@eox/drawtools 0.6.1 → 0.8.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,220 +1,52 @@
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);/**
1
+ (function(h,l){typeof exports=="object"&&typeof module<"u"?l(exports):typeof define=="function"&&define.amd?define(["exports"],l):(h=typeof globalThis<"u"?globalThis:h||self,l(h["eox-drawtools"]={}))})(this,function(h){"use strict";var ye=Object.defineProperty;var ge=(h,l,y)=>l in h?ye(h,l,{enumerable:!0,configurable:!0,writable:!0,value:y}):h[l]=y;var C=(h,l,y)=>(ge(h,typeof l!="symbol"?l+"":l,y),y),xt=(h,l,y)=>{if(!l.has(h))throw TypeError("Cannot "+y)};var m=(h,l,y)=>(xt(h,l,"read from private field"),y?y.call(h):l.get(h)),M=(h,l,y)=>{if(l.has(h))throw TypeError("Cannot add the same private member more than once");l instanceof WeakSet?l.add(h):l.set(h,y)},U=(h,l,y,O)=>(xt(h,l,"write to private field"),O?O.call(h,y):l.set(h,y),y);/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
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;/**
5
+ */var _t,z,D,v,j,J;const l=globalThis,y=l.ShadowRoot&&(l.ShadyCSS===void 0||l.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,O=Symbol(),Y=new WeakMap;let At=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==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 i=e!==void 0&&e.length===1;i&&(t=Y.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&Y.set(e,t))}return t}toString(){return this.cssText}};const St=r=>new At(typeof r=="string"?r:r+"",void 0,O),Et=(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)}},tt=y?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return St(e)})(r):r;/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
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");/**
9
+ */const{is:Ct,defineProperty:Ft,getOwnPropertyDescriptor:Ht,getOwnPropertyNames:kt,getOwnPropertySymbols:Mt,getPrototypeOf:Ut}=Object,b=globalThis,et=b.trustedTypes,Ot=et?et.emptyScript:"",W=b.reactiveElementPolyfillSupport,P=(r,t)=>r,Z={toAttribute(r,t){switch(t){case Boolean:r=r?Ot: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}},it=(r,t)=>!Ct(r,t),rt={attribute:!0,type:String,converter:Z,reflect:!1,hasChanged:it};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),b.litPropertyMetadata??(b.litPropertyMetadata=new WeakMap);class F 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=rt){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&&Ft(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:n}=Ht(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 c=s==null?void 0:s.call(this);n.call(this,o),this.requestUpdate(t,c,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??rt}static _$Ei(){if(this.hasOwnProperty(P("elementProperties")))return;const t=Ut(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,i=[...kt(e),...Mt(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(tt(s))}else t!==void 0&&e.push(tt(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 Et(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),c=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]=c.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,i){if(t!==void 0){if(i??(i=this.constructor.getPropertyOptions(t)),!(i.hasChanged??it)(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){}}F.elementStyles=[],F.shadowRootOptions={mode:"open"},F[P("elementProperties")]=new Map,F[P("finalized")]=new Map,W==null||W({ReactiveElement:F}),(b.reactiveElementVersions??(b.reactiveElementVersions=[])).push("2.0.4");/**
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
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};/**
13
+ */const N=globalThis,T=N.trustedTypes,st=T?T.createPolicy("lit-html",{createHTML:r=>r}):void 0,nt="$lit$",$=`lit$${(Math.random()+"").slice(9)}$`,ot="?"+$,Pt=`<${ot}>`,_=document,I=()=>_.createComment(""),B=r=>r===null||typeof r!="object"&&typeof r!="function",at=Array.isArray,Nt=r=>at(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",K=`[
14
+ \f\r]`,L=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,lt=/-->/g,ct=/>/g,x=RegExp(`>|${K}(?:([^\\s"'>=/]+)(${K}*=${K}*(?:[^
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),ht=/'/g,dt=/"/g,pt=/^(?:script|style|textarea|title)$/i,It=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),A=It(1),H=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),ut=new WeakMap,S=_.createTreeWalker(_,129);function yt(r,t){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return st!==void 0?st.createHTML(t):t}const Bt=(r,t)=>{const e=r.length-1,i=[];let s,n=t===2?"<svg>":"",o=L;for(let c=0;c<e;c++){const a=r[c];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=x):g[3]!==void 0&&(o=x):o===x?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?x:g[3]==='"'?dt:ht):o===dt||o===ht?o=x:o===lt||o===ct?o=L:(o=x,s=void 0);const w=o===x&&r[c+1].startsWith("/>")?" ":"";n+=o===L?a+Pt:d>=0?(i.push(u),a.slice(0,d)+nt+a.slice(d)+$+w):a+$+(d===-2?c:w)}return[yt(r,n+(r[e]||"<?>")+(t===2?"</svg>":"")),i]};class R{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let n=0,o=0;const c=t.length-1,a=this.parts,[u,g]=Bt(t,e);if(this.el=R.createElement(u,i),S.currentNode=this.el.content,e===2){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(s=S.nextNode())!==null&&a.length<c;){if(s.nodeType===1){if(s.hasAttributes())for(const d of s.getAttributeNames())if(d.endsWith(nt)){const f=g[o++],w=s.getAttribute(d).split($),G=/([.?@])?(.*)/.exec(f);a.push({type:1,index:n,name:G[2],strings:w,ctor:G[1]==="."?Rt:G[1]==="?"?Vt:G[1]==="@"?zt:q}),s.removeAttribute(d)}else d.startsWith($)&&(a.push({type:6,index:n}),s.removeAttribute(d));if(pt.test(s.tagName)){const d=s.textContent.split($),f=d.length-1;if(f>0){s.textContent=T?T.emptyScript:"";for(let w=0;w<f;w++)s.append(d[w],I()),S.nextNode(),a.push({type:2,index:++n});s.append(d[f],I())}}}else if(s.nodeType===8)if(s.data===ot)a.push({type:2,index:n});else{let d=-1;for(;(d=s.data.indexOf($,d+1))!==-1;)a.push({type:7,index:n}),d+=$.length-1}n++}}static createElement(t,e){const i=_.createElement("template");return i.innerHTML=t,i}}function k(r,t,e=r,i){var o,c;if(t===H)return t;let s=i!==void 0?(o=e._$Co)==null?void 0:o[i]:e._$Cl;const n=B(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==n&&((c=s==null?void 0:s._$AO)==null||c.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=k(r,s._$AS(r,t.values),s,i)),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:i}=this._$AD,s=((t==null?void 0:t.creationScope)??_).importNode(e,!0);S.currentNode=s;let n=S.nextNode(),o=0,c=0,a=i[0];for(;a!==void 0;){if(o===a.index){let u;a.type===2?u=new V(n,n.nextSibling,this,t):a.type===1?u=new a.ctor(n,a.name,a.strings,this,t):a.type===6&&(u=new Dt(n,this,t)),this._$AV.push(u),a=i[++c]}o!==(a==null?void 0:a.index)&&(n=S.nextNode(),o++)}return S.currentNode=_,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 V{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=k(this,t,e),B(t)?t===p||t==null||t===""?(this._$AH!==p&&this._$AR(),this._$AH=p):t!==this._$AH&&t!==H&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Nt(t)?this.k(t):this._(t)}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}_(t){this._$AH!==p&&B(this._$AH)?this._$AA.nextSibling.data=t:this.T(_.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 Lt(s,this),c=o.u(this.options);o.p(e),this.T(c),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){at(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 V(this.S(I()),this.S(I()),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=k(this,t,e,0),o=!B(t)||t!==this._$AH&&t!==H,o&&(this._$AH=t);else{const c=t;let a,u;for(t=n[0],a=0;a<n.length-1;a++)u=k(this,c[i+a],e,a),u===H&&(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 Rt extends q{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===p?void 0:t}}class Vt extends q{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==p)}}class zt extends q{constructor(t,e,i,s,n){super(t,e,i,s,n),this.type=5}_$AI(t,e=this){if((t=k(this,t,e,0)??p)===H)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 Dt{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){k(this,t)}}const Q=N.litHtmlPolyfillSupport;Q==null||Q(R,V),(N.litHtmlVersions??(N.litHtmlVersions=[])).push("3.1.2");const jt=(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 V(t.insertBefore(I(),n),n,void 0,e??{})}return s._$AI(r),s};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
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");/**
19
+ */class E extends F{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=jt(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 H}}E._$litElement$=!0,E.finalized=!0,(_t=globalThis.litElementHydrateSupport)==null||_t.call(globalThis,{LitElement:E});const X=globalThis.litElementPolyfillSupport;X==null||X({LitElement:E}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.4");/**
20
20
  * @license
21
21
  * Copyright 2017 Google LLC
22
22
  * SPDX-License-Identifier: BSD-3-Clause
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)}};/**
23
+ */const Jt=r=>(...t)=>({_$litDirective$:r,values:t});let Tt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};/**
24
24
  * @license
25
25
  * Copyright 2020 Google LLC
26
26
  * SPDX-License-Identifier: BSD-3-Clause
27
- */const qt={},Tt=(i,t=qt)=>i._$AH=t;/**
27
+ */const qt={},Gt=(r,t=qt)=>r._$AH=t;/**
28
28
  * @license
29
29
  * Copyright 2021 Google LLC
30
30
  * SPDX-License-Identifier: BSD-3-Clause
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
- * {
33
- font-family: Roboto, sans-serif;
34
- }
35
-
36
-
37
- button {
38
- /* TODO: why does this only work here and not from :root? */
39
- --primary-color: #004170;
40
- --primary-color-hover: #004170CC;
41
- --error-color: #FF5252;
42
-
43
- display: inline-flex;
44
- position: relative;
45
- align-items: center;
46
- color: #fff;
47
- border-width: 0;
48
- outline: none;
49
- border-radius: 4px;
50
- padding: 16px;
51
- height: 36px;
52
- cursor: pointer;
53
- font-family: inherit;
54
- font-size: 0.875rem;
55
- text-transform: uppercase;
56
- letter-spacing: 1.25px;
57
- font-weight: 500;
58
- 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);
59
- transition-property: box-shadow, transform, opacity, background;
60
- transition-duration: 0.28s;
61
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
62
- }
63
-
64
- button:hover:not([disabled]):not(.icon) {
65
- 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);
66
- background: var(--primary-color-hover);
67
- }
68
-
69
- button, button:active {
70
- background: var(--primary-color);
71
- }
72
-
73
- button[disabled] {
74
- opacity: 0.5;
75
- }
76
-
77
- button.outline {
78
- background: transparent;
79
- box-shadow: none;
80
- color: var(--primary-color);
81
- outline: 1px solid var(--primary-color);
82
- }
83
-
84
- button.outline:hover {
85
- background: transparent;
86
- }
87
-
88
- button.icon {
89
- background: transparent;
90
- border: none;
91
- box-shadow: none;
92
- padding: 0;
93
- border-radius: 50%;
94
- width: 24px;
95
- height: 24px;
96
- text-indent: -9999px;
97
- }
98
-
99
- button.icon-text {
100
- text-indent: 26px;
101
- }
102
-
103
- button.icon:before, button.icon-text:before {
104
- position: absolute;
105
- text-indent: 0;
106
- line-height: initial;
107
- }
108
-
109
- button.icon:before {
110
- width: 24px;
111
- height: 24px;
112
- margin-right: 0;
113
- }
114
-
115
- button.icon-text:before {
116
- width: 18px;
117
- height: 18px;
118
- }
119
-
120
- button.small {
121
- height: 28px;
122
- padding: 12.4px;
123
- font-size: .75rem;
124
- }
125
-
126
-
127
- button.discard:before {
128
- 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")
129
- }
130
-
131
- button.polygon:before {
132
- 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");
133
- }
134
- ul {
135
- padding: 0;
136
- }
137
- ul ul {
138
- padding-left: 48px;
139
- }
140
- li:hover {
141
- background: #f0f5f9;
142
- }
143
- li.selected {
144
- background: #f0f5f9;
145
- }
146
- li {
147
- list-style: none;
148
- padding: 4px;
149
- }
150
- li {
151
- border-bottom: 1px solid #0041703a;
152
- }
153
- li:first-child {
154
- border-top: 1px solid #0041703a;
155
- }
156
- li.sortable-chosen {
157
- background: #eeea;
158
- }
159
- li.sortable-drag {
160
- opacity: 0;
161
- }
162
- li.sortable-ghost {
163
- }
164
- button.small.icon, button.small.icon::before {
165
- height: 16px;
166
- width: 16px;
167
- padding: 0px;
168
- }
169
- button.discard.icon {
170
- opacity: .7;
171
- }
172
- button.discard.icon:hover {
173
- opacity: 1;
174
- }
175
- eox-drawtools-list {
176
- width: 100%;
177
- }
178
- .list {
179
- width: 100%;
180
- align-items: center;
181
- justify-content: space-between;
182
- display: flex;
183
- align-items: center;
184
- cursor: pointer;
185
- font-size: small;
186
- gap: 10px;
187
-
188
- }
189
- label {
190
- gap: 10px;
191
- }
192
- label, span {
193
- display: flex;
194
- align-items: center;
195
- cursor: pointer;
196
- font-size: small;
197
- flex-grow: 1;
198
- }
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`
31
+ */const Wt=Jt(class extends Tt{constructor(){super(...arguments),this.key=p}render(r,t){return this.key=r,t}update(r,[t,e]){return t!==this.key&&(Gt(r),this.key=t),e}}),Zt=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)},Kt=(r,t,e)=>{if(r.clickId===t)return;const i=e?[]:[t];r.hoverInteraction.highlightById(i)},Qt=(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:[]},Xt=(r,t)=>{const e=r.get("id"),{clickId:i,drawLayer:s,olMap:n,clickInteraction:o}=t,c=i===e,a=r.getGeometry();if(c){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()},Yt="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 E{constructor(){super();C(this,"hoverInteraction");C(this,"clickInteraction");C(this,"hoverId");C(this,"clickId");this.eoxMap=null,this.olMap=null,this.draw=null,this.drawLayer=null,this.drawnFeatures=[],this.modify=null,this.unstyled=!1}_handleDelete(e){Qt(e,this),this.dispatchEvent(new CustomEvent("changed",{bubbles:!0}))}_handleFeatureSelectAndDeselect(e){Xt(e,this)}_handleHoverFeature(e,i=!1){Kt(this,e,i)}firstUpdated(){Zt(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],A`
200
32
  <style>
201
- ${!this.unstyled&&X}
33
+ ${!this.unstyled&&Yt}
202
34
  </style>
203
- <ul>
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`
35
+ <ul class="list-wrap">
36
+ ${this.drawnFeatures.map((s,n)=>{const o=n+1,c=s.get("id"),a=this.hoverId===c,u=this.clickId===c;return Wt(o,A`
205
37
  <li
206
38
  class="${a||u?"selected":p}"
207
- @mouseover=${()=>this._handleHoverFeature(h)}
208
- @mouseout=${()=>this._handleHoverFeature(h,!0)}
39
+ @mouseover=${()=>this._handleHoverFeature(c)}
40
+ @mouseout=${()=>this._handleHoverFeature(c,!0)}
209
41
  >
210
42
  <div
211
43
  class="list"
212
- @click="${()=>this._handleFeatureSelectAndDeselect(r)}"
44
+ @click="${()=>this._handleFeatureSelectAndDeselect(s)}"
213
45
  >
214
46
  <span class="title">Feature #${o}</span>
215
47
  <button
216
48
  index=${n}
217
- class="icon small discard"
49
+ class="icon smallest discard"
218
50
  @click="${this._handleDelete}"
219
51
  >
220
52
  x
@@ -223,61 +55,150 @@ button.small {
223
55
  </li>
224
56
  `)})}
225
57
  </ul>
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`
58
+ `}}C(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 te=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}},ee='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;}',ie='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 re(r){navigator.clipboard.writeText(r).then(function(){},function(t){console.error("Could not copy text: ",t)})}/**
59
+ * @license
60
+ * Copyright 2021 Google LLC
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 E{constructor(){super();M(this,z,!0);M(this,D,!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}=te(this);U(this,z,e),U(this,D,i)}createRenderRoot(){return this}render(){this.updateButtonStates();const e=this.currentlyDrawing?"drawing":"draw";return A`
227
63
  <style>
228
- ${!this.unstyled&&X}
64
+ ${!this.unstyled&&ee}
65
+ ${!this.unstyled&&ie}
229
66
  </style>
230
- <div>
67
+ <div class="wrap-btn">
231
68
  <slot></slot>
232
-
233
- <!-- Draw Button -->
234
- <button
235
- data-cy="drawBtn"
236
- class="polygon icon"
237
- ?disabled="${S(this,V)||p}"
238
- @click="${()=>this.drawFunc.start()}"
239
- >
240
- ${e}
241
- </button>
242
-
243
- <!-- Discard Button -->
244
- <button
245
- data-cy="discardBtn"
246
- class="discard icon"
247
- ?disabled="${S(this,R)||p}"
248
- @click="${()=>this.drawFunc.discard()}"
249
- >
250
- discard
251
- </button>
69
+ <div>
70
+ <!-- Draw Button -->
71
+ <button
72
+ data-cy="drawBtn"
73
+ class="polygon icon"
74
+ ?disabled="${m(this,z)||p}"
75
+ @click="${()=>this.drawFunc.start()}"
76
+ >
77
+ ${e}
78
+ </button>
79
+
80
+ <!-- Discard Button -->
81
+ <button
82
+ data-cy="discardBtn"
83
+ class="discard icon"
84
+ ?disabled="${m(this,D)||p}"
85
+ @click="${()=>this.drawFunc.discard()}"
86
+ >
87
+ discard
88
+ </button>
89
+ </div>
90
+
91
+ <!-- Import Button -->
92
+ ${bt(this.importFeatures,()=>A`
93
+ <!-- Import Input Field : Hidden -->
94
+ <input
95
+ type="file"
96
+ id="import-file"
97
+ style="display: none;"
98
+ @change=${this.drawFunc.import}
99
+ />
100
+
101
+ <!-- Main Import Button -->
102
+ <button
103
+ data-cy="importBtn"
104
+ class="import icon"
105
+ @click=${()=>this.querySelector("#import-file").click()}
106
+ >
107
+ import
108
+ </button>
109
+ `)}
252
110
  </div>
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`
111
+
112
+ <!-- Geo JSON Wrapper -->
113
+ ${bt(this.showEditor,()=>A`
114
+ <div class="json-wrapper">
115
+ <!-- Geo JSON Editor -->
116
+ <textarea
117
+ @drop=${this.drawFunc.import}
118
+ @input=${this.drawFunc.editor}
119
+ .value=${this.geoJSON}
120
+ ></textarea>
121
+
122
+ <!-- Geo JSON Copy Button -->
123
+ <button
124
+ data-cy="copyBtn"
125
+ class="icon-copy"
126
+ @click=${()=>re(this.geoJSON)}
127
+ >
128
+ ${this.unstyled?"copy":p}
129
+ </button>
130
+ </div>
131
+ `)}
132
+ `}}z=new WeakMap,D=new WeakMap,C($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 se=`
133
+ button.discard:before {
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
+ }
136
+ button.polygon: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%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
+ }
139
+ button.import:before {
140
+ content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ctitle%3Eupload%3C/title%3E%3Cpath fill='%23004170' d='M9,16V10H5L12,3L19,10H15V16H9M5,20V18H19V20H5Z' /%3E%3C/svg%3E");
141
+ }
142
+ .wrap-btn {
143
+ display: flex;
144
+ justify-content: space-between;
145
+ }
146
+ eox-drawtools-list {
147
+ width: 100%;
148
+ }
149
+ .json-wrapper {
150
+ margin: 0.4rem 0rem;
151
+ padding: 0.75rem;
152
+ background: var(--secondary-color-hover);
153
+ position: relative;
154
+ }
155
+ .json-wrapper textarea {
156
+ height: 200px;
157
+ }
158
+ .icon-copy {
159
+ position: absolute;
160
+ bottom: 26px;
161
+ right: 26px;
162
+ border-radius: 4px;
163
+ height: 26px;
164
+ padding: 4px 6px;
165
+ }
166
+ .icon-copy:before {
167
+ width: 14px;
168
+ min-width: 14px;
169
+ height: 14px;
170
+ display: flex margin-right: 6px;
171
+ color: white;
172
+ 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
+ }
174
+ `,ne=r=>{(()=>{r.emitDrawnFeatures(),r.multipleFeatures||(r.draw.setActive(!1),r.currentlyDrawing=!1)})(),r.requestUpdate()},oe=r=>{const t=()=>{r.drawLayer.set("isDrawingEnabled",!0),r.draw.setActive(!0)},e=()=>{r.currentlyDrawing=!0,r.requestUpdate()};t(),e()},ae=(r,t)=>{var n;const i=document.querySelector(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",()=>ne(r)),{EoxMap:i,OlMap:s}},le=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()},ce=(r,t)=>{setTimeout(()=>{r.drawnFeatures=r.drawLayer.getSource().getFeatures(),r.updateGeoJSON(),r.requestUpdate(),t()},0)},he=':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 de(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=>vt(n,r),!1)}function pe(r){r.preventDefault(),r.stopPropagation()}function vt(r,t){pe(r);const e=r.dataTransfer?r.dataTransfer.files:r.target.files;Array.from(e).forEach(i=>ue(i,t))}function ue(r,t){const e=new FileReader;e.readAsText(r),e.onloadend=function(){typeof e.result=="string"&&t.handleFeatureChange(e.result)}}class wt extends E{constructor(){super();M(this,v,void 0);M(this,j,void 0);M(this,J,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.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(){oe(this)}handleDiscardDrawing(){le(this)}handleFeatureChange(e,i=!1){m(this,v).parseTextToFeature(e||JSON.stringify(ft),this.drawLayer,i)}handleFilesChange(e){vt(e,this)}onModifyEnd(){this.emitDrawnFeatures()}updateGeoJSON(){U(this,J,JSON.stringify(m(this,v).parseFeature(this.drawnFeatures)||ft,void 0,2))}emitDrawnFeatures(){ce(this,()=>{this.dispatchEvent(new CustomEvent("drawupdate",{detail:this.drawnFeatures}))})}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}firstUpdated(){const{EoxMap:e,OlMap:i}=ae(this,this.multipleFeatures);U(this,v,e),U(this,j,i),this.importFeatures&&de(this,m(this,v)),this.updateGeoJSON(),this.requestUpdate()}render(){var e;return A`
258
175
  <style>
259
- ${Xt}
260
- ${!this.unstyled&&X}
176
+ :host { display: block; }
177
+ ${!this.unstyled&&he}
178
+ ${!this.unstyled&&se}
261
179
  </style>
262
180
 
263
181
  <!-- Controller Component -->
264
182
  <eox-drawtools-controller
265
- .drawFunc=${{start:()=>this.handleStartDrawing(),discard:()=>this.handleDiscardDrawing()}}
183
+ .drawFunc=${{start:()=>this.handleStartDrawing(),discard:()=>this.handleDiscardDrawing(),editor:i=>this.handleFeatureChange(i.target.value,!0),import:i=>this.handleFilesChange(i)}}
266
184
  .unstyled=${this.unstyled}
267
185
  .drawnFeatures=${this.drawnFeatures}
268
186
  .currentlyDrawing=${this.currentlyDrawing}
269
187
  .multipleFeatures=${this.multipleFeatures}
188
+ .importFeatures=${this.importFeatures}
189
+ .showEditor=${this.showEditor}
190
+ .geoJSON=${m(this,J)}
270
191
  ></eox-drawtools-controller>
271
192
 
272
193
  <!-- 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)}
194
+ ${this.showList&&((e=this.drawnFeatures)!=null&&e.length)?A`<eox-drawtools-list
195
+ .eoxMap=${m(this,v)}
196
+ .olMap=${m(this,j)}
276
197
  .draw=${this.draw}
277
198
  .drawLayer=${this.drawLayer}
278
199
  .drawnFeatures=${this.drawnFeatures}
279
200
  .modify=${this.modify}
280
201
  .unstyled=${this.unstyled}
281
- @changed=${()=>this.requestUpdate()}
202
+ @changed=${()=>{this.updateGeoJSON(),this.requestUpdate()}}
282
203
  ></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"})});
204
+ `}}v=new WeakMap,j=new WeakMap,J=new WeakMap,customElements.define("eox-drawtools",wt),h.EOxDrawTools=wt,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@eox/drawtools",
3
- "version": "0.6.1",
3
+ "version": "0.8.1",
4
4
  "type": "module",
5
5
  "devDependencies": {
6
6
  "@eox/eslint-config": "^1.0.0",
7
- "@typescript-eslint/eslint-plugin": "^6.8.0",
8
- "@typescript-eslint/parser": "^6.8.0",
7
+ "@typescript-eslint/eslint-plugin": "^7.0.1",
8
+ "@typescript-eslint/parser": "^7.0.1",
9
9
  "eslint-plugin-typescript": "^0.14.0",
10
- "ol": "^8.1.0",
10
+ "ol": "^9.0.0",
11
11
  "typescript": "^5.2.2",
12
12
  "vite": "^5.0.2"
13
13
  },
package/test/_mockMap.js CHANGED
@@ -13,6 +13,7 @@ export class MockMap extends HTMLElement {
13
13
  {
14
14
  // Simulating get method
15
15
  get: () => "draw",
16
+ set: () => "",
16
17
  getSource: () => ({
17
18
  // Simulating clear method to reset features array
18
19
  clear: () => {
@@ -44,6 +45,8 @@ export class MockMap extends HTMLElement {
44
45
  };
45
46
  // Simulating removeInteraction method
46
47
  this.removeInteraction = () => {};
48
+ // Simulate parse features
49
+ this.parseFeature = () => {};
47
50
  }
48
51
  }
49
52
 
@@ -7,27 +7,23 @@ const { drawTools, controller, drawBtn, discardBtn } = TEST_SELECTORS;
7
7
  * Clicks the discard button and verifies if drawn features are cleared.
8
8
  */
9
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");
10
+ cy.get(drawTools)
11
+ .shadow()
12
+ .within(() => {
13
+ cy.get(controller).within(() => {
14
+ // Click the draw button and verify if it is in the 'drawing' state
15
+ cy.get(drawBtn).click();
16
+ cy.get(drawBtn).contains("drawing");
20
17
 
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
- });
18
+ // Click the discard button and verify if the 'drawing' state is removed
19
+ cy.get(discardBtn).click();
20
+ cy.get(drawBtn).should("not.contain", "drawing");
25
21
  });
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
22
  });
23
+
24
+ // Verify if drawn features array is empty after discarding
25
+ cy.get(drawTools).should(($el) => {
26
+ expect($el[0].drawnFeatures).to.have.length(0);
31
27
  });
32
28
  };
33
29