mcp-memory-bucket 0.11.1 → 0.12.1

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 as="modulepreload",ls=function(n){return"/"+n},He={},ae=function(e,t,s){let i=Promise.resolve();if(t&&t.length>0){let o=function(d){return Promise.all(d.map(u=>Promise.resolve(u).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),c=a?.nonce||a?.getAttribute("nonce");i=o(t.map(d=>{if(d=ls(d),d in He)return;He[d]=!0;const u=d.endsWith(".css"),p=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${p}`))return;const g=document.createElement("link");if(g.rel=u?"stylesheet":as,u||(g.as="script"),g.crossOrigin="",g.href=d,c&&g.setAttribute("nonce",c),document.head.appendChild(g),u)return new Promise((x,m)=>{g.addEventListener("load",x),g.addEventListener("error",()=>m(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 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 ls="modulepreload",cs=function(n){return"/"+n},He={},ae=function(e,t,s){let i=Promise.resolve();if(t&&t.length>0){let o=function(d){return Promise.all(d.map(u=>Promise.resolve(u).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),c=a?.nonce||a?.getAttribute("nonce");i=o(t.map(d=>{if(d=cs(d),d in He)return;He[d]=!0;const u=d.endsWith(".css"),p=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${p}`))return;const g=document.createElement("link");if(g.rel=u?"stylesheet":ls,u||(g.as="script"),g.crossOrigin="",g.href=d,c&&g.setAttribute("nonce",c),document.head.appendChild(g),u)return new Promise((x,m)=>{g.addEventListener("load",x),g.addEventListener("error",()=>m(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)})};/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */const ne=globalThis,Te=ne.ShadowRoot&&(ne.ShadyCSS===void 0||ne.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ae=Symbol(),Ke=new WeakMap;let It=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==Ae)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(Te&&e===void 0){const s=t!==void 0&&t.length===1;s&&(e=Ke.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&Ke.set(t,e))}return e}toString(){return this.cssText}};const cs=n=>new It(typeof n=="string"?n:n+"",void 0,Ae),w=(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 It(t,n,Ae)},ds=(n,e)=>{if(Te)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const s=document.createElement("style"),i=ne.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=t.cssText,n.appendChild(s)}},Ve=Te?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return cs(t)})(n):n;/**
5
+ */const ne=globalThis,Te=ne.ShadowRoot&&(ne.ShadyCSS===void 0||ne.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ae=Symbol(),Ke=new WeakMap;let Lt=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==Ae)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(Te&&e===void 0){const s=t!==void 0&&t.length===1;s&&(e=Ke.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&Ke.set(t,e))}return e}toString(){return this.cssText}};const ds=n=>new Lt(typeof n=="string"?n:n+"",void 0,Ae),$=(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 Lt(t,n,Ae)},hs=(n,e)=>{if(Te)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const s=document.createElement("style"),i=ne.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=t.cssText,n.appendChild(s)}},Ve=Te?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return ds(t)})(n):n;/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:hs,defineProperty:ps,getOwnPropertyDescriptor:us,getOwnPropertyNames:fs,getOwnPropertySymbols:gs,getPrototypeOf:bs}=Object,pe=globalThis,Ge=pe.trustedTypes,ms=Ge?Ge.emptyScript:"",vs=pe.reactiveElementPolyfillSupport,Q=(n,e)=>n,ye={toAttribute(n,e){switch(e){case Boolean:n=n?ms: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}},Lt=(n,e)=>!hs(n,e),We={attribute:!0,type:String,converter:ye,reflect:!1,useDefault:!1,hasChanged:Lt};Symbol.metadata??=Symbol("metadata"),pe.litPropertyMetadata??=new WeakMap;let B=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=We){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&&ps(this.prototype,e,i)}}static getPropertyDescriptor(e,t,s){const{get:i,set:r}=us(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)??We}static _$Ei(){if(this.hasOwnProperty(Q("elementProperties")))return;const e=bs(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Q("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Q("properties"))){const t=this.properties,s=[...fs(t),...gs(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(Ve(i))}else e!==void 0&&t.push(Ve(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 ds(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:ye).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:ye;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??Lt)(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){}};B.elementStyles=[],B.shadowRootOptions={mode:"open"},B[Q("elementProperties")]=new Map,B[Q("finalized")]=new Map,vs?.({ReactiveElement:B}),(pe.reactiveElementVersions??=[]).push("2.1.2");/**
9
+ */const{is:ps,defineProperty:us,getOwnPropertyDescriptor:fs,getOwnPropertyNames:gs,getOwnPropertySymbols:bs,getPrototypeOf:ms}=Object,pe=globalThis,Ge=pe.trustedTypes,vs=Ge?Ge.emptyScript:"",xs=pe.reactiveElementPolyfillSupport,Q=(n,e)=>n,ye={toAttribute(n,e){switch(e){case Boolean:n=n?vs: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}},Ft=(n,e)=>!ps(n,e),We={attribute:!0,type:String,converter:ye,reflect:!1,useDefault:!1,hasChanged:Ft};Symbol.metadata??=Symbol("metadata"),pe.litPropertyMetadata??=new WeakMap;let B=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=We){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&&us(this.prototype,e,i)}}static getPropertyDescriptor(e,t,s){const{get:i,set:r}=fs(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)??We}static _$Ei(){if(this.hasOwnProperty(Q("elementProperties")))return;const e=ms(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Q("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Q("properties"))){const t=this.properties,s=[...gs(t),...bs(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(Ve(i))}else e!==void 0&&t.push(Ve(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 hs(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:ye).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:ye;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??Ft)(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){}};B.elementStyles=[],B.shadowRootOptions={mode:"open"},B[Q("elementProperties")]=new Map,B[Q("finalized")]=new Map,xs?.({ReactiveElement:B}),(pe.reactiveElementVersions??=[]).push("2.1.2");/**
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */const Ee=globalThis,Ze=n=>n,le=Ee.trustedTypes,Je=le?le.createPolicy("lit-html",{createHTML:n=>n}):void 0,Ft="$lit$",z=`lit$${Math.random().toFixed(9).slice(2)}$`,Ot="?"+z,xs=`<${Ot}>`,O=document,X=()=>O.createComment(""),ee=n=>n===null||typeof n!="object"&&typeof n!="function",Re=Array.isArray,ys=n=>Re(n)||typeof n?.[Symbol.iterator]=="function",be=`[
13
+ */const Ee=globalThis,Ze=n=>n,le=Ee.trustedTypes,Je=le?le.createPolicy("lit-html",{createHTML:n=>n}):void 0,Ot="$lit$",z=`lit$${Math.random().toFixed(9).slice(2)}$`,Dt="?"+z,ys=`<${Dt}>`,O=document,X=()=>O.createComment(""),ee=n=>n===null||typeof n!="object"&&typeof n!="function",Re=Array.isArray,ks=n=>Re(n)||typeof n?.[Symbol.iterator]=="function",be=`[
14
14
  \f\r]`,Z=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ye=/-->/g,Qe=/>/g,P=RegExp(`>|${be}(?:([^\\s"'>=/]+)(${be}*=${be}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Xe=/'/g,et=/"/g,Dt=/^(?:script|style|textarea|title)$/i,ks=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),l=ks(1),D=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),tt=new WeakMap,L=O.createTreeWalker(O,129);function Mt(n,e){if(!Re(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Je!==void 0?Je.createHTML(e):e}const $s=(n,e)=>{const t=n.length-1,s=[];let i,r=e===2?"<svg>":e===3?"<math>":"",o=Z;for(let a=0;a<t;a++){const c=n[a];let d,u,p=-1,g=0;for(;g<c.length&&(o.lastIndex=g,u=o.exec(c),u!==null);)g=o.lastIndex,o===Z?u[1]==="!--"?o=Ye:u[1]!==void 0?o=Qe:u[2]!==void 0?(Dt.test(u[2])&&(i=RegExp("</"+u[2],"g")),o=P):u[3]!==void 0&&(o=P):o===P?u[0]===">"?(o=i??Z,p=-1):u[1]===void 0?p=-2:(p=o.lastIndex-u[2].length,d=u[1],o=u[3]===void 0?P:u[3]==='"'?et:Xe):o===et||o===Xe?o=P:o===Ye||o===Qe?o=Z:(o=P,i=void 0);const x=o===P&&n[a+1].startsWith("/>")?" ":"";r+=o===Z?c+xs:p>=0?(s.push(d),c.slice(0,p)+Ft+c.slice(p)+z+x):c+z+(p===-2?a:x)}return[Mt(n,r+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};let ke=class Nt{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let r=0,o=0;const a=e.length-1,c=this.parts,[d,u]=$s(e,t);if(this.el=Nt.createElement(d,s),L.currentNode=this.el.content,t===2||t===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=L.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const p of i.getAttributeNames())if(p.endsWith(Ft)){const g=u[o++],x=i.getAttribute(p).split(z),m=/([.?@])?(.*)/.exec(g);c.push({type:1,index:r,name:m[2],strings:x,ctor:m[1]==="."?_s:m[1]==="?"?Ss:m[1]==="@"?Cs:ue}),i.removeAttribute(p)}else p.startsWith(z)&&(c.push({type:6,index:r}),i.removeAttribute(p));if(Dt.test(i.tagName)){const p=i.textContent.split(z),g=p.length-1;if(g>0){i.textContent=le?le.emptyScript:"";for(let x=0;x<g;x++)i.append(p[x],X()),L.nextNode(),c.push({type:2,index:++r});i.append(p[g],X())}}}else if(i.nodeType===8)if(i.data===Ot)c.push({type:2,index:r});else{let p=-1;for(;(p=i.data.indexOf(z,p+1))!==-1;)c.push({type:7,index:r}),p+=z.length-1}r++}}static createElement(e,t){const s=O.createElement("template");return s.innerHTML=e,s}};function K(n,e,t=n,s){if(e===D)return e;let i=s!==void 0?t._$Co?.[s]:t._$Cl;const r=ee(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=K(n,i._$AS(n,e.values),i,s)),e}let ws=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??O).importNode(t,!0);L.currentNode=i;let r=L.nextNode(),o=0,a=0,c=s[0];for(;c!==void 0;){if(o===c.index){let d;c.type===2?d=new ze(r,r.nextSibling,this,e):c.type===1?d=new c.ctor(r,c.name,c.strings,this,e):c.type===6&&(d=new Ts(r,this,e)),this._$AV.push(d),c=s[++a]}o!==c?.index&&(r=L.nextNode(),o++)}return L.currentNode=O,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++}},ze=class Ut{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,i){this.type=2,this._$AH=f,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=K(this,e,t),ee(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==D&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):ys(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!==f&&ee(this._$AH)?this._$AA.nextSibling.data=e:this.T(O.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=ke.createElement(Mt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const r=new ws(i,this),o=r.u(this.options);r.p(t),this.T(o),this._$AH=r}}_$AC(e){let t=tt.get(e.strings);return t===void 0&&tt.set(e.strings,t=new ke(e)),t}k(e){Re(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 Ut(this.O(X()),this.O(X()),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=Ze(e).nextSibling;Ze(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ue=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,i,r){this.type=1,this._$AH=f,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=f}_$AI(e,t=this,s,i){const r=this.strings;let o=!1;if(r===void 0)e=K(this,e,t,0),o=!ee(e)||e!==this._$AH&&e!==D,o&&(this._$AH=e);else{const a=e;let c,d;for(e=r[0],c=0;c<r.length-1;c++)d=K(this,a[s+c],t,c),d===D&&(d=this._$AH[c]),o||=!ee(d)||d!==this._$AH[c],d===f?e=f:e!==f&&(e+=(d??"")+r[c+1]),this._$AH[c]=d}o&&!i&&this.j(e)}j(e){e===f?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},_s=class extends ue{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===f?void 0:e}},Ss=class extends ue{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==f)}},Cs=class extends ue{constructor(e,t,s,i,r){super(e,t,s,i,r),this.type=5}_$AI(e,t=this){if((e=K(this,e,t,0)??f)===D)return;const s=this._$AH,i=e===f&&s!==f||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,r=e!==f&&(s===f||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)}},Ts=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){K(this,e)}};const As=Ee.litHtmlPolyfillSupport;As?.(ke,ze),(Ee.litHtmlVersions??=[]).push("3.3.3");const Es=(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 ze(e.insertBefore(X(),r),r,void 0,t??{})}return i._$AI(n),i};/**
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Xe=/'/g,et=/"/g,Mt=/^(?:script|style|textarea|title)$/i,ws=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),l=ws(1),D=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),tt=new WeakMap,L=O.createTreeWalker(O,129);function Nt(n,e){if(!Re(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Je!==void 0?Je.createHTML(e):e}const $s=(n,e)=>{const t=n.length-1,s=[];let i,r=e===2?"<svg>":e===3?"<math>":"",o=Z;for(let a=0;a<t;a++){const c=n[a];let d,u,p=-1,g=0;for(;g<c.length&&(o.lastIndex=g,u=o.exec(c),u!==null);)g=o.lastIndex,o===Z?u[1]==="!--"?o=Ye:u[1]!==void 0?o=Qe:u[2]!==void 0?(Mt.test(u[2])&&(i=RegExp("</"+u[2],"g")),o=P):u[3]!==void 0&&(o=P):o===P?u[0]===">"?(o=i??Z,p=-1):u[1]===void 0?p=-2:(p=o.lastIndex-u[2].length,d=u[1],o=u[3]===void 0?P:u[3]==='"'?et:Xe):o===et||o===Xe?o=P:o===Ye||o===Qe?o=Z:(o=P,i=void 0);const x=o===P&&n[a+1].startsWith("/>")?" ":"";r+=o===Z?c+ys:p>=0?(s.push(d),c.slice(0,p)+Ot+c.slice(p)+z+x):c+z+(p===-2?a:x)}return[Nt(n,r+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};let ke=class Ut{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let r=0,o=0;const a=e.length-1,c=this.parts,[d,u]=$s(e,t);if(this.el=Ut.createElement(d,s),L.currentNode=this.el.content,t===2||t===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=L.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const p of i.getAttributeNames())if(p.endsWith(Ot)){const g=u[o++],x=i.getAttribute(p).split(z),m=/([.?@])?(.*)/.exec(g);c.push({type:1,index:r,name:m[2],strings:x,ctor:m[1]==="."?Ss:m[1]==="?"?Cs:m[1]==="@"?Ts:ue}),i.removeAttribute(p)}else p.startsWith(z)&&(c.push({type:6,index:r}),i.removeAttribute(p));if(Mt.test(i.tagName)){const p=i.textContent.split(z),g=p.length-1;if(g>0){i.textContent=le?le.emptyScript:"";for(let x=0;x<g;x++)i.append(p[x],X()),L.nextNode(),c.push({type:2,index:++r});i.append(p[g],X())}}}else if(i.nodeType===8)if(i.data===Dt)c.push({type:2,index:r});else{let p=-1;for(;(p=i.data.indexOf(z,p+1))!==-1;)c.push({type:7,index:r}),p+=z.length-1}r++}}static createElement(e,t){const s=O.createElement("template");return s.innerHTML=e,s}};function K(n,e,t=n,s){if(e===D)return e;let i=s!==void 0?t._$Co?.[s]:t._$Cl;const r=ee(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=K(n,i._$AS(n,e.values),i,s)),e}let _s=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??O).importNode(t,!0);L.currentNode=i;let r=L.nextNode(),o=0,a=0,c=s[0];for(;c!==void 0;){if(o===c.index){let d;c.type===2?d=new ze(r,r.nextSibling,this,e):c.type===1?d=new c.ctor(r,c.name,c.strings,this,e):c.type===6&&(d=new As(r,this,e)),this._$AV.push(d),c=s[++a]}o!==c?.index&&(r=L.nextNode(),o++)}return L.currentNode=O,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++}},ze=class jt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,i){this.type=2,this._$AH=f,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=K(this,e,t),ee(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==D&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):ks(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!==f&&ee(this._$AH)?this._$AA.nextSibling.data=e:this.T(O.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=ke.createElement(Nt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const r=new _s(i,this),o=r.u(this.options);r.p(t),this.T(o),this._$AH=r}}_$AC(e){let t=tt.get(e.strings);return t===void 0&&tt.set(e.strings,t=new ke(e)),t}k(e){Re(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 jt(this.O(X()),this.O(X()),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=Ze(e).nextSibling;Ze(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ue=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,i,r){this.type=1,this._$AH=f,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=f}_$AI(e,t=this,s,i){const r=this.strings;let o=!1;if(r===void 0)e=K(this,e,t,0),o=!ee(e)||e!==this._$AH&&e!==D,o&&(this._$AH=e);else{const a=e;let c,d;for(e=r[0],c=0;c<r.length-1;c++)d=K(this,a[s+c],t,c),d===D&&(d=this._$AH[c]),o||=!ee(d)||d!==this._$AH[c],d===f?e=f:e!==f&&(e+=(d??"")+r[c+1]),this._$AH[c]=d}o&&!i&&this.j(e)}j(e){e===f?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Ss=class extends ue{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===f?void 0:e}},Cs=class extends ue{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==f)}},Ts=class extends ue{constructor(e,t,s,i,r){super(e,t,s,i,r),this.type=5}_$AI(e,t=this){if((e=K(this,e,t,0)??f)===D)return;const s=this._$AH,i=e===f&&s!==f||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,r=e!==f&&(s===f||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)}},As=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){K(this,e)}};const Es=Ee.litHtmlPolyfillSupport;Es?.(ke,ze),(Ee.litHtmlVersions??=[]).push("3.3.3");const Rs=(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 ze(e.insertBefore(X(),r),r,void 0,t??{})}return i._$AI(n),i};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
- */const Pe=globalThis;let k=class extends B{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=Es(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return D}};k._$litElement$=!0,k.finalized=!0,Pe.litElementHydrateSupport?.({LitElement:k});const Rs=Pe.litElementPolyfillSupport;Rs?.({LitElement:k});(Pe.litElementVersions??=[]).push("4.2.2");var jt;let me=0;const st=new Set;function zs(n){me++;try{n()}finally{me--,me===0&&Ps()}}function Ps(){const n=new Set(st);st.clear();for(const e of n)e()}function Is(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function Ls(n){return n&&typeof n.deref=="function"}class Ie{static#e=0;#t;#s;#n=new Set;#r=jt.#e++;name;constructor(e,t){this.#t=e,this.#s=e,this.name=t}_get(){return h.activeConsumer&&h.activeConsumer.track(this),this.#t}_set(e){return Is(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.#n.add(s),()=>this.#n.delete(s)}_notify(){const e=[...this.#n];for(const t of e){let s;if(Ls(t)){if(s=t.deref(),!s){this.#n.delete(t);continue}}else s=t;s()}}get id(){return this.#r}get previousValue(){return this.#s}toString(){return this.name?`${this.constructor.name}(${this.name})`:`${this.constructor.name}#${this.id}`}}jt=Ie;class h extends Ie{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){zs(()=>{this._set(e)})}get value(){return this.get()}set value(e){this.set(e)}update(e){this.set(e(this.get()))}}class it extends Ie{#e;#t=!0;#s=!1;#n=new Map;_debugParent;#r;#u=()=>{this.#t||(this.#t=!0,this._notify())};constructor(e,t,s){super(void 0,t),this.#e=e,this.#r=s?.weak??!0}track(e){if(this.#n.has(e))return;const t=e.subscribe(this.#u,this.#r);this.#n.set(e,t)}dispose(){this.#a()}#a(){for(const e of this.#n.values())e();this.#n.clear()}get(){if(h.activeConsumer&&h.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(),h.push(this);try{const e=this.#e();this._set(e)}finally{h.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 h.activeConsumer||this.get(),s}}class N{#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){h.push(i);try{s.call(this,r)}finally{h.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 Fs=new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"});function Os(n){if(!n)return"unknown age";const e=new Date(n);return Number.isNaN(e.getTime())?"unknown age":Fs.format(e)}function Ds(n){const e=[],t=new Map,s=[];for(const r of n){const o=r._table==="memory_docs"?r.key:r.group;if(!o){s.push(r);continue}t.has(o)||(t.set(o,[]),e.push(o)),t.get(o).push(r)}const i=e.map(r=>({label:r,icon:t.get(r)[0]._table==="memory_docs"?"🔑":"📂",items:t.get(r)}));return s.length>0&&i.push({label:null,icon:s[0]._table==="memory_docs"?"🔑":"📂",items:s}),i}class Ms extends k{static{this.properties={results:{attribute:!1},showFolder:{attribute:!1},onSelect:{attribute:!1},selectedIds:{attribute:!1},onToggleSelect:{attribute:!1},onKeyClick:{attribute:!1},onGroupClick:{attribute:!1}}}static{this.styles=w`
19
+ */const Pe=globalThis;let k=class extends B{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=Rs(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return D}};k._$litElement$=!0,k.finalized=!0,Pe.litElementHydrateSupport?.({LitElement:k});const zs=Pe.litElementPolyfillSupport;zs?.({LitElement:k});(Pe.litElementVersions??=[]).push("4.2.2");var qt;let me=0;const st=new Set;function Ps(n){me++;try{n()}finally{me--,me===0&&Is()}}function Is(){const n=new Set(st);st.clear();for(const e of n)e()}function Ls(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function Fs(n){return n&&typeof n.deref=="function"}class Ie{static#e=0;#t;#s;#n=new Set;#r=qt.#e++;name;constructor(e,t){this.#t=e,this.#s=e,this.name=t}_get(){return h.activeConsumer&&h.activeConsumer.track(this),this.#t}_set(e){return Ls(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.#n.add(s),()=>this.#n.delete(s)}_notify(){const e=[...this.#n];for(const t of e){let s;if(Fs(t)){if(s=t.deref(),!s){this.#n.delete(t);continue}}else s=t;s()}}get id(){return this.#r}get previousValue(){return this.#s}toString(){return this.name?`${this.constructor.name}(${this.name})`:`${this.constructor.name}#${this.id}`}}qt=Ie;class h extends Ie{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){Ps(()=>{this._set(e)})}get value(){return this.get()}set value(e){this.set(e)}update(e){this.set(e(this.get()))}}class it extends Ie{#e;#t=!0;#s=!1;#n=new Map;_debugParent;#r;#u=()=>{this.#t||(this.#t=!0,this._notify())};constructor(e,t,s){super(void 0,t),this.#e=e,this.#r=s?.weak??!0}track(e){if(this.#n.has(e))return;const t=e.subscribe(this.#u,this.#r);this.#n.set(e,t)}dispose(){this.#a()}#a(){for(const e of this.#n.values())e();this.#n.clear()}get(){if(h.activeConsumer&&h.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(),h.push(this);try{const e=this.#e();this._set(e)}finally{h.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 h.activeConsumer||this.get(),s}}class N{#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){h.push(i);try{s.call(this,r)}finally{h.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 Os=new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"});function Ds(n){if(!n)return"unknown age";const e=new Date(n);return Number.isNaN(e.getTime())?"unknown age":Os.format(e)}function Ms(n){const e=[],t=new Map,s=[];for(const r of n){const o=r._table==="memory_docs"?r.key:r.group;if(!o){s.push(r);continue}t.has(o)||(t.set(o,[]),e.push(o)),t.get(o).push(r)}const i=e.map(r=>({label:r,icon:t.get(r)[0]._table==="memory_docs"?"🔑":"📂",items:t.get(r)}));return s.length>0&&i.push({label:null,icon:s[0]._table==="memory_docs"?"🔑":"📂",items:s}),i}class Ns extends k{static{this.properties={results:{attribute:!1},showFolder:{attribute:!1},onSelect:{attribute:!1},selectedIds:{attribute:!1},onToggleSelect:{attribute:!1},onKeyClick:{attribute:!1},onGroupClick:{attribute:!1}}}static{this.styles=$`
21
21
  :host { display: block; }
22
22
  .count-header {
23
23
  padding: 8px 14px;
@@ -81,7 +81,7 @@
81
81
  .empty { padding: 24px; opacity: 0.6; font-size: 13px; }
82
82
  `}render(){return!this.results||this.results.length===0?l`<div class="empty">No results.</div>`:l`
83
83
  <div class="count-header">${this.results.length} result${this.results.length===1?"":"s"}</div>
84
- ${Ds(this.results).map(e=>l`
84
+ ${Ms(this.results).map(e=>l`
85
85
  ${e.label?l`<div class="key-group-header">
86
86
  ${e.icon}
87
87
  <button
@@ -115,7 +115,7 @@
115
115
  >
116
116
  ${e.name}
117
117
  </span>
118
- <span class="meta">${Os(e.created_at)} · ${e.owner??"—"} · ${e.status}</span>
118
+ <span class="meta">${Ds(e.created_at)} · ${e.owner??"—"} · ${e.status}</span>
119
119
  </div>
120
120
  ${e._table==="memory_docs"&&e.key?l`<div class="key-line">🔑 ${e.key}</div>`:""}
121
121
  ${e._table==="skills"&&e.group?l`<div class="key-line">
@@ -137,12 +137,12 @@
137
137
  </div>
138
138
  </div>
139
139
  </div>
140
- `}}customElements.define("result-list",Ms);function Le(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var U=Le();function qt(n){U=n}var I={exec:()=>null};function j(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 b(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($.caret,"$1"),t=t.replace(i,o),s},getRegex:()=>new RegExp(t,e)};return s}var Ns=((n="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+n)}catch{return!1}})(),$={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:j(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:j(n=>new RegExp(`^ {0,${n}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:j(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:j(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:j(n=>new RegExp(`^ {0,${n}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:j(n=>new RegExp(`^ {0,${n}}>`))},Us=/^(?:[ \t]*(?:\n|$))+/,js=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,qs=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,te=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Bs=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Fe=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Bt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ht=b(Bt).replace(/bull/g,Fe).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(),Hs=b(Bt).replace(/bull/g,Fe).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(),Oe=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Ks=/^[^\n]+/,De=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Vs=b(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",De).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Gs=b(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Fe).getRegex(),fe="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",Me=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ws=b("^ {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",Me).replace("tag",fe).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Kt=n=>b(Oe).replace("hr",te).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",fe).getRegex(),Zs=Kt(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Js=Kt(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Ys=b(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Js).getRegex(),Ne={blockquote:Ys,code:js,def:Vs,fences:qs,heading:Bs,hr:te,html:Ws,lheading:Ht,list:Gs,newline:Us,paragraph:Zs,table:I,text:Ks},rt=b("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",te).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",fe).getRegex(),Qs={...Ne,lheading:Hs,table:rt,paragraph:b(Oe).replace("hr",te).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",rt).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",fe).getRegex()},Xs={...Ne,html:b(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Me).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:I,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:b(Oe).replace("hr",te).replace("heading",` *#{1,6} *[^
141
- ]`).replace("lheading",Ht).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ei=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ti=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Vt=/^( {2,}|\\)\n(?!\s*$)/,si=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,E=/[\p{P}\p{S}]/u,V=/[\s\p{P}\p{S}]/u,se=/[^\s\p{P}\p{S}]/u,ii=b(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,V).getRegex(),ri=/[\p{Pi}\p{Ps}"']/u,Gt=/(?!~)[\p{P}\p{S}]/u,ni=/(?!~)[\s\p{P}\p{S}]/u,oi=/(?:[^\s\p{P}\p{S}]|~)/u,ai=b(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Ns?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Wt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,li=b(Wt,"u").replace(/punct/g,E).getRegex(),ci=b(Wt,"u").replace(/punct/g,Gt).getRegex(),di=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,hi=b(di,"u").replace(/openQuote/g,ri).replace(/punct/g,E).getRegex(),Zt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",pi=b(Zt,"gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,V).replace(/punct/g,E).getRegex(),ui=b(Zt,"gu").replace(/notPunctSpace/g,oi).replace(/punctSpace/g,ni).replace(/punct/g,Gt).getRegex(),fi="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",gi=b(fi,"gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,V).replace(/punct/g,E).getRegex(),bi=b("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,V).replace(/punct/g,E).getRegex(),mi="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",vi=b(mi,"gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,V).replace(/punct/g,E).getRegex(),xi=b(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,E).getRegex(),yi="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",ki=b(yi,"gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,V).replace(/punct/g,E).getRegex(),$i=b(/\\(punct)/,"gu").replace(/punct/g,E).getRegex(),wi=b(/^<(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(),_i=b(Me).replace("(?:-->|$)","-->").getRegex(),Si=b("^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",_i).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ce=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Ci=b(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ce).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Jt=b(/^!?\[(label)\]\[(ref)\]/).replace("label",ce).replace("ref",De).getRegex(),Yt=b(/^!?\[(ref)\](?:\[\])?/).replace("ref",De).getRegex(),Ti=b("reflink|nolink(?!\\()","g").replace("reflink",Jt).replace("nolink",Yt).getRegex(),nt=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ue={_backpedal:I,anyPunctuation:$i,autolink:wi,blockSkip:ai,br:Vt,code:ti,del:I,delLDelim:I,delRDelim:I,emStrongLDelim:li,emStrongRDelimAst:pi,emStrongRDelimUnd:bi,escape:ei,link:Ci,nolink:Yt,punctuation:ii,reflink:Jt,reflinkSearch:Ti,tag:Si,text:si,url:I},Ai={...Ue,emStrongLDelim:hi,emStrongRDelimAst:gi,emStrongRDelimUnd:vi,link:b(/^!?\[(label)\]\((.*?)\)/).replace("label",ce).getRegex(),reflink:b(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ce).getRegex()},$e={...Ue,emStrongRDelimAst:ui,emStrongLDelim:ci,delLDelim:xi,delRDelim:ki,url:b(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",nt).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:b(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",nt).getRegex()},Ei={...$e,br:b(Vt).replace("{2,}","*").getRegex(),text:b($e.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ie={normal:Ne,gfm:Qs,pedantic:Xs},J={normal:Ue,gfm:$e,breaks:Ei,pedantic:Ai},Ri={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ot=n=>Ri[n];function A(n,e){if(e){if($.escapeTest.test(n))return n.replace($.escapeReplace,ot)}else if($.escapeTestNoEncode.test(n))return n.replace($.escapeReplaceNoEncode,ot);return n}function at(n){try{n=encodeURI(n).replace($.percentDecode,"%")}catch{return null}return n}function lt(n,e){let t=n.replace($.findPipe,(r,o,a)=>{let c=!1,d=o;for(;--d>=0&&a[d]==="\\";)c=!c;return c?"|":" |"}),s=t.split($.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($.slashPipe,"|");return s}function R(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 ct(n){let e=n.split(`
142
- `),t=e.length-1;for(;t>=0&&$.blankLine.test(e[t]);)t--;return e.length-t<=2?n:e.slice(0,t+1).join(`
143
- `)}function zi(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 Pi(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 dt(n,e,t,s,i){let r=e.href,o=e.title||null,a=n[1].replace(i.other.outputLinkReplace,"$1"),c=n[0].charAt(0)==="!";s.state.inLink=!0;let d=s.state.linkEmitted,u=s.state.inRawBlock;s.state.linkEmitted=!1;let p=s.inlineTokens(a),g=s.state.linkEmitted;if(s.state.linkEmitted=d,s.state.inLink=!1,!c){if(g){s.state.inRawBlock=u;return}s.state.linkEmitted=!0}return{type:c?"image":"link",raw:t,href:r,title:o,text:a,tokens:p}}function Ii(n,e,t){let s=n.match(t.other.indentCodeCompensation);if(s===null)return e;let i=s[1];return e.split(`
140
+ `}}customElements.define("result-list",Ns);function Le(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var U=Le();function Bt(n){U=n}var I={exec:()=>null};function j(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 b(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(w.caret,"$1"),t=t.replace(i,o),s},getRegex:()=>new RegExp(t,e)};return s}var Us=((n="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+n)}catch{return!1}})(),w={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:j(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:j(n=>new RegExp(`^ {0,${n}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:j(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:j(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:j(n=>new RegExp(`^ {0,${n}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:j(n=>new RegExp(`^ {0,${n}}>`))},js=/^(?:[ \t]*(?:\n|$))+/,qs=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Bs=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,te=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Hs=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Fe=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Ht=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Kt=b(Ht).replace(/bull/g,Fe).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(),Ks=b(Ht).replace(/bull/g,Fe).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(),Oe=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Vs=/^[^\n]+/,De=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Gs=b(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",De).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ws=b(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Fe).getRegex(),fe="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",Me=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Zs=b("^ {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",Me).replace("tag",fe).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Vt=n=>b(Oe).replace("hr",te).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",fe).getRegex(),Js=Vt(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Ys=Vt(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Qs=b(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ys).getRegex(),Ne={blockquote:Qs,code:qs,def:Gs,fences:Bs,heading:Hs,hr:te,html:Zs,lheading:Kt,list:Ws,newline:js,paragraph:Js,table:I,text:Vs},rt=b("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",te).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",fe).getRegex(),Xs={...Ne,lheading:Ks,table:rt,paragraph:b(Oe).replace("hr",te).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",rt).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",fe).getRegex()},ei={...Ne,html:b(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Me).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:I,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:b(Oe).replace("hr",te).replace("heading",` *#{1,6} *[^
141
+ ]`).replace("lheading",Kt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ti=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,si=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Gt=/^( {2,}|\\)\n(?!\s*$)/,ii=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,E=/[\p{P}\p{S}]/u,V=/[\s\p{P}\p{S}]/u,se=/[^\s\p{P}\p{S}]/u,ri=b(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,V).getRegex(),ni=/[\p{Pi}\p{Ps}"']/u,Wt=/(?!~)[\p{P}\p{S}]/u,oi=/(?!~)[\s\p{P}\p{S}]/u,ai=/(?:[^\s\p{P}\p{S}]|~)/u,li=b(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Us?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Zt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ci=b(Zt,"u").replace(/punct/g,E).getRegex(),di=b(Zt,"u").replace(/punct/g,Wt).getRegex(),hi=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,pi=b(hi,"u").replace(/openQuote/g,ni).replace(/punct/g,E).getRegex(),Jt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ui=b(Jt,"gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,V).replace(/punct/g,E).getRegex(),fi=b(Jt,"gu").replace(/notPunctSpace/g,ai).replace(/punctSpace/g,oi).replace(/punct/g,Wt).getRegex(),gi="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",bi=b(gi,"gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,V).replace(/punct/g,E).getRegex(),mi=b("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,V).replace(/punct/g,E).getRegex(),vi="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",xi=b(vi,"gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,V).replace(/punct/g,E).getRegex(),yi=b(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,E).getRegex(),ki="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",wi=b(ki,"gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,V).replace(/punct/g,E).getRegex(),$i=b(/\\(punct)/,"gu").replace(/punct/g,E).getRegex(),_i=b(/^<(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(),Si=b(Me).replace("(?:-->|$)","-->").getRegex(),Ci=b("^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",Si).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ce=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Ti=b(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ce).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Yt=b(/^!?\[(label)\]\[(ref)\]/).replace("label",ce).replace("ref",De).getRegex(),Qt=b(/^!?\[(ref)\](?:\[\])?/).replace("ref",De).getRegex(),Ai=b("reflink|nolink(?!\\()","g").replace("reflink",Yt).replace("nolink",Qt).getRegex(),nt=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ue={_backpedal:I,anyPunctuation:$i,autolink:_i,blockSkip:li,br:Gt,code:si,del:I,delLDelim:I,delRDelim:I,emStrongLDelim:ci,emStrongRDelimAst:ui,emStrongRDelimUnd:mi,escape:ti,link:Ti,nolink:Qt,punctuation:ri,reflink:Yt,reflinkSearch:Ai,tag:Ci,text:ii,url:I},Ei={...Ue,emStrongLDelim:pi,emStrongRDelimAst:bi,emStrongRDelimUnd:xi,link:b(/^!?\[(label)\]\((.*?)\)/).replace("label",ce).getRegex(),reflink:b(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ce).getRegex()},we={...Ue,emStrongRDelimAst:fi,emStrongLDelim:di,delLDelim:yi,delRDelim:wi,url:b(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",nt).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:b(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",nt).getRegex()},Ri={...we,br:b(Gt).replace("{2,}","*").getRegex(),text:b(we.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ie={normal:Ne,gfm:Xs,pedantic:ei},J={normal:Ue,gfm:we,breaks:Ri,pedantic:Ei},zi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ot=n=>zi[n];function A(n,e){if(e){if(w.escapeTest.test(n))return n.replace(w.escapeReplace,ot)}else if(w.escapeTestNoEncode.test(n))return n.replace(w.escapeReplaceNoEncode,ot);return n}function at(n){try{n=encodeURI(n).replace(w.percentDecode,"%")}catch{return null}return n}function lt(n,e){let t=n.replace(w.findPipe,(r,o,a)=>{let c=!1,d=o;for(;--d>=0&&a[d]==="\\";)c=!c;return c?"|":" |"}),s=t.split(w.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(w.slashPipe,"|");return s}function R(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 ct(n){let e=n.split(`
142
+ `),t=e.length-1;for(;t>=0&&w.blankLine.test(e[t]);)t--;return e.length-t<=2?n:e.slice(0,t+1).join(`
143
+ `)}function Pi(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 Ii(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 dt(n,e,t,s,i){let r=e.href,o=e.title||null,a=n[1].replace(i.other.outputLinkReplace,"$1"),c=n[0].charAt(0)==="!";s.state.inLink=!0;let d=s.state.linkEmitted,u=s.state.inRawBlock;s.state.linkEmitted=!1;let p=s.inlineTokens(a),g=s.state.linkEmitted;if(s.state.linkEmitted=d,s.state.inLink=!1,!c){if(g){s.state.inRawBlock=u;return}s.state.linkEmitted=!0}return{type:c?"image":"link",raw:t,href:r,title:o,text:a,tokens:p}}function Li(n,e,t){let s=n.match(t.other.indentCodeCompensation);if(s===null)return e;let i=s[1];return e.split(`
144
144
  `).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(`
145
- `)}var de=class{options;rules;lexer;constructor(n){this.options=n||U}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]:ct(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=Ii(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=R(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:R(e[0],`
145
+ `)}var de=class{options;rules;lexer;constructor(n){this.options=n||U}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]:ct(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=Li(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=R(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:R(e[0],`
146
146
  `),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:R(e[0],`
147
147
  `)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=R(e[0],`
148
148
  `).split(`
@@ -156,11 +156,11 @@ ${u}`:u;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
156
156
  ${m}`,i=i.substring(0,i.length-x.text.length)+G.text;break}else if(g?.type==="list"){let x=g,m=x.raw+`
157
157
  `+t.join(`
158
158
  `),T=this.list(m);r[r.length-1]=T,s=s.substring(0,s.length-g.raw.length)+T.raw,i=i.substring(0,i.length-x.raw.length)+T.raw,t=m.substring(r.at(-1).raw.length).split(`
159
- `);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 c=!1,d="",u="";if(!(e=r.exec(n))||this.rules.block.hr.test(n))break;d=e[0],n=n.substring(d.length);let p=Pi(e[2].split(`
159
+ `);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 c=!1,d="",u="";if(!(e=r.exec(n))||this.rules.block.hr.test(n))break;d=e[0],n=n.substring(d.length);let p=Ii(e[2].split(`
160
160
  `,1)[0],e[1].length),g=n.split(`
161
161
  `,1)[0],x=!p.trim(),m=0;if(this.options.pedantic?(m=2,u=p.trimStart()):x?m=e[1].length+1:(m=p.search(this.rules.other.nonSpaceChar),m=m>4?1:m,u=p.slice(m),m+=e[1].length),x&&this.rules.other.blankLine.test(g)&&(d+=g+`
162
- `,n=n.substring(g.length+1),c=!0),!c){let T=this.rules.other.nextBulletRegex(m),G=this.rules.other.hrRegex(m),qe=this.rules.other.fencesBeginRegex(m),Be=this.rules.other.headingBeginRegex(m),ns=this.rules.other.htmlBeginRegex(m),os=this.rules.other.blockquoteBeginRegex(m);for(;n;){let ge=n.split(`
163
- `,1)[0],W;if(g=ge,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),W=g):W=g.replace(this.rules.other.tabCharGlobal," "),qe.test(g)||Be.test(g)||ns.test(g)||os.test(g)||T.test(g)||G.test(g))break;if(W.search(this.rules.other.nonSpaceChar)>=m||!g.trim())u+=`
162
+ `,n=n.substring(g.length+1),c=!0),!c){let T=this.rules.other.nextBulletRegex(m),G=this.rules.other.hrRegex(m),qe=this.rules.other.fencesBeginRegex(m),Be=this.rules.other.headingBeginRegex(m),os=this.rules.other.htmlBeginRegex(m),as=this.rules.other.blockquoteBeginRegex(m);for(;n;){let ge=n.split(`
163
+ `,1)[0],W;if(g=ge,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),W=g):W=g.replace(this.rules.other.tabCharGlobal," "),qe.test(g)||Be.test(g)||os.test(g)||as.test(g)||T.test(g)||G.test(g))break;if(W.search(this.rules.other.nonSpaceChar)>=m||!g.trim())u+=`
164
164
  `+W.slice(m);else{if(x||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||qe.test(p)||Be.test(p)||G.test(p))break;u+=`
165
165
  `+g}x=!g.trim(),d+=ge+`
166
166
  `,n=n.substring(ge.length+1),p=W.slice(m)}}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(u),loose:!1,text:u,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 c of i.items)if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),!i.loose){let d=c.tokens.filter(p=>p.type==="space"),u=d.length>0&&d.some(p=>this.rules.other.anyLine.test(p.raw));i.loose=u}for(let c of i.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 p=this.lexer.inlineQueue.length-1;p>=0;p--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[p].src)){this.lexer.inlineQueue[p].src=this.lexer.inlineQueue[p].src.replace(this.rules.other.listReplaceTask,"");break}let u=this.rules.other.listTaskCheckbox.exec(c.raw);if(u){let p={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};c.checked=p.checked,i.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=p.raw+c.tokens[0].raw,c.tokens[0].text=p.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(p)):c.tokens.unshift({type:"paragraph",raw:p.raw,text:p.raw,tokens:[p]}):c.tokens.unshift(p)}}else c.task&&(c.task=!1)}if(i.loose)for(let c of i.items){c.loose=!0;for(let d of c.tokens)d.type==="text"&&(d.type="paragraph")}return i}}html(n){let e=this.rules.block.html.exec(n);if(e){let t=ct(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:R(e[0],`
@@ -168,8 +168,8 @@ ${m}`,i=i.substring(0,i.length-x.text.length)+G.text;break}else if(g?.type==="li
168
168
  `):[],r={type:"table",raw:R(e[0],`
169
169
  `),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(lt(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:R(e[0],`
170
170
  `),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)===`
171
- `?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=R(t.slice(0,-1),"\\");if((t.length-r.length)%2===0)return}else{let r=zi(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)),dt(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 dt(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,c=0,d=s[0][0],u=t===d,p=d==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,e=e.slice(-1*n.length+i);(s=p.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)){c+=o;continue}if(u)break}if(a-=o,a>0)continue;o=Math.min(o,o+a+c);let g=[...s[0]][0].length,x=n.slice(0,i+s.index+g+o);if(Math.min(i,o)%2){let T=x.slice(1,-1);return{type:"em",raw:x,text:T,tokens:this.lexer.inlineTokens(T)}}let m=x.slice(2,-2);return{type:"strong",raw:x,text:m,tokens:this.lexer.inlineTokens(m)}}}}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,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*n.length+i);(s=c.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,u=n.slice(0,i+s.index+d+o),p=u.slice(i,-i);return{type:"del",raw:u,text:p,tokens:this.lexer.inlineTokens(p)}}}}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}}}},S=class we{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||U,this.options.tokenizer=this.options.tokenizer||new de,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:$,block:ie.normal,inline:J.normal};this.options.pedantic?(t.block=ie.pedantic,t.inline=J.pedantic):this.options.gfm&&(t.block=ie.gfm,this.options.breaks?t.inline=J.breaks:t.inline=J.gfm),this.tokenizer.rules=t}static get rules(){return{block:ie,inline:J}}static lex(e,t){return new we(t).lex(e)}static lexInline(e,t){return new we(t).inlineTokens(e)}lex(e){e=e.replace($.carriageReturn,`
172
- `),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($.tabCharGlobal," ").replace($.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+=`
171
+ `?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=R(t.slice(0,-1),"\\");if((t.length-r.length)%2===0)return}else{let r=Pi(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)),dt(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 dt(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,c=0,d=s[0][0],u=t===d,p=d==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,e=e.slice(-1*n.length+i);(s=p.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)){c+=o;continue}if(u)break}if(a-=o,a>0)continue;o=Math.min(o,o+a+c);let g=[...s[0]][0].length,x=n.slice(0,i+s.index+g+o);if(Math.min(i,o)%2){let T=x.slice(1,-1);return{type:"em",raw:x,text:T,tokens:this.lexer.inlineTokens(T)}}let m=x.slice(2,-2);return{type:"strong",raw:x,text:m,tokens:this.lexer.inlineTokens(m)}}}}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,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*n.length+i);(s=c.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,u=n.slice(0,i+s.index+d+o),p=u.slice(i,-i);return{type:"del",raw:u,text:p,tokens:this.lexer.inlineTokens(p)}}}}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}}}},S=class $e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||U,this.options.tokenizer=this.options.tokenizer||new de,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:w,block:ie.normal,inline:J.normal};this.options.pedantic?(t.block=ie.pedantic,t.inline=J.pedantic):this.options.gfm&&(t.block=ie.gfm,this.options.breaks?t.inline=J.breaks:t.inline=J.gfm),this.tokenizer.rules=t}static get rules(){return{block:ie,inline:J}}static lex(e,t){return new $e(t).lex(e)}static lexInline(e,t){return new $e(t).inlineTokens(e)}lex(e){e=e.replace(w.carriageReturn,`
172
+ `),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(w.tabCharGlobal," ").replace(w.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+=`
173
173
  `: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(`
174
174
  `)?"":`
175
175
  `)+r.raw,a.text+=`
@@ -182,7 +182,7 @@ ${m}`,i=i.substring(0,i.length-x.text.length)+G.text;break}else if(g?.type==="li
182
182
  `+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(`
183
183
  `)?"":`
184
184
  `)+r.raw,a.text+=`
185
- `+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,c=d=>{let u=d.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,d.slice(u+1,-1)))return d;if(u>1&&d.charAt(0)!=="!"){let p=d.slice(1,u-1);if(this.linkInText(p))return"["+p.replace(a,c)+"]["+"a".repeat(d.length-u-2)+"]"}return"["+"a".repeat(d.length-2)+"]"};s=s.replace(a,c)}s=s.replace(this.tokenizer.rules.inline.anyPunctuation,a=>"+".repeat(a.length)),s=s.replace(this.tokenizer.rules.inline.blockSkip,(a,c,d)=>{let u=d?d.length:0;return a.slice(0,u)+"["+"a".repeat(a.length-u-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 c=e;if(this.options.extensions?.startInline){let d=1/0,u=e.slice(1),p;this.options.extensions.startInline.forEach(g=>{p=g.call({lexer:this},u),typeof p=="number"&&p>=0&&(d=Math.min(d,p))}),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)),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)}},he=class{options;parser;constructor(n){this.options=n||U}space(n){return""}code({text:n,lang:e,escaped:t}){let s=(e||"").match($.notSpaceStart)?.[0],i=n.replace($.endingNewline,"")+`
185
+ `+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,c=d=>{let u=d.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,d.slice(u+1,-1)))return d;if(u>1&&d.charAt(0)!=="!"){let p=d.slice(1,u-1);if(this.linkInText(p))return"["+p.replace(a,c)+"]["+"a".repeat(d.length-u-2)+"]"}return"["+"a".repeat(d.length-2)+"]"};s=s.replace(a,c)}s=s.replace(this.tokenizer.rules.inline.anyPunctuation,a=>"+".repeat(a.length)),s=s.replace(this.tokenizer.rules.inline.blockSkip,(a,c,d)=>{let u=d?d.length:0;return a.slice(0,u)+"["+"a".repeat(a.length-u-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 c=e;if(this.options.extensions?.startInline){let d=1/0,u=e.slice(1),p;this.options.extensions.startInline.forEach(g=>{p=g.call({lexer:this},u),typeof p=="number"&&p>=0&&(d=Math.min(d,p))}),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)),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)}},he=class{options;parser;constructor(n){this.options=n||U}space(n){return""}code({text:n,lang:e,escaped:t}){let s=(e||"").match(w.notSpaceStart)?.[0],i=n.replace(w.endingNewline,"")+`
186
186
  `;return s?'<pre><code class="language-'+A(s)+'">'+(t?i:A(i,!0))+`</code></pre>
187
187
  `:"<pre><code>"+(t?i:A(i,!0))+`</code></pre>
188
188
  `}blockquote({tokens:n}){return`<blockquote>
@@ -200,16 +200,16 @@ ${this.parser.parse(n)}</blockquote>
200
200
  `}tablerow({text:n}){return`<tr>
201
201
  ${n}</tr>
202
202
  `}tablecell(n){let e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
203
- `}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>${A(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=at(n);if(i===null)return s;n=i;let r='<a href="'+n+'"';return e&&(r+=' title="'+A(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=at(n);if(i===null)return A(t);n=i;let r=`<img src="${n}" alt="${A(t)}"`;return e&&(r+=` title="${A(e)}"`),r+=">",r}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:A(n.text)}},je=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}},C=class _e{options;renderer;textRenderer;constructor(e){this.options=e||U,this.options.renderer=this.options.renderer||new he,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new je}static parse(e,t){return new _e(t).parse(e)}static parseInline(e,t){return new _e(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}},Y=class{options;block;constructor(n){this.options=n||U}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?S.lex:S.lexInline}provideParser(n=this.block){return n?C.parse:C.parseInline}},Li=class{defaults=Le();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=C;Renderer=he;TextRenderer=je;Lexer=S;Tokenizer=de;Hooks=Y;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 he(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],c=i[o];i[o]=(...d)=>{let u=a.apply(i,d);return u===!1&&(u=c.apply(i,d)),u||""}}s.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new de(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],c=i[o];i[o]=(...d)=>{let u=a.apply(i,d);return u===!1&&(u=c.apply(i,d)),u}}s.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new Y;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],c=i[o];Y.passThroughHooks.has(r)?i[o]=d=>{if(this.defaults.async&&Y.passThroughHooksRespectAsync.has(r))return(async()=>{let p=await a.call(i,d);return c.call(i,p)})();let u=a.call(i,d);return c.call(i,u)}:i[o]=(...d)=>{if(this.defaults.async)return(async()=>{let p=await a.apply(i,d);return p===!1&&(p=await c.apply(i,d)),p})();let u=a.apply(i,d);return u===!1&&(u=c.apply(i,d)),u}}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 S.lex(n,e??this.defaults)}parser(n,e){return C.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?S.lex:S.lexInline)(o,i),c=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let d=await(i.hooks?await i.hooks.provideParser(n):n?C.parse:C.parseInline)(c,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?S.lex:S.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?C.parse:C.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+=`
204
- Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error occurred:</p><pre>"+A(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},M=new Li;function v(n,e){return M.parse(n,e)}v.options=v.setOptions=function(n){return M.setOptions(n),v.defaults=M.defaults,qt(v.defaults),v};v.getDefaults=Le;v.defaults=U;function Fi(...n){return M.use(...n),v.defaults=M.defaults,qt(v.defaults),v}v.use=Fi;v.walkTokens=function(n,e){return M.walkTokens(n,e)};v.parseInline=M.parseInline;v.Parser=C;v.parser=C.parse;v.Renderer=he;v.TextRenderer=je;v.Lexer=S;v.lexer=S.lex;v.Tokenizer=de;v.Hooks=Y;v.parse=v;v.options;v.setOptions;v.walkTokens;v.parseInline;C.parse;S.lex;/**
203
+ `}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>${A(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=at(n);if(i===null)return s;n=i;let r='<a href="'+n+'"';return e&&(r+=' title="'+A(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=at(n);if(i===null)return A(t);n=i;let r=`<img src="${n}" alt="${A(t)}"`;return e&&(r+=` title="${A(e)}"`),r+=">",r}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:A(n.text)}},je=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}},C=class _e{options;renderer;textRenderer;constructor(e){this.options=e||U,this.options.renderer=this.options.renderer||new he,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new je}static parse(e,t){return new _e(t).parse(e)}static parseInline(e,t){return new _e(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}},Y=class{options;block;constructor(n){this.options=n||U}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?S.lex:S.lexInline}provideParser(n=this.block){return n?C.parse:C.parseInline}},Fi=class{defaults=Le();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=C;Renderer=he;TextRenderer=je;Lexer=S;Tokenizer=de;Hooks=Y;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 he(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],c=i[o];i[o]=(...d)=>{let u=a.apply(i,d);return u===!1&&(u=c.apply(i,d)),u||""}}s.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new de(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],c=i[o];i[o]=(...d)=>{let u=a.apply(i,d);return u===!1&&(u=c.apply(i,d)),u}}s.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new Y;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],c=i[o];Y.passThroughHooks.has(r)?i[o]=d=>{if(this.defaults.async&&Y.passThroughHooksRespectAsync.has(r))return(async()=>{let p=await a.call(i,d);return c.call(i,p)})();let u=a.call(i,d);return c.call(i,u)}:i[o]=(...d)=>{if(this.defaults.async)return(async()=>{let p=await a.apply(i,d);return p===!1&&(p=await c.apply(i,d)),p})();let u=a.apply(i,d);return u===!1&&(u=c.apply(i,d)),u}}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 S.lex(n,e??this.defaults)}parser(n,e){return C.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?S.lex:S.lexInline)(o,i),c=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let d=await(i.hooks?await i.hooks.provideParser(n):n?C.parse:C.parseInline)(c,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?S.lex:S.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?C.parse:C.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+=`
204
+ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error occurred:</p><pre>"+A(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},M=new Fi;function v(n,e){return M.parse(n,e)}v.options=v.setOptions=function(n){return M.setOptions(n),v.defaults=M.defaults,Bt(v.defaults),v};v.getDefaults=Le;v.defaults=U;function Oi(...n){return M.use(...n),v.defaults=M.defaults,Bt(v.defaults),v}v.use=Oi;v.walkTokens=function(n,e){return M.walkTokens(n,e)};v.parseInline=M.parseInline;v.Parser=C;v.parser=C.parse;v.Renderer=he;v.TextRenderer=je;v.Lexer=S;v.lexer=S.lex;v.Tokenizer=de;v.Hooks=Y;v.parse=v;v.options;v.setOptions;v.walkTokens;v.parseInline;C.parse;S.lex;/**
205
205
  * @license
206
206
  * Copyright 2017 Google LLC
207
207
  * SPDX-License-Identifier: BSD-3-Clause
208
- */const Oi={CHILD:2},Di=n=>(...e)=>({_$litDirective$:n,values:e});class Mi{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)}}/**
208
+ */const Di={CHILD:2},Mi=n=>(...e)=>({_$litDirective$:n,values:e});class Ni{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)}}/**
209
209
  * @license
210
210
  * Copyright 2017 Google LLC
211
211
  * SPDX-License-Identifier: BSD-3-Clause
212
- */class Se extends Mi{constructor(e){if(super(e),this.it=f,e.type!==Oi.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===f||e==null)return this._t=void 0,this.it=e;if(e===D)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:[]}}}Se.directiveName="unsafeHTML",Se.resultType=1;const Ni=Di(Se);let ht=0;class Ui extends k{static{this.properties={tags:{attribute:!1},active:{attribute:!1},onToggle:{attribute:!1},allowCreate:{attribute:!1},width:{attribute:!1}}}#e=new h("");#t=new h(!1);#s=new h(-1);#n;#r;static{this.styles=w`
212
+ */class Se extends Ni{constructor(e){if(super(e),this.it=f,e.type!==Di.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===f||e==null)return this._t=void 0,this.it=e;if(e===D)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:[]}}}Se.directiveName="unsafeHTML",Se.resultType=1;const Ui=Mi(Se);let ht=0;class ji extends k{static{this.properties={tags:{attribute:!1},active:{attribute:!1},onToggle:{attribute:!1},allowCreate:{attribute:!1},width:{attribute:!1}}}#e=new h("");#t=new h(!1);#s=new h(-1);#n;#r;static{this.styles=$`
213
213
  :host {
214
214
  display: inline-block;
215
215
  position: relative;
@@ -323,7 +323,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
323
323
  .option input { margin: 0; pointer-events: none; }
324
324
  .empty { padding: 6px 8px; opacity: 0.6; font-style: italic; font-size: 12px; }
325
325
  .create-option { color: var(--accent); font-style: italic; }
326
- `}constructor(){super(),new N(this),this.tags=[],this.active=[],this.onToggle=()=>{},this.allowCreate=!1,this.#n=`--tag-multiselect-${++ht}`,this.#r=`tag-multiselect-listbox-${ht}`}willUpdate(){this.style.width=this.width??""}#u=e=>{e.composedPath().includes(this)||this.#o()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#u)}disconnectedCallback(){document.removeEventListener("click",this.#u),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()})}#o(){this.#t.set(!1),this.#s.set(-1),this.renderRoot.querySelector(".menu")?.hidePopover()}#d(){this.#t.value?this.#o():(this.#i(),this.renderRoot.querySelector(".input")?.focus())}#g(e){this.#e.set(e.target.value),this.#s.set(-1),this.#i()}#h(e){this.onToggle(e),this.#e.set(""),this.#s.set(-1)}get#c(){if(!this.allowCreate)return!1;const e=this.#e.value.trim();return e.length>0&&!this.tags.includes(e)&&!this.active.includes(e)}#b(e){e.stopPropagation(),this.active.forEach(t=>this.onToggle(t)),this.#e.set(""),this.renderRoot.querySelector(".input")?.focus(),this.#i()}#$(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.#h(s)):this.#c&&(e.preventDefault(),this.#h(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.#o()}render(){const e=this.active,t=this.#a,s=this.#t.value,i=this.#s.value;return l`
326
+ `}constructor(){super(),new N(this),this.tags=[],this.active=[],this.onToggle=()=>{},this.allowCreate=!1,this.#n=`--tag-multiselect-${++ht}`,this.#r=`tag-multiselect-listbox-${ht}`}willUpdate(){this.style.width=this.width??""}#u=e=>{e.composedPath().includes(this)||this.#o()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#u)}disconnectedCallback(){document.removeEventListener("click",this.#u),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()})}#o(){this.#t.set(!1),this.#s.set(-1),this.renderRoot.querySelector(".menu")?.hidePopover()}#d(){this.#t.value?this.#o():(this.#i(),this.renderRoot.querySelector(".input")?.focus())}#g(e){this.#e.set(e.target.value),this.#s.set(-1),this.#i()}#h(e){this.onToggle(e),this.#e.set(""),this.#s.set(-1)}get#c(){if(!this.allowCreate)return!1;const e=this.#e.value.trim();return e.length>0&&!this.tags.includes(e)&&!this.active.includes(e)}#b(e){e.stopPropagation(),this.active.forEach(t=>this.onToggle(t)),this.#e.set(""),this.renderRoot.querySelector(".input")?.focus(),this.#i()}#w(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.#h(s)):this.#c&&(e.preventDefault(),this.#h(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.#o()}render(){const e=this.active,t=this.#a,s=this.#t.value,i=this.#s.value;return l`
327
327
  <div class="field" style=${`anchor-name: ${this.#n}`}>
328
328
  <div class="chips-and-input">
329
329
  ${e.map(r=>l`
@@ -344,7 +344,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
344
344
  @input=${r=>this.#g(r)}
345
345
  @focus=${()=>this.#i()}
346
346
  @click=${()=>this.#i()}
347
- @keydown=${r=>this.#$(r)}
347
+ @keydown=${r=>this.#w(r)}
348
348
  />
349
349
  </div>
350
350
  ${e.length>0?l`<button class="clear-btn" tabindex="-1" @mousedown=${r=>r.preventDefault()} @click=${r=>this.#b(r)}>✕</button>`:""}
@@ -388,7 +388,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
388
388
  </li>
389
389
  `:l`<li class="empty">${this.allowCreate?"Type to create a tag":"No matches"}</li>`}
390
390
  </ul>
391
- `}}customElements.define("tag-multiselect",Ui);let pt=0;class ji extends k{static{this.properties={options:{attribute:!1},value:{attribute:!1},onChange:{attribute:!1}}}#e=new h("");#t=new h(!1);#s=new h(-1);#n;#r;static{this.styles=w`
391
+ `}}customElements.define("tag-multiselect",ji);let pt=0;class qi extends k{static{this.properties={options:{attribute:!1},value:{attribute:!1},onChange:{attribute:!1}}}#e=new h("");#t=new h(!1);#s=new h(-1);#n;#r;static{this.styles=$`
392
392
  :host {
393
393
  display: inline-block;
394
394
  position: relative;
@@ -475,7 +475,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
475
475
  .option.selected { font-weight: 600; }
476
476
  .empty { padding: 6px 8px; opacity: 0.6; font-style: italic; font-size: 12px; }
477
477
  .create-option { color: var(--accent); font-style: italic; }
478
- `}constructor(){super(),new N(this),this.options=[],this.value="",this.onChange=()=>{},this.#n=`--status-select-${++pt}`,this.#r=`status-select-listbox-${pt}`}#u=e=>{e.composedPath().includes(this)||this.#o()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#u)}disconnectedCallback(){document.removeEventListener("click",this.#u),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()})}#o(){this.#t.set(!1),this.#s.set(-1),this.#e.set(this.value),this.renderRoot.querySelector(".menu")?.hidePopover()}#d(){this.#t.value?this.#o():(this.#i(),this.renderRoot.querySelector(".input")?.focus())}#g(e){this.#e.set(e.target.value),this.#s.set(-1),this.#t.value||this.#i()}#h(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}#c(e){const t=this.#h(e);if(!t)return this.#o();this.onChange(t),this.#e.set(t),this.#s.set(-1),this.#o()}get#b(){const e=this.#h(this.#e.value);return e.length>0&&!this.options.some(t=>t.toLowerCase()===e)}get#$(){return this.#a.length+(this.#b?1:0)}#x(e){const t=this.#$;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.#c(i):this.#s.value===s.length&&this.#b?this.#c(this.#e.value):this.#e.value.trim()&&this.#c(this.#e.value)}else e.key==="Escape"&&(e.preventDefault(),this.#o())}render(){const e=this.value,t=this.#a,s=this.#t.value,i=this.#s.value;return l`
478
+ `}constructor(){super(),new N(this),this.options=[],this.value="",this.onChange=()=>{},this.#n=`--status-select-${++pt}`,this.#r=`status-select-listbox-${pt}`}#u=e=>{e.composedPath().includes(this)||this.#o()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#u)}disconnectedCallback(){document.removeEventListener("click",this.#u),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()})}#o(){this.#t.set(!1),this.#s.set(-1),this.#e.set(this.value),this.renderRoot.querySelector(".menu")?.hidePopover()}#d(){this.#t.value?this.#o():(this.#i(),this.renderRoot.querySelector(".input")?.focus())}#g(e){this.#e.set(e.target.value),this.#s.set(-1),this.#t.value||this.#i()}#h(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}#c(e){const t=this.#h(e);if(!t)return this.#o();this.onChange(t),this.#e.set(t),this.#s.set(-1),this.#o()}get#b(){const e=this.#h(this.#e.value);return e.length>0&&!this.options.some(t=>t.toLowerCase()===e)}get#w(){return this.#a.length+(this.#b?1:0)}#x(e){const t=this.#w;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.#c(i):this.#s.value===s.length&&this.#b?this.#c(this.#e.value):this.#e.value.trim()&&this.#c(this.#e.value)}else e.key==="Escape"&&(e.preventDefault(),this.#o())}render(){const e=this.value,t=this.#a,s=this.#t.value,i=this.#s.value;return l`
479
479
  <div class="field" style=${`anchor-name: ${this.#n}`}>
480
480
  <input
481
481
  class="input"
@@ -533,7 +533,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
533
533
  `:""}
534
534
  ${!t.length&&!this.#b?l`<li class="empty">No options</li>`:""}
535
535
  </ul>
536
- `}}customElements.define("status-select",ji);let qi=0;const Bi={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;"},Hi=["top","bottom","left","right"];class Ki extends k{static{this.properties={text:{attribute:!1},placement:{attribute:!1}}}#e;#t=null;static{this.styles=w`
536
+ `}}customElements.define("status-select",qi);let Bi=0;const Hi={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;"},Ki=["top","bottom","left","right"];class Vi extends k{static{this.properties={text:{attribute:!1},placement:{attribute:!1}}}#e;#t=null;static{this.styles=$`
537
537
  :host {
538
538
  display: inline-flex;
539
539
  position: relative;
@@ -617,7 +617,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
617
617
  translate: 0 -50%;
618
618
  margin: 0 0 0 6px;
619
619
  }
620
- `}constructor(){super(),this.text="",this.placement="top",this.#e=`--help-tooltip-${++qi}`}get#s(){const e=Hi.filter(t=>t!==this.placement);return[this.placement,...e].map(t=>`--bubble-${t}`).join(", ")}disconnectedCallback(){this.#t&&clearTimeout(this.#t),super.disconnectedCallback()}#n(){this.#t&&(clearTimeout(this.#t),this.#t=null);const e=this.renderRoot.querySelector(".bubble");e&&!e.matches(":popover-open")&&e.showPopover()}#r(){this.#t=setTimeout(()=>{this.renderRoot.querySelector(".bubble")?.hidePopover()},100)}render(){return l`
620
+ `}constructor(){super(),this.text="",this.placement="top",this.#e=`--help-tooltip-${++Bi}`}get#s(){const e=Ki.filter(t=>t!==this.placement);return[this.placement,...e].map(t=>`--bubble-${t}`).join(", ")}disconnectedCallback(){this.#t&&clearTimeout(this.#t),super.disconnectedCallback()}#n(){this.#t&&(clearTimeout(this.#t),this.#t=null);const e=this.renderRoot.querySelector(".bubble");e&&!e.matches(":popover-open")&&e.showPopover()}#r(){this.#t=setTimeout(()=>{this.renderRoot.querySelector(".bubble")?.hidePopover()},100)}render(){return l`
621
621
  <button
622
622
  type="button"
623
623
  class="icon"
@@ -633,13 +633,13 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
633
633
  role="tooltip"
634
634
  class="bubble"
635
635
  popover="manual"
636
- style=${`position-anchor: ${this.#e}; position-try-fallbacks: ${this.#s}; ${Bi[this.placement]}`}
636
+ style=${`position-anchor: ${this.#e}; position-try-fallbacks: ${this.#s}; ${Hi[this.placement]}`}
637
637
  @mouseenter=${()=>this.#n()}
638
638
  @mouseleave=${()=>this.#r()}
639
639
  >
640
640
  ${this.text}
641
641
  </div>
642
- `}}customElements.define("help-tooltip",Ki);const Ce="mem-bucket-toast",ut=3,Qt=2200;function q(n,e="default",t=Qt){window.dispatchEvent(new CustomEvent(Ce,{detail:{message:n,type:e,timeoutMs:t},bubbles:!0,composed:!0}))}const y={send:q,default:(n,e)=>q(n,"default",e),success:(n,e)=>q(n,"success",e),danger:(n,e)=>q(n,"danger",e),warning:(n,e)=>q(n,"warning",e),info:(n,e)=>q(n,"info",e)},Vi={default:"--fg",success:"--success",danger:"--danger",warning:"--warning",info:"--accent"};class Gi extends k{#e=new h([]);#t=e=>this.#s(e);constructor(){super(),new N(this)}connectedCallback(){super.connectedCallback(),window.addEventListener(Ce,this.#t)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener(Ce,this.#t)}#s(e){const{message:t,type:s="default",timeoutMs:i=Qt}=e.detail,r=Math.random().toString(36).slice(2,11),o=[...this.#e.value,{id:r,type:s,message:t,timeout:i}];this.#e.set(o.length>ut?o.slice(o.length-ut):o),setTimeout(()=>{this.#e.set(this.#e.value.filter(a=>a.id!==r))},i)}static{this.styles=w`
642
+ `}}customElements.define("help-tooltip",Vi);const Ce="mem-bucket-toast",ut=3,Xt=2200;function q(n,e="default",t=Xt){window.dispatchEvent(new CustomEvent(Ce,{detail:{message:n,type:e,timeoutMs:t},bubbles:!0,composed:!0}))}const y={send:q,default:(n,e)=>q(n,"default",e),success:(n,e)=>q(n,"success",e),danger:(n,e)=>q(n,"danger",e),warning:(n,e)=>q(n,"warning",e),info:(n,e)=>q(n,"info",e)},Gi={default:"--fg",success:"--success",danger:"--danger",warning:"--warning",info:"--accent"};class Wi extends k{#e=new h([]);#t=e=>this.#s(e);constructor(){super(),new N(this)}connectedCallback(){super.connectedCallback(),window.addEventListener(Ce,this.#t)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener(Ce,this.#t)}#s(e){const{message:t,type:s="default",timeoutMs:i=Xt}=e.detail,r=Math.random().toString(36).slice(2,11),o=[...this.#e.value,{id:r,type:s,message:t,timeout:i}];this.#e.set(o.length>ut?o.slice(o.length-ut):o),setTimeout(()=>{this.#e.set(this.#e.value.filter(a=>a.id!==r))},i)}static{this.styles=$`
643
643
  :host {
644
644
  position: fixed;
645
645
  top: 14px;
@@ -674,11 +674,11 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
674
674
  `}render(){return l`
675
675
  ${this.#e.value.map(e=>l`
676
676
  <div class="toast">
677
- <span class="dot" style=${`background: var(${Vi[e.type]})`}></span>
677
+ <span class="dot" style=${`background: var(${Gi[e.type]})`}></span>
678
678
  <span>${e.message}</span>
679
679
  </div>
680
680
  `)}
681
- `}}customElements.define("toast-stack",Gi);const ft="mem-bucket-detail-view-mode",Wi=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg"]);function Zi(n){const e=n.lastIndexOf(".");return e===-1?!1:Wi.has(n.slice(e).toLowerCase())}function Ji(n){const e={name:"",children:new Map};for(const t of n){const s=t.filename.split("/").filter(Boolean);let i=e;s.forEach((r,o)=>{const a=o===s.length-1;let c=i.children.get(r);c||(c={name:r,children:new Map},i.children.set(r,c)),a&&(c.entry=t),i=c})}return e}function Yi(n){const e={name:"",children:new Map,isFile:!1};for(const t of n){const s=t.split("/").filter(Boolean);let i=e;s.forEach((r,o)=>{let a=i.children.get(r);a||(a={name:r,children:new Map,isFile:!1},i.children.set(r,a)),o===s.length-1&&(a.isFile=!0),i=a})}return e}function Qi(n){return new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(n))}const Xi=["stable","beta","unreviewed"],er=["active","shipped","abandoned"],gt=["plan","spec","sql","testing-todo","discovery","session-summary","other"],tr=["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.",group:"This skill's primary category — distinct from folder (physical location) and tags (cross-cutting labels). Leave blank if it doesn't belong to a group.",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 bt(n){return{description:n.description??"",tags:n.tags??[],status:n.status??"",name:n.name??"",owner:n.owner??"",extends:n.extends??"",group:n.group??"",trigger_phrases:n.trigger_phrases??[],key:n.key??"",key_type:n.key_type??"",doc_type:n.doc_type??"",related_to:n.related_to??""}}class sr extends k{constructor(){super(...arguments),this._viewMode=localStorage.getItem(ft)??"markdown",this._editing=!1,this._draft=null,this._addingFrontmatter=!1,this._renaming=!1,this._renameValue="",this._viewingAttachment=null,this._sharing=!1,this._shareUsername="",this._shareRole="member",this._shareBusy=!1,this._shareStatus=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},onGroupClick:{attribute:!1},onGone:{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},_sharing:{state:!0},_shareUsername:{state:!0},_shareRole:{state:!0},_shareBusy:{state:!0},_shareStatus:{state:!0}}}static{this.styles=w`
681
+ `}}customElements.define("toast-stack",Wi);const ft="mem-bucket-detail-view-mode",Zi=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg"]);function Ji(n){const e=n.lastIndexOf(".");return e===-1?!1:Zi.has(n.slice(e).toLowerCase())}function gt(n,e){const t={name:"",children:new Map};for(const s of n){const i=s.split("/").filter(Boolean);let r=t;i.forEach((o,a)=>{let c=r.children.get(o);c||(c={name:o,children:new Map},r.children.set(o,c)),a===i.length-1&&(c.leaf=e(s)),r=c})}return t}function Yi(n){return new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(n))}const Qi=["stable","beta","unreviewed"],Xi=["active","shipped","abandoned"],bt=["plan","spec","sql","testing-todo","discovery","session-summary","other"],er=["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.",group:"This skill's primary category — distinct from folder (physical location) and tags (cross-cutting labels). Leave blank if it doesn't belong to a group.",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 mt(n){return{description:n.description??"",tags:n.tags??[],status:n.status??"",name:n.name??"",owner:n.owner??"",extends:n.extends??"",group:n.group??"",trigger_phrases:n.trigger_phrases??[],key:n.key??"",key_type:n.key_type??"",doc_type:n.doc_type??"",related_to:n.related_to??""}}class tr extends k{constructor(){super(...arguments),this._viewMode=localStorage.getItem(ft)??"markdown",this._editing=!1,this._draft=null,this._addingFrontmatter=!1,this._renaming=!1,this._renameValue="",this._viewingAttachment=null,this._sharing=!1,this._shareUsername="",this._shareRole="member",this._shareBusy=!1,this._shareStatus=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},onGroupClick:{attribute:!1},onGone:{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},_sharing:{state:!0},_shareUsername:{state:!0},_shareRole:{state:!0},_shareBusy:{state:!0},_shareStatus:{state:!0}}}static{this.styles=$`
682
682
  :host { display: block; padding: 16px; }
683
683
  h2 { margin: 0 0 4px; font-size: 16px; }
684
684
  .title-row {
@@ -1061,9 +1061,9 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
1061
1061
  }
1062
1062
  .share-links-row { display: flex; gap: 6px; }
1063
1063
  .share-status { font-size: 11px; opacity: 0.75; }
1064
- `}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,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){this._doc=null,this.onGone?.();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(ft,e)}async#n(){const{table:e,id:t}=this.selected,s=!this._doc?.deprecated;if(!(await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/deprecated`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({deprecated:s})})).ok){y.danger("Failed to update status");return}await this.#e(),this.onChanged?.()}async#r(){const{table:e,id:t}=this.selected,s=!this._doc?.paused;if(!(await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/paused`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({paused:s})})).ok){y.danger("Failed to update status");return}await this.#e(),this.onChanged?.()}async#u(e){const{table:t,id:s}=this.selected,i=await e.arrayBuffer(),r=await fetch(`/api/entries/${t}/${encodeURIComponent(s)}/attachments?filename=${encodeURIComponent(e.name)}`,{method:"POST",headers:{"Content-Type":"application/octet-stream"},body:i});if(!r.ok){const{error:o}=await r.json().catch(()=>({error:`upload failed (${r.status})`}));window.alert(o);return}await this.#e(),this.onChanged?.()}#a(e){const t=e.currentTarget,s=t.files?.[0];t.value="",s&&this.#u(s)}async#i(e){if(!window.confirm(`Remove attachment "${e}"? This can't be undone.`))return;const{table:t,id:s}=this.selected;if(!(await fetch(`/api/entries/${t}/${encodeURIComponent(s)}/attachments/${encodeURIComponent(e)}`,{method:"DELETE"})).ok){y.danger("Failed to remove attachment");return}this._viewingAttachment?.filename===e&&(this._viewingAttachment=null),await this.#e(),this.onChanged?.()}#o(){this._sharing=!0,this._shareUsername="",this._shareRole="member",this._shareStatus=null}#d(){this._sharing=!1,this._shareStatus=null}async#g(){if(!this.selected||!this._shareUsername.trim())return;const{table:e,id:t}=this.selected;this._shareBusy=!0,this._shareStatus=null;try{const s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/share`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:this._shareUsername.trim(),role:this._shareRole})}),i=await s.json().catch(()=>({}));this._shareStatus=s.ok?`Shared with ${this._shareUsername.trim()}.`:`Share failed: ${i.error??s.statusText}`,s.ok&&(this._shareUsername="")}finally{this._shareBusy=!1}}async#h(e){if(!this.selected)return;const{table:t,id:s}=this.selected;this._shareBusy=!0,this._shareStatus=null;try{const i=await fetch(`/api/entries/${t}/${encodeURIComponent(s)}/${e}`,{method:"POST"}),r=await i.json().catch(()=>({}));if(!i.ok){this._shareStatus=`Failed to create link: ${r.error??i.statusText}`;return}const o=e==="share-link"?"shareToken":"publicToken",a=new URL(window.location.href);a.search=`?${o}=${encodeURIComponent(r.token)}`;const c=a.toString();try{await navigator.clipboard?.writeText(c),this._shareStatus=`${e==="share-link"?"Share":"Public"} link copied to clipboard.`}catch{this._shareStatus=`Link: ${c}`}}finally{this._shareBusy=!1}}async#c(){if(!window.confirm("Delete this doc? This can't be undone."))return;const{table:e,id:t}=this.selected;if(!(await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"DELETE"})).ok){y.danger("Delete failed");return}this._doc=null,y.success("Deleted"),this.onChanged?.()}#b(){this._doc&&(this._draft=bt(this._doc),this._editing=!0,this._addingFrontmatter=!1)}#$(){this._doc&&(this._draft=bt(this._doc),this._addingFrontmatter=!0,this._editing=!1)}#x(e){this._draft&&(this._draft={...this._draft,doc_type:e},this._addingFrontmatter=!1,this._editing=!0)}#v(){this._editing=!1,this._addingFrontmatter=!1,this._draft=null}#p(e){this._draft&&(this._draft={...this._draft,...e})}#y(e){if(!this._draft)return;const t=this._draft.tags.includes(e)?this._draft.tags.filter(s=>s!==e):[...this._draft.tags,e];this.#p({tags:t})}#w(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.#p({trigger_phrases:t})}async#l(){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.group=this._draft.group||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#k(){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}"?
1064
+ `}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,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){this._doc=null,this.onGone?.();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(ft,e)}async#n(){const{table:e,id:t}=this.selected,s=!this._doc?.deprecated;if(!(await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/deprecated`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({deprecated:s})})).ok){y.danger("Failed to update status");return}await this.#e(),this.onChanged?.()}async#r(){const{table:e,id:t}=this.selected,s=!this._doc?.paused;if(!(await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/paused`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({paused:s})})).ok){y.danger("Failed to update status");return}await this.#e(),this.onChanged?.()}async#u(e){const{table:t,id:s}=this.selected,i=await e.arrayBuffer(),r=await fetch(`/api/entries/${t}/${encodeURIComponent(s)}/attachments?filename=${encodeURIComponent(e.name)}`,{method:"POST",headers:{"Content-Type":"application/octet-stream"},body:i});if(!r.ok){const{error:o}=await r.json().catch(()=>({error:`upload failed (${r.status})`}));window.alert(o);return}await this.#e(),this.onChanged?.()}#a(e){const t=e.currentTarget,s=t.files?.[0];t.value="",s&&this.#u(s)}async#i(e){if(!window.confirm(`Remove attachment "${e}"? This can't be undone.`))return;const{table:t,id:s}=this.selected;if(!(await fetch(`/api/entries/${t}/${encodeURIComponent(s)}/attachments/${encodeURIComponent(e)}`,{method:"DELETE"})).ok){y.danger("Failed to remove attachment");return}this._viewingAttachment?.filename===e&&(this._viewingAttachment=null),await this.#e(),this.onChanged?.()}#o(){this._sharing=!0,this._shareUsername="",this._shareRole="member",this._shareStatus=null}#d(){this._sharing=!1,this._shareStatus=null}async#g(){if(!this.selected||!this._shareUsername.trim())return;const{table:e,id:t}=this.selected;this._shareBusy=!0,this._shareStatus=null;try{const s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/share`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:this._shareUsername.trim(),role:this._shareRole})}),i=await s.json().catch(()=>({}));this._shareStatus=s.ok?`Shared with ${this._shareUsername.trim()}.`:`Share failed: ${i.error??s.statusText}`,s.ok&&(this._shareUsername="")}finally{this._shareBusy=!1}}async#h(e){if(!this.selected)return;const{table:t,id:s}=this.selected;this._shareBusy=!0,this._shareStatus=null;try{const i=await fetch(`/api/entries/${t}/${encodeURIComponent(s)}/${e}`,{method:"POST"}),r=await i.json().catch(()=>({}));if(!i.ok){this._shareStatus=`Failed to create link: ${r.error??i.statusText}`;return}const o=e==="share-link"?"shareToken":"publicToken",a=new URL(window.location.href);a.search=`?${o}=${encodeURIComponent(r.token)}`;const c=a.toString();try{await navigator.clipboard?.writeText(c),this._shareStatus=`${e==="share-link"?"Share":"Public"} link copied to clipboard.`}catch{this._shareStatus=`Link: ${c}`}}finally{this._shareBusy=!1}}async#c(){if(!window.confirm("Delete this doc? This can't be undone."))return;const{table:e,id:t}=this.selected;if(!(await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"DELETE"})).ok){y.danger("Delete failed");return}this._doc=null,y.success("Deleted"),this.onChanged?.()}#b(){this._doc&&(this._draft=mt(this._doc),this._editing=!0,this._addingFrontmatter=!1)}#w(){this._doc&&(this._draft=mt(this._doc),this._addingFrontmatter=!0,this._editing=!1)}#x(e){this._draft&&(this._draft={...this._draft,doc_type:e},this._addingFrontmatter=!1,this._editing=!0)}#v(){this._editing=!1,this._addingFrontmatter=!1,this._draft=null}#p(e){this._draft&&(this._draft={...this._draft,...e})}#y(e){if(!this._draft)return;const t=this._draft.tags.includes(e)?this._draft.tags.filter(s=>s!==e):[...this._draft.tags,e];this.#p({tags:t})}#$(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.#p({trigger_phrases:t})}async#l(){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.group=this._draft.group||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#k(){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}"?
1065
1065
 
1066
- 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?.()}#_(){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#m(){if(!this._doc||!this.selected||!this._renameValue.trim())return;const e=this.selected.table==="skills",t=this._renameValue.trim(),s=e?this._doc.name:this._doc.source_path.split("/").pop();if(t===s){this._renaming=!1;return}const i=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(!i.ok){const r=await i.json().catch(()=>({}));window.alert(`Rename failed: ${r.error??i.statusText}`);return}if(this._renaming=!1,e)this.selected={table:"skills",id:t};else{const r=await i.json();this.selected={table:"memory_docs",id:r.source_path}}await this.#e(),this.onChanged?.()}#T(){return l`
1066
+ 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?.()}#_(){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#m(){if(!this._doc||!this.selected||!this._renameValue.trim())return;const e=this.selected.table==="skills",t=this._renameValue.trim(),s=e?this._doc.name:this._doc.source_path.split("/").pop();if(t===s){this._renaming=!1;return}const i=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(!i.ok){const r=await i.json().catch(()=>({}));window.alert(`Rename failed: ${r.error??i.statusText}`);return}if(this._renaming=!1,e)this.selected={table:"skills",id:t};else{const r=await i.json();this.selected={table:"memory_docs",id:r.source_path}}await this.#e(),this.onChanged?.()}#C(){return l`
1067
1067
  <div class="edit-form">
1068
1068
  <div class="hint">What kind of doc is this? This shapes which fields apply next.</div>
1069
1069
  <div class="field">
@@ -1072,14 +1072,14 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1072
1072
  @change=${e=>this.#x(e.target.value)}
1073
1073
  >
1074
1074
  <option value="" selected disabled>Choose…</option>
1075
- ${gt.map(e=>l`<option value=${e}>${e}</option>`)}
1075
+ ${bt.map(e=>l`<option value=${e}>${e}</option>`)}
1076
1076
  </select>
1077
1077
  </div>
1078
1078
  <div class="form-actions">
1079
1079
  <button class="cancel" @click=${()=>this.#v()}>Cancel</button>
1080
1080
  </div>
1081
1081
  </div>
1082
- `}#A(e){const t=this._draft,s=this.facets;return l`
1082
+ `}#T(e){const t=this._draft,s=this.facets;return l`
1083
1083
  <div class="edit-form">
1084
1084
  ${e?l`
1085
1085
  <div class="field">
@@ -1102,7 +1102,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1102
1102
  .value=${t.key_type}
1103
1103
  @change=${i=>this.#p({key_type:i.target.value})}
1104
1104
  >
1105
- ${tr.map(i=>l`<option value=${i} ?selected=${i===t.key_type}>${i}</option>`)}
1105
+ ${er.map(i=>l`<option value=${i} ?selected=${i===t.key_type}>${i}</option>`)}
1106
1106
  </select>
1107
1107
  </div>
1108
1108
  </div>
@@ -1112,7 +1112,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1112
1112
  .value=${t.doc_type}
1113
1113
  @change=${i=>this.#p({doc_type:i.target.value})}
1114
1114
  >
1115
- ${gt.map(i=>l`<option value=${i} ?selected=${i===t.doc_type}>${i}</option>`)}
1115
+ ${bt.map(i=>l`<option value=${i} ?selected=${i===t.doc_type}>${i}</option>`)}
1116
1116
  </select>
1117
1117
  </div>
1118
1118
  `}
@@ -1135,7 +1135,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1135
1135
  <div class="field">
1136
1136
  <label>status <help-tooltip .text=${_.status}></help-tooltip></label>
1137
1137
  <status-select
1138
- .options=${[...new Set([...e?Xi:er,...s?.statuses??[]])]}
1138
+ .options=${[...new Set([...e?Qi:Xi,...s?.statuses??[]])]}
1139
1139
  .value=${t.status}
1140
1140
  .onChange=${i=>this.#p({status:i})}
1141
1141
  ></status-select>
@@ -1173,7 +1173,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1173
1173
  .tags=${[]}
1174
1174
  .active=${t.trigger_phrases}
1175
1175
  .allowCreate=${!0}
1176
- .onToggle=${i=>this.#w(i)}
1176
+ .onToggle=${i=>this.#$(i)}
1177
1177
  ></tag-multiselect>
1178
1178
  </div>
1179
1179
  `:l`
@@ -1203,7 +1203,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1203
1203
  📁 ${e.folder}
1204
1204
  </button>
1205
1205
  </div>
1206
- `}#R(e,t){const s=e.created_at?Qi(e.created_at):null;return l`
1206
+ `}#z(e,t){const s=e.created_at?Yi(e.created_at):null;return l`
1207
1207
  <dl class="info-grid">
1208
1208
  <dt>Description</dt>
1209
1209
  <dd class="description">${e.description||"—"}</dd>
@@ -1260,7 +1260,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1260
1260
  >`:l`<span class="hint">unknown</span>`}
1261
1261
  </dd>
1262
1262
  </dl>
1263
- `}#E(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}#I(){return l`
1263
+ `}#A(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}#I(){return l`
1264
1264
  <div class="share-form">
1265
1265
  <div class="share-row">
1266
1266
  <input
@@ -1283,7 +1283,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1283
1283
  </div>
1284
1284
  ${this._shareStatus?l`<div class="share-status">${this._shareStatus}</div>`:f}
1285
1285
  </div>
1286
- `}#z(e,t,s,i){return l`
1286
+ `}#P(e,t,s,i){return l`
1287
1287
  <a
1288
1288
  href="/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(s.filename)}/view"
1289
1289
  target="_blank"
@@ -1298,35 +1298,32 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1298
1298
  >⇩</a
1299
1299
  >
1300
1300
  <button class="attachment-remove" title="Remove" @click=${()=>this.#i(s.filename)}>×</button>
1301
- `}#P(e,t,s,i){const r=[...s.children.values()].sort((o,a)=>o.name.localeCompare(a.name));return r.map((o,a)=>{const c=a===r.length-1,d=i.map(p=>p?"│ ":" ").join("")+(c?"└── ":"├── "),u=o.entry===void 0;return l`
1301
+ `}#R(e,t,s){const i=[...e.children.values()].sort((r,o)=>r.name.localeCompare(o.name));return i.map((r,o)=>{const a=o===i.length-1,c=t.map(u=>u?"│ ":" ").join("")+(a?"└── ":"├── "),d=r.leaf===void 0;return l`
1302
1302
  <li>
1303
- <span class="tree-prefix">${d}</span>${u?l`<span class="tree-dir">📁 ${o.name}</span>`:this.#z(e,t,o.entry,o.name)}
1303
+ <span class="tree-prefix">${c}</span>${d?l`<span class="tree-dir">📁 ${r.name}</span>`:s(r.leaf,r.name)}
1304
1304
  </li>
1305
- ${u?this.#P(e,t,o,[...i,!c]):f}
1306
- `})}#C(e,t){const s=[...e.children.values()].sort((i,r)=>i.name.localeCompare(r.name));return s.map((i,r)=>{const o=r===s.length-1,a=t.map(c=>c?"│ ":" ").join("")+(o?"└── ":"├── ");return l`
1307
- <li>
1308
- <span class="tree-prefix">${a}</span>${i.isFile?l`<span>${i.name}</span>`:l`<span class="tree-dir">📁 ${i.name}</span>`}
1309
- </li>
1310
- ${i.isFile?f:this.#C(i,[...t,!o])}
1311
- `})}#O(e){if(!e.sourceFiles?.length)return f;const t=Yi(e.sourceFiles);return l`
1305
+ ${d?this.#R(r,[...t,!a],s):f}
1306
+ `})}#E(e){if(!e.sourceFiles?.length)return f;const t=gt(e.sourceFiles,()=>{});return l`
1312
1307
  <div class="attachments-section">
1313
1308
  <h4>Skill files</h4>
1314
- <ul class="attachment-tree">${this.#C(t,[])}</ul>
1309
+ <ul class="attachment-tree">${this.#R(t,[],(s,i)=>l`<span>${i}</span>`)}</ul>
1315
1310
  </div>
1316
- `}#F(e,t){const s=e.attachments?.length?Ji(e.attachments):void 0,i=e.attachments?.some(r=>r.filename.includes("/"))??!1;return l`
1311
+ `}#O(e,t){const s=e.attachments??[],i=new Map(s.map(a=>[a.filename,a])),r=s.length?gt(s.map(a=>a.filename),a=>i.get(a)):void 0,o=s.some(a=>a.filename.includes("/"));return l`
1317
1312
  <div class="attachments-section">
1318
1313
  <h4>Attachments</h4>
1319
- ${s?i?l`<ul class="attachment-tree">${this.#P(e,t,s,[])}</ul>`:l`
1314
+ ${r?o?l`<ul class="attachment-tree">
1315
+ ${this.#R(r,[],(a,c)=>this.#P(e,t,a,c))}
1316
+ </ul>`:l`
1320
1317
  <ul>
1321
- ${e.attachments.map(r=>l`<li>${this.#z(e,t,r,r.filename)}</li>`)}
1318
+ ${s.map(a=>l`<li>${this.#P(e,t,a,a.filename)}</li>`)}
1322
1319
  </ul>
1323
1320
  `:f}
1324
1321
  <label class="attachment-add">
1325
1322
  + Add
1326
- <input type="file" @change=${r=>this.#a(r)} />
1323
+ <input type="file" @change=${a=>this.#a(a)} />
1327
1324
  </label>
1328
1325
  </div>
1329
- `}#M(e,t,s){const i=document.documentElement.getAttribute("data-theme"),r=i==="light"||i==="dark"?`?theme=${i}`:"",o=`/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(s.filename)}/view${r}`,a=`/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(s.filename)}`;return l`
1326
+ `}#F(e,t,s){const i=document.documentElement.getAttribute("data-theme"),r=i==="light"||i==="dark"?`?theme=${i}`:"",o=`/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(s.filename)}/view${r}`,a=`/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(s.filename)}`;return l`
1330
1327
  <div class="attachment-view-header">
1331
1328
  <button class="back-button" title="Back to ${e.name??e.key??e.id}" @click=${()=>this._viewingAttachment=null}>
1332
1329
  ← Back
@@ -1334,13 +1331,13 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1334
1331
  <span class="attachment-view-title" title=${s.filename}>${s.filename}</span>
1335
1332
  <a class="attachment-view-download" href=${a} title="Download ${s.filename}">⇩ Download</a>
1336
1333
  </div>
1337
- ${Zi(s.filename)?l`<img class="attachment-image" src=${o} alt=${s.filename} />`:l`<iframe class="attachment-frame" src=${o} title=${s.filename}></iframe>`}
1338
- `}render(){if(!this.selected)return l`<div class="empty">Select an entry to view its details.</div>`;if(!this._doc)return f;const e=this._doc,t=this.selected.table==="skills",s=t&&e.folder==="builtin",i=!t&&e.has_frontmatter===!1;return this._addingFrontmatter?l`${this.#S(e,t)}${this.#T()}`:this._editing&&this._draft?l`${this.#S(e,t)}${this.#A(t)}`:this._viewingAttachment?l`${this.#S(e,t)}${this.#M(e,this.selected.table,this._viewingAttachment)}`:l`
1334
+ ${Ji(s.filename)?l`<img class="attachment-image" src=${o} alt=${s.filename} />`:l`<iframe class="attachment-frame" src=${o} title=${s.filename}></iframe>`}
1335
+ `}render(){if(!this.selected)return l`<div class="empty">Select an entry to view its details.</div>`;if(!this._doc)return f;const e=this._doc,t=this.selected.table==="skills",s=t&&e.folder==="builtin",i=!t&&e.has_frontmatter===!1;return this._addingFrontmatter?l`${this.#S(e,t)}${this.#C()}`:this._editing&&this._draft?l`${this.#S(e,t)}${this.#T(t)}`:this._viewingAttachment?l`${this.#S(e,t)}${this.#F(e,this.selected.table,this._viewingAttachment)}`:l`
1339
1336
  ${this.#S(e,t)}
1340
- ${i?l`<div class="bare-notice">No frontmatter — this is a plain, unmanaged file.</div>`:this.#R(e,t)}
1337
+ ${i?l`<div class="bare-notice">No frontmatter — this is a plain, unmanaged file.</div>`:this.#z(e,t)}
1341
1338
  ${s?f:l`
1342
1339
  <div class="actions">
1343
- ${i?l`<button class="primary" @click=${()=>this.#$()}>Add frontmatter</button>`:l`
1340
+ ${i?l`<button class="primary" @click=${()=>this.#w()}>Add frontmatter</button>`:l`
1344
1341
  <button @click=${()=>this.#b()}>Edit</button>
1345
1342
  <button @click=${()=>this.#_()}>Rename</button>
1346
1343
  <button @click=${()=>this.#n()}>${e.deprecated?"Un-deprecate":"Mark deprecated"}</button>
@@ -1364,8 +1361,8 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1364
1361
  `:f}
1365
1362
  ${this._sharing?this.#I():f}
1366
1363
  `}
1367
- ${this.#O(e)}
1368
- ${this.#F(e,this.selected.table)}
1364
+ ${this.#E(e)}
1365
+ ${this.#O(e,this.selected.table)}
1369
1366
  <div class="view-toggle">
1370
1367
  <button
1371
1368
  class=${this._viewMode==="markdown"?"active":""}
@@ -1380,9 +1377,9 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1380
1377
  Raw
1381
1378
  </button>
1382
1379
  </div>
1383
- ${this._viewMode==="markdown"?l`<div class="markdown-body">${Ni(v.parse(e.body??"",{async:!1,renderer:this.#E(this.selected.table,e.id)}))}</div>`:l`<pre>${e.raw_file??e.body}</pre>`}
1380
+ ${this._viewMode==="markdown"?l`<div class="markdown-body">${Ui(v.parse(e.body??"",{async:!1,renderer:this.#A(this.selected.table,e.id)}))}</div>`:l`<pre>${e.raw_file??e.body}</pre>`}
1384
1381
  <div class="source-path" title="click to copy" @click=${()=>this.#t()}>${e.source_path}</div>
1385
- `}}customElements.define("detail-panel",sr);const F="membkt";let ve;function H(){return ve||(ve=fetch("/api/config").then(n=>n.json()).catch(()=>({folderfooMode:"off",folderfooHost:null}))),ve}class ir extends k{static{this.properties={defaultKind:{attribute:!1},lockKind:{attribute:!1},onAdded:{attribute:!1},onCancel:{attribute:!1}}}#e=new h("skill");#t=new h("local");#s=new h("");#n=new h([]);#r=new h(null);#u=new h("");#a=new h("");#i=new h("");#o=new h(!1);#d=new h(!1);#g=new h(!1);#h=new h("");#c=new h("");#b=new h(!1);#$=new h("");#x=new h(!1);#v=new h("");#p=new h(!1);#y=new h(!1);#w=new h([]);#l=new h("");#k=new h("");#_=new h(!1);#m;#T=new h("mine");#A=new h([]);#S=new h(!1);#R=new h(null);static{this.styles=w`
1382
+ `}}customElements.define("detail-panel",tr);const F="membkt";let ve;function H(){return ve||(ve=fetch("/api/config").then(n=>n.json()).catch(()=>({folderfooMode:"off",folderfooHost:null}))),ve}class sr extends k{static{this.properties={defaultKind:{attribute:!1},lockKind:{attribute:!1},onAdded:{attribute:!1},onCancel:{attribute:!1}}}#e=new h("skill");#t=new h("local");#s=new h("");#n=new h([]);#r=new h(null);#u=new h("");#a=new h("");#i=new h("");#o=new h(!1);#d=new h(!1);#g=new h(!1);#h=new h("");#c=new h("");#b=new h(!1);#w=new h("");#x=new h(!1);#v=new h("");#p=new h(!1);#y=new h(!1);#$=new h([]);#l=new h("");#k=new h("");#_=new h(!1);#m;#C=new h("mine");#T=new h([]);#S=new h(!1);#z=new h(null);static{this.styles=$`
1386
1383
  :host { display: block; }
1387
1384
  .backdrop {
1388
1385
  position: fixed; inset: 0; background: var(--overlay);
@@ -1485,10 +1482,10 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1485
1482
  .ff-folder-entry.selected { background: var(--accent); color: var(--accent-fg); }
1486
1483
  .ff-empty { padding: 12px; opacity: 0.6; font-size: 13px; }
1487
1484
  .ff-widget-slot { display: flex; }
1488
- `}constructor(){super(),new N(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#e.set(this.defaultKind),this.#E()}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this.#m)}async#E(e){const t=new URLSearchParams;e&&t.set("path",e),this.#d.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.#r.set(i.parent),this.#n.set(i.entries),this.#i.set(""),this.renderRoot.querySelector(".browser")?.scrollTo(0,0)}#I(){this.#d.set(!this.#d.value),this.#E(this.#s.value)}#z(){this.#h.set(""),this.#g.set(!0)}#P(){this.#g.set(!1),this.#h.set("")}async#C(){const e=this.#h.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.#g.set(!1),this.#h.set(""),await this.#E(this.#s.value)}catch(t){this.#i.set(t.message)}}}#O(){this.#u.set(this.#s.value),this.#a.value||this.#a.set(this.#s.value.split("/").filter(Boolean).pop()??"")}async#F(){const e=this.#u.value||this.#s.value;if(e){this.#o.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.#o.set(!1)}}}async#M(){if(this.#p.value)return;const{folderfooMode:e,folderfooHost:t}=await H();if(e==="off"||!t)return;let s=null;try{s=localStorage.getItem("folderfoo_token")}catch{}s&&(this.#c.set(t),this.#v.set(F),this.#x.set(!0),this.#G(s))}async#j(){if(!this.#c.value){this.#i.set("enter a server URL first");return}this.#i.set("");try{await ae(()=>import(`${this.#c.value}/elements/folderfoo-profile-circle.js`),[]),this.#b.set(!0),this.#$.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.#m=setInterval(()=>this.#q(),800),this.#q()}catch(e){this.#$.set(e.message)}}#q(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{}!e||this.#p.value||(clearInterval(this.#m),this.#G(e))}async#G(e){this.#y.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.#c.value,token:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to persist folderfoo session");return}this.#p.set(!0),this.#v.set(F),await this.#B()}finally{this.#y.set(!1)}}async#B(e,t){this.#_.set(!0),this.#i.set("");try{const s=new URLSearchParams({server:this.#c.value,tenantId:this.#v.value});e&&s.set("owner",e),t&&s.set("rootFolder",t);const i=await fetch(`/api/folderfoo/folders?${s.toString()}`),r=await i.json();if(!i.ok){this.#i.set(r.error??"failed to list folderfoo folders");return}this.#w.set(r)}finally{this.#_.set(!1)}}async#Z(){this.#S.set(!0),this.#i.set("");try{const e=new URLSearchParams({server:this.#c.value,tenantId:this.#v.value}),t=await fetch(`/api/folderfoo/shared-folders?${e.toString()}`),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to list folders shared with you");return}this.#A.set(s)}finally{this.#S.set(!1)}}#H(e){this.#T.set(e),this.#R.set(null),this.#l.set(""),this.#k.set(""),e==="shared"&&this.#A.value.length===0?this.#Z():e==="mine"&&this.#B()}#J(e){this.#R.set(e),this.#B(e.owner,e.path)}#K(e,t){this.#l.set(e),this.#k.set(t??""),this.#a.value||this.#a.set(e.split("/").filter(Boolean).pop()??this.#v.value)}#Y(e){this.#K(e.path,e.owner)}async#Q(){if(this.#l.value){this.#o.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.#c.value,tenantId:this.#v.value,folderPath:this.#l.value,owner:this.#k.value||void 0})}),t=await e.json();if(!e.ok){this.#i.set(t.error??"failed to connect folder");return}this.onAdded(t.kindMismatchWarning)}finally{this.#o.set(!1)}}}#X(){const e=this.#n.value;return l`
1485
+ `}constructor(){super(),new N(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#e.set(this.defaultKind),this.#A()}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this.#m)}async#A(e){const t=new URLSearchParams;e&&t.set("path",e),this.#d.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.#r.set(i.parent),this.#n.set(i.entries),this.#i.set(""),this.renderRoot.querySelector(".browser")?.scrollTo(0,0)}#I(){this.#d.set(!this.#d.value),this.#A(this.#s.value)}#P(){this.#h.set(""),this.#g.set(!0)}#R(){this.#g.set(!1),this.#h.set("")}async#E(){const e=this.#h.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.#g.set(!1),this.#h.set(""),await this.#A(this.#s.value)}catch(t){this.#i.set(t.message)}}}#O(){this.#u.set(this.#s.value),this.#a.value||this.#a.set(this.#s.value.split("/").filter(Boolean).pop()??"")}async#F(){const e=this.#u.value||this.#s.value;if(e){this.#o.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.#o.set(!1)}}}async#G(){if(this.#p.value)return;const{folderfooMode:e,folderfooHost:t}=await H();if(e==="off"||!t)return;let s=null;try{s=localStorage.getItem("folderfoo_token")}catch{}s&&(this.#c.set(t),this.#v.set(F),this.#x.set(!0),this.#W(s))}async#U(){if(!this.#c.value){this.#i.set("enter a server URL first");return}this.#i.set("");try{await ae(()=>import(`${this.#c.value}/elements/folderfoo-profile-circle.js`),[]),this.#b.set(!0),this.#w.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.#m=setInterval(()=>this.#j(),800),this.#j()}catch(e){this.#w.set(e.message)}}#j(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{}!e||this.#p.value||(clearInterval(this.#m),this.#W(e))}async#W(e){this.#y.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.#c.value,token:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to persist folderfoo session");return}this.#p.set(!0),this.#v.set(F),await this.#q()}finally{this.#y.set(!1)}}async#q(e,t){this.#_.set(!0),this.#i.set("");try{const s=new URLSearchParams({server:this.#c.value,tenantId:this.#v.value});e&&s.set("owner",e),t&&s.set("rootFolder",t);const i=await fetch(`/api/folderfoo/folders?${s.toString()}`),r=await i.json();if(!i.ok){this.#i.set(r.error??"failed to list folderfoo folders");return}this.#$.set(r)}finally{this.#_.set(!1)}}async#J(){this.#S.set(!0),this.#i.set("");try{const e=new URLSearchParams({server:this.#c.value,tenantId:this.#v.value}),t=await fetch(`/api/folderfoo/shared-folders?${e.toString()}`),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to list folders shared with you");return}this.#T.set(s)}finally{this.#S.set(!1)}}#B(e){this.#C.set(e),this.#z.set(null),this.#l.set(""),this.#k.set(""),e==="shared"&&this.#T.value.length===0?this.#J():e==="mine"&&this.#q()}#Y(e){this.#z.set(e),this.#q(e.owner,e.path)}#H(e,t){this.#l.set(e),this.#k.set(t??""),this.#a.value||this.#a.set(e.split("/").filter(Boolean).pop()??this.#v.value)}#Q(e){this.#H(e.path,e.owner)}async#X(){if(this.#l.value){this.#o.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.#c.value,tenantId:this.#v.value,folderPath:this.#l.value,owner:this.#k.value||void 0})}),t=await e.json();if(!e.ok){this.#i.set(t.error??"failed to connect folder");return}this.onAdded(t.kindMismatchWarning)}finally{this.#o.set(!1)}}}#ee(){const e=this.#n.value;return l`
1489
1486
  <div class="breadcrumb-row">
1490
1487
  <div class="breadcrumb">${this.#s.value}</div>
1491
- <button class="new-folder-btn" @click=${()=>this.#z()}>+ New folder</button>
1488
+ <button class="new-folder-btn" @click=${()=>this.#P()}>+ New folder</button>
1492
1489
  <label class="hidden-toggle">
1493
1490
  <input type="checkbox" .checked=${this.#d.value} @change=${()=>this.#I()} />
1494
1491
  Show hidden
@@ -1501,17 +1498,17 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1501
1498
  placeholder="Folder name"
1502
1499
  .value=${this.#h.value}
1503
1500
  @input=${t=>this.#h.set(t.target.value)}
1504
- @keydown=${t=>{t.key==="Enter"&&this.#C(),t.key==="Escape"&&this.#P()}}
1501
+ @keydown=${t=>{t.key==="Enter"&&this.#E(),t.key==="Escape"&&this.#R()}}
1505
1502
  />
1506
- <button @click=${()=>this.#C()}>Create</button>
1507
- <button @click=${()=>this.#P()}>Cancel</button>
1503
+ <button @click=${()=>this.#E()}>Create</button>
1504
+ <button @click=${()=>this.#R()}>Cancel</button>
1508
1505
  </div>
1509
1506
  `:""}
1510
1507
  <div class="browser">
1511
- ${this.#r.value?l`<div class="entry up" @click=${()=>this.#E(this.#r.value)}>
1508
+ ${this.#r.value?l`<div class="entry up" @click=${()=>this.#A(this.#r.value)}>
1512
1509
  <span class="icon">📁</span> ..
1513
1510
  </div>`:""}
1514
- ${e.length===0&&!this.#r.value?l`<div class="empty">No subdirectories here.</div>`:e.map(t=>l`<div class="entry" @click=${()=>this.#E(t.path)}>
1511
+ ${e.length===0&&!this.#r.value?l`<div class="empty">No subdirectories here.</div>`:e.map(t=>l`<div class="entry" @click=${()=>this.#A(t.path)}>
1515
1512
  <span class="icon">📁</span> ${t.name}
1516
1513
  </div>`)}
1517
1514
  </div>
@@ -1541,7 +1538,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1541
1538
  </button>
1542
1539
  </div>
1543
1540
  </div>
1544
- `}#N(){const e=this.#w.value;if(this.#x.value&&!this.#p.value)return l`
1541
+ `}#M(){const e=this.#$.value;if(this.#x.value&&!this.#p.value)return l`
1545
1542
  <div class="ff-body">
1546
1543
  <div class="ff-connected-row"><span class="ff-connected-dot"></span> Already signed in to ${this.#c.value} — connecting…</div>
1547
1544
  ${this.#i.value?l`<div class="error">${this.#i.value}</div>`:""}
@@ -1564,7 +1561,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1564
1561
  placeholder="https://folderfoo.example.com"
1565
1562
  ?disabled=${this.#b.value}
1566
1563
  @input=${i=>this.#c.set(i.target.value)}
1567
- @keydown=${i=>i.key==="Enter"&&this.#j()}
1564
+ @keydown=${i=>i.key==="Enter"&&this.#U()}
1568
1565
  />
1569
1566
  </div>
1570
1567
  ${this.#b.value?l`
@@ -1573,38 +1570,38 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1573
1570
  ${this.#y.value?l`<div class="ff-hint">Finishing connection…</div>`:""}
1574
1571
  `:l`
1575
1572
  <div class="actions" style="justify-content: flex-start; margin-top: 0;">
1576
- <button class="secondary" @click=${()=>this.#j()}>Continue</button>
1573
+ <button class="secondary" @click=${()=>this.#U()}>Continue</button>
1577
1574
  </div>
1578
1575
  `}
1579
- ${this.#$.value?l`<div class="error">${this.#$.value}</div>`:""}
1576
+ ${this.#w.value?l`<div class="error">${this.#w.value}</div>`:""}
1580
1577
  ${this.#i.value?l`<div class="error">${this.#i.value}</div>`:""}
1581
1578
  <div class="actions">
1582
1579
  <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
1583
1580
  </div>
1584
1581
  </div>
1585
- `;const t=this.#A.value,s=this.#R.value;return l`
1582
+ `;const t=this.#T.value,s=this.#z.value;return l`
1586
1583
  <div class="ff-body">
1587
1584
  <div class="ff-connected-row"><span class="ff-connected-dot"></span> Connected to ${this.#c.value}</div>
1588
1585
  <div class="kind-toggle">
1589
1586
  <button
1590
- class=${this.#T.value==="mine"?"active":""}
1591
- @click=${()=>this.#H("mine")}
1587
+ class=${this.#C.value==="mine"?"active":""}
1588
+ @click=${()=>this.#B("mine")}
1592
1589
  >
1593
1590
  My folders
1594
1591
  </button>
1595
1592
  <button
1596
- class=${this.#T.value==="shared"?"active":""}
1597
- @click=${()=>this.#H("shared")}
1593
+ class=${this.#C.value==="shared"?"active":""}
1594
+ @click=${()=>this.#B("shared")}
1598
1595
  >
1599
1596
  Shared with me
1600
1597
  </button>
1601
1598
  </div>
1602
- ${this.#T.value==="mine"?l`
1599
+ ${this.#C.value==="mine"?l`
1603
1600
  ${e.length>0?l`
1604
1601
  <div class="ff-folder-list">
1605
1602
  ${e.map(i=>l`<div
1606
1603
  class="ff-folder-entry ${this.#l.value===i.path&&!this.#k.value?"selected":""}"
1607
- @click=${()=>this.#K(i.path)}
1604
+ @click=${()=>this.#H(i.path)}
1608
1605
  >
1609
1606
  ${i.path}
1610
1607
  </div>`)}
@@ -1613,11 +1610,11 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1613
1610
  `:s?l`
1614
1611
  <div class="breadcrumb-row">
1615
1612
  <div class="breadcrumb">${s.owner}:${s.path}</div>
1616
- <button class="new-folder-btn" @click=${()=>this.#H("shared")}>← Back</button>
1613
+ <button class="new-folder-btn" @click=${()=>this.#B("shared")}>← Back</button>
1617
1614
  </div>
1618
1615
  <div
1619
1616
  class="ff-folder-entry ${this.#l.value===s.path&&this.#k.value===s.owner?"selected":""}"
1620
- @click=${()=>this.#Y(s)}
1617
+ @click=${()=>this.#Q(s)}
1621
1618
  >
1622
1619
  (connect this folder itself)
1623
1620
  </div>
@@ -1625,7 +1622,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1625
1622
  <div class="ff-folder-list">
1626
1623
  ${e.map(i=>l`<div
1627
1624
  class="ff-folder-entry ${this.#l.value===i.path&&this.#k.value===s.owner?"selected":""}"
1628
- @click=${()=>this.#K(i.path,s.owner)}
1625
+ @click=${()=>this.#H(i.path,s.owner)}
1629
1626
  >
1630
1627
  ${i.path}
1631
1628
  </div>`)}
@@ -1634,7 +1631,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1634
1631
  `:l`
1635
1632
  ${t.length>0?l`
1636
1633
  <div class="ff-folder-list">
1637
- ${t.map(i=>l`<div class="ff-folder-entry" @click=${()=>this.#J(i)}>
1634
+ ${t.map(i=>l`<div class="ff-folder-entry" @click=${()=>this.#Y(i)}>
1638
1635
  ${i.path} <span style="opacity:0.6">— shared by ${i.owner}${i.role==="member"?" (read-only)":""}</span>
1639
1636
  </div>`)}
1640
1637
  </div>
@@ -1658,7 +1655,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1658
1655
  <button
1659
1656
  class="primary"
1660
1657
  ?disabled=${!this.#l.value||this.#o.value}
1661
- @click=${()=>this.#Q()}
1658
+ @click=${()=>this.#X()}
1662
1659
  >
1663
1660
  ${this.#o.value?"Connecting…":"Connect folder"}
1664
1661
  </button>
@@ -1690,15 +1687,15 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1690
1687
  </button>
1691
1688
  <button
1692
1689
  class=${this.#t.value==="folderfoo"?"active":""}
1693
- @click=${()=>{this.#t.set("folderfoo"),this.#M()}}
1690
+ @click=${()=>{this.#t.set("folderfoo"),this.#G()}}
1694
1691
  >
1695
1692
  Connect folderfoo
1696
1693
  </button>
1697
1694
  </div>
1698
- ${this.#t.value==="local"?this.#X():this.#N()}
1695
+ ${this.#t.value==="local"?this.#ee():this.#M()}
1699
1696
  </div>
1700
1697
  </div>
1701
- `}}customElements.define("add-folder-modal",ir);function mt(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 rr 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=w`
1698
+ `}}customElements.define("add-folder-modal",sr);function vt(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 ir 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=$`
1702
1699
  :host { display: flex; flex: 1 1 auto; min-height: 0; }
1703
1700
  .nav {
1704
1701
  flex: 0 0 260px;
@@ -1763,13 +1760,13 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1763
1760
  @click=${()=>this.onSelect(t.name)}
1764
1761
  >
1765
1762
  <span class="channel-name">${t.name}</span>
1766
- <span class="channel-meta">${mt(t.lastActivityAt)}</span>
1763
+ <span class="channel-meta">${vt(t.lastActivityAt)}</span>
1767
1764
  </div>
1768
1765
  `)}#t(){return this.selected?this.loading?l`<div class="content-pane"><div class="content-meta">Loading…</div></div>`:this.detail?l`
1769
1766
  <div class="content-pane">
1770
1767
  <div class="content-header">
1771
1768
  <span class="content-title">${this.detail.name}</span>
1772
- <span class="content-meta">last activity ${mt(this.detail.lastActivityAt)}</span>
1769
+ <span class="content-meta">last activity ${vt(this.detail.lastActivityAt)}</span>
1773
1770
  </div>
1774
1771
  ${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>`}
1775
1772
  </div>
@@ -1782,13 +1779,10 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1782
1779
  ${this.#e()}
1783
1780
  </div>
1784
1781
  ${this.#t()}
1785
- `}}customElements.define("channel-view",rr);function nr(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 or(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 Xt="mem-bucket-folder-view-mode",es="mem-bucket-folder-view-expanded",vt="mem-bucket-folder-view-tree-split-pct",xt="mem-bucket-folder-view-list-split-pct",yt=12,kt=40,$t=20,wt=80;function _t(n,e,t,s){const i=Number(localStorage.getItem(n));return Number.isFinite(i)&&i>=t&&i<=s?i:e}const ar=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],lr=[{value:"a",label:"Folder tree"},{value:"b",label:"Breadcrumb drill-down"},{value:"c",label:"Tag → Name"}];function cr(){const n=localStorage.getItem(Xt);return n==="a"||n==="b"||n==="c"?n:"a"}function dr(){try{const n=localStorage.getItem(es);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 St(n){localStorage.setItem(es,JSON.stringify([...n]))}class hr 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 h(cr());#t=new h(dr());#s=new h([]);#n=new h(null);#r=new h(null);#u=new h(_t(vt,20,yt,kt));#a=new h(_t(xt,40,$t,wt));#i=new h(null);#o=e=>this.#b(e);#d=()=>this.#$();static{this.styles=w`
1782
+ `}}customElements.define("channel-view",ir);function rr(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 nr(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 es="mem-bucket-folder-view-mode",ts="mem-bucket-folder-view-expanded",xt="mem-bucket-folder-view-tree-split-pct",yt="mem-bucket-folder-view-list-split-pct",kt=12,wt=40,$t=20,_t=80;function St(n,e,t,s){const i=Number(localStorage.getItem(n));return Number.isFinite(i)&&i>=t&&i<=s?i:e}const or=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],ar=[{value:"a",label:"Folder tree"},{value:"b",label:"Breadcrumb drill-down"},{value:"c",label:"Tag → Name"}];function lr(){const n=localStorage.getItem(es);return n==="a"||n==="b"||n==="c"?n:"a"}function cr(){try{const n=localStorage.getItem(ts);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 Ct(n){localStorage.setItem(ts,JSON.stringify([...n]))}class dr 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 h(lr());#t=new h(cr());#s=new h([]);#n=new h(null);#r=new h(null);#u=new h(St(xt,20,kt,wt));#a=new h(St(yt,40,$t,_t));#i=new h(null);#o=e=>this.#b(e);#d=()=>this.#w();static{this.styles=$`
1786
1783
  :host { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
1787
- /* padding-right reserves room for mem-bucket-app's absolutely-positioned .header-toolbar
1788
- overlay (rendered outside this element entirely - see its own comment), which lines up with
1789
- this row's top-right corner via matching padding. */
1790
1784
  .mode-row {
1791
- display: flex; align-items: center; gap: 8px; padding: 10px 320px 10px 16px;
1785
+ display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px;
1792
1786
  border-bottom: 1px solid var(--border); background: var(--bg-subtle);
1793
1787
  }
1794
1788
  .mode-row .filter-label { font-size: 12px; opacity: 0.6; font-weight: 600; }
@@ -1861,7 +1855,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1861
1855
  border: none; background: none; color: inherit; width: 100%; text-align: left; box-sizing: border-box;
1862
1856
  }
1863
1857
  .folder-card:hover { background: var(--hover); }
1864
- `}constructor(){super(),new N(this)}#g(e){this.#e.set(e),localStorage.setItem(Xt,e),this.#t.set(new Set),St(new Set),this.#s.set([]),this.#n.set(null),this.#r.set(null)}#h(e){this.#g(e.target.value)}#c(e,t){t.preventDefault(),this.#i.set(e),document.addEventListener("pointermove",this.#o),document.addEventListener("pointerup",this.#d)}#b(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.#u.set(Math.min(kt,Math.max(yt,r)));else{const o=100-this.#u.value,a=o>0?(r-this.#u.value)/o*100:0;this.#a.set(Math.min(wt,Math.max($t,a)))}}#$(){const e=this.#i.value;this.#i.set(null),document.removeEventListener("pointermove",this.#o),document.removeEventListener("pointerup",this.#d),e==="tree"?localStorage.setItem(vt,String(this.#u.value)):e==="list"&&localStorage.setItem(xt,String(this.#a.value))}#x(e){const t=new Set(this.#t.value);t.has(e)?t.delete(e):t.add(e),this.#t.set(t),St(t)}#v(e,t){this.#n.set({folder:e,tag:t})}#p(e){this.#n.set(null),this.#r.set({table:e._table,id:e.id})}#y(e){this.#r.set({table:e._table,id:e.id})}#w(e,t){const s=this.#t.value.has(t),i=e.tagGroups.reduce((o,a)=>o+a.items.length,0),r=this.#n.value?.folder===e.folder.name&&this.#n.value?.tag===null;return l`
1858
+ `}constructor(){super(),new N(this)}#g(e){this.#e.set(e),localStorage.setItem(es,e),this.#t.set(new Set),Ct(new Set),this.#s.set([]),this.#n.set(null),this.#r.set(null)}#h(e){this.#g(e.target.value)}#c(e,t){t.preventDefault(),this.#i.set(e),document.addEventListener("pointermove",this.#o),document.addEventListener("pointerup",this.#d)}#b(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.#u.set(Math.min(wt,Math.max(kt,r)));else{const o=100-this.#u.value,a=o>0?(r-this.#u.value)/o*100:0;this.#a.set(Math.min(_t,Math.max($t,a)))}}#w(){const e=this.#i.value;this.#i.set(null),document.removeEventListener("pointermove",this.#o),document.removeEventListener("pointerup",this.#d),e==="tree"?localStorage.setItem(xt,String(this.#u.value)):e==="list"&&localStorage.setItem(yt,String(this.#a.value))}#x(e){const t=new Set(this.#t.value);t.has(e)?t.delete(e):t.add(e),this.#t.set(t),Ct(t)}#v(e,t){this.#n.set({folder:e,tag:t})}#p(e){this.#n.set(null),this.#r.set({table:e._table,id:e.id})}#y(e){this.#r.set({table:e._table,id:e.id})}#$(e,t){const s=this.#t.value.has(t),i=e.tagGroups.reduce((o,a)=>o+a.items.length,0),r=this.#n.value?.folder===e.folder.name&&this.#n.value?.tag===null;return l`
1865
1859
  <button class="node ${e.folder.remote?"remote":""} ${r?"active":""}" @click=${()=>this.#x(t)}>
1866
1860
  <span class="caret">${s?"▾":"▸"}</span>
1867
1861
  <span class="icon">${e.folder.remote?"☁":"📁"}</span>
@@ -1875,7 +1869,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1875
1869
  `}#l(e){const t=(s,i)=>s.length===0?"":l`
1876
1870
  <div class="section-header">${i}</div>
1877
1871
  ${s.map(r=>{const o=`folder:${r.folder.name}`,a=this.#t.value.has(o),c=r.tagGroups[0]?.items??[];return l`
1878
- ${this.#w(r,o)}
1872
+ ${this.#$(r,o)}
1879
1873
  ${a?c.map(d=>l`
1880
1874
  <button class="node indent-1" @click=${()=>this.#p(d)}>
1881
1875
  <span class="caret"></span>
@@ -1925,14 +1919,14 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1925
1919
  <span class="count">${o.folder}</span>
1926
1920
  </button>
1927
1921
  `):""}
1928
- `})}#m(){const e=this.#n.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:or(t,s),r=e==="c"?nr(t):null,o=this.#n.value,a=this.#r.value;return l`
1922
+ `})}#m(){const e=this.#n.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:nr(t,s),r=e==="c"?rr(t):null,o=this.#n.value,a=this.#r.value;return l`
1929
1923
  <div class="mode-row">
1930
1924
  <span class="filter-label">View:</span>
1931
1925
  <select .value=${e} @change=${c=>this.#h(c)}>
1932
- ${lr.map(c=>l`<option value=${c.value}>${c.label}</option>`)}
1926
+ ${ar.map(c=>l`<option value=${c.value}>${c.label}</option>`)}
1933
1927
  </select>
1934
1928
  <div class="type-toggle">
1935
- ${ar.map(c=>l`
1929
+ ${or.map(c=>l`
1936
1930
  <button
1937
1931
  class=${this.typeFilter===c.value?"active":""}
1938
1932
  @click=${()=>this.onTypeChange(c.value)}
@@ -1941,6 +1935,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1941
1935
  </button>
1942
1936
  `)}
1943
1937
  </div>
1938
+ <slot name="mode-row-end"></slot>
1944
1939
  </div>
1945
1940
  <div class="body-region">
1946
1941
  <div
@@ -1985,7 +1980,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1985
1980
  ></detail-panel>
1986
1981
  `:l`<div class="no-selection">Select an item to view it.</div>`}
1987
1982
  </div>
1988
- `}}customElements.define("folder-view",hr);const pr={system:"◐",light:"☀",dark:"☾"},ur={system:"Auto",light:"Light",dark:"Dark"};class fr extends k{static{this.properties={showReindex:{attribute:!1},reindexing:{attribute:!1},channelsActive:{attribute:!1},folderViewActive:{attribute:!1},showShared:{attribute:!1},sharedActive:{attribute:!1},theme:{attribute:!1},onReindex:{attribute:!1},onToggleChannels:{attribute:!1},onToggleFolderView:{attribute:!1},onToggleShared:{attribute:!1},onCycleTheme:{attribute:!1}}}static{this.styles=w`
1983
+ `}}customElements.define("folder-view",dr);const hr={system:"◐",light:"☀",dark:"☾"},pr={system:"Auto",light:"Light",dark:"Dark"};class ur extends k{static{this.properties={showReindex:{attribute:!1},reindexing:{attribute:!1},channelsActive:{attribute:!1},folderViewActive:{attribute:!1},showShared:{attribute:!1},sharedActive:{attribute:!1},theme:{attribute:!1},onReindex:{attribute:!1},onToggleChannels:{attribute:!1},onToggleFolderView:{attribute:!1},onToggleShared:{attribute:!1},onCycleTheme:{attribute:!1}}}static{this.styles=$`
1989
1984
  :host {
1990
1985
  display: flex;
1991
1986
  align-items: center;
@@ -2074,14 +2069,14 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2074
2069
  `:""}
2075
2070
  <button
2076
2071
  class="theme-toggle"
2077
- title=${`Theme: ${ur[this.theme]} (click to change)`}
2072
+ title=${`Theme: ${pr[this.theme]} (click to change)`}
2078
2073
  aria-label="Toggle color theme"
2079
2074
  @click=${()=>this.onCycleTheme()}
2080
2075
  >
2081
- ${pr[this.theme]}
2076
+ ${hr[this.theme]}
2082
2077
  </button>
2083
2078
  <div class="folderfoo-slot"></div>
2084
- `}}customElements.define("app-toolbar",fr);const Ct="mem-bucket-last-fork-folder";class gr extends k{constructor(){super(...arguments),this._forkOpenFor=null,this._forkFolder=localStorage.getItem(Ct)??"",this._forkBusy=!1,this._forkStatus=null}static{this.properties={items:{attribute:!1},refreshing:{attribute:!1},lastRefreshSummary:{attribute:!1},memoryFolderNames:{attribute:!1},skillFolderNames:{attribute:!1},onRefresh:{attribute:!1},onDismiss:{attribute:!1},onOpen:{attribute:!1},onFork:{attribute:!1},_forkOpenFor:{state:!0},_forkFolder:{state:!0},_forkBusy:{state:!0},_forkStatus:{state:!0}}}static{this.styles=w`
2079
+ `}}customElements.define("app-toolbar",ur);const Tt="mem-bucket-last-fork-folder";class fr extends k{constructor(){super(...arguments),this._forkOpenFor=null,this._forkFolder=localStorage.getItem(Tt)??"",this._forkBusy=!1,this._forkStatus=null}static{this.properties={items:{attribute:!1},refreshing:{attribute:!1},lastRefreshSummary:{attribute:!1},memoryFolderNames:{attribute:!1},skillFolderNames:{attribute:!1},onRefresh:{attribute:!1},onDismiss:{attribute:!1},onOpen:{attribute:!1},onFork:{attribute:!1},_forkOpenFor:{state:!0},_forkFolder:{state:!0},_forkBusy:{state:!0},_forkStatus:{state:!0}}}static{this.styles=$`
2085
2080
  :host { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
2086
2081
  .header {
2087
2082
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
@@ -2133,7 +2128,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2133
2128
  }
2134
2129
  .fork-status { font-size: 11px; opacity: 0.75; padding: 0 16px 8px 40px; }
2135
2130
  .empty { padding: 24px; opacity: 0.6; font-size: 13px; text-align: center; }
2136
- `}#e(e){const t=new Map;for(const s of e){const i=t.get(s.owner)??[];i.push(s),t.set(s.owner,i)}return t}#t(e){return e==="skill"?this.skillFolderNames??[]:this.memoryFolderNames??[]}#s(e){this._forkOpenFor=this._forkOpenFor===e.origin_id?null:e.origin_id,this._forkStatus=null;const t=this.#t(e.kind);!t.includes(this._forkFolder)&&t.length&&(this._forkFolder=t[0])}async#n(e){if(this._forkFolder){this._forkBusy=!0,this._forkStatus=null;try{const t=await this.onFork(e,this._forkFolder);this._forkStatus=t.message,t.ok&&(localStorage.setItem(Ct,this._forkFolder),this._forkOpenFor=null)}finally{this._forkBusy=!1}}}#r(e){const t=e.status==="revoked",s=!t&&e.entryId!==null,i=this._forkOpenFor===e.origin_id;return l`
2131
+ `}#e(e){const t=new Map;for(const s of e){const i=t.get(s.owner)??[];i.push(s),t.set(s.owner,i)}return t}#t(e){return e==="skill"?this.skillFolderNames??[]:this.memoryFolderNames??[]}#s(e){this._forkOpenFor=this._forkOpenFor===e.origin_id?null:e.origin_id,this._forkStatus=null;const t=this.#t(e.kind);!t.includes(this._forkFolder)&&t.length&&(this._forkFolder=t[0])}async#n(e){if(this._forkFolder){this._forkBusy=!0,this._forkStatus=null;try{const t=await this.onFork(e,this._forkFolder);this._forkStatus=t.message,t.ok&&(localStorage.setItem(Tt,this._forkFolder),this._forkOpenFor=null)}finally{this._forkBusy=!1}}}#r(e){const t=e.status==="revoked",s=!t&&e.entryId!==null,i=this._forkOpenFor===e.origin_id;return l`
2137
2132
  <div class="row ${t?"revoked":""}" @click=${()=>s&&this.onOpen(e)}>
2138
2133
  <span class="icon">${e.kind==="skill"?"⚡":"📝"}</span>
2139
2134
  <span class="name">${e.remote_path}</span>
@@ -2173,7 +2168,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2173
2168
  </div>
2174
2169
  `)}
2175
2170
  </div>
2176
- `}}customElements.define("shared-with-me-panel",gr);class br extends k{static{this.properties={entityTitle:{attribute:!1},description:{attribute:!1},tags:{attribute:!1},iconOrEmoji:{attribute:!1},iconImageUrl:{attribute:!1},owner:{attribute:!1},verified:{attribute:!1},stats:{attribute:!1},pinned:{attribute:!1},onPin:{attribute:!1},onCopy:{attribute:!1},copyIcon:{attribute:!1},onEdit:{attribute:!1},onDelete:{attribute:!1},selected:{attribute:!1},onClick:{attribute:!1},onActivate:{attribute:!1},actionLabel:{attribute:!1},onAction:{attribute:!1}}}static{this.styles=w`
2171
+ `}}customElements.define("shared-with-me-panel",fr);class gr extends k{static{this.properties={entityTitle:{attribute:!1},description:{attribute:!1},tags:{attribute:!1},iconOrEmoji:{attribute:!1},iconImageUrl:{attribute:!1},owner:{attribute:!1},verified:{attribute:!1},stats:{attribute:!1},pinned:{attribute:!1},onPin:{attribute:!1},onCopy:{attribute:!1},copyIcon:{attribute:!1},onEdit:{attribute:!1},onDelete:{attribute:!1},selected:{attribute:!1},onClick:{attribute:!1},onActivate:{attribute:!1},actionLabel:{attribute:!1},onAction:{attribute:!1}}}static{this.styles=$`
2177
2172
  :host { display: block; height: 100%; box-sizing: border-box; }
2178
2173
  .card {
2179
2174
  display: flex;
@@ -2355,7 +2350,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2355
2350
  </div>
2356
2351
  `:f}
2357
2352
  </div>
2358
- `}}customElements.define("entity-card",br);let re=null;const mr=200,Tt="mem-bucket-quick-prompts-folder";class vr extends k{static{this.properties={onClose:{attribute:!1},memoryFolders:{attribute:!1},openToAdd:{attribute:!1}}}#e=new h([]);#t=new h(!0);#s=new h("");#n=new h(-1);#r=new h(!1);#u=!1;#a=new h(null);#i=new h("");#o=new h("");#d=new h(localStorage.getItem(Tt)??"");#g=new h("");#h=new h("");#c=e=>this.#y(e);#b=e=>this.#w(e);static{this.styles=w`
2353
+ `}}customElements.define("entity-card",gr);let re=null;const br=200,At="mem-bucket-quick-prompts-folder";class mr extends k{static{this.properties={onClose:{attribute:!1},memoryFolders:{attribute:!1},openToAdd:{attribute:!1}}}#e=new h([]);#t=new h(!0);#s=new h("");#n=new h(-1);#r=new h(!1);#u=!1;#a=new h(null);#i=new h("");#o=new h("");#d=new h(localStorage.getItem(At)??"");#g=new h("");#h=new h("");#c=e=>this.#y(e);#b=e=>this.#$(e);static{this.styles=$`
2359
2354
  :host { display: block; }
2360
2355
  .backdrop {
2361
2356
  position: fixed; inset: 0; background: var(--overlay);
@@ -2384,7 +2379,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2384
2379
  .body { flex: 1; overflow-y: auto; padding: 14px 16px; }
2385
2380
  .grid {
2386
2381
  display: grid;
2387
- grid-template-columns: repeat(auto-fill, minmax(${mr}px, 1fr));
2382
+ grid-template-columns: repeat(auto-fill, minmax(${br}px, 1fr));
2388
2383
  gap: 10px;
2389
2384
  }
2390
2385
  .add-tile {
@@ -2429,7 +2424,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2429
2424
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
2430
2425
  padding: 8px 16px; border-top: 1px solid var(--border); font-size: 11px; opacity: 0.6;
2431
2426
  }
2432
- `}constructor(){super(),new N(this)}willUpdate(e){e.has("memoryFolders")&&this.#T()}connectedCallback(){super.connectedCallback(),this.#$(),this.#T(),this.openToAdd&&(this.#u=!0,this.#A()),window.addEventListener("keydown",this.#b)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.#b)}firstUpdated(){this.renderRoot.querySelector(".search-row input")?.focus()}async#$(){this.#t.set(!0);try{const t=await(await fetch("/api/quick-prompts")).json();this.#e.set(t)}catch(e){this.#g.set(e.message)}finally{this.#t.set(!1)}}#x(){const e=this.#d.value?this.#e.value.filter(i=>i.folder===this.#d.value):this.#e.value,t=this.#s.value.trim().toLowerCase();return[...t?e.filter(i=>i.title.toLowerCase().includes(t)||i.body.toLowerCase().includes(t)||i.tags.some(r=>r.toLowerCase().includes(t))):e].sort((i,r)=>Number(r.pinned)-Number(i.pinned))}#v(e){const t=this.#x()[this.#n.value];this.#s.set(e.target.value);const s=this.#x(),i=t?s.findIndex(r=>r.id===t.id):-1;this.#n.set(i!==-1?i:s.length>0?0:-1)}#p(){const e=this.renderRoot.querySelector(".grid");if(!e)return 1;const t=getComputedStyle(e).gridTemplateColumns;return Math.max(1,t.split(" ").filter(Boolean).length)}#y(e){if((e.metaKey||e.ctrlKey)&&e.key==="Enter"&&!this.#r.value){e.preventDefault(),this.#A();return}const t=this.#x(),s=this.#p(),i=e.target,r=i instanceof HTMLInputElement,o=i instanceof HTMLTextAreaElement,a=(r||o)&&i.value.length>0;if(!((e.key==="ArrowLeft"||e.key==="ArrowRight")&&a)&&!((e.key==="ArrowUp"||e.key==="ArrowDown")&&o)){if(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight"){e.preventDefault();let c=this.#n.value;c===-1?c=0:e.key==="ArrowDown"?c=Math.min(t.length-1,c+s):e.key==="ArrowUp"?c=Math.max(0,c-s):e.key==="ArrowRight"?c=Math.min(t.length-1,c+1):e.key==="ArrowLeft"&&(c=Math.max(0,c-1)),this.#n.set(c);return}if(e.key==="Enter"){const c=t[this.#n.value];c&&(e.preventDefault(),this.#l(c));return}e.key==="Escape"&&!this.#r.value&&this.onClose()}}#w(e){(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()==="z"&&re&&(e.preventDefault(),this.#m())}async#l(e){try{await navigator.clipboard.writeText(e.body),y.success("Copied to clipboard")}catch{y.danger("Copy failed")}this.onClose()}async#k(e){const t=!e.pinned;this.#e.set(this.#e.value.map(s=>s.id===e.id?{...s,pinned:t}:s)),await fetch(`/api/quick-prompts/${encodeURIComponent(e.id)}/pinned`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({pinned:t})})}async#_(e){re={title:e.title,body:e.body,tags:e.tags,pinned:e.pinned,folder:e.folder},this.#e.set(this.#e.value.filter(t=>t.id!==e.id)),this.#h.set("Deleted — press Cmd+Z / Ctrl+Z to undo");try{await fetch(`/api/quick-prompts/${encodeURIComponent(e.id)}`,{method:"DELETE"})}catch(t){this.#g.set(t.message)}}async#m(){const e=re;if(e){re=null,this.#h.set("");try{const s=await(await fetch("/api/quick-prompts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e.title,body:e.body,tags:e.tags,folder:e.folder})})).json();e.pinned&&(await fetch(`/api/quick-prompts/${encodeURIComponent(s.id)}/pinned`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({pinned:!0})}),s.pinned=!0),this.#e.set([s,...this.#e.value]),this.#h.set("Prompt restored"),setTimeout(()=>this.#h.set(""),2e3)}catch(t){this.#g.set(t.message)}}}#T(){const e=this.memoryFolders??[];e.length!==0&&(e.some(t=>t.name===this.#d.value)||this.#d.set(e[0].name))}#A(){this.#a.set(null),this.#i.set(""),this.#o.set(""),this.#T(),this.#r.set(!0),this.#R()}#S(e){this.#a.set(e.id),this.#i.set(e.title),this.#o.set(e.body),this.#d.set(e.folder),this.#r.set(!0),this.#R()}#R(){this.updateComplete.then(()=>{this.renderRoot.querySelector(".add-form textarea")?.focus()})}#E(){this.updateComplete.then(()=>{this.renderRoot.querySelector(".search-row input")?.focus()})}#I(e){this.#d.set(e),localStorage.setItem(Tt,e),this.#n.set(-1)}#z(){if(this.#u){this.onClose();return}this.#r.set(!1),this.#a.set(null),this.#E()}async#P(){const e=this.#o.value.trim();if(!e)return;this.#g.set("");const t=this.#a.value;try{const s=await fetch(t?`/api/quick-prompts/${encodeURIComponent(t)}`:"/api/quick-prompts",{method:t?"PATCH":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:this.#i.value.trim(),body:e,folder:this.#d.value||void 0})}),i=await s.json();if(!s.ok){this.#g.set(i.error??(t?"failed to update prompt":"failed to create prompt"));return}t?this.#e.set(this.#e.value.map(r=>r.id===t?i:r)):this.#e.set([i,...this.#e.value]),this.#r.set(!1),this.#a.set(null)}catch(s){this.#g.set(s.message)}}#C(e){e.key==="Escape"?(e.stopPropagation(),this.#z()):(e.metaKey||e.ctrlKey)&&e.key==="Enter"&&this.#P()}render(){const e=this.#x();return l`
2427
+ `}constructor(){super(),new N(this)}willUpdate(e){e.has("memoryFolders")&&this.#C()}connectedCallback(){super.connectedCallback(),this.#w(),this.#C(),this.openToAdd&&(this.#u=!0,this.#T()),window.addEventListener("keydown",this.#b)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.#b)}firstUpdated(){this.renderRoot.querySelector(".search-row input")?.focus()}async#w(){this.#t.set(!0);try{const t=await(await fetch("/api/quick-prompts")).json();this.#e.set(t)}catch(e){this.#g.set(e.message)}finally{this.#t.set(!1)}}#x(){const e=this.#d.value?this.#e.value.filter(i=>i.folder===this.#d.value):this.#e.value,t=this.#s.value.trim().toLowerCase();return[...t?e.filter(i=>i.title.toLowerCase().includes(t)||i.body.toLowerCase().includes(t)||i.tags.some(r=>r.toLowerCase().includes(t))):e].sort((i,r)=>Number(r.pinned)-Number(i.pinned))}#v(e){const t=this.#x()[this.#n.value];this.#s.set(e.target.value);const s=this.#x(),i=t?s.findIndex(r=>r.id===t.id):-1;this.#n.set(i!==-1?i:s.length>0?0:-1)}#p(){const e=this.renderRoot.querySelector(".grid");if(!e)return 1;const t=getComputedStyle(e).gridTemplateColumns;return Math.max(1,t.split(" ").filter(Boolean).length)}#y(e){if((e.metaKey||e.ctrlKey)&&e.key==="Enter"&&!this.#r.value){e.preventDefault(),this.#T();return}const t=this.#x(),s=this.#p(),i=e.target,r=i instanceof HTMLInputElement,o=i instanceof HTMLTextAreaElement,a=(r||o)&&i.value.length>0;if(!((e.key==="ArrowLeft"||e.key==="ArrowRight")&&a)&&!((e.key==="ArrowUp"||e.key==="ArrowDown")&&o)){if(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight"){e.preventDefault();let c=this.#n.value;c===-1?c=0:e.key==="ArrowDown"?c=Math.min(t.length-1,c+s):e.key==="ArrowUp"?c=Math.max(0,c-s):e.key==="ArrowRight"?c=Math.min(t.length-1,c+1):e.key==="ArrowLeft"&&(c=Math.max(0,c-1)),this.#n.set(c);return}if(e.key==="Enter"){const c=t[this.#n.value];c&&(e.preventDefault(),this.#l(c));return}e.key==="Escape"&&!this.#r.value&&this.onClose()}}#$(e){(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()==="z"&&re&&(e.preventDefault(),this.#m())}async#l(e){try{await navigator.clipboard.writeText(e.body),y.success("Copied to clipboard")}catch{y.danger("Copy failed")}this.onClose()}async#k(e){const t=!e.pinned;this.#e.set(this.#e.value.map(s=>s.id===e.id?{...s,pinned:t}:s)),await fetch(`/api/quick-prompts/${encodeURIComponent(e.id)}/pinned`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({pinned:t})})}async#_(e){re={title:e.title,body:e.body,tags:e.tags,pinned:e.pinned,folder:e.folder},this.#e.set(this.#e.value.filter(t=>t.id!==e.id)),this.#h.set("Deleted — press Cmd+Z / Ctrl+Z to undo");try{await fetch(`/api/quick-prompts/${encodeURIComponent(e.id)}`,{method:"DELETE"})}catch(t){this.#g.set(t.message)}}async#m(){const e=re;if(e){re=null,this.#h.set("");try{const s=await(await fetch("/api/quick-prompts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e.title,body:e.body,tags:e.tags,folder:e.folder})})).json();e.pinned&&(await fetch(`/api/quick-prompts/${encodeURIComponent(s.id)}/pinned`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({pinned:!0})}),s.pinned=!0),this.#e.set([s,...this.#e.value]),this.#h.set("Prompt restored"),setTimeout(()=>this.#h.set(""),2e3)}catch(t){this.#g.set(t.message)}}}#C(){const e=this.memoryFolders??[];e.length!==0&&(e.some(t=>t.name===this.#d.value)||this.#d.set(e[0].name))}#T(){this.#a.set(null),this.#i.set(""),this.#o.set(""),this.#C(),this.#r.set(!0),this.#z()}#S(e){this.#a.set(e.id),this.#i.set(e.title),this.#o.set(e.body),this.#d.set(e.folder),this.#r.set(!0),this.#z()}#z(){this.updateComplete.then(()=>{this.renderRoot.querySelector(".add-form textarea")?.focus()})}#A(){this.updateComplete.then(()=>{this.renderRoot.querySelector(".search-row input")?.focus()})}#I(e){this.#d.set(e),localStorage.setItem(At,e),this.#n.set(-1)}#P(){if(this.#u){this.onClose();return}this.#r.set(!1),this.#a.set(null),this.#A()}async#R(){const e=this.#o.value.trim();if(!e)return;this.#g.set("");const t=this.#a.value;try{const s=await fetch(t?`/api/quick-prompts/${encodeURIComponent(t)}`:"/api/quick-prompts",{method:t?"PATCH":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:this.#i.value.trim(),body:e,folder:this.#d.value||void 0})}),i=await s.json();if(!s.ok){this.#g.set(i.error??(t?"failed to update prompt":"failed to create prompt"));return}t?this.#e.set(this.#e.value.map(r=>r.id===t?i:r)):this.#e.set([i,...this.#e.value]),this.#r.set(!1),this.#a.set(null)}catch(s){this.#g.set(s.message)}}#E(e){e.key==="Escape"?(e.stopPropagation(),this.#P()):(e.metaKey||e.ctrlKey)&&e.key==="Enter"&&this.#R()}render(){const e=this.#x();return l`
2433
2428
  <div class="backdrop" @click=${t=>t.target===t.currentTarget&&this.onClose()}>
2434
2429
  <div class="modal" @keydown=${this.#c}>
2435
2430
  <div class="search-row">
@@ -2454,7 +2449,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2454
2449
  ${this.#g.value?l`<div class="error">${this.#g.value}</div>`:""}
2455
2450
  <div class="body">
2456
2451
  ${this.#r.value?l`
2457
- <div class="add-form" @keydown=${this.#C}>
2452
+ <div class="add-form" @keydown=${this.#E}>
2458
2453
  <input
2459
2454
  type="text"
2460
2455
  placeholder="Title (optional)"
@@ -2467,20 +2462,20 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2467
2462
  @input=${t=>this.#o.set(t.target.value)}
2468
2463
  ></textarea>
2469
2464
  <div class="add-form-actions">
2470
- <button class="secondary" @click=${()=>this.#z()}>Cancel</button>
2471
- <button class="primary" ?disabled=${!this.#o.value.trim()} @click=${()=>this.#P()}>
2465
+ <button class="secondary" @click=${()=>this.#P()}>Cancel</button>
2466
+ <button class="primary" ?disabled=${!this.#o.value.trim()} @click=${()=>this.#R()}>
2472
2467
  ${this.#a.value?"Save changes":"Add prompt"}
2473
2468
  </button>
2474
2469
  </div>
2475
2470
  </div>
2476
2471
  `:this.#t.value?l`<div class="empty">Loading…</div>`:e.length===0&&!this.#s.value?l`
2477
2472
  <div class="grid">
2478
- <button class="add-tile" title="Add a quick prompt" @click=${()=>this.#A()}>+</button>
2473
+ <button class="add-tile" title="Add a quick prompt" @click=${()=>this.#T()}>+</button>
2479
2474
  </div>
2480
2475
  <div class="empty">No quick prompts yet — add one to get started.</div>
2481
2476
  `:l`
2482
2477
  <div class="grid">
2483
- <button class="add-tile" title="Add a quick prompt" @click=${()=>this.#A()}>+</button>
2478
+ <button class="add-tile" title="Add a quick prompt" @click=${()=>this.#T()}>+</button>
2484
2479
  ${e.map((t,s)=>l`
2485
2480
  <entity-card
2486
2481
  .entityTitle=${t.title}
@@ -2507,12 +2502,13 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2507
2502
  </div>
2508
2503
  </div>
2509
2504
  </div>
2510
- `}}customElements.define("quick-prompts-modal",vr);function xr(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 oe=new h({mode:"off",username:null});let At=!1;function yr(){if(At)return;At=!0;const n=new EventSource("/api/folderfoo/identity-stream");n.onmessage=e=>{try{oe.set(JSON.parse(e.data))}catch{}}}let Et=!1;async function kr(n){if(Et)return;Et=!0;const{folderfooMode:e,folderfooHost:t}=await H();if(e==="off"||!t)return;const s=new URL(window.location.href),i=s.searchParams.has("shareToken"),r=s.searchParams.has("publicToken");if(!(!i&&!r)){document.addEventListener("folderfoo-share-redeemed",o=>{const a=o.detail;!a?.owner||!a?.path||a.type!=="file"||!a.originId||!a.kind||n({owner:a.owner,path:a.path,originId:a.originId,kind:a.kind,role:a.role??"member",server:t,tenantId:F})}),document.addEventListener("folderfoo-share-redeem-failed",o=>{const a=o.detail?.message;alert(a||"This link is invalid or has expired.")});try{const[o,a]=await Promise.all([ae(()=>import(`${t}/elements/auth-guard.js`),[]),ae(()=>import(`${t}/elements/api-client.js`),[])]);if(a.setTenantId(F),i&&o.redeemShareTokenFromUrl(),r){const c=s.searchParams.get("publicToken");s.searchParams.delete("publicToken"),window.history.replaceState(null,"",s.toString());const d=await o.getPublicLink(c).catch(u=>(alert(u.message||"This link is invalid or has expired."),null));d?.type==="file"&&d.originId&&d.kind&&n({owner:d.owner,path:d.path,originId:d.originId,kind:d.kind,role:"member",server:t,tenantId:F})}}catch(o){console.error("[memory-bucket] failed to load folderfoo share-accept widgets:",o)}}}let Rt=!1;const $r=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],zt=[{value:"all",label:"Show all"},{value:"hide",label:"Hide"},{value:"only",label:"Only"}],wr={tags:[],statuses:[],owners:[],doc_types:[],key_types:[],folders:[]},_r={skill:[],memory:[]},ts="mem-bucket-split-pct",ss=20,is=80;function Sr(){const n=Number(localStorage.getItem(ts));return Number.isFinite(n)&&n>=ss&&n<=is?n:40}const rs="mem-bucket-theme",xe=["system","light","dark"];function Cr(){const n=localStorage.getItem(rs);return n==="light"||n==="dark"?n:"system"}function Pt(n){n==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",n)}function Tr(){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 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 u=e.get("date_from");u&&(t.dateFrom=u);const p=e.get("date_to");return p&&(t.dateTo=p),t}class Ar extends k{static{this.styles=w`
2505
+ `}}customElements.define("quick-prompts-modal",mr);function vr(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 oe=new h({mode:"off",username:null});let Et=!1;function xr(){if(Et)return;Et=!0;const n=new EventSource("/api/folderfoo/identity-stream");n.onmessage=e=>{try{oe.set(JSON.parse(e.data))}catch{}}}let Rt=!1;async function yr(n){if(Rt)return;Rt=!0;const{folderfooMode:e,folderfooHost:t}=await H();if(e==="off"||!t)return;const s=new URL(window.location.href),i=s.searchParams.has("shareToken"),r=s.searchParams.has("publicToken");if(!(!i&&!r)){document.addEventListener("folderfoo-share-redeemed",o=>{const a=o.detail;!a?.owner||!a?.path||a.type!=="file"||!a.originId||!a.kind||n({owner:a.owner,path:a.path,originId:a.originId,kind:a.kind,role:a.role??"member",server:t,tenantId:F})}),document.addEventListener("folderfoo-share-redeem-failed",o=>{const a=o.detail?.message;alert(a||"This link is invalid or has expired.")});try{const[o,a]=await Promise.all([ae(()=>import(`${t}/elements/auth-guard.js`),[]),ae(()=>import(`${t}/elements/api-client.js`),[])]);if(a.setTenantId(F),i&&o.redeemShareTokenFromUrl(),r){const c=s.searchParams.get("publicToken");s.searchParams.delete("publicToken"),window.history.replaceState(null,"",s.toString());const d=await o.getPublicLink(c).catch(u=>(alert(u.message||"This link is invalid or has expired."),null));d?.type==="file"&&d.originId&&d.kind&&n({owner:d.owner,path:d.path,originId:d.originId,kind:d.kind,role:"member",server:t,tenantId:F})}}catch(o){console.error("[memory-bucket] failed to load folderfoo share-accept widgets:",o)}}}let zt=!1;const kr=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],Pt=[{value:"all",label:"Show all"},{value:"hide",label:"Hide"},{value:"only",label:"Only"}],wr={tags:[],statuses:[],owners:[],doc_types:[],key_types:[],folders:[]},$r={skill:[],memory:[]},ss="mem-bucket-split-pct",is=20,rs=80;function _r(){const n=Number(localStorage.getItem(ss));return Number.isFinite(n)&&n>=is&&n<=rs?n:40}const ns="mem-bucket-theme",xe=["system","light","dark"];function Sr(){const n=localStorage.getItem(ns);return n==="light"||n==="dark"?n:"system"}function It(n){n==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",n)}function Cr(){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 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 u=e.get("date_from");u&&(t.dateFrom=u);const p=e.get("date_to");return p&&(t.dateTo=p),t}class Tr extends k{static{this.styles=$`
2511
2506
  :host { display: flex; flex-direction: column; height: 100vh; position: relative; }
2512
- /* Overlays whichever header row #renderBody() renders for the current mode (.folders-bar,
2513
- .toolbar-bar, or folder-view's own .mode-row) - all three share the same 10px/16px padding,
2514
- so this lines up with them pixel-for-pixel without needing to sit inside any of them. */
2515
- .header-toolbar { position: absolute; top: 10px; right: 16px; z-index: 1; }
2507
+ /* Mounted inside whichever header row #renderBody() renders for the current mode (.folders-bar,
2508
+ .toolbar-bar, or folder-view's own .mode-row, via a <slot>) so it's a normal flex child of
2509
+ that row - margin-left: auto keeps it pinned to the right, and it wraps onto its own line
2510
+ with the rest of the row's content when the row gets too narrow. */
2511
+ .header-toolbar { margin-left: auto; }
2516
2512
  .filters {
2517
2513
  padding: 12px 16px;
2518
2514
  border-bottom: 1px solid var(--border);
@@ -2615,28 +2611,25 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2615
2611
  left: -3px; right: -3px;
2616
2612
  }
2617
2613
  label.small { font-size: 12px; opacity: 0.7; }
2618
- /* padding-right reserves room for .header-toolbar (an absolutely-positioned overlay, so it
2619
- takes no space in this row's own flex layout) so wrapped folder chips don't run under it. */
2620
2614
  .folders-bar {
2621
2615
  display: flex;
2622
2616
  gap: 6px;
2623
2617
  align-items: center;
2624
2618
  flex-wrap: wrap;
2625
- padding: 10px 320px 10px 16px;
2619
+ padding: 10px 16px;
2626
2620
  border-bottom: 1px solid var(--border);
2627
2621
  background: var(--bg-subtle);
2628
2622
  }
2623
+ /* Chips live directly in .folders-bar's own flex-wrap flow (not a nested flex container) so a
2624
+ wrapped row of chips spans the bar's full width, left-aligned, instead of being squeezed into
2625
+ whatever width a nested flex item happened to get on the first line. */
2629
2626
  .folders-bar .folder-chips {
2630
- display: flex;
2631
- gap: 6px;
2632
- align-items: center;
2633
- flex-wrap: wrap;
2634
- flex: 1 1 auto;
2635
- min-width: 0;
2627
+ display: contents;
2636
2628
  }
2637
2629
  .toolbar-bar {
2638
2630
  display: flex;
2639
2631
  align-items: center;
2632
+ flex-wrap: wrap;
2640
2633
  padding: 10px 16px;
2641
2634
  border-bottom: 1px solid var(--border);
2642
2635
  background: var(--bg-subtle);
@@ -2711,7 +2704,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2711
2704
  cursor: pointer;
2712
2705
  }
2713
2706
  .bulk-bar button.danger { border-color: var(--danger); color: var(--danger); }
2714
- `}#e=Tr();#t=new h(this.#e.query??"");#s=new h(this.#e.typeFilter??"all");#n=new h(this.#e.activeTags??[]);#r=new h(this.#e.activeFolders??[]);#u=new h([]);#a=new h(wr);#i=new h(null);#o=new h(_r);#d=new h(!1);#g=new h("");#h=new h(!1);#c=new h(Sr());#b=new h("");#$=new h(!1);#x=new h(this.#e.sort??"");#v=new h(this.#e.deprecatedFilter??"all");#p=new h(this.#e.pausedFilter??"all");#y=new h(this.#e.dateFrom??"");#w=new h(this.#e.dateTo??"");#l=new h(new Set);#k=new h(Cr());#_=new h(!1);#m=new h("entries");#T=new h([]);#A=new h([]);#S=new h(null);#R=new h(null);#E=new h(!1);#I=new h([]);#z=new h(!1);#P=new h(null);#C=new h(!1);#O=new h(!1);#F=0;#M=e=>this.#K(e);#j=()=>this.#Y();#q=e=>this.#H(e);constructor(){super(),new N(this),Pt(this.#k.value)}#G(e){this.#k.set(e),localStorage.setItem(rs,e),Pt(e)}#B(){const e=xe[(xe.indexOf(this.#k.value)+1)%xe.length];this.#G(e)}async#Z(){if(!this.#_.value){this.#_.set(!0);try{if(!(await fetch("/api/rebuild-cache",{method:"POST"})).ok)throw new Error("rebuild-cache request failed");await Promise.all([this.#D(),this.#L(),this.#f()]),y.success("Reindex complete")}catch{y.danger("Reindex failed")}finally{this.#_.set(!1)}}}#H(e){if((e.metaKey||e.ctrlKey)&&e.key==="Enter"&&!this.#C.value){e.preventDefault(),this.#O.set(!0),this.#C.set(!0);return}if(e.key!=="Shift"){this.#F=0;return}const t=Date.now();t-this.#F<450?(this.#F=0,this.#C.set(!this.#C.value)):this.#F=t}#J(e){e.preventDefault(),this.#$.set(!0),document.addEventListener("pointermove",this.#M),document.addEventListener("pointerup",this.#j)}#K(e){const t=this.renderRoot.querySelector(".body-region");if(!t)return;const s=t.getBoundingClientRect(),i=(e.clientX-s.left)/s.width*100;this.#c.set(Math.min(is,Math.max(ss,i)))}#Y(){this.#$.set(!1),document.removeEventListener("pointermove",this.#M),document.removeEventListener("pointerup",this.#j),localStorage.setItem(ts,String(this.#c.value))}#Q=new it(()=>{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.#n.value)e.append("tag",t);for(const t of this.#r.value)e.append("folder",t);return this.#x.value&&e.set("sort",this.#x.value),this.#v.value==="hide"?e.set("deprecated","0"):this.#v.value==="only"&&e.set("deprecated","1"),this.#p.value==="hide"?e.set("paused","0"):this.#p.value==="only"&&e.set("paused","1"),this.#y.value&&e.set("date_from",this.#y.value),this.#w.value&&e.set("date_to",this.#w.value),e.toString()});#X=new it(()=>{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.#v.value==="hide"?e.set("deprecated","0"):this.#v.value==="only"&&e.set("deprecated","1"),this.#p.value==="hide"?e.set("paused","0"):this.#p.value==="only"&&e.set("paused","1"),this.#y.value&&e.set("date_from",this.#y.value),this.#w.value&&e.set("date_to",this.#w.value),e.toString()});#N=()=>this.#de();#ie=e=>this.#ke(e);#re=e=>this.#$e(e);#ne=()=>this.#ce();#oe;connectedCallback(){super.connectedCallback(),this.#f(),this.#L(),this.#D().then(()=>this.#de()),window.addEventListener("focus",this.#N),document.addEventListener("visibilitychange",this.#N),window.addEventListener("keydown",this.#q),document.addEventListener("folderfoo-file-open",this.#ie),document.addEventListener("folderfoo-folder-changed",this.#re),window.addEventListener("folderfoo-auth-change",this.#ne),this.#ce(),yr(),kr(e=>this.#Ce(e)),this.#W(),this.#oe=oe.subscribe(()=>{this.#D(),this.#f(),this.#L(),this.#m.value==="shared"&&oe.value.username===null&&this.#U("entries")})}async#ke(e){const t=e.detail?.name;if(!t)return;const s=xr(t);if(s.owner){this.#b.set(`"${s.name}" is from a shared folder — opening shared files here isn't supported yet.`);return}const{folderfooMode:i,folderfooHost:r}=await H();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:F,folderPath:s.folderPath,name:s.name})}),a=await o.json();if(!o.ok){this.#b.set(a.error??`couldn't open "${s.name}"`);return}this.#b.set(""),this.#i.set({table:a.table,id:a.id})}catch(o){this.#b.set(o.message)}}async#$e(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 H();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.#D()}}#ae(){return this.shadowRoot?.querySelector("app-toolbar")?.shadowRoot?.querySelector(".folderfoo-slot")??null}#le(e){const t=document.createElement("folderfoo-profile-circle");t.setAttribute("app-name","Memory Bucket"),t.setAttribute("tenant-id",F),t.style.zoom="0.875",e.appendChild(t)}async#we(){const e=this.#ae();if(!e||e.querySelector("folderfoo-profile-circle"))return;if(Rt){this.#le(e);return}if(e.hasAttribute("data-ff-attempted"))return;e.setAttribute("data-ff-attempted","");const{folderfooMode:t,folderfooHost:s}=await H();t==="off"||!s||ae(()=>import(`${s}/elements/folderfoo-profile-circle.js`),[]).then(async()=>{Rt=!0,await this.updateComplete;const i=this.#ae();i&&!i.querySelector("folderfoo-profile-circle")&&this.#le(i)}).catch(i=>{console.warn("folderfoo-profile-circle unavailable:",i.message)})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("focus",this.#N),document.removeEventListener("visibilitychange",this.#N),window.removeEventListener("keydown",this.#q),document.removeEventListener("folderfoo-file-open",this.#ie),document.removeEventListener("folderfoo-folder-changed",this.#re),window.removeEventListener("folderfoo-auth-change",this.#ne),this.#oe?.()}async#ce(){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 H();t==="off"||!s||fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:s,token:e})}).catch(()=>{})}#ee=!1;async#de(){if(document.visibilityState==="visible"){if(this.#te().some(e=>e.remote)&&!this.#ee){this.#ee=!0;try{await fetch("/api/remote-folders/resync-all",{method:"POST"})}catch{}finally{this.#ee=!1}}this.#f(),this.#L(),this.#D(),this.renderRoot.querySelector("detail-panel")?.refresh?.()}}async#f(){const e=this.#Q.value;history.replaceState(null,"",e?`#${e}`:location.pathname+location.search);const t=await fetch(`/api/entries?${e}`);this.#u.set(await t.json()),this.renderRoot.querySelector("result-list")?.scrollTo(0,0),this.#m.value==="folder-view"&&this.#he()}async#he(){const e=await fetch(`/api/entries?${this.#X.value}`);this.#T.set(await e.json())}async#L(){const e=this.#s.value==="all"?"":`?type=${this.#s.value}`,t=await fetch(`/api/facets${e}`);this.#a.set(await t.json())}async#D(){const t=await(await fetch("/api/folders")).json();this.#o.set(t),this.#h.set(!0);const s=new Set([...t.skill,...t.memory].map(o=>o.name)),i=this.#r.value.filter(o=>s.has(o));i.length!==this.#r.value.length&&(this.#r.set(i),this.#f());const r=this.#i.value;if(r){const o=this.#ve().get(r.id);o&&!s.has(o.folder)&&this.#i.set(null)}}#U(e){this.#m.set(e),e==="channels"?this.#ue():e==="folder-view"?this.#he():e==="shared"&&(this.#W(),this.#pe())}async#W(){const e=await fetch("/api/shared-items");this.#I.set(e.ok?await e.json():[])}async#pe(){this.#z.set(!0);try{const e=await fetch("/api/shared-items/refresh",{method:"POST"});e.ok&&this.#P.set(await e.json()),await this.#W()}finally{this.#z.set(!1)}}async#_e(e){await fetch(`/api/shared-items/${encodeURIComponent(e)}`,{method:"DELETE"}),await this.#W()}#Se(e){e.entryId&&(this.#i.set({table:e.kind==="skill"?"skills":"memory_docs",id:e.entryId}),this.#U("entries"))}async#Ce(e){const t=await fetch("/api/shared-items/accept",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const s=await t.json().catch(()=>({}));alert(s.error||"Failed to accept the shared item.");return}this.#U("shared")}async#Te(e,t){const s=await fetch(`/api/shared-items/${encodeURIComponent(e.origin_id)}/fork`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folder:t})}),i=await s.json().catch(()=>({}));return s.ok?(await this.#f(),{ok:!0,message:`Copied into "${t}".`}):{ok:!1,message:i.error||`Fork failed (${s.status}).`}}async#ue(){const e=await fetch("/api/channels");this.#A.set(await e.json()),this.#S.value&&this.#fe(this.#S.value)}async#fe(e){this.#S.set(e),this.#E.set(!0);try{const t=await fetch(`/api/channels/${encodeURIComponent(e)}`);this.#R.set(t.ok?await t.json():null)}finally{this.#E.set(!1)}}#Ae(e){const t=this.#r.value;this.#r.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#f()}async#Ee(e,t){if(t.stopPropagation(),window.prompt(`Type "${e.name}" to remove this ${e.kind} folder (files on disk are untouched):`)===e.name){this.#g.set(e.name);try{if(!(await fetch(`/api/folders/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"})).ok)throw new Error("remove folder request failed");this.#r.set(this.#r.value.filter(r=>r!==e.name)),await Promise.all([this.#D(),this.#L(),this.#f()]),y.success("Folder removed")}catch{y.danger("Failed to remove folder")}finally{this.#g.set("")}}}#ge(e){this.#d.set(!1),this.#D(),this.#L(),this.#f(),y.success("Folder connected"),e&&alert(e)}#te(){return[...this.#o.value.skill,...this.#o.value.memory].sort((e,t)=>Number(e.remote)-Number(t.remote))}#be(e){this.#s.set(e),this.#n.set([]),this.#L(),this.#f()}#Re(e){const t=this.#n.value;this.#n.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#f()}#ze(e){this.#n.value.includes(e)||this.#n.set([...this.#n.value,e]),this.#f()}#Pe(e){this.#r.value.includes(e)||this.#r.set([...this.#r.value,e]),this.#f()}#me(e){this.#y.set(e),this.#w.set(e),this.#f()}#Ie(e){this.#t.set(e.target.value),this.#f()}#V(e){this.#t.set(e),this.#f()}#Le(){this.#t.set(""),this.#f()}#Fe(e){this.#i.set({table:e._table,id:e.id})}#Oe(e){this.#x.set(e.target.value),this.#f()}#De(e){this.#v.set(e.target.value),this.#f()}#Me(e){this.#p.set(e.target.value),this.#f()}#Ne(e){this.#y.set(e.target.value),this.#f()}#Ue(e){this.#w.set(e.target.value),this.#f()}#je(){this.#y.set(""),this.#w.set(""),this.#f()}#qe(e){const t=new Set(this.#l.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#l.set(t)}#ve(){return new Map(this.#u.value.map(e=>[e.id,e]))}#se(){const e=new Map,t=this.#ve();for(const s of this.#l.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#xe(e){const t=this.#se(),s=this.#l.value.size,i=await Promise.all([...t.entries()].map(([r,o])=>fetch(`/api/entries/${r}/bulk/deprecated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:o,deprecated:e})})));this.#l.set(new Set),await this.#f(),i.every(r=>r.ok)?y.success(`${s} item${s===1?"":"s"} updated`):y.danger("Bulk update failed")}async#ye(e){const t=this.#se(),s=this.#l.value.size,i=await Promise.all([...t.entries()].map(([r,o])=>fetch(`/api/entries/${r}/bulk/paused`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:o,paused:e})})));this.#l.set(new Set),await this.#f(),i.every(r=>r.ok)?y.success(`${s} item${s===1?"":"s"} updated`):y.danger("Bulk update failed")}async#Be(){if(!window.confirm(`Delete ${this.#l.value.size} doc(s)? This can't be undone.`))return;const e=this.#se(),t=this.#l.value.size,s=await Promise.all([...e.entries()].map(([i,r])=>fetch(`/api/entries/${i}/bulk/delete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:r})})));this.#l.set(new Set),await this.#f(),s.every(i=>i.ok)?y.success(`${t} item${t===1?"":"s"} deleted`):y.danger("Bulk delete failed")}#He(){const e=this.#m.value!=="channels"&&this.#m.value!=="shared"&&this.#h.value&&this.#te().length>0,t=oe.value.username!==null||this.#I.value.length>0;return l`
2707
+ `}#e=Cr();#t=new h(this.#e.query??"");#s=new h(this.#e.typeFilter??"all");#n=new h(this.#e.activeTags??[]);#r=new h(this.#e.activeFolders??[]);#u=new h([]);#a=new h(wr);#i=new h(null);#o=new h($r);#d=new h(!1);#g=new h("");#h=new h(!1);#c=new h(_r());#b=new h("");#w=new h(!1);#x=new h(this.#e.sort??"");#v=new h(this.#e.deprecatedFilter??"all");#p=new h(this.#e.pausedFilter??"all");#y=new h(this.#e.dateFrom??"");#$=new h(this.#e.dateTo??"");#l=new h(new Set);#k=new h(Sr());#_=new h(!1);#m=new h("entries");#C=new h([]);#T=new h([]);#S=new h(null);#z=new h(null);#A=new h(!1);#I=new h([]);#P=new h(!1);#R=new h(null);#E=new h(!1);#O=new h(!1);#F=0;#G=e=>this.#H(e);#U=()=>this.#Q();#j=e=>this.#B(e);constructor(){super(),new N(this),It(this.#k.value)}#W(e){this.#k.set(e),localStorage.setItem(ns,e),It(e)}#q(){const e=xe[(xe.indexOf(this.#k.value)+1)%xe.length];this.#W(e)}async#J(){if(!this.#_.value){this.#_.set(!0);try{if(!(await fetch("/api/rebuild-cache",{method:"POST"})).ok)throw new Error("rebuild-cache request failed");await Promise.all([this.#D(),this.#L(),this.#f()]),y.success("Reindex complete")}catch{y.danger("Reindex failed")}finally{this.#_.set(!1)}}}#B(e){if((e.metaKey||e.ctrlKey)&&e.key==="Enter"&&!this.#E.value){e.preventDefault(),this.#O.set(!0),this.#E.set(!0);return}if(e.key!=="Shift"){this.#F=0;return}const t=Date.now();t-this.#F<450?(this.#F=0,this.#E.set(!this.#E.value)):this.#F=t}#Y(e){e.preventDefault(),this.#w.set(!0),document.addEventListener("pointermove",this.#G),document.addEventListener("pointerup",this.#U)}#H(e){const t=this.renderRoot.querySelector(".body-region");if(!t)return;const s=t.getBoundingClientRect(),i=(e.clientX-s.left)/s.width*100;this.#c.set(Math.min(rs,Math.max(is,i)))}#Q(){this.#w.set(!1),document.removeEventListener("pointermove",this.#G),document.removeEventListener("pointerup",this.#U),localStorage.setItem(ss,String(this.#c.value))}#X=new it(()=>{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.#n.value)e.append("tag",t);for(const t of this.#r.value)e.append("folder",t);return this.#x.value&&e.set("sort",this.#x.value),this.#v.value==="hide"?e.set("deprecated","0"):this.#v.value==="only"&&e.set("deprecated","1"),this.#p.value==="hide"?e.set("paused","0"):this.#p.value==="only"&&e.set("paused","1"),this.#y.value&&e.set("date_from",this.#y.value),this.#$.value&&e.set("date_to",this.#$.value),e.toString()});#ee=new it(()=>{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.#v.value==="hide"?e.set("deprecated","0"):this.#v.value==="only"&&e.set("deprecated","1"),this.#p.value==="hide"?e.set("paused","0"):this.#p.value==="only"&&e.set("paused","1"),this.#y.value&&e.set("date_from",this.#y.value),this.#$.value&&e.set("date_to",this.#$.value),e.toString()});#M=()=>this.#he();#re=e=>this.#we(e);#ne=e=>this.#$e(e);#oe=()=>this.#de();#ae;connectedCallback(){super.connectedCallback(),this.#f(),this.#L(),this.#D().then(()=>this.#he()),window.addEventListener("focus",this.#M),document.addEventListener("visibilitychange",this.#M),window.addEventListener("keydown",this.#j),document.addEventListener("folderfoo-file-open",this.#re),document.addEventListener("folderfoo-folder-changed",this.#ne),window.addEventListener("folderfoo-auth-change",this.#oe),this.#de(),xr(),yr(e=>this.#Te(e)),this.#Z(),this.#ae=oe.subscribe(()=>{this.#D(),this.#f(),this.#L(),this.#m.value==="shared"&&oe.value.username===null&&this.#N("entries")})}async#we(e){const t=e.detail?.name;if(!t)return;const s=vr(t);if(s.owner){this.#b.set(`"${s.name}" is from a shared folder — opening shared files here isn't supported yet.`);return}const{folderfooMode:i,folderfooHost:r}=await H();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:F,folderPath:s.folderPath,name:s.name})}),a=await o.json();if(!o.ok){this.#b.set(a.error??`couldn't open "${s.name}"`);return}this.#b.set(""),this.#i.set({table:a.table,id:a.id})}catch(o){this.#b.set(o.message)}}async#$e(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 H();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.#D()}}#le(){return this.shadowRoot?.querySelector("app-toolbar")?.shadowRoot?.querySelector(".folderfoo-slot")??null}#ce(e){const t=document.createElement("folderfoo-profile-circle");t.setAttribute("app-name","Memory Bucket"),t.setAttribute("tenant-id",F),t.style.zoom="0.875",e.appendChild(t)}async#_e(){const e=this.#le();if(!e||e.querySelector("folderfoo-profile-circle"))return;if(zt){this.#ce(e);return}if(e.hasAttribute("data-ff-attempted"))return;e.setAttribute("data-ff-attempted","");const{folderfooMode:t,folderfooHost:s}=await H();t==="off"||!s||ae(()=>import(`${s}/elements/folderfoo-profile-circle.js`),[]).then(async()=>{zt=!0,await this.updateComplete;const i=this.#le();i&&!i.querySelector("folderfoo-profile-circle")&&this.#ce(i)}).catch(i=>{console.warn("folderfoo-profile-circle unavailable:",i.message)})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("focus",this.#M),document.removeEventListener("visibilitychange",this.#M),window.removeEventListener("keydown",this.#j),document.removeEventListener("folderfoo-file-open",this.#re),document.removeEventListener("folderfoo-folder-changed",this.#ne),window.removeEventListener("folderfoo-auth-change",this.#oe),this.#ae?.()}async#de(){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 H();t==="off"||!s||fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:s,token:e})}).catch(()=>{})}#te=!1;async#he(){if(document.visibilityState==="visible"){if(this.#se().some(e=>e.remote)&&!this.#te){this.#te=!0;try{await fetch("/api/remote-folders/resync-all",{method:"POST"})}catch{}finally{this.#te=!1}}this.#f(),this.#L(),this.#D(),this.renderRoot.querySelector("detail-panel")?.refresh?.()}}async#f(){const e=this.#X.value;history.replaceState(null,"",e?`#${e}`:location.pathname+location.search);const t=await fetch(`/api/entries?${e}`);this.#u.set(await t.json()),this.renderRoot.querySelector("result-list")?.scrollTo(0,0),this.#m.value==="folder-view"&&this.#pe()}async#pe(){const e=await fetch(`/api/entries?${this.#ee.value}`);this.#C.set(await e.json())}async#L(){const e=this.#s.value==="all"?"":`?type=${this.#s.value}`,t=await fetch(`/api/facets${e}`);this.#a.set(await t.json())}async#D(){const t=await(await fetch("/api/folders")).json();this.#o.set(t),this.#h.set(!0);const s=new Set([...t.skill,...t.memory].map(o=>o.name)),i=this.#r.value.filter(o=>s.has(o));i.length!==this.#r.value.length&&(this.#r.set(i),this.#f());const r=this.#i.value;if(r){const o=this.#xe().get(r.id);o&&!s.has(o.folder)&&this.#i.set(null)}}#N(e){this.#m.set(e),e==="channels"?this.#fe():e==="folder-view"?this.#pe():e==="shared"&&(this.#Z(),this.#ue())}async#Z(){const e=await fetch("/api/shared-items");this.#I.set(e.ok?await e.json():[])}async#ue(){this.#P.set(!0);try{const e=await fetch("/api/shared-items/refresh",{method:"POST"});e.ok&&this.#R.set(await e.json()),await this.#Z()}finally{this.#P.set(!1)}}async#Se(e){await fetch(`/api/shared-items/${encodeURIComponent(e)}`,{method:"DELETE"}),await this.#Z()}#Ce(e){e.entryId&&(this.#i.set({table:e.kind==="skill"?"skills":"memory_docs",id:e.entryId}),this.#N("entries"))}async#Te(e){const t=await fetch("/api/shared-items/accept",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const s=await t.json().catch(()=>({}));alert(s.error||"Failed to accept the shared item.");return}this.#N("shared")}async#Ae(e,t){const s=await fetch(`/api/shared-items/${encodeURIComponent(e.origin_id)}/fork`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folder:t})}),i=await s.json().catch(()=>({}));return s.ok?(await this.#f(),{ok:!0,message:`Copied into "${t}".`}):{ok:!1,message:i.error||`Fork failed (${s.status}).`}}async#fe(){const e=await fetch("/api/channels");this.#T.set(await e.json()),this.#S.value&&this.#ge(this.#S.value)}async#ge(e){this.#S.set(e),this.#A.set(!0);try{const t=await fetch(`/api/channels/${encodeURIComponent(e)}`);this.#z.set(t.ok?await t.json():null)}finally{this.#A.set(!1)}}#Ee(e){const t=this.#r.value;this.#r.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#f()}async#Re(e,t){if(t.stopPropagation(),window.prompt(`Type "${e.name}" to remove this ${e.kind} folder (files on disk are untouched):`)===e.name){this.#g.set(e.name);try{if(!(await fetch(`/api/folders/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"})).ok)throw new Error("remove folder request failed");this.#r.set(this.#r.value.filter(r=>r!==e.name)),await Promise.all([this.#D(),this.#L(),this.#f()]),y.success("Folder removed")}catch{y.danger("Failed to remove folder")}finally{this.#g.set("")}}}#be(e){this.#d.set(!1),this.#D(),this.#L(),this.#f(),y.success("Folder connected"),e&&alert(e)}#se(){return[...this.#o.value.skill,...this.#o.value.memory].sort((e,t)=>Number(e.remote)-Number(t.remote))}#me(e){this.#s.set(e),this.#n.set([]),this.#L(),this.#f()}#ze(e){const t=this.#n.value;this.#n.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#f()}#Pe(e){this.#n.value.includes(e)||this.#n.set([...this.#n.value,e]),this.#f()}#Ie(e){this.#r.value.includes(e)||this.#r.set([...this.#r.value,e]),this.#f()}#ve(e){this.#y.set(e),this.#$.set(e),this.#f()}#Le(e){this.#t.set(e.target.value),this.#f()}#K(e){this.#t.set(e),this.#f()}#Fe(){this.#t.set(""),this.#f()}#Oe(e){this.#i.set({table:e._table,id:e.id})}#De(e){this.#x.set(e.target.value),this.#f()}#Me(e){this.#v.set(e.target.value),this.#f()}#Ne(e){this.#p.set(e.target.value),this.#f()}#Ue(e){this.#y.set(e.target.value),this.#f()}#je(e){this.#$.set(e.target.value),this.#f()}#qe(){this.#y.set(""),this.#$.set(""),this.#f()}#Be(e){const t=new Set(this.#l.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#l.set(t)}#xe(){return new Map(this.#u.value.map(e=>[e.id,e]))}#ie(){const e=new Map,t=this.#xe();for(const s of this.#l.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#ye(e){const t=this.#ie(),s=this.#l.value.size,i=await Promise.all([...t.entries()].map(([r,o])=>fetch(`/api/entries/${r}/bulk/deprecated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:o,deprecated:e})})));this.#l.set(new Set),await this.#f(),i.every(r=>r.ok)?y.success(`${s} item${s===1?"":"s"} updated`):y.danger("Bulk update failed")}async#ke(e){const t=this.#ie(),s=this.#l.value.size,i=await Promise.all([...t.entries()].map(([r,o])=>fetch(`/api/entries/${r}/bulk/paused`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:o,paused:e})})));this.#l.set(new Set),await this.#f(),i.every(r=>r.ok)?y.success(`${s} item${s===1?"":"s"} updated`):y.danger("Bulk update failed")}async#He(){if(!window.confirm(`Delete ${this.#l.value.size} doc(s)? This can't be undone.`))return;const e=this.#ie(),t=this.#l.value.size,s=await Promise.all([...e.entries()].map(([i,r])=>fetch(`/api/entries/${i}/bulk/delete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:r})})));this.#l.set(new Set),await this.#f(),s.every(i=>i.ok)?y.success(`${t} item${t===1?"":"s"} deleted`):y.danger("Bulk delete failed")}#V(){const e=this.#m.value!=="channels"&&this.#m.value!=="shared"&&this.#h.value&&this.#se().length>0,t=oe.value.username!==null||this.#I.value.length>0;return l`
2715
2708
  <app-toolbar
2716
2709
  .showReindex=${e}
2717
2710
  .reindexing=${this.#_.value}
@@ -2720,57 +2713,64 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2720
2713
  .showShared=${t}
2721
2714
  .sharedActive=${this.#m.value==="shared"}
2722
2715
  .theme=${this.#k.value}
2723
- .onReindex=${()=>this.#Z()}
2724
- .onToggleChannels=${()=>this.#U(this.#m.value==="channels"?"entries":"channels")}
2725
- .onToggleFolderView=${()=>this.#U(this.#m.value==="folder-view"?"entries":"folder-view")}
2726
- .onToggleShared=${()=>this.#U(this.#m.value==="shared"?"entries":"shared")}
2727
- .onCycleTheme=${()=>this.#B()}
2716
+ .onReindex=${()=>this.#J()}
2717
+ .onToggleChannels=${()=>this.#N(this.#m.value==="channels"?"entries":"channels")}
2718
+ .onToggleFolderView=${()=>this.#N(this.#m.value==="folder-view"?"entries":"folder-view")}
2719
+ .onToggleShared=${()=>this.#N(this.#m.value==="shared"?"entries":"shared")}
2720
+ .onCycleTheme=${()=>this.#q()}
2728
2721
  ></app-toolbar>
2729
- `}updated(){this.#we()}render(){return l`
2730
- <div class="header-toolbar">${this.#He()}</div>
2722
+ `}updated(){this.#_e()}render(){return l`
2731
2723
  ${this.#Ke()}
2732
- ${this.#C.value?l`<quick-prompts-modal
2733
- .onClose=${()=>{this.#C.set(!1),this.#O.set(!1)}}
2724
+ ${this.#E.value?l`<quick-prompts-modal
2725
+ .onClose=${()=>{this.#E.set(!1),this.#O.set(!1)}}
2734
2726
  .memoryFolders=${this.#o.value.memory}
2735
2727
  .openToAdd=${this.#O.value}
2736
2728
  ></quick-prompts-modal>`:""}
2737
2729
  <toast-stack></toast-stack>
2738
- `}#Ke(){const e=this.#a.value,t=this.#te();return this.#m.value==="shared"?l`
2739
- <div class="toolbar-bar"></div>
2730
+ `}#Ke(){const e=this.#a.value,t=this.#se();return this.#m.value==="shared"?l`
2731
+ <div class="toolbar-bar">
2732
+ <div class="header-toolbar">${this.#V()}</div>
2733
+ </div>
2740
2734
  <shared-with-me-panel
2741
2735
  .items=${this.#I.value}
2742
- .refreshing=${this.#z.value}
2743
- .lastRefreshSummary=${this.#P.value}
2736
+ .refreshing=${this.#P.value}
2737
+ .lastRefreshSummary=${this.#R.value}
2744
2738
  .memoryFolderNames=${this.#o.value.memory.map(s=>s.name)}
2745
2739
  .skillFolderNames=${this.#o.value.skill.map(s=>s.name)}
2746
- .onRefresh=${()=>this.#pe()}
2747
- .onDismiss=${s=>this.#_e(s)}
2748
- .onOpen=${s=>this.#Se(s)}
2749
- .onFork=${(s,i)=>this.#Te(s,i)}
2740
+ .onRefresh=${()=>this.#ue()}
2741
+ .onDismiss=${s=>this.#Se(s)}
2742
+ .onOpen=${s=>this.#Ce(s)}
2743
+ .onFork=${(s,i)=>this.#Ae(s,i)}
2750
2744
  ></shared-with-me-panel>
2751
2745
  `:this.#m.value==="channels"?l`
2752
- <div class="toolbar-bar"></div>
2746
+ <div class="toolbar-bar">
2747
+ <div class="header-toolbar">${this.#V()}</div>
2748
+ </div>
2753
2749
  <channel-view
2754
- .channels=${this.#A.value}
2750
+ .channels=${this.#T.value}
2755
2751
  .selected=${this.#S.value}
2756
- .detail=${this.#R.value}
2757
- .loading=${this.#E.value}
2758
- .onSelect=${s=>this.#fe(s)}
2759
- .onRefresh=${()=>this.#ue()}
2752
+ .detail=${this.#z.value}
2753
+ .loading=${this.#A.value}
2754
+ .onSelect=${s=>this.#ge(s)}
2755
+ .onRefresh=${()=>this.#fe()}
2760
2756
  ></channel-view>
2761
2757
  `:this.#m.value==="folder-view"?l`
2762
2758
  <folder-view
2763
- .entries=${this.#T.value}
2759
+ .entries=${this.#C.value}
2764
2760
  .allFolders=${t}
2765
2761
  .facets=${e}
2766
2762
  .typeFilter=${this.#s.value}
2767
- .onTypeChange=${s=>this.#be(s)}
2763
+ .onTypeChange=${s=>this.#me(s)}
2768
2764
  .onChanged=${()=>{this.#f(),this.#L()}}
2769
- .onDateClick=${s=>this.#me(s)}
2770
- .onKeyClick=${s=>this.#V(s)}
2771
- ></folder-view>
2765
+ .onDateClick=${s=>this.#ve(s)}
2766
+ .onKeyClick=${s=>this.#K(s)}
2767
+ >
2768
+ <div class="header-toolbar" slot="mode-row-end">${this.#V()}</div>
2769
+ </folder-view>
2772
2770
  `:this.#h.value&&t.length===0&&!this.#d.value?l`
2773
- <div class="toolbar-bar"></div>
2771
+ <div class="toolbar-bar">
2772
+ <div class="header-toolbar">${this.#V()}</div>
2773
+ </div>
2774
2774
  <div class="first-run">
2775
2775
  <h1>No folders configured yet</h1>
2776
2776
  <p>
@@ -2782,7 +2782,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2782
2782
  ${this.#d.value?l`<add-folder-modal
2783
2783
  .defaultKind=${"skill"}
2784
2784
  .lockKind=${!1}
2785
- .onAdded=${s=>this.#ge(s)}
2785
+ .onAdded=${s=>this.#be(s)}
2786
2786
  .onCancel=${()=>this.#d.set(!1)}
2787
2787
  ></add-folder-modal>`:""}
2788
2788
  `:l`
@@ -2793,20 +2793,21 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2793
2793
  <button
2794
2794
  class="folder-chip ${s.remote?"remote":""} ${this.#r.value.includes(s.name)?"active":""}"
2795
2795
  title=${s.remote?`${s.path} (remote — folderfoo)`:s.path}
2796
- @click=${()=>this.#Ae(s.name)}
2796
+ @click=${()=>this.#Ee(s.name)}
2797
2797
  >
2798
2798
  ${s.remote?l`<span class="remote-dot"></span>`:"📁"} ${s.name}
2799
2799
  <span class="kind">(${s.kind==="skill"?"s":"m"})</span>
2800
2800
  <span
2801
2801
  class="remove"
2802
2802
  title="Remove folder"
2803
- @click=${i=>this.#Ee(s,i)}
2803
+ @click=${i=>this.#Re(s,i)}
2804
2804
  >${this.#g.value===s.name?"…":"✕"}</span
2805
2805
  >
2806
2806
  </button>
2807
2807
  `)}
2808
2808
  <button class="add-folder-btn" @click=${()=>this.#d.set(!0)}>+ Add folder</button>
2809
2809
  </div>
2810
+ <div class="header-toolbar">${this.#V()}</div>
2810
2811
  </div>
2811
2812
  ${this.#b.value?l`
2812
2813
  <div class="folderfoo-open-banner">
@@ -2821,24 +2822,24 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2821
2822
  type="search"
2822
2823
  placeholder="Search descriptions, bodies, tags..."
2823
2824
  .value=${this.#t.value}
2824
- @input=${s=>this.#Ie(s)}
2825
+ @input=${s=>this.#Le(s)}
2825
2826
  />
2826
2827
  ${this.#t.value?l`
2827
2828
  <button
2828
2829
  class="search-clear-btn"
2829
2830
  title="Clear search"
2830
2831
  aria-label="Clear search"
2831
- @click=${()=>this.#Le()}
2832
+ @click=${()=>this.#Fe()}
2832
2833
  >
2833
2834
 
2834
2835
  </button>
2835
2836
  `:""}
2836
2837
  </div>
2837
2838
  <div class="row type-toggle">
2838
- ${$r.map(s=>l`
2839
+ ${kr.map(s=>l`
2839
2840
  <button
2840
2841
  class=${this.#s.value===s.value?"active":""}
2841
- @click=${()=>this.#be(s.value)}
2842
+ @click=${()=>this.#me(s.value)}
2842
2843
  >
2843
2844
  ${s.label}
2844
2845
  </button>
@@ -2848,7 +2849,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2848
2849
  <tag-multiselect
2849
2850
  .tags=${e.tags}
2850
2851
  .active=${this.#n.value}
2851
- .onToggle=${s=>this.#Re(s)}
2852
+ .onToggle=${s=>this.#ze(s)}
2852
2853
  .width=${"260px"}
2853
2854
  ></tag-multiselect>
2854
2855
  `}
@@ -2858,21 +2859,21 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2858
2859
  type="date"
2859
2860
  aria-label="From date"
2860
2861
  .value=${this.#y.value}
2861
- @change=${s=>this.#Ne(s)}
2862
+ @change=${s=>this.#Ue(s)}
2862
2863
  />
2863
2864
  <span class="date-range-sep">–</span>
2864
2865
  <input
2865
2866
  type="date"
2866
2867
  aria-label="To date"
2867
- .value=${this.#w.value}
2868
- @change=${s=>this.#Ue(s)}
2868
+ .value=${this.#$.value}
2869
+ @change=${s=>this.#je(s)}
2869
2870
  />
2870
- ${this.#y.value||this.#w.value?l`
2871
+ ${this.#y.value||this.#$.value?l`
2871
2872
  <button
2872
2873
  class="date-range-clear"
2873
2874
  title="Clear date range"
2874
2875
  aria-label="Clear date range"
2875
- @click=${()=>this.#je()}
2876
+ @click=${()=>this.#qe()}
2876
2877
  >
2877
2878
 
2878
2879
  </button>
@@ -2881,7 +2882,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2881
2882
  <span class="filter-label">Sort:</span>
2882
2883
  <select
2883
2884
  .value=${this.#x.value||(this.#t.value.trim()?"relevance":"mtime_desc")}
2884
- @change=${s=>this.#Oe(s)}
2885
+ @change=${s=>this.#De(s)}
2885
2886
  >
2886
2887
  ${this.#t.value.trim()?l`<option value="relevance">Relevance</option>`:""}
2887
2888
  <option value="mtime_desc">Recently touched</option>
@@ -2890,23 +2891,23 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2890
2891
  <option value="name_asc">Name</option>
2891
2892
  </select>
2892
2893
  <span class="filter-label">Deprecated:</span>
2893
- <select .value=${this.#v.value} @change=${s=>this.#De(s)}>
2894
- ${zt.map(s=>l`<option value=${s.value}>${s.label}</option>`)}
2894
+ <select .value=${this.#v.value} @change=${s=>this.#Me(s)}>
2895
+ ${Pt.map(s=>l`<option value=${s.value}>${s.label}</option>`)}
2895
2896
  </select>
2896
2897
  <span class="filter-label">Paused:</span>
2897
- <select .value=${this.#p.value} @change=${s=>this.#Me(s)}>
2898
- ${zt.map(s=>l`<option value=${s.value}>${s.label}</option>`)}
2898
+ <select .value=${this.#p.value} @change=${s=>this.#Ne(s)}>
2899
+ ${Pt.map(s=>l`<option value=${s.value}>${s.label}</option>`)}
2899
2900
  </select>
2900
2901
  </div>
2901
2902
  </div>
2902
2903
  ${this.#l.value.size>0?l`
2903
2904
  <div class="bulk-bar">
2904
2905
  <span>${this.#l.value.size} selected</span>
2905
- <button @click=${()=>this.#xe(!0)}>Mark deprecated</button>
2906
- <button @click=${()=>this.#xe(!1)}>Un-deprecate</button>
2907
- <button @click=${()=>this.#ye(!0)}>Pause</button>
2908
- <button @click=${()=>this.#ye(!1)}>Resume</button>
2909
- <button class="danger" @click=${()=>this.#Be()}>Delete</button>
2906
+ <button @click=${()=>this.#ye(!0)}>Mark deprecated</button>
2907
+ <button @click=${()=>this.#ye(!1)}>Un-deprecate</button>
2908
+ <button @click=${()=>this.#ke(!0)}>Pause</button>
2909
+ <button @click=${()=>this.#ke(!1)}>Resume</button>
2910
+ <button class="danger" @click=${()=>this.#He()}>Delete</button>
2910
2911
  <button @click=${()=>this.#l.set(new Set)}>Clear</button>
2911
2912
  </div>
2912
2913
  `:""}
@@ -2915,32 +2916,32 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2915
2916
  style=${`width: ${this.#c.value}%; border-right: 1px solid var(--border);`}
2916
2917
  .results=${this.#u.value}
2917
2918
  .showFolder=${t.length>1}
2918
- .onSelect=${s=>this.#Fe(s)}
2919
+ .onSelect=${s=>this.#Oe(s)}
2919
2920
  .selectedIds=${this.#l.value}
2920
- .onToggleSelect=${s=>this.#qe(s)}
2921
- .onKeyClick=${s=>this.#V(s)}
2922
- .onGroupClick=${s=>this.#V(s)}
2921
+ .onToggleSelect=${s=>this.#Be(s)}
2922
+ .onKeyClick=${s=>this.#K(s)}
2923
+ .onGroupClick=${s=>this.#K(s)}
2923
2924
  ></result-list>
2924
2925
  <div
2925
- class="splitter ${this.#$.value?"dragging":""}"
2926
- @pointerdown=${s=>this.#J(s)}
2926
+ class="splitter ${this.#w.value?"dragging":""}"
2927
+ @pointerdown=${s=>this.#Y(s)}
2927
2928
  ></div>
2928
2929
  <detail-panel
2929
2930
  .selected=${this.#i.value}
2930
2931
  .facets=${e}
2931
2932
  .onChanged=${()=>{this.#f(),this.#L()}}
2932
- .onTagClick=${s=>this.#ze(s)}
2933
- .onFolderClick=${s=>this.#Pe(s)}
2934
- .onDateClick=${s=>this.#me(s)}
2935
- .onKeyClick=${s=>this.#V(s)}
2936
- .onGroupClick=${s=>this.#V(s)}
2933
+ .onTagClick=${s=>this.#Pe(s)}
2934
+ .onFolderClick=${s=>this.#Ie(s)}
2935
+ .onDateClick=${s=>this.#ve(s)}
2936
+ .onKeyClick=${s=>this.#K(s)}
2937
+ .onGroupClick=${s=>this.#K(s)}
2937
2938
  .onGone=${()=>this.#i.set(null)}
2938
2939
  ></detail-panel>
2939
2940
  </div>
2940
2941
  ${this.#d.value?l`<add-folder-modal
2941
2942
  .defaultKind=${"skill"}
2942
2943
  .lockKind=${!1}
2943
- .onAdded=${s=>this.#ge(s)}
2944
+ .onAdded=${s=>this.#be(s)}
2944
2945
  .onCancel=${()=>this.#d.set(!1)}
2945
2946
  ></add-folder-modal>`:""}
2946
- `}}customElements.define("mem-bucket-app",Ar);
2947
+ `}}customElements.define("mem-bucket-app",Tr);