@eox/drawtools 0.5.0 → 0.6.1

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,34 +1,34 @@
1
- var qt=Object.defineProperty;var jt=(l,h,u)=>h in l?qt(l,h,{enumerable:!0,configurable:!0,writable:!0,value:u}):l[h]=u;var I=(l,h,u)=>(jt(l,typeof h!="symbol"?h+"":h,u),u),gt=(l,h,u)=>{if(!h.has(l))throw TypeError("Cannot "+u)};var g=(l,h,u)=>(gt(l,h,"read from private field"),u?u.call(l):h.get(l)),J=(l,h,u)=>{if(h.has(l))throw TypeError("Cannot add the same private member more than once");h instanceof WeakSet?h.add(l):h.set(l,u)},K=(l,h,u,M)=>(gt(l,h,"write to private field"),M?M.call(l,u):h.set(l,u),u);(function(l,h){typeof exports=="object"&&typeof module<"u"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(l=typeof globalThis<"u"?globalThis:l||self,h(l["eox-drawtools"]={}))})(this,function(l){var ft,f,H;"use strict";/**
1
+ (function(d,l){typeof exports=="object"&&typeof module<"u"?l(exports):typeof define=="function"&&define.amd?define(["exports"],l):(d=typeof globalThis<"u"?globalThis:d||self,l(d["eox-drawtools"]={}))})(this,function(d){"use strict";var ie=Object.defineProperty;var re=(d,l,y)=>l in d?ie(d,l,{enumerable:!0,configurable:!0,writable:!0,value:y}):d[l]=y;var x=(d,l,y)=>(re(d,typeof l!="symbol"?l+"":l,y),y),wt=(d,l,y)=>{if(!l.has(d))throw TypeError("Cannot "+y)};var S=(d,l,y)=>(wt(d,l,"read from private field"),y?y.call(d):l.get(d)),z=(d,l,y)=>{if(l.has(d))throw TypeError("Cannot add the same private member more than once");l instanceof WeakSet?l.add(d):l.set(d,y)},j=(d,l,y,F)=>(wt(d,l,"write to private field"),F?F.call(d,y):l.set(d,y),y);/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */const h=globalThis,u=h.ShadowRoot&&(h.ShadyCSS===void 0||h.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,M=Symbol(),G=new WeakMap;let mt=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==M)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(u&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=G.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&G.set(e,t))}return t}toString(){return this.cssText}};const _t=r=>new mt(typeof r=="string"?r:r+"",void 0,M),wt=(r,t)=>{if(u)r.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const s=document.createElement("style"),i=h.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,r.appendChild(s)}},Q=u?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return _t(e)})(r):r;/**
5
+ */var bt,V,R,M,k;const l=globalThis,y=l.ShadowRoot&&(l.ShadyCSS===void 0||l.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,F=Symbol(),Y=new WeakMap;let At=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==F)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 s=e!==void 0&&e.length===1;s&&(t=Y.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Y.set(e,t))}return t}toString(){return this.cssText}};const vt=i=>new At(typeof i=="string"?i:i+"",void 0,F),xt=(i,t)=>{if(y)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const s=document.createElement("style"),r=l.litNonce;r!==void 0&&s.setAttribute("nonce",r),s.textContent=e.cssText,i.appendChild(s)}},tt=y?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return vt(e)})(i):i;/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:bt,defineProperty:At,getOwnPropertyDescriptor:xt,getOwnPropertyNames:vt,getOwnPropertySymbols:Et,getPrototypeOf:St}=Object,_=globalThis,X=_.trustedTypes,Ct=X?X.emptyScript:"",z=_.reactiveElementPolyfillSupport,U=(r,t)=>r,q={toAttribute(r,t){switch(t){case Boolean:r=r?Ct: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}},Y=(r,t)=>!bt(r,t),tt={attribute:!0,type:String,converter:q,reflect:!1,hasChanged:Y};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),_.litPropertyMetadata??(_.litPropertyMetadata=new WeakMap);class E 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=tt){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);i!==void 0&&At(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:n}=xt(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get(){return i==null?void 0:i.call(this)},set(o){const p=i==null?void 0:i.call(this);n.call(this,o),this.requestUpdate(t,p,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??tt}static _$Ei(){if(this.hasOwnProperty(U("elementProperties")))return;const t=St(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(U("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(U("properties"))){const e=this.properties,s=[...vt(e),...Et(e)];for(const i of s)this.createProperty(i,e[i])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[s,i]of e)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const i=this._$Eu(e,s);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const i of s)e.unshift(Q(i))}else t!==void 0&&e.push(Q(t));return e}static _$Eu(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s: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._$Eg=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._$ES??(this._$ES=[])).push(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$ES)==null||e.splice(this._$ES.indexOf(t)>>>0,1)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return wt(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)==null||t.forEach(e=>{var s;return(s=e.hostConnected)==null?void 0:s.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)==null||t.forEach(e=>{var s;return(s=e.hostDisconnected)==null?void 0:s.call(e)})}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EO(t,e){var n;const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){const o=(((n=s.converter)==null?void 0:n.toAttribute)!==void 0?s.converter:q).toAttribute(e,s.type);this._$Em=t,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){var n;const s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){const o=s.getPropertyOptions(i),p=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:q;this._$Em=i,this[i]=p.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,s,i=!1,n){if(t!==void 0){if(s??(s=this.constructor.getPropertyOptions(t)),!(s.hasChanged??Y)(i?n:this[t],e))return;this.C(t,e,s)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(t,e,s){this._$AL.has(t)||this._$AL.set(t,e),s.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[n,o]of i)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.C(n,this[n],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(s=this._$ES)==null||s.forEach(i=>{var n;return(n=i.hostUpdate)==null?void 0:n.call(i)}),this.update(e)):this._$ET()}catch(i){throw t=!1,this._$ET(),i}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)==null||e.forEach(s=>{var i;return(i=s.hostUpdated)==null?void 0:i.call(s)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EO(e,this[e]))),this._$ET()}updated(t){}firstUpdated(t){}}E.elementStyles=[],E.shadowRootOptions={mode:"open"},E[U("elementProperties")]=new Map,E[U("finalized")]=new Map,z==null||z({ReactiveElement:E}),(_.reactiveElementVersions??(_.reactiveElementVersions=[])).push("2.0.1");/**
9
+ */const{is:St,defineProperty:Ct,getOwnPropertyDescriptor:Et,getOwnPropertyNames:Ht,getOwnPropertySymbols:Mt,getPrototypeOf:kt}=Object,g=globalThis,et=g.trustedTypes,Ft=et?et.emptyScript:"",Z=g.reactiveElementPolyfillSupport,U=(i,t)=>i,G={toAttribute(i,t){switch(t){case Boolean:i=i?Ft: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}},st=(i,t)=>!St(i,t),it={attribute:!0,type:String,converter:G,reflect:!1,hasChanged:st};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),g.litPropertyMetadata??(g.litPropertyMetadata=new WeakMap);class C 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=it){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),r=this.getPropertyDescriptor(t,s,e);r!==void 0&&Ct(this.prototype,t,r)}}static getPropertyDescriptor(t,e,s){const{get:r,set:n}=Et(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 h=r==null?void 0:r.call(this);n.call(this,o),this.requestUpdate(t,h,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??it}static _$Ei(){if(this.hasOwnProperty(U("elementProperties")))return;const t=kt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(U("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(U("properties"))){const e=this.properties,s=[...Ht(e),...Mt(e)];for(const r of s)this.createProperty(r,e[r])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[s,r]of e)this.elementProperties.set(s,r)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const r=this._$Eu(e,s);r!==void 0&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const r of s)e.unshift(tt(r))}else t!==void 0&&e.push(tt(t));return e}static _$Eu(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s: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._$Eg=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._$ES??(this._$ES=[])).push(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$ES)==null||e.splice(this._$ES.indexOf(t)>>>0,1)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return xt(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)==null||t.forEach(e=>{var s;return(s=e.hostConnected)==null?void 0:s.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)==null||t.forEach(e=>{var s;return(s=e.hostDisconnected)==null?void 0:s.call(e)})}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EO(t,e){var n;const s=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,s);if(r!==void 0&&s.reflect===!0){const o=(((n=s.converter)==null?void 0:n.toAttribute)!==void 0?s.converter:G).toAttribute(e,s.type);this._$Em=t,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(t,e){var n;const s=this.constructor,r=s._$Eh.get(t);if(r!==void 0&&this._$Em!==r){const o=s.getPropertyOptions(r),h=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:G;this._$Em=r,this[r]=h.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,s,r=!1,n){if(t!==void 0){if(s??(s=this.constructor.getPropertyOptions(t)),!(s.hasChanged??st)(r?n:this[t],e))return;this.C(t,e,s)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(t,e,s){this._$AL.has(t)||this._$AL.set(t,e),s.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[n,o]of r)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.C(n,this[n],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(s=this._$ES)==null||s.forEach(r=>{var n;return(n=r.hostUpdate)==null?void 0:n.call(r)}),this.update(e)):this._$ET()}catch(r){throw t=!1,this._$ET(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)==null||e.forEach(s=>{var r;return(r=s.hostUpdated)==null?void 0:r.call(s)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EO(e,this[e]))),this._$ET()}updated(t){}firstUpdated(t){}}C.elementStyles=[],C.shadowRootOptions={mode:"open"},C[U("elementProperties")]=new Map,C[U("finalized")]=new Map,Z==null||Z({ReactiveElement:C}),(g.reactiveElementVersions??(g.reactiveElementVersions=[])).push("2.0.1");/**
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */const P=globalThis,N=P.trustedTypes,et=N?N.createPolicy("lit-html",{createHTML:r=>r}):void 0,st="$lit$",w=`lit$${(Math.random()+"").slice(9)}$`,it="?"+w,kt=`<${it}>`,A=document,T=()=>A.createComment(""),D=r=>r===null||typeof r!="object"&&typeof r!="function",rt=Array.isArray,Ht=r=>rt(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",j=`[
14
- \f\r]`,L=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,nt=/-->/g,ot=/>/g,x=RegExp(`>|${j}(?:([^\\s"'>=/]+)(${j}*=${j}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),at=/'/g,ht=/"/g,lt=/^(?:script|style|textarea|title)$/i,It=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),V=It(1),S=Symbol.for("lit-noChange"),c=Symbol.for("lit-nothing"),ct=new WeakMap,v=A.createTreeWalker(A,129);function dt(r,t){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return et!==void 0?et.createHTML(t):t}const Mt=(r,t)=>{const e=r.length-1,s=[];let i,n=t===2?"<svg>":"",o=L;for(let p=0;p<e;p++){const a=r[p];let $,y,d=-1,m=0;for(;m<a.length&&(o.lastIndex=m,y=o.exec(a),y!==null);)m=o.lastIndex,o===L?y[1]==="!--"?o=nt:y[1]!==void 0?o=ot:y[2]!==void 0?(lt.test(y[2])&&(i=RegExp("</"+y[2],"g")),o=x):y[3]!==void 0&&(o=x):o===x?y[0]===">"?(o=i??L,d=-1):y[1]===void 0?d=-2:(d=o.lastIndex-y[2].length,$=y[1],o=y[3]===void 0?x:y[3]==='"'?ht:at):o===ht||o===at?o=x:o===nt||o===ot?o=L:(o=x,i=void 0);const b=o===x&&r[p+1].startsWith("/>")?" ":"";n+=o===L?a+kt:d>=0?(s.push($),a.slice(0,d)+st+a.slice(d)+w+b):a+w+(d===-2?p:b)}return[dt(r,n+(r[e]||"<?>")+(t===2?"</svg>":"")),s]};class O{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let n=0,o=0;const p=t.length-1,a=this.parts,[$,y]=Mt(t,e);if(this.el=O.createElement($,s),v.currentNode=this.el.content,e===2){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=v.nextNode())!==null&&a.length<p;){if(i.nodeType===1){if(i.hasAttributes())for(const d of i.getAttributeNames())if(d.endsWith(st)){const m=y[o++],b=i.getAttribute(d).split(w),B=/([.?@])?(.*)/.exec(m);a.push({type:1,index:n,name:B[2],strings:b,ctor:B[1]==="."?Pt:B[1]==="?"?Tt:B[1]==="@"?Dt:R}),i.removeAttribute(d)}else d.startsWith(w)&&(a.push({type:6,index:n}),i.removeAttribute(d));if(lt.test(i.tagName)){const d=i.textContent.split(w),m=d.length-1;if(m>0){i.textContent=N?N.emptyScript:"";for(let b=0;b<m;b++)i.append(d[b],T()),v.nextNode(),a.push({type:2,index:++n});i.append(d[m],T())}}}else if(i.nodeType===8)if(i.data===it)a.push({type:2,index:n});else{let d=-1;for(;(d=i.data.indexOf(w,d+1))!==-1;)a.push({type:7,index:n}),d+=w.length-1}n++}}static createElement(t,e){const s=A.createElement("template");return s.innerHTML=t,s}}function C(r,t,e=r,s){var o,p;if(t===S)return t;let i=s!==void 0?(o=e._$Co)==null?void 0:o[s]:e._$Cl;const n=D(t)?void 0:t._$litDirective$;return(i==null?void 0:i.constructor)!==n&&((p=i==null?void 0:i._$AO)==null||p.call(i,!1),n===void 0?i=void 0:(i=new n(r),i._$AT(r,e,s)),s!==void 0?(e._$Co??(e._$Co=[]))[s]=i:e._$Cl=i),i!==void 0&&(t=C(r,i._$AS(r,t.values),i,s)),t}class Ut{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:s}=this._$AD,i=((t==null?void 0:t.creationScope)??A).importNode(e,!0);v.currentNode=i;let n=v.nextNode(),o=0,p=0,a=s[0];for(;a!==void 0;){if(o===a.index){let $;a.type===2?$=new F(n,n.nextSibling,this,t):a.type===1?$=new a.ctor(n,a.name,a.strings,this,t):a.type===6&&($=new Lt(n,this,t)),this._$AV.push($),a=s[++p]}o!==(a==null?void 0:a.index)&&(n=v.nextNode(),o++)}return v.currentNode=A,i}p(t){let e=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class F{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=c,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=(i==null?void 0:i.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=C(this,t,e),D(t)?t===c||t==null||t===""?(this._$AH!==c&&this._$AR(),this._$AH=c):t!==this._$AH&&t!==S&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):Ht(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==c&&D(this._$AH)?this._$AA.nextSibling.data=t:this.$(A.createTextNode(t)),this._$AH=t}g(t){var n;const{values:e,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=O.createElement(dt(s.h,s.h[0]),this.options)),s);if(((n=this._$AH)==null?void 0:n._$AD)===i)this._$AH.p(e);else{const o=new Ut(i,this),p=o.u(this.options);o.p(e),this.$(p),this._$AH=o}}_$AC(t){let e=ct.get(t.strings);return e===void 0&&ct.set(t.strings,e=new O(t)),e}T(t){rt(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const n of t)i===e.length?e.push(s=new F(this.k(T()),this.k(T()),this,this.options)):s=e[i],s._$AI(n),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,e);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}}class R{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,n){this.type=1,this._$AH=c,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=c}_$AI(t,e=this,s,i){const n=this.strings;let o=!1;if(n===void 0)t=C(this,t,e,0),o=!D(t)||t!==this._$AH&&t!==S,o&&(this._$AH=t);else{const p=t;let a,$;for(t=n[0],a=0;a<n.length-1;a++)$=C(this,p[s+a],e,a),$===S&&($=this._$AH[a]),o||(o=!D($)||$!==this._$AH[a]),$===c?t=c:t!==c&&(t+=($??"")+n[a+1]),this._$AH[a]=$}o&&!i&&this.O(t)}O(t){t===c?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Pt extends R{constructor(){super(...arguments),this.type=3}O(t){this.element[this.name]=t===c?void 0:t}}class Tt extends R{constructor(){super(...arguments),this.type=4}O(t){this.element.toggleAttribute(this.name,!!t&&t!==c)}}class Dt extends R{constructor(t,e,s,i,n){super(t,e,s,i,n),this.type=5}_$AI(t,e=this){if((t=C(this,t,e,0)??c)===S)return;const s=this._$AH,i=t===c&&s!==c||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==c&&(s===c||i);i&&this.element.removeEventListener(this.name,this,s),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 Lt{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){C(this,t)}}const W=P.litHtmlPolyfillSupport;W==null||W(O,F),(P.litHtmlVersions??(P.litHtmlVersions=[])).push("3.0.2");const Ot=(r,t,e)=>{const s=(e==null?void 0:e.renderBefore)??t;let i=s._$litPart$;if(i===void 0){const n=(e==null?void 0:e.renderBefore)??null;s._$litPart$=i=new F(t.insertBefore(T(),n),n,void 0,e??{})}return i._$AI(r),i};/**
13
+ */const P=globalThis,q=P.trustedTypes,rt=q?q.createPolicy("lit-html",{createHTML:i=>i}):void 0,nt="$lit$",m=`lit$${(Math.random()+"").slice(9)}$`,ot="?"+m,Ut=`<${ot}>`,b=document,I=()=>b.createComment(""),O=i=>i===null||typeof i!="object"&&typeof i!="function",at=Array.isArray,Pt=i=>at(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",J=`[
14
+ \f\r]`,L=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,lt=/-->/g,ht=/>/g,w=RegExp(`>|${J}(?:([^\\s"'>=/]+)(${J}*=${J}*(?:[^
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),dt=/'/g,ct=/"/g,ut=/^(?:script|style|textarea|title)$/i,It=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),N=It(1),E=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),pt=new WeakMap,A=b.createTreeWalker(b,129);function yt(i,t){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return rt!==void 0?rt.createHTML(t):t}const Ot=(i,t)=>{const e=i.length-1,s=[];let r,n=t===2?"<svg>":"",o=L;for(let h=0;h<e;h++){const a=i[h];let u,$,c=-1,f=0;for(;f<a.length&&(o.lastIndex=f,$=o.exec(a),$!==null);)f=o.lastIndex,o===L?$[1]==="!--"?o=lt:$[1]!==void 0?o=ht:$[2]!==void 0?(ut.test($[2])&&(r=RegExp("</"+$[2],"g")),o=w):$[3]!==void 0&&(o=w):o===w?$[0]===">"?(o=r??L,c=-1):$[1]===void 0?c=-2:(c=o.lastIndex-$[2].length,u=$[1],o=$[3]===void 0?w:$[3]==='"'?ct:dt):o===ct||o===dt?o=w:o===lt||o===ht?o=L:(o=w,r=void 0);const _=o===w&&i[h+1].startsWith("/>")?" ":"";n+=o===L?a+Ut:c>=0?(s.push(u),a.slice(0,c)+nt+a.slice(c)+m+_):a+m+(c===-2?h:_)}return[yt(i,n+(i[e]||"<?>")+(t===2?"</svg>":"")),s]};class B{constructor({strings:t,_$litType$:e},s){let r;this.parts=[];let n=0,o=0;const h=t.length-1,a=this.parts,[u,$]=Ot(t,e);if(this.el=B.createElement(u,s),A.currentNode=this.el.content,e===2){const c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(r=A.nextNode())!==null&&a.length<h;){if(r.nodeType===1){if(r.hasAttributes())for(const c of r.getAttributeNames())if(c.endsWith(nt)){const f=$[o++],_=r.getAttribute(c).split(m),W=/([.?@])?(.*)/.exec(f);a.push({type:1,index:n,name:W[2],strings:_,ctor:W[1]==="."?Nt:W[1]==="?"?Bt:W[1]==="@"?Dt:T}),r.removeAttribute(c)}else c.startsWith(m)&&(a.push({type:6,index:n}),r.removeAttribute(c));if(ut.test(r.tagName)){const c=r.textContent.split(m),f=c.length-1;if(f>0){r.textContent=q?q.emptyScript:"";for(let _=0;_<f;_++)r.append(c[_],I()),A.nextNode(),a.push({type:2,index:++n});r.append(c[f],I())}}}else if(r.nodeType===8)if(r.data===ot)a.push({type:2,index:n});else{let c=-1;for(;(c=r.data.indexOf(m,c+1))!==-1;)a.push({type:7,index:n}),c+=m.length-1}n++}}static createElement(t,e){const s=b.createElement("template");return s.innerHTML=t,s}}function H(i,t,e=i,s){var o,h;if(t===E)return t;let r=s!==void 0?(o=e._$Co)==null?void 0:o[s]:e._$Cl;const n=O(t)?void 0:t._$litDirective$;return(r==null?void 0:r.constructor)!==n&&((h=r==null?void 0:r._$AO)==null||h.call(r,!1),n===void 0?r=void 0:(r=new n(i),r._$AT(i,e,s)),s!==void 0?(e._$Co??(e._$Co=[]))[s]=r:e._$Cl=r),r!==void 0&&(t=H(i,r._$AS(i,t.values),r,s)),t}class Lt{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:s}=this._$AD,r=((t==null?void 0:t.creationScope)??b).importNode(e,!0);A.currentNode=r;let n=A.nextNode(),o=0,h=0,a=s[0];for(;a!==void 0;){if(o===a.index){let u;a.type===2?u=new D(n,n.nextSibling,this,t):a.type===1?u=new a.ctor(n,a.name,a.strings,this,t):a.type===6&&(u=new Vt(n,this,t)),this._$AV.push(u),a=s[++h]}o!==(a==null?void 0:a.index)&&(n=A.nextNode(),o++)}return A.currentNode=b,r}p(t){let e=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class D{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,s,r){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,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=H(this,t,e),O(t)?t===p||t==null||t===""?(this._$AH!==p&&this._$AR(),this._$AH=p):t!==this._$AH&&t!==E&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):Pt(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==p&&O(this._$AH)?this._$AA.nextSibling.data=t:this.$(b.createTextNode(t)),this._$AH=t}g(t){var n;const{values:e,_$litType$:s}=t,r=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=B.createElement(yt(s.h,s.h[0]),this.options)),s);if(((n=this._$AH)==null?void 0:n._$AD)===r)this._$AH.p(e);else{const o=new Lt(r,this),h=o.u(this.options);o.p(e),this.$(h),this._$AH=o}}_$AC(t){let e=pt.get(t.strings);return e===void 0&&pt.set(t.strings,e=new B(t)),e}T(t){at(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,r=0;for(const n of t)r===e.length?e.push(s=new D(this.k(I()),this.k(I()),this,this.options)):s=e[r],s._$AI(n),r++;r<e.length&&(this._$AR(s&&s._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){var s;for((s=this._$AP)==null?void 0:s.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 T{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,r,n){this.type=1,this._$AH=p,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=p}_$AI(t,e=this,s,r){const n=this.strings;let o=!1;if(n===void 0)t=H(this,t,e,0),o=!O(t)||t!==this._$AH&&t!==E,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[s+a],e,a),u===E&&(u=this._$AH[a]),o||(o=!O(u)||u!==this._$AH[a]),u===p?t=p:t!==p&&(t+=(u??"")+n[a+1]),this._$AH[a]=u}o&&!r&&this.O(t)}O(t){t===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Nt extends T{constructor(){super(...arguments),this.type=3}O(t){this.element[this.name]=t===p?void 0:t}}class Bt extends T{constructor(){super(...arguments),this.type=4}O(t){this.element.toggleAttribute(this.name,!!t&&t!==p)}}class Dt extends T{constructor(t,e,s,r,n){super(t,e,s,r,n),this.type=5}_$AI(t,e=this){if((t=H(this,t,e,0)??p)===E)return;const s=this._$AH,r=t===p&&s!==p||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==p&&(s===p||r);r&&this.element.removeEventListener(this.name,this,s),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 Vt{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){H(this,t)}}const K=P.litHtmlPolyfillSupport;K==null||K(B,D),(P.litHtmlVersions??(P.litHtmlVersions=[])).push("3.1.0");const Rt=(i,t,e)=>{const s=(e==null?void 0:e.renderBefore)??t;let r=s._$litPart$;if(r===void 0){const n=(e==null?void 0:e.renderBefore)??null;s._$litPart$=r=new D(t.insertBefore(I(),n),n,void 0,e??{})}return r._$AI(i),r};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
- */class k extends E{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=Ot(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 S}}k._$litElement$=!0,k.finalized=!0,(ft=globalThis.litElementHydrateSupport)==null||ft.call(globalThis,{LitElement:k});const Z=globalThis.litElementPolyfillSupport;Z==null||Z({LitElement:k}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.1");/**
19
+ */class v extends C{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=Rt(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 E}}v._$litElement$=!0,v.finalized=!0,(bt=globalThis.litElementHydrateSupport)==null||bt.call(globalThis,{LitElement:v});const Q=globalThis.litElementPolyfillSupport;Q==null||Q({LitElement:v}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.1");/**
20
20
  * @license
21
21
  * Copyright 2017 Google LLC
22
22
  * SPDX-License-Identifier: BSD-3-Clause
23
- */const Ft=r=>(...t)=>({_$litDirective$:r,values:t});let Nt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};/**
23
+ */const zt=i=>(...t)=>({_$litDirective$:i,values:t});let jt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$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 Vt={},Rt=(r,t=Vt)=>r._$AH=t;/**
27
+ */const qt={},Tt=(i,t=qt)=>i._$AH=t;/**
28
28
  * @license
29
29
  * Copyright 2021 Google LLC
30
30
  * SPDX-License-Identifier: BSD-3-Clause
31
- */const Bt=Ft(class extends Nt{constructor(){super(...arguments),this.key=c}render(r,t){return this.key=r,t}update(r,[t,e]){return t!==this.key&&(Rt(r),this.key=t),e}}),pt=`
31
+ */const Wt=zt(class extends jt{constructor(){super(...arguments),this.key=p}render(i,t){return this.key=i,t}update(i,[t,e]){return t!==this.key&&(Tt(i),this.key=t),e}}),X=`
32
32
  * {
33
33
  font-family: Roboto, sans-serif;
34
34
  }
@@ -196,71 +196,88 @@ button.small {
196
196
  font-size: small;
197
197
  flex-grow: 1;
198
198
  }
199
- `,ut=(r,t,e=!1)=>({id:r,condition:t,panIn:e,layer:{type:"Vector",properties:{id:"selectLayer"},source:{type:"Vector"},style:{"fill-color":"rgba(51, 153, 204,0.5)","stroke-color":"#3399CC","stroke-width":2.5}}});class $t extends k{constructor(){super();I(this,"hoverInteraction");I(this,"clickInteraction");I(this,"hoverId");I(this,"clickId");this.eoxMap=null,this.olMap=null,this.draw=null,this.layer="draw",this.drawLayer=null,this.drawnFeatures=[],this.modify=null,this.unstyled=!1}_handleDelete(e){e.stopPropagation();const s=e.target.getAttribute("index"),i=this.drawnFeatures[s];this.drawLayer.getSource().removeFeature(i),this.drawnFeatures.splice(s,1),this.requestUpdate()}_handleFeatureSelectAndDeselect(e){const s=e.get("id");if(this.clickId===s){const i=this.drawLayer.getSource().getExtent();this.olMap.getView().fit(i,{duration:750}),this.clickInteraction.highlightById([])}else this.clickInteraction.highlightById([s]),this.olMap.getView().fit(e.getGeometry().getExtent(),{duration:750});this.requestUpdate()}firstUpdated(){var i,n;const e=(i=this.eoxMap)==null?void 0:i.selectInteractions["draw-hover"],s=(n=this.eoxMap)==null?void 0:n.selectInteractions["draw-click"];e||(this.hoverInteraction=this.eoxMap.addSelect(this.layer,ut("draw-hover","pointermove"))),s||(this.clickInteraction=this.eoxMap.addSelect(this.layer,ut("draw-click","click",!0))),this.hoverInteraction.selectStyleLayer.on("change",()=>this.requestUpdate()),this.clickInteraction.selectStyleLayer.on("change",()=>this.requestUpdate())}render(){var e,s;return this.hoverInteraction=this.eoxMap.selectInteractions["draw-hover"],this.clickInteraction=this.eoxMap.selectInteractions["draw-click"],this.hoverId=(e=this.hoverInteraction)==null?void 0:e.selectedFids[0],this.clickId=(s=this.clickInteraction)==null?void 0:s.selectedFids[0],V`
199
+ `,Zt=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)},Gt=(i,t,e)=>{if(i.clickId===t)return;const s=e?[]:[t];i.hoverInteraction.highlightById(s)},Jt=(i,t)=>{i.stopPropagation();const e=Number(i.target.getAttribute("index")),s=t.drawnFeatures[e];t.drawLayer.getSource().removeFeature(s),t.drawnFeatures.splice(e,1),t.requestUpdate()},$t={duration:750},Kt=(i,t)=>{const e=i.get("id"),{clickId:s,drawLayer:r,olMap:n,clickInteraction:o}=t,h=s===e,a=i.getGeometry();if(h){const u=r.getSource().getExtent();n.getView().fit(u,$t),o.highlightById([])}else{const u=a.getExtent();o.highlightById([e]),n.getView().fit(u,$t)}t.requestUpdate()};class ft extends v{constructor(){super();x(this,"hoverInteraction");x(this,"clickInteraction");x(this,"hoverId");x(this,"clickId");this.eoxMap=null,this.olMap=null,this.draw=null,this.drawLayer=null,this.drawnFeatures=[],this.modify=null,this.unstyled=!1}_handleDelete(e){Jt(e,this)}_handleFeatureSelectAndDeselect(e){Kt(e,this)}_handleHoverFeature(e,s=!1){Gt(this,e,s)}firstUpdated(){Zt(this)}render(){var e,s;return this.hoverId=(e=this.hoverInteraction)==null?void 0:e.selectedFids[0],this.clickId=(s=this.clickInteraction)==null?void 0:s.selectedFids[0],N`
200
200
  <style>
201
- ${!this.unstyled&&pt}
201
+ ${!this.unstyled&&X}
202
202
  </style>
203
203
  <ul>
204
- ${this.drawnFeatures.map((i,n)=>{const o=i.get("id"),p=this.hoverId===o||this.clickId===o;return Bt(n+1,V`
204
+ ${this.drawnFeatures.map((r,n)=>{const o=n+1,h=r.get("id"),a=this.hoverId===h,u=this.clickId===h;return Wt(o,N`
205
205
  <li
206
- class="${p?"selected":c}"
207
- @mouseover=${()=>{this.clickId!==o&&this.hoverInteraction.highlightById([o])}}
208
- @mouseout=${()=>{this.clickId!==o&&this.hoverInteraction.highlightById([])}}
206
+ class="${a||u?"selected":p}"
207
+ @mouseover=${()=>this._handleHoverFeature(h)}
208
+ @mouseout=${()=>this._handleHoverFeature(h,!0)}
209
209
  >
210
210
  <div
211
211
  class="list"
212
- @click="${()=>this._handleFeatureSelectAndDeselect(i)}"
212
+ @click="${()=>this._handleFeatureSelectAndDeselect(r)}"
213
213
  >
214
- <span class="title">Feature #${n+1}</span>
214
+ <span class="title">Feature #${o}</span>
215
215
  <button
216
216
  index=${n}
217
217
  class="icon small discard"
218
218
  @click="${this._handleDelete}"
219
219
  >
220
- ${this.unstyled?"x":c}
220
+ x
221
221
  </button>
222
222
  </div>
223
223
  </li>
224
224
  `)})}
225
225
  </ul>
226
- `}}I($t,"properties",{eoxMap:{attribute:!1,state:!0},olMap:{attribute:!1,state:!0},draw:{attribute:!1,state:!0},layer:{type:String},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",$t);const zt=`
227
- :host {
228
- display: block;
229
- }
230
- `;class yt extends k{constructor(){super();J(this,f,void 0);J(this,H,void 0);this.for="eox-map",this.currentlyDrawing=!1,this.draw=null,this.drawLayer=null,this.drawnFeatures=[],this.layer="draw",this.modify=null,this.multipleFeatures=!1,this.showList=!1,this.unstyled=!1}static get properties(){return{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},layer:{type:String},modify:{attribute:!1,state:!0},multipleFeatures:{attribute:"multiple-features",type:Boolean},showList:{attribute:"show-list",type:Boolean},unstyled:{type:Boolean}}}startDrawing(){var e,s;g(this,f).addDraw(this.layer,{id:"drawInteraction",type:"Polygon",stopClick:!0}),this.draw=g(this,f).interactions.drawInteraction,this.modify=g(this,f).interactions.drawInteractionmodify,(e=this.draw)==null||e.on("drawend",i=>this.onDrawEnd(i)),(s=this.modify)==null||s.on("modifyend",i=>this.onModifyEnd(i)),this.currentlyDrawing=!0,this.requestUpdate()}discardDrawing(){this.drawnFeatures=[],g(this,f).removeInteraction("drawInteraction"),this.drawLayer.getSource().clear(),this.emitDrawnFeatures(),this.currentlyDrawing=!1,this.requestUpdate()}onDrawEnd(){this.emitDrawnFeatures(),g(this,f).removeInteraction("drawInteraction"),this.currentlyDrawing=!1,this.requestUpdate()}onModifyEnd(){this.emitDrawnFeatures()}emitDrawnFeatures(){setTimeout(()=>{this.drawnFeatures=this.drawLayer.getSource().getFeatures(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("drawupdate",{detail:this.drawnFeatures}))},0)}render(){var s,i,n;const e=document.querySelector(this.for);return K(this,f,e),K(this,H,g(this,f).map),this.drawLayer=g(this,H).getLayers().getArray().find(o=>o.get("id")===this.layer),this.requestUpdate(),V`
226
+ `}}x(ft,"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",ft);const Qt=i=>{const{multipleFeatures:t,drawnFeatures:e,currentlyDrawing:s}=i,r=!t&&(e==null?void 0:e.length)>0||s,n=!(e!=null&&e.length)&&!s;return{drawDisabled:r,discardDisabled:n}};class gt extends v{constructor(){super();z(this,V,!0);z(this,R,!0);this.multipleFeatures=!1,this.drawnFeatures=[],this.currentlyDrawing=!1,this.drawFunc=null,this.unstyled=!1}updateButtonStates(){const{drawDisabled:e,discardDisabled:s}=Qt(this);j(this,V,e),j(this,R,s)}render(){this.updateButtonStates();const e=this.currentlyDrawing?"drawing":"draw";return N`
231
227
  <style>
232
- ${zt}
233
- ${!this.unstyled&&pt}
228
+ ${!this.unstyled&&X}
234
229
  </style>
235
230
  <div>
236
231
  <slot></slot>
232
+
233
+ <!-- Draw Button -->
237
234
  <button
238
235
  data-cy="drawBtn"
239
236
  class="polygon icon"
240
- disabled="${!this.multipleFeatures&&((s=this.drawnFeatures)==null?void 0:s.length)>0||this.currentlyDrawing||c}"
241
- @click="${()=>this.startDrawing()}"
237
+ ?disabled="${S(this,V)||p}"
238
+ @click="${()=>this.drawFunc.start()}"
242
239
  >
243
- ${this.currentlyDrawing?"drawing":"draw"}
240
+ ${e}
244
241
  </button>
242
+
243
+ <!-- Discard Button -->
245
244
  <button
246
245
  data-cy="discardBtn"
247
246
  class="discard icon"
248
- disabled="${!((i=this.drawnFeatures)!=null&&i.length)&&!this.currentlyDrawing||c}"
249
- @click="${()=>this.discardDrawing()}"
247
+ ?disabled="${S(this,R)||p}"
248
+ @click="${()=>this.drawFunc.discard()}"
250
249
  >
251
250
  discard
252
251
  </button>
253
252
  </div>
254
- ${this.showList&&((n=this.drawnFeatures)!=null&&n.length)?V`<eox-drawtools-list
255
- .eoxMap=${g(this,f)}
256
- .olMap=${g(this,H)}
253
+ `}}V=new WeakMap,R=new WeakMap,x(gt,"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},unstyled:{type:Boolean}}),customElements.define("eox-drawtools-controller",gt);const Xt=`
254
+ :host {
255
+ display: block;
256
+ }
257
+ `,mt=i=>{(()=>{i.emitDrawnFeatures(),i.draw.setActive(!1),i.currentlyDrawing=!1})(),i.requestUpdate()},Yt=i=>{const t=()=>{i.initDrawLayer(),i.draw.setActive(!0)},e=()=>{i.currentlyDrawing=!0,i.requestUpdate()};t(),e()},te=i=>{var r,n;const e=document.querySelector(i.for),s=e.map;return i.drawLayer=e.addOrUpdateLayer({type:"Vector",properties:{id:"drawLayer",layerControlHide:!0},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=e.interactions.drawInteraction,i.modify=e.interactions.drawInteractionmodify,(r=i.draw)==null||r.on("drawend",()=>mt(i)),(n=i.modify)==null||n.on("modifyend",()=>i.emitDrawnFeatures()),{EoxMap:e,OlMap:s}},ee=(i,t,e)=>{const s=()=>{i.drawnFeatures=[],i.draw.setActive(!1),i.drawLayer.getSource().clear(),t.removeInteraction("drawInteraction"),e.removeLayer(i.drawLayer)},r=()=>{i.emitDrawnFeatures(),i.currentlyDrawing=!1,i.requestUpdate()};s(),r()},se=(i,t)=>{setTimeout(()=>{i.drawnFeatures=i.drawLayer.getSource().getFeatures(),i.requestUpdate(),t()},0)};class _t extends v{constructor(){super();z(this,M,void 0);z(this,k,void 0);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.showList=!1,this.type="Polygon",this.unstyled=!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},showList:{attribute:"show-list",type:Boolean},type:{type:String},unstyled:{type:Boolean}}}initDrawLayer(){const{EoxMap:e,OlMap:s}=te(this);j(this,M,e),j(this,k,s)}handleStartDrawing(){Yt(this)}handleDiscardDrawing(){ee(this,S(this,M),S(this,k))}onDrawEnd(){mt(this)}onModifyEnd(){this.emitDrawnFeatures()}emitDrawnFeatures(){se(this,()=>{this.dispatchEvent(new CustomEvent("drawupdate",{detail:this.drawnFeatures}))})}render(){var e;return N`
258
+ <style>
259
+ ${Xt}
260
+ ${!this.unstyled&&X}
261
+ </style>
262
+
263
+ <!-- Controller Component -->
264
+ <eox-drawtools-controller
265
+ .drawFunc=${{start:()=>this.handleStartDrawing(),discard:()=>this.handleDiscardDrawing()}}
266
+ .unstyled=${this.unstyled}
267
+ .drawnFeatures=${this.drawnFeatures}
268
+ .currentlyDrawing=${this.currentlyDrawing}
269
+ .multipleFeatures=${this.multipleFeatures}
270
+ ></eox-drawtools-controller>
271
+
272
+ <!-- List Component -->
273
+ ${this.showList&&((e=this.drawnFeatures)!=null&&e.length)?N`<eox-drawtools-list
274
+ .eoxMap=${S(this,M)}
275
+ .olMap=${S(this,k)}
257
276
  .draw=${this.draw}
258
- .layer=${this.layer}
259
277
  .drawLayer=${this.drawLayer}
260
278
  .drawnFeatures=${this.drawnFeatures}
261
279
  .modify=${this.modify}
262
280
  .unstyled=${this.unstyled}
263
281
  @changed=${()=>this.requestUpdate()}
264
- >
265
- </eox-drawtools-list>`:c}
266
- `}}f=new WeakMap,H=new WeakMap,customElements.define("eox-drawtools",yt),l.EOxDrawTools=yt,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
282
+ ></eox-drawtools-list>`:p}
283
+ `}}M=new WeakMap,k=new WeakMap,customElements.define("eox-drawtools",_t),d.EOxDrawTools=_t,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eox/drawtools",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "type": "module",
5
5
  "devDependencies": {
6
6
  "@eox/eslint-config": "^1.0.0",
@@ -9,7 +9,7 @@
9
9
  "eslint-plugin-typescript": "^0.14.0",
10
10
  "ol": "^8.1.0",
11
11
  "typescript": "^5.2.2",
12
- "vite": "^4.0.0"
12
+ "vite": "^5.0.2"
13
13
  },
14
14
  "engines": {
15
15
  "npm": ">=8.0.0",
package/test/_mockMap.js CHANGED
@@ -1,32 +1,51 @@
1
+ // Defining a MockMap class extending HTMLElement
1
2
  export class MockMap extends HTMLElement {
2
3
  constructor() {
3
4
  super();
5
+ // Initializing features array
6
+ this.features = [];
7
+ // Simulating a map object with necessary methods
8
+ this.map = {
9
+ // Simulating getLayers method
10
+ getLayers: () => ({
11
+ // Simulating getArray method
12
+ getArray: () => [
13
+ {
14
+ // Simulating get method
15
+ get: () => "draw",
16
+ getSource: () => ({
17
+ // Simulating clear method to reset features array
18
+ clear: () => {
19
+ this.features = [];
20
+ },
21
+ // Simulating getFeatures method
22
+ getFeatures: () => this.features,
23
+ }),
24
+ },
25
+ ],
26
+ }),
27
+ // Simulating removeLayer method
28
+ removeLayer() {},
29
+ };
30
+ // Simulating addOrUpdateLayer method
31
+ this.addOrUpdateLayer = () => this.map.getLayers().getArray()[0];
32
+ // Simulating interactions object with necessary methods
33
+ this.interactions = {
34
+ drawInteraction: {
35
+ // Simulating on method for drawInteraction
36
+ on: (event, fun) => fun(event),
37
+ // Simulating setActive method for drawInteraction
38
+ setActive() {},
39
+ },
40
+ drawInteraction_modify: {
41
+ // Simulating on method for drawInteraction_modify
42
+ on() {},
43
+ },
44
+ };
45
+ // Simulating removeInteraction method
46
+ this.removeInteraction = () => {};
4
47
  }
5
- features = [{}];
6
- map = {
7
- getLayers: () => ({
8
- getArray: () => [
9
- {
10
- get: () => "draw",
11
- getSource: () => ({
12
- clear: () => {
13
- this.features = [];
14
- },
15
- getFeatures: () => this.features,
16
- }),
17
- },
18
- ],
19
- }),
20
- };
21
- addDraw() {}
22
- interactions = {
23
- drawInteraction: {
24
- on: (event, fun) => fun(event),
25
- },
26
- drawInteraction_modify: {
27
- on() {},
28
- },
29
- };
30
- removeInteraction() {}
31
48
  }
49
+
50
+ // Registering the MockMap custom element
32
51
  customElements.define("mock-map", MockMap);
@@ -0,0 +1,34 @@
1
+ import { TEST_SELECTORS } from "../../src/enums";
2
+
3
+ // Destructure TEST_SELECTORS object
4
+ const { drawTools, controller, drawBtn, discardBtn } = TEST_SELECTORS;
5
+
6
+ /**
7
+ * Clicks the discard button and verifies if drawn features are cleared.
8
+ */
9
+ const clickDiscardBtnTest = () => {
10
+ it("clicks the discard button and clears drawn features", () => {
11
+ cy.get(drawTools)
12
+ .shadow()
13
+ .within(() => {
14
+ cy.get(controller)
15
+ .shadow()
16
+ .within(() => {
17
+ // Click the draw button and verify if it is in the 'drawing' state
18
+ cy.get(drawBtn).click();
19
+ cy.get(drawBtn).contains("drawing");
20
+
21
+ // Click the discard button and verify if the 'drawing' state is removed
22
+ cy.get(discardBtn).click();
23
+ cy.get(drawBtn).should("not.contain", "drawing");
24
+ });
25
+ });
26
+
27
+ // Verify if drawn features array is empty after discarding
28
+ cy.get(drawTools).should(($el) => {
29
+ expect($el[0].drawnFeatures).to.have.length(0);
30
+ });
31
+ });
32
+ };
33
+
34
+ export default clickDiscardBtnTest;
@@ -0,0 +1,31 @@
1
+ import { TEST_SELECTORS } from "../../src/enums";
2
+
3
+ // Destructure TEST_SELECTORS object
4
+ const { drawTools, controller, drawBtn } = TEST_SELECTORS;
5
+
6
+ /**
7
+ * Clicks the draw button and verifies the 'drawing' state.
8
+ */
9
+ const clickDrawBtnTest = () => {
10
+ it("clicks the draw button", () => {
11
+ cy.get(drawTools)
12
+ .shadow()
13
+ .within(() => {
14
+ cy.get(controller)
15
+ .shadow()
16
+ .within(() => {
17
+ // Verify the initial state of the draw button
18
+ cy.get(drawBtn).contains("draw");
19
+ cy.get(drawBtn).should("not.contain", "drawing");
20
+
21
+ // Click the draw button and verify the 'drawing' state
22
+ cy.get(drawBtn).click();
23
+ cy.get(drawBtn).contains("drawing");
24
+ });
25
+ });
26
+
27
+ // TODO: Simulate drawing and add drawn features (not implemented in the current test)
28
+ });
29
+ };
30
+
31
+ export default clickDrawBtnTest;
@@ -0,0 +1,5 @@
1
+ // Exported test methods
2
+
3
+ export { default as clickDiscardBtnTest } from "./click-discard-btn"; // Test for clicking the discard button
4
+ export { default as clickDrawBtnTest } from "./click-draw-btn"; // Test for clicking the draw button
5
+ export { default as loadDrawToolsTest } from "./load-drawtool"; // Test for loading the drawtools component
@@ -0,0 +1,16 @@
1
+ import { TEST_SELECTORS } from "../../src/enums";
2
+
3
+ // Destructure TEST_SELECTORS object
4
+ const { drawTools } = TEST_SELECTORS;
5
+
6
+ /**
7
+ * Test to verify if the drawtools component loads successfully.
8
+ */
9
+ const loadDrawToolsTest = () => {
10
+ it("loads the drawtools", () => {
11
+ // Find the drawTools element and access its shadow DOM
12
+ cy.get(drawTools).shadow();
13
+ });
14
+ };
15
+
16
+ export default loadDrawToolsTest;
@@ -1,44 +1,32 @@
1
+ // Importing necessary modules, test cases, and enums
1
2
  import "../src/main";
2
3
  import "./_mockMap";
4
+ import {
5
+ clickDiscardBtnTest,
6
+ clickDrawBtnTest,
7
+ loadDrawToolsTest,
8
+ } from "./cases";
9
+ import { TEST_SELECTORS } from "../src/enums";
3
10
 
11
+ // Destructuring TEST_SELECTORS object
12
+ const { drawTools } = TEST_SELECTORS;
13
+
14
+ // Test suite for Drawtools
4
15
  describe("Drawtools", () => {
16
+ // Setting up the environment before each test
5
17
  beforeEach(() => {
18
+ // Mounting mock-map and eox-drawtools elements
6
19
  cy.mount("<mock-map></mock-map>").as("mock-map");
7
- cy.mount(
8
- `
9
- <eox-drawtools for="mock-map" layer="draw"></eox-drawtools>`
10
- ).as("eox-drawtools");
20
+ cy.mount(`<eox-drawtools for="mock-map"></eox-drawtools>`).as(drawTools);
11
21
  });
12
22
 
13
- it("loads the drawtools", () => {
14
- cy.get("eox-drawtools").shadow();
15
- });
23
+ // Test case to ensure the drawtools component loads successfully
24
+ it("loads the drawtools", () => loadDrawToolsTest());
16
25
 
17
- it("clicks the draw button", () => {
18
- cy.get("eox-drawtools")
19
- .shadow()
20
- .within(() => {
21
- cy.get("[data-cy='drawBtn']").contains("draw");
22
- cy.get("[data-cy='drawBtn']").should("not.contain", "drawing");
23
- cy.get("[data-cy='drawBtn']").click();
24
- cy.get("[data-cy='drawBtn']").contains("drawing");
25
- });
26
- cy.get("eox-drawtools").and(($el) => {
27
- expect($el[0].drawnFeatures).to.have.length(1);
28
- });
29
- });
26
+ // Test case to simulate clicking the draw button
27
+ it("clicks the draw button", () => clickDrawBtnTest());
30
28
 
31
- it("clicks the discard button and clears drawn features", () => {
32
- cy.get("eox-drawtools")
33
- .shadow()
34
- .within(() => {
35
- cy.get("[data-cy='drawBtn']").click();
36
- cy.get("[data-cy='drawBtn']").contains("drawing");
37
- cy.get("[data-cy='discardBtn']").click();
38
- cy.get("[data-cy='drawBtn']").should("not.contain", "drawing");
39
- });
40
- cy.get("eox-drawtools").should(($el) => {
41
- expect($el[0].drawnFeatures).to.have.length(0);
42
- });
43
- });
29
+ // Test case to simulate clicking the discard button and clearing drawn features
30
+ it("clicks the discard button and clears drawn features", () =>
31
+ clickDiscardBtnTest());
44
32
  });