PageSourceSearch

https://kringla.nu/kringla/dist/bundle.js

js kringla.nu collected 2026-10-02 09:57:04 UTC 320,526 bytes, 7 lines download raw bytes

1"use strict";(()=>{var lt={ADD:"add",REMOVE:"remove"};var he={PROPERTYCHANGE:"propertychange"};function we(n){for(let t in n)delete n[t]}function ce(n){let t;for(t in n)return!1;return!t}function U(n,t,e,i,r){if(r){let o=e;e=function(a){return n.removeEventListener(t,e),o.call(i??this,a)}}else i&&i!==n&&(e=e.bind(i));let s={target:n,type:t,listener:e};return n.addEventListener(t,e),s}function tn(n,t,e,i){return U(n,t,e,i,!0)}function H(n){n&&n.target&&(n.target.removeEventListener(n.type,n.listener),we(n))}var M={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"};var xo=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},ai=xo;function Nh(n,t,e){let i,r;e=e||zt;let s=0,o=n.length,a=!1;for(;s<o;)i=s+(o-s>>1),r=+e(n[i],t),r<0?s=i+1:(o=i,a=!r);return a?s:~s}function zt(n,t){return n>t?1:n<t?-1:0}function Gh(n,t){return n<t?1:n>t?-1:0}function en(n,t,e){if(n[0]<=t)return 0;let i=n.length;if(t<=n[i-1])return i-1;if(typeof e=="function"){for(let r=1;r<i;++r){let s=n[r];if(s===t)return r;if(s<t)return e(t,n[r-1],s)>0?r-1:r}return i-1}if(e>0){for(let r=1;r<i;++r)if(n[r]<t)return r-1;return i-1}if(e<0){for(let r=1;r<i;++r)if(n[r]<=t)return r;return i-1}for(let r=1;r<i;++r){if(n[r]==t)return r;if(n[r]<t)return n[r-1]-t<t-n[r]?r-1:r}return i-1}function Xh(n,t,e){for(;t<e;){let i=n[t];n[t]=n[e],n[e]=i,++t,--e}}function Ue(n,t){let e=Array.isArray(t)?t:[t],i=e.length;for(let r=0;r<i;r++)n[n.length]=e[r]}function Pt(n,t){let e=n.length;if(e!==t.length)return!1;for(let i=0;i<e;i++)if(n[i]!==t[i])return!1;return!0}function zh(n,t,e){let i=t||zt;return n.every(function(r,s){if(s===0)return!0;let o=i(n[s-1],r);return!(o>0||e&&o===0)})}function te(){return!0}function Re(){return!1}function Ye(){}function Gr(n){let t,e,i;return function(){let r=Array.prototype.slice.call(arguments);return(!e||this!==i||!Pt(r,e))&&(i=this,e=r,t=n.apply(this,arguments)),t}}function Wh(n){function t(){let e;try{e=n()}catch(i){return Promise.reject(i)}return e instanceof Promise?e:Promise.resolve(e)}return t()}var Eo=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var pt=Eo;var Co=class extends ai{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;let i=this.listeners_||(this.listeners_={}),r=i[t]||(i[t]=[]);r.includes(e)||r.push(e)}dispatchEvent(t){let e=typeof t=="string",i=e?t:t.type,r=this.listeners_&&this.listeners_[i];if(!r)return;let s=e?new pt(t):t;s.target||(s.target=this.eventTarget_||this);let o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in o||(o[i]=0,a[i]=0),++o[i];let l;for(let c=0,h=r.length;c<h;++c)if("handleEvent"in r[c]?l=r[c].handleEvent(s):l=r[c].call(this,s),l===!1||s.propagationStopped){l=!1;break}if(--o[i]===0){let c=a[i];for(delete a[i];c--;)this.removeEventListener(i,Ye);delete o[i]}return l}disposeInternal(){this.listeners_&&we(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:!1}removeEventListener(t,e){if(!this.listeners_)return;let i=this.listeners_[t];if(!i)return;let r=i.indexOf(e);r!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[r]=Ye,++this.pendingRemovals_[t]):(i.splice(r,1),i.length===0&&delete this.listeners_[t]))}},li=Co;var nn=class extends li{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(M.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){let i=t.length,r=new Array(i);for(let s=0;s<i;++s)r[s]=U(this,t[s],e);return r}return U(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){let r=t.length;i=new Array(r);for(let s=0;s<r;++s)i[s]=tn(this,t[s],e)}else i=tn(this,t,e);return e.ol_key=i,i}unInternal(t,e){let i=e.ol_key;if(i)vd(i);else if(Array.isArray(t))for(let r=0,s=t.length;r<s;++r)this.removeEventListener(t[r],e);else this.removeEventListener(t,e)}};nn.prototype.on;nn.prototype.once;nn.prototype.un;function vd(n){if(Array.isArray(n))for(let t=0,e=n.length;t<e;++t)H(n[t]);else H(n)}var Xr=nn;function j(){throw new Error("Unimplemented abstract method.")}var Ld=0;function F(n){return n.ol_uid||(n.ol_uid=String(++Ld))}var zr=class extends pt{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}},So=class extends Xr{constructor(t){super(),this.on,this.once,this.un,F(this),this.values_=null,t!==void 0&&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_}
1hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new zr(i,t,e)),i=he.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new zr(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){let r=this.values_||(this.values_={});if(i)r[t]=e;else{let s=r[t];r[t]=e,s!==e&&this.notify(t,s)}}setProperties(t,e){for(let 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_){let i=this.values_[t];delete this.values_[t],ce(this.values_)&&(this.values_=null),e||this.notify(t,i)}}},_t=So;var Uh={LENGTH:"length"},rn=class extends pt{constructor(t,e,i){super(t),this.element=e,this.index=i}},wo=class extends _t{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=1,r=this.array_.length;i<r;++i)this.assertUnique_(this.array_[i],i);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){let e=this.array_;for(let i=0,r=e.length;i<r;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(Uh.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 rn(lt.ADD,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){let e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){let e=this.array_;for(let i=0,r=e.length;i<r;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;let e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new rn(lt.REMOVE,e,t)),e}setAt(t,e){let i=this.getLength();if(t>=i){this.insertAt(t,e);return}if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);let r=this.array_[t];this.array_[t]=e,this.dispatchEvent(new rn(lt.REMOVE,r,t)),this.dispatchEvent(new rn(lt.ADD,e,t))}updateLength_(){this.set(Uh.LENGTH,this.array_.length)}assertUnique_(t,e){let i=this.array_;for(let r=0,s=i.length;r<s;++r)if(i[r]===t&&r!==e)throw new Error("Duplicate item added to a unique collection")}},St=wo;var Ro=class extends pt{constructor(t,e,i){super(t),this.map=e,this.frameState=i!==void 0?i:null}},hi=Ro;var To=class extends hi{constructor(t,e,i,r,s,o){super(t,e,s),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=r!==void 0?r:!1,this.activePointers=o}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()}},Te=To;var nt={SINGLECLICK:"singleclick",CLICK:M.CLICK,DBLCLICK:M.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var Pi=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",Ad=Pi.includes("safari")&&!Pi.includes("chrom"),qp=Ad&&(Pi.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(Pi)),Yh=Pi.includes("webkit")&&!Pi.includes("edge"),Io=Pi.includes("macintosh"),Kh=typeof devicePixelRatio<"u"?devicePixelRatio:1,wt=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,vo=typeof Image<"u"&&Image.prototype.decode;var Wr=(function(){let n=!1;try{let t=Object.defineProperty({},"passive",{get:function(){n=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return n})();var jn={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var Lo=class extends li{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=e===void 0?1:e,this.down_=null;let i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=U(i,jn.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=U(i,jn.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(M.TOUCHMOVE,this.boundHandleTouchMove_,Wr?{passive:!1}:!1)}emulateClick_(t){let e=new Te(nt.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new Te(nt.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let i=new Te(nt.SINGLECLICK,this.map_,t);this.dispatchEvent(i)},250)}updateActivePointers_(t){let e=t,i=e.pointerId;if(e.type==nt.POINTERUP||e.type==nt.POINTERCANCEL){delete this.trackedTouches_[i];for(let r in this.trackedTouches_)if(this.trackedTouches_[r].target!==e.target){delete this.trackedTouches_[r];break}}else(e.type==nt.POINTERDOWN||e.type==nt.POINTERMOVE)&&(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);let e=new Te(nt.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_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(H),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return t.button===0}handlePointerDown_(t){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(t);let e=new Te(nt.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);
1if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),this.dragListenerKeys_.length===0){let i=this.map_.getOwnerDocument();this.dragListenerKeys_.push(U(i,nt.POINTERMOVE,this.handlePointerMove_,this),U(i,nt.POINTERUP,this.handlePointerUp_,this),U(this.element_,nt.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(U(this.element_.getRootNode(),nt.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;let e=new Te(nt.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;let e=!!(this.down_&&this.isMoving_(t));this.dispatchEvent(new Te(nt.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){let e=this.originalPointerMoveEvent_;(!e||e.defaultPrevented)&&(typeof t.cancelable!="boolean"||t.cancelable===!0)&&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_&&(H(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(M.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(H(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(H),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},Bh=Lo;var Ie={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var vt={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var O={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Y(n,t){if(!n)throw new Error(t)}var Vn=1/0,Ao=class{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,we(this.queuedElements_)}dequeue(){let t=this.elements_,e=this.priorities_,i=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));let r=this.keyFunction_(i);return delete this.queuedElements_[r],i}enqueue(t){Y(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let e=this.priorityFunction_(t);return e!=Vn?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+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 this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){let e=this.elements_,i=this.priorities_,r=e.length,s=e[t],o=i[t],a=t;for(;t<r>>1;){let l=this.getLeftChildIndex_(t),c=this.getRightChildIndex_(t),h=c<r&&i[c]<i[l]?c:l;e[t]=e[h],i[t]=i[h],t=h}e[t]=s,i[t]=o,this.siftDown_(a,t)}siftDown_(t,e){let i=this.elements_,r=this.priorities_,s=i[e],o=r[e];for(;e>t;){let a=this.getParentIndex_(e);if(r[a]>o)i[e]=i[a],r[e]=r[a],e=a;else break}i[e]=s,r[e]=o}reprioritize(){let t=this.priorityFunction_,e=this.elements_,i=this.priorities_,r=0,s=e.length,o,a,l;for(a=0;a<s;++a)o=e[a],l=t(o),l==Vn?delete this.queuedElements_[this.keyFunction_(o)]:(i[r]=l,e[r++]=o);e.length=r,i.length=r,this.heapify_()}},jh=Ao;var Mo=class extends jh{constructor(t,e){super(i=>t.apply(null,i),i=>i[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){let e=super.enqueue(t);return e&&t[0].addEventListener(M.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){let e=t.target,i=e.getState();if(i===O.LOADED||i===O.ERROR||i===O.EMPTY){i!==O.ERROR&&e.removeEventListener(M.CHANGE,this.boundHandleTileChange_);let r=e.getKey();r in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[r],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;){let r=this.dequeue()[0],s=r.getKey();r.getState()===O.IDLE&&!(s in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++i,r.load())}}},Vh=Mo;function Zh(n,t,e,i,r){if(!n||!(e in n.wantedTiles))return Vn;
1if(!n.wantedTiles[e][t.getKey()])return Vn;let s=n.viewState.center,o=i[0]-s[0],a=i[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}var Rt={ANIMATING:0,INTERACTING:1};var ee={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function J(n,t,e){return Math.min(Math.max(n,t),e)}function Hh(n,t,e,i,r,s){let o=r-e,a=s-i;if(o!==0||a!==0){let l=((n-e)*o+(t-i)*a)/(o*o+a*a);l>1?(e=r,i=s):l>0&&(e+=o*l,i+=a*l)}return Ke(n,t,e,i)}function Ke(n,t,e,i){let r=e-n,s=i-t;return r*r+s*s}function qh(n){let t=n.length;for(let i=0;i<t;i++){let r=i,s=Math.abs(n[i][i]);for(let a=i+1;a<t;a++){let l=Math.abs(n[a][i]);l>s&&(s=l,r=a)}if(s===0)return null;let o=n[r];n[r]=n[i],n[i]=o;for(let a=i+1;a<t;a++){let l=-n[a][i]/n[i][i];for(let c=i;c<t+1;c++)i==c?n[a][c]=0:n[a][c]+=l*n[i][c]}}let e=new Array(t);for(let i=t-1;i>=0;i--){e[i]=n[i][t]/n[i][i];for(let r=i-1;r>=0;r--)n[r][t]-=n[r][i]*e[i]}return e}function Ur(n){return n*180/Math.PI}function ue(n){return n*Math.PI/180}function ve(n,t){let e=n%t;return e*t<0?e+t:e}function Ot(n,t,e){return n+e*(t-n)}function Oi(n,t){let e=Math.pow(10,t);return Math.round(n*e)/e}function Zn(n,t){return Math.floor(Oi(n,t))}function Hn(n,t){return Math.ceil(Oi(n,t))}function Yr(n,t,e){if(n>=t&&n<e)return n;let i=e-t;return((n-t)%i+i)%i+t}function Po(n,t,e){return(function(i,r,s,o,a){if(!i)return;if(!r&&!t)return i;let l=t?0:s[0]*r,c=t?0:s[1]*r,h=a?a[0]:0,u=a?a[1]:0,f=n[0]+l/2+h,d=n[2]-l/2+h,g=n[1]+c/2+u,p=n[3]-c/2+u;f>d&&(f=(d+f)/2,d=f),g>p&&(g=(p+g)/2,p=g);let m=J(i[0],f,d),_=J(i[1],g,p);if(o&&e&&r){let x=30*r;m+=-x*Math.log(1+Math.max(0,f-i[0])/x)+x*Math.log(1+Math.max(0,i[0]-d)/x),_+=-x*Math.log(1+Math.max(0,g-i[1])/x)+x*Math.log(1+Math.max(0,i[1]-p)/x)}return[m,_]})}function $h(n){return n}var yt={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function qn(n){let t=mt();for(let e=0,i=n.length;e<i;++e)Fi(t,n[e]);return t}function Md(n,t,e){let i=Math.min.apply(null,n),r=Math.min.apply(null,t),s=Math.max.apply(null,n),o=Math.max.apply(null,t);return jt(i,r,s,o,e)}function sn(n,t,e){return e?(e[0]=n[0]-t,e[1]=n[1]-t,e[2]=n[2]+t,e[3]=n[3]+t,e):[n[0]-t,n[1]-t,n[2]+t,n[3]+t]}function Br(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n.slice()}function jr(n,t,e){let i,r;return t<n[0]?i=n[0]-t:n[2]<t?i=t-n[2]:i=0,e<n[1]?r=n[1]-e:n[3]<e?r=e-n[3]:r=0,i*i+r*r}function fe(n,t){return Oo(n,t[0],t[1])}function Le(n,t){return n[0]<=t[0]&&t[2]<=n[2]&&n[1]<=t[1]&&t[3]<=n[3]}function Oo(n,t,e){return n[0]<=t&&t<=n[2]&&n[1]<=e&&e<=n[3]}function Kr(n,t){let e=n[0],i=n[1],r=n[2],s=n[3],o=t[0],a=t[1],l=yt.UNKNOWN;return o<e?l=l|yt.LEFT:o>r&&(l=l|yt.RIGHT),a<i?l=l|yt.BELOW:a>s&&(l=l|yt.ABOVE),l===yt.UNKNOWN&&(l=yt.INTERSECTING),l}function mt(){return[1/0,1/0,-1/0,-1/0]}function jt(n,t,e,i,r){return r?(r[0]=n,r[1]=t,r[2]=e,r[3]=i,r):[n,t,e,i]}function bi(n){return jt(1/0,1/0,-1/0,-1/0,n)}function Vr(n,t){let e=n[0],i=n[1];return jt(e,i,e,i,t)}function on(n,t,e,i,r){let s=bi(r);return bo(s,n,t,e,i)}function Di(n,t){return n[0]==t[0]&&n[2]==t[2]&&n[1]==t[1]&&n[3]==t[3]}function Zr(n,t){return t[0]<n[0]&&(n[0]=t[0]),t[2]>n[2]&&(n[2]=t[2]),t[1]<n[1]&&(n[1]=t[1]),t[3]>n[3]&&(n[3]=t[3]),n}function Fi(n,t){t[0]<n[0]&&(n[0]=t[0]),t[0]>n[2]&&(n[2]=t[0]),t[1]<n[1]&&(n[1]=t[1]),t[1]>n[3]&&(n[3]=t[1])}function bo(n,t,e,i,r){for(;e<i;e+=r)Pd(n,t[e],t[e+1]);return n}function Pd(n,t,e){n[0]=Math.min(n[0],t),n[1]=Math.min(n[1],e),n[2]=Math.max(n[2],t),n[3]=Math.max(n[3],e)}function Hr(n,t){let e;return e=t(an(n)),e||(e=t(ln(n)),e)||(e=t(hn(n)),e)||(e=t(ne(n)),e)?e:!1}function $n(n){let t=0;return Me(n)||(t=B(n)*at(n)),t}function an(n){return[n[0],n[1]]}function ln(n){return[n[2],n[1]]}function ie(n){return[(n[0]+n[2])/2,(n[1]+n[3])/2]}function Jh(n,t){let e;if(t==="bottom-left")e=an(n);else if(t==="bottom-right")e=ln(n);else if(t==="top-left")e=ne(n);else if(t==="top-right")e=hn(n);else throw new Error("Invalid corner");return e}function Jn(n,t,e,i,r){let[s,o,a,l,c,h,u,f]=Do(n,t,e,i);return jt(Math.min(s,a,c,u),Math.min(o,l,h,f),Math.max(s,a,c,u),Math.max(o,l,h,f),r)}function Do(n,t,e,i){let r=t*i[0]/2,s=t*i[1]/2,o=Math.cos(e),a=Math.sin(e),l=r*o,c=r*a,h=s*o,u=s*a,f=n[0],d=n[1];
1return[f-l+u,d-c-h,f-l-u,d-c+h,f+l-u,d+c+h,f+l+u,d+c-h,f-l+u,d-c-h]}function at(n){return n[3]-n[1]}function Ae(n,t,e){let i=e||mt();return st(n,t)?(n[0]>t[0]?i[0]=n[0]:i[0]=t[0],n[1]>t[1]?i[1]=n[1]:i[1]=t[1],n[2]<t[2]?i[2]=n[2]:i[2]=t[2],n[3]<t[3]?i[3]=n[3]:i[3]=t[3]):bi(i),i}function Fo(n,t){if(!st(n,t))return[n.slice()];if(Le(t,n))return[];let[e,i,r,s]=n,o=Math.max(e,t[0]),a=Math.max(i,t[1]),l=Math.min(r,t[2]),c=Math.min(s,t[3]),h=[];return o>e&&h.push([e,i,o,s]),l<r&&h.push([l,i,r,s]),a>i&&h.push([o,i,l,a]),c<s&&h.push([o,c,l,s]),h}function ne(n){return[n[0],n[3]]}function hn(n){return[n[2],n[3]]}function B(n){return n[2]-n[0]}function st(n,t){return n[0]<=t[2]&&n[2]>=t[0]&&n[1]<=t[3]&&n[3]>=t[1]}function Me(n){return n[2]<n[0]||n[3]<n[1]}function Qh(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n}function tc(n,t,e){let i=!1,r=Kr(n,t),s=Kr(n,e);if(r===yt.INTERSECTING||s===yt.INTERSECTING)i=!0;else{let o=n[0],a=n[1],l=n[2],c=n[3],h=t[0],u=t[1],f=e[0],d=e[1],g=(d-u)/(f-h),p,m;s&yt.ABOVE&&!(r&yt.ABOVE)&&(p=f-(d-c)/g,i=p>=o&&p<=l),!i&&s&yt.RIGHT&&!(r&yt.RIGHT)&&(m=d-(f-l)*g,i=m>
1=a&&m<=c),!i&&s&yt.BELOW&&!(r&yt.BELOW)&&(p=f-(d-a)/g,i=p>=o&&p<=l),!i&&s&yt.LEFT&&!(r&yt.LEFT)&&(m=d-(f-o)*g,i=m>=a&&m<=c)}return i}function qr(n,t,e,i){if(Me(n))return bi(e);let r=[];if(i>1){let a=n[2]-n[0],l=n[3]-n[1];for(let c=0;c<i;++c)r.push(n[0]+a*c/i,n[1],n[2],n[1]+l*c/i,n[2]-a*c/i,n[3],n[0],n[3]-l*c/i)}else r=[n[0],n[1],n[2],n[1],n[2],n[3],n[0],n[3]];t(r,r,2);let s=[],o=[];for(let a=0,l=r.length;a<l;a+=2)s.push(r[a]),o.push(r[a+1]);return Md(s,o,e)}function ko(n,t){let e=t.getExtent(),i=ie(n);if(t.canWrapX()&&(i[0]<e[0]||i[0]>=e[2])){let r=B(e),o=Math.floor((i[0]-e[0])/r)*r;n[0]-=o,n[2]-=o}return n}function $r(n,t,e){if(t.canWrapX()){let i=t.getExtent();if(!isFinite(n[0])||!isFinite(n[2]))return[[i[0],n[1],i[2],n[3]]];ko(n,t);let r=B(i);if(B(n)>r&&!e)return[[i[0],n[1],i[2],n[3]]];if(n[0]<i[0])return[[n[0]+r,n[1],i[2],n[3]],[i[0],n[1],n[2],n[3]]];if(n[2]>i[2])return[[n[0],n[1],i[2],n[3]],[i[0],n[1],n[2]-r,n[3]]]}return[n]}function ec(n,t){let e=[n];for(let i=0,r=t.length;i<r&&e.length>0;++i){let s=[];for(let o=0,a=e.length;o<a;++o)s.push(...Fo(e[o],t[i]));e=s}return e}function ic(n,t){return n[0]+=+t[0],n[1]+=+t[1],n}function ki(n,t){let e=!0;for(let i=n.length-1;i>=0;--i)if(n[i]!=t[i]){e=!1;break}return e}function cn(n,t){let e=Math.cos(t),i=Math.sin(t),r=n[0]*e-n[1]*i,s=n[1]*e+n[0]*i;return n[0]=r,n[1]=s,n}function nc(n,t){return n[0]*=t,n[1]*=t,n}function Jr(n,t){if(t.canWrapX()){let e=B(t.getExtent()),i=rc(n,t,e);i&&(n[0]-=i*e)}return n}function rc(n,t,e){let i=t.getExtent(),r=0;return t.canWrapX()&&(n[0]<i[0]||n[0]>i[2])&&(e=e||B(i),r=Math.floor((n[0]-i[0])/e)),r}function sc(n,t,e){let i=Math.sqrt((t[0]-n[0])*(t[0]-n[0])+(t[1]-n[1])*(t[1]-n[1])),r=[(t[0]-n[0])/i,(t[1]-n[1])/i],s=[-r[1],r[0]],o=Math.sqrt((e[0]-n[0])*(e[0]-n[0])+(e[1]-n[1])*(e[1]-n[1])),a=[(e[0]-n[0])/o,(e[1]-n[1])/o],l=i===0||o===0?0:Math.acos(J(a[0]*r[0]+a[1]*r[1],-1,1));return l=Math.max(l,1e-5),a[0]*s[0]+a[1]*s[1]>0?l:Math.PI*2-l}function No(n){return Math.pow(n,3)}function re(n){return 1-No(1-n)}function oc(n){return 3*n*n-2*n*n*n}function ac(n){return n}var Od=63710088e-1;function Go(n,t,e){e=e||Od;let i=ue(n[1]),r=ue(t[1]),s=(r-i)/2,o=ue(t[0]-n[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(r);return 2*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}var lc={info:1,warn:2,error:3,none:4},bd=lc.info;function Qr(...n){bd>lc.warn||console.warn(...n)}var Be={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var Xo=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=t.extent!==void 0?t.extent:null,this.worldExtent_=t.worldExtent!==void 0?t.worldExtent:null,this.axisOrientation_=t.axisOrientation!==void 0?t.axisOrientation:"enu",this.global_=t.global!==void 0?t.global:!1,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_||Be[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_}},un=Xo;var Qn=6378137,fn=Math.PI*Qn,Dd=[-fn,-fn,fn,fn],Fd=[-180,-85,180,85],ts=Qn*Math.log(Math.tan(Math.PI/2)),ci=class extends un{constructor(t){super({code:t,units:"m",extent:Dd,global:!0,worldExtent:Fd,getPointResolution:function(e,i){return e/Math.cosh(i[1]/Qn)}})}},zo=[new ci("EPSG:3857"),new ci("EPSG:102100"),new ci("EPSG:102113"),new ci("EPSG:900913"),new ci("http://www.opengis.net/def/crs/EPSG/0/3857"),new ci("http://www.opengis.net/gml/srs/epsg.xml#3857")];function hc(n,t,e,i){let r=n.length;e=e>
11?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(r));for(let s=0;s<r;s+=i){t[s]=fn*n[s]/180;let o=Qn*Math.log(Math.tan(Math.PI*(+n[s+1]+90)/360));o>ts?o=ts:o<-ts&&(o=-ts),t[s+1]=o}return t}function cc(n,t,e,i){let r=n.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(r));for(let s=0;s<r;s+=i)t[s]=180*n[s]/fn,t[s+1]=360*Math.atan(Math.exp(n[s+1]/Qn))/Math.PI-90;return t}var kd=6378137,uc=[-180,-90,180,90],Nd=Math.PI*kd/180,je=class extends un{constructor(t,e){super({code:t,units:"degrees",extent:uc,axisOrientation:e,global:!0,metersPerUnit:Nd,worldExtent:uc})}},Wo=[new je("CRS:84"),new je("EPSG:4326","neu"),new je("urn:ogc:def:crs:OGC:1.3:CRS84"),new je("urn:ogc:def:crs:OGC:2:84"),new je("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new je("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new je("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var Uo={};function fc(n){return Uo[n]||Uo[n.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function dc(n,t){Uo[n]=t}var dn={};function gn(n,t,e){let i=n.getCode(),r=t.getCode();i in dn||(dn[i]={}),dn[i][r]=e}function es(n,t){return n in dn&&t in dn[n]?dn[n][t]:null}var is=.9996,se=.00669438,rs=se*se,ss=rs*se,Ni=se/(1-se),gc=Math.sqrt(1-se),mn=(1-gc)/(1+gc),yc=mn*mn,Yo=yc*mn,Ko=Yo*mn,xc=Ko*mn,Ec=1-se/4-3*rs/64-5*ss/256,Gd=3*se/8+3*rs/32+45*ss/1024,Xd=15*rs/256+45*ss/1024,zd=35*ss/3072,Wd=3/2*mn-27/32*Yo+269/512*xc,Ud=21/16*yc-55/32*Ko,Yd=151/96*Yo-417/128*xc,Kd=1097/512*Ko,ns=6378137;function Bd(n,t,e){let i=n-5e5,o=(e.north?t:t-1e7)/is/(ns*Ec),a=o+Wd*
1Math.sin(2*o)+Ud*Math.sin(4*o)+Yd*Math.sin(6*o)+Kd*Math.sin(8*o),l=Math.sin(a),c=l*l,h=Math.cos(a),u=l/h,f=u*u,d=f*f,g=1-se*c,p=Math.sqrt(1-se*c),m=ns/p,_=(1-se)/g,x=Ni*h**2,C=x*x,y=i/(m*is),E=y*y,R=E*y,L=R*y,w=L*y,T=w*y,I=a-u/_*(E/2-L/24*(5+3*f+10*x-4*C-9*Ni))+T/720*(61+90*f+298*x+45*d-252*Ni-3*C),k=(y-R/6*(1+2*f+x)+w/120*(5-2*x+28*f-3*C+8*Ni+24*d))/h;return k=Yr(k+ue(Cc(e.number)),-Math.PI,Math.PI),[Ur(k),Ur(I)]}var mc=-80,pc=84,jd=-180,Vd=180;function Zd(n,t,e){n=Yr(n,jd,Vd),t<mc?t=mc:t>pc&&(t=pc);let i=ue(t),r=Math.sin(i),s=Math.cos(i),o=r/s,a=o*o,l=a*a,c=ue(n),h=Cc(e.number),u=ue(h),f=ns/Math.sqrt(1-se*r**2),d=Ni*s**2,g=s*Yr(c-u,-Math.PI,Math.PI),p=g*g,m=p*g,_=m*g,x=_*g,C=x*g,y=ns*(Ec*i-Gd*Math.sin(2*i)+Xd*Math.sin(4*i)-zd*Math.sin(6*i)),E=is*f*(g+m/6*(1-a+d)+x/120*(5-18*a+l+72*d-58*Ni))+5e5,R=is*(y+f*o*(p/2+_/24*(5-a+9*d+4*d**2)+C/720*(61-58*a+l+600*d-330*Ni)));return e.north||(R+=1e7),[E,R]}function Cc(n){return(n-1)*6-180+3}var Hd=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function Sc(n){let t=0;for(let r of Hd){let s=n.match(r);if(s){t=parseInt(s[1]);break}}if(!t)return null;let e=0,i=!1;return t>32700&&t<32761?e=t-32700:t>32600&&t<32661&&(i=!0,e=t-32600),e?{number:e,north:i}:null}function _c(n,t){return function(e,i,r,s){let o=e.length;r=r>1?r:2,s=s??r,i||(r>2?i=e.slice():i=new Array(o));for(let a=0;a<o;a+=s){let l=e[a],c=e[a+1],h=n(l,c,t);i[a]=h[0],i[a+1]=h[1]}return i}}function wc(n){return Sc(n)?new un({code:n,units:"m"}):null}function Rc(n){let t=Sc(n.getCode());return t?{forward:_c(Zd,t),inverse:_c(Bd,t)}:null}var qd=[Rc],$d=[wc];var jo=!0;function Zo(n){jo=!(n===void 0?!0:n)}function Ho(n,t){if(t!==void 0){for(let e=0,i=n.length;e<i;++e)t[e]=n[e];t=t}else t=n.slice();return t}function Vo(n){dc(n.getCode(),n),gn(n,n,Ho)}function Jd(n){n.forEach(Vo)}function ht(n){if(typeof n!="string")return n;let t=fc(n);if(t)return t;for(let e of $d){let i=e(n);if(i)return i}return null}function qo(n,t,e,i){n=ht(n);let r,s=n.getPointResolutionFunc();if(s){if(r=s(t,e),i&&i!==n.getUnits()){let o=n.getMetersPerUnit();o&&(r=r*o/Be[i])}}else{let o=n.getUnits();if(o=="degrees"&&!i||i=="degrees")r=t;else{let a=Ve(n,ht("EPSG:4326"));if(!a&&o!=="degrees")r=t*n.getMetersPerUnit();else{let c=[e[0]-t/2,e[1],e[0]+t/2,e[1],e[0],e[1]-t/2,e[0],e[1]+t/2];c=a(c,c,2);let h=Go(c.slice(0,2),c.slice(2,4)),u=Go(c.slice(4,6),c.slice(6,8));r=(h+u)/2}let l=i?Be[i]:n.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}
1function Tc(n){Jd(n),n.forEach(function(t){n.forEach(function(e){t!==e&&gn(t,e,Ho)})})}function Qd(n,t,e,i){n.forEach(function(r){t.forEach(function(s){gn(r,s,e),gn(s,r,i)})})}function os(n,t){return n?typeof n=="string"?ht(n):n:ht(t)}function Ic(n){return(function(t,e,i,r){let s=t.length;i=i!==void 0?i:2,r=r??i,e=e!==void 0?e:new Array(s);for(let o=0;o<s;o+=r){let a=n(t.slice(o,o+i)),l=a.length;for(let c=0,h=r;c<h;++c)e[o+c]=c>=l?t[o+c]:a[c]}return e})}function as(n,t){return Zo(),Ze(n,"EPSG:4326",t!==void 0?t:"EPSG:3857")}function pn(n,t){if(n===t)return!0;let e=n.getUnits()===t.getUnits();return(n.getCode()===t.getCode()||Ve(n,t)===Ho)&&e}function Ve(n,t){let e=n.getCode(),i=t.getCode(),r=es(e,i);if(r)return r;let s=null,o=null;for(let l of qd)s||(s=l(n)),o||(o=l(t));if(!s&&!o)return null;let a="EPSG:4326";if(o)if(s)r=Bo(s.inverse,o.forward);else{let l=es(e,a);l&&(r=Bo(l,o.forward))}else{let l=es(a,i);l&&(r=Bo(s.inverse,l))}return r&&(Vo(n),Vo(t),gn(n,t,r)),r}function Bo(n,t){return function(e,i,r,s){return i=n(e,i,r,s),t(i,i,r,s)}}function Gi(n,t){let e=ht(n),i=ht(t);return Ve(e,i)}function Ze(n,t,e){let i=Gi(t,e);if(!i){let r=ht(t).getCode(),s=ht(e).getCode();throw new Error(`No transform available between ${r} and ${s}`)}return i(n,void 0,n.length)}function ui(n,t,e,i){let r=Gi(t,e);return qr(n,r,void 0,i)}var de=null;function Xi(){return de}function tr(n,t){return de?Ze(n,t,de):n}function ge(n,t){return de?Ze(n,de,t):(jo&&!ki(n,[0,0])&&n[0]>=-180&&n[0]<=180&&n[1]>=-90&&n[1]<=90&&(jo=!1,Qr("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),n)}function fi(n,t){return de?ui(n,t,de):n}function me(n,t){return de?ui(n,de,t):n}function vc(n,t){if(!de)return n;let e=ht(t).getMetersPerUnit(),i=de.getMetersPerUnit();return e&&i?n*e/i:n}function tg(){Tc(zo),Tc(Wo),Qd(Wo,zo,hc,cc)}tg();var eg=[1,0,0,1,0,0],sy=new Array(6);function It(){return eg.slice(0)}function Lc(n,t){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n}function ct(n,t){let e=t[0],i=t[1];return t[0]=n[0]*e+n[2]*i+n[4],t[1]=n[1]*e+n[3]*i+n[5],t}function Lt(n,t,e,i,r,s,o,a){let l=Math.sin(s),c=Math.cos(s);return n[0]=i*c,n[1]=r*l,n[2]=-i*l,n[3]=r*c,n[4]=o*i*c-a*i*l+t,n[5]=o*r*l+a*r*c+e,n}function hs(n,t){let e=ig(t);Y(e!==0,"Transformation matrix cannot be inverted");let i=t[0],r=t[1],s=t[2],o=t[3],a=t[4],l=t[5];return n[0]=o/e,n[1]=-r/e,n[2]=-s/e,n[3]=i/e,n[4]=(s*l-o*a)/e,n[5]=-(i*l-r*a)/e,n}function ig(n){return n[0]*n[3]-n[1]*n[2]}var ng=[1e5,1e5,1e5,1e5,2,2];function Ac(n){return"matrix("+n.join(", ")+")"}function ls(n){return n.substring(7,n.length-1).split(",").map(parseFloat)}function Mc(n,t){let e=ls(n),i=ls(t);for(let r=0;r<6;++r)if(Math.round((e[r]-i[r])*ng[r])!==0)return!1;return!0}function Wt(n,t,e,i,r,s,o){s=s||[],o=o||2;let a=0;for(let l=t;l<e;l+=i){let c=n[l],h=n[l+1];s[a++]=r[0]*c+r[2]*h+r[4],s[a++]=r[1]*c+r[3]*h+r[5];for(let u=2;u<o;u++)s[a++]=n[l+u]}return s&&s.length!=a&&(s.length=a),s}function cs(n,t,e,i,r,s,o){o=o||[];let a=Math.cos(r),l=Math.sin(r),c=s[0],h=s[1],u=0;for(let f=t;f<e;f+=i){let d=n[f]-c,g=n[f+1]-h;o[u++]=c+d*a-g*l,o[u++]=h+d*l+g*a;for(let p=f+2;p<f+i;++p)o[u++]=n[p]}return o&&o.length!=u&&(o.length=u),o}function Pc(n,t,e,i,r,s,o,a){a=a||[];let l=o[0],c=o[1],h=0;for(let u=t;u<e;u+=i){let f=n[u]-l,d=n[u+1]-c;a[h++]=l+r*f,a[h++]=c+s*d;for(let g=u+2;g<u+i;++g)a[h++]=n[g]}return a&&a.length!=h&&(a.length=h),a}function Oc(n,t,e,i,r,s,o){o=o||[];let a=0;for(let l=t;l<e;l+=i){o[a++]=n[l]+r,o[a++]=n[l+1]+s;for(let c=l+2;c<l+i;++c)o[a++]=n[c]}return o&&o.length!=a&&(o.length=a),o}var bc=It(),rg=[NaN,NaN],$o=class extends _t{constructor(){super(),this.extent_=mt(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Gr((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);let r=this.clone();return r.applyTransform(i),r.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return j()}closestPointXY(t,e,i,r){return j()}containsXY(t,e){return this.closestPointXY(t,e,rg,Number.MIN_VALUE)===0}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 j()}getExtent(t){if(this.extentRevision_!=this.getRevision()){let e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&bi(e),this.extentRevision_=this.getRevision()}return Qh(this.extent_,t)}rotate(t,e){j()}scale(t,e,i){j()}
1simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return j()}getType(){return j()}applyTransform(t){j()}intersectsExtent(t){return j()}translate(t,e){j()}transform(t,e){let i=ht(t),r=i.getUnits()=="tile-pixels"?function(s,o,a){let l=i.getExtent(),c=i.getWorldExtent(),h=at(c)/at(l);Lt(bc,c[0],c[3],h,-h,0,0,0);let u=Wt(s,0,s.length,a,bc,o),f=Gi(i,e);return f?f(u,u,a):u}:Gi(i,e);return this.applyTransform(r),this}},Dc=$o;var Jo=class extends Dc{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return on(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return j()}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||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=Fc(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){j()}setLayout(t,e,i){let r;if(t)r=Fc(t);else{for(let s=0;s<i;++s){if(e.length===0){this.layout="XY",this.stride=2;return}e=e[0]}r=e.length,t=sg(r)}this.layout=t,this.stride=r}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){let i=this.getFlatCoordinates();if(i){let r=this.getStride();cs(i,0,i.length,r,t,e,i),this.changed()}}scale(t,e,i){e===void 0&&(e=t),i||(i=ie(this.getExtent()));let r=this.getFlatCoordinates();if(r){let s=this.getStride();Pc(r,0,r.length,s,t,e,i,r),this.changed()}}translate(t,e){let i=this.getFlatCoordinates();if(i){let r=this.getStride();Oc(i,0,i.length,r,t,e,i),this.changed()}}};function sg(n){let t;return n==2?t="XY":n==3?t="XYZ":n==4&&(t="XYZM"),t}function Fc(n){let t;return n=="XY"?t=2:n=="XYZ"||n=="XYM"?t=3:n=="XYZM"&&(t=4),t}function kc(n,t,e){let i=n.getFlatCoordinates();if(!i)return null;let r=n.getStride();return Wt(i,0,i.length,r,t,e)}var _n=Jo;function Qo(n,t,e,i){let r=0,s=n[e-i],o=n[e-i+1],a=0,l=0;for(;t<e;t+=i){let c=n[t]-s,h=n[t+1]-o;r+=l*c-a*h,a=c,l=h}return r/2}function Nc(n,t,e,i){let r=0;for(let s=0,o=e.length;s<o;++s){let a=e[s];r+=Qo(n,t,a,i),t=a}return r}function Gc(n,t,e,i,r,s,o){let a=n[t],l=n[t+1],c=n[e]-a,h=n[e+1]-l,u;if(c===0&&h===0)u=t;else{let f=((r-a)*c+(s-l)*h)/(c*c+h*h);if(f>1)u=e;else if(f>0){for(let d=0;d<i;++d)o[d]=Ot(n[t+d],n[e+d],f);o.length=i;return}else u=t}for(let f=0;f<i;++f)o[f]=n[u+f];o.length=i}function ta(n,t,e,i,r){let s=n[t],o=n[t+1];for(t+=i;t<e;t+=i){let a=n[t],l=n[t+1],c=Ke(s,o,a,l);c>r&&(r=c),s=a,o=l}return r}function Xc(n,t,e,i,r){for(let s=0,o=e.length;s<o;++s){let a=e[s];r=ta(n,t,a,i,r),t=a}return r}function ea(n,t,e,i,r,s,o,a,l,c,h){if(t==e)return c;let u,f;if(r===0){if(f=Ke(o,a,n[t],n[t+1]),f<c){for(u=0;u<i;++u)l[u]=n[t+u];return l.length=i,f}return c}h=h||[NaN,NaN];let d=t+i;for(;d<e;)if(Gc(n,d-i,d,i,o,a,h),f=Ke(o,a,h[0],h[1]),f<c){for(c=f,u=0;u<i;++u)l[u]=h[u];l.length=i,d+=i}else d+=i*Math.max((Math.sqrt(f)-Math.sqrt(c))/r|0,1);if(s&&(Gc(n,e-i,t,i,o,a,h),f=Ke(o,a,h[0],h[1]),f<c)){for(c=f,u=0;u<i;++u)l[u]=h[u];l.length=i}return c}function zc(n,t,e,i,r,s,o,a,l,c,h){h=h||[NaN,NaN];for(let u=0,f=e.length;u<f;++u){let d=e[u];c=ea(n,t,d,i,r,s,o,a,l,c,h),t=d}return c}function Wc(n,t,e,i){for(let r=0,s=e.length;r<s;++r)n[t++]=e[r];return t}function ia(n,t,e,i){for(let r=0,s=e.length;r<s;++r){let o=e[r];for(let a=0;a<i;++a)n[t++]=o[a]}return t}function Uc(n,t,e,i,r){r=r||[];let s=0;for(let o=0,a=e.length;o<a;++o){let l=ia(n,t,e[o],i);r[s++]=l,t=l}return r.length=s,r}function di(n,t,e,i,r){r=r!==void 0?r:[];let s=0;for(let o=t;o<e;o+=i)r[s++]=n.slice(o,o+i);return r.length=s,r}function yn(n,t,e,i,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=e.length;o<a;++o){let l=e[o];r[s++]=di(n,t,l,i,r[s]),t=l}return r.length=s,r}function na(n,t,e,i,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=e.length;o<a;++o){let l=e[o];r[s++]=l.length===1&&l[0]===t?[]:yn(n,t,l,i,r[s]),t=l[l.length-1]}return r.length=s,r}function Yc(n,t,e,i,r){return!Hr(r,function(o){return!gi(n,t,e,i,o[0],o[1])})}function gi(n,t,e,i,r,s){let o=0,a=n[e-i],l=n[e-i+1];for(;t<e;t+=i){let c=n[t],h=n[t+1];l<=s?h>s&&(c-a)*(s-l)-(r-a)*(h-l)>0&&o++:h<=s&&(c-a)*(s-l)-(r-a)*(h-l)<0&&o--,a=c,l=h}return o!==0}function us(n,t,e,i,r,s){if(e.length===0||!gi(n,t,e[0],i,r,s))return!1;for(let o=1,a=e.length;o<a;++o)if(gi(n,e[o-1],e[o],i,r,s))return!1;return!0}function Kc(n,t,e,i,r){let s;for(t+=i;t<e;t+=i)if(s=r(n.slice(t-i,t),n.slice(t,t+i)),s)return s;return!1}function fs(n,t,e,i,r,s){return s=s??bo(mt(),n,t,e,i),st(r,s)?s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:Kc(n,t,e,i,function(o,a){return tc(r,o,a)}):!1}function ra(n,t,e,i,r){return!!(fs(n,t,e,i,r)||gi(n,t,e,i,r[0],r[1])||gi(n,t,e,i,r[0],r[3])||gi(n,t,e,i,r[2],r[1])||gi(n,t,e,i,r[2],r[3]))}function Bc(n,t,e,i,r){if(!ra(n,t,e[0],i,r))return!1;if(e.length===1)return!0;for(let s=1,o=e.length;s<o;++s)if(Yc(n,e[s-1],e[s],i,r)&&!fs(n,e[s-1],e[s],i,r))return!1;return!0}function er(n,t,e,i,r,s,o){let a=(e-t)/i;if(a<3){for(;t<e;t+=i)s[o++]=n[t],s[o++]=n[t+1];return o}let l=new Array(a);l[0]=1,l[a-1]=1;let c=[t,e-i],h=0;for(;c.length>0;){let u=c.pop(),f=c.pop(),d=0,g=n[f],p=n[f+1],m=n[u],_=n[u+1];for(let x=f+i;x<u;x+=i){let C=n[x],y=n[x+1],E=Hh(C,y,g,p,m,_);
1E>d&&(h=x,d=E)}d>r&&(l[(h-t)/i]=1,f+i<h&&c.push(f,h),h+i<u&&c.push(h,u))}for(let u=0;u<a;++u)l[u]&&(s[o++]=n[t+u*i],s[o++]=n[t+u*i+1]);return o}function jc(n,t,e,i,r,s,o,a){for(let l=0,c=e.length;l<c;++l){let h=e[l];o=er(n,t,h,i,r,s,o),a.push(o),t=h}return o}function mi(n,t){return t*Math.round(n/t)}function og(n,t,e,i,r,s,o){if(t==e)return o;let a=mi(n[t],r),l=mi(n[t+1],r);t+=i,s[o++]=a,s[o++]=l;let c,h;do if(c=mi(n[t],r),h=mi(n[t+1],r),t+=i,t==e)return s[o++]=c,s[o++]=h,o;while(c==a&&h==l);for(;t<e;){let u=mi(n[t],r),f=mi(n[t+1],r);if(t+=i,u==c&&f==h)continue;let d=c-a,g=h-l,p=u-a,m=f-l;if(d*m==g*p&&(d<0&&p<d||d==p||d>0&&p>d)&&(g<0&&m<g||g==m||g>0&&m>g)){c=u,h=f;continue}s[o++]=c,s[o++]=h,a=c,l=h,c=u,h=f}return s[o++]=c,s[o++]=h,o}function ds(n,t,e,i,r,s,o,a){for(let l=0,c=e.length;l<c;++l){let h=e[l];o=og(n,t,h,i,r,s,o),a.push(o),t=h}return o}var sa=class n extends _n{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,e!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}clone(){return new n(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,r){return r<jr(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ta(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ea(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,r))}getArea(){return Qo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return di(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){let e=[];return e.length=er(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new n(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return fs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ia(this.flatCoordinates,0,t,this.stride),this.changed()}},oa=sa;var aa=class n extends _n{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){let t=new n(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,r){let s=this.flatCoordinates,o=Ke(t,e,s[0],s[1]);if(o<r){let a=this.stride;for(let l=0;l<a;++l)i[l]=s[l];return i.length=a,o}return r}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return Vr(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Oo(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Wc(this.flatCoordinates,0,t,this.stride),this.changed()}},ir=aa;function nr(n,t,e,i,r,s,o){let a,l,c,h,u,f,d,g=r[s+1],p=[];for(let x=0,C=e.length;x<C;++x){let y=e[x];for(h=n[y-i],f=n[y-i+1],a=t;a<y;a+=i)u=n[a],d=n[a+1],(g<=f&&d<=g||f<=g&&g<=d)&&(c=(g-f)/(d-f)*(u-h)+h,p.push(c)),h=u,f=d}let m=NaN,_=-1/0;for(p.sort(zt),h=p[0],a=1,l=p.length;a<l;++a){u=p[a];let x=Math.abs(u-h);x>_&&(c=(h+u)/2,us(n,t,e,i,c,g)&&(m=c,_=x)),h=u}return isNaN(m)&&(m=r[s]),o?(o.push(m,g,_),o):[m,g,_]}function Vc(n,t,e,i,r){let s=[];for(let o=0,a=e.length;o<a;++o){let l=e[o];s=nr(n,t,l,i,r,2*o,s),t=l[l.length-1]}return s}function Zc(n,t,e,i){for(;t<e-i;){for(let r=0;r<i;++r){let s=n[t+r];n[t+r]=n[e-i+r],n[e-i+r]=s}t+=i,e-=i}}function la(n,t,e,i){let r=0,s=n[e-i],o=n[e-i+1];for(;t<e;t+=i){let a=n[t],l=n[t+1];r+=(a-s)*(l+o),s=a,o=l}return r===0?void 0:r>0}function Hc(n,t,e,i,r){r=r!==void 0?r:!1;for(let s=0,o=e.length;s<o;++s){let a=e[s],l=la(n,t,a,i);if(s===0){if(r&&l||!r&&!l)return!1}else if(r&&!l||!r&&l)return!1;t=a}return!0}function ha(n,t,e,i,r){r=r!==void 0?r:!1;for(let s=0,o=e.length;s<o;++s){let a=e[s],l=la(n,t,a,i);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&Zc(n,t,a,i),t=a}return t}function qc(n,t){let e=[],i=0,r=0,s;for(let o=0,a=t.length;o<a;++o){let l=t[o],c=la(n,i,l,2);if(s===void 0&&(s=c),c===s)e.push(t.slice(r,o+1));else{if(e.length===0)continue;e[e.length-1].push(t[r])}r=o+1,i=l}return e}var gs=class n extends _n{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,e!==void 0&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?Ue(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let t=new n(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,r){return r<jr(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Xc(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),zc(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,r))}containsXY(t,e){return us(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Nc(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),ha(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,yn(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let t=ie(this.getExtent());this.flatInteriorPoint_=nr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new ir(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new oa(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){let t=this.layout,e=this.flatCoordinates,i=this.ends_,r=[],s=0;for(let o=0,a=i.length;o<a;++o){let l=i[o],c=new oa(e.slice(s,l),t);r.push(c),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let t=this.flatCoordinates;Hc(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=ha(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){let e=[],i=[];return e.length=ds(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new n(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return Bc(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);let i=Uc(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}},$c=gs;function ca(n){if(Me(n))throw new Error("Cannot create polygon from empty extent");let t=n[0],e=n[1],i=n[2],r=n[3],s=[t,e,t,r,i,r,i,e,t,e];return new gs(s,"XY",[s.length])}function ua(n,t,e,i){let r=B(t)/e[0],s=at(t)/e[1];return i?Math.min(n,Math.max(r,s)):Math.min(n,Math.min(r,s))}function fa(n,t,e){let i=Math.min(n,t),r=50;return i*=Math.log(1+r*Math.max(0,n/t-1))/r+1,e&&(i=Math.max(i,e),i/=Math.log(1+r*Math.max(0,e/n-1))/r+1),J(i,e/2,t*2)}
1function Jc(n,t,e,i){return t=t!==void 0?t:!0,(function(r,s,o,a){if(r!==void 0){let l=n[0],c=n[n.length-1],h=e?ua(l,e,o,i):l;if(a)return t?fa(r,h,c):J(r,c,h);let u=Math.min(h,r),f=Math.floor(en(n,u,s));return n[f]>h&&f<n.length-1?n[f+1]:n[f]}})}function Qc(n,t,e,i,r,s){return i=i!==void 0?i:!0,e=e!==void 0?e:0,(function(o,a,l,c){if(o!==void 0){let h=r?ua(t,r,l,s):t;if(c)return i?fa(o,h,e):J(o,e,h);let u=1e-9,f=Math.ceil(Math.log(t/h)/Math.log(n)-u),d=-a*(.5-u)+.5,g=Math.min(h,o),p=Math.floor(Math.log(t/g)/Math.log(n)+d),m=Math.max(f,p),_=t/Math.pow(n,m);return J(_,e,h)}})}function da(n,t,e,i,r){return e=e!==void 0?e:!0,(function(s,o,a,l){if(s!==void 0){let c=i?ua(n,i,a,r):n;return!e||!l?J(s,t,c):fa(s,c,t)}})}function xn(n){if(n!==void 0)return 0}function ga(n){if(n!==void 0)return n}function tu(n){let t=2*Math.PI/n;return(function(e,i){if(i)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e})}function eu(n){let t=n===void 0?ue(5):n;return(function(e,i){return i||e===void 0?e:Math.abs(e)<=t?0:e})}var ma=0,_a=class extends _t{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=os(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&&Zo(),t.center&&(t.center=ge(t.center,this.projection_)),t.extent&&(t.extent=me(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){let e=Object.assign({},t);for(let a in ee)delete e[a];this.setProperties(e,!0);let i=lg(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;let r=ag(t),s=i.constraint,o=hg(t);this.constraints_={center:r,resolution:s,rotation:o},this.setRotation(t.rotation!==void 0?t.rotation:0),this.setCenterInternal(t.center!==void 0?t.center:null),t.resolution!==void 0?this.setResolution(t.resolution):t.zoom!==void 0&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;let i=this.getCenterInternal();if(i){let r=t||[0,0,0,0];e=e||[0,0,0,0];let s=this.getResolution(),o=s/2*(r[3]-e[3]+e[1]-r[1]),a=s/2*(r[0]-e[0]+e[2]-r[2]);this.setCenterInternal([i[0]+o,i[1]-a])}}getUpdatedOptions_(t){let e=this.getProperties();return e.resolution!==void 0?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);let e=new Array(arguments.length);for(let i=0;i<e.length;++i){let r=arguments[i];r.center&&(r=Object.assign({},r),r.center=ge(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=ge(r.anchor,this.getProjection())),e[i]=r}this.animateInternal.apply(this,e)}animateInternal(t){let e=arguments.length,i;e>1&&typeof arguments[e-1]=="function"&&(i=arguments[e-1],--e);let r=0;for(;r<e&&!this.isDef();++r){let h=arguments[r];h.center&&this.setCenterInternal(h.center),h.zoom!==void 0?this.setZoom(h.zoom):h.resolution&&this.setResolution(h.resolution),h.rotation!==void 0&&this.setRotation(h.rotation)}if(r===e){i&&ms(i,!0);return}let s=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_,c=[];for(;r<e;++r){let h=arguments[r],u={start:s,complete:!1,anchor:h.anchor,duration:h.duration!==void 0?h.duration:1e3,easing:h.easing||oc,callback:i};if(h.center&&(u.sourceCenter=o,u.targetCenter=h.center.slice(),o=u.targetCenter),h.zoom!==void 0?(u.sourceResolution=a,u.targetResolution=this.getResolutionForZoom(h.zoom),a=u.targetResolution):h.resolution&&(u.sourceResolution=a,u.targetResolution=h.resolution,a=u.targetResolution),h.rotation!==void 0){u.sourceRotation=l;let f=ve(h.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+f,l=u.targetRotation}cg(u)?u.complete=!0:s+=u.duration,c.push(u)}
1this.animations_.push(c),this.setHint(Rt.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Rt.ANIMATING]>0}getInteracting(){return this.hints_[Rt.INTERACTING]>0}cancelAnimations(){this.setHint(Rt.ANIMATING,-this.hints_[Rt.ANIMATING]);let t;for(let e=0,i=this.animations_.length;e<i;++e){let r=this.animations_[e];if(r[0].callback&&ms(r[0].callback,!1),!t)for(let s=0,o=r.length;s<o;++s){let a=r[s];if(!a.complete){t=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;let t=Date.now(),e=!1;for(let i=this.animations_.length-1;i>=0;--i){let r=this.animations_[i],s=!0;for(let o=0,a=r.length;o<a;++o){let l=r[o];if(l.complete)continue;let c=t-l.start,h=l.duration>0?c/l.duration:1;h>=1?(l.complete=!0,h=1):s=!1;let u=l.easing(h);if(l.sourceCenter){let f=l.sourceCenter[0],d=l.sourceCenter[1],g=l.targetCenter[0],p=l.targetCenter[1];this.nextCenter_=l.targetCenter;let m=f+u*(g-f),_=d+u*(p-d);this.targetCenter_=[m,_]}if(l.sourceResolution&&l.targetResolution){let f=u===1?l.targetResolution:l.sourceResolution+u*(l.targetResolution-l.sourceResolution);if(l.anchor){let d=this.getViewportSize_(this.getRotation()),g=this.constraints_.resolution(f,0,d,!0);this.targetCenter_=this.calculateCenterZoom(g,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=f,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){let f=u===1?ve(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+u*(l.targetRotation-l.sourceRotation);if(l.anchor){let d=this.constraints_.rotation(f,!0);this.targetCenter_=this.calculateCenterRotate(d,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=f}if(this.applyTargetState_(!0),e=!0,!l.complete)break}if(s){this.animations_[i]=null,this.setHint(Rt.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&ms(o,!0)}}this.animations_=this.animations_.filter(Boolean),e&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i,r=this.getCenterInternal();return r!==void 0&&(i=[r[0]-e[0],r[1]-e[1]],cn(i,t-this.getRotation()),ic(i,e)),i}calculateCenterZoom(t,e){let i,r=this.getCenterInternal(),s=this.getResolution();if(r!==void 0&&s!==void 0){let o=e[0]-t*(e[0]-r[0])/s,a=e[1]-t*(e[1]-r[1])/s;i=[o,a]}return i}getViewportSize_(t){let e=this.viewportSize_;if(t){let i=e[0],r=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(r*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(r*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let t=this.getCenterInternal();return t&&tr(t,this.getProjection())}getCenterInternal(){return this.get(ee.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return t!==void 0?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){let e=this.calculateExtentInternal(t);return fi(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();let e=this.getCenterInternal();Y(e,"The view center is not defined");let i=this.getResolution();Y(i!==void 0,"The view resolution is not defined");let r=this.getRotation();return Y(r!==void 0,"The view rotation is not defined"),Jn(e,i,r,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(ee.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(me(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();let i=B(t)/e[0],r=at(t)/e[1];return Math.max(i,r)}getResolutionForValueFunction(t){t=t||2;let e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,r=Math.log(e/i)/Math.log(t);return(function(s){return e/Math.pow(t,s*r)})}getRotation(){return this.get(ee.ROTATION)}getValueForResolutionFunction(t){let e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,s=Math.log(i/r)/e;return(function(o){return Math.log(i/o)/e/s})}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t),i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){let t=this.getProjection(),e=this.getResolution(),i=this.getRotation(),r=this.getCenterInternal(),s=this.padding_;if(s){let o=this.getViewportSizeMinusPadding_();r=pa(r,this.getViewportSize_(),[o[0]/2+s[3],o[1]/2+s[0]],e,i)}return{center:r.slice(0),projection:t!==void 0?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,e=this.getResolution();return e!==void 0&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e=this.minZoom_||0,i,r;if(this.resolutions_){let s=en(this.resolutions_,t,1);e=s,i=this.resolutions_[s],s==this.resolutions_.length-1?r=2:r=i/this.resolutions_[s+1]}else i=this.maxResolution_,r=this.zoomFactor_;return e+Math.log(i/t)/Math.log(r)}getResolutionForZoom(t){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let e=J(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,J(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}
1fit(t,e){let i;if(Y(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){Y(!Me(t),"Cannot fit empty extent provided as `geometry`");let r=me(t,this.getProjection());i=ca(r)}else if(t.getType()==="Circle"){let r=me(t.getExtent(),this.getProjection());i=ca(r),i.rotate(this.getRotation(),ie(r))}else{let r=Xi();r?i=t.clone().transform(r,this.getProjection()):i=t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){let e=this.getRotation(),i=Math.cos(e),r=Math.sin(-e),s=t.getFlatCoordinates(),o=t.getStride(),a=1/0,l=1/0,c=-1/0,h=-1/0;for(let u=0,f=s.length;u<f;u+=o){let d=s[u]*i-s[u+1]*r,g=s[u]*r+s[u+1]*i;a=Math.min(a,d),l=Math.min(l,g),c=Math.max(c,d),h=Math.max(h,g)}return[a,l,c,h]}fitInternal(t,e){e=e||{};let i=e.size;i||(i=this.getViewportSizeMinusPadding_());let r=e.padding!==void 0?e.padding:[0,0,0,0],s=e.nearest!==void 0?e.nearest:!1,o;e.minResolution!==void 0?o=e.minResolution:e.maxZoom!==void 0?o=this.getResolutionForZoom(e.maxZoom):o=0;let a=this.rotatedExtentForGeometry(t),l=this.getResolutionForExtentInternal(a,[i[0]-r[1]-r[3],i[1]-r[0]-r[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,s?0:1);let c=this.getRotation(),h=Math.sin(c),u=Math.cos(c),f=ie(a);f[0]+=(r[1]-r[3])/2*l,f[1]+=(r[0]-r[2])/2*l;let d=f[0]*u-f[1]*h,g=f[1]*u+f[0]*h,p=this.getConstrainedCenter([d,g],l),m=e.callback?e.callback:Ye;e.duration!==void 0?this.animateInternal({resolution:l,center:p,duration:e.duration,easing:e.easing},m):(this.targetResolution_=l,this.targetCenter_=p,this.applyTargetState_(!1,!0),ms(m,!0))}centerOn(t,e,i){this.centerOnInternal(ge(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(pa(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,r){let s,o=this.padding_;if(o&&t){let a=this.getViewportSizeMinusPadding_(-i),l=pa(t,r,[a[0]/2+o[3],a[1]/2+o[0]],e,i);s=[t[0]-l[0],t[1]-l[1]]}return s}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(t){let e=tr(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){let e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&ge(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){let i=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*t,0,r,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=ge(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){let i=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(r,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t&&ge(t,this.getProjection()))}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){let i=this.getAnimating()||this.getInteracting()||e,r=this.constraints_.rotation(this.targetRotation_,i),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,0,s,i),a=this.constraints_.center(this.targetCenter_,o,s,i,this.calculateCenterShift(this.targetCenter_,o,r,s));this.get(ee.ROTATION)!==r&&this.set(ee.ROTATION,r),this.get(ee.RESOLUTION)!==o&&(this.set(ee.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(ee.CENTER)||!ki(this.get(ee.CENTER),a))&&this.set(ee.CENTER,a),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=t!==void 0?t:200;let r=e||0,s=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(s),a=this.constraints_.resolution(this.targetResolution_,r,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,s,o));if(t===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=s,this.targetCenter_=l,this.applyTargetState_();return}i=i||(t===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==s||!this.getCenterInternal()||!ki(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:t,easing:re,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Rt.INTERACTING,1)}
1endInteraction(t,e,i){i=i&&ge(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(Rt.INTERACTING,-1),this.resolveConstraints(t,e,i))}getConstrainedCenter(t,e){let i=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),i)}getConstrainedZoom(t,e){let i=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(i,e))}getConstrainedResolution(t,e){e=e||0;let i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,i)}};function ms(n,t){setTimeout(function(){n(t)},0)}function ag(n){if(n.extent!==void 0){let e=n.smoothExtentConstraint!==void 0?n.smoothExtentConstraint:!0;return Po(n.extent,n.constrainOnlyCenter,e)}let t=os(n.projection,"EPSG:3857");if(n.multiWorld!==!0&&t.isGlobal()){let e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,Po(e,!1,!1)}return $h}function lg(n){let t,e,i,o=n.minZoom!==void 0?n.minZoom:ma,a=n.maxZoom!==void 0?n.maxZoom:28,l=n.zoomFactor!==void 0?n.zoomFactor:2,c=n.multiWorld!==void 0?n.multiWorld:!1,h=n.smoothResolutionConstraint!==void 0?n.smoothResolutionConstraint:!0,u=n.showFullExtent!==void 0?n.showFullExtent:!1,f=os(n.projection,"EPSG:3857"),d=f.getExtent(),g=n.constrainOnlyCenter,p=n.extent;if(!c&&!p&&f.isGlobal()&&(g=!1,p=d),n.resolutions!==void 0){let m=n.resolutions;e=m[o],i=m[a]!==void 0?m[a]:m[m.length-1],n.constrainResolution?t=Jc(m,h,!g&&p,u):t=da(e,i,h,!g&&p,u)}else{let _=(d?Math.max(B(d),at(d)):360*Be.degrees/f.getMetersPerUnit())/256/Math.pow(2,ma),x=_/Math.pow(2,28-ma);e=n.maxResolution,e!==void 0?o=0:e=_/Math.pow(l,o),i=n.minResolution,i===void 0&&(n.maxZoom!==void 0?n.maxResolution!==void 0?i=e/Math.pow(l,a):i=_/Math.pow(l,a):i=x),a=o+Math.floor(Math.log(e/i)/Math.log(l)),i=e/Math.pow(l,a-o),n.constrainResolution?t=Qc(l,e,i,h,!g&&p,u):t=da(e,i,h,!g&&p,u)}return{constraint:t,maxResolution:e,minResolution:i,minZoom:o,zoomFactor:l}}function hg(n){if(n.enableRotation!==void 0?n.enableRotation:!0){let e=n.constrainRotation;return e===void 0||e===!0?eu():e===!1?ga:typeof e=="number"?tu(e):ga}return xn}function cg(n){return!(n.sourceCenter&&n.targetCenter&&!ki(n.sourceCenter,n.targetCenter)||n.sourceResolution!==n.targetResolution||n.sourceRotation!==n.targetRotation)}function pa(n,t,e,i,r){let s=Math.cos(-r),o=Math.sin(-r),a=n[0]*s-n[1]*o,l=n[1]*s+n[0]*o;a+=(t[0]/2-e[0])*i,l+=(e[1]-t[1]/2)*i,o=-o;let c=a*s-l*o,h=l*s+a*o;return[c,h]}var Vt=_a;var rr="ol-hidden";var pi="ol-unselectable";var En="ol-control",ya="ol-collapsed",ug=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(""),"i"),nu=["style","variant","weight","size","lineHeight","family"],ps={normal:400,bold:700},_s=function(n){let t=n.match(ug);if(!t)return null;let e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let i=0,r=nu.length;i<r;++i){let s=t[i+1];s!==void 0&&(e[nu[i]]=typeof s=="string"?s.trim():s)}return isNaN(Number(e.weight))&&e.weight in ps&&(e.weight=ps[e.weight]),e.families=e.family.split(/,\s?/).map(i=>i.trim().replace(/^['"]|['"]$/g,"")),e};function tt(n,t,e,i){let r;return e&&e.length?r=e.shift():wt?r=new class extends OffscreenCanvas{style={}}(n??300,t??150):r=document.createElement("canvas"),n&&(r.width=n),t&&(r.height=t),r.getContext("2d",i)}var xa;function sr(){return xa||(xa=tt(1,1)),xa}function zi(n){let t=n.canvas;t.width=1,t.height=1,n.clearRect(0,0,1,1)}function Ea(n,t){let e=t.parentNode;e&&e.replaceChild(n,t)}function ru(n){for(;n.lastChild;)n.lastChild.remove()}function su(n,t){let e=n.childNodes;for(let i=0;;++i){let r=e[i],s=t[i];if(!r&&!s)break;if(r!==s){if(!r){n.appendChild(s);continue}if(!s){n.removeChild(r),--i;continue}n.insertBefore(s,r)}}}function ys(){return new Proxy({childNodes:[],appendChild:function(t){return this.childNodes.push(t),t},remove:function(){},removeChild:function(t){let e=this.childNodes.indexOf(t);if(e===-1)throw new Error("Node to remove was not found");return this.childNodes.splice(e,1),t},insertBefore:function(t,e){let i=this.childNodes.indexOf(e);if(i===-1)throw new Error("Reference node not found");return this.childNodes.splice(i,0,t),t},style:{}},{get(t,e,i){return e==="firstElementChild"?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,i)}})}function Zt(n){return typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas}var Ca=class extends _t{constructor(t){super();let e=t.element;e&&!t.target&&!e.style.pointerEvents&&(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let e=0,i=this.listenerKeys.length;e<i;++e)H(this.listenerKeys[e]);if(this.listenerKeys.length=0,this.map_=t,t){let e=this.target_??t.getOverlayContainerStopEvent();this.element&&e.appendChild(this.element),this.render!==Ye&&this.listenerKeys.push(U(t,Ie.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}},Cn=Ca;var Sa=class extends Cn{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=t.collapsed!==void 0?t.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=t.collapsible!==void 0,this.collapsible_=t.collapsible!==void 0?t.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;let e=t.className!==void 0?t.className:"ol-attribution",i=t.tipLabel!==void 0?t.tipLabel:"Attributions",r=t.expandClassName!==void 0?t.expandClassName:e+"-expand",s=t.collapseLabel!==void 0?t.collapseLabel:"\u203A",o=t.collapseClassName!==void 0?t.collapseClassName:e+"-collapse";typeof s=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=s,this.collapseLabel_.className=o):this.collapseLabel_=s;let a=t.label!==void 0?t.label:"i";
1typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=r):this.label_=a;let l=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(l),this.toggleButton_.addEventListener(M.CLICK,this.handleClick_.bind(this),!1);let c=e+" "+pi+" "+En+(this.collapsed_&&this.collapsible_?" "+ya:"")+(this.collapsible_?"":" ol-uncollapsible"),h=this.element;h.className=c,h.appendChild(this.toggleButton_),h.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){let e=this.getMap().getAllLayers(),i=new Set(e.flatMap(r=>r.getAttributions(t)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(r=>i.add(r)):i.add(this.attributions_)),!this.overrideCollapsible_){let r=!e.s
1ome(s=>s.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(r)}return Array.from(i)}async updateElement_(t){if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}let e=await Promise.all(this.collectSourceAttributions_(t).map(r=>Wh(()=>r))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!Pt(e,this.renderedAttributions_)){ru(this.ulElement_);for(let r=0,s=e.length;r<s;++r){let o=document.createElement("li");o.innerHTML=e[r],this.ulElement_.appendChild(o)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(ya),this.collapsed_?Ea(this.collapseLabel_,this.label_):Ea(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)}},ou=Sa;var wa=class extends Cn{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});let e=t.className!==void 0?t.className:"ol-rotate",i=t.label!==void 0?t.label:"\u21E7",r=t.compassClassName!==void 0?t.compassClassName:"ol-compass";this.label_=null,typeof i=="string"?(this.label_=document.createElement("span"),this.label_.className=r,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(r));let s=t.tipLabel?t.tipLabel:"Reset rotation",o=document.createElement("button");o.className=e+"-reset",o.setAttribute("type","button"),o.title=s,o.appendChild(this.label_),o.addEventListener(M.CLICK,this.handleClick_.bind(this),!1);let a=e+" "+pi+" "+En,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=t.duration!==void 0?t.duration:250,this.autoHide_=t.autoHide!==void 0?t.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(rr)}handleClick_(t){t.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){let e=this.getMap().getView();if(!e)return;let i=e.getRotation();i!==void 0&&(this.duration_>0&&i%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:re}):e.setRotation(0))}render(t){let e=t.frameState;if(!e)return;let i=e.viewState.rotation;if(i!=this.rotation_){let r="rotate("+i+"rad)";if(this.autoHide_){let s=this.element.classList.contains(rr);!s&&i===0?this.element.classList.add(rr):s&&i!==0&&this.element.classList.remove(rr)}this.label_.style.transform=r}this.rotation_=i}},au=wa;var Ra=class extends Cn{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});let e=t.className!==void 0?t.className:"ol-zoom",i=t.delta!==void 0?t.delta:1,r=t.zoomInClassName!==void 0?t.zoomInClassName:e+"-in",s=t.zoomOutClassName!==void 0?t.zoomOutClassName:e+"-out",o=t.zoomInLabel!==void 0?t.zoomInLabel:"+",a=t.zoomOutLabel!==void 0?t.zoomOutLabel:"\u2013",l=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",c=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",h=document.createElement("button");h.className=r,h.setAttribute("type","button"),h.title=l,h.appendChild(typeof o=="string"?document.createTextNode(o):o),h.addEventListener(M.CLICK,this.handleClick_.bind(this,i),!1);let u=document.createElement("button");u.className=s,u.setAttribute("type","button"),u.title=c,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(M.CLICK,this.handleClick_.bind(this,-i),!1);let f=e+" "+pi+" "+En,d=this.element;d.className=f,d.appendChild(h),d.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){let i=this.getMap().getView();if(!i)return;let r=i.getZoom();if(r!==void 0){let s=i.getConstrainedZoom(r+t);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:s,duration:this.duration_,easing:re})):i.setZoom(s)}}},lu=Ra;function or(n){n=n||{};let t=new St;return(n.zoom===void 0||n.zoom)&&t.push(new lu(n.zoomOptions)),(n.rotate===void 0||n.rotate)&&t.push(new au(n.rotateOptions)),(n.attribution===void 0||n.attribution)&&t.push(new ou(n.attributionOptions)),t}var Ta=class{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;let t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;for(;i>0&&this.points_[i+2]>t;)i-=3;let r=this.points_[e+2]-this.points_[i+2];if(r<1e3/60)return!1;let s=this.points_[e]-this.points_[i],o=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(o,s),this.initialVelocity_=Math.sqrt(s*s+o*o)/r,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},hu=Ta;var Ia={ACTIVE:"active"};var va=class extends _t{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(Ia.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Ia.ACTIVE,t)}setMap(t){this.map_=t}};function cu(n,t,e){let i=n.getCenterInternal();if(i){let r=[i[0]+t[0],i[1]+t[1]];n.animateInternal({duration:e!==void 0?e:250,easing:ac,center:n.getConstrainedCenter(r)})}}function Sn(n,t,e,i){let r=n.getZoom();if(r===void 0)return;let s=n.getConstrainedZoom(r+t),o=n.getResolutionForZoom(s);n.getAnimating()&&n.cancelAnimations(),n.animate({resolution:o,anchor:e,duration:i!==void 0?i:250,easing:re})}var oe=va;var La=class extends oe{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:250}handleEvent(t){let e=!1;if(t.type==nt.DBLCLICK){let i=t.originalEvent,r=t.map,s=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=r.getView();Sn(a,o,s,this.duration_),i.preventDefault(),e=!0}return!e}},uu=La;function ar(n){let t=arguments;return function(e){let i=!0;for(let r=0,s=t.length;r<s&&(i=i&&t[r](e),!!i);++r);return i}}var fu=function(n){let t=n.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},fg=function(n){let t=n.map.getTargetElement(),e=t.getRootNode(),i=n.map.getOwnerDocument().activeElement;return e instanceof ShadowRoot?e.host.contains(i):t.contains(i)},xs=function(n){let t=n.map.getTargetElement(),e=t.getRootNode();return(e instanceof ShadowRoot?e.host:t).hasAttribute("tabindex")?fg(n):!0},du=te;var Es=function(n){let t=n.originalEvent;return"pointerId"in t&&t.button==0&&!(Yh&&Io&&t.ctrlKey)},Aa=Re,gu=function(n){return n.type=="pointermove"},mu=function(n){return n.type==nt.SINGLECLICK};var Cs=function(n){let t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey};var pu=function(n){let t=n.originalEvent;return Io?t.metaKey:t.ctrlKey},Ss=function(n){let t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},ws=function(n){let t=n.originalEvent,e=t.target.tagName;return e!=="INPUT"&&e!=="SELECT"&&e!=="TEXTAREA"&&!t.target.isContentEditable},Rs=function(n){let t=n.originalEvent;return"pointerId"in t&&t.pointerType=="mouse"};var _u=function(n){let t=n.originalEvent;return"pointerId"in t&&t.isPrimary&&t.button===0};var Ma=class extends oe{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==nt.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==nt.POINTERUP){let i=this.handleUpEvent(t);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(t.type==nt.POINTERDOWN){let i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==nt.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 wn(n){let t=n.length,e=0,i=0;for(let r=0;r<t;r++)e+=n[r].clientX,i+=n[r].clientY;return{clientX:e/t,clientY:i/t}}var Pe=Ma;var Pa=class extends Pe{constructor(t){super({stopDown:Re}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let e=t.condition?t.condition:ar(Cs,_u);this.condition_=t.onFocusOnly?ar(xs,e):e,this.noKinetic_=!1}handleDragEvent(t){let e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());let i=this.targetPointers,r=e.getEventPixel(wn(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){let s=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],a=t.map.getView();nc(s,a.getResolution()),cn(s,a.getRotation()),a.adjustCenterInternal(s)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=i.length,t.originalEvent.preventDefault()}handleUpEvent(t){let e=t.map,i=e.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){let r=this.kinetic_.getDistance(),s=this.kinetic_.getAngle(),o=i.getCenterInternal(),a=e.getPixelFromCo
1ordinateInternal(o),l=e.getCoordinateFromPixelInternal([a[0]-r*Math.cos(s),a[1]-r*Math.sin(s)]);i.animateInternal({center:i.getConstrainedCenter(l),duration:500,easing:re})}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)){let i=t.map.getView();return this.lastCentroid=null,i.getAnimating()&&i.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},yu=Pa;var Oa=class extends Pe{constructor(t){t=t||{},super({stopDown:Re}),this.condition_=t.condition?t.condition:fu,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!Rs(t))return;let e=t.map,i=e.getView();if(i.getConstraints().rotation===xn)return;let r=e.getSize(),s=t.pixel,o=Math.atan2(r[1]/2-s[1],s[0]-r[0]/2);if(this.lastAngle_!==void 0){let a=o-this.lastAngle_;i.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(t){return Rs(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return Rs(t)&&Es(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},xu=Oa;var ba=class extends ai{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_(){let t=this.startPixel_,e=this.endPixel_,i="px",r=this.element_.style;r.left=Math.min(t[0],e[0])+i,r.top=Math.min(t[1],e[1])+i,r.width=Math.abs(e[0]-t[0])+i,r.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);let e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;let t=this.startPixel_,e=this.endPixel_,r=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new $c([r])}getGeometry(){return this.geometry_}},Eu=ba;var Rn={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},Wi=class extends pt{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}},Da=class extends Pe{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new Eu(t.className||"ol-dragbox"),this.minArea_=t.minArea??
164,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??Es,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){let r=i[0]-e[0],s=i[1]-e[1];return r*r+s*s>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new Wi(Rn.BOXDRAG,t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;let e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new Wi(e?Rn.BOXEND:Rn.BOXCANCEL,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!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 Wi(Rn.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Wi(Rn.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Wi(Rn.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}},Cu=Da;var Fa=class extends Cu{constructor(t){t=t||{};let e=t.condition?t.condition:Ss;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=t.duration!==void 0?t.duration:200,this.out_=t.out!==void 0?t.out:!1}onBoxEnd(t){let i=this.getMap().getView(),r=this.getGeometry();if(this.out_){let s=i.rotatedExtentForGeometry(r),o=i.getResolutionForExtentInternal(s),a=i.getResolution()/o;r=r.clone(),r.scale(a*a)}i.fitInternal(r,{duration:this.duration_,easing:re})}},Su=Fa;var _i={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var ka=class extends oe{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return Cs(e)&&ws(e)},this.condition_=t.condition!==void 0?t.condition:this.defaultCondition_,this.duration_=t.duration!==void 0?t.duration:100,this.pixelDelta_=t.pixelDelta!==void 0?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==M.KEYDOWN){let i=t.originalEvent,r=i.key;if(this.condition_(t)&&(r==_i.DOWN||r==_i.LEFT||r==_i.RIGHT||r==_i.UP)){let o=t.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==_i.DOWN?c=-a:r==_i.LEFT?l=-a:r==_i.RIGHT?l=a:c=a;let h=[l,c];cn(h,o.getRotation()),cu(o,h,this.duration_),i.preventDefault(),e=!0}}return!e}},wu=ka;var Na=class extends oe{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!pu(e)&&ws(e)},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:100}handleEvent(t){let e=!1;if(t.type==M.KEYDOWN||t.type==M.KEYPRESS){let i=t.originalEvent,r=i.key;if(this.condition_(t)&&(r==="+"||r==="-")){let s=t.map,o=r==="+"?this.delta_:-this.delta_,a=s.getView();Sn(a,o,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}},Ru=Na;var dg=40,gg=300,mg=3,Ga=class extends oe{constructor(t){t=t||{},super(t),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=t.maxDelta!==void 0?t.maxDelta:1,this.duration_=t.duration!==void 0?t.duration:250,this.timeout_=t.timeout!==void 0?t.timeout:80,this.useAnchor_=t.useAnchor!==void 0?t.useAnchor:!0,this.constrainResolution_=t.constrainResolution!==void 0?t.constrainResolution:!1;let e=t.condition?t.condition:du;this.condition_=t.onFocusOnly?ar(xs,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300,this.ctrlKeyPressed_=!1,this.ctrlKeyListenerKeys_=[]}setMap(t){if(this.ctrlKeyListenerKeys_.forEach(H),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(t),t){let e=t.getOwnerDocument();this.ctrlKeyListenerKeys_.push(U(e,"keydown",i=>{i.key==="Control"&&(this.ctrlKeyPressed_=!0)}),U(e,"keyup",i=>{i.key==="Control"&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;let t=this.getMap();if(!t)return;let e=t.getView(),i=this.lastDelta_?this.lastDelta_>0?1:-1:0;e.endInteraction(this.constrainResolution_||e.getConstrainResolution()?100:void 0,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(t){if(!this.condition_(t)||t.type!==M.WHEEL)return!0;let i=t.map,r=t.originalEvent;r.preventDefault();let s=r.ctrlKey&&!this.ctrlKeyPressed_;r.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=t.pixel);let o=r.deltaY;switch(r.deltaMode){case WheelEvent.DOM_DELTA_LINE:o*=dg;break;case WheelEvent.DOM_DELTA_PAGE:o*=gg;break;default:}if(o===0)return!1;this.lastDelta_=o;let a=Date.now();this.startTime_===void 0&&(this.startTime_=a),(!this.mode_||a-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(o)<4?"trackpad":"wheel");let l=i.getView();if(this.mode_==="trackpad")return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(l.getAnimating()&&l.cancelAnimations(),l.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),s&&(o=o*mg),l.adjustZoom(-o/this.deltaPerZoom_,this.lastAnchor_?i.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=a,!1;this.totalDelta_+=o;let c=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),c),!1}handleWheelZoom_(t){let e=t.getView();e.getAnimating()&&e.cancelAnimations();
1let i=-J(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),Sn(e,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}},Tu=Ga;var Xa=class extends Pe{constructor(t){t=t||{};let e=t;e.stopDown||(e.stopDown=Re),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=t.threshold!==void 0?t.threshold:.3,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){let e=0,i=this.targetPointers[0],r=this.targetPointers[1],s=Math.atan2(r.clientY-i.clientY,r.clientX-i.clientX);if(this.lastAngle_!==void 0){let l=s-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=l}this.lastAngle_=s;let o=t.map,a=o.getView();a.getConstraints().rotation!==xn&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(wn(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return this.targetPointers.length<2?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){if(this.targetPointers.length>=2){let 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}},Iu=Xa;var za=class extends Pe{constructor(t){t=t||{};let e=t;e.stopDown||(e.stopDown=Re),super(e),this.anchor_=null,this.duration_=t.duration!==void 0?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1,i=this.targetPointers[0],r=this.targetPointers[1],s=i.clientX-r.clientX,o=i.clientY-r.clientY,a=Math.sqrt(s*s+o*o);this.lastDistance_!==void 0&&(e=this.lastDistance_/a),this.lastDistance_=a;let l=t.map,c=l.getView();e!=1&&(this.lastScaleDelta_=e),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(wn(this.targetPointers))),l.render(),c.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){let i=t.map.getView(),r=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,r),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){let e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}},vu=za;function Lu(n){n=n||{};let t=new St,e=new hu(-.005,.05,100);return(n.altShiftDragRotate===void 0||n.altShiftDragRotate)&&t.push(new xu),(n.doubleClickZoom===void 0||n.doubleClickZoom)&&t.push(new uu({delta:n.zoomDelta,duration:n.zoomDuration})),(n.dragPan===void 0||n.dragPan)&&t.push(new yu({onFocusOnly:n.onFocusOnly,kinetic:e})),(n.pinchRotate===void 0||n.pinchRotate)&&t.push(new Iu),(n.pinchZoom===void 0||n.pinchZoom)&&t.push(new vu({duration:n.zoomDuration})),(n.keyboard===void 0||n.keyboard)&&(t.push(new wu),t.push(new Ru({delta:n.zoomDelta,duration:n.zoomDuration}))),(n.mouseWheelZoom===void 0||n.mouseWheelZoom)&&t.push(new Tu({onFocusOnly:n.onFocusOnly,duration:n.zoomDuration})),(n.shiftDragZoom===void 0||n.shiftDragZoom)&&t.push(new Su({duration:n.zoomDuration})),t}var et={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"};var Wa=class extends _t{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;let e=Object.assign({},t);typeof t.properties=="object"&&(delete e.properties,Object.assign(e,t.properties)),e[et.OPACITY]=t.opacity!==void 0?t.opacity:1,Y(typeof e[et.OPACITY]=="number","Layer opacity must be a number"),e[et.VISIBLE]=t.visible!==void 0?t.visible:!0,e[et.Z_INDEX]=t.zIndex,e[et.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[et.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[et.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[et.MAX_ZOOM]=t.maxZoom!==void 0?t.maxZoom:1/0,this.className_=e.className!==void 0?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}
1getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){let e=this.state_||{layer:this,managed:t===void 0?!0:t},i=this.getZIndex();return e.opacity=J(Math.round(this.getOpacity()*100)/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=i===void 0&&!e.managed?1/0:i,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 j()}getLayerStatesArray(t){return j()}getExtent(){return this.get(et.EXTENT)}getMaxResolution(){return this.get(et.MAX_RESOLUTION)}getMinResolution(){return this.get(et.MIN_RESOLUTION)}getMinZoom(){return this.get(et.MIN_ZOOM)}getMaxZoom(){return this.get(et.MAX_ZOOM)}getOpacity(){return this.get(et.OPACITY)}getSourceState(){return j()}getVisible(){return this.get(et.VISIBLE)}getZIndex(){return this.get(et.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(et.EXTENT,t)}setMaxResolution(t){this.set(et.MAX_RESOLUTION,t)}setMinResolution(t){this.set(et.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(et.MAX_ZOOM,t)}setMinZoom(t){this.set(et.MIN_ZOOM,t)}setOpacity(t){Y(typeof t=="number","Layer opacity must be a number"),this.set(et.OPACITY,t)}setVisible(t){this.set(et.VISIBLE,t)}setZIndex(t){this.set(et.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},Ts=Wa;var yi={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},pe=class extends pt{constructor(t,e){super(t),this.layer=e}},Ua={LAYERS:"layers"},Ya=class n extends Ts{constructor(t){t=t||{};let 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(Ua.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new St(i.slice(),{unique:!0}):Y(typeof i.getArray=="function","Expected `layers` to be an array or a `Collection`"):i=new St(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(H),this.layersListenerKeys_.length=0;let t=this.getLayers();this.layersListenerKeys_.push(U(t,lt.ADD,this.handleLayersAdd_,this),U(t,lt.REMOVE,this.handleLayersRemove_,this));for(let i in this.listenerKeys_)this.listenerKeys_[i].forEach(H);we(this.listenerKeys_);let e=t.getArray();for(let i=0,r=e.length;i<r;i++){let s=e[i];this.registerLayerListeners_(s),this.dispatchEvent(new pe(yi.ADDLAYER,s))}this.changed()}registerLayerListeners_(t){let e=[U(t,he.PROPERTYCHANGE,this.handleLayerChange_,this),U(t,M.CHANGE,this.handleLayerChange_,this)];t instanceof n&&e.push(U(t,yi.ADDLAYER,this.handleLayerGroupAdd_,this),U(t,yi.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[F(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new pe(yi.ADDLAYER,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new pe(yi.REMOVELAYER,t.layer))}handleLayersAdd_(t){let e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new pe(yi.ADDLAYER,e)),this.changed()}handleLayersRemove_(t){let e=t.element,i=F(e);this.listenerKeys_[i].forEach(H),delete this.listenerKeys_[i],this.dispatchEvent(new pe(yi.REMOVELAYER,e)),this.changed()}getLayers(){return this.get(Ua.LAYERS)}setLayers(t){let e=this.getLayers();if(e){let i=e.getArray();for(let r=0,s=i.length;r<s;++r)this.dispatchEvent(new pe(yi.REMOVELAYER,i[r]))}this.set(Ua.LAYERS,t)}getLayersArray(t){return t=t!==void 0?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){let e=t!==void 0?t:[],i=e.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(e)});let r=this.getLayerState(),s=r.zIndex;!t&&r.zIndex===void 0&&(s=0);for(let o=i,a=e.length;o<a;o++){let l=e[o];l.opacity*=r.opacity,l.visible=l.visible&&r.visible,l.maxResolution=Math.min(l.maxResolution,r.maxResolution),l.minResolution=Math.max(l.minResolution,r.minResolution),l.minZoom=Math.max(l.minZoom,r.minZoom),l.maxZoom=Math.min(l.maxZoom,r.maxZoom),r.extent!==void 0&&(l.extent!==void 0?l.extent=Ae(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return e}getSourceState(){return"ready"}},lr=Ya;var At={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var Ka=class extends Ts{constructor(t){let 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(et.SOURCE,this.handleSourcePropertyChange_);let 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(et.SOURCE)||null}
1getRenderSource(){return this.getSource()}getSourceState(){let t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(H(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let t=this.getSource();t&&(this.sourceChangeKey_=U(t,M.CHANGE,this.handleSourceChange_,this),t.getState()==="ready"&&(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?null:this.renderer_.getData(t)}isVisible(t){let e,i=this.getMapInternal();!t&&i&&(t=i.getView()),t instanceof Vt?e={viewState:t.getState(),extent:t.calculateExtent()}:e=t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray());let r;if(e.layerStatesArray){if(r=e.layerStatesArray.find(o=>o.layer===this),!r)return!1}else r=this.getLayerState();let s=this.getExtent();return hr(r,e.viewState)&&(!s||st(s,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];let e=this.getSource()?.getAttributions();if(!e)return[];let i=t instanceof Vt?t.getViewStateAndExtent():t,r=e(i);return Array.isArray(r)||(r=[r]),r}render(t,e){let i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){let e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(et.MAP,t)}getMapInternal(){return this.get(et.MAP)}setMap(t){this.mapPrecomposeKey_&&(H(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(H(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=U(t,At.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=U(this,M.CHANGE,t.render,t),this.changed())}handlePrecompose_(t){let e=t.frameState.layerStatesArray,i=this.getLayerState(!1);Y(!e.some(r=>r.layer===i.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set(et.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function hr(n,t){if(!n.visible)return!1;let e=t.resolution;if(e<n.minResolution||e>=n.maxResolution)return!1;let i=t.zoom;return i>n.minZoom&&i<=n.maxZoom}var Ui=Ka;function Is(n,t,e=0,i=n.length-1,r=pg){for(;i>e;){if(i-e>600){let l=i-e+1,c=t-e+1,h=Math.log(l),u=.5*Math.exp(2*h/3),f=.5*Math.sqrt(h*u*(l-u)/l)*(c-l/2<0?-1:1),d=Math.max(e,Math.floor(t-c*u/l+f)),g=Math.min(i,Math.floor(t+(l-c)*u/l+f));Is(n,t,d,g,r)}let s=n[t],o=e,a=i;for(cr(n,e,t),r(n[i],s)>0&&cr(n,e,i);o<a;){for(cr(n,o,a),o++,a--;r(n[o],s)<0;)o++;for(;r(n[a],s)>0;)a--}r(n[e],s)===0?cr(n,e,a):(a++,cr(n,a,i)),a<=t&&(e=a+1),t<=a&&(i=a-1)}}function cr(n,t,e){let i=n[t];n[t]=n[e],n[e]=i}function pg(n,t){return n<t?-1:n>t?1:0}var Yi=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data,i=[];if(!Ls(t,e))return i;let r=this.toBBox,s=[];for(;e;){for(let o=0;o<e.children.length;o++){let a=e.children[o],l=e.leaf?r(a):a;Ls(t,l)&&(e.leaf?i.push(a):ja(t,l)?this._all(a,i):s.push(a))}e=s.pop()}return i}collides(t){let e=this.data;if(!Ls(t,e))return!1;let i=[];for(;e;){for(let r=0;r<e.children.length;r++){let s=e.children[r],o=e.leaf?this.toBBox(s):s;
1if(Ls(t,o)){if(e.leaf||ja(t,o))return!0;i.push(s)}}e=i.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let i=0;i<t.length;i++)this.insert(t[i]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=e;else if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){let i=this.data;this.data=e,e=i}this._insert(e,this.data.height-e.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=In([]),this}remove(t,e){if(!t)return this;let i=this.data,r=this.toBBox(t),s=[],o=[],a,l,c;for(;i||s.length;){if(i||(i=s.pop(),l=s[s.length-1],a=o.pop(),c=!0),i.leaf){let h=_g(t,i.children,e);if(h!==-1)return i.children.splice(h,1),s.push(i),this._condense(s),this}!c&&!i.leaf&&ja(i,r)?(s.push(i),o.push(a),a=0,l=i,i=i.children[0]):l?(a++,i=l.children[a],c=!1):i=null}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){let i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,r){let s=i-e+1,o=this._maxEntries,a;if(s<=o)return a=In(t.slice(e,i+1)),Tn(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=In([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));Au(t,e,i,c,this.compareMinX);for(let h=e;h<=i;h+=c){let u=Math.min(h+c-1,i);Au(t,h,u,l,this.compareMinY);for(let f=h;f<=u;f+=l){let d=Math.min(f+l-1,u);a.children.push(this._build(t,f,d,r-1))}}return Tn(a,this.toBBox),a}_chooseSubtree(t,e,i,r){for(;r.push(e),!(e.leaf||r.length-1===i);){let s=1/0,o=1/0,a;for(let l=0;l<e.children.length;l++){let c=e.children[l],h=Ba(c),u=Eg(t,c)-h;u<o?(o=u,s=h<s?h:s,a=c):u===o&&h<s&&(s=h,a=c)}e=a||e.children[0]}return e}_insert(t,e,i){let r=i?t:this.toBBox(t),s=[],o=this._chooseSubtree(r,this.data,e,s);for(o.children.push(t),fr(o,r);e>=0&&s[e].children.length>this._maxEntries;)this._split(s,e),e--;this._adjustParentBBoxes(r,s,e)}_split(t,e){let i=t[e],r=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,r);let o=this._chooseSplitIndex(i,s,r),a=In(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,Tn(i,this.toBBox),Tn(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,e){this.data=In([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Tn(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let r,s=1/0,o=1/0;for(let a=e;a<=i-e;a++){let l=ur(t,0,a,this.toBBox),c=ur(t,a,i,this.toBBox),h=Cg(l,c),u=Ba(l)+Ba(c);h<s?(s=h,r=a,o=u<o?u:o):h===s&&u<o&&(o=u,r=a)}return r||i-e}_chooseSplitAxis(t,e,i){let r=t.leaf?this.compareMinX:yg,s=t.leaf?this.compareMinY:xg,o=this._allDistMargin(t,e,i,r),a=this._allDistMargin(t,e,i,s);o<a&&t.children.sort(r)}_allDistMargin(t,e,i,r){t.children.sort(r);let s=this.toBBox,o=ur(t,0,e,s),a=ur(t,i-e,i,s),l=vs(o)+vs(a);for(let c=e;c<i-e;c++){let h=t.children[c];fr(o,t.leaf?s(h):h),l+=vs(o)}for(let c=i-e-1;c>=e;c--){let h=t.children[c];fr(a,t.leaf?s(h):h),l+=vs(a)}return l}_adjustParentBBoxes(t,e,i){for(let r=i;r>=0;r--)fr(e[r],t)}_condense(t){for(let e=t.length-1,i;e>=0;e--)t[e].children.length===0?e>0?(i=t[e-1].children,i.splice(i.indexOf(t[e]),1)):this.clear():Tn(t[e],this.toBBox)}};function _g(n,t,e){if(!e)return t.indexOf(n);for(let i=0;i<t.length;i++)if(e(n,t[i]))return i;return-1}function Tn(n,t){ur(n,0,n.children.length,t,n)}function ur(n,t,e,i,r){r||(r=In(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=t;s<e;s++){let o=n.children[s];fr(r,n.leaf?i(o):o)}return r}function fr(n,t){return n.minX=Math.min(n.minX,t.minX),n.minY=Math.min(n.minY,t.minY),n.maxX=Math.max(n.maxX,t.maxX),n.maxY=Math.max(n.maxY,t.maxY),n}function yg(n,t){return n.minX-t.minX}function xg(n,t){return n.minY-t.minY}function Ba(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function vs(n){return n.maxX-n.minX+(n.maxY-n.minY)}function Eg(n,t){return(Math.max(t.maxX,n.maxX)-Math.min(t.minX,n.minX))*(Math.max(t.maxY,n.maxY)-Math.min(t.minY,n.minY))}function Cg(n,t){let e=Math.max(n.minX,t.minX),i=Math.max(n.minY,t.minY),r=Math.min(n.maxX,t.maxX),s=Math.min(n.maxY,t.maxY);return Math.max(0,r-e)*Math.max(0,s-i)}function ja(n,t){return n.minX<=t.minX&&n.minY<=t.minY&&t.maxX<=n.maxX&&t.maxY<=n.maxY}function Ls(n,t){return t.minX<=n.maxX&&t.minY<=n.maxY&&t.maxX>=n.minX&&t.maxY>=n.minY}function In(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Au(n,t,e,i,r){let s=[t,e];for(;s.length;){if(e=s.pop(),t=s.pop(),e-t<=i)continue;let o=t+Math.ceil((e-t)/i/2)*i;Is(n,o,t,e,r),s.push(t,o,o,e)}}var Ms=[NaN,NaN,NaN,0],Va;function Sg(){return Va||(Va=tt(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),Va}var wg=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Rg=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Tg=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Ig=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function As(n,t){return n.endsWith("%")?Number(n.substring(0,n.length-1))/t:Number(n)}function gr(n){throw new Error('failed to parse "'+n+'" as color')}function Mu(n){if(n.toLowerCase().startsWith("rgb")){let s=n.match(Rg)||n.match(wg)||n.match(Tg);if(s){let o=s[4],a=100/255;return[J(As(s[1],a)+.5|0,0,255),J(As(s[2],a)+.5|0,0,255),J(As(s[3],a)+.5|0,0,255),o!==void 0?J(As(o,100),0,1):1]}gr(n)}if(n.startsWith("#")){if(Ig.test(n)){let s=n.substring(1),o=s.length<=4?1:2,a=[0,0,0,255];for(let l=0,c=s.length;l<c;l+=o){let h=parseInt(s.substring(l,l+o),16);o===1&&(h+=h<<4),a[l/o]=h}return a[3]=a[3]/255,a}gr(n)}
1let t=Sg();t.fillStyle="#abcdef";let e=t.fillStyle;t.fillStyle=n,t.fillStyle===e&&(t.fillStyle="#fedcba",e=t.fillStyle,t.fillStyle=n,t.fillStyle===e&&gr(n));let i=t.fillStyle;if(i.startsWith("#")||i.startsWith("rgba"))return Mu(i);t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);let r=Array.from(t.getImageData(0,0,1,1).data);return r[3]=Oi(r[3]/255,3),r}function Pu(n){return typeof n=="string"?n:pr(n)}var vg=1024,dr={},Za=0;function Ou(n){if(n.length===4)return n;let t=n.slice();return t[3]=1,t}function Ha(n){return n>.0031308?Math.pow(n,1/2.4)*269.025-14.025:n*3294.6}function qa(n){return n>.2068965?Math.pow(n,3):(n-4/29)*(108/841)}function $a(n){return n>10.314724?Math.pow((n+14.025)/269.025,2.4):n/3294.6}function Ja(n){return n>.0088564?Math.pow(n,1/3):n/(108/841)+4/29}function Qa(n){let t=$a(n[0]),e=$a(n[1]),i=$a(n[2]),r=Ja(t*.222488403+e*.716873169+i*.06060791),s=500*(Ja(t*.452247074+e*.399439023+i*.148375274)-r),o=200*(r-Ja(t*.016863605+e*.117638439+i*.865350722)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,n[3]]}function bu(n){let t=(n[0]+16)/116,e=n[1],i=n[2]*Math.PI/180,r=qa(t),s=qa(t+e/500*Math.cos(i)),o=qa(t-e/200*Math.sin(i)),a=Ha(s*3.021973625-r*1.617392459-o*.404875592),l=Ha(s*-.943766287+r*1.916279586+o*.027607165),c=Ha(s*.069407491-r*.22898585+o*1.159737864);return[J(a+.5|0,0,255),J(l+.5|0,0,255),J(c+.5|0,0,255),n[3]]}function mr(n){if(n==="none")return Ms;if(dr.hasOwnProperty(n))return dr[n];if(Za>=vg){let e=0;for(let i in dr)(e++&3)===0&&(delete dr[i],--Za)}let t=Mu(n);t.length!==4&&gr(n);for(let e of t)isNaN(e)&&gr(n);return dr[n]=t,++Za,t}function ae(n){return Array.isArray(n)?n:mr(n)}function pr(n){let t=n[0];t!=(t|0)&&(t=t+.5|0);let e=n[1];e!=(e|0)&&(e=e+.5|0);let i=n[2];i!=(i|0)&&(i=i+.5|0);let r=n[3]===void 0?1:Math.round(n[3]*1e3)/1e3;return"rgba("+t+","+e+","+i+","+r+")"}function tl(n){return n[0]>0&&n[1]>0}function Du(n,t,e){return e===void 0&&(e=[0,0]),e[0]=n[0]*t+.5|0,e[1]=n[1]*t+.5|0,e}function dt(n,t){return Array.isArray(n)?n:(t===void 0?t=[n,n]:(t[0]=n,t[1]=n),t)}var Bi=0,Os=0,bt=1<<Bi++,q=1<<Bi++,Dt=1<<Bi++,Gt=1<<Bi++,qe=1<<Bi++,Ki=1<<Bi++,bs=Math.pow(2,Bi)-1,il={[bt]:"boolean",[q]:"number",[Dt]:"string",[Gt]:"color",[qe]:"number[]",[Ki]:"size"},Lg=Object.keys(il).map(Number).sort(zt);function Ag(n){return n in il}function He(n){let t=[];for(let e of Lg)_r(n,e)&&t.push(il[e]);return t.length===0?"untyped":t.length<3?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t[t.length-1]}function _r(n,t){return(n&t)===t}function Ps(n,t){return!!(n&t)}function xi(n,t){return n===t}var ut=class{constructor(t,e){if(!Ag(t))throw new Error(`literal expressions must have a specific type, got ${He(t)}`);this.type=t,this.value=e}},Ds=class{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}};function Fs(n){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:n}}function gt(n,t,e){switch(typeof n){case"boolean":{if(xi(t,Dt))return new ut(Dt,n?"true":"false");if(!_r(t,bt))throw new Error(`got a boolean, but expected ${He(t)}`);return new ut(bt,n)}case"number":{if(xi(t,Ki))return new ut(Ki,dt(n));if(xi(t,bt))return new ut(bt,!!n);if(xi(t,Dt))return new ut(Dt,n.toString());if(!_r(t,q))throw new Error(`got a number, but expected ${He(t)}`);return new ut(q,n)}case"string":{if(xi(t,Gt))return new ut(Gt,mr(n));if(xi(t,bt))return new ut(bt,!!n);if(!_r(t,Dt))throw new Error(`got a string, but expected ${He(t)}`);return new ut(Dt,n)}default:}if(!Array.isArray(n))throw new Error("expression must be an array or a primitive value");if(n.length===0)throw new Error("empty expression");if(typeof n[0]=="string")return Wg(n,t,e);for(let i of n)if(typeof i!="number")throw new Error("expected an array of numbers");if(xi(t,Ki)){if(n.length!==2)throw new Error(`expected an array of two values for a size, got ${n.length}`);return new ut(Ki,n)}if(xi(t,Gt)){if(n.length===3)return new ut(Gt,[...n,1]);if(n.length===4)return new ut(Gt,n);throw new Error(`expected an array of 3 or 4 values for a color, got ${n.length}`)}if(!_r(t,qe))throw new Error(`got an array of numbers, but expected ${He(t)}`);return new ut(qe,n)}var S={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">
1=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},Mg={[S.Get]:W(V(1,1/0),Fu),[S.Var]:Pg(),[S.Has]:W(V(1,1/0),Fu),[S.Id]:W(Og,vn),[S.Concat]:W(V(2,1/0),it(Dt)),[S.GeometryType]:W(bg,vn),[S.LineMetric]:W(Dg,vn),[S.Resolution]:W(el,vn),[S.Zoom]:W(el,vn),[S.Time]:W(el,vn),[S.Any]:W(V(2,1/0),it(bt)),[S.All]:W(V(2,1/0),it(bt)),[S.Not]:W(V(1,1),it(bt)),[S.Equal]:W(V(2,2),Nu()),[S.NotEqual]:W(V(2,2),Nu()),[S.GreaterThan]:W(V(2,2),it(q)),[S.GreaterThanOrEqualTo]:W(V(2,2),it(q)),[S.LessThan]:W(V(2,2),it(q)),[S.LessThanOrEqualTo]:W(V(2,2),it(q)),[S.Multiply]:W(V(2,1/0),ku),[S.Coalesce]:W(V(2,1/0),ku),[S.Divide]:W(V(2,2),it(q)),[S.Add]:W(V(2,1/0),it(q)),[S.Subtract]:W(V(2,2),it(q)),[S.Clamp]:W(V(3,3),it(q)),[S.Mod]:W(V(2,2),it(q)),[S.Pow]:W(V(2,2),it(q)),[S.Abs]:W(V(1,1),it(q)),[S.Floor]:W(V(1,1),it(q)),[S.Ceil]:W(V(1,1),it(q)),[S.Round]:W(V(1,1),it(q)),[S.Sin]:W(V(1,1),it(q)),[S.Cos]:W(V(1,1),it(q)),[S.Atan]:W(V(1,2),it(q)),[S.Sqrt]:W(V(1,1),it(q)),[S.Match]:W(V(4,1/0),Gu,kg),[S.Between]:W(V(3,3),it(q)),[S.Interpolate]:W(V(6,1/0),Gu,Ng),[S.Case]:W(V(3,1/0),Fg,Gg),[S.In]:W(V(2,2),Xg),[S.Number]:W(V(1,1/0),it(bs)),[S.String]:W(V(1,1/0),it(bs)),[S.Array]:W(V(1,1/0),it(q)),[S.Color]:W(V(1,4),it(q)),[S.Band]:W(V(1,3),it(q)),[S.Palette]:W(V(2,2),zg),[S.ToString]:W(V(1,1),it(bt|q|Dt|Gt))};function Fu(n,t,e){let i=n.length-1,r=new Array(i);for(let s=0;s<i;++s){let o=n[s+1];switch(typeof o){case"number":{r[s]=new ut(q,o);break}case"string":{r[s]=new ut(Dt,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}s===0&&e.properties.set(String(o),t)}return r}function Pg(){return function(n,t,e){let i=n[1];if(typeof i!="string")throw new Error("expected a string argument for var operation");let r=t,s=e.inputVariables?.[i];if(s!==void 0){let o=gt(s,bs,e);if(!(o instanceof ut))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${i}`);let a=o.type;if(typeof s=="string"&&Ps(r,Gt)&&!Ps(r,Dt)?a=Gt:Array.isArray(s)&&s.length===2&&Ps(r,Ki)&&!Ps(r,qe)&&(a=Ki),r&=a,r===Os)throw new Error(`the type expected from the var operator (${He(t)}) did not have any overlap with the type of the corresponding style variables (${He(a)}), variable name: ${i}`)}if(e.variables.has(i)){let o=e.variables.get(i);if(r&=o,r===Os)throw new Error(`a new type expected from the var operator (${He(t)}) did not have any overlap with the previous type expected for it (${He(o)}), variable name: ${i}`)}return e.variables.set(i,r),new Ds(r,"var",new ut(Dt,i))}}function Og(n,t,e){e.featureId=!0}function bg(n,t,e){e.geometryType=!0}function Dg(n,t,e){e.mCoordinate=!0}function el(n,t,e){e.mapState=!0}function vn(n,t,e){let i=n[0];if(n.length!==1)throw new Error(`expected no arguments for ${i} operation`);return[]}function V(n,t){return function(e,i,r){let s=e[0],o=e.length-1;if(n===t){if(o!==n){let a=n===1?"":"s";throw new Error(`expected ${n} argument${a} for ${s}, got ${o}`)}}else if(o<n||o>t){let a=t===1/0?`${n} or more`:`${n} to ${t}`;throw new Error(`expected ${a} arguments for ${s}, got ${o}`)}}}function ku(n,t,e){let i=n.length-1,r=new Array(i);for(let s=0;s<i;++s){let o=gt(n[s+1],t,e);r[s]=o}return r}function it(n){return function(t,e,i){let r=t.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=gt(t[o+1],n,i);s[o]=a}return s}}function Nu(){return function(n,t,e){let i=n[0],r=n.length-1,s=new Array(r),o=bs;for(let a=0;a<r;++a){let l=gt(n[a+1],o,e);o&=l.type}if(o===Os)throw new Error(`no common type was found among the arguments of ${i}`);for(let a=0;a<r;++a){let l=gt(n[a+1],o,e);s[a]=l}return s}}function Fg(n,t,e){let i=n[0],r=n.length-1;if(r%2===0)throw new Error(`expected an odd number of arguments for ${i}, got ${r} instead`)}function Gu(n,t,e){let i=n[0],r=n.length-1;if(r%2===1)throw new Error(`expected an even number of arguments for operation ${i}, got ${r} instead`)}function kg(n,t,e){let i=n.length-1,r=gt(n[n.length-1],t,e),s=Dt|q|bt,o=new Array(i-2);for(let l=0;l<i-2;l+=2){try{let c=gt(n[l+2],s,e);s&=c.type}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}if(s===Os)throw new Error("no common type was found among the arguments of match expression")}for(let l=0;l<i-2;l+=2){try{let c=gt(n[l+2],s,e);o[l]=c}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}try{let c=gt(n[l+3],r.type,e);o[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+2} of match expression: ${c.message}`)}}return[gt(n[1],s,e),...o,r]}function Ng(n,t,e){let i=n[1],r;switch(i[0]){case"linear":r=1;break;case"exponential":let l=i[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);r=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(i)}`)}let s=new ut(q,r),o;try{o=gt(n[2],q,e)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}let a=new Array(n.length-3);for(let l=0;l<a.length;l+=2){try{let c=gt(n[l+3],q,e);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{let c=gt(n[l+4],t,e);a[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${c.message}`)}}return[s,o,...a]}function Gg(n,t,e){let i=gt(n[n.length-1],t,e),r=new Array(n.length-1);for(let s=0;s<r.length-1;s+=2){try{let o=gt(n[s+1],bt,e);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=gt(n[s+2],i.type,e);r[s+1]=o}catch(o){throw new Error(`failed to parse argument ${s+1}
1 of case expression: ${o.message}`)}}return r[r.length-1]=i,r}function Xg(n,t,e){let i=n[2];if(!Array.isArray(i))throw new Error('the second argument for the "in" operator must be an array');let r;if(i[0]==="literal"){if(i=i[1],!Array.isArray(i))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if(typeof i[0]=="string")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');typeof i[0]=="string"?r=Dt:r=q;let s=new Array(i.length);for(let a=0;a<s.length;a++)try{let l=gt(i[a],r,e);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[gt(n[1],r,e),...s]}function zg(n,t,e){let i;try{i=gt(n[1],q,e)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}let r=n[2];if(!Array.isArray(r))throw new Error("the second argument of palette must be an array");let s=new Array(r.length);for(let o=0;o<s.length;o++){let a;try{a=gt(r[o],Gt,e)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof ut))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[i,...s]}function W(...n){return function(t,e,i){let r=t[0],s;for(let o=0;o<n.length;o++){let a=n[o](t,e,i);if(o==n.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");s=a}}return new Ds(e,r,...s)}}function Wg(n,t,e){let i=n[0],r=Mg[i];if(!r)throw new Error(`unknown operator: ${i}`);return r(n,t,e)}function ks(n){if(!n)return"";let t=n.getType();switch(t){case"Point":case"LineString":case"Polygon":return t;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return t.substring(5);case"Circle":return"Polygon";
1case"GeometryCollection":return ks(n.getGeometries()[0]);default:return""}}function nl(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function ye(n,t,e){let i=gt(n,t,e);return _e(i,e)}function _e(n,t){if(n instanceof ut){if(n.type===Gt&&typeof n.value=="string"){let i=mr(n.value);return function(){return i}}return function(){return n.value}}let e=n.operator;switch(e){case S.Number:case S.String:case S.Coalesce:return Ug(n,t);case S.Get:case S.Var:case S.Has:return Yg(n,t);case S.Id:return i=>i.featureId;case S.GeometryType:return i=>i.geometryType;case S.Concat:{let i=n.args.map(r=>_e(r,t));return r=>"".concat(...i.map(s=>s(r).toString()))}case S.Resolution:return i=>i.resolution;case S.Any:case S.All:case S.Between:case S.In:case S.Not:return Bg(n,t);case S.Equal:case S.NotEqual:case S.LessThan:case S.LessThanOrEqualTo:case S.GreaterThan:case S.GreaterThanOrEqualTo:return Kg(n,t);case S.Multiply:case S.Divide:case S.Add:case S.Subtract:case S.Clamp:case S.Mod:case S.Pow:case S.Abs:case S.Floor:case S.Ceil:case S.Round:case S.Sin:case S.Cos:case S.Atan:case S.Sqrt:return jg(n,t);case S.Case:return Vg(n,t);case S.Match:return Zg(n,t);case S.Interpolate:return Hg(n,t);case S.ToString:return qg(n,t);default:throw new Error(`Unsupported operator ${e}`)}}function Ug(n,t){let e=n.operator,i=n.args.length,r=new Array(i);for(let s=0;s<i;++s)r[s]=_e(n.args[s],t);switch(e){case S.Coalesce:return s=>{for(let o=0;o<i;++o){let a=r[o](s);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case S.Number:case S.String:return s=>{for(let o=0;o<i;++o){let a=r[o](s);if(typeof a===e)return a}throw new Error(`Expected one of the values to be a ${e}`)};default:throw new Error(`Unsupported assertion operator ${e}`)}}function Yg(n,t){let i=n.args[0].value;switch(n.operator){case S.Get:return r=>{let s=n.args,o=r.properties[i];for(let a=1,l=s.length;a<l;++a){let h=s[a].value;o=o[h]}return o};case S.Var:return r=>r.variables[i];case S.Has:return r=>{let s=n.args;if(!(i in r.properties))return!1;let o=r.properties[i];for(let a=1,l=s.length;a<l;++a){let h=s[a].value;if(!o||!Object.hasOwn(o,h))return!1;o=o[h]}return!0};default:throw new Error(`Unsupported accessor operator ${n.operator}`)}}function Kg(n,t){let e=n.operator,i=_e(n.args[0],t),r=_e(n.args[1],t);switch(e){case S.Equal:return s=>i(s)===r(s);case S.NotEqual:return s=>i(s)!==r(s);case S.LessThan:return s=>i(s)<r(s);case S.LessThanOrEqualTo:return s=>i(s)<=r(s);case S.GreaterThan:return s=>i(s)>r(s);case S.GreaterThanOrEqualTo:return s=>i(s)>=r(s);default:throw new Error(`Unsupported comparison operator ${e}`)}}function Bg(n,t){let e=n.operator,i=n.args.length,r=new Array(i);for(let s=0;s<i;++s)r[s]=_e(n.args[s],t);switch(e){case S.Any:return s=>{for(let o=0;o<i;++o)if(r[o](s))return!0;return!1};case S.All:return s=>{for(let o=0;o<i;++o)if(!r[o](s))return!1;return!0};case S.Between:return s=>{let o=r[0](s),a=r[1](s),l=r[2](s);return o>=a&&o<=l};case S.In:return s=>{let o=r[0](s);for(let a=1;a<i;++a)if(o===r[a](s))return!0;return!1};case S.Not:return s=>!r[0](s);default:throw new Error(`Unsupported logical operator ${e}`)}}function jg(n,t){let e=n.operator,i=n.args.length,r=new Array(i);for(let s=0;s<i;++s)r[s]=_e(n.args[s],t);switch(e){case S.Multiply:return s=>{let o=1;for(let a=0;a<i;++a)o*=r[a](s);return o};case S.Divide:return s=>r[0](s)/r[1](s);case S.Add:return s=>{let o=0;for(let a=0;a<i;++a)o+=r[a](s);return o};case S.Subtract:return s=>r[0](s)-r[1](s);case S.Clamp:return s=>{let o=r[0](s),a=r[1](s);if(o<a)return a;let l=r[2](s);return o>l?l:o};case S.Mod:return s=>r[0](s)%r[1](s);case S.Pow:return s=>Math.pow(r[0](s),r[1](s));case S.Abs:return s=>Math.abs(r[0](s));case S.Floor:return s=>Math.floor(r[0](s));case S.Ceil:return s=>Math.ceil(r[0](s));case S.Round:return s=>Math.round(r[0](s));case S.Sin:return s=>Math.sin(r[0](s));case S.Cos:return s=>Math.cos(r[0](s));case S.Atan:return i===2?s=>Math.atan2(r[0](s),r[1](s)):s=>Math.atan(r[0](s));case S.Sqrt:return s=>Math.sqrt(r[0](s));default:throw new Error(`Unsupported numeric operator ${e}`)}}function Vg(n,t){let e=n.args.length,i=new Array(e);for(let r=0;r<e;++r)i[r]=_e(n.args[r],t);return r=>{for(let s=0;s<e-1;s+=2)if(i[s](r))return i[s+1](r);return i[e-1](r)}}function Zg(n,t){let e=n.args.length,i=new Array(e);for(let r=0;r<e;++r)i[r]=_e(n.args[r],t);return r=>{let s=i[0](r);for(let o=1;o<e-1;o+=2)if(s===i[o](r))return i[o+1](r);return i[e-1](r)}}function Hg(n,t){let e=n.args.length,i=new Array(e);for(let r=0;r<e;++r)i[r]=_e(n.args[r],t);return r=>{let s=i[0](r),o=i[1](r),a,l;for(let c=2;c<e;c+=2){let h=i[c](r),u=i[c+1](r),f=Array.isArray(u);if(f&&(u=Ou(u)),h>
1=o)return c===2?u:f?$g(s,o,a,l,h,u):yr(s,o,a,l,h,u);a=h,l=u}return l}}function qg(n,t){let e=n.operator,i=n.args.length,r=new Array(i);for(let s=0;s<i;++s)r[s]=_e(n.args[s],t);if(e===S.ToString)return s=>{let o=r[0](s);return n.args[0].type===Gt?pr(o):o.toString()};throw new Error(`Unsupported convert operator ${e}`)}function yr(n,t,e,i,r,s){let o=r-e;if(o===0)return i;let a=t-e,l=n===1?a/o:(Math.pow(n,a)-1)/(Math.pow(n,o)-1);return i+l*(s-i)}function $g(n,t,e,i,r,s){if(r-e===0)return i;let a=Qa(i),l=Qa(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let h=[yr(n,t,e,a[0],r,l[0]),yr(n,t,e,a[1],r,l[1]),a[2]+yr(n,t,e,0,r,c),yr(n,t,e,i[3],r,s[3])];return bu(h)}var z={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Xu(n,t,e){let i=n,r=!0,s=!1,o=!1,a=[tn(i,M.LOAD,function(){o=!0,s||t()})];return i.src&&vo?(s=!0,i.decode().then(function(){r&&t()}).catch(function(l){r&&(o?t():e())})):a.push(tn(i,M.ERROR,e)),function(){r=!1,a.forEach(H)}}function Jg(n,t){return new Promise((e,i)=>{function r(){o(),e(n)}function s(){o(),i(new Error("Image load error"))}function o(){n.removeEventListener("load",r),n.removeEventListener("error",s)}n.addEventListener("load",r),n.addEventListener("error",s),t&&(n.src=t)})}function zu(n,t){return t&&(n.src=t),n.src&&vo?new Promise((e,i)=>n.decode().then(()=>e(n)).catch(r=>n.complete&&n.width?e(n):i(r))):Jg(n)}var sl=class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(let e in this.cache_){let i=this.cache_[e];(t++&3)===0&&!i.hasListener()&&(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e){let i=rl(t,e);return i in this.cache_?this.cache_[i]:null}getPattern(t,e){let i=rl(t,e);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,i,r){let s=rl(t,e),o=s in this.cache_;this.cache_[s]=i,r&&(i.getImageState()===z.IDLE&&i.load(),i.getImageState()===z.LOADING?i.ready().then(()=>{this.patternCache_[s]=sr().createPattern(i.getImage(1),"repeat")}):this.patternCache_[s]=sr().createPattern(i.getImage(1),"repeat")),o||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};function rl(n,t){let e=t?ae(t):"null";return n+":"+e}var Ft=new sl;var xr=null,Ns=class extends li{constructor(t,e,i,r,s){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i?.crossOrigin,this.referrerPolicy_=i?.referrerPolicy,this.canvas_={},this.color_=s,this.imageState_=r===void 0?z.IDLE:r,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===z.LOADED){xr||(xr=tt(1,1,void 0,{willReadFrequently:!0})),xr.drawImage(this.image_,0,0);try{xr.getImageData(0,0,1,1),this.tainted_=!1}catch{xr=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(M.CHANGE)}handleImageError_(){this.imageState_=z.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=z.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_}setImage(t){this.image_=t}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_()){let t=this.size_[0],e=this.size_[1],i=tt(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_===z.IDLE){this.image_||this.initializeImage_(),this.imageState_=z.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&zu(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_!==z.LOADED)return;let e=this.image_,i=tt(Math.ceil(e.width*t),Math.ceil(e.height*t)),r=i.canvas;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle=Pu(this.color_),i.fillRect(0,0,r.width/t,r.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=r}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===z.LOADED||this.imageState_===z.ERROR)t();else{let e=()=>{(this.imageState_===z.LOADED||this.imageState_===z.ERROR)&&(this.removeEventListener(M.CHANGE,e),t())};this.addEventListener(M.CHANGE,e)}}
1)),this.ready_}};function Ei(n,t,e,i,r,s){let o=t===void 0?void 0:Ft.get(t,r);return o||(o=new Ns(n,n&&"src"in n?n.src||void 0:t,e,i,r),Ft.set(t,r,o,s)),s&&o&&!Ft.getPattern(t,r)&&Ft.set(t,r,o,s),o}var Wu=Ns;function Ut(n){return n?Array.isArray(n)?pr(n):typeof n=="object"&&"src"in n?Qg(n):n:null}function Qg(n){if(!n.offset||!n.size)return Ft.getPattern(n.src,n.color);let t=n.src+":"+n.offset,e=Ft.getPattern(t,n.color);if(e)return e;let i=Ft.get(n.src,null);if(i.getImageState()!==z.LOADED)return null;let r=tt(n.size[0],n.size[1]);return r.drawImage(i.getImage(1),n.offset[0],n.offset[1],n.size[0],n.size[1],0,0,n.size[0],n.size[1]),Ei(r.canvas,t,void 0,z.LOADED,n.color,!0),Ft.getPattern(t,n.color)}var Gs="10px sans-serif",Tt="#000",Oe="round",Yt=[],Kt=0,be="round",$e=10,Yu=0,kt="#000",Ci="center",Vi="middle",Je=[0,0,0,0],Qe=1,ji=new _t,Er=null,Uu,ol={},tm=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function em(n,t,e){return`${n} ${t} 16px "${e}"`}var Ku=(function(){let t,e;async function i(s){await e.ready;let o=_s(s),a=o.families[0].toLowerCase(),l=o.weight,c=[];return e.forEach(u=>{let f=u.family.replace(/^['"]|['"]$/g,"").toLowerCase(),d=ps[u.weight]||u.weight;f===a&&u.style===o.style&&d==l&&c.push(u)}),c.length===0?!1:(await Promise.all(c.map(u=>u.load().then(()=>!0,()=>!1)))).some(u=>u)}async function r(){await e.ready;let s=!0,o=ji.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){let c=a[l],h=o[c];h<100&&(await i(c)?(we(ol),ji.set(c,100)):(h+=10,ji.set(c,h,!0),h<100&&(s=!1)))}t=void 0,s||(t=setTimeout(r,100))}return async function(s){e||(e=wt?self.fonts:document.fonts);let o=_s(s);if(!o)return;let a=o.families,l=!1;for(let c of a){if(tm.has(c))continue;let h=em(o.style,o.weight,c);ji.get(h)===void 0&&(ji.set(h,0,!0),l=!0)}l&&(clearTimeout(t),t=setTimeout(r,100))}})(),im=(function(){let n;return function(t){let e=ol[t];if(e==null){if(wt){let i=_s(t),r=Bu(t,"\u017Dg");e=(isNaN(Number(i.lineHeight))?1.2:Number(i.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else n||(n=document.createElement("div"),n.innerHTML="M",n.style.minHeight="0",n.style.maxHeight="none",n.style.height="auto",n.style.padding="0",n.style.border="none",n.style.position="absolute",n.style.display="block",n.style.left="-99999px"),n.style.font=t,document.body.appendChild(n),e=n.offsetHeight,document.body.removeChild(n);ol[t]=e}return e}})();function Bu(n,t){return Er||(Er=tt(1,1)),n!=Uu&&(Er.font=n,Uu=Er.font),Er.measureText(t)}function ju(n,t){return Bu(n,t).width}function al(n,t,e){if(t in e)return e[t];let i=t.split(`
2`).reduce((r,s)=>Math.max(r,ju(n,s)),0);return e[t]=i,i}function Vu(n,t){let e=[],i=[],r=[],s=0,o=0,a=0,l=0;for(let c=0,h=t.length;c<=h;c+=2){let u=t[c];if(u===`
3`||c===h){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}let f=t[c+1]||n.font,d=ju(f,u);e.push(d),o+=d;let g=im(f);i.push(g),l=Math.max(l,g)}return{width:s,height:a,widths:e,heights:i,lineWidths:r}}function Zu(n,t,e,i,r,s,o,a,l,c,h){n.save(),e!==1&&(n.globalAlpha===void 0?n.globalAlpha=u=>u.globalAlpha*=e:n.globalAlpha*=e),t&&n.transform.apply(n,t),i.contextInstructions?(n.translate(l,c),n.scale(h[0],h[1]),nm(i,n)):h[0]<0||h[1]<0?(n.translate(l,c),n.scale(h[0],h[1]),n.drawImage(i,r,s,o,a,0,0,o,a)):n.drawImage(i,r,s,o,a,l,c,o*h[0],a*h[1]),n.restore()}function nm(n,t){let e=n.contextInstructions;for(let i=0,r=e.length;i<r;i+=2)Array.isArray(e[i+1])?t[e[i]].apply(t,e[i+1]):t[e[i]]=e[i+1]}var ll=class n{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=dt(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){let t=this.getScale();return new n({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 j()}getImage(t){return j()}getHitDetectionImage(){return j()}getPixelRatio(t){return 1}getImageState(){return j()}getImageSize(){return j()}getOrigin(){return j()}getSize(){return j()}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_=dt(t)}listenImageChange(t){j()}load(){j()}unlistenImageChange(t){j()}ready(){return Promise.resolve()}},Xs=ll;var hl=class n extends Xs{constructor(t){super({opacity:1,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,rotation:t.rotation!==void 0?t.rotation:0,scale:t.scale!==void 0?t.scale:1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=t.fill!==void 0?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=t.angle!==void 0?t.angle:0,this.stroke_=t.stroke!==void 0?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?z.LOADING:z.LOADED,this.imageState_===z.LOADING&&this.ready().then(()=>this.imageState_=z.LOADED),this.render()}clone(){let t=this.getScale(),e=new n({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.get
3Stroke().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(){let t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){let e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(","),r=Ft.get(i,null)?.getImage(1);if(!r){let s=this.renderOptions_,o=Math.ceil(s.size*t),a=tt(o,o);this.draw_(s,a,t),r=a.canvas;let l=new Wu(r,void 0,null,z.LOADED,null);Ft.set(i,null,l),createImageBitmap(r).then(c=>{l.setImage(c)})}return r}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(t){this.radius!==t&&(this.radius=t,this.render())}getRadius2(){return this.radius2_}setRadius2(t){this.radius2_!==t&&(this.radius2_=t,this.render())}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(e===0||this.points_===1/0||t!=="bevel"&&t!=="miter")return e;let r=this.radius,s=this.radius2_===void 0?r:this.radius2_;if(r<s){let R=r;r=s,s=R}let o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=s*Math.sin(a),c=Math.sqrt(s*s-l*l),h=r-c,u=Math.sqrt(l*l+h*h),f=u/l;if(t==="miter"&&f<=i)return f*e;let d=e/2/f,g=e/2*(h/u),m=Math.sqrt((r+d)*(r+d)+g*g)-r;if(this.radius2_===void 0||t==="bevel")return m*2;let _=r*Math.sin(a),x=Math.sqrt(r*r-_*_),C=s-x,E=Math.sqrt(_*_+C*C)/_;if(E<=i){let R=E*e/2-s-r;return 2*Math.max(m,R)}return m*2}createRenderOptions(){let t=Oe,e=be,i=0,r=null,s=0,o,a=0;this.stroke_&&(o=Ut(this.stroke_.getColor()??kt),a=this.stroke_.getWidth()??Qe,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,e=this.stroke_.getLineJoin()??be,t=this.stroke_.getLineCap()??Oe,i=this.stroke_.getMiterLimit()??$e);let l=this.calculateLineJoinSize_(e,a,i),c=Math.max(this.radius,this.radius2_||0),h=Math.ceil(2*c+l);return{strokeStyle:o,strokeWidth:a,size:h,lineCap:t,lineDash:r,lineDashOffset:s,lineJoin:e,miterLimit:i}}render(){this.renderOptions_=this.createRenderOptions();let t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let r=this.fill_.getColor();r===null&&(r=Tt),e.fillStyle=Ut(r),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),r=0;typeof i=="string"&&(i=ae(i)),i===null?r=1:Array.isArray(i)&&(r=i.length===4?i[3]:1),r===0&&(e=tt(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_,i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{let r=this.radius2_===void 0?i:this.radius2_;this.radius2_!==void 0&&(e*=2);let s=this.angle_-Math.PI/2,o=2*Math.PI/e;for(let a=0;a<e;a++){let l=s+a*o,c=a%2===0?i:r;t.lineTo(c*Math.cos(l),c*Math.sin(l))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=Tt,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}},zs=hl;var cl=class n extends zs{constructor(t){t=t||{radius:5},super({points:1/0,fill:t.fill,radius:t.radius,stroke:t.stroke,scale:t.scale!==void 0?t.scale:1,rotation:t.rotation!==void 0?t.rotation:0,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){let t=this.getScale(),e=new n({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.get
3Stroke().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}},ti=cl;var ul=class n{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,t.color!==void 0&&this.setColor(t.color)}clone(){let t=this.getColor();return new n({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(t!==null&&typeof t=="object"&&"src"in t){let e=Ei(null,t.src,{crossOrigin:"anonymous"},void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===z.IDLE&&e.load(),e.getImageState()===z.LOADING&&(this.patternImage_=e)}this.color_=t}getKey(){let t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?F(t):typeof t=="object"&&"src"in t?t.src+":"+t.offset:ae(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},Xt=ul;function Hu(n,t,e,i){return e!==void 0&&i!==void 0?[e/n,i/t]:e!==void 0?e/n:i!==void 0?i/t:1}var fl=class n extends Xs{constructor(t){t=t||{};let e=t.opacity!==void 0?t.opacity:1,i=t.rotation!==void 0?t.rotation:0,r=t.scale!==void 0?t.scale:1,s=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:e,rotation:i,scale:r,displacement:t.displacement!==void 0?t.displacement:[0,0],rotateWithView:s,declutterMode:t.declutterMode}),this.anchor_=t.anchor!==void 0?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=t.anchorOrigin!==void 0?t.anchorOrigin:"top-left",this.anchorXUnits_=t.anchorXUnits!==void 0?t.anchorXUnits:"fraction",this.anchorYUnits_=t.anchorYUnits!==void 0?t.anchorYUnits:"fraction",this.crossOrigin_=t.crossOrigin!==void 0?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy;let o=t.img!==void 0?t.img:null,a=t.src;Y(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||F(o)),Y(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),Y(!((t.width!==void 0||t.height!==void 0)&&t.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(t.src!==void 0?l=z.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?z.LOADED:z.IDLE:l=z.LOADING:l=z.LOADED),this.color_=t.color!==void 0?ae(t.color):null,this.iconImage_=Ei(o,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},l,this.color_),this.offset_=t.offset!==void 0?t.offset:[0,0],this.offsetOrigin_=t.offsetOrigin!==void 0?t.offsetOrigin:"top-left",this.origin_=null,this.size_=t.size!==void 0?t.size:null,this.initialOptions_,t.width!==void 0||t.height!==void 0){let c,h;if(t.size)[c,h]=t.size;else{let u=this.getImage(1);if(u.width&&u.height)c=u.width,h=u.height;else if(u instanceof HTMLImageElement){this.initialOptions_=t;let f=()=>{if(this.unlistenImageChange(f),!this.initialOptions_)return;let d=this.iconImage_.getSize();this.setScale(Hu(d[0],d[1],t.width,t.height))};this.listenImageChange(f);return}}c!==void 0&&this.setScale(Hu(c,h,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 n({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:this.size_!==null?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_;let r=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!r)return null;t=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(t[0]*=r[0]),this.anchorYUnits_=="fraction"&&(t[1]*=r[1])}if(this.anchorOrigin_!="top-left"){if(!r)return null;t===this.anchor_&&(t=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(t[0]=-t[0]+r[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(t[1]=-t[1]+r[1])}this.normalizedAnchor_=t}let 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_}setColor(t){let e=t?ae(t):null;if(this.color_===e||this.color_&&e&&this.color_.length===e.length&&this.color_.every((o,a)=>o===e[a]))return;this.color_=e;let i=this.getSrc(),r=i!==void 0?null:this.getHitDetectionImage(),s=i!==void 0?z.IDLE:this.iconImage_.getImageState();this.iconImage_=Ei(r,i,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},s,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(this.offsetOrigin_!="top-left"){let e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=i[0]-e[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=Ei(null,t,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},z.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){let t=this.getScaleArray();if(this.size_)return this.size_[0]*t[0];if(this.iconImage_.getImageState()==z.LOADED)return this.iconImage_.getSize()[0]*t[0]}getHeight(){let t=this.getScaleArray();if(this.size_)return this.size_[1]*t[1];if(this.iconImage_.getImageState()==z.LOADED)return this.iconImage_.getSize()[1]*t[1]}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(M.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(M.CHANGE,t)}ready(){return this.iconImage_.ready()}},Ws=fl;var dl=class n{constructor(t){t=t||{},this.color_=t.color!==void 0?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=t.lineDash!==void 0?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.offset_=t.offset,this.width_=t.width}clone(){let t=this.getColor();return new n({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(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(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}setOffset(t){this.offset_=t}setWidth(t){this.width_=t}},le=dl;var Si=class n{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=qu,t.geometry!==void 0&&this.setGeometry(t.geometry),this.fill_=t.fill!==void 0?t.fill:null,this.image_=t.image!==void 0?t.image:null,this.renderer_=t.renderer!==void 0?t.renderer:null,this.hitDetectionRenderer_=t.hitDetectionRenderer!==void 0?t.hitDetectionRenderer:null,this.stroke_=t.stroke!==void 0?t.stroke:null,this.text_=t.text!==void 0?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&typeof t=="object"&&(t=t.clone()),new n({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.get
3Stroke().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){typeof t=="function"?this.geometryFunction_=t:typeof t=="string"?this.geometryFunction_=function(e){return e.get(t)}:t?t!==void 0&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=qu,this.geometry_=t}setZIndex(t){this.zIndex_=t}};function $u(n){let t;if(typeof n=="function")t=n;else{let e;Array.isArray(n)?e=n:(Y(typeof n.getZIndex=="function","Expected an `Style` or an array of `Style`"),e=[n]),t=function(){return e}}return t}var gl=null;function ml(n,t){if(!gl){let e=new Xt({color:"rgba(255,255,255,0.4)"}),i=new le({color:"#3399CC",width:1.25});gl=[new Si({image:new ti({fill:e,stroke:i,radius:5}),fill:e,stroke:i})]}return gl}function Ju(){let n={},t=[255,255,255,1],e=[0,153,255,1],i=3;return n.Polygon=[new Si({fill:new Xt({color:[255,255,255,.5]})})],n.MultiPolygon=n.Polygon,n.LineString=[new Si({stroke:new le({color:t,width:i+2})}),new Si({stroke:new le({color:e,width:i})})],n.MultiLineString=n.LineString,n.Circle=n.Polygon.concat(n.LineString),n.Point=[new Si({image:new ti({radius:i*2,fill:new Xt({color:e}),stroke:new le({color:t,width:i/2})}),zIndex:1/0})],n.MultiPoint=n.Point,n.GeometryCollection=n.Polygon.concat(n.LineString,n.Point),n}function qu(n){return n.getGeometry()}var De=Si;var rm="#333",pl=class n{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=dt(t.scale!==void 0?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_=t.fill!==void 0?t.fill:new Xt({color:rm}),this.maxAngle_=t.maxAngle!==void 0?t.maxAngle:Math.PI/4,this.placement_=t.placement!==void 0?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=t.stroke!==void 0?t.stroke:null,this.offsetX_=t.offsetX!==void 0?t.offsetX:0,this.offsetY_=t.offsetY!==void 0?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=t.padding===void 0?null:t.padding,this.declutterMode_=t.declutterMode}clone(){let t=this.getScale();return new n({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof Xt?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}
3getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=dt(t!==void 0?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}},Cr=pl;function sm(n){return!0}function om(n,t){t=t??Fs();let e=am(n,t),i=nl();return function(r,s){if(i.properties=r.getPropertiesInternal(),i.resolution=s,t.featureId){let o=r.getId();o!==void 0?i.featureId=o:i.featureId=null}return t.geometryType&&(i.geometryType=ks(r.getGeometry())),e(i)}}function Qu(n,t){t=t??Fs();let e=n.length,i=new Array(e);for(let o=0;o<e;++o)i[o]=_l(n[o],t);let r=nl(),s=new Array(e);return function(o,a){if(r.properties=o.getPropertiesInternal(),r.resolution=a,t.featureId){let c=o.getId();c!==void 0?r.featureId=c:r.featureId=null}t.geometryType&&(r.geometryType=ks(o.getGeometry()));let l=0;for(let c=0;c<e;++c){let h=i[c](r);h&&(s[l]=h,l+=1)}return s.length=l,s}}function rf(n,t){if(t=t??Fs(),!Array.isArray(n))return Qu([n],t);let e=n.length;if("style"in n[0]){let s=new Array(e);for(let o=0;o<e;++o){let a=n[o];if(!("style"in a))throw new Error("Expected a list of rules with a style property");s[o]=a}return om(s,t)}return Qu(n,t)}function am(n,t){let e=n.length,i=new Array(e);for(let r=0;r<e;++r){let s=n[r],o="filter"in s?ye(s.filter,bt,t):sm,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=_l(s.style[c],t)}else a=[_l(s.style,t)];i[r]={filter:o,styles:a}}return function(r){let s=[],o=!1;for(let a=0;a<e;++a){let l=i[a].filter;if(l(r)&&!(n[a].else&&o)){o=!0;for(let c of i[a].styles){let h=c(r);h&&s.push(h)}}}return s}}function _l(n,t){let e=Sr(n,"",t),i=wr(n,"",t),r=lm(n,t),s=hm(n,t),o=Mt(n,"z-index",t);if(!e&&!i&&!r&&!s&&!ce(n))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(n));let a=new De;return function(l){let c=!0;if(e){let h=e(l);h&&(c=!1),a.setFill(h)}if(i){let h=i(l);h&&(c=!1),a.setStroke(h)}if(r){let h=r(l);h&&(c=!1),a.setText(h)}if(s){let h=s(l);h&&(c=!1),a.setImage(h)}return o&&a.setZIndex(o(l)),c?null:a}}function Sr(n,t,e){let i;if(t+"fill-pattern-src"in n)i=dm(n,t+"fill-",e);else{if(n[t+"fill-color"]==="none")return s=>null;i=Ys(n,t+"fill-color",e)}if(!i)return null;let r=new Xt;return function(s){let o=i(s);return o===Ms?null:(r.setColor(o),r)}}function wr(n,t,e){let i=Mt(n,t+"stroke-width",e),r=Ys(n,t+"stroke-color",e);if(!i&&!r)return null;let s=ei(n,t+"stroke-line-cap",e),o=ei(n,t+"stroke-line-join",e),a=sf(n,t+"stroke-line-dash",e),l=Mt(n,t+"stroke-line-dash-offset",e),c=Mt(n,t+"stroke-miter-limit",e),h=Mt(n,t+"stroke-offset",e),u=new le;return function(f){if(r){let d=r(f);if(d===Ms)return null;u.setColor(d)}if(i&&u.setWidth(i(f)),s){let d=s(f);if(d!=="butt"&&d!=="round"&&d!=="square")throw new Error("Expected butt, round, or square line cap");u.setLineCap(d)}if(o){let d=o(f);if(d!=="bevel"&&d!=="round"&&d!=="miter")throw new Error("Expected bevel, round, or miter line join");u.setLineJoin(d)}return a&&u.setLineDash(a(f)),l&&u.setLineDashOffset(l(f)),c&&u.setMiterLimit(c(f)),h&&u.setOffset(h(f)),u}}function lm(n,t){let e="text-",i=ei(n,e+"value",t);if(!i)return null;let r=Sr(n,e,t),s=Sr(n,e+"background-",t),o=wr(n,e,t),a=wr(n,e+"background-",t),l=ei(n,e+"font",t),c=Mt(n,e+"max-angle",t),h=Mt(n,e+"offset-x",t),u=Mt(n,e+"offset-y",t),f=Ln(n,e+"overflow",t),d=ei(n,e+"placement",t),g=Mt(n,e+"repeat",t),p=Ks(n,e+"scale",t),m=Ln(n,e+"rotate-with-view",t),_=Mt(n,e+"rotation",t),x=ei(n,e+"align",t),C=ei(n,e+"justify",t),y=e
3i(n,e+"baseline",t),E=Ln(n,e+"keep-upright",t),R=sf(n,e+"padding",t),L=Bs(n,e+"declutter-mode"),w=new Cr({declutterMode:L});return function(T){if(w.setText(i(T)),r&&w.setFill(r(T)),s&&w.setBackgroundFill(s(T)),o&&w.setStroke(o(T)),a&&w.setBackgroundStroke(a(T)),l&&w.setFont(l(T)),c&&w.setMaxAngle(c(T)),h&&w.setOffsetX(h(T)),u&&w.setOffsetY(u(T)),f&&w.setOverflow(f(T)),d){let I=d(T);if(I!=="point"&&I!=="line")throw new Error("Expected point or line for text-placement");w.setPlacement(I)}if(g&&w.setRepeat(g(T)),p&&w.setScale(p(T)),m&&w.setRotateWithView(m(T)),_&&w.setRotation(_(T)),x){let I=x(T);if(I!=="left"&&I!=="center"&&I!=="right"&&I!=="end"&&I!=="start")throw new Error("Expected left, right, center, start, or end for text-align");w.setTextAlign(I)}if(C){let I=C(T);if(I!=="left"&&I!=="right"&&I!=="center")throw new Error("Expected left, right, or center for text-justify");w.setJustify(I)}if(y){let I=y(T);if(I!=="bottom"&&I!=="top"&&I!=="middle"&&I!=="alphabetic"&&I!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");w.setTextBaseline(I)}return R&&w.setPadding(R(T)),E&&w.setKeepUpright(E(T)),w}}function hm(n,t){return"icon-src"in n?cm(n,t):"shape-points"in n?um(n,t):"circle-radius"in n?fm(n,t):null}function cm(n,t){let e="icon-",i=e+"src",r=of(n[i],i),s=Us(n,e+"anchor",t),o=Ks(n,e+"scale",t),a=Mt(n,e+"opacity",t),l=Us(n,e+"displacement",t),c=Mt(n,e+"rotation",t),h=Ln(n,e+"rotate-with-view",t),u=ef(n,e+"anchor-origin"),f=nf(n,e+"anchor-x-units"),d=nf(n,e+"anchor-y-units"),g=ii(n,e+"color"),p,m=null;g!==void 0&&(Array.isArray(g)&&g.length>0&&typeof g[0]=="string"?m=Ys(n,e+"color",t):p=af(g,e+"color"));let _=mm(n,e+"cross-origin"),x=pm(n,e+"offset"),C=ef(n,e+"offset-origin"),y=yl(n,e+"width"),E=yl(n,e+"height"),R=gm(n,e+"size"),L=Bs(n,e+"declutter-mode"),w={src:r,anchorOrigin:u,anchorXUnits:f,anchorYUnits:d,crossOrigin:_,offset:x,offsetOrigin:C,height:E,width:y,size:R,declutterMode:L},T=null;return function(I){if(T)m&&T.setColor(m(I));else{let k=m?m(I):p;T=new Ws(k!==void 0?Object.assign({},w,{color:k}):Object.assign({},w))}return a&&T.setOpacity(a(I)),l&&T.setDisplacement(l(I)),c&&T.setRotation(c(I)),h&&T.setRotateWithView(h(I)),o&&T.setScale(o(I)),s&&T.setAnchor(s(I)),T}}function um(n,t){let e="shape-",i=e+"points",r=e+"radius",s=xl(n[i],i);if(!(r in n))throw new Error(`Expected a number for ${r}`);let o=Mt(n,r,t),a=typeof n[r]=="number"?n[r]:5,l=e+"radius2",c=Mt(n,l,t),h=typeof n[l]=="number"?n[l]:void 0,u=Sr(n,e,t),f=wr(n,e,t),d=Ks(n,e+"scale",t),g=Us(n,e+"displacement",t),p=Mt(n,e+"rotation",t),m=Ln(n,e+"rotate-with-view",t),_=yl(n,e+"angle"),x=Bs(n,e+"declutter-mode"),C=new zs({points:s,radius:a,radius2:h,angle:_,declutterMode:x});return function(y){return o&&C.setRadius(o(y)),c&&C.setRadius2(c(y)),u&&C.setFill(u(y)),f&&C.setStroke(f(y)),g&&C.setDisplacement(g(y)),p&&C.setRotation(p(y)),m&&C.setRotateWithView(m(y)),d&&C.setScale(d(y)),C}}function fm(n,t){let e="circle-",i=Sr(n,e,t),r=wr(n,e,t),s=Mt(n,e+"radius",t),o=Ks(n,e+"scale",t),a=Us(n,e+"displacement",t),l=Mt(n,e+"rotation",t),c=Ln(n,e+"rotate-with-view",t),h=Bs(n,e+"declutter-mode"),u=new ti({radius:5,declutterMode:h});return function(f){return s&&u.setRadius(s(f)),i&&u.setFill(i(f)),r&&u.setStroke(r(f)),a&&u.setDisplacement(a(f)),l&&u.setRotation(l(f)),c&&u.setRotateWithView(c(f)),o&&u.setScale(o(f)),u}}function ii(n,t){if(!(t in n))return;let e=n[t];return e===void 0?void 0:e}function Mt(n,t,e){let i=ii(n,t);if(i===void 0)return;let r=ye(i,q,e);return function(s){return xl(r(s),t)}}function ei(n,t,e){let i=ii(n,t);if(i===void 0)return null;let r=ye(i,Dt,e);return function(s){return of(r(s),t)}}function dm(n,t,e){let i=ei(n,t+"pattern-src",e),r=tf(n,t+"pattern-offset",e),s=tf(n,t+"pattern-size",e),o=Ys(n,t+"color",e);return function(a){return{src:i(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function Ln(n,t,e){let i=ii(n,t);if(i===void 0)return null;let r=ye(i,bt,e);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${t}`);return o}}function Ys(n,t,e){let i=ii(n,t);if(i===void 0)return null;let r=ye(i,Gt,e);return function(s){return af(r(s),t)}}function sf(n,t,e){let i=ii(n,t);if(i===void 0)return null;
3if(Array.isArray(i)&&(i.length===0||typeof i[0]!="string")){let s=i.map((o,a)=>{if(typeof o=="number")return()=>o;let l=ye(o,q,e);return function(c){return xl(l(c),`${t}[${a}]`)}});return function(o){let a=new Array(s.length);for(let l=0;l<s.length;++l)a[l]=s[l](o);return a}}let r=ye(i,qe,e);return function(s){return Rr(r(s),t)}}function Us(n,t,e){let i=ii(n,t);if(i===void 0)return null;let r=ye(i,qe,e);return function(s){let o=Rr(r(s),t);if(o.length!==2)throw new Error(`Expected two numbers for ${t}`);return o}}function tf(n,t,e){let i=ii(n,t);if(i===void 0)return null;let r=ye(i,qe,e);return function(s){return lf(r(s),t)}}function Ks(n,t,e){let i=ii(n,t);if(i===void 0)return null;let r=ye(i,qe|q,e);return function(s){return _m(r(s),t)}}function yl(n,t){let e=n[t];if(e!==void 0){if(typeof e!="number")throw new Error(`Expected a number for ${t}`);return e}}function gm(n,t){let e=n[t];if(e!==void 0){if(typeof e=="number")return dt(e);if(!Array.isArray(e))throw new Error(`Expected a number or size array for ${t}`);if(e.length!==2||typeof e[0]!="number"||typeof e[1]!="number")throw new Error(`Expected a number or size array for ${t}`);return e}}function mm(n,t){let e=n[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);return e}}function ef(n,t){let e=n[t];if(e!==void 0){if(e!=="bottom-left"&&e!=="bottom-right"&&e!=="top-left"&&e!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${t}`);return e}}function nf(n,t){let e=n[t];if(e!==void 0){if(e!=="pixels"&&e!=="fraction")throw new Error(`Expected pixels or fraction for ${t}`);return e}}function pm(n,t){let e=n[t];if(e!==void 0)return Rr(e,t)}function Bs(n,t){let e=n[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);if(e!=="declutter"&&e!=="obstacle"&&e!=="none")throw new Error(`Expected declutter, obstacle, or none for ${t}`);return e}}function Rr(n,t){if(!Array.isArray(n))throw new Error(`Expected an array for ${t}`);let e=n.length;for(let i=0;i<e;++i)if(typeof n[i]!="number")throw new Error(`Expected an array of numbers for ${t}`);return n}function of(n,t){if(typeof n!="string")throw new Error(`Expected a string for ${t}`);return n}function xl(n,t){if(typeof n!="number")throw new Error(`Expected a number for ${t}`);return n}function af(n,t){if(typeof n=="string")return n;let e=Rr(n,t),i=e.length;if(i<3||i>4)throw new Error(`Expected a color with 3 or 4 values for ${t}`);return e}function lf(n,t){let e=Rr(n,t);if(e.length!==2)throw new Error(`Expected an array of two numbers for ${t}`);return e}function _m(n,t){return typeof n=="number"?n:lf(n,t)}var hf={RENDER_ORDER:"renderOrder"},El=class extends Ui{constructor(t){t=t||{};let e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=t.renderBuffer!==void 0?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=t.updateWhileAnimating!==void 0?t.updateWhileAnimating:!1,this.updateWhileInteracting_=t.updateWhileInteracting!==void 0?t.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(hf.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){let i=this.getDeclutter();i in t.declutter||(t.declutter[i]=new Yi(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(hf.RENDER_ORDER,t)}setStyle(t){this.style_=t===void 0?ml:t;let e=ym(t);this.styleFunction_=t===null?void 0:$u(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}};function ym(n){if(n===void 0)return ml;if(!n)return null;if(typeof n=="function"||n instanceof De)return n;if(Array.isArray(n)&&n.length===0)return[];if(Array.isArray(n)&&n[0]instanceof De){let e=n.length,i=new Array(e);for(let r=0;r<e;++r){let s=n[r];if(!(s instanceof De))throw new Error("Expected a list of style instances");i[r]=s}return i}return rf(n)}var js=El;var Cl=class extends pt{constructor(t,e,i,r){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=r}},Vs=Cl;var Sl=class extends ai{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){j()}calculateMatrices2D(t){let e=t.viewState,i=t.coordinateToPixelTransform,r=t.pixelToCoordinateTransform;Lt(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),hs(r,i)}forEachFeatureAtCoordinate(t,e,i,r,s,o,a,l){let c,h=e.viewState;function u(y,E,R,L){return s.call(o,E,y?R:null,L)}let f=h.projection,d=Jr(t.slice(),f),g=[[0,0]];if(f.canWrapX()&&r){let y=f.getExtent(),E=B(y);g.push([-E,0],[E,0])}let p=e.layerStatesArray,m=p.length,_=[],x=[];for(let y=0;y<g.length;y++)for(let E=m-1;E>=0;--E){let R=p[E],L=R.layer;if(L.hasRenderer()&&hr(R,h)&&a.call(l,L)){let w=L.getRenderer(),T=L.getSource();if(w&&T){let I=T.getWrapX()?d:t,k=u.bind(null,R.managed);x[0]=I[0]+g[y][0],x[1]=I[1]+g[y][1],c=w.forEachFeatureAtCoordinate(x,e,i,k,_)}if(c)return c}}if(_.length===0)return;let C=1/_.length;return _.forEach((y,E)=>y.distanceSq+=E*C),_.sort((y,E)=>y.distanceSq-E.distanceSq),_.some(y=>c=y.callback(y.feature,y.layer,y.geometry)),c}hasFeatureAtCoordinate(t,e,i,r,s,o){return this.forEachFeatureAtCoordinate(t,e,i,r,te,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(t){j()}scheduleExpireIconCache(t){Ft.canExpireCache()&&t.postRenderFunctions.push(xm)}};function xm(n,t){Ft.expire()}var cf=Sl;var wl=class extends cf{constructor(t){super(t),this.fontChangeListenerKey_=U(ji,he.PROPERTYCHANGE,t.redrawText,t),this.element_=wt?ys():document.createElement("div");let e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=pi+" ol-layers";let i=t.getViewport();i&&i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}
3dispatchRenderEvent(t,e){let i=this.getMap();if(i.hasListener(t)){let r=new Vs(t,void 0,e);i.dispatchEvent(r)}}disposeInternal(){H(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(t),this.dispatchRenderEvent(At.PRECOMPOSE,t);let e=t.layerStatesArray.sort((h,u)=>h.zIndex-u.zIndex);e.some(h=>h.layer instanceof js&&h.layer.getDeclutter())&&(t.declutter={});let r=t.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;Zt(o)&&(a=o.getContext("2d"),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,o.width,o.height));let l=[],c=a?o:null;for(let h=0,u=e.length;h<u;++h){let f=e[h];t.layerIndex=h;let d=f.layer,g=d.getSourceState();if(!hr(f,r)||g!="ready"&&g!="undefined"){d.unrender();continue}let p=d.render(t,c);p&&(p!==c&&(this.children_.push(p),c=p),l.push(f))}this.declutter(t,l),su(this.element_,this.children_);for(let h of a?this.children_:[]){let u=h.firstElementChild||h,f=h.style.backgroundColor;if(f&&(!Zt(u)||u.width>0)&&(a.fillStyle=f,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!Zt(u)||u.width===0)continue;a.save();let d=h.style.opacity||u.style.opacity;a.globalAlpha=d===""?1:Number(d);let g=u.style.transform;if(g)a.transform(...ls(g));else{let p=parseFloat(u.style.width)/u.width,m=parseFloat(u.style.height)/u.height;a.transform(p,0,0,m,0,0)}a.drawImage(u,0,0),a.restore()}this.dispatchRenderEvent(At.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){let r=e[i],s=r.layer;s.getDeclutter()&&s.renderDeclutter(t,r)}e.forEach(i=>i.layer.renderDeferred(t))}}},uf=wl;function ff(n){if(n instanceof Ui){n.setMapInternal(null);return}n instanceof lr&&n.getLayers().forEach(ff)}function df(n,t){if(n instanceof Ui){n.setMapInternal(t);return}if(n instanceof lr){let e=n.getLayers().getArray();for(let i=0,r=e.length;i<r;++i)df(e[i],t)}}var Rl=class extends _t{constructor(t){super(),t=t||{},this.on,this.once,this.un;let e=Em(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=t.maxTilesLoading!==void 0?t.maxTilesLoading:16,this.pixelRatio_=t.pixelRatio!==void 0?t.pixelRatio:Kh,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=It(),this.pixelToCoordinateTransform_=It(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,wt||(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,wt||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=e.controls||(wt?new St:or()),this.interactions=e.interactions||(wt?new St:Lu({onFocusOnly:!0}
3)),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Vh(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(vt.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(vt.VIEW,this.handleViewChanged_),this.addChangeListener(vt.SIZE,this.handleSizeChanged_),this.addChangeListener(vt.TARGET,this.handleTargetChanged_),this.setProperties(e.values);let i=this;t.view&&!(t.view instanceof Vt)&&t.view.then(function(r){i.setView(new Vt(r))}),this.controls.addEventListener(lt.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(lt.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(lt.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(lt.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(lt.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(lt.REMOVE,r=>{let s=r.element.getId();s!==void 0&&delete this.overlayIdIndex_[s.toString()],r.element.setMap(null)}),this.controls.forEach(r=>{r.setMap(this)}),this.interactions.forEach(r=>{r.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){df(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){let e=t.getId();e!==void 0&&(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;let r=this.getCoordinateFromPixelInternal(t);i=i!==void 0?i:{};let s=i.hitTolerance!==void 0?i.hitTolerance:0,o=i.layerFilter!==void 0?i.layerFilter:te,a=i.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,s,a,e,null,o,null)}getFeaturesAtPixel(t,e){let i=[];return this.forEachFeatureAtPixel(t,function(r){i.push(r)},e),i}getAllLayers(){let t=[];function e(i){i.forEach(function(r){r instanceof lr?e(r.getLayers()):t.push(r)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;let i=this.getCoordinateFromPixelInternal(t);e=e!==void 0?e:{};let r=e.layerFilter!==void 0?e.layerFilter:te,s=e.hitTolerance!==void 0?e.hitTolerance:0,o=e.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,s,o,r,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){let i=this.viewport_.getBoundingClientRect(),r=this.getSize(),s=i.width/r[0],o=i.height/r[1],a="changedTouches"in t?t.changedTouches[0]:t;return[(a.clientX-i.left)/s,(a.clientY-i.top)/o]}getTarget(){return this.get(vt.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return tr(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){let e=this.frameState_;return e?ct(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){let e=this.overlayIdIndex_[t.toString()];return e!==void 0?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(vt.LAYERGROUP)}setLayers(t){let e=this.getLayerGroup();if(t instanceof St){e.setLayers(t);return}let i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){let t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){let r=t[e];if(!r.visible)continue;let s=r.layer.getRenderer();if(s&&!s.ready)return!0;let o=r.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(t){let e=ge(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){let e=this.frameState_;return e?ct(e.coordinateToPixelTransform,t.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(t){this.pixelRatio_!==t&&(this.pixelRatio_=t,this.render())}getRenderer(){return this.renderer_}
3getSize(){return this.get(vt.SIZE)}getView(){return this.get(vt.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){let t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,r){return Zh(this.frameState_,t,e,i,r)}handleBrowserEvent(t,e){e=e||t.type;let i=new Te(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;let e=t.originalEvent,i=e.type;if(i===jn.POINTERDOWN||i===M.WHEEL||i===M.KEYDOWN){let r=this.getOwnerDocument(),s=this.viewport_.getRootNode?this.viewport_.getRootNode():r,o=e.target,a=s instanceof ShadowRoot?s.host===o?s.host.ownerDocument:s:s===r?r.documentElement:s;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(t.frameState=this.frameState_,this.dispatchEvent(t)!==!1){let r=this.getInteractions().getArray().slice();for(let s=r.length-1;s>=0;s--){let o=r[s];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){let t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let r=this.maxTilesLoading_,s=r,o=t?t.viewHints:void 0,a=o?o[Rt.ANIMATING]||o[Rt.INTERACTING]:!1;if(a){let l=Date.now()-t.time>8;r=l?0:8,s=l?0:2}e.getTilesLoading()<r&&(a&&e.reprioritize(),e.loadMoreTiles(r,s))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(At.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(At.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new hi(Ie.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new hi(Ie.LOADSTART,this,t))));let i=this.postRenderFunctions_;if(t)for(let r=0,s=i.length;r<s;++r)i[r](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let i=0,r=this.targetChangeHandlerKeys_.length;i<r;++i)H(this.targetChangeHandlerKeys_[i]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(M.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(M.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Zt(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);let i=this.targetElement_.getRootNode();i instanceof ShadowRoot&&this.resizeObserver_.unobserve(i.host),this.setSize(void 0)}let t=this.getTarget(),e=typeof t=="string"?document.getElementById(t):t;if(this.targetElement_=e,!e)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);
3else{if(Zt(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new uf(this)),!Zt(e)){this.mapBrowserEventHandler_=new Bh(this,this.moveTolerance_);for(let r in nt)this.mapBrowserEventHandler_.addEventListener(nt[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(M.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(M.WHEEL,this.boundHandleBrowserEvent_,Wr?{passive:!1}:!1);let i;if(this.keyboardEventTarget_)i=this.keyboardEventTarget_;else{let r=e.getRootNode();i=r instanceof ShadowRoot?r.host:e}if(this.targetChangeHandlerKeys_=[U(i,M.KEYDOWN,this.handleBrowserEvent,this),U(i,M.KEYPRESS,this.handleBrowserEvent,this)],!Zt(e)){let r=e.getRootNode();r instanceof ShadowRoot&&this.resizeObserver_.observe(r.host),this.resizeObserver_?.observe(e)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(H(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(H(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);let t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=U(t,he.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=U(t,M.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(H),this.layerGroupPropertyListenerKeys_=null);let t=this.getLayerGroup();t&&(this.handleLayerAdd_(new pe("addlayer",t)),this.layerGroupPropertyListenerKeys_=[U(t,he.PROPERTYCHANGE,this.render,this),U(t,M.CHANGE,this.render,this),U(t,"addlayer",this.handleLayerAdd_,this),U(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(){if(!this.frameState_)return;let t=this.frameState_.layerStatesArray;for(let e=0,i=t.length;e<i;++e){let r=t[e].layer;r.hasRenderer()&&r.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){ff(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){let e=this.getSize(),i=this.getView(),r=this.frameState_,s=null;if(e!==void 0&&tl(e)&&i&&i.isDef()){let o=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=i.getState();if(s={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Jn(a.center,a.resolution,a.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:a,viewHints:o,wantedTiles:{},mapId:F(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=Jn(a.nextCenter,a.nextResolution,l,e)}}this.frameState_=s,this.renderer_.renderFrame(s),s&&(s.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,s.postRenderFunctions),r&&(!this.previousExtent_||!Me(this.previousExtent_)&&!Di(s.extent,this.previousExtent_))&&(this.dispatchEvent(new hi(Ie.MOVESTART,this,r)),this.previousExtent_=bi(this.previousExtent_)),this.previousExtent_&&!s.viewHints[Rt.ANIMATING]&&!s.viewHints[Rt.INTERACTING]&&!Di(s.extent,this.previousExtent_)&&(this.dispatchEvent(new hi(Ie.MOVEEND,this,s)),Br(s.extent,this.previousExtent_))),this.dispatchEvent(new hi(Ie.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(Ie.LOADSTART)||this.hasListener(Ie.LOADEND)||this.hasListener(At.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){let e=this.getLayerGroup();e&&this.handleLayerRemove_(new pe("removelayer",e)),this.set(vt.LAYERGROUP,t)}setSize(t){this.set(vt.SIZE,t)}setTarget(t){this.set(vt.TARGET,t)}setView(t){if(!t||t instanceof Vt){this.set(vt.VIEW,t);return}this.set(vt.VIEW,new Vt);let e=this;t.then(function(i){e.setView(new Vt(i))})}updateSize(){let t=this.getTargetElement(),e;if(t){let r,s;if(Zt(t)){let o=t.getContext("2d").getTransform();r=t.width/o.a,s=t.height/o.d}else{let o=getComputedStyle(t);r=t.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),s=t.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(r)&&!isNaN(s)&&(e=[Math.max(0,r),Math.max(0,s)],!tl(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&Qr("No map visible because the map container's width or height are 0."))}let i=this.getSize();
3e&&(!i||!Pt(e,i))&&(this.updateViewportSize_(e),this.setSize(e))}updateViewportSize_(t){let e=this.getView();e&&e.setViewportSize(t)}};function Em(n){let t=null;n.keyboardEventTarget!==void 0&&(t=typeof n.keyboardEventTarget=="string"?document.getElementById(n.keyboardEventTarget):n.keyboardEventTarget);let e={},i=n.layers&&typeof n.layers.getLayers=="function"?n.layers:new lr({layers:n.layers});e[vt.LAYERGROUP]=i,e[vt.TARGET]=n.target,e[vt.VIEW]=n.view instanceof Vt?n.view:new Vt;let r;n.controls!==void 0&&(Array.isArray(n.controls)?r=new St(n.controls.slice()):(Y(typeof n.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),r=n.controls));let s;n.interactions!==void 0&&(Array.isArray(n.interactions)?s=new St(n.interactions.slice()):(Y(typeof n.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),s=n.interactions));let o;return n.overlays!==void 0?Array.isArray(n.overlays)?o=new St(n.overlays.slice()):(Y(typeof n.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=n.overlays):o=new St,{controls:r,interactions:s,keyboardEventTarget:t,overlays:o,values:e}}var gf=Rl;function mf(n,t,e,i){let r=document.createElement("script"),s="olc_"+F(t);function o(){delete window[s],r.parentNode.removeChild(r)}r.async=!0,r.src=n+(n.includes("?")?"&":"?")+(i||"callback")+"="+s;let a=setTimeout(function(){o(),e&&e()},1e4);window[s]=function(l){clearTimeout(a),o(),t(l)},document.head.appendChild(r)}var Zs=class{constructor(t,e,i,r){this.minX=t,this.maxX=e,this.minY=i,this.maxY=r}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)}
3getHeight(){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 Zi(n,t,e,i,r){return r!==void 0?(r.minX=n,r.maxX=t,r.minY=e,r.maxY=i,r):new Zs(n,t,e,i)}var Hs=Zs;function An(n,t,e,i){return i!==void 0?(i[0]=n,i[1]=t,i[2]=e,i):[n,t,e]}function Cm(n,t,e){return n+"/"+t+"/"+e}function Mn(n,t,e,i,r){return`${F(n)},${t},${Cm(e,i,r)}`}function pf(n){return Sm(n[0],n[1],n[2])}function Sm(n,t,e){return(t<<n)+e}function _f(n,t){let e=n[0],i=n[1],r=n[2];if(t.getMinZoom()>e||e>t.getMaxZoom())return!1;let s=t.getFullTileRange(e);return s?s.containsXY(i,r):!0}var Pn=[0,0,0],wi=5,Tl=class{constructor(t){let e=t.minZoom,i=t.resolutions;e===void 0&&i&&(e=i.findIndex(o=>o!==void 0)),this.minZoom=e!==void 0?e:0,this.resolutions_=i,Y(zh(this.resolutions_,(o,a)=>a-o,!0),"`resolutions` must be sorted in descending order");let r;if(!t.origins){for(let o=0,a=this.resolutions_.length-1;o<a;++o)if(!r)r=this.resolutions_[o]/this.resolutions_[o+1];else if(this.resolutions_[o]/this.resolutions_[o+1]!==r){r=void 0;break}}this.zoomFactor_=r,this.maxZoom=this.resolutions_.length-1,this.origin_=t.origin!==void 0?t.origin:null,this.origins_=null,t.origins!==void 0&&(this.origins_=t.origins,Y(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));let s=t.extent;s!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=ne(s)),Y(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,t.tileSizes!==void 0&&(this.tileSizes_=t.tileSizes,Y(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=t.tileSize!==void 0?t.tileSize:this.tileSizes_?null:256,Y(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=s!==void 0?s:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],t.tileRanges!==void 0?this.fullTileRanges_=t.tileRanges:t.sizes!==void 0?this.fullTileRanges_=t.sizes.map((o,a)=>{let l=new Hs(Math.min(0,o[0]),Math.max(o[0]-1,-1),Math.min(0,o[1]),Math.max(o[1]-1,-1));if(s){let c=this.getTileRangeForExtentAndZ(s,a);l.minX=Math.max(c.minX,l.minX),l.maxX=Math.min(c.maxX,l.maxX),l.minY=Math.max(c.minY,l.minY),l.maxY=Math.min(c.maxY,l.maxY)}return l}):s&&this.calculateTileRanges_(s)}forEachTileCoord(t,e,i){let r=this.getTileRangeForExtentAndZ(t,e);for(let s=r.minX,o=r.maxX;s<=o;++s)for(let a=r.minY,l=r.maxY;a<=l;++a)i([e,s,a])}forEachTileCoordParentTileRange(t,e,i,r){let s,o,a,l=null,c=t[0]-1;for(this.zoomFactor_===2?(o=t[1],a=t[2]):l=this.getTileCoordExtent(t,r);c>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),s=Zi(o,o,a,a,i)):s=this.getTileRangeForExtentAndZ(l,c,i),e(c,s))return!0;--c}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getOrigins(){return this.origins_}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(this.zoomFactor_===2){let s=t[1]*2,o=t[2]*2;return Zi(s,s+1,o,o+1,e)}let r=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(r,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;let r=t[0],s=t[1],o=t[2];if(e===r)return Zi(s,o,s,o,i);if(this.zoomFactor_){let l=Math.pow(this.zoomFactor_,e-r),c=Math.floor(s*l),h=Math.floor(o*l);if(e<r)return Zi(c,c,h,h,i);let u=Math.floor(l*(s+1))-1,f=Math.floor(l*(o+1))-1;return Zi(c,u,h,f,i)}let a=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,Pn);let r=Pn[1],s=Pn[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,Pn);let o=Pn[1],a=Pn[2];return Zi(r,o,s,a,i)}getTileCoordCenter(t){let e=this.getOrigin(t[0]),i=this.getResolution(t[0]),r=dt(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*r[0]*i,e[1]-(t[2]+.5)*r[1]*i]}getTileCoordExtent(t,e){let i=this.getOrigin(t[0]),r=this.getResolution(t[0]),s=dt(this.getTileSize(t[0]),this.tmpSize_),o=i[0]+t[1]*s[0]*r,a=i[1]-(t[2]+1)*s[1]*r,l=o+s[0]*r,c=a+s[1]*r;return jt(o,a,l,c,e)}
3getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,r,s){let o=this.getZForResolution(i),a=i/this.getResolution(o),l=this.getOrigin(o),c=dt(this.getTileSize(o),this.tmpSize_),h=a*(t-l[0])/i/c[0],u=a*(l[1]-e)/i/c[1];return r?(h=Hn(h,wi)-1,u=Hn(u,wi)-1):(h=Zn(h,wi),u=Zn(u,wi)),An(o,h,u,s)}getTileCoordForXYAndZ_(t,e,i,r,s){let o=this.getOrigin(i),a=this.getResolution(i),l=dt(this.getTileSize(i),this.tmpSize_),c=(t-o[0])/a/l[0],h=(o[1]-e)/a/l[1];return r?(c=Hn(c,wi)-1,h=Hn(h,wi)-1):(c=Zn(c,wi),h=Zn(h,wi)),An(i,c,h,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){let i=en(this.resolutions_,t,e||0);return J(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return ra(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){let e=this.resolutions_.length,i=new Array(e);for(let r=this.minZoom;r<e;++r)i[r]=this.getTileRangeForExtentAndZ(t,r);this.fullTileRanges_=i}},Il=Tl;function qs(n){let t=n.getDefaultTileGrid();return t||(t=Rm(n),n.setDefaultTileGrid(t)),t}function yf(n,t,e){let i=t[0],r=n.getTileCoordCenter(t),s=$s(e);if(!fe(s,r)){let o=B(s),a=Math.ceil((s[0]-r[0])/o);return r[0]+=o*a,n.getTileCoordForCoordAndZ(r,i)}return t}function wm(n,t,e,i){i=i!==void 0?i:"top-left";let r=Ef(n,t,e);return new Il({extent:n,origin:Jh(n,i),resolutions:r,tileSize:e})}function xf(n){let t=n||{},e=t.extent||ht("EPSG:3857").getExtent(),i={extent:e,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:Ef(e,t.maxZoom,t.tileSize,t.maxResolution)};return new Il(i)}function Ef(n,t,e,i){t=t!==void 0?t:42,e=dt(e!==void 0?e:256);let r=at(n),s=B(n);i=i>0?i:Math.max(s/e[0],r/e[1]);let o=t+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=i/Math.pow(2,l);return a}function Rm(n,t,e,i){let r=$s(n);return wm(r,t,e,i)}function $s(n){n=ht(n);let t=n.getExtent();if(!t){let e=180*Be.degrees/n.getMetersPerUnit();t=jt(-e,-e,e,e)}return t}var Tm=/\{z\}/g,Im=/\{x\}/g,vm=/\{y\}/g,Lm=/\{-y\}/g;function Cf(n,t,e,i,r){return n.replace(Tm,t.toString()).replace(Im,e.toString()).replace(vm,i.toString()).replace(Lm,function(){if(r===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(r-i).toString()})}function Sf(n){let t=[],e=/\{([a-z])-([a-z])\}/.exec(n);if(e){let i=e[1].charCodeAt(0),r=e[2].charCodeAt(0),s;for(s=i;s<=r;++s)t.push(n.replace(e[0],String.fromCharCode(s)));return t}if(e=/\{(\d+)-(\d+)\}/.exec(n),e){let i=parseInt(e[2],10);for(let r=parseInt(e[1],10);r<=i;r++)t.push(n.replace(e[0],r.toString()));return t}return t.push(n),t}function Am(n,t){return(function(e,i,r){if(!e)return;let s,o=e[0];if(t){let a=t.getFullTileRange(o);a&&(s=a.getHeight()-1)}return Cf(n,o,e[1],e[2],s)})}function Js(n,t){let e=n.length,i=new Array(e);for(let r=0;r<e;++r)i[r]=Am(n[r],t);return Mm(i)}function Mm(n){return n.length===1?n[0]:(function(t,e,i){if(!t)return;let r=pf(t),s=ve(r,n.length);return n[s](t,e,i)})}var vl=class extends li{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=i.transition===void 0?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(M.CHANGE)}release(){this.setState(O.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==O.EMPTY){if(this.state!==O.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){j()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(!i)i=e,this.transitionStarts_[t]=i;else if(i===-1)return 1;let r=e-i+1e3/60;return r>=this.transition_?1:No(r/this.transition_)}inTransition(t){return this.transition_?this.transitionStarts_[t]!==-1:!1}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}},On=vl;var Ll=class extends On{constructor(t,e,i,r,s,o){super(t,e,o),this.crossOrigin_=r?.crossOrigin,this.referrerPolicy_=r?.referrerPolicy,this.src_=i,this.key=i,this.image_,wt?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=s}getImage(){return this.image_}setImage(t){this.image_=t,this.state=O.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=O.ERROR,this.unlistenImage_(),this.image_=Pm(),this.changed()}handleImageLoad_(){if(wt)this.state=O.LOADED;else{let t=this.image_;
3t.naturalWidth&&t.naturalHeight?this.state=O.LOADED:this.state=O.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==O.ERROR&&(this.state=O.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==O.IDLE&&(this.state=O.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Xu(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};function Pm(){let n=tt(1,1);return n.fillStyle="rgba(0,0,0,0)",n.fillRect(0,0,1,1),n.canvas}var Qs=Ll;var Al,Hi=[];function wf(n,t,e,i,r){n.beginPath(),n.moveTo(0,0),n.lineTo(t,e),n.lineTo(i,r),n.closePath(),n.save(),n.clip(),n.fillRect(0,0,Math.max(t,i)+1,Math.max(e,r)),n.restore()}function Ml(n,t){return Math.abs(n[t*4]-210)>2||Math.abs(n[t*4+3]-.75*255)>2}function Om(){if(Al===void 0){let n=tt(6,6,Hi);n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",wf(n,4,5,4,0),wf(n,4,5,0,5);let t=n.getImageData(0,0,3,3).data;Al=Ml(t,0)||Ml(t,4)||Ml(t,8),zi(n),Hi.push(n.canvas)}return Al}function Rf(n,t,e,i){let r=Ze(e,t,n),s=qo(t,i,e),o=t.getMetersPerUnit();o!==void 0&&(s*=o);let a=n.getMetersPerUnit();a!==void 0&&(s/=a);let l=n.getExtent();if(!l||fe(l,r)){let c=qo(n,s,r)/s;isFinite(c)&&c>0&&(s/=c)}return s}function Tf(n,t,e,i){let r=ie(e),s=Rf(n,t,r,i);return(!isFinite(s)||s<=0)&&Hr(e,function(o){return s=Rf(n,t,o,i),isFinite(s)&&s>0}),s}function If(n,t,e,i,r,s,o,a,l,c,h,u,f,d){let g=tt(Math.round(e*n),Math.round(e*t),Hi);if(u||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(e,e);function p(E){return Math.round(E*e)/e}g.globalCompositeOperation="lighter";let m=mt();l.forEach(function(E,R,L){Zr(m,E.extent)});let _,x=e/i,C=(u?1:1+Math.pow(2,-24))/x;if(!f||l.length!==1||c!==0){if(_=tt(Math.round(B(m)*x),Math.round(at(m)*x),Hi),u||(_.imageSmoothingEnabled=!1),r&&d){let E=(r[0]-m[0])*x,R=-(r[3]-m[3])*x,L=B(r)*x,w=at(r)*x;_.rect(E,R,L,w),_.clip()}l.forEach(function(E,R,L){if(E.image.width>0&&E.image.height>0){if(E.clipExtent){_.save();let G=(E.clipExtent[0]-m[0])*x,D=-(E.clipExtent[3]-m[3])*x,K=B(E.clipExtent)*x,ot=at(E.clipExtent)*x;_.rect(u?G:Math.round(G),u?D:Math.round(D),u?K:Math.round(G+K)-Math.round(G),u?ot:Math.round(D+ot)-Math.round(D)),_.clip()}let w=(E.extent[0]-m[0])*x,T=-(E.extent[3]-m[3])*x,I=B(E.extent)*x,k=at(E.extent)*x;_.drawImage(E.image,c,c,E.image.width-2*c,E.image.height-2*c,u?w:Math.round(w),u?T:Math.round(T),u?I:Math.round(w+I)-Math.round(w),u?k:Math.round(T+k)-Math.round(T)),E.clipExtent&&_.restore()}})}let y=ne(o);
3return a.getTriangles().forEach(function(E,R,L){let w=E.source,T=E.target,I=w[0][0],k=w[0][1],G=w[1][0],D=w[1][1],K=w[2][0],ot=w[2][1],A=p((T[0][0]-y[0])/s),X=p(-(T[0][1]-y[1])/s),P=p((T[1][0]-y[0])/s),Z=p(-(T[1][1]-y[1])/s),N=p((T[2][0]-y[0])/s),$=p(-(T[2][1]-y[1])/s),Q=I,xt=k;I=0,k=0,G-=Q,D-=xt,K-=Q,ot-=xt;let v=[[G,D,0,0,P-A],[K,ot,0,0,N-A],[0,0,G,D,Z-X],[0,0,K,ot,$-X]],Bt=qh(v);if(!Bt)return;if(g.save(),g.beginPath(),Om()||!u){g.moveTo(P,Z);let rt=4,Ee=A-P,vi=X-Z;for(let $t=0;$t<rt;$t++)g.lineTo(P+p(($t+1)*Ee/rt),Z+p($t*vi/(rt-1))),$t!=rt-1&&g.lineTo(P+p(($t+1)*Ee/rt),Z+p(($t+1)*vi/(rt-1)));g.lineTo(N,$)}else g.moveTo(P,Z),g.lineTo(A,X),g.lineTo(N,$);g.clip(),g.transform(Bt[0],Bt[2],Bt[1],Bt[3],A,X),g.translate(m[0]-Q,m[3]-xt);let Et;if(_)Et=_.canvas,g.scale(C,-C);else{let rt=l[0],Ee=rt.extent;Et=rt.image,g.scale(B(Ee)/Et.width,-at(Ee)/Et.height)}g.drawImage(Et,0,0),g.restore()}),_&&(zi(_),Hi.push(_.canvas)),h&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEac
3h(function(E,R,L){let w=E.target,T=(w[0][0]-y[0])/s,I=-(w[0][1]-y[1])/s,k=(w[1][0]-y[0])/s,G=-(w[1][1]-y[1])/s,D=(w[2][0]-y[0])/s,K=-(w[2][1]-y[1])/s;g.beginPath(),g.moveTo(k,G),g.lineTo(T,I),g.lineTo(D,K),g.closePath(),g.stroke()}),g.restore()),g.canvas}var bm=10,vf=.25,Pl=class{constructor(t,e,i,r,s,o,a){this.sourceProj_=t,this.targetProj_=e;let l={},c=a?Ic(C=>ct(a,Ze(C,this.targetProj_,this.sourceProj_))):Gi(this.targetProj_,this.sourceProj_);this.transformInv_=function(C){let y=C[0]+"/"+C[1];return l[y]||(l[y]=c(C)),l[y]},this.maxSourceExtent_=r,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&B(r)>=B(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?B(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?B(this.targetProj_.getExtent()):null;let h=ne(i),u=hn(i),f=ln(i),d=an(i),g=this.transformInv_(h),p=this.transformInv_(u),m=this.transformInv_(f),_=this.transformInv_(d),x=bm+(o?Math.max(0,Math.ceil(Math.log2($n(i)/(o*o*256*256)))):0);if(this.addQuad_(h,u,f,d,g,p,m,_,x),this.wrapsXInSource_){let C=1/0;this.triangles_.forEach(function(y,E,R){C=Math.min(C,y.source[0][0],y.source[1][0],y.source[2][0])}),this.triangles_.forEach(y=>{if(Math.max(y.source[0][0],y.source[1][0],y.source[2][0])-C>this.sourceWorldWidth_/2){let E=[[y.source[0][0],y.source[0][1]],[y.source[1][0],y.source[1][1]],[y.source[2][0],y.source[2][1]]];E[0][0]-C>this.sourceWorldWidth_/2&&(E[0][0]-=this.sourceWorldWidth_),E[1][0]-C>this.sourceWorldWidth_/2&&(E[1][0]-=this.sourceWorldWidth_),E[2][0]-C>this.sourceWorldWidth_/2&&(E[2][0]-=this.sourceWorldWidth_);let R=Math.min(E[0][0],E[1][0],E[2][0]);Math.max(E[0][0],E[1][0],E[2][0])-R<this.sourceWorldWidth_/2&&(y.source=E)}})}l={}}addTriangle_(t,e,i,r,s,o){this.triangles_.push({source:[r,s,o],target:[t,e,i]})}addQuad_(t,e,i,r,s,o,a,l,c){let h=qn([s,o,a,l]),u=this.sourceWorldWidth_?B(h)/this.sourceWorldWidth_:null,f=this.sourceWorldWidth_,d=this.sourceProj_.canWrapX()&&u>.5&&u<1,g=!1;if(c>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){let m=qn([t,e,i,r]);g=B(m)/this.targetWorldWidth_>vf||g}!d&&this.sourceProj_.isGlobal()&&u&&(g=u>vf||g)}if(!g&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!st(h,this.maxSourceExtent_))return;let p=0;if(!g&&(!isFinite(s[0])||!isFinite(s[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(c>0)g=!0;else if(p=(!isFinite(s[0])||!isFinite(s[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),p!=1&&p!=2&&p!=4&&p!=8)return}if(c>0){if(!g){let m=[(t[0]+i[0])/2,(t[1]+i[1])/2],_=this.transformInv_(m),x;d?x=(ve(s[0],f)+ve(a[0],f))/2-ve(_[0],f):x=(s[0]+a[0])/2-_[0];let C=(s[1]+a[1])/2-_[1];g=x*x+C*C>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){let m=[(e[0]+i[0])/2,(e[1]+i[1])/2],_=this.transformInv_(m),x=[(r[0]+t[0])/2,(r[1]+t[1])/2],C=this.transformInv_(x);this.addQuad_(t,e,m,x,s,o,_,C,c-1),this.addQuad_(x,m,i,r,C,_,a,l,c-1)}else{let m=[(t[0]+e[0])/2,(t[1]+e[1])/2],_=this.transformInv_(m),x=[(i[0]+r[0])/2,(i[1]+r[1])/2],C=this.transformInv_(x);this.addQuad_(t,m,x,r,s,_,C,l,c-1),this.addQuad_(m,e,i,x,_,o,a,C,c-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(p&11)==0&&this.addTriangle_(t,i,r,s,a,l),(p&14)==0&&this.addTriangle_(t,i,e,s,a,o),p&&((p&13)==0&&this.addTriangle_(e,r,t,o,l,s),(p&7)==0&&this.addTriangle_(e,r,i,o,l,a))}calculateSourceExtent(){let t=mt();return this.triangles_.forEach(function(e,i,r){let s=e.source;Fi(t,s[0]),Fi(t,s[1]),Fi(t,s[2])}),t}getTriangles(){return this.triangles_}},Lf=Pl;var Ol=class extends On{constructor(t,e,i,r,s,o,a,l,c,h,u,f){super(s,O.IDLE,f),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=r,this.wrappedTileCoord_=o||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;let d=r.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent(),p=this.sourceTileGrid_.getExtent(),m=g?Ae(d,g):d;if($n(m)===0){this.state=O.EMPTY;return}let _=t.getExtent();_&&(p?p=Ae(p,_):p=_);let x=r.getResolution(this.wrappedTileCoord_[0]),C=Tf(t,i,m,x);if(!isFinite(C)||C<=0){this.state=O.EMPTY;return}let y=h!==void 0?h:.5;if(this.triangulation_=new Lf(t,i,m,p,C*y,x),this.triangulation_.getTr
3iangles().length===0){this.state=O.EMPTY;return}this.sourceZ_=e.getZForResolution(C);let E=this.triangulation_.calculateSourceExtent();if(p&&(t.canWrapX()?(E[1]=J(E[1],p[1],p[3]),E[3]=J(E[3],p[1],p[3])):E=Ae(E,p)),!$n(E))this.state=O.EMPTY;else{let R=0,L=0;t.canWrapX()&&(R=B(_),L=Math.floor((E[0]-_[0])/R)),$r(E.slice(),t,!0).forEach(T=>{let I=e.getTileRangeForExtentAndZ(T,this.sourceZ_);for(let k=I.minX;k<=I.maxX;k++)for(let G=I.minY;G<=I.maxY;G++){let D=L*R;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,k,G,a),offset:D})}++L}),this.sourceTiles_.length===0&&(this.state=O.EMPTY)}}getImage(){return this.canvas_}reproject_(){let t=[];if(this.sourceTiles_.forEach(e=>{let i=e.tile;if(i&&i.getState()==O.LOADED){let r=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);r[0]+=e.offset,r[2]+=e.offset;let s=this.clipExtent_?.slice();s&&(s[0]+=e.offset,s[2]+=e.offset),t.push({extent:r,clipExtent:s,image:i.getImage()})}}),this.sourceTiles_.length=0,t.length===0)this.state=O.ERROR;else{let e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),r=typeof i=="number"?i:i[0],s=typeof i=="number"?i:i[1],o=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=If(r,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=O.LOADED}this.changed()}load(){for(let t of this.sourceTiles_)t.tile=t.getTile();if(this.state==O.IDLE){this.state=O.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{let i=e.getState();if(i==O.IDLE||i==O.LOADING){t++;let r=U(e,M.CHANGE,s=>{let o=e.getState();(o==O.LOADED||o==O.ERROR||o==O.EMPTY)&&(H(r),t--,t===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(r)}}),t===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:e},i,r){e.getState()==O.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(H),this.sourcesListenerKeys_=null}release(){this.canvas_&&(zi(this.canvas_.getContext("2d")),Hi.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},to=Ol;var bl=class extends _t{constructor(t){super(),this.projection=ht(t.projection),this.attributions_=Af(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.state_=t.state!==void 0?t.state:"ready",this.wrapX_=t.wrapX!==void 0?t.wrapX:!1,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;let e=this;this.viewPromise_=new Promise(function(i,r){e.viewResolver=i,e.viewRejector=r})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}ready(){let t=this.getState();return t==="ready"?Promise.resolve():t==="error"?Promise.reject(new Error("Source failed to load")):new Promise((e,i)=>{let r=()=>{let s=this.getState();s==="ready"?(this.un("change",r),e()):s==="error"&&(this.un("change",r),i(new Error("Source failed to load")))};this.on("change",r)})}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=Af(t),this.changed()}setState(t){this.state_=t,this.changed()}};function Af(n){return n?typeof n=="function"?n:(Array.isArray(n)||(n=[n]),t=>n):null}var eo=bl;var Dl=class extends eo{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.tilePixelRatio_=t.tilePixelRatio!==void 0?t.tilePixelRatio:1,this.tileGrid=t.tileGrid!==void 0?t.tileGrid:null;let e=[256,256];this.tileGrid&&dt(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tmpSize=[0,0],this.key_=t.key||F(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){let e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,r,s,o){return j()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:qs(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){let r=this.getTileGridForProjection(i),s=this.getTilePixelRatio(e),o=dt(r.getTileSize(t),this.tmpSize);return s==1?o:Du(o,s,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){let i=e!==void 0?e:this.getProjection(),r=e!==void 0?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=yf(r,t,i)),_f(t,r)?t:null}clear(){}refresh(){this.clear(),super.refresh()}},io=class extends pt{constructor(t,e){super(t),this.tile=e}},Mf=Dl;var no={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var Fl=class n extends Mf{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===n.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){let e=t.target,i=F(e),r=e.getState(),s;r==O.LOADING?(this.tileLoadingKeys_[i]=!0,s=no.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],s=r==O.ERROR?no.TILELOADERROR:r==O.LOADED?no.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new io(s,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,typeof e<"u"?this.setKey(e):this.changed()}setUrl(t){let e=Sf(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;let e=t.join(`
4`);this.generateTileUrlFunction_?this.setTileUrlFunction(Js(t,this.tileGrid),e):this.setKey(e)}
4tileUrlFunction(t,e,i){}},Pf=Fl;var kl=class extends Pf{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:Dm,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate!==void 0?t.interpolate:!0,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=t.crossOrigin!==void 0?t.crossOrigin:null,this.referrerPolicy=t.referrerPolicy,this.tileClass=t.tileClass!==void 0?t.tileClass:Qs,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!pn(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getTileGridForProjection(t){let e=this.getProjection();if(this.tileGrid&&(!e||pn(e,t)))return this.tileGrid;let i=F(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=qs(t)),this.tileGridForProjection[i]}createTile_(t,e,i,r,s,o){let a=[t,e,i],l=this.getTileCoordForTileUrlFunction(a,s),c=l?this.tileUrlFunction(l,r,s):void 0,h=new this.tileClass(a,c!==void 0?O.IDLE:O.EMPTY,c!==void 0?c:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return h.key=o,h.addEventListener(M.CHANGE,this.handleTileChange.bind(this)),h}getTile(t,e,i,r,s,o){let a=this.getProjection();if(!a||!s||pn(a,s))return this.getTileInternal(t,e,i,r,a||s);let l=[t,e,i],c=this.getKey(),h=this.getTileGridForProjection(a),u=this.getTileGridForProjection(s),f=this.getTileCoordForTileUrlFunction(l,s),d=new to(a,h,s,u,l,f,this.getTilePixelRatio(r),this.getGutter(),(g,p,m,_)=>this.getTileInternal(g,p,m,_,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return d.key=c,d}getTileInternal(t,e,i,r,s,o){let a=this.getKey(),l=Mn(this,a,t,e,i);if(o&&o.containsKey(l))return o.get(l);let c=this.createTile_(t,e,i,r,s,a);return o?.set(l,c),c}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){let i=ht(t);if(i){let r=F(i);r in this.tileGridForProjection||(this.tileGridForProjection[r]=e)}}};function Dm(n,t){if(wt){let e=n.getCrossOrigin(),i="same-origin",r="same-origin";e==="anonymous"||e===""?(i="cors",r="omit"):e==="use-credentials"&&(i="cors",r="include");let s={mode:i,credentials:r,referrerPolicy:n.getReferrerPolicy()};fetch(t,s).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.blob()}).then(o=>createImageBitmap(o)).then(o=>{let a=n.getImage();a.width=o.width,a.height=o.height,a.getContext("2d").drawImage(o,0,0),o.close?.(),a.dispatchEvent(new Event("load"))}).catch(()=>{n.getImage().dispatchEvent(new Event("error"))});return}n.getImage().src=t}var Of=kl;var Nl=class extends Of{constructor(t){if(super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:ht("EPSG:3857"),reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,zDirection:t.zDirection}),this.tileJSON_=null,this.tileSize_=t.tileSize,t.url)if(t.jsonp)mf(t.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{let e=new XMLHttpRequest;e.addEventListener("load",this.onXHRLoad_.bind(this)),e.addEventListener("error",this.onXHRError_.bind(this)),e.open("GET",t.url),e.send()}else if(t.tileJSON)this.handleTileJSONResponse(t.tileJSON);else throw new Error("Either `url` or `tileJSON` options must be provided")}onXHRLoad_(t){let e=t.target;if(!e.status||e.status>=200&&e.status<300){let i;try{i=JSON.parse(e.responseText)}catch{this.handleTileJSONError();return}this.handleTileJSONResponse(i)}else this.handleTileJSONError()}onXHRError_(t){this.handleTileJSONError()}getTileJSON(){return this.tileJSON_}
4handleTileJSONResponse(t){let e=ht("EPSG:4326"),i=this.getProjection(),r;if(t.bounds!==void 0){let c=Ve(e,i);r=qr(t.bounds,c)}let s=$s(i),o=t.minzoom||0,a=t.maxzoom||22,l=xf({extent:s,maxZoom:a,minZoom:o,tileSize:this.tileSize_});if(this.tileGrid=l,this.tileUrlFunction=Js(t.tiles,l),t.attribution&&!this.getAttributions()){let c=r!==void 0?r:s;this.setAttributions(function(h){return st(c,h.extent)?[t.attribution]:null})}this.tileJSON_=t,this.setState("ready")}handleTileJSONError(){this.setState("error")}},bf=Nl;function ro(n){return n instanceof Image||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement||n instanceof ImageBitmap?n:null}var Fm=new Error("disposed");var km=[256,256],Gl=class extends On{constructor(t){let e=O.IDLE;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;let t=ro(this.data_);return t?[t.width,t.height]:km}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==O.IDLE&&this.state!==O.ERROR)return;this.state=O.LOADING,this.changed();let t=this;this.loader_().then(function(e){t.data_=e,t.state=O.LOADED,t.changed()}).catch(function(e){t.error_=e,t.state=O.ERROR,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(Fm),this.controller_=null),super.disposeInternal()}},Xl=Gl;var zl=class{constructor(t){this.highWaterMark=t!==void 0?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){let t=this.pop();t instanceof ai&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){let i=this.entries_[t];return Y(i!==void 0,"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){let e=this.entries_[t];return Y(e!==void 0,"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(){let t=new Array(this.count_),e=0,i;for(i=this.newest_;i;i=i.older)t[e++]=i.key_;return t}getValues(){let t=new Array(this.count_),e=0,i;for(i=this.newest_;i;i=i.older)t[e++]=i.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){return this.entries_[t]?.value_}pop(){let 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){Y(!(t in this.entries_),"Tried to set a value for a key that is used already");let 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}},Wl=zl;var Ul=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(sr(),{get:(t,e)=>{if(typeof t[e]=="function")return this.pendingMethod_=e,this.pushMethodArgs_},set:(t,e,i)=>(this.push_(e,i),!0)})}push_(...t){let e=this.instructions_,i=this.zIndex+this.offset_;e[i]||(e[i]=[]),e[i].push(...t)}pushMethodArgs_=(...t)=>{this.push_(this.pendingMethod_,t)};pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let i=0,r=e.length;i<r;++i){let s=e[i];if(typeof s=="function"){s(t);continue}let o=e[++i];
4typeof t[s]=="function"?t[s](...o):typeof o=="function"?t[s]=o(t):t[s]=o}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},so=Ul;var Nm=5,Yl=class extends Xr{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=Nm,this.renderedSourceKey_}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(t){this.renderedSourceKey_?this.renderedSourceKey_!==t&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=t):this.renderedSourceKey_=t}getFeatures(t){return j()}getData(t){return null}prepareFrame(t){return j()}renderFrame(t,e){return j()}forEachFeatureAtCoordinate(t,e,i,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){let e=t.target;(e.getState()===z.LOADED||e.getState()===z.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=z.LOADED&&e!=z.ERROR&&t.addEventListener(M.CHANGE,this.boundHandleImageChange_),e==z.IDLE&&(t.load(),e=t.getState()),e==z.LOADED}renderIfReadyAndVisible(){let t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}},Df=Yl;var Bl=[],bn=null;function Gm(){bn=tt(1,1,void 0,{willReadFrequently:!0})}var Kl=class extends Df{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=It(),this.pixelTransform=It(),this.inversePixelTransform=It(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){bn||Gm(),bn.clearRect(0,0,1,1);let r;try{bn.drawImage(t,e,i,1,1,0,0,1,1),r=bn.getImageData(0,0,1,1).data}catch{return bn=null,null}return r}getBackground(t){let i=this.getLayer().getBackground();return typeof i=="function"&&(i=i(t.viewState.resolution)),i||void 0}useContainer(t,e,i,r,s){if(Zt(t)&&this.pixelTransform[1]===0&&this.pixelTransform[2]===0&&this.pixelTransform[4]===0&&this.pixelTransform[5]===0&&t.width===r&&t.height===s){let c=t,h=c.getContext("2d");if(h){this.container=t,this.context=h,this.containerReused=!0,i&&(h.fillStyle=i,h.fillRect(0,0,c.width,c.height));return}}let o=this.getLayer().getClassName(),a,l;if(t&&t.className===o&&(!i||t&&t.style.backgroundColor&&Pt(ae(t.style.backgroundColor),ae(i)))){let c=t.firstElementChild;Zt(c)&&(l=c.getContext("2d"))}if(l&&Mc(l.canvas.style.transform,e)?(this.container=t,this.context=l,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){a=wt?ys():document.createElement("div"),a.className=o;let c=a.style;c.position="absolute",c.width="100%",c.height="100%",l=tt();let h=l.canvas;a.appendChild(h),c=h.style,c.position="absolute",c.left="0",c.transformOrigin="top left",this.container=a,this.context=l}!this.containerReused&&i&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){let r=ne(i),s=hn(i),o=ln(i),a=an(i);ct(e.coordinateToPixelTransform,r),ct(e.coordinateToPixelTransform,s),ct(e.coordinateToPixelTransform,o),ct(e.coordinateToPixelTransform,a);let l=this.inversePixelTransform;ct(l,r),ct(l,s),ct(l,o),ct(l,a),t.save(),t.beginPath(),t.moveTo(Math.round(r[0]),Math.round(r[1])
4),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}prepareContainer(t,e){let i=t.extent,r=t.viewState.resolution,s=t.viewState.rotation,o=t.pixelRatio,a=Math.round(B(i)/r*o),l=Math.round(at(i)/r*o);Lt(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/o,1/o,s,-a/2,-l/2),hs(this.inversePixelTransform,this.pixelTransform);let c=Ac(this.pixelTransform),h=this.getBackground(t);if(this.useContainer(e,c,h,a,l),!this.containerReused){let u=this.context.canvas;u.width!=a||u.height!=l?(u.width=a,u.height=l):this.context.clearRect(0,0,a,l),c!==u.style.transform&&(u.style.transform=c)}}dispatchRenderEvent_(t,e,i){let r=this.getLayer();if(r.hasListener(t)){let s=new Vs(t,this.inversePixelTransform,i,e);r.dispatchEvent(s)}}preRender(t,e){this.frameState=e,!e.declutter&&this.dispatchRenderEvent_(At.PRERENDER,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(At.POSTRENDER,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new so),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(At.PRERENDER,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(At.POSTRENDER,this.context,t))}getRenderTransform(t,e,i,r,s,o,a){let l=s/2,c=o/2,h=r/e,u=-h,f=-t[0]+a,d=-t[1];return Lt(this.tempTransform,l,c,h,u,-i,f,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}},oo=Kl;function jl(n,t,e){if(!(e in n))return n[e]=new Set([t]),!0;let i=n[e],r=i.has(t);return r||i.add(t),!r}function Xm(n,t,e){let i=n[e];return i?i.delete(t):!1}function Ff(n,t){let e=n.layerStatesArray[n.layerIndex];e.extent&&(t=Ae(t,me(e.extent,n.viewState.projection)));let i=e.layer.getRenderSource();if(!i.getWrapX()){let r=i.getTileGridForProjection(n.viewState.projection).getExtent();r&&(t=Ae(t,r))}return t}var Vl=class extends oo{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceRevision_,this.tempExtent=mt(),this.tempTileRange_=new Hs(0,0,0,0),this.tempTileCoord_=An(0,0,0);let i=e.cacheSize!==void 0?e.cacheSize:512;this.tileCache_=new Wl(i),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=i*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Wl(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=Mn(a,a.getKey(),t,e,i),c;if(s.containsKey(l))c=s.get(l);else{let h=r.viewState.projection,u=a.getProjection();if(c=a.getTile(t,e,i,r.pixelRatio,h,!u||pn(u,h)?void 0:this.getSourceTileCache()),!c)return null;s.set(l,c)}return c}getTile(t,e,i,r){let s=this.getOrCreateTile(t,e,i,r);return s||null}getData(t){let e=this.frameState;if(!e)return null;let i=this.getLayer(),r=ct(e.pixelToCoordinateTransform,t.slice()),s=i.getExtent();if(s&&!fe(s,r))return null;let o=e.viewState,a=i.getRenderSource(),l=a.getTileGridForProjection(o.projection),c=a.getTilePixelRatio(e.pixelRatio);for(let h=l.getZForResolution(o.resolution);h>=l.getMinZoom();--h){let u=l.getTileCoordForCoordAndZ(r,h),f=this.getTile(h,u[1],u[2],e);if(!f||f.getState()!==O.LOADED)continue;let d=l.getOrigin(h),g=dt(l.getTileSize(h)),p=l.getResolution(h),m;if(f instanceof Qs||f instanceof to)m=f.getImage();else if(f instanceof Xl){if(m=ro(f.getData()),!m)continue}else continue;let _=Math.floor(c*((r[0]-d[0])/p-u[1]*g[0])),x=Math.floor(c*((d[1]-r[1])/p-u[2]*g[1])),C=Math.round(c*a.getGutterForProjection(o.projection));return this.getImageData(m,_+C,x+C)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;let e=this.getLayer().getSource();if(!e)return!1;let i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=i,!0}
4enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,i,r,s){let o=t.viewState,a=this.getLayer(),l=a.getRenderSource(),c=l.getTileGridForProjection(o.projection),h=F(l);h in t.wantedTiles||(t.wantedTiles[h]={});let u=t.wantedTiles[h],f=a.getMapInternal(),d=Math.max(i-s,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),f?f.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),g=o.rotation,p=g?Do(o.center,o.resolution,g,t.size):void 0;for(let m=i;m>=d;--m){let _=c.getTileRangeForExtentAndZ(e,m,this.tempTileRange_),x=c.getResolution(m);for(let C=_.minX;C<=_.maxX;++C)for(let y=_.minY;y<=_.maxY;++y){if(g&&!c.tileCoordIntersectsViewport([m,C,y],p))continue;let E=this.getTile(m,C,y,t);if(!E||!jl(r,E,m))continue;let L=E.getKey();if(u[L]=!0,E.getState()===O.IDLE&&!t.tileQueue.isKeyQueued(L)){let w=An(m,C,y,this.tempTileCoord_);t.tileQueue.enqueue([E,h,c.getTileCoordCenter(w),x])}}}}findStaleTile_(t,e){let i=this.tileCache_,r=t[0],s=t[1],o=t[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){let c=Mn(this.getLayer().getSource(),a[l],r,s,o);if(i.containsKey(c)){let h=i.peek(c);if(h.getState()===O.LOADED)return h.endTransition(F(this)),jl(e,h,r),!0}}return!1}findAltTiles_(t,e,i,r){let s=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!s)return!1;let o=!0,a=this.tileCache_,l=this.getLayer().getRenderSource(),c=l.getKey();for(let h=s.minX;h<=s.maxX;++h)for(let u=s.minY;u<=s.maxY;++u){let f=Mn(l,c,i,h,u),d=!1;if(a.containsKey(f)){let g=a.peek(f);g.getState()===O.LOADED&&(jl(r,g,i),d=!0)}d||(o=!1)}return o}renderFrame(t,e){this.renderComplete=!0;let i=t.layerStatesArray[t.layerIndex],r=t.viewState,s=r.projection,o=r.resolution,a=r.center,l=t.pixelRatio,c=this.getLayer(),h=c.getSource(),u=h.getTileGridForProjection(s),f=u.getZForResolution(o,h.zDirection),d=u.getResolution(f);this.updateStaleKeys(h.getKey());let g=t.extent,p=h.getTilePixelRatio(l);this.prepareContainer(t,e);let m=this.context.canvas.width,_=this.context.canvas.height;this.layerExtent=i.extent?me(i.extent,s):null,this.layerExtent&&(g=Ae(g,this.layerExtent));let x=d*m/2/p,C=d*_/2/p,y=[a[0]-x,a[1]-C,a[0]+x,a[1]+C],E={};this.renderedTiles.length=0;let R=c.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){let A=u.getZForResolution(r.nextResolution,h.zDirection),X=Ff(t,t.nextExtent);this.enqueueTiles(t,X,A,E,R)}let L=Ff(t,g);if(this.enqueueTiles(t,L,f,E,0),R>0&&setTimeout(()=>{this.enqueueTiles(t,L,f-1,E,R-1)},0),!(f in E))return this.container;let w=F(this),T=t.time;for(let A of E[f]){let X=A.getState();if(X===O.EMPTY)continue;let P=A.tileCoord;if(X===O.LOADED&&A.getAlpha(w,T)===1){A.endTransition(w);continue}if(X!==O.ERROR&&(this.renderComplete=!1),this.findStaleTile_(P,E)){Xm(E,A,f),t.animate=!0;continue}if(this.findAltTiles_(u,P,f+1,E))continue;let $=u.getMinZoom();for(let Q=f-1;Q>=$&&!this.findAltTiles_(u,P,Q,E);--Q);}let I=d/o*l/p,k=this.getRenderContext(t);Lt(this.tempTransform,m/2,_/2,I,I,0,-m/2,-_/2),this.layerExtent&&this.clipUnrotated(k,t,this.layerExtent),h.getInterpolate()||(k.imageSmoothingEnabled=!1),this.preRender(k,t);let G=Object.keys(E).map(Number);G.sort(zt);let D=[],K=[],ot=[];for(let A=G.length-1;A>=0;--A){let X=G[A],P=h.getTilePixelSize(X,l,s),N=u.getResolution(X)/d,$=P[0]*N*I,Q=P[1]*N*I,xt=u.getTileCoordForCoordAndZ(ne(y),X),v=u.getTileCoordExtent(xt),Bt=ct(this.tempTransform,[p*(v[0]-y[0])/d,p*(y[3]-v[3])/d]),Et=p*h.getGutterForProjection(s);for(let rt of E[X]){if(rt.getState()!==O.LOADED)continue;let Ee=rt.tileCoord,vi=xt[1]-Ee[1],$t=Math.round(Bt[0]-(vi-1)*$),Nn=xt[2]-Ee[2],Or=Math.round(Bt[1]-(Nn-1)*Q),Li=Math.round(Bt[0]-vi*$),Ai=Math.round(Bt[1]-Nn*Q),Ji=$t-Li,Ge=Or-Ai,Qi=X===f;if(Qi&&rt.inTransition(w)){ot.push({tile:rt,x:Li,y:Ai,w:Ji,h:Ge,gutter:Et}),this.renderedTiles.unshift(rt),this.updateUsedTiles(t.usedTiles,h,rt);continue}let Gn=[Li,Ai,Li+Ji,Ai+Ge],Xn=[];for(let oi=0,zn=D.length;oi<zn;++oi)X<K[oi]&&st(Gn,D[oi])&&Xn.push(D[oi]);let br;Xn.length>0&&(br=ec(Gn,Xn)),D.push(Gn),K.push(X),this.drawTile(rt,t,Li,Ai,Ji,Ge,Et,Qi,br),this.renderedTiles.unshift(rt),this.updateUsedTiles(t.usedTiles,h,rt)}}for(let A=0,X=ot.length;A<X;++A){let{tile:P,x:Z,y:N,w:$,h:Q,gutter:xt}=ot[A];this.drawTile(P,t,Z,N,$,Q,xt,!0,void 0)}if(this.renderedResolution=d,this.extentChanged=!this.renderedExtent_||!Di(this.renderedExtent_,y),this.renderedExtent_=y,this.renderedPixelRatio=l,this.postRender(this.context,t),this.layerExtent&&k.restore(
4),k.imageSmoothingEnabled=!0,this.renderComplete){let A=(X,P)=>{let Z=F(h),N=P.wantedTiles[Z],$=N?Object.keys(N).length:0;this.updateCacheSize($),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(A)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,t*2)}drawTile(t,e,i,r,s,o,a,l,c){let h;if(t instanceof Xl){if(h=ro(t.getData()),!h)throw new Error("Rendering array data is not yet supported")}else h=this.getTileImage(t);if(!h)return;let u=this.getRenderContext(e),f=F(this),d=e.layerStatesArray[e.layerIndex],g=d.opacity*(l?t.getAlpha(f,e.time):1),p=g!==u.globalAlpha;p&&(u.save(),u.globalAlpha=g);let m=h.width-2*a,_=h.height-2*a;if(c){let x=m/s,C=_/o;for(let y=0,E=c.length;y<E;++y){let R=c[y],L=R[0],w=R[1],T=R[2]-R[0],I=R[3]-R[1];u.drawImage(h,a+(L-i)*x,a+(w-r)*C,T*x,I*C,L,w,T,I)}}else u.drawImage(h,a,a,m,_,i,r,s,o);p&&u.restore(),g!==d.opacity?e.animate=!0:l&&t.endTransition(f)}getImage(){let t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,i){let r=F(e);r in t||(t[r]={}),t[r][i.getKey()]=!0}},kf=Vl;var Tr={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var Zl=class extends Ui{constructor(t){t=t||{};let e=Object.assign({},t),i=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i,this.setPreload(t.preload!==void 0?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(Tr.PRELOAD)}setPreload(t){this.set(Tr.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(Tr.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(Tr.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}},Nf=Zl;var Hl=class extends Nf{constructor(t){super(t)}createRenderer(){return new kf(this,{cacheSize:this.getCacheSize()})}},Gf=Hl;var ql=class n extends _t{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(typeof t.getSimplifiedGeometry=="function"){let e=t;this.setGeometry(e)}else{let e=t;this.setProperties(e)}}clone(){let t=new n,e=this.geometryName_;t.setGeometryName(e);let i=this.getPropertiesInternal();if(i){let s=this.getGeometry();for(let o in i)o===e&&s?t.set(o,s.clone()):t.set(o,i[o],!0)}let r=this.getStyle();return r&&t.setStyle(r),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(H(this.geometryChangeKey_),this.geometryChangeKey_=null);let t=this.getGeometry();t&&(this.geometryChangeKey_=U(t,M.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?zm(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){t!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}};function zm(n){if(typeof n=="function")return n;let t;return Array.isArray(n)?t=n:(Y(typeof n.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[n]),function(){return t}}var Ir=ql;function $l(n,t,e,i,r,s,o){let a,l,c=(e-t)/i;if(c===1)a=t;else if(c===2)a=t,l=r;else if(c!==0){let h=n[t],u=n[t+1],f=0,d=[0];for(let m=t+i;m<e;m+=i){let _=n[m],x=n[m+1];f+=Math.sqrt((_-h)*(_-h)+(x-u)*(x-u)),d.push(f),h=_,u=x}let g=r*f,p=Nh(d,g);p<0?(l=(g-d[-p-2])/(d[-p-1]-d[-p-2]),a=t+(-p-2)*i):a=t+p*i}o=o>1?o:2,s=s||new Array(o);for(let h=0;h<o;++h)s[h]=a===void 0?NaN:l===void 0?n[a+h]:Ot(n[a+h],n[a+i+h],l);return s}function Xf(n,t,e,i){let r=n[t],s=n[t+1],o=0;for(let a=t+i;a<e;a+=i){let l=n[a],c=n[a+1];o+=Math.sqrt((l-r)*(l-r)+(c-s)*(c-s)),r=l,s=c}return o}function zf(n,t,e,i){let r=[],s=mt();for(let o=0,a=e.length;o<a;++o){let l=e[o];s=on(n,t,l[0],i),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),t=l[l.length-1]}return r}var Wm=!1;function Um(n,t,e,i,r,s,o){let a=new XMLHttpRequest;a.open("GET",typeof n=="function"?n(e,i,r):n,!0),t.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=Wm,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){let c=t.getType();try{let h;c=="text"||c=="json"?h=a.responseText:c=="xml"?h=a.responseXML||a.responseText:c=="arraybuffer"&&(h=a.response),h?s(t.readFeatures(h,{extent:e,featureProjection:r}),t.readProjection(h)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function Jl(n,t){return function(e,i,r,s,o){Um(n,t,e,i,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function Wf(n,t){return[[-1/0,-1/0,1/0,1/0]]}var Uf=It(),vr=class n{constructor(t,e,i,r,s,o){this.styleFunction,this.extent_,this.id_=o,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=s,this.squaredTolerance_,this.stride_=r,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?Vr(this.flatCoordinates_):on(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let t=ie(this.getExtent());this.flatInteriorPoints_=nr(this.flatCoordinates_,0,this.ends_,this.stride_,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let t=qc(this.flatCoordinates_,this.ends_),e=zf(this.flatCoordinates_,0,t,this.stride_);this.flatInteriorPoints_=Vc(this.flatCoordinates_,0,t,this.stride_,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=$l(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];let t=this.flatCoordinates_,e=0,i=this.ends_;for(let r=0,s=i.length;r<s;++r){let o=i[r],a=$l(t,e,o,this.stride_,.5);Ue(this.flatMidpoints_,a),e=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){t=ht(t);let e=t.getExtent(),i=t.getWorldExtent();if(e&&i){let r=at(i)/at(e);Lt(Uf,i[0],i[3],r,-r,0,0,0),Wt(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,Uf,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new n(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=Gr((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);let i=this.simplifiedGeometry_.getFlatCoordinates(),r;switch(this.type_){case"LineString":i.length=er(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),r=[i.length];break;case"MultiLineString":r=[],i.length=jc(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,r);break;case"Polygon":r=[],i.length=ds(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,r);break;default:}return r&&(this.simplifiedGeometry_=new n(this.type_,i,r,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}};vr.prototype.getFlatCoordinates=vr.prototype.getOrientedFlatCoordinates;var qi=vr;var Ql=class{constructor(t){this.rbush_=new Yi(t),this.items_={}}insert(t,e){let i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[F(e)]=i}load(t,e){let i=new Array(e.length);for(let r=0,s=e.length;r<s;r++){let o=t[r],a=e[r],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};i[r]=l,this.items_[F(a)]=l}this.rbush_.load(i)}remove(t){let e=F(t),i=this.items_[e];return delete this.items_[e],this.rbush_.remove(i)!==null}update(t,e){let i=this.items_[F(e)],r=[i.minX,i.minY,i.maxX,i.maxY];Di(r,t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(e){return e.value})}getInExtent(t){let e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(r){return r.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 r=0,s=t.length;r<s;r++)if(i=e(t[r]),i)return i;return i}isEmpty(){return ce(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){let e=this.rbush_.toJSON();return jt(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(let e in t.items_)this.items_[e]=t.items_[e]}},th=Ql;var Ht={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVE
4FEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var Fe=class extends pt{constructor(t,e,i){super(t),this.feature=e,this.features=i}},eh=class extends eo{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:t.wrapX!==void 0?t.wrapX:!0}),this.on,this.once,this.un,this.loader_=Ye,this.format_=t.format||null,this.overlaps_=t.overlaps===void 0?!0:t.overlaps,this.url_=t.url,t.loader!==void 0?this.loader_=t.loader:this.url_!==void 0&&(Y(this.format_,"`format` must be set when `url` is set"),this.loader_=Jl(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:Wf;let e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new th:null,this.loadedExtentsRtree_=new th,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let i,r;Array.isArray(t.features)?r=t.features:t.features&&(i=t.features,r=i.getArray()),!e&&i===void 0&&(i=new St(r)),r!==void 0&&this.addFeaturesInternal(r),i!==void 0&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){let e=F(t);if(!this.addToIndex_(e,t)){this.featuresCollection_&&this.featuresCollection_.remove(t);return}this.setupChangeEvents_(e,t);let i=t.getGeometry();if(i){let r=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(r,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new Fe(Ht.ADDFEATURE,t))}setupChangeEvents_(t,e){e instanceof qi||(this.featureChangeKeys_[t]=[U(e,M.CHANGE,this.handleFeatureChange_,this),U(e,he.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(e.getId()!==void 0){let r=String(e.getId());if(!(r in this.idIndex_))this.idIndex_[r]=e;else if(e instanceof qi){let s=this.idIndex_[r];s instanceof qi?Array.isArray(s)?s.push(e):this.idIndex_[r]=[s,e]:i=!1}else i=!1}return i&&(Y(!(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){let e=[],i=[],r=[];for(let s=0,o=t.length;s<o;s++){let a=t[s],l=F(a);this.addToIndex_(l,a)&&i.push(a)}for(let s=0,o=i.length;s<o;s++){let a=i[s],l=F(a);this.setupChangeEvents_(l,a);let c=a.getGeometry();if(c){let h=c.getExtent();e.push(h),r.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(e,r),this.hasListener(Ht.ADDFEATURE))for(let s=0,o=i.length;s<o;s++)this.dispatchEvent(new Fe(Ht.ADDFEATURE,i[s]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(Ht.ADDFEATURE,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(Ht.REMOVEFEATURE,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(lt.ADD,i=>{e||(e=!0,this.addFeature(i.element),e=!1)}),t.addEventListener(lt.REMOVE,i=>{e||(e=!0,this.removeFeature(i.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(let i in this.featureChangeKeys_)this.featureChangeKeys_[i].forEach(H);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(i=>{this.removeFeatureInternal(i)});for(let i in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[i])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let e=new Fe(Ht.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){let i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,function(r){let s=r.getGeometry();if(s instanceof qi||s.intersectsCoordinate(t))return e(r)})}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){let r=i.getGeometry();if(r instanceof qi||r.intersectsExtent(t)){let s=e(i);if(s)return s}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),ce(this.nullGeometryFeatures_)||Ue(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){let e=[];return this.forEachFeatureAtCoordinateDirect(t,function(i){e.push(i)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);let r=$r(t,e);return[].concat(...r.map(s=>this.featuresRtree_.getInExtent(s)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){let i=t[0],r=t[1],s=null,o=[NaN,NaN],a=1/0,l=[-1/0,-1/0,1/0,1/0];return e=e||te,this.featuresRtree_.forEachInExtent(l,function(c){if(e(c)){let h=c.getGeometry(),u=a;if(a=h instanceof qi?0:h.closestPointXY(i,r,o,a),a<u){s=c;let f=Math.sqrt(a);l[0]=i-f,l[1]=r-f,l[2]=i+f,l[3]=r+f}}}),s}getExtent(t){return this.featuresRtree_?.getExtent(t)??null}getFeatureById(t){let e=this.idIndex_[t.toString()];return e!==void 0?e:null}getFeatureByUid(t){let e=this.uidIndex_[t];return e!==void 0?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){let e=t.target,i=F(e),r=e.getGeometry();if(!r)i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);else{let o=r.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(o,e)):this.featuresRtree_&&this.featuresRtree_.update(o,e)}let s=e.getId();if(s!==void 0){let o=s.toString();this.idIndex_[o]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[o]=e)}
4else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new Fe(Ht.CHANGEFEATURE,e))}hasFeature(t){let e=t.getId();if(e!==void 0){let i=this.idIndex_[String(e)];return Array.isArray(i)?i.includes(t):i===t}return F(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&ce(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(t,e,i){let r=this.loadedExtentsRtree_,s=this.strategy_(t,e,i);for(let o=0,a=s.length;o<a;++o){let l=s[o];if(!r.forEachInExtent(l,function(h){return Le(h.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Fe(Ht.FEATURESLOADSTART));let h=g=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Fe(Ht.FEATURESLOADEND,void 0,g))},u=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Fe(Ht.FEATURESLOADERROR))},f=!1,d=this.loader_.call(this,l,e,i,g=>f||h(g),()=>f||u());d instanceof Promise?(f=!0,d.then(g=>{this.addFeatures(g),h(g)}).catch(u)):this.loader_.length<4&&(this.loading=!1),r.insert(l,{extent:l.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){let e=this.loadedExtentsRtree_,i=[];e.forEachInExtent(t,function(r){i.push(r)}),i.forEach(r=>{e.remove(r);let s=Fo(r.extent,t);for(let o of s)e.insert(o,{extent:o})})}removeFeatures(t){let e=!1;for(let i=0,r=t.length;i<r;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){if(!t)return;this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){let e=F(t);if(!(e in this.uidIndex_))return!1;e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.featureChangeKeys_[e]?.forEach(H),delete this.featureChangeKeys_[e];let r=t.getId();if(r!==void 0){let s=r.toString(),o=this.idIndex_[s];o===t?delete this.idIndex_[s]:Array.isArray(o)&&(o.splice(o.indexOf(t),1),o.length===1&&(this.idIndex_[s]=o[0]))}return delete this.uidIndex_[e],this.hasListener(Ht.REMOVEFEATURE)&&this.dispatchEvent(new Fe(Ht.REMOVEFEATURE,t)),!0}removeFromIdIndex_(t){for(let e in this.idIndex_)if(this.idIndex_[e]===t){delete this.idIndex_[e];break}}setLoader(t){this.loader_=t}setUrl(t){Y(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(Jl(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}},Yf=eh;var ih=class{drawCustom(t,e,i,r,s){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}},ao=ih;var Lr={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},Ar=[Lr.FILL],ke=[Lr.STROKE],ni=[Lr.BEGIN_PATH],nh=[Lr.CLOSE_PATH],b=Lr;var rh=class extends ao{constructor(t,e,i,r){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=r,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){let e=this.pixelRatio;return e==1?t:t.map(function(i){return i*e})}appendFlatPointCoordinates(t,e){let i=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,s=this.coordinates,o=s.length;for(let a=0,l=t.length;a<l;a+=e)r[0]=t[a],r[1]=t[a+1],fe(i,r)&&(s[o++]=r[0],s[o++]=r[1]);return o}appendFlatLineCoordinates(t,e,i,r,s,o){let a=this.coordinates,l=a.length,c=this.getBufferedMaxExtent();o&&(e+=r);let h=t[e],u=t[e+1],f=this.tmpCoordinate_,d=!0,g,p,m;for(g=e+r;g<i;g+=r)f[0]=t[g],f[1]=t[g+1],m=Kr(c,f),m!==p?(d&&(a[l++]=h,a[l++]=u,d=!1),a[l++]=f[0],a[l++]=f[1]):m===yt.INTERSECTING?(a[l++]=f[0],a[l++]=f[1],d=!1):d=!0,h=f[0],u=f[1],p=m;return(s&&d||g===e+r)&&(a[l++]=h,a[l++]=u),l}drawCustomCoordinates_(t,e,i,r,s){for(let o=0,a=i.length;o<a;++o){let l=i[o],c=this.appendFlatLineCoordinates(t,e,l,r,!1,!1);s.push(c),e=l}return e}drawCustom(t,e,i,r,s){this.beginGeometry(t,e,s);let o=t.getType(),a=t.getStride(),l=this.coordinates.length,c,h,u,f,d;switch(o){case"MultiPolygon":c=t.getOrientedFlatCoordinates(),f=[];let g=t.getEndss();d=0;for(let p=0,m=g.length;p<m;++p){let _=[];d=this.drawCustomCoordinates_(c,d,g[p],a,_),f.push(_)}this.instructions.push([b.CUSTOM,l,f,t,i,na,s]),this.hitDetectionInstructions.push([b.CUSTOM,l,f,t,r||i,na,s]);break;case"Polygon":case"MultiLineString":u=[],c=o=="Polygon"?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(c,0,t.getEnds(),a,u),this.instructions.push([b.CUSTOM,l,u,t,i,yn,s]),this.hitDetectionInstructions.push([b.CUSTOM,l,u,t,r||i,yn,s]);break;
4case"LineString":case"Circle":c=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(c,0,c.length,a,!1,!1),this.instructions.push([b.CUSTOM,l,h,t,i,di,s]),this.hitDetectionInstructions.push([b.CUSTOM,l,h,t,r||i,di,s]);break;case"MultiPoint":c=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(c,a),h>l&&(this.instructions.push([b.CUSTOM,l,h,t,i,di,s]),this.hitDetectionInstructions.push([b.CUSTOM,l,h,t,r||i,di,s]));break;case"Point":c=t.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),h=this.coordinates.length,this.instructions.push([b.CUSTOM,l,h,t,i,void 0,s]),this.hitDetectionInstructions.push([b.CUSTOM,l,h,t,r||i,void 0,s]);break;default:}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[b.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[b.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let t=this.hitDetectionInstructions;t.reverse();let e,i=t.length,r,s,o=-1;for(e=0;e<i;++e)r=t[e],s=r[0],s==b.END_GEOMETRY?o=e:s==b.BEGIN_GEOMETRY&&(r[2]=e,Xh(this.hitDetectionInstructions,o,e),o=-1)}fillStyleToState(t,e={}){if(t){let i=t.getColor();e.fillPatternScale=i&&typeof i=="object"&&"src"in i?this.pixelRatio:1,e.fillStyle=Ut(i||Tt)??void 0}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){let i=t.getColor();e.strokeStyle=Ut(i||kt);let r=t.getLineCap();e.lineCap=r!==void 0?r:Oe;let s=t.getLineDash();e.lineDash=s?s.slice():Yt;let o=t.getLineDashOffset();e.lineDashOffset=o||Kt;let a=t.getLineJoin();e.lineJoin=a!==void 0?a:be;let l=t.getWidth();e.lineWidth=l!==void 0?l:Qe;let c=t.getMiterLimit();e.miterLimit=c!==void 0?c:$e;let h=t.getOffset();e.strokeOffset=h??Yu,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0,e.strokeOffset=void 0;return e}setFillStrokeStyle(t,e){let i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){let e=t.fillStyle,i=[b.SET_FILL_STYLE,e];return typeof e!="string"&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[b.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){let i=t.fillStyle;(i!==void 0&&typeof i!="string"||t.currentFillStyle!=i)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){let i=t.strokeStyle,r=t.lineCap,s=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,l=t.lineWidth,c=t.miterLimit,h=t.strokeOffset;(t.currentStrokeStyle!=i||t.currentLineCap!=r||s!=t.currentLineDash&&!Pt(t.currentLineDash,s)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=c||t.currentStrokeOffset!=h)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=r,t.currentLineDash=s,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=l,t.currentMiterLimit=c,t.currentStrokeOffset=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let e=[b.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Br(this.maxExtent),this.maxLineWidth>0)){let t=this.resolution*(this.maxLineWidth+1)/2;sn(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Ne=rh;var sh=class extends Ne{constructor(t,e,i,r){super(t,e,i,r),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!fe(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);let r=t.getFlatCoordinates(),s=t.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,s);this.instructions.push([b.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.
4ceil(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([b.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);let r=t.getFlatCoordinates(),s=[];for(let l=0,c=r.length;l<c;l+=t.getStride())(!this.maxExtent||fe(this.maxExtent,r.slice(l,l+2)))&&s.push(r[l],r[l+1]);let o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,2);this.instructions.push([b.DRAW_IMAGE,o,a,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([b.DRAW_IMAGE,o,a,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){let i=t.getAnchor(),r=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_=r[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_=r[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}},Kf=sh;var oh=class extends Ne{constructor(t,e,i,r){super(t,e,i,r)}drawFlatCoordinates_(t,e,i,r,s){let o=this.coordinates.length,a=this.appendFlatLineCoordinates(t,e,i,r,!1,!1);return this.instructions.push([b.MOVE_TO_LINE_TO,o,a,s*this.pixelRatio]),this.hitDetectionInstructions.push([b.MOVE_TO_LINE_TO,o,a,s]),i}drawLineString(t,e,i){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([b.SET_STROKE_STYLE,kt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Yt,Kt],ni);let l=t.getFlatCoordinates(),c=t.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(ke),this.endGeometry(e)}drawMultiLineString(t,e,i){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([b.SET_STROKE_STYLE,kt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Yt,Kt],ni);let l=t.getEnds(),c=t.getFlatCoordinates(),h=t.getStride(),u=0;for(let f=0,d=l.length;f<d;++f)u=this.drawFlatCoordinates_(c,u,l[f],h,a);this.hitDetectionInstructions.push(ke),this.endGeometry(e)}finish(){let t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(ke),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(ke),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(ni)}},Bf=oh;var ah=class extends Ne{constructor(t,e,i,r){super(t,e,i,r)}drawFlatCoordinatess_(t,e,i,r,s){let o=this.state,a=o.fillStyle!==void 0,l=o.strokeStyle!==void 0,c=i.length;this.instructions.push(ni),this.hitDetectionInstructions.push(ni);for(let h=0;h<c;++h){let u=i[h],f=this.coordinates.length,d=this.appendFlatLineCoordinates(t,e,u,r,!0,!l);this.instructions.push([b.MOVE_TO_LINE_TO,f,d,s*this.pixelRatio,!0]),this.hitDetectionInstructions.push([b.MOVE_TO_LINE_TO,f,d,s,!0]),l&&(this.instructions.push(nh),this.hitDetectionInstructions.push(nh)),e=u}return a&&(this.instructions.push(Ar),this.hitDetectionInstructions.push(Ar)),l&&(this.instructions.push(ke),this.hitDetectionInstructions.push(ke)),e}drawCircle(t,e,i){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.
4strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawCircle(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([b.SET_FILL_STYLE,Tt]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([b.SET_STROKE_STYLE,kt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Yt,Kt]);let l=t.getFlatCoordinates(),c=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,c,!1,!1);let u=[b.CIRCLE,h,a];this.instructions.push(ni,u),this.hitDetectionInstructions.push(ni,u),r.fillStyle!==void 0&&(this.instructions.push(Ar),this.hitDetectionInstructions.push(Ar)),r.strokeStyle!==void 0&&(this.instructions.push(ke),this.hitDetectionInstructions.push(ke)),this.endGeometry(e)}drawPolygon(t,e,i){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([b.SET_FILL_STYLE,Tt]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([b.SET_STROKE_STYLE,kt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Yt,Kt]);let l=t.getEnds(),c=t.getOrientedFlatCoordinates(),h=t.getStride();this.drawFlatCoordinatess_(c,0,l,h,a),this.endGeometry(e)}drawMultiPolygon(t,e,i){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([b.SET_FILL_STYLE,Tt]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([b.SET_STROKE_STYLE,kt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Yt,Kt]);let l=t.getEndss(),c=t.getOrientedFlatCoordinates(),h=t.getStride(),u=0;for(let f=0,d=l.length;f<d;++f)u=this.drawFlatCoordinatess_(c,u,l[f],h,a);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;let t=this.tolerance;if(t!==0){let e=this.coordinates;for(let i=0,r=e.length;i<r;++i)e[i]=mi(e[i],t)}return super.finish()}setFillStrokeStyles_(){let t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}handleStrokeOffset_(t){let e=this.state,i=e.fillStyle,r=e.strokeStyle,s=e.strokeOffset;return Math.abs(s)>0&&i!==void 0&&r!==void 0?(e.strokeStyle=void 0,e.strokeOffset=0,t(),e.fillStyle=void 0,e.strokeStyle=r,e.strokeOffset=s,t(),e.fillStyle=i,!0):!1}},lh=ah;var hh=0,ch=1;function Ym(n,t,e,i,r,s,o,a){let l=o-r,c=a-s,h=0,u=1;if(l===0){if(r<n||r>e)return!1}else{let f=(n-r)/l,d=(e-r)/l;if(f>d){let g=f;f=d,d=g}if(f>h&&(h=f),d<u&&(u=d),h>u)return!1}if(c===0){if(s<t||s>i)return!1}else{let f=(t-s)/c,d=(i-s)/c;if(f>d){let g=f;f=d,d=g}if(f>h&&(h=f),d<u&&(u=d),h>u)return!1}return hh=h,ch=u,!0}function jf(n,t,e,i){let r=i[0],s=i[1],o=i[2],a=i[3],l=[],c=[],h=!1,u,f,d=0;for(let g=0,p=t.length;g<p;++g){let m=t[g],_=n[d],x=n[d+1],C=!1;for(let y=d+e;y<m;y+=e){let E=n[y],R=n[y+1];if(Ym(r,s,o,a,_,x,E,R)){let L=E-_,w=R-x,T=_+hh*L,I=x+hh*w,k=_+ch*L,G=x+ch*w;h&&C&&T===u&&I===f?l.push(k,G):(h&&c.push(l.length),l.push(T,I,k,G),h=!0),u=k,f=G,C=!0}_=E,x=R}d=m}return h&&c.push(l.length),{flatCoordinates:l,ends:c}}function Vf(n,t,e,i,r){let s=[],o=e,a=0,l=t.slice(e,2);for(;a<n&&o+r<i;){let[c,h]=l.slice(-2),u=t[o+r],f=t[o+r+1],d=Math.sqrt((u-c)*(u-c)+(f-h)*(f-h));if(a+=d,a>=n){let g=(n-a+d)/d,p=Ot(c,u,g),m=Ot(h,f,g);l.push(p,m),s.push(l),l=[p,m],a==n&&(o+=r),a=0}else if(a<n)l.push(t[o+r],t[o+r+1]),o+=r;else{let g=d-a,p=Ot(c,u,g/d),m=Ot(h,f,g/d);l.push(p,m),s.push(l),l=[p,m],a=0,o+=r}}return a>0&&s.push(l),s}function Zf(n,t,e,i,r){let s=e,o=e,a=0,l=0,c=e,h,u,f,d,g,p,m,_,x,C;for(u=e;u<i;u+=r){let y=t[u],E=t[u+1];g!==void 0&&(x=y-g,C=E-p,d=Math.sqrt(x*x+C*C),m!==void 0&&(l+=f,h=Math.acos((m*x+_*C)/(f*d)),h>n&&(l>a&&(a=l,s=c,o=u),l=0,c=u-r)),f=d,m=x,_=C),g=y,p=E}return l+=d,l>a?[c,u]:[s,o]}var Mr={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},uh=class extends Ne{constructor(t,e,i,r){super(t,e,i,r),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[Tt]={fillStyle:Tt},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){let t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){let r=this.textFillState_,s=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!r&&!s)return;let a=this.coordinates,l=a.length,c=t.getType(),h=null,u=t.getStride();if(o.placement==="line"&&(c=="LineString"||c=="MultiLineString"||c=="Polygon"||c=="MultiPolygon")){let f=t.getExtent();if(!st(this.maxExtent,f))return;let d;if(h=t.getFlatCoordinates(),c=="LineString")d=[h.length];else if(c=="MultiLineString")d=t.getEnds();else if(c=="Polygon")d=t.getEnds().slice(0,1);else if(c=="MultiPolygon"){let _=t.getEndss();d=[];for(let x=0,C=_.length;x<C;
4++x)d.push(_[x][0])}if((c=="LineString"||c=="MultiLineString")&&!Le(this.getBufferedMaxExtent(),f)){let _=jf(h,d,u,this.getBufferedMaxExtent());if(h=_.flatCoordinates,d=_.ends,u=2,d.length===0)return}this.beginGeometry(t,e,i);let g=o.repeat,p=g?void 0:o.textAlign,m=0;for(let _=0,x=d.length;_<x;++_){let C;g?C=Vf(g*this.resolution,h,m,d[_],u):C=[h.slice(m,d[_])];for(let y=0,E=C.length;y<E;++y){let R=C[y],L=0,w=R.length;if(p==null){let I=Zf(o.maxAngle,R,0,R.length,2);L=I[0],w=I[1]}for(let I=L;I<w;I+=u)a.push(R[I],R[I+1]);let T=a.length;m=d[_],this.drawChars_(l,T),l=T}}this.endGeometry(e)}else{let f=o.overflow?null:[];switch(c){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(),u=2;break;case"Polygon":h=t.getFlatInteriorPoint(),o.overflow||f.push(h[2]/this.resolution),u=3;break;case"MultiPolygon":let y=t.getFlatInteriorPoints();h=[];for(let E=0,R=y.length;E<R;E+=3)o.overflow||f.push(y[E+2]/this.resolution),h.push(y[E],y[E+1]);if(h.length===0)return;u=2;break;default:}let d=this.appendFlatPointCoordinates(h,u);if(d===l)return;if(f&&(d-l)/2!==h.length/u){let y=l/2;f=f.filter((E,R)=>{let L=a[(y+R)*2]===h[R*u]&&a[(y+R)*2+1]===h[R*u+1];return L||--y,L})}this.saveTextStates_();let g=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,p=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(t,e,i);let m=o.padding;if(m!=Je&&(o.scale[0]<0||o.scale[1]<0)){let y=o.padding[0],E=o.padding[1],R=o.padding[2],L=o.padding[3];o.scale[0]<0&&(E=-E,L=-L),o.scale[1]<0&&(y=-y,R=-R),m=[y,E,R,L]}let _=this.pixelRatio;this.instructions.push([b.DRAW_IMAGE,l,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,m==Je?Je:m.map(function(y){return y*_}),g,p,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,f]);let x=1/_,C=g?g.slice(0):null;C&&(C[1]=Tt),this.hitDetectionInstructions.push([b.DRAW_IMAGE,l,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[x,x],NaN,this.declutterMode_,this.declutterImageWithText_,m,C,p,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Tt:this.fillKey_,this.textOffsetX_,this.textOffsetY_,f]),this.endGeometry(e)}}saveTextStates_(){let t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,r=this.strokeKey_;t&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));let s=this.textKey_;s in this.textStates||(this.textStates[s]={font:e.font,textAlign:e.textAlign||Ci,justify:e.justify,textBaseline:e.textBaseline||Vi,scale:e.scale});let o=this.fillKey_;i&&(o in this.fillStates||(this.fillStates[o]={fillStyle:i.fillStyle}))}drawChars_(t,e){let i=this.textStrokeState_,r=this.textState_,s=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();let l=this.pixelRatio,c=Mr[r.textBaseline],h=this.textOffsetX_*l,u=this.textOffsetY_*l,f=this.text_,d=i?i.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([b.DRAW_CHARS,t,e,c,r.overflow,a,r.maxAngle,l,u,s,d*l,f,o,1,this.declutterMode_,this.textKeepUpright_,h]),this.hitDetectionInstructions.push([b.DRAW_CHARS,t,e,c,r.overflow,a&&Tt,r.maxAngle,l,u,s,d*l,f,o,1/l,this.declutterMode_,this.textKeepUpright_,h])}setTextStyle(t,e){let i,r,s;if(!t)this.text_="";else{let o=t.getFill();o?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=Ut(o.getColor()||Tt)):(r=null,this.textFillState_=r);let a=t.getStroke();if(!a)s=null,this.textStrokeState_=s;else{s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);let p=a.getLineDash(),m=a.getLineDashOffset(),_=a.getWidth(),x=a.getMiterLimit();s.lineCap=a.getLineCap()||Oe,s.lineDash=p?p.slice():Yt,s.lineDashOffset=m===void 0?Kt:m,s.lineJoin=a.getLineJoin()||be,s.lineWidth=_===void 0?Qe:_,s.miterLimit=x===void 0?$e:x,s.strokeStyle=Ut(a.getColor()||kt)}i=this.textState_;let l=t.getFont()||Gs;Ku(l);let c=t.getScaleArray();i.overflow=t.getOverflow(),i.font=l,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||Vi,i.backgroundFill=t.getBackgroun
4dFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||Je,i.scale=c===void 0?[1,1]:c;let h=t.getOffsetX(),u=t.getOffsetY(),f=t.getRotateWithView(),d=t.getKeepUpright(),g=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=h===void 0?0:h,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=f===void 0?!1:f,this.textKeepUpright_=d===void 0?!0:d,this.textRotation_=g===void 0?0:g,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:F(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_=r&&r.fillStyle?typeof r.fillStyle=="string"?r.fillStyle:"|"+F(r.fillStyle):""}this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}},Hf=uh;var Km={Circle:lh,Default:Ne,Image:Kf,LineString:Bf,Polygon:lh,Text:Hf},fh=class{constructor(t,e,i,r){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=r,this.resolution_=i,this.buildersByZIndex_={}}finish(){let t={};for(let e in this.buildersByZIndex_){t[e]=t[e]||{};let i=this.buildersByZIndex_[e];for(let r in i){let s=i[r].finish();t[e][r]=s}}return t}getBuilder(t,e){let i=t!==void 0?t.toString():"0",r=this.buildersByZIndex_[i];r===void 0&&(r={},this.buildersByZIndex_[i]=r);let s=r[e];if(s===void 0){let o=Km[e];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[e]=s}return s}},qf=fh;function lo(n,t,e,i,r,s,o,a){o=o??[],a=a??i;let l=n[t+i],c=n[t+i+1],h=n[e-2*i],u=n[e-2*i+1],f,d,g,p,m,_,x,C,y=0;for(let E=t;E<e;E+=i){g=f,p=d,m=void 0,_=void 0,E+i<e&&(m=n[E+i],_=n[E+i+1]),s&&E===t&&(g=h,p=u),s&&E===e-i&&(m=l,_=c),f=n[E],d=n[E+1],[x,C]=Bm(f,d,g,p,m,_,r),o[y++]=x,o[y++]=C;for(let R=2;R<a;R++)o[y++]=n[E+R]}return o.length!=y&&(o.length=y),o}function Bm(n,t,e,i,r,s,o){let a,l;e!==void 0&&i!==void 0?(a=n-e,l=t-i):r!==void 0&&s!==void 0?(a=r-n,l=s-t):(a=1,l=0);let c=Math.hypot(a,l),h=a/c,u=l/c;if(a=-u,l=h,e===void 0||i===void 0)return[n+a*o,t+l*o];if(r===void 0||s===void 0)return[n+a*o,t+l*o];let f=sc([n,t],[e,i],[r,s]);if(Math.cos(f)>.998)return[n+h*o,t+u*o];let d=Math.cos(f/2),g=Math.sin(f/2),p=g*a+d*l,m=-d*a+g*l,_=p*(1/g),x=m*(1/g);return[n+_*o,t+x*o]}function ho(n,t,e=!1){for(let i=0,r=n.length-2;i<r;i+=t){let s=e&&i===0?n.length-3*t:n.length-2*t;for(let o=s;o>i+t;o-=t){let a=n[i],l=n[i+1],c=n[i+t],h=n[i+t+1],u=n[o],f=n[o+1],d=n[o+t],g=n[o+t+1],p=(g-f)*(c-a)-(d-u)*(h-l);if(p===0)continue;let m=((d-u)*(l-f)-(g-f)*(a-u))/p,_=((c-a)*(l-f)-(h-l)*(a-u))/p;if(m>0&&m<1&&_>0&&_<1){let x=a+m*(c-a),C=l+m*(h-l);n[i+t]=x,n[i+t+1]=C,n.splice(i+2*t,o-i-t);break}}}return n}var dh;function jm(){return dh||(dh=new Intl.Segmenter(void 0,{granularity:"grapheme"})),dh}function $f(n,t,e,i,r,s,o,a,l,c,h,u,f=!0){let d=n[t],g=n[t+1],p=0,m=0,_=0,x=0;function C(){p=d,m=g,t+=i,d=n[t],g=n[t+1],x+=_,_=Math.sqrt((d-p)*(d-p)+(g-m)*(g-m))}do C();while(t<e-i&&x+_<s);let y=_===0?0:(s-x)/_,E=Ot(p,d,y),R=Ot(m,g,y),L=t-i,w=x,T=s+a*l(c,r,h);for(;t<e-i&&x+_<T;)C();y=_===0?0:(T-x)/_;let I=Ot(p,d,y),k=Ot(m,g,y),G=!1;if(f)if(u){let P=[E,R,I,k];cs(P,0,4,2,u,P,P),G=P[0]>P[2]}else G=E>I;let D=Math.PI,K=[],ot=L+i===t;t=L,_=0,x=w,d=n[t],g=n[t+1];let A;if(ot){C(),A=Math.atan2(g-m,d-p),G&&(A+=A>0?-D:D);let P=(I+E)/2,Z=(k+R)/2;return K[0]=[P,Z,(T-s)/2,A,r],K}r=r.replace(/\n/g," ");let X=Array.from(jm().segment(r),P=>P.segment);for(let P=0,Z=X.length;P<Z;){C();let N=Math.atan2(g-m,d-p);if(G&&(N+=N>0?-D:D),A!==void 0){let Et=N-A;if(Et+=Et>D?-2*D:Et<-D?2*D:0,Math.abs(Et)>o)return null}A=N;let $=P,Q=0;for(;P<Z;++P){let Et=G?Z-P-1:P,rt=a*l(c,X[Et],h);if(t+i<e&&x+_<s+Q+rt/2)break;Q+=rt}if(P===$)continue;let xt=(G?X.slice(Z-P,Z-$):X.slice($,P)).join("");y=_===0?0:(s+Q/2-x)/_;let v=Ot(p,d,y),Bt=Ot(m,g,y);K.push([v,Bt,Q/2,N,xt]),s+=Q}return K}var Dn=mt(),Ri=[],ri=[],si=[],Ti=[];function Jf(n){return n[3].declutterBox}var Qf=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function gh(n,t){return t==="start"?t=Qf.test(n)?"right":"left":t==="end"&&(t=Qf.test(n)?"left":"right"),Mr[t]}function Vm(n,t,e){return e>0&&n.push(`
5`,""),n.push(t,""),n}function Zm(n,t,e){return e%2===0&&(n+=t),n}var mh=class{constructor(t,e,i,r,s){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=It(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=s?new so:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,r){let s=t+e+i+r;if(this.labels_[s])return this.labels_[s];let o=r?this.strokeStates[r]:null,a=i?this.fillStates[i]:null,l=this.textStates[e],c=this.pixelRatio,h=[l.scale[0]*c,l.scale[1]*c],u=l.justify?Mr[l.justify]:gh(Array.isArray(t)?t[0]:t,l.textAlign||Ci),f=r&&o.lineWidth?o.lineWidth:0,d=Array.isArray(t)?t:String(t).split(`
6`).reduce(Vm,[]),{width:g,height:p,widths:m,heights:_,lineWidths:x}=Vu(l,d),C=g+f,y=[],E=(C+2)*h[0],R=(p+f)*h[1],L={width:E<0?Math.floor(E):Math.ceil(E),height:R<0?Math.floor(R):Math.ceil(R),contextInstructions:y};(h[0]!=1||h[1]!=1)&&y.push("scale",h),r&&(y.push("strokeStyle",o.strokeStyle),y.push("lineWidth",f),y.push("lineCap",o.lineCap),y.push("lineJoin",o.lineJoin),y.push("miterLimit",o.miterLimit),y.push("set
6LineDash",[o.lineDash]),y.push("lineDashOffset",o.lineDashOffset)),i&&y.push("fillStyle",a.fillStyle),y.push("textBaseline","middle"),y.push("textAlign","center");let w=.5-u,T=u*C+w*f,I=[],k=[],G=0,D=0,K=0,ot=0,A;for(let X=0,P=d.length;X<P;X+=2){let Z=d[X];if(Z===`
7`){D+=G,G=0,T=u*C+w*f,++ot;continue}let N=d[X+1]||l.font;N!==A&&(r&&I.push("font",N),i&&k.push("font",N),A=N),G=Math.max(G,_[K]);let $=[Z,T+w*m[K]+u*(m[K]-x[ot]),.5*(f+G)+D];T+=m[K],r&&I.push("strokeText",$),i&&k.push("fillText",$),++K}return Array.prototype.push.apply(y,I),Array.prototype.push.apply(y,k),this.labels_[s]=L,L}replayTextBackground_(t,e,i,r,s,o,a){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,r),t.lineTo.apply(t,s),t.lineTo.apply(t,e),o&&(this.alignAndScaleFill_=o[2],t.fillStyle=o[1],this.fill_(t)),a&&(this.setStrokeStyle_(t,a),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,r,s,o,a,l,c,h,u,f,d,g,p,m){a*=f[0],l*=f[1];let _=i-a,x=r-l,C=s+c>t?t-c:s,y=o+h>e?e-h:o,E=g[3]+C*f[0]+g[1],R=g[0]+y*f[1]+g[2],L=_-g[3],w=x-g[0];(p||u!==0)&&(Ri[0]=L,Ti[0]=L,Ri[1]=w,ri[1]=w,ri[0]=L+E,si[0]=ri[0],si[1]=w+R,Ti[1]=si[1]);let T;return u!==0?(T=Lt(It(),i,r,1,1,u,-i,-r),ct(T,Ri),ct(T,ri),ct(T,si),ct(T,Ti),jt(Math.min(Ri[0],ri[0],si[0],Ti[0]),Math.min(Ri[1],ri[1],si[1],Ti[1]),Math.max(Ri[0],ri[0],si[0],Ti[0]),Math.max(Ri[1],ri[1],si[1],Ti[1]),Dn)):jt(Math.min(L,L+E),Math.min(w,w+R),Math.max(L,L+E),Math.max(w,w+R),Dn),d&&(_=Math.round(_),x=Math.round(x)),{drawImageX:_,drawImageY:x,drawImageW:C,drawImageH:y,originX:c,originY:h,declutterBox:{minX:Dn[0],minY:Dn[1],maxX:Dn[2],maxY:Dn[3],value:m},canvasTransform:T,scale:f}}replayImageOrLabel_(t,e,i,r,s,o,a){let l=!!(o||a),c=r.declutterBox,h=a?a[2]*r.scale[0]/2:0;return c.minX-h<=e[0]&&c.maxX+h>=0&&c.minY-h<=e[1]&&c.maxY+h>=0&&(l&&this.replayTextBackground_(t,Ri,ri,si,Ti,o,a),Zu(t,r.canvasTransform,s,i,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(t){let e=this.alignAndScaleFill_;if(e){let i=ct(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;t.save(),t.translate(i[0]%r,i[1]%r),e!==1&&t.scale(e,e)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,r){let s=this.textStates[e],o=this.createLabel(t,e,r,i),a=this.strokeStates[i],l=this.pixelRatio,c=gh(Array.isArray(t)?t[0]:t,s.textAlign||Ci),h=Mr[s.textBaseline||Vi],u=a&&a.lineWidth?a.lineWidth:0,f=o.width/l-2*s.scale[0],d=c*f+2*(.5-c)*u,g=h*o.height/l+2*(.5-h)*u;return{label:o,anchorX:d,anchorY:g}}execute_(t,e,i,r,s,o,a,l){let c=this.zIndexContext_,h;this.pixelCoordinates_&&Pt(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=Wt(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),Lc(this.renderedTransform_,i));let u=0,f=r.length,d=0,g,p=[],m,_,x,C,y,E,R,L,w,T,I,k,G,D=0,K=0,ot=this.coordinateCache_,A=this.viewRotation_,X=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,P={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:A},Z=this.instructions!=r||this.overlaps?0:200,N,$,Q,xt;for(;u<f;){let v=r[u];switch(v[0]){case b.BEGIN_GEOMETRY:N=v[1],xt=v[3],N.getGeometry()?a!==void 0&&!st(a,xt.getExtent())?u=v[2]+1:++u:u=v[2],c&&(c.zIndex=v[4]);break;case b.BEGIN_PATH:D>Z&&(this.fill_(t),D=0),K>Z&&(t.stroke(),K=0),!D&&!K&&(t.beginPath(),y=NaN,E=NaN),++u;break;case b.CIRCLE:d=v[1],x=v[2]??0;let Et=h[d],rt=h[d+1],Ee=h[d+2]-x,vi=h[d+3]-x,$t=Ee-Et,Nn=vi-rt,Or=Math.sqrt($t*$t+Nn*Nn);t.moveTo(Et+Or,rt),t.arc(Et,rt,Or,0,2*Math.PI,!0),++u;break;case b.CLOSE_PATH:t.closePath(),++u;break;case b.CUSTOM:d=v[1],g=v[2];let Li=v[3],Ai=v[4],Ji=v[5];P.geometry=Li,P.feature=N,u in ot||(ot[u]=[]);let Ge=ot[u];Ji?Ji(h,d,g,2,Ge):(Ge[0]=h[d],Ge[1]=h[d+1],Ge.length=2),c&&(c.zIndex=v[6]),Ai(Ge,P),++u;break;case b.DRAW_IMAGE:d=v[1],g=v[2],w=v[3],m=v[4],_=v[5];let Qi=v[6],Gn=v[7],Xn=v[8],br=v[9],oi=v[10],zn=v[11],Cd=v[12],Dr=v[13];C=v[14]||"declutter";let Wn=v[15];if(!w&&v.length>=20){T=v[19],I=v[20],k=v[21],G=v[22];let Ct=this.drawLabelWithPointPlacement_(T,I,k,G);w=Ct.label,v[3]=w;let Ce=v[23];m=(Ct.anchorX-Ce)*this.pixelRatio,v[4]=m;let Jt=v[24];_=(Ct.anchorY-Jt)*this.pixelRatio,v[5]=_,Qi=w.height,v[6]=Qi,Dr=w.width,v[13]=Dr}let go;v.length>25&&(go=v[25]);let mo,Fr,kr;v.length>17?(mo=v[16],Fr=v[17],kr=v[18]):(mo=Je,Fr=null,kr=null),oi&&X?zn+=A:!oi&&!X&&(zn-=A);let Sd=0;for(;d<g;d+=2){if(go&&go[Sd++]<Dr/this.pixelRatio)continue;let Ct=this.calculateImageOrLabelDimensions_(w.width,w.height,h[d],h[d+1],Dr,Qi,m,_,Xn,br,zn,Cd,s,mo,!!Fr||!!kr,N),Ce=[t,e,w,Ct,Gn,Fr,kr];if(l){let Jt,Se,Qt;if(Wn){let ft=g-d;if(!Wn[ft]){Wn[ft]={args:Ce,declutterMode:C};continue}let Nt=Wn[ft];Jt=Nt.args,Se=Nt.declutterMode,delete Wn[ft],Qt=Jf(Jt)}let Xe,ze;if(Jt&&(Se!=="declutter"||!l.collides(Qt))&&(Xe=!0),(C!=="declutter"||!l.collides(Ct.declutterBox))&&(ze=!0),Se==="declutter"&&C==="declutter"){let ft=Xe&&ze;Xe=ft,ze=ft}Xe&&(Se!=="none"&&l.insert(Qt),this.replayImageOrLabel_.apply(this,Jt)),ze&&(C!=="none"&&l.insert(Ct.declutterBox),this.replayImageOrLabel_.apply(this,Ce))}else this.replayImageOrLabel_.apply(this,Ce)}++u;break;case b.DRAW_CHARS:let Ah=v[1],Mh=v[2],po=v[3],wd=v[4];G=v[5];let Rd=v[6],Ph=v[7],Oh=v[8];k=v[9];let _o=v[10];T=v[11],Array.isArray(T)&&(T=T.reduce(Zm,"")),I=v[12];let bh=[v[13],v[13]];C=v[14]||"declutter";let Td=v[15],Dh=v[16],yo=this.textStates[I],Un=yo.font,Yn=[yo.scale[0]*Ph,yo.scale[1]*Ph
7],Kn;Un in this.widths_?Kn=this.widths_[Un]:(Kn={},this.widths_[Un]=Kn);let Fh=Xf(h,Ah,Mh,2),kh=Math.abs(Yn[0])*al(Un,T,Kn);if(wd||kh<=Fh){let Ct=this.textStates[I].textAlign,Ce=(Fh-kh)*gh(T,Ct),Jt=$f(h,Ah,Mh,2,T,Ce,Rd,Math.abs(Yn[0]),al,Un,Kn,X?0:this.viewRotation_,Td);t:if(Jt){let Se=[],Qt,Xe,ze,ft,Nt;if(k)for(Qt=0,Xe=Jt.length;Qt<Xe;++Qt){Nt=Jt[Qt],ze=Nt[4],ft=this.createLabel(ze,I,"",k),m=Nt[2]+(Yn[0]<0?-_o:_o)-Dh,_=po*ft.height+(.5-po)*2*_o*Yn[1]/Yn[0]-Oh;let We=this.calculateImageOrLabelDimensions_(ft.width,ft.height,Nt[0],Nt[1],ft.width,ft.height,m,_,0,0,Nt[3],bh,!1,Je,!1,N);if(l&&C==="declutter"&&l.collides(We.declutterBox))break t;Se.push([t,e,ft,We,1,null,null])}if(G)for(Qt=0,Xe=Jt.length;Qt<Xe;++Qt){Nt=Jt[Qt],ze=Nt[4],ft=this.createLabel(ze,I,G,""),m=Nt[2]-Dh,_=po*ft.height-Oh;let We=this.calculateImageOrLabelDimensions_(ft.width,ft.height,Nt[0],Nt[1],ft.width,ft.height,m,_,0,0,Nt[3],bh,!1,Je,!1,N);if(l&&C==="declutter"&&l.collides(We.declutterBox))break t;Se.push([t,e,ft,We,1,null,null])}l&&C!=="none"&&l.load(Se.map(Jf));for(let We=0,Id=Se.length;We<Id;++We)this.replayImageOrLabel_.apply(this,Se[We])}}++u;break;case b.END_GEOMETRY:if(o!==void 0){N=v[1];let Ct=o(N,xt,C);if(Ct)return Ct}++u;break;case b.FILL:Z?D++:this.fill_(t),++u;break;case b.MOVE_TO_LINE_TO:d=v[1],g=v[2],x=v[3];let Mi,Bn,Nr;if(x){let Ce=(v[4]??!1)||Math.abs(h[d]-h[g-2])<1e-6&&Math.abs(h[d+1]-h[g-1])<1e-6;lo(h,d,g,2,x,Ce,p),ho(p,2,Ce),Mi=p,Bn=0,Nr=Mi.length}else Mi=h,Bn=d,Nr=g;$=Mi[Bn],Q=Mi[Bn+1],t.moveTo($,Q),y=$+.5|0,E=Q+.5|0;for(let Ct=Bn+2;Ct<Nr;Ct+=2)$=Mi[Ct],Q=Mi[Ct+1],R=$+.5|0,L=Q+.5|0,(Ct==Nr-2||R!==y||L!==E)&&(t.lineTo($,Q),y=R,E=L);++u;break;case b.SET_FILL_STYLE:this.alignAndScaleFill_=v[2],D?(this.fill_(t),D=0,K&&(t.stroke(),K=0)):K&&v[1]&&(t.stroke(),K=0),t.fillStyle=v[1],++u;break;case b.SET_STROKE_STYLE:D&&v[1]&&(this.fill_(t),D=0),K&&(t.stroke(),K=0),this.setStrokeStyle_(t,v),++u;break;case b.STROKE:Z?K++:t.stroke(),++u;break;default:++u;break}}D&&this.fill_(t),K&&t.stroke()}execute(t,e,i,r,s,o){this.viewRotation_=r,this.execute_(t,e,i,this.instructions,s,void 0,void 0,o)}executeHitDetection(t,e,i,r,s){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,r,s)}},td=mh;var Ii=["Polygon","Circle","LineString","Image","Text","Default"],yh=["Image","Text"],ed=Ii.filter(n=>!yh.includes(n)),id=!1,nd=!1;function Hm(){let n=0,t=i=>{let r=tt(1,1,null,{willReadFrequently:i}),s=0,o=performance.now();for(;performance.now()-o<50;++s)r.fillStyle=`rgba(255,0,${s%256},1)`,r.fillRect(0,0,1,1),r.getImageData(0,0,1,1);return n=s>n?s:n,s};id={[t(!0)]:!0,[t(!1)]:!1,[t(void 0)]:void 0}[n],nd=!0}var _h=class{constructor(t,e,i,r,s,o,a){this.maxExtent_=t,this.overlaps_=r,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=It(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(s,a)}clip(t,e){let i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(let i in t){let r=this.executorsByZIndex_[i];r===void 0&&(r={},this.executorsByZIndex_[i]=r);let s=t[i];for(let o in s){let a=s[o];r[o]=new td(this.resolution_,this.pixelRatio_,this.overlaps_,a,e)}}}hasExecutors(t){for(let e in this.executorsByZIndex_){let i=this.executorsByZIndex_[e];for(let r=0,s=t.length;r<s;++r)if(t[r]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,r,s,o){nd===!1&&Hm(),r=Math.round(r);let a=r*2+1,l=Lt(this.hitDetectionTransform_,r+.5,r+.5,1/e,-1/e,-i,-t[0],-t[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=tt(a,a,null,{willReadFrequently:id}));let h=this.hitDetectionContext_;h.canvas.width!==a||h.canvas.height!==a?(h.canvas.width=a,h.canvas.height=a):c||h.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=mt(),Fi(u,t),sn(u,e*(this.renderBuffer_+r),u));let f=qm(r),d;function g(E,R,L){let w=h.getImageData(0,0,a,a).data;for(let T=0,I=f.length;T<I;T++)if(w[f[T]]>0){if(!o||L==="none"||d!=="Image"&&d!=="Text"||o.includes(E)){let k=(f[T]-3)/4,G=r-k%a,D=r-(k/a|0),K=s(E,R,G*G+D*D);if(K)return K}h.clearRect(0,0,a,a);break}}let p=Object.keys(this.executorsByZIndex_).map(Number);p.sort(zt);let m,_,x,C,y;for(m=p.length-1;m>=0;--m){let E=p[m].toString();for(x=this.executorsByZIndex_[E],_=Ii.length-1;_>=0;--_)if(d=Ii[_],C=x[d],C!==void 0&&(y=C.executeHitDetection(h,l,i,g,u),y))return y}}getClipCoords(t){let e=this.maxExtent_;if(!e)return null;let i=e[0],r=e[1],s=e[2],o=e[3],a=[i,r,i,o,s,o,s,r];return Wt(a,0,8,2,t,a),a}isEmpty(){return ce(this.executorsByZIndex_)}execute(t,e,i,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?Gh:zt),o=o||Ii;let c=Ii.length;for(let h=0,u=l.length;h<u;++h){let f=l[h].toString(),d=this.executorsByZIndex_[f];for(let g=0,p=o.length;g<p;++g){let m=o[g],_=d[m];if(_!==void 0){let x=a===null?void 0:_.getZIndexContext(),C=x?x.getContext():t,y=this.maxExtent_&&m!=="Image"&&m!=="Text";if(y&&(C.save(),this.clip(C,i)),!x||m==="Text"||m==="Image"?_.execute(C,e,i,r,s,a):x.pushFunction(E=>
7_.execute(E,e,i,r,s,a)),y&&C.restore(),x){x.offset();let E=l[h]*c+Ii.indexOf(m);this.deferredZIndexContexts_[E]||(this.deferredZIndexContexts_[E]=[]),this.deferredZIndexContexts_[E].push(x)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(zt);for(let i=0,r=e.length;i<r;++i)t[e[i]].forEach(s=>{s.draw(this.renderedContext_),s.clear()}),t[e[i]].length=0}},ph={};function qm(n){if(ph[n]!==void 0)return ph[n];let t=n*2+1,e=n*n,i=new Array(e+1);for(let s=0;s<=n;++s)for(let o=0;o<=n;++o){let a=s*s+o*o;if(a>e)break;let l=i[a];l||(l=[],i[a]=l),l.push(((n+s)*t+(n+o))*4+3),s>0&&l.push(((n-s)*t+(n+o))*4+3),o>0&&(l.push(((n+s)*t+(n-o))*4+3),s>0&&l.push(((n-s)*t+(n-o))*4+3))}let r=[];for(let s=0,o=i.length;s<o;++s)i[s]&&r.push(...i[s]);return ph[n]=r,r}var rd=_h;var xh=class extends ao{constructor(t,e,i,r,s,o,a){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=r,this.transformRotation_=r?Oi(Math.atan2(r[1],r[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=o,this.userTransform_=a,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_=It()}drawImages_(t,e,i,r){if(!this.image_)return;let s=Wt(t,e,i,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let c=this.imageRotation_;this.transformRotation_===0&&(c-=this.viewRotation_),this.imageRotateWithView_&&(c+=this.viewRotation_);for(let h=0,u=s.length;h<u;h+=2){let f=s[h]-this.imageAnchorX_,d=s[h+1]-this.imageAnchorY_;if(c!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let g=f+this.imageAnchorX_,p=d+this.imageAnchorY_;Lt(a,g,p,1,1,c,-g,-p),o.save(),o.transform.apply(o,a),o.translate(g,p),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,f,d,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(t,e,i,r){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);let s=Wt(t,e,i,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);e<i;e+=r){let l=s[e]+this.textOffsetX_,c=s[e+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,c-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,l,c),this.textFillState_&&o.fillText(this.text_,l,c))}}moveToLineTo_(t,e,i,r,s,o){let a=this.context_,l=Wt(t,e,i,r,this.transform_,this.pixelCoordinates_);if(Math.abs(o)>0){let h=l.length,u=s||Math.abs(l[0]-l[h-2])<1e-6&&Math.abs(l[1]-l[h-1])<1e-6;l=lo(l,0,h,2,o,u,l),ho(l,2,u)}a.moveTo(l[0],l[1]);let c=l.length;s&&(c-=2);for(let h=2;h<c;h+=2)a.lineTo(l[h],l[h+1]);return s&&a.closePath(),i}drawRings_(t,e,i,r,s){for(let o=0,a=i.length;o<a;++o)e=this.moveToLineTo_(t,e,i[o],r,!0,s);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!st(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let e=kc(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],r=e[3]-e[1],s=Math.sqrt(i*i+r*r),o=this.context_;o.beginPath(),o.arc(e[0],e[1],s,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(t.getCenter(),0,2,2)}}
7setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t);break;default:}}drawFeature(t,e){let i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){let e=t.getGeometriesArray();for(let i=0,r=e.length;i<r;++i)this.drawGeometry(e[i])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let 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_));let 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_)),!!st(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1,this.strokeState_.strokeOffset),e.stroke()}if(this.text_!==""){let e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let e=t.getExtent();if(st(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let i=this.context_,r=t.getFlatCoordinates(),s=0,o=t.getEnds(),a=t.getStride();i.beginPath();for(let l=0,c=o.length;l<c;++l)s=this.moveToLineTo_(r,s,o[l],a,!1,this.strokeState_.strokeOffset);i.stroke()}if(this.text_!==""){let i=t.getFlatMidpoints();this.drawText_(i,0,i.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!st(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){let e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!st(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let e=this.context_,i=t.getOrientedFlatCoordinates(),r=0,s=t.getEndss(),o=t.getStride();e.beginPath();for(let a=0,l=s.length;a<l;++a){let c=s[a];r=this.drawRings_(i,r,c,o,this.strokeState_?.strokeOffset)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){let e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){let 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){let e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),Pt(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){let e=this.context_,i=this.contextTextState_,r=t.textAlign?t.textAlign:Ci;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=r&&(i.textAlign=r,e.textAlign=r),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=r,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:r,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(!t)this.fillState_=null;else{let i=t.getColor();this.fillState_={fillStyle:Ut(i||Tt)}}if(!e)this.strokeState_=null;else{let i=e.getColor(),r=e.getLineCap(),s=e.getLineDash(),o=e.getLineDashOffset(),a=e.getLineJoin(),l=e.getWidth(),c=e.getMiterLimit(),h=s||Yt,u=e.getOffset();this.strokeState_={lineCap:r!==void 0?r:Oe,lineDash:this.pixelRatio_===1?h:h.map(f=>f*this.pixelRatio_),lineDashOffset:(o||Kt)*this.pixelRatio_,lineJoin:a!==void 0?a:be,lineWidth:(l!==void 0?l:Qe)*this.pixelRatio_,miter
7Limit:c!==void 0?c:$e,strokeStyle:Ut(i||kt),strokeOffset:(u??0)*this.pixelRatio_}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}let i=t.getPixelRatio(this.pixelRatio_),r=t.getAnchor(),s=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*i,this.imageAnchorY_=r[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();let o=t.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/i,o[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(!t)this.text_="";else{let e=t.getFill();if(!e)this.textFillState_=null;else{let d=e.getColor();this.textFillState_={fillStyle:Ut(d||Tt)}}let i=t.getStroke();if(!i)this.textStrokeState_=null;else{let d=i.getColor(),g=i.getLineCap(),p=i.getLineDash(),m=i.getLineDashOffset(),_=i.getLineJoin(),x=i.getWidth(),C=i.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:Oe,lineDash:p||Yt,lineDashOffset:m||Kt,lineJoin:_!==void 0?_:be,lineWidth:x!==void 0?x:Qe,miter
7Limit:C!==void 0?C:$e,strokeStyle:Ut(d||kt)}}let r=t.getFont(),s=t.getOffsetX(),o=t.getOffsetY(),a=t.getRotateWithView(),l=t.getRotation(),c=t.getScaleArray(),h=t.getText(),u=t.getTextAlign(),f=t.getTextBaseline();this.textState_={font:r!==void 0?r:Gs,textAlign:u!==void 0?u:Ci,textBaseline:f!==void 0?f:Vi},this.text_=h!==void 0?Array.isArray(h)?h.reduce((d,g,p)=>d+=p%2?" ":g,""):h:"",this.textOffsetX_=s!==void 0?this.pixelRatio_*s:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}}},sd=xh;var xe=.5;function od(n,t,e,i,r,s,o,a,l){let c=l?fi(r,l):r,h=n[0]*xe,u=n[1]*xe,f=tt(h,u);f.imageSmoothingEnabled=!1;let d=f.canvas,g=new sd(f,xe,r,null,o,a,l?Ve(Xi(),l):null),p=e.length,m=Math.floor((256*256*256-1)/p),_={};for(let C=1;C<=p;++C){let y=e[C-1],E=y.getStyleFunction()||i;if(!E)continue;let R=E(y,s);if(!R)continue;Array.isArray(R)||(R=[R]);let w=(C*m).toString(16).padStart(7,"#00000");for(let T=0,I=R.length;T<I;++T){let k=R[T],G=k.getGeometryFunction()(y);if(!G||!st(c,G.getExtent()))continue;let D=k.clone(),K=D.getFill();K&&K.setColor(w);let ot=D.getStroke();ot&&(ot.setColor(w),ot.setLineDash(null)),D.setText(void 0);let A=k.getImage();if(A){let N=A.getImageSize();if(!N)continue;let $=tt(N[0],N[1],void 0,{alpha:!1}),Q=$.canvas;$.fillStyle=w,$.fillRect(0,0,Q.width,Q.height),D.setImage(new Ws({img:Q,anchor:A.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:A.getOrigin(),opacity:1,size:A.getSize(),scale:A.getScale(),rotation:A.getRotation(),rotateWithView:A.getRotateWithView()}))}let X=D.getZIndex()||0,P=_[X];P||(P={},_[X]=P,P.Polygon=[],P.Circle=[],P.LineString=[],P.Point=[]);let Z=G.getType();if(Z==="GeometryCollection"){let N=G.getGeometriesArrayRecursive();for(let $=0,Q=N.length;$<Q;++$){let xt=N[$];P[xt.getType().replace("Multi","")].push(xt,D)}}else P[Z.replace("Multi","")].push(G,D)}}let x=Object.keys(_).map(Number).sort(zt);for(let C=0,y=x.length;C<y;++C){let E=_[x[C]];for(let R in E){let L=E[R];for(let w=0,T=L.length;w<T;w+=2){g.setStyle(L[w+1]);for(let I=0,k=t.length;I<k;++I)g.setTransform(t[I]),g.drawGeometry(L[w])}}}return f.getImageData(0,0,d.width,d.height)}function ad(n,t,e){let i=[];if(e){let r=Math.floor(Math.round(n[0])*xe),s=Math.floor(Math.round(n[1])*xe),o=(J(r,0,e.width-1)+J(s,0,e.height-1)*e.width)*4,a=e.data[o],l=e.data[o+1],h=e.data[o+2]+256*(l+256*a),u=Math.floor((256*256*256-1)/t.length);h&&h%u===0&&i.push(t[h/u-1])}return i}var $m=.5,ld={Point:rp,LineString:ep,Polygon:op,MultiPoint:sp,MultiLineString:ip,MultiPolygon:np,GeometryCollection:tp,Circle:Jm};function hd(n,t){return parseInt(F(n),10)-parseInt(F(t),10)}function Eh(n,t){let e=Ch(n,t);return e*e}function Ch(n,t){return $m*n/t}function Jm(n,t,e,i,r){let s=e.getFill(),o=e.getStroke();if(s||o){let l=n.getBuilder(e.getZIndex(),"Circle");l.setFillStrokeStyle(s,o),l.drawCircle(t,i,r)}let a=e.getText();if(a&&a.getText()){let l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i,r)}}function Sh(n,t,e,i,r,s,o,a){let l=[],c=e.getImage();if(c){let f=!0,d=c.getImageState();d==z.LOADED||d==z.ERROR?f=!1:d==z.IDLE&&c.load(),f&&l.push(c.ready())}let h=e.getFill();h&&h.loading()&&l.push(h.ready());let u=l.length>0;return u&&Promise.all(l).then(()=>r(null)),Qm(n,t,e,i,s,o,a),u}function Qm(n,t,e,i,r,s,o){let a=e.getGeometryFunction()(t);if(!a)return;let l=a.simplifyTransformed(i,r);if(e.getRenderer())cd(n,l,e,t,o);else{let h=ld[l.getType()];h(n,l,e,t,o,s)}}function cd(n,t,e,i,r){if(t.getType()=="GeometryCollection"){let o=t.getGeometries();for(let a=0,l=o.length;a<l;++a)cd(n,o[a],e,i,r);return}n.getBuilder(e.getZIndex(),"Default").drawCustom(t,i,e.getRenderer(),e.getHitDetectionRenderer(),r)}function tp(n,t,e,i,r,s){let o=t.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let c=ld[o[a].getType()];c(n,o[a],e,i,r,s)}}function ep(n,t,e,i,r){let s=e.getStroke();if(s){let a=n.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawLineString(t,i,r)}let o=e.getText();if(o&&o.getText()){let a=n.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i,r)}}function ip(n,t,e,i,r){let s=e.getStroke();if(s){let a=n.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawMultiLineString(t,i,r)}let o=e.getText();if(o&&o.getText()){let a=n.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i,r)}}
7function np(n,t,e,i,r){let s=e.getFill(),o=e.getStroke();if(o||s){let l=n.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawMultiPolygon(t,i,r)}let a=e.getText();if(a&&a.getText()){let l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i,r)}}function rp(n,t,e,i,r,s){let o=e.getImage(),a=e.getText(),l=a&&a.getText(),c=s&&o&&l?{}:void 0;if(o){if(o.getImageState()!=z.LOADED)return;let h=n.getBuilder(e.getZIndex(),"Image");h.setImageStyle(o,c),h.drawPoint(t,i,r)}if(l){let h=n.getBuilder(e.getZIndex(),"Text");h.setTextStyle(a,c),h.drawText(t,i,r)}}function sp(n,t,e,i,r,s){let o=e.getImage(),a=o&&o.getOpacity()!==0,l=e.getText(),c=l&&l.getText(),h=s&&a&&c?{}:void 0;if(a){if(o.getImageState()!=z.LOADED)return;let u=n.getBuilder(e.getZIndex(),"Image");u.setImageStyle(o,h),u.drawMultiPoint(t,i,r)}if(c){let u=n.getBuilder(e.getZIndex(),"Text");u.setTextStyle(l,h),u.drawText(t,i,r)}}function op(n,t,e,i,r){let s=e.getFill(),o=e.getStroke();if(s||o){let l=n.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawPolygon(t,i,r)}let a=e.getText();if(a&&a.getText()){let l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i,r)}}var wh=class extends oo{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=mt(),this.wrappedRenderedExtent_=mt(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,i){let r=e.extent,s=e.viewState,o=s.center,a=s.resolution,l=s.projection,c=s.rotation,h=l.getExtent(),u=this.getLayer().getSource(),f=this.getLayer().getDeclutter(),d=e.pixelRatio,g=e.viewHints,p=!(g[Rt.ANIMATING]||g[Rt.INTERACTING]),m=this.context,_=Math.round(B(r)/a*d),x=Math.round(at(r)/a*d),C=u.getWrapX()&&l.canWrapX(),y=C?B(h):null,E=C?Math.ceil((r[2]-h[2])/y)+(this.extendX_?2:1):1,R=C?Math.floor((r[0]-h[0])/y)-(this.extendX_?1:0):0;do{let L=this.getRenderTransform(o,a,0,d,_,x,R*y);e.declutter&&(L=L.slice(0)),t.execute(m,[m.canvas.width,m.canvas.height],L,c,p,i===void 0?Ii:i?yh:ed,i?f&&e.declutter[f]:void 0)}while(++R<E)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=tt(this.context.canvas.width,this.context.canvas.height,Bl))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){let t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,zi(this.context),Bl.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,t,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(t,e){let i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;let r=t.viewState;this.prepareContainer(t,e);let s=this.context,o=this.replayGroup_,a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(At.PRERENDER)||this.getLayer().hasListener(At.POSTRENDER)))return this.container;this.setDrawContext_(),this.preRender(s,t);let l=r.projection;this.clipExtent_=null;let c=!1;if(a&&i.extent&&this.clipping){let h=me(i.extent,l);a=st(h,t.extent),a&&!Le(h,t.extent)&&(t.declutter?this.clipExtent_=h:(this.clipUnrotated(s,t,h),c=!0))}return a&&this.renderWorlds(o,t,this.getLayer().getDeclutter()?!1:void 0),c&&s.restore(),this.postRender(s,t),this.renderedRotation_!==r.rotation&&(this.renderedRotation_=r.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let i=this.frameState.size.slice(),r=this.renderedCenter_,s=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,c=this.getLayer(),h=[],u=i[0]*xe,f=i[1]*xe;h.push(this.getRenderTransform(r,s,o,xe,u,f,0).slice());let d=c.getSource(),g=a.getExtent();if(d.getWrapX()&&a.canWrapX()&&!Le(g,l)){let m=l[0],_=B(g),x=0,C;for(;m<g[0];)--x,C=_*x,h.push(this.getRenderTransform(r,s,o,xe,u,f,C).slice()),m+=_;for(x=0,m=l[2];m>g[2];)++x,C=_*x,h.push(this.getRenderTransform(r,s,o,xe,u,f,C).slice()),m-=_}let p=Xi();this.hitDetectionImageData_=od(i,h,this.renderedFeatures_,c.getStyleFunction(),l,s,o,Eh(s,this.renderedPixelRatio_),p?a:null)}e(ad(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,r,s){if(!this.replayGroup_)return;let o=e.viewState.resolution,a=e.viewState.rotation,l=this.getLayer(),c={},h=function(f,d,g){let p=F(f),m=c[p];if(m){if(m!==!0&&g<m.distanceSq){if(g===0)return c[p]=!0,s.splice(s.lastIndexOf(m),1),r(f,l,d);m.geometry=d,m.distanceSq=g}}else{if(g===0)return c[p]=!0,r(f,l,d);s.push(c[p]={feature:f,layer:l,geometry:d,distanceSq:g,callback:r})}},u=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,o,a,i,h,u?e.declutter?.[u]?.all().map(f=>f.value):null)}handleFontsChanged(){let t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){let e=this.getLayer(),i=e.getSource();if(!i)return!1;let r=t.viewHints[Rt.ANIMATING],s=t.viewHints[Rt.INTERACTING],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!o&&r||!a&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let l=t.extent,c=t.viewState,h=c.projection,u=c.resolution,f=t.pixelRatio,d=e.getRevision(),g=e.getRenderBuffer(),p=e.getRenderOrder();p===void 0&&(p=hd);let m=c.center.slice(),_=sn(l,g*u),x=_.slice(),C=[_.slice()],y=h.getExtent(),E=i.getWrapX()&&h.canWrapX();if(this.extendX_=!1,E){let A=i.getExtent();A&&!Me(A)&&(this.extendX_=A[0]<y[0]||A[2]>y[2])}if(E&&(!Le(y,t.extent)||this.extendX_)){let A=B(y),X=Math.max(B(_)/2,A),P=y[0],Z=y[2];this.extendX_&&(P-=A,Z+=A),_[0]=P-X,_[2]=Z+X,Jr(m,h);let N=ko(C[0],h);N[0]<y[0]&&N[2]<y[2]?C.push([N[0]+A,N[1],N[2]+A,N[3]]):N[0]>y[0]&&N[2]>y[2]&&C.push([N[0]-A,N[1],N[2]-A,N[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedPixelRatio_===f&&this.renderedRevision_==d&&this.renderedRenderOrder_==p&&this.renderedFrameDeclutter_===!!t.declutter&&Le(this.wrappedRenderedExtent_,_))return Pt(this.renderedExtent_,x)||(this.hitDetectionImageData_=null,this.renderedExtent_=x),this.renderedCenter_=m,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let R=new qf(Ch(u,f),_,u,f),L=Xi(),w;if(L){for(let A=0,X=C.length;A<X;++A){let P=C[A],Z=fi(P,h);i.loadFeatures(Z,vc(u,h),L)}w=Ve(L,h)}else for(let A=0,X=C.length;A<X;++A)i.loadFeatures(C[A],u,h);let T=Eh(u,f),I=!0,k=(A,X)=>{let P,Z=A.getStyleFunction()||e.getStyleFunction();if(Z&&(P=Z(A,u)),P){let N=this.renderFeature(A,T,P,R,w,this.getLayer().getDeclutter(),X);I=I&&!N}},G=fi(_,h),D=i.getFeaturesInExtent(G);p&&D.sort(p);for(let A=0,X=D.length;A<X;++A)k(D[A],A);this.renderedFeatures_=D,this.ready=I;let K=R.finish(),ot=new rd(_,u,f,i.getOverlaps(),K,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=u,this.renderedRevision_=d,this.renderedRenderOrder_=p,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=x,this.wrappedRenderedExtent_=_,this.renderedCenter_=m,this.renderedProjection_=h,this.renderedPixelRatio_=f,this.replayGroup_=ot,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,r,s,o,a){if(!i)return!1;let l=!1;if(Array.isArray(i))for(let c=0,h=i.length;c<h;++c)l=Sh(r,t,i[c],e,this.boundHandleStyleImageChange_,s,o,a)||l;else l=Sh(r,t,i,e,this.boundHandleStyleImageChange_,s,o,a);return l}},ud=wh;var Rh=class extends js{constructor(t){super(t)}createRenderer(){return new ud(this)}},co=Rh;var uo={SELECT:"select"},Fn=class extends pt{constructor(t,e,i,r){super(t),this.selected=e,this.deselected=i,this.mapBrowserEvent=r}},fo={},Th=class n extends oe{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.boundAddFeature_=this.addFeature_.bind(this),this.boundRemoveFeature_=this.removeFeature_.bind(this),this.condition_=t.condition?t.condition:mu,this.addCondition_=t.addCondition?t.addCondition:Aa,this.removeCondition_=t.removeCondition?t.removeCondition:Aa,this.toggleCondition_=t.toggleCondition?t.toggleCondition:Ss,this.multi_=t.multi?t.multi:!1,this.filter_=t.filter?t.filter:te,this.hitTolerance_=t.hitTolerance?t.hitTolerance:0,this.style_=t.style!==void 0?t.style:ap(),this.features_=t.features||new St;let e;if(t.layers)if(typeof t.layers=="function")e=t.layers;else{let i=t.layers;e=function(r){return i.includes(r)}}else e=te;this.layerFilter_=e,this.featureLayerAssociation_={}}addFeatureLayerAssociation_(t,e){this.featureLayerAssociation_[F(t)]=e}getFeatures(){return this.features_}getHitTolerance(){return this.hitTolerance_}getLayer(t){return this.featureLayerAssociation_[F(t)]}setHitTolerance(t){this.hitTolerance_=t}setMap(t){this.getMap()&&this.style_&&this.features_.forEach(this.restorePreviousStyle_.bind(this)),super.setMap(t),t?(this.features_.addEventListener(lt.ADD,this.boundAddFeature_),this.features_.addEventListener(lt.REMOVE,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(lt.ADD,this.boundAddFeature_),this.features_.removeEventListener(lt.REMOVE,this.boundRemoveFeature_))}addFeature_(t){let e=t.element;if(this.style_&&this.applySelectedStyle_(e),!this.getLayer(e)){let i=this.findLayerOfFeature_(e);
7i&&this.addFeatureLayerAssociation_(e,i)}}removeFeature_(t){this.style_&&this.restorePreviousStyle_(t.element),this.removeFeatureLayerAssociation_(t.element)}findLayerOfFeature_(t){return this.getMap().getAllLayers().find(function(i){if(i instanceof co&&i.getSource()&&i.getSource().hasFeature(t))return i})}getStyle(){return this.style_}applySelectedStyle_(t){let e=F(t);e in fo||(fo[e]=t.getStyle()),t.setStyle(this.style_)}restorePreviousStyle_(t){let e=this.getMap().getInteractions().getArray();for(let r=e.length-1;r>=0;--r){let s=e[r];if(s!==this&&s instanceof n&&s.getStyle()&&s.getFeatures().getArray().lastIndexOf(t)!==-1){t.setStyle(s.getStyle());return}}let i=F(t);t.setStyle(fo[i]),delete fo[i]}removeFeatureLayerAssociation_(t){delete this.featureLayerAssociation_[F(t)]}selectFeature(t){let e=this.findLayerOfFeature_(t);if(!this.layerFilter_(e)||!this.filter_(t,e))return!1;let i=this.getFeatures();return i.getArray().includes(t)?!1:(this.addFeatureLayerAssociation_(t,e),i.push(t),this.dispatchEvent(new Fn(uo.SELECT,[t],[],void 0)),!0)}deselectFeature(t){let e=this.getFeatures(),i=e.getArray().indexOf(t);return i===-1?!1:(e.removeAt(i),this.dispatchEvent(new Fn(uo.SELECT,[],[t],void 0)),!0)}toggleFeature(t){this.deselectFeature(t)||this.selectFeature(t)}clearSelection(){let t=this.getFeatures();if(t.getLength()!==0){let e=t.getArray().slice();t.clear(),this.dispatchEvent(new Fn(uo.SELECT,[],e,void 0))}}handleEvent(t){if(!this.condition_(t))return!0;let e=this.addCondition_(t),i=this.removeCondition_(t),r=this.toggleCondition_(t),s=!e&&!i&&!r,o=t.map,a=this.getFeatures(),l=[],c=[];if(s){o.forEachFeatureAtPixel(t.pixel,(h,u)=>{if(!(!(h instanceof Ir)||!this.filter_(h,u)))return this.addFeatureLayerAssociation_(h,u),c.push(h),!this.multi_},{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let h=a.getLength()-1;h>=0;--h){let u=a.item(h),f=c.indexOf(u);f===-1?(a.removeAt(h),l.push(u)):c.splice(f,1)}c.length!==0&&a.extend(c)}else{o.forEachFeatureAtPixel(t.pixel,(h,u)=>{if(!(h instanceof Ir)||!this.filter_(h,u))return;let f=a.getArray().includes(h);return f&&(i||r)?l.push(h):!f&&(e||r)&&(this.addFeatureLayerAssociation_(h,u),c.push(h)),!this.multi_},{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let h=l.length-1;h>=0;--h)a.remove(l[h]);a.extend(c)}return(c.length>0||l.length>0)&&this.dispatchEvent(new Fn(uo.SELECT,c,l,t)),!0}};function ap(){let n=Ju();return Ue(n.Polygon,n.LineString),Ue(n.GeometryCollection,n.LineString),function(t){return t.getGeometry()?n[t.getGeometry().getType()]:null}}var Ih=Th;var lp=`https://api.maptiler.com/maps/basic/tiles.json?key=${mt_k}`,_d=1,vh=new De({image:new ti({radius:6,fill:new Xt({color:"#C94A18"}),stroke:new le({color:"white",width:_d})})}),fd=n=>new De({image:new ti({radius:6,fill:new Xt({color:"#C94A18"}),stroke:new le({color:"#C94A18",width:_d})}),text:new Cr({text:n,offsetY:-20,padding:[4,6,4,6],backgroundFill:new Xt({color:"rgba(255, 255, 255, 0.9)"}),backgroundStroke:new le({color:"#333",width:1}),font:"12px sans-serif",fill:new Xt({color:"#000"})})});function yd(n,t,e,i,r){return new Ir({geometry:new ir(as([n,t])),name:e,url:i,uri:r})}function xd(n){return new co({source:new Yf({features:n})})}function hp(){return new Gf({source:new bf({url:lp,attributions:[],tileSize:512,crossOrigin:"anonymous"})})}function cp(n,t,e=!0){if(!t.length)return;let i=qn(t);i=Zr(i,i),n.getView().fit(i,{padding:[50,50,50,50],maxZoom:10,duration:e?600:0})}function Lh(n,t=!0){if(!n)return null;let i=Ze([15,62],"EPSG:4326","EPSG:3857"),r=new gf({target:n,layers:[hp()],view:new Vt({center:t?i:[0,0],zoom:6}),controls:or({zoom:!1,rotate:!1,attribution:!1})});return r.on("moveend",()=>{let s=r.getView().calculateExtent(r.getSize()),o=ui(s,"EPSG:3857","EPSG:4326"),a=document.querySelector("#boundingBox");a&&(a.value=o.join(","))}),r}function Ed(n,t,e=!0){let i=Lh(n);if(!i)return;let r=[],s=t?.split(";")??[],o=[];s.forEach(a=>{let[l,c]=a.split(",").map(parseFloat),h=yd(c,l);h.setStyle(vh),r.push(h),o.push(as([c,l]))}),i.addLayer(xd(r)),cp(i,o,e)}function up(n){n.style.opacity="0";let t=Lh(n),i=ui([-10,54.5,32,72],"EPSG:4326","EPSG:3857");t.once("rendercomplete",()=>{t.getView().fit(i,{padding:[50,50,50,50],duration:0}),n.style.opacity="1"}),t.on("moveend",()=>{let r=t.getView().calculateExtent(t.getSize()),s=ui(r,"EPSG:3857","EPSG:4326"),o=document.querySelector("#dialogBoundingBox");o&&(o.value=s.join(","))})}function fp(n,t){let e=JSON.parse(t),i=[],r=[];e.forEach(u=>{if(!u.longLat)return;let[f,d]=u.longLat.split(",").map(parseFloat),g=yd(f,d,u.name,u.url,u.uri);
7g.setStyle(vh),i.push(g),r.push(as([f,d]))});let s=xd(i),o=Lh(n);o.addLayer(s);let l=new URL(window.location.href).searchParams;o.once("rendercomplete",()=>{let u=l.get("omrade")?.split(",").map(parseFloat);if(u&&u.length===4){let f=ui(u,"EPSG:4326","EPSG:3857");o.getView().fit(f,{duration:0})}else{let d=ui([-10,54.5,32,72],"EPSG:4326","EPSG:3857");o.getView().fit(d,{duration:0})}});let c=new Ih({condition:gu,layers:[s],hitTolerance:6,style:u=>fd(u.get("name"))});o.addInteraction(c),o.on("pointermove",u=>{o.getTargetElement().style.cursor=o.hasFeatureAtPixel(u.pixel)?"pointer":""}),o.on("singleclick",u=>{o.forEachFeatureAtPixel(u.pixel,f=>{let d=f.get("url");d&&(window.location.href=d)})});let h=()=>{document.querySelectorAll("[data-uri]").forEach(u=>{u.addEventListener("mouseenter",()=>{let f=i.find(d=>d.get("uri")===u.dataset.uri);f&&f.setStyle(fd(f.get("name")))}),u.addEventListener("mouseleave",()=>{let f=i.find(d=>d.get("uri")===u.dataset.uri);f&&f.setStyle(vh)})})};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",h):h()}var Pr=document.querySelector("#mapPreview");Pr&&Pr.dataset.coords?.length&&Ed(Pr,Pr.dataset.coords,!1);var kn=document.querySelector("#closeDialog"),qt=document.querySelector("#mapDialogNative"),$i=document.querySelector("#fullMap");if(!qt){qt=document.createElement("dialog"),qt.id="mapDialogNative",qt.classList.add("native-map-dialog"),document.body.appendChild(qt);let n=document.createElement("h2");n.textContent="Karta",kn=document.createElement("button"),kn.innerText="St\xE4ng",kn.ariaLabel="St\xE4ng karta",n.appendChild(kn),qt.appendChild(n),$i=document.createElement("div"),$i.id="fullMap",$i.style.width="740px",$i.style.height="600px",qt.appendChild($i),qt.addEventListener("click",t=>{t.target===qt&&qt?.close()})}var dd=document.querySelector("#mapPreviewBtn");qt&&dd&&kn&&$i&&(kn.addEventListener("click",()=>qt.close()),dd.addEventListener("click",()=>{qt.showModal(),Ed($i,Pr?.dataset.coords)}));var gd=document.querySelector("#mapSearchCanvas");gd&&up(gd);var md=document.querySelector("#mapResultCanvas"),pd=document.querySelector("#coordinates")?.textContent;md&&pd&&fp(md,pd);})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.