UNPKG

@web-map-service/map2d

Version:

基于openlayer的2D地图服务

1 lines 351 kB
(function(rt,j){typeof exports=="object"&&typeof module<"u"?j(exports):typeof define=="function"&&define.amd?define(["exports"],j):(rt=typeof globalThis<"u"?globalThis:rt||self,j(rt.map2d={}))})(this,function(rt){"use strict";var R_=Object.defineProperty;var S_=(rt,j,Xt)=>j in rt?R_(rt,j,{enumerable:!0,configurable:!0,writable:!0,value:Xt}):rt[j]=Xt;var Fh=(rt,j,Xt)=>S_(rt,typeof j!="symbol"?j+"":j,Xt);const j={ADD:"add",REMOVE:"remove"},Xt={PROPERTYCHANGE:"propertychange"},F={CHANGE:"change",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",KEYDOWN:"keydown",KEYPRESS:"keypress",TOUCHMOVE:"touchmove",WHEEL:"wheel"};class bs{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function Oh(s,t,e){let i,n;e=e||ke;let r=0,o=s.length,a=!1;for(;r<o;)i=r+(o-r>>1),n=+e(s[i],t),n<0?r=i+1:(o=i,a=!n);return a?r:~r}function ke(s,t){return s>t?1:s<t?-1:0}function kh(s,t){return s<t?1:s>t?-1:0}function Ds(s,t,e){if(s[0]<=t)return 0;const i=s.length;if(t<=s[i-1])return i-1;if(typeof e=="function"){for(let n=1;n<i;++n){const r=s[n];if(r===t)return n;if(r<t)return e(t,s[n-1],r)>0?n-1:n}return i-1}if(e>0){for(let n=1;n<i;++n)if(s[n]<t)return n-1;return i-1}if(e<0){for(let n=1;n<i;++n)if(s[n]<=t)return n;return i-1}for(let n=1;n<i;++n){if(s[n]==t)return n;if(s[n]<t)return s[n-1]-t<t-s[n]?n-1:n}return i-1}function Nh(s,t,e){for(;t<e;){const i=s[t];s[t]=s[e],s[e]=i,++t,--e}}function Pt(s,t){const e=Array.isArray(t)?t:[t],i=e.length;for(let n=0;n<i;n++)s[s.length]=e[n]}function re(s,t){const e=s.length;if(e!==t.length)return!1;for(let i=0;i<e;i++)if(s[i]!==t[i])return!1;return!0}function $t(){return!0}function ei(){return!1}function Di(){}function bo(s){let t,e,i;return function(){const n=Array.prototype.slice.call(arguments);return(!e||this!==i||!re(n,e))&&(i=this,e=n,t=s.apply(this,arguments)),t}}function Do(s){function t(){let e;try{e=s()}catch(i){return Promise.reject(i)}return e instanceof Promise?e:Promise.resolve(e)}return t()}function ii(s){for(const t in s)delete s[t]}function ni(s){let t;for(t in s)return!1;return!t}class Tt{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class Ln extends bs{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e=typeof t=="string",i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const r=e?new Tt(t):t;r.target||(r.target=this.eventTarget_||this);const 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=n.length;c<h;++c)if("handleEvent"in n[c]?l=n[c].handleEvent(r):l=n[c].call(this,r),l===!1||r.propagationStopped){l=!1;break}if(--o[i]===0){let c=a[i];for(delete a[i];c--;)this.removeEventListener(i,Di);delete o[i]}return l}disposeInternal(){this.listeners_&&ii(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;const i=this.listeners_[t];if(!i)return;const n=i.indexOf(e);n!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=Di,++this.pendingRemovals_[t]):(i.splice(n,1),i.length===0&&delete this.listeners_[t]))}}function z(s,t,e,i,n){if(n){const o=e;e=function(a){return s.removeEventListener(t,e),o.call(i??this,a)}}else i&&i!==s&&(e=e.bind(i));const r={target:s,type:t,listener:e};return s.addEventListener(t,e),r}function Fo(s,t,e,i){return z(s,t,e,i,!0)}function tt(s){s&&s.target&&(s.target.removeEventListener(s.type,s.listener),ii(s))}class Fi extends Ln{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(F.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=z(this,t[r],e);return n}return z(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let r=0;r<n;++r)i[r]=Fo(this,t[r],e)}else i=Fo(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)Fs(i);else if(Array.isArray(t))for(let n=0,r=t.length;n<r;++n)this.removeEventListener(t[n],e);else this.removeEventListener(t,e)}}Fi.prototype.on,Fi.prototype.once,Fi.prototype.un;function Fs(s){if(Array.isArray(s))for(let t=0,e=s.length;t<e;++t)tt(s[t]);else tt(s)}function U(){throw new Error("Unimplemented abstract method.")}let Gh=0;function Y(s){return s.ol_uid||(s.ol_uid=String(++Gh))}class Oo extends Tt{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class Vt extends Fi{constructor(t){super(),this.on,this.once,this.un,Y(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_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new Oo(i,t,e)),i=Xt.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new Oo(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const n=this.values_||(this.values_={});if(i)n[t]=e;else{const r=n[t];n[t]=e,r!==e&&this.notify(t,r)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],ni(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}const ko={LENGTH:"length"};class An extends Tt{constructor(t,e,i){super(t),this.element=e,this.index=i}}class ot extends Vt{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t||[],this.unique_)for(let i=0,n=this.array_.length;i<n;++i)this.assertUnique_(this.array_[i],i);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(ko.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 An(j.ADD,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new An(j.REMOVE,e,t)),e}setAt(t,e){const 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);const n=this.array_[t];this.array_[t]=e,this.dispatchEvent(new An(j.REMOVE,n,t)),this.dispatchEvent(new An(j.ADD,e,t))}updateLength_(){this.set(ko.LENGTH,this.array_.length)}assertUnique_(t,e){for(let i=0,n=this.array_.length;i<n;++i)if(this.array_[i]===t&&i!==e)throw new Error("Duplicate item added to a unique collection")}}class si extends Tt{constructor(t,e,i){super(t),this.map=e,this.frameState=i!==void 0?i:null}}class oe extends si{constructor(t,e,i,n,r,o){super(t,e,r),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=n!==void 0?n:!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()}}const X={SINGLECLICK:"singleclick",CLICK:F.CLICK,DBLCLICK:F.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Ne=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"";Ne.includes("safari")&&!Ne.includes("chrom")&&(Ne.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(Ne));const Wh=Ne.includes("webkit")&&!Ne.includes("edge"),Os=Ne.includes("macintosh"),Bh=typeof devicePixelRatio<"u"?devicePixelRatio:1,No=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Go=typeof Image<"u"&&Image.prototype.decode,Wo=typeof createImageBitmap=="function",Bo=function(){let s=!1;try{const t=Object.defineProperty({},"passive",{get:function(){s=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return s}(),ks={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown"};class Xh extends Ln{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;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=z(i,ks.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=z(i,ks.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(F.TOUCHMOVE,this.boundHandleTouchMove_,Bo?{passive:!1}:!1)}emulateClick_(t){let e=new oe(X.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new oe(X.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const i=new oe(X.SINGLECLICK,this.map_,t);this.dispatchEvent(i)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==X.POINTERUP||e.type==X.POINTERCANCEL){delete this.trackedTouches_[i];for(const n in this.trackedTouches_)if(this.trackedTouches_[n].target!==e.target){delete this.trackedTouches_[n];break}}else(e.type==X.POINTERDOWN||e.type==X.POINTERMOVE)&&(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new oe(X.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(tt),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);const e=new oe(X.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),this.dragListenerKeys_.length===0){const i=this.map_.getOwnerDocument();this.dragListenerKeys_.push(z(i,X.POINTERMOVE,this.handlePointerMove_,this),z(i,X.POINTERUP,this.handlePointerUp_,this),z(this.element_,X.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(z(this.element_.getRootNode(),X.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new oe(X.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!!(this.down_&&this.isMoving_(t));this.dispatchEvent(new oe(X.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const 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_&&(tt(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(F.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(tt(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(tt),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const ae={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},gt={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},Oi={IDLE:0,LOADED:2,ERROR:3,EMPTY:4};function it(s,t){if(!s)throw new Error(t)}const Pn=1/0;class Vh{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,ii(this.queuedElements_)}dequeue(){const 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));const n=this.keyFunction_(i);return delete this.queuedElements_[n],i}enqueue(t){it(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=Pn?(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){const e=this.elements_,i=this.priorities_,n=e.length,r=e[t],o=i[t],a=t;for(;t<n>>1;){const l=this.getLeftChildIndex_(t),c=this.getRightChildIndex_(t),h=c<n&&i[c]<i[l]?c:l;e[t]=e[h],i[t]=i[h],t=h}e[t]=r,i[t]=o,this.siftDown_(a,t)}siftDown_(t,e){const i=this.elements_,n=this.priorities_,r=i[e],o=n[e];for(;e>t;){const a=this.getParentIndex_(e);if(n[a]>o)i[e]=i[a],n[e]=n[a],e=a;else break}i[e]=r,n[e]=o}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const r=e.length;let o,a,l;for(a=0;a<r;++a)o=e[a],l=t(o),l==Pn?delete this.queuedElements_[this.keyFunction_(o)]:(i[n]=l,e[n++]=o);e.length=n,i.length=n,this.heapify_()}}class zh extends Vh{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){const e=super.enqueue(t);return e&&t[0].addEventListener(F.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===Oi.LOADED||i===Oi.ERROR||i===Oi.EMPTY){i!==Oi.ERROR&&e.removeEventListener(F.CHANGE,this.boundHandleTileChange_);const n=e.getKey();n in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[n],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;){const n=this.dequeue()[0],r=n.getKey();n.getState()===Oi.IDLE&&!(r in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++i,n.load())}}}function Yh(s,t,e,i,n){if(!s||!(e in s.wantedTiles)||!s.wantedTiles[e][t.getKey()])return Pn;const r=s.viewState.center,o=i[0]-r[0],a=i[1]-r[1];return 65536*Math.log(n)+Math.sqrt(o*o+a*a)/n}const lt={ANIMATING:0,INTERACTING:1},zt={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function st(s,t,e){return Math.min(Math.max(s,t),e)}function jh(s,t,e,i,n,r){const o=n-e,a=r-i;if(o!==0||a!==0){const l=((s-e)*o+(t-i)*a)/(o*o+a*a);l>1?(e=n,i=r):l>0&&(e+=o*l,i+=a*l)}return le(s,t,e,i)}function le(s,t,e,i){const n=e-s,r=i-t;return n*n+r*r}function Kh(s){const t=s.length;for(let i=0;i<t;i++){let n=i,r=Math.abs(s[i][i]);for(let a=i+1;a<t;a++){const l=Math.abs(s[a][i]);l>r&&(r=l,n=a)}if(r===0)return null;const o=s[n];s[n]=s[i],s[i]=o;for(let a=i+1;a<t;a++){const l=-s[a][i]/s[i][i];for(let c=i;c<t+1;c++)i==c?s[a][c]=0:s[a][c]+=l*s[i][c]}}const e=new Array(t);for(let i=t-1;i>=0;i--){e[i]=s[i][t]/s[i][i];for(let n=i-1;n>=0;n--)s[n][t]-=s[n][i]*e[i]}return e}function Xo(s){return s*180/Math.PI}function Yt(s){return s*Math.PI/180}function ki(s,t){const e=s%t;return e*t<0?e+t:e}function Mt(s,t,e){return s+e*(t-s)}function bn(s,t){const e=Math.pow(10,t);return Math.round(s*e)/e}function Dn(s,t){return Math.ceil(bn(s,t))}function Ns(s,t,e){if(s>=t&&s<e)return s;const i=e-t;return((s-t)%i+i)%i+t}function Vo(s,t,e){return function(i,n,r,o,a){if(!i)return;if(!n&&!t)return i;const l=t?0:r[0]*n,c=t?0:r[1]*n,h=a?a[0]:0,u=a?a[1]:0;let d=s[0]+l/2+h,f=s[2]-l/2+h,g=s[1]+c/2+u,_=s[3]-c/2+u;d>f&&(d=(f+d)/2,f=d),g>_&&(g=(_+g)/2,_=g);let m=st(i[0],d,f),y=st(i[1],g,_);if(o&&e&&n){const p=30*n;m+=-p*Math.log(1+Math.max(0,d-i[0])/p)+p*Math.log(1+Math.max(0,i[0]-f)/p),y+=-p*Math.log(1+Math.max(0,g-i[1])/p)+p*Math.log(1+Math.max(0,i[1]-_)/p)}return[m,y]}}function Uh(s){return s}const ht={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Et(s){const t=jt();for(let e=0,i=s.length;e<i;++e)Xi(t,s[e]);return t}function Fn(s,t,e){return e?(e[0]=s[0]-t,e[1]=s[1]-t,e[2]=s[2]+t,e[3]=s[3]+t,e):[s[0]-t,s[1]-t,s[2]+t,s[3]+t]}function zo(s,t){return t?(t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t):s.slice()}function Ge(s,t,e){let i,n;return t<s[0]?i=s[0]-t:s[2]<t?i=t-s[2]:i=0,e<s[1]?n=s[1]-e:s[3]<e?n=e-s[3]:n=0,i*i+n*n}function Ni(s,t){return Gs(s,t[0],t[1])}function he(s,t){return s[0]<=t[0]&&t[2]<=s[2]&&s[1]<=t[1]&&t[3]<=s[3]}function Gs(s,t,e){return s[0]<=t&&t<=s[2]&&s[1]<=e&&e<=s[3]}function Ws(s,t){const e=s[0],i=s[1],n=s[2],r=s[3],o=t[0],a=t[1];let l=ht.UNKNOWN;return o<e?l=l|ht.LEFT:o>n&&(l=l|ht.RIGHT),a<i?l=l|ht.BELOW:a>r&&(l=l|ht.ABOVE),l===ht.UNKNOWN&&(l=ht.INTERSECTING),l}function jt(){return[1/0,1/0,-1/0,-1/0]}function We(s,t,e,i,n){return n?(n[0]=s,n[1]=t,n[2]=e,n[3]=i,n):[s,t,e,i]}function Gi(s){return We(1/0,1/0,-1/0,-1/0,s)}function Wi(s,t){const e=s[0],i=s[1];return We(e,i,e,i,t)}function Bs(s,t,e,i,n){const r=Gi(n);return jo(r,s,t,e,i)}function Bi(s,t){return s[0]==t[0]&&s[2]==t[2]&&s[1]==t[1]&&s[3]==t[3]}function Yo(s,t){return t[0]<s[0]&&(s[0]=t[0]),t[2]>s[2]&&(s[2]=t[2]),t[1]<s[1]&&(s[1]=t[1]),t[3]>s[3]&&(s[3]=t[3]),s}function Xi(s,t){t[0]<s[0]&&(s[0]=t[0]),t[0]>s[2]&&(s[2]=t[0]),t[1]<s[1]&&(s[1]=t[1]),t[1]>s[3]&&(s[3]=t[1])}function jo(s,t,e,i,n){for(;e<i;e+=n)Hh(s,t[e],t[e+1]);return s}function Hh(s,t,e){s[0]=Math.min(s[0],t),s[1]=Math.min(s[1],e),s[2]=Math.max(s[2],t),s[3]=Math.max(s[3],e)}function Ko(s,t){let e;return e=t(Vi(s)),e||(e=t(On(s)),e)||(e=t(Nn(s)),e)||(e=t(zi(s)),e)?e:!1}function Zh(s){let t=0;return ri(s)||(t=H(s)*ct(s)),t}function Vi(s){return[s[0],s[1]]}function On(s){return[s[2],s[1]]}function Jt(s){return[(s[0]+s[2])/2,(s[1]+s[3])/2]}function kn(s,t,e,i,n){const[r,o,a,l,c,h,u,d]=qh(s,t,e,i);return We(Math.min(r,a,c,u),Math.min(o,l,h,d),Math.max(r,a,c,u),Math.max(o,l,h,d),n)}function qh(s,t,e,i){const n=t*i[0]/2,r=t*i[1]/2,o=Math.cos(e),a=Math.sin(e),l=n*o,c=n*a,h=r*o,u=r*a,d=s[0],f=s[1];return[d-l+u,f-c-h,d-l-u,f-c+h,d+l-u,f+c+h,d+l+u,f+c-h,d-l+u,f-c-h]}function ct(s){return s[3]-s[1]}function Xs(s,t,e){const i=e||jt();return _t(s,t)?(s[0]>t[0]?i[0]=s[0]:i[0]=t[0],s[1]>t[1]?i[1]=s[1]:i[1]=t[1],s[2]<t[2]?i[2]=s[2]:i[2]=t[2],s[3]<t[3]?i[3]=s[3]:i[3]=t[3]):Gi(i),i}function zi(s){return[s[0],s[3]]}function Nn(s){return[s[2],s[3]]}function H(s){return s[2]-s[0]}function _t(s,t){return s[0]<=t[2]&&s[2]>=t[0]&&s[1]<=t[3]&&s[3]>=t[1]}function ri(s){return s[2]<s[0]||s[3]<s[1]}function $h(s,t){return t?(t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t):s}function Jh(s,t,e){let i=!1;const n=Ws(s,t),r=Ws(s,e);if(n===ht.INTERSECTING||r===ht.INTERSECTING)i=!0;else{const o=s[0],a=s[1],l=s[2],c=s[3],h=t[0],u=t[1],d=e[0],f=e[1],g=(f-u)/(d-h);let _,m;r&ht.ABOVE&&!(n&ht.ABOVE)&&(_=d-(f-c)/g,i=_>=o&&_<=l),!i&&r&ht.RIGHT&&!(n&ht.RIGHT)&&(m=f-(d-l)*g,i=m>=a&&m<=c),!i&&r&ht.BELOW&&!(n&ht.BELOW)&&(_=d-(f-a)/g,i=_>=o&&_<=l),!i&&r&ht.LEFT&&!(n&ht.LEFT)&&(m=f-(d-o)*g,i=m>=a&&m<=c)}return i}function Uo(s,t){const e=t.getExtent(),i=Jt(s);if(t.canWrapX()&&(i[0]<e[0]||i[0]>=e[2])){const n=H(e),o=Math.floor((i[0]-e[0])/n)*n;s[0]-=o,s[2]-=o}return s}function Qh(s,t,e){if(t.canWrapX()){const i=t.getExtent();if(!isFinite(s[0])||!isFinite(s[2]))return[[i[0],s[1],i[2],s[3]]];Uo(s,t);const n=H(i);if(H(s)>n)return[[i[0],s[1],i[2],s[3]]];if(s[0]<i[0])return[[s[0]+n,s[1],i[2],s[3]],[i[0],s[1],s[2],s[3]]];if(s[2]>i[2])return[[s[0],s[1],i[2],s[3]],[i[0],s[1],s[2]-n,s[3]]]}return[s]}function tc(s,t){return s[0]+=+t[0],s[1]+=+t[1],s}function Ho(s,t){const e=s[0],i=s[1],n=t[0],r=t[1],o=n[0],a=n[1],l=r[0],c=r[1],h=l-o,u=c-a,d=h===0&&u===0?0:(h*(e-o)+u*(i-a))/(h*h+u*u||0);let f,g;return d<=0?(f=o,g=a):d>=1?(f=l,g=c):(f=o+d*h,g=a+d*u),[f,g]}function xt(s,t){let e=!0;for(let i=s.length-1;i>=0;--i)if(s[i]!=t[i]){e=!1;break}return e}function Vs(s,t){const e=Math.cos(t),i=Math.sin(t),n=s[0]*e-s[1]*i,r=s[1]*e+s[0]*i;return s[0]=n,s[1]=r,s}function ec(s,t){return s[0]*=t,s[1]*=t,s}function oi(s,t){const e=s[0]-t[0],i=s[1]-t[1];return e*e+i*i}function Gn(s,t){return Math.sqrt(oi(s,t))}function ic(s,t){return oi(s,Ho(s,t))}function Zo(s,t){if(t.canWrapX()){const e=H(t.getExtent()),i=nc(s,t,e);i&&(s[0]-=i*e)}return s}function nc(s,t,e){const i=t.getExtent();let n=0;return t.canWrapX()&&(s[0]<i[0]||s[0]>i[2])&&(e=e||H(i),n=Math.floor((s[0]-i[0])/e)),n}function sc(s){return Math.pow(s,3)}function ai(s){return 1-sc(1-s)}function rc(s){return 3*s*s-2*s*s*s}function oc(s){return s}const zs=63710088e-1;function Ys(s,t,e){e=e||zs;const i=Yt(s[1]),n=Yt(t[1]),r=(n-i)/2,o=Yt(t[0]-s[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(n);return 2*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function js(s,t){let e=0;for(let i=0,n=s.length;i<n-1;++i)e+=Ys(s[i],s[i+1],t);return e}function qo(s,t){t=t||{};const e=t.radius||zs,i=t.projection||"EPSG:3857",n=s.getType();n!=="GeometryCollection"&&(s=s.clone().transform(i,"EPSG:4326"));let r=0,o,a,l,c,h,u;switch(n){case"Point":case"MultiPoint":break;case"LineString":case"LinearRing":{o=s.getCoordinates(),r=js(o,e);break}case"MultiLineString":case"Polygon":{for(o=s.getCoordinates(),l=0,c=o.length;l<c;++l)r+=js(o[l],e);break}case"MultiPolygon":{for(o=s.getCoordinates(),l=0,c=o.length;l<c;++l)for(a=o[l],h=0,u=a.length;h<u;++h)r+=js(a[h],e);break}case"GeometryCollection":{const d=s.getGeometries();for(l=0,c=d.length;l<c;++l)r+=qo(d[l],t);break}default:throw new Error("Unsupported geometry type: "+n)}return r}function Wn(s,t){let e=0;const i=s.length;let n=s[i-1][0],r=s[i-1][1];for(let o=0;o<i;o++){const a=s[o][0],l=s[o][1];e+=Yt(a-n)*(2+Math.sin(Yt(r))+Math.sin(Yt(l))),n=a,r=l}return e*t*t/2}function $o(s,t){t=t||{};const e=t.radius||zs,i=t.projection||"EPSG:3857",n=s.getType();n!=="GeometryCollection"&&(s=s.clone().transform(i,"EPSG:4326"));let r=0,o,a,l,c,h,u;switch(n){case"Point":case"MultiPoint":case"LineString":case"MultiLineString":case"LinearRing":break;case"Polygon":{for(o=s.getCoordinates(),r=Math.abs(Wn(o[0],e)),l=1,c=o.length;l<c;++l)r-=Math.abs(Wn(o[l],e));break}case"MultiPolygon":{for(o=s.getCoordinates(),l=0,c=o.length;l<c;++l)for(a=o[l],r+=Math.abs(Wn(a[0],e)),h=1,u=a.length;h<u;++h)r-=Math.abs(Wn(a[h],e));break}case"GeometryCollection":{const d=s.getGeometries();for(l=0,c=d.length;l<c;++l)r+=$o(d[l],t);break}default:throw new Error("Unsupported geometry type: "+n)}return r}function Jo(...s){console.warn(...s)}const Qo={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class Yi{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_||Qo[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_}}const ji=6378137,li=Math.PI*ji,ac=[-li,-li,li,li],lc=[-180,-85,180,85],Bn=ji*Math.log(Math.tan(Math.PI/2));class hi extends Yi{constructor(t){super({code:t,units:"m",extent:ac,global:!0,worldExtent:lc,getPointResolution:function(e,i){return e/Math.cosh(i[1]/ji)}})}}const ta=[new hi("EPSG:3857"),new hi("EPSG:102100"),new hi("EPSG:102113"),new hi("EPSG:900913"),new hi("http://www.opengis.net/def/crs/EPSG/0/3857"),new hi("http://www.opengis.net/gml/srs/epsg.xml#3857")];function hc(s,t,e,i){const n=s.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=s.slice():t=new Array(n));for(let r=0;r<n;r+=i){t[r]=li*s[r]/180;let o=ji*Math.log(Math.tan(Math.PI*(+s[r+1]+90)/360));o>Bn?o=Bn:o<-Bn&&(o=-Bn),t[r+1]=o}return t}function cc(s,t,e,i){const n=s.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=s.slice():t=new Array(n));for(let r=0;r<n;r+=i)t[r]=180*s[r]/li,t[r+1]=360*Math.atan(Math.exp(s[r+1]/ji))/Math.PI-90;return t}const uc=6378137,ea=[-180,-90,180,90],dc=Math.PI*uc/180;class Be extends Yi{constructor(t,e){super({code:t,units:"degrees",extent:ea,axisOrientation:e,global:!0,metersPerUnit:dc,worldExtent:ea})}}const ia=[new Be("CRS:84"),new Be("EPSG:4326","neu"),new Be("urn:ogc:def:crs:OGC:1.3:CRS84"),new Be("urn:ogc:def:crs:OGC:2:84"),new Be("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Be("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Be("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Ks={};function fc(s){return Ks[s]||Ks[s.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function gc(s,t){Ks[s]=t}let ci={};function Ki(s,t,e){const i=s.getCode(),n=t.getCode();i in ci||(ci[i]={}),ci[i][n]=e}function Us(s,t){return s in ci&&t in ci[s]?ci[s][t]:null}const Xn=.9996,bt=.00669438,Vn=bt*bt,zn=Vn*bt,Xe=bt/(1-bt),na=Math.sqrt(1-bt),ui=(1-na)/(1+na),sa=ui*ui,Hs=sa*ui,Zs=Hs*ui,ra=Zs*ui,oa=1-bt/4-3*Vn/64-5*zn/256,_c=3*bt/8+3*Vn/32+45*zn/1024,mc=15*Vn/256+45*zn/1024,yc=35*zn/3072,pc=3/2*ui-27/32*Hs+269/512*ra,Ec=21/16*sa-55/32*Zs,xc=151/96*Hs-417/128*ra,Cc=1097/512*Zs,Yn=6378137;function wc(s,t,e){const i=s-5e5,o=(e.north?t:t-1e7)/Xn/(Yn*oa),a=o+pc*Math.sin(2*o)+Ec*Math.sin(4*o)+xc*Math.sin(6*o)+Cc*Math.sin(8*o),l=Math.sin(a),c=l*l,h=Math.cos(a),u=l/h,d=u*u,f=d*d,g=1-bt*c,_=Math.sqrt(1-bt*c),m=Yn/_,y=(1-bt)/g,p=Xe*h**2,C=p*p,E=i/(m*Xn),x=E*E,I=x*E,T=I*E,R=T*E,v=R*E,L=a-u/y*(x/2-T/24*(5+3*d+10*p-4*C-9*Xe))+v/720*(61+90*d+298*p+45*f-252*Xe-3*C);let O=(E-I/6*(1+2*d+p)+R/120*(5-2*p+28*d-3*C+8*Xe+24*f))/h;return O=Ns(O+Yt(ha(e.number)),-Math.PI,Math.PI),[Xo(O),Xo(L)]}const aa=-80,la=84,Ic=-180,vc=180;function Rc(s,t,e){s=Ns(s,Ic,vc),t<aa?t=aa:t>la&&(t=la);const i=Yt(t),n=Math.sin(i),r=Math.cos(i),o=n/r,a=o*o,l=a*a,c=Yt(s),h=ha(e.number),u=Yt(h),d=Yn/Math.sqrt(1-bt*n**2),f=Xe*r**2,g=r*Ns(c-u,-Math.PI,Math.PI),_=g*g,m=_*g,y=m*g,p=y*g,C=p*g,E=Yn*(oa*i-_c*Math.sin(2*i)+mc*Math.sin(4*i)-yc*Math.sin(6*i)),x=Xn*d*(g+m/6*(1-a+f)+p/120*(5-18*a+l+72*f-58*Xe))+5e5;let I=Xn*(E+d*o*(_/2+y/24*(5-a+9*f+4*f**2)+C/720*(61-58*a+l+600*f-330*Xe)));return e.north||(I+=1e7),[x,I]}function ha(s){return(s-1)*6-180+3}const Sc=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function ca(s){let t=0;for(const n of Sc){const r=s.match(n);if(r){t=parseInt(r[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 ua(s,t){return function(e,i,n,r){const o=e.length;n=n>1?n:2,r=r??n,i||(n>2?i=e.slice():i=new Array(o));for(let a=0;a<o;a+=r){const l=e[a],c=e[a+1],h=s(l,c,t);i[a]=h[0],i[a+1]=h[1]}return i}}function Tc(s){return ca(s)?new Yi({code:s,units:"m"}):null}function Mc(s){const t=ca(s.getCode());return t?{forward:ua(Rc,t),inverse:ua(wc,t)}:null}const Lc=[Mc],Ac=[Tc];let qs=!0;function Pc(s){qs=!1}function $s(s,t){if(t!==void 0){for(let e=0,i=s.length;e<i;++e)t[e]=s[e];t=t}else t=s.slice();return t}function Js(s){gc(s.getCode(),s),Ki(s,s,$s)}function bc(s){s.forEach(Js)}function Dt(s){if(typeof s!="string")return s;const t=fc(s);if(t)return t;for(const e of Ac){const i=e(s);if(i)return i}return null}function da(s,t,e,i){s=Dt(s);let n;const r=s.getPointResolutionFunc();if(r)n=r(t,e);else{const o=s.getUnits();if(o=="degrees"&&!i||i=="degrees")n=t;else{const a=tr(s,Dt("EPSG:4326"));if(!a&&o!=="degrees")n=t*s.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);const h=Ys(c.slice(0,2),c.slice(2,4)),u=Ys(c.slice(4,6),c.slice(6,8));n=(h+u)/2}const l=s.getMetersPerUnit();l!==void 0&&(n/=l)}}return n}function fa(s){bc(s),s.forEach(function(t){s.forEach(function(e){t!==e&&Ki(t,e,$s)})})}function Dc(s,t,e,i){s.forEach(function(n){t.forEach(function(r){Ki(n,r,e),Ki(r,n,i)})})}function Qs(s,t){return s?typeof s=="string"?Dt(s):s:Dt(t)}function Fc(s){return function(t,e,i,n){const r=t.length;i=i!==void 0?i:2,n=n??i,e=e!==void 0?e:new Array(r);for(let o=0;o<r;o+=n){const a=s(t.slice(o,o+i)),l=a.length;for(let c=0,h=n;c<h;++c)e[o+c]=c>=l?t[o+c]:a[c]}return e}}function ga(s,t){if(s===t)return!0;const e=s.getUnits()===t.getUnits();return(s.getCode()===t.getCode()||tr(s,t)===$s)&&e}function tr(s,t){const e=s.getCode(),i=t.getCode();let n=Us(e,i);if(n)return n;let r=null,o=null;for(const l of Lc)r||(r=l(s)),o||(o=l(t));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)n=er(r.inverse,o.forward);else{const l=Us(e,a);l&&(n=er(l,o.forward))}else{const l=Us(a,i);l&&(n=er(r.inverse,l))}return n&&(Js(s),Js(t),Ki(s,t,n)),n}function er(s,t){return function(e,i,n,r){return i=s(e,i,n,r),t(i,i,n,r)}}function jn(s,t){const e=Dt(s),i=Dt(t);return tr(e,i)}function _a(s,t,e){const i=jn(t,e);if(!i){const n=Dt(t).getCode(),r=Dt(e).getCode();throw new Error(`No transform available between ${n} and ${r}`)}return i(s,void 0,s.length)}function Ve(s,t){return s}function $(s,t){return qs&&!xt(s,[0,0])&&s[0]>=-180&&s[0]<=180&&s[1]>=-90&&s[1]<=90&&(qs=!1,Jo("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),s}function ir(s,t){return s}function we(s,t){return s}function Oc(){fa(ta),fa(ia),Dc(ia,ta,hc,cc)}Oc(),new Array(6);function Kt(){return[1,0,0,1,0,0]}function kc(s,t){return s[0]=t[0],s[1]=t[1],s[2]=t[2],s[3]=t[3],s[4]=t[4],s[5]=t[5],s}function dt(s,t){const e=t[0],i=t[1];return t[0]=s[0]*e+s[2]*i+s[4],t[1]=s[1]*e+s[3]*i+s[5],t}function ce(s,t,e,i,n,r,o,a){const l=Math.sin(r),c=Math.cos(r);return s[0]=i*c,s[1]=n*l,s[2]=-i*l,s[3]=n*c,s[4]=o*i*c-a*i*l+t,s[5]=o*n*l+a*n*c+e,s}function ma(s,t){const e=Nc(t);it(e!==0,"Transformation matrix cannot be inverted");const i=t[0],n=t[1],r=t[2],o=t[3],a=t[4],l=t[5];return s[0]=o/e,s[1]=-n/e,s[2]=-r/e,s[3]=i/e,s[4]=(r*l-o*a)/e,s[5]=-(i*l-n*a)/e,s}function Nc(s){return s[0]*s[3]-s[1]*s[2]}const Gc=[1e5,1e5,1e5,1e5,2,2];function Wc(s){return"matrix("+s.join(", ")+")"}function ya(s){return s.substring(7,s.length-1).split(",").map(parseFloat)}function Bc(s,t){const e=ya(s),i=ya(t);for(let n=0;n<6;++n)if(Math.round((e[n]-i[n])*Gc[n])!==0)return!1;return!0}function Ie(s,t,e,i,n,r,o){r=r||[],o=o||2;let a=0;for(let l=t;l<e;l+=i){const c=s[l],h=s[l+1];r[a++]=n[0]*c+n[2]*h+n[4],r[a++]=n[1]*c+n[3]*h+n[5];for(let u=2;u<o;u++)r[a++]=s[l+u]}return r&&r.length!=a&&(r.length=a),r}function nr(s,t,e,i,n,r,o){o=o||[];const a=Math.cos(n),l=Math.sin(n),c=r[0],h=r[1];let u=0;for(let d=t;d<e;d+=i){const f=s[d]-c,g=s[d+1]-h;o[u++]=c+f*a-g*l,o[u++]=h+f*l+g*a;for(let _=d+2;_<d+i;++_)o[u++]=s[_]}return o&&o.length!=u&&(o.length=u),o}function Xc(s,t,e,i,n,r,o,a){a=a||[];const l=o[0],c=o[1];let h=0;for(let u=t;u<e;u+=i){const d=s[u]-l,f=s[u+1]-c;a[h++]=l+n*d,a[h++]=c+r*f;for(let g=u+2;g<u+i;++g)a[h++]=s[g]}return a&&a.length!=h&&(a.length=h),a}function Vc(s,t,e,i,n,r,o){o=o||[];let a=0;for(let l=t;l<e;l+=i){o[a++]=s[l]+n,o[a++]=s[l+1]+r;for(let c=l+2;c<l+i;++c)o[a++]=s[c]}return o&&o.length!=a&&(o.length=a),o}const pa=Kt(),zc=[NaN,NaN];class Ea extends Vt{constructor(){super(),this.extent_=jt(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=bo((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return U()}closestPointXY(t,e,i,n){return U()}containsXY(t,e){return this.closestPointXY(t,e,zc,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 U()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Gi(e),this.extentRevision_=this.getRevision()}return $h(this.extent_,t)}rotate(t,e){U()}scale(t,e,i){U()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return U()}getType(){return U()}applyTransform(t){U()}intersectsExtent(t){return U()}translate(t,e){U()}transform(t,e){const i=Dt(t),n=i.getUnits()=="tile-pixels"?function(r,o,a){const l=i.getExtent(),c=i.getWorldExtent(),h=ct(c)/ct(l);ce(pa,c[0],c[3],h,-h,0,0,0);const u=Ie(r,0,r.length,a,pa,o),d=jn(i,e);return d?d(u,u,a):u}:jn(i,e);return this.applyTransform(n),this}}class ve extends Ea{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return Bs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return U()}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;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=Kn(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){U()}setLayout(t,e,i){let n;if(t)n=Kn(t);else{for(let r=0;r<i;++r){if(e.length===0){this.layout="XY",this.stride=2;return}e=e[0]}n=e.length,t=Yc(n)}this.layout=t,this.stride=n}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();nr(i,0,i.length,n,t,e,i),this.changed()}}scale(t,e,i){e===void 0&&(e=t),i||(i=Jt(this.getExtent()));const n=this.getFlatCoordinates();if(n){const r=this.getStride();Xc(n,0,n.length,r,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();Vc(i,0,i.length,n,t,e,i),this.changed()}}}function Yc(s){let t;return s==2?t="XY":s==3?t="XYZ":s==4&&(t="XYZM"),t}function Kn(s){let t;return s=="XY"?t=2:s=="XYZ"||s=="XYM"?t=3:s=="XYZM"&&(t=4),t}function jc(s,t,e){const i=s.getFlatCoordinates();if(!i)return null;const n=s.getStride();return Ie(i,0,i.length,n,t,e)}function xa(s,t,e,i){let n=0;const r=s[e-i],o=s[e-i+1];let a=0,l=0;for(;t<e;t+=i){const c=s[t]-r,h=s[t+1]-o;n+=l*c-a*h,a=c,l=h}return n/2}function Ca(s,t,e,i){let n=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];n+=xa(s,t,a,i),t=a}return n}function Kc(s,t,e,i){let n=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];n+=Ca(s,t,a,i),t=a[a.length-1]}return n}function wa(s,t,e,i,n,r,o){const a=s[t],l=s[t+1],c=s[e]-a,h=s[e+1]-l;let u;if(c===0&&h===0)u=t;else{const d=((n-a)*c+(r-l)*h)/(c*c+h*h);if(d>1)u=e;else if(d>0){for(let f=0;f<i;++f)o[f]=Mt(s[t+f],s[e+f],d);o.length=i;return}else u=t}for(let d=0;d<i;++d)o[d]=s[u+d];o.length=i}function sr(s,t,e,i,n){let r=s[t],o=s[t+1];for(t+=i;t<e;t+=i){const a=s[t],l=s[t+1],c=le(r,o,a,l);c>n&&(n=c),r=a,o=l}return n}function rr(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){const a=e[r];n=sr(s,t,a,i,n),t=a}return n}function Uc(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){const a=e[r];n=rr(s,t,a,i,n),t=a[a.length-1]}return n}function or(s,t,e,i,n,r,o,a,l,c,h){if(t==e)return c;let u,d;if(n===0){if(d=le(o,a,s[t],s[t+1]),d<c){for(u=0;u<i;++u)l[u]=s[t+u];return l.length=i,d}return c}h=h||[NaN,NaN];let f=t+i;for(;f<e;)if(wa(s,f-i,f,i,o,a,h),d=le(o,a,h[0],h[1]),d<c){for(c=d,u=0;u<i;++u)l[u]=h[u];l.length=i,f+=i}else f+=i*Math.max((Math.sqrt(d)-Math.sqrt(c))/n|0,1);if(r&&(wa(s,e-i,t,i,o,a,h),d=le(o,a,h[0],h[1]),d<c)){for(c=d,u=0;u<i;++u)l[u]=h[u];l.length=i}return c}function ar(s,t,e,i,n,r,o,a,l,c,h){h=h||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const f=e[u];c=or(s,t,f,i,n,r,o,a,l,c,h),t=f}return c}function Hc(s,t,e,i,n,r,o,a,l,c,h){h=h||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const f=e[u];c=ar(s,t,f,i,n,r,o,a,l,c,h),t=f[f.length-1]}return c}function Ia(s,t,e,i){for(let n=0,r=e.length;n<r;++n)s[t++]=e[n];return t}function Un(s,t,e,i){for(let n=0,r=e.length;n<r;++n){const o=e[n];for(let a=0;a<i;++a)s[t++]=o[a]}return t}function lr(s,t,e,i,n){n=n||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=Un(s,t,e[o],i);n[r++]=l,t=l}return n.length=r,n}function Zc(s,t,e,i,n){n=n||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=lr(s,t,e[o],i,n[r]);l.length===0&&(l[0]=t),n[r++]=l,t=l[l.length-1]}return n.length=r,n}function Re(s,t,e,i,n){n=n!==void 0?n:[];let r=0;for(let o=t;o<e;o+=i)n[r++]=s.slice(o,o+i);return n.length=r,n}function Ui(s,t,e,i,n){n=n!==void 0?n:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];n[r++]=Re(s,t,l,i,n[r]),t=l}return n.length=r,n}function hr(s,t,e,i,n){n=n!==void 0?n:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];n[r++]=l.length===1&&l[0]===t?[]:Ui(s,t,l,i,n[r]),t=l[l.length-1]}return n.length=r,n}function Hn(s,t,e,i,n,r,o){const a=(e-t)/i;if(a<3){for(;t<e;t+=i)r[o++]=s[t],r[o++]=s[t+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const c=[t,e-i];let h=0;for(;c.length>0;){const u=c.pop(),d=c.pop();let f=0;const g=s[d],_=s[d+1],m=s[u],y=s[u+1];for(let p=d+i;p<u;p+=i){const C=s[p],E=s[p+1],x=jh(C,E,g,_,m,y);x>f&&(h=p,f=x)}f>n&&(l[(h-t)/i]=1,d+i<h&&c.push(d,h),h+i<u&&c.push(h,u))}for(let u=0;u<a;++u)l[u]&&(r[o++]=s[t+u*i],r[o++]=s[t+u*i+1]);return o}function va(s,t,e,i,n,r,o,a){for(let l=0,c=e.length;l<c;++l){const h=e[l];o=Hn(s,t,h,i,n,r,o),a.push(o),t=h}return o}function ze(s,t){return t*Math.round(s/t)}function qc(s,t,e,i,n,r,o){if(t==e)return o;let a=ze(s[t],n),l=ze(s[t+1],n);t+=i,r[o++]=a,r[o++]=l;let c,h;do if(c=ze(s[t],n),h=ze(s[t+1],n),t+=i,t==e)return r[o++]=c,r[o++]=h,o;while(c==a&&h==l);for(;t<e;){const u=ze(s[t],n),d=ze(s[t+1],n);if(t+=i,u==c&&d==h)continue;const f=c-a,g=h-l,_=u-a,m=d-l;if(f*m==g*_&&(f<0&&_<f||f==_||f>0&&_>f)&&(g<0&&m<g||g==m||g>0&&m>g)){c=u,h=d;continue}r[o++]=c,r[o++]=h,a=c,l=h,c=u,h=d}return r[o++]=c,r[o++]=h,o}function cr(s,t,e,i,n,r,o,a){for(let l=0,c=e.length;l<c;++l){const h=e[l];o=qc(s,t,h,i,n,r,o),a.push(o),t=h}return o}function $c(s,t,e,i,n,r,o,a){for(let l=0,c=e.length;l<c;++l){const h=e[l],u=[];o=cr(s,t,h,i,n,r,o,u),a.push(u),t=h[h.length-1]}return o}class Hi extends ve{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 Hi(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<Ge(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(sr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),or(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return xa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Re(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=Hn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Hi(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Un(this.flatCoordinates,0,t,this.stride),this.changed()}}class Lt extends ve{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Lt(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const r=this.flatCoordinates,o=le(t,e,r[0],r[1]);if(o<n){const a=this.stride;for(let l=0;l<a;++l)i[l]=r[l];return i.length=a,o}return n}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return Wi(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Gs(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ia(this.flatCoordinates,0,t,this.stride),this.changed()}}function Jc(s,t,e,i,n){return!Ko(n,function(o){return!Ye(s,t,e,i,o[0],o[1])})}function Ye(s,t,e,i,n,r){let o=0,a=s[e-i],l=s[e-i+1];for(;t<e;t+=i){const c=s[t],h=s[t+1];l<=r?h>r&&(c-a)*(r-l)-(n-a)*(h-l)>0&&o++:h<=r&&(c-a)*(r-l)-(n-a)*(h-l)<0&&o--,a=c,l=h}return o!==0}function ur(s,t,e,i,n,r){if(e.length===0||!Ye(s,t,e[0],i,n,r))return!1;for(let o=1,a=e.length;o<a;++o)if(Ye(s,e[o-1],e[o],i,n,r))return!1;return!0}function Qc(s,t,e,i,n,r){if(e.length===0)return!1;for(let o=0,a=e.length;o<a;++o){const l=e[o];if(ur(s,t,l,i,n,r))return!0;t=l[l.length-1]}return!1}function dr(s,t,e,i,n,r,o){let a,l,c,h,u,d,f;const g=n[r+1],_=[];for(let p=0,C=e.length;p<C;++p){const E=e[p];for(h=s[E-i],d=s[E-i+1],a=t;a<E;a+=i)u=s[a],f=s[a+1],(g<=d&&f<=g||d<=g&&g<=f)&&(c=(g-d)/(f-d)*(u-h)+h,_.push(c)),h=u,d=f}let m=NaN,y=-1/0;for(_.sort(ke),h=_[0],a=1,l=_.length;a<l;++a){u=_[a];const p=Math.abs(u-h);p>y&&(c=(h+u)/2,ur(s,t,e,i,c,g)&&(m=c,y=p)),h=u}return isNaN(m)&&(m=n[r]),o?(o.push(m,g,y),o):[m,g,y]}function Ra(s,t,e,i,n){let r=[];for(let o=0,a=e.length;o<a;++o){const l=e[o];r=dr(s,t,l,i,n,2*o,r),t=l[l.length-1]}return r}function Sa(s,t,e,i,n){let r;for(t+=i;t<e;t+=i)if(r=n(s.slice(t-i,t),s.slice(t,t+i)),r)return r;return!1}function Zn(s,t,e,i,n,r){return r=r??jo(jt(),s,t,e,i),_t(n,r)?r[0]>=n[0]&&r[2]<=n[2]||r[1]>=n[1]&&r[3]<=n[3]?!0:Sa(s,t,e,i,function(o,a){return Jh(n,o,a)}):!1}function tu(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){if(Zn(s,t,e[r],i,n))return!0;t=e[r]}return!1}function eu(s,t,e,i,n){return!!(Zn(s,t,e,i,n)||Ye(s,t,e,i,n[0],n[1])||Ye(s,t,e,i,n[0],n[3])||Ye(s,t,e,i,n[2],n[1])||Ye(s,t,e,i,n[2],n[3]))}function Ta(s,t,e,i,n){if(!eu(s,t,e[0],i,n))return!1;if(e.length===1)return!0;for(let r=1,o=e.length;r<o;++r)if(Jc(s,e[r-1],e[r],i,n)&&!Zn(s,e[r-1],e[r],i,n))return!1;return!0}function iu(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){const a=e[r];if(Ta(s,t,a,i,n))return!0;t=a[a.length-1]}return!1}function nu(s,t,e,i){for(;t<e-i;){for(let n=0;n<i;++n){const r=s[t+n];s[t+n]=s[e-i+n],s[e-i+n]=r}t+=i,e-=i}}function fr(s,t,e,i){let n=0,r=s[e-i],o=s[e-i+1];for(;t<e;t+=i){const a=s[t],l=s[t+1];n+=(a-r)*(l+o),r=a,o=l}return n===0?void 0:n>0}function Ma(s,t,e,i,n){n=n!==void 0?n:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=fr(s,t,a,i);if(r===0){if(n&&l||!n&&!l)return!1}else if(n&&!l||!n&&l)return!1;t=a}return!0}function su(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){const a=e[r];if(!Ma(s,t,a,i,n))return!1;a.length&&(t=a[a.length-1])}return!0}function gr(s,t,e,i,n){n=n!==void 0?n:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=fr(s,t,a,i);(r===0?n&&l||!n&&!l:n&&!l||!n&&l)&&nu(s,t,a,i),t=a}return t}function La(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r)t=gr(s,t,e[r],i,n);return t}function ru(s,t){const e=[];let i=0,n=0,r;for(let o=0,a=t.length;o<a;++o){const l=t[o],c=fr(s,i,l,2);if(r===void 0&&(r=c),c===r)e.push(t.slice(n,o+1));else{if(e.length===0)continue;e[e.length-1].push(t[n])}n=o+1,i=l}return e}class At extends ve{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?Pt(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new At(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Ge(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(rr(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ar(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return ur(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Ca(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),gr(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,Ui(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=Jt(this.getExtent());this.flatInteriorPoint_=dr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Lt(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new Hi(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,n=[];let r=0;for(let o=0,a=i.length;o<a;++o){const l=i[o],c=new Hi(e.slice(r,l),t);n.push(c),r=l}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Ma(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=gr(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=cr(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new At(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return Ta(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=lr(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}function Aa(s){if(ri(s))throw new Error("Cannot create polygon from empty extent");const t=s[0],e=s[1],i=s[2],n=s[3],r=[t,e,t,n,i,n,i,e,t,e];return new At(r,"XY",[r.length])}function _r(s,t,e,i){const n=H(t)/e[0],r=ct(t)/e[1];return i?Math.min(s,Math.max(n,r)):Math.min(s,Math.min(n,r))}function mr(s,t,e){let i=Math.min(s,t);const n=50;return i*=Math.log(1+n*Math.max(0,s/t-1))/n+1,e&&(i=Math.max(i,e),i/=Math.log(1+n*Math.max(0,e/s-1))/n+1),st(i,e/2,t*2)}function ou(s,t,e,i){return t=t!==void 0?t:!0,function(n,r,o,a){if(n!==void 0){const l=s[0],c=s[s.length-1],h=e?_r(l,e,o,i):l;if(a)return t?mr(n,h,c):st(n,c,h);const u=Math.min(h,n),d=Math.floor(Ds(s,u,r));return s[d]>h&&d<s.length-1?s[d+1]:s[d]}}}function au(s,t,e,i,n,r){return i=i!==void 0?i:!0,e=e!==void 0?e:0,function(o,a,l,c){if(o!==void 0){const h=n?_r(t,n,l,r):t;if(c)return i?mr(o,h,e):st(o,e,h);const u=1e-9,d=Math.ceil(Math.log(t/h)/Math.log(s)-u),f=-a*(.5-u)+.5,g=Math.min(h,o),_=Math.floor(Math.log(t/g)/Math.log(s)+f),m=Math.max(d,_),y=t/Math.pow(s,m);return st(y,e,h)}}}function Pa(s,t,e,i,n){return e=e!==void 0?e:!0,function(r,o,a,l){if(r!==void 0){const c=i?_r(s,i,a,n):s;return!e||!l?st(r,t,c):mr(r,c,t)}}}function yr(s){if(s!==void 0)return 0}function ba(s){if(s!==void 0)return s}function lu(s)