Agriculture-front-end/dist/assets/Modify.2dbbb3e0.js

2 lines
178 KiB
JavaScript

import{Q as t}from"./index.e5c8b0d6.js";import{R as e}from"./index.030fe210.js";const i={1:"The view center is not defined",2:"The view resolution is not defined",3:"The view rotation is not defined",4:"`image` and `src` cannot be provided at the same time",5:"`imgSize` must be set when `image` is provided",7:"`format` must be set when `url` is set",8:"Unknown `serverType` configured",9:"`url` must be configured or set using `#setUrl()`",10:"The default `geometryFunction` can only handle `Point` geometries",11:"`options.featureTypes` must be an Array",12:"`options.geometryName` must also be provided when `options.bbox` is set",13:"Invalid corner",14:"Invalid color",15:"Tried to get a value for a key that does not exist in the cache",16:"Tried to set a value for a key that is used already",17:"`resolutions` must be sorted in descending order",18:"Either `origin` or `origins` must be configured, never both",19:"Number of `tileSizes` and `resolutions` must be equal",20:"Number of `origins` and `resolutions` must be equal",22:"Either `tileSize` or `tileSizes` must be configured, never both",24:"Invalid extent or geometry provided as `geometry`",25:"Cannot fit empty extent provided as `geometry`",26:"Features must have an id set",27:"Features must have an id set",28:'`renderMode` must be `"hybrid"` or `"vector"`',30:"The passed `feature` was already added to the source",31:"Tried to enqueue an `element` that was already added to the queue",32:"Transformation matrix cannot be inverted",33:"Invalid units",34:"Invalid geometry layout",36:"Unknown SRS type",37:"Unknown geometry type found",38:"`styleMapValue` has an unknown type",39:"Unknown geometry type",40:"Expected `feature` to have a geometry",41:"Expected an `ol/style/Style` or an array of `ol/style/Style.js`",42:"Question unknown, the answer is 42",43:"Expected `layers` to be an array or a `Collection`",47:"Expected `controls` to be an array or an `ol/Collection`",48:"Expected `interactions` to be an array or an `ol/Collection`",49:"Expected `overlays` to be an array or an `ol/Collection`",50:"`options.featureTypes` should be an Array",51:"Either `url` or `tileJSON` options must be provided",52:"Unknown `serverType` configured",53:"Unknown `tierSizeCalculation` configured",55:"The {-y} placeholder requires a tile grid with extent",56:"mapBrowserEvent must originate from a pointer event",57:"At least 2 conditions are required",59:"Invalid command found in the PBF",60:"Missing or invalid `size`",61:"Cannot determine IIIF Image API version from provided image information JSON",62:"A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`",64:"Layer opacity must be a number",66:"`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has not been enabled. This is done by providing adequate shaders using the `hitVertexShader` and `hitFragmentShader` properties of `WebGLPointsLayerRenderer`",67:"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both",68:"A VectorTile source can only be rendered if it has a projection compatible with the view projection",69:"`width` or `height` cannot be provided together with `scale`"};class n extends Error{constructor(t){const e=i[t];super(e),this.code=t,this.name="AssertionError",this.message=e}}const s=n;function o(t,e){if(!t)throw new s(e)}const r=0,a=1,h=2,l=4,c=8,u=16;function d(t){const e=y();for(let i=0,n=t.length;i<n;++i)R(e,t[i]);return e}function g(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 f(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 _(t,e){return p(t,e[0],e[1])}function m(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function p(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function x(t,e){const i=t[0],n=t[1],s=t[2],o=t[3],d=e[0],g=e[1];let f=r;return d<i?f|=u:d>s&&(f|=l),g<n?f|=c:g>o&&(f|=h),f===r&&(f=a),f}function y(){return[1/0,1/0,-1/0,-1/0]}function v(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 S(t){return v(1/0,1/0,-1/0,-1/0,t)}function C(t,e){const i=t[0],n=t[1];return v(i,n,i,n,e)}function w(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function R(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 I(t,e,i,n,s){for(;i<n;i+=s)M(t,e[i],e[i+1]);return t}function M(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 E(t){return[t[0],t[1]]}function T(t){return[t[2],t[1]]}function b(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function F(t,e,i,n,s){const[o,r,a,h,l,c,u,d]=function(t,e,i,n){const s=e*n[0]/2,o=e*n[1]/2,r=Math.cos(i),a=Math.sin(i),h=s*r,l=s*a,c=o*r,u=o*a,d=t[0],g=t[1];return[d-h+u,g-l-c,d-h-u,g-l+c,d+h-u,g+l+c,d+h+u,g+l-c,d-h+u,g-l-c]}(t,e,i,n);return v(Math.min(o,a,l,u),Math.min(r,h,c,d),Math.max(o,a,l,u),Math.max(r,h,c,d),s)}function k(t){return t[3]-t[1]}function A(t){return[t[0],t[3]]}function P(t){return[t[2],t[3]]}function L(t){return t[2]-t[0]}function D(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function O(t){return t[2]<t[0]||t[3]<t[1]}function G(t,e){const i=e.getExtent(),n=b(t);if(e.canWrapX()&&(n[0]<i[0]||n[0]>=i[2])){const e=L(i),s=Math.floor((n[0]-i[0])/e)*e;t[0]-=s,t[2]-=s}return t}const W="change",B="error",z="load";const N=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};const Y=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};function X(t,e){return t>e?1:t<e?-1:0}function V(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 s=1;s<n;++s){if(t[s]==e)return s;if(t[s]<e)return t[s-1]-e<e-t[s]?s-1:s}return n-1}function Z(t,e,i){for(;e<i;){const n=t[e];t[e]=t[i],t[i]=n,++e,--i}}function j(t,e){const i=Array.isArray(e)?e:[e],n=i.length;for(let s=0;s<n;s++)t[t.length]=i[s]}function U(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 q(){return!0}function K(){}function H(t){for(const e in t)delete t[e]}function J(t){let e;for(e in t)return!1;return!e}const Q=class extends N{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 Y(t):t;s.target||(s.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),r=this.pendingRemovals_||(this.pendingRemovals_={});let a;i in o||(o[i]=0,r[i]=0),++o[i];for(let h=0,l=n.length;h<l;++h)if(a="handleEvent"in n[h]?n[h].handleEvent(s):n[h].call(this,s),!1===a||s.propagationStopped){a=!1;break}if(0==--o[i]){let t=r[i];for(delete r[i];t--;)this.removeEventListener(i,K);delete o[i]}return a}disposeInternal(){this.listeners_&&H(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){const i=this.listeners_&&this.listeners_[t];if(i){const n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=K,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}}};function $(){throw new Error("Unimplemented abstract method.")}let tt=0;function et(t){return t.ol_uid||(t.ol_uid=String(++tt))}function it(t){return 1-function(t){return Math.pow(t,3)}(1-t)}function nt(t){return 3*t*t-2*t*t*t}const st="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"";st.includes("firefox");st.includes("safari")&&!st.includes("chrom")&&(st.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(st)),st.includes("webkit")&&st.includes("edge"),st.includes("macintosh");const ot="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,rt="undefined"!=typeof Image&&Image.prototype.decode;function at(t,e,i,n){let s;return s=i&&i.length?i.shift():ot?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(s.width=t),e&&(s.height=e),s.getContext("2d",n)}!function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch(e){}}();const ht=0,lt=1,ct=2,ut=3;function dt(t,e,i,n,s){if(n&&n!==t&&(i=i.bind(n)),s){const n=i;i=function(){t.removeEventListener(e,i),n.apply(this,arguments)}}const o={target:t,type:e,listener:i};return t.addEventListener(e,i),o}function gt(t,e,i,n){return dt(t,e,i,n,!0)}function ft(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),H(t))}const _t={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};const mt=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_||_t[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_}},pt=6378137,xt=Math.PI*pt,yt=[-xt,-xt,xt,xt],vt=[-180,-85,180,85],St=pt*Math.log(Math.tan(Math.PI/2));class Ct extends mt{constructor(t){super({code:t,units:"m",extent:yt,global:!0,worldExtent:vt,getPointResolution:function(t,e){return t/Math.cosh(e[1]/pt)}})}}const wt=[new Ct("EPSG:3857"),new Ct("EPSG:102100"),new Ct("EPSG:102113"),new Ct("EPSG:900913"),new Ct("http://www.opengis.net/def/crs/EPSG/0/3857"),new Ct("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Rt(t,e,i){const n=t.length;i=i>1?i:2,void 0===e&&(e=i>2?t.slice():new Array(n));for(let s=0;s<n;s+=i){e[s]=xt*t[s]/180;let i=pt*Math.log(Math.tan(Math.PI*(+t[s+1]+90)/360));i>St?i=St:i<-St&&(i=-St),e[s+1]=i}return e}function It(t,e,i){const n=t.length;i=i>1?i:2,void 0===e&&(e=i>2?t.slice():new Array(n));for(let s=0;s<n;s+=i)e[s]=180*t[s]/xt,e[s+1]=360*Math.atan(Math.exp(t[s+1]/pt))/Math.PI-90;return e}const Mt=[-180,-90,180,90],Et=6378137*Math.PI/180;class Tt extends mt{constructor(t,e){super({code:t,units:"degrees",extent:Mt,axisOrientation:e,global:!0,metersPerUnit:Et,worldExtent:Mt})}}const bt=[new Tt("CRS:84"),new Tt("EPSG:4326","neu"),new Tt("urn:ogc:def:crs:OGC:1.3:CRS84"),new Tt("urn:ogc:def:crs:OGC:2:84"),new Tt("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Tt("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Tt("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Ft={};let kt={};function At(t,e,i){const n=t.getCode(),s=e.getCode();n in kt||(kt[n]={}),kt[n][s]=i}function Pt(t,e,i){return Math.min(Math.max(t,e),i)}function Lt(t,e,i,n,s,o){const r=s-i,a=o-n;if(0!==r||0!==a){const h=((t-i)*r+(e-n)*a)/(r*r+a*a);h>1?(i=s,n=o):h>0&&(i+=r*h,n+=a*h)}return Dt(t,e,i,n)}function Dt(t,e,i,n){const s=i-t,o=n-e;return s*s+o*o}function Ot(t){return t*Math.PI/180}function Gt(t,e){const i=t%e;return i*e<0?i+e:i}function Wt(t,e,i){return t+i*(e-t)}function Bt(t,e){const i=t[0],n=t[1],s=e[0],o=e[1],r=s[0],a=s[1],h=o[0],l=o[1],c=h-r,u=l-a,d=0===c&&0===u?0:(c*(i-r)+u*(n-a))/(c*c+u*u||0);let g,f;return d<=0?(g=r,f=a):d>=1?(g=h,f=l):(g=r+d*c,f=a+d*u),[g,f]}function zt(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 Nt(t,e){const i=t[0]-e[0],n=t[1]-e[1];return i*i+n*n}function Yt(t,e){return Math.sqrt(Nt(t,e))}function Xt(t,e){if(e.canWrapX()){const i=L(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||L(n),s=Math.floor((t[0]-n[0])/i));return s}(t,e,i);n&&(t[0]-=n*i)}return t}const Vt=6371008.8;function Zt(t,e,i){i=i||Vt;const n=Ot(t[1]),s=Ot(e[1]),o=(s-n)/2,r=Ot(e[0]-t[0])/2,a=Math.sin(o)*Math.sin(o)+Math.sin(r)*Math.sin(r)*Math.cos(n)*Math.cos(s);return 2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function jt(t,e){let i=0;for(let n=0,s=t.length;n<s-1;++n)i+=Zt(t[n],t[n+1],e);return i}function Ut(t,e){const i=(e=e||{}).radius||Vt,n=e.projection||"EPSG:3857",s=t.getType();"GeometryCollection"!==s&&(t=t.clone().transform(n,"EPSG:4326"));let o,r,a,h,l,c,u=0;switch(s){case"Point":case"MultiPoint":break;case"LineString":case"LinearRing":o=t.getCoordinates(),u=jt(o,i);break;case"MultiLineString":case"Polygon":for(o=t.getCoordinates(),a=0,h=o.length;a<h;++a)u+=jt(o[a],i);break;case"MultiPolygon":for(o=t.getCoordinates(),a=0,h=o.length;a<h;++a)for(r=o[a],l=0,c=r.length;l<c;++l)u+=jt(r[l],i);break;case"GeometryCollection":{const i=t.getGeometries();for(a=0,h=i.length;a<h;++a)u+=Ut(i[a],e);break}default:throw new Error("Unsupported geometry type: "+s)}return u}function qt(t,e){let i=0;const n=t.length;let s=t[n-1][0],o=t[n-1][1];for(let r=0;r<n;r++){const e=t[r][0],n=t[r][1];i+=Ot(e-s)*(2+Math.sin(Ot(o))+Math.sin(Ot(n))),s=e,o=n}return i*e*e/2}function Kt(t,e){const i=(e=e||{}).radius||Vt,n=e.projection||"EPSG:3857",s=t.getType();"GeometryCollection"!==s&&(t=t.clone().transform(n,"EPSG:4326"));let o,r,a,h,l,c,u=0;switch(s){case"Point":case"MultiPoint":case"LineString":case"MultiLineString":case"LinearRing":break;case"Polygon":for(o=t.getCoordinates(),u=Math.abs(qt(o[0],i)),a=1,h=o.length;a<h;++a)u-=Math.abs(qt(o[a],i));break;case"MultiPolygon":for(o=t.getCoordinates(),a=0,h=o.length;a<h;++a)for(r=o[a],u+=Math.abs(qt(r[0],i)),l=1,c=r.length;l<c;++l)u-=Math.abs(qt(r[l],i));break;case"GeometryCollection":{const i=t.getGeometries();for(a=0,h=i.length;a<h;++a)u+=Kt(i[a],e);break}default:throw new Error("Unsupported geometry type: "+s)}return u}let Ht=!0;function Jt(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 Qt(t,e){if(void 0!==e&&t!==e){for(let i=0,n=t.length;i<n;++i)e[i]=t[i];t=e}return t}function $t(t){!function(t,e){Ft[t]=e}(t.getCode(),t),At(t,t,Jt)}function te(t){return"string"==typeof t?Ft[e=t]||Ft[e.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null:t||null;var e}function ee(t){!function(t){t.forEach($t)}(t),t.forEach((function(e){t.forEach((function(t){e!==t&&At(e,t,Jt)}))}))}function ie(t,e){return t?"string"==typeof t?te(t):t:te(e)}function ne(t,e){let i=function(t,e){let i;return t in kt&&e in kt[t]&&(i=kt[t][e]),i}(t.getCode(),e.getCode());return i||(i=Qt),i}function se(t,e){return ne(te(t),te(e))}function oe(t,e){return t}function re(t,e){return Ht&&!zt(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(Ht=!1),t}function ae(t,e){return t}function he(t,e){return t}var le,ce,ue;ee(wt),ee(bt),le=wt,ce=Rt,ue=It,bt.forEach((function(t){le.forEach((function(e){At(t,e,ce),At(e,t,ue)}))}));const de="propertychange";class ge extends Q{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(W)}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]=dt(this,t[s],e);return n}return dt(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]=gt(this,t[s],e)}else i=gt(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)ft(t[e]);else ft(t)}(i);else if(Array.isArray(t))for(let n=0,s=t.length;n<s;++n)this.removeEventListener(t[n],e);else this.removeEventListener(t,e)}}ge.prototype.on,ge.prototype.once,ge.prototype.un;const fe=ge;class _e extends Y{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}const me=class extends fe{constructor(t){super(),this.on,this.once,this.un,et(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_)||{}}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new _e(i,t,e)),i=de,this.hasListener(i)&&this.dispatchEvent(new _e(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],J(this.values_)&&(this.values_=null),e||this.notify(t,i)}}};function pe(t){return t?Array.isArray(t)?function(e){return t}:"function"==typeof t?t:function(e){return[t]}:null}const xe=class extends me{constructor(t){super(),this.projection=te(t.projection),this.attributions_=pe(t.attributions),this.attributionsCollapsible_=void 0===t.attributionsCollapsible||t.attributionsCollapsible,this.loading=!1,this.state_=void 0!==t.state?t.state:"ready",this.wrapX_=void 0!==t.wrapX&&t.wrapX,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise((function(t,i){e.viewResolver=t,e.viewRejector=i}))}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=pe(t),this.changed()}setState(t){this.state_=t,this.changed()}};function ye(t,e,i,n,s){let o;for(e+=n;e<i;e+=n)if(o=s(t.slice(e-n,e),t.slice(e,e+n)),o)return o;return!1}function ve(t,e,i,n,s){const o=function(t,e){let i;return i=e(E(t)),i||(i=e(T(t)),i||(i=e(P(t)),i||(i=e(A(t)),i||!1)))}(s,(function(s){return!Se(t,e,i,n,s[0],s[1])}));return!o}function Se(t,e,i,n,s,o){let r=0,a=t[i-n],h=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];h<=o?n>o&&(i-a)*(o-h)-(s-a)*(n-h)>0&&r++:n<=o&&(i-a)*(o-h)-(s-a)*(n-h)<0&&r--,a=i,h=n}return 0!==r}function Ce(t,e,i,n,s,o){if(0===i.length)return!1;if(!Se(t,e,i[0],n,s,o))return!1;for(let r=1,a=i.length;r<a;++r)if(Se(t,i[r-1],i[r],n,s,o))return!1;return!0}function we(t,e,i,n,s){const o=I([1/0,1/0,-1/0,-1/0],t,e,i,n);return!!D(s,o)&&(!!m(s,o)||(o[0]>=s[0]&&o[2]<=s[2]||(o[1]>=s[1]&&o[3]<=s[3]||ye(t,e,i,n,(function(t,e){return function(t,e,i){let n=!1;const s=x(t,e),o=x(t,i);if(s===a||o===a)n=!0;else{const r=t[0],a=t[1],d=t[2],g=t[3],f=e[0],_=e[1],m=i[0],p=i[1],x=(p-_)/(m-f);let y,v;o&h&&!(s&h)&&(y=m-(p-g)/x,n=y>=r&&y<=d),n||!(o&l)||s&l||(v=p-(m-d)*x,n=v>=a&&v<=g),n||!(o&c)||s&c||(y=m-(p-a)/x,n=y>=r&&y<=d),n||!(o&u)||s&u||(v=p-(m-r)*x,n=v>=a&&v<=g)}return n}(s,t,e)})))))}function Re(t,e,i,n,s){if(!function(t,e,i,n,s){return!!(we(t,e,i,n,s)||Se(t,e,i,n,s[0],s[1])||Se(t,e,i,n,s[0],s[3])||Se(t,e,i,n,s[2],s[1])||Se(t,e,i,n,s[2],s[3]))}(t,e,i[0],n,s))return!1;if(1===i.length)return!0;for(let o=1,r=i.length;o<r;++o)if(ve(t,i[o-1],i[o],n,s)&&!we(t,i[o-1],i[o],n,s))return!1;return!0}function Ie(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}class Me extends me{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 Me(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_&&(ft(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=dt(t,W,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{o("function"==typeof t.getZIndex,41);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 Ee=Me;function Te(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 be(t,e,i,n,s,o,r,a){const h=Math.sin(o),l=Math.cos(o);return t[0]=n*l,t[1]=s*h,t[2]=-n*h,t[3]=s*l,t[4]=r*n*l-a*n*h+e,t[5]=r*s*h+a*s*l+i,t}let Fe;function ke(t,e,i,n,s,o){o=o||[];let r=0;for(let a=e;a<i;a+=n){const e=t[a],i=t[a+1];o[r++]=s[0]*e+s[2]*i+s[4],o[r++]=s[1]*e+s[3]*i+s[5]}return o&&o.length!=r&&(o.length=r),o}function Ae(t,e,i,n,s,o,r){r=r||[];const a=Math.cos(s),h=Math.sin(s),l=o[0],c=o[1];let u=0;for(let d=e;d<i;d+=n){const e=t[d]-l,i=t[d+1]-c;r[u++]=l+e*a-i*h,r[u++]=c+e*h+i*a;for(let s=d+2;s<d+n;++s)r[u++]=t[s]}return r&&r.length!=u&&(r.length=u),r}new Array(6);const Pe=[1,0,0,1,0,0];const Le=class extends me{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,s=!1;return function(){const o=Array.prototype.slice.call(arguments);return s&&this===n&&U(o,i)||(s=!0,n=this,i=o,e=t.apply(this,arguments)),e}}((function(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 $()}closestPointXY(t,e,i,n){return $()}containsXY(t,e){const i=this.getClosestPoint([t,e]);return i[0]===t&&i[1]===e}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 $()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&S(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){$()}scale(t,e,i){$()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return $()}getType(){return $()}applyTransform(t){$()}intersectsExtent(t){return $()}translate(t,e){$()}transform(t,e){const i=te(t),n="tile-pixels"==i.getUnits()?function(t,n,s){const o=i.getExtent(),r=i.getWorldExtent(),a=k(r)/k(o);return be(Pe,r[0],r[3],a,-a,0,0,0),ke(t,0,t.length,s,Pe,n),se(i,e)(t,n,s)}:se(i,e);return this.applyTransform(n),this}};function De(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}const Oe=class extends Le{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates=null}computeExtent(t){return e=this.flatCoordinates,i=0,n=this.flatCoordinates.length,s=this.stride,I(S(t),e,i,n,s);var e,i,n,s}getCoordinates(){return $()}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=De(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){$()}setLayout(t,e,i){let n;if(t)n=De(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.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();Ae(i,0,i.length,n,t,e,i),this.changed()}}scale(t,e,i){void 0===e&&(e=t),i||(i=b(this.getExtent()));const n=this.getFlatCoordinates();if(n){const s=this.getStride();!function(t,e,i,n,s,o,r,a){a=a||[];const h=r[0],l=r[1];let c=0;for(let u=e;u<i;u+=n){const e=t[u]-h,i=t[u+1]-l;a[c++]=h+s*e,a[c++]=l+o*i;for(let s=u+2;s<u+n;++s)a[c++]=t[s]}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,o,r){r=r||[];let a=0;for(let h=e;h<i;h+=n){r[a++]=t[h]+s,r[a++]=t[h+1]+o;for(let e=h+2;e<h+n;++e)r[a++]=t[e]}r&&r.length!=a&&(r.length=a)}(i,0,i.length,n,t,e,i),this.changed()}}};function Ge(t,e,i,n){for(let s=0,o=i.length;s<o;++s){const o=i[s];for(let i=0;i<n;++i)t[e++]=o[i]}return e}class We extends Oe{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new We(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const s=this.flatCoordinates,o=Dt(t,e,s[0],s[1]);if(o<n){const t=this.stride;for(let e=0;e<t;++e)i[e]=s[e];return i.length=t,o}return n}getCoordinates(){return this.flatCoordinates?this.flatCoordinates.slice():[]}computeExtent(t){return C(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return p(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 Be=We,ze="add",Ne="remove",Ye="length";class Xe extends Y{constructor(t,e,i){super(t),this.element=e,this.index=i}}const Ve=class extends me{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t||[],this.unique_)for(let i=0,n=this.array_.length;i<n;++i)this.assertUnique_(this.array_[i],i);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(Ye)}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 Xe(ze,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 Xe(Ne,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 Xe(Ne,i,t)),this.dispatchEvent(new Xe(ze,e,t))}updateLength_(){this.set(Ye,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 s(58)}};const Ze=class{constructor(t){this.rbush_=new e(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[et(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,s=e.length;n<s;n++){const s=t[n],o=e[n],r={minX:s[0],minY:s[1],maxX:s[2],maxY:s[3],value:o};i[n]=r,this.items_[et(o)]=r}this.rbush_.load(i)}remove(t){const e=et(t),i=this.items_[e];return delete this.items_[e],null!==this.rbush_.remove(i)}update(t,e){const i=this.items_[et(e)];w([i.minX,i.minY,i.maxX,i.maxY],t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map((function(t){return t.value}))}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map((function(t){return t.value}))}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let n=0,s=t.length;n<s;n++)if(i=e(t[n]),i)return i;return i}isEmpty(){return J(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return v(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(const e in t.items_)this.items_[e]=t.items_[e]}},je="addfeature",Ue="changefeature",qe="clear",Ke="removefeature",He="featuresloadstart",Je="featuresloadend",Qe="featuresloaderror";function $e(t,e){return[[-1/0,-1/0,1/0,1/0]]}function ti(t,e){return function(i,n,s,o,r){const a=this;!function(t,e,i,n,s,o,r){const a=new XMLHttpRequest;a.open("GET","function"==typeof t?t(i,n,s):t,!0),"arraybuffer"==e.getType()&&(a.responseType="arraybuffer"),a.withCredentials=!1,a.onload=function(t){if(!a.status||a.status>=200&&a.status<300){const t=e.getType();let n;"json"==t||"text"==t?n=a.responseText:"xml"==t?(n=a.responseXML,n||(n=(new DOMParser).parseFromString(a.responseText,"application/xml"))):"arraybuffer"==t&&(n=a.response),n?o(e.readFeatures(n,{extent:i,featureProjection:s}),e.readProjection(n)):r()}else r()},a.onerror=r,a.send()}(t,e,i,n,s,(function(t,e){a.addFeatures(t),void 0!==o&&o(t)}),r||K)}}class ei extends Y{constructor(t,e,i){super(t),this.feature=e,this.features=i}}const ii=class extends xe{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.on,this.once,this.un,this.loader_=K,this.format_=t.format,this.overlaps_=void 0===t.overlaps||t.overlaps,this.url_=t.url,void 0!==t.loader?this.loader_=t.loader:void 0!==this.url_&&(o(this.format_,7),this.loader_=ti(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:$e;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,n;this.featuresRtree_=e?new Ze:null,this.loadedExtentsRtree_=new Ze,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(t.features)?n=t.features:t.features&&(i=t.features,n=i.getArray()),e||void 0!==i||(i=new Ve(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=et(t);if(!this.addToIndex_(e,t))return void(this.featuresCollection_&&this.featuresCollection_.remove(t));this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const e=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(e,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new ei(je,t))}setupChangeEvents_(t,e){this.featureChangeKeys_[t]=[dt(e,W,this.handleFeatureChange_,this),dt(e,de,this.handleFeatureChange_,this)]}addToIndex_(t,e){let i=!0;const n=e.getId();return void 0!==n&&(n.toString()in this.idIndex_?i=!1:this.idIndex_[n.toString()]=e),i&&(o(!(t in this.uidIndex_),30),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],n=[];for(let s=0,o=t.length;s<o;s++){const e=t[s],n=et(e);this.addToIndex_(n,e)&&i.push(e)}for(let s=0,o=i.length;s<o;s++){const t=i[s],o=et(t);this.setupChangeEvents_(o,t);const r=t.getGeometry();if(r){const i=r.getExtent();e.push(i),n.push(t)}else this.nullGeometryFeatures_[o]=t}if(this.featuresRtree_&&this.featuresRtree_.load(e,n),this.hasListener(je))for(let s=0,o=i.length;s<o;s++)this.dispatchEvent(new ei(je,i[s]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(je,(function(i){e||(e=!0,t.push(i.feature),e=!1)})),this.addEventListener(Ke,(function(i){e||(e=!0,t.remove(i.feature),e=!1)})),t.addEventListener(ze,(t=>{e||(e=!0,this.addFeature(t.element),e=!1)})),t.addEventListener(Ne,(t=>{e||(e=!0,this.removeFeature(t.element),e=!1)})),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_){this.featureChangeKeys_[t].forEach(ft)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){const t=t=>{this.removeFeatureInternal(t)};this.featuresRtree_.forEach(t);for(const e in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[e])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new ei(qe);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,(function(i){if(i.getGeometry().intersectsCoordinate(t))return e(i)}))}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,(function(i){if(i.getGeometry().intersectsExtent(t)){const t=e(i);if(t)return t}}))}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),J(this.nullGeometryFeatures_)||j(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,(function(t){e.push(t)})),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const i=function(t,e){if(e.canWrapX()){const i=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[i[0],t[1],i[2],t[3]]];G(t,e);const n=L(i);if(L(t)>n)return[[i[0],t[1],i[2],t[3]]];if(t[0]<i[0])return[[t[0]+n,t[1],i[2],t[3]],[i[0],t[1],t[2],t[3]]];if(t[2]>i[2])return[[t[0],t[1],i[2],t[3]],[i[0],t[1],t[2]-n,t[3]]]}return[t]}(t,e);return[].concat(...i.map((t=>this.featuresRtree_.getInExtent(t))))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let s=null;const o=[NaN,NaN];let r=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||q,this.featuresRtree_.forEachInExtent(a,(function(t){if(e(t)){const e=t.getGeometry(),h=r;if(r=e.closestPointXY(i,n,o,r),r<h){s=t;const e=Math.sqrt(r);a[0]=i-e,a[1]=n-e,a[2]=i+e,a[3]=n+e}}})),s}getExtent(t){return this.featuresRtree_.getExtent(t)}getFeatureById(t){const e=this.idIndex_[t.toString()];return void 0!==e?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return void 0!==e?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,i=et(e),n=e.getGeometry();if(n){const t=n.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(t,e)):this.featuresRtree_&&this.featuresRtree_.update(t,e)}else i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);const s=e.getId();if(void 0!==s){const t=s.toString();this.idIndex_[t]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[t]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new ei(Ue,e))}hasFeature(t){const e=t.getId();return void 0!==e?e in this.idIndex_:et(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&J(this.nullGeometryFeatures_):!this.featuresCollection_||0===this.featuresCollection_.getLength()}loadFeatures(t,e,i){const n=this.loadedExtentsRtree_,s=this.strategy_(t,e,i);for(let o=0,r=s.length;o<r;++o){const t=s[o];n.forEachInExtent(t,(function(e){return m(e.extent,t)}))||(++this.loadingExtentsCount_,this.dispatchEvent(new ei(He)),this.loader_.call(this,t,e,i,(t=>{--this.loadingExtentsCount_,this.dispatchEvent(new ei(Je,void 0,t))}),(()=>{--this.loadingExtentsCount_,this.dispatchEvent(new ei(Qe))})),n.insert(t,{extent:t.slice()}))}this.loading=!(this.loader_.length<4)&&this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_;let i;e.forEachInExtent(t,(function(e){if(w(e.extent,t))return i=e,!0})),i&&e.remove(i)}removeFeature(t){if(!t)return;const e=et(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t);this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=et(t),i=this.featureChangeKeys_[e];if(!i)return;i.forEach(ft),delete this.featureChangeKeys_[e];const n=t.getId();return void 0!==n&&delete this.idIndex_[n.toString()],delete this.uidIndex_[e],this.dispatchEvent(new ei(Ke,t)),t}removeFromIdIndex_(t){let e=!1;for(const i in this.idIndex_)if(this.idIndex_[i]===t){delete this.idIndex_[i],e=!0;break}return e}setLoader(t){this.loader_=t}setUrl(t){o(this.format_,7),this.url_=t,this.setLoader(ti(t,this.format_))}},ni="opacity",si="visible",oi="extent",ri="zIndex",ai="maxResolution",hi="minResolution",li="maxZoom",ci="minZoom",ui="source",di="map";const gi=class extends me{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[ni]=void 0!==t.opacity?t.opacity:1,o("number"==typeof e[ni],64),e[si]=void 0===t.visible||t.visible,e[ri]=t.zIndex,e[ai]=void 0!==t.maxResolution?t.maxResolution:1/0,e[hi]=void 0!==t.minResolution?t.minResolution:0,e[ci]=void 0!==t.minZoom?t.minZoom:-1/0,e[li]=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=Pt(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 $()}getLayerStatesArray(t){return $()}getExtent(){return this.get(oi)}getMaxResolution(){return this.get(ai)}getMinResolution(){return this.get(hi)}getMinZoom(){return this.get(ci)}getMaxZoom(){return this.get(li)}getOpacity(){return this.get(ni)}getSourceState(){return $()}getVisible(){return this.get(si)}getZIndex(){return this.get(ri)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(oi,t)}setMaxResolution(t){this.set(ai,t)}setMinResolution(t){this.set(hi,t)}setMaxZoom(t){this.set(li,t)}setMinZoom(t){this.set(ci,t)}setOpacity(t){o("number"==typeof t,64),this.set(ni,t)}setVisible(t){this.set(si,t)}setZIndex(t){this.set(ri,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},fi="prerender",_i="postrender",mi="precompose",pi=0,xi=1,yi={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function vi(t,e,i){return function(n,s,o,r,a){if(!n)return;if(!s&&!e)return n;const h=e?0:o[0]*s,l=e?0:o[1]*s,c=a?a[0]:0,u=a?a[1]:0;let d=t[0]+h/2+c,g=t[2]-h/2+c,f=t[1]+l/2+u,_=t[3]-l/2+u;d>g&&(d=(g+d)/2,g=d),f>_&&(f=(_+f)/2,_=f);let m=Pt(n[0],d,g),p=Pt(n[1],f,_);if(r&&i&&s){const t=30*s;m+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-g)/t),p+=-t*Math.log(1+Math.max(0,f-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-_)/t)}return[m,p]}}function Si(t){return t}function Ci(t,e,i,n){const s=L(e)/i[0],o=k(e)/i[1];return n?Math.min(t,Math.max(s,o)):Math.min(t,Math.min(s,o))}function wi(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),Pt(n,i/2,2*e)}function Ri(t,e,i,n,s){return i=void 0===i||i,function(o,r,a,h){if(void 0!==o){const r=n?Ci(t,n,a,s):t;return i&&h?wi(o,r,e):Pt(o,e,r)}}}function Ii(t){if(void 0!==t)return 0}function Mi(t){if(void 0!==t)return t}function Ei(t,e,i,n,s,o,r){const a=t[e],h=t[e+1],l=t[i]-a,c=t[i+1]-h;let u;if(0===l&&0===c)u=e;else{const d=((s-a)*l+(o-h)*c)/(l*l+c*c);if(d>1)u=i;else{if(d>0){for(let s=0;s<n;++s)r[s]=Wt(t[e+s],t[i+s],d);return void(r.length=n)}u=e}}for(let d=0;d<n;++d)r[d]=t[u+d];r.length=n}function Ti(t,e,i,n,s){let o=t[e],r=t[e+1];for(e+=n;e<i;e+=n){const i=t[e],n=t[e+1],a=Dt(o,r,i,n);a>s&&(s=a),o=i,r=n}return s}function bi(t,e,i,n,s,o,r,a,h,l,c){if(e==i)return l;let u,d;if(0===s){if(d=Dt(r,a,t[e],t[e+1]),d<l){for(u=0;u<n;++u)h[u]=t[e+u];return h.length=n,d}return l}c=c||[NaN,NaN];let g=e+n;for(;g<i;)if(Ei(t,g-n,g,n,r,a,c),d=Dt(r,a,c[0],c[1]),d<l){for(l=d,u=0;u<n;++u)h[u]=c[u];h.length=n,g+=n}else g+=n*Math.max((Math.sqrt(d)-Math.sqrt(l))/s|0,1);if(o&&(Ei(t,i-n,e,n,r,a,c),d=Dt(r,a,c[0],c[1]),d<l)){for(l=d,u=0;u<n;++u)h[u]=c[u];h.length=n}return l}function Fi(t,e,i,n,s,o,r){const a=(i-e)/n;if(a<3){for(;e<i;e+=n)o[r++]=t[e],o[r++]=t[e+1];return r}const h=new Array(a);h[0]=1,h[a-1]=1;const l=[e,i-n];let c=0;for(;l.length>0;){const i=l.pop(),o=l.pop();let r=0;const a=t[o],u=t[o+1],d=t[i],g=t[i+1];for(let e=o+n;e<i;e+=n){const i=Lt(t[e],t[e+1],a,u,d,g);i>r&&(c=e,r=i)}r>s&&(h[(c-e)/n]=1,o+n<c&&l.push(o,c),c+n<i&&l.push(c,i))}for(let u=0;u<a;++u)h[u]&&(o[r++]=t[e+u*n],o[r++]=t[e+u*n+1]);return r}function ki(t,e){return e*Math.round(t/e)}function Ai(t,e,i,n,s,o,r){if(e==i)return r;let a,h,l=ki(t[e],s),c=ki(t[e+1],s);e+=n,o[r++]=l,o[r++]=c;do{if(a=ki(t[e],s),h=ki(t[e+1],s),(e+=n)==i)return o[r++]=a,o[r++]=h,r}while(a==l&&h==c);for(;e<i;){const i=ki(t[e],s),u=ki(t[e+1],s);if(e+=n,i==a&&u==h)continue;const d=a-l,g=h-c,f=i-l,_=u-c;d*_==g*f&&(d<0&&f<d||d==f||d>0&&f>d)&&(g<0&&_<g||g==_||g>0&&_>g)?(a=i,h=u):(o[r++]=a,o[r++]=h,l=a,c=h,a=i,h=u)}return o[r++]=a,o[r++]=h,r}function Pi(t,e,i,n,s){s=void 0!==s?s:[];let o=0;for(let r=e;r<i;r+=n)s[o++]=t.slice(r,r+n);return s.length=o,s}function Li(t,e,i,n,s){s=void 0!==s?s:[];let o=0;for(let r=0,a=i.length;r<a;++r){const a=i[r];s[o++]=Pi(t,e,a,n,s[o]),e=a}return s.length=o,s}function Di(t,e,i,n,s){s=void 0!==s?s:[];let o=0;for(let r=0,a=i.length;r<a;++r){const a=i[r];s[o++]=1===a.length&&a[0]===e?[]:Li(t,e,a,n,s[o]),e=a[a.length-1]}return s.length=o,s}function Oi(t,e,i,n){let s=0,o=t[i-n],r=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];s+=r*i-o*n,o=i,r=n}return s/2}class Gi extends Oe{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 Gi(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<f(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ti(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),bi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return Oi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Pi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=Fi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Gi(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ge(this.flatCoordinates,0,t,this.stride),this.changed()}}const Wi=Gi;function Bi(t,e,i,n){for(;e<i-n;){for(let s=0;s<n;++s){const o=t[e+s];t[e+s]=t[i-n+s],t[i-n+s]=o}e+=n,i-=n}}function zi(t,e,i,n){let s=0,o=t[i-n],r=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];s+=(i-o)*(n+r),o=i,r=n}return 0===s?void 0:s>0}function Ni(t,e,i,n,s){s=void 0!==s&&s;for(let o=0,r=i.length;o<r;++o){const r=i[o],a=zi(t,e,r,n);(0===o?s&&a||!s&&!a:s&&!a||!s&&a)&&Bi(t,e,r,n),e=r}return e}class Yi extends Oe{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?j(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Yi(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<f(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(function(t,e,i,n,s){for(let o=0,r=i.length;o<r;++o){const r=i[o];s=Ti(t,e,r,n,s),e=r}return s}(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),function(t,e,i,n,s,o,r,a,h,l,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];l=bi(t,e,d,n,s,o,r,a,h,l,c),e=d}return l}(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return Ce(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return function(t,e,i,n){let s=0;for(let o=0,r=i.length;o<r;++o){const r=i[o];s+=Oi(t,e,r,n),e=r}return s}(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),Ni(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,Li(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=b(this.getExtent());this.flatInteriorPoint_=function(t,e,i,n,s,o,r){let a,h,l,c,u,d,g;const f=s[o+1],_=[];for(let x=0,y=i.length;x<y;++x){const s=i[x];for(c=t[s-n],d=t[s-n+1],a=e;a<s;a+=n)u=t[a],g=t[a+1],(f<=d&&g<=f||d<=f&&f<=g)&&(l=(f-d)/(g-d)*(u-c)+c,_.push(l)),c=u,d=g}let m=NaN,p=-1/0;for(_.sort(X),c=_[0],a=1,h=_.length;a<h;++a){u=_[a];const s=Math.abs(u-c);s>p&&(l=(c+u)/2,Ce(t,e,i,n,l,f)&&(m=l,p=s)),c=u}return isNaN(m)&&(m=s[o]),r?(r.push(m,f,p),r):[m,f,p]}(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Be(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new Wi(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 o=0,r=i.length;o<r;++o){const r=i[o],a=new Wi(e.slice(s,r),t);n.push(a),s=r}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;!function(t,e,i,n,s){s=void 0!==s&&s;for(let o=0,r=i.length;o<r;++o){const r=i[o],a=zi(t,e,r,n);if(0===o){if(s&&a||!s&&!a)return!1}else if(s&&!a||!s&&a)return!1;e=r}return!0}(t,0,this.ends_,this.stride)?(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Ni(this.orientedFlatCoordinates_,0,this.ends_,this.stride)):this.orientedFlatCoordinates_=t,this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=function(t,e,i,n,s,o,r,a){for(let h=0,l=i.length;h<l;++h){const l=i[h];r=Ai(t,e,l,n,s,o,r),a.push(r),e=l}return r}(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new Yi(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return Re(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=function(t,e,i,n,s){s=s||[];let o=0;for(let r=0,a=i.length;r<a;++r){const a=Ge(t,e,i[r],n);s[o++]=a,e=a}return s.length=o,s}(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}function Xi(t){if(O(t))throw new Error("Cannot create polygon from empty extent");const e=t[0],i=t[1],n=t[2],s=t[3],o=[e,i,e,s,n,s,n,i,e,i];return new Yi(o,"XY",[o.length])}function Vi(t,e){setTimeout((function(){t(e)}),0)}function Zi(t){return!(t.sourceCenter&&t.targetCenter&&!zt(t.sourceCenter,t.targetCenter))&&(t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation)}function ji(t,e,i,n,s){const o=Math.cos(-s);let r=Math.sin(-s),a=t[0]*o-t[1]*r,h=t[1]*o+t[0]*r;a+=(e[0]/2-i[0])*n,h+=(i[1]-e[1]/2)*n,r=-r;return[a*o-h*r,h*o+a*r]}const Ui=class extends me{constructor(t){var e;super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=ie(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&&(Ht=!(void 0===e||e)),t.center&&(t.center=re(t.center,this.projection_)),t.extent&&(t.extent=he(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const r in yi)delete e[r];this.setProperties(e,!0);const i=function(t){let e,i,n;const s=28,o=2;let r=void 0!==t.minZoom?t.minZoom:0,a=void 0!==t.maxZoom?t.maxZoom:s;const h=void 0!==t.zoomFactor?t.zoomFactor:o,l=void 0!==t.multiWorld&&t.multiWorld,c=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,u=void 0!==t.showFullExtent&&t.showFullExtent,d=ie(t.projection,"EPSG:3857"),g=d.getExtent();let f=t.constrainOnlyCenter,_=t.extent;l||_||!d.isGlobal()||(f=!1,_=g);if(void 0!==t.resolutions){const s=t.resolutions;i=s[r],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,o,r,a){if(void 0!==s){const h=t[0],l=t[t.length-1],c=i?Ci(h,i,r,n):h;if(a)return e?wi(s,c,l):Pt(s,l,c);const u=Math.min(c,s),d=Math.floor(V(t,u,o));return t[d]>c&&d<t.length-1?t[d+1]:t[d]}}}(s,c,!f&&_,u):Ri(i,n,c,!f&&_,u)}else{const l=(g?Math.max(L(g),k(g)):360*_t.degrees/d.getMetersPerUnit())/256/Math.pow(o,0),m=l/Math.pow(o,s-0);i=t.maxResolution,void 0!==i?r=0:i=l/Math.pow(h,r),n=t.minResolution,void 0===n&&(n=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(h,a):l/Math.pow(h,a):m),a=r+Math.floor(Math.log(i/n)/Math.log(h)),n=i/Math.pow(h,a-r),e=t.constrainResolution?function(t,e,i,n,s,o){return n=void 0===n||n,i=void 0!==i?i:0,function(r,a,h,l){if(void 0!==r){const c=s?Ci(e,s,h,o):e;if(l)return n?wi(r,c,i):Pt(r,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,r),_=Math.floor(Math.log(e/f)/Math.log(t)+g),m=Math.max(d,_);return Pt(e/Math.pow(t,m),i,c)}}}(h,i,n,c,!f&&_,u):Ri(i,n,c,!f&&_,u)}return{constraint:e,maxResolution:i,minResolution:n,minZoom:r,zoomFactor:h}}(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 vi(t.extent,t.constrainOnlyCenter,e)}const e=ie(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,vi(t,!1,!1)}return Si}(t),s=i.constraint,o=function(t){const e=void 0===t.enableRotation||t.enableRotation;if(e){const e=t.constrainRotation;return void 0===e||!0===e?(i=i||Ot(5),function(t,e){return e?t:void 0!==t?Math.abs(t)<=i?0:t:void 0}):!1===e?Mi:"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):Mi}var i;return Ii}(t);this.constraints_={center:n,resolution:s,rotation:o},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(),o=s/2*(n[3]-e[3]+e[1]-n[1]),r=s/2*(n[0]-e[0]+e[2]-n[2]);this.setCenterInternal([i[0]+o,i[1]-r])}}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 i=0;i<e.length;++i){let t=arguments[i];t.center&&(t=Object.assign({},t),t.center=re(t.center,this.getProjection())),t.anchor&&(t=Object.assign({},t),t.anchor=re(t.anchor,this.getProjection())),e[i]=t}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&&Vi(e,!0));let s=Date.now(),o=this.targetCenter_.slice(),r=this.targetResolution_,a=this.targetRotation_;const h=[];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||nt,callback:e};if(t.center&&(i.sourceCenter=o,i.targetCenter=t.center.slice(),o=i.targetCenter),void 0!==t.zoom?(i.sourceResolution=r,i.targetResolution=this.getResolutionForZoom(t.zoom),r=i.targetResolution):t.resolution&&(i.sourceResolution=r,i.targetResolution=t.resolution,r=i.targetResolution),void 0!==t.rotation){i.sourceRotation=a;const e=Gt(t.rotation-a+Math.PI,2*Math.PI)-Math.PI;i.targetRotation=a+e,a=i.targetRotation}Zi(i)?i.complete=!0:s+=i.duration,h.push(i)}this.animations_.push(h),this.setHint(pi,1),this.updateAnimations_()}getAnimating(){return this.hints_[pi]>0}getInteracting(){return this.hints_[xi]>0}cancelAnimations(){let t;this.setHint(pi,-this.hints_[pi]);for(let e=0,i=this.animations_.length;e<i;++e){const i=this.animations_[e];if(i[0].callback&&Vi(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,o=n.length;i<o;++i){const o=n[i];if(o.complete)continue;const r=t-o.start;let a=o.duration>0?r/o.duration:1;a>=1?(o.complete=!0,a=1):s=!1;const h=o.easing(a);if(o.sourceCenter){const t=o.sourceCenter[0],e=o.sourceCenter[1],i=o.targetCenter[0],n=o.targetCenter[1];this.nextCenter_=o.targetCenter;const s=t+h*(i-t),r=e+h*(n-e);this.targetCenter_=[s,r]}if(o.sourceResolution&&o.targetResolution){const t=1===h?o.targetResolution:o.sourceResolution+h*(o.targetResolution-o.sourceResolution);if(o.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,o.anchor)}this.nextResolution_=o.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==o.sourceRotation&&void 0!==o.targetRotation){const t=1===h?Gt(o.targetRotation+Math.PI,2*Math.PI)-Math.PI:o.sourceRotation+h*(o.targetRotation-o.sourceRotation);if(o.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,o.anchor)}this.nextRotation_=o.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!o.complete)break}if(s){this.animations_[i]=null,this.setHint(pi,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&Vi(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,o;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,o=t[1]*i+t[0]*n;t[0]=s,t[1]=o}(i,t-this.getRotation()),o=e,(s=i)[0]+=+o[0],s[1]+=+o[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?oe(t,this.getProjection()):t}getCenterInternal(){return this.get(yi.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 ae(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();o(e,1);const i=this.getResolution();o(void 0!==i,2);const n=this.getRotation();return o(void 0!==n,3),F(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(yi.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(he(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=L(t)/e[0],n=k(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(yi.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=ji(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=V(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_){if(this.resolutions_.length<=1)return 0;const e=Pt(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,Pt(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(o(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,24),Array.isArray(t)){o(!O(t),25);i=Xi(he(t,this.getProjection()))}else if("Circle"===t.getType()){const e=he(t.getExtent(),this.getProjection());i=Xi(e),i.rotate(this.getRotation(),b(e))}else i=t;this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),s=t.getFlatCoordinates(),o=t.getStride();let r=1/0,a=1/0,h=-1/0,l=-1/0;for(let c=0,u=s.length;c<u;c+=o){const t=s[c]*i-s[c+1]*n,e=s[c]*n+s[c+1]*i;r=Math.min(r,t),a=Math.min(a,e),h=Math.max(h,t),l=Math.max(l,e)}return[r,a,h,l]}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 o;o=void 0!==e.minResolution?e.minResolution:void 0!==e.maxZoom?this.getResolutionForZoom(e.maxZoom):0;const r=this.rotatedExtentForGeometry(t);let a=this.getResolutionForExtentInternal(r,[i[0]-n[1]-n[3],i[1]-n[0]-n[2]]);a=isNaN(a)?o:Math.max(a,o),a=this.getConstrainedResolution(a,s?0:1);const h=this.getRotation(),l=Math.sin(h),c=Math.cos(h),u=b(r);u[0]+=(n[1]-n[3])/2*a,u[1]+=(n[0]-n[2])/2*a;const d=u[0]*c-u[1]*l,g=u[1]*c+u[0]*l,f=this.getConstrainedCenter([d,g],a),_=e.callback?e.callback:K;void 0!==e.duration?this.animateInternal({resolution:a,center:f,duration:e.duration,easing:e.easing},_):(this.targetResolution_=a,this.targetCenter_=f,this.applyTargetState_(!1,!0),Vi(_,!0))}centerOn(t,e,i){this.centerOnInternal(re(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(ji(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,n){let s;const o=this.padding_;if(o&&t){const r=this.getViewportSizeMinusPadding_(-i),a=ji(t,n,[r[0]/2+o[3],r[1]/2+o[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=oe(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&&re(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=re(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?re(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),o=this.constraints_.resolution(this.targetResolution_,0,s,i),r=this.constraints_.center(this.targetCenter_,o,s,i,this.calculateCenterShift(this.targetCenter_,o,n,s));this.get(yi.ROTATION)!==n&&this.set(yi.ROTATION,n),this.get(yi.RESOLUTION)!==o&&(this.set(yi.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),r&&this.get(yi.CENTER)&&zt(this.get(yi.CENTER),r)||this.set(yi.CENTER,r),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_),o=this.getViewportSize_(s),r=this.constraints_.resolution(this.targetResolution_,n,o),a=this.constraints_.center(this.targetCenter_,r,o,!1,this.calculateCenterShift(this.targetCenter_,r,s,o));if(0===t&&!this.cancelAnchor_)return this.targetResolution_=r,this.targetRotation_=s,this.targetCenter_=a,void this.applyTargetState_();i=i||(0===t?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===r&&this.getRotation()===s&&this.getCenterInternal()&&zt(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:a,resolution:r,duration:t,easing:it,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(xi,1)}endInteraction(t,e,i){i=i&&re(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(xi,-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)}};const qi=class extends gi{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(ui,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(ui)||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_&&(ft(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=dt(t,W,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;!t&&i&&(t=i.getView()),e=t instanceof Ui?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),n=e.layerStatesArray?e.layerStatesArray.find((t=>t.layer===this)):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||D(s,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];let e;const i=this.getSource();if(i&&(e=i.getAttributions()),!e)return[];let n=e(t instanceof Ui?t.getViewStateAndExtent():t);return Array.isArray(n)||(n=[n]),n}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}setMapInternal(t){t||this.unrender(),this.set(di,t)}getMapInternal(){return this.get(di)}setMap(t){this.mapPrecomposeKey_&&(ft(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(ft(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=dt(t,mi,(function(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);o(!e.some((function(t){return t.layer===i.layer})),67),e.push(i)}),this),this.mapRenderKey_=dt(this,W,t.render,t),this.changed())}setSource(t){this.set(ui,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}disposeInternal(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),super.disposeInternal()}};const Ki=class extends fe{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.declutterExecutorGroup=null}getFeatures(t){return $()}getData(t){return null}prepareFrame(t){return $()}renderFrame(t,e){return $()}loadedTileCallback(t,e,i){t[e]||(t[e]={}),t[e][i.tileCoord.toString()]=i}createLoadedTileFinder(t,e,i){return(n,s)=>{const o=this.loadedTileCallback.bind(this,i,n);return t.forEachLoadedTile(e,n,s,o)}}forEachFeatureAtCoordinate(t,e,i,n,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;e.getState()!==ct&&e.getState()!==ut||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=ct&&e!=ut&&t.addEventListener(W,this.boundHandleImageChange_),e==ht&&(t.load(),e=t.getState()),e==ct}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}};const Hi=class extends Y{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}},Ji=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,Qi=/^([a-z]*)$|^hsla?\(.*\)$/i;function $i(t){return"string"==typeof t?t:sn(t)}const tn=function(){const t={};let e=0;return function(i){let n;if(t.hasOwnProperty(i))n=t[i];else{if(e>=1024){let i=0;for(const n in t)3&i++||(delete t[n],--e)}n=function(t){let e,i,n,s,r;Qi.exec(t)&&(t=function(t){const e=document.createElement("div");if(e.style.color=t,""!==e.style.color){document.body.appendChild(e);const t=getComputedStyle(e).color;return document.body.removeChild(e),t}return""}(t));if(Ji.exec(t)){const o=t.length-1;let a;a=o<=4?1:2;const h=4===o||8===o;e=parseInt(t.substr(1+0*a,a),16),i=parseInt(t.substr(1+1*a,a),16),n=parseInt(t.substr(1+2*a,a),16),s=h?parseInt(t.substr(1+3*a,a),16):255,1==a&&(e=(e<<4)+e,i=(i<<4)+i,n=(n<<4)+n,h&&(s=(s<<4)+s)),r=[e,i,n,s/255]}else t.startsWith("rgba(")?(r=t.slice(5,-1).split(",").map(Number),nn(r)):t.startsWith("rgb(")?(r=t.slice(4,-1).split(",").map(Number),r.push(1),nn(r)):o(!1,14);return r}(i),t[i]=n,++e}return n}}();function en(t){return Array.isArray(t)?t:tn(t)}function nn(t){return t[0]=Pt(t[0]+.5|0,0,255),t[1]=Pt(t[1]+.5|0,0,255),t[2]=Pt(t[2]+.5|0,0,255),t[3]=Pt(t[3],0,1),t}function sn(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(100*t[3])/100)+")"}const on=[];let rn=null;const an=class extends Ki{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.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(t,e,i){let n;rn||(rn=at(1,1,void 0,{willReadFrequently:!0})),rn.clearRect(0,0,1,1);try{rn.drawImage(t,e,i,1,1,0,0,1,1),n=rn.getImageData(0,0,1,1).data}catch(s){return rn=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,o;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&U(en(t.style.backgroundColor),en(i)))){const e=t.firstElementChild;e instanceof HTMLCanvasElement&&(o=e.getContext("2d"))}if(o&&o.canvas.style.transform===e?(this.container=t,this.context=o,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%",o=at();const e=o.canvas;s.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=s,this.context=o}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=A(i),s=P(i),o=T(i),r=E(i);Te(e.coordinateToPixelTransform,n),Te(e.coordinateToPixelTransform,s),Te(e.coordinateToPixelTransform,o),Te(e.coordinateToPixelTransform,r);const a=this.inversePixelTransform;Te(a,n),Te(a,s),Te(a,o),Te(a,r),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(o[0]),Math.round(o[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.clip()}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const s=new Hi(t,this.inversePixelTransform,i,e);n.dispatchEvent(s)}}preRender(t,e){this.frameState=e,this.dispatchRenderEvent_(fi,t,e)}postRender(t,e){this.dispatchRenderEvent_(_i,t,e)}getRenderTransform(t,e,i,n,s,o,r){const a=s/2,h=o/2,l=n/e,c=-l,u=-t[0]+r,d=-t[1];return be(this.tempTransform,a,h,l,c,-i,u,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}},hn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAeCAYAAADQBxWhAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAJBSURBVEiJ7ZfPa9NgHMaf933j27jazTqRLq02tc0q6E4DZYfCEPwFuwzmwYPiQTz4H3gQ/wBRPHhxetB58CKIbKcNRKig11EGdutoHW6dP7aqXS2NTeKhjQSNW96tKyg+EEieNzyf9/3mG/KGwFY8kmCGmbJA+gD40TpVCKyMwWga8+9yAEAAgB0Ij1gUJ1oIchUxMWUsLD5hiEcSBDi/3cAGFXGru+sNZYaZaguwKWaYKdp8hm2TBdInQbBpYpMPhrimKr/62djgqMcIPxUBhm5c7eeaquhzhSXnYU/Ga47kZgYvDEfBdzAA4L2xoO13jZzqBwD9/cqa836uqeCaqoQf3RysFz+UAUCfzZcAAPp3ozT29K3zfkLV8F2n4TucCKgT9895nbUXFYYuPa7N5Mr29W8rrc3kyl/Gnr1GB5d2HR9Isj27A/pso4RsbzCwXrjxqVQGAN6rKsbq5/La81dZfNPrTiDgslKn7KYRaBIAQDL/4rI+V1jKn7w44TYu1EitkjC05/a1o9Hx0dMAQHycRsfvnem5c/2YSIZr964nfujgPjkZU6RISKYdMpOPaPupfycXyfg7yvsf+u9BrWpVBwDKGCFNz6w0PK8SfmUWhq9MSqFuX315pQYA8wNnH9aXP9ZEMjZVXhvYOBcDbhq6VXkqr8gHesvQ6nS2yDVVcduebKTqdLb4pzFC1fAttHZzvZEqlMDKtBEIAitDDUbT7YQajKYZSl9XaWenDIL4dgOJiSmrsPiS/HTa+AP1A194w/sdsoQRAAAAAElFTkSuQmCC";function ln(e){return t({url:"equipment/contractors",method:"get",params:e})}function cn(e){return t({url:"equipment/districtsBlocks",method:"get",params:e})}function un(e){return t({url:"equipment/cityAndCount",method:"get",params:e})}class dn{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=Ie(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new dn({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 $()}getImage(t){return $()}getHitDetectionImage(){return $()}getPixelRatio(t){return 1}getImageState(){return $()}getImageSize(){return $()}getOrigin(){return $()}getSize(){return $()}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_=Ie(t)}listenImageChange(t){$()}load(){$()}unlistenImageChange(t){$()}}const gn=dn;function fn(t){return Array.isArray(t)?sn(t):t}const _n=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-z]+?)\\s*$"].join(""),"i"),mn=["style","variant","weight","size","lineHeight","family"],pn=function(t){const e=t.match(_n);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let n=0,s=mn.length;n<s;++n){const t=e[n+1];void 0!==t&&(i[mn[n]]=t)}return i.families=i.family.split(/,\s?/),i},xn="10px sans-serif",yn="#000",vn="round",Sn=[],Cn="round",wn="#000",Rn="center",In="middle",Mn=[0,0,0,0],En=new me;let Tn,bn=null;const Fn={},kn=function(){const t="32px ",e=["monospace","serif"],i=e.length,n="wmytzilWMYTZIL@#/&?$%10";let s,o;function r(s,r,a){let h=!0;for(let l=0;l<i;++l){const i=e[l];if(o=Ln(s+" "+r+" "+t+i,n),a!=i){const e=Ln(s+" "+r+" "+t+a+","+i,n);h=h&&e!=o}}return!!h}function a(){let t=!0;const e=En.getKeys();for(let i=0,n=e.length;i<n;++i){const n=e[i];En.get(n)<100&&(r.apply(this,n.split("\n"))?(H(Fn),bn=null,Tn=void 0,En.set(n,100)):(En.set(n,En.get(n)+1,!0),t=!1))}t&&(clearInterval(s),s=void 0)}return function(t){const e=pn(t);if(!e)return;const i=e.families;for(let n=0,o=i.length;n<o;++n){const t=i[n],o=e.style+"\n"+e.weight+"\n"+t;void 0===En.get(o)&&(En.set(o,100,!0),r(e.style,e.weight,t)||(En.set(o,0,!0),void 0===s&&(s=setInterval(a,32))))}}}(),An=function(){let t;return function(e){let i=Fn[e];if(null==i){if(ot){const t=pn(e),n=Pn(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);Fn[e]=i}return i}}();function Pn(t,e){return bn||(bn=at(1,1)),t!=Tn&&(bn.font=t,Tn=bn.font),bn.measureText(e)}function Ln(t,e){return Pn(t,e).width}function Dn(t,e,i){if(e in i)return i[e];const n=e.split("\n").reduce(((e,i)=>Math.max(e,Ln(t,i))),0);return i[e]=n,n}function On(t,e,i,n,s,o,r,a,h,l,c){t.save(),1!==i&&(t.globalAlpha*=i),e&&t.setTransform.apply(t,e),n.contextInstructions?(t.translate(h,l),t.scale(c[0],c[1]),function(t,e){const i=t.contextInstructions;for(let n=0,s=i.length;n<s;n+=2)Array.isArray(i[n+1])?e[i[n]].apply(e,i[n+1]):e[i[n]]=i[n+1]}(n,t)):c[0]<0||c[1]<0?(t.translate(h,l),t.scale(c[0],c[1]),t.drawImage(n,s,o,r,a,0,0,r,a)):t.drawImage(n,s,o,r,a,h,l,r*c[0],a*c[1]),t.restore()}class Gn extends gn{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.canvas_=void 0,this.hitDetectionCanvas_=null,this.fill_=void 0!==t.fill?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius_=void 0!==t.radius?t.radius:t.radius1,this.radius2_=t.radius2,this.angle_=void 0!==t.angle?t.angle:0,this.stroke_=void 0!==t.stroke?t.stroke:null,this.size_=null,this.renderOptions_=null,this.render()}clone(){const t=this.getScale(),e=new Gn({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_;if(!t)return null;const 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.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_}getImage(t){let e=this.canvas_[t];if(!e){const i=this.renderOptions_,n=at(i.size*t,i.size*t);this.draw_(i,n,t),e=n.canvas,this.canvas_[t]=e}return e}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return ct}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 o=void 0===this.radius2_?this.points_:2*this.points_,r=2*Math.PI/o,a=s*Math.sin(r),h=n-Math.sqrt(s*s-a*a),l=Math.sqrt(a*a+h*h),c=l/a;if("miter"===t&&c<=i)return c*e;const u=e/2/c,d=e/2*(h/l),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(r),_=s-Math.sqrt(n*n-f*f),m=Math.sqrt(f*f+_*_)/f;if(m<=i){const t=m*e/2-s-n;return 2*Math.max(g,t)}return 2*g}createRenderOptions(){let t,e=Cn,i=0,n=null,s=0,o=0;this.stroke_&&(t=this.stroke_.getColor(),null===t&&(t=wn),t=fn(t),o=this.stroke_.getWidth(),void 0===o&&(o=1),n=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset(),e=this.stroke_.getLineJoin(),void 0===e&&(e=Cn),i=this.stroke_.getMiterLimit(),void 0===i&&(i=10));const r=this.calculateLineJoinSize_(e,o,i),a=Math.max(this.radius_,this.radius2_||0);return{strokeStyle:t,strokeWidth:o,size:Math.ceil(2*a+r),lineDash:n,lineDashOffset:s,lineJoin:e,miterLimit:i}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.canvas_={},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=yn),e.fillStyle=fn(t),e.fill()}this.stroke_&&(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())}createHitDetectionCanvas_(t){if(this.fill_){let e=this.fill_.getColor(),i=0;if("string"==typeof e&&(e=en(e)),null===e?i=1:Array.isArray(e)&&(i=4===e.length?e[3]:1),0===i){const e=at(t.size,t.size);this.hitDetectionCanvas_=e.canvas,this.drawHitDetectionCanvas_(t,e)}}this.hitDetectionCanvas_||(this.hitDetectionCanvas_=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,o=2*Math.PI/e;for(let r=0;r<e;r++){const e=s+r*o,a=r%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=yn,e.fill(),this.stroke_&&(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())}}const Wn=Gn;class Bn extends Wn{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 Bn({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 zn=Bn;class Nn{constructor(t){t=t||{},this.color_=void 0!==t.color?t.color:null}clone(){const t=this.getColor();return new Nn({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){this.color_=t}}const Yn=Nn;function Xn(t,e,i){return e+":"+t+":"+(i?$i(i):"null")}const Vn=new class{constructor(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}clear(){this.cache_={},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],--this.cacheSize_)}}}get(t,e,i){const n=Xn(t,e,i);return n in this.cache_?this.cache_[n]:null}set(t,e,i,n){const s=Xn(t,e,i);this.cache_[s]=n,++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};let Zn=null;class jn extends Q{constructor(t,e,i,n,s,o){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=n,this.canvas_={},this.color_=o,this.unlisten_=null,this.imageState_=s,this.size_=i,this.src_=e,this.tainted_}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(void 0===this.tainted_&&this.imageState_===ct){Zn||(Zn=at(1,1,void 0,{willReadFrequently:!0})),Zn.drawImage(this.image_,0,0);try{Zn.getImageData(0,0,1,1),this.tainted_=!1}catch(t){Zn=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(W)}handleImageError_(){this.imageState_=ut,this.unlistenImage_(),this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=ct,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),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=at(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_===ht){this.image_||this.initializeImage_(),this.imageState_=lt;try{this.image_.src=this.src_}catch(t){this.handleImageError_()}this.unlisten_=function(t,e,i){const n=t;let s=!0,o=!1,r=!1;const a=[gt(n,z,(function(){r=!0,o||e()}))];return n.src&&rt?(o=!0,n.decode().then((function(){s&&e()})).catch((function(t){s&&(r?e():i())}))):a.push(gt(n,B,i)),function(){s=!1,a.forEach(ft)}}(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==ct)return;const e=this.image_,i=document.createElement("canvas");i.width=Math.ceil(e.width*t),i.height=Math.ceil(e.height*t);const n=i.getContext("2d");n.scale(t,t),n.drawImage(e,0,0),n.globalCompositeOperation="multiply",n.fillStyle=$i(this.color_),n.fillRect(0,0,i.width/t,i.height/t),n.globalCompositeOperation="destination-in",n.drawImage(e,0,0),this.canvas_[t]=i}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function Un(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 qn extends gn{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;this.imgSize_=t.imgSize;let a=t.src;o(!(void 0!==a&&r),4),o(!r||r&&this.imgSize_,5),void 0!==a&&0!==a.length||!r||(a=r.src||et(r)),o(void 0!==a&&a.length>0,6),o(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),69);const h=void 0!==t.src?ht:ct;if(this.color_=void 0!==t.color?en(t.color):null,this.iconImage_=function(t,e,i,n,s,o){let r=Vn.get(e,n,o);return r||(r=new jn(t,e,i,n,s,o),Vn.set(e,n,o,r)),r}(r,a,void 0!==this.imgSize_?this.imgSize_:null,this.crossOrigin_,h,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,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 instanceof HTMLCanvasElement||n.src&&n.complete)){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(Un(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}e=n.width,i=n.height}void 0!==e&&this.setScale(Un(e,i,t.width,t.height))}}clone(){let t,e,i;this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t);return new qn({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_,imgSize:this.imgSize_,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()==ct?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:this.iconImage_.getImageState()==ct?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(W,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(W,t)}}const Kn=qn;class Hn{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 Hn({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 Jn=Hn;class Qn{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=es,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 Qn({geometry:t,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer(),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_=es,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let $n=null;function ts(t,e){if(!$n){const t=new Yn({color:"rgba(255,255,255,0.4)"}),e=new Jn({color:"#3399CC",width:1.25});$n=[new Qn({image:new zn({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return $n}function es(t){return t.getGeometry()}const is=Qn;class ns{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.scale_=t.scale,this.scaleArray_=Ie(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 Yn({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}clone(){const t=this.getScale();return new ns({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),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})}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_}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_}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}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=Ie(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 ss=ns;function os(t,e,i,n,s,o,r){let a,h;const l=(i-e)/n;if(1===l)a=e;else if(2===l)a=e,h=s;else if(0!==l){let o=t[e],r=t[e+1],l=0;const c=[0];for(let s=e+n;s<i;s+=n){const e=t[s],i=t[s+1];l+=Math.sqrt((e-o)*(e-o)+(i-r)*(i-r)),c.push(l),o=e,r=i}const u=s*l,d=function(t,e,i){let n,s;i=i||X;let o=0,r=t.length,a=!1;for(;o<r;)n=o+(r-o>>1),s=+i(t[n],e),s<0?o=n+1:(r=n,a=!s);return a?o:~o}(c,u);d<0?(h=(u-c[-d-2])/(c[-d-1]-c[-d-2]),a=e+(-d-2)*n):a=e+d*n}r=r>1?r:2,o=o||new Array(r);for(let c=0;c<r;++c)o[c]=void 0===a?NaN:void 0===h?t[a+c]:Wt(t[a+c],t[a+n+c],h);return o}function rs(t,e,i,n){let s=t[e],o=t[e+1],r=0;for(let a=e+n;a<i;a+=n){const e=t[a],i=t[a+1];r+=Math.sqrt((e-s)*(e-s)+(i-o)*(i-o)),s=e,o=i}return r}class as extends Oe{constructor(t,e){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}appendCoordinate(t){this.flatCoordinates?j(this.flatCoordinates,t):this.flatCoordinates=t.slice(),this.changed()}clone(){const t=new as(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<f(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ti(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),bi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,n))}forEachSegment(t){return ye(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinateAtM(t,e){return"XYM"!=this.layout&&"XYZM"!=this.layout?null:(e=void 0!==e&&e,function(t,e,i,n,s,o){if(i==e)return null;let r;if(s<t[e+n-1])return o?(r=t.slice(e,e+n),r[n-1]=s,r):null;if(t[i-1]<s)return o?(r=t.slice(i-n,i),r[n-1]=s,r):null;if(s==t[e+n-1])return t.slice(e,e+n);let a=e/n,h=i/n;for(;a<h;){const e=a+h>>1;s<t[(e+1)*n-1]?h=e:a=e+1}const l=t[a*n-1];if(s==l)return t.slice((a-1)*n,(a-1)*n+n);const c=(s-l)/(t[(a+1)*n-1]-l);r=[];for(let u=0;u<n-1;++u)r.push(Wt(t[(a-1)*n+u],t[a*n+u],c));return r.push(s),r}(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return Pi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return os(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return rs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const e=[];return e.length=Fi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new as(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return we(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ge(this.flatCoordinates,0,t,this.stride),this.changed()}}const hs=as;function ls(t){return new is({fill:cs(t,""),stroke:us(t,""),text:ds(t),image:gs(t)})}function cs(t,e){const i=t[e+"fill-color"];if(i)return"none"===i?null:new Yn({color:i})}function us(t,e){const i=t[e+"stroke-width"],n=t[e+"stroke-color"];if(i||n)return new Jn({width:i,color:n,lineCap:t[e+"stroke-line-cap"],lineJoin:t[e+"stroke-line-join"],lineDash:t[e+"stroke-line-dash"],lineDashOffset:t[e+"stroke-line-dash-offset"],miterLimit:t[e+"stroke-miter-limit"]})}function ds(t){const e=t["text-value"];if(!e)return;return new ss({text:e,font:t["text-font"],maxAngle:t["text-max-angle"],offsetX:t["text-offset-x"],offsetY:t["text-offset-y"],overflow:t["text-overflow"],placement:t["text-placement"],repeat:t["text-repeat"],scale:t["text-scale"],rotateWithView:t["text-rotate-with-view"],rotation:t["text-rotation"],textAlign:t["text-align"],justify:t["text-justify"],textBaseline:t["text-baseline"],padding:t["text-padding"],fill:cs(t,"text-"),backgroundFill:cs(t,"text-background-"),stroke:us(t,"text-"),backgroundStroke:us(t,"text-background-")})}function gs(t){const e=t["icon-src"],i=t["icon-img"];if(e||i){return new Kn({src:e,img:i,imgSize:t["icon-img-size"],anchor:t["icon-anchor"],anchorOrigin:t["icon-anchor-origin"],anchorXUnits:t["icon-anchor-x-units"],anchorYUnits:t["icon-anchor-y-units"],color:t["icon-color"],crossOrigin:t["icon-cross-origin"],offset:t["icon-offset"],displacement:t["icon-displacement"],opacity:t["icon-opacity"],scale:t["icon-scale"],width:t["icon-width"],height:t["icon-height"],rotation:t["icon-rotation"],rotateWithView:t["icon-rotate-with-view"],size:t["icon-size"],declutterMode:t["icon-declutter-mode"]})}const n=t["shape-points"];if(n){const e="shape-";return new Wn({points:n,fill:cs(t,e),stroke:us(t,e),radius:t["shape-radius"],radius1:t["shape-radius1"],radius2:t["shape-radius2"],angle:t["shape-angle"],displacement:t["shape-displacement"],rotation:t["shape-rotation"],rotateWithView:t["shape-rotate-with-view"],scale:t["shape-scale"],declutterMode:t["shape-declutter-mode"]})}const s=t["circle-radius"];if(s){const e="circle-";return new zn({radius:s,fill:cs(t,e),stroke:us(t,e),displacement:t["circle-displacement"],scale:t["circle-scale"],rotation:t["circle-rotation"],rotateWithView:t["circle-rotate-with-view"],declutterMode:t["circle-declutter-mode"]})}}const fs="renderOrder";const _s=class extends qi{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_=void 0!==t.declutter&&t.declutter,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(fs)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t){t.declutterTree||(t.declutterTree=new e(9)),this.getRenderer().renderDeclutter(t)}setRenderOrder(t){this.set(fs,t)}setStyle(t){let e;if(void 0===t)e=ts;else if(null===t)e=null;else if("function"==typeof t)e=t;else if(t instanceof is)e=t;else if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let e=0;e<i;++e){const i=t[e];n[e]=i instanceof is?i:ls(i)}e=n}else e=ls(t);this.style_=e,this.styleFunction_=null===t?void 0:function(t){let e;if("function"==typeof t)e=t;else{let i;Array.isArray(t)?i=t:(o("function"==typeof t.getZIndex,41),i=[t]),e=function(){return i}}return e}(this.style_),this.changed()}},ms={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},ps=[ms.FILL],xs=[ms.STROKE],ys=[ms.BEGIN_PATH],vs=[ms.CLOSE_PATH],Ss=ms;const Cs=class{drawCustom(t,e,i,n){}drawGeometry(t){}setStyle(t){}drawCircle(t,e){}drawFeature(t,e){}drawGeometryCollection(t,e){}drawLineString(t,e){}drawMultiLineString(t,e){}drawMultiPoint(t,e){}drawMultiPolygon(t,e){}drawPoint(t,e){}drawPolygon(t,e){}drawText(t,e){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}};const ws=class extends Cs{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 o=s.length;for(let r=0,a=t.length;r<a;r+=e)n[0]=t[r],n[1]=t[r+1],_(i,n)&&(s[o++]=n[0],s[o++]=n[1]);return o}appendFlatLineCoordinates(t,e,i,n,s,o){const r=this.coordinates;let h=r.length;const l=this.getBufferedMaxExtent();o&&(e+=n);let c=t[e],u=t[e+1];const d=this.tmpCoordinate_;let g,f,_,m=!0;for(g=e+n;g<i;g+=n)d[0]=t[g],d[1]=t[g+1],_=x(l,d),_!==f?(m&&(r[h++]=c,r[h++]=u,m=!1),r[h++]=d[0],r[h++]=d[1]):_===a?(r[h++]=d[0],r[h++]=d[1],m=!1):m=!0,c=d[0],u=d[1],f=_;return(s&&m||g===e+n)&&(r[h++]=c,r[h++]=u),h}drawCustomCoordinates_(t,e,i,n,s){for(let o=0,r=i.length;o<r;++o){const r=i[o],a=this.appendFlatLineCoordinates(t,e,r,n,!1,!1);s.push(a),e=r}return e}drawCustom(t,e,i,n){this.beginGeometry(t,e);const s=t.getType(),o=t.getStride(),r=this.coordinates.length;let a,h,l,c,u;switch(s){case"MultiPolygon":a=t.getOrientedFlatCoordinates(),c=[];const e=t.getEndss();u=0;for(let t=0,i=e.length;t<i;++t){const i=[];u=this.drawCustomCoordinates_(a,u,e[t],o,i),c.push(i)}this.instructions.push([Ss.CUSTOM,r,c,t,i,Di]),this.hitDetectionInstructions.push([Ss.CUSTOM,r,c,t,n||i,Di]);break;case"Polygon":case"MultiLineString":l=[],a="Polygon"==s?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),u=this.drawCustomCoordinates_(a,0,t.getEnds(),o,l),this.instructions.push([Ss.CUSTOM,r,l,t,i,Li]),this.hitDetectionInstructions.push([Ss.CUSTOM,r,l,t,n||i,Li]);break;case"LineString":case"Circle":a=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(a,0,a.length,o,!1,!1),this.instructions.push([Ss.CUSTOM,r,h,t,i,Pi]),this.hitDetectionInstructions.push([Ss.CUSTOM,r,h,t,n||i,Pi]);break;case"MultiPoint":a=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(a,o),h>r&&(this.instructions.push([Ss.CUSTOM,r,h,t,i,Pi]),this.hitDetectionInstructions.push([Ss.CUSTOM,r,h,t,n||i,Pi]));break;case"Point":a=t.getFlatCoordinates(),this.coordinates.push(a[0],a[1]),h=this.coordinates.length,this.instructions.push([Ss.CUSTOM,r,h,t,i]),this.hitDetectionInstructions.push([Ss.CUSTOM,r,h,t,n||i])}this.endGeometry(e)}beginGeometry(t,e){this.beginGeometryInstruction1_=[Ss.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[Ss.BEGIN_GEOMETRY,e,0,t],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,o=-1;for(e=0;e<i;++e)n=t[e],s=n[0],s==Ss.END_GEOMETRY?o=e:s==Ss.BEGIN_GEOMETRY&&(n[2]=e,Z(this.hitDetectionInstructions,o,e),o=-1)}setFillStrokeStyle(t,e){const i=this.state;if(t){const e=t.getColor();i.fillStyle=fn(e||yn)}else i.fillStyle=void 0;if(e){const t=e.getColor();i.strokeStyle=fn(t||wn);const n=e.getLineCap();i.lineCap=void 0!==n?n:vn;const s=e.getLineDash();i.lineDash=s?s.slice():Sn;const o=e.getLineDashOffset();i.lineDashOffset=o||0;const r=e.getLineJoin();i.lineJoin=void 0!==r?r:Cn;const a=e.getWidth();i.lineWidth=void 0!==a?a:1;const h=e.getMiterLimit();i.miterLimit=void 0!==h?h:10,i.lineWidth>this.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0}createFill(t){const e=t.fillStyle,i=[Ss.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(!0),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[Ss.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;"string"==typeof i&&t.currentFillStyle==i||(void 0!==i&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,s=t.lineDash,o=t.lineDashOffset,r=t.lineJoin,a=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||s!=t.currentLineDash&&!U(t.currentLineDash,s)||t.currentLineDashOffset!=o||t.currentLineJoin!=r||t.currentLineWidth!=a||t.currentMiterLimit!=h)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=s,t.currentLineDashOffset=o,t.currentLineJoin=r,t.currentLineWidth=a,t.currentMiterLimit=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[Ss.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;g(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}var t,e;return this.bufferedMaxExtent_}};const Rs=class extends ws{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){if(!this.image_)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([Ss.DRAW_IMAGE,s,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([Ss.DRAW_IMAGE,s,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){if(!this.image_)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([Ss.DRAW_IMAGE,s,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([Ss.DRAW_IMAGE,s,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 Is=class extends ws{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n){const s=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),r=[Ss.MOVE_TO_LINE_TO,s,o];return this.instructions.push(r),this.hitDetectionInstructions.push(r),i}drawLineString(t,e){const i=this.state,n=i.strokeStyle,s=i.lineWidth;if(void 0===n||void 0===s)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([Ss.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,Sn,0],ys);const o=t.getFlatCoordinates(),r=t.getStride();this.drawFlatCoordinates_(o,0,o.length,r),this.hitDetectionInstructions.push(xs),this.endGeometry(e)}drawMultiLineString(t,e){const i=this.state,n=i.strokeStyle,s=i.lineWidth;if(void 0===n||void 0===s)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([Ss.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,Sn,0],ys);const o=t.getEnds(),r=t.getFlatCoordinates(),a=t.getStride();let h=0;for(let l=0,c=o.length;l<c;++l)h=this.drawFlatCoordinates_(r,h,o[l],a);this.hitDetectionInstructions.push(xs),this.endGeometry(e)}finish(){const t=this.state;return null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(xs),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(xs),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(ys)}};const Ms=class extends ws{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinatess_(t,e,i,n){const s=this.state,o=void 0!==s.fillStyle,r=void 0!==s.strokeStyle,a=i.length;this.instructions.push(ys),this.hitDetectionInstructions.push(ys);for(let h=0;h<a;++h){const s=i[h],o=this.coordinates.length,a=this.appendFlatLineCoordinates(t,e,s,n,!0,!r),l=[Ss.MOVE_TO_LINE_TO,o,a];this.instructions.push(l),this.hitDetectionInstructions.push(l),r&&(this.instructions.push(vs),this.hitDetectionInstructions.push(vs)),e=s}return o&&(this.instructions.push(ps),this.hitDetectionInstructions.push(ps)),r&&(this.instructions.push(xs),this.hitDetectionInstructions.push(xs)),e}drawCircle(t,e){const i=this.state,n=i.fillStyle,s=i.strokeStyle;if(void 0===n&&void 0===s)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e),void 0!==i.fillStyle&&this.hitDetectionInstructions.push([Ss.SET_FILL_STYLE,yn]),void 0!==i.strokeStyle&&this.hitDetectionInstructions.push([Ss.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,Sn,0]);const o=t.getFlatCoordinates(),r=t.getStride(),a=this.coordinates.length;this.appendFlatLineCoordinates(o,0,o.length,r,!1,!1);const h=[Ss.CIRCLE,a];this.instructions.push(ys,h),this.hitDetectionInstructions.push(ys,h),void 0!==i.fillStyle&&(this.instructions.push(ps),this.hitDetectionInstructions.push(ps)),void 0!==i.strokeStyle&&(this.instructions.push(xs),this.hitDetectionInstructions.push(xs)),this.endGeometry(e)}drawPolygon(t,e){const i=this.state,n=i.fillStyle,s=i.strokeStyle;if(void 0===n&&void 0===s)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e),void 0!==i.fillStyle&&this.hitDetectionInstructions.push([Ss.SET_FILL_STYLE,yn]),void 0!==i.strokeStyle&&this.hitDetectionInstructions.push([Ss.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,Sn,0]);const o=t.getEnds(),r=t.getOrientedFlatCoordinates(),a=t.getStride();this.drawFlatCoordinatess_(r,0,o,a),this.endGeometry(e)}drawMultiPolygon(t,e){const i=this.state,n=i.fillStyle,s=i.strokeStyle;if(void 0===n&&void 0===s)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e),void 0!==i.fillStyle&&this.hitDetectionInstructions.push([Ss.SET_FILL_STYLE,yn]),void 0!==i.strokeStyle&&this.hitDetectionInstructions.push([Ss.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,Sn,0]);const o=t.getEndss(),r=t.getOrientedFlatCoordinates(),a=t.getStride();let h=0;for(let l=0,c=o.length;l<c;++l)h=this.drawFlatCoordinatess_(r,h,o[l],a);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]=ki(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;void 0!==t.fillStyle&&this.updateFillStyle(t,this.createFill),void 0!==t.strokeStyle&&this.updateStrokeStyle(t,this.applyStroke)}};function Es(t,e,i,n,s){const o=[];let r=i,a=0,h=e.slice(i,2);for(;a<t&&r+s<n;){const[i,n]=h.slice(-2),l=e[r+s],c=e[r+s+1],u=Math.sqrt((l-i)*(l-i)+(c-n)*(c-n));if(a+=u,a>=t){const e=(t-a+u)/u,d=Wt(i,l,e),g=Wt(n,c,e);h.push(d,g),o.push(h),h=[d,g],a==t&&(r+=s),a=0}else if(a<t)h.push(e[r+s],e[r+s+1]),r+=s;else{const t=u-a,e=Wt(i,l,t/u),d=Wt(n,c,t/u);h.push(e,d),o.push(h),h=[e,d],a=0,r+=s}}return a>0&&o.push(h),o}function Ts(t,e,i,n,s){let o,r,a,h,l,c,u,d,g,f,_=i,m=i,p=0,x=0,y=i;for(r=i;r<n;r+=s){const i=e[r],n=e[r+1];void 0!==l&&(g=i-l,f=n-c,h=Math.sqrt(g*g+f*f),void 0!==u&&(x+=a,o=Math.acos((u*g+d*f)/(a*h)),o>t&&(x>p&&(p=x,_=y,m=r),x=0,y=r-s)),a=h,u=g,d=f),l=i,c=n}return x+=h,x>p?[y,r]:[_,m]}const bs={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};const Fs={Circle:Ms,Default:ws,Image:Rs,LineString:Is,Polygon:Ms,Text:class extends ws{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.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[yn]={fillStyle:yn},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",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){const i=this.textFillState_,n=this.textStrokeState_,s=this.textState_;if(""===this.text_||!s||!i&&!n)return;const o=this.coordinates;let r=o.length;const a=t.getType();let h=null,l=t.getStride();if("line"!==s.placement||"LineString"!=a&&"MultiLineString"!=a&&"Polygon"!=a&&"MultiPolygon"!=a){let i=s.overflow?null:[];switch(a){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(),l=2;break;case"Polygon":h=t.getFlatInteriorPoint(),s.overflow||i.push(h[2]/this.resolution),l=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();h=[];for(let t=0,n=e.length;t<n;t+=3)s.overflow||i.push(e[t+2]/this.resolution),h.push(e[t],e[t+1]);if(0===h.length)return;l=2}const n=this.appendFlatPointCoordinates(h,l);if(n===r)return;if(i&&(n-r)/2!=h.length/l){let t=r/2;i=i.filter(((e,i)=>{const n=o[2*(t+i)]===h[i*l]&&o[2*(t+i)+1]===h[i*l+1];return n||--t,n}))}this.saveTextStates_(),(s.backgroundFill||s.backgroundStroke)&&(this.setFillStrokeStyle(s.backgroundFill,s.backgroundStroke),s.backgroundFill&&this.updateFillStyle(this.state,this.createFill),s.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,e);let c=s.padding;if(c!=Mn&&(s.scale[0]<0||s.scale[1]<0)){let t=s.padding[0],e=s.padding[1],i=s.padding[2],n=s.padding[3];s.scale[0]<0&&(e=-e,n=-n),s.scale[1]<0&&(t=-t,i=-i),c=[t,e,i,n]}const u=this.pixelRatio;this.instructions.push([Ss.DRAW_IMAGE,r,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,c==Mn?Mn:c.map((function(t){return t*u})),!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,i]);const d=1/u,g=this.state.fillStyle;s.backgroundFill&&(this.state.fillStyle=yn,this.hitDetectionInstructions.push(this.createFill(this.state))),this.hitDetectionInstructions.push([Ss.DRAW_IMAGE,r,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[d,d],NaN,void 0,this.declutterImageWithText_,c,!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?yn:this.fillKey_,this.textOffsetX_,this.textOffsetY_,i]),s.backgroundFill&&(this.state.fillStyle=g,this.hitDetectionInstructions.push(this.createFill(this.state))),this.endGeometry(e)}else{if(!D(this.getBufferedMaxExtent(),t.getExtent()))return;let i;if(h=t.getFlatCoordinates(),"LineString"==a)i=[h.length];else if("MultiLineString"==a)i=t.getEnds();else if("Polygon"==a)i=t.getEnds().slice(0,1);else if("MultiPolygon"==a){const e=t.getEndss();i=[];for(let t=0,n=e.length;t<n;++t)i.push(e[t][0])}this.beginGeometry(t,e);const n=s.repeat,c=n?void 0:s.textAlign;let u=0;for(let t=0,e=i.length;t<e;++t){let e;e=n?Es(n*this.resolution,h,u,i[t],l):[h.slice(u,i[t])];for(let n=0,a=e.length;n<a;++n){const a=e[n];let h=0,d=a.length;if(null==c){const t=Ts(s.maxAngle,a,0,a.length,2);h=t[0],d=t[1]}for(let t=h;t<d;t+=l)o.push(a[t],a[t+1]);const g=o.length;u=i[t],this.drawChars_(r,g),r=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||Rn,justify:e.justify,textBaseline:e.textBaseline||In,scale:e.scale});const o=this.fillKey_;i&&(o in this.fillStates||(this.fillStates[o]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,s=this.strokeKey_,o=this.textKey_,r=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,h=bs[n.textBaseline],l=this.textOffsetY_*a,c=this.text_,u=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([Ss.DRAW_CHARS,t,e,h,n.overflow,r,n.maxAngle,a,l,s,u*a,c,o,1]),this.hitDetectionInstructions.push([Ss.DRAW_CHARS,t,e,h,n.overflow,r?yn:r,n.maxAngle,1,l,s,u,c,o,1/a])}setTextStyle(t,e){let i,n,s;if(t){const e=t.getFill();e?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=fn(e.getColor()||yn)):(n=null,this.textFillState_=n);const o=t.getStroke();if(o){s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);const t=o.getLineDash(),e=o.getLineDashOffset(),i=o.getWidth(),n=o.getMiterLimit();s.lineCap=o.getLineCap()||vn,s.lineDash=t?t.slice():Sn,s.lineDashOffset=void 0===e?0:e,s.lineJoin=o.getLineJoin()||Cn,s.lineWidth=void 0===i?1:i,s.miterLimit=void 0===n?10:n,s.strokeStyle=fn(o.getColor()||wn)}else s=null,this.textStrokeState_=s;i=this.textState_;const r=t.getFont()||xn;kn(r);const a=t.getScaleArray();i.overflow=t.getOverflow(),i.font=r,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||In,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||Mn,i.scale=void 0===a?[1,1]:a;const h=t.getOffsetX(),l=t.getOffsetY(),c=t.getRotateWithView(),u=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=void 0===h?0:h,this.textOffsetY_=void 0===l?0:l,this.textRotateWithView_=void 0!==c&&c,this.textRotation_=void 0===u?0:u,this.strokeKey_=s?("string"==typeof s.strokeStyle?s.strokeStyle:et(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?"string"==typeof n.fillStyle?n.fillStyle:"|"+et(n.fillStyle):""}else this.text_="";this.declutterImageWithText_=e}}};const ks=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,Fs[e])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=s}return s}};function As(t,e,i,n,s,o,r,a,h,l,c,u){let d=t[e],g=t[e+1],f=0,_=0,m=0,p=0;function x(){f=d,_=g,d=t[e+=n],g=t[e+1],p+=m,m=Math.sqrt((d-f)*(d-f)+(g-_)*(g-_))}do{x()}while(e<i-n&&p+m<o);let y=0===m?0:(o-p)/m;const v=Wt(f,d,y),S=Wt(_,g,y),C=e-n,w=p,R=o+a*h(l,s,c);for(;e<i-n&&p+m<R;)x();y=0===m?0:(R-p)/m;const I=Wt(f,d,y),M=Wt(_,g,y);let E;if(u){const t=[v,S,I,M];Ae(t,0,4,2,u,t,t),E=t[0]>t[2]}else E=v>I;const T=Math.PI,b=[],F=C+n===e;let k;if(m=0,p=w,d=t[e=C],g=t[e+1],F){x(),k=Math.atan2(g-_,d-f),E&&(k+=k>0?-T:T);const t=(I+v)/2,e=(M+S)/2;return b[0]=[t,e,(R-o)/2,k,s],b}for(let A=0,P=(s=s.replace(/\n/g," ")).length;A<P;){x();let t=Math.atan2(g-_,d-f);if(E&&(t+=t>0?-T:T),void 0!==k){let e=t-k;if(e+=e>T?-2*T:e<-T?2*T:0,Math.abs(e)>r)return null}k=t;const u=A;let v=0;for(;A<P;++A){const t=a*h(l,s[E?P-A-1:A],c);if(e+n<i&&p+m<o+v+t/2)break;v+=t}if(A===u)continue;const S=E?s.substring(P-u,P-A):s.substring(u,A);y=0===m?0:(o+v/2-p)/m;const C=Wt(f,d,y),w=Wt(_,g,y);b.push([C,w,v/2,t,S]),o+=v}return b}const Ps=[1/0,1/0,-1/0,-1/0],Ls=[],Ds=[],Os=[],Gs=[];function Ws(t){return t[3].declutterBox}const Bs=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=Bs.test(t)?"right":"left":"end"===e&&(e=Bs.test(t)?"left":"right"),bs[e]}function Ns(t,e,i){return i>0&&t.push("\n",""),t.push(e,""),t}const Ys=class{constructor(t,e,i,n){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignFill_,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_={}}createLabel(t,e,i,n){const s=t+e+i+n;if(this.labels_[s])return this.labels_[s];const o=n?this.strokeStates[n]:null,r=i?this.fillStates[i]:null,a=this.textStates[e],h=this.pixelRatio,l=[a.scale[0]*h,a.scale[1]*h],c=Array.isArray(t),u=a.justify?bs[a.justify]:zs(Array.isArray(t)?t[0]:t,a.textAlign||Rn),d=n&&o.lineWidth?o.lineWidth:0,g=c?t:t.split("\n").reduce(Ns,[]),{width:f,height:_,widths:m,heights:p,lineWidths:x}=function(t,e){const i=[],n=[],s=[];let o=0,r=0,a=0,h=0;for(let l=0,c=e.length;l<=c;l+=2){const u=e[l];if("\n"===u||l===c){o=Math.max(o,r),s.push(r),r=0,a+=h;continue}const d=e[l+1]||t.font,g=Ln(d,u);i.push(g),r+=g;const f=An(d);n.push(f),h=Math.max(h,f)}return{width:o,height:a,widths:i,heights:n,lineWidths:s}}(a,g),y=f+d,v=[],S=(y+2)*l[0],C=(_+d)*l[1],w={width:S<0?Math.floor(S):Math.ceil(S),height:C<0?Math.floor(C):Math.ceil(C),contextInstructions:v};1==l[0]&&1==l[1]||v.push("scale",l),n&&(v.push("strokeStyle",o.strokeStyle),v.push("lineWidth",d),v.push("lineCap",o.lineCap),v.push("lineJoin",o.lineJoin),v.push("miterLimit",o.miterLimit),v.push("setLineDash",[o.lineDash]),v.push("lineDashOffset",o.lineDashOffset)),i&&v.push("fillStyle",r.fillStyle),v.push("textBaseline","middle"),v.push("textAlign","center");const R=.5-u;let I=u*y+R*d;const M=[],E=[];let T,b=0,F=0,k=0,A=0;for(let P=0,L=g.length;P<L;P+=2){const t=g[P];if("\n"===t){F+=b,b=0,I=u*y+R*d,++A;continue}const e=g[P+1]||a.font;e!==T&&(n&&M.push("font",e),i&&E.push("font",e),T=e),b=Math.max(b,p[k]);const s=[t,I+R*m[k]+u*(m[k]-x[A]),.5*(d+b)+F];I+=m[k],n&&M.push("strokeText",s),i&&E.push("fillText",s),++k}return Array.prototype.push.apply(v,M),Array.prototype.push.apply(v,E),this.labels_[s]=w,w}replayTextBackground_(t,e,i,n,s,o,r){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),o&&(this.alignFill_=o[2],this.fill_(t)),r&&(this.setStrokeStyle_(t,r),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,n,s,o,r,a,h,l,c,u,d,g,f,_){let m=i-(r*=u[0]),p=n-(a*=u[1]);const x=s+h>t?t-h:s,y=o+l>e?e-l:o,S=g[3]+x*u[0]+g[1],C=g[0]+y*u[1]+g[2],w=m-g[3],R=p-g[0];let I;return(f||0!==c)&&(Ls[0]=w,Gs[0]=w,Ls[1]=R,Ds[1]=R,Ds[0]=w+S,Os[0]=Ds[0],Os[1]=R+C,Gs[1]=Os[1]),0!==c?(I=be([1,0,0,1,0,0],i,n,1,1,c,-i,-n),Te(I,Ls),Te(I,Ds),Te(I,Os),Te(I,Gs),v(Math.min(Ls[0],Ds[0],Os[0],Gs[0]),Math.min(Ls[1],Ds[1],Os[1],Gs[1]),Math.max(Ls[0],Ds[0],Os[0],Gs[0]),Math.max(Ls[1],Ds[1],Os[1],Gs[1]),Ps)):v(Math.min(w,w+S),Math.min(R,R+C),Math.max(w,w+S),Math.max(R,R+C),Ps),d&&(m=Math.round(m),p=Math.round(p)),{drawImageX:m,drawImageY:p,drawImageW:x,drawImageH:y,originX:h,originY:l,declutterBox:{minX:Ps[0],minY:Ps[1],maxX:Ps[2],maxY:Ps[3],value:_},canvasTransform:I,scale:u}}replayImageOrLabel_(t,e,i,n,s,o,r){const a=!(!o&&!r),h=n.declutterBox,l=t.canvas,c=r?r[2]*n.scale[0]/2:0;return h.minX-c<=l.width/e&&h.maxX+c>=0&&h.minY-c<=l.height/e&&h.maxY+c>=0&&(a&&this.replayTextBackground_(t,Ls,Ds,Os,Gs,o,r),On(t,n.canvasTransform,s,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){if(this.alignFill_){const e=Te(this.renderedTransform_,[0,0]),i=512*this.pixelRatio;t.save(),t.translate(e[0]%i,e[1]%i),t.rotate(this.viewRotation_)}t.fill(),this.alignFill_&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=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],o=this.createLabel(t,e,n,i),r=this.strokeStates[i],a=this.pixelRatio,h=zs(Array.isArray(t)?t[0]:t,s.textAlign||Rn),l=bs[s.textBaseline||In],c=r&&r.lineWidth?r.lineWidth:0;return{label:o,anchorX:h*(o.width/a-2*s.scale[0])+2*(.5-h)*c,anchorY:l*o.height/a+2*(.5-l)*c}}execute_(t,e,i,n,s,o,r,a){let h;var l,c;this.pixelCoordinates_&&U(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=ke(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),l=this.renderedTransform_,c=i,l[0]=c[0],l[1]=c[1],l[2]=c[2],l[3]=c[3],l[4]=c[4],l[5]=c[5]);let u=0;const d=n.length;let g,f,_,m,p,x,y,v,S,C,w,R,I=0,M=0,E=0,T=null,b=null;const F=this.coordinateCache_,k=this.viewRotation_,A=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,P={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:k},L=this.instructions!=n||this.overlaps?0:200;let O,G,W,B;for(;u<d;){const i=n[u];switch(i[0]){case Ss.BEGIN_GEOMETRY:O=i[1],B=i[3],O.getGeometry()?void 0===r||D(r,B.getExtent())?++u:u=i[2]+1:u=i[2];break;case Ss.BEGIN_PATH:M>L&&(this.fill_(t),M=0),E>L&&(t.stroke(),E=0),M||E||(t.beginPath(),m=NaN,p=NaN),++u;break;case Ss.CIRCLE:I=i[1];const n=h[I],l=h[I+1],c=h[I+2]-n,d=h[I+3]-l,z=Math.sqrt(c*c+d*d);t.moveTo(n+z,l),t.arc(n,l,z,0,2*Math.PI,!0),++u;break;case Ss.CLOSE_PATH:t.closePath(),++u;break;case Ss.CUSTOM:I=i[1],g=i[2];const N=i[3],Y=i[4],X=6==i.length?i[5]:void 0;P.geometry=N,P.feature=O,u in F||(F[u]=[]);const V=F[u];X?X(h,I,g,2,V):(V[0]=h[I],V[1]=h[I+1],V.length=2),Y(V,P),++u;break;case Ss.DRAW_IMAGE:I=i[1],g=i[2],v=i[3],f=i[4],_=i[5];let Z=i[6];const j=i[7],U=i[8],q=i[9],K=i[10];let H=i[11];const J=i[12];let Q=i[13];const $=i[14],tt=i[15];if(!v&&i.length>=20){S=i[19],C=i[20],w=i[21],R=i[22];const t=this.drawLabelWithPointPlacement_(S,C,w,R);v=t.label,i[3]=v;const e=i[23];f=(t.anchorX-e)*this.pixelRatio,i[4]=f;const n=i[24];_=(t.anchorY-n)*this.pixelRatio,i[5]=_,Z=v.height,i[6]=Z,Q=v.width,i[13]=Q}let et,it,nt,st;i.length>25&&(et=i[25]),i.length>17?(it=i[16],nt=i[17],st=i[18]):(it=Mn,nt=!1,st=!1),K&&A?H+=k:K||A||(H-=k);let ot=0;for(;I<g;I+=2){if(et&&et[ot++]<Q/this.pixelRatio)continue;const i=this.calculateImageOrLabelDimensions_(v.width,v.height,h[I],h[I+1],Q,Z,f,_,U,q,H,J,s,it,nt||st,O),n=[t,e,v,i,j,nt?T:null,st?b:null];if(a){if("none"===$)continue;if("obstacle"===$){a.insert(i.declutterBox);continue}{let t,e;if(tt){const i=g-I;if(!tt[i]){tt[i]=n;continue}if(t=tt[i],delete tt[i],e=Ws(t),a.collides(e))continue}if(a.collides(i.declutterBox))continue;t&&(a.insert(e),this.replayImageOrLabel_.apply(this,t)),a.insert(i.declutterBox)}}this.replayImageOrLabel_.apply(this,n)}++u;break;case Ss.DRAW_CHARS:const rt=i[1],at=i[2],ht=i[3],lt=i[4];R=i[5];const ct=i[6],ut=i[7],dt=i[8];w=i[9];const gt=i[10];S=i[11],C=i[12];const ft=[i[13],i[13]],_t=this.textStates[C],mt=_t.font,pt=[_t.scale[0]*ut,_t.scale[1]*ut];let xt;mt in this.widths_?xt=this.widths_[mt]:(xt={},this.widths_[mt]=xt);const yt=rs(h,rt,at,2),vt=Math.abs(pt[0])*Dn(mt,S,xt);if(lt||vt<=yt){const i=As(h,rt,at,2,S,(yt-vt)*zs(S,this.textStates[C].textAlign),ct,Math.abs(pt[0]),Dn,mt,xt,A?0:this.viewRotation_);t:if(i){const n=[];let s,o,r,h,l;if(w)for(s=0,o=i.length;s<o;++s){l=i[s],r=l[4],h=this.createLabel(r,C,"",w),f=l[2]+(pt[0]<0?-gt:gt),_=ht*h.height+2*(.5-ht)*gt*pt[1]/pt[0]-dt;const o=this.calculateImageOrLabelDimensions_(h.width,h.height,l[0],l[1],h.width,h.height,f,_,0,0,l[3],ft,!1,Mn,!1,O);if(a&&a.collides(o.declutterBox))break t;n.push([t,e,h,o,1,null,null])}if(R)for(s=0,o=i.length;s<o;++s){l=i[s],r=l[4],h=this.createLabel(r,C,R,""),f=l[2],_=ht*h.height-dt;const o=this.calculateImageOrLabelDimensions_(h.width,h.height,l[0],l[1],h.width,h.height,f,_,0,0,l[3],ft,!1,Mn,!1,O);if(a&&a.collides(o.declutterBox))break t;n.push([t,e,h,o,1,null,null])}a&&a.load(n.map(Ws));for(let t=0,e=n.length;t<e;++t)this.replayImageOrLabel_.apply(this,n[t])}}++u;break;case Ss.END_GEOMETRY:if(void 0!==o){O=i[1];const t=o(O,B);if(t)return t}++u;break;case Ss.FILL:L?M++:this.fill_(t),++u;break;case Ss.MOVE_TO_LINE_TO:for(I=i[1],g=i[2],G=h[I],W=h[I+1],x=G+.5|0,y=W+.5|0,x===m&&y===p||(t.moveTo(G,W),m=x,p=y),I+=2;I<g;I+=2)G=h[I],W=h[I+1],x=G+.5|0,y=W+.5|0,I!=g-2&&x===m&&y===p||(t.lineTo(G,W),m=x,p=y);++u;break;case Ss.SET_FILL_STYLE:T=i,this.alignFill_=i[2],M&&(this.fill_(t),M=0,E&&(t.stroke(),E=0)),t.fillStyle=i[1],++u;break;case Ss.SET_STROKE_STYLE:b=i,E&&(t.stroke(),E=0),this.setStrokeStyle_(t,i),++u;break;case Ss.STROKE:L?E++:t.stroke(),++u;break;default:++u}}M&&this.fill_(t),E&&t.stroke()}execute(t,e,i,n,s,o){this.viewRotation_=n,this.execute_(t,e,i,this.instructions,s,void 0,void 0,o)}executeHitDetection(t,e,i,n,s){return this.viewRotation_=i,this.execute_(t,1,e,this.hitDetectionInstructions,!0,n,s)}},Xs=["Polygon","Circle","LineString","Image","Text","Default"];const Vs={};const Zs=class{constructor(t,e,i,n,s,o){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=[1,0,0,1,0,0],this.createExecutors_(s)}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){for(const e in t){let i=this.executorsByZIndex_[e];void 0===i&&(i={},this.executorsByZIndex_[e]=i);const n=t[e];for(const t in n){const e=n[t];i[t]=new Ys(this.resolution_,this.pixelRatio_,this.overlaps_,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,o){const r=2*(n=Math.round(n))+1,a=be(this.hitDetectionTransform_,n+.5,n+.5,1/e,-1/e,-i,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=at(r,r,void 0,{willReadFrequently:!0}));const l=this.hitDetectionContext_;let c;l.canvas.width!==r||l.canvas.height!==r?(l.canvas.width=r,l.canvas.height=r):h||l.clearRect(0,0,r,r),void 0!==this.renderBuffer_&&(c=[1/0,1/0,-1/0,-1/0],R(c,t),g(c,e*(this.renderBuffer_+n),c));const u=function(t){if(void 0!==Vs[t])return Vs[t];const e=2*t+1,i=t*t,n=new Array(i+1);for(let o=0;o<=t;++o)for(let s=0;s<=t;++s){const r=o*o+s*s;if(r>i)break;let a=n[r];a||(a=[],n[r]=a),a.push(4*((t+o)*e+(t+s))+3),o>0&&a.push(4*((t-o)*e+(t+s))+3),s>0&&(a.push(4*((t+o)*e+(t-s))+3),o>0&&a.push(4*((t-o)*e+(t-s))+3))}const s=[];for(let o=0,r=n.length;o<r;++o)n[o]&&s.push(...n[o]);return Vs[t]=s,s}(n);let d;function f(t,e){const i=l.getImageData(0,0,r,r).data;for(let a=0,h=u.length;a<h;a++)if(i[u[a]]>0){if(!o||"Image"!==d&&"Text"!==d||o.includes(t)){const i=(u[a]-3)/4,o=n-i%r,h=n-(i/r|0),l=s(t,e,o*o+h*h);if(l)return l}l.clearRect(0,0,r,r);break}}const _=Object.keys(this.executorsByZIndex_).map(Number);let m,p,x,y,v;for(_.sort(X),m=_.length-1;m>=0;--m){const t=_[m].toString();for(x=this.executorsByZIndex_[t],p=Xs.length-1;p>=0;--p)if(d=Xs[p],y=x[d],void 0!==y&&(v=y.executeHitDetection(l,a,i,f,c),v))return v}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],s=e[2],o=e[3],r=[i,n,i,o,s,o,s,n];return ke(r,0,8,2,t,r),r}isEmpty(){return J(this.executorsByZIndex_)}execute(t,e,i,n,s,o,r){const a=Object.keys(this.executorsByZIndex_).map(Number);let h,l,c,u,d,g;for(a.sort(X),this.maxExtent_&&(t.save(),this.clip(t,i)),o=o||Xs,r&&a.reverse(),h=0,l=a.length;h<l;++h){const l=a[h].toString();for(d=this.executorsByZIndex_[l],c=0,u=o.length;c<u;++c){g=d[o[c]],void 0!==g&&g.execute(t,e,i,n,s,r)}}this.maxExtent_&&t.restore()}};const js=class extends Cs{constructor(t,e,i,n,s,o,r){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?function(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=o,this.userTransform_=r,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=ke(t,e,i,n,this.transform_,this.pixelCoordinates_),o=this.context_,r=this.tmpLocalTransform_,a=o.globalAlpha;1!=this.imageOpacity_&&(o.globalAlpha=a*this.imageOpacity_);let h=this.imageRotation_;0===this.transformRotation_&&(h-=this.viewRotation_),this.imageRotateWithView_&&(h+=this.viewRotation_);for(let l=0,c=s.length;l<c;l+=2){const t=s[l]-this.imageAnchorX_,e=s[l+1]-this.imageAnchorY_;if(0!==h||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const i=t+this.imageAnchorX_,n=e+this.imageAnchorY_;be(r,i,n,1,1,h,-i,-n),o.setTransform.apply(o,r),o.translate(i,n),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.setTransform(1,0,0,1,0,0)}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,t,e,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(o.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=ke(t,e,i,n,this.transform_,this.pixelCoordinates_),o=this.context_;let r=this.textRotation_;for(0===this.transformRotation_&&(r-=this.viewRotation_),this.textRotateWithView_&&(r+=this.viewRotation_);e<i;e+=n){const t=s[e]+this.textOffsetX_,i=s[e+1]+this.textOffsetY_;0!==r||1!=this.textScale_[0]||1!=this.textScale_[1]?(o.translate(t-this.textOffsetX_,i-this.textOffsetY_),o.rotate(r),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.setTransform(1,0,0,1,0,0)):(this.textStrokeState_&&o.strokeText(this.text_,t,i),this.textFillState_&&o.fillText(this.text_,t,i))}}moveToLineTo_(t,e,i,n,s){const o=this.context_,r=ke(t,e,i,n,this.transform_,this.pixelCoordinates_);o.moveTo(r[0],r[1]);let a=r.length;s&&(a-=2);for(let h=2;h<a;h+=2)o.lineTo(r[h],r[h+1]);return s&&o.closePath(),i}drawRings_(t,e,i,n){for(let s=0,o=i.length;s<o;++s)e=this.moveToLineTo_(t,e,i[s],n,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),D(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 ke(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),o=this.context_;o.beginPath(),o.arc(e[0],e[1],s,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.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 i=0,n=e.length;i<n;++i)this.drawGeometry(e[i])}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_)),D(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(D(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();let n=0;const s=t.getEnds(),o=t.getStride();e.beginPath();for(let t=0,r=s.length;t<r;++t)n=this.moveToLineTo_(i,n,s[t],o,!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_)),D(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_)),D(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(),o=t.getStride();e.beginPath();for(let t=0,r=s.length;t<r;++t){const e=s[t];n=this.drawRings_(i,n,e,o)}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),U(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:Rn;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:fn(e||yn)}}else this.fillState_=null;if(e){const t=e.getColor(),i=e.getLineCap(),n=e.getLineDash(),s=e.getLineDashOffset(),o=e.getLineJoin(),r=e.getWidth(),a=e.getMiterLimit(),h=n||Sn;this.strokeState_={lineCap:void 0!==i?i:vn,lineDash:1===this.pixelRatio_?h:h.map((t=>t*this.pixelRatio_)),lineDashOffset:(s||0)*this.pixelRatio_,lineJoin:void 0!==o?o:Cn,lineWidth:(void 0!==r?r:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:fn(t||wn)}}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 o=t.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/i,o[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:fn(t||yn)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),s=i.getLineDashOffset(),o=i.getLineJoin(),r=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:vn,lineDash:n||Sn,lineDashOffset:s||0,lineJoin:void 0!==o?o:Cn,lineWidth:void 0!==r?r:1,miterLimit:void 0!==a?a:10,strokeStyle:fn(t||wn)}}else this.textStrokeState_=null;const n=t.getFont(),s=t.getOffsetX(),o=t.getOffsetY(),r=t.getRotateWithView(),a=t.getRotation(),h=t.getScaleArray(),l=t.getText(),c=t.getTextAlign(),u=t.getTextBaseline();this.textState_={font:void 0!==n?n:xn,textAlign:void 0!==c?c:Rn,textBaseline:void 0!==u?u:In},this.text_=void 0!==l?Array.isArray(l)?l.reduce(((t,e,i)=>t+(i%2?" ":e)),""):l:"",this.textOffsetX_=void 0!==s?this.pixelRatio_*s:0,this.textOffsetY_=void 0!==o?this.pixelRatio_*o:0,this.textRotateWithView_=void 0!==r&&r,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}else this.text_=""}},Us=.5;const qs={Point:function(t,e,i,n,s){const o=i.getImage(),r=i.getText();let a;if(o){if(o.getImageState()!=ct)return;let h=t;if(s){const l=o.getDeclutterMode();if("none"!==l)if(h=s,"obstacle"===l){const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,a),s.drawPoint(e,n)}else r&&r.getText()&&(a={})}const l=h.getBuilder(i.getZIndex(),"Image");l.setImageStyle(o,a),l.drawPoint(e,n)}if(r&&r.getText()){let o=t;s&&(o=s);const h=o.getBuilder(i.getZIndex(),"Text");h.setTextStyle(r,a),h.drawText(e,n)}},LineString:function(t,e,i,n,s){const o=i.getStroke();if(o){const s=t.getBuilder(i.getZIndex(),"LineString");s.setFillStrokeStyle(null,o),s.drawLineString(e,n)}const r=i.getText();if(r&&r.getText()){const o=(s||t).getBuilder(i.getZIndex(),"Text");o.setTextStyle(r),o.drawText(e,n)}},Polygon:function(t,e,i,n,s){const o=i.getFill(),r=i.getStroke();if(o||r){const s=t.getBuilder(i.getZIndex(),"Polygon");s.setFillStrokeStyle(o,r),s.drawPolygon(e,n)}const a=i.getText();if(a&&a.getText()){const o=(s||t).getBuilder(i.getZIndex(),"Text");o.setTextStyle(a),o.drawText(e,n)}},MultiPoint:function(t,e,i,n,s){const o=i.getImage(),r=i.getText();let a;if(o){if(o.getImageState()!=ct)return;let h=t;if(s){const l=o.getDeclutterMode();if("none"!==l)if(h=s,"obstacle"===l){const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,a),s.drawMultiPoint(e,n)}else r&&r.getText()&&(a={})}const l=h.getBuilder(i.getZIndex(),"Image");l.setImageStyle(o,a),l.drawMultiPoint(e,n)}if(r&&r.getText()){let o=t;s&&(o=s);const h=o.getBuilder(i.getZIndex(),"Text");h.setTextStyle(r,a),h.drawText(e,n)}},MultiLineString:function(t,e,i,n,s){const o=i.getStroke();if(o){const s=t.getBuilder(i.getZIndex(),"LineString");s.setFillStrokeStyle(null,o),s.drawMultiLineString(e,n)}const r=i.getText();if(r&&r.getText()){const o=(s||t).getBuilder(i.getZIndex(),"Text");o.setTextStyle(r),o.drawText(e,n)}},MultiPolygon:function(t,e,i,n,s){const o=i.getFill(),r=i.getStroke();if(r||o){const s=t.getBuilder(i.getZIndex(),"Polygon");s.setFillStrokeStyle(o,r),s.drawMultiPolygon(e,n)}const a=i.getText();if(a&&a.getText()){const o=(s||t).getBuilder(i.getZIndex(),"Text");o.setTextStyle(a),o.drawText(e,n)}},GeometryCollection:function(t,e,i,n,s){const o=e.getGeometriesArray();let r,a;for(r=0,a=o.length;r<a;++r){(0,qs[o[r].getType()])(t,o[r],i,n,s)}},Circle:function(t,e,i,n,s){const o=i.getFill(),r=i.getStroke();if(o||r){const s=t.getBuilder(i.getZIndex(),"Circle");s.setFillStrokeStyle(o,r),s.drawCircle(e,n)}const a=i.getText();if(a&&a.getText()){const o=(s||t).getBuilder(i.getZIndex(),"Text");o.setTextStyle(a),o.drawText(e,n)}}};function Ks(t,e){return parseInt(et(t),10)-parseInt(et(e),10)}function Hs(t,e){return.5*t/e}function Js(t,e,i,n,s,o,r){let a=!1;const h=i.getImage();if(h){const t=h.getImageState();t==ct||t==ut?h.unlistenImageChange(s):(t==ht&&h.load(),h.listenImageChange(s),a=!0)}return function(t,e,i,n,s,o){const r=i.getGeometryFunction()(e);if(!r)return;const a=r.simplifyTransformed(n,s),h=i.getRenderer();if(h)Qs(t,a,i,e);else{(0,qs[a.getType()])(t,a,i,e,o)}}(t,e,i,n,o,r),a}function Qs(t,e,i,n){if("GeometryCollection"==e.getType()){const s=e.getGeometries();for(let e=0,o=s.length;e<o;++e)Qs(t,s[e],i,n);return}t.getBuilder(i.getZIndex(),"Default").drawCustom(e,n,i.getRenderer(),i.getHitDetectionRenderer())}const $s=class extends an{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,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.renderedRenderOrder_=null,this.replayGroup_=null,this.replayGroupChanged=!0,this.declutterExecutorGroup=null,this.clipping=!0,this.compositionContext_=null,this.opacity_=1}renderWorlds(t,e,i){const n=e.extent,s=e.viewState,o=s.center,r=s.resolution,a=s.projection,h=s.rotation,l=a.getExtent(),c=this.getLayer().getSource(),u=e.pixelRatio,d=e.viewHints,g=!(d[pi]||d[xi]),f=this.compositionContext_,_=Math.round(e.size[0]*u),m=Math.round(e.size[1]*u),p=c.getWrapX()&&a.canWrapX(),x=p?L(l):null,y=p?Math.ceil((n[2]-l[2])/x)+1:1;let v=p?Math.floor((n[0]-l[0])/x):0;do{const e=this.getRenderTransform(o,r,h,u,_,m,v*x);t.execute(f,1,e,h,g,void 0,i)}while(++v<y)}setupCompositionContext_(){if(1!==this.opacity_){const t=at(this.context.canvas.width,this.context.canvas.height,on);this.compositionContext_=t}else this.compositionContext_=this.context}releaseCompositionContext_(){if(1!==this.opacity_){const t=this.context.globalAlpha;this.context.globalAlpha=this.opacity_,this.context.drawImage(this.compositionContext_.canvas,0,0),this.context.globalAlpha=t,function(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}(this.compositionContext_),on.push(this.compositionContext_.canvas),this.compositionContext_=null}}renderDeclutter(t){this.declutterExecutorGroup&&(this.setupCompositionContext_(),this.renderWorlds(this.declutterExecutorGroup,t,t.declutterTree),this.releaseCompositionContext_())}renderFrame(t,e){const i=t.pixelRatio,n=t.layerStatesArray[t.layerIndex];!function(t,e,i){return s=e,o=0,r=0,a=i,h=0,l=0,(n=t)[0]=s,n[1]=o,n[2]=r,n[3]=a,n[4]=h,n[5]=l,n;var n,s,o,r,a,h,l}(this.pixelTransform,1/i,1/i),function(t,e){const i=(n=e)[0]*n[3]-n[1]*n[2];var n;o(0!==i,32);const s=e[0],r=e[1],a=e[2],h=e[3],l=e[4],c=e[5];t[0]=h/i,t[1]=-r/i,t[2]=-a/i,t[3]=s/i,t[4]=(a*c-h*l)/i,t[5]=-(s*c-r*l)/i}(this.inversePixelTransform,this.pixelTransform);const s=function(t){const e="matrix("+t.join(", ")+")";if(ot)return e;const i=Fe||(Fe=document.createElement("div"));return i.style.transform=e,i.style.transform}(this.pixelTransform);this.useContainer(e,s,this.getBackground(t));const r=this.context,a=r.canvas,h=this.replayGroup_,l=this.declutterExecutorGroup;let c=h&&!h.isEmpty()||l&&!l.isEmpty();if(!c){if(!(this.getLayer().hasListener(fi)||this.getLayer().hasListener(_i)))return null}const u=Math.round(t.size[0]*i),d=Math.round(t.size[1]*i);a.width!=u||a.height!=d?(a.width=u,a.height=d,a.style.transform!==s&&(a.style.transform=s)):this.containerReused||r.clearRect(0,0,u,d),this.preRender(r,t);const g=t.viewState;g.projection,this.opacity_=n.opacity,this.setupCompositionContext_();let f=!1;if(c&&n.extent&&this.clipping){const e=he(n.extent);c=D(e,t.extent),f=c&&!m(e,t.extent),f&&this.clipUnrotated(this.compositionContext_,t,e)}return c&&this.renderWorlds(h,t),f&&this.compositionContext_.restore(),this.releaseCompositionContext_(),this.postRender(r,t),this.renderedRotation_!==g.rotation&&(this.renderedRotation_=g.rotation,this.hitDetectionImageData_=null),this.container}getFeatures(t){return new Promise((e=>{if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=[this.context.canvas.width,this.context.canvas.height];Te(this.pixelTransform,t);const e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,s=this.renderedProjection_,o=this.wrappedRenderedExtent_,r=this.getLayer(),a=[],h=t[0]*Us,l=t[1]*Us;a.push(this.getRenderTransform(e,i,n,Us,h,l,0).slice());const c=r.getSource(),u=s.getExtent();if(c.getWrapX()&&s.canWrapX()&&!m(u,o)){let t=o[0];const s=L(u);let r,c=0;for(;t<u[0];)--c,r=s*c,a.push(this.getRenderTransform(e,i,n,Us,h,l,r).slice()),t+=s;for(c=0,t=o[2];t>u[2];)++c,r=s*c,a.push(this.getRenderTransform(e,i,n,Us,h,l,r).slice()),t-=s}this.hitDetectionImageData_=function(t,e,i,n,s,o,r){const a=at(t[0]*Us,t[1]*Us);a.imageSmoothingEnabled=!1;const h=a.canvas,l=new js(a,Us,s,null,r),c=i.length,u=Math.floor(16777215/c),d={};for(let f=1;f<=c;++f){const t=i[f-1],e=t.getStyleFunction()||n;if(!e)continue;let r=e(t,o);if(!r)continue;Array.isArray(r)||(r=[r]);const a=(f*u).toString(16).padStart(7,"#00000");for(let i=0,n=r.length;i<n;++i){const e=r[i],n=e.getGeometryFunction()(t);if(!n||!D(s,n.getExtent()))continue;const o=e.clone(),h=o.getFill();h&&h.setColor(a);const l=o.getStroke();l&&(l.setColor(a),l.setLineDash(null)),o.setText(void 0);const c=e.getImage();if(c){const t=c.getImageSize();if(!t)continue;const e=at(t[0],t[1],void 0,{alpha:!1}),i=e.canvas;e.fillStyle=a,e.fillRect(0,0,i.width,i.height),o.setImage(new Kn({img:i,imgSize:t,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=o.getZIndex()||0;let g=d[u];g||(g={},d[u]=g,g.Polygon=[],g.Circle=[],g.LineString=[],g.Point=[]);const f=n.getType();if("GeometryCollection"===f){const t=n.getGeometriesArrayRecursive();for(let e=0,i=t.length;e<i;++e){const i=t[e];g[i.getType().replace("Multi","")].push(i,o)}}else g[f.replace("Multi","")].push(n,o)}}const g=Object.keys(d).map(Number).sort(X);for(let f=0,_=g.length;f<_;++f){const t=d[g[f]];for(const i in t){const n=t[i];for(let t=0,i=n.length;t<i;t+=2){l.setStyle(n[t+1]);for(let i=0,s=e.length;i<s;++i)l.setTransform(e[i]),l.drawGeometry(n[t])}}}return a.getImageData(0,0,h.width,h.height)}(t,a,this.renderedFeatures_,r.getStyleFunction(),o,i,n)}e(function(t,e,i){const n=[];if(i){const s=Math.floor(Math.round(t[0])*Us),o=Math.floor(Math.round(t[1])*Us),r=4*(Pt(s,0,i.width-1)+Pt(o,0,i.height-1)*i.width),a=i.data[r],h=i.data[r+1],l=i.data[r+2]+256*(h+256*a),c=Math.floor(16777215/e.length);l&&l%c==0&&n.push(e[l/c-1])}return n}(t,this.renderedFeatures_,this.hitDetectionImageData_))}))}forEachFeatureAtCoordinate(t,e,i,n,s){if(!this.replayGroup_)return;const o=e.viewState.resolution,r=e.viewState.rotation,a=this.getLayer(),h={},l=function(t,e,i){const o=et(t),r=h[o];if(r){if(!0!==r&&i<r.distanceSq){if(0===i)return h[o]=!0,s.splice(s.lastIndexOf(r),1),n(t,a,e);r.geometry=e,r.distanceSq=i}}else{if(0===i)return h[o]=!0,n(t,a,e);s.push(h[o]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}};let c;const u=[this.replayGroup_];return this.declutterExecutorGroup&&u.push(this.declutterExecutorGroup),u.some((n=>c=n.forEachFeatureAtCoordinate(t,o,r,i,l,n===this.declutterExecutorGroup&&e.declutterTree?e.declutterTree.all().map((t=>t.value)):null))),c}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[pi],s=t.viewHints[xi],o=e.getUpdateWhileAnimating(),r=e.getUpdateWhileInteracting();if(this.ready&&!o&&n||!r&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,h=t.viewState,l=h.projection,c=h.resolution,u=t.pixelRatio,d=e.getRevision(),f=e.getRenderBuffer();let _=e.getRenderOrder();void 0===_&&(_=Ks);const p=h.center.slice(),x=g(a,f*c),y=x.slice(),v=[x.slice()],S=l.getExtent();if(i.getWrapX()&&l.canWrapX()&&!m(S,t.extent)){const t=L(S),e=Math.max(L(x)/2,t);x[0]=S[0]-e,x[2]=S[2]+e,Xt(p,l);const i=G(v[0],l);i[0]<S[0]&&i[2]<S[2]?v.push([i[0]+t,i[1],i[2]+t,i[3]]):i[0]>S[0]&&i[2]>S[2]&&v.push([i[0]-t,i[1],i[2]-t,i[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedRevision_==d&&this.renderedRenderOrder_==_&&m(this.wrappedRenderedExtent_,x))return U(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=p,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const C=new ks(Hs(c,u),x,c,u);let w;this.getLayer().getDeclutter()&&(w=new ks(Hs(c,u),x,c,u));for(let g=0,m=v.length;g<m;++g)i.loadFeatures(v[g],c,l);const R=function(t,e){const i=Hs(t,e);return i*i}(c,u);let I=!0;const M=t=>{let i;const n=t.getStyleFunction()||e.getStyleFunction();if(n&&(i=n(t,c)),i){const e=this.renderFeature(t,R,i,C,undefined,w);I=I&&!e}},E=ae(x),T=i.getFeaturesInExtent(E);_&&T.sort(_);for(let g=0,m=T.length;g<m;++g)M(T[g]);this.renderedFeatures_=T,this.ready=I;const b=C.finish(),F=new Zs(x,c,u,i.getOverlaps(),b,e.getRenderBuffer());return w&&(this.declutterExecutorGroup=new Zs(x,c,u,i.getOverlaps(),w.finish(),e.getRenderBuffer())),this.renderedResolution_=c,this.renderedRevision_=d,this.renderedRenderOrder_=_,this.renderedExtent_=y,this.wrappedRenderedExtent_=x,this.renderedCenter_=p,this.renderedProjection_=l,this.replayGroup_=F,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,n,s,o){if(!i)return!1;let r=!1;if(Array.isArray(i))for(let a=0,h=i.length;a<h;++a)r=Js(n,t,i[a],e,this.boundHandleStyleImageChange_,s,o)||r;else r=Js(n,t,i,e,this.boundHandleStyleImageChange_,s,o);return r}};const to=class extends _s{constructor(t){super(t)}createRenderer(){return new $s(this)}},eo="singleclick",io="pointerdrag",no="pointermove",so="pointerdown",oo="pointerup",ro="active";const ao=class extends me{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(ro)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(ro,t)}setMap(t){this.map_=t}};const ho=class extends ao{constructor(t){super(t=t||{}),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==io)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==oo){const e=this.handleUpEvent(t);this.handlingDownUpSequence=e&&this.targetPointers.length>0}}else if(t.type==so){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==no&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}},lo=q,co=function(t){const e=t.originalEvent;return o(void 0!==e,56),e.isPrimary&&0===e.button},uo=[0,0,0,0],go=[],fo="modifystart",_o="modifyend";class mo extends Y{constructor(t,e,i){super(t),this.features=e,this.mapBrowserEvent=i}}function po(t,e){return t.index-e.index}function xo(t,e,i){const n=e.geometry;if("Circle"===n.getType()){let i=n;if(1===e.index){const e=Nt(i.getCenter(),re(t)),n=Math.sqrt(e)-i.getRadius();return n*n}}const s=re(t);return go[0]=re(e.segment[0]),go[1]=re(e.segment[1]),function(t,e){return Nt(t,Bt(t,e))}(s,go)}function yo(t,e,i){const n=e.geometry;if("Circle"===n.getType()&&1===e.index){return oe(n.getClosestPoint(re(t)))}const s=re(t);return go[0]=re(e.segment[0]),go[1]=re(e.segment[1]),oe(Bt(s,go))}function vo(){const t=function(){const t={},e=[255,255,255,1],i=[0,153,255,1];return t.Polygon=[new Qn({fill:new Yn({color:[255,255,255,.5]})})],t.MultiPolygon=t.Polygon,t.LineString=[new Qn({stroke:new Jn({color:e,width:5})}),new Qn({stroke:new Jn({color:i,width:3})})],t.MultiLineString=t.LineString,t.Circle=t.Polygon.concat(t.LineString),t.Point=[new Qn({image:new zn({radius:6,fill:new Yn({color:i}),stroke:new Jn({color:e,width:1.5})}),zIndex:1/0})],t.MultiPoint=t.Point,t.GeometryCollection=t.Polygon.concat(t.LineString,t.Point),t}();return function(e,i){return t.Point}}const So=class extends ho{constructor(t){let e;if(super(t),this.on,this.once,this.un,this.boundHandleFeatureChange_=this.handleFeatureChange_.bind(this),this.condition_=t.condition?t.condition:co,this.defaultDeleteCondition_=function(t){return function(t){const e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey}(t)&&function(t){return t.type==eo}(t)},this.deleteCondition_=t.deleteCondition?t.deleteCondition:this.defaultDeleteCondition_,this.insertVertexCondition_=t.insertVertexCondition?t.insertVertexCondition:lo,this.vertexFeature_=null,this.vertexSegments_=null,this.lastPixel_=[0,0],this.ignoreNextSingleClick_=!1,this.featuresBeingModified_=null,this.rBush_=new Ze,this.pixelTolerance_=void 0!==t.pixelTolerance?t.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new to({source:new ii({useSpatialIndex:!1,wrapX:!!t.wrapX}),style:t.style?t.style:vo(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.SEGMENT_WRITERS_={Point:this.writePointGeometry_.bind(this),LineString:this.writeLineStringGeometry_.bind(this),LinearRing:this.writeLineStringGeometry_.bind(this),Polygon:this.writePolygonGeometry_.bind(this),MultiPoint:this.writeMultiPointGeometry_.bind(this),MultiLineString:this.writeMultiLineStringGeometry_.bind(this),MultiPolygon:this.writeMultiPolygonGeometry_.bind(this),Circle:this.writeCircleGeometry_.bind(this),GeometryCollection:this.writeGeometryCollectionGeometry_.bind(this)},this.source_=null,this.hitDetection_=null,t.features?e=t.features:t.source&&(this.source_=t.source,e=new Ve(this.source_.getFeatures()),this.source_.addEventListener(je,this.handleSourceAdd_.bind(this)),this.source_.addEventListener(Ke,this.handleSourceRemove_.bind(this))),!e)throw new Error("The modify interaction requires features, a source or a layer");t.hitDetection&&(this.hitDetection_=t.hitDetection),this.features_=e,this.features_.forEach(this.addFeature_.bind(this)),this.features_.addEventListener(ze,this.handleFeatureAdd_.bind(this)),this.features_.addEventListener(Ne,this.handleFeatureRemove_.bind(this)),this.lastPointerEvent_=null,this.delta_=[0,0],this.snapToPointer_=void 0===t.snapToPointer?!this.hitDetection_:t.snapToPointer}addFeature_(t){const e=t.getGeometry();if(e){const i=this.SEGMENT_WRITERS_[e.getType()];i&&i(t,e)}const i=this.getMap();i&&i.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,i),t.addEventListener(W,this.boundHandleFeatureChange_)}willModifyFeatures_(t,e){if(!this.featuresBeingModified_){this.featuresBeingModified_=new Ve;const i=this.featuresBeingModified_.getArray();for(let t=0,n=e.length;t<n;++t){const n=e[t];for(let t=0,e=n.length;t<e;++t){const e=n[t].feature;e&&!i.includes(e)&&this.featuresBeingModified_.push(e)}}0===this.featuresBeingModified_.getLength()?this.featuresBeingModified_=null:this.dispatchEvent(new mo(fo,this.featuresBeingModified_,t))}}removeFeature_(t){this.removeFeatureSegmentData_(t),this.vertexFeature_&&0===this.features_.getLength()&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.removeEventListener(W,this.boundHandleFeatureChange_)}removeFeatureSegmentData_(t){const e=this.rBush_,i=[];e.forEach((function(e){t===e.feature&&i.push(e)}));for(let n=i.length-1;n>=0;--n){const t=i[n];for(let e=this.dragSegments_.length-1;e>=0;--e)this.dragSegments_[e][0]===t&&this.dragSegments_.splice(e,1);e.remove(t)}}setActive(t){this.vertexFeature_&&!t&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(t)}setMap(t){this.overlay_.setMap(t),super.setMap(t)}getOverlay(){return this.overlay_}handleSourceAdd_(t){t.feature&&this.features_.push(t.feature)}handleSourceRemove_(t){t.feature&&this.features_.remove(t.feature)}handleFeatureAdd_(t){this.addFeature_(t.element)}handleFeatureChange_(t){if(!this.changingFeature_){const e=t.target;this.removeFeature_(e),this.addFeature_(e)}}handleFeatureRemove_(t){this.removeFeature_(t.element)}writePointGeometry_(t,e){const i=e.getCoordinates(),n={feature:t,geometry:e,segment:[i,i]};this.rBush_.insert(e.getExtent(),n)}writeMultiPointGeometry_(t,e){const i=e.getCoordinates();for(let n=0,s=i.length;n<s;++n){const s=i[n],o={feature:t,geometry:e,depth:[n],index:n,segment:[s,s]};this.rBush_.insert(e.getExtent(),o)}}writeLineStringGeometry_(t,e){const i=e.getCoordinates();for(let n=0,s=i.length-1;n<s;++n){const s=i.slice(n,n+2),o={feature:t,geometry:e,index:n,segment:s};this.rBush_.insert(d(s),o)}}writeMultiLineStringGeometry_(t,e){const i=e.getCoordinates();for(let n=0,s=i.length;n<s;++n){const s=i[n];for(let i=0,o=s.length-1;i<o;++i){const o=s.slice(i,i+2),r={feature:t,geometry:e,depth:[n],index:i,segment:o};this.rBush_.insert(d(o),r)}}}writePolygonGeometry_(t,e){const i=e.getCoordinates();for(let n=0,s=i.length;n<s;++n){const s=i[n];for(let i=0,o=s.length-1;i<o;++i){const o=s.slice(i,i+2),r={feature:t,geometry:e,depth:[n],index:i,segment:o};this.rBush_.insert(d(o),r)}}}writeMultiPolygonGeometry_(t,e){const i=e.getCoordinates();for(let n=0,s=i.length;n<s;++n){const s=i[n];for(let i=0,o=s.length;i<o;++i){const o=s[i];for(let s=0,r=o.length-1;s<r;++s){const r=o.slice(s,s+2),a={feature:t,geometry:e,depth:[i,n],index:s,segment:r};this.rBush_.insert(d(r),a)}}}}writeCircleGeometry_(t,e){const i=e.getCenter(),n={feature:t,geometry:e,index:0,segment:[i,i]},s={feature:t,geometry:e,index:1,segment:[i,i]},o=[n,s];n.featureSegments=o,s.featureSegments=o,this.rBush_.insert(C(i),n);let r=e;this.rBush_.insert(r.getExtent(),s)}writeGeometryCollectionGeometry_(t,e){const i=e.getGeometriesArray();for(let n=0;n<i.length;++n){const e=i[n];(0,this.SEGMENT_WRITERS_[e.getType()])(t,e)}}createOrUpdateVertexFeature_(t,e,i){let n=this.vertexFeature_;if(n){n.getGeometry().setCoordinates(t)}else n=new Ee(new Be(t)),this.vertexFeature_=n,this.overlay_.getSource().addFeature(n);return n.set("features",e),n.set("geometries",i),n}handleEvent(t){if(!t.originalEvent)return!0;let e;return this.lastPointerEvent_=t,t.map.getView().getInteracting()||t.type!=no||this.handlingDownUpSequence||this.handlePointerMove_(t),this.vertexFeature_&&this.deleteCondition_(t)&&(e=!(t.type!=eo||!this.ignoreNextSingleClick_)||this.removePoint()),t.type==eo&&(this.ignoreNextSingleClick_=!1),super.handleEvent(t)&&!e}handleDragEvent(t){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(t,this.dragSegments_);const e=[t.coordinate[0]+this.delta_[0],t.coordinate[1]+this.delta_[1]],i=[],n=[];for(let s=0,o=this.dragSegments_.length;s<o;++s){const o=this.dragSegments_[s],r=o[0],a=r.feature;i.includes(a)||i.push(a);const h=r.geometry;n.includes(h)||n.push(h);const l=r.depth;let c;const u=r.segment,d=o[1];for(;e.length<h.getStride();)e.push(u[d][e.length]);switch(h.getType()){case"Point":c=e,u[0]=e,u[1]=e;break;case"MultiPoint":c=h.getCoordinates(),c[r.index]=e,u[0]=e,u[1]=e;break;case"LineString":c=h.getCoordinates(),c[r.index+d]=e,u[d]=e;break;case"MultiLineString":case"Polygon":c=h.getCoordinates(),c[l[0]][r.index+d]=e,u[d]=e;break;case"MultiPolygon":c=h.getCoordinates(),c[l[1]][l[0]][r.index+d]=e,u[d]=e;break;case"Circle":if(u[0]=e,u[1]=e,0===r.index)this.changingFeature_=!0,h.setCenter(e),this.changingFeature_=!1;else{this.changingFeature_=!0,t.map.getView().getProjection();let i=Yt(re(h.getCenter()),re(e));h.setRadius(i),this.changingFeature_=!1}}c&&this.setGeometryCoordinates_(h,c)}this.createOrUpdateVertexFeature_(e,i,n)}handleDownEvent(t){if(!this.condition_(t))return!1;const e=t.coordinate;this.handlePointerAtPixel_(t.pixel,t.map,e),this.dragSegments_.length=0,this.featuresBeingModified_=null;const i=this.vertexFeature_;if(i){t.map.getView().getProjection();const n=[],s=i.getGeometry().getCoordinates(),o=d([s]),r=this.rBush_.getInExtent(o),a={};r.sort(po);for(let i=0,h=r.length;i<h;++i){const o=r[i],h=o.segment;let l=et(o.geometry);const c=o.depth;if(c&&(l+="-"+c.join("-")),a[l]||(a[l]=new Array(2)),"Circle"!==o.geometry.getType()||1!==o.index)if(!zt(h[0],s)||a[l][0])if(!zt(h[1],s)||a[l][1])et(h)in this.vertexSegments_&&!a[l][0]&&!a[l][1]&&this.insertVertexCondition_(t)&&n.push(o);else{if(a[l][0]&&0===a[l][0].index){let t=o.geometry.getCoordinates();switch(o.geometry.getType()){case"LineString":case"MultiLineString":continue;case"MultiPolygon":t=t[c[1]];case"Polygon":if(o.index!==t[c[0]].length-2)continue}}this.dragSegments_.push([o,1]),a[l][1]=o}else this.dragSegments_.push([o,0]),a[l][0]=o;else{zt(yo(e,o),s)&&!a[l][0]&&(this.dragSegments_.push([o,0]),a[l][0]=o)}}n.length&&this.willModifyFeatures_(t,[n]);for(let t=n.length-1;t>=0;--t)this.insertVertex_(n[t],s)}return!!this.vertexFeature_}handleUpEvent(t){for(let e=this.dragSegments_.length-1;e>=0;--e){const t=this.dragSegments_[e][0],i=t.geometry;if("Circle"===i.getType()){const e=i.getCenter(),n=t.featureSegments[0],s=t.featureSegments[1];n.segment[0]=e,n.segment[1]=e,s.segment[0]=e,s.segment[1]=e,this.rBush_.update(C(e),n);let o=i;this.rBush_.update(o.getExtent(),s)}else this.rBush_.update(d(t.segment),t)}return this.featuresBeingModified_&&(this.dispatchEvent(new mo(_o,this.featuresBeingModified_,t)),this.featuresBeingModified_=null),!1}handlePointerMove_(t){this.lastPixel_=t.pixel,this.handlePointerAtPixel_(t.pixel,t.map,t.coordinate)}handlePointerAtPixel_(t,e,i){const n=i||e.getCoordinateFromPixel(t);e.getView().getProjection();const s=function(t,e){return xo(n,t)-xo(n,e)};let o,r;if(this.hitDetection_){const i="object"==typeof this.hitDetection_?t=>t===this.hitDetection_:void 0;e.forEachFeatureAtPixel(t,((t,e,i)=>{i&&(i=new Be(oe(i.getCoordinates())));const n=i||t.getGeometry();if("Point"===n.getType()&&t instanceof Ee&&this.features_.getArray().includes(t)){r=n;const e=t.getGeometry().getFlatCoordinates().slice(0,2);o=[{feature:t,geometry:r,segment:[e,e]}]}return!0}),{layerFilter:i})}if(!o){const t=ae(g(he(C(n,uo)),e.getView().getResolution()*this.pixelTolerance_,uo));o=this.rBush_.getInExtent(t)}if(o&&o.length>0){const i=o.sort(s)[0],a=i.segment;let h=yo(n,i);const l=e.getPixelFromCoordinate(h);let c=Yt(t,l);if(r||c<=this.pixelTolerance_){const t={};if(t[et(a)]=!0,this.snapToPointer_||(this.delta_[0]=h[0]-n[0],this.delta_[1]=h[1]-n[1]),"Circle"===i.geometry.getType()&&1===i.index)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(h,[i.feature],[i.geometry]);else{const n=e.getPixelFromCoordinate(a[0]),s=e.getPixelFromCoordinate(a[1]),r=Nt(l,n),u=Nt(l,s);c=Math.sqrt(Math.min(r,u)),this.snappedToVertex_=c<=this.pixelTolerance_,this.snappedToVertex_&&(h=r>u?a[1]:a[0]),this.createOrUpdateVertexFeature_(h,[i.feature],[i.geometry]);const d={};d[et(i.geometry)]=!0;for(let e=1,i=o.length;e<i;++e){const i=o[e].segment;if(!(zt(a[0],i[0])&&zt(a[1],i[1])||zt(a[0],i[1])&&zt(a[1],i[0])))break;{const n=et(o[e].geometry);n in d||(d[n]=!0,t[et(i)]=!0)}}}return void(this.vertexSegments_=t)}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)}insertVertex_(t,e){const i=t.segment,n=t.feature,s=t.geometry,o=t.depth,r=t.index;let a;for(;e.length<s.getStride();)e.push(0);switch(s.getType()){case"MultiLineString":case"Polygon":a=s.getCoordinates(),a[o[0]].splice(r+1,0,e);break;case"MultiPolygon":a=s.getCoordinates(),a[o[1]][o[0]].splice(r+1,0,e);break;case"LineString":a=s.getCoordinates(),a.splice(r+1,0,e);break;default:return}this.setGeometryCoordinates_(s,a);const h=this.rBush_;h.remove(t),this.updateSegmentIndices_(s,r,o,1);const l={segment:[i[0],e],feature:n,geometry:s,depth:o,index:r};h.insert(d(l.segment),l),this.dragSegments_.push([l,1]);const c={segment:[e,i[1]],feature:n,geometry:s,depth:o,index:r+1};h.insert(d(c.segment),c),this.dragSegments_.push([c,0]),this.ignoreNextSingleClick_=!0}removePoint(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=io){const t=this.lastPointerEvent_;this.willModifyFeatures_(t,this.dragSegments_);const e=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new mo(_o,this.featuresBeingModified_,t)),this.featuresBeingModified_=null,e}return!1}removeVertex_(){const t=this.dragSegments_,e={};let i,n,s,o,r,a,h,l,c,u,g,f=!1;for(r=t.length-1;r>=0;--r)s=t[r],u=s[0],g=et(u.feature),u.depth&&(g+="-"+u.depth.join("-")),g in e||(e[g]={}),0===s[1]?(e[g].right=u,e[g].index=u.index):1==s[1]&&(e[g].left=u,e[g].index=u.index+1);for(g in e){switch(c=e[g].right,h=e[g].left,a=e[g].index,l=a-1,u=void 0!==h?h:c,l<0&&(l=0),o=u.geometry,n=o.getCoordinates(),i=n,f=!1,o.getType()){case"MultiLineString":n[u.depth[0]].length>2&&(n[u.depth[0]].splice(a,1),f=!0);break;case"LineString":n.length>2&&(n.splice(a,1),f=!0);break;case"MultiPolygon":i=i[u.depth[1]];case"Polygon":i=i[u.depth[0]],i.length>4&&(a==i.length-1&&(a=0),i.splice(a,1),f=!0,0===a&&(i.pop(),i.push(i[0]),l=i.length-1))}if(f){this.setGeometryCoordinates_(o,n);const e=[];if(void 0!==h&&(this.rBush_.remove(h),e.push(h.segment[0])),void 0!==c&&(this.rBush_.remove(c),e.push(c.segment[1])),void 0!==h&&void 0!==c){const t={depth:u.depth,feature:u.feature,geometry:u.geometry,index:l,segment:e};this.rBush_.insert(d(t.segment),t)}this.updateSegmentIndices_(o,a,u.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.length=0}}return f}setGeometryCoordinates_(t,e){this.changingFeature_=!0,t.setCoordinates(e),this.changingFeature_=!1}updateSegmentIndices_(t,e,i,n){this.rBush_.forEachInExtent(t.getExtent(),(function(s){s.geometry===t&&(void 0===i||void 0===s.depth||U(s.depth,i))&&s.index>e&&(s.index+=n)}))}};export{zn as C,Yn as F,hs as L,So as M,Be as P,Wn as R,is as S,ss as T,ii as V,hn as _,un as a,cn as b,Jn as c,to as d,Ut as e,Kt as f,ln as g};