@eox/drawtools 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,43 +1,43 @@
1
- (function(c,l){typeof exports=="object"&&typeof module<"u"?l(exports):typeof define=="function"&&define.amd?define(["exports"],l):(c=typeof globalThis<"u"?globalThis:c||self,l(c["eox-drawtools"]={}))})(this,function(c){"use strict";var fe=Object.defineProperty;var At=c=>{throw TypeError(c)};var me=(c,l,y)=>l in c?fe(c,l,{enumerable:!0,configurable:!0,writable:!0,value:y}):c[l]=y;var S=(c,l,y)=>me(c,typeof l!="symbol"?l+"":l,y),St=(c,l,y)=>l.has(c)||At("Cannot "+y);var E=(c,l,y)=>(St(c,l,"read from private field"),y?y.call(c):l.get(c)),O=(c,l,y)=>l.has(c)?At("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(c):l.set(c,y),C=(c,l,y,P)=>(St(c,l,"write to private field"),P?P.call(c,y):l.set(c,y),y);/**
1
+ (function(c,l){typeof exports=="object"&&typeof module<"u"?l(exports):typeof define=="function"&&define.amd?define(["exports"],l):(c=typeof globalThis<"u"?globalThis:c||self,l(c["eox-drawtools"]={}))})(this,function(c){"use strict";var we=Object.defineProperty;var Et=c=>{throw TypeError(c)};var _e=(c,l,y)=>l in c?we(c,l,{enumerable:!0,configurable:!0,writable:!0,value:y}):c[l]=y;var E=(c,l,y)=>_e(c,typeof l!="symbol"?l+"":l,y),Ht=(c,l,y)=>l.has(c)||Et("Cannot "+y);var m=(c,l,y)=>(Ht(c,l,"read from private field"),y?y.call(c):l.get(c)),H=(c,l,y)=>l.has(c)?Et("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(c):l.set(c,y),w=(c,l,y,O)=>(Ht(c,l,"write to private field"),O?O.call(c,y):l.set(c,y),y);/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */var _t,D,j,k,U,J;const l=globalThis,y=l.ShadowRoot&&(l.ShadyCSS===void 0||l.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,P=Symbol(),tt=new WeakMap;let Et=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==P)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(y&&t===void 0){const i=e!==void 0&&e.length===1;i&&(t=tt.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&tt.set(e,t))}return t}toString(){return this.cssText}};const Ct=r=>new Et(typeof r=="string"?r:r+"",void 0,P),Mt=(r,t)=>{if(y)r.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const i=document.createElement("style"),s=l.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=e.cssText,r.appendChild(i)}},et=y?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return Ct(e)})(r):r;/**
5
+ */var Ct,J,q,I,L,D,U;const l=globalThis,y=l.ShadowRoot&&(l.ShadyCSS===void 0||l.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,O=Symbol(),it=new WeakMap;let kt=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==O)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(y&&t===void 0){const r=e!==void 0&&e.length===1;r&&(t=it.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&it.set(e,t))}return t}toString(){return this.cssText}};const Mt=i=>new kt(typeof i=="string"?i:i+"",void 0,O),Ft=(i,t)=>{if(y)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const r=document.createElement("style"),s=l.litNonce;s!==void 0&&r.setAttribute("nonce",s),r.textContent=e.cssText,i.appendChild(r)}},rt=y?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return Mt(e)})(i):i;/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:Ft,defineProperty:Ht,getOwnPropertyDescriptor:kt,getOwnPropertyNames:Ut,getOwnPropertySymbols:Ot,getPrototypeOf:Pt}=Object,m=globalThis,it=m.trustedTypes,It=it?it.emptyScript:"",W=m.reactiveElementPolyfillSupport,I=(r,t)=>r,Z={toAttribute(r,t){switch(t){case Boolean:r=r?It:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},rt=(r,t)=>!Ft(r,t),st={attribute:!0,type:String,converter:Z,reflect:!1,hasChanged:rt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),m.litPropertyMetadata??(m.litPropertyMetadata=new WeakMap);class M 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=st){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);s!==void 0&&Ht(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:n}=kt(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get(){return s==null?void 0:s.call(this)},set(o){const h=s==null?void 0:s.call(this);n.call(this,o),this.requestUpdate(t,h,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??st}static _$Ei(){if(this.hasOwnProperty(I("elementProperties")))return;const t=Pt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(I("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(I("properties"))){const e=this.properties,i=[...Ut(e),...Ot(e)];for(const s of i)this.createProperty(s,e[s])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[i,s]of e)this.elementProperties.set(i,s)}this._$Eh=new Map;for(const[e,i]of this.elementProperties){const s=this._$Eu(e,i);s!==void 0&&this._$Eh.set(s,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 s of i)e.unshift(et(s))}else t!==void 0&&e.push(et(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 Mt(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 n;const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(s!==void 0&&i.reflect===!0){const o=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:Z).toAttribute(e,i.type);this._$Em=t,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,e){var n;const i=this.constructor,s=i._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const o=i.getPropertyOptions(s),h=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:Z;this._$Em=s,this[s]=h.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,i){if(t!==void 0){if(i??(i=this.constructor.getPropertyOptions(t)),!(i.hasChanged??rt)(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[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[n,o]of s)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.P(n,this[n],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(i=this._$EO)==null||i.forEach(s=>{var n;return(n=s.hostUpdate)==null?void 0:n.call(s)}),this.update(e)):this._$EU()}catch(s){throw t=!1,this._$EU(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(i=>{var s;return(s=i.hostUpdated)==null?void 0:s.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){}}M.elementStyles=[],M.shadowRootOptions={mode:"open"},M[I("elementProperties")]=new Map,M[I("finalized")]=new Map,W==null||W({ReactiveElement:M}),(m.reactiveElementVersions??(m.reactiveElementVersions=[])).push("2.0.4");/**
9
+ */const{is:It,defineProperty:Lt,getOwnPropertyDescriptor:Ut,getOwnPropertyNames:Ot,getOwnPropertySymbols:Pt,getPrototypeOf:Nt}=Object,v=globalThis,st=v.trustedTypes,Vt=st?st.emptyScript:"",K=v.reactiveElementPolyfillSupport,P=(i,t)=>i,Q={toAttribute(i,t){switch(t){case Boolean:i=i?Vt:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},nt=(i,t)=>!It(i,t),ot={attribute:!0,type:String,converter:Q,reflect:!1,hasChanged:nt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),v.litPropertyMetadata??(v.litPropertyMetadata=new WeakMap);class k 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=ot){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const r=Symbol(),s=this.getPropertyDescriptor(t,r,e);s!==void 0&&Lt(this.prototype,t,s)}}static getPropertyDescriptor(t,e,r){const{get:s,set:n}=Ut(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get(){return s==null?void 0:s.call(this)},set(o){const d=s==null?void 0:s.call(this);n.call(this,o),this.requestUpdate(t,d,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??ot}static _$Ei(){if(this.hasOwnProperty(P("elementProperties")))return;const t=Nt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(P("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(P("properties"))){const e=this.properties,r=[...Ot(e),...Pt(e)];for(const s of r)this.createProperty(s,e[s])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[r,s]of e)this.elementProperties.set(r,s)}this._$Eh=new Map;for(const[e,r]of this.elementProperties){const s=this._$Eu(e,r);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const r=new Set(t.flat(1/0).reverse());for(const s of r)e.unshift(rt(s))}else t!==void 0&&e.push(rt(t));return e}static _$Eu(t,e){const r=e.attribute;return r===!1?void 0:typeof r=="string"?r: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 r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ft(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 r;return(r=e.hostConnected)==null?void 0:r.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var r;return(r=e.hostDisconnected)==null?void 0:r.call(e)})}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(t,e){var n;const r=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,r);if(s!==void 0&&r.reflect===!0){const o=(((n=r.converter)==null?void 0:n.toAttribute)!==void 0?r.converter:Q).toAttribute(e,r.type);this._$Em=t,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,e){var n;const r=this.constructor,s=r._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const o=r.getPropertyOptions(s),d=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:Q;this._$Em=s,this[s]=d.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){if(r??(r=this.constructor.getPropertyOptions(t)),!(r.hasChanged??nt)(this[t],e))return;this.P(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,r){this._$AL.has(t)||this._$AL.set(t,e),r.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 r;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[n,o]of s)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.P(n,this[n],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(r=this._$EO)==null||r.forEach(s=>{var n;return(n=s.hostUpdate)==null?void 0:n.call(s)}),this.update(e)):this._$EU()}catch(s){throw t=!1,this._$EU(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(r=>{var s;return(s=r.hostUpdated)==null?void 0:s.call(r)}),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){}}k.elementStyles=[],k.shadowRootOptions={mode:"open"},k[P("elementProperties")]=new Map,k[P("finalized")]=new Map,K==null||K({ReactiveElement:k}),(v.reactiveElementVersions??(v.reactiveElementVersions=[])).push("2.0.4");/**
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */const N=globalThis,T=N.trustedTypes,nt=T?T.createPolicy("lit-html",{createHTML:r=>r}):void 0,ot="$lit$",b=`lit$${Math.random().toFixed(9).slice(2)}$`,at="?"+b,Nt=`<${at}>`,v=document,B=()=>v.createComment(""),V=r=>r===null||typeof r!="object"&&typeof r!="function",K=Array.isArray,Bt=r=>K(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",Q=`[
14
- \f\r]`,L=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,lt=/-->/g,ct=/>/g,w=RegExp(`>|${Q}(?:([^\\s"'>=/]+)(${Q}*=${Q}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),ht=/'/g,dt=/"/g,pt=/^(?:script|style|textarea|title)$/i,Vt=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),x=Vt(1),F=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),ut=new WeakMap,_=v.createTreeWalker(v,129);function yt(r,t){if(!K(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return nt!==void 0?nt.createHTML(t):t}const Lt=(r,t)=>{const e=r.length-1,i=[];let s,n=t===2?"<svg>":t===3?"<math>":"",o=L;for(let h=0;h<e;h++){const a=r[h];let u,g,d=-1,f=0;for(;f<a.length&&(o.lastIndex=f,g=o.exec(a),g!==null);)f=o.lastIndex,o===L?g[1]==="!--"?o=lt:g[1]!==void 0?o=ct:g[2]!==void 0?(pt.test(g[2])&&(s=RegExp("</"+g[2],"g")),o=w):g[3]!==void 0&&(o=w):o===w?g[0]===">"?(o=s??L,d=-1):g[1]===void 0?d=-2:(d=o.lastIndex-g[2].length,u=g[1],o=g[3]===void 0?w:g[3]==='"'?dt:ht):o===dt||o===ht?o=w:o===lt||o===ct?o=L:(o=w,s=void 0);const $=o===w&&r[h+1].startsWith("/>")?" ":"";n+=o===L?a+Nt:d>=0?(i.push(u),a.slice(0,d)+ot+a.slice(d)+b+$):a+b+(d===-2?h:$)}return[yt(r,n+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]};class R{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let n=0,o=0;const h=t.length-1,a=this.parts,[u,g]=Lt(t,e);if(this.el=R.createElement(u,i),_.currentNode=this.el.content,e===2||e===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(s=_.nextNode())!==null&&a.length<h;){if(s.nodeType===1){if(s.hasAttributes())for(const d of s.getAttributeNames())if(d.endsWith(ot)){const f=g[o++],$=s.getAttribute(d).split(b),G=/([.?@])?(.*)/.exec(f);a.push({type:1,index:n,name:G[2],strings:$,ctor:G[1]==="."?zt:G[1]==="?"?Dt:G[1]==="@"?jt:q}),s.removeAttribute(d)}else d.startsWith(b)&&(a.push({type:6,index:n}),s.removeAttribute(d));if(pt.test(s.tagName)){const d=s.textContent.split(b),f=d.length-1;if(f>0){s.textContent=T?T.emptyScript:"";for(let $=0;$<f;$++)s.append(d[$],B()),_.nextNode(),a.push({type:2,index:++n});s.append(d[f],B())}}}else if(s.nodeType===8)if(s.data===at)a.push({type:2,index:n});else{let d=-1;for(;(d=s.data.indexOf(b,d+1))!==-1;)a.push({type:7,index:n}),d+=b.length-1}n++}}static createElement(t,e){const i=v.createElement("template");return i.innerHTML=t,i}}function H(r,t,e=r,i){var o,h;if(t===F)return t;let s=i!==void 0?(o=e._$Co)==null?void 0:o[i]:e._$Cl;const n=V(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==n&&((h=s==null?void 0:s._$AO)==null||h.call(s,!1),n===void 0?s=void 0:(s=new n(r),s._$AT(r,e,i)),i!==void 0?(e._$Co??(e._$Co=[]))[i]=s:e._$Cl=s),s!==void 0&&(t=H(r,s._$AS(r,t.values),s,i)),t}class Rt{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,s=((t==null?void 0:t.creationScope)??v).importNode(e,!0);_.currentNode=s;let n=_.nextNode(),o=0,h=0,a=i[0];for(;a!==void 0;){if(o===a.index){let u;a.type===2?u=new z(n,n.nextSibling,this,t):a.type===1?u=new a.ctor(n,a.name,a.strings,this,t):a.type===6&&(u=new Jt(n,this,t)),this._$AV.push(u),a=i[++h]}o!==(a==null?void 0:a.index)&&(n=_.nextNode(),o++)}return _.currentNode=v,s}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 z{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,i,s){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cv=(s==null?void 0:s.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=H(this,t,e),V(t)?t===p||t==null||t===""?(this._$AH!==p&&this._$AR(),this._$AH=p):t!==this._$AH&&t!==F&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Bt(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!==p&&V(this._$AH)?this._$AA.nextSibling.data=t:this.T(v.createTextNode(t)),this._$AH=t}$(t){var n;const{values:e,_$litType$:i}=t,s=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=R.createElement(yt(i.h,i.h[0]),this.options)),i);if(((n=this._$AH)==null?void 0:n._$AD)===s)this._$AH.p(e);else{const o=new Rt(s,this),h=o.u(this.options);o.p(e),this.T(h),this._$AH=o}}_$AC(t){let e=ut.get(t.strings);return e===void 0&&ut.set(t.strings,e=new R(t)),e}k(t){K(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const n of t)s===e.length?e.push(i=new z(this.O(B()),this.O(B()),this,this.options)):i=e[s],i._$AI(n),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$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 s=t.nextSibling;t.remove(),t=s}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}}class q{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,s,n){this.type=1,this._$AH=p,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=p}_$AI(t,e=this,i,s){const n=this.strings;let o=!1;if(n===void 0)t=H(this,t,e,0),o=!V(t)||t!==this._$AH&&t!==F,o&&(this._$AH=t);else{const h=t;let a,u;for(t=n[0],a=0;a<n.length-1;a++)u=H(this,h[i+a],e,a),u===F&&(u=this._$AH[a]),o||(o=!V(u)||u!==this._$AH[a]),u===p?t=p:t!==p&&(t+=(u??"")+n[a+1]),this._$AH[a]=u}o&&!s&&this.j(t)}j(t){t===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class zt extends q{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===p?void 0:t}}class Dt extends q{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==p)}}class jt extends q{constructor(t,e,i,s,n){super(t,e,i,s,n),this.type=5}_$AI(t,e=this){if((t=H(this,t,e,0)??p)===F)return;const i=this._$AH,s=t===p&&i!==p||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,n=t!==p&&(i===p||s);s&&this.element.removeEventListener(this.name,this,i),n&&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 Jt{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){H(this,t)}}const X=N.litHtmlPolyfillSupport;X==null||X(R,z),(N.litHtmlVersions??(N.litHtmlVersions=[])).push("3.2.1");const Tt=(r,t,e)=>{const i=(e==null?void 0:e.renderBefore)??t;let s=i._$litPart$;if(s===void 0){const n=(e==null?void 0:e.renderBefore)??null;i._$litPart$=s=new z(t.insertBefore(B(),n),n,void 0,e??{})}return s._$AI(r),s};/**
13
+ */const N=globalThis,G=N.trustedTypes,at=G?G.createPolicy("lit-html",{createHTML:i=>i}):void 0,lt="$lit$",b=`lit$${Math.random().toFixed(9).slice(2)}$`,ct="?"+b,Bt=`<${ct}>`,_=document,V=()=>_.createComment(""),B=i=>i===null||typeof i!="object"&&typeof i!="function",T=Array.isArray,Rt=i=>T(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",X=`[
14
+ \f\r]`,R=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,dt=/-->/g,ht=/>/g,x=RegExp(`>|${X}(?:([^\\s"'>=/]+)(${X}*=${X}*(?:[^
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),pt=/'/g,ut=/"/g,yt=/^(?:script|style|textarea|title)$/i,zt=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),A=zt(1),M=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),ft=new WeakMap,S=_.createTreeWalker(_,129);function gt(i,t){if(!T(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return at!==void 0?at.createHTML(t):t}const jt=(i,t)=>{const e=i.length-1,r=[];let s,n=t===2?"<svg>":t===3?"<math>":"",o=R;for(let d=0;d<e;d++){const a=i[d];let u,f,h=-1,g=0;for(;g<a.length&&(o.lastIndex=g,f=o.exec(a),f!==null);)g=o.lastIndex,o===R?f[1]==="!--"?o=dt:f[1]!==void 0?o=ht:f[2]!==void 0?(yt.test(f[2])&&(s=RegExp("</"+f[2],"g")),o=x):f[3]!==void 0&&(o=x):o===x?f[0]===">"?(o=s??R,h=-1):f[1]===void 0?h=-2:(h=o.lastIndex-f[2].length,u=f[1],o=f[3]===void 0?x:f[3]==='"'?ut:pt):o===ut||o===pt?o=x:o===dt||o===ht?o=R:(o=x,s=void 0);const $=o===x&&i[d+1].startsWith("/>")?" ":"";n+=o===R?a+Bt:h>=0?(r.push(u),a.slice(0,h)+lt+a.slice(h)+b+$):a+b+(h===-2?d:$)}return[gt(i,n+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]};class z{constructor({strings:t,_$litType$:e},r){let s;this.parts=[];let n=0,o=0;const d=t.length-1,a=this.parts,[u,f]=jt(t,e);if(this.el=z.createElement(u,r),S.currentNode=this.el.content,e===2||e===3){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(s=S.nextNode())!==null&&a.length<d;){if(s.nodeType===1){if(s.hasAttributes())for(const h of s.getAttributeNames())if(h.endsWith(lt)){const g=f[o++],$=s.getAttribute(h).split(b),Z=/([.?@])?(.*)/.exec(g);a.push({type:1,index:n,name:Z[2],strings:$,ctor:Z[1]==="."?qt:Z[1]==="?"?Dt:Z[1]==="@"?Gt:W}),s.removeAttribute(h)}else h.startsWith(b)&&(a.push({type:6,index:n}),s.removeAttribute(h));if(yt.test(s.tagName)){const h=s.textContent.split(b),g=h.length-1;if(g>0){s.textContent=G?G.emptyScript:"";for(let $=0;$<g;$++)s.append(h[$],V()),S.nextNode(),a.push({type:2,index:++n});s.append(h[g],V())}}}else if(s.nodeType===8)if(s.data===ct)a.push({type:2,index:n});else{let h=-1;for(;(h=s.data.indexOf(b,h+1))!==-1;)a.push({type:7,index:n}),h+=b.length-1}n++}}static createElement(t,e){const r=_.createElement("template");return r.innerHTML=t,r}}function F(i,t,e=i,r){var o,d;if(t===M)return t;let s=r!==void 0?(o=e._$Co)==null?void 0:o[r]:e._$Cl;const n=B(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==n&&((d=s==null?void 0:s._$AO)==null||d.call(s,!1),n===void 0?s=void 0:(s=new n(i),s._$AT(i,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=s:e._$Cl=s),s!==void 0&&(t=F(i,s._$AS(i,t.values),s,r)),t}class Jt{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:r}=this._$AD,s=((t==null?void 0:t.creationScope)??_).importNode(e,!0);S.currentNode=s;let n=S.nextNode(),o=0,d=0,a=r[0];for(;a!==void 0;){if(o===a.index){let u;a.type===2?u=new j(n,n.nextSibling,this,t):a.type===1?u=new a.ctor(n,a.name,a.strings,this,t):a.type===6&&(u=new Wt(n,this,t)),this._$AV.push(u),a=r[++d]}o!==(a==null?void 0:a.index)&&(n=S.nextNode(),o++)}return S.currentNode=_,s}p(t){let e=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}}class j{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,r,s){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=s,this._$Cv=(s==null?void 0:s.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=F(this,t,e),B(t)?t===p||t==null||t===""?(this._$AH!==p&&this._$AR(),this._$AH=p):t!==this._$AH&&t!==M&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Rt(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!==p&&B(this._$AH)?this._$AA.nextSibling.data=t:this.T(_.createTextNode(t)),this._$AH=t}$(t){var n;const{values:e,_$litType$:r}=t,s=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=z.createElement(gt(r.h,r.h[0]),this.options)),r);if(((n=this._$AH)==null?void 0:n._$AD)===s)this._$AH.p(e);else{const o=new Jt(s,this),d=o.u(this.options);o.p(e),this.T(d),this._$AH=o}}_$AC(t){let e=ft.get(t.strings);return e===void 0&&ft.set(t.strings,e=new z(t)),e}k(t){T(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,s=0;for(const n of t)s===e.length?e.push(r=new j(this.O(V()),this.O(V()),this,this.options)):r=e[s],r._$AI(n),s++;s<e.length&&(this._$AR(r&&r._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,e);t&&t!==this._$AB;){const s=t.nextSibling;t.remove(),t=s}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}}class W{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,s,n){this.type=1,this._$AH=p,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=p}_$AI(t,e=this,r,s){const n=this.strings;let o=!1;if(n===void 0)t=F(this,t,e,0),o=!B(t)||t!==this._$AH&&t!==M,o&&(this._$AH=t);else{const d=t;let a,u;for(t=n[0],a=0;a<n.length-1;a++)u=F(this,d[r+a],e,a),u===M&&(u=this._$AH[a]),o||(o=!B(u)||u!==this._$AH[a]),u===p?t=p:t!==p&&(t+=(u??"")+n[a+1]),this._$AH[a]=u}o&&!s&&this.j(t)}j(t){t===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class qt extends W{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===p?void 0:t}}class Dt extends W{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==p)}}class Gt extends W{constructor(t,e,r,s,n){super(t,e,r,s,n),this.type=5}_$AI(t,e=this){if((t=F(this,t,e,0)??p)===M)return;const r=this._$AH,s=t===p&&r!==p||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==p&&(r===p||s);s&&this.element.removeEventListener(this.name,this,r),n&&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 Wt{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){F(this,t)}}const Y=N.litHtmlPolyfillSupport;Y==null||Y(z,j),(N.litHtmlVersions??(N.litHtmlVersions=[])).push("3.2.1");const Zt=(i,t,e)=>{const r=(e==null?void 0:e.renderBefore)??t;let s=r._$litPart$;if(s===void 0){const n=(e==null?void 0:e.renderBefore)??null;r._$litPart$=s=new j(t.insertBefore(V(),n),n,void 0,e??{})}return s._$AI(i),s};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
- */class A extends M{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=Tt(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 F}}A._$litElement$=!0,A.finalized=!0,(_t=globalThis.litElementHydrateSupport)==null||_t.call(globalThis,{LitElement:A});const Y=globalThis.litElementPolyfillSupport;Y==null||Y({LitElement:A}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");/**
19
+ */class C extends k{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=Zt(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 M}}C._$litElement$=!0,C.finalized=!0,(Ct=globalThis.litElementHydrateSupport)==null||Ct.call(globalThis,{LitElement:C});const tt=globalThis.litElementPolyfillSupport;tt==null||tt({LitElement:C}),(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 qt=r=>(...t)=>({_$litDirective$:r,values:t});let Gt=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)}};/**
23
+ */const Kt=i=>(...t)=>({_$litDirective$:i,values:t});let Qt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$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 Wt={},Zt=(r,t=Wt)=>r._$AH=t;/**
27
+ */const Tt={},Xt=(i,t=Tt)=>i._$AH=t;/**
28
28
  * @license
29
29
  * Copyright 2021 Google LLC
30
30
  * SPDX-License-Identifier: BSD-3-Clause
31
- */const Kt=qt(class extends Gt{constructor(){super(...arguments),this.key=p}render(r,t){return this.key=r,t}update(r,[t,e]){return t!==this.key&&(Zt(r),this.key=t),e}}),Qt=r=>{r.hoverInteraction=r.eoxMap.selectInteractions.selectHover,r.clickInteraction=r.eoxMap.selectInteractions.selectClick;const t=()=>{r.requestUpdate()};r.hoverInteraction.selectStyleLayer.on("change",t),r.clickInteraction.selectStyleLayer.on("change",t)},Xt=(r,t,e)=>{if(r.clickId===t)return;const i=e?[]:[t];r.hoverInteraction.highlightById(i)},Yt=(r,t)=>{r.stopPropagation();const e=Number(r.target.getAttribute("index")),i=t.drawnFeatures[e];t.drawLayer.getSource().removeFeature(i),t.drawnFeatures.splice(e,1),t.requestUpdate()},gt={duration:750},ft={type:"FeatureCollection",features:[]},te=(r,t)=>{const e=r.get("id"),{clickId:i,drawLayer:s,olMap:n,clickInteraction:o}=t,h=i===e,a=r.getGeometry();if(h){const u=s.getSource().getExtent();n.getView().fit(u,gt),o.highlightById([])}else{const u=a.getExtent();o.highlightById([e]),n.getView().fit(u,gt)}t.requestUpdate()},ee="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 mt extends A{constructor(){super();S(this,"hoverInteraction");S(this,"clickInteraction");S(this,"hoverId");S(this,"clickId");this.eoxMap=null,this.olMap=null,this.draw=null,this.drawLayer=null,this.drawnFeatures=[],this.modify=null,this.unstyled=!1}_handleDelete(e){Yt(e,this),this.dispatchEvent(new CustomEvent("changed",{bubbles:!0}))}_handleFeatureSelectAndDeselect(e){te(e,this)}_handleHoverFeature(e,i=!1){Xt(this,e,i)}firstUpdated(){Qt(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],x`
31
+ */const Yt=Kt(class extends Qt{constructor(){super(...arguments),this.key=p}render(i,t){return this.key=i,t}update(i,[t,e]){return t!==this.key&&(Xt(i),this.key=t),e}}),te=i=>{i.hoverInteraction=i.eoxMap.selectInteractions.selectHover,i.clickInteraction=i.eoxMap.selectInteractions.selectClick;const t=()=>{i.requestUpdate()};i.hoverInteraction.selectStyleLayer.on("change",t),i.clickInteraction.selectStyleLayer.on("change",t)},ee=(i,t,e)=>{if(i.clickId===t)return;const r=e?[]:[t];i.hoverInteraction.highlightById(r)},ie=(i,t)=>{i.stopPropagation();const e=Number(i.target.getAttribute("index")),r=t.drawnFeatures[e];t.drawLayer.getSource().removeFeature(r),t.drawnFeatures.splice(e,1),t.requestUpdate()},mt={duration:750},vt={type:"FeatureCollection",features:[]},re=(i,t)=>{const e=i.getId(),{clickId:r,drawLayer:s,olMap:n,clickInteraction:o}=t,d=r===e,a=i.getGeometry();if(d){const u=s.getSource().getExtent();n.getView().fit(u,mt),o.highlightById([])}else{const u=a.getExtent();o.highlightById([e]),n.getView().fit(u,mt)}t.requestUpdate()},se="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 bt extends C{constructor(){super();E(this,"hoverInteraction");E(this,"clickInteraction");E(this,"hoverId");E(this,"clickId");this.eoxMap=null,this.olMap=null,this.draw=null,this.drawLayer=null,this.drawnFeatures=[],this.modify=null,this.unstyled=!1}_handleDelete(e){ie(e,this),this.dispatchEvent(new CustomEvent("changed",{bubbles:!0}))}_handleFeatureSelectAndDeselect(e){re(e,this)}_handleHoverFeature(e,r=!1){ee(this,e,r)}firstUpdated(){te(this)}createRenderRoot(){return this}render(){var e,r;return this.hoverId=(e=this.hoverInteraction)==null?void 0:e.selectedFids[0],this.clickId=(r=this.clickInteraction)==null?void 0:r.selectedFids[0],A`
32
32
  <style>
33
- ${!this.unstyled&&ee}
33
+ ${!this.unstyled&&se}
34
34
  </style>
35
35
  <ul class="list-wrap">
36
- ${this.drawnFeatures.map((s,n)=>{const o=n+1,h=s.get("id"),a=this.hoverId===h,u=this.clickId===h;return Kt(o,x`
36
+ ${this.drawnFeatures.map((s,n)=>{const o=n+1,d=s.getId(),a=this.hoverId===d,u=this.clickId===d;return Yt(o,A`
37
37
  <li
38
38
  class="${a||u?"selected":p}"
39
- @mouseover=${()=>this._handleHoverFeature(h)}
40
- @mouseout=${()=>this._handleHoverFeature(h,!0)}
39
+ @mouseover=${()=>this._handleHoverFeature(d)}
40
+ @mouseout=${()=>this._handleHoverFeature(d,!0)}
41
41
  >
42
42
  <div
43
43
  class="list"
@@ -55,14 +55,14 @@
55
55
  </li>
56
56
  `)})}
57
57
  </ul>
58
- `}}S(mt,"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",mt);const ie=r=>{const{multipleFeatures:t,drawnFeatures:e,currentlyDrawing:i}=r,s=!t&&(e==null?void 0:e.length)>0||i,n=!(e!=null&&e.length)&&!i;return{drawDisabled:s,discardDisabled:n}},re='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;}',se='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 ne(r){navigator.clipboard.writeText(r).then(function(){},function(t){console.error("Could not copy text: ",t)})}/**
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)})}/**
59
59
  * @license
60
60
  * Copyright 2021 Google LLC
61
61
  * SPDX-License-Identifier: BSD-3-Clause
62
- */function bt(r,t,e){return r?t(r):e==null?void 0:e(r)}class $t extends A{constructor(){super();O(this,D,!0);O(this,j,!0);this.multipleFeatures=!1,this.drawnFeatures=[],this.importFeatures=!1,this.showEditor=!1,this.currentlyDrawing=!1,this.drawFunc=null,this.geoJSON="",this.unstyled=!1}updateButtonStates(){const{drawDisabled:e,discardDisabled:i}=ie(this);C(this,D,e),C(this,j,i)}createRenderRoot(){return this}render(){this.updateButtonStates();const e=this.currentlyDrawing?"drawing":"draw";return x`
62
+ */function $t(i,t,e){return i?t(i):e==null?void 0:e(i)}class wt extends C{constructor(){super();H(this,J,!0);H(this,q,!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:r}=ne(this);w(this,J,e),w(this,q,r)}createRenderRoot(){return this}render(){this.updateButtonStates();const e=this.currentlyDrawing?"drawing":"draw";return A`
63
63
  <style>
64
- ${!this.unstyled&&re}
65
- ${!this.unstyled&&se}
64
+ ${!this.unstyled&&oe}
65
+ ${!this.unstyled&&ae}
66
66
  </style>
67
67
  <div class="wrap-btn">
68
68
  <slot></slot>
@@ -70,8 +70,8 @@
70
70
  <!-- Draw Button -->
71
71
  <button
72
72
  data-cy="drawBtn"
73
- class="polygon icon"
74
- ?disabled="${E(this,D)||p}"
73
+ class="${this.select?"pointer":"polygon"} icon"
74
+ ?disabled="${m(this,J)||p}"
75
75
  @click="${()=>this.drawFunc.start()}"
76
76
  >
77
77
  ${e}
@@ -81,7 +81,7 @@
81
81
  <button
82
82
  data-cy="discardBtn"
83
83
  class="discard icon"
84
- ?disabled="${E(this,j)||p}"
84
+ ?disabled="${m(this,q)||p}"
85
85
  @click="${()=>this.drawFunc.discard()}"
86
86
  >
87
87
  discard
@@ -89,7 +89,7 @@
89
89
  </div>
90
90
 
91
91
  <!-- Import Button -->
92
- ${bt(this.importFeatures,()=>x`
92
+ ${$t(this.importFeatures,()=>A`
93
93
  <!-- Import Input Field : Hidden -->
94
94
  <input
95
95
  type="file"
@@ -110,7 +110,7 @@
110
110
  </div>
111
111
 
112
112
  <!-- Geo JSON Wrapper -->
113
- ${bt(this.showEditor,()=>x`
113
+ ${$t(this.showEditor,()=>A`
114
114
  <div class="json-wrapper">
115
115
  <!-- Geo JSON Editor -->
116
116
  <textarea
@@ -123,16 +123,19 @@
123
123
  <button
124
124
  data-cy="copyBtn"
125
125
  class="icon-copy"
126
- @click=${()=>ne(this.geoJSON)}
126
+ @click=${()=>le(this.geoJSON)}
127
127
  >
128
128
  ${this.unstyled?"copy":p}
129
129
  </button>
130
130
  </div>
131
131
  `)}
132
- `}}D=new WeakMap,j=new WeakMap,S($t,"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},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",$t);const oe=`
132
+ `}}J=new WeakMap,q=new WeakMap,E(wt,"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",wt);const ce=`
133
133
  button.discard:before {
134
134
  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
135
  }
136
+ button.pointer:before {
137
+ content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23004170' viewBox='0 0 24 24'%3E%3Ctitle%3Ecursor-default-click%3C/title%3E%3Cpath d='M10.76,8.69A0.76,0.76 0 0,0 10,9.45V20.9C10,21.32 10.34,21.66 10.76,21.66C10.95,21.66 11.11,21.6 11.24,21.5L13.15,19.95L14.81,23.57C14.94,23.84 15.21,24 15.5,24C15.61,24 15.72,24 15.83,23.92L18.59,22.64C18.97,22.46 19.15,22 18.95,21.63L17.28,18L19.69,17.55C19.85,17.5 20,17.43 20.12,17.29C20.39,16.97 20.35,16.5 20,16.21L11.26,8.86L11.25,8.87C11.12,8.76 10.95,8.69 10.76,8.69M15,10V8H20V10H15M13.83,4.76L16.66,1.93L18.07,3.34L15.24,6.17L13.83,4.76M10,0H12V5H10V0M3.93,14.66L6.76,11.83L8.17,13.24L5.34,16.07L3.93,14.66M3.93,3.34L5.34,1.93L8.17,4.76L6.76,6.17L3.93,3.34M7,10H2V8H7V10' /%3E%3C/svg%3E");
138
+ }
136
139
  button.polygon:before {
137
140
  content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23004170' viewBox='0 0 24 24'%3E%3Ctitle%3Eshape-polygon-plus%3C/title%3E%3Cpath d='M17,15.7V13H19V17L10,21L3,14L7,5H11V7H8.3L5.4,13.6L10.4,18.6L17,15.7M22,5V7H19V10H17V7H14V5H17V2H19V5H22Z' /%3E%3C/svg%3E");
138
141
  }
@@ -171,29 +174,30 @@
171
174
  color: white;
172
175
  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")
173
176
  }
174
- `,ae=r=>{(()=>{r.emitDrawnFeatures(),r.multipleFeatures||(r.draw.setActive(!1),r.currentlyDrawing=!1)})(),r.requestUpdate()},le=r=>{const t=()=>{r.drawLayer.set("isDrawingEnabled",!0),r.draw.setActive(!0)},e=()=>{r.currentlyDrawing=!0,r.requestUpdate()};t(),e()},ce=r=>{let t;return typeof r=="string"?t=document.querySelector(r):t=r,t},vt=(r,t)=>{var n;const i=ce(r.for),s=i.map;return r.drawLayer=i.addOrUpdateLayer({type:"Vector",properties:{id:"drawLayer",layerControlHide:!0,isDrawingEnabled:!1,multipleFeatures:t},source:{type:"Vector"},interactions:[{type:"draw",options:{active:!1,id:"drawInteraction",type:r.type,modify:r.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}}}]}),r.draw=i.interactions.drawInteraction,r.modify=i.interactions.drawInteractionmodify,(n=r.modify)==null||n.on("modifyend",()=>r.onModifyEnd()),i.addEventListener("addfeatures",()=>ae(r)),{EoxMap:i,OlMap:s}},he=r=>{const t=()=>{r.drawnFeatures=[],r.draw.setActive(!1),r.drawLayer.getSource().clear(),r.geoJSON=null},e=()=>{r.emitDrawnFeatures(),r.currentlyDrawing=!1,r.requestUpdate()};t(),e()},de=(r,t)=>{setTimeout(()=>{r.drawnFeatures=r.drawLayer.getSource().getFeatures(),r.updateGeoJSON(),r.requestUpdate(),t()},0)},pe=':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 ue(r,t){function e(n){n.preventDefault(),n.stopPropagation()}function i(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,i,!1):t.addEventListener(n,s,!1)}),t.addEventListener("drop",n=>wt(n,r),!1)}function ye(r){r.preventDefault(),r.stopPropagation()}function wt(r,t){ye(r);const e=r.dataTransfer?r.dataTransfer.files:r.target.files;Array.from(e).forEach(i=>ge(i,t))}function ge(r,t){const e=new FileReader;e.readAsText(r),e.onloadend=function(){typeof e.result=="string"&&t.handleFeatureChange(e.result)}}class xt extends A{constructor(){super();O(this,k);O(this,U);O(this,J);this.allowModify=!1,this.for="eox-map",this.currentlyDrawing=!1,this.draw=null,this.drawLayer=null,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}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},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}}}handleStartDrawing(){le(this)}handleDiscardDrawing(){he(this)}handleFeatureChange(e,i=!1){this.eoxMap.parseTextToFeature(e||JSON.stringify(ft),this.drawLayer,i)}handleFilesChange(e){wt(e,this)}onModifyEnd(){this.emitDrawnFeatures()}updateGeoJSON(){C(this,J,JSON.stringify(this.eoxMap.parseFeature(this.drawnFeatures)||ft,void 0,2))}emitDrawnFeatures(){de(this,()=>{this.dispatchEvent(new CustomEvent("drawupdate",{detail:this.drawnFeatures}))})}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}firstUpdated(){const{EoxMap:e,OlMap:i}=vt(this,this.multipleFeatures);this.eoxMap=e,C(this,U,i),this.importFeatures&&ue(this,this.eoxMap),this.updateGeoJSON(),this.requestUpdate()}updated(e){if(e.has("for")){const{EoxMap:i,OlMap:s}=vt(this,this.multipleFeatures);this.eoxMap=i,C(this,U,s)}}get eoxMap(){return E(this,k)}set eoxMap(e){const i=E(this,k);C(this,k,e),this.requestUpdate("eoxMap",i)}render(){var e;return x`
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({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=[],setTimeout(()=>{i.draw.setActive(!1),i.selectionEvents.removeSelectionEvent()},200),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,setTimeout(()=>{o.setActive(!1),t.selectInteractions.SelectLayerClickInteraction.setActive(!1),t.selectInteractions.SelectLayerHoverInteraction.setActive(!1)},200)},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`
175
178
  <style>
176
179
  :host { display: block; }
177
- ${!this.unstyled&&pe}
178
- ${!this.unstyled&&oe}
180
+ ${!this.unstyled&&me}
181
+ ${!this.unstyled&&ce}
179
182
  </style>
180
183
 
181
184
  <!-- Controller Component -->
182
185
  <eox-drawtools-controller
183
- .drawFunc=${{start:()=>this.handleStartDrawing(),discard:()=>this.handleDiscardDrawing(),editor:i=>this.handleFeatureChange(i.target.value,!0),import:i=>this.handleFilesChange(i)}}
186
+ .drawFunc=${{start:()=>this.startDrawing(),discard:()=>this.discardDrawing(),editor:r=>this.handleFeatureChange(r.target.value,!0),import:r=>this.handleFilesChange(r)}}
187
+ ?select=${!!this.layerId}
184
188
  .unstyled=${this.unstyled}
185
189
  .drawnFeatures=${this.drawnFeatures}
186
190
  .currentlyDrawing=${this.currentlyDrawing}
187
191
  .multipleFeatures=${this.multipleFeatures}
188
192
  .importFeatures=${this.importFeatures}
189
193
  .showEditor=${this.showEditor}
190
- .geoJSON=${E(this,J)}
194
+ .geoJSON=${m(this,D)}
191
195
  ></eox-drawtools-controller>
192
196
 
193
197
  <!-- List Component -->
194
- ${this.showList&&((e=this.drawnFeatures)!=null&&e.length)?x`<eox-drawtools-list
198
+ ${this.showList&&((e=this.drawnFeatures)!=null&&e.length)?A`<eox-drawtools-list
195
199
  .eoxMap=${this.eoxMap}
196
- .olMap=${E(this,U)}
200
+ .olMap=${m(this,L)}
197
201
  .draw=${this.draw}
198
202
  .drawLayer=${this.drawLayer}
199
203
  .drawnFeatures=${this.drawnFeatures}
@@ -201,4 +205,4 @@
201
205
  .unstyled=${this.unstyled}
202
206
  @changed=${()=>{this.updateGeoJSON(),this.requestUpdate()}}
203
207
  ></eox-drawtools-list>`:p}
204
- `}}k=new WeakMap,U=new WeakMap,J=new WeakMap,customElements.define("eox-drawtools",xt),c.EOxDrawTools=xt,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
208
+ `}}I=new WeakMap,L=new WeakMap,D=new WeakMap,U=new WeakMap,customElements.define("eox-drawtools",St),c.EOxDrawTools=St,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eox/drawtools",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "type": "module",
5
5
  "devDependencies": {
6
6
  "ol": "^10.0.0",
@@ -17,6 +17,7 @@ export class EOxDrawToolsController extends LitElement {
17
17
  drawnFeatures: { attribute: false, state: true, type: Array },
18
18
  currentlyDrawing: { attribute: false, state: true, type: Boolean },
19
19
  drawFunc: { attribute: false, type: Object },
20
+ select: { type: Boolean },
20
21
  importFeatures: { attribute: "import-features", type: Boolean },
21
22
  showEditor: { attribute: "show-editor", type: Boolean },
22
23
  geoJSON: { attribute: "geo-json", type: String },
@@ -81,6 +82,11 @@ export class EOxDrawToolsController extends LitElement {
81
82
  * Render the element without additional styles
82
83
  */
83
84
  this.unstyled = false;
85
+
86
+ /**
87
+ *
88
+ */
89
+ this.select = false;
84
90
  }
85
91
 
86
92
  /**
@@ -115,7 +121,7 @@ export class EOxDrawToolsController extends LitElement {
115
121
  <!-- Draw Button -->
116
122
  <button
117
123
  data-cy="drawBtn"
118
- class="polygon icon"
124
+ class="${this.select ? "pointer" : "polygon"} icon"
119
125
  ?disabled="${this.#drawDisabled || nothing}"
120
126
  @click="${() => this.drawFunc.start()}"
121
127
  >
@@ -113,7 +113,7 @@ export class EOxDrawToolsList extends LitElement {
113
113
 
114
114
  /**
115
115
  *
116
- * @param {Number} featureId - The ID of the feature to hover.
116
+ * @param {number | string | undefined} featureId - The ID of the feature to hover.
117
117
  * @param {Boolean} mouseOut - Flag indicating mouse out event.
118
118
  */
119
119
  _handleHoverFeature(featureId, mouseOut = false) {
@@ -147,7 +147,7 @@ export class EOxDrawToolsList extends LitElement {
147
147
  ${this.drawnFeatures.map((feature, i) => {
148
148
  // Determine feature number and ID
149
149
  const featureNumber = i + 1;
150
- const featureId = feature.get("id");
150
+ const featureId = feature.getId();
151
151
 
152
152
  // Check if the feature is hovered or clicked
153
153
  const isFeatureHovered = this.hoverId === featureId;
@@ -2,6 +2,7 @@ export {
2
2
  STORIES_MAP_STYLE,
3
3
  STORIES_DRAW_TYPES,
4
4
  STORIES_LAYERS_ARRAY,
5
+ STORIES_VECTOR_LAYERS,
5
6
  } from "./stories";
6
7
 
7
8
  export { FIT_OPTIONS, DUMMY_GEO_JSON } from "./draw";
@@ -7,6 +7,27 @@ export const STORIES_LAYERS_ARRAY = [
7
7
  },
8
8
  ];
9
9
 
10
+ export const STORIES_VECTOR_LAYERS = [
11
+ {
12
+ type: "Vector",
13
+ background: "lightgrey",
14
+ properties: {
15
+ id: "regions",
16
+ },
17
+ source: {
18
+ type: "Vector",
19
+ url: "https://openlayers.org/data/vector/ecoregions.json",
20
+ format: "GeoJSON",
21
+ attributions: "Regions: @ openlayers.org",
22
+ },
23
+ style: {
24
+ "stroke-color": "black",
25
+ "stroke-width": 1,
26
+ "fill-color": "darkgrey",
27
+ },
28
+ },
29
+ ];
30
+
10
31
  export const STORIES_MAP_STYLE = "width: 400px; height: 300px;";
11
32
 
12
33
  export const STORIES_DRAW_TYPES = [
package/src/main.js CHANGED
@@ -7,6 +7,8 @@ import {
7
7
  initLayerMethod,
8
8
  discardDrawingMethod,
9
9
  emitDrawnFeaturesMethod,
10
+ createSelectHandler,
11
+ handleLayerId,
10
12
  } from "./methods/draw";
11
13
  import mainStyle from "@eox/elements-utils/styles/dist/main.style";
12
14
  import { DUMMY_GEO_JSON } from "./enums/index.js";
@@ -29,6 +31,7 @@ export class EOxDrawTools extends LitElement {
29
31
  currentlyDrawing: { attribute: false, state: true, type: Boolean },
30
32
  draw: { attribute: false, state: true },
31
33
  drawLayer: { attribute: false, state: true },
34
+ layerId: { attribute: "layer-id", type: String },
32
35
  drawnFeatures: { attribute: false, state: true, type: Array },
33
36
  modify: { attribute: false, state: true },
34
37
  multipleFeatures: { attribute: "multiple-features", type: Boolean },
@@ -42,7 +45,7 @@ export class EOxDrawTools extends LitElement {
42
45
  }
43
46
 
44
47
  /**
45
- * @type import("../../map/main").EOxMap
48
+ * @type import("../../map/src/main").EOxMap
46
49
  */
47
50
  #eoxMap;
48
51
 
@@ -56,6 +59,11 @@ export class EOxDrawTools extends LitElement {
56
59
  */
57
60
  #geoJSON;
58
61
 
62
+ /**
63
+ * @type string
64
+ */
65
+ #layerId;
66
+
59
67
  constructor() {
60
68
  super();
61
69
 
@@ -79,17 +87,22 @@ export class EOxDrawTools extends LitElement {
79
87
 
80
88
  /**
81
89
  * The current native OpenLayers `draw` interaction
82
- * @type import("ol/interaction").Draw
90
+ * @type import("ol/interaction").Draw | import("@eox/map/src/helpers").EOxSelectInteraction
83
91
  */
84
92
  this.draw = null;
85
93
 
86
94
  /**
87
95
  * The current native OpenLayers draw `layer`
88
- * @type import("ol/layer/Vector").default<import("ol/Feature").default>
96
+ * @type import("ol/layer/Vector").default
89
97
  */
90
98
 
91
99
  this.drawLayer = null;
92
100
 
101
+ /**
102
+ * The ID of the Vector/Vector Tile Layer that contains features to be selected
103
+ */
104
+ this.layerId = "";
105
+
93
106
  /**
94
107
  * The array of drawn native OpenLayers features. Normally includes only one feature, until multiple feature drawing is enabled.
95
108
  * @type Array<import("ol").Feature>
@@ -139,12 +152,30 @@ export class EOxDrawTools extends LitElement {
139
152
  * @type {Boolean}
140
153
  */
141
154
  this.noShadow = false;
155
+ /**
156
+ * @type {ReturnType<typeof import("./methods/draw/create-select-handler").default>}
157
+ */
158
+ this.selectionEvents = null;
159
+ }
160
+
161
+ /**
162
+ *
163
+ *
164
+ * @type {string}
165
+ */
166
+ set layerId(value) {
167
+ handleLayerId(this, this.eoxMap, value, this.#layerId);
168
+ this.#layerId = value;
169
+ }
170
+
171
+ get layerId() {
172
+ return this.#layerId;
142
173
  }
143
174
 
144
175
  /**
145
176
  * @onClick Event handler triggered to start drawing on the map.
146
177
  */
147
- handleStartDrawing() {
178
+ startDrawing() {
148
179
  startDrawingMethod(this);
149
180
  }
150
181
 
@@ -152,7 +183,7 @@ export class EOxDrawTools extends LitElement {
152
183
  * @onClick Event handler triggered to discard/stop drawing
153
184
  * on the map and delete the drawn shapes.
154
185
  */
155
- handleDiscardDrawing() {
186
+ discardDrawing() {
156
187
  discardDrawingMethod(this);
157
188
  }
158
189
 
@@ -164,6 +195,7 @@ export class EOxDrawTools extends LitElement {
164
195
  this.eoxMap.parseTextToFeature(
165
196
  text || JSON.stringify(DUMMY_GEO_JSON),
166
197
  this.drawLayer,
198
+ this.eoxMap,
167
199
  replaceFeatures,
168
200
  );
169
201
  }
@@ -226,6 +258,7 @@ export class EOxDrawTools extends LitElement {
226
258
  const { EoxMap, OlMap } = initLayerMethod(this, this.multipleFeatures);
227
259
  this.eoxMap = EoxMap;
228
260
  this.#olMap = OlMap;
261
+ this.selectionEvents = createSelectHandler(this);
229
262
 
230
263
  if (this.importFeatures) initMapDragDropImport(this, this.eoxMap);
231
264
 
@@ -263,13 +296,14 @@ export class EOxDrawTools extends LitElement {
263
296
  <!-- Controller Component -->
264
297
  <eox-drawtools-controller
265
298
  .drawFunc=${{
266
- start: () => this.handleStartDrawing(),
267
- discard: () => this.handleDiscardDrawing(),
299
+ start: () => this.startDrawing(),
300
+ discard: () => this.discardDrawing(),
268
301
  editor: (/** @type {{ target: { value: string; }; }} */ evt) =>
269
302
  this.handleFeatureChange(evt.target.value, true),
270
303
  import: (/** @type {DragEvent | Event} */ evt) =>
271
304
  this.handleFilesChange(evt),
272
305
  }}
306
+ ?select=${!!this.layerId}
273
307
  .unstyled=${this.unstyled}
274
308
  .drawnFeatures=${this.drawnFeatures}
275
309
  .currentlyDrawing=${this.currentlyDrawing}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Factory function to create a select event handler
3
+ * @param {import("../../main").EOxDrawTools} EoxDrawTool - The drawing tool instance.
4
+ */
5
+ const createSelectHandler = (EoxDrawTool) => {
6
+ /**
7
+ * Copy the selected feature to the draw layer
8
+ * and dispatches an event to add the feature to the map.
9
+ *
10
+ * @param {*} e
11
+ */
12
+ const selectHandler = (e) => {
13
+ if (e?.detail.id !== "SelectLayerClickInteraction" || !e.detail.feature) {
14
+ return;
15
+ }
16
+ EoxDrawTool.drawLayer.getSource().addFeature(e.detail.feature);
17
+ EoxDrawTool.eoxMap.dispatchEvent(
18
+ new CustomEvent("addfeatures", { detail: e.detail }),
19
+ );
20
+ };
21
+
22
+ /**
23
+ * Adds the selection event to the map
24
+ **/
25
+ const addSelectionEvent = () => {
26
+ if (EoxDrawTool.layerId) {
27
+ const hoverInteraction =
28
+ EoxDrawTool.eoxMap.selectInteractions["SelectLayerHoverInteraction"];
29
+ hoverInteraction.setActive(true);
30
+ EoxDrawTool.eoxMap.addEventListener("select", selectHandler);
31
+ }
32
+ };
33
+
34
+ /**
35
+ * Removes the selection event from the map and resets the selected features
36
+ **/
37
+ const removeSelectionEvent = () => {
38
+ const hoverInteraction =
39
+ EoxDrawTool.eoxMap.selectInteractions?.["SelectLayerHoverInteraction"];
40
+ if (hoverInteraction) {
41
+ hoverInteraction.selectedFids = [];
42
+ hoverInteraction.setActive(false);
43
+ }
44
+ EoxDrawTool.eoxMap.removeEventListener("select", selectHandler);
45
+ };
46
+
47
+ return { addSelectionEvent, removeSelectionEvent };
48
+ };
49
+
50
+ export default createSelectHandler;