UNPKG

@dbp-topics/dualdelivery

Version:

[GitLab Repository](https://gitlab.tugraz.at/dbp/dual-delivery/dualdelivery) | [npmjs package](https://www.npmjs.com/package/@dbp-topics/dualdelivery) | [Unpkg CDN](https://unpkg.com/browse/@dbp-topics/dualdelivery/) | [Dual Delivery Bundle](https://gitla

115 lines (113 loc) 10.8 kB
let t,e,n,i,s,r,o=t=>t; /*! * 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/common: LGPL-2.1-or-later * @dbp-toolkit/auth: LGPL-2.1-or-later * event-target-shim: MIT * lit-html: BSD-3-Clause * @dbp-toolkit/notification: LGPL-2.1-or-later * @dbp-toolkit/theme-switcher: LGPL-2.1-or-later * path-to-regexp: MIT * universal-router: MIT * generateUrls: MIT * @dbp-toolkit/matomo: LGPL-2.1-or-later * @babel/runtime: MIT * i18next: MIT * @lit/reactive-element: BSD-3-Clause * lit-element: BSD-3-Clause * @open-wc/dedupe-mixin: MIT * @open-wc/scoped-elements: MIT */import{s as a,r as c,$ as d,S as l,g as u,e as p,b as h,c as f,p as y,j as m}from"./dbp-lit-element.b2d8e6de.es.js";var v="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function g(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function b(t){var e=t.default;if("function"==typeof e){var n=function(){return e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,i.get?i:{enumerable:!0,get:function(){return t[e]}})})),n}class E extends a{constructor(){super(),this.text=""}static get properties(){return{text:{type:String}}}static get styles(){return c(t||(t=o` .outer { display: inline-block; vertical-align: sub; } .inner { display: flex; } .ring { display: inline-block; position: relative; width: 1em; height: 1em; } .ring div { box-sizing: border-box; display: block; position: absolute; width: 100%; height: 100%; border: 0.2em solid currentColor; border-radius: 50%; animation: ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite; border-color: currentColor transparent transparent transparent; } .ring div:nth-child(1) { animation-delay: -0.45s; } .ring div:nth-child(2) { animation-delay: -0.3s; } .ring div:nth-child(3) { animation-delay: -0.15s; } @keyframes ring { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .text { display: inline-block; margin-left: 0.5em; font-size: 0.7em; } `))}render(){const t=""!==this.text?d(e||(e=o` <div class="text">${0}</div> `),this.text):d(n||(n=o``));return d(i||(i=o` <div class="outer"> <div class="inner"> <div class="ring"> <div></div> <div></div> <div></div> <div></div> </div> ${0} </div> </div> `),t)}}class w extends(l(a)){constructor(){super(),this.value="",this.type="",this.spinner=!1,this.noSpinnerOnClick=!1,this.disabled=!1}static get scopedElements(){return{"dbp-mini-spinner":E}}connectedCallback(){super.connectedCallback()}static get properties(){return{value:{type:String},type:{type:String},spinner:{type:Boolean},noSpinnerOnClick:{type:Boolean,attribute:"no-spinner-on-click"},disabled:{type:Boolean,reflect:!0}}}clickHandler(){this.noSpinnerOnClick||this.start()}start(){this.spinner=!0,this.disabled=!0}stop(){this.spinner=!1,this.disabled=!1}isDisabled(){return this.disabled}static get styles(){return c(s||(s=o` ${0} ${0} .spinner { margin-left: 0.5em; } `),u(),p())}render(){return d(r||(r=o` <button @click="${0}" class="button ${0}" ?disabled="${0}"> ${0} <dbp-mini-spinner class="spinner" style="display: ${0}"></dbp-mini-spinner> </button> `),this.clickHandler,this.type,this.disabled,this.value,this.spinner?"inline":"none")}}l(a); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const F={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},_=t=>(...e)=>({_$litDirective$:t,values:e});class T{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,n){this._$Ct=t,this._$AM=e,this._$Ci=n}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}} /** * @license * Copyright 2018 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const x=_(class extends T{constructor(t){var e;if(super(t),t.type!==F.ATTRIBUTE||"class"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((e=>t[e])).join(" ")+" "}update(t,[e]){var n,i;if(void 0===this.et){this.et=new Set,void 0!==t.strings&&(this.st=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in e)e[t]&&!(null===(n=this.st)||void 0===n?void 0:n.has(t))&&this.et.add(t);return this.render(e)}const s=t.element.classList;this.et.forEach((t=>{t in e||(s.remove(t),this.et.delete(t))}));for(const t in e){const n=!!e[t];n===this.et.has(t)||(null===(i=this.st)||void 0===i?void 0:i.has(t))||(n?(s.add(t),this.et.add(t)):(s.remove(t),this.et.delete(t)))}return h}});function S(t){const e=new CustomEvent("dbp-notification-send",{bubbles:!0,cancelable:!0,detail:t});window.dispatchEvent(e)&&(alert((void 0!==t.summary&&""!==t.summary?t.summary+": ":"")+t.body),console.log("Use the web component dbp-notification to show fancy notifications."))}var O={error:{"connection-to-server-refused":"Verbindungs zum Server verweigert!",summary:"Ein Fehler ist aufgetreten"},jsonld:{"api-documentation-server":"Verbindung zum apiDocumentation API Server {{apiDocUrl}} fehlgeschlagen!","error-api-server":"Verbindung zum API Server {{apiUrl}} fehlgeschlagen!","error-hydra-documentation-url-not-set":"Hydra apiDocumentation URL wurden für server {{apiUrl}} nicht gesetzt!"}},C={error:{"connection-to-server-refused":"Connection to server refused!",summary:"An error occurred"},jsonld:{"api-documentation-server":"Connection to apiDocumentation server {{apiDocUrl}} failed!","error-api-server":"Connection to api server {{apiUrl}} failed!","error-hydra-documentation-url-not-set":"Hydra apiDocumentation url was not set for server {{apiUrl}}!"}};class ${constructor(t,e){this.entities=e,this.baseApiUrl=t;let n={};for(const t in e){n[e[t]["@id"]]=t}this.idToEntityNameMatchList=n}static async getInstance(t,e="de"){let n=$.promises[t];return void 0===n&&(n=new Promise(((n,i)=>{$._initialize(t,(t=>n(t)),(t=>i(t)),e)})),$.promises[t]=n),n}static initialize(t,e,n,i="de"){console.warn("DEPRECATED: JSONLD.initialize(), use JSONLD.getInstance() instead"),$._initialize(t,e,n,i)}static doInitializationOnce(t){console.warn("DEPRECATED: JSONLD.doInitializationOnce() calls can be removed")}static _initialize(t,e,n,i="de"){$._i18n.changeLanguage(i),void 0===$.instances[t]?(void 0===$.successFunctions[t]&&($.successFunctions[t]=[]),void 0===$.failureFunctions[t]&&($.failureFunctions[t]=[]),"function"==typeof e&&$.successFunctions[t].push(e),"function"==typeof n&&$.failureFunctions[t].push(n),t&&void 0===$.initStarted[t]&&($.initStarted[t]=!0,$._doInitialization(t))):"function"==typeof e&&e($.instances[t])}static _doInitialization(t){const e=new XMLHttpRequest,n=$._i18n;e.open("GET",t,!0),e.onreadystatechange=function(){if(4===e.readyState)if(200===e.status){const i=JSON.parse(e.responseText);let s={};for(let t in i)t.startsWith("@")||(s[t.toLowerCase()]=i[t]);const r=y(this.getResponseHeader("link"))["http://www.w3.org/ns/hydra/core#apiDocumentation"];if(void 0!==r){const e=new XMLHttpRequest;e.open("GET",r,!0),e.setRequestHeader("Content-Type","application/json"),e.onreadystatechange=function(){4===e.readyState&&(200===e.status?$._gatherEntities(e,t,s):$._executeFailureFunctions(t,n.t("jsonld.api-documentation-server",{apiUrl:r})))},e.send()}else $._executeFailureFunctions(t,n.t("jsonld.error-hydra-documentation-url-not-set",{apiUrl:t}))}else $._executeFailureFunctions(t,n.t("jsonld.error-api-server",{apiUrl:t}))},e.send()}static _gatherEntities(t,e,n){const i=JSON.parse(t.responseText)["hydra:supportedClass"];let s={};const r=m(e);i.forEach((function(t){const e=t["hydra:title"];let i=n[e.toLowerCase()];void 0===i||i.startsWith("http")||(i=r+i),t["@entryPoint"]=i,s[e]=t}));const o=new $(r,s);if($.instances[e]=o,void 0!==$.successFunctions[e])for(const t of $.successFunctions[e])"function"==typeof t&&t(o);$.successFunctions[e]=[]}static _executeFailureFunctions(t,e=""){const n=$._i18n;if(void 0!==$.failureFunctions[t])for(const n of $.failureFunctions[t])"function"==typeof n&&n(new Error(e));$.failureFunctions[t]=[],""!==e&&S({summary:n.t("error.summary"),body:e,type:"danger"})}getEntityForIdentifier(t){let e=this.getEntityNameForIdentifier(t);return this.getEntityForEntityName(e)}getEntityForEntityName(t){return this.entities[t]}getApiUrlForEntityName(t){const e=this.getEntityForEntityName(t);if(void 0===e||void 0===e["@entryPoint"])throw new Error(`Entity "${t}" not found!`);return e["@entryPoint"]}getEntityNameForIdentifier(t){return this.idToEntityNameMatchList[t]}getApiIdentifierList(){let t=[];for(const e in this.idToEntityNameMatchList)t.push(e);return t}expandMember(t,e){void 0===e&&(e=t["@context"]);let n={"@id":t["@id"]};for(const i of Object.keys(e)){const s=e[i];void 0!==t[i]&&(n[s]=t[i])}return n}compactMember(t,e){let n={};for(const i in e){const s=t[e[i]];void 0!==s&&(n[i]=s)}return n}transformMembers(t,e){const n=t["hydra:member"];if(void 0===n||0===n.length)return[];const i=t["@context"];let s=[],r=this;return n.forEach((function(t){s.push(r.compactMember(r.expandMember(t,i),e))})),s}}$._i18n=f({en:C,de:O},"de","en"),$.instances={},$.successFunctions={},$.failureFunctions={},$.initStarted={},$.promises={};export{w as B,$ as J,E as M,g as a,v as c,_ as e,b as g,T as i,x as o,S as s,F as t}; //# sourceMappingURL=jsonld.58b5b21b.es.js.map