@eox/layercontrol 0.17.6-dev.2.0 → 0.18.1-dev.1721833788.0

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.
@@ -1,48 +1,48 @@
1
- (function(ot,et){typeof exports=="object"&&typeof module<"u"?et(exports):typeof define=="function"&&define.amd?define(["exports"],et):(ot=typeof globalThis<"u"?globalThis:ot||self,et(ot["eox-layercontrol"]={}))})(this,function(ot){"use strict";var Y0=Object.defineProperty;var Mu=ot=>{throw TypeError(ot)};var j0=(ot,et,yt)=>et in ot?Y0(ot,et,{enumerable:!0,configurable:!0,writable:!0,value:yt}):ot[et]=yt;var bt=(ot,et,yt)=>j0(ot,typeof et!="symbol"?et+"":et,yt),Wa=(ot,et,yt)=>et.has(ot)||Mu("Cannot "+yt);var gt=(ot,et,yt)=>(Wa(ot,et,"read from private field"),yt?yt.call(ot):et.get(ot)),ut=(ot,et,yt)=>et.has(ot)?Mu("Cannot add the same private member more than once"):et instanceof WeakSet?et.add(ot):et.set(ot,yt),fr=(ot,et,yt,un)=>(Wa(ot,et,"write to private field"),un?un.call(ot,yt):et.set(ot,yt),yt),$t=(ot,et,yt)=>(Wa(ot,et,"access private method"),yt);/**
1
+ (function(Z,j){typeof exports=="object"&&typeof module<"u"?j(exports):typeof define=="function"&&define.amd?define(["exports"],j):(Z=typeof globalThis<"u"?globalThis:Z||self,j(Z["eox-layercontrol"]={}))})(this,function(Z){"use strict";var lg=Object.defineProperty;var wl=Z=>{throw TypeError(Z)};var ug=(Z,j,st)=>j in Z?lg(Z,j,{enumerable:!0,configurable:!0,writable:!0,value:st}):Z[j]=st;var ht=(Z,j,st)=>ug(Z,typeof j!="symbol"?j+"":j,st),Cs=(Z,j,st)=>j.has(Z)||wl("Cannot "+st);var nt=(Z,j,st)=>(Cs(Z,j,"read from private field"),st?st.call(Z):j.get(Z)),tt=(Z,j,st)=>j.has(Z)?wl("Cannot add the same private member more than once"):j instanceof WeakSet?j.add(Z):j.set(Z,st),Wn=(Z,j,st,un)=>(Cs(Z,j,"write to private field"),un?un.call(Z,st):j.set(Z,st),st),vt=(Z,j,st)=>(Cs(Z,j,"access private method"),st);/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */var yu,hn,sr,or,bs,Du,ws,Ss,ar,Rs,Cs,Is,As,ai,zs,Lu,Ms,Ds,Ls,Os,Ps,$s,Ns,Ou,Pt,Pu,$u,Ha,Nu,ku,Vs,ks,Fs,cn,Bs,Fu,Us;const et=globalThis,yt=et.ShadowRoot&&(et.ShadyCSS===void 0||et.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,un=Symbol(),za=new WeakMap;let Bu=class{constructor(t,e,n){if(this._$cssResult$=!0,n!==un)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(yt&&t===void 0){const n=e!==void 0&&e.length===1;n&&(t=za.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&za.set(e,t))}return t}toString(){return this.cssText}};const Uu=i=>new Bu(typeof i=="string"?i:i+"",void 0,un),Xu=(i,t)=>{if(yt)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const n=document.createElement("style"),r=et.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=e.cssText,i.appendChild(n)}},Va=yt?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(const n of t.cssRules)e+=n.cssText;return Uu(e)})(i):i;/**
5
+ */var xl,on,Hn,Gn,Ni,Cl,Ui,Fi,kn,Bi,Xi,Hi,Gi,Ee,tr,Sl,ki,Vi,ji,zi,Wi,Yi,Zi,Al,bt,Il,$l,Ss,Pl,Ml,er,Ki,qi,an,Ji,Ol,Qi;const j=globalThis,st=j.ShadowRoot&&(j.ShadyCSS===void 0||j.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,un=Symbol(),As=new WeakMap;let Ll=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==un)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(st&&t===void 0){const i=e!==void 0&&e.length===1;i&&(t=As.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&As.set(e,t))}return t}toString(){return this.cssText}};const Dl=n=>new Ll(typeof n=="string"?n:n+"",void 0,un),Nl=(n,t)=>{if(st)n.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const i=document.createElement("style"),r=j.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=e.cssText,n.appendChild(i)}},Is=st?n=>n:n=>n instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return Dl(e)})(n):n;/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:Gu,defineProperty:Wu,getOwnPropertyDescriptor:Hu,getOwnPropertyNames:zu,getOwnPropertySymbols:Vu,getPrototypeOf:Yu}=Object,He=globalThis,Ya=He.trustedTypes,ju=Ya?Ya.emptyScript:"",Ys=He.reactiveElementPolyfillSupport,dn=(i,t)=>i,js={toAttribute(i,t){switch(t){case Boolean:i=i?ju:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},ja=(i,t)=>!Gu(i,t),Za={attribute:!0,type:String,converter:js,reflect:!1,hasChanged:ja};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),He.litPropertyMetadata??(He.litPropertyMetadata=new WeakMap);class Ai extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Za){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const n=Symbol(),r=this.getPropertyDescriptor(t,n,e);r!==void 0&&Wu(this.prototype,t,r)}}static getPropertyDescriptor(t,e,n){const{get:r,set:s}=Hu(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get(){return r==null?void 0:r.call(this)},set(o){const a=r==null?void 0:r.call(this);s.call(this,o),this.requestUpdate(t,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Za}static _$Ei(){if(this.hasOwnProperty(dn("elementProperties")))return;const t=Yu(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(dn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(dn("properties"))){const e=this.properties,n=[...zu(e),...Vu(e)];for(const r of n)this.createProperty(r,e[r])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[n,r]of e)this.elementProperties.set(n,r)}this._$Eh=new Map;for(const[e,n]of this.elementProperties){const r=this._$Eu(e,n);r!==void 0&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const r of n)e.unshift(Va(r))}else t!==void 0&&e.push(Va(t));return e}static _$Eu(t,e){const n=e.attribute;return n===!1?void 0:typeof n=="string"?n:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const n of e.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Xu(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(e=>{var n;return(n=e.hostConnected)==null?void 0:n.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var n;return(n=e.hostDisconnected)==null?void 0:n.call(e)})}attributeChangedCallback(t,e,n){this._$AK(t,n)}_$EC(t,e){var s;const n=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,n);if(r!==void 0&&n.reflect===!0){const o=(((s=n.converter)==null?void 0:s.toAttribute)!==void 0?n.converter:js).toAttribute(e,n.type);this._$Em=t,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(t,e){var s;const n=this.constructor,r=n._$Eh.get(t);if(r!==void 0&&this._$Em!==r){const o=n.getPropertyOptions(r),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((s=o.converter)==null?void 0:s.fromAttribute)!==void 0?o.converter:js;this._$Em=r,this[r]=a.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,n){if(t!==void 0){if(n??(n=this.constructor.getPropertyOptions(t)),!(n.hasChanged??ja)(this[t],e))return;this.P(t,e,n)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,n){this._$AL.has(t)||this._$AL.set(t,e),n.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var n;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[s,o]of this._$Ep)this[s]=o;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[s,o]of r)o.wrapped!==!0||this._$AL.has(s)||this[s]===void 0||this.P(s,this[s],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(n=this._$EO)==null||n.forEach(r=>{var s;return(s=r.hostUpdate)==null?void 0:s.call(r)}),this.update(e)):this._$EU()}catch(r){throw t=!1,this._$EU(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(n=>{var r;return(r=n.hostUpdated)==null?void 0:r.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}}Ai.elementStyles=[],Ai.shadowRootOptions={mode:"open"},Ai[dn("elementProperties")]=new Map,Ai[dn("finalized")]=new Map,Ys==null||Ys({ReactiveElement:Ai}),(He.reactiveElementVersions??(He.reactiveElementVersions=[])).push("2.0.4");/**
9
+ */const{is:Ul,defineProperty:Fl,getOwnPropertyDescriptor:Bl,getOwnPropertyNames:Xl,getOwnPropertySymbols:Hl,getPrototypeOf:Gl}=Object,ae=globalThis,$s=ae.trustedTypes,kl=$s?$s.emptyScript:"",nr=ae.reactiveElementPolyfillSupport,cn=(n,t)=>n,ir={toAttribute(n,t){switch(t){case Boolean:n=n?kl:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,t){let e=n;switch(t){case Boolean:e=n!==null;break;case Number:e=n===null?null:Number(n);break;case Object:case Array:try{e=JSON.parse(n)}catch{e=null}}return e}},Ps=(n,t)=>!Ul(n,t),Ms={attribute:!0,type:String,converter:ir,reflect:!1,hasChanged:Ps};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),ae.litPropertyMetadata??(ae.litPropertyMetadata=new WeakMap);class De extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Ms){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(t,i,e);r!==void 0&&Fl(this.prototype,t,r)}}static getPropertyDescriptor(t,e,i){const{get:r,set:s}=Bl(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get(){return r==null?void 0:r.call(this)},set(o){const a=r==null?void 0:r.call(this);s.call(this,o),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ms}static _$Ei(){if(this.hasOwnProperty(cn("elementProperties")))return;const t=Gl(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(cn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(cn("properties"))){const e=this.properties,i=[...Xl(e),...Hl(e)];for(const r of i)this.createProperty(r,e[r])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[i,r]of e)this.elementProperties.set(i,r)}this._$Eh=new Map;for(const[e,i]of this.elementProperties){const r=this._$Eu(e,i);r!==void 0&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const r of i)e.unshift(Is(r))}else t!==void 0&&e.push(Is(t));return e}static _$Eu(t,e){const i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Nl(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(e=>{var i;return(i=e.hostConnected)==null?void 0:i.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var i;return(i=e.hostDisconnected)==null?void 0:i.call(e)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EC(t,e){var s;const i=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,i);if(r!==void 0&&i.reflect===!0){const o=(((s=i.converter)==null?void 0:s.toAttribute)!==void 0?i.converter:ir).toAttribute(e,i.type);this._$Em=t,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(t,e){var s;const i=this.constructor,r=i._$Eh.get(t);if(r!==void 0&&this._$Em!==r){const o=i.getPropertyOptions(r),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((s=o.converter)==null?void 0:s.fromAttribute)!==void 0?o.converter:ir;this._$Em=r,this[r]=a.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,i){if(t!==void 0){if(i??(i=this.constructor.getPropertyOptions(t)),!(i.hasChanged??Ps)(this[t],e))return;this.P(t,e,i)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,i){this._$AL.has(t)||this._$AL.set(t,e),i.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[s,o]of this._$Ep)this[s]=o;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[s,o]of r)o.wrapped!==!0||this._$AL.has(s)||this[s]===void 0||this.P(s,this[s],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(i=this._$EO)==null||i.forEach(r=>{var s;return(s=r.hostUpdate)==null?void 0:s.call(r)}),this.update(e)):this._$EU()}catch(r){throw t=!1,this._$EU(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(i=>{var r;return(r=i.hostUpdated)==null?void 0:r.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}}De.elementStyles=[],De.shadowRootOptions={mode:"open"},De[cn("elementProperties")]=new Map,De[cn("finalized")]=new Map,nr==null||nr({ReactiveElement:De}),(ae.reactiveElementVersions??(ae.reactiveElementVersions=[])).push("2.0.4");/**
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */const fn=globalThis,gr=fn.trustedTypes,qa=gr?gr.createPolicy("lit-html",{createHTML:i=>i}):void 0,Zs="$lit$",Re=`lit$${(Math.random()+"").slice(9)}$`,qs="?"+Re,Zu=`<${qs}>`,li=document,gn=()=>li.createComment(""),pn=i=>i===null||typeof i!="object"&&typeof i!="function",Ka=Array.isArray,Ja=i=>Ka(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",Ks=`[
14
- \f\r]`,_n=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Qa=/-->/g,tl=/>/g,hi=RegExp(`>|${Ks}(?:([^\\s"'>=/]+)(${Ks}*=${Ks}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),el=/'/g,il=/"/g,nl=/^(?:script|style|textarea|title)$/i,qu=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),q=qu(1),ie=Symbol.for("lit-noChange"),at=Symbol.for("lit-nothing"),rl=new WeakMap,ci=li.createTreeWalker(li,129);function sl(i,t){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return qa!==void 0?qa.createHTML(t):t}const ol=(i,t)=>{const e=i.length-1,n=[];let r,s=t===2?"<svg>":"",o=_n;for(let a=0;a<e;a++){const l=i[a];let h,c,u=-1,d=0;for(;d<l.length&&(o.lastIndex=d,c=o.exec(l),c!==null);)d=o.lastIndex,o===_n?c[1]==="!--"?o=Qa:c[1]!==void 0?o=tl:c[2]!==void 0?(nl.test(c[2])&&(r=RegExp("</"+c[2],"g")),o=hi):c[3]!==void 0&&(o=hi):o===hi?c[0]===">"?(o=r??_n,u=-1):c[1]===void 0?u=-2:(u=o.lastIndex-c[2].length,h=c[1],o=c[3]===void 0?hi:c[3]==='"'?il:el):o===il||o===el?o=hi:o===Qa||o===tl?o=_n:(o=hi,r=void 0);const f=o===hi&&i[a+1].startsWith("/>")?" ":"";s+=o===_n?l+Zu:u>=0?(n.push(h),l.slice(0,u)+Zs+l.slice(u)+Re+f):l+Re+(u===-2?a:f)}return[sl(i,s+(i[e]||"<?>")+(t===2?"</svg>":"")),n]};class mn{constructor({strings:t,_$litType$:e},n){let r;this.parts=[];let s=0,o=0;const a=t.length-1,l=this.parts,[h,c]=ol(t,e);if(this.el=mn.createElement(h,n),ci.currentNode=this.el.content,e===2){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(r=ci.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const u of r.getAttributeNames())if(u.endsWith(Zs)){const d=c[o++],f=r.getAttribute(u).split(Re),g=/([.?@])?(.*)/.exec(d);l.push({type:1,index:s,name:g[2],strings:f,ctor:g[1]==="."?ll:g[1]==="?"?hl:g[1]==="@"?cl:yn}),r.removeAttribute(u)}else u.startsWith(Re)&&(l.push({type:6,index:s}),r.removeAttribute(u));if(nl.test(r.tagName)){const u=r.textContent.split(Re),d=u.length-1;if(d>0){r.textContent=gr?gr.emptyScript:"";for(let f=0;f<d;f++)r.append(u[f],gn()),ci.nextNode(),l.push({type:2,index:++s});r.append(u[d],gn())}}}else if(r.nodeType===8)if(r.data===qs)l.push({type:2,index:s});else{let u=-1;for(;(u=r.data.indexOf(Re,u+1))!==-1;)l.push({type:7,index:s}),u+=Re.length-1}s++}}static createElement(t,e){const n=li.createElement("template");return n.innerHTML=t,n}}function ui(i,t,e=i,n){var o,a;if(t===ie)return t;let r=n!==void 0?(o=e._$Co)==null?void 0:o[n]:e._$Cl;const s=pn(t)?void 0:t._$litDirective$;return(r==null?void 0:r.constructor)!==s&&((a=r==null?void 0:r._$AO)==null||a.call(r,!1),s===void 0?r=void 0:(r=new s(i),r._$AT(i,e,n)),n!==void 0?(e._$Co??(e._$Co=[]))[n]=r:e._$Cl=r),r!==void 0&&(t=ui(i,r._$AS(i,t.values),r,n)),t}class al{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:n}=this._$AD,r=((t==null?void 0:t.creationScope)??li).importNode(e,!0);ci.currentNode=r;let s=ci.nextNode(),o=0,a=0,l=n[0];for(;l!==void 0;){if(o===l.index){let h;l.type===2?h=new Mi(s,s.nextSibling,this,t):l.type===1?h=new l.ctor(s,l.name,l.strings,this,t):l.type===6&&(h=new ul(s,this,t)),this._$AV.push(h),l=n[++a]}o!==(l==null?void 0:l.index)&&(s=ci.nextNode(),o++)}return ci.currentNode=li,r}p(t){let e=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(t,n,e),e+=n.strings.length-2):n._$AI(t[e])),e++}}class Mi{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,n,r){this.type=2,this._$AH=at,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=r,this._$Cv=(r==null?void 0:r.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=ui(this,t,e),pn(t)?t===at||t==null||t===""?(this._$AH!==at&&this._$AR(),this._$AH=at):t!==this._$AH&&t!==ie&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Ja(t)?this.k(t):this._(t)}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}_(t){this._$AH!==at&&pn(this._$AH)?this._$AA.nextSibling.data=t:this.T(li.createTextNode(t)),this._$AH=t}$(t){var s;const{values:e,_$litType$:n}=t,r=typeof n=="number"?this._$AC(t):(n.el===void 0&&(n.el=mn.createElement(sl(n.h,n.h[0]),this.options)),n);if(((s=this._$AH)==null?void 0:s._$AD)===r)this._$AH.p(e);else{const o=new al(r,this),a=o.u(this.options);o.p(e),this.T(a),this._$AH=o}}_$AC(t){let e=rl.get(t.strings);return e===void 0&&rl.set(t.strings,e=new mn(t)),e}k(t){Ka(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,r=0;for(const s of t)r===e.length?e.push(n=new Mi(this.S(gn()),this.S(gn()),this,this.options)):n=e[r],n._$AI(s),r++;r<e.length&&(this._$AR(n&&n._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){var n;for((n=this._$AP)==null?void 0:n.call(this,!1,!0,e);t&&t!==this._$AB;){const r=t.nextSibling;t.remove(),t=r}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}}class yn{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,n,r,s){this.type=1,this._$AH=at,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=at}_$AI(t,e=this,n,r){const s=this.strings;let o=!1;if(s===void 0)t=ui(this,t,e,0),o=!pn(t)||t!==this._$AH&&t!==ie,o&&(this._$AH=t);else{const a=t;let l,h;for(t=s[0],l=0;l<s.length-1;l++)h=ui(this,a[n+l],e,l),h===ie&&(h=this._$AH[l]),o||(o=!pn(h)||h!==this._$AH[l]),h===at?t=at:t!==at&&(t+=(h??"")+s[l+1]),this._$AH[l]=h}o&&!r&&this.j(t)}j(t){t===at?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class ll extends yn{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===at?void 0:t}}class hl extends yn{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==at)}}class cl extends yn{constructor(t,e,n,r,s){super(t,e,n,r,s),this.type=5}_$AI(t,e=this){if((t=ui(this,t,e,0)??at)===ie)return;const n=this._$AH,r=t===at&&n!==at||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,s=t!==at&&(n===at||r);r&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class ul{constructor(t,e,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){ui(this,t)}}const Ku={P:Zs,A:Re,C:qs,M:1,L:ol,R:al,D:Ja,V:ui,I:Mi,H:yn,N:hl,U:cl,B:ll,F:ul},Js=fn.litHtmlPolyfillSupport;Js==null||Js(mn,Mi),(fn.litHtmlVersions??(fn.litHtmlVersions=[])).push("3.1.2");const Ju=(i,t,e)=>{const n=(e==null?void 0:e.renderBefore)??t;let r=n._$litPart$;if(r===void 0){const s=(e==null?void 0:e.renderBefore)??null;n._$litPart$=r=new Mi(t.insertBefore(gn(),s),s,void 0,e??{})}return r._$AI(i),r};/**
13
+ */const hn=globalThis,Yn=hn.trustedTypes,Os=Yn?Yn.createPolicy("lit-html",{createHTML:n=>n}):void 0,rr="$lit$",qt=`lit$${(Math.random()+"").slice(9)}$`,sr="?"+qt,Vl=`<${sr}>`,be=document,dn=()=>be.createComment(""),fn=n=>n===null||typeof n!="object"&&typeof n!="function",Ls=Array.isArray,Ds=n=>Ls(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",or=`[
14
+ \f\r]`,gn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ns=/-->/g,Us=/>/g,ve=RegExp(`>|${or}(?:([^\\s"'>=/]+)(${or}*=${or}*(?:[^
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Fs=/'/g,Bs=/"/g,Xs=/^(?:script|style|textarea|title)$/i,jl=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),B=jl(1),Nt=Symbol.for("lit-noChange"),K=Symbol.for("lit-nothing"),Hs=new WeakMap,Te=be.createTreeWalker(be,129);function Gs(n,t){if(!Array.isArray(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Os!==void 0?Os.createHTML(t):t}const ks=(n,t)=>{const e=n.length-1,i=[];let r,s=t===2?"<svg>":"",o=gn;for(let a=0;a<e;a++){const l=n[a];let u,h,c=-1,d=0;for(;d<l.length&&(o.lastIndex=d,h=o.exec(l),h!==null);)d=o.lastIndex,o===gn?h[1]==="!--"?o=Ns:h[1]!==void 0?o=Us:h[2]!==void 0?(Xs.test(h[2])&&(r=RegExp("</"+h[2],"g")),o=ve):h[3]!==void 0&&(o=ve):o===ve?h[0]===">"?(o=r??gn,c=-1):h[1]===void 0?c=-2:(c=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?ve:h[3]==='"'?Bs:Fs):o===Bs||o===Fs?o=ve:o===Ns||o===Us?o=gn:(o=ve,r=void 0);const f=o===ve&&n[a+1].startsWith("/>")?" ":"";s+=o===gn?l+Vl:c>=0?(i.push(u),l.slice(0,c)+rr+l.slice(c)+qt+f):l+qt+(c===-2?a:f)}return[Gs(n,s+(n[e]||"<?>")+(t===2?"</svg>":"")),i]};class pn{constructor({strings:t,_$litType$:e},i){let r;this.parts=[];let s=0,o=0;const a=t.length-1,l=this.parts,[u,h]=ks(t,e);if(this.el=pn.createElement(u,i),Te.currentNode=this.el.content,e===2){const c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(r=Te.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const c of r.getAttributeNames())if(c.endsWith(rr)){const d=h[o++],f=r.getAttribute(c).split(qt),g=/([.?@])?(.*)/.exec(d);l.push({type:1,index:s,name:g[2],strings:f,ctor:g[1]==="."?js:g[1]==="?"?zs:g[1]==="@"?Ws:mn}),r.removeAttribute(c)}else c.startsWith(qt)&&(l.push({type:6,index:s}),r.removeAttribute(c));if(Xs.test(r.tagName)){const c=r.textContent.split(qt),d=c.length-1;if(d>0){r.textContent=Yn?Yn.emptyScript:"";for(let f=0;f<d;f++)r.append(c[f],dn()),Te.nextNode(),l.push({type:2,index:++s});r.append(c[d],dn())}}}else if(r.nodeType===8)if(r.data===sr)l.push({type:2,index:s});else{let c=-1;for(;(c=r.data.indexOf(qt,c+1))!==-1;)l.push({type:7,index:s}),c+=qt.length-1}s++}}static createElement(t,e){const i=be.createElement("template");return i.innerHTML=t,i}}function xe(n,t,e=n,i){var o,a;if(t===Nt)return t;let r=i!==void 0?(o=e._$Co)==null?void 0:o[i]:e._$Cl;const s=fn(t)?void 0:t._$litDirective$;return(r==null?void 0:r.constructor)!==s&&((a=r==null?void 0:r._$AO)==null||a.call(r,!1),s===void 0?r=void 0:(r=new s(n),r._$AT(n,e,i)),i!==void 0?(e._$Co??(e._$Co=[]))[i]=r:e._$Cl=r),r!==void 0&&(t=xe(n,r._$AS(n,t.values),r,i)),t}class Vs{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,r=((t==null?void 0:t.creationScope)??be).importNode(e,!0);Te.currentNode=r;let s=Te.nextNode(),o=0,a=0,l=i[0];for(;l!==void 0;){if(o===l.index){let u;l.type===2?u=new Ne(s,s.nextSibling,this,t):l.type===1?u=new l.ctor(s,l.name,l.strings,this,t):l.type===6&&(u=new Ys(s,this,t)),this._$AV.push(u),l=i[++a]}o!==(l==null?void 0:l.index)&&(s=Te.nextNode(),o++)}return Te.currentNode=be,r}p(t){let e=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class Ne{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,i,r){this.type=2,this._$AH=K,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=r,this._$Cv=(r==null?void 0:r.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=xe(this,t,e),fn(t)?t===K||t==null||t===""?(this._$AH!==K&&this._$AR(),this._$AH=K):t!==this._$AH&&t!==Nt&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Ds(t)?this.k(t):this._(t)}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}_(t){this._$AH!==K&&fn(this._$AH)?this._$AA.nextSibling.data=t:this.T(be.createTextNode(t)),this._$AH=t}$(t){var s;const{values:e,_$litType$:i}=t,r=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=pn.createElement(Gs(i.h,i.h[0]),this.options)),i);if(((s=this._$AH)==null?void 0:s._$AD)===r)this._$AH.p(e);else{const o=new Vs(r,this),a=o.u(this.options);o.p(e),this.T(a),this._$AH=o}}_$AC(t){let e=Hs.get(t.strings);return e===void 0&&Hs.set(t.strings,e=new pn(t)),e}k(t){Ls(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,r=0;for(const s of t)r===e.length?e.push(i=new Ne(this.S(dn()),this.S(dn()),this,this.options)):i=e[r],i._$AI(s),r++;r<e.length&&(this._$AR(i&&i._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,e);t&&t!==this._$AB;){const r=t.nextSibling;t.remove(),t=r}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}}class mn{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,r,s){this.type=1,this._$AH=K,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=s,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=K}_$AI(t,e=this,i,r){const s=this.strings;let o=!1;if(s===void 0)t=xe(this,t,e,0),o=!fn(t)||t!==this._$AH&&t!==Nt,o&&(this._$AH=t);else{const a=t;let l,u;for(t=s[0],l=0;l<s.length-1;l++)u=xe(this,a[i+l],e,l),u===Nt&&(u=this._$AH[l]),o||(o=!fn(u)||u!==this._$AH[l]),u===K?t=K:t!==K&&(t+=(u??"")+s[l+1]),this._$AH[l]=u}o&&!r&&this.j(t)}j(t){t===K?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class js extends mn{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===K?void 0:t}}class zs extends mn{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==K)}}class Ws extends mn{constructor(t,e,i,r,s){super(t,e,i,r,s),this.type=5}_$AI(t,e=this){if((t=xe(this,t,e,0)??K)===Nt)return;const i=this._$AH,r=t===K&&i!==K||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,s=t!==K&&(i===K||r);r&&this.element.removeEventListener(this.name,this,i),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class Ys{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){xe(this,t)}}const zl={P:rr,A:qt,C:sr,M:1,L:ks,R:Vs,D:Ds,V:xe,I:Ne,H:mn,N:zs,U:Ws,B:js,F:Ys},ar=hn.litHtmlPolyfillSupport;ar==null||ar(pn,Ne),(hn.litHtmlVersions??(hn.litHtmlVersions=[])).push("3.1.2");const Wl=(n,t,e)=>{const i=(e==null?void 0:e.renderBefore)??t;let r=i._$litPart$;if(r===void 0){const s=(e==null?void 0:e.renderBefore)??null;i._$litPart$=r=new Ne(t.insertBefore(dn(),s),s,void 0,e??{})}return r._$AI(n),r};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
- */let Yt=class extends Ai{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ju(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return ie}};Yt._$litElement$=!0,Yt.finalized=!0,(yu=globalThis.litElementHydrateSupport)==null||yu.call(globalThis,{LitElement:Yt});const Qs=globalThis.litElementPolyfillSupport;Qs==null||Qs({LitElement:Yt}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.4");/**
19
+ */let Mt=class extends De{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Wl(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return Nt}};Mt._$litElement$=!0,Mt.finalized=!0,(xl=globalThis.litElementHydrateSupport)==null||xl.call(globalThis,{LitElement:Mt});const lr=globalThis.litElementPolyfillSupport;lr==null||lr({LitElement:Mt}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.4");/**
20
20
  * @license
21
21
  * Copyright 2021 Google LLC
22
22
  * SPDX-License-Identifier: BSD-3-Clause
23
- */function ne(i,t,e){return i?t(i):e==null?void 0:e(i)}/**
23
+ */function Ut(n,t,e){return n?t(n):e==null?void 0:e(n)}/**
24
24
  * @license
25
25
  * Copyright 2017 Google LLC
26
26
  * SPDX-License-Identifier: BSD-3-Clause
27
- */const ze={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},to=i=>(...t)=>({_$litDirective$:i,values:t});class eo{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,n){this._$Ct=t,this._$AM=e,this._$Ci=n}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}/**
27
+ */const le={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ur=n=>(...t)=>({_$litDirective$:n,values:t});class cr{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}/**
28
28
  * @license
29
29
  * Copyright 2020 Google LLC
30
30
  * SPDX-License-Identifier: BSD-3-Clause
31
- */const{I:Qu}=Ku,td=i=>i.strings===void 0,dl=()=>document.createComment(""),En=(i,t,e)=>{var s;const n=i._$AA.parentNode,r=t===void 0?i._$AB:t._$AA;if(e===void 0){const o=n.insertBefore(dl(),r),a=n.insertBefore(dl(),r);e=new Qu(o,a,i,i.options)}else{const o=e._$AB.nextSibling,a=e._$AM,l=a!==i;if(l){let h;(s=e._$AQ)==null||s.call(e,i),e._$AM=i,e._$AP!==void 0&&(h=i._$AU)!==a._$AU&&e._$AP(h)}if(o!==r||l){let h=e._$AA;for(;h!==o;){const c=h.nextSibling;n.insertBefore(h,r),h=c}}}return e},di=(i,t,e=i)=>(i._$AI(t,e),i),ed={},fl=(i,t=ed)=>i._$AH=t,id=i=>i._$AH,io=i=>{var n;(n=i._$AP)==null||n.call(i,!1,!0);let t=i._$AA;const e=i._$AB.nextSibling;for(;t!==e;){const r=t.nextSibling;t.remove(),t=r}};/**
31
+ */const{I:Yl}=zl,Zl=n=>n.strings===void 0,Zs=()=>document.createComment(""),_n=(n,t,e)=>{var s;const i=n._$AA.parentNode,r=t===void 0?n._$AB:t._$AA;if(e===void 0){const o=i.insertBefore(Zs(),r),a=i.insertBefore(Zs(),r);e=new Yl(o,a,n,n.options)}else{const o=e._$AB.nextSibling,a=e._$AM,l=a!==n;if(l){let u;(s=e._$AQ)==null||s.call(e,n),e._$AM=n,e._$AP!==void 0&&(u=n._$AU)!==a._$AU&&e._$AP(u)}if(o!==r||l){let u=e._$AA;for(;u!==o;){const h=u.nextSibling;i.insertBefore(u,r),u=h}}}return e},Re=(n,t,e=n)=>(n._$AI(t,e),n),Kl={},Ks=(n,t=Kl)=>n._$AH=t,ql=n=>n._$AH,hr=n=>{var i;(i=n._$AP)==null||i.call(n,!1,!0);let t=n._$AA;const e=n._$AB.nextSibling;for(;t!==e;){const r=t.nextSibling;t.remove(),t=r}};/**
32
32
  * @license
33
33
  * Copyright 2017 Google LLC
34
34
  * SPDX-License-Identifier: BSD-3-Clause
35
- */const gl=(i,t,e)=>{const n=new Map;for(let r=t;r<=e;r++)n.set(i[r],r);return n},nd=to(class extends eo{constructor(i){if(super(i),i.type!==ze.CHILD)throw Error("repeat() can only be used in text expressions")}dt(i,t,e){let n;e===void 0?e=t:t!==void 0&&(n=t);const r=[],s=[];let o=0;for(const a of i)r[o]=n?n(a,o):o,s[o]=e(a,o),o++;return{values:s,keys:r}}render(i,t,e){return this.dt(i,t,e).values}update(i,[t,e,n]){const r=id(i),{values:s,keys:o}=this.dt(t,e,n);if(!Array.isArray(r))return this.ut=o,s;const a=this.ut??(this.ut=[]),l=[];let h,c,u=0,d=r.length-1,f=0,g=s.length-1;for(;u<=d&&f<=g;)if(r[u]===null)u++;else if(r[d]===null)d--;else if(a[u]===o[f])l[f]=di(r[u],s[f]),u++,f++;else if(a[d]===o[g])l[g]=di(r[d],s[g]),d--,g--;else if(a[u]===o[g])l[g]=di(r[u],s[g]),En(i,l[g+1],r[u]),u++,g--;else if(a[d]===o[f])l[f]=di(r[d],s[f]),En(i,r[u],r[d]),d--,f++;else if(h===void 0&&(h=gl(o,f,g),c=gl(a,u,d)),h.has(a[u]))if(h.has(a[d])){const p=c.get(o[f]),_=p!==void 0?r[p]:null;if(_===null){const y=En(i,r[u]);di(y,s[f]),l[f]=y}else l[f]=di(_,s[f]),En(i,r[u],_),r[p]=null;f++}else io(r[d]),d--;else io(r[u]),u++;for(;f<=g;){const p=En(i,l[g+1]);di(p,s[f]),l[f++]=p}for(;u<=d;){const p=r[u++];p!==null&&io(p)}return this.ut=o,fl(i,l),ie}});/**
35
+ */const qs=(n,t,e)=>{const i=new Map;for(let r=t;r<=e;r++)i.set(n[r],r);return i},Jl=ur(class extends cr{constructor(n){if(super(n),n.type!==le.CHILD)throw Error("repeat() can only be used in text expressions")}dt(n,t,e){let i;e===void 0?e=t:t!==void 0&&(i=t);const r=[],s=[];let o=0;for(const a of n)r[o]=i?i(a,o):o,s[o]=e(a,o),o++;return{values:s,keys:r}}render(n,t,e){return this.dt(n,t,e).values}update(n,[t,e,i]){const r=ql(n),{values:s,keys:o}=this.dt(t,e,i);if(!Array.isArray(r))return this.ut=o,s;const a=this.ut??(this.ut=[]),l=[];let u,h,c=0,d=r.length-1,f=0,g=s.length-1;for(;c<=d&&f<=g;)if(r[c]===null)c++;else if(r[d]===null)d--;else if(a[c]===o[f])l[f]=Re(r[c],s[f]),c++,f++;else if(a[d]===o[g])l[g]=Re(r[d],s[g]),d--,g--;else if(a[c]===o[g])l[g]=Re(r[c],s[g]),_n(n,l[g+1],r[c]),c++,g--;else if(a[d]===o[f])l[f]=Re(r[d],s[f]),_n(n,r[c],r[d]),d--,f++;else if(u===void 0&&(u=qs(o,f,g),h=qs(a,c,d)),u.has(a[c]))if(u.has(a[d])){const p=h.get(o[f]),m=p!==void 0?r[p]:null;if(m===null){const y=_n(n,r[c]);Re(y,s[f]),l[f]=y}else l[f]=Re(m,s[f]),_n(n,r[c],m),r[p]=null;f++}else hr(r[d]),d--;else hr(r[c]),c++;for(;f<=g;){const p=_n(n,l[g+1]);Re(p,s[f]),l[f++]=p}for(;c<=d;){const p=r[c++];p!==null&&hr(p)}return this.ut=o,Ks(n,l),Nt}});/**
36
36
  * wms-capabilities @0.6.0
37
37
  * @description WMS service Capabilities > JSON, based on openlayers
38
38
  * @license BSD-2-Clause
39
39
  * @preserve
40
- */var Z=i=>i!==void 0,pl=(i,t,e)=>t in i?i[t]:i[t]=e;const xn={ELEMENT:1,ATTRIBUTE:2,TEXT:3,CDATA_SECTION:4,ENTITY_REFERENCE:5,ENTITY:6,PROCESSING_INSTRUCTION:7,COMMENT:8,DOCUMENT:9,DOCUMENT_TYPE:10,DOCUMENT_FRAGMENT:11,NOTATION:12};class rd{constructor(t){this._parser=new t}toDocument(t){return this._parser.parseFromString(t,"application/xml")}getAllTextContent(t,e){return pr(t,e).join("")}}function pr(i,t){return _l(i,t,[]).join("")}function _l(i,t,e){if(i.nodeType===xn.CDATA_SECTION||i.nodeType===xn.TEXT)t?e.push(String(i.nodeValue).replace(/(\r\n|\r|\n)/g,"")):e.push(i.nodeValue);else{var n;for(n=i.firstChild;n;n=n.nextSibling)_l(n,t,e)}return e}function sd(i,t,e,n){for(var r=od(t);r;r=ad(r)){var s=r.namespaceURI||null,o=i[s];if(Z(o)){var a=o[r.localName];Z(a)&&a.call(n,r,e)}}}function od(i){let t=i.firstElementChild||i.firstChild;for(;t&&t.nodeType!==xn.ELEMENT;)t=t.nextSibling;return t}function ad(i){let t=i.nextElementSibling||i.nextSibling;for(;t&&t.nodeType!==xn.ELEMENT;)t=t.nextSibling;return t}function At(i,t,e){return ld(i,t,e)}function ld(i,t,e){var n=Z(e)?e:{},r,s;for(r=0,s=i.length;r<s;++r)n[i[r]]=t;return n}function ml(i,t){return function(e,n){var r=i.call(Z(t)?t:this,e,n);if(Z(r)){var s=n[n.length-1];s.push(r)}}}function Rt(i,t,e,n,r){return n.push(i),sd(t,e,n,r),n.pop()}function O(i,t,e){return function(n,r){let s=i.call(Z(e)?e:this,n,r);if(Z(s)){var o=r[r.length-1],a=Z(t)?t:n.localName;o[a]=s}}}function Gt(i,t,e){return function(n,r){var s=i.call(Z(e)?e:this,n,r);if(Z(s)){var o=r[r.length-1],a=Z(t)?t:n.localName,l=pl(o,a,[]);l.push(s)}}}const hd=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function cd(i){return i.replace(hd,"")}function fi(i){const t=/^\s*(true|1)|(false|0)\s*$/.exec(i);if(t)return Z(t[1])||!1}function Di(i){return Ce(pr(i,!1))}function Ce(i){const t=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(i);if(t)return parseFloat(t[1])}function no(i){return _r(pr(i,!1))}function _r(i){const t=/^\s*(\d+)\s*$/.exec(i);if(t)return parseInt(t[1],10)}function Q(i){return cd(pr(i,!1))}const ud="http://www.w3.org/1999/xlink";function ro(i){return i.getAttributeNS(ud,"href")}function dd(i,t){return Rt({},Bd,i,t)}function yl(i){return[Ce(i.getAttribute("minx")),Ce(i.getAttribute("miny")),Ce(i.getAttribute("maxx")),Ce(i.getAttribute("maxy"))]}function fd(i,t){const e=yl(i),n=[Ce(i.getAttribute("resx")),Ce(i.getAttribute("resy"))];return{crs:i.getAttribute("CRS")||i.getAttribute("SRS"),extent:e,res:n}}function gd(i,t){const e=yl(i);if(!(!Z(e[0])||!Z(e[1])||!Z(e[2])||!Z(e[3])))return e}function pd(i,t){const e=parseFloat(i.getAttribute("min")),n=parseFloat(i.getAttribute("max"));return{min:e,max:n}}function _d(i,t){const e=Rt({},Ud,i,t);if(!Z(e))return;const n=e.westBoundLongitude,r=e.southBoundLatitude,s=e.eastBoundLongitude,o=e.northBoundLatitude;if(!(!Z(n)||!Z(r)||!Z(s)||!Z(o)))return[n,r,s,o]}function md(i,t){return Rt({},Od,i,t)}function yd(i,t){return Rt({},Pd,i,t)}function Ed(i,t){return Rt({},$d,i,t)}function xd(i,t){return Rt({},Nd,i,t)}function Td(i,t){return Rt({},kd,i,t)}function vd(i,t){return Rt([],Fd,i,t)}function bd(i,t){const e=fi(i.getAttribute("queryable"));return Rt({queryable:Z(e)?e:!1},Tl,i,t)}function wd(i,t){var e=t[t.length-1];const n=Rt({},Tl,i,t);if(!Z(n))return;let r=fi(i.getAttribute("queryable"));Z(r)||(r=e.queryable),n.queryable=Z(r)?r:!1;let s=_r(i.getAttribute("cascaded"));Z(s)||(s=e.cascaded),n.cascaded=s;let o=fi(i.getAttribute("opaque"));Z(o)||(o=e.opaque),n.opaque=Z(o)?o:!1;let a=fi(i.getAttribute("noSubsets"));Z(a)||(a=e.noSubsets),n.noSubsets=Z(a)?a:!1;let l=Ce(i.getAttribute("fixedWidth"));Z(l)||(l=e.fixedWidth),n.fixedWidth=l;let h=Ce(i.getAttribute("fixedHeight"));Z(h)||(h=e.fixedHeight),n.fixedHeight=h;const c=["Style","CRS","AuthorityURL"];for(let d=0,f=c.length;d<f;d++){const g=c[d],p=e[g];if(Z(p)){let _=pl(n,g,[]);_=_.concat(p),n[g]=_}}const u=["EX_GeographicBoundingBox","BoundingBox","Dimension","Attribution","MinScaleDenominator","MaxScaleDenominator"];for(let d=0,f=u.length;d<f;d++){const g=u[d],p=n[g];if(!Z(p)){const _=e[g];n[g]=_}}return n}function Sd(i,t){return{name:i.getAttribute("name"),units:i.getAttribute("units"),unitSymbol:i.getAttribute("unitSymbol"),default:i.getAttribute("default"),multipleValues:fi(i.getAttribute("multipleValues")),nearestValue:fi(i.getAttribute("nearestValue")),current:fi(i.getAttribute("current")),values:Q(i)}}function Ie(i,t){return Rt({},Vd,i,t)}function Rd(i,t){return Rt({},Xd,i,t)}function Cd(i,t){return Rt({},Wd,i,t)}function Id(i,t){return Rt({},Hd,i,t)}function so(i,t){return Rt({},Gd,i,t)}function El(i,t){var e=Ie(i,t);if(Z(e)){const n=[_r(i.getAttribute("width")),_r(i.getAttribute("height"))];return e.size=n,e}}function Ad(i,t){var e=Ie(i,t);if(Z(e))return e.name=i.getAttribute("name"),e}function Md(i,t){var e=Ie(i,t);if(Z(e))return e.type=i.getAttribute("type"),e}function Dd(i,t){return Rt({},zd,i,t)}function xl(i,t){return Rt([],Yd,i,t)}const Mt=[null,"http://www.opengis.net/wms"],Ld=At(Mt,{Service:O(yd),Capability:O(md)}),Od=At(Mt,{Request:O(Rd),Exception:O(vd),Layer:O(bd)}),Pd=At(Mt,{Name:O(Q),Title:O(Q),Abstract:O(Q),KeywordList:O(xl),OnlineResource:O(ro),ContactInformation:O(Ed),Fees:O(Q),AccessConstraints:O(Q),LayerLimit:O(no),MaxWidth:O(no),MaxHeight:O(no)}),$d=At(Mt,{ContactPersonPrimary:O(xd),ContactPosition:O(Q),ContactAddress:O(Td),ContactVoiceTelephone:O(Q),ContactFacsimileTelephone:O(Q),ContactElectronicMailAddress:O(Q)}),Nd=At(Mt,{ContactPerson:O(Q),ContactOrganization:O(Q)}),kd=At(Mt,{AddressType:O(Q),Address:O(Q),City:O(Q),StateOrProvince:O(Q),PostCode:O(Q),Country:O(Q)}),Fd=At(Mt,{Format:ml(Q)}),Tl=At(Mt,{Name:O(Q),Title:O(Q),Abstract:O(Q),KeywordList:O(xl),CRS:Gt(Q),SRS:Gt(Q),EX_GeographicBoundingBox:O(_d),LatLonBoundingBox:O(gd),BoundingBox:Gt(fd),Dimension:Gt(Sd),Attribution:O(dd),AuthorityURL:Gt(Ad),Identifier:Gt(Q),MetadataURL:Gt(Md),DataURL:Gt(Ie),FeatureListURL:Gt(Ie),Style:Gt(Dd),MinScaleDenominator:O(Di),MaxScaleDenominator:O(Di),ScaleHint:O(pd),Layer:Gt(wd)}),Bd=At(Mt,{Title:O(Q),OnlineResource:O(ro),LogoURL:O(El)}),Ud=At(Mt,{westBoundLongitude:O(Di),eastBoundLongitude:O(Di),southBoundLatitude:O(Di),northBoundLatitude:O(Di)}),Xd=At(Mt,{GetCapabilities:O(so),GetMap:O(so),GetFeatureInfo:O(so)}),Gd=At(Mt,{Format:Gt(Q),DCPType:Gt(Cd)}),Wd=At(Mt,{HTTP:O(Id)}),Hd=At(Mt,{Get:O(Ie),Post:O(Ie)}),zd=At(Mt,{Name:O(Q),Title:O(Q),Abstract:O(Q),LegendURL:Gt(El),StyleSheetURL:O(Ie),StyleURL:O(Ie)}),Vd=At(Mt,{Format:O(Q),OnlineResource:O(ro)}),Yd=At(Mt,{Keyword:ml(Q)});class jd{constructor(t,e){!e&&typeof window<"u"&&(e=window.DOMParser),this.version=void 0,this._parser=new rd(e),this._data=t}data(t){return this._data=t,this}toJSON(t){return t=t||this._data,this.parse(t)}parse(t){return this.readFromDocument(this._parser.toDocument(t))}readFromDocument(t){for(let e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==xn.ELEMENT)return this.readFromNode(e);return null}readFromNode(t){return this.version=t.getAttribute("version"),Rt({version:this.version},Ld,t,[])||null}}async function Zd(i){let t=new URL(i),e=t.searchParams;e.set("SERVICE","WMS"),e.set("REQUEST","GetCapabilities");let n=t.toString();const r=await fetch(n);if(r.ok){const s=await r.text();return new jd(s).toJSON()}else throw new Error(`Error: ${r.status}`)}function oo(i){const t=/\b(?:wms|ows)\b/i,e=/{(?:z|x|y-?)}\/{(?:z|x|y-?)}\/{(?:z|x|y-?)}/i;return t.test(i)?"TileWMS":e.test(i)?"XYZ":!1}function qd(i){const e=/^(?:(?:https?|ftp):\/\/|\/\/)?(?:localhost|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|(?:\w+[\w-]*\.)+\w+)(?::\d+)?(?:\/\S*)?$/.test(i),n=oo(i);return!!(i&&e&&n)}function vl(i){return i.replace(/(['"])?([a-zA-Z0-9_]+)(['"])?:/g,'"$2": ').replace(/,\s*}/g,"}").replace(/,\s*]/g,"]").replace(/\s*(\{|}|\[|\]|,)\s*/g,"$1").replaceAll('": //',"://")}function Kd(i){try{return JSON.parse(vl(i)),!!i}catch{return!1}}function Jd(i,t){const e=new URL(i).searchParams;Object.entries(t).forEach(([o,a])=>{typeof a=="object"&&!Array.isArray(a)&&a!==null?Object.keys(a).forEach(l=>{e.set(l,a[l])}):e.set(o,a)});const n=i.split("?")[0],r=e.toString();return`${n}?${r}`}/**!
40
+ */var U=n=>n!==void 0,Js=(n,t,e)=>t in n?n[t]:n[t]=e;const yn={ELEMENT:1,ATTRIBUTE:2,TEXT:3,CDATA_SECTION:4,ENTITY_REFERENCE:5,ENTITY:6,PROCESSING_INSTRUCTION:7,COMMENT:8,DOCUMENT:9,DOCUMENT_TYPE:10,DOCUMENT_FRAGMENT:11,NOTATION:12};class Ql{constructor(t){this._parser=new t}toDocument(t){return this._parser.parseFromString(t,"application/xml")}getAllTextContent(t,e){return Zn(t,e).join("")}}function Zn(n,t){return Qs(n,t,[]).join("")}function Qs(n,t,e){if(n.nodeType===yn.CDATA_SECTION||n.nodeType===yn.TEXT)t?e.push(String(n.nodeValue).replace(/(\r\n|\r|\n)/g,"")):e.push(n.nodeValue);else{var i;for(i=n.firstChild;i;i=i.nextSibling)Qs(i,t,e)}return e}function tu(n,t,e,i){for(var r=eu(t);r;r=nu(r)){var s=r.namespaceURI||null,o=n[s];if(U(o)){var a=o[r.localName];U(a)&&a.call(i,r,e)}}}function eu(n){let t=n.firstElementChild||n.firstChild;for(;t&&t.nodeType!==yn.ELEMENT;)t=t.nextSibling;return t}function nu(n){let t=n.nextElementSibling||n.nextSibling;for(;t&&t.nodeType!==yn.ELEMENT;)t=t.nextSibling;return t}function pt(n,t,e){return iu(n,t,e)}function iu(n,t,e){var i=U(e)?e:{},r,s;for(r=0,s=n.length;r<s;++r)i[n[r]]=t;return i}function to(n,t){return function(e,i){var r=n.call(U(t)?t:this,e,i);if(U(r)){var s=i[i.length-1];s.push(r)}}}function dt(n,t,e,i,r){return i.push(n),tu(t,e,i,r),i.pop()}function S(n,t,e){return function(i,r){let s=n.call(U(e)?e:this,i,r);if(U(s)){var o=r[r.length-1],a=U(t)?t:i.localName;o[a]=s}}}function St(n,t,e){return function(i,r){var s=n.call(U(e)?e:this,i,r);if(U(s)){var o=r[r.length-1],a=U(t)?t:i.localName,l=Js(o,a,[]);l.push(s)}}}const ru=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function su(n){return n.replace(ru,"")}function we(n){const t=/^\s*(true|1)|(false|0)\s*$/.exec(n);if(t)return U(t[1])||!1}function Ue(n){return Jt(Zn(n,!1))}function Jt(n){const t=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(n);if(t)return parseFloat(t[1])}function dr(n){return Kn(Zn(n,!1))}function Kn(n){const t=/^\s*(\d+)\s*$/.exec(n);if(t)return parseInt(t[1],10)}function G(n){return su(Zn(n,!1))}const ou="http://www.w3.org/1999/xlink";function fr(n){return n.getAttributeNS(ou,"href")}function au(n,t){return dt({},Lu,n,t)}function eo(n){return[Jt(n.getAttribute("minx")),Jt(n.getAttribute("miny")),Jt(n.getAttribute("maxx")),Jt(n.getAttribute("maxy"))]}function lu(n,t){const e=eo(n),i=[Jt(n.getAttribute("resx")),Jt(n.getAttribute("resy"))];return{crs:n.getAttribute("CRS")||n.getAttribute("SRS"),extent:e,res:i}}function uu(n,t){const e=eo(n);if(!(!U(e[0])||!U(e[1])||!U(e[2])||!U(e[3])))return e}function cu(n,t){const e=parseFloat(n.getAttribute("min")),i=parseFloat(n.getAttribute("max"));return{min:e,max:i}}function hu(n,t){const e=dt({},Du,n,t);if(!U(e))return;const i=e.westBoundLongitude,r=e.southBoundLatitude,s=e.eastBoundLongitude,o=e.northBoundLatitude;if(!(!U(i)||!U(r)||!U(s)||!U(o)))return[i,r,s,o]}function du(n,t){return dt({},Au,n,t)}function fu(n,t){return dt({},Iu,n,t)}function gu(n,t){return dt({},$u,n,t)}function pu(n,t){return dt({},Pu,n,t)}function mu(n,t){return dt({},Mu,n,t)}function _u(n,t){return dt([],Ou,n,t)}function yu(n,t){const e=we(n.getAttribute("queryable"));return dt({queryable:U(e)?e:!1},ro,n,t)}function Eu(n,t){var e=t[t.length-1];const i=dt({},ro,n,t);if(!U(i))return;let r=we(n.getAttribute("queryable"));U(r)||(r=e.queryable),i.queryable=U(r)?r:!1;let s=Kn(n.getAttribute("cascaded"));U(s)||(s=e.cascaded),i.cascaded=s;let o=we(n.getAttribute("opaque"));U(o)||(o=e.opaque),i.opaque=U(o)?o:!1;let a=we(n.getAttribute("noSubsets"));U(a)||(a=e.noSubsets),i.noSubsets=U(a)?a:!1;let l=Jt(n.getAttribute("fixedWidth"));U(l)||(l=e.fixedWidth),i.fixedWidth=l;let u=Jt(n.getAttribute("fixedHeight"));U(u)||(u=e.fixedHeight),i.fixedHeight=u;const h=["Style","CRS","AuthorityURL"];for(let d=0,f=h.length;d<f;d++){const g=h[d],p=e[g];if(U(p)){let m=Js(i,g,[]);m=m.concat(p),i[g]=m}}const c=["EX_GeographicBoundingBox","BoundingBox","Dimension","Attribution","MinScaleDenominator","MaxScaleDenominator"];for(let d=0,f=c.length;d<f;d++){const g=c[d],p=i[g];if(!U(p)){const m=e[g];i[g]=m}}return i}function bu(n,t){return{name:n.getAttribute("name"),units:n.getAttribute("units"),unitSymbol:n.getAttribute("unitSymbol"),default:n.getAttribute("default"),multipleValues:we(n.getAttribute("multipleValues")),nearestValue:we(n.getAttribute("nearestValue")),current:we(n.getAttribute("current")),values:G(n)}}function Qt(n,t){return dt({},Hu,n,t)}function vu(n,t){return dt({},Nu,n,t)}function Tu(n,t){return dt({},Fu,n,t)}function xu(n,t){return dt({},Bu,n,t)}function gr(n,t){return dt({},Uu,n,t)}function no(n,t){var e=Qt(n,t);if(U(e)){const i=[Kn(n.getAttribute("width")),Kn(n.getAttribute("height"))];return e.size=i,e}}function Ru(n,t){var e=Qt(n,t);if(U(e))return e.name=n.getAttribute("name"),e}function wu(n,t){var e=Qt(n,t);if(U(e))return e.type=n.getAttribute("type"),e}function Cu(n,t){return dt({},Xu,n,t)}function io(n,t){return dt([],Gu,n,t)}const mt=[null,"http://www.opengis.net/wms"],Su=pt(mt,{Service:S(fu),Capability:S(du)}),Au=pt(mt,{Request:S(vu),Exception:S(_u),Layer:S(yu)}),Iu=pt(mt,{Name:S(G),Title:S(G),Abstract:S(G),KeywordList:S(io),OnlineResource:S(fr),ContactInformation:S(gu),Fees:S(G),AccessConstraints:S(G),LayerLimit:S(dr),MaxWidth:S(dr),MaxHeight:S(dr)}),$u=pt(mt,{ContactPersonPrimary:S(pu),ContactPosition:S(G),ContactAddress:S(mu),ContactVoiceTelephone:S(G),ContactFacsimileTelephone:S(G),ContactElectronicMailAddress:S(G)}),Pu=pt(mt,{ContactPerson:S(G),ContactOrganization:S(G)}),Mu=pt(mt,{AddressType:S(G),Address:S(G),City:S(G),StateOrProvince:S(G),PostCode:S(G),Country:S(G)}),Ou=pt(mt,{Format:to(G)}),ro=pt(mt,{Name:S(G),Title:S(G),Abstract:S(G),KeywordList:S(io),CRS:St(G),SRS:St(G),EX_GeographicBoundingBox:S(hu),LatLonBoundingBox:S(uu),BoundingBox:St(lu),Dimension:St(bu),Attribution:S(au),AuthorityURL:St(Ru),Identifier:St(G),MetadataURL:St(wu),DataURL:St(Qt),FeatureListURL:St(Qt),Style:St(Cu),MinScaleDenominator:S(Ue),MaxScaleDenominator:S(Ue),ScaleHint:S(cu),Layer:St(Eu)}),Lu=pt(mt,{Title:S(G),OnlineResource:S(fr),LogoURL:S(no)}),Du=pt(mt,{westBoundLongitude:S(Ue),eastBoundLongitude:S(Ue),southBoundLatitude:S(Ue),northBoundLatitude:S(Ue)}),Nu=pt(mt,{GetCapabilities:S(gr),GetMap:S(gr),GetFeatureInfo:S(gr)}),Uu=pt(mt,{Format:St(G),DCPType:St(Tu)}),Fu=pt(mt,{HTTP:S(xu)}),Bu=pt(mt,{Get:S(Qt),Post:S(Qt)}),Xu=pt(mt,{Name:S(G),Title:S(G),Abstract:S(G),LegendURL:St(no),StyleSheetURL:S(Qt),StyleURL:S(Qt)}),Hu=pt(mt,{Format:S(G),OnlineResource:S(fr)}),Gu=pt(mt,{Keyword:to(G)});class ku{constructor(t,e){!e&&typeof window<"u"&&(e=window.DOMParser),this.version=void 0,this._parser=new Ql(e),this._data=t}data(t){return this._data=t,this}toJSON(t){return t=t||this._data,this.parse(t)}parse(t){return this.readFromDocument(this._parser.toDocument(t))}readFromDocument(t){for(let e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==yn.ELEMENT)return this.readFromNode(e);return null}readFromNode(t){return this.version=t.getAttribute("version"),dt({version:this.version},Su,t,[])||null}}async function Vu(n){let t=new URL(n),e=t.searchParams;e.set("SERVICE","WMS"),e.set("REQUEST","GetCapabilities");let i=t.toString();const r=await fetch(i);if(r.ok){const s=await r.text();return new ku(s).toJSON()}else throw new Error(`Error: ${r.status}`)}function pr(n){const t=/\b(?:wms|ows)\b/i,e=/{(?:z|x|y-?)}\/{(?:z|x|y-?)}\/{(?:z|x|y-?)}/i;return t.test(n)?"TileWMS":e.test(n)?"XYZ":!1}function ju(n){const e=/^(?:(?:https?|ftp):\/\/|\/\/)?(?:localhost|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|(?:\w+[\w-]*\.)+\w+)(?::\d+)?(?:\/\S*)?$/.test(n),i=pr(n);return!!(n&&e&&i)}function so(n){return n.replace(/(['"])?([a-zA-Z0-9_]+)(['"])?:/g,'"$2": ').replace(/,\s*}/g,"}").replace(/,\s*]/g,"]").replace(/\s*(\{|}|\[|\]|,)\s*/g,"$1").replaceAll('": //',"://")}function zu(n){try{return JSON.parse(so(n)),!!n}catch{return!1}}function Wu(n,t){const e=new URL(n).searchParams;Object.entries(t).forEach(([o,a])=>{typeof a=="object"&&!Array.isArray(a)&&a!==null?Object.keys(a).forEach(l=>{e.set(l,a[l])}):e.set(o,a)});const i=n.split("?")[0],r=e.toString();return`${i}?${r}`}/**!
41
41
  * Sortable 1.15.2
42
42
  * @author RubaXa <trash@rubaxa.org>
43
43
  * @author owenm <owen23355@gmail.com>
44
44
  * @license MIT
45
- */function bl(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,n)}return e}function _e(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?bl(Object(e),!0).forEach(function(n){Qd(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):bl(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function mr(i){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?mr=function(t){return typeof t}:mr=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mr(i)}function Qd(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Ae(){return Ae=Object.assign||function(i){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(i[n]=e[n])}return i},Ae.apply(this,arguments)}function tf(i,t){if(i==null)return{};var e={},n=Object.keys(i),r,s;for(s=0;s<n.length;s++)r=n[s],!(t.indexOf(r)>=0)&&(e[r]=i[r]);return e}function ef(i,t){if(i==null)return{};var e=tf(i,t),n,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(r=0;r<s.length;r++)n=s[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(i,n)&&(e[n]=i[n])}return e}var nf="1.15.2";function Me(i){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(i)}var De=Me(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Tn=Me(/Edge/i),wl=Me(/firefox/i),vn=Me(/safari/i)&&!Me(/chrome/i)&&!Me(/android/i),Sl=Me(/iP(ad|od|hone)/i),Rl=Me(/chrome/i)&&Me(/android/i),Cl={capture:!1,passive:!1};function it(i,t,e){i.addEventListener(t,e,!De&&Cl)}function K(i,t,e){i.removeEventListener(t,e,!De&&Cl)}function yr(i,t){if(t){if(t[0]===">"&&(t=t.substring(1)),i)try{if(i.matches)return i.matches(t);if(i.msMatchesSelector)return i.msMatchesSelector(t);if(i.webkitMatchesSelector)return i.webkitMatchesSelector(t)}catch{return!1}return!1}}function rf(i){return i.host&&i!==document&&i.host.nodeType?i.host:i.parentNode}function ue(i,t,e,n){if(i){e=e||document;do{if(t!=null&&(t[0]===">"?i.parentNode===e&&yr(i,t):yr(i,t))||n&&i===e)return i;if(i===e)break}while(i=rf(i))}return null}var Il=/\s+/g;function jt(i,t,e){if(i&&t)if(i.classList)i.classList[e?"add":"remove"](t);else{var n=(" "+i.className+" ").replace(Il," ").replace(" "+t+" "," ");i.className=(n+(e?" "+t:"")).replace(Il," ")}}function B(i,t,e){var n=i&&i.style;if(n){if(e===void 0)return document.defaultView&&document.defaultView.getComputedStyle?e=document.defaultView.getComputedStyle(i,""):i.currentStyle&&(e=i.currentStyle),t===void 0?e:e[t];!(t in n)&&t.indexOf("webkit")===-1&&(t="-webkit-"+t),n[t]=e+(typeof e=="string"?"":"px")}}function Li(i,t){var e="";if(typeof i=="string")e=i;else do{var n=B(i,"transform");n&&n!=="none"&&(e=n+" "+e)}while(!t&&(i=i.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(e)}function Al(i,t,e){if(i){var n=i.getElementsByTagName(t),r=0,s=n.length;if(e)for(;r<s;r++)e(n[r],r);return n}return[]}function me(){var i=document.scrollingElement;return i||document.documentElement}function xt(i,t,e,n,r){if(!(!i.getBoundingClientRect&&i!==window)){var s,o,a,l,h,c,u;if(i!==window&&i.parentNode&&i!==me()?(s=i.getBoundingClientRect(),o=s.top,a=s.left,l=s.bottom,h=s.right,c=s.height,u=s.width):(o=0,a=0,l=window.innerHeight,h=window.innerWidth,c=window.innerHeight,u=window.innerWidth),(t||e)&&i!==window&&(r=r||i.parentNode,!De))do if(r&&r.getBoundingClientRect&&(B(r,"transform")!=="none"||e&&B(r,"position")!=="static")){var d=r.getBoundingClientRect();o-=d.top+parseInt(B(r,"border-top-width")),a-=d.left+parseInt(B(r,"border-left-width")),l=o+s.height,h=a+s.width;break}while(r=r.parentNode);if(n&&i!==window){var f=Li(r||i),g=f&&f.a,p=f&&f.d;f&&(o/=p,a/=g,u/=g,c/=p,l=o+c,h=a+u)}return{top:o,left:a,bottom:l,right:h,width:u,height:c}}}function Ml(i,t,e){for(var n=Ve(i,!0),r=xt(i)[t];n;){var s=xt(n)[e],o=void 0;if(e==="top"||e==="left"?o=r>=s:o=r<=s,!o)return n;if(n===me())break;n=Ve(n,!1)}return!1}function Oi(i,t,e,n){for(var r=0,s=0,o=i.children;s<o.length;){if(o[s].style.display!=="none"&&o[s]!==U.ghost&&(n||o[s]!==U.dragged)&&ue(o[s],e.draggable,i,!1)){if(r===t)return o[s];r++}s++}return null}function ao(i,t){for(var e=i.lastElementChild;e&&(e===U.ghost||B(e,"display")==="none"||t&&!yr(e,t));)e=e.previousElementSibling;return e||null}function re(i,t){var e=0;if(!i||!i.parentNode)return-1;for(;i=i.previousElementSibling;)i.nodeName.toUpperCase()!=="TEMPLATE"&&i!==U.clone&&(!t||yr(i,t))&&e++;return e}function Dl(i){var t=0,e=0,n=me();if(i)do{var r=Li(i),s=r.a,o=r.d;t+=i.scrollLeft*s,e+=i.scrollTop*o}while(i!==n&&(i=i.parentNode));return[t,e]}function sf(i,t){for(var e in i)if(i.hasOwnProperty(e)){for(var n in t)if(t.hasOwnProperty(n)&&t[n]===i[e][n])return Number(e)}return-1}function Ve(i,t){if(!i||!i.getBoundingClientRect)return me();var e=i,n=!1;do if(e.clientWidth<e.scrollWidth||e.clientHeight<e.scrollHeight){var r=B(e);if(e.clientWidth<e.scrollWidth&&(r.overflowX=="auto"||r.overflowX=="scroll")||e.clientHeight<e.scrollHeight&&(r.overflowY=="auto"||r.overflowY=="scroll")){if(!e.getBoundingClientRect||e===document.body)return me();if(n||t)return e;n=!0}}while(e=e.parentNode);return me()}function of(i,t){if(i&&t)for(var e in t)t.hasOwnProperty(e)&&(i[e]=t[e]);return i}function lo(i,t){return Math.round(i.top)===Math.round(t.top)&&Math.round(i.left)===Math.round(t.left)&&Math.round(i.height)===Math.round(t.height)&&Math.round(i.width)===Math.round(t.width)}var bn;function Ll(i,t){return function(){if(!bn){var e=arguments,n=this;e.length===1?i.call(n,e[0]):i.apply(n,e),bn=setTimeout(function(){bn=void 0},t)}}}function af(){clearTimeout(bn),bn=void 0}function Ol(i,t,e){i.scrollLeft+=t,i.scrollTop+=e}function Pl(i){var t=window.Polymer,e=window.jQuery||window.Zepto;return t&&t.dom?t.dom(i).cloneNode(!0):e?e(i).clone(!0)[0]:i.cloneNode(!0)}function $l(i,t,e){var n={};return Array.from(i.children).forEach(function(r){var s,o,a,l;if(!(!ue(r,t.draggable,i,!1)||r.animated||r===e)){var h=xt(r);n.left=Math.min((s=n.left)!==null&&s!==void 0?s:1/0,h.left),n.top=Math.min((o=n.top)!==null&&o!==void 0?o:1/0,h.top),n.right=Math.max((a=n.right)!==null&&a!==void 0?a:-1/0,h.right),n.bottom=Math.max((l=n.bottom)!==null&&l!==void 0?l:-1/0,h.bottom)}}),n.width=n.right-n.left,n.height=n.bottom-n.top,n.x=n.left,n.y=n.top,n}var Zt="Sortable"+new Date().getTime();function lf(){var i=[],t;return{captureAnimationState:function(){if(i=[],!!this.options.animation){var n=[].slice.call(this.el.children);n.forEach(function(r){if(!(B(r,"display")==="none"||r===U.ghost)){i.push({target:r,rect:xt(r)});var s=_e({},i[i.length-1].rect);if(r.thisAnimationDuration){var o=Li(r,!0);o&&(s.top-=o.f,s.left-=o.e)}r.fromRect=s}})}},addAnimationState:function(n){i.push(n)},removeAnimationState:function(n){i.splice(sf(i,{target:n}),1)},animateAll:function(n){var r=this;if(!this.options.animation){clearTimeout(t),typeof n=="function"&&n();return}var s=!1,o=0;i.forEach(function(a){var l=0,h=a.target,c=h.fromRect,u=xt(h),d=h.prevFromRect,f=h.prevToRect,g=a.rect,p=Li(h,!0);p&&(u.top-=p.f,u.left-=p.e),h.toRect=u,h.thisAnimationDuration&&lo(d,u)&&!lo(c,u)&&(g.top-u.top)/(g.left-u.left)===(c.top-u.top)/(c.left-u.left)&&(l=cf(g,d,f,r.options)),lo(u,c)||(h.prevFromRect=c,h.prevToRect=u,l||(l=r.options.animation),r.animate(h,g,u,l)),l&&(s=!0,o=Math.max(o,l),clearTimeout(h.animationResetTimer),h.animationResetTimer=setTimeout(function(){h.animationTime=0,h.prevFromRect=null,h.fromRect=null,h.prevToRect=null,h.thisAnimationDuration=null},l),h.thisAnimationDuration=l)}),clearTimeout(t),s?t=setTimeout(function(){typeof n=="function"&&n()},o):typeof n=="function"&&n(),i=[]},animate:function(n,r,s,o){if(o){B(n,"transition",""),B(n,"transform","");var a=Li(this.el),l=a&&a.a,h=a&&a.d,c=(r.left-s.left)/(l||1),u=(r.top-s.top)/(h||1);n.animatingX=!!c,n.animatingY=!!u,B(n,"transform","translate3d("+c+"px,"+u+"px,0)"),this.forRepaintDummy=hf(n),B(n,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),B(n,"transform","translate3d(0,0,0)"),typeof n.animated=="number"&&clearTimeout(n.animated),n.animated=setTimeout(function(){B(n,"transition",""),B(n,"transform",""),n.animated=!1,n.animatingX=!1,n.animatingY=!1},o)}}}}function hf(i){return i.offsetWidth}function cf(i,t,e,n){return Math.sqrt(Math.pow(t.top-i.top,2)+Math.pow(t.left-i.left,2))/Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))*n.animation}var Pi=[],ho={initializeByDefault:!0},wn={mount:function(t){for(var e in ho)ho.hasOwnProperty(e)&&!(e in t)&&(t[e]=ho[e]);Pi.forEach(function(n){if(n.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")}),Pi.push(t)},pluginEvent:function(t,e,n){var r=this;this.eventCanceled=!1,n.cancel=function(){r.eventCanceled=!0};var s=t+"Global";Pi.forEach(function(o){e[o.pluginName]&&(e[o.pluginName][s]&&e[o.pluginName][s](_e({sortable:e},n)),e.options[o.pluginName]&&e[o.pluginName][t]&&e[o.pluginName][t](_e({sortable:e},n)))})},initializePlugins:function(t,e,n,r){Pi.forEach(function(a){var l=a.pluginName;if(!(!t.options[l]&&!a.initializeByDefault)){var h=new a(t,e,t.options);h.sortable=t,h.options=t.options,t[l]=h,Ae(n,h.defaults)}});for(var s in t.options)if(t.options.hasOwnProperty(s)){var o=this.modifyOption(t,s,t.options[s]);typeof o<"u"&&(t.options[s]=o)}},getEventProperties:function(t,e){var n={};return Pi.forEach(function(r){typeof r.eventProperties=="function"&&Ae(n,r.eventProperties.call(e[r.pluginName],t))}),n},modifyOption:function(t,e,n){var r;return Pi.forEach(function(s){t[s.pluginName]&&s.optionListeners&&typeof s.optionListeners[e]=="function"&&(r=s.optionListeners[e].call(t[s.pluginName],n))}),r}};function uf(i){var t=i.sortable,e=i.rootEl,n=i.name,r=i.targetEl,s=i.cloneEl,o=i.toEl,a=i.fromEl,l=i.oldIndex,h=i.newIndex,c=i.oldDraggableIndex,u=i.newDraggableIndex,d=i.originalEvent,f=i.putSortable,g=i.extraEventProperties;if(t=t||e&&e[Zt],!!t){var p,_=t.options,y="on"+n.charAt(0).toUpperCase()+n.substr(1);window.CustomEvent&&!De&&!Tn?p=new CustomEvent(n,{bubbles:!0,cancelable:!0}):(p=document.createEvent("Event"),p.initEvent(n,!0,!0)),p.to=o||e,p.from=a||e,p.item=r||e,p.clone=s,p.oldIndex=l,p.newIndex=h,p.oldDraggableIndex=c,p.newDraggableIndex=u,p.originalEvent=d,p.pullMode=f?f.lastPutMode:void 0;var m=_e(_e({},g),wn.getEventProperties(n,t));for(var x in m)p[x]=m[x];e&&e.dispatchEvent(p),_[y]&&_[y].call(t,p)}}var df=["evt"],Wt=function(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.evt,s=ef(n,df);wn.pluginEvent.bind(U)(t,e,_e({dragEl:C,parentEl:_t,ghostEl:G,rootEl:dt,nextEl:gi,lastDownEl:Er,cloneEl:pt,cloneHidden:Ye,dragStarted:Rn,putSortable:Dt,activeSortable:U.active,originalEvent:r,oldIndex:$i,oldDraggableIndex:Sn,newIndex:qt,newDraggableIndex:je,hideGhostForTarget:Gl,unhideGhostForTarget:Wl,cloneNowHidden:function(){Ye=!0},cloneNowShown:function(){Ye=!1},dispatchSortableEvent:function(a){Ut({sortable:e,name:a,originalEvent:r})}},s))};function Ut(i){uf(_e({putSortable:Dt,cloneEl:pt,targetEl:C,rootEl:dt,oldIndex:$i,oldDraggableIndex:Sn,newIndex:qt,newDraggableIndex:je},i))}var C,_t,G,dt,gi,Er,pt,Ye,$i,qt,Sn,je,xr,Dt,Ni=!1,Tr=!1,vr=[],pi,de,co,uo,Nl,kl,Rn,ki,Cn,In=!1,br=!1,wr,Nt,fo=[],go=!1,Sr=[],Rr=typeof document<"u",Cr=Sl,Fl=Tn||De?"cssFloat":"float",ff=Rr&&!Rl&&!Sl&&"draggable"in document.createElement("div"),Bl=function(){if(Rr){if(De)return!1;var i=document.createElement("x");return i.style.cssText="pointer-events:auto",i.style.pointerEvents==="auto"}}(),Ul=function(t,e){var n=B(t),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),s=Oi(t,0,e),o=Oi(t,1,e),a=s&&B(s),l=o&&B(o),h=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+xt(s).width,c=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+xt(o).width;if(n.display==="flex")return n.flexDirection==="column"||n.flexDirection==="column-reverse"?"vertical":"horizontal";if(n.display==="grid")return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(s&&a.float&&a.float!=="none"){var u=a.float==="left"?"left":"right";return o&&(l.clear==="both"||l.clear===u)?"vertical":"horizontal"}return s&&(a.display==="block"||a.display==="flex"||a.display==="table"||a.display==="grid"||h>=r&&n[Fl]==="none"||o&&n[Fl]==="none"&&h+c>r)?"vertical":"horizontal"},gf=function(t,e,n){var r=n?t.left:t.top,s=n?t.right:t.bottom,o=n?t.width:t.height,a=n?e.left:e.top,l=n?e.right:e.bottom,h=n?e.width:e.height;return r===a||s===l||r+o/2===a+h/2},pf=function(t,e){var n;return vr.some(function(r){var s=r[Zt].options.emptyInsertThreshold;if(!(!s||ao(r))){var o=xt(r),a=t>=o.left-s&&t<=o.right+s,l=e>=o.top-s&&e<=o.bottom+s;if(a&&l)return n=r}}),n},Xl=function(t){function e(s,o){return function(a,l,h,c){var u=a.options.group.name&&l.options.group.name&&a.options.group.name===l.options.group.name;if(s==null&&(o||u))return!0;if(s==null||s===!1)return!1;if(o&&s==="clone")return s;if(typeof s=="function")return e(s(a,l,h,c),o)(a,l,h,c);var d=(o?a:l).options.group.name;return s===!0||typeof s=="string"&&s===d||s.join&&s.indexOf(d)>-1}}var n={},r=t.group;(!r||mr(r)!="object")&&(r={name:r}),n.name=r.name,n.checkPull=e(r.pull,!0),n.checkPut=e(r.put),n.revertClone=r.revertClone,t.group=n},Gl=function(){!Bl&&G&&B(G,"display","none")},Wl=function(){!Bl&&G&&B(G,"display","")};Rr&&!Rl&&document.addEventListener("click",function(i){if(Tr)return i.preventDefault(),i.stopPropagation&&i.stopPropagation(),i.stopImmediatePropagation&&i.stopImmediatePropagation(),Tr=!1,!1},!0);var _i=function(t){if(C){t=t.touches?t.touches[0]:t;var e=pf(t.clientX,t.clientY);if(e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[Zt]._onDragOver(n)}}},_f=function(t){C&&C.parentNode[Zt]._isOutsideThisEl(t.target)};function U(i,t){if(!(i&&i.nodeType&&i.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(i));this.el=i,this.options=t=Ae({},t),i[Zt]=this;var e={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(i.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Ul(i,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(o,a){o.setData("Text",a.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:U.supportPointer!==!1&&"PointerEvent"in window&&!vn,emptyInsertThreshold:5};wn.initializePlugins(this,i,e);for(var n in e)!(n in t)&&(t[n]=e[n]);Xl(t);for(var r in this)r.charAt(0)==="_"&&typeof this[r]=="function"&&(this[r]=this[r].bind(this));this.nativeDraggable=t.forceFallback?!1:ff,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?it(i,"pointerdown",this._onTapStart):(it(i,"mousedown",this._onTapStart),it(i,"touchstart",this._onTapStart)),this.nativeDraggable&&(it(i,"dragover",this),it(i,"dragenter",this)),vr.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),Ae(this,lf())}U.prototype={constructor:U,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(ki=null)},_getDirection:function(t,e){return typeof this.options.direction=="function"?this.options.direction.call(this,t,e,C):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,n=this.el,r=this.options,s=r.preventOnFilter,o=t.type,a=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,l=(a||t).target,h=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||l,c=r.filter;if(wf(n),!C&&!(/mousedown|pointerdown/.test(o)&&t.button!==0||r.disabled)&&!h.isContentEditable&&!(!this.nativeDraggable&&vn&&l&&l.tagName.toUpperCase()==="SELECT")&&(l=ue(l,r.draggable,n,!1),!(l&&l.animated)&&Er!==l)){if($i=re(l),Sn=re(l,r.draggable),typeof c=="function"){if(c.call(this,t,l,this)){Ut({sortable:e,rootEl:h,name:"filter",targetEl:l,toEl:n,fromEl:n}),Wt("filter",e,{evt:t}),s&&t.cancelable&&t.preventDefault();return}}else if(c&&(c=c.split(",").some(function(u){if(u=ue(h,u.trim(),n,!1),u)return Ut({sortable:e,rootEl:u,name:"filter",targetEl:l,fromEl:n,toEl:n}),Wt("filter",e,{evt:t}),!0}),c)){s&&t.cancelable&&t.preventDefault();return}r.handle&&!ue(h,r.handle,n,!1)||this._prepareDragStart(t,a,l)}}},_prepareDragStart:function(t,e,n){var r=this,s=r.el,o=r.options,a=s.ownerDocument,l;if(n&&!C&&n.parentNode===s){var h=xt(n);if(dt=s,C=n,_t=C.parentNode,gi=C.nextSibling,Er=n,xr=o.group,U.dragged=C,pi={target:C,clientX:(e||t).clientX,clientY:(e||t).clientY},Nl=pi.clientX-h.left,kl=pi.clientY-h.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,C.style["will-change"]="all",l=function(){if(Wt("delayEnded",r,{evt:t}),U.eventCanceled){r._onDrop();return}r._disableDelayedDragEvents(),!wl&&r.nativeDraggable&&(C.draggable=!0),r._triggerDragStart(t,e),Ut({sortable:r,name:"choose",originalEvent:t}),jt(C,o.chosenClass,!0)},o.ignore.split(",").forEach(function(c){Al(C,c.trim(),po)}),it(a,"dragover",_i),it(a,"mousemove",_i),it(a,"touchmove",_i),it(a,"mouseup",r._onDrop),it(a,"touchend",r._onDrop),it(a,"touchcancel",r._onDrop),wl&&this.nativeDraggable&&(this.options.touchStartThreshold=4,C.draggable=!0),Wt("delayStart",this,{evt:t}),o.delay&&(!o.delayOnTouchOnly||e)&&(!this.nativeDraggable||!(Tn||De))){if(U.eventCanceled){this._onDrop();return}it(a,"mouseup",r._disableDelayedDrag),it(a,"touchend",r._disableDelayedDrag),it(a,"touchcancel",r._disableDelayedDrag),it(a,"mousemove",r._delayedDragTouchMoveHandler),it(a,"touchmove",r._delayedDragTouchMoveHandler),o.supportPointer&&it(a,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(l,o.delay)}else l()}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){C&&po(C),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;K(t,"mouseup",this._disableDelayedDrag),K(t,"touchend",this._disableDelayedDrag),K(t,"touchcancel",this._disableDelayedDrag),K(t,"mousemove",this._delayedDragTouchMoveHandler),K(t,"touchmove",this._delayedDragTouchMoveHandler),K(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||t.pointerType=="touch"&&t,!this.nativeDraggable||e?this.options.supportPointer?it(document,"pointermove",this._onTouchMove):e?it(document,"touchmove",this._onTouchMove):it(document,"mousemove",this._onTouchMove):(it(C,"dragend",this),it(dt,"dragstart",this._onDragStart));try{document.selection?Ar(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,e){if(Ni=!1,dt&&C){Wt("dragStarted",this,{evt:e}),this.nativeDraggable&&it(document,"dragover",_f);var n=this.options;!t&&jt(C,n.dragClass,!1),jt(C,n.ghostClass,!0),U.active=this,t&&this._appendGhost(),Ut({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(de){this._lastX=de.clientX,this._lastY=de.clientY,Gl();for(var t=document.elementFromPoint(de.clientX,de.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(de.clientX,de.clientY),t!==e);)e=t;if(C.parentNode[Zt]._isOutsideThisEl(t),e)do{if(e[Zt]){var n=void 0;if(n=e[Zt]._onDragOver({clientX:de.clientX,clientY:de.clientY,target:t,rootEl:e}),n&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);Wl()}},_onTouchMove:function(t){if(pi){var e=this.options,n=e.fallbackTolerance,r=e.fallbackOffset,s=t.touches?t.touches[0]:t,o=G&&Li(G,!0),a=G&&o&&o.a,l=G&&o&&o.d,h=Cr&&Nt&&Dl(Nt),c=(s.clientX-pi.clientX+r.x)/(a||1)+(h?h[0]-fo[0]:0)/(a||1),u=(s.clientY-pi.clientY+r.y)/(l||1)+(h?h[1]-fo[1]:0)/(l||1);if(!U.active&&!Ni){if(n&&Math.max(Math.abs(s.clientX-this._lastX),Math.abs(s.clientY-this._lastY))<n)return;this._onDragStart(t,!0)}if(G){o?(o.e+=c-(co||0),o.f+=u-(uo||0)):o={a:1,b:0,c:0,d:1,e:c,f:u};var d="matrix(".concat(o.a,",").concat(o.b,",").concat(o.c,",").concat(o.d,",").concat(o.e,",").concat(o.f,")");B(G,"webkitTransform",d),B(G,"mozTransform",d),B(G,"msTransform",d),B(G,"transform",d),co=c,uo=u,de=s}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!G){var t=this.options.fallbackOnBody?document.body:dt,e=xt(C,!0,Cr,!0,t),n=this.options;if(Cr){for(Nt=t;B(Nt,"position")==="static"&&B(Nt,"transform")==="none"&&Nt!==document;)Nt=Nt.parentNode;Nt!==document.body&&Nt!==document.documentElement?(Nt===document&&(Nt=me()),e.top+=Nt.scrollTop,e.left+=Nt.scrollLeft):Nt=me(),fo=Dl(Nt)}G=C.cloneNode(!0),jt(G,n.ghostClass,!1),jt(G,n.fallbackClass,!0),jt(G,n.dragClass,!0),B(G,"transition",""),B(G,"transform",""),B(G,"box-sizing","border-box"),B(G,"margin",0),B(G,"top",e.top),B(G,"left",e.left),B(G,"width",e.width),B(G,"height",e.height),B(G,"opacity","0.8"),B(G,"position",Cr?"absolute":"fixed"),B(G,"zIndex","100000"),B(G,"pointerEvents","none"),U.ghost=G,t.appendChild(G),B(G,"transform-origin",Nl/parseInt(G.style.width)*100+"% "+kl/parseInt(G.style.height)*100+"%")}},_onDragStart:function(t,e){var n=this,r=t.dataTransfer,s=n.options;if(Wt("dragStart",this,{evt:t}),U.eventCanceled){this._onDrop();return}Wt("setupClone",this),U.eventCanceled||(pt=Pl(C),pt.removeAttribute("id"),pt.draggable=!1,pt.style["will-change"]="",this._hideClone(),jt(pt,this.options.chosenClass,!1),U.clone=pt),n.cloneId=Ar(function(){Wt("clone",n),!U.eventCanceled&&(n.options.removeCloneOnHide||dt.insertBefore(pt,C),n._hideClone(),Ut({sortable:n,name:"clone"}))}),!e&&jt(C,s.dragClass,!0),e?(Tr=!0,n._loopId=setInterval(n._emulateDragOver,50)):(K(document,"mouseup",n._onDrop),K(document,"touchend",n._onDrop),K(document,"touchcancel",n._onDrop),r&&(r.effectAllowed="move",s.setData&&s.setData.call(n,r,C)),it(document,"drop",n),B(C,"transform","translateZ(0)")),Ni=!0,n._dragStartId=Ar(n._dragStarted.bind(n,e,t)),it(document,"selectstart",n),Rn=!0,vn&&B(document.body,"user-select","none")},_onDragOver:function(t){var e=this.el,n=t.target,r,s,o,a=this.options,l=a.group,h=U.active,c=xr===l,u=a.sort,d=Dt||h,f,g=this,p=!1;if(go)return;function _(j,ct){Wt(j,g,_e({evt:t,isOwner:c,axis:f?"vertical":"horizontal",revert:o,dragRect:r,targetRect:s,canSort:u,fromSortable:d,target:n,completed:m,onMove:function(lt,ft){return Ir(dt,e,C,r,lt,xt(lt),t,ft)},changed:x},ct))}function y(){_("dragOverAnimationCapture"),g.captureAnimationState(),g!==d&&d.captureAnimationState()}function m(j){return _("dragOverCompleted",{insertion:j}),j&&(c?h._hideClone():h._showClone(g),g!==d&&(jt(C,Dt?Dt.options.ghostClass:h.options.ghostClass,!1),jt(C,a.ghostClass,!0)),Dt!==g&&g!==U.active?Dt=g:g===U.active&&Dt&&(Dt=null),d===g&&(g._ignoreWhileAnimating=n),g.animateAll(function(){_("dragOverAnimationComplete"),g._ignoreWhileAnimating=null}),g!==d&&(d.animateAll(),d._ignoreWhileAnimating=null)),(n===C&&!C.animated||n===e&&!n.animated)&&(ki=null),!a.dragoverBubble&&!t.rootEl&&n!==document&&(C.parentNode[Zt]._isOutsideThisEl(t.target),!j&&_i(t)),!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),p=!0}function x(){qt=re(C),je=re(C,a.draggable),Ut({sortable:g,name:"change",toEl:e,newIndex:qt,newDraggableIndex:je,originalEvent:t})}if(t.preventDefault!==void 0&&t.cancelable&&t.preventDefault(),n=ue(n,a.draggable,e,!0),_("dragOver"),U.eventCanceled)return p;if(C.contains(t.target)||n.animated&&n.animatingX&&n.animatingY||g._ignoreWhileAnimating===n)return m(!1);if(Tr=!1,h&&!a.disabled&&(c?u||(o=_t!==dt):Dt===this||(this.lastPutMode=xr.checkPull(this,h,C,t))&&l.checkPut(this,h,C,t))){if(f=this._getDirection(t,n)==="vertical",r=xt(C),_("dragOverValid"),U.eventCanceled)return p;if(o)return _t=dt,y(),this._hideClone(),_("revert"),U.eventCanceled||(gi?dt.insertBefore(C,gi):dt.appendChild(C)),m(!0);var E=ao(e,a.draggable);if(!E||xf(t,f,this)&&!E.animated){if(E===C)return m(!1);if(E&&e===t.target&&(n=E),n&&(s=xt(n)),Ir(dt,e,C,r,n,s,t,!!n)!==!1)return y(),E&&E.nextSibling?e.insertBefore(C,E.nextSibling):e.appendChild(C),_t=e,x(),m(!0)}else if(E&&Ef(t,f,this)){var T=Oi(e,0,a,!0);if(T===C)return m(!1);if(n=T,s=xt(n),Ir(dt,e,C,r,n,s,t,!1)!==!1)return y(),e.insertBefore(C,T),_t=e,x(),m(!0)}else if(n.parentNode===e){s=xt(n);var b=0,w,S=C.parentNode!==e,R=!gf(C.animated&&C.toRect||r,n.animated&&n.toRect||s,f),P=f?"top":"left",M=Ml(n,"top","top")||Ml(C,"top","top"),D=M?M.scrollTop:void 0;ki!==n&&(w=s[P],In=!1,br=!R&&a.invertSwap||S),b=Tf(t,n,s,f,R?1:a.swapThreshold,a.invertedSwapThreshold==null?a.swapThreshold:a.invertedSwapThreshold,br,ki===n);var k;if(b!==0){var L=re(C);do L-=b,k=_t.children[L];while(k&&(B(k,"display")==="none"||k===G))}if(b===0||k===n)return m(!1);ki=n,Cn=b;var F=n.nextElementSibling,A=!1;A=b===1;var Y=Ir(dt,e,C,r,n,s,t,A);if(Y!==!1)return(Y===1||Y===-1)&&(A=Y===1),go=!0,setTimeout(yf,30),y(),A&&!F?e.appendChild(C):n.parentNode.insertBefore(C,A?F:n),M&&Ol(M,0,D-M.scrollTop),_t=C.parentNode,w!==void 0&&!br&&(wr=Math.abs(w-xt(n)[P])),x(),m(!0)}if(e.contains(C))return m(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){K(document,"mousemove",this._onTouchMove),K(document,"touchmove",this._onTouchMove),K(document,"pointermove",this._onTouchMove),K(document,"dragover",_i),K(document,"mousemove",_i),K(document,"touchmove",_i)},_offUpEvents:function(){var t=this.el.ownerDocument;K(t,"mouseup",this._onDrop),K(t,"touchend",this._onDrop),K(t,"pointerup",this._onDrop),K(t,"touchcancel",this._onDrop),K(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;if(qt=re(C),je=re(C,n.draggable),Wt("drop",this,{evt:t}),_t=C&&C.parentNode,qt=re(C),je=re(C,n.draggable),U.eventCanceled){this._nulling();return}Ni=!1,br=!1,In=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),_o(this.cloneId),_o(this._dragStartId),this.nativeDraggable&&(K(document,"drop",this),K(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),vn&&B(document.body,"user-select",""),B(C,"transform",""),t&&(Rn&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),G&&G.parentNode&&G.parentNode.removeChild(G),(dt===_t||Dt&&Dt.lastPutMode!=="clone")&&pt&&pt.parentNode&&pt.parentNode.removeChild(pt),C&&(this.nativeDraggable&&K(C,"dragend",this),po(C),C.style["will-change"]="",Rn&&!Ni&&jt(C,Dt?Dt.options.ghostClass:this.options.ghostClass,!1),jt(C,this.options.chosenClass,!1),Ut({sortable:this,name:"unchoose",toEl:_t,newIndex:null,newDraggableIndex:null,originalEvent:t}),dt!==_t?(qt>=0&&(Ut({rootEl:_t,name:"add",toEl:_t,fromEl:dt,originalEvent:t}),Ut({sortable:this,name:"remove",toEl:_t,originalEvent:t}),Ut({rootEl:_t,name:"sort",toEl:_t,fromEl:dt,originalEvent:t}),Ut({sortable:this,name:"sort",toEl:_t,originalEvent:t})),Dt&&Dt.save()):qt!==$i&&qt>=0&&(Ut({sortable:this,name:"update",toEl:_t,originalEvent:t}),Ut({sortable:this,name:"sort",toEl:_t,originalEvent:t})),U.active&&((qt==null||qt===-1)&&(qt=$i,je=Sn),Ut({sortable:this,name:"end",toEl:_t,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){Wt("nulling",this),dt=C=_t=G=gi=pt=Er=Ye=pi=de=Rn=qt=je=$i=Sn=ki=Cn=Dt=xr=U.dragged=U.ghost=U.clone=U.active=null,Sr.forEach(function(t){t.checked=!0}),Sr.length=co=uo=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":C&&(this._onDragOver(t),mf(t));break;case"selectstart":t.preventDefault();break}},toArray:function(){for(var t=[],e,n=this.el.children,r=0,s=n.length,o=this.options;r<s;r++)e=n[r],ue(e,o.draggable,this.el,!1)&&t.push(e.getAttribute(o.dataIdAttr)||bf(e));return t},sort:function(t,e){var n={},r=this.el;this.toArray().forEach(function(s,o){var a=r.children[o];ue(a,this.options.draggable,r,!1)&&(n[s]=a)},this),e&&this.captureAnimationState(),t.forEach(function(s){n[s]&&(r.removeChild(n[s]),r.appendChild(n[s]))}),e&&this.animateAll()},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,e){return ue(t,e||this.options.draggable,this.el,!1)},option:function(t,e){var n=this.options;if(e===void 0)return n[t];var r=wn.modifyOption(this,t,e);typeof r<"u"?n[t]=r:n[t]=e,t==="group"&&Xl(n)},destroy:function(){Wt("destroy",this);var t=this.el;t[Zt]=null,K(t,"mousedown",this._onTapStart),K(t,"touchstart",this._onTapStart),K(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(K(t,"dragover",this),K(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(e){e.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),vr.splice(vr.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!Ye){if(Wt("hideClone",this),U.eventCanceled)return;B(pt,"display","none"),this.options.removeCloneOnHide&&pt.parentNode&&pt.parentNode.removeChild(pt),Ye=!0}},_showClone:function(t){if(t.lastPutMode!=="clone"){this._hideClone();return}if(Ye){if(Wt("showClone",this),U.eventCanceled)return;C.parentNode==dt&&!this.options.group.revertClone?dt.insertBefore(pt,C):gi?dt.insertBefore(pt,gi):dt.appendChild(pt),this.options.group.revertClone&&this.animate(C,pt),B(pt,"display",""),Ye=!1}}};function mf(i){i.dataTransfer&&(i.dataTransfer.dropEffect="move"),i.cancelable&&i.preventDefault()}function Ir(i,t,e,n,r,s,o,a){var l,h=i[Zt],c=h.options.onMove,u;return window.CustomEvent&&!De&&!Tn?l=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(l=document.createEvent("Event"),l.initEvent("move",!0,!0)),l.to=t,l.from=i,l.dragged=e,l.draggedRect=n,l.related=r||t,l.relatedRect=s||xt(t),l.willInsertAfter=a,l.originalEvent=o,i.dispatchEvent(l),c&&(u=c.call(h,l,o)),u}function po(i){i.draggable=!1}function yf(){go=!1}function Ef(i,t,e){var n=xt(Oi(e.el,0,e.options,!0)),r=$l(e.el,e.options,G),s=10;return t?i.clientX<r.left-s||i.clientY<n.top&&i.clientX<n.right:i.clientY<r.top-s||i.clientY<n.bottom&&i.clientX<n.left}function xf(i,t,e){var n=xt(ao(e.el,e.options.draggable)),r=$l(e.el,e.options,G),s=10;return t?i.clientX>r.right+s||i.clientY>n.bottom&&i.clientX>n.left:i.clientY>r.bottom+s||i.clientX>n.right&&i.clientY>n.top}function Tf(i,t,e,n,r,s,o,a){var l=n?i.clientY:i.clientX,h=n?e.height:e.width,c=n?e.top:e.left,u=n?e.bottom:e.right,d=!1;if(!o){if(a&&wr<h*r){if(!In&&(Cn===1?l>c+h*s/2:l<u-h*s/2)&&(In=!0),In)d=!0;else if(Cn===1?l<c+wr:l>u-wr)return-Cn}else if(l>c+h*(1-r)/2&&l<u-h*(1-r)/2)return vf(t)}return d=d||o,d&&(l<c+h*s/2||l>u-h*s/2)?l>c+h/2?1:-1:0}function vf(i){return re(C)<re(i)?1:-1}function bf(i){for(var t=i.tagName+i.className+i.src+i.href+i.textContent,e=t.length,n=0;e--;)n+=t.charCodeAt(e);return n.toString(36)}function wf(i){Sr.length=0;for(var t=i.getElementsByTagName("input"),e=t.length;e--;){var n=t[e];n.checked&&Sr.push(n)}}function Ar(i){return setTimeout(i,0)}function _o(i){return clearTimeout(i)}Rr&&it(document,"touchmove",function(i){(U.active||Ni)&&i.cancelable&&i.preventDefault()}),U.utils={on:it,off:K,css:B,find:Al,is:function(t,e){return!!ue(t,e,t,!1)},extend:of,throttle:Ll,closest:ue,toggleClass:jt,clone:Pl,index:re,nextTick:Ar,cancelNextTick:_o,detectDirection:Ul,getChild:Oi},U.get=function(i){return i[Zt]},U.mount=function(){for(var i=arguments.length,t=new Array(i),e=0;e<i;e++)t[e]=arguments[e];t[0].constructor===Array&&(t=t[0]),t.forEach(function(n){if(!n.prototype||!n.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(n));n.utils&&(U.utils=_e(_e({},U.utils),n.utils)),wn.mount(n)})},U.create=function(i,t){return new U(i,t)},U.version=nf;var Tt=[],An,mo,yo=!1,Eo,xo,Mr,Mn;function Sf(){function i(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var t in this)t.charAt(0)==="_"&&typeof this[t]=="function"&&(this[t]=this[t].bind(this))}return i.prototype={dragStarted:function(e){var n=e.originalEvent;this.sortable.nativeDraggable?it(document,"dragover",this._handleAutoScroll):this.options.supportPointer?it(document,"pointermove",this._handleFallbackAutoScroll):n.touches?it(document,"touchmove",this._handleFallbackAutoScroll):it(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var n=e.originalEvent;!this.options.dragOverBubble&&!n.rootEl&&this._handleAutoScroll(n)},drop:function(){this.sortable.nativeDraggable?K(document,"dragover",this._handleAutoScroll):(K(document,"pointermove",this._handleFallbackAutoScroll),K(document,"touchmove",this._handleFallbackAutoScroll),K(document,"mousemove",this._handleFallbackAutoScroll)),Hl(),Dr(),af()},nulling:function(){Mr=mo=An=yo=Mn=Eo=xo=null,Tt.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,n){var r=this,s=(e.touches?e.touches[0]:e).clientX,o=(e.touches?e.touches[0]:e).clientY,a=document.elementFromPoint(s,o);if(Mr=e,n||this.options.forceAutoScrollFallback||Tn||De||vn){To(e,this.options,a,n);var l=Ve(a,!0);yo&&(!Mn||s!==Eo||o!==xo)&&(Mn&&Hl(),Mn=setInterval(function(){var h=Ve(document.elementFromPoint(s,o),!0);h!==l&&(l=h,Dr()),To(e,r.options,h,n)},10),Eo=s,xo=o)}else{if(!this.options.bubbleScroll||Ve(a,!0)===me()){Dr();return}To(e,this.options,Ve(a,!1),!1)}}},Ae(i,{pluginName:"scroll",initializeByDefault:!0})}function Dr(){Tt.forEach(function(i){clearInterval(i.pid)}),Tt=[]}function Hl(){clearInterval(Mn)}var To=Ll(function(i,t,e,n){if(t.scroll){var r=(i.touches?i.touches[0]:i).clientX,s=(i.touches?i.touches[0]:i).clientY,o=t.scrollSensitivity,a=t.scrollSpeed,l=me(),h=!1,c;mo!==e&&(mo=e,Dr(),An=t.scroll,c=t.scrollFn,An===!0&&(An=Ve(e,!0)));var u=0,d=An;do{var f=d,g=xt(f),p=g.top,_=g.bottom,y=g.left,m=g.right,x=g.width,E=g.height,T=void 0,b=void 0,w=f.scrollWidth,S=f.scrollHeight,R=B(f),P=f.scrollLeft,M=f.scrollTop;f===l?(T=x<w&&(R.overflowX==="auto"||R.overflowX==="scroll"||R.overflowX==="visible"),b=E<S&&(R.overflowY==="auto"||R.overflowY==="scroll"||R.overflowY==="visible")):(T=x<w&&(R.overflowX==="auto"||R.overflowX==="scroll"),b=E<S&&(R.overflowY==="auto"||R.overflowY==="scroll"));var D=T&&(Math.abs(m-r)<=o&&P+x<w)-(Math.abs(y-r)<=o&&!!P),k=b&&(Math.abs(_-s)<=o&&M+E<S)-(Math.abs(p-s)<=o&&!!M);if(!Tt[u])for(var L=0;L<=u;L++)Tt[L]||(Tt[L]={});(Tt[u].vx!=D||Tt[u].vy!=k||Tt[u].el!==f)&&(Tt[u].el=f,Tt[u].vx=D,Tt[u].vy=k,clearInterval(Tt[u].pid),(D!=0||k!=0)&&(h=!0,Tt[u].pid=setInterval((function(){n&&this.layer===0&&U.active._onTouchMove(Mr);var F=Tt[this.layer].vy?Tt[this.layer].vy*a:0,A=Tt[this.layer].vx?Tt[this.layer].vx*a:0;typeof c=="function"&&c.call(U.dragged.parentNode[Zt],A,F,i,Mr,Tt[this.layer].el)!=="continue"||Ol(Tt[this.layer].el,A,F)}).bind({layer:u}),24))),u++}while(t.bubbleScroll&&d!==l&&(d=Ve(d,!1)));yo=h}},30),zl=function(t){var e=t.originalEvent,n=t.putSortable,r=t.dragEl,s=t.activeSortable,o=t.dispatchSortableEvent,a=t.hideGhostForTarget,l=t.unhideGhostForTarget;if(e){var h=n||s;a();var c=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e,u=document.elementFromPoint(c.clientX,c.clientY);l(),h&&!h.el.contains(u)&&(o("spill"),this.onSpill({dragEl:r,putSortable:n}))}};function vo(){}vo.prototype={startIndex:null,dragStart:function(t){var e=t.oldDraggableIndex;this.startIndex=e},onSpill:function(t){var e=t.dragEl,n=t.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var r=Oi(this.sortable.el,this.startIndex,this.options);r?this.sortable.el.insertBefore(e,r):this.sortable.el.appendChild(e),this.sortable.animateAll(),n&&n.animateAll()},drop:zl},Ae(vo,{pluginName:"revertOnSpill"});function bo(){}bo.prototype={onSpill:function(t){var e=t.dragEl,n=t.putSortable,r=n||this.sortable;r.captureAnimationState(),e.parentNode&&e.parentNode.removeChild(e),r.animateAll()},drop:zl},Ae(bo,{pluginName:"removeOnSpill"}),U.mount(new Sf),U.mount(bo,vo);const Rf=i=>{const t=i.item;let e=Array.prototype.slice.call(t.parentNode.childNodes);return e=e.filter(n=>n.nodeType!=Node.ELEMENT_NODE||!n.classList.contains("sortable-fallback")),e},Cf=(i,t,e,n,r,s)=>{const a=i.item.parentNode;for(const p of e)a.appendChild(p);if(i.oldIndex==i.newIndex)return;const l=n.getArray(),h=i.item.querySelector("eox-layercontrol-layer").layer.get(r),c=l.find(p=>p.get(r)===h),u=s.dataset.layer,d=l.find(p=>p.get(r)==u);let f,g;for(f=0;f<l.length;f++)if(l[f]==c){n.removeAt(f);break}for(g=0;g<l.length;g++)if(l[g]===d){f>g?n.insertAt(g,c):n.insertAt(g+1,c);break}t.requestUpdate()};function If(i,t,e,n){let r=[],s=null;i._sortable=U.create(i,{handle:".drag-handle",filter:".drag-handle.disabled",swapThreshold:.5,animation:150,easing:"cubic-bezier(1, 0, 0, 1)",onStart:o=>r=Rf(o),onMove:o=>{s=o.related},onEnd:o=>Cf(o,n,r,t,e,s)})}function Af(i,t,e,n){const r=i.getArray();let s=!1;r.forEach(o=>{const a=o.ol_uid;o.get(t)||(o.set(t,a),s=!0),o.get(e)||(o.set(e,`layer ${a}`),s=!0),s&&n.requestUpdate()})}function wo(i,t,e){let n=[];const r=(s,o,a)=>{n=[...n,...s.filter(h=>h.get(o)===a)];const l=s.filter(h=>h.getLayers);return l.length>0&&l.forEach(h=>r(h.getLayers().getArray(),o,a)),n};return r(i,t,e),n}function Mf(i,t,e){if(!i||!t)return!1;if(!Vl(i,e))return!0;const n=i.get("minZoom"),r=i.get("maxZoom"),s=t.getView().getZoom();return s>n&&s<r}function Vl(i,t){const e=i.get("minZoom"),n=i.get("maxZoom");return!!(t&&(e!==-1/0||n!==1/0))}function Df(i,t){var r,s,o;return!i||!t?void 0:i.getLayers?"group":((o=(r=t.getInteractions().getArray().filter(a=>a.freehand_!==void 0).map(a=>a.source_))==null?void 0:r.ol_uid)==null?void 0:o.includes(i.getSource?(s=i.getSource())==null?void 0:s.ol_uid:void 0))?"draw":i.declutter_!==void 0?"vector":"raster"}class So{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}const Lf={PROPERTYCHANGE:"propertychange"};class Yl{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function Fi(i,t){return i>t?1:i<t?-1:0}function Of(i,t){return i<t?1:i>t?-1:0}function jl(i,t,e){if(i[0]<=t)return 0;const n=i.length;if(t<=i[n-1])return n-1;if(typeof e=="function"){for(let r=1;r<n;++r){const s=i[r];if(s===t)return r;if(s<t)return e(t,i[r-1],s)>0?r-1:r}return n-1}if(e>0){for(let r=1;r<n;++r)if(i[r]<t)return r-1;return n-1}if(e<0){for(let r=1;r<n;++r)if(i[r]<=t)return r;return n-1}for(let r=1;r<n;++r){if(i[r]==t)return r;if(i[r]<t)return i[r-1]-t<t-i[r]?r-1:r}return n-1}function Pf(i,t,e){for(;t<e;){const n=i[t];i[t]=i[e],i[e]=n,++t,--e}}function $f(i,t){const e=Array.isArray(t)?t:[t],n=e.length;for(let r=0;r<n;r++)i[i.length]=e[r]}function Bi(i,t){const e=i.length;if(e!==t.length)return!1;for(let n=0;n<e;n++)if(i[n]!==t[n])return!1;return!0}function Ro(){}function Nf(i){let t=!1,e,n,r;return function(){const s=Array.prototype.slice.call(arguments);return(!t||this!==r||!Bi(s,n))&&(t=!0,r=this,n=s,e=i.apply(this,arguments)),e}}function Lr(i){for(const t in i)delete i[t]}function Co(i){let t;for(t in i)return!1;return!t}class Or extends Yl{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const n=this.listeners_||(this.listeners_={}),r=n[t]||(n[t]=[]);r.includes(e)||r.push(e)}dispatchEvent(t){const e=typeof t=="string",n=e?t:t.type,r=this.listeners_&&this.listeners_[n];if(!r)return;const s=e?new So(t):t;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 h=0,c=r.length;h<c;++h)if("handleEvent"in r[h]?l=r[h].handleEvent(s):l=r[h].call(this,s),l===!1||s.propagationStopped){l=!1;break}if(--o[n]===0){let h=a[n];for(delete a[n];h--;)this.removeEventListener(n,Ro);delete o[n]}return l}disposeInternal(){this.listeners_&&Lr(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return this.listeners_?t?t in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(t,e){if(!this.listeners_)return;const n=this.listeners_[t];if(!n)return;const r=n.indexOf(e);r!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(n[r]=Ro,++this.pendingRemovals_[t]):(n.splice(r,1),n.length===0&&delete this.listeners_[t]))}}const wt={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function Ze(i,t,e,n,r){if(n&&n!==i&&(e=e.bind(n)),r){const o=e;e=function(){i.removeEventListener(t,e),o.apply(this,arguments)}}const s={target:i,type:t,listener:e};return i.addEventListener(t,e),s}function Pr(i,t,e,n){return Ze(i,t,e,n,!0)}function ye(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),Lr(i))}class Dn extends Or{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(wt.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const n=t.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Ze(this,t[s],e);return r}return Ze(this,t,e)}onceInternal(t,e){let n;if(Array.isArray(t)){const r=t.length;n=new Array(r);for(let s=0;s<r;++s)n[s]=Pr(this,t[s],e)}else n=Pr(this,t,e);return e.ol_key=n,n}unInternal(t,e){const n=e.ol_key;if(n)kf(n);else if(Array.isArray(t))for(let r=0,s=t.length;r<s;++r)this.removeEventListener(t[r],e);else this.removeEventListener(t,e)}}Dn.prototype.on,Dn.prototype.once,Dn.prototype.un;function kf(i){if(Array.isArray(i))for(let t=0,e=i.length;t<e;++t)ye(i[t]);else ye(i)}function nt(){throw new Error("Unimplemented abstract method.")}let Ff=0;function kt(i){return i.ol_uid||(i.ol_uid=String(++Ff))}class Zl extends So{constructor(t,e,n){super(t),this.key=e,this.oldValue=n}}class $r extends Dn{constructor(t){super(),this.on,this.once,this.un,kt(this),this.values_=null,t!==void 0&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let n;n=`change:${t}`,this.hasListener(n)&&this.dispatchEvent(new Zl(n,t,e)),n=Lf.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new Zl(n,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,n){const r=this.values_||(this.values_={});if(n)r[t]=e;else{const s=r[t];r[t]=e,s!==e&&this.notify(t,s)}}setProperties(t,e){for(const n in t)this.set(n,t[n],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const n=this.values_[t];delete this.values_[t],Co(this.values_)&&(this.values_=null),e||this.notify(t,n)}}}const rt={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};function Lt(i,t){if(!i)throw new Error(t)}function vt(i,t,e){return Math.min(Math.max(i,t),e)}function Bf(i,t,e,n,r,s){const o=r-e,a=s-n;if(o!==0||a!==0){const l=((i-e)*o+(t-n)*a)/(o*o+a*a);l>1?(e=r,n=s):l>0&&(e+=o*l,n+=a*l)}return Ui(i,t,e,n)}function Ui(i,t,e,n){const r=e-i,s=n-t;return r*r+s*s}function Uf(i){const t=i.length;for(let n=0;n<t;n++){let r=n,s=Math.abs(i[n][n]);for(let a=n+1;a<t;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<t;a++){const l=-i[a][n]/i[n][n];for(let h=n;h<t+1;h++)n==h?i[a][h]=0:i[a][h]+=l*i[n][h]}}const e=new Array(t);for(let n=t-1;n>=0;n--){e[n]=i[n][t]/i[n][n];for(let r=n-1;r>=0;r--)i[r][t]-=i[r][n]*e[n]}return e}function Nr(i){return i*Math.PI/180}function Ln(i,t){const e=i%t;return e*t<0?e+t:e}function fe(i,t,e){return i+e*(t-i)}function Xf(i,t){const e=Math.pow(10,t);return Math.round(i*e)/e}class Gf extends $r{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);typeof t.properties=="object"&&(delete e.properties,Object.assign(e,t.properties)),e[rt.OPACITY]=t.opacity!==void 0?t.opacity:1,Lt(typeof e[rt.OPACITY]=="number","Layer opacity must be a number"),e[rt.VISIBLE]=t.visible!==void 0?t.visible:!0,e[rt.Z_INDEX]=t.zIndex,e[rt.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[rt.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[rt.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[rt.MAX_ZOOM]=t.maxZoom!==void 0?t.maxZoom:1/0,this.className_=e.className!==void 0?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:t===void 0?!0:t},n=this.getZIndex();return e.opacity=vt(Math.round(this.getOpacity()*100)/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=n===void 0&&!e.managed?1/0:n,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return nt()}getLayerStatesArray(t){return nt()}getExtent(){return this.get(rt.EXTENT)}getMaxResolution(){return this.get(rt.MAX_RESOLUTION)}getMinResolution(){return this.get(rt.MIN_RESOLUTION)}getMinZoom(){return this.get(rt.MIN_ZOOM)}getMaxZoom(){return this.get(rt.MAX_ZOOM)}getOpacity(){return this.get(rt.OPACITY)}getSourceState(){return nt()}getVisible(){return this.get(rt.VISIBLE)}getZIndex(){return this.get(rt.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(rt.EXTENT,t)}setMaxResolution(t){this.set(rt.MAX_RESOLUTION,t)}setMinResolution(t){this.set(rt.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(rt.MAX_ZOOM,t)}setMinZoom(t){this.set(rt.MIN_ZOOM,t)}setOpacity(t){Lt(typeof t=="number","Layer opacity must be a number"),this.set(rt.OPACITY,t)}setVisible(t){this.set(rt.VISIBLE,t)}setZIndex(t){this.set(rt.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}const Kt={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"},se={ANIMATING:0,INTERACTING:1},ge={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"},Wf=256,kr={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class ql{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=t.extent!==void 0?t.extent:null,this.worldExtent_=t.worldExtent!==void 0?t.worldExtent:null,this.axisOrientation_=t.axisOrientation!==void 0?t.axisOrientation:"enu",this.global_=t.global!==void 0?t.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||kr[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!!(t&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!!(this.global_&&t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const On=6378137,Xi=Math.PI*On,Hf=[-Xi,-Xi,Xi,Xi],zf=[-180,-85,180,85],Fr=On*Math.log(Math.tan(Math.PI/2));class Gi extends ql{constructor(t){super({code:t,units:"m",extent:Hf,global:!0,worldExtent:zf,getPointResolution:function(e,n){return e/Math.cosh(n[1]/On)}})}}const Kl=[new Gi("EPSG:3857"),new Gi("EPSG:102100"),new Gi("EPSG:102113"),new Gi("EPSG:900913"),new Gi("http://www.opengis.net/def/crs/EPSG/0/3857"),new Gi("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Vf(i,t,e){const n=i.length;e=e>1?e:2,t===void 0&&(e>2?t=i.slice():t=new Array(n));for(let r=0;r<n;r+=e){t[r]=Xi*i[r]/180;let s=On*Math.log(Math.tan(Math.PI*(+i[r+1]+90)/360));s>Fr?s=Fr:s<-Fr&&(s=-Fr),t[r+1]=s}return t}function Yf(i,t,e){const n=i.length;e=e>1?e:2,t===void 0&&(e>2?t=i.slice():t=new Array(n));for(let r=0;r<n;r+=e)t[r]=180*i[r]/Xi,t[r+1]=360*Math.atan(Math.exp(i[r+1]/On))/Math.PI-90;return t}const jf=6378137,Jl=[-180,-90,180,90],Zf=Math.PI*jf/180;class mi extends ql{constructor(t,e){super({code:t,units:"degrees",extent:Jl,axisOrientation:e,global:!0,metersPerUnit:Zf,worldExtent:Jl})}}const Ql=[new mi("CRS:84"),new mi("EPSG:4326","neu"),new mi("urn:ogc:def:crs:OGC:1.3:CRS84"),new mi("urn:ogc:def:crs:OGC:2:84"),new mi("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new mi("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new mi("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Io={};function qf(i){return Io[i]||Io[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function Kf(i,t){Io[i]=t}let Wi={};function Br(i,t,e){const n=i.getCode(),r=t.getCode();n in Wi||(Wi[n]={}),Wi[n][r]=e}function Jf(i,t){let e;return i in Wi&&t in Wi[i]&&(e=Wi[i][t]),e}const Ct={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Ao(i){const t=Ee();for(let e=0,n=i.length;e<n;++e)Nn(t,i[e]);return t}function Mo(i,t,e){return e?(e[0]=i[0]-t,e[1]=i[1]-t,e[2]=i[2]+t,e[3]=i[3]+t,e):[i[0]-t,i[1]-t,i[2]+t,i[3]+t]}function Qf(i,t){return t?(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t):i.slice()}function th(i,t,e){let n,r;return t<i[0]?n=i[0]-t:i[2]<t?n=t-i[2]:n=0,e<i[1]?r=i[1]-e:i[3]<e?r=e-i[3]:r=0,n*n+r*r}function Hi(i,t){return eh(i,t[0],t[1])}function Pn(i,t){return i[0]<=t[0]&&t[2]<=i[2]&&i[1]<=t[1]&&t[3]<=i[3]}function eh(i,t,e){return i[0]<=t&&t<=i[2]&&i[1]<=e&&e<=i[3]}function Do(i,t){const e=i[0],n=i[1],r=i[2],s=i[3],o=t[0],a=t[1];let l=Ct.UNKNOWN;return o<e?l=l|Ct.LEFT:o>r&&(l=l|Ct.RIGHT),a<n?l=l|Ct.BELOW:a>s&&(l=l|Ct.ABOVE),l===Ct.UNKNOWN&&(l=Ct.INTERSECTING),l}function Ee(){return[1/0,1/0,-1/0,-1/0]}function $n(i,t,e,n,r){return r?(r[0]=i,r[1]=t,r[2]=e,r[3]=n,r):[i,t,e,n]}function Lo(i){return $n(1/0,1/0,-1/0,-1/0,i)}function tg(i,t){const e=i[0],n=i[1];return $n(e,n,e,n,t)}function eg(i,t,e,n,r){const s=Lo(r);return ih(s,i,t,e,n)}function ig(i,t){return t[0]<i[0]&&(i[0]=t[0]),t[2]>i[2]&&(i[2]=t[2]),t[1]<i[1]&&(i[1]=t[1]),t[3]>i[3]&&(i[3]=t[3]),i}function Nn(i,t){t[0]<i[0]&&(i[0]=t[0]),t[0]>i[2]&&(i[2]=t[0]),t[1]<i[1]&&(i[1]=t[1]),t[1]>i[3]&&(i[3]=t[1])}function ih(i,t,e,n,r){for(;e<n;e+=r)ng(i,t[e],t[e+1]);return i}function ng(i,t,e){i[0]=Math.min(i[0],t),i[1]=Math.min(i[1],e),i[2]=Math.max(i[2],t),i[3]=Math.max(i[3],e)}function nh(i,t){let e;return e=t(Oo(i)),e||(e=t(Po(i)),e)||(e=t($o(i)),e)||(e=t(Ur(i)),e)?e:!1}function kn(i){let t=0;return Xr(i)||(t=ht(i)*Jt(i)),t}function Oo(i){return[i[0],i[1]]}function Po(i){return[i[2],i[1]]}function zi(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function rg(i,t,e,n,r){const[s,o,a,l,h,c,u,d]=sg(i,t,e,n);return $n(Math.min(s,a,h,u),Math.min(o,l,c,d),Math.max(s,a,h,u),Math.max(o,l,c,d),r)}function sg(i,t,e,n){const r=t*n[0]/2,s=t*n[1]/2,o=Math.cos(e),a=Math.sin(e),l=r*o,h=r*a,c=s*o,u=s*a,d=i[0],f=i[1];return[d-l+u,f-h-c,d-l-u,f-h+c,d+l-u,f+h+c,d+l+u,f+h-c,d-l+u,f-h-c]}function Jt(i){return i[3]-i[1]}function xe(i,t,e){const n=e||Ee();return Qt(i,t)?(i[0]>t[0]?n[0]=i[0]:n[0]=t[0],i[1]>t[1]?n[1]=i[1]:n[1]=t[1],i[2]<t[2]?n[2]=i[2]:n[2]=t[2],i[3]<t[3]?n[3]=i[3]:n[3]=t[3]):Lo(n),n}function Ur(i){return[i[0],i[3]]}function $o(i){return[i[2],i[3]]}function ht(i){return i[2]-i[0]}function Qt(i,t){return i[0]<=t[2]&&i[2]>=t[0]&&i[1]<=t[3]&&i[3]>=t[1]}function Xr(i){return i[2]<i[0]||i[3]<i[1]}function og(i,t){return t?(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t):i}function ag(i,t,e){let n=!1;const r=Do(i,t),s=Do(i,e);if(r===Ct.INTERSECTING||s===Ct.INTERSECTING)n=!0;else{const o=i[0],a=i[1],l=i[2],h=i[3],c=t[0],u=t[1],d=e[0],f=e[1],g=(f-u)/(d-c);let p,_;s&Ct.ABOVE&&!(r&Ct.ABOVE)&&(p=d-(f-h)/g,n=p>=o&&p<=l),!n&&s&Ct.RIGHT&&!(r&Ct.RIGHT)&&(_=f-(d-l)*g,n=_>=a&&_<=h),!n&&s&Ct.BELOW&&!(r&Ct.BELOW)&&(p=d-(f-a)/g,n=p>=o&&p<=l),!n&&s&Ct.LEFT&&!(r&Ct.LEFT)&&(_=f-(d-o)*g,n=_>=a&&_<=h)}return n}function rh(i,t){const e=t.getExtent(),n=zi(i);if(t.canWrapX()&&(n[0]<e[0]||n[0]>=e[2])){const r=ht(e),o=Math.floor((n[0]-e[0])/r)*r;i[0]-=o,i[2]-=o}return i}function sh(i,t,e){if(t.canWrapX()){const n=t.getExtent();if(!isFinite(i[0])||!isFinite(i[2]))return[[n[0],i[1],n[2],i[3]]];rh(i,t);const r=ht(n);if(ht(i)>r&&!e)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 lg(i,t){return i[0]+=+t[0],i[1]+=+t[1],i}function Gr(i,t){let e=!0;for(let n=i.length-1;n>=0;--n)if(i[n]!=t[n]){e=!1;break}return e}function hg(i,t){const e=Math.cos(t),n=Math.sin(t),r=i[0]*e-i[1]*n,s=i[1]*e+i[0]*n;return i[0]=r,i[1]=s,i}function cg(i,t){if(t.canWrapX()){const e=ht(t.getExtent()),n=ug(i,t,e);n&&(i[0]-=n*e)}return i}function ug(i,t,e){const n=t.getExtent();let r=0;return t.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(e=e||ht(n),r=Math.floor((i[0]-n[0])/e)),r}const dg=63710088e-1;function oh(i,t,e){e=e||dg;const n=Nr(i[1]),r=Nr(t[1]),s=(r-n)/2,o=Nr(t[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*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function fg(...i){console.warn(...i)}let No=!0;function gg(i){No=!(i===void 0?!0:i)}function ah(i,t){if(t!==void 0){for(let e=0,n=i.length;e<n;++e)t[e]=i[e];t=t}else t=i.slice();return t}function lh(i,t){if(t!==void 0&&i!==t){for(let e=0,n=i.length;e<n;++e)t[e]=i[e];i=t}return i}function pg(i){Kf(i.getCode(),i),Br(i,i,ah)}function _g(i){i.forEach(pg)}function yi(i){return typeof i=="string"?qf(i):i||null}function hh(i,t,e,n){i=yi(i);let r;const s=i.getPointResolutionFunc();if(s){if(r=s(t,e),n&&n!==i.getUnits()){const o=i.getMetersPerUnit();o&&(r=r*o/kr[n])}}else{const o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")r=t;else{const a=Fo(i,yi("EPSG:4326"));if(a===lh&&o!=="degrees")r=t*i.getMetersPerUnit();else{let h=[e[0]-t/2,e[1],e[0]+t/2,e[1],e[0],e[1]-t/2,e[0],e[1]+t/2];h=a(h,h,2);const c=oh(h.slice(0,2),h.slice(2,4)),u=oh(h.slice(4,6),h.slice(6,8));r=(c+u)/2}const l=n?kr[n]:i.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function ch(i){_g(i),i.forEach(function(t){i.forEach(function(e){t!==e&&Br(t,e,ah)})})}function mg(i,t,e,n){i.forEach(function(r){t.forEach(function(s){Br(r,s,e),Br(s,r,n)})})}function ko(i,t){return i?typeof i=="string"?yi(i):i:yi(t)}function Fo(i,t){const e=i.getCode(),n=t.getCode();let r=Jf(e,n);return r||(r=lh),r}function Wr(i,t){const e=yi(i),n=yi(t);return Fo(e,n)}function yg(i,t,e){return Wr(t,e)(i,void 0,i.length)}let Eg=null;function xg(){return Eg}function uh(i,t){return i}function qe(i,t){return No&&!Gr(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(No=!1,fg("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i}function Bo(i,t){return i}function Ei(i,t){return i}function Tg(){ch(Kl),ch(Ql),mg(Ql,Kl,Vf,Yf)}Tg();function dh(i,t,e){return function(n,r,s,o,a){if(!n)return;if(!r&&!t)return n;const l=t?0:s[0]*r,h=t?0:s[1]*r,c=a?a[0]:0,u=a?a[1]:0;let d=i[0]+l/2+c,f=i[2]-l/2+c,g=i[1]+h/2+u,p=i[3]-h/2+u;d>f&&(d=(f+d)/2,f=d),g>p&&(g=(p+g)/2,p=g);let _=vt(n[0],d,f),y=vt(n[1],g,p);if(o&&e&&r){const m=30*r;_+=-m*Math.log(1+Math.max(0,d-n[0])/m)+m*Math.log(1+Math.max(0,n[0]-f)/m),y+=-m*Math.log(1+Math.max(0,g-n[1])/m)+m*Math.log(1+Math.max(0,n[1]-p)/m)}return[_,y]}}function vg(i){return i}function Uo(i,t,e,n){const r=ht(t)/e[0],s=Jt(t)/e[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function Xo(i,t,e){let n=Math.min(i,t);const r=50;return n*=Math.log(1+r*Math.max(0,i/t-1))/r+1,e&&(n=Math.max(n,e),n/=Math.log(1+r*Math.max(0,e/i-1))/r+1),vt(n,e/2,t*2)}function bg(i,t,e,n){return t=t!==void 0?t:!0,function(r,s,o,a){if(r!==void 0){const l=i[0],h=i[i.length-1],c=e?Uo(l,e,o,n):l;if(a)return t?Xo(r,c,h):vt(r,h,c);const u=Math.min(c,r),d=Math.floor(jl(i,u,s));return i[d]>c&&d<i.length-1?i[d+1]:i[d]}}}function wg(i,t,e,n,r,s){return n=n!==void 0?n:!0,e=e!==void 0?e:0,function(o,a,l,h){if(o!==void 0){const c=r?Uo(t,r,l,s):t;if(h)return n?Xo(o,c,e):vt(o,e,c);const u=1e-9,d=Math.ceil(Math.log(t/c)/Math.log(i)-u),f=-a*(.5-u)+.5,g=Math.min(c,o),p=Math.floor(Math.log(t/g)/Math.log(i)+f),_=Math.max(d,p),y=t/Math.pow(i,_);return vt(y,e,c)}}}function fh(i,t,e,n,r){return e=e!==void 0?e:!0,function(s,o,a,l){if(s!==void 0){const h=n?Uo(i,n,a,r):i;return!e||!l?vt(s,t,h):Xo(s,h,t)}}}function Sg(i){if(i!==void 0)return 0}function gh(i){if(i!==void 0)return i}function Rg(i){const t=2*Math.PI/i;return function(e,n){if(n)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e}}function Cg(i){const t=i===void 0?Nr(5):i;return function(e,n){return n||e===void 0?e:Math.abs(e)<=t?0:e}}function ph(i){return Math.pow(i,3)}function Ig(i){return 1-ph(1-i)}function Ag(i){return 3*i*i-2*i*i*i}const Go=new Array(6);function oe(){return[1,0,0,1,0,0]}function Mg(i){return Hr(i,1,0,0,1,0,0)}function Wo(i,t){const e=i[0],n=i[1],r=i[2],s=i[3],o=i[4],a=i[5],l=t[0],h=t[1],c=t[2],u=t[3],d=t[4],f=t[5];return i[0]=e*l+r*h,i[1]=n*l+s*h,i[2]=e*c+r*u,i[3]=n*c+s*u,i[4]=e*d+r*f+o,i[5]=n*d+s*f+a,i}function Hr(i,t,e,n,r,s,o){return i[0]=t,i[1]=e,i[2]=n,i[3]=r,i[4]=s,i[5]=o,i}function Dg(i,t){return i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],i}function Ht(i,t){const e=t[0],n=t[1];return t[0]=i[0]*e+i[2]*n+i[4],t[1]=i[1]*e+i[3]*n+i[5],t}function Lg(i,t){const e=Math.cos(t),n=Math.sin(t);return Wo(i,Hr(Go,e,n,-n,e,0,0))}function _h(i,t,e){return Wo(i,Hr(Go,t,0,0,e,0,0))}function Og(i,t,e){return Wo(i,Hr(Go,1,0,0,1,t,e))}function Ke(i,t,e,n,r,s,o,a){const l=Math.sin(s),h=Math.cos(s);return i[0]=n*h,i[1]=r*l,i[2]=-n*l,i[3]=r*h,i[4]=o*n*h-a*n*l+t,i[5]=o*r*l+a*r*h+e,i}function Pg(i,t){const e=$g(t);Lt(e!==0,"Transformation matrix cannot be inverted");const n=t[0],r=t[1],s=t[2],o=t[3],a=t[4],l=t[5];return i[0]=o/e,i[1]=-r/e,i[2]=-s/e,i[3]=n/e,i[4]=(s*l-o*a)/e,i[5]=-(n*l-r*a)/e,i}function $g(i){return i[0]*i[3]-i[1]*i[2]}const mh=[1e6,1e6,1e6,1e6,2,2];function Ng(i){return"matrix("+i.map((e,n)=>Math.round(e*mh[n])/mh[n]).join(", ")+")"}function xi(i,t,e,n,r,s){s=s||[];let o=0;for(let a=t;a<e;a+=n){const l=i[a],h=i[a+1];s[o++]=r[0]*l+r[2]*h+r[4],s[o++]=r[1]*l+r[3]*h+r[5]}return s&&s.length!=o&&(s.length=o),s}function yh(i,t,e,n,r,s,o){o=o||[];const a=Math.cos(r),l=Math.sin(r),h=s[0],c=s[1];let u=0;for(let d=t;d<e;d+=n){const f=i[d]-h,g=i[d+1]-c;o[u++]=h+f*a-g*l,o[u++]=c+f*l+g*a;for(let p=d+2;p<d+n;++p)o[u++]=i[p]}return o&&o.length!=u&&(o.length=u),o}function kg(i,t,e,n,r,s,o,a){a=a||[];const l=o[0],h=o[1];let c=0;for(let u=t;u<e;u+=n){const d=i[u]-l,f=i[u+1]-h;a[c++]=l+r*d,a[c++]=h+s*f;for(let g=u+2;g<u+n;++g)a[c++]=i[g]}return a&&a.length!=c&&(a.length=c),a}function Fg(i,t,e,n,r,s,o){o=o||[];let a=0;for(let l=t;l<e;l+=n){o[a++]=i[l]+r,o[a++]=i[l+1]+s;for(let h=l+2;h<l+n;++h)o[a++]=i[h]}return o&&o.length!=a&&(o.length=a),o}const Eh=oe();class Bg extends $r{constructor(){super(),this.extent_=Ee(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Nf((t,e,n)=>{if(!n)return this.getSimplifiedGeometry(e);const r=this.clone();return r.applyTransform(n),r.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return nt()}closestPointXY(t,e,n,r){return nt()}containsXY(t,e){const n=this.getClosestPoint([t,e]);return n[0]===t&&n[1]===e}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return nt()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Lo(e),this.extentRevision_=this.getRevision()}return og(this.extent_,t)}rotate(t,e){nt()}scale(t,e,n){nt()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return nt()}getType(){return nt()}applyTransform(t){nt()}intersectsExtent(t){return nt()}translate(t,e){nt()}transform(t,e){const n=yi(t),r=n.getUnits()=="tile-pixels"?function(s,o,a){const l=n.getExtent(),h=n.getWorldExtent(),c=Jt(h)/Jt(l);return Ke(Eh,h[0],h[3],c,-c,0,0,0),xi(s,0,s.length,a,Eh,o),Wr(n,e)(s,o,a)}:Wr(n,e);return this.applyTransform(r),this}}class Ho extends Bg{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return eg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return nt()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=xh(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){nt()}setLayout(t,e,n){let r;if(t)r=xh(t);else{for(let s=0;s<n;++s){if(e.length===0){this.layout="XY",this.stride=2;return}e=e[0]}r=e.length,t=Ug(r)}this.layout=t,this.stride=r}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())}rotate(t,e){const n=this.getFlatCoordinates();if(n){const r=this.getStride();yh(n,0,n.length,r,t,e,n),this.changed()}}scale(t,e,n){e===void 0&&(e=t),n||(n=zi(this.getExtent()));const r=this.getFlatCoordinates();if(r){const s=this.getStride();kg(r,0,r.length,s,t,e,n,r),this.changed()}}translate(t,e){const n=this.getFlatCoordinates();if(n){const r=this.getStride();Fg(n,0,n.length,r,t,e,n),this.changed()}}}function Ug(i){let t;return i==2?t="XY":i==3?t="XYZ":i==4&&(t="XYZM"),t}function xh(i){let t;return i=="XY"?t=2:i=="XYZ"||i=="XYM"?t=3:i=="XYZM"&&(t=4),t}function Xg(i,t,e){const n=i.getFlatCoordinates();if(!n)return null;const r=i.getStride();return xi(n,0,n.length,r,t,e)}function Th(i,t,e,n,r,s,o){const a=i[t],l=i[t+1],h=i[e]-a,c=i[e+1]-l;let u;if(h===0&&c===0)u=t;else{const d=((r-a)*h+(s-l)*c)/(h*h+c*c);if(d>1)u=e;else if(d>0){for(let f=0;f<n;++f)o[f]=fe(i[t+f],i[e+f],d);o.length=n;return}else u=t}for(let d=0;d<n;++d)o[d]=i[u+d];o.length=n}function vh(i,t,e,n,r){let s=i[t],o=i[t+1];for(t+=n;t<e;t+=n){const a=i[t],l=i[t+1],h=Ui(s,o,a,l);h>r&&(r=h),s=a,o=l}return r}function Gg(i,t,e,n,r){for(let s=0,o=e.length;s<o;++s){const a=e[s];r=vh(i,t,a,n,r),t=a}return r}function bh(i,t,e,n,r,s,o,a,l,h,c){if(t==e)return h;let u,d;if(r===0){if(d=Ui(o,a,i[t],i[t+1]),d<h){for(u=0;u<n;++u)l[u]=i[t+u];return l.length=n,d}return h}c=c||[NaN,NaN];let f=t+n;for(;f<e;)if(Th(i,f-n,f,n,o,a,c),d=Ui(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n,f+=n}else f+=n*Math.max((Math.sqrt(d)-Math.sqrt(h))/r|0,1);if(s&&(Th(i,e-n,t,n,o,a,c),d=Ui(o,a,c[0],c[1]),d<h)){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n}return h}function Wg(i,t,e,n,r,s,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const f=e[u];h=bh(i,t,f,n,r,s,o,a,l,h,c),t=f}return h}function Hg(i,t,e,n){for(let r=0,s=e.length;r<s;++r)i[t++]=e[r];return t}function wh(i,t,e,n){for(let r=0,s=e.length;r<s;++r){const o=e[r];for(let a=0;a<n;++a)i[t++]=o[a]}return t}function zg(i,t,e,n,r){r=r||[];let s=0;for(let o=0,a=e.length;o<a;++o){const l=wh(i,t,e[o],n);r[s++]=l,t=l}return r.length=s,r}function Vg(i,t,e,n,r,s,o){const a=(e-t)/n;if(a<3){for(;t<e;t+=n)s[o++]=i[t],s[o++]=i[t+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[t,e-n];let c=0;for(;h.length>0;){const u=h.pop(),d=h.pop();let f=0;const g=i[d],p=i[d+1],_=i[u],y=i[u+1];for(let m=d+n;m<u;m+=n){const x=i[m],E=i[m+1],T=Bf(x,E,g,p,_,y);T>f&&(c=m,f=T)}f>r&&(l[(c-t)/n]=1,d+n<c&&h.push(d,c),c+n<u&&h.push(c,u))}for(let u=0;u<a;++u)l[u]&&(s[o++]=i[t+u*n],s[o++]=i[t+u*n+1]);return o}function Ti(i,t){return t*Math.round(i/t)}function Yg(i,t,e,n,r,s,o){if(t==e)return o;let a=Ti(i[t],r),l=Ti(i[t+1],r);t+=n,s[o++]=a,s[o++]=l;let h,c;do if(h=Ti(i[t],r),c=Ti(i[t+1],r),t+=n,t==e)return s[o++]=h,s[o++]=c,o;while(h==a&&c==l);for(;t<e;){const u=Ti(i[t],r),d=Ti(i[t+1],r);if(t+=n,u==h&&d==c)continue;const f=h-a,g=c-l,p=u-a,_=d-l;if(f*_==g*p&&(f<0&&p<f||f==p||f>0&&p>f)&&(g<0&&_<g||g==_||g>0&&_>g)){h=u,c=d;continue}s[o++]=h,s[o++]=c,a=h,l=c,h=u,c=d}return s[o++]=h,s[o++]=c,o}function jg(i,t,e,n,r,s,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=Yg(i,t,c,n,r,s,o),a.push(o),t=c}return o}function Vi(i,t,e,n,r){r=r!==void 0?r:[];let s=0;for(let o=t;o<e;o+=n)r[s++]=i.slice(o,o+n);return r.length=s,r}function zr(i,t,e,n,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];r[s++]=Vi(i,t,l,n,r[s]),t=l}return r.length=s,r}function Sh(i,t,e,n,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];r[s++]=l.length===1&&l[0]===t?[]:zr(i,t,l,n,r[s]),t=l[l.length-1]}return r.length=s,r}function Rh(i,t,e,n){let r=0;const s=i[e-n],o=i[e-n+1];let a=0,l=0;for(;t<e;t+=n){const h=i[t]-s,c=i[t+1]-o;r+=l*h-a*c,a=h,l=c}return r/2}function Zg(i,t,e,n){let r=0;for(let s=0,o=e.length;s<o;++s){const a=e[s];r+=Rh(i,t,a,n),t=a}return r}class Fn extends Ho{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,e!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}clone(){return new Fn(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,n,r){return r<th(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(vh(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),bh(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,n,r))}getArea(){return Rh(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Vi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=Vg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Fn(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=wh(this.flatCoordinates,0,t,this.stride),this.changed()}}class zo extends Ho{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new zo(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,n,r){const s=this.flatCoordinates,o=Ui(t,e,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(t){return tg(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return eh(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Hg(this.flatCoordinates,0,t,this.stride),this.changed()}}function qg(i,t,e,n,r){return!nh(r,function(o){return!vi(i,t,e,n,o[0],o[1])})}function vi(i,t,e,n,r,s){let o=0,a=i[e-n],l=i[e-n+1];for(;t<e;t+=n){const h=i[t],c=i[t+1];l<=s?c>s&&(h-a)*(s-l)-(r-a)*(c-l)>0&&o++:c<=s&&(h-a)*(s-l)-(r-a)*(c-l)<0&&o--,a=h,l=c}return o!==0}function Ch(i,t,e,n,r,s){if(e.length===0||!vi(i,t,e[0],n,r,s))return!1;for(let o=1,a=e.length;o<a;++o)if(vi(i,e[o-1],e[o],n,r,s))return!1;return!0}function Kg(i,t,e,n,r,s,o){let a,l,h,c,u,d,f;const g=r[s+1],p=[];for(let m=0,x=e.length;m<x;++m){const E=e[m];for(c=i[E-n],d=i[E-n+1],a=t;a<E;a+=n)u=i[a],f=i[a+1],(g<=d&&f<=g||d<=g&&g<=f)&&(h=(g-d)/(f-d)*(u-c)+c,p.push(h)),c=u,d=f}let _=NaN,y=-1/0;for(p.sort(Fi),c=p[0],a=1,l=p.length;a<l;++a){u=p[a];const m=Math.abs(u-c);m>y&&(h=(c+u)/2,Ch(i,t,e,n,h,g)&&(_=h,y=m)),c=u}return isNaN(_)&&(_=r[s]),o?(o.push(_,g,y),o):[_,g,y]}function Jg(i,t,e,n,r){let s;for(t+=n;t<e;t+=n)if(s=r(i.slice(t-n,t),i.slice(t,t+n)),s)return s;return!1}function Ih(i,t,e,n,r){const s=ih(Ee(),i,t,e,n);return Qt(r,s)?Pn(r,s)||s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:Jg(i,t,e,n,function(o,a){return ag(r,o,a)}):!1}function Qg(i,t,e,n,r){return!!(Ih(i,t,e,n,r)||vi(i,t,e,n,r[0],r[1])||vi(i,t,e,n,r[0],r[3])||vi(i,t,e,n,r[2],r[1])||vi(i,t,e,n,r[2],r[3]))}function tp(i,t,e,n,r){if(!Qg(i,t,e[0],n,r))return!1;if(e.length===1)return!0;for(let s=1,o=e.length;s<o;++s)if(qg(i,e[s-1],e[s],n,r)&&!Ih(i,e[s-1],e[s],n,r))return!1;return!0}function ep(i,t,e,n){for(;t<e-n;){for(let r=0;r<n;++r){const s=i[t+r];i[t+r]=i[e-n+r],i[e-n+r]=s}t+=n,e-=n}}function Ah(i,t,e,n){let r=0,s=i[e-n],o=i[e-n+1];for(;t<e;t+=n){const a=i[t],l=i[t+1];r+=(a-s)*(l+o),s=a,o=l}return r===0?void 0:r>0}function ip(i,t,e,n,r){r=r!==void 0?r:!1;for(let s=0,o=e.length;s<o;++s){const a=e[s],l=Ah(i,t,a,n);if(s===0){if(r&&l||!r&&!l)return!1}else if(r&&!l||!r&&l)return!1;t=a}return!0}function Mh(i,t,e,n,r){r=r!==void 0?r:!1;for(let s=0,o=e.length;s<o;++s){const a=e[s],l=Ah(i,t,a,n);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&ep(i,t,a,n),t=a}return t}class Vr extends Ho{constructor(t,e,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,e!==void 0&&n?(this.setFlatCoordinates(e,t),this.ends_=n):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?$f(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Vr(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,n,r){return r<th(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Gg(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Wg(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,n,r))}containsXY(t,e){return Ch(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Zg(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),Mh(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,zr(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=zi(this.getExtent());this.flatInteriorPoint_=Kg(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new zo(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new Fn(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,n=this.ends_,r=[];let s=0;for(let o=0,a=n.length;o<a;++o){const l=n[o],h=new Fn(e.slice(s,l),t);r.push(h),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;ip(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Mh(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],n=[];return e.length=jg(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,n),new Vr(e,"XY",n)}getType(){return"Polygon"}intersectsExtent(t){return tp(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const n=zg(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}}function Dh(i){if(Xr(i))throw new Error("Cannot create polygon from empty extent");const t=i[0],e=i[1],n=i[2],r=i[3],s=[t,e,t,r,n,r,n,e,t,e];return new Vr(s,"XY",[s.length])}const Vo=0;class Lh extends $r{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=ko(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&gg(),t.center&&(t.center=qe(t.center,this.projection_)),t.extent&&(t.extent=Ei(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const a in ge)delete e[a];this.setProperties(e,!0);const n=rp(t);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=n.minZoom;const r=np(t),s=n.constraint,o=sp(t);this.constraints_={center:r,resolution:s,rotation:o},this.setRotation(t.rotation!==void 0?t.rotation:0),this.setCenterInternal(t.center!==void 0?t.center:null),t.resolution!==void 0?this.setResolution(t.resolution):t.zoom!==void 0&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const n=this.getCenterInternal();if(n){const r=t||[0,0,0,0];e=e||[0,0,0,0];const s=this.getResolution(),o=s/2*(r[3]-e[3]+e[1]-r[1]),a=s/2*(r[0]-e[0]+e[2]-r[2]);this.setCenterInternal([n[0]+o,n[1]-a])}}getUpdatedOptions_(t){const e=this.getProperties();return e.resolution!==void 0?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let n=0;n<e.length;++n){let r=arguments[n];r.center&&(r=Object.assign({},r),r.center=qe(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=qe(r.anchor,this.getProjection())),e[n]=r}this.animateInternal.apply(this,e)}animateInternal(t){let e=arguments.length,n;e>1&&typeof arguments[e-1]=="function"&&(n=arguments[e-1],--e);let r=0;for(;r<e&&!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===e){n&&Yr(n,!0);return}let s=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const h=[];for(;r<e;++r){const c=arguments[r],u={start:s,complete:!1,anchor:c.anchor,duration:c.duration!==void 0?c.duration:1e3,easing:c.easing||Ag,callback:n};if(c.center&&(u.sourceCenter=o,u.targetCenter=c.center.slice(),o=u.targetCenter),c.zoom!==void 0?(u.sourceResolution=a,u.targetResolution=this.getResolutionForZoom(c.zoom),a=u.targetResolution):c.resolution&&(u.sourceResolution=a,u.targetResolution=c.resolution,a=u.targetResolution),c.rotation!==void 0){u.sourceRotation=l;const d=Ln(c.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+d,l=u.targetRotation}op(u)?u.complete=!0:s+=u.duration,h.push(u)}this.animations_.push(h),this.setHint(se.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[se.ANIMATING]>0}getInteracting(){return this.hints_[se.INTERACTING]>0}cancelAnimations(){this.setHint(se.ANIMATING,-this.hints_[se.ANIMATING]);let t;for(let e=0,n=this.animations_.length;e<n;++e){const r=this.animations_[e];if(r[0].callback&&Yr(r[0].callback,!1),!t)for(let s=0,o=r.length;s<o;++s){const a=r[s];if(!a.complete){t=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!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 h=t-l.start;let c=l.duration>0?h/l.duration:1;c>=1?(l.complete=!0,c=1):s=!1;const u=l.easing(c);if(l.sourceCenter){const d=l.sourceCenter[0],f=l.sourceCenter[1],g=l.targetCenter[0],p=l.targetCenter[1];this.nextCenter_=l.targetCenter;const _=d+u*(g-d),y=f+u*(p-f);this.targetCenter_=[_,y]}if(l.sourceResolution&&l.targetResolution){const d=u===1?l.targetResolution:l.sourceResolution+u*(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=u===1?Ln(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+u*(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),e=!0,!l.complete)break}if(s){this.animations_[n]=null,this.setHint(se.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=r[0].callback;o&&Yr(o,!0)}}this.animations_=this.animations_.filter(Boolean),e&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let n;const r=this.getCenterInternal();return r!==void 0&&(n=[r[0]-e[0],r[1]-e[1]],hg(n,t-this.getRotation()),lg(n,e)),n}calculateCenterZoom(t,e){let n;const r=this.getCenterInternal(),s=this.getResolution();if(r!==void 0&&s!==void 0){const o=e[0]-t*(e[0]-r[0])/s,a=e[1]-t*(e[1]-r[1])/s;n=[o,a]}return n}getViewportSize_(t){const e=this.viewportSize_;if(t){const n=e[0],r=e[1];return[Math.abs(n*Math.cos(t))+Math.abs(r*Math.sin(t)),Math.abs(n*Math.sin(t))+Math.abs(r*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t&&uh(t,this.getProjection())}getCenterInternal(){return this.get(ge.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return t!==void 0?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){const e=this.calculateExtentInternal(t);return Bo(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();Lt(e,"The view center is not defined");const n=this.getResolution();Lt(n!==void 0,"The view resolution is not defined");const r=this.getRotation();return Lt(r!==void 0,"The view rotation is not defined"),rg(e,n,r,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(ge.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Ei(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const n=ht(t)/e[0],r=Jt(t)/e[1];return Math.max(n,r)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(e/n)/Math.log(t);return function(s){return e/Math.pow(t,s*r)}}getRotation(){return this.get(ge.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,s=Math.log(n/r)/e;return function(o){return Math.log(n/o)/e/s}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const n=this.padding_;return n&&(e=[e[0]-n[1]-n[3],e[1]-n[0]-n[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),n=this.getRotation();let r=this.getCenterInternal();const s=this.padding_;if(s){const o=this.getViewportSizeMinusPadding_();r=Yo(r,this.getViewportSize_(),[o[0]/2+s[3],o[1]/2+s[0]],e,n)}return{center:r.slice(0),projection:t!==void 0?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return e!==void 0&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e=this.minZoom_||0,n,r;if(this.resolutions_){const s=jl(this.resolutions_,t,1);e=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 e+Math.log(n/t)/Math.log(r)}getResolutionForZoom(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;const e=vt(Math.floor(t),0,this.resolutions_.length-2),n=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(n,vt(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let n;if(Lt(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){Lt(!Xr(t),"Cannot fit empty extent provided as `geometry`");const r=Ei(t,this.getProjection());n=Dh(r)}else if(t.getType()==="Circle"){const r=Ei(t.getExtent(),this.getProjection());n=Dh(r),n.rotate(this.getRotation(),zi(r))}else n=t;this.fitInternal(n,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),n=Math.cos(e),r=Math.sin(-e),s=t.getFlatCoordinates(),o=t.getStride();let a=1/0,l=1/0,h=-1/0,c=-1/0;for(let u=0,d=s.length;u<d;u+=o){const f=s[u]*n-s[u+1]*r,g=s[u]*r+s[u+1]*n;a=Math.min(a,f),l=Math.min(l,g),h=Math.max(h,f),c=Math.max(c,g)}return[a,l,h,c]}fitInternal(t,e){e=e||{};let n=e.size;n||(n=this.getViewportSizeMinusPadding_());const r=e.padding!==void 0?e.padding:[0,0,0,0],s=e.nearest!==void 0?e.nearest:!1;let o;e.minResolution!==void 0?o=e.minResolution:e.maxZoom!==void 0?o=this.getResolutionForZoom(e.maxZoom):o=0;const a=this.rotatedExtentForGeometry(t);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 h=this.getRotation(),c=Math.sin(h),u=Math.cos(h),d=zi(a);d[0]+=(r[1]-r[3])/2*l,d[1]+=(r[0]-r[2])/2*l;const f=d[0]*u-d[1]*c,g=d[1]*u+d[0]*c,p=this.getConstrainedCenter([f,g],l),_=e.callback?e.callback:Ro;e.duration!==void 0?this.animateInternal({resolution:l,center:p,duration:e.duration,easing:e.easing},_):(this.targetResolution_=l,this.targetCenter_=p,this.applyTargetState_(!1,!0),Yr(_,!0))}centerOn(t,e,n){this.centerOnInternal(qe(t,this.getProjection()),e,n)}centerOnInternal(t,e,n){this.setCenterInternal(Yo(t,e,n,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,n,r){let s;const o=this.padding_;if(o&&t){const a=this.getViewportSizeMinusPadding_(-n),l=Yo(t,r,[a[0]/2+o[3],a[1]/2+o[0]],e,n);s=[t[0]-l[0],t[1]-l[1]]}return s}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(t){const e=uh(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){const e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&qe(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const n=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*t,0,r,n);e&&(this.targetCenter_=this.calculateCenterZoom(s,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=qe(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const n=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+t,n);e&&(this.targetCenter_=this.calculateCenterRotate(r,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t&&qe(t,this.getProjection()))}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const n=this.getAnimating()||this.getInteracting()||e,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(ge.ROTATION)!==r&&this.set(ge.ROTATION,r),this.get(ge.RESOLUTION)!==o&&(this.set(ge.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(ge.CENTER)||!Gr(this.get(ge.CENTER),a))&&this.set(ge.CENTER,a),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,n){t=t!==void 0?t:200;const r=e||0,s=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(s),a=this.constraints_.resolution(this.targetResolution_,r,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,s,o));if(t===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=s,this.targetCenter_=l,this.applyTargetState_();return}n=n||(t===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==s||!this.getCenterInternal()||!Gr(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:t,easing:Ig,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(se.INTERACTING,1)}endInteraction(t,e,n){n=n&&qe(n,this.getProjection()),this.endInteractionInternal(t,e,n)}endInteractionInternal(t,e,n){this.getInteracting()&&(this.setHint(se.INTERACTING,-1),this.resolveConstraints(t,e,n))}getConstrainedCenter(t,e){const n=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),n)}getConstrainedZoom(t,e){const n=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(n,e))}getConstrainedResolution(t,e){e=e||0;const n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,n)}}function Yr(i,t){setTimeout(function(){i(t)},0)}function np(i){if(i.extent!==void 0){const e=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return dh(i.extent,i.constrainOnlyCenter,e)}const t=ko(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&t.isGlobal()){const e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,dh(e,!1,!1)}return vg}function rp(i){let t,e,n,o=i.minZoom!==void 0?i.minZoom:Vo,a=i.maxZoom!==void 0?i.maxZoom:28;const l=i.zoomFactor!==void 0?i.zoomFactor:2,h=i.multiWorld!==void 0?i.multiWorld:!1,c=i.smoothResolutionConstraint!==void 0?i.smoothResolutionConstraint:!0,u=i.showFullExtent!==void 0?i.showFullExtent:!1,d=ko(i.projection,"EPSG:3857"),f=d.getExtent();let g=i.constrainOnlyCenter,p=i.extent;if(!h&&!p&&d.isGlobal()&&(g=!1,p=f),i.resolutions!==void 0){const _=i.resolutions;e=_[o],n=_[a]!==void 0?_[a]:_[_.length-1],i.constrainResolution?t=bg(_,c,!g&&p,u):t=fh(e,n,c,!g&&p,u)}else{const y=(f?Math.max(ht(f),Jt(f)):360*kr.degrees/d.getMetersPerUnit())/Wf/Math.pow(2,Vo),m=y/Math.pow(2,28-Vo);e=i.maxResolution,e!==void 0?o=0:e=y/Math.pow(l,o),n=i.minResolution,n===void 0&&(i.maxZoom!==void 0?i.maxResolution!==void 0?n=e/Math.pow(l,a):n=y/Math.pow(l,a):n=m),a=o+Math.floor(Math.log(e/n)/Math.log(l)),n=e/Math.pow(l,a-o),i.constrainResolution?t=wg(l,e,n,c,!g&&p,u):t=fh(e,n,c,!g&&p,u)}return{constraint:t,maxResolution:e,minResolution:n,minZoom:o,zoomFactor:l}}function sp(i){if(i.enableRotation!==void 0?i.enableRotation:!0){const e=i.constrainRotation;return e===void 0||e===!0?Cg():e===!1?gh:typeof e=="number"?Rg(e):gh}return Sg}function op(i){return!(i.sourceCenter&&i.targetCenter&&!Gr(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function Yo(i,t,e,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+=(t[0]/2-e[0])*n,l+=(e[1]-t[1]/2)*n,o=-o;const h=a*s-l*o,c=l*s+a*o;return[h,c]}class Oh extends Gf{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(rt.SOURCE,this.handleSourcePropertyChange_);const n=t.source?t.source:null;this.setSource(n)}getLayersArray(t){return t=t||[],t.push(this),t}getLayerStatesArray(t){return t=t||[],t.push(this.getLayerState()),t}getSource(){return this.get(rt.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(ye(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=Ze(t,wt.CHANGE,this.handleSourceChange_,this),t.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return!this.renderer_||!this.rendered?null:this.renderer_.getData(t)}isVisible(t){let e;const n=this.getMapInternal();!t&&n&&(t=n.getView()),t instanceof Lh?e={viewState:t.getState(),extent:t.calculateExtent()}:e=t,!e.layerStatesArray&&n&&(e.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let r;e.layerStatesArray?r=e.layerStatesArray.find(o=>o.layer===this):r=this.getLayerState();const s=this.getExtent();return ap(r,e.viewState)&&(!s||Qt(s,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];let e;const n=this.getSource();if(n&&(e=n.getAttributions()),!e)return[];const r=t instanceof Lh?t.getViewStateAndExtent():t;let s=e(r);return Array.isArray(s)||(s=[s]),s}render(t,e){const n=this.getRenderer();return n.prepareFrame(t)?(this.rendered=!0,n.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(rt.MAP,t)}getMapInternal(){return this.get(rt.MAP)}setMap(t){this.mapPrecomposeKey_&&(ye(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(ye(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=Ze(t,Kt.PRECOMPOSE,function(e){const r=e.frameState.layerStatesArray,s=this.getLayerState(!1);Lt(!r.some(function(o){return o.layer===s.layer}),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),r.push(s)},this),this.mapRenderKey_=Ze(this,wt.CHANGE,t.render,t),this.changed())}setSource(t){this.set(rt.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}disposeInternal(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),super.disposeInternal()}}function ap(i,t){if(!i.visible)return!1;const e=t.resolution;if(e<i.minResolution||e>=i.maxResolution)return!1;const n=t.zoom;return n>i.minZoom&&n<=i.maxZoom}const jr={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class lp extends Oh{constructor(t){t=t||{};const e=Object.assign({},t),n=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=n,this.setPreload(t.preload!==void 0?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(jr.PRELOAD)}setPreload(t){this.set(jr.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(jr.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(jr.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}const Ph=.5,$={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class jo extends Or{constructor(t,e,n){super(),n=n||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(wt.CHANGE)}release(){this.state===$.ERROR&&this.setState($.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==$.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){nt()}getAlpha(t,e){if(!this.transition_)return 1;let n=this.transitionStarts_[t];if(!n)n=e,this.transitionStarts_[t]=n;else if(n===-1)return 1;const r=e-n+1e3/60;return r>=this.transition_?1:ph(r/this.transition_)}inTransition(t){return this.transition_?this.transitionStarts_[t]!==-1:!1}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}}const Je=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"";Je.includes("firefox");const hp=Je.includes("safari")&&!Je.includes("chrom")&&(Je.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(Je));Je.includes("webkit")&&Je.includes("edge"),Je.includes("macintosh");const $h=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Nh=typeof Image<"u"&&Image.prototype.decode;(function(){let i=!1;try{const t=Object.defineProperty({},"passive",{get:function(){i=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return i})();function Et(i,t,e,n){let r;return e&&e.length?r=e.shift():$h?r=new OffscreenCanvas(i||300,t||300):r=document.createElement("canvas"),i&&(r.width=i),t&&(r.height=t),r.getContext("2d",n)}let Zo;function Zr(){return Zo||(Zo=Et(1,1)),Zo}function Yi(i){const t=i.canvas;t.width=1,t.height=1,i.clearRect(0,0,1,1)}function qr(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}function qo(i){return i instanceof Uint8Array||i instanceof Uint8ClampedArray||i instanceof Float32Array||i instanceof DataView?i:null}const cp=new Error("disposed");let ji=null;function up(i){ji||(ji=Et(i.width,i.height,void 0,{willReadFrequently:!0}));const t=ji.canvas,e=i.width;t.width!==e&&(t.width=e);const n=i.height;return t.height!==n&&(t.height=n),ji.clearRect(0,0,e,n),ji.drawImage(i,0,0),ji.getImageData(0,0,e,n).data}const dp=[256,256];class kh extends jo{constructor(t){const e=$.IDLE;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;const t=qr(this.data_);return t?[t.width,t.height]:dp}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==$.IDLE&&this.state!==$.ERROR)return;this.state=$.LOADING,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=$.LOADED,t.changed()}).catch(function(e){t.error_=e,t.state=$.ERROR,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(cp),this.controller_=null),super.disposeInternal()}}const fp=10,Fh=.25;class Bh{constructor(t,e,n,r,s,o){this.sourceProj_=t,this.targetProj_=e;let a={};const l=Wr(this.targetProj_,this.sourceProj_);this.transformInv_=function(m){const x=m[0]+"/"+m[1];return a[x]||(a[x]=l(m)),a[x]},this.maxSourceExtent_=r,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&ht(r)>=ht(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?ht(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?ht(this.targetProj_.getExtent()):null;const h=Ur(n),c=$o(n),u=Po(n),d=Oo(n),f=this.transformInv_(h),g=this.transformInv_(c),p=this.transformInv_(u),_=this.transformInv_(d),y=fp+(o?Math.max(0,Math.ceil(Math.log2(kn(n)/(o*o*256*256)))):0);if(this.addQuad_(h,c,u,d,f,g,p,_,y),this.wrapsXInSource_){let m=1/0;this.triangles_.forEach(function(x,E,T){m=Math.min(m,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])-m>this.sourceWorldWidth_/2){const E=[[x.source[0][0],x.source[0][1]],[x.source[1][0],x.source[1][1]],[x.source[2][0],x.source[2][1]]];E[0][0]-m>this.sourceWorldWidth_/2&&(E[0][0]-=this.sourceWorldWidth_),E[1][0]-m>this.sourceWorldWidth_/2&&(E[1][0]-=this.sourceWorldWidth_),E[2][0]-m>this.sourceWorldWidth_/2&&(E[2][0]-=this.sourceWorldWidth_);const T=Math.min(E[0][0],E[1][0],E[2][0]);Math.max(E[0][0],E[1][0],E[2][0])-T<this.sourceWorldWidth_/2&&(x.source=E)}})}a={}}addTriangle_(t,e,n,r,s,o){this.triangles_.push({source:[r,s,o],target:[t,e,n]})}addQuad_(t,e,n,r,s,o,a,l,h){const c=Ao([s,o,a,l]),u=this.sourceWorldWidth_?ht(c)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&u>.5&&u<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const _=Ao([t,e,n,r]);g=ht(_)/this.targetWorldWidth_>Fh||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>Fh||g)}if(!g&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!Qt(c,this.maxSourceExtent_))return;let p=0;if(!g&&(!isFinite(s[0])||!isFinite(s[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)g=!0;else if(p=(!isFinite(s[0])||!isFinite(s[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),p!=1&&p!=2&&p!=4&&p!=8)return}if(h>0){if(!g){const _=[(t[0]+n[0])/2,(t[1]+n[1])/2],y=this.transformInv_(_);let m;f?m=(Ln(s[0],d)+Ln(a[0],d))/2-Ln(y[0],d):m=(s[0]+a[0])/2-y[0];const x=(s[1]+a[1])/2-y[1];g=m*m+x*x>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-n[0])<=Math.abs(t[1]-n[1])){const _=[(e[0]+n[0])/2,(e[1]+n[1])/2],y=this.transformInv_(_),m=[(r[0]+t[0])/2,(r[1]+t[1])/2],x=this.transformInv_(m);this.addQuad_(t,e,_,m,s,o,y,x,h-1),this.addQuad_(m,_,n,r,x,y,a,l,h-1)}else{const _=[(t[0]+e[0])/2,(t[1]+e[1])/2],y=this.transformInv_(_),m=[(n[0]+r[0])/2,(n[1]+r[1])/2],x=this.transformInv_(m);this.addQuad_(t,_,m,r,s,y,x,l,h-1),this.addQuad_(_,e,n,m,y,o,a,x,h-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}p&11||this.addTriangle_(t,n,r,s,a,l),p&14||this.addTriangle_(t,n,e,s,a,o),p&&(p&13||this.addTriangle_(e,r,t,o,l,s),p&7||this.addTriangle_(e,r,n,o,l,a))}calculateSourceExtent(){const t=Ee();return this.triangles_.forEach(function(e,n,r){const s=e.source;Nn(t,s[0]),Nn(t,s[1]),Nn(t,s[2])}),t}getTriangles(){return this.triangles_}}let Ko;const Le=[];function Uh(i,t,e,n,r){i.beginPath(),i.moveTo(0,0),i.lineTo(t,e),i.lineTo(n,r),i.closePath(),i.save(),i.clip(),i.fillRect(0,0,Math.max(t,n)+1,Math.max(e,r)),i.restore()}function Jo(i,t){return Math.abs(i[t*4]-210)>2||Math.abs(i[t*4+3]-.75*255)>2}function gp(){if(Ko===void 0){const i=Et(6,6,Le);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",Uh(i,4,5,4,0),Uh(i,4,5,0,5);const t=i.getImageData(0,0,3,3).data;Ko=Jo(t,0)||Jo(t,4)||Jo(t,8),Yi(i),Le.push(i.canvas)}return Ko}function Xh(i,t,e,n){const r=yg(e,t,i);let s=hh(t,n,e);const o=t.getMetersPerUnit();o!==void 0&&(s*=o);const a=i.getMetersPerUnit();a!==void 0&&(s/=a);const l=i.getExtent();if(!l||Hi(l,r)){const h=hh(i,s,r)/s;isFinite(h)&&h>0&&(s/=h)}return s}function Gh(i,t,e,n){const r=zi(e);let s=Xh(i,t,r,n);return(!isFinite(s)||s<=0)&&nh(e,function(o){return s=Xh(i,t,o,n),isFinite(s)&&s>0}),s}function Wh(i,t,e,n,r,s,o,a,l,h,c,u,d,f){const g=Et(Math.round(e*i),Math.round(e*t),Le);if(u||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(e,e);function p(T){return Math.round(T*e)/e}g.globalCompositeOperation="lighter";const _=Ee();l.forEach(function(T,b,w){ig(_,T.extent)});let y;const m=e/n,x=(u?1:1+Math.pow(2,-24))/m;if(!d||l.length!==1||h!==0){if(y=Et(Math.round(ht(_)*m),Math.round(Jt(_)*m),Le),u||(y.imageSmoothingEnabled=!1),r&&f){const T=(r[0]-_[0])*m,b=-(r[3]-_[3])*m,w=ht(r)*m,S=Jt(r)*m;y.rect(T,b,w,S),y.clip()}l.forEach(function(T,b,w){if(T.image.width>0&&T.image.height>0){if(T.clipExtent){y.save();const D=(T.clipExtent[0]-_[0])*m,k=-(T.clipExtent[3]-_[3])*m,L=ht(T.clipExtent)*m,F=Jt(T.clipExtent)*m;y.rect(u?D:Math.round(D),u?k:Math.round(k),u?L:Math.round(D+L)-Math.round(D),u?F:Math.round(k+F)-Math.round(k)),y.clip()}const S=(T.extent[0]-_[0])*m,R=-(T.extent[3]-_[3])*m,P=ht(T.extent)*m,M=Jt(T.extent)*m;y.drawImage(T.image,h,h,T.image.width-2*h,T.image.height-2*h,u?S:Math.round(S),u?R:Math.round(R),u?P:Math.round(S+P)-Math.round(S),u?M:Math.round(R+M)-Math.round(R)),T.clipExtent&&y.restore()}})}const E=Ur(o);return a.getTriangles().forEach(function(T,b,w){const S=T.source,R=T.target;let P=S[0][0],M=S[0][1],D=S[1][0],k=S[1][1],L=S[2][0],F=S[2][1];const A=p((R[0][0]-E[0])/s),Y=p(-(R[0][1]-E[1])/s),j=p((R[1][0]-E[0])/s),ct=p(-(R[1][1]-E[1])/s),J=p((R[2][0]-E[0])/s),lt=p(-(R[2][1]-E[1])/s),ft=P,ae=M;P=0,M=0,D-=ft,k-=ae,L-=ft,F-=ae;const I=[[D,k,0,0,j-A],[L,F,0,0,J-A],[0,0,D,k,ct-Y],[0,0,L,F,lt-Y]],Be=Uf(I);if(!Be)return;if(g.save(),g.beginPath(),gp()||!u){g.moveTo(j,ct);const ee=4,Ci=A-j,Xs=Y-ct;for(let we=0;we<ee;we++)g.lineTo(j+p((we+1)*Ci/ee),ct+p(we*Xs/(ee-1))),we!=ee-1&&g.lineTo(j+p((we+1)*Ci/ee),ct+p((we+1)*Xs/(ee-1)));g.lineTo(J,lt)}else g.moveTo(j,ct),g.lineTo(A,Y),g.lineTo(J,lt);g.clip(),g.transform(Be[0],Be[2],Be[1],Be[3],A,Y),g.translate(_[0]-ft,_[3]-ae);let Ue;if(y)Ue=y.canvas,g.scale(x,-x);else{const ee=l[0],Ci=ee.extent;Ue=ee.image,g.scale(ht(Ci)/Ue.width,-Jt(Ci)/Ue.height)}g.drawImage(Ue,0,0),g.restore()}),y&&(Yi(y),Le.push(y.canvas)),c&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEach(function(T,b,w){const S=T.target,R=(S[0][0]-E[0])/s,P=-(S[0][1]-E[1])/s,M=(S[1][0]-E[0])/s,D=-(S[1][1]-E[1])/s,k=(S[2][0]-E[0])/s,L=-(S[2][1]-E[1])/s;g.beginPath(),g.moveTo(M,D),g.lineTo(R,P),g.lineTo(k,L),g.closePath(),g.stroke()}),g.restore()),g.canvas}class Hh extends kh{constructor(t){super({tileCoord:t.tileCoord,loader:()=>Promise.resolve(new Uint8ClampedArray(4)),interpolate:t.interpolate,transition:t.transition}),this.pixelRatio_=t.pixelRatio,this.gutter_=t.gutter,this.reprojData_=null,this.reprojError_=null,this.reprojSize_=void 0,this.sourceTileGrid_=t.sourceTileGrid,this.targetTileGrid_=t.targetTileGrid,this.wrappedTileCoord_=t.wrappedTileCoord||t.tileCoord,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const e=t.sourceProj,n=e.getExtent(),r=t.sourceTileGrid.getExtent();this.clipExtent_=e.canWrapX()?r?xe(n,r):n:r;const s=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),o=this.targetTileGrid_.getExtent();let a=this.sourceTileGrid_.getExtent();const l=o?xe(s,o):s;if(kn(l)===0){this.state=$.EMPTY;return}n&&(a?a=xe(a,n):a=n);const h=this.targetTileGrid_.getResolution(this.wrappedTileCoord_[0]),c=t.targetProj,u=Gh(e,c,l,h);if(!isFinite(u)||u<=0){this.state=$.EMPTY;return}const d=t.errorThreshold!==void 0?t.errorThreshold:Ph;if(this.triangulation_=new Bh(e,c,l,a,u*d,h),this.triangulation_.getTriangles().length===0){this.state=$.EMPTY;return}this.sourceZ_=this.sourceTileGrid_.getZForResolution(u);let f=this.triangulation_.calculateSourceExtent();if(a&&(e.canWrapX()?(f[1]=vt(f[1],a[1],a[3]),f[3]=vt(f[3],a[1],a[3])):f=xe(f,a)),!kn(f))this.state=$.EMPTY;else{let g=0,p=0;e.canWrapX()&&(g=ht(n),p=Math.floor((f[0]-n[0])/g)),sh(f.slice(),e,!0).forEach(y=>{const m=this.sourceTileGrid_.getTileRangeForExtentAndZ(y,this.sourceZ_),x=t.getTileFunction;for(let E=m.minX;E<=m.maxX;E++)for(let T=m.minY;T<=m.maxY;T++){const b=x(this.sourceZ_,E,T,this.pixelRatio_);if(b){const w=p*g;this.sourceTiles_.push({tile:b,offset:w})}}++p}),this.sourceTiles_.length===0&&(this.state=$.EMPTY)}}getSize(){return this.reprojSize_}getData(){return this.reprojData_}getError(){return this.reprojError_}reproject_(){const t=[];let e=!1;if(this.sourceTiles_.forEach(g=>{var Y;const p=g.tile;if(!p||p.getState()!==$.LOADED)return;const _=p.getSize(),y=this.gutter_;let m;const x=qo(p.getData());x?m=x:(e=!0,m=up(qr(p.getData())));const E=[_[0]+2*y,_[1]+2*y],T=m instanceof Float32Array,b=E[0]*E[1],w=T?Float32Array:Uint8ClampedArray,S=new w(m.buffer),R=w.BYTES_PER_ELEMENT,P=R*S.length/b,M=S.byteLength/E[1],D=Math.floor(M/R/E[0]),k=b*D;let L=S;if(S.length!==k){L=new w(k);let j=0,ct=0;const J=E[0]*D;for(let lt=0;lt<E[1];++lt){for(let ft=0;ft<J;++ft)L[j++]=S[ct+ft];ct+=M/R}}const F=this.sourceTileGrid_.getTileCoordExtent(p.tileCoord);F[0]+=g.offset,F[2]+=g.offset;const A=(Y=this.clipExtent_)==null?void 0:Y.slice();A&&(A[0]+=g.offset,A[2]+=g.offset),t.push({extent:F,clipExtent:A,data:new Uint8ClampedArray(L.buffer),dataType:w,bytesPerPixel:P,pixelSize:E})}),this.sourceTiles_.length=0,t.length===0){this.state=$.ERROR,this.changed();return}const n=this.wrappedTileCoord_[0],r=this.targetTileGrid_.getTileSize(n),s=typeof r=="number"?r:r[0],o=typeof r=="number"?r:r[1],a=this.targetTileGrid_.getResolution(n),l=this.sourceTileGrid_.getResolution(this.sourceZ_),h=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);let c,u;const d=t[0].bytesPerPixel,f=Math.ceil(d/3);for(let g=f-1;g>=0;--g){const p=[];for(let T=0,b=t.length;T<b;++T){const w=t[T],S=w.data,R=w.pixelSize,P=R[0],M=R[1],D=Et(P,M,Le),k=D.createImageData(P,M),L=k.data;let F=g*3;for(let A=0,Y=L.length;A<Y;A+=4)L[A]=S[F],L[A+1]=S[F+1],L[A+2]=S[F+2],L[A+3]=255,F+=d;D.putImageData(k,0,0),p.push({extent:w.extent,clipExtent:w.clipExtent,image:D.canvas})}const _=Wh(s,o,this.pixelRatio_,l,this.sourceTileGrid_.getExtent(),a,h,this.triangulation_,p,this.gutter_,!1,!1,!1);for(let T=0,b=p.length;T<b;++T){const S=p[T].image.getContext("2d");Yi(S),Le.push(S.canvas)}const y=_.getContext("2d"),m=y.getImageData(0,0,_.width,_.height);Yi(y),Le.push(_),c||(u=new Uint8ClampedArray(d*m.width*m.height),c=new t[0].dataType(u.buffer));const x=m.data;let E=g*3;for(let T=0,b=x.length;T<b;T+=4)x[T+3]===255?(u[E]=x[T],u[E+1]=x[T+1],u[E+2]=x[T+2]):(u[E]=0,u[E+1]=0,u[E+2]=0),E+=d}if(e){const g=Et(s,o),p=new ImageData(c,s);g.putImageData(p,0,0),this.reprojData_=g.canvas}else this.reprojData_=c;this.reprojSize_=[Math.round(s*this.pixelRatio_),Math.round(o*this.pixelRatio_)],this.state=$.LOADED,this.changed()}load(){if(this.state!==$.IDLE&&this.state!==$.ERROR)return;this.state=$.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const n=e.getState();if(n!==$.IDLE&&n!==$.LOADING)return;t++;const r=Ze(e,wt.CHANGE,function(){const s=e.getState();(s==$.LOADED||s==$.ERROR||s==$.EMPTY)&&(ye(r),t--,t===0&&(this.unlistenSources_(),this.reproject_()))},this);this.sourcesListenerKeys_.push(r)}),t===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:e}){e.getState()==$.IDLE&&e.load()})}unlistenSources_(){this.sourcesListenerKeys_.forEach(ye),this.sourcesListenerKeys_=null}}class Qo extends jo{constructor(t,e,n,r,s,o,a,l,h,c,u,d){super(s,$.IDLE,d),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=r,this.wrappedTileCoord_=o||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const f=r.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let p=this.sourceTileGrid_.getExtent();const _=g?xe(f,g):f;if(kn(_)===0){this.state=$.EMPTY;return}const y=t.getExtent();y&&(p?p=xe(p,y):p=y);const m=r.getResolution(this.wrappedTileCoord_[0]),x=Gh(t,n,_,m);if(!isFinite(x)||x<=0){this.state=$.EMPTY;return}const E=c!==void 0?c:Ph;if(this.triangulation_=new Bh(t,n,_,p,x*E,m),this.triangulation_.getTriangles().length===0){this.state=$.EMPTY;return}this.sourceZ_=e.getZForResolution(x);let T=this.triangulation_.calculateSourceExtent();if(p&&(t.canWrapX()?(T[1]=vt(T[1],p[1],p[3]),T[3]=vt(T[3],p[1],p[3])):T=xe(T,p)),!kn(T))this.state=$.EMPTY;else{let b=0,w=0;t.canWrapX()&&(b=ht(y),w=Math.floor((T[0]-y[0])/b)),sh(T.slice(),t,!0).forEach(R=>{const P=e.getTileRangeForExtentAndZ(R,this.sourceZ_);for(let M=P.minX;M<=P.maxX;M++)for(let D=P.minY;D<=P.maxY;D++){const k=h(this.sourceZ_,M,D,a);if(k){const L=w*b;this.sourceTiles_.push({tile:k,offset:L})}}++w}),this.sourceTiles_.length===0&&(this.state=$.EMPTY)}}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{var r;const n=e.tile;if(n&&n.getState()==$.LOADED){const s=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);s[0]+=e.offset,s[2]+=e.offset;const o=(r=this.clipExtent_)==null?void 0:r.slice();o&&(o[0]+=e.offset,o[2]+=e.offset),t.push({extent:s,clipExtent:o,image:n.getImage()})}}),this.sourceTiles_.length=0,t.length===0)this.state=$.ERROR;else{const e=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(e),r=typeof n=="number"?n:n[0],s=typeof n=="number"?n:n[1],o=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Wh(r,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=$.LOADED}this.changed()}load(){if(this.state==$.IDLE){this.state=$.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const n=e.getState();if(n==$.IDLE||n==$.LOADING){t++;const r=Ze(e,wt.CHANGE,function(s){const o=e.getState();(o==$.LOADED||o==$.ERROR||o==$.EMPTY)&&(ye(r),t--,t===0&&(this.unlistenSources_(),this.reproject_()))},this);this.sourcesListenerKeys_.push(r)}}),t===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:e},n,r){e.getState()==$.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(ye),this.sourcesListenerKeys_=null}release(){this.canvas_&&(Yi(this.canvas_.getContext("2d")),Le.push(this.canvas_),this.canvas_=null),super.release()}}const V={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function pp(i,t,e){const n=i;let r=!0,s=!1,o=!1;const a=[Pr(n,wt.LOAD,function(){o=!0,s||t()})];return n.src&&Nh?(s=!0,n.decode().then(function(){r&&t()}).catch(function(l){r&&(o?t():e())})):a.push(Pr(n,wt.ERROR,e)),function(){r=!1,a.forEach(ye)}}function _p(i,t){return new Promise((e,n)=>{function r(){o(),e(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),t&&(i.src=t)})}function mp(i,t){return t&&(i.src=t),i.src&&Nh?new Promise((e,n)=>i.decode().then(()=>e(i)).catch(r=>i.complete&&i.width?e(i):n(r))):_p(i)}class zh extends jo{constructor(t,e,n,r,s,o){super(t,e,o),this.crossOrigin_=r,this.src_=n,this.key=n,this.image_=new Image,r!==null&&(this.image_.crossOrigin=r),this.unlisten_=null,this.tileLoadFunction_=s}getImage(){return this.image_}setImage(t){this.image_=t,this.state=$.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=$.ERROR,this.unlistenImage_(),this.image_=yp(),this.changed()}handleImageLoad_(){const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=$.LOADED:this.state=$.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==$.ERROR&&(this.state=$.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==$.IDLE&&(this.state=$.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=pp(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function yp(){const i=Et(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}class Ep extends Or{constructor(t){super(),this.tile,this.handleTileChange_=this.handleTileChange_.bind(this),this.gutter_=t.gutter||0,this.helper_=t.helper,this.loaded=!1,this.ready=!1}setTile(t){if(t!==this.tile)if(this.tile&&this.tile.removeEventListener(wt.CHANGE,this.handleTileChange_),this.tile=t,this.loaded=t.getState()===$.LOADED,this.loaded)this.uploadTile();else{if(t instanceof zh){const e=t.getImage();e instanceof Image&&!e.crossOrigin&&(e.crossOrigin="anonymous")}t.addEventListener(wt.CHANGE,this.handleTileChange_)}}uploadTile(){nt()}setReady(){this.ready=!0,this.dispatchEvent(wt.CHANGE)}handleTileChange_(){this.tile.getState()===$.LOADED&&(this.loaded=!0,this.uploadTile())}disposeInternal(){this.tile.removeEventListener(wt.CHANGE,this.handleTileChange_)}}const ta=34962,ea=34963,xp=35040,ia=35044,Tp=35048,vp=5121,bp=5123,wp=5125,Vh=5126,Yh=["experimental-webgl","webgl","webkit-3d","moz-webgl"];function Sp(i,t){t=Object.assign({preserveDrawingBuffer:!0,antialias:!hp},t);const e=Yh.length;for(let n=0;n<e;++n)try{const r=i.getContext(Yh[n],t);if(r)return r}catch{}return null}const Rp={STATIC_DRAW:ia,STREAM_DRAW:xp,DYNAMIC_DRAW:Tp};class jh{constructor(t,e){this.array_=null,this.type_=t,Lt(t===ta||t===ea,"A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`"),this.usage_=e!==void 0?e:Rp.STATIC_DRAW}ofSize(t){return this.array_=new(na(this.type_))(t),this}fromArray(t){return this.array_=na(this.type_).from(t),this}fromArrayBuffer(t){return this.array_=new(na(this.type_))(t),this}getType(){return this.type_}getArray(){return this.array_}getUsage(){return this.usage_}getSize(){return this.array_?this.array_.length:0}}function na(i){switch(i){case ta:return Float32Array;case ea:return Uint32Array;default:return Float32Array}}function Te(i,t){return Array.isArray(i)?i:(t===void 0?t=[i,i]:(t[0]=i,t[1]=i),t)}function Zh(i,t,e){const n=e?i.LINEAR:i.NEAREST;i.bindTexture(i.TEXTURE_2D,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,n),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,n)}function Cp(i,t,e,n){Zh(i,t,n),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,e)}function qh(i,t,e,n,r,s){const o=i.getGL();let a,l;e instanceof Float32Array?(a=o.FLOAT,i.getExtension("OES_texture_float"),l=i.getExtension("OES_texture_float_linear")!==null):(a=o.UNSIGNED_BYTE,l=!0),Zh(o,t,s&&l);const h=e.byteLength/n[1];let c=1;h%8===0?c=8:h%4===0?c=4:h%2===0&&(c=2);let u;switch(r){case 1:{u=o.LUMINANCE;break}case 2:{u=o.LUMINANCE_ALPHA;break}case 3:{u=o.RGB;break}case 4:{u=o.RGBA;break}default:throw new Error(`Unsupported number of bands: ${r}`)}const d=o.getParameter(o.UNPACK_ALIGNMENT);o.pixelStorei(o.UNPACK_ALIGNMENT,c),o.texImage2D(o.TEXTURE_2D,0,u,n[0],n[1],0,u,a,e),o.pixelStorei(o.UNPACK_ALIGNMENT,d)}let Zi=null;function Ip(){Zi=Et(1,1,void 0,{willReadFrequently:!0})}class Ap extends Ep{constructor(t){super(t),this.textures=[],this.renderSize_=Te(t.grid.getTileSize(t.tile.tileCoord[0])),this.bandCount=NaN;const e=new jh(ta,ia);e.fromArray([0,1,1,1,1,0,0,0]),this.helper_.flushBufferData(e),this.coords=e,this.setTile(t.tile)}uploadTile(){const t=this.helper_,e=t.getGL(),n=this.tile;this.textures.length=0;let r;n instanceof zh||n instanceof Qo?r=n.getImage():r=n.getData();const s=qr(r);if(s){const m=e.createTexture();this.textures.push(m),this.bandCount=4,Cp(e,m,s,n.interpolate),this.setReady();return}r=qo(r);const o=n.getSize(),a=[o[0]+2*this.gutter_,o[1]+2*this.gutter_],l=r instanceof Float32Array,h=a[0]*a[1],c=l?Float32Array:Uint8Array,u=c.BYTES_PER_ELEMENT,d=r.byteLength/a[1];this.bandCount=Math.floor(d/u/a[0]);const f=Math.ceil(this.bandCount/4);if(f===1){const m=e.createTexture();this.textures.push(m),qh(t,m,r,a,this.bandCount,n.interpolate),this.setReady();return}const g=new Array(f);for(let m=0;m<f;++m){const x=e.createTexture();this.textures.push(x);const E=m<f-1?4:(this.bandCount-1)%4+1;g[m]=new c(h*E)}let p=0,_=0;const y=a[0]*this.bandCount;for(let m=0;m<a[1];++m){for(let x=0;x<y;++x){const E=r[_+x],T=Math.floor(p/this.bandCount),b=x%this.bandCount,w=Math.floor(b/4),S=g[w],R=S.length/h,P=b%4;S[T*R+P]=E,++p}_+=d/u}for(let m=0;m<f;++m){const x=this.textures[m],E=g[m],T=E.length/h;qh(t,x,E,a,T,n.interpolate)}this.setReady()}disposeInternal(){const t=this.helper_.getGL();this.helper_.deleteBuffer(this.coords);for(let e=0;e<this.textures.length;++e)t.deleteTexture(this.textures[e]);this.tile.removeEventListener(wt.CHANGE,this.handleTileChange_)}getImagePixelData_(t,e,n){const r=this.gutter_,s=this.renderSize_[0],o=this.renderSize_[1];Zi||Ip(),Zi.clearRect(0,0,1,1);const a=t.width,l=t.height,h=a-2*r,c=l-2*r,u=r+Math.floor(h*(e/s)),d=r+Math.floor(c*(n/o));let f;try{Zi.drawImage(t,u,d,1,1,0,0,1,1),f=Zi.getImageData(0,0,1,1).data}catch{return Zi=null,null}return f}getArrayPixelData_(t,e,n,r){const s=this.gutter_,o=this.renderSize_[0],a=this.renderSize_[1],l=e[0],h=e[1],c=l+2*s,u=h+2*s,d=s+Math.floor(l*(n/o)),f=s+Math.floor(h*(r/a));if(t instanceof DataView){const p=t.byteLength/(c*u),_=p*(f*c+d),y=t.buffer.slice(_,_+p);return new DataView(y)}const g=this.bandCount*(f*c+d);return t.slice(g,g+this.bandCount)}getPixelData(t,e){if(!this.loaded)return null;if(this.tile instanceof kh){const n=this.tile.getData(),r=qo(n);if(r){const s=this.tile.getSize();return this.getArrayPixelData_(r,s,t,e)}return this.getImagePixelData_(qr(n),t,e)}return this.getImagePixelData_(this.tile.getImage(),t,e)}}class Mp{constructor(t){this.highWaterMark=t!==void 0?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.pop()}clear(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const n=this.entries_[t];return Lt(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(t){const e=this.entries_[t];return Lt(e!==void 0,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e=0,n;for(n=this.newest_;n;n=n.older)t[e++]=n.key_;return t}getValues(){const t=new Array(this.count_);let e=0,n;for(n=this.newest_;n;n=n.older)t[e++]=n.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){var e;return(e=this.entries_[t])==null?void 0:e.value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){Lt(!(t in this.entries_),"Tried to set a value for a key that is used already");const n={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[t]=n,++this.count_}setSize(t){this.highWaterMark=t}}class Dp{constructor(t,e,n,r){this.minX=t,this.maxX=e,this.minY=n,this.maxY=r}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}const Lp=5;class Kh extends Dn{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.declutterExecutorGroup=null,this.staleKeys_=new Array,this.maxStaleKeys=Lp}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return nt()}getData(t){return null}prepareFrame(t){return nt()}renderFrame(t,e){return nt()}forEachFeatureAtCoordinate(t,e,n,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;(e.getState()===V.LOADED||e.getState()===V.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=V.LOADED&&e!=V.ERROR&&t.addEventListener(wt.CHANGE,this.boundHandleImageChange_),e==V.IDLE&&(t.load(),e=t.getState()),e==V.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}class Kr extends So{constructor(t,e,n,r){super(t),this.inversePixelTransform=e,this.frameState=n,this.context=r}}const Jr={LOST:"webglcontextlost",RESTORED:"webglcontextrestored"},Op=`
45
+ */function oo(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),e.push.apply(e,i)}return e}function jt(n){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?oo(Object(e),!0).forEach(function(i){Yu(n,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):oo(Object(e)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(e,i))})}return n}function qn(n){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?qn=function(t){return typeof t}:qn=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qn(n)}function Yu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function te(){return te=Object.assign||function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},te.apply(this,arguments)}function Zu(n,t){if(n==null)return{};var e={},i=Object.keys(n),r,s;for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&(e[r]=n[r]);return e}function Ku(n,t){if(n==null)return{};var e=Zu(n,t),i,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(r=0;r<s.length;r++)i=s[r],!(t.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(e[i]=n[i])}return e}var qu="1.15.2";function ee(n){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(n)}var ne=ee(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),En=ee(/Edge/i),ao=ee(/firefox/i),bn=ee(/safari/i)&&!ee(/chrome/i)&&!ee(/android/i),lo=ee(/iP(ad|od|hone)/i),uo=ee(/chrome/i)&&ee(/android/i),co={capture:!1,passive:!1};function z(n,t,e){n.addEventListener(t,e,!ne&&co)}function H(n,t,e){n.removeEventListener(t,e,!ne&&co)}function Jn(n,t){if(t){if(t[0]===">"&&(t=t.substring(1)),n)try{if(n.matches)return n.matches(t);if(n.msMatchesSelector)return n.msMatchesSelector(t);if(n.webkitMatchesSelector)return n.webkitMatchesSelector(t)}catch{return!1}return!1}}function Ju(n){return n.host&&n!==document&&n.host.nodeType?n.host:n.parentNode}function Xt(n,t,e,i){if(n){e=e||document;do{if(t!=null&&(t[0]===">"?n.parentNode===e&&Jn(n,t):Jn(n,t))||i&&n===e)return n;if(n===e)break}while(n=Ju(n))}return null}var ho=/\s+/g;function Ot(n,t,e){if(n&&t)if(n.classList)n.classList[e?"add":"remove"](t);else{var i=(" "+n.className+" ").replace(ho," ").replace(" "+t+" "," ");n.className=(i+(e?" "+t:"")).replace(ho," ")}}function $(n,t,e){var i=n&&n.style;if(i){if(e===void 0)return document.defaultView&&document.defaultView.getComputedStyle?e=document.defaultView.getComputedStyle(n,""):n.currentStyle&&(e=n.currentStyle),t===void 0?e:e[t];!(t in i)&&t.indexOf("webkit")===-1&&(t="-webkit-"+t),i[t]=e+(typeof e=="string"?"":"px")}}function Fe(n,t){var e="";if(typeof n=="string")e=n;else do{var i=$(n,"transform");i&&i!=="none"&&(e=i+" "+e)}while(!t&&(n=n.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(e)}function fo(n,t,e){if(n){var i=n.getElementsByTagName(t),r=0,s=i.length;if(e)for(;r<s;r++)e(i[r],r);return i}return[]}function zt(){var n=document.scrollingElement;return n||document.documentElement}function lt(n,t,e,i,r){if(!(!n.getBoundingClientRect&&n!==window)){var s,o,a,l,u,h,c;if(n!==window&&n.parentNode&&n!==zt()?(s=n.getBoundingClientRect(),o=s.top,a=s.left,l=s.bottom,u=s.right,h=s.height,c=s.width):(o=0,a=0,l=window.innerHeight,u=window.innerWidth,h=window.innerHeight,c=window.innerWidth),(t||e)&&n!==window&&(r=r||n.parentNode,!ne))do if(r&&r.getBoundingClientRect&&($(r,"transform")!=="none"||e&&$(r,"position")!=="static")){var d=r.getBoundingClientRect();o-=d.top+parseInt($(r,"border-top-width")),a-=d.left+parseInt($(r,"border-left-width")),l=o+s.height,u=a+s.width;break}while(r=r.parentNode);if(i&&n!==window){var f=Fe(r||n),g=f&&f.a,p=f&&f.d;f&&(o/=p,a/=g,c/=g,h/=p,l=o+h,u=a+c)}return{top:o,left:a,bottom:l,right:u,width:c,height:h}}}function go(n,t,e){for(var i=ue(n,!0),r=lt(n)[t];i;){var s=lt(i)[e],o=void 0;if(e==="top"||e==="left"?o=r>=s:o=r<=s,!o)return i;if(i===zt())break;i=ue(i,!1)}return!1}function Be(n,t,e,i){for(var r=0,s=0,o=n.children;s<o.length;){if(o[s].style.display!=="none"&&o[s]!==P.ghost&&(i||o[s]!==P.dragged)&&Xt(o[s],e.draggable,n,!1)){if(r===t)return o[s];r++}s++}return null}function mr(n,t){for(var e=n.lastElementChild;e&&(e===P.ghost||$(e,"display")==="none"||t&&!Jn(e,t));)e=e.previousElementSibling;return e||null}function Ft(n,t){var e=0;if(!n||!n.parentNode)return-1;for(;n=n.previousElementSibling;)n.nodeName.toUpperCase()!=="TEMPLATE"&&n!==P.clone&&(!t||Jn(n,t))&&e++;return e}function po(n){var t=0,e=0,i=zt();if(n)do{var r=Fe(n),s=r.a,o=r.d;t+=n.scrollLeft*s,e+=n.scrollTop*o}while(n!==i&&(n=n.parentNode));return[t,e]}function Qu(n,t){for(var e in n)if(n.hasOwnProperty(e)){for(var i in t)if(t.hasOwnProperty(i)&&t[i]===n[e][i])return Number(e)}return-1}function ue(n,t){if(!n||!n.getBoundingClientRect)return zt();var e=n,i=!1;do if(e.clientWidth<e.scrollWidth||e.clientHeight<e.scrollHeight){var r=$(e);if(e.clientWidth<e.scrollWidth&&(r.overflowX=="auto"||r.overflowX=="scroll")||e.clientHeight<e.scrollHeight&&(r.overflowY=="auto"||r.overflowY=="scroll")){if(!e.getBoundingClientRect||e===document.body)return zt();if(i||t)return e;i=!0}}while(e=e.parentNode);return zt()}function tc(n,t){if(n&&t)for(var e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);return n}function _r(n,t){return Math.round(n.top)===Math.round(t.top)&&Math.round(n.left)===Math.round(t.left)&&Math.round(n.height)===Math.round(t.height)&&Math.round(n.width)===Math.round(t.width)}var vn;function mo(n,t){return function(){if(!vn){var e=arguments,i=this;e.length===1?n.call(i,e[0]):n.apply(i,e),vn=setTimeout(function(){vn=void 0},t)}}}function ec(){clearTimeout(vn),vn=void 0}function _o(n,t,e){n.scrollLeft+=t,n.scrollTop+=e}function yo(n){var t=window.Polymer,e=window.jQuery||window.Zepto;return t&&t.dom?t.dom(n).cloneNode(!0):e?e(n).clone(!0)[0]:n.cloneNode(!0)}function Eo(n,t,e){var i={};return Array.from(n.children).forEach(function(r){var s,o,a,l;if(!(!Xt(r,t.draggable,n,!1)||r.animated||r===e)){var u=lt(r);i.left=Math.min((s=i.left)!==null&&s!==void 0?s:1/0,u.left),i.top=Math.min((o=i.top)!==null&&o!==void 0?o:1/0,u.top),i.right=Math.max((a=i.right)!==null&&a!==void 0?a:-1/0,u.right),i.bottom=Math.max((l=i.bottom)!==null&&l!==void 0?l:-1/0,u.bottom)}}),i.width=i.right-i.left,i.height=i.bottom-i.top,i.x=i.left,i.y=i.top,i}var Lt="Sortable"+new Date().getTime();function nc(){var n=[],t;return{captureAnimationState:function(){if(n=[],!!this.options.animation){var i=[].slice.call(this.el.children);i.forEach(function(r){if(!($(r,"display")==="none"||r===P.ghost)){n.push({target:r,rect:lt(r)});var s=jt({},n[n.length-1].rect);if(r.thisAnimationDuration){var o=Fe(r,!0);o&&(s.top-=o.f,s.left-=o.e)}r.fromRect=s}})}},addAnimationState:function(i){n.push(i)},removeAnimationState:function(i){n.splice(Qu(n,{target:i}),1)},animateAll:function(i){var r=this;if(!this.options.animation){clearTimeout(t),typeof i=="function"&&i();return}var s=!1,o=0;n.forEach(function(a){var l=0,u=a.target,h=u.fromRect,c=lt(u),d=u.prevFromRect,f=u.prevToRect,g=a.rect,p=Fe(u,!0);p&&(c.top-=p.f,c.left-=p.e),u.toRect=c,u.thisAnimationDuration&&_r(d,c)&&!_r(h,c)&&(g.top-c.top)/(g.left-c.left)===(h.top-c.top)/(h.left-c.left)&&(l=rc(g,d,f,r.options)),_r(c,h)||(u.prevFromRect=h,u.prevToRect=c,l||(l=r.options.animation),r.animate(u,g,c,l)),l&&(s=!0,o=Math.max(o,l),clearTimeout(u.animationResetTimer),u.animationResetTimer=setTimeout(function(){u.animationTime=0,u.prevFromRect=null,u.fromRect=null,u.prevToRect=null,u.thisAnimationDuration=null},l),u.thisAnimationDuration=l)}),clearTimeout(t),s?t=setTimeout(function(){typeof i=="function"&&i()},o):typeof i=="function"&&i(),n=[]},animate:function(i,r,s,o){if(o){$(i,"transition",""),$(i,"transform","");var a=Fe(this.el),l=a&&a.a,u=a&&a.d,h=(r.left-s.left)/(l||1),c=(r.top-s.top)/(u||1);i.animatingX=!!h,i.animatingY=!!c,$(i,"transform","translate3d("+h+"px,"+c+"px,0)"),this.forRepaintDummy=ic(i),$(i,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),$(i,"transform","translate3d(0,0,0)"),typeof i.animated=="number"&&clearTimeout(i.animated),i.animated=setTimeout(function(){$(i,"transition",""),$(i,"transform",""),i.animated=!1,i.animatingX=!1,i.animatingY=!1},o)}}}}function ic(n){return n.offsetWidth}function rc(n,t,e,i){return Math.sqrt(Math.pow(t.top-n.top,2)+Math.pow(t.left-n.left,2))/Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))*i.animation}var Xe=[],yr={initializeByDefault:!0},Tn={mount:function(t){for(var e in yr)yr.hasOwnProperty(e)&&!(e in t)&&(t[e]=yr[e]);Xe.forEach(function(i){if(i.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")}),Xe.push(t)},pluginEvent:function(t,e,i){var r=this;this.eventCanceled=!1,i.cancel=function(){r.eventCanceled=!0};var s=t+"Global";Xe.forEach(function(o){e[o.pluginName]&&(e[o.pluginName][s]&&e[o.pluginName][s](jt({sortable:e},i)),e.options[o.pluginName]&&e[o.pluginName][t]&&e[o.pluginName][t](jt({sortable:e},i)))})},initializePlugins:function(t,e,i,r){Xe.forEach(function(a){var l=a.pluginName;if(!(!t.options[l]&&!a.initializeByDefault)){var u=new a(t,e,t.options);u.sortable=t,u.options=t.options,t[l]=u,te(i,u.defaults)}});for(var s in t.options)if(t.options.hasOwnProperty(s)){var o=this.modifyOption(t,s,t.options[s]);typeof o<"u"&&(t.options[s]=o)}},getEventProperties:function(t,e){var i={};return Xe.forEach(function(r){typeof r.eventProperties=="function"&&te(i,r.eventProperties.call(e[r.pluginName],t))}),i},modifyOption:function(t,e,i){var r;return Xe.forEach(function(s){t[s.pluginName]&&s.optionListeners&&typeof s.optionListeners[e]=="function"&&(r=s.optionListeners[e].call(t[s.pluginName],i))}),r}};function sc(n){var t=n.sortable,e=n.rootEl,i=n.name,r=n.targetEl,s=n.cloneEl,o=n.toEl,a=n.fromEl,l=n.oldIndex,u=n.newIndex,h=n.oldDraggableIndex,c=n.newDraggableIndex,d=n.originalEvent,f=n.putSortable,g=n.extraEventProperties;if(t=t||e&&e[Lt],!!t){var p,m=t.options,y="on"+i.charAt(0).toUpperCase()+i.substr(1);window.CustomEvent&&!ne&&!En?p=new CustomEvent(i,{bubbles:!0,cancelable:!0}):(p=document.createEvent("Event"),p.initEvent(i,!0,!0)),p.to=o||e,p.from=a||e,p.item=r||e,p.clone=s,p.oldIndex=l,p.newIndex=u,p.oldDraggableIndex=h,p.newDraggableIndex=c,p.originalEvent=d,p.pullMode=f?f.lastPutMode:void 0;var _=jt(jt({},g),Tn.getEventProperties(i,t));for(var T in _)p[T]=_[T];e&&e.dispatchEvent(p),m[y]&&m[y].call(t,p)}}var oc=["evt"],At=function(t,e){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=i.evt,s=Ku(i,oc);Tn.pluginEvent.bind(P)(t,e,jt({dragEl:R,parentEl:rt,ghostEl:O,rootEl:et,nextEl:Ce,lastDownEl:Qn,cloneEl:it,cloneHidden:ce,dragStarted:Rn,putSortable:_t,activeSortable:P.active,originalEvent:r,oldIndex:He,oldDraggableIndex:xn,newIndex:Dt,newDraggableIndex:he,hideGhostForTarget:Co,unhideGhostForTarget:So,cloneNowHidden:function(){ce=!0},cloneNowShown:function(){ce=!1},dispatchSortableEvent:function(a){xt({sortable:e,name:a,originalEvent:r})}},s))};function xt(n){sc(jt({putSortable:_t,cloneEl:it,targetEl:R,rootEl:et,oldIndex:He,oldDraggableIndex:xn,newIndex:Dt,newDraggableIndex:he},n))}var R,rt,O,et,Ce,Qn,it,ce,He,Dt,xn,he,ti,_t,Ge=!1,ei=!1,ni=[],Se,Ht,Er,br,bo,vo,Rn,ke,wn,Cn=!1,ii=!1,ri,Tt,vr=[],Tr=!1,si=[],oi=typeof document<"u",ai=lo,To=En||ne?"cssFloat":"float",ac=oi&&!uo&&!lo&&"draggable"in document.createElement("div"),xo=function(){if(oi){if(ne)return!1;var n=document.createElement("x");return n.style.cssText="pointer-events:auto",n.style.pointerEvents==="auto"}}(),Ro=function(t,e){var i=$(t),r=parseInt(i.width)-parseInt(i.paddingLeft)-parseInt(i.paddingRight)-parseInt(i.borderLeftWidth)-parseInt(i.borderRightWidth),s=Be(t,0,e),o=Be(t,1,e),a=s&&$(s),l=o&&$(o),u=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+lt(s).width,h=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+lt(o).width;if(i.display==="flex")return i.flexDirection==="column"||i.flexDirection==="column-reverse"?"vertical":"horizontal";if(i.display==="grid")return i.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(s&&a.float&&a.float!=="none"){var c=a.float==="left"?"left":"right";return o&&(l.clear==="both"||l.clear===c)?"vertical":"horizontal"}return s&&(a.display==="block"||a.display==="flex"||a.display==="table"||a.display==="grid"||u>=r&&i[To]==="none"||o&&i[To]==="none"&&u+h>r)?"vertical":"horizontal"},lc=function(t,e,i){var r=i?t.left:t.top,s=i?t.right:t.bottom,o=i?t.width:t.height,a=i?e.left:e.top,l=i?e.right:e.bottom,u=i?e.width:e.height;return r===a||s===l||r+o/2===a+u/2},uc=function(t,e){var i;return ni.some(function(r){var s=r[Lt].options.emptyInsertThreshold;if(!(!s||mr(r))){var o=lt(r),a=t>=o.left-s&&t<=o.right+s,l=e>=o.top-s&&e<=o.bottom+s;if(a&&l)return i=r}}),i},wo=function(t){function e(s,o){return function(a,l,u,h){var c=a.options.group.name&&l.options.group.name&&a.options.group.name===l.options.group.name;if(s==null&&(o||c))return!0;if(s==null||s===!1)return!1;if(o&&s==="clone")return s;if(typeof s=="function")return e(s(a,l,u,h),o)(a,l,u,h);var d=(o?a:l).options.group.name;return s===!0||typeof s=="string"&&s===d||s.join&&s.indexOf(d)>-1}}var i={},r=t.group;(!r||qn(r)!="object")&&(r={name:r}),i.name=r.name,i.checkPull=e(r.pull,!0),i.checkPut=e(r.put),i.revertClone=r.revertClone,t.group=i},Co=function(){!xo&&O&&$(O,"display","none")},So=function(){!xo&&O&&$(O,"display","")};oi&&!uo&&document.addEventListener("click",function(n){if(ei)return n.preventDefault(),n.stopPropagation&&n.stopPropagation(),n.stopImmediatePropagation&&n.stopImmediatePropagation(),ei=!1,!1},!0);var Ae=function(t){if(R){t=t.touches?t.touches[0]:t;var e=uc(t.clientX,t.clientY);if(e){var i={};for(var r in t)t.hasOwnProperty(r)&&(i[r]=t[r]);i.target=i.rootEl=e,i.preventDefault=void 0,i.stopPropagation=void 0,e[Lt]._onDragOver(i)}}},cc=function(t){R&&R.parentNode[Lt]._isOutsideThisEl(t.target)};function P(n,t){if(!(n&&n.nodeType&&n.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(n));this.el=n,this.options=t=te({},t),n[Lt]=this;var e={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(n.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Ro(n,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(o,a){o.setData("Text",a.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:P.supportPointer!==!1&&"PointerEvent"in window&&!bn,emptyInsertThreshold:5};Tn.initializePlugins(this,n,e);for(var i in e)!(i in t)&&(t[i]=e[i]);wo(t);for(var r in this)r.charAt(0)==="_"&&typeof this[r]=="function"&&(this[r]=this[r].bind(this));this.nativeDraggable=t.forceFallback?!1:ac,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?z(n,"pointerdown",this._onTapStart):(z(n,"mousedown",this._onTapStart),z(n,"touchstart",this._onTapStart)),this.nativeDraggable&&(z(n,"dragover",this),z(n,"dragenter",this)),ni.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),te(this,nc())}P.prototype={constructor:P,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(ke=null)},_getDirection:function(t,e){return typeof this.options.direction=="function"?this.options.direction.call(this,t,e,R):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,i=this.el,r=this.options,s=r.preventOnFilter,o=t.type,a=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,l=(a||t).target,u=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||l,h=r.filter;if(yc(i),!R&&!(/mousedown|pointerdown/.test(o)&&t.button!==0||r.disabled)&&!u.isContentEditable&&!(!this.nativeDraggable&&bn&&l&&l.tagName.toUpperCase()==="SELECT")&&(l=Xt(l,r.draggable,i,!1),!(l&&l.animated)&&Qn!==l)){if(He=Ft(l),xn=Ft(l,r.draggable),typeof h=="function"){if(h.call(this,t,l,this)){xt({sortable:e,rootEl:u,name:"filter",targetEl:l,toEl:i,fromEl:i}),At("filter",e,{evt:t}),s&&t.cancelable&&t.preventDefault();return}}else if(h&&(h=h.split(",").some(function(c){if(c=Xt(u,c.trim(),i,!1),c)return xt({sortable:e,rootEl:c,name:"filter",targetEl:l,fromEl:i,toEl:i}),At("filter",e,{evt:t}),!0}),h)){s&&t.cancelable&&t.preventDefault();return}r.handle&&!Xt(u,r.handle,i,!1)||this._prepareDragStart(t,a,l)}}},_prepareDragStart:function(t,e,i){var r=this,s=r.el,o=r.options,a=s.ownerDocument,l;if(i&&!R&&i.parentNode===s){var u=lt(i);if(et=s,R=i,rt=R.parentNode,Ce=R.nextSibling,Qn=i,ti=o.group,P.dragged=R,Se={target:R,clientX:(e||t).clientX,clientY:(e||t).clientY},bo=Se.clientX-u.left,vo=Se.clientY-u.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,R.style["will-change"]="all",l=function(){if(At("delayEnded",r,{evt:t}),P.eventCanceled){r._onDrop();return}r._disableDelayedDragEvents(),!ao&&r.nativeDraggable&&(R.draggable=!0),r._triggerDragStart(t,e),xt({sortable:r,name:"choose",originalEvent:t}),Ot(R,o.chosenClass,!0)},o.ignore.split(",").forEach(function(h){fo(R,h.trim(),xr)}),z(a,"dragover",Ae),z(a,"mousemove",Ae),z(a,"touchmove",Ae),z(a,"mouseup",r._onDrop),z(a,"touchend",r._onDrop),z(a,"touchcancel",r._onDrop),ao&&this.nativeDraggable&&(this.options.touchStartThreshold=4,R.draggable=!0),At("delayStart",this,{evt:t}),o.delay&&(!o.delayOnTouchOnly||e)&&(!this.nativeDraggable||!(En||ne))){if(P.eventCanceled){this._onDrop();return}z(a,"mouseup",r._disableDelayedDrag),z(a,"touchend",r._disableDelayedDrag),z(a,"touchcancel",r._disableDelayedDrag),z(a,"mousemove",r._delayedDragTouchMoveHandler),z(a,"touchmove",r._delayedDragTouchMoveHandler),o.supportPointer&&z(a,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(l,o.delay)}else l()}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){R&&xr(R),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;H(t,"mouseup",this._disableDelayedDrag),H(t,"touchend",this._disableDelayedDrag),H(t,"touchcancel",this._disableDelayedDrag),H(t,"mousemove",this._delayedDragTouchMoveHandler),H(t,"touchmove",this._delayedDragTouchMoveHandler),H(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||t.pointerType=="touch"&&t,!this.nativeDraggable||e?this.options.supportPointer?z(document,"pointermove",this._onTouchMove):e?z(document,"touchmove",this._onTouchMove):z(document,"mousemove",this._onTouchMove):(z(R,"dragend",this),z(et,"dragstart",this._onDragStart));try{document.selection?ui(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,e){if(Ge=!1,et&&R){At("dragStarted",this,{evt:e}),this.nativeDraggable&&z(document,"dragover",cc);var i=this.options;!t&&Ot(R,i.dragClass,!1),Ot(R,i.ghostClass,!0),P.active=this,t&&this._appendGhost(),xt({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(Ht){this._lastX=Ht.clientX,this._lastY=Ht.clientY,Co();for(var t=document.elementFromPoint(Ht.clientX,Ht.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Ht.clientX,Ht.clientY),t!==e);)e=t;if(R.parentNode[Lt]._isOutsideThisEl(t),e)do{if(e[Lt]){var i=void 0;if(i=e[Lt]._onDragOver({clientX:Ht.clientX,clientY:Ht.clientY,target:t,rootEl:e}),i&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);So()}},_onTouchMove:function(t){if(Se){var e=this.options,i=e.fallbackTolerance,r=e.fallbackOffset,s=t.touches?t.touches[0]:t,o=O&&Fe(O,!0),a=O&&o&&o.a,l=O&&o&&o.d,u=ai&&Tt&&po(Tt),h=(s.clientX-Se.clientX+r.x)/(a||1)+(u?u[0]-vr[0]:0)/(a||1),c=(s.clientY-Se.clientY+r.y)/(l||1)+(u?u[1]-vr[1]:0)/(l||1);if(!P.active&&!Ge){if(i&&Math.max(Math.abs(s.clientX-this._lastX),Math.abs(s.clientY-this._lastY))<i)return;this._onDragStart(t,!0)}if(O){o?(o.e+=h-(Er||0),o.f+=c-(br||0)):o={a:1,b:0,c:0,d:1,e:h,f:c};var d="matrix(".concat(o.a,",").concat(o.b,",").concat(o.c,",").concat(o.d,",").concat(o.e,",").concat(o.f,")");$(O,"webkitTransform",d),$(O,"mozTransform",d),$(O,"msTransform",d),$(O,"transform",d),Er=h,br=c,Ht=s}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!O){var t=this.options.fallbackOnBody?document.body:et,e=lt(R,!0,ai,!0,t),i=this.options;if(ai){for(Tt=t;$(Tt,"position")==="static"&&$(Tt,"transform")==="none"&&Tt!==document;)Tt=Tt.parentNode;Tt!==document.body&&Tt!==document.documentElement?(Tt===document&&(Tt=zt()),e.top+=Tt.scrollTop,e.left+=Tt.scrollLeft):Tt=zt(),vr=po(Tt)}O=R.cloneNode(!0),Ot(O,i.ghostClass,!1),Ot(O,i.fallbackClass,!0),Ot(O,i.dragClass,!0),$(O,"transition",""),$(O,"transform",""),$(O,"box-sizing","border-box"),$(O,"margin",0),$(O,"top",e.top),$(O,"left",e.left),$(O,"width",e.width),$(O,"height",e.height),$(O,"opacity","0.8"),$(O,"position",ai?"absolute":"fixed"),$(O,"zIndex","100000"),$(O,"pointerEvents","none"),P.ghost=O,t.appendChild(O),$(O,"transform-origin",bo/parseInt(O.style.width)*100+"% "+vo/parseInt(O.style.height)*100+"%")}},_onDragStart:function(t,e){var i=this,r=t.dataTransfer,s=i.options;if(At("dragStart",this,{evt:t}),P.eventCanceled){this._onDrop();return}At("setupClone",this),P.eventCanceled||(it=yo(R),it.removeAttribute("id"),it.draggable=!1,it.style["will-change"]="",this._hideClone(),Ot(it,this.options.chosenClass,!1),P.clone=it),i.cloneId=ui(function(){At("clone",i),!P.eventCanceled&&(i.options.removeCloneOnHide||et.insertBefore(it,R),i._hideClone(),xt({sortable:i,name:"clone"}))}),!e&&Ot(R,s.dragClass,!0),e?(ei=!0,i._loopId=setInterval(i._emulateDragOver,50)):(H(document,"mouseup",i._onDrop),H(document,"touchend",i._onDrop),H(document,"touchcancel",i._onDrop),r&&(r.effectAllowed="move",s.setData&&s.setData.call(i,r,R)),z(document,"drop",i),$(R,"transform","translateZ(0)")),Ge=!0,i._dragStartId=ui(i._dragStarted.bind(i,e,t)),z(document,"selectstart",i),Rn=!0,bn&&$(document.body,"user-select","none")},_onDragOver:function(t){var e=this.el,i=t.target,r,s,o,a=this.options,l=a.group,u=P.active,h=ti===l,c=a.sort,d=_t||u,f,g=this,p=!1;if(Tr)return;function m(Pt,Vt){At(Pt,g,jt({evt:t,isOwner:h,axis:f?"vertical":"horizontal",revert:o,dragRect:r,targetRect:s,canSort:c,fromSortable:d,target:i,completed:_,onMove:function(re,se){return li(et,e,R,r,re,lt(re),t,se)},changed:T},Vt))}function y(){m("dragOverAnimationCapture"),g.captureAnimationState(),g!==d&&d.captureAnimationState()}function _(Pt){return m("dragOverCompleted",{insertion:Pt}),Pt&&(h?u._hideClone():u._showClone(g),g!==d&&(Ot(R,_t?_t.options.ghostClass:u.options.ghostClass,!1),Ot(R,a.ghostClass,!0)),_t!==g&&g!==P.active?_t=g:g===P.active&&_t&&(_t=null),d===g&&(g._ignoreWhileAnimating=i),g.animateAll(function(){m("dragOverAnimationComplete"),g._ignoreWhileAnimating=null}),g!==d&&(d.animateAll(),d._ignoreWhileAnimating=null)),(i===R&&!R.animated||i===e&&!i.animated)&&(ke=null),!a.dragoverBubble&&!t.rootEl&&i!==document&&(R.parentNode[Lt]._isOutsideThisEl(t.target),!Pt&&Ae(t)),!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),p=!0}function T(){Dt=Ft(R),he=Ft(R,a.draggable),xt({sortable:g,name:"change",toEl:e,newIndex:Dt,newDraggableIndex:he,originalEvent:t})}if(t.preventDefault!==void 0&&t.cancelable&&t.preventDefault(),i=Xt(i,a.draggable,e,!0),m("dragOver"),P.eventCanceled)return p;if(R.contains(t.target)||i.animated&&i.animatingX&&i.animatingY||g._ignoreWhileAnimating===i)return _(!1);if(ei=!1,u&&!a.disabled&&(h?c||(o=rt!==et):_t===this||(this.lastPutMode=ti.checkPull(this,u,R,t))&&l.checkPut(this,u,R,t))){if(f=this._getDirection(t,i)==="vertical",r=lt(R),m("dragOverValid"),P.eventCanceled)return p;if(o)return rt=et,y(),this._hideClone(),m("revert"),P.eventCanceled||(Ce?et.insertBefore(R,Ce):et.appendChild(R)),_(!0);var E=mr(e,a.draggable);if(!E||gc(t,f,this)&&!E.animated){if(E===R)return _(!1);if(E&&e===t.target&&(i=E),i&&(s=lt(i)),li(et,e,R,r,i,s,t,!!i)!==!1)return y(),E&&E.nextSibling?e.insertBefore(R,E.nextSibling):e.appendChild(R),rt=e,T(),_(!0)}else if(E&&fc(t,f,this)){var b=Be(e,0,a,!0);if(b===R)return _(!1);if(i=b,s=lt(i),li(et,e,R,r,i,s,t,!1)!==!1)return y(),e.insertBefore(R,b),rt=e,T(),_(!0)}else if(i.parentNode===e){s=lt(i);var v=0,C,w=R.parentNode!==e,I=!lc(R.animated&&R.toRect||r,i.animated&&i.toRect||s,f),X=f?"top":"left",F=go(i,"top","top")||go(R,"top","top"),V=F?F.scrollTop:void 0;ke!==i&&(C=s[X],Cn=!1,ii=!I&&a.invertSwap||w),v=pc(t,i,s,f,I?1:a.swapThreshold,a.invertedSwapThreshold==null?a.swapThreshold:a.invertedSwapThreshold,ii,ke===i);var q;if(v!==0){var J=Ft(R);do J-=v,q=rt.children[J];while(q&&($(q,"display")==="none"||q===O))}if(v===0||q===i)return _(!1);ke=i,wn=v;var at=i.nextElementSibling,Q=!1;Q=v===1;var Ct=li(et,e,R,r,i,s,t,Q);if(Ct!==!1)return(Ct===1||Ct===-1)&&(Q=Ct===1),Tr=!0,setTimeout(dc,30),y(),Q&&!at?e.appendChild(R):i.parentNode.insertBefore(R,Q?at:i),F&&_o(F,0,V-F.scrollTop),rt=R.parentNode,C!==void 0&&!ii&&(ri=Math.abs(C-lt(i)[X])),T(),_(!0)}if(e.contains(R))return _(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){H(document,"mousemove",this._onTouchMove),H(document,"touchmove",this._onTouchMove),H(document,"pointermove",this._onTouchMove),H(document,"dragover",Ae),H(document,"mousemove",Ae),H(document,"touchmove",Ae)},_offUpEvents:function(){var t=this.el.ownerDocument;H(t,"mouseup",this._onDrop),H(t,"touchend",this._onDrop),H(t,"pointerup",this._onDrop),H(t,"touchcancel",this._onDrop),H(document,"selectstart",this)},_onDrop:function(t){var e=this.el,i=this.options;if(Dt=Ft(R),he=Ft(R,i.draggable),At("drop",this,{evt:t}),rt=R&&R.parentNode,Dt=Ft(R),he=Ft(R,i.draggable),P.eventCanceled){this._nulling();return}Ge=!1,ii=!1,Cn=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Rr(this.cloneId),Rr(this._dragStartId),this.nativeDraggable&&(H(document,"drop",this),H(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),bn&&$(document.body,"user-select",""),$(R,"transform",""),t&&(Rn&&(t.cancelable&&t.preventDefault(),!i.dropBubble&&t.stopPropagation()),O&&O.parentNode&&O.parentNode.removeChild(O),(et===rt||_t&&_t.lastPutMode!=="clone")&&it&&it.parentNode&&it.parentNode.removeChild(it),R&&(this.nativeDraggable&&H(R,"dragend",this),xr(R),R.style["will-change"]="",Rn&&!Ge&&Ot(R,_t?_t.options.ghostClass:this.options.ghostClass,!1),Ot(R,this.options.chosenClass,!1),xt({sortable:this,name:"unchoose",toEl:rt,newIndex:null,newDraggableIndex:null,originalEvent:t}),et!==rt?(Dt>=0&&(xt({rootEl:rt,name:"add",toEl:rt,fromEl:et,originalEvent:t}),xt({sortable:this,name:"remove",toEl:rt,originalEvent:t}),xt({rootEl:rt,name:"sort",toEl:rt,fromEl:et,originalEvent:t}),xt({sortable:this,name:"sort",toEl:rt,originalEvent:t})),_t&&_t.save()):Dt!==He&&Dt>=0&&(xt({sortable:this,name:"update",toEl:rt,originalEvent:t}),xt({sortable:this,name:"sort",toEl:rt,originalEvent:t})),P.active&&((Dt==null||Dt===-1)&&(Dt=He,he=xn),xt({sortable:this,name:"end",toEl:rt,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){At("nulling",this),et=R=rt=O=Ce=it=Qn=ce=Se=Ht=Rn=Dt=he=He=xn=ke=wn=_t=ti=P.dragged=P.ghost=P.clone=P.active=null,si.forEach(function(t){t.checked=!0}),si.length=Er=br=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":R&&(this._onDragOver(t),hc(t));break;case"selectstart":t.preventDefault();break}},toArray:function(){for(var t=[],e,i=this.el.children,r=0,s=i.length,o=this.options;r<s;r++)e=i[r],Xt(e,o.draggable,this.el,!1)&&t.push(e.getAttribute(o.dataIdAttr)||_c(e));return t},sort:function(t,e){var i={},r=this.el;this.toArray().forEach(function(s,o){var a=r.children[o];Xt(a,this.options.draggable,r,!1)&&(i[s]=a)},this),e&&this.captureAnimationState(),t.forEach(function(s){i[s]&&(r.removeChild(i[s]),r.appendChild(i[s]))}),e&&this.animateAll()},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,e){return Xt(t,e||this.options.draggable,this.el,!1)},option:function(t,e){var i=this.options;if(e===void 0)return i[t];var r=Tn.modifyOption(this,t,e);typeof r<"u"?i[t]=r:i[t]=e,t==="group"&&wo(i)},destroy:function(){At("destroy",this);var t=this.el;t[Lt]=null,H(t,"mousedown",this._onTapStart),H(t,"touchstart",this._onTapStart),H(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(H(t,"dragover",this),H(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(e){e.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),ni.splice(ni.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!ce){if(At("hideClone",this),P.eventCanceled)return;$(it,"display","none"),this.options.removeCloneOnHide&&it.parentNode&&it.parentNode.removeChild(it),ce=!0}},_showClone:function(t){if(t.lastPutMode!=="clone"){this._hideClone();return}if(ce){if(At("showClone",this),P.eventCanceled)return;R.parentNode==et&&!this.options.group.revertClone?et.insertBefore(it,R):Ce?et.insertBefore(it,Ce):et.appendChild(it),this.options.group.revertClone&&this.animate(R,it),$(it,"display",""),ce=!1}}};function hc(n){n.dataTransfer&&(n.dataTransfer.dropEffect="move"),n.cancelable&&n.preventDefault()}function li(n,t,e,i,r,s,o,a){var l,u=n[Lt],h=u.options.onMove,c;return window.CustomEvent&&!ne&&!En?l=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(l=document.createEvent("Event"),l.initEvent("move",!0,!0)),l.to=t,l.from=n,l.dragged=e,l.draggedRect=i,l.related=r||t,l.relatedRect=s||lt(t),l.willInsertAfter=a,l.originalEvent=o,n.dispatchEvent(l),h&&(c=h.call(u,l,o)),c}function xr(n){n.draggable=!1}function dc(){Tr=!1}function fc(n,t,e){var i=lt(Be(e.el,0,e.options,!0)),r=Eo(e.el,e.options,O),s=10;return t?n.clientX<r.left-s||n.clientY<i.top&&n.clientX<i.right:n.clientY<r.top-s||n.clientY<i.bottom&&n.clientX<i.left}function gc(n,t,e){var i=lt(mr(e.el,e.options.draggable)),r=Eo(e.el,e.options,O),s=10;return t?n.clientX>r.right+s||n.clientY>i.bottom&&n.clientX>i.left:n.clientY>r.bottom+s||n.clientX>i.right&&n.clientY>i.top}function pc(n,t,e,i,r,s,o,a){var l=i?n.clientY:n.clientX,u=i?e.height:e.width,h=i?e.top:e.left,c=i?e.bottom:e.right,d=!1;if(!o){if(a&&ri<u*r){if(!Cn&&(wn===1?l>h+u*s/2:l<c-u*s/2)&&(Cn=!0),Cn)d=!0;else if(wn===1?l<h+ri:l>c-ri)return-wn}else if(l>h+u*(1-r)/2&&l<c-u*(1-r)/2)return mc(t)}return d=d||o,d&&(l<h+u*s/2||l>c-u*s/2)?l>h+u/2?1:-1:0}function mc(n){return Ft(R)<Ft(n)?1:-1}function _c(n){for(var t=n.tagName+n.className+n.src+n.href+n.textContent,e=t.length,i=0;e--;)i+=t.charCodeAt(e);return i.toString(36)}function yc(n){si.length=0;for(var t=n.getElementsByTagName("input"),e=t.length;e--;){var i=t[e];i.checked&&si.push(i)}}function ui(n){return setTimeout(n,0)}function Rr(n){return clearTimeout(n)}oi&&z(document,"touchmove",function(n){(P.active||Ge)&&n.cancelable&&n.preventDefault()}),P.utils={on:z,off:H,css:$,find:fo,is:function(t,e){return!!Xt(t,e,t,!1)},extend:tc,throttle:mo,closest:Xt,toggleClass:Ot,clone:yo,index:Ft,nextTick:ui,cancelNextTick:Rr,detectDirection:Ro,getChild:Be},P.get=function(n){return n[Lt]},P.mount=function(){for(var n=arguments.length,t=new Array(n),e=0;e<n;e++)t[e]=arguments[e];t[0].constructor===Array&&(t=t[0]),t.forEach(function(i){if(!i.prototype||!i.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(i));i.utils&&(P.utils=jt(jt({},P.utils),i.utils)),Tn.mount(i)})},P.create=function(n,t){return new P(n,t)},P.version=qu;var ut=[],Sn,wr,Cr=!1,Sr,Ar,ci,An;function Ec(){function n(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var t in this)t.charAt(0)==="_"&&typeof this[t]=="function"&&(this[t]=this[t].bind(this))}return n.prototype={dragStarted:function(e){var i=e.originalEvent;this.sortable.nativeDraggable?z(document,"dragover",this._handleAutoScroll):this.options.supportPointer?z(document,"pointermove",this._handleFallbackAutoScroll):i.touches?z(document,"touchmove",this._handleFallbackAutoScroll):z(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var i=e.originalEvent;!this.options.dragOverBubble&&!i.rootEl&&this._handleAutoScroll(i)},drop:function(){this.sortable.nativeDraggable?H(document,"dragover",this._handleAutoScroll):(H(document,"pointermove",this._handleFallbackAutoScroll),H(document,"touchmove",this._handleFallbackAutoScroll),H(document,"mousemove",this._handleFallbackAutoScroll)),Ao(),hi(),ec()},nulling:function(){ci=wr=Sn=Cr=An=Sr=Ar=null,ut.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,i){var r=this,s=(e.touches?e.touches[0]:e).clientX,o=(e.touches?e.touches[0]:e).clientY,a=document.elementFromPoint(s,o);if(ci=e,i||this.options.forceAutoScrollFallback||En||ne||bn){Ir(e,this.options,a,i);var l=ue(a,!0);Cr&&(!An||s!==Sr||o!==Ar)&&(An&&Ao(),An=setInterval(function(){var u=ue(document.elementFromPoint(s,o),!0);u!==l&&(l=u,hi()),Ir(e,r.options,u,i)},10),Sr=s,Ar=o)}else{if(!this.options.bubbleScroll||ue(a,!0)===zt()){hi();return}Ir(e,this.options,ue(a,!1),!1)}}},te(n,{pluginName:"scroll",initializeByDefault:!0})}function hi(){ut.forEach(function(n){clearInterval(n.pid)}),ut=[]}function Ao(){clearInterval(An)}var Ir=mo(function(n,t,e,i){if(t.scroll){var r=(n.touches?n.touches[0]:n).clientX,s=(n.touches?n.touches[0]:n).clientY,o=t.scrollSensitivity,a=t.scrollSpeed,l=zt(),u=!1,h;wr!==e&&(wr=e,hi(),Sn=t.scroll,h=t.scrollFn,Sn===!0&&(Sn=ue(e,!0)));var c=0,d=Sn;do{var f=d,g=lt(f),p=g.top,m=g.bottom,y=g.left,_=g.right,T=g.width,E=g.height,b=void 0,v=void 0,C=f.scrollWidth,w=f.scrollHeight,I=$(f),X=f.scrollLeft,F=f.scrollTop;f===l?(b=T<C&&(I.overflowX==="auto"||I.overflowX==="scroll"||I.overflowX==="visible"),v=E<w&&(I.overflowY==="auto"||I.overflowY==="scroll"||I.overflowY==="visible")):(b=T<C&&(I.overflowX==="auto"||I.overflowX==="scroll"),v=E<w&&(I.overflowY==="auto"||I.overflowY==="scroll"));var V=b&&(Math.abs(_-r)<=o&&X+T<C)-(Math.abs(y-r)<=o&&!!X),q=v&&(Math.abs(m-s)<=o&&F+E<w)-(Math.abs(p-s)<=o&&!!F);if(!ut[c])for(var J=0;J<=c;J++)ut[J]||(ut[J]={});(ut[c].vx!=V||ut[c].vy!=q||ut[c].el!==f)&&(ut[c].el=f,ut[c].vx=V,ut[c].vy=q,clearInterval(ut[c].pid),(V!=0||q!=0)&&(u=!0,ut[c].pid=setInterval((function(){i&&this.layer===0&&P.active._onTouchMove(ci);var at=ut[this.layer].vy?ut[this.layer].vy*a:0,Q=ut[this.layer].vx?ut[this.layer].vx*a:0;typeof h=="function"&&h.call(P.dragged.parentNode[Lt],Q,at,n,ci,ut[this.layer].el)!=="continue"||_o(ut[this.layer].el,Q,at)}).bind({layer:c}),24))),c++}while(t.bubbleScroll&&d!==l&&(d=ue(d,!1)));Cr=u}},30),Io=function(t){var e=t.originalEvent,i=t.putSortable,r=t.dragEl,s=t.activeSortable,o=t.dispatchSortableEvent,a=t.hideGhostForTarget,l=t.unhideGhostForTarget;if(e){var u=i||s;a();var h=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e,c=document.elementFromPoint(h.clientX,h.clientY);l(),u&&!u.el.contains(c)&&(o("spill"),this.onSpill({dragEl:r,putSortable:i}))}};function $r(){}$r.prototype={startIndex:null,dragStart:function(t){var e=t.oldDraggableIndex;this.startIndex=e},onSpill:function(t){var e=t.dragEl,i=t.putSortable;this.sortable.captureAnimationState(),i&&i.captureAnimationState();var r=Be(this.sortable.el,this.startIndex,this.options);r?this.sortable.el.insertBefore(e,r):this.sortable.el.appendChild(e),this.sortable.animateAll(),i&&i.animateAll()},drop:Io},te($r,{pluginName:"revertOnSpill"});function Pr(){}Pr.prototype={onSpill:function(t){var e=t.dragEl,i=t.putSortable,r=i||this.sortable;r.captureAnimationState(),e.parentNode&&e.parentNode.removeChild(e),r.animateAll()},drop:Io},te(Pr,{pluginName:"removeOnSpill"}),P.mount(new Ec),P.mount(Pr,$r);const bc=n=>{const t=n.item;let e=Array.prototype.slice.call(t.parentNode.childNodes);return e=e.filter(i=>i.nodeType!=Node.ELEMENT_NODE||!i.classList.contains("sortable-fallback")),e},vc=(n,t,e,i,r,s)=>{const a=n.item.parentNode;for(const p of e)a.appendChild(p);if(n.oldIndex==n.newIndex)return;const l=i.getArray(),u=n.item.querySelector("eox-layercontrol-layer").layer.get(r),h=l.find(p=>p.get(r)===u),c=s.dataset.layer,d=l.find(p=>p.get(r)==c);let f,g;for(f=0;f<l.length;f++)if(l[f]==h){i.removeAt(f);break}for(g=0;g<l.length;g++)if(l[g]===d){f>g?i.insertAt(g,h):i.insertAt(g+1,h);break}t.requestUpdate()};function Tc(n,t,e,i){let r=[],s=null;n._sortable=P.create(n,{handle:".drag-handle",filter:".drag-handle.disabled",swapThreshold:.5,animation:150,easing:"cubic-bezier(1, 0, 0, 1)",onStart:o=>r=bc(o),onMove:o=>{s=o.related},onEnd:o=>vc(o,i,r,t,e,s)})}function xc(n,t,e,i){const r=n.getArray();let s=!1;r.forEach(o=>{const a=o.ol_uid;o.get(t)||(o.set(t,a),s=!0),o.get(e)||(o.set(e,`layer ${a}`),s=!0),s&&i.requestUpdate()})}function Mr(n,t,e){let i=[];const r=(s,o,a)=>{i=[...i,...s.filter(u=>u.get(o)===a)];const l=s.filter(u=>u.getLayers);return l.length>0&&l.forEach(u=>r(u.getLayers().getArray(),o,a)),i};return r(n,t,e),i}function Rc(n,t,e){if(!n||!t)return!1;if(!$o(n,e))return!0;const i=n.get("minZoom"),r=n.get("maxZoom"),s=t.getView().getZoom();return s>i&&s<r}function $o(n,t){const e=n.get("minZoom"),i=n.get("maxZoom");return!!(t&&(e!==-1/0||i!==1/0))}function wc(n,t){var r,s,o;return!n||!t?void 0:n.getLayers?"group":((o=(r=t.getInteractions().getArray().filter(a=>a.freehand_!==void 0).map(a=>a.source_))==null?void 0:r.ol_uid)==null?void 0:o.includes(n.getSource?(s=n.getSource())==null?void 0:s.ol_uid:void 0))?"draw":n.declutter_!==void 0?"vector":"raster"}class Or{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}const Cc={PROPERTYCHANGE:"propertychange"};class Po{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function Mo(n,t){return n>t?1:n<t?-1:0}function Sc(n,t){return n<t?1:n>t?-1:0}function Oo(n,t,e){if(n[0]<=t)return 0;const i=n.length;if(t<=n[i-1])return i-1;if(typeof e=="function"){for(let r=1;r<i;++r){const s=n[r];if(s===t)return r;if(s<t)return e(t,n[r-1],s)>0?r-1:r}return i-1}if(e>0){for(let r=1;r<i;++r)if(n[r]<t)return r-1;return i-1}if(e<0){for(let r=1;r<i;++r)if(n[r]<=t)return r;return i-1}for(let r=1;r<i;++r){if(n[r]==t)return r;if(n[r]<t)return n[r-1]-t<t-n[r]?r-1:r}return i-1}function Ac(n,t){const e=Array.isArray(t)?t:[t],i=e.length;for(let r=0;r<i;r++)n[n.length]=e[r]}function Ic(n,t){const e=n.length;if(e!==t.length)return!1;for(let i=0;i<e;i++)if(n[i]!==t[i])return!1;return!0}function Lr(){}function $c(n){let t=!1,e,i,r;return function(){const s=Array.prototype.slice.call(arguments);return(!t||this!==r||!Ic(s,i))&&(t=!0,r=this,i=s,e=n.apply(this,arguments)),e}}function Dr(n){for(const t in n)delete n[t]}function Pc(n){let t;for(t in n)return!1;return!t}class Nr extends Po{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),r=i[t]||(i[t]=[]);r.includes(e)||r.push(e)}dispatchEvent(t){const e=typeof t=="string",i=e?t:t.type,r=this.listeners_&&this.listeners_[i];if(!r)return;const s=e?new Or(t):t;s.target||(s.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in o||(o[i]=0,a[i]=0),++o[i];let l;for(let u=0,h=r.length;u<h;++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[i]===0){let u=a[i];for(delete a[i];u--;)this.removeEventListener(i,Lr);delete o[i]}return l}disposeInternal(){this.listeners_&&Dr(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return this.listeners_?t?t in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const r=i.indexOf(e);r!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[r]=Lr,++this.pendingRemovals_[t]):(i.splice(r,1),i.length===0&&delete this.listeners_[t]))}}const It={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function de(n,t,e,i,r){if(i&&i!==n&&(e=e.bind(i)),r){const o=e;e=function(){n.removeEventListener(t,e),o.apply(this,arguments)}}const s={target:n,type:t,listener:e};return n.addEventListener(t,e),s}function di(n,t,e,i){return de(n,t,e,i,!0)}function Wt(n){n&&n.target&&(n.target.removeEventListener(n.type,n.listener),Dr(n))}class In extends Nr{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(It.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,r=new Array(i);for(let s=0;s<i;++s)r[s]=de(this,t[s],e);return r}return de(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const r=t.length;i=new Array(r);for(let s=0;s<r;++s)i[s]=di(this,t[s],e)}else i=di(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)Mc(i);else if(Array.isArray(t))for(let r=0,s=t.length;r<s;++r)this.removeEventListener(t[r],e);else this.removeEventListener(t,e)}}In.prototype.on,In.prototype.once,In.prototype.un;function Mc(n){if(Array.isArray(n))for(let t=0,e=n.length;t<e;++t)Wt(n[t]);else Wt(n)}function ot(){throw new Error("Unimplemented abstract method.")}let Oc=0;function Yt(n){return n.ol_uid||(n.ol_uid=String(++Oc))}class Lo extends Or{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class Ur extends In{constructor(t){super(),this.on,this.once,this.un,Yt(this),this.values_=null,t!==void 0&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new Lo(i,t,e)),i=Cc.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new Lo(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const r=this.values_||(this.values_={});if(i)r[t]=e;else{const s=r[t];r[t]=e,s!==e&&this.notify(t,s)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],Pc(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}const W={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};function Bt(n,t){if(!n)throw new Error(t)}function ft(n,t,e){return Math.min(Math.max(n,t),e)}function Lc(n,t,e,i,r,s){const o=r-e,a=s-i;if(o!==0||a!==0){const l=((n-e)*o+(t-i)*a)/(o*o+a*a);l>1?(e=r,i=s):l>0&&(e+=o*l,i+=a*l)}return Ve(n,t,e,i)}function Ve(n,t,e,i){const r=e-n,s=i-t;return r*r+s*s}function Dc(n){const t=n.length;for(let i=0;i<t;i++){let r=i,s=Math.abs(n[i][i]);for(let a=i+1;a<t;a++){const l=Math.abs(n[a][i]);l>s&&(s=l,r=a)}if(s===0)return null;const o=n[r];n[r]=n[i],n[i]=o;for(let a=i+1;a<t;a++){const l=-n[a][i]/n[i][i];for(let u=i;u<t+1;u++)i==u?n[a][u]=0:n[a][u]+=l*n[i][u]}}const e=new Array(t);for(let i=t-1;i>=0;i--){e[i]=n[i][t]/n[i][i];for(let r=i-1;r>=0;r--)n[r][t]-=n[r][i]*e[i]}return e}function fi(n){return n*Math.PI/180}function $n(n,t){const e=n%t;return e*t<0?e+t:e}function Nc(n,t,e){return n+e*(t-n)}class Uc extends Ur{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);typeof t.properties=="object"&&(delete e.properties,Object.assign(e,t.properties)),e[W.OPACITY]=t.opacity!==void 0?t.opacity:1,Bt(typeof e[W.OPACITY]=="number","Layer opacity must be a number"),e[W.VISIBLE]=t.visible!==void 0?t.visible:!0,e[W.Z_INDEX]=t.zIndex,e[W.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[W.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[W.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[W.MAX_ZOOM]=t.maxZoom!==void 0?t.maxZoom:1/0,this.className_=e.className!==void 0?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:t===void 0?!0:t},i=this.getZIndex();return e.opacity=ft(Math.round(this.getOpacity()*100)/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=i===void 0&&!e.managed?1/0:i,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return ot()}getLayerStatesArray(t){return ot()}getExtent(){return this.get(W.EXTENT)}getMaxResolution(){return this.get(W.MAX_RESOLUTION)}getMinResolution(){return this.get(W.MIN_RESOLUTION)}getMinZoom(){return this.get(W.MIN_ZOOM)}getMaxZoom(){return this.get(W.MAX_ZOOM)}getOpacity(){return this.get(W.OPACITY)}getSourceState(){return ot()}getVisible(){return this.get(W.VISIBLE)}getZIndex(){return this.get(W.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(W.EXTENT,t)}setMaxResolution(t){this.set(W.MAX_RESOLUTION,t)}setMinResolution(t){this.set(W.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(W.MAX_ZOOM,t)}setMinZoom(t){this.set(W.MIN_ZOOM,t)}setOpacity(t){Bt(typeof t=="number","Layer opacity must be a number"),this.set(W.OPACITY,t)}setVisible(t){this.set(W.VISIBLE,t)}setZIndex(t){this.set(W.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}const Ie={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"},fe={ANIMATING:0,INTERACTING:1},Gt={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"},Fc=256,gi={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class Do{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=t.extent!==void 0?t.extent:null,this.worldExtent_=t.worldExtent!==void 0?t.worldExtent:null,this.axisOrientation_=t.axisOrientation!==void 0?t.axisOrientation:"enu",this.global_=t.global!==void 0?t.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||gi[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!!(t&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!!(this.global_&&t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const Pn=6378137,je=Math.PI*Pn,Bc=[-je,-je,je,je],Xc=[-180,-85,180,85],pi=Pn*Math.log(Math.tan(Math.PI/2));class ze extends Do{constructor(t){super({code:t,units:"m",extent:Bc,global:!0,worldExtent:Xc,getPointResolution:function(e,i){return e/Math.cosh(i[1]/Pn)}})}}const No=[new ze("EPSG:3857"),new ze("EPSG:102100"),new ze("EPSG:102113"),new ze("EPSG:900913"),new ze("http://www.opengis.net/def/crs/EPSG/0/3857"),new ze("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Hc(n,t,e){const i=n.length;e=e>1?e:2,t===void 0&&(e>2?t=n.slice():t=new Array(i));for(let r=0;r<i;r+=e){t[r]=je*n[r]/180;let s=Pn*Math.log(Math.tan(Math.PI*(+n[r+1]+90)/360));s>pi?s=pi:s<-pi&&(s=-pi),t[r+1]=s}return t}function Gc(n,t,e){const i=n.length;e=e>1?e:2,t===void 0&&(e>2?t=n.slice():t=new Array(i));for(let r=0;r<i;r+=e)t[r]=180*n[r]/je,t[r+1]=360*Math.atan(Math.exp(n[r+1]/Pn))/Math.PI-90;return t}const kc=6378137,Uo=[-180,-90,180,90],Vc=Math.PI*kc/180;class $e extends Do{constructor(t,e){super({code:t,units:"degrees",extent:Uo,axisOrientation:e,global:!0,metersPerUnit:Vc,worldExtent:Uo})}}const Fo=[new $e("CRS:84"),new $e("EPSG:4326","neu"),new $e("urn:ogc:def:crs:OGC:1.3:CRS84"),new $e("urn:ogc:def:crs:OGC:2:84"),new $e("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new $e("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new $e("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Fr={};function jc(n){return Fr[n]||Fr[n.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function zc(n,t){Fr[n]=t}let We={};function mi(n,t,e){const i=n.getCode(),r=t.getCode();i in We||(We[i]={}),We[i][r]=e}function Wc(n,t){let e;return n in We&&t in We[n]&&(e=We[n][t]),e}const yt={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Br(n){const t=Ye();for(let e=0,i=n.length;e<i;++e)_i(t,n[e]);return t}function Bo(n,t,e){let i,r;return t<n[0]?i=n[0]-t:n[2]<t?i=t-n[2]:i=0,e<n[1]?r=n[1]-e:n[3]<e?r=e-n[3]:r=0,i*i+r*r}function Xr(n,t){return Xo(n,t[0],t[1])}function Yc(n,t){return n[0]<=t[0]&&t[2]<=n[2]&&n[1]<=t[1]&&t[3]<=n[3]}function Xo(n,t,e){return n[0]<=t&&t<=n[2]&&n[1]<=e&&e<=n[3]}function Ho(n,t){const e=n[0],i=n[1],r=n[2],s=n[3],o=t[0],a=t[1];let l=yt.UNKNOWN;return o<e?l=l|yt.LEFT:o>r&&(l=l|yt.RIGHT),a<i?l=l|yt.BELOW:a>s&&(l=l|yt.ABOVE),l===yt.UNKNOWN&&(l=yt.INTERSECTING),l}function Ye(){return[1/0,1/0,-1/0,-1/0]}function Hr(n,t,e,i,r){return r?(r[0]=n,r[1]=t,r[2]=e,r[3]=i,r):[n,t,e,i]}function Gr(n){return Hr(1/0,1/0,-1/0,-1/0,n)}function Zc(n,t){const e=n[0],i=n[1];return Hr(e,i,e,i,t)}function Kc(n,t,e,i,r){const s=Gr(r);return Go(s,n,t,e,i)}function qc(n,t){return t[0]<n[0]&&(n[0]=t[0]),t[2]>n[2]&&(n[2]=t[2]),t[1]<n[1]&&(n[1]=t[1]),t[3]>n[3]&&(n[3]=t[3]),n}function _i(n,t){t[0]<n[0]&&(n[0]=t[0]),t[0]>n[2]&&(n[2]=t[0]),t[1]<n[1]&&(n[1]=t[1]),t[1]>n[3]&&(n[3]=t[1])}function Go(n,t,e,i,r){for(;e<i;e+=r)Jc(n,t[e],t[e+1]);return n}function Jc(n,t,e){n[0]=Math.min(n[0],t),n[1]=Math.min(n[1],e),n[2]=Math.max(n[2],t),n[3]=Math.max(n[3],e)}function ko(n,t){let e;return e=t(Vo(n)),e||(e=t(jo(n)),e)||(e=t(zo(n)),e)||(e=t(kr(n)),e)?e:!1}function Mn(n){let t=0;return Ei(n)||(t=ct(n)*kt(n)),t}function Vo(n){return[n[0],n[1]]}function jo(n){return[n[2],n[1]]}function Ze(n){return[(n[0]+n[2])/2,(n[1]+n[3])/2]}function Qc(n,t,e,i,r){const[s,o,a,l,u,h,c,d]=th(n,t,e,i);return Hr(Math.min(s,a,u,c),Math.min(o,l,h,d),Math.max(s,a,u,c),Math.max(o,l,h,d),r)}function th(n,t,e,i){const r=t*i[0]/2,s=t*i[1]/2,o=Math.cos(e),a=Math.sin(e),l=r*o,u=r*a,h=s*o,c=s*a,d=n[0],f=n[1];return[d-l+c,f-u-h,d-l-c,f-u+h,d+l-c,f+u+h,d+l+c,f+u-h,d-l+c,f-u-h]}function kt(n){return n[3]-n[1]}function Zt(n,t,e){const i=e||Ye();return yi(n,t)?(n[0]>t[0]?i[0]=n[0]:i[0]=t[0],n[1]>t[1]?i[1]=n[1]:i[1]=t[1],n[2]<t[2]?i[2]=n[2]:i[2]=t[2],n[3]<t[3]?i[3]=n[3]:i[3]=t[3]):Gr(i),i}function kr(n){return[n[0],n[3]]}function zo(n){return[n[2],n[3]]}function ct(n){return n[2]-n[0]}function yi(n,t){return n[0]<=t[2]&&n[2]>=t[0]&&n[1]<=t[3]&&n[3]>=t[1]}function Ei(n){return n[2]<n[0]||n[3]<n[1]}function eh(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n}function nh(n,t,e){let i=!1;const r=Ho(n,t),s=Ho(n,e);if(r===yt.INTERSECTING||s===yt.INTERSECTING)i=!0;else{const o=n[0],a=n[1],l=n[2],u=n[3],h=t[0],c=t[1],d=e[0],f=e[1],g=(f-c)/(d-h);let p,m;s&yt.ABOVE&&!(r&yt.ABOVE)&&(p=d-(f-u)/g,i=p>=o&&p<=l),!i&&s&yt.RIGHT&&!(r&yt.RIGHT)&&(m=f-(d-l)*g,i=m>=a&&m<=u),!i&&s&yt.BELOW&&!(r&yt.BELOW)&&(p=d-(f-a)/g,i=p>=o&&p<=l),!i&&s&yt.LEFT&&!(r&yt.LEFT)&&(m=f-(d-o)*g,i=m>=a&&m<=u)}return i}function ih(n,t){const e=t.getExtent(),i=Ze(n);if(t.canWrapX()&&(i[0]<e[0]||i[0]>=e[2])){const r=ct(e),o=Math.floor((i[0]-e[0])/r)*r;n[0]-=o,n[2]-=o}return n}function Wo(n,t,e){if(t.canWrapX()){const i=t.getExtent();if(!isFinite(n[0])||!isFinite(n[2]))return[[i[0],n[1],i[2],n[3]]];ih(n,t);const r=ct(i);if(ct(n)>r&&!e)return[[i[0],n[1],i[2],n[3]]];if(n[0]<i[0])return[[n[0]+r,n[1],i[2],n[3]],[i[0],n[1],n[2],n[3]]];if(n[2]>i[2])return[[n[0],n[1],i[2],n[3]],[i[0],n[1],n[2]-r,n[3]]]}return[n]}function rh(n,t){return n[0]+=+t[0],n[1]+=+t[1],n}function bi(n,t){let e=!0;for(let i=n.length-1;i>=0;--i)if(n[i]!=t[i]){e=!1;break}return e}function sh(n,t){const e=Math.cos(t),i=Math.sin(t),r=n[0]*e-n[1]*i,s=n[1]*e+n[0]*i;return n[0]=r,n[1]=s,n}const oh=63710088e-1;function Yo(n,t,e){e=e||oh;const i=fi(n[1]),r=fi(t[1]),s=(r-i)/2,o=fi(t[0]-n[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(r);return 2*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function ah(...n){console.warn(...n)}let Vr=!0;function lh(n){Vr=!(n===void 0?!0:n)}function Zo(n,t){if(t!==void 0){for(let e=0,i=n.length;e<i;++e)t[e]=n[e];t=t}else t=n.slice();return t}function Ko(n,t){if(t!==void 0&&n!==t){for(let e=0,i=n.length;e<i;++e)t[e]=n[e];n=t}return n}function uh(n){zc(n.getCode(),n),mi(n,n,Zo)}function ch(n){n.forEach(uh)}function Pe(n){return typeof n=="string"?jc(n):n||null}function qo(n,t,e,i){n=Pe(n);let r;const s=n.getPointResolutionFunc();if(s){if(r=s(t,e),i&&i!==n.getUnits()){const o=n.getMetersPerUnit();o&&(r=r*o/gi[i])}}else{const o=n.getUnits();if(o=="degrees"&&!i||i=="degrees")r=t;else{const a=Qo(n,Pe("EPSG:4326"));if(a===Ko&&o!=="degrees")r=t*n.getMetersPerUnit();else{let u=[e[0]-t/2,e[1],e[0]+t/2,e[1],e[0],e[1]-t/2,e[0],e[1]+t/2];u=a(u,u,2);const h=Yo(u.slice(0,2),u.slice(2,4)),c=Yo(u.slice(4,6),u.slice(6,8));r=(h+c)/2}const l=i?gi[i]:n.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function Jo(n){ch(n),n.forEach(function(t){n.forEach(function(e){t!==e&&mi(t,e,Zo)})})}function hh(n,t,e,i){n.forEach(function(r){t.forEach(function(s){mi(r,s,e),mi(s,r,i)})})}function jr(n,t){return n?typeof n=="string"?Pe(n):n:Pe(t)}function Qo(n,t){const e=n.getCode(),i=t.getCode();let r=Wc(e,i);return r||(r=Ko),r}function vi(n,t){const e=Pe(n),i=Pe(t);return Qo(e,i)}function dh(n,t,e){return vi(t,e)(n,void 0,n.length)}function ta(n,t){return n}function ge(n,t){return Vr&&!bi(n,[0,0])&&n[0]>=-180&&n[0]<=180&&n[1]>=-90&&n[1]<=90&&(Vr=!1,ah("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),n}function fh(n,t){return n}function Ke(n,t){return n}function gh(){Jo(No),Jo(Fo),hh(Fo,No,Hc,Gc)}gh();function ea(n,t,e){return function(i,r,s,o,a){if(!i)return;if(!r&&!t)return i;const l=t?0:s[0]*r,u=t?0:s[1]*r,h=a?a[0]:0,c=a?a[1]:0;let d=n[0]+l/2+h,f=n[2]-l/2+h,g=n[1]+u/2+c,p=n[3]-u/2+c;d>f&&(d=(f+d)/2,f=d),g>p&&(g=(p+g)/2,p=g);let m=ft(i[0],d,f),y=ft(i[1],g,p);if(o&&e&&r){const _=30*r;m+=-_*Math.log(1+Math.max(0,d-i[0])/_)+_*Math.log(1+Math.max(0,i[0]-f)/_),y+=-_*Math.log(1+Math.max(0,g-i[1])/_)+_*Math.log(1+Math.max(0,i[1]-p)/_)}return[m,y]}}function ph(n){return n}function zr(n,t,e,i){const r=ct(t)/e[0],s=kt(t)/e[1];return i?Math.min(n,Math.max(r,s)):Math.min(n,Math.min(r,s))}function Wr(n,t,e){let i=Math.min(n,t);const r=50;return i*=Math.log(1+r*Math.max(0,n/t-1))/r+1,e&&(i=Math.max(i,e),i/=Math.log(1+r*Math.max(0,e/n-1))/r+1),ft(i,e/2,t*2)}function mh(n,t,e,i){return t=t!==void 0?t:!0,function(r,s,o,a){if(r!==void 0){const l=n[0],u=n[n.length-1],h=e?zr(l,e,o,i):l;if(a)return t?Wr(r,h,u):ft(r,u,h);const c=Math.min(h,r),d=Math.floor(Oo(n,c,s));return n[d]>h&&d<n.length-1?n[d+1]:n[d]}}}function _h(n,t,e,i,r,s){return i=i!==void 0?i:!0,e=e!==void 0?e:0,function(o,a,l,u){if(o!==void 0){const h=r?zr(t,r,l,s):t;if(u)return i?Wr(o,h,e):ft(o,e,h);const c=1e-9,d=Math.ceil(Math.log(t/h)/Math.log(n)-c),f=-a*(.5-c)+.5,g=Math.min(h,o),p=Math.floor(Math.log(t/g)/Math.log(n)+f),m=Math.max(d,p),y=t/Math.pow(n,m);return ft(y,e,h)}}}function na(n,t,e,i,r){return e=e!==void 0?e:!0,function(s,o,a,l){if(s!==void 0){const u=i?zr(n,i,a,r):n;return!e||!l?ft(s,t,u):Wr(s,u,t)}}}function yh(n){if(n!==void 0)return 0}function ia(n){if(n!==void 0)return n}function Eh(n){const t=2*Math.PI/n;return function(e,i){if(i)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e}}function bh(n){const t=n===void 0?fi(5):n;return function(e,i){return i||e===void 0?e:Math.abs(e)<=t?0:e}}function ra(n){return Math.pow(n,3)}function vh(n){return 1-ra(1-n)}function Th(n){return 3*n*n-2*n*n*n}const Yr=new Array(6);function On(){return[1,0,0,1,0,0]}function xh(n){return Ti(n,1,0,0,1,0,0)}function Zr(n,t){const e=n[0],i=n[1],r=n[2],s=n[3],o=n[4],a=n[5],l=t[0],u=t[1],h=t[2],c=t[3],d=t[4],f=t[5];return n[0]=e*l+r*u,n[1]=i*l+s*u,n[2]=e*h+r*c,n[3]=i*h+s*c,n[4]=e*d+r*f+o,n[5]=i*d+s*f+a,n}function Ti(n,t,e,i,r,s,o){return n[0]=t,n[1]=e,n[2]=i,n[3]=r,n[4]=s,n[5]=o,n}function Rh(n,t){const e=t[0],i=t[1];return t[0]=n[0]*e+n[2]*i+n[4],t[1]=n[1]*e+n[3]*i+n[5],t}function wh(n,t){const e=Math.cos(t),i=Math.sin(t);return Zr(n,Ti(Yr,e,i,-i,e,0,0))}function sa(n,t,e){return Zr(n,Ti(Yr,t,0,0,e,0,0))}function Ch(n,t,e){return Zr(n,Ti(Yr,1,0,0,1,t,e))}function Kr(n,t,e,i,r,s,o,a){const l=Math.sin(s),u=Math.cos(s);return n[0]=i*u,n[1]=r*l,n[2]=-i*l,n[3]=r*u,n[4]=o*i*u-a*i*l+t,n[5]=o*r*l+a*r*u+e,n}function Sh(n,t,e,i,r,s){s=s||[];let o=0;for(let a=t;a<e;a+=i){const l=n[a],u=n[a+1];s[o++]=r[0]*l+r[2]*u+r[4],s[o++]=r[1]*l+r[3]*u+r[5]}return s&&s.length!=o&&(s.length=o),s}function Ah(n,t,e,i,r,s,o){o=o||[];const a=Math.cos(r),l=Math.sin(r),u=s[0],h=s[1];let c=0;for(let d=t;d<e;d+=i){const f=n[d]-u,g=n[d+1]-h;o[c++]=u+f*a-g*l,o[c++]=h+f*l+g*a;for(let p=d+2;p<d+i;++p)o[c++]=n[p]}return o&&o.length!=c&&(o.length=c),o}function Ih(n,t,e,i,r,s,o,a){a=a||[];const l=o[0],u=o[1];let h=0;for(let c=t;c<e;c+=i){const d=n[c]-l,f=n[c+1]-u;a[h++]=l+r*d,a[h++]=u+s*f;for(let g=c+2;g<c+i;++g)a[h++]=n[g]}return a&&a.length!=h&&(a.length=h),a}function $h(n,t,e,i,r,s,o){o=o||[];let a=0;for(let l=t;l<e;l+=i){o[a++]=n[l]+r,o[a++]=n[l+1]+s;for(let u=l+2;u<l+i;++u)o[a++]=n[u]}return o&&o.length!=a&&(o.length=a),o}const oa=On();class Ph extends Ur{constructor(){super(),this.extent_=Ye(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=$c((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const r=this.clone();return r.applyTransform(i),r.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return ot()}closestPointXY(t,e,i,r){return ot()}containsXY(t,e){const i=this.getClosestPoint([t,e]);return i[0]===t&&i[1]===e}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return ot()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Gr(e),this.extentRevision_=this.getRevision()}return eh(this.extent_,t)}rotate(t,e){ot()}scale(t,e,i){ot()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return ot()}getType(){return ot()}applyTransform(t){ot()}intersectsExtent(t){return ot()}translate(t,e){ot()}transform(t,e){const i=Pe(t),r=i.getUnits()=="tile-pixels"?function(s,o,a){const l=i.getExtent(),u=i.getWorldExtent(),h=kt(u)/kt(l);return Kr(oa,u[0],u[3],h,-h,0,0,0),Sh(s,0,s.length,a,oa,o),vi(i,e)(s,o,a)}:vi(i,e);return this.applyTransform(r),this}}class qr extends Ph{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return Kc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return ot()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=aa(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){ot()}setLayout(t,e,i){let r;if(t)r=aa(t);else{for(let s=0;s<i;++s){if(e.length===0){this.layout="XY",this.stride=2;return}e=e[0]}r=e.length,t=Mh(r)}this.layout=t,this.stride=r}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const r=this.getStride();Ah(i,0,i.length,r,t,e,i),this.changed()}}scale(t,e,i){e===void 0&&(e=t),i||(i=Ze(this.getExtent()));const r=this.getFlatCoordinates();if(r){const s=this.getStride();Ih(r,0,r.length,s,t,e,i,r),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const r=this.getStride();$h(i,0,i.length,r,t,e,i),this.changed()}}}function Mh(n){let t;return n==2?t="XY":n==3?t="XYZ":n==4&&(t="XYZM"),t}function aa(n){let t;return n=="XY"?t=2:n=="XYZ"||n=="XYM"?t=3:n=="XYZM"&&(t=4),t}function la(n,t,e,i,r,s,o){const a=n[t],l=n[t+1],u=n[e]-a,h=n[e+1]-l;let c;if(u===0&&h===0)c=t;else{const d=((r-a)*u+(s-l)*h)/(u*u+h*h);if(d>1)c=e;else if(d>0){for(let f=0;f<i;++f)o[f]=Nc(n[t+f],n[e+f],d);o.length=i;return}else c=t}for(let d=0;d<i;++d)o[d]=n[c+d];o.length=i}function ua(n,t,e,i,r){let s=n[t],o=n[t+1];for(t+=i;t<e;t+=i){const a=n[t],l=n[t+1],u=Ve(s,o,a,l);u>r&&(r=u),s=a,o=l}return r}function Oh(n,t,e,i,r){for(let s=0,o=e.length;s<o;++s){const a=e[s];r=ua(n,t,a,i,r),t=a}return r}function ca(n,t,e,i,r,s,o,a,l,u,h){if(t==e)return u;let c,d;if(r===0){if(d=Ve(o,a,n[t],n[t+1]),d<u){for(c=0;c<i;++c)l[c]=n[t+c];return l.length=i,d}return u}h=h||[NaN,NaN];let f=t+i;for(;f<e;)if(la(n,f-i,f,i,o,a,h),d=Ve(o,a,h[0],h[1]),d<u){for(u=d,c=0;c<i;++c)l[c]=h[c];l.length=i,f+=i}else f+=i*Math.max((Math.sqrt(d)-Math.sqrt(u))/r|0,1);if(s&&(la(n,e-i,t,i,o,a,h),d=Ve(o,a,h[0],h[1]),d<u)){for(u=d,c=0;c<i;++c)l[c]=h[c];l.length=i}return u}function Lh(n,t,e,i,r,s,o,a,l,u,h){h=h||[NaN,NaN];for(let c=0,d=e.length;c<d;++c){const f=e[c];u=ca(n,t,f,i,r,s,o,a,l,u,h),t=f}return u}function Dh(n,t,e,i){for(let r=0,s=e.length;r<s;++r)n[t++]=e[r];return t}function ha(n,t,e,i){for(let r=0,s=e.length;r<s;++r){const o=e[r];for(let a=0;a<i;++a)n[t++]=o[a]}return t}function Nh(n,t,e,i,r){r=r||[];let s=0;for(let o=0,a=e.length;o<a;++o){const l=ha(n,t,e[o],i);r[s++]=l,t=l}return r.length=s,r}function Uh(n,t,e,i,r,s,o){const a=(e-t)/i;if(a<3){for(;t<e;t+=i)s[o++]=n[t],s[o++]=n[t+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const u=[t,e-i];let h=0;for(;u.length>0;){const c=u.pop(),d=u.pop();let f=0;const g=n[d],p=n[d+1],m=n[c],y=n[c+1];for(let _=d+i;_<c;_+=i){const T=n[_],E=n[_+1],b=Lc(T,E,g,p,m,y);b>f&&(h=_,f=b)}f>r&&(l[(h-t)/i]=1,d+i<h&&u.push(d,h),h+i<c&&u.push(h,c))}for(let c=0;c<a;++c)l[c]&&(s[o++]=n[t+c*i],s[o++]=n[t+c*i+1]);return o}function qe(n,t){return t*Math.round(n/t)}function Fh(n,t,e,i,r,s,o){if(t==e)return o;let a=qe(n[t],r),l=qe(n[t+1],r);t+=i,s[o++]=a,s[o++]=l;let u,h;do if(u=qe(n[t],r),h=qe(n[t+1],r),t+=i,t==e)return s[o++]=u,s[o++]=h,o;while(u==a&&h==l);for(;t<e;){const c=qe(n[t],r),d=qe(n[t+1],r);if(t+=i,c==u&&d==h)continue;const f=u-a,g=h-l,p=c-a,m=d-l;if(f*m==g*p&&(f<0&&p<f||f==p||f>0&&p>f)&&(g<0&&m<g||g==m||g>0&&m>g)){u=c,h=d;continue}s[o++]=u,s[o++]=h,a=u,l=h,u=c,h=d}return s[o++]=u,s[o++]=h,o}function Bh(n,t,e,i,r,s,o,a){for(let l=0,u=e.length;l<u;++l){const h=e[l];o=Fh(n,t,h,i,r,s,o),a.push(o),t=h}return o}function da(n,t,e,i,r){r=r!==void 0?r:[];let s=0;for(let o=t;o<e;o+=i)r[s++]=n.slice(o,o+i);return r.length=s,r}function Xh(n,t,e,i,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];r[s++]=da(n,t,l,i,r[s]),t=l}return r.length=s,r}function fa(n,t,e,i){let r=0;const s=n[e-i],o=n[e-i+1];let a=0,l=0;for(;t<e;t+=i){const u=n[t]-s,h=n[t+1]-o;r+=l*u-a*h,a=u,l=h}return r/2}function Hh(n,t,e,i){let r=0;for(let s=0,o=e.length;s<o;++s){const a=e[s];r+=fa(n,t,a,i),t=a}return r}class Ln extends qr{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,e!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}clone(){return new Ln(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,r){return r<Bo(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ua(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ca(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,r))}getArea(){return fa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return da(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=Uh(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Ln(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ha(this.flatCoordinates,0,t,this.stride),this.changed()}}class Jr extends qr{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Jr(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,r){const s=this.flatCoordinates,o=Ve(t,e,s[0],s[1]);if(o<r){const a=this.stride;for(let l=0;l<a;++l)i[l]=s[l];return i.length=a,o}return r}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return Zc(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Xo(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Dh(this.flatCoordinates,0,t,this.stride),this.changed()}}function Gh(n,t,e,i,r){return!ko(r,function(o){return!Me(n,t,e,i,o[0],o[1])})}function Me(n,t,e,i,r,s){let o=0,a=n[e-i],l=n[e-i+1];for(;t<e;t+=i){const u=n[t],h=n[t+1];l<=s?h>s&&(u-a)*(s-l)-(r-a)*(h-l)>0&&o++:h<=s&&(u-a)*(s-l)-(r-a)*(h-l)<0&&o--,a=u,l=h}return o!==0}function ga(n,t,e,i,r,s){if(e.length===0||!Me(n,t,e[0],i,r,s))return!1;for(let o=1,a=e.length;o<a;++o)if(Me(n,e[o-1],e[o],i,r,s))return!1;return!0}function kh(n,t,e,i,r,s,o){let a,l,u,h,c,d,f;const g=r[s+1],p=[];for(let _=0,T=e.length;_<T;++_){const E=e[_];for(h=n[E-i],d=n[E-i+1],a=t;a<E;a+=i)c=n[a],f=n[a+1],(g<=d&&f<=g||d<=g&&g<=f)&&(u=(g-d)/(f-d)*(c-h)+h,p.push(u)),h=c,d=f}let m=NaN,y=-1/0;for(p.sort(Mo),h=p[0],a=1,l=p.length;a<l;++a){c=p[a];const _=Math.abs(c-h);_>y&&(u=(h+c)/2,ga(n,t,e,i,u,g)&&(m=u,y=_)),h=c}return isNaN(m)&&(m=r[s]),o?(o.push(m,g,y),o):[m,g,y]}function Vh(n,t,e,i,r){let s;for(t+=i;t<e;t+=i)if(s=r(n.slice(t-i,t),n.slice(t,t+i)),s)return s;return!1}function pa(n,t,e,i,r){const s=Go(Ye(),n,t,e,i);return yi(r,s)?Yc(r,s)||s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:Vh(n,t,e,i,function(o,a){return nh(r,o,a)}):!1}function jh(n,t,e,i,r){return!!(pa(n,t,e,i,r)||Me(n,t,e,i,r[0],r[1])||Me(n,t,e,i,r[0],r[3])||Me(n,t,e,i,r[2],r[1])||Me(n,t,e,i,r[2],r[3]))}function zh(n,t,e,i,r){if(!jh(n,t,e[0],i,r))return!1;if(e.length===1)return!0;for(let s=1,o=e.length;s<o;++s)if(Gh(n,e[s-1],e[s],i,r)&&!pa(n,e[s-1],e[s],i,r))return!1;return!0}function Wh(n,t,e,i){for(;t<e-i;){for(let r=0;r<i;++r){const s=n[t+r];n[t+r]=n[e-i+r],n[e-i+r]=s}t+=i,e-=i}}function ma(n,t,e,i){let r=0,s=n[e-i],o=n[e-i+1];for(;t<e;t+=i){const a=n[t],l=n[t+1];r+=(a-s)*(l+o),s=a,o=l}return r===0?void 0:r>0}function Yh(n,t,e,i,r){r=r!==void 0?r:!1;for(let s=0,o=e.length;s<o;++s){const a=e[s],l=ma(n,t,a,i);if(s===0){if(r&&l||!r&&!l)return!1}else if(r&&!l||!r&&l)return!1;t=a}return!0}function _a(n,t,e,i,r){r=r!==void 0?r:!1;for(let s=0,o=e.length;s<o;++s){const a=e[s],l=ma(n,t,a,i);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&Wh(n,t,a,i),t=a}return t}class xi extends qr{constructor(t,e,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,e!==void 0&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?Ac(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new xi(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,r){return r<Bo(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Oh(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Lh(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,r))}containsXY(t,e){return ga(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Hh(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),_a(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,Xh(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=Ze(this.getExtent());this.flatInteriorPoint_=kh(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Jr(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new Ln(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,r=[];let s=0;for(let o=0,a=i.length;o<a;++o){const l=i[o],u=new Ln(e.slice(s,l),t);r.push(u),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Yh(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=_a(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Bh(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new xi(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return zh(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=Nh(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}function ya(n){if(Ei(n))throw new Error("Cannot create polygon from empty extent");const t=n[0],e=n[1],i=n[2],r=n[3],s=[t,e,t,r,i,r,i,e,t,e];return new xi(s,"XY",[s.length])}const Qr=0;class Ea extends Ur{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=jr(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&lh(),t.center&&(t.center=ge(t.center,this.projection_)),t.extent&&(t.extent=Ke(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const a in Gt)delete e[a];this.setProperties(e,!0);const i=Kh(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const r=Zh(t),s=i.constraint,o=qh(t);this.constraints_={center:r,resolution:s,rotation:o},this.setRotation(t.rotation!==void 0?t.rotation:0),this.setCenterInternal(t.center!==void 0?t.center:null),t.resolution!==void 0?this.setResolution(t.resolution):t.zoom!==void 0&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const r=t||[0,0,0,0];e=e||[0,0,0,0];const s=this.getResolution(),o=s/2*(r[3]-e[3]+e[1]-r[1]),a=s/2*(r[0]-e[0]+e[2]-r[2]);this.setCenterInternal([i[0]+o,i[1]-a])}}getUpdatedOptions_(t){const e=this.getProperties();return e.resolution!==void 0?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let i=0;i<e.length;++i){let r=arguments[i];r.center&&(r=Object.assign({},r),r.center=ge(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=ge(r.anchor,this.getProjection())),e[i]=r}this.animateInternal.apply(this,e)}animateInternal(t){let e=arguments.length,i;e>1&&typeof arguments[e-1]=="function"&&(i=arguments[e-1],--e);let r=0;for(;r<e&&!this.isDef();++r){const h=arguments[r];h.center&&this.setCenterInternal(h.center),h.zoom!==void 0?this.setZoom(h.zoom):h.resolution&&this.setResolution(h.resolution),h.rotation!==void 0&&this.setRotation(h.rotation)}if(r===e){i&&Ri(i,!0);return}let s=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const u=[];for(;r<e;++r){const h=arguments[r],c={start:s,complete:!1,anchor:h.anchor,duration:h.duration!==void 0?h.duration:1e3,easing:h.easing||Th,callback:i};if(h.center&&(c.sourceCenter=o,c.targetCenter=h.center.slice(),o=c.targetCenter),h.zoom!==void 0?(c.sourceResolution=a,c.targetResolution=this.getResolutionForZoom(h.zoom),a=c.targetResolution):h.resolution&&(c.sourceResolution=a,c.targetResolution=h.resolution,a=c.targetResolution),h.rotation!==void 0){c.sourceRotation=l;const d=$n(h.rotation-l+Math.PI,2*Math.PI)-Math.PI;c.targetRotation=l+d,l=c.targetRotation}Jh(c)?c.complete=!0:s+=c.duration,u.push(c)}this.animations_.push(u),this.setHint(fe.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[fe.ANIMATING]>0}getInteracting(){return this.hints_[fe.INTERACTING]>0}cancelAnimations(){this.setHint(fe.ANIMATING,-this.hints_[fe.ANIMATING]);let t;for(let e=0,i=this.animations_.length;e<i;++e){const r=this.animations_[e];if(r[0].callback&&Ri(r[0].callback,!1),!t)for(let s=0,o=r.length;s<o;++s){const a=r[s];if(!a.complete){t=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const r=this.animations_[i];let s=!0;for(let o=0,a=r.length;o<a;++o){const l=r[o];if(l.complete)continue;const u=t-l.start;let h=l.duration>0?u/l.duration:1;h>=1?(l.complete=!0,h=1):s=!1;const c=l.easing(h);if(l.sourceCenter){const d=l.sourceCenter[0],f=l.sourceCenter[1],g=l.targetCenter[0],p=l.targetCenter[1];this.nextCenter_=l.targetCenter;const m=d+c*(g-d),y=f+c*(p-f);this.targetCenter_=[m,y]}if(l.sourceResolution&&l.targetResolution){const d=c===1?l.targetResolution:l.sourceResolution+c*(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=c===1?$n(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+c*(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),e=!0,!l.complete)break}if(s){this.animations_[i]=null,this.setHint(fe.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=r[0].callback;o&&Ri(o,!0)}}this.animations_=this.animations_.filter(Boolean),e&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const r=this.getCenterInternal();return r!==void 0&&(i=[r[0]-e[0],r[1]-e[1]],sh(i,t-this.getRotation()),rh(i,e)),i}calculateCenterZoom(t,e){let i;const r=this.getCenterInternal(),s=this.getResolution();if(r!==void 0&&s!==void 0){const o=e[0]-t*(e[0]-r[0])/s,a=e[1]-t*(e[1]-r[1])/s;i=[o,a]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],r=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(r*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(r*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t&&ta(t,this.getProjection())}getCenterInternal(){return this.get(Gt.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return t!==void 0?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){const e=this.calculateExtentInternal(t);return fh(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();Bt(e,"The view center is not defined");const i=this.getResolution();Bt(i!==void 0,"The view resolution is not defined");const r=this.getRotation();return Bt(r!==void 0,"The view rotation is not defined"),Qc(e,i,r,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(Gt.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Ke(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=ct(t)/e[0],r=kt(t)/e[1];return Math.max(i,r)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,r=Math.log(e/i)/Math.log(t);return function(s){return e/Math.pow(t,s*r)}}getRotation(){return this.get(Gt.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,s=Math.log(i/r)/e;return function(o){return Math.log(i/o)/e/s}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let r=this.getCenterInternal();const s=this.padding_;if(s){const o=this.getViewportSizeMinusPadding_();r=ts(r,this.getViewportSize_(),[o[0]/2+s[3],o[1]/2+s[0]],e,i)}return{center:r.slice(0),projection:t!==void 0?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return e!==void 0&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e=this.minZoom_||0,i,r;if(this.resolutions_){const s=Oo(this.resolutions_,t,1);e=s,i=this.resolutions_[s],s==this.resolutions_.length-1?r=2:r=i/this.resolutions_[s+1]}else i=this.maxResolution_,r=this.zoomFactor_;return e+Math.log(i/t)/Math.log(r)}getResolutionForZoom(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;const e=ft(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,ft(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(Bt(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){Bt(!Ei(t),"Cannot fit empty extent provided as `geometry`");const r=Ke(t,this.getProjection());i=ya(r)}else if(t.getType()==="Circle"){const r=Ke(t.getExtent(),this.getProjection());i=ya(r),i.rotate(this.getRotation(),Ze(r))}else i=t;this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),r=Math.sin(-e),s=t.getFlatCoordinates(),o=t.getStride();let a=1/0,l=1/0,u=-1/0,h=-1/0;for(let c=0,d=s.length;c<d;c+=o){const f=s[c]*i-s[c+1]*r,g=s[c]*r+s[c+1]*i;a=Math.min(a,f),l=Math.min(l,g),u=Math.max(u,f),h=Math.max(h,g)}return[a,l,u,h]}fitInternal(t,e){e=e||{};let i=e.size;i||(i=this.getViewportSizeMinusPadding_());const r=e.padding!==void 0?e.padding:[0,0,0,0],s=e.nearest!==void 0?e.nearest:!1;let o;e.minResolution!==void 0?o=e.minResolution:e.maxZoom!==void 0?o=this.getResolutionForZoom(e.maxZoom):o=0;const a=this.rotatedExtentForGeometry(t);let l=this.getResolutionForExtentInternal(a,[i[0]-r[1]-r[3],i[1]-r[0]-r[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,s?0:1);const u=this.getRotation(),h=Math.sin(u),c=Math.cos(u),d=Ze(a);d[0]+=(r[1]-r[3])/2*l,d[1]+=(r[0]-r[2])/2*l;const f=d[0]*c-d[1]*h,g=d[1]*c+d[0]*h,p=this.getConstrainedCenter([f,g],l),m=e.callback?e.callback:Lr;e.duration!==void 0?this.animateInternal({resolution:l,center:p,duration:e.duration,easing:e.easing},m):(this.targetResolution_=l,this.targetCenter_=p,this.applyTargetState_(!1,!0),Ri(m,!0))}centerOn(t,e,i){this.centerOnInternal(ge(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(ts(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,r){let s;const o=this.padding_;if(o&&t){const a=this.getViewportSizeMinusPadding_(-i),l=ts(t,r,[a[0]/2+o[3],a[1]/2+o[0]],e,i);s=[t[0]-l[0],t[1]-l[1]]}return s}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(t){const e=ta(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){const e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&ge(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*t,0,r,i);e&&(this.targetCenter_=this.calculateCenterZoom(s,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=ge(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(r,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t&&ge(t,this.getProjection()))}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,r=this.constraints_.rotation(this.targetRotation_,i),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,0,s,i),a=this.constraints_.center(this.targetCenter_,o,s,i,this.calculateCenterShift(this.targetCenter_,o,r,s));this.get(Gt.ROTATION)!==r&&this.set(Gt.ROTATION,r),this.get(Gt.RESOLUTION)!==o&&(this.set(Gt.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Gt.CENTER)||!bi(this.get(Gt.CENTER),a))&&this.set(Gt.CENTER,a),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=t!==void 0?t:200;const r=e||0,s=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(s),a=this.constraints_.resolution(this.targetResolution_,r,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,s,o));if(t===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=s,this.targetCenter_=l,this.applyTargetState_();return}i=i||(t===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==s||!this.getCenterInternal()||!bi(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:t,easing:vh,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(fe.INTERACTING,1)}endInteraction(t,e,i){i=i&&ge(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(fe.INTERACTING,-1),this.resolveConstraints(t,e,i))}getConstrainedCenter(t,e){const i=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),i)}getConstrainedZoom(t,e){const i=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(i,e))}getConstrainedResolution(t,e){e=e||0;const i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,i)}}function Ri(n,t){setTimeout(function(){n(t)},0)}function Zh(n){if(n.extent!==void 0){const e=n.smoothExtentConstraint!==void 0?n.smoothExtentConstraint:!0;return ea(n.extent,n.constrainOnlyCenter,e)}const t=jr(n.projection,"EPSG:3857");if(n.multiWorld!==!0&&t.isGlobal()){const e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,ea(e,!1,!1)}return ph}function Kh(n){let t,e,i,o=n.minZoom!==void 0?n.minZoom:Qr,a=n.maxZoom!==void 0?n.maxZoom:28;const l=n.zoomFactor!==void 0?n.zoomFactor:2,u=n.multiWorld!==void 0?n.multiWorld:!1,h=n.smoothResolutionConstraint!==void 0?n.smoothResolutionConstraint:!0,c=n.showFullExtent!==void 0?n.showFullExtent:!1,d=jr(n.projection,"EPSG:3857"),f=d.getExtent();let g=n.constrainOnlyCenter,p=n.extent;if(!u&&!p&&d.isGlobal()&&(g=!1,p=f),n.resolutions!==void 0){const m=n.resolutions;e=m[o],i=m[a]!==void 0?m[a]:m[m.length-1],n.constrainResolution?t=mh(m,h,!g&&p,c):t=na(e,i,h,!g&&p,c)}else{const y=(f?Math.max(ct(f),kt(f)):360*gi.degrees/d.getMetersPerUnit())/Fc/Math.pow(2,Qr),_=y/Math.pow(2,28-Qr);e=n.maxResolution,e!==void 0?o=0:e=y/Math.pow(l,o),i=n.minResolution,i===void 0&&(n.maxZoom!==void 0?n.maxResolution!==void 0?i=e/Math.pow(l,a):i=y/Math.pow(l,a):i=_),a=o+Math.floor(Math.log(e/i)/Math.log(l)),i=e/Math.pow(l,a-o),n.constrainResolution?t=_h(l,e,i,h,!g&&p,c):t=na(e,i,h,!g&&p,c)}return{constraint:t,maxResolution:e,minResolution:i,minZoom:o,zoomFactor:l}}function qh(n){if(n.enableRotation!==void 0?n.enableRotation:!0){const e=n.constrainRotation;return e===void 0||e===!0?bh():e===!1?ia:typeof e=="number"?Eh(e):ia}return yh}function Jh(n){return!(n.sourceCenter&&n.targetCenter&&!bi(n.sourceCenter,n.targetCenter)||n.sourceResolution!==n.targetResolution||n.sourceRotation!==n.targetRotation)}function ts(n,t,e,i,r){const s=Math.cos(-r);let o=Math.sin(-r),a=n[0]*s-n[1]*o,l=n[1]*s+n[0]*o;a+=(t[0]/2-e[0])*i,l+=(e[1]-t[1]/2)*i,o=-o;const u=a*s-l*o,h=l*s+a*o;return[u,h]}class Qh extends Uc{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(W.SOURCE,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return t=t||[],t.push(this),t}getLayerStatesArray(t){return t=t||[],t.push(this.getLayerState()),t}getSource(){return this.get(W.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(Wt(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=de(t,It.CHANGE,this.handleSourceChange_,this),t.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return!this.renderer_||!this.rendered?null:this.renderer_.getData(t)}isVisible(t){let e;const i=this.getMapInternal();!t&&i&&(t=i.getView()),t instanceof Ea?e={viewState:t.getState(),extent:t.calculateExtent()}:e=t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray());let r;e.layerStatesArray?r=e.layerStatesArray.find(o=>o.layer===this):r=this.getLayerState();const s=this.getExtent();return td(r,e.viewState)&&(!s||yi(s,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];let e;const i=this.getSource();if(i&&(e=i.getAttributions()),!e)return[];const r=t instanceof Ea?t.getViewStateAndExtent():t;let s=e(r);return Array.isArray(s)||(s=[s]),s}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(W.MAP,t)}getMapInternal(){return this.get(W.MAP)}setMap(t){this.mapPrecomposeKey_&&(Wt(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(Wt(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=de(t,Ie.PRECOMPOSE,function(e){const r=e.frameState.layerStatesArray,s=this.getLayerState(!1);Bt(!r.some(function(o){return o.layer===s.layer}),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),r.push(s)},this),this.mapRenderKey_=de(this,It.CHANGE,t.render,t),this.changed())}setSource(t){this.set(W.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}disposeInternal(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),super.disposeInternal()}}function td(n,t){if(!n.visible)return!1;const e=t.resolution;if(e<n.minResolution||e>=n.maxResolution)return!1;const i=t.zoom;return i>n.minZoom&&i<=n.maxZoom}const wi={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class ed extends Qh{constructor(t){t=t||{};const e=Object.assign({},t),i=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i,this.setPreload(t.preload!==void 0?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(wi.PRELOAD)}setPreload(t){this.set(wi.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(wi.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(wi.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}const ba=.5,A={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class es extends Nr{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=i.transition===void 0?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(It.CHANGE)}release(){this.state===A.ERROR&&this.setState(A.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==A.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){ot()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(!i)i=e,this.transitionStarts_[t]=i;else if(i===-1)return 1;const r=e-i+1e3/60;return r>=this.transition_?1:ra(r/this.transition_)}inTransition(t){return this.transition_?this.transitionStarts_[t]!==-1:!1}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}}const pe=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"";pe.includes("firefox");const nd=pe.includes("safari")&&!pe.includes("chrom")&&(pe.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(pe));pe.includes("webkit")&&pe.includes("edge"),pe.includes("macintosh");const id=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,rd=typeof Image<"u"&&Image.prototype.decode;(function(){let n=!1;try{const t=Object.defineProperty({},"passive",{get:function(){n=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return n})();function me(n,t,e,i){let r;return e&&e.length?r=e.shift():id?r=new OffscreenCanvas(n||300,t||300):r=document.createElement("canvas"),n&&(r.width=n),t&&(r.height=t),r.getContext("2d",i)}function Dn(n){const t=n.canvas;t.width=1,t.height=1,n.clearRect(0,0,1,1)}function Ci(n){return n instanceof Image||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement||n instanceof ImageBitmap?n:null}function ns(n){return n instanceof Uint8Array||n instanceof Uint8ClampedArray||n instanceof Float32Array||n instanceof DataView?n:null}const sd=new Error("disposed");let Je=null;function od(n){Je||(Je=me(n.width,n.height,void 0,{willReadFrequently:!0}));const t=Je.canvas,e=n.width;t.width!==e&&(t.width=e);const i=n.height;return t.height!==i&&(t.height=i),Je.clearRect(0,0,e,i),Je.drawImage(n,0,0),Je.getImageData(0,0,e,i).data}const ad=[256,256];class va extends es{constructor(t){const e=A.IDLE;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;const t=Ci(this.data_);return t?[t.width,t.height]:ad}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==A.IDLE&&this.state!==A.ERROR)return;this.state=A.LOADING,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=A.LOADED,t.changed()}).catch(function(e){t.error_=e,t.state=A.ERROR,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(sd),this.controller_=null),super.disposeInternal()}}const ld=10,Ta=.25;class xa{constructor(t,e,i,r,s,o){this.sourceProj_=t,this.targetProj_=e;let a={};const l=vi(this.targetProj_,this.sourceProj_);this.transformInv_=function(_){const T=_[0]+"/"+_[1];return a[T]||(a[T]=l(_)),a[T]},this.maxSourceExtent_=r,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&ct(r)>=ct(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?ct(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?ct(this.targetProj_.getExtent()):null;const u=kr(i),h=zo(i),c=jo(i),d=Vo(i),f=this.transformInv_(u),g=this.transformInv_(h),p=this.transformInv_(c),m=this.transformInv_(d),y=ld+(o?Math.max(0,Math.ceil(Math.log2(Mn(i)/(o*o*256*256)))):0);if(this.addQuad_(u,h,c,d,f,g,p,m,y),this.wrapsXInSource_){let _=1/0;this.triangles_.forEach(function(T,E,b){_=Math.min(_,T.source[0][0],T.source[1][0],T.source[2][0])}),this.triangles_.forEach(T=>{if(Math.max(T.source[0][0],T.source[1][0],T.source[2][0])-_>this.sourceWorldWidth_/2){const E=[[T.source[0][0],T.source[0][1]],[T.source[1][0],T.source[1][1]],[T.source[2][0],T.source[2][1]]];E[0][0]-_>this.sourceWorldWidth_/2&&(E[0][0]-=this.sourceWorldWidth_),E[1][0]-_>this.sourceWorldWidth_/2&&(E[1][0]-=this.sourceWorldWidth_),E[2][0]-_>this.sourceWorldWidth_/2&&(E[2][0]-=this.sourceWorldWidth_);const b=Math.min(E[0][0],E[1][0],E[2][0]);Math.max(E[0][0],E[1][0],E[2][0])-b<this.sourceWorldWidth_/2&&(T.source=E)}})}a={}}addTriangle_(t,e,i,r,s,o){this.triangles_.push({source:[r,s,o],target:[t,e,i]})}addQuad_(t,e,i,r,s,o,a,l,u){const h=Br([s,o,a,l]),c=this.sourceWorldWidth_?ct(h)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&c>.5&&c<1;let g=!1;if(u>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const m=Br([t,e,i,r]);g=ct(m)/this.targetWorldWidth_>Ta||g}!f&&this.sourceProj_.isGlobal()&&c&&(g=c>Ta||g)}if(!g&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!yi(h,this.maxSourceExtent_))return;let p=0;if(!g&&(!isFinite(s[0])||!isFinite(s[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(u>0)g=!0;else if(p=(!isFinite(s[0])||!isFinite(s[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),p!=1&&p!=2&&p!=4&&p!=8)return}if(u>0){if(!g){const m=[(t[0]+i[0])/2,(t[1]+i[1])/2],y=this.transformInv_(m);let _;f?_=($n(s[0],d)+$n(a[0],d))/2-$n(y[0],d):_=(s[0]+a[0])/2-y[0];const T=(s[1]+a[1])/2-y[1];g=_*_+T*T>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const m=[(e[0]+i[0])/2,(e[1]+i[1])/2],y=this.transformInv_(m),_=[(r[0]+t[0])/2,(r[1]+t[1])/2],T=this.transformInv_(_);this.addQuad_(t,e,m,_,s,o,y,T,u-1),this.addQuad_(_,m,i,r,T,y,a,l,u-1)}else{const m=[(t[0]+e[0])/2,(t[1]+e[1])/2],y=this.transformInv_(m),_=[(i[0]+r[0])/2,(i[1]+r[1])/2],T=this.transformInv_(_);this.addQuad_(t,m,_,r,s,y,T,l,u-1),this.addQuad_(m,e,i,_,y,o,a,T,u-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}p&11||this.addTriangle_(t,i,r,s,a,l),p&14||this.addTriangle_(t,i,e,s,a,o),p&&(p&13||this.addTriangle_(e,r,t,o,l,s),p&7||this.addTriangle_(e,r,i,o,l,a))}calculateSourceExtent(){const t=Ye();return this.triangles_.forEach(function(e,i,r){const s=e.source;_i(t,s[0]),_i(t,s[1]),_i(t,s[2])}),t}getTriangles(){return this.triangles_}}let is;const ie=[];function Ra(n,t,e,i,r){n.beginPath(),n.moveTo(0,0),n.lineTo(t,e),n.lineTo(i,r),n.closePath(),n.save(),n.clip(),n.fillRect(0,0,Math.max(t,i)+1,Math.max(e,r)),n.restore()}function rs(n,t){return Math.abs(n[t*4]-210)>2||Math.abs(n[t*4+3]-.75*255)>2}function ud(){if(is===void 0){const n=me(6,6,ie);n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",Ra(n,4,5,4,0),Ra(n,4,5,0,5);const t=n.getImageData(0,0,3,3).data;is=rs(t,0)||rs(t,4)||rs(t,8),Dn(n),ie.push(n.canvas)}return is}function wa(n,t,e,i){const r=dh(e,t,n);let s=qo(t,i,e);const o=t.getMetersPerUnit();o!==void 0&&(s*=o);const a=n.getMetersPerUnit();a!==void 0&&(s/=a);const l=n.getExtent();if(!l||Xr(l,r)){const u=qo(n,s,r)/s;isFinite(u)&&u>0&&(s/=u)}return s}function Ca(n,t,e,i){const r=Ze(e);let s=wa(n,t,r,i);return(!isFinite(s)||s<=0)&&ko(e,function(o){return s=wa(n,t,o,i),isFinite(s)&&s>0}),s}function Sa(n,t,e,i,r,s,o,a,l,u,h,c,d,f){const g=me(Math.round(e*n),Math.round(e*t),ie);if(c||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(e,e);function p(b){return Math.round(b*e)/e}g.globalCompositeOperation="lighter";const m=Ye();l.forEach(function(b,v,C){qc(m,b.extent)});let y;const _=e/i,T=(c?1:1+Math.pow(2,-24))/_;if(!d||l.length!==1||u!==0){if(y=me(Math.round(ct(m)*_),Math.round(kt(m)*_),ie),c||(y.imageSmoothingEnabled=!1),r&&f){const b=(r[0]-m[0])*_,v=-(r[3]-m[3])*_,C=ct(r)*_,w=kt(r)*_;y.rect(b,v,C,w),y.clip()}l.forEach(function(b,v,C){if(b.image.width>0&&b.image.height>0){if(b.clipExtent){y.save();const V=(b.clipExtent[0]-m[0])*_,q=-(b.clipExtent[3]-m[3])*_,J=ct(b.clipExtent)*_,at=kt(b.clipExtent)*_;y.rect(c?V:Math.round(V),c?q:Math.round(q),c?J:Math.round(V+J)-Math.round(V),c?at:Math.round(q+at)-Math.round(q)),y.clip()}const w=(b.extent[0]-m[0])*_,I=-(b.extent[3]-m[3])*_,X=ct(b.extent)*_,F=kt(b.extent)*_;y.drawImage(b.image,u,u,b.image.width-2*u,b.image.height-2*u,c?w:Math.round(w),c?I:Math.round(I),c?X:Math.round(w+X)-Math.round(w),c?F:Math.round(I+F)-Math.round(I)),b.clipExtent&&y.restore()}})}const E=kr(o);return a.getTriangles().forEach(function(b,v,C){const w=b.source,I=b.target;let X=w[0][0],F=w[0][1],V=w[1][0],q=w[1][1],J=w[2][0],at=w[2][1];const Q=p((I[0][0]-E[0])/s),Ct=p(-(I[0][1]-E[1])/s),Pt=p((I[1][0]-E[0])/s),Vt=p(-(I[1][1]-E[1])/s),ln=p((I[2][0]-E[0])/s),re=p(-(I[2][1]-E[1])/s),se=X,ws=F;X=0,F=0,V-=se,q-=ws,J-=se,at-=ws;const ag=[[V,q,0,0,Pt-Q],[J,at,0,0,ln-Q],[0,0,V,q,Vt-Ct],[0,0,J,at,re-Ct]],Vn=Dc(ag);if(!Vn)return;if(g.save(),g.beginPath(),ud()||!c){g.moveTo(Pt,Vt);const oe=4,zn=Q-Pt,Rl=Ct-Vt;for(let Le=0;Le<oe;Le++)g.lineTo(Pt+p((Le+1)*zn/oe),Vt+p(Le*Rl/(oe-1))),Le!=oe-1&&g.lineTo(Pt+p((Le+1)*zn/oe),Vt+p((Le+1)*Rl/(oe-1)));g.lineTo(ln,re)}else g.moveTo(Pt,Vt),g.lineTo(Q,Ct),g.lineTo(ln,re);g.clip(),g.transform(Vn[0],Vn[2],Vn[1],Vn[3],Q,Ct),g.translate(m[0]-se,m[3]-ws);let jn;if(y)jn=y.canvas,g.scale(T,-T);else{const oe=l[0],zn=oe.extent;jn=oe.image,g.scale(ct(zn)/jn.width,-kt(zn)/jn.height)}g.drawImage(jn,0,0),g.restore()}),y&&(Dn(y),ie.push(y.canvas)),h&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEach(function(b,v,C){const w=b.target,I=(w[0][0]-E[0])/s,X=-(w[0][1]-E[1])/s,F=(w[1][0]-E[0])/s,V=-(w[1][1]-E[1])/s,q=(w[2][0]-E[0])/s,J=-(w[2][1]-E[1])/s;g.beginPath(),g.moveTo(F,V),g.lineTo(I,X),g.lineTo(q,J),g.closePath(),g.stroke()}),g.restore()),g.canvas}class Aa extends va{constructor(t){super({tileCoord:t.tileCoord,loader:()=>Promise.resolve(new Uint8ClampedArray(4)),interpolate:t.interpolate,transition:t.transition}),this.pixelRatio_=t.pixelRatio,this.gutter_=t.gutter,this.reprojData_=null,this.reprojError_=null,this.reprojSize_=void 0,this.sourceTileGrid_=t.sourceTileGrid,this.targetTileGrid_=t.targetTileGrid,this.wrappedTileCoord_=t.wrappedTileCoord||t.tileCoord,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const e=t.sourceProj,i=e.getExtent(),r=t.sourceTileGrid.getExtent();this.clipExtent_=e.canWrapX()?r?Zt(i,r):i:r;const s=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),o=this.targetTileGrid_.getExtent();let a=this.sourceTileGrid_.getExtent();const l=o?Zt(s,o):s;if(Mn(l)===0){this.state=A.EMPTY;return}i&&(a?a=Zt(a,i):a=i);const u=this.targetTileGrid_.getResolution(this.wrappedTileCoord_[0]),h=t.targetProj,c=Ca(e,h,l,u);if(!isFinite(c)||c<=0){this.state=A.EMPTY;return}const d=t.errorThreshold!==void 0?t.errorThreshold:ba;if(this.triangulation_=new xa(e,h,l,a,c*d,u),this.triangulation_.getTriangles().length===0){this.state=A.EMPTY;return}this.sourceZ_=this.sourceTileGrid_.getZForResolution(c);let f=this.triangulation_.calculateSourceExtent();if(a&&(e.canWrapX()?(f[1]=ft(f[1],a[1],a[3]),f[3]=ft(f[3],a[1],a[3])):f=Zt(f,a)),!Mn(f))this.state=A.EMPTY;else{let g=0,p=0;e.canWrapX()&&(g=ct(i),p=Math.floor((f[0]-i[0])/g)),Wo(f.slice(),e,!0).forEach(y=>{const _=this.sourceTileGrid_.getTileRangeForExtentAndZ(y,this.sourceZ_),T=t.getTileFunction;for(let E=_.minX;E<=_.maxX;E++)for(let b=_.minY;b<=_.maxY;b++){const v=T(this.sourceZ_,E,b,this.pixelRatio_);if(v){const C=p*g;this.sourceTiles_.push({tile:v,offset:C})}}++p}),this.sourceTiles_.length===0&&(this.state=A.EMPTY)}}getSize(){return this.reprojSize_}getData(){return this.reprojData_}getError(){return this.reprojError_}reproject_(){const t=[];let e=!1;if(this.sourceTiles_.forEach(g=>{var Ct;const p=g.tile;if(!p||p.getState()!==A.LOADED)return;const m=p.getSize(),y=this.gutter_;let _;const T=ns(p.getData());T?_=T:(e=!0,_=od(Ci(p.getData())));const E=[m[0]+2*y,m[1]+2*y],b=_ instanceof Float32Array,v=E[0]*E[1],C=b?Float32Array:Uint8ClampedArray,w=new C(_.buffer),I=C.BYTES_PER_ELEMENT,X=I*w.length/v,F=w.byteLength/E[1],V=Math.floor(F/I/E[0]),q=v*V;let J=w;if(w.length!==q){J=new C(q);let Pt=0,Vt=0;const ln=E[0]*V;for(let re=0;re<E[1];++re){for(let se=0;se<ln;++se)J[Pt++]=w[Vt+se];Vt+=F/I}}const at=this.sourceTileGrid_.getTileCoordExtent(p.tileCoord);at[0]+=g.offset,at[2]+=g.offset;const Q=(Ct=this.clipExtent_)==null?void 0:Ct.slice();Q&&(Q[0]+=g.offset,Q[2]+=g.offset),t.push({extent:at,clipExtent:Q,data:new Uint8ClampedArray(J.buffer),dataType:C,bytesPerPixel:X,pixelSize:E})}),this.sourceTiles_.length=0,t.length===0){this.state=A.ERROR,this.changed();return}const i=this.wrappedTileCoord_[0],r=this.targetTileGrid_.getTileSize(i),s=typeof r=="number"?r:r[0],o=typeof r=="number"?r:r[1],a=this.targetTileGrid_.getResolution(i),l=this.sourceTileGrid_.getResolution(this.sourceZ_),u=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);let h,c;const d=t[0].bytesPerPixel,f=Math.ceil(d/3);for(let g=f-1;g>=0;--g){const p=[];for(let b=0,v=t.length;b<v;++b){const C=t[b],w=C.data,I=C.pixelSize,X=I[0],F=I[1],V=me(X,F,ie),q=V.createImageData(X,F),J=q.data;let at=g*3;for(let Q=0,Ct=J.length;Q<Ct;Q+=4)J[Q]=w[at],J[Q+1]=w[at+1],J[Q+2]=w[at+2],J[Q+3]=255,at+=d;V.putImageData(q,0,0),p.push({extent:C.extent,clipExtent:C.clipExtent,image:V.canvas})}const m=Sa(s,o,this.pixelRatio_,l,this.sourceTileGrid_.getExtent(),a,u,this.triangulation_,p,this.gutter_,!1,!1,!1);for(let b=0,v=p.length;b<v;++b){const w=p[b].image.getContext("2d");Dn(w),ie.push(w.canvas)}const y=m.getContext("2d"),_=y.getImageData(0,0,m.width,m.height);Dn(y),ie.push(m),h||(c=new Uint8ClampedArray(d*_.width*_.height),h=new t[0].dataType(c.buffer));const T=_.data;let E=g*3;for(let b=0,v=T.length;b<v;b+=4)T[b+3]===255?(c[E]=T[b],c[E+1]=T[b+1],c[E+2]=T[b+2]):(c[E]=0,c[E+1]=0,c[E+2]=0),E+=d}if(e){const g=me(s,o),p=new ImageData(h,s);g.putImageData(p,0,0),this.reprojData_=g.canvas}else this.reprojData_=h;this.reprojSize_=[Math.round(s*this.pixelRatio_),Math.round(o*this.pixelRatio_)],this.state=A.LOADED,this.changed()}load(){if(this.state!==A.IDLE&&this.state!==A.ERROR)return;this.state=A.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const i=e.getState();if(i!==A.IDLE&&i!==A.LOADING)return;t++;const r=de(e,It.CHANGE,function(){const s=e.getState();(s==A.LOADED||s==A.ERROR||s==A.EMPTY)&&(Wt(r),t--,t===0&&(this.unlistenSources_(),this.reproject_()))},this);this.sourcesListenerKeys_.push(r)}),t===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:e}){e.getState()==A.IDLE&&e.load()})}unlistenSources_(){this.sourcesListenerKeys_.forEach(Wt),this.sourcesListenerKeys_=null}}class ss extends es{constructor(t,e,i,r,s,o,a,l,u,h,c,d){super(s,A.IDLE,d),this.renderEdges_=c!==void 0?c:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=r,this.wrappedTileCoord_=o||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const f=r.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let p=this.sourceTileGrid_.getExtent();const m=g?Zt(f,g):f;if(Mn(m)===0){this.state=A.EMPTY;return}const y=t.getExtent();y&&(p?p=Zt(p,y):p=y);const _=r.getResolution(this.wrappedTileCoord_[0]),T=Ca(t,i,m,_);if(!isFinite(T)||T<=0){this.state=A.EMPTY;return}const E=h!==void 0?h:ba;if(this.triangulation_=new xa(t,i,m,p,T*E,_),this.triangulation_.getTriangles().length===0){this.state=A.EMPTY;return}this.sourceZ_=e.getZForResolution(T);let b=this.triangulation_.calculateSourceExtent();if(p&&(t.canWrapX()?(b[1]=ft(b[1],p[1],p[3]),b[3]=ft(b[3],p[1],p[3])):b=Zt(b,p)),!Mn(b))this.state=A.EMPTY;else{let v=0,C=0;t.canWrapX()&&(v=ct(y),C=Math.floor((b[0]-y[0])/v)),Wo(b.slice(),t,!0).forEach(I=>{const X=e.getTileRangeForExtentAndZ(I,this.sourceZ_);for(let F=X.minX;F<=X.maxX;F++)for(let V=X.minY;V<=X.maxY;V++){const q=u(this.sourceZ_,F,V,a);if(q){const J=C*v;this.sourceTiles_.push({tile:q,offset:J})}}++C}),this.sourceTiles_.length===0&&(this.state=A.EMPTY)}}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{var r;const i=e.tile;if(i&&i.getState()==A.LOADED){const s=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);s[0]+=e.offset,s[2]+=e.offset;const o=(r=this.clipExtent_)==null?void 0:r.slice();o&&(o[0]+=e.offset,o[2]+=e.offset),t.push({extent:s,clipExtent:o,image:i.getImage()})}}),this.sourceTiles_.length=0,t.length===0)this.state=A.ERROR;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),r=typeof i=="number"?i:i[0],s=typeof i=="number"?i:i[1],o=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Sa(r,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=A.LOADED}this.changed()}load(){if(this.state==A.IDLE){this.state=A.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const i=e.getState();if(i==A.IDLE||i==A.LOADING){t++;const r=de(e,It.CHANGE,function(s){const o=e.getState();(o==A.LOADED||o==A.ERROR||o==A.EMPTY)&&(Wt(r),t--,t===0&&(this.unlistenSources_(),this.reproject_()))},this);this.sourcesListenerKeys_.push(r)}}),t===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:e},i,r){e.getState()==A.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(Wt),this.sourcesListenerKeys_=null}release(){this.canvas_&&(Dn(this.canvas_.getContext("2d")),ie.push(this.canvas_),this.canvas_=null),super.release()}}const Qe={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function cd(n,t,e){const i=n;let r=!0,s=!1,o=!1;const a=[di(i,It.LOAD,function(){o=!0,s||t()})];return i.src&&rd?(s=!0,i.decode().then(function(){r&&t()}).catch(function(l){r&&(o?t():e())})):a.push(di(i,It.ERROR,e)),function(){r=!1,a.forEach(Wt)}}class Ia extends es{constructor(t,e,i,r,s,o){super(t,e,o),this.crossOrigin_=r,this.src_=i,this.key=i,this.image_=new Image,r!==null&&(this.image_.crossOrigin=r),this.unlisten_=null,this.tileLoadFunction_=s}getImage(){return this.image_}setImage(t){this.image_=t,this.state=A.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=A.ERROR,this.unlistenImage_(),this.image_=hd(),this.changed()}handleImageLoad_(){const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=A.LOADED:this.state=A.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==A.ERROR&&(this.state=A.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==A.IDLE&&(this.state=A.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=cd(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function hd(){const n=me(1,1);return n.fillStyle="rgba(0,0,0,0)",n.fillRect(0,0,1,1),n.canvas}class dd extends Nr{constructor(t){super(),this.tile,this.handleTileChange_=this.handleTileChange_.bind(this),this.gutter_=t.gutter||0,this.helper_=t.helper,this.loaded=!1,this.ready=!1}setTile(t){if(t!==this.tile)if(this.tile&&this.tile.removeEventListener(It.CHANGE,this.handleTileChange_),this.tile=t,this.loaded=t.getState()===A.LOADED,this.loaded)this.uploadTile();else{if(t instanceof Ia){const e=t.getImage();e instanceof Image&&!e.crossOrigin&&(e.crossOrigin="anonymous")}t.addEventListener(It.CHANGE,this.handleTileChange_)}}uploadTile(){ot()}setReady(){this.ready=!0,this.dispatchEvent(It.CHANGE)}handleTileChange_(){this.tile.getState()===A.LOADED&&(this.loaded=!0,this.uploadTile())}disposeInternal(){this.tile.removeEventListener(It.CHANGE,this.handleTileChange_)}}const os=34962,as=34963,fd=35040,ls=35044,gd=35048,pd=5121,md=5123,_d=5125,$a=5126,Pa=["experimental-webgl","webgl","webkit-3d","moz-webgl"];function yd(n,t){t=Object.assign({preserveDrawingBuffer:!0,antialias:!nd},t);const e=Pa.length;for(let i=0;i<e;++i)try{const r=n.getContext(Pa[i],t);if(r)return r}catch{}return null}const Ed={STATIC_DRAW:ls,STREAM_DRAW:fd,DYNAMIC_DRAW:gd};class Ma{constructor(t,e){this.array_=null,this.type_=t,Bt(t===os||t===as,"A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`"),this.usage_=e!==void 0?e:Ed.STATIC_DRAW}ofSize(t){return this.array_=new(us(this.type_))(t),this}fromArray(t){return this.array_=us(this.type_).from(t),this}fromArrayBuffer(t){return this.array_=new(us(this.type_))(t),this}getType(){return this.type_}getArray(){return this.array_}getUsage(){return this.usage_}getSize(){return this.array_?this.array_.length:0}}function us(n){switch(n){case os:return Float32Array;case as:return Uint32Array;default:return Float32Array}}function Nn(n,t){return Array.isArray(n)?n:(t===void 0?t=[n,n]:(t[0]=n,t[1]=n),t)}function Oa(n,t,e){const i=e?n.LINEAR:n.NEAREST;n.bindTexture(n.TEXTURE_2D,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,i),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,i)}function bd(n,t,e,i){Oa(n,t,i),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e)}function La(n,t,e,i,r,s){const o=n.getGL();let a,l;e instanceof Float32Array?(a=o.FLOAT,n.getExtension("OES_texture_float"),l=n.getExtension("OES_texture_float_linear")!==null):(a=o.UNSIGNED_BYTE,l=!0),Oa(o,t,s&&l);const u=e.byteLength/i[1];let h=1;u%8===0?h=8:u%4===0?h=4:u%2===0&&(h=2);let c;switch(r){case 1:{c=o.LUMINANCE;break}case 2:{c=o.LUMINANCE_ALPHA;break}case 3:{c=o.RGB;break}case 4:{c=o.RGBA;break}default:throw new Error(`Unsupported number of bands: ${r}`)}const d=o.getParameter(o.UNPACK_ALIGNMENT);o.pixelStorei(o.UNPACK_ALIGNMENT,h),o.texImage2D(o.TEXTURE_2D,0,c,i[0],i[1],0,c,a,e),o.pixelStorei(o.UNPACK_ALIGNMENT,d)}let tn=null;function vd(){tn=me(1,1,void 0,{willReadFrequently:!0})}class Td extends dd{constructor(t){super(t),this.textures=[],this.renderSize_=Nn(t.grid.getTileSize(t.tile.tileCoord[0])),this.bandCount=NaN;const e=new Ma(os,ls);e.fromArray([0,1,1,1,1,0,0,0]),this.helper_.flushBufferData(e),this.coords=e,this.setTile(t.tile)}uploadTile(){const t=this.helper_,e=t.getGL(),i=this.tile;this.textures.length=0;let r;i instanceof Ia||i instanceof ss?r=i.getImage():r=i.getData();const s=Ci(r);if(s){const _=e.createTexture();this.textures.push(_),this.bandCount=4,bd(e,_,s,i.interpolate),this.setReady();return}r=ns(r);const o=i.getSize(),a=[o[0]+2*this.gutter_,o[1]+2*this.gutter_],l=r instanceof Float32Array,u=a[0]*a[1],h=l?Float32Array:Uint8Array,c=h.BYTES_PER_ELEMENT,d=r.byteLength/a[1];this.bandCount=Math.floor(d/c/a[0]);const f=Math.ceil(this.bandCount/4);if(f===1){const _=e.createTexture();this.textures.push(_),La(t,_,r,a,this.bandCount,i.interpolate),this.setReady();return}const g=new Array(f);for(let _=0;_<f;++_){const T=e.createTexture();this.textures.push(T);const E=_<f-1?4:(this.bandCount-1)%4+1;g[_]=new h(u*E)}let p=0,m=0;const y=a[0]*this.bandCount;for(let _=0;_<a[1];++_){for(let T=0;T<y;++T){const E=r[m+T],b=Math.floor(p/this.bandCount),v=T%this.bandCount,C=Math.floor(v/4),w=g[C],I=w.length/u,X=v%4;w[b*I+X]=E,++p}m+=d/c}for(let _=0;_<f;++_){const T=this.textures[_],E=g[_],b=E.length/u;La(t,T,E,a,b,i.interpolate)}this.setReady()}disposeInternal(){const t=this.helper_.getGL();this.helper_.deleteBuffer(this.coords);for(let e=0;e<this.textures.length;++e)t.deleteTexture(this.textures[e]);this.tile.removeEventListener(It.CHANGE,this.handleTileChange_)}getImagePixelData_(t,e,i){const r=this.gutter_,s=this.renderSize_[0],o=this.renderSize_[1];tn||vd(),tn.clearRect(0,0,1,1);const a=t.width,l=t.height,u=a-2*r,h=l-2*r,c=r+Math.floor(u*(e/s)),d=r+Math.floor(h*(i/o));let f;try{tn.drawImage(t,c,d,1,1,0,0,1,1),f=tn.getImageData(0,0,1,1).data}catch{return tn=null,null}return f}getArrayPixelData_(t,e,i,r){const s=this.gutter_,o=this.renderSize_[0],a=this.renderSize_[1],l=e[0],u=e[1],h=l+2*s,c=u+2*s,d=s+Math.floor(l*(i/o)),f=s+Math.floor(u*(r/a));if(t instanceof DataView){const p=t.byteLength/(h*c),m=p*(f*h+d),y=t.buffer.slice(m,m+p);return new DataView(y)}const g=this.bandCount*(f*h+d);return t.slice(g,g+this.bandCount)}getPixelData(t,e){if(!this.loaded)return null;if(this.tile instanceof va){const i=this.tile.getData(),r=ns(i);if(r){const s=this.tile.getSize();return this.getArrayPixelData_(r,s,t,e)}return this.getImagePixelData_(Ci(i),t,e)}return this.getImagePixelData_(this.tile.getImage(),t,e)}}class xd{constructor(t){this.highWaterMark=t!==void 0?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.pop()}clear(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return Bt(i!==void 0,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){const e=this.entries_[t];return Bt(e!==void 0,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e=0,i;for(i=this.newest_;i;i=i.older)t[e++]=i.key_;return t}getValues(){const t=new Array(this.count_);let e=0,i;for(i=this.newest_;i;i=i.older)t[e++]=i.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){var e;return(e=this.entries_[t])==null?void 0:e.value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){Bt(!(t in this.entries_),"Tried to set a value for a key that is used already");const i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}}class Rd{constructor(t,e,i,r){this.minX=t,this.maxX=e,this.minY=i,this.maxY=r}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}const wd=5;class Cd extends In{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.declutterExecutorGroup=null,this.staleKeys_=new Array,this.maxStaleKeys=wd}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return ot()}getData(t){return null}prepareFrame(t){return ot()}renderFrame(t,e){return ot()}forEachFeatureAtCoordinate(t,e,i,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;(e.getState()===Qe.LOADED||e.getState()===Qe.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=Qe.LOADED&&e!=Qe.ERROR&&t.addEventListener(It.CHANGE,this.boundHandleImageChange_),e==Qe.IDLE&&(t.load(),e=t.getState()),e==Qe.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}class cs extends Or{constructor(t,e,i,r){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=r}}const Si={LOST:"webglcontextlost",RESTORED:"webglcontextrestored"},Sd=`
46
46
  precision mediump float;
47
47
 
48
48
  attribute vec2 a_position;
@@ -56,7 +56,7 @@
56
56
  v_screenCoord = v_texCoord * u_screenSize;
57
57
  gl_Position = vec4(a_position, 0.0, 1.0);
58
58
  }
59
- `,Pp=`
59
+ `,Ad=`
60
60
  precision mediump float;
61
61
 
62
62
  uniform sampler2D u_image;
@@ -67,40 +67,40 @@
67
67
  void main() {
68
68
  gl_FragColor = texture2D(u_image, v_texCoord) * u_opacity;
69
69
  }
70
- `;class Jh{constructor(t){this.gl_=t.webGlContext;const e=this.gl_;this.scaleRatio_=t.scaleRatio||1,this.renderTargetTexture_=e.createTexture(),this.renderTargetTextureSize_=null,this.frameBuffer_=e.createFramebuffer(),this.depthBuffer_=e.createRenderbuffer();const n=e.createShader(e.VERTEX_SHADER);e.shaderSource(n,t.vertexShader||Op),e.compileShader(n);const r=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(r,t.fragmentShader||Pp),e.compileShader(r),this.renderTargetProgram_=e.createProgram(),e.attachShader(this.renderTargetProgram_,n),e.attachShader(this.renderTargetProgram_,r),e.linkProgram(this.renderTargetProgram_),this.renderTargetVerticesBuffer_=e.createBuffer();const s=[-1,-1,1,-1,-1,1,1,-1,1,1,-1,1];e.bindBuffer(e.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),e.bufferData(e.ARRAY_BUFFER,new Float32Array(s),e.STATIC_DRAW),this.renderTargetAttribLocation_=e.getAttribLocation(this.renderTargetProgram_,"a_position"),this.renderTargetUniformLocation_=e.getUniformLocation(this.renderTargetProgram_,"u_screenSize"),this.renderTargetOpacityLocation_=e.getUniformLocation(this.renderTargetProgram_,"u_opacity"),this.renderTargetTextureLocation_=e.getUniformLocation(this.renderTargetProgram_,"u_image"),this.uniforms_=[],t.uniforms&&Object.keys(t.uniforms).forEach(o=>{this.uniforms_.push({value:t.uniforms[o],location:e.getUniformLocation(this.renderTargetProgram_,o)})})}getGL(){return this.gl_}init(t){const e=this.getGL(),n=[e.drawingBufferWidth*this.scaleRatio_,e.drawingBufferHeight*this.scaleRatio_];if(e.bindFramebuffer(e.FRAMEBUFFER,this.getFrameBuffer()),e.bindRenderbuffer(e.RENDERBUFFER,this.getDepthBuffer()),e.viewport(0,0,n[0],n[1]),!this.renderTargetTextureSize_||this.renderTargetTextureSize_[0]!==n[0]||this.renderTargetTextureSize_[1]!==n[1]){this.renderTargetTextureSize_=n;const r=0,s=e.RGBA,o=0,a=e.RGBA,l=e.UNSIGNED_BYTE,h=null;e.bindTexture(e.TEXTURE_2D,this.renderTargetTexture_),e.texImage2D(e.TEXTURE_2D,r,s,n[0],n[1],o,a,l,h),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.renderTargetTexture_,0),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,n[0],n[1]),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,this.depthBuffer_)}}apply(t,e,n,r){const s=this.getGL(),o=t.size;if(s.bindFramebuffer(s.FRAMEBUFFER,e?e.getFrameBuffer():null),s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,this.renderTargetTexture_),!e){const l=kt(s.canvas);if(!t.renderTargets[l]){const h=s.getContextAttributes();h&&h.preserveDrawingBuffer&&(s.clearColor(0,0,0,0),s.clearDepth(1),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT)),t.renderTargets[l]=!0}}s.disable(s.DEPTH_TEST),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA),s.viewport(0,0,s.drawingBufferWidth,s.drawingBufferHeight),s.bindBuffer(s.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),s.useProgram(this.renderTargetProgram_),s.enableVertexAttribArray(this.renderTargetAttribLocation_),s.vertexAttribPointer(this.renderTargetAttribLocation_,2,s.FLOAT,!1,0,0),s.uniform2f(this.renderTargetUniformLocation_,o[0],o[1]),s.uniform1i(this.renderTargetTextureLocation_,0);const a=t.layerStatesArray[t.layerIndex].opacity;s.uniform1f(this.renderTargetOpacityLocation_,a),this.applyUniforms(t),n&&n(s,t),s.drawArrays(s.TRIANGLES,0,6),r&&r(s,t)}getFrameBuffer(){return this.frameBuffer_}getDepthBuffer(){return this.depthBuffer_}applyUniforms(t){const e=this.getGL();let n,r=1;this.uniforms_.forEach(function(s){if(n=typeof s.value=="function"?s.value(t):s.value,n instanceof HTMLCanvasElement||n instanceof ImageData)s.texture||(s.texture=e.createTexture()),e.activeTexture(e[`TEXTURE${r}`]),e.bindTexture(e.TEXTURE_2D,s.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),n instanceof ImageData?e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,n.width,n.height,0,e.UNSIGNED_BYTE,new Uint8Array(n.data)):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n),e.uniform1i(s.location,r++);else if(Array.isArray(n))switch(n.length){case 2:e.uniform2f(s.location,n[0],n[1]);return;case 3:e.uniform3f(s.location,n[0],n[1],n[2]);return;case 4:e.uniform4f(s.location,n[0],n[1],n[2],n[3]);return;default:return}else typeof n=="number"&&e.uniform1f(s.location,n)})}}function Qh(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function tc(i,t){return i[0]=t[0],i[1]=t[1],i[4]=t[2],i[5]=t[3],i[12]=t[4],i[13]=t[5],i}const Qe={PROJECTION_MATRIX:"u_projectionMatrix",SCREEN_TO_WORLD_MATRIX:"u_screenToWorldMatrix",TIME:"u_time",ZOOM:"u_zoom",RESOLUTION:"u_resolution",ROTATION:"u_rotation",VIEWPORT_SIZE_PX:"u_viewportSizePx",PIXEL_RATIO:"u_pixelRatio",HIT_DETECTION:"u_hitDetection"},Bn={UNSIGNED_BYTE:vp,UNSIGNED_SHORT:bp,UNSIGNED_INT:wp,FLOAT:Vh},Qr={};function ec(i){return"shared/"+i}let ic=0;function $p(){const i="unique/"+ic;return ic+=1,i}function Np(i){let t=Qr[i];if(!t){const e=document.createElement("canvas");e.width=1,e.height=1,e.style.position="absolute",e.style.left="0",t={users:0,context:Sp(e)},Qr[i]=t}return t.users+=1,t.context}function kp(i){const t=Qr[i];if(!t||(t.users-=1,t.users>0))return;const e=t.context,n=e.getExtension("WEBGL_lose_context");n&&n.loseContext();const r=e.canvas;r.width=1,r.height=1,delete Qr[i]}class Fp extends Yl{constructor(t){super(),t=t||{},this.boundHandleWebGLContextLost_=this.handleWebGLContextLost.bind(this),this.boundHandleWebGLContextRestored_=this.handleWebGLContextRestored.bind(this),this.canvasCacheKey_=t.canvasCacheKey?ec(t.canvasCacheKey):$p(),this.gl_=Np(this.canvasCacheKey_),this.bufferCache_={},this.extensionCache_={},this.currentProgram_=null,this.needsToBeRecreated_=!1;const e=this.gl_.canvas;e.addEventListener(Jr.LOST,this.boundHandleWebGLContextLost_),e.addEventListener(Jr.RESTORED,this.boundHandleWebGLContextRestored_),this.offsetRotateMatrix_=oe(),this.offsetScaleMatrix_=oe(),this.tmpMat4_=Qh(),this.uniformLocationsByProgram_={},this.attribLocationsByProgram_={},this.uniforms_=[],t.uniforms&&this.setUniforms(t.uniforms),this.postProcessPasses_=t.postProcesses?t.postProcesses.map(n=>new Jh({webGlContext:this.gl_,scaleRatio:n.scaleRatio,vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,uniforms:n.uniforms})):[new Jh({webGlContext:this.gl_})],this.shaderCompileErrors_=null,this.startTime_=Date.now()}setUniforms(t){this.uniforms_=[],this.addUniforms(t)}addUniforms(t){for(const e in t)this.uniforms_.push({name:e,value:t[e]})}canvasCacheKeyMatches(t){return this.canvasCacheKey_===ec(t)}getExtension(t){if(t in this.extensionCache_)return this.extensionCache_[t];const e=this.gl_.getExtension(t);return this.extensionCache_[t]=e,e}bindBuffer(t){const e=this.gl_,n=kt(t);let r=this.bufferCache_[n];if(!r){const s=e.createBuffer();r={buffer:t,webGlBuffer:s},this.bufferCache_[n]=r}e.bindBuffer(t.getType(),r.webGlBuffer)}flushBufferData(t){const e=this.gl_;this.bindBuffer(t),e.bufferData(t.getType(),t.getArray(),t.getUsage())}deleteBuffer(t){const e=this.gl_,n=kt(t),r=this.bufferCache_[n];r&&!e.isContextLost()&&e.deleteBuffer(r.webGlBuffer),delete this.bufferCache_[n]}disposeInternal(){const t=this.gl_.canvas;t.removeEventListener(Jr.LOST,this.boundHandleWebGLContextLost_),t.removeEventListener(Jr.RESTORED,this.boundHandleWebGLContextRestored_),kp(this.canvasCacheKey_),delete this.gl_}prepareDraw(t,e,n){const r=this.gl_,s=this.getCanvas(),o=t.size,a=t.pixelRatio;(s.width!==o[0]*a||s.height!==o[1]*a)&&(s.width=o[0]*a,s.height=o[1]*a,s.style.width=o[0]+"px",s.style.height=o[1]+"px");for(let l=this.postProcessPasses_.length-1;l>=0;l--)this.postProcessPasses_[l].init(t);r.bindTexture(r.TEXTURE_2D,null),r.clearColor(0,0,0,0),r.depthRange(0,1),r.clearDepth(1),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT),r.enable(r.BLEND),r.blendFunc(r.ONE,e?r.ZERO:r.ONE_MINUS_SRC_ALPHA),n?(r.enable(r.DEPTH_TEST),r.depthFunc(r.LEQUAL)):r.disable(r.DEPTH_TEST)}bindTexture(t,e,n){const r=this.gl_;r.activeTexture(r.TEXTURE0+e),r.bindTexture(r.TEXTURE_2D,t),r.uniform1i(this.getUniformLocation(n),e)}prepareDrawToRenderTarget(t,e,n,r){const s=this.gl_,o=e.getSize();s.bindFramebuffer(s.FRAMEBUFFER,e.getFramebuffer()),s.bindRenderbuffer(s.RENDERBUFFER,e.getDepthbuffer()),s.viewport(0,0,o[0],o[1]),s.bindTexture(s.TEXTURE_2D,e.getTexture()),s.clearColor(0,0,0,0),s.depthRange(0,1),s.clearDepth(1),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),s.enable(s.BLEND),s.blendFunc(s.ONE,n?s.ZERO:s.ONE_MINUS_SRC_ALPHA),r?(s.enable(s.DEPTH_TEST),s.depthFunc(s.LEQUAL)):s.disable(s.DEPTH_TEST)}drawElements(t,e){const n=this.gl_;this.getExtension("OES_element_index_uint");const r=n.UNSIGNED_INT,s=4,o=e-t,a=t*s;n.drawElements(n.TRIANGLES,o,r,a)}finalizeDraw(t,e,n){for(let r=0,s=this.postProcessPasses_.length;r<s;r++)r===s-1?this.postProcessPasses_[r].apply(t,null,e,n):this.postProcessPasses_[r].apply(t,this.postProcessPasses_[r+1])}getCanvas(){return this.gl_.canvas}getGL(){return this.gl_}applyFrameState(t){const e=t.size,n=t.viewState.rotation,r=t.pixelRatio;this.setUniformFloatValue(Qe.TIME,(Date.now()-this.startTime_)*.001),this.setUniformFloatValue(Qe.ZOOM,t.viewState.zoom),this.setUniformFloatValue(Qe.RESOLUTION,t.viewState.resolution),this.setUniformFloatValue(Qe.PIXEL_RATIO,r),this.setUniformFloatVec2(Qe.VIEWPORT_SIZE_PX,[e[0],e[1]]),this.setUniformFloatValue(Qe.ROTATION,n)}applyHitDetectionUniform(t){const e=this.getUniformLocation(Qe.HIT_DETECTION);this.getGL().uniform1i(e,t?1:0),t&&this.setUniformFloatValue(Qe.PIXEL_RATIO,.5)}applyUniforms(t){const e=this.gl_;let n,r=0;this.uniforms_.forEach(s=>{if(n=typeof s.value=="function"?s.value(t):s.value,n instanceof HTMLCanvasElement||n instanceof HTMLImageElement||n instanceof ImageData||n instanceof WebGLTexture){n instanceof WebGLTexture&&!s.texture?(s.prevValue=void 0,s.texture=n):s.texture||(s.prevValue=void 0,s.texture=e.createTexture()),this.bindTexture(s.texture,r,s.name),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);const o=!(n instanceof HTMLImageElement)||n.complete;!(n instanceof WebGLTexture)&&o&&s.prevValue!==n&&(s.prevValue=n,e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n)),r++}else if(Array.isArray(n)&&n.length===6)this.setUniformMatrixValue(s.name,tc(this.tmpMat4_,n));else if(Array.isArray(n)&&n.length<=4)switch(n.length){case 2:e.uniform2f(this.getUniformLocation(s.name),n[0],n[1]);return;case 3:e.uniform3f(this.getUniformLocation(s.name),n[0],n[1],n[2]);return;case 4:e.uniform4f(this.getUniformLocation(s.name),n[0],n[1],n[2],n[3]);return;default:return}else typeof n=="number"&&e.uniform1f(this.getUniformLocation(s.name),n)})}useProgram(t,e){this.gl_.useProgram(t),this.currentProgram_=t,this.applyFrameState(e),this.applyUniforms(e)}compileShader(t,e){const n=this.gl_,r=n.createShader(e);return n.shaderSource(r,t),n.compileShader(r),r}getProgram(t,e){const n=this.gl_,r=this.compileShader(t,n.FRAGMENT_SHADER),s=this.compileShader(e,n.VERTEX_SHADER),o=n.createProgram();if(n.attachShader(o,r),n.attachShader(o,s),n.linkProgram(o),!n.getShaderParameter(r,n.COMPILE_STATUS)){const a=`Fragment shader compilation failed: ${n.getShaderInfoLog(r)}`;throw new Error(a)}if(n.deleteShader(r),!n.getShaderParameter(s,n.COMPILE_STATUS)){const a=`Vertex shader compilation failed: ${n.getShaderInfoLog(s)}`;throw new Error(a)}if(n.deleteShader(s),!n.getProgramParameter(o,n.LINK_STATUS)){const a=`GL program linking failed: ${n.getProgramInfoLog(o)}`;throw new Error(a)}return o}getUniformLocation(t){const e=kt(this.currentProgram_);return this.uniformLocationsByProgram_[e]===void 0&&(this.uniformLocationsByProgram_[e]={}),this.uniformLocationsByProgram_[e][t]===void 0&&(this.uniformLocationsByProgram_[e][t]=this.gl_.getUniformLocation(this.currentProgram_,t)),this.uniformLocationsByProgram_[e][t]}getAttributeLocation(t){const e=kt(this.currentProgram_);return this.attribLocationsByProgram_[e]===void 0&&(this.attribLocationsByProgram_[e]={}),this.attribLocationsByProgram_[e][t]===void 0&&(this.attribLocationsByProgram_[e][t]=this.gl_.getAttribLocation(this.currentProgram_,t)),this.attribLocationsByProgram_[e][t]}makeProjectionTransform(t,e){const n=t.size,r=t.viewState.rotation,s=t.viewState.resolution,o=t.viewState.center;return Ke(e,0,0,2/(s*n[0]),2/(s*n[1]),-r,-o[0],-o[1]),e}setUniformFloatValue(t,e){this.gl_.uniform1f(this.getUniformLocation(t),e)}setUniformFloatVec2(t,e){this.gl_.uniform2fv(this.getUniformLocation(t),e)}setUniformFloatVec4(t,e){this.gl_.uniform4fv(this.getUniformLocation(t),e)}setUniformMatrixValue(t,e){this.gl_.uniformMatrix4fv(this.getUniformLocation(t),!1,e)}enableAttributeArray_(t,e,n,r,s){const o=this.getAttributeLocation(t);o<0||(this.gl_.enableVertexAttribArray(o),this.gl_.vertexAttribPointer(o,e,n,!1,r,s))}enableAttributes(t){const e=Bp(t);let n=0;for(let r=0;r<t.length;r++){const s=t[r];this.enableAttributeArray_(s.name,s.size,s.type||Vh,e,n),n+=s.size*nc(s.type)}}handleWebGLContextLost(t){Lr(this.bufferCache_),this.currentProgram_=null,t.preventDefault()}handleWebGLContextRestored(){this.needsToBeRecreated_=!0}needsToBeRecreated(){return this.needsToBeRecreated_}createTexture(t,e,n){const r=this.gl_;n=n||r.createTexture();const s=0,o=r.RGBA,a=0,l=r.RGBA,h=r.UNSIGNED_BYTE;return r.bindTexture(r.TEXTURE_2D,n),e?r.texImage2D(r.TEXTURE_2D,s,o,l,h,e):r.texImage2D(r.TEXTURE_2D,s,o,t[0],t[1],a,l,h,null),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),n}}function Bp(i){let t=0;for(let e=0;e<i.length;e++){const n=i[e];t+=n.size*nc(n.type)}return t}function nc(i){switch(i){case Bn.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case Bn.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case Bn.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT;case Bn.FLOAT:default:return Float32Array.BYTES_PER_ELEMENT}}class ra extends Kh{constructor(t,e){super(t),e=e||{},this.inversePixelTransform_=oe(),this.pixelContext_=null,this.postProcesses_=e.postProcesses,this.uniforms_=e.uniforms,this.helper,t.addChangeListener(rt.MAP,this.removeHelper.bind(this)),this.dispatchPreComposeEvent=this.dispatchPreComposeEvent.bind(this),this.dispatchPostComposeEvent=this.dispatchPostComposeEvent.bind(this)}dispatchPreComposeEvent(t,e){const n=this.getLayer();if(n.hasListener(Kt.PRECOMPOSE)){const r=new Kr(Kt.PRECOMPOSE,void 0,e,t);n.dispatchEvent(r)}}dispatchPostComposeEvent(t,e){const n=this.getLayer();if(n.hasListener(Kt.POSTCOMPOSE)){const r=new Kr(Kt.POSTCOMPOSE,void 0,e,t);n.dispatchEvent(r)}}reset(t){this.uniforms_=t.uniforms,this.helper&&this.helper.setUniforms(this.uniforms_)}removeHelper(){this.helper&&(this.helper.dispose(),delete this.helper)}prepareFrame(t){if(this.getLayer().getRenderSource()){let e=!0,n=-1,r;for(let o=0,a=t.layerStatesArray.length;o<a;o++){const l=t.layerStatesArray[o].layer,h=l.getRenderer();if(!(h instanceof ra)){e=!0;continue}const c=l.getClassName();if((e||c!==r)&&(n+=1,e=!1),r=c,h===this)break}const s="map/"+t.mapId+"/group/"+n;(!this.helper||!this.helper.canvasCacheKeyMatches(s)||this.helper.needsToBeRecreated())&&(this.removeHelper(),this.helper=new Fp({postProcesses:this.postProcesses_,uniforms:this.uniforms_,canvasCacheKey:s}),r&&(this.helper.getCanvas().className=r),this.afterHelperCreated())}return this.prepareFrameInternal(t)}afterHelperCreated(){}prepareFrameInternal(t){return!0}disposeInternal(){this.removeHelper(),super.disposeInternal()}dispatchRenderEvent_(t,e,n){const r=this.getLayer();if(r.hasListener(t)){Ke(this.inversePixelTransform_,0,0,n.pixelRatio,-n.pixelRatio,0,0,-n.size[1]);const s=new Kr(t,this.inversePixelTransform_,n,e);r.dispatchEvent(s)}}preRender(t,e){this.dispatchRenderEvent_(Kt.PRERENDER,t,e)}postRender(t,e){this.dispatchRenderEvent_(Kt.POSTRENDER,t,e)}}function rc(i,t,e,n){return n!==void 0?(n[0]=i,n[1]=t,n[2]=e,n):[i,t,e]}function Up(i,t,e){return i+"/"+t+"/"+e}function qi(i){return Up(i[0],i[1],i[2])}const Xp={TILE_TRANSFORM:"u_tileTransform",TRANSITION_ALPHA:"u_transitionAlpha",DEPTH:"u_depth",RENDER_EXTENT:"u_renderExtent",PATTERN_ORIGIN:"u_patternOrigin",RESOLUTION:"u_resolution",ZOOM:"u_zoom",GLOBAL_ALPHA:"u_globalAlpha",PROJECTION_MATRIX:"u_projectionMatrix",SCREEN_TO_WORLD_MATRIX:"u_screenToWorldMatrix"},Gp={};function sc(i){return 1/(i+2)}function Wp(){return{tileIds:new Set,representationsByZ:{}}}function oc(i,t){return i.tileIds.has(kt(t))}function ac(i,t,e){const n=i.representationsByZ;e in n||(n[e]=new Set),n[e].add(t),i.tileIds.add(kt(t.tile))}function sa(i,t){const e=i.layerStatesArray[i.layerIndex];e.extent&&(t=xe(t,Ei(e.extent,i.viewState.projection)));const n=e.layer.getRenderSource();if(!n.getWrapX()){const r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(t=xe(t,r))}return t}function oa(i,t){return`${i.getKey()},${qi(t)}`}class Hp extends ra{constructor(t,e){super(t,{uniforms:e.uniforms,postProcesses:e.postProcesses}),this.renderComplete=!1,this.tileTransform_=oe(),this.tempMat4=Qh(),this.tempTileRange_=new Dp(0,0,0,0),this.tempTileCoord_=rc(0,0,0),this.tempSize_=[0,0];const n=e.cacheSize!==void 0?e.cacheSize:512;this.tileRepresentationCache=new Mp(n),this.frameState=null,this.projection_=void 0}reset(t){super.reset({uniforms:t.uniforms})}prepareFrameInternal(t){this.projection_?t.viewState.projection!==this.projection_&&(this.clearCache(),this.projection_=t.viewState.projection):this.projection_=t.viewState.projection;const n=this.getLayer().getRenderSource();return!n||Xr(sa(t,t.extent))?!1:n.getState()==="ready"}createTileRepresentation(t){return nt()}enqueueTiles(t,e,n,r,s){const o=t.viewState,a=this.getLayer(),l=a.getRenderSource(),h=l.getTileGridForProjection(o.projection),c=l.getGutterForProjection(o.projection),u=kt(l);u in t.wantedTiles||(t.wantedTiles[u]={});const d=t.wantedTiles[u],f=this.tileRepresentationCache,g=a.getMapInternal(),p=Math.max(n-s,h.getMinZoom(),h.getZForResolution(Math.min(a.getMaxResolution(),g?g.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):h.getResolution(0)),l.zDirection));for(let _=n;_>=p;--_){const y=h.getTileRangeForExtentAndZ(e,_,this.tempTileRange_),m=h.getResolution(_);for(let x=y.minX;x<=y.maxX;++x)for(let E=y.minY;E<=y.maxY;++E){const T=rc(_,x,E,this.tempTileCoord_),b=oa(l,T);let w,S;if(f.containsKey(b)&&(w=f.get(b),S=w.tile),(!w||w.tile.key!==l.getKey())&&(S=l.getTile(_,x,E,t.pixelRatio,o.projection),!S)||oc(r,S))continue;w?w.setTile(S):(w=this.createTileRepresentation({tile:S,grid:h,helper:this.helper,gutter:c}),f.set(b,w)),ac(r,w,_);const R=S.getKey();d[R]=!0,S.getState()===$.IDLE&&(t.tileQueue.isKeyQueued(R)||t.tileQueue.enqueue([S,u,h.getTileCoordCenter(T),m]))}}}beforeTilesRender(t,e){this.helper.prepareDraw(this.frameState,!e,!0)}beforeTilesMaskRender(t){return!1}renderTile(t,e,n,r,s,o,a,l,h,c,u){}renderTileMask(t,e,n,r){}drawTile_(t,e,n,r,s,o,a){if(!e.ready)return;const h=e.tile.tileCoord,c=qi(h),u=c in o?o[c]:1,d=a.getResolution(n),f=Te(a.getTileSize(n),this.tempSize_),g=a.getOrigin(n),p=a.getTileCoordExtent(h),_=u<1?-1:sc(n);u<1&&(t.animate=!0);const y=t.viewState,m=y.center[0],x=y.center[1],E=f[0]+2*r,T=f[1]+2*r,b=E/T,w=(m-g[0])/(f[0]*d),S=(g[1]-x)/(f[1]*d),R=y.resolution/d,P=h[1],M=h[2];Mg(this.tileTransform_),_h(this.tileTransform_,2/(t.size[0]*R/E),-2/(t.size[1]*R/E)),Lg(this.tileTransform_,y.rotation),_h(this.tileTransform_,1,1/b),Og(this.tileTransform_,(f[0]*(P-w)-r)/E,(f[1]*(M-S)-r)/T),this.renderTile(e,this.tileTransform_,t,s,d,f,g,p,_,r,u)}renderFrame(t){this.frameState=t,this.renderComplete=!0;const e=this.helper.getGL();this.preRender(e,t);const n=t.viewState,r=this.getLayer(),s=r.getRenderSource(),o=s.getTileGridForProjection(n.projection),a=s.getGutterForProjection(n.projection),l=sa(t,t.extent),h=o.getZForResolution(n.resolution,s.zDirection),c=Wp(),u=r.getPreload();if(t.nextExtent){const b=o.getZForResolution(n.nextResolution,s.zDirection),w=sa(t,t.nextExtent);this.enqueueTiles(t,w,b,c,u)}this.enqueueTiles(t,l,h,c,0),u>0&&setTimeout(()=>{this.enqueueTiles(t,l,h-1,c,u-1)},0);const d={},f=kt(this),g=t.time;let p=!1;const _=c.representationsByZ;if(h in _)for(const b of _[h]){const w=b.tile;if((w instanceof Qo||w instanceof Hh)&&w.getState()===$.EMPTY)continue;const S=w.tileCoord;if(b.ready){const M=w.getAlpha(f,g);if(M===1){w.endTransition(f);continue}p=!0;const D=qi(S);d[D]=M}if(this.renderComplete=!1,this.findAltTiles_(o,S,h+1,c))continue;const P=o.getMinZoom();for(let M=h-1;M>=P&&!this.findAltTiles_(o,S,M,c);--M);}const y=Object.keys(_).map(Number).sort(Of);if(this.beforeTilesMaskRender(t))for(let b=0,w=y.length;b<w;++b){const S=y[b];for(const R of _[S]){const P=R.tile.tileCoord;if(qi(P)in d)continue;const D=o.getTileCoordExtent(P);this.renderTileMask(R,S,D,sc(S))}}this.beforeTilesRender(t,p);for(let b=0,w=y.length;b<w;++b){const S=y[b];for(const R of _[S]){const P=R.tile.tileCoord;qi(P)in d||this.drawTile_(t,R,S,a,l,d,o)}}if(h in _)for(const b of _[h]){const w=b.tile.tileCoord;qi(w)in d&&this.drawTile_(t,b,h,a,l,d,o)}this.helper.finalizeDraw(t,this.dispatchPreComposeEvent,this.dispatchPostComposeEvent);const x=this.helper.getCanvas(),E=this.tileRepresentationCache;for(;E.canExpireCache();)E.pop().dispose();const T=function(b,w){s.expireCache(w.viewState.projection,Gp)};return t.postRenderFunctions.push(T),this.postRender(e,t),x}findAltTiles_(t,e,n,r){const s=t.getTileRangeForTileCoordAndZ(e,n,this.tempTileRange_);if(!s)return!1;let o=!0;const a=this.tileRepresentationCache,l=this.getLayer().getRenderSource();for(let h=s.minX;h<=s.maxX;++h)for(let c=s.minY;c<=s.maxY;++c){const u=oa(l,[n,h,c]);let d=!1;if(a.containsKey(u)){const f=a.get(u);f.ready&&!oc(r,f.tile)&&(ac(r,f,n),d=!0)}d||(o=!1)}return o}clearCache(){const t=this.tileRepresentationCache;t.forEach(e=>e.dispose()),t.clear()}removeHelper(){this.helper&&this.clearCache(),super.removeHelper()}disposeInternal(){super.disposeInternal(),delete this.frameState}}const W={...Xp,TILE_TEXTURE_ARRAY:"u_tileTextures",TEXTURE_PIXEL_WIDTH:"u_texturePixelWidth",TEXTURE_PIXEL_HEIGHT:"u_texturePixelHeight",TEXTURE_RESOLUTION:"u_textureResolution",TEXTURE_ORIGIN_X:"u_textureOriginX",TEXTURE_ORIGIN_Y:"u_textureOriginY"},ts={TEXTURE_COORD:"a_textureCoord"},zp=[{name:ts.TEXTURE_COORD,size:2,type:Bn.FLOAT}];class Vp extends Hp{constructor(t,e){super(t,e),this.program_,this.vertexShader_=e.vertexShader,this.fragmentShader_=e.fragmentShader,this.indices_=new jh(ea,ia),this.indices_.fromArray([0,1,3,1,2,3]),this.paletteTextures_=e.paletteTextures||[]}reset(t){if(super.reset(t),this.helper){const e=this.helper.getGL();for(const n of this.paletteTextures_)n.delete(e)}this.vertexShader_=t.vertexShader,this.fragmentShader_=t.fragmentShader,this.paletteTextures_=t.paletteTextures||[],this.helper&&(this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_))}afterHelperCreated(){this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_),this.helper.flushBufferData(this.indices_)}removeHelper(){if(this.helper){const t=this.helper.getGL();for(const e of this.paletteTextures_)e.delete(t)}super.removeHelper()}createTileRepresentation(t){return new Ap(t)}beforeTilesRender(t,e){super.beforeTilesRender(t,e),this.helper.useProgram(this.program_,t)}renderTile(t,e,n,r,s,o,a,l,h,c,u){const d=this.helper.getGL();this.helper.bindBuffer(t.coords),this.helper.bindBuffer(this.indices_),this.helper.enableAttributes(zp);let f=0;for(;f<t.textures.length;){const b=`${W.TILE_TEXTURE_ARRAY}[${f}]`;this.helper.bindTexture(t.textures[f],f,b),++f}for(let b=0;b<this.paletteTextures_.length;++b){const w=this.paletteTextures_[b],S=w.getTexture(d);this.helper.bindTexture(S,f,w.name),++f}const g=n.viewState,p=o[0]+2*c,_=o[1]+2*c,m=t.tile.tileCoord,x=m[1],E=m[2];this.helper.setUniformMatrixValue(W.TILE_TRANSFORM,tc(this.tempMat4,e)),this.helper.setUniformFloatValue(W.TRANSITION_ALPHA,u),this.helper.setUniformFloatValue(W.DEPTH,h);let T=r;c>0&&(T=l,xe(T,r,T)),this.helper.setUniformFloatVec4(W.RENDER_EXTENT,T),this.helper.setUniformFloatValue(W.RESOLUTION,g.resolution),this.helper.setUniformFloatValue(W.ZOOM,g.zoom),this.helper.setUniformFloatValue(W.TEXTURE_PIXEL_WIDTH,p),this.helper.setUniformFloatValue(W.TEXTURE_PIXEL_HEIGHT,_),this.helper.setUniformFloatValue(W.TEXTURE_RESOLUTION,s),this.helper.setUniformFloatValue(W.TEXTURE_ORIGIN_X,a[0]+x*o[0]*s-c*s),this.helper.setUniformFloatValue(W.TEXTURE_ORIGIN_Y,a[1]-E*o[1]*s+c*s),this.helper.drawElements(0,this.indices_.getSize())}getData(t){if(!this.helper.getGL())return null;const n=this.frameState;if(!n)return null;const r=this.getLayer(),s=Ht(n.pixelToCoordinateTransform,t.slice()),o=n.viewState,a=r.getExtent();if(a&&!Hi(Ei(a,o.projection),s))return null;const l=r.getSources(Ao([s]),o.resolution);let h,c,u;for(h=l.length-1;h>=0;--h)if(c=l[h],c.getState()==="ready"){if(u=c.getTileGridForProjection(o.projection),c.getWrapX())break;const f=u.getExtent();if(!f||Hi(f,s))break}if(h<0)return null;const d=this.tileRepresentationCache;for(let f=u.getZForResolution(o.resolution);f>=u.getMinZoom();--f){const g=u.getTileCoordForCoordAndZ(s,f),p=oa(c,g);if(!d.containsKey(p))continue;const _=d.get(p),y=_.tile;if((y instanceof Qo||y instanceof Hh)&&y.getState()===$.EMPTY)return null;if(!_.loaded)continue;const m=u.getOrigin(f),x=Te(u.getTileSize(f)),E=u.getResolution(f),T=(s[0]-m[0])/E-g[1]*x[0],b=(m[1]-s[1])/E-g[2]*x[1];return _.getPixelData(T,b)}return null}disposeInternal(){const t=this.helper;if(t){const e=t.getGL();for(const n of this.paletteTextures_)n.delete(e);this.paletteTextures_.length=0,e.deleteProgram(this.program_),delete this.program_,t.deleteBuffer(this.indices_)}super.disposeInternal(),delete this.indices_}}const Un={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]};var Ot={name:"xyz",min:[0,0,0],channel:["X","Y","Z"],alias:["XYZ","ciexyz","cie1931"]};Ot.whitepoint={2:{A:[109.85,100,35.585],C:[98.074,100,118.232],D50:[96.422,100,82.521],D55:[95.682,100,92.149],D65:[95.045592705167,100,108.9057750759878],D75:[94.972,100,122.638],F2:[99.187,100,67.395],F7:[95.044,100,108.755],F11:[100.966,100,64.37],E:[100,100,100]},10:{A:[111.144,100,35.2],C:[97.285,100,116.145],D50:[96.72,100,81.427],D55:[95.799,100,90.926],D65:[94.811,100,107.304],D75:[94.416,100,120.641],F2:[103.28,100,69.026],F7:[95.792,100,107.687],F11:[103.866,100,65.627],E:[100,100,100]}},Ot.max=Ot.whitepoint[2].D65,Ot.rgb=function(i,t){t=t||Ot.whitepoint[2].E;var e=i[0]/t[0],n=i[1]/t[1],r=i[2]/t[2],s,o,a;return s=e*3.240969941904521+n*-1.537383177570093+r*-.498610760293,o=e*-.96924363628087+n*1.87596750150772+r*.041555057407175,a=e*.055630079696993+n*-.20397695888897+r*1.056971514242878,s=s>.0031308?1.055*Math.pow(s,1/2.4)-.055:s=s*12.92,o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:o=o*12.92,a=a>.0031308?1.055*Math.pow(a,1/2.4)-.055:a=a*12.92,s=Math.min(Math.max(0,s),1),o=Math.min(Math.max(0,o),1),a=Math.min(Math.max(0,a),1),[s*255,o*255,a*255]},Un.xyz=function(i,t){var e=i[0]/255,n=i[1]/255,r=i[2]/255;e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92,r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92;var s=e*.41239079926595+n*.35758433938387+r*.18048078840183,o=e*.21263900587151+n*.71516867876775+r*.072192315360733,a=e*.019330818715591+n*.11919477979462+r*.95053215224966;return t=t||Ot.whitepoint[2].E,[s*t[0],o*t[1],a*t[2]]};const aa={name:"luv",min:[0,-134,-140],max:[100,224,122],channel:["lightness","u","v"],alias:["LUV","cieluv","cie1976"],xyz:function(i,t,e){var n,r,s,o,a,l,h,c,u,d,f,g,p;if(s=i[0],o=i[1],a=i[2],s===0)return[0,0,0];var _=.0011070564598794539;return t=t||"D65",e=e||2,u=Ot.whitepoint[e][t][0],d=Ot.whitepoint[e][t][1],f=Ot.whitepoint[e][t][2],g=4*u/(u+15*d+3*f),p=9*d/(u+15*d+3*f),n=o/(13*s)+g||0,r=a/(13*s)+p||0,h=s>8?d*Math.pow((s+16)/116,3):d*s*_,l=h*9*n/(4*r)||0,c=h*(12-3*n-20*r)/(4*r)||0,[l,h,c]}};Ot.luv=function(i,t,e){var n,r,s,o,a,l,h,c,u,d,f,g,p,_=.008856451679035631,y=903.2962962962961;t=t||"D65",e=e||2,u=Ot.whitepoint[e][t][0],d=Ot.whitepoint[e][t][1],f=Ot.whitepoint[e][t][2],g=4*u/(u+15*d+3*f),p=9*d/(u+15*d+3*f),l=i[0],h=i[1],c=i[2],n=4*l/(l+15*h+3*c)||0,r=9*h/(l+15*h+3*c)||0;var m=h/d;return s=m<=_?y*m:116*Math.pow(m,1/3)-16,o=13*s*(n-g),a=13*s*(r-p),[s,o,a]};var lc={name:"lchuv",channel:["lightness","chroma","hue"],alias:["LCHuv","cielchuv"],min:[0,0,0],max:[100,100,360],luv:function(i){var t=i[0],e=i[1],n=i[2],r,s,o;return o=n/360*2*Math.PI,r=e*Math.cos(o),s=e*Math.sin(o),[t,r,s]},xyz:function(i){return aa.xyz(lc.luv(i))}};aa.lchuv=function(i){var t=i[0],e=i[1],n=i[2],r=Math.sqrt(e*e+n*n),s=Math.atan2(n,e),o=s*360/2/Math.PI;return o<0&&(o+=360),[t,r,o]},Ot.lchuv=function(i){return aa.lchuv(Ot.luv(i))};var es=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function hc(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Yp={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]};const cc=hc(Yp);var uc={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function jp(i){var c,u;var t,e=[],n=1,r;if(typeof i=="number")return{space:"rgb",values:[i>>>16,(i&65280)>>>8,i&255],alpha:1};if(typeof i=="number")return{space:"rgb",values:[i>>>16,(i&65280)>>>8,i&255],alpha:1};if(i=String(i).toLowerCase(),cc[i])e=cc[i].slice(),r="rgb";else if(i==="transparent")n=0,r="rgb",e=[0,0,0];else if(i[0]==="#"){var s=i.slice(1),o=s.length,a=o<=4;n=1,a?(e=[parseInt(s[0]+s[0],16),parseInt(s[1]+s[1],16),parseInt(s[2]+s[2],16)],o===4&&(n=parseInt(s[3]+s[3],16)/255)):(e=[parseInt(s[0]+s[1],16),parseInt(s[2]+s[3],16),parseInt(s[4]+s[5],16)],o===8&&(n=parseInt(s[6]+s[7],16)/255)),e[0]||(e[0]=0),e[1]||(e[1]=0),e[2]||(e[2]=0),r="rgb"}else if(t=/^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\s*\(([^\)]*)\)/.exec(i)){var l=t[1];r=l.replace(/a$/,"");var h=r==="cmyk"?4:r==="gray"?1:3;e=t[2].trim().split(/\s*[,\/]\s*|\s+/),r==="color"&&(r=e.shift()),e=e.map(function(d,f){if(d[d.length-1]==="%")return d=parseFloat(d)/100,f===3?d:r==="rgb"?d*255:r[0]==="h"||r[0]==="l"&&!f?d*100:r==="lab"?d*125:r==="lch"?f<2?d*150:d*360:r[0]==="o"&&!f?d:r==="oklab"?d*.4:r==="oklch"?f<2?d*.4:d*360:d;if(r[f]==="h"||f===2&&r[r.length-1]==="h"){if(uc[d]!==void 0)return uc[d];if(d.endsWith("deg"))return parseFloat(d);if(d.endsWith("turn"))return parseFloat(d)*360;if(d.endsWith("grad"))return parseFloat(d)*360/400;if(d.endsWith("rad"))return parseFloat(d)*180/Math.PI}return d==="none"?0:parseFloat(d)}),n=e.length>h?e.pop():1}else/[0-9](?:\s|\/|,)/.test(i)&&(e=i.match(/([0-9]+)/g).map(function(d){return parseFloat(d)}),r=((u=(c=i.match(/([a-z])/ig))==null?void 0:c.join(""))==null?void 0:u.toLowerCase())||"rgb");return{space:r,values:e,alpha:n}}const la={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(i){var t=i[0]/360,e=i[1]/100,n=i[2]/100,r,s,o,a,l,h=0;if(e===0)return l=n*255,[l,l,l];for(s=n<.5?n*(1+e):n+e-n*e,r=2*n-s,a=[0,0,0];h<3;)o=t+1/3*-(h-1),o<0?o++:o>1&&o--,l=6*o<1?r+(s-r)*6*o:2*o<1?s:3*o<2?r+(s-r)*(2/3-o)*6:r,a[h++]=l*255;return a}};Un.hsl=function(i){var t=i[0]/255,e=i[1]/255,n=i[2]/255,r=Math.min(t,e,n),s=Math.max(t,e,n),o=s-r,a,l,h;return s===r?a=0:t===s?a=(e-n)/o:e===s?a=2+(n-t)/o:n===s&&(a=4+(t-e)/o),a=Math.min(a*60,360),a<0&&(a+=360),h=(r+s)/2,s===r?l=0:h<=.5?l=o/(s+r):l=o/(2-s-r),[a,l*100,h*100]};function Zp(i){Array.isArray(i)&&i.raw&&(i=String.raw(...arguments)),i instanceof Number&&(i=+i);var t,e=jp(i);if(!e.space)return[];const n=e.space[0]==="h"?la.min:Un.min,r=e.space[0]==="h"?la.max:Un.max;return t=Array(3),t[0]=Math.min(Math.max(e.values[0],n[0]),r[0]),t[1]=Math.min(Math.max(e.values[1],n[1]),r[1]),t[2]=Math.min(Math.max(e.values[2],n[2]),r[2]),e.space[0]==="h"&&(t=la.rgb(t)),t.push(Math.min(Math.max(e.alpha,0),1)),t}function qp(i){return typeof i=="string"?i:ua(i)}const Kp=1024,Xn={};let ha=0;function Jp(i){if(i.length===4)return i;const t=i.slice();return t[3]=1,t}function dc(i){const t=Ot.lchuv(Un.xyz(i));return t[3]=i[3],t}function Qp(i){const t=Ot.rgb(lc.xyz(i));return t[3]=i[3],t}function ca(i){if(Xn.hasOwnProperty(i))return Xn[i];if(ha>=Kp){let e=0;for(const n in Xn)e++&3||(delete Xn[n],--ha)}const t=Zp(i);if(t.length!==4)throw new Error('failed to parse "'+i+'" as color');for(const e of t)if(isNaN(e))throw new Error('failed to parse "'+i+'" as color');return fc(t),Xn[i]=t,++ha,t}function bi(i){return Array.isArray(i)?i:ca(i)}function fc(i){return i[0]=vt(i[0]+.5|0,0,255),i[1]=vt(i[1]+.5|0,0,255),i[2]=vt(i[2]+.5|0,0,255),i[3]=vt(i[3],0,1),i}function ua(i){let t=i[0];t!=(t|0)&&(t=t+.5|0);let e=i[1];e!=(e|0)&&(e=e+.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("+t+","+e+","+n+","+r+")"}let wi=0;const Ft=1<<wi++,H=1<<wi++,Bt=1<<wi++,te=1<<wi++,ti=1<<wi++,Ki=1<<wi++,is=Math.pow(2,wi)-1,da={[Ft]:"boolean",[H]:"number",[Bt]:"string",[te]:"color",[ti]:"number[]",[Ki]:"size"},t_=Object.keys(da).map(Number).sort(Fi);function e_(i){return i in da}function Ji(i){const t=[];for(const e of t_)Gn(i,e)&&t.push(da[e]);return t.length===0?"untyped":t.length<3?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t[t.length-1]}function Gn(i,t){return(i&t)===t}function ei(i,t){return i===t}class St{constructor(t,e){if(!e_(t))throw new Error(`literal expressions must have a specific type, got ${Ji(t)}`);this.type=t,this.value=e}}class gc{constructor(t,e,...n){this.type=t,this.operator=e,this.args=n}}function fa(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1}}function It(i,t,e){switch(typeof i){case"boolean":{if(ei(t,Bt))return new St(Bt,i?"true":"false");if(!Gn(t,Ft))throw new Error(`got a boolean, but expected ${Ji(t)}`);return new St(Ft,i)}case"number":{if(ei(t,Ki))return new St(Ki,Te(i));if(ei(t,Ft))return new St(Ft,!!i);if(ei(t,Bt))return new St(Bt,i.toString());if(!Gn(t,H))throw new Error(`got a number, but expected ${Ji(t)}`);return new St(H,i)}case"string":{if(ei(t,te))return new St(te,ca(i));if(ei(t,Ft))return new St(Ft,!!i);if(!Gn(t,Bt))throw new Error(`got a string, but expected ${Ji(t)}`);return new St(Bt,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 f_(i,t,e);for(const n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(ei(t,Ki)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new St(Ki,i)}if(ei(t,te)){if(i.length===3)return new St(te,[...i,1]);if(i.length===4)return new St(te,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!Gn(t,ti))throw new Error(`got an array of numbers, but expected ${Ji(t)}`);return new St(ti,i)}const v={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",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"},i_={[v.Get]:X(z(1,1/0),n_),[v.Var]:X(z(1,1),r_),[v.Id]:X(s_,Wn),[v.Concat]:X(z(2,1/0),st(Bt)),[v.GeometryType]:X(o_,Wn),[v.Resolution]:X(Wn),[v.Zoom]:X(Wn),[v.Time]:X(Wn),[v.Any]:X(z(2,1/0),st(Ft)),[v.All]:X(z(2,1/0),st(Ft)),[v.Not]:X(z(1,1),st(Ft)),[v.Equal]:X(z(2,2),st(is)),[v.NotEqual]:X(z(2,2),st(is)),[v.GreaterThan]:X(z(2,2),st(H)),[v.GreaterThanOrEqualTo]:X(z(2,2),st(H)),[v.LessThan]:X(z(2,2),st(H)),[v.LessThanOrEqualTo]:X(z(2,2),st(H)),[v.Multiply]:X(z(2,1/0),pc),[v.Coalesce]:X(z(2,1/0),pc),[v.Divide]:X(z(2,2),st(H)),[v.Add]:X(z(2,1/0),st(H)),[v.Subtract]:X(z(2,2),st(H)),[v.Clamp]:X(z(3,3),st(H)),[v.Mod]:X(z(2,2),st(H)),[v.Pow]:X(z(2,2),st(H)),[v.Abs]:X(z(1,1),st(H)),[v.Floor]:X(z(1,1),st(H)),[v.Ceil]:X(z(1,1),st(H)),[v.Round]:X(z(1,1),st(H)),[v.Sin]:X(z(1,1),st(H)),[v.Cos]:X(z(1,1),st(H)),[v.Atan]:X(z(1,2),st(H)),[v.Sqrt]:X(z(1,1),st(H)),[v.Match]:X(z(4,1/0),_c,l_),[v.Between]:X(z(3,3),st(H)),[v.Interpolate]:X(z(6,1/0),_c,h_),[v.Case]:X(z(3,1/0),a_,c_),[v.In]:X(z(2,2),u_),[v.Number]:X(z(1,1/0),st(is)),[v.String]:X(z(1,1/0),st(is)),[v.Array]:X(z(1,1/0),st(H)),[v.Color]:X(z(1,4),st(H)),[v.Band]:X(z(1,3),st(H)),[v.Palette]:X(z(2,2),d_),[v.ToString]:X(z(1,1),st(Ft|H|Bt|te))};function n_(i,t,e){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 St(H,o);break}case"string":{r[s]=new St(Bt,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}s===0&&e.properties.add(String(o))}return r}function r_(i,t,e){const n=i[1];if(typeof n!="string")throw new Error("expected a string argument for var operation");return e.variables.add(n),[new St(Bt,n)]}function s_(i,t,e){e.featureId=!0}function o_(i,t,e){e.geometryType=!0}function Wn(i,t,e){const n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function z(i,t){return function(e,n,r){const s=e[0],o=e.length-1;if(i===t){if(o!==i){const a=i===1?"":"s";throw new Error(`expected ${i} argument${a} for ${s}, got ${o}`)}}else if(o<i||o>t){const a=t===1/0?`${i} or more`:`${i} to ${t}`;throw new Error(`expected ${a} arguments for ${s}, got ${o}`)}}}function pc(i,t,e){const n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){const o=It(i[s+1],t,e);r[s]=o}return r}function st(i){return function(t,e,n){const r=t.length-1,s=new Array(r);for(let o=0;o<r;++o){const a=It(t[o+1],i,n);s[o]=a}return s}}function a_(i,t,e){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 _c(i,t,e){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 l_(i,t,e){const n=i.length-1,r=Bt|H|Ft,s=It(i[1],r,e),o=It(i[i.length-1],t,e),a=new Array(n-2);for(let l=0;l<n-2;l+=2){try{const h=It(i[l+2],s.type,e);a[l]=h}catch(h){throw new Error(`failed to parse argument ${l+1} of match expression: ${h.message}`)}try{const h=It(i[l+3],o.type,e);a[l+1]=h}catch(h){throw new Error(`failed to parse argument ${l+2} of match expression: ${h.message}`)}}return[s,...a,o]}function h_(i,t,e){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 St(H,r);let o;try{o=It(i[2],H,e)}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 h=It(i[l+3],H,e);a[l]=h}catch(h){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${h.message}`)}try{const h=It(i[l+4],t,e);a[l+1]=h}catch(h){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${h.message}`)}}return[s,o,...a]}function c_(i,t,e){const n=It(i[i.length-1],t,e),r=new Array(i.length-1);for(let s=0;s<r.length-1;s+=2){try{const o=It(i[s+1],Ft,e);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,e);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 u_(i,t,e){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(typeof n[0]=="string"){if(n[0]!=="literal")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');if(!Array.isArray(n[1]))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array');n=n[1],r=Bt}else r=H;const s=new Array(n.length);for(let a=0;a<s.length;a++)try{const l=It(n[a],r,e);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[It(i[1],r,e),...s]}function d_(i,t,e){let n;try{n=It(i[1],H,e)}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],te,e)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof St))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[n,...s]}function X(...i){return function(t,e,n){const r=t[0];let s;for(let o=0;o<i.length;o++){const a=i[o](t,e,n);if(o==i.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");s=a}}return new gc(e,r,...s)}}function f_(i,t,e){const n=i[0],r=i_[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,t,e)}function ga(i){if(!i)return"";const t=i.getType();switch(t){case"Point":case"LineString":case"Polygon":return t;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return t.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return ga(i.getGeometries()[0]);default:return""}}class g_{constructor(t,e){this.name=t,this.data=e,this.texture_=null}getTexture(t){if(!this.texture_){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.data.length/4,1,0,t.RGBA,t.UNSIGNED_BYTE,this.data),this.texture_=e}return this.texture_}delete(t){this.texture_&&t.deleteTexture(this.texture_),this.texture_=null}}function p_(i,t){return`operator_${i}_${Object.keys(t.functions).length}`}function ns(i){const t=i.toString();return t.includes(".")?t:t+".0"}function pa(i){if(i.length<2||i.length>4)throw new Error("`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.");return`vec${i.length}(${i.map(ns).join(", ")})`}function __(i){const t=bi(i),e=t.length>3?t[3]:1;return pa([t[0]/255*e,t[1]/255*e,t[2]/255*e,e])}function m_(i){const t=Te(i);return pa(t)}const _a={};let y_=0;function mc(i){return i in _a||(_a[i]=y_++),_a[i]}function E_(i){return ns(mc(i))}function yc(i){return"u_var_"+i}function x_(){return{inFragmentShader:!1,variables:{},properties:{},functions:{},bandCount:0,style:{}}}const ma="getBandValue",Ec="u_paletteTextures";function T_(i,t,e,n){const r=It(i,t,e);return ya(r,t,n)}function tt(i){return(t,e,n)=>{const r=e.args.length,s=new Array(r);for(let o=0;o<r;++o)s[o]=ya(e.args[o],n,t);return i(s,t)}}const v_={[v.Get]:(i,t)=>{const n=t.args[0].value;return n in i.properties||(i.properties[n]={name:n,type:t.type}),(i.inFragmentShader?"v_prop_":"a_prop_")+n},[v.GeometryType]:(i,t,e)=>{const n="geometryType";return n in i.properties||(i.properties[n]={name:n,type:Bt,evaluator:o=>ga(o.getGeometry())}),(i.inFragmentShader?"v_prop_":"a_prop_")+n},[v.Var]:(i,t)=>{const n=t.args[0].value;return n in i.variables||(i.variables[n]={name:n,type:t.type}),yc(n)},[v.Resolution]:()=>"u_resolution",[v.Zoom]:()=>"u_zoom",[v.Time]:()=>"u_time",[v.Any]:tt(i=>`(${i.join(" || ")})`),[v.All]:tt(i=>`(${i.join(" && ")})`),[v.Not]:tt(([i])=>`(!${i})`),[v.Equal]:tt(([i,t])=>`(${i} == ${t})`),[v.NotEqual]:tt(([i,t])=>`(${i} != ${t})`),[v.GreaterThan]:tt(([i,t])=>`(${i} > ${t})`),[v.GreaterThanOrEqualTo]:tt(([i,t])=>`(${i} >= ${t})`),[v.LessThan]:tt(([i,t])=>`(${i} < ${t})`),[v.LessThanOrEqualTo]:tt(([i,t])=>`(${i} <= ${t})`),[v.Multiply]:tt(i=>`(${i.join(" * ")})`),[v.Divide]:tt(([i,t])=>`(${i} / ${t})`),[v.Add]:tt(i=>`(${i.join(" + ")})`),[v.Subtract]:tt(([i,t])=>`(${i} - ${t})`),[v.Clamp]:tt(([i,t,e])=>`clamp(${i}, ${t}, ${e})`),[v.Mod]:tt(([i,t])=>`mod(${i}, ${t})`),[v.Pow]:tt(([i,t])=>`pow(${i}, ${t})`),[v.Abs]:tt(([i])=>`abs(${i})`),[v.Floor]:tt(([i])=>`floor(${i})`),[v.Ceil]:tt(([i])=>`ceil(${i})`),[v.Round]:tt(([i])=>`floor(${i} + 0.5)`),[v.Sin]:tt(([i])=>`sin(${i})`),[v.Cos]:tt(([i])=>`cos(${i})`),[v.Atan]:tt(([i,t])=>t!==void 0?`atan(${i}, ${t})`:`atan(${i})`),[v.Sqrt]:tt(([i])=>`sqrt(${i})`),[v.Match]:tt(i=>{const t=i[0],e=i[i.length-1];let n=null;for(let r=i.length-3;r>=1;r-=2){const s=i[r],o=i[r+1];n=`(${t} == ${s} ? ${o} : ${n||e})`}return n}),[v.Between]:tt(([i,t,e])=>`(${i} >= ${t} && ${i} <= ${e})`),[v.Interpolate]:tt(([i,t,...e])=>{let n="";for(let r=0;r<e.length-2;r+=2){const s=e[r],o=n||e[r+1],a=e[r+2],l=e[r+3];let h;i===ns(1)?h=`(${t} - ${s}) / (${a} - ${s})`:h=`(pow(${i}, (${t} - ${s})) - 1.0) / (pow(${i}, (${a} - ${s})) - 1.0)`,n=`mix(${o}, ${l}, clamp(${h}, 0.0, 1.0))`}return n}),[v.Case]:tt(i=>{const t=i[i.length-1];let e=null;for(let n=i.length-3;n>=0;n-=2){const r=i[n],s=i[n+1];e=`(${r} ? ${s} : ${e||t})`}return e}),[v.In]:tt(([i,...t],e)=>{const n=p_("in",e),r=[];for(let s=0;s<t.length;s+=1)r.push(` if (inputValue == ${t[s]}) { return true; }`);return e.functions[n]=`bool ${n}(float inputValue) {
70
+ `;class Da{constructor(t){this.gl_=t.webGlContext;const e=this.gl_;this.scaleRatio_=t.scaleRatio||1,this.renderTargetTexture_=e.createTexture(),this.renderTargetTextureSize_=null,this.frameBuffer_=e.createFramebuffer(),this.depthBuffer_=e.createRenderbuffer();const i=e.createShader(e.VERTEX_SHADER);e.shaderSource(i,t.vertexShader||Sd),e.compileShader(i);const r=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(r,t.fragmentShader||Ad),e.compileShader(r),this.renderTargetProgram_=e.createProgram(),e.attachShader(this.renderTargetProgram_,i),e.attachShader(this.renderTargetProgram_,r),e.linkProgram(this.renderTargetProgram_),this.renderTargetVerticesBuffer_=e.createBuffer();const s=[-1,-1,1,-1,-1,1,1,-1,1,1,-1,1];e.bindBuffer(e.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),e.bufferData(e.ARRAY_BUFFER,new Float32Array(s),e.STATIC_DRAW),this.renderTargetAttribLocation_=e.getAttribLocation(this.renderTargetProgram_,"a_position"),this.renderTargetUniformLocation_=e.getUniformLocation(this.renderTargetProgram_,"u_screenSize"),this.renderTargetOpacityLocation_=e.getUniformLocation(this.renderTargetProgram_,"u_opacity"),this.renderTargetTextureLocation_=e.getUniformLocation(this.renderTargetProgram_,"u_image"),this.uniforms_=[],t.uniforms&&Object.keys(t.uniforms).forEach(o=>{this.uniforms_.push({value:t.uniforms[o],location:e.getUniformLocation(this.renderTargetProgram_,o)})})}getGL(){return this.gl_}init(t){const e=this.getGL(),i=[e.drawingBufferWidth*this.scaleRatio_,e.drawingBufferHeight*this.scaleRatio_];if(e.bindFramebuffer(e.FRAMEBUFFER,this.getFrameBuffer()),e.bindRenderbuffer(e.RENDERBUFFER,this.getDepthBuffer()),e.viewport(0,0,i[0],i[1]),!this.renderTargetTextureSize_||this.renderTargetTextureSize_[0]!==i[0]||this.renderTargetTextureSize_[1]!==i[1]){this.renderTargetTextureSize_=i;const r=0,s=e.RGBA,o=0,a=e.RGBA,l=e.UNSIGNED_BYTE,u=null;e.bindTexture(e.TEXTURE_2D,this.renderTargetTexture_),e.texImage2D(e.TEXTURE_2D,r,s,i[0],i[1],o,a,l,u),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.renderTargetTexture_,0),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,i[0],i[1]),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,this.depthBuffer_)}}apply(t,e,i,r){const s=this.getGL(),o=t.size;if(s.bindFramebuffer(s.FRAMEBUFFER,e?e.getFrameBuffer():null),s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,this.renderTargetTexture_),!e){const l=Yt(s.canvas);if(!t.renderTargets[l]){const u=s.getContextAttributes();u&&u.preserveDrawingBuffer&&(s.clearColor(0,0,0,0),s.clearDepth(1),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT)),t.renderTargets[l]=!0}}s.disable(s.DEPTH_TEST),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA),s.viewport(0,0,s.drawingBufferWidth,s.drawingBufferHeight),s.bindBuffer(s.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),s.useProgram(this.renderTargetProgram_),s.enableVertexAttribArray(this.renderTargetAttribLocation_),s.vertexAttribPointer(this.renderTargetAttribLocation_,2,s.FLOAT,!1,0,0),s.uniform2f(this.renderTargetUniformLocation_,o[0],o[1]),s.uniform1i(this.renderTargetTextureLocation_,0);const a=t.layerStatesArray[t.layerIndex].opacity;s.uniform1f(this.renderTargetOpacityLocation_,a),this.applyUniforms(t),i&&i(s,t),s.drawArrays(s.TRIANGLES,0,6),r&&r(s,t)}getFrameBuffer(){return this.frameBuffer_}getDepthBuffer(){return this.depthBuffer_}applyUniforms(t){const e=this.getGL();let i,r=1;this.uniforms_.forEach(function(s){if(i=typeof s.value=="function"?s.value(t):s.value,i instanceof HTMLCanvasElement||i instanceof ImageData)s.texture||(s.texture=e.createTexture()),e.activeTexture(e[`TEXTURE${r}`]),e.bindTexture(e.TEXTURE_2D,s.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),i instanceof ImageData?e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,i.width,i.height,0,e.UNSIGNED_BYTE,new Uint8Array(i.data)):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,i),e.uniform1i(s.location,r++);else if(Array.isArray(i))switch(i.length){case 2:e.uniform2f(s.location,i[0],i[1]);return;case 3:e.uniform3f(s.location,i[0],i[1],i[2]);return;case 4:e.uniform4f(s.location,i[0],i[1],i[2],i[3]);return;default:return}else typeof i=="number"&&e.uniform1f(s.location,i)})}}function Na(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Ua(n,t){return n[0]=t[0],n[1]=t[1],n[4]=t[2],n[5]=t[3],n[12]=t[4],n[13]=t[5],n}const _e={PROJECTION_MATRIX:"u_projectionMatrix",SCREEN_TO_WORLD_MATRIX:"u_screenToWorldMatrix",TIME:"u_time",ZOOM:"u_zoom",RESOLUTION:"u_resolution",ROTATION:"u_rotation",VIEWPORT_SIZE_PX:"u_viewportSizePx",PIXEL_RATIO:"u_pixelRatio",HIT_DETECTION:"u_hitDetection"},Un={UNSIGNED_BYTE:pd,UNSIGNED_SHORT:md,UNSIGNED_INT:_d,FLOAT:$a},Ai={};function Fa(n){return"shared/"+n}let Ba=0;function Id(){const n="unique/"+Ba;return Ba+=1,n}function $d(n){let t=Ai[n];if(!t){const e=document.createElement("canvas");e.width=1,e.height=1,e.style.position="absolute",e.style.left="0",t={users:0,context:yd(e)},Ai[n]=t}return t.users+=1,t.context}function Pd(n){const t=Ai[n];if(!t||(t.users-=1,t.users>0))return;const e=t.context,i=e.getExtension("WEBGL_lose_context");i&&i.loseContext();const r=e.canvas;r.width=1,r.height=1,delete Ai[n]}class Md extends Po{constructor(t){super(),t=t||{},this.boundHandleWebGLContextLost_=this.handleWebGLContextLost.bind(this),this.boundHandleWebGLContextRestored_=this.handleWebGLContextRestored.bind(this),this.canvasCacheKey_=t.canvasCacheKey?Fa(t.canvasCacheKey):Id(),this.gl_=$d(this.canvasCacheKey_),this.bufferCache_={},this.extensionCache_={},this.currentProgram_=null,this.needsToBeRecreated_=!1;const e=this.gl_.canvas;e.addEventListener(Si.LOST,this.boundHandleWebGLContextLost_),e.addEventListener(Si.RESTORED,this.boundHandleWebGLContextRestored_),this.offsetRotateMatrix_=On(),this.offsetScaleMatrix_=On(),this.tmpMat4_=Na(),this.uniformLocationsByProgram_={},this.attribLocationsByProgram_={},this.uniforms_=[],t.uniforms&&this.setUniforms(t.uniforms),this.postProcessPasses_=t.postProcesses?t.postProcesses.map(i=>new Da({webGlContext:this.gl_,scaleRatio:i.scaleRatio,vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,uniforms:i.uniforms})):[new Da({webGlContext:this.gl_})],this.shaderCompileErrors_=null,this.startTime_=Date.now()}setUniforms(t){this.uniforms_=[],this.addUniforms(t)}addUniforms(t){for(const e in t)this.uniforms_.push({name:e,value:t[e]})}canvasCacheKeyMatches(t){return this.canvasCacheKey_===Fa(t)}getExtension(t){if(t in this.extensionCache_)return this.extensionCache_[t];const e=this.gl_.getExtension(t);return this.extensionCache_[t]=e,e}bindBuffer(t){const e=this.gl_,i=Yt(t);let r=this.bufferCache_[i];if(!r){const s=e.createBuffer();r={buffer:t,webGlBuffer:s},this.bufferCache_[i]=r}e.bindBuffer(t.getType(),r.webGlBuffer)}flushBufferData(t){const e=this.gl_;this.bindBuffer(t),e.bufferData(t.getType(),t.getArray(),t.getUsage())}deleteBuffer(t){const e=this.gl_,i=Yt(t),r=this.bufferCache_[i];r&&!e.isContextLost()&&e.deleteBuffer(r.webGlBuffer),delete this.bufferCache_[i]}disposeInternal(){const t=this.gl_.canvas;t.removeEventListener(Si.LOST,this.boundHandleWebGLContextLost_),t.removeEventListener(Si.RESTORED,this.boundHandleWebGLContextRestored_),Pd(this.canvasCacheKey_),delete this.gl_}prepareDraw(t,e,i){const r=this.gl_,s=this.getCanvas(),o=t.size,a=t.pixelRatio;(s.width!==o[0]*a||s.height!==o[1]*a)&&(s.width=o[0]*a,s.height=o[1]*a,s.style.width=o[0]+"px",s.style.height=o[1]+"px");for(let l=this.postProcessPasses_.length-1;l>=0;l--)this.postProcessPasses_[l].init(t);r.bindTexture(r.TEXTURE_2D,null),r.clearColor(0,0,0,0),r.depthRange(0,1),r.clearDepth(1),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT),r.enable(r.BLEND),r.blendFunc(r.ONE,e?r.ZERO:r.ONE_MINUS_SRC_ALPHA),i?(r.enable(r.DEPTH_TEST),r.depthFunc(r.LEQUAL)):r.disable(r.DEPTH_TEST)}bindTexture(t,e,i){const r=this.gl_;r.activeTexture(r.TEXTURE0+e),r.bindTexture(r.TEXTURE_2D,t),r.uniform1i(this.getUniformLocation(i),e)}prepareDrawToRenderTarget(t,e,i,r){const s=this.gl_,o=e.getSize();s.bindFramebuffer(s.FRAMEBUFFER,e.getFramebuffer()),s.bindRenderbuffer(s.RENDERBUFFER,e.getDepthbuffer()),s.viewport(0,0,o[0],o[1]),s.bindTexture(s.TEXTURE_2D,e.getTexture()),s.clearColor(0,0,0,0),s.depthRange(0,1),s.clearDepth(1),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),s.enable(s.BLEND),s.blendFunc(s.ONE,i?s.ZERO:s.ONE_MINUS_SRC_ALPHA),r?(s.enable(s.DEPTH_TEST),s.depthFunc(s.LEQUAL)):s.disable(s.DEPTH_TEST)}drawElements(t,e){const i=this.gl_;this.getExtension("OES_element_index_uint");const r=i.UNSIGNED_INT,s=4,o=e-t,a=t*s;i.drawElements(i.TRIANGLES,o,r,a)}finalizeDraw(t,e,i){for(let r=0,s=this.postProcessPasses_.length;r<s;r++)r===s-1?this.postProcessPasses_[r].apply(t,null,e,i):this.postProcessPasses_[r].apply(t,this.postProcessPasses_[r+1])}getCanvas(){return this.gl_.canvas}getGL(){return this.gl_}applyFrameState(t){const e=t.size,i=t.viewState.rotation,r=t.pixelRatio;this.setUniformFloatValue(_e.TIME,(Date.now()-this.startTime_)*.001),this.setUniformFloatValue(_e.ZOOM,t.viewState.zoom),this.setUniformFloatValue(_e.RESOLUTION,t.viewState.resolution),this.setUniformFloatValue(_e.PIXEL_RATIO,r),this.setUniformFloatVec2(_e.VIEWPORT_SIZE_PX,[e[0],e[1]]),this.setUniformFloatValue(_e.ROTATION,i)}applyHitDetectionUniform(t){const e=this.getUniformLocation(_e.HIT_DETECTION);this.getGL().uniform1i(e,t?1:0),t&&this.setUniformFloatValue(_e.PIXEL_RATIO,.5)}applyUniforms(t){const e=this.gl_;let i,r=0;this.uniforms_.forEach(s=>{if(i=typeof s.value=="function"?s.value(t):s.value,i instanceof HTMLCanvasElement||i instanceof HTMLImageElement||i instanceof ImageData||i instanceof WebGLTexture){i instanceof WebGLTexture&&!s.texture?(s.prevValue=void 0,s.texture=i):s.texture||(s.prevValue=void 0,s.texture=e.createTexture()),this.bindTexture(s.texture,r,s.name),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);const o=!(i instanceof HTMLImageElement)||i.complete;!(i instanceof WebGLTexture)&&o&&s.prevValue!==i&&(s.prevValue=i,e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,i)),r++}else if(Array.isArray(i)&&i.length===6)this.setUniformMatrixValue(s.name,Ua(this.tmpMat4_,i));else if(Array.isArray(i)&&i.length<=4)switch(i.length){case 2:e.uniform2f(this.getUniformLocation(s.name),i[0],i[1]);return;case 3:e.uniform3f(this.getUniformLocation(s.name),i[0],i[1],i[2]);return;case 4:e.uniform4f(this.getUniformLocation(s.name),i[0],i[1],i[2],i[3]);return;default:return}else typeof i=="number"&&e.uniform1f(this.getUniformLocation(s.name),i)})}useProgram(t,e){this.gl_.useProgram(t),this.currentProgram_=t,this.applyFrameState(e),this.applyUniforms(e)}compileShader(t,e){const i=this.gl_,r=i.createShader(e);return i.shaderSource(r,t),i.compileShader(r),r}getProgram(t,e){const i=this.gl_,r=this.compileShader(t,i.FRAGMENT_SHADER),s=this.compileShader(e,i.VERTEX_SHADER),o=i.createProgram();if(i.attachShader(o,r),i.attachShader(o,s),i.linkProgram(o),!i.getShaderParameter(r,i.COMPILE_STATUS)){const a=`Fragment shader compilation failed: ${i.getShaderInfoLog(r)}`;throw new Error(a)}if(i.deleteShader(r),!i.getShaderParameter(s,i.COMPILE_STATUS)){const a=`Vertex shader compilation failed: ${i.getShaderInfoLog(s)}`;throw new Error(a)}if(i.deleteShader(s),!i.getProgramParameter(o,i.LINK_STATUS)){const a=`GL program linking failed: ${i.getProgramInfoLog(o)}`;throw new Error(a)}return o}getUniformLocation(t){const e=Yt(this.currentProgram_);return this.uniformLocationsByProgram_[e]===void 0&&(this.uniformLocationsByProgram_[e]={}),this.uniformLocationsByProgram_[e][t]===void 0&&(this.uniformLocationsByProgram_[e][t]=this.gl_.getUniformLocation(this.currentProgram_,t)),this.uniformLocationsByProgram_[e][t]}getAttributeLocation(t){const e=Yt(this.currentProgram_);return this.attribLocationsByProgram_[e]===void 0&&(this.attribLocationsByProgram_[e]={}),this.attribLocationsByProgram_[e][t]===void 0&&(this.attribLocationsByProgram_[e][t]=this.gl_.getAttribLocation(this.currentProgram_,t)),this.attribLocationsByProgram_[e][t]}makeProjectionTransform(t,e){const i=t.size,r=t.viewState.rotation,s=t.viewState.resolution,o=t.viewState.center;return Kr(e,0,0,2/(s*i[0]),2/(s*i[1]),-r,-o[0],-o[1]),e}setUniformFloatValue(t,e){this.gl_.uniform1f(this.getUniformLocation(t),e)}setUniformFloatVec2(t,e){this.gl_.uniform2fv(this.getUniformLocation(t),e)}setUniformFloatVec4(t,e){this.gl_.uniform4fv(this.getUniformLocation(t),e)}setUniformMatrixValue(t,e){this.gl_.uniformMatrix4fv(this.getUniformLocation(t),!1,e)}enableAttributeArray_(t,e,i,r,s){const o=this.getAttributeLocation(t);o<0||(this.gl_.enableVertexAttribArray(o),this.gl_.vertexAttribPointer(o,e,i,!1,r,s))}enableAttributes(t){const e=Od(t);let i=0;for(let r=0;r<t.length;r++){const s=t[r];this.enableAttributeArray_(s.name,s.size,s.type||$a,e,i),i+=s.size*Xa(s.type)}}handleWebGLContextLost(t){Dr(this.bufferCache_),this.currentProgram_=null,t.preventDefault()}handleWebGLContextRestored(){this.needsToBeRecreated_=!0}needsToBeRecreated(){return this.needsToBeRecreated_}createTexture(t,e,i){const r=this.gl_;i=i||r.createTexture();const s=0,o=r.RGBA,a=0,l=r.RGBA,u=r.UNSIGNED_BYTE;return r.bindTexture(r.TEXTURE_2D,i),e?r.texImage2D(r.TEXTURE_2D,s,o,l,u,e):r.texImage2D(r.TEXTURE_2D,s,o,t[0],t[1],a,l,u,null),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),i}}function Od(n){let t=0;for(let e=0;e<n.length;e++){const i=n[e];t+=i.size*Xa(i.type)}return t}function Xa(n){switch(n){case Un.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case Un.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case Un.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT;case Un.FLOAT:default:return Float32Array.BYTES_PER_ELEMENT}}class hs extends Cd{constructor(t,e){super(t),e=e||{},this.inversePixelTransform_=On(),this.pixelContext_=null,this.postProcesses_=e.postProcesses,this.uniforms_=e.uniforms,this.helper,t.addChangeListener(W.MAP,this.removeHelper.bind(this)),this.dispatchPreComposeEvent=this.dispatchPreComposeEvent.bind(this),this.dispatchPostComposeEvent=this.dispatchPostComposeEvent.bind(this)}dispatchPreComposeEvent(t,e){const i=this.getLayer();if(i.hasListener(Ie.PRECOMPOSE)){const r=new cs(Ie.PRECOMPOSE,void 0,e,t);i.dispatchEvent(r)}}dispatchPostComposeEvent(t,e){const i=this.getLayer();if(i.hasListener(Ie.POSTCOMPOSE)){const r=new cs(Ie.POSTCOMPOSE,void 0,e,t);i.dispatchEvent(r)}}reset(t){this.uniforms_=t.uniforms,this.helper&&this.helper.setUniforms(this.uniforms_)}removeHelper(){this.helper&&(this.helper.dispose(),delete this.helper)}prepareFrame(t){if(this.getLayer().getRenderSource()){let e=!0,i=-1,r;for(let o=0,a=t.layerStatesArray.length;o<a;o++){const l=t.layerStatesArray[o].layer,u=l.getRenderer();if(!(u instanceof hs)){e=!0;continue}const h=l.getClassName();if((e||h!==r)&&(i+=1,e=!1),r=h,u===this)break}const s="map/"+t.mapId+"/group/"+i;(!this.helper||!this.helper.canvasCacheKeyMatches(s)||this.helper.needsToBeRecreated())&&(this.removeHelper(),this.helper=new Md({postProcesses:this.postProcesses_,uniforms:this.uniforms_,canvasCacheKey:s}),r&&(this.helper.getCanvas().className=r),this.afterHelperCreated())}return this.prepareFrameInternal(t)}afterHelperCreated(){}prepareFrameInternal(t){return!0}disposeInternal(){this.removeHelper(),super.disposeInternal()}dispatchRenderEvent_(t,e,i){const r=this.getLayer();if(r.hasListener(t)){Kr(this.inversePixelTransform_,0,0,i.pixelRatio,-i.pixelRatio,0,0,-i.size[1]);const s=new cs(t,this.inversePixelTransform_,i,e);r.dispatchEvent(s)}}preRender(t,e){this.dispatchRenderEvent_(Ie.PRERENDER,t,e)}postRender(t,e){this.dispatchRenderEvent_(Ie.POSTRENDER,t,e)}}function Ha(n,t,e,i){return i!==void 0?(i[0]=n,i[1]=t,i[2]=e,i):[n,t,e]}function Ld(n,t,e){return n+"/"+t+"/"+e}function en(n){return Ld(n[0],n[1],n[2])}const Dd={TILE_TRANSFORM:"u_tileTransform",TRANSITION_ALPHA:"u_transitionAlpha",DEPTH:"u_depth",RENDER_EXTENT:"u_renderExtent",PATTERN_ORIGIN:"u_patternOrigin",RESOLUTION:"u_resolution",ZOOM:"u_zoom",GLOBAL_ALPHA:"u_globalAlpha",PROJECTION_MATRIX:"u_projectionMatrix",SCREEN_TO_WORLD_MATRIX:"u_screenToWorldMatrix"},Nd={};function Ga(n){return 1/(n+2)}function Ud(){return{tileIds:new Set,representationsByZ:{}}}function ka(n,t){return n.tileIds.has(Yt(t))}function Va(n,t,e){const i=n.representationsByZ;e in i||(i[e]=new Set),i[e].add(t),n.tileIds.add(Yt(t.tile))}function ds(n,t){const e=n.layerStatesArray[n.layerIndex];e.extent&&(t=Zt(t,Ke(e.extent,n.viewState.projection)));const i=e.layer.getRenderSource();if(!i.getWrapX()){const r=i.getTileGridForProjection(n.viewState.projection).getExtent();r&&(t=Zt(t,r))}return t}function fs(n,t){return`${n.getKey()},${en(t)}`}class Fd extends hs{constructor(t,e){super(t,{uniforms:e.uniforms,postProcesses:e.postProcesses}),this.renderComplete=!1,this.tileTransform_=On(),this.tempMat4=Na(),this.tempTileRange_=new Rd(0,0,0,0),this.tempTileCoord_=Ha(0,0,0),this.tempSize_=[0,0];const i=e.cacheSize!==void 0?e.cacheSize:512;this.tileRepresentationCache=new xd(i),this.frameState=null,this.projection_=void 0}reset(t){super.reset({uniforms:t.uniforms})}prepareFrameInternal(t){this.projection_?t.viewState.projection!==this.projection_&&(this.clearCache(),this.projection_=t.viewState.projection):this.projection_=t.viewState.projection;const i=this.getLayer().getRenderSource();return!i||Ei(ds(t,t.extent))?!1:i.getState()==="ready"}createTileRepresentation(t){return ot()}enqueueTiles(t,e,i,r,s){const o=t.viewState,a=this.getLayer(),l=a.getRenderSource(),u=l.getTileGridForProjection(o.projection),h=l.getGutterForProjection(o.projection),c=Yt(l);c in t.wantedTiles||(t.wantedTiles[c]={});const d=t.wantedTiles[c],f=this.tileRepresentationCache,g=a.getMapInternal(),p=Math.max(i-s,u.getMinZoom(),u.getZForResolution(Math.min(a.getMaxResolution(),g?g.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):u.getResolution(0)),l.zDirection));for(let m=i;m>=p;--m){const y=u.getTileRangeForExtentAndZ(e,m,this.tempTileRange_),_=u.getResolution(m);for(let T=y.minX;T<=y.maxX;++T)for(let E=y.minY;E<=y.maxY;++E){const b=Ha(m,T,E,this.tempTileCoord_),v=fs(l,b);let C,w;if(f.containsKey(v)&&(C=f.get(v),w=C.tile),(!C||C.tile.key!==l.getKey())&&(w=l.getTile(m,T,E,t.pixelRatio,o.projection),!w)||ka(r,w))continue;C?C.setTile(w):(C=this.createTileRepresentation({tile:w,grid:u,helper:this.helper,gutter:h}),f.set(v,C)),Va(r,C,m);const I=w.getKey();d[I]=!0,w.getState()===A.IDLE&&(t.tileQueue.isKeyQueued(I)||t.tileQueue.enqueue([w,c,u.getTileCoordCenter(b),_]))}}}beforeTilesRender(t,e){this.helper.prepareDraw(this.frameState,!e,!0)}beforeTilesMaskRender(t){return!1}renderTile(t,e,i,r,s,o,a,l,u,h,c){}renderTileMask(t,e,i,r){}drawTile_(t,e,i,r,s,o,a){if(!e.ready)return;const u=e.tile.tileCoord,h=en(u),c=h in o?o[h]:1,d=a.getResolution(i),f=Nn(a.getTileSize(i),this.tempSize_),g=a.getOrigin(i),p=a.getTileCoordExtent(u),m=c<1?-1:Ga(i);c<1&&(t.animate=!0);const y=t.viewState,_=y.center[0],T=y.center[1],E=f[0]+2*r,b=f[1]+2*r,v=E/b,C=(_-g[0])/(f[0]*d),w=(g[1]-T)/(f[1]*d),I=y.resolution/d,X=u[1],F=u[2];xh(this.tileTransform_),sa(this.tileTransform_,2/(t.size[0]*I/E),-2/(t.size[1]*I/E)),wh(this.tileTransform_,y.rotation),sa(this.tileTransform_,1,1/v),Ch(this.tileTransform_,(f[0]*(X-C)-r)/E,(f[1]*(F-w)-r)/b),this.renderTile(e,this.tileTransform_,t,s,d,f,g,p,m,r,c)}renderFrame(t){this.frameState=t,this.renderComplete=!0;const e=this.helper.getGL();this.preRender(e,t);const i=t.viewState,r=this.getLayer(),s=r.getRenderSource(),o=s.getTileGridForProjection(i.projection),a=s.getGutterForProjection(i.projection),l=ds(t,t.extent),u=o.getZForResolution(i.resolution,s.zDirection),h=Ud(),c=r.getPreload();if(t.nextExtent){const v=o.getZForResolution(i.nextResolution,s.zDirection),C=ds(t,t.nextExtent);this.enqueueTiles(t,C,v,h,c)}this.enqueueTiles(t,l,u,h,0),c>0&&setTimeout(()=>{this.enqueueTiles(t,l,u-1,h,c-1)},0);const d={},f=Yt(this),g=t.time;let p=!1;const m=h.representationsByZ;if(u in m)for(const v of m[u]){const C=v.tile;if((C instanceof ss||C instanceof Aa)&&C.getState()===A.EMPTY)continue;const w=C.tileCoord;if(v.ready){const F=C.getAlpha(f,g);if(F===1){C.endTransition(f);continue}p=!0;const V=en(w);d[V]=F}if(this.renderComplete=!1,this.findAltTiles_(o,w,u+1,h))continue;const X=o.getMinZoom();for(let F=u-1;F>=X&&!this.findAltTiles_(o,w,F,h);--F);}const y=Object.keys(m).map(Number).sort(Sc);if(this.beforeTilesMaskRender(t))for(let v=0,C=y.length;v<C;++v){const w=y[v];for(const I of m[w]){const X=I.tile.tileCoord;if(en(X)in d)continue;const V=o.getTileCoordExtent(X);this.renderTileMask(I,w,V,Ga(w))}}this.beforeTilesRender(t,p);for(let v=0,C=y.length;v<C;++v){const w=y[v];for(const I of m[w]){const X=I.tile.tileCoord;en(X)in d||this.drawTile_(t,I,w,a,l,d,o)}}if(u in m)for(const v of m[u]){const C=v.tile.tileCoord;en(C)in d&&this.drawTile_(t,v,u,a,l,d,o)}this.helper.finalizeDraw(t,this.dispatchPreComposeEvent,this.dispatchPostComposeEvent);const T=this.helper.getCanvas(),E=this.tileRepresentationCache;for(;E.canExpireCache();)E.pop().dispose();const b=function(v,C){s.expireCache(C.viewState.projection,Nd)};return t.postRenderFunctions.push(b),this.postRender(e,t),T}findAltTiles_(t,e,i,r){const s=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!s)return!1;let o=!0;const a=this.tileRepresentationCache,l=this.getLayer().getRenderSource();for(let u=s.minX;u<=s.maxX;++u)for(let h=s.minY;h<=s.maxY;++h){const c=fs(l,[i,u,h]);let d=!1;if(a.containsKey(c)){const f=a.get(c);f.ready&&!ka(r,f.tile)&&(Va(r,f,i),d=!0)}d||(o=!1)}return o}clearCache(){const t=this.tileRepresentationCache;t.forEach(e=>e.dispose()),t.clear()}removeHelper(){this.helper&&this.clearCache(),super.removeHelper()}disposeInternal(){super.disposeInternal(),delete this.frameState}}const L={...Dd,TILE_TEXTURE_ARRAY:"u_tileTextures",TEXTURE_PIXEL_WIDTH:"u_texturePixelWidth",TEXTURE_PIXEL_HEIGHT:"u_texturePixelHeight",TEXTURE_RESOLUTION:"u_textureResolution",TEXTURE_ORIGIN_X:"u_textureOriginX",TEXTURE_ORIGIN_Y:"u_textureOriginY"},Ii={TEXTURE_COORD:"a_textureCoord"},Bd=[{name:Ii.TEXTURE_COORD,size:2,type:Un.FLOAT}];class Xd extends Fd{constructor(t,e){super(t,e),this.program_,this.vertexShader_=e.vertexShader,this.fragmentShader_=e.fragmentShader,this.indices_=new Ma(as,ls),this.indices_.fromArray([0,1,3,1,2,3]),this.paletteTextures_=e.paletteTextures||[]}reset(t){if(super.reset(t),this.helper){const e=this.helper.getGL();for(const i of this.paletteTextures_)i.delete(e)}this.vertexShader_=t.vertexShader,this.fragmentShader_=t.fragmentShader,this.paletteTextures_=t.paletteTextures||[],this.helper&&(this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_))}afterHelperCreated(){this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_),this.helper.flushBufferData(this.indices_)}removeHelper(){if(this.helper){const t=this.helper.getGL();for(const e of this.paletteTextures_)e.delete(t)}super.removeHelper()}createTileRepresentation(t){return new Td(t)}beforeTilesRender(t,e){super.beforeTilesRender(t,e),this.helper.useProgram(this.program_,t)}renderTile(t,e,i,r,s,o,a,l,u,h,c){const d=this.helper.getGL();this.helper.bindBuffer(t.coords),this.helper.bindBuffer(this.indices_),this.helper.enableAttributes(Bd);let f=0;for(;f<t.textures.length;){const v=`${L.TILE_TEXTURE_ARRAY}[${f}]`;this.helper.bindTexture(t.textures[f],f,v),++f}for(let v=0;v<this.paletteTextures_.length;++v){const C=this.paletteTextures_[v],w=C.getTexture(d);this.helper.bindTexture(w,f,C.name),++f}const g=i.viewState,p=o[0]+2*h,m=o[1]+2*h,_=t.tile.tileCoord,T=_[1],E=_[2];this.helper.setUniformMatrixValue(L.TILE_TRANSFORM,Ua(this.tempMat4,e)),this.helper.setUniformFloatValue(L.TRANSITION_ALPHA,c),this.helper.setUniformFloatValue(L.DEPTH,u);let b=r;h>0&&(b=l,Zt(b,r,b)),this.helper.setUniformFloatVec4(L.RENDER_EXTENT,b),this.helper.setUniformFloatValue(L.RESOLUTION,g.resolution),this.helper.setUniformFloatValue(L.ZOOM,g.zoom),this.helper.setUniformFloatValue(L.TEXTURE_PIXEL_WIDTH,p),this.helper.setUniformFloatValue(L.TEXTURE_PIXEL_HEIGHT,m),this.helper.setUniformFloatValue(L.TEXTURE_RESOLUTION,s),this.helper.setUniformFloatValue(L.TEXTURE_ORIGIN_X,a[0]+T*o[0]*s-h*s),this.helper.setUniformFloatValue(L.TEXTURE_ORIGIN_Y,a[1]-E*o[1]*s+h*s),this.helper.drawElements(0,this.indices_.getSize())}getData(t){if(!this.helper.getGL())return null;const i=this.frameState;if(!i)return null;const r=this.getLayer(),s=Rh(i.pixelToCoordinateTransform,t.slice()),o=i.viewState,a=r.getExtent();if(a&&!Xr(Ke(a,o.projection),s))return null;const l=r.getSources(Br([s]),o.resolution);let u,h,c;for(u=l.length-1;u>=0;--u)if(h=l[u],h.getState()==="ready"){if(c=h.getTileGridForProjection(o.projection),h.getWrapX())break;const f=c.getExtent();if(!f||Xr(f,s))break}if(u<0)return null;const d=this.tileRepresentationCache;for(let f=c.getZForResolution(o.resolution);f>=c.getMinZoom();--f){const g=c.getTileCoordForCoordAndZ(s,f),p=fs(h,g);if(!d.containsKey(p))continue;const m=d.get(p),y=m.tile;if((y instanceof ss||y instanceof Aa)&&y.getState()===A.EMPTY)return null;if(!m.loaded)continue;const _=c.getOrigin(f),T=Nn(c.getTileSize(f)),E=c.getResolution(f),b=(s[0]-_[0])/E-g[1]*T[0],v=(_[1]-s[1])/E-g[2]*T[1];return m.getPixelData(b,v)}return null}disposeInternal(){const t=this.helper;if(t){const e=t.getGL();for(const i of this.paletteTextures_)i.delete(e);this.paletteTextures_.length=0,e.deleteProgram(this.program_),delete this.program_,t.deleteBuffer(this.indices_)}super.disposeInternal(),delete this.indices_}}const $i={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]};var Rt={name:"xyz",min:[0,0,0],channel:["X","Y","Z"],alias:["XYZ","ciexyz","cie1931"]};Rt.whitepoint={2:{A:[109.85,100,35.585],C:[98.074,100,118.232],D50:[96.422,100,82.521],D55:[95.682,100,92.149],D65:[95.045592705167,100,108.9057750759878],D75:[94.972,100,122.638],F2:[99.187,100,67.395],F7:[95.044,100,108.755],F11:[100.966,100,64.37],E:[100,100,100]},10:{A:[111.144,100,35.2],C:[97.285,100,116.145],D50:[96.72,100,81.427],D55:[95.799,100,90.926],D65:[94.811,100,107.304],D75:[94.416,100,120.641],F2:[103.28,100,69.026],F7:[95.792,100,107.687],F11:[103.866,100,65.627],E:[100,100,100]}},Rt.max=Rt.whitepoint[2].D65,Rt.rgb=function(n,t){t=t||Rt.whitepoint[2].E;var e=n[0]/t[0],i=n[1]/t[1],r=n[2]/t[2],s,o,a;return s=e*3.240969941904521+i*-1.537383177570093+r*-.498610760293,o=e*-.96924363628087+i*1.87596750150772+r*.041555057407175,a=e*.055630079696993+i*-.20397695888897+r*1.056971514242878,s=s>.0031308?1.055*Math.pow(s,1/2.4)-.055:s=s*12.92,o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:o=o*12.92,a=a>.0031308?1.055*Math.pow(a,1/2.4)-.055:a=a*12.92,s=Math.min(Math.max(0,s),1),o=Math.min(Math.max(0,o),1),a=Math.min(Math.max(0,a),1),[s*255,o*255,a*255]},$i.xyz=function(n,t){var e=n[0]/255,i=n[1]/255,r=n[2]/255;e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92,r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92;var s=e*.41239079926595+i*.35758433938387+r*.18048078840183,o=e*.21263900587151+i*.71516867876775+r*.072192315360733,a=e*.019330818715591+i*.11919477979462+r*.95053215224966;return t=t||Rt.whitepoint[2].E,[s*t[0],o*t[1],a*t[2]]};const ja={name:"luv",min:[0,-134,-140],max:[100,224,122],channel:["lightness","u","v"],alias:["LUV","cieluv","cie1976"],xyz:function(n,t,e){var i,r,s,o,a,l,u,h,c,d,f,g,p;if(s=n[0],o=n[1],a=n[2],s===0)return[0,0,0];var m=.0011070564598794539;return t=t||"D65",e=e||2,c=Rt.whitepoint[e][t][0],d=Rt.whitepoint[e][t][1],f=Rt.whitepoint[e][t][2],g=4*c/(c+15*d+3*f),p=9*d/(c+15*d+3*f),i=o/(13*s)+g||0,r=a/(13*s)+p||0,u=s>8?d*Math.pow((s+16)/116,3):d*s*m,l=u*9*i/(4*r)||0,h=u*(12-3*i-20*r)/(4*r)||0,[l,u,h]}};Rt.luv=function(n,t,e){var i,r,s,o,a,l,u,h,c,d,f,g,p,m=.008856451679035631,y=903.2962962962961;t=t||"D65",e=e||2,c=Rt.whitepoint[e][t][0],d=Rt.whitepoint[e][t][1],f=Rt.whitepoint[e][t][2],g=4*c/(c+15*d+3*f),p=9*d/(c+15*d+3*f),l=n[0],u=n[1],h=n[2],i=4*l/(l+15*u+3*h)||0,r=9*u/(l+15*u+3*h)||0;var _=u/d;return s=_<=m?y*_:116*Math.pow(_,1/3)-16,o=13*s*(i-g),a=13*s*(r-p),[s,o,a]},ja.lchuv=function(n){var t=n[0],e=n[1],i=n[2],r=Math.sqrt(e*e+i*i),s=Math.atan2(i,e),o=s*360/2/Math.PI;return o<0&&(o+=360),[t,r,o]},Rt.lchuv=function(n){return ja.lchuv(Rt.luv(n))};var Pi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function za(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Hd={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]};const Wa=za(Hd);var Ya={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function Gd(n){var h,c;var t,e=[],i=1,r;if(typeof n=="number")return{space:"rgb",values:[n>>>16,(n&65280)>>>8,n&255],alpha:1};if(typeof n=="number")return{space:"rgb",values:[n>>>16,(n&65280)>>>8,n&255],alpha:1};if(n=String(n).toLowerCase(),Wa[n])e=Wa[n].slice(),r="rgb";else if(n==="transparent")i=0,r="rgb",e=[0,0,0];else if(n[0]==="#"){var s=n.slice(1),o=s.length,a=o<=4;i=1,a?(e=[parseInt(s[0]+s[0],16),parseInt(s[1]+s[1],16),parseInt(s[2]+s[2],16)],o===4&&(i=parseInt(s[3]+s[3],16)/255)):(e=[parseInt(s[0]+s[1],16),parseInt(s[2]+s[3],16),parseInt(s[4]+s[5],16)],o===8&&(i=parseInt(s[6]+s[7],16)/255)),e[0]||(e[0]=0),e[1]||(e[1]=0),e[2]||(e[2]=0),r="rgb"}else if(t=/^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\s*\(([^\)]*)\)/.exec(n)){var l=t[1];r=l.replace(/a$/,"");var u=r==="cmyk"?4:r==="gray"?1:3;e=t[2].trim().split(/\s*[,\/]\s*|\s+/),r==="color"&&(r=e.shift()),e=e.map(function(d,f){if(d[d.length-1]==="%")return d=parseFloat(d)/100,f===3?d:r==="rgb"?d*255:r[0]==="h"||r[0]==="l"&&!f?d*100:r==="lab"?d*125:r==="lch"?f<2?d*150:d*360:r[0]==="o"&&!f?d:r==="oklab"?d*.4:r==="oklch"?f<2?d*.4:d*360:d;if(r[f]==="h"||f===2&&r[r.length-1]==="h"){if(Ya[d]!==void 0)return Ya[d];if(d.endsWith("deg"))return parseFloat(d);if(d.endsWith("turn"))return parseFloat(d)*360;if(d.endsWith("grad"))return parseFloat(d)*360/400;if(d.endsWith("rad"))return parseFloat(d)*180/Math.PI}return d==="none"?0:parseFloat(d)}),i=e.length>u?e.pop():1}else/[0-9](?:\s|\/|,)/.test(n)&&(e=n.match(/([0-9]+)/g).map(function(d){return parseFloat(d)}),r=((c=(h=n.match(/([a-z])/ig))==null?void 0:h.join(""))==null?void 0:c.toLowerCase())||"rgb");return{space:r,values:e,alpha:i}}const gs={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(n){var t=n[0]/360,e=n[1]/100,i=n[2]/100,r,s,o,a,l,u=0;if(e===0)return l=i*255,[l,l,l];for(s=i<.5?i*(1+e):i+e-i*e,r=2*i-s,a=[0,0,0];u<3;)o=t+1/3*-(u-1),o<0?o++:o>1&&o--,l=6*o<1?r+(s-r)*6*o:2*o<1?s:3*o<2?r+(s-r)*(2/3-o)*6:r,a[u++]=l*255;return a}};$i.hsl=function(n){var t=n[0]/255,e=n[1]/255,i=n[2]/255,r=Math.min(t,e,i),s=Math.max(t,e,i),o=s-r,a,l,u;return s===r?a=0:t===s?a=(e-i)/o:e===s?a=2+(i-t)/o:i===s&&(a=4+(t-e)/o),a=Math.min(a*60,360),a<0&&(a+=360),u=(r+s)/2,s===r?l=0:u<=.5?l=o/(s+r):l=o/(2-s-r),[a,l*100,u*100]};function kd(n){Array.isArray(n)&&n.raw&&(n=String.raw(...arguments)),n instanceof Number&&(n=+n);var t,e=Gd(n);if(!e.space)return[];const i=e.space[0]==="h"?gs.min:$i.min,r=e.space[0]==="h"?gs.max:$i.max;return t=Array(3),t[0]=Math.min(Math.max(e.values[0],i[0]),r[0]),t[1]=Math.min(Math.max(e.values[1],i[1]),r[1]),t[2]=Math.min(Math.max(e.values[2],i[2]),r[2]),e.space[0]==="h"&&(t=gs.rgb(t)),t.push(Math.min(Math.max(e.alpha,0),1)),t}const Vd=1024,Fn={};let ps=0;function Za(n){if(Fn.hasOwnProperty(n))return Fn[n];if(ps>=Vd){let e=0;for(const i in Fn)e++&3||(delete Fn[i],--ps)}const t=kd(n);if(t.length!==4)throw new Error('failed to parse "'+n+'" as color');for(const e of t)if(isNaN(e))throw new Error('failed to parse "'+n+'" as color');return jd(t),Fn[n]=t,++ps,t}function Ka(n){return Array.isArray(n)?n:Za(n)}function jd(n){return n[0]=ft(n[0]+.5|0,0,255),n[1]=ft(n[1]+.5|0,0,255),n[2]=ft(n[2]+.5|0,0,255),n[3]=ft(n[3],0,1),n}let Oe=0;const $t=1<<Oe++,D=1<<Oe++,wt=1<<Oe++,Kt=1<<Oe++,Mi=1<<Oe++,nn=1<<Oe++,Oi=Math.pow(2,Oe)-1,ms={[$t]:"boolean",[D]:"number",[wt]:"string",[Kt]:"color",[Mi]:"number[]",[nn]:"size"},zd=Object.keys(ms).map(Number).sort(Mo);function Wd(n){return n in ms}function rn(n){const t=[];for(const e of zd)Bn(n,e)&&t.push(ms[e]);return t.length===0?"untyped":t.length<3?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t[t.length-1]}function Bn(n,t){return(n&t)===t}function ye(n,t){return n===t}class gt{constructor(t,e){if(!Wd(t))throw new Error(`literal expressions must have a specific type, got ${rn(t)}`);this.type=t,this.value=e}}class qa{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function Yd(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1}}function Et(n,t,e){switch(typeof n){case"boolean":{if(ye(t,wt))return new gt(wt,n?"true":"false");if(!Bn(t,$t))throw new Error(`got a boolean, but expected ${rn(t)}`);return new gt($t,n)}case"number":{if(ye(t,nn))return new gt(nn,Nn(n));if(ye(t,$t))return new gt($t,!!n);if(ye(t,wt))return new gt(wt,n.toString());if(!Bn(t,D))throw new Error(`got a number, but expected ${rn(t)}`);return new gt(D,n)}case"string":{if(ye(t,Kt))return new gt(Kt,Za(n));if(ye(t,$t))return new gt($t,!!n);if(!Bn(t,wt))throw new Error(`got a string, but expected ${rn(t)}`);return new gt(wt,n)}}if(!Array.isArray(n))throw new Error("expression must be an array or a primitive value");if(n.length===0)throw new Error("empty expression");if(typeof n[0]=="string")return af(n,t,e);for(const i of n)if(typeof i!="number")throw new Error("expected an array of numbers");if(ye(t,nn)){if(n.length!==2)throw new Error(`expected an array of two values for a size, got ${n.length}`);return new gt(nn,n)}if(ye(t,Kt)){if(n.length===3)return new gt(Kt,[...n,1]);if(n.length===4)return new gt(Kt,n);throw new Error(`expected an array of 3 or 4 values for a color, got ${n.length}`)}if(!Bn(t,Mi))throw new Error(`got an array of numbers, but expected ${rn(t)}`);return new gt(Mi,n)}const x={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",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"},Zd={[x.Get]:M(N(1,1/0),Kd),[x.Var]:M(N(1,1),qd),[x.Id]:M(Jd,Xn),[x.Concat]:M(N(2,1/0),Y(wt)),[x.GeometryType]:M(Qd,Xn),[x.Resolution]:M(Xn),[x.Zoom]:M(Xn),[x.Time]:M(Xn),[x.Any]:M(N(2,1/0),Y($t)),[x.All]:M(N(2,1/0),Y($t)),[x.Not]:M(N(1,1),Y($t)),[x.Equal]:M(N(2,2),Y(Oi)),[x.NotEqual]:M(N(2,2),Y(Oi)),[x.GreaterThan]:M(N(2,2),Y(D)),[x.GreaterThanOrEqualTo]:M(N(2,2),Y(D)),[x.LessThan]:M(N(2,2),Y(D)),[x.LessThanOrEqualTo]:M(N(2,2),Y(D)),[x.Multiply]:M(N(2,1/0),Ja),[x.Coalesce]:M(N(2,1/0),Ja),[x.Divide]:M(N(2,2),Y(D)),[x.Add]:M(N(2,1/0),Y(D)),[x.Subtract]:M(N(2,2),Y(D)),[x.Clamp]:M(N(3,3),Y(D)),[x.Mod]:M(N(2,2),Y(D)),[x.Pow]:M(N(2,2),Y(D)),[x.Abs]:M(N(1,1),Y(D)),[x.Floor]:M(N(1,1),Y(D)),[x.Ceil]:M(N(1,1),Y(D)),[x.Round]:M(N(1,1),Y(D)),[x.Sin]:M(N(1,1),Y(D)),[x.Cos]:M(N(1,1),Y(D)),[x.Atan]:M(N(1,2),Y(D)),[x.Sqrt]:M(N(1,1),Y(D)),[x.Match]:M(N(4,1/0),Qa,ef),[x.Between]:M(N(3,3),Y(D)),[x.Interpolate]:M(N(6,1/0),Qa,nf),[x.Case]:M(N(3,1/0),tf,rf),[x.In]:M(N(2,2),sf),[x.Number]:M(N(1,1/0),Y(Oi)),[x.String]:M(N(1,1/0),Y(Oi)),[x.Array]:M(N(1,1/0),Y(D)),[x.Color]:M(N(1,4),Y(D)),[x.Band]:M(N(1,3),Y(D)),[x.Palette]:M(N(2,2),of),[x.ToString]:M(N(1,1),Y($t|D|wt|Kt))};function Kd(n,t,e){const i=n.length-1,r=new Array(i);for(let s=0;s<i;++s){const o=n[s+1];switch(typeof o){case"number":{r[s]=new gt(D,o);break}case"string":{r[s]=new gt(wt,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}s===0&&e.properties.add(String(o))}return r}function qd(n,t,e){const i=n[1];if(typeof i!="string")throw new Error("expected a string argument for var operation");return e.variables.add(i),[new gt(wt,i)]}function Jd(n,t,e){e.featureId=!0}function Qd(n,t,e){e.geometryType=!0}function Xn(n,t,e){const i=n[0];if(n.length!==1)throw new Error(`expected no arguments for ${i} operation`);return[]}function N(n,t){return function(e,i,r){const s=e[0],o=e.length-1;if(n===t){if(o!==n){const a=n===1?"":"s";throw new Error(`expected ${n} argument${a} for ${s}, got ${o}`)}}else if(o<n||o>t){const a=t===1/0?`${n} or more`:`${n} to ${t}`;throw new Error(`expected ${a} arguments for ${s}, got ${o}`)}}}function Ja(n,t,e){const i=n.length-1,r=new Array(i);for(let s=0;s<i;++s){const o=Et(n[s+1],t,e);r[s]=o}return r}function Y(n){return function(t,e,i){const r=t.length-1,s=new Array(r);for(let o=0;o<r;++o){const a=Et(t[o+1],n,i);s[o]=a}return s}}function tf(n,t,e){const i=n[0],r=n.length-1;if(r%2===0)throw new Error(`expected an odd number of arguments for ${i}, got ${r} instead`)}function Qa(n,t,e){const i=n[0],r=n.length-1;if(r%2===1)throw new Error(`expected an even number of arguments for operation ${i}, got ${r} instead`)}function ef(n,t,e){const i=n.length-1,r=wt|D|$t,s=Et(n[1],r,e),o=Et(n[n.length-1],t,e),a=new Array(i-2);for(let l=0;l<i-2;l+=2){try{const u=Et(n[l+2],s.type,e);a[l]=u}catch(u){throw new Error(`failed to parse argument ${l+1} of match expression: ${u.message}`)}try{const u=Et(n[l+3],o.type,e);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 nf(n,t,e){const i=n[1];let r;switch(i[0]){case"linear":r=1;break;case"exponential":const l=i[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);r=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(i)}`)}const s=new gt(D,r);let o;try{o=Et(n[2],D,e)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}const a=new Array(n.length-3);for(let l=0;l<a.length;l+=2){try{const u=Et(n[l+3],D,e);a[l]=u}catch(u){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${u.message}`)}try{const u=Et(n[l+4],t,e);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 rf(n,t,e){const i=Et(n[n.length-1],t,e),r=new Array(n.length-1);for(let s=0;s<r.length-1;s+=2){try{const o=Et(n[s+1],$t,e);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{const o=Et(n[s+2],i.type,e);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]=i,r}function sf(n,t,e){let i=n[2];if(!Array.isArray(i))throw new Error('the second argument for the "in" operator must be an array');let r;if(typeof i[0]=="string"){if(i[0]!=="literal")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');if(!Array.isArray(i[1]))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array');i=i[1],r=wt}else r=D;const s=new Array(i.length);for(let a=0;a<s.length;a++)try{const l=Et(i[a],r,e);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[Et(n[1],r,e),...s]}function of(n,t,e){let i;try{i=Et(n[1],D,e)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}const r=n[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=Et(r[o],Kt,e)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof gt))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[i,...s]}function M(...n){return function(t,e,i){const r=t[0];let s;for(let o=0;o<n.length;o++){const a=n[o](t,e,i);if(o==n.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");s=a}}return new qa(e,r,...s)}}function af(n,t,e){const i=n[0],r=Zd[i];if(!r)throw new Error(`unknown operator: ${i}`);return r(n,t,e)}function tl(n){if(!n)return"";const t=n.getType();switch(t){case"Point":case"LineString":case"Polygon":return t;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return t.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return tl(n.getGeometries()[0]);default:return""}}class lf{constructor(t,e){this.name=t,this.data=e,this.texture_=null}getTexture(t){if(!this.texture_){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.data.length/4,1,0,t.RGBA,t.UNSIGNED_BYTE,this.data),this.texture_=e}return this.texture_}delete(t){this.texture_&&t.deleteTexture(this.texture_),this.texture_=null}}function uf(n,t){return`operator_${n}_${Object.keys(t.functions).length}`}function Li(n){const t=n.toString();return t.includes(".")?t:t+".0"}function _s(n){if(n.length<2||n.length>4)throw new Error("`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.");return`vec${n.length}(${n.map(Li).join(", ")})`}function cf(n){const t=Ka(n),e=t.length>3?t[3]:1;return _s([t[0]/255*e,t[1]/255*e,t[2]/255*e,e])}function hf(n){const t=Nn(n);return _s(t)}const ys={};let df=0;function el(n){return n in ys||(ys[n]=df++),ys[n]}function ff(n){return Li(el(n))}function nl(n){return"u_var_"+n}function gf(){return{inFragmentShader:!1,variables:{},properties:{},functions:{},bandCount:0,style:{}}}const Es="getBandValue",il="u_paletteTextures";function pf(n,t,e,i){const r=Et(n,t,e);return bs(r,t,i)}function k(n){return(t,e,i)=>{const r=e.args.length,s=new Array(r);for(let o=0;o<r;++o)s[o]=bs(e.args[o],i,t);return n(s,t)}}const mf={[x.Get]:(n,t)=>{const i=t.args[0].value;return i in n.properties||(n.properties[i]={name:i,type:t.type}),(n.inFragmentShader?"v_prop_":"a_prop_")+i},[x.GeometryType]:(n,t,e)=>{const i="geometryType";return i in n.properties||(n.properties[i]={name:i,type:wt,evaluator:o=>tl(o.getGeometry())}),(n.inFragmentShader?"v_prop_":"a_prop_")+i},[x.Var]:(n,t)=>{const i=t.args[0].value;return i in n.variables||(n.variables[i]={name:i,type:t.type}),nl(i)},[x.Resolution]:()=>"u_resolution",[x.Zoom]:()=>"u_zoom",[x.Time]:()=>"u_time",[x.Any]:k(n=>`(${n.join(" || ")})`),[x.All]:k(n=>`(${n.join(" && ")})`),[x.Not]:k(([n])=>`(!${n})`),[x.Equal]:k(([n,t])=>`(${n} == ${t})`),[x.NotEqual]:k(([n,t])=>`(${n} != ${t})`),[x.GreaterThan]:k(([n,t])=>`(${n} > ${t})`),[x.GreaterThanOrEqualTo]:k(([n,t])=>`(${n} >= ${t})`),[x.LessThan]:k(([n,t])=>`(${n} < ${t})`),[x.LessThanOrEqualTo]:k(([n,t])=>`(${n} <= ${t})`),[x.Multiply]:k(n=>`(${n.join(" * ")})`),[x.Divide]:k(([n,t])=>`(${n} / ${t})`),[x.Add]:k(n=>`(${n.join(" + ")})`),[x.Subtract]:k(([n,t])=>`(${n} - ${t})`),[x.Clamp]:k(([n,t,e])=>`clamp(${n}, ${t}, ${e})`),[x.Mod]:k(([n,t])=>`mod(${n}, ${t})`),[x.Pow]:k(([n,t])=>`pow(${n}, ${t})`),[x.Abs]:k(([n])=>`abs(${n})`),[x.Floor]:k(([n])=>`floor(${n})`),[x.Ceil]:k(([n])=>`ceil(${n})`),[x.Round]:k(([n])=>`floor(${n} + 0.5)`),[x.Sin]:k(([n])=>`sin(${n})`),[x.Cos]:k(([n])=>`cos(${n})`),[x.Atan]:k(([n,t])=>t!==void 0?`atan(${n}, ${t})`:`atan(${n})`),[x.Sqrt]:k(([n])=>`sqrt(${n})`),[x.Match]:k(n=>{const t=n[0],e=n[n.length-1];let i=null;for(let r=n.length-3;r>=1;r-=2){const s=n[r],o=n[r+1];i=`(${t} == ${s} ? ${o} : ${i||e})`}return i}),[x.Between]:k(([n,t,e])=>`(${n} >= ${t} && ${n} <= ${e})`),[x.Interpolate]:k(([n,t,...e])=>{let i="";for(let r=0;r<e.length-2;r+=2){const s=e[r],o=i||e[r+1],a=e[r+2],l=e[r+3];let u;n===Li(1)?u=`(${t} - ${s}) / (${a} - ${s})`:u=`(pow(${n}, (${t} - ${s})) - 1.0) / (pow(${n}, (${a} - ${s})) - 1.0)`,i=`mix(${o}, ${l}, clamp(${u}, 0.0, 1.0))`}return i}),[x.Case]:k(n=>{const t=n[n.length-1];let e=null;for(let i=n.length-3;i>=0;i-=2){const r=n[i],s=n[i+1];e=`(${r} ? ${s} : ${e||t})`}return e}),[x.In]:k(([n,...t],e)=>{const i=uf("in",e),r=[];for(let s=0;s<t.length;s+=1)r.push(` if (inputValue == ${t[s]}) { return true; }`);return e.functions[i]=`bool ${i}(float inputValue) {
71
71
  ${r.join(`
72
72
  `)}
73
73
  return false;
74
- }`,`${n}(${i})`}),[v.Array]:tt(i=>`vec${i.length}(${i.join(", ")})`),[v.Color]:tt(i=>{if(i.length===1)return`vec4(vec3(${i[0]} / 255.0), 1.0)`;if(i.length===2)return`(${i[1]} * vec4(vec3(${i[0]} / 255.0), 1.0))`;const t=i.slice(0,3).map(n=>`${n} / 255.0`);return i.length===3?`vec4(${t.join(", ")}, 1.0)`:`(${i[3]} * vec4(${t.join(", ")}, 1.0))`}),[v.Band]:tt(([i,t,e],n)=>{if(!(ma in n.functions)){let r="";const s=n.bandCount||1;for(let o=0;o<s;o++){const a=Math.floor(o/4);let l=o%4;o===s-1&&l===1&&(l=3);const h=`${W.TILE_TEXTURE_ARRAY}[${a}]`;r+=` if (band == ${o+1}.0) {
75
- return texture2D(${h}, v_textureCoord + vec2(dx, dy))[${l}];
74
+ }`,`${i}(${n})`}),[x.Array]:k(n=>`vec${n.length}(${n.join(", ")})`),[x.Color]:k(n=>{if(n.length===1)return`vec4(vec3(${n[0]} / 255.0), 1.0)`;if(n.length===2)return`(${n[1]} * vec4(vec3(${n[0]} / 255.0), 1.0))`;const t=n.slice(0,3).map(i=>`${i} / 255.0`);return n.length===3?`vec4(${t.join(", ")}, 1.0)`:`(${n[3]} * vec4(${t.join(", ")}, 1.0))`}),[x.Band]:k(([n,t,e],i)=>{if(!(Es in i.functions)){let r="";const s=i.bandCount||1;for(let o=0;o<s;o++){const a=Math.floor(o/4);let l=o%4;o===s-1&&l===1&&(l=3);const u=`${L.TILE_TEXTURE_ARRAY}[${a}]`;r+=` if (band == ${o+1}.0) {
75
+ return texture2D(${u}, v_textureCoord + vec2(dx, dy))[${l}];
76
76
  }
77
- `}n.functions[ma]=`float getBandValue(float band, float xOffset, float yOffset) {
78
- float dx = xOffset / ${W.TEXTURE_PIXEL_WIDTH};
79
- float dy = yOffset / ${W.TEXTURE_PIXEL_HEIGHT};
77
+ `}i.functions[Es]=`float getBandValue(float band, float xOffset, float yOffset) {
78
+ float dx = xOffset / ${L.TEXTURE_PIXEL_WIDTH};
79
+ float dy = yOffset / ${L.TEXTURE_PIXEL_HEIGHT};
80
80
  ${r}
81
- }`}return`${ma}(${i}, ${t??"0.0"}, ${e??"0.0"})`}),[v.Palette]:(i,t)=>{const[e,...n]=t.args,r=n.length,s=new Uint8Array(r*4);for(let h=0;h<n.length;h++){const c=n[h].value,u=bi(c),d=h*4;s[d]=u[0],s[d+1]=u[1],s[d+2]=u[2],s[d+3]=u[3]*255}i.paletteTextures||(i.paletteTextures=[]);const o=`${Ec}[${i.paletteTextures.length}]`,a=new g_(o,s);i.paletteTextures.push(a);const l=ya(e,H,i);return`texture2D(${o}, vec2((${l} + 0.5) / ${r}.0, 0.5))`}};function ya(i,t,e){if(i instanceof gc){const n=v_[i.operator];if(n===void 0)throw new Error(`No compiler defined for this operator: ${JSON.stringify(i.operator)}`);return n(e,i,t)}if((i.type&H)>0)return ns(i.value);if((i.type&Ft)>0)return i.value.toString();if((i.type&Bt)>0)return E_(i.value.toString());if((i.type&te)>0)return __(i.value);if((i.type&ti)>0)return pa(i.value);if((i.type&Ki)>0)return m_(i.value);throw new Error(`Unexpected expression ${i.value} (expected type ${Ji(t)})`)}function Qi(i,t,e){const n=fa();return T_(t,e,n,i)}function xc(i,t){const e=`
82
- attribute vec2 ${ts.TEXTURE_COORD};
83
- uniform mat4 ${W.TILE_TRANSFORM};
84
- uniform float ${W.TEXTURE_PIXEL_WIDTH};
85
- uniform float ${W.TEXTURE_PIXEL_HEIGHT};
86
- uniform float ${W.TEXTURE_RESOLUTION};
87
- uniform float ${W.TEXTURE_ORIGIN_X};
88
- uniform float ${W.TEXTURE_ORIGIN_Y};
89
- uniform float ${W.DEPTH};
81
+ }`}return`${Es}(${n}, ${t??"0.0"}, ${e??"0.0"})`}),[x.Palette]:(n,t)=>{const[e,...i]=t.args,r=i.length,s=new Uint8Array(r*4);for(let u=0;u<i.length;u++){const h=i[u].value,c=Ka(h),d=u*4;s[d]=c[0],s[d+1]=c[1],s[d+2]=c[2],s[d+3]=c[3]*255}n.paletteTextures||(n.paletteTextures=[]);const o=`${il}[${n.paletteTextures.length}]`,a=new lf(o,s);n.paletteTextures.push(a);const l=bs(e,D,n);return`texture2D(${o}, vec2((${l} + 0.5) / ${r}.0, 0.5))`}};function bs(n,t,e){if(n instanceof qa){const i=mf[n.operator];if(i===void 0)throw new Error(`No compiler defined for this operator: ${JSON.stringify(n.operator)}`);return i(e,n,t)}if((n.type&D)>0)return Li(n.value);if((n.type&$t)>0)return n.value.toString();if((n.type&wt)>0)return ff(n.value.toString());if((n.type&Kt)>0)return cf(n.value);if((n.type&Mi)>0)return _s(n.value);if((n.type&nn)>0)return hf(n.value);throw new Error(`Unexpected expression ${n.value} (expected type ${rn(t)})`)}function sn(n,t,e){const i=Yd();return pf(t,e,i,n)}function rl(n,t){const e=`
82
+ attribute vec2 ${Ii.TEXTURE_COORD};
83
+ uniform mat4 ${L.TILE_TRANSFORM};
84
+ uniform float ${L.TEXTURE_PIXEL_WIDTH};
85
+ uniform float ${L.TEXTURE_PIXEL_HEIGHT};
86
+ uniform float ${L.TEXTURE_RESOLUTION};
87
+ uniform float ${L.TEXTURE_ORIGIN_X};
88
+ uniform float ${L.TEXTURE_ORIGIN_Y};
89
+ uniform float ${L.DEPTH};
90
90
 
91
91
  varying vec2 v_textureCoord;
92
92
  varying vec2 v_mapCoord;
93
93
 
94
94
  void main() {
95
- v_textureCoord = ${ts.TEXTURE_COORD};
95
+ v_textureCoord = ${Ii.TEXTURE_COORD};
96
96
  v_mapCoord = vec2(
97
- ${W.TEXTURE_ORIGIN_X} + ${W.TEXTURE_RESOLUTION} * ${W.TEXTURE_PIXEL_WIDTH} * v_textureCoord[0],
98
- ${W.TEXTURE_ORIGIN_Y} - ${W.TEXTURE_RESOLUTION} * ${W.TEXTURE_PIXEL_HEIGHT} * v_textureCoord[1]
97
+ ${L.TEXTURE_ORIGIN_X} + ${L.TEXTURE_RESOLUTION} * ${L.TEXTURE_PIXEL_WIDTH} * v_textureCoord[0],
98
+ ${L.TEXTURE_ORIGIN_Y} - ${L.TEXTURE_RESOLUTION} * ${L.TEXTURE_PIXEL_HEIGHT} * v_textureCoord[1]
99
99
  );
100
- gl_Position = ${W.TILE_TRANSFORM} * vec4(${ts.TEXTURE_COORD}, ${W.DEPTH}, 1.0);
100
+ gl_Position = ${L.TILE_TRANSFORM} * vec4(${Ii.TEXTURE_COORD}, ${L.DEPTH}, 1.0);
101
101
  }
102
- `,n={...x_(),inFragmentShader:!0,bandCount:t,style:i},r=[];if(i.color!==void 0){const u=Qi(n,i.color,te);r.push(`color = ${u};`)}if(i.contrast!==void 0){const u=Qi(n,i.contrast,H);r.push(`color.rgb = clamp((${u} + 1.0) * color.rgb - (${u} / 2.0), vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}if(i.exposure!==void 0){const u=Qi(n,i.exposure,H);r.push(`color.rgb = clamp((${u} + 1.0) * color.rgb, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}if(i.saturation!==void 0){const u=Qi(n,i.saturation,H);r.push(`
103
- float saturation = ${u} + 1.0;
102
+ `,i={...gf(),inFragmentShader:!0,bandCount:t,style:n},r=[];if(n.color!==void 0){const c=sn(i,n.color,Kt);r.push(`color = ${c};`)}if(n.contrast!==void 0){const c=sn(i,n.contrast,D);r.push(`color.rgb = clamp((${c} + 1.0) * color.rgb - (${c} / 2.0), vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}if(n.exposure!==void 0){const c=sn(i,n.exposure,D);r.push(`color.rgb = clamp((${c} + 1.0) * color.rgb, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}if(n.saturation!==void 0){const c=sn(i,n.saturation,D);r.push(`
103
+ float saturation = ${c} + 1.0;
104
104
  float sr = (1.0 - saturation) * 0.2126;
105
105
  float sg = (1.0 - saturation) * 0.7152;
106
106
  float sb = (1.0 - saturation) * 0.0722;
@@ -110,7 +110,7 @@ ${r}
110
110
  sb, sb, sb + saturation
111
111
  );
112
112
  color.rgb = clamp(saturationMatrix * color.rgb, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));
113
- `)}if(i.gamma!==void 0){const u=Qi(n,i.gamma,H);r.push(`color.rgb = pow(color.rgb, vec3(1.0 / ${u}));`)}if(i.brightness!==void 0){const u=Qi(n,i.brightness,H);r.push(`color.rgb = clamp(color.rgb + ${u}, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}const s={},o=Object.keys(n.variables).length;if(o>1&&!i.variables)throw new Error(`Missing variables in style (expected ${n.variables})`);for(let u=0;u<o;++u){const d=n.variables[Object.keys(n.variables)[u]];if(!(d.name in i.variables))throw new Error(`Missing '${d.name}' in style variables`);const f=yc(d.name);s[f]=function(){let g=i.variables[d.name];return typeof g=="string"&&(g=mc(g)),g!==void 0?g:-9999999}}const a=Object.keys(s).map(function(u){return`uniform float ${u};`}),l=Math.ceil(t/4);a.push(`uniform sampler2D ${W.TILE_TEXTURE_ARRAY}[${l}];`),n.paletteTextures&&a.push(`uniform sampler2D ${Ec}[${n.paletteTextures.length}];`);const h=Object.keys(n.functions).map(function(u){return n.functions[u]}),c=`
113
+ `)}if(n.gamma!==void 0){const c=sn(i,n.gamma,D);r.push(`color.rgb = pow(color.rgb, vec3(1.0 / ${c}));`)}if(n.brightness!==void 0){const c=sn(i,n.brightness,D);r.push(`color.rgb = clamp(color.rgb + ${c}, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}const s={},o=Object.keys(i.variables).length;if(o>1&&!n.variables)throw new Error(`Missing variables in style (expected ${i.variables})`);for(let c=0;c<o;++c){const d=i.variables[Object.keys(i.variables)[c]];if(!(d.name in n.variables))throw new Error(`Missing '${d.name}' in style variables`);const f=nl(d.name);s[f]=function(){let g=n.variables[d.name];return typeof g=="string"&&(g=el(g)),g!==void 0?g:-9999999}}const a=Object.keys(s).map(function(c){return`uniform float ${c};`}),l=Math.ceil(t/4);a.push(`uniform sampler2D ${L.TILE_TEXTURE_ARRAY}[${l}];`),i.paletteTextures&&a.push(`uniform sampler2D ${il}[${i.paletteTextures.length}];`);const u=Object.keys(i.functions).map(function(c){return i.functions[c]}),h=`
114
114
  #ifdef GL_FRAGMENT_PRECISION_HIGH
115
115
  precision highp float;
116
116
  #else
@@ -119,85 +119,77 @@ ${r}
119
119
 
120
120
  varying vec2 v_textureCoord;
121
121
  varying vec2 v_mapCoord;
122
- uniform vec4 ${W.RENDER_EXTENT};
123
- uniform float ${W.TRANSITION_ALPHA};
124
- uniform float ${W.TEXTURE_PIXEL_WIDTH};
125
- uniform float ${W.TEXTURE_PIXEL_HEIGHT};
126
- uniform float ${W.RESOLUTION};
127
- uniform float ${W.ZOOM};
122
+ uniform vec4 ${L.RENDER_EXTENT};
123
+ uniform float ${L.TRANSITION_ALPHA};
124
+ uniform float ${L.TEXTURE_PIXEL_WIDTH};
125
+ uniform float ${L.TEXTURE_PIXEL_HEIGHT};
126
+ uniform float ${L.RESOLUTION};
127
+ uniform float ${L.ZOOM};
128
128
 
129
129
  ${a.join(`
130
130
  `)}
131
131
 
132
- ${h.join(`
132
+ ${u.join(`
133
133
  `)}
134
134
 
135
135
  void main() {
136
136
  if (
137
- v_mapCoord[0] < ${W.RENDER_EXTENT}[0] ||
138
- v_mapCoord[1] < ${W.RENDER_EXTENT}[1] ||
139
- v_mapCoord[0] > ${W.RENDER_EXTENT}[2] ||
140
- v_mapCoord[1] > ${W.RENDER_EXTENT}[3]
137
+ v_mapCoord[0] < ${L.RENDER_EXTENT}[0] ||
138
+ v_mapCoord[1] < ${L.RENDER_EXTENT}[1] ||
139
+ v_mapCoord[0] > ${L.RENDER_EXTENT}[2] ||
140
+ v_mapCoord[1] > ${L.RENDER_EXTENT}[3]
141
141
  ) {
142
142
  discard;
143
143
  }
144
144
 
145
- vec4 color = texture2D(${W.TILE_TEXTURE_ARRAY}[0], v_textureCoord);
145
+ vec4 color = texture2D(${L.TILE_TEXTURE_ARRAY}[0], v_textureCoord);
146
146
 
147
147
  ${r.join(`
148
148
  `)}
149
149
 
150
150
  gl_FragColor = color;
151
151
  gl_FragColor.rgb *= gl_FragColor.a;
152
- gl_FragColor *= ${W.TRANSITION_ALPHA};
153
- }`;return{vertexShader:e,fragmentShader:c,uniforms:s,paletteTextures:n.paletteTextures}}class rs extends lp{constructor(t){t=t?Object.assign({},t):{};const e=t.style||{};delete t.style,super(t),this.sources_=t.sources,this.renderedSource_=null,this.renderedResolution_=NaN,this.style_=e,this.styleVariables_=this.style_.variables||{},this.addChangeListener(rt.SOURCE,this.handleSourceUpdate_)}getSources(t,e){const n=this.getSource();return this.sources_?typeof this.sources_=="function"?this.sources_(t,e):this.sources_:n?[n]:[]}getRenderSource(){return this.renderedSource_||this.getSource()}getSourceState(){const t=this.getRenderSource();return t?t.getState():"undefined"}handleSourceUpdate_(){this.hasRenderer()&&this.getRenderer().clearCache(),this.getSource()&&this.setStyle(this.style_)}getSourceBandCount_(){const t=Number.MAX_SAFE_INTEGER,e=this.getSources([-t,-t,t,t],t);return e&&e.length&&"bandCount"in e[0]?e[0].bandCount:4}createRenderer(){const t=xc(this.style_,this.getSourceBandCount_());return new Vp(this,{vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms,cacheSize:this.getCacheSize(),paletteTextures:t.paletteTextures})}renderSources(t,e){const n=this.getRenderer();let r;for(let s=0,o=e.length;s<o;++s)this.renderedSource_=e[s],n.prepareFrame(t)&&(r=n.renderFrame(t));return r}render(t,e){this.rendered=!0;const n=t.viewState,r=this.getSources(t.extent,n.resolution);let s=!0;for(let a=0,l=r.length;a<l;++a){const h=r[a],c=h.getState();if(c=="loading"){const u=()=>{h.getState()=="ready"&&(h.removeEventListener("change",u),this.changed())};h.addEventListener("change",u)}s=s&&c=="ready"}const o=this.renderSources(t,r);if(this.getRenderer().renderComplete&&s)return this.renderedResolution_=n.resolution,o;if(this.renderedResolution_>.5*n.resolution){const a=this.getSources(t.extent,this.renderedResolution_).filter(l=>!r.includes(l));if(a.length>0)return this.renderSources(t,a)}return o}setStyle(t){this.styleVariables_=t.variables||{},this.style_=t;const e=xc(this.style_,this.getSourceBandCount_());this.getRenderer().reset({vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,uniforms:e.uniforms,paletteTextures:e.paletteTextures}),this.changed()}updateStyleVariables(t){Object.assign(this.styleVariables_,t),this.changed()}}rs.prototype.dispose;function Tc(i,t){var n;let e={};for(const r in i){const s=i[r].type;if(s&&s!=="object")e[r]=s==="number"?Number(t[r]):t[r];else if(typeof i[r]=="object"&&((n=i[r])!=null&&n.properties)){const o=Tc(i[r].properties,t);Object.keys(o).length>0&&(e[r]=o)}}return e}function b_(i,t){var s,o,a,l,h;if(!t)return null;let e={},n=i.get("type")==="WebGLTile"||i instanceof rs?(s=i.style_)==null?void 0:s.variables:(o=t.style)==null?void 0:o.variables;if((t.type==="style"||t.style)&&n)e=n;else if((l=(a=i.getSource())==null?void 0:a.getTileUrlFunction)!=null&&l.call(a)){const c=new URL(i.getSource().getTileUrlFunction()([0,0,0]));e=Object.fromEntries(c.searchParams.entries())}else return null;const r=Tc(((h=t.schema)==null?void 0:h.properties)||t.schema,e);return Object.keys(r).length?r:null}const w_=(i,t)=>i==null?void 0:i.filter(e=>["remove","sort"].filter(n=>t!=null&&t.get("layerControlDisable")?n!=="sort":!0).includes(e)),S_=(i,t)=>i==null?void 0:i.filter(e=>{let n=!0;return["remove","sort"].includes(e)&&(n=!1),e==="info"&&(n=t.get("description")),e==="config"&&(n=t.get("layerConfig")),n}),R_=(i,t)=>q`
154
- <button slot="${i}-icon" class="icon">${t?i:at}</button>
155
- `,C_=i=>q`
152
+ gl_FragColor *= ${L.TRANSITION_ALPHA};
153
+ }`;return{vertexShader:e,fragmentShader:h,uniforms:s,paletteTextures:i.paletteTextures}}class sl extends ed{constructor(t){t=t?Object.assign({},t):{};const e=t.style||{};delete t.style,super(t),this.sources_=t.sources,this.renderedSource_=null,this.renderedResolution_=NaN,this.style_=e,this.styleVariables_=this.style_.variables||{},this.addChangeListener(W.SOURCE,this.handleSourceUpdate_)}getSources(t,e){const i=this.getSource();return this.sources_?typeof this.sources_=="function"?this.sources_(t,e):this.sources_:i?[i]:[]}getRenderSource(){return this.renderedSource_||this.getSource()}getSourceState(){const t=this.getRenderSource();return t?t.getState():"undefined"}handleSourceUpdate_(){this.hasRenderer()&&this.getRenderer().clearCache(),this.getSource()&&this.setStyle(this.style_)}getSourceBandCount_(){const t=Number.MAX_SAFE_INTEGER,e=this.getSources([-t,-t,t,t],t);return e&&e.length&&"bandCount"in e[0]?e[0].bandCount:4}createRenderer(){const t=rl(this.style_,this.getSourceBandCount_());return new Xd(this,{vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms,cacheSize:this.getCacheSize(),paletteTextures:t.paletteTextures})}renderSources(t,e){const i=this.getRenderer();let r;for(let s=0,o=e.length;s<o;++s)this.renderedSource_=e[s],i.prepareFrame(t)&&(r=i.renderFrame(t));return r}render(t,e){this.rendered=!0;const i=t.viewState,r=this.getSources(t.extent,i.resolution);let s=!0;for(let a=0,l=r.length;a<l;++a){const u=r[a],h=u.getState();if(h=="loading"){const c=()=>{u.getState()=="ready"&&(u.removeEventListener("change",c),this.changed())};u.addEventListener("change",c)}s=s&&h=="ready"}const o=this.renderSources(t,r);if(this.getRenderer().renderComplete&&s)return this.renderedResolution_=i.resolution,o;if(this.renderedResolution_>.5*i.resolution){const a=this.getSources(t.extent,this.renderedResolution_).filter(l=>!r.includes(l));if(a.length>0)return this.renderSources(t,a)}return o}setStyle(t){this.styleVariables_=t.variables||{},this.style_=t;const e=rl(this.style_,this.getSourceBandCount_());this.getRenderer().reset({vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,uniforms:e.uniforms,paletteTextures:e.paletteTextures}),this.changed()}updateStyleVariables(t){Object.assign(this.styleVariables_,t),this.changed()}}sl.prototype.dispose;const _f=sl;function ol(n,t){var i;let e={};for(const r in n){const s=n[r].type;if(s&&s!=="object")e[r]=s==="number"?Number(t[r]):t[r];else if(typeof n[r]=="object"&&((i=n[r])!=null&&i.properties)){const o=ol(n[r].properties,t);Object.keys(o).length>0&&(e[r]=o)}}return e}function yf(n,t){var s,o,a,l,u;if(!t)return null;let e={},i=n.get("type")==="WebGLTile"||n instanceof _f?(s=n.style_)==null?void 0:s.variables:(o=t.style)==null?void 0:o.variables;if((t.type==="style"||t.style)&&i)e=i;else if((l=(a=n.getSource())==null?void 0:a.getTileUrlFunction)!=null&&l.call(a)){const h=new URL(n.getSource().getTileUrlFunction()([0,0,0]));e=Object.fromEntries(h.searchParams.entries())}else return null;const r=ol(((u=t.schema)==null?void 0:u.properties)||t.schema,e);return Object.keys(r).length?r:null}const Ef=(n,t)=>n==null?void 0:n.filter(e=>["remove","sort"].filter(i=>t!=null&&t.get("layerControlDisable")?i!=="sort":!0).includes(e)),bf=(n,t)=>n==null?void 0:n.filter(e=>{let i=!0;return["remove","sort"].includes(e)&&(i=!1),e==="info"&&(i=t.get("description")),e==="config"&&(i=t.get("layerConfig")),i}),vf=(n,t)=>B`
154
+ <button slot="${n}-icon" class="icon">${t?n:K}</button>
155
+ `,Tf=n=>B`
156
156
  <button
157
157
  class="remove-icon icon"
158
- @click=${()=>{const{layer:t}=i;t==null||t.set("layerControlOptional",!0),t==null||t.setVisible(!1),i.dispatchEvent(new CustomEvent("changed",{detail:t,bubbles:!0}))}}
158
+ @click=${()=>{const{layer:t}=n;t==null||t.set("layerControlOptional",!0),t==null||t.setVisible(!1),n.dispatchEvent(new CustomEvent("changed",{detail:t,bubbles:!0}))}}
159
159
  >
160
- ${i.unstyled?"x":at}
160
+ ${n.unstyled?"x":K}
161
161
  </button>
162
- `,I_=i=>q`
162
+ `,xf=n=>B`
163
163
  <span class="button sort-icon icon drag-handle">
164
- ${i?"═":at}
164
+ ${n?"═":K}
165
165
  </span>
166
- `,vc=i=>{var e;const t=["layerControlHide","layerControlOptional"];return(e=i==null?void 0:i.getArray())==null?void 0:e.filter(n=>t.every(r=>!n.get(r)))};/**
166
+ `,al=n=>{var e;const t=["layerControlHide","layerControlOptional"];return(e=n==null?void 0:n.getArray())==null?void 0:e.filter(i=>t.every(r=>!i.get(r)))};/**
167
167
  * @license
168
168
  * Copyright 2020 Google LLC
169
169
  * SPDX-License-Identifier: BSD-3-Clause
170
- */const bc=to(class extends eo{constructor(i){if(super(i),i.type!==ze.PROPERTY&&i.type!==ze.ATTRIBUTE&&i.type!==ze.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!td(i))throw Error("`live` bindings can only contain a single expression")}render(i){return i}update(i,[t]){if(t===ie||t===at)return t;const e=i.element,n=i.name;if(i.type===ze.PROPERTY){if(t===e[n])return ie}else if(i.type===ze.BOOLEAN_ATTRIBUTE){if(!!t===e.hasAttribute(n))return ie}else if(i.type===ze.ATTRIBUTE&&e.getAttribute(n)===t+"")return ie;return fl(i),t}});/**
170
+ */const ll=ur(class extends cr{constructor(n){if(super(n),n.type!==le.PROPERTY&&n.type!==le.ATTRIBUTE&&n.type!==le.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!Zl(n))throw Error("`live` bindings can only contain a single expression")}render(n){return n}update(n,[t]){if(t===Nt||t===K)return t;const e=n.element,i=n.name;if(n.type===le.PROPERTY){if(t===e[i])return Nt}else if(n.type===le.BOOLEAN_ATTRIBUTE){if(!!t===e.hasAttribute(i))return Nt}else if(n.type===le.ATTRIBUTE&&e.getAttribute(i)===t+"")return Nt;return Ks(n),t}});/**
171
171
  * @license
172
172
  * Copyright 2017 Google LLC
173
173
  * SPDX-License-Identifier: BSD-3-Clause
174
- */class Ea extends eo{constructor(t){if(super(t),this.it=at,t.type!==ze.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===at||t==null)return this._t=void 0,this.it=t;if(t===ie)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}}Ea.directiveName="unsafeHTML",Ea.resultType=1;const A_=to(Ea);/**
174
+ */class vs extends cr{constructor(t){if(super(t),this.it=K,t.type!==le.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===K||t==null)return this._t=void 0,this.it=t;if(t===Nt)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}}vs.directiveName="unsafeHTML",vs.resultType=1;const Rf=ur(vs);/**
175
175
  * @license
176
176
  * Copyright 2021 Google LLC
177
177
  * SPDX-License-Identifier: BSD-3-Clause
178
- */function*ss(i,t){if(i!==void 0){let e=0;for(const n of i)yield t(n,e++)}}const M_=(i,t,e)=>{let n=t;return e.layer.getSource().getTileUrlFunction()&&(n||(n=e.layer.getSource().getTileUrlFunction()),e.layer.getSource().setTileUrlFunction((...r)=>Jd(n(...r),i)),e.layer.getSource().setKey(new Date)),n};function D_(i,t,e,n,r){wc(i,t,e||0,n||i.length-1,r||L_)}function wc(i,t,e,n,r){for(;n>e;){if(n-e>600){var s=n-e+1,o=t-e+1,a=Math.log(s),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1),c=Math.max(e,Math.floor(t-o*l/s+h)),u=Math.min(n,Math.floor(t+(s-o)*l/s+h));wc(i,t,c,u,r)}var d=i[t],f=e,g=n;for(Hn(i,e,t),r(i[n],d)>0&&Hn(i,e,n);f<g;){for(Hn(i,f,g),f++,g--;r(i[f],d)<0;)f++;for(;r(i[g],d)>0;)g--}r(i[e],d)===0?Hn(i,e,g):(g++,Hn(i,g,n)),g<=t&&(e=g+1),t<=g&&(n=g-1)}}function Hn(i,t,e){var n=i[t];i[t]=i[e],i[e]=n}function L_(i,t){return i<t?-1:i>t?1:0}class O_{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const n=[];if(!as(t,e))return n;const r=this.toBBox,s=[];for(;e;){for(let o=0;o<e.children.length;o++){const a=e.children[o],l=e.leaf?r(a):a;as(t,l)&&(e.leaf?n.push(a):Ta(t,l)?this._all(a,n):s.push(a))}e=s.pop()}return n}collides(t){let e=this.data;if(!as(t,e))return!1;const n=[];for(;e;){for(let r=0;r<e.children.length;r++){const s=e.children[r],o=e.leaf?this.toBBox(s):s;if(as(t,o)){if(e.leaf||Ta(t,o))return!0;n.push(s)}}e=n.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let n=0;n<t.length;n++)this.insert(t[n]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=e;else if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const n=this.data;this.data=e,e=n}this._insert(e,this.data.height-e.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=en([]),this}remove(t,e){if(!t)return this;let n=this.data;const r=this.toBBox(t),s=[],o=[];let a,l,h;for(;n||s.length;){if(n||(n=s.pop(),l=s[s.length-1],a=o.pop(),h=!0),n.leaf){const c=P_(t,n.children,e);if(c!==-1)return n.children.splice(c,1),s.push(n),this._condense(s),this}!h&&!n.leaf&&Ta(n,r)?(s.push(n),o.push(a),a=0,l=n,n=n.children[0]):l?(a++,n=l.children[a],h=!1):n=null}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const n=[];for(;t;)t.leaf?e.push(...t.children):n.push(...t.children),t=n.pop();return e}_build(t,e,n,r){const s=n-e+1;let o=this._maxEntries,a;if(s<=o)return a=en(t.slice(e,n+1)),tn(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=en([]),a.leaf=!1,a.height=r;const l=Math.ceil(s/o),h=l*Math.ceil(Math.sqrt(o));Sc(t,e,n,h,this.compareMinX);for(let c=e;c<=n;c+=h){const u=Math.min(c+h-1,n);Sc(t,c,u,l,this.compareMinY);for(let d=c;d<=u;d+=l){const f=Math.min(d+l-1,u);a.children.push(this._build(t,d,f,r-1))}}return tn(a,this.toBBox),a}_chooseSubtree(t,e,n,r){for(;r.push(e),!(e.leaf||r.length-1===n);){let s=1/0,o=1/0,a;for(let l=0;l<e.children.length;l++){const h=e.children[l],c=xa(h),u=k_(t,h)-c;u<o?(o=u,s=c<s?c:s,a=h):u===o&&c<s&&(s=c,a=h)}e=a||e.children[0]}return e}_insert(t,e,n){const r=n?t:this.toBBox(t),s=[],o=this._chooseSubtree(r,this.data,e,s);for(o.children.push(t),Vn(o,r);e>=0&&s[e].children.length>this._maxEntries;)this._split(s,e),e--;this._adjustParentBBoxes(r,s,e)}_split(t,e){const n=t[e],r=n.children.length,s=this._minEntries;this._chooseSplitAxis(n,s,r);const o=this._chooseSplitIndex(n,s,r),a=en(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,tn(n,this.toBBox),tn(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(n,a)}_splitRoot(t,e){this.data=en([t,e]),this.data.height=t.height+1,this.data.leaf=!1,tn(this.data,this.toBBox)}_chooseSplitIndex(t,e,n){let r,s=1/0,o=1/0;for(let a=e;a<=n-e;a++){const l=zn(t,0,a,this.toBBox),h=zn(t,a,n,this.toBBox),c=F_(l,h),u=xa(l)+xa(h);c<s?(s=c,r=a,o=u<o?u:o):c===s&&u<o&&(o=u,r=a)}return r||n-e}_chooseSplitAxis(t,e,n){const r=t.leaf?this.compareMinX:$_,s=t.leaf?this.compareMinY:N_,o=this._allDistMargin(t,e,n,r),a=this._allDistMargin(t,e,n,s);o<a&&t.children.sort(r)}_allDistMargin(t,e,n,r){t.children.sort(r);const s=this.toBBox,o=zn(t,0,e,s),a=zn(t,n-e,n,s);let l=os(o)+os(a);for(let h=e;h<n-e;h++){const c=t.children[h];Vn(o,t.leaf?s(c):c),l+=os(o)}for(let h=n-e-1;h>=e;h--){const c=t.children[h];Vn(a,t.leaf?s(c):c),l+=os(a)}return l}_adjustParentBBoxes(t,e,n){for(let r=n;r>=0;r--)Vn(e[r],t)}_condense(t){for(let e=t.length-1,n;e>=0;e--)t[e].children.length===0?e>0?(n=t[e-1].children,n.splice(n.indexOf(t[e]),1)):this.clear():tn(t[e],this.toBBox)}}function P_(i,t,e){if(!e)return t.indexOf(i);for(let n=0;n<t.length;n++)if(e(i,t[n]))return n;return-1}function tn(i,t){zn(i,0,i.children.length,t,i)}function zn(i,t,e,n,r){r||(r=en(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=t;s<e;s++){const o=i.children[s];Vn(r,i.leaf?n(o):o)}return r}function Vn(i,t){return i.minX=Math.min(i.minX,t.minX),i.minY=Math.min(i.minY,t.minY),i.maxX=Math.max(i.maxX,t.maxX),i.maxY=Math.max(i.maxY,t.maxY),i}function $_(i,t){return i.minX-t.minX}function N_(i,t){return i.minY-t.minY}function xa(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function os(i){return i.maxX-i.minX+(i.maxY-i.minY)}function k_(i,t){return(Math.max(t.maxX,i.maxX)-Math.min(t.minX,i.minX))*(Math.max(t.maxY,i.maxY)-Math.min(t.minY,i.minY))}function F_(i,t){const e=Math.max(i.minX,t.minX),n=Math.max(i.minY,t.minY),r=Math.min(i.maxX,t.maxX),s=Math.min(i.maxY,t.maxY);return Math.max(0,r-e)*Math.max(0,s-n)}function Ta(i,t){return i.minX<=t.minX&&i.minY<=t.minY&&t.maxX<=i.maxX&&t.maxY<=i.maxY}function as(i,t){return t.minX<=i.maxX&&t.minY<=i.maxY&&t.maxX>=i.minX&&t.maxY>=i.minY}function en(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Sc(i,t,e,n,r){const s=[t,e];for(;s.length;){if(e=s.pop(),t=s.pop(),e-t<=n)continue;const o=t+Math.ceil((e-t)/n/2)*n;D_(i,o,t,e,r),s.push(t,o,o,e)}}class ls{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=Te(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new ls({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return nt()}getImage(t){return nt()}getHitDetectionImage(){return nt()}getPixelRatio(t){return 1}getImageState(){return nt()}getImageSize(){return nt()}getOrigin(){return nt()}getSize(){return nt()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=Te(t)}listenImageChange(t){nt()}load(){nt()}unlistenImageChange(t){nt()}ready(){return Promise.resolve()}}class B_{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=32}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const n=this.cache_[e];!(t++&3)&&!n.hasListener()&&(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,n){const r=va(t,e,n);return r in this.cache_?this.cache_[r]:null}getPattern(t,e,n){const r=va(t,e,n);return r in this.patternCache_?this.patternCache_[r]:null}set(t,e,n,r,s){const o=va(t,e,n),a=o in this.cache_;this.cache_[o]=r,s&&(r.getImageState()===V.IDLE&&r.load(),r.getImageState()===V.LOADING?r.ready().then(()=>{this.patternCache_[o]=Zr().createPattern(r.getImage(1),"repeat")}):this.patternCache_[o]=Zr().createPattern(r.getImage(1),"repeat")),a||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function va(i,t,e){const n=e?bi(e):"null";return t+":"+i+":"+n}const ii=new B_;let Yn=null;class U_ extends Or{constructor(t,e,n,r,s){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=n,this.canvas_={},this.color_=s,this.imageState_=r===void 0?V.IDLE:r,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===V.LOADED){Yn||(Yn=Et(1,1,void 0,{willReadFrequently:!0})),Yn.drawImage(this.image_,0,0);try{Yn.getImageData(0,0,1,1),this.tainted_=!1}catch{Yn=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(wt.CHANGE)}handleImageError_(){this.imageState_=V.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=V.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],n=Et(t,e);n.fillRect(0,0,t,e),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===V.IDLE){this.image_||this.initializeImage_(),this.imageState_=V.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&mp(this.image_,this.src_).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==V.LOADED)return;const e=this.image_,n=document.createElement("canvas");n.width=Math.ceil(e.width*t),n.height=Math.ceil(e.height*t);const r=n.getContext("2d");r.scale(t,t),r.drawImage(e,0,0),r.globalCompositeOperation="multiply",r.fillStyle=qp(this.color_),r.fillRect(0,0,n.width/t,n.height/t),r.globalCompositeOperation="destination-in",r.drawImage(e,0,0),this.canvas_[t]=n}ready(){return this.ready_||(this.ready_=new Promise(t=>{this.imageState_===V.LOADED||this.imageState_===V.ERROR?t():this.addEventListener(wt.CHANGE,function e(){(this.imageState_===V.LOADED||this.imageState_===V.ERROR)&&(this.removeEventListener(wt.CHANGE,e),t())})})),this.ready_}}function ba(i,t,e,n,r,s){let o=t===void 0?void 0:ii.get(t,e,r);return o||(o=new U_(i,i&&"src"in i?i.src||void 0:t,e,n,r),ii.set(t,e,r,o,s)),s&&o&&!ii.getPattern(t,e,r)&&ii.set(t,e,r,o,s),o}function ve(i){return i?Array.isArray(i)?ua(i):typeof i=="object"&&"src"in i?X_(i):i:null}function X_(i){if(!i.offset||!i.size)return ii.getPattern(i.src,"anonymous",i.color);const t=i.src+":"+i.offset,e=ii.getPattern(t,void 0,i.color);if(e)return e;const n=ii.get(i.src,"anonymous",null);if(n.getImageState()!==V.LOADED)return null;const r=Et(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]),ba(r.canvas,t,void 0,V.LOADED,i.color,!0),ii.getPattern(t,void 0,i.color)}const G_=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z]+?)\\s*$`].join(""),"i"),Rc=["style","variant","weight","size","lineHeight","family"],Cc=function(i){const t=i.match(G_);if(!t)return null;const e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let n=0,r=Rc.length;n<r;++n){const s=t[n+1];s!==void 0&&(e[Rc[n]]=s)}return e.families=e.family.split(/,\s?/),e},Ic="10px sans-serif",zt="#000",nn="round",Oe=[],Pe=0,rn="round",jn=10,Zn="#000",qn="center",hs="middle",Si=[0,0,0,0],Kn=1,ni=new $r;let sn=null,wa;const Sa={},W_=function(){const t="32px ",e=["monospace","serif"],n=e.length,r="wmytzilWMYTZIL@#/&?$%10";let s,o;function a(h,c,u){let d=!0;for(let f=0;f<n;++f){const g=e[f];if(o=cs(h+" "+c+" "+t+g,r),u!=g){const p=cs(h+" "+c+" "+t+u+","+g,r);d=d&&p!=o}}return!!d}function l(){let h=!0;const c=ni.getKeys();for(let u=0,d=c.length;u<d;++u){const f=c[u];ni.get(f)<100&&(a.apply(this,f.split(`
179
- `))?(Lr(Sa),sn=null,wa=void 0,ni.set(f,100)):(ni.set(f,ni.get(f)+1,!0),h=!1))}h&&(clearInterval(s),s=void 0)}return function(h){const c=Cc(h);if(!c)return;const u=c.families;for(let d=0,f=u.length;d<f;++d){const g=u[d],p=c.style+`
180
- `+c.weight+`
181
- `+g;ni.get(p)===void 0&&(ni.set(p,100,!0),a(c.style,c.weight,g)||(ni.set(p,0,!0),s===void 0&&(s=setInterval(l,32))))}}}(),H_=function(){let i;return function(t){let e=Sa[t];if(e==null){if($h){const n=Cc(t),r=Ac(t,"Žg");e=(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=t,document.body.appendChild(i),e=i.offsetHeight,document.body.removeChild(i);Sa[t]=e}return e}}();function Ac(i,t){return sn||(sn=Et(1,1)),i!=wa&&(sn.font=i,wa=sn.font),sn.measureText(t)}function cs(i,t){return Ac(i,t).width}function Mc(i,t,e){if(t in e)return e[t];const n=t.split(`
182
- `).reduce((r,s)=>Math.max(r,cs(i,s)),0);return e[t]=n,n}function z_(i,t){const e=[],n=[],r=[];let s=0,o=0,a=0,l=0;for(let h=0,c=t.length;h<=c;h+=2){const u=t[h];if(u===`
183
- `||h===c){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}const d=t[h+1]||i.font,f=cs(d,u);e.push(f),o+=f;const g=H_(d);n.push(g),l=Math.max(l,g)}return{width:s,height:a,widths:e,heights:n,lineWidths:r}}function V_(i,t,e,n,r,s,o,a,l,h,c){i.save(),e!==1&&(i.globalAlpha===void 0?i.globalAlpha=u=>u.globalAlpha*=e:i.globalAlpha*=e),t&&i.transform.apply(i,t),n.contextInstructions?(i.translate(l,h),i.scale(c[0],c[1]),Y_(n,i)):c[0]<0||c[1]<0?(i.translate(l,h),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,h,o*c[0],a*c[1]),i.restore()}function Y_(i,t){const e=i.contextInstructions;for(let n=0,r=e.length;n<r;n+=2)Array.isArray(e[n+1])?t[e[n]].apply(t,e[n+1]):t[e[n]]=e[n+1]}class us extends ls{constructor(t){super({opacity:1,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,rotation:t.rotation!==void 0?t.rotation:0,scale:t.scale!==void 0?t.scale:1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode}),this.canvases_,this.hitDetectionCanvas_=null,this.fill_=t.fill!==void 0?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius_=t.radius,this.radius2_=t.radius2,this.angle_=t.angle!==void 0?t.angle:0,this.stroke_=t.stroke!==void 0?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?V.LOADING:V.LOADED,this.imageState_===V.LOADING&&this.ready().then(()=>this.imageState_=V.LOADED),this.render()}clone(){const t=this.getScale(),e=new us({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),n=this.getScaleArray();return[t[0]/2-e[0]/n[0],t[1]/2+e[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){let e=this.canvases_[t];if(!e){const n=this.renderOptions_,r=Et(n.size*t,n.size*t);this.draw_(n,r,t),e=r.canvas,this.canvases_[t]=e}return e}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius_}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,n){if(e===0||this.points_===1/0||t!=="bevel"&&t!=="miter")return e;let r=this.radius_,s=this.radius2_===void 0?r:this.radius2_;if(r<s){const b=r;r=s,s=b}const o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=s*Math.sin(a),h=Math.sqrt(s*s-l*l),c=r-h,u=Math.sqrt(l*l+c*c),d=u/l;if(t==="miter"&&d<=n)return d*e;const f=e/2/d,g=e/2*(c/u),_=Math.sqrt((r+f)*(r+f)+g*g)-r;if(this.radius2_===void 0||t==="bevel")return _*2;const y=r*Math.sin(a),m=Math.sqrt(r*r-y*y),x=s-m,T=Math.sqrt(y*y+x*x)/y;if(T<=n){const b=T*e/2-s-r;return 2*Math.max(_,b)}return _*2}createRenderOptions(){let t=nn,e=rn,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=ve(this.stroke_.getColor()??Zn),a=this.stroke_.getWidth()??Kn,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,e=this.stroke_.getLineJoin()??rn,t=this.stroke_.getLineCap()??nn,n=this.stroke_.getMiterLimit()??jn);const l=this.calculateLineJoinSize_(e,a,n),h=Math.max(this.radius_,this.radius2_||0),c=Math.ceil(2*h+l);return{strokeStyle:o,strokeWidth:a,size:c,lineCap:t,lineDash:r,lineDashOffset:s,lineJoin:e,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.canvases_={},this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,n){if(e.scale(n,n),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let r=this.fill_.getColor();r===null&&(r=zt),e.fillStyle=ve(r),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let n=this.fill_.getColor(),r=0;typeof n=="string"&&(n=bi(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(e=Et(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const n=this.radius_;if(e===1/0)t.arc(0,0,n,0,2*Math.PI);else{const r=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(e*=2);const s=this.angle_-Math.PI/2,o=2*Math.PI/e;for(let a=0;a<e;a++){const l=s+a*o,h=a%2===0?n:r;t.lineTo(h*Math.cos(l),h*Math.sin(l))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=zt,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}class ds extends us{constructor(t){t=t||{radius:5},super({points:1/0,fill:t.fill,radius:t.radius,stroke:t.stroke,scale:t.scale!==void 0?t.scale:1,rotation:t.rotation!==void 0?t.rotation:0,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){const t=this.getScale(),e=new ds({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}setRadius(t){this.radius_=t,this.render()}}class Jn{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,t.color!==void 0&&this.setColor(t.color)}clone(){const t=this.getColor();return new Jn({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(t!==null&&typeof t=="object"&&"src"in t){const e=ba(null,t.src,"anonymous",void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===V.IDLE&&e.load(),e.getImageState()===V.LOADING&&(this.patternImage_=e)}this.color_=t}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}class fs{constructor(t){t=t||{},this.color_=t.color!==void 0?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=t.lineDash!==void 0?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.width_=t.width}clone(){const t=this.getColor();return new fs({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setWidth(t){this.width_=t}}class gs{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=Lc,t.geometry!==void 0&&this.setGeometry(t.geometry),this.fill_=t.fill!==void 0?t.fill:null,this.image_=t.image!==void 0?t.image:null,this.renderer_=t.renderer!==void 0?t.renderer:null,this.hitDetectionRenderer_=t.hitDetectionRenderer!==void 0?t.hitDetectionRenderer:null,this.stroke_=t.stroke!==void 0?t.stroke:null,this.text_=t.text!==void 0?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&typeof t=="object"&&(t=t.clone()),new gs({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){typeof t=="function"?this.geometryFunction_=t:typeof t=="string"?this.geometryFunction_=function(e){return e.get(t)}:t?t!==void 0&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=Lc,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function j_(i){let t;if(typeof i=="function")t=i;else{let e;Array.isArray(i)?e=i:(Lt(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),e=[i]),t=function(){return e}}return t}let Ra=null;function Dc(i,t){if(!Ra){const e=new Jn({color:"rgba(255,255,255,0.4)"}),n=new fs({color:"#3399CC",width:1.25});Ra=[new gs({image:new ds({fill:e,stroke:n,radius:5}),fill:e,stroke:n})]}return Ra}function Lc(i){return i.getGeometry()}const ps=gs;function Oc(i,t,e,n){return e!==void 0&&n!==void 0?[e/i,n/t]:e!==void 0?e/i:n!==void 0?n/t:1}class _s extends ls{constructor(t){t=t||{};const e=t.opacity!==void 0?t.opacity:1,n=t.rotation!==void 0?t.rotation:0,r=t.scale!==void 0?t.scale:1,s=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:e,rotation:n,scale:r,displacement:t.displacement!==void 0?t.displacement:[0,0],rotateWithView:s,declutterMode:t.declutterMode}),this.anchor_=t.anchor!==void 0?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=t.anchorOrigin!==void 0?t.anchorOrigin:"top-left",this.anchorXUnits_=t.anchorXUnits!==void 0?t.anchorXUnits:"fraction",this.anchorYUnits_=t.anchorYUnits!==void 0?t.anchorYUnits:"fraction",this.crossOrigin_=t.crossOrigin!==void 0?t.crossOrigin:null;const o=t.img!==void 0?t.img:null;let a=t.src;Lt(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||kt(o)),Lt(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),Lt(!((t.width!==void 0||t.height!==void 0)&&t.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(t.src!==void 0?l=V.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?V.LOADED:V.IDLE:l=V.LOADING:l=V.LOADED),this.color_=t.color!==void 0?bi(t.color):null,this.iconImage_=ba(o,a,this.crossOrigin_,l,this.color_),this.offset_=t.offset!==void 0?t.offset:[0,0],this.offsetOrigin_=t.offsetOrigin!==void 0?t.offsetOrigin:"top-left",this.origin_=null,this.size_=t.size!==void 0?t.size:null,t.width!==void 0||t.height!==void 0){let h,c;if(t.size)[h,c]=t.size;else{const u=this.getImage(1);if(u.width&&u.height)h=u.width,c=u.height;else if(u instanceof HTMLImageElement){this.initialOptions_=t;const d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;const f=this.iconImage_.getSize();this.setScale(Oc(f[0],f[1],t.width,t.height))};this.listenImageChange(d);return}}h!==void 0&&this.setScale(Oc(h,c,t.width,t.height))}}clone(){let t,e,n;return this.initialOptions_?(e=this.initialOptions_.width,n=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new _s({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const r=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!r)return null;t=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(t[0]*=r[0]),this.anchorYUnits_=="fraction"&&(t[1]*=r[1])}if(this.anchorOrigin_!="top-left"){if(!r)return null;t===this.anchor_&&(t=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(t[0]=-t[0]+r[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(t[1]=-t[1]+r[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),n=this.getScaleArray();return[t[0]-e[0]/n[0],t[1]+e[1]/n[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if(this.offsetOrigin_!="top-left"){const e=this.getSize(),n=this.iconImage_.getSize();if(!e||!n)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=n[0]-e[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(t[1]=n[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();if(this.size_)return this.size_[0]*t[0];if(this.iconImage_.getImageState()==V.LOADED)return this.iconImage_.getSize()[0]*t[0]}getHeight(){const t=this.getScaleArray();if(this.size_)return this.size_[1]*t[1];if(this.iconImage_.getImageState()==V.LOADED)return this.iconImage_.getSize()[1]*t[1]}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(wt.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(wt.CHANGE,t)}ready(){return this.iconImage_.ready()}}const Z_="#333";class Ca{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.scale_=t.scale,this.scaleArray_=Te(t.scale!==void 0?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=t.fill!==void 0?t.fill:new Jn({color:Z_}),this.maxAngle_=t.maxAngle!==void 0?t.maxAngle:Math.PI/4,this.placement_=t.placement!==void 0?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=t.stroke!==void 0?t.stroke:null,this.offsetX_=t.offsetX!==void 0?t.offsetX:0,this.offsetY_=t.offsetY!==void 0?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=t.padding===void 0?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new Ca({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,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_}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(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=Te(t!==void 0?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}function Pc(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function $e(i,t,e){const n=It(i,t,e);return pe(n)}function pe(i,t){if(i instanceof St){if(i.type===te&&typeof i.value=="string"){const n=ca(i.value);return function(){return n}}return function(){return i.value}}const e=i.operator;switch(e){case v.Number:case v.String:case v.Coalesce:return q_(i);case v.Get:case v.Var:return K_(i);case v.Id:return n=>n.featureId;case v.GeometryType:return n=>n.geometryType;case v.Concat:{const n=i.args.map(r=>pe(r));return r=>"".concat(...n.map(s=>s(r).toString()))}case v.Resolution:return n=>n.resolution;case v.Any:case v.All:case v.Between:case v.In:case v.Not:return Q_(i);case v.Equal:case v.NotEqual:case v.LessThan:case v.LessThanOrEqualTo:case v.GreaterThan:case v.GreaterThanOrEqualTo:return J_(i);case v.Multiply:case v.Divide:case v.Add:case v.Subtract:case v.Clamp:case v.Mod:case v.Pow:case v.Abs:case v.Floor:case v.Ceil:case v.Round:case v.Sin:case v.Cos:case v.Atan:case v.Sqrt:return tm(i);case v.Case:return em(i);case v.Match:return im(i);case v.Interpolate:return nm(i);case v.ToString:return rm(i);default:throw new Error(`Unsupported operator ${e}`)}}function q_(i,t){const e=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=pe(i.args[s]);switch(e){case v.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 v.Number:case v.String:return s=>{for(let o=0;o<n;++o){const a=r[o](s);if(typeof a===e)return a}throw new Error(`Expected one of the values to be a ${e}`)};default:throw new Error(`Unsupported assertion operator ${e}`)}}function K_(i,t){const n=i.args[0].value;switch(i.operator){case v.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 v.Var:return r=>r.variables[n];default:throw new Error(`Unsupported accessor operator ${i.operator}`)}}function J_(i,t){const e=i.operator,n=pe(i.args[0]),r=pe(i.args[1]);switch(e){case v.Equal:return s=>n(s)===r(s);case v.NotEqual:return s=>n(s)!==r(s);case v.LessThan:return s=>n(s)<r(s);case v.LessThanOrEqualTo:return s=>n(s)<=r(s);case v.GreaterThan:return s=>n(s)>r(s);case v.GreaterThanOrEqualTo:return s=>n(s)>=r(s);default:throw new Error(`Unsupported comparison operator ${e}`)}}function Q_(i,t){const e=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=pe(i.args[s]);switch(e){case v.Any:return s=>{for(let o=0;o<n;++o)if(r[o](s))return!0;return!1};case v.All:return s=>{for(let o=0;o<n;++o)if(!r[o](s))return!1;return!0};case v.Between:return s=>{const o=r[0](s),a=r[1](s),l=r[2](s);return o>=a&&o<=l};case v.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 v.Not:return s=>!r[0](s);default:throw new Error(`Unsupported logical operator ${e}`)}}function tm(i,t){const e=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=pe(i.args[s]);switch(e){case v.Multiply:return s=>{let o=1;for(let a=0;a<n;++a)o*=r[a](s);return o};case v.Divide:return s=>r[0](s)/r[1](s);case v.Add:return s=>{let o=0;for(let a=0;a<n;++a)o+=r[a](s);return o};case v.Subtract:return s=>r[0](s)-r[1](s);case v.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 v.Mod:return s=>r[0](s)%r[1](s);case v.Pow:return s=>Math.pow(r[0](s),r[1](s));case v.Abs:return s=>Math.abs(r[0](s));case v.Floor:return s=>Math.floor(r[0](s));case v.Ceil:return s=>Math.ceil(r[0](s));case v.Round:return s=>Math.round(r[0](s));case v.Sin:return s=>Math.sin(r[0](s));case v.Cos:return s=>Math.cos(r[0](s));case v.Atan:return n===2?s=>Math.atan2(r[0](s),r[1](s)):s=>Math.atan(r[0](s));case v.Sqrt:return s=>Math.sqrt(r[0](s));default:throw new Error(`Unsupported numeric operator ${e}`)}}function em(i,t){const e=i.args.length,n=new Array(e);for(let r=0;r<e;++r)n[r]=pe(i.args[r]);return r=>{for(let s=0;s<e-1;s+=2)if(n[s](r))return n[s+1](r);return n[e-1](r)}}function im(i,t){const e=i.args.length,n=new Array(e);for(let r=0;r<e;++r)n[r]=pe(i.args[r]);return r=>{const s=n[0](r);for(let o=1;o<e;o+=2)if(s===n[o](r))return n[o+1](r);return n[e-1](r)}}function nm(i,t){const e=i.args.length,n=new Array(e);for(let r=0;r<e;++r)n[r]=pe(i.args[r]);return r=>{const s=n[0](r),o=n[1](r);let a,l;for(let h=2;h<e;h+=2){const c=n[h](r);let u=n[h+1](r);const d=Array.isArray(u);if(d&&(u=Jp(u)),c>=o)return h===2?u:d?sm(s,o,a,l,c,u):Qn(s,o,a,l,c,u);a=c,l=u}return l}}function rm(i,t){const e=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=pe(i.args[s]);switch(e){case v.ToString:return s=>{const o=r[0](s);return i.args[0].type===te?ua(o):o.toString()};default:throw new Error(`Unsupported convert operator ${e}`)}}function Qn(i,t,e,n,r,s){const o=r-e;if(o===0)return n;const a=t-e,l=i===1?a/o:(Math.pow(i,a)-1)/(Math.pow(i,o)-1);return n+l*(s-n)}function sm(i,t,e,n,r,s){if(r-e===0)return n;const a=dc(n),l=dc(s);let h=l[2]-a[2];h>180?h-=360:h<-180&&(h+=360);const c=[Qn(i,t,e,a[0],r,l[0]),Qn(i,t,e,a[1],r,l[1]),a[2]+Qn(i,t,e,0,r,h),Qn(i,t,e,n[3],r,s[3])];return fc(Qp(c))}function om(i){return!0}function am(i){const t=fa(),e=lm(i,t),n=Pc();return function(r,s){if(n.properties=r.getPropertiesInternal(),n.resolution=s,t.featureId){const o=r.getId();o!==void 0?n.featureId=o:n.featureId=null}return t.geometryType&&(n.geometryType=ga(r.getGeometry())),e(n)}}function $c(i){const t=fa(),e=i.length,n=new Array(e);for(let o=0;o<e;++o)n[o]=Ia(i[o],t);const r=Pc(),s=new Array(e);return function(o,a){if(r.properties=o.getPropertiesInternal(),r.resolution=a,t.featureId){const h=o.getId();h!==void 0?r.featureId=h:r.featureId=null}let l=0;for(let h=0;h<e;++h){const c=n[h](r);c&&(s[l]=c,l+=1)}return s.length=l,s}}function lm(i,t){const e=i.length,n=new Array(e);for(let r=0;r<e;++r){const s=i[r],o="filter"in s?$e(s.filter,Ft,t):om;let a;if(Array.isArray(s.style)){const l=s.style.length;a=new Array(l);for(let h=0;h<l;++h)a[h]=Ia(s.style[h],t)}else a=[Ia(s.style,t)];n[r]={filter:o,styles:a}}return function(r){const s=[];let o=!1;for(let a=0;a<e;++a){const l=n[a].filter;if(l(r)&&!(i[a].else&&o)){o=!0;for(const h of n[a].styles){const c=h(r);c&&s.push(c)}}}return s}}function Ia(i,t){const e=tr(i,"",t),n=er(i,"",t),r=hm(i,t),s=cm(i,t),o=Vt(i,"z-index",t);if(!e&&!n&&!r&&!s&&!Co(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));const a=new ps;return function(l){let h=!0;if(e){const c=e(l);c&&(h=!1),a.setFill(c)}if(n){const c=n(l);c&&(h=!1),a.setStroke(c)}if(r){const c=r(l);c&&(h=!1),a.setText(c)}if(s){const c=s(l);c&&(h=!1),a.setImage(c)}return o&&a.setZIndex(o(l)),h?null:a}}function tr(i,t,e){let n;if(t+"fill-pattern-src"in i)n=gm(i,t+"fill-",e);else{if(i[t+"fill-color"]==="none")return s=>null;n=Aa(i,t+"fill-color",e)}if(!n)return null;const r=new Jn;return function(s){const o=n(s);return o==="none"?null:(r.setColor(o),r)}}function er(i,t,e){const n=Vt(i,t+"stroke-width",e),r=Aa(i,t+"stroke-color",e);if(!n&&!r)return null;const s=Ne(i,t+"stroke-line-cap",e),o=Ne(i,t+"stroke-line-join",e),a=Nc(i,t+"stroke-line-dash",e),l=Vt(i,t+"stroke-line-dash-offset",e),h=Vt(i,t+"stroke-miter-limit",e),c=new fs;return function(u){if(r){const d=r(u);if(d==="none")return null;c.setColor(d)}if(n&&c.setWidth(n(u)),s){const d=s(u);if(d!=="butt"&&d!=="round"&&d!=="square")throw new Error("Expected butt, round, or square line cap");c.setLineCap(d)}if(o){const d=o(u);if(d!=="bevel"&&d!=="round"&&d!=="miter")throw new Error("Expected bevel, round, or miter line join");c.setLineJoin(d)}return a&&c.setLineDash(a(u)),l&&c.setLineDashOffset(l(u)),h&&c.setMiterLimit(h(u)),c}}function hm(i,t){const e="text-",n=Ne(i,e+"value",t);if(!n)return null;const r=tr(i,e,t),s=tr(i,e+"background-",t),o=er(i,e,t),a=er(i,e+"background-",t),l=Ne(i,e+"font",t),h=Vt(i,e+"max-angle",t),c=Vt(i,e+"offset-x",t),u=Vt(i,e+"offset-y",t),d=ir(i,e+"overflow",t),f=Ne(i,e+"placement",t),g=Vt(i,e+"repeat",t),p=ys(i,e+"scale",t),_=ir(i,e+"rotate-with-view",t),y=Vt(i,e+"rotation",t),m=Ne(i,e+"align",t),x=Ne(i,e+"justify",t),E=Ne(i,e+"baseline",t),T=Nc(i,e+"padding",t),b=xs(i,e+"declutter-mode"),w=new Ca({declutterMode:b});return function(S){if(w.setText(n(S)),r&&w.setFill(r(S)),s&&w.setBackgroundFill(s(S)),o&&w.setStroke(o(S)),a&&w.setBackgroundStroke(a(S)),l&&w.setFont(l(S)),h&&w.setMaxAngle(h(S)),c&&w.setOffsetX(c(S)),u&&w.setOffsetY(u(S)),d&&w.setOverflow(d(S)),f){const R=f(S);if(R!=="point"&&R!=="line")throw new Error("Expected point or line for text-placement");w.setPlacement(R)}if(g&&w.setRepeat(g(S)),p&&w.setScale(p(S)),_&&w.setRotateWithView(_(S)),y&&w.setRotation(y(S)),m){const R=m(S);if(R!=="left"&&R!=="center"&&R!=="right"&&R!=="end"&&R!=="start")throw new Error("Expected left, right, center, start, or end for text-align");w.setTextAlign(R)}if(x){const R=x(S);if(R!=="left"&&R!=="right"&&R!=="center")throw new Error("Expected left, right, or center for text-justify");w.setJustify(R)}if(E){const R=E(S);if(R!=="bottom"&&R!=="top"&&R!=="middle"&&R!=="alphabetic"&&R!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");w.setTextBaseline(R)}return T&&w.setPadding(T(S)),w}}function cm(i,t){return"icon-src"in i?um(i,t):"shape-points"in i?dm(i,t):"circle-radius"in i?fm(i,t):null}function um(i,t){const e="icon-",n=e+"src",r=Uc(i[n],n),s=ms(i,e+"anchor",t),o=ys(i,e+"scale",t),a=Vt(i,e+"opacity",t),l=ms(i,e+"displacement",t),h=Vt(i,e+"rotation",t),c=ir(i,e+"rotate-with-view",t),u=Fc(i,e+"anchor-origin"),d=Bc(i,e+"anchor-x-units"),f=Bc(i,e+"anchor-y-units"),g=ym(i,e+"color"),p=_m(i,e+"cross-origin"),_=mm(i,e+"offset"),y=Fc(i,e+"offset-origin"),m=Es(i,e+"width"),x=Es(i,e+"height"),E=pm(i,e+"size"),T=xs(i,e+"declutter-mode"),b=new _s({src:r,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,color:g,crossOrigin:p,offset:_,offsetOrigin:y,height:x,width:m,size:E,declutterMode:T});return function(w){return a&&b.setOpacity(a(w)),l&&b.setDisplacement(l(w)),h&&b.setRotation(h(w)),c&&b.setRotateWithView(c(w)),o&&b.setScale(o(w)),s&&b.setAnchor(s(w)),b}}function dm(i,t){const e="shape-",n=e+"points",r=e+"radius",s=Ma(i[n],n),o=Ma(i[r],r),a=tr(i,e,t),l=er(i,e,t),h=ys(i,e+"scale",t),c=ms(i,e+"displacement",t),u=Vt(i,e+"rotation",t),d=ir(i,e+"rotate-with-view",t),f=Es(i,e+"radius2"),g=Es(i,e+"angle"),p=xs(i,e+"declutter-mode"),_=new us({points:s,radius:o,radius2:f,angle:g,declutterMode:p});return function(y){return a&&_.setFill(a(y)),l&&_.setStroke(l(y)),c&&_.setDisplacement(c(y)),u&&_.setRotation(u(y)),d&&_.setRotateWithView(d(y)),h&&_.setScale(h(y)),_}}function fm(i,t){const e="circle-",n=tr(i,e,t),r=er(i,e,t),s=Vt(i,e+"radius",t),o=ys(i,e+"scale",t),a=ms(i,e+"displacement",t),l=Vt(i,e+"rotation",t),h=ir(i,e+"rotate-with-view",t),c=xs(i,e+"declutter-mode"),u=new ds({radius:5,declutterMode:c});return function(d){return s&&u.setRadius(s(d)),n&&u.setFill(n(d)),r&&u.setStroke(r(d)),a&&u.setDisplacement(a(d)),l&&u.setRotation(l(d)),h&&u.setRotateWithView(h(d)),o&&u.setScale(o(d)),u}}function Vt(i,t,e){if(!(t in i))return;const n=$e(i[t],H,e);return function(r){return Ma(n(r),t)}}function Ne(i,t,e){if(!(t in i))return null;const n=$e(i[t],Bt,e);return function(r){return Uc(n(r),t)}}function gm(i,t,e){const n=Ne(i,t+"pattern-src",e),r=kc(i,t+"pattern-offset",e),s=kc(i,t+"pattern-size",e),o=Aa(i,t+"color",e);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function ir(i,t,e){if(!(t in i))return null;const n=$e(i[t],Ft,e);return function(r){const s=n(r);if(typeof s!="boolean")throw new Error(`Expected a boolean for ${t}`);return s}}function Aa(i,t,e){if(!(t in i))return null;const n=$e(i[t],te,e);return function(r){return Xc(n(r),t)}}function Nc(i,t,e){if(!(t in i))return null;const n=$e(i[t],ti,e);return function(r){return nr(n(r),t)}}function ms(i,t,e){if(!(t in i))return null;const n=$e(i[t],ti,e);return function(r){const s=nr(n(r),t);if(s.length!==2)throw new Error(`Expected two numbers for ${t}`);return s}}function kc(i,t,e){if(!(t in i))return null;const n=$e(i[t],ti,e);return function(r){return Gc(n(r),t)}}function ys(i,t,e){if(!(t in i))return null;const n=$e(i[t],ti|H,e);return function(r){return Em(n(r),t)}}function Es(i,t){const e=i[t];if(e!==void 0){if(typeof e!="number")throw new Error(`Expected a number for ${t}`);return e}}function pm(i,t){const e=i[t];if(e!==void 0){if(typeof e=="number")return Te(e);if(!Array.isArray(e))throw new Error(`Expected a number or size array for ${t}`);if(e.length!==2||typeof e[0]!="number"||typeof e[1]!="number")throw new Error(`Expected a number or size array for ${t}`);return e}}function _m(i,t){const e=i[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);return e}}function Fc(i,t){const e=i[t];if(e!==void 0){if(e!=="bottom-left"&&e!=="bottom-right"&&e!=="top-left"&&e!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${t}`);return e}}function Bc(i,t){const e=i[t];if(e!==void 0){if(e!=="pixels"&&e!=="fraction")throw new Error(`Expected pixels or fraction for ${t}`);return e}}function mm(i,t){const e=i[t];if(e!==void 0)return nr(e,t)}function xs(i,t){const e=i[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);if(e!=="declutter"&&e!=="obstacle"&&e!=="none")throw new Error(`Expected declutter, obstacle, or none for ${t}`);return e}}function ym(i,t){const e=i[t];if(e!==void 0)return Xc(e,t)}function nr(i,t){if(!Array.isArray(i))throw new Error(`Expected an array for ${t}`);const e=i.length;for(let n=0;n<e;++n)if(typeof i[n]!="number")throw new Error(`Expected an array of numbers for ${t}`);return i}function Uc(i,t){if(typeof i!="string")throw new Error(`Expected a string for ${t}`);return i}function Ma(i,t){if(typeof i!="number")throw new Error(`Expected a number for ${t}`);return i}function Xc(i,t){if(typeof i=="string")return i;const e=nr(i,t),n=e.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${t}`);return e}function Gc(i,t){const e=nr(i,t);if(e.length!==2)throw new Error(`Expected an array of two numbers for ${t}`);return e}function Em(i,t){return typeof i=="number"?i:Gc(i,t)}const Wc={RENDER_ORDER:"renderOrder"};class xm extends Oh{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=t.renderBuffer!==void 0?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=t.updateWhileAnimating!==void 0?t.updateWhileAnimating:!1,this.updateWhileInteracting_=t.updateWhileInteracting!==void 0?t.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Wc.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const n=this.getDeclutter();n in t.declutter||(t.declutter[n]=new O_(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Wc.RENDER_ORDER,t)}setStyle(t){this.style_=t===void 0?Dc:t;const e=Tm(t);this.styleFunction_=t===null?void 0:j_(e),this.changed()}}function Tm(i){if(i===void 0)return Dc;if(!i)return null;if(typeof i=="function"||i instanceof ps)return i;if(!Array.isArray(i))return $c([i]);if(i.length===0)return[];const t=i.length,e=i[0];if(e instanceof ps){const r=new Array(t);for(let s=0;s<t;++s){const o=i[s];if(!(o instanceof ps))throw new Error("Expected a list of style instances");r[s]=o}return r}if("style"in e){const r=new Array(t);for(let s=0;s<t;++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 am(r)}return $c(i)}const N={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},Ts=[N.FILL],ri=[N.STROKE],Ri=[N.BEGIN_PATH],Hc=[N.CLOSE_PATH];class zc{drawCustom(t,e,n,r,s){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,n){}drawFeature(t,e,n){}drawGeometryCollection(t,e,n){}drawLineString(t,e,n){}drawMultiLineString(t,e,n){}drawMultiPoint(t,e,n){}drawMultiPolygon(t,e,n){}drawPoint(t,e,n){}drawPolygon(t,e,n){}drawText(t,e,n){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}class rr extends zc{constructor(t,e,n,r){super(),this.tolerance=t,this.maxExtent=e,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(t){const e=this.pixelRatio;return e==1?t:t.map(function(n){return n*e})}appendFlatPointCoordinates(t,e){const n=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,s=this.coordinates;let o=s.length;for(let a=0,l=t.length;a<l;a+=e)r[0]=t[a],r[1]=t[a+1],Hi(n,r)&&(s[o++]=r[0],s[o++]=r[1]);return o}appendFlatLineCoordinates(t,e,n,r,s,o){const a=this.coordinates;let l=a.length;const h=this.getBufferedMaxExtent();o&&(e+=r);let c=t[e],u=t[e+1];const d=this.tmpCoordinate_;let f=!0,g,p,_;for(g=e+r;g<n;g+=r)d[0]=t[g],d[1]=t[g+1],_=Do(h,d),_!==p?(f&&(a[l++]=c,a[l++]=u,f=!1),a[l++]=d[0],a[l++]=d[1]):_===Ct.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],f=!1):f=!0,c=d[0],u=d[1],p=_;return(s&&f||g===e+r)&&(a[l++]=c,a[l++]=u),l}drawCustomCoordinates_(t,e,n,r,s){for(let o=0,a=n.length;o<a;++o){const l=n[o],h=this.appendFlatLineCoordinates(t,e,l,r,!1,!1);s.push(h),e=l}return e}drawCustom(t,e,n,r,s){this.beginGeometry(t,e,s);const o=t.getType(),a=t.getStride(),l=this.coordinates.length;let h,c,u,d,f;switch(o){case"MultiPolygon":h=t.getOrientedFlatCoordinates(),d=[];const g=t.getEndss();f=0;for(let p=0,_=g.length;p<_;++p){const y=[];f=this.drawCustomCoordinates_(h,f,g[p],a,y),d.push(y)}this.instructions.push([N.CUSTOM,l,d,t,n,Sh,s]),this.hitDetectionInstructions.push([N.CUSTOM,l,d,t,r||n,Sh,s]);break;case"Polygon":case"MultiLineString":u=[],h=o=="Polygon"?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),f=this.drawCustomCoordinates_(h,0,t.getEnds(),a,u),this.instructions.push([N.CUSTOM,l,u,t,n,zr,s]),this.hitDetectionInstructions.push([N.CUSTOM,l,u,t,r||n,zr,s]);break;case"LineString":case"Circle":h=t.getFlatCoordinates(),c=this.appendFlatLineCoordinates(h,0,h.length,a,!1,!1),this.instructions.push([N.CUSTOM,l,c,t,n,Vi,s]),this.hitDetectionInstructions.push([N.CUSTOM,l,c,t,r||n,Vi,s]);break;case"MultiPoint":h=t.getFlatCoordinates(),c=this.appendFlatPointCoordinates(h,a),c>l&&(this.instructions.push([N.CUSTOM,l,c,t,n,Vi,s]),this.hitDetectionInstructions.push([N.CUSTOM,l,c,t,r||n,Vi,s]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),c=this.coordinates.length,this.instructions.push([N.CUSTOM,l,c,t,n,void 0,s]),this.hitDetectionInstructions.push([N.CUSTOM,l,c,t,r||n,void 0,s]);break}this.endGeometry(e)}beginGeometry(t,e,n){this.beginGeometryInstruction1_=[N.BEGIN_GEOMETRY,e,0,t,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[N.BEGIN_GEOMETRY,e,0,t,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;t.reverse();let e;const n=t.length;let r,s,o=-1;for(e=0;e<n;++e)r=t[e],s=r[0],s==N.END_GEOMETRY?o=e:s==N.BEGIN_GEOMETRY&&(r[2]=e,Pf(this.hitDetectionInstructions,o,e),o=-1)}setFillStrokeStyle(t,e){const n=this.state;if(t){const r=t.getColor();n.fillPatternScale=r&&typeof r=="object"&&"src"in r?this.pixelRatio:1,n.fillStyle=ve(r||zt)}else n.fillStyle=void 0;if(e){const r=e.getColor();n.strokeStyle=ve(r||Zn);const s=e.getLineCap();n.lineCap=s!==void 0?s:nn;const o=e.getLineDash();n.lineDash=o?o.slice():Oe;const a=e.getLineDashOffset();n.lineDashOffset=a||Pe;const l=e.getLineJoin();n.lineJoin=l!==void 0?l:rn;const h=e.getWidth();n.lineWidth=h!==void 0?h:Kn;const c=e.getMiterLimit();n.miterLimit=c!==void 0?c:jn,n.lineWidth>this.maxLineWidth&&(this.maxLineWidth=n.lineWidth,this.bufferedMaxExtent_=null)}else n.strokeStyle=void 0,n.lineCap=void 0,n.lineDash=null,n.lineDashOffset=void 0,n.lineJoin=void 0,n.lineWidth=void 0,n.miterLimit=void 0}createFill(t){const e=t.fillStyle,n=[N.SET_FILL_STYLE,e];return typeof e!="string"&&n.push(t.fillPatternScale),n}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[N.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const n=t.fillStyle;(typeof n!="string"||t.currentFillStyle!=n)&&(n!==void 0&&this.instructions.push(e.call(this,t)),t.currentFillStyle=n)}updateStrokeStyle(t,e){const n=t.strokeStyle,r=t.lineCap,s=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,l=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=n||t.currentLineCap!=r||s!=t.currentLineDash&&!Bi(t.currentLineDash,s)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=h)&&(n!==void 0&&e.call(this,t),t.currentStrokeStyle=n,t.currentLineCap=r,t.currentLineDash=s,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=l,t.currentMiterLimit=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[N.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Qf(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;Mo(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class vm extends rr{constructor(t,e,n,r){super(t,e,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(t,e,n){if(!this.image_||this.maxExtent&&!Hi(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,n);const r=t.getFlatCoordinates(),s=t.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,s);this.instructions.push([N.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([N.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,n){if(!this.image_)return;this.beginGeometry(t,e,n);const r=t.getFlatCoordinates(),s=[];for(let l=0,h=r.length;l<h;l+=t.getStride())(!this.maxExtent||Hi(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([N.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([N.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const n=t.getAnchor(),r=t.getSize(),s=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=r[1],this.opacity_=t.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=r[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}const bm=vm;class wm extends rr{constructor(t,e,n,r){super(t,e,n,r)}drawFlatCoordinates_(t,e,n,r){const s=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,n,r,!1,!1),a=[N.MOVE_TO_LINE_TO,s,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),n}drawLineString(t,e,n){const r=this.state,s=r.strokeStyle,o=r.lineWidth;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(t,e,n),this.hitDetectionInstructions.push([N.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Oe,Pe],Ri);const a=t.getFlatCoordinates(),l=t.getStride();this.drawFlatCoordinates_(a,0,a.length,l),this.hitDetectionInstructions.push(ri),this.endGeometry(e)}drawMultiLineString(t,e,n){const r=this.state,s=r.strokeStyle,o=r.lineWidth;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(t,e,n),this.hitDetectionInstructions.push([N.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Oe,Pe],Ri);const a=t.getEnds(),l=t.getFlatCoordinates(),h=t.getStride();let c=0;for(let u=0,d=a.length;u<d;++u)c=this.drawFlatCoordinates_(l,c,a[u],h);this.hitDetectionInstructions.push(ri),this.endGeometry(e)}finish(){const t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(ri),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(ri),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(Ri)}}const Sm=wm;class Rm extends rr{constructor(t,e,n,r){super(t,e,n,r)}drawFlatCoordinatess_(t,e,n,r){const s=this.state,o=s.fillStyle!==void 0,a=s.strokeStyle!==void 0,l=n.length;this.instructions.push(Ri),this.hitDetectionInstructions.push(Ri);for(let h=0;h<l;++h){const c=n[h],u=this.coordinates.length,d=this.appendFlatLineCoordinates(t,e,c,r,!0,!a),f=[N.MOVE_TO_LINE_TO,u,d];this.instructions.push(f),this.hitDetectionInstructions.push(f),a&&(this.instructions.push(Hc),this.hitDetectionInstructions.push(Hc)),e=c}return o&&(this.instructions.push(Ts),this.hitDetectionInstructions.push(Ts)),a&&(this.instructions.push(ri),this.hitDetectionInstructions.push(ri)),e}drawCircle(t,e,n){const r=this.state,s=r.fillStyle,o=r.strokeStyle;if(s===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([N.SET_FILL_STYLE,zt]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([N.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Oe,Pe]);const a=t.getFlatCoordinates(),l=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const c=[N.CIRCLE,h];this.instructions.push(Ri,c),this.hitDetectionInstructions.push(Ri,c),r.fillStyle!==void 0&&(this.instructions.push(Ts),this.hitDetectionInstructions.push(Ts)),r.strokeStyle!==void 0&&(this.instructions.push(ri),this.hitDetectionInstructions.push(ri)),this.endGeometry(e)}drawPolygon(t,e,n){const r=this.state,s=r.fillStyle,o=r.strokeStyle;if(s===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([N.SET_FILL_STYLE,zt]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([N.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Oe,Pe]);const a=t.getEnds(),l=t.getOrientedFlatCoordinates(),h=t.getStride();this.drawFlatCoordinatess_(l,0,a,h),this.endGeometry(e)}drawMultiPolygon(t,e,n){const r=this.state,s=r.fillStyle,o=r.strokeStyle;if(s===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([N.SET_FILL_STYLE,zt]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([N.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Oe,Pe]);const a=t.getEndss(),l=t.getOrientedFlatCoordinates(),h=t.getStride();let c=0;for(let u=0,d=a.length;u<d;++u)c=this.drawFlatCoordinatess_(l,c,a[u],h);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(t!==0){const e=this.coordinates;for(let n=0,r=e.length;n<r;++n)e[n]=Ti(e[n],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;t.fillStyle!==void 0&&this.updateFillStyle(t,this.createFill),t.strokeStyle!==void 0&&this.updateStrokeStyle(t,this.applyStroke)}}const Vc=Rm;function Cm(i,t,e,n,r){const s=[];let o=e,a=0,l=t.slice(e,2);for(;a<i&&o+r<n;){const[h,c]=l.slice(-2),u=t[o+r],d=t[o+r+1],f=Math.sqrt((u-h)*(u-h)+(d-c)*(d-c));if(a+=f,a>=i){const g=(i-a+f)/f,p=fe(h,u,g),_=fe(c,d,g);l.push(p,_),s.push(l),l=[p,_],a==i&&(o+=r),a=0}else if(a<i)l.push(t[o+r],t[o+r+1]),o+=r;else{const g=f-a,p=fe(h,u,g/f),_=fe(c,d,g/f);l.push(p,_),s.push(l),l=[p,_],a=0,o+=r}}return a>0&&s.push(l),s}function Im(i,t,e,n,r){let s=e,o=e,a=0,l=0,h=e,c,u,d,f,g,p,_,y,m,x;for(u=e;u<n;u+=r){const E=t[u],T=t[u+1];g!==void 0&&(m=E-g,x=T-p,f=Math.sqrt(m*m+x*x),_!==void 0&&(l+=d,c=Math.acos((_*m+y*x)/(d*f)),c>i&&(l>a&&(a=l,s=h,o=u),l=0,h=u-r)),d=f,_=m,y=x),g=E,p=T}return l+=f,l>a?[h,u]:[s,o]}const vs={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class Am extends rr{constructor(t,e,n,r){super(t,e,n,r),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[zt]={fillStyle:zt},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 t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,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 h=t.getType();let c=null,u=t.getStride();if(o.placement==="line"&&(h=="LineString"||h=="MultiLineString"||h=="Polygon"||h=="MultiPolygon")){if(!Qt(this.maxExtent,t.getExtent()))return;let d;if(c=t.getFlatCoordinates(),h=="LineString")d=[c.length];else if(h=="MultiLineString")d=t.getEnds();else if(h=="Polygon")d=t.getEnds().slice(0,1);else if(h=="MultiPolygon"){const _=t.getEndss();d=[];for(let y=0,m=_.length;y<m;++y)d.push(_[y][0])}this.beginGeometry(t,e,n);const f=o.repeat,g=f?void 0:o.textAlign;let p=0;for(let _=0,y=d.length;_<y;++_){let m;f?m=Cm(f*this.resolution,c,p,d[_],u):m=[c.slice(p,d[_])];for(let x=0,E=m.length;x<E;++x){const T=m[x];let b=0,w=T.length;if(g==null){const R=Im(o.maxAngle,T,0,T.length,2);b=R[0],w=R[1]}for(let R=b;R<w;R+=u)a.push(T[R],T[R+1]);const S=a.length;p=d[_],this.drawChars_(l,S),l=S}}this.endGeometry(e)}else{let d=o.overflow?null:[];switch(h){case"Point":case"MultiPoint":c=t.getFlatCoordinates();break;case"LineString":c=t.getFlatMidpoint();break;case"Circle":c=t.getCenter();break;case"MultiLineString":c=t.getFlatMidpoints(),u=2;break;case"Polygon":c=t.getFlatInteriorPoint(),o.overflow||d.push(c[2]/this.resolution),u=3;break;case"MultiPolygon":const m=t.getFlatInteriorPoints();c=[];for(let x=0,E=m.length;x<E;x+=3)o.overflow||d.push(m[x+2]/this.resolution),c.push(m[x],m[x+1]);if(c.length===0)return;u=2;break}const f=this.appendFlatPointCoordinates(c,u);if(f===l)return;if(d&&(f-l)/2!==c.length/u){let m=l/2;d=d.filter((x,E)=>{const T=a[(m+E)*2]===c[E*u]&&a[(m+E)*2+1]===c[E*u+1];return T||--m,T})}this.saveTextStates_(),(o.backgroundFill||o.backgroundStroke)&&(this.setFillStrokeStyle(o.backgroundFill,o.backgroundStroke),o.backgroundFill&&this.updateFillStyle(this.state,this.createFill),o.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,e,n);let g=o.padding;if(g!=Si&&(o.scale[0]<0||o.scale[1]<0)){let m=o.padding[0],x=o.padding[1],E=o.padding[2],T=o.padding[3];o.scale[0]<0&&(x=-x,T=-T),o.scale[1]<0&&(m=-m,E=-E),g=[m,x,E,T]}const p=this.pixelRatio;this.instructions.push([N.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,g==Si?Si:g.map(function(m){return m*p}),!!o.backgroundFill,!!o.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);const _=1/p,y=this.state.fillStyle;o.backgroundFill&&(this.state.fillStyle=zt,this.hitDetectionInstructions.push(this.createFill(this.state))),this.hitDetectionInstructions.push([N.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[_,_],NaN,this.declutterMode_,this.declutterImageWithText_,g,!!o.backgroundFill,!!o.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?zt:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),o.backgroundFill&&(this.state.fillStyle=y,this.hitDetectionInstructions.push(this.createFill(this.state))),this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,n=this.textFillState_,r=this.strokeKey_;t&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const s=this.textKey_;s in this.textStates||(this.textStates[s]={font:e.font,textAlign:e.textAlign||qn,justify:e.justify,textBaseline:e.textBaseline||hs,scale:e.scale});const o=this.fillKey_;n&&(o in this.fillStates||(this.fillStates[o]={fillStyle:n.fillStyle}))}drawChars_(t,e){const n=this.textStrokeState_,r=this.textState_,s=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,h=vs[r.textBaseline],c=this.textOffsetY_*l,u=this.text_,d=n?n.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([N.DRAW_CHARS,t,e,h,r.overflow,a,r.maxAngle,l,c,s,d*l,u,o,1,this.declutterMode_]),this.hitDetectionInstructions.push([N.DRAW_CHARS,t,e,h,r.overflow,a&&zt,r.maxAngle,l,c,s,d*l,u,o,1/l,this.declutterMode_])}setTextStyle(t,e){let n,r,s;if(!t)this.text_="";else{const o=t.getFill();o?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=ve(o.getColor()||zt)):(r=null,this.textFillState_=r);const a=t.getStroke();if(!a)s=null,this.textStrokeState_=s;else{s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);const g=a.getLineDash(),p=a.getLineDashOffset(),_=a.getWidth(),y=a.getMiterLimit();s.lineCap=a.getLineCap()||nn,s.lineDash=g?g.slice():Oe,s.lineDashOffset=p===void 0?Pe:p,s.lineJoin=a.getLineJoin()||rn,s.lineWidth=_===void 0?Kn:_,s.miterLimit=y===void 0?jn:y,s.strokeStyle=ve(a.getColor()||Zn)}n=this.textState_;const l=t.getFont()||Ic;W_(l);const h=t.getScaleArray();n.overflow=t.getOverflow(),n.font=l,n.maxAngle=t.getMaxAngle(),n.placement=t.getPlacement(),n.textAlign=t.getTextAlign(),n.repeat=t.getRepeat(),n.justify=t.getJustify(),n.textBaseline=t.getTextBaseline()||hs,n.backgroundFill=t.getBackgroundFill(),n.backgroundStroke=t.getBackgroundStroke(),n.padding=t.getPadding()||Si,n.scale=h===void 0?[1,1]:h;const c=t.getOffsetX(),u=t.getOffsetY(),d=t.getRotateWithView(),f=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=d===void 0?!1:d,this.textRotation_=f===void 0?0:f,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:kt(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:"|"+kt(r.fillStyle):""}this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}const Mm={Circle:Vc,Default:rr,Image:bm,LineString:Sm,Polygon:Vc,Text:Am};class Dm{constructor(t,e,n,r){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=r,this.resolution_=n,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const n=this.buildersByZIndex_[e];for(const r in n){const s=n[r].finish();t[e][r]=s}}return t}getBuilder(t,e){const n=t!==void 0?t.toString():"0";let r=this.buildersByZIndex_[n];r===void 0&&(r={},this.buildersByZIndex_[n]=r);let s=r[e];if(s===void 0){const o=Mm[e];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[e]=s}return s}}class Yc{constructor(){bt(this,"pushMethodArgs_",(...t)=>(this.instructions_[this.zIndex+this.offset_].push(t),this));this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(Zr(),{get:(t,e)=>{if(typeof Zr()[e]=="function")return this.instructions_[this.zIndex+this.offset_]||(this.instructions_[this.zIndex+this.offset_]=[]),this.instructions_[this.zIndex+this.offset_].push(e),this.pushMethodArgs_},set:(t,e,n)=>(this.instructions_[this.zIndex+this.offset_]||(this.instructions_[this.zIndex+this.offset_]=[]),this.instructions_[this.zIndex+this.offset_].push(e,n),!0)})}pushFunction(t){this.instructions_[this.zIndex+this.offset_].push(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let n=0,r=e.length;n<r;++n){const s=e[n];if(typeof s=="function"){s(t);continue}const o=e[++n];if(typeof t[s]=="function")t[s](...o);else{if(typeof o=="function"){t[s]=o(t);continue}t[s]=o}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}}const jc=[];let on=null;function Lm(){on=Et(1,1,void 0,{willReadFrequently:!0})}class Om extends Kh{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=oe(),this.pixelTransform=oe(),this.inversePixelTransform=oe(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(t,e,n){on||Lm(),on.clearRect(0,0,1,1);let r;try{on.drawImage(t,e,n,1,1,0,0,1,1),r=on.getImageData(0,0,1,1).data}catch{return on=null,null}return r}getBackground(t){let n=this.getLayer().getBackground();return typeof n=="function"&&(n=n(t.viewState.resolution)),n||void 0}useContainer(t,e,n){const r=this.getLayer().getClassName();let s,o;if(t&&t.className===r&&(!n||t&&t.style.backgroundColor&&Bi(bi(t.style.backgroundColor),bi(n)))){const a=t.firstElementChild;a instanceof HTMLCanvasElement&&(o=a.getContext("2d"))}if(o&&o.canvas.style.transform===e?(this.container=t,this.context=o,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){s=document.createElement("div"),s.className=r;let a=s.style;a.position="absolute",a.width="100%",a.height="100%",o=Et();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(t,e,n){const r=Ur(n),s=$o(n),o=Po(n),a=Oo(n);Ht(e.coordinateToPixelTransform,r),Ht(e.coordinateToPixelTransform,s),Ht(e.coordinateToPixelTransform,o),Ht(e.coordinateToPixelTransform,a);const l=this.inversePixelTransform;Ht(l,r),Ht(l,s),Ht(l,o),Ht(l,a),t.save(),t.beginPath(),t.moveTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}prepareContainer(t,e){const n=t.extent,r=t.viewState.resolution,s=t.viewState.rotation,o=t.pixelRatio,a=Math.round(ht(n)/r*o),l=Math.round(Jt(n)/r*o);Ke(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/o,1/o,s,-a/2,-l/2),Pg(this.inversePixelTransform,this.pixelTransform);const h=Ng(this.pixelTransform);if(this.useContainer(e,h,this.getBackground(t)),!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),h!==c.style.transform&&(c.style.transform=h)}}dispatchRenderEvent_(t,e,n){const r=this.getLayer();if(r.hasListener(t)){const s=new Kr(t,this.inversePixelTransform,n,e);r.dispatchEvent(s)}}preRender(t,e){this.frameState=e,!e.declutter&&this.dispatchRenderEvent_(Kt.PRERENDER,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(Kt.POSTRENDER,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new Yc),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(Kt.PRERENDER,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(Kt.POSTRENDER,this.context,t))}getRenderTransform(t,e,n,r,s,o,a){const l=s/2,h=o/2,c=r/e,u=-c,d=-t[0]+a,f=-t[1];return Ke(this.tempTransform,l,h,c,u,-n,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}function Pm(i,t,e,n,r,s,o,a,l,h,c,u){let d=i[t],f=i[t+1],g=0,p=0,_=0,y=0;function m(){g=d,p=f,t+=n,d=i[t],f=i[t+1],y+=_,_=Math.sqrt((d-g)*(d-g)+(f-p)*(f-p))}do m();while(t<e-n&&y+_<s);let x=_===0?0:(s-y)/_;const E=fe(g,d,x),T=fe(p,f,x),b=t-n,w=y,S=s+a*l(h,r,c);for(;t<e-n&&y+_<S;)m();x=_===0?0:(S-y)/_;const R=fe(g,d,x),P=fe(p,f,x);let M;if(u){const A=[E,T,R,P];yh(A,0,4,2,u,A,A),M=A[0]>A[2]}else M=E>R;const D=Math.PI,k=[],L=b+n===t;t=b,_=0,y=w,d=i[t],f=i[t+1];let F;if(L){m(),F=Math.atan2(f-p,d-g),M&&(F+=F>0?-D:D);const A=(R+E)/2,Y=(P+T)/2;return k[0]=[A,Y,(S-s)/2,F,r],k}r=r.replace(/\n/g," ");for(let A=0,Y=r.length;A<Y;){m();let j=Math.atan2(f-p,d-g);if(M&&(j+=j>0?-D:D),F!==void 0){let I=j-F;if(I+=I>D?-2*D:I<-D?2*D:0,Math.abs(I)>o)return null}F=j;const ct=A;let J=0;for(;A<Y;++A){const I=M?Y-A-1:A,Be=a*l(h,r[I],c);if(t+n<e&&y+_<s+J+Be/2)break;J+=Be}if(A===ct)continue;const lt=M?r.substring(Y-ct,Y-A):r.substring(ct,A);x=_===0?0:(s+J/2-y)/_;const ft=fe(g,d,x),ae=fe(p,f,x);k.push([ft,ae,J/2,j,lt]),s+=J}return k}function $m(i,t,e,n){let r=i[t],s=i[t+1],o=0;for(let a=t+n;a<e;a+=n){const l=i[a],h=i[a+1];o+=Math.sqrt((l-r)*(l-r)+(h-s)*(h-s)),r=l,s=h}return o}const an=Ee(),si=[],ke=[],Fe=[],oi=[];function Zc(i){return i[3].declutterBox}const qc=new RegExp("[֑-ࣿיִ-﷿ﹰ-ﻼࠀ-࿿-]");function Da(i,t){return t==="start"?t=qc.test(i)?"right":"left":t==="end"&&(t=qc.test(i)?"left":"right"),vs[t]}function Nm(i,t,e){return e>0&&i.push(`
184
- `,""),i.push(t,""),i}class km{constructor(t,e,n,r,s){this.overlaps=n,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=oe(),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 Yc:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,n,r){const s=t+e+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[e],h=this.pixelRatio,c=[l.scale[0]*h,l.scale[1]*h],u=l.justify?vs[l.justify]:Da(Array.isArray(t)?t[0]:t,l.textAlign||qn),d=r&&o.lineWidth?o.lineWidth:0,f=Array.isArray(t)?t:String(t).split(`
185
- `).reduce(Nm,[]),{width:g,height:p,widths:_,heights:y,lineWidths:m}=z_(l,f),x=g+d,E=[],T=(x+2)*c[0],b=(p+d)*c[1],w={width:T<0?Math.floor(T):Math.ceil(T),height:b<0?Math.floor(b):Math.ceil(b),contextInstructions:E};(c[0]!=1||c[1]!=1)&&E.push("scale",c),r&&(E.push("strokeStyle",o.strokeStyle),E.push("lineWidth",d),E.push("lineCap",o.lineCap),E.push("lineJoin",o.lineJoin),E.push("miterLimit",o.miterLimit),E.push("setLineDash",[o.lineDash]),E.push("lineDashOffset",o.lineDashOffset)),n&&E.push("fillStyle",a.fillStyle),E.push("textBaseline","middle"),E.push("textAlign","center");const S=.5-u;let R=u*x+S*d;const P=[],M=[];let D=0,k=0,L=0,F=0,A;for(let Y=0,j=f.length;Y<j;Y+=2){const ct=f[Y];if(ct===`
186
- `){k+=D,D=0,R=u*x+S*d,++F;continue}const J=f[Y+1]||l.font;J!==A&&(r&&P.push("font",J),n&&M.push("font",J),A=J),D=Math.max(D,y[L]);const lt=[ct,R+S*_[L]+u*(_[L]-m[F]),.5*(d+D)+k];R+=_[L],r&&P.push("strokeText",lt),n&&M.push("fillText",lt),++L}return Array.prototype.push.apply(E,P),Array.prototype.push.apply(E,M),this.labels_[s]=w,w}replayTextBackground_(t,e,n,r,s,o,a){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,n),t.lineTo.apply(t,r),t.lineTo.apply(t,s),t.lineTo.apply(t,e),o&&(this.alignAndScaleFill_=o[2],this.fill_(t)),a&&(this.setStrokeStyle_(t,a),t.stroke())}calculateImageOrLabelDimensions_(t,e,n,r,s,o,a,l,h,c,u,d,f,g,p,_){a*=d[0],l*=d[1];let y=n-a,m=r-l;const x=s+h>t?t-h:s,E=o+c>e?e-c:o,T=g[3]+x*d[0]+g[1],b=g[0]+E*d[1]+g[2],w=y-g[3],S=m-g[0];(p||u!==0)&&(si[0]=w,oi[0]=w,si[1]=S,ke[1]=S,ke[0]=w+T,Fe[0]=ke[0],Fe[1]=S+b,oi[1]=Fe[1]);let R;return u!==0?(R=Ke(oe(),n,r,1,1,u,-n,-r),Ht(R,si),Ht(R,ke),Ht(R,Fe),Ht(R,oi),$n(Math.min(si[0],ke[0],Fe[0],oi[0]),Math.min(si[1],ke[1],Fe[1],oi[1]),Math.max(si[0],ke[0],Fe[0],oi[0]),Math.max(si[1],ke[1],Fe[1],oi[1]),an)):$n(Math.min(w,w+T),Math.min(S,S+b),Math.max(w,w+T),Math.max(S,S+b),an),f&&(y=Math.round(y),m=Math.round(m)),{drawImageX:y,drawImageY:m,drawImageW:x,drawImageH:E,originX:h,originY:c,declutterBox:{minX:an[0],minY:an[1],maxX:an[2],maxY:an[3],value:_},canvasTransform:R,scale:d}}replayImageOrLabel_(t,e,n,r,s,o,a){const l=!!(o||a),h=r.declutterBox,c=a?a[2]*r.scale[0]/2:0;return h.minX-c<=e[0]&&h.maxX+c>=0&&h.minY-c<=e[1]&&h.maxY+c>=0&&(l&&this.replayTextBackground_(t,si,ke,Fe,oi,o,a),V_(t,r.canvasTransform,s,n,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const n=Ht(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;t.save(),t.translate(n[0]%r,n[1]%r),e!==1&&t.scale(e,e),t.rotate(this.viewRotation_)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6])}drawLabelWithPointPlacement_(t,e,n,r){const s=this.textStates[e],o=this.createLabel(t,e,r,n),a=this.strokeStates[n],l=this.pixelRatio,h=Da(Array.isArray(t)?t[0]:t,s.textAlign||qn),c=vs[s.textBaseline||hs],u=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*s.scale[0],f=h*d+2*(.5-h)*u,g=c*o.height/l+2*(.5-c)*u;return{label:o,anchorX:f,anchorY:g}}execute_(t,e,n,r,s,o,a,l){const h=this.zIndexContext_;let c;this.pixelCoordinates_&&Bi(n,this.renderedTransform_)?c=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),c=xi(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),Dg(this.renderedTransform_,n));let u=0;const d=r.length;let f=0,g,p,_,y,m,x,E,T,b,w,S,R,P,M=0,D=0,k=null,L=null;const F=this.coordinateCache_,A=this.viewRotation_,Y=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,j={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:A},ct=this.instructions!=r||this.overlaps?0:200;let J,lt,ft,ae;for(;u<d;){const I=r[u];switch(I[0]){case N.BEGIN_GEOMETRY:J=I[1],ae=I[3],J.getGeometry()?a!==void 0&&!Qt(a,ae.getExtent())?u=I[2]+1:++u:u=I[2],h&&(h.zIndex=I[4]);break;case N.BEGIN_PATH:M>ct&&(this.fill_(t),M=0),D>ct&&(t.stroke(),D=0),!M&&!D&&(t.beginPath(),m=NaN,x=NaN),++u;break;case N.CIRCLE:f=I[1];const Ue=c[f],ee=c[f+1],Ci=c[f+2],Xs=c[f+3],we=Ci-Ue,Eu=Xs-ee,xu=Math.sqrt(we*we+Eu*Eu);t.moveTo(Ue+xu,ee),t.arc(Ue,ee,xu,0,2*Math.PI,!0),++u;break;case N.CLOSE_PATH:t.closePath(),++u;break;case N.CUSTOM:f=I[1],g=I[2];const k0=I[3],F0=I[4],Tu=I[5];j.geometry=k0,j.feature=J,u in F||(F[u]=[]);const lr=F[u];Tu?Tu(c,f,g,2,lr):(lr[0]=c[f],lr[1]=c[f+1],lr.length=2),h&&(h.zIndex=I[6]),F0(lr,j),++u;break;case N.DRAW_IMAGE:f=I[1],g=I[2],b=I[3],p=I[4],_=I[5];let Na=I[6];const B0=I[7],U0=I[8],X0=I[9],vu=I[10];let ka=I[11];const G0=I[12];let Gs=I[13];y=I[14]||"declutter";const hr=I[15];if(!b&&I.length>=20){w=I[19],S=I[20],R=I[21],P=I[22];const le=this.drawLabelWithPointPlacement_(w,S,R,P);b=le.label,I[3]=b;const Ii=I[23];p=(le.anchorX-Ii)*this.pixelRatio,I[4]=p;const he=I[24];_=(le.anchorY-he)*this.pixelRatio,I[5]=_,Na=b.height,I[6]=Na,Gs=b.width,I[13]=Gs}let Fa;I.length>25&&(Fa=I[25]);let Ba,Ws,Hs;I.length>17?(Ba=I[16],Ws=I[17],Hs=I[18]):(Ba=Si,Ws=!1,Hs=!1),vu&&Y?ka+=A:!vu&&!Y&&(ka-=A);let W0=0;for(;f<g;f+=2){if(Fa&&Fa[W0++]<Gs/this.pixelRatio)continue;const le=this.calculateImageOrLabelDimensions_(b.width,b.height,c[f],c[f+1],Gs,Na,p,_,U0,X0,ka,G0,s,Ba,Ws||Hs,J),Ii=[t,e,b,le,B0,Ws?k:null,Hs?L:null];if(l){let he,Se,ce;if(hr){const mt=g-f;if(!hr[mt]){hr[mt]={args:Ii,declutterMode:y};continue}const Xt=hr[mt];he=Xt.args,Se=Xt.declutterMode,delete hr[mt],ce=Zc(he)}let Xe,Ge;if(he&&(Se!=="declutter"||!l.collides(ce))&&(Xe=!0),(y!=="declutter"||!l.collides(le.declutterBox))&&(Ge=!0),Se==="declutter"&&y==="declutter"){const mt=Xe&&Ge;Xe=mt,Ge=mt}Xe&&(Se!=="none"&&l.insert(ce),this.replayImageOrLabel_.apply(this,he)),Ge&&(y!=="none"&&l.insert(le.declutterBox),this.replayImageOrLabel_.apply(this,Ii))}else this.replayImageOrLabel_.apply(this,Ii)}++u;break;case N.DRAW_CHARS:const bu=I[1],wu=I[2],Ua=I[3],H0=I[4];P=I[5];const z0=I[6],Su=I[7],Ru=I[8];R=I[9];const Xa=I[10];w=I[11],S=I[12];const Cu=[I[13],I[13]];y=I[14]||"declutter";const Ga=this.textStates[S],cr=Ga.font,ur=[Ga.scale[0]*Su,Ga.scale[1]*Su];let dr;cr in this.widths_?dr=this.widths_[cr]:(dr={},this.widths_[cr]=dr);const Iu=$m(c,bu,wu,2),Au=Math.abs(ur[0])*Mc(cr,w,dr);if(H0||Au<=Iu){const le=this.textStates[S].textAlign,Ii=(Iu-Au)*Da(w,le),he=Pm(c,bu,wu,2,w,Ii,z0,Math.abs(ur[0]),Mc,cr,dr,Y?0:this.viewRotation_);t:if(he){const Se=[];let ce,Xe,Ge,mt,Xt;if(R)for(ce=0,Xe=he.length;ce<Xe;++ce){Xt=he[ce],Ge=Xt[4],mt=this.createLabel(Ge,S,"",R),p=Xt[2]+(ur[0]<0?-Xa:Xa),_=Ua*mt.height+(.5-Ua)*2*Xa*ur[1]/ur[0]-Ru;const We=this.calculateImageOrLabelDimensions_(mt.width,mt.height,Xt[0],Xt[1],mt.width,mt.height,p,_,0,0,Xt[3],Cu,!1,Si,!1,J);if(l&&y==="declutter"&&l.collides(We.declutterBox))break t;Se.push([t,e,mt,We,1,null,null])}if(P)for(ce=0,Xe=he.length;ce<Xe;++ce){Xt=he[ce],Ge=Xt[4],mt=this.createLabel(Ge,S,P,""),p=Xt[2],_=Ua*mt.height-Ru;const We=this.calculateImageOrLabelDimensions_(mt.width,mt.height,Xt[0],Xt[1],mt.width,mt.height,p,_,0,0,Xt[3],Cu,!1,Si,!1,J);if(l&&y==="declutter"&&l.collides(We.declutterBox))break t;Se.push([t,e,mt,We,1,null,null])}l&&y!=="none"&&l.load(Se.map(Zc));for(let We=0,V0=Se.length;We<V0;++We)this.replayImageOrLabel_.apply(this,Se[We])}}++u;break;case N.END_GEOMETRY:if(o!==void 0){J=I[1];const le=o(J,ae,y);if(le)return le}++u;break;case N.FILL:ct?M++:this.fill_(t),++u;break;case N.MOVE_TO_LINE_TO:for(f=I[1],g=I[2],lt=c[f],ft=c[f+1],t.moveTo(lt,ft),m=lt+.5|0,x=ft+.5|0,f+=2;f<g;f+=2)lt=c[f],ft=c[f+1],E=lt+.5|0,T=ft+.5|0,(f==g-2||E!==m||T!==x)&&(t.lineTo(lt,ft),m=E,x=T);++u;break;case N.SET_FILL_STYLE:k=I,this.alignAndScaleFill_=I[2],M&&(this.fill_(t),M=0,D&&(t.stroke(),D=0)),t.fillStyle=I[1],++u;break;case N.SET_STROKE_STYLE:L=I,D&&(t.stroke(),D=0),this.setStrokeStyle_(t,I),++u;break;case N.STROKE:ct?D++:t.stroke(),++u;break;default:++u;break}}M&&this.fill_(t),D&&t.stroke()}execute(t,e,n,r,s,o){this.viewRotation_=r,this.execute_(t,e,n,this.instructions,s,void 0,void 0,o)}executeHitDetection(t,e,n,r,s){return this.viewRotation_=n,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,r,s)}}const ln=["Polygon","Circle","LineString","Image","Text","Default"],Kc=["Image","Text"],Fm=ln.filter(i=>!Kc.includes(i));class Bm{constructor(t,e,n,r,s,o,a){this.maxExtent_=t,this.overlaps_=r,this.pixelRatio_=n,this.resolution_=e,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=oe(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(s,a)}clip(t,e){const n=this.getClipCoords(e);t.beginPath(),t.moveTo(n[0],n[1]),t.lineTo(n[2],n[3]),t.lineTo(n[4],n[5]),t.lineTo(n[6],n[7]),t.clip()}createExecutors_(t,e){for(const n in t){let r=this.executorsByZIndex_[n];r===void 0&&(r={},this.executorsByZIndex_[n]=r);const s=t[n];for(const o in s){const a=s[o];r[o]=new km(this.resolution_,this.pixelRatio_,this.overlaps_,a,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const n=this.executorsByZIndex_[e];for(let r=0,s=t.length;r<s;++r)if(t[r]in n)return!0}return!1}forEachFeatureAtCoordinate(t,e,n,r,s,o){r=Math.round(r);const a=r*2+1,l=Ke(this.hitDetectionTransform_,r+.5,r+.5,1/e,-1/e,-n,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=Et(a,a,void 0,{willReadFrequently:!0}));const c=this.hitDetectionContext_;c.canvas.width!==a||c.canvas.height!==a?(c.canvas.width=a,c.canvas.height=a):h||c.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=Ee(),Nn(u,t),Mo(u,e*(this.renderBuffer_+r),u));const d=Um(r);let f;function g(T,b,w){const S=c.getImageData(0,0,a,a).data;for(let R=0,P=d.length;R<P;R++)if(S[d[R]]>0){if(!o||w==="none"||f!=="Image"&&f!=="Text"||o.includes(T)){const M=(d[R]-3)/4,D=r-M%a,k=r-(M/a|0),L=s(T,b,D*D+k*k);if(L)return L}c.clearRect(0,0,a,a);break}}const p=Object.keys(this.executorsByZIndex_).map(Number);p.sort(Fi);let _,y,m,x,E;for(_=p.length-1;_>=0;--_){const T=p[_].toString();for(m=this.executorsByZIndex_[T],y=ln.length-1;y>=0;--y)if(f=ln[y],x=m[f],x!==void 0&&(E=x.executeHitDetection(c,l,n,g,u),E))return E}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const n=e[0],r=e[1],s=e[2],o=e[3],a=[n,r,n,o,s,o,s,r];return xi(a,0,8,2,t,a),a}isEmpty(){return Co(this.executorsByZIndex_)}execute(t,e,n,r,s,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(Fi),o=o||ln;const h=ln.length;let c,u,d,f,g;for(a&&l.reverse(),c=0,u=l.length;c<u;++c){const p=l[c].toString();for(g=this.executorsByZIndex_[p],d=0,f=o.length;d<f;++d){const _=o[d],y=g[_];if(y!==void 0){const m=a===null?void 0:y.getZIndexContext(),x=m?m.getContext():t,E=this.maxExtent_&&_!=="Image"&&_!=="Text";if(E&&(x.save(),this.clip(x,n)),!m||_==="Text"||_==="Image"?y.execute(x,e,n,r,s,a):m.pushFunction(T=>y.execute(T,e,n,r,s,a)),E&&x.restore(),m){m.offset();const T=l[c]*h+d;this.deferredZIndexContexts_[T]||(this.deferredZIndexContexts_[T]=[]),this.deferredZIndexContexts_[T].push(m)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(Fi);for(let n=0,r=e.length;n<r;++n)t[e[n]].forEach(s=>{s.draw(this.renderedContext_),s.clear()}),t[e[n]].length=0}}const La={};function Um(i){if(La[i]!==void 0)return La[i];const t=i*2+1,e=i*i,n=new Array(e+1);for(let s=0;s<=i;++s)for(let o=0;o<=i;++o){const a=s*s+o*o;if(a>e)break;let l=n[a];l||(l=[],n[a]=l),l.push(((i+s)*t+(i+o))*4+3),s>0&&l.push(((i-s)*t+(i+o))*4+3),o>0&&(l.push(((i+s)*t+(i-o))*4+3),s>0&&l.push(((i-s)*t+(i-o))*4+3))}const r=[];for(let s=0,o=n.length;s<o;++s)n[s]&&r.push(...n[s]);return La[i]=r,r}class Xm extends zc{constructor(t,e,n,r,s,o,a){super(),this.context_=t,this.pixelRatio_=e,this.extent_=n,this.transform_=r,this.transformRotation_=r?Xf(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_=oe()}drawImages_(t,e,n,r){if(!this.image_)return;const s=xi(t,e,n,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let h=this.imageRotation_;this.transformRotation_===0&&(h-=this.viewRotation_),this.imageRotateWithView_&&(h+=this.viewRotation_);for(let c=0,u=s.length;c<u;c+=2){const d=s[c]-this.imageAnchorX_,f=s[c+1]-this.imageAnchorY_;if(h!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const g=d+this.imageAnchorX_,p=f+this.imageAnchorY_;Ke(a,g,p,1,1,h,-g,-p),o.save(),o.transform.apply(o,a),o.translate(g,p),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,f,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(t,e,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=xi(t,e,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_);e<n;e+=r){const l=s[e]+this.textOffsetX_,h=s[e+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,h-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,h),this.textFillState_&&o.fillText(this.text_,l,h))}}moveToLineTo_(t,e,n,r,s){const o=this.context_,a=xi(t,e,n,r,this.transform_,this.pixelCoordinates_);o.moveTo(a[0],a[1]);let l=a.length;s&&(l-=2);for(let h=2;h<l;h+=2)o.lineTo(a[h],a[h+1]);return s&&o.closePath(),n}drawRings_(t,e,n,r){for(let s=0,o=n.length;s<o;++s)e=this.moveToLineTo_(t,e,n[s],r,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Qt(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=Xg(t,this.transform_,this.pixelCoordinates_),n=e[2]-e[0],r=e[3]-e[1],s=Math.sqrt(n*n+r*r),o=this.context_;o.beginPath(),o.arc(e[0],e[1],s,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t);break}}drawFeature(t,e){const n=e.getGeometryFunction()(t);n&&(this.setStyle(e),this.drawGeometry(n))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let n=0,r=e.length;n<r;++n)this.drawGeometry(e[n])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),n=t.getStride();this.image_&&this.drawImages_(e,0,e.length,n),this.text_!==""&&this.drawText_(e,0,e.length,n)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),n=t.getStride();this.image_&&this.drawImages_(e,0,e.length,n),this.text_!==""&&this.drawText_(e,0,e.length,n)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Qt(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,n=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(n,0,n.length,t.getStride(),!1),e.stroke()}if(this.text_!==""){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(Qt(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const n=this.context_,r=t.getFlatCoordinates();let s=0;const o=t.getEnds(),a=t.getStride();n.beginPath();for(let l=0,h=o.length;l<h;++l)s=this.moveToLineTo_(r,s,o[l],a,!1);n.stroke()}if(this.text_!==""){const n=t.getFlatMidpoints();this.drawText_(n,0,n.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Qt(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Qt(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,n=t.getOrientedFlatCoordinates();let r=0;const s=t.getEndss(),o=t.getStride();e.beginPath();for(let a=0,l=s.length;a<l;++a){const h=s[a];r=this.drawRings_(n,r,h,o)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,n=this.contextFillState_;n?n.fillStyle!=t.fillStyle&&(n.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,n=this.contextStrokeState_;n?(n.lineCap!=t.lineCap&&(n.lineCap=t.lineCap,e.lineCap=t.lineCap),Bi(n.lineDash,t.lineDash)||e.setLineDash(n.lineDash=t.lineDash),n.lineDashOffset!=t.lineDashOffset&&(n.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),n.lineJoin!=t.lineJoin&&(n.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),n.lineWidth!=t.lineWidth&&(n.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),n.miterLimit!=t.miterLimit&&(n.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),n.strokeStyle!=t.strokeStyle&&(n.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,n=this.contextTextState_,r=t.textAlign?t.textAlign:qn;n?(n.font!=t.font&&(n.font=t.font,e.font=t.font),n.textAlign!=r&&(n.textAlign=r,e.textAlign=r),n.textBaseline!=t.textBaseline&&(n.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=r,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:r,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(!t)this.fillState_=null;else{const n=t.getColor();this.fillState_={fillStyle:ve(n||zt)}}if(!e)this.strokeState_=null;else{const n=e.getColor(),r=e.getLineCap(),s=e.getLineDash(),o=e.getLineDashOffset(),a=e.getLineJoin(),l=e.getWidth(),h=e.getMiterLimit(),c=s||Oe;this.strokeState_={lineCap:r!==void 0?r:nn,lineDash:this.pixelRatio_===1?c:c.map(u=>u*this.pixelRatio_),lineDashOffset:(o||Pe)*this.pixelRatio_,lineJoin:a!==void 0?a:rn,lineWidth:(l!==void 0?l:Kn)*this.pixelRatio_,miterLimit:h!==void 0?h:jn,strokeStyle:ve(n||Zn)}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}const n=t.getPixelRatio(this.pixelRatio_),r=t.getAnchor(),s=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*n,this.imageAnchorY_=r[1]*n,this.imageHeight_=e[1]*n,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const o=t.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/n,o[1]*this.pixelRatio_/n],this.imageWidth_=e[0]*n}setTextStyle(t){if(!t)this.text_="";else{const e=t.getFill();if(!e)this.textFillState_=null;else{const f=e.getColor();this.textFillState_={fillStyle:ve(f||zt)}}const n=t.getStroke();if(!n)this.textStrokeState_=null;else{const f=n.getColor(),g=n.getLineCap(),p=n.getLineDash(),_=n.getLineDashOffset(),y=n.getLineJoin(),m=n.getWidth(),x=n.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:nn,lineDash:p||Oe,lineDashOffset:_||Pe,lineJoin:y!==void 0?y:rn,lineWidth:m!==void 0?m:Kn,miterLimit:x!==void 0?x:jn,strokeStyle:ve(f||Zn)}}const r=t.getFont(),s=t.getOffsetX(),o=t.getOffsetY(),a=t.getRotateWithView(),l=t.getRotation(),h=t.getScaleArray(),c=t.getText(),u=t.getTextAlign(),d=t.getTextBaseline();this.textState_={font:r!==void 0?r:Ic,textAlign:u!==void 0?u:qn,textBaseline:d!==void 0?d:hs},this.text_=c!==void 0?Array.isArray(c)?c.reduce((f,g,p)=>f+=p%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_*h[0],this.pixelRatio_*h[1]]}}}const Gm=Xm,be=.5;function Wm(i,t,e,n,r,s,o,a,l){const h=l?Bo(r):r,c=i[0]*be,u=i[1]*be,d=Et(c,u);d.imageSmoothingEnabled=!1;const f=d.canvas,g=new Gm(d,be,r,null,o,a,l?Fo(xg(),l):null),p=e.length,_=Math.floor((256*256*256-1)/p),y={};for(let x=1;x<=p;++x){const E=e[x-1],T=E.getStyleFunction()||n;if(!T)continue;let b=T(E,s);if(!b)continue;Array.isArray(b)||(b=[b]);const S=(x*_).toString(16).padStart(7,"#00000");for(let R=0,P=b.length;R<P;++R){const M=b[R],D=M.getGeometryFunction()(E);if(!D||!Qt(h,D.getExtent()))continue;const k=M.clone(),L=k.getFill();L&&L.setColor(S);const F=k.getStroke();F&&(F.setColor(S),F.setLineDash(null)),k.setText(void 0);const A=M.getImage();if(A){const J=A.getImageSize();if(!J)continue;const lt=Et(J[0],J[1],void 0,{alpha:!1}),ft=lt.canvas;lt.fillStyle=S,lt.fillRect(0,0,ft.width,ft.height),k.setImage(new _s({img:ft,anchor:A.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:A.getOrigin(),opacity:1,size:A.getSize(),scale:A.getScale(),rotation:A.getRotation(),rotateWithView:A.getRotateWithView()}))}const Y=k.getZIndex()||0;let j=y[Y];j||(j={},y[Y]=j,j.Polygon=[],j.Circle=[],j.LineString=[],j.Point=[]);const ct=D.getType();if(ct==="GeometryCollection"){const J=D.getGeometriesArrayRecursive();for(let lt=0,ft=J.length;lt<ft;++lt){const ae=J[lt];j[ae.getType().replace("Multi","")].push(ae,k)}}else j[ct.replace("Multi","")].push(D,k)}}const m=Object.keys(y).map(Number).sort(Fi);for(let x=0,E=m.length;x<E;++x){const T=y[m[x]];for(const b in T){const w=T[b];for(let S=0,R=w.length;S<R;S+=2){g.setStyle(w[S+1]);for(let P=0,M=t.length;P<M;++P)g.setTransform(t[P]),g.drawGeometry(w[S])}}}return d.getImageData(0,0,f.width,f.height)}function Hm(i,t,e){const n=[];if(e){const r=Math.floor(Math.round(i[0])*be),s=Math.floor(Math.round(i[1])*be),o=(vt(r,0,e.width-1)+vt(s,0,e.height-1)*e.width)*4,a=e.data[o],l=e.data[o+1],c=e.data[o+2]+256*(l+256*a),u=Math.floor((256*256*256-1)/t.length);c&&c%u===0&&n.push(t[c/u-1])}return n}const zm=.5,Jc={Point:Qm,LineString:qm,Polygon:e0,MultiPoint:t0,MultiLineString:Km,MultiPolygon:Jm,GeometryCollection:Zm,Circle:Ym};function Vm(i,t){return parseInt(kt(i),10)-parseInt(kt(t),10)}function Qc(i,t){const e=tu(i,t);return e*e}function tu(i,t){return zm*i/t}function Ym(i,t,e,n,r){const s=e.getFill(),o=e.getStroke();if(s||o){const l=i.getBuilder(e.getZIndex(),"Circle");l.setFillStrokeStyle(s,o),l.drawCircle(t,n,r)}const a=e.getText();if(a&&a.getText()){const l=i.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,n)}}function eu(i,t,e,n,r,s,o,a){const l=[],h=e.getImage();if(h){let d=!0;const f=h.getImageState();f==V.LOADED||f==V.ERROR?d=!1:f==V.IDLE&&h.load(),d&&l.push(h.ready())}const c=e.getFill();c&&c.loading()&&l.push(c.ready());const u=l.length>0;return u&&Promise.all(l).then(()=>r(null)),jm(i,t,e,n,s,o,a),u}function jm(i,t,e,n,r,s,o){const a=e.getGeometryFunction()(t);if(!a)return;const l=a.simplifyTransformed(n,r);if(e.getRenderer())iu(i,l,e,t,o);else{const c=Jc[l.getType()];c(i,l,e,t,o,s)}}function iu(i,t,e,n,r){if(t.getType()=="GeometryCollection"){const o=t.getGeometries();for(let a=0,l=o.length;a<l;++a)iu(i,o[a],e,n,r);return}i.getBuilder(e.getZIndex(),"Default").drawCustom(t,n,e.getRenderer(),e.getHitDetectionRenderer(),r)}function Zm(i,t,e,n,r,s){const o=t.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a){const h=Jc[o[a].getType()];h(i,o[a],e,n,r,s)}}function qm(i,t,e,n,r){const s=e.getStroke();if(s){const a=i.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawLineString(t,n,r)}const o=e.getText();if(o&&o.getText()){const a=i.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,n,r)}}function Km(i,t,e,n,r){const s=e.getStroke();if(s){const a=i.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawMultiLineString(t,n,r)}const o=e.getText();if(o&&o.getText()){const a=i.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,n,r)}}function Jm(i,t,e,n,r){const s=e.getFill(),o=e.getStroke();if(o||s){const l=i.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawMultiPolygon(t,n,r)}const a=e.getText();if(a&&a.getText()){const l=i.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,n,r)}}function Qm(i,t,e,n,r,s){const o=e.getImage(),a=e.getText(),l=a&&a.getText(),h=s&&o&&l?{}:void 0;if(o){if(o.getImageState()!=V.LOADED)return;const c=i.getBuilder(e.getZIndex(),"Image");c.setImageStyle(o,h),c.drawPoint(t,n,r)}if(l){const c=i.getBuilder(e.getZIndex(),"Text");c.setTextStyle(a,h),c.drawText(t,n,r)}}function t0(i,t,e,n,r,s){const o=e.getImage(),a=o&&o.getOpacity()!==0,l=e.getText(),h=l&&l.getText(),c=s&&a&&h?{}:void 0;if(a){if(o.getImageState()!=V.LOADED)return;const u=i.getBuilder(e.getZIndex(),"Image");u.setImageStyle(o,c),u.drawMultiPoint(t,n,r)}if(h){const u=i.getBuilder(e.getZIndex(),"Text");u.setTextStyle(l,c),u.drawText(t,n,r)}}function e0(i,t,e,n,r){const s=e.getFill(),o=e.getStroke();if(s||o){const l=i.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawPolygon(t,n,r)}const a=e.getText();if(a&&a.getText()){const l=i.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,n,r)}}class i0 extends Om{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipped_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Ee(),this.wrappedRenderedExtent_=Ee(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,n){const r=e.extent,s=e.viewState,o=s.center,a=s.resolution,l=s.projection,h=s.rotation,c=l.getExtent(),u=this.getLayer().getSource(),d=this.getLayer().getDeclutter(),f=e.pixelRatio,g=e.viewHints,p=!(g[se.ANIMATING]||g[se.INTERACTING]),_=this.context,y=Math.round(ht(r)/a*f),m=Math.round(Jt(r)/a*f),x=u.getWrapX()&&l.canWrapX(),E=x?ht(c):null,T=x?Math.ceil((r[2]-c[2])/E)+1:1;let b=x?Math.floor((r[0]-c[0])/E):0;do{let w=this.getRenderTransform(o,a,0,f,y,m,b*E);e.declutter&&(w=w.slice(0)),t.execute(_,[_.canvas.width,_.canvas.height],w,h,p,n===void 0?ln:n?Kc:Fm,n?d&&e.declutter[d]:void 0)}while(++b<T)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Et(this.context.canvas.width,this.context.canvas.height,jc))}resetDrawContext_(){if(this.opacity_!==1){const t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,Yi(this.context),jc.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.replayGroup_.renderDeferred(),this.clipped_&&this.context.restore(),this.resetDrawContext_())}renderFrame(t,e){const n=t.layerStatesArray[t.layerIndex];this.opacity_=n.opacity;const r=t.viewState;this.prepareContainer(t,e);const s=this.context,o=this.replayGroup_;let a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(Kt.PRERENDER)||this.getLayer().hasListener(Kt.POSTRENDER)))return null;if(this.setDrawContext_(),this.preRender(s,t),r.projection,this.clipped_=!1,a&&n.extent&&this.clipping){const l=Ei(n.extent);a=Qt(l,t.extent),this.clipped_=a&&!Pn(l,t.extent),this.clipped_&&this.clipUnrotated(s,t,l)}return a&&this.renderWorlds(o,t,this.getLayer().getDeclutter()?!1:void 0),!t.declutter&&this.clipped_&&s.restore(),this.postRender(s,t),this.renderedRotation_!==r.rotation&&(this.renderedRotation_=r.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const n=this.frameState.size.slice(),r=this.renderedCenter_,s=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,h=this.getLayer(),c=[],u=n[0]*be,d=n[1]*be;c.push(this.getRenderTransform(r,s,o,be,u,d,0).slice());const f=h.getSource(),g=a.getExtent();if(f.getWrapX()&&a.canWrapX()&&!Pn(g,l)){let p=l[0];const _=ht(g);let y=0,m;for(;p<g[0];)--y,m=_*y,c.push(this.getRenderTransform(r,s,o,be,u,d,m).slice()),p+=_;for(y=0,p=l[2];p>g[2];)++y,m=_*y,c.push(this.getRenderTransform(r,s,o,be,u,d,m).slice()),p-=_}this.hitDetectionImageData_=Wm(n,c,this.renderedFeatures_,h.getStyleFunction(),l,s,o,Qc(s,this.renderedPixelRatio_),null)}e(Hm(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,n,r,s){if(!this.replayGroup_)return;const o=e.viewState.resolution,a=e.viewState.rotation,l=this.getLayer(),h={},c=function(g,p,_){const y=kt(g),m=h[y];if(m){if(m!==!0&&_<m.distanceSq){if(_===0)return h[y]=!0,s.splice(s.lastIndexOf(m),1),r(g,l,p);m.geometry=p,m.distanceSq=_}}else{if(_===0)return h[y]=!0,r(g,l,p);s.push(h[y]={feature:g,layer:l,geometry:p,distanceSq:_,callback:r})}};let u;const d=[this.replayGroup_],f=this.getLayer().getDeclutter();return d.some(g=>u=g.forEachFeatureAtCoordinate(t,o,a,n,c,f&&e.declutter[f]?e.declutter[f].all().map(p=>p.value):null)),u}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),n=e.getSource();if(!n)return!1;const r=t.viewHints[se.ANIMATING],s=t.viewHints[se.INTERACTING],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!o&&r||!a&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=t.extent,h=t.viewState,c=h.projection,u=h.resolution,d=t.pixelRatio,f=e.getRevision(),g=e.getRenderBuffer();let p=e.getRenderOrder();p===void 0&&(p=Vm);const _=h.center.slice(),y=Mo(l,g*u),m=y.slice(),x=[y.slice()],E=c.getExtent();if(n.getWrapX()&&c.canWrapX()&&!Pn(E,t.extent)){const L=ht(E),F=Math.max(ht(y)/2,L);y[0]=E[0]-F,y[2]=E[2]+F,cg(_,c);const A=rh(x[0],c);A[0]<E[0]&&A[2]<E[2]?x.push([A[0]+L,A[1],A[2]+L,A[3]]):A[0]>E[0]&&A[2]>E[2]&&x.push([A[0]-L,A[1],A[2]-L,A[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==f&&this.renderedRenderOrder_==p&&this.renderedFrameDeclutter_===!!t.declutter&&Pn(this.wrappedRenderedExtent_,y))return Bi(this.renderedExtent_,m)||(this.hitDetectionImageData_=null,this.renderedExtent_=m),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const T=new Dm(tu(u,d),y,u,d);let b;for(let L=0,F=x.length;L<F;++L)n.loadFeatures(x[L],u,c);const w=Qc(u,d);let S=!0;const R=(L,F)=>{let A;const Y=L.getStyleFunction()||e.getStyleFunction();if(Y&&(A=Y(L,u)),A){const j=this.renderFeature(L,w,A,T,b,this.getLayer().getDeclutter(),F);S=S&&!j}},P=Bo(y),M=n.getFeaturesInExtent(P);p&&M.sort(p);for(let L=0,F=M.length;L<F;++L)R(M[L],L);this.renderedFeatures_=M,this.ready=S;const D=T.finish(),k=new Bm(y,u,d,n.getOverlaps(),D,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=u,this.renderedRevision_=f,this.renderedRenderOrder_=p,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=m,this.wrappedRenderedExtent_=y,this.renderedCenter_=_,this.renderedProjection_=c,this.renderedPixelRatio_=d,this.replayGroup_=k,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,n,r,s,o,a){if(!n)return!1;let l=!1;if(Array.isArray(n))for(let h=0,c=n.length;h<c;++h)l=eu(r,t,n[h],e,this.boundHandleStyleImageChange_,s,o,a)||l;else l=eu(r,t,n,e,this.boundHandleStyleImageChange_,s,o,a);return l}}class nu extends xm{constructor(t){super(t)}createRenderer(){return new i0(this)}}function n0(i,t,e){const n=t.get("type")==="WebGLTile"||t instanceof rs,r=t.get("type")==="Vector"||t instanceof nu,s=n?t.style_:e.style;let o=s==null?void 0:s.variables;if(o){const a=ru(i);if(s.variables={...o,...a},r){const l=r0(s);t.setStyle(l)}else n&&t.updateStyleVariables(a)}}const ru=i=>{const t={};for(const e in i)if(typeof i[e]=="object"&&i[e]!==null){const n=ru(i[e]);for(const r in n)t[r]=n==null?void 0:n[r]}else t[e]=i==null?void 0:i[e];return t};function r0(i){let t=i;if("variables"in i){let e=JSON.stringify(i);const{variables:n}=i;for(const r in n)typeof n[r]=="number"?e=e.replaceAll(`["var","${r}"]`,n[r]):e=e.replaceAll(`["var","${r}"]`,`"${n[r]}"`);t=JSON.parse(e)}return t}var s0="Expected a function",su=NaN,o0="[object Symbol]",a0=/^\s+|\s+$/g,l0=/^[-+]0x[0-9a-f]+$/i,h0=/^0b[01]+$/i,c0=/^0o[0-7]+$/i,u0=parseInt,d0=typeof es=="object"&&es&&es.Object===Object&&es,f0=typeof self=="object"&&self&&self.Object===Object&&self,g0=d0||f0||Function("return this")(),p0=Object.prototype,_0=p0.toString,m0=Math.max,y0=Math.min,Oa=function(){return g0.Date.now()};function E0(i,t,e){var n,r,s,o,a,l,h=0,c=!1,u=!1,d=!0;if(typeof i!="function")throw new TypeError(s0);t=ou(t)||0,Pa(e)&&(c=!!e.leading,u="maxWait"in e,s=u?m0(ou(e.maxWait)||0,t):s,d="trailing"in e?!!e.trailing:d);function f(b){var w=n,S=r;return n=r=void 0,h=b,o=i.apply(S,w),o}function g(b){return h=b,a=setTimeout(y,t),c?f(b):o}function p(b){var w=b-l,S=b-h,R=t-w;return u?y0(R,s-S):R}function _(b){var w=b-l,S=b-h;return l===void 0||w>=t||w<0||u&&S>=s}function y(){var b=Oa();if(_(b))return m(b);a=setTimeout(y,p(b))}function m(b){return a=void 0,d&&n?f(b):(n=r=void 0,o)}function x(){a!==void 0&&clearTimeout(a),h=0,n=l=r=a=void 0}function E(){return a===void 0?o:m(Oa())}function T(){var b=Oa(),w=_(b);if(n=arguments,r=this,l=b,w){if(a===void 0)return g(l);if(u)return a=setTimeout(y,t),f(l)}return a===void 0&&(a=setTimeout(y,t)),o}return T.cancel=x,T.flush=E,T}function Pa(i){var t=typeof i;return!!i&&(t=="object"||t=="function")}function x0(i){return!!i&&typeof i=="object"}function T0(i){return typeof i=="symbol"||x0(i)&&_0.call(i)==o0}function ou(i){if(typeof i=="number")return i;if(T0(i))return su;if(Pa(i)){var t=typeof i.valueOf=="function"?i.valueOf():i;i=Pa(t)?t+"":t}if(typeof i!="string")return i===0?i:+i;i=i.replace(a0,"");var e=h0.test(i);return e||c0.test(i)?u0(i.slice(2),e?2:8):l0.test(i)?su:+i}var v0=E0;const au=hc(v0);class lu extends Yt{constructor(){super();ut(this,bs);ut(this,hn,{});ut(this,sr,null);ut(this,or);ut(this,ws,"");ut(this,Ss,"");this.layer=null,this.unstyled=!1,this.noShadow=!1,this.layerConfig=null,this.debouncedDataChange=au($t(this,bs,Du),1e3,{leading:!0})}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}render(){fr(this,sr,b_(this.layer,this.layerConfig)),customElements.get("eox-jsonform")||console.error("Please import @eox/jsonform in order to use layerconfig");const e={disable_edit_json:!0,disable_collapse:!0,disable_properties:!0};return q`
178
+ */function*Di(n,t){if(n!==void 0){let e=0;for(const i of n)yield t(i,e++)}}const wf=(n,t,e)=>{let i=t;return e.layer.getSource().getTileUrlFunction()&&(i||(i=e.layer.getSource().getTileUrlFunction()),e.layer.getSource().setTileUrlFunction((...r)=>Wu(i(...r),n)),e.layer.getSource().setKey(new Date)),i};function Cf(n,t,e){const i="updateStyleVariables"in t,r="setStyle"in t,s=i?t.style_:e.style;let o=s==null?void 0:s.variables;if(o){const a=ul(n);if(s.variables={...o,...a},i)t.updateStyleVariables(a);else if(r){const l=Sf(s);t.setStyle(l)}}}const ul=n=>{const t={};for(const e in n)if(typeof n[e]=="object"&&n[e]!==null){const i=ul(n[e]);for(const r in i)t[r]=i==null?void 0:i[r]}else t[e]=n==null?void 0:n[e];return t};function Sf(n){let t=n;if("variables"in n){let e=JSON.stringify(n);const{variables:i}=n;for(const r in i)typeof i[r]=="number"?e=e.replaceAll(`["var","${r}"]`,i[r]):e=e.replaceAll(`["var","${r}"]`,`"${i[r]}"`);t=JSON.parse(e)}return t}var Af="Expected a function",cl=NaN,If="[object Symbol]",$f=/^\s+|\s+$/g,Pf=/^[-+]0x[0-9a-f]+$/i,Mf=/^0b[01]+$/i,Of=/^0o[0-7]+$/i,Lf=parseInt,Df=typeof Pi=="object"&&Pi&&Pi.Object===Object&&Pi,Nf=typeof self=="object"&&self&&self.Object===Object&&self,Uf=Df||Nf||Function("return this")(),Ff=Object.prototype,Bf=Ff.toString,Xf=Math.max,Hf=Math.min,Ts=function(){return Uf.Date.now()};function Gf(n,t,e){var i,r,s,o,a,l,u=0,h=!1,c=!1,d=!0;if(typeof n!="function")throw new TypeError(Af);t=hl(t)||0,xs(e)&&(h=!!e.leading,c="maxWait"in e,s=c?Xf(hl(e.maxWait)||0,t):s,d="trailing"in e?!!e.trailing:d);function f(v){var C=i,w=r;return i=r=void 0,u=v,o=n.apply(w,C),o}function g(v){return u=v,a=setTimeout(y,t),h?f(v):o}function p(v){var C=v-l,w=v-u,I=t-C;return c?Hf(I,s-w):I}function m(v){var C=v-l,w=v-u;return l===void 0||C>=t||C<0||c&&w>=s}function y(){var v=Ts();if(m(v))return _(v);a=setTimeout(y,p(v))}function _(v){return a=void 0,d&&i?f(v):(i=r=void 0,o)}function T(){a!==void 0&&clearTimeout(a),u=0,i=l=r=a=void 0}function E(){return a===void 0?o:_(Ts())}function b(){var v=Ts(),C=m(v);if(i=arguments,r=this,l=v,C){if(a===void 0)return g(l);if(c)return a=setTimeout(y,t),f(l)}return a===void 0&&(a=setTimeout(y,t)),o}return b.cancel=T,b.flush=E,b}function xs(n){var t=typeof n;return!!n&&(t=="object"||t=="function")}function kf(n){return!!n&&typeof n=="object"}function Vf(n){return typeof n=="symbol"||kf(n)&&Bf.call(n)==If}function hl(n){if(typeof n=="number")return n;if(Vf(n))return cl;if(xs(n)){var t=typeof n.valueOf=="function"?n.valueOf():n;n=xs(t)?t+"":t}if(typeof n!="string")return n===0?n:+n;n=n.replace($f,"");var e=Mf.test(n);return e||Of.test(n)?Lf(n.slice(2),e?2:8):Pf.test(n)?cl:+n}var jf=Gf;const dl=za(jf);class fl extends Mt{constructor(){super();tt(this,Ni);tt(this,on,{});tt(this,Hn,null);tt(this,Gn);tt(this,Ui,"");tt(this,Fi,"");this.layer=null,this.unstyled=!1,this.noShadow=!1,this.layerConfig=null,this.debouncedDataChange=dl(vt(this,Ni,Cl),1e3,{leading:!0})}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}render(){Wn(this,Hn,yf(this.layer,this.layerConfig)),customElements.get("eox-jsonform")||console.error("Please import @eox/jsonform in order to use layerconfig");const e={disable_edit_json:!0,disable_collapse:!0,disable_properties:!0};return B`
187
179
  <style>
188
- ${gt(this,ws)}
189
- ${!this.unstyled&&gt(this,Ss)}
180
+ ${nt(this,Ui)}
181
+ ${!this.unstyled&&nt(this,Fi)}
190
182
  </style>
191
- ${ne(this.layerConfig,()=>q`
183
+ ${Ut(this.layerConfig,()=>B`
192
184
  <!-- Render a JSON form for layer configuration -->
193
185
  <eox-jsonform
194
186
  .schema=${this.layerConfig.schema}
195
- .value=${gt(this,sr)}
187
+ .value=${nt(this,Hn)}
196
188
  .options=${e}
197
189
  @change=${this.debouncedDataChange}
198
190
  ></eox-jsonform>
199
191
  `)}
200
- `}}hn=new WeakMap,sr=new WeakMap,or=new WeakMap,bs=new WeakSet,Du=function(e){fr(this,hn,e.detail),this.layerConfig.type==="style"||this.layerConfig.style?["Vector","WebGLTile"].includes(this.layer.get("type"))||this.layer instanceof nu||this.layer instanceof rs?n0(gt(this,hn),this.layer,this.layerConfig):console.error(`Layer type ${this.layer.get("type")} does not support styles configuration`):(fr(this,or,M_(gt(this,hn),gt(this,or),this)),this.requestUpdate())},ws=new WeakMap,Ss=new WeakMap,bt(lu,"properties",{layer:{attribute:!1},unstyled:{type:Boolean},noShadow:{type:Boolean},layerConfig:{attribute:!1}}),customElements.define("eox-layercontrol-layerconfig",lu);class hu extends Yt{constructor(){super();ut(this,ar,e=>this.selectedTab===e&&"highlighted");ut(this,Rs,`
192
+ `}}on=new WeakMap,Hn=new WeakMap,Gn=new WeakMap,Ni=new WeakSet,Cl=function(e){Wn(this,on,e.detail),this.layerConfig.type==="style"||this.layerConfig.style?"setStyle"in this.layer||"updateStyleVariables"in this.layer?Cf(nt(this,on),this.layer,this.layerConfig):console.error(`Layer type ${this.layer.get("type")??""} does not support styles configuration`):(Wn(this,Gn,wf(nt(this,on),nt(this,Gn),this)),this.requestUpdate())},Ui=new WeakMap,Fi=new WeakMap,ht(fl,"properties",{layer:{attribute:!1},unstyled:{type:Boolean},noShadow:{type:Boolean},layerConfig:{attribute:!1}}),customElements.define("eox-layercontrol-layerconfig",fl);class gl extends Mt{constructor(){super();tt(this,kn,e=>this.selectedTab===e&&"highlighted");tt(this,Bi,`
201
193
  .tabbed figure {
202
194
  margin: 0;
203
195
  }
@@ -217,7 +209,7 @@ ${r}
217
209
  .tabbed label.highlighted {
218
210
  background: lightgrey;
219
211
  }
220
- `);ut(this,Cs,`
212
+ `);tt(this,Xi,`
221
213
  .tabbed {
222
214
  font-size: small;
223
215
  }
@@ -238,20 +230,20 @@ ${r}
238
230
  background: #00417011;
239
231
  border-top: 1px solid #0041701a;
240
232
  }
241
- `);this.actions=[],this.selectedTab=0,this.tabs=[],this.unstyled=!1,this.noShadow=!1}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}render(){const e=this.tabs,n=this.actions,r=n.length+e.length>1;return q`
233
+ `);this.actions=[],this.selectedTab=0,this.tabs=[],this.unstyled=!1,this.noShadow=!1}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}render(){const e=this.tabs,i=this.actions,r=i.length+e.length>1;return B`
242
234
  <style>
243
- ${gt(this,Rs)}
244
- ${!this.unstyled&&gt(this,Cs)}
235
+ ${nt(this,Bi)}
236
+ ${!this.unstyled&&nt(this,Xi)}
245
237
  </style>
246
238
  <div class="tabbed">
247
239
  <!-- Navigation for tabs and actions -->
248
- ${ne(r,()=>q`
240
+ ${Ut(r,()=>B`
249
241
  <nav>
250
242
  <div>
251
243
  <!-- Labels for tabs -->
252
- ${ss(e,(s,o)=>q`
244
+ ${Di(e,(s,o)=>B`
253
245
  <label
254
- class=${gt(this,ar).call(this,o)}
246
+ class=${nt(this,kn).call(this,o)}
255
247
  @click=${()=>this.selectedTab=o}
256
248
  >
257
249
  <!-- Customizable icon for each tab -->
@@ -261,7 +253,7 @@ ${r}
261
253
  </div>
262
254
  <div>
263
255
  <!-- Icons for actions -->
264
- ${ss(n,s=>q`
256
+ ${Di(i,s=>B`
265
257
  <span>
266
258
  <!-- Customizable icon for each action -->
267
259
  <slot name=${`${s}-icon`}>${s}</slot>
@@ -272,15 +264,15 @@ ${r}
272
264
  `)}
273
265
  <figure>
274
266
  <!-- Content for each tab -->
275
- ${ss(e,(s,o)=>q`
276
- <div class="tab ${gt(this,ar).call(this,o)}">
267
+ ${Di(e,(s,o)=>B`
268
+ <div class="tab ${nt(this,kn).call(this,o)}">
277
269
  <!-- Content slot for each tab -->
278
270
  <slot name=${`${s}-content`}>${s}</slot>
279
271
  </div>
280
272
  `)}
281
273
  </figure>
282
274
  </div>
283
- `}}ar=new WeakMap,Rs=new WeakMap,Cs=new WeakMap,bt(hu,"properties",{actions:{attribute:!1},selectedTab:{state:!0},tabs:{attribute:!1},unstyled:{type:Boolean},noShadow:{type:Boolean}}),customElements.define("eox-layercontrol-tabs",hu);const b0=`
275
+ `}}kn=new WeakMap,Bi=new WeakMap,Xi=new WeakMap,ht(gl,"properties",{actions:{attribute:!1},selectedTab:{state:!0},tabs:{attribute:!1},unstyled:{type:Boolean},noShadow:{type:Boolean}}),customElements.define("eox-layercontrol-tabs",gl);const zf=`
284
276
  button,
285
277
  .button {
286
278
  /* TODO: why does this only work here and not from :root? */
@@ -404,7 +396,7 @@ button.smallest.icon::before {
404
396
  width: 16px;
405
397
  padding: 0px;
406
398
  }
407
- `,w0=`
399
+ `,Wf=`
408
400
  input[type=radio] {
409
401
  appearance: none;
410
402
  -webkit-appearance: none;
@@ -432,7 +424,7 @@ input[type=radio]:checked:after {
432
424
  content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23004170' viewBox='0 0 24 24'%3E%3Ctitle%3Eradiobox-marked%3C/title%3E%3Cpath d='M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,7A5,5 0 0,0 7,12A5,5 0 0,0 12,17A5,5 0 0,0 17,12A5,5 0 0,0 12,7Z' /%3E%3C/svg%3E");
433
425
 
434
426
  }
435
- `,cu=`
427
+ `,pl=`
436
428
  input[type=checkbox] {
437
429
  appearance: none;
438
430
  -webkit-appearance: none;
@@ -455,7 +447,7 @@ input[type=checkbox]:checked:after {
455
447
  content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23004170' viewBox='0 0 24 24'%3E%3Ctitle%3Echeckbox-marked%3C/title%3E%3Cpath d='M10,17L5,12L6.41,10.58L10,14.17L17.59,6.58L19,8M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z' /%3E%3C/svg%3E");
456
448
 
457
449
  }
458
- `,S0=`
450
+ `,Yf=`
459
451
  input[type="range"] {
460
452
  -webkit-appearance: none;
461
453
  width: 90%;
@@ -532,11 +524,11 @@ input[type="range"]:focus::-webkit-slider-thumb {
532
524
  input::-moz-focus-inner, input::-moz-focus-outer {
533
525
  border: 0;
534
526
  }
535
- `;class uu extends Yt{constructor(){super();bt(this,"_removeButton",()=>C_(this));bt(this,"_sortButton",()=>I_(this.unstyled));bt(this,"_button",e=>R_(e,this.unstyled));ut(this,Is,"");ut(this,As,`
536
- ${b0}
537
- ${w0}
538
- ${cu}
539
- ${S0}
527
+ `;class ml extends Mt{constructor(){super();ht(this,"_removeButton",()=>Tf(this));ht(this,"_sortButton",()=>xf(this.unstyled));ht(this,"_button",e=>vf(e,this.unstyled));tt(this,Hi,"");tt(this,Gi,`
528
+ ${zf}
529
+ ${Wf}
530
+ ${pl}
531
+ ${Yf}
540
532
  .drag-handle {
541
533
  cursor: n-resize;
542
534
  }
@@ -628,20 +620,20 @@ input::-moz-focus-inner, input::-moz-focus-outer {
628
620
  [slot=opacity-content] {
629
621
  padding: 12px 6px;
630
622
  }
631
- `);this.layer=null,this.tools=[],this.unstyled=!1,this.noShadow=!1}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}render(){var l;const e=w_(this.tools,this.layer),n=S_(this.tools,this.layer),r=this[`_${e==null?void 0:e[0]}Button`]?this[`_${e==null?void 0:e[0]}Button`]():at,s=((l=this.tools)==null?void 0:l.length)===1?`${this.tools[0]}-icon`:"",o=e==null?void 0:e.length,a=n==null?void 0:n.length;return q`
623
+ `);this.layer=null,this.tools=[],this.unstyled=!1,this.noShadow=!1}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}render(){var l;const e=Ef(this.tools,this.layer),i=bf(this.tools,this.layer),r=this[`_${e==null?void 0:e[0]}Button`]?this[`_${e==null?void 0:e[0]}Button`]():K,s=((l=this.tools)==null?void 0:l.length)===1?`${this.tools[0]}-icon`:"",o=e==null?void 0:e.length,a=i==null?void 0:i.length;return B`
632
624
  <style>
633
- ${gt(this,Is)}
634
- ${!this.unstyled&&gt(this,As)}
625
+ ${nt(this,Hi)}
626
+ ${!this.unstyled&&nt(this,Gi)}
635
627
  </style>
636
- ${ne(o+a>0,()=>q`
637
- ${ne(o===1&&a===0,()=>q`
628
+ ${Ut(o+a>0,()=>B`
629
+ ${Ut(o===1&&a===0,()=>B`
638
630
  <div class="single-action-container">
639
631
  <div class="single-action">${r}</div>
640
632
  </div>
641
- `,()=>{var h;return q`
633
+ `,()=>{var u;return B`
642
634
  <details
643
635
  class="tools"
644
- open=${this.layer.get("layerControlToolsExpand")||at}
636
+ open=${this.layer.get("layerControlToolsExpand")||K}
645
637
  >
646
638
  <summary>
647
639
  <button class="icon ${s}">Tools</button>
@@ -649,14 +641,14 @@ input::-moz-focus-inner, input::-moz-focus-outer {
649
641
  <eox-layercontrol-tabs
650
642
  .noShadow=${!1}
651
643
  .actions=${e}
652
- .tabs=${n}
644
+ .tabs=${i}
653
645
  .unstyled=${this.unstyled}
654
646
  >
655
647
  <!-- Rendering tabs and content -->
656
- ${ss(n,c=>this._button(c))}
648
+ ${Di(i,h=>this._button(h))}
657
649
 
658
650
  <div slot="info-content">
659
- ${A_(this.layer.get("description"))}
651
+ ${Rf(this.layer.get("description"))}
660
652
  </div>
661
653
  <div slot="opacity-content">
662
654
  <!-- Input for opacity -->
@@ -665,13 +657,13 @@ input::-moz-focus-inner, input::-moz-focus-outer {
665
657
  min="0"
666
658
  max="1"
667
659
  step="0.01"
668
- value=${bc((h=this.layer)==null?void 0:h.getOpacity())}
669
- @input=${c=>this.layer.setOpacity(parseFloat(c.target.value))}
660
+ value=${ll((u=this.layer)==null?void 0:u.getOpacity())}
661
+ @input=${h=>this.layer.setOpacity(parseFloat(h.target.value))}
670
662
  />
671
663
  </div>
672
664
  <div slot="config-content">
673
665
  <!-- Layer configuration -->
674
- ${ne(this.layer.get("layerConfig"),()=>q`
666
+ ${Ut(this.layer.get("layerConfig"),()=>B`
675
667
  <eox-layercontrol-layerconfig
676
668
  slot="config-content"
677
669
  .layer=${this.layer}
@@ -688,8 +680,8 @@ input::-moz-focus-inner, input::-moz-focus-outer {
688
680
  </details>
689
681
  `})}
690
682
  `)}
691
- `}}Is=new WeakMap,As=new WeakMap,bt(uu,"properties",{layer:{attribute:!1},tools:{attribute:!1},unstyled:{type:Boolean},noShadow:{type:Boolean}}),customElements.define("eox-layercontrol-layer-tools",uu);const R0=i=>{const t=()=>{const e=Mf(i.layer,i.map,i.showLayerZoomState);let n=!1;!e&&i.currLayerVisibilityBasedOnZoom?(i.currLayerVisibilityBasedOnZoom=!1,n=!0):e&&!i.currLayerVisibilityBasedOnZoom&&(i.currLayerVisibilityBasedOnZoom=!0,n=!0),n&&(i.requestUpdate(),i.dispatchEvent(new CustomEvent("change:resolution",{bubbles:!0})))};Vl(i.layer,i.showLayerZoomState)&&(t(),i.map.getView().on("change:resolution",()=>t()))},C0=(i,t)=>{const e=t.layer;e.setVisible(i.target.checked),i.target.checked&&e.get("layerControlExclusive")&&t.closest(".layers > ul").querySelectorAll("eox-layercontrol-layer").forEach(r=>{var s;r.layer!==e&&((s=r.layer)!=null&&s.get("layerControlExclusive"))&&(r.layer.setVisible(!1),r.requestUpdate())}),t.dispatchEvent(new CustomEvent("changed",{bubbles:!0,detail:e})),t.requestUpdate()};class du extends Yt{constructor(){super();ut(this,ai);bt(this,"currLayerVisibilityBasedOnZoom",!0);ut(this,Ms,"");ut(this,Ds,`
692
- ${cu}
683
+ `}}Hi=new WeakMap,Gi=new WeakMap,ht(ml,"properties",{layer:{attribute:!1},tools:{attribute:!1},unstyled:{type:Boolean},noShadow:{type:Boolean}}),customElements.define("eox-layercontrol-layer-tools",ml);const Zf=n=>{const t=()=>{const e=Rc(n.layer,n.map,n.showLayerZoomState);let i=!1;!e&&n.currLayerVisibilityBasedOnZoom?(n.currLayerVisibilityBasedOnZoom=!1,i=!0):e&&!n.currLayerVisibilityBasedOnZoom&&(n.currLayerVisibilityBasedOnZoom=!0,i=!0),i&&(n.requestUpdate(),n.dispatchEvent(new CustomEvent("change:resolution",{bubbles:!0})))};$o(n.layer,n.showLayerZoomState)&&(t(),n.map.getView().on("change:resolution",()=>t()))},Kf=(n,t)=>{const e=t.layer;e.setVisible(n.target.checked),n.target.checked&&e.get("layerControlExclusive")&&t.closest(".layers > ul").querySelectorAll("eox-layercontrol-layer").forEach(r=>{var s;r.layer!==e&&((s=r.layer)!=null&&s.get("layerControlExclusive"))&&(r.layer.setVisible(!1),r.requestUpdate())}),t.dispatchEvent(new CustomEvent("changed",{bubbles:!0,detail:e})),t.requestUpdate()};class _l extends Mt{constructor(){super();tt(this,Ee);ht(this,"currLayerVisibilityBasedOnZoom",!0);tt(this,ki,"");tt(this,Vi,`
684
+ ${pl}
693
685
  eox-layercontrol-layer {
694
686
  width: 100%;
695
687
  }
@@ -729,25 +721,25 @@ input::-moz-focus-inner, input::-moz-focus-outer {
729
721
  [data-type=draw] .title::before {
730
722
  content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%230041703a' viewBox='0 0 24 24'%3E%3Ctitle%3Evector-square-edit%3C/title%3E%3Cpath d='M22.7 14.4L21.7 15.4L19.6 13.3L20.6 12.3C20.8 12.1 21.2 12.1 21.4 12.3L22.7 13.6C22.9 13.8 22.9 14.1 22.7 14.4M13 19.9L19.1 13.8L21.2 15.9L15.1 22H13V19.9M11 19.9V19.1L11.6 18.5L12.1 18H8V16H6V8H8V6H16V8H18V12.1L19.1 11L19.3 10.8C19.5 10.6 19.8 10.4 20.1 10.3V8H22.1V2H16.1V4H8V2H2V8H4V16H2V22H8V20L11 19.9M18 4H20V6H18V4M4 4H6V6H4V4M6 20H4V18H6V20Z' /%3E%3C/svg%3E");
731
723
  }
732
- `);this.layer=null,this.map=null,this.titleProperty="title",this.showLayerZoomState=!1,this.tools=[],this.unstyled=!1,this.noShadow=!1}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}firstUpdated(){R0(this)}render(){var l;const e=this.layer.getVisible(),n=e?"visible":"",r=this.currLayerVisibilityBasedOnZoom?"":"zoom-state-invisible",s=$t(this,ai,zs).call(this,"layerControlDisable")?"disabled":"",o=$t(this,ai,zs).call(this,"layerControlExclusive")?"radio":"checkbox",a=((l=this.tools)==null?void 0:l.length)>0;return q`
724
+ `);this.layer=null,this.map=null,this.titleProperty="title",this.showLayerZoomState=!1,this.tools=[],this.unstyled=!1,this.noShadow=!1}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}firstUpdated(){Zf(this)}render(){var l;const e=this.layer.getVisible(),i=e?"visible":"",r=this.currLayerVisibilityBasedOnZoom?"":"zoom-state-invisible",s=vt(this,Ee,tr).call(this,"layerControlDisable")?"disabled":"",o=vt(this,Ee,tr).call(this,"layerControlExclusive")?"radio":"checkbox",a=((l=this.tools)==null?void 0:l.length)>0;return B`
733
725
  <style>
734
- ${gt(this,Ms)}
735
- ${!this.unstyled&&gt(this,Ds)}
726
+ ${nt(this,ki)}
727
+ ${!this.unstyled&&nt(this,Vi)}
736
728
  </style>
737
- ${ne(this.layer,()=>q`
729
+ ${Ut(this.layer,()=>B`
738
730
  <!-- Render the layer -->
739
- <div class="layer ${n} ${r}">
731
+ <div class="layer ${i} ${r}">
740
732
  <label class="drag-handle ${s}">
741
733
  <!-- Input element for layer visibility -->
742
734
  <input
743
735
  type=${o}
744
- .checked=${bc(e)}
745
- @click=${$t(this,ai,Lu)}
736
+ .checked=${ll(e)}
737
+ @click=${vt(this,Ee,Sl)}
746
738
  />
747
739
 
748
740
  <!-- Layer title -->
749
- <span class="title">${$t(this,ai,zs).call(this,this.titleProperty)}</span>
750
- ${ne(a,()=>q`<span class="tools-placeholder"></span>`)}
741
+ <span class="title">${vt(this,Ee,tr).call(this,this.titleProperty)}</span>
742
+ ${Ut(a,()=>B`<span class="tools-placeholder"></span>`)}
751
743
  </label>
752
744
  </div>
753
745
 
@@ -759,7 +751,7 @@ input::-moz-focus-inner, input::-moz-focus-outer {
759
751
  .unstyled=${this.unstyled}
760
752
  ></eox-layercontrol-layer-tools>
761
753
  `)}
762
- `}}ai=new WeakSet,zs=function(e){var n;return(n=this.layer)==null?void 0:n.get(e)},Lu=function(e){C0(e,this)},Ms=new WeakMap,Ds=new WeakMap,bt(du,"properties",{layer:{attribute:!1},map:{attribute:!1,state:!0},titleProperty:{attribute:"title-property",type:String},showLayerZoomState:{attribute:"show-layer-zoom-state",type:Boolean},tools:{attribute:!1},unstyled:{type:Boolean},noShadow:{type:Boolean}}),customElements.define("eox-layercontrol-layer",du);class fu extends Yt{constructor(){super();ut(this,Ls,"");ut(this,Os,`
754
+ `}}Ee=new WeakSet,tr=function(e){var i;return(i=this.layer)==null?void 0:i.get(e)},Sl=function(e){Kf(e,this)},ki=new WeakMap,Vi=new WeakMap,ht(_l,"properties",{layer:{attribute:!1},map:{attribute:!1,state:!0},titleProperty:{attribute:"title-property",type:String},showLayerZoomState:{attribute:"show-layer-zoom-state",type:Boolean},tools:{attribute:!1},unstyled:{type:Boolean},noShadow:{type:Boolean}}),customElements.define("eox-layercontrol-layer",_l);class yl extends Mt{constructor(){super();tt(this,ji,"");tt(this,zi,`
763
755
  details summary {
764
756
  cursor: pointer;
765
757
  display: flex;
@@ -783,16 +775,16 @@ input::-moz-focus-inner, input::-moz-focus-outer {
783
775
  details[data-children-length="0"] summary::before {
784
776
  display: none;
785
777
  }
786
- `);this.group=null,this.idProperty="id",this.map=null,this.titleProperty="title",this.showLayerZoomState=!1,this.tools=[],this.unstyled=!1,this.noShadow=!1}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}render(){var r,s;const e=!!((r=this.group)!=null&&r.get("layerControlExpand")),n=(s=vc(this.group.getLayers()))==null?void 0:s.length;return q`
778
+ `);this.group=null,this.idProperty="id",this.map=null,this.titleProperty="title",this.showLayerZoomState=!1,this.tools=[],this.unstyled=!1,this.noShadow=!1}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}render(){var r,s;const e=!!((r=this.group)!=null&&r.get("layerControlExpand")),i=(s=al(this.group.getLayers()))==null?void 0:s.length;return B`
787
779
  <style>
788
- ${gt(this,Ls)}
789
- ${!this.unstyled&&gt(this,Os)}
780
+ ${nt(this,ji)}
781
+ ${!this.unstyled&&nt(this,zi)}
790
782
  </style>
791
- ${ne(this.group,()=>q`
783
+ ${Ut(this.group,()=>B`
792
784
  <!-- Render the details element with the layer control -->
793
785
  <details
794
- open=${e||at}
795
- data-children-length=${n}
786
+ open=${e||K}
787
+ data-children-length=${i}
796
788
  >
797
789
  <summary>
798
790
  <!-- Render the layer control within the summary -->
@@ -822,7 +814,7 @@ input::-moz-focus-inner, input::-moz-focus-outer {
822
814
  ></eox-layercontrol-layer-list>
823
815
  </details>
824
816
  `)}
825
- `}}Ls=new WeakMap,Os=new WeakMap,bt(fu,"properties",{group:{attribute:!1},idProperty:{attribute:"id-property"},map:{attribute:!1,state:!0},titleProperty:{attribute:"title-property",type:String},showLayerZoomState:{attribute:"show-layer-zoom-state",type:Boolean},tools:{attribute:!1},unstyled:{type:Boolean},noShadow:{type:Boolean}}),customElements.define("eox-layercontrol-layer-group",fu);const I0=i=>{const{layers:t,idProperty:e,titleProperty:n,renderRoot:r}=i,s=au(()=>{i.requestUpdate(),i.dispatchEvent(new CustomEvent("changed",{bubbles:!0}))},50),o=()=>s();if(t&&(t.hasListener("change:length")&&(t==null||t.un("change:length",o)),t.on("change:length",o),t)){const a=r.querySelector("ul");Af(t,e,n,i),If(a,t,e,i)}};class gu extends Yt{constructor(){super();ut(this,Ps,"");ut(this,$s,`
817
+ `}}ji=new WeakMap,zi=new WeakMap,ht(yl,"properties",{group:{attribute:!1},idProperty:{attribute:"id-property"},map:{attribute:!1,state:!0},titleProperty:{attribute:"title-property",type:String},showLayerZoomState:{attribute:"show-layer-zoom-state",type:Boolean},tools:{attribute:!1},unstyled:{type:Boolean},noShadow:{type:Boolean}}),customElements.define("eox-layercontrol-layer-group",yl);const qf=n=>{const{layers:t,idProperty:e,titleProperty:i,renderRoot:r}=n,s=dl(()=>{n.requestUpdate(),n.dispatchEvent(new CustomEvent("changed",{bubbles:!0}))},50),o=()=>s();if(t&&(t.hasListener("change:length")&&(t==null||t.un("change:length",o)),t.on("change:length",o),t)){const a=r.querySelector("ul");xc(t,e,i,n),Tc(a,t,e,n)}};class El extends Mt{constructor(){super();tt(this,Wi,"");tt(this,Yi,`
826
818
  ul {
827
819
  padding: 0;
828
820
  margin: 0;
@@ -850,22 +842,22 @@ input::-moz-focus-inner, input::-moz-focus-outer {
850
842
  }
851
843
  li.sortable-ghost {
852
844
  }
853
- `);this.idProperty="id",this.layers=null,this.map=null,this.tools=void 0,this.titleProperty="title",this.showLayerZoomState=!1,this.unstyled=!1,this.noShadow=!1}firstUpdated(){I0(this)}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}render(){const e=this.layers?vc(this.layers).reverse():[];return q`
845
+ `);this.idProperty="id",this.layers=null,this.map=null,this.tools=void 0,this.titleProperty="title",this.showLayerZoomState=!1,this.unstyled=!1,this.noShadow=!1}firstUpdated(){qf(this)}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}render(){const e=this.layers?al(this.layers).reverse():[];return B`
854
846
  <style>
855
- ${gt(this,Ps)}
856
- ${!this.unstyled&&gt(this,$s)}
847
+ ${nt(this,Wi)}
848
+ ${!this.unstyled&&nt(this,Yi)}
857
849
  </style>
858
850
  <ul>
859
- ${ne(this.layers,()=>q`
860
- ${nd(e,n=>n,n=>q`
851
+ ${Ut(this.layers,()=>B`
852
+ ${Jl(e,i=>i,i=>B`
861
853
  <li
862
- data-layer="${n.get(this.idProperty)}"
863
- data-type="${Df(n,this.map)}"
854
+ data-layer="${i.get(this.idProperty)}"
855
+ data-type="${wc(i,this.map)}"
864
856
  >
865
- ${n.getLayers?q`
857
+ ${i.getLayers?B`
866
858
  <eox-layercontrol-layer-group
867
859
  .noShadow=${!0}
868
- .group=${n}
860
+ .group=${i}
869
861
  .idProperty=${this.idProperty}
870
862
  .map=${this.map}
871
863
  .titleProperty=${this.titleProperty}
@@ -875,10 +867,10 @@ input::-moz-focus-inner, input::-moz-focus-outer {
875
867
  @changed=${()=>this.requestUpdate()}
876
868
  >
877
869
  </eox-layercontrol-layer-group>
878
- `:q`
870
+ `:B`
879
871
  <eox-layercontrol-layer
880
872
  .noShadow=${!0}
881
- .layer=${n}
873
+ .layer=${i}
882
874
  .map=${this.map}
883
875
  .titleProperty=${this.titleProperty}
884
876
  .showLayerZoomState=${this.showLayerZoomState}
@@ -891,7 +883,7 @@ input::-moz-focus-inner, input::-moz-focus-outer {
891
883
  `)}
892
884
  `)}
893
885
  </ul>
894
- `}}Ps=new WeakMap,$s=new WeakMap,bt(gu,"properties",{idProperty:{attribute:"id-property"},layers:{attribute:!1},map:{attribute:!1,state:!0},titleProperty:{attribute:"title-property",type:String},showLayerZoomState:{attribute:"show-layer-zoom-state",type:Boolean},tools:{attribute:!1},unstyled:{type:Boolean},noShadow:{type:Boolean}}),customElements.define("eox-layercontrol-layer-list",gu);const A0=i=>{const t=i.querySelector("select[name=optional]"),e=t?t.value:null,n=wo(i.layers.getArray(),"layerControlOptional",!0).find(r=>(r.get(i.idProperty)||r.ol_uid)===e);n==null||n.set("layerControlOptional",!1),n==null||n.setVisible(!0),i.dispatchEvent(new CustomEvent("changed",{bubbles:!0})),i.renderRoot.parentNode.querySelectorAll("eox-layercontrol-layer-list").forEach(r=>r.requestUpdate()),i.requestUpdate()};class pu extends Yt{constructor(){super();ut(this,Ns);this.idProperty="id",this.layers=null,this.titleProperty="title",this.unstyled=!1,this.noShadow=!1}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}render(){const e=wo(this.layers.getArray(),"layerControlOptional",!0);return q`
886
+ `}}Wi=new WeakMap,Yi=new WeakMap,ht(El,"properties",{idProperty:{attribute:"id-property"},layers:{attribute:!1},map:{attribute:!1,state:!0},titleProperty:{attribute:"title-property",type:String},showLayerZoomState:{attribute:"show-layer-zoom-state",type:Boolean},tools:{attribute:!1},unstyled:{type:Boolean},noShadow:{type:Boolean}}),customElements.define("eox-layercontrol-layer-list",El);const Jf=n=>{const t=n.querySelector("select[name=optional]"),e=t?t.value:null,i=Mr(n.layers.getArray(),"layerControlOptional",!0).find(r=>(r.get(n.idProperty)||r.ol_uid)===e);i==null||i.set("layerControlOptional",!1),i==null||i.setVisible(!0),n.dispatchEvent(new CustomEvent("changed",{bubbles:!0})),n.renderRoot.parentNode.querySelectorAll("eox-layercontrol-layer-list").forEach(r=>r.requestUpdate()),n.requestUpdate()};class bl extends Mt{constructor(){super();tt(this,Zi);this.idProperty="id",this.layers=null,this.titleProperty="title",this.unstyled=!1,this.noShadow=!1}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}render(){const e=Mr(this.layers.getArray(),"layerControlOptional",!0);return B`
895
887
  <!-- Label for the dropdown -->
896
888
  <label for="optional">Optional layers</label>
897
889
 
@@ -903,19 +895,19 @@ input::-moz-focus-inner, input::-moz-focus-outer {
903
895
  </option>
904
896
 
905
897
  <!-- Mapping through filtered layers list to generate dropdown options -->
906
- ${e.map(n=>{const r=n.get(this.idProperty)||n.ol_uid,s=n.get(this.titleProperty),o=`layer ${n.get(this.idProperty)}`;return q` <option value="${r}">${s||o}</option> `})}
898
+ ${e.map(i=>{const r=i.get(this.idProperty)||i.ol_uid,s=i.get(this.titleProperty),o=`layer ${i.get(this.idProperty)}`;return B` <option value="${r}">${s||o}</option> `})}
907
899
  </select>
908
900
 
909
901
  <!-- Button to handle adding layers -->
910
- <button @click="${$t(this,Ns,Ou)}">add</button>
911
- `}}Ns=new WeakSet,Ou=function(){A0(this)},bt(pu,"properties",{idProperty:{attribute:"id-property"},layers:{attribute:!1},titleProperty:{attribute:"title-property",type:String},unstyled:{type:Boolean},noShadow:{type:Boolean}}),customElements.define("eox-layercontrol-optional-list",pu);const M0=(i,t)=>{t.jsonInput=i.target.value,t.requestUpdate()},_u=i=>{const t=JSON.parse(`{"data":${vl(i.jsonInput)}}`);Array.isArray(t.data)?t.data.forEach(e=>{i.eoxMap.addOrUpdateLayer(e)}):i.eoxMap.addOrUpdateLayer(t.data),i.jsonInput=null,i.requestUpdate()},D0=(i,t)=>{t.urlInput=i.target.value,t.requestUpdate()};async function L0(i){const t=i.urlInput;if(i.wmsCapabilities=null,i.searchLoad=!0,i.requestUpdate(),!t)return!1;if(oo(t)==="XYZ")return{Name:t};try{const e=await Zd(t);i.wmsCapabilities=e}catch{}finally{i.searchLoad=!1,i.requestUpdate()}return!1}const O0=(i,t)=>{const{Name:e}=i,n=oo(t.urlInput)||"XYZ",r={type:"Tile",properties:{id:e,title:e},source:{type:n,url:t.urlInput,params:{LAYERS:e}}};t.jsonInput=JSON.stringify(r)},P0=(i,t)=>{t.open=i||null,t.urlInput=null,t.jsonInput=null,t.wmsCapabilities=null,t.requestUpdate()};class mu extends Yt{constructor(){super();ut(this,Pt);bt(this,"urlInput",null);bt(this,"jsonInput",null);bt(this,"open",null);bt(this,"searchLoad",!1);bt(this,"wmsCapabilities",null);ut(this,ks,`
902
+ <button @click="${vt(this,Zi,Al)}">add</button>
903
+ `}}Zi=new WeakSet,Al=function(){Jf(this)},ht(bl,"properties",{idProperty:{attribute:"id-property"},layers:{attribute:!1},titleProperty:{attribute:"title-property",type:String},unstyled:{type:Boolean},noShadow:{type:Boolean}}),customElements.define("eox-layercontrol-optional-list",bl);const Qf=(n,t)=>{t.jsonInput=n.target.value,t.requestUpdate()},vl=n=>{const t=JSON.parse(`{"data":${so(n.jsonInput)}}`);Array.isArray(t.data)?t.data.forEach(e=>{n.eoxMap.addOrUpdateLayer(e)}):n.eoxMap.addOrUpdateLayer(t.data),n.jsonInput=null,n.requestUpdate()},tg=(n,t)=>{t.urlInput=n.target.value,t.requestUpdate()};async function eg(n){const t=n.urlInput;if(n.wmsCapabilities=null,n.searchLoad=!0,n.requestUpdate(),!t)return!1;if(pr(t)==="XYZ")return{Name:t};try{const e=await Vu(t);n.wmsCapabilities=e}catch{}finally{n.searchLoad=!1,n.requestUpdate()}return!1}const ng=(n,t)=>{const{Name:e}=n,i=pr(t.urlInput)||"XYZ",r={type:"Tile",properties:{id:e,title:e},source:{type:i,url:t.urlInput,params:{LAYERS:e}}};t.jsonInput=JSON.stringify(r)},ig=(n,t)=>{t.open=n||null,t.urlInput=null,t.jsonInput=null,t.wmsCapabilities=null,t.requestUpdate()};class Tl extends Mt{constructor(){super();tt(this,bt);ht(this,"urlInput",null);ht(this,"jsonInput",null);ht(this,"open",null);ht(this,"searchLoad",!1);ht(this,"wmsCapabilities",null);tt(this,Ki,`
912
904
  .eox-add-layer-main .open {
913
905
  position: relative;
914
906
  }
915
907
  .eox-add-layer-main .close {
916
908
  display: none;
917
909
  }
918
- `);ut(this,Fs,`
910
+ `);tt(this,qi,`
919
911
  .eox-add {
920
912
  background: #f0f2f5;
921
913
  border-top: 1px solid #0041701a;
@@ -1048,23 +1040,23 @@ input::-moz-focus-inner, input::-moz-focus-outer {
1048
1040
  font-weight: bold;
1049
1041
  display: inline-block;
1050
1042
  }
1051
- `);this.eoxMap=null,this.unstyled=!1,this.noShadow=!1}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}render(){const e=this.open?"open":"close",n=this.open==="url",r=this.open==="json",s=!qd(this.urlInput)||this.searchLoad?!0:at;return q`
1043
+ `);this.eoxMap=null,this.unstyled=!1,this.noShadow=!1}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}render(){const e=this.open?"open":"close",i=this.open==="url",r=this.open==="json",s=!ju(this.urlInput)||this.searchLoad?!0:K;return B`
1052
1044
  <style>
1053
- ${gt(this,ks)}
1054
- ${!this.unstyled&&gt(this,Fs)}
1045
+ ${nt(this,Ki)}
1046
+ ${!this.unstyled&&nt(this,qi)}
1055
1047
  </style>
1056
1048
  <div class="eox-add-layer-main">
1057
1049
  <div class="eox-add-layer-col">
1058
1050
  <!-- Tabbed interface for URL and JSON -->
1059
1051
  <ul class="eox-add-layer-tab ${e}">
1060
1052
  <li
1061
- @click=${()=>$t(this,Pt,Vs).call(this,"url")}
1062
- class="${n?"active":""}"
1053
+ @click=${()=>vt(this,bt,er).call(this,"url")}
1054
+ class="${i?"active":""}"
1063
1055
  >
1064
1056
  URL
1065
1057
  </li>
1066
1058
  <li
1067
- @click=${()=>$t(this,Pt,Vs).call(this,"json")}
1059
+ @click=${()=>vt(this,bt,er).call(this,"json")}
1068
1060
  class="${r?"active":""}"
1069
1061
  >
1070
1062
  JSON
@@ -1074,13 +1066,13 @@ input::-moz-focus-inner, input::-moz-focus-outer {
1074
1066
  <!-- Button to toggle tabs -->
1075
1067
  <button
1076
1068
  class="add-icon icon"
1077
- @click=${()=>$t(this,Pt,Vs).call(this,this.open?null:"url")}
1069
+ @click=${()=>vt(this,bt,er).call(this,this.open?null:"url")}
1078
1070
  >
1079
1071
  ${this.unstyled?"Add Layer":""}
1080
1072
  </button>
1081
1073
  </div>
1082
1074
  <div class="eox-add ${e}">
1083
- ${n?q`
1075
+ ${i?B`
1084
1076
  <!-- Input field for URL -->
1085
1077
  <div class="eox-add-layer-col">
1086
1078
  <input
@@ -1088,71 +1080,71 @@ input::-moz-focus-inner, input::-moz-focus-outer {
1088
1080
  class="add-url"
1089
1081
  placeholder="Add URL (WMS/XYZ)"
1090
1082
  .value="${this.urlInput}"
1091
- @input=${$t(this,Pt,Pu)}
1083
+ @input=${vt(this,bt,Il)}
1092
1084
  >
1093
1085
  </input>
1094
1086
  <!-- Search button for URL -->
1095
1087
  <button
1096
1088
  class="search-icon"
1097
1089
  disabled=${s}
1098
- @click=${$t(this,Pt,$u)}
1090
+ @click=${vt(this,bt,$l)}
1099
1091
  >
1100
1092
  ${this.unstyled?"Search":""}
1101
1093
  </button>
1102
1094
  </div>
1103
1095
 
1104
1096
  <!-- Display layers for WMS capabilities -->
1105
- ${this.wmsCapabilities?q`<ul class="search-lists">
1106
- ${this.wmsCapabilities.Capability.Layer.Layer.map(o=>{const a=o.Name;return q`
1097
+ ${this.wmsCapabilities?B`<ul class="search-lists">
1098
+ ${this.wmsCapabilities.Capability.Layer.Layer.map(o=>{const a=o.Name;return B`
1107
1099
  <li class="search-list">
1108
1100
  ${a}
1109
1101
  <!-- Button to add layer -->
1110
1102
  <button
1111
1103
  class="add-layer-icon icon"
1112
- @click=${()=>$t(this,Pt,Ha).call(this,o)}
1104
+ @click=${()=>vt(this,bt,Ss).call(this,o)}
1113
1105
  >
1114
1106
  ${this.unstyled?"+":""}
1115
1107
  </button>
1116
1108
  </li>
1117
1109
  `})}
1118
- </ul>`:at}
1119
- `:q`
1110
+ </ul>`:K}
1111
+ `:B`
1120
1112
  <!-- Textarea for JSON input -->
1121
1113
  <textarea
1122
1114
  class="add-layer-input"
1123
1115
  placeholder="Please put a valid eox-map layer JSON."
1124
- @input=${$t(this,Pt,ku)}
1116
+ @input=${vt(this,bt,Ml)}
1125
1117
  .value=${this.jsonInput}
1126
1118
  ></textarea>
1127
1119
 
1128
1120
  <!-- Button to add JSON layer -->
1129
1121
  <button
1130
1122
  class="add-layer-icon json-add-layer"
1131
- disabled=${Kd(this.jsonInput)?at:!0}
1132
- @click=${$t(this,Pt,Nu)}
1123
+ disabled=${zu(this.jsonInput)?K:!0}
1124
+ @click=${vt(this,bt,Pl)}
1133
1125
  >
1134
1126
  ${this.unstyled?"Add JSON":""}
1135
1127
  </button>
1136
1128
  `}
1137
1129
  </div>
1138
1130
  </div>
1139
- `}}Pt=new WeakSet,Pu=function(e){D0(e,this)},$u=async function(){const e=await L0(this);e&&$t(this,Pt,Ha).call(this,e)},Ha=function(e){O0(e,this),_u(this)},Nu=function(){_u(this)},ku=function(e){M0(e,this)},Vs=function(e){P0(e,this)},ks=new WeakMap,Fs=new WeakMap,bt(mu,"properties",{eoxMap:{attribute:!1,state:!0},unstyled:{type:Boolean},noShadow:{type:Boolean}}),customElements.define("eox-layercontrol-add-layers",mu);const $0=(i,t)=>{if(t.requestUpdate(),i.target.tagName==="EOX-LAYERCONTROL-LAYER-TOOLS"){const e=t.renderRoot.querySelector("eox-layercontrol-optional-list");e==null||e.requestUpdate()}},N0=i=>{const t=i.for,e=document.querySelector(t);return e&&e.map!==i.map&&(i.map=e.map),e};class $a extends Yt{constructor(){super();ut(this,Bs);ut(this,cn);ut(this,Us,"* { font-family: Roboto, sans-serif; }");this.for="eox-map",this.idProperty="id",this.map=null,this.titleProperty="title",this.showLayerZoomState=!1,this.tools=["info","opacity","config","remove","sort"],this.addExternalLayers=!1,this.unstyled=!1,this.styleOverride=""}firstUpdated(){fr(this,cn,N0(this))}render(){var r,s,o;const e=(r=this.map)==null?void 0:r.getLayers().getArray(),n=e&&((s=wo(e,"layerControlOptional",!0))==null?void 0:s.length)>0;return q`
1131
+ `}}bt=new WeakSet,Il=function(e){tg(e,this)},$l=async function(){const e=await eg(this);e&&vt(this,bt,Ss).call(this,e)},Ss=function(e){ng(e,this),vl(this)},Pl=function(){vl(this)},Ml=function(e){Qf(e,this)},er=function(e){ig(e,this)},Ki=new WeakMap,qi=new WeakMap,ht(Tl,"properties",{eoxMap:{attribute:!1,state:!0},unstyled:{type:Boolean},noShadow:{type:Boolean}}),customElements.define("eox-layercontrol-add-layers",Tl);const rg=(n,t)=>{if(t.requestUpdate(),n.target.tagName==="EOX-LAYERCONTROL-LAYER-TOOLS"){const e=t.renderRoot.querySelector("eox-layercontrol-optional-list");e==null||e.requestUpdate()}},sg=n=>{let t;return typeof n=="string"?t=document.querySelector(n):t=n,t},og=n=>{const t=sg(n.for);return t&&t.map!==n.map&&(n.map=t.map),t};class Rs extends Mt{constructor(){super();tt(this,Ji);tt(this,an);tt(this,Qi,"* { font-family: Roboto, sans-serif; }");this.for="eox-map",this.idProperty="id",this.map=null,this.titleProperty="title",this.showLayerZoomState=!1,this.tools=["info","opacity","config","remove","sort"],this.addExternalLayers=!1,this.unstyled=!1,this.styleOverride=""}firstUpdated(){Wn(this,an,og(this))}render(){var r,s,o;const e=(r=this.map)==null?void 0:r.getLayers().getArray(),i=e&&((s=Mr(e,"layerControlOptional",!0))==null?void 0:s.length)>0;return B`
1140
1132
  <style>
1141
- ${!this.unstyled&&gt(this,Us)}
1133
+ ${!this.unstyled&&nt(this,Qi)}
1142
1134
  ${this.styleOverride}
1143
1135
  </style>
1144
1136
 
1145
1137
  <!-- Conditional rendering of add layers component -->
1146
- ${ne(this.addExternalLayers&&((o=gt(this,cn))==null?void 0:o.addOrUpdateLayer),()=>q`
1138
+ ${Ut(this.addExternalLayers&&((o=nt(this,an))==null?void 0:o.addOrUpdateLayer),()=>B`
1147
1139
  <eox-layercontrol-add-layers
1148
1140
  .noShadow=${!0}
1149
- .eoxMap=${gt(this,cn)}
1141
+ .eoxMap=${nt(this,an)}
1150
1142
  .unstyled=${this.unstyled}
1151
1143
  ></eox-layercontrol-add-layers>
1152
1144
  `)}
1153
1145
 
1154
1146
  <!-- Conditional rendering of layer list component -->
1155
- ${ne(this.map,()=>q`
1147
+ ${Ut(this.map,()=>B`
1156
1148
  <eox-layercontrol-layer-list
1157
1149
  .noShadow=${!0}
1158
1150
  class="layers"
@@ -1163,12 +1155,12 @@ input::-moz-focus-inner, input::-moz-focus-outer {
1163
1155
  .showLayerZoomState=${this.showLayerZoomState}
1164
1156
  .tools=${this.tools}
1165
1157
  .unstyled=${this.unstyled}
1166
- @changed=${$t(this,Bs,Fu)}
1158
+ @changed=${vt(this,Ji,Ol)}
1167
1159
  ></eox-layercontrol-layer-list>
1168
1160
  `)}
1169
1161
 
1170
1162
  <!-- Conditional rendering of optional list component -->
1171
- ${ne(n,()=>q`
1163
+ ${Ut(i,()=>B`
1172
1164
  <eox-layercontrol-optional-list
1173
1165
  .noShadow=${!0}
1174
1166
  .idProperty=${this.idProperty}
@@ -1177,4 +1169,4 @@ input::-moz-focus-inner, input::-moz-focus-outer {
1177
1169
  @changed=${()=>this.requestUpdate()}
1178
1170
  ></eox-layercontrol-optional-list>
1179
1171
  `)}
1180
- `}}cn=new WeakMap,Bs=new WeakSet,Fu=function(e){$0(e,this),this.dispatchEvent(new CustomEvent("layerchange",{detail:e.detail}))},Us=new WeakMap,bt($a,"properties",{for:{type:String},idProperty:{attribute:"id-property"},map:{attribute:!1,state:!0},titleProperty:{attribute:"title-property",type:String},showLayerZoomState:{attribute:"show-layer-zoom-state",type:Boolean},tools:{attribute:!1},addExternalLayers:{attribute:!1},unstyled:{type:Boolean},styleOverride:{type:String}}),customElements.define("eox-layercontrol",$a),ot.EOxLayerControl=$a,Object.defineProperty(ot,Symbol.toStringTag,{value:"Module"})});
1172
+ `}}an=new WeakMap,Ji=new WeakSet,Ol=function(e){rg(e,this),this.dispatchEvent(new CustomEvent("layerchange",{detail:e.detail}))},Qi=new WeakMap,ht(Rs,"properties",{for:{type:String},idProperty:{attribute:"id-property"},map:{attribute:!1,state:!0},titleProperty:{attribute:"title-property",type:String},showLayerZoomState:{attribute:"show-layer-zoom-state",type:Boolean},tools:{attribute:!1},addExternalLayers:{attribute:!1},unstyled:{type:Boolean},styleOverride:{type:String}}),customElements.define("eox-layercontrol",Rs),Z.EOxLayerControl=Rs,Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"})});