@pod-os/elements 0.31.1-rc.fd664af.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{d as e,r as t,h as n,H as i,e as s,f as r,i as o,j as a}from"./p-99602d8c.js";import{c}from"./p-4ab8d4da.js";import{c as l,h as d}from"./p-669fab6c.js";import{c as h,g as u}from"./p-9ff1da1c.js";import{c as f,s as p,B as b}from"./p-3d182668.js";import{P as m,N as g,L as w}from"./p-a004ecd1.js";import{S as y,t as v,d as k}from"./p-5cade8cd.js";import{s as x}from"./p-f6671856.js";import{i as S,x as _,E,c as A,S as T,_ as C,a as R,r as I,n as P,w as z,b as $,f as D}from"./p-9be91e78.js";import{e as W,a as O,s as L,L as j,b as U,g as J,c as K,w as H,S as N,i as M,t as B,d as X}from"./p-50aca1ca.js";import{s as F}from"./p-182f722d.js";import"./p-c066fd50.js";let V;const q=()=>{if(typeof window==="undefined"){return new Map}else{if(!V){const e=window;e.Ionicons=e.Ionicons||{};V=e.Ionicons.map=e.Ionicons.map||new Map}return V}};const G=e=>{let t=Q(e.src);if(t){return t}t=Z(e.name,e.icon,e.mode,e.ios,e.md);if(t){return Y(t,e)}if(e.icon){t=Q(e.icon);if(t){return t}t=Q(e.icon[e.mode]);if(t){return t}}return null};const Y=(t,n)=>{const i=q().get(t);if(i){return i}try{return e(`svg/${t}.svg`)}catch(e){console.warn(`[Ionicons Warning]: Could not load icon with name "${t}". Ensure that the icon is registered using addIcons or that the icon SVG data is passed directly to the icon component.`,n)}};const Z=(e,t,n,i,s)=>{n=(n&&ne(n))==="ios"?"ios":"md";if(i&&n==="ios"){e=ne(i)}else if(s&&n==="md"){e=ne(s)}else{if(!e&&t&&!ee(t)){e=t}if(te(e)){e=ne(e)}}if(!te(e)||e.trim()===""){return null}const r=e.replace(/[a-z]|-|\d/gi,"");if(r!==""){return null}return e};const Q=e=>{if(te(e)){e=e.trim();if(ee(e)){return e}}return null};const ee=e=>e.length>0&&/(\/|\.)/.test(e);const te=e=>typeof e==="string";const ne=e=>e.toLowerCase();const ie=(e,t=[])=>{const n={};t.forEach((t=>{if(e.hasAttribute(t)){const i=e.getAttribute(t);if(i!==null){n[t]=e.getAttribute(t)}e.removeAttribute(t)}}));return n};const se=e=>{if(e){if(e.dir!==""){return e.dir.toLowerCase()==="rtl"}}return(document===null||document===void 0?void 0:document.dir.toLowerCase())==="rtl"};const re=e=>{const t=document.createElement("div");t.innerHTML=e;for(let e=t.childNodes.length-1;e>=0;e--){if(t.childNodes[e].nodeName.toLowerCase()!=="svg"){t.removeChild(t.childNodes[e])}}const n=t.firstElementChild;if(n&&n.nodeName.toLowerCase()==="svg"){const e=n.getAttribute("class")||"";n.setAttribute("class",(e+" s-ion-icon").trim());if(oe(n)){return t.innerHTML}}return""};const oe=e=>{if(e.nodeType===1){if(e.nodeName.toLowerCase()==="script"){return false}for(let t=0;t<e.attributes.length;t++){const n=e.attributes[t].name;if(te(n)&&n.toLowerCase().indexOf("on")===0){return false}}for(let t=0;t<e.childNodes.length;t++){if(!oe(e.childNodes[t])){return false}}}return true};const ae=e=>e.startsWith("data:image/svg+xml");const ce=e=>e.indexOf(";utf8,")!==-1;const le=new Map;const de=new Map;let he;const ue=(e,t)=>{let n=de.get(e);if(!n){if(typeof fetch!=="undefined"&&typeof document!=="undefined"){if(ae(e)&&ce(e)){if(!he){he=new DOMParser}const t=he.parseFromString(e,"text/html");const n=t.querySelector("svg");if(n){le.set(e,n.outerHTML)}return Promise.resolve()}else{n=fetch(e).then((n=>{if(n.ok){return n.text().then((n=>{if(n&&t!==false){n=re(n)}le.set(e,n||"")}))}le.set(e,"")}));de.set(e,n)}}else{le.set(e,"");return Promise.resolve()}}return n};const fe=":host{display:inline-block;width:1em;height:1em;contain:strict;fill:currentColor;box-sizing:content-box !important}:host .ionicon{stroke:currentColor}.ionicon-fill-none{fill:none}.ionicon-stroke-width{stroke-width:32px;stroke-width:var(--ionicon-stroke-width, 32px)}.icon-inner,.ionicon,svg{display:block;height:100%;width:100%}@supports (background: -webkit-named-image(i)){:host(.icon-rtl) .icon-inner{transform:scaleX(-1)}}@supports not selector(:dir(rtl)) and selector(:host-context([dir='rtl'])){:host(.icon-rtl) .icon-inner{transform:scaleX(-1)}}:host(.flip-rtl):host-context([dir='rtl']) .icon-inner{transform:scaleX(-1)}@supports selector(:dir(rtl)){:host(.flip-rtl:dir(rtl)) .icon-inner{transform:scaleX(-1)}:host(.flip-rtl:dir(ltr)) .icon-inner{transform:scaleX(1)}}:host(.icon-small){font-size:1.125rem !important}:host(.icon-large){font-size:2rem !important}:host(.ion-color){color:var(--ion-color-base) !important}:host(.ion-color-primary){--ion-color-base:var(--ion-color-primary, #3880ff)}:host(.ion-color-secondary){--ion-color-base:var(--ion-color-secondary, #0cd1e8)}:host(.ion-color-tertiary){--ion-color-base:var(--ion-color-tertiary, #f4a942)}:host(.ion-color-success){--ion-color-base:var(--ion-color-success, #10dc60)}:host(.ion-color-warning){--ion-color-base:var(--ion-color-warning, #ffce00)}:host(.ion-color-danger){--ion-color-base:var(--ion-color-danger, #f14141)}:host(.ion-color-light){--ion-color-base:var(--ion-color-light, #f4f5f8)}:host(.ion-color-medium){--ion-color-base:var(--ion-color-medium, #989aa2)}:host(.ion-color-dark){--ion-color-base:var(--ion-color-dark, #222428)}";const pe=fe;const be=class{constructor(e){t(this,e);this.iconName=null;this.inheritedAttributes={};this.didLoadIcon=false;this.svgContent=undefined;this.isVisible=false;this.mode=me();this.color=undefined;this.ios=undefined;this.md=undefined;this.flipRtl=undefined;this.name=undefined;this.src=undefined;this.icon=undefined;this.size=undefined;this.lazy=false;this.sanitize=true}componentWillLoad(){this.inheritedAttributes=ie(this.el,["aria-label"])}connectedCallback(){this.waitUntilVisible(this.el,"50px",(()=>{this.isVisible=true;this.loadIcon()}))}componentDidLoad(){if(!this.didLoadIcon){this.loadIcon()}}disconnectedCallback(){if(this.io){this.io.disconnect();this.io=undefined}}waitUntilVisible(e,t,n){if(this.lazy&&typeof window!=="undefined"&&window.IntersectionObserver){const i=this.io=new window.IntersectionObserver((e=>{if(e[0].isIntersecting){i.disconnect();this.io=undefined;n()}}),{rootMargin:t});i.observe(e)}else{n()}}loadIcon(){if(this.isVisible){const e=G(this);if(e){if(le.has(e)){this.svgContent=le.get(e)}else{ue(e,this.sanitize).then((()=>this.svgContent=le.get(e)))}this.didLoadIcon=true}}this.iconName=Z(this.name,this.icon,this.mode,this.ios,this.md)}render(){const{flipRtl:e,iconName:t,inheritedAttributes:s,el:r}=this;const o=this.mode||"md";const a=t?(t.includes("arrow")||t.includes("chevron"))&&e!==false:false;const c=e||a;return n(i,Object.assign({role:"img",class:Object.assign(Object.assign({[o]:true},ge(this.color)),{[`icon-${this.size}`]:!!this.size,"flip-rtl":c,"icon-rtl":c&&se(r)})},s),this.svgContent?n("div",{class:"icon-inner",innerHTML:this.svgContent}):n("div",{class:"icon-inner"}))}static get assetsDirs(){return["svg"]}get el(){return s(this)}static get watchers(){return{name:["loadIcon"],src:["loadIcon"],icon:["loadIcon"],ios:["loadIcon"],md:["loadIcon"]}}};const me=()=>typeof document!=="undefined"&&document.documentElement.getAttribute("mode")||"md";const ge=e=>e?{"ion-color":true,[`ion-color-${e}`]:true}:null;be.style=pe;const we=":host{--background:rgba(var(--ion-color-primary-rgb, 56, 128, 255), 0.3);--progress-background:var(--ion-color-primary, #3880ff);--buffer-background:var(--background);display:block;position:relative;width:100%;contain:strict;direction:ltr;overflow:hidden}.progress,.progress-indeterminate,.indeterminate-bar-primary,.indeterminate-bar-secondary,.progress-buffer-bar{left:0;right:0;top:0;bottom:0;position:absolute;width:100%;height:100%}.buffer-circles-container,.buffer-circles{left:0;right:0;top:0;bottom:0;position:absolute}.buffer-circles{right:-10px;left:-10px;}.progress,.progress-buffer-bar,.buffer-circles-container{transform-origin:left top;transition:transform 150ms linear}.progress,.progress-indeterminate{background:var(--progress-background);z-index:2}.progress-buffer-bar{background:var(--buffer-background);z-index:1}.buffer-circles-container{overflow:hidden}.indeterminate-bar-primary{top:0;right:0;bottom:0;left:-145.166611%;animation:primary-indeterminate-translate 2s infinite linear}.indeterminate-bar-primary .progress-indeterminate{animation:primary-indeterminate-scale 2s infinite linear;animation-play-state:inherit}.indeterminate-bar-secondary{top:0;right:0;bottom:0;left:-54.888891%;animation:secondary-indeterminate-translate 2s infinite linear}.indeterminate-bar-secondary .progress-indeterminate{animation:secondary-indeterminate-scale 2s infinite linear;animation-play-state:inherit}.buffer-circles{background-image:radial-gradient(ellipse at center, var(--buffer-background) 0%, var(--buffer-background) 30%, transparent 30%);background-repeat:repeat-x;background-position:5px center;background-size:10px 10px;z-index:0;animation:buffering 450ms infinite linear}:host(.progress-bar-reversed){transform:scaleX(-1)}:host(.progress-paused) .indeterminate-bar-secondary,:host(.progress-paused) .indeterminate-bar-primary,:host(.progress-paused) .buffer-circles{animation-play-state:paused}:host(.ion-color) .progress-buffer-bar{background:rgba(var(--ion-color-base-rgb), 0.3)}:host(.ion-color) .buffer-circles{background-image:radial-gradient(ellipse at center, rgba(var(--ion-color-base-rgb), 0.3) 0%, rgba(var(--ion-color-base-rgb), 0.3) 30%, transparent 30%)}:host(.ion-color) .progress,:host(.ion-color) .progress-indeterminate{background:var(--ion-color-base)}@keyframes primary-indeterminate-translate{0%{transform:translateX(0)}20%{animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);transform:translateX(0)}59.15%{animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);transform:translateX(83.67142%)}100%{transform:translateX(200.611057%)}}@keyframes primary-indeterminate-scale{0%{transform:scaleX(0.08)}36.65%{animation-timing-function:cubic-bezier(0.334731, 0.12482, 0.785844, 1);transform:scaleX(0.08)}69.15%{animation-timing-function:cubic-bezier(0.06, 0.11, 0.6, 1);transform:scaleX(0.661479)}100%{transform:scaleX(0.08)}}@keyframes secondary-indeterminate-translate{0%{animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);transform:translateX(0)}25%{animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);transform:translateX(37.651913%)}48.35%{animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);transform:translateX(84.386165%)}100%{transform:translateX(160.277782%)}}@keyframes secondary-indeterminate-scale{0%{animation-timing-function:cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971);transform:scaleX(0.08)}19.15%{animation-timing-function:cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315);transform:scaleX(0.457104)}44.15%{animation-timing-function:cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179);transform:scaleX(0.72796)}100%{transform:scaleX(0.08)}}@keyframes buffering{to{transform:translateX(-10px)}}:host{height:3px}";const ye=we;const ve=":host{--background:rgba(var(--ion-color-primary-rgb, 56, 128, 255), 0.3);--progress-background:var(--ion-color-primary, #3880ff);--buffer-background:var(--background);display:block;position:relative;width:100%;contain:strict;direction:ltr;overflow:hidden}.progress,.progress-indeterminate,.indeterminate-bar-primary,.indeterminate-bar-secondary,.progress-buffer-bar{left:0;right:0;top:0;bottom:0;position:absolute;width:100%;height:100%}.buffer-circles-container,.buffer-circles{left:0;right:0;top:0;bottom:0;position:absolute}.buffer-circles{right:-10px;left:-10px;}.progress,.progress-buffer-bar,.buffer-circles-container{transform-origin:left top;transition:transform 150ms linear}.progress,.progress-indeterminate{background:var(--progress-background);z-index:2}.progress-buffer-bar{background:var(--buffer-background);z-index:1}.buffer-circles-container{overflow:hidden}.indeterminate-bar-primary{top:0;right:0;bottom:0;left:-145.166611%;animation:primary-indeterminate-translate 2s infinite linear}.indeterminate-bar-primary .progress-indeterminate{animation:primary-indeterminate-scale 2s infinite linear;animation-play-state:inherit}.indeterminate-bar-secondary{top:0;right:0;bottom:0;left:-54.888891%;animation:secondary-indeterminate-translate 2s infinite linear}.indeterminate-bar-secondary .progress-indeterminate{animation:secondary-indeterminate-scale 2s infinite linear;animation-play-state:inherit}.buffer-circles{background-image:radial-gradient(ellipse at center, var(--buffer-background) 0%, var(--buffer-background) 30%, transparent 30%);background-repeat:repeat-x;background-position:5px center;background-size:10px 10px;z-index:0;animation:buffering 450ms infinite linear}:host(.progress-bar-reversed){transform:scaleX(-1)}:host(.progress-paused) .indeterminate-bar-secondary,:host(.progress-paused) .indeterminate-bar-primary,:host(.progress-paused) .buffer-circles{animation-play-state:paused}:host(.ion-color) .progress-buffer-bar{background:rgba(var(--ion-color-base-rgb), 0.3)}:host(.ion-color) .buffer-circles{background-image:radial-gradient(ellipse at center, rgba(var(--ion-color-base-rgb), 0.3) 0%, rgba(var(--ion-color-base-rgb), 0.3) 30%, transparent 30%)}:host(.ion-color) .progress,:host(.ion-color) .progress-indeterminate{background:var(--ion-color-base)}@keyframes primary-indeterminate-translate{0%{transform:translateX(0)}20%{animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);transform:translateX(0)}59.15%{animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);transform:translateX(83.67142%)}100%{transform:translateX(200.611057%)}}@keyframes primary-indeterminate-scale{0%{transform:scaleX(0.08)}36.65%{animation-timing-function:cubic-bezier(0.334731, 0.12482, 0.785844, 1);transform:scaleX(0.08)}69.15%{animation-timing-function:cubic-bezier(0.06, 0.11, 0.6, 1);transform:scaleX(0.661479)}100%{transform:scaleX(0.08)}}@keyframes secondary-indeterminate-translate{0%{animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);transform:translateX(0)}25%{animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);transform:translateX(37.651913%)}48.35%{animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);transform:translateX(84.386165%)}100%{transform:translateX(160.277782%)}}@keyframes secondary-indeterminate-scale{0%{animation-timing-function:cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971);transform:scaleX(0.08)}19.15%{animation-timing-function:cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315);transform:scaleX(0.457104)}44.15%{animation-timing-function:cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179);transform:scaleX(0.72796)}100%{transform:scaleX(0.08)}}@keyframes buffering{to{transform:translateX(-10px)}}:host{height:4px}";const ke=ve;const xe=class{constructor(e){t(this,e);this.type="determinate";this.reversed=false;this.value=0;this.buffer=1;this.color=undefined}render(){const{color:e,type:t,reversed:s,value:r,buffer:o}=this;const a=h.getBoolean("_testing");const c=u(this);return n(i,{key:"944b79ed6fce1b2c0ed48681cd8517a5abbddd80",role:"progressbar","aria-valuenow":t==="determinate"?r:null,"aria-valuemin":"0","aria-valuemax":"1",class:l(e,{[c]:true,[`progress-bar-${t}`]:true,"progress-paused":a,"progress-bar-reversed":document.dir==="rtl"?!s:s})},t==="indeterminate"?Se():_e(r,o))}};const Se=()=>n("div",{part:"track",class:"progress-buffer-bar"},n("div",{class:"indeterminate-bar-primary"},n("span",{part:"progress",class:"progress-indeterminate"})),n("div",{class:"indeterminate-bar-secondary"},n("span",{part:"progress",class:"progress-indeterminate"})));const _e=(e,t)=>{const i=c(0,e,1);const s=c(0,t,1);return[n("div",{part:"progress",class:"progress",style:{transform:`scaleX(${i})`}}),n("div",{class:{"buffer-circles-container":true,"ion-hide":s===1},style:{transform:`translateX(${s*100}%)`}},n("div",{class:"buffer-circles-container",style:{transform:`translateX(-${s*100}%)`}},n("div",{part:"stream",class:"buffer-circles"}))),n("div",{part:"track",class:"progress-buffer-bar",style:{transform:`scaleX(${s})`}})]};xe.style={ios:ye,md:ke};const Ee=":host{--background:rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.065);border-radius:var(--border-radius, inherit);display:block;width:100%;height:inherit;margin-top:4px;margin-bottom:4px;background:var(--background);line-height:10px;user-select:none;pointer-events:none}span{display:inline-block}:host(.in-media){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;height:100%}:host(.skeleton-text-animated){position:relative;background:linear-gradient(to right, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.065) 8%, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.135) 18%, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.065) 33%);background-size:800px 104px;animation-duration:1s;animation-fill-mode:forwards;animation-iteration-count:infinite;animation-name:shimmer;animation-timing-function:linear}@keyframes shimmer{0%{background-position:-400px 0}100%{background-position:400px 0}}";const Ae=Ee;const Te=class{constructor(e){t(this,e);this.ionStyle=r(this,"ionStyle",7);this.animated=false}componentWillLoad(){this.emitStyle()}emitStyle(){const e={"skeleton-text":true};this.ionStyle.emit(e)}render(){const e=this.animated&&h.getBoolean("animated",true);const t=d("ion-avatar",this.el)||d("ion-thumbnail",this.el);const s=u(this);return n(i,{key:"4dab0fd2de666de12ad8f6dc6ed1e1de0be67ddd",class:{[s]:true,"skeleton-text-animated":e,"in-media":t}},n("span",{key:"f8f908ec24d65e63b14d9a54640a5f18f0fa8fa5"}," "))}get el(){return s(this)}};Te.style=Ae;const Ce=":host{font-family:var(--font-sans);display:block}button#new{cursor:pointer;display:flex;align-items:center;justify-content:center;border:none;width:var(--size-10);height:var(--size-10);background-color:var(--pos-primary-color);color:var(--pos-primary-text-color);font-size:var(--scale-6);border-radius:var(--radius-xs)}button#new:hover,button#new:focus{outline:none;filter:brightness(110%);box-shadow:var(--shadow-sm)}pos-new-thing-form{margin:var(--scale-3)}";const Re=Ce;const Ie=class{constructor(e){t(this,e)}openDialog(){this.dialog.showModal()}render(){return n(i,{key:"6142a141ef03ca93a362a6b00ebe8d515c3a677a"},n("button",{key:"72ecf353cd3a7d2d68f9ef28eb1bbe7fdb88b700",id:"new",title:"Add a new thing",onClick:()=>this.openDialog()},n("ion-icon",{key:"bd05d75c42c10de6df519575787fc66eafb22930",name:"add-circle-outline"})),n("pos-dialog",{key:"23cf0118149704dfca16758970e4f4658e87e946",ref:e=>this.dialog=e},n("span",{key:"5af7b7f618cc20684c39134b5ea295400e651cb6",slot:"title"},"Add a new thing"),n("pos-new-thing-form",{key:"895496c2f6ede3c8677d9d918e0b13582090baed",slot:"content",referenceUri:this.referenceUri})))}};Ie.style=Re;const Pe=localStorage.getItem("settings");const ze=Pe?JSON.parse(Pe):{offlineCache:false};const $e=f(ze);De();We();function De(){$e.on("set",(()=>{const e=JSON.stringify($e.state);localStorage.setItem("settings",e)}))}function We(){window.addEventListener("storage",(e=>{if(e.key==="settings"&&e.newValue){const t=JSON.parse(e.newValue);$e.state.offlineCache=t.offlineCache}}))}const Oe=(e,t)=>t.some((t=>e instanceof t));let Le;let je;function Ue(){return Le||(Le=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Je(){return je||(je=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Ke=new WeakMap;const He=new WeakMap;const Ne=new WeakMap;function Me(e){const t=new Promise(((t,n)=>{const i=()=>{e.removeEventListener("success",s);e.removeEventListener("error",r)};const s=()=>{t(Ge(e.result));i()};const r=()=>{n(e.error);i()};e.addEventListener("success",s);e.addEventListener("error",r)}));Ne.set(t,e);return t}function Be(e){if(Ke.has(e))return;const t=new Promise(((t,n)=>{const i=()=>{e.removeEventListener("complete",s);e.removeEventListener("error",r);e.removeEventListener("abort",r)};const s=()=>{t();i()};const r=()=>{n(e.error||new DOMException("AbortError","AbortError"));i()};e.addEventListener("complete",s);e.addEventListener("error",r);e.addEventListener("abort",r)}));Ke.set(e,t)}let Xe={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return Ke.get(e);if(t==="store"){return n.objectStoreNames[1]?undefined:n.objectStore(n.objectStoreNames[0])}}return Ge(e[t])},set(e,t,n){e[t]=n;return true},has(e,t){if(e instanceof IDBTransaction&&(t==="done"||t==="store")){return true}return t in e}};function Fe(e){Xe=e(Xe)}function Ve(e){if(Je().includes(e)){return function(...t){e.apply(Ye(this),t);return Ge(this.request)}}return function(...t){return Ge(e.apply(Ye(this),t))}}function qe(e){if(typeof e==="function")return Ve(e);if(e instanceof IDBTransaction)Be(e);if(Oe(e,Ue()))return new Proxy(e,Xe);return e}function Ge(e){if(e instanceof IDBRequest)return Me(e);if(He.has(e))return He.get(e);const t=qe(e);if(t!==e){He.set(e,t);Ne.set(t,e)}return t}const Ye=e=>Ne.get(e);function Ze(e,t,{blocked:n,upgrade:i,blocking:s,terminated:r}={}){const o=indexedDB.open(e,t);const a=Ge(o);if(i){o.addEventListener("upgradeneeded",(e=>{i(Ge(o.result),e.oldVersion,e.newVersion,Ge(o.transaction),e)}))}if(n){o.addEventListener("blocked",(e=>n(e.oldVersion,e.newVersion,e)))}a.then((e=>{if(r)e.addEventListener("close",(()=>r()));if(s){e.addEventListener("versionchange",(e=>s(e.oldVersion,e.newVersion,e)))}})).catch((()=>{}));return a}const Qe=["get","getKey","getAll","getAllKeys","count"];const et=["put","add","delete","clear"];const tt=new Map;function nt(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t==="string")){return}if(tt.get(t))return tt.get(t);const n=t.replace(/FromIndex$/,"");const i=t!==n;const s=et.includes(n);if(!(n in(i?IDBIndex:IDBObjectStore).prototype)||!(s||Qe.includes(n))){return}const r=async function(e,...t){const r=this.transaction(e,s?"readwrite":"readonly");let o=r.store;if(i)o=o.index(t.shift());return(await Promise.all([o[n](...t),s&&r.done]))[0]};tt.set(t,r);return r}Fe((e=>({...e,get:(t,n,i)=>nt(t,n)||e.get(t,n,i),has:(t,n)=>!!nt(t,n)||e.has(t,n)})));const it=["continue","continuePrimaryKey","advance"];const st={};const rt=new WeakMap;const ot=new WeakMap;const at={get(e,t){if(!it.includes(t))return e[t];let n=st[t];if(!n){n=st[t]=function(...e){rt.set(this,ot.get(this)[t](...e))}}return n}};async function*ct(...e){let t=this;if(!(t instanceof IDBCursor)){t=await t.openCursor(...e)}if(!t)return;t=t;const n=new Proxy(t,at);ot.set(n,t);Ne.set(n,Ye(t));while(t){yield n;t=await(rt.get(n)||t.continue());rt.delete(n)}}function lt(e,t){return t===Symbol.asyncIterator&&Oe(e,[IDBIndex,IDBObjectStore,IDBCursor])||t==="iterate"&&Oe(e,[IDBIndex,IDBObjectStore])}Fe((e=>({...e,get(t,n,i){if(lt(t,n))return ct;return e.get(t,n,i)},has(t,n){return lt(t,n)||e.has(t,n)}})));class dt{constructor(){this.dbPromise=Ze("OfflineCacheDB",1,{upgrade(e){if(!e.objectStoreNames.contains("documents")){const t=e.createObjectStore("documents",{keyPath:"url"});t.createIndex("url-revision",["url","revision"])}}})}async clear(){const e=await this.dbPromise;return e.clear("documents")}async get(e){const t=await this.dbPromise;return await t.get("documents",e)}async put(e){const t=await this.dbPromise;const n=await t.getFromIndex("documents","url-revision",[e.url,e.revision]);if(n){return}await t.put("documents",e)}}class ht{isOnline(){return navigator.onLine}}const ut=(e,t)=>new m({session:e,offlineCache:t.offlineCache?new dt:new g,onlineStatus:new ht});class ft extends y{constructor(e){super();this._value=e}get value(){return this.getValue()}_subscribe(e){const t=super._subscribe(e);!t.closed&&e.next(this._value);return t}getValue(){const{hasError:e,thrownError:t,_value:n}=this;if(e){throw t}this._throwIfClosed();return n}next(e){super.next(this._value=e)}}var pt=crypto;const bt=e=>e instanceof CryptoKey;const mt=async(e,t)=>{const n=`SHA-${e.slice(-3)}`;return new Uint8Array(await pt.subtle.digest(n,t))};var gt=mt;const wt=new TextEncoder;const yt=new TextDecoder;function vt(...e){const t=e.reduce(((e,{length:t})=>e+t),0);const n=new Uint8Array(t);let i=0;for(const t of e){n.set(t,i);i+=t.length}return n}const kt=e=>{let t=e;if(typeof t==="string"){t=wt.encode(t)}const n=32768;const i=[];for(let e=0;e<t.length;e+=n){i.push(String.fromCharCode.apply(null,t.subarray(e,e+n)))}return btoa(i.join(""))};const xt=e=>kt(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_");const St=e=>{const t=atob(e);const n=new Uint8Array(t.length);for(let e=0;e<t.length;e++){n[e]=t.charCodeAt(e)}return n};const _t=e=>{let t=e;if(t instanceof Uint8Array){t=yt.decode(t)}t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return St(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}};class Et extends Error{constructor(e,t){super(e,t);this.code="ERR_JOSE_GENERIC";this.name=this.constructor.name;Error.captureStackTrace?.(this,this.constructor)}}Et.code="ERR_JOSE_GENERIC";class At extends Et{constructor(e,t,n="unspecified",i="unspecified"){super(e,{cause:{claim:n,reason:i,payload:t}});this.code="ERR_JWT_CLAIM_VALIDATION_FAILED";this.claim=n;this.reason=i;this.payload=t}}At.code="ERR_JWT_CLAIM_VALIDATION_FAILED";class Tt extends Et{constructor(e,t,n="unspecified",i="unspecified"){super(e,{cause:{claim:n,reason:i,payload:t}});this.code="ERR_JWT_EXPIRED";this.claim=n;this.reason=i;this.payload=t}}Tt.code="ERR_JWT_EXPIRED";class Ct extends Et{constructor(){super(...arguments);this.code="ERR_JOSE_ALG_NOT_ALLOWED"}}Ct.code="ERR_JOSE_ALG_NOT_ALLOWED";class Rt extends Et{constructor(){super(...arguments);this.code="ERR_JOSE_NOT_SUPPORTED"}}Rt.code="ERR_JOSE_NOT_SUPPORTED";class It extends Et{constructor(e="decryption operation failed",t){super(e,t);this.code="ERR_JWE_DECRYPTION_FAILED"}}It.code="ERR_JWE_DECRYPTION_FAILED";class Pt extends Et{constructor(){super(...arguments);this.code="ERR_JWE_INVALID"}}Pt.code="ERR_JWE_INVALID";class zt extends Et{constructor(){super(...arguments);this.code="ERR_JWS_INVALID"}}zt.code="ERR_JWS_INVALID";class $t extends Et{constructor(){super(...arguments);this.code="ERR_JWT_INVALID"}}$t.code="ERR_JWT_INVALID";class Dt extends Et{constructor(){super(...arguments);this.code="ERR_JWK_INVALID"}}Dt.code="ERR_JWK_INVALID";class Wt extends Et{constructor(){super(...arguments);this.code="ERR_JWKS_INVALID"}}Wt.code="ERR_JWKS_INVALID";class Ot extends Et{constructor(e="no applicable key found in the JSON Web Key Set",t){super(e,t);this.code="ERR_JWKS_NO_MATCHING_KEY"}}Ot.code="ERR_JWKS_NO_MATCHING_KEY";class Lt extends Et{constructor(e="multiple matching keys found in the JSON Web Key Set",t){super(e,t);this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS"}}Lt.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";class jt extends Et{constructor(e="request timed out",t){super(e,t);this.code="ERR_JWKS_TIMEOUT"}}jt.code="ERR_JWKS_TIMEOUT";class Ut extends Et{constructor(e="signature verification failed",t){super(e,t);this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}Ut.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";function Jt(e,t="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function Kt(e,t){return e.name===t}function Ht(e){return parseInt(e.name.slice(4),10)}function Nt(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function Mt(e,t){if(t.length&&!t.some((t=>e.usages.includes(t)))){let e="CryptoKey does not support this operation, its usages must include ";if(t.length>2){const n=t.pop();e+=`one of ${t.join(", ")}, or ${n}.`}else if(t.length===2){e+=`one of ${t[0]} or ${t[1]}.`}else{e+=`${t[0]}.`}throw new TypeError(e)}}function Bt(e,t,...n){switch(t){case"HS256":case"HS384":case"HS512":{if(!Kt(e.algorithm,"HMAC"))throw Jt("HMAC");const n=parseInt(t.slice(2),10);const i=Ht(e.algorithm.hash);if(i!==n)throw Jt(`SHA-${n}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!Kt(e.algorithm,"RSASSA-PKCS1-v1_5"))throw Jt("RSASSA-PKCS1-v1_5");const n=parseInt(t.slice(2),10);const i=Ht(e.algorithm.hash);if(i!==n)throw Jt(`SHA-${n}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!Kt(e.algorithm,"RSA-PSS"))throw Jt("RSA-PSS");const n=parseInt(t.slice(2),10);const i=Ht(e.algorithm.hash);if(i!==n)throw Jt(`SHA-${n}`,"algorithm.hash");break}case"EdDSA":{if(e.algorithm.name!=="Ed25519"&&e.algorithm.name!=="Ed448"){throw Jt("Ed25519 or Ed448")}break}case"Ed25519":{if(!Kt(e.algorithm,"Ed25519"))throw Jt("Ed25519");break}case"ES256":case"ES384":case"ES512":{if(!Kt(e.algorithm,"ECDSA"))throw Jt("ECDSA");const n=Nt(t);const i=e.algorithm.namedCurve;if(i!==n)throw Jt(n,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}Mt(e,n)}function Xt(e,t,...n){n=n.filter(Boolean);if(n.length>2){const t=n.pop();e+=`one of type ${n.join(", ")}, or ${t}.`}else if(n.length===2){e+=`one of type ${n[0]} or ${n[1]}.`}else{e+=`of type ${n[0]}.`}if(t==null){e+=` Received ${t}`}else if(typeof t==="function"&&t.name){e+=` Received function ${t.name}`}else if(typeof t==="object"&&t!=null){if(t.constructor?.name){e+=` Received an instance of ${t.constructor.name}`}}return e}var Ft=(e,...t)=>Xt("Key must be ",e,...t);function Vt(e,t,...n){return Xt(`Key for the ${e} algorithm must be `,t,...n)}var qt=e=>{if(bt(e)){return true}return e?.[Symbol.toStringTag]==="KeyObject"};const Gt=["CryptoKey"];const Yt=(...e)=>{const t=e.filter(Boolean);if(t.length===0||t.length===1){return true}let n;for(const e of t){const t=Object.keys(e);if(!n||n.size===0){n=new Set(t);continue}for(const e of t){if(n.has(e)){return false}n.add(e)}}return true};var Zt=Yt;function Qt(e){return typeof e==="object"&&e!==null}function en(e){if(!Qt(e)||Object.prototype.toString.call(e)!=="[object Object]"){return false}if(Object.getPrototypeOf(e)===null){return true}let t=e;while(Object.getPrototypeOf(t)!==null){t=Object.getPrototypeOf(t)}return Object.getPrototypeOf(e)===t}var tn=(e,t)=>{if(e.startsWith("RS")||e.startsWith("PS")){const{modulusLength:n}=t.algorithm;if(typeof n!=="number"||n<2048){throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}}};function nn(e){return en(e)&&typeof e.kty==="string"}function sn(e){return e.kty!=="oct"&&typeof e.d==="string"}function rn(e){return e.kty!=="oct"&&typeof e.d==="undefined"}function on(e){return nn(e)&&e.kty==="oct"&&typeof e.k==="string"}function an(e){let t;let n;switch(e.kty){case"RSA":{switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${e.alg.slice(-3)}`};n=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.alg.slice(-3)}`};n=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(e.alg.slice(-3),10)||1}`};n=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new Rt('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"EC":{switch(e.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"};n=e.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"};n=e.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"};n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv};n=e.d?["deriveBits"]:[];break;default:throw new Rt('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"OKP":{switch(e.alg){case"Ed25519":t={name:"Ed25519"};n=e.d?["sign"]:["verify"];break;case"EdDSA":t={name:e.crv};n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv};n=e.d?["deriveBits"]:[];break;default:throw new Rt('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}default:throw new Rt('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:n}}const cn=async e=>{if(!e.alg){throw new TypeError('"alg" argument is required when "jwk.alg" is not present')}const{algorithm:t,keyUsages:n}=an(e);const i=[t,e.ext??false,e.key_ops??n];const s={...e};delete s.alg;delete s.use;return pt.subtle.importKey("jwk",s,...i)};var ln=cn;const dn=e=>_t(e);let hn;let un;const fn=e=>e?.[Symbol.toStringTag]==="KeyObject";const pn=async(e,t,n,i,s=false)=>{let r=e.get(t);if(r?.[i]){return r[i]}const o=await ln({...n,alg:i});if(s)Object.freeze(t);if(!r){e.set(t,{[i]:o})}else{r[i]=o}return o};const bn=(e,t)=>{if(fn(e)){let n=e.export({format:"jwk"});delete n.d;delete n.dp;delete n.dq;delete n.p;delete n.q;delete n.qi;if(n.k){return dn(n.k)}un||(un=new WeakMap);return pn(un,e,n,t)}if(nn(e)){if(e.k)return _t(e.k);un||(un=new WeakMap);const n=pn(un,e,e,t,true);return n}return e};const mn=(e,t)=>{if(fn(e)){let n=e.export({format:"jwk"});if(n.k){return dn(n.k)}hn||(hn=new WeakMap);return pn(hn,e,n,t)}if(nn(e)){if(e.k)return _t(e.k);hn||(hn=new WeakMap);const n=pn(hn,e,e,t,true);return n}return e};var gn={normalizePublicKey:bn,normalizePrivateKey:mn};async function wn(e,t){if(!en(e)){throw new TypeError("JWK must be an object")}t||(t=e.alg);switch(e.kty){case"oct":if(typeof e.k!=="string"||!e.k){throw new TypeError('missing "k" (Key Value) Parameter value')}return _t(e.k);case"RSA":if("oth"in e&&e.oth!==undefined){throw new Rt('RSA JWK "oth" (Other Primes Info) Parameter value is not supported')}case"EC":case"OKP":return ln({...e,alg:t});default:throw new Rt('Unsupported "kty" (Key Type) Parameter value')}}const yn=e=>e?.[Symbol.toStringTag];const vn=(e,t,n)=>{if(t.use!==undefined&&t.use!=="sig"){throw new TypeError("Invalid key for this operation, when present its use must be sig")}if(t.key_ops!==undefined&&t.key_ops.includes?.(n)!==true){throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${n}`)}if(t.alg!==undefined&&t.alg!==e){throw new TypeError(`Invalid key for this operation, when present its alg must be ${e}`)}return true};const kn=(e,t,n,i)=>{if(t instanceof Uint8Array)return;if(i&&nn(t)){if(on(t)&&vn(e,t,n))return;throw new TypeError(`JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present`)}if(!qt(t)){throw new TypeError(Vt(e,t,...Gt,"Uint8Array",i?"JSON Web Key":null))}if(t.type!=="secret"){throw new TypeError(`${yn(t)} instances for symmetric algorithms must be of type "secret"`)}};const xn=(e,t,n,i)=>{if(i&&nn(t)){switch(n){case"sign":if(sn(t)&&vn(e,t,n))return;throw new TypeError(`JSON Web Key for this operation be a private JWK`);case"verify":if(rn(t)&&vn(e,t,n))return;throw new TypeError(`JSON Web Key for this operation be a public JWK`)}}if(!qt(t)){throw new TypeError(Vt(e,t,...Gt,i?"JSON Web Key":null))}if(t.type==="secret"){throw new TypeError(`${yn(t)} instances for asymmetric algorithms must not be of type "secret"`)}if(n==="sign"&&t.type==="public"){throw new TypeError(`${yn(t)} instances for asymmetric algorithm signing must be of type "private"`)}if(n==="decrypt"&&t.type==="public"){throw new TypeError(`${yn(t)} instances for asymmetric algorithm decryption must be of type "private"`)}if(t.algorithm&&n==="verify"&&t.type==="private"){throw new TypeError(`${yn(t)} instances for asymmetric algorithm verifying must be of type "public"`)}if(t.algorithm&&n==="encrypt"&&t.type==="private"){throw new TypeError(`${yn(t)} instances for asymmetric algorithm encryption must be of type "public"`)}};function Sn(e,t,n,i){const s=t.startsWith("HS")||t==="dir"||t.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(t);if(s){kn(t,n,i,e)}else{xn(t,n,i,e)}}Sn.bind(undefined,false);const _n=Sn.bind(undefined,true);function En(e,t,n,i,s){if(s.crit!==undefined&&i?.crit===undefined){throw new e('"crit" (Critical) Header Parameter MUST be integrity protected')}if(!i||i.crit===undefined){return new Set}if(!Array.isArray(i.crit)||i.crit.length===0||i.crit.some((e=>typeof e!=="string"||e.length===0))){throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present')}let r;if(n!==undefined){r=new Map([...Object.entries(n),...t.entries()])}else{r=t}for(const t of i.crit){if(!r.has(t)){throw new Rt(`Extension Header Parameter "${t}" is not recognized`)}if(s[t]===undefined){throw new e(`Extension Header Parameter "${t}" is missing`)}if(r.get(t)&&i[t]===undefined){throw new e(`Extension Header Parameter "${t}" MUST be integrity protected`)}}return new Set(i.crit)}const An=(e,t)=>{if(t!==undefined&&(!Array.isArray(t)||t.some((e=>typeof e!=="string")))){throw new TypeError(`"${e}" option must be an array of strings`)}if(!t){return undefined}return new Set(t)};var Tn=An;const Cn=async e=>{if(e instanceof Uint8Array){return{kty:"oct",k:xt(e)}}if(!bt(e)){throw new TypeError(Ft(e,...Gt,"Uint8Array"))}if(!e.extractable){throw new TypeError("non-extractable CryptoKey cannot be exported as a JWK")}const{ext:t,key_ops:n,alg:i,use:s,...r}=await pt.subtle.exportKey("jwk",e);return r};var Rn=Cn;async function In(e){return Rn(e)}function Pn(e,t){const n=`SHA-${e.slice(-3)}`;switch(e){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:e.slice(-3)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":return{name:"Ed25519"};case"EdDSA":return{name:t.name};default:throw new Rt(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}async function zn(e,t,n){if(n==="sign"){t=await gn.normalizePrivateKey(t,e)}if(n==="verify"){t=await gn.normalizePublicKey(t,e)}if(bt(t)){Bt(t,e,n);return t}if(t instanceof Uint8Array){if(!e.startsWith("HS")){throw new TypeError(Ft(t,...Gt))}return pt.subtle.importKey("raw",t,{hash:`SHA-${e.slice(-3)}`,name:"HMAC"},false,[n])}throw new TypeError(Ft(t,...Gt,"Uint8Array","JSON Web Key"))}const $n=async(e,t,n,i)=>{const s=await zn(e,t,"verify");tn(e,s);const r=Pn(e,s.algorithm);try{return await pt.subtle.verify(r,s,n,i)}catch{return false}};var Dn=$n;async function Wn(e,t,n){if(!en(e)){throw new zt("Flattened JWS must be an object")}if(e.protected===undefined&&e.header===undefined){throw new zt('Flattened JWS must have either of the "protected" or "header" members')}if(e.protected!==undefined&&typeof e.protected!=="string"){throw new zt("JWS Protected Header incorrect type")}if(e.payload===undefined){throw new zt("JWS Payload missing")}if(typeof e.signature!=="string"){throw new zt("JWS Signature missing or incorrect type")}if(e.header!==undefined&&!en(e.header)){throw new zt("JWS Unprotected Header incorrect type")}let i={};if(e.protected){try{const t=_t(e.protected);i=JSON.parse(yt.decode(t))}catch{throw new zt("JWS Protected Header is invalid")}}if(!Zt(i,e.header)){throw new zt("JWS Protected and JWS Unprotected Header Parameter names must be disjoint")}const s={...i,...e.header};const r=En(zt,new Map([["b64",true]]),n?.crit,i,s);let o=true;if(r.has("b64")){o=i.b64;if(typeof o!=="boolean"){throw new zt('The "b64" (base64url-encode payload) Header Parameter must be a boolean')}}const{alg:a}=s;if(typeof a!=="string"||!a){throw new zt('JWS "alg" (Algorithm) Header Parameter missing or invalid')}const c=n&&Tn("algorithms",n.algorithms);if(c&&!c.has(a)){throw new Ct('"alg" (Algorithm) Header Parameter value not allowed')}if(o){if(typeof e.payload!=="string"){throw new zt("JWS Payload must be a string")}}else if(typeof e.payload!=="string"&&!(e.payload instanceof Uint8Array)){throw new zt("JWS Payload must be a string or an Uint8Array instance")}let l=false;if(typeof t==="function"){t=await t(i,e);l=true;_n(a,t,"verify");if(nn(t)){t=await wn(t,a)}}else{_n(a,t,"verify")}const d=vt(wt.encode(e.protected??""),wt.encode("."),typeof e.payload==="string"?wt.encode(e.payload):e.payload);let h;try{h=_t(e.signature)}catch{throw new zt("Failed to base64url decode the signature")}const u=await Dn(a,t,h,d);if(!u){throw new Ut}let f;if(o){try{f=_t(e.payload)}catch{throw new zt("Failed to base64url decode the payload")}}else if(typeof e.payload==="string"){f=wt.encode(e.payload)}else{f=e.payload}const p={payload:f};if(e.protected!==undefined){p.protectedHeader=i}if(e.header!==undefined){p.unprotectedHeader=e.header}if(l){return{...p,key:t}}return p}async function On(e,t,n){if(e instanceof Uint8Array){e=yt.decode(e)}if(typeof e!=="string"){throw new zt("Compact JWS must be a string or Uint8Array")}const{0:i,1:s,2:r,length:o}=e.split(".");if(o!==3){throw new zt("Invalid Compact JWS")}const a=await Wn({payload:s,protected:i,signature:r},t,n);const c={payload:a.payload,protectedHeader:a.protectedHeader};if(typeof t==="function"){return{...c,key:a.key}}return c}var Ln=e=>Math.floor(e.getTime()/1e3);const jn=60;const Un=jn*60;const Jn=Un*24;const Kn=Jn*7;const Hn=Jn*365.25;const Nn=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;var Mn=e=>{const t=Nn.exec(e);if(!t||t[4]&&t[1]){throw new TypeError("Invalid time period format")}const n=parseFloat(t[2]);const i=t[3].toLowerCase();let s;switch(i){case"sec":case"secs":case"second":case"seconds":case"s":s=Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":s=Math.round(n*jn);break;case"hour":case"hours":case"hr":case"hrs":case"h":s=Math.round(n*Un);break;case"day":case"days":case"d":s=Math.round(n*Jn);break;case"week":case"weeks":case"w":s=Math.round(n*Kn);break;default:s=Math.round(n*Hn);break}if(t[1]==="-"||t[4]==="ago"){return-s}return s};const Bn=e=>e.toLowerCase().replace(/^application\//,"");const Xn=(e,t)=>{if(typeof e==="string"){return t.includes(e)}if(Array.isArray(e)){return t.some(Set.prototype.has.bind(new Set(e)))}return false};var Fn=(e,t,n={})=>{let i;try{i=JSON.parse(yt.decode(t))}catch{}if(!en(i)){throw new $t("JWT Claims Set must be a top-level JSON object")}const{typ:s}=n;if(s&&(typeof e.typ!=="string"||Bn(e.typ)!==Bn(s))){throw new At('unexpected "typ" JWT header value',i,"typ","check_failed")}const{requiredClaims:r=[],issuer:o,subject:a,audience:c,maxTokenAge:l}=n;const d=[...r];if(l!==undefined)d.push("iat");if(c!==undefined)d.push("aud");if(a!==undefined)d.push("sub");if(o!==undefined)d.push("iss");for(const e of new Set(d.reverse())){if(!(e in i)){throw new At(`missing required "${e}" claim`,i,e,"missing")}}if(o&&!(Array.isArray(o)?o:[o]).includes(i.iss)){throw new At('unexpected "iss" claim value',i,"iss","check_failed")}if(a&&i.sub!==a){throw new At('unexpected "sub" claim value',i,"sub","check_failed")}if(c&&!Xn(i.aud,typeof c==="string"?[c]:c)){throw new At('unexpected "aud" claim value',i,"aud","check_failed")}let h;switch(typeof n.clockTolerance){case"string":h=Mn(n.clockTolerance);break;case"number":h=n.clockTolerance;break;case"undefined":h=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:u}=n;const f=Ln(u||new Date);if((i.iat!==undefined||l)&&typeof i.iat!=="number"){throw new At('"iat" claim must be a number',i,"iat","invalid")}if(i.nbf!==undefined){if(typeof i.nbf!=="number"){throw new At('"nbf" claim must be a number',i,"nbf","invalid")}if(i.nbf>f+h){throw new At('"nbf" claim timestamp check failed',i,"nbf","check_failed")}}if(i.exp!==undefined){if(typeof i.exp!=="number"){throw new At('"exp" claim must be a number',i,"exp","invalid")}if(i.exp<=f-h){throw new Tt('"exp" claim timestamp check failed',i,"exp","check_failed")}}if(l){const e=f-i.iat;const t=typeof l==="number"?l:Mn(l);if(e-h>t){throw new Tt('"iat" claim timestamp check failed (too far in the past)',i,"iat","check_failed")}if(e<0-h){throw new At('"iat" claim timestamp check failed (it should be in the past)',i,"iat","check_failed")}}return i};async function Vn(e,t,n){const i=await On(e,t,n);if(i.protectedHeader.crit?.includes("b64")&&i.protectedHeader.b64===false){throw new $t("JWTs MUST NOT use unencoded payload")}const s=Fn(i.protectedHeader,i.payload,n);const r={payload:s,protectedHeader:i.protectedHeader};if(typeof t==="function"){return{...r,key:i.key}}return r}const qn=async(e,t,n)=>{const i=await zn(e,t,"sign");tn(e,i);const s=await pt.subtle.sign(Pn(e,i.algorithm),i,n);return new Uint8Array(s)};var Gn=qn;class Yn{constructor(e){if(!(e instanceof Uint8Array)){throw new TypeError("payload must be an instance of Uint8Array")}this._payload=e}setProtectedHeader(e){if(this._protectedHeader){throw new TypeError("setProtectedHeader can only be called once")}this._protectedHeader=e;return this}setUnprotectedHeader(e){if(this._unprotectedHeader){throw new TypeError("setUnprotectedHeader can only be called once")}this._unprotectedHeader=e;return this}async sign(e,t){if(!this._protectedHeader&&!this._unprotectedHeader){throw new zt("either setProtectedHeader or setUnprotectedHeader must be called before #sign()")}if(!Zt(this._protectedHeader,this._unprotectedHeader)){throw new zt("JWS Protected and JWS Unprotected Header Parameter names must be disjoint")}const n={...this._protectedHeader,...this._unprotectedHeader};const i=En(zt,new Map([["b64",true]]),t?.crit,this._protectedHeader,n);let s=true;if(i.has("b64")){s=this._protectedHeader.b64;if(typeof s!=="boolean"){throw new zt('The "b64" (base64url-encode payload) Header Parameter must be a boolean')}}const{alg:r}=n;if(typeof r!=="string"||!r){throw new zt('JWS "alg" (Algorithm) Header Parameter missing or invalid')}_n(r,e,"sign");let o=this._payload;if(s){o=wt.encode(xt(o))}let a;if(this._protectedHeader){a=wt.encode(xt(JSON.stringify(this._protectedHeader)))}else{a=wt.encode("")}const c=vt(a,wt.encode("."),o);const l=await Gn(r,e,c);const d={signature:xt(l),payload:""};if(s){d.payload=yt.decode(o)}if(this._unprotectedHeader){d.header=this._unprotectedHeader}if(this._protectedHeader){d.protected=yt.decode(a)}return d}}class Zn{constructor(e){this._flattened=new Yn(e)}setProtectedHeader(e){this._flattened.setProtectedHeader(e);return this}async sign(e,t){const n=await this._flattened.sign(e,t);if(n.payload===undefined){throw new TypeError("use the flattened module for creating JWS with b64: false")}return`${n.protected}.${n.payload}.${n.signature}`}}function Qn(e,t){if(!Number.isFinite(t)){throw new TypeError(`Invalid ${e} input`)}return t}class ei{constructor(e={}){if(!en(e)){throw new TypeError("JWT Claims Set MUST be an object")}this._payload=e}setIssuer(e){this._payload={...this._payload,iss:e};return this}setSubject(e){this._payload={...this._payload,sub:e};return this}setAudience(e){this._payload={...this._payload,aud:e};return this}setJti(e){this._payload={...this._payload,jti:e};return this}setNotBefore(e){if(typeof e==="number"){this._payload={...this._payload,nbf:Qn("setNotBefore",e)}}else if(e instanceof Date){this._payload={...this._payload,nbf:Qn("setNotBefore",Ln(e))}}else{this._payload={...this._payload,nbf:Ln(new Date)+Mn(e)}}return this}setExpirationTime(e){if(typeof e==="number"){this._payload={...this._payload,exp:Qn("setExpirationTime",e)}}else if(e instanceof Date){this._payload={...this._payload,exp:Qn("setExpirationTime",Ln(e))}}else{this._payload={...this._payload,exp:Ln(new Date)+Mn(e)}}return this}setIssuedAt(e){if(typeof e==="undefined"){this._payload={...this._payload,iat:Ln(new Date)}}else if(e instanceof Date){this._payload={...this._payload,iat:Qn("setIssuedAt",Ln(e))}}else if(typeof e==="string"){this._payload={...this._payload,iat:Qn("setIssuedAt",Ln(new Date)+Mn(e))}}else{this._payload={...this._payload,iat:Qn("setIssuedAt",e)}}return this}}class ti extends ei{setProtectedHeader(e){this._protectedHeader=e;return this}async sign(e,t){const n=new Zn(wt.encode(JSON.stringify(this._payload)));n.setProtectedHeader(this._protectedHeader);if(Array.isArray(this._protectedHeader?.crit)&&this._protectedHeader.crit.includes("b64")&&this._protectedHeader.b64===false){throw new $t("JWTs MUST NOT use unencoded payload")}return n.sign(e,t)}}const ni=(e,t)=>{if(typeof e!=="string"||!e){throw new Dt(`${t} missing or invalid`)}};async function ii(e,t){if(!en(e)){throw new TypeError("JWK must be an object")}t??(t="sha256");if(t!=="sha256"&&t!=="sha384"&&t!=="sha512"){throw new TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"')}let n;switch(e.kty){case"EC":ni(e.crv,'"crv" (Curve) Parameter');ni(e.x,'"x" (X Coordinate) Parameter');ni(e.y,'"y" (Y Coordinate) Parameter');n={crv:e.crv,kty:e.kty,x:e.x,y:e.y};break;case"OKP":ni(e.crv,'"crv" (Subtype of Key Pair) Parameter');ni(e.x,'"x" (Public Key) Parameter');n={crv:e.crv,kty:e.kty,x:e.x};break;case"RSA":ni(e.e,'"e" (Exponent) Parameter');ni(e.n,'"n" (Modulus) Parameter');n={e:e.e,kty:e.kty,n:e.n};break;case"oct":ni(e.k,'"k" (Key Value) Parameter');n={k:e.k,kty:e.kty};break;default:throw new Rt('"kty" (Key Type) Parameter missing or unsupported')}const i=wt.encode(JSON.stringify(n));return xt(await gt(t,i))}function si(e){switch(typeof e==="string"&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";default:throw new Rt('Unsupported "alg" value for a JSON Web Key Set')}}function ri(e){return e&&typeof e==="object"&&Array.isArray(e.keys)&&e.keys.every(oi)}function oi(e){return en(e)}function ai(e){if(typeof structuredClone==="function"){return structuredClone(e)}return JSON.parse(JSON.stringify(e))}class ci{constructor(e){this._cached=new WeakMap;if(!ri(e)){throw new Wt("JSON Web Key Set malformed")}this._jwks=ai(e)}async getKey(e,t){const{alg:n,kid:i}={...e,...t?.header};const s=si(n);const r=this._jwks.keys.filter((e=>{let t=s===e.kty;if(t&&typeof i==="string"){t=i===e.kid}if(t&&typeof e.alg==="string"){t=n===e.alg}if(t&&typeof e.use==="string"){t=e.use==="sig"}if(t&&Array.isArray(e.key_ops)){t=e.key_ops.includes("verify")}if(t){switch(n){case"ES256":t=e.crv==="P-256";break;case"ES256K":t=e.crv==="secp256k1";break;case"ES384":t=e.crv==="P-384";break;case"ES512":t=e.crv==="P-521";break;case"Ed25519":t=e.crv==="Ed25519";break;case"EdDSA":t=e.crv==="Ed25519"||e.crv==="Ed448";break}}return t}));const{0:o,length:a}=r;if(a===0){throw new Ot}if(a!==1){const e=new Lt;const{_cached:t}=this;e[Symbol.asyncIterator]=async function*(){for(const e of r){try{yield await li(t,e,n)}catch{}}};throw e}return li(this._cached,o,n)}}async function li(e,t,n){const i=e.get(t)||e.set(t,{}).get(t);if(i[n]===undefined){const e=await wn({...t,ext:true},n);if(e instanceof Uint8Array||e.type!=="public"){throw new Wt("JSON Web Key Set members must be public keys")}i[n]=e}return i[n]}function di(e){const t=new ci(e);const n=async(e,n)=>t.getKey(e,n);Object.defineProperties(n,{jwks:{value:()=>ai(t._jwks),enumerable:true,configurable:false,writable:false}});return n}const hi=async(e,t,n)=>{let i;let s;let r=false;if(typeof AbortController==="function"){i=new AbortController;s=setTimeout((()=>{r=true;i.abort()}),t)}const o=await fetch(e.href,{signal:i?i.signal:undefined,redirect:"manual",headers:n.headers}).catch((e=>{if(r)throw new jt;throw e}));if(s!==undefined)clearTimeout(s);if(o.status!==200){throw new Et("Expected 200 OK from the JSON Web Key Set HTTP response")}try{return await o.json()}catch{throw new Et("Failed to parse the JSON Web Key Set HTTP response as JSON")}};var ui=hi;function fi(){return typeof WebSocketPair!=="undefined"||typeof navigator!=="undefined"&&navigator.userAgent==="Cloudflare-Workers"||typeof EdgeRuntime!=="undefined"&&EdgeRuntime==="vercel"}let pi;if(typeof navigator==="undefined"||!navigator.userAgent?.startsWith?.("Mozilla/5.0 ")){const e="jose";const t="v5.10.0";pi=`${e}/${t}`}const bi=Symbol();function mi(e,t){if(typeof e!=="object"||e===null){return false}if(!("uat"in e)||typeof e.uat!=="number"||Date.now()-e.uat>=t){return false}if(!("jwks"in e)||!en(e.jwks)||!Array.isArray(e.jwks.keys)||!Array.prototype.every.call(e.jwks.keys,en)){return false}return true}class gi{constructor(e,t){if(!(e instanceof URL)){throw new TypeError("url must be an instance of URL")}this._url=new URL(e.href);this._options={agent:t?.agent,headers:t?.headers};this._timeoutDuration=typeof t?.timeoutDuration==="number"?t?.timeoutDuration:5e3;this._cooldownDuration=typeof t?.cooldownDuration==="number"?t?.cooldownDuration:3e4;this._cacheMaxAge=typeof t?.cacheMaxAge==="number"?t?.cacheMaxAge:6e5;if(t?.[bi]!==undefined){this._cache=t?.[bi];if(mi(t?.[bi],this._cacheMaxAge)){this._jwksTimestamp=this._cache.uat;this._local=di(this._cache.jwks)}}}coolingDown(){return typeof this._jwksTimestamp==="number"?Date.now()<this._jwksTimestamp+this._cooldownDuration:false}fresh(){return typeof this._jwksTimestamp==="number"?Date.now()<this._jwksTimestamp+this._cacheMaxAge:false}async getKey(e,t){if(!this._local||!this.fresh()){await this.reload()}try{return await this._local(e,t)}catch(n){if(n instanceof Ot){if(this.coolingDown()===false){await this.reload();return this._local(e,t)}}throw n}}async reload(){if(this._pendingFetch&&fi()){this._pendingFetch=undefined}const e=new Headers(this._options.headers);if(pi&&!e.has("User-Agent")){e.set("User-Agent",pi);this._options.headers=Object.fromEntries(e.entries())}this._pendingFetch||(this._pendingFetch=ui(this._url,this._timeoutDuration,this._options).then((e=>{this._local=di(e);if(this._cache){this._cache.uat=Date.now();this._cache.jwks=e}this._jwksTimestamp=Date.now();this._pendingFetch=undefined})).catch((e=>{this._pendingFetch=undefined;throw e})));await this._pendingFetch}}function wi(e,t){const n=new gi(e,t);const i=async(e,t)=>n.getKey(e,t);Object.defineProperties(i,{coolingDown:{get:()=>n.coolingDown(),enumerable:true,configurable:false},fresh:{get:()=>n.fresh(),enumerable:true,configurable:false},reload:{value:()=>n.reload(),enumerable:true,configurable:false,writable:false},reloading:{get:()=>!!n._pendingFetch,enumerable:true,configurable:false},jwks:{value:()=>n._local?.jwks(),enumerable:true,configurable:false,writable:false}});return i}const yi=_t;function vi(e){if(typeof e!=="string")throw new $t("JWTs must use Compact JWS serialization, JWT must be a string");const{1:t,length:n}=e.split(".");if(n===5)throw new $t("Only JWTs using Compact JWS serialization can be decoded");if(n!==3)throw new $t("Invalid JWT");if(!t)throw new $t("JWTs must contain a payload");let i;try{i=yi(t)}catch{throw new $t("Failed to base64url decode the payload")}let s;try{s=JSON.parse(yt.decode(i))}catch{throw new $t("Failed to parse the decoded payload as JSON")}if(!en(s))throw new $t("Invalid JWT Claims Set");return s}function ki(e){const t=e?.modulusLength??2048;if(typeof t!=="number"||t<2048){throw new Rt("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used")}return t}async function xi(e,t){let n;let i;switch(e){case"PS256":case"PS384":case"PS512":n={name:"RSA-PSS",hash:`SHA-${e.slice(-3)}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:ki(t)};i=["sign","verify"];break;case"RS256":case"RS384":case"RS512":n={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.slice(-3)}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:ki(t)};i=["sign","verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":n={name:"RSA-OAEP",hash:`SHA-${parseInt(e.slice(-3),10)||1}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:ki(t)};i=["decrypt","unwrapKey","encrypt","wrapKey"];break;case"ES256":n={name:"ECDSA",namedCurve:"P-256"};i=["sign","verify"];break;case"ES384":n={name:"ECDSA",namedCurve:"P-384"};i=["sign","verify"];break;case"ES512":n={name:"ECDSA",namedCurve:"P-521"};i=["sign","verify"];break;case"Ed25519":n={name:"Ed25519"};i=["sign","verify"];break;case"EdDSA":{i=["sign","verify"];const e=t?.crv??"Ed25519";switch(e){case"Ed25519":case"Ed448":n={name:e};break;default:throw new Rt("Invalid or unsupported crv option provided")}break}case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{i=["deriveKey","deriveBits"];const e=t?.crv??"P-256";switch(e){case"P-256":case"P-384":case"P-521":{n={name:"ECDH",namedCurve:e};break}case"X25519":case"X448":n={name:e};break;default:throw new Rt("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448")}break}default:throw new Rt('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return pt.subtle.generateKey(n,t?.extractable??false,i)}async function Si(e,t){return xi(e,t)}const _i=async(e,t)=>{const n={...t,grant_types:["authorization_code","refresh_token"],id_token_signed_response_alg:"ES256",token_endpoint_auth_method:"none",application_type:"web",subject_type:"public"};return fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})};const Ei=async(e,t,n)=>{const i=new URL(t);const s=i.origin+i.pathname+i.search;const r=new URL(e).origin;const o=await fetch(`${r}/.well-known/openid-configuration`).then((e=>{if(!e.ok){throw new Error(`HTTP error! Status: ${e.status}`)}return e.json()}));const a=o["issuer"];const c=e=>e.endsWith("/")?e.slice(0,-1):e;if(c(e)!==c(a)){throw new Error("RFC 9207 - iss !== idp - "+a+" !== "+e)}sessionStorage.setItem("idp",a);sessionStorage.setItem("token_endpoint",o["token_endpoint"]);sessionStorage.setItem("jwks_uri",o["jwks_uri"]);let l=n?.client_id;if(!l){const e=o["registration_endpoint"];const t=await _i(e,n??{redirect_uris:[s]}).then((e=>{if(!e.ok){throw new Error(`HTTP error! Status: ${e.status}`)}return e.json()}));l=t["client_id"]}try{new URL(l)}catch{sessionStorage.setItem("client_id",l)}const{pkce_code_verifier:d,pkce_code_challenge:h}=await Ai();sessionStorage.setItem("pkce_code_verifier",d);const u=window.crypto.randomUUID();sessionStorage.setItem("csrf_token",u);const f=o["authorization_endpoint"]+`?response_type=code`+`&redirect_uri=${encodeURIComponent(s)}`+`&scope=openid offline_access webid`+`&client_id=${encodeURIComponent(l)}`+`&code_challenge_method=S256`+`&code_challenge=${h}`+`&state=${u}`+`&prompt=consent`;window.location.href=f};const Ai=async()=>{const e=window.crypto.randomUUID()+"-"+window.crypto.randomUUID();const t=new Uint8Array(await window.crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e)));const n=btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return{pkce_code_verifier:e,pkce_code_challenge:n}};const Ti=async(e,t)=>{const n=new URL(window.location.href);const i=n.searchParams.get("code");if(i===null){return{clientDetails:e}}const s=sessionStorage.getItem("idp");if(s===null||n.searchParams.get("iss")!==s){throw new Error("RFC 9207 - iss !== idp - "+n.searchParams.get("iss")+" !== "+s)}if(n.searchParams.get("state")!==sessionStorage.getItem("csrf_token")){throw new Error("RFC 6749 - state !== csrf_token - "+n.searchParams.get("state")+" !== "+sessionStorage.getItem("csrf_token"))}n.searchParams.delete("iss");n.searchParams.delete("state");n.searchParams.delete("code");window.history.pushState({},document.title,n.toString());const r=sessionStorage.getItem("pkce_code_verifier");if(r===null){throw new Error("Access Token Request preparation - Could not find in sessionStorage: pkce_code_verifier")}const o=e?.client_id||sessionStorage.getItem("client_id");if(!o){throw new Error("Access Token Request preparation - Could not find in sessionStorage: client_id (dynamic registration)")}const a=sessionStorage.getItem("token_endpoint");if(a===null){throw new Error("Access Token Request preparation - Could not find in sessionStorage: token_endpoint")}const c=await Si("ES256");const l=await Ci(i,r,n.toString(),o,a,c).then((e=>{if(!e.ok){throw new Error(`HTTP error! Status: ${e.status}`)}return e.json()}));const d=l["access_token"];const h=sessionStorage.getItem("jwks_uri");if(h===null){throw new Error("Access Token validation preparation - Could not find in sessionStorage: jwks_uri")}const u=wi(new URL(h));const{payload:f}=await Vn(d,u,{issuer:s,audience:"solid"});const p=await ii(await In(c.publicKey));if(f["cnf"]["jkt"]!==p){throw new Error("Access Token validation failed on `jkt`: jkt !== DPoP thumbprint - "+f["cnf"]["jkt"]+" !== "+p)}if(f["client_id"]!==o){throw new Error("Access Token validation failed on `client_id`: JWT payload !== client_id - "+f["client_id"]+" !== "+o)}const b={...l,dpop_key_pair:c};const m={idp:s,jwks_uri:h,token_endpoint:a};if(!e)e={redirect_uris:[n.toString()]};e.client_id=o;if(t){await t.init();await Promise.all([t.setItem("idp",s),t.setItem("jwks_uri",h),t.setItem("token_endpoint",a),t.setItem("client_id",o),t.setItem("dpop_keypair",c),t.setItem("refresh_token",l["refresh_token"])]);t.close()}sessionStorage.removeItem("csrf_token");sessionStorage.removeItem("pkce_code_verifier");sessionStorage.removeItem("idp");sessionStorage.removeItem("jwks_uri");sessionStorage.removeItem("token_endpoint");sessionStorage.removeItem("client_id");return{clientDetails:e,idpDetails:m,tokenDetails:b}};const Ci=async(e,t,n,i,s,r)=>{const o=await In(r.publicKey);o.alg="ES256";const a=await new ti({htu:s,htm:"POST"}).setIssuedAt().setJti(window.crypto.randomUUID()).setProtectedHeader({alg:"ES256",typ:"dpop+jwt",jwk:o}).sign(r.privateKey);return fetch(s,{method:"POST",headers:{dpop:a,"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:n,client_id:i})})};const Ri=async e=>{try{await e.init();const t=await e.getItem("client_id");const n=await e.getItem("token_endpoint");const i=await e.getItem("dpop_keypair");const s=await e.getItem("refresh_token");if(t===null||n===null||i===null||s===null){throw new Error("Could not refresh tokens: details missing from database.")}const r=await Ii(s,t,n,i).then((e=>{if(!e.ok){throw new Error(`HTTP error! Status: ${e.status}`)}return e.json()}));const o=r["access_token"];const a=await e.getItem("idp");if(a===null){throw new Error("Access Token validation preparation - Could not find in sessionDatabase: idp")}const c=await e.getItem("jwks_uri");if(c===null){throw new Error("Access Token validation preparation - Could not find in sessionDatabase: jwks_uri")}const l=wi(new URL(c));const{payload:d}=await Vn(o,l,{issuer:a,audience:"solid"});const h=await ii(await In(i.publicKey));if(d["cnf"]["jkt"]!==h){throw new Error("Access Token validation failed on `jkt`: jkt !== DPoP thumbprint - "+d["cnf"]["jkt"]+" !== "+h)}if(d["client_id"]!==t){throw new Error("Access Token validation failed on `client_id`: JWT payload !== client_id - "+d["client_id"]+" !== "+t)}await e.setItem("refresh_token",r["refresh_token"]);return{...r,dpop_key_pair:i}}finally{e.close()}};const Ii=async(e,t,n,i)=>{const s=await In(i.publicKey);s.alg="ES256";const r=await new ti({htu:n,htm:"POST"}).setIssuedAt().setJti(self.crypto.randomUUID()).setProtectedHeader({alg:"ES256",typ:"dpop+jwt",jwk:s}).sign(i.privateKey);return fetch(n,{method:"POST",headers:{dpop:r,"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:e,client_id:t})})};class Pi{isActive_=false;exp_;webId_=undefined;currentAth_=undefined;onSessionStateChange;information;database;refreshPromise;resolveRefresh;rejectRefresh;constructor(e,t){this.information={clientDetails:e};this.database=t?.database;this.onSessionStateChange=t?.onSessionStateChange}async login(e,t){await Ei(e,t,this.information.clientDetails)}async handleRedirectFromLogin(){const e=await Ti(this.information.clientDetails,this.database);if(!e.tokenDetails)return;this.information.clientDetails=e.clientDetails;this.information.idpDetails=e.idpDetails;await this.setTokenDetails(e.tokenDetails);this.onSessionStateChange?.()}async restore(){if(!this.database){throw new Error("Could not refresh tokens: missing database. Provide database in sessionOption.")}if(this.refreshPromise){return this.refreshPromise}this.refreshPromise=new Promise(((e,t)=>{this.resolveRefresh=e;this.rejectRefresh=t}));const e=this.isActive;Ri(this.database).then((e=>this.setTokenDetails(e))).then((()=>this.resolveRefresh())).catch((e=>{if(this.isActive){this.rejectRefresh(new Error(e||"Token refresh failed"))}else{this.rejectRefresh(new Error("No session to restore."))}})).finally((()=>{this.clearRefreshPromise();if(e!==this.isActive)this.onSessionStateChange?.()}));return this.refreshPromise}async logout(){this.isActive_=false;this.exp_=undefined;this.webId_=undefined;this.currentAth_=undefined;this.information.idpDetails=undefined;this.information.tokenDetails=undefined;if(this.refreshPromise&&this.rejectRefresh){this.rejectRefresh(new Error("Logout during token refresh."));this.clearRefreshPromise()}if(this.database){await this.database.init();await this.database.clear();this.database.close()}this.onSessionStateChange?.()}async authFetch(e,t,n){if(!this.isActive){return fetch(e,t)}let i;let s;let r;if(e instanceof Request){i=new URL(e.url);s=t?.method||e?.method||"GET";r=new Headers(e.headers)}else{t=t||{};i=new URL(e.toString());s=t.method||"GET";r=t.headers?new Headers(t.headers):new Headers}await this._renewTokensIfExpired();n=n??{htu:`${i.origin}${i.pathname}`,htm:s.toUpperCase()};const o=await this._createSignedDPoPToken(n);r.set("dpop",o);r.set("authorization",`DPoP ${this.information.tokenDetails.access_token}`);if(e instanceof Request){return fetch(new Request(e,{...t,headers:r}))}return fetch(i,{...t,headers:r})}async setTokenDetails(e){this.information.tokenDetails=e;await this._updateSessionDetailsFromToken(e.access_token)}clearRefreshPromise(){this.refreshPromise=undefined;this.resolveRefresh=undefined;this.rejectRefresh=undefined}get isActive(){return this.isActive_}get webId(){return this.webId_}getExpiresIn(){return this.information.tokenDetails?.expires_in??-1}isExpired(){if(!this.exp_)return true;return this._isTokenExpired(this.exp_)}getTokenDetails(){return this.information.tokenDetails}async _renewTokensIfExpired(){if(this.isExpired()){if(!this.refreshPromise){await this.restore()}else{await this.refreshPromise}}}async _computeAth(e){const t=new TextEncoder;const n=t.encode(e);const i=await crypto.subtle.digest("SHA-256",n);const s=Array.from(new Uint8Array(i));const r=btoa(String.fromCharCode(...s));const o=r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return o}async _createSignedDPoPToken(e){if(!this.information.tokenDetails||!this.currentAth_){throw new Error("Session not established.")}e.ath=this.currentAth_;const t=await In(this.information.tokenDetails.dpop_key_pair.publicKey);return new ti(e).setIssuedAt().setJti(window.crypto.randomUUID()).setProtectedHeader({alg:"ES256",typ:"dpop+jwt",jwk:t}).sign(this.information.tokenDetails.dpop_key_pair.privateKey)}async _updateSessionDetailsFromToken(e){if(!e){await this.logout();return}try{const t=vi(e);const n=t.webid;if(!n){throw new Error("Missing webid claim in access token")}const i=t.exp;if(!i){throw new Error("Missing exp claim in access token")}this.currentAth_=await this._computeAth(e);this.webId_=n;this.exp_=i;this.isActive_=true}catch(e){await this.logout()}}_isTokenExpired(e,t=0){if(typeof e!=="number"||isNaN(e)){return true}const n=Math.floor(Date.now()/1e3);return e<n+t}}const zi=()=>new URL("./RefreshWorker.js",import.meta.url);class $i{dbName;storeName;dbVersion;db=null;constructor(e="soidc",t="session",n=1){this.dbName=e;this.storeName=t;this.dbVersion=n}async init(){return new Promise(((e,t)=>{const n=indexedDB.open(this.dbName,this.dbVersion);n.onerror=e=>{t(new Error(`Database error: ${e.target.error}`))};n.onsuccess=t=>{this.db=t.target.result;e(this)};n.onupgradeneeded=e=>{const t=e.target.result;if(!t.objectStoreNames.contains(this.storeName)){t.createObjectStore(this.storeName)}}}))}async setItem(e,t){if(!this.db){await this.init()}return new Promise(((n,i)=>{const s=this.db.transaction(this.storeName,"readwrite");s.oncomplete=()=>{n()};s.onerror=t=>{i(new Error(`Transaction error for setItem(${e},...): ${t.target.error}`))};s.onabort=t=>{i(new Error(`Transaction aborted for setItem(${e},...): ${t.target.error}`))};const r=s.objectStore(this.storeName);r.put(t,e)}))}async getItem(e){if(!this.db){await this.init()}return new Promise(((t,n)=>{const i=this.db.transaction(this.storeName,"readonly");i.onerror=t=>{n(new Error(`Transaction error for getItem(${e}): ${t.target.error}`))};i.onabort=t=>{n(new Error(`Transaction aborted for getItem(${e}): ${t.target.error}`))};const s=i.objectStore(this.storeName);const r=s.get(e);r.onsuccess=()=>{t(r.result||null)}}))}async deleteItem(e){if(!this.db){await this.init()}return new Promise(((t,n)=>{const i=this.db.transaction(this.storeName,"readwrite");i.oncomplete=()=>{t()};i.onerror=t=>{n(new Error(`Transaction error for deleteItem(${e}): ${t.target.error}`))};i.onabort=t=>{n(new Error(`Transaction aborted for deleteItem(${e}): ${t.target.error}`))};const s=i.objectStore(this.storeName);s.delete(e)}))}async clear(){if(!this.db){await this.init()}return new Promise(((e,t)=>{const n=this.db.transaction(this.storeName,"readwrite");n.oncomplete=()=>{e()};n.onerror=e=>{t(new Error(`Transaction error for clear(): ${e.target.error}`))};n.onabort=e=>{t(new Error(`Transaction aborted for clear(): ${e.target.error}`))};const i=n.objectStore(this.storeName);i.clear()}))}close(){if(this.db){this.db.close();this.db=null}}}var Di;(function(e){e["SCHEDULE"]="SCHEDULE";e["REFRESH"]="REFRESH";e["STOP"]="STOP";e["DISCONNECT"]="DISCONNECT";e["TOKEN_DETAILS"]="TOKEN_DETAILS";e["ERROR_ON_REFRESH"]="ERROR_ON_REFRESH";e["EXPIRED"]="EXPIRED"})(Di||(Di={}));const Wi=new Set;const Oi=e=>{for(const t of Wi){t.postMessage(e)}};let Li;self.onconnect=e=>{const t=e.ports[0];Wi.add(t);if(!Li){Li=new ji(Oi,new $i)}t.onmessage=e=>{const{type:n,payload:i}=e.data;switch(n){case Di.SCHEDULE:Li.handleSchedule(i);break;case Di.REFRESH:Li.handleRefresh(t);break;case Di.STOP:Li.handleStop();break;case Di.DISCONNECT:Wi.delete(t);break}};t.onmessageerror=()=>Wi.delete(t);t.start()};class ji{tokenDetails;exp;refreshTimeout;finalLogoutTimeout;timersAreRunning=false;broadcast;database;refreshPromise;constructor(e,t){this.broadcast=e;this.database=t}async handleSchedule(e){this.tokenDetails=e;this.exp=vi(this.tokenDetails.access_token).exp;this.broadcast({type:Di.TOKEN_DETAILS,payload:{tokenDetails:this.tokenDetails}});console.log(`[RefreshWorker] Scheduling timers, expiry in ${this.tokenDetails.expires_in}s`);this.scheduleTimers(this.tokenDetails.expires_in);this.timersAreRunning=true}async handleRefresh(e){if(this.tokenDetails&&this.exp&&!this.isTokenExpired(this.exp)){console.log(`[RefreshWorker] Providing current tokens`);e.postMessage({type:Di.TOKEN_DETAILS,payload:{tokenDetails:this.tokenDetails}})}else{console.log(`[RefreshWorker] Refreshing tokens`);this.performRefresh()}}handleStop(){if(!this.tokenDetails){console.log("[RefreshWorker] Received STOP, being idle");return}this.broadcast({type:Di.EXPIRED});this.tokenDetails=undefined;this.exp=undefined;this.refreshPromise=undefined;console.log("[RefreshWorker] Received STOP, clearing timers");this.clearAllTimers()}async performRefresh(){if(this.refreshPromise){console.log("[RefreshWorker] Refresh already in progress, waiting...");return this.refreshPromise}this.refreshPromise=this.doRefresh();return this.refreshPromise}async doRefresh(){try{this.tokenDetails=await Ri(this.database);this.exp=vi(this.tokenDetails.access_token).exp;this.broadcast({type:Di.TOKEN_DETAILS,payload:{tokenDetails:this.tokenDetails}});console.log(`[RefreshWorker] Token refreshed`);console.log(`[RefreshWorker] Scheduling timers, expiry in ${this.tokenDetails.expires_in}s`);this.scheduleTimers(this.tokenDetails.expires_in)}catch(e){this.broadcast({type:Di.ERROR_ON_REFRESH,error:e.message});console.log(`[RefreshWorker]`,e.message)}finally{this.refreshPromise=undefined}}clearAllTimers(){if(this.refreshTimeout)clearTimeout(this.refreshTimeout);if(this.finalLogoutTimeout)clearTimeout(this.finalLogoutTimeout);this.timersAreRunning=false}scheduleTimers(e){this.clearAllTimers();this.timersAreRunning=true;const t=e*1e3;const n=.8;const i=30*1e3;const s=n*t;if(s>i){this.refreshTimeout=setTimeout((()=>this.performRefresh()),s)}const r=5*1e3;const o=t-r;this.finalLogoutTimeout=setTimeout((()=>{this.tokenDetails=undefined;this.broadcast({type:Di.EXPIRED})}),o)}isTokenExpired(e,t=0){if(typeof e!=="number"||isNaN(e)){return true}const n=Math.floor(Date.now()/1e3);return e<n+t}setTokenDetails(e){this.tokenDetails=e}getTimersAreRunning(){return this.timersAreRunning}getTokenDetails(){return this.tokenDetails}}class Ui extends Pi{worker;onSessionExpirationWarning;onSessionExpiration;constructor(e,t){const n=new $i;const i={...t,database:n};super(e,i);this.onSessionExpirationWarning=t?.onSessionExpirationWarning;this.onSessionExpiration=t?.onSessionExpiration;const s=t?.workerUrl??zi();this.worker=new SharedWorker(s,{type:"module"});this.worker.port.onmessage=e=>{this.handleWorkerMessage(e.data).catch(console.error)};window.addEventListener("beforeunload",(()=>{this.worker.port.postMessage({type:Di.DISCONNECT})}))}async handleWorkerMessage(e){const{type:t,payload:n,error:i}=e;switch(t){case Di.TOKEN_DETAILS:const e=this.isActive;await this.setTokenDetails(n.tokenDetails);if(e!==this.isActive)this.onSessionStateChange?.();if(this.refreshPromise&&this.resolveRefresh){this.resolveRefresh();this.clearRefreshPromise()}break;case Di.ERROR_ON_REFRESH:if(this.isActive)this.onSessionExpirationWarning?.();if(this.refreshPromise&&this.rejectRefresh){if(this.isActive){this.rejectRefresh(new Error(i||"Token refresh failed"))}else{this.rejectRefresh(new Error("No session to restore"))}this.clearRefreshPromise()}break;case Di.EXPIRED:if(this.isActive){this.onSessionExpiration?.();await this.logout()}if(this.refreshPromise&&this.rejectRefresh){this.rejectRefresh(new Error(i||"Token refresh failed"));this.clearRefreshPromise()}break}}async handleRedirectFromLogin(){await super.handleRedirectFromLogin();if(this.isActive){this.worker.port.postMessage({type:Di.SCHEDULE,payload:this.getTokenDetails()})}}async restore(){if(this.refreshPromise){return this.refreshPromise}this.refreshPromise=new Promise(((e,t)=>{this.resolveRefresh=e;this.rejectRefresh=t}));this.worker.port.postMessage({type:Di.REFRESH});return this.refreshPromise}async logout(){this.worker.port.postMessage({type:Di.STOP});await super.logout()}}class Ji{get authenticatedFetch(){return this._authenticatedFetch}constructor(){this.onSessionRestoreCallback=()=>{};this.sessionInfo$=new ft({isLoggedIn:false,webId:undefined});this.session=new Ui;this._authenticatedFetch=this.session.authFetch.bind(this.session)}async handleIncomingRedirect(e=false){await this.session.handleRedirectFromLogin();if(e){await this.session.restore();if(this.session.isActive){this.onSessionRestoreCallback(window.location.href)}}this.sessionInfo$.next({isLoggedIn:this.session.isActive,webId:this.session.webId})}async login(e){return this.session.login(e,window.location.href)}async logout(){await this.session.logout();this.sessionInfo$.next({isLoggedIn:false,webId:undefined})}observeSession(){return this.sessionInfo$}onSessionRestore(e){this.onSessionRestoreCallback=e}}const Ki=class{constructor(e){t(this,e);this.sessionRestoredEmitter=r(this,"pod-os:session-restored",7);this.podOsLoadedEmitter=r(this,"pod-os:loaded",7);this.restorePreviousSession=false;this.disconnected$=new y;this.loading=true}async componentWillLoad(){const e=new Ji;this.unsubscribeSettings=$e.on("set",(()=>{this.os=ut(e,$e.state)}));this.os=ut(e,$e.state);e.onSessionRestore((e=>{this.sessionRestoredEmitter.emit({url:e})}));try{await e.handleIncomingRedirect(this.restorePreviousSession)}catch(e){console.error(e)}this.os.observeSession().pipe(v(this.disconnected$)).subscribe((async e=>{p.state.webId=e.webId;if(e.isLoggedIn){const t=await this.os.fetchProfile(e.webId);p.state.profile=t}p.state.isLoggedIn=e.isLoggedIn;this.loading=false}));this.podOsLoadedEmitter.emit({os:this.os,authenticatedFetch:e.authenticatedFetch})}disconnectedCallback(){this.unsubscribeSettings();this.disconnected$.next();this.disconnected$.unsubscribe()}async initializeOs(e){e.stopPropagation();e.detail(this.os)}async loadModule(e){e.stopPropagation();if(e.detail.module==="contacts"){const t=await this.os.loadContactsModule();e.detail.receiver(t)}else{throw Error(`Unknown module "${e.detail.module}"`)}}render(){return this.loading?n("ion-progress-bar",{type:"indeterminate"}):n("slot",null)}};const Hi="pos-router {\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n\npos-navigation {\n max-width: var(--width-lg);\n margin: 0;\n min-width: var(--size-32);\n flex-shrink: 1; /* Ensure navigation can shrink */\n}\n\npos-add-new-thing,\npos-login {\n flex: 0 1 auto;\n flex-shrink: 0; /* Ensure those items don't shrink */\n}\n\nheader,\nfooter {\n display: flex;\n gap: var(--size-1);\n height: auto;\n justify-content: center;\n align-items: center;\n padding: var(--size-1);\n}\n\nfooter svg {\n width: var(--size-5);\n height: var(--size-5);\n}\n\nfooter {\n font-size: var(--scale-fluid-000);\n\n .settings {\n padding: 0 var(--size-1);\n text-decoration: none;\n background-color: var(--pos-background-color);\n border: 1px solid var(--pos-secondary-border-color);\n color: var(--pos-secondary-border-color);\n border-radius: var(--radius-xs);\n\n &:hover {\n background-color: var(--pos-secondary-border-color);\n color: var(--pos-background-color);\n }\n }\n}\n\nheader {\n flex-wrap: nowrap;\n padding: var(--size-1) var(--size-8);\n}\n\nmain {\n flex: 1;\n max-height: 100vh;\n overflow: auto;\n}\n\n@media (max-width: 640px) {\n header {\n padding: var(--size-1);\n justify-content: space-between;\n }\n footer {\n display: none;\n }\n}\n";const Ni=Hi;const Mi=class{constructor(e){t(this,e);this.restorePreviousSession=false;this.mode="standalone";this.uri=""}render(){return n(i,{key:"08b186d2f354d6c07df02707eb4ada81aef7dec3"},n("pos-app",{key:"54c372343e916ab5d77584381b3965c925ae0cd0",restorePreviousSession:this.restorePreviousSession},n("pos-error-toast",{key:"ab63e18121ca16670f81da141219a782dde0694b"},n("pos-router",{key:"69b6f3bf8ce3720c6c39cdb4be69e640e27ccc5b",mode:this.mode,"onPod-os:route-changed":e=>this.uri=e.detail},n("header",{key:"5cd3412caf13b6d99da517ae7e6f5877234e65d7"},n("pos-add-new-thing",{key:"9b83b3cf03b7038303975386176df539b35ff547",referenceUri:this.uri}),n("pos-navigation",{key:"26bfed9b1c8dd1be018babc6ef40ae42808a5c42",uri:this.uri==="pod-os:dashboard"?"":this.uri}),n("pos-login",{key:"e29f18dcde866d8ac1e317fcd7b71ef584e69034"},n("pos-user-menu",{key:"be796f0914649eb4e8525a9d8acdfd535626303c",webId:p.state.webId,slot:"if-logged-in"}))),n("main",{key:"f99dfb2d43e949528bc767b94801c99bf04a7eea"},this.mainContent()),n("footer",{key:"64744d1246356fa00da9c6b561785e2b794a7907"},n(Bi,{key:"a648f7f88e12c79348bda33152f2759d2b93e738"}),n("span",{key:"f22e2f9904ba517fc2e579a05018704b5ade6302"},"PodOS Browser"))))))}mainContent(){if(this.uri===""){return null}if(this.uri.startsWith("pod-os:")){return n("pos-internal-router",{uri:this.uri})}return n("pos-resource",{key:this.uri,uri:this.uri},n("pos-type-router",null))}};const Bi=()=>n("svg",{viewBox:"0 0 400 400",xmlns:"http://www.w3.org/2000/svg"},n("path",{d:"M50 350 L50 100 L200 50 L350 100 L350 350 Z",style:{fill:"#008BF8",stroke:"#008BF8","stroke-width":"70"},"stroke-linejoin":"round"}),n("path",{d:"M100 300 L100 150 L200 120 L300 150 L300 300 L130 300 L130 370 L100 370Z",style:{fill:"white",stroke:"white","stroke-width":"45"},"stroke-linejoin":"round"}),n("path",{d:"M150 250 L150 200 L200 180 L250 200 L250 250 Z",style:{fill:"#DC0073",stroke:"#DC0073","stroke-width":"20"},"stroke-linejoin":"round"}));Mi.style=Ni;const Xi=":host{display:grid;grid-template-columns:repeat(auto-fit, minmax(var(--size-12), var(--size-96)));gap:var(--size-4);padding:var(--size-2);justify-content:center;align-items:start;justify-items:stretch}";const Fi=Xi;const Vi=class{constructor(e){t(this,e)}render(){return n(i,{key:"18dc165b7be1c796136804a2ba7643b2a6fffc73"},n("pos-getting-started",{key:"e3f7a22641e4c24168a36f96463515cd1a89ca5e"}),n("pos-example-resources",{key:"1044dd873049118e165ff6d38449c85695f63a50"}))}};Vi.style=Fi;const qi=":host{display:grid;grid-template-columns:repeat(auto-fit, minmax(var(--size-12), var(--size-96)));gap:var(--size-4);padding:var(--size-2);justify-content:center;align-items:start;justify-items:stretch}";const Gi=qi;const Yi=class{constructor(e){t(this,e)}render(){return n("pos-setting-offline-cache",{key:"f065206f6291089773a19045243f04b6ce35eeb9"})}};Yi.style=Gi;const Zi=class{constructor(e){t(this,e);this.subscribeResource=r(this,"pod-os:resource",7);this.receiveResource=e=>{this.resource=e}}componentWillLoad(){x(this)}render(){return this.resource?this.resource.description():null}};const Qi="dialog{background-color:var(--pos-background-color);color:var(--pos-normal-text-color);border:none;border-radius:var(--radius-md);box-shadow:var(--shadow-md);max-width:var(--width-xs);animation:slideIn 0.2s ease-out}dialog::backdrop{background:rgba(0, 0, 0, 0.5);backdrop-filter:var(--blur-sm);animation:fadeIn 0.2s ease-out}@media (prefers-color-scheme: dark){dialog::backdrop{background:rgb(100, 100, 100, 0.5)}}dialog header>:first-child{flex-grow:1;font-weight:var(--weight-light);font-size:var(--scale-2);font-family:var(--font-sans);margin:0}dialog header{display:flex;flex-direction:row;justify-content:space-between;align-items:center;gap:var(--scale-0);border-bottom-style:inset;padding:0 0 var(--scale-0) 0}dialog>:last-child{display:block;margin-top:var(--scale-3)}button#close{cursor:pointer;display:flex;align-items:center;justify-content:center;border:none;background:none;font-size:var(--scale-3);color:var(--color-grey-500)}button#close:hover{color:var(--pos-secondary-border-color)}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes slideIn{from{opacity:0;transform:translateY(-20px) scale(0.95)}to{opacity:1;transform:translateY(0) scale(1)}}";const es=Qi;const ts=class{constructor(e){t(this,e)}async showModal(){this.dialog.showModal()}async close(){this.dialog.close()}render(){return n(i,{key:"42ee67fc5636f2c5d1a44613d0c39b0e98112a79"},n("dialog",{key:"e05b18b7ed8cae7ac010ecdcb3f58367f742fe77",ref:e=>this.dialog=e},n("header",{key:"4e3b2a6c0fc069c425d8bc9dcedee4e7f5c95c01"},n("slot",{key:"7617853cebf80d86469956af01761970fa68aa7b",name:"title"}),n("button",{key:"c6858cb4b90ab1cef16adb77a148aa2bec405cf7",tabindex:-1,id:"close",title:"Close",onClick:()=>this.close()},n("ion-icon",{key:"58737ce0aac7b5047557b81c15daed713490a5ce",name:"close-outline"}))),n("slot",{key:"868baba59e97e691735759af250cffed8766c913",name:"content"})))}};ts.style=es;var ns=e=>{var t;const{activeElement:n}=document;if(n&&e.contains(n)){(t=document.activeElement)==null?void 0:t.blur()}};var is=S`
1
+ import{d as e,r as t,h as n,H as i,e as r,f as s,i as o,j as a}from"./p-99602d8c.js";import{c}from"./p-4ab8d4da.js";import{c as l,h as d}from"./p-669fab6c.js";import{c as h,g as u}from"./p-9ff1da1c.js";import{c as f,s as p,B as b}from"./p-3d182668.js";import{P as m,N as g,L as w}from"./p-a004ecd1.js";import{S as v,t as y,d as k}from"./p-5cade8cd.js";import{s as x}from"./p-f6671856.js";import{i as S,x as _,E,c as A,S as C,_ as T,a as I,r as z,n as $,w as R,b as P,f as D}from"./p-9be91e78.js";import{e as W,a as O,s as L,L as j,b as U,g as J,c as K,w as H,S as N,i as M,t as B,d as X}from"./p-50aca1ca.js";import{s as F}from"./p-182f722d.js";import"./p-c066fd50.js";let V;const q=()=>{if(typeof window==="undefined"){return new Map}else{if(!V){const e=window;e.Ionicons=e.Ionicons||{};V=e.Ionicons.map=e.Ionicons.map||new Map}return V}};const G=e=>{let t=Q(e.src);if(t){return t}t=Z(e.name,e.icon,e.mode,e.ios,e.md);if(t){return Y(t,e)}if(e.icon){t=Q(e.icon);if(t){return t}t=Q(e.icon[e.mode]);if(t){return t}}return null};const Y=(t,n)=>{const i=q().get(t);if(i){return i}try{return e(`svg/${t}.svg`)}catch(e){console.warn(`[Ionicons Warning]: Could not load icon with name "${t}". Ensure that the icon is registered using addIcons or that the icon SVG data is passed directly to the icon component.`,n)}};const Z=(e,t,n,i,r)=>{n=(n&&ne(n))==="ios"?"ios":"md";if(i&&n==="ios"){e=ne(i)}else if(r&&n==="md"){e=ne(r)}else{if(!e&&t&&!ee(t)){e=t}if(te(e)){e=ne(e)}}if(!te(e)||e.trim()===""){return null}const s=e.replace(/[a-z]|-|\d/gi,"");if(s!==""){return null}return e};const Q=e=>{if(te(e)){e=e.trim();if(ee(e)){return e}}return null};const ee=e=>e.length>0&&/(\/|\.)/.test(e);const te=e=>typeof e==="string";const ne=e=>e.toLowerCase();const ie=(e,t=[])=>{const n={};t.forEach((t=>{if(e.hasAttribute(t)){const i=e.getAttribute(t);if(i!==null){n[t]=e.getAttribute(t)}e.removeAttribute(t)}}));return n};const re=e=>{if(e){if(e.dir!==""){return e.dir.toLowerCase()==="rtl"}}return(document===null||document===void 0?void 0:document.dir.toLowerCase())==="rtl"};const se=e=>{const t=document.createElement("div");t.innerHTML=e;for(let e=t.childNodes.length-1;e>=0;e--){if(t.childNodes[e].nodeName.toLowerCase()!=="svg"){t.removeChild(t.childNodes[e])}}const n=t.firstElementChild;if(n&&n.nodeName.toLowerCase()==="svg"){const e=n.getAttribute("class")||"";n.setAttribute("class",(e+" s-ion-icon").trim());if(oe(n)){return t.innerHTML}}return""};const oe=e=>{if(e.nodeType===1){if(e.nodeName.toLowerCase()==="script"){return false}for(let t=0;t<e.attributes.length;t++){const n=e.attributes[t].name;if(te(n)&&n.toLowerCase().indexOf("on")===0){return false}}for(let t=0;t<e.childNodes.length;t++){if(!oe(e.childNodes[t])){return false}}}return true};const ae=e=>e.startsWith("data:image/svg+xml");const ce=e=>e.indexOf(";utf8,")!==-1;const le=new Map;const de=new Map;let he;const ue=(e,t)=>{let n=de.get(e);if(!n){if(typeof fetch!=="undefined"&&typeof document!=="undefined"){if(ae(e)&&ce(e)){if(!he){he=new DOMParser}const t=he.parseFromString(e,"text/html");const n=t.querySelector("svg");if(n){le.set(e,n.outerHTML)}return Promise.resolve()}else{n=fetch(e).then((n=>{if(n.ok){return n.text().then((n=>{if(n&&t!==false){n=se(n)}le.set(e,n||"")}))}le.set(e,"")}));de.set(e,n)}}else{le.set(e,"");return Promise.resolve()}}return n};const fe=":host{display:inline-block;width:1em;height:1em;contain:strict;fill:currentColor;box-sizing:content-box !important}:host .ionicon{stroke:currentColor}.ionicon-fill-none{fill:none}.ionicon-stroke-width{stroke-width:32px;stroke-width:var(--ionicon-stroke-width, 32px)}.icon-inner,.ionicon,svg{display:block;height:100%;width:100%}@supports (background: -webkit-named-image(i)){:host(.icon-rtl) .icon-inner{transform:scaleX(-1)}}@supports not selector(:dir(rtl)) and selector(:host-context([dir='rtl'])){:host(.icon-rtl) .icon-inner{transform:scaleX(-1)}}:host(.flip-rtl):host-context([dir='rtl']) .icon-inner{transform:scaleX(-1)}@supports selector(:dir(rtl)){:host(.flip-rtl:dir(rtl)) .icon-inner{transform:scaleX(-1)}:host(.flip-rtl:dir(ltr)) .icon-inner{transform:scaleX(1)}}:host(.icon-small){font-size:1.125rem !important}:host(.icon-large){font-size:2rem !important}:host(.ion-color){color:var(--ion-color-base) !important}:host(.ion-color-primary){--ion-color-base:var(--ion-color-primary, #3880ff)}:host(.ion-color-secondary){--ion-color-base:var(--ion-color-secondary, #0cd1e8)}:host(.ion-color-tertiary){--ion-color-base:var(--ion-color-tertiary, #f4a942)}:host(.ion-color-success){--ion-color-base:var(--ion-color-success, #10dc60)}:host(.ion-color-warning){--ion-color-base:var(--ion-color-warning, #ffce00)}:host(.ion-color-danger){--ion-color-base:var(--ion-color-danger, #f14141)}:host(.ion-color-light){--ion-color-base:var(--ion-color-light, #f4f5f8)}:host(.ion-color-medium){--ion-color-base:var(--ion-color-medium, #989aa2)}:host(.ion-color-dark){--ion-color-base:var(--ion-color-dark, #222428)}";const pe=fe;const be=class{constructor(e){t(this,e);this.iconName=null;this.inheritedAttributes={};this.didLoadIcon=false;this.svgContent=undefined;this.isVisible=false;this.mode=me();this.color=undefined;this.ios=undefined;this.md=undefined;this.flipRtl=undefined;this.name=undefined;this.src=undefined;this.icon=undefined;this.size=undefined;this.lazy=false;this.sanitize=true}componentWillLoad(){this.inheritedAttributes=ie(this.el,["aria-label"])}connectedCallback(){this.waitUntilVisible(this.el,"50px",(()=>{this.isVisible=true;this.loadIcon()}))}componentDidLoad(){if(!this.didLoadIcon){this.loadIcon()}}disconnectedCallback(){if(this.io){this.io.disconnect();this.io=undefined}}waitUntilVisible(e,t,n){if(this.lazy&&typeof window!=="undefined"&&window.IntersectionObserver){const i=this.io=new window.IntersectionObserver((e=>{if(e[0].isIntersecting){i.disconnect();this.io=undefined;n()}}),{rootMargin:t});i.observe(e)}else{n()}}loadIcon(){if(this.isVisible){const e=G(this);if(e){if(le.has(e)){this.svgContent=le.get(e)}else{ue(e,this.sanitize).then((()=>this.svgContent=le.get(e)))}this.didLoadIcon=true}}this.iconName=Z(this.name,this.icon,this.mode,this.ios,this.md)}render(){const{flipRtl:e,iconName:t,inheritedAttributes:r,el:s}=this;const o=this.mode||"md";const a=t?(t.includes("arrow")||t.includes("chevron"))&&e!==false:false;const c=e||a;return n(i,Object.assign({role:"img",class:Object.assign(Object.assign({[o]:true},ge(this.color)),{[`icon-${this.size}`]:!!this.size,"flip-rtl":c,"icon-rtl":c&&re(s)})},r),this.svgContent?n("div",{class:"icon-inner",innerHTML:this.svgContent}):n("div",{class:"icon-inner"}))}static get assetsDirs(){return["svg"]}get el(){return r(this)}static get watchers(){return{name:["loadIcon"],src:["loadIcon"],icon:["loadIcon"],ios:["loadIcon"],md:["loadIcon"]}}};const me=()=>typeof document!=="undefined"&&document.documentElement.getAttribute("mode")||"md";const ge=e=>e?{"ion-color":true,[`ion-color-${e}`]:true}:null;be.style=pe;const we=":host{--background:rgba(var(--ion-color-primary-rgb, 56, 128, 255), 0.3);--progress-background:var(--ion-color-primary, #3880ff);--buffer-background:var(--background);display:block;position:relative;width:100%;contain:strict;direction:ltr;overflow:hidden}.progress,.progress-indeterminate,.indeterminate-bar-primary,.indeterminate-bar-secondary,.progress-buffer-bar{left:0;right:0;top:0;bottom:0;position:absolute;width:100%;height:100%}.buffer-circles-container,.buffer-circles{left:0;right:0;top:0;bottom:0;position:absolute}.buffer-circles{right:-10px;left:-10px;}.progress,.progress-buffer-bar,.buffer-circles-container{transform-origin:left top;transition:transform 150ms linear}.progress,.progress-indeterminate{background:var(--progress-background);z-index:2}.progress-buffer-bar{background:var(--buffer-background);z-index:1}.buffer-circles-container{overflow:hidden}.indeterminate-bar-primary{top:0;right:0;bottom:0;left:-145.166611%;animation:primary-indeterminate-translate 2s infinite linear}.indeterminate-bar-primary .progress-indeterminate{animation:primary-indeterminate-scale 2s infinite linear;animation-play-state:inherit}.indeterminate-bar-secondary{top:0;right:0;bottom:0;left:-54.888891%;animation:secondary-indeterminate-translate 2s infinite linear}.indeterminate-bar-secondary .progress-indeterminate{animation:secondary-indeterminate-scale 2s infinite linear;animation-play-state:inherit}.buffer-circles{background-image:radial-gradient(ellipse at center, var(--buffer-background) 0%, var(--buffer-background) 30%, transparent 30%);background-repeat:repeat-x;background-position:5px center;background-size:10px 10px;z-index:0;animation:buffering 450ms infinite linear}:host(.progress-bar-reversed){transform:scaleX(-1)}:host(.progress-paused) .indeterminate-bar-secondary,:host(.progress-paused) .indeterminate-bar-primary,:host(.progress-paused) .buffer-circles{animation-play-state:paused}:host(.ion-color) .progress-buffer-bar{background:rgba(var(--ion-color-base-rgb), 0.3)}:host(.ion-color) .buffer-circles{background-image:radial-gradient(ellipse at center, rgba(var(--ion-color-base-rgb), 0.3) 0%, rgba(var(--ion-color-base-rgb), 0.3) 30%, transparent 30%)}:host(.ion-color) .progress,:host(.ion-color) .progress-indeterminate{background:var(--ion-color-base)}@keyframes primary-indeterminate-translate{0%{transform:translateX(0)}20%{animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);transform:translateX(0)}59.15%{animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);transform:translateX(83.67142%)}100%{transform:translateX(200.611057%)}}@keyframes primary-indeterminate-scale{0%{transform:scaleX(0.08)}36.65%{animation-timing-function:cubic-bezier(0.334731, 0.12482, 0.785844, 1);transform:scaleX(0.08)}69.15%{animation-timing-function:cubic-bezier(0.06, 0.11, 0.6, 1);transform:scaleX(0.661479)}100%{transform:scaleX(0.08)}}@keyframes secondary-indeterminate-translate{0%{animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);transform:translateX(0)}25%{animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);transform:translateX(37.651913%)}48.35%{animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);transform:translateX(84.386165%)}100%{transform:translateX(160.277782%)}}@keyframes secondary-indeterminate-scale{0%{animation-timing-function:cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971);transform:scaleX(0.08)}19.15%{animation-timing-function:cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315);transform:scaleX(0.457104)}44.15%{animation-timing-function:cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179);transform:scaleX(0.72796)}100%{transform:scaleX(0.08)}}@keyframes buffering{to{transform:translateX(-10px)}}:host{height:3px}";const ve=we;const ye=":host{--background:rgba(var(--ion-color-primary-rgb, 56, 128, 255), 0.3);--progress-background:var(--ion-color-primary, #3880ff);--buffer-background:var(--background);display:block;position:relative;width:100%;contain:strict;direction:ltr;overflow:hidden}.progress,.progress-indeterminate,.indeterminate-bar-primary,.indeterminate-bar-secondary,.progress-buffer-bar{left:0;right:0;top:0;bottom:0;position:absolute;width:100%;height:100%}.buffer-circles-container,.buffer-circles{left:0;right:0;top:0;bottom:0;position:absolute}.buffer-circles{right:-10px;left:-10px;}.progress,.progress-buffer-bar,.buffer-circles-container{transform-origin:left top;transition:transform 150ms linear}.progress,.progress-indeterminate{background:var(--progress-background);z-index:2}.progress-buffer-bar{background:var(--buffer-background);z-index:1}.buffer-circles-container{overflow:hidden}.indeterminate-bar-primary{top:0;right:0;bottom:0;left:-145.166611%;animation:primary-indeterminate-translate 2s infinite linear}.indeterminate-bar-primary .progress-indeterminate{animation:primary-indeterminate-scale 2s infinite linear;animation-play-state:inherit}.indeterminate-bar-secondary{top:0;right:0;bottom:0;left:-54.888891%;animation:secondary-indeterminate-translate 2s infinite linear}.indeterminate-bar-secondary .progress-indeterminate{animation:secondary-indeterminate-scale 2s infinite linear;animation-play-state:inherit}.buffer-circles{background-image:radial-gradient(ellipse at center, var(--buffer-background) 0%, var(--buffer-background) 30%, transparent 30%);background-repeat:repeat-x;background-position:5px center;background-size:10px 10px;z-index:0;animation:buffering 450ms infinite linear}:host(.progress-bar-reversed){transform:scaleX(-1)}:host(.progress-paused) .indeterminate-bar-secondary,:host(.progress-paused) .indeterminate-bar-primary,:host(.progress-paused) .buffer-circles{animation-play-state:paused}:host(.ion-color) .progress-buffer-bar{background:rgba(var(--ion-color-base-rgb), 0.3)}:host(.ion-color) .buffer-circles{background-image:radial-gradient(ellipse at center, rgba(var(--ion-color-base-rgb), 0.3) 0%, rgba(var(--ion-color-base-rgb), 0.3) 30%, transparent 30%)}:host(.ion-color) .progress,:host(.ion-color) .progress-indeterminate{background:var(--ion-color-base)}@keyframes primary-indeterminate-translate{0%{transform:translateX(0)}20%{animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);transform:translateX(0)}59.15%{animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);transform:translateX(83.67142%)}100%{transform:translateX(200.611057%)}}@keyframes primary-indeterminate-scale{0%{transform:scaleX(0.08)}36.65%{animation-timing-function:cubic-bezier(0.334731, 0.12482, 0.785844, 1);transform:scaleX(0.08)}69.15%{animation-timing-function:cubic-bezier(0.06, 0.11, 0.6, 1);transform:scaleX(0.661479)}100%{transform:scaleX(0.08)}}@keyframes secondary-indeterminate-translate{0%{animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);transform:translateX(0)}25%{animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);transform:translateX(37.651913%)}48.35%{animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);transform:translateX(84.386165%)}100%{transform:translateX(160.277782%)}}@keyframes secondary-indeterminate-scale{0%{animation-timing-function:cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971);transform:scaleX(0.08)}19.15%{animation-timing-function:cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315);transform:scaleX(0.457104)}44.15%{animation-timing-function:cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179);transform:scaleX(0.72796)}100%{transform:scaleX(0.08)}}@keyframes buffering{to{transform:translateX(-10px)}}:host{height:4px}";const ke=ye;const xe=class{constructor(e){t(this,e);this.type="determinate";this.reversed=false;this.value=0;this.buffer=1;this.color=undefined}render(){const{color:e,type:t,reversed:r,value:s,buffer:o}=this;const a=h.getBoolean("_testing");const c=u(this);return n(i,{key:"944b79ed6fce1b2c0ed48681cd8517a5abbddd80",role:"progressbar","aria-valuenow":t==="determinate"?s:null,"aria-valuemin":"0","aria-valuemax":"1",class:l(e,{[c]:true,[`progress-bar-${t}`]:true,"progress-paused":a,"progress-bar-reversed":document.dir==="rtl"?!r:r})},t==="indeterminate"?Se():_e(s,o))}};const Se=()=>n("div",{part:"track",class:"progress-buffer-bar"},n("div",{class:"indeterminate-bar-primary"},n("span",{part:"progress",class:"progress-indeterminate"})),n("div",{class:"indeterminate-bar-secondary"},n("span",{part:"progress",class:"progress-indeterminate"})));const _e=(e,t)=>{const i=c(0,e,1);const r=c(0,t,1);return[n("div",{part:"progress",class:"progress",style:{transform:`scaleX(${i})`}}),n("div",{class:{"buffer-circles-container":true,"ion-hide":r===1},style:{transform:`translateX(${r*100}%)`}},n("div",{class:"buffer-circles-container",style:{transform:`translateX(-${r*100}%)`}},n("div",{part:"stream",class:"buffer-circles"}))),n("div",{part:"track",class:"progress-buffer-bar",style:{transform:`scaleX(${r})`}})]};xe.style={ios:ve,md:ke};const Ee=":host{--background:rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.065);border-radius:var(--border-radius, inherit);display:block;width:100%;height:inherit;margin-top:4px;margin-bottom:4px;background:var(--background);line-height:10px;user-select:none;pointer-events:none}span{display:inline-block}:host(.in-media){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;height:100%}:host(.skeleton-text-animated){position:relative;background:linear-gradient(to right, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.065) 8%, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.135) 18%, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.065) 33%);background-size:800px 104px;animation-duration:1s;animation-fill-mode:forwards;animation-iteration-count:infinite;animation-name:shimmer;animation-timing-function:linear}@keyframes shimmer{0%{background-position:-400px 0}100%{background-position:400px 0}}";const Ae=Ee;const Ce=class{constructor(e){t(this,e);this.ionStyle=s(this,"ionStyle",7);this.animated=false}componentWillLoad(){this.emitStyle()}emitStyle(){const e={"skeleton-text":true};this.ionStyle.emit(e)}render(){const e=this.animated&&h.getBoolean("animated",true);const t=d("ion-avatar",this.el)||d("ion-thumbnail",this.el);const r=u(this);return n(i,{key:"4dab0fd2de666de12ad8f6dc6ed1e1de0be67ddd",class:{[r]:true,"skeleton-text-animated":e,"in-media":t}},n("span",{key:"f8f908ec24d65e63b14d9a54640a5f18f0fa8fa5"}," "))}get el(){return r(this)}};Ce.style=Ae;const Te=":host{font-family:var(--font-sans);display:block}button#new{cursor:pointer;display:flex;align-items:center;justify-content:center;border:none;width:var(--size-10);height:var(--size-10);background-color:var(--pos-primary-color);color:var(--pos-primary-text-color);font-size:var(--scale-6);border-radius:var(--radius-xs)}button#new:hover,button#new:focus{outline:none;filter:brightness(110%);box-shadow:var(--shadow-sm)}pos-new-thing-form{margin:var(--scale-3)}";const Ie=Te;const ze=class{constructor(e){t(this,e)}openDialog(){this.dialog.showModal()}render(){return n(i,{key:"6142a141ef03ca93a362a6b00ebe8d515c3a677a"},n("button",{key:"72ecf353cd3a7d2d68f9ef28eb1bbe7fdb88b700",id:"new",title:"Add a new thing",onClick:()=>this.openDialog()},n("ion-icon",{key:"bd05d75c42c10de6df519575787fc66eafb22930",name:"add-circle-outline"})),n("pos-dialog",{key:"23cf0118149704dfca16758970e4f4658e87e946",ref:e=>this.dialog=e},n("span",{key:"5af7b7f618cc20684c39134b5ea295400e651cb6",slot:"title"},"Add a new thing"),n("pos-new-thing-form",{key:"895496c2f6ede3c8677d9d918e0b13582090baed",slot:"content",referenceUri:this.referenceUri})))}};ze.style=Ie;const $e=localStorage.getItem("settings");const Re=$e?JSON.parse($e):{offlineCache:false};const Pe=f(Re);De();We();function De(){Pe.on("set",(()=>{const e=JSON.stringify(Pe.state);localStorage.setItem("settings",e)}))}function We(){window.addEventListener("storage",(e=>{if(e.key==="settings"&&e.newValue){const t=JSON.parse(e.newValue);Pe.state.offlineCache=t.offlineCache}}))}const Oe=(e,t)=>t.some((t=>e instanceof t));let Le;let je;function Ue(){return Le||(Le=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Je(){return je||(je=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Ke=new WeakMap;const He=new WeakMap;const Ne=new WeakMap;function Me(e){const t=new Promise(((t,n)=>{const i=()=>{e.removeEventListener("success",r);e.removeEventListener("error",s)};const r=()=>{t(Ge(e.result));i()};const s=()=>{n(e.error);i()};e.addEventListener("success",r);e.addEventListener("error",s)}));Ne.set(t,e);return t}function Be(e){if(Ke.has(e))return;const t=new Promise(((t,n)=>{const i=()=>{e.removeEventListener("complete",r);e.removeEventListener("error",s);e.removeEventListener("abort",s)};const r=()=>{t();i()};const s=()=>{n(e.error||new DOMException("AbortError","AbortError"));i()};e.addEventListener("complete",r);e.addEventListener("error",s);e.addEventListener("abort",s)}));Ke.set(e,t)}let Xe={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return Ke.get(e);if(t==="store"){return n.objectStoreNames[1]?undefined:n.objectStore(n.objectStoreNames[0])}}return Ge(e[t])},set(e,t,n){e[t]=n;return true},has(e,t){if(e instanceof IDBTransaction&&(t==="done"||t==="store")){return true}return t in e}};function Fe(e){Xe=e(Xe)}function Ve(e){if(Je().includes(e)){return function(...t){e.apply(Ye(this),t);return Ge(this.request)}}return function(...t){return Ge(e.apply(Ye(this),t))}}function qe(e){if(typeof e==="function")return Ve(e);if(e instanceof IDBTransaction)Be(e);if(Oe(e,Ue()))return new Proxy(e,Xe);return e}function Ge(e){if(e instanceof IDBRequest)return Me(e);if(He.has(e))return He.get(e);const t=qe(e);if(t!==e){He.set(e,t);Ne.set(t,e)}return t}const Ye=e=>Ne.get(e);function Ze(e,t,{blocked:n,upgrade:i,blocking:r,terminated:s}={}){const o=indexedDB.open(e,t);const a=Ge(o);if(i){o.addEventListener("upgradeneeded",(e=>{i(Ge(o.result),e.oldVersion,e.newVersion,Ge(o.transaction),e)}))}if(n){o.addEventListener("blocked",(e=>n(e.oldVersion,e.newVersion,e)))}a.then((e=>{if(s)e.addEventListener("close",(()=>s()));if(r){e.addEventListener("versionchange",(e=>r(e.oldVersion,e.newVersion,e)))}})).catch((()=>{}));return a}const Qe=["get","getKey","getAll","getAllKeys","count"];const et=["put","add","delete","clear"];const tt=new Map;function nt(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t==="string")){return}if(tt.get(t))return tt.get(t);const n=t.replace(/FromIndex$/,"");const i=t!==n;const r=et.includes(n);if(!(n in(i?IDBIndex:IDBObjectStore).prototype)||!(r||Qe.includes(n))){return}const s=async function(e,...t){const s=this.transaction(e,r?"readwrite":"readonly");let o=s.store;if(i)o=o.index(t.shift());return(await Promise.all([o[n](...t),r&&s.done]))[0]};tt.set(t,s);return s}Fe((e=>({...e,get:(t,n,i)=>nt(t,n)||e.get(t,n,i),has:(t,n)=>!!nt(t,n)||e.has(t,n)})));const it=["continue","continuePrimaryKey","advance"];const rt={};const st=new WeakMap;const ot=new WeakMap;const at={get(e,t){if(!it.includes(t))return e[t];let n=rt[t];if(!n){n=rt[t]=function(...e){st.set(this,ot.get(this)[t](...e))}}return n}};async function*ct(...e){let t=this;if(!(t instanceof IDBCursor)){t=await t.openCursor(...e)}if(!t)return;t=t;const n=new Proxy(t,at);ot.set(n,t);Ne.set(n,Ye(t));while(t){yield n;t=await(st.get(n)||t.continue());st.delete(n)}}function lt(e,t){return t===Symbol.asyncIterator&&Oe(e,[IDBIndex,IDBObjectStore,IDBCursor])||t==="iterate"&&Oe(e,[IDBIndex,IDBObjectStore])}Fe((e=>({...e,get(t,n,i){if(lt(t,n))return ct;return e.get(t,n,i)},has(t,n){return lt(t,n)||e.has(t,n)}})));class dt{constructor(){this.dbPromise=Ze("OfflineCacheDB",1,{upgrade(e){if(!e.objectStoreNames.contains("documents")){const t=e.createObjectStore("documents",{keyPath:"url"});t.createIndex("url-revision",["url","revision"])}}})}async clear(){const e=await this.dbPromise;return e.clear("documents")}async get(e){const t=await this.dbPromise;return await t.get("documents",e)}async put(e){const t=await this.dbPromise;const n=await t.getFromIndex("documents","url-revision",[e.url,e.revision]);if(n){return}await t.put("documents",e)}}class ht{isOnline(){return navigator.onLine}}const ut=(e,t)=>new m({session:e,offlineCache:t.offlineCache?new dt:new g,onlineStatus:new ht});class ft extends v{constructor(e){super();this._value=e}get value(){return this.getValue()}_subscribe(e){const t=super._subscribe(e);!t.closed&&e.next(this._value);return t}getValue(){const{hasError:e,thrownError:t,_value:n}=this;if(e){throw t}this._throwIfClosed();return n}next(e){super.next(this._value=e)}}var pt=crypto;const bt=e=>e instanceof CryptoKey;const mt=async(e,t)=>{const n=`SHA-${e.slice(-3)}`;return new Uint8Array(await pt.subtle.digest(n,t))};var gt=mt;const wt=new TextEncoder;const vt=new TextDecoder;function yt(...e){const t=e.reduce(((e,{length:t})=>e+t),0);const n=new Uint8Array(t);let i=0;for(const t of e){n.set(t,i);i+=t.length}return n}const kt=e=>{let t=e;if(typeof t==="string"){t=wt.encode(t)}const n=32768;const i=[];for(let e=0;e<t.length;e+=n){i.push(String.fromCharCode.apply(null,t.subarray(e,e+n)))}return btoa(i.join(""))};const xt=e=>kt(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_");const St=e=>{const t=atob(e);const n=new Uint8Array(t.length);for(let e=0;e<t.length;e++){n[e]=t.charCodeAt(e)}return n};const _t=e=>{let t=e;if(t instanceof Uint8Array){t=vt.decode(t)}t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return St(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}};class Et extends Error{constructor(e,t){super(e,t);this.code="ERR_JOSE_GENERIC";this.name=this.constructor.name;Error.captureStackTrace?.(this,this.constructor)}}Et.code="ERR_JOSE_GENERIC";class At extends Et{constructor(e,t,n="unspecified",i="unspecified"){super(e,{cause:{claim:n,reason:i,payload:t}});this.code="ERR_JWT_CLAIM_VALIDATION_FAILED";this.claim=n;this.reason=i;this.payload=t}}At.code="ERR_JWT_CLAIM_VALIDATION_FAILED";class Ct extends Et{constructor(e,t,n="unspecified",i="unspecified"){super(e,{cause:{claim:n,reason:i,payload:t}});this.code="ERR_JWT_EXPIRED";this.claim=n;this.reason=i;this.payload=t}}Ct.code="ERR_JWT_EXPIRED";class Tt extends Et{constructor(){super(...arguments);this.code="ERR_JOSE_ALG_NOT_ALLOWED"}}Tt.code="ERR_JOSE_ALG_NOT_ALLOWED";class It extends Et{constructor(){super(...arguments);this.code="ERR_JOSE_NOT_SUPPORTED"}}It.code="ERR_JOSE_NOT_SUPPORTED";class zt extends Et{constructor(e="decryption operation failed",t){super(e,t);this.code="ERR_JWE_DECRYPTION_FAILED"}}zt.code="ERR_JWE_DECRYPTION_FAILED";class $t extends Et{constructor(){super(...arguments);this.code="ERR_JWE_INVALID"}}$t.code="ERR_JWE_INVALID";class Rt extends Et{constructor(){super(...arguments);this.code="ERR_JWS_INVALID"}}Rt.code="ERR_JWS_INVALID";class Pt extends Et{constructor(){super(...arguments);this.code="ERR_JWT_INVALID"}}Pt.code="ERR_JWT_INVALID";class Dt extends Et{constructor(){super(...arguments);this.code="ERR_JWK_INVALID"}}Dt.code="ERR_JWK_INVALID";class Wt extends Et{constructor(){super(...arguments);this.code="ERR_JWKS_INVALID"}}Wt.code="ERR_JWKS_INVALID";class Ot extends Et{constructor(e="no applicable key found in the JSON Web Key Set",t){super(e,t);this.code="ERR_JWKS_NO_MATCHING_KEY"}}Ot.code="ERR_JWKS_NO_MATCHING_KEY";class Lt extends Et{constructor(e="multiple matching keys found in the JSON Web Key Set",t){super(e,t);this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS"}}Lt.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";class jt extends Et{constructor(e="request timed out",t){super(e,t);this.code="ERR_JWKS_TIMEOUT"}}jt.code="ERR_JWKS_TIMEOUT";class Ut extends Et{constructor(e="signature verification failed",t){super(e,t);this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}Ut.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";function Jt(e,t="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function Kt(e,t){return e.name===t}function Ht(e){return parseInt(e.name.slice(4),10)}function Nt(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function Mt(e,t){if(t.length&&!t.some((t=>e.usages.includes(t)))){let e="CryptoKey does not support this operation, its usages must include ";if(t.length>2){const n=t.pop();e+=`one of ${t.join(", ")}, or ${n}.`}else if(t.length===2){e+=`one of ${t[0]} or ${t[1]}.`}else{e+=`${t[0]}.`}throw new TypeError(e)}}function Bt(e,t,...n){switch(t){case"HS256":case"HS384":case"HS512":{if(!Kt(e.algorithm,"HMAC"))throw Jt("HMAC");const n=parseInt(t.slice(2),10);const i=Ht(e.algorithm.hash);if(i!==n)throw Jt(`SHA-${n}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!Kt(e.algorithm,"RSASSA-PKCS1-v1_5"))throw Jt("RSASSA-PKCS1-v1_5");const n=parseInt(t.slice(2),10);const i=Ht(e.algorithm.hash);if(i!==n)throw Jt(`SHA-${n}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!Kt(e.algorithm,"RSA-PSS"))throw Jt("RSA-PSS");const n=parseInt(t.slice(2),10);const i=Ht(e.algorithm.hash);if(i!==n)throw Jt(`SHA-${n}`,"algorithm.hash");break}case"EdDSA":{if(e.algorithm.name!=="Ed25519"&&e.algorithm.name!=="Ed448"){throw Jt("Ed25519 or Ed448")}break}case"Ed25519":{if(!Kt(e.algorithm,"Ed25519"))throw Jt("Ed25519");break}case"ES256":case"ES384":case"ES512":{if(!Kt(e.algorithm,"ECDSA"))throw Jt("ECDSA");const n=Nt(t);const i=e.algorithm.namedCurve;if(i!==n)throw Jt(n,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}Mt(e,n)}function Xt(e,t,...n){n=n.filter(Boolean);if(n.length>2){const t=n.pop();e+=`one of type ${n.join(", ")}, or ${t}.`}else if(n.length===2){e+=`one of type ${n[0]} or ${n[1]}.`}else{e+=`of type ${n[0]}.`}if(t==null){e+=` Received ${t}`}else if(typeof t==="function"&&t.name){e+=` Received function ${t.name}`}else if(typeof t==="object"&&t!=null){if(t.constructor?.name){e+=` Received an instance of ${t.constructor.name}`}}return e}var Ft=(e,...t)=>Xt("Key must be ",e,...t);function Vt(e,t,...n){return Xt(`Key for the ${e} algorithm must be `,t,...n)}var qt=e=>{if(bt(e)){return true}return e?.[Symbol.toStringTag]==="KeyObject"};const Gt=["CryptoKey"];const Yt=(...e)=>{const t=e.filter(Boolean);if(t.length===0||t.length===1){return true}let n;for(const e of t){const t=Object.keys(e);if(!n||n.size===0){n=new Set(t);continue}for(const e of t){if(n.has(e)){return false}n.add(e)}}return true};var Zt=Yt;function Qt(e){return typeof e==="object"&&e!==null}function en(e){if(!Qt(e)||Object.prototype.toString.call(e)!=="[object Object]"){return false}if(Object.getPrototypeOf(e)===null){return true}let t=e;while(Object.getPrototypeOf(t)!==null){t=Object.getPrototypeOf(t)}return Object.getPrototypeOf(e)===t}var tn=(e,t)=>{if(e.startsWith("RS")||e.startsWith("PS")){const{modulusLength:n}=t.algorithm;if(typeof n!=="number"||n<2048){throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}}};function nn(e){return en(e)&&typeof e.kty==="string"}function rn(e){return e.kty!=="oct"&&typeof e.d==="string"}function sn(e){return e.kty!=="oct"&&typeof e.d==="undefined"}function on(e){return nn(e)&&e.kty==="oct"&&typeof e.k==="string"}function an(e){let t;let n;switch(e.kty){case"RSA":{switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${e.alg.slice(-3)}`};n=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.alg.slice(-3)}`};n=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(e.alg.slice(-3),10)||1}`};n=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new It('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"EC":{switch(e.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"};n=e.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"};n=e.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"};n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv};n=e.d?["deriveBits"]:[];break;default:throw new It('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"OKP":{switch(e.alg){case"Ed25519":t={name:"Ed25519"};n=e.d?["sign"]:["verify"];break;case"EdDSA":t={name:e.crv};n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv};n=e.d?["deriveBits"]:[];break;default:throw new It('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}default:throw new It('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:n}}const cn=async e=>{if(!e.alg){throw new TypeError('"alg" argument is required when "jwk.alg" is not present')}const{algorithm:t,keyUsages:n}=an(e);const i=[t,e.ext??false,e.key_ops??n];const r={...e};delete r.alg;delete r.use;return pt.subtle.importKey("jwk",r,...i)};var ln=cn;const dn=e=>_t(e);let hn;let un;const fn=e=>e?.[Symbol.toStringTag]==="KeyObject";const pn=async(e,t,n,i,r=false)=>{let s=e.get(t);if(s?.[i]){return s[i]}const o=await ln({...n,alg:i});if(r)Object.freeze(t);if(!s){e.set(t,{[i]:o})}else{s[i]=o}return o};const bn=(e,t)=>{if(fn(e)){let n=e.export({format:"jwk"});delete n.d;delete n.dp;delete n.dq;delete n.p;delete n.q;delete n.qi;if(n.k){return dn(n.k)}un||(un=new WeakMap);return pn(un,e,n,t)}if(nn(e)){if(e.k)return _t(e.k);un||(un=new WeakMap);const n=pn(un,e,e,t,true);return n}return e};const mn=(e,t)=>{if(fn(e)){let n=e.export({format:"jwk"});if(n.k){return dn(n.k)}hn||(hn=new WeakMap);return pn(hn,e,n,t)}if(nn(e)){if(e.k)return _t(e.k);hn||(hn=new WeakMap);const n=pn(hn,e,e,t,true);return n}return e};var gn={normalizePublicKey:bn,normalizePrivateKey:mn};async function wn(e,t){if(!en(e)){throw new TypeError("JWK must be an object")}t||(t=e.alg);switch(e.kty){case"oct":if(typeof e.k!=="string"||!e.k){throw new TypeError('missing "k" (Key Value) Parameter value')}return _t(e.k);case"RSA":if("oth"in e&&e.oth!==undefined){throw new It('RSA JWK "oth" (Other Primes Info) Parameter value is not supported')}case"EC":case"OKP":return ln({...e,alg:t});default:throw new It('Unsupported "kty" (Key Type) Parameter value')}}const vn=e=>e?.[Symbol.toStringTag];const yn=(e,t,n)=>{if(t.use!==undefined&&t.use!=="sig"){throw new TypeError("Invalid key for this operation, when present its use must be sig")}if(t.key_ops!==undefined&&t.key_ops.includes?.(n)!==true){throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${n}`)}if(t.alg!==undefined&&t.alg!==e){throw new TypeError(`Invalid key for this operation, when present its alg must be ${e}`)}return true};const kn=(e,t,n,i)=>{if(t instanceof Uint8Array)return;if(i&&nn(t)){if(on(t)&&yn(e,t,n))return;throw new TypeError(`JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present`)}if(!qt(t)){throw new TypeError(Vt(e,t,...Gt,"Uint8Array",i?"JSON Web Key":null))}if(t.type!=="secret"){throw new TypeError(`${vn(t)} instances for symmetric algorithms must be of type "secret"`)}};const xn=(e,t,n,i)=>{if(i&&nn(t)){switch(n){case"sign":if(rn(t)&&yn(e,t,n))return;throw new TypeError(`JSON Web Key for this operation be a private JWK`);case"verify":if(sn(t)&&yn(e,t,n))return;throw new TypeError(`JSON Web Key for this operation be a public JWK`)}}if(!qt(t)){throw new TypeError(Vt(e,t,...Gt,i?"JSON Web Key":null))}if(t.type==="secret"){throw new TypeError(`${vn(t)} instances for asymmetric algorithms must not be of type "secret"`)}if(n==="sign"&&t.type==="public"){throw new TypeError(`${vn(t)} instances for asymmetric algorithm signing must be of type "private"`)}if(n==="decrypt"&&t.type==="public"){throw new TypeError(`${vn(t)} instances for asymmetric algorithm decryption must be of type "private"`)}if(t.algorithm&&n==="verify"&&t.type==="private"){throw new TypeError(`${vn(t)} instances for asymmetric algorithm verifying must be of type "public"`)}if(t.algorithm&&n==="encrypt"&&t.type==="private"){throw new TypeError(`${vn(t)} instances for asymmetric algorithm encryption must be of type "public"`)}};function Sn(e,t,n,i){const r=t.startsWith("HS")||t==="dir"||t.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(t);if(r){kn(t,n,i,e)}else{xn(t,n,i,e)}}Sn.bind(undefined,false);const _n=Sn.bind(undefined,true);function En(e,t,n,i,r){if(r.crit!==undefined&&i?.crit===undefined){throw new e('"crit" (Critical) Header Parameter MUST be integrity protected')}if(!i||i.crit===undefined){return new Set}if(!Array.isArray(i.crit)||i.crit.length===0||i.crit.some((e=>typeof e!=="string"||e.length===0))){throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present')}let s;if(n!==undefined){s=new Map([...Object.entries(n),...t.entries()])}else{s=t}for(const t of i.crit){if(!s.has(t)){throw new It(`Extension Header Parameter "${t}" is not recognized`)}if(r[t]===undefined){throw new e(`Extension Header Parameter "${t}" is missing`)}if(s.get(t)&&i[t]===undefined){throw new e(`Extension Header Parameter "${t}" MUST be integrity protected`)}}return new Set(i.crit)}const An=(e,t)=>{if(t!==undefined&&(!Array.isArray(t)||t.some((e=>typeof e!=="string")))){throw new TypeError(`"${e}" option must be an array of strings`)}if(!t){return undefined}return new Set(t)};var Cn=An;const Tn=async e=>{if(e instanceof Uint8Array){return{kty:"oct",k:xt(e)}}if(!bt(e)){throw new TypeError(Ft(e,...Gt,"Uint8Array"))}if(!e.extractable){throw new TypeError("non-extractable CryptoKey cannot be exported as a JWK")}const{ext:t,key_ops:n,alg:i,use:r,...s}=await pt.subtle.exportKey("jwk",e);return s};var In=Tn;async function zn(e){return In(e)}function $n(e,t){const n=`SHA-${e.slice(-3)}`;switch(e){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:e.slice(-3)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":return{name:"Ed25519"};case"EdDSA":return{name:t.name};default:throw new It(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}async function Rn(e,t,n){if(n==="sign"){t=await gn.normalizePrivateKey(t,e)}if(n==="verify"){t=await gn.normalizePublicKey(t,e)}if(bt(t)){Bt(t,e,n);return t}if(t instanceof Uint8Array){if(!e.startsWith("HS")){throw new TypeError(Ft(t,...Gt))}return pt.subtle.importKey("raw",t,{hash:`SHA-${e.slice(-3)}`,name:"HMAC"},false,[n])}throw new TypeError(Ft(t,...Gt,"Uint8Array","JSON Web Key"))}const Pn=async(e,t,n,i)=>{const r=await Rn(e,t,"verify");tn(e,r);const s=$n(e,r.algorithm);try{return await pt.subtle.verify(s,r,n,i)}catch{return false}};var Dn=Pn;async function Wn(e,t,n){if(!en(e)){throw new Rt("Flattened JWS must be an object")}if(e.protected===undefined&&e.header===undefined){throw new Rt('Flattened JWS must have either of the "protected" or "header" members')}if(e.protected!==undefined&&typeof e.protected!=="string"){throw new Rt("JWS Protected Header incorrect type")}if(e.payload===undefined){throw new Rt("JWS Payload missing")}if(typeof e.signature!=="string"){throw new Rt("JWS Signature missing or incorrect type")}if(e.header!==undefined&&!en(e.header)){throw new Rt("JWS Unprotected Header incorrect type")}let i={};if(e.protected){try{const t=_t(e.protected);i=JSON.parse(vt.decode(t))}catch{throw new Rt("JWS Protected Header is invalid")}}if(!Zt(i,e.header)){throw new Rt("JWS Protected and JWS Unprotected Header Parameter names must be disjoint")}const r={...i,...e.header};const s=En(Rt,new Map([["b64",true]]),n?.crit,i,r);let o=true;if(s.has("b64")){o=i.b64;if(typeof o!=="boolean"){throw new Rt('The "b64" (base64url-encode payload) Header Parameter must be a boolean')}}const{alg:a}=r;if(typeof a!=="string"||!a){throw new Rt('JWS "alg" (Algorithm) Header Parameter missing or invalid')}const c=n&&Cn("algorithms",n.algorithms);if(c&&!c.has(a)){throw new Tt('"alg" (Algorithm) Header Parameter value not allowed')}if(o){if(typeof e.payload!=="string"){throw new Rt("JWS Payload must be a string")}}else if(typeof e.payload!=="string"&&!(e.payload instanceof Uint8Array)){throw new Rt("JWS Payload must be a string or an Uint8Array instance")}let l=false;if(typeof t==="function"){t=await t(i,e);l=true;_n(a,t,"verify");if(nn(t)){t=await wn(t,a)}}else{_n(a,t,"verify")}const d=yt(wt.encode(e.protected??""),wt.encode("."),typeof e.payload==="string"?wt.encode(e.payload):e.payload);let h;try{h=_t(e.signature)}catch{throw new Rt("Failed to base64url decode the signature")}const u=await Dn(a,t,h,d);if(!u){throw new Ut}let f;if(o){try{f=_t(e.payload)}catch{throw new Rt("Failed to base64url decode the payload")}}else if(typeof e.payload==="string"){f=wt.encode(e.payload)}else{f=e.payload}const p={payload:f};if(e.protected!==undefined){p.protectedHeader=i}if(e.header!==undefined){p.unprotectedHeader=e.header}if(l){return{...p,key:t}}return p}async function On(e,t,n){if(e instanceof Uint8Array){e=vt.decode(e)}if(typeof e!=="string"){throw new Rt("Compact JWS must be a string or Uint8Array")}const{0:i,1:r,2:s,length:o}=e.split(".");if(o!==3){throw new Rt("Invalid Compact JWS")}const a=await Wn({payload:r,protected:i,signature:s},t,n);const c={payload:a.payload,protectedHeader:a.protectedHeader};if(typeof t==="function"){return{...c,key:a.key}}return c}var Ln=e=>Math.floor(e.getTime()/1e3);const jn=60;const Un=jn*60;const Jn=Un*24;const Kn=Jn*7;const Hn=Jn*365.25;const Nn=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;var Mn=e=>{const t=Nn.exec(e);if(!t||t[4]&&t[1]){throw new TypeError("Invalid time period format")}const n=parseFloat(t[2]);const i=t[3].toLowerCase();let r;switch(i){case"sec":case"secs":case"second":case"seconds":case"s":r=Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":r=Math.round(n*jn);break;case"hour":case"hours":case"hr":case"hrs":case"h":r=Math.round(n*Un);break;case"day":case"days":case"d":r=Math.round(n*Jn);break;case"week":case"weeks":case"w":r=Math.round(n*Kn);break;default:r=Math.round(n*Hn);break}if(t[1]==="-"||t[4]==="ago"){return-r}return r};const Bn=e=>e.toLowerCase().replace(/^application\//,"");const Xn=(e,t)=>{if(typeof e==="string"){return t.includes(e)}if(Array.isArray(e)){return t.some(Set.prototype.has.bind(new Set(e)))}return false};var Fn=(e,t,n={})=>{let i;try{i=JSON.parse(vt.decode(t))}catch{}if(!en(i)){throw new Pt("JWT Claims Set must be a top-level JSON object")}const{typ:r}=n;if(r&&(typeof e.typ!=="string"||Bn(e.typ)!==Bn(r))){throw new At('unexpected "typ" JWT header value',i,"typ","check_failed")}const{requiredClaims:s=[],issuer:o,subject:a,audience:c,maxTokenAge:l}=n;const d=[...s];if(l!==undefined)d.push("iat");if(c!==undefined)d.push("aud");if(a!==undefined)d.push("sub");if(o!==undefined)d.push("iss");for(const e of new Set(d.reverse())){if(!(e in i)){throw new At(`missing required "${e}" claim`,i,e,"missing")}}if(o&&!(Array.isArray(o)?o:[o]).includes(i.iss)){throw new At('unexpected "iss" claim value',i,"iss","check_failed")}if(a&&i.sub!==a){throw new At('unexpected "sub" claim value',i,"sub","check_failed")}if(c&&!Xn(i.aud,typeof c==="string"?[c]:c)){throw new At('unexpected "aud" claim value',i,"aud","check_failed")}let h;switch(typeof n.clockTolerance){case"string":h=Mn(n.clockTolerance);break;case"number":h=n.clockTolerance;break;case"undefined":h=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:u}=n;const f=Ln(u||new Date);if((i.iat!==undefined||l)&&typeof i.iat!=="number"){throw new At('"iat" claim must be a number',i,"iat","invalid")}if(i.nbf!==undefined){if(typeof i.nbf!=="number"){throw new At('"nbf" claim must be a number',i,"nbf","invalid")}if(i.nbf>f+h){throw new At('"nbf" claim timestamp check failed',i,"nbf","check_failed")}}if(i.exp!==undefined){if(typeof i.exp!=="number"){throw new At('"exp" claim must be a number',i,"exp","invalid")}if(i.exp<=f-h){throw new Ct('"exp" claim timestamp check failed',i,"exp","check_failed")}}if(l){const e=f-i.iat;const t=typeof l==="number"?l:Mn(l);if(e-h>t){throw new Ct('"iat" claim timestamp check failed (too far in the past)',i,"iat","check_failed")}if(e<0-h){throw new At('"iat" claim timestamp check failed (it should be in the past)',i,"iat","check_failed")}}return i};async function Vn(e,t,n){const i=await On(e,t,n);if(i.protectedHeader.crit?.includes("b64")&&i.protectedHeader.b64===false){throw new Pt("JWTs MUST NOT use unencoded payload")}const r=Fn(i.protectedHeader,i.payload,n);const s={payload:r,protectedHeader:i.protectedHeader};if(typeof t==="function"){return{...s,key:i.key}}return s}const qn=async(e,t,n)=>{const i=await Rn(e,t,"sign");tn(e,i);const r=await pt.subtle.sign($n(e,i.algorithm),i,n);return new Uint8Array(r)};var Gn=qn;class Yn{constructor(e){if(!(e instanceof Uint8Array)){throw new TypeError("payload must be an instance of Uint8Array")}this._payload=e}setProtectedHeader(e){if(this._protectedHeader){throw new TypeError("setProtectedHeader can only be called once")}this._protectedHeader=e;return this}setUnprotectedHeader(e){if(this._unprotectedHeader){throw new TypeError("setUnprotectedHeader can only be called once")}this._unprotectedHeader=e;return this}async sign(e,t){if(!this._protectedHeader&&!this._unprotectedHeader){throw new Rt("either setProtectedHeader or setUnprotectedHeader must be called before #sign()")}if(!Zt(this._protectedHeader,this._unprotectedHeader)){throw new Rt("JWS Protected and JWS Unprotected Header Parameter names must be disjoint")}const n={...this._protectedHeader,...this._unprotectedHeader};const i=En(Rt,new Map([["b64",true]]),t?.crit,this._protectedHeader,n);let r=true;if(i.has("b64")){r=this._protectedHeader.b64;if(typeof r!=="boolean"){throw new Rt('The "b64" (base64url-encode payload) Header Parameter must be a boolean')}}const{alg:s}=n;if(typeof s!=="string"||!s){throw new Rt('JWS "alg" (Algorithm) Header Parameter missing or invalid')}_n(s,e,"sign");let o=this._payload;if(r){o=wt.encode(xt(o))}let a;if(this._protectedHeader){a=wt.encode(xt(JSON.stringify(this._protectedHeader)))}else{a=wt.encode("")}const c=yt(a,wt.encode("."),o);const l=await Gn(s,e,c);const d={signature:xt(l),payload:""};if(r){d.payload=vt.decode(o)}if(this._unprotectedHeader){d.header=this._unprotectedHeader}if(this._protectedHeader){d.protected=vt.decode(a)}return d}}class Zn{constructor(e){this._flattened=new Yn(e)}setProtectedHeader(e){this._flattened.setProtectedHeader(e);return this}async sign(e,t){const n=await this._flattened.sign(e,t);if(n.payload===undefined){throw new TypeError("use the flattened module for creating JWS with b64: false")}return`${n.protected}.${n.payload}.${n.signature}`}}function Qn(e,t){if(!Number.isFinite(t)){throw new TypeError(`Invalid ${e} input`)}return t}class ei{constructor(e={}){if(!en(e)){throw new TypeError("JWT Claims Set MUST be an object")}this._payload=e}setIssuer(e){this._payload={...this._payload,iss:e};return this}setSubject(e){this._payload={...this._payload,sub:e};return this}setAudience(e){this._payload={...this._payload,aud:e};return this}setJti(e){this._payload={...this._payload,jti:e};return this}setNotBefore(e){if(typeof e==="number"){this._payload={...this._payload,nbf:Qn("setNotBefore",e)}}else if(e instanceof Date){this._payload={...this._payload,nbf:Qn("setNotBefore",Ln(e))}}else{this._payload={...this._payload,nbf:Ln(new Date)+Mn(e)}}return this}setExpirationTime(e){if(typeof e==="number"){this._payload={...this._payload,exp:Qn("setExpirationTime",e)}}else if(e instanceof Date){this._payload={...this._payload,exp:Qn("setExpirationTime",Ln(e))}}else{this._payload={...this._payload,exp:Ln(new Date)+Mn(e)}}return this}setIssuedAt(e){if(typeof e==="undefined"){this._payload={...this._payload,iat:Ln(new Date)}}else if(e instanceof Date){this._payload={...this._payload,iat:Qn("setIssuedAt",Ln(e))}}else if(typeof e==="string"){this._payload={...this._payload,iat:Qn("setIssuedAt",Ln(new Date)+Mn(e))}}else{this._payload={...this._payload,iat:Qn("setIssuedAt",e)}}return this}}class ti extends ei{setProtectedHeader(e){this._protectedHeader=e;return this}async sign(e,t){const n=new Zn(wt.encode(JSON.stringify(this._payload)));n.setProtectedHeader(this._protectedHeader);if(Array.isArray(this._protectedHeader?.crit)&&this._protectedHeader.crit.includes("b64")&&this._protectedHeader.b64===false){throw new Pt("JWTs MUST NOT use unencoded payload")}return n.sign(e,t)}}const ni=(e,t)=>{if(typeof e!=="string"||!e){throw new Dt(`${t} missing or invalid`)}};async function ii(e,t){if(!en(e)){throw new TypeError("JWK must be an object")}t??(t="sha256");if(t!=="sha256"&&t!=="sha384"&&t!=="sha512"){throw new TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"')}let n;switch(e.kty){case"EC":ni(e.crv,'"crv" (Curve) Parameter');ni(e.x,'"x" (X Coordinate) Parameter');ni(e.y,'"y" (Y Coordinate) Parameter');n={crv:e.crv,kty:e.kty,x:e.x,y:e.y};break;case"OKP":ni(e.crv,'"crv" (Subtype of Key Pair) Parameter');ni(e.x,'"x" (Public Key) Parameter');n={crv:e.crv,kty:e.kty,x:e.x};break;case"RSA":ni(e.e,'"e" (Exponent) Parameter');ni(e.n,'"n" (Modulus) Parameter');n={e:e.e,kty:e.kty,n:e.n};break;case"oct":ni(e.k,'"k" (Key Value) Parameter');n={k:e.k,kty:e.kty};break;default:throw new It('"kty" (Key Type) Parameter missing or unsupported')}const i=wt.encode(JSON.stringify(n));return xt(await gt(t,i))}function ri(e){switch(typeof e==="string"&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";default:throw new It('Unsupported "alg" value for a JSON Web Key Set')}}function si(e){return e&&typeof e==="object"&&Array.isArray(e.keys)&&e.keys.every(oi)}function oi(e){return en(e)}function ai(e){if(typeof structuredClone==="function"){return structuredClone(e)}return JSON.parse(JSON.stringify(e))}class ci{constructor(e){this._cached=new WeakMap;if(!si(e)){throw new Wt("JSON Web Key Set malformed")}this._jwks=ai(e)}async getKey(e,t){const{alg:n,kid:i}={...e,...t?.header};const r=ri(n);const s=this._jwks.keys.filter((e=>{let t=r===e.kty;if(t&&typeof i==="string"){t=i===e.kid}if(t&&typeof e.alg==="string"){t=n===e.alg}if(t&&typeof e.use==="string"){t=e.use==="sig"}if(t&&Array.isArray(e.key_ops)){t=e.key_ops.includes("verify")}if(t){switch(n){case"ES256":t=e.crv==="P-256";break;case"ES256K":t=e.crv==="secp256k1";break;case"ES384":t=e.crv==="P-384";break;case"ES512":t=e.crv==="P-521";break;case"Ed25519":t=e.crv==="Ed25519";break;case"EdDSA":t=e.crv==="Ed25519"||e.crv==="Ed448";break}}return t}));const{0:o,length:a}=s;if(a===0){throw new Ot}if(a!==1){const e=new Lt;const{_cached:t}=this;e[Symbol.asyncIterator]=async function*(){for(const e of s){try{yield await li(t,e,n)}catch{}}};throw e}return li(this._cached,o,n)}}async function li(e,t,n){const i=e.get(t)||e.set(t,{}).get(t);if(i[n]===undefined){const e=await wn({...t,ext:true},n);if(e instanceof Uint8Array||e.type!=="public"){throw new Wt("JSON Web Key Set members must be public keys")}i[n]=e}return i[n]}function di(e){const t=new ci(e);const n=async(e,n)=>t.getKey(e,n);Object.defineProperties(n,{jwks:{value:()=>ai(t._jwks),enumerable:true,configurable:false,writable:false}});return n}const hi=async(e,t,n)=>{let i;let r;let s=false;if(typeof AbortController==="function"){i=new AbortController;r=setTimeout((()=>{s=true;i.abort()}),t)}const o=await fetch(e.href,{signal:i?i.signal:undefined,redirect:"manual",headers:n.headers}).catch((e=>{if(s)throw new jt;throw e}));if(r!==undefined)clearTimeout(r);if(o.status!==200){throw new Et("Expected 200 OK from the JSON Web Key Set HTTP response")}try{return await o.json()}catch{throw new Et("Failed to parse the JSON Web Key Set HTTP response as JSON")}};var ui=hi;function fi(){return typeof WebSocketPair!=="undefined"||typeof navigator!=="undefined"&&navigator.userAgent==="Cloudflare-Workers"||typeof EdgeRuntime!=="undefined"&&EdgeRuntime==="vercel"}let pi;if(typeof navigator==="undefined"||!navigator.userAgent?.startsWith?.("Mozilla/5.0 ")){const e="jose";const t="v5.10.0";pi=`${e}/${t}`}const bi=Symbol();function mi(e,t){if(typeof e!=="object"||e===null){return false}if(!("uat"in e)||typeof e.uat!=="number"||Date.now()-e.uat>=t){return false}if(!("jwks"in e)||!en(e.jwks)||!Array.isArray(e.jwks.keys)||!Array.prototype.every.call(e.jwks.keys,en)){return false}return true}class gi{constructor(e,t){if(!(e instanceof URL)){throw new TypeError("url must be an instance of URL")}this._url=new URL(e.href);this._options={agent:t?.agent,headers:t?.headers};this._timeoutDuration=typeof t?.timeoutDuration==="number"?t?.timeoutDuration:5e3;this._cooldownDuration=typeof t?.cooldownDuration==="number"?t?.cooldownDuration:3e4;this._cacheMaxAge=typeof t?.cacheMaxAge==="number"?t?.cacheMaxAge:6e5;if(t?.[bi]!==undefined){this._cache=t?.[bi];if(mi(t?.[bi],this._cacheMaxAge)){this._jwksTimestamp=this._cache.uat;this._local=di(this._cache.jwks)}}}coolingDown(){return typeof this._jwksTimestamp==="number"?Date.now()<this._jwksTimestamp+this._cooldownDuration:false}fresh(){return typeof this._jwksTimestamp==="number"?Date.now()<this._jwksTimestamp+this._cacheMaxAge:false}async getKey(e,t){if(!this._local||!this.fresh()){await this.reload()}try{return await this._local(e,t)}catch(n){if(n instanceof Ot){if(this.coolingDown()===false){await this.reload();return this._local(e,t)}}throw n}}async reload(){if(this._pendingFetch&&fi()){this._pendingFetch=undefined}const e=new Headers(this._options.headers);if(pi&&!e.has("User-Agent")){e.set("User-Agent",pi);this._options.headers=Object.fromEntries(e.entries())}this._pendingFetch||(this._pendingFetch=ui(this._url,this._timeoutDuration,this._options).then((e=>{this._local=di(e);if(this._cache){this._cache.uat=Date.now();this._cache.jwks=e}this._jwksTimestamp=Date.now();this._pendingFetch=undefined})).catch((e=>{this._pendingFetch=undefined;throw e})));await this._pendingFetch}}function wi(e,t){const n=new gi(e,t);const i=async(e,t)=>n.getKey(e,t);Object.defineProperties(i,{coolingDown:{get:()=>n.coolingDown(),enumerable:true,configurable:false},fresh:{get:()=>n.fresh(),enumerable:true,configurable:false},reload:{value:()=>n.reload(),enumerable:true,configurable:false,writable:false},reloading:{get:()=>!!n._pendingFetch,enumerable:true,configurable:false},jwks:{value:()=>n._local?.jwks(),enumerable:true,configurable:false,writable:false}});return i}const vi=_t;function yi(e){if(typeof e!=="string")throw new Pt("JWTs must use Compact JWS serialization, JWT must be a string");const{1:t,length:n}=e.split(".");if(n===5)throw new Pt("Only JWTs using Compact JWS serialization can be decoded");if(n!==3)throw new Pt("Invalid JWT");if(!t)throw new Pt("JWTs must contain a payload");let i;try{i=vi(t)}catch{throw new Pt("Failed to base64url decode the payload")}let r;try{r=JSON.parse(vt.decode(i))}catch{throw new Pt("Failed to parse the decoded payload as JSON")}if(!en(r))throw new Pt("Invalid JWT Claims Set");return r}function ki(e){const t=e?.modulusLength??2048;if(typeof t!=="number"||t<2048){throw new It("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used")}return t}async function xi(e,t){let n;let i;switch(e){case"PS256":case"PS384":case"PS512":n={name:"RSA-PSS",hash:`SHA-${e.slice(-3)}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:ki(t)};i=["sign","verify"];break;case"RS256":case"RS384":case"RS512":n={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.slice(-3)}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:ki(t)};i=["sign","verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":n={name:"RSA-OAEP",hash:`SHA-${parseInt(e.slice(-3),10)||1}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:ki(t)};i=["decrypt","unwrapKey","encrypt","wrapKey"];break;case"ES256":n={name:"ECDSA",namedCurve:"P-256"};i=["sign","verify"];break;case"ES384":n={name:"ECDSA",namedCurve:"P-384"};i=["sign","verify"];break;case"ES512":n={name:"ECDSA",namedCurve:"P-521"};i=["sign","verify"];break;case"Ed25519":n={name:"Ed25519"};i=["sign","verify"];break;case"EdDSA":{i=["sign","verify"];const e=t?.crv??"Ed25519";switch(e){case"Ed25519":case"Ed448":n={name:e};break;default:throw new It("Invalid or unsupported crv option provided")}break}case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{i=["deriveKey","deriveBits"];const e=t?.crv??"P-256";switch(e){case"P-256":case"P-384":case"P-521":{n={name:"ECDH",namedCurve:e};break}case"X25519":case"X448":n={name:e};break;default:throw new It("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448")}break}default:throw new It('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return pt.subtle.generateKey(n,t?.extractable??false,i)}async function Si(e,t){return xi(e,t)}const _i=async(e,t)=>{const n={...t,grant_types:["authorization_code","refresh_token"],id_token_signed_response_alg:"ES256",token_endpoint_auth_method:"none",application_type:"web",subject_type:"public"};return fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})};class Ei{dbName;storeName;dbVersion;db=null;constructor(e="soidc",t="session",n=1){this.dbName=e;this.storeName=t;this.dbVersion=n}async init(){return new Promise(((e,t)=>{const n=indexedDB.open(this.dbName,this.dbVersion);n.onerror=e=>{t(new Error(`Database error: ${e.target.error}`))};n.onsuccess=t=>{this.db=t.target.result;e(this)};n.onupgradeneeded=e=>{const t=e.target.result;if(!t.objectStoreNames.contains(this.storeName)){t.createObjectStore(this.storeName)}}}))}async setItem(e,t){if(!this.db){await this.init()}return new Promise(((n,i)=>{const r=this.db.transaction(this.storeName,"readwrite");r.oncomplete=()=>{n()};r.onerror=t=>{i(new Error(`Transaction error for setItem(${e},...): ${t.target.error}`))};r.onabort=t=>{i(new Error(`Transaction aborted for setItem(${e},...): ${t.target.error}`))};const s=r.objectStore(this.storeName);s.put(t,e)}))}async getItem(e){if(!this.db){await this.init()}return new Promise(((t,n)=>{const i=this.db.transaction(this.storeName,"readonly");i.onerror=t=>{n(new Error(`Transaction error for getItem(${e}): ${t.target.error}`))};i.onabort=t=>{n(new Error(`Transaction aborted for getItem(${e}): ${t.target.error}`))};const r=i.objectStore(this.storeName);const s=r.get(e);s.onsuccess=()=>{t(s.result||null)}}))}async deleteItem(e){if(!this.db){await this.init()}return new Promise(((t,n)=>{const i=this.db.transaction(this.storeName,"readwrite");i.oncomplete=()=>{t()};i.onerror=t=>{n(new Error(`Transaction error for deleteItem(${e}): ${t.target.error}`))};i.onabort=t=>{n(new Error(`Transaction aborted for deleteItem(${e}): ${t.target.error}`))};const r=i.objectStore(this.storeName);r.delete(e)}))}async clear(){if(!this.db){await this.init()}return new Promise(((e,t)=>{const n=this.db.transaction(this.storeName,"readwrite");n.oncomplete=()=>{e()};n.onerror=e=>{t(new Error(`Transaction error for clear(): ${e.target.error}`))};n.onabort=e=>{t(new Error(`Transaction aborted for clear(): ${e.target.error}`))};const i=n.objectStore(this.storeName);i.clear()}))}close(){if(this.db){this.db.close();this.db=null}}}const Ai=async(e,t,n)=>{const i=new URL(t);const r=i.origin+i.pathname+i.search;const s=new URL(e).origin;const o=await fetch(`${s}/.well-known/openid-configuration`).then((e=>{if(!e.ok){throw new Error(`HTTP error! Status: ${e.status}`)}return e.json()}));const a=o["issuer"];const c=e=>e.endsWith("/")?e.slice(0,-1):e;if(c(e)!==c(a)){throw new Error("RFC 9207 - iss != idp - "+a+" != "+e)}sessionStorage.setItem("idp",a);sessionStorage.setItem("token_endpoint",o["token_endpoint"]);sessionStorage.setItem("jwks_uri",o["jwks_uri"]);let l=n?.client_id;if(!l){const e=o["registration_endpoint"];const t=await _i(e,n??{redirect_uris:[r]}).then((e=>{if(!e.ok){throw new Error(`HTTP error! Status: ${e.status}`)}return e.json()}));l=t["client_id"];sessionStorage.setItem("client_id",l)}const{pkce_code_verifier:d,pkce_code_challenge:h}=await Ci();sessionStorage.setItem("pkce_code_verifier",d);const u=window.crypto.randomUUID();sessionStorage.setItem("csrf_token",u);const f=o["authorization_endpoint"]+`?response_type=code`+`&redirect_uri=${encodeURIComponent(r)}`+`&scope=openid offline_access webid`+`&client_id=${encodeURIComponent(l)}`+`&code_challenge_method=S256`+`&code_challenge=${h}`+`&state=${u}`+`&prompt=consent`;window.location.href=f};const Ci=async()=>{const e=window.crypto.randomUUID()+"-"+window.crypto.randomUUID();const t=new Uint8Array(await window.crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e)));const n=btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return{pkce_code_verifier:e,pkce_code_challenge:n}};const Ti=async e=>{const t=new URL(window.location.href);const n=t.searchParams.get("code");if(n===null){return{clientDetails:e}}const i=sessionStorage.getItem("idp");if(i===null||t.searchParams.get("iss")!=i){throw new Error("RFC 9207 - iss != idp - "+t.searchParams.get("iss")+" != "+i)}if(t.searchParams.get("state")!=sessionStorage.getItem("csrf_token")){throw new Error("RFC 6749 - state != csrf_token - "+t.searchParams.get("state")+" != "+sessionStorage.getItem("csrf_token"))}t.searchParams.delete("iss");t.searchParams.delete("state");t.searchParams.delete("code");window.history.pushState({},document.title,t.toString());const r=sessionStorage.getItem("pkce_code_verifier");if(r===null){throw new Error("Access Token Request preparation - Could not find in sessionStorage: pkce_code_verifier")}const s=e?.client_id||sessionStorage.getItem("client_id");if(!s){throw new Error("Access Token Request preparation - Could not find in sessionStorage: client_id (dynamic registration)")}const o=sessionStorage.getItem("token_endpoint");if(o===null){throw new Error("Access Token Request preparation - Could not find in sessionStorage: token_endpoint")}const a=await Si("ES256");const c=await Ii(n,r,t.toString(),s,o,a).then((e=>{if(!e.ok){throw new Error(`HTTP error! Status: ${e.status}`)}return e.json()}));const l=c["access_token"];const d=sessionStorage.getItem("jwks_uri");if(d===null){throw new Error("Access Token validation preparation - Could not find in sessionStorage: jwks_uri")}const h=wi(new URL(d));const{payload:u}=await Vn(l,h,{issuer:i,audience:"solid"});const f=await ii(await zn(a.publicKey));if(u["cnf"]["jkt"]!=f){throw new Error("Access Token validation failed on `jkt`: jkt != DPoP thumbprint - "+u["cnf"]["jkt"]+" != "+f)}if(u["client_id"]!=s){throw new Error("Access Token validation failed on `client_id`: JWT payload != client_id - "+u["client_id"]+" != "+s)}const p={...c,dpop_key_pair:a};const b={idp:i,jwks_uri:d,token_endpoint:o};if(!e)e={redirect_uris:[window.location.href]};e.client_id=s;const m=await(new Ei).init();await Promise.all([m.setItem("idp",i),m.setItem("jwks_uri",d),m.setItem("token_endpoint",o),m.setItem("client_id",s),m.setItem("dpop_keypair",a),m.setItem("refresh_token",c["refresh_token"])]);m.close();sessionStorage.removeItem("csrf_token");sessionStorage.removeItem("pkce_code_verifier");sessionStorage.removeItem("idp");sessionStorage.removeItem("jwks_uri");sessionStorage.removeItem("token_endpoint");sessionStorage.removeItem("client_id");return{clientDetails:e,idpDetails:b,tokenDetails:p}};const Ii=async(e,t,n,i,r,s)=>{const o=await zn(s.publicKey);o.alg="ES256";const a=await new ti({htu:r,htm:"POST"}).setIssuedAt().setJti(window.crypto.randomUUID()).setProtectedHeader({alg:"ES256",typ:"dpop+jwt",jwk:o}).sign(s.privateKey);return fetch(r,{method:"POST",headers:{dpop:a,"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:n,client_id:i})})};const zi=async()=>{const e=await(new Ei).init();const t=await e.getItem("client_id");const n=await e.getItem("token_endpoint");const i=await e.getItem("dpop_keypair");const r=await e.getItem("refresh_token");if(t===null||n===null||i===null||r===null){throw new Error("Could not refresh tokens: details missing from database.")}const s=await $i(r,t,n,i).then((e=>{if(!e.ok){throw new Error(`HTTP error! Status: ${e.status}`)}return e.json()}));const o=s["access_token"];const a=await e.getItem("idp");if(a===null){throw new Error("Access Token validation preparation - Could not find in sessionDatabase: idp")}const c=await e.getItem("jwks_uri");if(c===null){throw new Error("Access Token validation preparation - Could not find in sessionDatabase: jwks_uri")}const l=wi(new URL(c));const{payload:d}=await Vn(o,l,{issuer:a,audience:"solid"});const h=await ii(await zn(i.publicKey));if(d["cnf"]["jkt"]!=h){throw new Error("Access Token validation failed on `jkt`: jkt != DPoP thumbprint - "+d["cnf"]["jkt"]+" != "+h)}if(d["client_id"]!=t){throw new Error("Access Token validation failed on `client_id`: JWT payload != client_id - "+d["client_id"]+" != "+t)}await e.setItem("refresh_token",s["refresh_token"]);e.close();return{...s,dpop_key_pair:i}};const $i=async(e,t,n,i)=>{const r=await zn(i.publicKey);r.alg="ES256";const s=await new ti({htu:n,htm:"POST"}).setIssuedAt().setJti(window.crypto.randomUUID()).setProtectedHeader({alg:"ES256",typ:"dpop+jwt",jwk:r}).sign(i.privateKey);return fetch(n,{method:"POST",headers:{dpop:s,"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:e,client_id:t})})};class Ri{sessionInformation;isActive_=false;webId_=undefined;currentAth_=undefined;tokenRefreshTimeout;sessionDeactivateTimeout;onSessionExpirationWarning;constructor(e,t){this.sessionInformation={clientDetails:e};this.onSessionExpirationWarning=t?.onSessionExpirationWarning}async login(e,t){await Ai(e,t,this.sessionInformation.clientDetails)}async logout(){if(this.sessionDeactivateTimeout)clearTimeout(this.sessionDeactivateTimeout);this.sessionDeactivateTimeout=undefined;if(this.tokenRefreshTimeout)clearTimeout(this.tokenRefreshTimeout);this.tokenRefreshTimeout=undefined;this.sessionInformation.idpDetails=undefined;this.sessionInformation.tokenDetails=undefined;this.isActive_=false;this.webId_=undefined;if(this.sessionInformation.clientDetails?.client_id)try{new URL(this.sessionInformation.clientDetails.client_id)}catch(e){this.sessionInformation.clientDetails.client_id=undefined}const e=await(new Ei).init();await e.clear();e.close()}async handleRedirectFromLogin(){const e=await Ti(this.sessionInformation.clientDetails);if(!e.tokenDetails){return}this.sessionInformation=e;await this.setSessionDetails()}async restore(){await zi().then((e=>{this.sessionInformation.tokenDetails=e;return this.setSessionDetails()})).catch((e=>{}))}async createSignedDPoPToken(e){if(!this.sessionInformation.tokenDetails||!this.currentAth_){throw new Error("Session not established.")}e.ath=this.currentAth_;const t=await zn(this.sessionInformation.tokenDetails.dpop_key_pair.publicKey);return new ti(e).setIssuedAt().setJti(window.crypto.randomUUID()).setProtectedHeader({alg:"ES256",typ:"dpop+jwt",jwk:t}).sign(this.sessionInformation.tokenDetails.dpop_key_pair.privateKey)}async authFetch(e,t,n){let i;let r;let s;if(e instanceof Request){i=new URL(e.url);r=t?.method||e?.method||"GET";s=new Headers(e.headers)}else{t=t||{};i=new URL(e.toString());r=t.method||"GET";s=t.headers?new Headers(t.headers):new Headers}if(this.sessionInformation.tokenDetails){n=n??{htu:`${i.origin}${i.pathname}`,htm:r.toUpperCase()};const e=await this.createSignedDPoPToken(n);s.set("dpop",e);s.set("authorization",`DPoP ${this.sessionInformation.tokenDetails.access_token}`)}if(e instanceof Request){return fetch(new Request(e,{...t,headers:s}))}return fetch(i,{...t,headers:s})}get isActive(){return this.isActive_}get webId(){return this.webId_}async setSessionDetails(){if(!this.sessionInformation.tokenDetails?.access_token){this.logout()}this.currentAth_=await this.computeAth(this.sessionInformation.tokenDetails.access_token);this.webId_=yi(this.sessionInformation.tokenDetails.access_token)["webid"];this.isActive_=this.webId!==undefined;this.setSessionDeactivateTimeout();this.setTokenRefreshTimeout()}setSessionDeactivateTimeout(){const e=5;const t=(this.sessionInformation.tokenDetails.expires_in-e)*1e3;if(this.sessionDeactivateTimeout)clearTimeout(this.sessionDeactivateTimeout);this.sessionDeactivateTimeout=setTimeout((()=>this.logout()),t)}setTokenRefreshTimeout(){const e=95;const t=(this.sessionInformation.tokenDetails.expires_in-e)*1e3;if(this.tokenRefreshTimeout)clearTimeout(this.tokenRefreshTimeout);this.tokenRefreshTimeout=setTimeout((async()=>{const e=await zi().catch((e=>{if(this.onSessionExpirationWarning)this.onSessionExpirationWarning();return undefined}));if(!e){return}this.sessionInformation.tokenDetails=e;this.setSessionDetails()}),t)}async computeAth(e){const t=new TextEncoder;const n=t.encode(e);const i=await crypto.subtle.digest("SHA-256",n);const r=Array.from(new Uint8Array(i));const s=btoa(String.fromCharCode(...r));const o=s.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return o}}class Pi{get authenticatedFetch(){return this._authenticatedFetch}constructor(){this.onSessionRestoreCallback=()=>{};this.sessionInfo$=new ft({isLoggedIn:false,webId:undefined});this.session=new Ri;this._authenticatedFetch=this.session.authFetch.bind(this.session)}async handleIncomingRedirect(e=false){await this.session.handleRedirectFromLogin();if(e){await this.session.restore();if(this.session.isActive){this.onSessionRestoreCallback(window.location.href)}}this.sessionInfo$.next({isLoggedIn:this.session.isActive,webId:this.session.webId})}async login(e){return this.session.login(e,window.location.href)}async logout(){await this.session.logout();this.sessionInfo$.next({isLoggedIn:false,webId:undefined})}observeSession(){return this.sessionInfo$}onSessionRestore(e){this.onSessionRestoreCallback=e}}const Di=class{constructor(e){t(this,e);this.sessionRestoredEmitter=s(this,"pod-os:session-restored",7);this.podOsLoadedEmitter=s(this,"pod-os:loaded",7);this.restorePreviousSession=false;this.disconnected$=new v;this.loading=true}async componentWillLoad(){const e=new Pi;this.unsubscribeSettings=Pe.on("set",(()=>{this.os=ut(e,Pe.state)}));this.os=ut(e,Pe.state);e.onSessionRestore((e=>{this.sessionRestoredEmitter.emit({url:e})}));try{await e.handleIncomingRedirect(this.restorePreviousSession)}catch(e){console.error(e)}this.os.observeSession().pipe(y(this.disconnected$)).subscribe((async e=>{p.state.webId=e.webId;if(e.isLoggedIn){const t=await this.os.fetchProfile(e.webId);p.state.profile=t}p.state.isLoggedIn=e.isLoggedIn;this.loading=false}));this.podOsLoadedEmitter.emit({os:this.os,authenticatedFetch:e.authenticatedFetch})}disconnectedCallback(){this.unsubscribeSettings();this.disconnected$.next();this.disconnected$.unsubscribe()}async initializeOs(e){e.stopPropagation();e.detail(this.os)}async loadModule(e){e.stopPropagation();if(e.detail.module==="contacts"){const t=await this.os.loadContactsModule();e.detail.receiver(t)}else{throw Error(`Unknown module "${e.detail.module}"`)}}render(){return this.loading?n("ion-progress-bar",{type:"indeterminate"}):n("slot",null)}};const Wi="pos-router {\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n\npos-navigation {\n max-width: var(--width-lg);\n margin: 0;\n min-width: var(--size-32);\n flex-shrink: 1; /* Ensure navigation can shrink */\n}\n\npos-add-new-thing,\npos-login {\n flex: 0 1 auto;\n flex-shrink: 0; /* Ensure those items don't shrink */\n}\n\nheader,\nfooter {\n display: flex;\n gap: var(--size-1);\n height: auto;\n justify-content: center;\n align-items: center;\n padding: var(--size-1);\n}\n\nfooter svg {\n width: var(--size-5);\n height: var(--size-5);\n}\n\nfooter {\n font-size: var(--scale-fluid-000);\n\n .settings {\n padding: 0 var(--size-1);\n text-decoration: none;\n background-color: var(--pos-background-color);\n border: 1px solid var(--pos-secondary-border-color);\n color: var(--pos-secondary-border-color);\n border-radius: var(--radius-xs);\n\n &:hover {\n background-color: var(--pos-secondary-border-color);\n color: var(--pos-background-color);\n }\n }\n}\n\nheader {\n flex-wrap: nowrap;\n padding: var(--size-1) var(--size-8);\n}\n\nmain {\n flex: 1;\n max-height: 100vh;\n overflow: auto;\n}\n\n@media (max-width: 640px) {\n header {\n padding: var(--size-1);\n justify-content: space-between;\n }\n footer {\n display: none;\n }\n}\n";const Oi=Wi;const Li=class{constructor(e){t(this,e);this.restorePreviousSession=false;this.mode="standalone";this.uri=""}render(){return n(i,{key:"08b186d2f354d6c07df02707eb4ada81aef7dec3"},n("pos-app",{key:"54c372343e916ab5d77584381b3965c925ae0cd0",restorePreviousSession:this.restorePreviousSession},n("pos-error-toast",{key:"ab63e18121ca16670f81da141219a782dde0694b"},n("pos-router",{key:"69b6f3bf8ce3720c6c39cdb4be69e640e27ccc5b",mode:this.mode,"onPod-os:route-changed":e=>this.uri=e.detail},n("header",{key:"5cd3412caf13b6d99da517ae7e6f5877234e65d7"},n("pos-add-new-thing",{key:"9b83b3cf03b7038303975386176df539b35ff547",referenceUri:this.uri}),n("pos-navigation",{key:"26bfed9b1c8dd1be018babc6ef40ae42808a5c42",uri:this.uri==="pod-os:dashboard"?"":this.uri}),n("pos-login",{key:"e29f18dcde866d8ac1e317fcd7b71ef584e69034"},n("pos-user-menu",{key:"be796f0914649eb4e8525a9d8acdfd535626303c",webId:p.state.webId,slot:"if-logged-in"}))),n("main",{key:"f99dfb2d43e949528bc767b94801c99bf04a7eea"},this.mainContent()),n("footer",{key:"64744d1246356fa00da9c6b561785e2b794a7907"},n(ji,{key:"a648f7f88e12c79348bda33152f2759d2b93e738"}),n("span",{key:"f22e2f9904ba517fc2e579a05018704b5ade6302"},"PodOS Browser"))))))}mainContent(){if(this.uri===""){return null}if(this.uri.startsWith("pod-os:")){return n("pos-internal-router",{uri:this.uri})}return n("pos-resource",{key:this.uri,uri:this.uri},n("pos-type-router",null))}};const ji=()=>n("svg",{viewBox:"0 0 400 400",xmlns:"http://www.w3.org/2000/svg"},n("path",{d:"M50 350 L50 100 L200 50 L350 100 L350 350 Z",style:{fill:"#008BF8",stroke:"#008BF8","stroke-width":"70"},"stroke-linejoin":"round"}),n("path",{d:"M100 300 L100 150 L200 120 L300 150 L300 300 L130 300 L130 370 L100 370Z",style:{fill:"white",stroke:"white","stroke-width":"45"},"stroke-linejoin":"round"}),n("path",{d:"M150 250 L150 200 L200 180 L250 200 L250 250 Z",style:{fill:"#DC0073",stroke:"#DC0073","stroke-width":"20"},"stroke-linejoin":"round"}));Li.style=Oi;const Ui=":host{display:grid;grid-template-columns:repeat(auto-fit, minmax(var(--size-12), var(--size-96)));gap:var(--size-4);padding:var(--size-2);justify-content:center;align-items:start;justify-items:stretch}";const Ji=Ui;const Ki=class{constructor(e){t(this,e)}render(){return n(i,{key:"18dc165b7be1c796136804a2ba7643b2a6fffc73"},n("pos-getting-started",{key:"e3f7a22641e4c24168a36f96463515cd1a89ca5e"}),n("pos-example-resources",{key:"1044dd873049118e165ff6d38449c85695f63a50"}))}};Ki.style=Ji;const Hi=":host{display:grid;grid-template-columns:repeat(auto-fit, minmax(var(--size-12), var(--size-96)));gap:var(--size-4);padding:var(--size-2);justify-content:center;align-items:start;justify-items:stretch}";const Ni=Hi;const Mi=class{constructor(e){t(this,e)}render(){return n("pos-setting-offline-cache",{key:"f065206f6291089773a19045243f04b6ce35eeb9"})}};Mi.style=Ni;const Bi=class{constructor(e){t(this,e);this.subscribeResource=s(this,"pod-os:resource",7);this.receiveResource=e=>{this.resource=e}}componentWillLoad(){x(this)}render(){return this.resource?this.resource.description():null}};const Xi="dialog{background-color:var(--pos-background-color);color:var(--pos-normal-text-color);border:none;border-radius:var(--radius-md);box-shadow:var(--shadow-md);max-width:var(--width-xs);animation:slideIn 0.2s ease-out}dialog::backdrop{background:rgba(0, 0, 0, 0.5);backdrop-filter:var(--blur-sm);animation:fadeIn 0.2s ease-out}@media (prefers-color-scheme: dark){dialog::backdrop{background:rgb(100, 100, 100, 0.5)}}dialog header>:first-child{flex-grow:1;font-weight:var(--weight-light);font-size:var(--scale-2);font-family:var(--font-sans);margin:0}dialog header{display:flex;flex-direction:row;justify-content:space-between;align-items:center;gap:var(--scale-0);border-bottom-style:inset;padding:0 0 var(--scale-0) 0}dialog>:last-child{display:block;margin-top:var(--scale-3)}button#close{cursor:pointer;display:flex;align-items:center;justify-content:center;border:none;background:none;font-size:var(--scale-3);color:var(--color-grey-500)}button#close:hover{color:var(--pos-secondary-border-color)}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes slideIn{from{opacity:0;transform:translateY(-20px) scale(0.95)}to{opacity:1;transform:translateY(0) scale(1)}}";const Fi=Xi;const Vi=class{constructor(e){t(this,e)}async showModal(){this.dialog.showModal()}async close(){this.dialog.close()}render(){return n(i,{key:"42ee67fc5636f2c5d1a44613d0c39b0e98112a79"},n("dialog",{key:"e05b18b7ed8cae7ac010ecdcb3f58367f742fe77",ref:e=>this.dialog=e},n("header",{key:"4e3b2a6c0fc069c425d8bc9dcedee4e7f5c95c01"},n("slot",{key:"7617853cebf80d86469956af01761970fa68aa7b",name:"title"}),n("button",{key:"c6858cb4b90ab1cef16adb77a148aa2bec405cf7",tabindex:-1,id:"close",title:"Close",onClick:()=>this.close()},n("ion-icon",{key:"58737ce0aac7b5047557b81c15daed713490a5ce",name:"close-outline"}))),n("slot",{key:"868baba59e97e691735759af250cffed8766c913",name:"content"})))}};Vi.style=Fi;var qi=e=>{var t;const{activeElement:n}=document;if(n&&e.contains(n)){(t=document.activeElement)==null?void 0:t.blur()}};var Gi=S`
2
2
  :host {
3
3
  display: inline-block;
4
4
  color: var(--sl-color-neutral-600);
@@ -50,22 +50,22 @@ import{d as e,r as t,h as n,H as i,e as s,f as r,i as o,j as a}from"./p-99602d8c
50
50
  * @license
51
51
  * Copyright 2020 Google LLC
52
52
  * SPDX-License-Identifier: BSD-3-Clause
53
- */;const ss=Symbol.for(""),rs=e=>{if(e?.r===ss)return e?._$litStatic$},os=(e,...t)=>({_$litStatic$:t.reduce(((t,n,i)=>t+(e=>{if(void 0!==e._$litStatic$)return e._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${e}. Use 'unsafeStatic' to pass non-literal values, but\n take care to ensure page security.`)})(n)+e[i+1]),e[0]),r:ss}),as=new Map,cs=e=>(t,...n)=>{const i=n.length;let s,r;const o=[],a=[];let c,l=0,d=!1;for(;l<i;){for(c=t[l];l<i&&void 0!==(r=n[l],s=rs(r));)c+=s+t[++l],d=!0;l!==i&&a.push(r),o.push(c),l++}if(l===i&&o.push(t[i]),d){const e=o.join("$$lit$$");void 0===(t=as.get(e))&&(o.raw=o,as.set(e,t=o)),n=a}return e(t,...n)},ls=cs(_);
53
+ */;const Yi=Symbol.for(""),Zi=e=>{if(e?.r===Yi)return e?._$litStatic$},Qi=(e,...t)=>({_$litStatic$:t.reduce(((t,n,i)=>t+(e=>{if(void 0!==e._$litStatic$)return e._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${e}. Use 'unsafeStatic' to pass non-literal values, but\n take care to ensure page security.`)})(n)+e[i+1]),e[0]),r:Yi}),er=new Map,tr=e=>(t,...n)=>{const i=n.length;let r,s;const o=[],a=[];let c,l=0,d=!1;for(;l<i;){for(c=t[l];l<i&&void 0!==(s=n[l],r=Zi(s));)c+=r+t[++l],d=!0;l!==i&&a.push(s),o.push(c),l++}if(l===i&&o.push(t[i]),d){const e=o.join("$$lit$$");void 0===(t=er.get(e))&&(o.raw=o,er.set(e,t=o)),n=a}return e(t,...n)},nr=tr(_);
54
54
  /**
55
55
  * @license
56
56
  * Copyright 2018 Google LLC
57
57
  * SPDX-License-Identifier: BSD-3-Clause
58
- */const ds=e=>e??E;var hs=class extends R{constructor(){super(...arguments);this.hasFocus=false;this.label="";this.disabled=false}handleBlur(){this.hasFocus=false;this.emit("sl-blur")}handleFocus(){this.hasFocus=true;this.emit("sl-focus")}handleClick(e){if(this.disabled){e.preventDefault();e.stopPropagation()}}click(){this.button.click()}focus(e){this.button.focus(e)}blur(){this.button.blur()}render(){const e=this.href?true:false;const t=e?os`a`:os`button`;return ls`
58
+ */const ir=e=>e??E;var rr=class extends I{constructor(){super(...arguments);this.hasFocus=false;this.label="";this.disabled=false}handleBlur(){this.hasFocus=false;this.emit("sl-blur")}handleFocus(){this.hasFocus=true;this.emit("sl-focus")}handleClick(e){if(this.disabled){e.preventDefault();e.stopPropagation()}}click(){this.button.click()}focus(e){this.button.focus(e)}blur(){this.button.blur()}render(){const e=this.href?true:false;const t=e?Qi`a`:Qi`button`;return nr`
59
59
  <${t}
60
60
  part="base"
61
61
  class=${W({"icon-button":true,"icon-button--disabled":!e&&this.disabled,"icon-button--focused":this.hasFocus})}
62
- ?disabled=${ds(e?void 0:this.disabled)}
63
- type=${ds(e?void 0:"button")}
64
- href=${ds(e?this.href:void 0)}
65
- target=${ds(e?this.target:void 0)}
66
- download=${ds(e?this.download:void 0)}
67
- rel=${ds(e&&this.target?"noreferrer noopener":void 0)}
68
- role=${ds(e?void 0:"button")}
62
+ ?disabled=${ir(e?void 0:this.disabled)}
63
+ type=${ir(e?void 0:"button")}
64
+ href=${ir(e?this.href:void 0)}
65
+ target=${ir(e?this.target:void 0)}
66
+ download=${ir(e?this.download:void 0)}
67
+ rel=${ir(e&&this.target?"noreferrer noopener":void 0)}
68
+ role=${ir(e?void 0:"button")}
69
69
  aria-disabled=${this.disabled?"true":"false"}
70
70
  aria-label="${this.label}"
71
71
  tabindex=${this.disabled?"-1":"0"}
@@ -75,13 +75,13 @@ import{d as e,r as t,h as n,H as i,e as s,f as r,i as o,j as a}from"./p-99602d8c
75
75
  >
76
76
  <sl-icon
77
77
  class="icon-button__icon"
78
- name=${ds(this.name)}
79
- library=${ds(this.library)}
80
- src=${ds(this.src)}
78
+ name=${ir(this.name)}
79
+ library=${ir(this.library)}
80
+ src=${ir(this.src)}
81
81
  aria-hidden="true"
82
82
  ></sl-icon>
83
83
  </${t}>
84
- `}};hs.styles=[A,is];hs.dependencies={"sl-icon":T};C([O(".icon-button")],hs.prototype,"button",2);C([I()],hs.prototype,"hasFocus",2);C([P()],hs.prototype,"name",2);C([P()],hs.prototype,"library",2);C([P()],hs.prototype,"src",2);C([P()],hs.prototype,"href",2);C([P()],hs.prototype,"target",2);C([P()],hs.prototype,"download",2);C([P()],hs.prototype,"label",2);C([P({type:Boolean,reflect:true})],hs.prototype,"disabled",2);var us=class{constructor(e,...t){this.slotNames=[];this.handleSlotChange=e=>{const t=e.target;if(this.slotNames.includes("[default]")&&!t.name||t.name&&this.slotNames.includes(t.name)){this.host.requestUpdate()}};(this.host=e).addController(this);this.slotNames=t}hasDefaultSlot(){return[...this.host.childNodes].some((e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent.trim()!==""){return true}if(e.nodeType===e.ELEMENT_NODE){const t=e;const n=t.tagName.toLowerCase();if(n==="sl-visually-hidden"){return false}if(!t.hasAttribute("slot")){return true}}return false}))}hasNamedSlot(e){return this.host.querySelector(`:scope > [slot="${e}"]`)!==null}test(e){return e==="[default]"?this.hasDefaultSlot():this.hasNamedSlot(e)}hostConnected(){this.host.shadowRoot.addEventListener("slotchange",this.handleSlotChange)}hostDisconnected(){this.host.shadowRoot.removeEventListener("slotchange",this.handleSlotChange)}};function fs(e){if(!e){return""}const t=e.assignedNodes({flatten:true});let n="";[...t].forEach((e=>{if(e.nodeType===Node.TEXT_NODE){n+=e.textContent}}));return n}var ps=S`
84
+ `}};rr.styles=[A,Gi];rr.dependencies={"sl-icon":C};T([O(".icon-button")],rr.prototype,"button",2);T([z()],rr.prototype,"hasFocus",2);T([$()],rr.prototype,"name",2);T([$()],rr.prototype,"library",2);T([$()],rr.prototype,"src",2);T([$()],rr.prototype,"href",2);T([$()],rr.prototype,"target",2);T([$()],rr.prototype,"download",2);T([$()],rr.prototype,"label",2);T([$({type:Boolean,reflect:true})],rr.prototype,"disabled",2);var sr=class{constructor(e,...t){this.slotNames=[];this.handleSlotChange=e=>{const t=e.target;if(this.slotNames.includes("[default]")&&!t.name||t.name&&this.slotNames.includes(t.name)){this.host.requestUpdate()}};(this.host=e).addController(this);this.slotNames=t}hasDefaultSlot(){return[...this.host.childNodes].some((e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent.trim()!==""){return true}if(e.nodeType===e.ELEMENT_NODE){const t=e;const n=t.tagName.toLowerCase();if(n==="sl-visually-hidden"){return false}if(!t.hasAttribute("slot")){return true}}return false}))}hasNamedSlot(e){return this.host.querySelector(`:scope > [slot="${e}"]`)!==null}test(e){return e==="[default]"?this.hasDefaultSlot():this.hasNamedSlot(e)}hostConnected(){this.host.shadowRoot.addEventListener("slotchange",this.handleSlotChange)}hostDisconnected(){this.host.shadowRoot.removeEventListener("slotchange",this.handleSlotChange)}};function or(e){if(!e){return""}const t=e.assignedNodes({flatten:true});let n="";[...t].forEach((e=>{if(e.nodeType===Node.TEXT_NODE){n+=e.textContent}}));return n}var ar=S`
85
85
  :host {
86
86
  display: contents;
87
87
 
@@ -221,7 +221,7 @@ import{d as e,r as t,h as n,H as i,e as s,f as r,i as o,j as a}from"./p-99602d8c
221
221
  .alert__timer {
222
222
  display: none;
223
223
  }
224
- `;var bs=class e extends R{constructor(){super(...arguments);this.hasSlotController=new us(this,"icon","suffix");this.localize=new j(this);this.open=false;this.closable=false;this.variant="primary";this.duration=Infinity;this.remainingTime=this.duration}static get toastStack(){if(!this.currentToastStack){this.currentToastStack=Object.assign(document.createElement("div"),{className:"sl-toast-stack"})}return this.currentToastStack}firstUpdated(){this.base.hidden=!this.open}restartAutoHide(){this.handleCountdownChange();clearTimeout(this.autoHideTimeout);clearInterval(this.remainingTimeInterval);if(this.open&&this.duration<Infinity){this.autoHideTimeout=window.setTimeout((()=>this.hide()),this.duration);this.remainingTime=this.duration;this.remainingTimeInterval=window.setInterval((()=>{this.remainingTime-=100}),100)}}pauseAutoHide(){var e;(e=this.countdownAnimation)==null?void 0:e.pause();clearTimeout(this.autoHideTimeout);clearInterval(this.remainingTimeInterval)}resumeAutoHide(){var e;if(this.duration<Infinity){this.autoHideTimeout=window.setTimeout((()=>this.hide()),this.remainingTime);this.remainingTimeInterval=window.setInterval((()=>{this.remainingTime-=100}),100);(e=this.countdownAnimation)==null?void 0:e.play()}}handleCountdownChange(){if(this.open&&this.duration<Infinity&&this.countdown){const{countdownElement:e}=this;const t="100%";const n="0";this.countdownAnimation=e.animate([{width:t},{width:n}],{duration:this.duration,easing:"linear"})}}handleCloseClick(){this.hide()}async handleOpenChange(){if(this.open){this.emit("sl-show");if(this.duration<Infinity){this.restartAutoHide()}await U(this.base);this.base.hidden=false;const{keyframes:e,options:t}=J(this,"alert.show",{dir:this.localize.dir()});await K(this.base,e,t);this.emit("sl-after-show")}else{ns(this);this.emit("sl-hide");clearTimeout(this.autoHideTimeout);clearInterval(this.remainingTimeInterval);await U(this.base);const{keyframes:e,options:t}=J(this,"alert.hide",{dir:this.localize.dir()});await K(this.base,e,t);this.base.hidden=true;this.emit("sl-after-hide")}}handleDurationChange(){this.restartAutoHide()}async show(){if(this.open){return void 0}this.open=true;return H(this,"sl-after-show")}async hide(){if(!this.open){return void 0}this.open=false;return H(this,"sl-after-hide")}async toast(){return new Promise((t=>{this.handleCountdownChange();if(e.toastStack.parentElement===null){document.body.append(e.toastStack)}e.toastStack.appendChild(this);requestAnimationFrame((()=>{this.show()}));this.addEventListener("sl-after-hide",(()=>{e.toastStack.removeChild(this);t();if(e.toastStack.querySelector("sl-alert")===null){e.toastStack.remove()}}),{once:true})}))}render(){return _`
224
+ `;var cr=class e extends I{constructor(){super(...arguments);this.hasSlotController=new sr(this,"icon","suffix");this.localize=new j(this);this.open=false;this.closable=false;this.variant="primary";this.duration=Infinity;this.remainingTime=this.duration}static get toastStack(){if(!this.currentToastStack){this.currentToastStack=Object.assign(document.createElement("div"),{className:"sl-toast-stack"})}return this.currentToastStack}firstUpdated(){this.base.hidden=!this.open}restartAutoHide(){this.handleCountdownChange();clearTimeout(this.autoHideTimeout);clearInterval(this.remainingTimeInterval);if(this.open&&this.duration<Infinity){this.autoHideTimeout=window.setTimeout((()=>this.hide()),this.duration);this.remainingTime=this.duration;this.remainingTimeInterval=window.setInterval((()=>{this.remainingTime-=100}),100)}}pauseAutoHide(){var e;(e=this.countdownAnimation)==null?void 0:e.pause();clearTimeout(this.autoHideTimeout);clearInterval(this.remainingTimeInterval)}resumeAutoHide(){var e;if(this.duration<Infinity){this.autoHideTimeout=window.setTimeout((()=>this.hide()),this.remainingTime);this.remainingTimeInterval=window.setInterval((()=>{this.remainingTime-=100}),100);(e=this.countdownAnimation)==null?void 0:e.play()}}handleCountdownChange(){if(this.open&&this.duration<Infinity&&this.countdown){const{countdownElement:e}=this;const t="100%";const n="0";this.countdownAnimation=e.animate([{width:t},{width:n}],{duration:this.duration,easing:"linear"})}}handleCloseClick(){this.hide()}async handleOpenChange(){if(this.open){this.emit("sl-show");if(this.duration<Infinity){this.restartAutoHide()}await U(this.base);this.base.hidden=false;const{keyframes:e,options:t}=J(this,"alert.show",{dir:this.localize.dir()});await K(this.base,e,t);this.emit("sl-after-show")}else{qi(this);this.emit("sl-hide");clearTimeout(this.autoHideTimeout);clearInterval(this.remainingTimeInterval);await U(this.base);const{keyframes:e,options:t}=J(this,"alert.hide",{dir:this.localize.dir()});await K(this.base,e,t);this.base.hidden=true;this.emit("sl-after-hide")}}handleDurationChange(){this.restartAutoHide()}async show(){if(this.open){return void 0}this.open=true;return H(this,"sl-after-show")}async hide(){if(!this.open){return void 0}this.open=false;return H(this,"sl-after-hide")}async toast(){return new Promise((t=>{this.handleCountdownChange();if(e.toastStack.parentElement===null){document.body.append(e.toastStack)}e.toastStack.appendChild(this);requestAnimationFrame((()=>{this.show()}));this.addEventListener("sl-after-hide",(()=>{e.toastStack.removeChild(this);t();if(e.toastStack.querySelector("sl-alert")===null){e.toastStack.remove()}}),{once:true})}))}render(){return _`
225
225
  <div
226
226
  part="base"
227
227
  class=${W({alert:true,"alert--open":this.open,"alert--closable":this.closable,"alert--has-countdown":!!this.countdown,"alert--has-icon":this.hasSlotController.test("icon"),"alert--primary":this.variant==="primary","alert--success":this.variant==="success","alert--neutral":this.variant==="neutral","alert--warning":this.variant==="warning","alert--danger":this.variant==="danger"})}
@@ -260,7 +260,7 @@ import{d as e,r as t,h as n,H as i,e as s,f as r,i as o,j as a}from"./p-99602d8c
260
260
  </div>
261
261
  `:""}
262
262
  </div>
263
- `}};bs.styles=[A,ps];bs.dependencies={"sl-icon-button":hs};C([O('[part~="base"]')],bs.prototype,"base",2);C([O(".alert__countdown-elapsed")],bs.prototype,"countdownElement",2);C([P({type:Boolean,reflect:true})],bs.prototype,"open",2);C([P({type:Boolean,reflect:true})],bs.prototype,"closable",2);C([P({reflect:true})],bs.prototype,"variant",2);C([P({type:Number})],bs.prototype,"duration",2);C([P({type:String,reflect:true})],bs.prototype,"countdown",2);C([I()],bs.prototype,"remainingTime",2);C([z("open",{waitUntilFirstUpdate:true})],bs.prototype,"handleOpenChange",1);C([z("duration")],bs.prototype,"handleDurationChange",1);var ms=bs;L("alert.show",{keyframes:[{opacity:0,scale:.8},{opacity:1,scale:1}],options:{duration:250,easing:"ease"}});L("alert.hide",{keyframes:[{opacity:1,scale:1},{opacity:0,scale:.8}],options:{duration:250,easing:"ease"}});ms.define("sl-alert");const gs=class{constructor(e){t(this,e)}async unhandledRejection(e){e.stopPropagation();console.error("unhandled promise rejection",e);this.title="Unhandled promise rejection";this.message=e.reason.toString()}async catchError(e){e.stopPropagation();console.error(e.detail);if(e.detail instanceof Error){this.title="Error";this.message=e.detail.message}else{const t=e.detail;this.title=t.title;this.message=t.detail}await this.alert.toast()}render(){return n(i,{key:"a383b7a1dfb34a6be7d3c0a68b2c1535cef83730"},n("sl-alert",{key:"f0935768722535c5bbaded12e20dc021a3341122",ref:e=>this.alert=e,variant:"danger",duration:"10000",closable:true},n("sl-icon",{key:"c673059f17bd1690cec36f3a9a091ee833efcef0",slot:"icon",name:"exclamation-octagon"}),n("strong",{key:"1dbb54a4c87b99163a4e655085081255e1493225"},this.title),n("br",{key:"52c25e78c971bc7dc649f35846ac5f7d0e8870d2"}),this.message),n("slot",{key:"f1cc221122bed520f2ba4987c19af8849af58bf8"}))}};const ws=":host{border:var(--size-px) solid var(--pos-border-color);border-radius:var(--radius-lg);box-shadow:var(--shadow-md);padding:var(--size-8);max-width:var(--size-96);background:var(--pos-card-background)}.links{display:flex;flex-direction:column;gap:var(--size-3);max-width:80vw}";const ys=ws;const vs=class{constructor(e){t(this,e)}render(){return n(i,{key:"42e8ecc30fa26eb7750efff9a65048bb42b4c71d"},n("div",{key:"1df80385f1f6c44f7fe4255ecb93f6183df61727"},n("h2",{key:"9b249d38f00d1b00863226799bdcd13e4f78a4a9"},"Try these... 💡"),n("p",{key:"c33157b085b1ad3397e38bf5f4b1c601b0e40b6a"},"No idea where to start? Try these example resources, and follow your nose 👃"),n("div",{key:"f0f35cc2ec1f7fbf8a306e718e1f2aaffcbe84e0",class:"links"},n("pos-rich-link",{key:"999b7dc0aa587b1964838820f17a02257b051c0e",uri:"https://pod-os.solidcommunity.net/profile/card#me"}),n("pos-rich-link",{key:"67ca02160d0bdaa73bcfb188fcf40b058a584bf8",uri:"https://angelo.veltens.org/profile/card#me"}),n("pos-rich-link",{key:"800829fb68c96b0caa0ad2372b02e08b7842b704",uri:"https://angelo.veltens.org/public/bookmarks"}),n("pos-rich-link",{key:"680e29b8bf0437d6adba15052339b91ffd41b9a4",uri:"https://solidos.solidcommunity.net/profile/card#me"}))))}};vs.style=ys;const ks=":host{border:var(--size-px) solid var(--pos-border-color);border-radius:var(--radius-lg);box-shadow:var(--shadow-md);padding:var(--size-8);max-width:var(--size-96);background:var(--pos-card-background)}.question{font-weight:var(--weight-semibold)}a{font-weight:var(--weight-bold);color:var(--pos-primary-color)}button.login{background:none;color:var(--pos-primary-color);display:inline;text-decoration:underline;border:none;padding:0;margin:0;cursor:pointer;font-size:unset}";const xs=ks;const Ss=class{constructor(e){t(this,e);this.login=r(this,"pod-os:login",7)}render(){return n(i,{key:"23a14b5ee10d585cc8cf3166ce041072b68cabb2"},n("div",{key:"964e46223d77516aaed40c7c55371716cfccf40a"},n("h2",{key:"5eaf56d6b0751d8511632d05570a05d5deba88c0"},"Getting started 🚀"),n("p",{key:"f41d858112a0337bcf2be9a39986cacac6921210"},"🔎 Enter a URL into the above navigation bar to browse through the web of data. "),n("p",{key:"8d40de32d86b871343687b402122b0dcc843daf9"},"🔐"," ",n("button",{key:"225091e03c1cf175362dc9530cf1eb5238e50d65",class:"login",onClick:()=>this.login.emit()},"Sign in")," ","to access private resources on your Solid Pod or those of your friends or coworkers.")),n("div",{key:"92924f3a67ac70cd333932f0658f9f73dd7474c9"},n("p",{key:"365d7c78aee4bb9396ac7d55c42c9e26b47fe87a",class:"question"},"New to Solid?"),n("p",{key:"42190c0f401faff3cf43fe8f3c69f4afc380f819"},n("a",{key:"d7de0d55a657c8a54a389efc50aa89bc4d48c5e6",href:"https://solidproject.org/for-developers#hosted-pod-services"},"Get a Pod →"))),n("div",{key:"8ad728231a1f2af613a462982af6bf129956ab1c"},n("p",{key:"c960fa49ff9789fe881cadc4f37d315c7727115a",class:"question"},"Want to dig deeper into PodOS?"),n("p",{key:"7991e91dbfdfc0447a2e08850e3634086f3f12ee"},n("a",{key:"a35d336eb2ca5947e66abb9e37526ee035c0a700",href:"http://pod-os.org"},"Learn more →"))))}};Ss.style=xs;const _s=":host{display:flex;background-size:cover;background-repeat:no-repeat;background-position:center;border-radius:inherit}img,ion-skeleton-text,div.error{border-radius:var(--border-radius);width:var(--width);height:var(--height);max-width:var(--max-width);max-height:var(--max-height);object-fit:var(--object-fit)}img{backdrop-filter:var(--blur-xl)}.error{display:flex;opacity:0.8;background:repeating-linear-gradient(-45deg, rgba(150, 0, 0, 0.1), rgba(150, 0, 0, 0.1) 10px, #fff 5px, #fff 25px);flex-direction:column;border:1px solid red;color:black;align-items:center;justify-content:center;word-break:break-all;padding:1rem;box-sizing:border-box}.error ion-icon{color:#282828;--ionicon-stroke-width:calc(var(--width) / 5);font-size:calc(var(--width) / 2)}a.error{text-decoration:none;width:var(--width);height:var(--height)}.code{font-weight:bold;font-size:calc(var(--width) / 8)}.text{font-size:calc(var(--width) / 20)}";const Es=_s;const As=class{constructor(e){t(this,e);this.initializeOsEmitter=r(this,"pod-os:init",7);this.resourceLoadedEmitter=r(this,"pod-os:resource-loaded",7);this.blurredBackground=false;this.loading=true;this.setOs=async e=>{this.os=e}}componentWillLoad(){p.onChange("isLoggedIn",(()=>this.fetchBlob()));this.initializeOsEmitter.emit(this.setOs)}async fetchBlob(){try{this.loading=true;this.imageError=null;this.networkError=null;this.brokenFile=null;const e=await this.os.files().fetchFile(this.src);this.resourceLoadedEmitter.emit(this.src);if(e.blob()){this.dataUri=URL.createObjectURL(e.blob())}else{this.brokenFile=e}}catch(e){this.networkError=e}finally{this.loading=false}}onImageError(e){this.networkError=null;this.imageError=e}render(){if(this.loading){return n("ion-skeleton-text",{animated:true})}if(this.networkError){return n("img",{alt:this.alt,src:this.src,onError:e=>this.onImageError(e)})}if(this.brokenFile){return n(b,{file:this.brokenFile})}if(this.imageError){return n("div",{class:"error"},n("a",{href:this.src},this.src))}return n(i,{style:{backgroundImage:this.blurredBackground?`url('${this.dataUri}')`:null}},n("img",{src:this.dataUri,alt:this.alt}))}static get watchers(){return{os:["fetchBlob"],src:["fetchBlob"]}}};As.style=Es;const Ts=class{constructor(e){t(this,e);this.uri="pod-os:dashboard"}render(){return this.uri==="pod-os:settings"?n("pos-app-settings",null):n("pos-app-dashboard",null)}};const Cs=class{constructor(e){t(this,e);this.subscribeResource=r(this,"pod-os:resource",7);this.receiveResource=e=>{this.resource=e}}componentWillLoad(){x(this)}render(){return this.resource?this.resource.label():null}};const Rs=".container{display:flex;align-items:center;gap:var(--size-2)}.user-data{align-items:center;display:inline-flex;gap:10px}.user-data pos-picture{--width:40px;--height:40px;--border-radius:50%}pos-login-form{margin:var(--size-2)}dialog{margin-top:var(--size-10)}button#login,button#logout{outline:none;font-weight:var(--weight-bold);letter-spacing:var(--letter-xl);border:none;box-sizing:border-box;border-radius:var(--radius-xs);padding:var(--size-2);box-shadow:var(--shadow-sm);color:var(--pos-primary-text-color);background-color:var(--pos-primary-color)}button#login:focus-within,button#logout:focus-within{outline:var(--pos-input-focus-outline)}button#login:focus,button#login:hover,button#logout:focus,button#logout:hover{filter:brightness(110%);box-shadow:var(--shadow-md)}";const Is=Rs;const Ps=class{constructor(e){t(this,e);this.initializeOsEmitter=r(this,"pod-os:init",7);this.customLoggedInComponent=false;this.setOs=async e=>{this.os=e}}componentWillLoad(){this.customLoggedInComponent=!!this.host.querySelector('[slot="if-logged-in"]');this.initializeOsEmitter.emit(this.setOs)}login(e){const t=e.detail;this.os.login(t)}logout(){this.os.logout()}onLogin(){this.openDialog()}openDialog(){this.dialog.showModal()}render(){return n(i,{key:"629107a1282e2db90a71605535e1a28a61a251af"},n("div",{key:"377851ec061b30aa961ae677a4861f5ec6e297d7",class:"container"},!p.state.isLoggedIn?n("button",{id:"login",onClick:()=>this.openDialog()},"Login"):this.loggedInComponents()),n("pos-dialog",{key:"0572fe81ccde84aa96bce1f22018a8bdf0329adb",ref:e=>this.dialog=e},n("span",{key:"5414b1f7d70ea78591e8357b0a03fd08671ec6e7",slot:"title"},"Sign in to your Pod"),n("pos-login-form",{key:"07bad99f318e39f908116783b8bc0f9d9cd358a9","onPod-os:idp-url-selected":e=>this.login(e),slot:"content"})))}loggedInComponents(){return this.customLoggedInComponent?n("slot",{name:"if-logged-in"}):this.defaultLoggedInComponents()}defaultLoggedInComponents(){return[n("pos-resource",{uri:p.state.webId},n("span",{class:"user-data"},n("pos-picture",null),n("pos-label",null))),n("button",{id:"logout",onClick:()=>this.logout()},"Logout")]}get host(){return s(this)}};Ps.style=Is;const zs=":host{display:block;margin:0}form{display:flex;flex-direction:column;gap:var(--size-4)}input{outline:var(--pos-input-outline);padding:var(--scale-000);border:none;border-radius:var(--radius-xs);width:var(--size-full);box-sizing:border-box;background:var(--pos-input-background-color);color:var(--pos-normal-text-color)}input:focus-within{outline:var(--pos-input-focus-outline)}input#login{outline:none;box-shadow:var(--shadow-sm);cursor:pointer;color:var(--pos-primary-text-color);background-color:var(--pos-primary-color)}input#login:disabled{cursor:default;color:var(--pos-disabled-text-color);background-color:var(--pos-disabled-color);box-shadow:none}input#login:hover:not(:disabled),input#login:focus{filter:brightness(110%);box-shadow:var(--shadow-md)}";const $s=zs;const Ds=class{constructor(e){t(this,e);this.idpUrlSelected=r(this,"pod-os:idp-url-selected",7);this.idpUrl="";this.canSubmit=false}validate(){this.canSubmit=Boolean(this.idpUrl)}render(){return n("form",{key:"18b8b66ebfd121c33bf5e7e3f71829b643b92fee",method:"dialog",onSubmit:()=>this.handleSubmit()},n("label",{key:"754c2e392c0e078eb54471838a6a1b1b84a7fc39",htmlFor:"idpUrl"},"Please enter your Identity Provider"),n("input",{key:"e5c510ace3893f7a19117b87f4c8fddd418bb82f",id:"idpUrl",type:"url",value:this.idpUrl,required:true,onInput:e=>this.handleChange(e),list:"suggestedIssuers",placeholder:"Type to search..."}),n("datalist",{key:"19181c9050a562a78bcff28c6e2bd77fcd51dc81",id:"suggestedIssuers"},n("option",{key:"e0f05b8f4f1ebd9f2d5b0b964efd57943bba7095",value:"https://solidcommunity.net/"},"solidcommunity.net"),n("option",{key:"31ef91494e7fe992590e926235a07eb234ebd07f",value:"https://solidweb.me/"},"solidweb.me"),n("option",{key:"e7e0646134b9f89785f8349c0ee3f002a0f5f747",value:"https://login.inrupt.com"},"Inrupt PodSpaces"),n("option",{key:"5c4231cf451e5d1c6570b15913a8749677cb95fc",value:"https://trinpod.us"},"trinpod.us"),n("option",{key:"f0ebd336250c1b1efa9d92e638a3f1f88abfd82b",value:"https://trinpod.eu"},"trinpod.eu"),n("option",{key:"d7bd67b6e673479880617ae37ef5fd53af9ec3a9",value:"https://solid.redpencil.io/"},"redpencil.io"),n("option",{key:"2060fa5b05306cc1cf3ac004c956f3e1f0ae6ea9",value:"https://teamid.live/"},"teamid.live")),n("input",{key:"5ddd6bfce924dc90834647f3ceed4497d20bb9d8",id:"login",type:"submit",value:"Login",disabled:!this.canSubmit}))}handleChange(e){this.validate();this.idpUrl=e.target.value}async handleSubmit(){this.idpUrlSelected.emit(this.idpUrl)}static get delegatesFocus(){return true}static get watchers(){return{idpUrl:["validate"]}}};Ds.style=$s;var Ws=S`
263
+ `}};cr.styles=[A,ar];cr.dependencies={"sl-icon-button":rr};T([O('[part~="base"]')],cr.prototype,"base",2);T([O(".alert__countdown-elapsed")],cr.prototype,"countdownElement",2);T([$({type:Boolean,reflect:true})],cr.prototype,"open",2);T([$({type:Boolean,reflect:true})],cr.prototype,"closable",2);T([$({reflect:true})],cr.prototype,"variant",2);T([$({type:Number})],cr.prototype,"duration",2);T([$({type:String,reflect:true})],cr.prototype,"countdown",2);T([z()],cr.prototype,"remainingTime",2);T([R("open",{waitUntilFirstUpdate:true})],cr.prototype,"handleOpenChange",1);T([R("duration")],cr.prototype,"handleDurationChange",1);var lr=cr;L("alert.show",{keyframes:[{opacity:0,scale:.8},{opacity:1,scale:1}],options:{duration:250,easing:"ease"}});L("alert.hide",{keyframes:[{opacity:1,scale:1},{opacity:0,scale:.8}],options:{duration:250,easing:"ease"}});lr.define("sl-alert");const dr=class{constructor(e){t(this,e)}async unhandledRejection(e){e.stopPropagation();console.error("unhandled promise rejection",e);this.title="Unhandled promise rejection";this.message=e.reason.toString()}async catchError(e){e.stopPropagation();console.error(e.detail);if(e.detail instanceof Error){this.title="Error";this.message=e.detail.message}else{const t=e.detail;this.title=t.title;this.message=t.detail}await this.alert.toast()}render(){return n(i,{key:"a383b7a1dfb34a6be7d3c0a68b2c1535cef83730"},n("sl-alert",{key:"f0935768722535c5bbaded12e20dc021a3341122",ref:e=>this.alert=e,variant:"danger",duration:"10000",closable:true},n("sl-icon",{key:"c673059f17bd1690cec36f3a9a091ee833efcef0",slot:"icon",name:"exclamation-octagon"}),n("strong",{key:"1dbb54a4c87b99163a4e655085081255e1493225"},this.title),n("br",{key:"52c25e78c971bc7dc649f35846ac5f7d0e8870d2"}),this.message),n("slot",{key:"f1cc221122bed520f2ba4987c19af8849af58bf8"}))}};const hr=":host{border:var(--size-px) solid var(--pos-border-color);border-radius:var(--radius-lg);box-shadow:var(--shadow-md);padding:var(--size-8);max-width:var(--size-96);background:var(--pos-card-background)}.links{display:flex;flex-direction:column;gap:var(--size-3);max-width:80vw}";const ur=hr;const fr=class{constructor(e){t(this,e)}render(){return n(i,{key:"42e8ecc30fa26eb7750efff9a65048bb42b4c71d"},n("div",{key:"1df80385f1f6c44f7fe4255ecb93f6183df61727"},n("h2",{key:"9b249d38f00d1b00863226799bdcd13e4f78a4a9"},"Try these... 💡"),n("p",{key:"c33157b085b1ad3397e38bf5f4b1c601b0e40b6a"},"No idea where to start? Try these example resources, and follow your nose 👃"),n("div",{key:"f0f35cc2ec1f7fbf8a306e718e1f2aaffcbe84e0",class:"links"},n("pos-rich-link",{key:"999b7dc0aa587b1964838820f17a02257b051c0e",uri:"https://pod-os.solidcommunity.net/profile/card#me"}),n("pos-rich-link",{key:"67ca02160d0bdaa73bcfb188fcf40b058a584bf8",uri:"https://angelo.veltens.org/profile/card#me"}),n("pos-rich-link",{key:"800829fb68c96b0caa0ad2372b02e08b7842b704",uri:"https://angelo.veltens.org/public/bookmarks"}),n("pos-rich-link",{key:"680e29b8bf0437d6adba15052339b91ffd41b9a4",uri:"https://solidos.solidcommunity.net/profile/card#me"}))))}};fr.style=ur;const pr=":host{border:var(--size-px) solid var(--pos-border-color);border-radius:var(--radius-lg);box-shadow:var(--shadow-md);padding:var(--size-8);max-width:var(--size-96);background:var(--pos-card-background)}.question{font-weight:var(--weight-semibold)}a{font-weight:var(--weight-bold);color:var(--pos-primary-color)}button.login{background:none;color:var(--pos-primary-color);display:inline;text-decoration:underline;border:none;padding:0;margin:0;cursor:pointer;font-size:unset}";const br=pr;const mr=class{constructor(e){t(this,e);this.login=s(this,"pod-os:login",7)}render(){return n(i,{key:"23a14b5ee10d585cc8cf3166ce041072b68cabb2"},n("div",{key:"964e46223d77516aaed40c7c55371716cfccf40a"},n("h2",{key:"5eaf56d6b0751d8511632d05570a05d5deba88c0"},"Getting started 🚀"),n("p",{key:"f41d858112a0337bcf2be9a39986cacac6921210"},"🔎 Enter a URL into the above navigation bar to browse through the web of data. "),n("p",{key:"8d40de32d86b871343687b402122b0dcc843daf9"},"🔐"," ",n("button",{key:"225091e03c1cf175362dc9530cf1eb5238e50d65",class:"login",onClick:()=>this.login.emit()},"Sign in")," ","to access private resources on your Solid Pod or those of your friends or coworkers.")),n("div",{key:"92924f3a67ac70cd333932f0658f9f73dd7474c9"},n("p",{key:"365d7c78aee4bb9396ac7d55c42c9e26b47fe87a",class:"question"},"New to Solid?"),n("p",{key:"42190c0f401faff3cf43fe8f3c69f4afc380f819"},n("a",{key:"d7de0d55a657c8a54a389efc50aa89bc4d48c5e6",href:"https://solidproject.org/for-developers#hosted-pod-services"},"Get a Pod →"))),n("div",{key:"8ad728231a1f2af613a462982af6bf129956ab1c"},n("p",{key:"c960fa49ff9789fe881cadc4f37d315c7727115a",class:"question"},"Want to dig deeper into PodOS?"),n("p",{key:"7991e91dbfdfc0447a2e08850e3634086f3f12ee"},n("a",{key:"a35d336eb2ca5947e66abb9e37526ee035c0a700",href:"http://pod-os.org"},"Learn more →"))))}};mr.style=br;const gr=":host{display:flex;background-size:cover;background-repeat:no-repeat;background-position:center;border-radius:inherit}img,ion-skeleton-text,div.error{border-radius:var(--border-radius);width:var(--width);height:var(--height);max-width:var(--max-width);max-height:var(--max-height);object-fit:var(--object-fit)}img{backdrop-filter:var(--blur-xl)}.error{display:flex;opacity:0.8;background:repeating-linear-gradient(-45deg, rgba(150, 0, 0, 0.1), rgba(150, 0, 0, 0.1) 10px, #fff 5px, #fff 25px);flex-direction:column;border:1px solid red;color:black;align-items:center;justify-content:center;word-break:break-all;padding:1rem;box-sizing:border-box}.error ion-icon{color:#282828;--ionicon-stroke-width:calc(var(--width) / 5);font-size:calc(var(--width) / 2)}a.error{text-decoration:none;width:var(--width);height:var(--height)}.code{font-weight:bold;font-size:calc(var(--width) / 8)}.text{font-size:calc(var(--width) / 20)}";const wr=gr;const vr=class{constructor(e){t(this,e);this.initializeOsEmitter=s(this,"pod-os:init",7);this.resourceLoadedEmitter=s(this,"pod-os:resource-loaded",7);this.blurredBackground=false;this.loading=true;this.setOs=async e=>{this.os=e}}componentWillLoad(){p.onChange("isLoggedIn",(()=>this.fetchBlob()));this.initializeOsEmitter.emit(this.setOs)}async fetchBlob(){try{this.loading=true;this.imageError=null;this.networkError=null;this.brokenFile=null;const e=await this.os.files().fetchFile(this.src);this.resourceLoadedEmitter.emit(this.src);if(e.blob()){this.dataUri=URL.createObjectURL(e.blob())}else{this.brokenFile=e}}catch(e){this.networkError=e}finally{this.loading=false}}onImageError(e){this.networkError=null;this.imageError=e}render(){if(this.loading){return n("ion-skeleton-text",{animated:true})}if(this.networkError){return n("img",{alt:this.alt,src:this.src,onError:e=>this.onImageError(e)})}if(this.brokenFile){return n(b,{file:this.brokenFile})}if(this.imageError){return n("div",{class:"error"},n("a",{href:this.src},this.src))}return n(i,{style:{backgroundImage:this.blurredBackground?`url('${this.dataUri}')`:null}},n("img",{src:this.dataUri,alt:this.alt}))}static get watchers(){return{os:["fetchBlob"],src:["fetchBlob"]}}};vr.style=wr;const yr=class{constructor(e){t(this,e);this.uri="pod-os:dashboard"}render(){return this.uri==="pod-os:settings"?n("pos-app-settings",null):n("pos-app-dashboard",null)}};const kr=class{constructor(e){t(this,e);this.subscribeResource=s(this,"pod-os:resource",7);this.receiveResource=e=>{this.resource=e}}componentWillLoad(){x(this)}render(){return this.resource?this.resource.label():null}};const xr=".container{display:flex;align-items:center;gap:var(--size-2)}.user-data{align-items:center;display:inline-flex;gap:10px}.user-data pos-picture{--width:40px;--height:40px;--border-radius:50%}pos-login-form{margin:var(--size-2)}dialog{margin-top:var(--size-10)}button#login,button#logout{outline:none;font-weight:var(--weight-bold);letter-spacing:var(--letter-xl);border:none;box-sizing:border-box;border-radius:var(--radius-xs);padding:var(--size-2);box-shadow:var(--shadow-sm);color:var(--pos-primary-text-color);background-color:var(--pos-primary-color)}button#login:focus-within,button#logout:focus-within{outline:var(--pos-input-focus-outline)}button#login:focus,button#login:hover,button#logout:focus,button#logout:hover{filter:brightness(110%);box-shadow:var(--shadow-md)}";const Sr=xr;const _r=class{constructor(e){t(this,e);this.initializeOsEmitter=s(this,"pod-os:init",7);this.customLoggedInComponent=false;this.setOs=async e=>{this.os=e}}componentWillLoad(){this.customLoggedInComponent=!!this.host.querySelector('[slot="if-logged-in"]');this.initializeOsEmitter.emit(this.setOs)}login(e){const t=e.detail;this.os.login(t)}logout(){this.os.logout()}onLogin(){this.openDialog()}openDialog(){this.dialog.showModal()}render(){return n(i,{key:"629107a1282e2db90a71605535e1a28a61a251af"},n("div",{key:"377851ec061b30aa961ae677a4861f5ec6e297d7",class:"container"},!p.state.isLoggedIn?n("button",{id:"login",onClick:()=>this.openDialog()},"Login"):this.loggedInComponents()),n("pos-dialog",{key:"0572fe81ccde84aa96bce1f22018a8bdf0329adb",ref:e=>this.dialog=e},n("span",{key:"5414b1f7d70ea78591e8357b0a03fd08671ec6e7",slot:"title"},"Sign in to your Pod"),n("pos-login-form",{key:"07bad99f318e39f908116783b8bc0f9d9cd358a9","onPod-os:idp-url-selected":e=>this.login(e),slot:"content"})))}loggedInComponents(){return this.customLoggedInComponent?n("slot",{name:"if-logged-in"}):this.defaultLoggedInComponents()}defaultLoggedInComponents(){return[n("pos-resource",{uri:p.state.webId},n("span",{class:"user-data"},n("pos-picture",null),n("pos-label",null))),n("button",{id:"logout",onClick:()=>this.logout()},"Logout")]}get host(){return r(this)}};_r.style=Sr;const Er=":host{display:block;margin:0}form{display:flex;flex-direction:column;gap:var(--size-4)}input{outline:var(--pos-input-outline);padding:var(--scale-000);border:none;border-radius:var(--radius-xs);width:var(--size-full);box-sizing:border-box;background:var(--pos-input-background-color);color:var(--pos-normal-text-color)}input:focus-within{outline:var(--pos-input-focus-outline)}input#login{outline:none;box-shadow:var(--shadow-sm);cursor:pointer;color:var(--pos-primary-text-color);background-color:var(--pos-primary-color)}input#login:disabled{cursor:default;color:var(--pos-disabled-text-color);background-color:var(--pos-disabled-color);box-shadow:none}input#login:hover:not(:disabled),input#login:focus{filter:brightness(110%);box-shadow:var(--shadow-md)}";const Ar=Er;const Cr=class{constructor(e){t(this,e);this.idpUrlSelected=s(this,"pod-os:idp-url-selected",7);this.idpUrl="";this.canSubmit=false}validate(){this.canSubmit=Boolean(this.idpUrl)}render(){return n("form",{key:"18b8b66ebfd121c33bf5e7e3f71829b643b92fee",method:"dialog",onSubmit:()=>this.handleSubmit()},n("label",{key:"754c2e392c0e078eb54471838a6a1b1b84a7fc39",htmlFor:"idpUrl"},"Please enter your Identity Provider"),n("input",{key:"e5c510ace3893f7a19117b87f4c8fddd418bb82f",id:"idpUrl",type:"url",value:this.idpUrl,required:true,onInput:e=>this.handleChange(e),list:"suggestedIssuers",placeholder:"Type to search..."}),n("datalist",{key:"19181c9050a562a78bcff28c6e2bd77fcd51dc81",id:"suggestedIssuers"},n("option",{key:"e0f05b8f4f1ebd9f2d5b0b964efd57943bba7095",value:"https://solidcommunity.net/"},"solidcommunity.net"),n("option",{key:"31ef91494e7fe992590e926235a07eb234ebd07f",value:"https://solidweb.me/"},"solidweb.me"),n("option",{key:"e7e0646134b9f89785f8349c0ee3f002a0f5f747",value:"https://login.inrupt.com"},"Inrupt PodSpaces"),n("option",{key:"5c4231cf451e5d1c6570b15913a8749677cb95fc",value:"https://trinpod.us"},"trinpod.us"),n("option",{key:"f0ebd336250c1b1efa9d92e638a3f1f88abfd82b",value:"https://trinpod.eu"},"trinpod.eu"),n("option",{key:"d7bd67b6e673479880617ae37ef5fd53af9ec3a9",value:"https://solid.redpencil.io/"},"redpencil.io"),n("option",{key:"2060fa5b05306cc1cf3ac004c956f3e1f0ae6ea9",value:"https://teamid.live/"},"teamid.live")),n("input",{key:"5ddd6bfce924dc90834647f3ceed4497d20bb9d8",id:"login",type:"submit",value:"Login",disabled:!this.canSubmit}))}handleChange(e){this.validate();this.idpUrl=e.target.value}async handleSubmit(){this.idpUrlSelected.emit(this.idpUrl)}static get delegatesFocus(){return true}static get watchers(){return{idpUrl:["validate"]}}};Cr.style=Ar;var Tr=S`
264
264
  :host {
265
265
  display: inline-block;
266
266
  }
@@ -308,7 +308,7 @@ import{d as e,r as t,h as n,H as i,e as s,f as r,i as o,j as a}from"./p-99602d8c
308
308
  max-width: var(--auto-size-available-width) !important;
309
309
  max-height: var(--auto-size-available-height) !important;
310
310
  }
311
- `;function*Os(e=document.activeElement){if(e===null||e===void 0)return;yield e;if("shadowRoot"in e&&e.shadowRoot&&e.shadowRoot.mode!=="closed"){yield*$(Os(e.shadowRoot.activeElement))}}function Ls(){return[...Os()].pop()}var js=new WeakMap;function Us(e){let t=js.get(e);if(!t){t=window.getComputedStyle(e,null);js.set(e,t)}return t}function Js(e){if(typeof e.checkVisibility==="function"){return e.checkVisibility({checkOpacity:false,checkVisibilityCSS:true})}const t=Us(e);return t.visibility!=="hidden"&&t.display!=="none"}function Ks(e){const t=Us(e);const{overflowY:n,overflowX:i}=t;if(n==="scroll"||i==="scroll"){return true}if(n!=="auto"||i!=="auto"){return false}const s=e.scrollHeight>e.clientHeight;if(s&&n==="auto"){return true}const r=e.scrollWidth>e.clientWidth;if(r&&i==="auto"){return true}return false}function Hs(e){const t=e.tagName.toLowerCase();const n=Number(e.getAttribute("tabindex"));const i=e.hasAttribute("tabindex");if(i&&(isNaN(n)||n<=-1)){return false}if(e.hasAttribute("disabled")){return false}if(e.closest("[inert]")){return false}if(t==="input"&&e.getAttribute("type")==="radio"){const t=e.getRootNode();const n=`input[type='radio'][name="${e.getAttribute("name")}"]`;const i=t.querySelector(`${n}:checked`);if(i){return i===e}const s=t.querySelector(n);return s===e}if(!Js(e)){return false}if((t==="audio"||t==="video")&&e.hasAttribute("controls")){return true}if(e.hasAttribute("tabindex")){return true}if(e.hasAttribute("contenteditable")&&e.getAttribute("contenteditable")!=="false"){return true}const s=["button","input","select","textarea","a","audio","video","summary","iframe"].includes(t);if(s){return true}return Ks(e)}function Ns(e){var t,n;const i=Bs(e);const s=(t=i[0])!=null?t:null;const r=(n=i[i.length-1])!=null?n:null;return{start:s,end:r}}function Ms(e,t){var n;return((n=e.getRootNode({composed:true}))==null?void 0:n.host)!==t}function Bs(e){const t=new WeakMap;const n=[];function i(s){if(s instanceof Element){if(s.hasAttribute("inert")||s.closest("[inert]")){return}if(t.has(s)){return}t.set(s,true);if(!n.includes(s)&&Hs(s)){n.push(s)}if(s instanceof HTMLSlotElement&&Ms(s,e)){s.assignedElements({flatten:true}).forEach((e=>{i(e)}))}if(s.shadowRoot!==null&&s.shadowRoot.mode==="open"){i(s.shadowRoot)}}for(const e of s.children){i(e)}}i(e);return n.sort(((e,t)=>{const n=Number(e.getAttribute("tabindex"))||0;const i=Number(t.getAttribute("tabindex"))||0;return i-n}))}var Xs=class extends R{constructor(){super(...arguments);this.localize=new j(this);this.open=false;this.placement="bottom-start";this.disabled=false;this.stayOpenOnSelect=false;this.distance=0;this.skidding=0;this.hoist=false;this.sync=void 0;this.handleKeyDown=e=>{if(this.open&&e.key==="Escape"){e.stopPropagation();this.hide();this.focusOnTrigger()}};this.handleDocumentKeyDown=e=>{var t;if(e.key==="Escape"&&this.open&&!this.closeWatcher){e.stopPropagation();this.focusOnTrigger();this.hide();return}if(e.key==="Tab"){if(this.open&&((t=document.activeElement)==null?void 0:t.tagName.toLowerCase())==="sl-menu-item"){e.preventDefault();this.hide();this.focusOnTrigger();return}const n=(e,t)=>{if(!e)return null;const i=e.closest(t);if(i)return i;const s=e.getRootNode();if(s instanceof ShadowRoot){return n(s.host,t)}return null};setTimeout((()=>{var e;const t=((e=this.containingElement)==null?void 0:e.getRootNode())instanceof ShadowRoot?Ls():document.activeElement;if(!this.containingElement||n(t,this.containingElement.tagName.toLowerCase())!==this.containingElement){this.hide()}}))}};this.handleDocumentMouseDown=e=>{const t=e.composedPath();if(this.containingElement&&!t.includes(this.containingElement)){this.hide()}};this.handlePanelSelect=e=>{const t=e.target;if(!this.stayOpenOnSelect&&t.tagName.toLowerCase()==="sl-menu"){this.hide();this.focusOnTrigger()}}}connectedCallback(){super.connectedCallback();if(!this.containingElement){this.containingElement=this}}firstUpdated(){this.panel.hidden=!this.open;if(this.open){this.addOpenListeners();this.popup.active=true}}disconnectedCallback(){super.disconnectedCallback();this.removeOpenListeners();this.hide()}focusOnTrigger(){const e=this.trigger.assignedElements({flatten:true})[0];if(typeof(e==null?void 0:e.focus)==="function"){e.focus()}}getMenu(){return this.panel.assignedElements({flatten:true}).find((e=>e.tagName.toLowerCase()==="sl-menu"))}handleTriggerClick(){if(this.open){this.hide()}else{this.show();this.focusOnTrigger()}}async handleTriggerKeyDown(e){if([" ","Enter"].includes(e.key)){e.preventDefault();this.handleTriggerClick();return}const t=this.getMenu();if(t){const n=t.getAllItems();const i=n[0];const s=n[n.length-1];if(["ArrowDown","ArrowUp","Home","End"].includes(e.key)){e.preventDefault();if(!this.open){this.show();await this.updateComplete}if(n.length>0){this.updateComplete.then((()=>{if(e.key==="ArrowDown"||e.key==="Home"){t.setCurrentItem(i);i.focus()}if(e.key==="ArrowUp"||e.key==="End"){t.setCurrentItem(s);s.focus()}}))}}}}handleTriggerKeyUp(e){if(e.key===" "){e.preventDefault()}}handleTriggerSlotChange(){this.updateAccessibleTrigger()}updateAccessibleTrigger(){const e=this.trigger.assignedElements({flatten:true});const t=e.find((e=>Ns(e).start));let n;if(t){switch(t.tagName.toLowerCase()){case"sl-button":case"sl-icon-button":n=t.button;break;default:n=t}n.setAttribute("aria-haspopup","true");n.setAttribute("aria-expanded",this.open?"true":"false")}}async show(){if(this.open){return void 0}this.open=true;return H(this,"sl-after-show")}async hide(){if(!this.open){return void 0}this.open=false;return H(this,"sl-after-hide")}reposition(){this.popup.reposition()}addOpenListeners(){var e;this.panel.addEventListener("sl-select",this.handlePanelSelect);if("CloseWatcher"in window){(e=this.closeWatcher)==null?void 0:e.destroy();this.closeWatcher=new CloseWatcher;this.closeWatcher.onclose=()=>{this.hide();this.focusOnTrigger()}}else{this.panel.addEventListener("keydown",this.handleKeyDown)}document.addEventListener("keydown",this.handleDocumentKeyDown);document.addEventListener("mousedown",this.handleDocumentMouseDown)}removeOpenListeners(){var e;if(this.panel){this.panel.removeEventListener("sl-select",this.handlePanelSelect);this.panel.removeEventListener("keydown",this.handleKeyDown)}document.removeEventListener("keydown",this.handleDocumentKeyDown);document.removeEventListener("mousedown",this.handleDocumentMouseDown);(e=this.closeWatcher)==null?void 0:e.destroy()}async handleOpenChange(){if(this.disabled){this.open=false;return}this.updateAccessibleTrigger();if(this.open){this.emit("sl-show");this.addOpenListeners();await U(this);this.panel.hidden=false;this.popup.active=true;const{keyframes:e,options:t}=J(this,"dropdown.show",{dir:this.localize.dir()});await K(this.popup.popup,e,t);this.emit("sl-after-show")}else{this.emit("sl-hide");this.removeOpenListeners();await U(this);const{keyframes:e,options:t}=J(this,"dropdown.hide",{dir:this.localize.dir()});await K(this.popup.popup,e,t);this.panel.hidden=true;this.popup.active=false;this.emit("sl-after-hide")}}render(){return _`
311
+ `;function*Ir(e=document.activeElement){if(e===null||e===void 0)return;yield e;if("shadowRoot"in e&&e.shadowRoot&&e.shadowRoot.mode!=="closed"){yield*P(Ir(e.shadowRoot.activeElement))}}function zr(){return[...Ir()].pop()}var $r=new WeakMap;function Rr(e){let t=$r.get(e);if(!t){t=window.getComputedStyle(e,null);$r.set(e,t)}return t}function Pr(e){if(typeof e.checkVisibility==="function"){return e.checkVisibility({checkOpacity:false,checkVisibilityCSS:true})}const t=Rr(e);return t.visibility!=="hidden"&&t.display!=="none"}function Dr(e){const t=Rr(e);const{overflowY:n,overflowX:i}=t;if(n==="scroll"||i==="scroll"){return true}if(n!=="auto"||i!=="auto"){return false}const r=e.scrollHeight>e.clientHeight;if(r&&n==="auto"){return true}const s=e.scrollWidth>e.clientWidth;if(s&&i==="auto"){return true}return false}function Wr(e){const t=e.tagName.toLowerCase();const n=Number(e.getAttribute("tabindex"));const i=e.hasAttribute("tabindex");if(i&&(isNaN(n)||n<=-1)){return false}if(e.hasAttribute("disabled")){return false}if(e.closest("[inert]")){return false}if(t==="input"&&e.getAttribute("type")==="radio"){const t=e.getRootNode();const n=`input[type='radio'][name="${e.getAttribute("name")}"]`;const i=t.querySelector(`${n}:checked`);if(i){return i===e}const r=t.querySelector(n);return r===e}if(!Pr(e)){return false}if((t==="audio"||t==="video")&&e.hasAttribute("controls")){return true}if(e.hasAttribute("tabindex")){return true}if(e.hasAttribute("contenteditable")&&e.getAttribute("contenteditable")!=="false"){return true}const r=["button","input","select","textarea","a","audio","video","summary","iframe"].includes(t);if(r){return true}return Dr(e)}function Or(e){var t,n;const i=jr(e);const r=(t=i[0])!=null?t:null;const s=(n=i[i.length-1])!=null?n:null;return{start:r,end:s}}function Lr(e,t){var n;return((n=e.getRootNode({composed:true}))==null?void 0:n.host)!==t}function jr(e){const t=new WeakMap;const n=[];function i(r){if(r instanceof Element){if(r.hasAttribute("inert")||r.closest("[inert]")){return}if(t.has(r)){return}t.set(r,true);if(!n.includes(r)&&Wr(r)){n.push(r)}if(r instanceof HTMLSlotElement&&Lr(r,e)){r.assignedElements({flatten:true}).forEach((e=>{i(e)}))}if(r.shadowRoot!==null&&r.shadowRoot.mode==="open"){i(r.shadowRoot)}}for(const e of r.children){i(e)}}i(e);return n.sort(((e,t)=>{const n=Number(e.getAttribute("tabindex"))||0;const i=Number(t.getAttribute("tabindex"))||0;return i-n}))}var Ur=class extends I{constructor(){super(...arguments);this.localize=new j(this);this.open=false;this.placement="bottom-start";this.disabled=false;this.stayOpenOnSelect=false;this.distance=0;this.skidding=0;this.hoist=false;this.sync=void 0;this.handleKeyDown=e=>{if(this.open&&e.key==="Escape"){e.stopPropagation();this.hide();this.focusOnTrigger()}};this.handleDocumentKeyDown=e=>{var t;if(e.key==="Escape"&&this.open&&!this.closeWatcher){e.stopPropagation();this.focusOnTrigger();this.hide();return}if(e.key==="Tab"){if(this.open&&((t=document.activeElement)==null?void 0:t.tagName.toLowerCase())==="sl-menu-item"){e.preventDefault();this.hide();this.focusOnTrigger();return}const n=(e,t)=>{if(!e)return null;const i=e.closest(t);if(i)return i;const r=e.getRootNode();if(r instanceof ShadowRoot){return n(r.host,t)}return null};setTimeout((()=>{var e;const t=((e=this.containingElement)==null?void 0:e.getRootNode())instanceof ShadowRoot?zr():document.activeElement;if(!this.containingElement||n(t,this.containingElement.tagName.toLowerCase())!==this.containingElement){this.hide()}}))}};this.handleDocumentMouseDown=e=>{const t=e.composedPath();if(this.containingElement&&!t.includes(this.containingElement)){this.hide()}};this.handlePanelSelect=e=>{const t=e.target;if(!this.stayOpenOnSelect&&t.tagName.toLowerCase()==="sl-menu"){this.hide();this.focusOnTrigger()}}}connectedCallback(){super.connectedCallback();if(!this.containingElement){this.containingElement=this}}firstUpdated(){this.panel.hidden=!this.open;if(this.open){this.addOpenListeners();this.popup.active=true}}disconnectedCallback(){super.disconnectedCallback();this.removeOpenListeners();this.hide()}focusOnTrigger(){const e=this.trigger.assignedElements({flatten:true})[0];if(typeof(e==null?void 0:e.focus)==="function"){e.focus()}}getMenu(){return this.panel.assignedElements({flatten:true}).find((e=>e.tagName.toLowerCase()==="sl-menu"))}handleTriggerClick(){if(this.open){this.hide()}else{this.show();this.focusOnTrigger()}}async handleTriggerKeyDown(e){if([" ","Enter"].includes(e.key)){e.preventDefault();this.handleTriggerClick();return}const t=this.getMenu();if(t){const n=t.getAllItems();const i=n[0];const r=n[n.length-1];if(["ArrowDown","ArrowUp","Home","End"].includes(e.key)){e.preventDefault();if(!this.open){this.show();await this.updateComplete}if(n.length>0){this.updateComplete.then((()=>{if(e.key==="ArrowDown"||e.key==="Home"){t.setCurrentItem(i);i.focus()}if(e.key==="ArrowUp"||e.key==="End"){t.setCurrentItem(r);r.focus()}}))}}}}handleTriggerKeyUp(e){if(e.key===" "){e.preventDefault()}}handleTriggerSlotChange(){this.updateAccessibleTrigger()}updateAccessibleTrigger(){const e=this.trigger.assignedElements({flatten:true});const t=e.find((e=>Or(e).start));let n;if(t){switch(t.tagName.toLowerCase()){case"sl-button":case"sl-icon-button":n=t.button;break;default:n=t}n.setAttribute("aria-haspopup","true");n.setAttribute("aria-expanded",this.open?"true":"false")}}async show(){if(this.open){return void 0}this.open=true;return H(this,"sl-after-show")}async hide(){if(!this.open){return void 0}this.open=false;return H(this,"sl-after-hide")}reposition(){this.popup.reposition()}addOpenListeners(){var e;this.panel.addEventListener("sl-select",this.handlePanelSelect);if("CloseWatcher"in window){(e=this.closeWatcher)==null?void 0:e.destroy();this.closeWatcher=new CloseWatcher;this.closeWatcher.onclose=()=>{this.hide();this.focusOnTrigger()}}else{this.panel.addEventListener("keydown",this.handleKeyDown)}document.addEventListener("keydown",this.handleDocumentKeyDown);document.addEventListener("mousedown",this.handleDocumentMouseDown)}removeOpenListeners(){var e;if(this.panel){this.panel.removeEventListener("sl-select",this.handlePanelSelect);this.panel.removeEventListener("keydown",this.handleKeyDown)}document.removeEventListener("keydown",this.handleDocumentKeyDown);document.removeEventListener("mousedown",this.handleDocumentMouseDown);(e=this.closeWatcher)==null?void 0:e.destroy()}async handleOpenChange(){if(this.disabled){this.open=false;return}this.updateAccessibleTrigger();if(this.open){this.emit("sl-show");this.addOpenListeners();await U(this);this.panel.hidden=false;this.popup.active=true;const{keyframes:e,options:t}=J(this,"dropdown.show",{dir:this.localize.dir()});await K(this.popup.popup,e,t);this.emit("sl-after-show")}else{this.emit("sl-hide");this.removeOpenListeners();await U(this);const{keyframes:e,options:t}=J(this,"dropdown.hide",{dir:this.localize.dir()});await K(this.popup.popup,e,t);this.panel.hidden=true;this.popup.active=false;this.emit("sl-after-hide")}}render(){return _`
312
312
  <sl-popup
313
313
  part="base"
314
314
  exportparts="popup:base__popup"
@@ -321,7 +321,7 @@ import{d as e,r as t,h as n,H as i,e as s,f as r,i as o,j as a}from"./p-99602d8c
321
321
  shift
322
322
  auto-size="vertical"
323
323
  auto-size-padding="10"
324
- sync=${ds(this.sync?this.sync:void 0)}
324
+ sync=${ir(this.sync?this.sync:void 0)}
325
325
  class=${W({dropdown:true,"dropdown--open":this.open})}
326
326
  >
327
327
  <slot
@@ -339,7 +339,7 @@ import{d as e,r as t,h as n,H as i,e as s,f as r,i as o,j as a}from"./p-99602d8c
339
339
  <slot part="panel" class="dropdown__panel"></slot>
340
340
  </div>
341
341
  </sl-popup>
342
- `}};Xs.styles=[A,Ws];Xs.dependencies={"sl-popup":N};C([O(".dropdown")],Xs.prototype,"popup",2);C([O(".dropdown__trigger")],Xs.prototype,"trigger",2);C([O(".dropdown__panel")],Xs.prototype,"panel",2);C([P({type:Boolean,reflect:true})],Xs.prototype,"open",2);C([P({reflect:true})],Xs.prototype,"placement",2);C([P({type:Boolean,reflect:true})],Xs.prototype,"disabled",2);C([P({attribute:"stay-open-on-select",type:Boolean,reflect:true})],Xs.prototype,"stayOpenOnSelect",2);C([P({attribute:false})],Xs.prototype,"containingElement",2);C([P({type:Number})],Xs.prototype,"distance",2);C([P({type:Number})],Xs.prototype,"skidding",2);C([P({type:Boolean})],Xs.prototype,"hoist",2);C([P({reflect:true})],Xs.prototype,"sync",2);C([z("open",{waitUntilFirstUpdate:true})],Xs.prototype,"handleOpenChange",1);L("dropdown.show",{keyframes:[{opacity:0,scale:.9},{opacity:1,scale:1}],options:{duration:100,easing:"ease"}});L("dropdown.hide",{keyframes:[{opacity:1,scale:1},{opacity:0,scale:.9}],options:{duration:100,easing:"ease"}});Xs.define("sl-dropdown");var Fs=S`
342
+ `}};Ur.styles=[A,Tr];Ur.dependencies={"sl-popup":N};T([O(".dropdown")],Ur.prototype,"popup",2);T([O(".dropdown__trigger")],Ur.prototype,"trigger",2);T([O(".dropdown__panel")],Ur.prototype,"panel",2);T([$({type:Boolean,reflect:true})],Ur.prototype,"open",2);T([$({reflect:true})],Ur.prototype,"placement",2);T([$({type:Boolean,reflect:true})],Ur.prototype,"disabled",2);T([$({attribute:"stay-open-on-select",type:Boolean,reflect:true})],Ur.prototype,"stayOpenOnSelect",2);T([$({attribute:false})],Ur.prototype,"containingElement",2);T([$({type:Number})],Ur.prototype,"distance",2);T([$({type:Number})],Ur.prototype,"skidding",2);T([$({type:Boolean})],Ur.prototype,"hoist",2);T([$({reflect:true})],Ur.prototype,"sync",2);T([R("open",{waitUntilFirstUpdate:true})],Ur.prototype,"handleOpenChange",1);L("dropdown.show",{keyframes:[{opacity:0,scale:.9},{opacity:1,scale:1}],options:{duration:100,easing:"ease"}});L("dropdown.hide",{keyframes:[{opacity:1,scale:1},{opacity:0,scale:.9}],options:{duration:100,easing:"ease"}});Ur.define("sl-dropdown");var Jr=S`
343
343
  :host {
344
344
  display: block;
345
345
  position: relative;
@@ -354,14 +354,14 @@ import{d as e,r as t,h as n,H as i,e as s,f as r,i as o,j as a}from"./p-99602d8c
354
354
  ::slotted(sl-divider) {
355
355
  --spacing: var(--sl-spacing-x-small);
356
356
  }
357
- `;var Vs=class extends R{connectedCallback(){super.connectedCallback();this.setAttribute("role","menu")}handleClick(e){const t=["menuitem","menuitemcheckbox"];const n=e.composedPath();const i=n.find((e=>{var n;return t.includes(((n=e==null?void 0:e.getAttribute)==null?void 0:n.call(e,"role"))||"")}));if(!i)return;const s=n.find((e=>{var t;return((t=e==null?void 0:e.getAttribute)==null?void 0:t.call(e,"role"))==="menu"}));const r=s!==this;if(r)return;const o=i;if(o.type==="checkbox"){o.checked=!o.checked}this.emit("sl-select",{detail:{item:o}})}handleKeyDown(e){if(e.key==="Enter"||e.key===" "){const t=this.getCurrentItem();e.preventDefault();e.stopPropagation();t==null?void 0:t.click()}else if(["ArrowDown","ArrowUp","Home","End"].includes(e.key)){const t=this.getAllItems();const n=this.getCurrentItem();let i=n?t.indexOf(n):0;if(t.length>0){e.preventDefault();e.stopPropagation();if(e.key==="ArrowDown"){i++}else if(e.key==="ArrowUp"){i--}else if(e.key==="Home"){i=0}else if(e.key==="End"){i=t.length-1}if(i<0){i=t.length-1}if(i>t.length-1){i=0}this.setCurrentItem(t[i]);t[i].focus()}}}handleMouseDown(e){const t=e.target;if(this.isMenuItem(t)){this.setCurrentItem(t)}}handleSlotChange(){const e=this.getAllItems();if(e.length>0){this.setCurrentItem(e[0])}}isMenuItem(e){var t;return e.tagName.toLowerCase()==="sl-menu-item"||["menuitem","menuitemcheckbox","menuitemradio"].includes((t=e.getAttribute("role"))!=null?t:"")}getAllItems(){return[...this.defaultSlot.assignedElements({flatten:true})].filter((e=>{if(e.inert||!this.isMenuItem(e)){return false}return true}))}getCurrentItem(){return this.getAllItems().find((e=>e.getAttribute("tabindex")==="0"))}setCurrentItem(e){const t=this.getAllItems();t.forEach((t=>{t.setAttribute("tabindex",t===e?"0":"-1")}))}render(){return _`
357
+ `;var Kr=class extends I{connectedCallback(){super.connectedCallback();this.setAttribute("role","menu")}handleClick(e){const t=["menuitem","menuitemcheckbox"];const n=e.composedPath();const i=n.find((e=>{var n;return t.includes(((n=e==null?void 0:e.getAttribute)==null?void 0:n.call(e,"role"))||"")}));if(!i)return;const r=n.find((e=>{var t;return((t=e==null?void 0:e.getAttribute)==null?void 0:t.call(e,"role"))==="menu"}));const s=r!==this;if(s)return;const o=i;if(o.type==="checkbox"){o.checked=!o.checked}this.emit("sl-select",{detail:{item:o}})}handleKeyDown(e){if(e.key==="Enter"||e.key===" "){const t=this.getCurrentItem();e.preventDefault();e.stopPropagation();t==null?void 0:t.click()}else if(["ArrowDown","ArrowUp","Home","End"].includes(e.key)){const t=this.getAllItems();const n=this.getCurrentItem();let i=n?t.indexOf(n):0;if(t.length>0){e.preventDefault();e.stopPropagation();if(e.key==="ArrowDown"){i++}else if(e.key==="ArrowUp"){i--}else if(e.key==="Home"){i=0}else if(e.key==="End"){i=t.length-1}if(i<0){i=t.length-1}if(i>t.length-1){i=0}this.setCurrentItem(t[i]);t[i].focus()}}}handleMouseDown(e){const t=e.target;if(this.isMenuItem(t)){this.setCurrentItem(t)}}handleSlotChange(){const e=this.getAllItems();if(e.length>0){this.setCurrentItem(e[0])}}isMenuItem(e){var t;return e.tagName.toLowerCase()==="sl-menu-item"||["menuitem","menuitemcheckbox","menuitemradio"].includes((t=e.getAttribute("role"))!=null?t:"")}getAllItems(){return[...this.defaultSlot.assignedElements({flatten:true})].filter((e=>{if(e.inert||!this.isMenuItem(e)){return false}return true}))}getCurrentItem(){return this.getAllItems().find((e=>e.getAttribute("tabindex")==="0"))}setCurrentItem(e){const t=this.getAllItems();t.forEach((t=>{t.setAttribute("tabindex",t===e?"0":"-1")}))}render(){return _`
358
358
  <slot
359
359
  @slotchange=${this.handleSlotChange}
360
360
  @click=${this.handleClick}
361
361
  @keydown=${this.handleKeyDown}
362
362
  @mousedown=${this.handleMouseDown}
363
363
  ></slot>
364
- `}};Vs.styles=[A,Fs];C([O("slot")],Vs.prototype,"defaultSlot",2);Vs.define("sl-menu");var qs=S`
364
+ `}};Kr.styles=[A,Jr];T([O("slot")],Kr.prototype,"defaultSlot",2);Kr.define("sl-menu");var Hr=S`
365
365
  :host {
366
366
  --submenu-offset: -2px;
367
367
 
@@ -518,14 +518,14 @@ import{d as e,r as t,h as n,H as i,e as s,f as r,i as o,j as a}from"./p-99602d8c
518
518
  * @license
519
519
  * Copyright 2017 Google LLC
520
520
  * SPDX-License-Identifier: BSD-3-Clause
521
- */;const Gs=(e,t)=>{const n=e._$AN;if(void 0===n)return!1;for(const e of n)e._$AO?.(t,!1),Gs(e,t);return!0},Ys=e=>{let t,n;do{if(void 0===(t=e._$AM))break;n=t._$AN,n.delete(e),e=t}while(0===n?.size)},Zs=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(void 0===n)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),tr(t)}};function Qs(e){void 0!==this._$AN?(Ys(this),this._$AM=e,Zs(this)):this._$AM=e}function er(e,t=!1,n=0){const i=this._$AH,s=this._$AN;if(void 0!==s&&0!==s.size)if(t)if(Array.isArray(i))for(let e=n;e<i.length;e++)Gs(i[e],!1),Ys(i[e]);else null!=i&&(Gs(i,!1),Ys(i));else Gs(this,e)}const tr=e=>{e.type==B.CHILD&&(e._$AP??=er,e._$AQ??=Qs)};class nr extends M{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),Zs(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Gs(this,e),Ys(this))}setValue(e){if(D(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}
521
+ */;const Nr=(e,t)=>{const n=e._$AN;if(void 0===n)return!1;for(const e of n)e._$AO?.(t,!1),Nr(e,t);return!0},Mr=e=>{let t,n;do{if(void 0===(t=e._$AM))break;n=t._$AN,n.delete(e),e=t}while(0===n?.size)},Br=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(void 0===n)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),Vr(t)}};function Xr(e){void 0!==this._$AN?(Mr(this),this._$AM=e,Br(this)):this._$AM=e}function Fr(e,t=!1,n=0){const i=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(t)if(Array.isArray(i))for(let e=n;e<i.length;e++)Nr(i[e],!1),Mr(i[e]);else null!=i&&(Nr(i,!1),Mr(i));else Nr(this,e)}const Vr=e=>{e.type==B.CHILD&&(e._$AP??=Fr,e._$AQ??=Xr)};class qr extends M{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),Br(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Nr(this,e),Mr(this))}setValue(e){if(D(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}
522
522
  /**
523
523
  * @license
524
524
  * Copyright 2020 Google LLC
525
525
  * SPDX-License-Identifier: BSD-3-Clause
526
- */const ir=()=>new sr;class sr{}const rr=new WeakMap,or=X(class extends nr{render(e){return E}update(e,[t]){const n=t!==this.G;return n&&void 0!==this.G&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),E}rt(e){if(this.isConnected||(e=void 0),"function"==typeof this.G){const t=this.ht??globalThis;let n=rr.get(t);void 0===n&&(n=new WeakMap,rr.set(t,n)),void 0!==n.get(this.G)&&this.G.call(this.ht,void 0),n.set(this.G,e),void 0!==e&&this.G.call(this.ht,e)}else this.G.value=e}get lt(){return"function"==typeof this.G?rr.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var ar=class{constructor(e,t){this.popupRef=ir();this.enableSubmenuTimer=-1;this.isConnected=false;this.isPopupConnected=false;this.skidding=0;this.submenuOpenDelay=100;this.handleMouseMove=e=>{this.host.style.setProperty("--safe-triangle-cursor-x",`${e.clientX}px`);this.host.style.setProperty("--safe-triangle-cursor-y",`${e.clientY}px`)};this.handleMouseOver=()=>{if(this.hasSlotController.test("submenu")){this.enableSubmenu()}};this.handleKeyDown=e=>{switch(e.key){case"Escape":case"Tab":this.disableSubmenu();break;case"ArrowLeft":if(e.target!==this.host){e.preventDefault();e.stopPropagation();this.host.focus();this.disableSubmenu()}break;case"ArrowRight":case"Enter":case" ":this.handleSubmenuEntry(e);break}};this.handleClick=e=>{var t;if(e.target===this.host){e.preventDefault();e.stopPropagation()}else if(e.target instanceof Element&&(e.target.tagName==="sl-menu-item"||((t=e.target.role)==null?void 0:t.startsWith("menuitem")))){this.disableSubmenu()}};this.handleFocusOut=e=>{if(e.relatedTarget&&e.relatedTarget instanceof Element&&this.host.contains(e.relatedTarget)){return}this.disableSubmenu()};this.handlePopupMouseover=e=>{e.stopPropagation()};this.handlePopupReposition=()=>{const e=this.host.renderRoot.querySelector("slot[name='submenu']");const t=e==null?void 0:e.assignedElements({flatten:true}).filter((e=>e.localName==="sl-menu"))[0];const n=getComputedStyle(this.host).direction==="rtl";if(!t){return}const{left:i,top:s,width:r,height:o}=t.getBoundingClientRect();this.host.style.setProperty("--safe-triangle-submenu-start-x",`${n?i+r:i}px`);this.host.style.setProperty("--safe-triangle-submenu-start-y",`${s}px`);this.host.style.setProperty("--safe-triangle-submenu-end-x",`${n?i+r:i}px`);this.host.style.setProperty("--safe-triangle-submenu-end-y",`${s+o}px`)};(this.host=e).addController(this);this.hasSlotController=t}hostConnected(){if(this.hasSlotController.test("submenu")&&!this.host.disabled){this.addListeners()}}hostDisconnected(){this.removeListeners()}hostUpdated(){if(this.hasSlotController.test("submenu")&&!this.host.disabled){this.addListeners();this.updateSkidding()}else{this.removeListeners()}}addListeners(){if(!this.isConnected){this.host.addEventListener("mousemove",this.handleMouseMove);this.host.addEventListener("mouseover",this.handleMouseOver);this.host.addEventListener("keydown",this.handleKeyDown);this.host.addEventListener("click",this.handleClick);this.host.addEventListener("focusout",this.handleFocusOut);this.isConnected=true}if(!this.isPopupConnected){if(this.popupRef.value){this.popupRef.value.addEventListener("mouseover",this.handlePopupMouseover);this.popupRef.value.addEventListener("sl-reposition",this.handlePopupReposition);this.isPopupConnected=true}}}removeListeners(){if(this.isConnected){this.host.removeEventListener("mousemove",this.handleMouseMove);this.host.removeEventListener("mouseover",this.handleMouseOver);this.host.removeEventListener("keydown",this.handleKeyDown);this.host.removeEventListener("click",this.handleClick);this.host.removeEventListener("focusout",this.handleFocusOut);this.isConnected=false}if(this.isPopupConnected){if(this.popupRef.value){this.popupRef.value.removeEventListener("mouseover",this.handlePopupMouseover);this.popupRef.value.removeEventListener("sl-reposition",this.handlePopupReposition);this.isPopupConnected=false}}}handleSubmenuEntry(e){const t=this.host.renderRoot.querySelector("slot[name='submenu']");if(!t){console.error("Cannot activate a submenu if no corresponding menuitem can be found.",this);return}let n=null;for(const e of t.assignedElements()){n=e.querySelectorAll("sl-menu-item, [role^='menuitem']");if(n.length!==0){break}}if(!n||n.length===0){return}n[0].setAttribute("tabindex","0");for(let e=1;e!==n.length;++e){n[e].setAttribute("tabindex","-1")}if(this.popupRef.value){e.preventDefault();e.stopPropagation();if(this.popupRef.value.active){if(n[0]instanceof HTMLElement){n[0].focus()}}else{this.enableSubmenu(false);this.host.updateComplete.then((()=>{if(n[0]instanceof HTMLElement){n[0].focus()}}));this.host.requestUpdate()}}}setSubmenuState(e){if(this.popupRef.value){if(this.popupRef.value.active!==e){this.popupRef.value.active=e;this.host.requestUpdate()}}}enableSubmenu(e=true){if(e){window.clearTimeout(this.enableSubmenuTimer);this.enableSubmenuTimer=window.setTimeout((()=>{this.setSubmenuState(true)}),this.submenuOpenDelay)}else{this.setSubmenuState(true)}}disableSubmenu(){window.clearTimeout(this.enableSubmenuTimer);this.setSubmenuState(false)}updateSkidding(){var e;if(!((e=this.host.parentElement)==null?void 0:e.computedStyleMap)){return}const t=this.host.parentElement.computedStyleMap();const n=["padding-top","border-top-width","margin-top"];const i=n.reduce(((e,n)=>{var i;const s=(i=t.get(n))!=null?i:new CSSUnitValue(0,"px");const r=s instanceof CSSUnitValue?s:new CSSUnitValue(0,"px");const o=r.to("px");return e-o.value}),0);this.skidding=i}isExpanded(){return this.popupRef.value?this.popupRef.value.active:false}renderSubmenu(){const e=getComputedStyle(this.host).direction==="rtl";if(!this.isConnected){return _` <slot name="submenu" hidden></slot> `}return _`
526
+ */const Gr=()=>new Yr;class Yr{}const Zr=new WeakMap,Qr=X(class extends qr{render(e){return E}update(e,[t]){const n=t!==this.G;return n&&void 0!==this.G&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),E}rt(e){if(this.isConnected||(e=void 0),"function"==typeof this.G){const t=this.ht??globalThis;let n=Zr.get(t);void 0===n&&(n=new WeakMap,Zr.set(t,n)),void 0!==n.get(this.G)&&this.G.call(this.ht,void 0),n.set(this.G,e),void 0!==e&&this.G.call(this.ht,e)}else this.G.value=e}get lt(){return"function"==typeof this.G?Zr.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var es=class{constructor(e,t){this.popupRef=Gr();this.enableSubmenuTimer=-1;this.isConnected=false;this.isPopupConnected=false;this.skidding=0;this.submenuOpenDelay=100;this.handleMouseMove=e=>{this.host.style.setProperty("--safe-triangle-cursor-x",`${e.clientX}px`);this.host.style.setProperty("--safe-triangle-cursor-y",`${e.clientY}px`)};this.handleMouseOver=()=>{if(this.hasSlotController.test("submenu")){this.enableSubmenu()}};this.handleKeyDown=e=>{switch(e.key){case"Escape":case"Tab":this.disableSubmenu();break;case"ArrowLeft":if(e.target!==this.host){e.preventDefault();e.stopPropagation();this.host.focus();this.disableSubmenu()}break;case"ArrowRight":case"Enter":case" ":this.handleSubmenuEntry(e);break}};this.handleClick=e=>{var t;if(e.target===this.host){e.preventDefault();e.stopPropagation()}else if(e.target instanceof Element&&(e.target.tagName==="sl-menu-item"||((t=e.target.role)==null?void 0:t.startsWith("menuitem")))){this.disableSubmenu()}};this.handleFocusOut=e=>{if(e.relatedTarget&&e.relatedTarget instanceof Element&&this.host.contains(e.relatedTarget)){return}this.disableSubmenu()};this.handlePopupMouseover=e=>{e.stopPropagation()};this.handlePopupReposition=()=>{const e=this.host.renderRoot.querySelector("slot[name='submenu']");const t=e==null?void 0:e.assignedElements({flatten:true}).filter((e=>e.localName==="sl-menu"))[0];const n=getComputedStyle(this.host).direction==="rtl";if(!t){return}const{left:i,top:r,width:s,height:o}=t.getBoundingClientRect();this.host.style.setProperty("--safe-triangle-submenu-start-x",`${n?i+s:i}px`);this.host.style.setProperty("--safe-triangle-submenu-start-y",`${r}px`);this.host.style.setProperty("--safe-triangle-submenu-end-x",`${n?i+s:i}px`);this.host.style.setProperty("--safe-triangle-submenu-end-y",`${r+o}px`)};(this.host=e).addController(this);this.hasSlotController=t}hostConnected(){if(this.hasSlotController.test("submenu")&&!this.host.disabled){this.addListeners()}}hostDisconnected(){this.removeListeners()}hostUpdated(){if(this.hasSlotController.test("submenu")&&!this.host.disabled){this.addListeners();this.updateSkidding()}else{this.removeListeners()}}addListeners(){if(!this.isConnected){this.host.addEventListener("mousemove",this.handleMouseMove);this.host.addEventListener("mouseover",this.handleMouseOver);this.host.addEventListener("keydown",this.handleKeyDown);this.host.addEventListener("click",this.handleClick);this.host.addEventListener("focusout",this.handleFocusOut);this.isConnected=true}if(!this.isPopupConnected){if(this.popupRef.value){this.popupRef.value.addEventListener("mouseover",this.handlePopupMouseover);this.popupRef.value.addEventListener("sl-reposition",this.handlePopupReposition);this.isPopupConnected=true}}}removeListeners(){if(this.isConnected){this.host.removeEventListener("mousemove",this.handleMouseMove);this.host.removeEventListener("mouseover",this.handleMouseOver);this.host.removeEventListener("keydown",this.handleKeyDown);this.host.removeEventListener("click",this.handleClick);this.host.removeEventListener("focusout",this.handleFocusOut);this.isConnected=false}if(this.isPopupConnected){if(this.popupRef.value){this.popupRef.value.removeEventListener("mouseover",this.handlePopupMouseover);this.popupRef.value.removeEventListener("sl-reposition",this.handlePopupReposition);this.isPopupConnected=false}}}handleSubmenuEntry(e){const t=this.host.renderRoot.querySelector("slot[name='submenu']");if(!t){console.error("Cannot activate a submenu if no corresponding menuitem can be found.",this);return}let n=null;for(const e of t.assignedElements()){n=e.querySelectorAll("sl-menu-item, [role^='menuitem']");if(n.length!==0){break}}if(!n||n.length===0){return}n[0].setAttribute("tabindex","0");for(let e=1;e!==n.length;++e){n[e].setAttribute("tabindex","-1")}if(this.popupRef.value){e.preventDefault();e.stopPropagation();if(this.popupRef.value.active){if(n[0]instanceof HTMLElement){n[0].focus()}}else{this.enableSubmenu(false);this.host.updateComplete.then((()=>{if(n[0]instanceof HTMLElement){n[0].focus()}}));this.host.requestUpdate()}}}setSubmenuState(e){if(this.popupRef.value){if(this.popupRef.value.active!==e){this.popupRef.value.active=e;this.host.requestUpdate()}}}enableSubmenu(e=true){if(e){window.clearTimeout(this.enableSubmenuTimer);this.enableSubmenuTimer=window.setTimeout((()=>{this.setSubmenuState(true)}),this.submenuOpenDelay)}else{this.setSubmenuState(true)}}disableSubmenu(){window.clearTimeout(this.enableSubmenuTimer);this.setSubmenuState(false)}updateSkidding(){var e;if(!((e=this.host.parentElement)==null?void 0:e.computedStyleMap)){return}const t=this.host.parentElement.computedStyleMap();const n=["padding-top","border-top-width","margin-top"];const i=n.reduce(((e,n)=>{var i;const r=(i=t.get(n))!=null?i:new CSSUnitValue(0,"px");const s=r instanceof CSSUnitValue?r:new CSSUnitValue(0,"px");const o=s.to("px");return e-o.value}),0);this.skidding=i}isExpanded(){return this.popupRef.value?this.popupRef.value.active:false}renderSubmenu(){const e=getComputedStyle(this.host).direction==="rtl";if(!this.isConnected){return _` <slot name="submenu" hidden></slot> `}return _`
527
527
  <sl-popup
528
- ${or(this.popupRef)}
528
+ ${Qr(this.popupRef)}
529
529
  placement=${e?"left-start":"right-start"}
530
530
  anchor="anchor"
531
531
  flip
@@ -537,7 +537,7 @@ import{d as e,r as t,h as n,H as i,e as s,f as r,i as o,j as a}from"./p-99602d8c
537
537
  >
538
538
  <slot name="submenu"></slot>
539
539
  </sl-popup>
540
- `}};var cr=S`
540
+ `}};var ts=S`
541
541
  :host {
542
542
  --track-width: 2px;
543
543
  --track-color: rgb(128 128 128 / 25%);
@@ -594,12 +594,12 @@ import{d as e,r as t,h as n,H as i,e as s,f as r,i as o,j as a}from"./p-99602d8c
594
594
  stroke-dasharray: 0.05em, 3em;
595
595
  }
596
596
  }
597
- `;var lr=class extends R{constructor(){super(...arguments);this.localize=new j(this)}render(){return _`
597
+ `;var ns=class extends I{constructor(){super(...arguments);this.localize=new j(this)}render(){return _`
598
598
  <svg part="base" class="spinner" role="progressbar" aria-label=${this.localize.term("loading")}>
599
599
  <circle class="spinner__track"></circle>
600
600
  <circle class="spinner__indicator"></circle>
601
601
  </svg>
602
- `}};lr.styles=[A,cr];var dr=class extends R{constructor(){super(...arguments);this.localize=new j(this);this.type="normal";this.checked=false;this.value="";this.loading=false;this.disabled=false;this.hasSlotController=new us(this,"submenu");this.submenuController=new ar(this,this.hasSlotController);this.handleHostClick=e=>{if(this.disabled){e.preventDefault();e.stopImmediatePropagation()}};this.handleMouseOver=e=>{this.focus();e.stopPropagation()}}connectedCallback(){super.connectedCallback();this.addEventListener("click",this.handleHostClick);this.addEventListener("mouseover",this.handleMouseOver)}disconnectedCallback(){super.disconnectedCallback();this.removeEventListener("click",this.handleHostClick);this.removeEventListener("mouseover",this.handleMouseOver)}handleDefaultSlotChange(){const e=this.getTextLabel();if(typeof this.cachedTextLabel==="undefined"){this.cachedTextLabel=e;return}if(e!==this.cachedTextLabel){this.cachedTextLabel=e;this.emit("slotchange",{bubbles:true,composed:false,cancelable:false})}}handleCheckedChange(){if(this.checked&&this.type!=="checkbox"){this.checked=false;console.error('The checked attribute can only be used on menu items with type="checkbox"',this);return}if(this.type==="checkbox"){this.setAttribute("aria-checked",this.checked?"true":"false")}else{this.removeAttribute("aria-checked")}}handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false")}handleTypeChange(){if(this.type==="checkbox"){this.setAttribute("role","menuitemcheckbox");this.setAttribute("aria-checked",this.checked?"true":"false")}else{this.setAttribute("role","menuitem");this.removeAttribute("aria-checked")}}getTextLabel(){return fs(this.defaultSlot)}isSubmenu(){return this.hasSlotController.test("submenu")}render(){const e=this.localize.dir()==="rtl";const t=this.submenuController.isExpanded();return _`
602
+ `}};ns.styles=[A,ts];var is=class extends I{constructor(){super(...arguments);this.localize=new j(this);this.type="normal";this.checked=false;this.value="";this.loading=false;this.disabled=false;this.hasSlotController=new sr(this,"submenu");this.submenuController=new es(this,this.hasSlotController);this.handleHostClick=e=>{if(this.disabled){e.preventDefault();e.stopImmediatePropagation()}};this.handleMouseOver=e=>{this.focus();e.stopPropagation()}}connectedCallback(){super.connectedCallback();this.addEventListener("click",this.handleHostClick);this.addEventListener("mouseover",this.handleMouseOver)}disconnectedCallback(){super.disconnectedCallback();this.removeEventListener("click",this.handleHostClick);this.removeEventListener("mouseover",this.handleMouseOver)}handleDefaultSlotChange(){const e=this.getTextLabel();if(typeof this.cachedTextLabel==="undefined"){this.cachedTextLabel=e;return}if(e!==this.cachedTextLabel){this.cachedTextLabel=e;this.emit("slotchange",{bubbles:true,composed:false,cancelable:false})}}handleCheckedChange(){if(this.checked&&this.type!=="checkbox"){this.checked=false;console.error('The checked attribute can only be used on menu items with type="checkbox"',this);return}if(this.type==="checkbox"){this.setAttribute("aria-checked",this.checked?"true":"false")}else{this.removeAttribute("aria-checked")}}handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false")}handleTypeChange(){if(this.type==="checkbox"){this.setAttribute("role","menuitemcheckbox");this.setAttribute("aria-checked",this.checked?"true":"false")}else{this.setAttribute("role","menuitem");this.removeAttribute("aria-checked")}}getTextLabel(){return or(this.defaultSlot)}isSubmenu(){return this.hasSlotController.test("submenu")}render(){const e=this.localize.dir()==="rtl";const t=this.submenuController.isExpanded();return _`
603
603
  <div
604
604
  id="anchor"
605
605
  part="base"
@@ -624,7 +624,7 @@ import{d as e,r as t,h as n,H as i,e as s,f as r,i as o,j as a}from"./p-99602d8c
624
624
  ${this.submenuController.renderSubmenu()}
625
625
  ${this.loading?_` <sl-spinner part="spinner" exportparts="base:spinner__base"></sl-spinner> `:""}
626
626
  </div>
627
- `}};dr.styles=[A,qs];dr.dependencies={"sl-icon":T,"sl-popup":N,"sl-spinner":lr};C([O("slot:not([name])")],dr.prototype,"defaultSlot",2);C([O(".menu-item")],dr.prototype,"menuItem",2);C([P()],dr.prototype,"type",2);C([P({type:Boolean,reflect:true})],dr.prototype,"checked",2);C([P()],dr.prototype,"value",2);C([P({type:Boolean,reflect:true})],dr.prototype,"loading",2);C([P({type:Boolean,reflect:true})],dr.prototype,"disabled",2);C([z("checked")],dr.prototype,"handleCheckedChange",1);C([z("disabled")],dr.prototype,"handleDisabledChange",1);C([z("type")],dr.prototype,"handleTypeChange",1);dr.define("sl-menu-item");const hr="button.main {\n display: flex;\n transition:\n width 200ms,\n background-color 500ms,\n color 500ms,\n border-color 500ms;\n max-width: var(--size-40);\n flex-direction: row;\n overflow: hidden;\n height: var(--pos-navigation-bar-height);\n width: var(--pos-navigation-bar-height);\n align-items: center;\n justify-content: center;\n border-radius: var(--radius-md);\n color: var(--pos-subtle-text-color);\n border: var(--size-px) dashed var(--pos-subtle-text-color);\n background-color: var(--pos-background-color);\n\n p {\n padding: 0;\n margin: 0;\n display: none;\n white-space: nowrap;\n }\n\n &.success {\n color: var(--color-green-700);\n border-color: var(--color-green-700);\n border-style: solid;\n background-color: var(--color-green-100);\n }\n\n &:active {\n transform: scale(0.99);\n filter: brightness(90%);\n }\n &:focus {\n outline: var(--pos-input-focus-outline);\n }\n}\n\nsvg {\n display: inline-block;\n height: var(--size-6);\n flex-shrink: 0;\n flex-grow: 0;\n width: var(--size-6);\n}\n\nbutton.main:hover,\nsl-dropdown[open] button {\n &.success {\n background: var(--color-green-200);\n color: var(--color-green-700);\n }\n width: var(--size-full);\n height: var(--pos-navigation-bar-height);\n background: var(--pos-background-color);\n color: var(--pos-normal-text-color);\n\n p {\n display: inline-block;\n }\n}\n";const ur=hr;const fr=class{constructor(e){t(this,e);this.subscribePodOs=r(this,"pod-os:init",7);this.errorEmitter=r(this,"pod-os:error",7);this.indexUpdatedEmitter=r(this,"pod-os:search:index-updated",7);this.indexCreatedEmitter=r(this,"pod-os:search:index-created",7);this.indexes=[];this.showOptions=false;this.isIndexed=false;this.receivePodOs=async e=>{this.os=e;this.thing=this.os.store.get(this.uri);this.getLabelIndexes(p.state.profile);this.unsubscribeSessionChange=p.onChange("profile",(e=>{this.getLabelIndexes(e)}))}}componentWillLoad(){F(this)}disconnectedCallback(){this.unsubscribeSessionChange&&this.unsubscribeSessionChange()}updateUri(e){this.thing=this.os.store.get(e);this.isIndexed=this.checkIfIndexed(e)}checkIfIndexed(e){return this.indexes.some((t=>t.contains(e)))}getLabelIndexes(e){if(e){this.indexes=e.getPrivateLabelIndexes().map((e=>this.os.store.get(e).assume(w)));this.showOptions=this.indexes.length>1;this.isIndexed=this.checkIfIndexed(this.uri)}}async onClick(e){e.preventDefault();if(this.indexes.length===1){const e=this.indexes[0];await this.addToLabelIndex(e);this.indexUpdatedEmitter.emit(e)}else if(this.indexes.length===0){const e=await this.createDefaultLabelIndex();await this.addToLabelIndex(e);this.indexCreatedEmitter.emit(e)}}async addToLabelIndex(e){try{await this.os.addToLabelIndex(this.thing,e);this.isIndexed=true}catch(e){this.errorEmitter.emit(e)}}async createDefaultLabelIndex(){try{return await this.os.createDefaultLabelIndex(p.state.profile)}catch(e){this.errorEmitter.emit(e)}}render(){if(!p.state.isLoggedIn||!this.uri){return null}const e="Make this findable";const t=n("button",{type:"button",slot:"trigger","aria-label":e,class:{main:true,success:this.isIndexed},onClick:e=>this.onClick(e),title:""},this.isIndexed?n(br,null):n(pr,null),n("p",null,e));if(this.showOptions){return n(i,null,n("sl-dropdown",null,t,n("sl-menu",{role:"listbox"},this.indexes.map((e=>n("sl-menu-item",{role:"option",value:e,type:"checkbox",checked:e.contains(this.uri)},n("pos-resource",{uri:e.uri,lazy:true},n("pos-label",null))))))))}else{return t}}async onSelect(e){const t=e.detail.item.value;e.preventDefault();await this.addToLabelIndex(t);this.indexUpdatedEmitter.emit(t)}get el(){return s(this)}static get watchers(){return{uri:["updateUri"]}}};const pr=()=>n("svg",{role:"presentation",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},n("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m5.231 13.481L15 17.25m-4.5-15H5.625c-.621 0-1.125.504-1.125 1.125v16.5c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Zm3.75 11.625a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z"}));const br=()=>n("svg",{role:"presentation",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},n("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.125 2.25h-4.5c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125v-9M10.125 2.25h.375a9 9 0 0 1 9 9v.375M10.125 2.25A3.375 3.375 0 0 1 13.5 5.625v1.5c0 .621.504 1.125 1.125 1.125h1.5a3.375 3.375 0 0 1 3.375 3.375M9 15l2.25 2.25L15 12"}));fr.style=ur;const mr=":host {\n --pos-navigation-bar-height: var(--size-10);\n}\n\nsearch {\n position: relative;\n}\n\n.suggestions ol {\n border: 1px solid var(--pos-border-color);\n display: flex;\n flex-direction: column;\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n\n.suggestions {\n width: 100%;\n overflow-y: auto;\n max-height: 90dvh;\n li {\n padding: 1rem;\n background-color: var(--pos-background-color);\n pos-rich-link {\n --background-color: inherit;\n }\n &[aria-selected='true'] {\n background-color: var(--pos-primary-color);\n &:hover {\n background-color: var(--pos-primary-color);\n }\n }\n &:hover {\n background-color: var(--pos-border-color);\n }\n }\n}\n\n.suggestions li.selected pos-rich-link {\n --label-color: white;\n --description-color: var(--pos-border-color);\n --uri-color: var(--pos-subtle-text-color);\n}\n\ndialog {\n position: absolute;\n margin-top: calc(-1 * var(--pos-navigation-bar-height));\n padding: 0;\n width: 100%;\n max-width: 100%;\n min-width: 100%;\n overflow: hidden;\n max-height: 100dvh;\n background-color: var(--pos-background-color);\n color: var(--pos-normal-text-color);\n border: var(--pos-border-color);\n border-radius: var(--radius-md);\n box-shadow: var(--shadow-md);\n form {\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n align-items: center;\n input {\n display: flex;\n font-size: var(--scale-1);\n height: var(--pos-navigation-bar-height);\n border-top-left-radius: var(--radius-md);\n border-top-right-radius: var(--radius-md);\n padding-left: var(--size-2);\n width: 100%;\n border: none;\n outline: none;\n color: var(--pos-normal-text-color);\n background-color: var(--pos-input-background-color);\n box-sizing: border-box;\n }\n }\n}\n\ndialog[open] {\n display: flex;\n z-index: var(--layer-top);\n animation: slideIn 100ms ease-out;\n}\n\n@media (max-width: 640px) {\n search {\n position: unset;\n }\n dialog {\n margin-top: var(--size-1);\n top: 0;\n width: 95dvw;\n max-width: unset;\n min-width: unset;\n form {\n input {\n height: var(--size-12);\n font-size: var(--scale-fluid-3);\n }\n }\n }\n}\n\n@keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n";const gr=mr;const wr=class{constructor(e){t(this,e);this.subscribePodOs=r(this,"pod-os:init",7);this.linkEmitter=r(this,"pod-os:link",7);this.uri="";this.inputValue=this.uri;this.searchIndex=undefined;this.suggestions=[];this.selectedIndex=-1;this.resource=null;this.changeEvents=new y;this.debouncedSearch=null;this.receivePodOs=async e=>{this.os=e}}updateResource(){var e;try{this.resource=this.uri?(e=this.os)===null||e===void 0?void 0:e.store.get(this.uri):null}catch(e){this.resource=null}}componentWillLoad(){F(this);this.updateResource();p.onChange("isLoggedIn",(async e=>{if(e){await this.buildSearchIndex()}else{this.clearSearchIndex()}}));this.debouncedSearch=this.changeEvents.pipe(k(300)).subscribe((()=>this.search()))}disconnectedCallback(){var e;(e=this.debouncedSearch)===null||e===void 0?void 0:e.unsubscribe()}async buildSearchIndex(){this.searchIndex=await this.os.buildSearchIndex(p.state.profile)}rebuildSearchIndex(){this.searchIndex.rebuild()}openNavigationDialog(e){var t,n;this.resource=e.detail;if(e.detail){this.inputValue=e.detail.uri;this.search()}(t=this.inputRef)===null||t===void 0?void 0:t.select();(n=this.dialogRef)===null||n===void 0?void 0:n.show()}clearSearchIndex(){var e;(e=this.searchIndex)===null||e===void 0?void 0:e.clear()}onChange(e){this.inputValue=e.target.value;this.changeEvents.next()}closeDialog(){var e;(e=this.dialogRef)===null||e===void 0?void 0:e.close();this.selectedIndex=-1}clearSuggestions(){var e;this.suggestions=[];(e=this.dialogRef)===null||e===void 0?void 0:e.close();this.selectedIndex=-1}onClickSelf(e){e.stopPropagation()}handleKeyDown(e){if(e.key==="Escape"){this.closeDialog()}else if(e.key==="ArrowDown"){e.preventDefault();this.selectedIndex=Math.min(this.selectedIndex+1,this.suggestions.length-1)}else if(e.key==="ArrowUp"){e.preventDefault();this.selectedIndex=Math.max(this.selectedIndex-1,0)}}search(){if(this.searchIndex){this.suggestions=this.inputValue?this.searchIndex.search(this.inputValue):[]}}onSubmit(){if(this.suggestions&&this.selectedIndex>-1){this.linkEmitter.emit(this.suggestions[this.selectedIndex].ref)}else{this.linkEmitter.emit(this.inputValue)}}render(){return n("nav",{key:"44f504f9a905c6e63353741cda554a6a35a46f82"},n("search",{key:"98e7cae9729db2959d992f9e41a4cc99064b9eb0"},n("pos-navigation-bar",{key:"c0ce90fcc8334d0ea784ca3126a1524b036631ac",searchIndexReady:this.searchIndex!==undefined,current:this.resource}),n("dialog",{key:"a9b1418ad48ae298fbd8eaa56e62eb613e8deef6",ref:e=>this.dialogRef=e},n("form",{key:"a75933116bd844e0afc4e94eee713adb6d6bb4ea",method:"dialog",onSubmit:()=>this.onSubmit()},n("input",{key:"c6de46f82392acf3752e51e64dc6e5526f8d6a04",ref:e=>this.inputRef=e,enterkeyhint:"search","aria-label":"Search or enter URI",placeholder:"Search or enter URI",value:this.uri,onChange:e=>this.onChange(e),onInput:e=>this.onChange(e),role:"combobox","aria-autocomplete":"list","aria-expanded":this.suggestions.length>0,"aria-controls":"suggestions-list","aria-activedescendant":this.selectedIndex>=0?`option-${this.selectedIndex}`:null}),this.suggestions.length>0?n("div",{class:"suggestions"},n("ol",{id:"suggestions-list",role:"listbox","aria-label":"Search results"},this.suggestions.map(((e,t)=>n("li",{id:`option-${t}`,role:"option","aria-selected":t===this.selectedIndex?"true":"false"},n("pos-rich-link",{uri:e.ref})))))):null))))}static get watchers(){return{uri:["updateResource"],os:["updateResource"]}}};wr.style=gr;const yr="section.current {\n display: flex;\n height: var(--pos-navigation-bar-height);\n flex-grow: 1;\n gap: 0;\n background-color: var(--pos-input-background-color);\n border-radius: var(--radius-md);\n width: 100%;\n &:focus-within {\n outline: var(--pos-input-focus-outline);\n }\n}\n\nsection.current button {\n cursor: pointer;\n font-size: var(--scale-1);\n display: flex;\n align-items: center;\n justify-content: center;\n flex-grow: 1;\n background: none;\n color: var(--pos-normal-text-color);\n outline: none;\n border: none;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n &:focus {\n text-decoration: underline;\n }\n :first-child {\n flex-grow: 1;\n }\n svg {\n width: var(--size-6);\n color: var(--pos-subtle-text-color);\n }\n}\n";const vr=yr;const kr=class{constructor(e){t(this,e);this.navigate=r(this,"pod-os:navigate",7)}onClick(){this.navigate.emit(this.current)}activate(e){if((e.ctrlKey||e.metaKey)&&e.key==="k"){e.preventDefault();this.navigate.emit(this.current)}}render(){const e=this.current?`${this.current.label()} (Click to search or enter URI)`:"Search or enter URI";return n("section",{key:"a66626042ab42e63094b7b27729f0c299d6e62a3",class:"current"},this.current&&this.searchIndexReady&&n("pos-make-findable",{key:"4e2e2e3271c4ed78c34e32e0a815a87dd9d73b52",uri:this.current.uri}),n("button",{key:"5ff874354f32f9fef4b15337ce7230c43df0c0ca","aria-label":e,onClick:()=>this.onClick()},n("div",{key:"d00d82f397fb9f3ede61484d6cc2ae74ef92fd06"},this.current?this.current.label():"Search or enter URI"),this.icon()))}icon(){return n("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},n("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"}))}};kr.style=vr;const xr=":host{display:block}form{display:grid;grid-template-columns:var(--size-16) 1fr;grid-gap:var(--scale-0)}label{grid-column:1 / 2;display:flex;align-items:center;justify-content:flex-end}input,pos-select-term,button{grid-column:2 / 3}input,pos-select-term::part(input){outline:var(--pos-input-outline);padding:var(--scale-000);border:none;border-radius:var(--radius-xs);width:var(--size-full);box-sizing:border-box;background:var(--pos-input-background-color);color:var(--pos-normal-text-color)}input:focus-within,pos-select-term::part(input):focus-within{outline:var(--pos-input-focus-outline)}#new-uri{grid-column:1/3;cursor:default;word-break:break-all;color:var(--pos-normal-text-color);font-weight:var(--weight-light);background:var(--pos-disabled-color);padding:var(--scale-000);border-radius:var(--radius-xs)}input#create{outline:none;box-shadow:var(--shadow-sm);cursor:pointer;color:var(--pos-primary-text-color);background-color:var(--pos-primary-color)}input#create:disabled{cursor:default;color:var(--pos-disabled-text-color);background-color:var(--pos-disabled-color);box-shadow:none}input#create:hover:not(:disabled),input#create:focus{filter:brightness(110%);box-shadow:var(--shadow-md)}";const Sr=xr;const _r=class{constructor(e){t(this,e);this.linkEmitter=r(this,"pod-os:link",7);this.errorEmitter=r(this,"pod-os:error",7);this.subscribePodOs=r(this,"pod-os:init",7);this.canSubmit=false;this.receivePodOs=async e=>{this.os=e}}validate(){this.canSubmit=Boolean(this.name&&this.selectedTypeUri)}componentWillLoad(){F(this)}render(){return n("form",{key:"97ee880c3abec22c35be46a9cceea2458cf21ed9",method:"dialog",onSubmit:e=>this.handleSubmit(e)},n("label",{key:"d8640130a517630c02b974ee4013d2c3280b6fa2",htmlFor:"type"},"Type"),n("pos-select-term",{key:"e046ea254ed78f9ad89c4c20ada3c6ff13349749",id:"type",placeholder:"",value:this.selectedTypeUri,"onPod-os:term-selected":e=>this.onTermSelected(e)}),n("label",{key:"aed99f50050048a826960059e67f7c35d3f0ab55",htmlFor:"name"},"Name"),n("input",{key:"d449344ff106ad2a222ce134c72cf8a9f15ed829",id:"name",type:"text",value:this.name,onInput:e=>this.handleChange(e)}),this.newUri?n("div",{id:"new-uri",title:"This will be the URI of the new thing"},this.newUri):null,n("input",{key:"493bccdd4b475866aab67a3c77af87a067fa3076",id:"create",type:"submit",value:"Create",disabled:!this.canSubmit}))}handleChange(e){this.name=e.target.value;this.newUri=this.os.proposeUriForNewThing(this.referenceUri,this.name)}onTermSelected(e){this.selectedTypeUri=e.detail.uri}async handleSubmit(e){try{await this.os.addNewThing(this.newUri,this.name,this.selectedTypeUri);this.linkEmitter.emit(this.newUri);this.reset()}catch(t){e.preventDefault();this.errorEmitter.emit(t)}}reset(){this.name="";this.newUri="";this.selectedTypeUri=""}static get delegatesFocus(){return true}static get watchers(){return{name:["validate"],selectedTypeUri:["validate"]}}};_r.style=Sr;const Er=":host{--width:300px;--height:300px;--border-radius:var(--border-radius, 0);--object-fit:var(--object-fit, cover)}";const Ar=Er;const Tr=class{constructor(e){t(this,e);this.subscribeResource=r(this,"pod-os:resource",7);this.blurredBackground=false;this.receiveResource=e=>{this.resource=e}}componentWillLoad(){x(this)}render(){const e=this.resource?this.resource.picture():null;if(!e)return n("slot",null);return n("pos-image",{blurredBackground:this.blurredBackground,src:e.url,alt:this.resource.label()})}};Tr.style=Ar;const Cr="details.error {\n margin: var(--size-2);\n background-color: var(--pos-error-background-color);\n border: var(--size-px) solid var(--pos-error-border-color);\n padding: var(--size-2);\n border-radius: var(--radius-md);\n\n a {\n color: var(--pos-normal-text-color);\n }\n}\n";const Rr=Cr;const Ir=class{constructor(e){t(this,e);this.subscribePodOs=r(this,"pod-os:init",7);this.resourceLoadedEmitter=r(this,"pod-os:resource-loaded",7);this.consumers=[];this.lazy=false;this.loading=true;this.receivePodOs=async e=>{this.os=e}}componentWillLoad(){p.onChange("isLoggedIn",(()=>this.loadResource()));F(this)}async provideResource(e){e.stopPropagation();if(this.resource){e.detail(this.resource)}this.consumers.push(e)}async loadResource(){await this.getResource(!this.lazy)}async fetch(){await this.getResource(true)}async getResource(e=false){try{if(e){this.loading=true;await this.os.fetch(this.uri);this.resourceLoadedEmitter.emit(this.uri)}this.resource=this.os.store.get(this.uri);this.error=null;this.consumers.forEach((e=>{e.detail(this.resource)}))}catch(e){this.error=e}finally{this.loading=false}}render(){if(this.loading){return n("ion-progress-bar",{type:"indeterminate"})}if(this.error){return n("details",{class:"error"},n("summary",{title:"Click to expand"},"⚠ Sorry, something went wrong"),n("p",null,"Status:",this.error.status),n("p",null,this.error.message),n("p",null,"You can try to open the link outside PodOS: ",n("a",{href:this.uri},this.uri)))}return n("slot",null)}static get watchers(){return{os:["loadResource"],uri:["loadResource"]}}};Ir.style=Rr;const Pr=":host {\n --background-color: inherit;\n --label-color: var(--pos-normal-text-color);\n --description-color: var(--pos-normal-text-color);\n --uri-color: var(--pos-subtle-text-color);\n --font-family: var(--font-sans);\n}\n\np.content {\n background-color: var(--background-color);\n line-height: var(--line-xs);\n margin: 0;\n display: flex;\n flex-direction: column;\n align-items: baseline;\n gap: var(--size-1);\n\n .url {\n font-size: var(--scale-fluid-1);\n color: var(--pos-subtle-text-color);\n }\n}\n\na {\n color: var(--label-color);\n max-width: min(100%, var(--prose-lg));\n text-decoration: underline;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n text-decoration-thickness: var(--size-px);\n}\n\npos-label {\n color: var(--label-color);\n font-size: var(--scale-fluid-2);\n margin-bottom: var(--size-1);\n}\n\npos-description {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n text-overflow: ellipsis;\n overflow: hidden;\n font-weight: var(--weight-light);\n color: var(--description-color);\n font-size: var(--scale-fluid-2);\n}\n\n@media (min-width: 640px) {\n pos-label {\n font-size: var(--scale-fluid-0);\n }\n pos-description {\n font-size: var(--scale-fluid-1);\n }\n\n p.content {\n .url {\n font-size: var(--scale-fluid-000);\n }\n }\n}\n";const zr=Pr;const $r=class{constructor(e){t(this,e);this.linkEmitter=r(this,"pod-os:link",7);this.subscribeResource=r(this,"pod-os:resource",7);this.errorEmitter=r(this,"pod-os:error",7);this.followPredicate=false;this.error=null;this.showCustomContent=false;this.receiveResource=e=>{const t=(e,t,n,i)=>{if(e.length==0){this.error="No matching link found";this.errorEmitter.emit(new Error(`pos-rich-link: No matching link found from ${t.uri} ${i}=${n}`))}else if(e[0].uris.length>1){this.error="More than one matching link found";this.errorEmitter.emit(new Error(`pos-rich-link: More than one matching link found from ${t.uri} ${i}=${n}`))}else{this.link=e[0].uris[0];this.followPredicate=true}};if(this.rel){t(e.relations(this.rel),e,this.rel,"rel")}else if(this.rev){t(e.reverseRelations(this.rev),e,this.rev,"rev")}else{this.link=e.uri}}}componentWillLoad(){this.showCustomContent=!!this.host.lastElementChild||this.host.textContent.trim()!="";if(!this.uri)x(this)}render(){const e=e=>this.showCustomContent?n("a",{href:e,onClick:t=>{t.preventDefault();this.linkEmitter.emit(e)}},n("slot",null)):n("p",{class:"content"},n("a",{href:e,onClick:t=>{t.preventDefault();this.linkEmitter.emit(e)}},n("pos-label",null)),n("span",{class:"url"},new URL(e).host),n("pos-description",null));if(this.error){return this.error}else if(this.followPredicate){return n("pos-resource",{lazy:true,uri:this.link},e(this.link))}else if(this.link){return e(this.link)}else if(this.uri){return n("pos-resource",{lazy:true,uri:this.uri},e(this.uri))}else{return null}}get host(){return s(this)}};$r.style=zr;const Dr=(e,t,n)=>{const i=e.get(t);if(!i){e.set(t,[n])}else if(!i.includes(n)){i.push(n)}};const Wr=(e,t)=>{let n;return(...i)=>{if(n){clearTimeout(n)}n=setTimeout((()=>{n=0;e(...i)}),t)}};const Or=e=>!("isConnected"in e)||e.isConnected;const Lr=Wr((e=>{for(let t of e.keys()){e.set(t,e.get(t).filter(Or))}}),2e3);const jr=()=>{if(typeof o!=="function"){return{}}const e=new Map;return{dispose:()=>e.clear(),get:t=>{const n=o();if(n){Dr(e,t,n)}},set:t=>{const n=e.get(t);if(n){e.set(t,n.filter(a))}Lr(e)},reset:()=>{e.forEach((e=>e.forEach(a)));Lr(e)}}};const Ur=(e,t=((e,t)=>e!==t))=>{let n=new Map(Object.entries(e!==null&&e!==void 0?e:{}));const i={dispose:[],get:[],set:[],reset:[]};const s=()=>{n=new Map(Object.entries(e!==null&&e!==void 0?e:{}));i.reset.forEach((e=>e()))};const r=()=>{i.dispose.forEach((e=>e()));s()};const o=e=>{i.get.forEach((t=>t(e)));return n.get(e)};const a=(e,s)=>{const r=n.get(e);if(t(s,r,e)){n.set(e,s);i.set.forEach((t=>t(e,s,r)))}};const c=typeof Proxy==="undefined"?{}:new Proxy(e,{get(e,t){return o(t)},ownKeys(e){return Array.from(n.keys())},getOwnPropertyDescriptor(){return{enumerable:true,configurable:true}},has(e,t){return n.has(t)},set(e,t,n){a(t,n);return true}});const l=(e,t)=>{i[e].push(t);return()=>{Jr(i[e],t)}};const d=(t,n)=>{const i=l("set",((e,i)=>{if(e===t){n(i)}}));const s=l("reset",(()=>n(e[t])));return()=>{i();s()}};const h=(...e)=>{const t=e.reduce(((e,t)=>{if(t.set){e.push(l("set",t.set))}if(t.get){e.push(l("get",t.get))}if(t.reset){e.push(l("reset",t.reset))}if(t.dispose){e.push(l("dispose",t.dispose))}return e}),[]);return()=>t.forEach((e=>e()))};const u=e=>{const t=n.get(e);i.set.forEach((n=>n(e,t,t)))};return{state:c,get:o,set:a,on:l,onChange:d,use:h,dispose:r,reset:s,forceUpdate:u}};const Jr=(e,t)=>{const n=e.indexOf(t);if(n>=0){e[n]=e[e.length-1];e.length--}};const Kr=(e,t)=>{const n=Ur(e,t);n.use(jr());return n};const Hr=e=>{var t;const n=window;const i=new URL(n.location.href);const s=(t=e===null||e===void 0?void 0:e.parseURL)!==null&&t!==void 0?t:Mr;const{state:r,onChange:o,dispose:a}=Kr({url:i,activePath:s(i)},((e,t,n)=>{if(n==="url"){return e.href!==t.href}return e!==t}));const c=e=>{history.pushState(null,null,e);const t=new URL(e,document.baseURI);r.url=t;r.activePath=s(t)};const l=e=>{const{activePath:t}=r;for(let n of e){const i=Nr(t,n.path);if(i){if(n.to!=null){const i=typeof n.to==="string"?n.to:n.to(t);c(i);return l(e)}else{return{params:i,route:n}}}}return undefined};const d=()=>{const e=new URL(n.location.href);r.url=e;r.activePath=s(e)};const h=(e,t)=>{const n=l(t);if(n){if(typeof n.route.jsx==="function"){return n.route.jsx(n.params)}else{return n.route.jsx}}};const u=()=>{n.removeEventListener("popstate",d);a()};const f={Switch:h,get url(){return r.url},get activePath(){return r.activePath},push:c,onChange:o,dispose:u};d();n.addEventListener("popstate",d);return f};const Nr=(e,t)=>{if(typeof t==="string"){if(t===e){return{}}}else if(typeof t==="function"){const n=t(e);if(n){return n===true?{}:{...n}}}else{const n=t.exec(e);if(n){t.lastIndex=0;return{...n}}}return undefined};const Mr=e=>e.pathname.toLowerCase();const Br=".toolbar{display:flex;flex-direction:row;gap:0;align-items:center;margin-left:0.5rem}pos-navigation{flex-grow:1}";const Xr=Br;const Fr=Hr();const Vr=class{constructor(e){t(this,e);this.routeChanged=r(this,"pod-os:route-changed",7);this.mode="standalone"}linkClicked(e){this.navigate(e.detail)}sessionRestored(e){Fr.push(e.detail.url)}componentWillLoad(){this.updateUri();Fr.onChange("url",(()=>{this.updateUri()}))}navigate(e){Fr.push("?uri="+encodeURIComponent(e))}updateUri(){this.uri=new URLSearchParams(window.location.search).get("uri")||(this.mode==="standalone"?"pod-os:dashboard":window.location.href);this.routeChanged.emit(this.uri)}render(){return n("slot",{key:"6e8c5214a0e82fb838fc512ad3cfa4cfb480a29e"})}};Vr.style=Xr;const qr=":host{display:block}input{background-color:transparent;color:var(--pos-normal-text-color);border:none;padding-top:1rem;padding-bottom:1rem}input:focus{outline:none}";const Gr=qr;const Yr=class{constructor(e){t(this,e);this.subscribePodOs=r(this,"pod-os:init",7);this.termSelected=r(this,"pod-os:term-selected",7);this.placeholder="Type to search...";this.value="";this.terms=[];this.receivePodOs=async e=>{this.os=e}}componentWillLoad(){F(this)}setTerms(){this.terms=this.os.listKnownTerms()}handleChange(e){this.termSelected.emit({uri:e.target.value})}render(){return n(i,{key:"0dc25a3c0491f8dafb3b5350c7347907e98a08e7"},n("input",{key:"8f017d277f9fadaadc1bc3793d377848d315431b",part:"input",list:"terms",placeholder:this.placeholder,value:this.value,onChange:e=>this.handleChange(e)}),n("datalist",{key:"ab2fc8071cd8adc6999e1f460b8e8a8cb6d43849",part:"terms",id:"terms"},this.terms.map((e=>n("option",{value:e.uri},e.shorthand)))))}static get delegatesFocus(){return true}static get watchers(){return{os:["setTerms"]}}};Yr.style=Gr;const Zr=":host{border:var(--size-px) solid var(--pos-border-color);border-radius:var(--radius-lg);box-shadow:var(--shadow-md);padding:var(--size-8);max-width:var(--size-96);background:var(--pos-card-background)}svg{width:var(--size-8)}h2{display:flex;align-items:center}p{padding:var(--size-2)}.info{color:var(--color-grey-900);background-color:var(--color-blue-200)}.warn{color:var(--color-grey-900);background-color:var(--color-yellow-200)}";const Qr=Zr;const eo=class{constructor(e){t(this,e)}render(){return n(i,{key:"f024e7d542cfc87a4dc0a1f22694b664086ebd60"},n("div",{key:"e88e694cefa4a2361ca8c67f1bd023fda1b70f2a"},n("h2",{key:"c4b2e6270f26a2eb7f62e5076b40834903fc10e4"},n("svg",{key:"d63643c1ed908c6fe9ab4ff6c47b13848c714c32",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},n("path",{key:"78f055556bb175ea17d0db1ccf78c16343d67d3f","stroke-linecap":"round","stroke-linejoin":"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})),"Cache Settings"),n("p",{key:"3045ae3214b9e91feb34857ce45a3db6529f2959",class:"info"},"ℹ Enable offline cache to be able to access previously loaded data while offline."),n("p",{key:"9987c1cb59b62e1eb06c67a9c646a9a2f125529a",class:"warn"},"⚠ Private data may be stored on this device. Only enable it, if you trust this device."),n("label",{key:"55dd3c0fa7ece9a59437e7818d6cfa9b0e9eb5bf"},n("input",{key:"22874f8a39b5016b71818fa1d6226bf66ff969c3",type:"checkbox",checked:$e.state.offlineCache,onChange:e=>$e.state.offlineCache=e.target.checked}),"Enable offline cache")))}};eo.style=Qr;const to=":host {\n --button-size: var(--size-16);\n display: block;\n position: sticky;\n align-self: flex-start;\n top: 0;\n overflow: auto;\n min-width: var(--button-size);\n z-index: var(--layer-1);\n}\n\n[role='tablist'] {\n display: flex;\n flex-direction: column;\n justify-content: center;\n\n border-right: var(--size-px) solid var(--pos-border-color);\n\n button {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 0;\n font-size: var(--size-6);\n position: relative;\n overflow: hidden;\n outline: none;\n border: none;\n width: var(--button-size);\n min-width: var(--button-size);\n height: var(--button-size);\n min-height: var(--button-size);\n background-color: var(--pos-background-color);\n\n &::after {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: 0;\n height: 0;\n border-radius: 100%;\n background: color-mix(in srgb, var(--pos-primary-color), transparent 50%);\n transform: translate(-50%, -50%);\n opacity: 1;\n }\n\n &:active::after,\n &:focus::after {\n width: calc(var(--button-size) * 1.5);\n height: calc(var(--button-size) * 1.5);\n opacity: 0;\n transition:\n width 0.5s ease-out,\n height 0.5s ease-out,\n opacity 1s ease-out;\n }\n\n &:focus-visible {\n border: var(--size-px) solid var(--pos-primary-color);\n }\n\n @media (min-width: 640px) {\n &[aria-selected] {\n border-right: var(--size-1) solid var(--pos-primary-color);\n }\n }\n\n .text {\n font-size: var(--size-3);\n white-space: nowrap;\n text-overflow: ellipsis;\n width: 100%;\n overflow: hidden;\n }\n }\n}\n\n@media (max-width: 640px) {\n :host {\n position: fixed;\n top: unset;\n bottom: 0;\n width: 100dvw;\n }\n [role='tablist'] {\n flex-direction: row;\n background-color: var(--pos-background-color);\n\n border-top: var(--size-px) solid var(--pos-border-color);\n\n button {\n &[aria-selected] {\n border-top: var(--size-1) solid var(--pos-primary-color);\n }\n }\n }\n}\n";const no=to;const io=class{constructor(e){t(this,e);this.toolSelected=r(this,"pod-os:tool-selected",7);this.tools=[]}render(){if(this.tools.length>1){return n("div",{role:"tablist","aria-label":"Tools","aria-multiselectable":"false"},this.tools.map((e=>{var t;return n("button",{role:"tab","aria-selected":((t=this.selected)===null||t===void 0?void 0:t.element)===e.element,onClick:()=>this.toolSelected.emit(e)},n("sl-icon",{name:e.icon}),n("span",{class:"text"},e.label))})))}return null}};io.style=no;const so={Generic:{element:"pos-app-generic",label:"Data",icon:"list-ul",types:[]},RdfDocument:{element:"pos-app-rdf-document",label:"Things",icon:"diagram-2",types:[{uri:"http://www.w3.org/2007/ont/link#RDFDocument",priority:20}]},DocumentViewer:{element:"pos-app-document-viewer",label:"Doc",icon:"file-text",types:[{uri:ro("application/pdf"),priority:30},{uri:"http://www.w3.org/2007/ont/link#Document",priority:10}]},ImageViewer:{element:"pos-app-image-viewer",label:"Pic",icon:"file-image",types:[{uri:"http://purl.org/dc/terms/Image",priority:20}]},LdpContainer:{element:"pos-app-ldp-container",label:"Content",icon:"folder",types:[{uri:"http://www.w3.org/ns/ldp#Container",priority:30}]}};function ro(e){return"http://www.w3.org/ns/iana/media-types/"+e+"#Resource"}function oo(e){const t=new Set(e.map((e=>e.uri)));return Object.values(so).map(ao(t)).filter(lo).toSorted(ho).map((e=>e.tool)).concat(so.Generic)}const ao=e=>t=>({tool:t,priority:co(t.types,e)});function co(e,t){return e.filter((e=>t.has(e.uri))).reduce(((e,t)=>Math.max(e,t.priority)),0)}const lo=e=>e.priority>0;const ho=(e,t)=>t.priority-e.priority;const uo="section {\n display: flex;\n flex-direction: row;\n}\n\n.tools {\n flex-grow: 1;\n &.transition {\n position: relative;\n .tool {\n position: absolute;\n }\n }\n}\n\n.tool {\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n &.visible {\n animation: fadeIn 300ms ease-in;\n }\n &.hidden {\n animation: fadeOut 300ms ease-in;\n }\n}\n\n@keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes fadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n@media (max-width: 640px) {\n section {\n --toolbar-size: var(--size-16);\n flex-direction: column-reverse;\n padding-bottom: var(--toolbar-size);\n pos-tool-select {\n --button-size: var(--toolbar-size);\n }\n }\n}\n";const fo=uo;const po=class{constructor(e){t(this,e);this.subscribeResource=r(this,"pod-os:resource",7);this.transitioning=false;this.receiveResource=e=>{var t;const n=e.types();this.availableTools=oo(n);this.currentTool=(t=this.availableTools.find((e=>e.element===this.initialTool)))!==null&&t!==void 0?t:this.availableTools[0]}}componentWillLoad(){x(this);const e=new URLSearchParams(window.location.search);const t=e.get("tool");if(t){this.initialTool=t}}handleToolSelected(e){this.oldTool=this.currentTool;this.currentTool=e.detail;this.transitioning=true;const t=new URL(window.location.href);t.searchParams.set("tool",e.detail.element);window.history.replaceState({},"",t.toString())}render(){return this.availableTools?this.renderApp():null}renderApp(){var e;const t=this.currentTool.element;const i=(e=this.oldTool)===null||e===void 0?void 0:e.element;return n("section",null,n("pos-tool-select",{selected:this.currentTool,tools:this.availableTools}),n("div",{class:{tools:true,transition:this.transitioning},onAnimationEnd:()=>this.removeOldTool()},i&&n(i,{class:"tool hidden"}),n(t,{class:"tool visible"})))}removeOldTool(){this.oldTool=null;this.transitioning=false}};po.style=fo;var bo=S`
627
+ `}};is.styles=[A,Hr];is.dependencies={"sl-icon":C,"sl-popup":N,"sl-spinner":ns};T([O("slot:not([name])")],is.prototype,"defaultSlot",2);T([O(".menu-item")],is.prototype,"menuItem",2);T([$()],is.prototype,"type",2);T([$({type:Boolean,reflect:true})],is.prototype,"checked",2);T([$()],is.prototype,"value",2);T([$({type:Boolean,reflect:true})],is.prototype,"loading",2);T([$({type:Boolean,reflect:true})],is.prototype,"disabled",2);T([R("checked")],is.prototype,"handleCheckedChange",1);T([R("disabled")],is.prototype,"handleDisabledChange",1);T([R("type")],is.prototype,"handleTypeChange",1);is.define("sl-menu-item");const rs="button.main {\n display: flex;\n transition:\n width 200ms,\n background-color 500ms,\n color 500ms,\n border-color 500ms;\n max-width: var(--size-40);\n flex-direction: row;\n overflow: hidden;\n height: var(--pos-navigation-bar-height);\n width: var(--pos-navigation-bar-height);\n align-items: center;\n justify-content: center;\n border-radius: var(--radius-md);\n color: var(--pos-subtle-text-color);\n border: var(--size-px) dashed var(--pos-subtle-text-color);\n background-color: var(--pos-background-color);\n\n p {\n padding: 0;\n margin: 0;\n display: none;\n white-space: nowrap;\n }\n\n &.success {\n color: var(--color-green-700);\n border-color: var(--color-green-700);\n border-style: solid;\n background-color: var(--color-green-100);\n }\n\n &:active {\n transform: scale(0.99);\n filter: brightness(90%);\n }\n &:focus {\n outline: var(--pos-input-focus-outline);\n }\n}\n\nsvg {\n display: inline-block;\n height: var(--size-6);\n flex-shrink: 0;\n flex-grow: 0;\n width: var(--size-6);\n}\n\nbutton.main:hover,\nsl-dropdown[open] button {\n &.success {\n background: var(--color-green-200);\n color: var(--color-green-700);\n }\n width: var(--size-full);\n height: var(--pos-navigation-bar-height);\n background: var(--pos-background-color);\n color: var(--pos-normal-text-color);\n\n p {\n display: inline-block;\n }\n}\n";const ss=rs;const os=class{constructor(e){t(this,e);this.subscribePodOs=s(this,"pod-os:init",7);this.errorEmitter=s(this,"pod-os:error",7);this.indexUpdatedEmitter=s(this,"pod-os:search:index-updated",7);this.indexCreatedEmitter=s(this,"pod-os:search:index-created",7);this.indexes=[];this.showOptions=false;this.isIndexed=false;this.receivePodOs=async e=>{this.os=e;this.thing=this.os.store.get(this.uri);this.getLabelIndexes(p.state.profile);this.unsubscribeSessionChange=p.onChange("profile",(e=>{this.getLabelIndexes(e)}))}}componentWillLoad(){F(this)}disconnectedCallback(){this.unsubscribeSessionChange&&this.unsubscribeSessionChange()}updateUri(e){this.thing=this.os.store.get(e);this.isIndexed=this.checkIfIndexed(e)}checkIfIndexed(e){return this.indexes.some((t=>t.contains(e)))}getLabelIndexes(e){if(e){this.indexes=e.getPrivateLabelIndexes().map((e=>this.os.store.get(e).assume(w)));this.showOptions=this.indexes.length>1;this.isIndexed=this.checkIfIndexed(this.uri)}}async onClick(e){e.preventDefault();if(this.indexes.length===1){const e=this.indexes[0];await this.addToLabelIndex(e);this.indexUpdatedEmitter.emit(e)}else if(this.indexes.length===0){const e=await this.createDefaultLabelIndex();await this.addToLabelIndex(e);this.indexCreatedEmitter.emit(e)}}async addToLabelIndex(e){try{await this.os.addToLabelIndex(this.thing,e);this.isIndexed=true}catch(e){this.errorEmitter.emit(e)}}async createDefaultLabelIndex(){try{return await this.os.createDefaultLabelIndex(p.state.profile)}catch(e){this.errorEmitter.emit(e)}}render(){if(!p.state.isLoggedIn||!this.uri){return null}const e="Make this findable";const t=n("button",{type:"button",slot:"trigger","aria-label":e,class:{main:true,success:this.isIndexed},onClick:e=>this.onClick(e),title:""},this.isIndexed?n(cs,null):n(as,null),n("p",null,e));if(this.showOptions){return n(i,null,n("sl-dropdown",null,t,n("sl-menu",{role:"listbox"},this.indexes.map((e=>n("sl-menu-item",{role:"option",value:e,type:"checkbox",checked:e.contains(this.uri)},n("pos-resource",{uri:e.uri,lazy:true},n("pos-label",null))))))))}else{return t}}async onSelect(e){const t=e.detail.item.value;e.preventDefault();await this.addToLabelIndex(t);this.indexUpdatedEmitter.emit(t)}get el(){return r(this)}static get watchers(){return{uri:["updateUri"]}}};const as=()=>n("svg",{role:"presentation",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},n("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m5.231 13.481L15 17.25m-4.5-15H5.625c-.621 0-1.125.504-1.125 1.125v16.5c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Zm3.75 11.625a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z"}));const cs=()=>n("svg",{role:"presentation",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},n("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.125 2.25h-4.5c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125v-9M10.125 2.25h.375a9 9 0 0 1 9 9v.375M10.125 2.25A3.375 3.375 0 0 1 13.5 5.625v1.5c0 .621.504 1.125 1.125 1.125h1.5a3.375 3.375 0 0 1 3.375 3.375M9 15l2.25 2.25L15 12"}));os.style=ss;const ls=":host {\n --pos-navigation-bar-height: var(--size-10);\n}\n\nsearch {\n position: relative;\n}\n\n.suggestions ol {\n border: 1px solid var(--pos-border-color);\n display: flex;\n flex-direction: column;\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n\n.suggestions {\n width: 100%;\n overflow-y: auto;\n max-height: 90dvh;\n li {\n padding: 1rem;\n background-color: var(--pos-background-color);\n pos-rich-link {\n --background-color: inherit;\n }\n &[aria-selected='true'] {\n background-color: var(--pos-primary-color);\n &:hover {\n background-color: var(--pos-primary-color);\n }\n }\n &:hover {\n background-color: var(--pos-border-color);\n }\n }\n}\n\n.suggestions li.selected pos-rich-link {\n --label-color: white;\n --description-color: var(--pos-border-color);\n --uri-color: var(--pos-subtle-text-color);\n}\n\ndialog {\n position: absolute;\n margin-top: calc(-1 * var(--pos-navigation-bar-height));\n padding: 0;\n width: 100%;\n max-width: 100%;\n min-width: 100%;\n overflow: hidden;\n max-height: 100dvh;\n background-color: var(--pos-background-color);\n color: var(--pos-normal-text-color);\n border: var(--pos-border-color);\n border-radius: var(--radius-md);\n box-shadow: var(--shadow-md);\n form {\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n align-items: center;\n input {\n display: flex;\n font-size: var(--scale-1);\n height: var(--pos-navigation-bar-height);\n border-top-left-radius: var(--radius-md);\n border-top-right-radius: var(--radius-md);\n padding-left: var(--size-2);\n width: 100%;\n border: none;\n outline: none;\n color: var(--pos-normal-text-color);\n background-color: var(--pos-input-background-color);\n box-sizing: border-box;\n }\n }\n}\n\ndialog[open] {\n display: flex;\n z-index: var(--layer-top);\n animation: slideIn 100ms ease-out;\n}\n\n@media (max-width: 640px) {\n search {\n position: unset;\n }\n dialog {\n margin-top: var(--size-1);\n top: 0;\n width: 95dvw;\n max-width: unset;\n min-width: unset;\n form {\n input {\n height: var(--size-12);\n font-size: var(--scale-fluid-3);\n }\n }\n }\n}\n\n@keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n";const ds=ls;const hs=class{constructor(e){t(this,e);this.subscribePodOs=s(this,"pod-os:init",7);this.linkEmitter=s(this,"pod-os:link",7);this.uri="";this.inputValue=this.uri;this.searchIndex=undefined;this.suggestions=[];this.selectedIndex=-1;this.resource=null;this.changeEvents=new v;this.debouncedSearch=null;this.receivePodOs=async e=>{this.os=e}}updateResource(){var e;try{this.resource=this.uri?(e=this.os)===null||e===void 0?void 0:e.store.get(this.uri):null}catch(e){this.resource=null}}componentWillLoad(){F(this);this.updateResource();p.onChange("isLoggedIn",(async e=>{if(e){await this.buildSearchIndex()}else{this.clearSearchIndex()}}));this.debouncedSearch=this.changeEvents.pipe(k(300)).subscribe((()=>this.search()))}disconnectedCallback(){var e;(e=this.debouncedSearch)===null||e===void 0?void 0:e.unsubscribe()}async buildSearchIndex(){this.searchIndex=await this.os.buildSearchIndex(p.state.profile)}rebuildSearchIndex(){this.searchIndex.rebuild()}openNavigationDialog(e){var t,n;this.resource=e.detail;if(e.detail){this.inputValue=e.detail.uri;this.search()}(t=this.inputRef)===null||t===void 0?void 0:t.select();(n=this.dialogRef)===null||n===void 0?void 0:n.show()}clearSearchIndex(){var e;(e=this.searchIndex)===null||e===void 0?void 0:e.clear()}onChange(e){this.inputValue=e.target.value;this.changeEvents.next()}closeDialog(){var e;(e=this.dialogRef)===null||e===void 0?void 0:e.close();this.selectedIndex=-1}clearSuggestions(){var e;this.suggestions=[];(e=this.dialogRef)===null||e===void 0?void 0:e.close();this.selectedIndex=-1}onClickSelf(e){e.stopPropagation()}handleKeyDown(e){if(e.key==="Escape"){this.closeDialog()}else if(e.key==="ArrowDown"){e.preventDefault();this.selectedIndex=Math.min(this.selectedIndex+1,this.suggestions.length-1)}else if(e.key==="ArrowUp"){e.preventDefault();this.selectedIndex=Math.max(this.selectedIndex-1,0)}}search(){if(this.searchIndex){this.suggestions=this.inputValue?this.searchIndex.search(this.inputValue):[]}}onSubmit(){if(this.suggestions&&this.selectedIndex>-1){this.linkEmitter.emit(this.suggestions[this.selectedIndex].ref)}else{this.linkEmitter.emit(this.inputValue)}}render(){return n("nav",{key:"44f504f9a905c6e63353741cda554a6a35a46f82"},n("search",{key:"98e7cae9729db2959d992f9e41a4cc99064b9eb0"},n("pos-navigation-bar",{key:"c0ce90fcc8334d0ea784ca3126a1524b036631ac",searchIndexReady:this.searchIndex!==undefined,current:this.resource}),n("dialog",{key:"a9b1418ad48ae298fbd8eaa56e62eb613e8deef6",ref:e=>this.dialogRef=e},n("form",{key:"a75933116bd844e0afc4e94eee713adb6d6bb4ea",method:"dialog",onSubmit:()=>this.onSubmit()},n("input",{key:"c6de46f82392acf3752e51e64dc6e5526f8d6a04",ref:e=>this.inputRef=e,enterkeyhint:"search","aria-label":"Search or enter URI",placeholder:"Search or enter URI",value:this.uri,onChange:e=>this.onChange(e),onInput:e=>this.onChange(e),role:"combobox","aria-autocomplete":"list","aria-expanded":this.suggestions.length>0,"aria-controls":"suggestions-list","aria-activedescendant":this.selectedIndex>=0?`option-${this.selectedIndex}`:null}),this.suggestions.length>0?n("div",{class:"suggestions"},n("ol",{id:"suggestions-list",role:"listbox","aria-label":"Search results"},this.suggestions.map(((e,t)=>n("li",{id:`option-${t}`,role:"option","aria-selected":t===this.selectedIndex?"true":"false"},n("pos-rich-link",{uri:e.ref})))))):null))))}static get watchers(){return{uri:["updateResource"],os:["updateResource"]}}};hs.style=ds;const us="section.current {\n display: flex;\n height: var(--pos-navigation-bar-height);\n flex-grow: 1;\n gap: 0;\n background-color: var(--pos-input-background-color);\n border-radius: var(--radius-md);\n width: 100%;\n &:focus-within {\n outline: var(--pos-input-focus-outline);\n }\n}\n\nsection.current button {\n cursor: pointer;\n font-size: var(--scale-1);\n display: flex;\n align-items: center;\n justify-content: center;\n flex-grow: 1;\n background: none;\n color: var(--pos-normal-text-color);\n outline: none;\n border: none;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n &:focus {\n text-decoration: underline;\n }\n :first-child {\n flex-grow: 1;\n }\n svg {\n width: var(--size-6);\n color: var(--pos-subtle-text-color);\n }\n}\n";const fs=us;const ps=class{constructor(e){t(this,e);this.navigate=s(this,"pod-os:navigate",7)}onClick(){this.navigate.emit(this.current)}activate(e){if((e.ctrlKey||e.metaKey)&&e.key==="k"){e.preventDefault();this.navigate.emit(this.current)}}render(){const e=this.current?`${this.current.label()} (Click to search or enter URI)`:"Search or enter URI";return n("section",{key:"a66626042ab42e63094b7b27729f0c299d6e62a3",class:"current"},this.current&&this.searchIndexReady&&n("pos-make-findable",{key:"4e2e2e3271c4ed78c34e32e0a815a87dd9d73b52",uri:this.current.uri}),n("button",{key:"5ff874354f32f9fef4b15337ce7230c43df0c0ca","aria-label":e,onClick:()=>this.onClick()},n("div",{key:"d00d82f397fb9f3ede61484d6cc2ae74ef92fd06"},this.current?this.current.label():"Search or enter URI"),this.icon()))}icon(){return n("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},n("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"}))}};ps.style=fs;const bs=":host{display:block}form{display:grid;grid-template-columns:var(--size-16) 1fr;grid-gap:var(--scale-0)}label{grid-column:1 / 2;display:flex;align-items:center;justify-content:flex-end}input,pos-select-term,button{grid-column:2 / 3}input,pos-select-term::part(input){outline:var(--pos-input-outline);padding:var(--scale-000);border:none;border-radius:var(--radius-xs);width:var(--size-full);box-sizing:border-box;background:var(--pos-input-background-color);color:var(--pos-normal-text-color)}input:focus-within,pos-select-term::part(input):focus-within{outline:var(--pos-input-focus-outline)}#new-uri{grid-column:1/3;cursor:default;word-break:break-all;color:var(--pos-normal-text-color);font-weight:var(--weight-light);background:var(--pos-disabled-color);padding:var(--scale-000);border-radius:var(--radius-xs)}input#create{outline:none;box-shadow:var(--shadow-sm);cursor:pointer;color:var(--pos-primary-text-color);background-color:var(--pos-primary-color)}input#create:disabled{cursor:default;color:var(--pos-disabled-text-color);background-color:var(--pos-disabled-color);box-shadow:none}input#create:hover:not(:disabled),input#create:focus{filter:brightness(110%);box-shadow:var(--shadow-md)}";const ms=bs;const gs=class{constructor(e){t(this,e);this.linkEmitter=s(this,"pod-os:link",7);this.errorEmitter=s(this,"pod-os:error",7);this.subscribePodOs=s(this,"pod-os:init",7);this.canSubmit=false;this.receivePodOs=async e=>{this.os=e}}validate(){this.canSubmit=Boolean(this.name&&this.selectedTypeUri)}componentWillLoad(){F(this)}render(){return n("form",{key:"97ee880c3abec22c35be46a9cceea2458cf21ed9",method:"dialog",onSubmit:e=>this.handleSubmit(e)},n("label",{key:"d8640130a517630c02b974ee4013d2c3280b6fa2",htmlFor:"type"},"Type"),n("pos-select-term",{key:"e046ea254ed78f9ad89c4c20ada3c6ff13349749",id:"type",placeholder:"",value:this.selectedTypeUri,"onPod-os:term-selected":e=>this.onTermSelected(e)}),n("label",{key:"aed99f50050048a826960059e67f7c35d3f0ab55",htmlFor:"name"},"Name"),n("input",{key:"d449344ff106ad2a222ce134c72cf8a9f15ed829",id:"name",type:"text",value:this.name,onInput:e=>this.handleChange(e)}),this.newUri?n("div",{id:"new-uri",title:"This will be the URI of the new thing"},this.newUri):null,n("input",{key:"493bccdd4b475866aab67a3c77af87a067fa3076",id:"create",type:"submit",value:"Create",disabled:!this.canSubmit}))}handleChange(e){this.name=e.target.value;this.newUri=this.os.proposeUriForNewThing(this.referenceUri,this.name)}onTermSelected(e){this.selectedTypeUri=e.detail.uri}async handleSubmit(e){try{await this.os.addNewThing(this.newUri,this.name,this.selectedTypeUri);this.linkEmitter.emit(this.newUri);this.reset()}catch(t){e.preventDefault();this.errorEmitter.emit(t)}}reset(){this.name="";this.newUri="";this.selectedTypeUri=""}static get delegatesFocus(){return true}static get watchers(){return{name:["validate"],selectedTypeUri:["validate"]}}};gs.style=ms;const ws=":host{--width:300px;--height:300px;--border-radius:var(--border-radius, 0);--object-fit:var(--object-fit, cover)}";const vs=ws;const ys=class{constructor(e){t(this,e);this.subscribeResource=s(this,"pod-os:resource",7);this.blurredBackground=false;this.receiveResource=e=>{this.resource=e}}componentWillLoad(){x(this)}render(){const e=this.resource?this.resource.picture():null;if(!e)return n("slot",null);return n("pos-image",{blurredBackground:this.blurredBackground,src:e.url,alt:this.resource.label()})}};ys.style=vs;const ks="details.error {\n margin: var(--size-2);\n background-color: var(--pos-error-background-color);\n border: var(--size-px) solid var(--pos-error-border-color);\n padding: var(--size-2);\n border-radius: var(--radius-md);\n\n a {\n color: var(--pos-normal-text-color);\n }\n}\n";const xs=ks;const Ss=class{constructor(e){t(this,e);this.subscribePodOs=s(this,"pod-os:init",7);this.resourceLoadedEmitter=s(this,"pod-os:resource-loaded",7);this.consumers=[];this.lazy=false;this.loading=true;this.receivePodOs=async e=>{this.os=e}}componentWillLoad(){p.onChange("isLoggedIn",(()=>this.loadResource()));F(this)}async provideResource(e){e.stopPropagation();if(this.resource){e.detail(this.resource)}this.consumers.push(e)}async loadResource(){await this.getResource(!this.lazy)}async fetch(){await this.getResource(true)}async getResource(e=false){try{if(e){this.loading=true;await this.os.fetch(this.uri);this.resourceLoadedEmitter.emit(this.uri)}this.resource=this.os.store.get(this.uri);this.error=null;this.consumers.forEach((e=>{e.detail(this.resource)}))}catch(e){this.error=e}finally{this.loading=false}}render(){if(this.loading){return n("ion-progress-bar",{type:"indeterminate"})}if(this.error){return n("details",{class:"error"},n("summary",{title:"Click to expand"},"⚠ Sorry, something went wrong"),n("p",null,"Status:",this.error.status),n("p",null,this.error.message),n("p",null,"You can try to open the link outside PodOS: ",n("a",{href:this.uri},this.uri)))}return n("slot",null)}static get watchers(){return{os:["loadResource"],uri:["loadResource"]}}};Ss.style=xs;const _s=":host {\n --background-color: inherit;\n --label-color: var(--pos-normal-text-color);\n --description-color: var(--pos-normal-text-color);\n --uri-color: var(--pos-subtle-text-color);\n --font-family: var(--font-sans);\n}\n\np.content {\n background-color: var(--background-color);\n line-height: var(--line-xs);\n margin: 0;\n display: flex;\n flex-direction: column;\n align-items: baseline;\n gap: var(--size-1);\n\n .url {\n font-size: var(--scale-fluid-1);\n color: var(--pos-subtle-text-color);\n }\n}\n\na {\n color: var(--label-color);\n max-width: min(100%, var(--prose-lg));\n text-decoration: underline;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n text-decoration-thickness: var(--size-px);\n}\n\npos-label {\n color: var(--label-color);\n font-size: var(--scale-fluid-2);\n margin-bottom: var(--size-1);\n}\n\npos-description {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n text-overflow: ellipsis;\n overflow: hidden;\n font-weight: var(--weight-light);\n color: var(--description-color);\n font-size: var(--scale-fluid-2);\n}\n\n@media (min-width: 640px) {\n pos-label {\n font-size: var(--scale-fluid-0);\n }\n pos-description {\n font-size: var(--scale-fluid-1);\n }\n\n p.content {\n .url {\n font-size: var(--scale-fluid-000);\n }\n }\n}\n";const Es=_s;const As=class{constructor(e){t(this,e);this.linkEmitter=s(this,"pod-os:link",7);this.subscribeResource=s(this,"pod-os:resource",7);this.errorEmitter=s(this,"pod-os:error",7);this.followPredicate=false;this.error=null;this.showCustomContent=false;this.receiveResource=e=>{const t=(e,t,n,i)=>{if(e.length==0){this.error="No matching link found";this.errorEmitter.emit(new Error(`pos-rich-link: No matching link found from ${t.uri} ${i}=${n}`))}else if(e[0].uris.length>1){this.error="More than one matching link found";this.errorEmitter.emit(new Error(`pos-rich-link: More than one matching link found from ${t.uri} ${i}=${n}`))}else{this.link=e[0].uris[0];this.followPredicate=true}};if(this.rel){t(e.relations(this.rel),e,this.rel,"rel")}else if(this.rev){t(e.reverseRelations(this.rev),e,this.rev,"rev")}else{this.link=e.uri}}}componentWillLoad(){this.showCustomContent=!!this.host.lastElementChild||this.host.textContent.trim()!="";if(!this.uri)x(this)}render(){const e=e=>this.showCustomContent?n("a",{href:e,onClick:t=>{t.preventDefault();this.linkEmitter.emit(e)}},n("slot",null)):n("p",{class:"content"},n("a",{href:e,onClick:t=>{t.preventDefault();this.linkEmitter.emit(e)}},n("pos-label",null)),n("span",{class:"url"},new URL(e).host),n("pos-description",null));if(this.error){return this.error}else if(this.followPredicate){return n("pos-resource",{lazy:true,uri:this.link},e(this.link))}else if(this.link){return e(this.link)}else if(this.uri){return n("pos-resource",{lazy:true,uri:this.uri},e(this.uri))}else{return null}}get host(){return r(this)}};As.style=Es;const Cs=(e,t,n)=>{const i=e.get(t);if(!i){e.set(t,[n])}else if(!i.includes(n)){i.push(n)}};const Ts=(e,t)=>{let n;return(...i)=>{if(n){clearTimeout(n)}n=setTimeout((()=>{n=0;e(...i)}),t)}};const Is=e=>!("isConnected"in e)||e.isConnected;const zs=Ts((e=>{for(let t of e.keys()){e.set(t,e.get(t).filter(Is))}}),2e3);const $s=()=>{if(typeof o!=="function"){return{}}const e=new Map;return{dispose:()=>e.clear(),get:t=>{const n=o();if(n){Cs(e,t,n)}},set:t=>{const n=e.get(t);if(n){e.set(t,n.filter(a))}zs(e)},reset:()=>{e.forEach((e=>e.forEach(a)));zs(e)}}};const Rs=(e,t=((e,t)=>e!==t))=>{let n=new Map(Object.entries(e!==null&&e!==void 0?e:{}));const i={dispose:[],get:[],set:[],reset:[]};const r=()=>{n=new Map(Object.entries(e!==null&&e!==void 0?e:{}));i.reset.forEach((e=>e()))};const s=()=>{i.dispose.forEach((e=>e()));r()};const o=e=>{i.get.forEach((t=>t(e)));return n.get(e)};const a=(e,r)=>{const s=n.get(e);if(t(r,s,e)){n.set(e,r);i.set.forEach((t=>t(e,r,s)))}};const c=typeof Proxy==="undefined"?{}:new Proxy(e,{get(e,t){return o(t)},ownKeys(e){return Array.from(n.keys())},getOwnPropertyDescriptor(){return{enumerable:true,configurable:true}},has(e,t){return n.has(t)},set(e,t,n){a(t,n);return true}});const l=(e,t)=>{i[e].push(t);return()=>{Ps(i[e],t)}};const d=(t,n)=>{const i=l("set",((e,i)=>{if(e===t){n(i)}}));const r=l("reset",(()=>n(e[t])));return()=>{i();r()}};const h=(...e)=>{const t=e.reduce(((e,t)=>{if(t.set){e.push(l("set",t.set))}if(t.get){e.push(l("get",t.get))}if(t.reset){e.push(l("reset",t.reset))}if(t.dispose){e.push(l("dispose",t.dispose))}return e}),[]);return()=>t.forEach((e=>e()))};const u=e=>{const t=n.get(e);i.set.forEach((n=>n(e,t,t)))};return{state:c,get:o,set:a,on:l,onChange:d,use:h,dispose:s,reset:r,forceUpdate:u}};const Ps=(e,t)=>{const n=e.indexOf(t);if(n>=0){e[n]=e[e.length-1];e.length--}};const Ds=(e,t)=>{const n=Rs(e,t);n.use($s());return n};const Ws=e=>{var t;const n=window;const i=new URL(n.location.href);const r=(t=e===null||e===void 0?void 0:e.parseURL)!==null&&t!==void 0?t:Ls;const{state:s,onChange:o,dispose:a}=Ds({url:i,activePath:r(i)},((e,t,n)=>{if(n==="url"){return e.href!==t.href}return e!==t}));const c=e=>{history.pushState(null,null,e);const t=new URL(e,document.baseURI);s.url=t;s.activePath=r(t)};const l=e=>{const{activePath:t}=s;for(let n of e){const i=Os(t,n.path);if(i){if(n.to!=null){const i=typeof n.to==="string"?n.to:n.to(t);c(i);return l(e)}else{return{params:i,route:n}}}}return undefined};const d=()=>{const e=new URL(n.location.href);s.url=e;s.activePath=r(e)};const h=(e,t)=>{const n=l(t);if(n){if(typeof n.route.jsx==="function"){return n.route.jsx(n.params)}else{return n.route.jsx}}};const u=()=>{n.removeEventListener("popstate",d);a()};const f={Switch:h,get url(){return s.url},get activePath(){return s.activePath},push:c,onChange:o,dispose:u};d();n.addEventListener("popstate",d);return f};const Os=(e,t)=>{if(typeof t==="string"){if(t===e){return{}}}else if(typeof t==="function"){const n=t(e);if(n){return n===true?{}:{...n}}}else{const n=t.exec(e);if(n){t.lastIndex=0;return{...n}}}return undefined};const Ls=e=>e.pathname.toLowerCase();const js=".toolbar{display:flex;flex-direction:row;gap:0;align-items:center;margin-left:0.5rem}pos-navigation{flex-grow:1}";const Us=js;const Js=Ws();const Ks=class{constructor(e){t(this,e);this.routeChanged=s(this,"pod-os:route-changed",7);this.mode="standalone"}linkClicked(e){this.navigate(e.detail)}sessionRestored(e){Js.push(e.detail.url)}componentWillLoad(){this.updateUri();Js.onChange("url",(()=>{this.updateUri()}))}navigate(e){Js.push("?uri="+encodeURIComponent(e))}updateUri(){this.uri=new URLSearchParams(window.location.search).get("uri")||(this.mode==="standalone"?"pod-os:dashboard":window.location.href);this.routeChanged.emit(this.uri)}render(){return n("slot",{key:"6e8c5214a0e82fb838fc512ad3cfa4cfb480a29e"})}};Ks.style=Us;const Hs=":host{display:block}input{background-color:transparent;color:var(--pos-normal-text-color);border:none;padding-top:1rem;padding-bottom:1rem}input:focus{outline:none}";const Ns=Hs;const Ms=class{constructor(e){t(this,e);this.subscribePodOs=s(this,"pod-os:init",7);this.termSelected=s(this,"pod-os:term-selected",7);this.placeholder="Type to search...";this.value="";this.terms=[];this.receivePodOs=async e=>{this.os=e}}componentWillLoad(){F(this)}setTerms(){this.terms=this.os.listKnownTerms()}handleChange(e){this.termSelected.emit({uri:e.target.value})}render(){return n(i,{key:"0dc25a3c0491f8dafb3b5350c7347907e98a08e7"},n("input",{key:"8f017d277f9fadaadc1bc3793d377848d315431b",part:"input",list:"terms",placeholder:this.placeholder,value:this.value,onChange:e=>this.handleChange(e)}),n("datalist",{key:"ab2fc8071cd8adc6999e1f460b8e8a8cb6d43849",part:"terms",id:"terms"},this.terms.map((e=>n("option",{value:e.uri},e.shorthand)))))}static get delegatesFocus(){return true}static get watchers(){return{os:["setTerms"]}}};Ms.style=Ns;const Bs=":host{border:var(--size-px) solid var(--pos-border-color);border-radius:var(--radius-lg);box-shadow:var(--shadow-md);padding:var(--size-8);max-width:var(--size-96);background:var(--pos-card-background)}svg{width:var(--size-8)}h2{display:flex;align-items:center}p{padding:var(--size-2)}.info{color:var(--color-grey-900);background-color:var(--color-blue-200)}.warn{color:var(--color-grey-900);background-color:var(--color-yellow-200)}";const Xs=Bs;const Fs=class{constructor(e){t(this,e)}render(){return n(i,{key:"f024e7d542cfc87a4dc0a1f22694b664086ebd60"},n("div",{key:"e88e694cefa4a2361ca8c67f1bd023fda1b70f2a"},n("h2",{key:"c4b2e6270f26a2eb7f62e5076b40834903fc10e4"},n("svg",{key:"d63643c1ed908c6fe9ab4ff6c47b13848c714c32",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},n("path",{key:"78f055556bb175ea17d0db1ccf78c16343d67d3f","stroke-linecap":"round","stroke-linejoin":"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})),"Cache Settings"),n("p",{key:"3045ae3214b9e91feb34857ce45a3db6529f2959",class:"info"},"ℹ Enable offline cache to be able to access previously loaded data while offline."),n("p",{key:"9987c1cb59b62e1eb06c67a9c646a9a2f125529a",class:"warn"},"⚠ Private data may be stored on this device. Only enable it, if you trust this device."),n("label",{key:"55dd3c0fa7ece9a59437e7818d6cfa9b0e9eb5bf"},n("input",{key:"22874f8a39b5016b71818fa1d6226bf66ff969c3",type:"checkbox",checked:Pe.state.offlineCache,onChange:e=>Pe.state.offlineCache=e.target.checked}),"Enable offline cache")))}};Fs.style=Xs;const Vs=":host {\n --button-size: var(--size-16);\n display: block;\n position: sticky;\n align-self: flex-start;\n top: 0;\n overflow: auto;\n min-width: var(--button-size);\n z-index: var(--layer-1);\n}\n\n[role='tablist'] {\n display: flex;\n flex-direction: column;\n justify-content: center;\n\n border-right: var(--size-px) solid var(--pos-border-color);\n\n button {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 0;\n font-size: var(--size-6);\n position: relative;\n overflow: hidden;\n outline: none;\n border: none;\n width: var(--button-size);\n min-width: var(--button-size);\n height: var(--button-size);\n min-height: var(--button-size);\n background-color: var(--pos-background-color);\n\n &::after {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: 0;\n height: 0;\n border-radius: 100%;\n background: color-mix(in srgb, var(--pos-primary-color), transparent 50%);\n transform: translate(-50%, -50%);\n opacity: 1;\n }\n\n &:active::after,\n &:focus::after {\n width: calc(var(--button-size) * 1.5);\n height: calc(var(--button-size) * 1.5);\n opacity: 0;\n transition:\n width 0.5s ease-out,\n height 0.5s ease-out,\n opacity 1s ease-out;\n }\n\n &:focus-visible {\n border: var(--size-px) solid var(--pos-primary-color);\n }\n\n @media (min-width: 640px) {\n &[aria-selected] {\n border-right: var(--size-1) solid var(--pos-primary-color);\n }\n }\n\n .text {\n font-size: var(--size-3);\n white-space: nowrap;\n text-overflow: ellipsis;\n width: 100%;\n overflow: hidden;\n }\n }\n}\n\n@media (max-width: 640px) {\n :host {\n position: fixed;\n top: unset;\n bottom: 0;\n width: 100dvw;\n }\n [role='tablist'] {\n flex-direction: row;\n background-color: var(--pos-background-color);\n\n border-top: var(--size-px) solid var(--pos-border-color);\n\n button {\n &[aria-selected] {\n border-top: var(--size-1) solid var(--pos-primary-color);\n }\n }\n }\n}\n";const qs=Vs;const Gs=class{constructor(e){t(this,e);this.toolSelected=s(this,"pod-os:tool-selected",7);this.tools=[]}render(){if(this.tools.length>1){return n("div",{role:"tablist","aria-label":"Tools","aria-multiselectable":"false"},this.tools.map((e=>{var t;return n("button",{role:"tab","aria-selected":((t=this.selected)===null||t===void 0?void 0:t.element)===e.element,onClick:()=>this.toolSelected.emit(e)},n("sl-icon",{name:e.icon}),n("span",{class:"text"},e.label))})))}return null}};Gs.style=qs;const Ys={Generic:{element:"pos-app-generic",label:"Data",icon:"list-ul",types:[]},RdfDocument:{element:"pos-app-rdf-document",label:"Things",icon:"diagram-2",types:[{uri:"http://www.w3.org/2007/ont/link#RDFDocument",priority:20}]},DocumentViewer:{element:"pos-app-document-viewer",label:"Doc",icon:"file-text",types:[{uri:Zs("application/pdf"),priority:30},{uri:"http://www.w3.org/2007/ont/link#Document",priority:10}]},ImageViewer:{element:"pos-app-image-viewer",label:"Pic",icon:"file-image",types:[{uri:"http://purl.org/dc/terms/Image",priority:20}]},LdpContainer:{element:"pos-app-ldp-container",label:"Content",icon:"folder",types:[{uri:"http://www.w3.org/ns/ldp#Container",priority:30}]}};function Zs(e){return"http://www.w3.org/ns/iana/media-types/"+e+"#Resource"}function Qs(e){const t=new Set(e.map((e=>e.uri)));return Object.values(Ys).map(eo(t)).filter(no).toSorted(io).map((e=>e.tool)).concat(Ys.Generic)}const eo=e=>t=>({tool:t,priority:to(t.types,e)});function to(e,t){return e.filter((e=>t.has(e.uri))).reduce(((e,t)=>Math.max(e,t.priority)),0)}const no=e=>e.priority>0;const io=(e,t)=>t.priority-e.priority;const ro="section {\n display: flex;\n flex-direction: row;\n}\n\n.tools {\n flex-grow: 1;\n &.transition {\n position: relative;\n .tool {\n position: absolute;\n }\n }\n}\n\n.tool {\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n &.visible {\n animation: fadeIn 300ms ease-in;\n }\n &.hidden {\n animation: fadeOut 300ms ease-in;\n }\n}\n\n@keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes fadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n@media (max-width: 640px) {\n section {\n --toolbar-size: var(--size-16);\n flex-direction: column-reverse;\n padding-bottom: var(--toolbar-size);\n pos-tool-select {\n --button-size: var(--toolbar-size);\n }\n }\n}\n";const so=ro;const oo=class{constructor(e){t(this,e);this.subscribeResource=s(this,"pod-os:resource",7);this.transitioning=false;this.receiveResource=e=>{var t;const n=e.types();this.availableTools=Qs(n);this.currentTool=(t=this.availableTools.find((e=>e.element===this.initialTool)))!==null&&t!==void 0?t:this.availableTools[0]}}componentWillLoad(){x(this);const e=new URLSearchParams(window.location.search);const t=e.get("tool");if(t){this.initialTool=t}}handleToolSelected(e){this.oldTool=this.currentTool;this.currentTool=e.detail;this.transitioning=true;const t=new URL(window.location.href);t.searchParams.set("tool",e.detail.element);window.history.replaceState({},"",t.toString())}render(){return this.availableTools?this.renderApp():null}renderApp(){var e;const t=this.currentTool.element;const i=(e=this.oldTool)===null||e===void 0?void 0:e.element;return n("section",null,n("pos-tool-select",{selected:this.currentTool,tools:this.availableTools}),n("div",{class:{tools:true,transition:this.transitioning},onAnimationEnd:()=>this.removeOldTool()},i&&n(i,{class:"tool hidden"}),n(t,{class:"tool visible"})))}removeOldTool(){this.oldTool=null;this.transitioning=false}};oo.style=so;var ao=S`
628
628
  :host {
629
629
  display: inline-block;
630
630
 
@@ -687,7 +687,7 @@ import{d as e,r as t,h as n,H as i,e as s,f as r,i as o,j as a}from"./p-99602d8c
687
687
  object-fit: cover;
688
688
  overflow: hidden;
689
689
  }
690
- `;var mo=class extends R{constructor(){super(...arguments);this.hasError=false;this.image="";this.label="";this.initials="";this.loading="eager";this.shape="circle"}handleImageChange(){this.hasError=false}handleImageLoadError(){this.hasError=true;this.emit("sl-error")}render(){const e=_`
690
+ `;var co=class extends I{constructor(){super(...arguments);this.hasError=false;this.image="";this.label="";this.initials="";this.loading="eager";this.shape="circle"}handleImageChange(){this.hasError=false}handleImageLoadError(){this.hasError=true;this.emit("sl-error")}render(){const e=_`
691
691
  <img
692
692
  part="image"
693
693
  class="avatar__image"
@@ -711,7 +711,7 @@ import{d as e,r as t,h as n,H as i,e as s,f as r,i as o,j as a}from"./p-99602d8c
711
711
  >
712
712
  ${this.image&&!this.hasError?e:t}
713
713
  </div>
714
- `}};mo.styles=[A,bo];mo.dependencies={"sl-icon":T};C([I()],mo.prototype,"hasError",2);C([P()],mo.prototype,"image",2);C([P()],mo.prototype,"label",2);C([P()],mo.prototype,"initials",2);C([P()],mo.prototype,"loading",2);C([P({reflect:true})],mo.prototype,"shape",2);C([z("image")],mo.prototype,"handleImageChange",1);mo.define("sl-avatar");var go=S`
714
+ `}};co.styles=[A,ao];co.dependencies={"sl-icon":C};T([z()],co.prototype,"hasError",2);T([$()],co.prototype,"image",2);T([$()],co.prototype,"label",2);T([$()],co.prototype,"initials",2);T([$()],co.prototype,"loading",2);T([$({reflect:true})],co.prototype,"shape",2);T([R("image")],co.prototype,"handleImageChange",1);co.define("sl-avatar");var lo=S`
715
715
  :host {
716
716
  --color: var(--sl-panel-border-color);
717
717
  --width: var(--sl-panel-border-width);
@@ -730,5 +730,5 @@ import{d as e,r as t,h as n,H as i,e as s,f as r,i as o,j as a}from"./p-99602d8c
730
730
  border-left: solid var(--width) var(--color);
731
731
  margin: 0 var(--spacing);
732
732
  }
733
- `;var wo=class extends R{constructor(){super(...arguments);this.vertical=false}connectedCallback(){super.connectedCallback();this.setAttribute("role","separator")}handleVerticalChange(){this.setAttribute("aria-orientation",this.vertical?"vertical":"horizontal")}};wo.styles=[A,go];C([P({type:Boolean,reflect:true})],wo.prototype,"vertical",2);C([z("vertical")],wo.prototype,"handleVerticalChange",1);wo.define("sl-divider");const yo="button {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n margin: 0;\n border: none;\n background: none;\n cursor: pointer;\n border-radius: 50%;\n pos-picture {\n --width: 40px;\n --height: 40px;\n --border-radius: 50%;\n }\n sl-avatar {\n --size: 40px;\n }\n}\n\nsl-dropdown {\n display: block;\n}\n";const vo=yo;const ko=class{constructor(e){t(this,e);this.logout=r(this,"pod-os:logout",7);this.link=r(this,"pod-os:link",7)}onSelect(e){const{value:t}=e.detail.item;if(t==="logout"){this.logout.emit()}else if(t==="profile"){this.link.emit(this.webId)}else if(t==="dashboard"){this.link.emit("pod-os:dashboard")}else if(t==="settings"){this.link.emit("pod-os:settings")}}render(){if(!this.webId)return null;return n("pos-resource",{uri:this.webId},n("sl-dropdown",null,n("button",{slot:"trigger","aria-label":"User menu"},n("pos-picture",null,n("sl-avatar",null))),n("sl-menu",null,n("sl-menu-item",{value:"dashboard"},"Dashboard"),n("sl-menu-item",{value:"profile"},n("pos-label",null)),n("sl-menu-item",{value:"settings"},"Settings"),n("sl-divider",null),n("sl-menu-item",{value:"logout"},"Logout"))))}};ko.style=vo;export{be as ion_icon,xe as ion_progress_bar,Te as ion_skeleton_text,Ie as pos_add_new_thing,Ki as pos_app,Mi as pos_app_browser,Vi as pos_app_dashboard,Yi as pos_app_settings,Zi as pos_description,ts as pos_dialog,gs as pos_error_toast,vs as pos_example_resources,Ss as pos_getting_started,As as pos_image,Ts as pos_internal_router,Cs as pos_label,Ps as pos_login,Ds as pos_login_form,fr as pos_make_findable,wr as pos_navigation,kr as pos_navigation_bar,_r as pos_new_thing_form,Tr as pos_picture,Ir as pos_resource,$r as pos_rich_link,Vr as pos_router,Yr as pos_select_term,eo as pos_setting_offline_cache,io as pos_tool_select,po as pos_type_router,ko as pos_user_menu};
734
- //# sourceMappingURL=p-2a84b1f2.entry.js.map
733
+ `;var ho=class extends I{constructor(){super(...arguments);this.vertical=false}connectedCallback(){super.connectedCallback();this.setAttribute("role","separator")}handleVerticalChange(){this.setAttribute("aria-orientation",this.vertical?"vertical":"horizontal")}};ho.styles=[A,lo];T([$({type:Boolean,reflect:true})],ho.prototype,"vertical",2);T([R("vertical")],ho.prototype,"handleVerticalChange",1);ho.define("sl-divider");const uo="button {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n margin: 0;\n border: none;\n background: none;\n cursor: pointer;\n border-radius: 50%;\n pos-picture {\n --width: 40px;\n --height: 40px;\n --border-radius: 50%;\n }\n sl-avatar {\n --size: 40px;\n }\n}\n\nsl-dropdown {\n display: block;\n}\n";const fo=uo;const po=class{constructor(e){t(this,e);this.logout=s(this,"pod-os:logout",7);this.link=s(this,"pod-os:link",7)}onSelect(e){const{value:t}=e.detail.item;if(t==="logout"){this.logout.emit()}else if(t==="profile"){this.link.emit(this.webId)}else if(t==="dashboard"){this.link.emit("pod-os:dashboard")}else if(t==="settings"){this.link.emit("pod-os:settings")}}render(){if(!this.webId)return null;return n("pos-resource",{uri:this.webId},n("sl-dropdown",null,n("button",{slot:"trigger","aria-label":"User menu"},n("pos-picture",null,n("sl-avatar",null))),n("sl-menu",null,n("sl-menu-item",{value:"dashboard"},"Dashboard"),n("sl-menu-item",{value:"profile"},n("pos-label",null)),n("sl-menu-item",{value:"settings"},"Settings"),n("sl-divider",null),n("sl-menu-item",{value:"logout"},"Logout"))))}};po.style=fo;export{be as ion_icon,xe as ion_progress_bar,Ce as ion_skeleton_text,ze as pos_add_new_thing,Di as pos_app,Li as pos_app_browser,Ki as pos_app_dashboard,Mi as pos_app_settings,Bi as pos_description,Vi as pos_dialog,dr as pos_error_toast,fr as pos_example_resources,mr as pos_getting_started,vr as pos_image,yr as pos_internal_router,kr as pos_label,_r as pos_login,Cr as pos_login_form,os as pos_make_findable,hs as pos_navigation,ps as pos_navigation_bar,gs as pos_new_thing_form,ys as pos_picture,Ss as pos_resource,As as pos_rich_link,Ks as pos_router,Ms as pos_select_term,Fs as pos_setting_offline_cache,Gs as pos_tool_select,oo as pos_type_router,po as pos_user_menu};
734
+ //# sourceMappingURL=p-ed5c0c18.entry.js.map