wertyz-vue 3.10.21 → 3.10.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/wMapNext.js +1 -1
- package/dist/wertyzVue.js +1 -1
- package/package.json +1 -1
package/dist/wMapNext.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("ol/Map"),require("ol/View"),require("ol/proj"),require("ol/source"),require("ol/layer/Tile"),require("ol/source/Vector"),require("ol/layer/VectorImage"),require("ol/layer/Vector"),require("ol-ext/layer/AnimatedCluster"),require("ol/geom"),require("ol/Feature"),require("ol/style"),require("ol/Overlay"),require("ol/extent"),require("ol/interaction/Modify"),require("ol/interaction/Draw"),require("ol/events/condition"),require("ol-contextmenu/dist/ol-contextmenu.js")):"function"==typeof define&&define.amd?define("wertyzvue",["ol/Map","ol/View","ol/proj","ol/source","ol/layer/Tile","ol/source/Vector","ol/layer/VectorImage","ol/layer/Vector","ol-ext/layer/AnimatedCluster","ol/geom","ol/Feature","ol/style","ol/Overlay","ol/extent","ol/interaction/Modify","ol/interaction/Draw","ol/events/condition","ol-contextmenu/dist/ol-contextmenu.js"],e):"object"==typeof exports?exports.wertyzvue=e(require("ol/Map"),require("ol/View"),require("ol/proj"),require("ol/source"),require("ol/layer/Tile"),require("ol/source/Vector"),require("ol/layer/VectorImage"),require("ol/layer/Vector"),require("ol-ext/layer/AnimatedCluster"),require("ol/geom"),require("ol/Feature"),require("ol/style"),require("ol/Overlay"),require("ol/extent"),require("ol/interaction/Modify"),require("ol/interaction/Draw"),require("ol/events/condition"),require("ol-contextmenu/dist/ol-contextmenu.js")):t.wertyzvue=e(t["ol/Map"],t["ol/View"],t["ol/proj"],t["ol/source"],t["ol/layer/Tile"],t["ol/source/Vector"],t["ol/layer/VectorImage"],t["ol/layer/Vector"],t["ol-ext/layer/AnimatedCluster"],t["ol/geom"],t["ol/Feature"],t["ol/style"],t["ol/Overlay"],t["ol/extent"],t["ol/interaction/Modify"],t["ol/interaction/Draw"],t["ol/events/condition"],t["ol-contextmenu/dist/ol-contextmenu.js"])}(self,(t,i,n,s,r,o,a,l,h,c,u,d,g,f,p,_,m,y)=>(()=>{"use strict";var x={1005:t=>{t.exports=a},1189:t=>{t.exports=i},1273:t=>{t.exports=s},1849:t=>{t.exports=d},2085:t=>{t.exports=h},2418:t=>{t.exports=u},2617:t=>{t.exports=o},2948:t=>{t.exports=g},3139:t=>{t.exports=_},4275:t=>{t.exports=m},5327:t=>{t.exports=y},5922:t=>{t.exports=r},5993:t=>{t.exports=l},7604:t=>{t.exports=c},7963:t=>{t.exports=p},8218:e=>{e.exports=t},8407:t=>{t.exports=n},8432:t=>{t.exports=f}},S={};function v(t){var e=S[t];if(void 0!==e)return e.exports;var i=S[t]={exports:{}};return x[t](i,i.exports,v),i.exports}v.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return v.d(e,{a:e}),e},v.d=(t,e)=>{for(var i in e)v.o(e,i)&&!v.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},v.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),v.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var w={};v.r(w),v.d(w,{ClusterLayerWrapper:()=>ph,ContextMenuWrapper:()=>Fh,ContextMenuWrapperItem:()=>kh,Control:()=>Lh,DrawCircleWrapper:()=>Th,DrawPolygonWrapper:()=>bh,DrawWrapper:()=>Eh,FeatureCircleBuilder:()=>xh,FeatureLineStringBuilder:()=>Sh,FeaturePointBuilder:()=>mh,FeaturePolygonBuilder:()=>yh,GEOMETRY:()=>rh,Interaction:()=>Ih,LayerWrapper:()=>fh,MapControl:()=>Ah,MapProcessor:()=>uh,MapProcessorCluster:()=>dh,MapWrapper:()=>gh,ModifyWrapper:()=>Rh,OverlayWrapper:()=>vh,Processor:()=>ch,SelectWrapper:()=>Mh,calculateCentroid:()=>Ch,calculateDistance:()=>lh,calculateDistanceLine:()=>hh,calculateMidPoint:()=>wh,prepareLatitude:()=>oh,prepareLongitude:()=>ah});var C=v(8218),I=v.n(C),M=v(1189),R=v.n(M),E=v(8407),b=v(1273),T=v(5922),L=v.n(T),A=v(2617),k=v.n(A),F=v(1005),O=v.n(F),P=v(5993),D=v.n(P),W=v(2085),G=v.n(W),z=v(7604),B=v(2418),N=v.n(B),Y=v(1849),X=v(2948),V=v.n(X),Z=v(8432),j=v(7963),K=v.n(j),q=v(3139),$=v.n(q);const H="add",U="remove",J="propertychange",Q="change";const tt=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function et(t,e){return t>e?1:t<e?-1:0}function it(t,e){return t<e?1:t>e?-1:0}function nt(t,e,i){if(t[0]<=e)return 0;const n=t.length;if(e<=t[n-1])return n-1;if("function"==typeof i){for(let s=1;s<n;++s){const n=t[s];if(n===e)return s;if(n<e)return i(e,t[s-1],n)>0?s-1:s}return n-1}if(i>0){for(let i=1;i<n;++i)if(t[i]<e)return i-1;return n-1}if(i<0){for(let i=1;i<n;++i)if(t[i]<=e)return i;return n-1}for(let i=1;i<n;++i){if(t[i]==e)return i;if(t[i]<e)return t[i-1]-e<e-t[i]?i-1:i}return n-1}function st(t,e,i){for(;e<i;){const n=t[e];t[e]=t[i],t[i]=n,++e,--i}}function rt(t,e){const i=Array.isArray(e)?e:[e],n=i.length;for(let e=0;e<n;e++)t[t.length]=i[e]}function ot(t,e){const i=t.length;if(i!==e.length)return!1;for(let n=0;n<i;n++)if(t[n]!==e[n])return!1;return!0}function at(){return!0}function lt(){}function ht(t){for(const e in t)delete t[e]}function ct(t){let e;for(e in t)return!1;return!e}const ut=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};const dt=class extends tt{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e="string"==typeof t,i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const s=e?new ut(t):t;s.target||(s.target=this.eventTarget_||this);const r=this.dispatching_||(this.dispatching_={}),o=this.pendingRemovals_||(this.pendingRemovals_={});let a;i in r||(r[i]=0,o[i]=0),++r[i];for(let t=0,e=n.length;t<e;++t)if(a="handleEvent"in n[t]?n[t].handleEvent(s):n[t].call(this,s),!1===a||s.propagationStopped){a=!1;break}if(0===--r[i]){let t=o[i];for(delete o[i];t--;)this.removeEventListener(i,lt);delete r[i]}return a}disposeInternal(){this.listeners_&&ht(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return!!this.listeners_&&(t?t in this.listeners_:Object.keys(this.listeners_).length>0)}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=lt,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}};function gt(t,e,i,n,s){if(s){const s=i;i=function(r){return t.removeEventListener(e,i),s.call(n??this,r)}}else n&&n!==t&&(i=i.bind(n));const r={target:t,type:e,listener:i};return t.addEventListener(e,i),r}function ft(t,e,i,n){return gt(t,e,i,n,!0)}function pt(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),ht(t))}class _t extends dt{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(Q)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=gt(this,t[s],e);return n}return gt(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let s=0;s<n;++s)i[s]=ft(this,t[s],e)}else i=ft(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)!function(t){if(Array.isArray(t))for(let e=0,i=t.length;e<i;++e)pt(t[e]);else pt(t)}(i);else if(Array.isArray(t))for(let i=0,n=t.length;i<n;++i)this.removeEventListener(t[i],e);else this.removeEventListener(t,e)}}_t.prototype.on,_t.prototype.once,_t.prototype.un;const mt=_t;function yt(){throw new Error("Unimplemented abstract method.")}let xt=0;function St(t){return t.ol_uid||(t.ol_uid=String(++xt))}class vt extends ut{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}const wt=class extends mt{constructor(t){super(),this.on,this.once,this.un,St(this),this.values_=null,void 0!==t&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}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(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new vt(i,t,e)),i=J,this.hasListener(i)&&this.dispatchEvent(new vt(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const n=this.values_||(this.values_={});if(i)n[t]=e;else{const i=n[t];n[t]=e,i!==e&&this.notify(t,i)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],ct(this.values_)&&(this.values_=null),e||this.notify(t,i)}}},Ct="length";class It extends ut{constructor(t,e,i){super(t),this.element=e,this.index=i}}const Mt=class extends wt{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t||[],this.unique_)for(let t=0,e=this.array_.length;t<e;++t)this.assertUnique_(this.array_[t],t);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(Ct)}insertAt(t,e){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new It(H,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new It(U,e,t)),e}setAt(t,e){if(t>=this.getLength())return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const i=this.array_[t];this.array_[t]=e,this.dispatchEvent(new It(U,i,t)),this.dispatchEvent(new It(H,e,t))}updateLength_(){this.set(Ct,this.array_.length)}assertUnique_(t,e){for(let i=0,n=this.array_.length;i<n;++i)if(this.array_[i]===t&&i!==e)throw new Error("Duplicate item added to a unique collection")}};function Rt(t,e){if(!t)throw new Error(e)}class Et extends wt{constructor(t){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_),t)if("function"==typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new Et(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const i=this.getStyle();return i&&t.setStyle(i),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(pt(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=gt(t,Q,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?function(t){if("function"==typeof t)return t;let e;if(Array.isArray(t))e=t;else{Rt("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`");e=[t]}return function(){return e}}(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}const bt=Et,Tt="singleclick";const Lt=function(){return!1},At=function(t){return t.type==Tt},kt=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Ft=0,Ot=1,Pt=0,Dt=1,Wt=2,Gt=4,zt=8,Bt=16;function Nt(t,e,i){return i?(i[0]=t[0]-e,i[1]=t[1]-e,i[2]=t[2]+e,i[3]=t[3]+e,i):[t[0]-e,t[1]-e,t[2]+e,t[3]+e]}function Yt(t,e,i){let n,s;return n=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0,s=i<t[1]?t[1]-i:t[3]<i?i-t[3]:0,n*n+s*s}function Xt(t,e){return Zt(t,e[0],e[1])}function Vt(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function Zt(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function jt(t,e){const i=t[0],n=t[1],s=t[2],r=t[3],o=e[0],a=e[1];let l=Pt;return o<i?l|=Bt:o>s&&(l|=Gt),a<n?l|=zt:a>r&&(l|=Wt),l===Pt&&(l=Dt),l}function Kt(t,e,i,n,s){return s?(s[0]=t,s[1]=e,s[2]=i,s[3]=n,s):[t,e,i,n]}function qt(t){return Kt(1/0,1/0,-1/0,-1/0,t)}function $t(t,e){e[0]<t[0]&&(t[0]=e[0]),e[0]>t[2]&&(t[2]=e[0]),e[1]<t[1]&&(t[1]=e[1]),e[1]>t[3]&&(t[3]=e[1])}function Ht(t,e,i,n,s){for(;i<n;i+=s)Ut(t,e[i],e[i+1]);return t}function Ut(t,e,i){t[0]=Math.min(t[0],e),t[1]=Math.min(t[1],i),t[2]=Math.max(t[2],e),t[3]=Math.max(t[3],i)}function Jt(t){return[t[0],t[1]]}function Qt(t){return[t[2],t[1]]}function te(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function ee(t,e,i,n,s){const[r,o,a,l,h,c,u,d]=function(t,e,i,n){const s=e*n[0]/2,r=e*n[1]/2,o=Math.cos(i),a=Math.sin(i),l=s*o,h=s*a,c=r*o,u=r*a,d=t[0],g=t[1];return[d-l+u,g-h-c,d-l-u,g-h+c,d+l-u,g+h+c,d+l+u,g+h-c,d-l+u,g-h-c]}(t,e,i,n);return Kt(Math.min(r,a,h,u),Math.min(o,l,c,d),Math.max(r,a,h,u),Math.max(o,l,c,d),s)}function ie(t){return t[3]-t[1]}function ne(t){return[t[0],t[3]]}function se(t){return[t[2],t[3]]}function re(t){return t[2]-t[0]}function oe(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function ae(t){return t[2]<t[0]||t[3]<t[1]}function le(t,e,i,n){if(ae(t))return qt(i);let s=[];if(n>1){const e=t[2]-t[0],i=t[3]-t[1];for(let r=0;r<n;++r)s.push(t[0]+e*r/n,t[1],t[2],t[1]+i*r/n,t[2]-e*r/n,t[3],t[0],t[3]-i*r/n)}else s=[t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]];e(s,s,2);const r=[],o=[];for(let t=0,e=s.length;t<e;t+=2)r.push(s[t]),o.push(s[t+1]);return function(t,e,i){return Kt(Math.min.apply(null,t),Math.min.apply(null,e),Math.max.apply(null,t),Math.max.apply(null,e),i)}(r,o,i)}function he(t,e){const i=e.getExtent(),n=te(t);if(e.canWrapX()&&(n[0]<i[0]||n[0]>=i[2])){const e=re(i),s=Math.floor((n[0]-i[0])/e)*e;t[0]-=s,t[2]-=s}return t}function ce(t,e){let i=!0;for(let n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function ue(t,e){if(e.canWrapX()){const i=re(e.getExtent()),n=function(t,e,i){const n=e.getExtent();let s=0;e.canWrapX()&&(t[0]<n[0]||t[0]>n[2])&&(i=i||re(n),s=Math.floor((t[0]-n[0])/i));return s}(t,e,i);n&&(t[0]-=n*i)}return t}const de="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",ge=(de.includes("safari")&&!de.includes("chrom")&&(de.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(de)),de.includes("webkit")&&de.includes("edge"),de.includes("macintosh"),"undefined"!=typeof devicePixelRatio&&devicePixelRatio,"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope),fe="undefined"!=typeof Image&&Image.prototype.decode;!function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}}();function pe(t,e,i,n){let s;return s=i&&i.length?i.shift():ge?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(s.width=t),e&&(s.height=e),s.getContext("2d",n)}let _e;function me(){return _e||(_e=pe(1,1)),_e}const ye={info:1,warn:2,error:3,none:4};let xe=ye.info;const Se={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};const ve=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||Se[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}},we=6378137,Ce=Math.PI*we,Ie=[-Ce,-Ce,Ce,Ce],Me=[-180,-85,180,85],Re=we*Math.log(Math.tan(Math.PI/2));class Ee extends ve{constructor(t){super({code:t,units:"m",extent:Ie,global:!0,worldExtent:Me,getPointResolution:function(t,e){return t/Math.cosh(e[1]/we)}})}}const be=[new Ee("EPSG:3857"),new Ee("EPSG:102100"),new Ee("EPSG:102113"),new Ee("EPSG:900913"),new Ee("http://www.opengis.net/def/crs/EPSG/0/3857"),new Ee("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Te(t,e,i,n){const s=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(s));for(let i=0;i<s;i+=n){e[i]=Ce*t[i]/180;let n=we*Math.log(Math.tan(Math.PI*(+t[i+1]+90)/360));n>Re?n=Re:n<-Re&&(n=-Re),e[i+1]=n}return e}function Le(t,e,i,n){const s=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(s));for(let i=0;i<s;i+=n)e[i]=180*t[i]/Ce,e[i+1]=360*Math.atan(Math.exp(t[i+1]/we))/Math.PI-90;return e}const Ae=[-180,-90,180,90],ke=6378137*Math.PI/180;class Fe extends ve{constructor(t,e){super({code:t,units:"degrees",extent:Ae,axisOrientation:e,global:!0,metersPerUnit:ke,worldExtent:Ae})}}const Oe=[new Fe("CRS:84"),new Fe("EPSG:4326","neu"),new Fe("urn:ogc:def:crs:OGC:1.3:CRS84"),new Fe("urn:ogc:def:crs:OGC:2:84"),new Fe("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Fe("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Fe("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Pe={};let De={};function We(t,e,i){const n=t.getCode(),s=e.getCode();n in De||(De[n]={}),De[n][s]=i}function Ge(t,e){return t in De&&e in De[t]?De[t][e]:null}function ze(t,e,i){return Math.min(Math.max(t,e),i)}function Be(t,e,i,n,s,r){const o=s-i,a=r-n;if(0!==o||0!==a){const l=((t-i)*o+(e-n)*a)/(o*o+a*a);l>1?(i=s,n=r):l>0&&(i+=o*l,n+=a*l)}return Ne(t,e,i,n)}function Ne(t,e,i,n){const s=i-t,r=n-e;return s*s+r*r}function Ye(t){return 180*t/Math.PI}function Xe(t){return t*Math.PI/180}function Ve(t,e){const i=t%e;return i*e<0?i+e:i}function Ze(t,e,i){return t+i*(e-t)}function je(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function Ke(t,e,i){if(t>=e&&t<i)return t;const n=i-e;return((t-e)%n+n)%n+e}const qe=.9996,$e=.00669438,He=$e*$e,Ue=He*$e,Je=$e/(1-$e),Qe=Math.sqrt(1-$e),ti=(1-Qe)/(1+Qe),ei=ti*ti,ii=ei*ti,ni=ii*ti,si=ni*ti,ri=.9983242984503243,oi=15*He/256+45*Ue/1024,ai=35*Ue/3072,li=1.5*ti-27/32*ii+269/512*si,hi=21/16*ei-55/32*ni,ci=151/96*ii-417/128*si,ui=1097/512*ni,di=6378137;function gi(t,e,i){const n=t-5e5,s=(i.north?e:e-1e7)/qe/(di*ri),r=s+li*Math.sin(2*s)+hi*Math.sin(4*s)+ci*Math.sin(6*s)+ui*Math.sin(8*s),o=Math.sin(r),a=o*o,l=Math.cos(r),h=o/l,c=h*h,u=c*c,d=1-$e*a,g=Math.sqrt(1-$e*a),f=Je*l**2,p=f*f,_=n/(di/g*qe),m=_*_,y=m*_,x=y*_,S=x*_,v=r-h/((1-$e)/d)*(m/2-x/24*(5+3*c+10*f-4*p-9*Je))+S*_/720*(61+90*c+298*f+45*u-252*Je-3*p);let w=(_-y/6*(1+2*c+f)+S/120*(5-2*f+28*c-3*p+8*Je+24*u))/l;return w=Ke(w+Xe(pi(i.number)),-Math.PI,Math.PI),[Ye(w),Ye(v)]}function fi(t,e,i){t=Ke(t,-180,180),e<-80?e=-80:e>84&&(e=84);const n=Xe(e),s=Math.sin(n),r=Math.cos(n),o=s/r,a=o*o,l=a*a,h=Xe(t),c=Xe(pi(i.number)),u=di/Math.sqrt(1-$e*s**2),d=Je*r**2,g=r*Ke(h-c,-Math.PI,Math.PI),f=g*g,p=f*g,_=p*g,m=_*g,y=m*g,x=di*(ri*n-.002514607064228144*Math.sin(2*n)+oi*Math.sin(4*n)-ai*Math.sin(6*n)),S=qe*u*(g+p/6*(1-a+d)+m/120*(5-18*a+l+72*d-58*Je))+5e5;let v=qe*(x+u*o*(f/2+_/24*(5-a+9*d+4*d**2)+y/720*(61-58*a+l+600*d-330*Je)));return i.north||(v+=1e7),[S,v]}function pi(t){return 6*(t-1)-180+3}const _i=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function mi(t){let e=0;for(const i of _i){const n=t.match(i);if(n){e=parseInt(n[1]);break}}if(!e)return null;let i=0,n=!1;return e>32700&&e<32761?i=e-32700:e>32600&&e<32661&&(n=!0,i=e-32600),i?{number:i,north:n}:null}function yi(t,e){return function(i,n,s,r){const o=i.length;s=s>1?s:2,r=r??s,n||(n=s>2?i.slice():new Array(o));for(let s=0;s<o;s+=r){const r=i[s],o=i[s+1],a=t(r,o,e);n[s]=a[0],n[s+1]=a[1]}return n}}const xi=[function(t){const e=mi(t.getCode());return e?{forward:yi(fi,e),inverse:yi(gi,e)}:null}],Si=[function(t){return mi(t)?new ve({code:t,units:"m"}):null}];let vi=!0;function wi(t){vi=!(void 0===t||t)}function Ci(t,e){if(void 0!==e)for(let i=0,n=t.length;i<n;++i)e[i]=t[i];else e=t.slice();return e}function Ii(t){!function(t,e){Pe[t]=e}(t.getCode(),t),We(t,t,Ci)}function Mi(t){if("string"!=typeof t)return t;const e=Pe[i=t]||Pe[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null;var i;if(e)return e;for(const e of Si){const i=e(t);if(i)return i}return null}function Ri(t){!function(t){t.forEach(Ii)}(t),t.forEach(function(e){t.forEach(function(t){e!==t&&We(e,t,Ci)})})}function Ei(t,e){return t?"string"==typeof t?Mi(t):t:Mi(e)}function bi(t,e){const i=t.getCode(),n=e.getCode();let s=Ge(i,n);if(s)return s;let r=null,o=null;for(const i of xi)r||(r=i(t)),o||(o=i(e));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)s=Ti(r.inverse,o.forward);else{const t=Ge(i,a);t&&(s=Ti(t,o.forward))}else{const t=Ge(a,n);t&&(s=Ti(r.inverse,t))}return s&&(Ii(t),Ii(e),We(t,e,s)),s}function Ti(t,e){return function(i,n,s,r){return n=t(i,n,s,r),e(n,n,s,r)}}function Li(t,e){return bi(Mi(t),Mi(e))}function Ai(t,e,i){const n=Li(e,i);if(!n){const t=Mi(e).getCode(),n=Mi(i).getCode();throw new Error(`No transform available between ${t} and ${n}`)}return n(t,void 0,t.length)}function ki(t,e,i,n){return le(t,Li(e,i),void 0,n)}let Fi=null;function Oi(){return Fi}function Pi(t,e){return Fi?Ai(t,e,Fi):t}function Di(t,e){return Fi?Ai(t,Fi,e):(vi&&!ce(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(vi=!1,function(...t){xe>ye.warn||console.warn(...t)}("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t)}function Wi(t,e){return Fi?ki(t,e,Fi):t}function Gi(t,e){return Fi?ki(t,Fi,e):t}function zi(t,e){if(!Fi)return t;const i=Mi(e).getMetersPerUnit(),n=Fi.getMetersPerUnit();return i&&n?t*i/n:t}var Bi,Ni,Yi;Ri(be),Ri(Oe),Bi=be,Ni=Te,Yi=Le,Oe.forEach(function(t){Bi.forEach(function(e){We(t,e,Ni),We(e,t,Yi)})});const Xi="prerender",Vi="postrender",Zi="precompose",ji=0,Ki=1,qi=2,$i=3,Hi=[NaN,NaN,NaN,0];let Ui;const Ji=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Qi=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,tn=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,en=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function nn(t,e){return t.endsWith("%")?Number(t.substring(0,t.length-1))/e:Number(t)}function sn(t){throw new Error('failed to parse "'+t+'" as color')}function rn(t){if(t.toLowerCase().startsWith("rgb")){const e=t.match(Qi)||t.match(Ji)||t.match(tn);if(e){const t=e[4],i=100/255;return[ze(nn(e[1],i)+.5|0,0,255),ze(nn(e[2],i)+.5|0,0,255),ze(nn(e[3],i)+.5|0,0,255),void 0!==t?ze(nn(t,100),0,1):1]}sn(t)}if(t.startsWith("#")){if(en.test(t)){const e=t.substring(1),i=e.length<=4?1:2,n=[0,0,0,255];for(let t=0,s=e.length;t<s;t+=i){let s=parseInt(e.substring(t,t+i),16);1===i&&(s+=s<<4),n[t/i]=s}return n[3]=n[3]/255,n}sn(t)}const e=(Ui||(Ui=pe(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),Ui);e.fillStyle="#abcdef";let i=e.fillStyle;e.fillStyle=t,e.fillStyle===i&&(e.fillStyle="#fedcba",i=e.fillStyle,e.fillStyle=t,e.fillStyle===i&&sn(t));const n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return rn(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);const s=Array.from(e.getImageData(0,0,1,1).data);return s[3]=je(s[3]/255,3),s}const on={};let an=0;function ln(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function hn(t){return t>.0031308?269.025*Math.pow(t,1/2.4)-14.025:3294.6*t}function cn(t){return t>.2068965?Math.pow(t,3):108/841*(t-4/29)}function un(t){return t>10.314724?Math.pow((t+14.025)/269.025,2.4):t/3294.6}function dn(t){return t>.0088564?Math.pow(t,1/3):t/(108/841)+4/29}function gn(t){const e=un(t[0]),i=un(t[1]),n=un(t[2]),s=dn(.222488403*e+.716873169*i+.06060791*n),r=500*(dn(.452247074*e+.399439023*i+.148375274*n)-s),o=200*(s-dn(.016863605*e+.117638439*i+.865350722*n)),a=Math.atan2(o,r)*(180/Math.PI);return[116*s-16,Math.sqrt(r*r+o*o),a<0?a+360:a,t[3]]}function fn(t){if("none"===t)return Hi;if(on.hasOwnProperty(t))return on[t];if(an>=1024){let t=0;for(const e in on)3&t++||(delete on[e],--an)}const e=rn(t);4!==e.length&&sn(t);for(const i of e)isNaN(i)&&sn(t);return on[t]=e,++an,e}function pn(t){return Array.isArray(t)?t:fn(t)}function _n(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];n!=(0|n)&&(n=n+.5|0);return"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}function mn(t,e){return e&&(t.src=e),t.src&&fe?new Promise((e,i)=>t.decode().then(()=>e(t)).catch(n=>t.complete&&t.width?e(t):i(n))):function(t,e){return new Promise((i,n)=>{function s(){o(),i(t)}function r(){o(),n(new Error("Image load error"))}function o(){t.removeEventListener("load",s),t.removeEventListener("error",r)}t.addEventListener("load",s),t.addEventListener("error",r),e&&(t.src=e)})}(t)}class yn{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 t=0;for(const e in this.cache_){const i=this.cache_[e];3&t++||i.hasListener()||(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,i){const n=xn(t,e,i);return n in this.cache_?this.cache_[n]:null}getPattern(t,e,i){const n=xn(t,e,i);return n in this.patternCache_?this.patternCache_[n]:null}set(t,e,i,n,s){const r=xn(t,e,i),o=r in this.cache_;this.cache_[r]=n,s&&(n.getImageState()===ji&&n.load(),n.getImageState()===Ki?n.ready().then(()=>{this.patternCache_[r]=me().createPattern(n.getImage(1),"repeat")}):this.patternCache_[r]=me().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function xn(t,e,i){return e+":"+t+":"+(i?pn(i):"null")}const Sn=new yn;let vn=null;class wn extends dt{constructor(t,e,i,n,s){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=s,this.imageState_=void 0===n?ji:n,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(void 0===this.tainted_&&this.imageState_===qi){vn||(vn=pe(1,1,void 0,{willReadFrequently:!0})),vn.drawImage(this.image_,0,0);try{vn.getImageData(0,0,1,1),this.tainted_=!1}catch{vn=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(Q)}handleImageError_(){this.imageState_=$i,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=qi,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=pe(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===ji){this.image_||this.initializeImage_(),this.imageState_=Ki;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&mn(this.image_,this.src_).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==qi)return;const e=this.image_,i=pe(Math.ceil(e.width*t),Math.ceil(e.height*t)),n=i.canvas;var s;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle="string"==typeof(s=this.color_)?s:_n(s),i.fillRect(0,0,n.width/t,n.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=n}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===qi||this.imageState_===$i)t();else{const e=()=>{this.imageState_!==qi&&this.imageState_!==$i||(this.removeEventListener(Q,e),t())};this.addEventListener(Q,e)}})),this.ready_}}function Cn(t,e,i,n,s,r){let o=void 0===e?void 0:Sn.get(e,i,s);return o||(o=new wn(t,t&&"src"in t?t.src||void 0:e,i,n,s),Sn.set(e,i,s,o,r)),r&&o&&!Sn.getPattern(e,i,s)&&Sn.set(e,i,s,o,r),o}const In=wn;function Mn(t){return t?Array.isArray(t)?_n(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return Sn.getPattern(t.src,"anonymous",t.color);const e=t.src+":"+t.offset,i=Sn.getPattern(e,void 0,t.color);if(i)return i;const n=Sn.get(t.src,"anonymous",null);if(n.getImageState()!==qi)return null;const s=pe(t.size[0],t.size[1]);return s.drawImage(n.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),Cn(s.canvas,e,void 0,qi,t.color,!0),Sn.getPattern(e,void 0,t.color)}(t):t:null}function Rn(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=e;o<i;o+=n)s[r++]=t.slice(o,o+n);return s.length=r,s}function En(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];s[r++]=Rn(t,e,a,n,s[r]),e=a}return s.length=r,s}function bn(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];s[r++]=1===a.length&&a[0]===e?[]:En(t,e,a,n,s[r]),e=a[a.length-1]}return s.length=r,s}const Tn=class{drawCustom(t,e,i,n,s){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}},Ln=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"),An=["style","variant","weight","size","lineHeight","family"],kn={normal:400,bold:700},Fn=function(t){const e=t.match(Ln);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let t=0,n=An.length;t<n;++t){const n=e[t+1];void 0!==n&&(i[An[t]]="string"==typeof n?n.trim():n)}return isNaN(Number(i.weight))&&i.weight in kn&&(i.weight=kn[i.weight]),i.families=i.family.split(/,\s?/).map(t=>t.trim().replace(/^['"]|['"]$/g,"")),i},On="10px sans-serif",Pn="#000",Dn="round",Wn=[],Gn="round",zn="#000",Bn="center",Nn="middle",Yn=[0,0,0,0],Xn=new wt;let Vn,Zn=null;const jn={},Kn=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function qn(t,e,i){return`${t} ${e} 16px "${i}"`}const $n=function(){const t=100;let e,i;async function n(t){await i.ready;const e=await i.load(t);if(0===e.length)return!1;const n=Fn(t),s=n.families[0].toLowerCase(),r=n.weight;return e.some(t=>{const e=t.family.replace(/^['"]|['"]$/g,"").toLowerCase(),i=kn[t.weight]||t.weight;return e===s&&t.style===n.style&&i==r})}async function s(){await i.ready;let r=!0;const o=Xn.getProperties(),a=Object.keys(o).filter(e=>o[e]<t);for(let e=a.length-1;e>=0;--e){const i=a[e];let s=o[i];s<t&&(await n(i)?(ht(jn),Xn.set(i,t)):(s+=10,Xn.set(i,s,!0),s<t&&(r=!1)))}e=void 0,r||(e=setTimeout(s,100))}return async function(t){i||(i=ge?self.fonts:document.fonts);const n=Fn(t);if(!n)return;const r=n.families;let o=!1;for(const t of r){if(Kn.has(t))continue;const e=qn(n.style,n.weight,t);void 0===Xn.get(e)&&(Xn.set(e,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(s,100))}}(),Hn=function(){let t;return function(e){let i=jn[e];if(null==i){if(ge){const t=Fn(e),n=Un(e,"Žg");i=(isNaN(Number(t.lineHeight))?1.2:Number(t.lineHeight))*(n.actualBoundingBoxAscent+n.actualBoundingBoxDescent)}else t||(t=document.createElement("div"),t.innerHTML="M",t.style.minHeight="0",t.style.maxHeight="none",t.style.height="auto",t.style.padding="0",t.style.border="none",t.style.position="absolute",t.style.display="block",t.style.left="-99999px"),t.style.font=e,document.body.appendChild(t),i=t.offsetHeight,document.body.removeChild(t);jn[e]=i}return i}}();function Un(t,e){return Zn||(Zn=pe(1,1)),t!=Vn&&(Zn.font=t,Vn=Zn.font),Zn.measureText(e)}function Jn(t,e){return Un(t,e).width}function Qn(t,e,i){if(e in i)return i[e];const n=e.split("\n").reduce((e,i)=>Math.max(e,Jn(t,i)),0);return i[e]=n,n}function ts(t,e,i,n,s,r,o,a,l,h,c){t.save(),1!==i&&(void 0===t.globalAlpha?t.globalAlpha=t=>t.globalAlpha*=i:t.globalAlpha*=i),e&&t.transform.apply(t,e),n.contextInstructions?(t.translate(l,h),t.scale(c[0],c[1]),function(t,e){const i=t.contextInstructions;for(let t=0,n=i.length;t<n;t+=2)Array.isArray(i[t+1])?e[i[t]].apply(e,i[t+1]):e[i[t]]=i[t+1]}(n,t)):c[0]<0||c[1]<0?(t.translate(l,h),t.scale(c[0],c[1]),t.drawImage(n,s,r,o,a,0,0,o,a)):t.drawImage(n,s,r,o,a,l,h,o*c[0],a*c[1]),t.restore()}const es={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},is=[es.FILL],ns=[es.STROKE],ss=[es.BEGIN_PATH],rs=[es.CLOSE_PATH],os=es;const as=class extends Tn{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return 1==e?t:t.map(function(t){return t*e})}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,s=this.coordinates;let r=s.length;for(let o=0,a=t.length;o<a;o+=e)n[0]=t[o],n[1]=t[o+1],Xt(i,n)&&(s[r++]=n[0],s[r++]=n[1]);return r}appendFlatLineCoordinates(t,e,i,n,s,r){const o=this.coordinates;let a=o.length;const l=this.getBufferedMaxExtent();r&&(e+=n);let h=t[e],c=t[e+1];const u=this.tmpCoordinate_;let d,g,f,p=!0;for(d=e+n;d<i;d+=n)u[0]=t[d],u[1]=t[d+1],f=jt(l,u),f!==g?(p&&(o[a++]=h,o[a++]=c,p=!1),o[a++]=u[0],o[a++]=u[1]):f===Dt?(o[a++]=u[0],o[a++]=u[1],p=!1):p=!0,h=u[0],c=u[1],g=f;return(s&&p||d===e+n)&&(o[a++]=h,o[a++]=c),a}drawCustomCoordinates_(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r],a=this.appendFlatLineCoordinates(t,e,o,n,!1,!1);s.push(a),e=o}return e}drawCustom(t,e,i,n,s){this.beginGeometry(t,e,s);const r=t.getType(),o=t.getStride(),a=this.coordinates.length;let l,h,c,u,d;switch(r){case"MultiPolygon":l=t.getOrientedFlatCoordinates(),u=[];const e=t.getEndss();d=0;for(let t=0,i=e.length;t<i;++t){const i=[];d=this.drawCustomCoordinates_(l,d,e[t],o,i),u.push(i)}this.instructions.push([os.CUSTOM,a,u,t,i,bn,s]),this.hitDetectionInstructions.push([os.CUSTOM,a,u,t,n||i,bn,s]);break;case"Polygon":case"MultiLineString":c=[],l="Polygon"==r?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(l,0,t.getEnds(),o,c),this.instructions.push([os.CUSTOM,a,c,t,i,En,s]),this.hitDetectionInstructions.push([os.CUSTOM,a,c,t,n||i,En,s]);break;case"LineString":case"Circle":l=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([os.CUSTOM,a,h,t,i,Rn,s]),this.hitDetectionInstructions.push([os.CUSTOM,a,h,t,n||i,Rn,s]);break;case"MultiPoint":l=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(l,o),h>a&&(this.instructions.push([os.CUSTOM,a,h,t,i,Rn,s]),this.hitDetectionInstructions.push([os.CUSTOM,a,h,t,n||i,Rn,s]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([os.CUSTOM,a,h,t,i,void 0,s]),this.hitDetectionInstructions.push([os.CUSTOM,a,h,t,n||i,void 0,s])}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[os.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[os.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let n,s,r=-1;for(e=0;e<i;++e)n=t[e],s=n[0],s==os.END_GEOMETRY?r=e:s==os.BEGIN_GEOMETRY&&(n[2]=e,st(this.hitDetectionInstructions,r,e),r=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&"object"==typeof i&&"src"in i?this.pixelRatio:1,e.fillStyle=Mn(i||Pn)}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=Mn(i||zn);const n=t.getLineCap();e.lineCap=void 0!==n?n:Dn;const s=t.getLineDash();e.lineDash=s?s.slice():Wn;const r=t.getLineDashOffset();e.lineDashOffset=r||0;const o=t.getLineJoin();e.lineJoin=void 0!==o?o:Gn;const a=t.getWidth();e.lineWidth=void 0!==a?a:1;const l=t.getMiterLimit();e.miterLimit=void 0!==l?l:10,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[os.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[os.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;"string"==typeof i&&t.currentFillStyle==i||(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,s=t.lineDash,r=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||s!=t.currentLineDash&&!ot(t.currentLineDash,s)||t.currentLineDashOffset!=r||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=s,t.currentLineDashOffset=r,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[os.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=(t=this.maxExtent,e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t.slice()),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;Nt(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}var t,e;return this.bufferedMaxExtent_}};const ls=class extends as{constructor(t,e,i,n){super(t,e,i,n),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(t,e,i){if(!this.image_||this.maxExtent&&!Xt(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),s=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(n,s);this.instructions.push([os.DRAW_IMAGE,r,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([os.DRAW_IMAGE,r,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(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),s=[];for(let e=0,i=n.length;e<i;e+=t.getStride())this.maxExtent&&!Xt(this.maxExtent,n.slice(e,e+2))||s.push(n[e],n[e+1]);const r=this.coordinates.length,o=this.appendFlatPointCoordinates(s,2);this.instructions.push([os.DRAW_IMAGE,r,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([os.DRAW_IMAGE,r,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(e)}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(t,e){const i=t.getAnchor(),n=t.getSize(),s=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}};const hs=class extends as{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n){const s=this.coordinates.length,r=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),o=[os.MOVE_TO_LINE_TO,s,r];return this.instructions.push(o),this.hitDetectionInstructions.push(o),i}drawLineString(t,e,i){const n=this.state,s=n.strokeStyle,r=n.lineWidth;if(void 0===s||void 0===r)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([os.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Wn,0],ss);const o=t.getFlatCoordinates(),a=t.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push(ns),this.endGeometry(e)}drawMultiLineString(t,e,i){const n=this.state,s=n.strokeStyle,r=n.lineWidth;if(void 0===s||void 0===r)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([os.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Wn,0],ss);const o=t.getEnds(),a=t.getFlatCoordinates(),l=t.getStride();let h=0;for(let t=0,e=o.length;t<e;++t)h=this.drawFlatCoordinates_(a,h,o[t],l);this.hitDetectionInstructions.push(ns),this.endGeometry(e)}finish(){const t=this.state;return null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(ns),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(ns),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(ss)}};function cs(t,e,i,n,s,r,o){const a=(i-e)/n;if(a<3){for(;e<i;e+=n)r[o++]=t[e],r[o++]=t[e+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[e,i-n];let c=0;for(;h.length>0;){const i=h.pop(),r=h.pop();let o=0;const a=t[r],u=t[r+1],d=t[i],g=t[i+1];for(let e=r+n;e<i;e+=n){const i=Be(t[e],t[e+1],a,u,d,g);i>o&&(c=e,o=i)}o>s&&(l[(c-e)/n]=1,r+n<c&&h.push(r,c),c+n<i&&h.push(c,i))}for(let i=0;i<a;++i)l[i]&&(r[o++]=t[e+i*n],r[o++]=t[e+i*n+1]);return o}function us(t,e){return e*Math.round(t/e)}function ds(t,e,i,n,s,r,o){if(e==i)return o;let a,l,h=us(t[e],s),c=us(t[e+1],s);e+=n,r[o++]=h,r[o++]=c;do{if(a=us(t[e],s),l=us(t[e+1],s),(e+=n)==i)return r[o++]=a,r[o++]=l,o}while(a==h&&l==c);for(;e<i;){const i=us(t[e],s),u=us(t[e+1],s);if(e+=n,i==a&&u==l)continue;const d=a-h,g=l-c,f=i-h,p=u-c;d*p==g*f&&(d<0&&f<d||d==f||d>0&&f>d)&&(g<0&&p<g||g==p||g>0&&p>g)?(a=i,l=u):(r[o++]=a,r[o++]=l,h=a,c=l,a=i,l=u)}return r[o++]=a,r[o++]=l,o}function gs(t,e,i,n,s,r,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=ds(t,e,h,n,s,r,o),a.push(o),e=h}return o}const fs=class extends as{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinatess_(t,e,i,n){const s=this.state,r=void 0!==s.fillStyle,o=void 0!==s.strokeStyle,a=i.length;this.instructions.push(ss),this.hitDetectionInstructions.push(ss);for(let s=0;s<a;++s){const r=i[s],a=this.coordinates.length,l=this.appendFlatLineCoordinates(t,e,r,n,!0,!o),h=[os.MOVE_TO_LINE_TO,a,l];this.instructions.push(h),this.hitDetectionInstructions.push(h),o&&(this.instructions.push(rs),this.hitDetectionInstructions.push(rs)),e=r}return r&&(this.instructions.push(is),this.hitDetectionInstructions.push(is)),o&&(this.instructions.push(ns),this.hitDetectionInstructions.push(ns)),e}drawCircle(t,e,i){const n=this.state,s=n.fillStyle,r=n.strokeStyle;if(void 0===s&&void 0===r)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([os.SET_FILL_STYLE,Pn]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([os.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Wn,0]);const o=t.getFlatCoordinates(),a=t.getStride(),l=this.coordinates.length;this.appendFlatLineCoordinates(o,0,o.length,a,!1,!1);const h=[os.CIRCLE,l];this.instructions.push(ss,h),this.hitDetectionInstructions.push(ss,h),void 0!==n.fillStyle&&(this.instructions.push(is),this.hitDetectionInstructions.push(is)),void 0!==n.strokeStyle&&(this.instructions.push(ns),this.hitDetectionInstructions.push(ns)),this.endGeometry(e)}drawPolygon(t,e,i){const n=this.state,s=n.fillStyle,r=n.strokeStyle;if(void 0===s&&void 0===r)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([os.SET_FILL_STYLE,Pn]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([os.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Wn,0]);const o=t.getEnds(),a=t.getOrientedFlatCoordinates(),l=t.getStride();this.drawFlatCoordinatess_(a,0,o,l),this.endGeometry(e)}drawMultiPolygon(t,e,i){const n=this.state,s=n.fillStyle,r=n.strokeStyle;if(void 0===s&&void 0===r)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([os.SET_FILL_STYLE,Pn]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([os.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Wn,0]);const o=t.getEndss(),a=t.getOrientedFlatCoordinates(),l=t.getStride();let h=0;for(let t=0,e=o.length;t<e;++t)h=this.drawFlatCoordinatess_(a,h,o[t],l);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(0!==t){const e=this.coordinates;for(let i=0,n=e.length;i<n;++i)e[i]=us(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}};function ps(t,e,i,n,s){const r=[];let o=i,a=0,l=e.slice(i,2);for(;a<t&&o+s<n;){const[i,n]=l.slice(-2),h=e[o+s],c=e[o+s+1],u=Math.sqrt((h-i)*(h-i)+(c-n)*(c-n));if(a+=u,a>=t){const e=(t-a+u)/u,d=Ze(i,h,e),g=Ze(n,c,e);l.push(d,g),r.push(l),l=[d,g],a==t&&(o+=s),a=0}else if(a<t)l.push(e[o+s],e[o+s+1]),o+=s;else{const t=u-a,e=Ze(i,h,t/u),d=Ze(n,c,t/u);l.push(e,d),r.push(l),l=[e,d],a=0,o+=s}}return a>0&&r.push(l),r}function _s(t,e,i,n,s){let r,o,a,l,h,c,u,d,g,f,p=i,_=i,m=0,y=0,x=i;for(o=i;o<n;o+=s){const i=e[o],n=e[o+1];void 0!==h&&(g=i-h,f=n-c,l=Math.sqrt(g*g+f*f),void 0!==u&&(y+=a,r=Math.acos((u*g+d*f)/(a*l)),r>t&&(y>m&&(m=y,p=x,_=o),y=0,x=o-s)),a=l,u=g,d=f),h=i,c=n}return y+=l,y>m?[x,o]:[p,_]}const ms={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};const ys=class extends as{constructor(t,e,i,n){super(t,e,i,n),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[Pn]={fillStyle:Pn},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){const n=this.textFillState_,s=this.textStrokeState_,r=this.textState_;if(""===this.text_||!r||!n&&!s)return;const o=this.coordinates;let a=o.length;const l=t.getType();let h=null,c=t.getStride();if("line"!==r.placement||"LineString"!=l&&"MultiLineString"!=l&&"Polygon"!=l&&"MultiPolygon"!=l){let n=r.overflow?null:[];switch(l){case"Point":case"MultiPoint":h=t.getFlatCoordinates();break;case"LineString":h=t.getFlatMidpoint();break;case"Circle":h=t.getCenter();break;case"MultiLineString":h=t.getFlatMidpoints(),c=2;break;case"Polygon":h=t.getFlatInteriorPoint(),r.overflow||n.push(h[2]/this.resolution),c=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();h=[];for(let t=0,i=e.length;t<i;t+=3)r.overflow||n.push(e[t+2]/this.resolution),h.push(e[t],e[t+1]);if(0===h.length)return;c=2}const s=this.appendFlatPointCoordinates(h,c);if(s===a)return;if(n&&(s-a)/2!==h.length/c){let t=a/2;n=n.filter((e,i)=>{const n=o[2*(t+i)]===h[i*c]&&o[2*(t+i)+1]===h[i*c+1];return n||--t,n})}this.saveTextStates_();const u=r.backgroundFill?this.createFill(this.fillStyleToState(r.backgroundFill)):null,d=r.backgroundStroke?this.createStroke(this.strokeStyleToState(r.backgroundStroke)):null;this.beginGeometry(t,e,i);let g=r.padding;if(g!=Yn&&(r.scale[0]<0||r.scale[1]<0)){let t=r.padding[0],e=r.padding[1],i=r.padding[2],n=r.padding[3];r.scale[0]<0&&(e=-e,n=-n),r.scale[1]<0&&(t=-t,i=-i),g=[t,e,i,n]}const f=this.pixelRatio;this.instructions.push([os.DRAW_IMAGE,a,s,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,g==Yn?Yn:g.map(function(t){return t*f}),u,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]);const p=1/f,_=u?u.slice(0):null;_&&(_[1]=Pn),this.hitDetectionInstructions.push([os.DRAW_IMAGE,a,s,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[p,p],NaN,this.declutterMode_,this.declutterImageWithText_,g,_,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Pn:this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]),this.endGeometry(e)}else{if(!oe(this.maxExtent,t.getExtent()))return;let n;if(h=t.getFlatCoordinates(),"LineString"==l)n=[h.length];else if("MultiLineString"==l)n=t.getEnds();else if("Polygon"==l)n=t.getEnds().slice(0,1);else if("MultiPolygon"==l){const e=t.getEndss();n=[];for(let t=0,i=e.length;t<i;++t)n.push(e[t][0])}this.beginGeometry(t,e,i);const s=r.repeat,u=s?void 0:r.textAlign;let d=0;for(let t=0,e=n.length;t<e;++t){let e;e=s?ps(s*this.resolution,h,d,n[t],c):[h.slice(d,n[t])];for(let i=0,s=e.length;i<s;++i){const s=e[i];let l=0,h=s.length;if(null==u){const t=_s(r.maxAngle,s,0,s.length,2);l=t[0],h=t[1]}for(let t=l;t<h;t+=c)o.push(s[t],s[t+1]);const g=o.length;d=n[t],this.drawChars_(a,g),a=g}}this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,n=this.strokeKey_;t&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const s=this.textKey_;s in this.textStates||(this.textStates[s]={font:e.font,textAlign:e.textAlign||Bn,justify:e.justify,textBaseline:e.textBaseline||Nn,scale:e.scale});const r=this.fillKey_;i&&(r in this.fillStates||(this.fillStates[r]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,s=this.strokeKey_,r=this.textKey_,o=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,l=ms[n.textBaseline],h=this.textOffsetY_*a,c=this.text_,u=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([os.DRAW_CHARS,t,e,l,n.overflow,o,n.maxAngle,a,h,s,u*a,c,r,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([os.DRAW_CHARS,t,e,l,n.overflow,o?Pn:o,n.maxAngle,a,h,s,u*a,c,r,1/a,this.declutterMode_,this.textKeepUpright_])}setTextStyle(t,e){let i,n,s;if(t){const e=t.getFill();e?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=Mn(e.getColor()||Pn)):(n=null,this.textFillState_=n);const r=t.getStroke();if(r){s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);const t=r.getLineDash(),e=r.getLineDashOffset(),i=r.getWidth(),n=r.getMiterLimit();s.lineCap=r.getLineCap()||Dn,s.lineDash=t?t.slice():Wn,s.lineDashOffset=void 0===e?0:e,s.lineJoin=r.getLineJoin()||Gn,s.lineWidth=void 0===i?1:i,s.miterLimit=void 0===n?10:n,s.strokeStyle=Mn(r.getColor()||zn)}else s=null,this.textStrokeState_=s;i=this.textState_;const o=t.getFont()||On;$n(o);const a=t.getScaleArray();i.overflow=t.getOverflow(),i.font=o,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||Nn,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||Yn,i.scale=void 0===a?[1,1]:a;const l=t.getOffsetX(),h=t.getOffsetY(),c=t.getRotateWithView(),u=t.getKeepUpright(),d=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=void 0===l?0:l,this.textOffsetY_=void 0===h?0:h,this.textRotateWithView_=void 0!==c&&c,this.textKeepUpright_=void 0===u||u,this.textRotation_=void 0===d?0:d,this.strokeKey_=s?("string"==typeof s.strokeStyle?s.strokeStyle:St(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=n&&n.fillStyle?"string"==typeof n.fillStyle?n.fillStyle:"|"+St(n.fillStyle):""}else this.text_="";this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}},xs={Circle:fs,Default:as,Image:ls,LineString:hs,Polygon:fs,Text:ys};const Ss=class{constructor(t,e,i,n){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=n,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const n in i){const s=i[n].finish();t[e][n]=s}}return t}getBuilder(t,e){const i=void 0!==t?t.toString():"0";let n=this.buildersByZIndex_[i];void 0===n&&(n={},this.buildersByZIndex_[i]=n);let s=n[e];if(void 0===s){s=new(0,xs[e])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=s}return s}};function vs(t,e,i,n,s,r,o){r=r||[],o=o||2;let a=0;for(let l=e;l<i;l+=n){const e=t[l],i=t[l+1];r[a++]=s[0]*e+s[2]*i+s[4],r[a++]=s[1]*e+s[3]*i+s[5];for(let e=2;e<o;e++)r[a++]=t[l+e]}return r&&r.length!=a&&(r.length=a),r}function ws(t,e,i,n,s,r,o){o=o||[];const a=Math.cos(s),l=Math.sin(s),h=r[0],c=r[1];let u=0;for(let s=e;s<i;s+=n){const e=t[s]-h,i=t[s+1]-c;o[u++]=h+e*a-i*l,o[u++]=c+e*l+i*a;for(let e=s+2;e<s+n;++e)o[u++]=t[e]}return o&&o.length!=u&&(o.length=u),o}new Array(6);function Cs(t,e){const i=e[0],n=e[1];return e[0]=t[0]*i+t[2]*n+t[4],e[1]=t[1]*i+t[3]*n+t[5],e}function Is(t,e,i,n,s,r,o,a){const l=Math.sin(r),h=Math.cos(r);return t[0]=n*h,t[1]=s*l,t[2]=-n*l,t[3]=s*h,t[4]=o*n*h-a*n*l+e,t[5]=o*s*l+a*s*h+i,t}function Ms(t,e){const i=(n=e)[0]*n[3]-n[1]*n[2];var n;Rt(0!==i,"Transformation matrix cannot be inverted");const s=e[0],r=e[1],o=e[2],a=e[3],l=e[4],h=e[5];return t[0]=a/i,t[1]=-r/i,t[2]=-o/i,t[3]=s/i,t[4]=(o*h-a*l)/i,t[5]=-(s*h-r*l)/i,t}const Rs=[1e5,1e5,1e5,1e5,2,2];function Es(t){return"matrix("+t.join(", ")+")"}function bs(t){return t.substring(7,t.length-1).split(",").map(parseFloat)}function Ts(t,e,i,n){let s=t[e],r=t[e+1],o=0;for(let a=e+n;a<i;a+=n){const e=t[a],i=t[a+1];o+=Math.sqrt((e-s)*(e-s)+(i-r)*(i-r)),s=e,r=i}return o}function Ls(t,e,i,n,s,r,o,a,l,h,c,u,d=!0){let g=t[e],f=t[e+1],p=0,_=0,m=0,y=0;function x(){p=g,_=f,g=t[e+=n],f=t[e+1],y+=m,m=Math.sqrt((g-p)*(g-p)+(f-_)*(f-_))}do{x()}while(e<i-n&&y+m<r);let S=0===m?0:(r-y)/m;const v=Ze(p,g,S),w=Ze(_,f,S),C=e-n,I=y,M=r+a*l(h,s,c);for(;e<i-n&&y+m<M;)x();S=0===m?0:(M-y)/m;const R=Ze(p,g,S),E=Ze(_,f,S);let b=!1;if(d)if(u){const t=[v,w,R,E];ws(t,0,4,2,u,t,t),b=t[0]>t[2]}else b=v>R;const T=Math.PI,L=[],A=C+n===e;let k;if(m=0,y=I,g=t[e=C],f=t[e+1],A){x(),k=Math.atan2(f-_,g-p),b&&(k+=k>0?-T:T);const t=(R+v)/2,e=(E+w)/2;return L[0]=[t,e,(M-r)/2,k,s],L}for(let t=0,u=(s=s.replace(/\n/g," ")).length;t<u;){x();let d=Math.atan2(f-_,g-p);if(b&&(d+=d>0?-T:T),void 0!==k){let t=d-k;if(t+=t>T?-2*T:t<-T?2*T:0,Math.abs(t)>o)return null}k=d;const v=t;let w=0;for(;t<u;++t){const o=a*l(h,s[b?u-t-1:t],c);if(e+n<i&&y+m<r+w+o/2)break;w+=o}if(t===v)continue;const C=b?s.substring(u-v,u-t):s.substring(v,t);S=0===m?0:(r+w/2-y)/m;const I=Ze(p,g,S),M=Ze(_,f,S);L.push([I,M,w/2,d,C]),r+=w}return L}const As=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(me(),{get:(t,e)=>{if("function"==typeof me()[e])return this.push_(e),this.pushMethodArgs_},set:(t,e,i)=>(this.push_(e,i),!0)})}push_(...t){const e=this.instructions_,i=this.zIndex+this.offset_;e[i]||(e[i]=[]),e[i].push(...t)}pushMethodArgs_=(...t)=>(this.push_(t),this);pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let i=0,n=e.length;i<n;++i){const n=e[i];if("function"==typeof n){n(t);continue}const s=e[++i];if("function"==typeof t[n])t[n](...s);else{if("function"==typeof s){t[n]=s(t);continue}t[n]=s}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},ks=[1/0,1/0,-1/0,-1/0],Fs=[],Os=[],Ps=[],Ds=[];function Ws(t){return t[3].declutterBox}const Gs=new RegExp("["+String.fromCharCode(1425)+"-"+String.fromCharCode(2303)+String.fromCharCode(64285)+"-"+String.fromCharCode(65023)+String.fromCharCode(65136)+"-"+String.fromCharCode(65276)+String.fromCharCode(67584)+"-"+String.fromCharCode(69631)+String.fromCharCode(124928)+"-"+String.fromCharCode(126975)+"]");function zs(t,e){return"start"===e?e=Gs.test(t)?"right":"left":"end"===e&&(e=Gs.test(t)?"left":"right"),ms[e]}function Bs(t,e,i){return i>0&&t.push("\n",""),t.push(e,""),t}function Ns(t,e,i){return i%2==0&&(t+=e),t}const Ys=class{constructor(t,e,i,n,s){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=s?new As:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,n){const s=t+e+i+n;if(this.labels_[s])return this.labels_[s];const r=n?this.strokeStates[n]:null,o=i?this.fillStates[i]:null,a=this.textStates[e],l=this.pixelRatio,h=[a.scale[0]*l,a.scale[1]*l],c=a.justify?ms[a.justify]:zs(Array.isArray(t)?t[0]:t,a.textAlign||Bn),u=n&&r.lineWidth?r.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(Bs,[]),{width:g,height:f,widths:p,heights:_,lineWidths:m}=function(t,e){const i=[],n=[],s=[];let r=0,o=0,a=0,l=0;for(let h=0,c=e.length;h<=c;h+=2){const u=e[h];if("\n"===u||h===c){r=Math.max(r,o),s.push(o),o=0,a+=l,l=0;continue}const d=e[h+1]||t.font,g=Jn(d,u);i.push(g),o+=g;const f=Hn(d);n.push(f),l=Math.max(l,f)}return{width:r,height:a,widths:i,heights:n,lineWidths:s}}(a,d),y=g+u,x=[],S=(y+2)*h[0],v=(f+u)*h[1],w={width:S<0?Math.floor(S):Math.ceil(S),height:v<0?Math.floor(v):Math.ceil(v),contextInstructions:x};1==h[0]&&1==h[1]||x.push("scale",h),n&&(x.push("strokeStyle",r.strokeStyle),x.push("lineWidth",u),x.push("lineCap",r.lineCap),x.push("lineJoin",r.lineJoin),x.push("miterLimit",r.miterLimit),x.push("setLineDash",[r.lineDash]),x.push("lineDashOffset",r.lineDashOffset)),i&&x.push("fillStyle",o.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const C=.5-c;let I=c*y+C*u;const M=[],R=[];let E,b=0,T=0,L=0,A=0;for(let t=0,e=d.length;t<e;t+=2){const e=d[t];if("\n"===e){T+=b,b=0,I=c*y+C*u,++A;continue}const s=d[t+1]||a.font;s!==E&&(n&&M.push("font",s),i&&R.push("font",s),E=s),b=Math.max(b,_[L]);const r=[e,I+C*p[L]+c*(p[L]-m[A]),.5*(u+b)+T];I+=p[L],n&&M.push("strokeText",r),i&&R.push("fillText",r),++L}return Array.prototype.push.apply(x,M),Array.prototype.push.apply(x,R),this.labels_[s]=w,w}replayTextBackground_(t,e,i,n,s,r,o){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,n),t.lineTo.apply(t,s),t.lineTo.apply(t,e),r&&(this.alignAndScaleFill_=r[2],t.fillStyle=r[1],this.fill_(t)),o&&(this.setStrokeStyle_(t,o),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,n,s,r,o,a,l,h,c,u,d,g,f,p){let _=i-(o*=u[0]),m=n-(a*=u[1]);const y=s+l>t?t-l:s,x=r+h>e?e-h:r,S=g[3]+y*u[0]+g[1],v=g[0]+x*u[1]+g[2],w=_-g[3],C=m-g[0];let I;return(f||0!==c)&&(Fs[0]=w,Ds[0]=w,Fs[1]=C,Os[1]=C,Os[0]=w+S,Ps[0]=Os[0],Ps[1]=C+v,Ds[1]=Ps[1]),0!==c?(I=Is([1,0,0,1,0,0],i,n,1,1,c,-i,-n),Cs(I,Fs),Cs(I,Os),Cs(I,Ps),Cs(I,Ds),Kt(Math.min(Fs[0],Os[0],Ps[0],Ds[0]),Math.min(Fs[1],Os[1],Ps[1],Ds[1]),Math.max(Fs[0],Os[0],Ps[0],Ds[0]),Math.max(Fs[1],Os[1],Ps[1],Ds[1]),ks)):Kt(Math.min(w,w+S),Math.min(C,C+v),Math.max(w,w+S),Math.max(C,C+v),ks),d&&(_=Math.round(_),m=Math.round(m)),{drawImageX:_,drawImageY:m,drawImageW:y,drawImageH:x,originX:l,originY:h,declutterBox:{minX:ks[0],minY:ks[1],maxX:ks[2],maxY:ks[3],value:p},canvasTransform:I,scale:u}}replayImageOrLabel_(t,e,i,n,s,r,o){const a=!(!r&&!o),l=n.declutterBox,h=o?o[2]*n.scale[0]/2:0;return l.minX-h<=e[0]&&l.maxX+h>=0&&l.minY-h<=e[1]&&l.maxY+h>=0&&(a&&this.replayTextBackground_(t,Fs,Os,Ps,Ds,r,o),ts(t,n.canvasTransform,s,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=Cs(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(i[0]%n,i[1]%n),1!==e&&t.scale(e,e),t.rotate(this.viewRotation_)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,n){const s=this.textStates[e],r=this.createLabel(t,e,n,i),o=this.strokeStates[i],a=this.pixelRatio,l=zs(Array.isArray(t)?t[0]:t,s.textAlign||Bn),h=ms[s.textBaseline||Nn],c=o&&o.lineWidth?o.lineWidth:0;return{label:r,anchorX:l*(r.width/a-2*s.scale[0])+2*(.5-l)*c,anchorY:h*r.height/a+2*(.5-h)*c}}execute_(t,e,i,n,s,r,o,a){const l=this.zIndexContext_;let h;var c,u;this.pixelCoordinates_&&ot(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=vs(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),c=this.renderedTransform_,u=i,c[0]=u[0],c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5]);let d=0;const g=n.length;let f,p,_,m,y,x,S,v,w,C,I,M,R,E=0,b=0,T=0;const L=this.coordinateCache_,A=this.viewRotation_,k=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,F={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:A},O=this.instructions!=n||this.overlaps?0:200;let P,D,W,G;for(;d<g;){const i=n[d];switch(i[0]){case os.BEGIN_GEOMETRY:P=i[1],G=i[3],P.getGeometry()?void 0===o||oe(o,G.getExtent())?++d:d=i[2]+1:d=i[2],l&&(l.zIndex=i[4]);break;case os.BEGIN_PATH:b>O&&(this.fill_(t),b=0),T>O&&(t.stroke(),T=0),b||T||(t.beginPath(),y=NaN,x=NaN),++d;break;case os.CIRCLE:E=i[1];const n=h[E],c=h[E+1],u=h[E+2]-n,g=h[E+3]-c,z=Math.sqrt(u*u+g*g);t.moveTo(n+z,c),t.arc(n,c,z,0,2*Math.PI,!0),++d;break;case os.CLOSE_PATH:t.closePath(),++d;break;case os.CUSTOM:E=i[1],f=i[2];const B=i[3],N=i[4],Y=i[5];F.geometry=B,F.feature=P,d in L||(L[d]=[]);const X=L[d];Y?Y(h,E,f,2,X):(X[0]=h[E],X[1]=h[E+1],X.length=2),l&&(l.zIndex=i[6]),N(X,F),++d;break;case os.DRAW_IMAGE:E=i[1],f=i[2],w=i[3],p=i[4],_=i[5];let V=i[6];const Z=i[7],j=i[8],K=i[9],q=i[10];let $=i[11];const H=i[12];let U=i[13];m=i[14]||"declutter";const J=i[15];if(!w&&i.length>=20){C=i[19],I=i[20],M=i[21],R=i[22];const t=this.drawLabelWithPointPlacement_(C,I,M,R);w=t.label,i[3]=w;const e=i[23];p=(t.anchorX-e)*this.pixelRatio,i[4]=p;const n=i[24];_=(t.anchorY-n)*this.pixelRatio,i[5]=_,V=w.height,i[6]=V,U=w.width,i[13]=U}let Q,tt,et,it;i.length>25&&(Q=i[25]),i.length>17?(tt=i[16],et=i[17],it=i[18]):(tt=Yn,et=null,it=null),q&&k?$+=A:q||k||($-=A);let nt=0;for(;E<f;E+=2){if(Q&&Q[nt++]<U/this.pixelRatio)continue;const i=this.calculateImageOrLabelDimensions_(w.width,w.height,h[E],h[E+1],U,V,p,_,j,K,$,H,s,tt,!!et||!!it,P),n=[t,e,w,i,Z,et,it];if(a){let t,e,s,r,o;if(J){const i=f-E;if(!J[i]){J[i]={args:n,declutterMode:m};continue}const r=J[i];t=r.args,e=r.declutterMode,delete J[i],s=Ws(t)}if(!t||"declutter"===e&&a.collides(s)||(r=!0),"declutter"===m&&a.collides(i.declutterBox)||(o=!0),"declutter"===e&&"declutter"===m){const t=r&&o;r=t,o=t}r&&("none"!==e&&a.insert(s),this.replayImageOrLabel_.apply(this,t)),o&&("none"!==m&&a.insert(i.declutterBox),this.replayImageOrLabel_.apply(this,n))}else this.replayImageOrLabel_.apply(this,n)}++d;break;case os.DRAW_CHARS:const st=i[1],rt=i[2],ot=i[3],at=i[4];R=i[5];const lt=i[6],ht=i[7],ct=i[8];M=i[9];const ut=i[10];C=i[11],Array.isArray(C)&&(C=C.reduce(Ns,"")),I=i[12];const dt=[i[13],i[13]];m=i[14]||"declutter";const gt=i[15],ft=this.textStates[I],pt=ft.font,_t=[ft.scale[0]*ht,ft.scale[1]*ht];let mt;pt in this.widths_?mt=this.widths_[pt]:(mt={},this.widths_[pt]=mt);const yt=Ts(h,st,rt,2),xt=Math.abs(_t[0])*Qn(pt,C,mt);if(at||xt<=yt){const i=Ls(h,st,rt,2,C,(yt-xt)*zs(C,this.textStates[I].textAlign),lt,Math.abs(_t[0]),Qn,pt,mt,k?0:this.viewRotation_,gt);t:if(i){const n=[];let s,r,o,l,h;if(M)for(s=0,r=i.length;s<r;++s){h=i[s],o=h[4],l=this.createLabel(o,I,"",M),p=h[2]+(_t[0]<0?-ut:ut),_=ot*l.height+2*(.5-ot)*ut*_t[1]/_t[0]-ct;const r=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,p,_,0,0,h[3],dt,!1,Yn,!1,P);if(a&&"declutter"===m&&a.collides(r.declutterBox))break t;n.push([t,e,l,r,1,null,null])}if(R)for(s=0,r=i.length;s<r;++s){h=i[s],o=h[4],l=this.createLabel(o,I,R,""),p=h[2],_=ot*l.height-ct;const r=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,p,_,0,0,h[3],dt,!1,Yn,!1,P);if(a&&"declutter"===m&&a.collides(r.declutterBox))break t;n.push([t,e,l,r,1,null,null])}a&&"none"!==m&&a.load(n.map(Ws));for(let t=0,e=n.length;t<e;++t)this.replayImageOrLabel_.apply(this,n[t])}}++d;break;case os.END_GEOMETRY:if(void 0!==r){P=i[1];const t=r(P,G,m);if(t)return t}++d;break;case os.FILL:O?b++:this.fill_(t),++d;break;case os.MOVE_TO_LINE_TO:for(E=i[1],f=i[2],D=h[E],W=h[E+1],t.moveTo(D,W),y=D+.5|0,x=W+.5|0,E+=2;E<f;E+=2)D=h[E],W=h[E+1],S=D+.5|0,v=W+.5|0,E!=f-2&&S===y&&v===x||(t.lineTo(D,W),y=S,x=v);++d;break;case os.SET_FILL_STYLE:this.alignAndScaleFill_=i[2],b&&(this.fill_(t),b=0,T&&(t.stroke(),T=0)),t.fillStyle=i[1],++d;break;case os.SET_STROKE_STYLE:T&&(t.stroke(),T=0),this.setStrokeStyle_(t,i),++d;break;case os.STROKE:O?T++:t.stroke(),++d;break;default:++d}}b&&this.fill_(t),T&&t.stroke()}execute(t,e,i,n,s,r){this.viewRotation_=n,this.execute_(t,e,i,this.instructions,s,void 0,void 0,r)}executeHitDetection(t,e,i,n,s){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,n,s)}},Xs=["Polygon","Circle","LineString","Image","Text","Default"],Vs=["Image","Text"],Zs=Xs.filter(t=>!Vs.includes(t));const js={};const Ks=class{constructor(t,e,i,n,s,r,o){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=r,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=[1,0,0,1,0,0],this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(s,o)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let n=this.executorsByZIndex_[i];void 0===n&&(n={},this.executorsByZIndex_[i]=n);const s=t[i];for(const t in s){const i=s[t];n[t]=new Ys(this.resolution_,this.pixelRatio_,this.overlaps_,i,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let e=0,n=t.length;e<n;++e)if(t[e]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,n,s,r){const o=2*(n=Math.round(n))+1,a=Is(this.hitDetectionTransform_,n+.5,n+.5,1/e,-1/e,-i,-t[0],-t[1]),l=!this.hitDetectionContext_;l&&(this.hitDetectionContext_=pe(o,o));const h=this.hitDetectionContext_;let c;h.canvas.width!==o||h.canvas.height!==o?(h.canvas.width=o,h.canvas.height=o):l||h.clearRect(0,0,o,o),void 0!==this.renderBuffer_&&(c=[1/0,1/0,-1/0,-1/0],$t(c,t),Nt(c,e*(this.renderBuffer_+n),c));const u=function(t){if(void 0!==js[t])return js[t];const e=2*t+1,i=t*t,n=new Array(i+1);for(let s=0;s<=t;++s)for(let r=0;r<=t;++r){const o=s*s+r*r;if(o>i)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+s)*e+(t+r))+3),s>0&&a.push(4*((t-s)*e+(t+r))+3),r>0&&(a.push(4*((t+s)*e+(t-r))+3),s>0&&a.push(4*((t-s)*e+(t-r))+3))}const s=[];for(let t=0,e=n.length;t<e;++t)n[t]&&s.push(...n[t]);return js[t]=s,s}(n);let d;function g(t,e,i){const a=h.getImageData(0,0,o,o).data;for(let l=0,c=u.length;l<c;l++)if(a[u[l]]>0){if(!r||"none"===i||"Image"!==d&&"Text"!==d||r.includes(t)){const i=(u[l]-3)/4,r=n-i%o,a=n-(i/o|0),h=s(t,e,r*r+a*a);if(h)return h}h.clearRect(0,0,o,o);break}}const f=Object.keys(this.executorsByZIndex_).map(Number);let p,_,m,y,x;for(f.sort(et),p=f.length-1;p>=0;--p){const t=f[p].toString();for(m=this.executorsByZIndex_[t],_=Xs.length-1;_>=0;--_)if(d=Xs[_],y=m[d],void 0!==y&&(x=y.executeHitDetection(h,a,i,g,c),x))return x}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],s=e[2],r=e[3],o=[i,n,i,r,s,r,s,n];return vs(o,0,8,2,t,o),o}isEmpty(){return ct(this.executorsByZIndex_)}execute(t,e,i,n,s,r,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?it:et),r=r||Xs;const l=Xs.length;for(let h=0,c=a.length;h<c;++h){const c=a[h].toString(),u=this.executorsByZIndex_[c];for(let c=0,d=r.length;c<d;++c){const d=r[c],g=u[d];if(void 0!==g){const r=null===o?void 0:g.getZIndexContext(),c=r?r.getContext():t,u=this.maxExtent_&&"Image"!==d&&"Text"!==d;if(u&&(c.save(),this.clip(c,i)),r&&"Text"!==d&&"Image"!==d?r.pushFunction(t=>g.execute(t,e,i,n,s,o)):g.execute(c,e,i,n,s,o),u&&c.restore(),r){r.offset();const t=a[h]*l+Xs.indexOf(d);this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(r)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(et);for(let i=0,n=e.length;i<n;++i)t[e[i]].forEach(t=>{t.draw(this.renderedContext_),t.clear()}),t[e[i]].length=0}};function qs(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}class $s{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=qs(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new $s({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 yt()}getImage(t){return yt()}getHitDetectionImage(){return yt()}getPixelRatio(t){return 1}getImageState(){return yt()}getImageSize(){return yt()}getOrigin(){return yt()}getSize(){return yt()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=qs(t)}listenImageChange(t){yt()}load(){yt()}unlistenImageChange(t){yt()}ready(){return Promise.resolve()}}const Hs=$s;function Us(t,e,i,n){return void 0!==i&&void 0!==n?[i/t,n/e]:void 0!==i?i/t:void 0!==n?n/e:1}class Js extends Hs{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,n=void 0!==t.scale?t.scale:1,s=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:n,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:s,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null;const r=void 0!==t.img?t.img:null;let o,a=t.src;if(Rt(!(void 0!==a&&r),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!r||(a=r.src||St(r)),Rt(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),Rt(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?o=ji:void 0!==r&&(o="complete"in r?r.complete?r.src?qi:ji:Ki:qi),this.color_=void 0!==t.color?pn(t.color):null,this.iconImage_=Cn(r,a,this.crossOrigin_,o,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,this.initialOptions_,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const n=this.getImage(1);if(n.width&&n.height)e=n.width,i=n.height;else if(n instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(Us(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(Us(e,i,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new Js({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:e,height:i,size:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const e=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!e)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=e[0]),"fraction"==this.anchorYUnits_&&(t[1]*=e[1])}if("top-left"!=this.anchorOrigin_){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+e[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+e[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:this.iconImage_.getImageState()==qi?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:this.iconImage_.getImageState()==qi?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(Q,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(Q,t)}ready(){return this.iconImage_.ready()}}const Qs=Js,tr=[1,0,0,1,0,0],er=[NaN,NaN];const ir=class extends wt{constructor(){super(),this.extent_=[1/0,1/0,-1/0,-1/0],this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=function(t){let e,i,n;return function(){const s=Array.prototype.slice.call(arguments);return i&&this===n&&ot(s,i)||(n=this,i=s,e=t.apply(this,arguments)),e}}((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return yt()}closestPointXY(t,e,i,n){return yt()}containsXY(t,e){return 0===this.closestPointXY(t,e,er,Number.MIN_VALUE)}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return yt()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&qt(t),this.extentRevision_=this.getRevision()}return function(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}(this.extent_,t)}rotate(t,e){yt()}scale(t,e,i){yt()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return yt()}getType(){return yt()}applyTransform(t){yt()}intersectsExtent(t){return yt()}translate(t,e){yt()}transform(t,e){const i=Mi(t),n="tile-pixels"==i.getUnits()?function(t,n,s){const r=i.getExtent(),o=i.getWorldExtent(),a=ie(o)/ie(r);Is(tr,o[0],o[3],a,-a,0,0,0);const l=vs(t,0,t.length,s,tr,n),h=Li(i,e);return h?h(l,l,s):l}:Li(i,e);return this.applyTransform(n),this}};function nr(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}const sr=class extends ir{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return e=this.flatCoordinates,i=0,n=this.flatCoordinates.length,s=this.stride,Ht(qt(t),e,i,n,s);var e,i,n,s}getCoordinates(){return yt()}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(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=nr(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){yt()}setLayout(t,e,i){let n;if(t)n=nr(t);else{for(let t=0;t<i;++t){if(0===e.length)return this.layout="XY",void(this.stride=2);e=e[0]}n=e.length,t=function(t){let e;2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM");return e}(n)}this.layout=t,this.stride=n}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();ws(i,0,i.length,n,t,e,i),this.changed()}}scale(t,e,i){void 0===e&&(e=t),i||(i=te(this.getExtent()));const n=this.getFlatCoordinates();if(n){const s=this.getStride();!function(t,e,i,n,s,r,o,a){a=a||[];const l=o[0],h=o[1];let c=0;for(let o=e;o<i;o+=n){const e=t[o]-l,i=t[o+1]-h;a[c++]=l+s*e,a[c++]=h+r*i;for(let e=o+2;e<o+n;++e)a[c++]=t[e]}a&&a.length!=c&&(a.length=c)}(n,0,n.length,s,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();!function(t,e,i,n,s,r,o){o=o||[];let a=0;for(let l=e;l<i;l+=n){o[a++]=t[l]+s,o[a++]=t[l+1]+r;for(let e=l+2;e<l+n;++e)o[a++]=t[e]}o&&o.length!=a&&(o.length=a)}(i,0,i.length,n,t,e,i),this.changed()}}};const rr=class extends Tn{constructor(t,e,i,n,s,r,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?je(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=r,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_=[1,0,0,1,0,0]}drawImages_(t,e,i,n){if(!this.image_)return;const s=vs(t,e,i,n,this.transform_,this.pixelCoordinates_),r=this.context_,o=this.tmpLocalTransform_,a=r.globalAlpha;1!=this.imageOpacity_&&(r.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let t=0,e=s.length;t<e;t+=2){const e=s[t]-this.imageAnchorX_,i=s[t+1]-this.imageAnchorY_;if(0!==l||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const t=e+this.imageAnchorX_,n=i+this.imageAnchorY_;Is(o,t,n,1,1,l,-t,-n),r.save(),r.transform.apply(r,o),r.translate(t,n),r.scale(this.imageScale_[0],this.imageScale_[1]),r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),r.restore()}else r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,e,i,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(r.globalAlpha=a)}drawText_(t,e,i,n){if(!this.textState_||""===this.text_)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const s=vs(t,e,i,n,this.transform_,this.pixelCoordinates_),r=this.context_;let o=this.textRotation_;for(0===this.transformRotation_&&(o-=this.viewRotation_),this.textRotateWithView_&&(o+=this.viewRotation_);e<i;e+=n){const t=s[e]+this.textOffsetX_,i=s[e+1]+this.textOffsetY_;0!==o||1!=this.textScale_[0]||1!=this.textScale_[1]?(r.save(),r.translate(t-this.textOffsetX_,i-this.textOffsetY_),r.rotate(o),r.translate(this.textOffsetX_,this.textOffsetY_),r.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&r.strokeText(this.text_,0,0),this.textFillState_&&r.fillText(this.text_,0,0),r.restore()):(this.textStrokeState_&&r.strokeText(this.text_,t,i),this.textFillState_&&r.fillText(this.text_,t,i))}}moveToLineTo_(t,e,i,n,s){const r=this.context_,o=vs(t,e,i,n,this.transform_,this.pixelCoordinates_);r.moveTo(o[0],o[1]);let a=o.length;s&&(a-=2);for(let t=2;t<a;t+=2)r.lineTo(o[t],o[t+1]);return s&&r.closePath(),i}drawRings_(t,e,i,n){for(let s=0,r=i.length;s<r;++s)e=this.moveToLineTo_(t,e,i[s],n,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),oe(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=function(t,e,i){const n=t.getFlatCoordinates();if(!n)return null;const s=t.getStride();return vs(n,0,n.length,s,e,i)}(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],n=e[3]-e[1],s=Math.sqrt(i*i+n*n),r=this.context_;r.beginPath(),r.arc(e[0],e[1],s,0,2*Math.PI),this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}""!==this.text_&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t)}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let t=0,i=e.length;t<i;++t)this.drawGeometry(e[t])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),oe(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1),e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(oe(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();let n=0;const s=t.getEnds(),r=t.getStride();e.beginPath();for(let t=0,e=s.length;t<e;++t)n=this.moveToLineTo_(i,n,s[t],r,!1);e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoints();this.drawText_(e,0,e.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),oe(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),oe(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let n=0;const s=t.getEndss(),r=t.getStride();e.beginPath();for(let t=0,e=s.length;t<e;++t){const e=s[t];n=this.drawRings_(i,n,e,r)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),ot(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,i=this.contextTextState_,n=t.textAlign?t.textAlign:Bn;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=n&&(i.textAlign=n,e.textAlign=n),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=n,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:n,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(t){const e=t.getColor();this.fillState_={fillStyle:Mn(e||Pn)}}else this.fillState_=null;if(e){const t=e.getColor(),i=e.getLineCap(),n=e.getLineDash(),s=e.getLineDashOffset(),r=e.getLineJoin(),o=e.getWidth(),a=e.getMiterLimit(),l=n||Wn;this.strokeState_={lineCap:void 0!==i?i:Dn,lineDash:1===this.pixelRatio_?l:l.map(t=>t*this.pixelRatio_),lineDashOffset:(s||0)*this.pixelRatio_,lineJoin:void 0!==r?r:Gn,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:Mn(t||zn)}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),s=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const r=t.getScaleArray();this.imageScale_=[r[0]*this.pixelRatio_/i,r[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:Mn(t||Pn)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),s=i.getLineDashOffset(),r=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:Dn,lineDash:n||Wn,lineDashOffset:s||0,lineJoin:void 0!==r?r:Gn,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:Mn(t||zn)}}else this.textStrokeState_=null;const n=t.getFont(),s=t.getOffsetX(),r=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),l=t.getScaleArray(),h=t.getText(),c=t.getTextAlign(),u=t.getTextBaseline();this.textState_={font:void 0!==n?n:On,textAlign:void 0!==c?c:Bn,textBaseline:void 0!==u?u:Nn},this.text_=void 0!==h?Array.isArray(h)?h.reduce((t,e,i)=>t+(i%2?" ":e),""):h:"",this.textOffsetX_=void 0!==s?this.pixelRatio_*s:0,this.textOffsetY_=void 0!==r?this.pixelRatio_*r:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*l[0],this.pixelRatio_*l[1]]}else this.text_=""}},or=.5;const ar={Point:function(t,e,i,n,s,r){const o=i.getImage(),a=i.getText(),l=a&&a.getText(),h=r&&o&&l?{}:void 0;if(o){if(o.getImageState()!=qi)return;const r=t.getBuilder(i.getZIndex(),"Image");r.setImageStyle(o,h),r.drawPoint(e,n,s)}if(l){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a,h),r.drawText(e,n,s)}},LineString:function(t,e,i,n,s){const r=i.getStroke();if(r){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,r),o.drawLineString(e,n,s)}const o=i.getText();if(o&&o.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,n,s)}},Polygon:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(r||o){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(r,o),a.drawPolygon(e,n,s)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,n,s)}},MultiPoint:function(t,e,i,n,s,r){const o=i.getImage(),a=o&&0!==o.getOpacity(),l=i.getText(),h=l&&l.getText(),c=r&&a&&h?{}:void 0;if(a){if(o.getImageState()!=qi)return;const r=t.getBuilder(i.getZIndex(),"Image");r.setImageStyle(o,c),r.drawMultiPoint(e,n,s)}if(h){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(l,c),r.drawText(e,n,s)}},MultiLineString:function(t,e,i,n,s){const r=i.getStroke();if(r){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,r),o.drawMultiLineString(e,n,s)}const o=i.getText();if(o&&o.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,n,s)}},MultiPolygon:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(o||r){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(r,o),a.drawMultiPolygon(e,n,s)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,n,s)}},GeometryCollection:function(t,e,i,n,s,r){const o=e.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a){(0,ar[o[a].getType()])(t,o[a],i,n,s,r)}},Circle:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(r||o){const a=t.getBuilder(i.getZIndex(),"Circle");a.setFillStrokeStyle(r,o),a.drawCircle(e,n,s)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n)}}};function lr(t,e){return parseInt(St(t),10)-parseInt(St(e),10)}function hr(t,e){const i=cr(t,e);return i*i}function cr(t,e){return.5*t/e}function ur(t,e,i,n,s,r,o,a){const l=[],h=i.getImage();if(h){let t=!0;const e=h.getImageState();e==qi||e==$i?t=!1:e==ji&&h.load(),t&&l.push(h.ready())}const c=i.getFill();c&&c.loading()&&l.push(c.ready());const u=l.length>0;return u&&Promise.all(l).then(()=>s(null)),function(t,e,i,n,s,r,o){const a=i.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(n,s),h=i.getRenderer();if(h)dr(t,l,i,e,o);else{(0,ar[l.getType()])(t,l,i,e,o,r)}}(t,e,i,n,r,o,a),u}function dr(t,e,i,n,s){if("GeometryCollection"==e.getType()){const r=e.getGeometries();for(let e=0,o=r.length;e<o;++e)dr(t,r[e],i,n,s);return}t.getBuilder(i.getZIndex(),"Default").drawCustom(e,n,i.getRenderer(),i.getHitDetectionRenderer(),s)}const gr=class extends ut{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}};const fr=class extends mt{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=5}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return yt()}getData(t){return null}prepareFrame(t){return yt()}renderFrame(t,e){return yt()}forEachFeatureAtCoordinate(t,e,i,n,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;e.getState()!==qi&&e.getState()!==$i||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=qi&&e!=$i&&t.addEventListener(Q,this.boundHandleImageChange_),e==ji&&(t.load(),e=t.getState()),e==qi}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}},pr=[];let _r=null;const mr=class extends fr{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=[1,0,0,1,0,0],this.pixelTransform=[1,0,0,1,0,0],this.inversePixelTransform=[1,0,0,1,0,0],this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){let n;_r||(_r=pe(1,1,void 0,{willReadFrequently:!0})),_r.clearRect(0,0,1,1);try{_r.drawImage(t,e,i,1,1,0,0,1,1),n=_r.getImageData(0,0,1,1).data}catch{return _r=null,null}return n}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let s,r;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&ot(pn(t.style.backgroundColor),pn(i)))){const e=t.firstElementChild;e instanceof HTMLCanvasElement&&(r=e.getContext("2d"))}if(r&&function(t,e){const i=bs(t),n=bs(e);for(let t=0;t<6;++t)if(0!==Math.round((i[t]-n[t])*Rs[t]))return!1;return!0}(r.canvas.style.transform,e)?(this.container=t,this.context=r,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){s=document.createElement("div"),s.className=n;let t=s.style;t.position="absolute",t.width="100%",t.height="100%",r=pe();const e=r.canvas;s.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=s,this.context=r}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=ne(i),s=se(i),r=Qt(i),o=Jt(i);Cs(e.coordinateToPixelTransform,n),Cs(e.coordinateToPixelTransform,s),Cs(e.coordinateToPixelTransform,r),Cs(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;Cs(a,n),Cs(a,s),Cs(a,r),Cs(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const i=t.extent,n=t.viewState.resolution,s=t.viewState.rotation,r=t.pixelRatio,o=Math.round(re(i)/n*r),a=Math.round(ie(i)/n*r);Is(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/r,1/r,s,-o/2,-a/2),Ms(this.inversePixelTransform,this.pixelTransform);const l=Es(this.pixelTransform);if(this.useContainer(e,l,this.getBackground(t)),!this.containerReused){const t=this.context.canvas;t.width!=o||t.height!=a?(t.width=o,t.height=a):this.context.clearRect(0,0,o,a),l!==t.style.transform&&(t.style.transform=l)}}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const s=new gr(t,this.inversePixelTransform,i,e);n.dispatchEvent(s)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(Xi,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(Vi,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new As),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(Xi,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(Vi,this.context,t))}getRenderTransform(t,e,i,n,s,r,o){const a=s/2,l=r/2,h=n/e,c=-h,u=-t[0]+o,d=-t[1];return Is(this.tempTransform,a,l,h,c,-i,u,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}};const yr=class extends mr{constructor(t){super(t),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_=[1/0,1/0,-1/0,-1/0],this.wrappedRenderedExtent_=[1/0,1/0,-1/0,-1/0],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(t,e,i){const n=e.extent,s=e.viewState,r=s.center,o=s.resolution,a=s.projection,l=s.rotation,h=a.getExtent(),c=this.getLayer().getSource(),u=this.getLayer().getDeclutter(),d=e.pixelRatio,g=e.viewHints,f=!(g[Ft]||g[Ot]),p=this.context,_=Math.round(re(n)/o*d),m=Math.round(ie(n)/o*d),y=c.getWrapX()&&a.canWrapX(),x=y?re(h):null,S=y?Math.ceil((n[2]-h[2])/x)+1:1;let v=y?Math.floor((n[0]-h[0])/x):0;do{let n=this.getRenderTransform(r,o,0,d,_,m,v*x);e.declutter&&(n=n.slice(0)),t.execute(p,[p.canvas.width,p.canvas.height],n,l,f,void 0===i?Xs:i?Vs:Zs,i?u&&e.declutter[u]:void 0)}while(++v<S)}setDrawContext_(){1!==this.opacity_&&(this.targetContext_=this.context,this.context=pe(this.context.canvas.width,this.context.canvas.height,pr))}resetDrawContext_(){if(1!==this.opacity_&&this.targetContext_){const t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,function(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}(this.context),pr.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){this.replayGroup_&&this.getLayer().getDeclutter()&&this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.replayGroup_.renderDeferred(),this.clipped_&&this.context.restore(),this.resetDrawContext_())}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;const n=t.viewState;this.prepareContainer(t,e);const s=this.context,r=this.replayGroup_;let o=r&&!r.isEmpty();if(!o){if(!(this.getLayer().hasListener(Xi)||this.getLayer().hasListener(Vi)))return this.container}this.setDrawContext_(),this.preRender(s,t);const a=n.projection;if(this.clipped_=!1,o&&i.extent&&this.clipping){const e=Gi(i.extent,a);o=oe(e,t.extent),this.clipped_=o&&!Vt(e,t.extent),this.clipped_&&this.clipUnrotated(s,t,e)}return o&&this.renderWorlds(r,t,!this.getLayer().getDeclutter()&&void 0),!t.declutter&&this.clipped_&&s.restore(),this.postRender(s,t),this.renderedRotation_!==n.rotation&&(this.renderedRotation_=n.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=this.frameState.size.slice(),e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,s=this.renderedProjection_,r=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],l=t[0]*or,h=t[1]*or;a.push(this.getRenderTransform(e,i,n,or,l,h,0).slice());const c=o.getSource(),u=s.getExtent();if(c.getWrapX()&&s.canWrapX()&&!Vt(u,r)){let t=r[0];const s=re(u);let o,c=0;for(;t<u[0];)--c,o=s*c,a.push(this.getRenderTransform(e,i,n,or,l,h,o).slice()),t+=s;for(c=0,t=r[2];t>u[2];)++c,o=s*c,a.push(this.getRenderTransform(e,i,n,or,l,h,o).slice()),t-=s}const d=Oi();this.hitDetectionImageData_=function(t,e,i,n,s,r,o,a,l){const h=l?Wi(s,l):s,c=pe(t[0]*or,t[1]*or);c.imageSmoothingEnabled=!1;const u=c.canvas,d=new rr(c,or,s,null,o,a,l?bi(Oi(),l):null),g=i.length,f=Math.floor(16777215/g),p={};for(let t=1;t<=g;++t){const e=i[t-1],s=e.getStyleFunction()||n;if(!s)continue;let o=s(e,r);if(!o)continue;Array.isArray(o)||(o=[o]);const a=(t*f).toString(16).padStart(7,"#00000");for(let t=0,i=o.length;t<i;++t){const i=o[t],n=i.getGeometryFunction()(e);if(!n||!oe(h,n.getExtent()))continue;const s=i.clone(),r=s.getFill();r&&r.setColor(a);const l=s.getStroke();l&&(l.setColor(a),l.setLineDash(null)),s.setText(void 0);const c=i.getImage();if(c){const t=c.getImageSize();if(!t)continue;const e=pe(t[0],t[1],void 0,{alpha:!1}),i=e.canvas;e.fillStyle=a,e.fillRect(0,0,i.width,i.height),s.setImage(new Qs({img:i,anchor:c.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:c.getOrigin(),opacity:1,size:c.getSize(),scale:c.getScale(),rotation:c.getRotation(),rotateWithView:c.getRotateWithView()}))}const u=s.getZIndex()||0;let d=p[u];d||(d={},p[u]=d,d.Polygon=[],d.Circle=[],d.LineString=[],d.Point=[]);const g=n.getType();if("GeometryCollection"===g){const t=n.getGeometriesArrayRecursive();for(let e=0,i=t.length;e<i;++e){const i=t[e];d[i.getType().replace("Multi","")].push(i,s)}}else d[g.replace("Multi","")].push(n,s)}}const _=Object.keys(p).map(Number).sort(et);for(let t=0,i=_.length;t<i;++t){const i=p[_[t]];for(const t in i){const n=i[t];for(let t=0,i=n.length;t<i;t+=2){d.setStyle(n[t+1]);for(let i=0,s=e.length;i<s;++i)d.setTransform(e[i]),d.drawGeometry(n[t])}}}return c.getImageData(0,0,u.width,u.height)}(t,a,this.renderedFeatures_,o.getStyleFunction(),r,i,n,hr(i,this.renderedPixelRatio_),d?s:null)}e(function(t,e,i){const n=[];if(i){const s=Math.floor(Math.round(t[0])*or),r=Math.floor(Math.round(t[1])*or),o=4*(ze(s,0,i.width-1)+ze(r,0,i.height-1)*i.width),a=i.data[o],l=i.data[o+1],h=i.data[o+2]+256*(l+256*a),c=Math.floor(16777215/e.length);h&&h%c===0&&n.push(e[h/c-1])}return n}(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,n,s){if(!this.replayGroup_)return;const r=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),l={},h=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,r,o,i,function(t,e,i){const r=St(t),o=l[r];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return l[r]=!0,s.splice(s.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return l[r]=!0,n(t,a,e);s.push(l[r]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}},h?e.declutter?.[h]?.all().map(t=>t.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[Ft],s=t.viewHints[Ot],r=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!r&&n||!o&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,l=t.viewState,h=l.projection,c=l.resolution,u=t.pixelRatio,d=e.getRevision(),g=e.getRenderBuffer();let f=e.getRenderOrder();void 0===f&&(f=lr);const p=l.center.slice(),_=Nt(a,g*c),m=_.slice(),y=[_.slice()],x=h.getExtent();if(i.getWrapX()&&h.canWrapX()&&!Vt(x,t.extent)){const t=re(x),e=Math.max(re(_)/2,t);_[0]=x[0]-e,_[2]=x[2]+e,ue(p,h);const i=he(y[0],h);i[0]<x[0]&&i[2]<x[2]?y.push([i[0]+t,i[1],i[2]+t,i[3]]):i[0]>x[0]&&i[2]>x[2]&&y.push([i[0]-t,i[1],i[2]-t,i[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedRevision_==d&&this.renderedRenderOrder_==f&&this.renderedFrameDeclutter_===!!t.declutter&&Vt(this.wrappedRenderedExtent_,_))return ot(this.renderedExtent_,m)||(this.hitDetectionImageData_=null,this.renderedExtent_=m),this.renderedCenter_=p,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const S=new Ss(cr(c,u),_,c,u),v=Oi();let w;if(v){for(let t=0,e=y.length;t<e;++t){const e=Wi(y[t],h);i.loadFeatures(e,zi(c,h),v)}w=bi(v,h)}else for(let t=0,e=y.length;t<e;++t)i.loadFeatures(y[t],c,h);const C=hr(c,u);let I=!0;const M=(t,i)=>{let n;const s=t.getStyleFunction()||e.getStyleFunction();if(s&&(n=s(t,c)),n){const e=this.renderFeature(t,C,n,S,w,this.getLayer().getDeclutter(),i);I=I&&!e}},R=Wi(_,h),E=i.getFeaturesInExtent(R);f&&E.sort(f);for(let t=0,e=E.length;t<e;++t)M(E[t],t);this.renderedFeatures_=E,this.ready=I;const b=S.finish(),T=new Ks(_,c,u,i.getOverlaps(),b,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=c,this.renderedRevision_=d,this.renderedRenderOrder_=f,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=m,this.wrappedRenderedExtent_=_,this.renderedCenter_=p,this.renderedProjection_=h,this.renderedPixelRatio_=u,this.replayGroup_=T,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,n,s,r,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,h=i.length;l<h;++l)a=ur(n,t,i[l],e,this.boundHandleStyleImageChange_,s,r,o)||a;else a=ur(n,t,i,e,this.boundHandleStyleImageChange_,s,r,o);return a}};function xr(t,e,i=0,n=t.length-1,s=vr){for(;n>i;){if(n-i>600){const r=n-i+1,o=e-i+1,a=Math.log(r),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(r-l)/r)*(o-r/2<0?-1:1);xr(t,e,Math.max(i,Math.floor(e-o*l/r+h)),Math.min(n,Math.floor(e+(r-o)*l/r+h)),s)}const r=t[e];let o=i,a=n;for(Sr(t,i,e),s(t[n],r)>0&&Sr(t,i,n);o<a;){for(Sr(t,o,a),o++,a--;s(t[o],r)<0;)o++;for(;s(t[a],r)>0;)a--}0===s(t[i],r)?Sr(t,i,a):(a++,Sr(t,a,n)),a<=e&&(i=a+1),e<=a&&(n=a-1)}}function Sr(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function vr(t,e){return t<e?-1:t>e?1:0}class wr{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!Or(t,e))return i;const n=this.toBBox,s=[];for(;e;){for(let r=0;r<e.children.length;r++){const o=e.children[r],a=e.leaf?n(o):o;Or(t,a)&&(e.leaf?i.push(o):Fr(t,a)?this._all(o,i):s.push(o))}e=s.pop()}return i}collides(t){let e=this.data;if(!Or(t,e))return!1;const i=[];for(;e;){for(let n=0;n<e.children.length;n++){const s=e.children[n],r=e.leaf?this.toBBox(s):s;if(Or(t,r)){if(e.leaf||Fr(t,r))return!0;i.push(s)}}e=i.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(let e=0;e<t.length;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Pr([]),this}remove(t,e){if(!t)return this;let i=this.data;const n=this.toBBox(t),s=[],r=[];let o,a,l;for(;i||s.length;){if(i||(i=s.pop(),a=s[s.length-1],o=r.pop(),l=!0),i.leaf){const n=Cr(t,i.children,e);if(-1!==n)return i.children.splice(n,1),s.push(i),this._condense(s),this}l||i.leaf||!Fr(i,n)?a?(o++,i=a.children[o],l=!1):i=null:(s.push(i),r.push(o),o=0,a=i,i=i.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,n){const s=i-e+1;let r,o=this._maxEntries;if(s<=o)return r=Pr(t.slice(e,i+1)),Ir(r,this.toBBox),r;n||(n=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,n-1))),r=Pr([]),r.leaf=!1,r.height=n;const a=Math.ceil(s/o),l=a*Math.ceil(Math.sqrt(o));Dr(t,e,i,l,this.compareMinX);for(let s=e;s<=i;s+=l){const e=Math.min(s+l-1,i);Dr(t,s,e,a,this.compareMinY);for(let i=s;i<=e;i+=a){const s=Math.min(i+a-1,e);r.children.push(this._build(t,i,s,n-1))}}return Ir(r,this.toBBox),r}_chooseSubtree(t,e,i,n){for(;n.push(e),!e.leaf&&n.length-1!==i;){let i,n=1/0,s=1/0;for(let r=0;r<e.children.length;r++){const o=e.children[r],a=Tr(o),l=Ar(t,o)-a;l<s?(s=l,n=a<n?a:n,i=o):l===s&&a<n&&(n=a,i=o)}e=i||e.children[0]}return e}_insert(t,e,i){const n=i?t:this.toBBox(t),s=[],r=this._chooseSubtree(n,this.data,e,s);for(r.children.push(t),Rr(r,n);e>=0&&s[e].children.length>this._maxEntries;)this._split(s,e),e--;this._adjustParentBBoxes(n,s,e)}_split(t,e){const i=t[e],n=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,n);const r=this._chooseSplitIndex(i,s,n),o=Pr(i.children.splice(r,i.children.length-r));o.height=i.height,o.leaf=i.leaf,Ir(i,this.toBBox),Ir(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=Pr([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Ir(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,s=1/0,r=1/0;for(let o=e;o<=i-e;o++){const e=Mr(t,0,o,this.toBBox),a=Mr(t,o,i,this.toBBox),l=kr(e,a),h=Tr(e)+Tr(a);l<s?(s=l,n=o,r=h<r?h:r):l===s&&h<r&&(r=h,n=o)}return n||i-e}_chooseSplitAxis(t,e,i){const n=t.leaf?this.compareMinX:Er,s=t.leaf?this.compareMinY:br;this._allDistMargin(t,e,i,n)<this._allDistMargin(t,e,i,s)&&t.children.sort(n)}_allDistMargin(t,e,i,n){t.children.sort(n);const s=this.toBBox,r=Mr(t,0,e,s),o=Mr(t,i-e,i,s);let a=Lr(r)+Lr(o);for(let n=e;n<i-e;n++){const e=t.children[n];Rr(r,t.leaf?s(e):e),a+=Lr(r)}for(let n=i-e-1;n>=e;n--){const e=t.children[n];Rr(o,t.leaf?s(e):e),a+=Lr(o)}return a}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)Rr(e[n],t)}_condense(t){for(let e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children,e.splice(e.indexOf(t[i]),1)):this.clear():Ir(t[i],this.toBBox)}}function Cr(t,e,i){if(!i)return e.indexOf(t);for(let n=0;n<e.length;n++)if(i(t,e[n]))return n;return-1}function Ir(t,e){Mr(t,0,t.children.length,e,t)}function Mr(t,e,i,n,s){s||(s=Pr(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let r=e;r<i;r++){const e=t.children[r];Rr(s,t.leaf?n(e):e)}return s}function Rr(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function Er(t,e){return t.minX-e.minX}function br(t,e){return t.minY-e.minY}function Tr(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Lr(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Ar(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function kr(t,e){const i=Math.max(t.minX,e.minX),n=Math.max(t.minY,e.minY),s=Math.min(t.maxX,e.maxX),r=Math.min(t.maxY,e.maxY);return Math.max(0,s-i)*Math.max(0,r-n)}function Fr(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function Or(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function Pr(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Dr(t,e,i,n,s){const r=[e,i];for(;r.length;){if((i=r.pop())-(e=r.pop())<=n)continue;const o=e+Math.ceil((i-e)/n/2)*n;xr(t,o,e,i,s),r.push(e,o,o,i)}}let Wr=0;const Gr=1<<Wr++,zr=1<<Wr++,Br=1<<Wr++,Nr=1<<Wr++,Yr=1<<Wr++,Xr=1<<Wr++,Vr=Math.pow(2,6)-1,Zr={[Gr]:"boolean",[zr]:"number",[Br]:"string",[Nr]:"color",[Yr]:"number[]",[Xr]:"size"},jr=Object.keys(Zr).map(Number).sort(et);function Kr(t){const e=[];for(const i of jr)qr(t,i)&&e.push(Zr[i]);return 0===e.length?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function qr(t,e){return(t&e)===e}function $r(t,e){return t===e}class Hr{constructor(t,e){if(!function(t){return t in Zr}(t))throw new Error(`literal expressions must have a specific type, got ${Kr(t)}`);this.type=t,this.value=e}}class Ur{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function Jr(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mapState:!1}}function Qr(t,e,i){switch(typeof t){case"boolean":if($r(e,Br))return new Hr(Br,t?"true":"false");if(!qr(e,Gr))throw new Error(`got a boolean, but expected ${Kr(e)}`);return new Hr(Gr,t);case"number":if($r(e,Xr))return new Hr(Xr,qs(t));if($r(e,Gr))return new Hr(Gr,!!t);if($r(e,Br))return new Hr(Br,t.toString());if(!qr(e,zr))throw new Error(`got a number, but expected ${Kr(e)}`);return new Hr(zr,t);case"string":if($r(e,Nr))return new Hr(Nr,fn(t));if($r(e,Gr))return new Hr(Gr,!!t);if(!qr(e,Br))throw new Error(`got a string, but expected ${Kr(e)}`);return new Hr(Br,t)}if(!Array.isArray(t))throw new Error("expression must be an array or a primitive value");if(0===t.length)throw new Error("empty expression");if("string"==typeof t[0])return function(t,e,i){const n=t[0],s=qo[n];if(!s)throw new Error(`unknown operator: ${n}`);return s(t,e,i)}(t,e,i);for(const e of t)if("number"!=typeof e)throw new Error("expected an array of numbers");if($r(e,Xr)){if(2!==t.length)throw new Error(`expected an array of two values for a size, got ${t.length}`);return new Hr(Xr,t)}if($r(e,Nr)){if(3===t.length)return new Hr(Nr,[...t,1]);if(4===t.length)return new Hr(Nr,t);throw new Error(`expected an array of 3 or 4 values for a color, got ${t.length}`)}if(!qr(e,Yr))throw new Error(`got an array of numbers, but expected ${Kr(e)}`);return new Hr(Yr,t)}const to="get",eo="var",io="concat",no="geometry-type",so="line-metric",ro="any",oo="all",ao="!",lo="resolution",ho="zoom",co="time",uo="==",go="!=",fo=">",po=">=",_o="<",mo="<=",yo="*",xo="/",So="+",vo="-",wo="clamp",Co="%",Io="^",Mo="abs",Ro="floor",Eo="ceil",bo="round",To="sin",Lo="cos",Ao="atan",ko="sqrt",Fo="match",Oo="between",Po="interpolate",Do="coalesce",Wo="case",Go="in",zo="number",Bo="string",No="array",Yo="color",Xo="id",Vo="band",Zo="palette",jo="to-string",Ko="has",qo={[to]:ia(Jo(1,1/0),$o),[eo]:ia(Jo(1,1),function(t,e,i){const n=t[1];if("string"!=typeof n)throw new Error("expected a string argument for var operation");return i.variables.add(n),[new Hr(Br,n)]}),[Ko]:ia(Jo(1,1/0),$o),[Xo]:ia(function(t,e,i){i.featureId=!0},Uo),[io]:ia(Jo(2,1/0),ta(Br)),[no]:ia(function(t,e,i){i.geometryType=!0},Uo),[so]:ia(Uo),[lo]:ia(Ho,Uo),[ho]:ia(Ho,Uo),[co]:ia(Ho,Uo),[ro]:ia(Jo(2,1/0),ta(Gr)),[oo]:ia(Jo(2,1/0),ta(Gr)),[ao]:ia(Jo(1,1),ta(Gr)),[uo]:ia(Jo(2,2),ta(Vr)),[go]:ia(Jo(2,2),ta(Vr)),[fo]:ia(Jo(2,2),ta(zr)),[po]:ia(Jo(2,2),ta(zr)),[_o]:ia(Jo(2,2),ta(zr)),[mo]:ia(Jo(2,2),ta(zr)),[yo]:ia(Jo(2,1/0),Qo),[Do]:ia(Jo(2,1/0),Qo),[xo]:ia(Jo(2,2),ta(zr)),[So]:ia(Jo(2,1/0),ta(zr)),[vo]:ia(Jo(2,2),ta(zr)),[wo]:ia(Jo(3,3),ta(zr)),[Co]:ia(Jo(2,2),ta(zr)),[Io]:ia(Jo(2,2),ta(zr)),[Mo]:ia(Jo(1,1),ta(zr)),[Ro]:ia(Jo(1,1),ta(zr)),[Eo]:ia(Jo(1,1),ta(zr)),[bo]:ia(Jo(1,1),ta(zr)),[To]:ia(Jo(1,1),ta(zr)),[Lo]:ia(Jo(1,1),ta(zr)),[Ao]:ia(Jo(1,2),ta(zr)),[ko]:ia(Jo(1,1),ta(zr)),[Fo]:ia(Jo(4,1/0),ea,function(t,e,i){const n=t.length-1,s=Br|zr|Gr,r=Qr(t[1],s,i),o=Qr(t[t.length-1],e,i),a=new Array(n-2);for(let e=0;e<n-2;e+=2){try{const n=Qr(t[e+2],r.type,i);a[e]=n}catch(t){throw new Error(`failed to parse argument ${e+1} of match expression: ${t.message}`)}try{const n=Qr(t[e+3],o.type,i);a[e+1]=n}catch(t){throw new Error(`failed to parse argument ${e+2} of match expression: ${t.message}`)}}return[r,...a,o]}),[Oo]:ia(Jo(3,3),ta(zr)),[Po]:ia(Jo(6,1/0),ea,function(t,e,i){const n=t[1];let s;switch(n[0]){case"linear":s=1;break;case"exponential":const t=n[1];if("number"!=typeof t||t<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(t)} instead`);s=t;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}const r=new Hr(zr,s);let o;try{o=Qr(t[2],zr,i)}catch(t){throw new Error(`failed to parse argument 1 in interpolate expression: ${t.message}`)}const a=new Array(t.length-3);for(let n=0;n<a.length;n+=2){try{const e=Qr(t[n+3],zr,i);a[n]=e}catch(t){throw new Error(`failed to parse argument ${n+2} for interpolate expression: ${t.message}`)}try{const s=Qr(t[n+4],e,i);a[n+1]=s}catch(t){throw new Error(`failed to parse argument ${n+3} for interpolate expression: ${t.message}`)}}return[r,o,...a]}),[Wo]:ia(Jo(3,1/0),function(t,e,i){const n=t[0],s=t.length-1;if(s%2==0)throw new Error(`expected an odd number of arguments for ${n}, got ${s} instead`)},function(t,e,i){const n=Qr(t[t.length-1],e,i),s=new Array(t.length-1);for(let e=0;e<s.length-1;e+=2){try{const n=Qr(t[e+1],Gr,i);s[e]=n}catch(t){throw new Error(`failed to parse argument ${e} of case expression: ${t.message}`)}try{const r=Qr(t[e+2],n.type,i);s[e+1]=r}catch(t){throw new Error(`failed to parse argument ${e+1} of case expression: ${t.message}`)}}return s[s.length-1]=n,s}),[Go]:ia(Jo(2,2),function(t,e,i){let n,s=t[2];if(!Array.isArray(s))throw new Error('the second argument for the "in" operator must be an array');if("string"==typeof s[0]){if("literal"!==s[0])throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');if(!Array.isArray(s[1]))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array');s=s[1],n=Br}else n=zr;const r=new Array(s.length);for(let t=0;t<r.length;t++)try{const e=Qr(s[t],n,i);r[t]=e}catch(e){throw new Error(`failed to parse haystack item ${t} for "in" expression: ${e.message}`)}return[Qr(t[1],n,i),...r]}),[zo]:ia(Jo(1,1/0),ta(Vr)),[Bo]:ia(Jo(1,1/0),ta(Vr)),[No]:ia(Jo(1,1/0),ta(zr)),[Yo]:ia(Jo(1,4),ta(zr)),[Vo]:ia(Jo(1,3),ta(zr)),[Zo]:ia(Jo(2,2),function(t,e,i){let n;try{n=Qr(t[1],zr,i)}catch(t){throw new Error(`failed to parse first argument in palette expression: ${t.message}`)}const s=t[2];if(!Array.isArray(s))throw new Error("the second argument of palette must be an array");const r=new Array(s.length);for(let t=0;t<r.length;t++){let e;try{e=Qr(s[t],Nr,i)}catch(e){throw new Error(`failed to parse color at index ${t} in palette expression: ${e.message}`)}if(!(e instanceof Hr))throw new Error(`the palette color at index ${t} must be a literal value`);r[t]=e}return[n,...r]}),[jo]:ia(Jo(1,1),ta(Gr|zr|Br|Nr))};function $o(t,e,i){const n=t.length-1,s=new Array(n);for(let e=0;e<n;++e){const n=t[e+1];switch(typeof n){case"number":s[e]=new Hr(zr,n);break;case"string":s[e]=new Hr(Br,n);break;default:throw new Error(`expected a string key or numeric array index for a get operation, got ${n}`)}0===e&&i.properties.add(String(n))}return s}function Ho(t,e,i){i.mapState=!0}function Uo(t,e,i){const n=t[0];if(1!==t.length)throw new Error(`expected no arguments for ${n} operation`);return[]}function Jo(t,e){return function(i,n,s){const r=i[0],o=i.length-1;if(t===e){if(o!==t){throw new Error(`expected ${t} argument${1===t?"":"s"} for ${r}, got ${o}`)}}else if(o<t||o>e){throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${r}, got ${o}`)}}}function Qo(t,e,i){const n=t.length-1,s=new Array(n);for(let r=0;r<n;++r){const n=Qr(t[r+1],e,i);s[r]=n}return s}function ta(t){return function(e,i,n){const s=e.length-1,r=new Array(s);for(let i=0;i<s;++i){const s=Qr(e[i+1],t,n);r[i]=s}return r}}function ea(t,e,i){const n=t[0],s=t.length-1;if(s%2==1)throw new Error(`expected an even number of arguments for operation ${n}, got ${s} instead`)}function ia(...t){return function(e,i,n){const s=e[0];let r;for(let s=0;s<t.length;s++){const o=t[s](e,i,n);if(s==t.length-1){if(!o)throw new Error("expected last argument validator to return the parsed args");r=o}}return new Ur(i,s,...r)}}function na(t){if(!t)return"";const e=t.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return na(t.getGeometries()[0]);default:return""}}function sa(t,e,i){return ra(Qr(t,e,i),i)}function ra(t,e){if(t instanceof Hr){if(t.type===Nr&&"string"==typeof t.value){const e=fn(t.value);return function(){return e}}return function(){return t.value}}const i=t.operator;switch(i){case zo:case Bo:case Do:return function(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let i=0;i<n;++i)s[i]=ra(t.args[i],e);switch(i){case Do:return t=>{for(let e=0;e<n;++e){const i=s[e](t);if(null!=i)return i}throw new Error("Expected one of the values to be non-null")};case zo:case Bo:return t=>{for(let e=0;e<n;++e){const n=s[e](t);if(typeof n===i)return n}throw new Error(`Expected one of the values to be a ${i}`)};default:throw new Error(`Unsupported assertion operator ${i}`)}}(t,e);case to:case eo:case Ko:return function(t){const e=t.args[0],i=e.value;switch(t.operator){case to:return e=>{const n=t.args;let s=e.properties[i];for(let t=1,e=n.length;t<e;++t){s=s[n[t].value]}return s};case eo:return t=>t.variables[i];case Ko:return e=>{const n=t.args;if(!(i in e.properties))return!1;let s=e.properties[i];for(let t=1,e=n.length;t<e;++t){const e=n[t].value;if(!s||!Object.hasOwn(s,e))return!1;s=s[e]}return!0};default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}(t);case Xo:return t=>t.featureId;case no:return t=>t.geometryType;case io:{const i=t.args.map(t=>ra(t,e));return t=>"".concat(...i.map(e=>e(t).toString()))}case lo:return t=>t.resolution;case ro:case oo:case Oo:case Go:case ao:return function(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let i=0;i<n;++i)s[i]=ra(t.args[i],e);switch(i){case ro:return t=>{for(let e=0;e<n;++e)if(s[e](t))return!0;return!1};case oo:return t=>{for(let e=0;e<n;++e)if(!s[e](t))return!1;return!0};case Oo:return t=>{const e=s[0](t),i=s[1](t),n=s[2](t);return e>=i&&e<=n};case Go:return t=>{const e=s[0](t);for(let i=1;i<n;++i)if(e===s[i](t))return!0;return!1};case ao:return t=>!s[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}(t,e);case uo:case go:case _o:case mo:case fo:case po:return function(t,e){const i=t.operator,n=ra(t.args[0],e),s=ra(t.args[1],e);switch(i){case uo:return t=>n(t)===s(t);case go:return t=>n(t)!==s(t);case _o:return t=>n(t)<s(t);case mo:return t=>n(t)<=s(t);case fo:return t=>n(t)>s(t);case po:return t=>n(t)>=s(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}(t,e);case yo:case xo:case So:case vo:case wo:case Co:case Io:case Mo:case Ro:case Eo:case bo:case To:case Lo:case Ao:case ko:return function(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let i=0;i<n;++i)s[i]=ra(t.args[i],e);switch(i){case yo:return t=>{let e=1;for(let i=0;i<n;++i)e*=s[i](t);return e};case xo:return t=>s[0](t)/s[1](t);case So:return t=>{let e=0;for(let i=0;i<n;++i)e+=s[i](t);return e};case vo:return t=>s[0](t)-s[1](t);case wo:return t=>{const e=s[0](t),i=s[1](t);if(e<i)return i;const n=s[2](t);return e>n?n:e};case Co:return t=>s[0](t)%s[1](t);case Io:return t=>Math.pow(s[0](t),s[1](t));case Mo:return t=>Math.abs(s[0](t));case Ro:return t=>Math.floor(s[0](t));case Eo:return t=>Math.ceil(s[0](t));case bo:return t=>Math.round(s[0](t));case To:return t=>Math.sin(s[0](t));case Lo:return t=>Math.cos(s[0](t));case Ao:return 2===n?t=>Math.atan2(s[0](t),s[1](t)):t=>Math.atan(s[0](t));case ko:return t=>Math.sqrt(s[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}(t,e);case Wo:return function(t,e){const i=t.args.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=ra(t.args[s],e);return t=>{for(let e=0;e<i-1;e+=2){if(n[e](t))return n[e+1](t)}return n[i-1](t)}}(t,e);case Fo:return function(t,e){const i=t.args.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=ra(t.args[s],e);return t=>{const e=n[0](t);for(let s=1;s<i-1;s+=2)if(e===n[s](t))return n[s+1](t);return n[i-1](t)}}(t,e);case Po:return function(t,e){const i=t.args.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=ra(t.args[s],e);return t=>{const e=n[0](t),s=n[1](t);let r,o;for(let a=2;a<i;a+=2){const i=n[a](t);let l=n[a+1](t);const h=Array.isArray(l);if(h&&(l=ln(l)),i>=s)return 2===a?l:h?aa(e,s,r,o,i,l):oa(e,s,r,o,i,l);r=i,o=l}return o}}(t,e);case jo:return function(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let i=0;i<n;++i)s[i]=ra(t.args[i],e);if(i===jo)return e=>{const i=s[0](e);return t.args[0].type===Nr?_n(i):i.toString()};throw new Error(`Unsupported convert operator ${i}`)}(t,e);default:throw new Error(`Unsupported operator ${i}`)}}function oa(t,e,i,n,s,r){const o=s-i;if(0===o)return n;const a=e-i;return n+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(r-n)}function aa(t,e,i,n,s,r){if(0===s-i)return n;const o=gn(n),a=gn(r);let l=a[2]-o[2];l>180?l-=360:l<-180&&(l+=360);return function(t){const e=(t[0]+16)/116,i=t[1],n=t[2]*Math.PI/180,s=cn(e),r=cn(e+i/500*Math.cos(n)),o=cn(e-i/200*Math.sin(n)),a=hn(3.021973625*r-1.617392459*s-.404875592*o),l=hn(-.943766287*r+1.916279586*s+.027607165*o),h=hn(.069407491*r-.22898585*s+1.159737864*o);return[ze(a+.5|0,0,255),ze(l+.5|0,0,255),ze(h+.5|0,0,255),t[3]]}([oa(t,e,i,o[0],s,a[0]),oa(t,e,i,o[1],s,a[1]),o[2]+oa(t,e,i,0,s,l),oa(t,e,i,n[3],s,r[3])])}class la extends Hs{constructor(t){super({opacity:1,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,rotation:void 0!==t.rotation?t.rotation:0,scale:void 0!==t.scale?t.scale:1,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=void 0!==t.fill?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=void 0!==t.angle?t.angle:0,this.stroke_=void 0!==t.stroke?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?Ki:qi,this.imageState_===Ki&&this.ready().then(()=>this.imageState_=qi),this.render()}clone(){const t=this.getScale(),e=new la({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 e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let n=Sn.get(i,null,null)?.getImage(1);if(!n){const e=this.renderOptions_,s=Math.ceil(e.size*t),r=pe(s,s);this.draw_(e,r,t),n=r.canvas,Sn.set(i,null,null,new In(n,void 0,null,qi,null))}return n}getPixelRatio(t){return t}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(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let n=this.radius,s=void 0===this.radius2_?n:this.radius2_;if(n<s){const t=n;n=s,s=t}const r=void 0===this.radius2_?this.points_:2*this.points_,o=2*Math.PI/r,a=s*Math.sin(o),l=n-Math.sqrt(s*s-a*a),h=Math.sqrt(a*a+l*l),c=h/a;if("miter"===t&&c<=i)return c*e;const u=e/2/c,d=e/2*(l/h),g=Math.sqrt((n+u)*(n+u)+d*d)-n;if(void 0===this.radius2_||"bevel"===t)return 2*g;const f=n*Math.sin(o),p=s-Math.sqrt(n*n-f*f),_=Math.sqrt(f*f+p*p)/f;if(_<=i){const t=_*e/2-s-n;return 2*Math.max(g,t)}return 2*g}createRenderOptions(){let t,e=Dn,i=Gn,n=0,s=null,r=0,o=0;this.stroke_&&(t=Mn(this.stroke_.getColor()??zn),o=this.stroke_.getWidth()??1,s=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,i=this.stroke_.getLineJoin()??Gn,e=this.stroke_.getLineCap()??Dn,n=this.stroke_.getMiterLimit()??10);const a=this.calculateLineJoinSize_(i,o,n),l=Math.max(this.radius,this.radius2_||0);return{strokeStyle:t,strokeWidth:o,size:Math.ceil(2*l+a),lineCap:e,lineDash:s,lineDashOffset:r,lineJoin:i,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let t=this.fill_.getColor();null===t&&(t=Pn),e.fillStyle=Mn(t),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),n=0;"string"==typeof i&&(i=pn(i)),null===i?n=1:Array.isArray(i)&&(n=4===i.length?i[3]:1),0===n&&(e=pe(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const n=void 0===this.radius2_?i:this.radius2_;void 0!==this.radius2_&&(e*=2);const s=this.angle_-Math.PI/2,r=2*Math.PI/e;for(let o=0;o<e;o++){const e=s+o*r,a=o%2==0?i:n;t.lineTo(a*Math.cos(e),a*Math.sin(e))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=Pn,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}const ha=la;class ca extends ha{constructor(t){super({points:1/0,fill:(t=t||{radius:5}).fill,radius:t.radius,stroke:t.stroke,scale:void 0!==t.scale?t.scale:1,rotation:void 0!==t.rotation?t.rotation:0,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){const t=this.getScale(),e=new ca({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 e.setOpacity(this.getOpacity()),e}setRadius(t){this.radius=t,this.render()}}const ua=ca;class da{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,void 0!==t.color&&this.setColor(t.color)}clone(){const t=this.getColor();return new da({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(null!==t&&"object"==typeof t&&"src"in t){const e=Cn(null,t.src,"anonymous",void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===ji&&e.load(),e.getImageState()===Ki&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?St(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:pn(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}const ga=da;class fa{constructor(t){t=t||{},this.color_=void 0!==t.color?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=void 0!==t.lineDash?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.width_=t.width}clone(){const t=this.getColor();return new fa({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(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setWidth(t){this.width_=t}}const pa=fa;class _a{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=xa,void 0!==t.geometry&&this.setGeometry(t.geometry),this.fill_=void 0!==t.fill?t.fill:null,this.image_=void 0!==t.image?t.image:null,this.renderer_=void 0!==t.renderer?t.renderer:null,this.hitDetectionRenderer_=void 0!==t.hitDetectionRenderer?t.hitDetectionRenderer:null,this.stroke_=void 0!==t.stroke?t.stroke:null,this.text_=void 0!==t.text?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&"object"==typeof t&&(t=t.clone()),new _a({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(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=xa,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let ma=null;function ya(t,e){if(!ma){const t=new ga({color:"rgba(255,255,255,0.4)"}),e=new pa({color:"#3399CC",width:1.25});ma=[new _a({image:new ua({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return ma}function xa(t){return t.getGeometry()}const Sa=_a;class va{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=qs(void 0!==t.scale?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=void 0!==t.fill?t.fill:new ga({color:"#333"}),this.maxAngle_=void 0!==t.maxAngle?t.maxAngle:Math.PI/4,this.placement_=void 0!==t.placement?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=void 0!==t.stroke?t.stroke:null,this.offsetX_=void 0!==t.offsetX?t.offsetX:0,this.offsetY_=void 0!==t.offsetY?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=void 0===t.padding?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new va({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(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=qs(void 0!==t?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}const wa=va;function Ca(t){return!0}function Ia(t){const e=Jr(),i=function(t,e){const i=t.length,n=new Array(i);for(let s=0;s<i;++s){const i=t[s],r="filter"in i?sa(i.filter,Gr,e):Ca;let o;if(Array.isArray(i.style)){const t=i.style.length;o=new Array(t);for(let n=0;n<t;++n)o[n]=Ra(i.style[n],e)}else o=[Ra(i.style,e)];n[s]={filter:r,styles:o}}return function(e){const s=[];let r=!1;for(let o=0;o<i;++o){if((0,n[o].filter)(e)&&(!t[o].else||!r)){r=!0;for(const t of n[o].styles){const i=t(e);i&&s.push(i)}}}return s}}(t,e),n={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""};return function(t,s){if(n.properties=t.getPropertiesInternal(),n.resolution=s,e.featureId){const e=t.getId();n.featureId=void 0!==e?e:null}return e.geometryType&&(n.geometryType=na(t.getGeometry())),i(n)}}function Ma(t){const e=Jr(),i=t.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=Ra(t[s],e);const s={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""},r=new Array(i);return function(t,o){if(s.properties=t.getPropertiesInternal(),s.resolution=o,e.featureId){const e=t.getId();s.featureId=void 0!==e?e:null}let a=0;for(let t=0;t<i;++t){const e=n[t](s);e&&(r[a]=e,a+=1)}return r.length=a,r}}function Ra(t,e){const i=Ea(t,"",e),n=ba(t,"",e),s=function(t,e){const i="text-",n=La(t,i+"value",e);if(!n)return null;const s=Ea(t,i,e),r=Ea(t,i+"background-",e),o=ba(t,i,e),a=ba(t,i+"background-",e),l=La(t,i+"font",e),h=Ta(t,i+"max-angle",e),c=Ta(t,i+"offset-x",e),u=Ta(t,i+"offset-y",e),d=Aa(t,i+"overflow",e),g=La(t,i+"placement",e),f=Ta(t,i+"repeat",e),p=Da(t,i+"scale",e),_=Aa(t,i+"rotate-with-view",e),m=Ta(t,i+"rotation",e),y=La(t,i+"align",e),x=La(t,i+"justify",e),S=La(t,i+"baseline",e),v=Aa(t,i+"keep-upright",e),w=Fa(t,i+"padding",e),C=Ba(t,i+"declutter-mode"),I=new wa({declutterMode:C});return function(t){if(I.setText(n(t)),s&&I.setFill(s(t)),r&&I.setBackgroundFill(r(t)),o&&I.setStroke(o(t)),a&&I.setBackgroundStroke(a(t)),l&&I.setFont(l(t)),h&&I.setMaxAngle(h(t)),c&&I.setOffsetX(c(t)),u&&I.setOffsetY(u(t)),d&&I.setOverflow(d(t)),g){const e=g(t);if("point"!==e&&"line"!==e)throw new Error("Expected point or line for text-placement");I.setPlacement(e)}if(f&&I.setRepeat(f(t)),p&&I.setScale(p(t)),_&&I.setRotateWithView(_(t)),m&&I.setRotation(m(t)),y){const e=y(t);if("left"!==e&&"center"!==e&&"right"!==e&&"end"!==e&&"start"!==e)throw new Error("Expected left, right, center, start, or end for text-align");I.setTextAlign(e)}if(x){const e=x(t);if("left"!==e&&"right"!==e&&"center"!==e)throw new Error("Expected left, right, or center for text-justify");I.setJustify(e)}if(S){const e=S(t);if("bottom"!==e&&"top"!==e&&"middle"!==e&&"alphabetic"!==e&&"hanging"!==e)throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");I.setTextBaseline(e)}return w&&I.setPadding(w(t)),v&&I.setKeepUpright(v(t)),I}}(t,e),r=function(t,e){if("icon-src"in t)return function(t,e){const i="icon-",n=i+"src",s=Ya(t[n],n),r=Oa(t,i+"anchor",e),o=Da(t,i+"scale",e),a=Ta(t,i+"opacity",e),l=Oa(t,i+"displacement",e),h=Ta(t,i+"rotation",e),c=Aa(t,i+"rotate-with-view",e),u=Ga(t,i+"anchor-origin"),d=za(t,i+"anchor-x-units"),g=za(t,i+"anchor-y-units"),f=function(t,e){const i=t[e];if(void 0===i)return;return Va(i,e)}(t,i+"color"),p=function(t,e){const i=t[e];if(void 0===i)return;if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);return i}(t,i+"cross-origin"),_=function(t,e){const i=t[e];if(void 0===i)return;return Na(i,e)}(t,i+"offset"),m=Ga(t,i+"offset-origin"),y=Wa(t,i+"width"),x=Wa(t,i+"height"),S=function(t,e){const i=t[e];if(void 0===i)return;if("number"==typeof i)return qs(i);if(!Array.isArray(i))throw new Error(`Expected a number or size array for ${e}`);if(2!==i.length||"number"!=typeof i[0]||"number"!=typeof i[1])throw new Error(`Expected a number or size array for ${e}`);return i}(t,i+"size"),v=Ba(t,i+"declutter-mode"),w=new Qs({src:s,anchorOrigin:u,anchorXUnits:d,anchorYUnits:g,color:f,crossOrigin:p,offset:_,offsetOrigin:m,height:x,width:y,size:S,declutterMode:v});return function(t){return a&&w.setOpacity(a(t)),l&&w.setDisplacement(l(t)),h&&w.setRotation(h(t)),c&&w.setRotateWithView(c(t)),o&&w.setScale(o(t)),r&&w.setAnchor(r(t)),w}}(t,e);if("shape-points"in t)return function(t,e){const i="shape-",n=i+"points",s=i+"radius",r=Xa(t[n],n),o=Xa(t[s],s),a=Ea(t,i,e),l=ba(t,i,e),h=Da(t,i+"scale",e),c=Oa(t,i+"displacement",e),u=Ta(t,i+"rotation",e),d=Aa(t,i+"rotate-with-view",e),g=Wa(t,i+"radius2"),f=Wa(t,i+"angle"),p=Ba(t,i+"declutter-mode"),_=new ha({points:r,radius:o,radius2:g,angle:f,declutterMode:p});return function(t){return a&&_.setFill(a(t)),l&&_.setStroke(l(t)),c&&_.setDisplacement(c(t)),u&&_.setRotation(u(t)),d&&_.setRotateWithView(d(t)),h&&_.setScale(h(t)),_}}(t,e);if("circle-radius"in t)return function(t,e){const i="circle-",n=Ea(t,i,e),s=ba(t,i,e),r=Ta(t,i+"radius",e),o=Da(t,i+"scale",e),a=Oa(t,i+"displacement",e),l=Ta(t,i+"rotation",e),h=Aa(t,i+"rotate-with-view",e),c=Ba(t,i+"declutter-mode"),u=new ua({radius:5,declutterMode:c});return function(t){return r&&u.setRadius(r(t)),n&&u.setFill(n(t)),s&&u.setStroke(s(t)),a&&u.setDisplacement(a(t)),l&&u.setRotation(l(t)),h&&u.setRotateWithView(h(t)),o&&u.setScale(o(t)),u}}(t,e);return null}(t,e),o=Ta(t,"z-index",e);if(!(i||n||s||r||ct(t)))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(t));const a=new Sa;return function(t){let e=!0;if(i){const n=i(t);n&&(e=!1),a.setFill(n)}if(n){const i=n(t);i&&(e=!1),a.setStroke(i)}if(s){const i=s(t);i&&(e=!1),a.setText(i)}if(r){const i=r(t);i&&(e=!1),a.setImage(i)}return o&&a.setZIndex(o(t)),e?null:a}}function Ea(t,e,i){let n;if(e+"fill-pattern-src"in t)n=function(t,e,i){const n=La(t,e+"pattern-src",i),s=Pa(t,e+"pattern-offset",i),r=Pa(t,e+"pattern-size",i),o=ka(t,e+"color",i);return function(t){return{src:n(t),offset:s&&s(t),size:r&&r(t),color:o&&o(t)}}}(t,e+"fill-",i);else{if("none"===t[e+"fill-color"])return t=>null;n=ka(t,e+"fill-color",i)}if(!n)return null;const s=new ga;return function(t){const e=n(t);return e===Hi?null:(s.setColor(e),s)}}function ba(t,e,i){const n=Ta(t,e+"stroke-width",i),s=ka(t,e+"stroke-color",i);if(!n&&!s)return null;const r=La(t,e+"stroke-line-cap",i),o=La(t,e+"stroke-line-join",i),a=Fa(t,e+"stroke-line-dash",i),l=Ta(t,e+"stroke-line-dash-offset",i),h=Ta(t,e+"stroke-miter-limit",i),c=new pa;return function(t){if(s){const e=s(t);if(e===Hi)return null;c.setColor(e)}if(n&&c.setWidth(n(t)),r){const e=r(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");c.setLineCap(e)}if(o){const e=o(t);if("bevel"!==e&&"round"!==e&&"miter"!==e)throw new Error("Expected bevel, round, or miter line join");c.setLineJoin(e)}return a&&c.setLineDash(a(t)),l&&c.setLineDashOffset(l(t)),h&&c.setMiterLimit(h(t)),c}}function Ta(t,e,i){if(!(e in t))return;const n=sa(t[e],zr,i);return function(t){return Xa(n(t),e)}}function La(t,e,i){if(!(e in t))return null;const n=sa(t[e],Br,i);return function(t){return Ya(n(t),e)}}function Aa(t,e,i){if(!(e in t))return null;const n=sa(t[e],Gr,i);return function(t){const i=n(t);if("boolean"!=typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function ka(t,e,i){if(!(e in t))return null;const n=sa(t[e],Nr,i);return function(t){return Va(n(t),e)}}function Fa(t,e,i){if(!(e in t))return null;const n=sa(t[e],Yr,i);return function(t){return Na(n(t),e)}}function Oa(t,e,i){if(!(e in t))return null;const n=sa(t[e],Yr,i);return function(t){const i=Na(n(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function Pa(t,e,i){if(!(e in t))return null;const n=sa(t[e],Yr,i);return function(t){return Za(n(t),e)}}function Da(t,e,i){if(!(e in t))return null;const n=sa(t[e],Yr|zr,i);return function(t){return function(t,e){if("number"==typeof t)return t;return Za(t,e)}(n(t),e)}}function Wa(t,e){const i=t[e];if(void 0!==i){if("number"!=typeof i)throw new Error(`Expected a number for ${e}`);return i}}function Ga(t,e){const i=t[e];if(void 0!==i){if("bottom-left"!==i&&"bottom-right"!==i&&"top-left"!==i&&"top-right"!==i)throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return i}}function za(t,e){const i=t[e];if(void 0!==i){if("pixels"!==i&&"fraction"!==i)throw new Error(`Expected pixels or fraction for ${e}`);return i}}function Ba(t,e){const i=t[e];if(void 0!==i){if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);if("declutter"!==i&&"obstacle"!==i&&"none"!==i)throw new Error(`Expected declutter, obstacle, or none for ${e}`);return i}}function Na(t,e){if(!Array.isArray(t))throw new Error(`Expected an array for ${e}`);const i=t.length;for(let n=0;n<i;++n)if("number"!=typeof t[n])throw new Error(`Expected an array of numbers for ${e}`);return t}function Ya(t,e){if("string"!=typeof t)throw new Error(`Expected a string for ${e}`);return t}function Xa(t,e){if("number"!=typeof t)throw new Error(`Expected a number for ${e}`);return t}function Va(t,e){if("string"==typeof t)return t;const i=Na(t,e),n=i.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function Za(t,e){const i=Na(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}const ja={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function Ka(t,e,i){return function(n,s,r,o,a){if(!n)return;if(!s&&!e)return n;const l=e?0:r[0]*s,h=e?0:r[1]*s,c=a?a[0]:0,u=a?a[1]:0;let d=t[0]+l/2+c,g=t[2]-l/2+c,f=t[1]+h/2+u,p=t[3]-h/2+u;d>g&&(d=(g+d)/2,g=d),f>p&&(f=(p+f)/2,p=f);let _=ze(n[0],d,g),m=ze(n[1],f,p);if(o&&i&&s){const t=30*s;_+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-g)/t),m+=-t*Math.log(1+Math.max(0,f-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-p)/t)}return[_,m]}}function qa(t){return t}function $a(t){return 1-function(t){return Math.pow(t,3)}(1-t)}function Ha(t){return 3*t*t-2*t*t*t}function Ua(t,e,i,n){let s=0;const r=t[i-n],o=t[i-n+1];let a=0,l=0;for(;e<i;e+=n){const i=t[e]-r,n=t[e+1]-o;s+=l*i-a*n,a=i,l=n}return s/2}function Ja(t,e,i,n){let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r];s+=Ua(t,e,o,n),e=o}return s}function Qa(t,e,i,n,s,r,o){const a=t[e],l=t[e+1],h=t[i]-a,c=t[i+1]-l;let u;if(0===h&&0===c)u=e;else{const d=((s-a)*h+(r-l)*c)/(h*h+c*c);if(d>1)u=i;else{if(d>0){for(let s=0;s<n;++s)o[s]=Ze(t[e+s],t[i+s],d);return void(o.length=n)}u=e}}for(let e=0;e<n;++e)o[e]=t[u+e];o.length=n}function tl(t,e,i,n,s){let r=t[e],o=t[e+1];for(e+=n;e<i;e+=n){const i=t[e],n=t[e+1],a=Ne(r,o,i,n);a>s&&(s=a),r=i,o=n}return s}function el(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];s=tl(t,e,o,n,s),e=o}return s}function il(t,e,i,n,s,r,o,a,l,h,c){if(e==i)return h;let u,d;if(0===s){if(d=Ne(o,a,t[e],t[e+1]),d<h){for(u=0;u<n;++u)l[u]=t[e+u];return l.length=n,d}return h}c=c||[NaN,NaN];let g=e+n;for(;g<i;)if(Qa(t,g-n,g,n,o,a,c),d=Ne(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n,g+=n}else g+=n*Math.max((Math.sqrt(d)-Math.sqrt(h))/s|0,1);if(r&&(Qa(t,i-n,e,n,o,a,c),d=Ne(o,a,c[0],c[1]),d<h)){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n}return h}function nl(t,e,i,n,s,r,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];h=il(t,e,d,n,s,r,o,a,l,h,c),e=d}return h}function sl(t,e,i,n){for(let s=0,r=i.length;s<r;++s){const r=i[s];for(let i=0;i<n;++i)t[e++]=r[i]}return e}function rl(t,e,i,n,s){s=s||[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=sl(t,e,i[o],n);s[r++]=a,e=a}return s.length=r,s}class al extends sr{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}clone(){return new al(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<Yt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(tl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),il(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return Ua(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Rn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=cs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new al(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=sl(this.flatCoordinates,0,t,this.stride),this.changed()}}const ll=al;class hl extends sr{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new hl(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const s=this.flatCoordinates,r=Ne(t,e,s[0],s[1]);if(r<n){const t=this.stride;for(let e=0;e<t;++e)i[e]=s[e];return i.length=t,r}return n}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return function(t,e){const i=t[0],n=t[1];return Kt(i,n,i,n,e)}(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Zt(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=function(t,e,i){for(let n=0,s=i.length;n<s;++n)t[e++]=i[n];return e}(this.flatCoordinates,0,t,this.stride),this.changed()}}const cl=hl;function ul(t,e,i,n,s){const r=function(t,e){let i;return i=e(Jt(t)),i||(i=e(Qt(t)),i||(i=e(se(t)),i||(i=e(ne(t)),i||!1)))}(s,function(s){return!dl(t,e,i,n,s[0],s[1])});return!r}function dl(t,e,i,n,s,r){let o=0,a=t[i-n],l=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];l<=r?n>r&&(i-a)*(r-l)-(s-a)*(n-l)>0&&o++:n<=r&&(i-a)*(r-l)-(s-a)*(n-l)<0&&o--,a=i,l=n}return 0!==o}function gl(t,e,i,n,s,r){if(0===i.length)return!1;if(!dl(t,e,i[0],n,s,r))return!1;for(let e=1,o=i.length;e<o;++e)if(dl(t,i[e-1],i[e],n,s,r))return!1;return!0}function fl(t,e,i,n,s,r,o){let a,l,h,c,u,d,g;const f=s[r+1],p=[];for(let s=0,r=i.length;s<r;++s){const r=i[s];for(c=t[r-n],d=t[r-n+1],a=e;a<r;a+=n)u=t[a],g=t[a+1],(f<=d&&g<=f||d<=f&&f<=g)&&(h=(f-d)/(g-d)*(u-c)+c,p.push(h)),c=u,d=g}let _=NaN,m=-1/0;for(p.sort(et),c=p[0],a=1,l=p.length;a<l;++a){u=p[a];const s=Math.abs(u-c);s>m&&(h=(c+u)/2,gl(t,e,i,n,h,f)&&(_=h,m=s)),c=u}return isNaN(_)&&(_=s[r]),o?(o.push(_,f,m),o):[_,f,m]}function pl(t,e,i,n,s,r){return r=r??Ht([1/0,1/0,-1/0,-1/0],t,e,i,n),!!oe(s,r)&&(r[0]>=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]||function(t,e,i,n,s){let r;for(e+=n;e<i;e+=n)if(r=s(t.slice(e-n,e),t.slice(e,e+n)),r)return r;return!1}(t,e,i,n,function(t,e){return function(t,e,i){let n=!1;const s=jt(t,e),r=jt(t,i);if(s===Dt||r===Dt)n=!0;else{const o=t[0],a=t[1],l=t[2],h=t[3],c=e[0],u=e[1],d=i[0],g=i[1],f=(g-u)/(d-c);let p,_;r&Wt&&!(s&Wt)&&(p=d-(g-h)/f,n=p>=o&&p<=l),n||!(r&Gt)||s&Gt||(_=g-(d-l)*f,n=_>=a&&_<=h),n||!(r&zt)||s&zt||(p=d-(g-a)/f,n=p>=o&&p<=l),n||!(r&Bt)||s&Bt||(_=g-(d-o)*f,n=_>=a&&_<=h)}return n}(s,t,e)}))}function _l(t,e,i,n,s){if(!function(t,e,i,n,s){return!!(pl(t,e,i,n,s)||dl(t,e,i,n,s[0],s[1])||dl(t,e,i,n,s[0],s[3])||dl(t,e,i,n,s[2],s[1])||dl(t,e,i,n,s[2],s[3]))}(t,e,i[0],n,s))return!1;if(1===i.length)return!0;for(let e=1,r=i.length;e<r;++e)if(ul(t,i[e-1],i[e],n,s)&&!pl(t,i[e-1],i[e],n,s))return!1;return!0}function ml(t,e,i,n){for(;e<i-n;){for(let s=0;s<n;++s){const r=t[e+s];t[e+s]=t[i-n+s],t[i-n+s]=r}e+=n,i-=n}}function yl(t,e,i,n){let s=0,r=t[i-n],o=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];s+=(i-r)*(n+o),r=i,o=n}return 0===s?void 0:s>0}function xl(t,e,i,n,s){s=void 0!==s&&s;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=yl(t,e,o,n);if(0===r){if(s&&a||!s&&!a)return!1}else if(s&&!a||!s&&a)return!1;e=o}return!0}function Sl(t,e,i,n,s){s=void 0!==s&&s;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=yl(t,e,o,n);(0===r?s&&a||!s&&!a:s&&!a||!s&&a)&&ml(t,e,o,n),e=o}return e}class vl extends sr{constructor(t,e,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,void 0!==e&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?rt(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new vl(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Yt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(el(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),nl(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return gl(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Ja(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),Sl(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,En(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=te(this.getExtent());this.flatInteriorPoint_=fl(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new cl(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new ll(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,n=[];let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=new ll(e.slice(s,o),t);n.push(a),s=o}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;xl(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Sl(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=gs(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new vl(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return _l(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=rl(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}function wl(t){if(ae(t))throw new Error("Cannot create polygon from empty extent");const e=t[0],i=t[1],n=t[2],s=t[3],r=[e,i,e,s,n,s,n,i,e,i];return new vl(r,"XY",[r.length])}function Cl(t,e,i,n){const s=re(e)/i[0],r=ie(e)/i[1];return n?Math.min(t,Math.max(s,r)):Math.min(t,Math.min(s,r))}function Il(t,e,i){let n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(n=Math.max(n,i),n/=Math.log(1+50*Math.max(0,i/t-1))/50+1),ze(n,i/2,2*e)}function Ml(t,e,i,n,s){return i=void 0===i||i,function(r,o,a,l){if(void 0!==r){const o=n?Cl(t,n,a,s):t;return i&&l?Il(r,o,e):ze(r,e,o)}}}function Rl(t){if(void 0!==t)return 0}function El(t){if(void 0!==t)return t}function bl(t,e){setTimeout(function(){t(e)},0)}function Tl(t){return!(t.sourceCenter&&t.targetCenter&&!ce(t.sourceCenter,t.targetCenter))&&(t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation)}function Ll(t,e,i,n,s){const r=Math.cos(-s);let o=Math.sin(-s),a=t[0]*r-t[1]*o,l=t[1]*r+t[0]*o;a+=(e[0]/2-i[0])*n,l+=(i[1]-e[1]/2)*n,o=-o;return[a*r-l*o,l*r+a*o]}const Al=class extends wt{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Ei(t.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,t.projection&&wi(),t.center&&(t.center=Di(t.center,this.projection_)),t.extent&&(t.extent=Gi(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in ja)delete e[t];this.setProperties(e,!0);const i=function(t){let e,i,n;const s=28,r=2;let o=void 0!==t.minZoom?t.minZoom:0,a=void 0!==t.maxZoom?t.maxZoom:s;const l=void 0!==t.zoomFactor?t.zoomFactor:r,h=void 0!==t.multiWorld&&t.multiWorld,c=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,u=void 0!==t.showFullExtent&&t.showFullExtent,d=Ei(t.projection,"EPSG:3857"),g=d.getExtent();let f=t.constrainOnlyCenter,p=t.extent;h||p||!d.isGlobal()||(f=!1,p=g);if(void 0!==t.resolutions){const s=t.resolutions;i=s[o],n=void 0!==s[a]?s[a]:s[s.length-1],e=t.constrainResolution?function(t,e,i,n){return e=void 0===e||e,function(s,r,o,a){if(void 0!==s){const l=t[0],h=t[t.length-1],c=i?Cl(l,i,o,n):l;if(a)return e?Il(s,c,h):ze(s,h,c);const u=Math.min(c,s),d=Math.floor(nt(t,u,r));return t[d]>c&&d<t.length-1?t[d+1]:t[d]}}}(s,c,!f&&p,u):Ml(i,n,c,!f&&p,u)}else{const h=(g?Math.max(re(g),ie(g)):360*Se.degrees/d.getMetersPerUnit())/256/Math.pow(r,0),_=h/Math.pow(r,s-0);i=t.maxResolution,void 0!==i?o=0:i=h/Math.pow(l,o),n=t.minResolution,void 0===n&&(n=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(l,a):h/Math.pow(l,a):_),a=o+Math.floor(Math.log(i/n)/Math.log(l)),n=i/Math.pow(l,a-o),e=t.constrainResolution?function(t,e,i,n,s,r){return n=void 0===n||n,i=void 0!==i?i:0,function(o,a,l,h){if(void 0!==o){const c=s?Cl(e,s,l,r):e;if(h)return n?Il(o,c,i):ze(o,i,c);const u=1e-9,d=Math.ceil(Math.log(e/c)/Math.log(t)-u),g=-a*(.5-u)+.5,f=Math.min(c,o),p=Math.floor(Math.log(e/f)/Math.log(t)+g),_=Math.max(d,p);return ze(e/Math.pow(t,_),i,c)}}}(l,i,n,c,!f&&p,u):Ml(i,n,c,!f&&p,u)}return{constraint:e,maxResolution:i,minResolution:n,minZoom:o,zoomFactor:l}}(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const n=function(t){if(void 0!==t.extent){const e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return Ka(t.extent,t.constrainOnlyCenter,e)}const e=Ei(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,Ka(t,!1,!1)}return qa}(t),s=i.constraint,r=function(t){const e=void 0===t.enableRotation||t.enableRotation;if(e){const e=t.constrainRotation;return void 0===e||!0===e?function(t){const e=void 0===t?Xe(5):t;return function(t,i){return i||void 0===t?t:Math.abs(t)<=e?0:t}}():!1===e?El:"number"==typeof e?function(t){const e=2*Math.PI/t;return function(t,i){return i?t:void 0!==t?t=Math.floor(t/e+.5)*e:void 0}}(e):El}return Rl}(t);this.constraints_={center:n,resolution:s,rotation:r},this.setRotation(void 0!==t.rotation?t.rotation:0),this.setCenterInternal(void 0!==t.center?t.center:null),void 0!==t.resolution?this.setResolution(t.resolution):void 0!==t.zoom&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const n=t||[0,0,0,0];e=e||[0,0,0,0];const s=this.getResolution(),r=s/2*(n[3]-e[3]+e[1]-n[1]),o=s/2*(n[0]-e[0]+e[2]-n[2]);this.setCenterInternal([i[0]+r,i[1]-o])}}getUpdatedOptions_(t){const e=this.getProperties();return void 0!==e.resolution?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let t=0;t<e.length;++t){let i=arguments[t];i.center&&(i=Object.assign({},i),i.center=Di(i.center,this.getProjection())),i.anchor&&(i=Object.assign({},i),i.anchor=Di(i.anchor,this.getProjection())),e[t]=i}this.animateInternal.apply(this,e)}animateInternal(t){let e,i=arguments.length;i>1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n<i&&!this.isDef();++n){const t=arguments[n];t.center&&this.setCenterInternal(t.center),void 0!==t.zoom?this.setZoom(t.zoom):t.resolution&&this.setResolution(t.resolution),void 0!==t.rotation&&this.setRotation(t.rotation)}if(n===i)return void(e&&bl(e,!0));let s=Date.now(),r=this.targetCenter_.slice(),o=this.targetResolution_,a=this.targetRotation_;const l=[];for(;n<i;++n){const t=arguments[n],i={start:s,complete:!1,anchor:t.anchor,duration:void 0!==t.duration?t.duration:1e3,easing:t.easing||Ha,callback:e};if(t.center&&(i.sourceCenter=r,i.targetCenter=t.center.slice(),r=i.targetCenter),void 0!==t.zoom?(i.sourceResolution=o,i.targetResolution=this.getResolutionForZoom(t.zoom),o=i.targetResolution):t.resolution&&(i.sourceResolution=o,i.targetResolution=t.resolution,o=i.targetResolution),void 0!==t.rotation){i.sourceRotation=a;const e=Ve(t.rotation-a+Math.PI,2*Math.PI)-Math.PI;i.targetRotation=a+e,a=i.targetRotation}Tl(i)?i.complete=!0:s+=i.duration,l.push(i)}this.animations_.push(l),this.setHint(Ft,1),this.updateAnimations_()}getAnimating(){return this.hints_[Ft]>0}getInteracting(){return this.hints_[Ot]>0}cancelAnimations(){let t;this.setHint(Ft,-this.hints_[Ft]);for(let e=0,i=this.animations_.length;e<i;++e){const i=this.animations_[e];if(i[0].callback&&bl(i[0].callback,!1),!t)for(let e=0,n=i.length;e<n;++e){const n=i[e];if(!n.complete){t=n.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const n=this.animations_[i];let s=!0;for(let i=0,r=n.length;i<r;++i){const r=n[i];if(r.complete)continue;const o=t-r.start;let a=r.duration>0?o/r.duration:1;a>=1?(r.complete=!0,a=1):s=!1;const l=r.easing(a);if(r.sourceCenter){const t=r.sourceCenter[0],e=r.sourceCenter[1],i=r.targetCenter[0],n=r.targetCenter[1];this.nextCenter_=r.targetCenter;const s=t+l*(i-t),o=e+l*(n-e);this.targetCenter_=[s,o]}if(r.sourceResolution&&r.targetResolution){const t=1===l?r.targetResolution:r.sourceResolution+l*(r.targetResolution-r.sourceResolution);if(r.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,r.anchor)}this.nextResolution_=r.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==r.sourceRotation&&void 0!==r.targetRotation){const t=1===l?Ve(r.targetRotation+Math.PI,2*Math.PI)-Math.PI:r.sourceRotation+l*(r.targetRotation-r.sourceRotation);if(r.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,r.anchor)}this.nextRotation_=r.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!r.complete)break}if(s){this.animations_[i]=null,this.setHint(Ft,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&bl(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();var s,r;return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],function(t,e){const i=Math.cos(e),n=Math.sin(e),s=t[0]*i-t[1]*n,r=t[1]*i+t[0]*n;t[0]=s,t[1]=r}(i,t-this.getRotation()),r=e,(s=i)[0]+=+r[0],s[1]+=+r[1]),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),s=this.getResolution();if(void 0!==n&&void 0!==s){i=[e[0]-t*(e[0]-n[0])/s,e[1]-t*(e[1]-n[1])/s]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?Pi(t,this.getProjection()):t}getCenterInternal(){return this.get(ja.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){return Wi(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();Rt(e,"The view center is not defined");const i=this.getResolution();Rt(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return Rt(void 0!==n,"The view rotation is not defined"),ee(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(ja.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Gi(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=re(t)/e[0],n=ie(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(i){return e/Math.pow(t,i*n)}}getRotation(){return this.get(ja.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,s=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/s}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const s=this.padding_;if(s){const t=this.getViewportSizeMinusPadding_();n=Ll(n,this.getViewportSize_(),[t[0]/2+s[3],t[1]/2+s[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const s=nt(this.resolutions_,t,1);n=s,e=this.resolutions_[s],i=s==this.resolutions_.length-1?2:e/this.resolutions_[s+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=ze(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,ze(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(Rt(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){Rt(!ae(t),"Cannot fit empty extent provided as `geometry`");i=wl(Gi(t,this.getProjection()))}else if("Circle"===t.getType()){const e=Gi(t.getExtent(),this.getProjection());i=wl(e),i.rotate(this.getRotation(),te(e))}else{const e=Oi();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),s=t.getFlatCoordinates(),r=t.getStride();let o=1/0,a=1/0,l=-1/0,h=-1/0;for(let t=0,e=s.length;t<e;t+=r){const e=s[t]*i-s[t+1]*n,r=s[t]*n+s[t+1]*i;o=Math.min(o,e),a=Math.min(a,r),l=Math.max(l,e),h=Math.max(h,r)}return[o,a,l,h]}fitInternal(t,e){let i=(e=e||{}).size;i||(i=this.getViewportSizeMinusPadding_());const n=void 0!==e.padding?e.padding:[0,0,0,0],s=void 0!==e.nearest&&e.nearest;let r;r=void 0!==e.minResolution?e.minResolution:void 0!==e.maxZoom?this.getResolutionForZoom(e.maxZoom):0;const o=this.rotatedExtentForGeometry(t);let a=this.getResolutionForExtentInternal(o,[i[0]-n[1]-n[3],i[1]-n[0]-n[2]]);a=isNaN(a)?r:Math.max(a,r),a=this.getConstrainedResolution(a,s?0:1);const l=this.getRotation(),h=Math.sin(l),c=Math.cos(l),u=te(o);u[0]+=(n[1]-n[3])/2*a,u[1]+=(n[0]-n[2])/2*a;const d=u[0]*c-u[1]*h,g=u[1]*c+u[0]*h,f=this.getConstrainedCenter([d,g],a),p=e.callback?e.callback:lt;void 0!==e.duration?this.animateInternal({resolution:a,center:f,duration:e.duration,easing:e.easing},p):(this.targetResolution_=a,this.targetCenter_=f,this.applyTargetState_(!1,!0),bl(p,!0))}centerOn(t,e,i){this.centerOnInternal(Di(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(Ll(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,n){let s;const r=this.padding_;if(r&&t){const o=this.getViewportSizeMinusPadding_(-i),a=Ll(t,n,[o[0]/2+r[3],o[1]/2+r[0]],e,i);s=[t[0]-a[0],t[1]-a[1]]}return s}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(t){const e=Pi(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){const e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&Di(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*t,0,n,i);e&&(this.targetCenter_=this.calculateCenterZoom(s,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=Di(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(n,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t?Di(t,this.getProjection()):t)}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,n=this.constraints_.rotation(this.targetRotation_,i),s=this.getViewportSize_(n),r=this.constraints_.resolution(this.targetResolution_,0,s,i),o=this.constraints_.center(this.targetCenter_,r,s,i,this.calculateCenterShift(this.targetCenter_,r,n,s));this.get(ja.ROTATION)!==n&&this.set(ja.ROTATION,n),this.get(ja.RESOLUTION)!==r&&(this.set(ja.RESOLUTION,r),this.set("zoom",this.getZoom(),!0)),o&&this.get(ja.CENTER)&&ce(this.get(ja.CENTER),o)||this.set(ja.CENTER,o),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=void 0!==t?t:200;const n=e||0,s=this.constraints_.rotation(this.targetRotation_),r=this.getViewportSize_(s),o=this.constraints_.resolution(this.targetResolution_,n,r),a=this.constraints_.center(this.targetCenter_,o,r,!1,this.calculateCenterShift(this.targetCenter_,o,s,r));if(0===t&&!this.cancelAnchor_)return this.targetResolution_=o,this.targetRotation_=s,this.targetCenter_=a,void this.applyTargetState_();i=i||(0===t?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===o&&this.getRotation()===s&&this.getCenterInternal()&&ce(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:a,resolution:o,duration:t,easing:$a,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Ot,1)}endInteraction(t,e,i){i=i&&Di(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(Ot,-1),this.resolveConstraints(t,e,i))}getConstrainedCenter(t,e){const i=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),i)}getConstrainedZoom(t,e){const i=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(i,e))}getConstrainedResolution(t,e){e=e||0;const i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,i)}},kl="opacity",Fl="visible",Ol="extent",Pl="zIndex",Dl="maxResolution",Wl="minResolution",Gl="maxZoom",zl="minZoom",Bl="source",Nl="map";const Yl=class extends wt{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);"object"==typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[kl]=void 0!==t.opacity?t.opacity:1,Rt("number"==typeof e[kl],"Layer opacity must be a number"),e[Fl]=void 0===t.visible||t.visible,e[Pl]=t.zIndex,e[Dl]=void 0!==t.maxResolution?t.maxResolution:1/0,e[Wl]=void 0!==t.minResolution?t.minResolution:0,e[zl]=void 0!==t.minZoom?t.minZoom:-1/0,e[Gl]=void 0!==t.maxZoom?t.maxZoom:1/0,this.className_=void 0!==e.className?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:void 0===t||t},i=this.getZIndex();return e.opacity=ze(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i||e.managed?i:1/0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return yt()}getLayerStatesArray(t){return yt()}getExtent(){return this.get(Ol)}getMaxResolution(){return this.get(Dl)}getMinResolution(){return this.get(Wl)}getMinZoom(){return this.get(zl)}getMaxZoom(){return this.get(Gl)}getOpacity(){return this.get(kl)}getSourceState(){return yt()}getVisible(){return this.get(Fl)}getZIndex(){return this.get(Pl)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Ol,t)}setMaxResolution(t){this.set(Dl,t)}setMinResolution(t){this.set(Wl,t)}setMaxZoom(t){this.set(Gl,t)}setMinZoom(t){this.set(zl,t)}setOpacity(t){Rt("number"==typeof t,"Layer opacity must be a number"),this.set(kl,t)}setVisible(t){this.set(Fl,t)}setZIndex(t){this.set(Pl,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}};const Xl=class extends Yl{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(Bl,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return(t=t||[]).push(this),t}getLayerStatesArray(t){return(t=t||[]).push(this.getLayerState()),t}getSource(){return this.get(Bl)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),this.sourceReady_||"ready"!==this.getSource().getState()||(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(pt(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=gt(t,Q,this.handleSourceChange_,this),"ready"===t.getState()&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();let n;if(!t&&i&&(t=i.getView()),e=t instanceof Al?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),e.layerStatesArray){if(n=e.layerStatesArray.find(t=>t.layer===this),!n)return!1}else n=this.getLayerState();const s=this.getExtent();return function(t,e){if(!t.visible)return!1;const i=e.resolution;if(i<t.minResolution||i>=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}(n,e.viewState)&&(!s||oe(s,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let i=e(t instanceof Al?t.getViewStateAndExtent():t);return Array.isArray(i)||(i=[i]),i}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(Nl,t)}getMapInternal(){return this.get(Nl)}setMap(t){this.mapPrecomposeKey_&&(pt(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(pt(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=gt(t,Zi,this.handlePrecompose_,this),this.mapRenderKey_=gt(this,Q,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);Rt(!e.some(t=>t.layer===i.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set(Bl,t)}getRenderer(){return this.renderer_||(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()}},Vl="renderOrder";const Zl=class extends Xl{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=void 0!==t.renderBuffer?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=void 0!==t.updateWhileAnimating&&t.updateWhileAnimating,this.updateWhileInteracting_=void 0!==t.updateWhileInteracting&&t.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Vl)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();i in t.declutter==!1&&(t.declutter[i]=new wr(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Vl,t)}setStyle(t){this.style_=void 0===t?ya:t;const e=function(t){if(void 0===t)return ya;if(!t)return null;if("function"==typeof t)return t;if(t instanceof Sa)return t;if(!Array.isArray(t))return Ma([t]);if(0===t.length)return[];const e=t.length,i=t[0];if(i instanceof Sa){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!(e instanceof Sa))throw new Error("Expected a list of style instances");i[n]=e}return i}if("style"in i){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!("style"in e))throw new Error("Expected a list of rules with a style property");i[n]=e}return Ia(i)}const n=t;return Ma(n)}(t);this.styleFunction_=null===t?void 0:function(t){let e;if("function"==typeof t)e=t;else{let i;Array.isArray(t)?i=t:(Rt("function"==typeof t.getZIndex,"Expected an `Style` or an array of `Style`"),i=[t]),e=function(){return i}}return e}(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}};const jl=class extends Zl{constructor(t){super(t)}createRenderer(){return new yr(this)}},Kl="active";const ql=class extends wt{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(Kl)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Kl,t)}setMap(t){this.map_=t}},$l="select";class Hl extends ut{constructor(t,e,i,n){super(t),this.selected=e,this.deselected=i,this.mapBrowserEvent=n}}const Ul={};class Jl extends ql{constructor(t){let e;if(super(),this.on,this.once,this.un,t=t||{},this.boundAddFeature_=this.addFeature_.bind(this),this.boundRemoveFeature_=this.removeFeature_.bind(this),this.condition_=t.condition?t.condition:At,this.addCondition_=t.addCondition?t.addCondition:Lt,this.removeCondition_=t.removeCondition?t.removeCondition:Lt,this.toggleCondition_=t.toggleCondition?t.toggleCondition:kt,this.multi_=!!t.multi&&t.multi,this.filter_=t.filter?t.filter:at,this.hitTolerance_=t.hitTolerance?t.hitTolerance:0,this.style_=void 0!==t.style?t.style:function(){const t=function(){const t={},e=[255,255,255,1],i=[0,153,255,1];return t.Polygon=[new _a({fill:new ga({color:[255,255,255,.5]})})],t.MultiPolygon=t.Polygon,t.LineString=[new _a({stroke:new pa({color:e,width:5})}),new _a({stroke:new pa({color:i,width:3})})],t.MultiLineString=t.LineString,t.Circle=t.Polygon.concat(t.LineString),t.Point=[new _a({image:new ua({radius:6,fill:new ga({color:i}),stroke:new pa({color:e,width:1.5})}),zIndex:1/0})],t.MultiPoint=t.Point,t.GeometryCollection=t.Polygon.concat(t.LineString,t.Point),t}();return rt(t.Polygon,t.LineString),rt(t.GeometryCollection,t.LineString),function(e){return e.getGeometry()?t[e.getGeometry().getType()]:null}}(),this.features_=t.features||new Mt,t.layers)if("function"==typeof t.layers)e=t.layers;else{const i=t.layers;e=function(t){return i.includes(t)}}else e=at;this.layerFilter_=e,this.featureLayerAssociation_={}}addFeatureLayerAssociation_(t,e){this.featureLayerAssociation_[St(t)]=e}getFeatures(){return this.features_}getHitTolerance(){return this.hitTolerance_}getLayer(t){return this.featureLayerAssociation_[St(t)]}setHitTolerance(t){this.hitTolerance_=t}setMap(t){this.getMap()&&this.style_&&this.features_.forEach(this.restorePreviousStyle_.bind(this)),super.setMap(t),t?(this.features_.addEventListener(H,this.boundAddFeature_),this.features_.addEventListener(U,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(H,this.boundAddFeature_),this.features_.removeEventListener(U,this.boundRemoveFeature_))}addFeature_(t){const e=t.element;if(this.style_&&this.applySelectedStyle_(e),!this.getLayer(e)){const t=this.getMap().getAllLayers().find(function(t){if(t instanceof jl&&t.getSource()&&t.getSource().hasFeature(e))return t});t&&this.addFeatureLayerAssociation_(e,t)}}removeFeature_(t){this.style_&&this.restorePreviousStyle_(t.element)}getStyle(){return this.style_}applySelectedStyle_(t){const e=St(t);e in Ul||(Ul[e]=t.getStyle()),t.setStyle(this.style_)}restorePreviousStyle_(t){const e=this.getMap().getInteractions().getArray();for(let i=e.length-1;i>=0;--i){const n=e[i];if(n!==this&&n instanceof Jl&&n.getStyle()&&-1!==n.getFeatures().getArray().lastIndexOf(t))return void t.setStyle(n.getStyle())}const i=St(t);t.setStyle(Ul[i]),delete Ul[i]}removeFeatureLayerAssociation_(t){delete this.featureLayerAssociation_[St(t)]}handleEvent(t){if(!this.condition_(t))return!0;const e=this.addCondition_(t),i=this.removeCondition_(t),n=this.toggleCondition_(t),s=!e&&!i&&!n,r=t.map,o=this.getFeatures(),a=[],l=[];if(s){ht(this.featureLayerAssociation_),r.forEachFeatureAtPixel(t.pixel,(t,e)=>{if(t instanceof bt&&this.filter_(t,e))return this.addFeatureLayerAssociation_(t,e),l.push(t),!this.multi_},{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let t=o.getLength()-1;t>=0;--t){const e=o.item(t),i=l.indexOf(e);i>-1?l.splice(i,1):(o.remove(e),a.push(e))}0!==l.length&&o.extend(l)}else{r.forEachFeatureAtPixel(t.pixel,(t,s)=>{if(t instanceof bt&&this.filter_(t,s))return!e&&!n||o.getArray().includes(t)?(i||n)&&o.getArray().includes(t)&&(a.push(t),this.removeFeatureLayerAssociation_(t)):(this.addFeatureLayerAssociation_(t,s),l.push(t)),!this.multi_},{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let t=a.length-1;t>=0;--t)o.remove(a[t]);o.extend(l)}return(l.length>0||a.length>0)&&this.dispatchEvent(new Hl($l,l,a,t)),!0}}const Ql=Jl;var th=v(4275),eh=v(5327),ih=v.n(eh);const nh="postrender";const sh=class extends wt{constructor(t){super();const e=t.element;!e||t.target||e.style.pointerEvents||(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let t=0,e=this.listenerKeys.length;t<e;++t)pt(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=t,t){const e=this.target_??t.getOverlayContainerStopEvent();this.element&&e.appendChild(this.element),this.render!==lt&&this.listenerKeys.push(gt(t,nh,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_="string"==typeof t?document.getElementById(t):t}},rh={POINT:"Point",LINE:"LineString",POLYGON:"Polygon",CIRCLE:"Circle"};function oh(t){return t>90||t<-90?t/1e5:t}function ah(t){return t>180||t<-180?t/1e5:t}function lh(t,e){const i=.017453292519943295,n=Math.cos,s=oh(t.latitude),r=oh(e.latitude),o=ah(t.longitude),a=ah(e.longitude),l=.5-n((r-s)*i)/2+n(s*i)*n(r*i)*(1-n((a-o)*i))/2;return Math.round(12742*Math.asin(Math.sqrt(l))*1e3)}function hh(t){let e=0;return t.forEach((i,n)=>{void 0!==t[n+1]&&(e+=lh(i,t[n+1]))}),e}class ch{layerWrapper=null;featureBuilder=null;modifyWrapper=null;overlayWrapper=null;layerWrapper=null;contextMenuWrapper=null;selectWrapper=null;drawWrappers=[];mapControls=[];constructor(){}getLayerWrapper(){return this.layerWrapper}getModifyWrapper(){return this.modifyWrapper}getOverlayWrapper(){return this.overlayWrapper}getDrawWrappers(){return this.drawWrappers}getSelectWrapper(){return this.selectWrapper}getContextMenuWrapper(){return this.contextMenuWrapper}getMapControls(){return this.mapControls}includeModify(t){if(!this.layerWrapper)throw new Error("LayerWrapper is null");this.modifyWrapper=new Rh({...t,source:this.layerWrapper.getSource()})}includeSelect(t){if(!this.layerWrapper)throw new Error("LayerWrapper is null");this.selectWrapper=new Mh({...t,layerWrapper:this.layerWrapper})}includeOverlay(t){this.overlayWrapper=new vh({...t})}includeDraw(t,e){t.source=this.layerWrapper.getSource(),e===rh.CIRCLE?this.drawWrappers.push(new Th(t)):e===rh.POLYGON&&this.drawWrappers.push(new bh(t))}includeControl(t){this.mapControls.push(new Ah(t))}includeContextMenu(t){this.contextMenuWrapper=new Fh(t)}setData(t,e=!1){this.featureBuilder&&(this.layerWrapper.removeAllFeatures(e),this.addData(t))}addData(t){if(this.featureBuilder){const e=this.featureBuilder.create(t);this.layerWrapper.addFeatures(Array.isArray(e)?e:[e])}}getDrawWrapperByType(t){return this.drawWrappers.find(e=>e.options.type===t)}setFeatureCoordinates(t,e){if(this.featureBuilder){const i=this.layerWrapper.getFeatureById(t);i&&this.featureBuilder.setCoordinate(i,e)}}setFeatureStyle(t,e){if(this.featureBuilder){const i=this.layerWrapper.getFeatureById(t);i&&this.featureBuilder.setStyle(i,e)}}}class uh extends ch{constructor(t){super(),this.layerWrapper=new fh(t)}}class dh extends ch{constructor(t){super(),this.layerWrapper=new ph(t)}}class gh{map=null;tileLayer=null;mapEvents={};options={hitTolerance:10};static EVENTS={CLICK:"click",SINGLECLICK:"singleclick",MOVEEND:"moveend",POINTERMOVE:"pointermove"};constructor(t=null,e={}){t&&this.init(t,e)}init(t,e={}){const i={zoom:e.zoom?e.zoom:4,center:(0,E.fromLonLat)(e.center?e.center:[0,0])},n={source:new b.OSM({})};this.tileLayer=new(L())(n);const s={target:t,layers:[this.tileLayer],view:new(R())(i)};this.map=new(I())(s),this.initEvents(),this.options.hitTolerance=void 0!==e.hitTolerance?e.hitTolerance:10}initEvents(){for(const t in gh.EVENTS)this.map.on(gh.EVENTS[t],e=>this.#t(gh.EVENTS[t],e))}getMap(){return this.map}getTileLayer(){return this.tileLayer}getViewPortCoordinates(){return this.map.getView().calculateExtent(this.map.getSize())}getViewCenter(){return(0,E.transform)(this.map.getView().getCenter(),"EPSG:3857","EPSG:4326")}addLayer(t){console.log(t.getLayer()),this.map.addLayer(t.getLayer())}removeLayer(t){this.map.removeLayer(t.getLayer())}addOverlay(t){t&&t.getOverlay()&&this.map.addOverlay(t.getOverlay())}addControl(t){t&&t.getControl()&&this.map.addControl(t.getControl())}addInteraction(t){t&&t.getInteraction()&&this.map.addInteraction(t.getInteraction())}getFeatureFromPixel(t){return this.map.forEachFeatureAtPixel(t,t=>t)}getLayerFromPixel(t){return this.map.forEachFeatureAtPixel(t,(t,e)=>e)}getZoomLevel(){return this.map.getView().getZoom()}fitToLayer(t,e={}){if(t.getSource().getFeatures().length>0){const i={size:this.map.getSize(),maxZoom:e.zoom?e.zoom:20,padding:e.padding?e.padding:[30,30,30,30],duration:e.duration?e.duration:0},n=t.getSource().getExtent();this.map.getView().fit(n,i)}}fitToFeature(t,e={}){const i={size:this.map.getSize(),maxZoom:e.zoom?e.zoom:20,padding:e.padding?e.padding:[20,20,20,20],duration:e.duration?e.duration:0},n=t.getGeometry().getExtent();this.map.getView().fit(n,i)}on(t,e){this.mapEvents.hasOwnProperty(t)?this.mapEvents[t].push(e):this.mapEvents[t]=[e]}off(t,e){this.mapEvents.hasOwnProperty(t)&&(this.mapEvents[t]=this.mapEvents[t].filter(t=>t!==e))}#t(t,e){this.mapEvents.hasOwnProperty(t)&&this.mapEvents[t].forEach(t=>{void 0!==e.pixel?this.map.forEachFeatureAtPixel(e.pixel,(i,n)=>{setTimeout(t(i,n,e),1)},{hitTolerance:this.options.hitTolerance}):setTimeout(t(e),1)})}addProcessor(t){this.addLayer(t.getLayerWrapper()),this.addInteraction(t.getModifyWrapper()),this.addOverlay(t.getOverlayWrapper()),this.addControl(t.getContextMenuWrapper()),this.addInteraction(t.getSelectWrapper()),t.drawWrappers.forEach(t=>this.addInteraction(t)),t.getMapControls().forEach(t=>this.addControl(t))}}class fh{layer=null;source=null;sourceEvents={};static EVENTS={ADD_FEATURE:"addfeature"};constructor(t={}){this.source=new(k())({wrapX:!1});const e={name:t?.name??"Layer",style:t?.style??new Y.Style,zIndex:t?.zIndex??1,opacity:t?.opacity??1,source:this.source};t.useVectorImage?this.layer=new(O())(e):this.layer=new(D())(e),this.initEvents()}initEvents(){for(const t in fh.EVENTS)this.source.on(fh.EVENTS[t],e=>this.#t(fh.EVENTS[t],e))}addFeatures(t){this.source.addFeatures(t)}addFeature(t){this.source.addFeature(t)}removeAllFeatures(t=!1){this.source.clear(t)}removeFeatures(t){this.source.removeFeatures(t)}removeFeature(t){this.source.removeFeature(t)}removeFeatureById(t){const e=this.getFeatureById(t);e&&this.removeFeature(e)}removeFeaturesByProperty(t,e){this.removeFeatures(this.getFeaturesByProperty(t,e))}getFeatureById(t){return this.source.getFeatureById(t)}getFeaturesByProperty(t,e){const i=[];return this.source.getFeatures.forEach(n=>{n.get("properties")[t]===e&&i.push(n)}),i}getAllFeatures(){return this.source.getFeatures()}getLayer(){return this.layer}getSource(){return this.source}getName(){return this.layer.get("name")}show(){this.layer.setVisible(!0)}hide(){this.layer.setVisible(!1)}setStyle(t){this.layer.setStyle(t)}on(t,e){this.sourceEvents.hasOwnProperty(t)?this.sourceEvents[t].push(e):this.sourceEvents[t]=[e]}off(t,e){this.sourceEvents.hasOwnProperty(t)&&(this.sourceEvents[t]=this.sourceEvents[t].filter(t=>t!==e))}#t(t,e){this.sourceEvents.hasOwnProperty(t)&&this.sourceEvents[t].forEach(t=>{setTimeout(t(e),1)})}}class ph extends fh{cluster=null;constructor(t){super(t);const e={source:this.source,distance:t?.distance??50};this.cluster=new b.Cluster(e);const i={name:t?.name??"ClusterLayer",style:t?.style??new Y.Style,zIndex:t?.zIndex??1,animationDuration:t?.animationDuration??200,options:t?.opacity??1,source:this.cluster};this.layer=new(G())(i),console.log(this.source)}setDistance(t){this.cluster.setDistance(t)}}class _h{options={style:null,idKey:null,nestedKey:null};constructor(t={}){this.options.style=void 0!==t.style?t.style:null,this.options.idKey=void 0!==t.idKey?t.idKey:null,this.options.nestedKey=void 0!==t.nestedKey?t.nestedKey:null}getOLCoordinate(t){const e=ah(t.longitude),i=oh(t.latitude);return(0,E.fromLonLat)([e,i])}setId(t,e,i){this.options.idKey?t.setId(i[this.options.idKey]):void 0!==e.id?t.setId(e.id):void 0!==i.id&&t.setId(i.id)}setStyle(t,e=null){t.setStyle(e??this.options?.style??null)}setCoordinate(t,e){t.getGeometry().setCoordinates(this.getOLCoordinate(e))}createFeatures(t){return t.map(t=>this.createFeature(t))}createFeature(t){throw new Error("Method is not implemented")}}class mh extends _h{constructor(t={}){super(t)}createFeature(t){const e=this.options.nestedKey?t[this.options.nestedKey]:t,i=this.getOLCoordinate(e),n={geometry:new z.Point(i)},s=new(N())(n);return s.set("properties",t),this.setId(s,e,t),this.setStyle(s,t?.style??null),s}create(t){return Array.isArray(t)?this.createFeatures(t):this.createFeature(t)}}class yh extends _h{constructor(t={}){super(t)}parsePoints(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i].coordinate;e.push(this.getOLCoordinate(n))}return[e]}createFeature(t){console.log(t);const e=this.parsePoints(t.points),i={geometry:new z.Polygon(e)},n=new(N())(i);return n.set("properties",t),this.setId(n,t,t),this.setStyle(n,t?.style??null),n}create(t){return Array.isArray(t)?this.createFeatures(t):this.createFeature(t)}}class xh extends _h{constructor(t={}){super(t)}createFeature(t){const e=this.options.nestedKey?t[this.options.nestedKey]:t,i=this.getOLCoordinate(e);console.log(i);const n={geometry:new z.Circle(i,t.radius)},s=new(N())(n);return s.set("properties",t),this.setId(s,e,t),this.setStyle(s,t?.style??null),s}create(t){return Array.isArray(t)?this.createFeatures(t):this.createFeature(t)}}class Sh extends _h{constructor(t={}){super(t)}parsePoints(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i].coordinate;e.push(this.getOLCoordinate(n))}return e}createFeature(t){const e=this.parsePoints(t.points),i={geometry:new z.LineString(e)},n=new(N())(i);return n.set("properties",t),this.setId(n,t,t),this.setStyle(n,t?.style??null),n}create(t){return Array.isArray(t)?this.createFeatures(t):this.createFeature(t)}}class vh{overlay=null;constructor(t={}){const e={element:document.getElementById(void 0!==t.element?t.element:null),offset:void 0!==t.offset?t.offset:[0,-30],positioning:"bottom-center"};this.overlay=new(V())(e)}getOverlay(){return this.overlay}setPositionByFeature(t){if(t){let e=t.getGeometry().getExtent();this.overlay.setPosition((0,Z.getCenter)(e))}else this.overlay.setPosition(void 0)}setContent(t){element.innerHTML=t}show(t,e){void 0!==e&&this.setContent(e),void 0!==t&&this.setPositionByFeature(t)}hide(){this.overlay.setPosition(void 0)}}function wh(t){return{latitude:(t[0].latitude+t[1].latitude)/2,longitude:(t[0].longitude+t[1].longitude)/2}}function Ch(t){const e={latitude:0,longitude:0},i=t.length;for(let n=0;n<i;n++){let i=t[n];e.latitude+=i.latitude,e.longitude+=i.longitude}return e.latitude/=i,e.longitude/=i,e}class Ih{interaction=null;constructor(){}setActive(t){this.interaction.setActive(t)}getInteraction(){return this.interaction}_parseCircleCoordinates(t){const e=t.getGeometry().getCenter(),i=t.getGeometry().getRadius(),n=(0,E.toLonLat)(e);return{longitude:n[0].toFixed(5),latitude:n[1].toFixed(5),radius:i}}_parsePointCoordinates(t){const e=(0,E.toLonLat)(t.getGeometry().getCoordinates());return{longitude:e[0].toFixed(5),latitude:e[1].toFixed(5),id:t.getId()}}_parsePolygonCoordinates(t){const e=t.getGeometry().getCoordinates()[0],i=[];for(let t=0,n=e.length;t<n;t++){const n=(0,E.toLonLat)(e[t]);i.push({longitude:n[0].toFixed(5),latitude:n[1].toFixed(5),order:t+1})}return{id:t.getId(),points:i}}_parseLSCoordinates(t){const e=t.getGeometry().getCoordinates();if(!this.options.editFirstAndLastPoint){const i=e[0],n=e[e.length-1],s=this.oldCoordinates[0],r=this.oldCoordinates[this.oldCoordinates.length-1];if(i[0]!==s[0]||i[1]!==s[1]||n[0]!==r[0]||n[1]!==r[1])return t.getGeometry().setCoordinates(this.oldCoordinates),void(this.oldCoordinates=null)}return{id:t.getId(),points:e.map((t,e)=>{const i=(0,E.toLonLat)(t);return{order:e+1,longitude:+(1e5*i[0]).toFixed(0),latitude:+(1e5*i[1]).toFixed(0)}})}}}class Mh extends Ih{options={layerWrapper:null,style:null,hitTolerance:5,selectedHandler:null,deselectedHandler:null,alwaysOneSelected:!0,active:!1};lastSelectedId=null;constructor(t){super(),this.options=t,console.log(this.options);const e={layers:this.options.layerWrapper?[this.options.layerWrapper.getLayer()]:[],style:this.options.style,hitTolerance:this.options?.hitTolerance??5,condition:this.options?.condition??th.click};console.log(e),this.options.alwaysOneSelected&&(e.toggleCondition=ol.events.condition.never,e.filter=function(t){return null===lastSelectedId||(t.getId()===lastSelectedId||null===lastSelectedId)}),this.interaction=new Ql(e),this.interaction.on("select",t=>console.log(t)),this.setActive(this.options?.active??!1)}getSelectedFeatures(){return this.interaction.getFeatures()}clear(){this.interaction.getFeatures().clear(),this.lastSelectedId=null}addFeatures(t){this.interaction.getFeatures().push(...t)}#e(t){console.log(t),this.options.deselectedHandler&&(t.deselected.length>0?this.options.deselected(t,t.deselected[0].get("properties")):this.options.deselected(t,null)),this.options.selectedHandler&&(t.selected.length>0?(this.options.selected(t,t.selected[0].get("properties")),void 0!==this.options.alwaysOneSelected&&this.options.alwaysOneSelected&&(lastSelectedId=t.selected[0].getId())):(this.options.selected(e,null),void 0!==this.options.alwaysOneSelected&&this.options.alwaysOneSelected&&this.interaction.getFeatures().push(t.deselected[0])))}}class Rh extends Ih{options={source:null,features:[],startModifyHandler:null,endModifyHandler:null,hitDteection:null,style:null,alwaysOneFeature:!0,editFirstAndLastPoint:!1};oldCoordinates=null;constructor(t){super(),this.options=t;const e={source:this.options.source,features:this.options.features,hitDetection:this.options.hitDetection??10,style:this.options.style,active:this.options.active??!1,deleteCondition:th.shiftKeyOnly};this.options.editFirstAndLastPoint||(e.vertexFilter=(t,e)=>{if(console.log(e),e.getType()===rh.LINE){const i=e.getCoordinates(),n=t[0]===i[0][0]&&t[1]===i[0][1],s=t[0]===i[i.length-1][0]&&t[1]===i[i.length-1][1];return!(n||s)}return!0}),this.interaction=new(K())(e),this.interaction.on("modifystart",this.#i.bind(this)),this.interaction.on("modifyend",this.#n.bind(this)),this.setActive(!1)}#n(t){const e=t.features.getArray();this.options.endModifyHandler&&this.options.endModifyHandler(this.#s(e),e)}#i(t){const e=t.features.getArray()[0].getGeometry().getCoordinates();this.oldCoordinates=e,this.options.startModifyHandler&&this.options.startModifyHandler(t)}#s(t){if(!this.options.alwaysOneFeature)return t.map(t=>{let e=t.getGeometry().getCoordinates();return e.length>=2&&Array.isArray(e[0])?this._parseLSCoordinates(t):1===e.length?this._parsePolygonCoordinates(t):this._parsePointCoordinates(t)});{const e=t[0],i=e.getGeometry().getCoordinates();for(let e=1;e<t.length;e++){const i=t[e],n=i.get("properties").coordinate,s=(0,E.fromLonLat)([+n.longitude,+n.latitude]);i.getGeometry().setCoordinates(s)}if(i.length>=2&&Array.isArray(i[0]))return[this._parseLSCoordinates(e)];if(1!==i.length)return[this._parsePointCoordinates(e)];this._parsePolygonCoordinates(e)}}}class Eh extends Ih{options={source:null,style:null,type:null,endDrawHandler:null,startDrawHandler:null,active:!1};constructor(t=null){super(),this.options=t;const e={source:this.options.source,style:this.options.style,type:this.options.type,active:this.options?.active??!1};this.interaction=new($())(e),this.interaction.on("drawend",this.drawEndEvent.bind(this)),this.interaction.on("drawstart",this.drawStartEvent.bind(this)),this.setActive(!1)}drawEndEvent(){throw new Error("Not implemented method")}drawStartEvent(){this.options.startDrawHandler&&this.options.startDrawHandler()}}class bh extends Eh{constructor(t){t.type=rh.POLYGON,super(t)}drawEndEvent(t){if(this.options.endDrawHandler){const e=t.feature;this.options.endDrawHandler(this._parsePolygonCoordinates(e),rh.POLYGON,t.feature)}}}class Th extends Eh{constructor(t){t.type=rh.CIRCLE,super(t)}drawEndEvent(t){if(this.options.endDrawHandler){const e=t.feature;this.options.endDrawHandler(this._parseCircleCoordinates(e),rh.CIRCLE,t.feature)}}}class Lh{control=null;getControl(){return this.control}}class Ah extends Lh{constructor(t){super();const e=document.createElement("button");e.innerHTML=t?.text??"*";const i=document.createElement("div");i.className="ol-unselectable ol-control "+(t?.className??""),i.appendChild(e),t.clickHandler&&i.addEventListener("click",t.clickHandler.bind(this),!1),this.control=new sh({element:i})}}class kh{text=null;classname=null;callback=null;icon=null;items=null;constructor(){return this}setText(t){return this.text=t,this}setClassName(t){return this.classname=t,this}setCallback(t){return this.callback=t,this}setIcon(t){return this.icon=t,this}setItems(t){return this.items=t,this}addItem(t){return this.items||(this.items=[]),this.items.push(t),this}}class Fh extends Lh{options={items:[],defaultItems:!1,width:null};constructor(t){super(),this.options=t,this.coordinates=null;const e={items:this.options?.items??[],defaultItems:this.options?.defaultItems??!1,width:this.options?.width??170};this.control=new(ih())(e)}addItems(t){this.control.extend(t)}addItem(t){this.control.push(t)}removeItems(){this.control.clear()}removeLastItem(){this.control.pop()}}return w})());
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("ol/Map"),require("ol/View"),require("ol/proj"),require("ol/source"),require("ol/layer/Tile"),require("ol/source/Vector"),require("ol/layer/VectorImage"),require("ol/layer/Vector"),require("ol-ext/layer/AnimatedCluster"),require("ol/geom"),require("ol/Feature"),require("ol/style"),require("ol/Overlay"),require("ol/extent"),require("ol/interaction/Modify"),require("ol/interaction/Draw"),require("ol/events/condition"),require("ol-contextmenu/dist/ol-contextmenu.js")):"function"==typeof define&&define.amd?define("wertyzvue",["ol/Map","ol/View","ol/proj","ol/source","ol/layer/Tile","ol/source/Vector","ol/layer/VectorImage","ol/layer/Vector","ol-ext/layer/AnimatedCluster","ol/geom","ol/Feature","ol/style","ol/Overlay","ol/extent","ol/interaction/Modify","ol/interaction/Draw","ol/events/condition","ol-contextmenu/dist/ol-contextmenu.js"],e):"object"==typeof exports?exports.wertyzvue=e(require("ol/Map"),require("ol/View"),require("ol/proj"),require("ol/source"),require("ol/layer/Tile"),require("ol/source/Vector"),require("ol/layer/VectorImage"),require("ol/layer/Vector"),require("ol-ext/layer/AnimatedCluster"),require("ol/geom"),require("ol/Feature"),require("ol/style"),require("ol/Overlay"),require("ol/extent"),require("ol/interaction/Modify"),require("ol/interaction/Draw"),require("ol/events/condition"),require("ol-contextmenu/dist/ol-contextmenu.js")):t.wertyzvue=e(t["ol/Map"],t["ol/View"],t["ol/proj"],t["ol/source"],t["ol/layer/Tile"],t["ol/source/Vector"],t["ol/layer/VectorImage"],t["ol/layer/Vector"],t["ol-ext/layer/AnimatedCluster"],t["ol/geom"],t["ol/Feature"],t["ol/style"],t["ol/Overlay"],t["ol/extent"],t["ol/interaction/Modify"],t["ol/interaction/Draw"],t["ol/events/condition"],t["ol-contextmenu/dist/ol-contextmenu.js"])}(self,(t,i,n,s,r,o,a,l,h,c,u,d,g,f,p,_,m,y)=>(()=>{"use strict";var x={1005:t=>{t.exports=a},1189:t=>{t.exports=i},1273:t=>{t.exports=s},1849:t=>{t.exports=d},2085:t=>{t.exports=h},2418:t=>{t.exports=u},2617:t=>{t.exports=o},2948:t=>{t.exports=g},3139:t=>{t.exports=_},4275:t=>{t.exports=m},5327:t=>{t.exports=y},5922:t=>{t.exports=r},5993:t=>{t.exports=l},7604:t=>{t.exports=c},7963:t=>{t.exports=p},8218:e=>{e.exports=t},8407:t=>{t.exports=n},8432:t=>{t.exports=f}},S={};function v(t){var e=S[t];if(void 0!==e)return e.exports;var i=S[t]={exports:{}};return x[t](i,i.exports,v),i.exports}v.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return v.d(e,{a:e}),e},v.d=(t,e)=>{for(var i in e)v.o(e,i)&&!v.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},v.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),v.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var w={};v.r(w),v.d(w,{ClusterLayerWrapper:()=>ph,ContextMenuWrapper:()=>Fh,ContextMenuWrapperItem:()=>kh,Control:()=>Lh,DrawCircleWrapper:()=>Th,DrawPolygonWrapper:()=>bh,DrawWrapper:()=>Eh,FeatureCircleBuilder:()=>xh,FeatureLineStringBuilder:()=>Sh,FeaturePointBuilder:()=>mh,FeaturePolygonBuilder:()=>yh,GEOMETRY:()=>rh,Interaction:()=>Ih,LayerWrapper:()=>fh,MapControl:()=>Ah,MapProcessor:()=>uh,MapProcessorCluster:()=>dh,MapWrapper:()=>gh,ModifyWrapper:()=>Rh,OverlayWrapper:()=>vh,Processor:()=>ch,SelectWrapper:()=>Mh,calculateCentroid:()=>Ch,calculateDistance:()=>lh,calculateDistanceLine:()=>hh,calculateMidPoint:()=>wh,prepareLatitude:()=>oh,prepareLongitude:()=>ah});var C=v(8218),I=v.n(C),M=v(1189),R=v.n(M),E=v(8407),b=v(1273),T=v(5922),L=v.n(T),A=v(2617),k=v.n(A),F=v(1005),O=v.n(F),P=v(5993),D=v.n(P),W=v(2085),G=v.n(W),z=v(7604),B=v(2418),N=v.n(B),Y=v(1849),X=v(2948),V=v.n(X),Z=v(8432),j=v(7963),K=v.n(j),q=v(3139),$=v.n(q);const H="add",U="remove",J="propertychange",Q="change";const tt=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function et(t,e){return t>e?1:t<e?-1:0}function it(t,e){return t<e?1:t>e?-1:0}function nt(t,e,i){if(t[0]<=e)return 0;const n=t.length;if(e<=t[n-1])return n-1;if("function"==typeof i){for(let s=1;s<n;++s){const n=t[s];if(n===e)return s;if(n<e)return i(e,t[s-1],n)>0?s-1:s}return n-1}if(i>0){for(let i=1;i<n;++i)if(t[i]<e)return i-1;return n-1}if(i<0){for(let i=1;i<n;++i)if(t[i]<=e)return i;return n-1}for(let i=1;i<n;++i){if(t[i]==e)return i;if(t[i]<e)return t[i-1]-e<e-t[i]?i-1:i}return n-1}function st(t,e,i){for(;e<i;){const n=t[e];t[e]=t[i],t[i]=n,++e,--i}}function rt(t,e){const i=Array.isArray(e)?e:[e],n=i.length;for(let e=0;e<n;e++)t[t.length]=i[e]}function ot(t,e){const i=t.length;if(i!==e.length)return!1;for(let n=0;n<i;n++)if(t[n]!==e[n])return!1;return!0}function at(){return!0}function lt(){}function ht(t){for(const e in t)delete t[e]}function ct(t){let e;for(e in t)return!1;return!e}const ut=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};const dt=class extends tt{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e="string"==typeof t,i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const s=e?new ut(t):t;s.target||(s.target=this.eventTarget_||this);const r=this.dispatching_||(this.dispatching_={}),o=this.pendingRemovals_||(this.pendingRemovals_={});let a;i in r||(r[i]=0,o[i]=0),++r[i];for(let t=0,e=n.length;t<e;++t)if(a="handleEvent"in n[t]?n[t].handleEvent(s):n[t].call(this,s),!1===a||s.propagationStopped){a=!1;break}if(0===--r[i]){let t=o[i];for(delete o[i];t--;)this.removeEventListener(i,lt);delete r[i]}return a}disposeInternal(){this.listeners_&&ht(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return!!this.listeners_&&(t?t in this.listeners_:Object.keys(this.listeners_).length>0)}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=lt,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}};function gt(t,e,i,n,s){if(s){const s=i;i=function(r){return t.removeEventListener(e,i),s.call(n??this,r)}}else n&&n!==t&&(i=i.bind(n));const r={target:t,type:e,listener:i};return t.addEventListener(e,i),r}function ft(t,e,i,n){return gt(t,e,i,n,!0)}function pt(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),ht(t))}class _t extends dt{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(Q)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=gt(this,t[s],e);return n}return gt(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let s=0;s<n;++s)i[s]=ft(this,t[s],e)}else i=ft(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)!function(t){if(Array.isArray(t))for(let e=0,i=t.length;e<i;++e)pt(t[e]);else pt(t)}(i);else if(Array.isArray(t))for(let i=0,n=t.length;i<n;++i)this.removeEventListener(t[i],e);else this.removeEventListener(t,e)}}_t.prototype.on,_t.prototype.once,_t.prototype.un;const mt=_t;function yt(){throw new Error("Unimplemented abstract method.")}let xt=0;function St(t){return t.ol_uid||(t.ol_uid=String(++xt))}class vt extends ut{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}const wt=class extends mt{constructor(t){super(),this.on,this.once,this.un,St(this),this.values_=null,void 0!==t&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}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(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new vt(i,t,e)),i=J,this.hasListener(i)&&this.dispatchEvent(new vt(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const n=this.values_||(this.values_={});if(i)n[t]=e;else{const i=n[t];n[t]=e,i!==e&&this.notify(t,i)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],ct(this.values_)&&(this.values_=null),e||this.notify(t,i)}}},Ct="length";class It extends ut{constructor(t,e,i){super(t),this.element=e,this.index=i}}const Mt=class extends wt{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t||[],this.unique_)for(let t=0,e=this.array_.length;t<e;++t)this.assertUnique_(this.array_[t],t);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(Ct)}insertAt(t,e){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new It(H,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new It(U,e,t)),e}setAt(t,e){if(t>=this.getLength())return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const i=this.array_[t];this.array_[t]=e,this.dispatchEvent(new It(U,i,t)),this.dispatchEvent(new It(H,e,t))}updateLength_(){this.set(Ct,this.array_.length)}assertUnique_(t,e){for(let i=0,n=this.array_.length;i<n;++i)if(this.array_[i]===t&&i!==e)throw new Error("Duplicate item added to a unique collection")}};function Rt(t,e){if(!t)throw new Error(e)}class Et extends wt{constructor(t){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_),t)if("function"==typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new Et(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const i=this.getStyle();return i&&t.setStyle(i),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(pt(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=gt(t,Q,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?function(t){if("function"==typeof t)return t;let e;if(Array.isArray(t))e=t;else{Rt("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`");e=[t]}return function(){return e}}(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}const bt=Et,Tt="singleclick";const Lt=function(){return!1},At=function(t){return t.type==Tt},kt=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Ft=0,Ot=1,Pt=0,Dt=1,Wt=2,Gt=4,zt=8,Bt=16;function Nt(t,e,i){return i?(i[0]=t[0]-e,i[1]=t[1]-e,i[2]=t[2]+e,i[3]=t[3]+e,i):[t[0]-e,t[1]-e,t[2]+e,t[3]+e]}function Yt(t,e,i){let n,s;return n=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0,s=i<t[1]?t[1]-i:t[3]<i?i-t[3]:0,n*n+s*s}function Xt(t,e){return Zt(t,e[0],e[1])}function Vt(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function Zt(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function jt(t,e){const i=t[0],n=t[1],s=t[2],r=t[3],o=e[0],a=e[1];let l=Pt;return o<i?l|=Bt:o>s&&(l|=Gt),a<n?l|=zt:a>r&&(l|=Wt),l===Pt&&(l=Dt),l}function Kt(t,e,i,n,s){return s?(s[0]=t,s[1]=e,s[2]=i,s[3]=n,s):[t,e,i,n]}function qt(t){return Kt(1/0,1/0,-1/0,-1/0,t)}function $t(t,e){e[0]<t[0]&&(t[0]=e[0]),e[0]>t[2]&&(t[2]=e[0]),e[1]<t[1]&&(t[1]=e[1]),e[1]>t[3]&&(t[3]=e[1])}function Ht(t,e,i,n,s){for(;i<n;i+=s)Ut(t,e[i],e[i+1]);return t}function Ut(t,e,i){t[0]=Math.min(t[0],e),t[1]=Math.min(t[1],i),t[2]=Math.max(t[2],e),t[3]=Math.max(t[3],i)}function Jt(t){return[t[0],t[1]]}function Qt(t){return[t[2],t[1]]}function te(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function ee(t,e,i,n,s){const[r,o,a,l,h,c,u,d]=function(t,e,i,n){const s=e*n[0]/2,r=e*n[1]/2,o=Math.cos(i),a=Math.sin(i),l=s*o,h=s*a,c=r*o,u=r*a,d=t[0],g=t[1];return[d-l+u,g-h-c,d-l-u,g-h+c,d+l-u,g+h+c,d+l+u,g+h-c,d-l+u,g-h-c]}(t,e,i,n);return Kt(Math.min(r,a,h,u),Math.min(o,l,c,d),Math.max(r,a,h,u),Math.max(o,l,c,d),s)}function ie(t){return t[3]-t[1]}function ne(t){return[t[0],t[3]]}function se(t){return[t[2],t[3]]}function re(t){return t[2]-t[0]}function oe(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function ae(t){return t[2]<t[0]||t[3]<t[1]}function le(t,e,i,n){if(ae(t))return qt(i);let s=[];if(n>1){const e=t[2]-t[0],i=t[3]-t[1];for(let r=0;r<n;++r)s.push(t[0]+e*r/n,t[1],t[2],t[1]+i*r/n,t[2]-e*r/n,t[3],t[0],t[3]-i*r/n)}else s=[t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]];e(s,s,2);const r=[],o=[];for(let t=0,e=s.length;t<e;t+=2)r.push(s[t]),o.push(s[t+1]);return function(t,e,i){return Kt(Math.min.apply(null,t),Math.min.apply(null,e),Math.max.apply(null,t),Math.max.apply(null,e),i)}(r,o,i)}function he(t,e){const i=e.getExtent(),n=te(t);if(e.canWrapX()&&(n[0]<i[0]||n[0]>=i[2])){const e=re(i),s=Math.floor((n[0]-i[0])/e)*e;t[0]-=s,t[2]-=s}return t}function ce(t,e){let i=!0;for(let n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function ue(t,e){if(e.canWrapX()){const i=re(e.getExtent()),n=function(t,e,i){const n=e.getExtent();let s=0;e.canWrapX()&&(t[0]<n[0]||t[0]>n[2])&&(i=i||re(n),s=Math.floor((t[0]-n[0])/i));return s}(t,e,i);n&&(t[0]-=n*i)}return t}const de="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",ge=(de.includes("safari")&&!de.includes("chrom")&&(de.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(de)),de.includes("webkit")&&de.includes("edge"),de.includes("macintosh"),"undefined"!=typeof devicePixelRatio&&devicePixelRatio,"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope),fe="undefined"!=typeof Image&&Image.prototype.decode;!function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}}();function pe(t,e,i,n){let s;return s=i&&i.length?i.shift():ge?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(s.width=t),e&&(s.height=e),s.getContext("2d",n)}let _e;function me(){return _e||(_e=pe(1,1)),_e}const ye={info:1,warn:2,error:3,none:4};let xe=ye.info;const Se={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};const ve=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||Se[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}},we=6378137,Ce=Math.PI*we,Ie=[-Ce,-Ce,Ce,Ce],Me=[-180,-85,180,85],Re=we*Math.log(Math.tan(Math.PI/2));class Ee extends ve{constructor(t){super({code:t,units:"m",extent:Ie,global:!0,worldExtent:Me,getPointResolution:function(t,e){return t/Math.cosh(e[1]/we)}})}}const be=[new Ee("EPSG:3857"),new Ee("EPSG:102100"),new Ee("EPSG:102113"),new Ee("EPSG:900913"),new Ee("http://www.opengis.net/def/crs/EPSG/0/3857"),new Ee("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Te(t,e,i,n){const s=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(s));for(let i=0;i<s;i+=n){e[i]=Ce*t[i]/180;let n=we*Math.log(Math.tan(Math.PI*(+t[i+1]+90)/360));n>Re?n=Re:n<-Re&&(n=-Re),e[i+1]=n}return e}function Le(t,e,i,n){const s=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(s));for(let i=0;i<s;i+=n)e[i]=180*t[i]/Ce,e[i+1]=360*Math.atan(Math.exp(t[i+1]/we))/Math.PI-90;return e}const Ae=[-180,-90,180,90],ke=6378137*Math.PI/180;class Fe extends ve{constructor(t,e){super({code:t,units:"degrees",extent:Ae,axisOrientation:e,global:!0,metersPerUnit:ke,worldExtent:Ae})}}const Oe=[new Fe("CRS:84"),new Fe("EPSG:4326","neu"),new Fe("urn:ogc:def:crs:OGC:1.3:CRS84"),new Fe("urn:ogc:def:crs:OGC:2:84"),new Fe("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Fe("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Fe("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Pe={};let De={};function We(t,e,i){const n=t.getCode(),s=e.getCode();n in De||(De[n]={}),De[n][s]=i}function Ge(t,e){return t in De&&e in De[t]?De[t][e]:null}function ze(t,e,i){return Math.min(Math.max(t,e),i)}function Be(t,e,i,n,s,r){const o=s-i,a=r-n;if(0!==o||0!==a){const l=((t-i)*o+(e-n)*a)/(o*o+a*a);l>1?(i=s,n=r):l>0&&(i+=o*l,n+=a*l)}return Ne(t,e,i,n)}function Ne(t,e,i,n){const s=i-t,r=n-e;return s*s+r*r}function Ye(t){return 180*t/Math.PI}function Xe(t){return t*Math.PI/180}function Ve(t,e){const i=t%e;return i*e<0?i+e:i}function Ze(t,e,i){return t+i*(e-t)}function je(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function Ke(t,e,i){if(t>=e&&t<i)return t;const n=i-e;return((t-e)%n+n)%n+e}const qe=.9996,$e=.00669438,He=$e*$e,Ue=He*$e,Je=$e/(1-$e),Qe=Math.sqrt(1-$e),ti=(1-Qe)/(1+Qe),ei=ti*ti,ii=ei*ti,ni=ii*ti,si=ni*ti,ri=.9983242984503243,oi=15*He/256+45*Ue/1024,ai=35*Ue/3072,li=1.5*ti-27/32*ii+269/512*si,hi=21/16*ei-55/32*ni,ci=151/96*ii-417/128*si,ui=1097/512*ni,di=6378137;function gi(t,e,i){const n=t-5e5,s=(i.north?e:e-1e7)/qe/(di*ri),r=s+li*Math.sin(2*s)+hi*Math.sin(4*s)+ci*Math.sin(6*s)+ui*Math.sin(8*s),o=Math.sin(r),a=o*o,l=Math.cos(r),h=o/l,c=h*h,u=c*c,d=1-$e*a,g=Math.sqrt(1-$e*a),f=Je*l**2,p=f*f,_=n/(di/g*qe),m=_*_,y=m*_,x=y*_,S=x*_,v=r-h/((1-$e)/d)*(m/2-x/24*(5+3*c+10*f-4*p-9*Je))+S*_/720*(61+90*c+298*f+45*u-252*Je-3*p);let w=(_-y/6*(1+2*c+f)+S/120*(5-2*f+28*c-3*p+8*Je+24*u))/l;return w=Ke(w+Xe(pi(i.number)),-Math.PI,Math.PI),[Ye(w),Ye(v)]}function fi(t,e,i){t=Ke(t,-180,180),e<-80?e=-80:e>84&&(e=84);const n=Xe(e),s=Math.sin(n),r=Math.cos(n),o=s/r,a=o*o,l=a*a,h=Xe(t),c=Xe(pi(i.number)),u=di/Math.sqrt(1-$e*s**2),d=Je*r**2,g=r*Ke(h-c,-Math.PI,Math.PI),f=g*g,p=f*g,_=p*g,m=_*g,y=m*g,x=di*(ri*n-.002514607064228144*Math.sin(2*n)+oi*Math.sin(4*n)-ai*Math.sin(6*n)),S=qe*u*(g+p/6*(1-a+d)+m/120*(5-18*a+l+72*d-58*Je))+5e5;let v=qe*(x+u*o*(f/2+_/24*(5-a+9*d+4*d**2)+y/720*(61-58*a+l+600*d-330*Je)));return i.north||(v+=1e7),[S,v]}function pi(t){return 6*(t-1)-180+3}const _i=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function mi(t){let e=0;for(const i of _i){const n=t.match(i);if(n){e=parseInt(n[1]);break}}if(!e)return null;let i=0,n=!1;return e>32700&&e<32761?i=e-32700:e>32600&&e<32661&&(n=!0,i=e-32600),i?{number:i,north:n}:null}function yi(t,e){return function(i,n,s,r){const o=i.length;s=s>1?s:2,r=r??s,n||(n=s>2?i.slice():new Array(o));for(let s=0;s<o;s+=r){const r=i[s],o=i[s+1],a=t(r,o,e);n[s]=a[0],n[s+1]=a[1]}return n}}const xi=[function(t){const e=mi(t.getCode());return e?{forward:yi(fi,e),inverse:yi(gi,e)}:null}],Si=[function(t){return mi(t)?new ve({code:t,units:"m"}):null}];let vi=!0;function wi(t){vi=!(void 0===t||t)}function Ci(t,e){if(void 0!==e)for(let i=0,n=t.length;i<n;++i)e[i]=t[i];else e=t.slice();return e}function Ii(t){!function(t,e){Pe[t]=e}(t.getCode(),t),We(t,t,Ci)}function Mi(t){if("string"!=typeof t)return t;const e=Pe[i=t]||Pe[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null;var i;if(e)return e;for(const e of Si){const i=e(t);if(i)return i}return null}function Ri(t){!function(t){t.forEach(Ii)}(t),t.forEach(function(e){t.forEach(function(t){e!==t&&We(e,t,Ci)})})}function Ei(t,e){return t?"string"==typeof t?Mi(t):t:Mi(e)}function bi(t,e){const i=t.getCode(),n=e.getCode();let s=Ge(i,n);if(s)return s;let r=null,o=null;for(const i of xi)r||(r=i(t)),o||(o=i(e));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)s=Ti(r.inverse,o.forward);else{const t=Ge(i,a);t&&(s=Ti(t,o.forward))}else{const t=Ge(a,n);t&&(s=Ti(r.inverse,t))}return s&&(Ii(t),Ii(e),We(t,e,s)),s}function Ti(t,e){return function(i,n,s,r){return n=t(i,n,s,r),e(n,n,s,r)}}function Li(t,e){return bi(Mi(t),Mi(e))}function Ai(t,e,i){const n=Li(e,i);if(!n){const t=Mi(e).getCode(),n=Mi(i).getCode();throw new Error(`No transform available between ${t} and ${n}`)}return n(t,void 0,t.length)}function ki(t,e,i,n){return le(t,Li(e,i),void 0,n)}let Fi=null;function Oi(){return Fi}function Pi(t,e){return Fi?Ai(t,e,Fi):t}function Di(t,e){return Fi?Ai(t,Fi,e):(vi&&!ce(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(vi=!1,function(...t){xe>ye.warn||console.warn(...t)}("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t)}function Wi(t,e){return Fi?ki(t,e,Fi):t}function Gi(t,e){return Fi?ki(t,Fi,e):t}function zi(t,e){if(!Fi)return t;const i=Mi(e).getMetersPerUnit(),n=Fi.getMetersPerUnit();return i&&n?t*i/n:t}var Bi,Ni,Yi;Ri(be),Ri(Oe),Bi=be,Ni=Te,Yi=Le,Oe.forEach(function(t){Bi.forEach(function(e){We(t,e,Ni),We(e,t,Yi)})});const Xi="prerender",Vi="postrender",Zi="precompose",ji=0,Ki=1,qi=2,$i=3,Hi=[NaN,NaN,NaN,0];let Ui;const Ji=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Qi=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,tn=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,en=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function nn(t,e){return t.endsWith("%")?Number(t.substring(0,t.length-1))/e:Number(t)}function sn(t){throw new Error('failed to parse "'+t+'" as color')}function rn(t){if(t.toLowerCase().startsWith("rgb")){const e=t.match(Qi)||t.match(Ji)||t.match(tn);if(e){const t=e[4],i=100/255;return[ze(nn(e[1],i)+.5|0,0,255),ze(nn(e[2],i)+.5|0,0,255),ze(nn(e[3],i)+.5|0,0,255),void 0!==t?ze(nn(t,100),0,1):1]}sn(t)}if(t.startsWith("#")){if(en.test(t)){const e=t.substring(1),i=e.length<=4?1:2,n=[0,0,0,255];for(let t=0,s=e.length;t<s;t+=i){let s=parseInt(e.substring(t,t+i),16);1===i&&(s+=s<<4),n[t/i]=s}return n[3]=n[3]/255,n}sn(t)}const e=(Ui||(Ui=pe(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),Ui);e.fillStyle="#abcdef";let i=e.fillStyle;e.fillStyle=t,e.fillStyle===i&&(e.fillStyle="#fedcba",i=e.fillStyle,e.fillStyle=t,e.fillStyle===i&&sn(t));const n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return rn(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);const s=Array.from(e.getImageData(0,0,1,1).data);return s[3]=je(s[3]/255,3),s}const on={};let an=0;function ln(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function hn(t){return t>.0031308?269.025*Math.pow(t,1/2.4)-14.025:3294.6*t}function cn(t){return t>.2068965?Math.pow(t,3):108/841*(t-4/29)}function un(t){return t>10.314724?Math.pow((t+14.025)/269.025,2.4):t/3294.6}function dn(t){return t>.0088564?Math.pow(t,1/3):t/(108/841)+4/29}function gn(t){const e=un(t[0]),i=un(t[1]),n=un(t[2]),s=dn(.222488403*e+.716873169*i+.06060791*n),r=500*(dn(.452247074*e+.399439023*i+.148375274*n)-s),o=200*(s-dn(.016863605*e+.117638439*i+.865350722*n)),a=Math.atan2(o,r)*(180/Math.PI);return[116*s-16,Math.sqrt(r*r+o*o),a<0?a+360:a,t[3]]}function fn(t){if("none"===t)return Hi;if(on.hasOwnProperty(t))return on[t];if(an>=1024){let t=0;for(const e in on)3&t++||(delete on[e],--an)}const e=rn(t);4!==e.length&&sn(t);for(const i of e)isNaN(i)&&sn(t);return on[t]=e,++an,e}function pn(t){return Array.isArray(t)?t:fn(t)}function _n(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];n!=(0|n)&&(n=n+.5|0);return"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}function mn(t,e){return e&&(t.src=e),t.src&&fe?new Promise((e,i)=>t.decode().then(()=>e(t)).catch(n=>t.complete&&t.width?e(t):i(n))):function(t,e){return new Promise((i,n)=>{function s(){o(),i(t)}function r(){o(),n(new Error("Image load error"))}function o(){t.removeEventListener("load",s),t.removeEventListener("error",r)}t.addEventListener("load",s),t.addEventListener("error",r),e&&(t.src=e)})}(t)}class yn{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 t=0;for(const e in this.cache_){const i=this.cache_[e];3&t++||i.hasListener()||(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,i){const n=xn(t,e,i);return n in this.cache_?this.cache_[n]:null}getPattern(t,e,i){const n=xn(t,e,i);return n in this.patternCache_?this.patternCache_[n]:null}set(t,e,i,n,s){const r=xn(t,e,i),o=r in this.cache_;this.cache_[r]=n,s&&(n.getImageState()===ji&&n.load(),n.getImageState()===Ki?n.ready().then(()=>{this.patternCache_[r]=me().createPattern(n.getImage(1),"repeat")}):this.patternCache_[r]=me().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function xn(t,e,i){return e+":"+t+":"+(i?pn(i):"null")}const Sn=new yn;let vn=null;class wn extends dt{constructor(t,e,i,n,s){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=s,this.imageState_=void 0===n?ji:n,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(void 0===this.tainted_&&this.imageState_===qi){vn||(vn=pe(1,1,void 0,{willReadFrequently:!0})),vn.drawImage(this.image_,0,0);try{vn.getImageData(0,0,1,1),this.tainted_=!1}catch{vn=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(Q)}handleImageError_(){this.imageState_=$i,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=qi,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=pe(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===ji){this.image_||this.initializeImage_(),this.imageState_=Ki;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&mn(this.image_,this.src_).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==qi)return;const e=this.image_,i=pe(Math.ceil(e.width*t),Math.ceil(e.height*t)),n=i.canvas;var s;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle="string"==typeof(s=this.color_)?s:_n(s),i.fillRect(0,0,n.width/t,n.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=n}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===qi||this.imageState_===$i)t();else{const e=()=>{this.imageState_!==qi&&this.imageState_!==$i||(this.removeEventListener(Q,e),t())};this.addEventListener(Q,e)}})),this.ready_}}function Cn(t,e,i,n,s,r){let o=void 0===e?void 0:Sn.get(e,i,s);return o||(o=new wn(t,t&&"src"in t?t.src||void 0:e,i,n,s),Sn.set(e,i,s,o,r)),r&&o&&!Sn.getPattern(e,i,s)&&Sn.set(e,i,s,o,r),o}const In=wn;function Mn(t){return t?Array.isArray(t)?_n(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return Sn.getPattern(t.src,"anonymous",t.color);const e=t.src+":"+t.offset,i=Sn.getPattern(e,void 0,t.color);if(i)return i;const n=Sn.get(t.src,"anonymous",null);if(n.getImageState()!==qi)return null;const s=pe(t.size[0],t.size[1]);return s.drawImage(n.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),Cn(s.canvas,e,void 0,qi,t.color,!0),Sn.getPattern(e,void 0,t.color)}(t):t:null}function Rn(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=e;o<i;o+=n)s[r++]=t.slice(o,o+n);return s.length=r,s}function En(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];s[r++]=Rn(t,e,a,n,s[r]),e=a}return s.length=r,s}function bn(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];s[r++]=1===a.length&&a[0]===e?[]:En(t,e,a,n,s[r]),e=a[a.length-1]}return s.length=r,s}const Tn=class{drawCustom(t,e,i,n,s){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}},Ln=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"),An=["style","variant","weight","size","lineHeight","family"],kn={normal:400,bold:700},Fn=function(t){const e=t.match(Ln);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let t=0,n=An.length;t<n;++t){const n=e[t+1];void 0!==n&&(i[An[t]]="string"==typeof n?n.trim():n)}return isNaN(Number(i.weight))&&i.weight in kn&&(i.weight=kn[i.weight]),i.families=i.family.split(/,\s?/).map(t=>t.trim().replace(/^['"]|['"]$/g,"")),i},On="10px sans-serif",Pn="#000",Dn="round",Wn=[],Gn="round",zn="#000",Bn="center",Nn="middle",Yn=[0,0,0,0],Xn=new wt;let Vn,Zn=null;const jn={},Kn=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function qn(t,e,i){return`${t} ${e} 16px "${i}"`}const $n=function(){const t=100;let e,i;async function n(t){await i.ready;const e=await i.load(t);if(0===e.length)return!1;const n=Fn(t),s=n.families[0].toLowerCase(),r=n.weight;return e.some(t=>{const e=t.family.replace(/^['"]|['"]$/g,"").toLowerCase(),i=kn[t.weight]||t.weight;return e===s&&t.style===n.style&&i==r})}async function s(){await i.ready;let r=!0;const o=Xn.getProperties(),a=Object.keys(o).filter(e=>o[e]<t);for(let e=a.length-1;e>=0;--e){const i=a[e];let s=o[i];s<t&&(await n(i)?(ht(jn),Xn.set(i,t)):(s+=10,Xn.set(i,s,!0),s<t&&(r=!1)))}e=void 0,r||(e=setTimeout(s,100))}return async function(t){i||(i=ge?self.fonts:document.fonts);const n=Fn(t);if(!n)return;const r=n.families;let o=!1;for(const t of r){if(Kn.has(t))continue;const e=qn(n.style,n.weight,t);void 0===Xn.get(e)&&(Xn.set(e,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(s,100))}}(),Hn=function(){let t;return function(e){let i=jn[e];if(null==i){if(ge){const t=Fn(e),n=Un(e,"Žg");i=(isNaN(Number(t.lineHeight))?1.2:Number(t.lineHeight))*(n.actualBoundingBoxAscent+n.actualBoundingBoxDescent)}else t||(t=document.createElement("div"),t.innerHTML="M",t.style.minHeight="0",t.style.maxHeight="none",t.style.height="auto",t.style.padding="0",t.style.border="none",t.style.position="absolute",t.style.display="block",t.style.left="-99999px"),t.style.font=e,document.body.appendChild(t),i=t.offsetHeight,document.body.removeChild(t);jn[e]=i}return i}}();function Un(t,e){return Zn||(Zn=pe(1,1)),t!=Vn&&(Zn.font=t,Vn=Zn.font),Zn.measureText(e)}function Jn(t,e){return Un(t,e).width}function Qn(t,e,i){if(e in i)return i[e];const n=e.split("\n").reduce((e,i)=>Math.max(e,Jn(t,i)),0);return i[e]=n,n}function ts(t,e,i,n,s,r,o,a,l,h,c){t.save(),1!==i&&(void 0===t.globalAlpha?t.globalAlpha=t=>t.globalAlpha*=i:t.globalAlpha*=i),e&&t.transform.apply(t,e),n.contextInstructions?(t.translate(l,h),t.scale(c[0],c[1]),function(t,e){const i=t.contextInstructions;for(let t=0,n=i.length;t<n;t+=2)Array.isArray(i[t+1])?e[i[t]].apply(e,i[t+1]):e[i[t]]=i[t+1]}(n,t)):c[0]<0||c[1]<0?(t.translate(l,h),t.scale(c[0],c[1]),t.drawImage(n,s,r,o,a,0,0,o,a)):t.drawImage(n,s,r,o,a,l,h,o*c[0],a*c[1]),t.restore()}const es={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},is=[es.FILL],ns=[es.STROKE],ss=[es.BEGIN_PATH],rs=[es.CLOSE_PATH],os=es;const as=class extends Tn{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return 1==e?t:t.map(function(t){return t*e})}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,s=this.coordinates;let r=s.length;for(let o=0,a=t.length;o<a;o+=e)n[0]=t[o],n[1]=t[o+1],Xt(i,n)&&(s[r++]=n[0],s[r++]=n[1]);return r}appendFlatLineCoordinates(t,e,i,n,s,r){const o=this.coordinates;let a=o.length;const l=this.getBufferedMaxExtent();r&&(e+=n);let h=t[e],c=t[e+1];const u=this.tmpCoordinate_;let d,g,f,p=!0;for(d=e+n;d<i;d+=n)u[0]=t[d],u[1]=t[d+1],f=jt(l,u),f!==g?(p&&(o[a++]=h,o[a++]=c,p=!1),o[a++]=u[0],o[a++]=u[1]):f===Dt?(o[a++]=u[0],o[a++]=u[1],p=!1):p=!0,h=u[0],c=u[1],g=f;return(s&&p||d===e+n)&&(o[a++]=h,o[a++]=c),a}drawCustomCoordinates_(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r],a=this.appendFlatLineCoordinates(t,e,o,n,!1,!1);s.push(a),e=o}return e}drawCustom(t,e,i,n,s){this.beginGeometry(t,e,s);const r=t.getType(),o=t.getStride(),a=this.coordinates.length;let l,h,c,u,d;switch(r){case"MultiPolygon":l=t.getOrientedFlatCoordinates(),u=[];const e=t.getEndss();d=0;for(let t=0,i=e.length;t<i;++t){const i=[];d=this.drawCustomCoordinates_(l,d,e[t],o,i),u.push(i)}this.instructions.push([os.CUSTOM,a,u,t,i,bn,s]),this.hitDetectionInstructions.push([os.CUSTOM,a,u,t,n||i,bn,s]);break;case"Polygon":case"MultiLineString":c=[],l="Polygon"==r?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(l,0,t.getEnds(),o,c),this.instructions.push([os.CUSTOM,a,c,t,i,En,s]),this.hitDetectionInstructions.push([os.CUSTOM,a,c,t,n||i,En,s]);break;case"LineString":case"Circle":l=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([os.CUSTOM,a,h,t,i,Rn,s]),this.hitDetectionInstructions.push([os.CUSTOM,a,h,t,n||i,Rn,s]);break;case"MultiPoint":l=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(l,o),h>a&&(this.instructions.push([os.CUSTOM,a,h,t,i,Rn,s]),this.hitDetectionInstructions.push([os.CUSTOM,a,h,t,n||i,Rn,s]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([os.CUSTOM,a,h,t,i,void 0,s]),this.hitDetectionInstructions.push([os.CUSTOM,a,h,t,n||i,void 0,s])}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[os.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[os.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let n,s,r=-1;for(e=0;e<i;++e)n=t[e],s=n[0],s==os.END_GEOMETRY?r=e:s==os.BEGIN_GEOMETRY&&(n[2]=e,st(this.hitDetectionInstructions,r,e),r=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&"object"==typeof i&&"src"in i?this.pixelRatio:1,e.fillStyle=Mn(i||Pn)}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=Mn(i||zn);const n=t.getLineCap();e.lineCap=void 0!==n?n:Dn;const s=t.getLineDash();e.lineDash=s?s.slice():Wn;const r=t.getLineDashOffset();e.lineDashOffset=r||0;const o=t.getLineJoin();e.lineJoin=void 0!==o?o:Gn;const a=t.getWidth();e.lineWidth=void 0!==a?a:1;const l=t.getMiterLimit();e.miterLimit=void 0!==l?l:10,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[os.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[os.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;"string"==typeof i&&t.currentFillStyle==i||(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,s=t.lineDash,r=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||s!=t.currentLineDash&&!ot(t.currentLineDash,s)||t.currentLineDashOffset!=r||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=s,t.currentLineDashOffset=r,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[os.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=(t=this.maxExtent,e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t.slice()),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;Nt(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}var t,e;return this.bufferedMaxExtent_}};const ls=class extends as{constructor(t,e,i,n){super(t,e,i,n),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(t,e,i){if(!this.image_||this.maxExtent&&!Xt(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),s=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(n,s);this.instructions.push([os.DRAW_IMAGE,r,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([os.DRAW_IMAGE,r,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(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),s=[];for(let e=0,i=n.length;e<i;e+=t.getStride())this.maxExtent&&!Xt(this.maxExtent,n.slice(e,e+2))||s.push(n[e],n[e+1]);const r=this.coordinates.length,o=this.appendFlatPointCoordinates(s,2);this.instructions.push([os.DRAW_IMAGE,r,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([os.DRAW_IMAGE,r,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(e)}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(t,e){const i=t.getAnchor(),n=t.getSize(),s=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}};const hs=class extends as{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n){const s=this.coordinates.length,r=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),o=[os.MOVE_TO_LINE_TO,s,r];return this.instructions.push(o),this.hitDetectionInstructions.push(o),i}drawLineString(t,e,i){const n=this.state,s=n.strokeStyle,r=n.lineWidth;if(void 0===s||void 0===r)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([os.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Wn,0],ss);const o=t.getFlatCoordinates(),a=t.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push(ns),this.endGeometry(e)}drawMultiLineString(t,e,i){const n=this.state,s=n.strokeStyle,r=n.lineWidth;if(void 0===s||void 0===r)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([os.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Wn,0],ss);const o=t.getEnds(),a=t.getFlatCoordinates(),l=t.getStride();let h=0;for(let t=0,e=o.length;t<e;++t)h=this.drawFlatCoordinates_(a,h,o[t],l);this.hitDetectionInstructions.push(ns),this.endGeometry(e)}finish(){const t=this.state;return null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(ns),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(ns),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(ss)}};function cs(t,e,i,n,s,r,o){const a=(i-e)/n;if(a<3){for(;e<i;e+=n)r[o++]=t[e],r[o++]=t[e+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[e,i-n];let c=0;for(;h.length>0;){const i=h.pop(),r=h.pop();let o=0;const a=t[r],u=t[r+1],d=t[i],g=t[i+1];for(let e=r+n;e<i;e+=n){const i=Be(t[e],t[e+1],a,u,d,g);i>o&&(c=e,o=i)}o>s&&(l[(c-e)/n]=1,r+n<c&&h.push(r,c),c+n<i&&h.push(c,i))}for(let i=0;i<a;++i)l[i]&&(r[o++]=t[e+i*n],r[o++]=t[e+i*n+1]);return o}function us(t,e){return e*Math.round(t/e)}function ds(t,e,i,n,s,r,o){if(e==i)return o;let a,l,h=us(t[e],s),c=us(t[e+1],s);e+=n,r[o++]=h,r[o++]=c;do{if(a=us(t[e],s),l=us(t[e+1],s),(e+=n)==i)return r[o++]=a,r[o++]=l,o}while(a==h&&l==c);for(;e<i;){const i=us(t[e],s),u=us(t[e+1],s);if(e+=n,i==a&&u==l)continue;const d=a-h,g=l-c,f=i-h,p=u-c;d*p==g*f&&(d<0&&f<d||d==f||d>0&&f>d)&&(g<0&&p<g||g==p||g>0&&p>g)?(a=i,l=u):(r[o++]=a,r[o++]=l,h=a,c=l,a=i,l=u)}return r[o++]=a,r[o++]=l,o}function gs(t,e,i,n,s,r,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=ds(t,e,h,n,s,r,o),a.push(o),e=h}return o}const fs=class extends as{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinatess_(t,e,i,n){const s=this.state,r=void 0!==s.fillStyle,o=void 0!==s.strokeStyle,a=i.length;this.instructions.push(ss),this.hitDetectionInstructions.push(ss);for(let s=0;s<a;++s){const r=i[s],a=this.coordinates.length,l=this.appendFlatLineCoordinates(t,e,r,n,!0,!o),h=[os.MOVE_TO_LINE_TO,a,l];this.instructions.push(h),this.hitDetectionInstructions.push(h),o&&(this.instructions.push(rs),this.hitDetectionInstructions.push(rs)),e=r}return r&&(this.instructions.push(is),this.hitDetectionInstructions.push(is)),o&&(this.instructions.push(ns),this.hitDetectionInstructions.push(ns)),e}drawCircle(t,e,i){const n=this.state,s=n.fillStyle,r=n.strokeStyle;if(void 0===s&&void 0===r)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([os.SET_FILL_STYLE,Pn]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([os.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Wn,0]);const o=t.getFlatCoordinates(),a=t.getStride(),l=this.coordinates.length;this.appendFlatLineCoordinates(o,0,o.length,a,!1,!1);const h=[os.CIRCLE,l];this.instructions.push(ss,h),this.hitDetectionInstructions.push(ss,h),void 0!==n.fillStyle&&(this.instructions.push(is),this.hitDetectionInstructions.push(is)),void 0!==n.strokeStyle&&(this.instructions.push(ns),this.hitDetectionInstructions.push(ns)),this.endGeometry(e)}drawPolygon(t,e,i){const n=this.state,s=n.fillStyle,r=n.strokeStyle;if(void 0===s&&void 0===r)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([os.SET_FILL_STYLE,Pn]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([os.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Wn,0]);const o=t.getEnds(),a=t.getOrientedFlatCoordinates(),l=t.getStride();this.drawFlatCoordinatess_(a,0,o,l),this.endGeometry(e)}drawMultiPolygon(t,e,i){const n=this.state,s=n.fillStyle,r=n.strokeStyle;if(void 0===s&&void 0===r)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([os.SET_FILL_STYLE,Pn]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([os.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Wn,0]);const o=t.getEndss(),a=t.getOrientedFlatCoordinates(),l=t.getStride();let h=0;for(let t=0,e=o.length;t<e;++t)h=this.drawFlatCoordinatess_(a,h,o[t],l);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(0!==t){const e=this.coordinates;for(let i=0,n=e.length;i<n;++i)e[i]=us(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}};function ps(t,e,i,n,s){const r=[];let o=i,a=0,l=e.slice(i,2);for(;a<t&&o+s<n;){const[i,n]=l.slice(-2),h=e[o+s],c=e[o+s+1],u=Math.sqrt((h-i)*(h-i)+(c-n)*(c-n));if(a+=u,a>=t){const e=(t-a+u)/u,d=Ze(i,h,e),g=Ze(n,c,e);l.push(d,g),r.push(l),l=[d,g],a==t&&(o+=s),a=0}else if(a<t)l.push(e[o+s],e[o+s+1]),o+=s;else{const t=u-a,e=Ze(i,h,t/u),d=Ze(n,c,t/u);l.push(e,d),r.push(l),l=[e,d],a=0,o+=s}}return a>0&&r.push(l),r}function _s(t,e,i,n,s){let r,o,a,l,h,c,u,d,g,f,p=i,_=i,m=0,y=0,x=i;for(o=i;o<n;o+=s){const i=e[o],n=e[o+1];void 0!==h&&(g=i-h,f=n-c,l=Math.sqrt(g*g+f*f),void 0!==u&&(y+=a,r=Math.acos((u*g+d*f)/(a*l)),r>t&&(y>m&&(m=y,p=x,_=o),y=0,x=o-s)),a=l,u=g,d=f),h=i,c=n}return y+=l,y>m?[x,o]:[p,_]}const ms={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};const ys=class extends as{constructor(t,e,i,n){super(t,e,i,n),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[Pn]={fillStyle:Pn},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){const n=this.textFillState_,s=this.textStrokeState_,r=this.textState_;if(""===this.text_||!r||!n&&!s)return;const o=this.coordinates;let a=o.length;const l=t.getType();let h=null,c=t.getStride();if("line"!==r.placement||"LineString"!=l&&"MultiLineString"!=l&&"Polygon"!=l&&"MultiPolygon"!=l){let n=r.overflow?null:[];switch(l){case"Point":case"MultiPoint":h=t.getFlatCoordinates();break;case"LineString":h=t.getFlatMidpoint();break;case"Circle":h=t.getCenter();break;case"MultiLineString":h=t.getFlatMidpoints(),c=2;break;case"Polygon":h=t.getFlatInteriorPoint(),r.overflow||n.push(h[2]/this.resolution),c=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();h=[];for(let t=0,i=e.length;t<i;t+=3)r.overflow||n.push(e[t+2]/this.resolution),h.push(e[t],e[t+1]);if(0===h.length)return;c=2}const s=this.appendFlatPointCoordinates(h,c);if(s===a)return;if(n&&(s-a)/2!==h.length/c){let t=a/2;n=n.filter((e,i)=>{const n=o[2*(t+i)]===h[i*c]&&o[2*(t+i)+1]===h[i*c+1];return n||--t,n})}this.saveTextStates_();const u=r.backgroundFill?this.createFill(this.fillStyleToState(r.backgroundFill)):null,d=r.backgroundStroke?this.createStroke(this.strokeStyleToState(r.backgroundStroke)):null;this.beginGeometry(t,e,i);let g=r.padding;if(g!=Yn&&(r.scale[0]<0||r.scale[1]<0)){let t=r.padding[0],e=r.padding[1],i=r.padding[2],n=r.padding[3];r.scale[0]<0&&(e=-e,n=-n),r.scale[1]<0&&(t=-t,i=-i),g=[t,e,i,n]}const f=this.pixelRatio;this.instructions.push([os.DRAW_IMAGE,a,s,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,g==Yn?Yn:g.map(function(t){return t*f}),u,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]);const p=1/f,_=u?u.slice(0):null;_&&(_[1]=Pn),this.hitDetectionInstructions.push([os.DRAW_IMAGE,a,s,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[p,p],NaN,this.declutterMode_,this.declutterImageWithText_,g,_,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Pn:this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]),this.endGeometry(e)}else{if(!oe(this.maxExtent,t.getExtent()))return;let n;if(h=t.getFlatCoordinates(),"LineString"==l)n=[h.length];else if("MultiLineString"==l)n=t.getEnds();else if("Polygon"==l)n=t.getEnds().slice(0,1);else if("MultiPolygon"==l){const e=t.getEndss();n=[];for(let t=0,i=e.length;t<i;++t)n.push(e[t][0])}this.beginGeometry(t,e,i);const s=r.repeat,u=s?void 0:r.textAlign;let d=0;for(let t=0,e=n.length;t<e;++t){let e;e=s?ps(s*this.resolution,h,d,n[t],c):[h.slice(d,n[t])];for(let i=0,s=e.length;i<s;++i){const s=e[i];let l=0,h=s.length;if(null==u){const t=_s(r.maxAngle,s,0,s.length,2);l=t[0],h=t[1]}for(let t=l;t<h;t+=c)o.push(s[t],s[t+1]);const g=o.length;d=n[t],this.drawChars_(a,g),a=g}}this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,n=this.strokeKey_;t&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const s=this.textKey_;s in this.textStates||(this.textStates[s]={font:e.font,textAlign:e.textAlign||Bn,justify:e.justify,textBaseline:e.textBaseline||Nn,scale:e.scale});const r=this.fillKey_;i&&(r in this.fillStates||(this.fillStates[r]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,s=this.strokeKey_,r=this.textKey_,o=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,l=ms[n.textBaseline],h=this.textOffsetY_*a,c=this.text_,u=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([os.DRAW_CHARS,t,e,l,n.overflow,o,n.maxAngle,a,h,s,u*a,c,r,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([os.DRAW_CHARS,t,e,l,n.overflow,o?Pn:o,n.maxAngle,a,h,s,u*a,c,r,1/a,this.declutterMode_,this.textKeepUpright_])}setTextStyle(t,e){let i,n,s;if(t){const e=t.getFill();e?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=Mn(e.getColor()||Pn)):(n=null,this.textFillState_=n);const r=t.getStroke();if(r){s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);const t=r.getLineDash(),e=r.getLineDashOffset(),i=r.getWidth(),n=r.getMiterLimit();s.lineCap=r.getLineCap()||Dn,s.lineDash=t?t.slice():Wn,s.lineDashOffset=void 0===e?0:e,s.lineJoin=r.getLineJoin()||Gn,s.lineWidth=void 0===i?1:i,s.miterLimit=void 0===n?10:n,s.strokeStyle=Mn(r.getColor()||zn)}else s=null,this.textStrokeState_=s;i=this.textState_;const o=t.getFont()||On;$n(o);const a=t.getScaleArray();i.overflow=t.getOverflow(),i.font=o,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||Nn,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||Yn,i.scale=void 0===a?[1,1]:a;const l=t.getOffsetX(),h=t.getOffsetY(),c=t.getRotateWithView(),u=t.getKeepUpright(),d=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=void 0===l?0:l,this.textOffsetY_=void 0===h?0:h,this.textRotateWithView_=void 0!==c&&c,this.textKeepUpright_=void 0===u||u,this.textRotation_=void 0===d?0:d,this.strokeKey_=s?("string"==typeof s.strokeStyle?s.strokeStyle:St(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=n&&n.fillStyle?"string"==typeof n.fillStyle?n.fillStyle:"|"+St(n.fillStyle):""}else this.text_="";this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}},xs={Circle:fs,Default:as,Image:ls,LineString:hs,Polygon:fs,Text:ys};const Ss=class{constructor(t,e,i,n){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=n,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const n in i){const s=i[n].finish();t[e][n]=s}}return t}getBuilder(t,e){const i=void 0!==t?t.toString():"0";let n=this.buildersByZIndex_[i];void 0===n&&(n={},this.buildersByZIndex_[i]=n);let s=n[e];if(void 0===s){s=new(0,xs[e])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=s}return s}};function vs(t,e,i,n,s,r,o){r=r||[],o=o||2;let a=0;for(let l=e;l<i;l+=n){const e=t[l],i=t[l+1];r[a++]=s[0]*e+s[2]*i+s[4],r[a++]=s[1]*e+s[3]*i+s[5];for(let e=2;e<o;e++)r[a++]=t[l+e]}return r&&r.length!=a&&(r.length=a),r}function ws(t,e,i,n,s,r,o){o=o||[];const a=Math.cos(s),l=Math.sin(s),h=r[0],c=r[1];let u=0;for(let s=e;s<i;s+=n){const e=t[s]-h,i=t[s+1]-c;o[u++]=h+e*a-i*l,o[u++]=c+e*l+i*a;for(let e=s+2;e<s+n;++e)o[u++]=t[e]}return o&&o.length!=u&&(o.length=u),o}new Array(6);function Cs(t,e){const i=e[0],n=e[1];return e[0]=t[0]*i+t[2]*n+t[4],e[1]=t[1]*i+t[3]*n+t[5],e}function Is(t,e,i,n,s,r,o,a){const l=Math.sin(r),h=Math.cos(r);return t[0]=n*h,t[1]=s*l,t[2]=-n*l,t[3]=s*h,t[4]=o*n*h-a*n*l+e,t[5]=o*s*l+a*s*h+i,t}function Ms(t,e){const i=(n=e)[0]*n[3]-n[1]*n[2];var n;Rt(0!==i,"Transformation matrix cannot be inverted");const s=e[0],r=e[1],o=e[2],a=e[3],l=e[4],h=e[5];return t[0]=a/i,t[1]=-r/i,t[2]=-o/i,t[3]=s/i,t[4]=(o*h-a*l)/i,t[5]=-(s*h-r*l)/i,t}const Rs=[1e5,1e5,1e5,1e5,2,2];function Es(t){return"matrix("+t.join(", ")+")"}function bs(t){return t.substring(7,t.length-1).split(",").map(parseFloat)}function Ts(t,e,i,n){let s=t[e],r=t[e+1],o=0;for(let a=e+n;a<i;a+=n){const e=t[a],i=t[a+1];o+=Math.sqrt((e-s)*(e-s)+(i-r)*(i-r)),s=e,r=i}return o}function Ls(t,e,i,n,s,r,o,a,l,h,c,u,d=!0){let g=t[e],f=t[e+1],p=0,_=0,m=0,y=0;function x(){p=g,_=f,g=t[e+=n],f=t[e+1],y+=m,m=Math.sqrt((g-p)*(g-p)+(f-_)*(f-_))}do{x()}while(e<i-n&&y+m<r);let S=0===m?0:(r-y)/m;const v=Ze(p,g,S),w=Ze(_,f,S),C=e-n,I=y,M=r+a*l(h,s,c);for(;e<i-n&&y+m<M;)x();S=0===m?0:(M-y)/m;const R=Ze(p,g,S),E=Ze(_,f,S);let b=!1;if(d)if(u){const t=[v,w,R,E];ws(t,0,4,2,u,t,t),b=t[0]>t[2]}else b=v>R;const T=Math.PI,L=[],A=C+n===e;let k;if(m=0,y=I,g=t[e=C],f=t[e+1],A){x(),k=Math.atan2(f-_,g-p),b&&(k+=k>0?-T:T);const t=(R+v)/2,e=(E+w)/2;return L[0]=[t,e,(M-r)/2,k,s],L}for(let t=0,u=(s=s.replace(/\n/g," ")).length;t<u;){x();let d=Math.atan2(f-_,g-p);if(b&&(d+=d>0?-T:T),void 0!==k){let t=d-k;if(t+=t>T?-2*T:t<-T?2*T:0,Math.abs(t)>o)return null}k=d;const v=t;let w=0;for(;t<u;++t){const o=a*l(h,s[b?u-t-1:t],c);if(e+n<i&&y+m<r+w+o/2)break;w+=o}if(t===v)continue;const C=b?s.substring(u-v,u-t):s.substring(v,t);S=0===m?0:(r+w/2-y)/m;const I=Ze(p,g,S),M=Ze(_,f,S);L.push([I,M,w/2,d,C]),r+=w}return L}const As=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(me(),{get:(t,e)=>{if("function"==typeof me()[e])return this.push_(e),this.pushMethodArgs_},set:(t,e,i)=>(this.push_(e,i),!0)})}push_(...t){const e=this.instructions_,i=this.zIndex+this.offset_;e[i]||(e[i]=[]),e[i].push(...t)}pushMethodArgs_=(...t)=>(this.push_(t),this);pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let i=0,n=e.length;i<n;++i){const n=e[i];if("function"==typeof n){n(t);continue}const s=e[++i];if("function"==typeof t[n])t[n](...s);else{if("function"==typeof s){t[n]=s(t);continue}t[n]=s}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},ks=[1/0,1/0,-1/0,-1/0],Fs=[],Os=[],Ps=[],Ds=[];function Ws(t){return t[3].declutterBox}const Gs=new RegExp("["+String.fromCharCode(1425)+"-"+String.fromCharCode(2303)+String.fromCharCode(64285)+"-"+String.fromCharCode(65023)+String.fromCharCode(65136)+"-"+String.fromCharCode(65276)+String.fromCharCode(67584)+"-"+String.fromCharCode(69631)+String.fromCharCode(124928)+"-"+String.fromCharCode(126975)+"]");function zs(t,e){return"start"===e?e=Gs.test(t)?"right":"left":"end"===e&&(e=Gs.test(t)?"left":"right"),ms[e]}function Bs(t,e,i){return i>0&&t.push("\n",""),t.push(e,""),t}function Ns(t,e,i){return i%2==0&&(t+=e),t}const Ys=class{constructor(t,e,i,n,s){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=s?new As:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,n){const s=t+e+i+n;if(this.labels_[s])return this.labels_[s];const r=n?this.strokeStates[n]:null,o=i?this.fillStates[i]:null,a=this.textStates[e],l=this.pixelRatio,h=[a.scale[0]*l,a.scale[1]*l],c=a.justify?ms[a.justify]:zs(Array.isArray(t)?t[0]:t,a.textAlign||Bn),u=n&&r.lineWidth?r.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(Bs,[]),{width:g,height:f,widths:p,heights:_,lineWidths:m}=function(t,e){const i=[],n=[],s=[];let r=0,o=0,a=0,l=0;for(let h=0,c=e.length;h<=c;h+=2){const u=e[h];if("\n"===u||h===c){r=Math.max(r,o),s.push(o),o=0,a+=l,l=0;continue}const d=e[h+1]||t.font,g=Jn(d,u);i.push(g),o+=g;const f=Hn(d);n.push(f),l=Math.max(l,f)}return{width:r,height:a,widths:i,heights:n,lineWidths:s}}(a,d),y=g+u,x=[],S=(y+2)*h[0],v=(f+u)*h[1],w={width:S<0?Math.floor(S):Math.ceil(S),height:v<0?Math.floor(v):Math.ceil(v),contextInstructions:x};1==h[0]&&1==h[1]||x.push("scale",h),n&&(x.push("strokeStyle",r.strokeStyle),x.push("lineWidth",u),x.push("lineCap",r.lineCap),x.push("lineJoin",r.lineJoin),x.push("miterLimit",r.miterLimit),x.push("setLineDash",[r.lineDash]),x.push("lineDashOffset",r.lineDashOffset)),i&&x.push("fillStyle",o.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const C=.5-c;let I=c*y+C*u;const M=[],R=[];let E,b=0,T=0,L=0,A=0;for(let t=0,e=d.length;t<e;t+=2){const e=d[t];if("\n"===e){T+=b,b=0,I=c*y+C*u,++A;continue}const s=d[t+1]||a.font;s!==E&&(n&&M.push("font",s),i&&R.push("font",s),E=s),b=Math.max(b,_[L]);const r=[e,I+C*p[L]+c*(p[L]-m[A]),.5*(u+b)+T];I+=p[L],n&&M.push("strokeText",r),i&&R.push("fillText",r),++L}return Array.prototype.push.apply(x,M),Array.prototype.push.apply(x,R),this.labels_[s]=w,w}replayTextBackground_(t,e,i,n,s,r,o){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,n),t.lineTo.apply(t,s),t.lineTo.apply(t,e),r&&(this.alignAndScaleFill_=r[2],t.fillStyle=r[1],this.fill_(t)),o&&(this.setStrokeStyle_(t,o),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,n,s,r,o,a,l,h,c,u,d,g,f,p){let _=i-(o*=u[0]),m=n-(a*=u[1]);const y=s+l>t?t-l:s,x=r+h>e?e-h:r,S=g[3]+y*u[0]+g[1],v=g[0]+x*u[1]+g[2],w=_-g[3],C=m-g[0];let I;return(f||0!==c)&&(Fs[0]=w,Ds[0]=w,Fs[1]=C,Os[1]=C,Os[0]=w+S,Ps[0]=Os[0],Ps[1]=C+v,Ds[1]=Ps[1]),0!==c?(I=Is([1,0,0,1,0,0],i,n,1,1,c,-i,-n),Cs(I,Fs),Cs(I,Os),Cs(I,Ps),Cs(I,Ds),Kt(Math.min(Fs[0],Os[0],Ps[0],Ds[0]),Math.min(Fs[1],Os[1],Ps[1],Ds[1]),Math.max(Fs[0],Os[0],Ps[0],Ds[0]),Math.max(Fs[1],Os[1],Ps[1],Ds[1]),ks)):Kt(Math.min(w,w+S),Math.min(C,C+v),Math.max(w,w+S),Math.max(C,C+v),ks),d&&(_=Math.round(_),m=Math.round(m)),{drawImageX:_,drawImageY:m,drawImageW:y,drawImageH:x,originX:l,originY:h,declutterBox:{minX:ks[0],minY:ks[1],maxX:ks[2],maxY:ks[3],value:p},canvasTransform:I,scale:u}}replayImageOrLabel_(t,e,i,n,s,r,o){const a=!(!r&&!o),l=n.declutterBox,h=o?o[2]*n.scale[0]/2:0;return l.minX-h<=e[0]&&l.maxX+h>=0&&l.minY-h<=e[1]&&l.maxY+h>=0&&(a&&this.replayTextBackground_(t,Fs,Os,Ps,Ds,r,o),ts(t,n.canvasTransform,s,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=Cs(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(i[0]%n,i[1]%n),1!==e&&t.scale(e,e),t.rotate(this.viewRotation_)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,n){const s=this.textStates[e],r=this.createLabel(t,e,n,i),o=this.strokeStates[i],a=this.pixelRatio,l=zs(Array.isArray(t)?t[0]:t,s.textAlign||Bn),h=ms[s.textBaseline||Nn],c=o&&o.lineWidth?o.lineWidth:0;return{label:r,anchorX:l*(r.width/a-2*s.scale[0])+2*(.5-l)*c,anchorY:h*r.height/a+2*(.5-h)*c}}execute_(t,e,i,n,s,r,o,a){const l=this.zIndexContext_;let h;var c,u;this.pixelCoordinates_&&ot(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=vs(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),c=this.renderedTransform_,u=i,c[0]=u[0],c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5]);let d=0;const g=n.length;let f,p,_,m,y,x,S,v,w,C,I,M,R,E=0,b=0,T=0;const L=this.coordinateCache_,A=this.viewRotation_,k=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,F={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:A},O=this.instructions!=n||this.overlaps?0:200;let P,D,W,G;for(;d<g;){const i=n[d];switch(i[0]){case os.BEGIN_GEOMETRY:P=i[1],G=i[3],P.getGeometry()?void 0===o||oe(o,G.getExtent())?++d:d=i[2]+1:d=i[2],l&&(l.zIndex=i[4]);break;case os.BEGIN_PATH:b>O&&(this.fill_(t),b=0),T>O&&(t.stroke(),T=0),b||T||(t.beginPath(),y=NaN,x=NaN),++d;break;case os.CIRCLE:E=i[1];const n=h[E],c=h[E+1],u=h[E+2]-n,g=h[E+3]-c,z=Math.sqrt(u*u+g*g);t.moveTo(n+z,c),t.arc(n,c,z,0,2*Math.PI,!0),++d;break;case os.CLOSE_PATH:t.closePath(),++d;break;case os.CUSTOM:E=i[1],f=i[2];const B=i[3],N=i[4],Y=i[5];F.geometry=B,F.feature=P,d in L||(L[d]=[]);const X=L[d];Y?Y(h,E,f,2,X):(X[0]=h[E],X[1]=h[E+1],X.length=2),l&&(l.zIndex=i[6]),N(X,F),++d;break;case os.DRAW_IMAGE:E=i[1],f=i[2],w=i[3],p=i[4],_=i[5];let V=i[6];const Z=i[7],j=i[8],K=i[9],q=i[10];let $=i[11];const H=i[12];let U=i[13];m=i[14]||"declutter";const J=i[15];if(!w&&i.length>=20){C=i[19],I=i[20],M=i[21],R=i[22];const t=this.drawLabelWithPointPlacement_(C,I,M,R);w=t.label,i[3]=w;const e=i[23];p=(t.anchorX-e)*this.pixelRatio,i[4]=p;const n=i[24];_=(t.anchorY-n)*this.pixelRatio,i[5]=_,V=w.height,i[6]=V,U=w.width,i[13]=U}let Q,tt,et,it;i.length>25&&(Q=i[25]),i.length>17?(tt=i[16],et=i[17],it=i[18]):(tt=Yn,et=null,it=null),q&&k?$+=A:q||k||($-=A);let nt=0;for(;E<f;E+=2){if(Q&&Q[nt++]<U/this.pixelRatio)continue;const i=this.calculateImageOrLabelDimensions_(w.width,w.height,h[E],h[E+1],U,V,p,_,j,K,$,H,s,tt,!!et||!!it,P),n=[t,e,w,i,Z,et,it];if(a){let t,e,s,r,o;if(J){const i=f-E;if(!J[i]){J[i]={args:n,declutterMode:m};continue}const r=J[i];t=r.args,e=r.declutterMode,delete J[i],s=Ws(t)}if(!t||"declutter"===e&&a.collides(s)||(r=!0),"declutter"===m&&a.collides(i.declutterBox)||(o=!0),"declutter"===e&&"declutter"===m){const t=r&&o;r=t,o=t}r&&("none"!==e&&a.insert(s),this.replayImageOrLabel_.apply(this,t)),o&&("none"!==m&&a.insert(i.declutterBox),this.replayImageOrLabel_.apply(this,n))}else this.replayImageOrLabel_.apply(this,n)}++d;break;case os.DRAW_CHARS:const st=i[1],rt=i[2],ot=i[3],at=i[4];R=i[5];const lt=i[6],ht=i[7],ct=i[8];M=i[9];const ut=i[10];C=i[11],Array.isArray(C)&&(C=C.reduce(Ns,"")),I=i[12];const dt=[i[13],i[13]];m=i[14]||"declutter";const gt=i[15],ft=this.textStates[I],pt=ft.font,_t=[ft.scale[0]*ht,ft.scale[1]*ht];let mt;pt in this.widths_?mt=this.widths_[pt]:(mt={},this.widths_[pt]=mt);const yt=Ts(h,st,rt,2),xt=Math.abs(_t[0])*Qn(pt,C,mt);if(at||xt<=yt){const i=Ls(h,st,rt,2,C,(yt-xt)*zs(C,this.textStates[I].textAlign),lt,Math.abs(_t[0]),Qn,pt,mt,k?0:this.viewRotation_,gt);t:if(i){const n=[];let s,r,o,l,h;if(M)for(s=0,r=i.length;s<r;++s){h=i[s],o=h[4],l=this.createLabel(o,I,"",M),p=h[2]+(_t[0]<0?-ut:ut),_=ot*l.height+2*(.5-ot)*ut*_t[1]/_t[0]-ct;const r=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,p,_,0,0,h[3],dt,!1,Yn,!1,P);if(a&&"declutter"===m&&a.collides(r.declutterBox))break t;n.push([t,e,l,r,1,null,null])}if(R)for(s=0,r=i.length;s<r;++s){h=i[s],o=h[4],l=this.createLabel(o,I,R,""),p=h[2],_=ot*l.height-ct;const r=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,p,_,0,0,h[3],dt,!1,Yn,!1,P);if(a&&"declutter"===m&&a.collides(r.declutterBox))break t;n.push([t,e,l,r,1,null,null])}a&&"none"!==m&&a.load(n.map(Ws));for(let t=0,e=n.length;t<e;++t)this.replayImageOrLabel_.apply(this,n[t])}}++d;break;case os.END_GEOMETRY:if(void 0!==r){P=i[1];const t=r(P,G,m);if(t)return t}++d;break;case os.FILL:O?b++:this.fill_(t),++d;break;case os.MOVE_TO_LINE_TO:for(E=i[1],f=i[2],D=h[E],W=h[E+1],t.moveTo(D,W),y=D+.5|0,x=W+.5|0,E+=2;E<f;E+=2)D=h[E],W=h[E+1],S=D+.5|0,v=W+.5|0,E!=f-2&&S===y&&v===x||(t.lineTo(D,W),y=S,x=v);++d;break;case os.SET_FILL_STYLE:this.alignAndScaleFill_=i[2],b&&(this.fill_(t),b=0,T&&(t.stroke(),T=0)),t.fillStyle=i[1],++d;break;case os.SET_STROKE_STYLE:T&&(t.stroke(),T=0),this.setStrokeStyle_(t,i),++d;break;case os.STROKE:O?T++:t.stroke(),++d;break;default:++d}}b&&this.fill_(t),T&&t.stroke()}execute(t,e,i,n,s,r){this.viewRotation_=n,this.execute_(t,e,i,this.instructions,s,void 0,void 0,r)}executeHitDetection(t,e,i,n,s){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,n,s)}},Xs=["Polygon","Circle","LineString","Image","Text","Default"],Vs=["Image","Text"],Zs=Xs.filter(t=>!Vs.includes(t));const js={};const Ks=class{constructor(t,e,i,n,s,r,o){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=r,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=[1,0,0,1,0,0],this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(s,o)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let n=this.executorsByZIndex_[i];void 0===n&&(n={},this.executorsByZIndex_[i]=n);const s=t[i];for(const t in s){const i=s[t];n[t]=new Ys(this.resolution_,this.pixelRatio_,this.overlaps_,i,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let e=0,n=t.length;e<n;++e)if(t[e]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,n,s,r){const o=2*(n=Math.round(n))+1,a=Is(this.hitDetectionTransform_,n+.5,n+.5,1/e,-1/e,-i,-t[0],-t[1]),l=!this.hitDetectionContext_;l&&(this.hitDetectionContext_=pe(o,o));const h=this.hitDetectionContext_;let c;h.canvas.width!==o||h.canvas.height!==o?(h.canvas.width=o,h.canvas.height=o):l||h.clearRect(0,0,o,o),void 0!==this.renderBuffer_&&(c=[1/0,1/0,-1/0,-1/0],$t(c,t),Nt(c,e*(this.renderBuffer_+n),c));const u=function(t){if(void 0!==js[t])return js[t];const e=2*t+1,i=t*t,n=new Array(i+1);for(let s=0;s<=t;++s)for(let r=0;r<=t;++r){const o=s*s+r*r;if(o>i)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+s)*e+(t+r))+3),s>0&&a.push(4*((t-s)*e+(t+r))+3),r>0&&(a.push(4*((t+s)*e+(t-r))+3),s>0&&a.push(4*((t-s)*e+(t-r))+3))}const s=[];for(let t=0,e=n.length;t<e;++t)n[t]&&s.push(...n[t]);return js[t]=s,s}(n);let d;function g(t,e,i){const a=h.getImageData(0,0,o,o).data;for(let l=0,c=u.length;l<c;l++)if(a[u[l]]>0){if(!r||"none"===i||"Image"!==d&&"Text"!==d||r.includes(t)){const i=(u[l]-3)/4,r=n-i%o,a=n-(i/o|0),h=s(t,e,r*r+a*a);if(h)return h}h.clearRect(0,0,o,o);break}}const f=Object.keys(this.executorsByZIndex_).map(Number);let p,_,m,y,x;for(f.sort(et),p=f.length-1;p>=0;--p){const t=f[p].toString();for(m=this.executorsByZIndex_[t],_=Xs.length-1;_>=0;--_)if(d=Xs[_],y=m[d],void 0!==y&&(x=y.executeHitDetection(h,a,i,g,c),x))return x}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],s=e[2],r=e[3],o=[i,n,i,r,s,r,s,n];return vs(o,0,8,2,t,o),o}isEmpty(){return ct(this.executorsByZIndex_)}execute(t,e,i,n,s,r,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?it:et),r=r||Xs;const l=Xs.length;for(let h=0,c=a.length;h<c;++h){const c=a[h].toString(),u=this.executorsByZIndex_[c];for(let c=0,d=r.length;c<d;++c){const d=r[c],g=u[d];if(void 0!==g){const r=null===o?void 0:g.getZIndexContext(),c=r?r.getContext():t,u=this.maxExtent_&&"Image"!==d&&"Text"!==d;if(u&&(c.save(),this.clip(c,i)),r&&"Text"!==d&&"Image"!==d?r.pushFunction(t=>g.execute(t,e,i,n,s,o)):g.execute(c,e,i,n,s,o),u&&c.restore(),r){r.offset();const t=a[h]*l+Xs.indexOf(d);this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(r)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(et);for(let i=0,n=e.length;i<n;++i)t[e[i]].forEach(t=>{t.draw(this.renderedContext_),t.clear()}),t[e[i]].length=0}};function qs(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}class $s{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=qs(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new $s({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 yt()}getImage(t){return yt()}getHitDetectionImage(){return yt()}getPixelRatio(t){return 1}getImageState(){return yt()}getImageSize(){return yt()}getOrigin(){return yt()}getSize(){return yt()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=qs(t)}listenImageChange(t){yt()}load(){yt()}unlistenImageChange(t){yt()}ready(){return Promise.resolve()}}const Hs=$s;function Us(t,e,i,n){return void 0!==i&&void 0!==n?[i/t,n/e]:void 0!==i?i/t:void 0!==n?n/e:1}class Js extends Hs{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,n=void 0!==t.scale?t.scale:1,s=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:n,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:s,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null;const r=void 0!==t.img?t.img:null;let o,a=t.src;if(Rt(!(void 0!==a&&r),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!r||(a=r.src||St(r)),Rt(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),Rt(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?o=ji:void 0!==r&&(o="complete"in r?r.complete?r.src?qi:ji:Ki:qi),this.color_=void 0!==t.color?pn(t.color):null,this.iconImage_=Cn(r,a,this.crossOrigin_,o,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,this.initialOptions_,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const n=this.getImage(1);if(n.width&&n.height)e=n.width,i=n.height;else if(n instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(Us(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(Us(e,i,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new Js({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:e,height:i,size:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const e=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!e)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=e[0]),"fraction"==this.anchorYUnits_&&(t[1]*=e[1])}if("top-left"!=this.anchorOrigin_){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+e[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+e[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:this.iconImage_.getImageState()==qi?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:this.iconImage_.getImageState()==qi?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(Q,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(Q,t)}ready(){return this.iconImage_.ready()}}const Qs=Js,tr=[1,0,0,1,0,0],er=[NaN,NaN];const ir=class extends wt{constructor(){super(),this.extent_=[1/0,1/0,-1/0,-1/0],this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=function(t){let e,i,n;return function(){const s=Array.prototype.slice.call(arguments);return i&&this===n&&ot(s,i)||(n=this,i=s,e=t.apply(this,arguments)),e}}((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return yt()}closestPointXY(t,e,i,n){return yt()}containsXY(t,e){return 0===this.closestPointXY(t,e,er,Number.MIN_VALUE)}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return yt()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&qt(t),this.extentRevision_=this.getRevision()}return function(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}(this.extent_,t)}rotate(t,e){yt()}scale(t,e,i){yt()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return yt()}getType(){return yt()}applyTransform(t){yt()}intersectsExtent(t){return yt()}translate(t,e){yt()}transform(t,e){const i=Mi(t),n="tile-pixels"==i.getUnits()?function(t,n,s){const r=i.getExtent(),o=i.getWorldExtent(),a=ie(o)/ie(r);Is(tr,o[0],o[3],a,-a,0,0,0);const l=vs(t,0,t.length,s,tr,n),h=Li(i,e);return h?h(l,l,s):l}:Li(i,e);return this.applyTransform(n),this}};function nr(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}const sr=class extends ir{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return e=this.flatCoordinates,i=0,n=this.flatCoordinates.length,s=this.stride,Ht(qt(t),e,i,n,s);var e,i,n,s}getCoordinates(){return yt()}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(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=nr(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){yt()}setLayout(t,e,i){let n;if(t)n=nr(t);else{for(let t=0;t<i;++t){if(0===e.length)return this.layout="XY",void(this.stride=2);e=e[0]}n=e.length,t=function(t){let e;2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM");return e}(n)}this.layout=t,this.stride=n}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();ws(i,0,i.length,n,t,e,i),this.changed()}}scale(t,e,i){void 0===e&&(e=t),i||(i=te(this.getExtent()));const n=this.getFlatCoordinates();if(n){const s=this.getStride();!function(t,e,i,n,s,r,o,a){a=a||[];const l=o[0],h=o[1];let c=0;for(let o=e;o<i;o+=n){const e=t[o]-l,i=t[o+1]-h;a[c++]=l+s*e,a[c++]=h+r*i;for(let e=o+2;e<o+n;++e)a[c++]=t[e]}a&&a.length!=c&&(a.length=c)}(n,0,n.length,s,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();!function(t,e,i,n,s,r,o){o=o||[];let a=0;for(let l=e;l<i;l+=n){o[a++]=t[l]+s,o[a++]=t[l+1]+r;for(let e=l+2;e<l+n;++e)o[a++]=t[e]}o&&o.length!=a&&(o.length=a)}(i,0,i.length,n,t,e,i),this.changed()}}};const rr=class extends Tn{constructor(t,e,i,n,s,r,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?je(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=r,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_=[1,0,0,1,0,0]}drawImages_(t,e,i,n){if(!this.image_)return;const s=vs(t,e,i,n,this.transform_,this.pixelCoordinates_),r=this.context_,o=this.tmpLocalTransform_,a=r.globalAlpha;1!=this.imageOpacity_&&(r.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let t=0,e=s.length;t<e;t+=2){const e=s[t]-this.imageAnchorX_,i=s[t+1]-this.imageAnchorY_;if(0!==l||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const t=e+this.imageAnchorX_,n=i+this.imageAnchorY_;Is(o,t,n,1,1,l,-t,-n),r.save(),r.transform.apply(r,o),r.translate(t,n),r.scale(this.imageScale_[0],this.imageScale_[1]),r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),r.restore()}else r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,e,i,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(r.globalAlpha=a)}drawText_(t,e,i,n){if(!this.textState_||""===this.text_)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const s=vs(t,e,i,n,this.transform_,this.pixelCoordinates_),r=this.context_;let o=this.textRotation_;for(0===this.transformRotation_&&(o-=this.viewRotation_),this.textRotateWithView_&&(o+=this.viewRotation_);e<i;e+=n){const t=s[e]+this.textOffsetX_,i=s[e+1]+this.textOffsetY_;0!==o||1!=this.textScale_[0]||1!=this.textScale_[1]?(r.save(),r.translate(t-this.textOffsetX_,i-this.textOffsetY_),r.rotate(o),r.translate(this.textOffsetX_,this.textOffsetY_),r.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&r.strokeText(this.text_,0,0),this.textFillState_&&r.fillText(this.text_,0,0),r.restore()):(this.textStrokeState_&&r.strokeText(this.text_,t,i),this.textFillState_&&r.fillText(this.text_,t,i))}}moveToLineTo_(t,e,i,n,s){const r=this.context_,o=vs(t,e,i,n,this.transform_,this.pixelCoordinates_);r.moveTo(o[0],o[1]);let a=o.length;s&&(a-=2);for(let t=2;t<a;t+=2)r.lineTo(o[t],o[t+1]);return s&&r.closePath(),i}drawRings_(t,e,i,n){for(let s=0,r=i.length;s<r;++s)e=this.moveToLineTo_(t,e,i[s],n,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),oe(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=function(t,e,i){const n=t.getFlatCoordinates();if(!n)return null;const s=t.getStride();return vs(n,0,n.length,s,e,i)}(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],n=e[3]-e[1],s=Math.sqrt(i*i+n*n),r=this.context_;r.beginPath(),r.arc(e[0],e[1],s,0,2*Math.PI),this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}""!==this.text_&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t)}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let t=0,i=e.length;t<i;++t)this.drawGeometry(e[t])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),oe(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1),e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(oe(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();let n=0;const s=t.getEnds(),r=t.getStride();e.beginPath();for(let t=0,e=s.length;t<e;++t)n=this.moveToLineTo_(i,n,s[t],r,!1);e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoints();this.drawText_(e,0,e.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),oe(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),oe(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let n=0;const s=t.getEndss(),r=t.getStride();e.beginPath();for(let t=0,e=s.length;t<e;++t){const e=s[t];n=this.drawRings_(i,n,e,r)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),ot(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,i=this.contextTextState_,n=t.textAlign?t.textAlign:Bn;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=n&&(i.textAlign=n,e.textAlign=n),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=n,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:n,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(t){const e=t.getColor();this.fillState_={fillStyle:Mn(e||Pn)}}else this.fillState_=null;if(e){const t=e.getColor(),i=e.getLineCap(),n=e.getLineDash(),s=e.getLineDashOffset(),r=e.getLineJoin(),o=e.getWidth(),a=e.getMiterLimit(),l=n||Wn;this.strokeState_={lineCap:void 0!==i?i:Dn,lineDash:1===this.pixelRatio_?l:l.map(t=>t*this.pixelRatio_),lineDashOffset:(s||0)*this.pixelRatio_,lineJoin:void 0!==r?r:Gn,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:Mn(t||zn)}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),s=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const r=t.getScaleArray();this.imageScale_=[r[0]*this.pixelRatio_/i,r[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:Mn(t||Pn)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),s=i.getLineDashOffset(),r=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:Dn,lineDash:n||Wn,lineDashOffset:s||0,lineJoin:void 0!==r?r:Gn,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:Mn(t||zn)}}else this.textStrokeState_=null;const n=t.getFont(),s=t.getOffsetX(),r=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),l=t.getScaleArray(),h=t.getText(),c=t.getTextAlign(),u=t.getTextBaseline();this.textState_={font:void 0!==n?n:On,textAlign:void 0!==c?c:Bn,textBaseline:void 0!==u?u:Nn},this.text_=void 0!==h?Array.isArray(h)?h.reduce((t,e,i)=>t+(i%2?" ":e),""):h:"",this.textOffsetX_=void 0!==s?this.pixelRatio_*s:0,this.textOffsetY_=void 0!==r?this.pixelRatio_*r:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*l[0],this.pixelRatio_*l[1]]}else this.text_=""}},or=.5;const ar={Point:function(t,e,i,n,s,r){const o=i.getImage(),a=i.getText(),l=a&&a.getText(),h=r&&o&&l?{}:void 0;if(o){if(o.getImageState()!=qi)return;const r=t.getBuilder(i.getZIndex(),"Image");r.setImageStyle(o,h),r.drawPoint(e,n,s)}if(l){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a,h),r.drawText(e,n,s)}},LineString:function(t,e,i,n,s){const r=i.getStroke();if(r){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,r),o.drawLineString(e,n,s)}const o=i.getText();if(o&&o.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,n,s)}},Polygon:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(r||o){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(r,o),a.drawPolygon(e,n,s)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,n,s)}},MultiPoint:function(t,e,i,n,s,r){const o=i.getImage(),a=o&&0!==o.getOpacity(),l=i.getText(),h=l&&l.getText(),c=r&&a&&h?{}:void 0;if(a){if(o.getImageState()!=qi)return;const r=t.getBuilder(i.getZIndex(),"Image");r.setImageStyle(o,c),r.drawMultiPoint(e,n,s)}if(h){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(l,c),r.drawText(e,n,s)}},MultiLineString:function(t,e,i,n,s){const r=i.getStroke();if(r){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,r),o.drawMultiLineString(e,n,s)}const o=i.getText();if(o&&o.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,n,s)}},MultiPolygon:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(o||r){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(r,o),a.drawMultiPolygon(e,n,s)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,n,s)}},GeometryCollection:function(t,e,i,n,s,r){const o=e.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a){(0,ar[o[a].getType()])(t,o[a],i,n,s,r)}},Circle:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(r||o){const a=t.getBuilder(i.getZIndex(),"Circle");a.setFillStrokeStyle(r,o),a.drawCircle(e,n,s)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n)}}};function lr(t,e){return parseInt(St(t),10)-parseInt(St(e),10)}function hr(t,e){const i=cr(t,e);return i*i}function cr(t,e){return.5*t/e}function ur(t,e,i,n,s,r,o,a){const l=[],h=i.getImage();if(h){let t=!0;const e=h.getImageState();e==qi||e==$i?t=!1:e==ji&&h.load(),t&&l.push(h.ready())}const c=i.getFill();c&&c.loading()&&l.push(c.ready());const u=l.length>0;return u&&Promise.all(l).then(()=>s(null)),function(t,e,i,n,s,r,o){const a=i.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(n,s),h=i.getRenderer();if(h)dr(t,l,i,e,o);else{(0,ar[l.getType()])(t,l,i,e,o,r)}}(t,e,i,n,r,o,a),u}function dr(t,e,i,n,s){if("GeometryCollection"==e.getType()){const r=e.getGeometries();for(let e=0,o=r.length;e<o;++e)dr(t,r[e],i,n,s);return}t.getBuilder(i.getZIndex(),"Default").drawCustom(e,n,i.getRenderer(),i.getHitDetectionRenderer(),s)}const gr=class extends ut{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}};const fr=class extends mt{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=5}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return yt()}getData(t){return null}prepareFrame(t){return yt()}renderFrame(t,e){return yt()}forEachFeatureAtCoordinate(t,e,i,n,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;e.getState()!==qi&&e.getState()!==$i||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=qi&&e!=$i&&t.addEventListener(Q,this.boundHandleImageChange_),e==ji&&(t.load(),e=t.getState()),e==qi}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}},pr=[];let _r=null;const mr=class extends fr{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=[1,0,0,1,0,0],this.pixelTransform=[1,0,0,1,0,0],this.inversePixelTransform=[1,0,0,1,0,0],this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){let n;_r||(_r=pe(1,1,void 0,{willReadFrequently:!0})),_r.clearRect(0,0,1,1);try{_r.drawImage(t,e,i,1,1,0,0,1,1),n=_r.getImageData(0,0,1,1).data}catch{return _r=null,null}return n}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let s,r;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&ot(pn(t.style.backgroundColor),pn(i)))){const e=t.firstElementChild;e instanceof HTMLCanvasElement&&(r=e.getContext("2d"))}if(r&&function(t,e){const i=bs(t),n=bs(e);for(let t=0;t<6;++t)if(0!==Math.round((i[t]-n[t])*Rs[t]))return!1;return!0}(r.canvas.style.transform,e)?(this.container=t,this.context=r,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){s=document.createElement("div"),s.className=n;let t=s.style;t.position="absolute",t.width="100%",t.height="100%",r=pe();const e=r.canvas;s.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=s,this.context=r}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=ne(i),s=se(i),r=Qt(i),o=Jt(i);Cs(e.coordinateToPixelTransform,n),Cs(e.coordinateToPixelTransform,s),Cs(e.coordinateToPixelTransform,r),Cs(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;Cs(a,n),Cs(a,s),Cs(a,r),Cs(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const i=t.extent,n=t.viewState.resolution,s=t.viewState.rotation,r=t.pixelRatio,o=Math.round(re(i)/n*r),a=Math.round(ie(i)/n*r);Is(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/r,1/r,s,-o/2,-a/2),Ms(this.inversePixelTransform,this.pixelTransform);const l=Es(this.pixelTransform);if(this.useContainer(e,l,this.getBackground(t)),!this.containerReused){const t=this.context.canvas;t.width!=o||t.height!=a?(t.width=o,t.height=a):this.context.clearRect(0,0,o,a),l!==t.style.transform&&(t.style.transform=l)}}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const s=new gr(t,this.inversePixelTransform,i,e);n.dispatchEvent(s)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(Xi,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(Vi,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new As),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(Xi,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(Vi,this.context,t))}getRenderTransform(t,e,i,n,s,r,o){const a=s/2,l=r/2,h=n/e,c=-h,u=-t[0]+o,d=-t[1];return Is(this.tempTransform,a,l,h,c,-i,u,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}};const yr=class extends mr{constructor(t){super(t),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_=[1/0,1/0,-1/0,-1/0],this.wrappedRenderedExtent_=[1/0,1/0,-1/0,-1/0],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(t,e,i){const n=e.extent,s=e.viewState,r=s.center,o=s.resolution,a=s.projection,l=s.rotation,h=a.getExtent(),c=this.getLayer().getSource(),u=this.getLayer().getDeclutter(),d=e.pixelRatio,g=e.viewHints,f=!(g[Ft]||g[Ot]),p=this.context,_=Math.round(re(n)/o*d),m=Math.round(ie(n)/o*d),y=c.getWrapX()&&a.canWrapX(),x=y?re(h):null,S=y?Math.ceil((n[2]-h[2])/x)+1:1;let v=y?Math.floor((n[0]-h[0])/x):0;do{let n=this.getRenderTransform(r,o,0,d,_,m,v*x);e.declutter&&(n=n.slice(0)),t.execute(p,[p.canvas.width,p.canvas.height],n,l,f,void 0===i?Xs:i?Vs:Zs,i?u&&e.declutter[u]:void 0)}while(++v<S)}setDrawContext_(){1!==this.opacity_&&(this.targetContext_=this.context,this.context=pe(this.context.canvas.width,this.context.canvas.height,pr))}resetDrawContext_(){if(1!==this.opacity_&&this.targetContext_){const t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,function(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}(this.context),pr.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){this.replayGroup_&&this.getLayer().getDeclutter()&&this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.replayGroup_.renderDeferred(),this.clipped_&&this.context.restore(),this.resetDrawContext_())}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;const n=t.viewState;this.prepareContainer(t,e);const s=this.context,r=this.replayGroup_;let o=r&&!r.isEmpty();if(!o){if(!(this.getLayer().hasListener(Xi)||this.getLayer().hasListener(Vi)))return this.container}this.setDrawContext_(),this.preRender(s,t);const a=n.projection;if(this.clipped_=!1,o&&i.extent&&this.clipping){const e=Gi(i.extent,a);o=oe(e,t.extent),this.clipped_=o&&!Vt(e,t.extent),this.clipped_&&this.clipUnrotated(s,t,e)}return o&&this.renderWorlds(r,t,!this.getLayer().getDeclutter()&&void 0),!t.declutter&&this.clipped_&&s.restore(),this.postRender(s,t),this.renderedRotation_!==n.rotation&&(this.renderedRotation_=n.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=this.frameState.size.slice(),e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,s=this.renderedProjection_,r=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],l=t[0]*or,h=t[1]*or;a.push(this.getRenderTransform(e,i,n,or,l,h,0).slice());const c=o.getSource(),u=s.getExtent();if(c.getWrapX()&&s.canWrapX()&&!Vt(u,r)){let t=r[0];const s=re(u);let o,c=0;for(;t<u[0];)--c,o=s*c,a.push(this.getRenderTransform(e,i,n,or,l,h,o).slice()),t+=s;for(c=0,t=r[2];t>u[2];)++c,o=s*c,a.push(this.getRenderTransform(e,i,n,or,l,h,o).slice()),t-=s}const d=Oi();this.hitDetectionImageData_=function(t,e,i,n,s,r,o,a,l){const h=l?Wi(s,l):s,c=pe(t[0]*or,t[1]*or);c.imageSmoothingEnabled=!1;const u=c.canvas,d=new rr(c,or,s,null,o,a,l?bi(Oi(),l):null),g=i.length,f=Math.floor(16777215/g),p={};for(let t=1;t<=g;++t){const e=i[t-1],s=e.getStyleFunction()||n;if(!s)continue;let o=s(e,r);if(!o)continue;Array.isArray(o)||(o=[o]);const a=(t*f).toString(16).padStart(7,"#00000");for(let t=0,i=o.length;t<i;++t){const i=o[t],n=i.getGeometryFunction()(e);if(!n||!oe(h,n.getExtent()))continue;const s=i.clone(),r=s.getFill();r&&r.setColor(a);const l=s.getStroke();l&&(l.setColor(a),l.setLineDash(null)),s.setText(void 0);const c=i.getImage();if(c){const t=c.getImageSize();if(!t)continue;const e=pe(t[0],t[1],void 0,{alpha:!1}),i=e.canvas;e.fillStyle=a,e.fillRect(0,0,i.width,i.height),s.setImage(new Qs({img:i,anchor:c.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:c.getOrigin(),opacity:1,size:c.getSize(),scale:c.getScale(),rotation:c.getRotation(),rotateWithView:c.getRotateWithView()}))}const u=s.getZIndex()||0;let d=p[u];d||(d={},p[u]=d,d.Polygon=[],d.Circle=[],d.LineString=[],d.Point=[]);const g=n.getType();if("GeometryCollection"===g){const t=n.getGeometriesArrayRecursive();for(let e=0,i=t.length;e<i;++e){const i=t[e];d[i.getType().replace("Multi","")].push(i,s)}}else d[g.replace("Multi","")].push(n,s)}}const _=Object.keys(p).map(Number).sort(et);for(let t=0,i=_.length;t<i;++t){const i=p[_[t]];for(const t in i){const n=i[t];for(let t=0,i=n.length;t<i;t+=2){d.setStyle(n[t+1]);for(let i=0,s=e.length;i<s;++i)d.setTransform(e[i]),d.drawGeometry(n[t])}}}return c.getImageData(0,0,u.width,u.height)}(t,a,this.renderedFeatures_,o.getStyleFunction(),r,i,n,hr(i,this.renderedPixelRatio_),d?s:null)}e(function(t,e,i){const n=[];if(i){const s=Math.floor(Math.round(t[0])*or),r=Math.floor(Math.round(t[1])*or),o=4*(ze(s,0,i.width-1)+ze(r,0,i.height-1)*i.width),a=i.data[o],l=i.data[o+1],h=i.data[o+2]+256*(l+256*a),c=Math.floor(16777215/e.length);h&&h%c===0&&n.push(e[h/c-1])}return n}(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,n,s){if(!this.replayGroup_)return;const r=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),l={},h=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,r,o,i,function(t,e,i){const r=St(t),o=l[r];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return l[r]=!0,s.splice(s.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return l[r]=!0,n(t,a,e);s.push(l[r]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}},h?e.declutter?.[h]?.all().map(t=>t.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[Ft],s=t.viewHints[Ot],r=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!r&&n||!o&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,l=t.viewState,h=l.projection,c=l.resolution,u=t.pixelRatio,d=e.getRevision(),g=e.getRenderBuffer();let f=e.getRenderOrder();void 0===f&&(f=lr);const p=l.center.slice(),_=Nt(a,g*c),m=_.slice(),y=[_.slice()],x=h.getExtent();if(i.getWrapX()&&h.canWrapX()&&!Vt(x,t.extent)){const t=re(x),e=Math.max(re(_)/2,t);_[0]=x[0]-e,_[2]=x[2]+e,ue(p,h);const i=he(y[0],h);i[0]<x[0]&&i[2]<x[2]?y.push([i[0]+t,i[1],i[2]+t,i[3]]):i[0]>x[0]&&i[2]>x[2]&&y.push([i[0]-t,i[1],i[2]-t,i[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedRevision_==d&&this.renderedRenderOrder_==f&&this.renderedFrameDeclutter_===!!t.declutter&&Vt(this.wrappedRenderedExtent_,_))return ot(this.renderedExtent_,m)||(this.hitDetectionImageData_=null,this.renderedExtent_=m),this.renderedCenter_=p,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const S=new Ss(cr(c,u),_,c,u),v=Oi();let w;if(v){for(let t=0,e=y.length;t<e;++t){const e=Wi(y[t],h);i.loadFeatures(e,zi(c,h),v)}w=bi(v,h)}else for(let t=0,e=y.length;t<e;++t)i.loadFeatures(y[t],c,h);const C=hr(c,u);let I=!0;const M=(t,i)=>{let n;const s=t.getStyleFunction()||e.getStyleFunction();if(s&&(n=s(t,c)),n){const e=this.renderFeature(t,C,n,S,w,this.getLayer().getDeclutter(),i);I=I&&!e}},R=Wi(_,h),E=i.getFeaturesInExtent(R);f&&E.sort(f);for(let t=0,e=E.length;t<e;++t)M(E[t],t);this.renderedFeatures_=E,this.ready=I;const b=S.finish(),T=new Ks(_,c,u,i.getOverlaps(),b,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=c,this.renderedRevision_=d,this.renderedRenderOrder_=f,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=m,this.wrappedRenderedExtent_=_,this.renderedCenter_=p,this.renderedProjection_=h,this.renderedPixelRatio_=u,this.replayGroup_=T,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,n,s,r,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,h=i.length;l<h;++l)a=ur(n,t,i[l],e,this.boundHandleStyleImageChange_,s,r,o)||a;else a=ur(n,t,i,e,this.boundHandleStyleImageChange_,s,r,o);return a}};function xr(t,e,i=0,n=t.length-1,s=vr){for(;n>i;){if(n-i>600){const r=n-i+1,o=e-i+1,a=Math.log(r),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(r-l)/r)*(o-r/2<0?-1:1);xr(t,e,Math.max(i,Math.floor(e-o*l/r+h)),Math.min(n,Math.floor(e+(r-o)*l/r+h)),s)}const r=t[e];let o=i,a=n;for(Sr(t,i,e),s(t[n],r)>0&&Sr(t,i,n);o<a;){for(Sr(t,o,a),o++,a--;s(t[o],r)<0;)o++;for(;s(t[a],r)>0;)a--}0===s(t[i],r)?Sr(t,i,a):(a++,Sr(t,a,n)),a<=e&&(i=a+1),e<=a&&(n=a-1)}}function Sr(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function vr(t,e){return t<e?-1:t>e?1:0}class wr{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!Or(t,e))return i;const n=this.toBBox,s=[];for(;e;){for(let r=0;r<e.children.length;r++){const o=e.children[r],a=e.leaf?n(o):o;Or(t,a)&&(e.leaf?i.push(o):Fr(t,a)?this._all(o,i):s.push(o))}e=s.pop()}return i}collides(t){let e=this.data;if(!Or(t,e))return!1;const i=[];for(;e;){for(let n=0;n<e.children.length;n++){const s=e.children[n],r=e.leaf?this.toBBox(s):s;if(Or(t,r)){if(e.leaf||Fr(t,r))return!0;i.push(s)}}e=i.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(let e=0;e<t.length;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Pr([]),this}remove(t,e){if(!t)return this;let i=this.data;const n=this.toBBox(t),s=[],r=[];let o,a,l;for(;i||s.length;){if(i||(i=s.pop(),a=s[s.length-1],o=r.pop(),l=!0),i.leaf){const n=Cr(t,i.children,e);if(-1!==n)return i.children.splice(n,1),s.push(i),this._condense(s),this}l||i.leaf||!Fr(i,n)?a?(o++,i=a.children[o],l=!1):i=null:(s.push(i),r.push(o),o=0,a=i,i=i.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,n){const s=i-e+1;let r,o=this._maxEntries;if(s<=o)return r=Pr(t.slice(e,i+1)),Ir(r,this.toBBox),r;n||(n=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,n-1))),r=Pr([]),r.leaf=!1,r.height=n;const a=Math.ceil(s/o),l=a*Math.ceil(Math.sqrt(o));Dr(t,e,i,l,this.compareMinX);for(let s=e;s<=i;s+=l){const e=Math.min(s+l-1,i);Dr(t,s,e,a,this.compareMinY);for(let i=s;i<=e;i+=a){const s=Math.min(i+a-1,e);r.children.push(this._build(t,i,s,n-1))}}return Ir(r,this.toBBox),r}_chooseSubtree(t,e,i,n){for(;n.push(e),!e.leaf&&n.length-1!==i;){let i,n=1/0,s=1/0;for(let r=0;r<e.children.length;r++){const o=e.children[r],a=Tr(o),l=Ar(t,o)-a;l<s?(s=l,n=a<n?a:n,i=o):l===s&&a<n&&(n=a,i=o)}e=i||e.children[0]}return e}_insert(t,e,i){const n=i?t:this.toBBox(t),s=[],r=this._chooseSubtree(n,this.data,e,s);for(r.children.push(t),Rr(r,n);e>=0&&s[e].children.length>this._maxEntries;)this._split(s,e),e--;this._adjustParentBBoxes(n,s,e)}_split(t,e){const i=t[e],n=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,n);const r=this._chooseSplitIndex(i,s,n),o=Pr(i.children.splice(r,i.children.length-r));o.height=i.height,o.leaf=i.leaf,Ir(i,this.toBBox),Ir(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=Pr([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Ir(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,s=1/0,r=1/0;for(let o=e;o<=i-e;o++){const e=Mr(t,0,o,this.toBBox),a=Mr(t,o,i,this.toBBox),l=kr(e,a),h=Tr(e)+Tr(a);l<s?(s=l,n=o,r=h<r?h:r):l===s&&h<r&&(r=h,n=o)}return n||i-e}_chooseSplitAxis(t,e,i){const n=t.leaf?this.compareMinX:Er,s=t.leaf?this.compareMinY:br;this._allDistMargin(t,e,i,n)<this._allDistMargin(t,e,i,s)&&t.children.sort(n)}_allDistMargin(t,e,i,n){t.children.sort(n);const s=this.toBBox,r=Mr(t,0,e,s),o=Mr(t,i-e,i,s);let a=Lr(r)+Lr(o);for(let n=e;n<i-e;n++){const e=t.children[n];Rr(r,t.leaf?s(e):e),a+=Lr(r)}for(let n=i-e-1;n>=e;n--){const e=t.children[n];Rr(o,t.leaf?s(e):e),a+=Lr(o)}return a}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)Rr(e[n],t)}_condense(t){for(let e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children,e.splice(e.indexOf(t[i]),1)):this.clear():Ir(t[i],this.toBBox)}}function Cr(t,e,i){if(!i)return e.indexOf(t);for(let n=0;n<e.length;n++)if(i(t,e[n]))return n;return-1}function Ir(t,e){Mr(t,0,t.children.length,e,t)}function Mr(t,e,i,n,s){s||(s=Pr(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let r=e;r<i;r++){const e=t.children[r];Rr(s,t.leaf?n(e):e)}return s}function Rr(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function Er(t,e){return t.minX-e.minX}function br(t,e){return t.minY-e.minY}function Tr(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Lr(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Ar(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function kr(t,e){const i=Math.max(t.minX,e.minX),n=Math.max(t.minY,e.minY),s=Math.min(t.maxX,e.maxX),r=Math.min(t.maxY,e.maxY);return Math.max(0,s-i)*Math.max(0,r-n)}function Fr(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function Or(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function Pr(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Dr(t,e,i,n,s){const r=[e,i];for(;r.length;){if((i=r.pop())-(e=r.pop())<=n)continue;const o=e+Math.ceil((i-e)/n/2)*n;xr(t,o,e,i,s),r.push(e,o,o,i)}}let Wr=0;const Gr=1<<Wr++,zr=1<<Wr++,Br=1<<Wr++,Nr=1<<Wr++,Yr=1<<Wr++,Xr=1<<Wr++,Vr=Math.pow(2,6)-1,Zr={[Gr]:"boolean",[zr]:"number",[Br]:"string",[Nr]:"color",[Yr]:"number[]",[Xr]:"size"},jr=Object.keys(Zr).map(Number).sort(et);function Kr(t){const e=[];for(const i of jr)qr(t,i)&&e.push(Zr[i]);return 0===e.length?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function qr(t,e){return(t&e)===e}function $r(t,e){return t===e}class Hr{constructor(t,e){if(!function(t){return t in Zr}(t))throw new Error(`literal expressions must have a specific type, got ${Kr(t)}`);this.type=t,this.value=e}}class Ur{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function Jr(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mapState:!1}}function Qr(t,e,i){switch(typeof t){case"boolean":if($r(e,Br))return new Hr(Br,t?"true":"false");if(!qr(e,Gr))throw new Error(`got a boolean, but expected ${Kr(e)}`);return new Hr(Gr,t);case"number":if($r(e,Xr))return new Hr(Xr,qs(t));if($r(e,Gr))return new Hr(Gr,!!t);if($r(e,Br))return new Hr(Br,t.toString());if(!qr(e,zr))throw new Error(`got a number, but expected ${Kr(e)}`);return new Hr(zr,t);case"string":if($r(e,Nr))return new Hr(Nr,fn(t));if($r(e,Gr))return new Hr(Gr,!!t);if(!qr(e,Br))throw new Error(`got a string, but expected ${Kr(e)}`);return new Hr(Br,t)}if(!Array.isArray(t))throw new Error("expression must be an array or a primitive value");if(0===t.length)throw new Error("empty expression");if("string"==typeof t[0])return function(t,e,i){const n=t[0],s=qo[n];if(!s)throw new Error(`unknown operator: ${n}`);return s(t,e,i)}(t,e,i);for(const e of t)if("number"!=typeof e)throw new Error("expected an array of numbers");if($r(e,Xr)){if(2!==t.length)throw new Error(`expected an array of two values for a size, got ${t.length}`);return new Hr(Xr,t)}if($r(e,Nr)){if(3===t.length)return new Hr(Nr,[...t,1]);if(4===t.length)return new Hr(Nr,t);throw new Error(`expected an array of 3 or 4 values for a color, got ${t.length}`)}if(!qr(e,Yr))throw new Error(`got an array of numbers, but expected ${Kr(e)}`);return new Hr(Yr,t)}const to="get",eo="var",io="concat",no="geometry-type",so="line-metric",ro="any",oo="all",ao="!",lo="resolution",ho="zoom",co="time",uo="==",go="!=",fo=">",po=">=",_o="<",mo="<=",yo="*",xo="/",So="+",vo="-",wo="clamp",Co="%",Io="^",Mo="abs",Ro="floor",Eo="ceil",bo="round",To="sin",Lo="cos",Ao="atan",ko="sqrt",Fo="match",Oo="between",Po="interpolate",Do="coalesce",Wo="case",Go="in",zo="number",Bo="string",No="array",Yo="color",Xo="id",Vo="band",Zo="palette",jo="to-string",Ko="has",qo={[to]:ia(Jo(1,1/0),$o),[eo]:ia(Jo(1,1),function(t,e,i){const n=t[1];if("string"!=typeof n)throw new Error("expected a string argument for var operation");return i.variables.add(n),[new Hr(Br,n)]}),[Ko]:ia(Jo(1,1/0),$o),[Xo]:ia(function(t,e,i){i.featureId=!0},Uo),[io]:ia(Jo(2,1/0),ta(Br)),[no]:ia(function(t,e,i){i.geometryType=!0},Uo),[so]:ia(Uo),[lo]:ia(Ho,Uo),[ho]:ia(Ho,Uo),[co]:ia(Ho,Uo),[ro]:ia(Jo(2,1/0),ta(Gr)),[oo]:ia(Jo(2,1/0),ta(Gr)),[ao]:ia(Jo(1,1),ta(Gr)),[uo]:ia(Jo(2,2),ta(Vr)),[go]:ia(Jo(2,2),ta(Vr)),[fo]:ia(Jo(2,2),ta(zr)),[po]:ia(Jo(2,2),ta(zr)),[_o]:ia(Jo(2,2),ta(zr)),[mo]:ia(Jo(2,2),ta(zr)),[yo]:ia(Jo(2,1/0),Qo),[Do]:ia(Jo(2,1/0),Qo),[xo]:ia(Jo(2,2),ta(zr)),[So]:ia(Jo(2,1/0),ta(zr)),[vo]:ia(Jo(2,2),ta(zr)),[wo]:ia(Jo(3,3),ta(zr)),[Co]:ia(Jo(2,2),ta(zr)),[Io]:ia(Jo(2,2),ta(zr)),[Mo]:ia(Jo(1,1),ta(zr)),[Ro]:ia(Jo(1,1),ta(zr)),[Eo]:ia(Jo(1,1),ta(zr)),[bo]:ia(Jo(1,1),ta(zr)),[To]:ia(Jo(1,1),ta(zr)),[Lo]:ia(Jo(1,1),ta(zr)),[Ao]:ia(Jo(1,2),ta(zr)),[ko]:ia(Jo(1,1),ta(zr)),[Fo]:ia(Jo(4,1/0),ea,function(t,e,i){const n=t.length-1,s=Br|zr|Gr,r=Qr(t[1],s,i),o=Qr(t[t.length-1],e,i),a=new Array(n-2);for(let e=0;e<n-2;e+=2){try{const n=Qr(t[e+2],r.type,i);a[e]=n}catch(t){throw new Error(`failed to parse argument ${e+1} of match expression: ${t.message}`)}try{const n=Qr(t[e+3],o.type,i);a[e+1]=n}catch(t){throw new Error(`failed to parse argument ${e+2} of match expression: ${t.message}`)}}return[r,...a,o]}),[Oo]:ia(Jo(3,3),ta(zr)),[Po]:ia(Jo(6,1/0),ea,function(t,e,i){const n=t[1];let s;switch(n[0]){case"linear":s=1;break;case"exponential":const t=n[1];if("number"!=typeof t||t<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(t)} instead`);s=t;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}const r=new Hr(zr,s);let o;try{o=Qr(t[2],zr,i)}catch(t){throw new Error(`failed to parse argument 1 in interpolate expression: ${t.message}`)}const a=new Array(t.length-3);for(let n=0;n<a.length;n+=2){try{const e=Qr(t[n+3],zr,i);a[n]=e}catch(t){throw new Error(`failed to parse argument ${n+2} for interpolate expression: ${t.message}`)}try{const s=Qr(t[n+4],e,i);a[n+1]=s}catch(t){throw new Error(`failed to parse argument ${n+3} for interpolate expression: ${t.message}`)}}return[r,o,...a]}),[Wo]:ia(Jo(3,1/0),function(t,e,i){const n=t[0],s=t.length-1;if(s%2==0)throw new Error(`expected an odd number of arguments for ${n}, got ${s} instead`)},function(t,e,i){const n=Qr(t[t.length-1],e,i),s=new Array(t.length-1);for(let e=0;e<s.length-1;e+=2){try{const n=Qr(t[e+1],Gr,i);s[e]=n}catch(t){throw new Error(`failed to parse argument ${e} of case expression: ${t.message}`)}try{const r=Qr(t[e+2],n.type,i);s[e+1]=r}catch(t){throw new Error(`failed to parse argument ${e+1} of case expression: ${t.message}`)}}return s[s.length-1]=n,s}),[Go]:ia(Jo(2,2),function(t,e,i){let n,s=t[2];if(!Array.isArray(s))throw new Error('the second argument for the "in" operator must be an array');if("string"==typeof s[0]){if("literal"!==s[0])throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');if(!Array.isArray(s[1]))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array');s=s[1],n=Br}else n=zr;const r=new Array(s.length);for(let t=0;t<r.length;t++)try{const e=Qr(s[t],n,i);r[t]=e}catch(e){throw new Error(`failed to parse haystack item ${t} for "in" expression: ${e.message}`)}return[Qr(t[1],n,i),...r]}),[zo]:ia(Jo(1,1/0),ta(Vr)),[Bo]:ia(Jo(1,1/0),ta(Vr)),[No]:ia(Jo(1,1/0),ta(zr)),[Yo]:ia(Jo(1,4),ta(zr)),[Vo]:ia(Jo(1,3),ta(zr)),[Zo]:ia(Jo(2,2),function(t,e,i){let n;try{n=Qr(t[1],zr,i)}catch(t){throw new Error(`failed to parse first argument in palette expression: ${t.message}`)}const s=t[2];if(!Array.isArray(s))throw new Error("the second argument of palette must be an array");const r=new Array(s.length);for(let t=0;t<r.length;t++){let e;try{e=Qr(s[t],Nr,i)}catch(e){throw new Error(`failed to parse color at index ${t} in palette expression: ${e.message}`)}if(!(e instanceof Hr))throw new Error(`the palette color at index ${t} must be a literal value`);r[t]=e}return[n,...r]}),[jo]:ia(Jo(1,1),ta(Gr|zr|Br|Nr))};function $o(t,e,i){const n=t.length-1,s=new Array(n);for(let e=0;e<n;++e){const n=t[e+1];switch(typeof n){case"number":s[e]=new Hr(zr,n);break;case"string":s[e]=new Hr(Br,n);break;default:throw new Error(`expected a string key or numeric array index for a get operation, got ${n}`)}0===e&&i.properties.add(String(n))}return s}function Ho(t,e,i){i.mapState=!0}function Uo(t,e,i){const n=t[0];if(1!==t.length)throw new Error(`expected no arguments for ${n} operation`);return[]}function Jo(t,e){return function(i,n,s){const r=i[0],o=i.length-1;if(t===e){if(o!==t){throw new Error(`expected ${t} argument${1===t?"":"s"} for ${r}, got ${o}`)}}else if(o<t||o>e){throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${r}, got ${o}`)}}}function Qo(t,e,i){const n=t.length-1,s=new Array(n);for(let r=0;r<n;++r){const n=Qr(t[r+1],e,i);s[r]=n}return s}function ta(t){return function(e,i,n){const s=e.length-1,r=new Array(s);for(let i=0;i<s;++i){const s=Qr(e[i+1],t,n);r[i]=s}return r}}function ea(t,e,i){const n=t[0],s=t.length-1;if(s%2==1)throw new Error(`expected an even number of arguments for operation ${n}, got ${s} instead`)}function ia(...t){return function(e,i,n){const s=e[0];let r;for(let s=0;s<t.length;s++){const o=t[s](e,i,n);if(s==t.length-1){if(!o)throw new Error("expected last argument validator to return the parsed args");r=o}}return new Ur(i,s,...r)}}function na(t){if(!t)return"";const e=t.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return na(t.getGeometries()[0]);default:return""}}function sa(t,e,i){return ra(Qr(t,e,i),i)}function ra(t,e){if(t instanceof Hr){if(t.type===Nr&&"string"==typeof t.value){const e=fn(t.value);return function(){return e}}return function(){return t.value}}const i=t.operator;switch(i){case zo:case Bo:case Do:return function(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let i=0;i<n;++i)s[i]=ra(t.args[i],e);switch(i){case Do:return t=>{for(let e=0;e<n;++e){const i=s[e](t);if(null!=i)return i}throw new Error("Expected one of the values to be non-null")};case zo:case Bo:return t=>{for(let e=0;e<n;++e){const n=s[e](t);if(typeof n===i)return n}throw new Error(`Expected one of the values to be a ${i}`)};default:throw new Error(`Unsupported assertion operator ${i}`)}}(t,e);case to:case eo:case Ko:return function(t){const e=t.args[0],i=e.value;switch(t.operator){case to:return e=>{const n=t.args;let s=e.properties[i];for(let t=1,e=n.length;t<e;++t){s=s[n[t].value]}return s};case eo:return t=>t.variables[i];case Ko:return e=>{const n=t.args;if(!(i in e.properties))return!1;let s=e.properties[i];for(let t=1,e=n.length;t<e;++t){const e=n[t].value;if(!s||!Object.hasOwn(s,e))return!1;s=s[e]}return!0};default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}(t);case Xo:return t=>t.featureId;case no:return t=>t.geometryType;case io:{const i=t.args.map(t=>ra(t,e));return t=>"".concat(...i.map(e=>e(t).toString()))}case lo:return t=>t.resolution;case ro:case oo:case Oo:case Go:case ao:return function(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let i=0;i<n;++i)s[i]=ra(t.args[i],e);switch(i){case ro:return t=>{for(let e=0;e<n;++e)if(s[e](t))return!0;return!1};case oo:return t=>{for(let e=0;e<n;++e)if(!s[e](t))return!1;return!0};case Oo:return t=>{const e=s[0](t),i=s[1](t),n=s[2](t);return e>=i&&e<=n};case Go:return t=>{const e=s[0](t);for(let i=1;i<n;++i)if(e===s[i](t))return!0;return!1};case ao:return t=>!s[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}(t,e);case uo:case go:case _o:case mo:case fo:case po:return function(t,e){const i=t.operator,n=ra(t.args[0],e),s=ra(t.args[1],e);switch(i){case uo:return t=>n(t)===s(t);case go:return t=>n(t)!==s(t);case _o:return t=>n(t)<s(t);case mo:return t=>n(t)<=s(t);case fo:return t=>n(t)>s(t);case po:return t=>n(t)>=s(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}(t,e);case yo:case xo:case So:case vo:case wo:case Co:case Io:case Mo:case Ro:case Eo:case bo:case To:case Lo:case Ao:case ko:return function(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let i=0;i<n;++i)s[i]=ra(t.args[i],e);switch(i){case yo:return t=>{let e=1;for(let i=0;i<n;++i)e*=s[i](t);return e};case xo:return t=>s[0](t)/s[1](t);case So:return t=>{let e=0;for(let i=0;i<n;++i)e+=s[i](t);return e};case vo:return t=>s[0](t)-s[1](t);case wo:return t=>{const e=s[0](t),i=s[1](t);if(e<i)return i;const n=s[2](t);return e>n?n:e};case Co:return t=>s[0](t)%s[1](t);case Io:return t=>Math.pow(s[0](t),s[1](t));case Mo:return t=>Math.abs(s[0](t));case Ro:return t=>Math.floor(s[0](t));case Eo:return t=>Math.ceil(s[0](t));case bo:return t=>Math.round(s[0](t));case To:return t=>Math.sin(s[0](t));case Lo:return t=>Math.cos(s[0](t));case Ao:return 2===n?t=>Math.atan2(s[0](t),s[1](t)):t=>Math.atan(s[0](t));case ko:return t=>Math.sqrt(s[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}(t,e);case Wo:return function(t,e){const i=t.args.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=ra(t.args[s],e);return t=>{for(let e=0;e<i-1;e+=2){if(n[e](t))return n[e+1](t)}return n[i-1](t)}}(t,e);case Fo:return function(t,e){const i=t.args.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=ra(t.args[s],e);return t=>{const e=n[0](t);for(let s=1;s<i-1;s+=2)if(e===n[s](t))return n[s+1](t);return n[i-1](t)}}(t,e);case Po:return function(t,e){const i=t.args.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=ra(t.args[s],e);return t=>{const e=n[0](t),s=n[1](t);let r,o;for(let a=2;a<i;a+=2){const i=n[a](t);let l=n[a+1](t);const h=Array.isArray(l);if(h&&(l=ln(l)),i>=s)return 2===a?l:h?aa(e,s,r,o,i,l):oa(e,s,r,o,i,l);r=i,o=l}return o}}(t,e);case jo:return function(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let i=0;i<n;++i)s[i]=ra(t.args[i],e);if(i===jo)return e=>{const i=s[0](e);return t.args[0].type===Nr?_n(i):i.toString()};throw new Error(`Unsupported convert operator ${i}`)}(t,e);default:throw new Error(`Unsupported operator ${i}`)}}function oa(t,e,i,n,s,r){const o=s-i;if(0===o)return n;const a=e-i;return n+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(r-n)}function aa(t,e,i,n,s,r){if(0===s-i)return n;const o=gn(n),a=gn(r);let l=a[2]-o[2];l>180?l-=360:l<-180&&(l+=360);return function(t){const e=(t[0]+16)/116,i=t[1],n=t[2]*Math.PI/180,s=cn(e),r=cn(e+i/500*Math.cos(n)),o=cn(e-i/200*Math.sin(n)),a=hn(3.021973625*r-1.617392459*s-.404875592*o),l=hn(-.943766287*r+1.916279586*s+.027607165*o),h=hn(.069407491*r-.22898585*s+1.159737864*o);return[ze(a+.5|0,0,255),ze(l+.5|0,0,255),ze(h+.5|0,0,255),t[3]]}([oa(t,e,i,o[0],s,a[0]),oa(t,e,i,o[1],s,a[1]),o[2]+oa(t,e,i,0,s,l),oa(t,e,i,n[3],s,r[3])])}class la extends Hs{constructor(t){super({opacity:1,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,rotation:void 0!==t.rotation?t.rotation:0,scale:void 0!==t.scale?t.scale:1,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=void 0!==t.fill?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=void 0!==t.angle?t.angle:0,this.stroke_=void 0!==t.stroke?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?Ki:qi,this.imageState_===Ki&&this.ready().then(()=>this.imageState_=qi),this.render()}clone(){const t=this.getScale(),e=new la({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 e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let n=Sn.get(i,null,null)?.getImage(1);if(!n){const e=this.renderOptions_,s=Math.ceil(e.size*t),r=pe(s,s);this.draw_(e,r,t),n=r.canvas,Sn.set(i,null,null,new In(n,void 0,null,qi,null))}return n}getPixelRatio(t){return t}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(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let n=this.radius,s=void 0===this.radius2_?n:this.radius2_;if(n<s){const t=n;n=s,s=t}const r=void 0===this.radius2_?this.points_:2*this.points_,o=2*Math.PI/r,a=s*Math.sin(o),l=n-Math.sqrt(s*s-a*a),h=Math.sqrt(a*a+l*l),c=h/a;if("miter"===t&&c<=i)return c*e;const u=e/2/c,d=e/2*(l/h),g=Math.sqrt((n+u)*(n+u)+d*d)-n;if(void 0===this.radius2_||"bevel"===t)return 2*g;const f=n*Math.sin(o),p=s-Math.sqrt(n*n-f*f),_=Math.sqrt(f*f+p*p)/f;if(_<=i){const t=_*e/2-s-n;return 2*Math.max(g,t)}return 2*g}createRenderOptions(){let t,e=Dn,i=Gn,n=0,s=null,r=0,o=0;this.stroke_&&(t=Mn(this.stroke_.getColor()??zn),o=this.stroke_.getWidth()??1,s=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,i=this.stroke_.getLineJoin()??Gn,e=this.stroke_.getLineCap()??Dn,n=this.stroke_.getMiterLimit()??10);const a=this.calculateLineJoinSize_(i,o,n),l=Math.max(this.radius,this.radius2_||0);return{strokeStyle:t,strokeWidth:o,size:Math.ceil(2*l+a),lineCap:e,lineDash:s,lineDashOffset:r,lineJoin:i,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let t=this.fill_.getColor();null===t&&(t=Pn),e.fillStyle=Mn(t),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),n=0;"string"==typeof i&&(i=pn(i)),null===i?n=1:Array.isArray(i)&&(n=4===i.length?i[3]:1),0===n&&(e=pe(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const n=void 0===this.radius2_?i:this.radius2_;void 0!==this.radius2_&&(e*=2);const s=this.angle_-Math.PI/2,r=2*Math.PI/e;for(let o=0;o<e;o++){const e=s+o*r,a=o%2==0?i:n;t.lineTo(a*Math.cos(e),a*Math.sin(e))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=Pn,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}const ha=la;class ca extends ha{constructor(t){super({points:1/0,fill:(t=t||{radius:5}).fill,radius:t.radius,stroke:t.stroke,scale:void 0!==t.scale?t.scale:1,rotation:void 0!==t.rotation?t.rotation:0,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){const t=this.getScale(),e=new ca({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 e.setOpacity(this.getOpacity()),e}setRadius(t){this.radius=t,this.render()}}const ua=ca;class da{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,void 0!==t.color&&this.setColor(t.color)}clone(){const t=this.getColor();return new da({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(null!==t&&"object"==typeof t&&"src"in t){const e=Cn(null,t.src,"anonymous",void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===ji&&e.load(),e.getImageState()===Ki&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?St(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:pn(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}const ga=da;class fa{constructor(t){t=t||{},this.color_=void 0!==t.color?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=void 0!==t.lineDash?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.width_=t.width}clone(){const t=this.getColor();return new fa({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(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setWidth(t){this.width_=t}}const pa=fa;class _a{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=xa,void 0!==t.geometry&&this.setGeometry(t.geometry),this.fill_=void 0!==t.fill?t.fill:null,this.image_=void 0!==t.image?t.image:null,this.renderer_=void 0!==t.renderer?t.renderer:null,this.hitDetectionRenderer_=void 0!==t.hitDetectionRenderer?t.hitDetectionRenderer:null,this.stroke_=void 0!==t.stroke?t.stroke:null,this.text_=void 0!==t.text?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&"object"==typeof t&&(t=t.clone()),new _a({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(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=xa,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let ma=null;function ya(t,e){if(!ma){const t=new ga({color:"rgba(255,255,255,0.4)"}),e=new pa({color:"#3399CC",width:1.25});ma=[new _a({image:new ua({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return ma}function xa(t){return t.getGeometry()}const Sa=_a;class va{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=qs(void 0!==t.scale?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=void 0!==t.fill?t.fill:new ga({color:"#333"}),this.maxAngle_=void 0!==t.maxAngle?t.maxAngle:Math.PI/4,this.placement_=void 0!==t.placement?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=void 0!==t.stroke?t.stroke:null,this.offsetX_=void 0!==t.offsetX?t.offsetX:0,this.offsetY_=void 0!==t.offsetY?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=void 0===t.padding?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new va({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(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=qs(void 0!==t?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}const wa=va;function Ca(t){return!0}function Ia(t){const e=Jr(),i=function(t,e){const i=t.length,n=new Array(i);for(let s=0;s<i;++s){const i=t[s],r="filter"in i?sa(i.filter,Gr,e):Ca;let o;if(Array.isArray(i.style)){const t=i.style.length;o=new Array(t);for(let n=0;n<t;++n)o[n]=Ra(i.style[n],e)}else o=[Ra(i.style,e)];n[s]={filter:r,styles:o}}return function(e){const s=[];let r=!1;for(let o=0;o<i;++o){if((0,n[o].filter)(e)&&(!t[o].else||!r)){r=!0;for(const t of n[o].styles){const i=t(e);i&&s.push(i)}}}return s}}(t,e),n={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""};return function(t,s){if(n.properties=t.getPropertiesInternal(),n.resolution=s,e.featureId){const e=t.getId();n.featureId=void 0!==e?e:null}return e.geometryType&&(n.geometryType=na(t.getGeometry())),i(n)}}function Ma(t){const e=Jr(),i=t.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=Ra(t[s],e);const s={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""},r=new Array(i);return function(t,o){if(s.properties=t.getPropertiesInternal(),s.resolution=o,e.featureId){const e=t.getId();s.featureId=void 0!==e?e:null}let a=0;for(let t=0;t<i;++t){const e=n[t](s);e&&(r[a]=e,a+=1)}return r.length=a,r}}function Ra(t,e){const i=Ea(t,"",e),n=ba(t,"",e),s=function(t,e){const i="text-",n=La(t,i+"value",e);if(!n)return null;const s=Ea(t,i,e),r=Ea(t,i+"background-",e),o=ba(t,i,e),a=ba(t,i+"background-",e),l=La(t,i+"font",e),h=Ta(t,i+"max-angle",e),c=Ta(t,i+"offset-x",e),u=Ta(t,i+"offset-y",e),d=Aa(t,i+"overflow",e),g=La(t,i+"placement",e),f=Ta(t,i+"repeat",e),p=Da(t,i+"scale",e),_=Aa(t,i+"rotate-with-view",e),m=Ta(t,i+"rotation",e),y=La(t,i+"align",e),x=La(t,i+"justify",e),S=La(t,i+"baseline",e),v=Aa(t,i+"keep-upright",e),w=Fa(t,i+"padding",e),C=Ba(t,i+"declutter-mode"),I=new wa({declutterMode:C});return function(t){if(I.setText(n(t)),s&&I.setFill(s(t)),r&&I.setBackgroundFill(r(t)),o&&I.setStroke(o(t)),a&&I.setBackgroundStroke(a(t)),l&&I.setFont(l(t)),h&&I.setMaxAngle(h(t)),c&&I.setOffsetX(c(t)),u&&I.setOffsetY(u(t)),d&&I.setOverflow(d(t)),g){const e=g(t);if("point"!==e&&"line"!==e)throw new Error("Expected point or line for text-placement");I.setPlacement(e)}if(f&&I.setRepeat(f(t)),p&&I.setScale(p(t)),_&&I.setRotateWithView(_(t)),m&&I.setRotation(m(t)),y){const e=y(t);if("left"!==e&&"center"!==e&&"right"!==e&&"end"!==e&&"start"!==e)throw new Error("Expected left, right, center, start, or end for text-align");I.setTextAlign(e)}if(x){const e=x(t);if("left"!==e&&"right"!==e&&"center"!==e)throw new Error("Expected left, right, or center for text-justify");I.setJustify(e)}if(S){const e=S(t);if("bottom"!==e&&"top"!==e&&"middle"!==e&&"alphabetic"!==e&&"hanging"!==e)throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");I.setTextBaseline(e)}return w&&I.setPadding(w(t)),v&&I.setKeepUpright(v(t)),I}}(t,e),r=function(t,e){if("icon-src"in t)return function(t,e){const i="icon-",n=i+"src",s=Ya(t[n],n),r=Oa(t,i+"anchor",e),o=Da(t,i+"scale",e),a=Ta(t,i+"opacity",e),l=Oa(t,i+"displacement",e),h=Ta(t,i+"rotation",e),c=Aa(t,i+"rotate-with-view",e),u=Ga(t,i+"anchor-origin"),d=za(t,i+"anchor-x-units"),g=za(t,i+"anchor-y-units"),f=function(t,e){const i=t[e];if(void 0===i)return;return Va(i,e)}(t,i+"color"),p=function(t,e){const i=t[e];if(void 0===i)return;if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);return i}(t,i+"cross-origin"),_=function(t,e){const i=t[e];if(void 0===i)return;return Na(i,e)}(t,i+"offset"),m=Ga(t,i+"offset-origin"),y=Wa(t,i+"width"),x=Wa(t,i+"height"),S=function(t,e){const i=t[e];if(void 0===i)return;if("number"==typeof i)return qs(i);if(!Array.isArray(i))throw new Error(`Expected a number or size array for ${e}`);if(2!==i.length||"number"!=typeof i[0]||"number"!=typeof i[1])throw new Error(`Expected a number or size array for ${e}`);return i}(t,i+"size"),v=Ba(t,i+"declutter-mode"),w=new Qs({src:s,anchorOrigin:u,anchorXUnits:d,anchorYUnits:g,color:f,crossOrigin:p,offset:_,offsetOrigin:m,height:x,width:y,size:S,declutterMode:v});return function(t){return a&&w.setOpacity(a(t)),l&&w.setDisplacement(l(t)),h&&w.setRotation(h(t)),c&&w.setRotateWithView(c(t)),o&&w.setScale(o(t)),r&&w.setAnchor(r(t)),w}}(t,e);if("shape-points"in t)return function(t,e){const i="shape-",n=i+"points",s=i+"radius",r=Xa(t[n],n),o=Xa(t[s],s),a=Ea(t,i,e),l=ba(t,i,e),h=Da(t,i+"scale",e),c=Oa(t,i+"displacement",e),u=Ta(t,i+"rotation",e),d=Aa(t,i+"rotate-with-view",e),g=Wa(t,i+"radius2"),f=Wa(t,i+"angle"),p=Ba(t,i+"declutter-mode"),_=new ha({points:r,radius:o,radius2:g,angle:f,declutterMode:p});return function(t){return a&&_.setFill(a(t)),l&&_.setStroke(l(t)),c&&_.setDisplacement(c(t)),u&&_.setRotation(u(t)),d&&_.setRotateWithView(d(t)),h&&_.setScale(h(t)),_}}(t,e);if("circle-radius"in t)return function(t,e){const i="circle-",n=Ea(t,i,e),s=ba(t,i,e),r=Ta(t,i+"radius",e),o=Da(t,i+"scale",e),a=Oa(t,i+"displacement",e),l=Ta(t,i+"rotation",e),h=Aa(t,i+"rotate-with-view",e),c=Ba(t,i+"declutter-mode"),u=new ua({radius:5,declutterMode:c});return function(t){return r&&u.setRadius(r(t)),n&&u.setFill(n(t)),s&&u.setStroke(s(t)),a&&u.setDisplacement(a(t)),l&&u.setRotation(l(t)),h&&u.setRotateWithView(h(t)),o&&u.setScale(o(t)),u}}(t,e);return null}(t,e),o=Ta(t,"z-index",e);if(!(i||n||s||r||ct(t)))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(t));const a=new Sa;return function(t){let e=!0;if(i){const n=i(t);n&&(e=!1),a.setFill(n)}if(n){const i=n(t);i&&(e=!1),a.setStroke(i)}if(s){const i=s(t);i&&(e=!1),a.setText(i)}if(r){const i=r(t);i&&(e=!1),a.setImage(i)}return o&&a.setZIndex(o(t)),e?null:a}}function Ea(t,e,i){let n;if(e+"fill-pattern-src"in t)n=function(t,e,i){const n=La(t,e+"pattern-src",i),s=Pa(t,e+"pattern-offset",i),r=Pa(t,e+"pattern-size",i),o=ka(t,e+"color",i);return function(t){return{src:n(t),offset:s&&s(t),size:r&&r(t),color:o&&o(t)}}}(t,e+"fill-",i);else{if("none"===t[e+"fill-color"])return t=>null;n=ka(t,e+"fill-color",i)}if(!n)return null;const s=new ga;return function(t){const e=n(t);return e===Hi?null:(s.setColor(e),s)}}function ba(t,e,i){const n=Ta(t,e+"stroke-width",i),s=ka(t,e+"stroke-color",i);if(!n&&!s)return null;const r=La(t,e+"stroke-line-cap",i),o=La(t,e+"stroke-line-join",i),a=Fa(t,e+"stroke-line-dash",i),l=Ta(t,e+"stroke-line-dash-offset",i),h=Ta(t,e+"stroke-miter-limit",i),c=new pa;return function(t){if(s){const e=s(t);if(e===Hi)return null;c.setColor(e)}if(n&&c.setWidth(n(t)),r){const e=r(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");c.setLineCap(e)}if(o){const e=o(t);if("bevel"!==e&&"round"!==e&&"miter"!==e)throw new Error("Expected bevel, round, or miter line join");c.setLineJoin(e)}return a&&c.setLineDash(a(t)),l&&c.setLineDashOffset(l(t)),h&&c.setMiterLimit(h(t)),c}}function Ta(t,e,i){if(!(e in t))return;const n=sa(t[e],zr,i);return function(t){return Xa(n(t),e)}}function La(t,e,i){if(!(e in t))return null;const n=sa(t[e],Br,i);return function(t){return Ya(n(t),e)}}function Aa(t,e,i){if(!(e in t))return null;const n=sa(t[e],Gr,i);return function(t){const i=n(t);if("boolean"!=typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function ka(t,e,i){if(!(e in t))return null;const n=sa(t[e],Nr,i);return function(t){return Va(n(t),e)}}function Fa(t,e,i){if(!(e in t))return null;const n=sa(t[e],Yr,i);return function(t){return Na(n(t),e)}}function Oa(t,e,i){if(!(e in t))return null;const n=sa(t[e],Yr,i);return function(t){const i=Na(n(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function Pa(t,e,i){if(!(e in t))return null;const n=sa(t[e],Yr,i);return function(t){return Za(n(t),e)}}function Da(t,e,i){if(!(e in t))return null;const n=sa(t[e],Yr|zr,i);return function(t){return function(t,e){if("number"==typeof t)return t;return Za(t,e)}(n(t),e)}}function Wa(t,e){const i=t[e];if(void 0!==i){if("number"!=typeof i)throw new Error(`Expected a number for ${e}`);return i}}function Ga(t,e){const i=t[e];if(void 0!==i){if("bottom-left"!==i&&"bottom-right"!==i&&"top-left"!==i&&"top-right"!==i)throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return i}}function za(t,e){const i=t[e];if(void 0!==i){if("pixels"!==i&&"fraction"!==i)throw new Error(`Expected pixels or fraction for ${e}`);return i}}function Ba(t,e){const i=t[e];if(void 0!==i){if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);if("declutter"!==i&&"obstacle"!==i&&"none"!==i)throw new Error(`Expected declutter, obstacle, or none for ${e}`);return i}}function Na(t,e){if(!Array.isArray(t))throw new Error(`Expected an array for ${e}`);const i=t.length;for(let n=0;n<i;++n)if("number"!=typeof t[n])throw new Error(`Expected an array of numbers for ${e}`);return t}function Ya(t,e){if("string"!=typeof t)throw new Error(`Expected a string for ${e}`);return t}function Xa(t,e){if("number"!=typeof t)throw new Error(`Expected a number for ${e}`);return t}function Va(t,e){if("string"==typeof t)return t;const i=Na(t,e),n=i.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function Za(t,e){const i=Na(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}const ja={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function Ka(t,e,i){return function(n,s,r,o,a){if(!n)return;if(!s&&!e)return n;const l=e?0:r[0]*s,h=e?0:r[1]*s,c=a?a[0]:0,u=a?a[1]:0;let d=t[0]+l/2+c,g=t[2]-l/2+c,f=t[1]+h/2+u,p=t[3]-h/2+u;d>g&&(d=(g+d)/2,g=d),f>p&&(f=(p+f)/2,p=f);let _=ze(n[0],d,g),m=ze(n[1],f,p);if(o&&i&&s){const t=30*s;_+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-g)/t),m+=-t*Math.log(1+Math.max(0,f-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-p)/t)}return[_,m]}}function qa(t){return t}function $a(t){return 1-function(t){return Math.pow(t,3)}(1-t)}function Ha(t){return 3*t*t-2*t*t*t}function Ua(t,e,i,n){let s=0;const r=t[i-n],o=t[i-n+1];let a=0,l=0;for(;e<i;e+=n){const i=t[e]-r,n=t[e+1]-o;s+=l*i-a*n,a=i,l=n}return s/2}function Ja(t,e,i,n){let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r];s+=Ua(t,e,o,n),e=o}return s}function Qa(t,e,i,n,s,r,o){const a=t[e],l=t[e+1],h=t[i]-a,c=t[i+1]-l;let u;if(0===h&&0===c)u=e;else{const d=((s-a)*h+(r-l)*c)/(h*h+c*c);if(d>1)u=i;else{if(d>0){for(let s=0;s<n;++s)o[s]=Ze(t[e+s],t[i+s],d);return void(o.length=n)}u=e}}for(let e=0;e<n;++e)o[e]=t[u+e];o.length=n}function tl(t,e,i,n,s){let r=t[e],o=t[e+1];for(e+=n;e<i;e+=n){const i=t[e],n=t[e+1],a=Ne(r,o,i,n);a>s&&(s=a),r=i,o=n}return s}function el(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];s=tl(t,e,o,n,s),e=o}return s}function il(t,e,i,n,s,r,o,a,l,h,c){if(e==i)return h;let u,d;if(0===s){if(d=Ne(o,a,t[e],t[e+1]),d<h){for(u=0;u<n;++u)l[u]=t[e+u];return l.length=n,d}return h}c=c||[NaN,NaN];let g=e+n;for(;g<i;)if(Qa(t,g-n,g,n,o,a,c),d=Ne(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n,g+=n}else g+=n*Math.max((Math.sqrt(d)-Math.sqrt(h))/s|0,1);if(r&&(Qa(t,i-n,e,n,o,a,c),d=Ne(o,a,c[0],c[1]),d<h)){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n}return h}function nl(t,e,i,n,s,r,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];h=il(t,e,d,n,s,r,o,a,l,h,c),e=d}return h}function sl(t,e,i,n){for(let s=0,r=i.length;s<r;++s){const r=i[s];for(let i=0;i<n;++i)t[e++]=r[i]}return e}function rl(t,e,i,n,s){s=s||[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=sl(t,e,i[o],n);s[r++]=a,e=a}return s.length=r,s}class al extends sr{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}clone(){return new al(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<Yt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(tl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),il(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return Ua(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Rn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=cs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new al(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=sl(this.flatCoordinates,0,t,this.stride),this.changed()}}const ll=al;class hl extends sr{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new hl(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const s=this.flatCoordinates,r=Ne(t,e,s[0],s[1]);if(r<n){const t=this.stride;for(let e=0;e<t;++e)i[e]=s[e];return i.length=t,r}return n}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return function(t,e){const i=t[0],n=t[1];return Kt(i,n,i,n,e)}(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Zt(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=function(t,e,i){for(let n=0,s=i.length;n<s;++n)t[e++]=i[n];return e}(this.flatCoordinates,0,t,this.stride),this.changed()}}const cl=hl;function ul(t,e,i,n,s){const r=function(t,e){let i;return i=e(Jt(t)),i||(i=e(Qt(t)),i||(i=e(se(t)),i||(i=e(ne(t)),i||!1)))}(s,function(s){return!dl(t,e,i,n,s[0],s[1])});return!r}function dl(t,e,i,n,s,r){let o=0,a=t[i-n],l=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];l<=r?n>r&&(i-a)*(r-l)-(s-a)*(n-l)>0&&o++:n<=r&&(i-a)*(r-l)-(s-a)*(n-l)<0&&o--,a=i,l=n}return 0!==o}function gl(t,e,i,n,s,r){if(0===i.length)return!1;if(!dl(t,e,i[0],n,s,r))return!1;for(let e=1,o=i.length;e<o;++e)if(dl(t,i[e-1],i[e],n,s,r))return!1;return!0}function fl(t,e,i,n,s,r,o){let a,l,h,c,u,d,g;const f=s[r+1],p=[];for(let s=0,r=i.length;s<r;++s){const r=i[s];for(c=t[r-n],d=t[r-n+1],a=e;a<r;a+=n)u=t[a],g=t[a+1],(f<=d&&g<=f||d<=f&&f<=g)&&(h=(f-d)/(g-d)*(u-c)+c,p.push(h)),c=u,d=g}let _=NaN,m=-1/0;for(p.sort(et),c=p[0],a=1,l=p.length;a<l;++a){u=p[a];const s=Math.abs(u-c);s>m&&(h=(c+u)/2,gl(t,e,i,n,h,f)&&(_=h,m=s)),c=u}return isNaN(_)&&(_=s[r]),o?(o.push(_,f,m),o):[_,f,m]}function pl(t,e,i,n,s,r){return r=r??Ht([1/0,1/0,-1/0,-1/0],t,e,i,n),!!oe(s,r)&&(r[0]>=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]||function(t,e,i,n,s){let r;for(e+=n;e<i;e+=n)if(r=s(t.slice(e-n,e),t.slice(e,e+n)),r)return r;return!1}(t,e,i,n,function(t,e){return function(t,e,i){let n=!1;const s=jt(t,e),r=jt(t,i);if(s===Dt||r===Dt)n=!0;else{const o=t[0],a=t[1],l=t[2],h=t[3],c=e[0],u=e[1],d=i[0],g=i[1],f=(g-u)/(d-c);let p,_;r&Wt&&!(s&Wt)&&(p=d-(g-h)/f,n=p>=o&&p<=l),n||!(r&Gt)||s&Gt||(_=g-(d-l)*f,n=_>=a&&_<=h),n||!(r&zt)||s&zt||(p=d-(g-a)/f,n=p>=o&&p<=l),n||!(r&Bt)||s&Bt||(_=g-(d-o)*f,n=_>=a&&_<=h)}return n}(s,t,e)}))}function _l(t,e,i,n,s){if(!function(t,e,i,n,s){return!!(pl(t,e,i,n,s)||dl(t,e,i,n,s[0],s[1])||dl(t,e,i,n,s[0],s[3])||dl(t,e,i,n,s[2],s[1])||dl(t,e,i,n,s[2],s[3]))}(t,e,i[0],n,s))return!1;if(1===i.length)return!0;for(let e=1,r=i.length;e<r;++e)if(ul(t,i[e-1],i[e],n,s)&&!pl(t,i[e-1],i[e],n,s))return!1;return!0}function ml(t,e,i,n){for(;e<i-n;){for(let s=0;s<n;++s){const r=t[e+s];t[e+s]=t[i-n+s],t[i-n+s]=r}e+=n,i-=n}}function yl(t,e,i,n){let s=0,r=t[i-n],o=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];s+=(i-r)*(n+o),r=i,o=n}return 0===s?void 0:s>0}function xl(t,e,i,n,s){s=void 0!==s&&s;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=yl(t,e,o,n);if(0===r){if(s&&a||!s&&!a)return!1}else if(s&&!a||!s&&a)return!1;e=o}return!0}function Sl(t,e,i,n,s){s=void 0!==s&&s;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=yl(t,e,o,n);(0===r?s&&a||!s&&!a:s&&!a||!s&&a)&&ml(t,e,o,n),e=o}return e}class vl extends sr{constructor(t,e,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,void 0!==e&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?rt(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new vl(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Yt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(el(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),nl(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return gl(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Ja(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),Sl(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,En(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=te(this.getExtent());this.flatInteriorPoint_=fl(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new cl(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new ll(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,n=[];let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=new ll(e.slice(s,o),t);n.push(a),s=o}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;xl(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Sl(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=gs(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new vl(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return _l(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=rl(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}function wl(t){if(ae(t))throw new Error("Cannot create polygon from empty extent");const e=t[0],i=t[1],n=t[2],s=t[3],r=[e,i,e,s,n,s,n,i,e,i];return new vl(r,"XY",[r.length])}function Cl(t,e,i,n){const s=re(e)/i[0],r=ie(e)/i[1];return n?Math.min(t,Math.max(s,r)):Math.min(t,Math.min(s,r))}function Il(t,e,i){let n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(n=Math.max(n,i),n/=Math.log(1+50*Math.max(0,i/t-1))/50+1),ze(n,i/2,2*e)}function Ml(t,e,i,n,s){return i=void 0===i||i,function(r,o,a,l){if(void 0!==r){const o=n?Cl(t,n,a,s):t;return i&&l?Il(r,o,e):ze(r,e,o)}}}function Rl(t){if(void 0!==t)return 0}function El(t){if(void 0!==t)return t}function bl(t,e){setTimeout(function(){t(e)},0)}function Tl(t){return!(t.sourceCenter&&t.targetCenter&&!ce(t.sourceCenter,t.targetCenter))&&(t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation)}function Ll(t,e,i,n,s){const r=Math.cos(-s);let o=Math.sin(-s),a=t[0]*r-t[1]*o,l=t[1]*r+t[0]*o;a+=(e[0]/2-i[0])*n,l+=(i[1]-e[1]/2)*n,o=-o;return[a*r-l*o,l*r+a*o]}const Al=class extends wt{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Ei(t.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,t.projection&&wi(),t.center&&(t.center=Di(t.center,this.projection_)),t.extent&&(t.extent=Gi(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in ja)delete e[t];this.setProperties(e,!0);const i=function(t){let e,i,n;const s=28,r=2;let o=void 0!==t.minZoom?t.minZoom:0,a=void 0!==t.maxZoom?t.maxZoom:s;const l=void 0!==t.zoomFactor?t.zoomFactor:r,h=void 0!==t.multiWorld&&t.multiWorld,c=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,u=void 0!==t.showFullExtent&&t.showFullExtent,d=Ei(t.projection,"EPSG:3857"),g=d.getExtent();let f=t.constrainOnlyCenter,p=t.extent;h||p||!d.isGlobal()||(f=!1,p=g);if(void 0!==t.resolutions){const s=t.resolutions;i=s[o],n=void 0!==s[a]?s[a]:s[s.length-1],e=t.constrainResolution?function(t,e,i,n){return e=void 0===e||e,function(s,r,o,a){if(void 0!==s){const l=t[0],h=t[t.length-1],c=i?Cl(l,i,o,n):l;if(a)return e?Il(s,c,h):ze(s,h,c);const u=Math.min(c,s),d=Math.floor(nt(t,u,r));return t[d]>c&&d<t.length-1?t[d+1]:t[d]}}}(s,c,!f&&p,u):Ml(i,n,c,!f&&p,u)}else{const h=(g?Math.max(re(g),ie(g)):360*Se.degrees/d.getMetersPerUnit())/256/Math.pow(r,0),_=h/Math.pow(r,s-0);i=t.maxResolution,void 0!==i?o=0:i=h/Math.pow(l,o),n=t.minResolution,void 0===n&&(n=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(l,a):h/Math.pow(l,a):_),a=o+Math.floor(Math.log(i/n)/Math.log(l)),n=i/Math.pow(l,a-o),e=t.constrainResolution?function(t,e,i,n,s,r){return n=void 0===n||n,i=void 0!==i?i:0,function(o,a,l,h){if(void 0!==o){const c=s?Cl(e,s,l,r):e;if(h)return n?Il(o,c,i):ze(o,i,c);const u=1e-9,d=Math.ceil(Math.log(e/c)/Math.log(t)-u),g=-a*(.5-u)+.5,f=Math.min(c,o),p=Math.floor(Math.log(e/f)/Math.log(t)+g),_=Math.max(d,p);return ze(e/Math.pow(t,_),i,c)}}}(l,i,n,c,!f&&p,u):Ml(i,n,c,!f&&p,u)}return{constraint:e,maxResolution:i,minResolution:n,minZoom:o,zoomFactor:l}}(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const n=function(t){if(void 0!==t.extent){const e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return Ka(t.extent,t.constrainOnlyCenter,e)}const e=Ei(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,Ka(t,!1,!1)}return qa}(t),s=i.constraint,r=function(t){const e=void 0===t.enableRotation||t.enableRotation;if(e){const e=t.constrainRotation;return void 0===e||!0===e?function(t){const e=void 0===t?Xe(5):t;return function(t,i){return i||void 0===t?t:Math.abs(t)<=e?0:t}}():!1===e?El:"number"==typeof e?function(t){const e=2*Math.PI/t;return function(t,i){return i?t:void 0!==t?t=Math.floor(t/e+.5)*e:void 0}}(e):El}return Rl}(t);this.constraints_={center:n,resolution:s,rotation:r},this.setRotation(void 0!==t.rotation?t.rotation:0),this.setCenterInternal(void 0!==t.center?t.center:null),void 0!==t.resolution?this.setResolution(t.resolution):void 0!==t.zoom&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const n=t||[0,0,0,0];e=e||[0,0,0,0];const s=this.getResolution(),r=s/2*(n[3]-e[3]+e[1]-n[1]),o=s/2*(n[0]-e[0]+e[2]-n[2]);this.setCenterInternal([i[0]+r,i[1]-o])}}getUpdatedOptions_(t){const e=this.getProperties();return void 0!==e.resolution?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let t=0;t<e.length;++t){let i=arguments[t];i.center&&(i=Object.assign({},i),i.center=Di(i.center,this.getProjection())),i.anchor&&(i=Object.assign({},i),i.anchor=Di(i.anchor,this.getProjection())),e[t]=i}this.animateInternal.apply(this,e)}animateInternal(t){let e,i=arguments.length;i>1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n<i&&!this.isDef();++n){const t=arguments[n];t.center&&this.setCenterInternal(t.center),void 0!==t.zoom?this.setZoom(t.zoom):t.resolution&&this.setResolution(t.resolution),void 0!==t.rotation&&this.setRotation(t.rotation)}if(n===i)return void(e&&bl(e,!0));let s=Date.now(),r=this.targetCenter_.slice(),o=this.targetResolution_,a=this.targetRotation_;const l=[];for(;n<i;++n){const t=arguments[n],i={start:s,complete:!1,anchor:t.anchor,duration:void 0!==t.duration?t.duration:1e3,easing:t.easing||Ha,callback:e};if(t.center&&(i.sourceCenter=r,i.targetCenter=t.center.slice(),r=i.targetCenter),void 0!==t.zoom?(i.sourceResolution=o,i.targetResolution=this.getResolutionForZoom(t.zoom),o=i.targetResolution):t.resolution&&(i.sourceResolution=o,i.targetResolution=t.resolution,o=i.targetResolution),void 0!==t.rotation){i.sourceRotation=a;const e=Ve(t.rotation-a+Math.PI,2*Math.PI)-Math.PI;i.targetRotation=a+e,a=i.targetRotation}Tl(i)?i.complete=!0:s+=i.duration,l.push(i)}this.animations_.push(l),this.setHint(Ft,1),this.updateAnimations_()}getAnimating(){return this.hints_[Ft]>0}getInteracting(){return this.hints_[Ot]>0}cancelAnimations(){let t;this.setHint(Ft,-this.hints_[Ft]);for(let e=0,i=this.animations_.length;e<i;++e){const i=this.animations_[e];if(i[0].callback&&bl(i[0].callback,!1),!t)for(let e=0,n=i.length;e<n;++e){const n=i[e];if(!n.complete){t=n.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const n=this.animations_[i];let s=!0;for(let i=0,r=n.length;i<r;++i){const r=n[i];if(r.complete)continue;const o=t-r.start;let a=r.duration>0?o/r.duration:1;a>=1?(r.complete=!0,a=1):s=!1;const l=r.easing(a);if(r.sourceCenter){const t=r.sourceCenter[0],e=r.sourceCenter[1],i=r.targetCenter[0],n=r.targetCenter[1];this.nextCenter_=r.targetCenter;const s=t+l*(i-t),o=e+l*(n-e);this.targetCenter_=[s,o]}if(r.sourceResolution&&r.targetResolution){const t=1===l?r.targetResolution:r.sourceResolution+l*(r.targetResolution-r.sourceResolution);if(r.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,r.anchor)}this.nextResolution_=r.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==r.sourceRotation&&void 0!==r.targetRotation){const t=1===l?Ve(r.targetRotation+Math.PI,2*Math.PI)-Math.PI:r.sourceRotation+l*(r.targetRotation-r.sourceRotation);if(r.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,r.anchor)}this.nextRotation_=r.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!r.complete)break}if(s){this.animations_[i]=null,this.setHint(Ft,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&bl(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();var s,r;return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],function(t,e){const i=Math.cos(e),n=Math.sin(e),s=t[0]*i-t[1]*n,r=t[1]*i+t[0]*n;t[0]=s,t[1]=r}(i,t-this.getRotation()),r=e,(s=i)[0]+=+r[0],s[1]+=+r[1]),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),s=this.getResolution();if(void 0!==n&&void 0!==s){i=[e[0]-t*(e[0]-n[0])/s,e[1]-t*(e[1]-n[1])/s]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?Pi(t,this.getProjection()):t}getCenterInternal(){return this.get(ja.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){return Wi(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();Rt(e,"The view center is not defined");const i=this.getResolution();Rt(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return Rt(void 0!==n,"The view rotation is not defined"),ee(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(ja.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Gi(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=re(t)/e[0],n=ie(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(i){return e/Math.pow(t,i*n)}}getRotation(){return this.get(ja.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,s=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/s}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const s=this.padding_;if(s){const t=this.getViewportSizeMinusPadding_();n=Ll(n,this.getViewportSize_(),[t[0]/2+s[3],t[1]/2+s[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const s=nt(this.resolutions_,t,1);n=s,e=this.resolutions_[s],i=s==this.resolutions_.length-1?2:e/this.resolutions_[s+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=ze(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,ze(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(Rt(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){Rt(!ae(t),"Cannot fit empty extent provided as `geometry`");i=wl(Gi(t,this.getProjection()))}else if("Circle"===t.getType()){const e=Gi(t.getExtent(),this.getProjection());i=wl(e),i.rotate(this.getRotation(),te(e))}else{const e=Oi();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),s=t.getFlatCoordinates(),r=t.getStride();let o=1/0,a=1/0,l=-1/0,h=-1/0;for(let t=0,e=s.length;t<e;t+=r){const e=s[t]*i-s[t+1]*n,r=s[t]*n+s[t+1]*i;o=Math.min(o,e),a=Math.min(a,r),l=Math.max(l,e),h=Math.max(h,r)}return[o,a,l,h]}fitInternal(t,e){let i=(e=e||{}).size;i||(i=this.getViewportSizeMinusPadding_());const n=void 0!==e.padding?e.padding:[0,0,0,0],s=void 0!==e.nearest&&e.nearest;let r;r=void 0!==e.minResolution?e.minResolution:void 0!==e.maxZoom?this.getResolutionForZoom(e.maxZoom):0;const o=this.rotatedExtentForGeometry(t);let a=this.getResolutionForExtentInternal(o,[i[0]-n[1]-n[3],i[1]-n[0]-n[2]]);a=isNaN(a)?r:Math.max(a,r),a=this.getConstrainedResolution(a,s?0:1);const l=this.getRotation(),h=Math.sin(l),c=Math.cos(l),u=te(o);u[0]+=(n[1]-n[3])/2*a,u[1]+=(n[0]-n[2])/2*a;const d=u[0]*c-u[1]*h,g=u[1]*c+u[0]*h,f=this.getConstrainedCenter([d,g],a),p=e.callback?e.callback:lt;void 0!==e.duration?this.animateInternal({resolution:a,center:f,duration:e.duration,easing:e.easing},p):(this.targetResolution_=a,this.targetCenter_=f,this.applyTargetState_(!1,!0),bl(p,!0))}centerOn(t,e,i){this.centerOnInternal(Di(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(Ll(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,n){let s;const r=this.padding_;if(r&&t){const o=this.getViewportSizeMinusPadding_(-i),a=Ll(t,n,[o[0]/2+r[3],o[1]/2+r[0]],e,i);s=[t[0]-a[0],t[1]-a[1]]}return s}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(t){const e=Pi(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){const e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&Di(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*t,0,n,i);e&&(this.targetCenter_=this.calculateCenterZoom(s,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=Di(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(n,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t?Di(t,this.getProjection()):t)}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,n=this.constraints_.rotation(this.targetRotation_,i),s=this.getViewportSize_(n),r=this.constraints_.resolution(this.targetResolution_,0,s,i),o=this.constraints_.center(this.targetCenter_,r,s,i,this.calculateCenterShift(this.targetCenter_,r,n,s));this.get(ja.ROTATION)!==n&&this.set(ja.ROTATION,n),this.get(ja.RESOLUTION)!==r&&(this.set(ja.RESOLUTION,r),this.set("zoom",this.getZoom(),!0)),o&&this.get(ja.CENTER)&&ce(this.get(ja.CENTER),o)||this.set(ja.CENTER,o),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=void 0!==t?t:200;const n=e||0,s=this.constraints_.rotation(this.targetRotation_),r=this.getViewportSize_(s),o=this.constraints_.resolution(this.targetResolution_,n,r),a=this.constraints_.center(this.targetCenter_,o,r,!1,this.calculateCenterShift(this.targetCenter_,o,s,r));if(0===t&&!this.cancelAnchor_)return this.targetResolution_=o,this.targetRotation_=s,this.targetCenter_=a,void this.applyTargetState_();i=i||(0===t?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===o&&this.getRotation()===s&&this.getCenterInternal()&&ce(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:a,resolution:o,duration:t,easing:$a,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Ot,1)}endInteraction(t,e,i){i=i&&Di(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(Ot,-1),this.resolveConstraints(t,e,i))}getConstrainedCenter(t,e){const i=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),i)}getConstrainedZoom(t,e){const i=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(i,e))}getConstrainedResolution(t,e){e=e||0;const i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,i)}},kl="opacity",Fl="visible",Ol="extent",Pl="zIndex",Dl="maxResolution",Wl="minResolution",Gl="maxZoom",zl="minZoom",Bl="source",Nl="map";const Yl=class extends wt{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);"object"==typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[kl]=void 0!==t.opacity?t.opacity:1,Rt("number"==typeof e[kl],"Layer opacity must be a number"),e[Fl]=void 0===t.visible||t.visible,e[Pl]=t.zIndex,e[Dl]=void 0!==t.maxResolution?t.maxResolution:1/0,e[Wl]=void 0!==t.minResolution?t.minResolution:0,e[zl]=void 0!==t.minZoom?t.minZoom:-1/0,e[Gl]=void 0!==t.maxZoom?t.maxZoom:1/0,this.className_=void 0!==e.className?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:void 0===t||t},i=this.getZIndex();return e.opacity=ze(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i||e.managed?i:1/0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return yt()}getLayerStatesArray(t){return yt()}getExtent(){return this.get(Ol)}getMaxResolution(){return this.get(Dl)}getMinResolution(){return this.get(Wl)}getMinZoom(){return this.get(zl)}getMaxZoom(){return this.get(Gl)}getOpacity(){return this.get(kl)}getSourceState(){return yt()}getVisible(){return this.get(Fl)}getZIndex(){return this.get(Pl)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Ol,t)}setMaxResolution(t){this.set(Dl,t)}setMinResolution(t){this.set(Wl,t)}setMaxZoom(t){this.set(Gl,t)}setMinZoom(t){this.set(zl,t)}setOpacity(t){Rt("number"==typeof t,"Layer opacity must be a number"),this.set(kl,t)}setVisible(t){this.set(Fl,t)}setZIndex(t){this.set(Pl,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}};const Xl=class extends Yl{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(Bl,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return(t=t||[]).push(this),t}getLayerStatesArray(t){return(t=t||[]).push(this.getLayerState()),t}getSource(){return this.get(Bl)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),this.sourceReady_||"ready"!==this.getSource().getState()||(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(pt(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=gt(t,Q,this.handleSourceChange_,this),"ready"===t.getState()&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();let n;if(!t&&i&&(t=i.getView()),e=t instanceof Al?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),e.layerStatesArray){if(n=e.layerStatesArray.find(t=>t.layer===this),!n)return!1}else n=this.getLayerState();const s=this.getExtent();return function(t,e){if(!t.visible)return!1;const i=e.resolution;if(i<t.minResolution||i>=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}(n,e.viewState)&&(!s||oe(s,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let i=e(t instanceof Al?t.getViewStateAndExtent():t);return Array.isArray(i)||(i=[i]),i}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(Nl,t)}getMapInternal(){return this.get(Nl)}setMap(t){this.mapPrecomposeKey_&&(pt(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(pt(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=gt(t,Zi,this.handlePrecompose_,this),this.mapRenderKey_=gt(this,Q,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);Rt(!e.some(t=>t.layer===i.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set(Bl,t)}getRenderer(){return this.renderer_||(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()}},Vl="renderOrder";const Zl=class extends Xl{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=void 0!==t.renderBuffer?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=void 0!==t.updateWhileAnimating&&t.updateWhileAnimating,this.updateWhileInteracting_=void 0!==t.updateWhileInteracting&&t.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Vl)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();i in t.declutter==!1&&(t.declutter[i]=new wr(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Vl,t)}setStyle(t){this.style_=void 0===t?ya:t;const e=function(t){if(void 0===t)return ya;if(!t)return null;if("function"==typeof t)return t;if(t instanceof Sa)return t;if(!Array.isArray(t))return Ma([t]);if(0===t.length)return[];const e=t.length,i=t[0];if(i instanceof Sa){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!(e instanceof Sa))throw new Error("Expected a list of style instances");i[n]=e}return i}if("style"in i){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!("style"in e))throw new Error("Expected a list of rules with a style property");i[n]=e}return Ia(i)}const n=t;return Ma(n)}(t);this.styleFunction_=null===t?void 0:function(t){let e;if("function"==typeof t)e=t;else{let i;Array.isArray(t)?i=t:(Rt("function"==typeof t.getZIndex,"Expected an `Style` or an array of `Style`"),i=[t]),e=function(){return i}}return e}(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}};const jl=class extends Zl{constructor(t){super(t)}createRenderer(){return new yr(this)}},Kl="active";const ql=class extends wt{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(Kl)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Kl,t)}setMap(t){this.map_=t}},$l="select";class Hl extends ut{constructor(t,e,i,n){super(t),this.selected=e,this.deselected=i,this.mapBrowserEvent=n}}const Ul={};class Jl extends ql{constructor(t){let e;if(super(),this.on,this.once,this.un,t=t||{},this.boundAddFeature_=this.addFeature_.bind(this),this.boundRemoveFeature_=this.removeFeature_.bind(this),this.condition_=t.condition?t.condition:At,this.addCondition_=t.addCondition?t.addCondition:Lt,this.removeCondition_=t.removeCondition?t.removeCondition:Lt,this.toggleCondition_=t.toggleCondition?t.toggleCondition:kt,this.multi_=!!t.multi&&t.multi,this.filter_=t.filter?t.filter:at,this.hitTolerance_=t.hitTolerance?t.hitTolerance:0,this.style_=void 0!==t.style?t.style:function(){const t=function(){const t={},e=[255,255,255,1],i=[0,153,255,1];return t.Polygon=[new _a({fill:new ga({color:[255,255,255,.5]})})],t.MultiPolygon=t.Polygon,t.LineString=[new _a({stroke:new pa({color:e,width:5})}),new _a({stroke:new pa({color:i,width:3})})],t.MultiLineString=t.LineString,t.Circle=t.Polygon.concat(t.LineString),t.Point=[new _a({image:new ua({radius:6,fill:new ga({color:i}),stroke:new pa({color:e,width:1.5})}),zIndex:1/0})],t.MultiPoint=t.Point,t.GeometryCollection=t.Polygon.concat(t.LineString,t.Point),t}();return rt(t.Polygon,t.LineString),rt(t.GeometryCollection,t.LineString),function(e){return e.getGeometry()?t[e.getGeometry().getType()]:null}}(),this.features_=t.features||new Mt,t.layers)if("function"==typeof t.layers)e=t.layers;else{const i=t.layers;e=function(t){return i.includes(t)}}else e=at;this.layerFilter_=e,this.featureLayerAssociation_={}}addFeatureLayerAssociation_(t,e){this.featureLayerAssociation_[St(t)]=e}getFeatures(){return this.features_}getHitTolerance(){return this.hitTolerance_}getLayer(t){return this.featureLayerAssociation_[St(t)]}setHitTolerance(t){this.hitTolerance_=t}setMap(t){this.getMap()&&this.style_&&this.features_.forEach(this.restorePreviousStyle_.bind(this)),super.setMap(t),t?(this.features_.addEventListener(H,this.boundAddFeature_),this.features_.addEventListener(U,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(H,this.boundAddFeature_),this.features_.removeEventListener(U,this.boundRemoveFeature_))}addFeature_(t){const e=t.element;if(this.style_&&this.applySelectedStyle_(e),!this.getLayer(e)){const t=this.getMap().getAllLayers().find(function(t){if(t instanceof jl&&t.getSource()&&t.getSource().hasFeature(e))return t});t&&this.addFeatureLayerAssociation_(e,t)}}removeFeature_(t){this.style_&&this.restorePreviousStyle_(t.element)}getStyle(){return this.style_}applySelectedStyle_(t){const e=St(t);e in Ul||(Ul[e]=t.getStyle()),t.setStyle(this.style_)}restorePreviousStyle_(t){const e=this.getMap().getInteractions().getArray();for(let i=e.length-1;i>=0;--i){const n=e[i];if(n!==this&&n instanceof Jl&&n.getStyle()&&-1!==n.getFeatures().getArray().lastIndexOf(t))return void t.setStyle(n.getStyle())}const i=St(t);t.setStyle(Ul[i]),delete Ul[i]}removeFeatureLayerAssociation_(t){delete this.featureLayerAssociation_[St(t)]}handleEvent(t){if(!this.condition_(t))return!0;const e=this.addCondition_(t),i=this.removeCondition_(t),n=this.toggleCondition_(t),s=!e&&!i&&!n,r=t.map,o=this.getFeatures(),a=[],l=[];if(s){ht(this.featureLayerAssociation_),r.forEachFeatureAtPixel(t.pixel,(t,e)=>{if(t instanceof bt&&this.filter_(t,e))return this.addFeatureLayerAssociation_(t,e),l.push(t),!this.multi_},{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let t=o.getLength()-1;t>=0;--t){const e=o.item(t),i=l.indexOf(e);i>-1?l.splice(i,1):(o.remove(e),a.push(e))}0!==l.length&&o.extend(l)}else{r.forEachFeatureAtPixel(t.pixel,(t,s)=>{if(t instanceof bt&&this.filter_(t,s))return!e&&!n||o.getArray().includes(t)?(i||n)&&o.getArray().includes(t)&&(a.push(t),this.removeFeatureLayerAssociation_(t)):(this.addFeatureLayerAssociation_(t,s),l.push(t)),!this.multi_},{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let t=a.length-1;t>=0;--t)o.remove(a[t]);o.extend(l)}return(l.length>0||a.length>0)&&this.dispatchEvent(new Hl($l,l,a,t)),!0}}const Ql=Jl;var th=v(4275),eh=v(5327),ih=v.n(eh);const nh="postrender";const sh=class extends wt{constructor(t){super();const e=t.element;!e||t.target||e.style.pointerEvents||(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let t=0,e=this.listenerKeys.length;t<e;++t)pt(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=t,t){const e=this.target_??t.getOverlayContainerStopEvent();this.element&&e.appendChild(this.element),this.render!==lt&&this.listenerKeys.push(gt(t,nh,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_="string"==typeof t?document.getElementById(t):t}},rh={POINT:"Point",LINE:"LineString",POLYGON:"Polygon",CIRCLE:"Circle"};function oh(t){return t>90||t<-90?t/1e5:t}function ah(t){return t>180||t<-180?t/1e5:t}function lh(t,e){const i=.017453292519943295,n=Math.cos,s=oh(t.latitude),r=oh(e.latitude),o=ah(t.longitude),a=ah(e.longitude),l=.5-n((r-s)*i)/2+n(s*i)*n(r*i)*(1-n((a-o)*i))/2;return Math.round(12742*Math.asin(Math.sqrt(l))*1e3)}function hh(t){let e=0;return t.forEach((i,n)=>{void 0!==t[n+1]&&(e+=lh(i,t[n+1]))}),e}class ch{layerWrapper=null;featureBuilder=null;modifyWrapper=null;overlayWrapper=null;layerWrapper=null;contextMenuWrapper=null;selectWrapper=null;drawWrappers=[];mapControls=[];constructor(){}getLayerWrapper(){return this.layerWrapper}getModifyWrapper(){return this.modifyWrapper}getOverlayWrapper(){return this.overlayWrapper}getDrawWrappers(){return this.drawWrappers}getSelectWrapper(){return this.selectWrapper}getContextMenuWrapper(){return this.contextMenuWrapper}getMapControls(){return this.mapControls}includeModify(t){if(!this.layerWrapper)throw new Error("LayerWrapper is null");this.modifyWrapper=new Rh({...t,source:this.layerWrapper.getSource()})}includeSelect(t){if(!this.layerWrapper)throw new Error("LayerWrapper is null");this.selectWrapper=new Mh({...t,layerWrapper:this.layerWrapper})}includeOverlay(t){this.overlayWrapper=new vh({...t})}includeDraw(t,e){t.source=this.layerWrapper.getSource(),e===rh.CIRCLE?this.drawWrappers.push(new Th(t)):e===rh.POLYGON&&this.drawWrappers.push(new bh(t))}includeControl(t){this.mapControls.push(new Ah(t))}includeContextMenu(t){this.contextMenuWrapper=new Fh(t)}setData(t,e=!1){this.featureBuilder&&(this.layerWrapper.removeAllFeatures(e),this.addData(t))}addData(t){if(this.featureBuilder){const e=this.featureBuilder.create(t);this.layerWrapper.addFeatures(Array.isArray(e)?e:[e])}}getDrawWrapperByType(t){return this.drawWrappers.find(e=>e.options.type===t)}setFeatureCoordinates(t,e){if(this.featureBuilder){const i=this.layerWrapper.getFeatureById(t);i&&this.featureBuilder.setCoordinate(i,e)}}setFeatureStyle(t,e){if(this.featureBuilder){const i=this.layerWrapper.getFeatureById(t);i&&this.featureBuilder.setStyle(i,e)}}}class uh extends ch{constructor(t){super(),this.layerWrapper=new fh(t)}}class dh extends ch{constructor(t){super(),this.layerWrapper=new ph(t)}}class gh{map=null;tileLayer=null;mapEvents={};options={hitTolerance:10};static EVENTS={CLICK:"click",SINGLECLICK:"singleclick",MOVEEND:"moveend",POINTERMOVE:"pointermove"};constructor(t=null,e={}){t&&this.init(t,e)}init(t,e={}){const i={zoom:e.zoom?e.zoom:4,center:(0,E.fromLonLat)(e.center?e.center:[0,0])},n={source:new b.OSM({})};this.tileLayer=new(L())(n);const s={target:t,layers:[this.tileLayer],view:new(R())(i)};this.map=new(I())(s),this.initEvents(),this.options.hitTolerance=void 0!==e.hitTolerance?e.hitTolerance:10}initEvents(){for(const t in gh.EVENTS)this.map.on(gh.EVENTS[t],e=>this.#t(gh.EVENTS[t],e))}getMap(){return this.map}getTileLayer(){return this.tileLayer}getViewPortCoordinates(){return this.map.getView().calculateExtent(this.map.getSize())}getViewCenter(){return(0,E.transform)(this.map.getView().getCenter(),"EPSG:3857","EPSG:4326")}addLayer(t){console.log(t.getLayer()),this.map.addLayer(t.getLayer())}removeLayer(t){this.map.removeLayer(t.getLayer())}addOverlay(t){t&&t.getOverlay()&&this.map.addOverlay(t.getOverlay())}addControl(t){t&&t.getControl()&&this.map.addControl(t.getControl())}addInteraction(t){t&&t.getInteraction()&&this.map.addInteraction(t.getInteraction())}getFeatureFromPixel(t){return this.map.forEachFeatureAtPixel(t,t=>t)}getLayerFromPixel(t){return this.map.forEachFeatureAtPixel(t,(t,e)=>e)}getZoomLevel(){return this.map.getView().getZoom()}fitToLayer(t,e={}){if(t.getSource().getFeatures().length>0){const i={size:this.map.getSize(),maxZoom:e.zoom?e.zoom:20,padding:e.padding?e.padding:[30,30,30,30],duration:e.duration?e.duration:0},n=t.getSource().getExtent();this.map.getView().fit(n,i)}}fitToFeature(t,e={}){const i={size:this.map.getSize(),maxZoom:e.zoom?e.zoom:20,padding:e.padding?e.padding:[20,20,20,20],duration:e.duration?e.duration:0},n=t.getGeometry().getExtent();this.map.getView().fit(n,i)}on(t,e){this.mapEvents.hasOwnProperty(t)?this.mapEvents[t].push(e):this.mapEvents[t]=[e]}off(t,e){this.mapEvents.hasOwnProperty(t)&&(this.mapEvents[t]=this.mapEvents[t].filter(t=>t!==e))}#t(t,e){this.mapEvents.hasOwnProperty(t)&&this.mapEvents[t].forEach(t=>{void 0!==e.pixel?this.map.forEachFeatureAtPixel(e.pixel,(i,n)=>{setTimeout(t(i,n,e),1)},{hitTolerance:this.options.hitTolerance}):setTimeout(t(e),1)})}addProcessor(t){this.addLayer(t.getLayerWrapper()),this.addInteraction(t.getModifyWrapper()),this.addOverlay(t.getOverlayWrapper()),this.addControl(t.getContextMenuWrapper()),this.addInteraction(t.getSelectWrapper()),t.drawWrappers.forEach(t=>this.addInteraction(t)),t.getMapControls().forEach(t=>this.addControl(t))}}class fh{layer=null;source=null;sourceEvents={};static EVENTS={ADD_FEATURE:"addfeature"};constructor(t={}){this.source=new(k())({wrapX:!1});const e={name:t?.name??"Layer",style:t?.style??new Y.Style,zIndex:t?.zIndex??1,opacity:t?.opacity??1,source:this.source};t.useVectorImage?this.layer=new(O())(e):this.layer=new(D())(e),this.initEvents()}initEvents(){for(const t in fh.EVENTS)this.source.on(fh.EVENTS[t],e=>this.#t(fh.EVENTS[t],e))}addFeatures(t){this.source.addFeatures(t)}addFeature(t){this.source.addFeature(t)}removeAllFeatures(t=!1){this.source.clear(t)}removeFeatures(t){this.source.removeFeatures(t)}removeFeature(t){this.source.removeFeature(t)}removeFeatureById(t){const e=this.getFeatureById(t);e&&this.removeFeature(e)}removeFeaturesByProperty(t,e){this.removeFeatures(this.getFeaturesByProperty(t,e))}getFeatureById(t){return this.source.getFeatureById(t)}getFeaturesByProperty(t,e){const i=[];return this.source.getFeatures.forEach(n=>{n.get("properties")[t]===e&&i.push(n)}),i}getAllFeatures(){return this.source.getFeatures()}getLayer(){return this.layer}getSource(){return this.source}getName(){return this.layer.get("name")}show(){this.layer.setVisible(!0)}hide(){this.layer.setVisible(!1)}setStyle(t){this.layer.setStyle(t)}on(t,e){this.sourceEvents.hasOwnProperty(t)?this.sourceEvents[t].push(e):this.sourceEvents[t]=[e]}off(t,e){this.sourceEvents.hasOwnProperty(t)&&(this.sourceEvents[t]=this.sourceEvents[t].filter(t=>t!==e))}#t(t,e){this.sourceEvents.hasOwnProperty(t)&&this.sourceEvents[t].forEach(t=>{setTimeout(t(e),1)})}}class ph extends fh{cluster=null;constructor(t){super(t);const e={source:this.source,distance:t?.distance??50};this.cluster=new b.Cluster(e);const i={name:t?.name??"ClusterLayer",style:t?.style??new Y.Style,zIndex:t?.zIndex??1,animationDuration:t?.animationDuration??200,options:t?.opacity??1,source:this.cluster};this.layer=new(G())(i),console.log(this.source)}setDistance(t){this.cluster.setDistance(t)}}class _h{options={style:null,idKey:null,nestedKey:null};constructor(t={}){this.options.style=void 0!==t.style?t.style:null,this.options.idKey=void 0!==t.idKey?t.idKey:null,this.options.nestedKey=void 0!==t.nestedKey?t.nestedKey:null}getOLCoordinate(t){const e=ah(t.longitude),i=oh(t.latitude);return(0,E.fromLonLat)([e,i])}setId(t,e,i){this.options.idKey?t.setId(i[this.options.idKey]):void 0!==e.id?t.setId(e.id):void 0!==i.id&&t.setId(i.id)}setStyle(t,e=null){t.setStyle(e??this.options?.style??null)}setCoordinate(t,e){t.getGeometry().setCoordinates(this.getOLCoordinate(e))}createFeatures(t){return t.map(t=>this.createFeature(t))}createFeature(t){throw new Error("Method is not implemented")}}class mh extends _h{constructor(t={}){super(t)}createFeature(t){const e=this.options.nestedKey?t[this.options.nestedKey]:t,i=this.getOLCoordinate(e),n={geometry:new z.Point(i)},s=new(N())(n);return s.set("properties",t),this.setId(s,e,t),this.setStyle(s,t?.style??null),s}create(t){return Array.isArray(t)?this.createFeatures(t):this.createFeature(t)}}class yh extends _h{constructor(t={}){super(t)}parsePoints(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i].coordinate;e.push(this.getOLCoordinate(n))}return[e]}createFeature(t){console.log(t);const e=this.parsePoints(t.points),i={geometry:new z.Polygon(e)},n=new(N())(i);return n.set("properties",t),this.setId(n,t,t),this.setStyle(n,t?.style??null),n}create(t){return Array.isArray(t)?this.createFeatures(t):this.createFeature(t)}}class xh extends _h{constructor(t={}){super(t)}createFeature(t){const e=this.options.nestedKey?t[this.options.nestedKey]:t,i=this.getOLCoordinate(e);console.log(i);const n={geometry:new z.Circle(i,t.radius)},s=new(N())(n);return s.set("properties",t),this.setId(s,e,t),this.setStyle(s,t?.style??null),s}create(t){return Array.isArray(t)?this.createFeatures(t):this.createFeature(t)}}class Sh extends _h{constructor(t={}){super(t)}parsePoints(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i].coordinate;e.push(this.getOLCoordinate(n))}return e}createFeature(t){const e=this.parsePoints(t.points),i={geometry:new z.LineString(e)},n=new(N())(i);return n.set("properties",t),this.setId(n,t,t),this.setStyle(n,t?.style??null),n}create(t){return Array.isArray(t)?this.createFeatures(t):this.createFeature(t)}}class vh{overlay=null;constructor(t={}){const e={element:document.getElementById(void 0!==t.element?t.element:null),offset:void 0!==t.offset?t.offset:[0,-30],positioning:"bottom-center"};this.overlay=new(V())(e)}getOverlay(){return this.overlay}setPositionByFeature(t){if(t){let e=t.getGeometry().getExtent();this.overlay.setPosition((0,Z.getCenter)(e))}else this.overlay.setPosition(void 0)}setContent(t){element.innerHTML=t}show(t,e){void 0!==e&&this.setContent(e),void 0!==t&&this.setPositionByFeature(t)}hide(){this.overlay.setPosition(void 0)}}function wh(t){return{latitude:(t[0].latitude+t[1].latitude)/2,longitude:(t[0].longitude+t[1].longitude)/2}}function Ch(t){const e={latitude:0,longitude:0},i=t.length;for(let n=0;n<i;n++){let i=t[n];e.latitude+=i.latitude,e.longitude+=i.longitude}return e.latitude/=i,e.longitude/=i,e}class Ih{interaction=null;constructor(){}setActive(t){this.interaction.setActive(t)}getInteraction(){return this.interaction}_parseCircleCoordinates(t){const e=t.getGeometry().getCenter(),i=t.getGeometry().getRadius(),n=(0,E.toLonLat)(e);return{longitude:n[0].toFixed(5),latitude:n[1].toFixed(5),radius:i}}_parsePointCoordinates(t){const e=(0,E.toLonLat)(t.getGeometry().getCoordinates());return{longitude:e[0].toFixed(5),latitude:e[1].toFixed(5),id:t.getId()}}_parsePolygonCoordinates(t){const e=t.getGeometry().getCoordinates()[0],i=[];for(let t=0,n=e.length;t<n;t++){const n=(0,E.toLonLat)(e[t]);i.push({longitude:n[0].toFixed(5),latitude:n[1].toFixed(5),order:t+1})}return{id:t.getId(),points:i}}_parseLSCoordinates(t){const e=t.getGeometry().getCoordinates();if(!this.options.editFirstAndLastPoint){const i=e[0],n=e[e.length-1],s=this.oldCoordinates[0],r=this.oldCoordinates[this.oldCoordinates.length-1];if(i[0]!==s[0]||i[1]!==s[1]||n[0]!==r[0]||n[1]!==r[1])return t.getGeometry().setCoordinates(this.oldCoordinates),void(this.oldCoordinates=null)}return{id:t.getId(),points:e.map((t,e)=>{const i=(0,E.toLonLat)(t);return{order:e+1,longitude:+(1e5*i[0]).toFixed(0),latitude:+(1e5*i[1]).toFixed(0)}})}}}class Mh extends Ih{options={layerWrapper:null,style:null,hitTolerance:5,selectedHandler:null,deselectedHandler:null,alwaysOneSelected:!1,active:!1};lastSelectedId=null;constructor(t){super(),this.options=t;const e={layers:this.options.layerWrapper?[this.options.layerWrapper.getLayer()]:[],style:this.options.style,hitTolerance:this.options?.hitTolerance??5,condition:this.options?.condition??th.singleClick};this.options.alwaysOneSelected&&(e.toggleCondition=ol.events.condition.never,e.filter=t=>null===this.lastSelectedId||(t.getId()===this.lastSelectedId||null===this.lastSelectedId)),this.interaction=new Ql(e),this.interaction.on("select",this.#e.bind(this)),this.setActive(this.options?.active??!1)}getSelectedFeatures(){return this.interaction.getFeatures()}clear(){this.interaction.getFeatures().clear(),this.lastSelectedId=null}addFeatures(t){this.interaction.getFeatures().push(...t)}#e(t){console.log(t),this.options.deselectedHandler&&(t.deselected.length>0?this.options.deselected(t,t.deselected[0].get("properties")):this.options.deselected(t,null)),this.options.selectedHandler&&(t.selected.length>0?(this.options.selected(t,t.selected[0].get("properties")),void 0!==this.options.alwaysOneSelected&&this.options.alwaysOneSelected&&(this.lastSelectedId=t.selected[0].getId())):(this.options.selected(e,null),void 0!==this.options.alwaysOneSelected&&this.options.alwaysOneSelected&&this.interaction.getFeatures().push(t.deselected[0])))}}class Rh extends Ih{options={source:null,features:[],startModifyHandler:null,endModifyHandler:null,hitDteection:null,style:null,alwaysOneFeature:!0,editFirstAndLastPoint:!1};oldCoordinates=null;constructor(t){super(),this.options=t;const e={source:this.options.source,features:this.options.features,hitDetection:this.options.hitDetection??10,style:this.options.style,active:this.options.active??!1,deleteCondition:th.shiftKeyOnly};this.options.editFirstAndLastPoint||(e.vertexFilter=(t,e)=>{if(console.log(e),e.getType()===rh.LINE){const i=e.getCoordinates(),n=t[0]===i[0][0]&&t[1]===i[0][1],s=t[0]===i[i.length-1][0]&&t[1]===i[i.length-1][1];return!(n||s)}return!0}),this.interaction=new(K())(e),this.interaction.on("modifystart",this.#i.bind(this)),this.interaction.on("modifyend",this.#n.bind(this)),this.setActive(!1)}#n(t){const e=t.features.getArray();this.options.endModifyHandler&&this.options.endModifyHandler(this.#s(e),e)}#i(t){const e=t.features.getArray()[0].getGeometry().getCoordinates();this.oldCoordinates=e,this.options.startModifyHandler&&this.options.startModifyHandler(t)}#s(t){if(!this.options.alwaysOneFeature)return t.map(t=>{let e=t.getGeometry().getCoordinates();return e.length>=2&&Array.isArray(e[0])?this._parseLSCoordinates(t):1===e.length?this._parsePolygonCoordinates(t):this._parsePointCoordinates(t)});{const e=t[0],i=e.getGeometry().getCoordinates();for(let e=1;e<t.length;e++){const i=t[e],n=i.get("properties").coordinate,s=(0,E.fromLonLat)([+n.longitude,+n.latitude]);i.getGeometry().setCoordinates(s)}if(i.length>=2&&Array.isArray(i[0]))return[this._parseLSCoordinates(e)];if(1!==i.length)return[this._parsePointCoordinates(e)];this._parsePolygonCoordinates(e)}}}class Eh extends Ih{options={source:null,style:null,type:null,endDrawHandler:null,startDrawHandler:null,active:!1};constructor(t=null){super(),this.options=t;const e={source:this.options.source,style:this.options.style,type:this.options.type,active:this.options?.active??!1};this.interaction=new($())(e),this.interaction.on("drawend",this.drawEndEvent.bind(this)),this.interaction.on("drawstart",this.drawStartEvent.bind(this)),this.setActive(!1)}drawEndEvent(){throw new Error("Not implemented method")}drawStartEvent(){this.options.startDrawHandler&&this.options.startDrawHandler()}}class bh extends Eh{constructor(t){t.type=rh.POLYGON,super(t)}drawEndEvent(t){if(this.options.endDrawHandler){const e=t.feature;this.options.endDrawHandler(this._parsePolygonCoordinates(e),rh.POLYGON,t.feature)}}}class Th extends Eh{constructor(t){t.type=rh.CIRCLE,super(t)}drawEndEvent(t){if(this.options.endDrawHandler){const e=t.feature;this.options.endDrawHandler(this._parseCircleCoordinates(e),rh.CIRCLE,t.feature)}}}class Lh{control=null;getControl(){return this.control}}class Ah extends Lh{constructor(t){super();const e=document.createElement("button");e.innerHTML=t?.text??"*";const i=document.createElement("div");i.className="ol-unselectable ol-control "+(t?.className??""),i.appendChild(e),t.clickHandler&&i.addEventListener("click",t.clickHandler.bind(this),!1),this.control=new sh({element:i})}}class kh{text=null;classname=null;callback=null;icon=null;items=null;constructor(){return this}setText(t){return this.text=t,this}setClassName(t){return this.classname=t,this}setCallback(t){return this.callback=t,this}setIcon(t){return this.icon=t,this}setItems(t){return this.items=t,this}addItem(t){return this.items||(this.items=[]),this.items.push(t),this}}class Fh extends Lh{options={items:[],defaultItems:!1,width:null};constructor(t){super(),this.options=t,this.coordinates=null;const e={items:this.options?.items??[],defaultItems:this.options?.defaultItems??!1,width:this.options?.width??170};this.control=new(ih())(e)}addItems(t){this.control.extend(t)}addItem(t){this.control.push(t)}removeItems(){this.control.clear()}removeLastItem(){this.control.pop()}}return w})());
|