@kit-data-manager/pid-component
Version:
The PID-Component is a web component that can be used to evaluate and display FAIR Digital Objects, PIDs, ORCiDs, and possibly other identifiers in a user-friendly way. It is easily extensible to support other identifier types.
19 lines • 49 kB
JavaScript
/*!
*
* Copyright 2024 Karlsruhe Institute of Technology.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import{h as t,r as e,H as i}from"./p-19958745.js";class n{constructor(t,e){this._settings=[];this._items=[];this._actions=[];this._value=t;this._settings=e}get settings(){return this._settings}set settings(t){this._settings=t}get items(){return this._items}get actions(){return this._actions}get value(){return this._value}get data(){return undefined}renderBody(){return undefined}}class r extends n{getSettingsKey(){return"DateType"}hasCorrectFormat(){const t=new RegExp("^([0-9]{4})-([0]?[1-9]|1[0-2])-([0-2][0-9]|3[0-1])(T([0-1][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9](.[0-9]*)?(Z|([+|-]([0-1][0-9]|2[0-3]):[0-5][0-9])){1}))$");return t.test(this.value)}init(){this._date=new Date(this.value);return}isResolvable(){return false}renderPreview(){return t("span",null,this._date.toLocaleString())}}let o;async function s(){if("caches"in self){o=await caches.open("pid-component")}}async function a(t,e){await s();if(o){const i=await o.match(t);if(i){return i.json()}else{let i;const n=t.split("://");if(n[0]!=="https"){i=await fetch(`https://${n[1]}`,e);if(!i){console.log(`404 for https://${n[1]} - trying http://${n[1]}`);i=await fetch(`http://${n[1]}`,e)}}else{i=await fetch(t,e)}await o.put(t,i.clone());return i.json()}}else{const i=await fetch(t,e);return i.json()}}async function l(){if(o){await o.delete("pid-component")}}class c{constructor(t,e,i,n,r,o,s,a,l,c,h){this._orcid=t;this._familyName=i;this._givenNames=n;this._employments=r;this._preferredLocale=o;this._biography=s;this._emails=a;this._keywords=l;this._researcherUrls=c;this._country=h;this._ORCiDJSON=e}get orcid(){return this._orcid}get familyName(){return this._familyName}get givenNames(){return this._givenNames}get ORCiDJSON(){return this._ORCiDJSON}get employments(){return this._employments}get preferredLocale(){return this._preferredLocale}get biography(){return this._biography}get emails(){return this._emails}get keywords(){return this._keywords}get researcherUrls(){return this._researcherUrls}get country(){return this._country}static isORCiD(t){const e=new RegExp("^(https://orcid.org/)?[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{3}[0-9X]$");return e.test(t)}static async getORCiDInfo(t){if(!c.isORCiD(t))throw new Error("Invalid input");if(t.match("^(https://orcid.org/)?[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{3}[0-9X]$")!==null)t=t.replace("https://orcid.org/","");const e=await a(`https://pub.orcid.org/v3.0/${t}`,{headers:{Accept:"application/json"}});let i="";let n=[];try{i=e["person"]["name"]["family-name"]["value"]}catch(t){console.debug(t)}try{n=e["person"]["name"]["given-names"]["value"]}catch(t){console.debug(t)}const r=e["activities-summary"]["employments"]["affiliation-group"];const o=[];try{for(let t=0;t<r.length;t++){const e=r[t]["summaries"][0]["employment-summary"];const i=new h(new Date,null,"","");if(e["start-date"]!==null)i.startDate=new Date(e["start-date"]["year"]["value"],e["start-date"]["month"]["value"],e["start-date"]["day"]["value"]);if(e["end-date"]!==null)i.endDate=new Date(e["end-date"]["year"]["value"],e["end-date"]["month"]["value"],e["end-date"]["day"]["value"]);i.organization=e["organization"]["name"];i.department=e["department-name"];o.push(i)}}catch(t){console.debug(t)}const s=e["preferences"]["locale"]!==null?e["preferences"]["locale"]:undefined;const l=e["person"]["biography"]!==null?e["person"]["biography"]["content"]:undefined;const d=[];if(e["person"]["emails"]["email"]!==null){for(const t of e["person"]["emails"]["email"]){d.push({email:t["email"],primary:t["primary"],verified:t["verified"]})}}const f=[];if(e["person"]["keywords"]["keyword"]!==null){for(const t of e["person"]["keywords"]["keyword"]){f.push({content:t["content"],index:t["display-index"]})}f.sort(((t,e)=>t.index-e.index))}const u=[];if(e["person"]["researcher-urls"]["researcher-url"]!==null){for(const t of e["person"]["researcher-urls"]["researcher-url"]){u.push({url:t["url"]["value"],name:t["url-name"],index:t["display-index"]})}u.sort(((t,e)=>t.index-e.index))}const p=e["person"]["addresses"]["address"].length>0?e["person"]["addresses"]["address"][0]["country"]["value"]:undefined;return new c(t,e,i,n,o,s,l,d,f,u,p)}static fromJSON(t){const e=JSON.parse(t);const i=e.employments.map((t=>h.fromJSON(t)));return new c(e.orcid,e.ORCiDJSON,e.familyName,e.givenNames,i,e.preferredLocale,e.biography,e.emails,e.keywords,e.researcherUrls,e.country)}getAffiliationsAt(t){const e=[];for(const i of this._employments){if(i.startDate<=t&&i.endDate===null)e.push(i);if(i.startDate<=t&&i.endDate!==null&&i.endDate>=t)e.push(i)}return e}getAffiliationAsString(t,e=true){if(t===undefined||t.organization===null)return undefined;else{if(e&&t.department!==null)return`${t.organization} [${t.department}]`;else return t.organization}}toObject(){return{orcid:this._orcid,ORCiDJSON:this._ORCiDJSON,familyName:this._familyName,givenNames:this._givenNames,employments:this._employments.map((t=>JSON.stringify(t.toObject()))),preferredLocale:this._preferredLocale,biography:this._biography,emails:this._emails,keywords:this._keywords,researcherUrls:this._researcherUrls,country:this._country}}}class h{constructor(t,e,i,n){this.startDate=t;this.endDate=e;this.organization=i;this.department=n}static fromJSON(t){const e=JSON.parse(t);const i=new Date(e.startDate);const n=e.endDate===null?null:new Date(e.endDate);return new h(i,n,e.organization,e.department)}toObject(){return{startDate:this.startDate,endDate:this.endDate,organization:this.organization,department:this.department}}}class d{constructor(t,e,i,n,r,o,s){this._estimatedTypePriority=0;this._priority=t;this._keyTitle=e;this._value=i;this._keyTooltip=n;this._keyLink=r;this._valueRegex=o;this._renderDynamically=s;if(s)this._estimatedTypePriority=D.length;else this._estimatedTypePriority=I.getEstimatedPriority(this._value)}get priority(){return this._priority}get keyTitle(){return this._keyTitle}get value(){return this._value}get keyTooltip(){return this._keyTooltip}get keyLink(){return this._keyLink}get valueRegex(){return this._valueRegex}get renderDynamically(){return this._renderDynamically}get estimatedTypePriority(){return this._estimatedTypePriority}isValidValue(){return this._valueRegex.test(this._value)}}class f{constructor(t,e,i,n){this._priority=t;this._title=e;this._link=i;this._style=n}get priority(){return this._priority}get title(){return this._title}get link(){return this._link}get style(){return this._style}}class u extends n{constructor(){super(...arguments);this.affiliationAt=new Date(Date.now());this.showAffiliation=true}get data(){return JSON.stringify(this._orcidInfo.toObject())}hasCorrectFormat(){return c.isORCiD(this.value)}async init(t){if(t!==undefined){this._orcidInfo=c.fromJSON(t);console.debug("reload ORCIDInfo from data",this._orcidInfo)}else{this._orcidInfo=await c.getORCiDInfo(this.value);console.debug("load ORCIDInfo from API",this._orcidInfo)}if(this.settings){for(const t of this.settings){switch(t["name"]){case"affiliationAt":this.affiliationAt=new Date(t["value"]);break;case"showAffiliation":this.showAffiliation=t["value"];break}}}this.items.push(new d(0,"ORCiD",this._orcidInfo.orcid,"ORCiD is a free service for researchers to distinguish themselves by creating a unique personal identifier.","https://orcid.org",undefined,true));try{const t=this._orcidInfo.familyName;if(t){new d(1,"Family Name",this._orcidInfo.familyName,"The family name of the person.")}}catch(t){console.log("Failed to obtain family name from ORCiD record.",t)}try{const t=this._orcidInfo.givenNames;if(t){new d(2,"Given Names",this._orcidInfo.givenNames.toString(),"The given names of the person.")}}catch(t){console.log("Failed to obtain given names from ORCiD record.",t)}this.actions.push(new f(0,"Open ORCiD profile",`https://orcid.org/${this._orcidInfo.orcid}`,"primary"));try{const t=this._orcidInfo.getAffiliationsAt(new Date(Date.now()));for(const e of t){const t=this._orcidInfo.getAffiliationAsString(e);if(t!==undefined&&t.length>2)this.items.push(new d(50,"Current Affiliation",t,"The current affiliation of the person.",undefined,undefined,false))}}catch(t){console.log("Failed to obtain affiliations from ORCiD record.",t)}if(this._orcidInfo.getAffiliationsAt(this.affiliationAt)!==this._orcidInfo.getAffiliationsAt(new Date)&&this.affiliationAt.toLocaleDateString("en-US")!==(new Date).toLocaleDateString("en-US")){const t=this._orcidInfo.getAffiliationsAt(this.affiliationAt);for(const e of t){const t=this._orcidInfo.getAffiliationAsString(e);this.items.push(new d(49,"Affiliation at "+this.affiliationAt.toLocaleDateString("en-US",{year:"numeric",month:"numeric",day:"numeric"}),t,"The affiliation of the person at the given date.",undefined,undefined,false))}}if(this._orcidInfo.emails){const t=this._orcidInfo.emails.filter((t=>t.primary))[0];const e=this._orcidInfo.emails.filter((t=>!t.primary));if(t){this.items.push(new d(20,"Primary E-Mail address",t.email,"The primary e-mail address of the person."));this.actions.push(new f(0,"Send E-Mail",`mailto:${t.email}`,"secondary"))}if(e.length>0)this.items.push(new d(70,"Other E-Mail addresses",e.map((t=>t.email)).join(", "),"All other e-mail addresses of the person."));if(this._orcidInfo.preferredLocale)this.items.push(new d(25,"Preferred Language",this._orcidInfo.preferredLocale,"The preferred locale/language of the person."));for(const t of this._orcidInfo.researcherUrls){this.items.push(new d(100,t.name,t.url,"A link to a website specified by the person."))}if(this._orcidInfo.keywords.length>50)this.items.push(new d(60,"Keywords",this._orcidInfo.keywords.map((t=>t.content)).join(", "),"Keywords specified by the person.",undefined,undefined,false));if(this._orcidInfo.biography)this.items.push(new d(200,"Biography",this._orcidInfo.biography,"The biography of the person.",undefined,undefined,false));if(this._orcidInfo.country)this.items.push(new d(30,"Country",this._orcidInfo.country,"The country of the person."))}}isResolvable(){return this._orcidInfo.ORCiDJSON!==undefined}renderPreview(){return t("span",{class:"inline-flex items-center font-mono flex-nowrap align-top"},t("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",class:"h-5 p-0.5 mr-1 flex-none items-center"},t("style",{type:"text/css"},`.st0{fill:#A6CE39;}`,`.st1{fill:#FFFFFF;}`),t("path",{class:"st0",d:"M256,128c0,70.7-57.3,128-128,128C57.3,256,0,198.7,0,128C0,57.3,57.3,0,128,0C198.7,0,256,57.3,256,128z"}),t("g",null,t("path",{class:"st1",d:"M86.3,186.2H70.9V79.1h15.4v48.4V186.2z"}),t("path",{class:"st1",d:"M108.9,79.1h41.6c39.6,0,57,28.3,57,53.6c0,27.5-21.5,53.6-56.8,53.6h-41.8V79.1z M124.3,172.4h24.5\n c34.9,0,42.9-26.5,42.9-39.7c0-21.5-13.7-39.7-43.7-39.7h-23.7V172.4z"}),t("path",{class:"st1",d:"M88.7,56.8c0,5.5-4.5,10.1-10.1,10.1c-5.6,0-10.1-4.6-10.1-10.1c0-5.6,4.5-10.1,10.1-10.1\n C84.2,46.7,88.7,51.3,88.7,56.8z"}))),t("span",{class:"flex-none px-1 items-center"},this._orcidInfo.familyName,", ",this._orcidInfo.givenNames," ",this.showAffiliation&&this._orcidInfo.getAffiliationsAt(new Date).length>0?`(${this._orcidInfo.getAffiliationAsString(this._orcidInfo.getAffiliationsAt(new Date)[0],false)}${this._orcidInfo.getAffiliationsAt(this.affiliationAt).length>0&&this.affiliationAt.toLocaleDateString()!==(new Date).toLocaleDateString()&&this._orcidInfo.getAffiliationsAt(this.affiliationAt)[0].organization!==this._orcidInfo.getAffiliationsAt(new Date)[0].organization?`, then: ${this._orcidInfo.getAffiliationsAt(this.affiliationAt)[0].organization}`:""})`:""))}getSettingsKey(){return"ORCIDType"}}class p{constructor(t,e){this._prefix=t;this._suffix=e}get prefix(){return this._prefix}get suffix(){return this._suffix}static isPID(t){return new RegExp("^([0-9A-Za-z])+.([0-9A-Za-z])+/([!-~])+$").test(t)}static getPIDFromString(t){if(!p.isPID(t))throw new Error("Invalid input");const e=t.split("/");return new p(e[0],e[1])}static fromJSON(t){const e=JSON.parse(t);return new p(e.prefix,e.suffix)}toString(){return`${this.prefix}/${this.suffix}`}isResolvable(){return!C.has(this)&&!this.prefix.toUpperCase().match("^(0$|0\\.|HS_|10320$)")}async resolve(){if(C.has(this))return undefined;else if(O.has(this))return O.get(this);else{const t=await a(`https://hdl.handle.net/api/handles/${this.prefix}/${this.suffix}#resolve`);console.log(t);const e=t.values.map((async t=>{const e=(async()=>{if(p.isPID(t.type)){const e=p.getPIDFromString(t.type);const i=await g.resolveDataType(e);return i instanceof g?i:e}return t.type})();return{index:t.index,type:await e,data:t.data,ttl:t.ttl,timestamp:Date.parse(t.timestamp)}}));const i=await Promise.all(e);const n=new m(this,i);O.set(this,n);return n}}toObject(){return{prefix:this.prefix,suffix:this.suffix}}}const w=new p("10320","loc");class g{constructor(t,e,i,n,r){this._pid=t;this._name=e;this._description=i;this._regex=r;this._redirectURL=n}get pid(){return this._pid}get name(){return this._name}get description(){return this._description}get redirectURL(){return this._redirectURL}get regex(){return this._regex}static async resolveDataType(t){if(S.has(t))return S.get(t);if(!t.isResolvable()){console.debug(`PID ${t.toString()} has been marked as unresolvable`);return undefined}const e=await t.resolve();if(e===undefined){console.debug(`PID ${t.toString()} could not be resolved via the API`);C.add(t);return undefined}const i={name:"",description:"",redirectURL:"",ePICJSON:{}};for(let t=0;t<e.values.length;t++){const n=e.values[t];if(n.type===w||n.type.toString()===w.toString()){const t=new DOMParser;const e=t.parseFromString(n.data.value,"text/xml");const r=e.getElementsByTagName("location");for(let t=0;t<r.length;t++){const e={href:r[t].getAttribute("href"),weight:undefined,view:undefined,resolvedData:undefined};try{e.weight=parseInt(r[t].getAttribute("weight"))}catch(t){}try{e.view=r[t].getAttribute("view")}catch(t){}try{if(e.view==="json"){e.resolvedData=await a(e.href);i.ePICJSON=e.resolvedData;i.name=e.resolvedData["name"];i.description=e.resolvedData["description"]}else{i.redirectURL=e.href}}catch(t){}}}}try{const e=new g(t,i.name,i.description,i.redirectURL,i.regex);S.set(t,e);return e}catch(t){console.error(t);return undefined}}static fromJSON(t){const e=JSON.parse(t);return new g(p.fromJSON(e.pid),e.name,e.description,e.redirectURL,e.regex)}toObject(){return{pid:JSON.stringify(this._pid.toObject()),name:this._name,description:this._description,redirectURL:this._redirectURL,regex:this._regex}}}class m{constructor(t,e){this._values=[];this._pid=t;this._values=e}get pid(){return this._pid}get values(){return this._values}static fromJSON(t){const e=JSON.parse(t);const i=e.values.map((t=>{const e=JSON.parse(t);const i=JSON.parse(e.type);let n;if(i.pidDataType!==undefined){n=g.fromJSON(i.pidDataType)}else if(i.pid!==undefined){n=p.fromJSON(i.pid)}else{n=i.string}const r=JSON.parse(e.data);return{index:e.index,type:n,data:r,ttl:e.ttl,timestamp:e.timestamp}}));return new m(p.fromJSON(e.pid),i)}toObject(){return{pid:JSON.stringify(this._pid.toObject()),values:this._values.map((t=>JSON.stringify({index:t.index,type:JSON.stringify({pid:t.type instanceof p?JSON.stringify(t.type.toObject()):undefined,pidDataType:t.type instanceof g?JSON.stringify(t.type.toObject()):undefined,string:typeof t.type=="string"?t.type:undefined}),data:JSON.stringify(t.data),ttl:t.ttl,timestamp:t.timestamp})))}}}class b extends n{constructor(){super(...arguments);this._parts=[]}get data(){return JSON.stringify(this._pidRecord.toObject())}hasCorrectFormat(){return p.isPID(this.value)}async init(t){if(t!==undefined){this._pidRecord=m.fromJSON(t);this._parts=await Promise.all([{text:this._pidRecord.pid.prefix,nextExists:true},{text:this._pidRecord.pid.suffix,nextExists:false}]);console.debug("reload PIDRecord from data",this._pidRecord)}else{const t=p.getPIDFromString(this.value);this._parts=[{text:t.prefix,nextExists:true},{text:t.suffix,nextExists:false}];this._pidRecord=await t.resolve();console.debug("load PIDRecord from API",this._pidRecord)}for(const t of this._pidRecord.values){if(t.type instanceof g){this.items.push(new d(0,t.type.name,t.data.value,t.type.description,t.type.redirectURL,t.type.regex))}}this.actions.push(new f(0,"Open in FAIR-DOscope",`https://kit-data-manager.github.io/fairdoscope/?pid=${this._pidRecord.pid.toString()}`,"primary"));this.actions.push(new f(0,"View in Handle.net registry",`https://hdl.handle.net/${this._pidRecord.pid.toString()}`,"secondary"));return}isResolvable(){return this._pidRecord.values.length>0}renderPreview(){return t("span",{class:"font-mono bg-inherit font-bold rounded-md"},this._parts.map((e=>t("span",{class:"font-bold font-mono"},t("color-highlight",{text:e.text}),t("span",{class:"font-mono font-bold text-gray-800 mx-0.5"},e.nextExists?"/":"")))))}getSettingsKey(){return"HandleType"}}class y extends n{getSettingsKey(){return"EmailType"}hasCorrectFormat(){const t=/^(([\w\-.]+@([\w-]+\.)+[\w-]{2,})(\s*,\s*)?)*$/gm;return t.test(this.value)}init(){return}isResolvable(){return false}renderPreview(){return t("span",{class:"items-center"},this.value.split(new RegExp(/\s*,\s*/)).filter((t=>t.length>0)).map((e=>t("a",{href:"mailto:"+e,rel:"noopener noreferrer",target:"_blank",class:"items-center inline-flex font-mono text-sm text-blue-400 border border-slate-400 bg-white/60 rounded-md px-1 py-0.5"},t("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none","aria-hidden":"true",viewBox:"0 0 24 24","stroke-width":"1",stroke:"black",height:"20px",class:"mr-2"},t("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M21.75 6.75v10.5a2.25 2.25 0 0 1-2.25 2.25h-15a2.25 2.25 0 0 1-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25m19.5 0v.243a2.25 2.25 0 0 1-1.07 1.916l-7.5 4.615a2.25 2.25 0 0 1-2.36 0L3.32 8.91a2.25 2.25 0 0 1-1.07-1.916V6.75"})),t("span",{class:"ml-2"},e)))))}}class x extends n{getSettingsKey(){return"URLType"}hasCorrectFormat(){const t=new RegExp("^http(s)?:(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$");return t.test(this.value)}init(){return}isResolvable(){return false}renderPreview(){return t("a",{href:this.value,target:"_blank",rel:"noopener noreferrer",class:"font-mono text-sm text-blue-400"},this.value)}}class v extends n{hasCorrectFormat(){return true}init(){return}isResolvable(){return false}renderPreview(){return t("span",null,this.value)}getSettingsKey(){return"FallbackType"}}class k extends n{getSettingsKey(){return"LocaleType"}hasCorrectFormat(){const t=/^([a-zA-Z]{2})(-[A-Z]{2})?$/;return t.test(this.value)}init(){return}isResolvable(){return false}renderPreview(){return t("locale-visualization",{locale:this.value,showFlag:true})}}const D=[{priority:0,key:"DateType",constructor:r},{priority:1,key:"ORCIDType",constructor:u},{priority:2,key:"HandleType",constructor:b},{priority:3,key:"EmailType",constructor:y},{priority:4,key:"URLType",constructor:x},{priority:5,key:"LocaleType",constructor:k},{priority:5,key:"FallbackType",constructor:v}];const S=new Map;const O=new Map;const C=new Set;class I{static getEstimatedPriority(t){let e=0;for(let i=0;i<D.length;i++){const n=new D[i].constructor(t);if(n.hasCorrectFormat()){e=i;break}}return e}static async getBestFit(t,e){var i;let n=new D[D.length-1].constructor(t);for(let e=D.length-1;e>=0;e--){const i=new D[e].constructor(t);if(i.hasCorrectFormat())n=i}try{const t=n.getSettingsKey();const r=(i=e.find((e=>e.type===t)))===null||i===void 0?void 0:i.values;if(r)n.settings=r}catch(t){console.warn("Error while adding settings to object:",t)}await n.init();return n}}const z=(t,e)=>e.some((e=>t instanceof e));let M;let j;function N(){return M||(M=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function R(){return j||(j=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const T=new WeakMap;const E=new WeakMap;const P=new WeakMap;function A(t){const e=new Promise(((e,i)=>{const n=()=>{t.removeEventListener("success",r);t.removeEventListener("error",o)};const r=()=>{e(K(t.result));n()};const o=()=>{i(t.error);n()};t.addEventListener("success",r);t.addEventListener("error",o)}));P.set(e,t);return e}function B(t){if(T.has(t))return;const e=new Promise(((e,i)=>{const n=()=>{t.removeEventListener("complete",r);t.removeEventListener("error",o);t.removeEventListener("abort",o)};const r=()=>{e();n()};const o=()=>{i(t.error||new DOMException("AbortError","AbortError"));n()};t.addEventListener("complete",r);t.addEventListener("error",o);t.addEventListener("abort",o)}));T.set(t,e)}let F={get(t,e,i){if(t instanceof IDBTransaction){if(e==="done")return T.get(t);if(e==="store"){return i.objectStoreNames[1]?undefined:i.objectStore(i.objectStoreNames[0])}}return K(t[e])},set(t,e,i){t[e]=i;return true},has(t,e){if(t instanceof IDBTransaction&&(e==="done"||e==="store")){return true}return e in t}};function $(t){F=t(F)}function J(t){if(R().includes(t)){return function(...e){t.apply(U(this),e);return K(this.request)}}return function(...e){return K(t.apply(U(this),e))}}function L(t){if(typeof t==="function")return J(t);if(t instanceof IDBTransaction)B(t);if(z(t,N()))return new Proxy(t,F);return t}function K(t){if(t instanceof IDBRequest)return A(t);if(E.has(t))return E.get(t);const e=L(t);if(e!==t){E.set(t,e);P.set(e,t)}return e}const U=t=>P.get(t);function V(t,e,{blocked:i,upgrade:n,blocking:r,terminated:o}={}){const s=indexedDB.open(t,e);const a=K(s);if(n){s.addEventListener("upgradeneeded",(t=>{n(K(s.result),t.oldVersion,t.newVersion,K(s.transaction),t)}))}if(i){s.addEventListener("blocked",(t=>i(t.oldVersion,t.newVersion,t)))}a.then((t=>{if(o)t.addEventListener("close",(()=>o()));if(r){t.addEventListener("versionchange",(t=>r(t.oldVersion,t.newVersion,t)))}})).catch((()=>{}));return a}const H=["get","getKey","getAll","getAllKeys","count"];const q=["put","add","delete","clear"];const W=new Map;function _(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e==="string")){return}if(W.get(e))return W.get(e);const i=e.replace(/FromIndex$/,"");const n=e!==i;const r=q.includes(i);if(!(i in(n?IDBIndex:IDBObjectStore).prototype)||!(r||H.includes(i))){return}const o=async function(t,...e){const o=this.transaction(t,r?"readwrite":"readonly");let s=o.store;if(n)s=s.index(e.shift());return(await Promise.all([s[i](...e),r&&o.done]))[0]};W.set(e,o);return o}$((t=>({...t,get:(e,i,n)=>_(e,i)||t.get(e,i,n),has:(e,i)=>!!_(e,i)||t.has(e,i)})));const Z=["continue","continuePrimaryKey","advance"];const X={};const Y=new WeakMap;const G=new WeakMap;const Q={get(t,e){if(!Z.includes(e))return t[e];let i=X[e];if(!i){i=X[e]=function(...t){Y.set(this,G.get(this)[e](...t))}}return i}};async function*tt(...t){let e=this;if(!(e instanceof IDBCursor)){e=await e.openCursor(...t)}if(!e)return;e=e;const i=new Proxy(e,Q);G.set(i,e);P.set(i,U(e));while(e){yield i;e=await(Y.get(i)||e.continue());Y.delete(i)}}function et(t,e){return e===Symbol.asyncIterator&&z(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&z(t,[IDBIndex,IDBObjectStore])}$((t=>({...t,get(e,i,n){if(et(e,i))return tt;return t.get(e,i,n)},has(e,i){return et(e,i)||t.has(e,i)}})));const it="pid-component";const nt=undefined;class rt{constructor(){this.dbPromise=V(it,nt,{upgrade(t){const e=t.createObjectStore("entities",{keyPath:"value"});e.createIndex("by-context","context",{unique:false});const i=t.createObjectStore("relations",{autoIncrement:true});i.createIndex("by-start","start",{unique:false});i.createIndex("by-description","description",{unique:false});i.createIndex("by-end","end",{unique:false})}})}async addEntity(t){const e=document.documentURI;const i=await this.dbPromise;await i.add("entities",{value:t.value,rendererKey:t.getSettingsKey(),context:e,lastAccess:new Date,lastData:t.data}).catch((t=>{if(t.name==="ConstraintError"){console.debug("Entity already exists",t)}else console.error("Could not add entity",t)}));console.debug("added entity",t);const n=i.transaction("relations","readwrite");const r=[];for(const e of t.items){const i={start:t.value,description:e.keyTitle,end:e.value};const o=n.store.index("by-start");let s=await o.openCursor();while(s){if(s.value.start===i.start&&s.value.end===i.end&&s.value.description===i.description){return}s=await s.continue()}r.push(n.store.add(i))}r.push(n.done);await Promise.all(r);console.debug("added relations",r)}async getEntity(t,e){var i,n;try{const n=await this.dbPromise;const r=await n.get("entities",t);if(r!==undefined){console.debug("Found entity for value in db",r,t);const n=(i=e.find((t=>t.type===r.rendererKey)))===null||i===void 0?void 0:i.values;const o=n===null||n===void 0?void 0:n.find((t=>t.name==="ttl"));if(o!=undefined&&o.value!=undefined&&((new Date).getTime()-r.lastAccess.getTime()>o.value||o.value===0)){console.log("TTL expired! Deleting entry in db",o.value,(new Date).getTime()-r.lastAccess.getTime());await this.deleteEntity(t)}else{console.log("TTL not expired or undefined",(new Date).getTime()-r.lastAccess.getTime());const e=new(D.find((t=>t.key===r.rendererKey)).constructor)(t,n);e.settings=n;await e.init(r.lastData);return e}}}catch(t){console.error("Could not get entity from db",t)}console.debug("No valid entity found for value in db",t);const r=await I.getBestFit(t,e);r.settings=(n=e.find((t=>t.type===r.getSettingsKey())))===null||n===void 0?void 0:n.values;await r.init();await this.addEntity(r);console.debug("added entity to db",t,r);return r}async deleteEntity(t){const e=await this.dbPromise;await e.delete("entities",t);const i=e.transaction("relations","readwrite");const n=i.store.index("by-start");let r=await n.openCursor();while(r){if(r.value.start===t||r.value.end===t){await i.store.delete(r.primaryKey)}r=await r.continue()}console.log("deleted entity",t);await i.done}async clearEntities(){const t=await this.dbPromise;await t.clear("entities");await t.clear("relations");console.log("cleared entities")}}const ot='*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;border:0 solid #e5e7eb;box-sizing:border-box}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}details summary::-webkit-details-marker{display:none}.sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.static{position:static}.relative{position:relative}.right-0{right:0}.isolate{isolation:isolate}.z-10{z-index:10}.z-20{z-index:20}.float-right{float:right}.float-left{float:left}.m-0\\.5{margin:.125rem}.m-1{margin:.25rem}.ml-1{margin-left:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-1{margin-top:.25rem}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.hidden{display:none}.h-5{height:1.25rem}.h-64{height:16rem}.max-h-12{max-height:3rem}.max-h-fit{max-height:fit-content}.min-h-\\[1rem\\]{min-height:1rem}.min-h-\\[4rem\\]{min-height:4rem}.w-1\\/4{width:25%}.w-3\\/4{width:75%}.w-5{width:1.25rem}.w-full{width:100%}.min-w-\\[1rem\\]{min-width:1rem}.max-w-full{max-width:100%}.flex-none{flex:none}.flex-shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.select-text{user-select:text}.select-all{user-select:all}.resize-y{resize:vertical}.list-none{list-style-type:none}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.flex-nowrap{flex-wrap:nowrap}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.-space-x-px>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(-1px*(1 - var(--tw-space-x-reverse)));margin-right:calc(-1px*var(--tw-space-x-reverse))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.75rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.75rem*var(--tw-space-x-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.overflow-clip{overflow:clip}.overflow-x-auto{overflow-x:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-hidden{overflow-y:hidden}.overflow-y-scroll{overflow-y:scroll}.text-clip{text-overflow:clip}.rounded{border-radius:.25rem}.rounded-md{border-radius:.375rem}.rounded-b{border-bottom-left-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-l-md{border-bottom-left-radius:.375rem;border-top-left-radius:.375rem}.rounded-r-md{border-bottom-right-radius:.375rem;border-top-right-radius:.375rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.border{border-width:1px}.border-t{border-top-width:1px}.border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.bg-slate-200{--tw-bg-opacity:1;background-color:rgb(226 232 240/var(--tw-bg-opacity,1))}.bg-slate-600{--tw-bg-opacity:1;background-color:rgb(71 85 105/var(--tw-bg-opacity,1))}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.bg-white\\/40{background-color:hsla(0,0%,100%,.4)}.bg-white\\/60{background-color:hsla(0,0%,100%,.6)}.bg-opacity-0{--tw-bg-opacity:0}.p-0\\.5{padding:.125rem}.p-1{padding:.25rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.py-0{padding-bottom:0;padding-top:0}.py-1{padding-bottom:.25rem;padding-top:.25rem}.pl-0\\.5{padding-left:.125rem}.pr-1{padding-right:.25rem}.text-left{text-align:left}.align-baseline{vertical-align:baseline}.align-top{vertical-align:top}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.leading-6{line-height:1.5rem}.text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity,1))}.text-blue-400{--tw-text-opacity:1;color:rgb(96 165 250/var(--tw-text-opacity,1))}.text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.text-slate-200{--tw-text-opacity:1;color:rgb(226 232 240/var(--tw-text-opacity,1))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.opacity-25{opacity:.25}.opacity-75{opacity:.75}.shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.shadow-md,.shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.ring-inset{--tw-ring-inset:inset}.ring-gray-300{--tw-ring-opacity:1;--tw-ring-color:rgb(209 213 219/var(--tw-ring-opacity,1))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-100{transition-duration:.1s}.duration-200{transition-duration:.2s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.odd\\:bg-slate-200:nth-child(odd){--tw-bg-opacity:1;background-color:rgb(226 232 240/var(--tw-bg-opacity,1))}.open\\:w-full[open]{width:100%}.open\\:align-top[open]{vertical-align:top}.hover\\:bg-gray-50:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}.focus\\:z-20:focus{z-index:20}.focus\\:bg-gray-200:focus{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:outline-offset-0:focus{outline-offset:0}.focus\\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:ring-gray-300:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(209 213 219/var(--tw-ring-opacity,1))}.focus\\:ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\\:outline:focus-visible{outline-style:solid}.focus-visible\\:outline-2:focus-visible{outline-width:2px}.focus-visible\\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\\:outline-indigo-600:focus-visible{outline-color:#4f46e5}.group[open] .group-open\\:-rotate-180{--tw-rotate:-180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@media (min-width:640px){.sm\\:flex{display:flex}.sm\\:flex-1{flex:1 1 0%}.sm\\:flex-nowrap{flex-wrap:nowrap}.sm\\:items-center{align-items:center}.sm\\:justify-between{justify-content:space-between}.sm\\:px-1{padding-left:.25rem;padding-right:.25rem}}@media (min-width:768px){.md\\:mt-0{margin-top:0}.md\\:inline-flex{display:inline-flex}}.inline-block{display:inline-block}.max-h-min{max-height:min-content}.border-slate-500{--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity,1))}.bg-green-200{--tw-bg-opacity:1;background-color:rgb(187 247 208/var(--tw-bg-opacity,1))}.py-0\\.5{padding-bottom:.125rem;padding-top:.125rem}.text-slate-800{--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity,1))}.hover\\:bg-blue-200:hover{--tw-bg-opacity:1;background-color:rgb(191 219 254/var(--tw-bg-opacity,1))}.hover\\:text-slate-900:hover{--tw-text-opacity:1;color:rgb(15 23 42/var(--tw-text-opacity,1))}';const st=ot;const at=class{constructor(t){e(this,t);this.settings="[]";this.amountOfItems=10;this.levelOfSubcomponents=1;this.currentLevelOfSubcomponents=0;this.emphasizeComponent=true;this.showTopLevelCopy=true;this.defaultTTL=24*60*60*1e3;this.items=[];this.actions=[];this.loadSubcomponents=false;this.displayStatus="loading";this.tablePage=0;this.temporarilyEmphasized=this.emphasizeComponent;this.toggleSubcomponents=()=>{if(!this.hideSubcomponents&&this.levelOfSubcomponents-this.currentLevelOfSubcomponents>0)this.loadSubcomponents=!this.loadSubcomponents};this.showTooltip=t=>{let e=t.target;do{e=e.parentElement}while(e!==null&&e.tagName!=="A");if(e!==null)e.children[1].classList.remove("hidden")};this.hideTooltip=t=>{let e=t.target;do{e=e.parentElement}while(e!==null&&e.tagName!=="A");if(e!==null)e.children[1].classList.add("hidden")}}async watchValue(){this.displayStatus="loading";await this.componentWillLoad()}async watchLoadSubcomponents(){this.temporarilyEmphasized=this.loadSubcomponents}async componentWillLoad(){let t=[];try{t=JSON.parse(this.settings)}catch(t){console.error("Failed to parse settings.",t)}t.forEach((t=>{if(!t.values.some((t=>t.name==="ttl"))){t.values.push({name:"ttl",value:this.defaultTTL})}}));try{const e=new rt;this.identifierObject=await e.getEntity(this.value,t)}catch(t){console.error("Failed to get entity from db",t);return}if(!this.hideSubcomponents){this.items=this.identifierObject.items;this.items.sort(((t,e)=>{if(t.priority>e.priority)return 1;if(t.priority<e.priority)return-1;if(t.estimatedTypePriority>e.estimatedTypePriority)return 1;if(t.estimatedTypePriority<e.estimatedTypePriority)return-1}));this.actions=this.identifierObject.actions;this.actions.sort(((t,e)=>t.priority-e.priority))}this.displayStatus="loaded";console.log("Finished loading for ",this.value,this.identifierObject);await l()}render(){return t(i,{key:"dc894b8d28790b44f836cc5330e68ccd4e4fe430",class:"inline flex-grow max-w-full font-sans flex-wrap align-baseline items-center text-xs"},this.items.length===0&&this.actions.length===0||this.hideSubcomponents?this.identifierObject!==undefined&&this.displayStatus==="loaded"?t("span",{class:this.currentLevelOfSubcomponents===0?"group "+(this.emphasizeComponent||this.temporarilyEmphasized?"rounded-md shadow-md border px-1 bg-white ":"bg-white/40")+"text-xs text-clip inline-flex flex-grow open:align-top open:w-full ease-in-out transition-all duration-200 overflow-y-hidden font-bold font-mono cursor-pointer list-none overflow-x-hidden space-x-3 flex-nowrap flex-shrink-0 items-center":""},t("span",{class:"font-medium font-mono inline-flex flex-nowrap overflow-x-auto text-xs select-all"},this.identifierObject.renderPreview()),this.currentLevelOfSubcomponents===0&&this.showTopLevelCopy&&this.emphasizeComponent?t("copy-button",{value:this.identifierObject.value}):""):t("span",{class:"inline-flex items-center transition ease-in-out"},t("svg",{class:"animate-spin ml-1 mr-3 h-5 w-5 text-black",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},t("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),t("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})),"Loading... ",this.value):t("details",{class:"group "+(this.emphasizeComponent||this.temporarilyEmphasized?"rounded-md border pl-0.5 py-0 bg-white bg-opacity-0":"bg-white/60")+"text-clip inline flex-grow font-sans open:align-top open:w-full ease-in-out transition-all duration-200",open:this.openByDefault,onToggle:this.toggleSubcomponents},t("summary",{class:"overflow-y-hidden font-bold font-mono cursor-pointer list-none overflow-x-hidden inline-flex flex-nowrap flex-shrink-0 items-center"},t("span",{class:"inline-flex flex-nowrap overflow-x-auto pr-1 items-center"},this.emphasizeComponent||this.temporarilyEmphasized?t("span",{class:"flex-shrink-0 pr-1"},t("svg",{class:"transition group-open:-rotate-180",fill:"none",height:"12","shape-rendering":"geometricPrecision",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",viewBox:"0 0 12 12",width:"10"},t("path",{d:"M 2 3 l 4 6 l 4 -6"}))):"",t("span",{class:"font-medium font-mono inline-flex flex-nowrap overflow-x-auto text-sm select-all"},this.identifierObject.renderPreview())),this.currentLevelOfSubcomponents===0&&this.showTopLevelCopy&&(this.emphasizeComponent||this.temporarilyEmphasized)?t("copy-button",{value:this.identifierObject.value}):""),this.items.length>0?t("div",null,t("div",{class:"resize-y divide-y text-sm leading-6 bg-gray-100 m-1 p-0.5 h-64 max-h-fit overflow-y-scroll border rounded min-h-[4rem]"},t("table",{class:"text-left w-full text-sm font-sans select-text"},t("thead",{class:"bg-slate-600 flex text-slate-200 w-full rounded-t"},t("tr",{class:"flex w-full rounded font-semibold"},t("th",{class:"px-1 w-1/4"},"Key"),t("th",{class:"px-1 w-3/4"},"Value"))),t("tbody",{class:"bg-grey-100 flex flex-col items-center justify-between overflow-y-scroll w-full rounded-b"},this.items.filter(((t,e)=>e>=this.tablePage*this.amountOfItems&&e<this.tablePage*this.amountOfItems+this.amountOfItems)).map((e=>t("tr",{class:"odd:bg-slate-200 flex w-full"},t("td",{class:"overflow-x-auto p-1 w-1/4 font-mono"},t("a",{role:"link",class:"right-0 focus:outline-none focus:ring-gray-300 rounded-md focus:ring-offset-2 focus:ring-2 focus:bg-gray-200 relative md:mt-0 inline flex-nowrap",onMouseOver:this.showTooltip,onFocus:this.showTooltip,onMouseOut:this.hideTooltip},t("div",{class:"cursor-pointer align-top justify-between flex-nowrap"},t("a",{href:e.keyLink,target:"_blank",rel:"noopener noreferrer",class:"mr-2 text-blue-400 justify-start float-left"},e.keyTitle),t("svg",{"aria-haspopup":"true",xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-info-circle justify-end min-w-[1rem] min-h-[1rem] flex-none float-right",width:"25",height:"25",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"#A0AEC0",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},t("path",{stroke:"none",d:"M0 0h24v24H0z"}),t("circle",{cx:"12",cy:"12",r:"9"}),t("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"}),t("polyline",{points:"11 12 12 12 12 16 13 16"}))),t("p",{role:"tooltip",class:"hidden z-20 mt-1 transition duration-100 ease-in-out shadow-md bg-white rounded text-xs text-gray-600 p-1 flex-wrap overflow-clip"},e.keyTooltip))),t("td",{class:"align-top overflow-x-auto text-sm p-1 w-3/4 select-text flex "},t("span",{class:"flex-grow"},this.loadSubcomponents&&!this.hideSubcomponents&&!e.renderDynamically?t("pid-component",{value:e.value,levelOfSubcomponents:this.levelOfSubcomponents,currentLevelOfSubcomponents:this.currentLevelOfSubcomponents+1,amountOfItems:this.amountOfItems,settings:this.settings}):!this.hideSubcomponents&&this.currentLevelOfSubcomponents===this.levelOfSubcomponents&&!e.renderDynamically?t("pid-component",{value:e.value,levelOfSubcomponents:this.currentLevelOfSubcomponents,currentLevelOfSubcomponents:this.currentLevelOfSubcomponents,amountOfItems:this.amountOfItems,settings:this.settings,hideSubcomponents:true}):t("span",{class:"font-mono text-sm"},e.value)),t("copy-button",{value:e.value})))))))),t("div",{class:"flex items-center justify-between border-t border-gray-200 bg-white px-1 py-1 sm:px-1 max-h-12"},t("div",{class:"hidden sm:flex sm:flex-1 sm:flex-nowrap sm:items-center sm:justify-between text-sm"},t("div",{class:""},t("p",{class:"text-sm text-gray-700"},"Showing",t("span",{class:"font-medium"}," ",1+this.tablePage*this.amountOfItems," "),"to",t("span",{class:"font-medium"}," ",Math.min(this.tablePage*this.amountOfItems+this.amountOfItems,this.items.length)," "),"of",t("span",{class:"font-medium"}," ",this.items.length," "),"entries")),t("div",null,this.items.length>this.amountOfItems?t("nav",{class:"isolate inline-flex -space-x-px rounded-md shadow-sm","aria-label":"Pagination"},t("button",{onClick:()=>{this.tablePage=Math.max(this.tablePage-1,0)},class:"relative inline-flex items-center rounded-l-md px-1 py-1 text-gray-400 ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus:z-20 focus:outline-offset-0"},t("span",{class:"sr-only"},"Previous"),t("svg",{class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},t("path",{"fill-rule":"evenodd",d:"M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z","clip-rule":"evenodd"}))),Array(Math.ceil(this.items.length/this.amountOfItems)).fill(0).map(((e,i)=>t("button",{onClick:()=>this.tablePage=i,class:i===this.tablePage?"relative z-10 inline-flex items-center bg-blue-600 px-2 py-1 text-sm font-semibold text-white focus:z-20 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600":"relative hidden items-center px-2 py-1 text-sm font-semibold text-gray-900 ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus:z-20 focus:outline-offset-0 md:inline-flex"},i+1))),t("button",{onClick:()=>{this.tablePage=Math.min(this.tablePage+1,Math.floor(this.items.length/this.amountOfItems))},class:"relative inline-flex items-center rounded-r-md px-1 py-1 text-gray-400 ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus:z-20 focus:outline-offset-0"},t("span",{class:"sr-only"},"Next"),t("svg",{class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},t("path",{"fill-rule":"evenodd",d:"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z","clip-rule":"evenodd"})))):"")))):"",this.identifierObject.renderBody(),this.actions.length>0?t("span",{class:"m-0.5 flex justify-between gap-1"},this.actions.map((e=>{let i="p-1 font-semibold text-sm rounded border ";switch(e.style){case"primary":i+="bg-blue-500 text-white";break;case"secondary":i+="bg-slate-200 text-blue-500";break;case"danger":i+="bg-red-500 text-white";break}return t("a",{href:e.link,class:i,rel:"noopener noreferrer",target:"_blank"},e.title)}))):""))}static get watchers(){return{value:["watchValue"],loadSubcomponents:["watchLoadSubcomponents"]}}};at.style=st;export{at as pid_component};
//# sourceMappingURL=p-dc1d01d8.entry.js.map