2 lines
282 KiB
JavaScript
2 lines
282 KiB
JavaScript
(self["webpackChunkhd_glasses_app"]=self["webpackChunkhd_glasses_app"]||[]).push([[10],{7010:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return Cu}});var n=function(){var t=this,e=t._self._c;return e("div",{attrs:{id:"content"}},[e("div",{ref:"map",staticStyle:{width:"100vw",height:"100vh"},attrs:{id:"map"}}),e("div",{attrs:{id:"overlay-box"}}),e("div",{staticClass:"actionList"},[e("van-grid",{attrs:{"column-num":3}},[e("van-grid-item",[e("van-button",{attrs:{size:"mini",type:"primary"},on:{click:function(e){t.canAddPoints=!0}}},[t._v("开始新增点位")])],1),e("van-grid-item",[e("van-button",{attrs:{size:"mini",type:"primary"},on:{click:function(e){t.canAddPoints=!1}}},[t._v("结束新增点位")])],1),e("van-grid-item",[e("van-button",{attrs:{size:"mini",type:"primary"},on:{click:t.clearPointsLayers}},[t._v("清除点位")])],1),e("van-grid-item",[e("van-button",{attrs:{size:"mini",type:"primary"},on:{click:function(e){return t.startAnimation()}}},[t._v("开始沿轨迹运动")])],1),e("van-grid-item",[e("van-button",{attrs:{size:"mini",type:"primary"},on:{click:function(e){return t.stopAnimation()}}},[t._v("结束沿轨迹运动")])],1)],1),e("br")],1)])},s=[];i(7658);class r{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}var o=r,a={PROPERTYCHANGE:"propertychange"};class h{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}var l=h;function c(t,e,i){let n,s;i=i||u;let r=0,o=t.length,a=!1;while(r<o)n=r+(o-r>>1),s=+i(t[n],e),s<0?r=n+1:(o=n,a=!s);return a?r:~r}function u(t,e){return t>e?1:t<e?-1:0}function d(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 g(t,e,i){while(e<i){const n=t[e];t[e]=t[i],t[i]=n,++e,--i}}function _(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 f(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 p(t,e,i){const n=e||u;return t.every((function(e,s){if(0===s)return!0;const r=n(t[s-1],e);return!(r>0||i&&0===r)}))}function m(){return!0}function y(){return!1}function v(){}function x(t){let e,i,n,s=!1;return function(){const r=Array.prototype.slice.call(arguments);return s&&this===n&&f(r,i)||(s=!0,n=this,i=r,e=t.apply(this,arguments)),e}}function E(t){for(const e in t)delete t[e]}function C(t){let e;for(e in t)return!1;return!e}class S extends l{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 o(t):t;s.target||(s.target=this.eventTarget_||this);const r=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});let h;i in r||(r[i]=0,a[i]=0),++r[i];for(let o=0,l=n.length;o<l;++o)if(h="handleEvent"in n[o]?n[o].handleEvent(s):n[o].call(this,s),!1===h||s.propagationStopped){h=!1;break}if(0===--r[i]){let t=a[i];delete a[i];while(t--)this.removeEventListener(i,v);delete r[i]}return h}disposeInternal(){this.listeners_&&E(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]=v,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}}}var w=S,R={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function T(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 r={target:t,type:e,listener:i};return t.addEventListener(e,i),r}function I(t,e,i,n){return T(t,e,i,n,!0)}function M(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),E(t))}class L extends w{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(R.CHANGE)}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]=T(this,t[s],e);return n}return T(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]=I(this,t[s],e)}else i=I(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)b(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)}}function b(t){if(Array.isArray(t))for(let e=0,i=t.length;e<i;++e)M(t[e]);else M(t)}L.prototype.on,L.prototype.once,L.prototype.un;var A=L;function O(){throw new Error("Unimplemented abstract method.")}let P=0;function D(t){return t.ol_uid||(t.ol_uid=String(++P))}class F extends o{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class k extends A{constructor(t){super(),this.on,this.once,this.un,D(this),this.values_=null,void 0!==t&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new F(i,t,e)),i=a.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new F(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],C(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}var N=k,G={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};function W(t,e){if(!t)throw new Error(e)}function z(t,e,i){return Math.min(Math.max(t,e),i)}function X(t,e,i,n,s,r){const o=s-i,a=r-n;if(0!==o||0!==a){const h=((t-i)*o+(e-n)*a)/(o*o+a*a);h>1?(i=s,n=r):h>0&&(i+=o*h,n+=a*h)}return Y(t,e,i,n)}function Y(t,e,i,n){const s=i-t,r=n-e;return s*s+r*r}function B(t){const e=t.length;for(let n=0;n<e;n++){let i=n,s=Math.abs(t[n][n]);for(let o=n+1;o<e;o++){const e=Math.abs(t[o][n]);e>s&&(s=e,i=o)}if(0===s)return null;const r=t[i];t[i]=t[n],t[n]=r;for(let o=n+1;o<e;o++){const i=-t[o][n]/t[n][n];for(let s=n;s<e+1;s++)n==s?t[o][s]=0:t[o][s]+=i*t[n][s]}}const i=new Array(e);for(let n=e-1;n>=0;n--){i[n]=t[n][e]/t[n][n];for(let s=n-1;s>=0;s--)t[s][e]-=t[s][n]*i[n]}return i}function K(t){return t*Math.PI/180}function V(t,e){const i=t%e;return i*e<0?i+e:i}function j(t,e,i){return t+i*(e-t)}function Z(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function U(t,e){return Math.floor(Z(t,e))}function H(t,e){return Math.ceil(Z(t,e))}class q extends N{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[G.OPACITY]=void 0!==t.opacity?t.opacity:1,W("number"===typeof e[G.OPACITY],"Layer opacity must be a number"),e[G.VISIBLE]=void 0===t.visible||t.visible,e[G.Z_INDEX]=t.zIndex,e[G.MAX_RESOLUTION]=void 0!==t.maxResolution?t.maxResolution:1/0,e[G.MIN_RESOLUTION]=void 0!==t.minResolution?t.minResolution:0,e[G.MIN_ZOOM]=void 0!==t.minZoom?t.minZoom:-1/0,e[G.MAX_ZOOM]=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=z(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 O()}getLayerStatesArray(t){return O()}getExtent(){return this.get(G.EXTENT)}getMaxResolution(){return this.get(G.MAX_RESOLUTION)}getMinResolution(){return this.get(G.MIN_RESOLUTION)}getMinZoom(){return this.get(G.MIN_ZOOM)}getMaxZoom(){return this.get(G.MAX_ZOOM)}getOpacity(){return this.get(G.OPACITY)}getSourceState(){return O()}getVisible(){return this.get(G.VISIBLE)}getZIndex(){return this.get(G.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(G.EXTENT,t)}setMaxResolution(t){this.set(G.MAX_RESOLUTION,t)}setMinResolution(t){this.set(G.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(G.MAX_ZOOM,t)}setMinZoom(t){this.set(G.MIN_ZOOM,t)}setOpacity(t){W("number"===typeof t,"Layer opacity must be a number"),this.set(G.OPACITY,t)}setVisible(t){this.set(G.VISIBLE,t)}setZIndex(t){this.set(G.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}var J=q,$={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"},Q={ANIMATING:0,INTERACTING:1},tt={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};const et=42,it=256;const nt={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class st{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_||nt[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_}}var rt=st;const ot=6378137,at=Math.PI*ot,ht=[-at,-at,at,at],lt=[-180,-85,180,85],ct=ot*Math.log(Math.tan(Math.PI/2));class ut extends rt{constructor(t){super({code:t,units:"m",extent:ht,global:!0,worldExtent:lt,getPointResolution:function(t,e){return t/Math.cosh(e[1]/ot)}})}}const dt=[new ut("EPSG:3857"),new ut("EPSG:102100"),new ut("EPSG:102113"),new ut("EPSG:900913"),new ut("http://www.opengis.net/def/crs/EPSG/0/3857"),new ut("http://www.opengis.net/gml/srs/epsg.xml#3857")];function gt(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]=at*t[s]/180;let i=ot*Math.log(Math.tan(Math.PI*(+t[s+1]+90)/360));i>ct?i=ct:i<-ct&&(i=-ct),e[s+1]=i}return e}function _t(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]/at,e[s+1]=360*Math.atan(Math.exp(t[s+1]/ot))/Math.PI-90;return e}const ft=6378137,pt=[-180,-90,180,90],mt=Math.PI*ft/180;class yt extends rt{constructor(t,e){super({code:t,units:"degrees",extent:pt,axisOrientation:e,global:!0,metersPerUnit:mt,worldExtent:pt})}}const vt=[new yt("CRS:84"),new yt("EPSG:4326","neu"),new yt("urn:ogc:def:crs:OGC:1.3:CRS84"),new yt("urn:ogc:def:crs:OGC:2:84"),new yt("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new yt("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new yt("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let xt={};function Et(t){return xt[t]||xt[t.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function Ct(t,e){xt[t]=e}let St={};function wt(t,e,i){const n=t.getCode(),s=e.getCode();n in St||(St[n]={}),St[n][s]=i}function Rt(t,e){let i;return t in St&&e in St[t]&&(i=St[t][e]),i}var Tt={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function It(t){const e=kt();for(let i=0,n=t.length;i<n;++i)Bt(e,t[i]);return e}function Mt(t,e,i){const n=Math.min.apply(null,t),s=Math.min.apply(null,e),r=Math.max.apply(null,t),o=Math.max.apply(null,e);return Nt(n,s,r,o,i)}function Lt(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 bt(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t.slice()}function At(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 Ot(t,e){return Dt(t,e[0],e[1])}function Pt(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function Dt(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function Ft(t,e){const i=t[0],n=t[1],s=t[2],r=t[3],o=e[0],a=e[1];let h=Tt.UNKNOWN;return o<i?h|=Tt.LEFT:o>s&&(h|=Tt.RIGHT),a<n?h|=Tt.BELOW:a>r&&(h|=Tt.ABOVE),h===Tt.UNKNOWN&&(h=Tt.INTERSECTING),h}function kt(){return[1/0,1/0,-1/0,-1/0]}function Nt(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 Gt(t){return Nt(1/0,1/0,-1/0,-1/0,t)}function Wt(t,e){const i=t[0],n=t[1];return Nt(i,n,i,n,e)}function zt(t,e,i,n,s){const r=Gt(s);return Kt(r,t,e,i,n)}function Xt(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function Yt(t,e){return e[0]<t[0]&&(t[0]=e[0]),e[2]>t[2]&&(t[2]=e[2]),e[1]<t[1]&&(t[1]=e[1]),e[3]>t[3]&&(t[3]=e[3]),t}function Bt(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 Kt(t,e,i,n,s){for(;i<n;i+=s)Vt(t,e[i],e[i+1]);return t}function Vt(t,e,i){t[0]=Math.min(t[0],e),t[1]=Math.min(t[1],i),t[2]=Math.max(t[2],e),t[3]=Math.max(t[3],i)}function jt(t,e){let i;return i=e(Ut(t)),i||(i=e(Ht(t)),i||(i=e(ne(t)),i||(i=e(ie(t)),i||!1)))}function Zt(t){let e=0;return oe(t)||(e=se(t)*te(t)),e}function Ut(t){return[t[0],t[1]]}function Ht(t){return[t[2],t[1]]}function qt(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function Jt(t,e){let i;if("bottom-left"===e)i=Ut(t);else if("bottom-right"===e)i=Ht(t);else if("top-left"===e)i=ie(t);else{if("top-right"!==e)throw new Error("Invalid corner");i=ne(t)}return i}function $t(t,e,i,n,s){const[r,o,a,h,l,c,u,d]=Qt(t,e,i,n);return Nt(Math.min(r,a,l,u),Math.min(o,h,c,d),Math.max(r,a,l,u),Math.max(o,h,c,d),s)}function Qt(t,e,i,n){const s=e*n[0]/2,r=e*n[1]/2,o=Math.cos(i),a=Math.sin(i),h=s*o,l=s*a,c=r*o,u=r*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]}function te(t){return t[3]-t[1]}function ee(t,e,i){const n=i||kt();return re(t,e)?(t[0]>e[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]<e[2]?n[2]=t[2]:n[2]=e[2],t[3]<e[3]?n[3]=t[3]:n[3]=e[3]):Gt(n),n}function ie(t){return[t[0],t[3]]}function ne(t){return[t[2],t[3]]}function se(t){return t[2]-t[0]}function re(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function oe(t){return t[2]<t[0]||t[3]<t[1]}function ae(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}function he(t,e,i){let n=!1;const s=Ft(t,e),r=Ft(t,i);if(s===Tt.INTERSECTING||r===Tt.INTERSECTING)n=!0;else{const o=t[0],a=t[1],h=t[2],l=t[3],c=e[0],u=e[1],d=i[0],g=i[1],_=(g-u)/(d-c);let f,p;r&Tt.ABOVE&&!(s&Tt.ABOVE)&&(f=d-(g-l)/_,n=f>=o&&f<=h),n||!(r&Tt.RIGHT)||s&Tt.RIGHT||(p=g-(d-h)*_,n=p>=a&&p<=l),n||!(r&Tt.BELOW)||s&Tt.BELOW||(f=d-(g-a)/_,n=f>=o&&f<=h),n||!(r&Tt.LEFT)||s&Tt.LEFT||(p=g-(d-o)*_,n=p>=a&&p<=l)}return n}function le(t,e,i,n){if(oe(t))return Gt(i);let s=[];if(n>1){const e=t[2]-t[0],i=t[3]-t[1];for(let r=0;r<n;++r)s.push(t[0]+e*r/n,t[1],t[2],t[1]+i*r/n,t[2]-e*r/n,t[3],t[0],t[3]-i*r/n)}else s=[t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]];e(s,s,2);const r=[],o=[];for(let a=0,h=s.length;a<h;a+=2)r.push(s[a]),o.push(s[a+1]);return Mt(r,o,i)}function ce(t,e){const i=e.getExtent(),n=qt(t);if(e.canWrapX()&&(n[0]<i[0]||n[0]>=i[2])){const e=se(i),s=Math.floor((n[0]-i[0])/e),r=s*e;t[0]-=r,t[2]-=r}return t}function ue(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]]];ce(t,e);const n=se(i);if(se(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]}function de(t,e){return t[0]+=+e[0],t[1]+=+e[1],t}function ge(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 _e(t,e){const i=Math.cos(e),n=Math.sin(e),s=t[0]*i-t[1]*n,r=t[1]*i+t[0]*n;return t[0]=s,t[1]=r,t}function fe(t,e){return t[0]*=e,t[1]*=e,t}function pe(t,e){if(e.canWrapX()){const i=se(e.getExtent()),n=me(t,e,i);n&&(t[0]-=n*i)}return t}function me(t,e,i){const n=e.getExtent();let s=0;return e.canWrapX()&&(t[0]<n[0]||t[0]>n[2])&&(i=i||se(n),s=Math.floor((t[0]-n[0])/i)),s}const ye=6371008.8;function ve(t,e,i){i=i||ye;const n=K(t[1]),s=K(e[1]),r=(s-n)/2,o=K(e[0]-t[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(s);return 2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}const xe={info:1,warn:2,error:3,none:4};let Ee=xe.info;function Ce(...t){Ee>xe.warn||console.warn(...t)}let Se=!0;function we(t){const e=void 0===t||t;Se=!e}function Re(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 Te(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 Ie(t){Ct(t.getCode(),t),wt(t,t,Re)}function Me(t){t.forEach(Ie)}function Le(t){return"string"===typeof t?Et(t):t||null}function be(t,e,i,n){let s;t=Le(t);const r=t.getPointResolutionFunc();if(r){if(s=r(e,i),n&&n!==t.getUnits()){const e=t.getMetersPerUnit();e&&(s=s*e/nt[n])}}else{const r=t.getUnits();if("degrees"==r&&!n||"degrees"==n)s=e;else{const o=Fe(t,Le("EPSG:4326"));if(o===Te&&"degrees"!==r)s=e*t.getMetersPerUnit();else{let t=[i[0]-e/2,i[1],i[0]+e/2,i[1],i[0],i[1]-e/2,i[0],i[1]+e/2];t=o(t,t,2);const n=ve(t.slice(0,2),t.slice(2,4)),r=ve(t.slice(4,6),t.slice(6,8));s=(n+r)/2}const a=n?nt[n]:t.getMetersPerUnit();void 0!==a&&(s/=a)}}return s}function Ae(t){Me(t),t.forEach((function(e){t.forEach((function(t){e!==t&&wt(e,t,Re)}))}))}function Oe(t,e,i,n){t.forEach((function(t){e.forEach((function(e){wt(t,e,i),wt(e,t,n)}))}))}function Pe(t,e){return t?"string"===typeof t?Le(t):t:Le(e)}function De(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();if(t.getCode()===e.getCode())return i;const n=Fe(t,e);return n===Re&&i}function Fe(t,e){const i=t.getCode(),n=e.getCode();let s=Rt(i,n);return s||(s=Te),s}function ke(t,e){const i=Le(t),n=Le(e);return Fe(i,n)}function Ne(t,e,i){const n=ke(e,i);return n(t,void 0,t.length)}function Ge(t,e,i,n){const s=ke(e,i);return le(t,s,void 0,n)}let We=null;function ze(){return We}function Xe(t,e){return We?Ne(t,e,We):t}function Ye(t,e){return We?Ne(t,We,e):(Se&&!ge(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(Se=!1,Ce("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t)}function Be(t,e){return We?Ge(t,e,We):t}function Ke(t,e){return We?Ge(t,We,e):t}function Ve(t,e){if(!We)return t;const i=Le(e).getUnits(),n=We.getUnits();return i&&n?t*nt[i]/nt[n]:t}function je(){Ae(dt),Ae(vt),Oe(vt,dt,gt,_t)}function Ze(t,e,i){return function(n,s,r,o,a){if(!n)return;if(!s&&!e)return n;const h=e?0:r[0]*s,l=e?0:r[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,_=t[1]+l/2+u,f=t[3]-l/2+u;d>g&&(d=(g+d)/2,g=d),_>f&&(_=(f+_)/2,f=_);let p=z(n[0],d,g),m=z(n[1],_,f);if(o&&i&&s){const t=30*s;p+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-g)/t),m+=-t*Math.log(1+Math.max(0,_-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-f)/t)}return[p,m]}}function Ue(t){return t}function He(t,e,i,n){const s=se(e)/i[0],r=te(e)/i[1];return n?Math.min(t,Math.max(s,r)):Math.min(t,Math.min(s,r))}function qe(t,e,i){let n=Math.min(t,e);const s=50;return n*=Math.log(1+s*Math.max(0,t/e-1))/s+1,i&&(n=Math.max(n,i),n/=Math.log(1+s*Math.max(0,i/t-1))/s+1),z(n,i/2,2*e)}function Je(t,e,i,n){return e=void 0===e||e,function(s,r,o,a){if(void 0!==s){const h=t[0],l=t[t.length-1],c=i?He(h,i,o,n):h;if(a)return e?qe(s,c,l):z(s,l,c);const u=Math.min(c,s),g=Math.floor(d(t,u,r));return t[g]>c&&g<t.length-1?t[g+1]:t[g]}}}function $e(t,e,i,n,s,r){return n=void 0===n||n,i=void 0!==i?i:0,function(o,a,h,l){if(void 0!==o){const c=s?He(e,s,h,r):e;if(l)return n?qe(o,c,i):z(o,i,c);const u=1e-9,d=Math.ceil(Math.log(e/c)/Math.log(t)-u),g=-a*(.5-u)+.5,_=Math.min(c,o),f=Math.floor(Math.log(e/_)/Math.log(t)+g),p=Math.max(d,f),m=e/Math.pow(t,p);return z(m,i,c)}}}function Qe(t,e,i,n,s){return i=void 0===i||i,function(r,o,a,h){if(void 0!==r){const o=n?He(t,n,a,s):t;return i&&h?qe(r,o,e):z(r,e,o)}}}function ti(t){if(void 0!==t)return 0}function ei(t){if(void 0!==t)return t}function ii(t){const e=2*Math.PI/t;return function(t,i){return i?t:void 0!==t?(t=Math.floor(t/e+.5)*e,t):void 0}}function ni(t){return t=t||K(5),function(e,i){return i?e:void 0!==e?Math.abs(e)<=t?0:e:void 0}}function si(t){return Math.pow(t,3)}function ri(t){return 1-si(1-t)}function oi(t){return 3*t*t-2*t*t*t}function ai(t){return t}je();const hi="undefined"!==typeof navigator&&"undefined"!==typeof navigator.userAgent?navigator.userAgent.toLowerCase():"",li=hi.includes("firefox"),ci=hi.includes("safari")&&!hi.includes("chrom"),ui=(ci&&(hi.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(hi)),hi.includes("webkit")&&!hi.includes("edge")),di=hi.includes("macintosh"),gi="undefined"!==typeof devicePixelRatio?devicePixelRatio:1,_i="undefined"!==typeof WorkerGlobalScope&&"undefined"!==typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,fi="undefined"!==typeof Image&&Image.prototype.decode,pi=function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch(e){}return t}();new Array(6);function mi(){return[1,0,0,1,0,0]}function yi(t,e){const i=t[0],n=t[1],s=t[2],r=t[3],o=t[4],a=t[5],h=e[0],l=e[1],c=e[2],u=e[3],d=e[4],g=e[5];return t[0]=i*h+s*l,t[1]=n*h+r*l,t[2]=i*c+s*u,t[3]=n*c+r*u,t[4]=i*d+s*g+o,t[5]=n*d+r*g+a,t}function vi(t,e,i,n,s,r,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=s,t[4]=r,t[5]=o,t}function xi(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function Ei(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 Ci(t,e,i){return vi(t,e,0,0,i,0,0)}function Si(t,e,i,n,s,r,o,a){const h=Math.sin(r),l=Math.cos(r);return t[0]=n*l,t[1]=s*h,t[2]=-n*h,t[3]=s*l,t[4]=o*n*l-a*n*h+e,t[5]=o*s*h+a*s*l+i,t}function wi(t,e){const i=Ri(e);W(0!==i,"Transformation matrix cannot be inverted");const n=e[0],s=e[1],r=e[2],o=e[3],a=e[4],h=e[5];return t[0]=o/i,t[1]=-s/i,t[2]=-r/i,t[3]=n/i,t[4]=(r*h-o*a)/i,t[5]=-(n*h-s*a)/i,t}function Ri(t){return t[0]*t[3]-t[1]*t[2]}let Ti;function Ii(t){const e="matrix("+t.join(", ")+")";if(_i)return e;const i=Ti||(Ti=document.createElement("div"));return i.style.transform=e,i.style.transform}function Mi(t,e,i,n,s,r){r=r||[];let o=0;for(let a=e;a<i;a+=n){const e=t[a],i=t[a+1];r[o++]=s[0]*e+s[2]*i+s[4],r[o++]=s[1]*e+s[3]*i+s[5]}return r&&r.length!=o&&(r.length=o),r}function Li(t,e,i,n,s,r,o){o=o||[];const a=Math.cos(s),h=Math.sin(s),l=r[0],c=r[1];let u=0;for(let d=e;d<i;d+=n){const e=t[d]-l,i=t[d+1]-c;o[u++]=l+e*a-i*h,o[u++]=c+e*h+i*a;for(let s=d+2;s<d+n;++s)o[u++]=t[s]}return o&&o.length!=u&&(o.length=u),o}function bi(t,e,i,n,s,r,o,a){a=a||[];const h=o[0],l=o[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+r*i;for(let s=u+2;s<u+n;++s)a[c++]=t[s]}return a&&a.length!=c&&(a.length=c),a}function Ai(t,e,i,n,s,r,o){o=o||[];let a=0;for(let h=e;h<i;h+=n){o[a++]=t[h]+s,o[a++]=t[h+1]+r;for(let e=h+2;e<h+n;++e)o[a++]=t[e]}return o&&o.length!=a&&(o.length=a),o}const Oi=mi();class Pi extends N{constructor(){super(),this.extent_=kt(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=x((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 O()}closestPointXY(t,e,i,n){return O()}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 O()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&Gt(t),this.extentRevision_=this.getRevision()}return ae(this.extent_,t)}rotate(t,e){O()}scale(t,e,i){O()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return O()}getType(){return O()}applyTransform(t){O()}intersectsExtent(t){return O()}translate(t,e){O()}transform(t,e){const i=Le(t),n="tile-pixels"==i.getUnits()?function(t,n,s){const r=i.getExtent(),o=i.getWorldExtent(),a=te(o)/te(r);return Si(Oi,o[0],o[3],a,-a,0,0,0),Mi(t,0,t.length,s,Oi,n),ke(i,e)(t,n,s)}:ke(i,e);return this.applyTransform(n),this}}var Di=Pi;class Fi extends Di{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates=null}computeExtent(t){return zt(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return O()}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),i=e.getFlatCoordinates();return i.length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=Ni(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){O()}setLayout(t,e,i){let n;if(t)n=Ni(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=ki(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();Li(i,0,i.length,n,t,e,i),this.changed()}}scale(t,e,i){void 0===e&&(e=t),i||(i=qt(this.getExtent()));const n=this.getFlatCoordinates();if(n){const s=this.getStride();bi(n,0,n.length,s,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();Ai(i,0,i.length,n,t,e,i),this.changed()}}}function ki(t){let e;return 2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM"),e}function Ni(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}function Gi(t,e,i){const n=t.getFlatCoordinates();if(!n)return null;const s=t.getStride();return Mi(n,0,n.length,s,e,i)}var Wi=Fi;function zi(t,e,i,n,s,r,o){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+(r-h)*c)/(l*l+c*c);if(d>1)u=i;else{if(d>0){for(let s=0;s<n;++s)o[s]=j(t[e+s],t[i+s],d);return void(o.length=n)}u=e}}for(let d=0;d<n;++d)o[d]=t[u+d];o.length=n}function Xi(t,e,i,n,s){let r=t[e],o=t[e+1];for(e+=n;e<i;e+=n){const i=t[e],n=t[e+1],a=Y(r,o,i,n);a>s&&(s=a),r=i,o=n}return s}function Yi(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];s=Xi(t,e,o,n,s),e=o}return s}function Bi(t,e,i,n,s,r,o,a,h,l,c){if(e==i)return l;let u,d;if(0===s){if(d=Y(o,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;while(g<i)if(zi(t,g-n,g,n,o,a,c),d=Y(o,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(r&&(zi(t,i-n,e,n,o,a,c),d=Y(o,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 Ki(t,e,i,n,s,r,o,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,r,o,a,h,l,c),e=d}return l}function Vi(t,e,i,n){for(let s=0,r=i.length;s<r;++s)t[e++]=i[s];return e}function ji(t,e,i,n){for(let s=0,r=i.length;s<r;++s){const r=i[s];for(let i=0;i<n;++i)t[e++]=r[i]}return e}function Zi(t,e,i,n,s){s=s||[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=ji(t,e,i[o],n);s[r++]=a,e=a}return s.length=r,s}function Ui(t,e,i,n,s,r,o){const a=(i-e)/n;if(a<3){for(;e<i;e+=n)r[o++]=t[e],r[o++]=t[e+1];return o}const h=new Array(a);h[0]=1,h[a-1]=1;const l=[e,i-n];let c=0;while(l.length>0){const i=l.pop(),r=l.pop();let o=0;const a=t[r],u=t[r+1],d=t[i],g=t[i+1];for(let e=r+n;e<i;e+=n){const i=t[e],n=t[e+1],s=X(i,n,a,u,d,g);s>o&&(c=e,o=s)}o>s&&(h[(c-e)/n]=1,r+n<c&&l.push(r,c),c+n<i&&l.push(c,i))}for(let u=0;u<a;++u)h[u]&&(r[o++]=t[e+u*n],r[o++]=t[e+u*n+1]);return o}function Hi(t,e){return e*Math.round(t/e)}function qi(t,e,i,n,s,r,o){if(e==i)return o;let a,h,l=Hi(t[e],s),c=Hi(t[e+1],s);e+=n,r[o++]=l,r[o++]=c;do{if(a=Hi(t[e],s),h=Hi(t[e+1],s),e+=n,e==i)return r[o++]=a,r[o++]=h,o}while(a==l&&h==c);while(e<i){const i=Hi(t[e],s),u=Hi(t[e+1],s);if(e+=n,i==a&&u==h)continue;const d=a-l,g=h-c,_=i-l,f=u-c;d*f==g*_&&(d<0&&_<d||d==_||d>0&&_>d)&&(g<0&&f<g||g==f||g>0&&f>g)?(a=i,h=u):(r[o++]=a,r[o++]=h,l=a,c=h,a=i,h=u)}return r[o++]=a,r[o++]=h,o}function Ji(t,e,i,n,s,r,o,a){for(let h=0,l=i.length;h<l;++h){const l=i[h];o=qi(t,e,l,n,s,r,o),a.push(o),e=l}return o}function $i(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=e;o<i;o+=n)s[r++]=t.slice(o,o+n);return s.length=r,s}function Qi(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];s[r++]=$i(t,e,a,n,s[r]),e=a}return s.length=r,s}function tn(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];s[r++]=1===a.length&&a[0]===e?[]:Qi(t,e,a,n,s[r]),e=a[a.length-1]}return s.length=r,s}function en(t,e,i,n){let s=0,r=t[i-n],o=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];s+=o*i-r*n,r=i,o=n}return s/2}function nn(t,e,i,n){let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r];s+=en(t,e,o,n),e=o}return s}class sn extends Wi{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 sn(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<At(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Xi(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 en(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return $i(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=Ui(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new sn(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ji(this.flatCoordinates,0,t,this.stride),this.changed()}}var rn=sn;class on extends Wi{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new on(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const s=this.flatCoordinates,r=Y(t,e,s[0],s[1]);if(r<n){const t=this.stride;for(let e=0;e<t;++e)i[e]=s[e];return i.length=t,r}return n}getCoordinates(){return this.flatCoordinates?this.flatCoordinates.slice():[]}computeExtent(t){return Wt(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Dt(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Vi(this.flatCoordinates,0,t,this.stride),this.changed()}}var an=on;function hn(t,e,i,n,s){const r=jt(s,(function(s){return!ln(t,e,i,n,s[0],s[1])}));return!r}function ln(t,e,i,n,s,r){let o=0,a=t[i-n],h=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];h<=r?n>r&&(i-a)*(r-h)-(s-a)*(n-h)>0&&o++:n<=r&&(i-a)*(r-h)-(s-a)*(n-h)<0&&o--,a=i,h=n}return 0!==o}function cn(t,e,i,n,s,r){if(0===i.length)return!1;if(!ln(t,e,i[0],n,s,r))return!1;for(let o=1,a=i.length;o<a;++o)if(ln(t,i[o-1],i[o],n,s,r))return!1;return!0}function un(t,e,i,n,s,r,o){let a,h,l,c,d,g,_;const f=s[r+1],p=[];for(let u=0,v=i.length;u<v;++u){const s=i[u];for(c=t[s-n],g=t[s-n+1],a=e;a<s;a+=n)d=t[a],_=t[a+1],(f<=g&&_<=f||g<=f&&f<=_)&&(l=(f-g)/(_-g)*(d-c)+c,p.push(l)),c=d,g=_}let m=NaN,y=-1/0;for(p.sort(u),c=p[0],a=1,h=p.length;a<h;++a){d=p[a];const s=Math.abs(d-c);s>y&&(l=(c+d)/2,cn(t,e,i,n,l,f)&&(m=l,y=s)),c=d}return isNaN(m)&&(m=s[r]),o?(o.push(m,f,y),o):[m,f,y]}function dn(t,e,i,n,s){let r;for(e+=n;e<i;e+=n)if(r=s(t.slice(e-n,e),t.slice(e,e+n)),r)return r;return!1}function gn(t,e,i,n,s){const r=Kt(kt(),t,e,i,n);return!!re(s,r)&&(!!Pt(s,r)||(r[0]>=s[0]&&r[2]<=s[2]||(r[1]>=s[1]&&r[3]<=s[3]||dn(t,e,i,n,(function(t,e){return he(s,t,e)})))))}function _n(t,e,i,n,s){return!!gn(t,e,i,n,s)||(!!ln(t,e,i,n,s[0],s[1])||(!!ln(t,e,i,n,s[0],s[3])||(!!ln(t,e,i,n,s[2],s[1])||!!ln(t,e,i,n,s[2],s[3]))))}function fn(t,e,i,n,s){if(!_n(t,e,i[0],n,s))return!1;if(1===i.length)return!0;for(let r=1,o=i.length;r<o;++r)if(hn(t,i[r-1],i[r],n,s)&&!gn(t,i[r-1],i[r],n,s))return!1;return!0}function pn(t,e,i,n){while(e<i-n){for(let s=0;s<n;++s){const r=t[e+s];t[e+s]=t[i-n+s],t[i-n+s]=r}e+=n,i-=n}}function mn(t,e,i,n){let s=0,r=t[i-n],o=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];s+=(i-r)*(n+o),r=i,o=n}return 0===s?void 0:s>0}function yn(t,e,i,n,s){s=void 0!==s&&s;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=mn(t,e,o,n);if(0===r){if(s&&a||!s&&!a)return!1}else if(s&&!a||!s&&a)return!1;e=o}return!0}function vn(t,e,i,n,s){s=void 0!==s&&s;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=mn(t,e,o,n),h=0===r?s&&a||!s&&!a:s&&!a||!s&&a;h&&pn(t,e,o,n),e=o}return e}class xn extends Wi{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?_(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new xn(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<At(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Yi(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ki(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return cn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return nn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),vn(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,Qi(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=qt(this.getExtent());this.flatInteriorPoint_=un(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new an(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new rn(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,n=[];let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=new rn(e.slice(s,o),t);n.push(a),s=o}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;yn(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=vn(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Ji(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new xn(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return fn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=Zi(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}var En=xn;function Cn(t){if(oe(t))throw new Error("Cannot create polygon from empty extent");const e=t[0],i=t[1],n=t[2],s=t[3],r=[e,i,e,s,n,s,n,i,e,i];return new xn(r,"XY",[r.length])}const Sn=0;class wn extends N{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Pe(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&&we(),t.center&&(t.center=Ye(t.center,this.projection_)),t.extent&&(t.extent=Ke(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const o in tt)delete e[o];this.setProperties(e,!0);const i=In(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=Tn(t),s=i.constraint,r=Mn(t);this.constraints_={center:n,resolution:s,rotation:r},this.setRotation(void 0!==t.rotation?t.rotation:0),this.setCenterInternal(void 0!==t.center?t.center:null),void 0!==t.resolution?this.setResolution(t.resolution):void 0!==t.zoom&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const n=t||[0,0,0,0];e=e||[0,0,0,0];const s=this.getResolution(),r=s/2*(n[3]-e[3]+e[1]-n[1]),o=s/2*(n[0]-e[0]+e[2]-n[2]);this.setCenterInternal([i[0]+r,i[1]-o])}}getUpdatedOptions_(t){const e=this.getProperties();return void 0!==e.resolution?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let i=0;i<e.length;++i){let t=arguments[i];t.center&&(t=Object.assign({},t),t.center=Ye(t.center,this.getProjection())),t.anchor&&(t=Object.assign({},t),t.anchor=Ye(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&&Rn(e,!0));let s=Date.now(),r=this.targetCenter_.slice(),o=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||oi,callback:e};if(t.center&&(i.sourceCenter=r,i.targetCenter=t.center.slice(),r=i.targetCenter),void 0!==t.zoom?(i.sourceResolution=o,i.targetResolution=this.getResolutionForZoom(t.zoom),o=i.targetResolution):t.resolution&&(i.sourceResolution=o,i.targetResolution=t.resolution,o=i.targetResolution),void 0!==t.rotation){i.sourceRotation=a;const e=V(t.rotation-a+Math.PI,2*Math.PI)-Math.PI;i.targetRotation=a+e,a=i.targetRotation}Ln(i)?i.complete=!0:s+=i.duration,h.push(i)}this.animations_.push(h),this.setHint(Q.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Q.ANIMATING]>0}getInteracting(){return this.hints_[Q.INTERACTING]>0}cancelAnimations(){let t;this.setHint(Q.ANIMATING,-this.hints_[Q.ANIMATING]);for(let e=0,i=this.animations_.length;e<i;++e){const i=this.animations_[e];if(i[0].callback&&Rn(i[0].callback,!1),!t)for(let e=0,n=i.length;e<n;++e){const n=i[e];if(!n.complete){t=n.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const n=this.animations_[i];let s=!0;for(let i=0,r=n.length;i<r;++i){const r=n[i];if(r.complete)continue;const o=t-r.start;let a=r.duration>0?o/r.duration:1;a>=1?(r.complete=!0,a=1):s=!1;const h=r.easing(a);if(r.sourceCenter){const t=r.sourceCenter[0],e=r.sourceCenter[1],i=r.targetCenter[0],n=r.targetCenter[1];this.nextCenter_=r.targetCenter;const s=t+h*(i-t),o=e+h*(n-e);this.targetCenter_=[s,o]}if(r.sourceResolution&&r.targetResolution){const t=1===h?r.targetResolution:r.sourceResolution+h*(r.targetResolution-r.sourceResolution);if(r.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,r.anchor)}this.nextResolution_=r.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==r.sourceRotation&&void 0!==r.targetRotation){const t=1===h?V(r.targetRotation+Math.PI,2*Math.PI)-Math.PI:r.sourceRotation+h*(r.targetRotation-r.sourceRotation);if(r.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,r.anchor)}this.nextRotation_=r.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!r.complete)break}if(s){this.animations_[i]=null,this.setHint(Q.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&Rn(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();return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],_e(i,t-this.getRotation()),de(i,e)),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),s=this.getResolution();if(void 0!==n&&void 0!==s){const r=e[0]-t*(e[0]-n[0])/s,o=e[1]-t*(e[1]-n[1])/s;i=[r,o]}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?Xe(t,this.getProjection()):t}getCenterInternal(){return this.get(tt.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){const e=this.calculateExtentInternal(t);return Be(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();W(e,"The view center is not defined");const i=this.getResolution();W(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return W(void 0!==n,"The view rotation is not defined"),$t(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(tt.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Ke(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=se(t)/e[0],n=te(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){const s=e/Math.pow(t,i*n);return s}}getRotation(){return this.get(tt.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){const n=Math.log(i/t)/e/s;return n}}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=bn(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=d(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=z(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,z(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(W(Array.isArray(t)||"function"===typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){W(!oe(t),"Cannot fit empty extent provided as `geometry`");const e=Ke(t,this.getProjection());i=Cn(e)}else if("Circle"===t.getType()){const e=Ke(t.getExtent(),this.getProjection());i=Cn(e),i.rotate(this.getRotation(),qt(e))}else{const e=ze();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),s=t.getFlatCoordinates(),r=t.getStride();let o=1/0,a=1/0,h=-1/0,l=-1/0;for(let c=0,u=s.length;c<u;c+=r){const t=s[c]*i-s[c+1]*n,e=s[c]*n+s[c+1]*i;o=Math.min(o,t),a=Math.min(a,e),h=Math.max(h,t),l=Math.max(l,e)}return[o,a,h,l]}fitInternal(t,e){e=e||{};let i=e.size;i||(i=this.getViewportSizeMinusPadding_());const n=void 0!==e.padding?e.padding:[0,0,0,0],s=void 0!==e.nearest&&e.nearest;let r;r=void 0!==e.minResolution?e.minResolution:void 0!==e.maxZoom?this.getResolutionForZoom(e.maxZoom):0;const o=this.rotatedExtentForGeometry(t);let a=this.getResolutionForExtentInternal(o,[i[0]-n[1]-n[3],i[1]-n[0]-n[2]]);a=isNaN(a)?r:Math.max(a,r),a=this.getConstrainedResolution(a,s?0:1);const h=this.getRotation(),l=Math.sin(h),c=Math.cos(h),u=qt(o);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,_=this.getConstrainedCenter([d,g],a),f=e.callback?e.callback:v;void 0!==e.duration?this.animateInternal({resolution:a,center:_,duration:e.duration,easing:e.easing},f):(this.targetResolution_=a,this.targetCenter_=_,this.applyTargetState_(!1,!0),Rn(f,!0))}centerOn(t,e,i){this.centerOnInternal(Ye(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(bn(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,n){let s;const r=this.padding_;if(r&&t){const o=this.getViewportSizeMinusPadding_(-i),a=bn(t,n,[o[0]/2+r[3],o[1]/2+r[0]],e,i);s=[t[0]-a[0],t[1]-a[1]]}return s}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(t){const e=Xe(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&&Ye(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=Ye(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?Ye(t,this.getProjection()):t)}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,n=this.constraints_.rotation(this.targetRotation_,i),s=this.getViewportSize_(n),r=this.constraints_.resolution(this.targetResolution_,0,s,i),o=this.constraints_.center(this.targetCenter_,r,s,i,this.calculateCenterShift(this.targetCenter_,r,n,s));this.get(tt.ROTATION)!==n&&this.set(tt.ROTATION,n),this.get(tt.RESOLUTION)!==r&&(this.set(tt.RESOLUTION,r),this.set("zoom",this.getZoom(),!0)),o&&this.get(tt.CENTER)&&ge(this.get(tt.CENTER),o)||this.set(tt.CENTER,o),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=void 0!==t?t:200;const n=e||0,s=this.constraints_.rotation(this.targetRotation_),r=this.getViewportSize_(s),o=this.constraints_.resolution(this.targetResolution_,n,r),a=this.constraints_.center(this.targetCenter_,o,r,!1,this.calculateCenterShift(this.targetCenter_,o,s,r));if(0===t&&!this.cancelAnchor_)return this.targetResolution_=o,this.targetRotation_=s,this.targetCenter_=a,void this.applyTargetState_();i=i||(0===t?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===o&&this.getRotation()===s&&this.getCenterInternal()&&ge(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:a,resolution:o,duration:t,easing:ri,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Q.INTERACTING,1)}endInteraction(t,e,i){i=i&&Ye(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(Q.INTERACTING,-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)}}function Rn(t,e){setTimeout((function(){t(e)}),0)}function Tn(t){if(void 0!==t.extent){const e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return Ze(t.extent,t.constrainOnlyCenter,e)}const e=Pe(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,Ze(t,!1,!1)}return Ue}function In(t){let e,i,n;const s=28,r=2;let o=void 0!==t.minZoom?t.minZoom:Sn,a=void 0!==t.maxZoom?t.maxZoom:s;const h=void 0!==t.zoomFactor?t.zoomFactor:r,l=void 0!==t.multiWorld&&t.multiWorld,c=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,u=void 0!==t.showFullExtent&&t.showFullExtent,d=Pe(t.projection,"EPSG:3857"),g=d.getExtent();let _=t.constrainOnlyCenter,f=t.extent;if(l||f||!d.isGlobal()||(_=!1,f=g),void 0!==t.resolutions){const s=t.resolutions;i=s[o],n=void 0!==s[a]?s[a]:s[s.length-1],e=t.constrainResolution?Je(s,c,!_&&f,u):Qe(i,n,c,!_&&f,u)}else{const l=g?Math.max(se(g),te(g)):360*nt.degrees/d.getMetersPerUnit(),p=l/it/Math.pow(r,Sn),m=p/Math.pow(r,s-Sn);i=t.maxResolution,void 0!==i?o=0:i=p/Math.pow(h,o),n=t.minResolution,void 0===n&&(n=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(h,a):p/Math.pow(h,a):m),a=o+Math.floor(Math.log(i/n)/Math.log(h)),n=i/Math.pow(h,a-o),e=t.constrainResolution?$e(h,i,n,c,!_&&f,u):Qe(i,n,c,!_&&f,u)}return{constraint:e,maxResolution:i,minResolution:n,minZoom:o,zoomFactor:h}}function Mn(t){const e=void 0===t.enableRotation||t.enableRotation;if(e){const e=t.constrainRotation;return void 0===e||!0===e?ni():!1===e?ei:"number"===typeof e?ii(e):ei}return ti}function Ln(t){return!(t.sourceCenter&&t.targetCenter&&!ge(t.sourceCenter,t.targetCenter))&&(t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation)}function bn(t,e,i,n,s){const r=Math.cos(-s);let o=Math.sin(-s),a=t[0]*r-t[1]*o,h=t[1]*r+t[0]*o;a+=(e[0]/2-i[0])*n,h+=(i[1]-e[1]/2)*n,o=-o;const l=a*r-h*o,c=h*r+a*o;return[l,c]}var An=wn;class On extends J{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(G.SOURCE,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return t=t||[],t.push(this),t}getLayerStatesArray(t){return t=t||[],t.push(this.getLayerState()),t}getSource(){return this.get(G.SOURCE)||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_&&(M(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=T(t,R.CHANGE,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 An?{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 Pn(n,e.viewState)&&(!s||re(s,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];let e;const i=this.getSource();if(i&&(e=i.getAttributions()),!e)return[];const n=t instanceof An?t.getViewStateAndExtent():t;let s=e(n);return Array.isArray(s)||(s=[s]),s}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(G.MAP,t)}getMapInternal(){return this.get(G.MAP)}setMap(t){this.mapPrecomposeKey_&&(M(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(M(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=T(t,$.PRECOMPOSE,(function(t){const e=t,i=e.frameState.layerStatesArray,n=this.getLayerState(!1);W(!i.some((function(t){return t.layer===n.layer})),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),i.push(n)}),this),this.mapRenderKey_=T(this,R.CHANGE,t.render,t),this.changed())}setSource(t){this.set(G.SOURCE,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()}}function Pn(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}var Dn=On,Fn={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class kn extends Dn{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.setPreload(void 0!==t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError)}getPreload(){return this.get(Fn.PRELOAD)}setPreload(t){this.set(Fn.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(Fn.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(Fn.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}var Nn=kn,Gn=(i(541),{IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4});class Wn extends A{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.declutterExecutorGroup=null}getFeatures(t){return O()}getData(t){return null}prepareFrame(t){return O()}renderFrame(t,e){return O()}loadedTileCallback(t,e,i){t[e]||(t[e]={}),t[e][i.tileCoord.toString()]=i}createLoadedTileFinder(t,e,i){return(n,s)=>{const r=this.loadedTileCallback.bind(this,i,n);return t.forEachLoadedTile(e,n,s,r)}}forEachFeatureAtCoordinate(t,e,i,n,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;e.getState()!==Gn.LOADED&&e.getState()!==Gn.ERROR||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=Gn.LOADED&&e!=Gn.ERROR&&t.addEventListener(R.CHANGE,this.boundHandleImageChange_),e==Gn.IDLE&&(t.load(),e=t.getState()),e==Gn.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}}var zn=Wn;class Xn extends o{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}}var Yn=Xn;const Bn=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,Kn=/^([a-z]*)$|^hsla?\(.*\)$/i;function Vn(t){return"string"===typeof t?t:Jn(t)}function jn(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""}const Zn=function(){const t=1024,e={};let i=0;return function(n){let s;if(e.hasOwnProperty(n))s=e[n];else{if(i>=t){let t=0;for(const n in e)0===(3&t++)&&(delete e[n],--i)}s=Hn(n),e[n]=s,++i}return s}}();function Un(t){return Array.isArray(t)?t:Zn(t)}function Hn(t){let e,i,n,s,r;if(Kn.exec(t)&&(t=jn(t)),Bn.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 if(t.startsWith("rgba("))r=t.slice(5,-1).split(",").map(Number),qn(r);else{if(!t.startsWith("rgb("))throw new Error("Invalid color");r=t.slice(4,-1).split(",").map(Number),r.push(1),qn(r)}return r}function qn(t){return t[0]=z(t[0]+.5|0,0,255),t[1]=z(t[1]+.5|0,0,255),t[2]=z(t[2]+.5|0,0,255),t[3]=z(t[3],0,1),t}function Jn(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);const s=void 0===t[3]?1:Math.round(100*t[3])/100;return"rgba("+e+","+i+","+n+","+s+")"}function $n(t,e,i,n){let s;return s=i&&i.length?i.shift():_i?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(s.width=t),e&&(s.height=e),s.getContext("2d",n)}function Qn(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function ts(t){let e=t.offsetWidth;const i=getComputedStyle(t);return e+=parseInt(i.marginLeft,10)+parseInt(i.marginRight,10),e}function es(t){let e=t.offsetHeight;const i=getComputedStyle(t);return e+=parseInt(i.marginTop,10)+parseInt(i.marginBottom,10),e}function is(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function ns(t){return t&&t.parentNode?t.parentNode.removeChild(t):null}function ss(t){while(t.lastChild)t.removeChild(t.lastChild)}function rs(t,e){const i=t.childNodes;for(let n=0;1;++n){const s=i[n],r=e[n];if(!s&&!r)break;s!==r&&(s?r?t.insertBefore(r,s):(t.removeChild(s),--n):t.appendChild(r))}}const os=[];let as=null;function hs(){as=$n(1,1,void 0,{willReadFrequently:!0})}class ls extends zn{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=mi(),this.pixelTransform=mi(),this.inversePixelTransform=mi(),this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(t,e,i){let n;as||hs(),as.clearRect(0,0,1,1);try{as.drawImage(t,e,i,1,1,0,0,1,1),n=as.getImageData(0,0,1,1).data}catch(s){return as=null,null}return n}getBackground(t){const e=this.getLayer();let i=e.getBackground();return"function"===typeof i&&(i=i(t.viewState.resolution)),i||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let s,r;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&f(Un(t.style.backgroundColor),Un(i)))){const e=t.firstElementChild;e instanceof HTMLCanvasElement&&(r=e.getContext("2d"))}if(r&&r.canvas.style.transform===e?(this.container=t,this.context=r,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){s=document.createElement("div"),s.className=n;let t=s.style;t.position="absolute",t.width="100%",t.height="100%",r=$n();const e=r.canvas;s.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=s,this.context=r}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=ie(i),s=ne(i),r=Ht(i),o=Ut(i);Ei(e.coordinateToPixelTransform,n),Ei(e.coordinateToPixelTransform,s),Ei(e.coordinateToPixelTransform,r),Ei(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;Ei(a,n),Ei(a,s),Ei(a,r),Ei(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const s=new Yn(t,this.inversePixelTransform,i,e);n.dispatchEvent(s)}}preRender(t,e){this.frameState=e,this.dispatchRenderEvent_($.PRERENDER,t,e)}postRender(t,e){this.dispatchRenderEvent_($.POSTRENDER,t,e)}getRenderTransform(t,e,i,n,s,r,o){const a=s/2,h=r/2,l=n/e,c=-l,u=-t[0]+o,d=-t[1];return Si(this.tempTransform,a,h,l,c,-i,u,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}}var cs=ls,us={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class ds extends w{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.interimTile=null,this.key="",this.transition_=void 0===i.transition?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(R.CHANGE)}release(){this.state===us.ERROR&&this.setState(us.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){if(!this.interimTile)return this;let t=this.interimTile;do{if(t.getState()==us.LOADED)return this.transition_=0,t;t=t.interimTile}while(t);return this}refreshInterimChain(){if(!this.interimTile)return;let t=this.interimTile,e=this;do{if(t.getState()==us.LOADED){t.interimTile=null;break}t.getState()==us.LOADING?e=t:t.getState()==us.IDLE?e.interimTile=t.interimTile:e=t,t=e.interimTile}while(t)}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==us.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){O()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;const n=e-i+1e3/60;return n>=this.transition_?1:si(n/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}}var gs=ds;function _s(t,e,i){const n=t;let s=!0,r=!1,o=!1;const a=[I(n,R.LOAD,(function(){o=!0,r||e()}))];return n.src&&fi?(r=!0,n.decode().then((function(){s&&e()})).catch((function(t){s&&(o?e():i())}))):a.push(I(n,R.ERROR,i)),function(){s=!1,a.forEach(M)}}function fs(t,e){return new Promise(((i,n)=>{function s(){o(),i(t)}function r(){o(),n(new Error("Image load error"))}function o(){t.removeEventListener("load",s),t.removeEventListener("error",r)}t.addEventListener("load",s),t.addEventListener("error",r),e&&(t.src=e)}))}function ps(t,e){return e&&(t.src=e),fi?new Promise(((e,i)=>t.decode().then((()=>e(t)),i))):fs(t)}class ms extends gs{constructor(t,e,i,n,s,r){super(t,e,r),this.crossOrigin_=n,this.src_=i,this.key=i,this.image_=new Image,null!==n&&(this.image_.crossOrigin=n),this.unlisten_=null,this.tileLoadFunction_=s}getImage(){return this.image_}setImage(t){this.image_=t,this.state=us.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=us.ERROR,this.unlistenImage_(),this.image_=ys(),this.changed()}handleImageLoad_(){const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=us.LOADED:this.state=us.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==us.ERROR&&(this.state=us.IDLE,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==us.IDLE&&(this.state=us.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=_s(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function ys(){const t=$n(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}var vs=ms;const xs=.5,Es=10,Cs=.25;class Ss{constructor(t,e,i,n,s,r){this.sourceProj_=t,this.targetProj_=e;let o={};const a=ke(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){const e=t[0]+"/"+t[1];return o[e]||(o[e]=a(t)),o[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&se(n)>=se(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?se(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?se(this.targetProj_.getExtent()):null;const h=ie(i),l=ne(i),c=Ht(i),u=Ut(i),d=this.transformInv_(h),g=this.transformInv_(l),_=this.transformInv_(c),f=this.transformInv_(u),p=Es+(r?Math.max(0,Math.ceil(Math.log2(Zt(i)/(r*r*256*256)))):0);if(this.addQuad_(h,l,c,u,d,g,_,f,p),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach((function(e,i,n){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])})),this.triangles_.forEach((e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const i=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];i[0][0]-t>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-t>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-t>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);const n=Math.min(i[0][0],i[1][0],i[2][0]),s=Math.max(i[0][0],i[1][0],i[2][0]);s-n<this.sourceWorldWidth_/2&&(e.source=i)}}))}o={}}addTriangle_(t,e,i,n,s,r){this.triangles_.push({source:[n,s,r],target:[t,e,i]})}addQuad_(t,e,i,n,s,r,o,a,h){const l=It([s,r,o,a]),c=this.sourceWorldWidth_?se(l)/this.sourceWorldWidth_:null,u=this.sourceWorldWidth_,d=this.sourceProj_.canWrapX()&&c>.5&&c<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const s=It([t,e,i,n]),r=se(s)/this.targetWorldWidth_;g=r>Cs||g}!d&&this.sourceProj_.isGlobal()&&c&&(g=c>Cs||g)}if(!g&&this.maxSourceExtent_&&isFinite(l[0])&&isFinite(l[1])&&isFinite(l[2])&&isFinite(l[3])&&!re(l,this.maxSourceExtent_))return;let _=0;if(!g&&(!isFinite(s[0])||!isFinite(s[1])||!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])))if(h>0)g=!0;else if(_=(isFinite(s[0])&&isFinite(s[1])?0:8)+(isFinite(r[0])&&isFinite(r[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=_&&2!=_&&4!=_&&8!=_)return;if(h>0){if(!g){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],n=this.transformInv_(e);let r;if(d){const t=(V(s[0],u)+V(o[0],u))/2;r=t-V(n[0],u)}else r=(s[0]+o[0])/2-n[0];const a=(s[1]+o[1])/2-n[1],h=r*r+a*a;g=h>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const l=[(e[0]+i[0])/2,(e[1]+i[1])/2],c=this.transformInv_(l),u=[(n[0]+t[0])/2,(n[1]+t[1])/2],d=this.transformInv_(u);this.addQuad_(t,e,l,u,s,r,c,d,h-1),this.addQuad_(u,l,i,n,d,c,o,a,h-1)}else{const l=[(t[0]+e[0])/2,(t[1]+e[1])/2],c=this.transformInv_(l),u=[(i[0]+n[0])/2,(i[1]+n[1])/2],d=this.transformInv_(u);this.addQuad_(t,l,u,n,s,c,d,a,h-1),this.addQuad_(l,e,i,u,c,r,o,d,h-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}0==(11&_)&&this.addTriangle_(t,i,n,s,o,a),0==(14&_)&&this.addTriangle_(t,i,e,s,o,r),_&&(0==(13&_)&&this.addTriangle_(e,n,t,r,a,s),0==(7&_)&&this.addTriangle_(e,n,i,r,a,o))}calculateSourceExtent(){const t=kt();return this.triangles_.forEach((function(e,i,n){const s=e.source;Bt(t,s[0]),Bt(t,s[1]),Bt(t,s[2])})),t}getTriangles(){return this.triangles_}}var ws=Ss;let Rs;const Ts=[];function Is(t,e,i,n,s){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,s),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,s)),t.restore()}function Ms(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function Ls(){if(void 0===Rs){const t=$n(6,6,Ts);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",Is(t,4,5,4,0),Is(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;Rs=Ms(e,0)||Ms(e,4)||Ms(e,8),Qn(t),Ts.push(t.canvas)}return Rs}function bs(t,e,i,n){const s=Ne(i,e,t);let r=be(e,n,i);const o=e.getMetersPerUnit();void 0!==o&&(r*=o);const a=t.getMetersPerUnit();void 0!==a&&(r/=a);const h=t.getExtent();if(!h||Ot(h,s)){const e=be(t,r,s)/r;isFinite(e)&&e>0&&(r/=e)}return r}function As(t,e,i,n){const s=qt(i);let r=bs(t,e,s,n);return(!isFinite(r)||r<=0)&&jt(i,(function(i){return r=bs(t,e,i,n),isFinite(r)&&r>0})),r}function Os(t,e,i,n,s,r,o,a,h,l,c,u){const d=$n(Math.round(i*t),Math.round(i*e),Ts);if(u||(d.imageSmoothingEnabled=!1),0===h.length)return d.canvas;function g(t){return Math.round(t*i)/i}d.scale(i,i),d.globalCompositeOperation="lighter";const _=kt();h.forEach((function(t,e,i){Yt(_,t.extent)}));const f=se(_),p=te(_),m=$n(Math.round(i*f/n),Math.round(i*p/n),Ts);u||(m.imageSmoothingEnabled=!1);const y=i/n;h.forEach((function(t,e,i){const n=t.extent[0]-_[0],s=-(t.extent[3]-_[3]),r=se(t.extent),o=te(t.extent);t.image.width>0&&t.image.height>0&&m.drawImage(t.image,l,l,t.image.width-2*l,t.image.height-2*l,n*y,s*y,r*y,o*y)}));const v=ie(o);return a.getTriangles().forEach((function(t,e,s){const o=t.source,a=t.target;let h=o[0][0],l=o[0][1],c=o[1][0],f=o[1][1],p=o[2][0],y=o[2][1];const x=g((a[0][0]-v[0])/r),E=g(-(a[0][1]-v[1])/r),C=g((a[1][0]-v[0])/r),S=g(-(a[1][1]-v[1])/r),w=g((a[2][0]-v[0])/r),R=g(-(a[2][1]-v[1])/r),T=h,I=l;h=0,l=0,c-=T,f-=I,p-=T,y-=I;const M=[[c,f,0,0,C-x],[p,y,0,0,w-x],[0,0,c,f,S-E],[0,0,p,y,R-E]],L=B(M);if(L){if(d.save(),d.beginPath(),Ls()||!u){d.moveTo(C,S);const t=4,e=x-C,i=E-S;for(let n=0;n<t;n++)d.lineTo(C+g((n+1)*e/t),S+g(n*i/(t-1))),n!=t-1&&d.lineTo(C+g((n+1)*e/t),S+g((n+1)*i/(t-1)));d.lineTo(w,R)}else d.moveTo(C,S),d.lineTo(x,E),d.lineTo(w,R);d.clip(),d.transform(L[0],L[2],L[1],L[3],x,E),d.translate(_[0]-T,_[3]-I),d.scale(n/i,-n/i),d.drawImage(m.canvas,0,0),d.restore()}})),Qn(m),Ts.push(m.canvas),c&&(d.save(),d.globalCompositeOperation="source-over",d.strokeStyle="black",d.lineWidth=1,a.getTriangles().forEach((function(t,e,i){const n=t.target,s=(n[0][0]-v[0])/r,o=-(n[0][1]-v[1])/r,a=(n[1][0]-v[0])/r,h=-(n[1][1]-v[1])/r,l=(n[2][0]-v[0])/r,c=-(n[2][1]-v[1])/r;d.beginPath(),d.moveTo(a,h),d.lineTo(s,o),d.lineTo(l,c),d.closePath(),d.stroke()})),d.restore()),d.canvas}class Ps extends gs{constructor(t,e,i,n,s,r,o,a,h,l,c,u){super(s,us.IDLE,{interpolate:!!u}),this.renderEdges_=void 0!==c&&c,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=n,this.wrappedTileCoord_=r||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const d=n.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let _=this.sourceTileGrid_.getExtent();const f=g?ee(d,g):d;if(0===Zt(f))return void(this.state=us.EMPTY);const p=t.getExtent();p&&(_=_?ee(_,p):p);const m=n.getResolution(this.wrappedTileCoord_[0]),y=As(t,i,f,m);if(!isFinite(y)||y<=0)return void(this.state=us.EMPTY);const v=void 0!==l?l:xs;if(this.triangulation_=new ws(t,i,f,_,y*v,m),0===this.triangulation_.getTriangles().length)return void(this.state=us.EMPTY);this.sourceZ_=e.getZForResolution(y);let x=this.triangulation_.calculateSourceExtent();if(_&&(t.canWrapX()?(x[1]=z(x[1],_[1],_[3]),x[3]=z(x[3],_[1],_[3])):x=ee(x,_)),Zt(x)){const t=e.getTileRangeForExtentAndZ(x,this.sourceZ_);for(let e=t.minX;e<=t.maxX;e++)for(let i=t.minY;i<=t.maxY;i++){const t=h(this.sourceZ_,e,i,o);t&&this.sourceTiles_.push(t)}0===this.sourceTiles_.length&&(this.state=us.EMPTY)}else this.state=us.EMPTY}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach((e=>{e&&e.getState()==us.LOADED&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})})),this.sourceTiles_.length=0,0===t.length)this.state=us.ERROR;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"===typeof i?i:i[0],s="number"===typeof i?i:i[1],r=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Os(n,s,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),r,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=us.LOADED}this.changed()}load(){if(this.state==us.IDLE){this.state=us.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach((e=>{const i=e.getState();if(i==us.IDLE||i==us.LOADING){t++;const i=T(e,R.CHANGE,(function(n){const s=e.getState();s!=us.LOADED&&s!=us.ERROR&&s!=us.EMPTY||(M(i),t--,0===t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(i)}})),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function(t,e,i){const n=t.getState();n==us.IDLE&&t.load()}))}}unlistenSources_(){this.sourcesListenerKeys_.forEach(M),this.sourcesListenerKeys_=null}release(){this.canvas_&&(Qn(this.canvas_.getContext("2d")),Ts.push(this.canvas_),this.canvas_=null),super.release()}}var Ds=Ps;class Fs{constructor(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function ks(t,e,i,n,s){return void 0!==s?(s.minX=t,s.maxX=e,s.minY=i,s.maxY=n,s):new Fs(t,e,i,n)}var Ns=Fs;function Gs(t){return t[0]>0&&t[1]>0}function Ws(t,e,i){return void 0===i&&(i=[0,0]),i[0]=t[0]*e+.5|0,i[1]=t[1]*e+.5|0,i}function zs(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}class Xs extends cs{constructor(t){super(t),this.extentChanged=!0,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=kt(),this.tmpTileRange_=new Ns(0,0,0,0)}isDrawableTile(t){const e=this.getLayer(),i=t.getState(),n=e.getUseInterimTilesOnError();return i==us.LOADED||i==us.EMPTY||i==us.ERROR&&!n}getTile(t,e,i,n){const s=n.pixelRatio,r=n.viewState.projection,o=this.getLayer(),a=o.getSource();let h=a.getTile(t,e,i,s,r);return h.getState()==us.ERROR&&o.getUseInterimTilesOnError()&&o.getPreload()>0&&(this.newTiles_=!0),this.isDrawableTile(h)||(h=h.getInterimTile()),h}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=Ei(e.pixelToCoordinateTransform,t.slice()),s=i.getExtent();if(s&&!Ot(s,n))return null;const r=e.pixelRatio,o=e.viewState.projection,a=e.viewState,h=i.getRenderSource(),l=h.getTileGridForProjection(a.projection),c=h.getTilePixelRatio(e.pixelRatio);for(let u=l.getZForResolution(a.resolution);u>=l.getMinZoom();--u){const t=l.getTileCoordForCoordAndZ(n,u),e=h.getTile(u,t[1],t[2],r,o);if(!(e instanceof vs||e instanceof Ds)||e instanceof Ds&&e.getState()===us.EMPTY)return null;if(e.getState()!==us.LOADED)continue;const i=l.getOrigin(u),s=zs(l.getTileSize(u)),d=l.getResolution(u),g=Math.floor(c*((n[0]-i[0])/d-t[1]*s[0])),_=Math.floor(c*((i[1]-n[1])/d-t[2]*s[1])),f=Math.round(c*h.getGutterForProjection(a.projection));return this.getImageData(e.getImage(),g+f,_+f)}return null}loadedTileCallback(t,e,i){return!!this.isDrawableTile(i)&&super.loadedTileCallback(t,e,i)}prepareFrame(t){return!!this.getLayer().getSource()}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex],n=t.viewState,s=n.projection,r=n.resolution,o=n.center,a=n.rotation,h=t.pixelRatio,l=this.getLayer(),c=l.getSource(),d=c.getRevision(),g=c.getTileGridForProjection(s),_=g.getZForResolution(r,c.zDirection),f=g.getResolution(_);let p=t.extent;const m=t.viewState.resolution,y=c.getTilePixelRatio(h),v=Math.round(se(p)/m*h),x=Math.round(te(p)/m*h),E=i.extent&&Ke(i.extent,s);E&&(p=ee(p,Ke(i.extent,s)));const C=f*v/2/y,S=f*x/2/y,w=[o[0]-C,o[1]-S,o[0]+C,o[1]+S],R=g.getTileRangeForExtentAndZ(p,_),T={};T[_]={};const I=this.createLoadedTileFinder(c,s,T),M=this.tmpExtent,L=this.tmpTileRange_;this.newTiles_=!1;const b=a?Qt(n.center,m,a,t.size):void 0;for(let u=R.minX;u<=R.maxX;++u)for(let e=R.minY;e<=R.maxY;++e){if(a&&!g.tileCoordIntersectsViewport([_,u,e],b))continue;const n=this.getTile(_,u,e,t);if(this.isDrawableTile(n)){const e=D(this);if(n.getState()==us.LOADED){T[_][n.tileCoord.toString()]=n;let t=n.inTransition(e);t&&1!==i.opacity&&(n.endTransition(e),t=!1),this.newTiles_||!t&&this.renderedTiles.includes(n)||(this.newTiles_=!0)}if(1===n.getAlpha(e,t.time))continue}const s=g.getTileCoordChildTileRange(n.tileCoord,L,M);let r=!1;s&&(r=I(_+1,s)),r||g.forEachTileCoordParentTileRange(n.tileCoord,I,L,M)}const A=f/r*h/y;Si(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/h,1/h,a,-v/2,-x/2);const O=Ii(this.pixelTransform);this.useContainer(e,O,this.getBackground(t));const P=this.context,F=P.canvas;wi(this.inversePixelTransform,this.pixelTransform),Si(this.tempTransform,v/2,x/2,A,A,0,-v/2,-x/2),F.width!=v||F.height!=x?(F.width=v,F.height=x):this.containerReused||P.clearRect(0,0,v,x),E&&this.clipUnrotated(P,t,E),c.getInterpolate()||(P.imageSmoothingEnabled=!1),this.preRender(P,t),this.renderedTiles.length=0;let k,N,G,W=Object.keys(T).map(Number);W.sort(u),1!==i.opacity||this.containerReused&&!c.getOpaque(t.viewState.projection)?(k=[],N=[]):W=W.reverse();for(let u=W.length-1;u>=0;--u){const e=W[u],i=c.getTilePixelSize(e,h,s),n=g.getResolution(e),r=n/f,o=i[0]*r*A,a=i[1]*r*A,l=g.getTileCoordForCoordAndZ(ie(w),e),d=g.getTileCoordExtent(l),p=Ei(this.tempTransform,[y*(d[0]-w[0])/f,y*(w[3]-d[3])/f]),m=y*c.getGutterForProjection(s),v=T[e];for(const s in v){const i=v[s],n=i.tileCoord,r=l[1]-n[1],h=Math.round(p[0]-(r-1)*o),u=l[2]-n[2],d=Math.round(p[1]-(u-1)*a),g=Math.round(p[0]-r*o),f=Math.round(p[1]-u*a),y=h-g,x=d-f,E=_===e,C=E&&1!==i.getAlpha(D(this),t.time);let S=!1;if(!C)if(k){G=[g,f,g+y,f,g+y,f+x,g,f+x];for(let t=0,i=k.length;t<i;++t)if(_!==e&&e<N[t]){const e=k[t];re([g,f,g+y,f+x],[e[0],e[3],e[4],e[7]])&&(S||(P.save(),S=!0),P.beginPath(),P.moveTo(G[0],G[1]),P.lineTo(G[2],G[3]),P.lineTo(G[4],G[5]),P.lineTo(G[6],G[7]),P.moveTo(e[6],e[7]),P.lineTo(e[4],e[5]),P.lineTo(e[2],e[3]),P.lineTo(e[0],e[1]),P.clip())}k.push(G),N.push(e)}else P.clearRect(g,f,y,x);this.drawTileImage(i,t,g,f,y,x,m,E),k&&!C?(S&&P.restore(),this.renderedTiles.unshift(i)):this.renderedTiles.push(i),this.updateUsedTiles(t.usedTiles,c,i)}}return this.renderedRevision=d,this.renderedResolution=f,this.extentChanged=!this.renderedExtent_||!Xt(this.renderedExtent_,w),this.renderedExtent_=w,this.renderedPixelRatio=h,this.renderedProjection=s,this.manageTilePyramid(t,c,g,h,s,p,_,l.getPreload()),this.scheduleExpireCache(t,c),this.postRender(P,t),i.extent&&P.restore(),P.imageSmoothingEnabled=!0,O!==F.style.transform&&(F.style.transform=O),this.container}drawTileImage(t,e,i,n,s,r,o,a){const h=this.getTileImage(t);if(!h)return;const l=D(this),c=e.layerStatesArray[e.layerIndex],u=c.opacity*(a?t.getAlpha(l,e.time):1),d=u!==this.context.globalAlpha;d&&(this.context.save(),this.context.globalAlpha=u),this.context.drawImage(h,o,o,h.width-2*o,h.height-2*o,i,n,s,r),d&&this.context.restore(),u!==c.opacity?e.animate=!0:a&&t.endTransition(l)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}scheduleExpireCache(t,e){if(e.canExpireCache()){const i=function(t,e,i){const n=D(t);n in i.usedTiles&&t.expireCache(i.viewState.projection,i.usedTiles[n])}.bind(null,e);t.postRenderFunctions.push(i)}}updateUsedTiles(t,e,i){const n=D(e);n in t||(t[n]={}),t[n][i.getKey()]=!0}manageTilePyramid(t,e,i,n,s,r,o,a,h){const l=D(e);l in t.wantedTiles||(t.wantedTiles[l]={});const c=t.wantedTiles[l],u=t.tileQueue,d=i.getMinZoom(),g=t.viewState.rotation,_=g?Qt(t.viewState.center,t.viewState.resolution,g,t.size):void 0;let f,p,m,y,v,x,E=0;for(x=d;x<=o;++x)for(p=i.getTileRangeForExtentAndZ(r,x,p),m=i.getResolution(x),y=p.minX;y<=p.maxX;++y)for(v=p.minY;v<=p.maxY;++v)g&&!i.tileCoordIntersectsViewport([x,y,v],_)||(o-x<=a?(++E,f=e.getTile(x,y,v,n,s),f.getState()==us.IDLE&&(c[f.getKey()]=!0,u.isKeyQueued(f.getKey())||u.enqueue([f,l,i.getTileCoordCenter(f.tileCoord),m])),void 0!==h&&h(f)):e.useTile(x,y,v,s));e.updateCacheSize(E,s)}}var Ys=Xs;class Bs extends Nn{constructor(t){super(t)}createRenderer(){return new Ys(this)}}var Ks=Bs,Vs=i(5325);class js{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=zs(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new js({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 O()}getImage(t){return O()}getHitDetectionImage(){return O()}getPixelRatio(t){return 1}getImageState(){return O()}getImageSize(){return O()}getOrigin(){return O()}getSize(){return O()}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_=zs(t)}listenImageChange(t){O()}load(){O()}unlistenImageChange(t){O()}}var Zs=js;function Us(t){return Array.isArray(t)?Jn(t):t}const Hs="ol-hidden",qs="ol-selectable",Js="ol-unselectable",$s="ol-control",Qs="ol-collapsed",tr=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"),er=["style","variant","weight","size","lineHeight","family"],ir=function(t){const e=t.match(tr);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let n=0,s=er.length;n<s;++n){const t=e[n+1];void 0!==t&&(i[er[n]]=t)}return i.families=i.family.split(/,\s?/),i},nr="10px sans-serif",sr="#000",rr="round",or=[],ar=0,hr="round",lr=10,cr="#000",ur="center",dr="middle",gr=[0,0,0,0],_r=1,fr=new N;let pr,mr=null;const yr={},vr=function(){const t=100,e="32px ",i=["monospace","serif"],n=i.length,s="wmytzilWMYTZIL@#/&?$%10";let r,o;function a(t,r,a){let h=!0;for(let l=0;l<n;++l){const n=i[l];if(o=Cr(t+" "+r+" "+e+n,s),a!=n){const i=Cr(t+" "+r+" "+e+a+","+n,s);h=h&&i!=o}}return!!h}function h(){let e=!0;const i=fr.getKeys();for(let n=0,s=i.length;n<s;++n){const s=i[n];fr.get(s)<t&&(a.apply(this,s.split("\n"))?(E(yr),mr=null,pr=void 0,fr.set(s,t)):(fr.set(s,fr.get(s)+1,!0),e=!1))}e&&(clearInterval(r),r=void 0)}return function(e){const i=ir(e);if(!i)return;const n=i.families;for(let s=0,o=n.length;s<o;++s){const e=n[s],o=i.style+"\n"+i.weight+"\n"+e;void 0===fr.get(o)&&(fr.set(o,t,!0),a(i.style,i.weight,e)||(fr.set(o,0,!0),void 0===r&&(r=setInterval(h,32))))}}}(),xr=function(){let t;return function(e){let i=yr[e];if(void 0==i){if(_i){const t=ir(e),n=Er(e,"Žg"),s=isNaN(Number(t.lineHeight))?1.2:Number(t.lineHeight);i=s*(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);yr[e]=i}return i}}();function Er(t,e){return mr||(mr=$n(1,1)),t!=pr&&(mr.font=t,pr=mr.font),mr.measureText(e)}function Cr(t,e){return Er(t,e).width}function Sr(t,e,i){if(e in i)return i[e];const n=e.split("\n").reduce(((e,i)=>Math.max(e,Cr(t,i))),0);return i[e]=n,n}function wr(t,e){const i=[],n=[],s=[];let r=0,o=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){r=Math.max(r,o),s.push(o),o=0,a+=h;continue}const d=e[l+1]||t.font,g=Cr(d,u);i.push(g),o+=g;const _=xr(d);n.push(_),h=Math.max(h,_)}return{width:r,height:a,widths:i,heights:n,lineWidths:s}}function Rr(t,e,i,n,s,r,o,a,h,l,c){t.save(),1!==i&&(t.globalAlpha*=i),e&&t.transform.apply(t,e),n.contextInstructions?(t.translate(h,l),t.scale(c[0],c[1]),Tr(n,t)):c[0]<0||c[1]<0?(t.translate(h,l),t.scale(c[0],c[1]),t.drawImage(n,s,r,o,a,0,0,o,a)):t.drawImage(n,s,r,o,a,h,l,o*c[0],a*c[1]),t.restore()}function Tr(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]}class Ir extends Zs{constructor(t){const e=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:1,rotateWithView:e,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 Ir({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=$n(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 Gn.LOADED}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius_}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let n=this.radius_,s=void 0===this.radius2_?n:this.radius2_;if(n<s){const t=n;n=s,s=t}const r=void 0===this.radius2_?this.points_:2*this.points_,o=2*Math.PI/r,a=s*Math.sin(o),h=Math.sqrt(s*s-a*a),l=n-h,c=Math.sqrt(a*a+l*l),u=c/a;if("miter"===t&&u<=i)return u*e;const d=e/2/u,g=e/2*(l/c),_=Math.sqrt((n+d)*(n+d)+g*g),f=_-n;if(void 0===this.radius2_||"bevel"===t)return 2*f;const p=n*Math.sin(o),m=Math.sqrt(n*n-p*p),y=s-m,v=Math.sqrt(p*p+y*y),x=v/p;if(x<=i){const t=x*e/2-s-n;return 2*Math.max(f,t)}return 2*f}createRenderOptions(){let t,e=rr,i=hr,n=0,s=null,r=0,o=0;this.stroke_&&(t=this.stroke_.getColor(),null===t&&(t=cr),t=Us(t),o=this.stroke_.getWidth(),void 0===o&&(o=_r),s=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset(),i=this.stroke_.getLineJoin(),void 0===i&&(i=hr),e=this.stroke_.getLineCap(),void 0===e&&(e=rr),n=this.stroke_.getMiterLimit(),void 0===n&&(n=lr));const a=this.calculateLineJoinSize_(i,o,n),h=Math.max(this.radius_,this.radius2_||0),l=Math.ceil(2*h+a);return{strokeStyle:t,strokeWidth:o,size:l,lineCap:e,lineDash:s,lineDashOffset:r,lineJoin:i,miterLimit:n}}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=sr),e.fillStyle=Us(t),e.fill()}this.stroke_&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){if(this.fill_){let e=this.fill_.getColor(),i=0;if("string"===typeof e&&(e=Un(e)),null===e?i=1:Array.isArray(e)&&(i=4===e.length?e[3]:1),0===i){const e=$n(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,r=2*Math.PI/e;for(let o=0;o<e;o++){const e=s+o*r,a=o%2===0?i:n;t.lineTo(a*Math.cos(e),a*Math.sin(e))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=sr,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())}}var Mr=Ir;class Lr extends Mr{constructor(t){t=t||{radius:5},super({points:1/0,fill:t.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 Lr({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()}}var br=Lr;class Ar{constructor(t){t=t||{},this.color_=void 0!==t.color?t.color:null}clone(){const t=this.getColor();return new Ar({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){this.color_=t}}var Or=Ar;class Pr{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 Pr({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}}var Dr=Pr;class Fr{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=Wr,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 Fr({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_=Wr,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function kr(t){let e;if("function"===typeof t)e=t;else{let i;if(Array.isArray(t))i=t;else{W("function"===typeof t.getZIndex,"Expected an `Style` or an array of `Style`");const e=t;i=[e]}e=function(){return i}}return e}let Nr=null;function Gr(t,e){if(!Nr){const t=new Or({color:"rgba(255,255,255,0.4)"}),e=new Dr({color:"#3399CC",width:1.25});Nr=[new Fr({image:new br({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return Nr}function Wr(t){return t.getGeometry()}var zr=Fr;class Xr{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];0!==(3&t++)||i.hasListener()||(delete this.cache_[e],--this.cacheSize_)}}}get(t,e,i){const n=Yr(t,e,i);return n in this.cache_?this.cache_[n]:null}set(t,e,i,n){const s=Yr(t,e,i);this.cache_[s]=n,++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function Yr(t,e,i){const n=i?Vn(i):"null";return e+":"+t+":"+n}const Br=new Xr;let Kr=null;class Vr extends w{constructor(t,e,i,n,s){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=s,this.imageState_=void 0===n?Gn.IDLE:n,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,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_===Gn.LOADED){Kr||(Kr=$n(1,1,void 0,{willReadFrequently:!0})),Kr.drawImage(this.image_,0,0);try{Kr.getImageData(0,0,1,1),this.tainted_=!1}catch(t){Kr=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(R.CHANGE)}handleImageError_(){this.imageState_=Gn.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Gn.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=$n(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_===Gn.IDLE){this.image_||this.initializeImage_(),this.imageState_=Gn.LOADING;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch(t){this.handleImageError_()}this.image_ instanceof HTMLImageElement&&ps(this.image_,this.src_).then((t=>{this.image_=t,this.handleImageLoad_()})).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==Gn.LOADED)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=Vn(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}}function jr(t,e,i,n,s){let r=void 0===e?void 0:Br.get(e,i,s);return r||(r=new Vr(t,t instanceof HTMLImageElement?t.src||void 0:e,i,n,s),Br.set(e,i,s,r)),r}function Zr(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 Ur extends Zs{constructor(t){t=t||{};const e=void 0!==t.opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,n=void 0!==t.scale?t.scale:1,s=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:n,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:s,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null;const r=void 0!==t.img?t.img:null;let o,a=t.src;if(W(!(void 0!==a&&r),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!r||(a=r.src||D(r)),W(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),W(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?o=Gn.IDLE:void 0!==r&&(o=r instanceof HTMLImageElement?r.complete?r.src?Gn.LOADED:Gn.IDLE:Gn.LOADING:Gn.LOADED),this.color_=void 0!==t.color?Un(t.color):null,this.iconImage_=jr(r,a,this.crossOrigin_,o,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const n=this.getImage(1);if(n.width&&n.height)e=n.width,i=n.height;else if(n instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(Zr(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(Zr(e,i,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new Ur({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const e=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!e)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=e[0]),"fraction"==this.anchorYUnits_&&(t[1]*=e[1])}if("top-left"!=this.anchorOrigin_){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+e[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+e[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:this.iconImage_.getImageState()==Gn.LOADED?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:this.iconImage_.getImageState()==Gn.LOADED?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(R.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(R.CHANGE,t)}}var Hr=Ur;const qr="#333";class Jr{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.scale_=t.scale,this.scaleArray_=zs(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 Or({color:qr}),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 Jr({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_=zs(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}}var $r=Jr;let Qr=0;const to=1<<Qr++,eo=1<<Qr++,io=1<<Qr++,no=1<<Qr++,so=1<<Qr++,ro=Math.pow(2,Qr)-1,oo={[to]:"boolean",[eo]:"number",[io]:"string",[no]:"color",[so]:"number[]"},ao=Object.keys(oo).map(Number).sort(u);function ho(t){const e=[];for(const i of ao)lo(t,i)&&e.push(oo[i]);return 0===e.length?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function lo(t,e){return(t&e)===e}function co(t,e){return!!(t&e)}class uo{constructor(t,e){this.type=t,this.value=e}}class go{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function _o(){return{variables:new Set,properties:new Set}}function fo(t,e){switch(typeof t){case"boolean":return new uo(to,t);case"number":return new uo(eo,t);case"string":return new uo(io,t);default:}if(!Array.isArray(t))throw new Error("Expression must be an array or a primitive value");if(0===t.length)throw new Error("Empty expression");if("string"===typeof t[0])return So(t,e);for(const n of t)if("number"!==typeof n)throw new Error("Expected an array of numbers");let i=so;return 3!==t.length&&4!==t.length||(i|=no),new uo(i,t)}const po={Number:"number",String:"string",Get:"get",Var:"var",Any:"any",All:"all",Not:"!",Resolution:"resolution",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match"},mo={[po.Number]:Co(Eo(1,1/0,ro),eo),[po.String]:Co(Eo(1,1/0,ro),io),[po.Get]:Co(yo,ro),[po.Var]:Co(vo,ro),[po.Resolution]:Co(xo,eo),[po.Any]:Co(Eo(2,1/0,to),to),[po.All]:Co(Eo(2,1/0,to),to),[po.Not]:Co(Eo(1,1,to),to),[po.Equal]:Co(Eo(2,2,ro),to),[po.NotEqual]:Co(Eo(2,2,ro),to),[po.GreaterThan]:Co(Eo(2,2,ro),to),[po.GreaterThanOrEqualTo]:Co(Eo(2,2,ro),to),[po.LessThan]:Co(Eo(2,2,ro),to),[po.LessThanOrEqualTo]:Co(Eo(2,2,ro),to),[po.Multiply]:Co(Eo(2,1/0,eo),eo),[po.Divide]:Co(Eo(2,2,eo),eo),[po.Add]:Co(Eo(2,1/0,eo),eo),[po.Subtract]:Co(Eo(2,2,eo),eo),[po.Clamp]:Co(Eo(3,3,eo),eo),[po.Mod]:Co(Eo(2,2,eo),eo),[po.Pow]:Co(Eo(2,2,eo),eo),[po.Abs]:Co(Eo(1,1,eo),eo),[po.Floor]:Co(Eo(1,1,eo),eo),[po.Ceil]:Co(Eo(1,1,eo),eo),[po.Round]:Co(Eo(1,1,eo),eo),[po.Sin]:Co(Eo(1,1,eo),eo),[po.Cos]:Co(Eo(1,1,eo),eo),[po.Atan]:Co(Eo(1,2,eo),eo),[po.Sqrt]:Co(Eo(1,1,eo),eo),[po.Match]:Co(Eo(4,1/0,io|eo),ro)};function yo(t,e){if(2!==t.length)throw new Error("Expected 1 argument for get operation");const i=fo(t[1],e);if(!(i instanceof uo))throw new Error("Expected a literal argument for get operation");if("string"!==typeof i.value)throw new Error("Expected a string argument for get operation");return e.properties.add(i.value),[i]}function vo(t,e){if(2!==t.length)throw new Error("Expected 1 argument for var operation");const i=fo(t[1],e);if(!(i instanceof uo))throw new Error("Expected a literal argument for var operation");if("string"!==typeof i.value)throw new Error("Expected a string argument for get operation");return e.variables.add(i.value),[i]}function xo(t,e){const i=t[0];if(1!==t.length)throw new Error(`Expected no arguments for ${i} operation`);return[]}function Eo(t,e,i){return function(n,s){const r=n[0],o=n.length-1;if(t===e){if(o!==t){const e=1===t?"":"s";throw new Error(`Expected ${t} argument${e} for operation ${r}, got ${o}`)}}else if(o<t||o>e)throw new Error(`Expected ${t} to ${e} arguments for operation ${r}, got ${o}`);const a=new Array(o);for(let t=0;t<o;++t){const e=fo(n[t+1],s);if(!co(i,e.type)){const n=ho(i),s=ho(e.type);throw new Error(`Unexpected type for argument ${t} of ${r} operation : got ${n} but expected ${s}`)}a[t]=e}return a}}function Co(t,e){return function(i,n){const s=i[0],r=t(i,n);return new go(e,s,...r)}}function So(t,e){const i=t[0],n=mo[i];if(!n)throw new Error(`Unknown operator: ${i}`);return n(t,e)}function wo(){return{variables:{},properties:{},resolution:NaN}}function Ro(t,e,i){const n=fo(t,i);if(!co(e,n.type)){const t=ho(e),i=ho(n.type);throw new Error(`Expected expression to be of type ${t}, got ${i}`)}return To(n,i)}function To(t,e){if(t instanceof uo)return function(){return t.value};const i=t.operator;switch(i){case po.Number:case po.String:return Io(t,e);case po.Get:case po.Var:return Mo(t,e);case po.Resolution:return t=>t.resolution;case po.Any:case po.All:case po.Not:return bo(t,e);case po.Equal:case po.NotEqual:case po.LessThan:case po.LessThanOrEqualTo:case po.GreaterThan:case po.GreaterThanOrEqualTo:return Lo(t,e);case po.Multiply:case po.Divide:case po.Add:case po.Subtract:case po.Clamp:case po.Mod:case po.Pow:case po.Abs:case po.Floor:case po.Ceil:case po.Round:case po.Sin:case po.Cos:case po.Atan:case po.Sqrt:return Ao(t,e);case po.Match:return Oo(t,e);default:throw new Error(`Unsupported operator ${i}`)}}function Io(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let r=0;r<n;++r)s[r]=To(t.args[r],e);switch(i){case po.Number:case po.String:return t=>{for(let e=0;e<n;++e){const n=s[e](t);if(typeof n===i)return n}throw new Error(`Expected one of the values to be a ${i}`)};default:throw new Error(`Unsupported assertion operator ${i}`)}}function Mo(t,e){const i=t.args[0];if(!(i instanceof uo))throw new Error("Expected literal name");const n=i.value;if("string"!==typeof n)throw new Error("Expected string name");switch(t.operator){case po.Get:return t=>t.properties[n];case po.Var:return t=>t.variables[n];default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}function Lo(t,e){const i=t.operator,n=To(t.args[0],e),s=To(t.args[1],e);switch(i){case po.Equal:return t=>n(t)===s(t);case po.NotEqual:return t=>n(t)!==s(t);case po.LessThan:return t=>n(t)<s(t);case po.LessThanOrEqualTo:return t=>n(t)<=s(t);case po.GreaterThan:return t=>n(t)>s(t);case po.GreaterThanOrEqualTo:return t=>n(t)>=s(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}function bo(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let r=0;r<n;++r)s[r]=To(t.args[r],e);switch(i){case po.Any:return t=>{for(let e=0;e<n;++e)if(s[e](t))return!0;return!1};case po.All:return t=>{for(let e=0;e<n;++e)if(!s[e](t))return!1;return!0};case po.Not:return t=>!s[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}function Ao(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let r=0;r<n;++r)s[r]=To(t.args[r],e);switch(i){case po.Multiply:return t=>{let e=1;for(let i=0;i<n;++i)e*=s[i](t);return e};case po.Divide:return t=>s[0](t)/s[1](t);case po.Add:return t=>{let e=0;for(let i=0;i<n;++i)e+=s[i](t);return e};case po.Subtract:return t=>s[0](t)-s[1](t);case po.Clamp:return t=>{const e=s[0](t),i=s[1](t);if(e<i)return i;const n=s[2](t);return e>n?n:e};case po.Mod:return t=>s[0](t)%s[1](t);case po.Pow:return t=>Math.pow(s[0](t),s[1](t));case po.Abs:return t=>Math.abs(s[0](t));case po.Floor:return t=>Math.floor(s[0](t));case po.Ceil:return t=>Math.ceil(s[0](t));case po.Round:return t=>Math.round(s[0](t));case po.Sin:return t=>Math.sin(s[0](t));case po.Cos:return t=>Math.cos(s[0](t));case po.Atan:return 2===n?t=>Math.atan2(s[0](t),s[1](t)):t=>Math.atan(s[0](t));case po.Sqrt:return t=>Math.sqrt(s[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}function Oo(t,e){const i=t.args.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=To(t.args[s],e);return t=>{const e=n[0](t);for(let s=1;s<i;s+=2)if(e===n[s](t))return n[s+1](t);return n[i-1](t)}}function Po(t){return!0}function Do(t){const e=_o(),i=ko(t,e),n=wo();return function(t,e){return n.properties=t.getPropertiesInternal(),n.resolution=e,i(n)}}function Fo(t){const e=_o(),i=t.length,n=new Array(i);for(let o=0;o<i;++o)n[o]=No(t[o],e);const s=wo(),r=new Array(i);return function(t,e){s.properties=t.getPropertiesInternal(),s.resolution=e;for(let o=0;o<i;++o)r[o]=n[o](s);return r}}function ko(t,e){const i=t.length,n=new Array(i);for(let s=0;s<i;++s){const i=t[s],r="filter"in i?Ro(i.filter,to,e):Po;let o;if(Array.isArray(i.style)){const t=i.style.length;o=new Array(t);for(let n=0;n<t;++n)o[n]=No(i.style[n],e)}else o=[No(i.style,e)];n[s]={filter:r,styles:o}}return function(e){const s=[];let r=!1;for(let o=0;o<i;++o){const i=n[o].filter;if(i(e)&&(!t[o].else||!r)){r=!0;for(const t of n[o].styles){const i=t(e);i&&s.push(i)}}}return s}}function No(t,e){const i=Go(t,"",e),n=Wo(t,"",e),s=zo(t,e),r=Xo(t,e),o=Vo(t,"z-index",e),a=new zr;return function(t){let e=!0;if(i){const n=i(t);n&&(e=!1),a.setFill(n)}if(n){const i=n(t);i&&(e=!1),a.setStroke(i)}if(s){const i=s(t);i&&(e=!1),a.setText(i)}if(r){const i=r(t);i&&(e=!1),a.setImage(i)}return o&&a.setZIndex(o(t)),e?null:a}}function Go(t,e,i){const n=Uo(t,e+"fill-color",i);if(!n)return null;const s=new Or;return function(t){const e=n(t);return"none"===e?null:(s.setColor(e),s)}}function Wo(t,e,i){const n=Vo(t,e+"stroke-width",i),s=Uo(t,e+"stroke-color",i);if(!n&&!s)return null;const r=jo(t,e+"stroke-line-cap",i),o=jo(t,e+"stroke-line-join",i),a=Ho(t,e+"stroke-line-dash",i),h=Vo(t,e+"stroke-line-dash-offset",i),l=Vo(t,e+"stroke-miter-limit",i),c=new Dr;return function(t){if(s){const e=s(t);if("none"===e)return null;c.setColor(e)}if(n&&c.setWidth(n(t)),r){const e=r(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");c.setLineCap(e)}if(o){const e=o(t);if("bevel"!==e&&"round"!==e&&"miter"!==e)throw new Error("Expected bevel, round, or miter line join");c.setLineJoin(e)}return a&&c.setLineDash(a(t)),h&&c.setLineDashOffset(h(t)),l&&c.setMiterLimit(l(t)),c}}function zo(t,e){const i="text-",n=jo(t,i+"value",e);if(!n)return null;const s=Go(t,i,e),r=Go(t,i+"background-",e),o=Wo(t,i,e),a=Wo(t,i+"background-",e),h=jo(t,i+"font",e),l=Vo(t,i+"max-angle",e),c=Vo(t,i+"offset-x",e),u=Vo(t,i+"offset-y",e),d=Zo(t,i+"overflow",e),g=jo(t,i+"placement",e),_=Vo(t,i+"repeat",e),f=Jo(t,i+"scale",e),p=Zo(t,i+"rotate-with-view",e),m=Vo(t,i+"rotation",e),y=jo(t,i+"align",e),v=jo(t,i+"justify",e),x=jo(t,i+"baseline",e),E=Ho(t,i+"padding",e),C=new $r({});return function(t){if(C.setText(n(t)),s&&C.setFill(s(t)),r&&C.setBackgroundFill(r(t)),o&&C.setStroke(o(t)),a&&C.setBackgroundStroke(a(t)),h&&C.setFont(h(t)),l&&C.setMaxAngle(l(t)),c&&C.setOffsetX(c(t)),u&&C.setOffsetY(u(t)),d&&C.setOverflow(d(t)),g){const e=g(t);if("point"!==e&&"line"!==e)throw new Error("Expected point or line for text-placement");C.setPlacement(e)}if(_&&C.setRepeat(_(t)),f&&C.setScale(f(t)),p&&C.setRotateWithView(p(t)),m&&C.setRotation(m(t)),y){const e=y(t);if("left"!==e&&"center"!==e&&"right"!==e&&"end"!==e&&"start"!==e)throw new Error("Expected left, right, center, start, or end for text-align");C.setTextAlign(e)}if(v){const e=v(t);if("left"!==e&&"right"!==e&&"center"!==e)throw new Error("Expected left, right, or center for text-justify");C.setJustify(e)}if(x){const e=x(t);if("bottom"!==e&&"top"!==e&&"middle"!==e&&"alphabetic"!==e&&"hanging"!==e)throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");C.setTextBaseline(e)}return E&&C.setPadding(E(t)),C}}function Xo(t,e){return"icon-src"in t?Yo(t,e):"shape-points"in t?Bo(t,e):"circle-radius"in t?Ko(t,e):null}function Yo(t,e){const i="icon-",n=i+"src",s=aa(t[n],n),r=qo(t,i+"anchor",e),o=Jo(t,i+"scale",e),a=Vo(t,i+"opacity",e),h=qo(t,i+"displacement",e),l=Vo(t,i+"rotation",e),c=Zo(t,i+"rotate-with-view",e),u=ea(t,i+"anchor-origin"),d=ia(t,i+"anchor-x-units"),g=ia(t,i+"anchor-y-units"),_=ra(t,i+"color"),f=ta(t,i+"cross-origin"),p=na(t,i+"offset"),m=ea(t,i+"offset-origin"),y=$o(t,i+"width"),v=$o(t,i+"height"),x=Qo(t,i+"size"),E=sa(t,i+"declutter"),C=new Hr({src:s,anchorOrigin:u,anchorXUnits:d,anchorYUnits:g,color:_,crossOrigin:f,offset:p,offsetOrigin:m,height:v,width:y,size:x,declutterMode:E});return function(t){return a&&C.setOpacity(a(t)),h&&C.setDisplacement(h(t)),l&&C.setRotation(l(t)),c&&C.setRotateWithView(c(t)),o&&C.setScale(o(t)),r&&C.setAnchor(r(t)),C}}function Bo(t,e){const i="shape-",n=i+"points",s=ha(t[n],n),r=Go(t,i,e),o=Wo(t,i,e),a=Jo(t,i+"scale",e),h=qo(t,i+"displacement",e),l=Vo(t,i+"rotation",e),c=Zo(t,i+"rotate-with-view",e),u=$o(t,i+"radius"),d=$o(t,i+"radius1"),g=$o(t,i+"radius2"),_=$o(t,i+"angle"),f=sa(t,i+"declutter-mode"),p=new Mr({points:s,radius:u,radius1:d,radius2:g,angle:_,declutterMode:f});return function(t){return r&&p.setFill(r(t)),o&&p.setStroke(o(t)),h&&p.setDisplacement(h(t)),l&&p.setRotation(l(t)),c&&p.setRotateWithView(c(t)),a&&p.setScale(a(t)),p}}function Ko(t,e){const i="circle-",n=Go(t,i,e),s=Wo(t,i,e),r=Vo(t,i+"radius",e),o=Jo(t,i+"scale",e),a=qo(t,i+"displacement",e),h=Vo(t,i+"rotation",e),l=Zo(t,i+"rotate-with-view",e),c=sa(t,i+"declutter-mode"),u=new br({radius:5,declutterMode:c});return function(t){return r&&u.setRadius(r(t)),n&&u.setFill(n(t)),s&&u.setStroke(s(t)),a&&u.setDisplacement(a(t)),h&&u.setRotation(h(t)),l&&u.setRotateWithView(l(t)),o&&u.setScale(o(t)),u}}function Vo(t,e,i){if(!(e in t))return;const n=Ro(t[e],eo,i);return function(t){return ha(n(t),e)}}function jo(t,e,i){if(!(e in t))return null;const n=Ro(t[e],io,i);return function(t){return aa(n(t),e)}}function Zo(t,e,i){if(!(e in t))return null;const n=Ro(t[e],to,i);return function(t){const i=n(t);if("boolean"!==typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function Uo(t,e,i){if(!(e in t))return null;const n=Ro(t[e],no|io,i);return function(t){return la(n(t),e)}}function Ho(t,e,i){if(!(e in t))return null;const n=Ro(t[e],so,i);return function(t){return oa(n(t),e)}}function qo(t,e,i){if(!(e in t))return null;const n=Ro(t[e],so,i);return function(t){const i=oa(n(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function Jo(t,e,i){if(!(e in t))return null;const n=Ro(t[e],so|eo,i);return function(t){return ca(n(t),e)}}function $o(t,e){const i=t[e];if(void 0!==i){if("number"!==typeof i)throw new Error(`Expected a number for ${e}`);return i}}function Qo(t,e){const i=t[e];if(void 0!==i){if("number"===typeof i)return zs(i);if(!Array.isArray(i))throw new Error(`Expected a number or size array for ${e}`);if(2!==i.length||"number"!==typeof i[0]||"number"!==typeof i[1])throw new Error(`Expected a number or size array for ${e}`);return i}}function ta(t,e){const i=t[e];if(void 0!==i){if("string"!==typeof i)throw new Error(`Expected a string for ${e}`);return i}}function ea(t,e){const i=t[e];if(void 0!==i){if("bottom-left"!==i&&"bottom-right"!==i&&"top-left"!==i&&"top-right"!==i)throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return i}}function ia(t,e){const i=t[e];if(void 0!==i){if("pixels"!==i&&"fraction"!==i)throw new Error(`Expected pixels or fraction for ${e}`);return i}}function na(t,e){const i=t[e];if(void 0!==i)return oa(i,e)}function sa(t,e){const i=t[e];if(void 0!==i){if("string"!==typeof i)throw new Error(`Expected a string for ${e}`);if("declutter"!==i&&"obstacle"!==i&&"none"!==i)throw new Error(`Expected declutter, obstacle, or none for ${e}`);return i}}function ra(t,e){const i=t[e];if(void 0!==i)return la(i,e)}function oa(t,e){if(!Array.isArray(t))throw new Error(`Expected an array for ${e}`);const i=t.length;for(let n=0;n<i;++n)if("number"!==typeof t[n])throw new Error(`Expected an array of numbers for ${e}`);return t}function aa(t,e){if("string"!==typeof t)throw new Error(`Expected a string for ${e}`);return t}function ha(t,e){if("number"!==typeof t)throw new Error(`Expected a number for ${e}`);return t}function la(t,e){if("string"===typeof t)return t;const i=oa(t,e),n=i.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function ca(t,e){if("number"===typeof t)return t;const i=oa(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}const ua={RENDER_ORDER:"renderOrder"};class da extends Dn{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(ua.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t){t.declutterTree||(t.declutterTree=new Vs(9)),this.getRenderer().renderDeclutter(t)}setRenderOrder(t){this.set(ua.RENDER_ORDER,t)}setStyle(t){this.style_=ga(t),this.styleFunction_=null===t?void 0:kr(this.style_),this.changed()}}function ga(t){if(void 0===t)return Gr;if(!t)return null;if("function"===typeof t)return t;if(t instanceof zr)return t;if(!Array.isArray(t))return Fo([t]);if(0===t.length)return[];const e=t.length,i=t[0];if(i instanceof zr){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!(e instanceof zr))throw new Error("Expected a list of style instances");i[n]=e}return i}if("style"in i){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!("style"in e))throw new Error("Expected a list of rules with a style property");i[n]=e}return Do(i)}const n=t;return Fo(n)}var _a=da;const fa={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},pa=[fa.FILL],ma=[fa.STROKE],ya=[fa.BEGIN_PATH],va=[fa.CLOSE_PATH];var xa=fa;class Ea{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){}}var Ca=Ea;class Sa extends Ca{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return 1==e?t:t.map((function(t){return t*e}))}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,s=this.coordinates;let r=s.length;for(let o=0,a=t.length;o<a;o+=e)n[0]=t[o],n[1]=t[o+1],Ot(i,n)&&(s[r++]=n[0],s[r++]=n[1]);return r}appendFlatLineCoordinates(t,e,i,n,s,r){const o=this.coordinates;let a=o.length;const h=this.getBufferedMaxExtent();r&&(e+=n);let l=t[e],c=t[e+1];const u=this.tmpCoordinate_;let d,g,_,f=!0;for(d=e+n;d<i;d+=n)u[0]=t[d],u[1]=t[d+1],_=Ft(h,u),_!==g?(f&&(o[a++]=l,o[a++]=c,f=!1),o[a++]=u[0],o[a++]=u[1]):_===Tt.INTERSECTING?(o[a++]=u[0],o[a++]=u[1],f=!1):f=!0,l=u[0],c=u[1],g=_;return(s&&f||d===e+n)&&(o[a++]=l,o[a++]=c),a}drawCustomCoordinates_(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r],a=this.appendFlatLineCoordinates(t,e,o,n,!1,!1);s.push(a),e=o}return e}drawCustom(t,e,i,n){this.beginGeometry(t,e);const s=t.getType(),r=t.getStride(),o=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],r,i),c.push(i)}this.instructions.push([xa.CUSTOM,o,c,t,i,tn]),this.hitDetectionInstructions.push([xa.CUSTOM,o,c,t,n||i,tn]);break;case"Polygon":case"MultiLineString":l=[],a="Polygon"==s?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),u=this.drawCustomCoordinates_(a,0,t.getEnds(),r,l),this.instructions.push([xa.CUSTOM,o,l,t,i,Qi]),this.hitDetectionInstructions.push([xa.CUSTOM,o,l,t,n||i,Qi]);break;case"LineString":case"Circle":a=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(a,0,a.length,r,!1,!1),this.instructions.push([xa.CUSTOM,o,h,t,i,$i]),this.hitDetectionInstructions.push([xa.CUSTOM,o,h,t,n||i,$i]);break;case"MultiPoint":a=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(a,r),h>o&&(this.instructions.push([xa.CUSTOM,o,h,t,i,$i]),this.hitDetectionInstructions.push([xa.CUSTOM,o,h,t,n||i,$i]));break;case"Point":a=t.getFlatCoordinates(),this.coordinates.push(a[0],a[1]),h=this.coordinates.length,this.instructions.push([xa.CUSTOM,o,h,t,i]),this.hitDetectionInstructions.push([xa.CUSTOM,o,h,t,n||i]);break;default:}this.endGeometry(e)}beginGeometry(t,e){this.beginGeometryInstruction1_=[xa.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[xa.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,r=-1;for(e=0;e<i;++e)n=t[e],s=n[0],s==xa.END_GEOMETRY?r=e:s==xa.BEGIN_GEOMETRY&&(n[2]=e,g(this.hitDetectionInstructions,r,e),r=-1)}setFillStrokeStyle(t,e){const i=this.state;if(t){const e=t.getColor();i.fillStyle=Us(e||sr)}else i.fillStyle=void 0;if(e){const t=e.getColor();i.strokeStyle=Us(t||cr);const n=e.getLineCap();i.lineCap=void 0!==n?n:rr;const s=e.getLineDash();i.lineDash=s?s.slice():or;const r=e.getLineDashOffset();i.lineDashOffset=r||ar;const o=e.getLineJoin();i.lineJoin=void 0!==o?o:hr;const a=e.getWidth();i.lineWidth=void 0!==a?a:_r;const h=e.getMiterLimit();i.miterLimit=void 0!==h?h:lr,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=[xa.SET_FILL_STYLE,e];return"string"!==typeof e&&i.push(!0),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[xa.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,r=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||s!=t.currentLineDash&&!f(t.currentLineDash,s)||t.currentLineDashOffset!=r||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=h)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=s,t.currentLineDashOffset=r,t.currentLineJoin=o,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=[xa.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=bt(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;Lt(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}var wa=Sa;class Ra extends wa{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,r=this.appendFlatPointCoordinates(i,n);this.instructions.push([xa.DRAW_IMAGE,s,r,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([xa.DRAW_IMAGE,s,r,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,r=this.appendFlatPointCoordinates(i,n);this.instructions.push([xa.DRAW_IMAGE,s,r,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([xa.DRAW_IMAGE,s,r,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}}var Ta=Ra;class Ia extends wa{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n){const s=this.coordinates.length,r=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),o=[xa.MOVE_TO_LINE_TO,s,r];return this.instructions.push(o),this.hitDetectionInstructions.push(o),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([xa.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,or,ar],ya);const r=t.getFlatCoordinates(),o=t.getStride();this.drawFlatCoordinates_(r,0,r.length,o),this.hitDetectionInstructions.push(ma),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([xa.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,or,ar],ya);const r=t.getEnds(),o=t.getFlatCoordinates(),a=t.getStride();let h=0;for(let l=0,c=r.length;l<c;++l)h=this.drawFlatCoordinates_(o,h,r[l],a);this.hitDetectionInstructions.push(ma),this.endGeometry(e)}finish(){const t=this.state;return void 0!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(ma),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){void 0!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(ma),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(ya)}}var Ma=Ia;class La extends wa{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinatess_(t,e,i,n){const s=this.state,r=void 0!==s.fillStyle,o=void 0!==s.strokeStyle,a=i.length;this.instructions.push(ya),this.hitDetectionInstructions.push(ya);for(let h=0;h<a;++h){const s=i[h],r=this.coordinates.length,a=this.appendFlatLineCoordinates(t,e,s,n,!0,!o),l=[xa.MOVE_TO_LINE_TO,r,a];this.instructions.push(l),this.hitDetectionInstructions.push(l),o&&(this.instructions.push(va),this.hitDetectionInstructions.push(va)),e=s}return r&&(this.instructions.push(pa),this.hitDetectionInstructions.push(pa)),o&&(this.instructions.push(ma),this.hitDetectionInstructions.push(ma)),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([xa.SET_FILL_STYLE,sr]),void 0!==i.strokeStyle&&this.hitDetectionInstructions.push([xa.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,or,ar]);const r=t.getFlatCoordinates(),o=t.getStride(),a=this.coordinates.length;this.appendFlatLineCoordinates(r,0,r.length,o,!1,!1);const h=[xa.CIRCLE,a];this.instructions.push(ya,h),this.hitDetectionInstructions.push(ya,h),void 0!==i.fillStyle&&(this.instructions.push(pa),this.hitDetectionInstructions.push(pa)),void 0!==i.strokeStyle&&(this.instructions.push(ma),this.hitDetectionInstructions.push(ma)),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([xa.SET_FILL_STYLE,sr]),void 0!==i.strokeStyle&&this.hitDetectionInstructions.push([xa.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,or,ar]);const r=t.getEnds(),o=t.getOrientedFlatCoordinates(),a=t.getStride();this.drawFlatCoordinatess_(o,0,r,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([xa.SET_FILL_STYLE,sr]),void 0!==i.strokeStyle&&this.hitDetectionInstructions.push([xa.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,or,ar]);const r=t.getEndss(),o=t.getOrientedFlatCoordinates(),a=t.getStride();let h=0;for(let l=0,c=r.length;l<c;++l)h=this.drawFlatCoordinatess_(o,h,r[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]=Hi(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state,e=t.fillStyle;void 0!==e&&this.updateFillStyle(t,this.createFill),void 0!==t.strokeStyle&&this.updateStrokeStyle(t,this.applyStroke)}}var ba=La;function Aa(t,e,i,n,s){const r=[];let o=i,a=0,h=e.slice(i,2);while(a<t&&o+s<n){const[i,n]=h.slice(-2),l=e[o+s],c=e[o+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=j(i,l,e),g=j(n,c,e);h.push(d,g),r.push(h),h=[d,g],a==t&&(o+=s),a=0}else if(a<t)h.push(e[o+s],e[o+s+1]),o+=s;else{const t=u-a,e=j(i,l,t/u),d=j(n,c,t/u);h.push(e,d),r.push(h),h=[e,d],a=0,o+=s}}return a>0&&r.push(h),r}function Oa(t,e,i,n,s){let r,o,a,h,l,c,u,d,g,_,f=i,p=i,m=0,y=0,v=i;for(o=i;o<n;o+=s){const i=e[o],n=e[o+1];void 0!==l&&(g=i-l,_=n-c,h=Math.sqrt(g*g+_*_),void 0!==u&&(y+=a,r=Math.acos((u*g+d*_)/(a*h)),r>t&&(y>m&&(m=y,f=v,p=o),y=0,v=o-s)),a=h,u=g,d=_),l=i,c=n}return y+=h,y>m?[v,o]:[f,p]}const Pa={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class Da extends wa{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[sr]={fillStyle:sr},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 r=this.coordinates;let o=r.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;break;default:}const n=this.appendFlatPointCoordinates(h,l);if(n===o)return;if(i&&(n-o)/2!==h.length/l){let t=o/2;i=i.filter(((e,i)=>{const n=r[2*(t+i)]===h[i*l]&&r[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!=gr&&(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([xa.DRAW_IMAGE,o,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,c==gr?gr: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=sr,this.hitDetectionInstructions.push(this.createFill(this.state))),this.hitDetectionInstructions.push([xa.DRAW_IMAGE,o,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_?sr: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(!re(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?Aa(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(void 0==c){const t=Oa(s.maxAngle,a,0,a.length,2);h=t[0],d=t[1]}for(let t=h;t<d;t+=l)r.push(a[t],a[t+1]);const g=r.length;u=i[t],this.drawChars_(o,g),o=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||ur,justify:e.justify,textBaseline:e.textBaseline||dr,scale:e.scale});const r=this.fillKey_;i&&(r in this.fillStates||(this.fillStates[r]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,s=this.strokeKey_,r=this.textKey_,o=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,h=Pa[n.textBaseline],l=this.textOffsetY_*a,c=this.text_,u=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([xa.DRAW_CHARS,t,e,h,n.overflow,o,n.maxAngle,a,l,s,u*a,c,r,1]),this.hitDetectionInstructions.push([xa.DRAW_CHARS,t,e,h,n.overflow,o?sr:o,n.maxAngle,a,l,s,u*a,c,r,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=Us(e.getColor()||sr)):(n=null,this.textFillState_=n);const r=t.getStroke();if(r){s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);const t=r.getLineDash(),e=r.getLineDashOffset(),i=r.getWidth(),n=r.getMiterLimit();s.lineCap=r.getLineCap()||rr,s.lineDash=t?t.slice():or,s.lineDashOffset=void 0===e?ar:e,s.lineJoin=r.getLineJoin()||hr,s.lineWidth=void 0===i?_r:i,s.miterLimit=void 0===n?lr:n,s.strokeStyle=Us(r.getColor()||cr)}else s=null,this.textStrokeState_=s;i=this.textState_;const o=t.getFont()||nr;vr(o);const a=t.getScaleArray();i.overflow=t.getOverflow(),i.font=o,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||dr,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||gr,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:D(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:"|"+D(n.fillStyle):""}else this.text_="";this.declutterImageWithText_=e}}var Fa=Da;const ka={Circle:ba,Default:wa,Image:Ta,LineString:Ma,Polygon:ba,Text:Fa};class Na{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){const t=ka[e];s=new t(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=s}return s}}var Ga=Na;function Wa(t,e,i,n,s,r,o,a,h,l,c,u){let d=t[e],g=t[e+1],_=0,f=0,p=0,m=0;function y(){_=d,f=g,e+=n,d=t[e],g=t[e+1],m+=p,p=Math.sqrt((d-_)*(d-_)+(g-f)*(g-f))}do{y()}while(e<i-n&&m+p<r);let v=0===p?0:(r-m)/p;const x=j(_,d,v),E=j(f,g,v),C=e-n,S=m,w=r+a*h(l,s,c);while(e<i-n&&m+p<w)y();v=0===p?0:(w-m)/p;const R=j(_,d,v),T=j(f,g,v);let I;if(u){const t=[x,E,R,T];Li(t,0,4,2,u,t,t),I=t[0]>t[2]}else I=x>R;const M=Math.PI,L=[],b=C+n===e;let A;if(e=C,p=0,m=S,d=t[e],g=t[e+1],b){y(),A=Math.atan2(g-f,d-_),I&&(A+=A>0?-M:M);const t=(R+x)/2,e=(T+E)/2;return L[0]=[t,e,(w-r)/2,A,s],L}s=s.replace(/\n/g," ");for(let O=0,P=s.length;O<P;){y();let t=Math.atan2(g-f,d-_);if(I&&(t+=t>0?-M:M),void 0!==A){let e=t-A;if(e+=e>M?-2*M:e<-M?2*M:0,Math.abs(e)>o)return null}A=t;const u=O;let x=0;for(;O<P;++O){const t=I?P-O-1:O,o=a*h(l,s[t],c);if(e+n<i&&m+p<r+x+o/2)break;x+=o}if(O===u)continue;const E=I?s.substring(P-u,P-O):s.substring(u,O);v=0===p?0:(r+x/2-m)/p;const C=j(_,d,v),S=j(f,g,v);L.push([C,S,x/2,t,E]),r+=x}return L}function za(t,e,i,n){let s=t[e],r=t[e+1],o=0;for(let a=e+n;a<i;a+=n){const e=t[a],i=t[a+1];o+=Math.sqrt((e-s)*(e-s)+(i-r)*(i-r)),s=e,r=i}return o}const Xa=kt(),Ya=[],Ba=[],Ka=[],Va=[];function ja(t){return t[3].declutterBox}const Za=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 Ua(t,e){return"start"===e?e=Za.test(t)?"right":"left":"end"===e&&(e=Za.test(t)?"left":"right"),Pa[e]}function Ha(t,e,i){return i>0&&t.push("\n",""),t.push(e,""),t}class qa{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_=mi(),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 r=n?this.strokeStates[n]:null,o=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?Pa[a.justify]:Ua(Array.isArray(t)?t[0]:t,a.textAlign||ur),d=n&&r.lineWidth?r.lineWidth:0,g=c?t:t.split("\n").reduce(Ha,[]),{width:_,height:f,widths:p,heights:m,lineWidths:y}=wr(a,g),v=_+d,x=[],E=(v+2)*l[0],C=(f+d)*l[1],S={width:E<0?Math.floor(E):Math.ceil(E),height:C<0?Math.floor(C):Math.ceil(C),contextInstructions:x};1==l[0]&&1==l[1]||x.push("scale",l),n&&(x.push("strokeStyle",r.strokeStyle),x.push("lineWidth",d),x.push("lineCap",r.lineCap),x.push("lineJoin",r.lineJoin),x.push("miterLimit",r.miterLimit),x.push("setLineDash",[r.lineDash]),x.push("lineDashOffset",r.lineDashOffset)),i&&x.push("fillStyle",o.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const w=.5-u;let R=u*v+w*d;const T=[],I=[];let M,L=0,b=0,A=0,O=0;for(let P=0,D=g.length;P<D;P+=2){const t=g[P];if("\n"===t){b+=L,L=0,R=u*v+w*d,++O;continue}const e=g[P+1]||a.font;e!==M&&(n&&T.push("font",e),i&&I.push("font",e),M=e),L=Math.max(L,m[A]);const s=[t,R+w*p[A]+u*(p[A]-y[O]),.5*(d+L)+b];R+=p[A],n&&T.push("strokeText",s),i&&I.push("fillText",s),++A}return Array.prototype.push.apply(x,T),Array.prototype.push.apply(x,I),this.labels_[s]=S,S}replayTextBackground_(t,e,i,n,s,r,o){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,n),t.lineTo.apply(t,s),t.lineTo.apply(t,e),r&&(this.alignFill_=r[2],this.fill_(t)),o&&(this.setStrokeStyle_(t,o),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,n,s,r,o,a,h,l,c,u,d,g,_,f){o*=u[0],a*=u[1];let p=i-o,m=n-a;const y=s+h>t?t-h:s,v=r+l>e?e-l:r,x=g[3]+y*u[0]+g[1],E=g[0]+v*u[1]+g[2],C=p-g[3],S=m-g[0];let w;return(_||0!==c)&&(Ya[0]=C,Va[0]=C,Ya[1]=S,Ba[1]=S,Ba[0]=C+x,Ka[0]=Ba[0],Ka[1]=S+E,Va[1]=Ka[1]),0!==c?(w=Si(mi(),i,n,1,1,c,-i,-n),Ei(w,Ya),Ei(w,Ba),Ei(w,Ka),Ei(w,Va),Nt(Math.min(Ya[0],Ba[0],Ka[0],Va[0]),Math.min(Ya[1],Ba[1],Ka[1],Va[1]),Math.max(Ya[0],Ba[0],Ka[0],Va[0]),Math.max(Ya[1],Ba[1],Ka[1],Va[1]),Xa)):Nt(Math.min(C,C+x),Math.min(S,S+E),Math.max(C,C+x),Math.max(S,S+E),Xa),d&&(p=Math.round(p),m=Math.round(m)),{drawImageX:p,drawImageY:m,drawImageW:y,drawImageH:v,originX:h,originY:l,declutterBox:{minX:Xa[0],minY:Xa[1],maxX:Xa[2],maxY:Xa[3],value:f},canvasTransform:w,scale:u}}replayImageOrLabel_(t,e,i,n,s,r,o){const a=!(!r&&!o),h=n.declutterBox,l=t.canvas,c=o?o[2]*n.scale[0]/2:0,u=h.minX-c<=l.width/e&&h.maxX+c>=0&&h.minY-c<=l.height/e&&h.maxY+c>=0;return u&&(a&&this.replayTextBackground_(t,Ya,Ba,Ka,Va,r,o),Rr(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=Ei(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],r=this.createLabel(t,e,n,i),o=this.strokeStates[i],a=this.pixelRatio,h=Ua(Array.isArray(t)?t[0]:t,s.textAlign||ur),l=Pa[s.textBaseline||dr],c=o&&o.lineWidth?o.lineWidth:0,u=r.width/a-2*s.scale[0],d=h*u+2*(.5-h)*c,g=l*r.height/a+2*(.5-l)*c;return{label:r,anchorX:d,anchorY:g}}execute_(t,e,i,n,s,r,o,a){let h;this.pixelCoordinates_&&f(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=Mi(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),xi(this.renderedTransform_,i));let l=0;const c=n.length;let u,d,g,_,p,m,y,v,x,E,C,S,w=0,R=0,T=0,I=null,M=null;const L=this.coordinateCache_,b=this.viewRotation_,A=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,O={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:b},P=this.instructions!=n||this.overlaps?0:200;let D,F,k,N;while(l<c){const i=n[l],c=i[0];switch(c){case xa.BEGIN_GEOMETRY:D=i[1],N=i[3],D.getGeometry()?void 0===o||re(o,N.getExtent())?++l:l=i[2]+1:l=i[2];break;case xa.BEGIN_PATH:R>P&&(this.fill_(t),R=0),T>P&&(t.stroke(),T=0),R||T||(t.beginPath(),_=NaN,p=NaN),++l;break;case xa.CIRCLE:w=i[1];const n=h[w],c=h[w+1],f=h[w+2],G=h[w+3],W=f-n,z=G-c,X=Math.sqrt(W*W+z*z);t.moveTo(n+X,c),t.arc(n,c,X,0,2*Math.PI,!0),++l;break;case xa.CLOSE_PATH:t.closePath(),++l;break;case xa.CUSTOM:w=i[1],u=i[2];const Y=i[3],B=i[4],K=6==i.length?i[5]:void 0;O.geometry=Y,O.feature=D,l in L||(L[l]=[]);const V=L[l];K?K(h,w,u,2,V):(V[0]=h[w],V[1]=h[w+1],V.length=2),B(V,O),++l;break;case xa.DRAW_IMAGE:w=i[1],u=i[2],v=i[3],d=i[4],g=i[5];let j=i[6];const Z=i[7],U=i[8],H=i[9],q=i[10];let J=i[11];const $=i[12];let Q=i[13];const tt=i[14],et=i[15];if(!v&&i.length>=20){x=i[19],E=i[20],C=i[21],S=i[22];const t=this.drawLabelWithPointPlacement_(x,E,C,S);v=t.label,i[3]=v;const e=i[23];d=(t.anchorX-e)*this.pixelRatio,i[4]=d;const n=i[24];g=(t.anchorY-n)*this.pixelRatio,i[5]=g,j=v.height,i[6]=j,Q=v.width,i[13]=Q}let it,nt,st,rt;i.length>25&&(it=i[25]),i.length>17?(nt=i[16],st=i[17],rt=i[18]):(nt=gr,st=!1,rt=!1),q&&A?J+=b:q||A||(J-=b);let ot=0;for(;w<u;w+=2){if(it&&it[ot++]<Q/this.pixelRatio)continue;const i=this.calculateImageOrLabelDimensions_(v.width,v.height,h[w],h[w+1],Q,j,d,g,U,H,J,$,s,nt,st||rt,D),n=[t,e,v,i,Z,st?I:null,rt?M:null];if(a){if("none"===tt)continue;if("obstacle"===tt){a.insert(i.declutterBox);continue}{let t,e;if(et){const i=u-w;if(!et[i]){et[i]=n;continue}if(t=et[i],delete et[i],e=ja(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)}++l;break;case xa.DRAW_CHARS:const at=i[1],ht=i[2],lt=i[3],ct=i[4];S=i[5];const ut=i[6],dt=i[7],gt=i[8];C=i[9];const _t=i[10];x=i[11],E=i[12];const ft=[i[13],i[13]],pt=this.textStates[E],mt=pt.font,yt=[pt.scale[0]*dt,pt.scale[1]*dt];let vt;mt in this.widths_?vt=this.widths_[mt]:(vt={},this.widths_[mt]=vt);const xt=za(h,at,ht,2),Et=Math.abs(yt[0])*Sr(mt,x,vt);if(ct||Et<=xt){const i=this.textStates[E].textAlign,n=(xt-Et)*Ua(x,i),s=Wa(h,at,ht,2,x,n,ut,Math.abs(yt[0]),Sr,mt,vt,A?0:this.viewRotation_);t:if(s){const i=[];let n,r,o,h,l;if(C)for(n=0,r=s.length;n<r;++n){l=s[n],o=l[4],h=this.createLabel(o,E,"",C),d=l[2]+(yt[0]<0?-_t:_t),g=lt*h.height+2*(.5-lt)*_t*yt[1]/yt[0]-gt;const r=this.calculateImageOrLabelDimensions_(h.width,h.height,l[0],l[1],h.width,h.height,d,g,0,0,l[3],ft,!1,gr,!1,D);if(a&&a.collides(r.declutterBox))break t;i.push([t,e,h,r,1,null,null])}if(S)for(n=0,r=s.length;n<r;++n){l=s[n],o=l[4],h=this.createLabel(o,E,S,""),d=l[2],g=lt*h.height-gt;const r=this.calculateImageOrLabelDimensions_(h.width,h.height,l[0],l[1],h.width,h.height,d,g,0,0,l[3],ft,!1,gr,!1,D);if(a&&a.collides(r.declutterBox))break t;i.push([t,e,h,r,1,null,null])}a&&a.load(i.map(ja));for(let t=0,e=i.length;t<e;++t)this.replayImageOrLabel_.apply(this,i[t])}}++l;break;case xa.END_GEOMETRY:if(void 0!==r){D=i[1];const t=r(D,N);if(t)return t}++l;break;case xa.FILL:P?R++:this.fill_(t),++l;break;case xa.MOVE_TO_LINE_TO:for(w=i[1],u=i[2],F=h[w],k=h[w+1],m=F+.5|0,y=k+.5|0,m===_&&y===p||(t.moveTo(F,k),_=m,p=y),w+=2;w<u;w+=2)F=h[w],k=h[w+1],m=F+.5|0,y=k+.5|0,w!=u-2&&m===_&&y===p||(t.lineTo(F,k),_=m,p=y);++l;break;case xa.SET_FILL_STYLE:I=i,this.alignFill_=i[2],R&&(this.fill_(t),R=0,T&&(t.stroke(),T=0)),t.fillStyle=i[1],++l;break;case xa.SET_STROKE_STYLE:M=i,T&&(t.stroke(),T=0),this.setStrokeStyle_(t,i),++l;break;case xa.STROKE:P?T++:t.stroke(),++l;break;default:++l;break}}R&&this.fill_(t),T&&t.stroke()}execute(t,e,i,n,s,r){this.viewRotation_=n,this.execute_(t,e,i,this.instructions,s,void 0,void 0,r)}executeHitDetection(t,e,i,n,s){return this.viewRotation_=i,this.execute_(t,1,e,this.hitDetectionInstructions,!0,n,s)}}var Ja=qa;const $a=["Polygon","Circle","LineString","Image","Text","Default"];class Qa{constructor(t,e,i,n,s,r){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=r,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=mi(),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 Ja(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,r){n=Math.round(n);const o=2*n+1,a=Si(this.hitDetectionTransform_,n+.5,n+.5,1/e,-1/e,-i,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=$n(o,o,void 0,{willReadFrequently:!0}));const l=this.hitDetectionContext_;let c;l.canvas.width!==o||l.canvas.height!==o?(l.canvas.width=o,l.canvas.height=o):h||l.clearRect(0,0,o,o),void 0!==this.renderBuffer_&&(c=kt(),Bt(c,t),Lt(c,e*(this.renderBuffer_+n),c));const d=eh(n);let g;function _(t,e){const i=l.getImageData(0,0,o,o).data;for(let a=0,h=d.length;a<h;a++)if(i[d[a]]>0){if(!r||"Image"!==g&&"Text"!==g||r.includes(t)){const i=(d[a]-3)/4,r=n-i%o,h=n-(i/o|0),l=s(t,e,r*r+h*h);if(l)return l}l.clearRect(0,0,o,o);break}}const f=Object.keys(this.executorsByZIndex_).map(Number);let p,m,y,v,x;for(f.sort(u),p=f.length-1;p>=0;--p){const t=f[p].toString();for(y=this.executorsByZIndex_[t],m=$a.length-1;m>=0;--m)if(g=$a[m],v=y[g],void 0!==v&&(x=v.executeHitDetection(l,a,i,_,c),x))return x}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],s=e[2],r=e[3],o=[i,n,i,r,s,r,s,n];return Mi(o,0,8,2,t,o),o}isEmpty(){return C(this.executorsByZIndex_)}execute(t,e,i,n,s,r,o){const a=Object.keys(this.executorsByZIndex_).map(Number);let h,l,c,d,g,_;for(a.sort(u),this.maxExtent_&&(t.save(),this.clip(t,i)),r=r||$a,o&&a.reverse(),h=0,l=a.length;h<l;++h){const l=a[h].toString();for(g=this.executorsByZIndex_[l],c=0,d=r.length;c<d;++c){const a=r[c];_=g[a],void 0!==_&&_.execute(t,e,i,n,s,o)}}this.maxExtent_&&t.restore()}}const th={};function eh(t){if(void 0!==th[t])return th[t];const e=2*t+1,i=t*t,n=new Array(i+1);for(let r=0;r<=t;++r)for(let s=0;s<=t;++s){const o=r*r+s*s;if(o>i)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+r)*e+(t+s))+3),r>0&&a.push(4*((t-r)*e+(t+s))+3),s>0&&(a.push(4*((t+r)*e+(t-s))+3),r>0&&a.push(4*((t-r)*e+(t-s))+3))}const s=[];for(let r=0,o=n.length;r<o;++r)n[r]&&s.push(...n[r]);return th[t]=s,s}var ih=Qa;class nh extends Ca{constructor(t,e,i,n,s,r,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?Z(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=r,this.userTransform_=o,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=mi()}drawImages_(t,e,i,n){if(!this.image_)return;const s=Mi(t,e,i,n,this.transform_,this.pixelCoordinates_),r=this.context_,o=this.tmpLocalTransform_,a=r.globalAlpha;1!=this.imageOpacity_&&(r.globalAlpha=a*this.imageOpacity_);let 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_;Si(o,i,n,1,1,h,-i,-n),r.save(),r.transform.apply(r,o),r.translate(i,n),r.scale(this.imageScale_[0],this.imageScale_[1]),r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),r.restore()}else r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,t,e,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(r.globalAlpha=a)}drawText_(t,e,i,n){if(!this.textState_||""===this.text_)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const s=Mi(t,e,i,n,this.transform_,this.pixelCoordinates_),r=this.context_;let o=this.textRotation_;for(0===this.transformRotation_&&(o-=this.viewRotation_),this.textRotateWithView_&&(o+=this.viewRotation_);e<i;e+=n){const t=s[e]+this.textOffsetX_,i=s[e+1]+this.textOffsetY_;0!==o||1!=this.textScale_[0]||1!=this.textScale_[1]?(r.save(),r.translate(t-this.textOffsetX_,i-this.textOffsetY_),r.rotate(o),r.translate(this.textOffsetX_,this.textOffsetY_),r.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&r.strokeText(this.text_,0,0),this.textFillState_&&r.fillText(this.text_,0,0),r.restore()):(this.textStrokeState_&&r.strokeText(this.text_,t,i),this.textFillState_&&r.fillText(this.text_,t,i))}}moveToLineTo_(t,e,i,n,s){const r=this.context_,o=Mi(t,e,i,n,this.transform_,this.pixelCoordinates_);r.moveTo(o[0],o[1]);let a=o.length;s&&(a-=2);for(let h=2;h<a;h+=2)r.lineTo(o[h],o[h+1]);return s&&r.closePath(),i}drawRings_(t,e,i,n){for(let s=0,r=i.length;s<r;++s)e=this.moveToLineTo_(t,e,i[s],n,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),re(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=Gi(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],n=e[3]-e[1],s=Math.sqrt(i*i+n*n),r=this.context_;r.beginPath(),r.arc(e[0],e[1],s,0,2*Math.PI),this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}""!==this.text_&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){const e=t.getType();switch(e){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);break;default:}}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_)),re(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(re(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();let n=0;const s=t.getEnds(),r=t.getStride();e.beginPath();for(let t=0,o=s.length;t<o;++t)n=this.moveToLineTo_(i,n,s[t],r,!1);e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoints();this.drawText_(e,0,e.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),re(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_)),re(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let n=0;const s=t.getEndss(),r=t.getStride();e.beginPath();for(let t=0,o=s.length;t<o;++t){const e=s[t];n=this.drawRings_(i,n,e,r)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),f(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:ur;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:Us(e||sr)}}else this.fillState_=null;if(e){const t=e.getColor(),i=e.getLineCap(),n=e.getLineDash(),s=e.getLineDashOffset(),r=e.getLineJoin(),o=e.getWidth(),a=e.getMiterLimit(),h=n||or;this.strokeState_={lineCap:void 0!==i?i:rr,lineDash:1===this.pixelRatio_?h:h.map((t=>t*this.pixelRatio_)),lineDashOffset:(s||ar)*this.pixelRatio_,lineJoin:void 0!==r?r:hr,lineWidth:(void 0!==o?o:_r)*this.pixelRatio_,miterLimit:void 0!==a?a:lr,strokeStyle:Us(t||cr)}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),s=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const r=t.getScaleArray();this.imageScale_=[r[0]*this.pixelRatio_/i,r[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:Us(t||sr)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),s=i.getLineDashOffset(),r=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:rr,lineDash:n||or,lineDashOffset:s||ar,lineJoin:void 0!==r?r:hr,lineWidth:void 0!==o?o:_r,miterLimit:void 0!==a?a:lr,strokeStyle:Us(t||cr)}}else this.textStrokeState_=null;const n=t.getFont(),s=t.getOffsetX(),r=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),h=t.getScaleArray(),l=t.getText(),c=t.getTextAlign(),u=t.getTextBaseline();this.textState_={font:void 0!==n?n:nr,textAlign:void 0!==c?c:ur,textBaseline:void 0!==u?u:dr},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!==r?this.pixelRatio_*r:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}else this.text_=""}}var sh=nh;const rh=.5;function oh(t,e,i,n,s,r,o){const a=t[0]*rh,h=t[1]*rh,l=$n(a,h);l.imageSmoothingEnabled=!1;const c=l.canvas,d=new sh(l,rh,s,null,o),g=i.length,_=Math.floor(16777215/g),f={};for(let u=1;u<=g;++u){const t=i[u-1],e=t.getStyleFunction()||n;if(!e)continue;let o=e(t,r);if(!o)continue;Array.isArray(o)||(o=[o]);const a=u*_,h=a.toString(16).padStart(7,"#00000");for(let i=0,n=o.length;i<n;++i){const e=o[i],n=e.getGeometryFunction()(t);if(!n||!re(s,n.getExtent()))continue;const r=e.clone(),a=r.getFill();a&&a.setColor(h);const l=r.getStroke();l&&(l.setColor(h),l.setLineDash(null)),r.setText(void 0);const c=e.getImage();if(c){const t=c.getImageSize();if(!t)continue;const e=$n(t[0],t[1],void 0,{alpha:!1}),i=e.canvas;e.fillStyle=h,e.fillRect(0,0,i.width,i.height),r.setImage(new Hr({img:i,anchor:c.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:c.getOrigin(),opacity:1,size:c.getSize(),scale:c.getScale(),rotation:c.getRotation(),rotateWithView:c.getRotateWithView()}))}const u=r.getZIndex()||0;let d=f[u];d||(d={},f[u]=d,d["Polygon"]=[],d["Circle"]=[],d["LineString"]=[],d["Point"]=[]);const g=n.getType();if("GeometryCollection"===g){const t=n.getGeometriesArrayRecursive();for(let e=0,i=t.length;e<i;++e){const i=t[e];d[i.getType().replace("Multi","")].push(i,r)}}else d[g.replace("Multi","")].push(n,r)}}const p=Object.keys(f).map(Number).sort(u);for(let u=0,m=p.length;u<m;++u){const t=f[p[u]];for(const i in t){const n=t[i];for(let t=0,i=n.length;t<i;t+=2){d.setStyle(n[t+1]);for(let i=0,s=e.length;i<s;++i)d.setTransform(e[i]),d.drawGeometry(n[t])}}}return l.getImageData(0,0,c.width,c.height)}function ah(t,e,i){const n=[];if(i){const s=Math.floor(Math.round(t[0])*rh),r=Math.floor(Math.round(t[1])*rh),o=4*(z(s,0,i.width-1)+z(r,0,i.height-1)*i.width),a=i.data[o],h=i.data[o+1],l=i.data[o+2],c=l+256*(h+256*a),u=Math.floor(16777215/e.length);c&&c%u===0&&n.push(e[c/u-1])}return n}const hh=.5,lh={Point:Eh,LineString:yh,Polygon:Sh,MultiPoint:Ch,MultiLineString:vh,MultiPolygon:xh,GeometryCollection:mh,Circle:gh};function ch(t,e){return parseInt(D(t),10)-parseInt(D(e),10)}function uh(t,e){const i=dh(t,e);return i*i}function dh(t,e){return hh*t/e}function gh(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(r||o){const s=t.getBuilder(i.getZIndex(),"Circle");s.setFillStrokeStyle(r,o),s.drawCircle(e,n)}const a=i.getText();if(a&&a.getText()){const r=(s||t).getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,n)}}function _h(t,e,i,n,s,r,o){let a=!1;const h=i.getImage();if(h){const t=h.getImageState();t==Gn.LOADED||t==Gn.ERROR?h.unlistenImageChange(s):(t==Gn.IDLE&&h.load(),h.listenImageChange(s),a=!0)}return fh(t,e,i,n,r,o),a}function fh(t,e,i,n,s,r){const o=i.getGeometryFunction()(e);if(!o)return;const a=o.simplifyTransformed(n,s),h=i.getRenderer();if(h)ph(t,a,i,e);else{const n=lh[a.getType()];n(t,a,i,e,r)}}function ph(t,e,i,n){if("GeometryCollection"==e.getType()){const s=e.getGeometries();for(let e=0,r=s.length;e<r;++e)ph(t,s[e],i,n);return}const s=t.getBuilder(i.getZIndex(),"Default");s.drawCustom(e,n,i.getRenderer(),i.getHitDetectionRenderer())}function mh(t,e,i,n,s){const r=e.getGeometriesArray();let o,a;for(o=0,a=r.length;o<a;++o){const e=lh[r[o].getType()];e(t,r[o],i,n,s)}}function yh(t,e,i,n,s){const r=i.getStroke();if(r){const s=t.getBuilder(i.getZIndex(),"LineString");s.setFillStrokeStyle(null,r),s.drawLineString(e,n)}const o=i.getText();if(o&&o.getText()){const r=(s||t).getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,n)}}function vh(t,e,i,n,s){const r=i.getStroke();if(r){const s=t.getBuilder(i.getZIndex(),"LineString");s.setFillStrokeStyle(null,r),s.drawMultiLineString(e,n)}const o=i.getText();if(o&&o.getText()){const r=(s||t).getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,n)}}function xh(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(o||r){const s=t.getBuilder(i.getZIndex(),"Polygon");s.setFillStrokeStyle(r,o),s.drawMultiPolygon(e,n)}const a=i.getText();if(a&&a.getText()){const r=(s||t).getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,n)}}function Eh(t,e,i,n,s){const r=i.getImage(),o=i.getText();let a;if(r){if(r.getImageState()!=Gn.LOADED)return;let h=t;if(s){const l=r.getDeclutterMode();if("none"!==l)if(h=s,"obstacle"===l){const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(r,a),s.drawPoint(e,n)}else o&&o.getText()&&(a={})}const l=h.getBuilder(i.getZIndex(),"Image");l.setImageStyle(r,a),l.drawPoint(e,n)}if(o&&o.getText()){let r=t;s&&(r=s);const h=r.getBuilder(i.getZIndex(),"Text");h.setTextStyle(o,a),h.drawText(e,n)}}function Ch(t,e,i,n,s){const r=i.getImage(),o=i.getText();let a;if(r){if(r.getImageState()!=Gn.LOADED)return;let h=t;if(s){const l=r.getDeclutterMode();if("none"!==l)if(h=s,"obstacle"===l){const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(r,a),s.drawMultiPoint(e,n)}else o&&o.getText()&&(a={})}const l=h.getBuilder(i.getZIndex(),"Image");l.setImageStyle(r,a),l.drawMultiPoint(e,n)}if(o&&o.getText()){let r=t;s&&(r=s);const h=r.getBuilder(i.getZIndex(),"Text");h.setTextStyle(o,a),h.drawText(e,n)}}function Sh(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(r||o){const s=t.getBuilder(i.getZIndex(),"Polygon");s.setFillStrokeStyle(r,o),s.drawPolygon(e,n)}const a=i.getText();if(a&&a.getText()){const r=(s||t).getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,n)}}class wh extends cs{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_=kt(),this.wrappedRenderedExtent_=kt(),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,r=s.center,o=s.resolution,a=s.projection,h=s.rotation,l=a.getExtent(),c=this.getLayer().getSource(),u=e.pixelRatio,d=e.viewHints,g=!(d[Q.ANIMATING]||d[Q.INTERACTING]),_=this.compositionContext_,f=Math.round(e.size[0]*u),p=Math.round(e.size[1]*u),m=c.getWrapX()&&a.canWrapX(),y=m?se(l):null,v=m?Math.ceil((n[2]-l[2])/y)+1:1;let x=m?Math.floor((n[0]-l[0])/y):0;do{const e=this.getRenderTransform(r,o,h,u,f,p,x*y);t.execute(_,1,e,h,g,void 0,i)}while(++x<v)}setupCompositionContext_(){if(1!==this.opacity_){const t=$n(this.context.canvas.width,this.context.canvas.height,os);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,Qn(this.compositionContext_),os.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];Ci(this.pixelTransform,1/i,1/i),wi(this.inversePixelTransform,this.pixelTransform);const s=Ii(this.pixelTransform);this.useContainer(e,s,this.getBackground(t));const r=this.context,o=r.canvas,a=this.replayGroup_,h=this.declutterExecutorGroup;let l=a&&!a.isEmpty()||h&&!h.isEmpty();if(!l){const t=this.getLayer().hasListener($.PRERENDER)||this.getLayer().hasListener($.POSTRENDER);if(!t)return null}const c=Math.round(t.size[0]*i),u=Math.round(t.size[1]*i);o.width!=c||o.height!=u?(o.width=c,o.height=u,o.style.transform!==s&&(o.style.transform=s)):this.containerReused||r.clearRect(0,0,c,u),this.preRender(r,t);const d=t.viewState,g=d.projection;this.opacity_=n.opacity,this.setupCompositionContext_();let _=!1;if(l&&n.extent&&this.clipping){const e=Ke(n.extent,g);l=re(e,t.extent),_=l&&!Pt(e,t.extent),_&&this.clipUnrotated(this.compositionContext_,t,e)}return l&&this.renderWorlds(a,t),_&&this.compositionContext_.restore(),this.releaseCompositionContext_(),this.postRender(r,t),this.renderedRotation_!==d.rotation&&(this.renderedRotation_=d.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];Ei(this.pixelTransform,t);const e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,s=this.renderedProjection_,r=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],h=t[0]*rh,l=t[1]*rh;a.push(this.getRenderTransform(e,i,n,rh,h,l,0).slice());const c=o.getSource(),u=s.getExtent();if(c.getWrapX()&&s.canWrapX()&&!Pt(u,r)){let t=r[0];const s=se(u);let o,c=0;while(t<u[0])--c,o=s*c,a.push(this.getRenderTransform(e,i,n,rh,h,l,o).slice()),t+=s;c=0,t=r[2];while(t>u[2])++c,o=s*c,a.push(this.getRenderTransform(e,i,n,rh,h,l,o).slice()),t-=s}this.hitDetectionImageData_=oh(t,a,this.renderedFeatures_,o.getStyleFunction(),r,i,n)}e(ah(t,this.renderedFeatures_,this.hitDetectionImageData_))}))}forEachFeatureAtCoordinate(t,e,i,n,s){if(!this.replayGroup_)return;const r=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),h={},l=function(t,e,i){const r=D(t),o=h[r];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return h[r]=!0,s.splice(s.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return h[r]=!0,n(t,a,e);s.push(h[r]={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,r,o,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[Q.ANIMATING],s=t.viewHints[Q.INTERACTING],r=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!r&&n||!o&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,h=t.viewState,l=h.projection,c=h.resolution,u=t.pixelRatio,d=e.getRevision(),g=e.getRenderBuffer();let _=e.getRenderOrder();void 0===_&&(_=ch);const p=h.center.slice(),m=Lt(a,g*c),y=m.slice(),v=[m.slice()],x=l.getExtent();if(i.getWrapX()&&l.canWrapX()&&!Pt(x,t.extent)){const t=se(x),e=Math.max(se(m)/2,t);m[0]=x[0]-e,m[2]=x[2]+e,pe(p,l);const i=ce(v[0],l);i[0]<x[0]&&i[2]<x[2]?v.push([i[0]+t,i[1],i[2]+t,i[3]]):i[0]>x[0]&&i[2]>x[2]&&v.push([i[0]-t,i[1],i[2]-t,i[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedRevision_==d&&this.renderedRenderOrder_==_&&Pt(this.wrappedRenderedExtent_,m))return f(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=p,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const E=new Ga(dh(c,u),m,c,u);let C;this.getLayer().getDeclutter()&&(C=new Ga(dh(c,u),m,c,u));const S=ze();let w;if(S){for(let t=0,e=v.length;t<e;++t){const e=v[t],n=Be(e,l);i.loadFeatures(n,Ve(c,l),S)}w=Fe(S,l)}else for(let f=0,O=v.length;f<O;++f)i.loadFeatures(v[f],c,l);const R=uh(c,u);let T=!0;const I=t=>{let i;const n=t.getStyleFunction()||e.getStyleFunction();if(n&&(i=n(t,c)),i){const e=this.renderFeature(t,R,i,E,w,C);T=T&&!e}},M=Be(m,l),L=i.getFeaturesInExtent(M);_&&L.sort(_);for(let f=0,O=L.length;f<O;++f)I(L[f]);this.renderedFeatures_=L,this.ready=T;const b=E.finish(),A=new ih(m,c,u,i.getOverlaps(),b,e.getRenderBuffer());return C&&(this.declutterExecutorGroup=new ih(m,c,u,i.getOverlaps(),C.finish(),e.getRenderBuffer())),this.renderedResolution_=c,this.renderedRevision_=d,this.renderedRenderOrder_=_,this.renderedExtent_=y,this.wrappedRenderedExtent_=m,this.renderedCenter_=p,this.renderedProjection_=l,this.replayGroup_=A,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,n,s,r){if(!i)return!1;let o=!1;if(Array.isArray(i))for(let a=0,h=i.length;a<h;++a)o=_h(n,t,i[a],e,this.boundHandleStyleImageChange_,s,r)||o;else o=_h(n,t,i,e,this.boundHandleStyleImageChange_,s,r);return o}}var Rh=wh;class Th extends _a{constructor(t){super(t)}createRenderer(){return new Rh(this)}}var Ih=Th,Mh={ADD:"add",REMOVE:"remove"};const Lh={LENGTH:"length"};class bh extends o{constructor(t,e,i){super(t),this.element=e,this.index=i}}class Ah extends N{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(){while(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(Lh.LENGTH)}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 bh(Mh.ADD,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 bh(Mh.REMOVE,e,t)),e}setAt(t,e){const i=this.getLength();if(t>=i)return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const n=this.array_[t];this.array_[t]=e,this.dispatchEvent(new bh(Mh.REMOVE,n,t)),this.dispatchEvent(new bh(Mh.ADD,e,t))}updateLength_(){this.set(Lh.LENGTH,this.array_.length)}assertUnique_(t,e){for(let i=0,n=this.array_.length;i<n;++i)if(this.array_[i]===t&&i!==e)throw new Error("Duplicate item added to a unique collection")}}var Oh=Ah;class Ph{constructor(t){this.rbush_=new Vs(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_[D(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],r=e[n],o={minX:s[0],minY:s[1],maxX:s[2],maxY:s[3],value:r};i[n]=o,this.items_[D(r)]=o}this.rbush_.load(i)}remove(t){const e=D(t),i=this.items_[e];return delete this.items_[e],null!==this.rbush_.remove(i)}update(t,e){const i=this.items_[D(e)],n=[i.minX,i.minY,i.maxX,i.maxY];Xt(n,t)||(this.remove(e),this.insert(t,e))}getAll(){const t=this.rbush_.all();return t.map((function(t){return t.value}))}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]},i=this.rbush_.search(e);return i.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 C(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return Nt(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]}}var Dh=Ph;class Fh extends N{constructor(t){super(),this.projection=Le(t.projection),this.attributions_=kh(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_=kh(t),this.changed()}setState(t){this.state_=t,this.changed()}}function kh(t){return t?Array.isArray(t)?function(e){return t}:"function"===typeof t?t:function(e){return[t]}:null}var Nh=Fh,Gh={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function Wh(t,e){return[[-1/0,-1/0,1/0,1/0]]}let zh=!1;function Xh(t,e,i,n,s,r,o){const a=new XMLHttpRequest;a.open("GET","function"===typeof t?t(i,n,s):t,!0),"arraybuffer"==e.getType()&&(a.responseType="arraybuffer"),a.withCredentials=zh,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?r(e.readFeatures(n,{extent:i,featureProjection:s}),e.readProjection(n)):o()}else o()},a.onerror=o,a.send()}function Yh(t,e){return function(i,n,s,r,o){const a=this;Xh(t,e,i,n,s,(function(t,e){a.addFeatures(t),void 0!==r&&r(t)}),o||v)}}class Bh extends o{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class Kh extends Nh{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.on,this.once,this.un,this.loader_=v,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_&&(W(this.format_,"`format` must be set when `url` is set"),this.loader_=Yh(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:Wh;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,n;this.featuresRtree_=e?new Dh:null,this.loadedExtentsRtree_=new Dh,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 Oh(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=D(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 Bh(Gh.ADDFEATURE,t))}setupChangeEvents_(t,e){this.featureChangeKeys_[t]=[T(e,R.CHANGE,this.handleFeatureChange_,this),T(e,a.PROPERTYCHANGE,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&&(W(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],n=[];for(let s=0,r=t.length;s<r;s++){const e=t[s],n=D(e);this.addToIndex_(n,e)&&i.push(e)}for(let s=0,r=i.length;s<r;s++){const t=i[s],r=D(t);this.setupChangeEvents_(r,t);const o=t.getGeometry();if(o){const i=o.getExtent();e.push(i),n.push(t)}else this.nullGeometryFeatures_[r]=t}if(this.featuresRtree_&&this.featuresRtree_.load(e,n),this.hasListener(Gh.ADDFEATURE))for(let s=0,r=i.length;s<r;s++)this.dispatchEvent(new Bh(Gh.ADDFEATURE,i[s]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(Gh.ADDFEATURE,(function(i){e||(e=!0,t.push(i.feature),e=!1)})),this.addEventListener(Gh.REMOVEFEATURE,(function(i){e||(e=!0,t.remove(i.feature),e=!1)})),t.addEventListener(Mh.ADD,(t=>{e||(e=!0,this.addFeature(t.element),e=!1)})),t.addEventListener(Mh.REMOVE,(t=>{e||(e=!0,this.removeFeature(t.element),e=!1)})),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_){const e=this.featureChangeKeys_[t];e.forEach(M)}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 Bh(Gh.CLEAR);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){const n=i.getGeometry();if(n.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){const n=i.getGeometry();if(n.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(),C(this.nullGeometryFeatures_)||_(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_){const i=e&&e.canWrapX()&&this.getWrapX();if(!i)return this.featuresRtree_.getInExtent(t);const n=ue(t,e);return[].concat(...n.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 r=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||m,this.featuresRtree_.forEachInExtent(a,(function(t){if(e(t)){const e=t.getGeometry(),h=o;if(o=e.closestPointXY(i,n,r,o),o<h){s=t;const e=Math.sqrt(o);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=D(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 Bh(Gh.CHANGEFEATURE,e))}hasFeature(t){const e=t.getId();return void 0!==e?e in this.idIndex_:D(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&C(this.nullGeometryFeatures_):!this.featuresCollection_||0===this.featuresCollection_.getLength()}loadFeatures(t,e,i){const n=this.loadedExtentsRtree_,s=this.strategy_(t,e,i);for(let r=0,o=s.length;r<o;++r){const t=s[r],o=n.forEachInExtent(t,(function(e){return Pt(e.extent,t)}));o||(++this.loadingExtentsCount_,this.dispatchEvent(new Bh(Gh.FEATURESLOADSTART)),this.loader_.call(this,t,e,i,(t=>{--this.loadingExtentsCount_,this.dispatchEvent(new Bh(Gh.FEATURESLOADEND,void 0,t))}),(()=>{--this.loadingExtentsCount_,this.dispatchEvent(new Bh(Gh.FEATURESLOADERROR))})),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(Xt(e.extent,t))return i=e,!0})),i&&e.remove(i)}removeFeature(t){if(!t)return;const e=D(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t);const i=this.removeFeatureInternal(t);i&&this.changed()}removeFeatureInternal(t){const e=D(t),i=this.featureChangeKeys_[e];if(!i)return;i.forEach(M),delete this.featureChangeKeys_[e];const n=t.getId();return void 0!==n&&delete this.idIndex_[n.toString()],delete this.uidIndex_[e],this.dispatchEvent(new Bh(Gh.REMOVEFEATURE,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){W(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(Yh(t,this.format_))}}var Vh=Kh;class jh{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){while(this.canExpireCache())this.pop()}clear(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;while(e)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return W(void 0!==i,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){const e=this.entries_[t];return W(void 0!==e,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.key_;return t}getValues(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){if(this.containsKey(t))return this.entries_[t].value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){W(!(t in this.entries_),"Tried to set a value for a key that is used already");const i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}}var Zh=jh;function Uh(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function Hh(t,e,i){return t+"/"+e+"/"+i}function qh(t){return Hh(t[0],t[1],t[2])}function Jh(t){return t.split("/").map(Number)}function $h(t){return(t[1]<<t[0])+t[2]}function Qh(t,e){const i=t[0],n=t[1],s=t[2];if(e.getMinZoom()>i||i>e.getMaxZoom())return!1;const r=e.getFullTileRange(i);return!r||r.containsXY(n,s)}class tl extends Zh{clear(){while(this.getCount()>0)this.pop().release();super.clear()}expireCache(t){while(this.canExpireCache()){const e=this.peekLast();if(e.getKey()in t)break;this.pop().release()}}pruneExceptNewestZ(){if(0===this.getCount())return;const t=this.peekFirstKey(),e=Jh(t),i=e[0];this.forEach((t=>{t.tileCoord[0]!==i&&(this.remove(qh(t.tileCoord)),t.release())}))}}var el=tl,il={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};const nl=[0,0,0],sl=5;class rl{constructor(t){let e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,W(p(this.resolutions_,(function(t,e){return e-t}),!0),"`resolutions` must be sorted in descending order"),!t.origins)for(let n=0,s=this.resolutions_.length-1;n<s;++n)if(e){if(this.resolutions_[n]/this.resolutions_[n+1]!==e){e=void 0;break}}else e=this.resolutions_[n]/this.resolutions_[n+1];this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=void 0!==t.origin?t.origin:null,this.origins_=null,void 0!==t.origins&&(this.origins_=t.origins,W(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const i=t.extent;void 0===i||this.origin_||this.origins_||(this.origin_=ie(i)),W(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,void 0!==t.tileSizes&&(this.tileSizes_=t.tileSizes,W(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=void 0!==t.tileSize?t.tileSize:this.tileSizes_?null:it,W(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=void 0!==i?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],void 0!==t.sizes?this.fullTileRanges_=t.sizes.map((function(t,e){const n=new Ns(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(i){const t=this.getTileRangeForExtentAndZ(i,e);n.minX=Math.max(t.minX,n.minX),n.maxX=Math.min(t.maxX,n.maxX),n.minY=Math.max(t.minY,n.minY),n.maxY=Math.min(t.maxY,n.maxY)}return n}),this):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let s=n.minX,r=n.maxX;s<=r;++s)for(let t=n.minY,o=n.maxY;t<=o;++t)i([e,s,t])}forEachTileCoordParentTileRange(t,e,i,n){let s,r,o,a=null,h=t[0]-1;2===this.zoomFactor_?(r=t[1],o=t[2]):a=this.getTileCoordExtent(t,n);while(h>=this.minZoom){if(2===this.zoomFactor_?(r=Math.floor(r/2),o=Math.floor(o/2),s=ks(r,r,o,o,i)):s=this.getTileRangeForExtentAndZ(a,h,i),e(h,s))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(2===this.zoomFactor_){const i=2*t[1],n=2*t[2];return ks(i,i+1,n,n+1,e)}const n=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(n,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const n=t[0],s=t[1],r=t[2];if(e===n)return ks(s,r,s,r,i);if(this.zoomFactor_){const t=Math.pow(this.zoomFactor_,e-n),o=Math.floor(s*t),a=Math.floor(r*t);if(e<n)return ks(o,o,a,a,i);const h=Math.floor(t*(s+1))-1,l=Math.floor(t*(r+1))-1;return ks(o,h,a,l,i)}const o=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(o,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,nl);const n=nl[1],s=nl[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,nl);const r=nl[1],o=nl[2];return ks(n,r,s,o,i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),n=zs(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*n[0]*i,e[1]-(t[2]+.5)*n[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),n=this.getResolution(t[0]),s=zs(this.getTileSize(t[0]),this.tmpSize_),r=i[0]+t[1]*s[0]*n,o=i[1]-(t[2]+1)*s[1]*n,a=r+s[0]*n,h=o+s[1]*n;return Nt(r,o,a,h,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,n,s){const r=this.getZForResolution(i),o=i/this.getResolution(r),a=this.getOrigin(r),h=zs(this.getTileSize(r),this.tmpSize_);let l=o*(t-a[0])/i/h[0],c=o*(a[1]-e)/i/h[1];return n?(l=H(l,sl)-1,c=H(c,sl)-1):(l=U(l,sl),c=U(c,sl)),Uh(r,l,c,s)}getTileCoordForXYAndZ_(t,e,i,n,s){const r=this.getOrigin(i),o=this.getResolution(i),a=zs(this.getTileSize(i),this.tmpSize_);let h=(t-r[0])/o/a[0],l=(r[1]-e)/o/a[1];return n?(h=H(h,sl)-1,l=H(l,sl)-1):(h=U(h,sl),l=U(l,sl)),Uh(i,h,l,s)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){const i=d(this.resolutions_,t,e||0);return z(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return _n(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,i=new Array(e);for(let n=this.minZoom;n<e;++n)i[n]=this.getTileRangeForExtentAndZ(t,n);this.fullTileRanges_=i}}var ol=rl;function al(t){let e=t.getDefaultTileGrid();return e||(e=dl(t),t.setDefaultTileGrid(e)),e}function hl(t,e,i){const n=e[0],s=t.getTileCoordCenter(e),r=gl(i);if(!Ot(r,s)){const e=se(r),i=Math.ceil((r[0]-s[0])/e);return s[0]+=e*i,t.getTileCoordForCoordAndZ(s,n)}return e}function ll(t,e,i,n){n=void 0!==n?n:"top-left";const s=ul(t,e,i);return new ol({extent:t,origin:Jt(t,n),resolutions:s,tileSize:i})}function cl(t){const e=t||{},i=e.extent||Le("EPSG:3857").getExtent(),n={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:ul(i,e.maxZoom,e.tileSize,e.maxResolution)};return new ol(n)}function ul(t,e,i,n){e=void 0!==e?e:et,i=zs(void 0!==i?i:it);const s=te(t),r=se(t);n=n>0?n:Math.max(r/i[0],s/i[1]);const o=e+1,a=new Array(o);for(let h=0;h<o;++h)a[h]=n/Math.pow(2,h);return a}function dl(t,e,i,n){const s=gl(t);return ll(s,e,i,n)}function gl(t){t=Le(t);let e=t.getExtent();if(!e){const i=180*nt.degrees/t.getMetersPerUnit();e=Nt(-i,-i,i,i)}return e}class _l extends Nh{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.opaque_=void 0!==t.opaque&&t.opaque,this.tilePixelRatio_=void 0!==t.tilePixelRatio?t.tilePixelRatio:1,this.tileGrid=void 0!==t.tileGrid?t.tileGrid:null;const e=[256,256];this.tileGrid&&zs(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tileCache=new el(t.cacheSize||0),this.tmpSize=[0,0],this.key_=t.key||"",this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}canExpireCache(){return this.tileCache.canExpireCache()}expireCache(t,e){const i=this.getTileCacheForProjection(t);i&&i.expireCache(e)}forEachLoadedTile(t,e,i,n){const s=this.getTileCacheForProjection(t);if(!s)return!1;let r,o,a,h=!0;for(let l=i.minX;l<=i.maxX;++l)for(let t=i.minY;t<=i.maxY;++t)o=Hh(e,l,t),a=!1,s.containsKey(o)&&(r=s.get(o),a=r.getState()===us.LOADED,a&&(a=!1!==n(r))),a||(h=!1);return h}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getOpaque(t){return this.opaque_}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,n,s){return O()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:al(t)}getTileCacheForProjection(t){const e=this.getProjection();return W(null===e||De(e,t),"A VectorTile source can only be rendered if it has a projection compatible with the view projection."),this.tileCache}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),s=this.getTilePixelRatio(e),r=zs(n.getTileSize(t),this.tmpSize);return 1==s?r:Ws(r,s,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){e=void 0!==e?e:this.getProjection();const i=this.getTileGridForProjection(e);return this.getWrapX()&&e.isGlobal()&&(t=hl(i,t,e)),Qh(t,i)?t:null}clear(){this.tileCache.clear()}refresh(){this.clear(),super.refresh()}updateCacheSize(t,e){const i=this.getTileCacheForProjection(e);t>i.highWaterMark&&(i.highWaterMark=t)}useTile(t,e,i,n){}}class fl extends o{constructor(t,e){super(t),this.tile=e}}var pl=_l;function ml(t,e){const i=/\{z\}/g,n=/\{x\}/g,s=/\{y\}/g,r=/\{-y\}/g;return function(o,a,h){if(o)return t.replace(i,o[0].toString()).replace(n,o[1].toString()).replace(s,o[2].toString()).replace(r,(function(){const t=o[0],i=e.getFullTileRange(t);W(i,"The {-y} placeholder requires a tile grid with extent");const n=i.getHeight()-o[2]-1;return n.toString()}))}}function yl(t,e){const i=t.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=ml(t[s],e);return vl(n)}function vl(t){return 1===t.length?t[0]:function(e,i,n){if(!e)return;const s=$h(e),r=V(s,t.length);return t[r](e,i,n)}}function xl(t){const e=[];let i=/\{([a-z])-([a-z])\}/.exec(t);if(i){const n=i[1].charCodeAt(0),s=i[2].charCodeAt(0);let r;for(r=n;r<=s;++r)e.push(t.replace(i[0],String.fromCharCode(r)));return e}if(i=/\{(\d+)-(\d+)\}/.exec(t),i){const n=parseInt(i[2],10);for(let s=parseInt(i[1],10);s<=n;s++)e.push(t.replace(i[0],s.toString()));return e}return e.push(t),e}class El extends pl{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===El.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,i=D(e),n=e.getState();let s;n==us.LOADING?(this.tileLoadingKeys_[i]=!0,s=il.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],s=n==us.ERROR?il.TILELOADERROR:n==us.LOADED?il.TILELOADEND:void 0),void 0!=s&&this.dispatchEvent(new fl(s,e))}setTileLoadFunction(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),"undefined"!==typeof e?this.setKey(e):this.changed()}setUrl(t){const e=xl(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(yl(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}useTile(t,e,i){const n=Hh(t,e,i);this.tileCache.containsKey(n)&&this.tileCache.get(n)}}var Cl=El;class Sl extends Cl{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:wl,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:void 0===t.interpolate||t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=void 0!==t.crossOrigin?t.crossOrigin:null,this.tileClass=void 0!==t.tileClass?t.tileClass:vs,this.tileCacheForProjection={},this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}canExpireCache(){if(this.tileCache.canExpireCache())return!0;for(const t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1}expireCache(t,e){const i=this.getTileCacheForProjection(t);this.tileCache.expireCache(this.tileCache==i?e:{});for(const n in this.tileCacheForProjection){const t=this.tileCacheForProjection[n];t.expireCache(t==i?e:{})}}getGutterForProjection(t){return this.getProjection()&&t&&!De(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getOpaque(t){return!(this.getProjection()&&t&&!De(this.getProjection(),t))&&super.getOpaque(t)}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||De(e,t)))return this.tileGrid;const i=D(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=al(t)),this.tileGridForProjection[i]}getTileCacheForProjection(t){const e=this.getProjection();if(!e||De(e,t))return this.tileCache;const i=D(t);return i in this.tileCacheForProjection||(this.tileCacheForProjection[i]=new el(this.tileCache.highWaterMark)),this.tileCacheForProjection[i]}createTile_(t,e,i,n,s,r){const o=[t,e,i],a=this.getTileCoordForTileUrlFunction(o,s),h=a?this.tileUrlFunction(a,n,s):void 0,l=new this.tileClass(o,void 0!==h?us.IDLE:us.EMPTY,void 0!==h?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return l.key=r,l.addEventListener(R.CHANGE,this.handleTileChange.bind(this)),l}getTile(t,e,i,n,s){const r=this.getProjection();if(!r||!s||De(r,s))return this.getTileInternal(t,e,i,n,r||s);const o=this.getTileCacheForProjection(s),a=[t,e,i];let h;const l=qh(a);o.containsKey(l)&&(h=o.get(l));const c=this.getKey();if(h&&h.key==c)return h;const u=this.getTileGridForProjection(r),d=this.getTileGridForProjection(s),g=this.getTileCoordForTileUrlFunction(a,s),_=new Ds(r,u,s,d,a,g,this.getTilePixelRatio(n),this.getGutter(),((t,e,i,n)=>this.getTileInternal(t,e,i,n,r)),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.getInterpolate());return _.key=c,h?(_.interimTile=h,_.refreshInterimChain(),o.replace(l,_)):o.set(l,_),_}getTileInternal(t,e,i,n,s){let r=null;const o=Hh(t,e,i),a=this.getKey();if(this.tileCache.containsKey(o)){if(r=this.tileCache.get(o),r.key!=a){const h=r;r=this.createTile_(t,e,i,n,s,a),h.getState()==us.IDLE?r.interimTile=h.interimTile:r.interimTile=h,r.refreshInterimChain(),this.tileCache.replace(o,r)}}else r=this.createTile_(t,e,i,n,s,a),this.tileCache.set(o,r);return r}setRenderReprojectionEdges(t){if(this.renderReprojectionEdges_!=t){this.renderReprojectionEdges_=t;for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear();this.changed()}}setTileGridForProjection(t,e){const i=Le(t);if(i){const t=D(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}clear(){super.clear();for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear()}}function wl(t,e){t.getImage().src=e}var Rl=Sl;class Tl extends Rl{constructor(t){t=t||{};const e=void 0!==t.projection?t.projection:"EPSG:3857",i=void 0!==t.tileGrid?t.tileGrid:cl({extent:gl(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,opaque:t.opaque,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=void 0!==t.gutter?t.gutter:0}getGutter(){return this.gutter_}}var Il=Tl;class Ml extends N{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 Ml(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_&&(M(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=T(t,R.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?Ll(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_()}}function Ll(t){if("function"===typeof t)return t;let e;if(Array.isArray(t))e=t;else{W("function"===typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`");const i=t;e=[i]}return function(){return e}}var bl=Ml;class Al extends l{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){O()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;Si(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),wi(n,i)}forEachFeatureAtCoordinate(t,e,i,n,s,r,o,a){let h;const l=e.viewState;function c(t,e,i,n){return s.call(r,e,t?i:null,n)}const u=l.projection,d=pe(t.slice(),u),g=[[0,0]];if(u.canWrapX()&&n){const t=u.getExtent(),e=se(t);g.push([-e,0],[e,0])}const _=e.layerStatesArray,f=_.length,p=[],m=[];for(let v=0;v<g.length;v++)for(let n=f-1;n>=0;--n){const s=_[n],r=s.layer;if(r.hasRenderer()&&Pn(s,l)&&o.call(a,r)){const n=r.getRenderer(),o=r.getSource();if(n&&o){const r=o.getWrapX()?d:t,a=c.bind(null,s.managed);m[0]=r[0]+g[v][0],m[1]=r[1]+g[v][1],h=n.forEachFeatureAtCoordinate(m,e,i,a,p)}if(h)return h}}if(0===p.length)return;const y=1/p.length;return p.forEach(((t,e)=>t.distanceSq+=e*y)),p.sort(((t,e)=>t.distanceSq-e.distanceSq)),p.some((t=>h=t.callback(t.feature,t.layer,t.geometry))),h}hasFeatureAtCoordinate(t,e,i,n,s,r){const o=this.forEachFeatureAtCoordinate(t,e,i,n,m,this,s,r);return void 0!==o}getMap(){return this.map_}renderFrame(t){O()}flushDeclutterItems(t){}scheduleExpireIconCache(t){Br.canExpireCache()&&t.postRenderFunctions.push(Ol)}}function Ol(t,e){Br.expire()}var Pl=Al;class Dl extends Pl{constructor(t){super(t),this.fontChangeListenerKey_=T(fr,a.PROPERTYCHANGE,t.redrawText.bind(t)),this.element_=document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Js+" ol-layers";const i=t.getViewport();i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0,this.declutterLayers_=[]}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const n=new Yn(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){M(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),super.disposeInternal()}renderFrame(t){if(!t)return void(this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1));this.calculateMatrices2D(t),this.dispatchRenderEvent($.PRECOMPOSE,t);const e=t.layerStatesArray.sort((function(t,e){return t.zIndex-e.zIndex})),i=t.viewState;this.children_.length=0;const n=this.declutterLayers_;n.length=0;let s=null;for(let r=0,o=e.length;r<o;++r){const o=e[r];t.layerIndex=r;const a=o.layer,h=a.getSourceState();if(!Pn(o,i)||"ready"!=h&&"undefined"!=h){a.unrender();continue}const l=a.render(t,s);l&&(l!==s&&(this.children_.push(l),s=l),"getDeclutter"in a&&n.push(a))}this.flushDeclutterItems(t),rs(this.element_,this.children_),this.dispatchRenderEvent($.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}flushDeclutterItems(t){const e=this.declutterLayers_;for(let i=e.length-1;i>=0;--i)e[i].renderDeclutter(t);e.length=0}}var Fl=Dl;class kl extends o{constructor(t,e){super(t),this.layer=e}}const Nl={LAYERS:"layers"};class Gl extends J{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(Nl.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new Oh(i.slice(),{unique:!0}):W("function"===typeof i.getArray,"Expected `layers` to be an array or a `Collection`"):i=new Oh(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(M),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(T(t,Mh.ADD,this.handleLayersAdd_,this),T(t,Mh.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach(M);E(this.listenerKeys_);const e=t.getArray();for(let i=0,n=e.length;i<n;i++){const t=e[i];this.registerLayerListeners_(t),this.dispatchEvent(new kl("addlayer",t))}this.changed()}registerLayerListeners_(t){const e=[T(t,a.PROPERTYCHANGE,this.handleLayerChange_,this),T(t,R.CHANGE,this.handleLayerChange_,this)];t instanceof Gl&&e.push(T(t,"addlayer",this.handleLayerGroupAdd_,this),T(t,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[D(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new kl("addlayer",t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new kl("removelayer",t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new kl("addlayer",e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=D(e);this.listenerKeys_[i].forEach(M),delete this.listenerKeys_[i],this.dispatchEvent(new kl("removelayer",e)),this.changed()}getLayers(){return this.get(Nl.LAYERS)}setLayers(t){const e=this.getLayers();if(e){const t=e.getArray();for(let e=0,i=t.length;e<i;++e)this.dispatchEvent(new kl("removelayer",t[e]))}this.set(Nl.LAYERS,t)}getLayersArray(t){return t=void 0!==t?t:[],this.getLayers().forEach((function(e){e.getLayersArray(t)})),t}getLayerStatesArray(t){const e=void 0!==t?t:[],i=e.length;this.getLayers().forEach((function(t){t.getLayerStatesArray(e)}));const n=this.getLayerState();let s=n.zIndex;t||void 0!==n.zIndex||(s=0);for(let r=i,o=e.length;r<o;r++){const t=e[r];t.opacity*=n.opacity,t.visible=t.visible&&n.visible,t.maxResolution=Math.min(t.maxResolution,n.maxResolution),t.minResolution=Math.max(t.minResolution,n.minResolution),t.minZoom=Math.max(t.minZoom,n.minZoom),t.maxZoom=Math.min(t.maxZoom,n.maxZoom),void 0!==n.extent&&(void 0!==t.extent?t.extent=ee(t.extent,n.extent):t.extent=n.extent),void 0===t.zIndex&&(t.zIndex=s)}return e}getSourceState(){return"ready"}}var Wl=Gl;class zl extends o{constructor(t,e,i){super(t),this.map=e,this.frameState=void 0!==i?i:null}}var Xl=zl;class Yl extends Xl{constructor(t,e,i,n,s,r){super(t,e,s),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=void 0!==n&&n,this.activePointers=r}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}var Bl=Yl,Kl={SINGLECLICK:"singleclick",CLICK:R.CLICK,DBLCLICK:R.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Vl={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};class jl extends w{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=void 0===e?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=T(i,Vl.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=T(i,Vl.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(R.TOUCHMOVE,this.boundHandleTouchMove_,!!pi&&{passive:!1})}emulateClick_(t){let e=new Bl(Kl.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new Bl(Kl.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout((()=>{this.clickTimeoutId_=void 0;const e=new Bl(Kl.SINGLECLICK,this.map_,t);this.dispatchEvent(e)}),250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==Kl.POINTERUP||e.type==Kl.POINTERCANCEL){delete this.trackedTouches_[i];for(const t in this.trackedTouches_)if(this.trackedTouches_[t].target!==e.target){delete this.trackedTouches_[t];break}}else e.type!=Kl.POINTERDOWN&&e.type!=Kl.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new Bl(Kl.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(M),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return 0===t.button}handlePointerDown_(t){this.emulateClicks_=0===this.activePointers_.length,this.updateActivePointers_(t);const e=new Bl(Kl.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),0===this.dragListenerKeys_.length){const t=this.map_.getOwnerDocument();this.dragListenerKeys_.push(T(t,Kl.POINTERMOVE,this.handlePointerMove_,this),T(t,Kl.POINTERUP,this.handlePointerUp_,this),T(this.element_,Kl.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push(T(this.element_.getRootNode(),Kl.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new Bl(Kl.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!(!this.down_||!this.isMoving_(t));this.dispatchEvent(new Bl(Kl.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;e&&!e.defaultPrevented||"boolean"===typeof t.cancelable&&!0!==t.cancelable||t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(M(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(R.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(M(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(M),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}var Zl=jl,Ul={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},Hl={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};const ql=1/0;class Jl{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,E(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const n=this.keyFunction_(i);return delete this.queuedElements_[n],i}enqueue(t){W(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=ql&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,n=e.length,s=e[t],r=i[t],o=t;while(t<n>>1){const s=this.getLeftChildIndex_(t),r=this.getRightChildIndex_(t),o=r<n&&i[r]<i[s]?r:s;e[t]=e[o],i[t]=i[o],t=o}e[t]=s,i[t]=r,this.siftDown_(o,t)}siftDown_(t,e){const i=this.elements_,n=this.priorities_,s=i[e],r=n[e];while(e>t){const t=this.getParentIndex_(e);if(!(n[t]>r))break;i[e]=i[t],n[e]=n[t],e=t}i[e]=s,n[e]=r}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const s=e.length;let r,o,a;for(o=0;o<s;++o)r=e[o],a=t(r),a==ql?delete this.queuedElements_[this.keyFunction_(r)]:(i[n]=a,e[n++]=r);e.length=n,i.length=n,this.heapify_()}}var $l=Jl;class Ql extends $l{constructor(t,e){super((function(e){return t.apply(null,e)}),(function(t){return t[0].getKey()})),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);if(e){const e=t[0];e.addEventListener(R.CHANGE,this.boundHandleTileChange_)}return e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===us.LOADED||i===us.ERROR||i===us.EMPTY){i!==us.ERROR&&e.removeEventListener(R.CHANGE,this.boundHandleTileChange_);const t=e.getKey();t in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[t],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i,n,s,r=0;while(this.tilesLoading_<t&&r<e&&this.getCount()>0)n=this.dequeue()[0],s=n.getKey(),i=n.getState(),i!==us.IDLE||s in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++r,n.load())}}var tc=Ql;function ec(t,e,i,n,s){if(!t||!(i in t.wantedTiles))return ql;if(!t.wantedTiles[i][e.getKey()])return ql;const r=t.viewState.center,o=n[0]-r[0],a=n[1]-r[1];return 65536*Math.log(s)+Math.sqrt(o*o+a*a)/s}class ic extends N{constructor(t){super();const e=t.element;!e||t.target||e.style.pointerEvents||(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){ns(this.element),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&ns(this.element);for(let e=0,i=this.listenerKeys.length;e<i;++e)M(this.listenerKeys[e]);if(this.listenerKeys.length=0,this.map_=t,t){const e=this.target_?this.target_:t.getOverlayContainerStopEvent();e.appendChild(this.element),this.render!==v&&this.listenerKeys.push(T(t,Ul.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_="string"===typeof t?document.getElementById(t):t}}var nc=ic;class sc extends nc{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=void 0===t.collapsed||t.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=void 0!==t.collapsible,this.collapsible_=void 0===t.collapsible||t.collapsible,this.collapsible_||(this.collapsed_=!1);const e=void 0!==t.className?t.className:"ol-attribution",i=void 0!==t.tipLabel?t.tipLabel:"Attributions",n=void 0!==t.expandClassName?t.expandClassName:e+"-expand",s=void 0!==t.collapseLabel?t.collapseLabel:"›",r=void 0!==t.collapseClassName?t.collapseClassName:e+"-collapse";"string"===typeof s?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=s,this.collapseLabel_.className=r):this.collapseLabel_=s;const o=void 0!==t.label?t.label:"i";"string"===typeof o?(this.label_=document.createElement("span"),this.label_.textContent=o,this.label_.className=n):this.label_=o;const a=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(a),this.toggleButton_.addEventListener(R.CLICK,this.handleClick_.bind(this),!1);const h=e+" "+Js+" "+$s+(this.collapsed_&&this.collapsible_?" "+Qs:"")+(this.collapsible_?"":" ol-uncollapsible"),l=this.element;l.className=h,l.appendChild(this.toggleButton_),l.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=Array.from(new Set(this.getMap().getAllLayers().flatMap((e=>e.getAttributions(t))))),i=!this.getMap().getAllLayers().some((t=>t.getSource()&&!1===t.getSource().getAttributionsCollapsible()));return this.overrideCollapsible_||this.setCollapsible(i),e}updateElement_(t){if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=this.collectSourceAttributions_(t),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!f(e,this.renderedAttributions_)){ss(this.ulElement_);for(let t=0,i=e.length;t<i;++t){const i=document.createElement("li");i.innerHTML=e[t],this.ulElement_.appendChild(i)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(Qs),this.collapsed_?is(this.collapseLabel_,this.label_):is(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}}var rc=sc;class oc extends nc{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=void 0!==t.className?t.className:"ol-rotate",i=void 0!==t.label?t.label:"⇧",n=void 0!==t.compassClassName?t.compassClassName:"ol-compass";this.label_=null,"string"===typeof i?(this.label_=document.createElement("span"),this.label_.className=n,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(n));const s=t.tipLabel?t.tipLabel:"Reset rotation",r=document.createElement("button");r.className=e+"-reset",r.setAttribute("type","button"),r.title=s,r.appendChild(this.label_),r.addEventListener(R.CLICK,this.handleClick_.bind(this),!1);const o=e+" "+Js+" "+$s,a=this.element;a.className=o,a.appendChild(r),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=void 0!==t.duration?t.duration:250,this.autoHide_=void 0===t.autoHide||t.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Hs)}handleClick_(t){t.preventDefault(),void 0!==this.callResetNorth_?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const t=this.getMap(),e=t.getView();if(!e)return;const i=e.getRotation();void 0!==i&&(this.duration_>0&&i%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:ri}):e.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const t="rotate("+i+"rad)";if(this.autoHide_){const t=this.element.classList.contains(Hs);t||0!==i?t&&0!==i&&this.element.classList.remove(Hs):this.element.classList.add(Hs)}this.label_.style.transform=t}this.rotation_=i}}var ac=oc;class hc extends nc{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=void 0!==t.className?t.className:"ol-zoom",i=void 0!==t.delta?t.delta:1,n=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",s=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",r=void 0!==t.zoomInLabel?t.zoomInLabel:"+",o=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",a=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",h=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",l=document.createElement("button");l.className=n,l.setAttribute("type","button"),l.title=a,l.appendChild("string"===typeof r?document.createTextNode(r):r),l.addEventListener(R.CLICK,this.handleClick_.bind(this,i),!1);const c=document.createElement("button");c.className=s,c.setAttribute("type","button"),c.title=h,c.appendChild("string"===typeof o?document.createTextNode(o):o),c.addEventListener(R.CLICK,this.handleClick_.bind(this,-i),!1);const u=e+" "+Js+" "+$s,d=this.element;d.className=u,d.appendChild(l),d.appendChild(c),this.duration_=void 0!==t.duration?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const e=this.getMap(),i=e.getView();if(!i)return;const n=i.getZoom();if(void 0!==n){const e=i.getConstrainedZoom(n+t);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:e,duration:this.duration_,easing:ri})):i.setZoom(e)}}}var lc=hc;function cc(t){t=t||{};const e=new Oh,i=void 0===t.zoom||t.zoom;i&&e.push(new lc(t.zoomOptions));const n=void 0===t.rotate||t.rotate;n&&e.push(new ac(t.rotateOptions));const s=void 0===t.attribution||t.attribution;return s&&e.push(new rc(t.attributionOptions)),e}var uc={ACTIVE:"active"};class dc extends N{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(uc.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(uc.ACTIVE,t)}setMap(t){this.map_=t}}function gc(t,e,i){const n=t.getCenterInternal();if(n){const s=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:ai,center:t.getConstrainedCenter(s)})}}function _c(t,e,i,n){const s=t.getZoom();if(void 0===s)return;const r=t.getConstrainedZoom(s+e),o=t.getResolutionForZoom(r);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:i,duration:void 0!==n?n:250,easing:ri})}var fc=dc;class pc extends fc{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:250}handleEvent(t){let e=!1;if(t.type==Kl.DBLCLICK){const i=t.originalEvent,n=t.map,s=t.coordinate,r=i.shiftKey?-this.delta_:this.delta_,o=n.getView();_c(o,r,s,this.duration_),i.preventDefault(),e=!0}return!e}}var mc=pc;class yc extends fc{constructor(t){t=t||{},super(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==Kl.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==Kl.POINTERUP){const e=this.handleUpEvent(t);this.handlingDownUpSequence=e&&this.targetPointers.length>0}}else if(t.type==Kl.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==Kl.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function vc(t){const e=t.length;let i=0,n=0;for(let s=0;s<e;s++)i+=t[s].clientX,n+=t[s].clientY;return{clientX:i/e,clientY:n/e}}var xc=yc;function Ec(t){const e=arguments;return function(t){let i=!0;for(let n=0,s=e.length;n<s;++n)if(i=i&&e[n](t),!i)break;return i}}const Cc=function(t){const e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Sc=function(t){const e=t.map.getTargetElement(),i=t.map.getOwnerDocument().activeElement;return e.contains(i)},wc=function(t){return!t.map.getTargetElement().hasAttribute("tabindex")||Sc(t)},Rc=m,Tc=function(t){const e=t.originalEvent;return 0==e.button&&!(ui&&di&&e.ctrlKey)},Ic=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},Mc=function(t){const e=t.originalEvent;return di?e.metaKey:e.ctrlKey},Lc=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},bc=function(t){const e=t.originalEvent,i=e.target.tagName;return"INPUT"!==i&&"SELECT"!==i&&"TEXTAREA"!==i&&!e.target.isContentEditable},Ac=function(t){const e=t.originalEvent;return W(void 0!==e,"mapBrowserEvent must originate from a pointer event"),"mouse"==e.pointerType},Oc=function(t){const e=t.originalEvent;return W(void 0!==e,"mapBrowserEvent must originate from a pointer event"),e.isPrimary&&0===e.button};class Pc extends xc{constructor(t){super({stopDown:y}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:Ec(Ic,Oc);this.condition_=t.onFocusOnly?Ec(wc,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const i=this.targetPointers,n=e.getEventPixel(vc(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(n[0],n[1]),this.lastCentroid){const e=[this.lastCentroid[0]-n[0],n[1]-this.lastCentroid[1]],i=t.map,s=i.getView();fe(e,s.getResolution()),_e(e,s.getRotation()),s.adjustCenterInternal(e)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=n,this.lastPointersCount_=i.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,i=e.getView();if(0===this.targetPointers.length){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const t=this.kinetic_.getDistance(),n=this.kinetic_.getAngle(),s=i.getCenterInternal(),r=e.getPixelFromCoordinateInternal(s),o=e.getCoordinateFromPixelInternal([r[0]-t*Math.cos(n),r[1]-t*Math.sin(n)]);i.animateInternal({center:i.getConstrainedCenter(o),duration:500,easing:ri})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const e=t.map,i=e.getView();return this.lastCentroid=null,i.getAnimating()&&i.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}var Dc=Pc;class Fc extends xc{constructor(t){t=t||{},super({stopDown:y}),this.condition_=t.condition?t.condition:Cc,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!Ac(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===ti)return;const n=e.getSize(),s=t.pixel,r=Math.atan2(n[1]/2-s[1],s[0]-n[0]/2);if(void 0!==this.lastAngle_){const t=r-this.lastAngle_;i.adjustRotationInternal(-t)}this.lastAngle_=r}handleUpEvent(t){if(!Ac(t))return!0;const e=t.map,i=e.getView();return i.endInteraction(this.duration_),!1}handleDownEvent(t){if(!Ac(t))return!1;if(Tc(t)&&this.condition_(t)){const e=t.map;return e.getView().beginInteraction(),this.lastAngle_=void 0,!0}return!1}}var kc=Fc;class Nc extends l{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,i="px",n=this.element_.style;n.left=Math.min(t[0],e[0])+i,n.top=Math.min(t[1],e[1])+i,n.width=Math.abs(e[0]-t[0])+i,n.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){const t=this.startPixel_,e=this.endPixel_,i=[t,[t[0],e[1]],e,[e[0],t[1]]],n=i.map(this.map_.getCoordinateFromPixelInternal,this.map_);n[4]=n[0].slice(),this.geometry_?this.geometry_.setCoordinates([n]):this.geometry_=new En([n])}getGeometry(){return this.geometry_}}var Gc=Nc;const Wc={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class zc extends o{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class Xc extends xc{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.box_=new Gc(t.className||"ol-dragbox"),this.minArea_=void 0!==t.minArea?t.minArea:64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition?t.condition:Tc,this.boxEndCondition_=t.boxEndCondition?t.boxEndCondition:this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const n=i[0]-e[0],s=i[1]-e[1];return n*n+s*s>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new zc(Wc.BOXDRAG,t.coordinate,t))}handleUpEvent(t){this.box_.setMap(null);const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new zc(e?Wc.BOXEND:Wc.BOXCANCEL,t.coordinate,t)),!1}handleDownEvent(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new zc(Wc.BOXSTART,t.coordinate,t)),!0)}onBoxEnd(t){}}var Yc=Xc;class Bc extends Yc{constructor(t){t=t||{};const e=t.condition?t.condition:Lc;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=void 0!==t.duration?t.duration:200,this.out_=void 0!==t.out&&t.out}onBoxEnd(t){const e=this.getMap(),i=e.getView();let n=this.getGeometry();if(this.out_){const t=i.rotatedExtentForGeometry(n),e=i.getResolutionForExtentInternal(t),s=i.getResolution()/e;n=n.clone(),n.scale(s*s)}i.fitInternal(n,{duration:this.duration_,easing:ri})}}var Kc=Bc,Vc={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class jc extends fc{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return Ic(t)&&bc(t)},this.condition_=void 0!==t.condition?t.condition:this.defaultCondition_,this.duration_=void 0!==t.duration?t.duration:100,this.pixelDelta_=void 0!==t.pixelDelta?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==R.KEYDOWN){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==Vc.DOWN||n==Vc.LEFT||n==Vc.RIGHT||n==Vc.UP)){const s=t.map,r=s.getView(),o=r.getResolution()*this.pixelDelta_;let a=0,h=0;n==Vc.DOWN?h=-o:n==Vc.LEFT?a=-o:n==Vc.RIGHT?a=o:h=o;const l=[a,h];_e(l,r.getRotation()),gc(r,l,this.duration_),i.preventDefault(),e=!0}}return!e}}var Zc=jc;class Uc extends fc{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!Mc(t)&&bc(t)},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:100}handleEvent(t){let e=!1;if(t.type==R.KEYDOWN||t.type==R.KEYPRESS){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&("+"===n||"-"===n)){const s=t.map,r="+"===n?this.delta_:-this.delta_,o=s.getView();_c(o,r,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}var Hc=Uc;class qc{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;while(i>0&&this.points_[i+2]>t)i-=3;const n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const s=this.points_[e]-this.points_[i],r=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(r,s),this.initialVelocity_=Math.sqrt(s*s+r*r)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}var Jc=qc;class $c extends fc{constructor(t){t=t||{},super(t),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=void 0!==t.maxDelta?t.maxDelta:1,this.duration_=void 0!==t.duration?t.duration:250,this.timeout_=void 0!==t.timeout?t.timeout:80,this.useAnchor_=void 0===t.useAnchor||t.useAnchor,this.constrainResolution_=void 0!==t.constrainResolution&&t.constrainResolution;const e=t.condition?t.condition:Rc;this.condition_=t.onFocusOnly?Ec(wc,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;const e=t.getView();e.endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)}handleEvent(t){if(!this.condition_(t))return!0;const e=t.type;if(e!==R.WHEEL)return!0;const i=t.map,n=t.originalEvent;let s;if(n.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==R.WHEEL&&(s=n.deltaY,li&&n.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(s/=gi),n.deltaMode===WheelEvent.DOM_DELTA_LINE&&(s*=40)),0===s)return!1;this.lastDelta_=s;const r=Date.now();void 0===this.startTime_&&(this.startTime_=r),(!this.mode_||r-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(s)<4?"trackpad":"wheel");const o=i.getView();if("trackpad"===this.mode_&&!o.getConstrainResolution()&&!this.constrainResolution_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(o.getAnimating()&&o.cancelAnimations(),o.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),o.adjustZoom(-s/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=r,!1;this.totalDelta_+=s;const a=Math.max(this.timeout_-(r-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),a),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-z(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),_c(e,i,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}var Qc=$c;class tu extends xc{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=y),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==t.threshold?t.threshold:.3,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],n=this.targetPointers[1],s=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(void 0!==this.lastAngle_){const t=s-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=s;const r=t.map,o=r.getView();o.getConstraints().rotation!==ti&&(this.anchor_=r.getCoordinateFromPixelInternal(r.getEventPixel(vc(this.targetPointers))),this.rotating_&&(r.render(),o.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map,i=e.getView();return i.endInteraction(this.duration_),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}var eu=tu;class iu extends xc{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=y),super(e),this.anchor_=null,this.duration_=void 0!==t.duration?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.targetPointers[1],s=i.clientX-n.clientX,r=i.clientY-n.clientY,o=Math.sqrt(s*s+r*r);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,h=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(vc(this.targetPointers))),a.render(),h.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map,i=e.getView(),n=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,n),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}var nu=iu;function su(t){t=t||{};const e=new Oh,i=new Jc(-.005,.05,100),n=void 0===t.altShiftDragRotate||t.altShiftDragRotate;n&&e.push(new kc);const s=void 0===t.doubleClickZoom||t.doubleClickZoom;s&&e.push(new mc({delta:t.zoomDelta,duration:t.zoomDuration}));const r=void 0===t.dragPan||t.dragPan;r&&e.push(new Dc({onFocusOnly:t.onFocusOnly,kinetic:i}));const o=void 0===t.pinchRotate||t.pinchRotate;o&&e.push(new eu);const a=void 0===t.pinchZoom||t.pinchZoom;a&&e.push(new nu({duration:t.zoomDuration}));const h=void 0===t.keyboard||t.keyboard;h&&(e.push(new Zc),e.push(new Hc({delta:t.zoomDelta,duration:t.zoomDuration})));const l=void 0===t.mouseWheelZoom||t.mouseWheelZoom;l&&e.push(new Qc({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration}));const c=void 0===t.shiftDragZoom||t.shiftDragZoom;return c&&e.push(new Kc({duration:t.zoomDuration})),e}function ru(t){t instanceof Dn?t.setMapInternal(null):t instanceof Wl&&t.getLayers().forEach(ru)}function ou(t,e){if(t instanceof Dn)t.setMapInternal(e);else if(t instanceof Wl){const i=t.getLayers().getArray();for(let t=0,n=i.length;t<n;++t)ou(i[t],e)}}class au extends N{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=hu(t);this.renderComplete_,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=void 0!==t.maxTilesLoading?t.maxTilesLoading:16,this.pixelRatio_=void 0!==t.pixelRatio?t.pixelRatio:gi,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=mi(),this.pixelToCoordinateTransform_=mi(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_),this.mapBrowserEventHandler_=null,this.moveTolerance_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,this.resizeObserver_=new ResizeObserver((()=>this.updateSize())),this.controls=e.controls||cc(),this.interactions=e.interactions||su({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new tc(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Hl.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Hl.VIEW,this.handleViewChanged_),this.addChangeListener(Hl.SIZE,this.handleSizeChanged_),this.addChangeListener(Hl.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;!t.view||t.view instanceof An||t.view.then((function(t){i.setView(new An(t))})),this.controls.addEventListener(Mh.ADD,(t=>{t.element.setMap(this)})),this.controls.addEventListener(Mh.REMOVE,(t=>{t.element.setMap(null)})),this.interactions.addEventListener(Mh.ADD,(t=>{t.element.setMap(this)})),this.interactions.addEventListener(Mh.REMOVE,(t=>{t.element.setMap(null)})),this.overlays_.addEventListener(Mh.ADD,(t=>{this.addOverlayInternal_(t.element)})),this.overlays_.addEventListener(Mh.REMOVE,(t=>{const e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)})),this.controls.forEach((t=>{t.setMap(this)})),this.interactions.forEach((t=>{t.setMap(this)})),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){const e=this.getLayerGroup().getLayers();e.push(t)}handleLayerAdd_(t){ou(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const n=this.getCoordinateFromPixelInternal(t);i=void 0!==i?i:{};const s=void 0!==i.hitTolerance?i.hitTolerance:0,r=void 0!==i.layerFilter?i.layerFilter:m,o=!1!==i.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,s,o,e,null,r,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,(function(t){i.push(t)}),e),i}getAllLayers(){const t=[];function e(i){i.forEach((function(i){i instanceof Wl?e(i.getLayers()):t.push(i)}))}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t);e=void 0!==e?e:{};const n=void 0!==e.layerFilter?e.layerFilter:m,s=void 0!==e.hitTolerance?e.hitTolerance:0,r=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,s,r,n,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const e=this.viewport_,i=e.getBoundingClientRect(),n=this.getSize(),s=i.width/n[0],r=i.height/n[1],o="changedTouches"in t?t.changedTouches[0]:t;return[(o.clientX-i.left)/s,(o.clientY-i.top)/r]}getTarget(){return this.get(Hl.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return Xe(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?Ei(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(Hl.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof Oh)return void e.setLayers(t);const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){const t=this.getLayerGroup().getLayers();return t}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const i=t[e];if(!i.visible)continue;const n=i.layer.getRenderer();if(n&&!n.ready)return!0;const s=i.layer.getSource();if(s&&s.loading)return!0}return!1}getPixelFromCoordinate(t){const e=Ye(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?Ei(e.coordinateToPixelTransform,t.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(Hl.SIZE)}getView(){return this.get(Hl.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,n){return ec(this.frameState_,t,e,i,n)}handleBrowserEvent(t,e){e=e||t.type;const i=new Bl(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===Vl.POINTERDOWN||i===R.WHEEL||i===R.KEYDOWN){const t=this.getOwnerDocument(),i=this.viewport_.getRootNode?this.viewport_.getRootNode():t,n=e.target;if(this.overlayContainerStopEvent_.contains(n)||!(i===t?t.documentElement:i).contains(n))return}if(t.frameState=this.frameState_,!1!==this.dispatchEvent(t)){const e=this.getInteractions().getArray().slice();for(let i=e.length-1;i>=0;i--){const n=e[i];if(n.getMap()!==this||!n.getActive()||!this.getTargetElement())continue;const s=n.handleEvent(t);if(!s||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let i=this.maxTilesLoading_,n=i;if(t){const e=t.viewHints;if(e[Q.ANIMATING]||e[Q.INTERACTING]){const e=Date.now()-t.time>8;i=e?0:8,n=e?0:2}}e.getTilesLoading()<i&&(e.reprioritize(),e.loadMoreTiles(i,n))}t&&this.renderer_&&!t.animate&&(!0===this.renderComplete_?(this.hasListener($.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent($.RENDERCOMPLETE,t),!1===this.loaded_&&(this.loaded_=!0,this.dispatchEvent(new Xl(Ul.LOADEND,this,t)))):!0===this.loaded_&&(this.loaded_=!1,this.dispatchEvent(new Xl(Ul.LOADSTART,this,t))));const i=this.postRenderFunctions_;for(let n=0,s=i.length;n<s;++n)i[n](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let t=0,e=this.targetChangeHandlerKeys_.length;t<e;++t)M(this.targetChangeHandlerKeys_[t]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(R.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(R.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,ns(this.viewport_)}if(this.targetElement_){this.resizeObserver_.unobserve(this.targetElement_);const t=this.targetElement_.getRootNode();t instanceof ShadowRoot&&this.resizeObserver_.unobserve(t.host),this.setSize(void 0)}const t=this.getTarget(),e="string"===typeof t?document.getElementById(t):t;if(this.targetElement_=e,e){e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Fl(this)),this.mapBrowserEventHandler_=new Zl(this,this.moveTolerance_);for(const e in Kl)this.mapBrowserEventHandler_.addEventListener(Kl[e],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(R.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(R.WHEEL,this.boundHandleBrowserEvent_,!!pi&&{passive:!1});const t=this.keyboardEventTarget_?this.keyboardEventTarget_:e;this.targetChangeHandlerKeys_=[T(t,R.KEYDOWN,this.handleBrowserEvent,this),T(t,R.KEYPRESS,this.handleBrowserEvent,this)];const i=e.getRootNode();i instanceof ShadowRoot&&this.resizeObserver_.observe(i.host),this.resizeObserver_.observe(e)}else this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);this.updateSize()}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(M(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(M(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(),this.viewPropertyListenerKey_=T(t,a.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=T(t,R.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(M),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new kl("addlayer",t)),this.layerGroupPropertyListenerKeys_=[T(t,a.PROPERTYCHANGE,this.render,this),T(t,R.CHANGE,this.render,this),T(t,"addlayer",this.handleLayerAdd_,this),T(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const i=t[e].layer;i.hasRenderer()&&i.getRenderer().handleFontsChanged()}}render(){this.renderer_&&void 0===this.animationDelayKey_&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}flushDeclutterItems(){const t=this.frameState_;t&&this.renderer_.flushDeclutterItems(t)}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){const e=this.getLayerGroup().getLayers();return e.remove(t)}handleLayerRemove_(t){ru(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),n=this.frameState_;let s=null;if(void 0!==e&&Gs(e)&&i&&i.isDef()){const n=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),r=i.getState();if(s={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutterTree:null,extent:$t(r.center,r.resolution,r.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:r,viewHints:n,wantedTiles:{},mapId:D(this),renderTargets:{}},r.nextCenter&&r.nextResolution){const t=isNaN(r.nextRotation)?r.rotation:r.nextRotation;s.nextExtent=$t(r.nextCenter,r.nextResolution,t,e)}}if(this.frameState_=s,this.renderer_.renderFrame(s),s){if(s.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,s.postRenderFunctions),n){const t=!this.previousExtent_||!oe(this.previousExtent_)&&!Xt(s.extent,this.previousExtent_);t&&(this.dispatchEvent(new Xl(Ul.MOVESTART,this,n)),this.previousExtent_=Gt(this.previousExtent_))}const t=this.previousExtent_&&!s.viewHints[Q.ANIMATING]&&!s.viewHints[Q.INTERACTING]&&!Xt(s.extent,this.previousExtent_);t&&(this.dispatchEvent(new Xl(Ul.MOVEEND,this,s)),bt(s.extent,this.previousExtent_))}this.dispatchEvent(new Xl(Ul.POSTRENDER,this,s)),this.renderComplete_=this.hasListener(Ul.LOADSTART)||this.hasListener(Ul.LOADEND)||this.hasListener($.RENDERCOMPLETE)?!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady():void 0,this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout((()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()}),0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new kl("removelayer",e)),this.set(Hl.LAYERGROUP,t)}setSize(t){this.set(Hl.SIZE,t)}setTarget(t){this.set(Hl.TARGET,t)}setView(t){if(!t||t instanceof An)return void this.set(Hl.VIEW,t);this.set(Hl.VIEW,new An);const e=this;t.then((function(t){e.setView(new An(t))}))}updateSize(){const t=this.getTargetElement();let e;if(t){const i=getComputedStyle(t),n=t.offsetWidth-parseFloat(i["borderLeftWidth"])-parseFloat(i["paddingLeft"])-parseFloat(i["paddingRight"])-parseFloat(i["borderRightWidth"]),s=t.offsetHeight-parseFloat(i["borderTopWidth"])-parseFloat(i["paddingTop"])-parseFloat(i["paddingBottom"])-parseFloat(i["borderBottomWidth"]);isNaN(n)||isNaN(s)||(e=[n,s],!Gs(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&Ce("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&f(e,i)||(this.setSize(e),this.updateViewportSize_())}updateViewportSize_(){const t=this.getView();if(t){let e;const i=getComputedStyle(this.viewport_);i.width&&i.height&&(e=[parseInt(i.width,10),parseInt(i.height,10)]),t.setViewportSize(e)}}}function hu(t){let e=null;void 0!==t.keyboardEventTarget&&(e="string"===typeof t.keyboardEventTarget?document.getElementById(t.keyboardEventTarget):t.keyboardEventTarget);const i={},n=t.layers&&"function"===typeof t.layers.getLayers?t.layers:new Wl({layers:t.layers});let s,r,o;return i[Hl.LAYERGROUP]=n,i[Hl.TARGET]=t.target,i[Hl.VIEW]=t.view instanceof An?t.view:new An,void 0!==t.controls&&(Array.isArray(t.controls)?s=new Oh(t.controls.slice()):(W("function"===typeof t.controls.getArray,"Expected `controls` to be an array or an `ol/Collection.js`"),s=t.controls)),void 0!==t.interactions&&(Array.isArray(t.interactions)?r=new Oh(t.interactions.slice()):(W("function"===typeof t.interactions.getArray,"Expected `interactions` to be an array or an `ol/Collection.js`"),r=t.interactions)),void 0!==t.overlays?Array.isArray(t.overlays)?o=new Oh(t.overlays.slice()):(W("function"===typeof t.overlays.getArray,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=t.overlays):o=new Oh,{controls:s,interactions:r,keyboardEventTarget:e,overlays:o,values:i}}var lu=au;const cu={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class uu extends N{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=void 0===t.insertFirst||t.insertFirst,this.stopEvent=void 0===t.stopEvent||t.stopEvent,this.element=document.createElement("div"),this.element.className=void 0!==t.className?t.className:"ol-overlay-container "+qs,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=!0===t.autoPan?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(cu.ELEMENT,this.handleElementChanged),this.addChangeListener(cu.MAP,this.handleMapChanged),this.addChangeListener(cu.OFFSET,this.handleOffsetChanged),this.addChangeListener(cu.POSITION,this.handlePositionChanged),this.addChangeListener(cu.POSITIONING,this.handlePositioningChanged),void 0!==t.element&&this.setElement(t.element),this.setOffset(void 0!==t.offset?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),void 0!==t.position&&this.setPosition(t.position)}getElement(){return this.get(cu.ELEMENT)}getId(){return this.id}getMap(){return this.get(cu.MAP)||null}getOffset(){return this.get(cu.OFFSET)}getPosition(){return this.get(cu.POSITION)}getPositioning(){return this.get(cu.POSITIONING)}handleElementChanged(){ss(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&(ns(this.element),M(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=T(t,Ul.POSTRENDER,this.render,this),this.updatePixelPosition();const e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(cu.ELEMENT,t)}setMap(t){this.set(cu.MAP,t)}setOffset(t){this.set(cu.OFFSET,t)}setPosition(t){this.set(cu.POSITION,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(cu.POSITION))return;const i=this.getRect(e.getTargetElement(),e.getSize()),n=this.getElement(),s=this.getRect(n,[ts(n),es(n)]);t=t||{};const r=void 0===t.margin?20:t.margin;if(!Pt(i,s)){const n=s[0]-i[0],o=i[2]-s[2],a=s[1]-i[1],h=i[3]-s[3],l=[0,0];if(n<0?l[0]=n-r:o<0&&(l[0]=Math.abs(o)+r),a<0?l[1]=a-r:h<0&&(l[1]=Math.abs(h)+r),0!==l[0]||0!==l[1]){const i=e.getView().getCenterInternal(),n=e.getPixelFromCoordinateInternal(i);if(!n)return;const s=[n[0]+l[0],n[1]+l[1]],r=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(s),duration:r.duration,easing:r.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),n=i.left+window.pageXOffset,s=i.top+window.pageYOffset;return[n,s,n+e[0],s+e[1]]}setPositioning(t){this.set(cu.POSITIONING,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e)return void this.setVisible(!1);const i=t.getPixelFromCoordinate(e),n=t.getSize();this.updateRenderedPosition(i,n)}updateRenderedPosition(t,e){const i=this.element.style,n=this.getOffset(),s=this.getPositioning();this.setVisible(!0);const r=Math.round(t[0]+n[0])+"px",o=Math.round(t[1]+n[1])+"px";let a="0%",h="0%";"bottom-right"==s||"center-right"==s||"top-right"==s?a="-100%":"bottom-center"!=s&&"center-center"!=s&&"top-center"!=s||(a="-50%"),"bottom-left"==s||"bottom-center"==s||"bottom-right"==s?h="-100%":"center-left"!=s&&"center-center"!=s&&"center-right"!=s||(h="-50%");const l=`translate(${a}, ${h}) translate(${r}, ${o})`;this.rendered.transform_!=l&&(this.rendered.transform_=l,i.transform=l)}getOptions(){return this.options}}var du=uu;function gu(t,e,i,n,s,r,o){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 r=t[e],o=t[e+1],l=0;const u=[0];for(let s=e+n;s<i;s+=n){const e=t[s],i=t[s+1];l+=Math.sqrt((e-r)*(e-r)+(i-o)*(i-o)),u.push(l),r=e,o=i}const d=s*l,g=c(u,d);g<0?(h=(d-u[-g-2])/(u[-g-1]-u[-g-2]),a=e+(-g-2)*n):a=e+g*n}o=o>1?o:2,r=r||new Array(o);for(let c=0;c<o;++c)r[c]=void 0===a?NaN:void 0===h?t[a+c]:j(t[a+c],t[a+n+c],h);return r}function _u(t,e,i,n,s,r){if(i==e)return null;let o;if(s<t[e+n-1])return r?(o=t.slice(e,e+n),o[n-1]=s,o):null;if(t[i-1]<s)return r?(o=t.slice(i-n,i),o[n-1]=s,o):null;if(s==t[e+n-1])return t.slice(e,e+n);let a=e/n,h=i/n;while(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=t[(a+1)*n-1],u=(s-l)/(c-l);o=[];for(let d=0;d<n-1;++d)o.push(j(t[(a-1)*n+d],t[a*n+d],u));return o.push(s),o}class fu extends Wi{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?_(this.flatCoordinates,t):this.flatCoordinates=t.slice(),this.changed()}clone(){const t=new fu(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<At(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Xi(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 dn(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,_u(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return $i(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return gu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return za(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=Ui(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new fu(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return gn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ji(this.flatCoordinates,0,t,this.stride),this.changed()}}var pu=fu;function mu(t){if(!(t.context instanceof CanvasRenderingContext2D))throw new Error("Only works for render events from Canvas 2D layers");const e=t.inversePixelTransform[0],i=t.inversePixelTransform[1],n=Math.sqrt(e*e+i*i),s=t.frameState,r=yi(t.inversePixelTransform.slice(),s.coordinateToPixelTransform),o=uh(s.viewState.resolution,n);let a;const h=ze();return h&&(a=Fe(h,s.viewState.projection)),new sh(t.context,n,s.extent,r,s.viewState.rotation,o,a)}var yu={data(){return{map:{},pointLayer:{},canAddPoints:!1,coordinate:[],route:new pu([[113.95113841271974,22.568523240293505],[113.94452944970705,22.563351941312792],[113.95188943124391,22.559317898954394],[113.94467965341188,22.555326771940233]]),geometryMove:{},featureMove:{},styles:{route:new zr({stroke:new Dr({width:6,color:[237,212,0,.8]})}),icon:new zr({image:new Hr({anchor:[.5,1],src:"https://openlayers.org/en/v4.6.5/examples/data/icon.png",scale:1})}),featureMove:new zr({image:new br({radius:7,fill:new Or({color:"black"}),stroke:new Dr({color:"white",width:2})})})},vectorLayer:{},distance:0,lastTime:0,speed:.1}},mounted(){this.initMap(),this.clickMap()},methods:{showHistory(){var t=[[113.94755498147583,22.565597285534384],[113.9468468782959,22.563151110912802],[113.9487566111145,22.56018995216036],[113.95017281747437,22.55748628547335]];console.log(t)},clearPointsLayers(){this.coordinate=[],this.map.removeLayer(this.pointLayer),this.pointLayer={},0==Object.keys(this.pointLayer).length&&(this.pointLayer=new Ih({source:new Vh}),this.map.addLayer(this.pointLayer))},initMap(){this.geometryMove=new an(this.route.getFirstCoordinate()),this.featureMove=new bl({type:"featureMove",geometry:this.geometryMove}),this.vectorLayer=new Ih({source:new Vh({features:[new bl({type:"route",geometry:this.route}),this.featureMove,new bl({type:"icon",geometry:new an(this.route.getFirstCoordinate())}),new bl({type:"icon",geometry:new an(this.route.getLastCoordinate())})]}),style:t=>this.styles[t.get("type")]}),this.map=new lu({target:"map",layers:[new Ks({source:new Il({url:"http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetPurplishBlue/MapServer/tile/{z}/{y}/{x}"})})],view:new An({projection:"EPSG:4326",center:[113.948306,22.562039],zoom:16})}),this.map.addLayer(this.vectorLayer)},clickMap(){this.map.on("click",(t=>{this.canAddPoints&&this.addPoints(t.coordinate)}))},addPoints(t){this.coordinate.push(t),console.log(JSON.stringify(this.coordinate)),0==Object.keys(this.pointLayer).length&&(this.pointLayer=new Ih({source:new Vh}),this.map.addLayer(this.pointLayer));const e=new bl({geometry:new an(t)});e.setStyle(new zr({image:new Hr({src:"https://smart-garden-manage.oss-cn-chengdu.aliyuncs.com/shexiangtou.png",scale:.3})})),this.pointLayer.getSource().addFeature(e)},addText(t){const e=document.getElementById("overlay-box"),i=document.createElement("span");i.contentEditable=!0,i.id=t[0];let n=document.createTextNode("摄像头"+t[0].toFixed(2));i.appendChild(n),e.appendChild(i);let s=new du({position:t,element:document.getElementById(t[0]),offset:[-25,30]});this.map.addOverlay(s)},moveFeature(t){let e=t.frameState.time;this.distance=(this.distance+this.speed*(e-this.lastTime)/1e3)%1,this.lastTime=e;const i=this.route.getCoordinateAt(this.distance>1?2-this.distance:this.distance);this.geometryMove.setCoordinates(i);const n=mu(t);n.setStyle(this.styles.featureMove),n.drawGeometry(this.geometryMove),this.map.render()},startAnimation(){this.lastTime=Date.now(),this.vectorLayer.on("postrender",this.moveFeature),this.featureMove.setGeometry(null)},stopAnimation(){this.featureMove.setGeometry(this.geometryMove),this.vectorLayer.un("postrender",this.moveFeature)}}},vu=yu,xu=i(3736),Eu=(0,xu.Z)(vu,n,s,!1,null,null,null),Cu=Eu.exports},5325:function(t,e,i){i(7658),function(e,i){t.exports=i()}(0,(function(){"use strict";function t(t,n,s,r,o){!function t(i,n,s,r,o){for(;r>s;){if(r-s>600){var a=r-s+1,h=n-s+1,l=Math.log(a),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(a-c)/a)*(h-a/2<0?-1:1),d=Math.max(s,Math.floor(n-h*c/a+u)),g=Math.min(r,Math.floor(n+(a-h)*c/a+u));t(i,n,d,g,o)}var _=i[n],f=s,p=r;for(e(i,s,n),o(i[r],_)>0&&e(i,s,r);f<p;){for(e(i,f,p),f++,p--;o(i[f],_)<0;)f++;for(;o(i[p],_)>0;)p--}0===o(i[s],_)?e(i,s,p):e(i,++p,r),p<=n&&(s=p+1),n<=p&&(r=p-1)}}(t,n,s||0,r||t.length-1,o||i)}function e(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function i(t,e){return t<e?-1:t>e?1:0}var n=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function s(t,e,i){if(!i)return e.indexOf(t);for(var n=0;n<e.length;n++)if(i(t,e[n]))return n;return-1}function r(t,e){o(t,0,t.children.length,e,t)}function o(t,e,i,n,s){s||(s=_(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(var r=e;r<i;r++){var o=t.children[r];a(s,t.leaf?n(o):o)}return s}function a(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function h(t,e){return t.minX-e.minX}function l(t,e){return t.minY-e.minY}function c(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function u(t){return t.maxX-t.minX+(t.maxY-t.minY)}function d(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function g(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function _(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function f(e,i,n,s,r){for(var o=[i,n];o.length;)if(!((n=o.pop())-(i=o.pop())<=s)){var a=i+Math.ceil((n-i)/s/2)*s;t(e,a,i,n,r),o.push(i,a,a,n)}}return n.prototype.all=function(){return this._all(this.data,[])},n.prototype.search=function(t){var e=this.data,i=[];if(!g(t,e))return i;for(var n=this.toBBox,s=[];e;){for(var r=0;r<e.children.length;r++){var o=e.children[r],a=e.leaf?n(o):o;g(t,a)&&(e.leaf?i.push(o):d(t,a)?this._all(o,i):s.push(o))}e=s.pop()}return i},n.prototype.collides=function(t){var e=this.data;if(!g(t,e))return!1;for(var i=[];e;){for(var n=0;n<e.children.length;n++){var s=e.children[n],r=e.leaf?this.toBBox(s):s;if(g(t,r)){if(e.leaf||d(t,r))return!0;i.push(s)}}e=i.pop()}return!1},n.prototype.load=function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0;e<t.length;e++)this.insert(t[e]);return this}var i=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===i.height)this._splitRoot(this.data,i);else{if(this.data.height<i.height){var n=this.data;this.data=i,i=n}this._insert(i,this.data.height-i.height-1,!0)}else this.data=i;return this},n.prototype.insert=function(t){return t&&this._insert(t,this.data.height-1),this},n.prototype.clear=function(){return this.data=_([]),this},n.prototype.remove=function(t,e){if(!t)return this;for(var i,n,r,o=this.data,a=this.toBBox(t),h=[],l=[];o||h.length;){if(o||(o=h.pop(),n=h[h.length-1],i=l.pop(),r=!0),o.leaf){var c=s(t,o.children,e);if(-1!==c)return o.children.splice(c,1),h.push(o),this._condense(h),this}r||o.leaf||!d(o,a)?n?(i++,o=n.children[i],r=!1):o=null:(h.push(o),l.push(i),i=0,n=o,o=o.children[0])}return this},n.prototype.toBBox=function(t){return t},n.prototype.compareMinX=function(t,e){return t.minX-e.minX},n.prototype.compareMinY=function(t,e){return t.minY-e.minY},n.prototype.toJSON=function(){return this.data},n.prototype.fromJSON=function(t){return this.data=t,this},n.prototype._all=function(t,e){for(var i=[];t;)t.leaf?e.push.apply(e,t.children):i.push.apply(i,t.children),t=i.pop();return e},n.prototype._build=function(t,e,i,n){var s,o=i-e+1,a=this._maxEntries;if(o<=a)return r(s=_(t.slice(e,i+1)),this.toBBox),s;n||(n=Math.ceil(Math.log(o)/Math.log(a)),a=Math.ceil(o/Math.pow(a,n-1))),(s=_([])).leaf=!1,s.height=n;var h=Math.ceil(o/a),l=h*Math.ceil(Math.sqrt(a));f(t,e,i,l,this.compareMinX);for(var c=e;c<=i;c+=l){var u=Math.min(c+l-1,i);f(t,c,u,h,this.compareMinY);for(var d=c;d<=u;d+=h){var g=Math.min(d+h-1,u);s.children.push(this._build(t,d,g,n-1))}}return r(s,this.toBBox),s},n.prototype._chooseSubtree=function(t,e,i,n){for(;n.push(e),!e.leaf&&n.length-1!==i;){for(var s=1/0,r=1/0,o=void 0,a=0;a<e.children.length;a++){var h=e.children[a],l=c(h),u=(d=t,g=h,(Math.max(g.maxX,d.maxX)-Math.min(g.minX,d.minX))*(Math.max(g.maxY,d.maxY)-Math.min(g.minY,d.minY))-l);u<r?(r=u,s=l<s?l:s,o=h):u===r&&l<s&&(s=l,o=h)}e=o||e.children[0]}var d,g;return e},n.prototype._insert=function(t,e,i){var n=i?t:this.toBBox(t),s=[],r=this._chooseSubtree(n,this.data,e,s);for(r.children.push(t),a(r,n);e>=0&&s[e].children.length>this._maxEntries;)this._split(s,e),e--;this._adjustParentBBoxes(n,s,e)},n.prototype._split=function(t,e){var i=t[e],n=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,n);var o=this._chooseSplitIndex(i,s,n),a=_(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,r(i,this.toBBox),r(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)},n.prototype._splitRoot=function(t,e){this.data=_([t,e]),this.data.height=t.height+1,this.data.leaf=!1,r(this.data,this.toBBox)},n.prototype._chooseSplitIndex=function(t,e,i){for(var n,s,r,a,h,l,u,d=1/0,g=1/0,_=e;_<=i-e;_++){var f=o(t,0,_,this.toBBox),p=o(t,_,i,this.toBBox),m=(s=f,r=p,a=void 0,h=void 0,l=void 0,u=void 0,a=Math.max(s.minX,r.minX),h=Math.max(s.minY,r.minY),l=Math.min(s.maxX,r.maxX),u=Math.min(s.maxY,r.maxY),Math.max(0,l-a)*Math.max(0,u-h)),y=c(f)+c(p);m<d?(d=m,n=_,g=y<g?y:g):m===d&&y<g&&(g=y,n=_)}return n||i-e},n.prototype._chooseSplitAxis=function(t,e,i){var n=t.leaf?this.compareMinX:h,s=t.leaf?this.compareMinY:l;this._allDistMargin(t,e,i,n)<this._allDistMargin(t,e,i,s)&&t.children.sort(n)},n.prototype._allDistMargin=function(t,e,i,n){t.children.sort(n);for(var s=this.toBBox,r=o(t,0,e,s),h=o(t,i-e,i,s),l=u(r)+u(h),c=e;c<i-e;c++){var d=t.children[c];a(r,t.leaf?s(d):d),l+=u(r)}for(var g=i-e-1;g>=e;g--){var _=t.children[g];a(h,t.leaf?s(_):_),l+=u(h)}return l},n.prototype._adjustParentBBoxes=function(t,e,i){for(var n=i;n>=0;n--)a(e[n],t)},n.prototype._condense=function(t){for(var e=t.length-1,i=void 0;e>=0;e--)0===t[e].children.length?e>0?(i=t[e-1].children).splice(i.indexOf(t[e]),1):this.clear():r(t[e],this.toBBox)},n}))}}]);
|
||
//# sourceMappingURL=10.bf685dc9.js.map
|