@eox/drawtools 0.11.1 → 0.13.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-drawtools.js +6395 -562
- package/dist/eox-drawtools.umd.cjs +38 -37
- package/package.json +17 -4
- package/src/helpers/features-to-geojson.js +14 -0
- package/src/helpers/features-to-wkt.js +13 -0
- package/src/helpers/index.js +2 -0
- package/src/main.js +24 -8
- package/src/methods/draw/emit-drawn-features.js +42 -3
- package/types/drawtools/src/components/controller.d.ts +99 -0
- package/types/drawtools/src/components/controller.d.ts.map +1 -0
- package/types/drawtools/src/components/list.d.ts +118 -0
- package/types/drawtools/src/components/list.d.ts.map +1 -0
- package/types/drawtools/src/enums/draw.d.ts +8 -0
- package/types/drawtools/src/enums/draw.d.ts.map +1 -0
- package/types/drawtools/src/enums/index.d.ts +4 -0
- package/types/drawtools/src/enums/index.d.ts.map +1 -0
- package/types/drawtools/src/enums/stories.d.ts +30 -0
- package/types/drawtools/src/enums/stories.d.ts.map +1 -0
- package/types/drawtools/src/enums/test.d.ts +8 -0
- package/types/drawtools/src/enums/test.d.ts.map +1 -0
- package/types/drawtools/src/helpers/copy-text-to-clipboard.d.ts +7 -0
- package/types/drawtools/src/helpers/copy-text-to-clipboard.d.ts.map +1 -0
- package/types/drawtools/src/helpers/features-to-geojson.d.ts +11 -0
- package/types/drawtools/src/helpers/features-to-geojson.d.ts.map +1 -0
- package/types/drawtools/src/helpers/features-to-wkt.d.ts +9 -0
- package/types/drawtools/src/helpers/features-to-wkt.d.ts.map +1 -0
- package/types/drawtools/src/helpers/generate-upload-events.d.ts +17 -0
- package/types/drawtools/src/helpers/generate-upload-events.d.ts.map +1 -0
- package/types/drawtools/src/helpers/index.d.ts +4 -0
- package/types/drawtools/src/helpers/index.d.ts.map +1 -0
- package/types/drawtools/src/main.d.ts +204 -0
- package/types/drawtools/src/main.d.ts.map +1 -0
- package/types/drawtools/src/methods/controller/index.d.ts +2 -0
- package/types/drawtools/src/methods/controller/index.d.ts.map +1 -0
- package/types/drawtools/src/methods/controller/update-button-states.d.ts +12 -0
- package/types/drawtools/src/methods/controller/update-button-states.d.ts.map +1 -0
- package/types/drawtools/src/methods/draw/create-select-handler.d.ts +10 -0
- package/types/drawtools/src/methods/draw/create-select-handler.d.ts.map +1 -0
- package/types/drawtools/src/methods/draw/discard-drawing.d.ts +9 -0
- package/types/drawtools/src/methods/draw/discard-drawing.d.ts.map +1 -0
- package/types/drawtools/src/methods/draw/emit-drawn-features.d.ts +20 -0
- package/types/drawtools/src/methods/draw/emit-drawn-features.d.ts.map +1 -0
- package/types/drawtools/src/methods/draw/handle-layer-id.d.ts +12 -0
- package/types/drawtools/src/methods/draw/handle-layer-id.d.ts.map +1 -0
- package/types/drawtools/src/methods/draw/index.d.ts +9 -0
- package/types/drawtools/src/methods/draw/index.d.ts.map +1 -0
- package/types/drawtools/src/methods/draw/init-layer.d.ts +13 -0
- package/types/drawtools/src/methods/draw/init-layer.d.ts.map +1 -0
- package/types/drawtools/src/methods/draw/init-selection.d.ts +9 -0
- package/types/drawtools/src/methods/draw/init-selection.d.ts.map +1 -0
- package/types/drawtools/src/methods/draw/on-draw-end.d.ts +9 -0
- package/types/drawtools/src/methods/draw/on-draw-end.d.ts.map +1 -0
- package/types/drawtools/src/methods/draw/start-drawing.d.ts +9 -0
- package/types/drawtools/src/methods/draw/start-drawing.d.ts.map +1 -0
- package/types/drawtools/src/methods/list/delete-feature.d.ts +11 -0
- package/types/drawtools/src/methods/list/delete-feature.d.ts.map +1 -0
- package/types/drawtools/src/methods/list/first-update.d.ts +8 -0
- package/types/drawtools/src/methods/list/first-update.d.ts.map +1 -0
- package/types/drawtools/src/methods/list/hover-feature.d.ts +10 -0
- package/types/drawtools/src/methods/list/hover-feature.d.ts.map +1 -0
- package/types/drawtools/src/methods/list/index.d.ts +5 -0
- package/types/drawtools/src/methods/list/index.d.ts.map +1 -0
- package/types/drawtools/src/methods/list/select-deselect-feature.d.ts +9 -0
- package/types/drawtools/src/methods/list/select-deselect-feature.d.ts.map +1 -0
- package/types/drawtools/src/style.eox.d.ts +2 -0
- package/types/drawtools/src/style.eox.d.ts.map +1 -0
- package/types/map/src/components/compare.d.ts +31 -0
- package/types/map/src/components/compare.d.ts.map +1 -0
- package/types/map/src/components/tooltip.d.ts +36 -0
- package/types/map/src/components/tooltip.d.ts.map +1 -0
- package/types/map/src/controls/controls.d.ts +27 -0
- package/types/map/src/controls/controls.d.ts.map +1 -0
- package/types/map/src/controls/geo-location.d.ts +41 -0
- package/types/map/src/controls/geo-location.d.ts.map +1 -0
- package/types/map/src/controls/loading-indicator.d.ts +20 -0
- package/types/map/src/controls/loading-indicator.d.ts.map +1 -0
- package/types/map/src/enums/index.d.ts +2 -0
- package/types/map/src/enums/index.d.ts.map +1 -0
- package/types/map/src/enums/map.d.ts +5 -0
- package/types/map/src/enums/map.d.ts.map +1 -0
- package/types/map/src/helpers/add-new-feature.d.ts +14 -0
- package/types/map/src/helpers/add-new-feature.d.ts.map +1 -0
- package/types/map/src/helpers/cancel-animation.d.ts +7 -0
- package/types/map/src/helpers/cancel-animation.d.ts.map +1 -0
- package/types/map/src/helpers/center.d.ts +12 -0
- package/types/map/src/helpers/center.d.ts.map +1 -0
- package/types/map/src/helpers/coordinates-roughly-equals.d.ts +12 -0
- package/types/map/src/helpers/coordinates-roughly-equals.d.ts.map +1 -0
- package/types/map/src/helpers/draw.d.ts +22 -0
- package/types/map/src/helpers/draw.d.ts.map +1 -0
- package/types/map/src/helpers/generate.d.ts +30 -0
- package/types/map/src/helpers/generate.d.ts.map +1 -0
- package/types/map/src/helpers/index.d.ts +16 -0
- package/types/map/src/helpers/index.d.ts.map +1 -0
- package/types/map/src/helpers/interactions.d.ts +16 -0
- package/types/map/src/helpers/interactions.d.ts.map +1 -0
- package/types/map/src/helpers/layer.d.ts +24 -0
- package/types/map/src/helpers/layer.d.ts.map +1 -0
- package/types/map/src/helpers/parse-feature.d.ts +8 -0
- package/types/map/src/helpers/parse-feature.d.ts.map +1 -0
- package/types/map/src/helpers/parse-text.d.ts +33 -0
- package/types/map/src/helpers/parse-text.d.ts.map +1 -0
- package/types/map/src/helpers/register-projection-from-code.d.ts +8 -0
- package/types/map/src/helpers/register-projection-from-code.d.ts.map +1 -0
- package/types/map/src/helpers/register-projection.d.ts +11 -0
- package/types/map/src/helpers/register-projection.d.ts.map +1 -0
- package/types/map/src/helpers/select.d.ts +86 -0
- package/types/map/src/helpers/select.d.ts.map +1 -0
- package/types/map/src/helpers/tile-grid.d.ts +14 -0
- package/types/map/src/helpers/tile-grid.d.ts.map +1 -0
- package/types/map/src/helpers/transform.d.ts +19 -0
- package/types/map/src/helpers/transform.d.ts.map +1 -0
- package/types/map/src/main.d.ts +337 -0
- package/types/map/src/main.d.ts.map +1 -0
- package/types/map/src/methods/map/add-update-layer.d.ts +13 -0
- package/types/map/src/methods/map/add-update-layer.d.ts.map +1 -0
- package/types/map/src/methods/map/animate-to-state.d.ts +7 -0
- package/types/map/src/methods/map/animate-to-state.d.ts.map +1 -0
- package/types/map/src/methods/map/first-updated.d.ts +9 -0
- package/types/map/src/methods/map/first-updated.d.ts.map +1 -0
- package/types/map/src/methods/map/getters.d.ts +15 -0
- package/types/map/src/methods/map/getters.d.ts.map +1 -0
- package/types/map/src/methods/map/index.d.ts +7 -0
- package/types/map/src/methods/map/index.d.ts.map +1 -0
- package/types/map/src/methods/map/remove.d.ts +22 -0
- package/types/map/src/methods/map/remove.d.ts.map +1 -0
- package/types/map/src/methods/map/setters.d.ts +82 -0
- package/types/map/src/methods/map/setters.d.ts.map +1 -0
- package/types/map/types.d.ts +148 -0
- package/types/map/types.d.ts.map +1 -0
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(v,_){typeof exports=="object"&&typeof module<"u"?_(exports):typeof define=="function"&&define.amd?define(["exports"],_):(v=typeof globalThis<"u"?globalThis:v||self,_(v["eox-drawtools"]={}))})(this,function(v){"use strict";var ms=Object.defineProperty;var Hi=v=>{throw TypeError(v)};var _s=(v,_,b)=>_ in v?ms(v,_,{enumerable:!0,configurable:!0,writable:!0,value:b}):v[_]=b;var W=(v,_,b)=>_s(v,typeof _!="symbol"?_+"":_,b),ji=(v,_,b)=>_.has(v)||Hi("Cannot "+b);var M=(v,_,b)=>(ji(v,_,"read from private field"),b?b.call(v):_.get(v)),D=(v,_,b)=>_.has(v)?Hi("Cannot add the same private member more than once"):_ instanceof WeakSet?_.add(v):_.set(v,b),G=(v,_,b,at)=>(ji(v,_,"write to private field"),at?at.call(v,b):_.set(v,b),b);/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/var
|
|
5
|
+
*/var Oi,Et,xt,rt,st,Pt,ot;const _=globalThis,b=_.ShadowRoot&&(_.ShadyCSS===void 0||_.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,at=Symbol(),be=new WeakMap;let Ui=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==at)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(b&&t===void 0){const i=e!==void 0&&e.length===1;i&&(t=be.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&be.set(e,t))}return t}toString(){return this.cssText}};const Xi=n=>new Ui(typeof n=="string"?n:n+"",void 0,at),Yi=(n,t)=>{if(b)n.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const i=document.createElement("style"),r=_.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=e.cssText,n.appendChild(i)}},Ee=b?n=>n:n=>n instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return Xi(e)})(n):n;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is:
|
|
9
|
+
*/const{is:Bi,defineProperty:Vi,getOwnPropertyDescriptor:zi,getOwnPropertyNames:Ji,getOwnPropertySymbols:Wi,getPrototypeOf:Di}=Object,S=globalThis,xe=S.trustedTypes,Zi=xe?xe.emptyScript:"",Yt=S.reactiveElementPolyfillSupport,lt=(n,t)=>n,Bt={toAttribute(n,t){switch(t){case Boolean:n=n?Zi:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,t){let e=n;switch(t){case Boolean:e=n!==null;break;case Number:e=n===null?null:Number(n);break;case Object:case Array:try{e=JSON.parse(n)}catch{e=null}}return e}},Pe=(n,t)=>!Bi(n,t),$e={attribute:!0,type:String,converter:Bt,reflect:!1,hasChanged:Pe};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),S.litPropertyMetadata??(S.litPropertyMetadata=new WeakMap);class Z 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=$e){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(t,i,e);r!==void 0&&Vi(this.prototype,t,r)}}static getPropertyDescriptor(t,e,i){const{get:r,set:s}=zi(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get(){return r==null?void 0:r.call(this)},set(o){const a=r==null?void 0:r.call(this);s.call(this,o),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??$e}static _$Ei(){if(this.hasOwnProperty(lt("elementProperties")))return;const t=Di(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(lt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(lt("properties"))){const e=this.properties,i=[...Ji(e),...Wi(e)];for(const r of i)this.createProperty(r,e[r])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[i,r]of e)this.elementProperties.set(i,r)}this._$Eh=new Map;for(const[e,i]of this.elementProperties){const r=this._$Eu(e,i);r!==void 0&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const r of i)e.unshift(Ee(r))}else t!==void 0&&e.push(Ee(t));return e}static _$Eu(t,e){const i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Yi(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(e=>{var i;return(i=e.hostConnected)==null?void 0:i.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var i;return(i=e.hostDisconnected)==null?void 0:i.call(e)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EC(t,e){var s;const i=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,i);if(r!==void 0&&i.reflect===!0){const o=(((s=i.converter)==null?void 0:s.toAttribute)!==void 0?i.converter:Bt).toAttribute(e,i.type);this._$Em=t,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(t,e){var s;const i=this.constructor,r=i._$Eh.get(t);if(r!==void 0&&this._$Em!==r){const o=i.getPropertyOptions(r),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((s=o.converter)==null?void 0:s.fromAttribute)!==void 0?o.converter:Bt;this._$Em=r,this[r]=a.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,i){if(t!==void 0){if(i??(i=this.constructor.getPropertyOptions(t)),!(i.hasChanged??Pe)(this[t],e))return;this.P(t,e,i)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,i){this._$AL.has(t)||this._$AL.set(t,e),i.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[s,o]of this._$Ep)this[s]=o;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[s,o]of r)o.wrapped!==!0||this._$AL.has(s)||this[s]===void 0||this.P(s,this[s],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(i=this._$EO)==null||i.forEach(r=>{var s;return(s=r.hostUpdate)==null?void 0:s.call(r)}),this.update(e)):this._$EU()}catch(r){throw t=!1,this._$EU(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(i=>{var r;return(r=i.hostUpdated)==null?void 0:r.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}}Z.elementStyles=[],Z.shadowRootOptions={mode:"open"},Z[lt("elementProperties")]=new Map,Z[lt("finalized")]=new Map,Yt==null||Yt({ReactiveElement:Z}),(S.reactiveElementVersions??(S.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 ht=globalThis,At=ht.trustedTypes,Ae=At?At.createPolicy("lit-html",{createHTML:n=>n}):void 0,Me="$lit$",F=`lit$${Math.random().toFixed(9).slice(2)}$`,Se="?"+F,Ki=`<${Se}>`,R=document,ct=()=>R.createComment(""),ut=n=>n===null||typeof n!="object"&&typeof n!="function",Vt=Array.isArray,qi=n=>Vt(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",zt=`[
|
|
14
|
+
\f\r]`,dt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Fe=/-->/g,Ge=/>/g,T=RegExp(`>|${zt}(?:([^\\s"'>=/]+)(${zt}*=${zt}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Re=/'/g,Te=/"/g,Le=/^(?:script|style|textarea|title)$/i,Qi=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),L=Qi(1),K=Symbol.for("lit-noChange"),C=Symbol.for("lit-nothing"),Ie=new WeakMap,I=R.createTreeWalker(R,129);function Ne(n,t){if(!Vt(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ae!==void 0?Ae.createHTML(t):t}const tn=(n,t)=>{const e=n.length-1,i=[];let r,s=t===2?"<svg>":t===3?"<math>":"",o=dt;for(let a=0;a<e;a++){const l=n[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===dt?c[1]==="!--"?o=Fe:c[1]!==void 0?o=Ge:c[2]!==void 0?(Le.test(c[2])&&(r=RegExp("</"+c[2],"g")),o=T):c[3]!==void 0&&(o=T):o===T?c[0]===">"?(o=r??dt,u=-1):c[1]===void 0?u=-2:(u=o.lastIndex-c[2].length,h=c[1],o=c[3]===void 0?T:c[3]==='"'?Te:Re):o===Te||o===Re?o=T:o===Fe||o===Ge?o=dt:(o=T,r=void 0);const g=o===T&&n[a+1].startsWith("/>")?" ":"";s+=o===dt?l+Ki:u>=0?(i.push(h),l.slice(0,u)+Me+l.slice(u)+F+g):l+F+(u===-2?a:g)}return[Ne(n,s+(n[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]};class gt{constructor({strings:t,_$litType$:e},i){let r;this.parts=[];let s=0,o=0;const a=t.length-1,l=this.parts,[h,c]=tn(t,e);if(this.el=gt.createElement(h,i),I.currentNode=this.el.content,e===2||e===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(r=I.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const u of r.getAttributeNames())if(u.endsWith(Me)){const d=c[o++],g=r.getAttribute(u).split(F),p=/([.?@])?(.*)/.exec(d);l.push({type:1,index:s,name:p[2],strings:g,ctor:p[1]==="."?nn:p[1]==="?"?rn:p[1]==="@"?sn:Mt}),r.removeAttribute(u)}else u.startsWith(F)&&(l.push({type:6,index:s}),r.removeAttribute(u));if(Le.test(r.tagName)){const u=r.textContent.split(F),d=u.length-1;if(d>0){r.textContent=At?At.emptyScript:"";for(let g=0;g<d;g++)r.append(u[g],ct()),I.nextNode(),l.push({type:2,index:++s});r.append(u[d],ct())}}}else if(r.nodeType===8)if(r.data===Se)l.push({type:2,index:s});else{let u=-1;for(;(u=r.data.indexOf(F,u+1))!==-1;)l.push({type:7,index:s}),u+=F.length-1}s++}}static createElement(t,e){const i=R.createElement("template");return i.innerHTML=t,i}}function q(n,t,e=n,i){var o,a;if(t===K)return t;let r=i!==void 0?(o=e._$Co)==null?void 0:o[i]:e._$Cl;const s=ut(t)?void 0:t._$litDirective$;return(r==null?void 0:r.constructor)!==s&&((a=r==null?void 0:r._$AO)==null||a.call(r,!1),s===void 0?r=void 0:(r=new s(n),r._$AT(n,e,i)),i!==void 0?(e._$Co??(e._$Co=[]))[i]=r:e._$Cl=r),r!==void 0&&(t=q(n,r._$AS(n,t.values),r,i)),t}let en=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,r=((t==null?void 0:t.creationScope)??R).importNode(e,!0);I.currentNode=r;let s=I.nextNode(),o=0,a=0,l=i[0];for(;l!==void 0;){if(o===l.index){let h;l.type===2?h=new pt(s,s.nextSibling,this,t):l.type===1?h=new l.ctor(s,l.name,l.strings,this,t):l.type===6&&(h=new on(s,this,t)),this._$AV.push(h),l=i[++a]}o!==(l==null?void 0:l.index)&&(s=I.nextNode(),o++)}return I.currentNode=R,r}p(t){let e=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}};class pt{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,i,r){this.type=2,this._$AH=C,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=r,this._$Cv=(r==null?void 0:r.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=q(this,t,e),ut(t)?t===C||t==null||t===""?(this._$AH!==C&&this._$AR(),this._$AH=C):t!==this._$AH&&t!==K&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):qi(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==C&&ut(this._$AH)?this._$AA.nextSibling.data=t:this.T(R.createTextNode(t)),this._$AH=t}$(t){var s;const{values:e,_$litType$:i}=t,r=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=gt.createElement(Ne(i.h,i.h[0]),this.options)),i);if(((s=this._$AH)==null?void 0:s._$AD)===r)this._$AH.p(e);else{const o=new en(r,this),a=o.u(this.options);o.p(e),this.T(a),this._$AH=o}}_$AC(t){let e=Ie.get(t.strings);return e===void 0&&Ie.set(t.strings,e=new gt(t)),e}k(t){Vt(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,r=0;for(const s of t)r===e.length?e.push(i=new pt(this.O(ct()),this.O(ct()),this,this.options)):i=e[r],i._$AI(s),r++;r<e.length&&(this._$AR(i&&i._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,e);t&&t!==this._$AB;){const r=t.nextSibling;t.remove(),t=r}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}}class Mt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,r,s){this.type=1,this._$AH=C,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=s,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=C}_$AI(t,e=this,i,r){const s=this.strings;let o=!1;if(s===void 0)t=q(this,t,e,0),o=!ut(t)||t!==this._$AH&&t!==K,o&&(this._$AH=t);else{const a=t;let l,h;for(t=s[0],l=0;l<s.length-1;l++)h=q(this,a[i+l],e,l),h===K&&(h=this._$AH[l]),o||(o=!ut(h)||h!==this._$AH[l]),h===C?t=C:t!==C&&(t+=(h??"")+s[l+1]),this._$AH[l]=h}o&&!r&&this.j(t)}j(t){t===C?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class nn extends Mt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===C?void 0:t}}class rn extends Mt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==C)}}class sn extends Mt{constructor(t,e,i,r,s){super(t,e,i,r,s),this.type=5}_$AI(t,e=this){if((t=q(this,t,e,0)??C)===K)return;const i=this._$AH,r=t===C&&i!==C||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,s=t!==C&&(i===C||r);r&&this.element.removeEventListener(this.name,this,i),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class on{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){q(this,t)}}const Jt=ht.litHtmlPolyfillSupport;Jt==null||Jt(gt,pt),(ht.litHtmlVersions??(ht.litHtmlVersions=[])).push("3.2.1");const an=(n,t,e)=>{const i=(e==null?void 0:e.renderBefore)??t;let r=i._$litPart$;if(r===void 0){const s=(e==null?void 0:e.renderBefore)??null;i._$litPart$=r=new pt(t.insertBefore(ct(),s),s,void 0,e??{})}return r._$AI(n),r};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/class
|
|
19
|
+
*/class N extends Z{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=an(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 K}}N._$litElement$=!0,N.finalized=!0,(Oi=globalThis.litElementHydrateSupport)==null||Oi.call(globalThis,{LitElement:N});const Wt=globalThis.litElementPolyfillSupport;Wt==null||Wt({LitElement:N}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
-
*/const
|
|
23
|
+
*/const ln=n=>(...t)=>({_$litDirective$:n,values:t});let hn=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};/**
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2020 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/const
|
|
27
|
+
*/const cn={},un=(n,t=cn)=>n._$AH=t;/**
|
|
28
28
|
* @license
|
|
29
29
|
* Copyright 2021 Google LLC
|
|
30
30
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
31
|
-
*/const
|
|
31
|
+
*/const dn=ln(class extends hn{constructor(){super(...arguments),this.key=C}render(n,t){return this.key=n,t}update(n,[t,e]){return t!==this.key&&(un(n),this.key=t),e}}),gn=n=>{n.hoverInteraction=n.eoxMap.selectInteractions.selectHover,n.clickInteraction=n.eoxMap.selectInteractions.selectClick;const t=()=>{n.requestUpdate()};n.hoverInteraction.selectStyleLayer.on("change",t),n.clickInteraction.selectStyleLayer.on("change",t)},pn=(n,t,e)=>{if(n.clickId===t)return;const i=e?[]:[t];n.hoverInteraction.highlightById(i)},fn=(n,t)=>{n.stopPropagation();const e=Number(n.target.getAttribute("index")),i=t.drawnFeatures[e];t.drawLayer.getSource().removeFeature(i),t.drawnFeatures.splice(e,1),t.requestUpdate()},Oe={duration:750},ke={type:"FeatureCollection",features:[]},yn=(n,t)=>{const e=n.getId(),{clickId:i,drawLayer:r,olMap:s,clickInteraction:o}=t,a=i===e,l=n.getGeometry();if(a){const h=r.getSource().getExtent();s.getView().fit(h,Oe),o.highlightById([])}else{const h=l.getExtent();o.highlightById([e]),s.getView().fit(h,Oe)}t.requestUpdate()},mn="ul.list-wrap { padding: 0;}ul.list-wrap li:hover,ul.list-wrap li.selected { background: var(--secondary-bg-color-hover);}ul.list-wrap li { list-style: none; padding: 4px;}ul.list-wrap li { border-bottom: 1.2px solid var(--secondary-color);}ul.list-wrap li:first-child { border-top: 1.2px solid var(--secondary-color);}ul.list-wrap li .list { width: 100%; align-items: center; justify-content: space-between; display: flex; align-items: center; cursor: pointer; font-size: small; gap: 10px;}ul.list-wrap li .list span { display: flex; align-items: center; cursor: pointer; font-size: small; flex-grow: 1;}";class He extends N{constructor(){super();W(this,"hoverInteraction");W(this,"clickInteraction");W(this,"hoverId");W(this,"clickId");this.eoxMap=null,this.olMap=null,this.draw=null,this.drawLayer=null,this.drawnFeatures=[],this.modify=null,this.unstyled=!1}_handleDelete(e){fn(e,this),this.dispatchEvent(new CustomEvent("changed",{bubbles:!0}))}_handleFeatureSelectAndDeselect(e){yn(e,this)}_handleHoverFeature(e,i=!1){pn(this,e,i)}firstUpdated(){gn(this)}createRenderRoot(){return this}render(){var e,i;return this.hoverId=(e=this.hoverInteraction)==null?void 0:e.selectedFids[0],this.clickId=(i=this.clickInteraction)==null?void 0:i.selectedFids[0],L`
|
|
32
32
|
<style>
|
|
33
|
-
${!this.unstyled&&
|
|
33
|
+
${!this.unstyled&&mn}
|
|
34
34
|
</style>
|
|
35
35
|
<ul class="list-wrap">
|
|
36
|
-
${this.drawnFeatures.map((s
|
|
36
|
+
${this.drawnFeatures.map((r,s)=>{const o=s+1,a=r.getId(),l=this.hoverId===a,h=this.clickId===a;return dn(o,L`
|
|
37
37
|
<li
|
|
38
|
-
class="${
|
|
39
|
-
@mouseover=${()=>this._handleHoverFeature(
|
|
40
|
-
@mouseout=${()=>this._handleHoverFeature(
|
|
38
|
+
class="${l||h?"selected":C}"
|
|
39
|
+
@mouseover=${()=>this._handleHoverFeature(a)}
|
|
40
|
+
@mouseout=${()=>this._handleHoverFeature(a,!0)}
|
|
41
41
|
>
|
|
42
42
|
<div
|
|
43
43
|
class="list"
|
|
44
|
-
@click="${()=>this._handleFeatureSelectAndDeselect(
|
|
44
|
+
@click="${()=>this._handleFeatureSelectAndDeselect(r)}"
|
|
45
45
|
>
|
|
46
46
|
<span class="title">Feature #${o}</span>
|
|
47
47
|
<button
|
|
48
|
-
index=${
|
|
48
|
+
index=${s}
|
|
49
49
|
class="icon smallest discard"
|
|
50
50
|
@click="${this._handleDelete}"
|
|
51
51
|
>
|
|
@@ -55,14 +55,15 @@
|
|
|
55
55
|
</li>
|
|
56
56
|
`)})}
|
|
57
57
|
</ul>
|
|
58
|
-
`}}E(bt,"properties",{eoxMap:{attribute:!1,state:!0},olMap:{attribute:!1,state:!0},draw:{attribute:!1,state:!0},drawLayer:{attribute:!1,state:!0},drawnFeatures:{attribute:!1,state:!0,type:Array},modify:{attribute:!1,state:!0},unstyled:{type:Boolean}}),customElements.define("eox-drawtools-list",bt);const ne=i=>{const{multipleFeatures:t,drawnFeatures:e,currentlyDrawing:r}=i,s=!t&&(e==null?void 0:e.length)>0||r,n=!(e!=null&&e.length)&&!r;return{drawDisabled:s,discardDisabled:n}},oe='button,.button { display: inline-flex; position: relative; align-items: center; color: #fff; border-width: 0; outline: none; border-radius: 4px; padding: 16px; height: 36px; cursor: pointer; font-family: inherit; font-size: 0.875rem; text-transform: uppercase; letter-spacing: 1.25px; font-weight: 500; box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12); transition-property: box-shadow, transform, opacity, background; transition-duration: 0.28s; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);}button:hover:not([disabled]):not(.icon):not(.json-editor-btntype-*),.button:hover:not([disabled]):not(.icon) { box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12); background: var(--primary-btn-color-hover);}button,button:active,.button,.button:active { background: var(--primary-color);}button[disabled],.button[disabled] { opacity: 0.5; cursor: not-allowed;}button.block,.button.block { display: block;}button.outline,.button.outline { background: transparent; box-shadow: none; color: var(--primary-color); outline: 1px solid var(--primary-color);}button.outline:hover,.button.outline:hover { background: transparent;}button.icon,.button.icon,button[class*="json-editor-btntype-"] { background: transparent; border: none; box-shadow: none; padding: 0; border-radius: 50%; width: 24px; height: 24px; text-indent: -9999px;}button.icon-text,.button.icon-text { text-indent: 26px;}button.icon-text.block,.button.icon-text.block { text-indent: 20px;}button.icon:before,button.icon-text:before,.button.icon:before,.button.icon-text:before { position: absolute; text-indent: 0; line-height: initial;}button.icon-text.block:before,.button.icon-text.block:before { text-indent: -54px;}button.icon:before,.button.icon:before,button[class*="json-editor-btntype-"]::before { width: 24px; height: 24px; margin-right: 0;}button.icon-text:before,.button.icon-text:before { width: 18px; height: 18px;}button.small,.button.small { height: 28px; padding: 12.4px; font-size: 0.75rem;}button.smallest.icon,button.smallest.icon::before { height: 16px; width: 16px; padding: 0;}',ae='textarea { height: 90px; resize: none; border-radius: 4px; box-sizing: border-box !important; width: 100%; padding: 5px 7px; border: 1px solid var(--secondary-color); font-size: smaller; background: var(--background-color);}input[type="text"],input[type="url"],input[type="email"],input[type="password"],input[type="text"],input[type="number"],input[type="search"],input[type="tel"],select { box-sizing: border-box; width: 100%; margin-top: 0.5rem; margin-bottom: 0.5rem; padding: 5px 7px; border-radius: 4px; border: 1px solid #0004;}';function le(i){navigator.clipboard.writeText(i).then(function(){},function(t){console.error("Could not copy text: ",t)})}/**
|
|
58
|
+
`}}W(He,"properties",{eoxMap:{attribute:!1,state:!0},olMap:{attribute:!1,state:!0},draw:{attribute:!1,state:!0},drawLayer:{attribute:!1,state:!0},drawnFeatures:{attribute:!1,state:!0,type:Array},modify:{attribute:!1,state:!0},unstyled:{type:Boolean}}),customElements.define("eox-drawtools-list",He);const _n=n=>{const{multipleFeatures:t,drawnFeatures:e,currentlyDrawing:i}=n,r=!t&&(e==null?void 0:e.length)>0||i,s=!(e!=null&&e.length)&&!i;return{drawDisabled:r,discardDisabled:s}},vn='button,.button { display: inline-flex; position: relative; align-items: center; color: #fff; border-width: 0; outline: none; border-radius: 4px; padding: 16px; height: 36px; cursor: pointer; font-family: inherit; font-size: 0.875rem; text-transform: uppercase; letter-spacing: 1.25px; font-weight: 500; box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12); transition-property: box-shadow, transform, opacity, background; transition-duration: 0.28s; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);}button:hover:not([disabled]):not(.icon):not(.json-editor-btntype-*),.button:hover:not([disabled]):not(.icon) { box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12); background: var(--primary-btn-color-hover);}button,button:active,.button,.button:active { background: var(--primary-color);}button[disabled],.button[disabled] { opacity: 0.5; cursor: not-allowed;}button.block,.button.block { display: block;}button.outline,.button.outline { background: transparent; box-shadow: none; color: var(--primary-color); outline: 1px solid var(--primary-color);}button.outline:hover,.button.outline:hover { background: transparent;}button.icon,.button.icon,button[class*="json-editor-btntype-"] { background: transparent; border: none; box-shadow: none; padding: 0; border-radius: 50%; width: 24px; height: 24px; text-indent: -9999px;}button.icon-text,.button.icon-text { text-indent: 26px;}button.icon-text.block,.button.icon-text.block { text-indent: 20px;}button.icon:before,button.icon-text:before,.button.icon:before,.button.icon-text:before { position: absolute; text-indent: 0; line-height: initial;}button.icon-text.block:before,.button.icon-text.block:before { text-indent: -54px;}button.icon:before,.button.icon:before,button[class*="json-editor-btntype-"]::before { width: 24px; height: 24px; margin-right: 0;}button.icon-text:before,.button.icon-text:before { width: 18px; height: 18px;}button.small,.button.small { height: 28px; padding: 12.4px; font-size: 0.75rem;}button.smallest.icon,button.smallest.icon::before { height: 16px; width: 16px; padding: 0;}',Cn='textarea { height: 90px; resize: none; border-radius: 4px; box-sizing: border-box !important; width: 100%; padding: 5px 7px; border: 1px solid var(--secondary-color); font-size: smaller; background: var(--background-color);}input[type="text"],input[type="url"],input[type="email"],input[type="password"],input[type="text"],input[type="number"],input[type="search"],input[type="tel"],select { box-sizing: border-box; width: 100%; margin-top: 0.5rem; margin-bottom: 0.5rem; padding: 5px 7px; border-radius: 4px; border: 1px solid #0004;}';function wn(n){navigator.clipboard.writeText(n).then(function(){},function(t){console.error("Could not copy text: ",t)})}class je{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}const bn={PROPERTYCHANGE:"propertychange"};class En{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function xn(n,t,e){let i,r;e=e||Ue;let s=0,o=n.length,a=!1;for(;s<o;)i=s+(o-s>>1),r=+e(n[i],t),r<0?s=i+1:(o=i,a=!r);return a?s:~s}function Ue(n,t){return n>t?1:n<t?-1:0}function A(n,t){const e=Array.isArray(t)?t:[t],i=e.length;for(let r=0;r<i;r++)n[n.length]=e[r]}function Pn(n,t){const e=n.length;if(e!==t.length)return!1;for(let i=0;i<e;i++)if(n[i]!==t[i])return!1;return!0}function Xe(){}function Ye(n){let t,e,i;return function(){const r=Array.prototype.slice.call(arguments);return(!e||this!==i||!Pn(r,e))&&(i=this,e=r,t=n.apply(this,arguments)),t}}function Be(n){for(const t in n)delete n[t]}function Ve(n){let t;for(t in n)return!1;return!t}class $n extends En{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),r=i[t]||(i[t]=[]);r.includes(e)||r.push(e)}dispatchEvent(t){const e=typeof t=="string",i=e?t:t.type,r=this.listeners_&&this.listeners_[i];if(!r)return;const s=e?new je(t):t;s.target||(s.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in o||(o[i]=0,a[i]=0),++o[i];let l;for(let 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[i]===0){let h=a[i];for(delete a[i];h--;)this.removeEventListener(i,Xe);delete o[i]}return l}disposeInternal(){this.listeners_&&Be(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return this.listeners_?t?t in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const r=i.indexOf(e);r!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[r]=Xe,++this.pendingRemovals_[t]):(i.splice(r,1),i.length===0&&delete this.listeners_[t]))}}const Dt={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 ft(n,t,e,i,r){if(r){const o=e;e=function(){n.removeEventListener(t,e),o.apply(i??this,arguments)}}else i&&i!==n&&(e=e.bind(i));const s={target:n,type:t,listener:e};return n.addEventListener(t,e),s}function ze(n,t,e,i){return ft(n,t,e,i,!0)}function St(n){n&&n.target&&(n.target.removeEventListener(n.type,n.listener),Be(n))}class Ft extends $n{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(Dt.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,r=new Array(i);for(let s=0;s<i;++s)r[s]=ft(this,t[s],e);return r}return ft(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const r=t.length;i=new Array(r);for(let s=0;s<r;++s)i[s]=ze(this,t[s],e)}else i=ze(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)An(i);else if(Array.isArray(t))for(let r=0,s=t.length;r<s;++r)this.removeEventListener(t[r],e);else this.removeEventListener(t,e)}}Ft.prototype.on,Ft.prototype.once,Ft.prototype.un;function An(n){if(Array.isArray(n))for(let t=0,e=n.length;t<e;++t)St(n[t]);else St(n)}function f(){throw new Error("Unimplemented abstract method.")}let Mn=0;function Sn(n){return n.ol_uid||(n.ol_uid=String(++Mn))}class Je extends je{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class We extends Ft{constructor(t){super(),this.on,this.once,this.un,Sn(this),this.values_=null,t!==void 0&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new Je(i,t,e)),i=bn.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new Je(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const r=this.values_||(this.values_={});if(i)r[t]=e;else{const s=r[t];r[t]=e,s!==e&&this.notify(t,s)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],Ve(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}function Fn(n,t){if(!n)throw new Error(t)}class Q extends We{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if(typeof t.getSimplifiedGeometry=="function"){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new Q(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const i=this.getStyle();return i&&t.setStyle(i),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(St(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=ft(t,Dt.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?Gn(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function Gn(n){if(typeof n=="function")return n;let t;return Array.isArray(n)?t=n:(Fn(typeof n.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[n]),function(){return t}}new Array(6);function De(){return[1,0,0,1,0,0]}function Ze(n,t,e,i,r,s,o,a){const l=Math.sin(s),h=Math.cos(s);return n[0]=i*h,n[1]=r*l,n[2]=-i*l,n[3]=r*h,n[4]=o*i*h-a*i*l+t,n[5]=o*r*l+a*r*h+e,n}const E={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function O(n,t,e){let i,r;return t<n[0]?i=n[0]-t:n[2]<t?i=t-n[2]:i=0,e<n[1]?r=n[1]-e:n[3]<e?r=e-n[3]:r=0,i*i+r*r}function Rn(n,t){return n[0]<=t[0]&&t[2]<=n[2]&&n[1]<=t[1]&&t[3]<=n[3]}function Ke(n,t,e){return n[0]<=t&&t<=n[2]&&n[1]<=e&&e<=n[3]}function qe(n,t){const e=n[0],i=n[1],r=n[2],s=n[3],o=t[0],a=t[1];let l=E.UNKNOWN;return o<e?l=l|E.LEFT:o>r&&(l=l|E.RIGHT),a<i?l=l|E.BELOW:a>s&&(l=l|E.ABOVE),l===E.UNKNOWN&&(l=E.INTERSECTING),l}function Zt(){return[1/0,1/0,-1/0,-1/0]}function Qe(n,t,e,i,r){return r?(r[0]=n,r[1]=t,r[2]=e,r[3]=i,r):[n,t,e,i]}function Kt(n){return Qe(1/0,1/0,-1/0,-1/0,n)}function ti(n,t){const e=n[0],i=n[1];return Qe(e,i,e,i,t)}function qt(n,t,e,i,r){const s=Kt(r);return ei(s,n,t,e,i)}function Tn(n,t){return t[0]<n[0]&&(n[0]=t[0]),t[2]>n[2]&&(n[2]=t[2]),t[1]<n[1]&&(n[1]=t[1]),t[3]>n[3]&&(n[3]=t[3]),n}function ei(n,t,e,i,r){for(;e<i;e+=r)Ln(n,t[e],t[e+1]);return n}function Ln(n,t,e){n[0]=Math.min(n[0],t),n[1]=Math.min(n[1],e),n[2]=Math.max(n[2],t),n[3]=Math.max(n[3],e)}function In(n,t){let e;return e=t(Nn(n)),e||(e=t(On(n)),e)||(e=t(Hn(n)),e)||(e=t(kn(n)),e)?e:!1}function Nn(n){return[n[0],n[1]]}function On(n){return[n[2],n[1]]}function Gt(n){return[(n[0]+n[2])/2,(n[1]+n[3])/2]}function Rt(n){return n[3]-n[1]}function kn(n){return[n[0],n[3]]}function Hn(n){return[n[2],n[3]]}function jn(n,t){return n[0]<=t[2]&&n[2]>=t[0]&&n[1]<=t[3]&&n[3]>=t[1]}function Un(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n}function Xn(n,t,e){let i=!1;const r=qe(n,t),s=qe(n,e);if(r===E.INTERSECTING||s===E.INTERSECTING)i=!0;else{const o=n[0],a=n[1],l=n[2],h=n[3],c=t[0],u=t[1],d=e[0],g=e[1],p=(g-u)/(d-c);let m,w;s&E.ABOVE&&!(r&E.ABOVE)&&(m=d-(g-h)/p,i=m>=o&&m<=l),!i&&s&E.RIGHT&&!(r&E.RIGHT)&&(w=g-(d-l)*p,i=w>=a&&w<=h),!i&&s&E.BELOW&&!(r&E.BELOW)&&(m=d-(g-a)/p,i=m>=o&&m<=l),!i&&s&E.LEFT&&!(r&E.LEFT)&&(w=g-(d-o)*p,i=w>=a&&w<=h)}return i}const Yn={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class ii{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_||Yn[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 yt=6378137,tt=Math.PI*yt,Bn=[-tt,-tt,tt,tt],Vn=[-180,-85,180,85],Tt=yt*Math.log(Math.tan(Math.PI/2));class et extends ii{constructor(t){super({code:t,units:"m",extent:Bn,global:!0,worldExtent:Vn,getPointResolution:function(e,i){return e/Math.cosh(i[1]/yt)}})}}const ni=[new et("EPSG:3857"),new et("EPSG:102100"),new et("EPSG:102113"),new et("EPSG:900913"),new et("http://www.opengis.net/def/crs/EPSG/0/3857"),new et("http://www.opengis.net/gml/srs/epsg.xml#3857")];function zn(n,t,e,i){const r=n.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(r));for(let s=0;s<r;s+=i){t[s]=tt*n[s]/180;let o=yt*Math.log(Math.tan(Math.PI*(+n[s+1]+90)/360));o>Tt?o=Tt:o<-Tt&&(o=-Tt),t[s+1]=o}return t}function Jn(n,t,e,i){const r=n.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(r));for(let s=0;s<r;s+=i)t[s]=180*n[s]/tt,t[s+1]=360*Math.atan(Math.exp(n[s+1]/yt))/Math.PI-90;return t}const Wn=6378137,ri=[-180,-90,180,90],Dn=Math.PI*Wn/180;class k extends ii{constructor(t,e){super({code:t,units:"degrees",extent:ri,axisOrientation:e,global:!0,metersPerUnit:Dn,worldExtent:ri})}}const si=[new k("CRS:84"),new k("EPSG:4326","neu"),new k("urn:ogc:def:crs:OGC:1.3:CRS84"),new k("urn:ogc:def:crs:OGC:2:84"),new k("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new k("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new k("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Qt={};function Zn(n){return Qt[n]||Qt[n.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function Kn(n,t){Qt[n]=t}let it={};function Lt(n,t,e){const i=n.getCode(),r=t.getCode();i in it||(it[i]={}),it[i][r]=e}function qn(n,t){let e;return n in it&&t in it[n]&&(e=it[n][t]),e}function Qn(n,t,e,i,r,s){const o=r-e,a=s-i;if(o!==0||a!==0){const l=((n-e)*o+(t-i)*a)/(o*o+a*a);l>1?(e=r,i=s):l>0&&(e+=o*l,i+=a*l)}return H(n,t,e,i)}function H(n,t,e,i){const r=e-n,s=i-t;return r*r+s*s}function te(n,t,e){return n+e*(t-n)}function ee(n,t){if(t!==void 0){for(let e=0,i=n.length;e<i;++e)t[e]=n[e];t=t}else t=n.slice();return t}function tr(n,t){if(t!==void 0&&n!==t){for(let e=0,i=n.length;e<i;++e)t[e]=n[e];n=t}return n}function er(n){Kn(n.getCode(),n),Lt(n,n,ee)}function ir(n){n.forEach(er)}function P(n){return typeof n=="string"?Zn(n):n||null}function oi(n){ir(n),n.forEach(function(t){n.forEach(function(e){t!==e&&Lt(t,e,ee)})})}function nr(n,t,e,i){n.forEach(function(r){t.forEach(function(s){Lt(r,s,e),Lt(s,r,i)})})}function rr(n,t){if(n===t)return!0;const e=n.getUnits()===t.getUnits();return(n.getCode()===t.getCode()||ai(n,t)===ee)&&e}function ai(n,t){const e=n.getCode(),i=t.getCode();let r=qn(e,i);return r||(r=tr),r}function ie(n,t){const e=P(n),i=P(t);return ai(e,i)}function sr(){oi(ni),oi(si),nr(si,ni,zn,Jn)}sr();function li(n,t,e,i,r,s,o){s=s||[],o=o||2;let a=0;for(let l=t;l<e;l+=i){const h=n[l],c=n[l+1];s[a++]=r[0]*h+r[2]*c+r[4],s[a++]=r[1]*h+r[3]*c+r[5];for(let u=2;u<o;u++)s[a++]=n[l+u]}return s&&s.length!=a&&(s.length=a),s}function or(n,t,e,i,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+=i){const g=n[d]-h,p=n[d+1]-c;o[u++]=h+g*a-p*l,o[u++]=c+g*l+p*a;for(let m=d+2;m<d+i;++m)o[u++]=n[m]}return o&&o.length!=u&&(o.length=u),o}function ar(n,t,e,i,r,s,o,a){a=a||[];const l=o[0],h=o[1];let c=0;for(let u=t;u<e;u+=i){const d=n[u]-l,g=n[u+1]-h;a[c++]=l+r*d,a[c++]=h+s*g;for(let p=u+2;p<u+i;++p)a[c++]=n[p]}return a&&a.length!=c&&(a.length=c),a}function lr(n,t,e,i,r,s,o){o=o||[];let a=0;for(let l=t;l<e;l+=i){o[a++]=n[l]+r,o[a++]=n[l+1]+s;for(let h=l+2;h<l+i;++h)o[a++]=n[h]}return o&&o.length!=a&&(o.length=a),o}const hi=De();class ci extends We{constructor(){super(),this.extent_=Zt(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Ye((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const r=this.clone();return r.applyTransform(i),r.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return f()}closestPointXY(t,e,i,r){return f()}containsXY(t,e){const i=this.getClosestPoint([t,e]);return i[0]===t&&i[1]===e}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return f()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Kt(e),this.extentRevision_=this.getRevision()}return Un(this.extent_,t)}rotate(t,e){f()}scale(t,e,i){f()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return f()}getType(){return f()}applyTransform(t){f()}intersectsExtent(t){return f()}translate(t,e){f()}transform(t,e){const i=P(t),r=i.getUnits()=="tile-pixels"?function(s,o,a){const l=i.getExtent(),h=i.getWorldExtent(),c=Rt(h)/Rt(l);return Ze(hi,h[0],h[3],c,-c,0,0,0),li(s,0,s.length,a,hi,o),ie(i,e)(s,o,a)}:ie(i,e);return this.applyTransform(r),this}}class j extends ci{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return qt(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return f()}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=ui(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){f()}setLayout(t,e,i){let r;if(t)r=ui(t);else{for(let s=0;s<i;++s){if(e.length===0){this.layout="XY",this.stride=2;return}e=e[0]}r=e.length,t=U(r)}this.layout=t,this.stride=r}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const r=this.getStride();or(i,0,i.length,r,t,e,i),this.changed()}}scale(t,e,i){e===void 0&&(e=t),i||(i=Gt(this.getExtent()));const r=this.getFlatCoordinates();if(r){const s=this.getStride();ar(r,0,r.length,s,t,e,i,r),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const r=this.getStride();lr(i,0,i.length,r,t,e,i),this.changed()}}}function U(n){let t;return n==2?t="XY":n==3?t="XYZ":n==4&&(t="XYZM"),t}function ui(n){let t;return n=="XY"?t=2:n=="XYZ"||n=="XYM"?t=3:n=="XYZM"&&(t=4),t}function hr(n,t,e,i){for(let r=0,s=e.length;r<s;++r)n[t++]=e[r];return t}function It(n,t,e,i){for(let r=0,s=e.length;r<s;++r){const o=e[r];for(let a=0;a<i;++a)n[t++]=o[a]}return t}function mt(n,t,e,i,r){r=r||[];let s=0;for(let o=0,a=e.length;o<a;++o){const l=It(n,t,e[o],i);r[s++]=l,t=l}return r.length=s,r}function di(n,t,e,i,r){r=r||[];let s=0;for(let o=0,a=e.length;o<a;++o){const l=mt(n,t,e[o],i,r[s]);l.length===0&&(l[0]=t),r[s++]=l,t=l[l.length-1]}return r.length=s,r}class X extends ci{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(St),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,i=t.length;e<i;++e)this.changeEventsKeys_.push(ft(t[e],Dt.CHANGE,this.changed,this))}clone(){const t=new X(ne(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,e,i,r){if(r<O(this.getExtent(),t,e))return r;const s=this.geometries_;for(let o=0,a=s.length;o<a;++o)r=s[o].closestPointXY(t,e,i,r);return r}containsXY(t,e){const i=this.geometries_;for(let r=0,s=i.length;r<s;++r)if(i[r].containsXY(t,e))return!0;return!1}computeExtent(t){Kt(t);const e=this.geometries_;for(let i=0,r=e.length;i<r;++i)Tn(t,e[i].getExtent());return t}getGeometries(){return ne(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let i=0,r=e.length;i<r;++i)e[i].getType()===this.getType()?t=t.concat(e[i].getGeometriesArrayRecursive()):t.push(e[i]);return t}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=[],i=this.geometries_;let r=!1;for(let s=0,o=i.length;s<o;++s){const a=i[s],l=a.getSimplifiedGeometry(t);e.push(l),l!==a&&(r=!0)}return r?new X(e):(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.geometries_;for(let i=0,r=e.length;i<r;++i)if(e[i].intersectsExtent(t))return!0;return!1}isEmpty(){return this.geometries_.length===0}rotate(t,e){const i=this.geometries_;for(let r=0,s=i.length;r<s;++r)i[r].rotate(t,e);this.changed()}scale(t,e,i){i||(i=Gt(this.getExtent()));const r=this.geometries_;for(let s=0,o=r.length;s<o;++s)r[s].scale(t,e,i);this.changed()}setGeometries(t){this.setGeometriesArray(ne(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let i=0,r=e.length;i<r;++i)e[i].applyTransform(t);this.changed()}translate(t,e){const i=this.geometries_;for(let r=0,s=i.length;r<s;++r)i[r].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function ne(n){return n.map(t=>t.clone())}function gi(n,t,e,i,r,s,o){const a=n[t],l=n[t+1],h=n[e]-a,c=n[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 g=0;g<i;++g)o[g]=te(n[t+g],n[e+g],d);o.length=i;return}else u=t}for(let d=0;d<i;++d)o[d]=n[u+d];o.length=i}function re(n,t,e,i,r){let s=n[t],o=n[t+1];for(t+=i;t<e;t+=i){const a=n[t],l=n[t+1],h=H(s,o,a,l);h>r&&(r=h),s=a,o=l}return r}function se(n,t,e,i,r){for(let s=0,o=e.length;s<o;++s){const a=e[s];r=re(n,t,a,i,r),t=a}return r}function cr(n,t,e,i,r){for(let s=0,o=e.length;s<o;++s){const a=e[s];r=se(n,t,a,i,r),t=a[a.length-1]}return r}function oe(n,t,e,i,r,s,o,a,l,h,c){if(t==e)return h;let u,d;if(r===0){if(d=H(o,a,n[t],n[t+1]),d<h){for(u=0;u<i;++u)l[u]=n[t+u];return l.length=i,d}return h}c=c||[NaN,NaN];let g=t+i;for(;g<e;)if(gi(n,g-i,g,i,o,a,c),d=H(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<i;++u)l[u]=c[u];l.length=i,g+=i}else g+=i*Math.max((Math.sqrt(d)-Math.sqrt(h))/r|0,1);if(s&&(gi(n,e-i,t,i,o,a,c),d=H(o,a,c[0],c[1]),d<h)){for(h=d,u=0;u<i;++u)l[u]=c[u];l.length=i}return h}function ae(n,t,e,i,r,s,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const g=e[u];h=oe(n,t,g,i,r,s,o,a,l,h,c),t=g}return h}function ur(n,t,e,i,r,s,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const g=e[u];h=ae(n,t,g,i,r,s,o,a,l,h,c),t=g[g.length-1]}return h}function Nt(n,t,e,i,r,s,o){const a=(e-t)/i;if(a<3){for(;t<e;t+=i)s[o++]=n[t],s[o++]=n[t+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[t,e-i];let c=0;for(;h.length>0;){const u=h.pop(),d=h.pop();let g=0;const p=n[d],m=n[d+1],w=n[u],$=n[u+1];for(let x=d+i;x<u;x+=i){const we=n[x],$t=n[x+1],ki=Qn(we,$t,p,m,w,$);ki>g&&(c=x,g=ki)}g>r&&(l[(c-t)/i]=1,d+i<c&&h.push(d,c),c+i<u&&h.push(c,u))}for(let u=0;u<a;++u)l[u]&&(s[o++]=n[t+u*i],s[o++]=n[t+u*i+1]);return o}function pi(n,t,e,i,r,s,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=Nt(n,t,c,i,r,s,o),a.push(o),t=c}return o}function nt(n,t){return t*Math.round(n/t)}function dr(n,t,e,i,r,s,o){if(t==e)return o;let a=nt(n[t],r),l=nt(n[t+1],r);t+=i,s[o++]=a,s[o++]=l;let h,c;do if(h=nt(n[t],r),c=nt(n[t+1],r),t+=i,t==e)return s[o++]=h,s[o++]=c,o;while(h==a&&c==l);for(;t<e;){const u=nt(n[t],r),d=nt(n[t+1],r);if(t+=i,u==h&&d==c)continue;const g=h-a,p=c-l,m=u-a,w=d-l;if(g*w==p*m&&(g<0&&m<g||g==m||g>0&&m>g)&&(p<0&&w<p||p==w||p>0&&w>p)){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 le(n,t,e,i,r,s,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=dr(n,t,c,i,r,s,o),a.push(o),t=c}return o}function gr(n,t,e,i,r,s,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l],u=[];o=le(n,t,c,i,r,s,o,u),a.push(u),t=c[c.length-1]}return o}function Ot(n,t,e,i,r){r=r!==void 0?r:[];let s=0;for(let o=t;o<e;o+=i)r[s++]=n.slice(o,o+i);return r.length=s,r}function he(n,t,e,i,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];r[s++]=Ot(n,t,l,i,r[s]),t=l}return r.length=s,r}function pr(n,t,e,i,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];r[s++]=l.length===1&&l[0]===t?[]:he(n,t,l,i,r[s]),t=l[l.length-1]}return r.length=s,r}function fi(n,t,e,i){let r=0;const s=n[e-i],o=n[e-i+1];let a=0,l=0;for(;t<e;t+=i){const h=n[t]-s,c=n[t+1]-o;r+=l*h-a*c,a=h,l=c}return r/2}function yi(n,t,e,i){let r=0;for(let s=0,o=e.length;s<o;++s){const a=e[s];r+=fi(n,t,a,i),t=a}return r}function fr(n,t,e,i){let r=0;for(let s=0,o=e.length;s<o;++s){const a=e[s];r+=yi(n,t,a,i),t=a[a.length-1]}return r}class _t extends j{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 _t(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,r){return r<O(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(re(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),oe(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,r))}getArea(){return fi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Ot(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=Nt(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new _t(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=It(this.flatCoordinates,0,t,this.stride),this.changed()}}function mi(n,t,e,i,r){let s;for(t+=i;t<e;t+=i)if(s=r(n.slice(t-i,t),n.slice(t,t+i)),s)return s;return!1}function kt(n,t,e,i,r,s,o){let a,l;const h=(e-t)/i;if(h===1)a=t;else if(h===2)a=t,l=r;else if(h!==0){let c=n[t],u=n[t+1],d=0;const g=[0];for(let w=t+i;w<e;w+=i){const $=n[w],x=n[w+1];d+=Math.sqrt(($-c)*($-c)+(x-u)*(x-u)),g.push(d),c=$,u=x}const p=r*d,m=xn(g,p);m<0?(l=(p-g[-m-2])/(g[-m-1]-g[-m-2]),a=t+(-m-2)*i):a=t+m*i}o=o>1?o:2,s=s||new Array(o);for(let c=0;c<o;++c)s[c]=a===void 0?NaN:l===void 0?n[a+c]:te(n[a+c],n[a+i+c],l);return s}function ce(n,t,e,i,r,s){if(e==t)return null;let o;if(r<n[t+i-1])return s?(o=n.slice(t,t+i),o[i-1]=r,o):null;if(n[e-1]<r)return s?(o=n.slice(e-i,e),o[i-1]=r,o):null;if(r==n[t+i-1])return n.slice(t,t+i);let a=t/i,l=e/i;for(;a<l;){const d=a+l>>1;r<n[(d+1)*i-1]?l=d:a=d+1}const h=n[a*i-1];if(r==h)return n.slice((a-1)*i,(a-1)*i+i);const c=n[(a+1)*i-1],u=(r-h)/(c-h);o=[];for(let d=0;d<i-1;++d)o.push(te(n[(a-1)*i+d],n[a*i+d],u));return o.push(r),o}function yr(n,t,e,i,r,s,o){if(o)return ce(n,t,e[e.length-1],i,r,s);let a;if(r<n[i-1])return s?(a=n.slice(0,i),a[i-1]=r,a):null;if(n[n.length-1]<r)return s?(a=n.slice(n.length-i),a[i-1]=r,a):null;for(let l=0,h=e.length;l<h;++l){const c=e[l];if(t!=c){if(r<n[t+i-1])return null;if(r<=n[c-1])return ce(n,t,c,i,r,!1);t=c}}return null}function mr(n,t,e,i,r){return!In(r,function(o){return!Y(n,t,e,i,o[0],o[1])})}function Y(n,t,e,i,r,s){let o=0,a=n[e-i],l=n[e-i+1];for(;t<e;t+=i){const h=n[t],c=n[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 ue(n,t,e,i,r,s){if(e.length===0||!Y(n,t,e[0],i,r,s))return!1;for(let o=1,a=e.length;o<a;++o)if(Y(n,e[o-1],e[o],i,r,s))return!1;return!0}function _r(n,t,e,i,r,s){if(e.length===0)return!1;for(let o=0,a=e.length;o<a;++o){const l=e[o];if(ue(n,t,l,i,r,s))return!0;t=l[l.length-1]}return!1}function Ht(n,t,e,i,r){const s=ei(Zt(),n,t,e,i);return jn(r,s)?Rn(r,s)||s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:mi(n,t,e,i,function(o,a){return Xn(r,o,a)}):!1}function vr(n,t,e,i,r){for(let s=0,o=e.length;s<o;++s){if(Ht(n,t,e[s],i,r))return!0;t=e[s]}return!1}function Cr(n,t,e,i,r){return!!(Ht(n,t,e,i,r)||Y(n,t,e,i,r[0],r[1])||Y(n,t,e,i,r[0],r[3])||Y(n,t,e,i,r[2],r[1])||Y(n,t,e,i,r[2],r[3]))}function _i(n,t,e,i,r){if(!Cr(n,t,e[0],i,r))return!1;if(e.length===1)return!0;for(let s=1,o=e.length;s<o;++s)if(mr(n,e[s-1],e[s],i,r)&&!Ht(n,e[s-1],e[s],i,r))return!1;return!0}function wr(n,t,e,i,r){for(let s=0,o=e.length;s<o;++s){const a=e[s];if(_i(n,t,a,i,r))return!0;t=a[a.length-1]}return!1}function br(n,t,e,i){let r=n[t],s=n[t+1],o=0;for(let a=t+i;a<e;a+=i){const l=n[a],h=n[a+1];o+=Math.sqrt((l-r)*(l-r)+(h-s)*(h-s)),r=l,s=h}return o}class B extends j{constructor(t,e){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,e!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendCoordinate(t){A(this.flatCoordinates,t),this.changed()}clone(){const t=new B(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,r){return r<O(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(re(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),oe(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,r))}forEachSegment(t){return mi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinateAtM(t,e){return this.layout!="XYM"&&this.layout!="XYZM"?null:(e=e!==void 0?e:!1,ce(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return Ot(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return kt(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return br(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const e=[];return e.length=Nt(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new B(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return Ht(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=It(this.flatCoordinates,0,t,this.stride),this.changed()}}class vt extends j{constructor(t,e,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(e!==void 0&&i)this.setFlatCoordinates(e,t),this.ends_=i;else{const r=t,s=[],o=[];for(let l=0,h=r.length;l<h;++l){const c=r[l];A(s,c.getFlatCoordinates()),o.push(s.length)}const a=r.length===0?this.getLayout():r[0].getLayout();this.setFlatCoordinates(a,s),this.ends_=o}}appendLineString(t){A(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new vt(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,r){return r<O(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(se(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ae(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,i,r))}getCoordinateAtM(t,e,i){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(e=e!==void 0?e:!1,i=i!==void 0?i:!1,yr(this.flatCoordinates,0,this.ends_,this.stride,t,e,i))}getCoordinates(){return he(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new B(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.ends_,i=this.layout,r=[];let s=0;for(let o=0,a=e.length;o<a;++o){const l=e[o],h=new B(t.slice(s,l),i);r.push(h),s=l}return r}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let i=0;const r=this.ends_,s=this.stride;for(let o=0,a=r.length;o<a;++o){const l=r[o],h=kt(e,i,l,s,.5);A(t,h),i=l}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=pi(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,i),new vt(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return vr(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=mt(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}class V extends j{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new V(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,r){const s=this.flatCoordinates,o=H(t,e,s[0],s[1]);if(o<r){const a=this.stride;for(let l=0;l<a;++l)i[l]=s[l];return i.length=a,o}return r}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return ti(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Ke(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=hr(this.flatCoordinates,0,t,this.stride),this.changed()}}class Ct extends j{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){A(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new Ct(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,r){if(r<O(this.getExtent(),t,e))return r;const s=this.flatCoordinates,o=this.stride;for(let a=0,l=s.length;a<l;a+=o){const h=H(t,e,s[a],s[a+1]);if(h<r){r=h;for(let c=0;c<o;++c)i[c]=s[a+c];i.length=o}}return r}getCoordinates(){return Ot(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new V(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,i=this.stride,r=[];for(let s=0,o=t.length;s<o;s+=i){const a=new V(t.slice(s,s+i),e);r.push(a)}return r}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,i=this.stride;for(let r=0,s=e.length;r<s;r+=i){const o=e[r],a=e[r+1];if(Ke(t,o,a))return!0}return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=It(this.flatCoordinates,0,t,this.stride),this.changed()}}function de(n,t,e,i,r,s,o){let a,l,h,c,u,d,g;const p=r[s+1],m=[];for(let x=0,we=e.length;x<we;++x){const $t=e[x];for(c=n[$t-i],d=n[$t-i+1],a=t;a<$t;a+=i)u=n[a],g=n[a+1],(p<=d&&g<=p||d<=p&&p<=g)&&(h=(p-d)/(g-d)*(u-c)+c,m.push(h)),c=u,d=g}let w=NaN,$=-1/0;for(m.sort(Ue),c=m[0],a=1,l=m.length;a<l;++a){u=m[a];const x=Math.abs(u-c);x>$&&(h=(c+u)/2,ue(n,t,e,i,h,p)&&(w=h,$=x)),c=u}return isNaN(w)&&(w=r[s]),o?(o.push(w,p,$),o):[w,p,$]}function vi(n,t,e,i,r){let s=[];for(let o=0,a=e.length;o<a;++o){const l=e[o];s=de(n,t,l,i,r,2*o,s),t=l[l.length-1]}return s}function Er(n,t,e,i){for(;t<e-i;){for(let r=0;r<i;++r){const s=n[t+r];n[t+r]=n[e-i+r],n[e-i+r]=s}t+=i,e-=i}}function ge(n,t,e,i){let r=0,s=n[e-i],o=n[e-i+1];for(;t<e;t+=i){const a=n[t],l=n[t+1];r+=(a-s)*(l+o),s=a,o=l}return r===0?void 0:r>0}function pe(n,t,e,i,r){r=r!==void 0?r:!1;for(let s=0,o=e.length;s<o;++s){const a=e[s],l=ge(n,t,a,i);if(s===0){if(r&&l||!r&&!l)return!1}else if(r&&!l||!r&&l)return!1;t=a}return!0}function Ci(n,t,e,i,r){for(let s=0,o=e.length;s<o;++s){const a=e[s];if(!pe(n,t,a,i,r))return!1;a.length&&(t=a[a.length-1])}return!0}function jt(n,t,e,i,r){r=r!==void 0?r:!1;for(let s=0,o=e.length;s<o;++s){const a=e[s],l=ge(n,t,a,i);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&Er(n,t,a,i),t=a}return t}function fe(n,t,e,i,r){for(let s=0,o=e.length;s<o;++s)t=jt(n,t,e[s],i,r);return t}function xr(n,t){const e=[];let i=0,r=0,s;for(let o=0,a=t.length;o<a;++o){const l=t[o],h=ge(n,i,l,2);if(s===void 0&&(s=h),h===s)e.push(t.slice(r,o+1));else{if(e.length===0)continue;e[e.length-1].push(t[r])}r=o+1,i=l}return e}class z extends j{constructor(t,e,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,e!==void 0&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?A(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new z(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,r){return r<O(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(se(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ae(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,r))}containsXY(t,e){return ue(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return yi(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),jt(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,he(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=Gt(this.getExtent());this.flatInteriorPoint_=de(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new V(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new _t(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,r=[];let s=0;for(let o=0,a=i.length;o<a;++o){const l=i[o],h=new _t(e.slice(s,l),t);r.push(h),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;pe(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=jt(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=le(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new z(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return _i(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=mt(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}function wi(n,t,e,i){const r=[];let s=Zt();for(let o=0,a=e.length;o<a;++o){const l=e[o];s=qt(n,t,l[0],i),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),t=l[l.length-1]}return r}class wt extends j{constructor(t,e,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(t[0])){const r=t,s=[],o=[];for(let a=0,l=r.length;a<l;++a){const h=r[a],c=s.length,u=h.getEnds();for(let d=0,g=u.length;d<g;++d)u[d]+=c;A(s,h.getFlatCoordinates()),o.push(u)}e=r.length===0?this.getLayout():r[0].getLayout(),t=s,i=o}e!==void 0&&i?(this.setFlatCoordinates(e,t),this.endss_=i):this.setCoordinates(t,e)}appendPolygon(t){let e;if(!this.flatCoordinates)this.flatCoordinates=t.getFlatCoordinates().slice(),e=t.getEnds().slice(),this.endss_.push();else{const i=this.flatCoordinates.length;A(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let r=0,s=e.length;r<s;++r)e[r]+=i}this.endss_.push(e),this.changed()}clone(){const t=this.endss_.length,e=new Array(t);for(let r=0;r<t;++r)e[r]=this.endss_[r].slice();const i=new wt(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,r){return r<O(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(cr(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ur(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,t,e,i,r))}containsXY(t,e){return _r(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return fr(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),fe(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,pr(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=wi(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=vi(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Ct(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Ci(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=fe(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=gr(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new wt(e,"XY",i)}getPolygon(t){if(t<0||this.endss_.length<=t)return null;let e;if(t===0)e=0;else{const s=this.endss_[t-1];e=s[s.length-1]}const i=this.endss_[t].slice(),r=i[i.length-1];if(e!==0)for(let s=0,o=i.length;s<o;++s)i[s]-=e;return new z(this.flatCoordinates.slice(e,r),this.layout,i)}getPolygons(){const t=this.layout,e=this.flatCoordinates,i=this.endss_,r=[];let s=0;for(let o=0,a=i.length;o<a;++o){const l=i[o].slice(),h=l[l.length-1];if(s!==0)for(let u=0,d=l.length;u<d;++u)l[u]-=s;const c=new z(e.slice(s,h),t,l);r.push(c),s=h}return r}getType(){return"MultiPolygon"}intersectsExtent(t){return wr(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=di(this.flatCoordinates,0,t,this.stride,this.endss_);if(i.length===0)this.flatCoordinates.length=0;else{const r=i[i.length-1];this.flatCoordinates.length=r.length===0?0:r[r.length-1]}this.changed()}}const bi=De();class J{constructor(t,e,i,r,s,o){this.styleFunction,this.extent_,this.id_=o,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=s,this.squaredTolerance_,this.stride_=r,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?ti(this.flatCoordinates_):qt(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=Gt(this.getExtent());this.flatInteriorPoints_=de(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=xr(this.flatCoordinates_,this.ends_),e=wi(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=vi(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=kt(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let r=0,s=i.length;r<s;++r){const o=i[r],a=kt(t,e,o,2,.5);A(this.flatMidpoints_,a),e=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){t=P(t);const e=t.getExtent(),i=t.getWorldExtent();if(e&&i){const r=Rt(i)/Rt(e);Ze(bi,i[0],i[3],r,-r,0,0,0),li(this.flatCoordinates_,0,this.flatCoordinates_.length,2,bi,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){var t;return new J(this.type_,this.flatCoordinates_.slice(),(t=this.ends_)==null?void 0:t.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=Ye((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let r;switch(this.type_){case"LineString":i.length=Nt(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),r=[i.length];break;case"MultiLineString":r=[],i.length=pi(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,r);break;case"Polygon":r=[],i.length=le(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,r);break}return r&&(this.simplifiedGeometry_=new J(this.type_,i,r,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}J.prototype.getFlatCoordinates=J.prototype.getOrientedFlatCoordinates;class Ei{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Q,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?P(e.dataProjection):this.readProjection(t);e.extent&&i&&i.getUnits()==="tile-pixels"&&(i=P(i),i.setWorldExtent(e.extent)),e={dataProjection:i,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return f()}readFeature(t,e){return f()}readFeatures(t,e){return f()}readGeometry(t,e){return f()}readProjection(t){return f()}writeFeature(t,e){return f()}writeFeatures(t,e){return f()}writeGeometry(t,e){return f()}}function bt(n,t,e){const i=e?P(e.featureProjection):null,r=e?P(e.dataProjection):null;let s=n;if(i&&r&&!rr(i,r)){t&&(s=n.clone());const o=t?i:r,a=t?r:i;o.getUnits()==="tile-pixels"?s.transform(o,a):s.applyTransform(ie(o,a))}if(t&&e&&e.decimals!==void 0){const o=Math.pow(10,e.decimals),a=function(l){for(let h=0,c=l.length;h<c;++h)l[h]=Math.round(l[h]*o)/o;return l};s===n&&(s=n.clone()),s.applyTransform(a)}return s}const Pr={Point:V,LineString:B,Polygon:z,MultiPoint:Ct,MultiLineString:vt,MultiPolygon:wt};function $r(n,t,e){return Array.isArray(t[0])?(Ci(n,0,t,e)||(n=n.slice(),fe(n,0,t,e)),n):(pe(n,0,t,e)||(n=n.slice(),jt(n,0,t,e)),n)}function xi(n,t){var s;const e=n.geometry;if(!e)return[];if(Array.isArray(e))return e.map(o=>xi({...n,geometry:o})).flat();const i=e.type==="MultiPolygon"?"Polygon":e.type;if(i==="GeometryCollection"||i==="Circle")throw new Error("Unsupported geometry type: "+i);const r=e.layout.length;return bt(new J(i,i==="Polygon"?$r(e.flatCoordinates,e.ends,r):e.flatCoordinates,(s=e.ends)==null?void 0:s.flat(),r,n.properties||{},n.id).enableSimplifyTransformed(),!1,t)}function ye(n,t){if(!n)return null;if(Array.isArray(n)){const i=n.map(r=>ye(r,t));return new X(i)}const e=Pr[n.type];return bt(new e(n.flatCoordinates,n.layout,n.ends),!1,t)}class Ar extends Ei{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(Ut(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(Ut(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return f()}readFeaturesFromObject(t,e){return f()}readGeometry(t,e){return this.readGeometryFromObject(Ut(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return f()}readProjection(t){return this.readProjectionFromObject(Ut(t))}readProjectionFromObject(t){return f()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return f()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return f()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return f()}}function Ut(n){if(typeof n=="string"){const t=JSON.parse(n);return t||null}return n!==null?n:null}class Mr extends Ar{constructor(t){t=t||{},super(),this.dataProjection=P(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=P(t.featureProjection)),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,e){let i=null;t.type==="Feature"?i=t:i={type:"Feature",geometry:t,properties:null};const r=me(i.geometry);if(this.featureClass===J)return xi({geometry:r,id:i.id,properties:i.properties},e);const s=new Q;return this.geometryName_?s.setGeometryName(this.geometryName_):this.extractGeometryName_&&i.geometry_name&&s.setGeometryName(i.geometry_name),s.setGeometry(ye(r,e)),"id"in i&&s.setId(i.id),i.properties&&s.setProperties(i.properties,!0),s}readFeaturesFromObject(t,e){const i=t;let r=null;if(i.type==="FeatureCollection"){const s=t;r=[];const o=s.features;for(let a=0,l=o.length;a<l;++a){const h=this.readFeatureFromObject(o[a],e);h&&r.push(h)}}else r=[this.readFeatureFromObject(t,e)];return r.flat()}readGeometryFromObject(t,e){return Sr(t,e)}readProjectionFromObject(t){const e=t.crs;let i;if(e)if(e.type=="name")i=P(e.properties.name);else if(e.type==="EPSG")i=P("EPSG:"+e.properties.code);else throw new Error("Unknown SRS type");else i=this.dataProjection;return i}writeFeatureObject(t,e){e=this.adaptOptions(e);const i={type:"Feature",geometry:null,properties:null},r=t.getId();if(r!==void 0&&(i.id=r),!t.hasProperties())return i;const s=t.getProperties(),o=t.getGeometry();return o&&(i.geometry=_e(o,e),delete s[t.getGeometryName()]),Ve(s)||(i.properties=s),i}writeFeaturesObject(t,e){e=this.adaptOptions(e);const i=[];for(let r=0,s=t.length;r<s;++r)i.push(this.writeFeatureObject(t[r],e));return{type:"FeatureCollection",features:i}}writeGeometryObject(t,e){return _e(t,this.adaptOptions(e))}}function me(n,t){if(!n)return null;let e;switch(n.type){case"Point":{e=Gr(n);break}case"LineString":{e=Rr(n);break}case"Polygon":{e=Nr(n);break}case"MultiPoint":{e=Lr(n);break}case"MultiLineString":{e=Tr(n);break}case"MultiPolygon":{e=Ir(n);break}case"GeometryCollection":{e=Fr(n);break}default:throw new Error("Unsupported GeoJSON type: "+n.type)}return e}function Sr(n,t){const e=me(n);return ye(e,t)}function Fr(n,t){return n.geometries.map(function(i){return me(i)})}function Gr(n){const t=n.coordinates;return{type:"Point",flatCoordinates:t,layout:U(t.length)}}function Rr(n){var i;const t=n.coordinates,e=t.flat();return{type:"LineString",flatCoordinates:e,ends:[e.length],layout:U(((i=t[0])==null?void 0:i.length)||2)}}function Tr(n){var s,o;const t=n.coordinates,e=((o=(s=t[0])==null?void 0:s[0])==null?void 0:o.length)||2,i=[],r=mt(i,0,t,e);return{type:"MultiLineString",flatCoordinates:i,ends:r,layout:U(e)}}function Lr(n){var e;const t=n.coordinates;return{type:"MultiPoint",flatCoordinates:t.flat(),layout:U(((e=t[0])==null?void 0:e.length)||2)}}function Ir(n){var s,o;const t=n.coordinates,e=[],i=((o=(s=t[0])==null?void 0:s[0])==null?void 0:o[0].length)||2,r=di(e,0,t,i);return{type:"MultiPolygon",flatCoordinates:e,ends:r,layout:U(i)}}function Nr(n){var s,o;const t=n.coordinates,e=[],i=(o=(s=t[0])==null?void 0:s[0])==null?void 0:o.length,r=mt(e,0,t,i);return{type:"Polygon",flatCoordinates:e,ends:r,layout:U(i)}}function _e(n,t){n=bt(n,!0,t);const e=n.getType();let i;switch(e){case"Point":{i=Xr(n);break}case"LineString":{i=kr(n);break}case"Polygon":{i=Yr(n,t);break}case"MultiPoint":{i=jr(n);break}case"MultiLineString":{i=Hr(n);break}case"MultiPolygon":{i=Ur(n,t);break}case"GeometryCollection":{i=Or(n,t);break}case"Circle":{i={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+e)}return i}function Or(n,t){return t=Object.assign({},t),delete t.featureProjection,{type:"GeometryCollection",geometries:n.getGeometriesArray().map(function(i){return _e(i,t)})}}function kr(n,t){return{type:"LineString",coordinates:n.getCoordinates()}}function Hr(n,t){return{type:"MultiLineString",coordinates:n.getCoordinates()}}function jr(n,t){return{type:"MultiPoint",coordinates:n.getCoordinates()}}function Ur(n,t){let e;return t&&(e=t.rightHanded),{type:"MultiPolygon",coordinates:n.getCoordinates(e)}}function Xr(n,t){return{type:"Point",coordinates:n.getCoordinates()}}function Yr(n,t){let e;return t&&(e=t.rightHanded),{type:"Polygon",coordinates:n.getCoordinates(e)}}const Br=(n,t)=>new Mr().writeFeaturesObject(n,t);class Vr extends Ei{constructor(){super()}getType(){return"text"}readFeature(t,e){return this.readFeatureFromText(Xt(t),this.adaptOptions(e))}readFeatureFromText(t,e){return f()}readFeatures(t,e){return this.readFeaturesFromText(Xt(t),this.adaptOptions(e))}readFeaturesFromText(t,e){return f()}readGeometry(t,e){return this.readGeometryFromText(Xt(t),this.adaptOptions(e))}readGeometryFromText(t,e){return f()}readProjection(t){return this.readProjectionFromText(Xt(t))}readProjectionFromText(t){return this.dataProjection}writeFeature(t,e){return this.writeFeatureText(t,this.adaptOptions(e))}writeFeatureText(t,e){return f()}writeFeatures(t,e){return this.writeFeaturesText(t,this.adaptOptions(e))}writeFeaturesText(t,e){return f()}writeGeometry(t,e){return this.writeGeometryText(t,this.adaptOptions(e))}writeGeometryText(t,e){return f()}}function Xt(n){return typeof n=="string"?n:""}const zr={POINT:V,LINESTRING:B,POLYGON:z,MULTIPOINT:Ct,MULTILINESTRING:vt,MULTIPOLYGON:wt},Pi="EMPTY",$i="Z",Ai="M",Jr="ZM",y={START:0,TEXT:1,LEFT_PAREN:2,RIGHT_PAREN:3,NUMBER:4,COMMA:5,EOF:6},Wr={Point:"POINT",LineString:"LINESTRING",Polygon:"POLYGON",MultiPoint:"MULTIPOINT",MultiLineString:"MULTILINESTRING",MultiPolygon:"MULTIPOLYGON",GeometryCollection:"GEOMETRYCOLLECTION",Circle:"CIRCLE"};class Dr{constructor(t){this.wkt=t,this.index_=-1}isAlpha_(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}isNumeric_(t,e){return e=e!==void 0?e:!1,t>="0"&&t<="9"||t=="."&&!e}isWhiteSpace_(t){return t==" "||t==" "||t=="\r"||t==`
|
|
59
|
+
`}nextChar_(){return this.wkt.charAt(++this.index_)}nextToken(){const t=this.nextChar_(),e=this.index_;let i=t,r;if(t=="(")r=y.LEFT_PAREN;else if(t==",")r=y.COMMA;else if(t==")")r=y.RIGHT_PAREN;else if(this.isNumeric_(t)||t=="-")r=y.NUMBER,i=this.readNumber_();else if(this.isAlpha_(t))r=y.TEXT,i=this.readText_();else{if(this.isWhiteSpace_(t))return this.nextToken();if(t==="")r=y.EOF;else throw new Error("Unexpected character: "+t)}return{position:e,value:i,type:r}}readNumber_(){let t;const e=this.index_;let i=!1,r=!1;do t=="."?i=!0:(t=="e"||t=="E")&&(r=!0),t=this.nextChar_();while(this.isNumeric_(t,i)||!r&&(t=="e"||t=="E")||r&&(t=="-"||t=="+"));return parseFloat(this.wkt.substring(e,this.index_--))}readText_(){let t;const e=this.index_;do t=this.nextChar_();while(this.isAlpha_(t));return this.wkt.substring(e,this.index_--).toUpperCase()}}class Zr{constructor(t){this.lexer_=t,this.token_={position:0,type:y.START},this.layout_="XY"}consume_(){this.token_=this.lexer_.nextToken()}isTokenType(t){return this.token_.type==t}match(t){const e=this.isTokenType(t);return e&&this.consume_(),e}parse(){return this.consume_(),this.parseGeometry_()}parseGeometryLayout_(){let t="XY";const e=this.token_;if(this.isTokenType(y.TEXT)){const i=e.value;i===$i?t="XYZ":i===Ai?t="XYM":i===Jr&&(t="XYZM"),t!=="XY"&&this.consume_()}return t}parseGeometryCollectionText_(){if(this.match(y.LEFT_PAREN)){const t=[];do t.push(this.parseGeometry_());while(this.match(y.COMMA));if(this.match(y.RIGHT_PAREN))return t}throw new Error(this.formatErrorMessage_())}parsePointText_(){if(this.match(y.LEFT_PAREN)){const t=this.parsePoint_();if(this.match(y.RIGHT_PAREN))return t}throw new Error(this.formatErrorMessage_())}parseLineStringText_(){if(this.match(y.LEFT_PAREN)){const t=this.parsePointList_();if(this.match(y.RIGHT_PAREN))return t}throw new Error(this.formatErrorMessage_())}parsePolygonText_(){if(this.match(y.LEFT_PAREN)){const t=this.parseLineStringTextList_();if(this.match(y.RIGHT_PAREN))return t}throw new Error(this.formatErrorMessage_())}parseMultiPointText_(){if(this.match(y.LEFT_PAREN)){let t;if(this.token_.type==y.LEFT_PAREN?t=this.parsePointTextList_():t=this.parsePointList_(),this.match(y.RIGHT_PAREN))return t}throw new Error(this.formatErrorMessage_())}parseMultiLineStringText_(){if(this.match(y.LEFT_PAREN)){const t=this.parseLineStringTextList_();if(this.match(y.RIGHT_PAREN))return t}throw new Error(this.formatErrorMessage_())}parseMultiPolygonText_(){if(this.match(y.LEFT_PAREN)){const t=this.parsePolygonTextList_();if(this.match(y.RIGHT_PAREN))return t}throw new Error(this.formatErrorMessage_())}parsePoint_(){const t=[],e=this.layout_.length;for(let i=0;i<e;++i){const r=this.token_;if(this.match(y.NUMBER))t.push(r.value);else break}if(t.length==e)return t;throw new Error(this.formatErrorMessage_())}parsePointList_(){const t=[this.parsePoint_()];for(;this.match(y.COMMA);)t.push(this.parsePoint_());return t}parsePointTextList_(){const t=[this.parsePointText_()];for(;this.match(y.COMMA);)t.push(this.parsePointText_());return t}parseLineStringTextList_(){const t=[this.parseLineStringText_()];for(;this.match(y.COMMA);)t.push(this.parseLineStringText_());return t}parsePolygonTextList_(){const t=[this.parsePolygonText_()];for(;this.match(y.COMMA);)t.push(this.parsePolygonText_());return t}isEmptyGeometry_(){const t=this.isTokenType(y.TEXT)&&this.token_.value==Pi;return t&&this.consume_(),t}formatErrorMessage_(){return"Unexpected `"+this.token_.value+"` at position "+this.token_.position+" in `"+this.lexer_.wkt+"`"}parseGeometry_(){const t=this.token_;if(this.match(y.TEXT)){const e=t.value;this.layout_=this.parseGeometryLayout_();const i=this.isEmptyGeometry_();if(e=="GEOMETRYCOLLECTION"){if(i)return new X([]);const o=this.parseGeometryCollectionText_();return new X(o)}const r=zr[e];if(!r)throw new Error("Invalid geometry type: "+e);let s;if(i)e=="POINT"?s=[NaN,NaN]:s=[];else switch(e){case"POINT":{s=this.parsePointText_();break}case"LINESTRING":{s=this.parseLineStringText_();break}case"POLYGON":{s=this.parsePolygonText_();break}case"MULTIPOINT":{s=this.parseMultiPointText_();break}case"MULTILINESTRING":{s=this.parseMultiLineStringText_();break}case"MULTIPOLYGON":{s=this.parseMultiPolygonText_();break}}return new r(s,this.layout_)}throw new Error(this.formatErrorMessage_())}}class Kr extends Vr{constructor(t){super(),t=t||{},this.splitCollection_=t.splitCollection!==void 0?t.splitCollection:!1}parse_(t){const e=new Dr(t);return new Zr(e).parse()}readFeatureFromText(t,e){const i=this.readGeometryFromText(t,e),r=new Q;return r.setGeometry(i),r}readFeaturesFromText(t,e){let i=[];const r=this.readGeometryFromText(t,e);this.splitCollection_&&r.getType()=="GeometryCollection"?i=r.getGeometriesArray():i=[r];const s=[];for(let o=0,a=i.length;o<a;++o){const l=new Q;l.setGeometry(i[o]),s.push(l)}return s}readGeometryFromText(t,e){const i=this.parse_(t);return bt(i,!1,e)}writeFeatureText(t,e){const i=t.getGeometry();return i?this.writeGeometryText(i,e):""}writeFeaturesText(t,e){if(t.length==1)return this.writeFeatureText(t[0],e);const i=[];for(let s=0,o=t.length;s<o;++s)i.push(t[s].getGeometry());const r=new X(i);return this.writeGeometryText(r,e)}writeGeometryText(t,e){return Fi(bt(t,!0,e))}}function Mi(n){const t=n.getCoordinates();return t.length===0?"":t.join(" ")}function qr(n){const t=[],e=n.getPoints();for(let i=0,r=e.length;i<r;++i)t.push("("+Mi(e[i])+")");return t.join(",")}function Qr(n){const t=[],e=n.getGeometries();for(let i=0,r=e.length;i<r;++i)t.push(Fi(e[i]));return t.join(",")}function ve(n){const t=n.getCoordinates(),e=[];for(let i=0,r=t.length;i<r;++i)e.push(t[i].join(" "));return e.join(",")}function ts(n){const t=[],e=n.getLineStrings();for(let i=0,r=e.length;i<r;++i)t.push("("+ve(e[i])+")");return t.join(",")}function Si(n){const t=[],e=n.getLinearRings();for(let i=0,r=e.length;i<r;++i)t.push("("+ve(e[i])+")");return t.join(",")}function es(n){const t=[],e=n.getPolygons();for(let i=0,r=e.length;i<r;++i)t.push("("+Si(e[i])+")");return t.join(",")}function is(n){const t=n.getLayout();let e="";return(t==="XYZ"||t==="XYZM")&&(e+=$i),(t==="XYM"||t==="XYZM")&&(e+=Ai),e}const ns={Point:Mi,LineString:ve,Polygon:Si,MultiPoint:qr,MultiLineString:ts,MultiPolygon:es,GeometryCollection:Qr};function Fi(n){const t=n.getType(),e=ns[t],i=e(n);let r=Wr[t];if(typeof n.getFlatCoordinates=="function"){const s=is(n);s.length>0&&(r+=" "+s)}return i.length===0?r+" "+Pi:r+"("+i+")"}const rs=(n,t)=>new Kr().writeFeatures(n,t);/**
|
|
59
60
|
* @license
|
|
60
61
|
* Copyright 2021 Google LLC
|
|
61
62
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
62
|
-
*/function
|
|
63
|
+
*/function Gi(n,t,e){return n?t(n):e==null?void 0:e(n)}class Ri extends N{constructor(){super();D(this,Et,!0);D(this,xt,!0);this.multipleFeatures=!1,this.drawnFeatures=[],this.importFeatures=!1,this.showEditor=!1,this.currentlyDrawing=!1,this.drawFunc=null,this.geoJSON="",this.unstyled=!1,this.select=!1}updateButtonStates(){const{drawDisabled:e,discardDisabled:i}=_n(this);G(this,Et,e),G(this,xt,i)}createRenderRoot(){return this}render(){this.updateButtonStates();const e=this.currentlyDrawing?"drawing":"draw";return L`
|
|
63
64
|
<style>
|
|
64
|
-
${!this.unstyled&&
|
|
65
|
-
${!this.unstyled&&
|
|
65
|
+
${!this.unstyled&&vn}
|
|
66
|
+
${!this.unstyled&&Cn}
|
|
66
67
|
</style>
|
|
67
68
|
<div class="wrap-btn">
|
|
68
69
|
<slot></slot>
|
|
@@ -71,7 +72,7 @@
|
|
|
71
72
|
<button
|
|
72
73
|
data-cy="drawBtn"
|
|
73
74
|
class="${this.select?"pointer":"polygon"} icon"
|
|
74
|
-
?disabled="${
|
|
75
|
+
?disabled="${M(this,Et)||C}"
|
|
75
76
|
@click="${()=>this.drawFunc.start()}"
|
|
76
77
|
>
|
|
77
78
|
${e}
|
|
@@ -81,7 +82,7 @@
|
|
|
81
82
|
<button
|
|
82
83
|
data-cy="discardBtn"
|
|
83
84
|
class="discard icon"
|
|
84
|
-
?disabled="${
|
|
85
|
+
?disabled="${M(this,xt)||C}"
|
|
85
86
|
@click="${()=>this.drawFunc.discard()}"
|
|
86
87
|
>
|
|
87
88
|
discard
|
|
@@ -89,7 +90,7 @@
|
|
|
89
90
|
</div>
|
|
90
91
|
|
|
91
92
|
<!-- Import Button -->
|
|
92
|
-
${
|
|
93
|
+
${Gi(this.importFeatures,()=>L`
|
|
93
94
|
<!-- Import Input Field : Hidden -->
|
|
94
95
|
<input
|
|
95
96
|
type="file"
|
|
@@ -110,7 +111,7 @@
|
|
|
110
111
|
</div>
|
|
111
112
|
|
|
112
113
|
<!-- Geo JSON Wrapper -->
|
|
113
|
-
${
|
|
114
|
+
${Gi(this.showEditor,()=>L`
|
|
114
115
|
<div class="json-wrapper">
|
|
115
116
|
<!-- Geo JSON Editor -->
|
|
116
117
|
<textarea
|
|
@@ -123,13 +124,13 @@
|
|
|
123
124
|
<button
|
|
124
125
|
data-cy="copyBtn"
|
|
125
126
|
class="icon-copy"
|
|
126
|
-
@click=${()=>
|
|
127
|
+
@click=${()=>wn(this.geoJSON)}
|
|
127
128
|
>
|
|
128
|
-
${this.unstyled?"copy":
|
|
129
|
+
${this.unstyled?"copy":C}
|
|
129
130
|
</button>
|
|
130
131
|
</div>
|
|
131
132
|
`)}
|
|
132
|
-
`}}
|
|
133
|
+
`}}Et=new WeakMap,xt=new WeakMap,W(Ri,"properties",{multipleFeatures:{attribute:!1,type:Boolean},drawnFeatures:{attribute:!1,state:!0,type:Array},currentlyDrawing:{attribute:!1,state:!0,type:Boolean},drawFunc:{attribute:!1,type:Object},select:{type:Boolean},importFeatures:{attribute:"import-features",type:Boolean},showEditor:{attribute:"show-editor",type:Boolean},geoJSON:{attribute:"geo-json",type:String},unstyled:{type:Boolean}}),customElements.define("eox-drawtools-controller",Ri);const ss=`
|
|
133
134
|
button.discard:before {
|
|
134
135
|
content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23FF5252' viewBox='0 0 24 24'%3E%3Ctitle%3Etrash-can-outline%3C/title%3E%3Cpath d='M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z' /%3E%3C/svg%3E")
|
|
135
136
|
}
|
|
@@ -174,16 +175,16 @@
|
|
|
174
175
|
color: white;
|
|
175
176
|
content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ctitle%3Econtent-copy%3C/title%3E%3Cpath d='M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z' fill='white' /%3E%3C/svg%3E")
|
|
176
177
|
}
|
|
177
|
-
`,de=i=>{(()=>{i.emitDrawnFeatures(),i.multipleFeatures||(i.draw.setActive(!1),i.selectionEvents.removeSelectionEvent(),i.currentlyDrawing=!1)})(),i.requestUpdate()},he=i=>{const t=()=>{i.drawLayer.set("isDrawingEnabled",!0),i.draw.setActive(!0),i.selectionEvents.addSelectionEvent()},e=()=>{i.currentlyDrawing=!0,i.requestUpdate()};t(),e()},pe=i=>{let t;return typeof i=="string"?t=document.querySelector(i):t=i,t},_t=(i,t)=>{var n;const r=pe(i.for),s=r.map;return i.drawLayer=r.addOrUpdateLayer({zIndex:100,type:"Vector",properties:{id:"drawLayer",layerControlHide:!0,isDrawingEnabled:!1,multipleFeatures:t},source:{type:"Vector"},interactions:[{type:"draw",options:{active:!1,id:"drawInteraction",type:i.type,modify:i.allowModify,stopClick:!0}},{type:"select",options:{id:"selectHover",condition:"pointermove",style:{"fill-color":"rgba(51, 153, 204,0.5)","stroke-color":"#3399CC","stroke-width":2.5}}},{type:"select",options:{id:"selectClick",condition:"click",panIn:!0,style:{"fill-color":"rgba(51, 153, 204,0.5)","stroke-color":"#3399CC","stroke-width":2.5}}}]}),i.draw=r.interactions.drawInteraction,i.modify=r.interactions.drawInteractionmodify,et(i,r,i.layerId),(n=i.modify)==null||n.on("modifyend",()=>i.onModifyEnd()),r.addEventListener("addfeatures",()=>de(i)),{EoxMap:r,OlMap:s}},ue=i=>{const t=()=>{i.drawnFeatures=[],i.draw.setActive(!1),i.selectionEvents.removeSelectionEvent(),i.drawLayer.getSource().clear(),i.geoJSON=null},e=()=>{i.emitDrawnFeatures(),i.currentlyDrawing=!1,i.requestUpdate()};t(),e()},ye=(i,t)=>{setTimeout(()=>{i.drawnFeatures=i.drawLayer.getSource().getFeatures(),i.updateGeoJSON(),i.requestUpdate(),t()},0)},fe=i=>{const t=s=>{(s==null?void 0:s.detail.id)!=="SelectLayerClickInteraction"||!s.detail.feature||(i.drawLayer.getSource().addFeature(s.detail.feature),i.eoxMap.dispatchEvent(new CustomEvent("addfeatures",{detail:s.detail})))};return{addSelectionEvent:()=>{i.layerId&&(i.eoxMap.selectInteractions.SelectLayerHoverInteraction.setActive(!0),i.eoxMap.addEventListener("select",t))},removeSelectionEvent:()=>{var n;const s=(n=i.eoxMap.selectInteractions)==null?void 0:n.SelectLayerHoverInteraction;s&&(s.selectedFids=[],s.setActive(!1)),i.eoxMap.removeEventListener("select",t)}}},et=(i,t,e)=>{if(!e||!t)return;const r=JSON.parse(JSON.stringify(t.getLayerById(e).get("_jsonDefinition")))||null;if(!r){console.error(`Layer with id ${e} not found`);return}const s={type:"select",active:!1,options:{id:"SelectLayerHoverInteraction",condition:"pointermove",active:!1,style:{"fill-color":"rgba(0, 0, 0,0.0)","stroke-color":"#3399CC","stroke-width":2.5}}},n={type:"select",options:{id:"SelectLayerClickInteraction",condition:"click",multi:i.multipleFeatures,modify:i.allowModify,active:!1,style:{"fill-color":"rgba(0, 0, 0,0.0)","stroke-color":"rgba(0, 0, 0,0.0)"}}};r.interactions=[s,n],t.addOrUpdateLayer(r);const o=i.draw;i.draw=t.selectInteractions.SelectLayerClickInteraction,o.setActive(!1),t.selectInteractions.SelectLayerClickInteraction.setActive(!1),t.selectInteractions.SelectLayerHoverInteraction.setActive(!1)},ge=(i,t,e,r)=>{if(t){if(e){r&&e!==r&&xt(i,t),et(i,t,e);return}if(!e&&r){xt(i,t);return}}};function xt(i,t){t&&(i.discardDrawing(),i.selectionEvents.removeSelectionEvent(),i.draw=t.interactions.drawInteraction,t.selectInteractions.SelectLayerClickInteraction.remove(),t.selectInteractions.SelectLayerHoverInteraction.remove())}const me=':root,:host { --spacing: 1rem; --block-spacing-vertical: calc(var(--spacing) * 2); --block-spacing-horizontal: var(--spacing); --background-color: var(--eox-background-color, white); --color: var(--eox-color, #2c3d49); --h-color: var(--eox-h-color, var(--color)); --hover-transparency: var(--eox-hover-transparency, 20%); --bg-hover-transparency: var(--eox-bg-hover-transparency, 40%); --btn-hover-transparency: var(--eox-btn-hover-transparency, 80%); --primary-color: var(--eox-primary-color, #004170); --primary-color-hover: color-mix( in srgb, var(--primary-color) var(--hover-transparency), transparent ); --primary-bg-color-hover: color-mix( in srgb, var(--primary-color) var(--bg-hover-transparency), transparent ); --primary-btn-color-hover: color-mix( in srgb, var(--primary-color) var(--btn-hover-transparency), transparent ); --secondary-color: var(--eox-secondary-color, #c6d4df); --secondary-color-hover: color-mix( in srgb, var(--secondary-color) var(--hover-transparency), transparent ); --secondary-bg-color-hover: color-mix( in srgb, var(--secondary-color) var(--bg-hover-transparency), transparent ); --secondary-btn-color-hover: color-mix( in srgb, var(--secondary-color) var(--btn-hover-transparency), transparent ); --success: var(--eox-success, #26cc0f); --warning: var(--eox-warning, #f18e32); --error: var(--eox-error, #ff5252); --header-font-family: var(--eox-header-font-family, "Roboto", sans-serif); --body-font-family: var(--eox-body-font-family, "Roboto", sans-serif);}* { font-size: normal; font-family: var(--body-font-family); color: var(--eox-color);}h1,h2,h3,h4,h5,h6 { font-family: var(--header-font-family);}span,p,div,main,label { font-family: var(--body-font-family);}@media (min-width: 576px) { .container { max-width: 510px; padding-right: 0; padding-left: 0; --block-spacing-vertical: calc(var(--spacing) * 2.5); }}@media (min-width: 768px) { .container { max-width: 700px; --block-spacing-vertical: calc(var(--spacing) * 3); }}@media (min-width: 992px) { .container { max-width: 920px; --block-spacing-vertical: calc(var(--spacing) * 3.5); }}@media (min-width: 1200px) { .container { max-width: 1130px; --block-spacing-vertical: calc(var(--spacing) * 4); }}.container { width: 100%; margin-right: auto; margin-left: auto; display: block; padding: var(--block-spacing-vertical) var(--block-spacing-horizontal);}h1,h2,h3 { line-height: 120%; margin-top: 0.8rem; margin-bottom: 0.8rem;}p { --font-size: 1rem; font-weight: 400; line-height: 170%; margin-top: 0.8rem; margin-bottom: 1.6rem; font-size: var(--font-size);}body { padding: 0; margin: 0;}.sb-show-main.sb-main-padded { padding: 0;}h1,h2,h3,h4,h5,h6 { --font-weight: 700;}h1 { --font-size: 3rem; --typography-spacing-vertical: 0.5rem;}h2 { --font-size: 2rem; --typography-spacing-vertical: 0.5rem;}h3 { --font-size: 1.75rem; --typography-spacing-vertical: 0.5rem;}h4 { --font-size: 1.5rem; --typography-spacing-vertical: 0.5rem;}h5 { --font-size: 1.25rem; --typography-spacing-vertical: 0.5rem;}h1,h2,h3,h4,h5,h6 { margin-top: 0; margin-bottom: var(--typography-spacing-vertical); color: var(--h-color); font-weight: var(--font-weight); font-size: var(--font-size); font-family: var(--header-font-family);}';function ve(i,t){function e(n){n.preventDefault(),n.stopPropagation()}function r(n){n.srcElement.style.opacity="0.4"}function s(n){n.srcElement.style.opacity="1"}["dragenter","dragover","dragleave","drop"].forEach(n=>{t.addEventListener(n,e,!1),["dragenter","dragover"].includes(n)?t.addEventListener(n,r,!1):t.addEventListener(n,s,!1)}),t.addEventListener("drop",n=>At(n,i),!1)}function be(i){i.preventDefault(),i.stopPropagation()}function At(i,t){be(i);const e=i.dataTransfer?i.dataTransfer.files:i.target.files;Array.from(e).forEach(r=>$e(r,t))}function $e(i,t){const e=new FileReader;e.readAsText(i),e.onloadend=function(){typeof e.result=="string"&&t.handleFeatureChange(e.result)}}class St extends C{constructor(){super();H(this,I);H(this,L);H(this,D);H(this,U);this.allowModify=!1,this.for="eox-map",this.currentlyDrawing=!1,this.draw=null,this.drawLayer=null,this.layerId="",this.drawnFeatures=[],this.modify=null,this.multipleFeatures=!1,this.importFeatures=!1,this.showEditor=!1,this.showList=!1,this.type="Polygon",this.unstyled=!1,this.noShadow=!1,this.selectionEvents=null}static get properties(){return{allowModify:{attribute:"allow-modify",type:Boolean},for:{type:String},currentlyDrawing:{attribute:!1,state:!0,type:Boolean},draw:{attribute:!1,state:!0},drawLayer:{attribute:!1,state:!0},layerId:{attribute:"layer-id",type:String},drawnFeatures:{attribute:!1,state:!0,type:Array},modify:{attribute:!1,state:!0},multipleFeatures:{attribute:"multiple-features",type:Boolean},importFeatures:{attribute:"import-features",type:Boolean},showEditor:{attribute:"show-editor",type:Boolean},showList:{attribute:"show-list",type:Boolean},noShadow:{type:Boolean},type:{type:String},unstyled:{type:Boolean}}}set layerId(e){ge(this,this.eoxMap,e,m(this,U)),w(this,U,e)}get layerId(){return m(this,U)}startDrawing(){he(this)}discardDrawing(){ue(this)}handleFeatureChange(e,r=!1){this.eoxMap.parseTextToFeature(e||JSON.stringify(vt),this.drawLayer,this.eoxMap,r)}handleFilesChange(e){At(e,this)}onModifyEnd(){this.emitDrawnFeatures()}updateGeoJSON(){w(this,D,JSON.stringify(this.eoxMap.parseFeature(this.drawnFeatures)||vt,void 0,2))}emitDrawnFeatures(){ye(this,()=>{this.dispatchEvent(new CustomEvent("drawupdate",{detail:this.drawnFeatures}))})}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}firstUpdated(){const{EoxMap:e,OlMap:r}=_t(this,this.multipleFeatures);this.eoxMap=e,w(this,L,r),this.selectionEvents=fe(this),this.importFeatures&&ve(this,this.eoxMap),this.updateGeoJSON(),this.requestUpdate()}updated(e){if(e.has("for")){const{EoxMap:r,OlMap:s}=_t(this,this.multipleFeatures);this.eoxMap=r,w(this,L,s)}}get eoxMap(){return m(this,I)}set eoxMap(e){const r=m(this,I);w(this,I,e),this.requestUpdate("eoxMap",r)}render(){var e;return A`
|
|
178
|
+
`,os=n=>{(()=>{n.emitDrawnFeatures(),n.multipleFeatures||(n.draw.setActive(!1),n.selectionEvents.removeSelectionEvent(),n.currentlyDrawing=!1)})(),n.requestUpdate()},as=n=>{const t=()=>{n.drawLayer.set("isDrawingEnabled",!0),n.draw.setActive(!0),n.selectionEvents.addSelectionEvent()},e=()=>{n.currentlyDrawing=!0,n.requestUpdate()};t(),e()},ls=n=>{let t;return typeof n=="string"?t=document.querySelector(n):t=n,t},Ti=(n,t)=>{var s;const i=ls(n.for),r=i.map;return n.drawLayer=i.addOrUpdateLayer({zIndex:100,type:"Vector",properties:{id:"drawLayer",layerControlHide:!0,isDrawingEnabled:!1,multipleFeatures:t},source:{type:"Vector"},interactions:[{type:"draw",options:{active:!1,id:"drawInteraction",type:n.type,modify:n.allowModify,stopClick:!0}},{type:"select",options:{id:"selectHover",condition:"pointermove",style:{"fill-color":"rgba(51, 153, 204,0.5)","stroke-color":"#3399CC","stroke-width":2.5}}},{type:"select",options:{id:"selectClick",condition:"click",panIn:!0,style:{"fill-color":"rgba(51, 153, 204,0.5)","stroke-color":"#3399CC","stroke-width":2.5}}}]}),n.draw=i.interactions.drawInteraction,n.modify=i.interactions.drawInteractionmodify,Ce(n,i,n.layerId),(s=n.modify)==null||s.on("modifyend",()=>n.onModifyEnd()),i.addEventListener("addfeatures",()=>os(n)),{EoxMap:i,OlMap:r}},hs=n=>{const t=()=>{n.drawnFeatures=[],n.draw.setActive(!1),n.selectionEvents.removeSelectionEvent(),n.drawLayer.getSource().clear(),n.geoJSON=null},e=()=>{n.emitDrawnFeatures(),n.currentlyDrawing=!1,n.requestUpdate()};t(),e()},cs=(n,t)=>{setTimeout(()=>{const i=n.drawLayer.getSource().getFeatures(),r=n.eoxMap.projection||"EPSG:3857",s=n.projection;n.drawnFeatures=s?i.map(a=>{a=a.clone();const l=a.getGeometry().transform(r,s);return a.setGeometry(l),a}):i;let o;switch(n.format){case"geojson":o=Br(n.drawnFeatures);break;case"wkt":o=rs(n.drawnFeatures);break;case"feature":o=n.drawnFeatures;break;default:o=n.drawnFeatures;break}n.updateGeoJSON(),n.requestUpdate(),t(o)},0)},us=n=>{const t=r=>{(r==null?void 0:r.detail.id)!=="SelectLayerClickInteraction"||!r.detail.feature||(n.drawLayer.getSource().addFeature(r.detail.feature),n.eoxMap.dispatchEvent(new CustomEvent("addfeatures",{detail:r.detail})))};return{addSelectionEvent:()=>{n.layerId&&(n.eoxMap.selectInteractions.SelectLayerHoverInteraction.setActive(!0),n.eoxMap.addEventListener("select",t))},removeSelectionEvent:()=>{var s;const r=(s=n.eoxMap.selectInteractions)==null?void 0:s.SelectLayerHoverInteraction;r&&(r.selectedFids=[],r.setActive(!1)),n.eoxMap.removeEventListener("select",t)}}},Ce=(n,t,e)=>{if(!e||!t)return;const i=JSON.parse(JSON.stringify(t.getLayerById(e).get("_jsonDefinition")))||null;if(!i){console.error(`Layer with id ${e} not found`);return}const r={type:"select",active:!1,options:{id:"SelectLayerHoverInteraction",condition:"pointermove",active:!1,style:{"fill-color":"rgba(0, 0, 0,0.0)","stroke-color":"#3399CC","stroke-width":2.5}}},s={type:"select",options:{id:"SelectLayerClickInteraction",condition:"click",multi:n.multipleFeatures,modify:n.allowModify,active:!1,style:{"fill-color":"rgba(0, 0, 0,0.0)","stroke-color":"rgba(0, 0, 0,0.0)"}}};i.interactions=[r,s],t.addOrUpdateLayer(i);const o=n.draw;n.draw=t.selectInteractions.SelectLayerClickInteraction,o.setActive(!1),t.selectInteractions.SelectLayerClickInteraction.setActive(!1),t.selectInteractions.SelectLayerHoverInteraction.setActive(!1)},ds=(n,t,e,i)=>{if(t){if(e){i&&e!==i&&Li(n,t),Ce(n,t,e);return}if(!e&&i){Li(n,t);return}}};function Li(n,t){t&&(n.discardDrawing(),n.selectionEvents.removeSelectionEvent(),n.draw=t.interactions.drawInteraction,t.selectInteractions.SelectLayerClickInteraction.remove(),t.selectInteractions.SelectLayerHoverInteraction.remove())}const gs=':root,:host { --spacing: 1rem; --block-spacing-vertical: calc(var(--spacing) * 2); --block-spacing-horizontal: var(--spacing); --background-color: var(--eox-background-color, white); --color: var(--eox-color, #2c3d49); --h-color: var(--eox-h-color, var(--color)); --hover-transparency: var(--eox-hover-transparency, 20%); --bg-hover-transparency: var(--eox-bg-hover-transparency, 40%); --btn-hover-transparency: var(--eox-btn-hover-transparency, 80%); --primary-color: var(--eox-primary-color, #004170); --primary-color-hover: color-mix( in srgb, var(--primary-color) var(--hover-transparency), transparent ); --primary-bg-color-hover: color-mix( in srgb, var(--primary-color) var(--bg-hover-transparency), transparent ); --primary-btn-color-hover: color-mix( in srgb, var(--primary-color) var(--btn-hover-transparency), transparent ); --secondary-color: var(--eox-secondary-color, #c6d4df); --secondary-color-hover: color-mix( in srgb, var(--secondary-color) var(--hover-transparency), transparent ); --secondary-bg-color-hover: color-mix( in srgb, var(--secondary-color) var(--bg-hover-transparency), transparent ); --secondary-btn-color-hover: color-mix( in srgb, var(--secondary-color) var(--btn-hover-transparency), transparent ); --success: var(--eox-success, #26cc0f); --warning: var(--eox-warning, #f18e32); --error: var(--eox-error, #ff5252); --header-font-family: var(--eox-header-font-family, "Roboto", sans-serif); --body-font-family: var(--eox-body-font-family, "Roboto", sans-serif);}* { font-size: normal; font-family: var(--body-font-family); color: var(--eox-color);}h1,h2,h3,h4,h5,h6 { font-family: var(--header-font-family);}span,p,div,main,label { font-family: var(--body-font-family);}@media (min-width: 576px) { .container { max-width: 510px; padding-right: 0; padding-left: 0; --block-spacing-vertical: calc(var(--spacing) * 2.5); }}@media (min-width: 768px) { .container { max-width: 700px; --block-spacing-vertical: calc(var(--spacing) * 3); }}@media (min-width: 992px) { .container { max-width: 920px; --block-spacing-vertical: calc(var(--spacing) * 3.5); }}@media (min-width: 1200px) { .container { max-width: 1130px; --block-spacing-vertical: calc(var(--spacing) * 4); }}.container { width: 100%; margin-right: auto; margin-left: auto; display: block; padding: var(--block-spacing-vertical) var(--block-spacing-horizontal);}h1,h2,h3 { line-height: 120%; margin-top: 0.8rem; margin-bottom: 0.8rem;}p { --font-size: 1rem; font-weight: 400; line-height: 170%; margin-top: 0.8rem; margin-bottom: 1.6rem; font-size: var(--font-size);}body { padding: 0; margin: 0;}.sb-show-main.sb-main-padded { padding: 0;}h1,h2,h3,h4,h5,h6 { --font-weight: 700;}h1 { --font-size: 3rem; --typography-spacing-vertical: 0.5rem;}h2 { --font-size: 2rem; --typography-spacing-vertical: 0.5rem;}h3 { --font-size: 1.75rem; --typography-spacing-vertical: 0.5rem;}h4 { --font-size: 1.5rem; --typography-spacing-vertical: 0.5rem;}h5 { --font-size: 1.25rem; --typography-spacing-vertical: 0.5rem;}h1,h2,h3,h4,h5,h6 { margin-top: 0; margin-bottom: var(--typography-spacing-vertical); color: var(--h-color); font-weight: var(--font-weight); font-size: var(--font-size); font-family: var(--header-font-family);}pre { position: relative; border-radius: 4px; z-index: 1; margin: 0; padding: 20px 0; background: transparent; background: var(--code-bg-color, #8e96aa24);}code { display: block; padding: 0 24px; width: fit-content; min-width: 100%; line-height: var(--code-line-height, 1.7); font-family: var(--code-font-family, monospace); font-size: var(--code-font-size, var(--font-size)); color: var(--code-color, #004170);}:not(pre) > code { display: inline; border-radius: 4px; background: var(--code-bg-color, #8e96aa24); padding: var(--code-padding, 3px 6px);}';function ps(n,t){function e(s){s.preventDefault(),s.stopPropagation()}function i(s){s.srcElement.style.opacity="0.4"}function r(s){s.srcElement.style.opacity="1"}["dragenter","dragover","dragleave","drop"].forEach(s=>{t.addEventListener(s,e,!1),["dragenter","dragover"].includes(s)?t.addEventListener(s,i,!1):t.addEventListener(s,r,!1)}),t.addEventListener("drop",s=>Ii(s,n),!1)}function fs(n){n.preventDefault(),n.stopPropagation()}function Ii(n,t){fs(n);const e=n.dataTransfer?n.dataTransfer.files:n.target.files;Array.from(e).forEach(i=>ys(i,t))}function ys(n,t){const e=new FileReader;e.readAsText(n),e.onloadend=function(){typeof e.result=="string"&&t.handleFeatureChange(e.result)}}class Ni extends N{constructor(){super();D(this,rt);D(this,st);D(this,Pt);D(this,ot);this.allowModify=!1,this.for="eox-map",this.currentlyDrawing=!1,this.draw=null,this.drawLayer=null,this.layerId="",this.drawnFeatures=[],this.modify=null,this.multipleFeatures=!1,this.importFeatures=!1,this.showEditor=!1,this.showList=!1,this.projection="EPSG:4326",this.type="Polygon",this.selectionEvents=null,this.format="feature",this.unstyled=!1,this.noShadow=!1}static get properties(){return{allowModify:{attribute:"allow-modify",type:Boolean},for:{type:String},currentlyDrawing:{attribute:!1,state:!0,type:Boolean},draw:{attribute:!1,state:!0},drawLayer:{attribute:!1,state:!0},layerId:{attribute:"layer-id",type:String},drawnFeatures:{attribute:!1,state:!0,type:Array},modify:{attribute:!1,state:!0},multipleFeatures:{attribute:"multiple-features",type:Boolean},importFeatures:{attribute:"import-features",type:Boolean},showEditor:{attribute:"show-editor",type:Boolean},showList:{attribute:"show-list",type:Boolean},projection:{type:String},noShadow:{type:Boolean},format:{type:String},type:{type:String},unstyled:{type:Boolean}}}set layerId(e){ds(this,this.eoxMap,e,M(this,ot)),G(this,ot,e)}get layerId(){return M(this,ot)}startDrawing(){as(this)}discardDrawing(){hs(this)}handleFeatureChange(e,i=!1){this.eoxMap.parseTextToFeature(e||JSON.stringify(ke),this.drawLayer,this.eoxMap,i)}handleFilesChange(e){Ii(e,this)}onModifyEnd(){this.emitDrawnFeatures()}updateGeoJSON(){G(this,Pt,JSON.stringify(this.eoxMap.parseFeature(this.drawnFeatures)||ke,void 0,2))}emitDrawnFeatures(){cs(this,i=>{this.dispatchEvent(new CustomEvent("drawupdate",{detail:i}))})}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}firstUpdated(){const{EoxMap:e,OlMap:i}=Ti(this,this.multipleFeatures);this.eoxMap=e,G(this,st,i),this.selectionEvents=us(this),this.importFeatures&&ps(this,this.eoxMap),this.updateGeoJSON(),this.requestUpdate()}updated(e){if(e.has("for")){const{EoxMap:i,OlMap:r}=Ti(this,this.multipleFeatures);this.eoxMap=i,G(this,st,r)}}get eoxMap(){return M(this,rt)}set eoxMap(e){const i=M(this,rt);G(this,rt,e),this.requestUpdate("eoxMap",i)}render(){var e;return L`
|
|
178
179
|
<style>
|
|
179
180
|
:host { display: block; }
|
|
180
|
-
${!this.unstyled&&
|
|
181
|
-
${!this.unstyled&&
|
|
181
|
+
${!this.unstyled&&gs}
|
|
182
|
+
${!this.unstyled&&ss}
|
|
182
183
|
</style>
|
|
183
184
|
|
|
184
185
|
<!-- Controller Component -->
|
|
185
186
|
<eox-drawtools-controller
|
|
186
|
-
.drawFunc=${{start:()=>this.startDrawing(),discard:()=>this.discardDrawing(),editor:
|
|
187
|
+
.drawFunc=${{start:()=>this.startDrawing(),discard:()=>this.discardDrawing(),editor:i=>this.handleFeatureChange(i.target.value,!0),import:i=>this.handleFilesChange(i)}}
|
|
187
188
|
?select=${!!this.layerId}
|
|
188
189
|
.unstyled=${this.unstyled}
|
|
189
190
|
.drawnFeatures=${this.drawnFeatures}
|
|
@@ -191,18 +192,18 @@
|
|
|
191
192
|
.multipleFeatures=${this.multipleFeatures}
|
|
192
193
|
.importFeatures=${this.importFeatures}
|
|
193
194
|
.showEditor=${this.showEditor}
|
|
194
|
-
.geoJSON=${
|
|
195
|
+
.geoJSON=${M(this,Pt)}
|
|
195
196
|
></eox-drawtools-controller>
|
|
196
197
|
|
|
197
198
|
<!-- List Component -->
|
|
198
|
-
${this.showList&&((e=this.drawnFeatures)!=null&&e.length)?
|
|
199
|
+
${this.showList&&((e=this.drawnFeatures)!=null&&e.length)?L`<eox-drawtools-list
|
|
199
200
|
.eoxMap=${this.eoxMap}
|
|
200
|
-
.olMap=${
|
|
201
|
+
.olMap=${M(this,st)}
|
|
201
202
|
.draw=${this.draw}
|
|
202
203
|
.drawLayer=${this.drawLayer}
|
|
203
204
|
.drawnFeatures=${this.drawnFeatures}
|
|
204
205
|
.modify=${this.modify}
|
|
205
206
|
.unstyled=${this.unstyled}
|
|
206
207
|
@changed=${()=>{this.updateGeoJSON(),this.requestUpdate()}}
|
|
207
|
-
></eox-drawtools-list>`:
|
|
208
|
-
`}}
|
|
208
|
+
></eox-drawtools-list>`:C}
|
|
209
|
+
`}}rt=new WeakMap,st=new WeakMap,Pt=new WeakMap,ot=new WeakMap,customElements.define("eox-drawtools",Ni),v.EOxDrawTools=Ni,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eox/drawtools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"devDependencies": {
|
|
6
|
-
"ol": "^10.0.0",
|
|
7
6
|
"vite": "^5.0.2"
|
|
8
7
|
},
|
|
9
8
|
"engines": {
|
|
@@ -11,16 +10,30 @@
|
|
|
11
10
|
"node": ">=18.0.0"
|
|
12
11
|
},
|
|
13
12
|
"files": [
|
|
13
|
+
"types",
|
|
14
14
|
"dist",
|
|
15
15
|
"src"
|
|
16
16
|
],
|
|
17
17
|
"main": "./src/main.js",
|
|
18
|
+
"types": "./types/drawtools/src/main.d.ts",
|
|
19
|
+
"typesVersions": {
|
|
20
|
+
"*": {
|
|
21
|
+
".": [
|
|
22
|
+
"./types/drawtools/src/main.d.ts"
|
|
23
|
+
],
|
|
24
|
+
"src/*": [
|
|
25
|
+
"./types/drawtools/src/*"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
18
29
|
"scripts": {
|
|
30
|
+
"prepack": "tsc -p tsconfig.build.json || true",
|
|
19
31
|
"build": "vite build",
|
|
20
32
|
"watch": "vite build --watch"
|
|
21
33
|
},
|
|
22
34
|
"dependencies": {
|
|
23
|
-
"@eox/elements-utils": "^0.
|
|
24
|
-
"lit": "^3.2.0"
|
|
35
|
+
"@eox/elements-utils": "^0.1.1",
|
|
36
|
+
"lit": "^3.2.0",
|
|
37
|
+
"ol": "^10.0.0"
|
|
25
38
|
}
|
|
26
39
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import GeoJson from "ol/format/GeoJSON";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Converts features to a GeoJSON representation.
|
|
5
|
+
*
|
|
6
|
+
* @param {import("ol").Feature[]} features
|
|
7
|
+
* @param {(Parameters<GeoJson["writeFeaturesObject"]>)["1"]} [options]
|
|
8
|
+
*/
|
|
9
|
+
const featuresToGeoJson = (features, options) => {
|
|
10
|
+
const format = new GeoJson();
|
|
11
|
+
return format.writeFeaturesObject(features, options);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default featuresToGeoJson;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import WKT from "ol/format/WKT.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Converts features to a Well-Known Text (WKT) representation.
|
|
5
|
+
*
|
|
6
|
+
* @type {WKT["writeFeatures"]}
|
|
7
|
+
*/
|
|
8
|
+
const featureToWKT = (features, options) => {
|
|
9
|
+
const format = new WKT();
|
|
10
|
+
return format.writeFeatures(features, options);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default featureToWKT;
|
package/src/helpers/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
// Import and export helper functions
|
|
2
2
|
|
|
3
3
|
export { default as copyTextToClipboard } from "./copy-text-to-clipboard"; // Copy a given text string to the clipboard
|
|
4
|
+
export { default as featuresToGeoJson } from "./features-to-geojson"; // Convert a feature to a GeoJSON representation
|
|
5
|
+
export { default as featuresToWKT } from "./features-to-wkt"; // Convert a feature to a Well-Known Text (WKT) representation
|