mcp-memory-bucket 0.10.3 → 0.10.10

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,23 +1,23 @@
1
- (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(i){if(i.ep)return;i.ep=!0;const r=t(i);fetch(i.href,r)}})();const Yt="modulepreload",Jt=function(n){return"/"+n},Me={},$t=function(e,t,s){let i=Promise.resolve();if(t&&t.length>0){let o=function(d){return Promise.all(d.map(p=>Promise.resolve(p).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=a?.nonce||a?.getAttribute("nonce");i=o(t.map(d=>{if(d=Jt(d),d in Me)return;Me[d]=!0;const p=d.endsWith(".css"),h=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${h}`))return;const f=document.createElement("link");if(f.rel=p?"stylesheet":Yt,p||(f.as="script"),f.crossOrigin="",f.href=d,l&&f.setAttribute("nonce",l),document.head.appendChild(f),p)return new Promise((x,b)=>{f.addEventListener("load",x),f.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${d}`)))})}))}function r(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&r(a.reason);return e().catch(r)})};/**
1
+ (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerPolicy&&(r.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?r.credentials="include":s.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(s){if(s.ep)return;s.ep=!0;const r=t(s);fetch(s.href,r)}})();const Jt="modulepreload",Xt=function(n){return"/"+n},Me={},wt=function(e,t,i){let s=Promise.resolve();if(t&&t.length>0){let o=function(d){return Promise.all(d.map(p=>Promise.resolve(p).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),c=a?.nonce||a?.getAttribute("nonce");s=o(t.map(d=>{if(d=Xt(d),d in Me)return;Me[d]=!0;const p=d.endsWith(".css"),h=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${h}`))return;const f=document.createElement("link");if(f.rel=p?"stylesheet":Jt,p||(f.as="script"),f.crossOrigin="",f.href=d,c&&f.setAttribute("nonce",c),document.head.appendChild(f),p)return new Promise((x,b)=>{f.addEventListener("load",x),f.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${d}`)))})}))}function r(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&r(a.reason);return e().catch(r)})};/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */const te=globalThis,ke=te.ShadowRoot&&(te.ShadyCSS===void 0||te.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,$e=Symbol(),Ne=new WeakMap;let wt=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==$e)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(ke&&e===void 0){const s=t!==void 0&&t.length===1;s&&(e=Ne.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&Ne.set(t,e))}return e}toString(){return this.cssText}};const Xt=n=>new wt(typeof n=="string"?n:n+"",void 0,$e),T=(n,...e)=>{const t=n.length===1?n[0]:e.reduce((s,i,r)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[r+1],n[0]);return new wt(t,n,$e)},es=(n,e)=>{if(ke)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const s=document.createElement("style"),i=te.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=t.cssText,n.appendChild(s)}},qe=ke?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return Xt(t)})(n):n;/**
5
+ */const te=globalThis,ke=te.ShadowRoot&&(te.ShadyCSS===void 0||te.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,$e=Symbol(),Ne=new WeakMap;let _t=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==$e)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(ke&&e===void 0){const i=t!==void 0&&t.length===1;i&&(e=Ne.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Ne.set(t,e))}return e}toString(){return this.cssText}};const ei=n=>new _t(typeof n=="string"?n:n+"",void 0,$e),A=(n,...e)=>{const t=n.length===1?n[0]:e.reduce((i,s,r)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+n[r+1],n[0]);return new _t(t,n,$e)},ti=(n,e)=>{if(ke)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const i=document.createElement("style"),s=te.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=t.cssText,n.appendChild(i)}},Ue=ke?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return ei(t)})(n):n;/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:ts,defineProperty:ss,getOwnPropertyDescriptor:is,getOwnPropertyNames:ns,getOwnPropertySymbols:rs,getPrototypeOf:os}=Object,ae=globalThis,Ue=ae.trustedTypes,as=Ue?Ue.emptyScript:"",ls=ae.reactiveElementPolyfillSupport,W=(n,e)=>n,ge={toAttribute(n,e){switch(e){case Boolean:n=n?as:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},_t=(n,e)=>!ts(n,e),je={attribute:!0,type:String,converter:ge,reflect:!1,useDefault:!1,hasChanged:_t};Symbol.metadata??=Symbol("metadata"),ae.litPropertyMetadata??=new WeakMap;let N=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=je){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(e,s,t);i!==void 0&&ss(this.prototype,e,i)}}static getPropertyDescriptor(e,t,s){const{get:i,set:r}=is(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:i,set(o){const a=i?.call(this);r?.call(this,o),this.requestUpdate(e,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??je}static _$Ei(){if(this.hasOwnProperty(W("elementProperties")))return;const e=os(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(W("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(W("properties"))){const t=this.properties,s=[...ns(t),...rs(t)];for(const i of s)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[s,i]of t)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const i of s)t.unshift(qe(i))}else e!==void 0&&t.push(qe(e));return t}static _$Eu(e,t){const s=t.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const s of t.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return es(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){const s=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,s);if(i!==void 0&&s.reflect===!0){const r=(s.converter?.toAttribute!==void 0?s.converter:ge).toAttribute(t,s.type);this._$Em=e,r==null?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(e,t){const s=this.constructor,i=s._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const r=s.getPropertyOptions(i),o=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:ge;this._$Em=i;const a=o.fromAttribute(t,r.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,s,i=!1,r){if(e!==void 0){const o=this.constructor;if(i===!1&&(r=this[e]),s??=o.getPropertyOptions(e),!((s.hasChanged??_t)(r,t)||s.useDefault&&s.reflect&&r===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,s))))return;this.C(e,t,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:s,reflect:i,wrapped:r},o){s&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),r!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,r]of this._$Ep)this[i]=r;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,r]of s){const{wrapped:o}=r,a=this[i];o!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,r,a)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(t)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};N.elementStyles=[],N.shadowRootOptions={mode:"open"},N[W("elementProperties")]=new Map,N[W("finalized")]=new Map,ls?.({ReactiveElement:N}),(ae.reactiveElementVersions??=[]).push("2.1.2");/**
9
+ */const{is:ii,defineProperty:si,getOwnPropertyDescriptor:ni,getOwnPropertyNames:ri,getOwnPropertySymbols:oi,getPrototypeOf:ai}=Object,ae=globalThis,qe=ae.trustedTypes,li=qe?qe.emptyScript:"",ci=ae.reactiveElementPolyfillSupport,Z=(n,e)=>n,ge={toAttribute(n,e){switch(e){case Boolean:n=n?li:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},St=(n,e)=>!ii(n,e),je={attribute:!0,type:String,converter:ge,reflect:!1,useDefault:!1,hasChanged:St};Symbol.metadata??=Symbol("metadata"),ae.litPropertyMetadata??=new WeakMap;let N=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=je){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(e,i,t);s!==void 0&&si(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){const{get:s,set:r}=ni(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:s,set(o){const a=s?.call(this);r?.call(this,o),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??je}static _$Ei(){if(this.hasOwnProperty(Z("elementProperties")))return;const e=ai(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Z("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Z("properties"))){const t=this.properties,i=[...ri(t),...oi(t)];for(const s of i)this.createProperty(s,t[s])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[i,s]of t)this.elementProperties.set(i,s)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const s=this._$Eu(t,i);s!==void 0&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const s of i)t.unshift(Ue(s))}else e!==void 0&&t.push(Ue(e));return t}static _$Eu(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ti(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){const i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(s!==void 0&&i.reflect===!0){const r=(i.converter?.toAttribute!==void 0?i.converter:ge).toAttribute(t,i.type);this._$Em=e,r==null?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(e,t){const i=this.constructor,s=i._$Eh.get(e);if(s!==void 0&&this._$Em!==s){const r=i.getPropertyOptions(s),o=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:ge;this._$Em=s;const a=o.fromAttribute(t,r.type);this[s]=a??this._$Ej?.get(s)??a,this._$Em=null}}requestUpdate(e,t,i,s=!1,r){if(e!==void 0){const o=this.constructor;if(s===!1&&(r=this[e]),i??=o.getPropertyOptions(e),!((i.hasChanged??St)(r,t)||i.useDefault&&i.reflect&&r===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,i))))return;this.C(e,t,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:s,wrapped:r},o){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),r!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),s===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[s,r]of this._$Ep)this[s]=r;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[s,r]of i){const{wrapped:o}=r,a=this[s];o!==!0||this._$AL.has(s)||a===void 0||this.C(s,void 0,r,a)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(t)):this._$EM()}catch(i){throw e=!1,this._$EM(),i}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};N.elementStyles=[],N.shadowRootOptions={mode:"open"},N[Z("elementProperties")]=new Map,N[Z("finalized")]=new Map,ci?.({ReactiveElement:N}),(ae.reactiveElementVersions??=[]).push("2.1.2");/**
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */const we=globalThis,Be=n=>n,se=we.trustedTypes,He=se?se.createPolicy("lit-html",{createHTML:n=>n}):void 0,St="$lit$",R=`lit$${Math.random().toFixed(9).slice(2)}$`,Ct="?"+R,cs=`<${Ct}>`,I=document,Q=()=>I.createComment(""),G=n=>n===null||typeof n!="object"&&typeof n!="function",_e=Array.isArray,ds=n=>_e(n)||typeof n?.[Symbol.iterator]=="function",he=`[
13
+ */const we=globalThis,Be=n=>n,ie=we.trustedTypes,He=ie?ie.createPolicy("lit-html",{createHTML:n=>n}):void 0,Ct="$lit$",R=`lit$${Math.random().toFixed(9).slice(2)}$`,At="?"+R,di=`<${At}>`,I=document,G=()=>I.createComment(""),Q=n=>n===null||typeof n!="object"&&typeof n!="function",_e=Array.isArray,hi=n=>_e(n)||typeof n?.[Symbol.iterator]=="function",he=`[
14
14
  \f\r]`,H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ke=/-->/g,Ve=/>/g,P=RegExp(`>|${he}(?:([^\\s"'>=/]+)(${he}*=${he}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Ze=/'/g,We=/"/g,Tt=/^(?:script|style|textarea|title)$/i,hs=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),c=hs(1),O=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),Qe=new WeakMap,L=I.createTreeWalker(I,129);function At(n,e){if(!_e(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return He!==void 0?He.createHTML(e):e}const ps=(n,e)=>{const t=n.length-1,s=[];let i,r=e===2?"<svg>":e===3?"<math>":"",o=H;for(let a=0;a<t;a++){const l=n[a];let d,p,h=-1,f=0;for(;f<l.length&&(o.lastIndex=f,p=o.exec(l),p!==null);)f=o.lastIndex,o===H?p[1]==="!--"?o=Ke:p[1]!==void 0?o=Ve:p[2]!==void 0?(Tt.test(p[2])&&(i=RegExp("</"+p[2],"g")),o=P):p[3]!==void 0&&(o=P):o===P?p[0]===">"?(o=i??H,h=-1):p[1]===void 0?h=-2:(h=o.lastIndex-p[2].length,d=p[1],o=p[3]===void 0?P:p[3]==='"'?We:Ze):o===We||o===Ze?o=P:o===Ke||o===Ve?o=H:(o=P,i=void 0);const x=o===P&&n[a+1].startsWith("/>")?" ":"";r+=o===H?l+cs:h>=0?(s.push(d),l.slice(0,h)+St+l.slice(h)+R+x):l+R+(h===-2?a:x)}return[At(n,r+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};let be=class Et{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let r=0,o=0;const a=e.length-1,l=this.parts,[d,p]=ps(e,t);if(this.el=Et.createElement(d,s),L.currentNode=this.el.content,t===2||t===3){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=L.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const h of i.getAttributeNames())if(h.endsWith(St)){const f=p[o++],x=i.getAttribute(h).split(R),b=/([.?@])?(.*)/.exec(f);l.push({type:1,index:r,name:b[2],strings:x,ctor:b[1]==="."?fs:b[1]==="?"?gs:b[1]==="@"?bs:le}),i.removeAttribute(h)}else h.startsWith(R)&&(l.push({type:6,index:r}),i.removeAttribute(h));if(Tt.test(i.tagName)){const h=i.textContent.split(R),f=h.length-1;if(f>0){i.textContent=se?se.emptyScript:"";for(let x=0;x<f;x++)i.append(h[x],Q()),L.nextNode(),l.push({type:2,index:++r});i.append(h[f],Q())}}}else if(i.nodeType===8)if(i.data===Ct)l.push({type:2,index:r});else{let h=-1;for(;(h=i.data.indexOf(R,h+1))!==-1;)l.push({type:7,index:r}),h+=R.length-1}r++}}static createElement(e,t){const s=I.createElement("template");return s.innerHTML=e,s}};function q(n,e,t=n,s){if(e===O)return e;let i=s!==void 0?t._$Co?.[s]:t._$Cl;const r=G(e)?void 0:e._$litDirective$;return i?.constructor!==r&&(i?._$AO?.(!1),r===void 0?i=void 0:(i=new r(n),i._$AT(n,t,s)),s!==void 0?(t._$Co??=[])[s]=i:t._$Cl=i),i!==void 0&&(e=q(n,i._$AS(n,e.values),i,s)),e}let us=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,i=(e?.creationScope??I).importNode(t,!0);L.currentNode=i;let r=L.nextNode(),o=0,a=0,l=s[0];for(;l!==void 0;){if(o===l.index){let d;l.type===2?d=new Se(r,r.nextSibling,this,e):l.type===1?d=new l.ctor(r,l.name,l.strings,this,e):l.type===6&&(d=new ms(r,this,e)),this._$AV.push(d),l=s[++a]}o!==l?.index&&(r=L.nextNode(),o++)}return L.currentNode=I,i}p(e){let t=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}},Se=class Rt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,i){this.type=2,this._$AH=m,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=q(this,e,t),G(e)?e===m||e==null||e===""?(this._$AH!==m&&this._$AR(),this._$AH=m):e!==this._$AH&&e!==O&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):ds(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==m&&G(this._$AH)?this._$AA.nextSibling.data=e:this.T(I.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:s}=e,i=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=be.createElement(At(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const r=new us(i,this),o=r.u(this.options);r.p(t),this.T(o),this._$AH=r}}_$AC(e){let t=Qe.get(e.strings);return t===void 0&&Qe.set(e.strings,t=new be(e)),t}k(e){_e(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,i=0;for(const r of e)i===t.length?t.push(s=new Rt(this.O(Q()),this.O(Q()),this,this.options)):s=t[i],s._$AI(r),i++;i<t.length&&(this._$AR(s&&s._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const s=Be(e).nextSibling;Be(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},le=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,i,r){this.type=1,this._$AH=m,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=r,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=m}_$AI(e,t=this,s,i){const r=this.strings;let o=!1;if(r===void 0)e=q(this,e,t,0),o=!G(e)||e!==this._$AH&&e!==O,o&&(this._$AH=e);else{const a=e;let l,d;for(e=r[0],l=0;l<r.length-1;l++)d=q(this,a[s+l],t,l),d===O&&(d=this._$AH[l]),o||=!G(d)||d!==this._$AH[l],d===m?e=m:e!==m&&(e+=(d??"")+r[l+1]),this._$AH[l]=d}o&&!i&&this.j(e)}j(e){e===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},fs=class extends le{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===m?void 0:e}},gs=class extends le{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==m)}},bs=class extends le{constructor(e,t,s,i,r){super(e,t,s,i,r),this.type=5}_$AI(e,t=this){if((e=q(this,e,t,0)??m)===O)return;const s=this._$AH,i=e===m&&s!==m||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,r=e!==m&&(s===m||i);i&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},ms=class{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){q(this,e)}};const vs=we.litHtmlPolyfillSupport;vs?.(be,Se),(we.litHtmlVersions??=[]).push("3.3.3");const xs=(n,e,t)=>{const s=t?.renderBefore??e;let i=s._$litPart$;if(i===void 0){const r=t?.renderBefore??null;s._$litPart$=i=new Se(e.insertBefore(Q(),r),r,void 0,t??{})}return i._$AI(n),i};/**
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),We=/'/g,Ze=/"/g,Tt=/^(?:script|style|textarea|title)$/i,pi=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),l=pi(1),O=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),Ge=new WeakMap,L=I.createTreeWalker(I,129);function Et(n,e){if(!_e(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return He!==void 0?He.createHTML(e):e}const ui=(n,e)=>{const t=n.length-1,i=[];let s,r=e===2?"<svg>":e===3?"<math>":"",o=H;for(let a=0;a<t;a++){const c=n[a];let d,p,h=-1,f=0;for(;f<c.length&&(o.lastIndex=f,p=o.exec(c),p!==null);)f=o.lastIndex,o===H?p[1]==="!--"?o=Ke:p[1]!==void 0?o=Ve:p[2]!==void 0?(Tt.test(p[2])&&(s=RegExp("</"+p[2],"g")),o=P):p[3]!==void 0&&(o=P):o===P?p[0]===">"?(o=s??H,h=-1):p[1]===void 0?h=-2:(h=o.lastIndex-p[2].length,d=p[1],o=p[3]===void 0?P:p[3]==='"'?Ze:We):o===Ze||o===We?o=P:o===Ke||o===Ve?o=H:(o=P,s=void 0);const x=o===P&&n[a+1].startsWith("/>")?" ":"";r+=o===H?c+di:h>=0?(i.push(d),c.slice(0,h)+Ct+c.slice(h)+R+x):c+R+(h===-2?a:x)}return[Et(n,r+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]};let be=class Rt{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let r=0,o=0;const a=e.length-1,c=this.parts,[d,p]=ui(e,t);if(this.el=Rt.createElement(d,i),L.currentNode=this.el.content,t===2||t===3){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(s=L.nextNode())!==null&&c.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const h of s.getAttributeNames())if(h.endsWith(Ct)){const f=p[o++],x=s.getAttribute(h).split(R),b=/([.?@])?(.*)/.exec(f);c.push({type:1,index:r,name:b[2],strings:x,ctor:b[1]==="."?gi:b[1]==="?"?bi:b[1]==="@"?mi:le}),s.removeAttribute(h)}else h.startsWith(R)&&(c.push({type:6,index:r}),s.removeAttribute(h));if(Tt.test(s.tagName)){const h=s.textContent.split(R),f=h.length-1;if(f>0){s.textContent=ie?ie.emptyScript:"";for(let x=0;x<f;x++)s.append(h[x],G()),L.nextNode(),c.push({type:2,index:++r});s.append(h[f],G())}}}else if(s.nodeType===8)if(s.data===At)c.push({type:2,index:r});else{let h=-1;for(;(h=s.data.indexOf(R,h+1))!==-1;)c.push({type:7,index:r}),h+=R.length-1}r++}}static createElement(e,t){const i=I.createElement("template");return i.innerHTML=e,i}};function U(n,e,t=n,i){if(e===O)return e;let s=i!==void 0?t._$Co?.[i]:t._$Cl;const r=Q(e)?void 0:e._$litDirective$;return s?.constructor!==r&&(s?._$AO?.(!1),r===void 0?s=void 0:(s=new r(n),s._$AT(n,t,i)),i!==void 0?(t._$Co??=[])[i]=s:t._$Cl=s),s!==void 0&&(e=U(n,s._$AS(n,e.values),s,i)),e}let fi=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,s=(e?.creationScope??I).importNode(t,!0);L.currentNode=s;let r=L.nextNode(),o=0,a=0,c=i[0];for(;c!==void 0;){if(o===c.index){let d;c.type===2?d=new Se(r,r.nextSibling,this,e):c.type===1?d=new c.ctor(r,c.name,c.strings,this,e):c.type===6&&(d=new vi(r,this,e)),this._$AV.push(d),c=i[++a]}o!==c?.index&&(r=L.nextNode(),o++)}return L.currentNode=I,s}p(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}},Se=class Pt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,s){this.type=2,this._$AH=m,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=U(this,e,t),Q(e)?e===m||e==null||e===""?(this._$AH!==m&&this._$AR(),this._$AH=m):e!==this._$AH&&e!==O&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):hi(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==m&&Q(this._$AH)?this._$AA.nextSibling.data=e:this.T(I.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:i}=e,s=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=be.createElement(Et(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(t);else{const r=new fi(s,this),o=r.u(this.options);r.p(t),this.T(o),this._$AH=r}}_$AC(e){let t=Ge.get(e.strings);return t===void 0&&Ge.set(e.strings,t=new be(e)),t}k(e){_e(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,s=0;for(const r of e)s===t.length?t.push(i=new Pt(this.O(G()),this.O(G()),this,this.options)):i=t[s],i._$AI(r),s++;s<t.length&&(this._$AR(i&&i._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const i=Be(e).nextSibling;Be(e).remove(),e=i}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},le=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,s,r){this.type=1,this._$AH=m,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=r,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=m}_$AI(e,t=this,i,s){const r=this.strings;let o=!1;if(r===void 0)e=U(this,e,t,0),o=!Q(e)||e!==this._$AH&&e!==O,o&&(this._$AH=e);else{const a=e;let c,d;for(e=r[0],c=0;c<r.length-1;c++)d=U(this,a[i+c],t,c),d===O&&(d=this._$AH[c]),o||=!Q(d)||d!==this._$AH[c],d===m?e=m:e!==m&&(e+=(d??"")+r[c+1]),this._$AH[c]=d}o&&!s&&this.j(e)}j(e){e===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},gi=class extends le{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===m?void 0:e}},bi=class extends le{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==m)}},mi=class extends le{constructor(e,t,i,s,r){super(e,t,i,s,r),this.type=5}_$AI(e,t=this){if((e=U(this,e,t,0)??m)===O)return;const i=this._$AH,s=e===m&&i!==m||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,r=e!==m&&(i===m||s);s&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},vi=class{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){U(this,e)}};const xi=we.litHtmlPolyfillSupport;xi?.(be,Se),(we.litHtmlVersions??=[]).push("3.3.3");const yi=(n,e,t)=>{const i=t?.renderBefore??e;let s=i._$litPart$;if(s===void 0){const r=t?.renderBefore??null;i._$litPart$=s=new Se(e.insertBefore(G(),r),r,void 0,t??{})}return s._$AI(n),s};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
- */const Ce=globalThis;let k=class extends N{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=xs(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return O}};k._$litElement$=!0,k.finalized=!0,Ce.litElementHydrateSupport?.({LitElement:k});const ys=Ce.litElementPolyfillSupport;ys?.({LitElement:k});(Ce.litElementVersions??=[]).push("4.2.2");var Pt;let pe=0;const Ge=new Set;function ks(n){pe++;try{n()}finally{pe--,pe===0&&$s()}}function $s(){const n=new Set(Ge);Ge.clear();for(const e of n)e()}function ws(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function _s(n){return n&&typeof n.deref=="function"}class Te{static#e=0;#t;#s;#r=new Set;#n=Pt.#e++;name;constructor(e,t){this.#t=e,this.#s=e,this.name=t}_get(){return u.activeConsumer&&u.activeConsumer.track(this),this.#t}_set(e){return ws(e,this.#t)?(this.#s=this.#t,this.#t=e,this._notify(),!0):!1}subscribe(e,t=!1){let s=e;return t&&(s=new WeakRef(e)),this.#r.add(s),()=>this.#r.delete(s)}_notify(){const e=[...this.#r];for(const t of e){let s;if(_s(t)){if(s=t.deref(),!s){this.#r.delete(t);continue}}else s=t;s()}}get id(){return this.#n}get previousValue(){return this.#s}toString(){return this.name?`${this.constructor.name}(${this.name})`:`${this.constructor.name}#${this.id}`}}Pt=Te;class u extends Te{static#e=[];constructor(e,t){super(e,t)}static get activeConsumer(){return this.#e[this.#e.length-1]}static push(e){this.#e.push(e)}static pop(){this.#e.pop()}get(){return this._get()}set(e){ks(()=>{this._set(e)})}get value(){return this.get()}set value(e){this.set(e)}update(e){this.set(e(this.get()))}}class Ye extends Te{#e;#t=!0;#s=!1;#r=new Map;_debugParent;#n;#d=()=>{this.#t||(this.#t=!0,this._notify())};constructor(e,t,s){super(void 0,t),this.#e=e,this.#n=s?.weak??!0}track(e){if(this.#r.has(e))return;const t=e.subscribe(this.#d,this.#n);this.#r.set(e,t)}dispose(){this.#a()}#a(){for(const e of this.#r.values())e();this.#r.clear()}get(){if(u.activeConsumer&&u.activeConsumer.track(this),!this.#t)return this._get();if(this.#s)throw new Error(`Cycle detected in ${this}
20
- ↳ while computing ${this._debugParent??"root"}`);this.#s=!0,this.#a(),u.push(this);try{const e=this.#e();this._set(e)}finally{u.pop(),this.#t=!1,this.#s=!1}return this._get()}get value(){return this.get()}set value(e){throw new Error(`Cannot set value of Computed ${this}. Computed values are read-only.`)}subscribe(e,t=!1){const s=super.subscribe(e,t);return u.activeConsumer||this.get(),s}}class Y{#e;#t=new Map;_debugParent;constructor(e){this.#e=e,e.addController(this);const t=e,s=t.update,i=this;t.update=function(r){u.push(i);try{s.call(this,r)}finally{u.pop()}}}track(e){this.#t.has(e)||this.#t.set(e,e.subscribe(this.#s,!0))}#s=()=>{this.#e.requestUpdate()};hostUpdate(){for(const e of this.#t.values())e();this.#t.clear()}hostDisconnected(){for(const e of this.#t.values())e();this.#t.clear()}toString(){const e=this.#e;return`SignalWatcher(${e?.localName??e?.tagName??e?.constructor?.name??"unknown"})`}}const Ss=new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"});function Cs(n){if(!n)return"unknown age";const e=new Date(n);return Number.isNaN(e.getTime())?"unknown age":Ss.format(e)}function Ts(n){const e=[],t=new Map,s=[];for(const r of n){if(r._table!=="memory_docs"){s.push(r);continue}t.has(r.name)||(t.set(r.name,[]),e.push(r.name)),t.get(r.name).push(r)}const i=e.map(r=>({key:r,items:t.get(r)}));return s.length>0&&i.push({key:null,items:s}),i}class As extends k{static{this.properties={results:{attribute:!1},showFolder:{attribute:!1},onSelect:{attribute:!1},selectedIds:{attribute:!1},onToggleSelect:{attribute:!1},onKeyClick:{attribute:!1}}}static{this.styles=T`
19
+ */const Ce=globalThis;let k=class extends N{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=yi(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return O}};k._$litElement$=!0,k.finalized=!0,Ce.litElementHydrateSupport?.({LitElement:k});const ki=Ce.litElementPolyfillSupport;ki?.({LitElement:k});(Ce.litElementVersions??=[]).push("4.2.2");var zt;let pe=0;const Qe=new Set;function $i(n){pe++;try{n()}finally{pe--,pe===0&&wi()}}function wi(){const n=new Set(Qe);Qe.clear();for(const e of n)e()}function _i(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function Si(n){return n&&typeof n.deref=="function"}class Ae{static#e=0;#t;#i;#r=new Set;#n=zt.#e++;name;constructor(e,t){this.#t=e,this.#i=e,this.name=t}_get(){return u.activeConsumer&&u.activeConsumer.track(this),this.#t}_set(e){return _i(e,this.#t)?(this.#i=this.#t,this.#t=e,this._notify(),!0):!1}subscribe(e,t=!1){let i=e;return t&&(i=new WeakRef(e)),this.#r.add(i),()=>this.#r.delete(i)}_notify(){const e=[...this.#r];for(const t of e){let i;if(Si(t)){if(i=t.deref(),!i){this.#r.delete(t);continue}}else i=t;i()}}get id(){return this.#n}get previousValue(){return this.#i}toString(){return this.name?`${this.constructor.name}(${this.name})`:`${this.constructor.name}#${this.id}`}}zt=Ae;class u extends Ae{static#e=[];constructor(e,t){super(e,t)}static get activeConsumer(){return this.#e[this.#e.length-1]}static push(e){this.#e.push(e)}static pop(){this.#e.pop()}get(){return this._get()}set(e){$i(()=>{this._set(e)})}get value(){return this.get()}set value(e){this.set(e)}update(e){this.set(e(this.get()))}}class Ye extends Ae{#e;#t=!0;#i=!1;#r=new Map;_debugParent;#n;#h=()=>{this.#t||(this.#t=!0,this._notify())};constructor(e,t,i){super(void 0,t),this.#e=e,this.#n=i?.weak??!0}track(e){if(this.#r.has(e))return;const t=e.subscribe(this.#h,this.#n);this.#r.set(e,t)}dispose(){this.#l()}#l(){for(const e of this.#r.values())e();this.#r.clear()}get(){if(u.activeConsumer&&u.activeConsumer.track(this),!this.#t)return this._get();if(this.#i)throw new Error(`Cycle detected in ${this}
20
+ ↳ while computing ${this._debugParent??"root"}`);this.#i=!0,this.#l(),u.push(this);try{const e=this.#e();this._set(e)}finally{u.pop(),this.#t=!1,this.#i=!1}return this._get()}get value(){return this.get()}set value(e){throw new Error(`Cannot set value of Computed ${this}. Computed values are read-only.`)}subscribe(e,t=!1){const i=super.subscribe(e,t);return u.activeConsumer||this.get(),i}}class Y{#e;#t=new Map;_debugParent;constructor(e){this.#e=e,e.addController(this);const t=e,i=t.update,s=this;t.update=function(r){u.push(s);try{i.call(this,r)}finally{u.pop()}}}track(e){this.#t.has(e)||this.#t.set(e,e.subscribe(this.#i,!0))}#i=()=>{this.#e.requestUpdate()};hostUpdate(){for(const e of this.#t.values())e();this.#t.clear()}hostDisconnected(){for(const e of this.#t.values())e();this.#t.clear()}toString(){const e=this.#e;return`SignalWatcher(${e?.localName??e?.tagName??e?.constructor?.name??"unknown"})`}}const Ci=new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"});function Ai(n){if(!n)return"unknown age";const e=new Date(n);return Number.isNaN(e.getTime())?"unknown age":Ci.format(e)}function Ti(n){const e=[],t=new Map,i=[];for(const r of n){if(r._table!=="memory_docs"||!r.key){i.push(r);continue}t.has(r.key)||(t.set(r.key,[]),e.push(r.key)),t.get(r.key).push(r)}const s=e.map(r=>({key:r,items:t.get(r)}));return i.length>0&&s.push({key:null,items:i}),s}class Ei extends k{static{this.properties={results:{attribute:!1},showFolder:{attribute:!1},onSelect:{attribute:!1},selectedIds:{attribute:!1},onToggleSelect:{attribute:!1},onKeyClick:{attribute:!1}}}static{this.styles=A`
21
21
  :host { display: block; }
22
22
  .count-header {
23
23
  padding: 8px 14px;
@@ -56,6 +56,7 @@
56
56
  .deprecated .name { text-decoration: line-through; }
57
57
  .meta { opacity: 0.65; font-size: 11px; white-space: nowrap; }
58
58
  .folder-path { font-size: 10.5px; opacity: 0.55; margin-top: 1px; }
59
+ .key-line { font-size: 10.5px; opacity: 0.6; margin-top: 1px; }
59
60
  .desc { font-size: 12px; opacity: 0.8; margin-top: 3px; }
60
61
  .tags { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
61
62
  .tag { font-size: 10px; border: 1px solid var(--border-strong); border-radius: 999px; padding: 1px 6px; }
@@ -78,10 +79,10 @@
78
79
  color: var(--accent); background: var(--accent-tint); border-radius: 4px; padding: 0 4px;
79
80
  }
80
81
  .empty { padding: 24px; opacity: 0.6; font-size: 13px; }
81
- `}render(){return!this.results||this.results.length===0?c`<div class="empty">No results.</div>`:c`
82
+ `}render(){return!this.results||this.results.length===0?l`<div class="empty">No results.</div>`:l`
82
83
  <div class="count-header">${this.results.length} result${this.results.length===1?"":"s"}</div>
83
- ${Ts(this.results).map(e=>c`
84
- ${e.key?c`<div class="key-group-header">
84
+ ${Ti(this.results).map(e=>l`
85
+ ${e.key?l`<div class="key-group-header">
85
86
  🔑
86
87
  <button
87
88
  class="key-group-link"
@@ -94,7 +95,7 @@
94
95
  </div>`:""}
95
96
  ${e.items.map(t=>this.#e(t))}
96
97
  `)}
97
- `}#e(e){const t=e._table==="skills"&&e.folder==="builtin";return c`
98
+ `}#e(e){const t=e._table==="skills"&&e.folder==="builtin";return l`
98
99
  <div class="row ${e.deprecated?"deprecated":""} ${e.paused?"paused":""}" @click=${()=>this.onSelect(e)}>
99
100
  <input
100
101
  type="checkbox"
@@ -102,7 +103,7 @@
102
103
  .checked=${this.selectedIds?.has(e.id)??!1}
103
104
  .disabled=${t}
104
105
  title=${t?"Builtin skills can't be bulk-deprecated, paused, or deleted":""}
105
- @click=${s=>{s.stopPropagation(),t||this.onToggleSelect(e)}}
106
+ @click=${i=>{i.stopPropagation(),t||this.onToggleSelect(e)}}
106
107
  />
107
108
  <div class="row-body">
108
109
  <div class="top">
@@ -112,90 +113,91 @@
112
113
  >
113
114
  ${e.name}
114
115
  </span>
115
- <span class="meta">${Cs(e.created_at)} · ${e.owner??"—"} · ${e.status}</span>
116
+ <span class="meta">${Ai(e.created_at)} · ${e.owner??"—"} · ${e.status}</span>
116
117
  </div>
117
- ${this.showFolder&&e.folder?c`<div class="folder-path">📁 ${e.folder}</div>`:""}
118
+ ${e._table==="memory_docs"&&e.key?l`<div class="key-line">🔑 ${e.key}</div>`:""}
119
+ ${this.showFolder&&e.folder?l`<div class="folder-path">📁 ${e.folder}</div>`:""}
118
120
  <div class="desc">${e.description}</div>
119
121
  <div class="tags">
120
- ${e.deprecated?c`<span class="deprecated-badge">deprecated</span>`:""}
121
- ${e.paused?c`<span class="paused-badge">paused</span>`:""}
122
- ${e.tags.map(s=>c`<span class="tag">${s}</span>`)}
122
+ ${e.deprecated?l`<span class="deprecated-badge">deprecated</span>`:""}
123
+ ${e.paused?l`<span class="paused-badge">paused</span>`:""}
124
+ ${e.tags.map(i=>l`<span class="tag">${i}</span>`)}
123
125
  </div>
124
126
  </div>
125
127
  </div>
126
- `}}customElements.define("result-list",As);function Ae(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var F=Ae();function zt(n){F=n}var z={exec:()=>null};function M(n){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),i=e[s];return i||(i=n(s),e[s]=i),i}}function g(n,e=""){let t=typeof n=="string"?n:n.source,s={replace:(i,r)=>{let o=typeof r=="string"?r:r.source;return o=o.replace(y.caret,"$1"),t=t.replace(i,o),s},getRegex:()=>new RegExp(t,e)};return s}var Es=((n="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+n)}catch{return!1}})(),y={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:M(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:M(n=>new RegExp(`^ {0,${n}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:M(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:M(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:M(n=>new RegExp(`^ {0,${n}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:M(n=>new RegExp(`^ {0,${n}}>`))},Rs=/^(?:[ \t]*(?:\n|$))+/,Ps=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,zs=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,J=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ls=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ee=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Lt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,It=g(Lt).replace(/bull/g,Ee).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Is=g(Lt).replace(/bull/g,Ee).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Re=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Os=/^[^\n]+/,Pe=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ds=g(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Pe).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Fs=g(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ee).getRegex(),ce="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ze=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ms=g("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ze).replace("tag",ce).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ot=n=>g(Re).replace("hr",J).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",n).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ce).getRegex(),Ns=Ot(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),qs=Ot(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Us=g(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",qs).getRegex(),Le={blockquote:Us,code:Ps,def:Ds,fences:zs,heading:Ls,hr:J,html:Ms,lheading:It,list:Fs,newline:Rs,paragraph:Ns,table:z,text:Os},Je=g("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",J).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ce).getRegex(),js={...Le,lheading:Is,table:Je,paragraph:g(Re).replace("hr",J).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Je).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ce).getRegex()},Bs={...Le,html:g(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ze).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:z,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:g(Re).replace("hr",J).replace("heading",` *#{1,6} *[^
127
- ]`).replace("lheading",It).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Hs=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ks=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Dt=/^( {2,}|\\)\n(?!\s*$)/,Vs=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,A=/[\p{P}\p{S}]/u,U=/[\s\p{P}\p{S}]/u,X=/[^\s\p{P}\p{S}]/u,Zs=g(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,U).getRegex(),Ws=/[\p{Pi}\p{Ps}"']/u,Ft=/(?!~)[\p{P}\p{S}]/u,Qs=/(?!~)[\s\p{P}\p{S}]/u,Gs=/(?:[^\s\p{P}\p{S}]|~)/u,Ys=g(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Es?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Mt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Js=g(Mt,"u").replace(/punct/g,A).getRegex(),Xs=g(Mt,"u").replace(/punct/g,Ft).getRegex(),ei=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,ti=g(ei,"u").replace(/openQuote/g,Ws).replace(/punct/g,A).getRegex(),Nt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",si=g(Nt,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),ii=g(Nt,"gu").replace(/notPunctSpace/g,Gs).replace(/punctSpace/g,Qs).replace(/punct/g,Ft).getRegex(),ni="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",ri=g(ni,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),oi=g("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),ai="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",li=g(ai,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),ci=g(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,A).getRegex(),di="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",hi=g(di,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),pi=g(/\\(punct)/,"gu").replace(/punct/g,A).getRegex(),ui=g(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),fi=g(ze).replace("(?:-->|$)","-->").getRegex(),gi=g("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",fi).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ie=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,bi=g(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ie).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),qt=g(/^!?\[(label)\]\[(ref)\]/).replace("label",ie).replace("ref",Pe).getRegex(),Ut=g(/^!?\[(ref)\](?:\[\])?/).replace("ref",Pe).getRegex(),mi=g("reflink|nolink(?!\\()","g").replace("reflink",qt).replace("nolink",Ut).getRegex(),Xe=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ie={_backpedal:z,anyPunctuation:pi,autolink:ui,blockSkip:Ys,br:Dt,code:Ks,del:z,delLDelim:z,delRDelim:z,emStrongLDelim:Js,emStrongRDelimAst:si,emStrongRDelimUnd:oi,escape:Hs,link:bi,nolink:Ut,punctuation:Zs,reflink:qt,reflinkSearch:mi,tag:gi,text:Vs,url:z},vi={...Ie,emStrongLDelim:ti,emStrongRDelimAst:ri,emStrongRDelimUnd:li,link:g(/^!?\[(label)\]\((.*?)\)/).replace("label",ie).getRegex(),reflink:g(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ie).getRegex()},me={...Ie,emStrongRDelimAst:ii,emStrongLDelim:Xs,delLDelim:ci,delRDelim:hi,url:g(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Xe).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:g(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Xe).getRegex()},xi={...me,br:g(Dt).replace("{2,}","*").getRegex(),text:g(me.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ee={normal:Le,gfm:js,pedantic:Bs},K={normal:Ie,gfm:me,breaks:xi,pedantic:vi},yi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},et=n=>yi[n];function C(n,e){if(e){if(y.escapeTest.test(n))return n.replace(y.escapeReplace,et)}else if(y.escapeTestNoEncode.test(n))return n.replace(y.escapeReplaceNoEncode,et);return n}function tt(n){try{n=encodeURI(n).replace(y.percentDecode,"%")}catch{return null}return n}function st(n,e){let t=n.replace(y.findPipe,(r,o,a)=>{let l=!1,d=o;for(;--d>=0&&a[d]==="\\";)l=!l;return l?"|":" |"}),s=t.split(y.splitPipe),i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(y.slashPipe,"|");return s}function E(n,e,t){let s=n.length;if(s===0)return"";let i=0;for(;i<s&&n.charAt(s-i-1)===e;)i++;return n.slice(0,s-i)}function it(n){let e=n.split(`
128
+ `}}customElements.define("result-list",Ei);function Te(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var F=Te();function Lt(n){F=n}var z={exec:()=>null};function M(n){let e=[];return t=>{let i=Math.max(0,Math.min(3,t-1)),s=e[i];return s||(s=n(i),e[i]=s),s}}function g(n,e=""){let t=typeof n=="string"?n:n.source,i={replace:(s,r)=>{let o=typeof r=="string"?r:r.source;return o=o.replace(y.caret,"$1"),t=t.replace(s,o),i},getRegex:()=>new RegExp(t,e)};return i}var Ri=((n="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+n)}catch{return!1}})(),y={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:M(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:M(n=>new RegExp(`^ {0,${n}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:M(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:M(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:M(n=>new RegExp(`^ {0,${n}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:M(n=>new RegExp(`^ {0,${n}}>`))},Pi=/^(?:[ \t]*(?:\n|$))+/,zi=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Li=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,J=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ii=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ee=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,It=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ot=g(It).replace(/bull/g,Ee).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Oi=g(It).replace(/bull/g,Ee).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Re=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Di=/^[^\n]+/,Pe=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Fi=g(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Pe).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Mi=g(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ee).getRegex(),ce="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ze=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ni=g("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ze).replace("tag",ce).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Dt=n=>g(Re).replace("hr",J).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",n).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ce).getRegex(),Ui=Dt(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),qi=Dt(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),ji=g(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",qi).getRegex(),Le={blockquote:ji,code:zi,def:Fi,fences:Li,heading:Ii,hr:J,html:Ni,lheading:Ot,list:Mi,newline:Pi,paragraph:Ui,table:z,text:Di},Je=g("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",J).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ce).getRegex(),Bi={...Le,lheading:Oi,table:Je,paragraph:g(Re).replace("hr",J).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Je).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ce).getRegex()},Hi={...Le,html:g(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ze).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:z,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:g(Re).replace("hr",J).replace("heading",` *#{1,6} *[^
129
+ ]`).replace("lheading",Ot).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ki=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Vi=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ft=/^( {2,}|\\)\n(?!\s*$)/,Wi=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,T=/[\p{P}\p{S}]/u,q=/[\s\p{P}\p{S}]/u,X=/[^\s\p{P}\p{S}]/u,Zi=g(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,q).getRegex(),Gi=/[\p{Pi}\p{Ps}"']/u,Mt=/(?!~)[\p{P}\p{S}]/u,Qi=/(?!~)[\s\p{P}\p{S}]/u,Yi=/(?:[^\s\p{P}\p{S}]|~)/u,Ji=g(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Ri?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Nt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Xi=g(Nt,"u").replace(/punct/g,T).getRegex(),es=g(Nt,"u").replace(/punct/g,Mt).getRegex(),ts=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,is=g(ts,"u").replace(/openQuote/g,Gi).replace(/punct/g,T).getRegex(),Ut="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ss=g(Ut,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,q).replace(/punct/g,T).getRegex(),ns=g(Ut,"gu").replace(/notPunctSpace/g,Yi).replace(/punctSpace/g,Qi).replace(/punct/g,Mt).getRegex(),rs="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",os=g(rs,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,q).replace(/punct/g,T).getRegex(),as=g("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,q).replace(/punct/g,T).getRegex(),ls="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",cs=g(ls,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,q).replace(/punct/g,T).getRegex(),ds=g(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,T).getRegex(),hs="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",ps=g(hs,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,q).replace(/punct/g,T).getRegex(),us=g(/\\(punct)/,"gu").replace(/punct/g,T).getRegex(),fs=g(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),gs=g(ze).replace("(?:-->|$)","-->").getRegex(),bs=g("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",gs).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),se=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,ms=g(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",se).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),qt=g(/^!?\[(label)\]\[(ref)\]/).replace("label",se).replace("ref",Pe).getRegex(),jt=g(/^!?\[(ref)\](?:\[\])?/).replace("ref",Pe).getRegex(),vs=g("reflink|nolink(?!\\()","g").replace("reflink",qt).replace("nolink",jt).getRegex(),Xe=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ie={_backpedal:z,anyPunctuation:us,autolink:fs,blockSkip:Ji,br:Ft,code:Vi,del:z,delLDelim:z,delRDelim:z,emStrongLDelim:Xi,emStrongRDelimAst:ss,emStrongRDelimUnd:as,escape:Ki,link:ms,nolink:jt,punctuation:Zi,reflink:qt,reflinkSearch:vs,tag:bs,text:Wi,url:z},xs={...Ie,emStrongLDelim:is,emStrongRDelimAst:os,emStrongRDelimUnd:cs,link:g(/^!?\[(label)\]\((.*?)\)/).replace("label",se).getRegex(),reflink:g(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",se).getRegex()},me={...Ie,emStrongRDelimAst:ns,emStrongLDelim:es,delLDelim:ds,delRDelim:ps,url:g(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Xe).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:g(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Xe).getRegex()},ys={...me,br:g(Ft).replace("{2,}","*").getRegex(),text:g(me.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ee={normal:Le,gfm:Bi,pedantic:Hi},K={normal:Ie,gfm:me,breaks:ys,pedantic:xs},ks={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},et=n=>ks[n];function C(n,e){if(e){if(y.escapeTest.test(n))return n.replace(y.escapeReplace,et)}else if(y.escapeTestNoEncode.test(n))return n.replace(y.escapeReplaceNoEncode,et);return n}function tt(n){try{n=encodeURI(n).replace(y.percentDecode,"%")}catch{return null}return n}function it(n,e){let t=n.replace(y.findPipe,(r,o,a)=>{let c=!1,d=o;for(;--d>=0&&a[d]==="\\";)c=!c;return c?"|":" |"}),i=t.split(y.splitPipe),s=0;if(i[0].trim()||i.shift(),i.length>0&&!i.at(-1)?.trim()&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;s<i.length;s++)i[s]=i[s].trim().replace(y.slashPipe,"|");return i}function E(n,e,t){let i=n.length;if(i===0)return"";let s=0;for(;s<i&&n.charAt(i-s-1)===e;)s++;return n.slice(0,i-s)}function st(n){let e=n.split(`
128
130
  `),t=e.length-1;for(;t>=0&&y.blankLine.test(e[t]);)t--;return e.length-t<=2?n:e.slice(0,t+1).join(`
129
- `)}function ki(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<n.length;s++)if(n[s]==="\\")s++;else if(n[s]===e[0])t++;else if(n[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function $i(n,e=0){let t=e,s="";for(let i of n)if(i===" "){let r=4-t%4;s+=" ".repeat(r),t+=r}else s+=i,t++;return s}function nt(n,e,t,s,i){let r=e.href,o=e.title||null,a=n[1].replace(i.other.outputLinkReplace,"$1"),l=n[0].charAt(0)==="!";s.state.inLink=!0;let d=s.state.linkEmitted,p=s.state.inRawBlock;s.state.linkEmitted=!1;let h=s.inlineTokens(a),f=s.state.linkEmitted;if(s.state.linkEmitted=d,s.state.inLink=!1,!l){if(f){s.state.inRawBlock=p;return}s.state.linkEmitted=!0}return{type:l?"image":"link",raw:t,href:r,title:o,text:a,tokens:h}}function wi(n,e,t){let s=n.match(t.other.indentCodeCompensation);if(s===null)return e;let i=s[1];return e.split(`
130
- `).map(r=>{let o=r.match(t.other.beginningSpace);if(o===null)return r;let[a]=o;return a.length>=i.length?r.slice(i.length):r}).join(`
131
- `)}var ne=class{options;rules;lexer;constructor(n){this.options=n||F}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=this.options.pedantic?e[0]:it(e[0]),s=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:s}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],s=wi(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=E(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:E(e[0],`
131
+ `)}function $s(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let i=0;i<n.length;i++)if(n[i]==="\\")i++;else if(n[i]===e[0])t++;else if(n[i]===e[1]&&(t--,t<0))return i;return t>0?-2:-1}function ws(n,e=0){let t=e,i="";for(let s of n)if(s===" "){let r=4-t%4;i+=" ".repeat(r),t+=r}else i+=s,t++;return i}function nt(n,e,t,i,s){let r=e.href,o=e.title||null,a=n[1].replace(s.other.outputLinkReplace,"$1"),c=n[0].charAt(0)==="!";i.state.inLink=!0;let d=i.state.linkEmitted,p=i.state.inRawBlock;i.state.linkEmitted=!1;let h=i.inlineTokens(a),f=i.state.linkEmitted;if(i.state.linkEmitted=d,i.state.inLink=!1,!c){if(f){i.state.inRawBlock=p;return}i.state.linkEmitted=!0}return{type:c?"image":"link",raw:t,href:r,title:o,text:a,tokens:h}}function _s(n,e,t){let i=n.match(t.other.indentCodeCompensation);if(i===null)return e;let s=i[1];return e.split(`
132
+ `).map(r=>{let o=r.match(t.other.beginningSpace);if(o===null)return r;let[a]=o;return a.length>=s.length?r.slice(s.length):r}).join(`
133
+ `)}var ne=class{options;rules;lexer;constructor(n){this.options=n||F}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=this.options.pedantic?e[0]:st(e[0]),i=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:i}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],i=_s(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:i}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let i=E(t,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(t=i.trim())}return{type:"heading",raw:E(e[0],`
132
134
  `),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:E(e[0],`
133
135
  `)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=E(e[0],`
134
136
  `).split(`
135
- `),s="",i="",r=[];for(;t.length>0;){let o=!1,a=[],l;for(l=0;l<t.length;l++)if(this.rules.other.blockquoteStart.test(t[l]))a.push(t[l]),o=!0;else if(!o)a.push(t[l]);else break;t=t.slice(l);let d=a.join(`
137
+ `),i="",s="",r=[];for(;t.length>0;){let o=!1,a=[],c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))a.push(t[c]),o=!0;else if(!o)a.push(t[c]);else break;t=t.slice(c);let d=a.join(`
136
138
  `),p=d.replace(this.rules.other.blockquoteSetextReplace,`
137
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
138
- ${d}`:d,i=i?`${i}
139
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
140
+ ${d}`:d,s=s?`${s}
139
141
  ${p}`:p;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,r,!0),this.lexer.state.top=h,t.length===0)break;let f=r.at(-1);if(f?.type==="code")break;if(f?.type==="blockquote"){let x=f,b=t.join(`
140
142
  `),S=x.raw+`
141
- `+b.replace(this.rules.other.blockquoteSetextReplace2,""),j=this.blockquote(S);r[r.length-1]=j,s=`${s}
142
- ${b}`,i=i.substring(0,i.length-x.text.length)+j.text;break}else if(f?.type==="list"){let x=f,b=x.raw+`
143
+ `+b.replace(this.rules.other.blockquoteSetextReplace2,""),j=this.blockquote(S);r[r.length-1]=j,i=`${i}
144
+ ${b}`,s=s.substring(0,s.length-x.text.length)+j.text;break}else if(f?.type==="list"){let x=f,b=x.raw+`
143
145
  `+t.join(`
144
- `),S=this.list(b);r[r.length-1]=S,s=s.substring(0,s.length-f.raw.length)+S.raw,i=i.substring(0,i.length-x.raw.length)+S.raw,t=b.substring(r.at(-1).raw.length).split(`
145
- `);continue}}return{type:"blockquote",raw:s,tokens:r,text:i}}}list(n){let e=this.rules.block.list.exec(n);if(e){let t=e[1].trim(),s=t.length>1,i={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let r=this.rules.other.listItemRegex(t),o=!1;for(;n;){let l=!1,d="",p="";if(!(e=r.exec(n))||this.rules.block.hr.test(n))break;d=e[0],n=n.substring(d.length);let h=$i(e[2].split(`
146
+ `),S=this.list(b);r[r.length-1]=S,i=i.substring(0,i.length-f.raw.length)+S.raw,s=s.substring(0,s.length-x.raw.length)+S.raw,t=b.substring(r.at(-1).raw.length).split(`
147
+ `);continue}}return{type:"blockquote",raw:i,tokens:r,text:s}}}list(n){let e=this.rules.block.list.exec(n);if(e){let t=e[1].trim(),i=t.length>1,s={type:"list",raw:"",ordered:i,start:i?+t.slice(0,-1):"",loose:!1,items:[]};t=i?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=i?t:"[*+-]");let r=this.rules.other.listItemRegex(t),o=!1;for(;n;){let c=!1,d="",p="";if(!(e=r.exec(n))||this.rules.block.hr.test(n))break;d=e[0],n=n.substring(d.length);let h=ws(e[2].split(`
146
148
  `,1)[0],e[1].length),f=n.split(`
147
149
  `,1)[0],x=!h.trim(),b=0;if(this.options.pedantic?(b=2,p=h.trimStart()):x?b=e[1].length+1:(b=h.search(this.rules.other.nonSpaceChar),b=b>4?1:b,p=h.slice(b),b+=e[1].length),x&&this.rules.other.blankLine.test(f)&&(d+=f+`
148
- `,n=n.substring(f.length+1),l=!0),!l){let S=this.rules.other.nextBulletRegex(b),j=this.rules.other.hrRegex(b),De=this.rules.other.fencesBeginRegex(b),Fe=this.rules.other.headingBeginRegex(b),Qt=this.rules.other.htmlBeginRegex(b),Gt=this.rules.other.blockquoteBeginRegex(b);for(;n;){let de=n.split(`
149
- `,1)[0],B;if(f=de,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),B=f):B=f.replace(this.rules.other.tabCharGlobal," "),De.test(f)||Fe.test(f)||Qt.test(f)||Gt.test(f)||S.test(f)||j.test(f))break;if(B.search(this.rules.other.nonSpaceChar)>=b||!f.trim())p+=`
150
+ `,n=n.substring(f.length+1),c=!0),!c){let S=this.rules.other.nextBulletRegex(b),j=this.rules.other.hrRegex(b),De=this.rules.other.fencesBeginRegex(b),Fe=this.rules.other.headingBeginRegex(b),Qt=this.rules.other.htmlBeginRegex(b),Yt=this.rules.other.blockquoteBeginRegex(b);for(;n;){let de=n.split(`
151
+ `,1)[0],B;if(f=de,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),B=f):B=f.replace(this.rules.other.tabCharGlobal," "),De.test(f)||Fe.test(f)||Qt.test(f)||Yt.test(f)||S.test(f)||j.test(f))break;if(B.search(this.rules.other.nonSpaceChar)>=b||!f.trim())p+=`
150
152
  `+B.slice(b);else{if(x||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||De.test(h)||Fe.test(h)||j.test(h))break;p+=`
151
153
  `+f}x=!f.trim(),d+=de+`
152
- `,n=n.substring(de.length+1),h=B.slice(b)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(o=!0)),i.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),i.raw+=d}let a=i.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let l of i.items)if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),!i.loose){let d=l.tokens.filter(h=>h.type==="space"),p=d.length>0&&d.some(h=>this.rules.other.anyLine.test(h.raw));i.loose=p}for(let l of i.items){let d=l.tokens[0];if(l.task&&(d?.type==="text"||d?.type==="paragraph")){l.text=l.text.replace(this.rules.other.listReplaceTask,""),d.raw=d.raw.replace(this.rules.other.listReplaceTask,""),d.text=d.text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(l.raw);if(p){let h={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};l.checked=h.checked,i.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=h.raw+l.tokens[0].raw,l.tokens[0].text=h.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(h)):l.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):l.tokens.unshift(h)}}else l.task&&(l.task=!1)}if(i.loose)for(let l of i.items){l.loose=!0;for(let d of l.tokens)d.type==="text"&&(d.type="paragraph")}return i}}html(n){let e=this.rules.block.html.exec(n);if(e){let t=it(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:E(e[0],`
153
- `),href:s,title:i}}}table(n){let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=st(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
154
+ `,n=n.substring(de.length+1),h=B.slice(b)}}s.loose||(o?s.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(o=!0)),s.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),s.raw+=d}let a=s.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let c of s.items)if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),!s.loose){let d=c.tokens.filter(h=>h.type==="space"),p=d.length>0&&d.some(h=>this.rules.other.anyLine.test(h.raw));s.loose=p}for(let c of s.items){let d=c.tokens[0];if(c.task&&(d?.type==="text"||d?.type==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),d.raw=d.raw.replace(this.rules.other.listReplaceTask,""),d.text=d.text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(c.raw);if(p){let h={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};c.checked=h.checked,s.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=h.raw+c.tokens[0].raw,c.tokens[0].text=h.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(h)):c.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):c.tokens.unshift(h)}}else c.task&&(c.task=!1)}if(s.loose)for(let c of s.items){c.loose=!0;for(let d of c.tokens)d.type==="text"&&(d.type="paragraph")}return s}}html(n){let e=this.rules.block.html.exec(n);if(e){let t=st(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:E(e[0],`
155
+ `),href:i,title:s}}}table(n){let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=it(e[1]),i=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
154
156
  `):[],r={type:"table",raw:E(e[0],`
155
- `),header:[],align:[],rows:[]};if(t.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?r.align.push("right"):this.rules.other.tableAlignCenter.test(o)?r.align.push("center"):this.rules.other.tableAlignLeft.test(o)?r.align.push("left"):r.align.push(null);for(let o=0;o<t.length;o++)r.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:r.align[o]});for(let o of i)r.rows.push(st(o,r.header.length).map((a,l)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:r.align[l]})));return r}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e){let t=e[1].trim();return{type:"heading",raw:E(e[0],`
157
+ `),header:[],align:[],rows:[]};if(t.length===i.length){for(let o of i)this.rules.other.tableAlignRight.test(o)?r.align.push("right"):this.rules.other.tableAlignCenter.test(o)?r.align.push("center"):this.rules.other.tableAlignLeft.test(o)?r.align.push("left"):r.align.push(null);for(let o=0;o<t.length;o++)r.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:r.align[o]});for(let o of s)r.rows.push(it(o,r.header.length).map((a,c)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:r.align[c]})));return r}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e){let t=e[1].trim();return{type:"heading",raw:E(e[0],`
156
158
  `),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let t=e[1].charAt(e[1].length-1)===`
157
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let r=E(t.slice(0,-1),"\\");if((t.length-r.length)%2===0)return}else{let r=ki(e[2],"()");if(r===-2)return;if(r>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+r;e[2]=e[2].substring(0,r),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let s=e[2],i="";if(this.options.pedantic){let r=this.rules.other.pedanticHrefTitle.exec(s);r&&(s=r[1],i=r[3])}else i=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),nt(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[s.toLowerCase()];if(!i){let r=t[0].charAt(0);return{type:"text",raw:r,text:r}}return nt(t,i,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(n);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,r,o,a=i,l=0,d=s[0][0],p=t===d,h=d==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*n.length+i);(s=h.exec(e))!==null;){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r)continue;if(o=[...r].length,s[3]||s[4]){a+=o;continue}else if(s[5]||s[6]){if(i%3&&!((i+o)%3)){l+=o;continue}if(p)break}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let f=[...s[0]][0].length,x=n.slice(0,i+s.index+f+o);if(Math.min(i,o)%2){let S=x.slice(1,-1);return{type:"em",raw:x,text:S,tokens:this.lexer.inlineTokens(S)}}let b=x.slice(2,-2);return{type:"strong",raw:x,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,t=""){let s=this.rules.inline.delLDelim.exec(n);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,r,o,a=i,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*n.length+i);(s=l.exec(e))!==null;){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r||(o=[...r].length,o!==i))continue;if(s[3]||s[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let d=[...s[0]][0].length,p=n.slice(0,i+s.index+d+o),h=p.slice(i,-i);return{type:"del",raw:p,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(n){let e;if(e=this.rules.inline.url.exec(n)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},w=class ve{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||F,this.options.tokenizer=this.options.tokenizer||new ne,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:y,block:ee.normal,inline:K.normal};this.options.pedantic?(t.block=ee.pedantic,t.inline=K.pedantic):this.options.gfm&&(t.block=ee.gfm,this.options.breaks?t.inline=K.breaks:t.inline=K.gfm),this.tokenizer.rules=t}static get rules(){return{block:ee,inline:K}}static lex(e,t){return new ve(t).lex(e)}static lexInline(e,t){return new ve(t).inlineTokens(e)}lex(e){e=e.replace(y.carriageReturn,`
158
- `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(y.tabCharGlobal," ").replace(y.spaceLine,""));let i=1/0;for(;e;){if(e.length<i)i=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let r;if(this.options.extensions?.block?.some(a=>(r=a.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let a=t.at(-1);r.raw.length===1&&a!==void 0?a.raw+=`
159
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let r=E(t.slice(0,-1),"\\");if((t.length-r.length)%2===0)return}else{let r=$s(e[2],"()");if(r===-2)return;if(r>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+r;e[2]=e[2].substring(0,r),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let i=e[2],s="";if(this.options.pedantic){let r=this.rules.other.pedanticHrefTitle.exec(i);r&&(i=r[1],s=r[3])}else s=e[3]?e[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?i=i.slice(1):i=i.slice(1,-1)),nt(e,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let i=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[i.toLowerCase()];if(!s){let r=t[0].charAt(0);return{type:"text",raw:r,text:r}}return nt(t,s,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let i=this.rules.inline.emStrongLDelim.exec(n);if(!(!i||!i[1]&&!i[2]&&!i[3]&&!i[4]||i[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[3])||!t||this.rules.inline.punctuation.exec(t))){let s=[...i[0]].length-1,r,o,a=s,c=0,d=i[0][0],p=t===d,h=d==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*n.length+s);(i=h.exec(e))!==null;){if(r=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!r)continue;if(o=[...r].length,i[3]||i[4]){a+=o;continue}else if(i[5]||i[6]){if(s%3&&!((s+o)%3)){c+=o;continue}if(p)break}if(a-=o,a>0)continue;o=Math.min(o,o+a+c);let f=[...i[0]][0].length,x=n.slice(0,s+i.index+f+o);if(Math.min(s,o)%2){let S=x.slice(1,-1);return{type:"em",raw:x,text:S,tokens:this.lexer.inlineTokens(S)}}let b=x.slice(2,-2);return{type:"strong",raw:x,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(t),s=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return i&&s&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,t=""){let i=this.rules.inline.delLDelim.exec(n);if(i&&(!i[1]||!t||this.rules.inline.punctuation.exec(t))){let s=[...i[0]].length-1,r,o,a=s,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*n.length+s);(i=c.exec(e))!==null;){if(r=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!r||(o=[...r].length,o!==s))continue;if(i[3]||i[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let d=[...i[0]][0].length,p=n.slice(0,s+i.index+d+o),h=p.slice(s,-s);return{type:"del",raw:p,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,i;return e[2]==="@"?(t=e[1],i="mailto:"+t):(t=e[1],i=t),{type:"link",raw:e[0],text:t,href:i,tokens:[{type:"text",raw:t,text:t}]}}}url(n){let e;if(e=this.rules.inline.url.exec(n)){let t,i;if(e[2]==="@")t=e[0],i="mailto:"+t;else{let s;do s=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(s!==e[0]);t=e[0],e[1]==="www."?i="http://"+e[0]:i=e[0]}return{type:"link",raw:e[0],text:t,href:i,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},w=class ve{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||F,this.options.tokenizer=this.options.tokenizer||new ne,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:y,block:ee.normal,inline:K.normal};this.options.pedantic?(t.block=ee.pedantic,t.inline=K.pedantic):this.options.gfm&&(t.block=ee.gfm,this.options.breaks?t.inline=K.breaks:t.inline=K.gfm),this.tokenizer.rules=t}static get rules(){return{block:ee,inline:K}}static lex(e,t){return new ve(t).lex(e)}static lexInline(e,t){return new ve(t).inlineTokens(e)}lex(e){e=e.replace(y.carriageReturn,`
160
+ `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let i=this.inlineQueue[t];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],i=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(y.tabCharGlobal," ").replace(y.spaceLine,""));let s=1/0;for(;e;){if(e.length<s)s=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let r;if(this.options.extensions?.block?.some(a=>(r=a.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let a=t.at(-1);r.raw.length===1&&a!==void 0?a.raw+=`
159
161
  `:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
160
162
  `)?"":`
161
163
  `)+r.raw,a.text+=`
162
164
  `+r.text,this.inlineQueue.at(-1).src=a.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
163
165
  `)?"":`
164
166
  `)+r.raw,a.text+=`
165
- `+r.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let o=e;if(this.options.extensions?.startBlock){let a=1/0,l=e.slice(1),d;this.options.extensions.startBlock.forEach(p=>{d=p.call({lexer:this},l),typeof d=="number"&&d>=0&&(a=Math.min(a,d))}),a<1/0&&a>=0&&(o=e.substring(0,a+1))}if(this.state.top&&(r=this.tokenizer.paragraph(o))){let a=t.at(-1);s&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
167
+ `+r.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let o=e;if(this.options.extensions?.startBlock){let a=1/0,c=e.slice(1),d;this.options.extensions.startBlock.forEach(p=>{d=p.call({lexer:this},c),typeof d=="number"&&d>=0&&(a=Math.min(a,d))}),a<1/0&&a>=0&&(o=e.substring(0,a+1))}if(this.state.top&&(r=this.tokenizer.paragraph(o))){let a=t.at(-1);i&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
166
168
  `)?"":`
167
169
  `)+r.raw,a.text+=`
168
- `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),s=o.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(`
170
+ `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),i=o.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(`
169
171
  `)?"":`
170
172
  `)+r.raw,a.text+=`
171
- `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes("["))return!1;let t=this.tokenizer.rules.inline.link;for(let s of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(s[0])&&e.charAt(s.index-1)!=="!")return!0;for(let s of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let i=s[0],r=i.lastIndexOf("[");if(!(i.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,i.slice(r+1,-1)))&&!(r>1&&this.linkInText(i.slice(1,r-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=e;if(this.tokens.links&&e.includes("[")){let a=this.tokenizer.rules.inline.reflinkSearch,l=d=>{let p=d.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,d.slice(p+1,-1)))return d;if(p>1&&d.charAt(0)!=="!"){let h=d.slice(1,p-1);if(this.linkInText(h))return"["+h.replace(a,l)+"]["+"a".repeat(d.length-p-2)+"]"}return"["+"a".repeat(d.length-2)+"]"};s=s.replace(a,l)}s=s.replace(this.tokenizer.rules.inline.anyPunctuation,a=>"+".repeat(a.length)),s=s.replace(this.tokenizer.rules.inline.blockSkip,(a,l,d)=>{let p=d?d.length:0;return a.slice(0,p)+"["+"a".repeat(a.length-p-2)+"]"}),s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let i=!1,r="",o=1/0;for(;e;){if(e.length<o)o=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}i||(r=""),i=!1;let a;if(this.options.extensions?.inline?.some(d=>(a=d.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let d=t.at(-1);a.type==="text"&&d?.type==="text"?(d.raw+=a.raw,d.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,s,r)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e,s,r)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let l=e;if(this.options.extensions?.startInline){let d=1/0,p=e.slice(1),h;this.options.extensions.startInline.forEach(f=>{h=f.call({lexer:this},p),typeof h=="number"&&h>=0&&(d=Math.min(d,h))}),d<1/0&&d>=0&&(l=e.substring(0,d+1))}if(a=this.tokenizer.inlineText(l)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(r=a.raw.slice(-1)),i=!0;let d=t.at(-1);d?.type==="text"?(d.raw+=a.raw,d.text+=a.text):t.push(a);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},re=class{options;parser;constructor(n){this.options=n||F}space(n){return""}code({text:n,lang:e,escaped:t}){let s=(e||"").match(y.notSpaceStart)?.[0],i=n.replace(y.endingNewline,"")+`
172
- `;return s?'<pre><code class="language-'+C(s)+'">'+(t?i:C(i,!0))+`</code></pre>
173
- `:"<pre><code>"+(t?i:C(i,!0))+`</code></pre>
173
+ `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes("["))return!1;let t=this.tokenizer.rules.inline.link;for(let i of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(i[0])&&e.charAt(i.index-1)!=="!")return!0;for(let i of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let s=i[0],r=s.lastIndexOf("[");if(!(s.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,s.slice(r+1,-1)))&&!(r>1&&this.linkInText(s.slice(1,r-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let i=e;if(this.tokens.links&&e.includes("[")){let a=this.tokenizer.rules.inline.reflinkSearch,c=d=>{let p=d.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,d.slice(p+1,-1)))return d;if(p>1&&d.charAt(0)!=="!"){let h=d.slice(1,p-1);if(this.linkInText(h))return"["+h.replace(a,c)+"]["+"a".repeat(d.length-p-2)+"]"}return"["+"a".repeat(d.length-2)+"]"};i=i.replace(a,c)}i=i.replace(this.tokenizer.rules.inline.anyPunctuation,a=>"+".repeat(a.length)),i=i.replace(this.tokenizer.rules.inline.blockSkip,(a,c,d)=>{let p=d?d.length:0;return a.slice(0,p)+"["+"a".repeat(a.length-p-2)+"]"}),i=this.options.hooks?.emStrongMask?.call({lexer:this},i)??i;let s=!1,r="",o=1/0;for(;e;){if(e.length<o)o=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}s||(r=""),s=!1;let a;if(this.options.extensions?.inline?.some(d=>(a=d.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let d=t.at(-1);a.type==="text"&&d?.type==="text"?(d.raw+=a.raw,d.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,i,r)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e,i,r)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let c=e;if(this.options.extensions?.startInline){let d=1/0,p=e.slice(1),h;this.options.extensions.startInline.forEach(f=>{h=f.call({lexer:this},p),typeof h=="number"&&h>=0&&(d=Math.min(d,h))}),d<1/0&&d>=0&&(c=e.substring(0,d+1))}if(a=this.tokenizer.inlineText(c)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(r=a.raw.slice(-1)),s=!0;let d=t.at(-1);d?.type==="text"?(d.raw+=a.raw,d.text+=a.text):t.push(a);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},re=class{options;parser;constructor(n){this.options=n||F}space(n){return""}code({text:n,lang:e,escaped:t}){let i=(e||"").match(y.notSpaceStart)?.[0],s=n.replace(y.endingNewline,"")+`
174
+ `;return i?'<pre><code class="language-'+C(i)+'">'+(t?s:C(s,!0))+`</code></pre>
175
+ `:"<pre><code>"+(t?s:C(s,!0))+`</code></pre>
174
176
  `}blockquote({tokens:n}){return`<blockquote>
175
177
  ${this.parser.parse(n)}</blockquote>
176
178
  `}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:e}){return`<h${e}>${this.parser.parseInline(n)}</h${e}>
177
179
  `}hr(n){return`<hr>
178
- `}list(n){let e=n.ordered,t=n.start,s="";for(let o=0;o<n.items.length;o++){let a=n.items[o];s+=this.listitem(a)}let i=e?"ol":"ul",r=e&&t!==1?' start="'+t+'"':"";return"<"+i+r+`>
179
- `+s+"</"+i+`>
180
+ `}list(n){let e=n.ordered,t=n.start,i="";for(let o=0;o<n.items.length;o++){let a=n.items[o];i+=this.listitem(a)}let s=e?"ol":"ul",r=e&&t!==1?' start="'+t+'"':"";return"<"+s+r+`>
181
+ `+i+"</"+s+`>
180
182
  `}listitem(n){return`<li>${this.parser.parse(n.tokens)}</li>
181
183
  `}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
182
- `}table(n){let e="",t="";for(let i=0;i<n.header.length;i++)t+=this.tablecell(n.header[i]);e+=this.tablerow({text:t});let s="";for(let i=0;i<n.rows.length;i++){let r=n.rows[i];t="";for(let o=0;o<r.length;o++)t+=this.tablecell(r[o]);s+=this.tablerow({text:t})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
184
+ `}table(n){let e="",t="";for(let s=0;s<n.header.length;s++)t+=this.tablecell(n.header[s]);e+=this.tablerow({text:t});let i="";for(let s=0;s<n.rows.length;s++){let r=n.rows[s];t="";for(let o=0;o<r.length;o++)t+=this.tablecell(r[o]);i+=this.tablerow({text:t})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
183
185
  <thead>
184
186
  `+e+`</thead>
185
- `+s+`</table>
187
+ `+i+`</table>
186
188
  `}tablerow({text:n}){return`<tr>
187
189
  ${n}</tr>
188
190
  `}tablecell(n){let e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
189
- `}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${C(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let s=this.parser.parseInline(t),i=tt(n);if(i===null)return s;n=i;let r='<a href="'+n+'"';return e&&(r+=' title="'+C(e)+'"'),r+=">"+s+"</a>",r}image({href:n,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let i=tt(n);if(i===null)return C(t);n=i;let r=`<img src="${n}" alt="${C(t)}"`;return e&&(r+=` title="${C(e)}"`),r+=">",r}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:C(n.text)}},Oe=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},_=class xe{options;renderer;textRenderer;constructor(e){this.options=e||F,this.options.renderer=this.options.renderer||new re,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Oe}static parse(e,t){return new xe(t).parse(e)}static parseInline(e,t){return new xe(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let o=i,a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(o.type)){t+=a||"";continue}}let r=i;switch(r.type){case"space":{t+=this.renderer.space(r);break}case"hr":{t+=this.renderer.hr(r);break}case"heading":{t+=this.renderer.heading(r);break}case"code":{t+=this.renderer.code(r);break}case"table":{t+=this.renderer.table(r);break}case"blockquote":{t+=this.renderer.blockquote(r);break}case"list":{t+=this.renderer.list(r);break}case"checkbox":{t+=this.renderer.checkbox(r);break}case"html":{t+=this.renderer.html(r);break}case"def":{t+=this.renderer.def(r);break}case"paragraph":{t+=this.renderer.paragraph(r);break}case"text":{t+=this.renderer.text(r);break}default:{let o='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let s="";for(let i=0;i<e.length;i++){let r=e[i];if(this.options.extensions?.renderers?.[r.type]){let a=this.options.extensions.renderers[r.type].call({parser:this},r);if(a!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(r.type)){s+=a||"";continue}}let o=r;switch(o.type){case"escape":{s+=t.text(o);break}case"html":{s+=t.html(o);break}case"link":{s+=t.link(o);break}case"image":{s+=t.image(o);break}case"checkbox":{s+=t.checkbox(o);break}case"strong":{s+=t.strong(o);break}case"em":{s+=t.em(o);break}case"codespan":{s+=t.codespan(o);break}case"br":{s+=t.br(o);break}case"del":{s+=t.del(o);break}case"text":{s+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return s}},V=class{options;block;constructor(n){this.options=n||F}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(n=this.block){return n?w.lex:w.lexInline}provideParser(n=this.block){return n?_.parse:_.parseInline}},_i=class{defaults=Ae();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=_;Renderer=re;TextRenderer=Oe;Lexer=w;Tokenizer=ne;Hooks=V;constructor(...n){this.use(...n)}walkTokens(n,e){let t=[];for(let s of n)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let i=s;for(let r of i.header)t=t.concat(this.walkTokens(r.tokens,e));for(let r of i.rows)for(let o of r)t=t.concat(this.walkTokens(o.tokens,e));break}case"list":{let i=s;t=t.concat(this.walkTokens(i.items,e));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(r=>{let o=i[r].flat(1/0);t=t.concat(this.walkTokens(o,e))}):i.tokens&&(t=t.concat(this.walkTokens(i.tokens,e)))}}return t}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let r=e.renderers[i.name];r?e.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=r.apply(this,o)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let r=e[i.level];r?r.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),s.extensions=e),t.renderer){let i=this.defaults.renderer||new re(this.defaults);for(let r in t.renderer){if(!(r in i))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;let o=r,a=t.renderer[o],l=i[o];i[o]=(...d)=>{let p=a.apply(i,d);return p===!1&&(p=l.apply(i,d)),p||""}}s.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new ne(this.defaults);for(let r in t.tokenizer){if(!(r in i))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let o=r,a=t.tokenizer[o],l=i[o];i[o]=(...d)=>{let p=a.apply(i,d);return p===!1&&(p=l.apply(i,d)),p}}s.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new V;for(let r in t.hooks){if(!(r in i))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;let o=r,a=t.hooks[o],l=i[o];V.passThroughHooks.has(r)?i[o]=d=>{if(this.defaults.async&&V.passThroughHooksRespectAsync.has(r))return(async()=>{let h=await a.call(i,d);return l.call(i,h)})();let p=a.call(i,d);return l.call(i,p)}:i[o]=(...d)=>{if(this.defaults.async)return(async()=>{let h=await a.apply(i,d);return h===!1&&(h=await l.apply(i,d)),h})();let p=a.apply(i,d);return p===!1&&(p=l.apply(i,d)),p}}s.hooks=i}if(t.walkTokens){let i=this.defaults.walkTokens,r=t.walkTokens;s.walkTokens=function(o){let a=[];return a.push(r.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return w.lex(n,e??this.defaults)}parser(n,e){return _.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let s={...t},i={...this.defaults,...s},r=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return r(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return r(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return r(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=n),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,a=await(i.hooks?await i.hooks.provideLexer(n):n?w.lex:w.lexInline)(o,i),l=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let d=await(i.hooks?await i.hooks.provideParser(n):n?_.parse:_.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(d):d})().catch(r);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer(n):n?w.lex:w.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser(n):n?_.parse:_.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return r(o)}}}onError(n,e){return t=>{if(t.message+=`
190
- Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error occurred:</p><pre>"+C(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},D=new _i;function v(n,e){return D.parse(n,e)}v.options=v.setOptions=function(n){return D.setOptions(n),v.defaults=D.defaults,zt(v.defaults),v};v.getDefaults=Ae;v.defaults=F;function Si(...n){return D.use(...n),v.defaults=D.defaults,zt(v.defaults),v}v.use=Si;v.walkTokens=function(n,e){return D.walkTokens(n,e)};v.parseInline=D.parseInline;v.Parser=_;v.parser=_.parse;v.Renderer=re;v.TextRenderer=Oe;v.Lexer=w;v.lexer=w.lex;v.Tokenizer=ne;v.Hooks=V;v.parse=v;v.options;v.setOptions;v.walkTokens;v.parseInline;_.parse;w.lex;/**
191
+ `}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${C(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let i=this.parser.parseInline(t),s=tt(n);if(s===null)return i;n=s;let r='<a href="'+n+'"';return e&&(r+=' title="'+C(e)+'"'),r+=">"+i+"</a>",r}image({href:n,title:e,text:t,tokens:i}){i&&(t=this.parser.parseInline(i,this.parser.textRenderer));let s=tt(n);if(s===null)return C(t);n=s;let r=`<img src="${n}" alt="${C(t)}"`;return e&&(r+=` title="${C(e)}"`),r+=">",r}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:C(n.text)}},Oe=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},_=class xe{options;renderer;textRenderer;constructor(e){this.options=e||F,this.options.renderer=this.options.renderer||new re,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Oe}static parse(e,t){return new xe(t).parse(e)}static parseInline(e,t){return new xe(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let i=0;i<e.length;i++){let s=e[i];if(this.options.extensions?.renderers?.[s.type]){let o=s,a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(o.type)){t+=a||"";continue}}let r=s;switch(r.type){case"space":{t+=this.renderer.space(r);break}case"hr":{t+=this.renderer.hr(r);break}case"heading":{t+=this.renderer.heading(r);break}case"code":{t+=this.renderer.code(r);break}case"table":{t+=this.renderer.table(r);break}case"blockquote":{t+=this.renderer.blockquote(r);break}case"list":{t+=this.renderer.list(r);break}case"checkbox":{t+=this.renderer.checkbox(r);break}case"html":{t+=this.renderer.html(r);break}case"def":{t+=this.renderer.def(r);break}case"paragraph":{t+=this.renderer.paragraph(r);break}case"text":{t+=this.renderer.text(r);break}default:{let o='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let i="";for(let s=0;s<e.length;s++){let r=e[s];if(this.options.extensions?.renderers?.[r.type]){let a=this.options.extensions.renderers[r.type].call({parser:this},r);if(a!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(r.type)){i+=a||"";continue}}let o=r;switch(o.type){case"escape":{i+=t.text(o);break}case"html":{i+=t.html(o);break}case"link":{i+=t.link(o);break}case"image":{i+=t.image(o);break}case"checkbox":{i+=t.checkbox(o);break}case"strong":{i+=t.strong(o);break}case"em":{i+=t.em(o);break}case"codespan":{i+=t.codespan(o);break}case"br":{i+=t.br(o);break}case"del":{i+=t.del(o);break}case"text":{i+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return i}},V=class{options;block;constructor(n){this.options=n||F}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(n=this.block){return n?w.lex:w.lexInline}provideParser(n=this.block){return n?_.parse:_.parseInline}},Ss=class{defaults=Te();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=_;Renderer=re;TextRenderer=Oe;Lexer=w;Tokenizer=ne;Hooks=V;constructor(...n){this.use(...n)}walkTokens(n,e){let t=[];for(let i of n)switch(t=t.concat(e.call(this,i)),i.type){case"table":{let s=i;for(let r of s.header)t=t.concat(this.walkTokens(r.tokens,e));for(let r of s.rows)for(let o of r)t=t.concat(this.walkTokens(o.tokens,e));break}case"list":{let s=i;t=t.concat(this.walkTokens(s.items,e));break}default:{let s=i;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach(r=>{let o=s[r].flat(1/0);t=t.concat(this.walkTokens(o,e))}):s.tokens&&(t=t.concat(this.walkTokens(s.tokens,e)))}}return t}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let i={...t};if(i.async=this.defaults.async||i.async||!1,t.extensions&&(t.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let r=e.renderers[s.name];r?e.renderers[s.name]=function(...o){let a=s.renderer.apply(this,o);return a===!1&&(a=r.apply(this,o)),a}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let r=e[s.level];r?r.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),i.extensions=e),t.renderer){let s=this.defaults.renderer||new re(this.defaults);for(let r in t.renderer){if(!(r in s))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;let o=r,a=t.renderer[o],c=s[o];s[o]=(...d)=>{let p=a.apply(s,d);return p===!1&&(p=c.apply(s,d)),p||""}}i.renderer=s}if(t.tokenizer){let s=this.defaults.tokenizer||new ne(this.defaults);for(let r in t.tokenizer){if(!(r in s))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let o=r,a=t.tokenizer[o],c=s[o];s[o]=(...d)=>{let p=a.apply(s,d);return p===!1&&(p=c.apply(s,d)),p}}i.tokenizer=s}if(t.hooks){let s=this.defaults.hooks||new V;for(let r in t.hooks){if(!(r in s))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;let o=r,a=t.hooks[o],c=s[o];V.passThroughHooks.has(r)?s[o]=d=>{if(this.defaults.async&&V.passThroughHooksRespectAsync.has(r))return(async()=>{let h=await a.call(s,d);return c.call(s,h)})();let p=a.call(s,d);return c.call(s,p)}:s[o]=(...d)=>{if(this.defaults.async)return(async()=>{let h=await a.apply(s,d);return h===!1&&(h=await c.apply(s,d)),h})();let p=a.apply(s,d);return p===!1&&(p=c.apply(s,d)),p}}i.hooks=s}if(t.walkTokens){let s=this.defaults.walkTokens,r=t.walkTokens;i.walkTokens=function(o){let a=[];return a.push(r.call(this,o)),s&&(a=a.concat(s.call(this,o))),a}}this.defaults={...this.defaults,...i}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return w.lex(n,e??this.defaults)}parser(n,e){return _.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let i={...t},s={...this.defaults,...i},r=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&i.async===!1)return r(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return r(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return r(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=n),s.async)return(async()=>{let o=s.hooks?await s.hooks.preprocess(e):e,a=await(s.hooks?await s.hooks.provideLexer(n):n?w.lex:w.lexInline)(o,s),c=s.hooks?await s.hooks.processAllTokens(a):a;s.walkTokens&&await Promise.all(this.walkTokens(c,s.walkTokens));let d=await(s.hooks?await s.hooks.provideParser(n):n?_.parse:_.parseInline)(c,s);return s.hooks?await s.hooks.postprocess(d):d})().catch(r);try{s.hooks&&(e=s.hooks.preprocess(e));let o=(s.hooks?s.hooks.provideLexer(n):n?w.lex:w.lexInline)(e,s);s.hooks&&(o=s.hooks.processAllTokens(o)),s.walkTokens&&this.walkTokens(o,s.walkTokens);let a=(s.hooks?s.hooks.provideParser(n):n?_.parse:_.parseInline)(o,s);return s.hooks&&(a=s.hooks.postprocess(a)),a}catch(o){return r(o)}}}onError(n,e){return t=>{if(t.message+=`
192
+ Please report this to https://github.com/markedjs/marked.`,n){let i="<p>An error occurred:</p><pre>"+C(t.message+"",!0)+"</pre>";return e?Promise.resolve(i):i}if(e)return Promise.reject(t);throw t}}},D=new Ss;function v(n,e){return D.parse(n,e)}v.options=v.setOptions=function(n){return D.setOptions(n),v.defaults=D.defaults,Lt(v.defaults),v};v.getDefaults=Te;v.defaults=F;function Cs(...n){return D.use(...n),v.defaults=D.defaults,Lt(v.defaults),v}v.use=Cs;v.walkTokens=function(n,e){return D.walkTokens(n,e)};v.parseInline=D.parseInline;v.Parser=_;v.parser=_.parse;v.Renderer=re;v.TextRenderer=Oe;v.Lexer=w;v.lexer=w.lex;v.Tokenizer=ne;v.Hooks=V;v.parse=v;v.options;v.setOptions;v.walkTokens;v.parseInline;_.parse;w.lex;/**
191
193
  * @license
192
194
  * Copyright 2017 Google LLC
193
195
  * SPDX-License-Identifier: BSD-3-Clause
194
- */const Ci={CHILD:2},Ti=n=>(...e)=>({_$litDirective$:n,values:e});class Ai{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,s){this._$Ct=e,this._$AM=t,this._$Ci=s}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
196
+ */const As={CHILD:2},Ts=n=>(...e)=>({_$litDirective$:n,values:e});class Es{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
195
197
  * @license
196
198
  * Copyright 2017 Google LLC
197
199
  * SPDX-License-Identifier: BSD-3-Clause
198
- */class ye extends Ai{constructor(e){if(super(e),this.it=m,e.type!==Ci.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===m||e==null)return this._t=void 0,this.it=e;if(e===O)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}ye.directiveName="unsafeHTML",ye.resultType=1;const Ei=Ti(ye);let rt=0;class Ri extends k{static{this.properties={tags:{attribute:!1},active:{attribute:!1},onToggle:{attribute:!1},allowCreate:{attribute:!1},width:{attribute:!1}}}#e=new u("");#t=new u(!1);#s=new u(-1);#r;#n;static{this.styles=T`
200
+ */class ye extends Es{constructor(e){if(super(e),this.it=m,e.type!==As.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===m||e==null)return this._t=void 0,this.it=e;if(e===O)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}ye.directiveName="unsafeHTML",ye.resultType=1;const Rs=Ts(ye);let rt=0;class Ps extends k{static{this.properties={tags:{attribute:!1},active:{attribute:!1},onToggle:{attribute:!1},allowCreate:{attribute:!1},width:{attribute:!1}}}#e=new u("");#t=new u(!1);#i=new u(-1);#r;#n;static{this.styles=A`
199
201
  :host {
200
202
  display: inline-block;
201
203
  position: relative;
@@ -309,10 +311,10 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
309
311
  .option input { margin: 0; pointer-events: none; }
310
312
  .empty { padding: 6px 8px; opacity: 0.6; font-style: italic; font-size: 12px; }
311
313
  .create-option { color: var(--accent); font-style: italic; }
312
- `}constructor(){super(),new Y(this),this.tags=[],this.active=[],this.onToggle=()=>{},this.allowCreate=!1,this.#r=`--tag-multiselect-${++rt}`,this.#n=`tag-multiselect-listbox-${rt}`}willUpdate(){this.style.width=this.width??""}#d=e=>{e.composedPath().includes(this)||this.#l()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#d)}disconnectedCallback(){document.removeEventListener("click",this.#d),super.disconnectedCallback()}get#a(){const e=this.#e.value.trim().toLowerCase();return e?this.tags.filter(t=>t.toLowerCase().includes(e)):this.tags}#i(){this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#l(){this.#t.set(!1),this.#s.set(-1),this.renderRoot.querySelector(".menu")?.hidePopover()}#p(){this.#t.value?this.#l():(this.#i(),this.renderRoot.querySelector(".input")?.focus())}#h(e){this.#e.set(e.target.value),this.#s.set(-1),this.#i()}#u(e){this.onToggle(e),this.#e.set(""),this.#s.set(-1)}get#o(){if(!this.allowCreate)return!1;const e=this.#e.value.trim();return e.length>0&&!this.tags.includes(e)&&!this.active.includes(e)}#g(e){e.stopPropagation(),this.active.forEach(t=>this.onToggle(t)),this.#e.set(""),this.renderRoot.querySelector(".input")?.focus(),this.#i()}#y(e){const t=this.#a;if(e.key==="ArrowDown")e.preventDefault(),this.#i(),t.length&&this.#s.set((this.#s.value+1)%t.length);else if(e.key==="ArrowUp")e.preventDefault(),this.#i(),t.length&&this.#s.set((this.#s.value-1+t.length)%t.length);else if(e.key==="Enter"||this.allowCreate&&e.key===","){const s=t[this.#s.value];s!==void 0?(e.preventDefault(),this.#u(s)):this.#o&&(e.preventDefault(),this.#u(this.#e.value.trim()))}else if(e.key==="Backspace"&&!this.#e.value&&this.active.length>0){const s=this.active[this.active.length-1];s!==void 0&&this.onToggle(s)}else e.key==="Escape"&&this.#l()}render(){const e=this.active,t=this.#a,s=this.#t.value,i=this.#s.value;return c`
314
+ `}constructor(){super(),new Y(this),this.tags=[],this.active=[],this.onToggle=()=>{},this.allowCreate=!1,this.#r=`--tag-multiselect-${++rt}`,this.#n=`tag-multiselect-listbox-${rt}`}willUpdate(){this.style.width=this.width??""}#h=e=>{e.composedPath().includes(this)||this.#c()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#h)}disconnectedCallback(){document.removeEventListener("click",this.#h),super.disconnectedCallback()}get#l(){const e=this.#e.value.trim().toLowerCase();return e?this.tags.filter(t=>t.toLowerCase().includes(e)):this.tags}#s(){this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#c(){this.#t.set(!1),this.#i.set(-1),this.renderRoot.querySelector(".menu")?.hidePopover()}#f(){this.#t.value?this.#c():(this.#s(),this.renderRoot.querySelector(".input")?.focus())}#y(e){this.#e.set(e.target.value),this.#i.set(-1),this.#s()}#p(e){this.onToggle(e),this.#e.set(""),this.#i.set(-1)}get#o(){if(!this.allowCreate)return!1;const e=this.#e.value.trim();return e.length>0&&!this.tags.includes(e)&&!this.active.includes(e)}#a(e){e.stopPropagation(),this.active.forEach(t=>this.onToggle(t)),this.#e.set(""),this.renderRoot.querySelector(".input")?.focus(),this.#s()}#k(e){const t=this.#l;if(e.key==="ArrowDown")e.preventDefault(),this.#s(),t.length&&this.#i.set((this.#i.value+1)%t.length);else if(e.key==="ArrowUp")e.preventDefault(),this.#s(),t.length&&this.#i.set((this.#i.value-1+t.length)%t.length);else if(e.key==="Enter"||this.allowCreate&&e.key===","){const i=t[this.#i.value];i!==void 0?(e.preventDefault(),this.#p(i)):this.#o&&(e.preventDefault(),this.#p(this.#e.value.trim()))}else if(e.key==="Backspace"&&!this.#e.value&&this.active.length>0){const i=this.active[this.active.length-1];i!==void 0&&this.onToggle(i)}else e.key==="Escape"&&this.#c()}render(){const e=this.active,t=this.#l,i=this.#t.value,s=this.#i.value;return l`
313
315
  <div class="field" style=${`anchor-name: ${this.#r}`}>
314
316
  <div class="chips-and-input">
315
- ${e.map(r=>c`
317
+ ${e.map(r=>l`
316
318
  <span class="selected-chip">
317
319
  ${r}
318
320
  <span class="remove" @click=${()=>this.onToggle(r)}>✕</span>
@@ -322,23 +324,23 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
322
324
  class="input"
323
325
  role="combobox"
324
326
  aria-autocomplete="list"
325
- aria-expanded=${s}
327
+ aria-expanded=${i}
326
328
  aria-controls=${this.#n}
327
- aria-activedescendant=${i>=0?`${this.#n}-opt-${i}`:""}
329
+ aria-activedescendant=${s>=0?`${this.#n}-opt-${s}`:""}
328
330
  placeholder=${e.length===0?"Filter by tag…":""}
329
331
  .value=${this.#e.value}
330
- @input=${r=>this.#h(r)}
331
- @focus=${()=>this.#i()}
332
- @click=${()=>this.#i()}
333
- @keydown=${r=>this.#y(r)}
332
+ @input=${r=>this.#y(r)}
333
+ @focus=${()=>this.#s()}
334
+ @click=${()=>this.#s()}
335
+ @keydown=${r=>this.#k(r)}
334
336
  />
335
337
  </div>
336
- ${e.length>0?c`<button class="clear-btn" tabindex="-1" @mousedown=${r=>r.preventDefault()} @click=${r=>this.#g(r)}>✕</button>`:""}
338
+ ${e.length>0?l`<button class="clear-btn" tabindex="-1" @mousedown=${r=>r.preventDefault()} @click=${r=>this.#a(r)}>✕</button>`:""}
337
339
  <button
338
- class="chevron-btn ${s?"open":""}"
340
+ class="chevron-btn ${i?"open":""}"
339
341
  tabindex="-1"
340
342
  @mousedown=${r=>r.preventDefault()}
341
- @click=${()=>this.#p()}
343
+ @click=${()=>this.#f()}
342
344
  >
343
345
 
344
346
  </button>
@@ -346,35 +348,35 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
346
348
 
347
349
  <ul
348
350
  id=${this.#n}
349
- class="menu ${s?"visible":""}"
351
+ class="menu ${i?"visible":""}"
350
352
  role="listbox"
351
353
  aria-multiselectable="true"
352
354
  popover="manual"
353
355
  style=${`position-anchor: ${this.#r}`}
354
356
  >
355
- ${t.length?t.map((r,o)=>c`
357
+ ${t.length?t.map((r,o)=>l`
356
358
  <li
357
359
  id=${`${this.#n}-opt-${o}`}
358
360
  role="option"
359
361
  aria-selected=${e.includes(r)}
360
- class=${o===i?"option highlighted":"option"}
362
+ class=${o===s?"option highlighted":"option"}
361
363
  @mousedown=${a=>a.preventDefault()}
362
- @click=${()=>this.#u(r)}
364
+ @click=${()=>this.#p(r)}
363
365
  >
364
366
  <input type="checkbox" .checked=${e.includes(r)} tabindex="-1" />
365
367
  ${r}
366
368
  </li>
367
- `):this.#o?c`
369
+ `):this.#o?l`
368
370
  <li
369
371
  class="option create-option"
370
372
  @mousedown=${r=>r.preventDefault()}
371
- @click=${()=>this.#u(this.#e.value.trim())}
373
+ @click=${()=>this.#p(this.#e.value.trim())}
372
374
  >
373
375
  No match. Create '${this.#e.value.trim()}'
374
376
  </li>
375
- `:c`<li class="empty">${this.allowCreate?"Type to create a tag":"No matches"}</li>`}
377
+ `:l`<li class="empty">${this.allowCreate?"Type to create a tag":"No matches"}</li>`}
376
378
  </ul>
377
- `}}customElements.define("tag-multiselect",Ri);let ot=0;class Pi extends k{static{this.properties={options:{attribute:!1},value:{attribute:!1},onChange:{attribute:!1}}}#e=new u("");#t=new u(!1);#s=new u(-1);#r;#n;static{this.styles=T`
379
+ `}}customElements.define("tag-multiselect",Ps);let ot=0;class zs extends k{static{this.properties={options:{attribute:!1},value:{attribute:!1},onChange:{attribute:!1}}}#e=new u("");#t=new u(!1);#i=new u(-1);#r;#n;static{this.styles=A`
378
380
  :host {
379
381
  display: inline-block;
380
382
  position: relative;
@@ -461,27 +463,27 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
461
463
  .option.selected { font-weight: 600; }
462
464
  .empty { padding: 6px 8px; opacity: 0.6; font-style: italic; font-size: 12px; }
463
465
  .create-option { color: var(--accent); font-style: italic; }
464
- `}constructor(){super(),new Y(this),this.options=[],this.value="",this.onChange=()=>{},this.#r=`--status-select-${++ot}`,this.#n=`status-select-listbox-${ot}`}#d=e=>{e.composedPath().includes(this)||this.#l()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#d)}disconnectedCallback(){document.removeEventListener("click",this.#d),super.disconnectedCallback()}get#a(){const e=this.#e.value.trim().toLowerCase();return!e||e===this.value.trim().toLowerCase()?this.options:this.options.filter(t=>t.toLowerCase().includes(e))}#i(){this.#e.set(this.value),this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#l(){this.#t.set(!1),this.#s.set(-1),this.#e.set(this.value),this.renderRoot.querySelector(".menu")?.hidePopover()}#p(){this.#t.value?this.#l():(this.#i(),this.renderRoot.querySelector(".input")?.focus())}#h(e){this.#e.set(e.target.value),this.#s.set(-1),this.#t.value||this.#i()}#u(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}#o(e){const t=this.#u(e);if(!t)return this.#l();this.onChange(t),this.#e.set(t),this.#s.set(-1),this.#l()}get#g(){const e=this.#u(this.#e.value);return e.length>0&&!this.options.some(t=>t.toLowerCase()===e)}get#y(){return this.#a.length+(this.#g?1:0)}#$(e){const t=this.#y;if(e.key==="ArrowDown")e.preventDefault(),this.#i(),t&&this.#s.set((this.#s.value+1)%t);else if(e.key==="ArrowUp")e.preventDefault(),this.#i(),t&&this.#s.set((this.#s.value-1+t)%t);else if(e.key==="Enter"){e.preventDefault();const s=this.#a,i=s[this.#s.value];i!==void 0?this.#o(i):this.#s.value===s.length&&this.#g?this.#o(this.#e.value):this.#e.value.trim()&&this.#o(this.#e.value)}else e.key==="Escape"&&(e.preventDefault(),this.#l())}render(){const e=this.value,t=this.#a,s=this.#t.value,i=this.#s.value;return c`
466
+ `}constructor(){super(),new Y(this),this.options=[],this.value="",this.onChange=()=>{},this.#r=`--status-select-${++ot}`,this.#n=`status-select-listbox-${ot}`}#h=e=>{e.composedPath().includes(this)||this.#c()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#h)}disconnectedCallback(){document.removeEventListener("click",this.#h),super.disconnectedCallback()}get#l(){const e=this.#e.value.trim().toLowerCase();return!e||e===this.value.trim().toLowerCase()?this.options:this.options.filter(t=>t.toLowerCase().includes(e))}#s(){this.#e.set(this.value),this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#c(){this.#t.set(!1),this.#i.set(-1),this.#e.set(this.value),this.renderRoot.querySelector(".menu")?.hidePopover()}#f(){this.#t.value?this.#c():(this.#s(),this.renderRoot.querySelector(".input")?.focus())}#y(e){this.#e.set(e.target.value),this.#i.set(-1),this.#t.value||this.#s()}#p(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}#o(e){const t=this.#p(e);if(!t)return this.#c();this.onChange(t),this.#e.set(t),this.#i.set(-1),this.#c()}get#a(){const e=this.#p(this.#e.value);return e.length>0&&!this.options.some(t=>t.toLowerCase()===e)}get#k(){return this.#l.length+(this.#a?1:0)}#w(e){const t=this.#k;if(e.key==="ArrowDown")e.preventDefault(),this.#s(),t&&this.#i.set((this.#i.value+1)%t);else if(e.key==="ArrowUp")e.preventDefault(),this.#s(),t&&this.#i.set((this.#i.value-1+t)%t);else if(e.key==="Enter"){e.preventDefault();const i=this.#l,s=i[this.#i.value];s!==void 0?this.#o(s):this.#i.value===i.length&&this.#a?this.#o(this.#e.value):this.#e.value.trim()&&this.#o(this.#e.value)}else e.key==="Escape"&&(e.preventDefault(),this.#c())}render(){const e=this.value,t=this.#l,i=this.#t.value,s=this.#i.value;return l`
465
467
  <div class="field" style=${`anchor-name: ${this.#r}`}>
466
468
  <input
467
469
  class="input"
468
470
  role="combobox"
469
471
  aria-autocomplete="list"
470
- aria-expanded=${s}
472
+ aria-expanded=${i}
471
473
  aria-controls=${this.#n}
472
- aria-activedescendant=${i>=0?`${this.#n}-opt-${i}`:""}
473
- .value=${s?this.#e.value:e}
474
- @input=${r=>this.#h(r)}
475
- @focus=${()=>this.#i()}
476
- @click=${()=>this.#i()}
477
- @keydown=${r=>this.#$(r)}
478
- @blur=${()=>{this.#t.value&&this.#e.value.trim()&&this.#u(this.#e.value)!==e?this.#o(this.#e.value):this.#l()}}
474
+ aria-activedescendant=${s>=0?`${this.#n}-opt-${s}`:""}
475
+ .value=${i?this.#e.value:e}
476
+ @input=${r=>this.#y(r)}
477
+ @focus=${()=>this.#s()}
478
+ @click=${()=>this.#s()}
479
+ @keydown=${r=>this.#w(r)}
480
+ @blur=${()=>{this.#t.value&&this.#e.value.trim()&&this.#p(this.#e.value)!==e?this.#o(this.#e.value):this.#c()}}
479
481
  />
480
482
  <button
481
- class="chevron-btn ${s?"open":""}"
483
+ class="chevron-btn ${i?"open":""}"
482
484
  tabindex="-1"
483
485
  @mousedown=${r=>r.preventDefault()}
484
- @click=${()=>this.#p()}
486
+ @click=${()=>this.#f()}
485
487
  >
486
488
 
487
489
  </button>
@@ -489,37 +491,37 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
489
491
 
490
492
  <ul
491
493
  id=${this.#n}
492
- class="menu ${s?"visible":""}"
494
+ class="menu ${i?"visible":""}"
493
495
  role="listbox"
494
496
  popover="manual"
495
497
  style=${`position-anchor: ${this.#r}`}
496
498
  >
497
- ${t.map((r,o)=>c`
499
+ ${t.map((r,o)=>l`
498
500
  <li
499
501
  id=${`${this.#n}-opt-${o}`}
500
502
  role="option"
501
503
  aria-selected=${r===e}
502
- class=${`option ${r===e?"selected":""} ${o===i?"highlighted":""}`}
504
+ class=${`option ${r===e?"selected":""} ${o===s?"highlighted":""}`}
503
505
  @mousedown=${a=>a.preventDefault()}
504
506
  @click=${()=>this.#o(r)}
505
507
  >
506
508
  ${r}
507
509
  </li>
508
510
  `)}
509
- ${this.#g?c`
511
+ ${this.#a?l`
510
512
  <li
511
513
  id=${`${this.#n}-opt-${t.length}`}
512
514
  role="option"
513
- class=${`option create-option ${t.length===i?"highlighted":""}`}
515
+ class=${`option create-option ${t.length===s?"highlighted":""}`}
514
516
  @mousedown=${r=>r.preventDefault()}
515
517
  @click=${()=>this.#o(this.#e.value)}
516
518
  >
517
- ${t.length?"Create":"No match. Create"} '${this.#u(this.#e.value)}'
519
+ ${t.length?"Create":"No match. Create"} '${this.#p(this.#e.value)}'
518
520
  </li>
519
521
  `:""}
520
- ${!t.length&&!this.#g?c`<li class="empty">No options</li>`:""}
522
+ ${!t.length&&!this.#a?l`<li class="empty">No options</li>`:""}
521
523
  </ul>
522
- `}}customElements.define("status-select",Pi);let zi=0;const Li={top:"top: auto; bottom: anchor(top); left: anchor(center); right: auto; translate: -50% 0; margin-top: 0; margin-bottom: 6px;",bottom:"top: anchor(bottom); bottom: auto; left: anchor(center); right: auto; translate: -50% 0; margin-top: 6px; margin-bottom: 0;",left:"top: anchor(center); bottom: auto; left: auto; right: anchor(left); translate: 0 -50%; margin-right: 6px;",right:"top: anchor(center); bottom: auto; left: anchor(right); right: auto; translate: 0 -50%; margin-left: 6px;"},Ii=["top","bottom","left","right"];class Oi extends k{static{this.properties={text:{attribute:!1},placement:{attribute:!1}}}#e;#t=null;static{this.styles=T`
524
+ `}}customElements.define("status-select",zs);let Ls=0;const Is={top:"top: auto; bottom: anchor(top); left: anchor(center); right: auto; translate: -50% 0; margin-top: 0; margin-bottom: 6px;",bottom:"top: anchor(bottom); bottom: auto; left: anchor(center); right: auto; translate: -50% 0; margin-top: 6px; margin-bottom: 0;",left:"top: anchor(center); bottom: auto; left: auto; right: anchor(left); translate: 0 -50%; margin-right: 6px;",right:"top: anchor(center); bottom: auto; left: anchor(right); right: auto; translate: 0 -50%; margin-left: 6px;"},Os=["top","bottom","left","right"];class Ds extends k{static{this.properties={text:{attribute:!1},placement:{attribute:!1}}}#e;#t=null;static{this.styles=A`
523
525
  :host {
524
526
  display: inline-flex;
525
527
  position: relative;
@@ -603,7 +605,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
603
605
  translate: 0 -50%;
604
606
  margin: 0 0 0 6px;
605
607
  }
606
- `}constructor(){super(),this.text="",this.placement="top",this.#e=`--help-tooltip-${++zi}`}get#s(){const e=Ii.filter(t=>t!==this.placement);return[this.placement,...e].map(t=>`--bubble-${t}`).join(", ")}disconnectedCallback(){this.#t&&clearTimeout(this.#t),super.disconnectedCallback()}#r(){this.#t&&(clearTimeout(this.#t),this.#t=null);const e=this.renderRoot.querySelector(".bubble");e&&!e.matches(":popover-open")&&e.showPopover()}#n(){this.#t=setTimeout(()=>{this.renderRoot.querySelector(".bubble")?.hidePopover()},100)}render(){return c`
608
+ `}constructor(){super(),this.text="",this.placement="top",this.#e=`--help-tooltip-${++Ls}`}get#i(){const e=Os.filter(t=>t!==this.placement);return[this.placement,...e].map(t=>`--bubble-${t}`).join(", ")}disconnectedCallback(){this.#t&&clearTimeout(this.#t),super.disconnectedCallback()}#r(){this.#t&&(clearTimeout(this.#t),this.#t=null);const e=this.renderRoot.querySelector(".bubble");e&&!e.matches(":popover-open")&&e.showPopover()}#n(){this.#t=setTimeout(()=>{this.renderRoot.querySelector(".bubble")?.hidePopover()},100)}render(){return l`
607
609
  <button
608
610
  type="button"
609
611
  class="icon"
@@ -619,13 +621,13 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
619
621
  role="tooltip"
620
622
  class="bubble"
621
623
  popover="manual"
622
- style=${`position-anchor: ${this.#e}; position-try-fallbacks: ${this.#s}; ${Li[this.placement]}`}
624
+ style=${`position-anchor: ${this.#e}; position-try-fallbacks: ${this.#i}; ${Is[this.placement]}`}
623
625
  @mouseenter=${()=>this.#r()}
624
626
  @mouseleave=${()=>this.#n()}
625
627
  >
626
628
  ${this.text}
627
629
  </div>
628
- `}}customElements.define("help-tooltip",Oi);const at="mem-bucket-detail-view-mode";function Di(n){return new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(n))}const Fi=["stable","beta","unreviewed"],Mi=["active","shipped","abandoned"],lt=["plan","spec","sql","testing-todo","discovery","session-summary","other"],Ni=["ticket","freeform"],$={description:"What this doc is / does, shown in search results and list views. For skills, this is also the only thing an agent sees before deciding whether to load the full body — so state both what it does and when to use it.",tags:"Free-form keywords used to filter and search. Not the only thing matched during full-text search, but the fastest way to narrow a list view.",status:`Lifecycle state — stable/beta/unreviewed for skills, active/shipped/abandoned for memory docs. Skills default to "unreviewed" if left unset, so low-trust content doesn't read as equivalent to a reviewed pattern.`,name:"The skill's identifier — becomes its containing folder name on disk. Lowercase letters, numbers, and hyphens only.",owner:"Who authored or maintains this skill — a person or team name, free text.",extends:"Name of another skill this one builds on or specializes, if any. Leave blank if it doesn't extend anything.",trigger_phrases:"Extra keyword phrases beyond the description that should surface this skill in search — phrasings a user might type that don't literally appear in the description text.",key:"The lookup handle for this memory doc — usually a ticket ID, sometimes a free-form name. One key can have several docs attached (a plan, a spec, session notes) all retrievable together.",key_type:'"ticket" if the key is a real ticket ID, "freeform" for a name like "Spot Chart Design".',doc_type:"What kind of content this is — shapes how it should be read (a plan reads differently than raw SQL or a session summary).",related_to:"Another key this doc relates to, if any — free text, not validated against existing keys."};function ct(n){return{description:n.description??"",tags:n.tags??[],status:n.status??"",name:n.name??"",owner:n.owner??"",extends:n.extends??"",trigger_phrases:n.trigger_phrases??[],key:n.key??"",key_type:n.key_type??"",doc_type:n.doc_type??"",related_to:n.related_to??""}}class qi extends k{constructor(){super(...arguments),this._viewMode=localStorage.getItem(at)??"markdown",this._editing=!1,this._draft=null,this._addingFrontmatter=!1,this._renaming=!1,this._renameValue=""}static{this.properties={selected:{attribute:!1},onChanged:{attribute:!1},facets:{attribute:!1},onTagClick:{attribute:!1},onFolderClick:{attribute:!1},onDateClick:{attribute:!1},onKeyClick:{attribute:!1},_doc:{state:!0},_viewMode:{state:!0},_editing:{state:!0},_draft:{state:!0},_addingFrontmatter:{state:!0},_renaming:{state:!0},_renameValue:{state:!0}}}static{this.styles=T`
630
+ `}}customElements.define("help-tooltip",Ds);const at="mem-bucket-detail-view-mode",Fs=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg"]);function Ms(n){const e=n.lastIndexOf(".");return e===-1?!1:Fs.has(n.slice(e).toLowerCase())}function Ns(n){return new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(n))}const Us=["stable","beta","unreviewed"],qs=["active","shipped","abandoned"],lt=["plan","spec","sql","testing-todo","discovery","session-summary","other"],js=["ticket","freeform"],$={description:"What this doc is / does, shown in search results and list views. For skills, this is also the only thing an agent sees before deciding whether to load the full body — so state both what it does and when to use it.",tags:"Free-form keywords used to filter and search. Not the only thing matched during full-text search, but the fastest way to narrow a list view.",status:`Lifecycle state — stable/beta/unreviewed for skills, active/shipped/abandoned for memory docs. Skills default to "unreviewed" if left unset, so low-trust content doesn't read as equivalent to a reviewed pattern.`,name:"The skill's identifier — becomes its containing folder name on disk. Lowercase letters, numbers, and hyphens only.",owner:"Who authored or maintains this skill — a person or team name, free text.",extends:"Name of another skill this one builds on or specializes, if any. Leave blank if it doesn't extend anything.",trigger_phrases:"Extra keyword phrases beyond the description that should surface this skill in search — phrasings a user might type that don't literally appear in the description text.",key:"The lookup handle for this memory doc — usually a ticket ID, sometimes a free-form name. One key can have several docs attached (a plan, a spec, session notes) all retrievable together.",key_type:'"ticket" if the key is a real ticket ID, "freeform" for a name like "Spot Chart Design".',doc_type:"What kind of content this is — shapes how it should be read (a plan reads differently than raw SQL or a session summary).",related_to:"Another key this doc relates to, if any — free text, not validated against existing keys."};function ct(n){return{description:n.description??"",tags:n.tags??[],status:n.status??"",name:n.name??"",owner:n.owner??"",extends:n.extends??"",trigger_phrases:n.trigger_phrases??[],key:n.key??"",key_type:n.key_type??"",doc_type:n.doc_type??"",related_to:n.related_to??""}}class Bs extends k{constructor(){super(...arguments),this._viewMode=localStorage.getItem(at)??"markdown",this._editing=!1,this._draft=null,this._addingFrontmatter=!1,this._renaming=!1,this._renameValue="",this._viewingAttachment=null}static{this.properties={selected:{attribute:!1},onChanged:{attribute:!1},facets:{attribute:!1},onTagClick:{attribute:!1},onFolderClick:{attribute:!1},onDateClick:{attribute:!1},onKeyClick:{attribute:!1},_doc:{state:!0},_viewMode:{state:!0},_editing:{state:!0},_draft:{state:!0},_addingFrontmatter:{state:!0},_renaming:{state:!0},_renameValue:{state:!0},_viewingAttachment:{state:!0}}}static{this.styles=A`
629
631
  :host { display: block; padding: 16px; }
630
632
  h2 { margin: 0 0 4px; font-size: 16px; }
631
633
  .title-row {
@@ -642,6 +644,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
642
644
  text-align: left;
643
645
  }
644
646
  .title-link:hover { opacity: 0.8; }
647
+ .key-subtitle { display: block; font-size: 12px; opacity: 0.65; margin-top: 2px; font-weight: 400; }
645
648
  .key-link {
646
649
  background: none; border: none; padding: 0; margin: 0; font: inherit;
647
650
  color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
@@ -723,6 +726,32 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
723
726
  opacity: 0.55;
724
727
  font-weight: 600;
725
728
  }
729
+ .attachment-add {
730
+ position: relative;
731
+ display: inline-block;
732
+ margin-top: 6px;
733
+ font-weight: 500;
734
+ opacity: 0.85;
735
+ cursor: pointer;
736
+ }
737
+ .attachment-add:hover { opacity: 1; }
738
+ .attachment-add input[type='file'] {
739
+ position: absolute;
740
+ inset: 0;
741
+ opacity: 0;
742
+ cursor: pointer;
743
+ }
744
+ .attachment-remove {
745
+ opacity: 0.55;
746
+ background: none;
747
+ border: none;
748
+ cursor: pointer;
749
+ font-size: 13px;
750
+ line-height: 1;
751
+ padding: 0 0 0 4px;
752
+ color: inherit;
753
+ }
754
+ .attachment-remove:hover { opacity: 1; color: var(--danger); }
726
755
  .attachments-section ul {
727
756
  list-style: none;
728
757
  margin: 0;
@@ -731,13 +760,56 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
731
760
  flex-direction: column;
732
761
  gap: 4px;
733
762
  }
734
- .attachment-meta { opacity: 0.55; font-size: 11px; }
735
763
  .attachment-download {
736
764
  opacity: 0.55;
737
765
  text-decoration: none;
738
766
  margin-left: 2px;
739
767
  }
740
768
  .attachment-download:hover { opacity: 1; }
769
+ .attachment-view-header {
770
+ display: flex;
771
+ align-items: center;
772
+ gap: 10px;
773
+ margin-bottom: 8px;
774
+ }
775
+ .back-button {
776
+ font-size: 11px;
777
+ padding: 3px 8px;
778
+ border: 1px solid var(--border);
779
+ background: transparent;
780
+ color: inherit;
781
+ border-radius: 4px;
782
+ cursor: pointer;
783
+ }
784
+ .back-button:hover { background: var(--hover); }
785
+ .attachment-view-title {
786
+ font-size: 12px;
787
+ font-weight: 600;
788
+ flex: 1;
789
+ overflow: hidden;
790
+ text-overflow: ellipsis;
791
+ white-space: nowrap;
792
+ }
793
+ .attachment-view-download {
794
+ font-size: 11px;
795
+ text-decoration: none;
796
+ color: inherit;
797
+ opacity: 0.75;
798
+ }
799
+ .attachment-view-download:hover { opacity: 1; }
800
+ .attachment-frame {
801
+ width: 100%;
802
+ height: 65vh;
803
+ border: 1px solid var(--border);
804
+ border-radius: 6px;
805
+ background: var(--bg-subtle);
806
+ }
807
+ .attachment-image {
808
+ display: block;
809
+ max-width: 100%;
810
+ max-height: 65vh;
811
+ border-radius: 6px;
812
+ }
741
813
  .source-path {
742
814
  font-family: monospace;
743
815
  font-size: 11px;
@@ -912,48 +984,48 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
912
984
  color: inherit;
913
985
  }
914
986
  .hint { font-size: 11px; opacity: 0.6; }
915
- `}updated(e){e.has("selected")&&this.selected&&(this._editing=!1,this._addingFrontmatter=!1,this._renaming=!1,this.#e(),this.scrollTop=0)}async#e(){const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);this._doc=s.ok?await s.json():null,await this.updateComplete,this.shadowRoot?.querySelector(".markdown-body")?.scrollTo(0,0),this.shadowRoot?.querySelector("pre")?.scrollTo(0,0)}async refresh(){if(!this.selected||this._editing||this._addingFrontmatter||this._renaming)return;const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);if(!s.ok)return;const r=(this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre"))?.scrollTop??0;this._doc=await s.json(),await this.updateComplete;const o=this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre");o&&(o.scrollTop=r)}#t(){this._doc?.source_path&&navigator.clipboard?.writeText(this._doc.source_path)}#s(e){this._viewMode=e,localStorage.setItem(at,e)}async#r(){const{table:e,id:t}=this.selected,s=!this._doc?.deprecated;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/deprecated`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({deprecated:s})}),await this.#e(),this.onChanged?.()}async#n(){const{table:e,id:t}=this.selected,s=!this._doc?.paused;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/paused`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({paused:s})}),await this.#e(),this.onChanged?.()}async#d(){if(!window.confirm("Delete this doc? This can't be undone."))return;const{table:e,id:t}=this.selected;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"DELETE"}),this._doc=null,this.onChanged?.()}#a(){this._doc&&(this._draft=ct(this._doc),this._editing=!0,this._addingFrontmatter=!1)}#i(){this._doc&&(this._draft=ct(this._doc),this._addingFrontmatter=!0,this._editing=!1)}#l(e){this._draft&&(this._draft={...this._draft,doc_type:e},this._addingFrontmatter=!1,this._editing=!0)}#p(){this._editing=!1,this._addingFrontmatter=!1,this._draft=null}#h(e){this._draft&&(this._draft={...this._draft,...e})}#u(e){if(!this._draft)return;const t=this._draft.tags.includes(e)?this._draft.tags.filter(s=>s!==e):[...this._draft.tags,e];this.#h({tags:t})}#o(e){if(!this._draft)return;const t=this._draft.trigger_phrases.includes(e)?this._draft.trigger_phrases.filter(s=>s!==e):[...this._draft.trigger_phrases,e];this.#h({trigger_phrases:t})}async#g(){if(!this._draft||!this.selected)return;const{table:e,id:t}=this.selected,s=e==="skills",i={description:this._draft.description,tags:this._draft.tags,status:this._draft.status};s?(i.owner=this._draft.owner||null,i.extends=this._draft.extends||null,i.trigger_phrases=this._draft.trigger_phrases):(i.key=this._draft.key,i.key_type=this._draft.key_type,i.doc_type=this._draft.doc_type,i.related_to=this._draft.related_to||null);const r=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({frontmatter:i})});if(!r.ok){const o=await r.json().catch(()=>({}));window.alert(`Save failed: ${o.error??r.statusText}`);return}this._editing=!1,this._draft=null,await this.#e(),this.onChanged?.()}async#y(){if(!this.selected||!this._doc||this.selected.table!=="memory_docs")return;const{table:e,id:t}=this.selected;if(!window.confirm(`Delete frontmatter for "${this._doc.key}"?
987
+ `}updated(e){e.has("selected")&&this.selected&&(this._editing=!1,this._addingFrontmatter=!1,this._renaming=!1,this._viewingAttachment=null,this.#e(),this.scrollTop=0)}async#e(){const{table:e,id:t}=this.selected,i=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);this._doc=i.ok?await i.json():null,await this.updateComplete,this.shadowRoot?.querySelector(".markdown-body")?.scrollTo(0,0),this.shadowRoot?.querySelector("pre")?.scrollTo(0,0)}async refresh(){if(!this.selected||this._editing||this._addingFrontmatter||this._renaming)return;const{table:e,id:t}=this.selected,i=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);if(!i.ok)return;const r=(this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre"))?.scrollTop??0;this._doc=await i.json(),await this.updateComplete;const o=this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre");o&&(o.scrollTop=r)}#t(){this._doc?.source_path&&navigator.clipboard?.writeText(this._doc.source_path)}#i(e){this._viewMode=e,localStorage.setItem(at,e)}async#r(){const{table:e,id:t}=this.selected,i=!this._doc?.deprecated;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/deprecated`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({deprecated:i})}),await this.#e(),this.onChanged?.()}async#n(){const{table:e,id:t}=this.selected,i=!this._doc?.paused;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/paused`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({paused:i})}),await this.#e(),this.onChanged?.()}async#h(e){const{table:t,id:i}=this.selected,s=await e.arrayBuffer(),r=await fetch(`/api/entries/${t}/${encodeURIComponent(i)}/attachments?filename=${encodeURIComponent(e.name)}`,{method:"POST",headers:{"Content-Type":"application/octet-stream"},body:s});if(!r.ok){const{error:o}=await r.json().catch(()=>({error:`upload failed (${r.status})`}));window.alert(o);return}await this.#e(),this.onChanged?.()}#l(e){const t=e.currentTarget,i=t.files?.[0];t.value="",i&&this.#h(i)}async#s(e){if(!window.confirm(`Remove attachment "${e}"? This can't be undone.`))return;const{table:t,id:i}=this.selected;await fetch(`/api/entries/${t}/${encodeURIComponent(i)}/attachments/${encodeURIComponent(e)}`,{method:"DELETE"}),this._viewingAttachment?.filename===e&&(this._viewingAttachment=null),await this.#e(),this.onChanged?.()}async#c(){if(!window.confirm("Delete this doc? This can't be undone."))return;const{table:e,id:t}=this.selected;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"DELETE"}),this._doc=null,this.onChanged?.()}#f(){this._doc&&(this._draft=ct(this._doc),this._editing=!0,this._addingFrontmatter=!1)}#y(){this._doc&&(this._draft=ct(this._doc),this._addingFrontmatter=!0,this._editing=!1)}#p(e){this._draft&&(this._draft={...this._draft,doc_type:e},this._addingFrontmatter=!1,this._editing=!0)}#o(){this._editing=!1,this._addingFrontmatter=!1,this._draft=null}#a(e){this._draft&&(this._draft={...this._draft,...e})}#k(e){if(!this._draft)return;const t=this._draft.tags.includes(e)?this._draft.tags.filter(i=>i!==e):[...this._draft.tags,e];this.#a({tags:t})}#w(e){if(!this._draft)return;const t=this._draft.trigger_phrases.includes(e)?this._draft.trigger_phrases.filter(i=>i!==e):[...this._draft.trigger_phrases,e];this.#a({trigger_phrases:t})}async#m(){if(!this._draft||!this.selected)return;const{table:e,id:t}=this.selected,i=e==="skills",s={description:this._draft.description,tags:this._draft.tags,status:this._draft.status};i?(s.owner=this._draft.owner||null,s.extends=this._draft.extends||null,s.trigger_phrases=this._draft.trigger_phrases):(s.key=this._draft.key,s.key_type=this._draft.key_type,s.doc_type=this._draft.doc_type,s.related_to=this._draft.related_to||null);const r=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({frontmatter:s})});if(!r.ok){const o=await r.json().catch(()=>({}));window.alert(`Save failed: ${o.error??r.statusText}`);return}this._editing=!1,this._draft=null,await this.#e(),this.onChanged?.()}async#b(){if(!this.selected||!this._doc||this.selected.table!=="memory_docs")return;const{table:e,id:t}=this.selected;if(!window.confirm(`Delete frontmatter for "${this._doc.key}"?
916
988
 
917
- This removes the doc's key, tags, and status — it drops out of key-based lookup and full-text search, and becomes a plain unmanaged file, until frontmatter is added again.`))return;const i=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/frontmatter`,{method:"DELETE"});if(!i.ok){const r=await i.json().catch(()=>({}));window.alert(`Delete failed: ${r.error??i.statusText}`);return}this._doc=null,this.selected=null,this.onChanged?.()}#$(){this._doc&&(this._renameValue=this._doc.name??"",this._renaming=!0)}async#b(){if(!this._doc||!this._renameValue.trim())return;const e=this._renameValue.trim();if(e===this._doc.name){this._renaming=!1;return}const t=await fetch(`/api/entries/skills/${encodeURIComponent(this._doc.name)}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({new_name:e})});if(!t.ok){const s=await t.json().catch(()=>({}));window.alert(`Rename failed: ${s.error??t.statusText}`);return}this._renaming=!1,this.selected={table:"skills",id:e},await this.#e(),this.onChanged?.()}#m(){return c`
989
+ This removes the doc's key, tags, and status — it drops out of key-based lookup and full-text search, and becomes a plain unmanaged file, until frontmatter is added again.`))return;const s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/frontmatter`,{method:"DELETE"});if(!s.ok){const r=await s.json().catch(()=>({}));window.alert(`Delete failed: ${r.error??s.statusText}`);return}this._doc=null,this.selected=null,this.onChanged?.()}#v(){if(!this._doc||!this.selected)return;const e=this.selected.table==="skills";this._renameValue=e?this._doc.name??"":this._doc.source_path.split("/").pop()??"",this._renaming=!0}async#x(){if(!this._doc||!this.selected||!this._renameValue.trim())return;const e=this.selected.table==="skills",t=this._renameValue.trim(),i=e?this._doc.name:this._doc.source_path.split("/").pop();if(t===i){this._renaming=!1;return}const s=e?await fetch(`/api/entries/skills/${encodeURIComponent(this._doc.name)}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({new_name:t})}):await fetch(`/api/entries/memory_docs/${encodeURIComponent(this.selected.id)}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({new_filename:t})});if(!s.ok){const r=await s.json().catch(()=>({}));window.alert(`Rename failed: ${r.error??s.statusText}`);return}if(this._renaming=!1,e)this.selected={table:"skills",id:t};else{const r=await s.json();this.selected={table:"memory_docs",id:r.source_path}}await this.#e(),this.onChanged?.()}#u(){return l`
918
990
  <div class="edit-form">
919
991
  <div class="hint">What kind of doc is this? This shapes which fields apply next.</div>
920
992
  <div class="field">
921
993
  <label>doc_type <help-tooltip .text=${$.doc_type}></help-tooltip></label>
922
994
  <select
923
- @change=${e=>this.#l(e.target.value)}
995
+ @change=${e=>this.#p(e.target.value)}
924
996
  >
925
997
  <option value="" selected disabled>Choose…</option>
926
- ${lt.map(e=>c`<option value=${e}>${e}</option>`)}
998
+ ${lt.map(e=>l`<option value=${e}>${e}</option>`)}
927
999
  </select>
928
1000
  </div>
929
1001
  <div class="form-actions">
930
- <button class="cancel" @click=${()=>this.#p()}>Cancel</button>
1002
+ <button class="cancel" @click=${()=>this.#o()}>Cancel</button>
931
1003
  </div>
932
1004
  </div>
933
- `}#x(e){const t=this._draft,s=this.facets;return c`
1005
+ `}#_(e){const t=this._draft,i=this.facets;return l`
934
1006
  <div class="edit-form">
935
- ${e?c`
1007
+ ${e?l`
936
1008
  <div class="field">
937
1009
  <label>name <help-tooltip .text=${$.name}></help-tooltip></label>
938
1010
  <div class="hint">Renaming moves the skill's folder on disk — kept as a separate action.</div>
939
1011
  </div>
940
- `:c`
1012
+ `:l`
941
1013
  <div class="field-row">
942
1014
  <div class="field">
943
1015
  <label>key <help-tooltip .text=${$.key}></help-tooltip></label>
944
1016
  <input
945
1017
  type="text"
946
1018
  .value=${t.key}
947
- @input=${i=>this.#h({key:i.target.value})}
1019
+ @input=${s=>this.#a({key:s.target.value})}
948
1020
  />
949
1021
  </div>
950
1022
  <div class="field">
951
1023
  <label>key_type <help-tooltip .text=${$.key_type}></help-tooltip></label>
952
1024
  <select
953
1025
  .value=${t.key_type}
954
- @change=${i=>this.#h({key_type:i.target.value})}
1026
+ @change=${s=>this.#a({key_type:s.target.value})}
955
1027
  >
956
- ${Ni.map(i=>c`<option value=${i} ?selected=${i===t.key_type}>${i}</option>`)}
1028
+ ${js.map(s=>l`<option value=${s} ?selected=${s===t.key_type}>${s}</option>`)}
957
1029
  </select>
958
1030
  </div>
959
1031
  </div>
@@ -961,9 +1033,9 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
961
1033
  <label>doc_type <help-tooltip .text=${$.doc_type}></help-tooltip></label>
962
1034
  <select
963
1035
  .value=${t.doc_type}
964
- @change=${i=>this.#h({doc_type:i.target.value})}
1036
+ @change=${s=>this.#a({doc_type:s.target.value})}
965
1037
  >
966
- ${lt.map(i=>c`<option value=${i} ?selected=${i===t.doc_type}>${i}</option>`)}
1038
+ ${lt.map(s=>l`<option value=${s} ?selected=${s===t.doc_type}>${s}</option>`)}
967
1039
  </select>
968
1040
  </div>
969
1041
  `}
@@ -971,34 +1043,34 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
971
1043
  <label>description <help-tooltip .text=${$.description}></help-tooltip></label>
972
1044
  <textarea
973
1045
  .value=${t.description}
974
- @input=${i=>this.#h({description:i.target.value})}
1046
+ @input=${s=>this.#a({description:s.target.value})}
975
1047
  ></textarea>
976
1048
  </div>
977
1049
  <div class="field">
978
1050
  <label>tags <help-tooltip .text=${$.tags}></help-tooltip></label>
979
1051
  <tag-multiselect
980
- .tags=${s?.tags??[]}
1052
+ .tags=${i?.tags??[]}
981
1053
  .active=${t.tags}
982
1054
  .allowCreate=${!0}
983
- .onToggle=${i=>this.#u(i)}
1055
+ .onToggle=${s=>this.#k(s)}
984
1056
  ></tag-multiselect>
985
1057
  </div>
986
1058
  <div class="field">
987
1059
  <label>status <help-tooltip .text=${$.status}></help-tooltip></label>
988
1060
  <status-select
989
- .options=${[...new Set([...e?Fi:Mi,...s?.statuses??[]])]}
1061
+ .options=${[...new Set([...e?Us:qs,...i?.statuses??[]])]}
990
1062
  .value=${t.status}
991
- .onChange=${i=>this.#h({status:i})}
1063
+ .onChange=${s=>this.#a({status:s})}
992
1064
  ></status-select>
993
1065
  </div>
994
- ${e?c`
1066
+ ${e?l`
995
1067
  <div class="field-row">
996
1068
  <div class="field">
997
1069
  <label>owner <help-tooltip .text=${$.owner}></help-tooltip></label>
998
1070
  <input
999
1071
  type="text"
1000
1072
  .value=${t.owner}
1001
- @input=${i=>this.#h({owner:i.target.value})}
1073
+ @input=${s=>this.#a({owner:s.target.value})}
1002
1074
  />
1003
1075
  </div>
1004
1076
  <div class="field">
@@ -1006,7 +1078,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1006
1078
  <input
1007
1079
  type="text"
1008
1080
  .value=${t.extends}
1009
- @input=${i=>this.#h({extends:i.target.value})}
1081
+ @input=${s=>this.#a({extends:s.target.value})}
1010
1082
  />
1011
1083
  </div>
1012
1084
  </div>
@@ -1016,62 +1088,63 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1016
1088
  .tags=${[]}
1017
1089
  .active=${t.trigger_phrases}
1018
1090
  .allowCreate=${!0}
1019
- .onToggle=${i=>this.#o(i)}
1091
+ .onToggle=${s=>this.#w(s)}
1020
1092
  ></tag-multiselect>
1021
1093
  </div>
1022
- `:c`
1094
+ `:l`
1023
1095
  <div class="field">
1024
1096
  <label>related_to <help-tooltip .text=${$.related_to}></help-tooltip></label>
1025
1097
  <input
1026
1098
  type="text"
1027
1099
  .value=${t.related_to}
1028
- @input=${i=>this.#h({related_to:i.target.value})}
1100
+ @input=${s=>this.#a({related_to:s.target.value})}
1029
1101
  />
1030
1102
  </div>
1031
1103
  `}
1032
1104
  <div class="form-actions">
1033
- <button class="save" @click=${()=>this.#g()}>Save</button>
1034
- <button class="cancel" @click=${()=>this.#p()}>Cancel</button>
1105
+ <button class="save" @click=${()=>this.#m()}>Save</button>
1106
+ <button class="cancel" @click=${()=>this.#o()}>Cancel</button>
1035
1107
  </div>
1036
1108
  </div>
1037
- `}#v(e,t){const s=t?void 0:e.key;return c`
1109
+ `}#$(e,t){const i=t?void 0:e.key,s=t?e.name??e.id:e.source_path?e.source_path.split("/").pop():e.id;return l`
1038
1110
  <div class="title-row">
1039
- <h2>
1040
- ${s?c`<button class="title-link" title="Search for key '${s}'" @click=${()=>this.onKeyClick?.(s)}>
1041
- ${e.name??s??e.id}
1042
- </button>`:e.name??e.key??e.id}
1043
- </h2>
1111
+ <div>
1112
+ <h2>${s}</h2>
1113
+ ${i?l`<button class="title-link key-subtitle" title="Search for key '${i}'" @click=${()=>this.onKeyClick?.(i)}>
1114
+ 🔑 ${i}
1115
+ </button>`:""}
1116
+ </div>
1044
1117
  <button class="pill folder-pill" title="Filter by folder '${e.folder}'" @click=${()=>this.onFolderClick?.(e.folder)}>
1045
1118
  📁 ${e.folder}
1046
1119
  </button>
1047
1120
  </div>
1048
- `}#f(e,t){const s=e.created_at?Di(e.created_at):null;return c`
1121
+ `}#g(e,t){const i=e.created_at?Ns(e.created_at):null;return l`
1049
1122
  <dl class="info-grid">
1050
1123
  <dt>Description</dt>
1051
1124
  <dd class="description">${e.description||"—"}</dd>
1052
1125
 
1053
1126
  <dt>Tags</dt>
1054
1127
  <dd>
1055
- ${e.tags?.length?e.tags.map(i=>c`<button class="pill tag-pill" @click=${()=>this.onTagClick?.(i)}>${i}</button>`):c`<span class="hint">no tags</span>`}
1128
+ ${e.tags?.length?e.tags.map(s=>l`<button class="pill tag-pill" @click=${()=>this.onTagClick?.(s)}>${s}</button>`):l`<span class="hint">no tags</span>`}
1056
1129
  </dd>
1057
1130
 
1058
1131
  <dt>Status</dt>
1059
1132
  <dd>${e.status}</dd>
1060
1133
 
1061
- ${e.deprecated||e.paused?c`
1134
+ ${e.deprecated||e.paused?l`
1062
1135
  <dt>Flags</dt>
1063
1136
  <dd>
1064
- ${e.deprecated?c`<span class="pill warn-pill">deprecated</span>`:m}
1065
- ${e.paused?c`<span class="pill muted-pill">paused</span>`:m}
1137
+ ${e.deprecated?l`<span class="pill warn-pill">deprecated</span>`:m}
1138
+ ${e.paused?l`<span class="pill muted-pill">paused</span>`:m}
1066
1139
  </dd>
1067
1140
  `:m}
1068
1141
 
1069
- ${t?c`
1070
- ${e.owner?c`<dt>Owner</dt>
1142
+ ${t?l`
1143
+ ${e.owner?l`<dt>Owner</dt>
1071
1144
  <dd>${e.owner}</dd>`:m}
1072
- ${e.extends?c`<dt>Extends</dt>
1145
+ ${e.extends?l`<dt>Extends</dt>
1073
1146
  <dd>${e.extends}</dd>`:m}
1074
- `:c`
1147
+ `:l`
1075
1148
  <dt>Key</dt>
1076
1149
  <dd>
1077
1150
  <button class="key-link" title="Search for this key" @click=${()=>e.key&&this.onKeyClick?.(e.key)}>
@@ -1085,82 +1158,101 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1085
1158
  <dt>Doc type</dt>
1086
1159
  <dd>${e.doc_type}</dd>
1087
1160
 
1088
- ${e.related_to?c`<dt>Related to</dt>
1161
+ ${e.related_to?l`<dt>Related to</dt>
1089
1162
  <dd>${e.related_to}</dd>`:m}
1090
1163
  `}
1091
1164
 
1092
1165
  <dt>Created</dt>
1093
1166
  <dd>
1094
- ${s?c`<span class="date-value" title="Filter to this day" @click=${()=>this.onDateClick?.(s)}
1095
- >${s}</span
1096
- >`:c`<span class="hint">unknown</span>`}
1167
+ ${i?l`<span class="date-value" title="Filter to this day" @click=${()=>this.onDateClick?.(i)}
1168
+ >${i}</span
1169
+ >`:l`<span class="hint">unknown</span>`}
1097
1170
  </dd>
1098
1171
  </dl>
1099
- `}#w(e,t){const s=new v.Renderer,i=s.link.bind(s);return s.link=r=>{if(typeof r.href=="string"&&r.href.startsWith("attachment://")){const o=r.href.slice(13);return i({...r,href:`/api/entries/${e}/${encodeURIComponent(t)}/attachments/${encodeURIComponent(o)}`})}return i(r)},s}#_(e,t){return e.attachments?.length?c`
1172
+ `}#T(e,t){const i=new v.Renderer,s=i.link.bind(i);return i.link=r=>{if(typeof r.href=="string"&&r.href.startsWith("attachment://")){const o=r.href.slice(13);return s({...r,href:`/api/entries/${e}/${encodeURIComponent(t)}/attachments/${encodeURIComponent(o)}`})}return s(r)},i}#E(e,t){return l`
1100
1173
  <div class="attachments-section">
1101
1174
  <h4>Attachments</h4>
1102
- <ul>
1103
- ${e.attachments.map(s=>c`
1104
- <li>
1105
- <a href="/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(s.filename)}/view" target="_blank" rel="noopener"
1106
- >${s.filename}</a
1107
- >
1108
- <span class="attachment-meta">(${s.mime_type}, ${s.size} bytes)</span>
1109
- <a
1110
- class="attachment-download"
1111
- href="/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(s.filename)}"
1112
- title="Download"
1113
- >⇩</a
1114
- >
1115
- </li>
1116
- `)}
1117
- </ul>
1175
+ ${e.attachments?.length?l`
1176
+ <ul>
1177
+ ${e.attachments.map(i=>l`
1178
+ <li>
1179
+ <a
1180
+ href="/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(i.filename)}/view"
1181
+ target="_blank"
1182
+ rel="noopener"
1183
+ @click=${s=>{s.button!==0||s.metaKey||s.ctrlKey||s.shiftKey||s.altKey||(s.preventDefault(),this._viewingAttachment=i)}}
1184
+ >${i.filename}</a
1185
+ >
1186
+ <a
1187
+ class="attachment-download"
1188
+ href="/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(i.filename)}"
1189
+ title="Download"
1190
+ >⇩</a
1191
+ >
1192
+ <button class="attachment-remove" title="Remove" @click=${()=>this.#s(i.filename)}>×</button>
1193
+ </li>
1194
+ `)}
1195
+ </ul>
1196
+ `:m}
1197
+ <label class="attachment-add">
1198
+ + Add
1199
+ <input type="file" @change=${i=>this.#l(i)} />
1200
+ </label>
1118
1201
  </div>
1119
- `:m}render(){if(!this.selected)return c`<div class="empty">Select an entry to view its details.</div>`;if(!this._doc)return m;const e=this._doc,t=this.selected.table==="skills",s=t&&e.folder==="builtin",i=!t&&e.has_frontmatter===!1;return this._addingFrontmatter?c`${this.#v(e,t)}${this.#m()}`:this._editing&&this._draft?c`${this.#v(e,t)}${this.#x(t)}`:c`
1120
- ${this.#v(e,t)}
1121
- ${i?c`<div class="bare-notice">No frontmatter this is a plain, unmanaged file.</div>`:this.#f(e,t)}
1122
- ${s?m:c`
1202
+ `}#S(e,t,i){const s=document.documentElement.getAttribute("data-theme"),r=s==="light"||s==="dark"?`?theme=${s}`:"",o=`/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(i.filename)}/view${r}`,a=`/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(i.filename)}`;return l`
1203
+ <div class="attachment-view-header">
1204
+ <button class="back-button" title="Back to ${e.name??e.key??e.id}" @click=${()=>this._viewingAttachment=null}>
1205
+ ← Back
1206
+ </button>
1207
+ <span class="attachment-view-title" title=${i.filename}>${i.filename}</span>
1208
+ <a class="attachment-view-download" href=${a} title="Download ${i.filename}">⇩ Download</a>
1209
+ </div>
1210
+ ${Ms(i.filename)?l`<img class="attachment-image" src=${o} alt=${i.filename} />`:l`<iframe class="attachment-frame" src=${o} title=${i.filename}></iframe>`}
1211
+ `}render(){if(!this.selected)return l`<div class="empty">Select an entry to view its details.</div>`;if(!this._doc)return m;const e=this._doc,t=this.selected.table==="skills",i=t&&e.folder==="builtin",s=!t&&e.has_frontmatter===!1;return this._addingFrontmatter?l`${this.#$(e,t)}${this.#u()}`:this._editing&&this._draft?l`${this.#$(e,t)}${this.#_(t)}`:this._viewingAttachment?l`${this.#$(e,t)}${this.#S(e,this.selected.table,this._viewingAttachment)}`:l`
1212
+ ${this.#$(e,t)}
1213
+ ${s?l`<div class="bare-notice">No frontmatter — this is a plain, unmanaged file.</div>`:this.#g(e,t)}
1214
+ ${i?m:l`
1123
1215
  <div class="actions">
1124
- ${i?c`<button class="primary" @click=${()=>this.#i()}>Add frontmatter</button>`:c`
1125
- <button @click=${()=>this.#a()}>Edit</button>
1126
- ${t?c`<button @click=${()=>this.#$()}>Rename</button>`:m}
1216
+ ${s?l`<button class="primary" @click=${()=>this.#y()}>Add frontmatter</button>`:l`
1217
+ <button @click=${()=>this.#f()}>Edit</button>
1218
+ <button @click=${()=>this.#v()}>Rename</button>
1127
1219
  <button @click=${()=>this.#r()}>${e.deprecated?"Un-deprecate":"Mark deprecated"}</button>
1128
1220
  <button @click=${()=>this.#n()}>${e.paused?"Resume":"Pause"}</button>
1129
- ${t?m:c`<button class="danger" @click=${()=>this.#y()}>Delete frontmatter</button>`}
1221
+ ${t?m:l`<button class="danger" @click=${()=>this.#b()}>Delete frontmatter</button>`}
1130
1222
  `}
1131
- <button class="danger" @click=${()=>this.#d()}>Delete</button>
1223
+ <button class="danger" @click=${()=>this.#c()}>Delete</button>
1132
1224
  </div>
1133
- ${this._renaming?c`
1225
+ ${this._renaming?l`
1134
1226
  <div class="rename-row">
1135
1227
  <input
1136
1228
  type="text"
1137
1229
  .value=${this._renameValue}
1138
1230
  @input=${r=>this._renameValue=r.target.value}
1139
- @keydown=${r=>r.key==="Enter"&&this.#b()}
1231
+ @keydown=${r=>r.key==="Enter"&&this.#x()}
1140
1232
  />
1141
- <button @click=${()=>this.#b()}>Save</button>
1233
+ <button @click=${()=>this.#x()}>Save</button>
1142
1234
  <button @click=${()=>this._renaming=!1}>Cancel</button>
1143
1235
  </div>
1144
1236
  `:m}
1145
1237
  `}
1146
- ${this.#_(e,this.selected.table)}
1238
+ ${this.#E(e,this.selected.table)}
1147
1239
  <div class="view-toggle">
1148
1240
  <button
1149
1241
  class=${this._viewMode==="markdown"?"active":""}
1150
- @click=${()=>this.#s("markdown")}
1242
+ @click=${()=>this.#i("markdown")}
1151
1243
  >
1152
1244
  Preview
1153
1245
  </button>
1154
1246
  <button
1155
1247
  class=${this._viewMode==="raw"?"active":""}
1156
- @click=${()=>this.#s("raw")}
1248
+ @click=${()=>this.#i("raw")}
1157
1249
  >
1158
1250
  Raw
1159
1251
  </button>
1160
1252
  </div>
1161
- ${this._viewMode==="markdown"?c`<div class="markdown-body">${Ei(v.parse(e.body??"",{async:!1,renderer:this.#w(this.selected.table,e.id)}))}</div>`:c`<pre>${e.raw_file??e.body}</pre>`}
1253
+ ${this._viewMode==="markdown"?l`<div class="markdown-body">${Rs(v.parse(e.body??"",{async:!1,renderer:this.#T(this.selected.table,e.id)}))}</div>`:l`<pre>${e.raw_file??e.body}</pre>`}
1162
1254
  <div class="source-path" title="click to copy" @click=${()=>this.#t()}>${e.source_path}</div>
1163
- `}}customElements.define("detail-panel",qi);const oe="membkt";let ue;function Z(){return ue||(ue=fetch("/api/config").then(n=>n.json()).catch(()=>({folderfooMode:"off",folderfooHost:null}))),ue}class Ui extends k{static{this.properties={defaultKind:{attribute:!1},lockKind:{attribute:!1},onAdded:{attribute:!1},onCancel:{attribute:!1}}}#e=new u("skill");#t=new u("local");#s=new u("");#r=new u([]);#n=new u(null);#d=new u("");#a=new u("");#i=new u("");#l=new u(!1);#p=new u(!1);#h=new u(!1);#u=new u("");#o=new u("");#g=new u(!1);#y=new u("");#$=new u(!1);#b=new u("");#m=new u(!1);#x=new u(!1);#v=new u([]);#f=new u("");#w=new u(!1);#_;static{this.styles=T`
1255
+ `}}customElements.define("detail-panel",Bs);const oe="membkt";let ue;function W(){return ue||(ue=fetch("/api/config").then(n=>n.json()).catch(()=>({folderfooMode:"off",folderfooHost:null}))),ue}class Hs extends k{static{this.properties={defaultKind:{attribute:!1},lockKind:{attribute:!1},onAdded:{attribute:!1},onCancel:{attribute:!1}}}#e=new u("skill");#t=new u("local");#i=new u("");#r=new u([]);#n=new u(null);#h=new u("");#l=new u("");#s=new u("");#c=new u(!1);#f=new u(!1);#y=new u(!1);#p=new u("");#o=new u("");#a=new u(!1);#k=new u("");#w=new u(!1);#m=new u("");#b=new u(!1);#v=new u(!1);#x=new u([]);#u=new u("");#_=new u(!1);#$;static{this.styles=A`
1164
1256
  :host { display: block; }
1165
1257
  .backdrop {
1166
1258
  position: fixed; inset: 0; background: var(--overlay);
@@ -1263,106 +1355,106 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1263
1355
  .ff-folder-entry.selected { background: var(--accent); color: var(--accent-fg); }
1264
1356
  .ff-empty { padding: 12px; opacity: 0.6; font-size: 13px; }
1265
1357
  .ff-widget-slot { display: flex; }
1266
- `}constructor(){super(),new Y(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#e.set(this.defaultKind),this.#k()}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this.#_)}async#k(e){const t=new URLSearchParams;e&&t.set("path",e),this.#p.value&&t.set("hidden","1");const s=await fetch(`/api/fs/list?${t.toString()}`);if(!s.ok){this.#i.set((await s.json()).error??"failed to list directory");return}const i=await s.json();this.#s.set(i.path),this.#n.set(i.parent),this.#r.set(i.entries),this.#i.set(""),this.renderRoot.querySelector(".browser")?.scrollTo(0,0)}#R(){this.#p.set(!this.#p.value),this.#k(this.#s.value)}#P(){this.#u.set(""),this.#h.set(!0)}#C(){this.#h.set(!1),this.#u.set("")}async#A(){const e=this.#u.value.trim();if(e){this.#i.set("");try{const t=await fetch("/api/fs/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:this.#s.value,name:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to create folder");return}this.#h.set(!1),this.#u.set(""),await this.#k(this.#s.value)}catch(t){this.#i.set(t.message)}}}#E(){this.#d.set(this.#s.value),this.#a.value||this.#a.set(this.#s.value.split("/").filter(Boolean).pop()??"")}async#z(){const e=this.#d.value||this.#s.value;if(e){this.#l.set(!0),this.#i.set("");try{const t=await fetch("/api/folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#a.value||void 0,path:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to add folder");return}this.onAdded()}finally{this.#l.set(!1)}}}async#L(){if(this.#m.value)return;const{folderfooMode:e,folderfooHost:t}=await Z();if(e==="off"||!t)return;let s=null;try{s=localStorage.getItem("folderfoo_token")}catch{}s&&(this.#o.set(t),this.#b.set(oe),this.#$.set(!0),this.#D(s))}async#I(){if(!this.#o.value){this.#i.set("enter a server URL first");return}this.#i.set("");try{await $t(()=>import(`${this.#o.value}/elements/folderfoo-profile-circle.js`),[]),this.#g.set(!0),this.#y.set(""),await this.updateComplete;const e=this.renderRoot.querySelector(".ff-widget-slot");if(e&&!e.querySelector("folderfoo-profile-circle")){const t=document.createElement("folderfoo-profile-circle");t.setAttribute("app-name","Memory Bucket"),e.appendChild(t)}this.#_=setInterval(()=>this.#O(),800),this.#O()}catch(e){this.#y.set(e.message)}}#O(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{}!e||this.#m.value||(clearInterval(this.#_),this.#D(e))}async#D(e){this.#x.set(!0),this.#i.set("");try{const t=await fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:this.#o.value,token:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to persist folderfoo session");return}this.#m.set(!0),this.#b.set(oe),await this.#N()}finally{this.#x.set(!1)}}async#N(){this.#w.set(!0),this.#i.set("");try{const e=new URLSearchParams({server:this.#o.value,tenantId:this.#b.value}),t=await fetch(`/api/folderfoo/folders?${e.toString()}`),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to list folderfoo folders");return}this.#v.set(s)}finally{this.#w.set(!1)}}#q(e){this.#f.set(e),this.#a.value||this.#a.set(e.split("/").filter(Boolean).pop()??this.#b.value)}async#U(){if(this.#f.value){this.#l.set(!0),this.#i.set("");try{const e=await fetch("/api/remote-folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#a.value||void 0,server:this.#o.value,tenantId:this.#b.value,folderPath:this.#f.value})}),t=await e.json();if(!e.ok){this.#i.set(t.error??"failed to connect folder");return}this.onAdded()}finally{this.#l.set(!1)}}}#j(){const e=this.#r.value;return c`
1358
+ `}constructor(){super(),new Y(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#e.set(this.defaultKind),this.#g()}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this.#$)}async#g(e){const t=new URLSearchParams;e&&t.set("path",e),this.#f.value&&t.set("hidden","1");const i=await fetch(`/api/fs/list?${t.toString()}`);if(!i.ok){this.#s.set((await i.json()).error??"failed to list directory");return}const s=await i.json();this.#i.set(s.path),this.#n.set(s.parent),this.#r.set(s.entries),this.#s.set(""),this.renderRoot.querySelector(".browser")?.scrollTo(0,0)}#T(){this.#f.set(!this.#f.value),this.#g(this.#i.value)}#E(){this.#p.set(""),this.#y.set(!0)}#S(){this.#y.set(!1),this.#p.set("")}async#R(){const e=this.#p.value.trim();if(e){this.#s.set("");try{const t=await fetch("/api/fs/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:this.#i.value,name:e})}),i=await t.json();if(!t.ok){this.#s.set(i.error??"failed to create folder");return}this.#y.set(!1),this.#p.set(""),await this.#g(this.#i.value)}catch(t){this.#s.set(t.message)}}}#P(){this.#h.set(this.#i.value),this.#l.value||this.#l.set(this.#i.value.split("/").filter(Boolean).pop()??"")}async#z(){const e=this.#h.value||this.#i.value;if(e){this.#c.set(!0),this.#s.set("");try{const t=await fetch("/api/folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#l.value||void 0,path:e})}),i=await t.json();if(!t.ok){this.#s.set(i.error??"failed to add folder");return}this.onAdded()}finally{this.#c.set(!1)}}}async#L(){if(this.#b.value)return;const{folderfooMode:e,folderfooHost:t}=await W();if(e==="off"||!t)return;let i=null;try{i=localStorage.getItem("folderfoo_token")}catch{}i&&(this.#o.set(t),this.#m.set(oe),this.#w.set(!0),this.#D(i))}async#I(){if(!this.#o.value){this.#s.set("enter a server URL first");return}this.#s.set("");try{await wt(()=>import(`${this.#o.value}/elements/folderfoo-profile-circle.js`),[]),this.#a.set(!0),this.#k.set(""),await this.updateComplete;const e=this.renderRoot.querySelector(".ff-widget-slot");if(e&&!e.querySelector("folderfoo-profile-circle")){const t=document.createElement("folderfoo-profile-circle");t.setAttribute("app-name","Memory Bucket"),e.appendChild(t)}this.#$=setInterval(()=>this.#O(),800),this.#O()}catch(e){this.#k.set(e.message)}}#O(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{}!e||this.#b.value||(clearInterval(this.#$),this.#D(e))}async#D(e){this.#v.set(!0),this.#s.set("");try{const t=await fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:this.#o.value,token:e})}),i=await t.json();if(!t.ok){this.#s.set(i.error??"failed to persist folderfoo session");return}this.#b.set(!0),this.#m.set(oe),await this.#M()}finally{this.#v.set(!1)}}async#M(){this.#_.set(!0),this.#s.set("");try{const e=new URLSearchParams({server:this.#o.value,tenantId:this.#m.value}),t=await fetch(`/api/folderfoo/folders?${e.toString()}`),i=await t.json();if(!t.ok){this.#s.set(i.error??"failed to list folderfoo folders");return}this.#x.set(i)}finally{this.#_.set(!1)}}#N(e){this.#u.set(e),this.#l.value||this.#l.set(e.split("/").filter(Boolean).pop()??this.#m.value)}async#U(){if(this.#u.value){this.#c.set(!0),this.#s.set("");try{const e=await fetch("/api/remote-folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#l.value||void 0,server:this.#o.value,tenantId:this.#m.value,folderPath:this.#u.value})}),t=await e.json();if(!e.ok){this.#s.set(t.error??"failed to connect folder");return}this.onAdded()}finally{this.#c.set(!1)}}}#q(){const e=this.#r.value;return l`
1267
1359
  <div class="breadcrumb-row">
1268
- <div class="breadcrumb">${this.#s.value}</div>
1269
- <button class="new-folder-btn" @click=${()=>this.#P()}>+ New folder</button>
1360
+ <div class="breadcrumb">${this.#i.value}</div>
1361
+ <button class="new-folder-btn" @click=${()=>this.#E()}>+ New folder</button>
1270
1362
  <label class="hidden-toggle">
1271
- <input type="checkbox" .checked=${this.#p.value} @change=${()=>this.#R()} />
1363
+ <input type="checkbox" .checked=${this.#f.value} @change=${()=>this.#T()} />
1272
1364
  Show hidden
1273
1365
  </label>
1274
1366
  </div>
1275
- ${this.#h.value?c`
1367
+ ${this.#y.value?l`
1276
1368
  <div class="new-folder-row">
1277
1369
  <input
1278
1370
  type="text"
1279
1371
  placeholder="Folder name"
1280
- .value=${this.#u.value}
1281
- @input=${t=>this.#u.set(t.target.value)}
1282
- @keydown=${t=>{t.key==="Enter"&&this.#A(),t.key==="Escape"&&this.#C()}}
1372
+ .value=${this.#p.value}
1373
+ @input=${t=>this.#p.set(t.target.value)}
1374
+ @keydown=${t=>{t.key==="Enter"&&this.#R(),t.key==="Escape"&&this.#S()}}
1283
1375
  />
1284
- <button @click=${()=>this.#A()}>Create</button>
1285
- <button @click=${()=>this.#C()}>Cancel</button>
1376
+ <button @click=${()=>this.#R()}>Create</button>
1377
+ <button @click=${()=>this.#S()}>Cancel</button>
1286
1378
  </div>
1287
1379
  `:""}
1288
1380
  <div class="browser">
1289
- ${this.#n.value?c`<div class="entry up" @click=${()=>this.#k(this.#n.value)}>
1381
+ ${this.#n.value?l`<div class="entry up" @click=${()=>this.#g(this.#n.value)}>
1290
1382
  <span class="icon">📁</span> ..
1291
1383
  </div>`:""}
1292
- ${e.length===0&&!this.#n.value?c`<div class="empty">No subdirectories here.</div>`:e.map(t=>c`<div class="entry" @click=${()=>this.#k(t.path)}>
1384
+ ${e.length===0&&!this.#n.value?l`<div class="empty">No subdirectories here.</div>`:e.map(t=>l`<div class="entry" @click=${()=>this.#g(t.path)}>
1293
1385
  <span class="icon">📁</span> ${t.name}
1294
1386
  </div>`)}
1295
1387
  </div>
1296
1388
  <div class="footer">
1297
- <button class="secondary" @click=${()=>this.#E()}>
1389
+ <button class="secondary" @click=${()=>this.#P()}>
1298
1390
  Select this folder
1299
1391
  </button>
1300
- ${this.#d.value?c`<div class="selected-row">Selected: <span class="path">${this.#d.value}</span></div>`:""}
1392
+ ${this.#h.value?l`<div class="selected-row">Selected: <span class="path">${this.#h.value}</span></div>`:""}
1301
1393
  <div>
1302
1394
  <label>Folder name</label>
1303
1395
  <input
1304
1396
  type="text"
1305
- .value=${this.#a.value}
1397
+ .value=${this.#l.value}
1306
1398
  placeholder="e.g. personal, company"
1307
- @input=${t=>this.#a.set(t.target.value)}
1399
+ @input=${t=>this.#l.set(t.target.value)}
1308
1400
  />
1309
1401
  </div>
1310
- ${this.#i.value?c`<div class="error">${this.#i.value}</div>`:""}
1402
+ ${this.#s.value?l`<div class="error">${this.#s.value}</div>`:""}
1311
1403
  <div class="actions">
1312
1404
  <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
1313
1405
  <button
1314
1406
  class="primary"
1315
- ?disabled=${!this.#d.value||this.#l.value}
1407
+ ?disabled=${!this.#h.value||this.#c.value}
1316
1408
  @click=${()=>this.#z()}
1317
1409
  >
1318
- ${this.#l.value?"Adding…":"Add folder"}
1410
+ ${this.#c.value?"Adding…":"Add folder"}
1319
1411
  </button>
1320
1412
  </div>
1321
1413
  </div>
1322
- `}#B(){const e=this.#v.value;return this.#$.value&&!this.#m.value?c`
1414
+ `}#j(){const e=this.#x.value;return this.#w.value&&!this.#b.value?l`
1323
1415
  <div class="ff-body">
1324
1416
  <div class="ff-connected-row"><span class="ff-connected-dot"></span> Already signed in to ${this.#o.value} — connecting…</div>
1325
- ${this.#i.value?c`<div class="error">${this.#i.value}</div>`:""}
1417
+ ${this.#s.value?l`<div class="error">${this.#s.value}</div>`:""}
1326
1418
  <div class="actions">
1327
1419
  <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
1328
1420
  </div>
1329
1421
  </div>
1330
- `:this.#m.value?c`
1422
+ `:this.#b.value?l`
1331
1423
  <div class="ff-body">
1332
1424
  <div class="ff-connected-row"><span class="ff-connected-dot"></span> Connected to ${this.#o.value}</div>
1333
- ${e.length>0?c`
1425
+ ${e.length>0?l`
1334
1426
  <div class="ff-folder-list">
1335
- ${e.map(t=>c`<div
1336
- class="ff-folder-entry ${this.#f.value===t.path?"selected":""}"
1337
- @click=${()=>this.#q(t.path)}
1427
+ ${e.map(t=>l`<div
1428
+ class="ff-folder-entry ${this.#u.value===t.path?"selected":""}"
1429
+ @click=${()=>this.#N(t.path)}
1338
1430
  >
1339
1431
  ${t.path}
1340
1432
  </div>`)}
1341
1433
  </div>
1342
- `:this.#w.value?c`<div class="ff-hint">Loading folders…</div>`:c`<div class="ff-empty">No folders found.</div>`}
1343
- ${this.#f.value?c`<div class="selected-row">Selected: <span class="path">${this.#f.value}</span></div>`:""}
1434
+ `:this.#_.value?l`<div class="ff-hint">Loading folders…</div>`:l`<div class="ff-empty">No folders found.</div>`}
1435
+ ${this.#u.value?l`<div class="selected-row">Selected: <span class="path">${this.#u.value}</span></div>`:""}
1344
1436
  <div>
1345
1437
  <label>Folder name</label>
1346
1438
  <input
1347
1439
  type="text"
1348
- .value=${this.#a.value}
1440
+ .value=${this.#l.value}
1349
1441
  placeholder="e.g. team-qa"
1350
- @input=${t=>this.#a.set(t.target.value)}
1442
+ @input=${t=>this.#l.set(t.target.value)}
1351
1443
  />
1352
1444
  </div>
1353
- ${this.#i.value?c`<div class="error">${this.#i.value}</div>`:""}
1445
+ ${this.#s.value?l`<div class="error">${this.#s.value}</div>`:""}
1354
1446
  <div class="actions">
1355
1447
  <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
1356
1448
  <button
1357
1449
  class="primary"
1358
- ?disabled=${!this.#f.value||this.#l.value}
1450
+ ?disabled=${!this.#u.value||this.#c.value}
1359
1451
  @click=${()=>this.#U()}
1360
1452
  >
1361
- ${this.#l.value?"Connecting…":"Connect folder"}
1453
+ ${this.#c.value?"Connecting…":"Connect folder"}
1362
1454
  </button>
1363
1455
  </div>
1364
1456
  </div>
1365
- `:c`
1457
+ `:l`
1366
1458
  <div class="ff-body">
1367
1459
  <div class="ff-hint">
1368
1460
  Sign in to a folderfoo server to mount one of your folders (or a folder shared with you) as a
@@ -1375,31 +1467,31 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1375
1467
  type="text"
1376
1468
  .value=${this.#o.value}
1377
1469
  placeholder="https://folderfoo.example.com"
1378
- ?disabled=${this.#g.value}
1470
+ ?disabled=${this.#a.value}
1379
1471
  @input=${t=>this.#o.set(t.target.value)}
1380
1472
  @keydown=${t=>t.key==="Enter"&&this.#I()}
1381
1473
  />
1382
1474
  </div>
1383
- ${this.#g.value?c`
1475
+ ${this.#a.value?l`
1384
1476
  <div class="ff-hint">Sign in below (this is folderfoo's own login widget, same one every folderfoo app uses):</div>
1385
1477
  <div class="ff-widget-slot"></div>
1386
- ${this.#x.value?c`<div class="ff-hint">Finishing connection…</div>`:""}
1387
- `:c`
1478
+ ${this.#v.value?l`<div class="ff-hint">Finishing connection…</div>`:""}
1479
+ `:l`
1388
1480
  <div class="actions" style="justify-content: flex-start; margin-top: 0;">
1389
1481
  <button class="secondary" @click=${()=>this.#I()}>Continue</button>
1390
1482
  </div>
1391
1483
  `}
1392
- ${this.#y.value?c`<div class="error">${this.#y.value}</div>`:""}
1393
- ${this.#i.value?c`<div class="error">${this.#i.value}</div>`:""}
1484
+ ${this.#k.value?l`<div class="error">${this.#k.value}</div>`:""}
1485
+ ${this.#s.value?l`<div class="error">${this.#s.value}</div>`:""}
1394
1486
  <div class="actions">
1395
1487
  <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
1396
1488
  </div>
1397
1489
  </div>
1398
- `}render(){return c`
1490
+ `}render(){return l`
1399
1491
  <div class="backdrop" @click=${e=>e.target===e.currentTarget&&this.onCancel()}>
1400
1492
  <div class="modal">
1401
1493
  <div class="header"><h2>Add a folder</h2></div>
1402
- ${this.lockKind?c``:c`
1494
+ ${this.lockKind?l``:l`
1403
1495
  <div class="kind-toggle">
1404
1496
  <button
1405
1497
  class=${this.#e.value==="skill"?"active":""}
@@ -1426,10 +1518,10 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1426
1518
  Connect folderfoo
1427
1519
  </button>
1428
1520
  </div>
1429
- ${this.#t.value==="local"?this.#j():this.#B()}
1521
+ ${this.#t.value==="local"?this.#q():this.#j()}
1430
1522
  </div>
1431
1523
  </div>
1432
- `}}customElements.define("add-folder-modal",Ui);function dt(n){const e=Date.now()-n,t=Math.floor(e/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;const s=Math.floor(t/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}class ji extends k{static{this.properties={channels:{attribute:!1},selected:{attribute:!1},detail:{attribute:!1},loading:{attribute:!1},onSelect:{attribute:!1},onRefresh:{attribute:!1}}}static{this.styles=T`
1524
+ `}}customElements.define("add-folder-modal",Hs);function dt(n){const e=Date.now()-n,t=Math.floor(e/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;const i=Math.floor(t/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}class Ks extends k{static{this.properties={channels:{attribute:!1},selected:{attribute:!1},detail:{attribute:!1},loading:{attribute:!1},onSelect:{attribute:!1},onRefresh:{attribute:!1}}}static{this.styles=A`
1433
1525
  :host { display: flex; flex: 1 1 auto; min-height: 0; }
1434
1526
  .nav {
1435
1527
  flex: 0 0 260px;
@@ -1488,7 +1580,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1488
1580
  opacity: 0.5; font-size: 13px; padding-top: 46px;
1489
1581
  }
1490
1582
  .placeholder-empty { opacity: 0.5; font-style: italic; }
1491
- `}#e(){return!this.channels||this.channels.length===0?c`<div class="empty">No live channels right now. Channels appear here once an agent posts to one with memory_channel_post — they're ephemeral and disappear after a long idle period or server restart.</div>`:[...this.channels].sort((t,s)=>s.lastActivityAt-t.lastActivityAt).map(t=>c`
1583
+ `}#e(){return!this.channels||this.channels.length===0?l`<div class="empty">No live channels right now. Channels appear here once an agent posts to one with memory_channel_post — they're ephemeral and disappear after a long idle period or server restart.</div>`:[...this.channels].sort((t,i)=>i.lastActivityAt-t.lastActivityAt).map(t=>l`
1492
1584
  <div
1493
1585
  class="channel-row ${this.selected===t.name?"active":""}"
1494
1586
  @click=${()=>this.onSelect(t.name)}
@@ -1496,15 +1588,15 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1496
1588
  <span class="channel-name">${t.name}</span>
1497
1589
  <span class="channel-meta">${dt(t.lastActivityAt)}</span>
1498
1590
  </div>
1499
- `)}#t(){return this.selected?this.loading?c`<div class="content-pane"><div class="content-meta">Loading…</div></div>`:this.detail?c`
1591
+ `)}#t(){return this.selected?this.loading?l`<div class="content-pane"><div class="content-meta">Loading…</div></div>`:this.detail?l`
1500
1592
  <div class="content-pane">
1501
1593
  <div class="content-header">
1502
1594
  <span class="content-title">${this.detail.name}</span>
1503
1595
  <span class="content-meta">last activity ${dt(this.detail.lastActivityAt)}</span>
1504
1596
  </div>
1505
- ${this.detail.content?c`<div class="content-body">${this.detail.content}</div>`:c`<div class="placeholder-empty">Channel exists but nothing has been posted yet.</div>`}
1597
+ ${this.detail.content?l`<div class="content-body">${this.detail.content}</div>`:l`<div class="placeholder-empty">Channel exists but nothing has been posted yet.</div>`}
1506
1598
  </div>
1507
- `:c`<div class="content-pane"><div class="content-meta">Channel not found — it may have gone idle and been swept.</div></div>`:c`<div class="no-selection">Select a channel to view its content.</div>`}render(){return c`
1599
+ `:l`<div class="content-pane"><div class="content-meta">Channel not found — it may have gone idle and been swept.</div></div>`:l`<div class="no-selection">Select a channel to view its content.</div>`}render(){return l`
1508
1600
  <div class="nav">
1509
1601
  <div class="nav-header">
1510
1602
  <span>Live channels</span>
@@ -1513,10 +1605,13 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1513
1605
  ${this.#e()}
1514
1606
  </div>
1515
1607
  ${this.#t()}
1516
- `}}customElements.define("channel-view",ji);function Bi(n){const e=new Map;for(const t of n){const s=t.tags.length>0?t.tags:[null];for(const i of s){const r=e.get(i);r?r.push(t):e.set(i,[t])}}return[...e.entries()].map(([t,s])=>({tag:t,items:s})).sort((t,s)=>t.tag===null?1:s.tag===null?-1:t.tag.localeCompare(s.tag))}function Hi(n,e){const t=new Map;for(const r of n){const o=t.get(r.folder);o?o.push(r):t.set(r.folder,[r])}const s=[],i=[];for(const r of e){const o=t.get(r.name);if(!o)continue;const a={folder:r,tagGroups:[{tag:null,items:o}]};(r.remote?i:s).push(a)}return{local:s,remote:i}}const jt="mem-bucket-folder-view-mode",Bt="mem-bucket-folder-view-expanded",ht="mem-bucket-folder-view-tree-split-pct",pt="mem-bucket-folder-view-list-split-pct",ut=12,ft=40,gt=20,bt=80;function mt(n,e,t,s){const i=Number(localStorage.getItem(n));return Number.isFinite(i)&&i>=t&&i<=s?i:e}const Ki=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],Vi=[{value:"a",label:"Folder tree"},{value:"b",label:"Breadcrumb drill-down"},{value:"c",label:"Tag → Name"}];function Zi(){const n=localStorage.getItem(jt);return n==="a"||n==="b"||n==="c"?n:"a"}function Wi(){try{const n=localStorage.getItem(Bt);if(!n)return new Set;const e=JSON.parse(n);return Array.isArray(e)?new Set(e.map(String)):new Set}catch{return new Set}}function vt(n){localStorage.setItem(Bt,JSON.stringify([...n]))}class Qi extends k{static{this.properties={entries:{attribute:!1},allFolders:{attribute:!1},facets:{attribute:!1},typeFilter:{attribute:!1},onTypeChange:{attribute:!1},onChanged:{attribute:!1},onDateClick:{attribute:!1},onKeyClick:{attribute:!1}}}#e=new u(Zi());#t=new u(Wi());#s=new u([]);#r=new u(null);#n=new u(null);#d=new u(mt(ht,20,ut,ft));#a=new u(mt(pt,40,gt,bt));#i=new u(null);#l=e=>this.#g(e);#p=()=>this.#y();static{this.styles=T`
1608
+ `}}customElements.define("channel-view",Ks);function Vs(n){const e=new Map;for(const t of n){const i=t.tags.length>0?t.tags:[null];for(const s of i){const r=e.get(s);r?r.push(t):e.set(s,[t])}}return[...e.entries()].map(([t,i])=>({tag:t,items:i})).sort((t,i)=>t.tag===null?1:i.tag===null?-1:t.tag.localeCompare(i.tag))}function Ws(n,e){const t=new Map;for(const r of n){const o=t.get(r.folder);o?o.push(r):t.set(r.folder,[r])}const i=[],s=[];for(const r of e){const o=t.get(r.name);if(!o)continue;const a={folder:r,tagGroups:[{tag:null,items:o}]};(r.remote?s:i).push(a)}return{local:i,remote:s}}const Bt="mem-bucket-folder-view-mode",Ht="mem-bucket-folder-view-expanded",ht="mem-bucket-folder-view-tree-split-pct",pt="mem-bucket-folder-view-list-split-pct",ut=12,ft=40,gt=20,bt=80;function mt(n,e,t,i){const s=Number(localStorage.getItem(n));return Number.isFinite(s)&&s>=t&&s<=i?s:e}const Zs=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],Gs=[{value:"a",label:"Folder tree"},{value:"b",label:"Breadcrumb drill-down"},{value:"c",label:"Tag → Name"}];function Qs(){const n=localStorage.getItem(Bt);return n==="a"||n==="b"||n==="c"?n:"a"}function Ys(){try{const n=localStorage.getItem(Ht);if(!n)return new Set;const e=JSON.parse(n);return Array.isArray(e)?new Set(e.map(String)):new Set}catch{return new Set}}function vt(n){localStorage.setItem(Ht,JSON.stringify([...n]))}class Js extends k{static{this.properties={entries:{attribute:!1},allFolders:{attribute:!1},facets:{attribute:!1},typeFilter:{attribute:!1},onTypeChange:{attribute:!1},onChanged:{attribute:!1},onDateClick:{attribute:!1},onKeyClick:{attribute:!1}}}#e=new u(Qs());#t=new u(Ys());#i=new u([]);#r=new u(null);#n=new u(null);#h=new u(mt(ht,20,ut,ft));#l=new u(mt(pt,40,gt,bt));#s=new u(null);#c=e=>this.#a(e);#f=()=>this.#k();static{this.styles=A`
1517
1609
  :host { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
1610
+ /* padding-right reserves room for mem-bucket-app's absolutely-positioned .header-toolbar
1611
+ overlay (rendered outside this element entirely - see its own comment), which lines up with
1612
+ this row's top-right corner via matching padding. */
1518
1613
  .mode-row {
1519
- display: flex; align-items: center; gap: 8px; padding: 10px 16px;
1614
+ display: flex; align-items: center; gap: 8px; padding: 10px 320px 10px 16px;
1520
1615
  border-bottom: 1px solid var(--border); background: var(--bg-subtle);
1521
1616
  }
1522
1617
  .mode-row .filter-label { font-size: 12px; opacity: 0.6; font-weight: 600; }
@@ -1589,120 +1684,119 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1589
1684
  border: none; background: none; color: inherit; width: 100%; text-align: left; box-sizing: border-box;
1590
1685
  }
1591
1686
  .folder-card:hover { background: var(--hover); }
1592
- `}constructor(){super(),new Y(this)}#h(e){this.#e.set(e),localStorage.setItem(jt,e),this.#t.set(new Set),vt(new Set),this.#s.set([]),this.#r.set(null),this.#n.set(null)}#u(e){this.#h(e.target.value)}#o(e,t){t.preventDefault(),this.#i.set(e),document.addEventListener("pointermove",this.#l),document.addEventListener("pointerup",this.#p)}#g(e){const t=this.#i.value;if(!t)return;const s=this.renderRoot.querySelector(".body-region");if(!s)return;const i=s.getBoundingClientRect(),r=(e.clientX-i.left)/i.width*100;if(t==="tree")this.#d.set(Math.min(ft,Math.max(ut,r)));else{const o=100-this.#d.value,a=o>0?(r-this.#d.value)/o*100:0;this.#a.set(Math.min(bt,Math.max(gt,a)))}}#y(){const e=this.#i.value;this.#i.set(null),document.removeEventListener("pointermove",this.#l),document.removeEventListener("pointerup",this.#p),e==="tree"?localStorage.setItem(ht,String(this.#d.value)):e==="list"&&localStorage.setItem(pt,String(this.#a.value))}#$(e){const t=new Set(this.#t.value);t.has(e)?t.delete(e):t.add(e),this.#t.set(t),vt(t)}#b(e,t){this.#r.set({folder:e,tag:t})}#m(e){this.#r.set(null),this.#n.set({table:e._table,id:e.id})}#x(e){this.#n.set({table:e._table,id:e.id})}#v(e,t){const s=this.#t.value.has(t),i=e.tagGroups.reduce((o,a)=>o+a.items.length,0),r=this.#r.value?.folder===e.folder.name&&this.#r.value?.tag===null;return c`
1593
- <button class="node ${e.folder.remote?"remote":""} ${r?"active":""}" @click=${()=>this.#$(t)}>
1594
- <span class="caret">${s?"▾":"▸"}</span>
1687
+ `}constructor(){super(),new Y(this)}#y(e){this.#e.set(e),localStorage.setItem(Bt,e),this.#t.set(new Set),vt(new Set),this.#i.set([]),this.#r.set(null),this.#n.set(null)}#p(e){this.#y(e.target.value)}#o(e,t){t.preventDefault(),this.#s.set(e),document.addEventListener("pointermove",this.#c),document.addEventListener("pointerup",this.#f)}#a(e){const t=this.#s.value;if(!t)return;const i=this.renderRoot.querySelector(".body-region");if(!i)return;const s=i.getBoundingClientRect(),r=(e.clientX-s.left)/s.width*100;if(t==="tree")this.#h.set(Math.min(ft,Math.max(ut,r)));else{const o=100-this.#h.value,a=o>0?(r-this.#h.value)/o*100:0;this.#l.set(Math.min(bt,Math.max(gt,a)))}}#k(){const e=this.#s.value;this.#s.set(null),document.removeEventListener("pointermove",this.#c),document.removeEventListener("pointerup",this.#f),e==="tree"?localStorage.setItem(ht,String(this.#h.value)):e==="list"&&localStorage.setItem(pt,String(this.#l.value))}#w(e){const t=new Set(this.#t.value);t.has(e)?t.delete(e):t.add(e),this.#t.set(t),vt(t)}#m(e,t){this.#r.set({folder:e,tag:t})}#b(e){this.#r.set(null),this.#n.set({table:e._table,id:e.id})}#v(e){this.#n.set({table:e._table,id:e.id})}#x(e,t){const i=this.#t.value.has(t),s=e.tagGroups.reduce((o,a)=>o+a.items.length,0),r=this.#r.value?.folder===e.folder.name&&this.#r.value?.tag===null;return l`
1688
+ <button class="node ${e.folder.remote?"remote":""} ${r?"active":""}" @click=${()=>this.#w(t)}>
1689
+ <span class="caret">${i?"▾":"▸"}</span>
1595
1690
  <span class="icon">${e.folder.remote?"☁":"📁"}</span>
1596
1691
  <span
1597
1692
  class="label"
1598
- @click=${o=>{o.stopPropagation(),this.#b(e.folder.name,null)}}
1693
+ @click=${o=>{o.stopPropagation(),this.#m(e.folder.name,null)}}
1599
1694
  >${e.folder.name}</span
1600
1695
  >
1601
- <span class="count">${i}</span>
1696
+ <span class="count">${s}</span>
1602
1697
  </button>
1603
- `}#f(e){const t=(s,i)=>s.length===0?"":c`
1604
- <div class="section-header">${i}</div>
1605
- ${s.map(r=>{const o=`folder:${r.folder.name}`,a=this.#t.value.has(o),l=r.tagGroups[0]?.items??[];return c`
1606
- ${this.#v(r,o)}
1607
- ${a?l.map(d=>c`
1608
- <button class="node indent-1" @click=${()=>this.#m(d)}>
1698
+ `}#u(e){const t=(i,s)=>i.length===0?"":l`
1699
+ <div class="section-header">${s}</div>
1700
+ ${i.map(r=>{const o=`folder:${r.folder.name}`,a=this.#t.value.has(o),c=r.tagGroups[0]?.items??[];return l`
1701
+ ${this.#x(r,o)}
1702
+ ${a?c.map(d=>l`
1703
+ <button class="node indent-1" @click=${()=>this.#b(d)}>
1609
1704
  <span class="caret"></span>
1610
1705
  <span class="icon">${d._table==="skills"?"⚡":"📝"}</span>
1611
1706
  <span class="label">${d.name}</span>
1612
1707
  </button>
1613
1708
  `):""}
1614
1709
  `})}
1615
- `;return e.local.length===0&&e.remote.length===0?c`<div class="empty">No entries.</div>`:c`${t(e.local,"Folders")}${t(e.remote,"Remote")}`}#w(e){const t=this.#s.value;if(t.length===0){const o=[...e.local,...e.remote];return o.length===0?c`<div class="empty">No entries.</div>`:o.map(a=>{const l=a.tagGroups.reduce((d,p)=>d+p.items.length,0);return c`
1710
+ `;return e.local.length===0&&e.remote.length===0?l`<div class="empty">No entries.</div>`:l`${t(e.local,"Folders")}${t(e.remote,"Remote")}`}#_(e){const t=this.#i.value;if(t.length===0){const o=[...e.local,...e.remote];return o.length===0?l`<div class="empty">No entries.</div>`:o.map(a=>{const c=a.tagGroups.reduce((d,p)=>d+p.items.length,0);return l`
1616
1711
  <button
1617
1712
  class="folder-card ${a.folder.remote?"remote":""}"
1618
- @click=${()=>this.#s.set([a.folder.name])}
1713
+ @click=${()=>this.#i.set([a.folder.name])}
1619
1714
  >
1620
1715
  <span class="icon">${a.folder.remote?"☁":"📁"}</span>
1621
1716
  <span class="label">${a.folder.name}</span>
1622
- <span class="count">${l}</span>
1717
+ <span class="count">${c}</span>
1623
1718
  </button>
1624
- `})}const s=t[0],r=[...e.local,...e.remote].find(o=>o.folder.name===s)?.tagGroups[0]?.items??[];return c`
1719
+ `})}const i=t[0],r=[...e.local,...e.remote].find(o=>o.folder.name===i)?.tagGroups[0]?.items??[];return l`
1625
1720
  <div class="breadcrumb-bar">
1626
- <button @click=${()=>this.#s.set([])}>🏠 Folders</button>
1721
+ <button @click=${()=>this.#i.set([])}>🏠 Folders</button>
1627
1722
  <span class="breadcrumb-sep">›</span>
1628
- <span>${s}</span>
1723
+ <span>${i}</span>
1629
1724
  </div>
1630
- ${r.length===0?c`<div class="empty">No entries in this folder.</div>`:r.map(o=>c`
1631
- <button class="node" @click=${()=>this.#m(o)}>
1725
+ ${r.length===0?l`<div class="empty">No entries in this folder.</div>`:r.map(o=>l`
1726
+ <button class="node" @click=${()=>this.#b(o)}>
1632
1727
  <span class="caret"></span>
1633
1728
  <span class="icon">${o._table==="skills"?"⚡":"📝"}</span>
1634
1729
  <span class="label">${o.name}</span>
1635
1730
  </button>
1636
1731
  `)}
1637
- `}#_(e){return e.length===0?c`<div class="empty">No entries.</div>`:e.map(t=>{const s=`tag:${t.tag??""}`,i=this.#t.value.has(s),r=this.#r.value?.folder===null&&this.#r.value?.tag===t.tag;return c`
1638
- <button class="node ${r?"active":""}" @click=${()=>this.#$(s)}>
1639
- <span class="caret">${i?"▾":"▸"}</span>
1732
+ `}#$(e){return e.length===0?l`<div class="empty">No entries.</div>`:e.map(t=>{const i=`tag:${t.tag??""}`,s=this.#t.value.has(i),r=this.#r.value?.folder===null&&this.#r.value?.tag===t.tag;return l`
1733
+ <button class="node ${r?"active":""}" @click=${()=>this.#w(i)}>
1734
+ <span class="caret">${s?"▾":"▸"}</span>
1640
1735
  <span class="icon">${t.tag===null?"":"🏷"}</span>
1641
1736
  <span
1642
1737
  class="label"
1643
- @click=${o=>{o.stopPropagation(),this.#b(null,t.tag)}}
1738
+ @click=${o=>{o.stopPropagation(),this.#m(null,t.tag)}}
1644
1739
  >${t.tag??"(untagged)"}</span
1645
1740
  >
1646
1741
  <span class="count">${t.items.length}</span>
1647
1742
  </button>
1648
- ${i?t.items.map(o=>c`
1649
- <button class="node indent-1" @click=${()=>this.#m(o)}>
1743
+ ${s?t.items.map(o=>l`
1744
+ <button class="node indent-1" @click=${()=>this.#b(o)}>
1650
1745
  <span class="caret"></span>
1651
1746
  <span class="icon">${o._table==="skills"?"⚡":"📝"}</span>
1652
1747
  <span class="label">${o.name}</span>
1653
1748
  <span class="count">${o.folder}</span>
1654
1749
  </button>
1655
1750
  `):""}
1656
- `})}#k(){const e=this.#r.value;return e?(this.entries??[]).filter(s=>(e.folder===null||s.folder===e.folder)&&(e.tag===null||s.tags.includes(e.tag))):[]}render(){const e=this.#e.value,t=this.entries??[],s=this.allFolders??[],i=e==="c"?null:Hi(t,s),r=e==="c"?Bi(t):null,o=this.#r.value,a=this.#n.value;return c`
1751
+ `})}#g(){const e=this.#r.value;return e?(this.entries??[]).filter(i=>(e.folder===null||i.folder===e.folder)&&(e.tag===null||i.tags.includes(e.tag))):[]}render(){const e=this.#e.value,t=this.entries??[],i=this.allFolders??[],s=e==="c"?null:Ws(t,i),r=e==="c"?Vs(t):null,o=this.#r.value,a=this.#n.value;return l`
1657
1752
  <div class="mode-row">
1658
1753
  <span class="filter-label">View:</span>
1659
- <select .value=${e} @change=${l=>this.#u(l)}>
1660
- ${Vi.map(l=>c`<option value=${l.value}>${l.label}</option>`)}
1754
+ <select .value=${e} @change=${c=>this.#p(c)}>
1755
+ ${Gs.map(c=>l`<option value=${c.value}>${c.label}</option>`)}
1661
1756
  </select>
1662
1757
  <div class="type-toggle">
1663
- ${Ki.map(l=>c`
1758
+ ${Zs.map(c=>l`
1664
1759
  <button
1665
- class=${this.typeFilter===l.value?"active":""}
1666
- @click=${()=>this.onTypeChange(l.value)}
1760
+ class=${this.typeFilter===c.value?"active":""}
1761
+ @click=${()=>this.onTypeChange(c.value)}
1667
1762
  >
1668
- ${l.label}
1763
+ ${c.label}
1669
1764
  </button>
1670
1765
  `)}
1671
1766
  </div>
1672
- <slot name="toolbar"></slot>
1673
1767
  </div>
1674
1768
  <div class="body-region">
1675
1769
  <div
1676
1770
  class="tree-rail"
1677
- style=${`width: ${this.#d.value}%; border-right: 1px solid var(--border);`}
1771
+ style=${`width: ${this.#h.value}%; border-right: 1px solid var(--border);`}
1678
1772
  >
1679
- ${e==="a"?this.#f(i):e==="b"?this.#w(i):this.#_(r)}
1773
+ ${e==="a"?this.#u(s):e==="b"?this.#_(s):this.#$(r)}
1680
1774
  </div>
1681
- ${o?c`
1775
+ ${o?l`
1682
1776
  <div
1683
- class="splitter ${this.#i.value==="tree"?"dragging":""}"
1684
- @pointerdown=${l=>this.#o("tree",l)}
1777
+ class="splitter ${this.#s.value==="tree"?"dragging":""}"
1778
+ @pointerdown=${c=>this.#o("tree",c)}
1685
1779
  ></div>
1686
1780
  <result-list
1687
- style=${`width: ${this.#a.value}%; border-right: 1px solid var(--border);`}
1688
- .results=${this.#k()}
1781
+ style=${`width: ${this.#l.value}%; border-right: 1px solid var(--border);`}
1782
+ .results=${this.#g()}
1689
1783
  .showFolder=${!0}
1690
- .onSelect=${l=>this.#x(l)}
1784
+ .onSelect=${c=>this.#v(c)}
1691
1785
  .selectedIds=${new Set}
1692
1786
  .onToggleSelect=${()=>{}}
1693
1787
  .onKeyClick=${this.onKeyClick}
1694
1788
  ></result-list>
1695
1789
  <div
1696
- class="splitter ${this.#i.value==="list"?"dragging":""}"
1697
- @pointerdown=${l=>this.#o("list",l)}
1790
+ class="splitter ${this.#s.value==="list"?"dragging":""}"
1791
+ @pointerdown=${c=>this.#o("list",c)}
1698
1792
  ></div>
1699
- `:c`
1793
+ `:l`
1700
1794
  <div
1701
- class="splitter ${this.#i.value==="tree"?"dragging":""}"
1702
- @pointerdown=${l=>this.#o("tree",l)}
1795
+ class="splitter ${this.#s.value==="tree"?"dragging":""}"
1796
+ @pointerdown=${c=>this.#o("tree",c)}
1703
1797
  ></div>
1704
1798
  `}
1705
- ${a?c`
1799
+ ${a?l`
1706
1800
  <detail-panel
1707
1801
  .selected=${a}
1708
1802
  .facets=${this.facets}
@@ -1712,9 +1806,9 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1712
1806
  .onDateClick=${this.onDateClick}
1713
1807
  .onKeyClick=${this.onKeyClick}
1714
1808
  ></detail-panel>
1715
- `:c`<div class="no-selection">Select an item to view it.</div>`}
1809
+ `:l`<div class="no-selection">Select an item to view it.</div>`}
1716
1810
  </div>
1717
- `}}customElements.define("folder-view",Qi);const Gi={system:"◐",light:"☀",dark:"☾"},Yi={system:"Auto",light:"Light",dark:"Dark"};class Ji extends k{static{this.properties={showReindex:{attribute:!1},reindexing:{attribute:!1},channelsActive:{attribute:!1},folderViewActive:{attribute:!1},theme:{attribute:!1},onReindex:{attribute:!1},onToggleChannels:{attribute:!1},onToggleFolderView:{attribute:!1},onCycleTheme:{attribute:!1}}}static{this.styles=T`
1811
+ `}}customElements.define("folder-view",Js);const Xs={system:"◐",light:"☀",dark:"☾"},en={system:"Auto",light:"Light",dark:"Dark"};class tn extends k{static{this.properties={showReindex:{attribute:!1},reindexing:{attribute:!1},channelsActive:{attribute:!1},folderViewActive:{attribute:!1},theme:{attribute:!1},onReindex:{attribute:!1},onToggleChannels:{attribute:!1},onToggleFolderView:{attribute:!1},onCycleTheme:{attribute:!1}}}static{this.styles=A`
1718
1812
  :host {
1719
1813
  display: flex;
1720
1814
  align-items: center;
@@ -1766,7 +1860,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1766
1860
  .channels-toggle.active, .folder-view-toggle.active {
1767
1861
  background: var(--accent); border-color: var(--accent); color: var(--accent-fg); opacity: 1;
1768
1862
  }
1769
- `}#e(){return c`
1863
+ `}#e(){return l`
1770
1864
  <button
1771
1865
  class=${`reindex-toggle${this.reindexing?" spinning":""}`}
1772
1866
  title=${this.reindexing?"Reindexing…":"Rebuild cache from disk"}
@@ -1776,7 +1870,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1776
1870
  >
1777
1871
 
1778
1872
  </button>
1779
- `}render(){return c`
1873
+ `}render(){return l`
1780
1874
  ${this.showReindex?this.#e():""}
1781
1875
  <button
1782
1876
  class="channels-toggle ${this.channelsActive?"active":""}"
@@ -1794,16 +1888,19 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1794
1888
  </button>
1795
1889
  <button
1796
1890
  class="theme-toggle"
1797
- title=${`Theme: ${Yi[this.theme]} (click to change)`}
1891
+ title=${`Theme: ${en[this.theme]} (click to change)`}
1798
1892
  aria-label="Toggle color theme"
1799
1893
  @click=${()=>this.onCycleTheme()}
1800
1894
  >
1801
- ${Gi[this.theme]}
1895
+ ${Xs[this.theme]}
1802
1896
  </button>
1803
1897
  <div class="folderfoo-slot"></div>
1804
- `}}customElements.define("app-toolbar",Ji);function Xi(n){const e=n.split(":");if(e.length===1)return{folderPath:"",name:e[0]};if(e.length===2){const[r,o]=e;return r.includes("/")?{folderPath:r,name:o}:{owner:r,folderPath:"",name:o}}const[t,s,...i]=e;return{owner:t===""?void 0:t,folderPath:s,name:i.join(":")}}const Ht=new u({mode:"off",username:null});let xt=!1;function en(){if(xt)return;xt=!0;const n=new EventSource("/api/folderfoo/identity-stream");n.onmessage=e=>{try{Ht.set(JSON.parse(e.data))}catch{}}}const tn=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],yt=[{value:"all",label:"Show all"},{value:"hide",label:"Hide"},{value:"only",label:"Only"}],sn={tags:[],statuses:[],owners:[],doc_types:[],key_types:[],folders:[]},nn={skill:[],memory:[]},Kt="mem-bucket-split-pct",Vt=20,Zt=80;function rn(){const n=Number(localStorage.getItem(Kt));return Number.isFinite(n)&&n>=Vt&&n<=Zt?n:40}const Wt="mem-bucket-theme",fe=["system","light","dark"];function on(){const n=localStorage.getItem(Wt);return n==="light"||n==="dark"?n:"system"}function kt(n){n==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",n)}function an(){const n=location.hash.slice(1);if(!n)return{};const e=new URLSearchParams(n),t={},s=e.get("q");s&&(t.query=s);const i=e.get("type");(i==="skill"||i==="memory"||i==="all")&&(t.typeFilter=i);const r=e.getAll("tag");r.length&&(t.activeTags=r);const o=e.getAll("folder");o.length&&(t.activeFolders=o);const a=e.get("sort");a&&(t.sort=a);const l=e.get("deprecated");l==="0"?t.deprecatedFilter="hide":l==="1"&&(t.deprecatedFilter="only");const d=e.get("paused");d==="0"?t.pausedFilter="hide":d==="1"&&(t.pausedFilter="only");const p=e.get("date_from");p&&(t.dateFrom=p);const h=e.get("date_to");return h&&(t.dateTo=h),t}class ln extends k{static{this.styles=T`
1805
- :host { display: flex; flex-direction: column; height: 100vh; }
1806
- app-toolbar { margin-left: auto; flex-shrink: 0; }
1898
+ `}}customElements.define("app-toolbar",tn);function sn(n){const e=n.split(":");if(e.length===1)return{folderPath:"",name:e[0]};if(e.length===2){const[r,o]=e;return r.includes("/")?{folderPath:r,name:o}:{owner:r,folderPath:"",name:o}}const[t,i,...s]=e;return{owner:t===""?void 0:t,folderPath:i,name:s.join(":")}}const Kt=new u({mode:"off",username:null});let xt=!1;function nn(){if(xt)return;xt=!0;const n=new EventSource("/api/folderfoo/identity-stream");n.onmessage=e=>{try{Kt.set(JSON.parse(e.data))}catch{}}}let yt=!1;const rn=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],kt=[{value:"all",label:"Show all"},{value:"hide",label:"Hide"},{value:"only",label:"Only"}],on={tags:[],statuses:[],owners:[],doc_types:[],key_types:[],folders:[]},an={skill:[],memory:[]},Vt="mem-bucket-split-pct",Wt=20,Zt=80;function ln(){const n=Number(localStorage.getItem(Vt));return Number.isFinite(n)&&n>=Wt&&n<=Zt?n:40}const Gt="mem-bucket-theme",fe=["system","light","dark"];function cn(){const n=localStorage.getItem(Gt);return n==="light"||n==="dark"?n:"system"}function $t(n){n==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",n)}function dn(){const n=location.hash.slice(1);if(!n)return{};const e=new URLSearchParams(n),t={},i=e.get("q");i&&(t.query=i);const s=e.get("type");(s==="skill"||s==="memory"||s==="all")&&(t.typeFilter=s);const r=e.getAll("tag");r.length&&(t.activeTags=r);const o=e.getAll("folder");o.length&&(t.activeFolders=o);const a=e.get("sort");a&&(t.sort=a);const c=e.get("deprecated");c==="0"?t.deprecatedFilter="hide":c==="1"&&(t.deprecatedFilter="only");const d=e.get("paused");d==="0"?t.pausedFilter="hide":d==="1"&&(t.pausedFilter="only");const p=e.get("date_from");p&&(t.dateFrom=p);const h=e.get("date_to");return h&&(t.dateTo=h),t}class hn extends k{static{this.styles=A`
1899
+ :host { display: flex; flex-direction: column; height: 100vh; position: relative; }
1900
+ /* Overlays whichever header row #renderBody() renders for the current mode (.folders-bar,
1901
+ .toolbar-bar, or folder-view's own .mode-row) - all three share the same 10px/16px padding,
1902
+ so this lines up with them pixel-for-pixel without needing to sit inside any of them. */
1903
+ .header-toolbar { position: absolute; top: 10px; right: 16px; z-index: 1; }
1807
1904
  .filters {
1808
1905
  padding: 12px 16px;
1809
1906
  border-bottom: 1px solid var(--border);
@@ -1906,12 +2003,14 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1906
2003
  left: -3px; right: -3px;
1907
2004
  }
1908
2005
  label.small { font-size: 12px; opacity: 0.7; }
2006
+ /* padding-right reserves room for .header-toolbar (an absolutely-positioned overlay, so it
2007
+ takes no space in this row's own flex layout) so wrapped folder chips don't run under it. */
1909
2008
  .folders-bar {
1910
2009
  display: flex;
1911
2010
  gap: 6px;
1912
2011
  align-items: center;
1913
2012
  flex-wrap: wrap;
1914
- padding: 10px 16px;
2013
+ padding: 10px 320px 10px 16px;
1915
2014
  border-bottom: 1px solid var(--border);
1916
2015
  background: var(--bg-subtle);
1917
2016
  }
@@ -2000,85 +2099,82 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2000
2099
  cursor: pointer;
2001
2100
  }
2002
2101
  .bulk-bar button.danger { border-color: var(--danger); color: var(--danger); }
2003
- `}#e=an();#t=new u(this.#e.query??"");#s=new u(this.#e.typeFilter??"all");#r=new u(this.#e.activeTags??[]);#n=new u(this.#e.activeFolders??[]);#d=new u([]);#a=new u(sn);#i=new u(null);#l=new u(nn);#p=new u(!1);#h=new u("");#u=new u(!1);#o=new u(rn());#g=new u("");#y=new u(!1);#$=new u(this.#e.sort??"");#b=new u(this.#e.deprecatedFilter??"all");#m=new u(this.#e.pausedFilter??"all");#x=new u(this.#e.dateFrom??"");#v=new u(this.#e.dateTo??"");#f=new u(new Set);#w=new u(on());#_=new u(!1);#k=new u("entries");#R=new u([]);#P=new u([]);#C=new u(null);#A=new u(null);#E=new u(!1);#z=e=>this.#q(e);#L=()=>this.#U();constructor(){super(),new Y(this),kt(this.#w.value)}#I(e){this.#w.set(e),localStorage.setItem(Wt,e),kt(e)}#O(){const e=fe[(fe.indexOf(this.#w.value)+1)%fe.length];this.#I(e)}async#D(){if(!this.#_.value){this.#_.set(!0);try{await fetch("/api/rebuild-cache",{method:"POST"}),await Promise.all([this.#T(),this.#S(),this.#c()])}finally{this.#_.set(!1)}}}#N(e){e.preventDefault(),this.#y.set(!0),document.addEventListener("pointermove",this.#z),document.addEventListener("pointerup",this.#L)}#q(e){const t=this.renderRoot.querySelector(".body-region");if(!t)return;const s=t.getBoundingClientRect(),i=(e.clientX-s.left)/s.width*100;this.#o.set(Math.min(Zt,Math.max(Vt,i)))}#U(){this.#y.set(!1),document.removeEventListener("pointermove",this.#z),document.removeEventListener("pointerup",this.#L),localStorage.setItem(Kt,String(this.#o.value))}#j=new Ye(()=>{const e=new URLSearchParams;this.#s.value!=="all"&&e.set("type",this.#s.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim());for(const t of this.#r.value)e.append("tag",t);for(const t of this.#n.value)e.append("folder",t);return this.#$.value&&e.set("sort",this.#$.value),this.#b.value==="hide"?e.set("deprecated","0"):this.#b.value==="only"&&e.set("deprecated","1"),this.#m.value==="hide"?e.set("paused","0"):this.#m.value==="only"&&e.set("paused","1"),this.#x.value&&e.set("date_from",this.#x.value),this.#v.value&&e.set("date_to",this.#v.value),e.toString()});#B=new Ye(()=>{const e=new URLSearchParams;return this.#s.value!=="all"&&e.set("type",this.#s.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim()),this.#b.value==="hide"?e.set("deprecated","0"):this.#b.value==="only"&&e.set("deprecated","1"),this.#m.value==="hide"?e.set("paused","0"):this.#m.value==="only"&&e.set("paused","1"),this.#x.value&&e.set("date_from",this.#x.value),this.#v.value&&e.set("date_to",this.#v.value),e.toString()});#F=()=>this.#X();#Z=e=>this.#de(e);#W=e=>this.#he(e);#Q=()=>this.#J();#G;connectedCallback(){super.connectedCallback(),this.#c(),this.#S(),this.#T().then(()=>this.#X()),window.addEventListener("focus",this.#F),document.addEventListener("visibilitychange",this.#F),document.addEventListener("folderfoo-file-open",this.#Z),document.addEventListener("folderfoo-folder-changed",this.#W),window.addEventListener("folderfoo-auth-change",this.#Q),this.#J(),en(),this.#G=Ht.subscribe(()=>this.#T())}async#de(e){const t=e.detail?.name;if(!t)return;const s=Xi(t);if(s.owner){this.#g.set(`"${s.name}" is from a shared folder — opening shared files here isn't supported yet.`);return}const{folderfooMode:i,folderfooHost:r}=await Z();if(!(i==="off"||!r))try{const o=await fetch("/api/folderfoo/resolve-open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:r,tenantId:oe,folderPath:s.folderPath,name:s.name})}),a=await o.json();if(!o.ok){this.#g.set(a.error??`couldn't open "${s.name}"`);return}this.#g.set(""),this.#i.set({table:a.table,id:a.id})}catch(o){this.#g.set(o.message)}}async#he(e){const{path:t,action:s,newPath:i}=e.detail??{};if(!(t===void 0||!s)){if((s==="rename"||s==="move")&&i){const{folderfooHost:r}=await Z();if(!r)return;try{await fetch("/api/folders/renamed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:r,oldPath:t,newPath:i})})}catch{}}this.#T()}}#Y(){return this.shadowRoot?.querySelector("app-toolbar")?.shadowRoot?.querySelector(".folderfoo-slot")??null}async#pe(){const e=this.#Y();if(!e||e.querySelector("folderfoo-profile-circle")||e.hasAttribute("data-ff-attempted"))return;e.setAttribute("data-ff-attempted","");const{folderfooMode:t,folderfooHost:s}=await Z();t==="off"||!s||$t(()=>import(`${s}/elements/folderfoo-profile-circle.js`),[]).then(async()=>{await this.updateComplete;const i=document.createElement("folderfoo-profile-circle");i.setAttribute("app-name","Memory Bucket"),i.setAttribute("tenant-id",oe),i.style.zoom="0.875",this.#Y()?.appendChild(i)}).catch(i=>{console.warn("folderfoo-profile-circle unavailable:",i.message)})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("focus",this.#F),document.removeEventListener("visibilitychange",this.#F),document.removeEventListener("folderfoo-file-open",this.#Z),document.removeEventListener("folderfoo-folder-changed",this.#W),window.removeEventListener("folderfoo-auth-change",this.#Q),this.#G?.()}async#J(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{return}if(!e){fetch("/api/folderfoo/logout",{method:"POST"}).catch(()=>{});return}const{folderfooMode:t,folderfooHost:s}=await Z();t==="off"||!s||fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:s,token:e})}).catch(()=>{})}#H=!1;async#X(){if(document.visibilityState==="visible"){if(this.#re().some(e=>e.remote)&&!this.#H){this.#H=!0;try{await fetch("/api/remote-folders/resync-all",{method:"POST"})}catch{}finally{this.#H=!1}}this.#c(),this.#S(),this.#T(),this.renderRoot.querySelector("detail-panel")?.refresh?.()}}async#c(){const e=this.#j.value;history.replaceState(null,"",e?`#${e}`:location.pathname+location.search);const t=await fetch(`/api/entries?${e}`);this.#d.set(await t.json()),this.renderRoot.querySelector("result-list")?.scrollTo(0,0),this.#k.value==="folder-view"&&this.#ee()}async#ee(){const e=await fetch(`/api/entries?${this.#B.value}`);this.#R.set(await e.json())}async#S(){const e=this.#s.value==="all"?"":`?type=${this.#s.value}`,t=await fetch(`/api/facets${e}`);this.#a.set(await t.json())}async#T(){const t=await(await fetch("/api/folders")).json();this.#l.set(t),this.#u.set(!0);const s=new Set([...t.skill,...t.memory].map(r=>r.name)),i=this.#n.value.filter(r=>s.has(r));i.length!==this.#n.value.length&&(this.#n.set(i),this.#c())}#te(e){this.#k.set(e),e==="channels"?this.#se():e==="folder-view"&&this.#ee()}async#se(){const e=await fetch("/api/channels");this.#P.set(await e.json()),this.#C.value&&this.#ie(this.#C.value)}async#ie(e){this.#C.set(e),this.#E.set(!0);try{const t=await fetch(`/api/channels/${encodeURIComponent(e)}`);this.#A.set(t.ok?await t.json():null)}finally{this.#E.set(!1)}}#ue(e){const t=this.#n.value;this.#n.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#c()}async#fe(e,t){if(t.stopPropagation(),window.prompt(`Type "${e.name}" to remove this ${e.kind} folder (files on disk are untouched):`)===e.name){this.#h.set(e.name);try{await fetch(`/api/folders/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"}),this.#n.set(this.#n.value.filter(i=>i!==e.name)),await Promise.all([this.#T(),this.#S(),this.#c()])}finally{this.#h.set("")}}}#ne(){this.#p.set(!1),this.#T(),this.#S(),this.#c()}#re(){return[...this.#l.value.skill,...this.#l.value.memory].sort((e,t)=>Number(e.remote)-Number(t.remote))}#oe(e){this.#s.set(e),this.#r.set([]),this.#S(),this.#c()}#ge(e){const t=this.#r.value;this.#r.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#c()}#be(e){this.#r.value.includes(e)||this.#r.set([...this.#r.value,e]),this.#c()}#me(e){this.#n.value.includes(e)||this.#n.set([...this.#n.value,e]),this.#c()}#ae(e){this.#x.set(e),this.#v.set(e),this.#c()}#ve(e){this.#t.set(e.target.value),this.#c()}#K(e){this.#t.set(e),this.#c()}#xe(){this.#t.set(""),this.#c()}#ye(e){this.#i.set({table:e._table,id:e.id})}#ke(e){this.#$.set(e.target.value),this.#c()}#$e(e){this.#b.set(e.target.value),this.#c()}#we(e){this.#m.set(e.target.value),this.#c()}#_e(e){this.#x.set(e.target.value),this.#c()}#Se(e){this.#v.set(e.target.value),this.#c()}#Ce(){this.#x.set(""),this.#v.set(""),this.#c()}#Te(e){const t=new Set(this.#f.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#f.set(t)}#Ae(){return new Map(this.#d.value.map(e=>[e.id,e]))}#V(){const e=new Map,t=this.#Ae();for(const s of this.#f.value){const i=t.get(s);if(!i)continue;const r=e.get(i._table)??[];r.push(s),e.set(i._table,r)}return e}async#le(e){const t=this.#V();await Promise.all([...t.entries()].map(([s,i])=>fetch(`/api/entries/${s}/bulk/deprecated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i,deprecated:e})}))),this.#f.set(new Set),await this.#c()}async#ce(e){const t=this.#V();await Promise.all([...t.entries()].map(([s,i])=>fetch(`/api/entries/${s}/bulk/paused`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i,paused:e})}))),this.#f.set(new Set),await this.#c()}async#Ee(){if(!window.confirm(`Delete ${this.#f.value.size} doc(s)? This can't be undone.`))return;const e=this.#V();await Promise.all([...e.entries()].map(([t,s])=>fetch(`/api/entries/${t}/bulk/delete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:s})}))),this.#f.set(new Set),await this.#c()}#M(e){return c`
2102
+ `}#e=dn();#t=new u(this.#e.query??"");#i=new u(this.#e.typeFilter??"all");#r=new u(this.#e.activeTags??[]);#n=new u(this.#e.activeFolders??[]);#h=new u([]);#l=new u(on);#s=new u(null);#c=new u(an);#f=new u(!1);#y=new u("");#p=new u(!1);#o=new u(ln());#a=new u("");#k=new u(!1);#w=new u(this.#e.sort??"");#m=new u(this.#e.deprecatedFilter??"all");#b=new u(this.#e.pausedFilter??"all");#v=new u(this.#e.dateFrom??"");#x=new u(this.#e.dateTo??"");#u=new u(new Set);#_=new u(cn());#$=new u(!1);#g=new u("entries");#T=new u([]);#E=new u([]);#S=new u(null);#R=new u(null);#P=new u(!1);#z=e=>this.#N(e);#L=()=>this.#U();constructor(){super(),new Y(this),$t(this.#_.value)}#I(e){this.#_.set(e),localStorage.setItem(Gt,e),$t(e)}#O(){const e=fe[(fe.indexOf(this.#_.value)+1)%fe.length];this.#I(e)}async#D(){if(!this.#$.value){this.#$.set(!0);try{await fetch("/api/rebuild-cache",{method:"POST"}),await Promise.all([this.#A(),this.#C(),this.#d()])}finally{this.#$.set(!1)}}}#M(e){e.preventDefault(),this.#k.set(!0),document.addEventListener("pointermove",this.#z),document.addEventListener("pointerup",this.#L)}#N(e){const t=this.renderRoot.querySelector(".body-region");if(!t)return;const i=t.getBoundingClientRect(),s=(e.clientX-i.left)/i.width*100;this.#o.set(Math.min(Zt,Math.max(Wt,s)))}#U(){this.#k.set(!1),document.removeEventListener("pointermove",this.#z),document.removeEventListener("pointerup",this.#L),localStorage.setItem(Vt,String(this.#o.value))}#q=new Ye(()=>{const e=new URLSearchParams;this.#i.value!=="all"&&e.set("type",this.#i.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim());for(const t of this.#r.value)e.append("tag",t);for(const t of this.#n.value)e.append("folder",t);return this.#w.value&&e.set("sort",this.#w.value),this.#m.value==="hide"?e.set("deprecated","0"):this.#m.value==="only"&&e.set("deprecated","1"),this.#b.value==="hide"?e.set("paused","0"):this.#b.value==="only"&&e.set("paused","1"),this.#v.value&&e.set("date_from",this.#v.value),this.#x.value&&e.set("date_to",this.#x.value),e.toString()});#j=new Ye(()=>{const e=new URLSearchParams;return this.#i.value!=="all"&&e.set("type",this.#i.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim()),this.#m.value==="hide"?e.set("deprecated","0"):this.#m.value==="only"&&e.set("deprecated","1"),this.#b.value==="hide"?e.set("paused","0"):this.#b.value==="only"&&e.set("paused","1"),this.#v.value&&e.set("date_from",this.#v.value),this.#x.value&&e.set("date_to",this.#x.value),e.toString()});#F=()=>this.#ee();#W=e=>this.#de(e);#Z=e=>this.#he(e);#G=()=>this.#X();#Q;connectedCallback(){super.connectedCallback(),this.#d(),this.#C(),this.#A().then(()=>this.#ee()),window.addEventListener("focus",this.#F),document.addEventListener("visibilitychange",this.#F),document.addEventListener("folderfoo-file-open",this.#W),document.addEventListener("folderfoo-folder-changed",this.#Z),window.addEventListener("folderfoo-auth-change",this.#G),this.#X(),nn(),this.#Q=Kt.subscribe(()=>this.#A())}async#de(e){const t=e.detail?.name;if(!t)return;const i=sn(t);if(i.owner){this.#a.set(`"${i.name}" is from a shared folder — opening shared files here isn't supported yet.`);return}const{folderfooMode:s,folderfooHost:r}=await W();if(!(s==="off"||!r))try{const o=await fetch("/api/folderfoo/resolve-open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:r,tenantId:oe,folderPath:i.folderPath,name:i.name})}),a=await o.json();if(!o.ok){this.#a.set(a.error??`couldn't open "${i.name}"`);return}this.#a.set(""),this.#s.set({table:a.table,id:a.id})}catch(o){this.#a.set(o.message)}}async#he(e){const{path:t,action:i,newPath:s}=e.detail??{};if(!(t===void 0||!i)){if((i==="rename"||i==="move")&&s){const{folderfooHost:r}=await W();if(!r)return;try{await fetch("/api/folders/renamed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:r,oldPath:t,newPath:s})})}catch{}}this.#A()}}#Y(){return this.shadowRoot?.querySelector("app-toolbar")?.shadowRoot?.querySelector(".folderfoo-slot")??null}#J(e){const t=document.createElement("folderfoo-profile-circle");t.setAttribute("app-name","Memory Bucket"),t.setAttribute("tenant-id",oe),t.style.zoom="0.875",e.appendChild(t)}async#pe(){const e=this.#Y();if(!e||e.querySelector("folderfoo-profile-circle"))return;if(yt){this.#J(e);return}if(e.hasAttribute("data-ff-attempted"))return;e.setAttribute("data-ff-attempted","");const{folderfooMode:t,folderfooHost:i}=await W();t==="off"||!i||wt(()=>import(`${i}/elements/folderfoo-profile-circle.js`),[]).then(async()=>{yt=!0,await this.updateComplete;const s=this.#Y();s&&!s.querySelector("folderfoo-profile-circle")&&this.#J(s)}).catch(s=>{console.warn("folderfoo-profile-circle unavailable:",s.message)})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("focus",this.#F),document.removeEventListener("visibilitychange",this.#F),document.removeEventListener("folderfoo-file-open",this.#W),document.removeEventListener("folderfoo-folder-changed",this.#Z),window.removeEventListener("folderfoo-auth-change",this.#G),this.#Q?.()}async#X(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{return}if(!e){fetch("/api/folderfoo/logout",{method:"POST"}).catch(()=>{});return}const{folderfooMode:t,folderfooHost:i}=await W();t==="off"||!i||fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:i,token:e})}).catch(()=>{})}#B=!1;async#ee(){if(document.visibilityState==="visible"){if(this.#H().some(e=>e.remote)&&!this.#B){this.#B=!0;try{await fetch("/api/remote-folders/resync-all",{method:"POST"})}catch{}finally{this.#B=!1}}this.#d(),this.#C(),this.#A(),this.renderRoot.querySelector("detail-panel")?.refresh?.()}}async#d(){const e=this.#q.value;history.replaceState(null,"",e?`#${e}`:location.pathname+location.search);const t=await fetch(`/api/entries?${e}`);this.#h.set(await t.json()),this.renderRoot.querySelector("result-list")?.scrollTo(0,0),this.#g.value==="folder-view"&&this.#te()}async#te(){const e=await fetch(`/api/entries?${this.#j.value}`);this.#T.set(await e.json())}async#C(){const e=this.#i.value==="all"?"":`?type=${this.#i.value}`,t=await fetch(`/api/facets${e}`);this.#l.set(await t.json())}async#A(){const t=await(await fetch("/api/folders")).json();this.#c.set(t),this.#p.set(!0);const i=new Set([...t.skill,...t.memory].map(r=>r.name)),s=this.#n.value.filter(r=>i.has(r));s.length!==this.#n.value.length&&(this.#n.set(s),this.#d())}#ie(e){this.#g.set(e),e==="channels"?this.#se():e==="folder-view"&&this.#te()}async#se(){const e=await fetch("/api/channels");this.#E.set(await e.json()),this.#S.value&&this.#ne(this.#S.value)}async#ne(e){this.#S.set(e),this.#P.set(!0);try{const t=await fetch(`/api/channels/${encodeURIComponent(e)}`);this.#R.set(t.ok?await t.json():null)}finally{this.#P.set(!1)}}#ue(e){const t=this.#n.value;this.#n.set(t.includes(e)?t.filter(i=>i!==e):[...t,e]),this.#d()}async#fe(e,t){if(t.stopPropagation(),window.prompt(`Type "${e.name}" to remove this ${e.kind} folder (files on disk are untouched):`)===e.name){this.#y.set(e.name);try{await fetch(`/api/folders/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"}),this.#n.set(this.#n.value.filter(s=>s!==e.name)),await Promise.all([this.#A(),this.#C(),this.#d()])}finally{this.#y.set("")}}}#re(){this.#f.set(!1),this.#A(),this.#C(),this.#d()}#H(){return[...this.#c.value.skill,...this.#c.value.memory].sort((e,t)=>Number(e.remote)-Number(t.remote))}#oe(e){this.#i.set(e),this.#r.set([]),this.#C(),this.#d()}#ge(e){const t=this.#r.value;this.#r.set(t.includes(e)?t.filter(i=>i!==e):[...t,e]),this.#d()}#be(e){this.#r.value.includes(e)||this.#r.set([...this.#r.value,e]),this.#d()}#me(e){this.#n.value.includes(e)||this.#n.set([...this.#n.value,e]),this.#d()}#ae(e){this.#v.set(e),this.#x.set(e),this.#d()}#ve(e){this.#t.set(e.target.value),this.#d()}#K(e){this.#t.set(e),this.#d()}#xe(){this.#t.set(""),this.#d()}#ye(e){this.#s.set({table:e._table,id:e.id})}#ke(e){this.#w.set(e.target.value),this.#d()}#$e(e){this.#m.set(e.target.value),this.#d()}#we(e){this.#b.set(e.target.value),this.#d()}#_e(e){this.#v.set(e.target.value),this.#d()}#Se(e){this.#x.set(e.target.value),this.#d()}#Ce(){this.#v.set(""),this.#x.set(""),this.#d()}#Ae(e){const t=new Set(this.#u.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#u.set(t)}#Te(){return new Map(this.#h.value.map(e=>[e.id,e]))}#V(){const e=new Map,t=this.#Te();for(const i of this.#u.value){const s=t.get(i);if(!s)continue;const r=e.get(s._table)??[];r.push(i),e.set(s._table,r)}return e}async#le(e){const t=this.#V();await Promise.all([...t.entries()].map(([i,s])=>fetch(`/api/entries/${i}/bulk/deprecated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:s,deprecated:e})}))),this.#u.set(new Set),await this.#d()}async#ce(e){const t=this.#V();await Promise.all([...t.entries()].map(([i,s])=>fetch(`/api/entries/${i}/bulk/paused`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:s,paused:e})}))),this.#u.set(new Set),await this.#d()}async#Ee(){if(!window.confirm(`Delete ${this.#u.value.size} doc(s)? This can't be undone.`))return;const e=this.#V();await Promise.all([...e.entries()].map(([t,i])=>fetch(`/api/entries/${t}/bulk/delete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i})}))),this.#u.set(new Set),await this.#d()}#Re(){const e=this.#g.value!=="channels"&&this.#p.value&&this.#H().length>0;return l`
2004
2103
  <app-toolbar
2005
2104
  .showReindex=${e}
2006
- .reindexing=${this.#_.value}
2007
- .channelsActive=${this.#k.value==="channels"}
2008
- .folderViewActive=${this.#k.value==="folder-view"}
2009
- .theme=${this.#w.value}
2105
+ .reindexing=${this.#$.value}
2106
+ .channelsActive=${this.#g.value==="channels"}
2107
+ .folderViewActive=${this.#g.value==="folder-view"}
2108
+ .theme=${this.#_.value}
2010
2109
  .onReindex=${()=>this.#D()}
2011
- .onToggleChannels=${()=>this.#te(this.#k.value==="channels"?"entries":"channels")}
2012
- .onToggleFolderView=${()=>this.#te(this.#k.value==="folder-view"?"entries":"folder-view")}
2110
+ .onToggleChannels=${()=>this.#ie(this.#g.value==="channels"?"entries":"channels")}
2111
+ .onToggleFolderView=${()=>this.#ie(this.#g.value==="folder-view"?"entries":"folder-view")}
2013
2112
  .onCycleTheme=${()=>this.#O()}
2014
2113
  ></app-toolbar>
2015
- `}updated(){this.#pe()}render(){const e=this.#a.value,t=this.#re();return this.#k.value==="channels"?c`
2016
- <div class="toolbar-bar">${this.#M(!1)}</div>
2114
+ `}updated(){this.#pe()}render(){return l` <div class="header-toolbar">${this.#Re()}</div>${this.#Pe()} `}#Pe(){const e=this.#l.value,t=this.#H();return this.#g.value==="channels"?l`
2115
+ <div class="toolbar-bar"></div>
2017
2116
  <channel-view
2018
- .channels=${this.#P.value}
2019
- .selected=${this.#C.value}
2020
- .detail=${this.#A.value}
2021
- .loading=${this.#E.value}
2022
- .onSelect=${s=>this.#ie(s)}
2117
+ .channels=${this.#E.value}
2118
+ .selected=${this.#S.value}
2119
+ .detail=${this.#R.value}
2120
+ .loading=${this.#P.value}
2121
+ .onSelect=${i=>this.#ne(i)}
2023
2122
  .onRefresh=${()=>this.#se()}
2024
2123
  ></channel-view>
2025
- `:this.#k.value==="folder-view"?c`
2124
+ `:this.#g.value==="folder-view"?l`
2026
2125
  <folder-view
2027
- .entries=${this.#R.value}
2126
+ .entries=${this.#T.value}
2028
2127
  .allFolders=${t}
2029
2128
  .facets=${e}
2030
- .typeFilter=${this.#s.value}
2031
- .onTypeChange=${s=>this.#oe(s)}
2032
- .onChanged=${()=>{this.#c(),this.#S()}}
2033
- .onDateClick=${s=>this.#ae(s)}
2034
- .onKeyClick=${s=>this.#K(s)}
2035
- >
2036
- <div slot="toolbar">${this.#M(!0)}</div>
2037
- </folder-view>
2038
- `:this.#u.value&&t.length===0&&!this.#p.value?c`
2039
- <div class="toolbar-bar">${this.#M(!1)}</div>
2129
+ .typeFilter=${this.#i.value}
2130
+ .onTypeChange=${i=>this.#oe(i)}
2131
+ .onChanged=${()=>{this.#d(),this.#C()}}
2132
+ .onDateClick=${i=>this.#ae(i)}
2133
+ .onKeyClick=${i=>this.#K(i)}
2134
+ ></folder-view>
2135
+ `:this.#p.value&&t.length===0&&!this.#f.value?l`
2136
+ <div class="toolbar-bar"></div>
2040
2137
  <div class="first-run">
2041
2138
  <h1>No folders configured yet</h1>
2042
2139
  <p>
2043
2140
  Add a folder of skills or memory docs to get started. You can add more folders later —
2044
2141
  e.g. a personal skills repo plus a shared company repo.
2045
2142
  </p>
2046
- <button class="add-folder-btn" @click=${()=>this.#p.set(!0)}>+ Add your first folder</button>
2143
+ <button class="add-folder-btn" @click=${()=>this.#f.set(!0)}>+ Add your first folder</button>
2047
2144
  </div>
2048
- ${this.#p.value?c`<add-folder-modal
2145
+ ${this.#f.value?l`<add-folder-modal
2049
2146
  .defaultKind=${"skill"}
2050
2147
  .lockKind=${!1}
2051
- .onAdded=${()=>this.#ne()}
2052
- .onCancel=${()=>this.#p.set(!1)}
2148
+ .onAdded=${()=>this.#re()}
2149
+ .onCancel=${()=>this.#f.set(!1)}
2053
2150
  ></add-folder-modal>`:""}
2054
- `:c`
2151
+ `:l`
2055
2152
  <div class="folders-bar">
2056
2153
  <span class="filter-label">Folders:</span>
2057
2154
  <div class="folder-chips">
2058
- ${t.map(s=>c`
2155
+ ${t.map(i=>l`
2059
2156
  <button
2060
- class="folder-chip ${s.remote?"remote":""} ${this.#n.value.includes(s.name)?"active":""}"
2061
- title=${s.remote?`${s.path} (remote — folderfoo)`:s.path}
2062
- @click=${()=>this.#ue(s.name)}
2157
+ class="folder-chip ${i.remote?"remote":""} ${this.#n.value.includes(i.name)?"active":""}"
2158
+ title=${i.remote?`${i.path} (remote — folderfoo)`:i.path}
2159
+ @click=${()=>this.#ue(i.name)}
2063
2160
  >
2064
- ${s.remote?c`<span class="remote-dot"></span>`:"📁"} ${s.name}
2065
- <span class="kind">(${s.kind==="skill"?"s":"m"})</span>
2161
+ ${i.remote?l`<span class="remote-dot"></span>`:"📁"} ${i.name}
2162
+ <span class="kind">(${i.kind==="skill"?"s":"m"})</span>
2066
2163
  <span
2067
2164
  class="remove"
2068
2165
  title="Remove folder"
2069
- @click=${i=>this.#fe(s,i)}
2070
- >${this.#h.value===s.name?"…":"✕"}</span
2166
+ @click=${s=>this.#fe(i,s)}
2167
+ >${this.#y.value===i.name?"…":"✕"}</span
2071
2168
  >
2072
2169
  </button>
2073
2170
  `)}
2074
- <button class="add-folder-btn" @click=${()=>this.#p.set(!0)}>+ Add folder</button>
2171
+ <button class="add-folder-btn" @click=${()=>this.#f.set(!0)}>+ Add folder</button>
2075
2172
  </div>
2076
- ${this.#M(!0)}
2077
2173
  </div>
2078
- ${this.#g.value?c`
2174
+ ${this.#a.value?l`
2079
2175
  <div class="folderfoo-open-banner">
2080
- ${this.#g.value}
2081
- <button class="dismiss" @click=${()=>this.#g.set("")}>✕</button>
2176
+ ${this.#a.value}
2177
+ <button class="dismiss" @click=${()=>this.#a.set("")}>✕</button>
2082
2178
  </div>
2083
2179
  `:""}
2084
2180
  <div class="filters">
@@ -2088,9 +2184,9 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2088
2184
  type="search"
2089
2185
  placeholder="Search descriptions, bodies, tags..."
2090
2186
  .value=${this.#t.value}
2091
- @input=${s=>this.#ve(s)}
2187
+ @input=${i=>this.#ve(i)}
2092
2188
  />
2093
- ${this.#t.value?c`
2189
+ ${this.#t.value?l`
2094
2190
  <button
2095
2191
  class="search-clear-btn"
2096
2192
  title="Clear search"
@@ -2102,20 +2198,20 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2102
2198
  `:""}
2103
2199
  </div>
2104
2200
  <div class="row type-toggle">
2105
- ${tn.map(s=>c`
2201
+ ${rn.map(i=>l`
2106
2202
  <button
2107
- class=${this.#s.value===s.value?"active":""}
2108
- @click=${()=>this.#oe(s.value)}
2203
+ class=${this.#i.value===i.value?"active":""}
2204
+ @click=${()=>this.#oe(i.value)}
2109
2205
  >
2110
- ${s.label}
2206
+ ${i.label}
2111
2207
  </button>
2112
2208
  `)}
2113
2209
  </div>
2114
- ${e.tags.length===0?c`<span class="filter-label">Tags:</span> <label class="small">no tags yet</label>`:c`
2210
+ ${e.tags.length===0?l`<span class="filter-label">Tags:</span> <label class="small">no tags yet</label>`:l`
2115
2211
  <tag-multiselect
2116
2212
  .tags=${e.tags}
2117
2213
  .active=${this.#r.value}
2118
- .onToggle=${s=>this.#ge(s)}
2214
+ .onToggle=${i=>this.#ge(i)}
2119
2215
  .width=${"260px"}
2120
2216
  ></tag-multiselect>
2121
2217
  `}
@@ -2124,17 +2220,17 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2124
2220
  <input
2125
2221
  type="date"
2126
2222
  aria-label="From date"
2127
- .value=${this.#x.value}
2128
- @change=${s=>this.#_e(s)}
2223
+ .value=${this.#v.value}
2224
+ @change=${i=>this.#_e(i)}
2129
2225
  />
2130
2226
  <span class="date-range-sep">–</span>
2131
2227
  <input
2132
2228
  type="date"
2133
2229
  aria-label="To date"
2134
- .value=${this.#v.value}
2135
- @change=${s=>this.#Se(s)}
2230
+ .value=${this.#x.value}
2231
+ @change=${i=>this.#Se(i)}
2136
2232
  />
2137
- ${this.#x.value||this.#v.value?c`
2233
+ ${this.#v.value||this.#x.value?l`
2138
2234
  <button
2139
2235
  class="date-range-clear"
2140
2236
  title="Clear date range"
@@ -2147,64 +2243,64 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2147
2243
  </div>
2148
2244
  <span class="filter-label">Sort:</span>
2149
2245
  <select
2150
- .value=${this.#$.value||(this.#t.value.trim()?"relevance":"mtime_desc")}
2151
- @change=${s=>this.#ke(s)}
2246
+ .value=${this.#w.value||(this.#t.value.trim()?"relevance":"mtime_desc")}
2247
+ @change=${i=>this.#ke(i)}
2152
2248
  >
2153
- ${this.#t.value.trim()?c`<option value="relevance">Relevance</option>`:""}
2249
+ ${this.#t.value.trim()?l`<option value="relevance">Relevance</option>`:""}
2154
2250
  <option value="mtime_desc">Recently touched</option>
2155
2251
  <option value="mtime_asc">Least recently touched</option>
2156
2252
  <option value="created_at_asc">Oldest first</option>
2157
2253
  <option value="name_asc">Name</option>
2158
2254
  </select>
2159
2255
  <span class="filter-label">Deprecated:</span>
2160
- <select .value=${this.#b.value} @change=${s=>this.#$e(s)}>
2161
- ${yt.map(s=>c`<option value=${s.value}>${s.label}</option>`)}
2256
+ <select .value=${this.#m.value} @change=${i=>this.#$e(i)}>
2257
+ ${kt.map(i=>l`<option value=${i.value}>${i.label}</option>`)}
2162
2258
  </select>
2163
2259
  <span class="filter-label">Paused:</span>
2164
- <select .value=${this.#m.value} @change=${s=>this.#we(s)}>
2165
- ${yt.map(s=>c`<option value=${s.value}>${s.label}</option>`)}
2260
+ <select .value=${this.#b.value} @change=${i=>this.#we(i)}>
2261
+ ${kt.map(i=>l`<option value=${i.value}>${i.label}</option>`)}
2166
2262
  </select>
2167
2263
  </div>
2168
2264
  </div>
2169
- ${this.#f.value.size>0?c`
2265
+ ${this.#u.value.size>0?l`
2170
2266
  <div class="bulk-bar">
2171
- <span>${this.#f.value.size} selected</span>
2267
+ <span>${this.#u.value.size} selected</span>
2172
2268
  <button @click=${()=>this.#le(!0)}>Mark deprecated</button>
2173
2269
  <button @click=${()=>this.#le(!1)}>Un-deprecate</button>
2174
2270
  <button @click=${()=>this.#ce(!0)}>Pause</button>
2175
2271
  <button @click=${()=>this.#ce(!1)}>Resume</button>
2176
2272
  <button class="danger" @click=${()=>this.#Ee()}>Delete</button>
2177
- <button @click=${()=>this.#f.set(new Set)}>Clear</button>
2273
+ <button @click=${()=>this.#u.set(new Set)}>Clear</button>
2178
2274
  </div>
2179
2275
  `:""}
2180
2276
  <div class="body-region">
2181
2277
  <result-list
2182
2278
  style=${`width: ${this.#o.value}%; border-right: 1px solid var(--border);`}
2183
- .results=${this.#d.value}
2279
+ .results=${this.#h.value}
2184
2280
  .showFolder=${t.length>1}
2185
- .onSelect=${s=>this.#ye(s)}
2186
- .selectedIds=${this.#f.value}
2187
- .onToggleSelect=${s=>this.#Te(s)}
2188
- .onKeyClick=${s=>this.#K(s)}
2281
+ .onSelect=${i=>this.#ye(i)}
2282
+ .selectedIds=${this.#u.value}
2283
+ .onToggleSelect=${i=>this.#Ae(i)}
2284
+ .onKeyClick=${i=>this.#K(i)}
2189
2285
  ></result-list>
2190
2286
  <div
2191
- class="splitter ${this.#y.value?"dragging":""}"
2192
- @pointerdown=${s=>this.#N(s)}
2287
+ class="splitter ${this.#k.value?"dragging":""}"
2288
+ @pointerdown=${i=>this.#M(i)}
2193
2289
  ></div>
2194
2290
  <detail-panel
2195
- .selected=${this.#i.value}
2291
+ .selected=${this.#s.value}
2196
2292
  .facets=${e}
2197
- .onChanged=${()=>{this.#c(),this.#S()}}
2198
- .onTagClick=${s=>this.#be(s)}
2199
- .onFolderClick=${s=>this.#me(s)}
2200
- .onDateClick=${s=>this.#ae(s)}
2201
- .onKeyClick=${s=>this.#K(s)}
2293
+ .onChanged=${()=>{this.#d(),this.#C()}}
2294
+ .onTagClick=${i=>this.#be(i)}
2295
+ .onFolderClick=${i=>this.#me(i)}
2296
+ .onDateClick=${i=>this.#ae(i)}
2297
+ .onKeyClick=${i=>this.#K(i)}
2202
2298
  ></detail-panel>
2203
2299
  </div>
2204
- ${this.#p.value?c`<add-folder-modal
2300
+ ${this.#f.value?l`<add-folder-modal
2205
2301
  .defaultKind=${"skill"}
2206
2302
  .lockKind=${!1}
2207
- .onAdded=${()=>this.#ne()}
2208
- .onCancel=${()=>this.#p.set(!1)}
2303
+ .onAdded=${()=>this.#re()}
2304
+ .onCancel=${()=>this.#f.set(!1)}
2209
2305
  ></add-folder-modal>`:""}
2210
- `}}customElements.define("mem-bucket-app",ln);
2306
+ `}}customElements.define("mem-bucket-app",hn);