UNPKG

@digital-blueprint/dispatch-app

Version:

[GitHub Repository](https://github.com/digital-blueprint/dispatch-app) | [npmjs package](https://www.npmjs.com/package/@digital-blueprint/dispatch-app) | [Unpkg CDN](https://unpkg.com/browse/@digital-blueprint/dispatch-app/) | [Dispatch Bundle](https://gi

503 lines (454 loc) 178 kB
let e=e=>e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,ee,te,v,y,b,ne,re,ie,x,ae,S,oe,se,C,w,T,E,D;function O(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?O(Object(n),!0).forEach(function(t){A(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function A(e,t,n){return(t=j(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j(e){var t=ce(e,`string`);return typeof t==`symbol`?t:t+``}function ce(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)} /*! * License: LGPL-2.1-or-later * Dependencies: * * @webcomponents/scoped-custom-element-registry: BSD-3-Clause * @dbp-toolkit/app-shell: LGPL-2.1-or-later * @dbp-toolkit/language-select: LGPL-2.1-or-later * @dbp-toolkit/auth: LGPL-2.1-or-later * lit-html: BSD-3-Clause * @dbp-toolkit/notification: LGPL-2.1-or-later * @dbp-toolkit/theme-switcher: LGPL-2.1-or-later * universal-router: MIT * @dbp-toolkit/matomo: LGPL-2.1-or-later */ import{$ as M,B as le,C as N,E as P,I as F,N as I,O as L,P as R,Q as z,T as B,V,X as ue,a as de,c as H,d as fe,f as pe,g as me,h as he,i as ge,j as _e,l as ve,m as ye,n as be,o as xe,p as U,r as Se,rt as Ce,t as we,tt as W,v as G,y as K}from"./shared/dbp-lit-element.BfjLvJVI.js";import{a as q,i as Te,o as J,r as Ee,t as De}from"./shared/directive-helpers.Sc6bWiSp.js";(function(){function e(e){var t=0;return function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}var t=typeof Object.defineProperties==`function`?Object.defineProperty:function(e,t,n){return e==Array.prototype||e==Object.prototype||(e[t]=n.value),e};function n(e){e=[typeof globalThis==`object`&&globalThis,e,typeof window==`object`&&window,typeof self==`object`&&self,typeof global==`object`&&global];for(var t=0;t<e.length;++t){var n=e[t];if(n&&n.Math==Math)return n}throw Error(`Cannot find global object`)}var r=n(this);function i(e,n){if(n)a:{var i=r;e=e.split(`.`);for(var a=0;a<e.length-1;a++){var o=e[a];if(!(o in i))break a;i=i[o]}e=e[e.length-1],a=i[e],n=n(a),n!=a&&n!=null&&t(i,e,{configurable:!0,writable:!0,value:n})}}i(`Symbol`,function(e){function n(e){if(this instanceof n)throw TypeError(`Symbol is not a constructor`);return new r(`jscomp_symbol_`+(e||``)+`_`+ i++,e)}function r(e,n){this.l=e,t(this,`description`,{configurable:!0,writable:!0,value:n})}if(e)return e;r.prototype.toString=function(){return this.l};var i=0;return n}),i(`Symbol.iterator`,function(n){if(n)return n;n=Symbol(`Symbol.iterator`);for(var i=`Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array`.split(` `),o=0;o<i.length;o++){var s=r[i[o]];typeof s==`function`&&typeof s.prototype[n]!=`function`&&t(s.prototype,n,{configurable:!0,writable:!0,value:function(){return a(e(this))}})}return n});function a(e){return e={next:e},e[Symbol.iterator]=function(){return this},e}function o(t){var n=typeof Symbol<`u`&&Symbol.iterator&&t[Symbol.iterator];return n?n.call(t):{next:e(t)}}function s(e){if(!(e instanceof Array)){e=o(e);for(var t,n=[];!(t=e.next()).done;)n.push(t.value);e=n}return e}var c=typeof Object.create==`function`?Object.create:function(e){function t(){}return t.prototype=e,new t},l=function(){function e(){function e(){}return new e,Reflect.construct(e,[],function(){}),new e instanceof e}if(typeof Reflect<`u`&&Reflect.construct){if(e())return Reflect.construct;var t=Reflect.construct;return function(e,n,r){return e=t(e,n),r&&Reflect.setPrototypeOf(e,r.prototype),e}}return function(e,t,n){return n===void 0&&(n=e),n=c(n.prototype||Object.prototype),Function.prototype.apply.call(e,n,t)||n}}(),u;if(typeof Object.setPrototypeOf==`function`)u=Object.setPrototypeOf;else{var d;a:{var f={a:!0},p={};try{p.__proto__=f,d=p.a;break a}catch{}d=!1}u=d?function(e,t){if(e.__proto__=t,e.__proto__!==t)throw TypeError(e+` is not extensible`);return e}:null}var m=u,h=window;if(h.CustomElementRegistryPolyfill?.formAssociated===void 0){var g={};h.CustomElementRegistryPolyfill=(g.formAssociated=new Set,g)}var _=window.HTMLElement,ee=window.customElements.define,te=window.customElements.get,v=window.customElements,y=new WeakMap,b=new WeakMap,ne=new WeakMap,re=new WeakMap;function ie(){var e;this.promise=new Promise(function(t){e=t}),this.resolve=e}function x(){this.h=new Map,this.m=new Map,this.j=new Map,this.i=new Map}x.prototype.define=function(e,t){if(e=e.toLowerCase(),this.h.get(e)!==void 0)throw new DOMException(`Failed to execute 'define' on 'CustomElementRegistry': the name "`+e+`" has already been used with this registry`);if(this.m.get(t)!==void 0)throw new DOMException(`Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry`);var n=t.prototype.attributeChangedCallback,r=new Set(t.observedAttributes||[]);se(t,r,n);var i=te.call(v,e),a=i?.s??(t.formAssociated||h.CustomElementRegistryPolyfill.formAssociated.has(e));if(a&&h.CustomElementRegistryPolyfill.formAssociated.add(e),a!=t.formAssociated)try{t.formAssociated=a}catch{}if(n={tagName:e,g:t,connectedCallback:t.prototype.connectedCallback,disconnectedCallback:t.prototype.disconnectedCallback,adoptedCallback:t.prototype.adoptedCallback,attributeChangedCallback:n,formAssociated:a,formAssociatedCallback:t.prototype.formAssociatedCallback,formDisabledCallback:t.prototype.formDisabledCallback,formResetCallback:t.prototype.formResetCallback,formStateRestoreCallback:t.prototype.formStateRestoreCallback,observedAttributes:r},this.h.set(e,n),this.m.set(t,n),i||(i=oe(e),ee.call(v,e,i)),this===window.customElements&&(ne.set(t,n),n.o=i),i=this.i.get(e))for(this.i.delete(e),i=o(i),r=i.next();!r.done;r=i.next())r=r.value,b.delete(r),D(r,n,!0);return i=this.j.get(e),i!==void 0&&(i.resolve(t),this.j.delete(e)),t},x.prototype.upgrade=function(e){var t=[...arguments];k.push(this),v.upgrade.apply(v,s(t)),k.pop()},x.prototype.get=function(e){return this.h.get(e)?.g},x.prototype.whenDefined=function(e){var t=this.h.get(e);return t===void 0?(t=this.j.get(e),t===void 0&&(t=new ie,this.j.set(e,t)),t.promise):Promise.resolve(t.g)};function ae(e,t,n,r){var i=e.i.get(n);i||e.i.set(n,i=new Set),r?i.add(t):i.delete(t)}var S;window.HTMLElement=function(){var e=S;if(e)return S=void 0,e;var t=ne.get(this.constructor);if(!t)throw TypeError(`Illegal constructor (custom element class must be registered with global customElements registry to be newable)`);return e=Reflect.construct(_,[],t.o),Object.setPrototypeOf(e,this.constructor.prototype),y.set(e,t),e},window.HTMLElement.prototype=_.prototype;function oe(e){function t(){var t=Reflect.construct(_,[],this.constructor);Object.setPrototypeOf(t,HTMLElement.prototype);a:{var n=t.getRootNode();if(!(n===document||n instanceof ShadowRoot)){if(n=k[k.length-1],n instanceof CustomElementRegistry){var r=n;break a}n=n.getRootNode(),n===document||n instanceof ShadowRoot||(n=(r=re.get(n))?.getRootNode()||document)}r=n.registry}return r||=window.customElements,(n=r.h.get(e))?D(t,n):b.set(t,r),t}return r.Object.defineProperty(t,`formAssociated`,{configurable:!0,enumerable:!0,get:function(){return h.CustomElementRegistryPolyfill.formAssociated.has(e)}}),t.prototype.connectedCallback=function(t){for(var n=[],r=0;r<arguments.length;++r)n[r]=arguments[r];w(this),(r=y.get(this))?r.connectedCallback&&r.connectedCallback.apply(this,n):ae(b.get(this),this,e,!0)},t.prototype.disconnectedCallback=function(t){for(var n=[],r=0;r<arguments.length;++r)n[r]=arguments[r];(r=y.get(this))?r.disconnectedCallback&&r.disconnectedCallback.apply(this,n):ae(b.get(this),this,e,!1)},t.prototype.adoptedCallback=function(e){var t=[...arguments],n,r;(n=y.get(this))==null||(r=n.adoptedCallback)==null||r.apply(this,t)},t.prototype.formAssociatedCallback=function(e){for(var t=[],n=0;n<arguments.length;++n)t[n]=arguments[n];if(n=y.get(this),n!=null&&n.formAssociated){var r;n==null||(r=n.formAssociatedCallback)==null||r.apply(this,t)}},t.prototype.formDisabledCallback=function(e){for(var t=[],n=0;n<arguments.length;++n)t[n]=arguments[n];if(n=y.get(this),n!=null&&n.formAssociated){var r;n==null||(r=n.formDisabledCallback)==null||r.apply(this,t)}},t.prototype.formResetCallback=function(e){for(var t=[],n=0;n<arguments.length;++n)t[n]=arguments[n];if(n=y.get(this),n!=null&&n.formAssociated){var r;n==null||(r=n.formResetCallback)==null||r.apply(this,t)}},t.prototype.formStateRestoreCallback=function(e){for(var t=[],n=0;n<arguments.length;++n)t[n]=arguments[n];if(n=y.get(this),n!=null&&n.formAssociated){var r;n==null||(r=n.formStateRestoreCallback)==null||r.apply(this,t)}},t}window.CustomElementRegistry=x;function se(e,t,n){if(t.size!==0&&n!==void 0){var r=e.prototype.setAttribute;r&&(e.prototype.setAttribute=function(e,i){if(w(this),e=e.toLowerCase(),t.has(e)){var a=this.getAttribute(e);r.call(this,e,i),n.call(this,e,a,i)}else r.call(this,e,i)});var i=e.prototype.removeAttribute;i&&(e.prototype.removeAttribute=function(e){if(w(this),e=e.toLowerCase(),t.has(e)){var r=this.getAttribute(e);i.call(this,e),n.call(this,e,r,null)}else i.call(this,e)});var a=e.prototype.toggleAttribute;a&&(e.prototype.toggleAttribute=function(e,r){if(w(this),e=e.toLowerCase(),t.has(e)){var i=this.getAttribute(e);a.call(this,e,r),r=this.getAttribute(e),i!==r&&n.call(this,e,i,r)}else a.call(this,e,r)})}}var C;document.readyState===`loading`&&(C=new Set,document.addEventListener(`readystatechange`,function(){C.forEach(function(e){return T(e,y.get(e))})},{once:!0}));function w(e){var t;(t=C)!=null&&t.has(e)&&T(e,y.get(e))}function T(e,t){var n;(n=C)==null||n.delete(e),t.attributeChangedCallback&&t.observedAttributes.forEach(function(n){e.hasAttribute(n)&&t.attributeChangedCallback.call(e,n,null,e.getAttribute(n))})}function E(e){var t=Object.getPrototypeOf(e);if(t!==window.HTMLElement)return t===_?Object.setPrototypeOf(e,window.HTMLElement):E(t)}function D(e,t,n){n=n===void 0?!1:n,Object.setPrototypeOf(e,t.g.prototype),y.set(e,t),S=e;try{new t.g}catch{E(t.g),new t.g}t.attributeChangedCallback&&(C===void 0||e.hasAttributes()?T(e,t):C.add(e)),n&&t.connectedCallback&&e.isConnected&&t.connectedCallback.call(e)}var O=Element.prototype.attachShadow;Element.prototype.attachShadow=function(e,t){for(var n=[],r=1;r<arguments.length;++r)n[r-1]=arguments[r];var i=Object.assign({},e);return r=e.customElements,r=e.registry===void 0?r:e.registry,i=(delete i.customElements,delete i.registry,i),n=O.call.apply(O,[this,i].concat(s(n))),r!==void 0&&(n.customElements=n.registry=r),n};var k=[document];function A(e,t,n){var r=(n?Object.getPrototypeOf(n):e.prototype)[t];e.prototype[t]=function(e){var t=[...arguments];return k.push(this),t=r.apply(n||this,t),t!==void 0&&re.set(t,this),k.pop(),t}}A(ShadowRoot,`createElement`,document),A(ShadowRoot,`createElementNS`,document),A(ShadowRoot,`importNode`,document),A(Element,`insertAdjacentHTML`);function j(e){var t=Object.getOwnPropertyDescriptor(e.prototype,`innerHTML`);Object.defineProperty(e.prototype,`innerHTML`,Object.assign({},t,{set:function(e){k.push(this),t.set.call(this,e),k.pop()}}))}if(j(Element),j(ShadowRoot),Object.defineProperty(window,`customElements`,{value:new CustomElementRegistry,configurable:!0,writable:!0}),window.ElementInternals&&window.ElementInternals.prototype.setFormValue){var ce=new WeakMap,M=HTMLElement.prototype.attachInternals,le=[`setFormValue`,`setValidity`,`checkValidity`,`reportValidity`];HTMLElement.prototype.attachInternals=function(e){var t=[...arguments];return t=M.call.apply(M,[this].concat(s(t))),ce.set(t,this),t},le.forEach(function(e){var t=window.ElementInternals.prototype,n=t[e];t[e]=function(e){for(var t=[],r=0;r<arguments.length;++r)t[r]=arguments[r];if(r=ce.get(this),!0===y.get(r).formAssociated)return n?.call.apply(n,[this].concat(s(t)));throw new DOMException(`Failed to execute `+n+` on 'ElementInternals': The target element is not a form-associated custom element.`)}});var N=function(e){var t=l(Array,[].concat(s(e)),this.constructor);return t.l=e,t},P=N,F=Array;if(P.prototype=c(F.prototype),P.prototype.constructor=P,m)m(P,F);else for(var I in F)if(I!=`prototype`)if(Object.defineProperties){var L=Object.getOwnPropertyDescriptor(F,I);L&&Object.defineProperty(P,I,L)}else P[I]=F[I];P.u=F.prototype,r.Object.defineProperty(N.prototype,`value`,{configurable:!0,enumerable:!0,get:function(){return this.l.find(function(e){return!0===e.checked})?.value||``}});var R=function(e){var t=this,n=new Map;e.forEach(function(e,r){var i=e.getAttribute(`name`),a=n.get(i)||[];t[+r]=e,a.push(e),n.set(i,a)}),this.length=e.length,n.forEach(function(e,n){e&&n!==`length`&&n!==`item`&&n!==`namedItem`&&(t[n]=e.length===1?e[0]:new N(e))})};R.prototype.item=function(e){return this[e]??null},R.prototype[Symbol.iterator]=function(){throw Error(`Method not implemented.`)},R.prototype.namedItem=function(e){return this[e]??null};var z=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,`elements`);Object.defineProperty(HTMLFormElement.prototype,`elements`,{get:function(){var e=z.get.call(this),t=[];e=o(e);for(var n=e.next();!n.done;n=e.next()){n=n.value;var r=y.get(n);r&&!0!==r.formAssociated||t.push(n)}return new R(t)}})}}).call(typeof globalThis==`object`?globalThis:window);var Oe={"activity-example":{"hello-world":`Hallo Welt`},buttons:{"scroll-to-bottom-button-label":`Zum Seitenende scrollen`,"scroll-to-top-button-label":`Zum Seitenanfang scrollen`},"choose-from-menu":`Bitte wählen Sie eine Aktivität aus dem Menu.`,contact:`Kontakt`,imprint:`Impressum`,login:`Anmelden`,logout:`Abmelden`,"main-page":{menu:`Menü`},"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`,"standard-layout-name":`Standard`,"switch-layout":`Layout wechseln`,"switch-to-standard-layout-label":`Zum Standardlayout wechseln`,"switch-to-wide-layout-label":`Zum Weiten Layout wechseln`,welcome:{headline:`Willkommen!`},"wide-layout-name":`Erweitert`},ke={"activity-example":{"hello-world":`Hello World`},buttons:{"scroll-to-bottom-button-label":`Scroll to page bottom`,"scroll-to-top-button-label":`Scroll to page top`},"choose-from-menu":`Please choose an activity from the menu.`,contact:`Contact`,imprint:`Legal Notice`,login:`Login`,logout:`Logout`,"main-page":{menu:`Menu`},"page-not-found":`Requested Page Not Found`,"page-updated-needs-reload":`The application has been updated. Please reload the page.`,"privacy-policy":`Privacy Policy`,"standard-layout-name":`Standard`,"switch-layout":`Switch layout`,"switch-to-standard-layout-label":`Switch to Standard Layout`,"switch-to-wide-layout-label":`Switch to Wide Layout`,welcome:{headline:`Welcome!`},"wide-layout-name":`Wide`};function Ae(){return W({en:ke,de:Oe},`de`,`en`)}var je={de:`Deutsch`,"de-action":`Auf Deutsch anzeigen`,demo:`Hallo Welt`,en:`Englisch`,"en-action":`Auf Englisch anzeigen`},Me={de:`German`,"de-action":`Switch to German`,demo:`Hello World`,en:`English`,"en-action":`Switch to English`};function Ne(){return W({en:Me,de:je},`de`,`en`)}var Pe=class extends K{constructor(){super(),this._lang=`de`,this.languages=[`de`,`en`],this._i18n=Ne(),this._i18n.t(`de`),this._i18n.t(`de-action`),this._i18n.t(`en`),this._i18n.t(`en-action`)}_getNextLanguage(e){var t=this.languages.indexOf(e),n=this.languages[t+1];return n===void 0&&(n=this.languages[0]),n}_getPreviousLanguage(e){var t=this.languages.indexOf(e),n=this.languages[t-1];return n===void 0&&(n=this.languages[this.languages.length-1]),n}static get properties(){return{lang:{type:String},next:{type:String},languages:{type:Array}}}set lang(e){let t=this.lang,n=this.next;this._lang=e,this.requestUpdate(`lang`,t),this.requestUpdate(`next`,n),t!==e&&(this.sendSetPropertyEvent(`lang`,e),this._i18n.changeLanguage(this.next))}get lang(){return this._lang}set next(e){this.lang=this._getPreviousLanguage(e)}get next(){return this._getNextLanguage(this.lang)}static get styles(){return M(t||=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); } `,I())}onClick(e){e.preventDefault(),this.lang=this.next}render(){return z(n||=e` <a href="#" title="${0}" @click=${0}>${0}</a> `,this._i18n.t(this.next+`-action`),this.onClick,this.next.toUpperCase())}},Fe={"logging-in":`Anmeldung läuft`,login:`Anmelden`,"login-failed":`Kommunikation mit dem Anmeldeserver fehlgeschlagen`,logout:`Abmelden`},Ie={"logging-in":`Logging in`,login:`Login`,"login-failed":`Communication with the login server failed`,logout:`Logout`};function Le(){return W({en:Ie,de:Fe},`de`,`en`)}const Re=function(e,t){let n=new Promise((t,n)=>{let r=setTimeout(()=>{clearTimeout(r),n(`Timed out in `+e+`ms.`)},e)});return Promise.race([t,n])},ze=function(e){try{return new URL(e).href}catch{return new URL(e,window.location.href).href}};var Be=class extends EventTarget{constructor(e,t,n,r,i,a){super(),this._baseURL=e,this._realm=t,this._clientId=n,this._keycloak=null,this._initPromise=null,this._silentCheckSsoUri=r,this._checkLoginIframe=i,this._idpHint=a,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(){document.visibilityState===`visible`&&this._checkTokeHasExpired()}_onChanged(){let e=new CustomEvent(`changed`,{detail:this._keycloak,bubbles:!0,composed:!0});this.dispatchEvent(e)}_onReady(e){e&&this._onChanged()}async _onTokenExpired(){console.log(`Token has expired`);let e=!1;try{e=await this._keycloak.updateToken(-1)}catch(e){console.log(`Failed to refresh the token`,e);return}console.assert(e,`token should have been refreshed`)}async _checkTokeHasExpired(){let e;if(this._keycloak===null||!this._keycloak.authenticated)return;let t=this.MIN_VALIDITY+this.CHECK_INTERVAL;this.DEBUG&&console.log(`Updating token if not valid for at least ${t}s`);try{e=await this._keycloak.updateToken(t)}catch(e){console.log(`Failed to refresh the token`,e)}this.DEBUG&&e&&console.log(`token has been refreshed`)}async _onAuthSuccess(){this._checkId!==null&&(clearInterval(this._checkId),this._checkId=null),this._checkId=setInterval(this._checkTokeHasExpired.bind(this),this.CHECK_INTERVAL*1e3),this._onChanged()}async _onAuthLogout(){this._checkId!==null&&(clearInterval(this._checkId),this._checkId=null),this._onChanged()}async _init(){let e=(await import(`./shared/keycloak.Cr_baO-G.js`)).default;this._keycloak=new e({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);let t={};t.pkceMethod=`S256`,this.DEBUG&&(t.enableLogging=!0),t.checkLoginIframe=this._checkLoginIframe,this._silentCheckSsoUri?(t.onLoad=`check-sso`,t.silentCheckSsoRedirectUri=ze(this._silentCheckSsoUri),await Re(5e3,this._keycloak.init(t)).catch(()=>{console.log(`Login timed out`),this._onChanged()})):await this._keycloak.init(t)}async _ensureInit(){return this._initPromise===null&&(this._initPromise=this._init()),this._initPromise}isLoggingIn(){let e=window.location.href;return e.search(`[&#]state=`)>=0&&e.search(`[&#]session_state=`)>=0}async login(e){await this._ensureInit(),e||={};let t=e.lang||`en`,n=e.scope||``;this._keycloak.authenticated||await this._keycloak.login({locale:t,scope:n,idpHint:this._idpHint})}async tryLogin(){await this._ensureInit()}async localLogout(){this._keycloak.clearToken()}async logout(){await this._ensureInit(),this._keycloak.logout()}};const Y=Object.freeze({UNKNOWN:`unknown`,LOGGING_IN:`logging-in`,LOGGED_IN:`logged-in`,LOGGING_OUT:`logging-out`,LOGGED_OUT:`logged-out`});var Ve=class extends H(K,Le){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=Y.UNKNOWN,this.requestedLoginStatus=Y.UNKNOWN,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(e){e.forEach((e,t)=>{switch(t){case`requestedLoginStatus`:{console.log(`requested-login-status changed`,this.requestedLoginStatus);let e=this.requestedLoginStatus;switch(this.requestedLoginStatus=Y.UNKNOWN,e){case Y.LOGGED_IN:this._kcwrapper.login({lang:this.lang,scope:this.scope||``});break;case Y.LOGGED_OUT:this._loginStatus===Y.LOGGED_IN&&this._setLoginStatus(Y.LOGGING_OUT),this._kcwrapper.logout(),this._loginStatus===Y.LOGGING_OUT&&this._setLoginStatus(Y.LOGGED_IN);break}break}}}),super.update(e)}async _fetchUser(e,t){let n=xe(this.entryPointUrl,`/frontend/users/${encodeURIComponent(e)}`),r=await fetch(n,{headers:{Authorization:`Bearer `+t}});if(!r.ok)throw r;return{roles:(await r.json()).roles??[]}}async _onKCChanged(e){let t=e.detail;if(this._authenticated=t.authenticated,t.authenticated){if(t.subject!==this.subject){this._loginStatus===Y.LOGGED_IN&&(this._setLoginStatus(Y.LOGGING_OUT),this._setLoggedOut());let e=t.idTokenParsed.preferred_username;this._userId=e;let n;try{n=await this._fetchUser(e,t.token)}catch(e){console.error(e),n={roles:[]}}e===this._userId&&(this._user=n)}let e=this.token!==t.token;this.token=t.token,this.name=t.idTokenParsed.name,this.subject=t.subject,this._user!==null&&this._setLoginStatus(Y.LOGGED_IN,e)}else this._loginStatus===Y.LOGGED_IN&&this._setLoginStatus(Y.LOGGING_OUT),this._setLoggedOut()}_setLoggedOut(){this.name=``,this.token=``,this.subject=``,this._userId=``,this._user=null,this._setLoginStatus(Y.LOGGED_OUT)}sendSetPropertyEvents(){let e={"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,_roles:this._user?this._user.roles:[]};this.sendSetPropertyEvent(`auth`,e)}_setLoginStatus(e,t){this._loginStatus===e&&!t||(this._loginStatus=e,this.sendSetPropertyEvents())}static get properties(){return k(k({},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 e=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 Be(this.keycloakUrl,this.realm,this.clientId,this.silentCheckSsoRedirectUri,!this.noCheckLoginIframe,this.idpHint),this._kcwrapper.addEventListener(`changed`,this._onKCChanged),async function(){try{e.forceLogin||e._kcwrapper.isLoggingIn()?(e._setLoginStatus(Y.LOGGING_IN),await e._kcwrapper.login({lang:e.lang,scope:e.scope||``})):e.tryLogin?(e._setLoginStatus(Y.LOGGING_IN),await e._kcwrapper.tryLogin(),e._authenticated||e._setLoginStatus(Y.LOGGED_OUT)):e._setLoginStatus(Y.LOGGED_OUT)}catch(t){throw e._setLoginStatus(Y.LOGGED_OUT),we({summary:e._i18n.t(`login-failed`),type:`danger`,timeout:5}),t}}()}disconnectedCallback(){this._kcwrapper.close(),this._kcwrapper.removeEventListener(`changed`,this._onKCChanged),super.disconnectedCallback()}},He=class extends de(H(R(K),Ae)){constructor(){super(),this.closeDropdown=this.closeDropdown.bind(this),this.onWindowResize=this.onWindowResize.bind(this)}static get scopedElements(){return{"dbp-icon":F}}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(){let e=this.shadowRoot.querySelector(`div.dropdown-menu`);if(!e)return;let t=this.getBoundingClientRect(),n=window.innerWidth-t.left;e.setAttribute(`style`,`width: ${n-20}px`)}onLoginClicked(e){this.sendSetPropertyEvent(`requested-login-status`,Y.LOGGED_IN),e.preventDefault()}onLogoutClicked(e){this.sendSetPropertyEvent(`requested-login-status`,Y.LOGGED_OUT)}static get styles(){return M(r||=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; } `,I())}setChevron(e){let t=this.shadowRoot.querySelector(`#menu-chevron-icon`);t!==null&&(t.name=e)}onDropdownClick(e){e.stopPropagation(),e.currentTarget.classList.toggle(`is-active`),this.setChevron(e.currentTarget.classList.contains(`is-active`)?`chevron-up`:`chevron-down`),this.updateDropdownWidth()}closeDropdown(){this.shadowRoot.querySelectorAll(`.dropdown`).forEach(function(e){e.classList.remove(`is-active`)}),this.setChevron(`chevron-down`)}renderLoggedIn(){let t=this._i18n;return z(i||=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(){let t=this._i18n;return z(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,fe(` <svg viewBox="0 0 100 100" y="0px" x="0px" id="icon" role="img" version="1.1"> <g id="g6"> <path style="stroke-width:1.33417916" id="path2" 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" /> <path id="path4" 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" /> </g> </svg> `),t.t(`login`))}render(){return z(o||=e` <div class="authbox"> ${0} </div> `,this.isLoggedIn()?this.renderLoggedIn():this.renderLoggedOut())}}; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const Ue=(e,t,n)=>{let r=new Map;for(let i=t;i<=n;i++)r.set(e[i],i);return r},We=ye(class extends he{constructor(e){if(super(e),e.type!==me.CHILD)throw Error(`repeat() can only be used in text expressions`)}dt(e,t,n){let r;n===void 0?n=t:t!==void 0&&(r=t);let i=[],a=[],o=0;for(let t of e)i[o]=r?r(t,o):o,a[o]=n(t,o),o++;return{values:a,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,r]){let i=Te(e),{values:a,keys:o}=this.dt(t,n,r);if(!Array.isArray(i))return this.ut=o,a;let s=this.ut??=[],c=[],l,u,d=0,f=i.length-1,p=0,m=a.length-1;for(;d<=f&&p<=m;)if(i[d]===null)d++;else if(i[f]===null)f--;else if(s[d]===o[p])c[p]=J(i[d],a[p]),d++,p++;else if(s[f]===o[m])c[m]=J(i[f],a[m]),f--,m--;else if(s[d]===o[m])c[m]=J(i[d],a[m]),q(e,c[m+1],i[d]),d++,m--;else if(s[f]===o[p])c[p]=J(i[f],a[p]),q(e,i[d],i[f]),f--,p++;else if(l===void 0&&(l=Ue(o,p,m),u=Ue(s,d,f)),l.has(s[d]))if(l.has(s[f])){let t=u.get(o[p]),n=t===void 0?null:i[t];if(n===null){let t=q(e,i[d]);J(t,a[p]),c[p]=t}else c[p]=J(n,a[p]),q(e,i[d],n),i[t]=null;p++}else De(i[f]),f--;else De(i[d]),d++;for(;p<=m;){let t=q(e,c[m+1]);J(t,a[p]),c[p++]=t}for(;d<=f;){let e=i[d++];e!==null&&De(e)}return this.ut=o,Ee(e,c),ue}});function Ge(t){let n=t.split(` `);return n.map((t,r)=>z(s||=e` ${0}${0} `,t,r<n.length-1?z(c||=e` <br /> `):``))}var Ke=class extends R(G){constructor(){super(),this.type=`info`,this.body=``,this.summary=``,this.timeout=0,this.icon=``,this.replaceId=null,this.notificationId=null,this.targetNotificationId=null,this._progressTimeout=null}static get scopedElements(){return{"dbp-icon":F}}static get properties(){return{type:{type:String},body:{type:String},summary:{type:String},timeout:{type:Number},icon:{type:String},replaceId:{type:String},notificationId:{type:String,reflect:!0}}}connectedCallback(){super.connectedCallback(),this.timeout>0&&(this._progressTimeout=setTimeout(()=>{this.handleDelete(!0)},this.timeout*1e3))}disconnectedCallback(){this._progressTimeout&&clearTimeout(this._progressTimeout),super.disconnectedCallback()}handleDelete(e=!1){this.dispatchEvent(new CustomEvent(`dbp-notification-close`,{detail:{targetNotificationId:this.targetNotificationId,automatic:e},bubbles:!0,composed:!0}))}static get styles(){return M(l||=e` ${0} ${0} ${0} .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); } `,I(),B(),L())}render(){let t=this.timeout>0?`has-progress-bar`:`no-progress-bar`,n=this.timeout>0?`--dbp-progress-timeout: ${this.timeout}s;`:``;return z(u||=e` <div class="notification is-${0} ${0} enter-animation"> <button class="delete" @click=${0} aria-label="Close notification"></button> ${0} <div class="content"> ${0} <span>${0}</span> </div> ${0} </div> `,this.type,t,this.handleDelete,this.summary?z(d||=e` <h3>${0}</h3> `,this.summary):``,this.icon?z(f||=e` <dbp-icon name="${0}"></dbp-icon> `,this.icon):``,Ge(this.body),this.timeout>0?z(p||=e` <div class="progress-container"> <div class="progress" style="${0}"></div> </div> `,n):``)}},qe=class extends R(G){constructor(){super(),this.notifications=[],this._boundNotificationHandler=this._handleNotificationEvent.bind(this)}static get scopedElements(){return{"dbp-notification-item":Ke}}static get properties(){return k(k({},super.properties),{},{inline:{type:Boolean,attribute:`inline`},notifications:{type:Array,state:!0}})}_handleNotificationEvent(e){let t=e.detail.targetNotificationId??null;if(t){if(t!==this.id)return}else if(this.id!==`dbp-notification`)return;e.preventDefault(),e.stopImmediatePropagation();let n=e.detail.replaceId??null,r={id:le(),type:e.detail.type??`info`,body:e.detail.body??``,summary:e.detail.summary??``,timeout:e.detail.timeout??0,icon:e.detail.icon??``,replaceId:n};n&&(this.notifications=this.notifications.filter(e=>e.replaceId!==n)),this.notifications.push(r),this.requestUpdate(`notifications`),this.updateComplete.then(()=>{let e=new CustomEvent(`dbp-notification-added`,{detail:{targetNotificationId:this.id},bubbles:!0,composed:!0});this.dispatchEvent(e)})}connectedCallback(){super.connectedCallback(),window.addEventListener(`dbp-notification-send`,this._boundNotificationHandler)}disconnectedCallback(){window.removeEventListener(`dbp-notification-send`,this._boundNotificationHandler),super.disconnectedCallback();for(let e of Object.values(this.notifications))clearTimeout(e.progressTimeout)}_removeById(e,t=!1){let n=this.shadowRoot.querySelector(`dbp-notification-item[notificationId="${e}"]`);if(n){let r=t?0:500;n.classList.add(`is-removing`),setTimeout(()=>{this.notifications=this.notifications.filter(t=>t.id!==e),this.dispatchEvent(new CustomEvent(`dbp-notification-removed`,{detail:{targetNotificationId:this.id},bubbles:!0,composed:!0}))},r)}}removeAllNotifications(){this.notifications=[]}static get styles(){return M(m||=e` ${0} ${0} ${0} .notification-container { position: fixed; top: 0; max-width: 500px; margin: 0.75em auto; left: 0; right: 0; z-index: 1000; padding: 0; } :host([inline]) .notification-container { top: 0; left: 0; right: 0; max-width: 100%; margin: 0 auto; display: flex; flex-direction: column; } :host([inline]) .notification-container--inside { margin-top: 60px; } .notification h3 { font: inherit; font-weight: bold; margin-bottom: 3px; } `,I(),B(),L())}render(){return z(h||=e` <div class="notification-container" id="notification-container"> ${0} </div> `,We(this.notifications,e=>e.id,t=>z(g||=e` <dbp-notification-item .type=${0} .body=${0} .summary=${0} .timeout=${0} .icon=${0} .replaceId=${0} .notificationId=${0} @dbp-notification-close=${0}></dbp-notification-item> `,t.type,t.body,t.summary,t.timeout,t.icon,t.replaceId,t.id,e=>{this._removeById(t.id,e.detail.automatic)})))}},Je={"color-mode":`Farbmodus ändern`,"demo-title":`Theme Switcher Demo`,intro:`Mit dem Theme-Switcher können Sie zwischen unterschiedlichen Farb-Themes umschalten.`},Ye={"color-mode":`Change color mode`,"demo-title":`Theme Switcher Demo`,intro:`With the theme-switcher you can switch between multiple themes.`};function Xe(){return W({en:Ye,de:Je},`de`,`en`)}var Ze=class extends H(R(K),Xe){constructor(){super(),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 k(k({},super.properties),{},{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":F}}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.darkModeThemeOverride===null?this.detectBrowserDarkMode=!0:this.darkModeThemeOverride===``?this.detectBrowserDarkMode=!1:(this.detectBrowserDarkMode=!0,this.darkModeClass=this.darkModeThemeOverride),this.loadTheme(`light-theme`),this.detectInitialMode()}),this.langDir&&Ce(this._i18n,this)}detectInitialMode(){let e=localStorage.getItem(`prefered-color-mode`);if(e){let t=this.themes.find(t=>t.class===e);t&&this.loadTheme(t.class);return}if(this.detectBrowserDarkMode&&window.matchMedia(`(prefers-color-scheme: dark)`).matches){let e=this.themes.find(e=>e.class===this.darkModeClass);e&&this.loadTheme(e.class)}}toggleModeMenu(){let e=this.shadowRoot.querySelector(`.mode-button`);if(!e)return;e.classList.contains(`active`)?e.classList.remove(`active`):e.classList.add(`active`);let t=this.shadowRoot.querySelector(`ul.extended-menu`),n=this.shadowRoot.querySelector(`.mode-button`);t===null||n===null||(t.classList.toggle(`hidden`),t.classList.contains(`hidden`)?document.removeEventListener(`click`,this.boundCloseAdditionalMenuHandler):(document.addEventListener(`click`,this.boundCloseAdditionalMenuHandler),this.initateOpenAdditionalMenu=!0))}hideModeMenu(){if(this.initateOpenAdditionalMenu){this.initateOpenAdditionalMenu=!1;return}let e=this.shadowRoot.querySelector(`ul.extended-menu`);e&&!e.classList.contains(`hidden`)&&this.toggleModeMenu()}loadTheme(e){let t=this.shadowRoot.querySelector(`.button-`+e),n=this.shadowRoot.querySelectorAll(`.button-theme`),r=this.shadowRoot.host.getRootNode({composed:!0}).body;t===null||n.length===0||r===null||(n.forEach(e=>e.classList.remove(`active`)),t.classList.add(`active`),r.classList.contains(e)||(this.themes.forEach(e=>{r.classList.remove(e.class)}),r.classList.add(e)))}saveTheme(e){let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=window.matchMedia(`(prefers-color-scheme: light)`);e===`light-theme`&&n.matches||e===this.darkModeClass&&t.matches?localStorage.removeItem(`prefered-color-mode`):localStorage.setItem(`prefered-color-mode`,e)}static get styles(){return M(_||=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 { text-align: left; min-width: 160px; } .extended-menu li a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 12px 15px; width: 100%; box-sizing: border-box; text-align: left; color: var(--dbp-content); background: none; display: block; } .icon { margin-right: 10px; } #theme-menu { position: relative; } .ul-right { right: 0px; } `,I(),B(),N())}render(){let t=this._i18n;return z(ee||=e` <div id="theme-menu" class="${0}"> <a href="#" class="mode-button" title="${0}" @click="${0}"> <dbp-icon name="contrast"></dbp-icon> </a> <ul class="extended-menu hidden ${0}"> ${0} </ul> </div> `,U({hidden:this.themes.length<=1}),t.t(`color-mode`),e=>{this.toggleModeMenu(),e.preventDefault()},U({"ul-right":this.dropdownRight}),this.themes.map(t=>z(te||=e` <li class="" id="${0}"> <a href="#" class="button-theme button-${0}" @click="${0}" title="${0}"> <dbp-icon class="icon" name="${0}"></dbp-icon> ${0} </a> </li> `,t.class,t.class,e=>{this.loadTheme(t.class),this.saveTheme(t.class),e.preventDefault()},t.name,t.icon,t.name)))}},Qe=class extends K{constructor(){super(),this._observer=null,this._dark=!1}static get properties(){return k(k({},super.properties),{},{_dark:{type:Boolean}})}static get styles(){return M(v||=e` .hidden { display: none; } `)}connectedCallback(){super.connectedCallback(),this._observer=new MutationObserver(()=>{this._dark=document.body.classList.contains(`dark-theme`)}),this._observer.observe(document.body,{attributes:!0,attributeFilter:[`class`]})}disconnectedCallback(){this._observer.disconnect(),this._observer=null,super.disconnectedCallback()}render(){return z(y||=e` <slot class="${0}" name="light"></slot> <slot class="${0}" name="dark"></slot> `,U({hidden:this._dark}),U({hidden:!this._dark}))}}; /*! Path-to-RegExp | MIT License | https://github.com/pillar