@eox/layercontrol 0.17.6-dev.1.0 → 0.17.6-dev.2.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.
- package/dist/eox-layercontrol.js +19057 -2204
- package/dist/eox-layercontrol.umd.cjs +247 -131
- package/package.json +3 -3
|
@@ -1,87 +1,203 @@
|
|
|
1
|
-
(function(
|
|
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);/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/var
|
|
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;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is:
|
|
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");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/const
|
|
14
|
-
\f\r]`,
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
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};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/let
|
|
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");/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2021 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
-
*/function
|
|
23
|
+
*/function ne(i,t,e){return i?t(i):e==null?void 0:e(i)}/**
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/const
|
|
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)}}/**
|
|
28
28
|
* @license
|
|
29
29
|
* Copyright 2020 Google LLC
|
|
30
30
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
31
|
-
*/const{I:
|
|
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}};/**
|
|
32
32
|
* @license
|
|
33
33
|
* Copyright 2017 Google LLC
|
|
34
34
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
35
|
-
*/const
|
|
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}});/**
|
|
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
|
|
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}`}/**!
|
|
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 Ti(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);t&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(n,o).enumerable})),e.push.apply(e,i)}return e}function pt(n){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Ti(Object(e),!0).forEach(function(i){kr(n,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):Ti(Object(e)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(e,i))})}return n}function Te(n){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Te=function(t){return typeof t}:Te=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Te(n)}function kr(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function bt(){return bt=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},bt.apply(this,arguments)}function Ur(n,t){if(n==null)return{};var e={},i=Object.keys(n),o,r;for(r=0;r<i.length;r++)o=i[r],!(t.indexOf(o)>=0)&&(e[o]=n[o]);return e}function Fr(n,t){if(n==null)return{};var e=Ur(n,t),i,o;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(e[i]=n[i])}return e}var jr="1.15.2";function vt(n){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(n)}var wt=vt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),se=vt(/Edge/i),Pi=vt(/firefox/i),ae=vt(/safari/i)&&!vt(/chrome/i)&&!vt(/android/i),Oi=vt(/iP(ad|od|hone)/i),Ri=vt(/chrome/i)&&vt(/android/i),Di={capture:!1,passive:!1};function A(n,t,e){n.addEventListener(t,e,!wt&&Di)}function S(n,t,e){n.removeEventListener(t,e,!wt&&Di)}function Pe(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 zr(n){return n.host&&n!==document&&n.host.nodeType?n.host:n.parentNode}function ut(n,t,e,i){if(n){e=e||document;do{if(t!=null&&(t[0]===">"?n.parentNode===e&&Pe(n,t):Pe(n,t))||i&&n===e)return n;if(n===e)break}while(n=zr(n))}return null}var Ni=/\s+/g;function nt(n,t,e){if(n&&t)if(n.classList)n.classList[e?"add":"remove"](t);else{var i=(" "+n.className+" ").replace(Ni," ").replace(" "+t+" "," ");n.className=(i+(e?" "+t:"")).replace(Ni," ")}}function b(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 jt(n,t){var e="";if(typeof n=="string")e=n;else do{var i=b(n,"transform");i&&i!=="none"&&(e=i+" "+e)}while(!t&&(n=n.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(e)}function Mi(n,t,e){if(n){var i=n.getElementsByTagName(t),o=0,r=i.length;if(e)for(;o<r;o++)e(i[o],o);return i}return[]}function ft(){var n=document.scrollingElement;return n||document.documentElement}function B(n,t,e,i,o){if(!(!n.getBoundingClientRect&&n!==window)){var r,s,a,l,u,d,c;if(n!==window&&n.parentNode&&n!==ft()?(r=n.getBoundingClientRect(),s=r.top,a=r.left,l=r.bottom,u=r.right,d=r.height,c=r.width):(s=0,a=0,l=window.innerHeight,u=window.innerWidth,d=window.innerHeight,c=window.innerWidth),(t||e)&&n!==window&&(o=o||n.parentNode,!wt))do if(o&&o.getBoundingClientRect&&(b(o,"transform")!=="none"||e&&b(o,"position")!=="static")){var p=o.getBoundingClientRect();s-=p.top+parseInt(b(o,"border-top-width")),a-=p.left+parseInt(b(o,"border-left-width")),l=s+r.height,u=a+r.width;break}while(o=o.parentNode);if(i&&n!==window){var f=jt(o||n),g=f&&f.a,y=f&&f.d;f&&(s/=y,a/=g,c/=g,d/=y,l=s+d,u=a+c)}return{top:s,left:a,bottom:l,right:u,width:c,height:d}}}function Ii(n,t,e){for(var i=$t(n,!0),o=B(n)[t];i;){var r=B(i)[e],s=void 0;if(e==="top"||e==="left"?s=o>=r:s=o<=r,!s)return i;if(i===ft())break;i=$t(i,!1)}return!1}function zt(n,t,e,i){for(var o=0,r=0,s=n.children;r<s.length;){if(s[r].style.display!=="none"&&s[r]!==v.ghost&&(i||s[r]!==v.dragged)&&ut(s[r],e.draggable,n,!1)){if(o===t)return s[r];o++}r++}return null}function Cn(n,t){for(var e=n.lastElementChild;e&&(e===v.ghost||b(e,"display")==="none"||t&&!Pe(e,t));)e=e.previousElementSibling;return e||null}function lt(n,t){var e=0;if(!n||!n.parentNode)return-1;for(;n=n.previousElementSibling;)n.nodeName.toUpperCase()!=="TEMPLATE"&&n!==v.clone&&(!t||Pe(n,t))&&e++;return e}function Hi(n){var t=0,e=0,i=ft();if(n)do{var o=jt(n),r=o.a,s=o.d;t+=n.scrollLeft*r,e+=n.scrollTop*s}while(n!==i&&(n=n.parentNode));return[t,e]}function Zr(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 $t(n,t){if(!n||!n.getBoundingClientRect)return ft();var e=n,i=!1;do if(e.clientWidth<e.scrollWidth||e.clientHeight<e.scrollHeight){var o=b(e);if(e.clientWidth<e.scrollWidth&&(o.overflowX=="auto"||o.overflowX=="scroll")||e.clientHeight<e.scrollHeight&&(o.overflowY=="auto"||o.overflowY=="scroll")){if(!e.getBoundingClientRect||e===document.body)return ft();if(i||t)return e;i=!0}}while(e=e.parentNode);return ft()}function Xr(n,t){if(n&&t)for(var e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);return n}function Tn(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 le;function Bi(n,t){return function(){if(!le){var e=arguments,i=this;e.length===1?n.call(i,e[0]):n.apply(i,e),le=setTimeout(function(){le=void 0},t)}}}function Yr(){clearTimeout(le),le=void 0}function Vi(n,t,e){n.scrollLeft+=t,n.scrollTop+=e}function Li(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 ki(n,t,e){var i={};return Array.from(n.children).forEach(function(o){var r,s,a,l;if(!(!ut(o,t.draggable,n,!1)||o.animated||o===e)){var u=B(o);i.left=Math.min((r=i.left)!==null&&r!==void 0?r:1/0,u.left),i.top=Math.min((s=i.top)!==null&&s!==void 0?s: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 it="Sortable"+new Date().getTime();function qr(){var n=[],t;return{captureAnimationState:function(){if(n=[],!!this.options.animation){var i=[].slice.call(this.el.children);i.forEach(function(o){if(!(b(o,"display")==="none"||o===v.ghost)){n.push({target:o,rect:B(o)});var r=pt({},n[n.length-1].rect);if(o.thisAnimationDuration){var s=jt(o,!0);s&&(r.top-=s.f,r.left-=s.e)}o.fromRect=r}})}},addAnimationState:function(i){n.push(i)},removeAnimationState:function(i){n.splice(Zr(n,{target:i}),1)},animateAll:function(i){var o=this;if(!this.options.animation){clearTimeout(t),typeof i=="function"&&i();return}var r=!1,s=0;n.forEach(function(a){var l=0,u=a.target,d=u.fromRect,c=B(u),p=u.prevFromRect,f=u.prevToRect,g=a.rect,y=jt(u,!0);y&&(c.top-=y.f,c.left-=y.e),u.toRect=c,u.thisAnimationDuration&&Tn(p,c)&&!Tn(d,c)&&(g.top-c.top)/(g.left-c.left)===(d.top-c.top)/(d.left-c.left)&&(l=Gr(g,p,f,o.options)),Tn(c,d)||(u.prevFromRect=d,u.prevToRect=c,l||(l=o.options.animation),o.animate(u,g,c,l)),l&&(r=!0,s=Math.max(s,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),r?t=setTimeout(function(){typeof i=="function"&&i()},s):typeof i=="function"&&i(),n=[]},animate:function(i,o,r,s){if(s){b(i,"transition",""),b(i,"transform","");var a=jt(this.el),l=a&&a.a,u=a&&a.d,d=(o.left-r.left)/(l||1),c=(o.top-r.top)/(u||1);i.animatingX=!!d,i.animatingY=!!c,b(i,"transform","translate3d("+d+"px,"+c+"px,0)"),this.forRepaintDummy=Wr(i),b(i,"transition","transform "+s+"ms"+(this.options.easing?" "+this.options.easing:"")),b(i,"transform","translate3d(0,0,0)"),typeof i.animated=="number"&&clearTimeout(i.animated),i.animated=setTimeout(function(){b(i,"transition",""),b(i,"transform",""),i.animated=!1,i.animatingX=!1,i.animatingY=!1},s)}}}}function Wr(n){return n.offsetWidth}function Gr(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 Zt=[],Pn={initializeByDefault:!0},ue={mount:function(t){for(var e in Pn)Pn.hasOwnProperty(e)&&!(e in t)&&(t[e]=Pn[e]);Zt.forEach(function(i){if(i.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")}),Zt.push(t)},pluginEvent:function(t,e,i){var o=this;this.eventCanceled=!1,i.cancel=function(){o.eventCanceled=!0};var r=t+"Global";Zt.forEach(function(s){e[s.pluginName]&&(e[s.pluginName][r]&&e[s.pluginName][r](pt({sortable:e},i)),e.options[s.pluginName]&&e[s.pluginName][t]&&e[s.pluginName][t](pt({sortable:e},i)))})},initializePlugins:function(t,e,i,o){Zt.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,bt(i,u.defaults)}});for(var r in t.options)if(t.options.hasOwnProperty(r)){var s=this.modifyOption(t,r,t.options[r]);typeof s<"u"&&(t.options[r]=s)}},getEventProperties:function(t,e){var i={};return Zt.forEach(function(o){typeof o.eventProperties=="function"&&bt(i,o.eventProperties.call(e[o.pluginName],t))}),i},modifyOption:function(t,e,i){var o;return Zt.forEach(function(r){t[r.pluginName]&&r.optionListeners&&typeof r.optionListeners[e]=="function"&&(o=r.optionListeners[e].call(t[r.pluginName],i))}),o}};function Jr(n){var t=n.sortable,e=n.rootEl,i=n.name,o=n.targetEl,r=n.cloneEl,s=n.toEl,a=n.fromEl,l=n.oldIndex,u=n.newIndex,d=n.oldDraggableIndex,c=n.newDraggableIndex,p=n.originalEvent,f=n.putSortable,g=n.extraEventProperties;if(t=t||e&&e[it],!!t){var y,D=t.options,X="on"+i.charAt(0).toUpperCase()+i.substr(1);window.CustomEvent&&!wt&&!se?y=new CustomEvent(i,{bubbles:!0,cancelable:!0}):(y=document.createEvent("Event"),y.initEvent(i,!0,!0)),y.to=s||e,y.from=a||e,y.item=o||e,y.clone=r,y.oldIndex=l,y.newIndex=u,y.oldDraggableIndex=d,y.newDraggableIndex=c,y.originalEvent=p,y.pullMode=f?f.lastPutMode:void 0;var U=pt(pt({},g),ue.getEventProperties(i,t));for(var rt in U)y[rt]=U[rt];e&&e.dispatchEvent(y),D[X]&&D[X].call(t,y)}}var Kr=["evt"],tt=function(t,e){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=i.evt,r=Fr(i,Kr);ue.pluginEvent.bind(v)(t,e,pt({dragEl:h,parentEl:I,ghostEl:w,rootEl:R,nextEl:Ht,lastDownEl:Oe,cloneEl:N,cloneHidden:_t,dragStarted:de,putSortable:z,activeSortable:v.active,originalEvent:o,oldIndex:Xt,oldDraggableIndex:ce,newIndex:ot,newDraggableIndex:At,hideGhostForTarget:Yi,unhideGhostForTarget:qi,cloneNowHidden:function(){_t=!0},cloneNowShown:function(){_t=!1},dispatchSortableEvent:function(a){J({sortable:e,name:a,originalEvent:o})}},r))};function J(n){Jr(pt({putSortable:z,cloneEl:N,targetEl:h,rootEl:R,oldIndex:Xt,oldDraggableIndex:ce,newIndex:ot,newDraggableIndex:At},n))}var h,I,w,R,Ht,Oe,N,_t,Xt,ot,ce,At,Re,z,Yt=!1,De=!1,Ne=[],Bt,ct,On,Rn,Ui,Fi,de,qt,he,pe=!1,Me=!1,Ie,q,Dn=[],Nn=!1,He=[],Be=typeof document<"u",Ve=Oi,ji=se||wt?"cssFloat":"float",Qr=Be&&!Ri&&!Oi&&"draggable"in document.createElement("div"),zi=function(){if(Be){if(wt)return!1;var n=document.createElement("x");return n.style.cssText="pointer-events:auto",n.style.pointerEvents==="auto"}}(),Zi=function(t,e){var i=b(t),o=parseInt(i.width)-parseInt(i.paddingLeft)-parseInt(i.paddingRight)-parseInt(i.borderLeftWidth)-parseInt(i.borderRightWidth),r=zt(t,0,e),s=zt(t,1,e),a=r&&b(r),l=s&&b(s),u=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+B(r).width,d=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+B(s).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(r&&a.float&&a.float!=="none"){var c=a.float==="left"?"left":"right";return s&&(l.clear==="both"||l.clear===c)?"vertical":"horizontal"}return r&&(a.display==="block"||a.display==="flex"||a.display==="table"||a.display==="grid"||u>=o&&i[ji]==="none"||s&&i[ji]==="none"&&u+d>o)?"vertical":"horizontal"},ts=function(t,e,i){var o=i?t.left:t.top,r=i?t.right:t.bottom,s=i?t.width:t.height,a=i?e.left:e.top,l=i?e.right:e.bottom,u=i?e.width:e.height;return o===a||r===l||o+s/2===a+u/2},es=function(t,e){var i;return Ne.some(function(o){var r=o[it].options.emptyInsertThreshold;if(!(!r||Cn(o))){var s=B(o),a=t>=s.left-r&&t<=s.right+r,l=e>=s.top-r&&e<=s.bottom+r;if(a&&l)return i=o}}),i},Xi=function(t){function e(r,s){return function(a,l,u,d){var c=a.options.group.name&&l.options.group.name&&a.options.group.name===l.options.group.name;if(r==null&&(s||c))return!0;if(r==null||r===!1)return!1;if(s&&r==="clone")return r;if(typeof r=="function")return e(r(a,l,u,d),s)(a,l,u,d);var p=(s?a:l).options.group.name;return r===!0||typeof r=="string"&&r===p||r.join&&r.indexOf(p)>-1}}var i={},o=t.group;(!o||Te(o)!="object")&&(o={name:o}),i.name=o.name,i.checkPull=e(o.pull,!0),i.checkPut=e(o.put),i.revertClone=o.revertClone,t.group=i},Yi=function(){!zi&&w&&b(w,"display","none")},qi=function(){!zi&&w&&b(w,"display","")};Be&&!Ri&&document.addEventListener("click",function(n){if(De)return n.preventDefault(),n.stopPropagation&&n.stopPropagation(),n.stopImmediatePropagation&&n.stopImmediatePropagation(),De=!1,!1},!0);var Vt=function(t){if(h){t=t.touches?t.touches[0]:t;var e=es(t.clientX,t.clientY);if(e){var i={};for(var o in t)t.hasOwnProperty(o)&&(i[o]=t[o]);i.target=i.rootEl=e,i.preventDefault=void 0,i.stopPropagation=void 0,e[it]._onDragOver(i)}}},ns=function(t){h&&h.parentNode[it]._isOutsideThisEl(t.target)};function v(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=bt({},t),n[it]=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 Zi(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(s,a){s.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:v.supportPointer!==!1&&"PointerEvent"in window&&!ae,emptyInsertThreshold:5};ue.initializePlugins(this,n,e);for(var i in e)!(i in t)&&(t[i]=e[i]);Xi(t);for(var o in this)o.charAt(0)==="_"&&typeof this[o]=="function"&&(this[o]=this[o].bind(this));this.nativeDraggable=t.forceFallback?!1:Qr,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?A(n,"pointerdown",this._onTapStart):(A(n,"mousedown",this._onTapStart),A(n,"touchstart",this._onTapStart)),this.nativeDraggable&&(A(n,"dragover",this),A(n,"dragenter",this)),Ne.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),bt(this,qr())}v.prototype={constructor:v,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(qt=null)},_getDirection:function(t,e){return typeof this.options.direction=="function"?this.options.direction.call(this,t,e,h):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,i=this.el,o=this.options,r=o.preventOnFilter,s=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,d=o.filter;if(cs(i),!h&&!(/mousedown|pointerdown/.test(s)&&t.button!==0||o.disabled)&&!u.isContentEditable&&!(!this.nativeDraggable&&ae&&l&&l.tagName.toUpperCase()==="SELECT")&&(l=ut(l,o.draggable,i,!1),!(l&&l.animated)&&Oe!==l)){if(Xt=lt(l),ce=lt(l,o.draggable),typeof d=="function"){if(d.call(this,t,l,this)){J({sortable:e,rootEl:u,name:"filter",targetEl:l,toEl:i,fromEl:i}),tt("filter",e,{evt:t}),r&&t.cancelable&&t.preventDefault();return}}else if(d&&(d=d.split(",").some(function(c){if(c=ut(u,c.trim(),i,!1),c)return J({sortable:e,rootEl:c,name:"filter",targetEl:l,fromEl:i,toEl:i}),tt("filter",e,{evt:t}),!0}),d)){r&&t.cancelable&&t.preventDefault();return}o.handle&&!ut(u,o.handle,i,!1)||this._prepareDragStart(t,a,l)}}},_prepareDragStart:function(t,e,i){var o=this,r=o.el,s=o.options,a=r.ownerDocument,l;if(i&&!h&&i.parentNode===r){var u=B(i);if(R=r,h=i,I=h.parentNode,Ht=h.nextSibling,Oe=i,Re=s.group,v.dragged=h,Bt={target:h,clientX:(e||t).clientX,clientY:(e||t).clientY},Ui=Bt.clientX-u.left,Fi=Bt.clientY-u.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,h.style["will-change"]="all",l=function(){if(tt("delayEnded",o,{evt:t}),v.eventCanceled){o._onDrop();return}o._disableDelayedDragEvents(),!Pi&&o.nativeDraggable&&(h.draggable=!0),o._triggerDragStart(t,e),J({sortable:o,name:"choose",originalEvent:t}),nt(h,s.chosenClass,!0)},s.ignore.split(",").forEach(function(d){Mi(h,d.trim(),Mn)}),A(a,"dragover",Vt),A(a,"mousemove",Vt),A(a,"touchmove",Vt),A(a,"mouseup",o._onDrop),A(a,"touchend",o._onDrop),A(a,"touchcancel",o._onDrop),Pi&&this.nativeDraggable&&(this.options.touchStartThreshold=4,h.draggable=!0),tt("delayStart",this,{evt:t}),s.delay&&(!s.delayOnTouchOnly||e)&&(!this.nativeDraggable||!(se||wt))){if(v.eventCanceled){this._onDrop();return}A(a,"mouseup",o._disableDelayedDrag),A(a,"touchend",o._disableDelayedDrag),A(a,"touchcancel",o._disableDelayedDrag),A(a,"mousemove",o._delayedDragTouchMoveHandler),A(a,"touchmove",o._delayedDragTouchMoveHandler),s.supportPointer&&A(a,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(l,s.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(){h&&Mn(h),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;S(t,"mouseup",this._disableDelayedDrag),S(t,"touchend",this._disableDelayedDrag),S(t,"touchcancel",this._disableDelayedDrag),S(t,"mousemove",this._delayedDragTouchMoveHandler),S(t,"touchmove",this._delayedDragTouchMoveHandler),S(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||t.pointerType=="touch"&&t,!this.nativeDraggable||e?this.options.supportPointer?A(document,"pointermove",this._onTouchMove):e?A(document,"touchmove",this._onTouchMove):A(document,"mousemove",this._onTouchMove):(A(h,"dragend",this),A(R,"dragstart",this._onDragStart));try{document.selection?ke(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,e){if(Yt=!1,R&&h){tt("dragStarted",this,{evt:e}),this.nativeDraggable&&A(document,"dragover",ns);var i=this.options;!t&&nt(h,i.dragClass,!1),nt(h,i.ghostClass,!0),v.active=this,t&&this._appendGhost(),J({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(ct){this._lastX=ct.clientX,this._lastY=ct.clientY,Yi();for(var t=document.elementFromPoint(ct.clientX,ct.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(ct.clientX,ct.clientY),t!==e);)e=t;if(h.parentNode[it]._isOutsideThisEl(t),e)do{if(e[it]){var i=void 0;if(i=e[it]._onDragOver({clientX:ct.clientX,clientY:ct.clientY,target:t,rootEl:e}),i&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);qi()}},_onTouchMove:function(t){if(Bt){var e=this.options,i=e.fallbackTolerance,o=e.fallbackOffset,r=t.touches?t.touches[0]:t,s=w&&jt(w,!0),a=w&&s&&s.a,l=w&&s&&s.d,u=Ve&&q&&Hi(q),d=(r.clientX-Bt.clientX+o.x)/(a||1)+(u?u[0]-Dn[0]:0)/(a||1),c=(r.clientY-Bt.clientY+o.y)/(l||1)+(u?u[1]-Dn[1]:0)/(l||1);if(!v.active&&!Yt){if(i&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))<i)return;this._onDragStart(t,!0)}if(w){s?(s.e+=d-(On||0),s.f+=c-(Rn||0)):s={a:1,b:0,c:0,d:1,e:d,f:c};var p="matrix(".concat(s.a,",").concat(s.b,",").concat(s.c,",").concat(s.d,",").concat(s.e,",").concat(s.f,")");b(w,"webkitTransform",p),b(w,"mozTransform",p),b(w,"msTransform",p),b(w,"transform",p),On=d,Rn=c,ct=r}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!w){var t=this.options.fallbackOnBody?document.body:R,e=B(h,!0,Ve,!0,t),i=this.options;if(Ve){for(q=t;b(q,"position")==="static"&&b(q,"transform")==="none"&&q!==document;)q=q.parentNode;q!==document.body&&q!==document.documentElement?(q===document&&(q=ft()),e.top+=q.scrollTop,e.left+=q.scrollLeft):q=ft(),Dn=Hi(q)}w=h.cloneNode(!0),nt(w,i.ghostClass,!1),nt(w,i.fallbackClass,!0),nt(w,i.dragClass,!0),b(w,"transition",""),b(w,"transform",""),b(w,"box-sizing","border-box"),b(w,"margin",0),b(w,"top",e.top),b(w,"left",e.left),b(w,"width",e.width),b(w,"height",e.height),b(w,"opacity","0.8"),b(w,"position",Ve?"absolute":"fixed"),b(w,"zIndex","100000"),b(w,"pointerEvents","none"),v.ghost=w,t.appendChild(w),b(w,"transform-origin",Ui/parseInt(w.style.width)*100+"% "+Fi/parseInt(w.style.height)*100+"%")}},_onDragStart:function(t,e){var i=this,o=t.dataTransfer,r=i.options;if(tt("dragStart",this,{evt:t}),v.eventCanceled){this._onDrop();return}tt("setupClone",this),v.eventCanceled||(N=Li(h),N.removeAttribute("id"),N.draggable=!1,N.style["will-change"]="",this._hideClone(),nt(N,this.options.chosenClass,!1),v.clone=N),i.cloneId=ke(function(){tt("clone",i),!v.eventCanceled&&(i.options.removeCloneOnHide||R.insertBefore(N,h),i._hideClone(),J({sortable:i,name:"clone"}))}),!e&&nt(h,r.dragClass,!0),e?(De=!0,i._loopId=setInterval(i._emulateDragOver,50)):(S(document,"mouseup",i._onDrop),S(document,"touchend",i._onDrop),S(document,"touchcancel",i._onDrop),o&&(o.effectAllowed="move",r.setData&&r.setData.call(i,o,h)),A(document,"drop",i),b(h,"transform","translateZ(0)")),Yt=!0,i._dragStartId=ke(i._dragStarted.bind(i,e,t)),A(document,"selectstart",i),de=!0,ae&&b(document.body,"user-select","none")},_onDragOver:function(t){var e=this.el,i=t.target,o,r,s,a=this.options,l=a.group,u=v.active,d=Re===l,c=a.sort,p=z||u,f,g=this,y=!1;if(Nn)return;function D(Se,ra){tt(Se,g,pt({evt:t,isOwner:d,axis:f?"vertical":"horizontal",revert:s,dragRect:o,targetRect:r,canSort:c,fromSortable:p,target:i,completed:U,onMove:function(mo,sa){return Le(R,e,h,o,mo,B(mo),t,sa)},changed:rt},ra))}function X(){D("dragOverAnimationCapture"),g.captureAnimationState(),g!==p&&p.captureAnimationState()}function U(Se){return D("dragOverCompleted",{insertion:Se}),Se&&(d?u._hideClone():u._showClone(g),g!==p&&(nt(h,z?z.options.ghostClass:u.options.ghostClass,!1),nt(h,a.ghostClass,!0)),z!==g&&g!==v.active?z=g:g===v.active&&z&&(z=null),p===g&&(g._ignoreWhileAnimating=i),g.animateAll(function(){D("dragOverAnimationComplete"),g._ignoreWhileAnimating=null}),g!==p&&(p.animateAll(),p._ignoreWhileAnimating=null)),(i===h&&!h.animated||i===e&&!i.animated)&&(qt=null),!a.dragoverBubble&&!t.rootEl&&i!==document&&(h.parentNode[it]._isOutsideThisEl(t.target),!Se&&Vt(t)),!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),y=!0}function rt(){ot=lt(h),At=lt(h,a.draggable),J({sortable:g,name:"change",toEl:e,newIndex:ot,newDraggableIndex:At,originalEvent:t})}if(t.preventDefault!==void 0&&t.cancelable&&t.preventDefault(),i=ut(i,a.draggable,e,!0),D("dragOver"),v.eventCanceled)return y;if(h.contains(t.target)||i.animated&&i.animatingX&&i.animatingY||g._ignoreWhileAnimating===i)return U(!1);if(De=!1,u&&!a.disabled&&(d?c||(s=I!==R):z===this||(this.lastPutMode=Re.checkPull(this,u,h,t))&&l.checkPut(this,u,h,t))){if(f=this._getDirection(t,i)==="vertical",o=B(h),D("dragOverValid"),v.eventCanceled)return y;if(s)return I=R,X(),this._hideClone(),D("revert"),v.eventCanceled||(Ht?R.insertBefore(h,Ht):R.appendChild(h)),U(!0);var K=Cn(e,a.draggable);if(!K||ss(t,f,this)&&!K.animated){if(K===h)return U(!1);if(K&&e===t.target&&(i=K),i&&(r=B(i)),Le(R,e,h,o,i,r,t,!!i)!==!1)return X(),K&&K.nextSibling?e.insertBefore(h,K.nextSibling):e.appendChild(h),I=e,rt(),U(!0)}else if(K&&rs(t,f,this)){var dt=zt(e,0,a,!0);if(dt===h)return U(!1);if(i=dt,r=B(i),Le(R,e,h,o,i,r,t,!1)!==!1)return X(),e.insertBefore(h,dt),I=e,rt(),U(!0)}else if(i.parentNode===e){r=B(i);var P=0,W,ht=h.parentNode!==e,G=!ts(h.animated&&h.toRect||o,i.animated&&i.toRect||r,f),we=f?"top":"left",Tt=Ii(i,"top","top")||Ii(h,"top","top"),Ee=Tt?Tt.scrollTop:void 0;qt!==i&&(W=r[we],pe=!1,Me=!G&&a.invertSwap||ht),P=as(t,i,r,f,G?1:a.swapThreshold,a.invertedSwapThreshold==null?a.swapThreshold:a.invertedSwapThreshold,Me,qt===i);var Et;if(P!==0){var Lt=lt(h);do Lt-=P,Et=I.children[Lt];while(Et&&(b(Et,"display")==="none"||Et===w))}if(P===0||Et===i)return U(!1);qt=i,he=P;var xe=i.nextElementSibling,Pt=!1;Pt=P===1;var cn=Le(R,e,h,o,i,r,t,Pt);if(cn!==!1)return(cn===1||cn===-1)&&(Pt=cn===1),Nn=!0,setTimeout(os,30),X(),Pt&&!xe?e.appendChild(h):i.parentNode.insertBefore(h,Pt?xe:i),Tt&&Vi(Tt,0,Ee-Tt.scrollTop),I=h.parentNode,W!==void 0&&!Me&&(Ie=Math.abs(W-B(i)[we])),rt(),U(!0)}if(e.contains(h))return U(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){S(document,"mousemove",this._onTouchMove),S(document,"touchmove",this._onTouchMove),S(document,"pointermove",this._onTouchMove),S(document,"dragover",Vt),S(document,"mousemove",Vt),S(document,"touchmove",Vt)},_offUpEvents:function(){var t=this.el.ownerDocument;S(t,"mouseup",this._onDrop),S(t,"touchend",this._onDrop),S(t,"pointerup",this._onDrop),S(t,"touchcancel",this._onDrop),S(document,"selectstart",this)},_onDrop:function(t){var e=this.el,i=this.options;if(ot=lt(h),At=lt(h,i.draggable),tt("drop",this,{evt:t}),I=h&&h.parentNode,ot=lt(h),At=lt(h,i.draggable),v.eventCanceled){this._nulling();return}Yt=!1,Me=!1,pe=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),In(this.cloneId),In(this._dragStartId),this.nativeDraggable&&(S(document,"drop",this),S(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),ae&&b(document.body,"user-select",""),b(h,"transform",""),t&&(de&&(t.cancelable&&t.preventDefault(),!i.dropBubble&&t.stopPropagation()),w&&w.parentNode&&w.parentNode.removeChild(w),(R===I||z&&z.lastPutMode!=="clone")&&N&&N.parentNode&&N.parentNode.removeChild(N),h&&(this.nativeDraggable&&S(h,"dragend",this),Mn(h),h.style["will-change"]="",de&&!Yt&&nt(h,z?z.options.ghostClass:this.options.ghostClass,!1),nt(h,this.options.chosenClass,!1),J({sortable:this,name:"unchoose",toEl:I,newIndex:null,newDraggableIndex:null,originalEvent:t}),R!==I?(ot>=0&&(J({rootEl:I,name:"add",toEl:I,fromEl:R,originalEvent:t}),J({sortable:this,name:"remove",toEl:I,originalEvent:t}),J({rootEl:I,name:"sort",toEl:I,fromEl:R,originalEvent:t}),J({sortable:this,name:"sort",toEl:I,originalEvent:t})),z&&z.save()):ot!==Xt&&ot>=0&&(J({sortable:this,name:"update",toEl:I,originalEvent:t}),J({sortable:this,name:"sort",toEl:I,originalEvent:t})),v.active&&((ot==null||ot===-1)&&(ot=Xt,At=ce),J({sortable:this,name:"end",toEl:I,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){tt("nulling",this),R=h=I=w=Ht=N=Oe=_t=Bt=ct=de=ot=At=Xt=ce=qt=he=z=Re=v.dragged=v.ghost=v.clone=v.active=null,He.forEach(function(t){t.checked=!0}),He.length=On=Rn=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":h&&(this._onDragOver(t),is(t));break;case"selectstart":t.preventDefault();break}},toArray:function(){for(var t=[],e,i=this.el.children,o=0,r=i.length,s=this.options;o<r;o++)e=i[o],ut(e,s.draggable,this.el,!1)&&t.push(e.getAttribute(s.dataIdAttr)||us(e));return t},sort:function(t,e){var i={},o=this.el;this.toArray().forEach(function(r,s){var a=o.children[s];ut(a,this.options.draggable,o,!1)&&(i[r]=a)},this),e&&this.captureAnimationState(),t.forEach(function(r){i[r]&&(o.removeChild(i[r]),o.appendChild(i[r]))}),e&&this.animateAll()},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,e){return ut(t,e||this.options.draggable,this.el,!1)},option:function(t,e){var i=this.options;if(e===void 0)return i[t];var o=ue.modifyOption(this,t,e);typeof o<"u"?i[t]=o:i[t]=e,t==="group"&&Xi(i)},destroy:function(){tt("destroy",this);var t=this.el;t[it]=null,S(t,"mousedown",this._onTapStart),S(t,"touchstart",this._onTapStart),S(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(S(t,"dragover",this),S(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(e){e.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),Ne.splice(Ne.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!_t){if(tt("hideClone",this),v.eventCanceled)return;b(N,"display","none"),this.options.removeCloneOnHide&&N.parentNode&&N.parentNode.removeChild(N),_t=!0}},_showClone:function(t){if(t.lastPutMode!=="clone"){this._hideClone();return}if(_t){if(tt("showClone",this),v.eventCanceled)return;h.parentNode==R&&!this.options.group.revertClone?R.insertBefore(N,h):Ht?R.insertBefore(N,Ht):R.appendChild(N),this.options.group.revertClone&&this.animate(h,N),b(N,"display",""),_t=!1}}};function is(n){n.dataTransfer&&(n.dataTransfer.dropEffect="move"),n.cancelable&&n.preventDefault()}function Le(n,t,e,i,o,r,s,a){var l,u=n[it],d=u.options.onMove,c;return window.CustomEvent&&!wt&&!se?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=o||t,l.relatedRect=r||B(t),l.willInsertAfter=a,l.originalEvent=s,n.dispatchEvent(l),d&&(c=d.call(u,l,s)),c}function Mn(n){n.draggable=!1}function os(){Nn=!1}function rs(n,t,e){var i=B(zt(e.el,0,e.options,!0)),o=ki(e.el,e.options,w),r=10;return t?n.clientX<o.left-r||n.clientY<i.top&&n.clientX<i.right:n.clientY<o.top-r||n.clientY<i.bottom&&n.clientX<i.left}function ss(n,t,e){var i=B(Cn(e.el,e.options.draggable)),o=ki(e.el,e.options,w),r=10;return t?n.clientX>o.right+r||n.clientY>i.bottom&&n.clientX>i.left:n.clientY>o.bottom+r||n.clientX>i.right&&n.clientY>i.top}function as(n,t,e,i,o,r,s,a){var l=i?n.clientY:n.clientX,u=i?e.height:e.width,d=i?e.top:e.left,c=i?e.bottom:e.right,p=!1;if(!s){if(a&&Ie<u*o){if(!pe&&(he===1?l>d+u*r/2:l<c-u*r/2)&&(pe=!0),pe)p=!0;else if(he===1?l<d+Ie:l>c-Ie)return-he}else if(l>d+u*(1-o)/2&&l<c-u*(1-o)/2)return ls(t)}return p=p||s,p&&(l<d+u*r/2||l>c-u*r/2)?l>d+u/2?1:-1:0}function ls(n){return lt(h)<lt(n)?1:-1}function us(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 cs(n){He.length=0;for(var t=n.getElementsByTagName("input"),e=t.length;e--;){var i=t[e];i.checked&&He.push(i)}}function ke(n){return setTimeout(n,0)}function In(n){return clearTimeout(n)}Be&&A(document,"touchmove",function(n){(v.active||Yt)&&n.cancelable&&n.preventDefault()}),v.utils={on:A,off:S,css:b,find:Mi,is:function(t,e){return!!ut(t,e,t,!1)},extend:Xr,throttle:Bi,closest:ut,toggleClass:nt,clone:Li,index:lt,nextTick:ke,cancelNextTick:In,detectDirection:Zi,getChild:zt},v.get=function(n){return n[it]},v.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&&(v.utils=pt(pt({},v.utils),i.utils)),ue.mount(i)})},v.create=function(n,t){return new v(n,t)},v.version=jr;var V=[],fe,Hn,Bn=!1,Vn,Ln,Ue,ge;function ds(){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?A(document,"dragover",this._handleAutoScroll):this.options.supportPointer?A(document,"pointermove",this._handleFallbackAutoScroll):i.touches?A(document,"touchmove",this._handleFallbackAutoScroll):A(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var i=e.originalEvent;!this.options.dragOverBubble&&!i.rootEl&&this._handleAutoScroll(i)},drop:function(){this.sortable.nativeDraggable?S(document,"dragover",this._handleAutoScroll):(S(document,"pointermove",this._handleFallbackAutoScroll),S(document,"touchmove",this._handleFallbackAutoScroll),S(document,"mousemove",this._handleFallbackAutoScroll)),Wi(),Fe(),Yr()},nulling:function(){Ue=Hn=fe=Bn=ge=Vn=Ln=null,V.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,i){var o=this,r=(e.touches?e.touches[0]:e).clientX,s=(e.touches?e.touches[0]:e).clientY,a=document.elementFromPoint(r,s);if(Ue=e,i||this.options.forceAutoScrollFallback||se||wt||ae){kn(e,this.options,a,i);var l=$t(a,!0);Bn&&(!ge||r!==Vn||s!==Ln)&&(ge&&Wi(),ge=setInterval(function(){var u=$t(document.elementFromPoint(r,s),!0);u!==l&&(l=u,Fe()),kn(e,o.options,u,i)},10),Vn=r,Ln=s)}else{if(!this.options.bubbleScroll||$t(a,!0)===ft()){Fe();return}kn(e,this.options,$t(a,!1),!1)}}},bt(n,{pluginName:"scroll",initializeByDefault:!0})}function Fe(){V.forEach(function(n){clearInterval(n.pid)}),V=[]}function Wi(){clearInterval(ge)}var kn=Bi(function(n,t,e,i){if(t.scroll){var o=(n.touches?n.touches[0]:n).clientX,r=(n.touches?n.touches[0]:n).clientY,s=t.scrollSensitivity,a=t.scrollSpeed,l=ft(),u=!1,d;Hn!==e&&(Hn=e,Fe(),fe=t.scroll,d=t.scrollFn,fe===!0&&(fe=$t(e,!0)));var c=0,p=fe;do{var f=p,g=B(f),y=g.top,D=g.bottom,X=g.left,U=g.right,rt=g.width,K=g.height,dt=void 0,P=void 0,W=f.scrollWidth,ht=f.scrollHeight,G=b(f),we=f.scrollLeft,Tt=f.scrollTop;f===l?(dt=rt<W&&(G.overflowX==="auto"||G.overflowX==="scroll"||G.overflowX==="visible"),P=K<ht&&(G.overflowY==="auto"||G.overflowY==="scroll"||G.overflowY==="visible")):(dt=rt<W&&(G.overflowX==="auto"||G.overflowX==="scroll"),P=K<ht&&(G.overflowY==="auto"||G.overflowY==="scroll"));var Ee=dt&&(Math.abs(U-o)<=s&&we+rt<W)-(Math.abs(X-o)<=s&&!!we),Et=P&&(Math.abs(D-r)<=s&&Tt+K<ht)-(Math.abs(y-r)<=s&&!!Tt);if(!V[c])for(var Lt=0;Lt<=c;Lt++)V[Lt]||(V[Lt]={});(V[c].vx!=Ee||V[c].vy!=Et||V[c].el!==f)&&(V[c].el=f,V[c].vx=Ee,V[c].vy=Et,clearInterval(V[c].pid),(Ee!=0||Et!=0)&&(u=!0,V[c].pid=setInterval((function(){i&&this.layer===0&&v.active._onTouchMove(Ue);var xe=V[this.layer].vy?V[this.layer].vy*a:0,Pt=V[this.layer].vx?V[this.layer].vx*a:0;typeof d=="function"&&d.call(v.dragged.parentNode[it],Pt,xe,n,Ue,V[this.layer].el)!=="continue"||Vi(V[this.layer].el,Pt,xe)}).bind({layer:c}),24))),c++}while(t.bubbleScroll&&p!==l&&(p=$t(p,!1)));Bn=u}},30),Gi=function(t){var e=t.originalEvent,i=t.putSortable,o=t.dragEl,r=t.activeSortable,s=t.dispatchSortableEvent,a=t.hideGhostForTarget,l=t.unhideGhostForTarget;if(e){var u=i||r;a();var d=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e,c=document.elementFromPoint(d.clientX,d.clientY);l(),u&&!u.el.contains(c)&&(s("spill"),this.onSpill({dragEl:o,putSortable:i}))}};function Un(){}Un.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 o=zt(this.sortable.el,this.startIndex,this.options);o?this.sortable.el.insertBefore(e,o):this.sortable.el.appendChild(e),this.sortable.animateAll(),i&&i.animateAll()},drop:Gi},bt(Un,{pluginName:"revertOnSpill"});function Fn(){}Fn.prototype={onSpill:function(t){var e=t.dragEl,i=t.putSortable,o=i||this.sortable;o.captureAnimationState(),e.parentNode&&e.parentNode.removeChild(e),o.animateAll()},drop:Gi},bt(Fn,{pluginName:"removeOnSpill"}),v.mount(new ds),v.mount(Fn,Un);const hs=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},ps=(n,t,e,i,o,r)=>{const a=n.item.parentNode;for(const y of e)a.appendChild(y);if(n.oldIndex==n.newIndex)return;const l=i.getArray(),u=n.item.querySelector("eox-layercontrol-layer").layer.get(o),d=l.find(y=>y.get(o)===u),c=r.dataset.layer,p=l.find(y=>y.get(o)==c);let f,g;for(f=0;f<l.length;f++)if(l[f]==d){i.removeAt(f);break}for(g=0;g<l.length;g++)if(l[g]===p){f>g?i.insertAt(g,d):i.insertAt(g+1,d);break}t.requestUpdate()};function fs(n,t,e,i){let o=[],r=null;n._sortable=v.create(n,{handle:".drag-handle",filter:".drag-handle.disabled",swapThreshold:.5,animation:150,easing:"cubic-bezier(1, 0, 0, 1)",onStart:s=>o=hs(s),onMove:s=>{r=s.related},onEnd:s=>ps(s,i,o,t,e,r)})}function gs(n,t,e,i){const o=n.getArray();let r=!1;o.forEach(s=>{const a=s.ol_uid;s.get(t)||(s.set(t,a),r=!0),s.get(e)||(s.set(e,`layer ${a}`),r=!0),r&&i.requestUpdate()})}function jn(n,t,e){let i=[];const o=(r,s,a)=>{i=[...i,...r.filter(u=>u.get(s)===a)];const l=r.filter(u=>u.getLayers);return l.length>0&&l.forEach(u=>o(u.getLayers().getArray(),s,a)),i};return o(n,t,e),i}function ms(n,t,e){if(!n||!t)return!1;if(!Ji(n,e))return!0;const i=n.get("minZoom"),o=n.get("maxZoom"),r=t.getView().getZoom();return r>i&&r<o}function Ji(n,t){const e=n.get("minZoom"),i=n.get("maxZoom");return!!(t&&(e!==-1/0||i!==1/0))}function ys(n,t){var o,r,s;return!n||!t?void 0:n.getLayers?"group":((s=(o=t.getInteractions().getArray().filter(a=>a.freehand_!==void 0).map(a=>a.source_))==null?void 0:o.ol_uid)==null?void 0:s.includes(n.getSource?(r=n.getSource())==null?void 0:r.ol_uid:void 0))?"draw":n.declutter_!==void 0?"vector":"raster"}function Ki(n,t){var i;let e={};for(const o in n){const r=n[o].type;if(r&&r!=="object")e[o]=r==="number"?Number(t[o]):t[o];else if(typeof n[o]=="object"&&((i=n[o])!=null&&i.properties)){const s=Ki(n[o].properties,t);Object.keys(s).length>0&&(e[o]=s)}}return e}function bs(n,t){var r;if(!t||!n.getSource().getTileUrlFunction())return null;const e=new URL(n.getSource().getTileUrlFunction()([0,0,0])),i=Object.fromEntries(e.searchParams.entries()),o=Ki(((r=t.schema)==null?void 0:r.properties)||t.schema,i);return Object.keys(o).length?o:null}const vs=(n,t)=>n==null?void 0:n.filter(e=>["remove","sort"].filter(i=>t!=null&&t.get("layerControlDisable")?i!=="sort":!0).includes(e)),ws=(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}),Es=(n,t)=>x`
|
|
46
|
-
|
|
47
|
-
|
|
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=`
|
|
46
|
+
precision mediump float;
|
|
47
|
+
|
|
48
|
+
attribute vec2 a_position;
|
|
49
|
+
varying vec2 v_texCoord;
|
|
50
|
+
varying vec2 v_screenCoord;
|
|
51
|
+
|
|
52
|
+
uniform vec2 u_screenSize;
|
|
53
|
+
|
|
54
|
+
void main() {
|
|
55
|
+
v_texCoord = a_position * 0.5 + 0.5;
|
|
56
|
+
v_screenCoord = v_texCoord * u_screenSize;
|
|
57
|
+
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
58
|
+
}
|
|
59
|
+
`,Pp=`
|
|
60
|
+
precision mediump float;
|
|
61
|
+
|
|
62
|
+
uniform sampler2D u_image;
|
|
63
|
+
uniform float u_opacity;
|
|
64
|
+
|
|
65
|
+
varying vec2 v_texCoord;
|
|
66
|
+
|
|
67
|
+
void main() {
|
|
68
|
+
gl_FragColor = texture2D(u_image, v_texCoord) * u_opacity;
|
|
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) {
|
|
71
|
+
${r.join(`
|
|
72
|
+
`)}
|
|
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}];
|
|
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};
|
|
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};
|
|
90
|
+
|
|
91
|
+
varying vec2 v_textureCoord;
|
|
92
|
+
varying vec2 v_mapCoord;
|
|
93
|
+
|
|
94
|
+
void main() {
|
|
95
|
+
v_textureCoord = ${ts.TEXTURE_COORD};
|
|
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]
|
|
99
|
+
);
|
|
100
|
+
gl_Position = ${W.TILE_TRANSFORM} * vec4(${ts.TEXTURE_COORD}, ${W.DEPTH}, 1.0);
|
|
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;
|
|
104
|
+
float sr = (1.0 - saturation) * 0.2126;
|
|
105
|
+
float sg = (1.0 - saturation) * 0.7152;
|
|
106
|
+
float sb = (1.0 - saturation) * 0.0722;
|
|
107
|
+
mat3 saturationMatrix = mat3(
|
|
108
|
+
sr + saturation, sr, sr,
|
|
109
|
+
sg, sg + saturation, sg,
|
|
110
|
+
sb, sb, sb + saturation
|
|
111
|
+
);
|
|
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=`
|
|
114
|
+
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
115
|
+
precision highp float;
|
|
116
|
+
#else
|
|
117
|
+
precision mediump float;
|
|
118
|
+
#endif
|
|
119
|
+
|
|
120
|
+
varying vec2 v_textureCoord;
|
|
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};
|
|
128
|
+
|
|
129
|
+
${a.join(`
|
|
130
|
+
`)}
|
|
131
|
+
|
|
132
|
+
${h.join(`
|
|
133
|
+
`)}
|
|
134
|
+
|
|
135
|
+
void main() {
|
|
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]
|
|
141
|
+
) {
|
|
142
|
+
discard;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
vec4 color = texture2D(${W.TILE_TEXTURE_ARRAY}[0], v_textureCoord);
|
|
146
|
+
|
|
147
|
+
${r.join(`
|
|
148
|
+
`)}
|
|
149
|
+
|
|
150
|
+
gl_FragColor = color;
|
|
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`
|
|
48
156
|
<button
|
|
49
157
|
class="remove-icon icon"
|
|
50
|
-
@click=${()=>{const{layer:t}=
|
|
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}))}}
|
|
51
159
|
>
|
|
52
|
-
${
|
|
160
|
+
${i.unstyled?"x":at}
|
|
53
161
|
</button>
|
|
54
|
-
`,
|
|
162
|
+
`,I_=i=>q`
|
|
55
163
|
<span class="button sort-icon icon drag-handle">
|
|
56
|
-
${
|
|
164
|
+
${i?"═":at}
|
|
57
165
|
</span>
|
|
58
|
-
`,
|
|
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)))};/**
|
|
59
167
|
* @license
|
|
60
168
|
* Copyright 2020 Google LLC
|
|
61
169
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
62
|
-
*/const to
|
|
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}});/**
|
|
63
171
|
* @license
|
|
64
172
|
* Copyright 2017 Google LLC
|
|
65
173
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
66
|
-
*/class
|
|
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);/**
|
|
67
175
|
* @license
|
|
68
176
|
* Copyright 2021 Google LLC
|
|
69
177
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
70
|
-
*/function*je(n,t){if(n!==void 0){let e=0;for(const i of n)yield t(i,e++)}}const _s=(n,t,e)=>{let i=t;return e.layer.getSource().getTileUrlFunction()&&(i||(i=e.layer.getSource().getTileUrlFunction()),e.layer.getSource().setTileUrlFunction((...o)=>Lr(i(...o),n)),e.layer.getSource().setKey(new Date)),i};var ze=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function As(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Cs="Expected a function",eo=NaN,Ts="[object Symbol]",Ps=/^\s+|\s+$/g,Os=/^[-+]0x[0-9a-f]+$/i,Rs=/^0b[01]+$/i,Ds=/^0o[0-7]+$/i,Ns=parseInt,Ms=typeof ze=="object"&&ze&&ze.Object===Object&&ze,Is=typeof self=="object"&&self&&self.Object===Object&&self,Hs=Ms||Is||Function("return this")(),Bs=Object.prototype,Vs=Bs.toString,Ls=Math.max,ks=Math.min,Zn=function(){return Hs.Date.now()};function Us(n,t,e){var i,o,r,s,a,l,u=0,d=!1,c=!1,p=!0;if(typeof n!="function")throw new TypeError(Cs);t=no(t)||0,Xn(e)&&(d=!!e.leading,c="maxWait"in e,r=c?Ls(no(e.maxWait)||0,t):r,p="trailing"in e?!!e.trailing:p);function f(P){var W=i,ht=o;return i=o=void 0,u=P,s=n.apply(ht,W),s}function g(P){return u=P,a=setTimeout(X,t),d?f(P):s}function y(P){var W=P-l,ht=P-u,G=t-W;return c?ks(G,r-ht):G}function D(P){var W=P-l,ht=P-u;return l===void 0||W>=t||W<0||c&&ht>=r}function X(){var P=Zn();if(D(P))return U(P);a=setTimeout(X,y(P))}function U(P){return a=void 0,p&&i?f(P):(i=o=void 0,s)}function rt(){a!==void 0&&clearTimeout(a),u=0,i=l=o=a=void 0}function K(){return a===void 0?s:U(Zn())}function dt(){var P=Zn(),W=D(P);if(i=arguments,o=this,l=P,W){if(a===void 0)return g(l);if(c)return a=setTimeout(X,t),f(l)}return a===void 0&&(a=setTimeout(X,t)),s}return dt.cancel=rt,dt.flush=K,dt}function Xn(n){var t=typeof n;return!!n&&(t=="object"||t=="function")}function Fs(n){return!!n&&typeof n=="object"}function js(n){return typeof n=="symbol"||Fs(n)&&Vs.call(n)==Ts}function no(n){if(typeof n=="number")return n;if(js(n))return eo;if(Xn(n)){var t=typeof n.valueOf=="function"?n.valueOf():n;n=Xn(t)?t+"":t}if(typeof n!="string")return n===0?n:+n;n=n.replace(Ps,"");var e=Rs.test(n);return e||Ds.test(n)?Ns(n.slice(2),e?2:8):Os.test(n)?eo:+n}var zs=Us;const io=As(zs);class oo extends et{constructor(){super();O(this,Ze);O(this,me,{});O(this,ye,null);O(this,be);O(this,Xe,"");O(this,Ye,"");this.layer=null,this.unstyled=!1,this.noShadow=!1,this.layerConfig=null,this.debouncedDataChange=io(Y(this,Ze,bo),1e3,{leading:!0})}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}render(){$e(this,ye,bs(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 x`
|
|
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`
|
|
71
187
|
<style>
|
|
72
|
-
${
|
|
73
|
-
${!this.unstyled&&
|
|
188
|
+
${gt(this,ws)}
|
|
189
|
+
${!this.unstyled&>(this,Ss)}
|
|
74
190
|
</style>
|
|
75
|
-
${
|
|
191
|
+
${ne(this.layerConfig,()=>q`
|
|
76
192
|
<!-- Render a JSON form for layer configuration -->
|
|
77
193
|
<eox-jsonform
|
|
78
194
|
.schema=${this.layerConfig.schema}
|
|
79
|
-
.value=${
|
|
195
|
+
.value=${gt(this,sr)}
|
|
80
196
|
.options=${e}
|
|
81
197
|
@change=${this.debouncedDataChange}
|
|
82
198
|
></eox-jsonform>
|
|
83
199
|
`)}
|
|
84
|
-
`}}
|
|
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,`
|
|
85
201
|
.tabbed figure {
|
|
86
202
|
margin: 0;
|
|
87
203
|
}
|
|
@@ -101,7 +217,7 @@
|
|
|
101
217
|
.tabbed label.highlighted {
|
|
102
218
|
background: lightgrey;
|
|
103
219
|
}
|
|
104
|
-
`);
|
|
220
|
+
`);ut(this,Cs,`
|
|
105
221
|
.tabbed {
|
|
106
222
|
font-size: small;
|
|
107
223
|
}
|
|
@@ -122,33 +238,33 @@
|
|
|
122
238
|
background: #00417011;
|
|
123
239
|
border-top: 1px solid #0041701a;
|
|
124
240
|
}
|
|
125
|
-
`);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,
|
|
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`
|
|
126
242
|
<style>
|
|
127
|
-
${
|
|
128
|
-
${!this.unstyled&&
|
|
243
|
+
${gt(this,Rs)}
|
|
244
|
+
${!this.unstyled&>(this,Cs)}
|
|
129
245
|
</style>
|
|
130
246
|
<div class="tabbed">
|
|
131
247
|
<!-- Navigation for tabs and actions -->
|
|
132
|
-
${
|
|
248
|
+
${ne(r,()=>q`
|
|
133
249
|
<nav>
|
|
134
250
|
<div>
|
|
135
251
|
<!-- Labels for tabs -->
|
|
136
|
-
${
|
|
252
|
+
${ss(e,(s,o)=>q`
|
|
137
253
|
<label
|
|
138
|
-
class=${
|
|
139
|
-
@click=${()=>this.selectedTab=
|
|
254
|
+
class=${gt(this,ar).call(this,o)}
|
|
255
|
+
@click=${()=>this.selectedTab=o}
|
|
140
256
|
>
|
|
141
257
|
<!-- Customizable icon for each tab -->
|
|
142
|
-
<slot name=${`${
|
|
258
|
+
<slot name=${`${s}-icon`}>${s}</slot>
|
|
143
259
|
</label>
|
|
144
260
|
`)}
|
|
145
261
|
</div>
|
|
146
262
|
<div>
|
|
147
263
|
<!-- Icons for actions -->
|
|
148
|
-
${
|
|
264
|
+
${ss(n,s=>q`
|
|
149
265
|
<span>
|
|
150
266
|
<!-- Customizable icon for each action -->
|
|
151
|
-
<slot name=${`${
|
|
267
|
+
<slot name=${`${s}-icon`}>${s}</slot>
|
|
152
268
|
</span>
|
|
153
269
|
`)}
|
|
154
270
|
</div>
|
|
@@ -156,15 +272,15 @@
|
|
|
156
272
|
`)}
|
|
157
273
|
<figure>
|
|
158
274
|
<!-- Content for each tab -->
|
|
159
|
-
${
|
|
160
|
-
<div class="tab ${
|
|
275
|
+
${ss(e,(s,o)=>q`
|
|
276
|
+
<div class="tab ${gt(this,ar).call(this,o)}">
|
|
161
277
|
<!-- Content slot for each tab -->
|
|
162
|
-
<slot name=${`${
|
|
278
|
+
<slot name=${`${s}-content`}>${s}</slot>
|
|
163
279
|
</div>
|
|
164
280
|
`)}
|
|
165
281
|
</figure>
|
|
166
282
|
</div>
|
|
167
|
-
`}}
|
|
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=`
|
|
168
284
|
button,
|
|
169
285
|
.button {
|
|
170
286
|
/* TODO: why does this only work here and not from :root? */
|
|
@@ -288,7 +404,7 @@ button.smallest.icon::before {
|
|
|
288
404
|
width: 16px;
|
|
289
405
|
padding: 0px;
|
|
290
406
|
}
|
|
291
|
-
`,
|
|
407
|
+
`,w0=`
|
|
292
408
|
input[type=radio] {
|
|
293
409
|
appearance: none;
|
|
294
410
|
-webkit-appearance: none;
|
|
@@ -316,7 +432,7 @@ input[type=radio]:checked:after {
|
|
|
316
432
|
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");
|
|
317
433
|
|
|
318
434
|
}
|
|
319
|
-
`,
|
|
435
|
+
`,cu=`
|
|
320
436
|
input[type=checkbox] {
|
|
321
437
|
appearance: none;
|
|
322
438
|
-webkit-appearance: none;
|
|
@@ -339,7 +455,7 @@ input[type=checkbox]:checked:after {
|
|
|
339
455
|
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");
|
|
340
456
|
|
|
341
457
|
}
|
|
342
|
-
`,
|
|
458
|
+
`,S0=`
|
|
343
459
|
input[type="range"] {
|
|
344
460
|
-webkit-appearance: none;
|
|
345
461
|
width: 90%;
|
|
@@ -416,11 +532,11 @@ input[type="range"]:focus::-webkit-slider-thumb {
|
|
|
416
532
|
input::-moz-focus-inner, input::-moz-focus-outer {
|
|
417
533
|
border: 0;
|
|
418
534
|
}
|
|
419
|
-
`;class
|
|
420
|
-
${
|
|
421
|
-
${
|
|
422
|
-
${
|
|
423
|
-
${
|
|
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}
|
|
424
540
|
.drag-handle {
|
|
425
541
|
cursor: n-resize;
|
|
426
542
|
}
|
|
@@ -512,35 +628,35 @@ input::-moz-focus-inner, input::-moz-focus-outer {
|
|
|
512
628
|
[slot=opacity-content] {
|
|
513
629
|
padding: 12px 6px;
|
|
514
630
|
}
|
|
515
|
-
`);this.layer=null,this.tools=[],this.unstyled=!1,this.noShadow=!1}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}render(){var l;const e=
|
|
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`
|
|
516
632
|
<style>
|
|
517
|
-
${
|
|
518
|
-
${!this.unstyled&&
|
|
633
|
+
${gt(this,Is)}
|
|
634
|
+
${!this.unstyled&>(this,As)}
|
|
519
635
|
</style>
|
|
520
|
-
${
|
|
521
|
-
${
|
|
636
|
+
${ne(o+a>0,()=>q`
|
|
637
|
+
${ne(o===1&&a===0,()=>q`
|
|
522
638
|
<div class="single-action-container">
|
|
523
|
-
<div class="single-action">${
|
|
639
|
+
<div class="single-action">${r}</div>
|
|
524
640
|
</div>
|
|
525
|
-
`,()=>{var
|
|
641
|
+
`,()=>{var h;return q`
|
|
526
642
|
<details
|
|
527
643
|
class="tools"
|
|
528
|
-
open=${this.layer.get("layerControlToolsExpand")||
|
|
644
|
+
open=${this.layer.get("layerControlToolsExpand")||at}
|
|
529
645
|
>
|
|
530
646
|
<summary>
|
|
531
|
-
<button class="icon ${
|
|
647
|
+
<button class="icon ${s}">Tools</button>
|
|
532
648
|
</summary>
|
|
533
649
|
<eox-layercontrol-tabs
|
|
534
650
|
.noShadow=${!1}
|
|
535
651
|
.actions=${e}
|
|
536
|
-
.tabs=${
|
|
652
|
+
.tabs=${n}
|
|
537
653
|
.unstyled=${this.unstyled}
|
|
538
654
|
>
|
|
539
655
|
<!-- Rendering tabs and content -->
|
|
540
|
-
${
|
|
656
|
+
${ss(n,c=>this._button(c))}
|
|
541
657
|
|
|
542
658
|
<div slot="info-content">
|
|
543
|
-
${
|
|
659
|
+
${A_(this.layer.get("description"))}
|
|
544
660
|
</div>
|
|
545
661
|
<div slot="opacity-content">
|
|
546
662
|
<!-- Input for opacity -->
|
|
@@ -549,13 +665,13 @@ input::-moz-focus-inner, input::-moz-focus-outer {
|
|
|
549
665
|
min="0"
|
|
550
666
|
max="1"
|
|
551
667
|
step="0.01"
|
|
552
|
-
value=${
|
|
553
|
-
@input=${
|
|
668
|
+
value=${bc((h=this.layer)==null?void 0:h.getOpacity())}
|
|
669
|
+
@input=${c=>this.layer.setOpacity(parseFloat(c.target.value))}
|
|
554
670
|
/>
|
|
555
671
|
</div>
|
|
556
672
|
<div slot="config-content">
|
|
557
673
|
<!-- Layer configuration -->
|
|
558
|
-
${
|
|
674
|
+
${ne(this.layer.get("layerConfig"),()=>q`
|
|
559
675
|
<eox-layercontrol-layerconfig
|
|
560
676
|
slot="config-content"
|
|
561
677
|
.layer=${this.layer}
|
|
@@ -572,8 +688,8 @@ input::-moz-focus-inner, input::-moz-focus-outer {
|
|
|
572
688
|
</details>
|
|
573
689
|
`})}
|
|
574
690
|
`)}
|
|
575
|
-
`}}
|
|
576
|
-
${
|
|
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}
|
|
577
693
|
eox-layercontrol-layer {
|
|
578
694
|
width: 100%;
|
|
579
695
|
}
|
|
@@ -613,25 +729,25 @@ input::-moz-focus-inner, input::-moz-focus-outer {
|
|
|
613
729
|
[data-type=draw] .title::before {
|
|
614
730
|
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");
|
|
615
731
|
}
|
|
616
|
-
`);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(){
|
|
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`
|
|
617
733
|
<style>
|
|
618
|
-
${
|
|
619
|
-
${!this.unstyled&&
|
|
734
|
+
${gt(this,Ms)}
|
|
735
|
+
${!this.unstyled&>(this,Ds)}
|
|
620
736
|
</style>
|
|
621
|
-
${
|
|
737
|
+
${ne(this.layer,()=>q`
|
|
622
738
|
<!-- Render the layer -->
|
|
623
|
-
<div class="layer ${
|
|
624
|
-
<label class="drag-handle ${
|
|
739
|
+
<div class="layer ${n} ${r}">
|
|
740
|
+
<label class="drag-handle ${s}">
|
|
625
741
|
<!-- Input element for layer visibility -->
|
|
626
742
|
<input
|
|
627
|
-
type=${
|
|
628
|
-
.checked=${
|
|
629
|
-
@click=${
|
|
743
|
+
type=${o}
|
|
744
|
+
.checked=${bc(e)}
|
|
745
|
+
@click=${$t(this,ai,Lu)}
|
|
630
746
|
/>
|
|
631
747
|
|
|
632
748
|
<!-- Layer title -->
|
|
633
|
-
<span class="title">${
|
|
634
|
-
${
|
|
749
|
+
<span class="title">${$t(this,ai,zs).call(this,this.titleProperty)}</span>
|
|
750
|
+
${ne(a,()=>q`<span class="tools-placeholder"></span>`)}
|
|
635
751
|
</label>
|
|
636
752
|
</div>
|
|
637
753
|
|
|
@@ -643,7 +759,7 @@ input::-moz-focus-inner, input::-moz-focus-outer {
|
|
|
643
759
|
.unstyled=${this.unstyled}
|
|
644
760
|
></eox-layercontrol-layer-tools>
|
|
645
761
|
`)}
|
|
646
|
-
`}}
|
|
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,`
|
|
647
763
|
details summary {
|
|
648
764
|
cursor: pointer;
|
|
649
765
|
display: flex;
|
|
@@ -667,16 +783,16 @@ input::-moz-focus-inner, input::-moz-focus-outer {
|
|
|
667
783
|
details[data-children-length="0"] summary::before {
|
|
668
784
|
display: none;
|
|
669
785
|
}
|
|
670
|
-
`);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
|
|
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`
|
|
671
787
|
<style>
|
|
672
|
-
${
|
|
673
|
-
${!this.unstyled&&
|
|
788
|
+
${gt(this,Ls)}
|
|
789
|
+
${!this.unstyled&>(this,Os)}
|
|
674
790
|
</style>
|
|
675
|
-
${
|
|
791
|
+
${ne(this.group,()=>q`
|
|
676
792
|
<!-- Render the details element with the layer control -->
|
|
677
793
|
<details
|
|
678
|
-
open=${e||
|
|
679
|
-
data-children-length=${
|
|
794
|
+
open=${e||at}
|
|
795
|
+
data-children-length=${n}
|
|
680
796
|
>
|
|
681
797
|
<summary>
|
|
682
798
|
<!-- Render the layer control within the summary -->
|
|
@@ -706,7 +822,7 @@ input::-moz-focus-inner, input::-moz-focus-outer {
|
|
|
706
822
|
></eox-layercontrol-layer-list>
|
|
707
823
|
</details>
|
|
708
824
|
`)}
|
|
709
|
-
`}}
|
|
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,`
|
|
710
826
|
ul {
|
|
711
827
|
padding: 0;
|
|
712
828
|
margin: 0;
|
|
@@ -734,22 +850,22 @@ input::-moz-focus-inner, input::-moz-focus-outer {
|
|
|
734
850
|
}
|
|
735
851
|
li.sortable-ghost {
|
|
736
852
|
}
|
|
737
|
-
`);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(){
|
|
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`
|
|
738
854
|
<style>
|
|
739
|
-
${
|
|
740
|
-
${!this.unstyled&&
|
|
855
|
+
${gt(this,Ps)}
|
|
856
|
+
${!this.unstyled&>(this,$s)}
|
|
741
857
|
</style>
|
|
742
858
|
<ul>
|
|
743
|
-
${
|
|
744
|
-
${
|
|
859
|
+
${ne(this.layers,()=>q`
|
|
860
|
+
${nd(e,n=>n,n=>q`
|
|
745
861
|
<li
|
|
746
|
-
data-layer="${
|
|
747
|
-
data-type="${
|
|
862
|
+
data-layer="${n.get(this.idProperty)}"
|
|
863
|
+
data-type="${Df(n,this.map)}"
|
|
748
864
|
>
|
|
749
|
-
${
|
|
865
|
+
${n.getLayers?q`
|
|
750
866
|
<eox-layercontrol-layer-group
|
|
751
867
|
.noShadow=${!0}
|
|
752
|
-
.group=${
|
|
868
|
+
.group=${n}
|
|
753
869
|
.idProperty=${this.idProperty}
|
|
754
870
|
.map=${this.map}
|
|
755
871
|
.titleProperty=${this.titleProperty}
|
|
@@ -759,10 +875,10 @@ input::-moz-focus-inner, input::-moz-focus-outer {
|
|
|
759
875
|
@changed=${()=>this.requestUpdate()}
|
|
760
876
|
>
|
|
761
877
|
</eox-layercontrol-layer-group>
|
|
762
|
-
`:
|
|
878
|
+
`:q`
|
|
763
879
|
<eox-layercontrol-layer
|
|
764
880
|
.noShadow=${!0}
|
|
765
|
-
.layer=${
|
|
881
|
+
.layer=${n}
|
|
766
882
|
.map=${this.map}
|
|
767
883
|
.titleProperty=${this.titleProperty}
|
|
768
884
|
.showLayerZoomState=${this.showLayerZoomState}
|
|
@@ -775,7 +891,7 @@ input::-moz-focus-inner, input::-moz-focus-outer {
|
|
|
775
891
|
`)}
|
|
776
892
|
`)}
|
|
777
893
|
</ul>
|
|
778
|
-
`}}
|
|
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`
|
|
779
895
|
<!-- Label for the dropdown -->
|
|
780
896
|
<label for="optional">Optional layers</label>
|
|
781
897
|
|
|
@@ -787,19 +903,19 @@ input::-moz-focus-inner, input::-moz-focus-outer {
|
|
|
787
903
|
</option>
|
|
788
904
|
|
|
789
905
|
<!-- Mapping through filtered layers list to generate dropdown options -->
|
|
790
|
-
${e.map(
|
|
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> `})}
|
|
791
907
|
</select>
|
|
792
908
|
|
|
793
909
|
<!-- Button to handle adding layers -->
|
|
794
|
-
<button @click="${
|
|
795
|
-
`}}
|
|
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,`
|
|
796
912
|
.eox-add-layer-main .open {
|
|
797
913
|
position: relative;
|
|
798
914
|
}
|
|
799
915
|
.eox-add-layer-main .close {
|
|
800
916
|
display: none;
|
|
801
917
|
}
|
|
802
|
-
`);
|
|
918
|
+
`);ut(this,Fs,`
|
|
803
919
|
.eox-add {
|
|
804
920
|
background: #f0f2f5;
|
|
805
921
|
border-top: 1px solid #0041701a;
|
|
@@ -932,24 +1048,24 @@ input::-moz-focus-inner, input::-moz-focus-outer {
|
|
|
932
1048
|
font-weight: bold;
|
|
933
1049
|
display: inline-block;
|
|
934
1050
|
}
|
|
935
|
-
`);this.eoxMap=null,this.unstyled=!1,this.noShadow=!1}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}render(){const e=this.open?"open":"close",
|
|
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`
|
|
936
1052
|
<style>
|
|
937
|
-
${
|
|
938
|
-
${!this.unstyled&&
|
|
1053
|
+
${gt(this,ks)}
|
|
1054
|
+
${!this.unstyled&>(this,Fs)}
|
|
939
1055
|
</style>
|
|
940
1056
|
<div class="eox-add-layer-main">
|
|
941
1057
|
<div class="eox-add-layer-col">
|
|
942
1058
|
<!-- Tabbed interface for URL and JSON -->
|
|
943
1059
|
<ul class="eox-add-layer-tab ${e}">
|
|
944
1060
|
<li
|
|
945
|
-
@click=${()
|
|
946
|
-
class="${
|
|
1061
|
+
@click=${()=>$t(this,Pt,Vs).call(this,"url")}
|
|
1062
|
+
class="${n?"active":""}"
|
|
947
1063
|
>
|
|
948
1064
|
URL
|
|
949
1065
|
</li>
|
|
950
1066
|
<li
|
|
951
|
-
@click=${()
|
|
952
|
-
class="${
|
|
1067
|
+
@click=${()=>$t(this,Pt,Vs).call(this,"json")}
|
|
1068
|
+
class="${r?"active":""}"
|
|
953
1069
|
>
|
|
954
1070
|
JSON
|
|
955
1071
|
</li>
|
|
@@ -958,13 +1074,13 @@ input::-moz-focus-inner, input::-moz-focus-outer {
|
|
|
958
1074
|
<!-- Button to toggle tabs -->
|
|
959
1075
|
<button
|
|
960
1076
|
class="add-icon icon"
|
|
961
|
-
@click=${()
|
|
1077
|
+
@click=${()=>$t(this,Pt,Vs).call(this,this.open?null:"url")}
|
|
962
1078
|
>
|
|
963
1079
|
${this.unstyled?"Add Layer":""}
|
|
964
1080
|
</button>
|
|
965
1081
|
</div>
|
|
966
1082
|
<div class="eox-add ${e}">
|
|
967
|
-
${
|
|
1083
|
+
${n?q`
|
|
968
1084
|
<!-- Input field for URL -->
|
|
969
1085
|
<div class="eox-add-layer-col">
|
|
970
1086
|
<input
|
|
@@ -972,71 +1088,71 @@ input::-moz-focus-inner, input::-moz-focus-outer {
|
|
|
972
1088
|
class="add-url"
|
|
973
1089
|
placeholder="Add URL (WMS/XYZ)"
|
|
974
1090
|
.value="${this.urlInput}"
|
|
975
|
-
@input=${
|
|
1091
|
+
@input=${$t(this,Pt,Pu)}
|
|
976
1092
|
>
|
|
977
1093
|
</input>
|
|
978
1094
|
<!-- Search button for URL -->
|
|
979
1095
|
<button
|
|
980
1096
|
class="search-icon"
|
|
981
|
-
disabled=${
|
|
982
|
-
@click=${
|
|
1097
|
+
disabled=${s}
|
|
1098
|
+
@click=${$t(this,Pt,$u)}
|
|
983
1099
|
>
|
|
984
1100
|
${this.unstyled?"Search":""}
|
|
985
1101
|
</button>
|
|
986
1102
|
</div>
|
|
987
1103
|
|
|
988
1104
|
<!-- Display layers for WMS capabilities -->
|
|
989
|
-
${this.wmsCapabilities?
|
|
990
|
-
${this.wmsCapabilities.Capability.Layer.Layer.map(
|
|
1105
|
+
${this.wmsCapabilities?q`<ul class="search-lists">
|
|
1106
|
+
${this.wmsCapabilities.Capability.Layer.Layer.map(o=>{const a=o.Name;return q`
|
|
991
1107
|
<li class="search-list">
|
|
992
1108
|
${a}
|
|
993
1109
|
<!-- Button to add layer -->
|
|
994
1110
|
<button
|
|
995
1111
|
class="add-layer-icon icon"
|
|
996
|
-
@click=${()
|
|
1112
|
+
@click=${()=>$t(this,Pt,Ha).call(this,o)}
|
|
997
1113
|
>
|
|
998
1114
|
${this.unstyled?"+":""}
|
|
999
1115
|
</button>
|
|
1000
1116
|
</li>
|
|
1001
1117
|
`})}
|
|
1002
|
-
</ul>`:
|
|
1003
|
-
`:
|
|
1118
|
+
</ul>`:at}
|
|
1119
|
+
`:q`
|
|
1004
1120
|
<!-- Textarea for JSON input -->
|
|
1005
1121
|
<textarea
|
|
1006
1122
|
class="add-layer-input"
|
|
1007
1123
|
placeholder="Please put a valid eox-map layer JSON."
|
|
1008
|
-
@input=${
|
|
1124
|
+
@input=${$t(this,Pt,ku)}
|
|
1009
1125
|
.value=${this.jsonInput}
|
|
1010
1126
|
></textarea>
|
|
1011
1127
|
|
|
1012
1128
|
<!-- Button to add JSON layer -->
|
|
1013
1129
|
<button
|
|
1014
1130
|
class="add-layer-icon json-add-layer"
|
|
1015
|
-
disabled=${
|
|
1016
|
-
@click=${
|
|
1131
|
+
disabled=${Kd(this.jsonInput)?at:!0}
|
|
1132
|
+
@click=${$t(this,Pt,Nu)}
|
|
1017
1133
|
>
|
|
1018
1134
|
${this.unstyled?"Add JSON":""}
|
|
1019
1135
|
</button>
|
|
1020
1136
|
`}
|
|
1021
1137
|
</div>
|
|
1022
1138
|
</div>
|
|
1023
|
-
`}}
|
|
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`
|
|
1024
1140
|
<style>
|
|
1025
|
-
${!this.unstyled&&
|
|
1141
|
+
${!this.unstyled&>(this,Us)}
|
|
1026
1142
|
${this.styleOverride}
|
|
1027
1143
|
</style>
|
|
1028
1144
|
|
|
1029
1145
|
<!-- Conditional rendering of add layers component -->
|
|
1030
|
-
${
|
|
1146
|
+
${ne(this.addExternalLayers&&((o=gt(this,cn))==null?void 0:o.addOrUpdateLayer),()=>q`
|
|
1031
1147
|
<eox-layercontrol-add-layers
|
|
1032
1148
|
.noShadow=${!0}
|
|
1033
|
-
.eoxMap=${
|
|
1149
|
+
.eoxMap=${gt(this,cn)}
|
|
1034
1150
|
.unstyled=${this.unstyled}
|
|
1035
1151
|
></eox-layercontrol-add-layers>
|
|
1036
1152
|
`)}
|
|
1037
1153
|
|
|
1038
1154
|
<!-- Conditional rendering of layer list component -->
|
|
1039
|
-
${
|
|
1155
|
+
${ne(this.map,()=>q`
|
|
1040
1156
|
<eox-layercontrol-layer-list
|
|
1041
1157
|
.noShadow=${!0}
|
|
1042
1158
|
class="layers"
|
|
@@ -1047,12 +1163,12 @@ input::-moz-focus-inner, input::-moz-focus-outer {
|
|
|
1047
1163
|
.showLayerZoomState=${this.showLayerZoomState}
|
|
1048
1164
|
.tools=${this.tools}
|
|
1049
1165
|
.unstyled=${this.unstyled}
|
|
1050
|
-
@changed=${
|
|
1166
|
+
@changed=${$t(this,Bs,Fu)}
|
|
1051
1167
|
></eox-layercontrol-layer-list>
|
|
1052
1168
|
`)}
|
|
1053
1169
|
|
|
1054
1170
|
<!-- Conditional rendering of optional list component -->
|
|
1055
|
-
${
|
|
1171
|
+
${ne(n,()=>q`
|
|
1056
1172
|
<eox-layercontrol-optional-list
|
|
1057
1173
|
.noShadow=${!0}
|
|
1058
1174
|
.idProperty=${this.idProperty}
|
|
@@ -1061,4 +1177,4 @@ input::-moz-focus-inner, input::-moz-focus-outer {
|
|
|
1061
1177
|
@changed=${()=>this.requestUpdate()}
|
|
1062
1178
|
></eox-layercontrol-optional-list>
|
|
1063
1179
|
`)}
|
|
1064
|
-
`}}
|
|
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"})});
|