@digital-blueprint/checkin-app
Version:
[GitHub Repository](https://github.com/digital-blueprint/checkin-app) | [npmjs package](https://www.npmjs.com/package/@digital-blueprint/checkin-app) | [Unpkg CDN](https://unpkg.com/browse/@digital-blueprint/checkin-app/) | [Checkin Bundle](https://github
366 lines (319 loc) • 124 kB
JavaScript
let t,e,n,o,i,r,a,s,l,c,d,h,u,p,g,f,m,b,v,y,w,k,_,x,E=t=>t;function C(){return C=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},C.apply(this,arguments)}
/*!
* License: LGPL-2.1-or-later
* Dependencies:
*
* @webcomponents/scoped-custom-element-registry: 0.0.9 (BSD-3-Clause)
* @dbp-toolkit/app-shell: 0.3.4 (LGPL-2.1-or-later)
* @dbp-toolkit/language-select: 0.3.2 (LGPL-2.1-or-later)
* @dbp-toolkit/common: 0.3.5 (LGPL-2.1-or-later)
* @dbp-toolkit/auth: 0.3.2 (LGPL-2.1-or-later)
* event-target-shim: 6.0.2 (MIT)
* @dbp-toolkit/notification: 0.3.2 (LGPL-2.1-or-later)
* @dbp-toolkit/theme-switcher: 0.0.6 (LGPL-2.1-or-later)
* path-to-regexp: 6.2.0 (MIT)
* universal-router: 9.1.0 (MIT)
* generateUrls: 9.1.0 (MIT)
* @dbp-toolkit/matomo: 0.2.7 (LGPL-2.1-or-later)
*/import{c as S}from"./shared/_commonjsHelpers.PEtoXAax.es.js";import{c as A,D as T,i as L,x as R,o as O,A as D,g as U,s as I,S as P,M,a as F,I as j,b as $,d as N,e as V,f as G,h as B,j as H,k as W,l as q}from"./shared/notification.fWOMSAA9.es.js";import{c as z}from"./shared/utils.uVgKQcsS.es.js";(function(){function t(t){var e=0;return function(){return e<t.length?{done:!1,value:t[e++]}:{done:!0}}}function e(e){var n="undefined"!=typeof Symbol&&Symbol.iterator&&e[Symbol.iterator];return n?n.call(e):{next:t(e)}}function n(t){if(!(t instanceof Array)){t=e(t);for(var n,o=[];!(n=t.next()).done;)o.push(n.value);t=o}return t}var o="function"==typeof Object.create?Object.create:function(t){function e(){}return e.prototype=t,new e};var i,r=function(t){t=["object"==typeof globalThis&&globalThis,t,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof S&&S];for(var e=0;e<t.length;++e){var n=t[e];if(n&&n.Math==Math)return n}throw Error("Cannot find global object")}(this),a=function(){if("undefined"!=typeof Reflect&&Reflect.construct){if(function(){function t(){}return Reflect.construct(t,[],(function(){})),new t instanceof t}())return Reflect.construct;var t=Reflect.construct;return function(e,n,o){return e=t(e,n),o&&Reflect.setPrototypeOf(e,o.prototype),e}}return function(t,e,n){return void 0===n&&(n=t),n=o(n.prototype||Object.prototype),Function.prototype.apply.call(t,n,e)||n}}();if("function"==typeof Object.setPrototypeOf)i=Object.setPrototypeOf;else{var s;t:{var l={};try{l.__proto__={a:!0},s=l.a;break t}catch(t){}s=!1}i=s?function(t,e){if(t.__proto__=e,t.__proto__!==e)throw new TypeError(t+" is not extensible");return t}:null}var c=i;if(!ShadowRoot.prototype.createElement){var d,h=window.HTMLElement,u=window.customElements.define,p=window.customElements.get,g=window.customElements,f=new WeakMap,m=new WeakMap,b=new WeakMap,v=new WeakMap;window.CustomElementRegistry=function(){this.l=new Map,this.o=new Map,this.i=new Map,this.h=new Map},window.CustomElementRegistry.prototype.define=function(t,n){if(t=t.toLowerCase(),void 0!==this.j(t))throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': the name \""+t+'" has already been used with this registry');if(void 0!==this.o.get(n))throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry");var o=n.prototype.attributeChangedCallback,i=new Set(n.observedAttributes||[]);if(w(n,i,o),o={g:n,connectedCallback:n.prototype.connectedCallback,disconnectedCallback:n.prototype.disconnectedCallback,adoptedCallback:n.prototype.adoptedCallback,attributeChangedCallback:o,formAssociated:n.formAssociated,formAssociatedCallback:n.prototype.formAssociatedCallback,formDisabledCallback:n.prototype.formDisabledCallback,formResetCallback:n.prototype.formResetCallback,formStateRestoreCallback:n.prototype.formStateRestoreCallback,observedAttributes:i},this.l.set(t,o),this.o.set(n,o),(i=p.call(g,t))||(i=y(t),u.call(g,t,i)),this===window.customElements&&(b.set(n,o),o.s=i),i=this.h.get(t)){this.h.delete(t);for(var r=(i=e(i)).next();!r.done;r=i.next())r=r.value,m.delete(r),_(r,o,!0)}return void 0!==(o=this.i.get(t))&&(o.resolve(n),this.i.delete(t)),n},window.CustomElementRegistry.prototype.upgrade=function(){E.push(this),g.upgrade.apply(g,arguments),E.pop()},window.CustomElementRegistry.prototype.get=function(t){var e;return null==(e=this.l.get(t))?void 0:e.g},window.CustomElementRegistry.prototype.j=function(t){return this.l.get(t)},window.CustomElementRegistry.prototype.whenDefined=function(t){var e=this.j(t);if(void 0!==e)return Promise.resolve(e.g);var n=this.i.get(t);return void 0===n&&((n={}).promise=new Promise((function(t){return n.resolve=t})),this.i.set(t,n)),n.promise},window.CustomElementRegistry.prototype.m=function(t,e,n){var o=this.h.get(e);o||this.h.set(e,o=new Set),n?o.add(t):o.delete(t)},window.HTMLElement=function(){var t=d;if(t)return d=void 0,t;var e=b.get(this.constructor);if(!e)throw new TypeError("Illegal constructor (custom element class must be registered with global customElements registry to be newable)");return t=Reflect.construct(h,[],e.s),Object.setPrototypeOf(t,this.constructor.prototype),f.set(t,e),t},window.HTMLElement.prototype=h.prototype;var y=function(t){function e(){var e=Reflect.construct(h,[],this.constructor);Object.setPrototypeOf(e,HTMLElement.prototype);t:{var n=e.getRootNode();if(!(n===document||n instanceof ShadowRoot)){if((n=E[E.length-1])instanceof CustomElementRegistry){var o=n;break t}(n=n.getRootNode())===document||n instanceof ShadowRoot||(n=(null==(o=v.get(n))?void 0:o.getRootNode())||document)}o=n.customElements}return(n=(o=o||window.customElements).j(t))?_(e,n):m.set(e,o),e}return r.Object.defineProperty(e,"formAssociated",{configurable:!0,enumerable:!0,get:function(){return!0}}),e.prototype.connectedCallback=function(){var e=f.get(this);e?e.connectedCallback&&e.connectedCallback.apply(this,arguments):m.get(this).m(this,t,!0)},e.prototype.disconnectedCallback=function(){var e=f.get(this);e?e.disconnectedCallback&&e.disconnectedCallback.apply(this,arguments):m.get(this).m(this,t,!1)},e.prototype.adoptedCallback=function(){var t,e;null==(t=f.get(this))||null==(e=t.adoptedCallback)||e.apply(this,arguments)},e.prototype.formAssociatedCallback=function(){var t,e=f.get(this);e&&e.formAssociated&&(null==e||null==(t=e.formAssociatedCallback)||t.apply(this,arguments))},e.prototype.formDisabledCallback=function(){var t,e=f.get(this);null!=e&&e.formAssociated&&(null==e||null==(t=e.formDisabledCallback)||t.apply(this,arguments))},e.prototype.formResetCallback=function(){var t,e=f.get(this);null!=e&&e.formAssociated&&(null==e||null==(t=e.formResetCallback)||t.apply(this,arguments))},e.prototype.formStateRestoreCallback=function(){var t,e=f.get(this);null!=e&&e.formAssociated&&(null==e||null==(t=e.formStateRestoreCallback)||t.apply(this,arguments))},e},w=function(t,e,n){if(0!==e.size&&void 0!==n){var o=t.prototype.setAttribute;o&&(t.prototype.setAttribute=function(t,i){if(t=t.toLowerCase(),e.has(t)){var r=this.getAttribute(t);o.call(this,t,i),n.call(this,t,r,i)}else o.call(this,t,i)});var i=t.prototype.removeAttribute;i&&(t.prototype.removeAttribute=function(t){if(t=t.toLowerCase(),e.has(t)){var o=this.getAttribute(t);i.call(this,t),n.call(this,t,o,null)}else i.call(this,t)});var r=t.prototype.toggleAttribute;r&&(t.prototype.toggleAttribute=function(t,o){if(t=t.toLowerCase(),e.has(t)){var i=this.getAttribute(t);r.call(this,t,o),o=this.getAttribute(t),n.call(this,t,i,o)}else r.call(this,t,o)})}},k=function t(e){var n=Object.getPrototypeOf(e);if(n!==window.HTMLElement)return n===h?Object.setPrototypeOf(e,window.HTMLElement):t(n)},_=function(t,e,n){n=void 0!==n&&n,Object.setPrototypeOf(t,e.g.prototype),f.set(t,e),d=t;try{new e.g}catch(t){k(e.g),new e.g}e.attributeChangedCallback&&e.observedAttributes.forEach((function(n){t.hasAttribute(n)&&e.attributeChangedCallback.call(t,n,null,t.getAttribute(n))})),n&&e.connectedCallback&&t.isConnected&&e.connectedCallback.call(t)},x=Element.prototype.attachShadow;Element.prototype.attachShadow=function(t){var e=x.apply(this,arguments);return t.customElements&&(e.customElements=t.customElements),e};var E=[document],C=function(t,e,n){var o=(n?Object.getPrototypeOf(n):t.prototype)[e];t.prototype[e]=function(){E.push(this);var t=o.apply(n||this,arguments);return void 0!==t&&v.set(t,this),E.pop(),t}};C(ShadowRoot,"createElement",document),C(ShadowRoot,"importNode",document),C(Element,"insertAdjacentHTML");var A=function(t){var e=Object.getOwnPropertyDescriptor(t.prototype,"innerHTML");Object.defineProperty(t.prototype,"innerHTML",Object.assign({},e,{set:function(t){E.push(this),e.set.call(this,t),E.pop()}}))};if(A(Element),A(ShadowRoot),Object.defineProperty(window,"customElements",{value:new CustomElementRegistry,configurable:!0,writable:!0}),window.ElementInternals&&window.ElementInternals.prototype.setFormValue){var T=new WeakMap,L=HTMLElement.prototype.attachInternals;HTMLElement.prototype.attachInternals=function(t){for(var e=[],o=0;o<arguments.length;++o)e[o]=arguments[o];return e=L.call.apply(L,[this].concat(n(e))),T.set(e,this),e},["setFormValue","setValidity","checkValidity","reportValidity"].forEach((function(t){var e=window.ElementInternals.prototype,o=e[t];e[t]=function(t){for(var e=[],i=0;i<arguments.length;++i)e[i]=arguments[i];if(i=T.get(this),!0===f.get(i).formAssociated)return null==o?void 0:o.call.apply(o,[this].concat(n(e)));throw new DOMException("Failed to execute "+o+" on 'ElementInternals': The target element is not a form-associated custom element.")}}));var R=function(t){var e=a(Array,[].concat(n(t)),this.constructor);return e.h=t,e},O=R,D=Array;if(O.prototype=o(D.prototype),O.prototype.constructor=O,c)c(O,D);else for(var U in D)if("prototype"!=U)if(Object.defineProperties){var I=Object.getOwnPropertyDescriptor(D,U);I&&Object.defineProperty(O,U,I)}else O[U]=D[U];O.u=D.prototype,r.Object.defineProperty(R.prototype,"value",{configurable:!0,enumerable:!0,get:function(){var t;return(null==(t=this.h.find((function(t){return!0===t.checked})))?void 0:t.value)||""}});var P=function(t){var e=this,n=new Map;t.forEach((function(t,o){var i=t.getAttribute("name"),r=n.get(i)||[];e[+o]=t,r.push(t),n.set(i,r)})),this.length=t.length,n.forEach((function(t,n){t&&(e[n]=1===t.length?t[0]:new R(t))}))};P.prototype.namedItem=function(t){return this[t]};var M=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");Object.defineProperty(HTMLFormElement.prototype,"elements",{get:function(){for(var t=M.get.call(this,[]),n=[],o=(t=e(t)).next();!o.done;o=t.next()){o=o.value;var i=f.get(o);i&&!0!==i.formAssociated||n.push(o)}return new P(n)}})}}}).call("object"==typeof globalThis?globalThis:window);var K={"activity-example":{"hello-world":"Hallo Welt"},"choose-from-menu":"Bitte wählen Sie eine Aktivität aus dem Menu.",contact:"Kontakt",imprint:"Impressum",login:"Anmelden",logo:{word1:"Wissen",word2:"Technik",word3:"Leidenschaft"},logout:"Abmelden","page-not-found":"Die gewünschte Seite wurde nicht gefunden","page-updated-needs-reload":"Die Applikation wurde aktualisiert. Bitte laden Sie die Seite neu.","privacy-policy":"Datenschutz",welcome:{headline:"Willkommen bei der Applikation '{{appname}}'."}},Y={"activity-example":{"hello-world":"Hello World"},"choose-from-menu":"Please choose an activity from the menu.",contact:"Contact",imprint:"Legal Notice",login:"Login",logo:{word1:"Science",word2:"Passion",word3:"Technology"},logout:"Logout","page-not-found":"Requested Page Not Found","page-updated-needs-reload":"The application has been updated. Please reload the page.","privacy-policy":"Privacy Policy",welcome:{headline:"Welcome to the '{{appname}}' application."}};function X(){return A({en:Y,de:K},"de","en")}var J={de:"Deutsch","de-action":"Auf Deutsch anzeigen",demo:"Hallo Welt",en:"Englisch","en-action":"Auf Englisch anzeigen"},Q={de:"German","de-action":"Switch to German",demo:"Hello World",en:"English","en-action":"Switch to English"};class Z extends D{constructor(){super(),this._lang="de",this.languages=["de","en"],this._i18n=A({en:Q,de:J},"de","en"),this._i18n.t("de"),this._i18n.t("de-action"),this._i18n.t("en"),this._i18n.t("en-action")}_getNextLanguage(t){var e=this.languages.indexOf(t),n=this.languages[e+1];return void 0===n&&(n=this.languages[0]),n}_getPreviousLanguage(t){var e=this.languages.indexOf(t),n=this.languages[e-1];return void 0===n&&(n=this.languages[this.languages.length-1]),n}static get properties(){return{lang:{type:String},next:{type:String},languages:{type:Array}}}set lang(t){const e=this.lang,n=this.next;this._lang=t,this.requestUpdate("lang",e),this.requestUpdate("next",n),e!==t&&(this.sendSetPropertyEvent("lang",t),this._i18n.changeLanguage(this.next))}get lang(){return this._lang}set next(t){this.lang=this._getPreviousLanguage(t)}get next(){return this._getNextLanguage(this.lang)}static get styles(){return L(n||(n=E`
${0}
:host {
display: inline-block;
}
a:hover {
color: var(--dbp-hover-color, var(--dbp-content));
background-color: var(--dbp-hover-background-color);
transition: none;
}
a {
padding: 0.3em;
display: inline-block;
text-decoration: none;
transition: background-color 0.15s, color 0.15s;
color: var(--dbp-content);
}
input::-moz-focus-inner { border: 0; }
:focus-visible{
outline:none !important;
outline-width: 0 !important;
box-shadow: none;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: 0px 0px 4px 2px var(--dbp-primary);
}
`),U())}onClick(t){t.preventDefault(),this.lang=this.next}render(){var t=this._i18n.t(this.next+"-action");return R(o||(o=E`
<a href="#" title="${0}" @click=${0}>${0}</a>
`),t,this.onClick,this.next.toUpperCase())}}var tt={login:"Anmelden","login-failed":"Kommunikation mit dem Anmeldeserver fehlgeschlagen",logout:"Abmelden","logging-in":"Einloggen"},et={login:"Login","login-failed":"Communication with the login server failed",logout:"Logout","logging-in":"Logging in"};function nt(){return A({en:et,de:tt},"de","en")}function ot(t,e,...n){if(!t)throw new TypeError(it(e,n))}function it(t,e){let n=0;return t.replace(/%[os]/g,(()=>rt(e[n++])))}function rt(t){return"object"!=typeof t||null===t?String(t):Object.prototype.toString.call(t)}const at="undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:void 0;class st{constructor(t,e){this.code=t,this.message=e}warn(...t){var e;try{undefined;const n=(null!==(e=(new Error).stack)&&void 0!==e?e:"").replace(/^(?:(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+?\n){2}/g,"\n");console.warn(this.message,...t,n)}catch(t){}}}const lt=new st("W01","Unable to initialize event under dispatching."),ct=new st("W02","Assigning any falsy value to 'cancelBubble' property has no effect."),dt=new st("W03","Assigning any truthy value to 'returnValue' property has no effect."),ht=new st("W04","Unable to preventDefault on non-cancelable events."),ut=new st("W05","Unable to preventDefault inside passive event listener invocation."),pt=new st("W06","An event listener wasn't added because it has been added already: %o, %o"),gt=new st("W07","The %o option value was abandoned because the event listener wasn't added as duplicated."),ft=new st("W08","The 'callback' argument must be a function or an object that has 'handleEvent' method: %o");class mt{static get NONE(){return bt}static get CAPTURING_PHASE(){return vt}static get AT_TARGET(){return yt}static get BUBBLING_PHASE(){return wt}constructor(t,e){Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});const n=null!=e?e:{};kt.set(this,{type:String(t),bubbles:Boolean(n.bubbles),cancelable:Boolean(n.cancelable),composed:Boolean(n.composed),target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1,inPassiveListenerFlag:!1,dispatchFlag:!1,timeStamp:Date.now()})}get type(){return _t(this).type}get target(){return _t(this).target}get srcElement(){return _t(this).target}get currentTarget(){return _t(this).currentTarget}composedPath(){const t=_t(this).currentTarget;return t?[t]:[]}get NONE(){return bt}get CAPTURING_PHASE(){return vt}get AT_TARGET(){return yt}get BUBBLING_PHASE(){return wt}get eventPhase(){return _t(this).dispatchFlag?2:0}stopPropagation(){_t(this).stopPropagationFlag=!0}get cancelBubble(){return _t(this).stopPropagationFlag}set cancelBubble(t){t?_t(this).stopPropagationFlag=!0:ct.warn()}stopImmediatePropagation(){const t=_t(this);t.stopPropagationFlag=t.stopImmediatePropagationFlag=!0}get bubbles(){return _t(this).bubbles}get cancelable(){return _t(this).cancelable}get returnValue(){return!_t(this).canceledFlag}set returnValue(t){t?dt.warn():xt(_t(this))}preventDefault(){xt(_t(this))}get defaultPrevented(){return _t(this).canceledFlag}get composed(){return _t(this).composed}get isTrusted(){return!1}get timeStamp(){return _t(this).timeStamp}initEvent(t,e=!1,n=!1){const o=_t(this);o.dispatchFlag?lt.warn():kt.set(this,C({},o,{type:String(t),bubbles:Boolean(e),cancelable:Boolean(n),target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1}))}}const bt=0,vt=1,yt=2,wt=3,kt=new WeakMap;function _t(t,e="this"){const n=kt.get(t);return ot(null!=n,"'%s' must be an object that Event constructor created, but got another one: %o",e,t),n}function xt(t){t.inPassiveListenerFlag?ut.warn():t.cancelable?t.canceledFlag=!0:ht.warn()}Object.defineProperty(mt,"NONE",{enumerable:!0}),Object.defineProperty(mt,"CAPTURING_PHASE",{enumerable:!0}),Object.defineProperty(mt,"AT_TARGET",{enumerable:!0}),Object.defineProperty(mt,"BUBBLING_PHASE",{enumerable:!0});const Et=Object.getOwnPropertyNames(mt.prototype);for(let t=0;t<Et.length;++t)"constructor"!==Et[t]&&Object.defineProperty(mt.prototype,Et[t],{enumerable:!0});let Ct;void 0!==at&&void 0!==at.Event&&Object.setPrototypeOf(mt.prototype,at.Event.prototype);const St={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};function At(t){const e=Object.keys(St);for(let n=0;n<e.length;++n){const o=e[n],i=St[o];Object.defineProperty(t,o,{get:()=>i,configurable:!0,enumerable:!0})}}class Tt extends mt{static wrap(t){return new(Dt(t))(t)}constructor(t){super(t.type,{bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed}),t.cancelBubble&&super.stopPropagation(),t.defaultPrevented&&super.preventDefault(),Lt.set(this,{original:t});const e=Object.keys(t);for(let n=0;n<e.length;++n){const o=e[n];o in this||Object.defineProperty(this,o,Ut(t,o))}}stopPropagation(){super.stopPropagation();const{original:t}=Rt(this);"stopPropagation"in t&&t.stopPropagation()}get cancelBubble(){return super.cancelBubble}set cancelBubble(t){super.cancelBubble=t;const{original:e}=Rt(this);"cancelBubble"in e&&(e.cancelBubble=t)}stopImmediatePropagation(){super.stopImmediatePropagation();const{original:t}=Rt(this);"stopImmediatePropagation"in t&&t.stopImmediatePropagation()}get returnValue(){return super.returnValue}set returnValue(t){super.returnValue=t;const{original:e}=Rt(this);"returnValue"in e&&(e.returnValue=t)}preventDefault(){super.preventDefault();const{original:t}=Rt(this);"preventDefault"in t&&t.preventDefault()}get timeStamp(){const{original:t}=Rt(this);return"timeStamp"in t?t.timeStamp:super.timeStamp}}const Lt=new WeakMap;function Rt(t){const e=Lt.get(t);return ot(null!=e,"'this' is expected an Event object, but got",t),e}const Ot=new WeakMap;function Dt(t){const e=Object.getPrototypeOf(t);if(null==e)return Tt;let n=Ot.get(e);return null==n&&(n=function(t,e){class n extends t{}const o=Object.keys(e);for(let t=0;t<o.length;++t)Object.defineProperty(n.prototype,o[t],Ut(e,o[t]));return n}(Dt(e),e),Ot.set(e,n)),n}function Ut(t,e){const n=Object.getOwnPropertyDescriptor(t,e);return{get(){const t=Rt(this).original,n=t[e];return"function"==typeof n?n.bind(t):n},set(t){Rt(this).original[e]=t},configurable:n.configurable,enumerable:n.enumerable}}function It(t){return 1==(1&t.flags)}function Pt(t){return 2==(2&t.flags)}function Mt(t){return 4==(4&t.flags)}function Ft(t){return 8==(8&t.flags)}function jt({callback:t},e,n){try{"function"==typeof t?t.call(e,n):"function"==typeof t.handleEvent&&t.handleEvent(n)}catch(t){!function(t){try{const e=t instanceof Error?t:new Error(rt(t));if("function"==typeof dispatchEvent&&"function"==typeof ErrorEvent)dispatchEvent(new ErrorEvent("error",{error:e,message:e.message}));else if("undefined"!=typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)}catch(t){}}(t)}}function $t({listeners:t},e,n){for(let o=0;o<t.length;++o)if(t[o].callback===e&&It(t[o])===n)return o;return-1}function Nt(t,e,n){const o=$t(t,e,n);return-1!==o&&Vt(t,o)}function Vt(t,e,n=!1){const o=t.listeners[e];return function(t){t.flags|=8}(o),o.signal&&o.signal.removeEventListener("abort",o.signalListener),t.cow&&!n?(t.cow=!1,t.listeners=t.listeners.filter(((t,n)=>n!==e)),!1):(t.listeners.splice(e,1),!0)}Ot.set(Object.prototype,Tt),void 0!==at&&void 0!==at.Event&&Ot.set(at.Event.prototype,Tt);class Gt{constructor(){Bt.set(this,Object.create(null))}addEventListener(t,e,n){const o=Ht(this),{callback:i,capture:r,once:a,passive:s,signal:l,type:c}=function(t,e,n){var o;if(Wt(e),"object"==typeof n&&null!==n)return{type:String(t),callback:null!=e?e:void 0,capture:Boolean(n.capture),passive:Boolean(n.passive),once:Boolean(n.once),signal:null!==(o=n.signal)&&void 0!==o?o:void 0};return{type:String(t),callback:null!=e?e:void 0,capture:Boolean(n),passive:!1,once:!1,signal:void 0}}(t,e,n);if(null==i||(null==l?void 0:l.aborted))return;const d=function(t,e){var n;return null!==(n=t[e])&&void 0!==n?n:t[e]={attrCallback:void 0,attrListener:void 0,cow:!1,listeners:[]}}(o,c),h=$t(d,i,r);-1===h?function(t,e,n,o,i,r){let a;r&&(a=Nt.bind(null,t,e,n),r.addEventListener("abort",a));const s=function(t,e,n,o,i,r){return{callback:t,flags:(e?1:0)|(n?2:0)|(o?4:0),signal:i,signalListener:r}}(e,n,o,i,r,a);t.cow?(t.cow=!1,t.listeners=[...t.listeners,s]):t.listeners.push(s)}(d,i,r,s,a,l):function(t,e,n,o){pt.warn(It(t)?"capture":"bubble",t.callback),Pt(t)!==e&>.warn("passive");Mt(t)!==n&>.warn("once");t.signal!==o&>.warn("signal")}(d.listeners[h],s,a,l)}removeEventListener(t,e,n){const o=Ht(this),{callback:i,capture:r,type:a}=function(t,e,n){if(Wt(e),"object"==typeof n&&null!==n)return{type:String(t),callback:null!=e?e:void 0,capture:Boolean(n.capture)};return{type:String(t),callback:null!=e?e:void 0,capture:Boolean(n)}}(t,e,n),s=o[a];null!=i&&s&&Nt(s,i,r)}dispatchEvent(t){const e=Ht(this)[String(t.type)];if(null==e)return!0;const n=t instanceof mt?t:Tt.wrap(t),o=_t(n,"event");if(o.dispatchFlag)throw i="This event has been in dispatching.",at.DOMException?new at.DOMException(i,"InvalidStateError"):(null==Ct&&(Ct=class t extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,t)}get code(){return 11}get name(){return"InvalidStateError"}},Object.defineProperties(Ct.prototype,{code:{enumerable:!0},name:{enumerable:!0}}),At(Ct),At(Ct.prototype)),new Ct(i));var i;if(o.dispatchFlag=!0,o.target=o.currentTarget=this,!o.stopPropagationFlag){const{cow:t,listeners:i}=e;e.cow=!0;for(let r=0;r<i.length;++r){const a=i[r];if(!Ft(a)&&(Mt(a)&&Vt(e,r,!t)&&(r-=1),o.inPassiveListenerFlag=Pt(a),jt(a,this,n),o.inPassiveListenerFlag=!1,o.stopImmediatePropagationFlag))break}t||(e.cow=!1)}return o.target=null,o.currentTarget=null,o.stopImmediatePropagationFlag=!1,o.stopPropagationFlag=!1,o.dispatchFlag=!1,!o.canceledFlag}}const Bt=new WeakMap;function Ht(t,e="this"){const n=Bt.get(t);return ot(null!=n,"'%s' must be an object that EventTarget constructor created, but got another one: %o",e,t),n}function Wt(t){if("function"!=typeof t&&("object"!=typeof t||null===t||"function"!=typeof t.handleEvent)){if(null!=t&&"object"!=typeof t)throw new TypeError(it(ft.message,[t]));ft.warn(t)}}const qt=Object.getOwnPropertyNames(Gt.prototype);for(let t=0;t<qt.length;++t)"constructor"!==qt[t]&&Object.defineProperty(Gt.prototype,qt[t],{enumerable:!0});void 0!==at&&void 0!==at.EventTarget&&Object.setPrototypeOf(Gt.prototype,at.EventTarget.prototype);class zt extends Gt{constructor(t,e,n,o,i,r){super(),this._baseURL=t,this._realm=e,this._clientId=n,this._keycloak=null,this._initPromise=null,this._silentCheckSsoUri=o,this._checkLoginIframe=i,this._idpHint=r,this._checkId=null,this.MIN_VALIDITY=20,this.CHECK_INTERVAL=10,this.DEBUG=!1,this._onVisibilityChanged=this._onVisibilityChanged.bind(this),document.addEventListener("visibilitychange",this._onVisibilityChanged)}close(){document.removeEventListener("visibilitychange",this._onVisibilityChanged)}_onVisibilityChanged(){"visible"===document.visibilityState&&this._keycloak.authenticated&&this._checkTokeHasExpired()}_onChanged(){const t=new CustomEvent("changed",{detail:this._keycloak,bubbles:!0,composed:!0});this.dispatchEvent(t)}_onReady(t){t&&this._onChanged()}async _onTokenExpired(){console.log("Token has expired");let t=!1;try{t=await this._keycloak.updateToken(-1)}catch(t){return void console.log("Failed to refresh the token",t)}console.assert(t,"token should have been refreshed")}async _checkTokeHasExpired(){let t,e=this.MIN_VALIDITY+this.CHECK_INTERVAL;this.DEBUG&&console.log(`Updating token if not valid for at least ${e}s`);try{t=await this._keycloak.updateToken(e)}catch(t){console.log("Failed to refresh the token",t)}this.DEBUG&&t&&console.log("token has been refreshed")}async _onAuthSuccess(){null!==this._checkId&&(clearInterval(this._checkId),this._checkId=null),this._checkId=setInterval(this._checkTokeHasExpired.bind(this),1e3*this.CHECK_INTERVAL),this._onChanged()}async _onAuthLogout(){null!==this._checkId&&(clearInterval(this._checkId),this._checkId=null),this._onChanged()}async _init(){const t=(await import("./shared/keycloak.IggD-Uud.es.js")).default;this._keycloak=new t({url:this._baseURL,realm:this._realm,clientId:this._clientId}),this._keycloak.onTokenExpired=this._onTokenExpired.bind(this),this._keycloak.onAuthRefreshSuccess=this._onChanged.bind(this),this._keycloak.onAuthRefreshError=this._onChanged.bind(this),this._keycloak.onAuthLogout=this._onAuthLogout.bind(this),this._keycloak.onAuthSuccess=this._onAuthSuccess.bind(this),this._keycloak.onAuthError=this._onChanged.bind(this),this._keycloak.onReady=this._onReady.bind(this);const e={promiseType:"native",pkceMethod:"S256"};this.DEBUG&&(e.enableLogging=!0),e.checkLoginIframe=this._checkLoginIframe,this._silentCheckSsoUri?(e.onLoad="check-sso",e.silentCheckSsoRedirectUri=function(t){try{return new URL(t).href}catch(e){return new URL(t,window.location.href).href}}(this._silentCheckSsoUri),await function(t,e){let n=new Promise(((e,n)=>{let o=setTimeout((()=>{clearTimeout(o),n("Timed out in "+t+"ms.")}),t)}));return Promise.race([e,n])}(5e3,this._keycloak.init(e)).catch((()=>{console.log("Login timed out"),this._onChanged()}))):await this._keycloak.init(e)}async _ensureInit(){return null===this._initPromise&&(this._initPromise=this._init()),this._initPromise}isLoggingIn(){const t=window.location.href;return t.search("[&#]state=")>=0&&t.search("[&#]session_state=")>=0}async login(t){await this._ensureInit();const e=(t=t||{}).lang||"en",n=t.scope||"";this._keycloak.authenticated||await this._keycloak.login({kcLocale:e,locale:e,scope:n,idpHint:this._idpHint})}async tryLogin(){await this._ensureInit()}async localLogout(){this._keycloak.clearToken()}async logout(){await this._ensureInit(),this._keycloak.logout()}}const Kt=Object.freeze({UNKNOWN:"unknown",LOGGING_IN:"logging-in",LOGGED_IN:"logged-in",LOGGING_OUT:"logging-out",LOGGED_OUT:"logged-out"});class Yt extends D{constructor(){super(),this.forceLogin=!1,this.token="",this.subject="",this.name="",this.tryLogin=!1,this.entryPointUrl="",this._user=null,this._userId="",this._authenticated=!1,this._loginStatus=Kt.UNKNOWN,this.requestedLoginStatus=Kt.UNKNOWN,this._i18n=nt(),this.lang=this._i18n.language,this.keycloakUrl=null,this.realm=null,this.clientId=null,this.silentCheckSsoRedirectUri=null,this.noCheckLoginIframe=!1,this.scope=null,this.idpHint="",this._onKCChanged=this._onKCChanged.bind(this),window.playwright&&this.setAttribute("data-testid","dbp-auth-keycloak")}update(t){t.forEach(((t,e)=>{switch(e){case"lang":this._i18n.changeLanguage(this.lang);break;case"requestedLoginStatus":switch(console.log("requested-login-status changed",this.requestedLoginStatus),this.requestedLoginStatus){case Kt.LOGGED_IN:this._kcwrapper.login({lang:this.lang,scope:this.scope||""});break;case Kt.LOGGED_OUT:this._loginStatus===Kt.LOGGED_IN&&this._setLoginStatus(Kt.LOGGING_OUT),this._kcwrapper.logout(),this._loginStatus===Kt.LOGGING_OUT&&this._setLoginStatus(Kt.LOGGED_IN)}}})),super.update(t)}async _fetchUser(t){var e;const n=z(this.entryPointUrl,`/frontend/users/${encodeURIComponent(t)}`);let o=await fetch(n,{headers:{Authorization:"Bearer "+this.token}});if(!o.ok)throw o;return{roles:null!=(e=(await o.json()).roles)?e:[]}}async _onKCChanged(t){const e=t.detail;if(this._authenticated=e.authenticated,e.authenticated){let t=this.token!==e.token;this.name=e.idTokenParsed.name,this.token=e.token,this.subject=e.subject;const n=e.idTokenParsed.preferred_username;let o=n!==this._userId;if(o){let t;this._userId=n;try{t=await this._fetchUser(n)}catch(e){console.error(e),t={roles:[]}}n===this._userId&&(this._user=t)}null!==this._user&&this._setLoginStatus(Kt.LOGGED_IN,t||o)}else this._loginStatus===Kt.LOGGED_IN&&this._setLoginStatus(Kt.LOGGING_OUT),this.name="",this.token="",this.subject="",this._userId="",this._user=null,this._setLoginStatus(Kt.LOGGED_OUT)}sendSetPropertyEvents(){const t={"login-status":this._loginStatus,subject:this.subject,token:this.token,"user-full-name":this.name,"user-id":this._userId,"person-id":this._userId,person:this._user};(window.Cypress||window.playwright)&&(window.DBPAuth=t,console.log("Cypress/Playwright detected")),this.setAttribute("data-auth-set","true"),this.sendSetPropertyEvent("auth",t)}_setLoginStatus(t,e){(this._loginStatus!==t||e)&&(this._loginStatus=t,this.sendSetPropertyEvents())}static get properties(){return C({},super.properties,{lang:{type:String},forceLogin:{type:Boolean,attribute:"force-login"},tryLogin:{type:Boolean,attribute:"try-login"},entryPointUrl:{type:String,attribute:"entry-point-url"},name:{type:String,attribute:!1},token:{type:String,attribute:!1},subject:{type:String,attribute:!1},_userId:{type:String,attribute:!1},_user:{type:Object,attribute:!1},_loginStatus:{type:String,attribute:!1},keycloakUrl:{type:String,attribute:"url"},realm:{type:String},clientId:{type:String,attribute:"client-id"},silentCheckSsoRedirectUri:{type:String,attribute:"silent-check-sso-redirect-uri"},scope:{type:String},idpHint:{type:String,attribute:"idp-hint"},requestedLoginStatus:{type:String,attribute:"requested-login-status"},noCheckLoginIframe:{type:Boolean,attribute:"no-check-login-iframe"}})}connectedCallback(){var t=this;if(super.connectedCallback(),!this.keycloakUrl)throw Error("url not set");if(!this.realm)throw Error("realm not set");if(!this.clientId)throw Error("client-id not set");this._kcwrapper=new zt(this.keycloakUrl,this.realm,this.clientId,this.silentCheckSsoRedirectUri,!this.noCheckLoginIframe,this.idpHint),this._kcwrapper.addEventListener("changed",this._onKCChanged);!async function(){try{t.forceLogin||t._kcwrapper.isLoggingIn()?(t._setLoginStatus(Kt.LOGGING_IN),await t._kcwrapper.login({lang:t.lang,scope:t.scope||""})):t.tryLogin?(t._setLoginStatus(Kt.LOGGING_IN),await t._kcwrapper.tryLogin(),t._authenticated||t._setLoginStatus(Kt.LOGGED_OUT)):t._setLoginStatus(Kt.LOGGED_OUT)}catch(e){throw t._setLoginStatus(Kt.LOGGED_OUT),I({summary:t._i18n.t("login-failed"),type:"danger",timeout:5}),e}}()}disconnectedCallback(){this._kcwrapper.close(),this._kcwrapper.removeEventListener("changed",this._onKCChanged),super.disconnectedCallback()}}P(D);class Xt extends(P(D)){constructor(){super(),this._i18n=X(),this.lang=this._i18n.language,this.auth={},this.closeDropdown=this.closeDropdown.bind(this),this.onWindowResize=this.onWindowResize.bind(this)}static get scopedElements(){return{"dbp-icon":j}}static get properties(){return C({},super.properties,{lang:{type:String},auth:{type:Object}})}onWindowResize(){this.updateDropdownWidth()}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.onWindowResize),document.addEventListener("click",this.closeDropdown)}disconnectedCallback(){window.removeEventListener("resize",this.onWindowResize),document.removeEventListener("click",this.closeDropdown),super.disconnectedCallback()}updateDropdownWidth(){const t=this.shadowRoot.querySelector("div.dropdown-menu");if(!t)return;let e=this.getBoundingClientRect(),n=window.innerWidth-e.left;t.setAttribute("style",`width: ${n-20}px`)}onLoginClicked(t){this.sendSetPropertyEvent("requested-login-status",Kt.LOGGED_IN),t.preventDefault()}onLogoutClicked(t){this.sendSetPropertyEvent("requested-login-status",Kt.LOGGED_OUT)}update(t){t.forEach(((t,e)=>{"lang"===e&&this._i18n.changeLanguage(this.lang)})),super.update(t)}static get styles(){return L(i||(i=E`
${0}
:host {
display: inline-block;
}
a {
color: var(--dbp-content);
fill: var(--dbp-content);
cursor: pointer;
text-decoration: none;
display: block;
}
input::-moz-focus-inner {
border: 0;
}
:focus-visible {
outline: none !important;
outline-width: 0 !important;
box-shadow: none;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: 0px 0px 4px 2px var(--dbp-primary);
}
.dropdown.is-active .dropdown-menu,
.dropdown.is-hoverable:hover .dropdown-menu {
display: block;
}
.dropdown-menu {
display: none;
min-width: 5em;
max-width: 25em;
position: absolute;
z-index: 20;
border: var(--dbp-border);
border-radius: 0px;
overflow: hidden;
background-color: var(--dbp-background);
}
.dropdown-content {
padding-bottom: 0.5rem;
padding-top: 0.5rem;
}
.menu a {
/*padding: 0.3em;*/
font-weight: 400;
color: var(--dbp-content);
display: block;
text-decoration: none;
}
.menu a:hover {
color: var(--dbp-hover-color, var(--dbp-content));
background-color: var(--dbp-hover-background-color);
}
.menu a.selected {
color: var(--dbp-on-secondary-surface);
background-color: var(--dbp-secondary-surface);
}
.dropdown-item {
color: var(--dbp-muted);
display: block;
font-size: 0.875rem;
line-height: 1.5;
padding: 0.375rem 1rem;
margin-left: 0.5em;
margin-right: 0.5em;
padding-left: 0.5em;
padding-right: 0.5em;
position: relative;
}
.dropdown {
cursor: pointer;
}
a.dropdown-item {
width: initial !important;
}
.main-button {
min-width: 150px;
}
.menu-icon {
height: 1em;
width: 1em;
vertical-align: -0.1rem;
}
.login-box svg {
width: 1.1em;
height: 1.1em;
display: flex;
}
.login-button {
padding: 0.3em 0.4em;
transition: background-color 0.15s, color 0.15s;
}
.login-button:hover {
color: var(--dbp-hover-color, var(--dbp-content));
background-color: var(--dbp-hover-background-color);
cursor: pointer;
transition: none;
}
.login-box {
display: flex;
align-items: center;
}
.login-box:hover svg path {
fill: var(--dbp-hover-color);
}
.login-box .label {
padding-left: 0.2em;
}
.dropdown-trigger {
display: flex;
align-items: center;
}
.dropdown-trigger .name {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
min-width: 0;
margin-right: 0.5em;
}
`),U())}setChevron(t){const e=this.shadowRoot.querySelector("#menu-chevron-icon");null!==e&&(e.name=t)}onDropdownClick(t){t.stopPropagation(),t.currentTarget.classList.toggle("is-active"),this.setChevron(t.currentTarget.classList.contains("is-active")?"chevron-up":"chevron-down"),this.updateDropdownWidth()}closeDropdown(){this.shadowRoot.querySelectorAll(".dropdown").forEach((function(t){t.classList.remove("is-active")})),this.setChevron("chevron-down")}renderLoggedIn(){const t=this._i18n;return R(r||(r=E`
<div class="dropdown" @click="${0}">
<a href="#">
<div class="dropdown-trigger login-button">
<div class="name">${0}</div>
<dbp-icon
class="menu-icon"
name="chevron-down"
id="menu-chevron-icon"></dbp-icon>
</div>
</a>
<div class="dropdown-menu" id="dropdown-menu2" role="menu">
<div class="dropdown-content" @blur="${0}">
<div class="menu">
<a href="#" @click="${0}" class="dropdown-item">
${0}
</a>
</div>
</div>
</div>
</div>
`),this.onDropdownClick,this.auth["user-full-name"],this.closeDropdown,this.onLogoutClicked,t.t("logout"))}renderLoggedOut(){const t=this._i18n;return R(a||(a=E`
<a href="#" @click="${0}">
<div class="login-box login-button">
<div class="icon" aria-hidden="true">${0}</div>
<div class="label">${0}</div>
</div>
</a>
`),this.onLoginClicked,F('\n <svg\n viewBox="0 0 100 100"\n y="0px"\n x="0px"\n id="icon"\n role="img"\n version="1.1">\n <g\n id="g6">\n <path\n style="stroke-width:1.33417916"\n id="path2"\n d="m 42.943908,38.894934 5.885859,6.967885 H 5.4215537 c -1.8393311,0 -3.4334181,1.741972 -3.4334181,4.064599 0,2.322628 1.4714649,4.064599 3.4334181,4.064599 H 48.829767 L 42.943908,60.9599 c -1.348843,1.596808 -1.348843,4.064599 0,5.661406 1.348843,1.596808 3.433418,1.596808 4.782261,0 L 61.705085,49.927418 47.726169,33.378693 c -1.348843,-1.596806 -3.433418,-1.596806 -4.782261,0 -1.348843,1.596807 -1.348843,4.064599 0,5.516241 z" />\n <path\n id="path4"\n d="m 50,2.3007812 c -18.777325,0 -35.049449,10.9124408 -42.8261719,26.7246098 H 13.390625 C 20.672112,16.348362 34.336876,7.8007812 50,7.8007812 73.3,7.8007812 92.300781,26.7 92.300781,50 92.300781,73.3 73.3,92.300781 50,92.300781 c -15.673389,0 -29.345175,-8.60579 -36.623047,-21.326172 H 7.1640625 C 14.942553,86.8272 31.242598,97.800781 50.099609,97.800781 76.399609,97.800781 97.900391,76.4 97.900391,50 97.800391,23.7 76.3,2.3007812 50,2.3007812 Z" />\n </g>\n </svg>\n '),t.t("login"))}render(){const t="logged-in"===this.auth["login-status"];return R(s||(s=E`
<div class="authbox">${0}</div>
`),t?this.renderLoggedIn():this.renderLoggedOut())}}var Jt={send:"senden"},Qt={send:"send"};class Zt extends T{constructor(){super(),this._i18n=A({en:Qt,de:Jt},"de","en"),this.lang=this._i18n.language}static get properties(){return C({},super.properties,{lang:{type:String}})}connectedCallback(){super.connectedCallback();const t=this;window.addEventListener("dbp-notification-send",(e=>{if(void 0===e.detail)return;t.notificationBlock=t._("#notification");const n=`notification-${(()=>{let t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}))})()}`,o=void 0!==e.detail.type?e.detail.type:"info",i=void 0!==e.detail.body?e.detail.body:"",r=void 0!==e.detail.summary?e.detail.summary:"",a=void 0!==e.detail.timeout?e.detail.timeout:0,s=void 0!==e.detail.icon?e.detail.icon:"",l=""!==s?`<dbp-icon name="${s}"></dbp-icon>`:"",c=""!==r?`<h3>${r}</h3>`:"";t.notificationBlock.innerHTML=`\n <div id="${n}" class="notification is-${o}">\n <button id="${n}-button" onclick="parentNode.parentNode.removeChild(parentNode)" class="delete"></button>\n ${c}\n ${l} ${i}\n </div>\n `+t.notificationBlock.innerHTML;const d=`#${n}`;a>0&&setTimeout((()=>{t.removeMessageId(d)}),1e3*a),e.preventDefault()}))}removeMessageId(t){const e=this._(t);e&&this.notificationBlock.removeChild(e)}static get styles(){return L(l||(l=E`
${0}
${0}
${0}
.notification:not(:last-child) {
margin-bottom: 1.5rem;
}
.notification h3 {
font-weight: bold;
margin-bottom: 3px;
}
.delete,
.modal-close {
-moz-appearance: none;
-webkit-appearance: none;
background-color: rgba(10, 10, 10, 0.2);
border: none;
border-radius: 290486px;
cursor: pointer;
pointer-events: auto;
display: inline-block;
flex-grow: 0;
flex-shrink: 0;
font-size: 0;
height: 20px;
max-height: 20px;
max-width: 20px;
min-height: 20px;
min-width: 20px;
outline: 0;
position: relative;
vertical-align: top;
width: 20px;
}
.delete::before,
.modal-close::before,
.delete::after,
.modal-close::after {
background-color: var(--dbp-background);
color: var(--dbp-content);
content: '';
display: block;
left: 50%;
position: absolute;
top: 50%;
-webkit-transform: translateX(-50%) translateY(-50%) rotate(45deg);
transform: translateX(-50%) translateY(-50%) rotate(45deg);
-webkit-transform-origin: center center;
transform-origin: center center;
}
.delete::before,
.modal-close::before {
height: 2px;
width: 50%;
}
.delete::after,
.modal-close::after {
height: 50%;
width: 2px;
}
.delete:hover,
.modal-close:hover,
.delete:focus,
.modal-close:focus {
background-color: rgba(10, 10, 10, 0.3);
}
.delete:active,
.modal-close:active {
background-color: rgba(10, 10, 10, 0.4);
}
#notification {
position: fixed;
top: 0;
max-width: 500px;
margin: 0.75em auto;
left: 0;
right: 0;
z-index: 1000;
padding: 0;
}
.notification h3 {
margin: 0 0 3px 0;
font: inherit;
font-weight: bold;
}
`),U(),$(),N())}render(){return R(c||(c=E`
<div class="columns">
<div class="column" id="notification"></div>
</div>
`))}}var te={"color-mode":"Farbmodus ändern","demo-title":"Theme Switcher Demo",intro:"Mit dem Theme-Switcher können Sie zwischen unterschiedlichen Farb-Themes umschalten."},ee={"color-mode":"Change color mode","demo-title":"Theme Switcher Demo",intro:"With the theme-switcher you can switch between multiple themes."};class ne extends(P(D)){constructor(){super(),this._i18n=A({en:ee,de:te},"de","en"),this.lang=this._i18n.language,this.themes=[],this.boundCloseAdditionalMenuHandler=this.hideModeMenu.bind(this),this.detectBrowserDarkMode=!1,this.darkModeClass="dark-theme",this.langDir="",this.dropdownRight=!1,this.darkModeThemeOverride=null}static get properties(){return C({},super.properties,{lang:{type:String},themes:{type:Array,attribute:"themes"},darkModeThemeOverride:{type:String,attribute:"dark-mode-theme-override"},dropdownRight:{type:Boolean,attribute:"dropdown-right"},langDir:{type:String,attribute:"lang-dir"}})}static get scopedElements(){return{"dbp-icon":j}}update(t){t.forEach(((t,e)=>{"lang"===e&&this._i18n.changeLanguage(this.lang)})),super.update(t)}connectedCallback(){super.connectedCallback(),this.updateComplete.then((()=>{null===this.darkModeThemeOverride?this.detectBrowserDarkMode=!0:""===this.darkModeThemeOverride?this.detectBrowserDarkMode=!1:(this.detectBrowserDarkMode=!0,this.darkModeClass=this.darkModeThemeOverride),this.loadTheme("light-theme"),this.detectInitialMode()})),this.langDir&&V(this._i18n,this)}detectInitialMode(){let t=localStorage.getItem("prefered-color-mode");if(t){const e=this.themes.find((e=>e.class===t));e&&this.loadTheme(e.class)}else if(this.detectBrowserDarkMode){if(window.matchMedia("(prefers-color-scheme: dark)").matches){const t=this.themes.find((t=>t.class===this.darkModeClass));t&&this.loadTheme(t.class)}}}toggleModeMenu(){const t=this.shadowRoot.querySelector(".mode-button");if(!t)return;t.classList.contains("active")?t.classList.remove("active"):t.classList.add("active");const e=this.shadowRoot.querySelector("ul.extended-menu"),n=this.shadowRoot.querySelector(".mode-button");null!==e&&null!==n&&(e.classList.toggle("hidden"),e.classList.contains("hidden")?document.removeEventListener("click",this.boundCloseAdditionalMenuHandler):(document.addEventListener("click",this.boundCloseAdditionalMenuHandler),this.initateOpenAdditionalMenu=!0))}hideModeMenu(){if(this.initateOpenAdditionalMenu)return void(this.initateOpenAdditionalMenu=!1);const t=this.shadowRoot.querySelector("ul.extended-menu");t&&!t.classList.contains("hidden")&&this.toggleModeMenu()}loadTheme(t){const e=this.shadowRoot.querySelector(".button-"+t),n=this.shadowRoot.querySelectorAll(".button-theme"),o=this.shadowRoot.host.getRootNode({composed:!0}).body;null!==e&&0!==n.length&&null!==o&&(n.forEach((t=>t.classList.remove("active"))),e.classList.add("active"),o.classList.contains(t)||(this.themes.forEach((t=>{o.classList.remove(t.class)})),o.classList.add(t)))}saveTheme(t){const e=window.matchMedia("(prefers-color-scheme: dark)"),n=window.matchMedia("(prefers-color-scheme: light)");"light-theme"===t&&n.matches||t===this.darkModeClass&&e.matches?localStorage.removeItem("prefered-color-mode"):localStorage.setItem("prefered-color-mode",t)}static get styles(){return L(d||(d=E`
${0}
${0}
${0}
mode-button, button.button {
border: none;
}
.active,
.extended-menu li a.active dbp-icon {
color: var(--dbp-accent);
}
.active {
font-weight: bolder;
}
a:hover:not(.active),
.extended-menu li a:hover:not(.active) {
color: var(--dbp-hover-color, var(--dbp-content));
background-color: var(--dbp-hover-background-color);
transition: none;
}
a {
padding: 0.3em;
display: inline-block;
text-decoration: none;
transition: background-color 0.15s, color 0.15s;
color: var(--dbp-content);
}
.extended-menu {
list-style: none;
border: var(--dbp-border);
position: absolute;
background-color: var(--dbp-background);
z-index: 1000;
border-radius: var(--dbp-border-radius);
}
.extended-menu li {