@europeana/map 0.1.1-map.1 → 0.1.1-map.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/europeana-map.app.iife.js +22 -0
- package/dist/europeana-map.app.iife.js.map +1 -0
- package/dist/europeana-map.app.js +28570 -14318
- package/dist/europeana-map.app.js.map +1 -1
- package/dist/europeana-map.component.iife.js +19 -0
- package/dist/europeana-map.component.iife.js.map +1 -0
- package/dist/europeana-map.component.js +25543 -11312
- package/dist/europeana-map.component.js.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var EuropeanaMap=(function(K){"use strict";var nt;function cc(i,e){return K.getCurrentScope()?(K.onScopeDispose(i,e),!0):!1}function ya(){const i=new Set,e=s=>{i.delete(s)};return{on:s=>{i.add(s);const o=()=>e(s);return cc(o),{off:o}},off:e,trigger:(...s)=>Promise.all(Array.from(i).map(o=>o(...s))),clear:()=>{i.clear()}}}const hc=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Hg=()=>{};function _a(...i){if(i.length!==1)return K.toRef(...i);const e=i[0];return typeof e=="function"?K.readonly(K.customRef(()=>({get:e,set:Hg}))):K.ref(e)}function dc(i,e=!1,t="Timeout"){return new Promise((n,r)=>{e?setTimeout(r,i,t):setTimeout(n,i)})}function Jg(i,...e){return e.some(t=>t in i)}function xa(i,e=!1){function t(h,{flush:d="sync",deep:f=!1,timeout:g,throwOnTimeout:m}={}){let p=null;const y=[new Promise(_=>{p=K.watch(i,E=>{h(E)!==e&&(p?p():K.nextTick(()=>p?.()),_(E))},{flush:d,deep:f,immediate:!0})})];return g!=null&&y.push(dc(g,m).then(()=>K.toValue(i)).finally(()=>p?.())),Promise.race(y)}function n(h,d){if(!K.isRef(h))return t(E=>E===h,d);const{flush:f="sync",deep:g=!1,timeout:m,throwOnTimeout:p}=d??{};let y=null;const _=[new Promise(E=>{y=K.watch([i,h],([x,w])=>{e!==(x===w)&&(y?y():K.nextTick(()=>y?.()),E(x))},{flush:f,deep:g,immediate:!0})})];return m!=null&&_.push(dc(m,p).then(()=>K.toValue(i)).finally(()=>(y?.(),K.toValue(i)))),Promise.race(_)}function r(h){return t(d=>!!d,h)}function s(h){return n(null,h)}function o(h){return n(void 0,h)}function a(h){return t(Number.isNaN,h)}function l(h,d){return t(f=>{const g=Array.from(f);return g.includes(h)||g.includes(K.toValue(h))},d)}function u(h){return c(1,h)}function c(h=1,d){let f=-1;return t(()=>(f+=1,f>=h),d)}return Array.isArray(K.toValue(i))?{toMatch:t,toContains:l,changed:u,changedTimes:c,get not(){return xa(i,!e)}}:{toMatch:t,toBe:n,toBeTruthy:r,toBeNull:s,toBeNaN:a,toBeUndefined:o,changed:u,changedTimes:c,get not(){return xa(i,!e)}}}function Qg(i){return xa(i)}function ep(i,e,t={}){const{immediate:n=!0,immediateCallback:r=!1}=t,s=K.shallowRef(!1);let o;function a(){o&&(clearTimeout(o),o=void 0)}function l(){s.value=!1,a()}function u(...c){r&&i(),a(),s.value=!0,o=setTimeout(()=>{s.value=!1,o=void 0,i(...c)},K.toValue(e))}return n&&(s.value=!0,hc&&u()),cc(l),{isPending:K.shallowReadonly(s),start:u,stop:l}}const wa=hc?window:void 0,tp={json:"application/json",text:"text/plain"};function fc(i){return i&&Jg(i,"immediate","refetch","initialData","timeout","beforeFetch","afterFetch","onFetchError","fetch","updateDataOnError")}function Ea(i){return typeof Headers<"u"&&i instanceof Headers?Object.fromEntries(i.entries()):i}function np(i,...e){var t,n;const r=typeof AbortController=="function";let s={},o={immediate:!0,refetch:!1,timeout:0,updateDataOnError:!1};const a={method:"GET",type:"text",payload:void 0};e.length>0&&(fc(e[0])?o={...o,...e[0]}:s=e[0]),e.length>1&&fc(e[1])&&(o={...o,...e[1]});const{fetch:l=(t=wa?.fetch)!==null&&t!==void 0?t:(n=globalThis)===null||n===void 0?void 0:n.fetch,initialData:u,timeout:c}=o,h=ya(),d=ya(),f=ya(),g=K.shallowRef(!1),m=K.shallowRef(!1),p=K.shallowRef(!1),y=K.shallowRef(null),_=K.shallowRef(null),E=K.shallowRef(null),x=K.shallowRef(u||null),w=K.computed(()=>r&&m.value);let C,b;const v=N=>{r&&(C?.abort(N),C=new AbortController,C.signal.onabort=()=>p.value=!0,s={...s,signal:C.signal})},R=N=>{m.value=N,g.value=!N};c&&(b=ep(v,c,{immediate:!1}));let A=0;const F=async(N=!1)=>{var D;v(),R(!0),E.value=null,y.value=null,p.value=!1,A+=1;const T=A,V={method:a.method,headers:{}},Z=K.toValue(a.payload);if(Z){var ce;const H=Ea(V.headers),Re=Object.getPrototypeOf(Z);!a.payloadType&&Z&&(Re===Object.prototype||Array.isArray(Re))&&!(Z instanceof FormData)&&(a.payloadType="json"),a.payloadType&&(H["Content-Type"]=(ce=tp[a.payloadType])!==null&&ce!==void 0?ce:a.payloadType),V.body=a.payloadType==="json"?JSON.stringify(Z):Z}let Ae=!1;const L={url:K.toValue(i),options:{...V,...s},cancel:()=>{Ae=!0}};if(o.beforeFetch&&Object.assign(L,await o.beforeFetch(L)),Ae||!l)return R(!1),Promise.resolve(null);let le=null;return b&&b.start(),l(L.url,{...V,...L.options,headers:{...Ea(V.headers),...Ea((D=L.options)===null||D===void 0?void 0:D.headers)}}).then(async H=>{if(_.value=H,y.value=H.status,le=await H.clone()[a.type](),!H.ok)throw x.value=u||null,new Error(H.statusText);return o.afterFetch&&({data:le}=await o.afterFetch({data:le,response:H,context:L,execute:F})),x.value=le,h.trigger(H),H}).catch(async H=>{let Re=H.message||H.name;if(o.onFetchError&&({error:Re,data:le}=await o.onFetchError({data:le,error:H,response:_.value,context:L,execute:F})),E.value=Re,o.updateDataOnError&&(x.value=le),d.trigger(H),N)throw H;return null}).finally(()=>{T===A&&R(!1),b&&b.stop(),f.trigger(null)})},O=_a(o.refetch);K.watch([O,_a(i)],([N])=>N&&F(),{deep:!0});const I={isFinished:K.shallowReadonly(g),isFetching:K.shallowReadonly(m),statusCode:y,response:_,error:E,data:x,canAbort:w,aborted:p,abort:v,execute:F,onFetchResponse:h.on,onFetchError:d.on,onFetchFinally:f.on,get:S("GET"),put:S("PUT"),post:S("POST"),delete:S("DELETE"),patch:S("PATCH"),head:S("HEAD"),options:S("OPTIONS"),json:k("json"),text:k("text"),blob:k("blob"),arrayBuffer:k("arrayBuffer"),formData:k("formData")};function S(N){return(D,T)=>{if(!m.value)return a.method=N,a.payload=D,a.payloadType=T,K.isRef(a.payload)&&K.watch([O,_a(a.payload)],([V])=>V&&F(),{deep:!0}),{...I,then(V,Z){return U().then(V,Z)}}}}function U(){return new Promise((N,D)=>{Qg(g).toBe(!0).then(()=>N(I)).catch(D)})}function k(N){return()=>{if(!m.value)return a.type=N,{...I,then(D,T){return U().then(D,T)}}}}return o.immediate&&Promise.resolve().then(()=>F()),{...I,then(N,D){return U().then(N,D)}}}const wt={ADD:"add",REMOVE:"remove"},Ai={PROPERTYCHANGE:"propertychange"};function Er(i){for(const e in i)delete i[e]}function Sn(i){let e;for(e in i)return!1;return!e}function fe(i,e,t,n,r){if(r){const o=t;t=function(a){return i.removeEventListener(e,t),o.call(n??this,a)}}else n&&n!==i&&(t=t.bind(n));const s={target:i,type:e,listener:t};return i.addEventListener(e,t),s}function Ps(i,e,t,n){return fe(i,e,t,n,!0)}function Me(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),Er(i))}const $={CHANGE:"change",ERROR:"error",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",TOUCHMOVE:"touchmove",WHEEL:"wheel"};class vr{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function ip(i,e,t){let n,r;t=t||Kt;let s=0,o=i.length,a=!1;for(;s<o;)n=s+(o-s>>1),r=+t(i[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}function Kt(i,e){return i>e?1:i<e?-1:0}function rp(i,e){return i<e?1:i>e?-1:0}function Ls(i,e,t){if(i[0]<=e)return 0;const n=i.length;if(e<=i[n-1])return n-1;if(typeof t=="function"){for(let r=1;r<n;++r){const s=i[r];if(s===e)return r;if(s<e)return t(e,i[r-1],s)>0?r-1:r}return n-1}if(t>0){for(let r=1;r<n;++r)if(i[r]<e)return r-1;return n-1}if(t<0){for(let r=1;r<n;++r)if(i[r]<=e)return r;return n-1}for(let r=1;r<n;++r){if(i[r]==e)return r;if(i[r]<e)return i[r-1]-e<e-i[r]?r-1:r}return n-1}function sp(i,e,t){for(;e<t;){const n=i[e];i[e]=i[t],i[t]=n,++e,--t}}function $t(i,e){const t=Array.isArray(e)?e:[e],n=t.length;for(let r=0;r<n;r++)i[i.length]=t[r]}function In(i,e){const t=i.length;if(t!==e.length)return!1;for(let n=0;n<t;n++)if(i[n]!==e[n])return!1;return!0}function op(i,e,t){const n=e||Kt;return i.every(function(r,s){if(s===0)return!0;const o=n(i[s-1],r);return!(o>0||o===0)})}function Cr(){return!0}function Fs(){return!1}function br(){}function gc(i){let e,t,n;return function(){const r=Array.prototype.slice.call(arguments);return(!t||this!==n||!In(r,t))&&(n=this,t=r,e=i.apply(this,arguments)),e}}function Pi(i){function e(){let t;try{t=i()}catch(n){return Promise.reject(n)}return t instanceof Promise?t:Promise.resolve(t)}return e()}class Gt{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class Rr extends vr{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;const n=this.listeners_||(this.listeners_={}),r=n[e]||(n[e]=[]);r.includes(t)||r.push(t)}dispatchEvent(e){const t=typeof e=="string",n=t?e:e.type,r=this.listeners_&&this.listeners_[n];if(!r)return;const s=t?new Gt(e):e;s.target||(s.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});n in o||(o[n]=0,a[n]=0),++o[n];let l;for(let u=0,c=r.length;u<c;++u)if("handleEvent"in r[u]?l=r[u].handleEvent(s):l=r[u].call(this,s),l===!1||s.propagationStopped){l=!1;break}if(--o[n]===0){let u=a[n];for(delete a[n];u--;)this.removeEventListener(n,br);delete o[n]}return l}disposeInternal(){this.listeners_&&Er(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){if(!this.listeners_)return;const n=this.listeners_[e];if(!n)return;const r=n.indexOf(t);r!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[r]=br,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}}class Tr extends Rr{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent($.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){const n=e.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=fe(this,e[s],t);return r}return fe(this,e,t)}onceInternal(e,t){let n;if(Array.isArray(e)){const r=e.length;n=new Array(r);for(let s=0;s<r;++s)n[s]=Ps(this,e[s],t)}else n=Ps(this,e,t);return t.ol_key=n,n}unInternal(e,t){const n=t.ol_key;if(n)ap(n);else if(Array.isArray(e))for(let r=0,s=e.length;r<s;++r)this.removeEventListener(e[r],t);else this.removeEventListener(e,t)}}Tr.prototype.on,Tr.prototype.once,Tr.prototype.un;function ap(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)Me(i[e]);else Me(i)}function J(){throw new Error("Unimplemented abstract method.")}let lp=0;function te(i){return i.ol_uid||(i.ol_uid=String(++lp))}class pc extends Gt{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}}class Zt extends Tr{constructor(e){super(),this.on,this.once,this.un,te(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}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(e,t){let n;n=`change:${e}`,this.hasListener(n)&&this.dispatchEvent(new pc(n,e,t)),n=Ai.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new pc(n,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,n){const r=this.values_||(this.values_={});if(n)r[e]=t;else{const s=r[e];r[e]=t,s!==t&&this.notify(e,s)}}setProperties(e,t){for(const n in e)this.set(n,e[n],t)}applyProperties(e){e.values_&&Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){const n=this.values_[e];delete this.values_[e],Sn(this.values_)&&(this.values_=null),t||this.notify(e,n)}}}const mc={LENGTH:"length"};class Os extends Gt{constructor(e,t,n){super(e),this.element=t,this.index=n}}class At extends Zt{constructor(e,t){if(super(),this.on,this.once,this.un,t=t||{},this.unique_=!!t.unique,this.array_=e??[],this.unique_)for(let n=1,r=this.array_.length;n<r;++n)this.assertUnique_(this.array_[n],n);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,n=e.length;t<n;++t)this.push(e[t]);return this}forEach(e){const t=this.array_;for(let n=0,r=t.length;n<r;++n)e(t[n],n,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(mc.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new Os(wt.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){const t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){const t=this.array_;for(let n=0,r=t.length;n<r;++n)if(t[n]===e)return this.removeAt(n)}removeAt(e){if(e<0||e>=this.getLength())return;const t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new Os(wt.REMOVE,t,e)),t}setAt(e,t){const n=this.getLength();if(e>=n){this.insertAt(e,t);return}if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);const r=this.array_[e];this.array_[e]=t,this.dispatchEvent(new Os(wt.REMOVE,r,e)),this.dispatchEvent(new Os(wt.ADD,t,e))}updateLength_(){this.set(mc.LENGTH,this.array_.length)}assertUnique_(e,t){const n=this.array_;for(let r=0,s=n.length;r<s;++r)if(n[r]===e&&r!==t)throw new Error("Duplicate item added to a unique collection")}}class Li extends Gt{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}}class Mn extends Li{constructor(e,t,n,r,s,o){super(e,t,s),this.originalEvent=n,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(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}const Ve={SINGLECLICK:"singleclick",CLICK:$.CLICK,DBLCLICK:$.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Jn=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"";Jn.includes("safari")&&!Jn.includes("chrom")&&(Jn.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(Jn));const up=Jn.includes("webkit")&&!Jn.includes("edge"),yc=Jn.includes("macintosh"),cp=typeof devicePixelRatio<"u"?devicePixelRatio:1,at=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,_c=typeof Image<"u"&&Image.prototype.decode,hp=typeof createImageBitmap=="function",xc=(function(){let i=!1;try{const e=Object.defineProperty({},"passive",{get:function(){i=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return i})(),va={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown"};class dp extends Rr{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;const n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=fe(n,va.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=fe(n,va.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener($.TOUCHMOVE,this.boundHandleTouchMove_,xc?{passive:!1}:!1)}emulateClick_(e){let t=new Mn(Ve.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new Mn(Ve.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const n=new Mn(Ve.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){const t=e,n=t.pointerId;if(t.type==Ve.POINTERUP||t.type==Ve.POINTERCANCEL){delete this.trackedTouches_[n];for(const r in this.trackedTouches_)if(this.trackedTouches_[r].target!==t.target){delete this.trackedTouches_[r];break}}else(t.type==Ve.POINTERDOWN||t.type==Ve.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);const t=new Mn(Ve.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(Me),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);const t=new Mn(Ve.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){const n=this.map_.getOwnerDocument();this.dragListenerKeys_.push(fe(n,Ve.POINTERMOVE,this.handlePointerMove_,this),fe(n,Ve.POINTERUP,this.handlePointerUp_,this),fe(this.element_,Ve.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(fe(this.element_.getRootNode(),Ve.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;const t=new Mn(Ve.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;const t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new Mn(Ve.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){const t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!="boolean"||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(Me(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener($.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(Me(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(Me),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const An={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},lt={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},G={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function xe(i,e){if(!i)throw new Error(e)}const ks=1/0;class fp{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,Er(this.queuedElements_)}dequeue(){const e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));const r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(e){xe(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const t=this.priorityFunction_(e);return t!=ks?(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){const t=this.elements_,n=this.priorities_,r=t.length,s=t[e],o=n[e],a=e;for(;e<r>>1;){const l=this.getLeftChildIndex_(e),u=this.getRightChildIndex_(e),c=u<r&&n[u]<n[l]?u:l;t[e]=t[c],n[e]=n[c],e=c}t[e]=s,n[e]=o,this.siftDown_(a,e)}siftDown_(e,t){const n=this.elements_,r=this.priorities_,s=n[t],o=r[t];for(;t>e;){const a=this.getParentIndex_(t);if(r[a]>o)n[t]=n[a],r[t]=r[a],t=a;else break}n[t]=s,r[t]=o}reprioritize(){const e=this.priorityFunction_,t=this.elements_,n=this.priorities_;let r=0;const s=t.length;let o,a,l;for(a=0;a<s;++a)o=t[a],l=e(o),l==ks?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}}class wc extends fp{constructor(e,t){super(n=>e.apply(null,n),n=>n[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){const t=super.enqueue(e);return t&&e[0].addEventListener($.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){const t=e.target,n=t.getState();if(n===G.LOADED||n===G.ERROR||n===G.EMPTY){n!==G.ERROR&&t.removeEventListener($.CHANGE,this.boundHandleTileChange_);const r=t.getKey();r in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[r],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let n=0;for(;this.tilesLoading_<e&&n<t&&this.getCount()>0;){const r=this.dequeue()[0],s=r.getKey();r.getState()===G.IDLE&&!(s in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++n,r.load())}}}function gp(i,e,t,n,r){if(!i||!(t in i.wantedTiles)||!i.wantedTiles[t][e.getKey()])return ks;const s=i.viewState.center,o=n[0]-s[0],a=n[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}const Oe={ANIMATING:0,INTERACTING:1},jt={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function ke(i,e,t){return Math.min(Math.max(i,e),t)}function pp(i,e,t,n,r,s){const o=r-t,a=s-n;if(o!==0||a!==0){const l=((i-t)*o+(e-n)*a)/(o*o+a*a);l>1?(t=r,n=s):l>0&&(t+=o*l,n+=a*l)}return Qn(i,e,t,n)}function Qn(i,e,t,n){const r=t-i,s=n-e;return r*r+s*s}function mp(i){const e=i.length;for(let n=0;n<e;n++){let r=n,s=Math.abs(i[n][n]);for(let a=n+1;a<e;a++){const l=Math.abs(i[a][n]);l>s&&(s=l,r=a)}if(s===0)return null;const o=i[r];i[r]=i[n],i[n]=o;for(let a=n+1;a<e;a++){const l=-i[a][n]/i[n][n];for(let u=n;u<e+1;u++)n==u?i[a][u]=0:i[a][u]+=l*i[n][u]}}const t=new Array(e);for(let n=e-1;n>=0;n--){t[n]=i[n][e]/i[n][n];for(let r=n-1;r>=0;r--)i[r][e]-=i[r][n]*t[n]}return t}function Ec(i){return i*180/Math.PI}function Pn(i){return i*Math.PI/180}function Fi(i,e){const t=i%e;return t*e<0?t+e:t}function Tt(i,e,t){return i+t*(e-i)}function Ds(i,e){const t=Math.pow(10,e);return Math.round(i*t)/t}function Ns(i,e){return Math.floor(Ds(i,e))}function Ln(i,e){return Math.ceil(Ds(i,e))}function Ca(i,e,t){if(i>=e&&i<t)return i;const n=t-e;return((i-e)%n+n)%n+e}function vc(i,e,t){return(function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;const l=e?0:s[0]*r,u=e?0:s[1]*r,c=a?a[0]:0,h=a?a[1]:0;let d=i[0]+l/2+c,f=i[2]-l/2+c,g=i[1]+u/2+h,m=i[3]-u/2+h;d>f&&(d=(f+d)/2,f=d),g>m&&(g=(m+g)/2,m=g);let p=ke(n[0],d,f),y=ke(n[1],g,m);if(o&&t&&r){const _=30*r;p+=-_*Math.log(1+Math.max(0,d-n[0])/_)+_*Math.log(1+Math.max(0,n[0]-f)/_),y+=-_*Math.log(1+Math.max(0,g-n[1])/_)+_*Math.log(1+Math.max(0,n[1]-m)/_)}return[p,y]})}function yp(i){return i}const tt={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function ba(i){const e=St();for(let t=0,n=i.length;t<n;++t)Sr(e,i[t]);return e}function _p(i,e,t){const n=Math.min.apply(null,i),r=Math.min.apply(null,e),s=Math.max.apply(null,i),o=Math.max.apply(null,e);return an(n,r,s,o,t)}function sn(i,e,t){return t?(t[0]=i[0]-e,t[1]=i[1]-e,t[2]=i[2]+e,t[3]=i[3]+e,t):[i[0]-e,i[1]-e,i[2]+e,i[3]+e]}function Cc(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i.slice()}function ei(i,e,t){let n,r;return e<i[0]?n=i[0]-e:i[2]<e?n=e-i[2]:n=0,t<i[1]?r=i[1]-t:i[3]<t?r=t-i[3]:r=0,n*n+r*r}function ti(i,e){return Ra(i,e[0],e[1])}function on(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function Ra(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function Ta(i,e){const t=i[0],n=i[1],r=i[2],s=i[3],o=e[0],a=e[1];let l=tt.UNKNOWN;return o<t?l=l|tt.LEFT:o>r&&(l=l|tt.RIGHT),a<n?l=l|tt.BELOW:a>s&&(l=l|tt.ABOVE),l===tt.UNKNOWN&&(l=tt.INTERSECTING),l}function St(){return[1/0,1/0,-1/0,-1/0]}function an(i,e,t,n,r){return r?(r[0]=i,r[1]=e,r[2]=t,r[3]=n,r):[i,e,t,n]}function Oi(i){return an(1/0,1/0,-1/0,-1/0,i)}function Sa(i,e){const t=i[0],n=i[1];return an(t,n,t,n,e)}function Ia(i,e,t,n,r){const s=Oi(r);return Rc(s,i,e,t,n)}function ln(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function bc(i,e){return e[0]<i[0]&&(i[0]=e[0]),e[2]>i[2]&&(i[2]=e[2]),e[1]<i[1]&&(i[1]=e[1]),e[3]>i[3]&&(i[3]=e[3]),i}function Sr(i,e){e[0]<i[0]&&(i[0]=e[0]),e[0]>i[2]&&(i[2]=e[0]),e[1]<i[1]&&(i[1]=e[1]),e[1]>i[3]&&(i[3]=e[1])}function Rc(i,e,t,n,r){for(;t<n;t+=r)xp(i,e[t],e[t+1]);return i}function xp(i,e,t){i[0]=Math.min(i[0],e),i[1]=Math.min(i[1],t),i[2]=Math.max(i[2],e),i[3]=Math.max(i[3],t)}function Tc(i,e){let t;return t=e(zs(i)),t||(t=e(Gs(i)),t)||(t=e(Xs(i)),t)||(t=e(un(i)),t)?t:!1}function Ma(i){let e=0;return Fn(i)||(e=pe(i)*Ke(i)),e}function zs(i){return[i[0],i[1]]}function Gs(i){return[i[2],i[1]]}function Et(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function wp(i,e){let t;if(e==="bottom-left")t=zs(i);else if(e==="bottom-right")t=Gs(i);else if(e==="top-left")t=un(i);else if(e==="top-right")t=Xs(i);else throw new Error("Invalid corner");return t}function js(i,e,t,n,r){const[s,o,a,l,u,c,h,d]=Sc(i,e,t,n);return an(Math.min(s,a,u,h),Math.min(o,l,c,d),Math.max(s,a,u,h),Math.max(o,l,c,d),r)}function Sc(i,e,t,n){const r=e*n[0]/2,s=e*n[1]/2,o=Math.cos(t),a=Math.sin(t),l=r*o,u=r*a,c=s*o,h=s*a,d=i[0],f=i[1];return[d-l+h,f-u-c,d-l-h,f-u+c,d+l-h,f+u+c,d+l+h,f+u-c,d-l+h,f-u-c]}function Ke(i){return i[3]-i[1]}function Xt(i,e,t){const n=t||St();return Ue(i,e)?(i[0]>e[0]?n[0]=i[0]:n[0]=e[0],i[1]>e[1]?n[1]=i[1]:n[1]=e[1],i[2]<e[2]?n[2]=i[2]:n[2]=e[2],i[3]<e[3]?n[3]=i[3]:n[3]=e[3]):Oi(n),n}function un(i){return[i[0],i[3]]}function Xs(i){return[i[2],i[3]]}function pe(i){return i[2]-i[0]}function Ue(i,e){return i[0]<=e[2]&&i[2]>=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function Fn(i){return i[2]<i[0]||i[3]<i[1]}function Ep(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function vp(i,e,t){let n=!1;const r=Ta(i,e),s=Ta(i,t);if(r===tt.INTERSECTING||s===tt.INTERSECTING)n=!0;else{const o=i[0],a=i[1],l=i[2],u=i[3],c=e[0],h=e[1],d=t[0],f=t[1],g=(f-h)/(d-c);let m,p;s&tt.ABOVE&&!(r&tt.ABOVE)&&(m=d-(f-u)/g,n=m>=o&&m<=l),!n&&s&tt.RIGHT&&!(r&tt.RIGHT)&&(p=f-(d-l)*g,n=p>=a&&p<=u),!n&&s&tt.BELOW&&!(r&tt.BELOW)&&(m=d-(f-a)/g,n=m>=o&&m<=l),!n&&s&tt.LEFT&&!(r&tt.LEFT)&&(p=f-(d-o)*g,n=p>=a&&p<=u)}return n}function Ic(i,e,t,n){if(Fn(i))return Oi(t);let r=[];if(n>1){const a=i[2]-i[0],l=i[3]-i[1];for(let u=0;u<n;++u)r.push(i[0]+a*u/n,i[1],i[2],i[1]+l*u/n,i[2]-a*u/n,i[3],i[0],i[3]-l*u/n)}else r=[i[0],i[1],i[2],i[1],i[2],i[3],i[0],i[3]];e(r,r,2);const s=[],o=[];for(let a=0,l=r.length;a<l;a+=2)s.push(r[a]),o.push(r[a+1]);return _p(s,o,t)}function Mc(i,e){const t=e.getExtent(),n=Et(i);if(e.canWrapX()&&(n[0]<t[0]||n[0]>=t[2])){const r=pe(t),o=Math.floor((n[0]-t[0])/r)*r;i[0]-=o,i[2]-=o}return i}function Ac(i,e,t){if(e.canWrapX()){const n=e.getExtent();if(!isFinite(i[0])||!isFinite(i[2]))return[[n[0],i[1],n[2],i[3]]];Mc(i,e);const r=pe(n);if(pe(i)>r&&!t)return[[n[0],i[1],n[2],i[3]]];if(i[0]<n[0])return[[i[0]+r,i[1],n[2],i[3]],[n[0],i[1],i[2],i[3]]];if(i[2]>n[2])return[[i[0],i[1],n[2],i[3]],[n[0],i[1],i[2]-r,i[3]]]}return[i]}function Pc(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function Ws(i,e){let t=!0;for(let n=i.length-1;n>=0;--n)if(i[n]!=e[n]){t=!1;break}return t}function Aa(i,e){const t=Math.cos(e),n=Math.sin(e),r=i[0]*t-i[1]*n,s=i[1]*t+i[0]*n;return i[0]=r,i[1]=s,i}function Lc(i,e){return i[0]*=e,i[1]*=e,i}function Cp(i,e){const t=i[0]-e[0],n=i[1]-e[1];return t*t+n*n}function bp(i,e){return Math.sqrt(Cp(i,e))}function Pa(i,e){if(e.canWrapX()){const t=pe(e.getExtent()),n=Rp(i,e,t);n&&(i[0]-=n*t)}return i}function Rp(i,e,t){const n=e.getExtent();let r=0;return e.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(t=t||pe(n),r=Math.floor((i[0]-n[0])/t)),r}function Tp(i,e,t){const n=Math.sqrt((e[0]-i[0])*(e[0]-i[0])+(e[1]-i[1])*(e[1]-i[1])),r=[(e[0]-i[0])/n,(e[1]-i[1])/n],s=[-r[1],r[0]],o=Math.sqrt((t[0]-i[0])*(t[0]-i[0])+(t[1]-i[1])*(t[1]-i[1])),a=[(t[0]-i[0])/o,(t[1]-i[1])/o];let l=n===0||o===0?0:Math.acos(ke(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 Fc(i){return Math.pow(i,3)}function ki(i){return 1-Fc(1-i)}function Sp(i){return 3*i*i-2*i*i*i}function Ip(i){return i}const Mp=63710088e-1;function Oc(i,e,t){t=t||Mp;const n=Pn(i[1]),r=Pn(e[1]),s=(r-n)/2,o=Pn(e[0]-i[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(r);return 2*t*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function kc(...i){console.warn(...i)}const On={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class Vs{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent!==void 0?e.extent:null,this.worldExtent_=e.worldExtent!==void 0?e.worldExtent:null,this.axisOrientation_=e.axisOrientation!==void 0?e.axisOrientation:"enu",this.global_=e.global!==void 0?e.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||On[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const Ir=6378137,Di=Math.PI*Ir,Ap=[-Di,-Di,Di,Di],Pp=[-180,-85,180,85],Us=Ir*Math.log(Math.tan(Math.PI/2));class Ni extends Vs{constructor(e){super({code:e,units:"m",extent:Ap,global:!0,worldExtent:Pp,getPointResolution:function(t,n){return t/Math.cosh(n[1]/Ir)}})}}const Dc=[new Ni("EPSG:3857"),new Ni("EPSG:102100"),new Ni("EPSG:102113"),new Ni("EPSG:900913"),new Ni("http://www.opengis.net/def/crs/EPSG/0/3857"),new Ni("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Lp(i,e,t,n){const r=i.length;t=t>1?t:2,n=n??t,e===void 0&&(t>2?e=i.slice():e=new Array(r));for(let s=0;s<r;s+=n){e[s]=Di*i[s]/180;let o=Ir*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>Us?o=Us:o<-Us&&(o=-Us),e[s+1]=o}return e}function Fp(i,e,t,n){const r=i.length;t=t>1?t:2,n=n??t,e===void 0&&(t>2?e=i.slice():e=new Array(r));for(let s=0;s<r;s+=n)e[s]=180*i[s]/Di,e[s+1]=360*Math.atan(Math.exp(i[s+1]/Ir))/Math.PI-90;return e}const Op=6378137,Nc=[-180,-90,180,90],kp=Math.PI*Op/180;class ni extends Vs{constructor(e,t){super({code:e,units:"degrees",extent:Nc,axisOrientation:t,global:!0,metersPerUnit:kp,worldExtent:Nc})}}const zc=[new ni("CRS:84"),new ni("EPSG:4326","neu"),new ni("urn:ogc:def:crs:OGC:1.3:CRS84"),new ni("urn:ogc:def:crs:OGC:2:84"),new ni("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new ni("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new ni("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let La={};function Dp(i){return La[i]||La[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function Np(i,e){La[i]=e}let zi={};function Mr(i,e,t){const n=i.getCode(),r=e.getCode();n in zi||(zi[n]={}),zi[n][r]=t}function Fa(i,e){return i in zi&&e in zi[i]?zi[i][e]:null}const Ys=.9996,Pt=.00669438,Bs=Pt*Pt,Ks=Bs*Pt,ii=Pt/(1-Pt),Gc=Math.sqrt(1-Pt),Gi=(1-Gc)/(1+Gc),jc=Gi*Gi,Oa=jc*Gi,ka=Oa*Gi,Xc=ka*Gi,Wc=1-Pt/4-3*Bs/64-5*Ks/256,zp=3*Pt/8+3*Bs/32+45*Ks/1024,Gp=15*Bs/256+45*Ks/1024,jp=35*Ks/3072,Xp=3/2*Gi-27/32*Oa+269/512*Xc,Wp=21/16*jc-55/32*ka,Vp=151/96*Oa-417/128*Xc,Up=1097/512*ka,$s=6378137;function Yp(i,e,t){const n=i-5e5,o=(t.north?e:e-1e7)/Ys/($s*Wc),a=o+Xp*Math.sin(2*o)+Wp*Math.sin(4*o)+Vp*Math.sin(6*o)+Up*Math.sin(8*o),l=Math.sin(a),u=l*l,c=Math.cos(a),h=l/c,d=h*h,f=d*d,g=1-Pt*u,m=Math.sqrt(1-Pt*u),p=$s/m,y=(1-Pt)/g,_=ii*c**2,E=_*_,x=n/(p*Ys),w=x*x,C=w*x,b=C*x,v=b*x,R=v*x,A=a-h/y*(w/2-b/24*(5+3*d+10*_-4*E-9*ii))+R/720*(61+90*d+298*_+45*f-252*ii-3*E);let F=(x-C/6*(1+2*d+_)+v/120*(5-2*_+28*d-3*E+8*ii+24*f))/c;return F=Ca(F+Pn(Yc(t.number)),-Math.PI,Math.PI),[Ec(F),Ec(A)]}const Vc=-80,Uc=84,Bp=-180,Kp=180;function $p(i,e,t){i=Ca(i,Bp,Kp),e<Vc?e=Vc:e>Uc&&(e=Uc);const n=Pn(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,u=Pn(i),c=Yc(t.number),h=Pn(c),d=$s/Math.sqrt(1-Pt*r**2),f=ii*s**2,g=s*Ca(u-h,-Math.PI,Math.PI),m=g*g,p=m*g,y=p*g,_=y*g,E=_*g,x=$s*(Wc*n-zp*Math.sin(2*n)+Gp*Math.sin(4*n)-jp*Math.sin(6*n)),w=Ys*d*(g+p/6*(1-a+f)+_/120*(5-18*a+l+72*f-58*ii))+5e5;let C=Ys*(x+d*o*(m/2+y/24*(5-a+9*f+4*f**2)+E/720*(61-58*a+l+600*f-330*ii)));return t.north||(C+=1e7),[w,C]}function Yc(i){return(i-1)*6-180+3}const Zp=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function Bc(i){let e=0;for(const r of Zp){const s=i.match(r);if(s){e=parseInt(s[1]);break}}if(!e)return null;let t=0,n=!1;return e>32700&&e<32761?t=e-32700:e>32600&&e<32661&&(n=!0,t=e-32600),t?{number:t,north:n}:null}function Kc(i,e){return function(t,n,r,s){const o=t.length;r=r>1?r:2,s=s??r,n||(r>2?n=t.slice():n=new Array(o));for(let a=0;a<o;a+=s){const l=t[a],u=t[a+1],c=i(l,u,e);n[a]=c[0],n[a+1]=c[1]}return n}}function qp(i){return Bc(i)?new Vs({code:i,units:"m"}):null}function Hp(i){const e=Bc(i.getCode());return e?{forward:Kc($p,e),inverse:Kc(Yp,e)}:null}const Jp=[Hp],Qp=[qp];let Da=!0;function $c(i){Da=!1}function Na(i,e){if(e!==void 0){for(let t=0,n=i.length;t<n;++t)e[t]=i[t];e=e}else e=i.slice();return e}function za(i){Np(i.getCode(),i),Mr(i,i,Na)}function em(i){i.forEach(za)}function we(i){if(typeof i!="string")return i;const e=Dp(i);if(e)return e;for(const t of Qp){const n=t(i);if(n)return n}return null}function Ga(i,e,t,n){i=we(i);let r;const s=i.getPointResolutionFunc();if(s){if(r=s(e,t),n&&n!==i.getUnits()){const o=i.getMetersPerUnit();o&&(r=r*o/On[n])}}else{const o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")r=e;else{const a=ji(i,we("EPSG:4326"));if(!a&&o!=="degrees")r=e*i.getMetersPerUnit();else{let u=[t[0]-e/2,t[1],t[0]+e/2,t[1],t[0],t[1]-e/2,t[0],t[1]+e/2];u=a(u,u,2);const c=Oc(u.slice(0,2),u.slice(2,4)),h=Oc(u.slice(4,6),u.slice(6,8));r=(c+h)/2}const l=n?On[n]:i.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function Zc(i){em(i),i.forEach(function(e){i.forEach(function(t){e!==t&&Mr(e,t,Na)})})}function tm(i,e,t,n){i.forEach(function(r){e.forEach(function(s){Mr(r,s,t),Mr(s,r,n)})})}function ja(i,e){return i?typeof i=="string"?we(i):i:we(e)}function nm(i){return(function(e,t,n,r){const s=e.length;n=n!==void 0?n:2,r=r??n,t=t!==void 0?t:new Array(s);for(let o=0;o<s;o+=r){const a=i(e.slice(o,o+n)),l=a.length;for(let u=0,c=r;u<c;++u)t[o+u]=u>=l?e[o+u]:a[u]}return t})}function Xa(i,e){return $c(),Ar(i,"EPSG:4326",e!==void 0?e:"EPSG:3857")}function ut(i,e){if(i===e)return!0;const t=i.getUnits()===e.getUnits();return(i.getCode()===e.getCode()||ji(i,e)===Na)&&t}function ji(i,e){const t=i.getCode(),n=e.getCode();let r=Fa(t,n);if(r)return r;let s=null,o=null;for(const l of Jp)s||(s=l(i)),o||(o=l(e));if(!s&&!o)return null;const a="EPSG:4326";if(o)if(s)r=Wa(s.inverse,o.forward);else{const l=Fa(t,a);l&&(r=Wa(l,o.forward))}else{const l=Fa(a,n);l&&(r=Wa(s.inverse,l))}return r&&(za(i),za(e),Mr(i,e,r)),r}function Wa(i,e){return function(t,n,r,s){return n=i(t,n,r,s),e(n,n,r,s)}}function ri(i,e){const t=we(i),n=we(e);return ji(t,n)}function Ar(i,e,t){const n=ri(e,t);if(!n){const r=we(e).getCode(),s=we(t).getCode();throw new Error(`No transform available between ${r} and ${s}`)}return n(i,void 0,i.length)}function Xi(i,e,t,n){const r=ri(e,t);return Ic(i,r,void 0,n)}let Lt=null;function im(i){Lt=we(i)}function Pr(){return Lt}function rm(){im("EPSG:4326")}function Va(i,e){return Lt?Ar(i,e,Lt):i}function cn(i,e){return Lt?Ar(i,Lt,e):(Da&&!Ws(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(Da=!1,kc("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i)}function Zs(i,e){return Lt?Xi(i,e,Lt):i}function hn(i,e){return Lt?Xi(i,Lt,e):i}function sm(i,e){if(!Lt)return i;const t=we(e).getMetersPerUnit(),n=Lt.getMetersPerUnit();return t&&n?i*t/n:i}function om(){Zc(Dc),Zc(zc),tm(zc,Dc,Lp,Fp)}om();const qc=new Array(6);function vt(){return[1,0,0,1,0,0]}function Hc(i){return Ya(i,1,0,0,1,0,0)}function Ua(i,e){const t=i[0],n=i[1],r=i[2],s=i[3],o=i[4],a=i[5],l=e[0],u=e[1],c=e[2],h=e[3],d=e[4],f=e[5];return i[0]=t*l+r*u,i[1]=n*l+s*u,i[2]=t*c+r*h,i[3]=n*c+s*h,i[4]=t*d+r*f+o,i[5]=n*d+s*f+a,i}function Ya(i,e,t,n,r,s,o){return i[0]=e,i[1]=t,i[2]=n,i[3]=r,i[4]=s,i[5]=o,i}function am(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i}function qe(i,e){const t=e[0],n=e[1];return e[0]=i[0]*t+i[2]*n+i[4],e[1]=i[1]*t+i[3]*n+i[5],e}function Ba(i,e,t){return Ua(i,Ya(qc,e,0,0,t,0,0))}function lm(i,e,t){return Ua(i,Ya(qc,1,0,0,1,e,t))}function qt(i,e,t,n,r,s,o,a){const l=Math.sin(s),u=Math.cos(s);return i[0]=n*u,i[1]=r*l,i[2]=-n*l,i[3]=r*u,i[4]=o*n*u-a*n*l+e,i[5]=o*r*l+a*r*u+t,i}function Jc(i,e){const t=um(e);xe(t!==0,"Transformation matrix cannot be inverted");const n=e[0],r=e[1],s=e[2],o=e[3],a=e[4],l=e[5];return i[0]=o/t,i[1]=-r/t,i[2]=-s/t,i[3]=n/t,i[4]=(s*l-o*a)/t,i[5]=-(n*l-r*a)/t,i}function um(i){return i[0]*i[3]-i[1]*i[2]}const cm=[1e5,1e5,1e5,1e5,2,2];function hm(i){return"matrix("+i.join(", ")+")"}function Ka(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function dm(i,e){const t=Ka(i),n=Ka(e);for(let r=0;r<6;++r)if(Math.round((t[r]-n[r])*cm[r])!==0)return!1;return!0}function kn(i,e,t,n,r,s,o){s=s||[],o=o||2;let a=0;for(let l=e;l<t;l+=n){const u=i[l],c=i[l+1];s[a++]=r[0]*u+r[2]*c+r[4],s[a++]=r[1]*u+r[3]*c+r[5];for(let h=2;h<o;h++)s[a++]=i[l+h]}return s&&s.length!=a&&(s.length=a),s}function Qc(i,e,t,n,r,s,o){o=o||[];const a=Math.cos(r),l=Math.sin(r),u=s[0],c=s[1];let h=0;for(let d=e;d<t;d+=n){const f=i[d]-u,g=i[d+1]-c;o[h++]=u+f*a-g*l,o[h++]=c+f*l+g*a;for(let m=d+2;m<d+n;++m)o[h++]=i[m]}return o&&o.length!=h&&(o.length=h),o}function fm(i,e,t,n,r,s,o,a){a=a||[];const l=o[0],u=o[1];let c=0;for(let h=e;h<t;h+=n){const d=i[h]-l,f=i[h+1]-u;a[c++]=l+r*d,a[c++]=u+s*f;for(let g=h+2;g<h+n;++g)a[c++]=i[g]}return a&&a.length!=c&&(a.length=c),a}function gm(i,e,t,n,r,s,o){o=o||[];let a=0;for(let l=e;l<t;l+=n){o[a++]=i[l]+r,o[a++]=i[l+1]+s;for(let u=l+2;u<l+n;++u)o[a++]=i[u]}return o&&o.length!=a&&(o.length=a),o}const eh=vt(),pm=[NaN,NaN];class th extends Zt{constructor(){super(),this.extent_=St(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=gc((e,t,n)=>{if(!n)return this.getSimplifiedGeometry(t);const r=this.clone();return r.applyTransform(n),r.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return J()}closestPointXY(e,t,n,r){return J()}containsXY(e,t){return this.closestPointXY(e,t,pm,Number.MIN_VALUE)===0}getClosestPoint(e,t){return t=t||[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return J()}getExtent(e){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&Oi(t),this.extentRevision_=this.getRevision()}return Ep(this.extent_,e)}rotate(e,t){J()}scale(e,t,n){J()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return J()}getType(){return J()}applyTransform(e){J()}intersectsExtent(e){return J()}translate(e,t){J()}transform(e,t){const n=we(e),r=n.getUnits()=="tile-pixels"?function(s,o,a){const l=n.getExtent(),u=n.getWorldExtent(),c=Ke(u)/Ke(l);qt(eh,u[0],u[3],c,-c,0,0,0);const h=kn(s,0,s.length,a,eh,o),d=ri(n,t);return d?d(h,h,a):h}:ri(n,t);return this.applyTransform(r),this}}class si extends th{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return Ia(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}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(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=nh(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){J()}setLayout(e,t,n){let r;if(e)r=nh(e);else{for(let s=0;s<n;++s){if(t.length===0){this.layout="XY",this.stride=2;return}t=t[0]}r=t.length,e=oi(r)}this.layout=e,this.stride=r}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(e,t){const n=this.getFlatCoordinates();if(n){const r=this.getStride();Qc(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||(n=Et(this.getExtent()));const r=this.getFlatCoordinates();if(r){const s=this.getStride();fm(r,0,r.length,s,e,t,n,r),this.changed()}}translate(e,t){const n=this.getFlatCoordinates();if(n){const r=this.getStride();gm(n,0,n.length,r,e,t,n),this.changed()}}}function oi(i){let e;return i==2?e="XY":i==3?e="XYZ":i==4&&(e="XYZM"),e}function nh(i){let e;return i=="XY"?e=2:i=="XYZ"||i=="XYM"?e=3:i=="XYZM"&&(e=4),e}function mm(i,e,t){const n=i.getFlatCoordinates();if(!n)return null;const r=i.getStride();return kn(n,0,n.length,r,e,t)}function ih(i,e,t,n){let r=0;const s=i[t-n],o=i[t-n+1];let a=0,l=0;for(;e<t;e+=n){const u=i[e]-s,c=i[e+1]-o;r+=l*u-a*c,a=u,l=c}return r/2}function rh(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){const a=t[s];r+=ih(i,e,a,n),e=a}return r}function ym(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){const a=t[s];r+=rh(i,e,a,n),e=a[a.length-1]}return r}function sh(i,e,t,n,r,s,o){const a=i[e],l=i[e+1],u=i[t]-a,c=i[t+1]-l;let h;if(u===0&&c===0)h=e;else{const d=((r-a)*u+(s-l)*c)/(u*u+c*c);if(d>1)h=t;else if(d>0){for(let f=0;f<n;++f)o[f]=Tt(i[e+f],i[t+f],d);o.length=n;return}else h=e}for(let d=0;d<n;++d)o[d]=i[h+d];o.length=n}function $a(i,e,t,n,r){let s=i[e],o=i[e+1];for(e+=n;e<t;e+=n){const a=i[e],l=i[e+1],u=Qn(s,o,a,l);u>r&&(r=u),s=a,o=l}return r}function Za(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){const a=t[s];r=$a(i,e,a,n,r),e=a}return r}function _m(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){const a=t[s];r=Za(i,e,a,n,r),e=a[a.length-1]}return r}function qa(i,e,t,n,r,s,o,a,l,u,c){if(e==t)return u;let h,d;if(r===0){if(d=Qn(o,a,i[e],i[e+1]),d<u){for(h=0;h<n;++h)l[h]=i[e+h];return l.length=n,d}return u}c=c||[NaN,NaN];let f=e+n;for(;f<t;)if(sh(i,f-n,f,n,o,a,c),d=Qn(o,a,c[0],c[1]),d<u){for(u=d,h=0;h<n;++h)l[h]=c[h];l.length=n,f+=n}else f+=n*Math.max((Math.sqrt(d)-Math.sqrt(u))/r|0,1);if(s&&(sh(i,t-n,e,n,o,a,c),d=Qn(o,a,c[0],c[1]),d<u)){for(u=d,h=0;h<n;++h)l[h]=c[h];l.length=n}return u}function Ha(i,e,t,n,r,s,o,a,l,u,c){c=c||[NaN,NaN];for(let h=0,d=t.length;h<d;++h){const f=t[h];u=qa(i,e,f,n,r,s,o,a,l,u,c),e=f}return u}function xm(i,e,t,n,r,s,o,a,l,u,c){c=c||[NaN,NaN];for(let h=0,d=t.length;h<d;++h){const f=t[h];u=Ha(i,e,f,n,r,s,o,a,l,u,c),e=f[f.length-1]}return u}function wm(i,e,t,n){for(let r=0,s=t.length;r<s;++r)i[e++]=t[r];return e}function qs(i,e,t,n){for(let r=0,s=t.length;r<s;++r){const o=t[r];for(let a=0;a<n;++a)i[e++]=o[a]}return e}function Lr(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){const l=qs(i,e,t[o],n);r[s++]=l,e=l}return r.length=s,r}function oh(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){const l=Lr(i,e,t[o],n,r[s]);l.length===0&&(l[0]=e),r[s++]=l,e=l[l.length-1]}return r.length=s,r}function Dn(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=e;o<t;o+=n)r[s++]=i.slice(o,o+n);return r.length=s,r}function Fr(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=t.length;o<a;++o){const l=t[o];r[s++]=Dn(i,e,l,n,r[s]),e=l}return r.length=s,r}function Ja(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=t.length;o<a;++o){const l=t[o];r[s++]=l.length===1&&l[0]===e?[]:Fr(i,e,l,n,r[s]),e=l[l.length-1]}return r.length=s,r}function Hs(i,e,t,n,r,s,o){const a=(t-e)/n;if(a<3){for(;e<t;e+=n)s[o++]=i[e],s[o++]=i[e+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const u=[e,t-n];let c=0;for(;u.length>0;){const h=u.pop(),d=u.pop();let f=0;const g=i[d],m=i[d+1],p=i[h],y=i[h+1];for(let _=d+n;_<h;_+=n){const E=i[_],x=i[_+1],w=pp(E,x,g,m,p,y);w>f&&(c=_,f=w)}f>r&&(l[(c-e)/n]=1,d+n<c&&u.push(d,c),c+n<h&&u.push(c,h))}for(let h=0;h<a;++h)l[h]&&(s[o++]=i[e+h*n],s[o++]=i[e+h*n+1]);return o}function ah(i,e,t,n,r,s,o,a){for(let l=0,u=t.length;l<u;++l){const c=t[l];o=Hs(i,e,c,n,r,s,o),a.push(o),e=c}return o}function ai(i,e){return e*Math.round(i/e)}function Em(i,e,t,n,r,s,o){if(e==t)return o;let a=ai(i[e],r),l=ai(i[e+1],r);e+=n,s[o++]=a,s[o++]=l;let u,c;do if(u=ai(i[e],r),c=ai(i[e+1],r),e+=n,e==t)return s[o++]=u,s[o++]=c,o;while(u==a&&c==l);for(;e<t;){const h=ai(i[e],r),d=ai(i[e+1],r);if(e+=n,h==u&&d==c)continue;const f=u-a,g=c-l,m=h-a,p=d-l;if(f*p==g*m&&(f<0&&m<f||f==m||f>0&&m>f)&&(g<0&&p<g||g==p||g>0&&p>g)){u=h,c=d;continue}s[o++]=u,s[o++]=c,a=u,l=c,u=h,c=d}return s[o++]=u,s[o++]=c,o}function Qa(i,e,t,n,r,s,o,a){for(let l=0,u=t.length;l<u;++l){const c=t[l];o=Em(i,e,c,n,r,s,o),a.push(o),e=c}return o}function vm(i,e,t,n,r,s,o,a){for(let l=0,u=t.length;l<u;++l){const c=t[l],h=[];o=Qa(i,e,c,n,r,s,o,h),a.push(h),e=c[c.length-1]}return o}class Or extends si{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}clone(){return new Or(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,n,r){return r<ei(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt($a(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),qa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return ih(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Dn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){const t=[];return t.length=Hs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new Or(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=qs(this.flatCoordinates,0,e,this.stride),this.changed()}}class dn extends si{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){const e=new dn(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){const s=this.flatCoordinates,o=Qn(e,t,s[0],s[1]);if(o<r){const a=this.stride;for(let l=0;l<a;++l)n[l]=s[l];return n.length=a,o}return r}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(e){return Sa(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return Ra(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=wm(this.flatCoordinates,0,e,this.stride),this.changed()}}function Cm(i,e,t,n,r){return!Tc(r,function(o){return!li(i,e,t,n,o[0],o[1])})}function li(i,e,t,n,r,s){let o=0,a=i[t-n],l=i[t-n+1];for(;e<t;e+=n){const u=i[e],c=i[e+1];l<=s?c>s&&(u-a)*(s-l)-(r-a)*(c-l)>0&&o++:c<=s&&(u-a)*(s-l)-(r-a)*(c-l)<0&&o--,a=u,l=c}return o!==0}function el(i,e,t,n,r,s){if(t.length===0||!li(i,e,t[0],n,r,s))return!1;for(let o=1,a=t.length;o<a;++o)if(li(i,t[o-1],t[o],n,r,s))return!1;return!0}function bm(i,e,t,n,r,s){if(t.length===0)return!1;for(let o=0,a=t.length;o<a;++o){const l=t[o];if(el(i,e,l,n,r,s))return!0;e=l[l.length-1]}return!1}function tl(i,e,t,n,r,s,o){let a,l,u,c,h,d,f;const g=r[s+1],m=[];for(let _=0,E=t.length;_<E;++_){const x=t[_];for(c=i[x-n],d=i[x-n+1],a=e;a<x;a+=n)h=i[a],f=i[a+1],(g<=d&&f<=g||d<=g&&g<=f)&&(u=(g-d)/(f-d)*(h-c)+c,m.push(u)),c=h,d=f}let p=NaN,y=-1/0;for(m.sort(Kt),c=m[0],a=1,l=m.length;a<l;++a){h=m[a];const _=Math.abs(h-c);_>y&&(u=(c+h)/2,el(i,e,t,n,u,g)&&(p=u,y=_)),c=h}return isNaN(p)&&(p=r[s]),o?(o.push(p,g,y),o):[p,g,y]}function lh(i,e,t,n,r){let s=[];for(let o=0,a=t.length;o<a;++o){const l=t[o];s=tl(i,e,l,n,r,2*o,s),e=l[l.length-1]}return s}function uh(i,e,t,n,r){let s;for(e+=n;e<t;e+=n)if(s=r(i.slice(e-n,e),i.slice(e,e+n)),s)return s;return!1}function Js(i,e,t,n,r,s){return s=s??Rc(St(),i,e,t,n),Ue(r,s)?s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:uh(i,e,t,n,function(o,a){return vp(r,o,a)}):!1}function Rm(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){if(Js(i,e,t[s],n,r))return!0;e=t[s]}return!1}function ch(i,e,t,n,r){return!!(Js(i,e,t,n,r)||li(i,e,t,n,r[0],r[1])||li(i,e,t,n,r[0],r[3])||li(i,e,t,n,r[2],r[1])||li(i,e,t,n,r[2],r[3]))}function hh(i,e,t,n,r){if(!ch(i,e,t[0],n,r))return!1;if(t.length===1)return!0;for(let s=1,o=t.length;s<o;++s)if(Cm(i,t[s-1],t[s],n,r)&&!Js(i,t[s-1],t[s],n,r))return!1;return!0}function Tm(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){const a=t[s];if(hh(i,e,a,n,r))return!0;e=a[a.length-1]}return!1}function Sm(i,e,t,n){for(;e<t-n;){for(let r=0;r<n;++r){const s=i[e+r];i[e+r]=i[t-n+r],i[t-n+r]=s}e+=n,t-=n}}function nl(i,e,t,n){let r=0,s=i[t-n],o=i[t-n+1];for(;e<t;e+=n){const a=i[e],l=i[e+1];r+=(a-s)*(l+o),s=a,o=l}return r===0?void 0:r>0}function il(i,e,t,n,r){r=r!==void 0?r:!1;for(let s=0,o=t.length;s<o;++s){const a=t[s],l=nl(i,e,a,n);if(s===0){if(r&&l||!r&&!l)return!1}else if(r&&!l||!r&&l)return!1;e=a}return!0}function dh(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){const a=t[s];if(!il(i,e,a,n,r))return!1;a.length&&(e=a[a.length-1])}return!0}function Qs(i,e,t,n,r){r=r!==void 0?r:!1;for(let s=0,o=t.length;s<o;++s){const a=t[s],l=nl(i,e,a,n);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&Sm(i,e,a,n),e=a}return e}function rl(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s)e=Qs(i,e,t[s],n,r);return e}function fh(i,e){const t=[];let n=0,r=0,s;for(let o=0,a=e.length;o<a;++o){const l=e[o],u=nl(i,n,l,2);if(s===void 0&&(s=u),u===s)t.push(e.slice(r,o+1));else{if(t.length===0)continue;t[t.length-1].push(e[r])}r=o+1,n=l}return t}class fn extends si{constructor(e,t,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&n?(this.setFlatCoordinates(t,e),this.ends_=n):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?$t(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const e=new fn(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<ei(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Za(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ha(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return el(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return rh(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),Qs(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,Fr(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const e=Et(this.getExtent());this.flatInteriorPoint_=tl(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new dn(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new Or(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){const e=this.layout,t=this.flatCoordinates,n=this.ends_,r=[];let s=0;for(let o=0,a=n.length;o<a;++o){const l=n[o],u=new Or(t.slice(s,l),e);r.push(u),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const e=this.flatCoordinates;il(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=Qs(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){const t=[],n=[];return t.length=Qa(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,n),new fn(t,"XY",n)}getType(){return"Polygon"}intersectsExtent(e){return hh(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);const n=Lr(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}}function gh(i){if(Fn(i))throw new Error("Cannot create polygon from empty extent");const e=i[0],t=i[1],n=i[2],r=i[3],s=[e,t,e,r,n,r,n,t,e,t];return new fn(s,"XY",[s.length])}function sl(i,e,t,n){const r=pe(e)/t[0],s=Ke(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function ol(i,e,t){let n=Math.min(i,e);const r=50;return n*=Math.log(1+r*Math.max(0,i/e-1))/r+1,t&&(n=Math.max(n,t),n/=Math.log(1+r*Math.max(0,t/i-1))/r+1),ke(n,t/2,e*2)}function Im(i,e,t,n){return e=e!==void 0?e:!0,(function(r,s,o,a){if(r!==void 0){const l=i[0],u=i[i.length-1],c=t?sl(l,t,o,n):l;if(a)return e?ol(r,c,u):ke(r,u,c);const h=Math.min(c,r),d=Math.floor(Ls(i,h,s));return i[d]>c&&d<i.length-1?i[d+1]:i[d]}})}function Mm(i,e,t,n,r,s){return n=n!==void 0?n:!0,t=t!==void 0?t:0,(function(o,a,l,u){if(o!==void 0){const c=r?sl(e,r,l,s):e;if(u)return n?ol(o,c,t):ke(o,t,c);const h=1e-9,d=Math.ceil(Math.log(e/c)/Math.log(i)-h),f=-a*(.5-h)+.5,g=Math.min(c,o),m=Math.floor(Math.log(e/g)/Math.log(i)+f),p=Math.max(d,m),y=e/Math.pow(i,p);return ke(y,t,c)}})}function ph(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){const u=n?sl(i,n,a,r):i;return!t||!l?ke(s,e,u):ol(s,u,e)}})}function al(i){if(i!==void 0)return 0}function mh(i){if(i!==void 0)return i}function Am(i){const e=2*Math.PI/i;return(function(t,n){if(n)return t;if(t!==void 0)return t=Math.floor(t/e+.5)*e,t})}function Pm(i){const e=Pn(5);return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}const yh=42,ll=256,ul=0;class Wt extends Zt{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=ja(e.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,e.projection&&$c(),e.center&&(e.center=cn(e.center,this.projection_)),e.extent&&(e.extent=hn(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){const t=Object.assign({},e);for(const a in jt)delete t[a];this.setProperties(t,!0);const n=Fm(e);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=n.minZoom;const r=Lm(e),s=n.constraint,o=Om(e);this.constraints_={center:r,resolution:s,rotation:o},this.setRotation(e.rotation!==void 0?e.rotation:0),this.setCenterInternal(e.center!==void 0?e.center:null),e.resolution!==void 0?this.setResolution(e.resolution):e.zoom!==void 0&&this.setZoom(e.zoom)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;const n=this.getCenterInternal();if(n){const r=e||[0,0,0,0];t=t||[0,0,0,0];const s=this.getResolution(),o=s/2*(r[3]-t[3]+t[1]-r[1]),a=s/2*(r[0]-t[0]+t[2]-r[2]);this.setCenterInternal([n[0]+o,n[1]-a])}}getUpdatedOptions_(e){const t=this.getProperties();return t.resolution!==void 0?t.resolution=this.getResolution():t.zoom=this.getZoom(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const t=new Array(arguments.length);for(let n=0;n<t.length;++n){let r=arguments[n];r.center&&(r=Object.assign({},r),r.center=cn(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=cn(r.anchor,this.getProjection())),t[n]=r}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,n;t>1&&typeof arguments[t-1]=="function"&&(n=arguments[t-1],--t);let r=0;for(;r<t&&!this.isDef();++r){const c=arguments[r];c.center&&this.setCenterInternal(c.center),c.zoom!==void 0?this.setZoom(c.zoom):c.resolution&&this.setResolution(c.resolution),c.rotation!==void 0&&this.setRotation(c.rotation)}if(r===t){n&&eo(n,!0);return}let s=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const u=[];for(;r<t;++r){const c=arguments[r],h={start:s,complete:!1,anchor:c.anchor,duration:c.duration!==void 0?c.duration:1e3,easing:c.easing||Sp,callback:n};if(c.center&&(h.sourceCenter=o,h.targetCenter=c.center.slice(),o=h.targetCenter),c.zoom!==void 0?(h.sourceResolution=a,h.targetResolution=this.getResolutionForZoom(c.zoom),a=h.targetResolution):c.resolution&&(h.sourceResolution=a,h.targetResolution=c.resolution,a=h.targetResolution),c.rotation!==void 0){h.sourceRotation=l;const d=Fi(c.rotation-l+Math.PI,2*Math.PI)-Math.PI;h.targetRotation=l+d,l=h.targetRotation}km(h)?h.complete=!0:s+=h.duration,u.push(h)}this.animations_.push(u),this.setHint(Oe.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Oe.ANIMATING]>0}getInteracting(){return this.hints_[Oe.INTERACTING]>0}cancelAnimations(){this.setHint(Oe.ANIMATING,-this.hints_[Oe.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){const r=this.animations_[t];if(r[0].callback&&eo(r[0].callback,!1),!e)for(let s=0,o=r.length;s<o;++s){const a=r[s];if(!a.complete){e=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,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;const e=Date.now();let t=!1;for(let n=this.animations_.length-1;n>=0;--n){const r=this.animations_[n];let s=!0;for(let o=0,a=r.length;o<a;++o){const l=r[o];if(l.complete)continue;const u=e-l.start;let c=l.duration>0?u/l.duration:1;c>=1?(l.complete=!0,c=1):s=!1;const h=l.easing(c);if(l.sourceCenter){const d=l.sourceCenter[0],f=l.sourceCenter[1],g=l.targetCenter[0],m=l.targetCenter[1];this.nextCenter_=l.targetCenter;const p=d+h*(g-d),y=f+h*(m-f);this.targetCenter_=[p,y]}if(l.sourceResolution&&l.targetResolution){const d=h===1?l.targetResolution:l.sourceResolution+h*(l.targetResolution-l.sourceResolution);if(l.anchor){const f=this.getViewportSize_(this.getRotation()),g=this.constraints_.resolution(d,0,f,!0);this.targetCenter_=this.calculateCenterZoom(g,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const d=h===1?Fi(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+h*(l.targetRotation-l.sourceRotation);if(l.anchor){const f=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(f,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(s){this.animations_[n]=null,this.setHint(Oe.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=r[0].callback;o&&eo(o,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n;const r=this.getCenterInternal();return r!==void 0&&(n=[r[0]-t[0],r[1]-t[1]],Aa(n,e-this.getRotation()),Pc(n,t)),n}calculateCenterZoom(e,t){let n;const r=this.getCenterInternal(),s=this.getResolution();if(r!==void 0&&s!==void 0){const o=t[0]-e*(t[0]-r[0])/s,a=t[1]-e*(t[1]-r[1])/s;n=[o,a]}return n}getViewportSize_(e){const t=this.viewportSize_;if(e){const n=t[0],r=t[1];return[Math.abs(n*Math.cos(e))+Math.abs(r*Math.sin(e)),Math.abs(n*Math.sin(e))+Math.abs(r*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const e=this.getCenterInternal();return e&&Va(e,this.getProjection())}getCenterInternal(){return this.get(jt.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return e!==void 0?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){const t=this.calculateExtentInternal(e);return Zs(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();const t=this.getCenterInternal();xe(t,"The view center is not defined");const n=this.getResolution();xe(n!==void 0,"The view resolution is not defined");const r=this.getRotation();return xe(r!==void 0,"The view rotation is not defined"),js(t,n,r,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(jt.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(hn(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();const n=pe(e)/t[0],r=Ke(e)/t[1];return Math.max(n,r)}getResolutionForValueFunction(e){e=e||2;const t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(t/n)/Math.log(e);return(function(s){return t/Math.pow(e,s*r)})}getRotation(){return this.get(jt.ROTATION)}getValueForResolutionFunction(e){const t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,s=Math.log(n/r)/t;return(function(o){return Math.log(n/o)/t/s})}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e);const n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){const e=this.getProjection(),t=this.getResolution(),n=this.getRotation();let r=this.getCenterInternal();const s=this.padding_;if(s){const o=this.getViewportSizeMinusPadding_();r=cl(r,this.getViewportSize_(),[o[0]/2+s[3],o[1]/2+s[0]],t,n)}return{center:r.slice(0),projection:e!==void 0?e:null,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e;const t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,n,r;if(this.resolutions_){const s=Ls(this.resolutions_,e,1);t=s,n=this.resolutions_[s],s==this.resolutions_.length-1?r=2:r=n/this.resolutions_[s+1]}else n=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(n/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];const t=ke(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,ke(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(xe(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){xe(!Fn(e),"Cannot fit empty extent provided as `geometry`");const r=hn(e,this.getProjection());n=gh(r)}else if(e.getType()==="Circle"){const r=hn(e.getExtent(),this.getProjection());n=gh(r),n.rotate(this.getRotation(),Et(r))}else{const r=Pr();r?n=e.clone().transform(r,this.getProjection()):n=e}this.fitInternal(n,t)}rotatedExtentForGeometry(e){const t=this.getRotation(),n=Math.cos(t),r=Math.sin(-t),s=e.getFlatCoordinates(),o=e.getStride();let a=1/0,l=1/0,u=-1/0,c=-1/0;for(let h=0,d=s.length;h<d;h+=o){const f=s[h]*n-s[h+1]*r,g=s[h]*r+s[h+1]*n;a=Math.min(a,f),l=Math.min(l,g),u=Math.max(u,f),c=Math.max(c,g)}return[a,l,u,c]}fitInternal(e,t){t=t||{};let n=t.size;n||(n=this.getViewportSizeMinusPadding_());const r=t.padding!==void 0?t.padding:[0,0,0,0],s=t.nearest!==void 0?t.nearest:!1;let o;t.minResolution!==void 0?o=t.minResolution:t.maxZoom!==void 0?o=this.getResolutionForZoom(t.maxZoom):o=0;const a=this.rotatedExtentForGeometry(e);let l=this.getResolutionForExtentInternal(a,[n[0]-r[1]-r[3],n[1]-r[0]-r[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,s?0:1);const u=this.getRotation(),c=Math.sin(u),h=Math.cos(u),d=Et(a);d[0]+=(r[1]-r[3])/2*l,d[1]+=(r[0]-r[2])/2*l;const f=d[0]*h-d[1]*c,g=d[1]*h+d[0]*c,m=this.getConstrainedCenter([f,g],l),p=t.callback?t.callback:br;t.duration!==void 0?this.animateInternal({resolution:l,center:m,duration:t.duration,easing:t.easing},p):(this.targetResolution_=l,this.targetCenter_=m,this.applyTargetState_(!1,!0),eo(p,!0))}centerOn(e,t,n){this.centerOnInternal(cn(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(cl(e,t,n,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,n,r){let s;const o=this.padding_;if(o&&e){const a=this.getViewportSizeMinusPadding_(-n),l=cl(e,r,[a[0]/2+o[3],a[1]/2+o[0]],t,n);s=[e[0]-l[0],e[1]-l[1]]}return s}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(e){const t=Va(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){const t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t=t&&cn(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){const n=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*e,0,r,n);t&&(this.targetCenter_=this.calculateCenterZoom(s,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(Math.pow(this.zoomFactor_,-e),t)}adjustRotation(e,t){t&&(t=cn(t,this.getProjection())),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){const n=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+e,n);t&&(this.targetCenter_=this.calculateCenterRotate(r,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&cn(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){const n=this.getAnimating()||this.getInteracting()||t,r=this.constraints_.rotation(this.targetRotation_,n),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,0,s,n),a=this.constraints_.center(this.targetCenter_,o,s,n,this.calculateCenterShift(this.targetCenter_,o,r,s));this.get(jt.ROTATION)!==r&&this.set(jt.ROTATION,r),this.get(jt.RESOLUTION)!==o&&(this.set(jt.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(jt.CENTER)||!Ws(this.get(jt.CENTER),a))&&this.set(jt.CENTER,a),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,n){e=e!==void 0?e:200;const r=t||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(e===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=s,this.targetCenter_=l,this.applyTargetState_();return}n=n||(e===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==s||!this.getCenterInternal()||!Ws(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:ki,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Oe.INTERACTING,1)}endInteraction(e,t,n){n=n&&cn(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(Oe.INTERACTING,-1),this.resolveConstraints(e,t,n))}getConstrainedCenter(e,t){const n=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),n)}getConstrainedZoom(e,t){const n=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(n,t))}getConstrainedResolution(e,t){t=t||0;const n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,n)}}function eo(i,e){setTimeout(function(){i(e)},0)}function Lm(i){if(i.extent!==void 0){const t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return vc(i.extent,i.constrainOnlyCenter,t)}const e=ja(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,vc(t,!1,!1)}return yp}function Fm(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:ul,a=i.maxZoom!==void 0?i.maxZoom:28;const l=i.zoomFactor!==void 0?i.zoomFactor:2,u=i.multiWorld!==void 0?i.multiWorld:!1,c=i.smoothResolutionConstraint!==void 0?i.smoothResolutionConstraint:!0,h=i.showFullExtent!==void 0?i.showFullExtent:!1,d=ja(i.projection,"EPSG:3857"),f=d.getExtent();let g=i.constrainOnlyCenter,m=i.extent;if(!u&&!m&&d.isGlobal()&&(g=!1,m=f),i.resolutions!==void 0){const p=i.resolutions;t=p[o],n=p[a]!==void 0?p[a]:p[p.length-1],i.constrainResolution?e=Im(p,c,!g&&m,h):e=ph(t,n,c,!g&&m,h)}else{const y=(f?Math.max(pe(f),Ke(f)):360*On.degrees/d.getMetersPerUnit())/ll/Math.pow(2,ul),_=y/Math.pow(2,28-ul);t=i.maxResolution,t!==void 0?o=0:t=y/Math.pow(l,o),n=i.minResolution,n===void 0&&(i.maxZoom!==void 0?i.maxResolution!==void 0?n=t/Math.pow(l,a):n=y/Math.pow(l,a):n=_),a=o+Math.floor(Math.log(t/n)/Math.log(l)),n=t/Math.pow(l,a-o),i.constrainResolution?e=Mm(l,t,n,c,!g&&m,h):e=ph(t,n,c,!g&&m,h)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function Om(i){if(i.enableRotation!==void 0?i.enableRotation:!0){const t=i.constrainRotation;return t===void 0||t===!0?Pm():t===!1?mh:typeof t=="number"?Am(t):mh}return al}function km(i){return!(i.sourceCenter&&i.targetCenter&&!Ws(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function cl(i,e,t,n,r){const s=Math.cos(-r);let o=Math.sin(-r),a=i[0]*s-i[1]*o,l=i[1]*s+i[0]*o;a+=(e[0]/2-t[0])*n,l+=(t[1]-e[1]/2)*n,o=-o;const u=a*s-l*o,c=l*s+a*o;return[u,c]}const to="ol-hidden",no="ol-unselectable",hl="ol-control",_h="ol-collapsed",Dm=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"),xh=["style","variant","weight","size","lineHeight","family"],dl={normal:400,bold:700},fl=function(i){const e=i.match(Dm);if(!e)return null;const t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,r=xh.length;n<r;++n){const s=e[n+1];s!==void 0&&(t[xh[n]]=typeof s=="string"?s.trim():s)}return isNaN(Number(t.weight))&&t.weight in dl&&(t.weight=dl[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t};function De(i,e,t,n){let r;return t&&t.length?r=t.shift():at?r=new class extends OffscreenCanvas{style={}}(i??300,e??150):r=document.createElement("canvas"),i&&(r.width=i),e&&(r.height=e),r.getContext("2d",n)}let gl;function io(){return gl||(gl=De(1,1)),gl}function kr(i){const e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function wh(i,e){const t=e.parentNode;t&&t.replaceChild(i,e)}function Nm(i){for(;i.lastChild;)i.lastChild.remove()}function zm(i,e){const t=i.childNodes;for(let n=0;;++n){const r=t[n],s=e[n];if(!r&&!s)break;if(r!==s){if(!r){i.appendChild(s);continue}if(!s){i.removeChild(r),--n;continue}i.insertBefore(s,r)}}}function Eh(){return new Proxy({childNodes:[],appendChild:function(e){return this.childNodes.push(e),e},remove:function(){},removeChild:function(e){const t=this.childNodes.indexOf(e);if(t===-1)throw new Error("Node to remove was not found");return this.childNodes.splice(t,1),e},insertBefore:function(e,t){const n=this.childNodes.indexOf(t);if(n===-1)throw new Error("Reference node not found");return this.childNodes.splice(n,0,e),e},style:{}},{get(e,t,n){return t==="firstElementChild"?e.childNodes.length>0?e.childNodes[0]:null:Reflect.get(e,t,n)}})}function Nn(i){return typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas}class pl extends Zt{constructor(e){super();const t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&this.element?.remove();for(let t=0,n=this.listenerKeys.length;t<n;++t)Me(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=e,e){const t=this.target_??e.getOverlayContainerStopEvent();this.element&&t.appendChild(this.element),this.render!==br&&this.listenerKeys.push(fe(e,An.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}}class Gm extends pl{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=e.collapsed!==void 0?e.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible!==void 0?e.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;const t=e.className!==void 0?e.className:"ol-attribution",n=e.tipLabel!==void 0?e.tipLabel:"Attributions",r=e.expandClassName!==void 0?e.expandClassName:t+"-expand",s=e.collapseLabel!==void 0?e.collapseLabel:"›",o=e.collapseClassName!==void 0?e.collapseClassName:t+"-collapse";typeof s=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=s,this.collapseLabel_.className=o):this.collapseLabel_=s;const a=e.label!==void 0?e.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=r):this.label_=a;const 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=n,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener($.CLICK,this.handleClick_.bind(this),!1);const u=t+" "+no+" "+hl+(this.collapsed_&&this.collapsible_?" "+_h:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=u,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){const t=this.getMap().getAllLayers(),n=new Set(t.flatMap(r=>r.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(r=>n.add(r)):n.add(this.attributions_)),!this.overrideCollapsible_){const r=!t.some(s=>s.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(r)}return Array.from(n)}async updateElement_(e){if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const t=await Promise.all(this.collectSourceAttributions_(e).map(r=>Pi(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!In(t,this.renderedAttributions_)){Nm(this.ulElement_);for(let r=0,s=t.length;r<s;++r){const o=document.createElement("li");o.innerHTML=t[r],this.ulElement_.appendChild(o)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(_h),this.collapsed_?wh(this.collapseLabel_,this.label_):wh(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(e){this.userCollapsed_=e,!(!this.collapsible_||this.collapsed_===e)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(e){this.updateElement_(e.frameState)}}class jm extends pl{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target});const t=e.className!==void 0?e.className:"ol-rotate",n=e.label!==void 0?e.label:"⇧",r=e.compassClassName!==void 0?e.compassClassName:"ol-compass";this.label_=null,typeof n=="string"?(this.label_=document.createElement("span"),this.label_.className=r,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(r));const s=e.tipLabel?e.tipLabel:"Reset rotation",o=document.createElement("button");o.className=t+"-reset",o.setAttribute("type","button"),o.title=s,o.appendChild(this.label_),o.addEventListener($.CLICK,this.handleClick_.bind(this),!1);const a=t+" "+no+" "+hl,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=e.duration!==void 0?e.duration:250,this.autoHide_=e.autoHide!==void 0?e.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(to)}handleClick_(e){e.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const t=this.getMap().getView();if(!t)return;const n=t.getRotation();n!==void 0&&(this.duration_>0&&n%(2*Math.PI)!==0?t.animate({rotation:0,duration:this.duration_,easing:ki}):t.setRotation(0))}render(e){const t=e.frameState;if(!t)return;const n=t.viewState.rotation;if(n!=this.rotation_){const r="rotate("+n+"rad)";if(this.autoHide_){const s=this.element.classList.contains(to);!s&&n===0?this.element.classList.add(to):s&&n!==0&&this.element.classList.remove(to)}this.label_.style.transform=r}this.rotation_=n}}class Xm extends pl{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target});const t=e.className!==void 0?e.className:"ol-zoom",n=e.delta!==void 0?e.delta:1,r=e.zoomInClassName!==void 0?e.zoomInClassName:t+"-in",s=e.zoomOutClassName!==void 0?e.zoomOutClassName:t+"-out",o=e.zoomInLabel!==void 0?e.zoomInLabel:"+",a=e.zoomOutLabel!==void 0?e.zoomOutLabel:"–",l=e.zoomInTipLabel!==void 0?e.zoomInTipLabel:"Zoom in",u=e.zoomOutTipLabel!==void 0?e.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=r,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof o=="string"?document.createTextNode(o):o),c.addEventListener($.CLICK,this.handleClick_.bind(this,n),!1);const h=document.createElement("button");h.className=s,h.setAttribute("type","button"),h.title=u,h.appendChild(typeof a=="string"?document.createTextNode(a):a),h.addEventListener($.CLICK,this.handleClick_.bind(this,-n),!1);const d=t+" "+no+" "+hl,f=this.element;f.className=d,f.appendChild(c),f.appendChild(h),this.duration_=e.duration!==void 0?e.duration:250}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){const n=this.getMap().getView();if(!n)return;const r=n.getZoom();if(r!==void 0){const s=n.getConstrainedZoom(r+e);this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:s,duration:this.duration_,easing:ki})):n.setZoom(s)}}}function Wm(i){i=i||{};const e=new At;return(i.zoom===void 0||i.zoom)&&e.push(new Xm(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new jm(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new Gm(i.attributionOptions)),e}class Vm{constructor(e,t,n){this.decay_=e,this.minVelocity_=t,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;const e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]<e)return!1;let n=t-3;for(;n>0&&this.points_[n+2]>e;)n-=3;const r=this.points_[t+2]-this.points_[n+2];if(r<16.666666666666668)return!1;const s=this.points_[t]-this.points_[n],o=this.points_[t+1]-this.points_[n+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_}}const vh={ACTIVE:"active"};class Dr extends Zt{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(vh.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(vh.ACTIVE,e)}setMap(e){this.map_=e}}function Um(i,e,t){const n=i.getCenterInternal();if(n){const r=[n[0]+e[0],n[1]+e[1]];i.animateInternal({duration:t!==void 0?t:250,easing:Ip,center:i.getConstrainedCenter(r)})}}function ml(i,e,t,n){const r=i.getZoom();if(r===void 0)return;const s=i.getConstrainedZoom(r+e),o=i.getResolutionForZoom(s);i.getAnimating()&&i.cancelAnimations(),i.animate({resolution:o,anchor:t,duration:n!==void 0?n:250,easing:ki})}class Ym extends Dr{constructor(e){super(),e=e||{},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:250}handleEvent(e){let t=!1;if(e.type==Ve.DBLCLICK){const n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();ml(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}}function yl(i){const e=arguments;return function(t){let n=!0;for(let r=0,s=e.length;r<s&&(n=n&&e[r](t),!!n);++r);return n}}const Bm=function(i){const e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Km=function(i){const e=i.map.getTargetElement(),t=e.getRootNode(),n=i.map.getOwnerDocument().activeElement;return t instanceof ShadowRoot?t.host.contains(n):e.contains(n)},Ch=function(i){const e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?Km(i):!0},$m=Cr,bh=function(i){const e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(up&&yc&&e.ctrlKey)},Rh=function(i){const e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},Zm=function(i){const e=i.originalEvent;return yc?e.metaKey:e.ctrlKey},qm=function(i){const e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Th=function(i){const e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},_l=function(i){const e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"},Hm=function(i){const e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};class Nr extends Dr{constructor(e){e=e||{},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==Ve.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==Ve.POINTERUP){const n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==Ve.POINTERDOWN){const n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==Ve.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}}function xl(i){const e=i.length;let t=0,n=0;for(let r=0;r<e;r++)t+=i[r].clientX,n+=i[r].clientY;return{clientX:t/e,clientY:n/e}}class Jm extends Nr{constructor(e){super({stopDown:Fs}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const t=e.condition?e.condition:yl(Rh,Hm);this.condition_=e.onFocusOnly?yl(Ch,t):t,this.noKinetic_=!1}handleDragEvent(e){const t=e.map;this.panning_||(this.panning_=!0,t.getView().beginInteraction());const n=this.targetPointers,r=t.getEventPixel(xl(n));if(n.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){const s=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],a=e.map.getView();Lc(s,a.getResolution()),Aa(s,a.getRotation()),a.adjustCenterInternal(s)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=n.length,e.originalEvent.preventDefault()}handleUpEvent(e){const t=e.map,n=t.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const r=this.kinetic_.getDistance(),s=this.kinetic_.getAngle(),o=n.getCenterInternal(),a=t.getPixelFromCoordinateInternal(o),l=t.getCoordinateFromPixelInternal([a[0]-r*Math.cos(s),a[1]-r*Math.sin(s)]);n.animateInternal({center:n.getConstrainedCenter(l),duration:500,easing:ki})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){const n=e.map.getView();return this.lastCentroid=null,n.getAnimating()&&n.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}class Qm extends Nr{constructor(e){e=e||{},super({stopDown:Fs}),this.condition_=e.condition?e.condition:Bm,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!_l(e))return;const t=e.map,n=t.getView();if(n.getConstraints().rotation===al)return;const r=t.getSize(),s=e.pixel,o=Math.atan2(r[1]/2-s[1],s[0]-r[0]/2);if(this.lastAngle_!==void 0){const a=o-this.lastAngle_;n.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(e){return _l(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return _l(e)&&bh(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}class ey extends vr{constructor(e){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const e=this.startPixel_,t=this.endPixel_,n="px",r=this.element_.style;r.left=Math.min(e[0],t[0])+n,r.top=Math.min(e[1],t[1])+n,r.width=Math.abs(t[0]-e[0])+n,r.height=Math.abs(t[1]-e[1])+n}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const e=this.startPixel_,t=this.endPixel_,r=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new fn([r])}getGeometry(){return this.geometry_}}const Wi={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class zr extends Gt{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}}class ty extends Nr{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new ey(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??bh,this.boxEndCondition_=e.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,n){const r=n[0]-t[0],s=n[1]-t[1];return r*r+s*s>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.startPixel_&&(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new zr(Wi.BOXDRAG,e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;const t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new zr(t?Wi.BOXEND:Wi.BOXCANCEL,e.coordinate,e)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new zr(Wi.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new zr(Wi.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new zr(Wi.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}}class ny extends ty{constructor(e){e=e||{};const t=e.condition?e.condition:qm;super({condition:t,className:e.className||"ol-dragzoom",minArea:e.minArea}),this.duration_=e.duration!==void 0?e.duration:200,this.out_=e.out!==void 0?e.out:!1}onBoxEnd(e){const n=this.getMap().getView();let r=this.getGeometry();if(this.out_){const s=n.rotatedExtentForGeometry(r),o=n.getResolutionForExtentInternal(s),a=n.getResolution()/o;r=r.clone(),r.scale(a*a)}n.fitInternal(r,{duration:this.duration_,easing:ki})}}const ui={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class iy extends Dr{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return Rh(t)&&Th(t)},this.condition_=e.condition!==void 0?e.condition:this.defaultCondition_,this.duration_=e.duration!==void 0?e.duration:100,this.pixelDelta_=e.pixelDelta!==void 0?e.pixelDelta:128}handleEvent(e){let t=!1;if(e.type==$.KEYDOWN){const n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==ui.DOWN||r==ui.LEFT||r==ui.RIGHT||r==ui.UP)){const o=e.map.getView(),a=o.getResolution()*this.pixelDelta_;let l=0,u=0;r==ui.DOWN?u=-a:r==ui.LEFT?l=-a:r==ui.RIGHT?l=a:u=a;const c=[l,u];Aa(c,o.getRotation()),Um(o,c,this.duration_),n.preventDefault(),t=!0}}return!t}}class ry extends Dr{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!Zm(t)&&Th(t)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:100}handleEvent(e){let t=!1;if(e.type==$.KEYDOWN||e.type==$.KEYPRESS){const n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==="+"||r==="-")){const s=e.map,o=r==="+"?this.delta_:-this.delta_,a=s.getView();ml(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}}const sy=40,oy=300,ay=3;class ly extends Dr{constructor(e){e=e||{},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta!==void 0?e.maxDelta:1,this.duration_=e.duration!==void 0?e.duration:250,this.timeout_=e.timeout!==void 0?e.timeout:80,this.useAnchor_=e.useAnchor!==void 0?e.useAnchor:!0,this.constrainResolution_=e.constrainResolution!==void 0?e.constrainResolution:!1;const t=e.condition?e.condition:$m;this.condition_=e.onFocusOnly?yl(Ch,t):t,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(e){if(this.ctrlKeyListenerKeys_.forEach(Me),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){const t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(fe(t,"keydown",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!0)}),fe(t,"keyup",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;const e=this.getMap();if(!e)return;const t=e.getView(),n=this.lastDelta_?this.lastDelta_>0?1:-1:0;t.endInteraction(this.constrainResolution_||t.getConstrainResolution()?100:void 0,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e)||e.type!==$.WHEEL)return!0;const n=e.map,r=e.originalEvent;r.preventDefault();const s=r.ctrlKey&&!this.ctrlKeyPressed_;r.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=e.pixel);let o=r.deltaY;switch(r.deltaMode){case WheelEvent.DOM_DELTA_LINE:o*=sy;break;case WheelEvent.DOM_DELTA_PAGE:o*=oy;break}if(o===0)return!1;this.lastDelta_=o;const 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");const l=n.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*ay),l.adjustZoom(-o/this.deltaPerZoom_,this.lastAnchor_?n.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=a,!1;this.totalDelta_+=o;const u=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),u),!1}handleWheelZoom_(e){const t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-ke(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),ml(t,n,this.lastAnchor_?e.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(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}}class uy extends Nr{constructor(e){e=e||{};const t=e;t.stopDown||(t.stopDown=Fs),super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold!==void 0?e.threshold:.3,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){let t=0;const n=this.targetPointers[0],r=this.targetPointers[1],s=Math.atan2(r.clientY-n.clientY,r.clientX-n.clientX);if(this.lastAngle_!==void 0){const l=s-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=l}this.lastAngle_=s;const o=e.map,a=o.getView();a.getConstraints().rotation!==al&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(xl(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){const t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}}class cy extends Nr{constructor(e){e=e||{};const t=e;t.stopDown||(t.stopDown=Fs),super(t),this.anchor_=null,this.duration_=e.duration!==void 0?e.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1;const n=this.targetPointers[0],r=this.targetPointers[1],s=n.clientX-r.clientX,o=n.clientY-r.clientY,a=Math.sqrt(s*s+o*o);this.lastDistance_!==void 0&&(t=this.lastDistance_/a),this.lastDistance_=a;const l=e.map,u=l.getView();t!=1&&(this.lastScaleDelta_=t),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(xl(this.targetPointers))),l.render(),u.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){const n=e.map.getView(),r=this.lastScaleDelta_>1?1:-1;return n.endInteraction(this.duration_,r),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){const t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}}function hy(i){i=i||{};const e=new At,t=new Vm(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new Qm),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new Ym({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new Jm({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new uy),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new cy({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new iy),e.push(new ry({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new ly({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new ny({duration:i.zoomDuration})),e}const be={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"};class Sh extends Zt{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;const t=Object.assign({},e);typeof e.properties=="object"&&(delete t.properties,Object.assign(t,e.properties)),t[be.OPACITY]=e.opacity!==void 0?e.opacity:1,xe(typeof t[be.OPACITY]=="number","Layer opacity must be a number"),t[be.VISIBLE]=e.visible!==void 0?e.visible:!0,t[be.Z_INDEX]=e.zIndex,t[be.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[be.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[be.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[be.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){const t=this.state_||{layer:this,managed:e===void 0?!0:e},n=this.getZIndex();return t.opacity=ke(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return J()}getLayerStatesArray(e){return J()}getExtent(){return this.get(be.EXTENT)}getMaxResolution(){return this.get(be.MAX_RESOLUTION)}getMinResolution(){return this.get(be.MIN_RESOLUTION)}getMinZoom(){return this.get(be.MIN_ZOOM)}getMaxZoom(){return this.get(be.MAX_ZOOM)}getOpacity(){return this.get(be.OPACITY)}getSourceState(){return J()}getVisible(){return this.get(be.VISIBLE)}getZIndex(){return this.get(be.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(be.EXTENT,e)}setMaxResolution(e){this.set(be.MAX_RESOLUTION,e)}setMinResolution(e){this.set(be.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(be.MAX_ZOOM,e)}setMinZoom(e){this.set(be.MIN_ZOOM,e)}setOpacity(e){xe(typeof e=="number","Layer opacity must be a number"),this.set(be.OPACITY,e)}setVisible(e){this.set(be.VISIBLE,e)}setZIndex(e){this.set(be.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}const zn={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"};class Gn extends Gt{constructor(e,t){super(e),this.layer=t}}const wl={LAYERS:"layers"};class jn extends Sh{constructor(e){e=e||{};const t=Object.assign({},e);delete t.layers;let n=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(wl.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new At(n.slice(),{unique:!0}):xe(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new At(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(Me),this.layersListenerKeys_.length=0;const e=this.getLayers();this.layersListenerKeys_.push(fe(e,wt.ADD,this.handleLayersAdd_,this),fe(e,wt.REMOVE,this.handleLayersRemove_,this));for(const n in this.listenerKeys_)this.listenerKeys_[n].forEach(Me);Er(this.listenerKeys_);const t=e.getArray();for(let n=0,r=t.length;n<r;n++){const s=t[n];this.registerLayerListeners_(s),this.dispatchEvent(new Gn(zn.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){const t=[fe(e,Ai.PROPERTYCHANGE,this.handleLayerChange_,this),fe(e,$.CHANGE,this.handleLayerChange_,this)];e instanceof jn&&t.push(fe(e,zn.ADDLAYER,this.handleLayerGroupAdd_,this),fe(e,zn.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[te(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Gn(zn.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Gn(zn.REMOVELAYER,e.layer))}handleLayersAdd_(e){const t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Gn(zn.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){const t=e.element,n=te(t);this.listenerKeys_[n].forEach(Me),delete this.listenerKeys_[n],this.dispatchEvent(new Gn(zn.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(wl.LAYERS)}setLayers(e){const t=this.getLayers();if(t){const n=t.getArray();for(let r=0,s=n.length;r<s;++r)this.dispatchEvent(new Gn(zn.REMOVELAYER,n[r]))}this.set(wl.LAYERS,e)}getLayersArray(e){return e=e!==void 0?e:[],this.getLayers().forEach(function(t){t.getLayersArray(e)}),e}getLayerStatesArray(e){const t=e!==void 0?e:[],n=t.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(t)});const r=this.getLayerState();let s=r.zIndex;!e&&r.zIndex===void 0&&(s=0);for(let o=n,a=t.length;o<a;o++){const l=t[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=Xt(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}}const Ft={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};class Vi extends Sh{constructor(e){const t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(be.SOURCE,this.handleSourcePropertyChange_);const n=e.source?e.source:null;this.setSource(n)}getLayersArray(e){return e=e||[],e.push(this),e}getLayerStatesArray(e){return e=e||[],e.push(this.getLayerState()),e}getSource(){return this.get(be.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(Me(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const e=this.getSource();e&&(this.sourceChangeKey_=fe(e,$.CHANGE,this.handleSourceChange_,this),e.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t;const n=this.getMapInternal();!e&&n&&(e=n.getView()),e instanceof Wt?t={viewState:e.getState(),extent:e.calculateExtent()}:t=e,!t.layerStatesArray&&n&&(t.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let r;if(t.layerStatesArray){if(r=t.layerStatesArray.find(o=>o.layer===this),!r)return!1}else r=this.getLayerState();const s=this.getExtent();return El(r,t.viewState)&&(!s||Ue(s,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];const t=this.getSource()?.getAttributions();if(!t)return[];const n=e instanceof Wt?e.getViewStateAndExtent():e;let r=t(n);return Array.isArray(r)||(r=[r]),r}render(e,t){const n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){const t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(be.MAP,e)}getMapInternal(){return this.get(be.MAP)}setMap(e){this.mapPrecomposeKey_&&(Me(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(Me(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=fe(e,Ft.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=fe(this,$.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){const t=e.frameState.layerStatesArray,n=this.getLayerState(!1);xe(!t.some(r=>r.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set(be.SOURCE,e)}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 El(i,e){if(!i.visible)return!1;const t=e.resolution;if(t<i.minResolution||t>=i.maxResolution)return!1;const n=e.zoom;return n>i.minZoom&&n<=i.maxZoom}function Ih(i,e,t=0,n=i.length-1,r=dy){for(;n>t;){if(n-t>600){const l=n-t+1,u=e-t+1,c=Math.log(l),h=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*h*(l-h)/l)*(u-l/2<0?-1:1),f=Math.max(t,Math.floor(e-u*h/l+d)),g=Math.min(n,Math.floor(e+(l-u)*h/l+d));Ih(i,e,f,g,r)}const s=i[e];let o=t,a=n;for(Gr(i,t,e),r(i[n],s)>0&&Gr(i,t,n);o<a;){for(Gr(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?Gr(i,t,a):(a++,Gr(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function Gr(i,e,t){const n=i[e];i[e]=i[t],i[t]=n}function dy(i,e){return i<e?-1:i>e?1:0}let Mh=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data;const n=[];if(!so(e,t))return n;const r=this.toBBox,s=[];for(;t;){for(let o=0;o<t.children.length;o++){const a=t.children[o],l=t.leaf?r(a):a;so(e,l)&&(t.leaf?n.push(a):Cl(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!so(e,t))return!1;const n=[];for(;t;){for(let r=0;r<t.children.length;r++){const s=t.children[r],o=t.leaf?this.toBBox(s):s;if(so(e,o)){if(t.leaf||Cl(e,o))return!0;n.push(s)}}t=n.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let n=0;n<e.length;n++)this.insert(e[n]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){const n=this.data;this.data=t,t=n}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=Yi([]),this}remove(e,t){if(!e)return this;let n=this.data;const r=this.toBBox(e),s=[],o=[];let a,l,u;for(;n||s.length;){if(n||(n=s.pop(),l=s[s.length-1],a=o.pop(),u=!0),n.leaf){const c=fy(e,n.children,t);if(c!==-1)return n.children.splice(c,1),s.push(n),this._condense(s),this}!u&&!n.leaf&&Cl(n,r)?(s.push(n),o.push(a),a=0,l=n,n=n.children[0]):l?(a++,n=l.children[a],u=!1):n=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){const n=[];for(;e;)e.leaf?t.push(...e.children):n.push(...e.children),e=n.pop();return t}_build(e,t,n,r){const s=n-t+1;let o=this._maxEntries,a;if(s<=o)return a=Yi(e.slice(t,n+1)),Ui(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=Yi([]),a.leaf=!1,a.height=r;const l=Math.ceil(s/o),u=l*Math.ceil(Math.sqrt(o));Ah(e,t,n,u,this.compareMinX);for(let c=t;c<=n;c+=u){const h=Math.min(c+u-1,n);Ah(e,c,h,l,this.compareMinY);for(let d=c;d<=h;d+=l){const f=Math.min(d+l-1,h);a.children.push(this._build(e,d,f,r-1))}}return Ui(a,this.toBBox),a}_chooseSubtree(e,t,n,r){for(;r.push(t),!(t.leaf||r.length-1===n);){let s=1/0,o=1/0,a;for(let l=0;l<t.children.length;l++){const u=t.children[l],c=vl(u),h=my(e,u)-c;h<o?(o=h,s=c<s?c:s,a=u):h===o&&c<s&&(s=c,a=u)}t=a||t.children[0]}return t}_insert(e,t,n){const r=n?e:this.toBBox(e),s=[],o=this._chooseSubtree(r,this.data,t,s);for(o.children.push(e),Xr(o,r);t>=0&&s[t].children.length>this._maxEntries;)this._split(s,t),t--;this._adjustParentBBoxes(r,s,t)}_split(e,t){const n=e[t],r=n.children.length,s=this._minEntries;this._chooseSplitAxis(n,s,r);const o=this._chooseSplitIndex(n,s,r),a=Yi(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,Ui(n,this.toBBox),Ui(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=Yi([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Ui(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,s=1/0,o=1/0;for(let a=t;a<=n-t;a++){const l=jr(e,0,a,this.toBBox),u=jr(e,a,n,this.toBBox),c=yy(l,u),h=vl(l)+vl(u);c<s?(s=c,r=a,o=h<o?h:o):c===s&&h<o&&(o=h,r=a)}return r||n-t}_chooseSplitAxis(e,t,n){const r=e.leaf?this.compareMinX:gy,s=e.leaf?this.compareMinY:py,o=this._allDistMargin(e,t,n,r),a=this._allDistMargin(e,t,n,s);o<a&&e.children.sort(r)}_allDistMargin(e,t,n,r){e.children.sort(r);const s=this.toBBox,o=jr(e,0,t,s),a=jr(e,n-t,n,s);let l=ro(o)+ro(a);for(let u=t;u<n-t;u++){const c=e.children[u];Xr(o,e.leaf?s(c):c),l+=ro(o)}for(let u=n-t-1;u>=t;u--){const c=e.children[u];Xr(a,e.leaf?s(c):c),l+=ro(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)Xr(t[r],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():Ui(e[t],this.toBBox)}};function fy(i,e,t){if(!t)return e.indexOf(i);for(let n=0;n<e.length;n++)if(t(i,e[n]))return n;return-1}function Ui(i,e){jr(i,0,i.children.length,e,i)}function jr(i,e,t,n,r){r||(r=Yi(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=e;s<t;s++){const o=i.children[s];Xr(r,i.leaf?n(o):o)}return r}function Xr(i,e){return i.minX=Math.min(i.minX,e.minX),i.minY=Math.min(i.minY,e.minY),i.maxX=Math.max(i.maxX,e.maxX),i.maxY=Math.max(i.maxY,e.maxY),i}function gy(i,e){return i.minX-e.minX}function py(i,e){return i.minY-e.minY}function vl(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function ro(i){return i.maxX-i.minX+(i.maxY-i.minY)}function my(i,e){return(Math.max(e.maxX,i.maxX)-Math.min(e.minX,i.minX))*(Math.max(e.maxY,i.maxY)-Math.min(e.minY,i.minY))}function yy(i,e){const t=Math.max(i.minX,e.minX),n=Math.max(i.minY,e.minY),r=Math.min(i.maxX,e.maxX),s=Math.min(i.maxY,e.maxY);return Math.max(0,r-t)*Math.max(0,s-n)}function Cl(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function so(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function Yi(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Ah(i,e,t,n,r){const s=[e,t];for(;s.length;){if(t=s.pop(),e=s.pop(),t-e<=n)continue;const o=e+Math.ceil((t-e)/n/2)*n;Ih(i,o,e,t,r),s.push(e,o,o,t)}}const bl=[NaN,NaN,NaN,0];let Rl;function _y(){return Rl||(Rl=De(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),Rl}const xy=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,wy=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Ey=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,vy=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function oo(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function Wr(i){throw new Error('failed to parse "'+i+'" as color')}function Ph(i){if(i.toLowerCase().startsWith("rgb")){const s=i.match(wy)||i.match(xy)||i.match(Ey);if(s){const o=s[4],a=100/255;return[ke(oo(s[1],a)+.5|0,0,255),ke(oo(s[2],a)+.5|0,0,255),ke(oo(s[3],a)+.5|0,0,255),o!==void 0?ke(oo(o,100),0,1):1]}Wr(i)}if(i.startsWith("#")){if(vy.test(i)){const s=i.substring(1),o=s.length<=4?1:2,a=[0,0,0,255];for(let l=0,u=s.length;l<u;l+=o){let c=parseInt(s.substring(l,l+o),16);o===1&&(c+=c<<4),a[l/o]=c}return a[3]=a[3]/255,a}Wr(i)}const e=_y();e.fillStyle="#abcdef";let t=e.fillStyle;e.fillStyle=i,e.fillStyle===t&&(e.fillStyle="#fedcba",t=e.fillStyle,e.fillStyle=i,e.fillStyle===t&&Wr(i));const n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return Ph(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);const r=Array.from(e.getImageData(0,0,1,1).data);return r[3]=Ds(r[3]/255,3),r}function Cy(i){return typeof i=="string"?i:Pl(i)}const by=1024,Vr={};let Tl=0;function Ry(i){if(i.length===4)return i;const e=i.slice();return e[3]=1,e}function Sl(i){return i>.0031308?Math.pow(i,.4166666666666667)*269.025-14.025:i*3294.6}function Il(i){return i>.2068965?Math.pow(i,3):(i-.13793103448275862)*.12841854934601665}function Ml(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function Al(i){return i>.0088564?Math.pow(i,.3333333333333333):i/.12841854934601665+.13793103448275862}function Lh(i){const e=Ml(i[0]),t=Ml(i[1]),n=Ml(i[2]),r=Al(e*.222488403+t*.716873169+n*.06060791),s=500*(Al(e*.452247074+t*.399439023+n*.148375274)-r),o=200*(r-Al(e*.016863605+t*.117638439+n*.865350722)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,i[3]]}function Ty(i){const e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,r=Il(e),s=Il(e+t/500*Math.cos(n)),o=Il(e-t/200*Math.sin(n)),a=Sl(s*3.021973625-r*1.617392459-o*.404875592),l=Sl(s*-.943766287+r*1.916279586+o*.027607165),u=Sl(s*.069407491-r*.22898585+o*1.159737864);return[ke(a+.5|0,0,255),ke(l+.5|0,0,255),ke(u+.5|0,0,255),i[3]]}function ao(i){if(i==="none")return bl;if(Vr.hasOwnProperty(i))return Vr[i];if(Tl>=by){let t=0;for(const n in Vr)(t++&3)===0&&(delete Vr[n],--Tl)}const e=Ph(i);e.length!==4&&Wr(i);for(const t of e)isNaN(t)&&Wr(i);return Vr[i]=e,++Tl,e}function ci(i){return Array.isArray(i)?i:ao(i)}function Pl(i){let e=i[0];e!=(e|0)&&(e=e+.5|0);let t=i[1];t!=(t|0)&&(t=t+.5|0);let n=i[2];n!=(n|0)&&(n=n+.5|0);const r=i[3]===void 0?1:Math.round(i[3]*1e3)/1e3;return"rgba("+e+","+t+","+n+","+r+")"}function Fh(i){return i[0]>0&&i[1]>0}function Sy(i,e,t){return t===void 0&&(t=[0,0]),t[0]=i[0]*e+.5|0,t[1]=i[1]*e+.5|0,t}function ct(i,e){return Array.isArray(i)?i:(e===void 0?e=[i,i]:(e[0]=i,e[1]=i),e)}let hi=0;const ft=1<<hi++,ge=1<<hi++,Ct=1<<hi++,Vt=1<<hi++,di=1<<hi++,Ur=1<<hi++,lo=Math.pow(2,hi)-1,Ll={[ft]:"boolean",[ge]:"number",[Ct]:"string",[Vt]:"color",[di]:"number[]",[Ur]:"size"},Iy=Object.keys(Ll).map(Number).sort(Kt);function My(i){return i in Ll}function Yr(i){const e=[];for(const t of Iy)Br(i,t)&&e.push(Ll[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function Br(i,e){return(i&e)===e}function Xn(i,e){return i===e}class et{constructor(e,t){if(!My(e))throw new Error(`literal expressions must have a specific type, got ${Yr(e)}`);this.type=e,this.value=t}}class Ay{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}}function Oh(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1}}function it(i,e,t){switch(typeof i){case"boolean":{if(Xn(e,Ct))return new et(Ct,i?"true":"false");if(!Br(e,ft))throw new Error(`got a boolean, but expected ${Yr(e)}`);return new et(ft,i)}case"number":{if(Xn(e,Ur))return new et(Ur,ct(i));if(Xn(e,ft))return new et(ft,!!i);if(Xn(e,Ct))return new et(Ct,i.toString());if(!Br(e,ge))throw new Error(`got a number, but expected ${Yr(e)}`);return new et(ge,i)}case"string":{if(Xn(e,Vt))return new et(Vt,ao(i));if(Xn(e,ft))return new et(ft,!!i);if(!Br(e,Ct))throw new Error(`got a string, but expected ${Yr(e)}`);return new et(Ct,i)}}if(!Array.isArray(i))throw new Error("expression must be an array or a primitive value");if(i.length===0)throw new Error("empty expression");if(typeof i[0]=="string")return Wy(i,e,t);for(const n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(Xn(e,Ur)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new et(Ur,i)}if(Xn(e,Vt)){if(i.length===3)return new et(Vt,[...i,1]);if(i.length===4)return new et(Vt,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!Br(e,di))throw new Error(`got an array of numbers, but expected ${Yr(e)}`);return new et(di,i)}const M={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:">=",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"},Py={[M.Get]:Q(ue(1,1/0),kh),[M.Var]:Q(ue(1,1),Ly),[M.Has]:Q(ue(1,1/0),kh),[M.Id]:Q(Fy,Bi),[M.Concat]:Q(ue(2,1/0),ve(Ct)),[M.GeometryType]:Q(Oy,Bi),[M.LineMetric]:Q(ky,Bi),[M.Resolution]:Q(Fl,Bi),[M.Zoom]:Q(Fl,Bi),[M.Time]:Q(Fl,Bi),[M.Any]:Q(ue(2,1/0),ve(ft)),[M.All]:Q(ue(2,1/0),ve(ft)),[M.Not]:Q(ue(1,1),ve(ft)),[M.Equal]:Q(ue(2,2),ve(lo)),[M.NotEqual]:Q(ue(2,2),ve(lo)),[M.GreaterThan]:Q(ue(2,2),ve(ge)),[M.GreaterThanOrEqualTo]:Q(ue(2,2),ve(ge)),[M.LessThan]:Q(ue(2,2),ve(ge)),[M.LessThanOrEqualTo]:Q(ue(2,2),ve(ge)),[M.Multiply]:Q(ue(2,1/0),Dh),[M.Coalesce]:Q(ue(2,1/0),Dh),[M.Divide]:Q(ue(2,2),ve(ge)),[M.Add]:Q(ue(2,1/0),ve(ge)),[M.Subtract]:Q(ue(2,2),ve(ge)),[M.Clamp]:Q(ue(3,3),ve(ge)),[M.Mod]:Q(ue(2,2),ve(ge)),[M.Pow]:Q(ue(2,2),ve(ge)),[M.Abs]:Q(ue(1,1),ve(ge)),[M.Floor]:Q(ue(1,1),ve(ge)),[M.Ceil]:Q(ue(1,1),ve(ge)),[M.Round]:Q(ue(1,1),ve(ge)),[M.Sin]:Q(ue(1,1),ve(ge)),[M.Cos]:Q(ue(1,1),ve(ge)),[M.Atan]:Q(ue(1,2),ve(ge)),[M.Sqrt]:Q(ue(1,1),ve(ge)),[M.Match]:Q(ue(4,1/0),Nh,Ny),[M.Between]:Q(ue(3,3),ve(ge)),[M.Interpolate]:Q(ue(6,1/0),Nh,zy),[M.Case]:Q(ue(3,1/0),Dy,Gy),[M.In]:Q(ue(2,2),jy),[M.Number]:Q(ue(1,1/0),ve(lo)),[M.String]:Q(ue(1,1/0),ve(lo)),[M.Array]:Q(ue(1,1/0),ve(ge)),[M.Color]:Q(ue(1,4),ve(ge)),[M.Band]:Q(ue(1,3),ve(ge)),[M.Palette]:Q(ue(2,2),Xy),[M.ToString]:Q(ue(1,1),ve(ft|ge|Ct|Vt))};function kh(i,e,t){const n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){const o=i[s+1];switch(typeof o){case"number":{r[s]=new et(ge,o);break}case"string":{r[s]=new et(Ct,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}s===0&&t.properties.add(String(o))}return r}function Ly(i,e,t){const n=i[1];if(typeof n!="string")throw new Error("expected a string argument for var operation");return t.variables.add(n),[new et(Ct,n)]}function Fy(i,e,t){t.featureId=!0}function Oy(i,e,t){t.geometryType=!0}function ky(i,e,t){t.mCoordinate=!0}function Fl(i,e,t){t.mapState=!0}function Bi(i,e,t){const n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function ue(i,e){return function(t,n,r){const s=t[0],o=t.length-1;if(i===e){if(o!==i){const a=i===1?"":"s";throw new Error(`expected ${i} argument${a} for ${s}, got ${o}`)}}else if(o<i||o>e){const a=e===1/0?`${i} or more`:`${i} to ${e}`;throw new Error(`expected ${a} arguments for ${s}, got ${o}`)}}}function Dh(i,e,t){const n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){const o=it(i[s+1],e,t);r[s]=o}return r}function ve(i){return function(e,t,n){const r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){const a=it(e[o+1],i,n);s[o]=a}return s}}function Dy(i,e,t){const n=i[0],r=i.length-1;if(r%2===0)throw new Error(`expected an odd number of arguments for ${n}, got ${r} instead`)}function Nh(i,e,t){const n=i[0],r=i.length-1;if(r%2===1)throw new Error(`expected an even number of arguments for operation ${n}, got ${r} instead`)}function Ny(i,e,t){const n=i.length-1,r=Ct|ge|ft,s=it(i[1],r,t),o=it(i[i.length-1],e,t),a=new Array(n-2);for(let l=0;l<n-2;l+=2){try{const u=it(i[l+2],s.type,t);a[l]=u}catch(u){throw new Error(`failed to parse argument ${l+1} of match expression: ${u.message}`)}try{const u=it(i[l+3],o.type,t);a[l+1]=u}catch(u){throw new Error(`failed to parse argument ${l+2} of match expression: ${u.message}`)}}return[s,...a,o]}function zy(i,e,t){const n=i[1];let r;switch(n[0]){case"linear":r=1;break;case"exponential":const l=n[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(n)}`)}const s=new et(ge,r);let o;try{o=it(i[2],ge,t)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}const a=new Array(i.length-3);for(let l=0;l<a.length;l+=2){try{const u=it(i[l+3],ge,t);a[l]=u}catch(u){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${u.message}`)}try{const u=it(i[l+4],e,t);a[l+1]=u}catch(u){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${u.message}`)}}return[s,o,...a]}function Gy(i,e,t){const n=it(i[i.length-1],e,t),r=new Array(i.length-1);for(let s=0;s<r.length-1;s+=2){try{const o=it(i[s+1],ft,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{const o=it(i[s+2],n.type,t);r[s+1]=o}catch(o){throw new Error(`failed to parse argument ${s+1} of case expression: ${o.message}`)}}return r[r.length-1]=n,r}function jy(i,e,t){let n=i[2];if(!Array.isArray(n))throw new Error('the second argument for the "in" operator must be an array');let r;if(n[0]==="literal"){if(n=n[1],!Array.isArray(n))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if(typeof n[0]=="string")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');typeof n[0]=="string"?r=Ct:r=ge;const s=new Array(n.length);for(let a=0;a<s.length;a++)try{const l=it(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[it(i[1],r,t),...s]}function Xy(i,e,t){let n;try{n=it(i[1],ge,t)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}const r=i[2];if(!Array.isArray(r))throw new Error("the second argument of palette must be an array");const s=new Array(r.length);for(let o=0;o<s.length;o++){let a;try{a=it(r[o],Vt,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof et))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[n,...s]}function Q(...i){return function(e,t,n){const r=e[0];let s;for(let o=0;o<i.length;o++){const a=i[o](e,t,n);if(o==i.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");s=a}}return new Ay(t,r,...s)}}function Wy(i,e,t){const n=i[0],r=Py[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function zh(i){if(!i)return"";const e=i.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return zh(i.getGeometries()[0]);default:return""}}function Gh(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Ht(i,e,t){const n=it(i,e,t);return Ut(n)}function Ut(i,e){if(i instanceof et){if(i.type===Vt&&typeof i.value=="string"){const n=ao(i.value);return function(){return n}}return function(){return i.value}}const t=i.operator;switch(t){case M.Number:case M.String:case M.Coalesce:return Vy(i);case M.Get:case M.Var:case M.Has:return Uy(i);case M.Id:return n=>n.featureId;case M.GeometryType:return n=>n.geometryType;case M.Concat:{const n=i.args.map(r=>Ut(r));return r=>"".concat(...n.map(s=>s(r).toString()))}case M.Resolution:return n=>n.resolution;case M.Any:case M.All:case M.Between:case M.In:case M.Not:return By(i);case M.Equal:case M.NotEqual:case M.LessThan:case M.LessThanOrEqualTo:case M.GreaterThan:case M.GreaterThanOrEqualTo:return Yy(i);case M.Multiply:case M.Divide:case M.Add:case M.Subtract:case M.Clamp:case M.Mod:case M.Pow:case M.Abs:case M.Floor:case M.Ceil:case M.Round:case M.Sin:case M.Cos:case M.Atan:case M.Sqrt:return Ky(i);case M.Case:return $y(i);case M.Match:return Zy(i);case M.Interpolate:return qy(i);case M.ToString:return Hy(i);default:throw new Error(`Unsupported operator ${t}`)}}function Vy(i,e){const t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Ut(i.args[s]);switch(t){case M.Coalesce:return s=>{for(let o=0;o<n;++o){const 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 M.Number:case M.String:return s=>{for(let o=0;o<n;++o){const a=r[o](s);if(typeof a===t)return a}throw new Error(`Expected one of the values to be a ${t}`)};default:throw new Error(`Unsupported assertion operator ${t}`)}}function Uy(i,e){const n=i.args[0].value;switch(i.operator){case M.Get:return r=>{const s=i.args;let o=r.properties[n];for(let a=1,l=s.length;a<l;++a){const c=s[a].value;o=o[c]}return o};case M.Var:return r=>r.variables[n];case M.Has:return r=>{const s=i.args;if(!(n in r.properties))return!1;let o=r.properties[n];for(let a=1,l=s.length;a<l;++a){const c=s[a].value;if(!o||!Object.hasOwn(o,c))return!1;o=o[c]}return!0};default:throw new Error(`Unsupported accessor operator ${i.operator}`)}}function Yy(i,e){const t=i.operator,n=Ut(i.args[0]),r=Ut(i.args[1]);switch(t){case M.Equal:return s=>n(s)===r(s);case M.NotEqual:return s=>n(s)!==r(s);case M.LessThan:return s=>n(s)<r(s);case M.LessThanOrEqualTo:return s=>n(s)<=r(s);case M.GreaterThan:return s=>n(s)>r(s);case M.GreaterThanOrEqualTo:return s=>n(s)>=r(s);default:throw new Error(`Unsupported comparison operator ${t}`)}}function By(i,e){const t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Ut(i.args[s]);switch(t){case M.Any:return s=>{for(let o=0;o<n;++o)if(r[o](s))return!0;return!1};case M.All:return s=>{for(let o=0;o<n;++o)if(!r[o](s))return!1;return!0};case M.Between:return s=>{const o=r[0](s),a=r[1](s),l=r[2](s);return o>=a&&o<=l};case M.In:return s=>{const o=r[0](s);for(let a=1;a<n;++a)if(o===r[a](s))return!0;return!1};case M.Not:return s=>!r[0](s);default:throw new Error(`Unsupported logical operator ${t}`)}}function Ky(i,e){const t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Ut(i.args[s]);switch(t){case M.Multiply:return s=>{let o=1;for(let a=0;a<n;++a)o*=r[a](s);return o};case M.Divide:return s=>r[0](s)/r[1](s);case M.Add:return s=>{let o=0;for(let a=0;a<n;++a)o+=r[a](s);return o};case M.Subtract:return s=>r[0](s)-r[1](s);case M.Clamp:return s=>{const o=r[0](s),a=r[1](s);if(o<a)return a;const l=r[2](s);return o>l?l:o};case M.Mod:return s=>r[0](s)%r[1](s);case M.Pow:return s=>Math.pow(r[0](s),r[1](s));case M.Abs:return s=>Math.abs(r[0](s));case M.Floor:return s=>Math.floor(r[0](s));case M.Ceil:return s=>Math.ceil(r[0](s));case M.Round:return s=>Math.round(r[0](s));case M.Sin:return s=>Math.sin(r[0](s));case M.Cos:return s=>Math.cos(r[0](s));case M.Atan:return n===2?s=>Math.atan2(r[0](s),r[1](s)):s=>Math.atan(r[0](s));case M.Sqrt:return s=>Math.sqrt(r[0](s));default:throw new Error(`Unsupported numeric operator ${t}`)}}function $y(i,e){const t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Ut(i.args[r]);return r=>{for(let s=0;s<t-1;s+=2)if(n[s](r))return n[s+1](r);return n[t-1](r)}}function Zy(i,e){const t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Ut(i.args[r]);return r=>{const s=n[0](r);for(let o=1;o<t-1;o+=2)if(s===n[o](r))return n[o+1](r);return n[t-1](r)}}function qy(i,e){const t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Ut(i.args[r]);return r=>{const s=n[0](r),o=n[1](r);let a,l;for(let u=2;u<t;u+=2){const c=n[u](r);let h=n[u+1](r);const d=Array.isArray(h);if(d&&(h=Ry(h)),c>=o)return u===2?h:d?Jy(s,o,a,l,c,h):Kr(s,o,a,l,c,h);a=c,l=h}return l}}function Hy(i,e){const t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Ut(i.args[s]);if(t===M.ToString)return s=>{const o=r[0](s);return i.args[0].type===Vt?Pl(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function Kr(i,e,t,n,r,s){const o=r-t;if(o===0)return n;const a=e-t,l=i===1?a/o:(Math.pow(i,a)-1)/(Math.pow(i,o)-1);return n+l*(s-n)}function Jy(i,e,t,n,r,s){if(r-t===0)return n;const a=Lh(n),l=Lh(s);let u=l[2]-a[2];u>180?u-=360:u<-180&&(u+=360);const c=[Kr(i,e,t,a[0],r,l[0]),Kr(i,e,t,a[1],r,l[1]),a[2]+Kr(i,e,t,0,r,u),Kr(i,e,t,n[3],r,s[3])];return Ty(c)}const X={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class Ol extends Rr{constructor(e,t,n,r){super(),this.extent=e,this.pixelRatio_=n,this.resolution=t,this.state=typeof r=="function"?X.IDLE:r,this.image_=null,this.loader=typeof r=="function"?r:null}changed(){this.dispatchEvent($.CHANGE)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(this.state==X.IDLE&&this.loader){this.state=X.LOADING,this.changed();const e=this.getResolution(),t=Array.isArray(e)?e[0]:e;Pi(()=>this.loader(this.getExtent(),t,this.getPixelRatio())).then(n=>{"image"in n&&(this.image_=n.image),"extent"in n&&(this.extent=n.extent),"resolution"in n&&(this.resolution=n.resolution),"pixelRatio"in n&&(this.pixelRatio_=n.pixelRatio),(n instanceof HTMLImageElement||hp&&n instanceof ImageBitmap||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement)&&(this.image_=n),this.state=X.LOADED}).catch(n=>{this.state=X.ERROR,console.error(n)}).finally(()=>this.changed())}}setImage(e){this.image_=e}setResolution(e){this.resolution=e}}function Qy(i,e,t){const n=i;let r=!0,s=!1,o=!1;const a=[Ps(n,$.LOAD,function(){o=!0,s||e()})];return n.src&&_c?(s=!0,n.decode().then(function(){r&&e()}).catch(function(l){r&&(o?e():t())})):a.push(Ps(n,$.ERROR,t)),function(){r=!1,a.forEach(Me)}}function e0(i,e){return new Promise((t,n)=>{function r(){o(),t(i)}function s(){o(),n(new Error("Image load error"))}function o(){i.removeEventListener("load",r),i.removeEventListener("error",s)}i.addEventListener("load",r),i.addEventListener("error",s)})}function t0(i,e){return e&&(i.src=e),i.src&&_c?new Promise((t,n)=>i.decode().then(()=>t(i)).catch(r=>i.complete&&i.width?t(i):n(r))):e0(i)}class n0{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 e=0;for(const t in this.cache_){const n=this.cache_[t];(e++&3)===0&&!n.hasListener()&&(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t){const n=kl(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){const n=kl(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){const s=kl(e,t),o=s in this.cache_;this.cache_[s]=n,r&&(n.getImageState()===X.IDLE&&n.load(),n.getImageState()===X.LOADING?n.ready().then(()=>{this.patternCache_[s]=io().createPattern(n.getImage(1),"repeat")}):this.patternCache_[s]=io().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}}function kl(i,e){const t=e?ci(e):"null";return i+":"+t}const Ot=new n0;let $r=null;class jh extends Rr{constructor(e,t,n,r,s){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.canvas_={},this.color_=s,this.imageState_=r===void 0?X.IDLE:r,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,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_===X.LOADED){$r||($r=De(1,1,void 0,{willReadFrequently:!0})),$r.drawImage(this.image_,0,0);try{$r.getImageData(0,0,1,1),this.tainted_=!1}catch{$r=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent($.CHANGE)}handleImageError_(){this.imageState_=X.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=X.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}setImage(e){this.image_=e}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const e=this.size_[0],t=this.size_[1],n=De(e,t);n.fillRect(0,0,e,t),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===X.IDLE){this.image_||this.initializeImage_(),this.imageState_=X.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&t0(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==X.LOADED)return;const t=this.image_,n=De(Math.ceil(t.width*e),Math.ceil(t.height*e)),r=n.canvas;n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation="multiply",n.fillStyle=Cy(this.color_),n.fillRect(0,0,r.width/e,r.height/e),n.globalCompositeOperation="destination-in",n.drawImage(t,0,0),this.canvas_[e]=r}ready(){return this.ready_||(this.ready_=new Promise(e=>{if(this.imageState_===X.LOADED||this.imageState_===X.ERROR)e();else{const t=()=>{(this.imageState_===X.LOADED||this.imageState_===X.ERROR)&&(this.removeEventListener($.CHANGE,t),e())};this.addEventListener($.CHANGE,t)}})),this.ready_}}function Zr(i,e,t,n,r,s){let o=e===void 0?void 0:Ot.get(e,r);return o||(o=new jh(i,i&&"src"in i?i.src||void 0:e,t,n,r),Ot.set(e,r,o,s)),s&&o&&!Ot.getPattern(e,r)&&Ot.set(e,r,o,s),o}function Jt(i){return i?Array.isArray(i)?Pl(i):typeof i=="object"&&"src"in i?i0(i):i:null}function i0(i){if(!i.offset||!i.size)return Ot.getPattern(i.src,i.color);const e=i.src+":"+i.offset,t=Ot.getPattern(e,i.color);if(t)return t;const n=Ot.get(i.src,null);if(n.getImageState()!==X.LOADED)return null;const r=De(i.size[0],i.size[1]);return r.drawImage(n.getImage(1),i.offset[0],i.offset[1],i.size[0],i.size[1],0,0,i.size[0],i.size[1]),Zr(r.canvas,e,void 0,X.LOADED,i.color,!0),Ot.getPattern(e,i.color)}const Xh="10px sans-serif",bt="#000",Ki="round",gn=[],pn=0,$i="round",qr=10,r0=0,Qt="#000",Hr="center",uo="middle",fi=[0,0,0,0],Jr=1,gi=new Zt;let Qr=null,Wh;const Dl={},s0=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function o0(i,e,t){return`${i} ${e} 16px "${t}"`}const a0=(function(){let e,t;async function n(s){await t.ready;const o=await t.load(s);if(o.length===0)return!1;const a=fl(s),l=a.families[0].toLowerCase(),u=a.weight;return o.some(c=>{const h=c.family.replace(/^['"]|['"]$/g,"").toLowerCase(),d=dl[c.weight]||c.weight;return h===l&&c.style===a.style&&d==u})}async function r(){await t.ready;let s=!0;const o=gi.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){const u=a[l];let c=o[u];c<100&&(await n(u)?(Er(Dl),gi.set(u,100)):(c+=10,gi.set(u,c,!0),c<100&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(s){t||(t=at?self.fonts:document.fonts);const o=fl(s);if(!o)return;const a=o.families;let l=!1;for(const u of a){if(s0.has(u))continue;const c=o0(o.style,o.weight,u);gi.get(c)===void 0&&(gi.set(c,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(r,100))}})(),l0=(function(){let i;return function(e){let t=Dl[e];if(t==null){if(at){const n=fl(e),r=Vh(e,"Žg");t=(isNaN(Number(n.lineHeight))?1.2:Number(n.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else i||(i=document.createElement("div"),i.innerHTML="M",i.style.minHeight="0",i.style.maxHeight="none",i.style.height="auto",i.style.padding="0",i.style.border="none",i.style.position="absolute",i.style.display="block",i.style.left="-99999px"),i.style.font=e,document.body.appendChild(i),t=i.offsetHeight,document.body.removeChild(i);Dl[e]=t}return t}})();function Vh(i,e){return Qr||(Qr=De(1,1)),i!=Wh&&(Qr.font=i,Wh=Qr.font),Qr.measureText(e)}function Uh(i,e){return Vh(i,e).width}function Yh(i,e,t){if(e in t)return t[e];const n=e.split(`
|
|
2
|
+
`).reduce((r,s)=>Math.max(r,Uh(i,s)),0);return t[e]=n,n}function u0(i,e){const t=[],n=[],r=[];let s=0,o=0,a=0,l=0;for(let u=0,c=e.length;u<=c;u+=2){const h=e[u];if(h===`
|
|
3
|
+
`||u===c){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}const d=e[u+1]||i.font,f=Uh(d,h);t.push(f),o+=f;const g=l0(d);n.push(g),l=Math.max(l,g)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function c0(i,e,t,n,r,s,o,a,l,u,c){i.save(),t!==1&&(i.globalAlpha===void 0?i.globalAlpha=h=>h.globalAlpha*=t:i.globalAlpha*=t),e&&i.transform.apply(i,e),n.contextInstructions?(i.translate(l,u),i.scale(c[0],c[1]),h0(n,i)):c[0]<0||c[1]<0?(i.translate(l,u),i.scale(c[0],c[1]),i.drawImage(n,r,s,o,a,0,0,o,a)):i.drawImage(n,r,s,o,a,l,u,o*c[0],a*c[1]),i.restore()}function h0(i,e){const t=i.contextInstructions;for(let n=0,r=t.length;n<r;n+=2)Array.isArray(t[n+1])?e[t[n]].apply(e,t[n+1]):e[t[n]]=t[n+1]}class co{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=ct(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){const e=this.getScale();return new co({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,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(e){return J()}getHitDetectionImage(){return J()}getPixelRatio(e){return 1}getImageState(){return J()}getImageSize(){return J()}getOrigin(){return J()}getSize(){return J()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=ct(e)}listenImageChange(e){J()}load(){J()}unlistenImageChange(e){J()}ready(){return Promise.resolve()}}class ho extends co{constructor(e){super({opacity:1,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,rotation:e.rotation!==void 0?e.rotation:0,scale:e.scale!==void 0?e.scale:1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=e.fill!==void 0?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius=e.radius,this.radius2_=e.radius2,this.angle_=e.angle!==void 0?e.angle:0,this.stroke_=e.stroke!==void 0?e.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?X.LOADING:X.LOADED,this.imageState_===X.LOADING&&this.ready().then(()=>this.imageState_=X.LOADED),this.render()}clone(){const e=this.getScale(),t=new ho({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}getAnchor(){const e=this.size_,t=this.getDisplacement(),n=this.getScaleArray();return[e[0]/2-t[0]/n[0],e[1]/2+t[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(e){const t=this.fill_?.getKey(),n=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(",");let r=Ot.get(n,null)?.getImage(1);if(!r){const s=this.renderOptions_,o=Math.ceil(s.size*e),a=De(o,o);this.draw_(s,a,e),r=a.canvas;const l=new jh(r,void 0,null,X.LOADED,null);Ot.set(n,null,l),createImageBitmap(r).then(u=>{l.setImage(u)})}return r}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(e){this.radius!==e&&(this.radius=e,this.render())}getRadius2(){return this.radius2_}setRadius2(e){this.radius2_!==e&&(this.radius2_=e,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,n){if(t===0||this.points_===1/0||e!=="bevel"&&e!=="miter")return t;let r=this.radius,s=this.radius2_===void 0?r:this.radius2_;if(r<s){const C=r;r=s,s=C}const o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=s*Math.sin(a),u=Math.sqrt(s*s-l*l),c=r-u,h=Math.sqrt(l*l+c*c),d=h/l;if(e==="miter"&&d<=n)return d*t;const f=t/2/d,g=t/2*(c/h),p=Math.sqrt((r+f)*(r+f)+g*g)-r;if(this.radius2_===void 0||e==="bevel")return p*2;const y=r*Math.sin(a),_=Math.sqrt(r*r-y*y),E=s-_,w=Math.sqrt(y*y+E*E)/y;if(w<=n){const C=w*t/2-s-r;return 2*Math.max(p,C)}return p*2}createRenderOptions(){let e=Ki,t=$i,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=Jt(this.stroke_.getColor()??Qt),a=this.stroke_.getWidth()??Jr,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??$i,e=this.stroke_.getLineCap()??Ki,n=this.stroke_.getMiterLimit()??qr);const l=this.calculateLineJoinSize_(t,a,n),u=Math.max(this.radius,this.radius2_||0),c=Math.ceil(2*u+l);return{strokeStyle:o,strokeWidth:a,size:c,lineCap:e,lineDash:r,lineDashOffset:s,lineJoin:t,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();const e=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[e,e]}draw_(e,t,n){if(t.scale(n,n),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let r=this.fill_.getColor();r===null&&(r=bt),t.fillStyle=Jt(r),t.fill()}e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){let t;if(this.fill_){let n=this.fill_.getColor(),r=0;typeof n=="string"&&(n=ci(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=De(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_;const n=this.radius;if(t===1/0)e.arc(0,0,n,0,2*Math.PI);else{const r=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(t*=2);const s=this.angle_-Math.PI/2,o=2*Math.PI/t;for(let a=0;a<t;a++){const l=s+a*o,u=a%2===0?n:r;e.lineTo(u*Math.cos(l),u*Math.sin(l))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=bt,t.fill(),e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}class Zi extends ho{constructor(e){e=e||{radius:5},super({points:1/0,fill:e.fill,radius:e.radius,stroke:e.stroke,scale:e.scale!==void 0?e.scale:1,rotation:e.rotation!==void 0?e.rotation:0,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode})}clone(){const e=this.getScale(),t=new Zi({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}}class kt{constructor(e){e=e||{},this.patternImage_=null,this.color_=null,e.color!==void 0&&this.setColor(e.color)}clone(){const e=this.getColor();return new kt({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){if(e!==null&&typeof e=="object"&&"src"in e){const t=Zr(null,e.src,{crossOrigin:"anonymous"},void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===X.IDLE&&t.load(),t.getImageState()===X.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){const e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?te(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:ci(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}function Bh(i,e,t,n){return t!==void 0&&n!==void 0?[t/i,n/e]:t!==void 0?t/i:n!==void 0?n/e:1}class pi extends co{constructor(e){e=e||{};const t=e.opacity!==void 0?e.opacity:1,n=e.rotation!==void 0?e.rotation:0,r=e.scale!==void 0?e.scale:1,s=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:n,scale:r,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:s,declutterMode:e.declutterMode}),this.anchor_=e.anchor!==void 0?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin!==void 0?e.anchorOrigin:"top-left",this.anchorXUnits_=e.anchorXUnits!==void 0?e.anchorXUnits:"fraction",this.anchorYUnits_=e.anchorYUnits!==void 0?e.anchorYUnits:"fraction",this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy_=e.referrerPolicy;const o=e.img!==void 0?e.img:null;let a=e.src;xe(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||te(o)),xe(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),xe(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(e.src!==void 0?l=X.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?X.LOADED:X.IDLE:l=X.LOADING:l=X.LOADED),this.color_=e.color!==void 0?ci(e.color):null,this.iconImage_=Zr(o,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},l,this.color_),this.offset_=e.offset!==void 0?e.offset:[0,0],this.offsetOrigin_=e.offsetOrigin!==void 0?e.offsetOrigin:"top-left",this.origin_=null,this.size_=e.size!==void 0?e.size:null,this.initialOptions_,e.width!==void 0||e.height!==void 0){let u,c;if(e.size)[u,c]=e.size;else{const h=this.getImage(1);if(h.width&&h.height)u=h.width,c=h.height;else if(h instanceof HTMLImageElement){this.initialOptions_=e;const d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;const f=this.iconImage_.getSize();this.setScale(Bh(f[0],f[1],e.width,e.height))};this.listenImageChange(d);return}}u!==void 0&&this.setScale(Bh(u,c,e.width,e.height))}}clone(){let e,t,n;return this.initialOptions_?(t=this.initialOptions_.width,n=this.initialOptions_.height):(e=this.getScale(),e=Array.isArray(e)?e.slice():e),new pi({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:e,width:t,height:n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;const r=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!r)return null;e=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(e[0]*=r[0]),this.anchorYUnits_=="fraction"&&(e[1]*=r[1])}if(this.anchorOrigin_!="top-left"){if(!r)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(e[0]=-e[0]+r[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(e[1]=-e[1]+r[1])}this.normalizedAnchor_=e}const t=this.getDisplacement(),n=this.getScaleArray();return[e[0]-t[0]/n[0],e[1]+t[1]/n[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(e){const t=e?ci(e):null;if(this.color_===t||this.color_&&t&&this.color_.length===t.length&&this.color_.every((o,a)=>o===t[a]))return;this.color_=t;const n=this.getSrc(),r=n!==void 0?null:this.getHitDetectionImage(),s=n!==void 0?X.IDLE:this.iconImage_.getImageState();this.iconImage_=Zr(r,n,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},s,this.color_)}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!="top-left"){const t=this.getSize(),n=this.iconImage_.getSize();if(!t||!n)return null;e=e.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(e[0]=n[0]-t[0]-e[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(e[1]=n[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=Zr(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},X.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==X.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){const e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==X.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener($.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener($.CHANGE,e)}ready(){return this.iconImage_.ready()}}class mn{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash!==void 0?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.offset_=e.offset,this.width_=e.width}clone(){const e=this.getColor();return new mn({color:Array.isArray(e)?e.slice():e||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(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setOffset(e){this.offset_=e}setWidth(e){this.width_=e}}class gt{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=$h,e.geometry!==void 0&&this.setGeometry(e.geometry),this.fill_=e.fill!==void 0?e.fill:null,this.image_=e.image!==void 0?e.image:null,this.renderer_=e.renderer!==void 0?e.renderer:null,this.hitDetectionRenderer_=e.hitDetectionRenderer!==void 0?e.hitDetectionRenderer:null,this.stroke_=e.stroke!==void 0?e.stroke:null,this.text_=e.text!==void 0?e.text:null,this.zIndex_=e.zIndex}clone(){let e=this.getGeometry();return e&&typeof e=="object"&&(e=e.clone()),new gt({geometry:e??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){typeof e=="function"?this.geometryFunction_=e:typeof e=="string"?this.geometryFunction_=function(t){return t.get(e)}:e?e!==void 0&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=$h,this.geometry_=e}setZIndex(e){this.zIndex_=e}}function d0(i){let e;if(typeof i=="function")e=i;else{let t;Array.isArray(i)?t=i:(xe(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[i]),e=function(){return t}}return e}let Nl=null;function Kh(i,e){if(!Nl){const t=new kt({color:"rgba(255,255,255,0.4)"}),n=new mn({color:"#3399CC",width:1.25});Nl=[new gt({image:new Zi({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return Nl}function $h(i){return i.getGeometry()}const f0="#333";class es{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.keepUpright_=e.keepUpright,this.scale_=e.scale,this.scaleArray_=ct(e.scale!==void 0?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=e.fill!==void 0?e.fill:new kt({color:f0}),this.maxAngle_=e.maxAngle!==void 0?e.maxAngle:Math.PI/4,this.placement_=e.placement!==void 0?e.placement:"point",this.overflow_=!!e.overflow,this.stroke_=e.stroke!==void 0?e.stroke:null,this.offsetX_=e.offsetX!==void 0?e.offsetX:0,this.offsetY_=e.offsetY!==void 0?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=e.padding===void 0?null:e.padding,this.declutterMode_=e.declutterMode}clone(){const e=this.getScale();return new es({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(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof kt?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_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setKeepUpright(e){this.keepUpright_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=ct(e!==void 0?e:1)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}}function g0(i){return!0}function p0(i){const e=Oh(),t=m0(i,e),n=Gh();return function(r,s){if(n.properties=r.getPropertiesInternal(),n.resolution=s,e.featureId){const o=r.getId();o!==void 0?n.featureId=o:n.featureId=null}return e.geometryType&&(n.geometryType=zh(r.getGeometry())),t(n)}}function Zh(i){const e=Oh(),t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=zl(i[o],e);const r=Gh(),s=new Array(t);return function(o,a){if(r.properties=o.getPropertiesInternal(),r.resolution=a,e.featureId){const u=o.getId();u!==void 0?r.featureId=u:r.featureId=null}let l=0;for(let u=0;u<t;++u){const c=n[u](r);c&&(s[l]=c,l+=1)}return s.length=l,s}}function m0(i,e){const t=i.length,n=new Array(t);for(let r=0;r<t;++r){const s=i[r],o="filter"in s?Ht(s.filter,ft,e):g0;let a;if(Array.isArray(s.style)){const l=s.style.length;a=new Array(l);for(let u=0;u<l;++u)a[u]=zl(s.style[u],e)}else a=[zl(s.style,e)];n[r]={filter:o,styles:a}}return function(r){const s=[];let o=!1;for(let a=0;a<t;++a){const l=n[a].filter;if(l(r)&&!(i[a].else&&o)){o=!0;for(const u of n[a].styles){const c=u(r);c&&s.push(c)}}}return s}}function zl(i,e){const t=ts(i,"",e),n=ns(i,"",e),r=y0(i,e),s=_0(i,e),o=rt(i,"z-index",e);if(!t&&!n&&!r&&!s&&!Sn(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));const a=new gt;return function(l){let u=!0;if(t){const c=t(l);c&&(u=!1),a.setFill(c)}if(n){const c=n(l);c&&(u=!1),a.setStroke(c)}if(r){const c=r(l);c&&(u=!1),a.setText(c)}if(s){const c=s(l);c&&(u=!1),a.setImage(c)}return o&&a.setZIndex(o(l)),u?null:a}}function ts(i,e,t){let n;if(e+"fill-pattern-src"in i)n=v0(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=fo(i,e+"fill-color",t)}if(!n)return null;const r=new kt;return function(s){const o=n(s);return o===bl?null:(r.setColor(o),r)}}function ns(i,e,t){const n=rt(i,e+"stroke-width",t),r=fo(i,e+"stroke-color",t);if(!n&&!r)return null;const s=_n(i,e+"stroke-line-cap",t),o=_n(i,e+"stroke-line-join",t),a=qh(i,e+"stroke-line-dash",t),l=rt(i,e+"stroke-line-dash-offset",t),u=rt(i,e+"stroke-miter-limit",t),c=rt(i,e+"stroke-offset",t),h=new mn;return function(d){if(r){const f=r(d);if(f===bl)return null;h.setColor(f)}if(n&&h.setWidth(n(d)),s){const f=s(d);if(f!=="butt"&&f!=="round"&&f!=="square")throw new Error("Expected butt, round, or square line cap");h.setLineCap(f)}if(o){const f=o(d);if(f!=="bevel"&&f!=="round"&&f!=="miter")throw new Error("Expected bevel, round, or miter line join");h.setLineJoin(f)}return a&&h.setLineDash(a(d)),l&&h.setLineDashOffset(l(d)),u&&h.setMiterLimit(u(d)),c&&h.setOffset(c(d)),h}}function y0(i,e){const t="text-",n=_n(i,t+"value",e);if(!n)return null;const r=ts(i,t,e),s=ts(i,t+"background-",e),o=ns(i,t,e),a=ns(i,t+"background-",e),l=_n(i,t+"font",e),u=rt(i,t+"max-angle",e),c=rt(i,t+"offset-x",e),h=rt(i,t+"offset-y",e),d=qi(i,t+"overflow",e),f=_n(i,t+"placement",e),g=rt(i,t+"repeat",e),m=po(i,t+"scale",e),p=qi(i,t+"rotate-with-view",e),y=rt(i,t+"rotation",e),_=_n(i,t+"align",e),E=_n(i,t+"justify",e),x=_n(i,t+"baseline",e),w=qi(i,t+"keep-upright",e),C=qh(i,t+"padding",e),b=mo(i,t+"declutter-mode"),v=new es({declutterMode:b});return function(R){if(v.setText(n(R)),r&&v.setFill(r(R)),s&&v.setBackgroundFill(s(R)),o&&v.setStroke(o(R)),a&&v.setBackgroundStroke(a(R)),l&&v.setFont(l(R)),u&&v.setMaxAngle(u(R)),c&&v.setOffsetX(c(R)),h&&v.setOffsetY(h(R)),d&&v.setOverflow(d(R)),f){const A=f(R);if(A!=="point"&&A!=="line")throw new Error("Expected point or line for text-placement");v.setPlacement(A)}if(g&&v.setRepeat(g(R)),m&&v.setScale(m(R)),p&&v.setRotateWithView(p(R)),y&&v.setRotation(y(R)),_){const A=_(R);if(A!=="left"&&A!=="center"&&A!=="right"&&A!=="end"&&A!=="start")throw new Error("Expected left, right, center, start, or end for text-align");v.setTextAlign(A)}if(E){const A=E(R);if(A!=="left"&&A!=="right"&&A!=="center")throw new Error("Expected left, right, or center for text-justify");v.setJustify(A)}if(x){const A=x(R);if(A!=="bottom"&&A!=="top"&&A!=="middle"&&A!=="alphabetic"&&A!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");v.setTextBaseline(A)}return C&&v.setPadding(C(R)),w&&v.setKeepUpright(w(R)),v}}function _0(i,e){return"icon-src"in i?x0(i,e):"shape-points"in i?w0(i,e):"circle-radius"in i?E0(i,e):null}function x0(i,e){const t="icon-",n=t+"src",r=ed(i[n],n),s=go(i,t+"anchor",e),o=po(i,t+"scale",e),a=rt(i,t+"opacity",e),l=go(i,t+"displacement",e),u=rt(i,t+"rotation",e),c=qi(i,t+"rotate-with-view",e),h=Jh(i,t+"anchor-origin"),d=Qh(i,t+"anchor-x-units"),f=Qh(i,t+"anchor-y-units"),g=yn(i,t+"color");let m,p=null;g!==void 0&&(Array.isArray(g)&&g.length>0&&typeof g[0]=="string"?p=fo(i,t+"color",e):m=td(g,t+"color"));const y=b0(i,t+"cross-origin"),_=R0(i,t+"offset"),E=Jh(i,t+"offset-origin"),x=Gl(i,t+"width"),w=Gl(i,t+"height"),C=C0(i,t+"size"),b=mo(i,t+"declutter-mode"),v={src:r,anchorOrigin:h,anchorXUnits:d,anchorYUnits:f,crossOrigin:y,offset:_,offsetOrigin:E,height:w,width:x,size:C,declutterMode:b};let R=null;return function(A){if(R)p&&R.setColor(p(A));else{const F=p?p(A):m;R=new pi(F!==void 0?Object.assign({},v,{color:F}):Object.assign({},v))}return a&&R.setOpacity(a(A)),l&&R.setDisplacement(l(A)),u&&R.setRotation(u(A)),c&&R.setRotateWithView(c(A)),o&&R.setScale(o(A)),s&&R.setAnchor(s(A)),R}}function w0(i,e){const t="shape-",n=t+"points",r=t+"radius",s=jl(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);const o=rt(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",u=rt(i,l,e),c=typeof i[l]=="number"?i[l]:void 0,h=ts(i,t,e),d=ns(i,t,e),f=po(i,t+"scale",e),g=go(i,t+"displacement",e),m=rt(i,t+"rotation",e),p=qi(i,t+"rotate-with-view",e),y=Gl(i,t+"angle"),_=mo(i,t+"declutter-mode"),E=new ho({points:s,radius:a,radius2:c,angle:y,declutterMode:_});return function(x){return o&&E.setRadius(o(x)),u&&E.setRadius2(u(x)),h&&E.setFill(h(x)),d&&E.setStroke(d(x)),g&&E.setDisplacement(g(x)),m&&E.setRotation(m(x)),p&&E.setRotateWithView(p(x)),f&&E.setScale(f(x)),E}}function E0(i,e){const t="circle-",n=ts(i,t,e),r=ns(i,t,e),s=rt(i,t+"radius",e),o=po(i,t+"scale",e),a=go(i,t+"displacement",e),l=rt(i,t+"rotation",e),u=qi(i,t+"rotate-with-view",e),c=mo(i,t+"declutter-mode"),h=new Zi({radius:5,declutterMode:c});return function(d){return s&&h.setRadius(s(d)),n&&h.setFill(n(d)),r&&h.setStroke(r(d)),a&&h.setDisplacement(a(d)),l&&h.setRotation(l(d)),u&&h.setRotateWithView(u(d)),o&&h.setScale(o(d)),h}}function yn(i,e){if(!(e in i))return;const t=i[e];return t===void 0?void 0:t}function rt(i,e,t){const n=yn(i,e);if(n===void 0)return;const r=Ht(n,ge,t);return function(s){return jl(r(s),e)}}function _n(i,e,t){const n=yn(i,e);if(n===void 0)return null;const r=Ht(n,Ct,t);return function(s){return ed(r(s),e)}}function v0(i,e,t){const n=_n(i,e+"pattern-src",t),r=Hh(i,e+"pattern-offset",t),s=Hh(i,e+"pattern-size",t),o=fo(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function qi(i,e,t){const n=yn(i,e);if(n===void 0)return null;const r=Ht(n,ft,t);return function(s){const o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function fo(i,e,t){const n=yn(i,e);if(n===void 0)return null;const r=Ht(n,Vt,t);return function(s){return td(r(s),e)}}function qh(i,e,t){const n=yn(i,e);if(n===void 0)return null;if(Array.isArray(n)&&(n.length===0||typeof n[0]!="string")){const s=n.map((o,a)=>{if(typeof o=="number")return()=>o;const l=Ht(o,ge,t);return function(u){return jl(l(u),`${e}[${a}]`)}});return function(o){const a=new Array(s.length);for(let l=0;l<s.length;++l)a[l]=s[l](o);return a}}const r=Ht(n,di,t);return function(s){return is(r(s),e)}}function go(i,e,t){const n=yn(i,e);if(n===void 0)return null;const r=Ht(n,di,t);return function(s){const o=is(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function Hh(i,e,t){const n=yn(i,e);if(n===void 0)return null;const r=Ht(n,di,t);return function(s){return nd(r(s),e)}}function po(i,e,t){const n=yn(i,e);if(n===void 0)return null;const r=Ht(n,di|ge,t);return function(s){return T0(r(s),e)}}function Gl(i,e){const t=i[e];if(t!==void 0){if(typeof t!="number")throw new Error(`Expected a number for ${e}`);return t}}function C0(i,e){const t=i[e];if(t!==void 0){if(typeof t=="number")return ct(t);if(!Array.isArray(t))throw new Error(`Expected a number or size array for ${e}`);if(t.length!==2||typeof t[0]!="number"||typeof t[1]!="number")throw new Error(`Expected a number or size array for ${e}`);return t}}function b0(i,e){const t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);return t}}function Jh(i,e){const t=i[e];if(t!==void 0){if(t!=="bottom-left"&&t!=="bottom-right"&&t!=="top-left"&&t!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return t}}function Qh(i,e){const t=i[e];if(t!==void 0){if(t!=="pixels"&&t!=="fraction")throw new Error(`Expected pixels or fraction for ${e}`);return t}}function R0(i,e){const t=i[e];if(t!==void 0)return is(t,e)}function mo(i,e){const t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);if(t!=="declutter"&&t!=="obstacle"&&t!=="none")throw new Error(`Expected declutter, obstacle, or none for ${e}`);return t}}function is(i,e){if(!Array.isArray(i))throw new Error(`Expected an array for ${e}`);const t=i.length;for(let n=0;n<t;++n)if(typeof i[n]!="number")throw new Error(`Expected an array of numbers for ${e}`);return i}function ed(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function jl(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function td(i,e){if(typeof i=="string")return i;const t=is(i,e),n=t.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return t}function nd(i,e){const t=is(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function T0(i,e){return typeof i=="number"?i:nd(i,e)}const id={RENDER_ORDER:"renderOrder"};class Xl extends Vi{constructor(e){e=e||{};const t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=e.renderBuffer!==void 0?e.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating!==void 0?e.updateWhileAnimating:!1,this.updateWhileInteracting_=e.updateWhileInteracting!==void 0?e.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(id.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){const n=this.getDeclutter();n in e.declutter||(e.declutter[n]=new Mh(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(id.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?Kh:e;const t=S0(e);this.styleFunction_=e===null?void 0:d0(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}}function S0(i){if(i===void 0)return Kh;if(!i)return null;if(typeof i=="function"||i instanceof gt)return i;if(!Array.isArray(i))return Zh([i]);if(i.length===0)return[];const e=i.length,t=i[0];if(t instanceof gt){const r=new Array(e);for(let s=0;s<e;++s){const o=i[s];if(!(o instanceof gt))throw new Error("Expected a list of style instances");r[s]=o}return r}if("style"in t){const r=new Array(e);for(let s=0;s<e;++s){const o=i[s];if(!("style"in o))throw new Error("Expected a list of rules with a style property");r[s]=o}return p0(r)}return Zh(i)}class rd extends Gt{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}}class I0 extends vr{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){J()}calculateMatrices2D(e){const t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;qt(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),Jc(r,n)}forEachFeatureAtCoordinate(e,t,n,r,s,o,a,l){let u;const c=t.viewState;function h(x,w,C,b){return s.call(o,w,x?C:null,b)}const d=c.projection,f=Pa(e.slice(),d),g=[[0,0]];if(d.canWrapX()&&r){const x=d.getExtent(),w=pe(x);g.push([-w,0],[w,0])}const m=t.layerStatesArray,p=m.length,y=[],_=[];for(let x=0;x<g.length;x++)for(let w=p-1;w>=0;--w){const C=m[w],b=C.layer;if(b.hasRenderer()&&El(C,c)&&a.call(l,b)){const v=b.getRenderer(),R=b.getSource();if(v&&R){const A=R.getWrapX()?f:e,F=h.bind(null,C.managed);_[0]=A[0]+g[x][0],_[1]=A[1]+g[x][1],u=v.forEachFeatureAtCoordinate(_,t,n,F,y)}if(u)return u}}if(y.length===0)return;const E=1/y.length;return y.forEach((x,w)=>x.distanceSq+=w*E),y.sort((x,w)=>x.distanceSq-w.distanceSq),y.some(x=>u=x.callback(x.feature,x.layer,x.geometry)),u}hasFeatureAtCoordinate(e,t,n,r,s,o){return this.forEachFeatureAtCoordinate(e,t,n,r,Cr,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){J()}scheduleExpireIconCache(e){Ot.canExpireCache()&&e.postRenderFunctions.push(M0)}}function M0(i,e){Ot.expire()}class A0 extends I0{constructor(e){super(e),this.fontChangeListenerKey_=fe(gi,Ai.PROPERTYCHANGE,e.redrawText,e),this.element_=at?Eh():document.createElement("div");const t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=no+" ol-layers";const n=e.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){const n=this.getMap();if(n.hasListener(e)){const r=new rd(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){Me(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(Ft.PRECOMPOSE,e);const t=e.layerStatesArray.sort((u,c)=>u.zIndex-c.zIndex);t.some(u=>u.layer instanceof Xl&&u.layer.getDeclutter())&&(e.declutter={});const r=e.viewState;this.children_.length=0;const s=[];let o=null;for(let u=0,c=t.length;u<c;++u){const h=t[u];e.layerIndex=u;const d=h.layer,f=d.getSourceState();if(!El(h,r)||f!="ready"&&f!="undefined"){d.unrender();continue}const g=d.render(e,o);g&&(g!==o&&(this.children_.push(g),o=g),s.push(h))}this.declutter(e,s),zm(this.element_,this.children_);const l=this.getMap().getTargetElement();if(Nn(l)){const u=l.getContext("2d");for(const c of this.children_){const h=c.firstElementChild||c,d=c.style.backgroundColor;if(d&&(!Nn(h)||h.width>0)&&(u.fillStyle=d,u.fillRect(0,0,l.width,l.height)),Nn(h)&&h.width>0){u.save();const f=c.style.opacity||h.style.opacity;u.globalAlpha=f===""?1:Number(f);const g=h.style.transform;if(g)u.transform(...Ka(g));else{const m=parseFloat(h.style.width)/h.width,p=parseFloat(h.style.height)/h.height;u.transform(m,0,0,p,0,0)}u.drawImage(h,0,0),u.restore()}}}this.dispatchRenderEvent(Ft.POSTCOMPOSE,e),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(e)}declutter(e,t){if(e.declutter){for(let n=t.length-1;n>=0;--n){const r=t[n],s=r.layer;s.getDeclutter()&&s.renderDeclutter(e,r)}t.forEach(n=>n.layer.renderDeferred(e))}}}function sd(i){if(i instanceof Vi){i.setMapInternal(null);return}i instanceof jn&&i.getLayers().forEach(sd)}function od(i,e){if(i instanceof Vi){i.setMapInternal(e);return}if(i instanceof jn){const t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)od(t[n],e)}}let rs=class extends Zt{constructor(e){super(),e=e||{},this.on,this.once,this.un;const t=P0(e);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=e.maxTilesLoading!==void 0?e.maxTilesLoading:16,this.pixelRatio_=e.pixelRatio!==void 0?e.pixelRatio:cp,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=vt(),this.pixelToCoordinateTransform_=vt(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,at||(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_=e.moveTolerance,this.keyboardEventTarget_=t.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,at||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(at?new At:Wm()),this.interactions=t.interactions||(at?new At:hy({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new wc(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(lt.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(lt.VIEW,this.handleViewChanged_),this.addChangeListener(lt.SIZE,this.handleSizeChanged_),this.addChangeListener(lt.TARGET,this.handleTargetChanged_),this.setProperties(t.values);const n=this;e.view&&!(e.view instanceof Wt)&&e.view.then(function(r){n.setView(new Wt(r))}),this.controls.addEventListener(wt.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(wt.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(wt.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(wt.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(wt.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(wt.REMOVE,r=>{const 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(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){od(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){const t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,n){if(!this.frameState_||!this.renderer_)return;const r=this.getCoordinateFromPixelInternal(e);n=n!==void 0?n:{};const s=n.hitTolerance!==void 0?n.hitTolerance:0,o=n.layerFilter!==void 0?n.layerFilter:Cr,a=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,s,a,t,null,o,null)}getFeaturesAtPixel(e,t){const n=[];return this.forEachFeatureAtPixel(e,function(r){n.push(r)},t),n}getAllLayers(){const e=[];function t(n){n.forEach(function(r){r instanceof jn?t(r.getLayers()):e.push(r)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;const n=this.getCoordinateFromPixelInternal(e);t=t!==void 0?t:{};const r=t.layerFilter!==void 0?t.layerFilter:Cr,s=t.hitTolerance!==void 0?t.hitTolerance:0,o=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,s,o,r,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){const n=this.viewport_.getBoundingClientRect(),r=this.getSize(),s=n.width/r[0],o=n.height/r[1],a="changedTouches"in e?e.changedTouches[0]:e;return[(a.clientX-n.left)/s,(a.clientY-n.top)/o]}getTarget(){return this.get(lt.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return Va(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){const t=this.frameState_;return t?qe(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){const t=this.overlayIdIndex_[e.toString()];return t!==void 0?t:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(lt.LAYERGROUP)}setLayers(e){const t=this.getLayerGroup();if(e instanceof At){t.setLayers(e);return}const n=t.getLayers();n.clear(),n.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const e=this.getLayerGroup().getLayerStatesArray();for(let t=0,n=e.length;t<n;++t){const r=e[t];if(!r.visible)continue;const s=r.layer.getRenderer();if(s&&!s.ready)return!0;const o=r.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(e){const t=cn(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){const t=this.frameState_;return t?qe(t.coordinateToPixelTransform,e.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(e){this.pixelRatio_!==e&&(this.pixelRatio_=e,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(lt.SIZE)}getView(){return this.get(lt.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const e=this.getTargetElement();return e?e.ownerDocument:document}getTilePriority(e,t,n,r){return gp(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;const n=new Mn(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;const t=e.originalEvent,n=t.type;if(n===va.POINTERDOWN||n===$.WHEEL||n===$.KEYDOWN){const r=this.getOwnerDocument(),s=this.viewport_.getRootNode?this.viewport_.getRootNode():r,o=t.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(e.frameState=this.frameState_,this.dispatchEvent(e)!==!1){const r=this.getInteractions().getArray().slice();for(let s=r.length-1;s>=0;s--){const o=r[s];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(e)||e.propagationStopped)break}}}handlePostRender(){const e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let r=this.maxTilesLoading_,s=r;const o=e?e.viewHints:void 0,a=o?o[Oe.ANIMATING]||o[Oe.INTERACTING]:!1;if(a){const l=Date.now()-e.time>8;r=l?0:8,s=l?0:2}t.getTilesLoading()<r&&(a&&t.reprioritize(),t.loadMoreTiles(r,s))}e&&this.renderer_&&!e.animate&&(this.renderComplete_?(this.hasListener(Ft.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Ft.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Li(An.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Li(An.LOADSTART,this,e))));const n=this.postRenderFunctions_;if(e)for(let r=0,s=n.length;r<s;++r)n[r](this,e);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let n=0,r=this.targetChangeHandlerKeys_.length;n<r;++n)Me(this.targetChangeHandlerKeys_[n]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener($.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener($.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Nn(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);const n=this.targetElement_.getRootNode();n instanceof ShadowRoot&&this.resizeObserver_.unobserve(n.host),this.setSize(void 0)}const e=this.getTarget(),t=typeof e=="string"?document.getElementById(e):e;if(this.targetElement_=t,!t)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);else{if(Nn(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new A0(this)),!Nn(t)){this.mapBrowserEventHandler_=new dp(this,this.moveTolerance_);for(const r in Ve)this.mapBrowserEventHandler_.addEventListener(Ve[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener($.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener($.WHEEL,this.boundHandleBrowserEvent_,xc?{passive:!1}:!1);let n;if(this.keyboardEventTarget_)n=this.keyboardEventTarget_;else{const r=t.getRootNode();n=r instanceof ShadowRoot?r.host:t}if(this.targetChangeHandlerKeys_=[fe(n,$.KEYDOWN,this.handleBrowserEvent,this),fe(n,$.KEYPRESS,this.handleBrowserEvent,this)],t instanceof HTMLElement){const r=t.getRootNode();r instanceof ShadowRoot&&this.resizeObserver_.observe(r.host),this.resizeObserver_?.observe(t)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(Me(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(Me(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=fe(e,Ai.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=fe(e,$.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(Me),this.layerGroupPropertyListenerKeys_=null);const e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Gn("addlayer",e)),this.layerGroupPropertyListenerKeys_=[fe(e,Ai.PROPERTYCHANGE,this.render,this),fe(e,$.CHANGE,this.render,this),fe(e,"addlayer",this.handleLayerAdd_,this),fe(e,"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;const e=this.frameState_.layerStatesArray;for(let t=0,n=e.length;t<n;++t){const r=e[t].layer;r.hasRenderer()&&r.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){sd(e.layer)}removeOverlay(e){return this.getOverlays().remove(e)}renderFrame_(e){const t=this.getSize(),n=this.getView(),r=this.frameState_;let s=null;if(t!==void 0&&Fh(t)&&n&&n.isDef()){const o=n.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=n.getState();if(s={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:js(a.center,a.resolution,a.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:te(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=js(a.nextCenter,a.nextResolution,l,t)}}this.frameState_=s,this.renderer_.renderFrame(s),s&&(s.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,s.postRenderFunctions),r&&(!this.previousExtent_||!Fn(this.previousExtent_)&&!ln(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Li(An.MOVESTART,this,r)),this.previousExtent_=Oi(this.previousExtent_)),this.previousExtent_&&!s.viewHints[Oe.ANIMATING]&&!s.viewHints[Oe.INTERACTING]&&!ln(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Li(An.MOVEEND,this,s)),Cc(s.extent,this.previousExtent_))),this.dispatchEvent(new Li(An.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(An.LOADSTART)||this.hasListener(An.LOADEND)||this.hasListener(Ft.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(e){const t=this.getLayerGroup();t&&this.handleLayerRemove_(new Gn("removelayer",t)),this.set(lt.LAYERGROUP,e)}setSize(e){this.set(lt.SIZE,e)}setTarget(e){this.set(lt.TARGET,e)}setView(e){if(!e||e instanceof Wt){this.set(lt.VIEW,e);return}this.set(lt.VIEW,new Wt);const t=this;e.then(function(n){t.setView(new Wt(n))})}updateSize(){const e=this.getTargetElement();let t;if(e){let r,s;if(Nn(e)){const o=e.getContext("2d").getTransform();r=e.width/o.a,s=e.height/o.d}else{const o=getComputedStyle(e);r=e.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),s=e.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(r)&&!isNaN(s)&&(t=[Math.max(0,r),Math.max(0,s)],!Fh(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&kc("No map visible because the map container's width or height are 0."))}const n=this.getSize();t&&(!n||!In(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){const t=this.getView();t&&t.setViewportSize(e)}};function P0(i){let e=null;i.keyboardEventTarget!==void 0&&(e=typeof i.keyboardEventTarget=="string"?document.getElementById(i.keyboardEventTarget):i.keyboardEventTarget);const t={},n=i.layers&&typeof i.layers.getLayers=="function"?i.layers:new jn({layers:i.layers});t[lt.LAYERGROUP]=n,t[lt.TARGET]=i.target,t[lt.VIEW]=i.view instanceof Wt?i.view:new Wt;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new At(i.controls.slice()):(xe(typeof i.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),r=i.controls));let s;i.interactions!==void 0&&(Array.isArray(i.interactions)?s=new At(i.interactions.slice()):(xe(typeof i.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),s=i.interactions));let o;return i.overlays!==void 0?Array.isArray(i.overlays)?o=new At(i.overlays.slice()):(xe(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=i.overlays):o=new At,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}class ss extends Rr{constructor(e,t,n){super(),n=n||{},this.tileCoord=e,this.state=t,this.key="",this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent($.CHANGE)}release(){this.setState(G.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==G.EMPTY){if(this.state!==G.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}}load(){J()}getAlpha(e,t){if(!this.transition_)return 1;let n=this.transitionStarts_[e];if(!n)n=t,this.transitionStarts_[e]=n;else if(n===-1)return 1;const r=t-n+1e3/60;return r>=this.transition_?1:Fc(r/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}disposeInternal(){this.release(),super.disposeInternal()}}function Wl(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}const L0=new Error("disposed"),F0=[256,256];class ad extends ss{constructor(e){const t=G.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;const e=Wl(this.data_);return e?[e.width,e.height]:F0}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==G.IDLE&&this.state!==G.ERROR)return;this.state=G.LOADING,this.changed();const e=this;this.loader_().then(function(t){e.data_=t,e.state=G.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=G.ERROR,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(L0),this.controller_=null),super.disposeInternal()}}class ld extends ss{constructor(e,t,n,r,s,o){super(e,t,o),this.crossOrigin_=r?.crossOrigin,this.referrerPolicy_=r?.referrerPolicy,this.src_=n,this.key=n,this.image_,at?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(e){this.image_=e,this.state=G.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=G.ERROR,this.unlistenImage_(),this.image_=O0(),this.changed()}handleImageLoad_(){if(at)this.state=G.LOADED;else{const e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=G.LOADED:this.state=G.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==G.ERROR&&(this.state=G.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==G.IDLE&&(this.state=G.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Qy(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 O0(){const i=De(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}class Vl{constructor(e,t,n,r){this.minX=e,this.maxX=t,this.minY=n,this.maxY=r}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minX<this.minX&&(this.minX=e.minX),e.maxX>this.maxX&&(this.maxX=e.maxX),e.minY<this.minY&&(this.minY=e.minY),e.maxY>this.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}}function Hi(i,e,t,n,r){return r!==void 0?(r.minX=i,r.maxX=e,r.minY=t,r.maxY=n,r):new Vl(i,e,t,n)}let Ul;const Ji=[];function ud(i,e,t,n,r){i.beginPath(),i.moveTo(0,0),i.lineTo(e,t),i.lineTo(n,r),i.closePath(),i.save(),i.clip(),i.fillRect(0,0,Math.max(e,n)+1,Math.max(t,r)),i.restore()}function Yl(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-191.25)>2}function k0(){if(Ul===void 0){const i=De(6,6,Ji);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",ud(i,4,5,4,0),ud(i,4,5,0,5);const e=i.getImageData(0,0,3,3).data;Ul=Yl(e,0)||Yl(e,4)||Yl(e,8),kr(i),Ji.push(i.canvas)}return Ul}function Bl(i,e,t,n){const r=Ar(t,e,i);let s=Ga(e,n,t);const o=e.getMetersPerUnit();o!==void 0&&(s*=o);const a=i.getMetersPerUnit();a!==void 0&&(s/=a);const l=i.getExtent();if(!l||ti(l,r)){const u=Ga(i,s,r)/s;isFinite(u)&&u>0&&(s/=u)}return s}function D0(i,e,t,n){const r=Et(t);let s=Bl(i,e,r,n);return(!isFinite(s)||s<=0)&&Tc(t,function(o){return s=Bl(i,e,o,n),isFinite(s)&&s>0}),s}function cd(i,e,t,n,r,s,o,a,l,u,c,h,d,f){const g=De(Math.round(t*i),Math.round(t*e),Ji);if(h||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(t,t);function m(w){return Math.round(w*t)/t}g.globalCompositeOperation="lighter";const p=St();l.forEach(function(w,C,b){bc(p,w.extent)});let y;const _=t/n,E=(h?1:1+Math.pow(2,-24))/_;if(!d||l.length!==1||u!==0){if(y=De(Math.round(pe(p)*_),Math.round(Ke(p)*_),Ji),h||(y.imageSmoothingEnabled=!1),r&&f){const w=(r[0]-p[0])*_,C=-(r[3]-p[3])*_,b=pe(r)*_,v=Ke(r)*_;y.rect(w,C,b,v),y.clip()}l.forEach(function(w,C,b){if(w.image.width>0&&w.image.height>0){if(w.clipExtent){y.save();const O=(w.clipExtent[0]-p[0])*_,I=-(w.clipExtent[3]-p[3])*_,S=pe(w.clipExtent)*_,U=Ke(w.clipExtent)*_;y.rect(h?O:Math.round(O),h?I:Math.round(I),h?S:Math.round(O+S)-Math.round(O),h?U:Math.round(I+U)-Math.round(I)),y.clip()}const v=(w.extent[0]-p[0])*_,R=-(w.extent[3]-p[3])*_,A=pe(w.extent)*_,F=Ke(w.extent)*_;y.drawImage(w.image,u,u,w.image.width-2*u,w.image.height-2*u,h?v:Math.round(v),h?R:Math.round(R),h?A:Math.round(v+A)-Math.round(v),h?F:Math.round(R+F)-Math.round(R)),w.clipExtent&&y.restore()}})}const x=un(o);return a.getTriangles().forEach(function(w,C,b){const v=w.source,R=w.target;let A=v[0][0],F=v[0][1],O=v[1][0],I=v[1][1],S=v[2][0],U=v[2][1];const k=m((R[0][0]-x[0])/s),N=m(-(R[0][1]-x[1])/s),D=m((R[1][0]-x[0])/s),T=m(-(R[1][1]-x[1])/s),V=m((R[2][0]-x[0])/s),Z=m(-(R[2][1]-x[1])/s),ce=A,Ae=F;A=0,F=0,O-=ce,I-=Ae,S-=ce,U-=Ae;const L=[[O,I,0,0,D-k],[S,U,0,0,V-k],[0,0,O,I,T-N],[0,0,S,U,Z-N]],le=mp(L);if(!le)return;if(g.save(),g.beginPath(),k0()||!h){g.moveTo(D,T);const Re=4,Te=k-D,W=N-T;for(let P=0;P<Re;P++)g.lineTo(D+m((P+1)*Te/Re),T+m(P*W/(Re-1))),P!=Re-1&&g.lineTo(D+m((P+1)*Te/Re),T+m((P+1)*W/(Re-1)));g.lineTo(V,Z)}else g.moveTo(D,T),g.lineTo(k,N),g.lineTo(V,Z);g.clip(),g.transform(le[0],le[2],le[1],le[3],k,N),g.translate(p[0]-ce,p[3]-Ae);let H;if(y)H=y.canvas,g.scale(E,-E);else{const Re=l[0],Te=Re.extent;H=Re.image,g.scale(pe(Te)/H.width,-Ke(Te)/H.height)}g.drawImage(H,0,0),g.restore()}),y&&(kr(y),Ji.push(y.canvas)),c&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEach(function(w,C,b){const v=w.target,R=(v[0][0]-x[0])/s,A=-(v[0][1]-x[1])/s,F=(v[1][0]-x[0])/s,O=-(v[1][1]-x[1])/s,I=(v[2][0]-x[0])/s,S=-(v[2][1]-x[1])/s;g.beginPath(),g.moveTo(F,O),g.lineTo(R,A),g.lineTo(I,S),g.closePath(),g.stroke()}),g.restore()),g.canvas}const N0=10,hd=.25;class dd{constructor(e,t,n,r,s,o,a){this.sourceProj_=e,this.targetProj_=t;let l={};const u=a?nm(E=>qe(a,Ar(E,this.targetProj_,this.sourceProj_))):ri(this.targetProj_,this.sourceProj_);this.transformInv_=function(E){const x=E[0]+"/"+E[1];return l[x]||(l[x]=u(E)),l[x]},this.maxSourceExtent_=r,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&pe(r)>=pe(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?pe(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?pe(this.targetProj_.getExtent()):null;const c=un(n),h=Xs(n),d=Gs(n),f=zs(n),g=this.transformInv_(c),m=this.transformInv_(h),p=this.transformInv_(d),y=this.transformInv_(f),_=N0+(o?Math.max(0,Math.ceil(Math.log2(Ma(n)/(o*o*256*256)))):0);if(this.addQuad_(c,h,d,f,g,m,p,y,_),this.wrapsXInSource_){let E=1/0;this.triangles_.forEach(function(x,w,C){E=Math.min(E,x.source[0][0],x.source[1][0],x.source[2][0])}),this.triangles_.forEach(x=>{if(Math.max(x.source[0][0],x.source[1][0],x.source[2][0])-E>this.sourceWorldWidth_/2){const w=[[x.source[0][0],x.source[0][1]],[x.source[1][0],x.source[1][1]],[x.source[2][0],x.source[2][1]]];w[0][0]-E>this.sourceWorldWidth_/2&&(w[0][0]-=this.sourceWorldWidth_),w[1][0]-E>this.sourceWorldWidth_/2&&(w[1][0]-=this.sourceWorldWidth_),w[2][0]-E>this.sourceWorldWidth_/2&&(w[2][0]-=this.sourceWorldWidth_);const C=Math.min(w[0][0],w[1][0],w[2][0]);Math.max(w[0][0],w[1][0],w[2][0])-C<this.sourceWorldWidth_/2&&(x.source=w)}})}l={}}addTriangle_(e,t,n,r,s,o){this.triangles_.push({source:[r,s,o],target:[e,t,n]})}addQuad_(e,t,n,r,s,o,a,l,u){const c=ba([s,o,a,l]),h=this.sourceWorldWidth_?pe(c)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&h>.5&&h<1;let g=!1;if(u>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const p=ba([e,t,n,r]);g=pe(p)/this.targetWorldWidth_>hd||g}!f&&this.sourceProj_.isGlobal()&&h&&(g=h>hd||g)}if(!g&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!Ue(c,this.maxSourceExtent_))return;let m=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(u>0)g=!0;else if(m=(!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),m!=1&&m!=2&&m!=4&&m!=8)return}if(u>0){if(!g){const p=[(e[0]+n[0])/2,(e[1]+n[1])/2],y=this.transformInv_(p);let _;f?_=(Fi(s[0],d)+Fi(a[0],d))/2-Fi(y[0],d):_=(s[0]+a[0])/2-y[0];const E=(s[1]+a[1])/2-y[1];g=_*_+E*E>this.errorThresholdSquared_}if(g){if(Math.abs(e[0]-n[0])<=Math.abs(e[1]-n[1])){const p=[(t[0]+n[0])/2,(t[1]+n[1])/2],y=this.transformInv_(p),_=[(r[0]+e[0])/2,(r[1]+e[1])/2],E=this.transformInv_(_);this.addQuad_(e,t,p,_,s,o,y,E,u-1),this.addQuad_(_,p,n,r,E,y,a,l,u-1)}else{const p=[(e[0]+t[0])/2,(e[1]+t[1])/2],y=this.transformInv_(p),_=[(n[0]+r[0])/2,(n[1]+r[1])/2],E=this.transformInv_(_);this.addQuad_(e,p,_,r,s,y,E,l,u-1),this.addQuad_(p,t,n,_,y,o,a,E,u-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(m&11)==0&&this.addTriangle_(e,n,r,s,a,l),(m&14)==0&&this.addTriangle_(e,n,t,s,a,o),m&&((m&13)==0&&this.addTriangle_(t,r,e,o,l,s),(m&7)==0&&this.addTriangle_(t,r,n,o,l,a))}calculateSourceExtent(){const e=St();return this.triangles_.forEach(function(t,n,r){const s=t.source;Sr(e,s[0]),Sr(e,s[1]),Sr(e,s[2])}),e}getTriangles(){return this.triangles_}}const fd=.5;class gd extends ss{constructor(e,t,n,r,s,o,a,l,u,c,h,d){super(s,G.IDLE,d),this.renderEdges_=h!==void 0?h:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=r,this.wrappedTileCoord_=o||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()?e.getExtent():void 0;const f=r.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let m=this.sourceTileGrid_.getExtent();const p=g?Xt(f,g):f;if(Ma(p)===0){this.state=G.EMPTY;return}const y=e.getExtent();y&&(m?m=Xt(m,y):m=y);const _=r.getResolution(this.wrappedTileCoord_[0]),E=D0(e,n,p,_);if(!isFinite(E)||E<=0){this.state=G.EMPTY;return}const x=c!==void 0?c:fd;if(this.triangulation_=new dd(e,n,p,m,E*x,_),this.triangulation_.getTriangles().length===0){this.state=G.EMPTY;return}this.sourceZ_=t.getZForResolution(E);let w=this.triangulation_.calculateSourceExtent();if(m&&(e.canWrapX()?(w[1]=ke(w[1],m[1],m[3]),w[3]=ke(w[3],m[1],m[3])):w=Xt(w,m)),!Ma(w))this.state=G.EMPTY;else{let C=0,b=0;e.canWrapX()&&(C=pe(y),b=Math.floor((w[0]-y[0])/C)),Ac(w.slice(),e,!0).forEach(R=>{const A=t.getTileRangeForExtentAndZ(R,this.sourceZ_);for(let F=A.minX;F<=A.maxX;F++)for(let O=A.minY;O<=A.maxY;O++){const I=b*C;this.sourceTiles_.push({getTile:()=>u(this.sourceZ_,F,O,a),offset:I})}++b}),this.sourceTiles_.length===0&&(this.state=G.EMPTY)}}getImage(){return this.canvas_}reproject_(){const e=[];if(this.sourceTiles_.forEach(t=>{const n=t.tile;if(n&&n.getState()==G.LOADED){const r=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);r[0]+=t.offset,r[2]+=t.offset;const s=this.clipExtent_?.slice();s&&(s[0]+=t.offset,s[2]+=t.offset),e.push({extent:r,clipExtent:s,image:n.getImage()})}}),this.sourceTiles_.length=0,e.length===0)this.state=G.ERROR;else{const t=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(t),r=typeof n=="number"?n:n[0],s=typeof n=="number"?n:n[1],o=this.targetTileGrid_.getResolution(t),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=cd(r,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=G.LOADED}this.changed()}load(){for(const e of this.sourceTiles_)e.tile=e.getTile();if(this.state==G.IDLE){this.state=G.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{const n=t.getState();if(n==G.IDLE||n==G.LOADING){e++;const r=fe(t,$.CHANGE,s=>{const o=t.getState();(o==G.LOADED||o==G.ERROR||o==G.EMPTY)&&(Me(r),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(r)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t},n,r){t.getState()==G.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(Me),this.sourcesListenerKeys_=null}release(){this.canvas_&&(kr(this.canvas_.getContext("2d")),Ji.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}}class pd{constructor(e){this.highWaterMark=e!==void 0?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const e=this.pop();e instanceof vr&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){const n=this.entries_[e];return xe(n!==void 0,"Tried to get a value for a key that does not exist in the cache"),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(e){const t=this.entries_[e];return xe(t!==void 0,"Tried to get a value for a key that does not exist in the cache"),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){const e=new Array(this.count_);let t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){const e=new Array(this.count_);let t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){return this.entries_[e]?.value_}pop(){const e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){xe(!(e in this.entries_),"Tried to set a value for a key that is used already");const n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}}function yo(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function z0(i,e,t){return i+"/"+e+"/"+t}function _o(i,e,t,n,r){return`${te(i)},${e},${z0(t,n,r)}`}function G0(i){return j0(i[0],i[1],i[2])}function j0(i,e,t){return(e<<i)+t}function X0(i,e){const t=i[0],n=i[1],r=i[2];if(e.getMinZoom()>t||t>e.getMaxZoom())return!1;const s=e.getFullTileRange(t);return s?s.containsXY(n,r):!0}class Kl{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(io(),{get:(e,t)=>{if(typeof io()[t]=="function")return this.push_(t),this.pushMethodArgs_},set:(e,t,n)=>(this.push_(t,n),!0)})}push_(...e){const t=this.instructions_,n=this.zIndex+this.offset_;t[n]||(t[n]=[]),t[n].push(...e)}pushMethodArgs_=(...e)=>(this.push_(e),this);pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let n=0,r=t.length;n<r;++n){const s=t[n];if(typeof s=="function"){s(e);continue}const o=t[++n];if(typeof e[s]=="function")e[s](...o);else{if(typeof o=="function"){e[s]=o(e);continue}e[s]=o}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}}const W0=5;class V0 extends Tr{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=W0}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(e){return J()}getData(e){return null}prepareFrame(e){return J()}renderFrame(e,t){return J()}forEachFeatureAtCoordinate(e,t,n,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){const t=e.target;(t.getState()===X.LOADED||t.getState()===X.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=X.LOADED&&t!=X.ERROR&&e.addEventListener($.CHANGE,this.boundHandleImageChange_),t==X.IDLE&&(e.load(),t=e.getState()),t==X.LOADED}renderIfReadyAndVisible(){const e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const md=[];let Qi=null;function U0(){Qi=De(1,1,void 0,{willReadFrequently:!0})}class $l extends V0{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=vt(),this.pixelTransform=vt(),this.inversePixelTransform=vt(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){Qi||U0(),Qi.clearRect(0,0,1,1);let r;try{Qi.drawImage(e,t,n,1,1,0,0,1,1),r=Qi.getImageData(0,0,1,1).data}catch{return Qi=null,null}return r}getBackground(e){let n=this.getLayer().getBackground();return typeof n=="function"&&(n=n(e.viewState.resolution)),n||void 0}useContainer(e,t,n){const r=this.getLayer().getClassName();let s,o;if(e&&e.className===r&&(!n||e&&e.style.backgroundColor&&In(ci(e.style.backgroundColor),ci(n)))){const a=e.firstElementChild;Nn(a)&&(o=a.getContext("2d"))}if(o&&dm(o.canvas.style.transform,t)?(this.container=e,this.context=o,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){s=at?Eh():document.createElement("div"),s.className=r;let a=s.style;a.position="absolute",a.width="100%",a.height="100%",o=De();const l=o.canvas;s.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=s,this.context=o}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){const r=un(n),s=Xs(n),o=Gs(n),a=zs(n);qe(t.coordinateToPixelTransform,r),qe(t.coordinateToPixelTransform,s),qe(t.coordinateToPixelTransform,o),qe(t.coordinateToPixelTransform,a);const l=this.inversePixelTransform;qe(l,r),qe(l,s),qe(l,o),qe(l,a),e.save(),e.beginPath(),e.moveTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(s[0]),Math.round(s[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.clip()}prepareContainer(e,t){const n=e.extent,r=e.viewState.resolution,s=e.viewState.rotation,o=e.pixelRatio,a=Math.round(pe(n)/r*o),l=Math.round(Ke(n)/r*o);qt(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),Jc(this.inversePixelTransform,this.pixelTransform);const u=hm(this.pixelTransform);if(this.useContainer(t,u,this.getBackground(e)),!this.containerReused){const c=this.context.canvas;c.width!=a||c.height!=l?(c.width=a,c.height=l):this.context.clearRect(0,0,a,l),u!==c.style.transform&&(c.style.transform=u)}}dispatchRenderEvent_(e,t,n){const r=this.getLayer();if(r.hasListener(e)){const s=new rd(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(Ft.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(Ft.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new Kl),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(Ft.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(Ft.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,r,s,o,a){const l=s/2,u=o/2,c=r/t,h=-c,d=-e[0]+a,f=-e[1];return qt(this.tempTransform,l,u,c,h,-n,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}function Zl(i,e,t){if(!(t in i))return i[t]=new Set([e]),!0;const n=i[t],r=n.has(e);return r||n.add(e),!r}function Y0(i,e,t){const n=i[t];return n?n.delete(e):!1}function yd(i,e){const t=i.layerStatesArray[i.layerIndex];t.extent&&(e=Xt(e,hn(t.extent,i.viewState.projection)));const n=t.layer.getRenderSource();if(!n.getWrapX()){const r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=Xt(e,r))}return e}class _d extends $l{constructor(e,t){super(e),t=t||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=St(),this.tempTileRange_=new Vl(0,0,0,0),this.tempTileCoord_=yo(0,0,0);const n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new pd(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new pd(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){const s=this.tileCache_,a=this.getLayer().getSource(),l=_o(a,a.getKey(),e,t,n);let u;if(s.containsKey(l))u=s.get(l);else{const c=r.viewState.projection,h=a.getProjection();if(u=a.getTile(e,t,n,r.pixelRatio,c,!h||ut(h,c)?void 0:this.getSourceTileCache()),!u)return null;s.set(l,u)}return u}getTile(e,t,n,r){const s=this.getOrCreateTile(e,t,n,r);return s||null}getData(e){const t=this.frameState;if(!t)return null;const n=this.getLayer(),r=qe(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!ti(s,r))return null;const o=t.viewState,a=n.getRenderSource(),l=a.getTileGridForProjection(o.projection),u=a.getTilePixelRatio(t.pixelRatio);for(let c=l.getZForResolution(o.resolution);c>=l.getMinZoom();--c){const h=l.getTileCoordForCoordAndZ(r,c),d=this.getTile(c,h[1],h[2],t);if(!d||d.getState()!==G.LOADED)continue;const f=l.getOrigin(c),g=ct(l.getTileSize(c)),m=l.getResolution(c);let p;if(d instanceof ld||d instanceof gd)p=d.getImage();else if(d instanceof ad){if(p=Wl(d.getData()),!p)continue}else continue;const y=Math.floor(u*((r[0]-f[0])/m-h[1]*g[0])),_=Math.floor(u*((f[1]-r[1])/m-h[2]*g[1])),E=Math.round(u*a.getGutterForProjection(o.projection));return this.getImageData(p,y+E,_+E)}return null}prepareFrame(e){this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;const t=this.getLayer().getSource();if(!t)return!1;const n=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===t.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(e,t,n,r,s){const o=e.viewState,a=this.getLayer(),l=a.getRenderSource(),u=l.getTileGridForProjection(o.projection),c=te(l);c in e.wantedTiles||(e.wantedTiles[c]={});const h=e.wantedTiles[c],d=a.getMapInternal(),f=Math.max(n-s,u.getMinZoom(),u.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):u.getResolution(0)),l.zDirection)),g=o.rotation,m=g?Sc(o.center,o.resolution,g,e.size):void 0;for(let p=n;p>=f;--p){const y=u.getTileRangeForExtentAndZ(t,p,this.tempTileRange_),_=u.getResolution(p);for(let E=y.minX;E<=y.maxX;++E)for(let x=y.minY;x<=y.maxY;++x){if(g&&!u.tileCoordIntersectsViewport([p,E,x],m))continue;const w=this.getTile(p,E,x,e);if(!w||!Zl(r,w,p))continue;const b=w.getKey();if(h[b]=!0,w.getState()===G.IDLE&&!e.tileQueue.isKeyQueued(b)){const v=yo(p,E,x,this.tempTileCoord_);e.tileQueue.enqueue([w,c,u.getTileCoordCenter(v),_])}}}}findStaleTile_(e,t){const n=this.tileCache_,r=e[0],s=e[1],o=e[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){const u=_o(this.getLayer().getSource(),a[l],r,s,o);if(n.containsKey(u)){const c=n.peek(u);if(c.getState()===G.LOADED)return c.endTransition(te(this)),Zl(t,c,r),!0}}return!1}findAltTiles_(e,t,n,r){const s=e.getTileRangeForTileCoordAndZ(t,n,this.tempTileRange_);if(!s)return!1;let o=!0;const a=this.tileCache_,l=this.getLayer().getRenderSource(),u=l.getKey();for(let c=s.minX;c<=s.maxX;++c)for(let h=s.minY;h<=s.maxY;++h){const d=_o(l,u,n,c,h);let f=!1;if(a.containsKey(d)){const g=a.peek(d);g.getState()===G.LOADED&&(Zl(r,g,n),f=!0)}f||(o=!1)}return o}renderFrame(e,t){this.renderComplete=!0;const n=e.layerStatesArray[e.layerIndex],r=e.viewState,s=r.projection,o=r.resolution,a=r.center,l=e.pixelRatio,u=this.getLayer(),c=u.getSource(),h=c.getTileGridForProjection(s),d=h.getZForResolution(o,c.zDirection),f=h.getResolution(d),g=c.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==g&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=g):this.renderedSourceKey_=g;let m=e.extent;const p=c.getTilePixelRatio(l);this.prepareContainer(e,t);const y=this.context.canvas.width,_=this.context.canvas.height;this.layerExtent=n.extent?hn(n.extent,s):null,this.layerExtent&&(m=Xt(m,this.layerExtent));const E=f*y/2/p,x=f*_/2/p,w=[a[0]-E,a[1]-x,a[0]+E,a[1]+x],C={};this.renderedTiles.length=0;const b=u.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){const N=h.getZForResolution(r.nextResolution,c.zDirection),D=yd(e,e.nextExtent);this.enqueueTiles(e,D,N,C,b)}const v=yd(e,m);if(this.enqueueTiles(e,v,d,C,0),b>0&&setTimeout(()=>{this.enqueueTiles(e,v,d-1,C,b-1)},0),!(d in C))return this.container;const R=te(this),A=e.time;for(const N of C[d]){const D=N.getState();if(D===G.EMPTY)continue;const T=N.tileCoord;if(D===G.LOADED&&N.getAlpha(R,A)===1){N.endTransition(R);continue}if(D!==G.ERROR&&(this.renderComplete=!1),this.findStaleTile_(T,C)){Y0(C,N,d),e.animate=!0;continue}if(this.findAltTiles_(h,T,d+1,C))continue;const ce=h.getMinZoom();for(let Ae=d-1;Ae>=ce&&!this.findAltTiles_(h,T,Ae,C);--Ae);}const F=f/o*l/p,O=this.getRenderContext(e);qt(this.tempTransform,y/2,_/2,F,F,0,-y/2,-_/2),this.layerExtent&&this.clipUnrotated(O,e,this.layerExtent),c.getInterpolate()||(O.imageSmoothingEnabled=!1),this.preRender(O,e);const I=Object.keys(C).map(Number);I.sort(Kt);let S;const U=[],k=[];for(let N=I.length-1;N>=0;--N){const D=I[N],T=c.getTilePixelSize(D,l,s),Z=h.getResolution(D)/f,ce=T[0]*Z*F,Ae=T[1]*Z*F,L=h.getTileCoordForCoordAndZ(un(w),D),le=h.getTileCoordExtent(L),H=qe(this.tempTransform,[p*(le[0]-w[0])/f,p*(w[3]-le[3])/f]),Re=p*c.getGutterForProjection(s);for(const Te of C[D]){if(Te.getState()!==G.LOADED)continue;const W=Te.tileCoord,P=L[1]-W[1],Xe=Math.round(H[0]-(P-1)*ce),Ze=L[2]-W[2],q=Math.round(H[1]-(Ze-1)*Ae),Ee=Math.round(H[0]-P*ce),Ce=Math.round(H[1]-Ze*Ae),ne=Xe-Ee,me=q-Ce,oe=I.length===1;let _e=!1;S=[Ee,Ce,Ee+ne,Ce,Ee+ne,Ce+me,Ee,Ce+me];for(let Se=0,Pe=U.length;Se<Pe;++Se)if(!oe&&D<k[Se]){const Le=U[Se];Ue([Ee,Ce,Ee+ne,Ce+me],[Le[0],Le[3],Le[4],Le[7]])&&(_e||(O.save(),_e=!0),O.beginPath(),O.moveTo(S[0],S[1]),O.lineTo(S[2],S[3]),O.lineTo(S[4],S[5]),O.lineTo(S[6],S[7]),O.moveTo(Le[6],Le[7]),O.lineTo(Le[4],Le[5]),O.lineTo(Le[2],Le[3]),O.lineTo(Le[0],Le[1]),O.clip())}U.push(S),k.push(D),this.drawTile(Te,e,Ee,Ce,ne,me,Re,oe),_e&&O.restore(),this.renderedTiles.unshift(Te),this.updateUsedTiles(e.usedTiles,c,Te)}}if(this.renderedResolution=f,this.extentChanged=!this.renderedExtent_||!ln(this.renderedExtent_,w),this.renderedExtent_=w,this.renderedPixelRatio=l,this.postRender(this.context,e),this.layerExtent&&O.restore(),O.imageSmoothingEnabled=!0,this.renderComplete){const N=(D,T)=>{const V=te(c),Z=T.wantedTiles[V],ce=Z?Object.keys(Z).length:0;this.updateCacheSize(ce),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};e.postRenderFunctions.push(N)}return this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,n,r,s,o,a,l){let u;if(e instanceof ad){if(u=Wl(e.getData()),!u)throw new Error("Rendering array data is not yet supported")}else u=this.getTileImage(e);if(!u)return;const c=this.getRenderContext(t),h=te(this),d=t.layerStatesArray[t.layerIndex],f=d.opacity*(l?e.getAlpha(h,t.time):1),g=f!==c.globalAlpha;g&&(c.save(),c.globalAlpha=f),c.drawImage(u,a,a,u.width-2*a,u.height-2*a,n,r,s,o),g&&c.restore(),f!==d.opacity?t.animate=!0:l&&e.endTransition(h)}getImage(){const e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,n){const r=te(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}}const Wn={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class B0 extends Vi{constructor(e){e=e||{};const t=Object.assign({},e),n=e.cacheSize;delete e.cacheSize,delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n,this.setPreload(e.preload!==void 0?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(Wn.PRELOAD)}setPreload(e){this.set(Wn.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(Wn.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(Wn.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}}class ql extends B0{constructor(e){super(e)}createRenderer(){return new _d(this,{cacheSize:this.getCacheSize()})}}const er=[0,0,0],Vn=5;class xo{constructor(e){this.minZoom=e.minZoom!==void 0?e.minZoom:0,this.resolutions_=e.resolutions,xe(op(this.resolutions_,(r,s)=>s-r),"`resolutions` must be sorted in descending order");let t;if(!e.origins){for(let r=0,s=this.resolutions_.length-1;r<s;++r)if(!t)t=this.resolutions_[r]/this.resolutions_[r+1];else if(this.resolutions_[r]/this.resolutions_[r+1]!==t){t=void 0;break}}this.zoomFactor_=t,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin!==void 0?e.origin:null,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,xe(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const n=e.extent;n!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=un(n)),xe(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,xe(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:ll,xe(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=n!==void 0?n:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.sizes!==void 0?this.fullTileRanges_=e.sizes.map((r,s)=>{const o=new Vl(Math.min(0,r[0]),Math.max(r[0]-1,-1),Math.min(0,r[1]),Math.max(r[1]-1,-1));if(n){const a=this.getTileRangeForExtentAndZ(n,s);o.minX=Math.max(a.minX,o.minX),o.maxX=Math.min(a.maxX,o.maxX),o.minY=Math.max(a.minY,o.minY),o.maxY=Math.min(a.maxY,o.maxY)}return o}):n&&this.calculateTileRanges_(n)}forEachTileCoord(e,t,n){const r=this.getTileRangeForExtentAndZ(e,t);for(let s=r.minX,o=r.maxX;s<=o;++s)for(let a=r.minY,l=r.maxY;a<=l;++a)n([t,s,a])}forEachTileCoordParentTileRange(e,t,n,r){let s,o,a,l=null,u=e[0]-1;for(this.zoomFactor_===2?(o=e[1],a=e[2]):l=this.getTileCoordExtent(e,r);u>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),s=Hi(o,o,a,a,n)):s=this.getTileRangeForExtentAndZ(l,u,n),t(u,s))return!0;--u}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getOrigins(){return this.origins_}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,n){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){const s=e[1]*2,o=e[2]*2;return Hi(s,s+1,o,o+1,t)}const r=this.getTileCoordExtent(e,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(r,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,n){if(t>this.maxZoom||t<this.minZoom)return null;const r=e[0],s=e[1],o=e[2];if(t===r)return Hi(s,o,s,o,n);if(this.zoomFactor_){const l=Math.pow(this.zoomFactor_,t-r),u=Math.floor(s*l),c=Math.floor(o*l);if(t<r)return Hi(u,u,c,c,n);const h=Math.floor(l*(s+1))-1,d=Math.floor(l*(o+1))-1;return Hi(u,h,c,d,n)}const a=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,t,n)}getTileRangeForExtentAndZ(e,t,n){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,er);const r=er[1],s=er[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,er);const o=er[1],a=er[2];return Hi(r,o,s,a,n)}getTileCoordCenter(e){const t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=ct(this.getTileSize(e[0]),this.tmpSize_);return[t[0]+(e[1]+.5)*r[0]*n,t[1]-(e[2]+.5)*r[1]*n]}getTileCoordExtent(e,t){const n=this.getOrigin(e[0]),r=this.getResolution(e[0]),s=ct(this.getTileSize(e[0]),this.tmpSize_),o=n[0]+e[1]*s[0]*r,a=n[1]-(e[2]+1)*s[1]*r,l=o+s[0]*r,u=a+s[1]*r;return an(o,a,l,u,t)}getTileCoordForCoordAndResolution(e,t,n){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,n)}getTileCoordForXYAndResolution_(e,t,n,r,s){const o=this.getZForResolution(n),a=n/this.getResolution(o),l=this.getOrigin(o),u=ct(this.getTileSize(o),this.tmpSize_);let c=a*(e-l[0])/n/u[0],h=a*(l[1]-t)/n/u[1];return r?(c=Ln(c,Vn)-1,h=Ln(h,Vn)-1):(c=Ns(c,Vn),h=Ns(h,Vn)),yo(o,c,h,s)}getTileCoordForXYAndZ_(e,t,n,r,s){const o=this.getOrigin(n),a=this.getResolution(n),l=ct(this.getTileSize(n),this.tmpSize_);let u=(e-o[0])/a/l[0],c=(o[1]-t)/a/l[1];return r?(u=Ln(u,Vn)-1,c=Ln(c,Vn)-1):(u=Ns(u,Vn),c=Ns(c,Vn)),yo(n,u,c,s)}getTileCoordForCoordAndZ(e,t,n){return this.getTileCoordForXYAndZ_(e[0],e[1],t,!1,n)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,t){const n=Ls(this.resolutions_,e,t||0);return ke(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return ch(t,0,t.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){const t=this.resolutions_.length,n=new Array(t);for(let r=this.minZoom;r<t;++r)n[r]=this.getTileRangeForExtentAndZ(e,r);this.fullTileRanges_=n}}function Hl(i){let e=i.getDefaultTileGrid();return e||(e=Z0(i),i.setDefaultTileGrid(e)),e}function K0(i,e,t){const n=e[0],r=i.getTileCoordCenter(e),s=os(t);if(!ti(s,r)){const o=pe(s),a=Math.ceil((s[0]-r[0])/o);return r[0]+=o*a,i.getTileCoordForCoordAndZ(r,n)}return e}function $0(i,e,t,n){n=n!==void 0?n:"top-left";const r=xd(i,e,t);return new xo({extent:i,origin:wp(i,n),resolutions:r,tileSize:t})}function wo(i){const e=i||{},t=e.extent||we("EPSG:3857").getExtent(),n={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:xd(t,e.maxZoom,e.tileSize,e.maxResolution)};return new xo(n)}function xd(i,e,t,n){e=e!==void 0?e:yh,t=ct(t!==void 0?t:ll);const r=Ke(i),s=pe(i);n=n>0?n:Math.max(s/t[0],r/t[1]);const o=e+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=n/Math.pow(2,l);return a}function Z0(i,e,t,n){const r=os(i);return $0(r,e,t,n)}function os(i){i=we(i);let e=i.getExtent();if(!e){const t=180*On.degrees/i.getMetersPerUnit();e=an(-t,-t,t,t)}return e}const q0=/\{z\}/g,H0=/\{x\}/g,J0=/\{y\}/g,Q0=/\{-y\}/g;function e_(i,e,t,n,r){return i.replace(q0,e.toString()).replace(H0,t.toString()).replace(J0,n.toString()).replace(Q0,function(){if(r===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(r-n).toString()})}function t_(i){const e=[];let t=/\{([a-z])-([a-z])\}/.exec(i);if(t){const n=t[1].charCodeAt(0),r=t[2].charCodeAt(0);let s;for(s=n;s<=r;++s)e.push(i.replace(t[0],String.fromCharCode(s)));return e}if(t=/\{(\d+)-(\d+)\}/.exec(i),t){const n=parseInt(t[2],10);for(let r=parseInt(t[1],10);r<=n;r++)e.push(i.replace(t[0],r.toString()));return e}return e.push(i),e}function n_(i,e){return(function(t,n,r){if(!t)return;let s;const o=t[0];if(e){const a=e.getFullTileRange(o);a&&(s=a.getHeight()-1)}return e_(i,o,t[1],t[2],s)})}function wd(i,e){const t=i.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=n_(i[r],e);return i_(n)}function i_(i){return i.length===1?i[0]:(function(e,t,n){if(!e)return;const r=G0(e),s=Fi(r,i.length);return i[s](e,t,n)})}class tr extends Zt{constructor(e){super(),this.projection=we(e.projection),this.attributions_=Ed(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible??!0,this.loading=!1,this.state_=e.state!==void 0?e.state:"ready",this.wrapX_=e.wrapX!==void 0?e.wrapX:!1,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;const t=this;this.viewPromise_=new Promise(function(n,r){t.viewResolver=n,t.viewRejector=r})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=Ed(e),this.changed()}setState(e){this.state_=e,this.changed()}}function Ed(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),e=>i):null}class vd extends tr{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=e.tilePixelRatio!==void 0?e.tilePixelRatio:1,this.tileGrid=e.tileGrid!==void 0?e.tileGrid:null;const t=[256,256];this.tileGrid&&ct(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tmpSize=[0,0],this.key_=e.key||te(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){const t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,n,r,s,o){return J()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:Hl(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){const r=this.getTileGridForProjection(n),s=this.getTilePixelRatio(t),o=ct(r.getTileSize(e),this.tmpSize);return s==1?o:Sy(o,s,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){const n=t!==void 0?t:this.getProjection(),r=t!==void 0?this.getTileGridForProjection(n):this.tileGrid||this.getTileGridForProjection(n);return this.getWrapX()&&n.isGlobal()&&(e=K0(r,e,n)),X0(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}}class r_ extends Gt{constructor(e,t){super(e),this.tile=t}}const Jl={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};class Eo extends vd{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===Eo.prototype.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,e.tileUrlFunction&&(this.tileUrlFunction=e.tileUrlFunction),this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.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(e){const t=e.target,n=te(t),r=t.getState();let s;r==G.LOADING?(this.tileLoadingKeys_[n]=!0,s=Jl.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],s=r==G.ERROR?Jl.TILELOADERROR:r==G.LOADED?Jl.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new r_(s,t))}setTileLoadFunction(e){this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,t){this.tileUrlFunction=e,typeof t<"u"?this.setKey(t):this.changed()}setUrl(e){const t=t_(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;const t=e.join(`
|
|
4
|
+
`);this.generateTileUrlFunction_?this.setTileUrlFunction(wd(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}}class Cd extends Eo{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:s_,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate!==void 0?e.interpolate:!0,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy=e.referrerPolicy,this.tileClass=e.tileClass!==void 0?e.tileClass:ld,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!ut(this.getProjection(),e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=":disable-interpolation"),e}getTileGridForProjection(e){const t=this.getProjection();if(this.tileGrid&&(!t||ut(t,e)))return this.tileGrid;const n=te(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=Hl(e)),this.tileGridForProjection[n]}createTile_(e,t,n,r,s,o){const a=[e,t,n],l=this.getTileCoordForTileUrlFunction(a,s),u=l?this.tileUrlFunction(l,r,s):void 0,c=new this.tileClass(a,u!==void 0?G.IDLE:G.EMPTY,u!==void 0?u:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener($.CHANGE,this.handleTileChange.bind(this)),c}getTile(e,t,n,r,s,o){const a=this.getProjection();if(!a||!s||ut(a,s))return this.getTileInternal(e,t,n,r,a||s);const l=[e,t,n],u=this.getKey(),c=this.getTileGridForProjection(a),h=this.getTileGridForProjection(s),d=this.getTileCoordForTileUrlFunction(l,s),f=new gd(a,c,s,h,l,d,this.getTilePixelRatio(r),this.getGutter(),(g,m,p,y)=>this.getTileInternal(g,m,p,y,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return f.key=u,f}getTileInternal(e,t,n,r,s,o){const a=this.getKey(),l=_o(this,a,e,t,n);if(o&&o.containsKey(l))return o.get(l);const u=this.createTile_(e,t,n,r,s,a);return o?.set(l,u),u}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,t){const n=we(e);if(n){const r=te(n);r in this.tileGridForProjection||(this.tileGridForProjection[r]=t)}}}function s_(i,e){if(at){const t=i.getCrossOrigin();let n="same-origin",r="same-origin";t==="anonymous"||t===""?(n="cors",r="omit"):t==="use-credentials"&&(n="cors",r="include");const s={mode:n,credentials:r,referrerPolicy:i.getReferrerPolicy()};fetch(e,s).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.blob()}).then(o=>createImageBitmap(o)).then(o=>{const a=i.getImage();a.width=o.width,a.height=o.height,a.getContext("2d").drawImage(o,0,0),o.close?.(),a.dispatchEvent(new Event("load"))}).catch(()=>{i.getImage().dispatchEvent(new Event("error"))});return}i.getImage().src=e}class o_ extends Cd{constructor(e){e=e||{};const t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:wo({extent:os(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize});super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,referrerPolicy:e.referrerPolicy,interpolate:e.interpolate,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0}getGutter(){return this.gutter_}}const a_='© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.';class l_ extends o_{constructor(e){e=e||{};let t;e.attributions!==void 0?t=e.attributions:t=[a_];const n=e.url!==void 0?e.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:t,attributionsCollapsible:!1,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin!==void 0?e.crossOrigin:"anonymous",referrerPolicy:e.referrerPolicy||"origin-when-cross-origin",interpolate:e.interpolate,maxZoom:e.maxZoom!==void 0?e.maxZoom:19,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileLoadFunction:e.tileLoadFunction,transition:e.transition,url:n,wrapX:e.wrapX,zDirection:e.zDirection})}}var u_=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],c_=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],h_={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:u_,layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:c_,paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};const d_=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function f_(i,e){const t={};for(const n in i)n!=="ref"&&(t[n]=i[n]);return d_.forEach(n=>{n in e&&(t[n]=e[n])}),t}function bd(i){i=i.slice();const e=Object.create(null);for(let t=0;t<i.length;t++)e[i[t].id]=i[t];for(let t=0;t<i.length;t++)"ref"in i[t]&&(i[t]=f_(i[t],e[i[t].ref]));return i}var en=class extends Error{constructor(i,e){super(e),this.message=e,this.key=i}},g_=class Pg{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[n,r]of t)this.bindings[n]=r}concat(e){return new Pg(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}};const vo={kind:"null"},z={kind:"number"},ee={kind:"string"},ae={kind:"boolean"},tn={kind:"color"},Co={kind:"projectionDefinition"},mi={kind:"object"},se={kind:"value"},p_={kind:"error"},bo={kind:"collator"},Ro={kind:"formatted"},To={kind:"padding"},as={kind:"colorArray"},So={kind:"numberArray"},ls={kind:"resolvedImage"},Io={kind:"variableAnchorOffsetCollection"};function pt(i,e){return{kind:"array",itemType:i,N:e}}function Ne(i){if(i.kind==="array"){const e=Ne(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}else return i.kind}const m_=[vo,z,ee,ae,tn,Co,Ro,mi,pt(se),To,So,as,ls,Io];function us(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!us(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const t of m_)if(!us(t,e))return null}}return`Expected ${Ne(i)} but found ${Ne(e)} instead.`}function Ql(i,e){return e.some(t=>t.kind===i.kind)}function yi(i,e){return e.some(t=>t==="null"?i===null:t==="array"?Array.isArray(i):t==="object"?i&&!Array.isArray(i)&&typeof i=="object":t===typeof i)}function Un(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const Rd=.96422,Td=1,Sd=.82521,Id=4/29,nr=6/29,Md=3*nr*nr,y_=nr*nr*nr,__=Math.PI/180,x_=180/Math.PI;function Ad(i){return i=i%360,i<0&&(i+=360),i}function Pd([i,e,t,n]){i=eu(i),e=eu(e),t=eu(t);let r,s;const o=tu((.2225045*i+.7168786*e+.0606169*t)/Td);i===e&&e===t?r=s=o:(r=tu((.4360747*i+.3850649*e+.1430804*t)/Rd),s=tu((.0139322*i+.0971045*e+.7141733*t)/Sd));const a=116*o-16;return[a<0?0:a,500*(r-o),200*(o-s),n]}function eu(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function tu(i){return i>y_?Math.pow(i,.3333333333333333):i/Md+Id}function Ld([i,e,t,n]){let r=(i+16)/116,s=isNaN(e)?r:r+e/500,o=isNaN(t)?r:r-t/200;return r=Td*iu(r),s=Rd*iu(s),o=Sd*iu(o),[nu(3.1338561*s-1.6168667*r-.4906146*o),nu(-.9787684*s+1.9161415*r+.033454*o),nu(.0719453*s-.2289914*r+1.4052427*o),n]}function nu(i){return i=i<=.00304?12.92*i:1.055*Math.pow(i,.4166666666666667)-.055,i<0?0:i>1?1:i}function iu(i){return i>nr?i*i*i:Md*(i-Id)}function w_(i){const[e,t,n,r]=Pd(i),s=Math.sqrt(t*t+n*n);return[Math.round(s*1e4)?Ad(Math.atan2(n,t)*x_):NaN,s,e,r]}function E_([i,e,t,n]){return i=isNaN(i)?0:i*__,Ld([t,Math.cos(i)*e,Math.sin(i)*e,n])}function v_([i,e,t,n]){i=Ad(i),e/=100,t/=100;function r(s){const o=(s+i/30)%12,a=e*Math.min(t,1-t);return t-a*Math.max(-1,Math.min(o-3,9-o,1))}return[r(0),r(8),r(4),n]}const C_=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function Fd(i,e){return C_(i,e)?i[e]:void 0}function b_(i){if(i=i.toLowerCase().trim(),i==="transparent")return[0,0,0,0];const e=Fd(R_,i);if(e){const[n,r,s]=e;return[n/255,r/255,s/255,1]}if(i.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(i)){const n=i.length<6?1:2;let r=1;return[Mo(i.slice(r,r+=n)),Mo(i.slice(r,r+=n)),Mo(i.slice(r,r+=n)),Mo(i.slice(r,r+n)||"ff")]}if(i.startsWith("rgb")){const n=i.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(n){const[r,s,o,a,l,u,c,h,d,f,g,m]=n,p=[a||" ",c||" ",f].join("");if(p===" "||p===" /"||p===",,"||p===",,,"){const y=[o,u,d].join(""),_=y==="%%%"?100:y===""?255:0;if(_){const E=[ir(+s/_,0,1),ir(+l/_,0,1),ir(+h/_,0,1),g?Od(+g,m):1];if(kd(E))return E}}return}}const t=i.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(t){const[n,r,s,o,a,l,u,c,h]=t,d=[s||" ",a||" ",u].join("");if(d===" "||d===" /"||d===",,"||d===",,,"){const f=[+r,ir(+o,0,100),ir(+l,0,100),c?Od(+c,h):1];if(kd(f))return v_(f)}}}function Mo(i){return parseInt(i.padEnd(2,i),16)/255}function Od(i,e){return ir(e?i/100:i,0,1)}function ir(i,e,t){return Math.min(Math.max(e,i),t)}function kd(i){return!i.some(Number.isNaN)}const R_={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function _i(i,e,t){return i+t*(e-i)}function cs(i,e,t){return i.map((n,r)=>_i(n,e[r],t))}var Ge=(nt=class{constructor(e,t,n,r=1,s=!0){this.r=e,this.g=t,this.b=n,this.a=r,s||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[e,t,n,r]))}static parse(e){if(e instanceof nt)return e;if(typeof e!="string")return;const t=b_(e);if(t)return new nt(...t,!1)}get rgb(){const{r:e,g:t,b:n,a:r}=this,s=r||1/0;return this.overwriteGetter("rgb",[e/s,t/s,n/s,r])}get hcl(){return this.overwriteGetter("hcl",w_(this.rgb))}get lab(){return this.overwriteGetter("lab",Pd(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,n,r]=this.rgb;return`rgba(${[e,t,n].map(s=>Math.round(s*255)).join(",")},${r})`}static interpolate(e,t,n,r="rgb"){switch(r){case"rgb":{const[s,o,a,l]=cs(e.rgb,t.rgb,n);return new nt(s,o,a,l,!1)}case"hcl":{const[s,o,a,l]=e.hcl,[u,c,h,d]=t.hcl;let f,g;if(!isNaN(s)&&!isNaN(u)){let E=u-s;u>s&&E>180?E-=360:u<s&&s-u>180&&(E+=360),f=s+n*E}else isNaN(s)?isNaN(u)?f=NaN:(f=u,(a===1||a===0)&&(g=c)):(f=s,(h===1||h===0)&&(g=o));const[m,p,y,_]=E_([f,g??_i(o,c,n),_i(a,h,n),_i(l,d,n)]);return new nt(m,p,y,_,!1)}case"lab":{const[s,o,a,l]=Ld(cs(e.lab,t.lab,n));return new nt(s,o,a,l,!1)}}}},nt.black=new nt(0,0,0,1),nt.white=new nt(1,1,1,1),nt.transparent=new nt(0,0,0,0),nt.red=new nt(1,0,0,1),nt),ru=class{constructor(i,e,t){i?this.sensitivity=e?"variant":"case":this.sensitivity=e?"accent":"base",this.locale=t,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(i,e){return this.collator.compare(i,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}};const T_=["bottom","center","top"];var su=class{constructor(i,e,t,n,r,s){this.text=i,this.image=e,this.scale=t,this.fontStack=n,this.textColor=r,this.verticalAlign=s}},hs=class fa{constructor(e){this.sections=e}static fromString(e){return new fa([new su(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof fa?e:fa.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}},rr=class Ss{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ss)return e;if(typeof e=="number")return new Ss([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if(typeof t!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]];break}return new Ss(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new Ss(cs(e.values,t.values,n))}},sr=class Is{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Is)return e;if(typeof e=="number")return new Is([e]);if(Array.isArray(e)){for(const t of e)if(typeof t!="number")return;return new Is(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new Is(cs(e.values,t.values,n))}},Yn=class Ms{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ms)return e;if(typeof e=="string"){const n=Ge.parse(e);return n?new Ms([n]):void 0}if(!Array.isArray(e))return;const t=[];for(const n of e){if(typeof n!="string")return;const r=Ge.parse(n);if(!r)return;t.push(r)}return new Ms(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n,r="rgb"){const s=[];if(e.values.length!=t.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${t.values.length}), cannot interpolate.`);for(let o=0;o<e.values.length;o++)s.push(Ge.interpolate(e.values[o],t.values[o],n,r));return new Ms(s)}},je=class extends Error{constructor(i){super(i),this.name="RuntimeError"}toJSON(){return this.message}};const S_=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);var or=class ga{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ga)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let t=0;t<e.length;t+=2){const n=e[t],r=e[t+1];if(typeof n!="string"||!S_.has(n)||!Array.isArray(r)||r.length!==2||typeof r[0]!="number"||typeof r[1]!="number")return}return new ga(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){const r=e.values,s=t.values;if(r.length!==s.length)throw new je(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);const o=[];for(let a=0;a<r.length;a+=2){if(r[a]!==s[a])throw new je(`Cannot interpolate values containing mismatched anchors. from[${a}]: ${r[a]}, to[${a}]: ${s[a]}`);o.push(r[a]);const[l,u]=r[a+1],[c,h]=s[a+1];o.push([_i(l,c,n),_i(u,h,n)])}return new ga(o)}},ar=class Lg{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Lg({name:e,available:!1}):null}},ds=class wr{constructor(e,t,n){this.from=e,this.to=t,this.transition=n}static interpolate(e,t,n){return new wr(e,t,n)}static parse(e){if(e instanceof wr)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number")return new wr(e[0],e[1],e[2]);if(typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number")return new wr(e.from,e.to,e.transition);if(typeof e=="string")return new wr(e,e,1)}};function Dd(i,e,t,n){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255?typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[i,e,t,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[i,e,t,n]:[i,e,t]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function fs(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof ds||i instanceof Ge||i instanceof ru||i instanceof hs||i instanceof rr||i instanceof sr||i instanceof Yn||i instanceof or||i instanceof ar)return!0;if(Array.isArray(i)){for(const e of i)if(!fs(e))return!1;return!0}else if(typeof i=="object"){for(const e in i)if(!fs(i[e]))return!1;return!0}else return!1}function He(i){if(i===null)return vo;if(typeof i=="string")return ee;if(typeof i=="boolean")return ae;if(typeof i=="number")return z;if(i instanceof Ge)return tn;if(i instanceof ds)return Co;if(i instanceof ru)return bo;if(i instanceof hs)return Ro;if(i instanceof rr)return To;if(i instanceof sr)return So;if(i instanceof Yn)return as;if(i instanceof or)return Io;if(i instanceof ar)return ls;if(Array.isArray(i)){const e=i.length;let t;for(const n of i){const r=He(n);if(!t)t=r;else{if(t===r)continue;t=se;break}}return pt(t||se,e)}else return mi}function gs(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof Ge||i instanceof ds||i instanceof hs||i instanceof rr||i instanceof sr||i instanceof Yn||i instanceof or||i instanceof ar?i.toString():JSON.stringify(i)}var Ao=class Fg{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(e.length!==2)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!fs(e[1]))return t.error("invalid value");const n=e[1];let r=He(n);const s=t.expectedType;return r.kind==="array"&&r.N===0&&s&&s.kind==="array"&&(typeof s.N!="number"||s.N===0)&&(r=s),new Fg(r,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}};const Po={string:ee,number:z,boolean:ae,object:mi};var xn=class Og{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let n=1,r;const s=e[0];if(s==="array"){let a;if(e.length>2){const u=e[1];if(typeof u!="string"||!(u in Po)||u==="object")return t.error('The item type argument of "array" must be one of string, number, boolean',1);a=Po[u],n++}else a=se;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);l=e[2],n++}r=pt(a,l)}else{if(!Po[s])throw new Error(`Types doesn't contain name = ${s}`);r=Po[s]}const o=[];for(;n<e.length;n++){const a=t.parse(e[n],n,se);if(!a)return null;o.push(a)}return new Og(r,o)}evaluate(e){for(let t=0;t<this.args.length;t++){const n=this.args[t].evaluate(e);if(us(this.type,He(n))){if(t===this.args.length-1)throw new je(`Expected value to be of type ${Ne(this.type)}, but found ${Ne(He(n))} instead.`)}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};const Nd={"to-boolean":ae,"to-color":tn,"to-number":z,"to-string":ee};var lr=class kg{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[0];if(!Nd[n])throw new Error(`Can't parse ${n} as it is not part of the known types`);if((n==="to-boolean"||n==="to-string")&&e.length!==2)return t.error("Expected one argument.");const r=Nd[n],s=[];for(let o=1;o<e.length;o++){const a=t.parse(e[o],o,se);if(!a)return null;s.push(a)}return new kg(r,s)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let t,n;for(const r of this.args){if(t=r.evaluate(e),n=null,t instanceof Ge)return t;if(typeof t=="string"){const s=e.parseColor(t);if(s)return s}else if(Array.isArray(t)&&(t.length<3||t.length>4?n=`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:n=Dd(t[0],t[1],t[2],t[3]),!n))return new Ge(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new je(n||`Could not parse color from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const n of this.args){t=n.evaluate(e);const r=rr.parse(t);if(r)return r}throw new je(`Could not parse padding from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"numberArray":{let t;for(const n of this.args){t=n.evaluate(e);const r=sr.parse(t);if(r)return r}throw new je(`Could not parse numberArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"colorArray":{let t;for(const n of this.args){t=n.evaluate(e);const r=Yn.parse(t);if(r)return r}throw new je(`Could not parse colorArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const n of this.args){t=n.evaluate(e);const r=or.parse(t);if(r)return r}throw new je(`Could not parse variableAnchorOffsetCollection from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const n of this.args){if(t=n.evaluate(e),t===null)return 0;const r=Number(t);if(!isNaN(r))return r}throw new je(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return hs.fromString(gs(this.args[0].evaluate(e)));case"resolvedImage":return ar.fromString(gs(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return gs(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};const I_=["Unknown","Point","LineString","Polygon"];var zd=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?I_[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(i){let e=this._parseColorCache.get(i);return e||(e=Ge.parse(i),this._parseColorCache.set(i,e)),e}},Gd=class Dg{constructor(e,t,n=[],r,s=new g_,o=[]){this.registry=e,this.path=n,this.key=n.map(a=>`[${a}]`).join(""),this.scope=s,this.errors=o,this.expectedType=r,this._isConstant=t}parse(e,t,n,r,s={}){return t?this.concat(t,n,r)._parse(e,s):this._parse(e,s)}_parse(e,t){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function n(r,s,o){return o==="assert"?new xn(s,[r]):o==="coerce"?new lr(s,[r]):r}if(Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r=e[0];if(typeof r!="string")return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const s=this.registry[r];if(s){let o=s.parse(e,this);if(!o)return null;if(this.expectedType){const a=this.expectedType,l=o.type;if((a.kind==="string"||a.kind==="number"||a.kind==="boolean"||a.kind==="object"||a.kind==="array")&&l.kind==="value")o=n(o,a,t.typeAnnotation||"assert");else if(a.kind==="projectionDefinition"&&["string","array"].includes(l.kind)||["color","formatted","resolvedImage"].includes(a.kind)&&["value","string"].includes(l.kind)||["padding","numberArray"].includes(a.kind)&&["value","number","array"].includes(l.kind)||a.kind==="colorArray"&&["value","string","array"].includes(l.kind)||a.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(l.kind))o=n(o,a,t.typeAnnotation||"coerce");else if(this.checkSubtype(a,l))return null}if(!(o instanceof Ao)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){const a=new zd;try{o=new Ao(o.type,o.evaluate(a))}catch(l){return this.error(l.message),null}}return o}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}else return typeof e>"u"?this.error("'undefined' value invalid. Use null instead."):typeof e=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,t,n){const r=typeof e=="number"?this.path.concat(e):this.path,s=n?this.scope.concat(n):this.scope;return new Dg(this.registry,this._isConstant,r,t||null,s,this.errors)}error(e,...t){const n=`${this.key}${t.map(r=>`[${r}]`).join("")}`;this.errors.push(new en(n,e))}checkSubtype(e,t){const n=us(e,t);return n&&this.error(n),n}},jd=class Ng{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const n=[];for(let s=1;s<e.length-1;s+=2){const o=e[s];if(typeof o!="string")return t.error(`Expected string, but found ${typeof o} instead.`,s);if(/[^a-zA-Z0-9_]/.test(o))return t.error("Variable names must contain only alphanumeric characters or '_'.",s);const a=t.parse(e[s+1],s+1);if(!a)return null;n.push([o,a])}const r=t.parse(e[e.length-1],e.length-1,t.expectedType,n);return r?new Ng(n,r):null}outputDefined(){return this.result.outputDefined()}},Xd=class zg{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(e.length!==2||typeof e[1]!="string")return t.error("'var' expression requires exactly one string literal argument.");const n=e[1];return t.scope.has(n)?new zg(n,t.scope.get(n)):t.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},M_=class Gg{constructor(e,t,n){this.type=e,this.index=t,this.input=n}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,z),r=t.parse(e[2],2,pt(t.expectedType||se));if(!n||!r)return null;const s=r.type;return new Gg(s.itemType,n,r)}evaluate(e){const t=this.index.evaluate(e),n=this.input.evaluate(e);if(t<0)throw new je(`Array index out of bounds: ${t} < 0.`);if(t>=n.length)throw new je(`Array index out of bounds: ${t} > ${n.length-1}.`);if(t!==Math.floor(t))throw new je(`Array index must be an integer, but found ${t} instead.`);return n[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},A_=class jg{constructor(e,t){this.type=ae,this.needle=e,this.haystack=t}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,se),r=t.parse(e[2],2,se);return!n||!r?null:Ql(n.type,[ae,ee,z,vo,se])?new jg(n,r):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ne(n.type)} instead`)}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!yi(t,["boolean","string","number","null"]))throw new je(`Expected first argument to be of type boolean, string, number or null, but found ${Ne(He(t))} instead.`);if(!yi(n,["string","array"]))throw new je(`Expected second argument to be of type array or string, but found ${Ne(He(n))} instead.`);return n.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},P_=class oc{constructor(e,t,n){this.type=z,this.needle=e,this.haystack=t,this.fromIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,se),r=t.parse(e[2],2,se);if(!n||!r)return null;if(!Ql(n.type,[ae,ee,z,vo,se]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ne(n.type)} instead`);if(e.length===4){const s=t.parse(e[3],3,z);return s?new oc(n,r,s):null}else return new oc(n,r)}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!yi(t,["boolean","string","number","null"]))throw new je(`Expected first argument to be of type boolean, string, number or null, but found ${Ne(He(t))} instead.`);let r;if(this.fromIndex&&(r=this.fromIndex.evaluate(e)),yi(n,["string"])){const s=n.indexOf(t,r);return s===-1?-1:[...n.slice(0,s)].length}else{if(yi(n,["array"]))return n.indexOf(t,r);throw new je(`Expected second argument to be of type array or string, but found ${Ne(He(n))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},L_=class Xg{constructor(e,t,n,r,s,o){this.inputType=e,this.type=t,this.input=n,this.cases=r,this.outputs=s,this.otherwise=o}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!==1)return t.error("Expected an even number of arguments.");let n,r;t.expectedType&&t.expectedType.kind!=="value"&&(r=t.expectedType);const s={},o=[];for(let u=2;u<e.length-1;u+=2){let c=e[u];const h=e[u+1];Array.isArray(c)||(c=[c]);const d=t.concat(u);if(c.length===0)return d.error("Expected at least one branch label.");for(const g of c){if(typeof g!="number"&&typeof g!="string")return d.error("Branch labels must be numbers or strings.");if(typeof g=="number"&&Math.abs(g)>Number.MAX_SAFE_INTEGER)return d.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof g=="number"&&Math.floor(g)!==g)return d.error("Numeric branch labels must be integer values.");if(!n)n=He(g);else if(d.checkSubtype(n,He(g)))return null;if(typeof s[String(g)]<"u")return d.error("Branch labels must be unique.");s[String(g)]=o.length}const f=t.parse(h,u,r);if(!f)return null;r=r||f.type,o.push(f)}const a=t.parse(e[1],1,se);if(!a)return null;const l=t.parse(e[e.length-1],e.length-1,r);return!l||a.type.kind!=="value"&&t.concat(1).checkSubtype(n,a.type)?null:new Xg(n,r,a,s,o,l)}evaluate(e){const t=this.input.evaluate(e);return(He(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},F_=class Wg{constructor(e,t,n){this.type=e,this.branches=t,this.otherwise=n}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!==0)return t.error("Expected an odd number of arguments.");let n;t.expectedType&&t.expectedType.kind!=="value"&&(n=t.expectedType);const r=[];for(let o=1;o<e.length-1;o+=2){const a=t.parse(e[o],o,ae);if(!a)return null;const l=t.parse(e[o+1],o+1,n);if(!l)return null;r.push([a,l]),n=n||l.type}const s=t.parse(e[e.length-1],e.length-1,n);if(!s)return null;if(!n)throw new Error("Can't infer output type");return new Wg(n,r,s)}evaluate(e){for(const[t,n]of this.branches)if(t.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,n]of this.branches)e(t),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}},O_=class ac{constructor(e,t,n,r){this.type=e,this.input=t,this.beginIndex=n,this.endIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,se),r=t.parse(e[2],2,z);if(!n||!r)return null;if(!Ql(n.type,[pt(se),ee,se]))return t.error(`Expected first argument to be of type array or string, but found ${Ne(n.type)} instead`);if(e.length===4){const s=t.parse(e[3],3,z);return s?new ac(n.type,n,r,s):null}else return new ac(n.type,n,r)}evaluate(e){const t=this.input.evaluate(e),n=this.beginIndex.evaluate(e);let r;if(this.endIndex&&(r=this.endIndex.evaluate(e)),yi(t,["string"]))return[...t].slice(n,r).join("");if(yi(t,["array"]))return t.slice(n,r);throw new je(`Expected first argument to be of type array or string, but found ${Ne(He(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function Wd(i,e){const t=i.length-1;let n=0,r=t,s=0,o,a;for(;n<=r;)if(s=Math.floor((n+r)/2),o=i[s],a=i[s+1],o<=e){if(s===t||e<a)return s;n=s+1}else if(o>e)r=s-1;else throw new je("Input is not a number.");return 0}var Vd=class Vg{constructor(e,t,n){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[r,s]of n)this.labels.push(r),this.outputs.push(s)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");const n=t.parse(e[1],1,z);if(!n)return null;const r=[];let s=null;t.expectedType&&t.expectedType.kind!=="value"&&(s=t.expectedType);for(let o=1;o<e.length;o+=2){const a=o===1?-1/0:e[o],l=e[o+1],u=o,c=o+1;if(typeof a!="number")return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',u);if(r.length&&r[r.length-1][0]>=a)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);const h=t.parse(l,c,s);if(!h)return null;s=s||h.type,r.push([a,h])}return new Vg(s,n,r)}evaluate(e){const t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return n[0].evaluate(e);const s=t.length;return r>=t[s-1]?n[s-1].evaluate(e):n[Wd(t,r)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function k_(i,e,t,n){const r=3*i,s=3*(t-i)-r,o=1-r-s,a=3*e,l=3*(n-e)-a,u=1-a-l;return function(h,d=1e-6){if(h<=0)return 0;if(h>=1)return 1;let f=h;for(let p=0;p<8;p++){const y=((o*f+s)*f+r)*f-h;if(Math.abs(y)<d)return((u*f+l)*f+a)*f;const _=(3*o*f+2*s)*f+r;if(Math.abs(_)<1e-6)break;f-=y/_}let g=0,m=1;f=h;for(let p=0;p<20;p++){const y=((o*f+s)*f+r)*f;if(Math.abs(y-h)<d)break;h>y?g=f:m=f,f=(g+m)*.5}return((u*f+l)*f+a)*f}}var xi=class lc{constructor(e,t,n,r,s){this.type=e,this.operator=t,this.interpolation=n,this.input=r,this.labels=[],this.outputs=[];for(const[o,a]of s)this.labels.push(o),this.outputs.push(a)}static interpolationFactor(e,t,n,r){let s=0;if(e.name==="exponential")s=ou(t,e.base,n,r);else if(e.name==="linear")s=ou(t,1,n,r);else if(e.name==="cubic-bezier"){const o=e.controlPoints;s=k_(o[0],o[1],o[2],o[3])(ou(t,1,n,r))}return s}static parse(e,t){let[n,r,s,...o]=e;if(!Array.isArray(r)||r.length===0)return t.error("Expected an interpolation type expression.",1);if(r[0]==="linear")r={name:"linear"};else if(r[0]==="exponential"){const u=r[1];if(typeof u!="number")return t.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:u}}else if(r[0]==="cubic-bezier"){const u=r.slice(1);if(u.length!==4||u.some(c=>typeof c!="number"||c<0||c>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:u}}else return t.error(`Unknown interpolation type ${String(r[0])}`,1,0);if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");if(s=t.parse(s,2,z),!s)return null;const a=[];let l=null;(n==="interpolate-hcl"||n==="interpolate-lab")&&t.expectedType!=as?l=tn:t.expectedType&&t.expectedType.kind!=="value"&&(l=t.expectedType);for(let u=0;u<o.length;u+=2){const c=o[u],h=o[u+1],d=u+3,f=u+4;if(typeof c!="number")return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',d);if(a.length&&a[a.length-1][0]>=c)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',d);const g=t.parse(h,f,l);if(!g)return null;l=l||g.type,a.push([c,g])}return!Un(l,z)&&!Un(l,Co)&&!Un(l,tn)&&!Un(l,To)&&!Un(l,So)&&!Un(l,as)&&!Un(l,Io)&&!Un(l,pt(z))?t.error(`Type ${Ne(l)} is not interpolatable.`):new lc(l,n,r,s,a)}evaluate(e){const t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return n[0].evaluate(e);const s=t.length;if(r>=t[s-1])return n[s-1].evaluate(e);const o=Wd(t,r),a=t[o],l=t[o+1],u=lc.interpolationFactor(this.interpolation,r,a,l),c=n[o].evaluate(e),h=n[o+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return _i(c,h,u);case"color":return Ge.interpolate(c,h,u);case"padding":return rr.interpolate(c,h,u);case"colorArray":return Yn.interpolate(c,h,u);case"numberArray":return sr.interpolate(c,h,u);case"variableAnchorOffsetCollection":return or.interpolate(c,h,u);case"array":return cs(c,h,u);case"projectionDefinition":return ds.interpolate(c,h,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return Ge.interpolate(c,h,u,"hcl");case"colorArray":return Yn.interpolate(c,h,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Ge.interpolate(c,h,u,"lab");case"colorArray":return Yn.interpolate(c,h,u,"lab")}}}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function ou(i,e,t,n){const r=n-t,s=i-t;return r===0?0:e===1?s/r:(Math.pow(e,s)-1)/(Math.pow(e,r)-1)}var Ud=class uc{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let n=null;const r=t.expectedType;r&&r.kind!=="value"&&(n=r);const s=[];for(const o of e.slice(1)){const a=t.parse(o,1+s.length,n,void 0,{typeAnnotation:"omit"});if(!a)return null;n=n||a.type,s.push(a)}if(!n)throw new Error("No output type");return r&&s.some(o=>us(r,o.type))?new uc(se,s):new uc(n,s)}evaluate(e){let t=null,n=0,r;for(const s of this.args)if(n++,t=s.evaluate(e),t&&t instanceof ar&&!t.available&&(r||(r=t.name),t=null,n===this.args.length&&(t=r)),t!==null)break;return t}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function Yd(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function D_(i,e,t){return e===t}function N_(i,e,t){return e!==t}function z_(i,e,t){return e<t}function G_(i,e,t){return e>t}function j_(i,e,t){return e<=t}function X_(i,e,t){return e>=t}function Bd(i,e,t,n){return n.compare(e,t)===0}function W_(i,e,t,n){return!Bd(i,e,t,n)}function V_(i,e,t,n){return n.compare(e,t)<0}function U_(i,e,t,n){return n.compare(e,t)>0}function Y_(i,e,t,n){return n.compare(e,t)<=0}function B_(i,e,t,n){return n.compare(e,t)>=0}function ur(i,e,t){const n=i!=="=="&&i!=="!=";return class Ug{constructor(s,o,a){this.type=ae,this.lhs=s,this.rhs=o,this.collator=a,this.hasUntypedArgument=s.type.kind==="value"||o.type.kind==="value"}static parse(s,o){if(s.length!==3&&s.length!==4)return o.error("Expected two or three arguments.");const a=s[0];let l=o.parse(s[1],1,se);if(!l)return null;if(!Yd(a,l.type))return o.concat(1).error(`"${a}" comparisons are not supported for type '${Ne(l.type)}'.`);let u=o.parse(s[2],2,se);if(!u)return null;if(!Yd(a,u.type))return o.concat(2).error(`"${a}" comparisons are not supported for type '${Ne(u.type)}'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return o.error(`Cannot compare types '${Ne(l.type)}' and '${Ne(u.type)}'.`);n&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new xn(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new xn(l.type,[u])));let c=null;if(s.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return o.error("Cannot use collator to compare non-string types.");if(c=o.parse(s[3],3,bo),!c)return null}return new Ug(l,u,c)}evaluate(s){const o=this.lhs.evaluate(s),a=this.rhs.evaluate(s);if(n&&this.hasUntypedArgument){const l=He(o),u=He(a);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new je(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const l=He(o),u=He(a);if(l.kind!=="string"||u.kind!=="string")return e(s,o,a)}return this.collator?t(s,o,a,this.collator.evaluate(s)):e(s,o,a)}eachChild(s){s(this.lhs),s(this.rhs),this.collator&&s(this.collator)}outputDefined(){return!0}}}const K_=ur("==",D_,Bd),$_=ur("!=",N_,W_),Z_=ur("<",z_,V_),q_=ur(">",G_,U_),H_=ur("<=",j_,Y_),J_=ur(">=",X_,B_);var Kd=class Yg{constructor(e,t,n){this.type=bo,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error("Expected one argument.");const n=e[1];if(typeof n!="object"||Array.isArray(n))return t.error("Collator options argument must be an object.");const r=t.parse(n["case-sensitive"]===void 0?!1:n["case-sensitive"],1,ae);if(!r)return null;const s=t.parse(n["diacritic-sensitive"]===void 0?!1:n["diacritic-sensitive"],1,ae);if(!s)return null;let o=null;return n.locale&&(o=t.parse(n.locale,1,ee),!o)?null:new Yg(r,s,o)}evaluate(e){return new ru(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}},Q_=class Bg{constructor(e,t,n,r,s,o){this.type=ee,this.number=e,this.locale=t,this.currency=n,this.unit=r,this.minFractionDigits=s,this.maxFractionDigits=o}static parse(e,t){if(e.length!==3)return t.error("Expected two arguments.");const n=t.parse(e[1],1,z);if(!n)return null;const r=e[2];if(typeof r!="object"||Array.isArray(r))return t.error("NumberFormat options argument must be an object.");let s=null;if(r.locale&&(s=t.parse(r.locale,1,ee),!s))return null;let o=null;if(r.currency&&(o=t.parse(r.currency,1,ee),!o))return null;let a=null;if(r.unit&&(a=t.parse(r.unit,1,ee),!a))return null;if(o&&a)return t.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(r["min-fraction-digits"]&&(l=t.parse(r["min-fraction-digits"],1,z),!l))return null;let u=null;return r["max-fraction-digits"]&&(u=t.parse(r["max-fraction-digits"],1,z),!u)?null:new Bg(n,s,o,a,l,u)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},ex=class Kg{constructor(e){this.type=Ro,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&typeof n=="object")return t.error("First argument must be an image or text section.");const r=[];let s=!1;for(let o=1;o<=e.length-1;++o){const a=e[o];if(s&&typeof a=="object"&&!Array.isArray(a)){s=!1;let l=null;if(a["font-scale"]&&(l=t.parse(a["font-scale"],1,z),!l))return null;let u=null;if(a["text-font"]&&(u=t.parse(a["text-font"],1,pt(ee)),!u))return null;let c=null;if(a["text-color"]&&(c=t.parse(a["text-color"],1,tn),!c))return null;let h=null;if(a["vertical-align"]){if(typeof a["vertical-align"]=="string"&&!T_.includes(a["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${a["vertical-align"]}' instead.`);if(h=t.parse(a["vertical-align"],1,ee),!h)return null}const d=r[r.length-1];d.scale=l,d.font=u,d.textColor=c,d.verticalAlign=h}else{const l=t.parse(e[o],1,se);if(!l)return null;const u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");s=!0,r.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Kg(r)}evaluate(e){const t=n=>{const r=n.content.evaluate(e);return He(r)===ls?new su("",r,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(e):null):new su(gs(r),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null,n.verticalAlign?n.verticalAlign.evaluate(e):null)};return new hs(this.sections.map(t))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}},tx=class $g{constructor(e){this.type=ls,this.input=e}static parse(e,t){if(e.length!==2)return t.error("Expected two arguments.");const n=t.parse(e[1],1,ee);return n?new $g(n):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),n=ar.fromString(t);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(t)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}},nx=class Zg{constructor(e){this.type=z,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=t.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?t.error(`Expected argument of type string or array, but found ${Ne(n.type)} instead.`):new Zg(n):null}evaluate(e){const t=this.input.evaluate(e);if(typeof t=="string")return[...t].length;if(Array.isArray(t))return t.length;throw new je(`Expected value to be of type string or array, but found ${Ne(He(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}};const nn=8192;function ix(i,e){const t=rx(i[0]),n=ox(i[1]),r=Math.pow(2,e.z);return[Math.round(t*r*nn),Math.round(n*r*nn)]}function au(i,e){const t=Math.pow(2,e.z),n=(i[0]/nn+e.x)/t,r=(i[1]/nn+e.y)/t;return[sx(n),ax(r)]}function rx(i){return(180+i)/360}function sx(i){return i*360-180}function ox(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function ax(i){return 360/Math.PI*Math.atan(Math.exp((180-i*360)*Math.PI/180))-90}function ps(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function ms(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function lx(i,e,t){return e[1]>i[1]!=t[1]>i[1]&&i[0]<(t[0]-e[0])*(i[1]-e[1])/(t[1]-e[1])+e[0]}function ux(i,e,t){const n=i[0]-e[0],r=i[1]-e[1],s=i[0]-t[0],o=i[1]-t[1];return n*o-s*r===0&&n*s<=0&&r*o<=0}function Lo(i,e,t,n){const r=[e[0]-i[0],e[1]-i[1]];return fx([n[0]-t[0],n[1]-t[1]],r)===0?!1:!!(Zd(i,e,t,n)&&Zd(t,n,i,e))}function cx(i,e,t){for(const n of t)for(let r=0;r<n.length-1;++r)if(Lo(i,e,n[r],n[r+1]))return!0;return!1}function cr(i,e,t=!1){let n=!1;for(const r of e)for(let s=0;s<r.length-1;s++){if(ux(i,r[s],r[s+1]))return t;lx(i,r[s],r[s+1])&&(n=!n)}return n}function hx(i,e){for(const t of e)if(cr(i,t))return!0;return!1}function $d(i,e){for(const t of i)if(!cr(t,e))return!1;for(let t=0;t<i.length-1;++t)if(cx(i[t],i[t+1],e))return!1;return!0}function dx(i,e){for(const t of e)if($d(i,t))return!0;return!1}function fx(i,e){return i[0]*e[1]-i[1]*e[0]}function Zd(i,e,t,n){const r=i[0]-t[0],s=i[1]-t[1],o=e[0]-t[0],a=e[1]-t[1],l=n[0]-t[0],u=n[1]-t[1],c=r*u-l*s,h=o*u-l*a;return c>0&&h<0||c<0&&h>0}function lu(i,e,t){const n=[];for(let r=0;r<i.length;r++){const s=[];for(let o=0;o<i[r].length;o++){const a=ix(i[r][o],t);ps(e,a),s.push(a)}n.push(s)}return n}function qd(i,e,t){const n=[];for(let r=0;r<i.length;r++){const s=lu(i[r],e,t);n.push(s)}return n}function Hd(i,e,t,n){if(i[0]<t[0]||i[0]>t[2]){const r=n*.5;let s=i[0]-t[0]>r?-n:t[0]-i[0]>r?n:0;s===0&&(s=i[0]-t[2]>r?-n:t[2]-i[0]>r?n:0),i[0]+=s}ps(e,i)}function gx(i){i[0]=i[1]=1/0,i[2]=i[3]=-1/0}function Jd(i,e,t,n){const r=Math.pow(2,n.z)*nn,s=[n.x*nn,n.y*nn],o=[];for(const a of i)for(const l of a){const u=[l.x+s[0],l.y+s[1]];Hd(u,e,t,r),o.push(u)}return o}function Qd(i,e,t,n){const r=Math.pow(2,n.z)*nn,s=[n.x*nn,n.y*nn],o=[];for(const a of i){const l=[];for(const u of a){const c=[u.x+s[0],u.y+s[1]];ps(e,c),l.push(c)}o.push(l)}if(e[2]-e[0]<=r/2){gx(e);for(const a of o)for(const l of a)Hd(l,e,t,r)}return o}function px(i,e){const t=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=i.canonicalID();if(e.type==="Polygon"){const s=lu(e.coordinates,n,r),o=Jd(i.geometry(),t,n,r);if(!ms(t,n))return!1;for(const a of o)if(!cr(a,s))return!1}if(e.type==="MultiPolygon"){const s=qd(e.coordinates,n,r),o=Jd(i.geometry(),t,n,r);if(!ms(t,n))return!1;for(const a of o)if(!hx(a,s))return!1}return!0}function mx(i,e){const t=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=i.canonicalID();if(e.type==="Polygon"){const s=lu(e.coordinates,n,r),o=Qd(i.geometry(),t,n,r);if(!ms(t,n))return!1;for(const a of o)if(!$d(a,s))return!1}if(e.type==="MultiPolygon"){const s=qd(e.coordinates,n,r),o=Qd(i.geometry(),t,n,r);if(!ms(t,n))return!1;for(const a of o)if(!dx(a,s))return!1}return!0}var uu=class pa{constructor(e,t){this.type=ae,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(fs(e[1])){const n=e[1];if(n.type==="FeatureCollection"){const r=[];for(const s of n.features){const{type:o,coordinates:a}=s.geometry;o==="Polygon"&&r.push(a),o==="MultiPolygon"&&r.push(...a)}if(r.length)return new pa(n,{type:"MultiPolygon",coordinates:r})}else if(n.type==="Feature"){const r=n.geometry.type;if(r==="Polygon"||r==="MultiPolygon")return new pa(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new pa(n,n)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return px(e,this.geometries);if(e.geometryType()==="LineString")return mx(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},ef=class{constructor(i=[],e=(t,n)=>t<n?-1:t>n?1:0){if(this.data=i,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(i){this.data.push(i),this._up(this.length++)}pop(){if(this.length===0)return;const i=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:e,compare:t}=this,n=e[i];for(;i>0;){const r=i-1>>1,s=e[r];if(t(n,s)>=0)break;e[i]=s,i=r}e[i]=n}_down(i){const{data:e,compare:t}=this,n=this.length>>1,r=e[i];for(;i<n;){let s=(i<<1)+1;const o=s+1;if(o<this.length&&t(e[o],e[s])<0&&(s=o),t(e[s],r)>=0)break;e[i]=e[s],i=s}e[i]=r}};function yx(i,e){if(i.length<=1)return[i];const t=[];let n,r;for(const s of i){const o=_x(s);o!==0&&(s.area=Math.abs(o),r===void 0&&(r=o<0),r===o<0?(n&&t.push(n),n=[s]):n.push(s))}return n&&t.push(n),t}function _x(i){let e=0;for(let t=0,n=i.length,r=n-1,s,o;t<n;r=t++)s=i[t],o=i[r],e+=(o.x-s.x)*(s.y+o.y);return e}const xx=6378.137,tf=1/298.257223563,nf=tf*(2-tf),rf=Math.PI/180;var cu=class{constructor(i){const e=rf*xx*1e3,t=Math.cos(i*rf),n=1/(1-nf*(1-t*t)),r=Math.sqrt(n);this.kx=e*r*t,this.ky=e*r*n*(1-nf)}distance(i,e){const t=this.wrap(i[0]-e[0])*this.kx,n=(i[1]-e[1])*this.ky;return Math.sqrt(t*t+n*n)}pointOnLine(i,e){let t=1/0,n,r,s,o;for(let a=0;a<i.length-1;a++){let l=i[a][0],u=i[a][1],c=this.wrap(i[a+1][0]-l)*this.kx,h=(i[a+1][1]-u)*this.ky,d=0;(c!==0||h!==0)&&(d=(this.wrap(e[0]-l)*this.kx*c+(e[1]-u)*this.ky*h)/(c*c+h*h),d>1?(l=i[a+1][0],u=i[a+1][1]):d>0&&(l+=c/this.kx*d,u+=h/this.ky*d)),c=this.wrap(e[0]-l)*this.kx,h=(e[1]-u)*this.ky;const f=c*c+h*h;f<t&&(t=f,n=l,r=u,s=a,o=d)}return{point:[n,r],index:s,t:Math.max(0,Math.min(1,o))}}wrap(i){for(;i<-180;)i+=360;for(;i>180;)i-=360;return i}};const hu=100,du=50;function sf(i,e){return e[0]-i[0]}function Fo(i){return i[1]-i[0]+1}function wn(i,e){return i[1]>=i[0]&&i[1]<e}function fu(i,e){if(i[0]>i[1])return[null,null];const t=Fo(i);if(e){if(t===2)return[i,null];const r=Math.floor(t/2);return[[i[0],i[0]+r],[i[0]+r,i[1]]]}if(t===1)return[i,null];const n=Math.floor(t/2)-1;return[[i[0],i[0]+n],[i[0]+n+1,i[1]]]}function gu(i,e){if(!wn(e,i.length))return[1/0,1/0,-1/0,-1/0];const t=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)ps(t,i[n]);return t}function pu(i){const e=[1/0,1/0,-1/0,-1/0];for(const t of i)for(const n of t)ps(e,n);return e}function of(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function mu(i,e,t){if(!of(i)||!of(e))return NaN;let n=0,r=0;return i[2]<e[0]&&(n=e[0]-i[2]),i[0]>e[2]&&(n=i[0]-e[2]),i[1]>e[3]&&(r=i[1]-e[3]),i[3]<e[1]&&(r=e[1]-i[3]),t.distance([0,0],[n,r])}function wi(i,e,t){const n=t.pointOnLine(e,i);return t.distance(i,n.point)}function yu(i,e,t,n,r){const s=Math.min(wi(i,[t,n],r),wi(e,[t,n],r)),o=Math.min(wi(t,[i,e],r),wi(n,[i,e],r));return Math.min(s,o)}function wx(i,e,t,n,r){if(!(wn(e,i.length)&&wn(n,t.length)))return 1/0;let s=1/0;for(let o=e[0];o<e[1];++o){const a=i[o],l=i[o+1];for(let u=n[0];u<n[1];++u){const c=t[u],h=t[u+1];if(Lo(a,l,c,h))return 0;s=Math.min(s,yu(a,l,c,h,r))}}return s}function Ex(i,e,t,n,r){if(!(wn(e,i.length)&&wn(n,t.length)))return NaN;let s=1/0;for(let o=e[0];o<=e[1];++o)for(let a=n[0];a<=n[1];++a)if(s=Math.min(s,r.distance(i[o],t[a])),s===0)return s;return s}function vx(i,e,t){if(cr(i,e,!0))return 0;let n=1/0;for(const r of e){const s=r[0],o=r[r.length-1];if(s!==o&&(n=Math.min(n,wi(i,[o,s],t)),n===0))return n;const a=t.pointOnLine(r,i);if(n=Math.min(n,t.distance(i,a.point)),n===0)return n}return n}function Cx(i,e,t,n){if(!wn(e,i.length))return NaN;for(let s=e[0];s<=e[1];++s)if(cr(i[s],t,!0))return 0;let r=1/0;for(let s=e[0];s<e[1];++s){const o=i[s],a=i[s+1];for(const l of t)for(let u=0,c=l.length,h=c-1;u<c;h=u++){const d=l[h],f=l[u];if(Lo(o,a,d,f))return 0;r=Math.min(r,yu(o,a,d,f,n))}}return r}function af(i,e){for(const t of i)for(const n of t)if(cr(n,e,!0))return!0;return!1}function bx(i,e,t,n=1/0){const r=pu(i),s=pu(e);if(n!==1/0&&mu(r,s,t)>=n)return n;if(ms(r,s)){if(af(i,e))return 0}else if(af(e,i))return 0;let o=1/0;for(const a of i)for(let l=0,u=a.length,c=u-1;l<u;c=l++){const h=a[c],d=a[l];for(const f of e)for(let g=0,m=f.length,p=m-1;g<m;p=g++){const y=f[p],_=f[g];if(Lo(h,d,y,_))return 0;o=Math.min(o,yu(h,d,y,_,t))}}return o}function lf(i,e,t,n,r,s){if(!s)return;const o=mu(gu(n,s),r,t);o<e&&i.push([o,s,[0,0]])}function Oo(i,e,t,n,r,s,o){if(!s||!o)return;const a=mu(gu(n,s),gu(r,o),t);a<e&&i.push([a,s,o])}function ko(i,e,t,n,r=1/0){let s=Math.min(n.distance(i[0],t[0][0]),r);if(s===0)return s;const o=new ef([[0,[0,i.length-1],[0,0]]],sf),a=pu(t);for(;o.length>0;){const l=o.pop();if(l[0]>=s)continue;const u=l[1],c=e?du:hu;if(Fo(u)<=c){if(!wn(u,i.length))return NaN;if(e){const h=Cx(i,u,t,n);if(isNaN(h)||h===0)return h;s=Math.min(s,h)}else for(let h=u[0];h<=u[1];++h){const d=vx(i[h],t,n);if(s=Math.min(s,d),s===0)return 0}}else{const h=fu(u,e);lf(o,s,n,i,a,h[0]),lf(o,s,n,i,a,h[1])}}return s}function Do(i,e,t,n,r,s=1/0){let o=Math.min(s,r.distance(i[0],t[0]));if(o===0)return o;const a=new ef([[0,[0,i.length-1],[0,t.length-1]]],sf);for(;a.length>0;){const l=a.pop();if(l[0]>=o)continue;const u=l[1],c=l[2],h=e?du:hu,d=n?du:hu;if(Fo(u)<=h&&Fo(c)<=d){if(!wn(u,i.length)&&wn(c,t.length))return NaN;let f;if(e&&n)f=wx(i,u,t,c,r),o=Math.min(o,f);else if(e&&!n){const g=i.slice(u[0],u[1]+1);for(let m=c[0];m<=c[1];++m)if(f=wi(t[m],g,r),o=Math.min(o,f),o===0)return o}else if(!e&&n){const g=t.slice(c[0],c[1]+1);for(let m=u[0];m<=u[1];++m)if(f=wi(i[m],g,r),o=Math.min(o,f),o===0)return o}else f=Ex(i,u,t,c,r),o=Math.min(o,f)}else{const f=fu(u,e),g=fu(c,n);Oo(a,o,r,i,t,f[0],g[0]),Oo(a,o,r,i,t,f[0],g[1]),Oo(a,o,r,i,t,f[1],g[0]),Oo(a,o,r,i,t,f[1],g[1])}}return o}function Rx(i,e){const t=i.geometry(),n=t.flat().map(o=>au([o.x,o.y],i.canonical));if(t.length===0)return NaN;const r=new cu(n[0][1]);let s=1/0;for(const o of e){switch(o.type){case"Point":s=Math.min(s,Do(n,!1,[o.coordinates],!1,r,s));break;case"LineString":s=Math.min(s,Do(n,!1,o.coordinates,!0,r,s));break;case"Polygon":s=Math.min(s,ko(n,!1,o.coordinates,r,s));break}if(s===0)return s}return s}function Tx(i,e){const t=i.geometry(),n=t.flat().map(o=>au([o.x,o.y],i.canonical));if(t.length===0)return NaN;const r=new cu(n[0][1]);let s=1/0;for(const o of e){switch(o.type){case"Point":s=Math.min(s,Do(n,!0,[o.coordinates],!1,r,s));break;case"LineString":s=Math.min(s,Do(n,!0,o.coordinates,!0,r,s));break;case"Polygon":s=Math.min(s,ko(n,!0,o.coordinates,r,s));break}if(s===0)return s}return s}function Sx(i,e){const t=i.geometry();if(t.length===0||t[0].length===0)return NaN;const n=yx(t).map(o=>o.map(a=>a.map(l=>au([l.x,l.y],i.canonical)))),r=new cu(n[0][0][0][1]);let s=1/0;for(const o of e)for(const a of n){switch(o.type){case"Point":s=Math.min(s,ko([o.coordinates],!1,a,r,s));break;case"LineString":s=Math.min(s,ko(o.coordinates,!0,a,r,s));break;case"Polygon":s=Math.min(s,bx(a,o.coordinates,r,s));break}if(s===0)return s}return s}function _u(i){return i.type==="MultiPolygon"?i.coordinates.map(e=>({type:"Polygon",coordinates:e})):i.type==="MultiLineString"?i.coordinates.map(e=>({type:"LineString",coordinates:e})):i.type==="MultiPoint"?i.coordinates.map(e=>({type:"Point",coordinates:e})):[i]}var xu=class ma{constructor(e,t){this.type=z,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(fs(e[1])){const n=e[1];if(n.type==="FeatureCollection")return new ma(n,n.features.map(r=>_u(r.geometry)).flat());if(n.type==="Feature")return new ma(n,_u(n.geometry));if("type"in n&&"coordinates"in n)return new ma(n,_u(n))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return Rx(e,this.geometries);if(e.geometryType()==="LineString")return Tx(e,this.geometries);if(e.geometryType()==="Polygon")return Sx(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},wu=class qg{constructor(e){this.type=se,this.key=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=e[1];return n==null?t.error("Global state property must be defined."):typeof n!="string"?t.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new qg(n)}evaluate(e){const t=e.globals?.globalState;return!t||Object.keys(t).length===0?null:Fd(t,this.key)??null}eachChild(){}outputDefined(){return!1}};const No={"==":K_,"!=":$_,">":q_,"<":Z_,">=":J_,"<=":H_,array:xn,at:M_,boolean:xn,case:F_,coalesce:Ud,collator:Kd,format:ex,image:tx,in:A_,"index-of":P_,interpolate:xi,"interpolate-hcl":xi,"interpolate-lab":xi,length:nx,let:jd,literal:Ao,match:L_,number:xn,"number-format":Q_,object:xn,slice:O_,step:Vd,string:xn,"to-boolean":lr,"to-color":lr,"to-number":lr,"to-string":lr,var:Xd,within:uu,distance:xu,"global-state":wu};var Bn=class As{constructor(e,t,n,r){this.name=e,this.type=t,this._evaluate=n,this.args=r}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const n=e[0],r=As.definitions[n];if(!r)return t.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const s=Array.isArray(r)?r[0]:r.type,o=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,a=o.filter(([u])=>!Array.isArray(u)||u.length===e.length-1);let l=null;for(const[u,c]of a){l=new Gd(t.registry,zo,t.path,null,t.scope);const h=[];let d=!1;for(let f=1;f<e.length;f++){const g=e[f],m=Array.isArray(u)?u[f-1]:u.type,p=l.parse(g,1+h.length,m);if(!p){d=!0;break}h.push(p)}if(!d){if(Array.isArray(u)&&u.length!==h.length){l.error(`Expected ${u.length} arguments, but found ${h.length} instead.`);continue}for(let f=0;f<h.length;f++){const g=Array.isArray(u)?u[f]:u.type,m=h[f];l.concat(f+1).checkSubtype(g,m.type)}if(l.errors.length===0)return new As(n,s,c,h)}}if(a.length===1)t.errors.push(...l.errors);else{const u=(a.length?a:o).map(([h])=>Mx(h)).join(" | "),c=[];for(let h=1;h<e.length;h++){const d=t.parse(e[h],1+c.length);if(!d)return null;c.push(Ne(d.type))}t.error(`Expected arguments of type ${u}, but found (${c.join(", ")}) instead.`)}return null}static register(e,t){As.definitions=t;for(const n in t)e[n]=As}};function uf(i,[e,t,n,r]){e=e.evaluate(i),t=t.evaluate(i),n=n.evaluate(i);const s=r?r.evaluate(i):1,o=Dd(e,t,n,s);if(o)throw new je(o);return new Ge(e/255,t/255,n/255,s,!1)}function cf(i,e){return i in e}function Eu(i,e){const t=e[i];return typeof t>"u"?null:t}function Ix(i,e,t,n){for(;t<=n;){const r=t+n>>1;if(e[r]===i)return!0;e[r]>i?n=r-1:t=r+1}return!1}function Ei(i){return{type:i}}Bn.register(No,{error:[p_,[ee],(i,[e])=>{throw new je(e.evaluate(i))}],typeof:[ee,[se],(i,[e])=>Ne(He(e.evaluate(i)))],"to-rgba":[pt(z,4),[tn],(i,[e])=>{const[t,n,r,s]=e.evaluate(i).rgb;return[t*255,n*255,r*255,s]}],rgb:[tn,[z,z,z],uf],rgba:[tn,[z,z,z,z],uf],has:{type:ae,overloads:[[[ee],(i,[e])=>cf(e.evaluate(i),i.properties())],[[ee,mi],(i,[e,t])=>cf(e.evaluate(i),t.evaluate(i))]]},get:{type:se,overloads:[[[ee],(i,[e])=>Eu(e.evaluate(i),i.properties())],[[ee,mi],(i,[e,t])=>Eu(e.evaluate(i),t.evaluate(i))]]},"feature-state":[se,[ee],(i,[e])=>Eu(e.evaluate(i),i.featureState||{})],properties:[mi,[],i=>i.properties()],"geometry-type":[ee,[],i=>i.geometryType()],id:[se,[],i=>i.id()],zoom:[z,[],i=>i.globals.zoom],"heatmap-density":[z,[],i=>i.globals.heatmapDensity||0],elevation:[z,[],i=>i.globals.elevation||0],"line-progress":[z,[],i=>i.globals.lineProgress||0],accumulated:[se,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[z,Ei(z),(i,e)=>{let t=0;for(const n of e)t+=n.evaluate(i);return t}],"*":[z,Ei(z),(i,e)=>{let t=1;for(const n of e)t*=n.evaluate(i);return t}],"-":{type:z,overloads:[[[z,z],(i,[e,t])=>e.evaluate(i)-t.evaluate(i)],[[z],(i,[e])=>-e.evaluate(i)]]},"/":[z,[z,z],(i,[e,t])=>e.evaluate(i)/t.evaluate(i)],"%":[z,[z,z],(i,[e,t])=>e.evaluate(i)%t.evaluate(i)],ln2:[z,[],()=>Math.LN2],pi:[z,[],()=>Math.PI],e:[z,[],()=>Math.E],"^":[z,[z,z],(i,[e,t])=>Math.pow(e.evaluate(i),t.evaluate(i))],sqrt:[z,[z],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[z,[z],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[z,[z],(i,[e])=>Math.log(e.evaluate(i))],log2:[z,[z],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[z,[z],(i,[e])=>Math.sin(e.evaluate(i))],cos:[z,[z],(i,[e])=>Math.cos(e.evaluate(i))],tan:[z,[z],(i,[e])=>Math.tan(e.evaluate(i))],asin:[z,[z],(i,[e])=>Math.asin(e.evaluate(i))],acos:[z,[z],(i,[e])=>Math.acos(e.evaluate(i))],atan:[z,[z],(i,[e])=>Math.atan(e.evaluate(i))],min:[z,Ei(z),(i,e)=>Math.min(...e.map(t=>t.evaluate(i)))],max:[z,Ei(z),(i,e)=>Math.max(...e.map(t=>t.evaluate(i)))],abs:[z,[z],(i,[e])=>Math.abs(e.evaluate(i))],round:[z,[z],(i,[e])=>{const t=e.evaluate(i);return t<0?-Math.round(-t):Math.round(t)}],floor:[z,[z],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[z,[z],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[ae,[ee,se],(i,[e,t])=>i.properties()[e.value]===t.value],"filter-id-==":[ae,[se],(i,[e])=>i.id()===e.value],"filter-type-==":[ae,[ee],(i,[e])=>i.geometryType()===e.value],"filter-<":[ae,[ee,se],(i,[e,t])=>{const n=i.properties()[e.value],r=t.value;return typeof n==typeof r&&n<r}],"filter-id-<":[ae,[se],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t<n}],"filter->":[ae,[ee,se],(i,[e,t])=>{const n=i.properties()[e.value],r=t.value;return typeof n==typeof r&&n>r}],"filter-id->":[ae,[se],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t>n}],"filter-<=":[ae,[ee,se],(i,[e,t])=>{const n=i.properties()[e.value],r=t.value;return typeof n==typeof r&&n<=r}],"filter-id-<=":[ae,[se],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t<=n}],"filter->=":[ae,[ee,se],(i,[e,t])=>{const n=i.properties()[e.value],r=t.value;return typeof n==typeof r&&n>=r}],"filter-id->=":[ae,[se],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t>=n}],"filter-has":[ae,[se],(i,[e])=>e.value in i.properties()],"filter-has-id":[ae,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[ae,[pt(ee)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[ae,[pt(se)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[ae,[ee,pt(se)],(i,[e,t])=>t.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[ae,[ee,pt(se)],(i,[e,t])=>Ix(i.properties()[e.value],t.value,0,t.value.length-1)],all:{type:ae,overloads:[[[ae,ae],(i,[e,t])=>e.evaluate(i)&&t.evaluate(i)],[Ei(ae),(i,e)=>{for(const t of e)if(!t.evaluate(i))return!1;return!0}]]},any:{type:ae,overloads:[[[ae,ae],(i,[e,t])=>e.evaluate(i)||t.evaluate(i)],[Ei(ae),(i,e)=>{for(const t of e)if(t.evaluate(i))return!0;return!1}]]},"!":[ae,[ae],(i,[e])=>!e.evaluate(i)],"is-supported-script":[ae,[ee],(i,[e])=>{const t=i.globals&&i.globals.isSupportedScript;return t?t(e.evaluate(i)):!0}],upcase:[ee,[ee],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[ee,[ee],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[ee,Ei(se),(i,e)=>e.map(t=>gs(t.evaluate(i))).join("")],split:[pt(ee),[ee,ee],(i,[e,t])=>e.evaluate(i).split(t.evaluate(i))],join:[ee,[pt(ee),ee],(i,[e,t])=>e.evaluate(i).join(t.evaluate(i))],"resolved-locale":[ee,[bo],(i,[e])=>e.evaluate(i).resolvedLocale()]});function Mx(i){return Array.isArray(i)?`(${i.map(Ne).join(", ")})`:`(${Ne(i.type)}...)`}function zo(i){if(i instanceof Xd)return zo(i.boundExpression);if(i instanceof Bn&&i.name==="error")return!1;if(i instanceof Kd)return!1;if(i instanceof uu)return!1;if(i instanceof xu)return!1;if(i instanceof wu)return!1;const e=i instanceof lr||i instanceof xn;let t=!0;return i.eachChild(n=>{e?t=t&&zo(n):t=t&&n instanceof Ao}),t?vu(i)&&bu(i,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function vu(i){if(i instanceof Bn){if(i.name==="get"&&i.args.length===1)return!1;if(i.name==="feature-state")return!1;if(i.name==="has"&&i.args.length===1)return!1;if(i.name==="properties"||i.name==="geometry-type"||i.name==="id")return!1;if(/^filter-/.test(i.name))return!1}if(i instanceof uu||i instanceof xu)return!1;let e=!0;return i.eachChild(t=>{e&&!vu(t)&&(e=!1)}),e}function Cu(i){if(i instanceof Bn&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(t=>{e&&!Cu(t)&&(e=!1)}),e}function bu(i,e){if(i instanceof Bn&&e.indexOf(i.name)>=0)return!1;let t=!0;return i.eachChild(n=>{t&&!bu(n,e)&&(t=!1)}),t}function Ru(i){return{result:"success",value:i}}function hr(i){return{result:"error",value:i}}function Ax(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Px(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Lx(i){return!!i.expression&&i.expression.interpolated}function Go(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)&&He(i)===mi}var Fx=class{constructor(i,e,t){this.expression=i,this._warningHistory={},this._evaluator=new zd,this._defaultValue=e?kx(e):null,this._enumValues=e&&e.type==="enum"?e.values:null,this._globalState=t}evaluateWithoutErrorHandling(i,e,t,n,r,s){return this._globalState&&(i=dr(i,this._globalState)),this._evaluator.globals=i,this._evaluator.feature=e,this._evaluator.featureState=t,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(i,e,t,n,r,s){this._globalState&&(i=dr(i,this._globalState)),this._evaluator.globals=i,this._evaluator.feature=e||null,this._evaluator.featureState=t||null,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s||null;try{const o=this.expression.evaluate(this._evaluator);if(o==null||typeof o=="number"&&o!==o)return this._defaultValue;if(this._enumValues&&!(o in this._enumValues))throw new je(`Expected value to be one of ${Object.keys(this._enumValues).map(a=>JSON.stringify(a)).join(", ")}, but found ${JSON.stringify(o)} instead.`);return o}catch(o){return this._warningHistory[o.message]||(this._warningHistory[o.message]=!0,typeof console<"u"&&console.warn(o.message)),this._defaultValue}}};function jo(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in No}function hf(i,e,t){const n=new Gd(No,zo,[],e?Ox(e):void 0),r=n.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return r?Ru(new Fx(r,e,t)):hr(n.errors)}var df=class{constructor(i,e,t){this.kind=i,this._styleExpression=e,this.isStateDependent=i!=="constant"&&!Cu(e.expression),this.globalStateRefs=Wo(e.expression),this._globalState=t}evaluateWithoutErrorHandling(i,e,t,n,r,s){return this._globalState&&(i=dr(i,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(i,e,t,n,r,s)}evaluate(i,e,t,n,r,s){return this._globalState&&(i=dr(i,this._globalState)),this._styleExpression.evaluate(i,e,t,n,r,s)}},ff=class{constructor(i,e,t,n,r){this.kind=i,this.zoomStops=t,this._styleExpression=e,this.isStateDependent=i!=="camera"&&!Cu(e.expression),this.globalStateRefs=Wo(e.expression),this.interpolationType=n,this._globalState=r}evaluateWithoutErrorHandling(i,e,t,n,r,s){return this._globalState&&(i=dr(i,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(i,e,t,n,r,s)}evaluate(i,e,t,n,r,s){return this._globalState&&(i=dr(i,this._globalState)),this._styleExpression.evaluate(i,e,t,n,r,s)}interpolationFactor(i,e,t){return this.interpolationType?xi.interpolationFactor(this.interpolationType,i,e,t):0}};function gf(i,e,t){const n=hf(i,e,t);if(n.result==="error")return n;const r=n.value.expression,s=vu(r);if(!s&&!Ax(e))return hr([new en("","data expressions not supported")]);const o=bu(r,["zoom"]);if(!o&&!Px(e))return hr([new en("","zoom expressions not supported")]);const a=Xo(r);if(!a&&!o)return hr([new en("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof en)return hr([a]);if(a instanceof xi&&!Lx(e))return hr([new en("",'"interpolate" expressions cannot be used with this property')]);if(!a)return Ru(s?new df("constant",n.value,t):new df("source",n.value,t));const l=a instanceof xi?a.interpolation:void 0;return Ru(s?new ff("camera",n.value,a.labels,l,t):new ff("composite",n.value,a.labels,l,t))}function Xo(i){let e=null;if(i instanceof jd)e=Xo(i.result);else if(i instanceof Ud){for(const t of i.args)if(e=Xo(t),e)break}else(i instanceof Vd||i instanceof xi)&&i.input instanceof Bn&&i.input.name==="zoom"&&(e=i);return e instanceof en||i.eachChild(t=>{const n=Xo(t);n instanceof en?e=n:!e&&n?e=new en("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&n&&e!==n&&(e=new en("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Wo(i,e=new Set){return i instanceof wu&&e.add(i.key),i.eachChild(t=>{Wo(t,e)}),e}function Ox(i){const e={color:tn,string:ee,number:z,enum:ee,boolean:ae,formatted:Ro,padding:To,numberArray:So,colorArray:as,projectionDefinition:Co,resolvedImage:ls,variableAnchorOffsetCollection:Io};return i.type==="array"?pt(e[i.value]||se,i.length):e[i.type]}function kx(i){if(i.type==="color"&&Go(i.default))return new Ge(0,0,0,0);switch(i.type){case"color":return Ge.parse(i.default)||null;case"padding":return rr.parse(i.default)||null;case"numberArray":return sr.parse(i.default)||null;case"colorArray":return Yn.parse(i.default)||null;case"variableAnchorOffsetCollection":return or.parse(i.default)||null;case"projectionDefinition":return ds.parse(i.default)||null;default:return i.default===void 0?null:i.default}}function dr(i,e){const{zoom:t,heatmapDensity:n,elevation:r,lineProgress:s,isSupportedScript:o,accumulated:a}=i??{};return{zoom:t,heatmapDensity:n,elevation:r,lineProgress:s,isSupportedScript:o,accumulated:a,globalState:e}}function pf(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!pf(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Dx={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Nx(i,e){if(i==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};pf(i)||(i=Vo(i));const t=hf(i,Dx,e);if(t.result==="error")throw new Error(t.value.map(n=>`${n.key}: ${n.message}`).join(", "));return{filter:(n,r,s)=>t.value.evaluate(n,r,{},s),needGeometry:mf(i),getGlobalStateRefs:()=>Wo(t.value.expression)}}function zx(i,e){return i<e?-1:i>e?1:0}function mf(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let e=1;e<i.length;e++)if(mf(i[e]))return!0;return!1}function Vo(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?Tu(i[1],i[2],"=="):e==="!="?Uo(Tu(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Tu(i[1],i[2],e):e==="any"?Gx(i.slice(1)):e==="all"?["all"].concat(i.slice(1).map(Vo)):e==="none"?["all"].concat(i.slice(1).map(Vo).map(Uo)):e==="in"?yf(i[1],i.slice(2)):e==="!in"?Uo(yf(i[1],i.slice(2))):e==="has"?_f(i[1]):e==="!has"?Uo(_f(i[1])):!0}function Tu(i,e,t){switch(i){case"$type":return[`filter-type-${t}`,e];case"$id":return[`filter-id-${t}`,e];default:return[`filter-${t}`,i,e]}}function Gx(i){return["any"].concat(i.map(Vo))}function yf(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",i,["literal",e.sort(zx)]]:["filter-in-small",i,["literal",e]]}}function _f(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Uo(i){return["!",i]}function ys(i){return typeof i=="object"?["literal",i]:i}function xf(i,e){let t=i.stops;if(!t)return jx(i,e);const n=t&&typeof t[0][0]=="object",r=n||i.property!==void 0,s=n||!r;return t=t.map(o=>!r&&e.tokens&&typeof o[1]=="string"?[o[0],Ux(o[1])]:[o[0],ys(o[1])]),n?Xx(i,e,t):s?Vx(i,e,t):Iu(i,e,t)}function jx(i,e){const t=["get",i.property];if(i.default===void 0)return e.type==="string"?["string",t]:t;if(e.type==="enum")return["match",t,Object.keys(e.values),t,i.default];{const n=[e.type==="color"?"to-color":e.type,t,ys(i.default)];return e.type==="array"&&n.splice(1,0,e.value,e.length||null),n}}function Su(i){switch(i.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function Xx(i,e,t){const n={},r={},s=[];for(let o=0;o<t.length;o++){const a=t[o],l=a[0].zoom;n[l]===void 0&&(n[l]={zoom:l,type:i.type,property:i.property,default:i.default},r[l]=[],s.push(l)),r[l].push([a[0].value,a[1]])}if(Au({},e)==="exponential"){const o=[Su(i),["linear"],["zoom"]];for(const a of s)fr(o,a,Iu(n[a],e,r[a]),!1);return o}else{const o=["step",["zoom"]];for(const a of s)fr(o,a,Iu(n[a],e,r[a]),!0);return Mu(o),o}}function Wx(i,e){if(i!==void 0)return i;if(e!==void 0)return e}function wf(i,e){const t=ys(Wx(i.default,e.default));return t===void 0&&e.type==="resolvedImage"?"":t}function Iu(i,e,t){const n=Au(i,e),r=["get",i.property];if(n==="categorical"&&typeof t[0][0]=="boolean"){const s=["case"];for(const o of t)s.push(["==",r,o[0]],o[1]);return s.push(wf(i,e)),s}else if(n==="categorical"){const s=["match",r];for(const o of t)fr(s,o[0],o[1],!1);return s.push(wf(i,e)),s}else if(n==="interval"){const s=["step",["number",r]];for(const o of t)fr(s,o[0],o[1],!0);return Mu(s),i.default===void 0?s:["case",["==",["typeof",r],"number"],s,ys(i.default)]}else if(n==="exponential"){const s=i.base!==void 0?i.base:1,o=[Su(i),s===1?["linear"]:["exponential",s],["number",r]];for(const a of t)fr(o,a[0],a[1],!1);return i.default===void 0?o:["case",["==",["typeof",r],"number"],o,ys(i.default)]}else throw new Error(`Unknown property function type ${n}`)}function Vx(i,e,t,n=["zoom"]){const r=Au(i,e);let s,o=!1;if(r==="interval")s=["step",n],o=!0;else if(r==="exponential"){const a=i.base!==void 0?i.base:1;s=[Su(i),a===1?["linear"]:["exponential",a],n]}else throw new Error(`Unknown zoom function type "${r}"`);for(const a of t)fr(s,a[0],a[1],o);return Mu(s),s}function Mu(i){i[0]==="step"&&i.length===3&&(i.push(0),i.push(i[3]))}function fr(i,e,t,n){i.length>3&&e===i[i.length-2]||(n&&i.length===2||i.push(e),i.push(t))}function Au(i,e){return i.type?i.type:e.expression.interpolated?"exponential":"interval"}function Ux(i){const e=["concat"],t=/{([^{}]+)}/g;let n=0;for(let r=t.exec(i);r!==null;r=t.exec(i)){const s=i.slice(n,t.lastIndex-r[0].length);n=t.lastIndex,s.length>0&&e.push(s),e.push(["get",r[1]])}if(e.length===1)return i;if(n<i.length)e.push(i.slice(n));else if(e.length===2)return["to-string",e[1]];return e}const Ef=h_;class gr extends Zt{constructor(e){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_),e)if(typeof e.getSimplifiedGeometry=="function"){const t=e;this.setGeometry(t)}else{const t=e;this.setProperties(t)}}clone(){const e=new gr,t=this.geometryName_;e.setGeometryName(t);const n=this.getPropertiesInternal();if(n){const s=this.getGeometry();for(const o in n)o===t&&s?e.set(o,s.clone()):e.set(o,n[o],!0)}const r=this.getStyle();return r&&e.setStyle(r),e}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_&&(Me(this.geometryChangeKey_),this.geometryChangeKey_=null);const e=this.getGeometry();e&&(this.geometryChangeKey_=fe(e,$.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?Yx(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){e!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}}function Yx(i){if(typeof i=="function")return i;let e;return Array.isArray(i)?e=i:(xe(typeof i.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[i]),function(){return e}}function Yo(i,e,t,n,r,s,o){let a,l;const u=(t-e)/n;if(u===1)a=e;else if(u===2)a=e,l=r;else if(u!==0){let c=i[e],h=i[e+1],d=0;const f=[0];for(let p=e+n;p<t;p+=n){const y=i[p],_=i[p+1];d+=Math.sqrt((y-c)*(y-c)+(_-h)*(_-h)),f.push(d),c=y,h=_}const g=r*d,m=ip(f,g);m<0?(l=(g-f[-m-2])/(f[-m-1]-f[-m-2]),a=e+(-m-2)*n):a=e+m*n}o=o>1?o:2,s=s||new Array(o);for(let c=0;c<o;++c)s[c]=a===void 0?NaN:l===void 0?i[a+c]:Tt(i[a+c],i[a+n+c],l);return s}function Pu(i,e,t,n,r,s){if(t==e)return null;let o;if(r<i[e+n-1])return s?(o=i.slice(e,e+n),o[n-1]=r,o):null;if(i[t-1]<r)return s?(o=i.slice(t-n,t),o[n-1]=r,o):null;if(r==i[e+n-1])return i.slice(e,e+n);let a=e/n,l=t/n;for(;a<l;){const d=a+l>>1;r<i[(d+1)*n-1]?l=d:a=d+1}const u=i[a*n-1];if(r==u)return i.slice((a-1)*n,(a-1)*n+n);const c=i[(a+1)*n-1],h=(r-u)/(c-u);o=[];for(let d=0;d<n-1;++d)o.push(Tt(i[(a-1)*n+d],i[a*n+d],h));return o.push(r),o}function Bx(i,e,t,n,r,s,o){if(o)return Pu(i,e,t[t.length-1],n,r,s);let a;if(r<i[n-1])return s?(a=i.slice(0,n),a[n-1]=r,a):null;if(i[i.length-1]<r)return s?(a=i.slice(i.length-n),a[n-1]=r,a):null;for(let l=0,u=t.length;l<u;++l){const c=t[l];if(e!=c){if(r<i[e+n-1])return null;if(r<=i[c-1])return Pu(i,e,c,n,r,!1);e=c}}return null}function Lu(i,e,t,n){let r=i[e],s=i[e+1],o=0;for(let a=e+n;a<t;a+=n){const l=i[a],u=i[a+1];o+=Math.sqrt((l-r)*(l-r)+(u-s)*(u-s)),r=l,s=u}return o}class vi extends si{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendCoordinate(e){$t(this.flatCoordinates,e),this.changed()}clone(){const e=new vi(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<ei(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt($a(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),qa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,n,r))}forEachSegment(e){return uh(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return this.layout!="XYM"&&this.layout!="XYZM"?null:(t=t!==void 0?t:!1,Pu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return Dn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return Yo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return Lu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(e){const t=[];return t.length=Hs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new vi(t,"XY")}getType(){return"LineString"}intersectsExtent(e){return Js(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,this.getExtent())}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=qs(this.flatCoordinates,0,e,this.stride),this.changed()}}class _s extends si{constructor(e,t,n){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(t!==void 0&&n)this.setFlatCoordinates(t,e),this.ends_=n;else{const r=e,s=[],o=[];for(let l=0,u=r.length;l<u;++l){const c=r[l];$t(s,c.getFlatCoordinates()),o.push(s.length)}const a=r.length===0?this.getLayout():r[0].getLayout();this.setFlatCoordinates(a,s),this.ends_=o}}appendLineString(e){$t(this.flatCoordinates,e.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const e=new _s(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<ei(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Za(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ha(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,n,r))}getCoordinateAtM(e,t,n){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(t=t!==void 0?t:!1,n=n!==void 0?n:!1,Bx(this.flatCoordinates,0,this.ends_,this.stride,e,t,n))}getCoordinates(){return Fr(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new vi(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){const e=this.flatCoordinates,t=this.ends_,n=this.layout,r=[];let s=0;for(let o=0,a=t.length;o<a;++o){const l=t[o],u=new vi(e.slice(s,l),n);r.push(u),s=l}return r}getLength(){const e=this.ends_;let t=0,n=0;for(let r=0,s=e.length;r<s;++r)n+=Lu(this.flatCoordinates,t,e[r],this.stride),t=e[r];return n}getFlatMidpoints(){const e=[],t=this.flatCoordinates;let n=0;const r=this.ends_,s=this.stride;for(let o=0,a=r.length;o<a;++o){const l=r[o],u=Yo(t,n,l,s,.5);$t(e,u),n=l}return e}getSimplifiedGeometryInternal(e){const t=[],n=[];return t.length=ah(this.flatCoordinates,0,this.ends_,this.stride,e,t,0,n),new _s(t,"XY",n)}getType(){return"MultiLineString"}intersectsExtent(e){return Rm(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);const n=Lr(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}}class xs extends si{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){$t(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){const e=new xs(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){if(r<ei(this.getExtent(),e,t))return r;const s=this.flatCoordinates,o=this.stride;for(let a=0,l=s.length;a<l;a+=o){const u=Qn(e,t,s[a],s[a+1]);if(u<r){r=u;for(let c=0;c<o;++c)n[c]=s[a+c];n.length=o}}return r}getCoordinates(){return Dn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){const t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new dn(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){const e=this.flatCoordinates,t=this.layout,n=this.stride,r=[];for(let s=0,o=e.length;s<o;s+=n){const a=new dn(e.slice(s,s+n),t);r.push(a)}return r}getType(){return"MultiPoint"}intersectsExtent(e){const t=this.flatCoordinates,n=this.stride;for(let r=0,s=t.length;r<s;r+=n){const o=t[r],a=t[r+1];if(Ra(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=qs(this.flatCoordinates,0,e,this.stride),this.changed()}}function vf(i,e,t,n){const r=[];let s=St();for(let o=0,a=t.length;o<a;++o){const l=t[o];s=Ia(i,e,l[0],n),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),e=l[l.length-1]}return r}class ws extends si{constructor(e,t,n){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!n&&!Array.isArray(e[0])){const r=e,s=[],o=[];for(let a=0,l=r.length;a<l;++a){const u=r[a],c=s.length,h=u.getEnds();for(let d=0,f=h.length;d<f;++d)h[d]+=c;$t(s,u.getFlatCoordinates()),o.push(h)}t=r.length===0?this.getLayout():r[0].getLayout(),e=s,n=o}t!==void 0&&n?(this.setFlatCoordinates(t,e),this.endss_=n):this.setCoordinates(e,t)}appendPolygon(e){let t;if(!this.flatCoordinates)this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();else{const n=this.flatCoordinates.length;$t(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let r=0,s=t.length;r<s;++r)t[r]+=n}this.endss_.push(t),this.changed()}clone(){const e=this.endss_.length,t=new Array(e);for(let r=0;r<e;++r)t[r]=this.endss_[r].slice();const n=new ws(this.flatCoordinates.slice(),this.layout,t);return n.applyProperties(this),n}closestPointXY(e,t,n,r){return r<ei(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(_m(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),xm(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return bm(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return ym(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),rl(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,Ja(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const e=vf(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=lh(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new xs(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const e=this.flatCoordinates;dh(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=rl(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){const t=[],n=[];return t.length=vm(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(e),t,0,n),new ws(t,"XY",n)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(e===0)t=0;else{const s=this.endss_[e-1];t=s[s.length-1]}const n=this.endss_[e].slice(),r=n[n.length-1];if(t!==0)for(let s=0,o=n.length;s<o;++s)n[s]-=t;return new fn(this.flatCoordinates.slice(t,r),this.layout,n)}getPolygons(){const e=this.layout,t=this.flatCoordinates,n=this.endss_,r=[];let s=0;for(let o=0,a=n.length;o<a;++o){const l=n[o].slice(),u=l[l.length-1];if(s!==0)for(let h=0,d=l.length;h<d;++h)l[h]-=s;const c=new fn(t.slice(s,u),e,l);r.push(c),s=u}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return Tm(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);const n=oh(this.flatCoordinates,0,e,this.stride,this.endss_);if(n.length===0)this.flatCoordinates.length=0;else{const r=n[n.length-1];this.flatCoordinates.length=r.length===0?0:r[r.length-1]}this.changed()}}const Cf=vt();class ht{constructor(e,t,n,r,s,o){this.styleFunction,this.extent_,this.id_=o,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=n||null,this.properties_=s,this.squaredTolerance_,this.stride_=r,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?Sa(this.flatCoordinates_):Ia(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const e=Et(this.getExtent());this.flatInteriorPoints_=tl(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const e=fh(this.flatCoordinates_,this.ends_),t=vf(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=lh(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=Yo(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const e=this.flatCoordinates_;let t=0;const n=this.ends_;for(let r=0,s=n.length;r<s;++r){const o=n[r],a=Yo(e,t,o,this.stride_,.5);$t(this.flatMidpoints_,a),t=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){e=we(e);const t=e.getExtent(),n=e.getWorldExtent();if(t&&n){const r=Ke(n)/Ke(t);qt(Cf,n[0],n[3],r,-r,0,0,0),kn(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,Cf,this.flatCoordinates_)}}applyTransform(e){e(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new ht(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=gc((e,t)=>{if(e===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),t&&this.simplifiedGeometry_.applyTransform(t);const n=this.simplifiedGeometry_.getFlatCoordinates();let r;switch(this.type_){case"LineString":n.length=Hs(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),r=[n.length];break;case"MultiLineString":r=[],n.length=ah(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,r);break;case"Polygon":r=[],n.length=Qa(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(e),n,0,r);break}return r&&(this.simplifiedGeometry_=new ht(this.type_,n,r,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=e,this.simplifiedGeometry_}),this}}ht.prototype.getFlatCoordinates=ht.prototype.getOrientedFlatCoordinates;class Bo extends th{constructor(e){super(),this.geometries_=e,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(Me),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const e=this.geometries_;for(let t=0,n=e.length;t<n;++t)this.changeEventsKeys_.push(fe(e[t],$.CHANGE,this.changed,this))}clone(){const e=new Bo(Fu(this.geometries_));return e.applyProperties(this),e}closestPointXY(e,t,n,r){if(r<ei(this.getExtent(),e,t))return r;const s=this.geometries_;for(let o=0,a=s.length;o<a;++o)r=s[o].closestPointXY(e,t,n,r);return r}containsXY(e,t){const n=this.geometries_;for(let r=0,s=n.length;r<s;++r)if(n[r].containsXY(e,t))return!0;return!1}computeExtent(e){Oi(e);const t=this.geometries_;for(let n=0,r=t.length;n<r;++n)bc(e,t[n].getExtent());return e}getGeometries(){return Fu(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let e=[];const t=this.geometries_;for(let n=0,r=t.length;n<r;++n)t[n].getType()===this.getType()?e=e.concat(t[n].getGeometriesArrayRecursive()):e.push(t[n]);return e}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const t=[],n=this.geometries_;let r=!1;for(let s=0,o=n.length;s<o;++s){const a=n[s],l=a.getSimplifiedGeometry(e);t.push(l),l!==a&&(r=!0)}return r?new Bo(t):(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getType(){return"GeometryCollection"}intersectsExtent(e){const t=this.geometries_;for(let n=0,r=t.length;n<r;++n)if(t[n].intersectsExtent(e))return!0;return!1}isEmpty(){return this.geometries_.length===0}rotate(e,t){const n=this.geometries_;for(let r=0,s=n.length;r<s;++r)n[r].rotate(e,t);this.changed()}scale(e,t,n){n||(n=Et(this.getExtent()));const r=this.geometries_;for(let s=0,o=r.length;s<o;++s)r[s].scale(e,t,n);this.changed()}setGeometries(e){this.setGeometriesArray(Fu(e))}setGeometriesArray(e){this.unlistenGeometriesChange_(),this.geometries_=e,this.listenGeometriesChange_(),this.changed()}applyTransform(e){const t=this.geometries_;for(let n=0,r=t.length;n<r;++n)t[n].applyTransform(e);this.changed()}translate(e,t){const n=this.geometries_;for(let r=0,s=n.length;r<s;++r)n[r].translate(e,t);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function Fu(i){return i.map(e=>e.clone())}class bf{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=gr,this.supportedMediaTypes=null}getReadOptions(e,t){if(t){let n=t.dataProjection?we(t.dataProjection):this.readProjection(e);t.extent&&n&&n.getUnits()==="tile-pixels"&&(n=we(n),n.setWorldExtent(t.extent)),t={dataProjection:n,featureProjection:t.featureProjection}}return this.adaptOptions(t)}adaptOptions(e){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},e)}getType(){return J()}readFeature(e,t){return J()}readFeatures(e,t){return J()}readGeometry(e,t){return J()}readProjection(e){return J()}writeFeature(e,t){return J()}writeFeatures(e,t){return J()}writeGeometry(e,t){return J()}}function Ko(i,e,t){const n=t?we(t.featureProjection):null,r=t?we(t.dataProjection):null;let s=i;if(n&&r&&!ut(n,r)){e&&(s=i.clone());const o=e?n:r,a=e?r:n;o.getUnits()==="tile-pixels"?s.transform(o,a):s.applyTransform(ri(o,a))}if(e&&t&&t.decimals!==void 0){const o=Math.pow(10,t.decimals),a=function(l){for(let u=0,c=l.length;u<c;++u)l[u]=Math.round(l[u]*o)/o;return l};s===i&&(s=i.clone()),s.applyTransform(a)}return s}const Kx={Point:dn,LineString:vi,Polygon:fn,MultiPoint:xs,MultiLineString:_s,MultiPolygon:ws};function $x(i,e,t){return Array.isArray(e[0])?(dh(i,0,e,t)||(i=i.slice(),rl(i,0,e,t)),i):(il(i,0,e,t)||(i=i.slice(),Qs(i,0,e,t)),i)}function Rf(i,e){const t=i.geometry;if(!t)return[];if(Array.isArray(t))return t.map(s=>Rf({...i,geometry:s})).flat();const n=t.type==="MultiPolygon"?"Polygon":t.type;if(n==="GeometryCollection"||n==="Circle")throw new Error("Unsupported geometry type: "+n);const r=t.layout.length;return Ko(new ht(n,n==="Polygon"?$x(t.flatCoordinates,t.ends,r):t.flatCoordinates,t.ends?.flat(),r,i.properties||{},i.id).enableSimplifyTransformed(),!1,e)}function Ou(i,e){if(!i)return null;if(Array.isArray(i)){const n=i.map(r=>Ou(r,e));return new Bo(n)}const t=Kx[i.type];return Ko(new t(i.flatCoordinates,i.layout||"XY",i.ends),!1,e)}class Zx extends bf{constructor(){super()}getType(){return"json"}readFeature(e,t){return this.readFeatureFromObject($o(e),this.getReadOptions(e,t))}readFeatures(e,t){return this.readFeaturesFromObject($o(e),this.getReadOptions(e,t))}readFeatureFromObject(e,t){return J()}readFeaturesFromObject(e,t){return J()}readGeometry(e,t){return this.readGeometryFromObject($o(e),this.getReadOptions(e,t))}readGeometryFromObject(e,t){return J()}readProjection(e){return this.readProjectionFromObject($o(e))}readProjectionFromObject(e){return J()}writeFeature(e,t){return JSON.stringify(this.writeFeatureObject(e,t))}writeFeatureObject(e,t){return J()}writeFeatures(e,t){return JSON.stringify(this.writeFeaturesObject(e,t))}writeFeaturesObject(e,t){return J()}writeGeometry(e,t){return JSON.stringify(this.writeGeometryObject(e,t))}writeGeometryObject(e,t){return J()}}function $o(i){if(typeof i=="string"){const e=JSON.parse(i);return e||null}return i!==null?i:null}class Tf extends Zx{constructor(e){e=e||{},super(),this.dataProjection=we(e.dataProjection?e.dataProjection:"EPSG:4326"),e.featureProjection&&(this.defaultFeatureProjection=we(e.featureProjection)),e.featureClass&&(this.featureClass=e.featureClass),this.geometryName_=e.geometryName,this.extractGeometryName_=e.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(e,t){let n=null;e.type==="Feature"?n=e:n={type:"Feature",geometry:e,properties:null};const r=ku(n.geometry);if(this.featureClass===ht)return Rf({geometry:r,id:n.id,properties:n.properties},t);const s=new gr;return this.geometryName_?s.setGeometryName(this.geometryName_):this.extractGeometryName_&&n.geometry_name&&s.setGeometryName(n.geometry_name),s.setGeometry(Ou(r,t)),"id"in n&&s.setId(n.id),n.properties&&s.setProperties(n.properties,!0),s}readFeaturesFromObject(e,t){const n=e;let r=null;if(n.type==="FeatureCollection"){const s=e;r=[];const o=s.features;for(let a=0,l=o.length;a<l;++a){const u=this.readFeatureFromObject(o[a],t);u&&r.push(u)}}else r=[this.readFeatureFromObject(e,t)];return r.flat()}readGeometryFromObject(e,t){return qx(e,t)}readProjectionFromObject(e){const t=e.crs;let n;if(t)if(t.type=="name")n=we(t.properties.name);else if(t.type==="EPSG")n=we("EPSG:"+t.properties.code);else throw new Error("Unknown SRS type");else n=this.dataProjection;return n}writeFeatureObject(e,t){t=this.adaptOptions(t);const n={type:"Feature",geometry:null,properties:null},r=e.getId();if(r!==void 0&&(n.id=r),!e.hasProperties())return n;const s=e.getProperties(),o=e.getGeometry();return o&&(n.geometry=Du(o,t),delete s[e.getGeometryName()]),Sn(s)||(n.properties=s),n}writeFeaturesObject(e,t){t=this.adaptOptions(t);const n=[];for(let r=0,s=e.length;r<s;++r)n.push(this.writeFeatureObject(e[r],t));return{type:"FeatureCollection",features:n}}writeGeometryObject(e,t){return Du(e,this.adaptOptions(t))}}function ku(i,e){if(!i)return null;let t;switch(i.type){case"Point":{t=Jx(i);break}case"LineString":{t=Qx(i);break}case"Polygon":{t=i1(i);break}case"MultiPoint":{t=t1(i);break}case"MultiLineString":{t=e1(i);break}case"MultiPolygon":{t=n1(i);break}case"GeometryCollection":{t=Hx(i);break}default:throw new Error("Unsupported GeoJSON type: "+i.type)}return t}function qx(i,e){const t=ku(i);return Ou(t,e)}function Hx(i,e){return i.geometries.map(function(n){return ku(n)})}function Jx(i){const e=i.coordinates;return{type:"Point",flatCoordinates:e,layout:oi(e.length)}}function Qx(i){const e=i.coordinates,t=e.flat();return{type:"LineString",flatCoordinates:t,ends:[t.length],layout:oi(e[0]?.length||2)}}function e1(i){const e=i.coordinates,t=e[0]?.[0]?.length||2,n=[],r=Lr(n,0,e,t);return{type:"MultiLineString",flatCoordinates:n,ends:r,layout:oi(t)}}function t1(i){const e=i.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:oi(e[0]?.length||2)}}function n1(i){const e=i.coordinates,t=[],n=e[0]?.[0]?.[0].length||2,r=oh(t,0,e,n);return{type:"MultiPolygon",flatCoordinates:t,ends:r,layout:oi(n)}}function i1(i){const e=i.coordinates,t=[],n=e[0]?.[0]?.length,r=Lr(t,0,e,n);return{type:"Polygon",flatCoordinates:t,ends:r,layout:oi(n)}}function Du(i,e){i=Ko(i,!0,e);const t=i.getType();let n;switch(t){case"Point":{n=u1(i);break}case"LineString":{n=s1(i);break}case"Polygon":{n=c1(i,e);break}case"MultiPoint":{n=a1(i);break}case"MultiLineString":{n=o1(i);break}case"MultiPolygon":{n=l1(i,e);break}case"GeometryCollection":{n=r1(i,e);break}case"Circle":{n={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+t)}return n}function r1(i,e){return e=Object.assign({},e),delete e.featureProjection,{type:"GeometryCollection",geometries:i.getGeometriesArray().map(function(n){return Du(n,e)})}}function s1(i,e){return{type:"LineString",coordinates:i.getCoordinates()}}function o1(i,e){return{type:"MultiLineString",coordinates:i.getCoordinates()}}function a1(i,e){return{type:"MultiPoint",coordinates:i.getCoordinates()}}function l1(i,e){let t;return e&&(t=e.rightHanded),{type:"MultiPolygon",coordinates:i.getCoordinates(t)}}function u1(i,e){return{type:"Point",coordinates:i.getCoordinates()}}function c1(i,e){let t;return e&&(t=e.rightHanded),{type:"Polygon",coordinates:i.getCoordinates(t)}}const Nu=65536*65536,Sf=1/Nu,h1=12,If=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),zu=0,Zo=1,Es=2,qo=5;class d1{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,n=this.length){for(;this.pos<n;){const r=this.readVarint(),s=r>>3,o=this.pos;this.type=r&7,e(s,t,this),this.pos===o&&this.skip(r)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Nu;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Nu;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf;let n,r;return r=t[this.pos++],n=r&127,r<128||(r=t[this.pos++],n|=(r&127)<<7,r<128)||(r=t[this.pos++],n|=(r&127)<<14,r<128)||(r=t[this.pos++],n|=(r&127)<<21,r<128)?n:(r=t[this.pos],n|=(r&15)<<28,f1(n,e,this))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2===1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=h1&&If?If.decode(this.buf.subarray(t,e)):T1(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===Es?this.readVarint()+this.pos:this.pos+1}skip(e){const t=e&7;if(t===zu)for(;this.buf[this.pos++]>127;);else if(t===Es)this.pos=this.readVarint()+this.pos;else if(t===qo)this.pos+=4;else if(t===Zo)this.pos+=8;else throw new Error(`Unimplemented type: ${t}`)}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.dataView=new DataView(n.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Sf),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Sf),!0),this.pos+=8}writeVarint(e){if(e=+e||0,e>268435455||e<0){g1(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))}writeSVarint(e){this.writeVarint(e<0?-e*2-1:e*2)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(e.length*4),this.pos++;const t=this.pos;this.pos=S1(this.buf,e,this.pos);const n=this.pos-t;n>=128&&Mf(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t);for(let n=0;n<t;n++)this.buf[this.pos++]=e[n]}writeRawMessage(e,t){this.pos++;const n=this.pos;e(t,this);const r=this.pos-n;r>=128&&Mf(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r}writeMessage(e,t,n){this.writeTag(e,Es),this.writeRawMessage(t,n)}writePackedVarint(e,t){t.length&&this.writeMessage(e,y1,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,_1,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,E1,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,x1,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,w1,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,v1,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,C1,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,b1,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,R1,t)}writeBytesField(e,t){this.writeTag(e,Es),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,qo),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,qo),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,Zo),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,Zo),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,zu),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,zu),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,Es),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,qo),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,Zo),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function f1(i,e,t){const n=t.buf;let r,s;if(s=n[t.pos++],r=(s&112)>>4,s<128||(s=n[t.pos++],r|=(s&127)<<3,s<128)||(s=n[t.pos++],r|=(s&127)<<10,s<128)||(s=n[t.pos++],r|=(s&127)<<17,s<128)||(s=n[t.pos++],r|=(s&127)<<24,s<128)||(s=n[t.pos++],r|=(s&1)<<31,s<128))return pr(i,r,e);throw new Error("Expected varint not more than 10 bytes")}function pr(i,e,t){return t?e*4294967296+(i>>>0):(e>>>0)*4294967296+(i>>>0)}function g1(i,e){let t,n;if(i>=0?(t=i%4294967296|0,n=i/4294967296|0):(t=~(-i%4294967296),n=~(-i/4294967296),t^4294967295?t=t+1|0:(t=0,n=n+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),p1(t,n,e),m1(n,e)}function p1(i,e,t){t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos]=i&127}function m1(i,e){const t=(i&7)<<4;e.buf[e.pos++]|=t|((i>>>=3)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127)))))}function Mf(i,e,t){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));t.realloc(n);for(let r=t.pos-1;r>=i;r--)t.buf[r+n]=t.buf[r]}function y1(i,e){for(let t=0;t<i.length;t++)e.writeVarint(i[t])}function _1(i,e){for(let t=0;t<i.length;t++)e.writeSVarint(i[t])}function x1(i,e){for(let t=0;t<i.length;t++)e.writeFloat(i[t])}function w1(i,e){for(let t=0;t<i.length;t++)e.writeDouble(i[t])}function E1(i,e){for(let t=0;t<i.length;t++)e.writeBoolean(i[t])}function v1(i,e){for(let t=0;t<i.length;t++)e.writeFixed32(i[t])}function C1(i,e){for(let t=0;t<i.length;t++)e.writeSFixed32(i[t])}function b1(i,e){for(let t=0;t<i.length;t++)e.writeFixed64(i[t])}function R1(i,e){for(let t=0;t<i.length;t++)e.writeSFixed64(i[t])}function T1(i,e,t){let n="",r=e;for(;r<t;){const s=i[r];let o=null,a=s>239?4:s>223?3:s>191?2:1;if(r+a>t)break;let l,u,c;a===1?s<128&&(o=s):a===2?(l=i[r+1],(l&192)===128&&(o=(s&31)<<6|l&63,o<=127&&(o=null))):a===3?(l=i[r+1],u=i[r+2],(l&192)===128&&(u&192)===128&&(o=(s&15)<<12|(l&63)<<6|u&63,(o<=2047||o>=55296&&o<=57343)&&(o=null))):a===4&&(l=i[r+1],u=i[r+2],c=i[r+3],(l&192)===128&&(u&192)===128&&(c&192)===128&&(o=(s&15)<<18|(l&63)<<12|(u&63)<<6|c&63,(o<=65535||o>=1114112)&&(o=null))),o===null?(o=65533,a=1):o>65535&&(o-=65536,n+=String.fromCharCode(o>>>10&1023|55296),o=56320|o&1023),n+=String.fromCharCode(o),r+=a}return n}function S1(i,e,t){for(let n=0,r,s;n<e.length;n++){if(r=e.charCodeAt(n),r>55295&&r<57344)if(s)if(r<56320){i[t++]=239,i[t++]=191,i[t++]=189,s=r;continue}else r=s-55296<<10|r-56320|65536,s=null;else{r>56319||n+1===e.length?(i[t++]=239,i[t++]=191,i[t++]=189):s=r;continue}else s&&(i[t++]=239,i[t++]=191,i[t++]=189,s=null);r<128?i[t++]=r:(r<2048?i[t++]=r>>6|192:(r<65536?i[t++]=r>>12|224:(i[t++]=r>>18|240,i[t++]=r>>12&63|128),i[t++]=r>>6&63|128),i[t++]=r&63|128)}return t}class Af extends bf{constructor(e){super(),e=e||{},this.dataProjection=new Vs({code:"",units:"tile-pixels"}),this.featureClass=e.featureClass?e.featureClass:ht,this.geometryName_=e.geometryName,this.layerName_=e.layerName?e.layerName:"layer",this.layers_=e.layers?e.layers:null,this.idProperty_=e.idProperty,this.supportedMediaTypes=["application/vnd.mapbox-vector-tile","application/x-protobuf"]}readRawGeometry_(e,t,n,r){e.pos=t.geometry;const s=e.readVarint()+e.pos;let o=1,a=0,l=0,u=0,c=0,h=0;for(;e.pos<s;){if(!a){const d=e.readVarint();o=d&7,a=d>>3}if(a--,o===1||o===2)l+=e.readSVarint(),u+=e.readSVarint(),o===1&&c>h&&(r.push(c),h=c),n.push(l,u),c+=2;else if(o===7)c>h&&(n.push(n[h],n[h+1]),c+=2);else throw new Error("Invalid command found in the PBF")}c>h&&(r.push(c),h=c)}createFeature_(e,t,n){const r=t.type;if(r===0)return null;let s;const o=t.properties;let a;this.idProperty_?(a=o[this.idProperty_],delete o[this.idProperty_]):a=t.id,o[this.layerName_]=t.layer.name;const l=[],u=[];this.readRawGeometry_(e,t,l,u);const c=L1(r,u.length);if(this.featureClass===ht)s=new this.featureClass(c,l,u,2,o,a),s.transform(n.dataProjection);else{let h;if(c=="Polygon"){const g=fh(l,u);h=g.length>1?new ws(l,"XY",g):new fn(l,"XY",u)}else h=c==="Point"?new dn(l,"XY"):c==="LineString"?new vi(l,"XY"):c==="MultiPoint"?new xs(l,"XY"):c==="MultiLineString"?new _s(l,"XY",u):null;const d=this.featureClass;s=new d,this.geometryName_&&s.setGeometryName(this.geometryName_);const f=Ko(h,!1,n);s.setGeometry(f),a!==void 0&&s.setId(a),s.setProperties(o,!0)}return s}getType(){return"arraybuffer"}readFeatures(e,t){const n=this.layers_;t=this.adaptOptions(t);const r=we(t.dataProjection);r.setWorldExtent(t.extent),t.dataProjection=r;const s=new d1(e),o=s.readFields(I1,{}),a=[];for(const l in o){if(n&&!n.includes(l))continue;const u=o[l],c=u?[0,0,u.extent,u.extent]:null;r.setExtent(c);for(let h=0,d=u.length;h<d;++h){const f=P1(s,u,h),g=this.createFeature_(s,f,t);g!==null&&a.push(g)}}return a}readProjection(e){return this.dataProjection}setLayers(e){this.layers_=e}}function I1(i,e,t){if(i===3){const n={keys:[],values:[],features:[]},r=t.readVarint()+t.pos;t.readFields(M1,n,r),n.length=n.features.length,n.length&&(e[n.name]=n)}}function M1(i,e,t){if(i===15)e.version=t.readVarint();else if(i===1)e.name=t.readString();else if(i===5)e.extent=t.readVarint();else if(i===2)e.features.push(t.pos);else if(i===3)e.keys.push(t.readString());else if(i===4){let n=null;const r=t.readVarint()+t.pos;for(;t.pos<r;)i=t.readVarint()>>3,n=i===1?t.readString():i===2?t.readFloat():i===3?t.readDouble():i===4?t.readVarint64():i===5?t.readVarint():i===6?t.readSVarint():i===7?t.readBoolean():null;e.values.push(n)}}function A1(i,e,t){if(i==1)e.id=t.readVarint();else if(i==2){const n=t.readVarint()+t.pos;for(;t.pos<n;){const r=e.layer.keys[t.readVarint()],s=e.layer.values[t.readVarint()];e.properties[r]=s}}else i==3?e.type=t.readVarint():i==4&&(e.geometry=t.pos)}function P1(i,e,t){i.pos=e.features[t];const n=i.readVarint()+i.pos,r={layer:e,type:0,properties:{}};return i.readFields(A1,r,n),r}function L1(i,e){let t;return i===1?t=e===1?"Point":"MultiPoint":i===2?t=e===1?"LineString":"MultiLineString":i===3&&(t="Polygon"),t}class Pf{drawCustom(e,t,n,r,s){}drawGeometry(e){}setStyle(e){}drawCircle(e,t,n){}drawFeature(e,t,n){}drawGeometryCollection(e,t,n){}drawLineString(e,t,n){}drawMultiLineString(e,t,n){}drawMultiPoint(e,t,n){}drawMultiPolygon(e,t,n){}drawPoint(e,t,n){}drawPolygon(e,t,n){}drawText(e,t,n){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}}const Y={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},Ho=[Y.FILL],Kn=[Y.STROKE],Ci=[Y.BEGIN_PATH],Lf=[Y.CLOSE_PATH];class vs extends Pf{constructor(e,t,n,r){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=r,this.maxLineWidth=0,this.resolution=n,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(e){const t=this.pixelRatio;return t==1?e:e.map(function(n){return n*t})}appendFlatPointCoordinates(e,t){const n=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,s=this.coordinates;let o=s.length;for(let a=0,l=e.length;a<l;a+=t)r[0]=e[a],r[1]=e[a+1],ti(n,r)&&(s[o++]=r[0],s[o++]=r[1]);return o}appendFlatLineCoordinates(e,t,n,r,s,o){const a=this.coordinates;let l=a.length;const u=this.getBufferedMaxExtent();o&&(t+=r);let c=e[t],h=e[t+1];const d=this.tmpCoordinate_;let f=!0,g,m,p;for(g=t+r;g<n;g+=r)d[0]=e[g],d[1]=e[g+1],p=Ta(u,d),p!==m?(f&&(a[l++]=c,a[l++]=h,f=!1),a[l++]=d[0],a[l++]=d[1]):p===tt.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],f=!1):f=!0,c=d[0],h=d[1],m=p;return(s&&f||g===t+r)&&(a[l++]=c,a[l++]=h),l}drawCustomCoordinates_(e,t,n,r,s){for(let o=0,a=n.length;o<a;++o){const l=n[o],u=this.appendFlatLineCoordinates(e,t,l,r,!1,!1);s.push(u),t=l}return t}drawCustom(e,t,n,r,s){this.beginGeometry(e,t,s);const o=e.getType(),a=e.getStride(),l=this.coordinates.length;let u,c,h,d,f;switch(o){case"MultiPolygon":u=e.getOrientedFlatCoordinates(),d=[];const g=e.getEndss();f=0;for(let m=0,p=g.length;m<p;++m){const y=[];f=this.drawCustomCoordinates_(u,f,g[m],a,y),d.push(y)}this.instructions.push([Y.CUSTOM,l,d,e,n,Ja,s]),this.hitDetectionInstructions.push([Y.CUSTOM,l,d,e,r||n,Ja,s]);break;case"Polygon":case"MultiLineString":h=[],u=o=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),f=this.drawCustomCoordinates_(u,0,e.getEnds(),a,h),this.instructions.push([Y.CUSTOM,l,h,e,n,Fr,s]),this.hitDetectionInstructions.push([Y.CUSTOM,l,h,e,r||n,Fr,s]);break;case"LineString":case"Circle":u=e.getFlatCoordinates(),c=this.appendFlatLineCoordinates(u,0,u.length,a,!1,!1),this.instructions.push([Y.CUSTOM,l,c,e,n,Dn,s]),this.hitDetectionInstructions.push([Y.CUSTOM,l,c,e,r||n,Dn,s]);break;case"MultiPoint":u=e.getFlatCoordinates(),c=this.appendFlatPointCoordinates(u,a),c>l&&(this.instructions.push([Y.CUSTOM,l,c,e,n,Dn,s]),this.hitDetectionInstructions.push([Y.CUSTOM,l,c,e,r||n,Dn,s]));break;case"Point":u=e.getFlatCoordinates(),this.coordinates.push(u[0],u[1]),c=this.coordinates.length,this.instructions.push([Y.CUSTOM,l,c,e,n,void 0,s]),this.hitDetectionInstructions.push([Y.CUSTOM,l,c,e,r||n,void 0,s]);break}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[Y.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[Y.BEGIN_GEOMETRY,t,0,e,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const e=this.hitDetectionInstructions;e.reverse();let t;const n=e.length;let r,s,o=-1;for(t=0;t<n;++t)r=e[t],s=r[0],s==Y.END_GEOMETRY?o=t:s==Y.BEGIN_GEOMETRY&&(r[2]=t,sp(this.hitDetectionInstructions,o,t),o=-1)}fillStyleToState(e,t={}){if(e){const n=e.getColor();t.fillPatternScale=n&&typeof n=="object"&&"src"in n?this.pixelRatio:1,t.fillStyle=Jt(n||bt)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){const n=e.getColor();t.strokeStyle=Jt(n||Qt);const r=e.getLineCap();t.lineCap=r!==void 0?r:Ki;const s=e.getLineDash();t.lineDash=s?s.slice():gn;const o=e.getLineDashOffset();t.lineDashOffset=o||pn;const a=e.getLineJoin();t.lineJoin=a!==void 0?a:$i;const l=e.getWidth();t.lineWidth=l!==void 0?l:Jr;const u=e.getMiterLimit();t.miterLimit=u!==void 0?u:qr;const c=e.getOffset();t.strokeOffset=c??r0,t.lineWidth>this.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0,t.strokeOffset=void 0;return t}setFillStrokeStyle(e,t){const n=this.state;this.fillStyleToState(e,n),this.strokeStyleToState(t,n)}createFill(e){const t=e.fillStyle,n=[Y.SET_FILL_STYLE,t];return typeof t!="string"&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[Y.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){const n=e.fillStyle;(n!==void 0&&typeof n!="string"||e.currentFillStyle!=n)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=n)}updateStrokeStyle(e,t){const n=e.strokeStyle,r=e.lineCap,s=e.lineDash,o=e.lineDashOffset,a=e.lineJoin,l=e.lineWidth,u=e.miterLimit,c=e.strokeOffset;(e.currentStrokeStyle!=n||e.currentLineCap!=r||s!=e.currentLineDash&&!In(e.currentLineDash,s)||e.currentLineDashOffset!=o||e.currentLineJoin!=a||e.currentLineWidth!=l||e.currentMiterLimit!=u||e.currentStrokeOffset!=c)&&(t.call(this,e),e.currentStrokeStyle=n,e.currentLineCap=r,e.currentLineDash=s,e.currentLineDashOffset=o,e.currentLineJoin=a,e.currentLineWidth=l,e.currentMiterLimit=u,e.currentStrokeOffset=c)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const t=[Y.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Cc(this.maxExtent),this.maxLineWidth>0)){const e=this.resolution*(this.maxLineWidth+1)/2;sn(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class F1 extends vs{constructor(e,t,n,r){super(e,t,n,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(e,t,n){if(!this.image_||this.maxExtent&&!ti(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,n);const r=e.getFlatCoordinates(),s=e.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,s);this.instructions.push([Y.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([Y.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(t)}drawMultiPoint(e,t,n){if(!this.image_)return;this.beginGeometry(e,t,n);const r=e.getFlatCoordinates(),s=[];for(let l=0,u=r.length;l<u;l+=e.getStride())(!this.maxExtent||ti(this.maxExtent,r.slice(l,l+2)))&&s.push(r[l],r[l+1]);const o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,2);this.instructions.push([Y.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([Y.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(t)}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(e,t){const n=e.getAnchor(),r=e.getSize(),s=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=r[1],this.opacity_=e.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=r[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}}class O1 extends vs{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinates_(e,t,n,r,s){const o=this.coordinates.length,a=this.appendFlatLineCoordinates(e,t,n,r,!1,!1);return this.instructions.push([Y.MOVE_TO_LINE_TO,o,a,s*this.pixelRatio]),this.hitDetectionInstructions.push([Y.MOVE_TO_LINE_TO,o,a,s]),n}drawLineString(e,t,n){const 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(e,t,n),this.hitDetectionInstructions.push([Y.SET_STROKE_STYLE,Qt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,gn,pn],Ci);const l=e.getFlatCoordinates(),u=e.getStride();this.drawFlatCoordinates_(l,0,l.length,u,a),this.hitDetectionInstructions.push(Kn),this.endGeometry(t)}drawMultiLineString(e,t,n){const 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(e,t,n),this.hitDetectionInstructions.push([Y.SET_STROKE_STYLE,Qt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,gn,pn],Ci);const l=e.getEnds(),u=e.getFlatCoordinates(),c=e.getStride();let h=0;for(let d=0,f=l.length;d<f;++d)h=this.drawFlatCoordinates_(u,h,l[d],c,a);this.hitDetectionInstructions.push(Kn),this.endGeometry(t)}finish(){const e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(Kn),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(Kn),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(Ci)}}class Ff extends vs{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinatess_(e,t,n,r,s){const o=this.state,a=o.fillStyle!==void 0,l=o.strokeStyle!==void 0,u=n.length;this.instructions.push(Ci),this.hitDetectionInstructions.push(Ci);for(let c=0;c<u;++c){const h=n[c],d=this.coordinates.length,f=this.appendFlatLineCoordinates(e,t,h,r,!0,!l);this.instructions.push([Y.MOVE_TO_LINE_TO,d,f,s*this.pixelRatio,!0]),this.hitDetectionInstructions.push([Y.MOVE_TO_LINE_TO,d,f,s,!0]),l&&(this.instructions.push(Lf),this.hitDetectionInstructions.push(Lf)),t=h}return a&&(this.instructions.push(Ho),this.hitDetectionInstructions.push(Ho)),l&&(this.instructions.push(Kn),this.hitDetectionInstructions.push(Kn)),t}drawCircle(e,t,n){const r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawCircle(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([Y.SET_FILL_STYLE,bt]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([Y.SET_STROKE_STYLE,Qt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,gn,pn]);const l=e.getFlatCoordinates(),u=e.getStride(),c=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,u,!1,!1);const h=[Y.CIRCLE,c,a];this.instructions.push(Ci,h),this.hitDetectionInstructions.push(Ci,h),r.fillStyle!==void 0&&(this.instructions.push(Ho),this.hitDetectionInstructions.push(Ho)),r.strokeStyle!==void 0&&(this.instructions.push(Kn),this.hitDetectionInstructions.push(Kn)),this.endGeometry(t)}drawPolygon(e,t,n){const r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([Y.SET_FILL_STYLE,bt]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([Y.SET_STROKE_STYLE,Qt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,gn,pn]);const l=e.getEnds(),u=e.getOrientedFlatCoordinates(),c=e.getStride();this.drawFlatCoordinatess_(u,0,l,c,a),this.endGeometry(t)}drawMultiPolygon(e,t,n){const r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([Y.SET_FILL_STYLE,bt]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([Y.SET_STROKE_STYLE,Qt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,gn,pn]);const l=e.getEndss(),u=e.getOrientedFlatCoordinates(),c=e.getStride();let h=0;for(let d=0,f=l.length;d<f;++d)h=this.drawFlatCoordinatess_(u,h,l[d],c,a);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const e=this.tolerance;if(e!==0){const t=this.coordinates;for(let n=0,r=t.length;n<r;++n)t[n]=ai(t[n],e)}return super.finish()}setFillStrokeStyles_(){const e=this.state;this.updateFillStyle(e,this.createFill),this.updateStrokeStyle(e,this.applyStroke)}handleStrokeOffset_(e){const t=this.state,n=t.fillStyle,r=t.strokeStyle,s=t.strokeOffset;return Math.abs(s)>0&&n!==void 0&&r!==void 0?(t.strokeStyle=void 0,t.strokeOffset=0,e(),t.fillStyle=void 0,t.strokeStyle=r,t.strokeOffset=s,e(),t.fillStyle=n,!0):!1}}function k1(i,e,t,n,r){const s=[];let o=t,a=0,l=e.slice(t,2);for(;a<i&&o+r<n;){const[u,c]=l.slice(-2),h=e[o+r],d=e[o+r+1],f=Math.sqrt((h-u)*(h-u)+(d-c)*(d-c));if(a+=f,a>=i){const g=(i-a+f)/f,m=Tt(u,h,g),p=Tt(c,d,g);l.push(m,p),s.push(l),l=[m,p],a==i&&(o+=r),a=0}else if(a<i)l.push(e[o+r],e[o+r+1]),o+=r;else{const g=f-a,m=Tt(u,h,g/f),p=Tt(c,d,g/f);l.push(m,p),s.push(l),l=[m,p],a=0,o+=r}}return a>0&&s.push(l),s}function D1(i,e,t,n,r){let s=t,o=t,a=0,l=0,u=t,c,h,d,f,g,m,p,y,_,E;for(h=t;h<n;h+=r){const x=e[h],w=e[h+1];g!==void 0&&(_=x-g,E=w-m,f=Math.sqrt(_*_+E*E),p!==void 0&&(l+=d,c=Math.acos((p*_+y*E)/(d*f)),c>i&&(l>a&&(a=l,s=u,o=h),l=0,u=h-r)),d=f,p=_,y=E),g=x,m=w}return l+=f,l>a?[u,h]:[s,o]}const Jo={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class N1 extends vs{constructor(e,t,n,r){super(e,t,n,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[bt]={fillStyle:bt},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,n){const r=this.textFillState_,s=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!r&&!s)return;const a=this.coordinates;let l=a.length;const u=e.getType();let c=null,h=e.getStride();if(o.placement==="line"&&(u=="LineString"||u=="MultiLineString"||u=="Polygon"||u=="MultiPolygon")){if(!Ue(this.maxExtent,e.getExtent()))return;let d;if(c=e.getFlatCoordinates(),u=="LineString")d=[c.length];else if(u=="MultiLineString")d=e.getEnds();else if(u=="Polygon")d=e.getEnds().slice(0,1);else if(u=="MultiPolygon"){const p=e.getEndss();d=[];for(let y=0,_=p.length;y<_;++y)d.push(p[y][0])}this.beginGeometry(e,t,n);const f=o.repeat,g=f?void 0:o.textAlign;let m=0;for(let p=0,y=d.length;p<y;++p){let _;f?_=k1(f*this.resolution,c,m,d[p],h):_=[c.slice(m,d[p])];for(let E=0,x=_.length;E<x;++E){const w=_[E];let C=0,b=w.length;if(g==null){const R=D1(o.maxAngle,w,0,w.length,2);C=R[0],b=R[1]}for(let R=C;R<b;R+=h)a.push(w[R],w[R+1]);const v=a.length;m=d[p],this.drawChars_(l,v),l=v}}this.endGeometry(t)}else{let d=o.overflow?null:[];switch(u){case"Point":case"MultiPoint":c=e.getFlatCoordinates();break;case"LineString":c=e.getFlatMidpoint();break;case"Circle":c=e.getCenter();break;case"MultiLineString":c=e.getFlatMidpoints(),h=2;break;case"Polygon":c=e.getFlatInteriorPoint(),o.overflow||d.push(c[2]/this.resolution),h=3;break;case"MultiPolygon":const x=e.getFlatInteriorPoints();c=[];for(let w=0,C=x.length;w<C;w+=3)o.overflow||d.push(x[w+2]/this.resolution),c.push(x[w],x[w+1]);if(c.length===0)return;h=2;break}const f=this.appendFlatPointCoordinates(c,h);if(f===l)return;if(d&&(f-l)/2!==c.length/h){let x=l/2;d=d.filter((w,C)=>{const b=a[(x+C)*2]===c[C*h]&&a[(x+C)*2+1]===c[C*h+1];return b||--x,b})}this.saveTextStates_();const g=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,m=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(e,t,n);let p=o.padding;if(p!=fi&&(o.scale[0]<0||o.scale[1]<0)){let x=o.padding[0],w=o.padding[1],C=o.padding[2],b=o.padding[3];o.scale[0]<0&&(w=-w,b=-b),o.scale[1]<0&&(x=-x,C=-C),p=[x,w,C,b]}const y=this.pixelRatio;this.instructions.push([Y.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,p==fi?fi:p.map(function(x){return x*y}),g,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);const _=1/y,E=g?g.slice(0):null;E&&(E[1]=bt),this.hitDetectionInstructions.push([Y.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[_,_],NaN,this.declutterMode_,this.declutterImageWithText_,p,E,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?bt:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),this.endGeometry(t)}}saveTextStates_(){const e=this.textStrokeState_,t=this.textState_,n=this.textFillState_,r=this.strokeKey_;e&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));const s=this.textKey_;s in this.textStates||(this.textStates[s]={font:t.font,textAlign:t.textAlign||Hr,justify:t.justify,textBaseline:t.textBaseline||uo,scale:t.scale});const o=this.fillKey_;n&&(o in this.fillStates||(this.fillStates[o]={fillStyle:n.fillStyle}))}drawChars_(e,t){const n=this.textStrokeState_,r=this.textState_,s=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,u=Jo[r.textBaseline],c=this.textOffsetY_*l,h=this.text_,d=n?n.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([Y.DRAW_CHARS,e,t,u,r.overflow,a,r.maxAngle,l,c,s,d*l,h,o,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([Y.DRAW_CHARS,e,t,u,r.overflow,a&&bt,r.maxAngle,l,c,s,d*l,h,o,1/l,this.declutterMode_,this.textKeepUpright_])}setTextStyle(e,t){let n,r,s;if(!e)this.text_="";else{const o=e.getFill();o?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=Jt(o.getColor()||bt)):(r=null,this.textFillState_=r);const a=e.getStroke();if(!a)s=null,this.textStrokeState_=s;else{s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);const m=a.getLineDash(),p=a.getLineDashOffset(),y=a.getWidth(),_=a.getMiterLimit();s.lineCap=a.getLineCap()||Ki,s.lineDash=m?m.slice():gn,s.lineDashOffset=p===void 0?pn:p,s.lineJoin=a.getLineJoin()||$i,s.lineWidth=y===void 0?Jr:y,s.miterLimit=_===void 0?qr:_,s.strokeStyle=Jt(a.getColor()||Qt)}n=this.textState_;const l=e.getFont()||Xh;a0(l);const u=e.getScaleArray();n.overflow=e.getOverflow(),n.font=l,n.maxAngle=e.getMaxAngle(),n.placement=e.getPlacement(),n.textAlign=e.getTextAlign(),n.repeat=e.getRepeat(),n.justify=e.getJustify(),n.textBaseline=e.getTextBaseline()||uo,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||fi,n.scale=u===void 0?[1,1]:u;const c=e.getOffsetX(),h=e.getOffsetY(),d=e.getRotateWithView(),f=e.getKeepUpright(),g=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=h===void 0?0:h,this.textRotateWithView_=d===void 0?!1:d,this.textKeepUpright_=f===void 0?!0:f,this.textRotation_=g===void 0?0:g,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:te(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=n.font+n.scale+(n.textAlign||"?")+(n.repeat||"?")+(n.justify||"?")+(n.textBaseline||"?"),this.fillKey_=r&&r.fillStyle?typeof r.fillStyle=="string"?r.fillStyle:"|"+te(r.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}}const z1={Circle:Ff,Default:vs,Image:F1,LineString:O1,Polygon:Ff,Text:N1};class Of{constructor(e,t,n,r){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=r,this.resolution_=n,this.buildersByZIndex_={}}finish(){const e={};for(const t in this.buildersByZIndex_){e[t]=e[t]||{};const n=this.buildersByZIndex_[t];for(const r in n){const s=n[r].finish();e[t][r]=s}}return e}getBuilder(e,t){const n=e!==void 0?e.toString():"0";let r=this.buildersByZIndex_[n];r===void 0&&(r={},this.buildersByZIndex_[n]=r);let s=r[t];if(s===void 0){const o=z1[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}}function kf(i,e,t,n,r,s,o,a){o=o??[],a=a??n;const l=i[e+n],u=i[e+n+1],c=i[t-2*n],h=i[t-2*n+1];let d,f,g,m,p,y,_,E,x=0;for(let w=e;w<t;w+=n){g=d,m=f,p=void 0,y=void 0,w+n<t&&(p=i[w+n],y=i[w+n+1]),s&&w===e&&(g=c,m=h),s&&w===t-n&&(p=l,y=u),d=i[w],f=i[w+1],[_,E]=G1(d,f,g,m,p,y,r),o[x++]=_,o[x++]=E;for(let C=2;C<a;C++)o[x++]=i[w+C]}return o.length!=x&&(o.length=x),o}function G1(i,e,t,n,r,s,o){let a,l;t!==void 0&&n!==void 0?(a=i-t,l=e-n):r!==void 0&&s!==void 0?(a=r-i,l=s-e):(a=1,l=0);const u=Math.hypot(a,l),c=a/u,h=l/u;if(a=-h,l=c,t===void 0||n===void 0)return[i+a*o,e+l*o];if(r===void 0||s===void 0)return[i+a*o,e+l*o];const d=Tp([i,e],[t,n],[r,s]);if(Math.cos(d)>.998)return[i+c*o,e+h*o];const f=Math.cos(d/2),g=Math.sin(d/2),m=g*a+f*l,p=-f*a+g*l,y=m*(1/g),_=p*(1/g);return[i+y*o,e+_*o]}function Df(i,e){for(let t=0,n=i.length-2;t<n;t+=e)for(let r=i.length-2*e;r>t+e;r-=e){const s=i[t],o=i[t+1],a=i[t+e],l=i[t+e+1],u=i[r],c=i[r+1],h=i[r+e],d=i[r+e+1],f=(d-c)*(a-s)-(h-u)*(l-o);if(f===0)continue;const g=((h-u)*(o-c)-(d-c)*(s-u))/f,m=((a-s)*(o-c)-(l-o)*(s-u))/f;if(g>0&&g<1&&m>0&&m<1){const p=s+g*(a-s),y=o+g*(l-o);i[t+e]=p,i[t+e+1]=y,i.splice(t+2*e,r-t-e);break}}return i}function j1(i,e,t,n,r,s,o,a,l,u,c,h,d=!0){let f=i[e],g=i[e+1],m=0,p=0,y=0,_=0;function E(){m=f,p=g,e+=n,f=i[e],g=i[e+1],_+=y,y=Math.sqrt((f-m)*(f-m)+(g-p)*(g-p))}do E();while(e<t-n&&_+y<s);let x=y===0?0:(s-_)/y;const w=Tt(m,f,x),C=Tt(p,g,x),b=e-n,v=_,R=s+a*l(u,r,c);for(;e<t-n&&_+y<R;)E();x=y===0?0:(R-_)/y;const A=Tt(m,f,x),F=Tt(p,g,x);let O=!1;if(d)if(h){const N=[w,C,A,F];Qc(N,0,4,2,h,N,N),O=N[0]>N[2]}else O=w>A;const I=Math.PI,S=[],U=b+n===e;e=b,y=0,_=v,f=i[e],g=i[e+1];let k;if(U){E(),k=Math.atan2(g-p,f-m),O&&(k+=k>0?-I:I);const N=(A+w)/2,D=(F+C)/2;return S[0]=[N,D,(R-s)/2,k,r],S}r=r.replace(/\n/g," ");for(let N=0,D=r.length;N<D;){E();let T=Math.atan2(g-p,f-m);if(O&&(T+=T>0?-I:I),k!==void 0){let le=T-k;if(le+=le>I?-2*I:le<-I?2*I:0,Math.abs(le)>o)return null}k=T;const V=N;let Z=0;for(;N<D;++N){const le=O?D-N-1:N,H=a*l(u,r[le],c);if(e+n<t&&_+y<s+Z+H/2)break;Z+=H}if(N===V)continue;const ce=O?r.substring(D-V,D-N):r.substring(V,N);x=y===0?0:(s+Z/2-_)/y;const Ae=Tt(m,f,x),L=Tt(p,g,x);S.push([Ae,L,Z/2,T,ce]),s+=Z}return S}const mr=St(),$n=[],En=[],vn=[],Zn=[];function Nf(i){return i[3].declutterBox}const zf=new RegExp("[֑-ࣿיִ-﷿ﹰ-ﻼࠀ--]");function Gu(i,e){return e==="start"?e=zf.test(i)?"right":"left":e==="end"&&(e=zf.test(i)?"left":"right"),Jo[e]}function X1(i,e,t){return t>0&&i.push(`
|
|
5
|
+
`,""),i.push(e,""),i}function W1(i,e,t){return t%2===0&&(i+=e),i}class V1{constructor(e,t,n,r,s){this.overlaps=n,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=vt(),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 Kl:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,n,r){const s=e+t+n+r;if(this.labels_[s])return this.labels_[s];const o=r?this.strokeStates[r]:null,a=n?this.fillStates[n]:null,l=this.textStates[t],u=this.pixelRatio,c=[l.scale[0]*u,l.scale[1]*u],h=l.justify?Jo[l.justify]:Gu(Array.isArray(e)?e[0]:e,l.textAlign||Hr),d=r&&o.lineWidth?o.lineWidth:0,f=Array.isArray(e)?e:String(e).split(`
|
|
6
|
+
`).reduce(X1,[]),{width:g,height:m,widths:p,heights:y,lineWidths:_}=u0(l,f),E=g+d,x=[],w=(E+2)*c[0],C=(m+d)*c[1],b={width:w<0?Math.floor(w):Math.ceil(w),height:C<0?Math.floor(C):Math.ceil(C),contextInstructions:x};(c[0]!=1||c[1]!=1)&&x.push("scale",c),r&&(x.push("strokeStyle",o.strokeStyle),x.push("lineWidth",d),x.push("lineCap",o.lineCap),x.push("lineJoin",o.lineJoin),x.push("miterLimit",o.miterLimit),x.push("setLineDash",[o.lineDash]),x.push("lineDashOffset",o.lineDashOffset)),n&&x.push("fillStyle",a.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const v=.5-h;let R=h*E+v*d;const A=[],F=[];let O=0,I=0,S=0,U=0,k;for(let N=0,D=f.length;N<D;N+=2){const T=f[N];if(T===`
|
|
7
|
+
`){I+=O,O=0,R=h*E+v*d,++U;continue}const V=f[N+1]||l.font;V!==k&&(r&&A.push("font",V),n&&F.push("font",V),k=V),O=Math.max(O,y[S]);const Z=[T,R+v*p[S]+h*(p[S]-_[U]),.5*(d+O)+I];R+=p[S],r&&A.push("strokeText",Z),n&&F.push("fillText",Z),++S}return Array.prototype.push.apply(x,A),Array.prototype.push.apply(x,F),this.labels_[s]=b,b}replayTextBackground_(e,t,n,r,s,o,a){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,n),e.lineTo.apply(e,r),e.lineTo.apply(e,s),e.lineTo.apply(e,t),o&&(this.alignAndScaleFill_=o[2],e.fillStyle=o[1],this.fill_(e)),a&&(this.setStrokeStyle_(e,a),e.stroke())}calculateImageOrLabelDimensions_(e,t,n,r,s,o,a,l,u,c,h,d,f,g,m,p){a*=d[0],l*=d[1];let y=n-a,_=r-l;const E=s+u>e?e-u:s,x=o+c>t?t-c:o,w=g[3]+E*d[0]+g[1],C=g[0]+x*d[1]+g[2],b=y-g[3],v=_-g[0];(m||h!==0)&&($n[0]=b,Zn[0]=b,$n[1]=v,En[1]=v,En[0]=b+w,vn[0]=En[0],vn[1]=v+C,Zn[1]=vn[1]);let R;return h!==0?(R=qt(vt(),n,r,1,1,h,-n,-r),qe(R,$n),qe(R,En),qe(R,vn),qe(R,Zn),an(Math.min($n[0],En[0],vn[0],Zn[0]),Math.min($n[1],En[1],vn[1],Zn[1]),Math.max($n[0],En[0],vn[0],Zn[0]),Math.max($n[1],En[1],vn[1],Zn[1]),mr)):an(Math.min(b,b+w),Math.min(v,v+C),Math.max(b,b+w),Math.max(v,v+C),mr),f&&(y=Math.round(y),_=Math.round(_)),{drawImageX:y,drawImageY:_,drawImageW:E,drawImageH:x,originX:u,originY:c,declutterBox:{minX:mr[0],minY:mr[1],maxX:mr[2],maxY:mr[3],value:p},canvasTransform:R,scale:d}}replayImageOrLabel_(e,t,n,r,s,o,a){const l=!!(o||a),u=r.declutterBox,c=a?a[2]*r.scale[0]/2:0;return u.minX-c<=t[0]&&u.maxX+c>=0&&u.minY-c<=t[1]&&u.maxY+c>=0&&(l&&this.replayTextBackground_(e,$n,En,vn,Zn,o,a),c0(e,r.canvasTransform,s,n,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(e){const t=this.alignAndScaleFill_;if(t){const n=qe(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;e.save(),e.translate(n[0]%r,n[1]%r),t!==1&&e.scale(t,t)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],t[1]&&(e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6]))}drawLabelWithPointPlacement_(e,t,n,r){const s=this.textStates[t],o=this.createLabel(e,t,r,n),a=this.strokeStates[n],l=this.pixelRatio,u=Gu(Array.isArray(e)?e[0]:e,s.textAlign||Hr),c=Jo[s.textBaseline||uo],h=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*s.scale[0],f=u*d+2*(.5-u)*h,g=c*o.height/l+2*(.5-c)*h;return{label:o,anchorX:f,anchorY:g}}execute_(e,t,n,r,s,o,a,l){const u=this.zIndexContext_;let c;this.pixelCoordinates_&&In(n,this.renderedTransform_)?c=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),c=kn(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),am(this.renderedTransform_,n));let h=0;const d=r.length;let f=0,g;const m=[];let p,y,_,E,x,w,C,b,v,R,A,F,O,I=0,S=0;const U=this.coordinateCache_,k=this.viewRotation_,N=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,D={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:k},T=this.instructions!=r||this.overlaps?0:200;let V,Z,ce,Ae;for(;h<d;){const L=r[h];switch(L[0]){case Y.BEGIN_GEOMETRY:V=L[1],Ae=L[3],V.getGeometry()?a!==void 0&&!Ue(a,Ae.getExtent())?h=L[2]+1:++h:h=L[2],u&&(u.zIndex=L[4]);break;case Y.BEGIN_PATH:I>T&&(this.fill_(e),I=0),S>T&&(e.stroke(),S=0),!I&&!S&&(e.beginPath(),x=NaN,w=NaN),++h;break;case Y.CIRCLE:f=L[1],_=L[2]??0;const H=c[f],Re=c[f+1],Te=c[f+2]-_,W=c[f+3]-_,P=Te-H,Xe=W-Re,Ze=Math.sqrt(P*P+Xe*Xe);e.moveTo(H+Ze,Re),e.arc(H,Re,Ze,0,2*Math.PI,!0),++h;break;case Y.CLOSE_PATH:e.closePath(),++h;break;case Y.CUSTOM:f=L[1],g=L[2];const q=L[3],Ee=L[4],Ce=L[5];D.geometry=q,D.feature=V,h in U||(U[h]=[]);const ne=U[h];Ce?Ce(c,f,g,2,ne):(ne[0]=c[f],ne[1]=c[f+1],ne.length=2),u&&(u.zIndex=L[6]),Ee(ne,D),++h;break;case Y.DRAW_IMAGE:f=L[1],g=L[2],v=L[3],p=L[4],y=L[5];let me=L[6];const oe=L[7],_e=L[8],Se=L[9],Pe=L[10];let Le=L[11];const Bt=L[12];let he=L[13];E=L[14]||"declutter";const ie=L[15];if(!v&&L.length>=20){R=L[19],A=L[20],F=L[21],O=L[22];const Qe=this.drawLabelWithPointPlacement_(R,A,F,O);v=Qe.label,L[3]=v;const Mi=L[23];p=(Qe.anchorX-Mi)*this.pixelRatio,L[4]=p;const Nt=L[24];y=(Qe.anchorY-Nt)*this.pixelRatio,L[5]=y,me=v.height,L[6]=me,he=v.width,L[13]=he}let B;L.length>25&&(B=L[25]);let de,Ie,re;L.length>17?(de=L[16],Ie=L[17],re=L[18]):(de=fi,Ie=null,re=null),Pe&&N?Le+=k:!Pe&&!N&&(Le-=k);let ye=0;for(;f<g;f+=2){if(B&&B[ye++]<he/this.pixelRatio)continue;const Qe=this.calculateImageOrLabelDimensions_(v.width,v.height,c[f],c[f+1],he,me,p,y,_e,Se,Le,Bt,s,de,!!Ie||!!re,V),Mi=[e,t,v,Qe,oe,Ie,re];if(l){let Nt,rn,zt;if(ie){const Be=g-f;if(!ie[Be]){ie[Be]={args:Mi,declutterMode:E};continue}const xt=ie[Be];Nt=xt.args,rn=xt.declutterMode,delete ie[Be],zt=Nf(Nt)}let bn,Rn;if(Nt&&(rn!=="declutter"||!l.collides(zt))&&(bn=!0),(E!=="declutter"||!l.collides(Qe.declutterBox))&&(Rn=!0),rn==="declutter"&&E==="declutter"){const Be=bn&&Rn;bn=Be,Rn=Be}bn&&(rn!=="none"&&l.insert(zt),this.replayImageOrLabel_.apply(this,Nt)),Rn&&(E!=="none"&&l.insert(Qe.declutterBox),this.replayImageOrLabel_.apply(this,Mi))}else this.replayImageOrLabel_.apply(this,Mi)}++h;break;case Y.DRAW_CHARS:const We=L[1],Ye=L[2],Je=L[3],Mt=L[4];O=L[5];const st=L[6],dt=L[7],Fe=L[8];F=L[9];const ot=L[10];R=L[11],Array.isArray(R)&&(R=R.reduce(W1,"")),A=L[12];const yt=[L[13],L[13]];E=L[14]||"declutter";const _t=L[15],ze=this.textStates[A],Rt=ze.font,Si=[ze.scale[0]*dt,ze.scale[1]*dt];let Cn;Rt in this.widths_?Cn=this.widths_[Rt]:(Cn={},this.widths_[Rt]=Cn);const ca=Lu(c,We,Ye,2),ha=Math.abs(Si[0])*Yh(Rt,R,Cn);if(Mt||ha<=ca){const Qe=this.textStates[A].textAlign,Mi=(ca-ha)*Gu(R,Qe),Nt=j1(c,We,Ye,2,R,Mi,st,Math.abs(Si[0]),Yh,Rt,Cn,N?0:this.viewRotation_,_t);e:if(Nt){const rn=[];let zt,bn,Rn,Be,xt;if(F)for(zt=0,bn=Nt.length;zt<bn;++zt){xt=Nt[zt],Rn=xt[4],Be=this.createLabel(Rn,A,"",F),p=xt[2]+(Si[0]<0?-ot:ot),y=Je*Be.height+(.5-Je)*2*ot*Si[1]/Si[0]-Fe;const Tn=this.calculateImageOrLabelDimensions_(Be.width,Be.height,xt[0],xt[1],Be.width,Be.height,p,y,0,0,xt[3],yt,!1,fi,!1,V);if(l&&E==="declutter"&&l.collides(Tn.declutterBox))break e;rn.push([e,t,Be,Tn,1,null,null])}if(O)for(zt=0,bn=Nt.length;zt<bn;++zt){xt=Nt[zt],Rn=xt[4],Be=this.createLabel(Rn,A,O,""),p=xt[2],y=Je*Be.height-Fe;const Tn=this.calculateImageOrLabelDimensions_(Be.width,Be.height,xt[0],xt[1],Be.width,Be.height,p,y,0,0,xt[3],yt,!1,fi,!1,V);if(l&&E==="declutter"&&l.collides(Tn.declutterBox))break e;rn.push([e,t,Be,Tn,1,null,null])}l&&E!=="none"&&l.load(rn.map(Nf));for(let Tn=0,wE=rn.length;Tn<wE;++Tn)this.replayImageOrLabel_.apply(this,rn[Tn])}}++h;break;case Y.END_GEOMETRY:if(o!==void 0){V=L[1];const Qe=o(V,Ae,E);if(Qe)return Qe}++h;break;case Y.FILL:T?I++:this.fill_(e),++h;break;case Y.MOVE_TO_LINE_TO:f=L[1],g=L[2],_=L[3];let Ii,Ts,da;if(_){const Qe=L[4]??!1;kf(c,f,g,2,_,Qe,m),Df(m,2),Ii=m,Ts=0,da=Ii.length}else Ii=c,Ts=f,da=g;Z=Ii[Ts],ce=Ii[Ts+1],e.moveTo(Z,ce),x=Z+.5|0,w=ce+.5|0;for(let Qe=Ts+2;Qe<da;Qe+=2)Z=Ii[Qe],ce=Ii[Qe+1],C=Z+.5|0,b=ce+.5|0,(Qe==da-2||C!==x||b!==w)&&(e.lineTo(Z,ce),x=C,w=b);++h;break;case Y.SET_FILL_STYLE:this.alignAndScaleFill_=L[2],I?(this.fill_(e),I=0,S&&(e.stroke(),S=0)):S&&L[1]&&(e.stroke(),S=0),e.fillStyle=L[1],++h;break;case Y.SET_STROKE_STYLE:I&&L[1]&&(this.fill_(e),I=0),S&&(e.stroke(),S=0),this.setStrokeStyle_(e,L),++h;break;case Y.STROKE:T?S++:e.stroke(),++h;break;default:++h;break}}I&&this.fill_(e),S&&e.stroke()}execute(e,t,n,r,s,o){this.viewRotation_=r,this.execute_(e,t,n,this.instructions,s,void 0,void 0,o)}executeHitDetection(e,t,n,r,s){return this.viewRotation_=n,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,r,s)}}const bi=["Polygon","Circle","LineString","Image","Text","Default"],Qo=["Image","Text"],U1=bi.filter(i=>!Qo.includes(i));let Gf=!1,jf=!1;function Y1(){let i=0;const e=n=>{const r=De(1,1,null,{willReadFrequently:n});let s=0;const 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 i=s>i?s:i,s};Gf={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[i],jf=!0}class Xf{constructor(e,t,n,r,s,o,a){this.maxExtent_=e,this.overlaps_=r,this.pixelRatio_=n,this.resolution_=t,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=vt(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(s,a)}clip(e,t){const n=this.getClipCoords(t);e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(n[2],n[3]),e.lineTo(n[4],n[5]),e.lineTo(n[6],n[7]),e.clip()}createExecutors_(e,t){for(const n in e){let r=this.executorsByZIndex_[n];r===void 0&&(r={},this.executorsByZIndex_[n]=r);const s=e[n];for(const o in s){const a=s[o];r[o]=new V1(this.resolution_,this.pixelRatio_,this.overlaps_,a,t)}}}hasExecutors(e){for(const t in this.executorsByZIndex_){const n=this.executorsByZIndex_[t];for(let r=0,s=e.length;r<s;++r)if(e[r]in n)return!0}return!1}forEachFeatureAtCoordinate(e,t,n,r,s,o){jf===!1&&Y1(),r=Math.round(r);const a=r*2+1,l=qt(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),u=!this.hitDetectionContext_;u&&(this.hitDetectionContext_=De(a,a,null,{willReadFrequently:Gf}));const c=this.hitDetectionContext_;c.canvas.width!==a||c.canvas.height!==a?(c.canvas.width=a,c.canvas.height=a):u||c.clearRect(0,0,a,a);let h;this.renderBuffer_!==void 0&&(h=St(),Sr(h,e),sn(h,t*(this.renderBuffer_+r),h));const d=B1(r);let f;function g(w,C,b){const v=c.getImageData(0,0,a,a).data;for(let R=0,A=d.length;R<A;R++)if(v[d[R]]>0){if(!o||b==="none"||f!=="Image"&&f!=="Text"||o.includes(w)){const F=(d[R]-3)/4,O=r-F%a,I=r-(F/a|0),S=s(w,C,O*O+I*I);if(S)return S}c.clearRect(0,0,a,a);break}}const m=Object.keys(this.executorsByZIndex_).map(Number);m.sort(Kt);let p,y,_,E,x;for(p=m.length-1;p>=0;--p){const w=m[p].toString();for(_=this.executorsByZIndex_[w],y=bi.length-1;y>=0;--y)if(f=bi[y],E=_[f],E!==void 0&&(x=E.executeHitDetection(c,l,n,g,h),x))return x}}getClipCoords(e){const t=this.maxExtent_;if(!t)return null;const n=t[0],r=t[1],s=t[2],o=t[3],a=[n,r,n,o,s,o,s,r];return kn(a,0,8,2,e,a),a}isEmpty(){return Sn(this.executorsByZIndex_)}execute(e,t,n,r,s,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?rp:Kt),o=o||bi;const u=bi.length;for(let c=0,h=l.length;c<h;++c){const d=l[c].toString(),f=this.executorsByZIndex_[d];for(let g=0,m=o.length;g<m;++g){const p=o[g],y=f[p];if(y!==void 0){const _=a===null?void 0:y.getZIndexContext(),E=_?_.getContext():e,x=this.maxExtent_&&p!=="Image"&&p!=="Text";if(x&&(E.save(),this.clip(E,n)),!_||p==="Text"||p==="Image"?y.execute(E,t,n,r,s,a):_.pushFunction(w=>y.execute(w,t,n,r,s,a)),x&&E.restore(),_){_.offset();const w=l[c]*u+bi.indexOf(p);this.deferredZIndexContexts_[w]||(this.deferredZIndexContexts_[w]=[]),this.deferredZIndexContexts_[w].push(_)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(Kt);for(let n=0,r=t.length;n<r;++n)e[t[n]].forEach(s=>{s.draw(this.renderedContext_),s.clear()}),e[t[n]].length=0}}const ju={};function B1(i){if(ju[i]!==void 0)return ju[i];const e=i*2+1,t=i*i,n=new Array(t+1);for(let s=0;s<=i;++s)for(let o=0;o<=i;++o){const a=s*s+o*o;if(a>t)break;let l=n[a];l||(l=[],n[a]=l),l.push(((i+s)*e+(i+o))*4+3),s>0&&l.push(((i-s)*e+(i+o))*4+3),o>0&&(l.push(((i+s)*e+(i-o))*4+3),s>0&&l.push(((i-s)*e+(i-o))*4+3))}const r=[];for(let s=0,o=n.length;s<o;++s)n[s]&&r.push(...n[s]);return ju[i]=r,r}class K1 extends Pf{constructor(e,t,n,r,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?Ds(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_=vt()}drawImages_(e,t,n,r){if(!this.image_)return;const s=kn(e,t,n,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let u=this.imageRotation_;this.transformRotation_===0&&(u-=this.viewRotation_),this.imageRotateWithView_&&(u+=this.viewRotation_);for(let c=0,h=s.length;c<h;c+=2){const d=s[c]-this.imageAnchorX_,f=s[c+1]-this.imageAnchorY_;if(u!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const g=d+this.imageAnchorX_,m=f+this.imageAnchorY_;qt(a,g,m,1,1,u,-g,-m),o.save(),o.transform.apply(o,a),o.translate(g,m),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_,d,f,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(e,t,n,r){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const s=kn(e,t,n,r,this.transform_,this.pixelCoordinates_),o=this.context_;let a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);t<n;t+=r){const l=s[t]+this.textOffsetX_,u=s[t+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,u-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,u),this.textFillState_&&o.fillText(this.text_,l,u))}}moveToLineTo_(e,t,n,r,s,o){const a=this.context_;let l=kn(e,t,n,r,this.transform_,this.pixelCoordinates_);Math.abs(o)>0&&(l=kf(l,0,l.length,2,o,s,l),Df(l,2)),a.moveTo(l[0],l[1]);let u=l.length;s&&(u-=2);for(let c=2;c<u;c+=2)a.lineTo(l[c],l[c+1]);return s&&a.closePath(),n}drawRings_(e,t,n,r,s){for(let o=0,a=n.length;o<a;++o)t=this.moveToLineTo_(e,t,n[o],r,!0,s);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ue(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=mm(e,this.transform_,this.pixelCoordinates_),n=t[2]-t[0],r=t[3]-t[1],s=Math.sqrt(n*n+r*r),o=this.context_;o.beginPath(),o.arc(t[0],t[1],s,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case"Point":this.drawPoint(e);break;case"LineString":this.drawLineString(e);break;case"Polygon":this.drawPolygon(e);break;case"MultiPoint":this.drawMultiPoint(e);break;case"MultiLineString":this.drawMultiLineString(e);break;case"MultiPolygon":this.drawMultiPolygon(e);break;case"GeometryCollection":this.drawGeometryCollection(e);break;case"Circle":this.drawCircle(e);break}}drawFeature(e,t){const n=t.getGeometryFunction()(e);n&&(this.setStyle(t),this.drawGeometry(n))}drawGeometryCollection(e){const t=e.getGeometriesArray();for(let n=0,r=t.length;n<r;++n)this.drawGeometry(t[n])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ue(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const t=this.context_,n=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(n,0,n.length,e.getStride(),!1,this.strokeState_.strokeOffset),t.stroke()}if(this.text_!==""){const t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getExtent();if(Ue(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const n=this.context_,r=e.getFlatCoordinates();let s=0;const o=e.getEnds(),a=e.getStride();n.beginPath();for(let l=0,u=o.length;l<u;++l)s=this.moveToLineTo_(r,s,o[l],a,!1,this.strokeState_.strokeOffset);n.stroke()}if(this.text_!==""){const n=e.getFlatMidpoints();this.drawText_(n,0,n.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ue(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){const t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ue(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=this.context_,n=e.getOrientedFlatCoordinates();let r=0;const s=e.getEndss(),o=e.getStride();t.beginPath();for(let a=0,l=s.length;a<l;++a){const u=s[a];r=this.drawRings_(n,r,u,o,this.strokeState_?.strokeOffset)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){const t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){const t=this.context_,n=this.contextFillState_;n?n.fillStyle!=e.fillStyle&&(n.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){const t=this.context_,n=this.contextStrokeState_;n?(n.lineCap!=e.lineCap&&(n.lineCap=e.lineCap,t.lineCap=e.lineCap),In(n.lineDash,e.lineDash)||t.setLineDash(n.lineDash=e.lineDash),n.lineDashOffset!=e.lineDashOffset&&(n.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),n.lineJoin!=e.lineJoin&&(n.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),n.lineWidth!=e.lineWidth&&(n.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),n.miterLimit!=e.miterLimit&&(n.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),n.strokeStyle!=e.strokeStyle&&(n.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){const t=this.context_,n=this.contextTextState_,r=e.textAlign?e.textAlign:Hr;n?(n.font!=e.font&&(n.font=e.font,t.font=e.font),n.textAlign!=r&&(n.textAlign=r,t.textAlign=r),n.textBaseline!=e.textBaseline&&(n.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=r,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:r,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(!e)this.fillState_=null;else{const n=e.getColor();this.fillState_={fillStyle:Jt(n||bt)}}if(!t)this.strokeState_=null;else{const n=t.getColor(),r=t.getLineCap(),s=t.getLineDash(),o=t.getLineDashOffset(),a=t.getLineJoin(),l=t.getWidth(),u=t.getMiterLimit(),c=s||gn,h=t.getOffset();this.strokeState_={lineCap:r!==void 0?r:Ki,lineDash:this.pixelRatio_===1?c:c.map(d=>d*this.pixelRatio_),lineDashOffset:(o||pn)*this.pixelRatio_,lineJoin:a!==void 0?a:$i,lineWidth:(l!==void 0?l:Jr)*this.pixelRatio_,miterLimit:u!==void 0?u:qr,strokeStyle:Jt(n||Qt),strokeOffset:(h??0)*this.pixelRatio_}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}const n=e.getPixelRatio(this.pixelRatio_),r=e.getAnchor(),s=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*n,this.imageAnchorY_=r[1]*n,this.imageHeight_=t[1]*n,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();const o=e.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/n,o[1]*this.pixelRatio_/n],this.imageWidth_=t[0]*n}setTextStyle(e){if(!e)this.text_="";else{const t=e.getFill();if(!t)this.textFillState_=null;else{const f=t.getColor();this.textFillState_={fillStyle:Jt(f||bt)}}const n=e.getStroke();if(!n)this.textStrokeState_=null;else{const f=n.getColor(),g=n.getLineCap(),m=n.getLineDash(),p=n.getLineDashOffset(),y=n.getLineJoin(),_=n.getWidth(),E=n.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:Ki,lineDash:m||gn,lineDashOffset:p||pn,lineJoin:y!==void 0?y:$i,lineWidth:_!==void 0?_:Jr,miterLimit:E!==void 0?E:qr,strokeStyle:Jt(f||Qt)}}const r=e.getFont(),s=e.getOffsetX(),o=e.getOffsetY(),a=e.getRotateWithView(),l=e.getRotation(),u=e.getScaleArray(),c=e.getText(),h=e.getTextAlign(),d=e.getTextBaseline();this.textState_={font:r!==void 0?r:Xh,textAlign:h!==void 0?h:Hr,textBaseline:d!==void 0?d:uo},this.text_=c!==void 0?Array.isArray(c)?c.reduce((f,g,m)=>f+=m%2?" ":g,""):c:"",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_*u[0],this.pixelRatio_*u[1]]}}}const It=.5;function Wf(i,e,t,n,r,s,o,a,l){const u=l?Zs(r,l):r,c=i[0]*It,h=i[1]*It,d=De(c,h);d.imageSmoothingEnabled=!1;const f=d.canvas,g=new K1(d,It,r,null,o,a,l?ji(Pr(),l):null),m=t.length,p=Math.floor((256*256*256-1)/m),y={};for(let E=1;E<=m;++E){const x=t[E-1],w=x.getStyleFunction()||n;if(!w)continue;let C=w(x,s);if(!C)continue;Array.isArray(C)||(C=[C]);const v=(E*p).toString(16).padStart(7,"#00000");for(let R=0,A=C.length;R<A;++R){const F=C[R],O=F.getGeometryFunction()(x);if(!O||!Ue(u,O.getExtent()))continue;const I=F.clone(),S=I.getFill();S&&S.setColor(v);const U=I.getStroke();U&&(U.setColor(v),U.setLineDash(null)),I.setText(void 0);const k=F.getImage();if(k){const V=k.getImageSize();if(!V)continue;const Z=De(V[0],V[1],void 0,{alpha:!1}),ce=Z.canvas;Z.fillStyle=v,Z.fillRect(0,0,ce.width,ce.height),I.setImage(new pi({img:ce,anchor:k.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:k.getOrigin(),opacity:1,size:k.getSize(),scale:k.getScale(),rotation:k.getRotation(),rotateWithView:k.getRotateWithView()}))}const N=I.getZIndex()||0;let D=y[N];D||(D={},y[N]=D,D.Polygon=[],D.Circle=[],D.LineString=[],D.Point=[]);const T=O.getType();if(T==="GeometryCollection"){const V=O.getGeometriesArrayRecursive();for(let Z=0,ce=V.length;Z<ce;++Z){const Ae=V[Z];D[Ae.getType().replace("Multi","")].push(Ae,I)}}else D[T.replace("Multi","")].push(O,I)}}const _=Object.keys(y).map(Number).sort(Kt);for(let E=0,x=_.length;E<x;++E){const w=y[_[E]];for(const C in w){const b=w[C];for(let v=0,R=b.length;v<R;v+=2){g.setStyle(b[v+1]);for(let A=0,F=e.length;A<F;++A)g.setTransform(e[A]),g.drawGeometry(b[v])}}}return d.getImageData(0,0,f.width,f.height)}function Vf(i,e,t){const n=[];if(t){const r=Math.floor(Math.round(i[0])*It),s=Math.floor(Math.round(i[1])*It),o=(ke(r,0,t.width-1)+ke(s,0,t.height-1)*t.width)*4,a=t.data[o],l=t.data[o+1],c=t.data[o+2]+256*(l+256*a),h=Math.floor((256*256*256-1)/e.length);c&&c%h===0&&n.push(e[c/h-1])}return n}const $1=.5,Uf={Point:nw,LineString:Q1,Polygon:rw,MultiPoint:iw,MultiLineString:ew,MultiPolygon:tw,GeometryCollection:J1,Circle:q1};function Z1(i,e){return parseInt(te(i),10)-parseInt(te(e),10)}function Xu(i,e){const t=Yf(i,e);return t*t}function Yf(i,e){return $1*i/e}function q1(i,e,t,n,r){const s=t.getFill(),o=t.getStroke();if(s||o){const l=i.getBuilder(t.getZIndex(),"Circle");l.setFillStrokeStyle(s,o),l.drawCircle(e,n,r)}const a=t.getText();if(a&&a.getText()){const l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}function ea(i,e,t,n,r,s,o,a){const l=[],u=t.getImage();if(u){let d=!0;const f=u.getImageState();f==X.LOADED||f==X.ERROR?d=!1:f==X.IDLE&&u.load(),d&&l.push(u.ready())}const c=t.getFill();c&&c.loading()&&l.push(c.ready());const h=l.length>0;return h&&Promise.all(l).then(()=>r(null)),H1(i,e,t,n,s,o,a),h}function H1(i,e,t,n,r,s,o){const a=t.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(n,r);if(t.getRenderer())Bf(i,l,t,e,o);else{const c=Uf[l.getType()];c(i,l,t,e,o,s)}}function Bf(i,e,t,n,r){if(e.getType()=="GeometryCollection"){const o=e.getGeometries();for(let a=0,l=o.length;a<l;++a)Bf(i,o[a],t,n,r);return}i.getBuilder(t.getZIndex(),"Default").drawCustom(e,n,t.getRenderer(),t.getHitDetectionRenderer(),r)}function J1(i,e,t,n,r,s){const o=e.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a){const u=Uf[o[a].getType()];u(i,o[a],t,n,r,s)}}function Q1(i,e,t,n,r){const s=t.getStroke();if(s){const a=i.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawLineString(e,n,r)}const o=t.getText();if(o&&o.getText()){const a=i.getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,n,r)}}function ew(i,e,t,n,r){const s=t.getStroke();if(s){const a=i.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawMultiLineString(e,n,r)}const o=t.getText();if(o&&o.getText()){const a=i.getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,n,r)}}function tw(i,e,t,n,r){const s=t.getFill(),o=t.getStroke();if(o||s){const l=i.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawMultiPolygon(e,n,r)}const a=t.getText();if(a&&a.getText()){const l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}function nw(i,e,t,n,r,s){const o=t.getImage(),a=t.getText(),l=a&&a.getText(),u=s&&o&&l?{}:void 0;if(o){if(o.getImageState()!=X.LOADED)return;const c=i.getBuilder(t.getZIndex(),"Image");c.setImageStyle(o,u),c.drawPoint(e,n,r)}if(l){const c=i.getBuilder(t.getZIndex(),"Text");c.setTextStyle(a,u),c.drawText(e,n,r)}}function iw(i,e,t,n,r,s){const o=t.getImage(),a=o&&o.getOpacity()!==0,l=t.getText(),u=l&&l.getText(),c=s&&a&&u?{}:void 0;if(a){if(o.getImageState()!=X.LOADED)return;const h=i.getBuilder(t.getZIndex(),"Image");h.setImageStyle(o,c),h.drawMultiPoint(e,n,r)}if(u){const h=i.getBuilder(t.getZIndex(),"Text");h.setTextStyle(l,c),h.drawText(e,n,r)}}function rw(i,e,t,n,r){const s=t.getFill(),o=t.getStroke();if(s||o){const l=i.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawPolygon(e,n,r)}const a=t.getText();if(a&&a.getText()){const l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}class sw extends $l{constructor(e){super(e),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_=St(),this.wrappedRenderedExtent_=St(),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(e,t,n){const r=t.extent,s=t.viewState,o=s.center,a=s.resolution,l=s.projection,u=s.rotation,c=l.getExtent(),h=this.getLayer().getSource(),d=this.getLayer().getDeclutter(),f=t.pixelRatio,g=t.viewHints,m=!(g[Oe.ANIMATING]||g[Oe.INTERACTING]),p=this.context,y=Math.round(pe(r)/a*f),_=Math.round(Ke(r)/a*f),E=h.getWrapX()&&l.canWrapX(),x=E?pe(c):null,w=E?Math.ceil((r[2]-c[2])/x)+(this.extendX_?2:1):1;let C=E?Math.floor((r[0]-c[0])/x)-(this.extendX_?1:0):0;do{let b=this.getRenderTransform(o,a,0,f,y,_,C*x);t.declutter&&(b=b.slice(0)),e.execute(p,[p.canvas.width,p.canvas.height],b,u,m,n===void 0?bi:n?Qo:U1,n?d&&t.declutter[d]:void 0)}while(++C<w)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=De(this.context.canvas.width,this.context.canvas.height,md))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){const e=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=e,kr(this.context),md.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(e){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,e,!0)}renderDeferredInternal(e){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,e,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(e,t){const n=e.layerStatesArray[e.layerIndex];this.opacity_=n.opacity;const r=e.viewState;this.prepareContainer(e,t);const s=this.context,o=this.replayGroup_;let a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(Ft.PRERENDER)||this.getLayer().hasListener(Ft.POSTRENDER)))return this.container;this.setDrawContext_(),this.preRender(s,e);const l=r.projection;this.clipExtent_=null;let u=!1;if(a&&n.extent&&this.clipping){const c=hn(n.extent,l);a=Ue(c,e.extent),a&&!on(c,e.extent)&&(e.declutter?this.clipExtent_=c:(this.clipUnrotated(s,e,c),u=!0))}return a&&this.renderWorlds(o,e,this.getLayer().getDeclutter()?!1:void 0),u&&s.restore(),this.postRender(s,e),this.renderedRotation_!==r.rotation&&(this.renderedRotation_=r.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const n=this.frameState.size.slice(),r=this.renderedCenter_,s=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,u=this.getLayer(),c=[],h=n[0]*It,d=n[1]*It;c.push(this.getRenderTransform(r,s,o,It,h,d,0).slice());const f=u.getSource(),g=a.getExtent();if(f.getWrapX()&&a.canWrapX()&&!on(g,l)){let p=l[0];const y=pe(g);let _=0,E;for(;p<g[0];)--_,E=y*_,c.push(this.getRenderTransform(r,s,o,It,h,d,E).slice()),p+=y;for(_=0,p=l[2];p>g[2];)++_,E=y*_,c.push(this.getRenderTransform(r,s,o,It,h,d,E).slice()),p-=y}const m=Pr();this.hitDetectionImageData_=Wf(n,c,this.renderedFeatures_,u.getStyleFunction(),l,s,o,Xu(s,this.renderedPixelRatio_),m?a:null)}t(Vf(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,n,r,s){if(!this.replayGroup_)return;const o=t.viewState.resolution,a=t.viewState.rotation,l=this.getLayer(),u={},c=function(d,f,g){const m=te(d),p=u[m];if(p){if(p!==!0&&g<p.distanceSq){if(g===0)return u[m]=!0,s.splice(s.lastIndexOf(p),1),r(d,l,f);p.geometry=f,p.distanceSq=g}}else{if(g===0)return u[m]=!0,r(d,l,f);s.push(u[m]={feature:d,layer:l,geometry:f,distanceSq:g,callback:r})}},h=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,o,a,n,c,h?t.declutter?.[h]?.all().map(d=>d.value):null)}handleFontsChanged(){const e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){const t=this.getLayer(),n=t.getSource();if(!n)return!1;const r=e.viewHints[Oe.ANIMATING],s=e.viewHints[Oe.INTERACTING],o=t.getUpdateWhileAnimating(),a=t.getUpdateWhileInteracting();if(this.ready&&!o&&r||!a&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=e.extent,u=e.viewState,c=u.projection,h=u.resolution,d=e.pixelRatio,f=t.getRevision(),g=t.getRenderBuffer();let m=t.getRenderOrder();m===void 0&&(m=Z1);const p=u.center.slice(),y=sn(l,g*h),_=y.slice(),E=[y.slice()],x=c.getExtent(),w=n.getWrapX()&&c.canWrapX();if(this.extendX_=!1,w){const k=n.getExtent();k&&!Fn(k)&&(this.extendX_=k[0]<x[0]||k[2]>x[2])}if(w&&(!on(x,e.extent)||this.extendX_)){const k=pe(x),N=Math.max(pe(y)/2,k);let D=x[0],T=x[2];this.extendX_&&(D-=k,T+=k),y[0]=D-N,y[2]=T+N,Pa(p,c);const V=Mc(E[0],c);V[0]<x[0]&&V[2]<x[2]?E.push([V[0]+k,V[1],V[2]+k,V[3]]):V[0]>x[0]&&V[2]>x[2]&&E.push([V[0]-k,V[1],V[2]-k,V[3]])}if(this.ready&&this.renderedResolution_==h&&this.renderedPixelRatio_===d&&this.renderedRevision_==f&&this.renderedRenderOrder_==m&&this.renderedFrameDeclutter_===!!e.declutter&&on(this.wrappedRenderedExtent_,y))return In(this.renderedExtent_,_)||(this.hitDetectionImageData_=null,this.renderedExtent_=_),this.renderedCenter_=p,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const C=new Of(Yf(h,d),y,h,d),b=Pr();let v;if(b){for(let k=0,N=E.length;k<N;++k){const D=E[k],T=Zs(D,c);n.loadFeatures(T,sm(h,c),b)}v=ji(b,c)}else for(let k=0,N=E.length;k<N;++k)n.loadFeatures(E[k],h,c);const R=Xu(h,d);let A=!0;const F=(k,N)=>{let D;const T=k.getStyleFunction()||t.getStyleFunction();if(T&&(D=T(k,h)),D){const V=this.renderFeature(k,R,D,C,v,this.getLayer().getDeclutter(),N);A=A&&!V}},O=Zs(y,c),I=n.getFeaturesInExtent(O);m&&I.sort(m);for(let k=0,N=I.length;k<N;++k)F(I[k],k);this.renderedFeatures_=I,this.ready=A;const S=C.finish(),U=new Xf(y,h,d,n.getOverlaps(),S,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=h,this.renderedRevision_=f,this.renderedRenderOrder_=m,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=_,this.wrappedRenderedExtent_=y,this.renderedCenter_=p,this.renderedProjection_=c,this.renderedPixelRatio_=d,this.replayGroup_=U,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,n,r,s,o,a){if(!n)return!1;let l=!1;if(Array.isArray(n))for(let u=0,c=n.length;u<c;++u)l=ea(r,e,n[u],t,this.boundHandleStyleImageChange_,s,o,a)||l;else l=ea(r,e,n,t,this.boundHandleStyleImageChange_,s,o,a);return l}}class ta extends Xl{constructor(e){super(e)}createRenderer(){return new sw(this)}}const ow={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},Kf={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class aw extends _d{constructor(e,t){super(e,t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=vt(),this.tileClipContexts_=null}enqueueTilesForNextExtent(){return this.getLayer().getRenderMode()!=="vector"}drawTile(e,t,n,r,s,o,a,l){this.updateExecutorGroup_(e,t.pixelRatio,t.viewState.projection),this.tileImageNeedsRender_(e)&&this.renderTileImage_(e,t),super.drawTile(e,t,n,r,s,o,a,l)}getTile(e,t,n,r){const s=this.getOrCreateTile(e,t,n,r);if(!s)return null;const o=r.viewState,a=o.resolution,l=r.viewHints,u=this.getLayer().getSource(),c=u.getTileGridForProjection(o.projection),h=!(l[Oe.ANIMATING]||l[Oe.INTERACTING]),d=c.getZForResolution(a,u.zDirection)===e;return h&&d?s.wantedResolution=a:s.wantedResolution||(s.wantedResolution=c.getResolution(e)),s}prepareFrame(e){const t=this.getLayer().getRevision();return this.renderedLayerRevision_!==t&&(this.renderedLayerRevision_=t,this.renderedTiles.length=0),super.prepareFrame(e)}updateExecutorGroup_(e,t,n){const r=this.getLayer(),s=r.getRevision(),o=r.getRenderOrder()||null,a=e.wantedResolution,l=e.getReplayState(r);if(!l.dirty&&l.renderedResolution===a&&l.renderedRevision==s&&l.renderedPixelRatio===t&&l.renderedRenderOrder==o)return;const u=r.getSource(),c=!!r.getDeclutter(),h=u.getTileGrid(),f=u.getTileGridForProjection(n).getTileCoordExtent(e.wrappedTileCoord),g=u.getSourceTiles(t,n,e),m=te(r);delete e.hitDetectionImageData[m],e.executorGroups[m]=[],l.dirty=!1;for(let p=0,y=g.length;p<y;++p){const _=g[p];if(_.getState()!=G.LOADED)continue;const E=u.getProjection(),x=_.tileCoord;let w=h.getTileCoordExtent(x);n&&E&&!ut(n,E)&&(w=Xi(w,E,n,32));const C=Xt(f,w),b=sn(C,r.getRenderBuffer()*a,this.tempExtent),v=ln(w,C)?null:b,R=new Of(0,C,a,t),A=Xu(a,t),F=function(k,N){let D;const T=k.getStyleFunction()||r.getStyleFunction();if(T&&(D=T(k,a)),D){const V=this.renderFeature(k,A,D,R,c,N);l.dirty=l.dirty||V}},O=_.getFeatures();o&&o!==l.renderedRenderOrder&&O.sort(o);for(let k=0,N=O.length;k<N;++k){let D=O[k];n&&_.projection&&!ut(n,_.projection)&&(D=D.clone(),D.getGeometry().applyTransform(ri(_.projection,n))),(!v||Ue(v,D.getGeometry().getExtent()))&&F.call(this,D,k)}const I=R.finish(),S=r.getRenderMode()!=="vector"&&c&&g.length===1?null:C,U=new Xf(S,a,t,u.getOverlaps(),I,r.getRenderBuffer(),!0);e.executorGroups[m].push(U)}l.renderedRevision=s,l.renderedPixelRatio=t,l.renderedRenderOrder=o,l.renderedResolution=a}forEachFeatureAtCoordinate(e,t,n,r,s){const o=t.viewState.resolution,a=t.viewState.rotation;n=n??0;const l=this.getLayer(),c=l.getSource().getTileGridForProjection(t.viewState.projection),h=l.getRenderBuffer(),d=ba([e]);sn(d,o*(h+n),d);const f={},g=function(x,w,C){let b=x.getId();b===void 0&&(b=te(x));const v=f[b];if(v){if(v!==!0&&C<v.distanceSq){if(C===0)return f[b]=!0,s.splice(s.lastIndexOf(v),1),r(x,l,w);v.geometry=w,v.distanceSq=C}}else{if(C===0)return f[b]=!0,r(x,l,w);s.push(f[b]={feature:x,layer:l,geometry:w,distanceSq:C,callback:r})}},m=this.renderedTiles,p=te(l),y=l.getDeclutter(),_=y?t.declutter?.[y]?.all().map(x=>x.value):null;let E;e:for(let x=m.length-1;x>=0;--x){const w=m[x],C=c.getTileCoordExtent(w.wrappedTileCoord);if(!Ue(C,d))continue;const b=w.executorGroups[p];for(let v=0,R=b.length;v<R;++v)if(E=b[v].forEachFeatureAtCoordinate(e,o,a,n,g,_),E)break e}return E}getFeatures(e){return this.renderedTiles.length===0?Promise.resolve([]):new Promise((t,n)=>{const r=this.getLayer(),s=r.getSource(),o=this.renderedProjection,a=o.getExtent(),l=this.renderedResolution,u=s.getTileGridForProjection(o),c=qe(this.renderedPixelToCoordinateTransform_,e.slice()),h=u.getTileCoordForCoordAndResolution(c,l).toString(),d=this.renderedTiles.find(E=>E.tileCoord.toString()===h&&E.getState()===G.LOADED);if(!d||d.loadingSourceTiles>0){t([]);return}s.getWrapX()&&o.canWrapX()&&!on(a,u.getTileCoordExtent(d.tileCoord))&&Pa(c,o);const f=te(r),g=u.getTileCoordExtent(d.wrappedTileCoord),m=un(g),p=[(c[0]-m[0])/l,(m[1]-c[1])/l],y=d.getSourceTiles().reduce((E,x)=>E.concat(x.getFeatures()),[]);let _=d.hitDetectionImageData[f];if(!_){const E=ct(u.getTileSize(u.getZForResolution(l,s.zDirection))),x=this.renderedRotation_,w=[this.getRenderTransform(u.getTileCoordCenter(d.wrappedTileCoord),l,0,It,E[0]*It,E[1]*It,0)];_=Wf(E,w,y,r.getStyleFunction(),u.getTileCoordExtent(d.wrappedTileCoord),d.getReplayState(r).renderedResolution,x),d.hitDetectionImageData[f]=_}t(Vf(p,y,_))})}getFeaturesInExtent(e){const t=[],n=this.getTileCache();if(n.getCount()===0)return t;const s=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),o=s.getZForResolution(this.renderedResolution),a={};return n.forEach(l=>{if(l.tileCoord[0]!==o||l.getState()!==G.LOADED)return;const u=l.getSourceTiles();for(let c=0,h=u.length;c<h;++c){const d=u[c],f=d.getKey();if(f in a)continue;a[f]=!0;const g=d.tileCoord;if(Ue(e,s.getTileCoordExtent(g))){const m=d.getFeatures();if(m)for(let p=0,y=m.length;p<y;++p){const _=m[p],E=_.getGeometry();Ue(e,E.getExtent())&&t.push(_)}}}}),t}handleFontsChanged(){const e=this.getLayer();e.getVisible()&&this.renderedLayerRevision_!==void 0&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}renderDeclutter(e,t){const n=this.context,r=n.globalAlpha;n.globalAlpha=t.opacity;const s=e.viewHints,o=!(s[Oe.ANIMATING]||s[Oe.INTERACTING]),a=[this.context.canvas.width,this.context.canvas.height],l=this.getLayer().getDeclutter(),u=l?e.declutter?.[l]:void 0,c=te(this.getLayer()),h=this.renderedTiles;for(let d=0,f=h.length;d<f;++d){const g=h[d],m=g.executorGroups[c];if(m)for(let p=m.length-1;p>=0;--p)m[p].execute(this.context,a,this.getTileRenderTransform(g,e),e.viewState.rotation,o,Qo,u)}n.globalAlpha=r}renderDeferredInternal(e){const t=this.renderedTiles,n=te(this.getLayer()),r=t.reduce((l,u,c)=>(u.executorGroups[n].forEach(h=>l.push({executorGroup:h,index:c})),l),[]),s=r.map(({executorGroup:l})=>l.getDeferredZIndexContexts()),o={};for(let l=0,u=r.length;l<u;++l){const c=r[l].executorGroup.getDeferredZIndexContexts();for(const h in c)o[h]=!0}const a=Object.keys(o).map(Number).sort(Kt);this.layerExtent&&this.clipUnrotated(this.context,e,this.layerExtent),a.forEach(l=>{s.forEach((u,c)=>{u[l]&&(u[l].forEach(h=>{const{executorGroup:d,index:f}=r[c],g=d.getRenderedContext(),m=g.globalAlpha;g.globalAlpha=this.renderedOpacity_;const p=this.tileClipContexts_[f];p&&p.draw(g),h.draw(g),p&&g.restore(),g.globalAlpha=m,h.clear()}),u[l].length=0)})}),this.layerExtent&&this.context.restore()}getTileRenderTransform(e,t){const n=t.pixelRatio,r=t.viewState,s=r.center,o=r.resolution,a=r.rotation,l=t.size,u=Math.round(l[0]*n),c=Math.round(l[1]*n),d=this.getLayer().getSource().getTileGridForProjection(t.viewState.projection),f=e.tileCoord,g=d.getTileCoordExtent(e.wrappedTileCoord),m=d.getTileCoordExtent(f,this.tempExtent)[0]-g[0];return Ua(Ba(this.inversePixelTransform.slice(),1/n,1/n),this.getRenderTransform(s,o,a,n,u,c,m))}postRender(e,t){const n=t.viewHints,r=!(n[Oe.ANIMATING]||n[Oe.INTERACTING]);this.renderedPixelToCoordinateTransform_=t.pixelToCoordinateTransform.slice(),this.renderedRotation_=t.viewState.rotation,this.renderedOpacity_=t.layerStatesArray[t.layerIndex].opacity;const s=this.getLayer(),o=s.getRenderMode(),a=e.globalAlpha;e.globalAlpha=this.renderedOpacity_;const l=s.getDeclutter(),u=l?Kf[o].filter(w=>!Qo.includes(w)):Kf[o],c=t.viewState,h=c.rotation;this.layerExtent&&this.clipUnrotated(e,t,this.layerExtent);const d=s.getSource(),g=d.getTileGridForProjection(c.projection).getZForResolution(c.resolution,d.zDirection),m=this.renderedTiles,p=[],y=[],_=[],E=te(s);let x=!0;for(let w=m.length-1;w>=0;--w){const C=m[w];x=x&&!C.getReplayState(s).dirty;const b=C.executorGroups[E].filter(S=>S.hasExecutors(u));if(b.length===0)continue;const v=this.getTileRenderTransform(C,t),R=C.tileCoord[0];let A=!1;const F=b[0].getClipCoords(v);let O=e,I;if(F){I=new Kl,O=I.getContext();for(let S=0,U=p.length;S<U;++S)if(g!==R&&R<y[S]){const k=p[S];Ue([F[0],F[3],F[4],F[7]],[k[0],k[3],k[4],k[7]])&&(A||(O.save(),A=!0),O.beginPath(),O.moveTo(F[0],F[1]),O.lineTo(F[2],F[3]),O.lineTo(F[4],F[5]),O.lineTo(F[6],F[7]),O.moveTo(k[6],k[7]),O.lineTo(k[4],k[5]),O.lineTo(k[2],k[3]),O.lineTo(k[0],k[1]),O.clip())}p.push(F),y.push(R)}for(let S=0,U=b.length;S<U;++S)b[S].execute(e,[e.canvas.width,e.canvas.height],v,h,r,u,t.declutter?.[l]);A&&(O===e?O.restore():_[w]=I)}this.layerExtent&&e.restore(),e.globalAlpha=a,this.ready=x,this.tileClipContexts_=_,t.declutter||this.renderDeferredInternal(t),super.postRender(e,t)}renderFeature(e,t,n,r,s,o){if(!n)return!1;let a=!1;if(Array.isArray(n))for(let l=0,u=n.length;l<u;++l)a=ea(r,e,n[l],t,this.boundHandleStyleImageChange_,void 0,s,o)||a;else a=ea(r,e,n,t,this.boundHandleStyleImageChange_,void 0,s,o);return a}tileImageNeedsRender_(e){const t=this.getLayer();if(t.getRenderMode()==="vector")return!1;const n=e.getReplayState(t),r=t.getRevision(),s=e.wantedResolution;return n.renderedTileResolution!==s||n.renderedTileRevision!==r}renderTileImage_(e,t){const n=this.getLayer(),r=e.getReplayState(n),s=n.getRevision(),o=e.executorGroups[te(n)];r.renderedTileRevision=s;const a=e.wrappedTileCoord,l=a[0],u=n.getSource();let c=t.pixelRatio;const d=t.viewState.projection,f=u.getTileGridForProjection(d),g=f.getResolution(e.tileCoord[0]),m=t.pixelRatio/e.wantedResolution*g,p=f.getResolution(l),y=e.getContext();c=Math.round(Math.max(c,m/c));const _=u.getTilePixelSize(l,c,d);y.canvas.width=_[0],y.canvas.height=_[1];const E=c/m;if(E!==1){const b=Hc(this.tmpTransform_);Ba(b,E,E),y.setTransform.apply(y,b)}const x=f.getTileCoordExtent(a,this.tempExtent),w=m/p,C=Hc(this.tmpTransform_);Ba(C,w,-w),lm(C,-x[0],-x[3]);for(let b=0,v=o.length;b<v;++b)o[b].execute(y,[y.canvas.width*E,y.canvas.height*E],C,0,!0,ow[n.getRenderMode()],null);r.renderedTileResolution=e.wantedResolution}}class Cs extends Xl{constructor(e){e=e||{};const t=Object.assign({},e);delete t.preload;const n=e.cacheSize===void 0?0:e.cacheSize;delete e.cacheSize,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n;const r=e.renderMode||"hybrid";xe(r=="hybrid"||r=="vector","`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=r,this.setPreload(e.preload?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0),this.getBackground,this.setBackground}createRenderer(){return new aw(this,{cacheSize:this.cacheSize_})}getFeatures(e){return super.getFeatures(e)}getFeaturesInExtent(e){return this.getRenderer().getFeaturesInExtent(e)}getRenderMode(){return this.renderMode_}getPreload(){return this.get(Wn.PRELOAD)}getUseInterimTilesOnError(){return this.get(Wn.USE_INTERIM_TILES_ON_ERROR)}setPreload(e){this.set(Wn.PRELOAD,e)}setUseInterimTilesOnError(e){this.set(Wn.USE_INTERIM_TILES_ON_ERROR,e)}}function lw(i,e){return[[-1/0,-1/0,1/0,1/0]]}function uw(i,e){return[i]}function cw(i,e,t,n){const r=document.createElement("script"),s="olc_"+te(e);function o(){delete window[s],r.parentNode.removeChild(r)}r.async=!0,r.src=i+(i.includes("?")?"&":"?")+"callback="+s;const a=setTimeout(function(){o(),t&&t()},1e4);window[s]=function(l){clearTimeout(a),o(),e(l)},document.head.appendChild(r)}class $f extends Cd{constructor(e){if(super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:we("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:"loading",tileLoadFunction:e.tileLoadFunction,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,zDirection:e.zDirection}),this.tileJSON_=null,this.tileSize_=e.tileSize,e.url)if(e.jsonp)cw(e.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const t=new XMLHttpRequest;t.addEventListener("load",this.onXHRLoad_.bind(this)),t.addEventListener("error",this.onXHRError_.bind(this)),t.open("GET",e.url),t.send()}else if(e.tileJSON)this.handleTileJSONResponse(e.tileJSON);else throw new Error("Either `url` or `tileJSON` options must be provided")}onXHRLoad_(e){const t=e.target;if(!t.status||t.status>=200&&t.status<300){let n;try{n=JSON.parse(t.responseText)}catch{this.handleTileJSONError();return}this.handleTileJSONResponse(n)}else this.handleTileJSONError()}onXHRError_(e){this.handleTileJSONError()}getTileJSON(){return this.tileJSON_}handleTileJSONResponse(e){const t=we("EPSG:4326"),n=this.getProjection();let r;if(e.bounds!==void 0){const u=ji(t,n);r=Ic(e.bounds,u)}const s=os(n),o=e.minzoom||0,a=e.maxzoom||22,l=wo({extent:s,maxZoom:a,minZoom:o,tileSize:this.tileSize_});if(this.tileGrid=l,this.tileUrlFunction=wd(e.tiles,l),e.attribution&&!this.getAttributions()){const u=r!==void 0?r:s;this.setAttributions(function(c){return Ue(u,c.extent)?[e.attribution]:null})}this.tileJSON_=e,this.setState("ready")}handleTileJSONError(){this.setState("error")}}let hw=!1;function Zf(i,e,t,n,r,s,o){const a=new XMLHttpRequest;a.open("GET",typeof i=="function"?i(t,n,r):i,!0),e.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=hw,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){const u=e.getType();try{let c;u=="text"||u=="json"?c=a.responseText:u=="xml"?c=a.responseXML||a.responseText:u=="arraybuffer"&&(c=a.response),c?s(e.readFeatures(c,{extent:t,featureProjection:r}),e.readProjection(c)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function qf(i,e){return function(t,n,r,s,o){Zf(i,e,t,n,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}class Hf{constructor(e){this.rbush_=new Mh(e),this.items_={}}insert(e,t){const n={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(n),this.items_[te(t)]=n}load(e,t){const n=new Array(t.length);for(let r=0,s=t.length;r<s;r++){const o=e[r],a=t[r],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};n[r]=l,this.items_[te(a)]=l}this.rbush_.load(n)}remove(e){const t=te(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){const n=this.items_[te(t)],r=[n.minX,n.minY,n.maxX,n.maxY];ln(r,e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(e){const t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(r){return r.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let n;for(let r=0,s=e.length;r<s;r++)if(n=t(e[r]),n)return n;return n}isEmpty(){return Sn(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){const t=this.rbush_.toJSON();return an(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(const t in e.items_)this.items_[t]=e.items_[t]}}const Dt={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};class qn extends Gt{constructor(e,t,n){super(e),this.feature=t,this.features=n}}class yr extends tr{constructor(e){e=e||{},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:e.wrapX!==void 0?e.wrapX:!0}),this.on,this.once,this.un,this.loader_=br,this.format_=e.format||null,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader!==void 0?this.loader_=e.loader:this.url_!==void 0&&(xe(this.format_,"`format` must be set when `url` is set"),this.loader_=qf(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:lw;const t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new Hf:null,this.loadedExtentsRtree_=new Hf,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let n,r;Array.isArray(e.features)?r=e.features:e.features&&(n=e.features,r=n.getArray()),!t&&n===void 0&&(n=new At(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){const t=te(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);const n=e.getGeometry();if(n){const r=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(r,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new qn(Dt.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof ht||(this.featureChangeKeys_[e]=[fe(t,$.CHANGE,this.handleFeatureChange_,this),fe(t,Ai.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let n=!0;if(t.getId()!==void 0){const r=String(t.getId());if(!(r in this.idIndex_))this.idIndex_[r]=t;else if(t instanceof ht){const s=this.idIndex_[r];s instanceof ht?Array.isArray(s)?s.push(t):this.idIndex_[r]=[s,t]:n=!1}else n=!1}return n&&(xe(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),n}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){const t=[],n=[],r=[];for(let s=0,o=e.length;s<o;s++){const a=e[s],l=te(a);this.addToIndex_(l,a)&&n.push(a)}for(let s=0,o=n.length;s<o;s++){const a=n[s],l=te(a);this.setupChangeEvents_(l,a);const u=a.getGeometry();if(u){const c=u.getExtent();t.push(c),r.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(t,r),this.hasListener(Dt.ADDFEATURE))for(let s=0,o=n.length;s<o;s++)this.dispatchEvent(new qn(Dt.ADDFEATURE,n[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(Dt.ADDFEATURE,function(n){t||(t=!0,e.push(n.feature),t=!1)}),this.addEventListener(Dt.REMOVEFEATURE,function(n){t||(t=!0,e.remove(n.feature),t=!1)}),e.addEventListener(wt.ADD,n=>{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(wt.REMOVE,n=>{t||(t=!0,this.removeFeature(n.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(const n in this.featureChangeKeys_)this.featureChangeKeys_[n].forEach(Me);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(n=>{this.removeFeatureInternal(n)});for(const n in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[n])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const t=new qn(Dt.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){const n=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(n,function(r){const s=r.getGeometry();if(s instanceof ht||s.intersectsCoordinate(e))return t(r)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(n){const r=n.getGeometry();if(r instanceof ht||r.intersectsExtent(e)){const s=t(n);if(s)return s}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),Sn(this.nullGeometryFeatures_)||$t(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){const t=[];return this.forEachFeatureAtCoordinateDirect(e,function(n){t.push(n)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);const r=Ac(e,t);return[].concat(...r.map(s=>this.featuresRtree_.getInExtent(s)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){const n=e[0],r=e[1];let s=null;const o=[NaN,NaN];let a=1/0;const l=[-1/0,-1/0,1/0,1/0];return t=t||Cr,this.featuresRtree_.forEachInExtent(l,function(u){if(t(u)){const c=u.getGeometry(),h=a;if(a=c instanceof ht?0:c.closestPointXY(n,r,o,a),a<h){s=u;const d=Math.sqrt(a);l[0]=n-d,l[1]=r-d,l[2]=n+d,l[3]=r+d}}}),s}getExtent(e){return this.featuresRtree_?.getExtent(e)??null}getFeatureById(e){const t=this.idIndex_[e.toString()];return t!==void 0?t:null}getFeatureByUid(e){const t=this.uidIndex_[e];return t!==void 0?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){const t=e.target,n=te(t),r=t.getGeometry();if(!r)n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[n]=t);else{const o=r.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(o,t)):this.featuresRtree_&&this.featuresRtree_.update(o,t)}const s=t.getId();if(s!==void 0){const o=s.toString();this.idIndex_[o]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[o]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[n]=t;this.changed(),this.dispatchEvent(new qn(Dt.CHANGEFEATURE,t))}hasFeature(e){const t=e.getId();return t!==void 0?t in this.idIndex_:te(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Sn(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,n){const r=this.loadedExtentsRtree_,s=this.strategy_(e,t,n);for(let o=0,a=s.length;o<a;++o){const l=s[o];if(!r.forEachInExtent(l,function(c){return on(c.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new qn(Dt.FEATURESLOADSTART));const c=g=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new qn(Dt.FEATURESLOADEND,void 0,g))},h=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new qn(Dt.FEATURESLOADERROR))};let d=!1;const f=this.loader_.call(this,l,t,n,g=>d||c(g),()=>d||h());f instanceof Promise?(d=!0,f.then(g=>{this.addFeatures(g),c(g)}).catch(h)):this.loader_.length<4&&(this.loading=!1),r.insert(l,{extent:l.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){const t=this.loadedExtentsRtree_,n=t.forEachInExtent(e,function(r){if(ln(r.extent,e))return r});n&&t.remove(n)}removeFeatures(e){let t=!1;for(let n=0,r=e.length;n<r;++n)t=this.removeFeatureInternal(e[n])||t;t&&this.changed()}removeFeature(e){if(!e)return;this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){const t=te(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.featureChangeKeys_[t]?.forEach(Me),delete this.featureChangeKeys_[t];const r=e.getId();if(r!==void 0){const s=r.toString(),o=this.idIndex_[s];o===e?delete this.idIndex_[s]:Array.isArray(o)&&(o.splice(o.indexOf(e),1),o.length===1&&(this.idIndex_[s]=o[0]))}return delete this.uidIndex_[t],this.hasListener(Dt.REMOVEFEATURE)&&this.dispatchEvent(new qn(Dt.REMOVEFEATURE,e)),!0}removeFromIdIndex_(e){for(const t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){xe(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(qf(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}}const Jf=[];class dw extends ss{constructor(e,t,n,r,s){super(e,t,{transition:0}),this.context_=null,this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=r.bind(void 0,this),this.removeSourceTiles_=s,this.wrappedTileCoord=n}getContext(){return this.context_||(this.context_=De(1,1,Jf)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(e){const t=te(e);return t in this.replayState_||(this.replayState_[t]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedPixelRatio:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[t]}load(){this.getSourceTiles()}release(){this.context_&&(kr(this.context_),Jf.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}}let Qf=class extends ss{constructor(e,t,n,r,s,o){super(e,t,o),this.extent=null,this.format_=r,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=s,this.url_=n,this.key=n}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){this.state==G.IDLE&&(this.setState(G.LOADING),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(e,t){this.setFeatures(e)}onError(){this.setState(G.ERROR)}setFeatures(e){this.features_=e,this.setState(G.LOADED)}setLoader(e){this.loader_=e}};class Wu extends Eo{constructor(e){const t=e.projection||"EPSG:3857",n=e.extent||os(t),r=e.tileGrid||wo({extent:n,maxResolution:e.maxResolution,maxZoom:e.maxZoom!==void 0?e.maxZoom:22,minZoom:e.minZoom,tileSize:e.tileSize||512});super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,interpolate:!0,projection:t,state:e.state,tileGrid:r,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:eg,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX===void 0?!0:e.wrapX,transition:e.transition,zDirection:e.zDirection===void 0?1:e.zDirection}),this.format_=e.format?e.format:null,this.tileKeysBySourceTileUrl_={},this.sourceTiles_={},this.overlaps_=e.overlaps==null?!0:e.overlaps,this.tileClass=e.tileClass?e.tileClass:Qf,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceTiles(e,t,n,r){if(n.getState()===G.IDLE){n.setState(G.LOADING);const s=n.wrappedTileCoord,o=this.getTileGridForProjection(t);let a=o.getTileCoordExtent(s);const l=s[0],u=o.getResolution(l);sn(a,-u,a);const c=this.projection;t&&this.projection&&!ut(t,c)&&(a=Xi(a,t,c));const h=this.tileGrid,d=h.getExtent();d&&Xt(a,d,a);let f=u;t&&c&&!ut(t,c)&&(f=u/c.getMetersPerUnit()/t.getMetersPerUnit());const g=h.getZForResolution(f,this.zDirection),m=r||this.tileUrlFunction;h.forEachTileCoord(a,g,p=>{const y=m(p,e,t);this.sourceTiles_[y]||(this.sourceTiles_[y]=new this.tileClass(p,y?G.IDLE:G.EMPTY,y,this.format_,this.tileLoadFunction));const _=this.sourceTiles_[y];n.sourceTiles.push(_),this.tileKeysBySourceTileUrl_[y]||(this.tileKeysBySourceTileUrl_[y]=[]),this.tileKeysBySourceTileUrl_[y].push(n.getKey());const E=_.getState();if(E<G.LOADED){const x=w=>{this.handleTileChange(w);const C=_.getState();if(C===G.LOADED||C===G.ERROR){const b=_.getKey();b in n.errorTileKeys?_.getState()===G.LOADED&&delete n.errorTileKeys[b]:n.loadingSourceTiles--,C===G.ERROR?n.errorTileKeys[b]=!0:_.removeEventListener($.CHANGE,x),n.loadingSourceTiles===0&&n.setState(Sn(n.errorTileKeys)?G.LOADED:G.ERROR)}};_.addEventListener($.CHANGE,x),n.loadingSourceTiles++}E===G.IDLE&&(_.extent=h.getTileCoordExtent(p),_.projection=this.projection,_.resolution=h.getResolution(p[0]),_.load())}),n.loadingSourceTiles||n.setState(n.sourceTiles.some(p=>p.getState()===G.ERROR)?G.ERROR:G.LOADED)}return n.sourceTiles}removeSourceTiles(e){const t=e.getKey(),n=e.sourceTiles;for(let r=0,s=n.length;r<s;++r){const o=n[r].getTileUrl();if(!this.tileKeysBySourceTileUrl_[o])return;const a=this.tileKeysBySourceTileUrl_[o].indexOf(t);a!==-1&&(this.tileKeysBySourceTileUrl_[o].splice(a,1),this.tileKeysBySourceTileUrl_[o].length===0&&(delete this.tileKeysBySourceTileUrl_[o],delete this.sourceTiles_[o]))}}getTile(e,t,n,r,s){const o=[e,t,n];let a=this.getTileCoordForTileUrlFunction(o,s);const l=this.getTileGrid().getExtent(),u=this.projection,c=this.getTileGridForProjection(s);if(a&&l){const g=c.getTileCoordExtent(a);sn(g,-c.getResolution(e),g),Ue(l,!s||!u||ut(s,u)?g:Xi(g,s,u))||(a=null)}let h=!0;if(a!==null){const g=this.tileGrid,m=c.getResolution(e);let p=m;s&&u&&!ut(s,u)&&(p=m/u.getMetersPerUnit()/s.getMetersPerUnit());const y=g.getZForResolution(p,1),_=c.getTileCoordExtent(a);sn(_,-m,_),g.forEachTileCoord(!s||!u||ut(s,u)?_:Xi(_,s,u),y,E=>{h=h&&!this.tileUrlFunction(E,r,u)})}const d=this.tileUrlFunction,f=new dw(o,h?G.EMPTY:G.IDLE,a,g=>this.getSourceTiles(r,s,g,d),this.removeSourceTiles.bind(this));return f.key=this.getKey(),f}getTileGridForProjection(e){const t=e.getCode();let n=this.tileGrids_[t];if(!n){const r=this.projection;if(r!==null&&!ut(r,e))return Hl(e);const s=this.tileGrid,o=s.getResolutions().slice(),a=o.map(function(c,h){return s.getOrigin(h)}),l=o.map(function(c,h){return s.getTileSize(h)}),u=yh+1;for(let c=o.length;c<u;++c)o.push(o[c-1]/2),a.push(a[c-1]),l.push(l[c-1]);n=new xo({extent:s.getExtent(),origins:a,resolutions:o,tileSizes:l}),this.tileGrids_[t]=n}return n}getTilePixelRatio(e){return e}getTilePixelSize(e,t,n){const r=this.getTileGridForProjection(n),s=ct(r.getTileSize(e),this.tmpSize);return[Math.round(s[0]*t),Math.round(s[1]*t)]}setOverlaps(e){this.overlaps_=e,this.changed()}}function eg(i,e){i.setLoader(function(t,n,r){Zf(e,i.getFormat(),t,n,r,i.onLoad.bind(i),i.onError.bind(i))})}function tg(i,e){const t=e[0].evaluate(i),n=e[1].evaluate(i),r=e[2].evaluate(i),s=e[3]?e[3].evaluate(i):1;return Ge.parse(`hsla(${t}, ${n}%, ${r}%, ${s})`)}function fw(i){const e=i[0]/255,t=i[1]/255,n=i[2]/255,r=i[3],s=Math.max(e,t,n),o=Math.min(e,t,n),a=(s+o)/2;let l,u;if(s===o)l=0,u=0;else{const c=s-o;switch(u=a>.5?c/(2-s-o):c/(s+o),s){case e:l=(t-n)/c+(t<n?6:0);break;case t:l=(n-e)/c+2;break;case n:l=(e-t)/c+4;break;default:l=0}l/=6}return[l*360,u*100,a*100,r]}function na(i){if(Array.isArray(i)){if(i.length===0)return i;const e=i[0];if(e==="literal")return i;if(e==="image"&&i.length===3&&typeof i[2]=="object"&&i[2]!==null&&!Array.isArray(i[2]))return["image-config",na(i[1]),["literal",i[2]]];const t=i.length;for(let n=1;n<t;++n){const r=i[n],s=na(r);if(s!==r){const o=[e];for(let a=1;a<n;++a)o.push(i[a]);o.push(s);for(let a=n+1;a<t;++a)o.push(na(i[a]));return o}}}return i}const Vu={},mt={zoom:0,distanceFromCenter:0};Bn.register(No,{...Bn.definitions,pitch:[{kind:"number"},[],i=>mt.pitch||0],"distance-from-center":[{kind:"number"},[],i=>mt.distanceFromCenter||0],"to-hsla":[{kind:"array",itemType:{kind:"number"},N:4},[{kind:"string"}],(i,[e])=>fw(ao(e.evaluate(i)))],hsl:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"}],tg],hsla:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"},{kind:"number"}],tg],"image-config":[{kind:"value"},[{kind:"string"},{kind:"value"}],(i,[e,t])=>e.evaluate(i)],"measure-light":[{kind:"number"},[{kind:"value"}],()=>1],config:[{kind:"value"},[{kind:"string"}],(i,[e])=>{const t=Vu[e.evaluate(i)];return t===void 0?{}:t}]});const ng="https://api.mapbox.com";function Uu(i){const e="mapbox://";return i.indexOf(e)!==0?"":i.slice(e.length)}function gw(i,e,t){if(typeof i=="string")return[{id:"default",url:ig(i,e,t)}];for(const n of i)n.url=ig(n.url,e,t);return i}function ig(i,e,t){const n=Uu(i);if(!e||!n)return decodeURI(new URL(i,t).href);const r="sprites/";if(n.indexOf(r)!==0)throw new Error(`unexpected sprites url: ${i}`);const s=n.slice(r.length);return`${ng}/styles/v1/${s}/sprite?access_token=${e}`}function ia(i,e){const t=Uu(i);if(!t||!e)return decodeURI(new URL(i,location.href).href);const n="styles/";if(t.indexOf(n)!==0)throw new Error(`unexpected style url: ${i}`);const r=t.slice(n.length);return`${ng}/styles/v1/${r}?&access_token=${e}`}const pw=["a","b","c","d"];function ra(i,e,t,n){const r=new URL(i,n||location.href),s=Uu(i);if(!s)return e?(r.searchParams.has(t)||r.searchParams.set(t,e),[decodeURI(r.href)]):[decodeURI(r.href)];if(s==="mapbox.satellite"){const o=window.devicePixelRatio>=1.5?"@2x":"";return[`https://api.mapbox.com/v4/${s}/{z}/{x}/{y}${o}.webp?access_token=${e}`]}return pw.map(o=>`https://${o}.tiles.mapbox.com/v4/${s}/{z}/{x}/{y}.vector.pbf?access_token=${e}`)}class mw extends $l{constructor(e){super(e),this.image=null,this.renderedSourceRevision_=0}getImage(){return this.image?this.image.getImage():null}prepareFrame(e){const t=e.layerStatesArray[e.layerIndex],n=e.pixelRatio,r=e.viewState,s=r.resolution,o=this.getLayer().getSource(),a=e.viewHints;let l=e.extent;if(t.extent!==void 0&&(l=Xt(l,hn(t.extent,r.projection))),!a[Oe.ANIMATING]&&!a[Oe.INTERACTING]&&!Fn(l))if(o){!this.getLayer().rendered&&this.renderedSourceRevision_!==o.getRevision()&&(this.image=null),this.renderedSourceRevision_=o.getRevision();const u=r.projection,c=o.getImage(l,s,n,u);c&&(this.loadImage(c)?this.image=c:c.getState()===X.EMPTY&&(this.image=null))}else this.image=null;return!!this.image}getData(e){const t=this.frameState;if(!t)return null;const n=this.getLayer(),r=qe(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!ti(s,r))return null;const o=this.image.getExtent(),a=this.image.getImage(),l=pe(o),u=Math.floor(a.width*((r[0]-o[0])/l));if(u<0||u>=a.width)return null;const c=Ke(o),h=Math.floor(a.height*((o[3]-r[1])/c));return h<0||h>=a.height?null:this.getImageData(a,u,h)}renderFrame(e,t){const n=this.image,r=n.getExtent(),s=n.getResolution(),[o,a]=Array.isArray(s)?s:[s,s],l=n.getPixelRatio(),u=e.layerStatesArray[e.layerIndex],c=e.pixelRatio,h=e.viewState,d=h.center,f=h.resolution,g=c*o/(f*l),m=c*a/(f*l);this.prepareContainer(e,t);const p=this.context.canvas.width,y=this.context.canvas.height,_=this.getRenderContext(e);let E=!1,x=!0;if(u.extent){const R=hn(u.extent,h.projection);x=Ue(R,e.extent),E=x&&!on(R,e.extent),E&&this.clipUnrotated(_,e,R)}const w=n.getImage(),C=qt(this.tempTransform,p/2,y/2,g,m,0,l*(r[0]-d[0])/o,l*(d[1]-r[3])/a);this.renderedResolution=a*c/l;const b=w.width*C[0],v=w.height*C[3];if(this.getLayer().getSource().getInterpolate()||(_.imageSmoothingEnabled=!1),this.preRender(_,e),x&&b>=.5&&v>=.5){const R=C[4],A=C[5],F=u.opacity;F!==1&&(_.save(),_.globalAlpha=F),_.drawImage(w,0,0,+w.width,+w.height,R,A,b,v),F!==1&&_.restore()}return this.postRender(this.context,e),E&&_.restore(),_.imageSmoothingEnabled=!0,this.container}}class yw extends Vi{constructor(e){e=e||{},super(e)}}class Yu extends yw{constructor(e){super(e)}createRenderer(){return new mw(this)}getData(e){return super.getData(e)}}class _w extends Ol{constructor(e,t,n,r,s){const o=s!==void 0?X.IDLE:X.LOADED;super(e,t,n,o),this.loader_=s!==void 0?s:null,this.canvas_=r,this.error_=null}getError(){return this.error_}handleLoad_(e){e?(this.error_=e,this.state=X.ERROR):this.state=X.LOADED,this.changed()}load(){this.state==X.IDLE&&(this.state=X.LOADING,this.changed(),this.loader_(this.handleLoad_.bind(this)))}getImage(){return this.canvas_}}function Bu(i){return Array.isArray(i)?Math.min(...i):i}class xw extends Ol{constructor(e,t,n,r,s,o,a){let l=e.getExtent();l&&e.canWrapX()&&(l=l.slice(),l[0]=-1/0,l[2]=1/0);let u=t.getExtent();u&&t.canWrapX()&&(u=u.slice(),u[0]=-1/0,u[2]=1/0);const c=u?Xt(n,u):n,h=Et(c),d=Bl(e,t,h,r),f=fd,g=new dd(e,t,c,l,d*f,r),m=g.calculateSourceExtent(),p=Fn(m)?null:o(m,d,s),y=p?X.IDLE:X.EMPTY,_=p?p.getPixelRatio():1;super(n,r,_,y),this.targetProj_=t,this.maxSourceExtent_=l,this.triangulation_=g,this.targetResolution_=r,this.targetExtent_=n,this.sourceImage_=p,this.sourcePixelRatio_=_,this.interpolate_=a,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==X.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const e=this.sourceImage_.getState();if(e==X.LOADED){const t=pe(this.targetExtent_)/this.targetResolution_,n=Ke(this.targetExtent_)/this.targetResolution_;this.canvas_=cd(t,n,this.sourcePixelRatio_,Bu(this.sourceImage_.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_,!0)}this.state=e,this.changed()}load(){if(this.state==X.IDLE){this.state=X.LOADING,this.changed();const e=this.sourceImage_.getState();e==X.LOADED||e==X.ERROR?this.reproject_():(this.sourceListenerKey_=fe(this.sourceImage_,$.CHANGE,t=>{const n=this.sourceImage_.getState();(n==X.LOADED||n==X.ERROR)&&(this.unlistenSource_(),this.reproject_())}),this.sourceImage_.load())}}unlistenSource_(){Me(this.sourceListenerKey_),this.sourceListenerKey_=null}}const sa=4,Ku={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class ww extends Gt{constructor(e,t){super(e),this.image=t}}class rg extends tr{constructor(e){super({attributions:e.attributions,projection:e.projection,state:e.state,interpolate:e.interpolate!==void 0?e.interpolate:!0}),this.on,this.once,this.un,this.loader=e.loader||null,this.resolutions_=e.resolutions!==void 0?e.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=e.loader?e.loader.length===0:!1,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(e){this.resolutions_=e}findNearestResolution(e){const t=this.getResolutions();if(t){const n=Ls(t,e,0);e=t[n]}return e}getImage(e,t,n,r){const s=this.getProjection();if(!s||!r||ut(s,r))return s&&(r=s),this.getImageInternal(e,t,n,r);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&ut(this.reprojectedImage_.getProjection(),r)&&this.reprojectedImage_.getResolution()==t&&ln(this.reprojectedImage_.getExtent(),e))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new xw(s,r,e,t,n,(o,a,l)=>this.getImageInternal(o,a,l,s),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(e,t,n,r){if(this.loader){const s=Ew(e,t,n,1),o=this.findNearestResolution(t);if(this.image&&(this.static_||this.wantedProjection_===r&&(this.wantedExtent_&&on(this.wantedExtent_,s)||on(this.image.getExtent(),s))&&(this.wantedResolution_&&Bu(this.wantedResolution_)===o||Bu(this.image.getResolution())===o)))return this.image;this.wantedProjection_=r,this.wantedExtent_=s,this.wantedResolution_=o,this.image=new Ol(s,o,n,this.loader),this.image.addEventListener($.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(e){const t=e.target;let n;switch(t.getState()){case X.LOADING:this.loading=!0,n=Ku.IMAGELOADSTART;break;case X.LOADED:this.loading=!1,n=Ku.IMAGELOADEND;break;case X.ERROR:this.loading=!1,n=Ku.IMAGELOADERROR;break;default:return}this.hasListener(n)&&this.dispatchEvent(new ww(n,t))}}function Ew(i,e,t,n){const r=e/t,s=Et(i),o=Ln(pe(i)/r,sa),a=Ln(Ke(i)/r,sa),l=Ln((n-1)*o/2,sa),u=o+2*l,c=Ln((n-1)*a/2,sa),h=a+2*c;return js(s,r,0,[u,h])}function sg(i){return function(e){const t=e.buffers,n=e.meta,r=e.imageOps,s=e.width,o=e.height,a=t.length,l=t[0].byteLength;if(r){const d=new Array(a);for(let g=0;g<a;++g)d[g]=new ImageData(new Uint8ClampedArray(t[g]),s,o);return i(d,n).data.buffer}const u=new Uint8ClampedArray(l),c=new Array(a),h=new Array(a);for(let d=0;d<a;++d)c[d]=new Uint8ClampedArray(t[d]),h[d]=[0,0,0,0];for(let d=0;d<l;d+=4){for(let g=0;g<a;++g){const m=c[g];h[g][0]=m[d],h[g][1]=m[d+1],h[g][2]=m[d+2],h[g][3]=m[d+3]}const f=i(h,n);u[d]=f[0],u[d+1]=f[1],u[d+2]=f[2],u[d+3]=f[3]}return u.buffer}}function vw(i,e){const n=Object.keys(i.lib||{}).map(function(s){return"const "+s+" = "+i.lib[s].toString()+";"}).concat(["const __minion__ = ("+sg.toString()+")(",i.operation.toString(),");",'self.addEventListener("message", function(event) {'," const buffer = __minion__(event.data);"," self.postMessage({buffer: buffer, meta: event.data.meta}, [buffer]);","});"]),r=new Worker(typeof Blob>"u"?"data:text/javascript;base64,"+Buffer.from(n.join(`
|
|
8
|
+
`),"binary").toString("base64"):URL.createObjectURL(new Blob(n,{type:"text/javascript"})));return r.addEventListener("message",e),r}function Cw(i,e){const t=sg(i.operation);let n=!1;return{postMessage:function(r){setTimeout(function(){n||e({data:{buffer:t(r),meta:r.meta}})},0)},terminate:function(){n=!0}}}class bw extends vr{constructor(e){super(),this.imageOps_=!!e.imageOps;let t;e.threads===0?t=0:this.imageOps_?t=1:t=e.threads||1;const n=new Array(t);if(t)for(let r=0;r<t;++r)n[r]=vw(e,this.onWorkerMessage_.bind(this,r));else n[0]=Cw(e,this.onWorkerMessage_.bind(this,0));this.workers_=n,this.queue_=[],this.maxQueueLength_=e.queue||1/0,this.running_=0,this.dataLookup_={},this.job_=null}process(e,t,n){this.enqueue_({inputs:e,meta:t,callback:n}),this.dispatch_()}enqueue_(e){for(this.queue_.push(e);this.queue_.length>this.maxQueueLength_;)this.queue_.shift().callback(null,null)}dispatch_(){if(this.running_||this.queue_.length===0)return;const e=this.queue_.shift();this.job_=e;const t=e.inputs[0].width,n=e.inputs[0].height,r=e.inputs.map(function(l){return l.data.buffer}),s=this.workers_.length;if(this.running_=s,s===1){this.workers_[0].postMessage({buffers:r,meta:e.meta,imageOps:this.imageOps_,width:t,height:n},r);return}const o=e.inputs[0].data.length,a=4*Math.ceil(o/4/s);for(let l=0;l<s;++l){const u=l*a,c=[];for(let h=0,d=r.length;h<d;++h)c.push(r[h].slice(u,u+a));this.workers_[l].postMessage({buffers:c,meta:e.meta,imageOps:this.imageOps_,width:t,height:n},c)}}onWorkerMessage_(e,t){this.disposed||(this.dataLookup_[e]=t.data,--this.running_,this.running_===0&&this.resolveJob_())}resolveJob_(){const e=this.job_,t=this.workers_.length;let n,r;if(t===1)n=new Uint8ClampedArray(this.dataLookup_[0].buffer),r=this.dataLookup_[0].meta;else{const s=e.inputs[0].data.length;n=new Uint8ClampedArray(s),r=new Array(t);const o=4*Math.ceil(s/4/t);for(let a=0;a<t;++a){const l=this.dataLookup_[a].buffer,u=a*o;n.set(new Uint8ClampedArray(l),u),r[a]=this.dataLookup_[a].meta}}this.job_=null,this.dataLookup_={},e.callback(null,new ImageData(n,e.inputs[0].width,e.inputs[0].height),r),this.dispatch_()}disposeInternal(){for(let e=0;e<this.workers_.length;++e)this.workers_[e].terminate();this.workers_.length=0}}const og={BEFOREOPERATIONS:"beforeoperations",AFTEROPERATIONS:"afteroperations"};class ag extends Gt{constructor(e,t,n){super(e),this.extent=t.extent,this.resolution=t.viewState.resolution/t.pixelRatio,this.data=n}}class $u extends rg{constructor(e){super({projection:null}),this.on,this.once,this.un,this.processor_=null,this.operationType_=e.operationType!==void 0?e.operationType:"pixel",this.threads_=e.threads!==void 0?e.threads:1,this.layers_=Sw(e.sources);const t=this.changed.bind(this);for(let n=0,r=this.layers_.length;n<r;++n)this.layers_[n].addEventListener($.CHANGE,t);this.useResolutions_=e.resolutions!==null,this.tileQueue_=new wc(function(){return 1},this.processSources_.bind(this)),this.requestedFrameState_,this.renderedImageCanvas_=null,this.renderedRevision_,this.frameState_={animate:!1,coordinateToPixelTransform:vt(),declutter:null,extent:null,index:0,layerIndex:0,layerStatesArray:Tw(this.layers_),pixelRatio:1,pixelToCoordinateTransform:vt(),postRenderFunctions:[],size:[0,0],tileQueue:this.tileQueue_,time:Date.now(),usedTiles:{},viewState:{rotation:0},viewHints:[],wantedTiles:{},mapId:te(this),renderTargets:{}},this.setAttributions(function(n){const r=[];for(let s=0,o=e.sources.length;s<o;++s){const a=e.sources[s],l=a instanceof tr?a:a.getSource();if(!l)continue;const u=l.getAttributions()?.(n);typeof u=="string"?r.push(u):u!==void 0&&r.push(...u)}return r}),e.operation!==void 0&&this.setOperation(e.operation,e.lib)}setOperation(e,t){this.processor_&&this.processor_.dispose(),this.processor_=new bw({operation:e,imageOps:this.operationType_==="image",queue:1,lib:t,threads:this.threads_}),this.changed()}updateFrameState_(e,t,n){const r=Object.assign({},this.frameState_);r.viewState=Object.assign({},r.viewState);const s=Et(e);r.size[0]=Math.ceil(pe(e)/t),r.size[1]=Math.ceil(Ke(e)/t),r.extent=[s[0]-r.size[0]*t/2,s[1]-r.size[1]*t/2,s[0]+r.size[0]*t/2,s[1]+r.size[1]*t/2],r.time=Date.now();const o=r.viewState;return o.center=s,o.projection=n,o.resolution=t,r}allSourcesReady_(){let e=!0,t;for(let n=0,r=this.layers_.length;n<r;++n)if(t=this.layers_[n].getSource(),!t||t.getState()!=="ready"){e=!1;break}return e}getImage(e,t,n,r){if(!this.allSourcesReady_())return null;this.tileQueue_.loadMoreTiles(16,16),t=this.findNearestResolution(t);const s=this.updateFrameState_(e,t,r);if(this.requestedFrameState_=s,this.renderedImageCanvas_){const o=this.renderedImageCanvas_.getResolution(),a=this.renderedImageCanvas_.getExtent();(t!==o||!ln(s.extent,a))&&(this.renderedImageCanvas_=null)}return(!this.renderedImageCanvas_||this.getRevision()!==this.renderedRevision_)&&this.processSources_(),s.animate&&requestAnimationFrame(this.changed.bind(this)),this.renderedImageCanvas_}processSources_(){const e=this.requestedFrameState_,t=this.layers_.length,n=new Array(t);for(let s=0;s<t;++s){e.layerIndex=s,e.renderTargets={};const o=Rw(this.layers_[s],e);if(o)n[s]=o;else return}const r={};this.dispatchEvent(new ag(og.BEFOREOPERATIONS,e,r)),this.processor_.process(n,r,this.onWorkerComplete_.bind(this,e))}onWorkerComplete_(e,t,n,r){if(t||!n)return;const s=e.extent,o=e.viewState.resolution;if(o!==this.requestedFrameState_.viewState.resolution||!ln(s,this.requestedFrameState_.extent))return;let a;if(this.renderedImageCanvas_)a=this.renderedImageCanvas_.getImage().getContext("2d");else{const l=Math.round(pe(s)/o),u=Math.round(Ke(s)/o);a=De(l,u),this.renderedImageCanvas_=new _w(s,o,1,a.canvas)}a.putImageData(n,0,0),e.animate?requestAnimationFrame(this.changed.bind(this)):this.changed(),this.renderedRevision_=this.getRevision(),this.dispatchEvent(new ag(og.AFTEROPERATIONS,e,r))}getResolutions(e){if(!this.useResolutions_)return null;let t=super.getResolutions();if(!t)for(let n=0,r=this.layers_.length;n<r&&(t=this.layers_[n].getSource().getResolutions(e),!t);++n);return t}disposeInternal(){this.processor_&&this.processor_.dispose(),super.disposeInternal()}}$u.prototype.dispose;let Ri=null;function Rw(i,e){const t=i.getRenderer();if(!t)throw new Error("Unsupported layer type: "+i);if(!t.prepareFrame(e))return null;const n=e.size[0],r=e.size[1];if(n===0||r===0)return null;const s=t.renderFrame(e,null);let o;if(s instanceof HTMLCanvasElement)o=s;else{if(s&&(o=s.firstElementChild),!(o instanceof HTMLCanvasElement))throw new Error("Unsupported rendered element: "+o);if(o.width===n&&o.height===r)return o.getContext("2d").getImageData(0,0,n,r)}if(!Ri)Ri=De(n,r,void 0,{willReadFrequently:!0});else{const a=Ri.canvas;a.width!==n||a.height!==r?Ri=De(n,r,void 0,{willReadFrequently:!0}):Ri.clearRect(0,0,n,r)}return Ri.drawImage(o,0,0,n,r),Ri.getImageData(0,0,n,r)}function Tw(i){return i.map(function(e){return e.getLayerState()})}function Sw(i){const e=i.length,t=new Array(e);for(let n=0;n<e;++n)t[n]=Iw(i[n]);return t}function Iw(i){let e;return i instanceof tr?i instanceof vd?e=new ql({source:i}):i instanceof rg&&(e=new Yu({source:i})):e=i,e}function Mw(i,e){const t=i[0],n=t.width,r=t.height,s=t.data,o=new Uint8ClampedArray(s.length),a=e.resolution*2,l=n-1,u=r-1,c=[0,0,0,0],h=Math.PI,d=e.encoding,f=e.exaggeration,g=e.zoom,m=e.method||"standard",p=e.accentColor,y=e.shadowColors||[e.shadowColor],_=e.highlightColors||[e.highlightColor],x=(e.azimuths||[e.sunAz]).map(W=>W*h/180),C=(e.altitudes||[45]).map(W=>W*h/180),b=Math.min(x.length,C.length,y.length,_.length,4),v=g<2?.4:g<4.5?.35:.3,R=g<15?Math.pow(2,(15-g)*v):1;function A(W,P="mapbox"){return P==="mapbox"?(W[0]*256*256+W[1]*256+W[2])*.1-1e4:P==="terrarium"?W[0]*256+W[1]+W[2]/256-32768:0}function F(W,P){return W!==0?Math.atan2(P,-W):h/2*(P>0?1:-1)}function O(W,P){const Xe=x[0]+h,Ze=Math.atan(.625*Math.sqrt(W*W+P*P)),q=F(W,P),Ee=1.875-f*1.75,Ce=.5*h,ne=f!==.5?(Math.pow(Ee,Ze)-1)/(Math.pow(Ee,Ce)-1)*Ce:Ze,me=Math.cos(ne),oe=Math.min(Math.max(f*2,0),1),_e=(1-me)*oe,Se=p,Pe=Se.r*_e,Le=Se.g*_e,Bt=Se.b*_e,he=Se.a*_e;let ie=(q+Xe)/h+.5;ie=ie%2,ie<0&&(ie+=2);const B=Math.abs(ie-1),de=Math.sin(ne)*oe,Ie=y[0],re=_[0],ye=(Ie.r*(1-B)+re.r*B)*de,We=(Ie.g*(1-B)+re.g*B)*de,Ye=(Ie.b*(1-B)+re.b*B)*de,Je=(Ie.a*(1-B)+re.a*B)*de;return[Pe*(1-Je)+ye,Le*(1-Je)+We,Bt*(1-Je)+Ye,he*(1-Je)+Je]}function I(W,P){W*=f*2,P*=f*2;const Xe=F(W,P),Ze=x[0]+h,q=Math.atan(Math.sqrt(W*W+P*P))*(2/h);let Ee=(Xe+Ze)/h+.5;Ee=Ee%2,Ee<0&&(Ee+=2);const Ce=1-Math.abs(Ee-1),ne=q*Ce,me=q*(1-Ce),oe=y[0],_e=_[0];return[oe.r*ne+_e.r*me,oe.g*ne+_e.g*me,oe.b*ne+_e.b*me,oe.a*ne+_e.a*me]}function S(W,P){W*=f*2,P*=f*2;const Xe=x[0]+h,Ze=Math.cos(Xe),q=Math.sin(Xe),Ee=Math.cos(C[0]),ne=(Math.sin(C[0])-(P*Ze*Ee-W*q*Ee))/Math.sqrt(1+W*W+P*P),me=Math.max(0,Math.min(1,ne));if(me>.5){const Se=2*me-1,Pe=_[0];return[Pe.r*Se,Pe.g*Se,Pe.b*Se,Pe.a*Se]}const oe=1-2*me,_e=y[0];return[_e.r*oe,_e.g*oe,_e.b*oe,_e.a*oe]}function U(W,P){W*=f*2,P*=f*2;const Xe=x[0]+h,Ze=Math.cos(Xe),q=Math.sin(Xe),Ee=Math.cos(C[0]),Ce=Math.sin(C[0]);let ne=Math.acos((Ce-(P*Ze*Ee-W*q*Ee))/Math.sqrt(1+W*W+P*P));ne=Math.max(0,Math.min(h/2,ne));const me=Math.atan(Math.sqrt(W*W+P*P))*(4/h/h),oe=ne*me,_e=(h/2-ne)*me,Se=y[0],Pe=_[0];return[Se.r*oe+Pe.r*_e,Se.g*oe+Pe.g*_e,Se.b*oe+Pe.b*_e,Se.a*oe+Pe.a*_e]}function k(W,P){W*=f*2,P*=f*2;const Xe=W*W+P*P,Ze=Math.sqrt(1+Xe);let q=0,Ee=0,Ce=0,ne=0;for(let me=0;me<b;me++){const oe=Math.cos(C[me]),_e=Math.sin(C[me]),Se=-Math.cos(x[me]),Pe=-Math.sin(x[me]),Le=(_e-(P*Se*oe-W*Pe*oe))/Ze,Bt=Math.max(0,Math.min(1,Le)),he=y[Math.min(me,y.length-1)],ie=_[Math.min(me,_.length-1)];if(Bt>.5){const B=(2*Bt-1)/b;q+=ie.r*B,Ee+=ie.g*B,Ce+=ie.b*B,ne+=ie.a*B}else{const B=(1-2*Bt)/b;q+=he.r*B,Ee+=he.g*B,Ce+=he.b*B,ne+=he.a*B}}return[q,Ee,Ce,ne]}const N=m==="igor"?I:m==="basic"?S:m==="combined"?U:m==="multidirectional"?k:O;let D,T,V,Z,ce,Ae,L,le,H,Re,Te;for(T=0;T<=u;++T)for(ce=T===0?0:T-1,Ae=T===u?u:T+1,D=0;D<=l;++D){V=D===0?0:D-1,Z=D===l?l:D+1,L=(T*n+V)*4,c[0]=s[L],c[1]=s[L+1],c[2]=s[L+2],c[3]=s[L+3],le=A(c,d),L=(T*n+Z)*4,c[0]=s[L],c[1]=s[L+1],c[2]=s[L+2],c[3]=s[L+3],H=A(c,d),Re=(H-le)/a*R,L=(ce*n+D)*4,c[0]=s[L],c[1]=s[L+1],c[2]=s[L+2],c[3]=s[L+3],le=A(c,d),L=(Ae*n+D)*4,c[0]=s[L],c[1]=s[L+1],c[2]=s[L+2],c[3]=s[L+3],H=A(c,d),Te=(H-le)/a*R;const W=N(Re,Te),P=W[3];L=(T*n+D)*4,P>0&&(o[L]=W[0]/P*255,o[L+1]=W[1]/P*255,o[L+2]=W[2]/P*255),o[L+3]=P*255}return new ImageData(o,n,r)}function Aw(i,e){const t=i[0],n=t.width,r=t.height,s=t.data,o=new Uint8ClampedArray(s.length),a=n-1,l=r-1,u=[0,0,0,0];let c,h,d;function f(v){return v>0?1/(1-v):1+v}function g(v){return v>0?1-1/(1.001-v):-v}function m(v){v*=Math.PI/180;const R=Math.sin(v),A=Math.cos(v);return[(2*A+1)/3,(-Math.sqrt(3)*R-A+1)/3,(Math.sqrt(3)*R-A+1)/3]}const p=g(e.saturation),y=f(e.contrast),_=m(e.hueRotate),E=_,x=[_[2],_[0],_[1]],w=[_[1],_[2],_[0]],C=e.brightnessLow,b=e.brightnessHigh;for(h=0;h<=l;++h)for(c=0;c<=a;++c){d=(h*n+c)*4,u[0]=s[d],u[1]=s[d+1],u[2]=s[d+2],u[3]=s[d+3];const v=u[0],R=u[1],A=u[2],F=(k,N)=>{let D=0;for(let T=0;T<k.length;T++)D+=k[T]*N[T];return D};let O=F([v,R,A],E),I=F([v,R,A],x),S=F([v,R,A],w);const U=(O+I+S)/3;O+=(U-O)*p,I+=(U-I)*p,S+=(U-S)*p,O=(O-127.5)*y+127.5,I=(I-127.5)*y+127.5,S=(S-127.5)*y+127.5,O=C*(255-O)+b*O,I=C*(255-I)+b*I,S=C*(255-S)+b*S,o[d]=O,o[d+1]=I,o[d+2]=S,o[d+3]=u[3]}return new ImageData(o,n,r)}var lg={thin:100,hairline:100,"ultra-light":200,"extra-light":200,light:300,book:300,regular:400,normal:400,plain:400,roman:400,standard:400,medium:500,"semi-bold":600,"demi-bold":600,bold:700,"extra-bold":800,"ultra-bold":800,heavy:900,black:900,"heavy-black":900,fat:900,poster:900,"ultra-black":950,"extra-black":950},bs=" ",ug=/(italic|oblique)$/i,cg={};function Zu(i,e,t){var n=cg[i];if(!n){Array.isArray(i)||(i=[i]);for(var r=400,s="normal",o=[],a,l,u=0,c=i.length;u<c;++u){var h=i[u],d=h.split(" "),f=d[d.length-1].toLowerCase();f=="normal"||f=="italic"||f=="oblique"?(s=l?s:f,l=!0,d.pop(),f=d[d.length-1].toLowerCase()):ug.test(f)&&(f=f.replace(ug,""),s=l?s:d[d.length-1].replace(f,""),l=!0);for(var g in lg){var m=d.length>1?d[d.length-2].toLowerCase():"";if(f==g||f==g.replace("-","")||m+"-"+f==g){r=a?r:lg[g],d.pop(),m&&g.startsWith(m)&&d.pop();break}}!a&&typeof f=="number"&&(r=f,a=!0);var p=d.join(bs).replace("Klokantech Noto Sans","Noto Sans").replace("DIN Pro","Barlow").replace("Arial Unicode MS","Arial");p.indexOf(bs)!==-1&&(p='"'+p+'"'),o.push(p)}n=cg[i]=[s,r,o]}return n[0]+bs+n[1]+bs+e+"px"+(t?"/"+t:"")+bs+n[2]}const $e=Object.freeze({}),hg={},dg={};let Pw=0;function qu(i){return i.id||(i.id=Pw++),i.id}function Lw(i,e){return qu(i)+"."+te(e)}function Hu(i){let e=hg[i.id];return e||(e={},hg[qu(i)]=e),e}function Fw(i){let e=dg[i.id];return e||(e={},dg[qu(i)]=e),e}function Ju(i){return i*Math.PI/180}const Yt=(function(){const i=[];for(let e=78271.51696402048;i.length<=24;e/=2)i.push(e);return i})();function oa(i,e){if(typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof OffscreenCanvas<"u")return new OffscreenCanvas(i,e);const t=document.createElement("canvas");return t.width=i,t.height=e,t}function aa(i,e){let t=0;const n=e.length;for(;t<n;++t)if(e[t]<i&&t+1<n){const s=e[t]/e[t+1];return t+Math.log(e[t]/i)/Math.log(s)}return n-1}function Rs(i,e){const t=Math.floor(i),n=Math.pow(2,i-t);return e[t]/n}const _r={};function xr(i,e,t={},n){if(e in _r)return n&&(n.url=_r[e][0].url),_r[e][1];const r=t.transformRequest&&t.transformRequest(e,i)||e,s=function(l){return delete _r[e],Promise.reject(new Error("Error fetching source "+e))},o=function(l){return delete _r[e],l.ok?l.json():Promise.reject(new Error("Error fetching source "+e))},a=Pi(()=>r).then(l=>l instanceof Response?(n&&(n.url=l.url),o(l)):(l instanceof Request||(l=new Request(l)),l.headers.get("Accept")||l.headers.set("Accept","application/json"),n&&(n.url=l.url),fetch(l).then(o).catch(s))).catch(s);return _r[e]=[r,a],a}function fg(i,e){if(typeof i=="string")if(i.trim().startsWith("{"))try{const t=JSON.parse(i);return Promise.resolve(t)}catch(t){return Promise.reject(t)}else return i=ia(i,e.accessToken),xr("Style",i,e);else return Promise.resolve(i)}const gg={};function pg(i,e,t={}){const n=[e,JSON.stringify(i)].toString();let r=gg[n];if(!r||t.transformRequest){let s;t.transformRequest&&(s=(a,l)=>{const u=t.transformRequest&&t.transformRequest(l,"Tiles")||l;if(a instanceof Qf)a.setLoader((c,h,d)=>{const f=function(g){g.arrayBuffer().then(m=>{const y=a.getFormat().readFeatures(m,{extent:c,featureProjection:d});a.setFeatures(y)})};Pi(()=>u).then(g=>{if(g instanceof Response)return f(g);fetch(g).then(f).catch(m=>a.setState(G.ERROR))}).catch(g=>a.setState(G.ERROR))});else{const c=a.getImage();Pi(()=>u).then(h=>{if(typeof h=="string"){c.src=h;return}const d=f=>f.blob().then(g=>{const m=URL.createObjectURL(g);c.addEventListener("load",()=>URL.revokeObjectURL(m)),c.addEventListener("error",()=>URL.revokeObjectURL(m)),c.src=m});if(h instanceof Response)return d(h);fetch(h).then(d).catch(f=>a.setState(G.ERROR))}).catch(h=>a.setState(G.ERROR))}});const o=i.url;if(o&&!i.tiles){const a=ra(o,t.accessToken,t.accessTokenParam||"access_token",e||location.href);if(o.startsWith("mapbox://"))r=Promise.resolve({tileJson:Object.assign({},i,{url:void 0,tiles:a}),tileLoadFunction:s});else{const l={};r=xr("Source",a[0],t,l).then(function(u){return u.tiles=u.tiles.map(function(c){return u.scheme==="tms"&&(c=c.replace("{y}","{-y}")),ra(c,t.accessToken,t.accessTokenParam||"access_token",l.url)[0]}),Promise.resolve({tileJson:u,tileLoadFunction:s})})}}else i.tiles?(i=Object.assign({},i,{tiles:i.tiles.map(function(a){return i.scheme==="tms"&&(a=a.replace("{y}","{-y}")),ra(a,t.accessToken,t.accessTokenParam||"access_token",e||location.href)[0]})}),r=Promise.resolve({tileJson:Object.assign({},i),tileLoadFunction:s})):r=Promise.reject(new Error("source has no `tiles` nor `url`"));gg[n]=r}return r}function mg(i,e,t,n){const r=[2*t*e.pixelRatio+e.width,2*t*e.pixelRatio+e.height],s=oa(r[0],r[1]),o=s.getContext("2d");o.drawImage(i,e.x,e.y,e.width,e.height,t*e.pixelRatio,t*e.pixelRatio,e.width,e.height);const a=o.getImageData(0,0,r[0],r[1]);o.globalCompositeOperation="destination-over",o.fillStyle=`rgba(${n.r*255},${n.g*255},${n.b*255},${n.a})`;const l=a.data;for(let u=0,c=a.width;u<c;++u)for(let h=0,d=a.height;h<d;++h){const f=(h*c+u)*4;l[f+3]>0&&o.arc(u,h,t*e.pixelRatio,0,2*Math.PI)}return o.fill(),s}function Ow(i,e,t){const n=Math.max(0,Math.min(1,(t-i)/(e-i)));return n*n*(3-2*n)}function yg(i,e,t){const n=oa(e.width,e.height),r=n.getContext("2d");r.drawImage(i,e.x,e.y,e.width,e.height,0,0,e.width,e.height);const s=r.getImageData(0,0,e.width,e.height),o=s.data;for(let a=0,l=s.width;a<l;++a)for(let u=0,c=s.height;u<c;++u){const h=(u*l+a)*4,d=o[h+3]/255,f=.75,g=.1,m=Ow(f-g,f+g,d);m>0?(o[h+0]=Math.round(255*t.r*m),o[h+1]=Math.round(255*t.g*m),o[h+2]=Math.round(255*t.b*m),o[h+3]=Math.round(255*m)):o[h+3]=0}return r.putImageData(s,0,0),n}const kw=Array(256).join(" ");function Qu(i,e){if(e>=.05){let t="";const n=i.split(`
|
|
9
|
+
`),r=kw.slice(0,Math.round(e/.1));for(let s=0,o=n.length;s<o;++s)s>0&&(t+=`
|
|
10
|
+
`),t+=n[s].split("").join(r);return t}return i}let ec;function _g(){return ec||(ec=oa(1,1).getContext("2d")),ec}function Dw(i,e){if(/\d+ \d+/.test(i)){const[t,n]=i.split(" ").map(Number);return t<=e&&e<=n}return i==e}function Ti(i,e){return _g().measureText(i).width+(i.length-1)*e}const la={};gi.on("propertychange",()=>{for(const i in la)delete la[i]});function tc(i,e,t,n){if(i.indexOf(`
|
|
11
|
+
`)!==-1){const o=i.split(`
|
|
12
|
+
`),a=[];for(let l=0,u=o.length;l<u;++l)a.push(tc(o[l],e,t,n));return a.join(`
|
|
13
|
+
`)}const r=t+","+e+","+i+","+n;let s=la[r];if(!s){const o=i.split(" ");if(o.length>1){const a=_g();a.font=e;const u=a.measureText("M").width*t;let c="";const h=[];for(let d=0,f=o.length;d<f;++d){const g=o[d],m=c+(c?" ":"")+g;Ti(m,n)<=u?c=m:(c&&h.push(c),c=g)}c&&h.push(c);for(let d=0,f=h.length;d<f&&f>1;++d){const g=h[d];if(Ti(g,n)<u*.35){const m=d>0?Ti(h[d-1],n):1/0,p=d<f-1?Ti(h[d+1],n):1/0;h.splice(d,1),f-=1,m<p?(h[d-1]+=" "+g,d-=1):h[d]=g+" "+h[d]}}for(let d=0,f=h.length-1;d<f;++d){const g=h[d],m=h[d+1];if(Ti(g,n)>u*.7&&Ti(m,n)<u*.6){const p=g.split(" "),y=p.pop();Ti(y,n)<u*.2&&(h[d]=p.join(" "),h[d+1]=y+" "+m),f-=1}}s=h.join(`
|
|
14
|
+
`)}else s=i;s=Qu(s,n),la[r]=s}return s}const Nw=["Arial","Courier New","Times New Roman","Verdana","sans-serif","serif","monospace","cursive","fantasy"],xg={};function zw(i,e="https://cdn.jsdelivr.net/npm/@fontsource/{font-family}/{fontweight}{-fontstyle}.css"){if(at)return i;let t;for(let n=0,r=i.length;n<r;++n){const s=i[n];if(s in xg)continue;xg[s]=!0;const a=Zu(s,16).split(" ");t||(t=[]),t.push([a.slice(3).join(" ").replace(/"/g,""),a[1],a[0]])}return t&&(async()=>{await document.fonts.ready;for(let n=0,r=t.length;n<r;++n){const s=t[n],o=s[0];if(Nw.includes(o))continue;const a=s[1],l=s[2];if(!(await document.fonts.load(`${l} ${a} 16px "${o}"`)).some(c=>c.family.replace(/^['"]|['"]$/g,"").toLowerCase()===o.toLowerCase()&&Dw(c.weight,a)&&c.style===l)){const c=e.replace("{font-family}",o.replace(/ /g,"-").toLowerCase()).replace("{Font+Family}",o.replace(/ /g,"+")).replace("{fontweight}",a).replace("{-fontstyle}",l.replace("normal","").replace(/(.+)/,"-$1")).replace("{fontstyle}",l);if(!document.querySelector('link[href="'+c+'"]')){const h=document.createElement("link");h.href=c,h.rel="stylesheet",document.head.appendChild(h)}}}})(),i}const Gw={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},jw={center:[.5,.5],left:[0,.5],right:[1,.5],top:[.5,0],bottom:[.5,1],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},wg=function(i,e){let t=gf(i,e);if(t.result==="error"){const n=na(i);n!==i&&(t=gf(n,e))}if(t.result==="error"){const n=t.value[0];return console.error("Error parsing expression:",i,n.key,n.message),{evaluate:()=>e.default}}return t.value};let ua,nc;function j(i,e,t,n,r,s){const o=i.id;r||(r={},console.warn("No functionCache provided to getValue()")),r[o]||(r[o]={});const a=r[o];if(!a[t]){let l=(i[e]||$e)[t];const u=Ef[`${e}_${i.type}`]&&Ef[`${e}_${i.type}`][t];l===void 0&&u&&(l=u.default);let c=jo(l);if(!c&&Go(l)&&(l=xf(l,u),c=!0),c){const h=wg(l,u);a[t]=h.evaluate.bind(h)}else{const h=u?u.type:typeof l;(h==="color"||h==="colorArray")&&(l=Ge.parse(l));let d=!1;if(h==="array")for(let f=0;f<l.length;++f){const g=l[f];if(jo(g)||Go(g)){d=!0;break}}if(d){const f=Object.assign({},u,{type:u.value}),g=[];for(let m=0;m<l.length;++m){let p=l[m];if(!jo(p)&&Go(p)&&(p=xf(p,f)),jo(p)){const y=wg(p,f);g.push(y.evaluate.bind(y))}else g.push(function(){return p})}a[t]=function(m,p,y){const _=[];for(let E=0;E<g.length;++E)_[E]=g[E](m,p,y);return _}}else a[t]=function(){return l}}}return a[t](mt,n,s)}function Eg(i,e,t,n){return j(i,"layout",`${t}-allow-overlap`,e,n)?j(i,"layout",`${t}-ignore-placement`,e,n)?"none":"obstacle":"declutter"}function Xw(i,e,t,n){if(n||console.warn("No filterCache provided to evaluateFilter()"),!(i in n))try{n[i]=Nx(e).filter}catch(r){console.warn("Filter will evaluate to false: "+r.message),n[i]=function(){return!1}}return n[i](mt,t)}function Hn(i,e){if(i){if(i.a===0||e===0)return;const t=i.a;return e=e===void 0?1:e,t===0?"transparent":"rgba("+Math.round(i.r*255/t)+","+Math.round(i.g*255/t)+","+Math.round(i.b*255/t)+","+t*e+")"}return i}const Ww=/\{[^{}}]*\}/g;function ic(i,e){return i.replace(Ww,function(t){return e[t.slice(1,-1)]||""})}function vg(i,e){let t=i.split(":")[0];return t===i&&(t="default"),e[t]}const Vw={};function Uw(i,e,t,n=Yt,r=void 0,s=void 0,o=void 0,a=void 0){if(typeof e=="string"&&(e=JSON.parse(e)),e.schema)for(const E in e.schema){const x=e.schema[E];"default"in x&&(Vu[E]=x.default)}if(e.version!=8)throw new Error("glStyle version 8 required.");Vw[Lw(e,i)]=Array.from(arguments);const l={};(typeof s=="string"||s instanceof Request||s instanceof Response||s instanceof Promise)&&(s={default:s});for(const E in s){const x=s[E];Pi(()=>x).then(async w=>{let C;if(typeof Image<"u"){const b=new Image;if(typeof w=="string")b.crossOrigin="anonymous",b.src=w;else{let v;w instanceof Request?v=await fetch(w):w instanceof Response&&(v=w);const R=await v.blob();C=URL.createObjectURL(R),b.src=C}b.addEventListener("load",function v(){b.removeEventListener("load",v),l[E]={image:b,size:[b.width,b.height]},i.changed(),C&&URL.revokeObjectURL(C)}),b.addEventListener("error",function v(){URL.revokeObjectURL(C),b.removeEventListener("error",v)})}else if(typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope){const b=self;b.postMessage({action:"loadImage",src:w}),b.addEventListener("message",function(R){R.data.action==="imageLoaded"&&R.data.src===w&&(l[E]={image:R.data.image,size:[R.data.image.width,R.data.image.height]})})}})}const u=bd(e.layers),c={},h=[],d={},f={},g=Hu(e),m=Fw(e);let p;for(let E=0,x=u.length;E<x;++E){const w=u[E],C=w.id;if(typeof t=="string"&&w.source==t||Array.isArray(t)&&t.indexOf(C)!==-1){const b=w["source-layer"];if(p){if(w.source!==p)throw new Error(`Layer "${C}" does not use source "${p}`)}else{p=w.source;const R=e.sources[p];if(!R)throw new Error(`Source "${p}" is not defined`);const A=R.type;if(A!=="vector"&&A!=="geojson")throw new Error(`Source "${p}" is not of type "vector" or "geojson", but "${A}"`)}let v=c[b];v||(v=[],c[b]=v),v.push({layer:w,index:E}),h.push(C)}}const y=[],_=function(E,x,w){const C=i.getSource?.()?.format_?.layerName_??"mvt:layer",b=E.getProperties(),v=c[b[C]];if(!v)return;let R=n.indexOf(x);R==-1&&(R=aa(x,n)),mt.zoom=R,mt.distanceFromCenter=0;const A=E.getGeometry(),F=Gw[A.getType()],O=i.get("map");if(O&&O instanceof rs&&F===1){const k=O.getSize();if(k){const N=O.getView().getCenter(),D=Et(A.getExtent());mt.distanceFromCenter=bp(N,D)/x/k[1]}}const I={id:E.getId(),properties:b,type:F},S=i.get("mapbox-featurestate")[E.getId()];let U=-1;for(let k=0,N=v.length;k<N;++k){const D=v[k],T=D.layer,V=T.id;if(w!==void 0&&w!==V)continue;const Z=T.layout||$e,ce=T.paint||$e;if(j(T,"layout","visibility",I,g,S)==="none"||"minzoom"in T&&R<T.minzoom||"maxzoom"in T&&R>=T.maxzoom)continue;const L=T.filter;if(!L||Xw(V,L,I,m)){let le,H,Re,Te,W,P;const Xe=D.index;if(F==3&&(T.type=="fill"||T.type=="fill-extrusion")){if(H=j(T,"paint",T.type+"-opacity",I,g,S),T.type+"-pattern"in ce){const he=j(T,"paint",T.type+"-pattern",I,g,S);if(he){const ie=typeof he=="string"?ic(he,b):he.toString(),B=vg(ie,l);if(r&&r[ie]&&B){++U,P=y[U],(!P||!P.getFill()||P.getStroke()||P.getText())&&(P=new gt({fill:new kt}),y[U]=P),Re=P.getFill(),P.setZIndex(Xe);const de=ie+"."+H;let Ie=f[de];if(!Ie){const re=r[ie],ye=oa(re.width,re.height),We=ye.getContext("2d");We.globalAlpha=H,We.drawImage(B.image,re.x,re.y,re.width,re.height,0,0,re.width,re.height),Ie=We.createPattern(ye,"repeat"),f[de]=Ie}Re.setColor(Ie)}}}else if(le=Hn(j(T,"paint",T.type+"-color",I,g,S),H),T.type+"-outline-color"in ce&&(W=Hn(j(T,"paint",T.type+"-outline-color",I,g,S),H)),W||(W=le),le||W){if(++U,P=y[U],(!P||le&&!P.getFill()||!le&&P.getFill()||W&&!P.getStroke()||!W&&P.getStroke()||P.getText())&&(P=new gt({fill:le?new kt:void 0,stroke:W?new mn:void 0}),y[U]=P),le&&(Re=P.getFill(),Re.setColor(le)),T.type==="fill-extrusion"){const he=j(T,"paint","fill-extrusion-height",I,g,S);if(he>0){const ie=Math.max(.1,.9-Math.min(he,225)/280);if(W&&W!=="transparent"){const B=Ge.parse(W);W=`rgba(${Math.round(B.r*255*ie)},${Math.round(B.g*255*ie)},${Math.round(B.b*255*ie)},${B.a})`}}}W&&(Te=P.getStroke(),Te.setColor(W),Te.setWidth(.5)),P.setZIndex(Xe)}}if(F!=1&&T.type=="line"){"line-pattern"in ce?le=void 0:le=Hn(j(T,"paint","line-color",I,g,S),j(T,"paint","line-opacity",I,g,S));const he=j(T,"paint","line-width",I,g,S);le&&he>0&&(++U,P=y[U],(!P||!P.getStroke()||P.getFill()||P.getText())&&(P=new gt({stroke:new mn}),y[U]=P),Te=P.getStroke(),Te.setLineCap(j(T,"layout","line-cap",I,g,S)),Te.setLineJoin(j(T,"layout","line-join",I,g,S)),Te.setMiterLimit(j(T,"layout","line-miter-limit",I,g,S)),Te.setColor(le),Te.setWidth(he),Te.setLineDash(ce["line-dasharray"]?j(T,"paint","line-dasharray",I,g,S).map(function(ie){return ie*he}):null),typeof Te.setOffset=="function"&&Te.setOffset(j(T,"paint","line-offset",I,g,S)),P.setZIndex(Xe))}let Ze=!1,q=null,Ee=0,Ce,ne,me;if((F==1||F==2)&&"icon-image"in Z){const he=j(T,"layout","icon-image",I,g,S);if(he){Ce=typeof he=="string"?ic(he,b):he.toString();let ie;const B=a?a(i,Ce):void 0,de=vg(Ce,l);if(r&&r[Ce]&&de||B){const Ie=j(T,"layout","icon-rotation-alignment",I,g,S);if(F==2){const re=E.getGeometry();if(re.getFlatMidpoint||re.getFlatMidpoints){const ye=re.getExtent();if(Math.sqrt(Math.max(Math.pow((ye[2]-ye[0])/x,2),Math.pow((ye[3]-ye[1])/x,2)))>150){const Ye=re.getType()==="MultiLineString"?re.getFlatMidpoints():re.getFlatMidpoint();if(nc||(ua=[NaN,NaN],nc=new ht("Point",ua,[],2,{},void 0)),ie=nc,ua[0]=Ye[0],ua[1]=Ye[1],j(T,"layout","symbol-placement",I,g,S)==="line"&&Ie==="map"){const Mt=re.getStride(),st=re.getFlatCoordinates();for(let dt=0,Fe=st.length-Mt;dt<Fe;dt+=Mt){const ot=st[dt],yt=st[dt+1],_t=st[dt+Mt],ze=st[dt+Mt+1],Rt=Math.min(ot,_t),Si=Math.max(ot,_t),Cn=Ye[0],ca=Ye[1],ha=(ze-yt)*(Cn-ot)-(_t-ot)*(ca-yt);if(Math.abs(ha)<.001&&Cn<=Si&&Cn>=Rt){Ee=Math.atan2(yt-ze,_t-ot);break}}}}}}if(F!==2||ie){const re=j(T,"layout","icon-size",I,g,S),ye=ce["icon-color"]!==void 0?j(T,"paint","icon-color",I,g,S):null;if(!ye||ye.a!==0){const We=j(T,"paint","icon-halo-color",I,g,S),Ye=j(T,"paint","icon-halo-width",I,g,S);let Je=`${Ce}.${re}.${Ye}.${We}`;if(ye!==null&&(Je+=`.${ye}`),ne=d[Je],!ne){const Mt=Eg(T,I,"icon",g);let st;"icon-offset"in Z&&(st=j(T,"layout","icon-offset",I,g,S).slice(0),st[0]*=re,st[1]*=-re);let dt=ye?[ye.r*255,ye.g*255,ye.b*255,ye.a]:void 0;if(B){const Fe={color:dt,rotateWithView:Ie==="map",displacement:st,declutterMode:Mt,scale:re};typeof B=="string"?Fe.src=B:(Fe.img=B,Fe.imgSize=[B.width,B.height]),ne=new pi(Fe)}else{const Fe=r[Ce];let ot,yt,_t;if(Ye)Fe.sdf?(ot=mg(yg(de.image,Fe,ye||[0,0,0,1]),{x:0,y:0,width:Fe.width,height:Fe.height,pixelRatio:Fe.pixelRatio},Ye,We),dt=void 0):ot=mg(de.image,Fe,Ye,We);else{if(Fe.sdf&&!de.unSDFed){const ze=yg(de.image,{x:0,y:0,width:de.size[0],height:de.size[1]},{r:1,g:1,b:1});de.image=ze,de.unSDFed=!0}ot=de.image,yt=[Fe.width,Fe.height],_t=[Fe.x,Fe.y]}ne=new pi({color:dt,img:ot,imgSize:de.size,size:yt,offset:_t,rotateWithView:Ie==="map",scale:re/Fe.pixelRatio,displacement:st,declutterMode:Mt})}d[Je]=ne}}ne&&(++U,P=y[U],(!P||!P.getImage()||P.getFill()||P.getStroke())&&(P=new gt,y[U]=P),P.setGeometry(ie),ne.setRotation(Ee+Ju(j(T,"layout","icon-rotate",I,g,S))),ne.setOpacity(j(T,"paint","icon-opacity",I,g,S)),ne.setAnchor(jw[j(T,"layout","icon-anchor",I,g,S)]),P.setImage(ne),q=P.getText(),P.setText(void 0),P.setZIndex(Xe),Ze=!0,me=!1)}else me=!0}}}if(F==1&&T.type==="circle"){++U,P=y[U],(!P||!P.getImage()||P.getFill()||P.getStroke())&&(P=new gt,y[U]=P);const he="circle-radius"in ce?j(T,"paint","circle-radius",I,g,S):5,ie=Hn(j(T,"paint","circle-stroke-color",I,g,S),j(T,"paint","circle-stroke-opacity",I,g,S)),B=j(T,"paint","circle-translate",I,g,S),de=Hn(j(T,"paint","circle-color",I,g,S),j(T,"paint","circle-opacity",I,g,S)),Ie=j(T,"paint","circle-stroke-width",I,g,S),re=he+"."+ie+"."+de+"."+Ie+"."+B[0]+"."+B[1];ne=d[re],ne||(ne=new Zi({radius:he,displacement:[B[0],-B[1]],stroke:ie&&Ie>0?new mn({width:Ie,color:ie}):void 0,fill:de?new kt({color:de}):void 0,declutterMode:"none"}),d[re]=ne),P.setImage(ne),q=P.getText(),P.setText(void 0),P.setGeometry(void 0),P.setZIndex(Xe),Ze=!0}let oe,_e,Se,Pe,Le,Bt;if("text-field"in Z){Pe=Math.round(j(T,"layout","text-size",I,g,S));const he=j(T,"layout","text-font",I,g,S);Se=j(T,"layout","text-line-height",I,g,S),_e=Zu(o?o(he,e.metadata?e.metadata["ol:webfonts"]:void 0):he,Pe,Se),_e.includes("sans-serif")||(_e+=",sans-serif"),Le=j(T,"layout","text-letter-spacing",I,g,S),Bt=j(T,"layout","text-max-width",I,g,S);const ie=j(T,"layout","text-field",I,g,S);typeof ie=="object"&&ie.sections?ie.sections.length===1?oe=ie.toString():oe=ie.sections.reduce((B,de,Ie)=>{const re=de.fontStack?de.fontStack.split(","):he,ye=Zu(o?o(re):re,Pe*(de.scale||1),Se);let We=de.text;if(We===`
|
|
15
|
+
`)return B.push(`
|
|
16
|
+
`,""),B;if(F==2)return B.push(Qu(We,Le),ye),B;We=tc(We,ye,Bt,Le).split(`
|
|
17
|
+
`);for(let Ye=0,Je=We.length;Ye<Je;++Ye)Ye>0&&B.push(`
|
|
18
|
+
`,""),B.push(We[Ye],ye);return B},[]):oe=ic(ie,b).trim(),H=j(T,"paint","text-opacity",I,g,S)}if(oe&&H&&!me){Ze||(++U,P=y[U],(!P||!P.getText()||P.getFill()||P.getStroke())&&(P=new gt,y[U]=P),P.setImage(void 0),P.setGeometry(void 0));const he=Eg(T,I,"text",g);P.getText()||P.setText(q),q=P.getText(),(!q||"getDeclutterMode"in q&&q.getDeclutterMode()!==he)&&(q=new es({padding:[2,2,2,2],declutterMode:he}),P.setText(q));const ie=j(T,"layout","text-transform",I,g,S);ie=="uppercase"?oe=Array.isArray(oe)?oe.map((ze,Rt)=>Rt%2?ze:ze.toUpperCase()):oe.toUpperCase():ie=="lowercase"&&(oe=Array.isArray(oe)?oe.map((ze,Rt)=>Rt%2?ze:ze.toLowerCase()):oe.toLowerCase());const B=Array.isArray(oe)?oe:F==2?Qu(oe,Le):tc(oe,_e,Bt,Le);if(q.setText(B),q.setFont(_e),q.setRotation(Ju(j(T,"layout","text-rotate",I,g,S))),typeof q.setKeepUpright=="function"){const ze=j(T,"layout","text-keep-upright",I,g,S);q.setKeepUpright(ze)}const de=j(T,"layout","text-anchor",I,g,S),Ie=Ze||F==1?"point":j(T,"layout","symbol-placement",I,g,S);let re;if(Ie==="line-center"?(q.setPlacement("line"),re="center"):q.setPlacement(Ie),Ie==="line"&&typeof q.setRepeat=="function"){const ze=j(T,"layout","symbol-spacing",I,g,S);q.setRepeat(ze*2)}q.setOverflow(Ie==="point");let ye=j(T,"paint","text-halo-width",I,g,S);const We=j(T,"layout","text-offset",I,g,S),Ye=j(T,"paint","text-translate",I,g,S);let Je=0,Mt=0;if(Ie=="point"){re="center",de.indexOf("left")!==-1?(re="left",Mt=ye):de.indexOf("right")!==-1&&(re="right",Mt=-ye);const ze=j(T,"layout","text-rotation-alignment",I,g,S);q.setRotateWithView(ze=="map")}else q.setMaxAngle(Ju(j(T,"layout","text-max-angle",I,g,S))*oe.length/B.length),q.setRotateWithView(!1);q.setTextAlign(re);let st="middle";de.indexOf("bottom")==0?(st="bottom",Je=-ye-.5*(Se-1)*Pe):de.indexOf("top")==0&&(st="top",Je=ye+.5*(Se-1)*Pe),q.setTextBaseline(st);const dt=j(T,"layout","text-justify",I,g,S);q.setJustify(dt==="auto"?void 0:dt),q.setOffsetX(We[0]*Pe+Mt+Ye[0]),q.setOffsetY(We[1]*Pe+Je+Ye[1]);const Fe=q.getFill()||new kt;Fe.setColor(Hn(j(T,"paint","text-color",I,g,S),H)),q.setFill(Fe);const ot=Hn(j(T,"paint","text-halo-color",I,g,S),H);if(ot&&ye>0){const ze=q.getStroke()||new mn;ze.setColor(ot),ye*=2;const Rt=.5*Pe;ze.setWidth(ye<=Rt?ye:Rt),q.setStroke(ze)}else q.setStroke(void 0);const yt=j(T,"layout","text-padding",I,g,S),_t=q.getPadding();yt!==_t[0]&&(_t[0]=yt,_t[1]=yt,_t[2]=yt,_t[3]=yt),P.setZIndex(Xe)}}}if(U>-1)return y.length=U+1,y};return i.setStyle(_),i.set("mapbox-layers",h),i.set("mapbox-source",p),i.set("mapbox-featurestate",i.get("mapbox-featurestate")||{}),_}const Yw=Ge.parse("#000000"),Bw=Ge.parse("#FFFFFF"),Kw=Ge.parse("#000000");function $w(i){return new Yu({source:new $u({operationType:"image",operation:Aw,sources:[i]})})}function Zw(i){return new Yu({source:new $u({operationType:"image",operation:Mw,sources:[i]})})}function qw(i,e,t,n){i.getSource().on("beforeoperations",function(r){mt.zoom=aa(r.resolution,t.resolutions||Yt),mt.distanceFromCenter=0;const s=r.data;s.saturation=j(e,"paint","raster-saturation",$e,n),s.contrast=j(e,"paint","raster-contrast",$e,n),s.brightnessHigh=j(e,"paint","raster-brightness-max",$e,n),s.brightnessLow=j(e,"paint","raster-brightness-min",$e,n),s.hueRotate=j(e,"paint","raster-hue-rotate",$e,n)})}function Hw(i,e,t,n,r){i.getSource().on("beforeoperations",function(s){const o=s.data;o.resolution=Ga(n.projection||"EPSG:3857",s.resolution,Et(s.extent),"m");const a=aa(s.resolution,n.resolutions||Yt);mt.zoom=a,mt.distanceFromCenter=0,o.zoom=a,o.encoding=e.encoding,o.method=j(t,"paint","hillshade-method",$e,r)||"standard",o.exaggeration=j(t,"paint","hillshade-exaggeration",$e,r);let l=j(t,"paint","hillshade-illumination-direction",$e,r);l==null&&(l=335),o.azimuths=Array.isArray(l)?l:[l],o.sunAz=o.azimuths[0];let u=j(t,"paint","hillshade-illumination-altitude",$e,r);u==null&&(u=45),o.altitudes=Array.isArray(u)?u:[u];function c(d){return d&&d.values?d.values[0]:d}function h(d){const f=t.paint?.[d];if(Array.isArray(f)&&f.length>0&&typeof f[0]=="string"&&Ge.parse(f[0])!==void 0)return f.map(m=>Ge.parse(m));let g=j(t,"paint",d,$e,r);return g=c(g),g?[g]:void 0}o.highlightColors=h("hillshade-highlight-color"),o.highlightColor=o.highlightColors?.[0]||Bw,o.highlightColors||(o.highlightColors=[o.highlightColor]),o.shadowColors=h("hillshade-shadow-color"),o.shadowColor=o.shadowColors?.[0]||Yw,o.shadowColors||(o.shadowColors=[o.shadowColor]),o.accentColor=c(j(t,"paint","hillshade-accent-color",$e,r))||Kw})}const Jw=["raster-saturation","raster-contrast","raster-brightness-max","raster-brightness-min","raster-hue-rotate"];function Qw(i,e,t){let n=null;return function(r){i.paint&&"raster-opacity"in i.paint&&r.frameState.viewState.zoom!==n&&(n=r.frameState.viewState.zoom,delete t[i.id],eE(i,e,n,t))}}function eE(i,e,t,n){mt.zoom=t,mt.distanceFromCenter=0;const r=j(i,"paint","raster-opacity",$e,n);e.setOpacity(r)}const tE=["background","circle","fill","fill-extrusion","line","symbol","raster","hillshade"];function nE(i,e=512){return i.getExtent()?wo({extent:i.getExtent(),tileSize:e,maxZoom:22}).getResolutions():Yt}function Cg(i,e){return e.accessToken||(e=Object.assign({},e),new URL(i).searchParams.forEach((n,r)=>{e.accessToken=n,e.accessTokenParam=r})),e}function iE(i,e,t="",n={},r=void 0){let s,o,a,l,u=!0;return typeof t!="string"&&!Array.isArray(t)?(a=t,l=a.source||a.layers,n=a):l=t,typeof n=="string"?(s=n,a={}):(s=n.styleUrl,a=n),a.updateSource===!1&&(u=!1),r||(r=a.resolutions),!s&&typeof e=="string"&&!e.trim().startsWith("{")&&(s=e),s&&(s=s.startsWith("data:")?location.href:ia(s,a.accessToken),a=Cg(s,a)),new Promise(function(c,h){fg(e,a).then(function(d){if(d.version!=8)return h(new Error("glStyle version 8 required."));if(!(i instanceof ta||i instanceof Cs))return h(new Error("Can only apply to VectorLayer or VectorTileLayer"));const f=i instanceof Cs?"vector":"geojson";if(l?Array.isArray(l)?o=d.layers.find(function(x){return x.id===l[0]}).source:o=l:(o=d.layers.find(function(x){return x.source&&d.sources[x.source].type===f}).source,l=o),!o)return h(new Error(`No ${f} source found in the glStyle.`));function g(){if(!u)return Promise.resolve();if(i instanceof Cs)return Tg(d.sources[o],s,a).then(function(b){const v=i.getSource();v?b!==v&&(v.setTileUrlFunction(b.getTileUrlFunction()),typeof v.setUrls=="function"&&typeof b.getUrls=="function"&&v.setUrls(b.getUrls()),v.format_||(v.format_=b.format_),v.getAttributions()||v.setAttributions(b.getAttributions()),v.getTileLoadFunction()===eg&&v.setTileLoadFunction(b.getTileLoadFunction()),ut(v.getProjection(),b.getProjection())&&(v.tileGrid=b.getTileGrid())):i.setSource(b);const R=i.getSource().getTileGrid();!isFinite(i.getMaxResolution())&&!isFinite(i.getMinZoom())&&R.getMinZoom()>0&&i.setMaxResolution(Rs(Math.max(0,R.getMinZoom()-1e-12),R.getResolutions()))});const x=d.sources[o];let w=i.getSource();(!w||w.get("mapbox-source")!==x)&&(w=Ig(x,s,a));const C=i.getSource();return C?w!==C&&(C.getAttributions()||C.setAttributions(w.getAttributions()),C.format_||(C.format_=w.getFormat()),C.url_=w.getUrl()):i.setSource(w),Promise.resolve()}let m,p;const y={},_={};function E(){if(!p&&(!d.sprite||y)){if(a.projection&&!r){const b=we(a.projection).getUnits();b!=="m"&&(r=Yt.map(v=>v/On[b]))}let x;const w=i.getSource();w instanceof Wu&&w.format_ instanceof Af&&(x=w.format_.layerName_),p=Uw(i,d,l,r,y,_,(C,b=a.webfonts)=>zw(C,b),a.getImage,x),i.getStyle()?g().then(c).catch(h):h(new Error(`Nothing to show for source [${o}]`))}else p?(i.setStyle(p),g().then(c).catch(h)):h(new Error("Something went wrong trying to apply style."))}if(d.sprite){const x=gw(d.sprite,a.accessToken,s||location.href);m=at?1:window.devicePixelRatio>=1.5?.5:1;const w=m==.5?"@2x":"";Promise.all(x.map(function(C){const b=new URL(C.url);let v=b.origin+b.pathname+w+".json"+b.search;return new Promise(function(R,A){xr("Sprite",v,a).then(R).catch(function(F){v=b.origin+b.pathname+".json"+b.search,xr("Sprite",v,a).then(R).catch(A)})}).then(function(R){R===void 0&&h(new Error("No sprites found."));let A;if(A=b.origin+b.pathname+w+".png"+b.search,a.transformRequest){const F=a.transformRequest(A,"SpriteImage")||A;(F instanceof Request||F instanceof Promise)&&(A=F)}_[C.id]=A;for(const F in R){const O=C.id=="default"?F:`${C.id}:${F}`;y[O]=R[F]}}).catch(function(R){h(new Error(`Sprites cannot be loaded: ${v}: ${R.message}`))})})).then(E).catch(h)}else E()}).catch(h)})}const rE=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function bg(i,e){if(!e.ref)return e;const t=i.find(r=>r.id===e.ref);if(!t)return e;const n=Object.assign({},e);for(const r of rE)!(r in n)&&r in t&&(n[r]=t[r]);return n}function sE(i,e){const t=i.bounds;if(t){const n=Xa([t[0],t[1]],e),r=Xa([t[2],t[3]],e);return[n[0],n[1],r[0],r[1]]}return we(e).getExtent()}function Rg(i,e,t){const n=new $f({tileJSON:e,tileSize:i.tileSize||e.tileSize||512}),r=n.getTileJSON(),s=n.getTileGrid(),o=we(t.projection||"EPSG:3857"),a=sE(r,o),l=o.getExtent(),u=r.minzoom||0,c=r.maxzoom||22,h={attributions:n.getAttributions(),projection:o,tileGrid:new xo({origin:l?un(l):s.getOrigin(0),extent:a||s.getExtent(),minZoom:u,resolutions:nE(o,e.tileSize).slice(0,c+1),tileSize:s.getTileSize(0)})};return Array.isArray(r.tiles)?h.urls=r.tiles:h.url=r.tiles,h}function oE(i,e,t,n){const r={id:i.id,type:i.type},s=i.paint||{};r.paint=s,mt.zoom=aa(e,t.resolutions||Yt),mt.distanceFromCenter=0;let o;const a=j(r,"paint","background-color",$e,n);return s["background-opacity"]!==void 0&&(o=j(r,"paint","background-opacity",$e,n)),j(r,"layout","visibility",$e,n)==="none"?void 0:Hn(a,o)}function aE(i,e,t){const n=at?{style:{}}:document.createElement("div");return n.className="ol-mapbox-style-background",n.style.position="absolute",n.style.width="100%",n.style.height="100%",new Vi({source:new tr({}),render(r){const s=oE(i,r.viewState.resolution,e,t);return n.style.backgroundColor=s,n}})}function Tg(i,e,t){return new Promise(function(n,r){pg(i,e,t).then(function({tileJson:s,tileLoadFunction:o}){const a=Rg(i,s,t);a.tileLoadFunction=o,a.format=new Af({layerName:"mvt:layer"});const l=new Wu(a);l.set("mapbox-source",i),n(l)}).catch(r)})}function lE(i,e,t){const n=new Cs({declutter:!0,visible:!1});return Tg(i,e,t).then(function(r){n.setSource(r)}).catch(function(r){n.setSource(void 0)}),n}function Sg(i){return`{bbox-${(i?i.getCode():"EPSG:3857").toLowerCase().replace(/[^a-z0-9]/g,"-")}}`}function uE(i,e,t){return new Promise(function(n,r){pg(i,e,t).then(function({tileJson:s,tileLoadFunction:o}){const a=new $f({interpolate:t.interpolate===void 0?!0:t.interpolate,transition:0,crossOrigin:"anonymous",tileJSON:s});a.tileGrid=Rg(i,s,t).tileGrid,t.projection&&(a.projection=we(t.projection));const l=a.getTileUrlFunction();o&&a.setTileLoadFunction(o),a.setTileUrlFunction(function(u,c,h){const d=Sg(h);let f=l(u,c,h);if(f.indexOf(d)!=-1){const g=a.getTileGrid().getTileCoordExtent(u);f=f.replace(d,g.toString())}return f}),a.set("mapbox-source",i),n(a)}).catch(function(s){r(s)})})}function rc(i,e,t){const n=new ql;return uE(i,e,t).then(function(r){n.setSource(r)}).catch(function(){n.setSource(void 0)}),n}function Ig(i,e,t){const n=t.projection?new Tf({dataProjection:t.projection}):new Tf,r=i.data,s={};if(typeof r=="string"){const[a]=ra(r,t.accessToken,t.accessTokenParam||"access_token",e||location.href);if(/\{bbox-[0-9a-z-]+\}/.test(a)){const u=(h,d,f)=>{const g=Sg(f);return a.replace(g,`${h.join(",")}`)},c=new yr({attributions:i.attribution,format:n,loader:(h,d,f,g,m)=>{const p=typeof u=="function"?u(h,d,f):u;xr("GeoJSON",p,t).then(y=>{const _=c.getFormat().readFeatures(y,{featureProjection:f});c.addFeatures(_),g(_)}).catch(y=>{c.removeLoadedExtent(h),m()})},strategy:uw});return c.set("mapbox-source",i),c}const l=new yr({attributions:i.attribution,format:n,url:a,loader:(u,c,h,d,f)=>{xr("GeoJSON",a,t).then(g=>{const m=l.getFormat().readFeatures(g,{featureProjection:h});l.addFeatures(m),d(m)}).catch(g=>{l.removeLoadedExtent(u),f()})}});return l}s.features=n.readFeatures(r,{featureProjection:Pr()||"EPSG:3857"});const o=new yr(Object.assign({attributions:i.attribution,format:n},s));return o.set("mapbox-source",i),o}function cE(i,e,t){return new ta({declutter:!0,source:Ig(i,e,t),visible:!1})}function hE(i,e,t){function n(){const r=e.get("mapbox-style");if(!r)return;const s=bd(r.layers),o=i.get("mapbox-layers"),a=s.filter(function(l){return o.includes(l.id)}).some(function(l){return!l.layout||j(l,"layout","visibility",$e,t)==="visible"});i.get("visible")!==a&&i.setVisible(a)}i.on("change",n),n()}function dE(i,e,t,n){t=bg(i.layers,t);const r=Hu(i),s=t.type;let o=t.source;const a=i.sources[o];let l;if(s=="background")l=aE(t,n,r),o=void 0;else if(a.type=="vector")l=lE(a,e,n);else if(a.type=="raster"){if(!!Object.keys(t.paint||{}).find(c=>Jw.includes(c))){const c=rc(a,e,n);l=$w(c),qw(l,t,n,r)}else l=rc(a,e,n);l.setVisible(t.layout?j(t,"layout","visibility",$e,r)!=="none":!0),l.on("prerender",Qw(t,l,r))}else if(a.type=="geojson")l=cE(a,e,n);else if(a.type=="raster-dem"&&t.type=="hillshade"){const u=rc(a,e,n);l=Zw(u),Hw(l,a,t,n,r),l.setVisible(t.layout?j(t,"layout","visibility",$e,r)!=="none":!0)}return l&&l.set("mapbox-source",o),l}function Mg(i,e,t,n){i.schema&&Object.assign(Vu,Object.keys(i.schema).reduce((h,d)=>(h[d]=i.schema[d]?.default,h),{}));const r=[];let s=null;if(e instanceof rs){if(s=e.getView(),!s.isDef()&&!s.getRotation()&&!s.getResolutions()){const h=n.projection?we(n.projection):s.getProjection();s=new Wt(Object.assign(s.getProperties(),{maxResolution:Yt[0]/On[h.getUnits()],projection:n.projection||s.getProjection()})),e.setView(s)}"center"in i&&!s.getCenter()&&s.setCenter(Xa(i.center,s.getProjection())),"zoom"in i&&s.getZoom()===void 0&&s.setResolution(Yt[0]/On[s.getProjection().getUnits()]/Math.pow(2,i.zoom)),(!s.getCenter()||s.getZoom()===void 0)&&s.fit(s.getProjection().getExtent(),{nearest:!0,size:e.getSize()})}e.set("mapbox-style",i),e.set("mapbox-metadata",{styleUrl:t,options:n});const o=i.layers;let a=[],l,u,c;for(let h=0,d=o.length;h<d;++h){const f=bg(o,o[h]),g=f.type;if(tE.includes(g))c=f.source,(!c||c!=u)&&(a.length&&(r.push(Ag(l,a,i,t,e,n)),a=[]),l=dE(i,t,f,n),l instanceof ta||l instanceof Cs||(a=[]),u=l.get("mapbox-source")),a.push(f.id);else{console.warn(`layers[${h}].type "${g}" not supported`);continue}}return r.push(Ag(l,a,i,t,e,n)),Promise.all(r)}function fE(i,e,t={}){let n,r;if(at){if(!(i instanceof rs)&&!(i instanceof jn))throw new Error("ol-mapbox-style in a web worker requires a Map or a LayerGroup as first argument");r=i}else typeof i=="string"||i instanceof HTMLElement?r=new rs({target:i}):r=i;if(typeof e=="string"){const s=e.startsWith("data:")?location.href:ia(e,t.accessToken);t=Cg(s,t),n=new Promise(function(o,a){fg(e,t).then(function(l){Mg(l,r,s,t).then(function(){o(r)}).catch(a)}).catch(function(l){a(new Error(`Could not load ${e}: ${l.message}`))})})}else n=new Promise(function(s,o){Mg(e,r,!t.styleUrl||t.styleUrl.startsWith("data:")?location.href:ia(t.styleUrl,t.accessToken),t).then(function(){s(r)}).catch(o)});return n}function Ag(i,e,t,n,r,s={}){let o=24,a=0;const l=t.layers;for(let u=0,c=l.length;u<c;++u){const h=l[u];e.indexOf(h.id)!==-1&&(o=Math.min("minzoom"in h?h.minzoom:0,o),a=Math.max("maxzoom"in h?h.maxzoom:24,a))}return new Promise(function(u,c){const h=function(){const f=i.getSource();if(!f||f.getState()==="error"){c(new Error("Error accessing data for source "+i.get("mapbox-source")));return}if("getTileGrid"in f){const g=f.getTileGrid();if(g){const m=g.getMinZoom();(o>0||m>0)&&i.setMaxResolution(Math.min(Rs(Math.max(0,o-1e-12),Yt),Rs(Math.max(0,m-1e-12),g.getResolutions()))),a<24&&i.setMinResolution(Rs(a,Yt))}}else o>0&&i.setMaxResolution(Rs(Math.max(0,o-1e-12),Yt));f instanceof yr||f instanceof Wu?iE(i,t,e,Object.assign({styleUrl:n},s)).then(function(){hE(i,r,Hu(t)),u()}).catch(c):u()};i.set("mapbox-layers",e);const d=r.getLayers();d.getArray().indexOf(i)===-1&&d.push(i),i.getSource()?h():i.once("change:source",h)})}const gE="EPSG:3857",pE=[9.254419,50.102223],mE=({centre:i,map:e,style:t,target:n}={})=>{const r=K.toRef(e);rm();const s=()=>{const l=K.unref(t);if(l){const u=new jn;return fE(u,l),u}else return new ql({source:new l_})},o=()=>new Wt({center:K.unref(i)||pE,minZoom:1,projection:gE,zoom:4}),a=()=>{r.value||(r.value=new rs),r.value.setTarget(n),r.value.setView(o()),r.value.setLayers([s()])};return K.watch(K.toRef(t),()=>{r.value?.setLayers([s()])}),K.onMounted(()=>{a()}),{map:r}};class yE extends yr{constructor(e){e=e||{},super({attributions:e.attributions,wrapX:e.wrapX}),this.resolution=void 0,this.distance=e.distance!==void 0?e.distance:20,this.minDistance=e.minDistance||0,this.interpolationRatio=0,this.features=[],this.geometryFunction=e.geometryFunction||function(t){const n=t.getGeometry();return xe(!n||n.getType()==="Point","The default `geometryFunction` can only handle `Point` or null geometries"),n},this.createCustomCluster_=e.createCluster,this.source=null,this.boundRefresh_=this.refresh.bind(this),this.updateDistance(this.distance,this.minDistance),this.setSource(e.source||null)}clear(e){this.features.length=0,super.clear(e)}getDistance(){return this.distance}getSource(){return this.source}loadFeatures(e,t,n){this.source?.loadFeatures(e,t,n),t!==this.resolution&&(this.resolution=t,this.refresh())}setDistance(e){this.updateDistance(e,this.minDistance)}setMinDistance(e){this.updateDistance(this.distance,e)}getMinDistance(){return this.minDistance}setSource(e){this.source&&this.source.removeEventListener($.CHANGE,this.boundRefresh_),this.source=e,e&&e.addEventListener($.CHANGE,this.boundRefresh_),this.refresh()}refresh(){this.clear(),this.cluster(),this.addFeatures(this.features)}updateDistance(e,t){const n=e===0?0:Math.min(t,e)/e,r=e!==this.distance||this.interpolationRatio!==n;this.distance=e,this.minDistance=t,this.interpolationRatio=n,r&&this.refresh()}cluster(){if(this.resolution===void 0||!this.source)return;const e=St(),t=this.distance*this.resolution,n=this.source.getFeatures(),r={};for(let s=0,o=n.length;s<o;s++){const a=n[s];if(!(te(a)in r)){const l=this.geometryFunction(a);if(l){const u=l.getCoordinates();Sa(u,e),sn(e,t,e);const c=this.source.getFeaturesInExtent(e).filter(function(h){const d=te(h);return d in r?!1:(r[d]=!0,!0)});this.features.push(this.createCluster(c,e))}}}}createCluster(e,t){const n=[0,0];for(let a=e.length-1;a>=0;--a){const l=this.geometryFunction(e[a]);l?Pc(n,l.getCoordinates()):e.splice(a,1)}Lc(n,1/e.length);const r=Et(t),s=this.interpolationRatio,o=new dn([n[0]*(1-s)+r[0]*s,n[1]*(1-s)+r[1]*s]);return this.createCustomCluster_?this.createCustomCluster_(o,e):new gr({geometry:o,features:e})}}const _E=({data:i,map:e,pointIconSrc:t}={})=>{const n=K.toRef(e),r=K.computed(()=>i.value.features.map(u=>new gr({geometry:new dn(u.geometry.coordinates),name:u.id}))),s={},o=u=>{const h=u.get("features").length;return s[h]||(t&&h===1?s[h]=new gt({image:new pi({src:t,width:32,height:32})}):s[h]=new gt({image:new Zi({radius:14,stroke:new mn({color:"#000"}),fill:new kt({color:"#000"})}),text:new es({text:h.toString(),fill:new kt({color:"#fff"}),font:'700 0.875rem "Open Sans", "Arial", sans-serif'})})),s[h]},a=()=>new ta({source:new yE({distance:Number.parseInt(40,10),minDistance:Number.parseInt(20,10),source:new yr({features:r.value})}),style:o}),l=()=>{i.value?.features?.length===1&&n.value.getView().setCenter(i.value.features[0].geometry.coordinates)};K.watchEffect(()=>{n.value&&i.value&&(n.value.addLayer(a()),l())})},xE="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_2058_7122)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12%2012C10.9%2012%2010%2011.1%2010%2010C10%208.9%2010.9%208%2012%208C13.1%208%2014%208.9%2014%2010C14%2011.1%2013.1%2012%2012%2012ZM12%202C16.2%202%2020%205.22%2020%2010.2C20%2013.52%2017.33%2017.45%2012%2022C6.67%2017.45%204%2013.52%204%2010.2C4%205.22%207.8%202%2012%202Z'%20fill='black'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_2058_7122'%3e%3crect%20width='24'%20height='24'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",sc="europeana-map-map";return{__name:"EuropeanaMap",props:{json:{type:String,default:null},style:{type:String,default:null},url:{type:String,default:null}},setup(i){const e=K.inject("map",null),t=K.inject("config",null),n=i,r=K.ref(null),s=K.computed(()=>n.url||t?.value?.url),o=K.computed(()=>n.json||t?.value?.json),a=K.computed(()=>n.style||t?.value?.style);if(o.value)r.value=JSON.parse(o.value);else if(s.value)np(s.value).json().then(l=>{r.value=l.data.value});else throw new Error("No data JSON or URL supplied.");return mE({map:e,style:a,target:sc}),_E({data:r,map:e,pointIconSrc:xE}),(l,u)=>(K.openBlock(),K.createElementBlock("div",{id:sc,class:K.normalizeClass(sc)}))}}})(Vue);
|
|
19
|
+
//# sourceMappingURL=europeana-map.component.iife.js.map
|