mcp-memory-bucket 0.12.6 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
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 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;/**
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),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 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
@@ -12,12 +12,12 @@
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
13
  */const Ee=globalThis,Ze=n=>n,le=Ee.trustedTypes,Je=le?le.createPolicy("lit-html",{createHTML:n=>n}):void 0,Ot="$lit$",P=`lit$${Math.random().toFixed(9).slice(2)}$`,Dt="?"+P,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,z=RegExp(`>|${be}(?:([^\\s"'>=/]+)(${be}*=${be}*(?:[^
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=z):u[3]!==void 0&&(o=z):o===z?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?z:u[3]==='"'?et:Xe):o===et||o===Xe?o=z:o===Ye||o===Qe?o=Z:(o=z,i=void 0);const x=o===z&&n[a+1].startsWith("/>")?" ":"";r+=o===Z?c+ys:p>=0?(s.push(d),c.slice(0,p)+Ot+c.slice(p)+P+x):c+P+(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(P),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(P)&&(c.push({type:6,index:r}),i.removeAttribute(p));if(Mt.test(i.tagName)){const p=i.textContent.split(P),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(P,p+1))!==-1;)c.push({type:7,index:r}),p+=P.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 Pe(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++}},Pe=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,Pe),(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 Pe(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,$s=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),l=$s(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 ws=(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=z):u[3]!==void 0&&(o=z):o===z?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?z:u[3]==='"'?et:Xe):o===et||o===Xe?o=z:o===Ye||o===Qe?o=Z:(o=z,i=void 0);const x=o===z&&n[a+1].startsWith("/>")?" ":"";r+=o===Z?c+ys:p>=0?(s.push(d),c.slice(0,p)+Ot+c.slice(p)+P+x):c+P+(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]=ws(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(P),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(P)&&(c.push({type:6,index:r}),i.removeAttribute(p));if(Mt.test(i.tagName)){const p=i.textContent.split(P),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(P,p+1))!==-1;)c.push({type:7,index:r}),p+=P.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 Pe(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++}},Pe=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,Pe),(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 Pe(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
19
  */const ze=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,ze.litElementHydrateSupport?.({LitElement:k});const Ps=ze.litElementPolyfillSupport;Ps?.({LitElement:k});(ze.litElementVersions??=[]).push("4.2.2");var qt;let me=0;const st=new Set;function zs(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){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 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=$`
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=w`
21
21
  :host { display: block; }
22
22
  .count-header {
23
23
  padding: 8px 14px;
@@ -137,9 +137,9 @@
137
137
  </div>
138
138
  </div>
139
139
  </div>
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},Pi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ot=n=>Pi[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(`
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($.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}})(),$={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)",$i=b(ki,"gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,V).replace(/punct/g,E).getRegex(),wi=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:wi,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()},$e={...Ue,emStrongRDelimAst:fi,emStrongLDelim:di,delLDelim:yi,delRDelim:$i,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={...$e,br:b(Gt).replace("{2,}","*").getRegex(),text:b($e.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ie={normal:Ne,gfm:Xs,pedantic:ei},J={normal:Ue,gfm:$e,breaks:Ri,pedantic:Ei},Pi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ot=n=>Pi[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
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 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
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],`
@@ -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 $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+=`
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+=`
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(w.notSpaceStart)?.[0],i=n.replace(w.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($.notSpaceStart)?.[0],i=n.replace($.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>
@@ -209,7 +209,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
209
209
  * @license
210
210
  * Copyright 2017 Google LLC
211
211
  * SPDX-License-Identifier: BSD-3-Clause
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=$`
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=w`
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()}#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`
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#l(){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.#l&&(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.#w(r)}
347
+ @keydown=${r=>this.#$(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>`:""}
@@ -378,7 +378,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
378
378
  <input type="checkbox" .checked=${e.includes(r)} tabindex="-1" />
379
379
  ${r}
380
380
  </li>
381
- `):this.#c?l`
381
+ `):this.#l?l`
382
382
  <li
383
383
  class="option create-option"
384
384
  @mousedown=${r=>r.preventDefault()}
@@ -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",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=$`
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=w`
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#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`
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,"-")}#l(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)}#y(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.#l(i):this.#s.value===s.length&&this.#b?this.#l(this.#e.value):this.#e.value.trim()&&this.#l(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"
@@ -488,8 +488,8 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
488
488
  @input=${r=>this.#g(r)}
489
489
  @focus=${()=>this.#i()}
490
490
  @click=${()=>this.#i()}
491
- @keydown=${r=>this.#x(r)}
492
- @blur=${()=>{this.#t.value&&this.#e.value.trim()&&this.#h(this.#e.value)!==e?this.#c(this.#e.value):this.#o()}}
491
+ @keydown=${r=>this.#y(r)}
492
+ @blur=${()=>{this.#t.value&&this.#e.value.trim()&&this.#h(this.#e.value)!==e?this.#l(this.#e.value):this.#o()}}
493
493
  />
494
494
  <button
495
495
  class="chevron-btn ${s?"open":""}"
@@ -515,7 +515,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
515
515
  aria-selected=${r===e}
516
516
  class=${`option ${r===e?"selected":""} ${o===i?"highlighted":""}`}
517
517
  @mousedown=${a=>a.preventDefault()}
518
- @click=${()=>this.#c(r)}
518
+ @click=${()=>this.#l(r)}
519
519
  >
520
520
  ${r}
521
521
  </li>
@@ -526,14 +526,14 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
526
526
  role="option"
527
527
  class=${`option create-option ${t.length===i?"highlighted":""}`}
528
528
  @mousedown=${r=>r.preventDefault()}
529
- @click=${()=>this.#c(this.#e.value)}
529
+ @click=${()=>this.#l(this.#e.value)}
530
530
  >
531
531
  ${t.length?"Create":"No match. Create"} '${this.#h(this.#e.value)}'
532
532
  </li>
533
533
  `:""}
534
534
  ${!t.length&&!this.#b?l`<li class="empty">No options</li>`:""}
535
535
  </ul>
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=$`
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=w`
537
537
  :host {
538
538
  display: inline-flex;
539
539
  position: relative;
@@ -639,7 +639,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
639
639
  >
640
640
  ${this.text}
641
641
  </div>
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=$`
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=w`
643
643
  :host {
644
644
  position: fixed;
645
645
  top: 14px;
@@ -678,7 +678,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
678
678
  <span>${e.message}</span>
679
679
  </div>
680
680
  `)}
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=$`
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=w`
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=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}"?
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}#g(){return this.selected?.table==="skills"&&this._doc?.folder?`?folder=${encodeURIComponent(this._doc.folder)}`:""}async#h(){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${this.#g()}`,{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#l(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}${this.#g()}`,{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#b(){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?.()}#$(){this._doc&&(this._draft=mt(this._doc),this._editing=!0,this._addingFrontmatter=!1)}#y(){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})}#w(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})}#c(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#k(){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#_(){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?.()}#C(){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?.()}#m(){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#C(){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?.()}#A(){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">
@@ -1079,7 +1079,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1079
1079
  <button class="cancel" @click=${()=>this.#v()}>Cancel</button>
1080
1080
  </div>
1081
1081
  </div>
1082
- `}#T(e){const t=this._draft,s=this.facets;return l`
1082
+ `}#R(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">
@@ -1129,7 +1129,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1129
1129
  .tags=${s?.tags??[]}
1130
1130
  .active=${t.tags}
1131
1131
  .allowCreate=${!0}
1132
- .onToggle=${i=>this.#y(i)}
1132
+ .onToggle=${i=>this.#w(i)}
1133
1133
  ></tag-multiselect>
1134
1134
  </div>
1135
1135
  <div class="field">
@@ -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.#$(i)}
1176
+ .onToggle=${i=>this.#c(i)}
1177
1177
  ></tag-multiselect>
1178
1178
  </div>
1179
1179
  `:l`
@@ -1187,11 +1187,11 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1187
1187
  </div>
1188
1188
  `}
1189
1189
  <div class="form-actions">
1190
- <button class="save" @click=${()=>this.#l()}>Save</button>
1190
+ <button class="save" @click=${()=>this.#k()}>Save</button>
1191
1191
  <button class="cancel" @click=${()=>this.#v()}>Cancel</button>
1192
1192
  </div>
1193
1193
  </div>
1194
- `}#S(e,t){const s=t?void 0:e.key,i=t?e.name??e.id:e.source_path?e.source_path.split("/").pop():e.id;return l`
1194
+ `}#T(e,t){const s=t?void 0:e.key,i=t?e.name??e.id:e.source_path?e.source_path.split("/").pop():e.id;return l`
1195
1195
  <div class="title-row">
1196
1196
  <div>
1197
1197
  <h2>${i}</h2>
@@ -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
- `}#P(e,t){const s=e.created_at?Yi(e.created_at):null;return l`
1206
+ `}#E(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
- `}#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`
1263
+ `}#I(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}#z(){return l`
1264
1264
  <div class="share-form">
1265
1265
  <div class="share-row">
1266
1266
  <input
@@ -1268,22 +1268,22 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1268
1268
  placeholder="username"
1269
1269
  .value=${this._shareUsername}
1270
1270
  @input=${e=>this._shareUsername=e.target.value}
1271
- @keydown=${e=>e.key==="Enter"&&this.#g()}
1271
+ @keydown=${e=>e.key==="Enter"&&this.#h()}
1272
1272
  />
1273
1273
  <select .value=${this._shareRole} @change=${e=>this._shareRole=e.target.value}>
1274
1274
  <option value="member">Read-only</option>
1275
1275
  <option value="editor">Can edit</option>
1276
1276
  </select>
1277
- <button ?disabled=${this._shareBusy||!this._shareUsername.trim()} @click=${()=>this.#g()}>Share</button>
1277
+ <button ?disabled=${this._shareBusy||!this._shareUsername.trim()} @click=${()=>this.#h()}>Share</button>
1278
1278
  </div>
1279
1279
  <div class="share-links-row">
1280
- <button ?disabled=${this._shareBusy} @click=${()=>this.#h("share-link")}>Copy share link</button>
1281
- <button ?disabled=${this._shareBusy} @click=${()=>this.#h("public-link")}>Copy public link</button>
1280
+ <button ?disabled=${this._shareBusy} @click=${()=>this.#l("share-link")}>Copy share link</button>
1281
+ <button ?disabled=${this._shareBusy} @click=${()=>this.#l("public-link")}>Copy public link</button>
1282
1282
  <button @click=${()=>this.#d()}>Close</button>
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,24 +1298,24 @@ 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
- `}#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`
1301
+ `}#S(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
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
- ${d?this.#R(r,[...t,!a],s):f}
1306
- `})}#E(e){if(!e.sourceFiles?.length)return f;const t=gt(e.sourceFiles,()=>{});return l`
1305
+ ${d?this.#S(r,[...t,!a],s):f}
1306
+ `})}#O(e){if(!e.sourceFiles?.length)return f;const t=gt(e.sourceFiles,()=>{});return l`
1307
1307
  <div class="attachments-section">
1308
1308
  <h4>Skill files</h4>
1309
- <ul class="attachment-tree">${this.#R(t,[],(s,i)=>l`<span>${i}</span>`)}</ul>
1309
+ <ul class="attachment-tree">${this.#S(t,[],(s,i)=>l`<span>${i}</span>`)}</ul>
1310
1310
  </div>
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`
1311
+ `}#F(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`
1312
1312
  <div class="attachments-section">
1313
1313
  <h4>Attachments</h4>
1314
1314
  ${r?o?l`<ul class="attachment-tree">
1315
- ${this.#R(r,[],(a,c)=>this.#z(e,t,a,c))}
1315
+ ${this.#S(r,[],(a,c)=>this.#P(e,t,a,c))}
1316
1316
  </ul>`:l`
1317
1317
  <ul>
1318
- ${s.map(a=>l`<li>${this.#z(e,t,a,a.filename)}</li>`)}
1318
+ ${s.map(a=>l`<li>${this.#P(e,t,a,a.filename)}</li>`)}
1319
1319
  </ul>
1320
1320
  `:f}
1321
1321
  <label class="attachment-add">
@@ -1323,7 +1323,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1323
1323
  <input type="file" @change=${a=>this.#a(a)} />
1324
1324
  </label>
1325
1325
  </div>
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`
1326
+ `}#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`
1327
1327
  <div class="attachment-view-header">
1328
1328
  <button class="back-button" title="Back to ${e.name??e.key??e.id}" @click=${()=>this._viewingAttachment=null}>
1329
1329
  ← Back
@@ -1332,20 +1332,20 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1332
1332
  <a class="attachment-view-download" href=${a} title="Download ${s.filename}">⇩ Download</a>
1333
1333
  </div>
1334
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`
1336
- ${this.#S(e,t)}
1337
- ${i?l`<div class="bare-notice">No frontmatter — this is a plain, unmanaged file.</div>`:this.#P(e,t)}
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.#T(e,t)}${this.#A()}`:this._editing&&this._draft?l`${this.#T(e,t)}${this.#R(t)}`:this._viewingAttachment?l`${this.#T(e,t)}${this.#M(e,this.selected.table,this._viewingAttachment)}`:l`
1336
+ ${this.#T(e,t)}
1337
+ ${i?l`<div class="bare-notice">No frontmatter — this is a plain, unmanaged file.</div>`:this.#E(e,t)}
1338
1338
  ${s?f:l`
1339
1339
  <div class="actions">
1340
- ${i?l`<button class="primary" @click=${()=>this.#w()}>Add frontmatter</button>`:l`
1341
- <button @click=${()=>this.#b()}>Edit</button>
1342
- <button @click=${()=>this.#_()}>Rename</button>
1340
+ ${i?l`<button class="primary" @click=${()=>this.#y()}>Add frontmatter</button>`:l`
1341
+ <button @click=${()=>this.#$()}>Edit</button>
1342
+ <button @click=${()=>this.#m()}>Rename</button>
1343
1343
  <button @click=${()=>this.#n()}>${e.deprecated?"Un-deprecate":"Mark deprecated"}</button>
1344
1344
  <button @click=${()=>this.#r()}>${e.paused?"Resume":"Pause"}</button>
1345
- ${t?f:l`<button class="danger" @click=${()=>this.#k()}>Delete frontmatter</button>`}
1345
+ ${t?f:l`<button class="danger" @click=${()=>this.#_()}>Delete frontmatter</button>`}
1346
1346
  ${e.remoteInfo?l`<button @click=${()=>this.#o()}>Share…</button>`:f}
1347
1347
  `}
1348
- <button class="danger" @click=${()=>this.#c()}>Delete</button>
1348
+ <button class="danger" @click=${()=>this.#b()}>Delete</button>
1349
1349
  </div>
1350
1350
  ${this._renaming?l`
1351
1351
  <div class="rename-row">
@@ -1353,16 +1353,16 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1353
1353
  type="text"
1354
1354
  .value=${this._renameValue}
1355
1355
  @input=${r=>this._renameValue=r.target.value}
1356
- @keydown=${r=>r.key==="Enter"&&this.#m()}
1356
+ @keydown=${r=>r.key==="Enter"&&this.#C()}
1357
1357
  />
1358
- <button @click=${()=>this.#m()}>Save</button>
1358
+ <button @click=${()=>this.#C()}>Save</button>
1359
1359
  <button @click=${()=>this._renaming=!1}>Cancel</button>
1360
1360
  </div>
1361
1361
  `:f}
1362
- ${this._sharing?this.#I():f}
1362
+ ${this._sharing?this.#z():f}
1363
1363
  `}
1364
- ${this.#E(e)}
1365
- ${this.#O(e,this.selected.table)}
1364
+ ${this.#O(e)}
1365
+ ${this.#F(e,this.selected.table)}
1366
1366
  <div class="view-toggle">
1367
1367
  <button
1368
1368
  class=${this._viewMode==="markdown"?"active":""}
@@ -1377,9 +1377,9 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1377
1377
  Raw
1378
1378
  </button>
1379
1379
  </div>
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>`}
1380
+ ${this._viewMode==="markdown"?l`<div class="markdown-body">${Ui(v.parse(e.body??"",{async:!1,renderer:this.#I(this.selected.table,e.id)}))}</div>`:l`<pre>${e.raw_file??e.body}</pre>`}
1381
1381
  <div class="source-path" title="click to copy" @click=${()=>this.#t()}>${e.source_path}</div>
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);#P=new h(null);static{this.styles=$`
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("");#l=new h("");#b=new h(!1);#$=new h("");#y=new h(!1);#x=new h("");#v=new h(!1);#p=new h(!1);#w=new h([]);#c=new h("");#k=new h("");#_=new h(!1);#m;#C=new h("mine");#A=new h([]);#R=new h(!1);#T=new h(null);static{this.styles=w`
1383
1383
  :host { display: block; }
1384
1384
  .backdrop {
1385
1385
  position: fixed; inset: 0; background: var(--overlay);
@@ -1482,7 +1482,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1482
1482
  .ff-folder-entry.selected { background: var(--accent); color: var(--accent-fg); }
1483
1483
  .ff-empty { padding: 12px; opacity: 0.6; font-size: 13px; }
1484
1484
  .ff-widget-slot { display: flex; }
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)}#z(){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.#P.set(null),this.#l.set(""),this.#k.set(""),e==="shared"&&this.#T.value.length===0?this.#J():e==="mine"&&this.#q()}#Y(e){this.#P.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`
1485
+ `}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#S(){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.#v.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.#l.set(t),this.#x.set(F),this.#y.set(!0),this.#W(s))}async#j(){if(!this.#l.value){this.#i.set("enter a server URL first");return}this.#i.set("");try{await ae(()=>import(`${this.#l.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.#v.value||(clearInterval(this.#m),this.#W(e))}async#W(e){this.#p.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.#l.value,token:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to persist folderfoo session");return}this.#v.set(!0),this.#x.set(F),await this.#B()}finally{this.#p.set(!1)}}async#B(e,t){this.#_.set(!0),this.#i.set("");try{const s=new URLSearchParams({server:this.#l.value,tenantId:this.#x.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#J(){this.#R.set(!0),this.#i.set("");try{const e=new URLSearchParams({server:this.#l.value,tenantId:this.#x.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.#R.set(!1)}}#H(e){this.#C.set(e),this.#T.set(null),this.#c.set(""),this.#k.set(""),e==="shared"&&this.#A.value.length===0?this.#J():e==="mine"&&this.#B()}#Y(e){this.#T.set(e),this.#B(e.owner,e.path)}#K(e,t){this.#c.set(e),this.#k.set(t??""),this.#a.value||this.#a.set(e.split("/").filter(Boolean).pop()??this.#x.value)}#Q(e){this.#K(e.path,e.owner)}async#X(){if(this.#c.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.#l.value,tenantId:this.#x.value,folderPath:this.#c.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`
1486
1486
  <div class="breadcrumb-row">
1487
1487
  <div class="breadcrumb">${this.#s.value}</div>
1488
1488
  <button class="new-folder-btn" @click=${()=>this.#z()}>+ New folder</button>
@@ -1498,17 +1498,17 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1498
1498
  placeholder="Folder name"
1499
1499
  .value=${this.#h.value}
1500
1500
  @input=${t=>this.#h.set(t.target.value)}
1501
- @keydown=${t=>{t.key==="Enter"&&this.#E(),t.key==="Escape"&&this.#R()}}
1501
+ @keydown=${t=>{t.key==="Enter"&&this.#S(),t.key==="Escape"&&this.#P()}}
1502
1502
  />
1503
- <button @click=${()=>this.#E()}>Create</button>
1504
- <button @click=${()=>this.#R()}>Cancel</button>
1503
+ <button @click=${()=>this.#S()}>Create</button>
1504
+ <button @click=${()=>this.#P()}>Cancel</button>
1505
1505
  </div>
1506
1506
  `:""}
1507
1507
  <div class="browser">
1508
- ${this.#r.value?l`<div class="entry up" @click=${()=>this.#A(this.#r.value)}>
1508
+ ${this.#r.value?l`<div class="entry up" @click=${()=>this.#E(this.#r.value)}>
1509
1509
  <span class="icon">📁</span> ..
1510
1510
  </div>`:""}
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)}>
1511
+ ${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)}>
1512
1512
  <span class="icon">📁</span> ${t.name}
1513
1513
  </div>`)}
1514
1514
  </div>
@@ -1538,15 +1538,15 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1538
1538
  </button>
1539
1539
  </div>
1540
1540
  </div>
1541
- `}#M(){const e=this.#$.value;if(this.#x.value&&!this.#p.value)return l`
1541
+ `}#N(){const e=this.#w.value;if(this.#y.value&&!this.#v.value)return l`
1542
1542
  <div class="ff-body">
1543
- <div class="ff-connected-row"><span class="ff-connected-dot"></span> Already signed in to ${this.#c.value} — connecting…</div>
1543
+ <div class="ff-connected-row"><span class="ff-connected-dot"></span> Already signed in to ${this.#l.value} — connecting…</div>
1544
1544
  ${this.#i.value?l`<div class="error">${this.#i.value}</div>`:""}
1545
1545
  <div class="actions">
1546
1546
  <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
1547
1547
  </div>
1548
1548
  </div>
1549
- `;if(!this.#p.value)return l`
1549
+ `;if(!this.#v.value)return l`
1550
1550
  <div class="ff-body">
1551
1551
  <div class="ff-hint">
1552
1552
  Sign in to a folderfoo server to mount one of your folders (or a folder shared with you) as a
@@ -1557,41 +1557,41 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1557
1557
  <label>Server URL</label>
1558
1558
  <input
1559
1559
  type="text"
1560
- .value=${this.#c.value}
1560
+ .value=${this.#l.value}
1561
1561
  placeholder="https://folderfoo.example.com"
1562
1562
  ?disabled=${this.#b.value}
1563
- @input=${i=>this.#c.set(i.target.value)}
1564
- @keydown=${i=>i.key==="Enter"&&this.#U()}
1563
+ @input=${i=>this.#l.set(i.target.value)}
1564
+ @keydown=${i=>i.key==="Enter"&&this.#j()}
1565
1565
  />
1566
1566
  </div>
1567
1567
  ${this.#b.value?l`
1568
1568
  <div class="ff-hint">Sign in below (this is folderfoo's own login widget, same one every folderfoo app uses):</div>
1569
1569
  <div class="ff-widget-slot"></div>
1570
- ${this.#y.value?l`<div class="ff-hint">Finishing connection…</div>`:""}
1570
+ ${this.#p.value?l`<div class="ff-hint">Finishing connection…</div>`:""}
1571
1571
  `:l`
1572
1572
  <div class="actions" style="justify-content: flex-start; margin-top: 0;">
1573
- <button class="secondary" @click=${()=>this.#U()}>Continue</button>
1573
+ <button class="secondary" @click=${()=>this.#j()}>Continue</button>
1574
1574
  </div>
1575
1575
  `}
1576
- ${this.#w.value?l`<div class="error">${this.#w.value}</div>`:""}
1576
+ ${this.#$.value?l`<div class="error">${this.#$.value}</div>`:""}
1577
1577
  ${this.#i.value?l`<div class="error">${this.#i.value}</div>`:""}
1578
1578
  <div class="actions">
1579
1579
  <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
1580
1580
  </div>
1581
1581
  </div>
1582
- `;const t=this.#T.value,s=this.#P.value;return l`
1582
+ `;const t=this.#A.value,s=this.#T.value;return l`
1583
1583
  <div class="ff-body">
1584
- <div class="ff-connected-row"><span class="ff-connected-dot"></span> Connected to ${this.#c.value}</div>
1584
+ <div class="ff-connected-row"><span class="ff-connected-dot"></span> Connected to ${this.#l.value}</div>
1585
1585
  <div class="kind-toggle">
1586
1586
  <button
1587
1587
  class=${this.#C.value==="mine"?"active":""}
1588
- @click=${()=>this.#B("mine")}
1588
+ @click=${()=>this.#H("mine")}
1589
1589
  >
1590
1590
  My folders
1591
1591
  </button>
1592
1592
  <button
1593
1593
  class=${this.#C.value==="shared"?"active":""}
1594
- @click=${()=>this.#B("shared")}
1594
+ @click=${()=>this.#H("shared")}
1595
1595
  >
1596
1596
  Shared with me
1597
1597
  </button>
@@ -1600,8 +1600,8 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1600
1600
  ${e.length>0?l`
1601
1601
  <div class="ff-folder-list">
1602
1602
  ${e.map(i=>l`<div
1603
- class="ff-folder-entry ${this.#l.value===i.path&&!this.#k.value?"selected":""}"
1604
- @click=${()=>this.#H(i.path)}
1603
+ class="ff-folder-entry ${this.#c.value===i.path&&!this.#k.value?"selected":""}"
1604
+ @click=${()=>this.#K(i.path)}
1605
1605
  >
1606
1606
  ${i.path}
1607
1607
  </div>`)}
@@ -1610,10 +1610,10 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1610
1610
  `:s?l`
1611
1611
  <div class="breadcrumb-row">
1612
1612
  <div class="breadcrumb">${s.owner}:${s.path}</div>
1613
- <button class="new-folder-btn" @click=${()=>this.#B("shared")}>← Back</button>
1613
+ <button class="new-folder-btn" @click=${()=>this.#H("shared")}>← Back</button>
1614
1614
  </div>
1615
1615
  <div
1616
- class="ff-folder-entry ${this.#l.value===s.path&&this.#k.value===s.owner?"selected":""}"
1616
+ class="ff-folder-entry ${this.#c.value===s.path&&this.#k.value===s.owner?"selected":""}"
1617
1617
  @click=${()=>this.#Q(s)}
1618
1618
  >
1619
1619
  (connect this folder itself)
@@ -1621,8 +1621,8 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1621
1621
  ${e.length>0?l`
1622
1622
  <div class="ff-folder-list">
1623
1623
  ${e.map(i=>l`<div
1624
- class="ff-folder-entry ${this.#l.value===i.path&&this.#k.value===s.owner?"selected":""}"
1625
- @click=${()=>this.#H(i.path,s.owner)}
1624
+ class="ff-folder-entry ${this.#c.value===i.path&&this.#k.value===s.owner?"selected":""}"
1625
+ @click=${()=>this.#K(i.path,s.owner)}
1626
1626
  >
1627
1627
  ${i.path}
1628
1628
  </div>`)}
@@ -1635,10 +1635,10 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1635
1635
  ${i.path} <span style="opacity:0.6">— shared by ${i.owner}${i.role==="member"?" (read-only)":""}</span>
1636
1636
  </div>`)}
1637
1637
  </div>
1638
- `:this.#S.value?l`<div class="ff-hint">Loading shared folders…</div>`:l`<div class="ff-empty">No one has shared a folder with you yet.</div>`}
1638
+ `:this.#R.value?l`<div class="ff-hint">Loading shared folders…</div>`:l`<div class="ff-empty">No one has shared a folder with you yet.</div>`}
1639
1639
  `}
1640
- ${this.#l.value?l`<div class="selected-row">
1641
- Selected: <span class="path">${this.#k.value?`${this.#k.value}:`:""}${this.#l.value}</span>
1640
+ ${this.#c.value?l`<div class="selected-row">
1641
+ Selected: <span class="path">${this.#k.value?`${this.#k.value}:`:""}${this.#c.value}</span>
1642
1642
  </div>`:""}
1643
1643
  <div>
1644
1644
  <label>Folder name</label>
@@ -1654,7 +1654,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1654
1654
  <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
1655
1655
  <button
1656
1656
  class="primary"
1657
- ?disabled=${!this.#l.value||this.#o.value}
1657
+ ?disabled=${!this.#c.value||this.#o.value}
1658
1658
  @click=${()=>this.#X()}
1659
1659
  >
1660
1660
  ${this.#o.value?"Connecting…":"Connect folder"}
@@ -1687,15 +1687,15 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1687
1687
  </button>
1688
1688
  <button
1689
1689
  class=${this.#t.value==="folderfoo"?"active":""}
1690
- @click=${()=>{this.#t.set("folderfoo"),this.#G()}}
1690
+ @click=${()=>{this.#t.set("folderfoo"),this.#M()}}
1691
1691
  >
1692
1692
  Connect folderfoo
1693
1693
  </button>
1694
1694
  </div>
1695
- ${this.#t.value==="local"?this.#ee():this.#M()}
1695
+ ${this.#t.value==="local"?this.#ee():this.#N()}
1696
1696
  </div>
1697
1697
  </div>
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=$`
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=w`
1699
1699
  :host { display: flex; flex: 1 1 auto; min-height: 0; }
1700
1700
  .nav {
1701
1701
  flex: 0 0 260px;
@@ -1779,7 +1779,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1779
1779
  ${this.#e()}
1780
1780
  </div>
1781
1781
  ${this.#t()}
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=$`
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,$t=40,wt=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,$t));#a=new h(St(yt,40,wt,_t));#i=new h(null);#o=e=>this.#b(e);#d=()=>this.#$();static{this.styles=w`
1783
1783
  :host { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
1784
1784
  .mode-row {
1785
1785
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px;
@@ -1855,23 +1855,23 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1855
1855
  border: none; background: none; color: inherit; width: 100%; text-align: left; box-sizing: border-box;
1856
1856
  }
1857
1857
  .folder-card:hover { background: var(--hover); }
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`
1859
- <button class="node ${e.folder.remote?"remote":""} ${r?"active":""}" @click=${()=>this.#x(t)}>
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)}#l(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($t,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(wt,a)))}}#$(){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))}#y(e){const t=new Set(this.#t.value);t.has(e)?t.delete(e):t.add(e),this.#t.set(t),Ct(t)}#x(e,t){this.#n.set({folder:e,tag:t})}#v(e){this.#n.set(null),this.#r.set({table:e._table,id:e.id})}#p(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`
1859
+ <button class="node ${e.folder.remote?"remote":""} ${r?"active":""}" @click=${()=>this.#y(t)}>
1860
1860
  <span class="caret">${s?"▾":"▸"}</span>
1861
1861
  <span class="icon">${e.folder.remote?"☁":"📁"}</span>
1862
1862
  <span
1863
1863
  class="label"
1864
- @click=${o=>{o.stopPropagation(),this.#v(e.folder.name,null)}}
1864
+ @click=${o=>{o.stopPropagation(),this.#x(e.folder.name,null)}}
1865
1865
  >${e.folder.name}</span
1866
1866
  >
1867
1867
  <span class="count">${i}</span>
1868
1868
  </button>
1869
- `}#l(e){const t=(s,i)=>s.length===0?"":l`
1869
+ `}#c(e){const t=(s,i)=>s.length===0?"":l`
1870
1870
  <div class="section-header">${i}</div>
1871
1871
  ${s.map(r=>{const o=`folder:${r.folder.name}`,a=this.#t.value.has(o),c=r.tagGroups[0]?.items??[];return l`
1872
- ${this.#$(r,o)}
1872
+ ${this.#w(r,o)}
1873
1873
  ${a?c.map(d=>l`
1874
- <button class="node indent-1" @click=${()=>this.#p(d)}>
1874
+ <button class="node indent-1" @click=${()=>this.#v(d)}>
1875
1875
  <span class="caret"></span>
1876
1876
  <span class="icon">${d._table==="skills"?"⚡":"📝"}</span>
1877
1877
  <span class="label">${d.name}</span>
@@ -1894,25 +1894,25 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1894
1894
  <span>${s}</span>
1895
1895
  </div>
1896
1896
  ${r.length===0?l`<div class="empty">No entries in this folder.</div>`:r.map(o=>l`
1897
- <button class="node" @click=${()=>this.#p(o)}>
1897
+ <button class="node" @click=${()=>this.#v(o)}>
1898
1898
  <span class="caret"></span>
1899
1899
  <span class="icon">${o._table==="skills"?"⚡":"📝"}</span>
1900
1900
  <span class="label">${o.name}</span>
1901
1901
  </button>
1902
1902
  `)}
1903
1903
  `}#_(e){return e.length===0?l`<div class="empty">No entries.</div>`:e.map(t=>{const s=`tag:${t.tag??""}`,i=this.#t.value.has(s),r=this.#n.value?.folder===null&&this.#n.value?.tag===t.tag;return l`
1904
- <button class="node ${r?"active":""}" @click=${()=>this.#x(s)}>
1904
+ <button class="node ${r?"active":""}" @click=${()=>this.#y(s)}>
1905
1905
  <span class="caret">${i?"▾":"▸"}</span>
1906
1906
  <span class="icon">${t.tag===null?"":"🏷"}</span>
1907
1907
  <span
1908
1908
  class="label"
1909
- @click=${o=>{o.stopPropagation(),this.#v(null,t.tag)}}
1909
+ @click=${o=>{o.stopPropagation(),this.#x(null,t.tag)}}
1910
1910
  >${t.tag??"(untagged)"}</span
1911
1911
  >
1912
1912
  <span class="count">${t.items.length}</span>
1913
1913
  </button>
1914
1914
  ${i?t.items.map(o=>l`
1915
- <button class="node indent-1" @click=${()=>this.#p(o)}>
1915
+ <button class="node indent-1" @click=${()=>this.#v(o)}>
1916
1916
  <span class="caret"></span>
1917
1917
  <span class="icon">${o._table==="skills"?"⚡":"📝"}</span>
1918
1918
  <span class="label">${o.name}</span>
@@ -1942,30 +1942,30 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1942
1942
  class="tree-rail"
1943
1943
  style=${`width: ${this.#u.value}%; border-right: 1px solid var(--border);`}
1944
1944
  >
1945
- ${e==="a"?this.#l(i):e==="b"?this.#k(i):this.#_(r)}
1945
+ ${e==="a"?this.#c(i):e==="b"?this.#k(i):this.#_(r)}
1946
1946
  </div>
1947
1947
  ${o?l`
1948
1948
  <div
1949
1949
  class="splitter ${this.#i.value==="tree"?"dragging":""}"
1950
- @pointerdown=${c=>this.#c("tree",c)}
1950
+ @pointerdown=${c=>this.#l("tree",c)}
1951
1951
  ></div>
1952
1952
  <result-list
1953
1953
  style=${`width: ${this.#a.value}%; border-right: 1px solid var(--border);`}
1954
1954
  .results=${this.#m()}
1955
1955
  .showFolder=${!0}
1956
- .onSelect=${c=>this.#y(c)}
1956
+ .onSelect=${c=>this.#p(c)}
1957
1957
  .selectedIds=${new Set}
1958
1958
  .onToggleSelect=${()=>{}}
1959
1959
  .onKeyClick=${this.onKeyClick}
1960
1960
  ></result-list>
1961
1961
  <div
1962
1962
  class="splitter ${this.#i.value==="list"?"dragging":""}"
1963
- @pointerdown=${c=>this.#c("list",c)}
1963
+ @pointerdown=${c=>this.#l("list",c)}
1964
1964
  ></div>
1965
1965
  `:l`
1966
1966
  <div
1967
1967
  class="splitter ${this.#i.value==="tree"?"dragging":""}"
1968
- @pointerdown=${c=>this.#c("tree",c)}
1968
+ @pointerdown=${c=>this.#l("tree",c)}
1969
1969
  ></div>
1970
1970
  `}
1971
1971
  ${a?l`
@@ -1980,7 +1980,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1980
1980
  ></detail-panel>
1981
1981
  `:l`<div class="no-selection">Select an item to view it.</div>`}
1982
1982
  </div>
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},onCopyBridgeConfig:{attribute:!1}}}static{this.styles=$`
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},onCopyBridgeConfig:{attribute:!1}}}static{this.styles=w`
1984
1984
  :host {
1985
1985
  display: flex;
1986
1986
  align-items: center;
@@ -2100,7 +2100,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2100
2100
  ${hr[this.theme]}
2101
2101
  </button>
2102
2102
  <div class="folderfoo-slot"></div>
2103
- `}}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=$`
2103
+ `}}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=w`
2104
2104
  :host { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
2105
2105
  .header {
2106
2106
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
@@ -2117,6 +2117,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2117
2117
  .refresh-btn.spinning { animation: shared-refresh-spin 0.8s linear infinite; }
2118
2118
  @keyframes shared-refresh-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
2119
2119
  .summary { font-size: 12px; opacity: 0.6; }
2120
+ .summary.error { opacity: 1; color: var(--danger, #c0392b); cursor: help; }
2120
2121
  .body { flex: 1 1 auto; overflow-y: auto; }
2121
2122
  .owner-group { border-bottom: 1px solid var(--border); }
2122
2123
  .owner-header { padding: 8px 16px 4px; font-size: 12px; font-weight: 600; opacity: 0.7; }
@@ -2157,6 +2158,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2157
2158
  <span class="icon">${e.kind==="skill"?"⚡":"📝"}</span>
2158
2159
  <span class="name">${e.remote_path}</span>
2159
2160
  ${t?l`<span class="revoked-badge">no longer shared with you</span>`:l`<span class="role-badge">${e.role}</span>`}
2161
+ ${!t&&e.paused?l`<span class="role-badge" title="Arrived as a direct share — hidden from agents until you open it and unpause it">paused</span>`:""}
2160
2162
  ${t?"":l`<button class="fork-btn" @click=${r=>{r.stopPropagation(),this.#s(e)}}>Fork to mine</button>`}
2161
2163
  ${t?l`<button class="dismiss-btn" title="Dismiss" @click=${r=>{r.stopPropagation(),this.onDismiss(e.origin_id)}}>✕</button>`:""}
2162
2164
  </div>
@@ -2174,6 +2176,8 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2174
2176
  <div class="header">
2175
2177
  <h2>Shared with me</h2>
2176
2178
  ${s?l`<span class="summary">${s.added} added · ${s.updated} updated · ${s.revoked} revoked · ${s.unchanged} unchanged</span>`:""}
2179
+ ${s?.errors?.length?l`<span class="summary error" title=${s.errors.join(`
2180
+ `)}>${s.errors.length} failed</span>`:""}
2177
2181
  <button
2178
2182
  class="refresh-btn ${this.refreshing?"spinning":""}"
2179
2183
  title="Refresh — check for updates or revoked shares"
@@ -2192,7 +2196,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2192
2196
  </div>
2193
2197
  `)}
2194
2198
  </div>
2195
- `}}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=$`
2199
+ `}}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=w`
2196
2200
  :host { display: block; height: 100%; box-sizing: border-box; }
2197
2201
  .card {
2198
2202
  display: flex;
@@ -2374,7 +2378,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2374
2378
  </div>
2375
2379
  `:f}
2376
2380
  </div>
2377
- `}}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=$`
2381
+ `}}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("");#l=e=>this.#p(e);#b=e=>this.#w(e);static{this.styles=w`
2378
2382
  :host { display: block; }
2379
2383
  .backdrop {
2380
2384
  position: fixed; inset: 0; background: var(--overlay);
@@ -2448,15 +2452,15 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2448
2452
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
2449
2453
  padding: 8px 16px; border-top: 1px solid var(--border); font-size: 11px; opacity: 0.6;
2450
2454
  }
2451
- `}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.#P()}#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.#P()}#P(){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)}#z(){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.#z()):(e.metaKey||e.ctrlKey)&&e.key==="Enter"&&this.#R()}render(){const e=this.#x();return l`
2455
+ `}constructor(){super(),new N(this)}willUpdate(e){e.has("memoryFolders")&&this.#C()}connectedCallback(){super.connectedCallback(),this.#$(),this.#C(),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)}}#y(){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))}#x(e){const t=this.#y()[this.#n.value];this.#s.set(e.target.value);const s=this.#y(),i=t?s.findIndex(r=>r.id===t.id):-1;this.#n.set(i!==-1?i:s.length>0?0:-1)}#v(){const e=this.renderRoot.querySelector(".grid");if(!e)return 1;const t=getComputedStyle(e).gridTemplateColumns;return Math.max(1,t.split(" ").filter(Boolean).length)}#p(e){if((e.metaKey||e.ctrlKey)&&e.key==="Enter"&&!this.#r.value){e.preventDefault(),this.#A();return}const t=this.#y(),s=this.#v(),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.#c(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#c(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))}#A(){this.#a.set(null),this.#i.set(""),this.#o.set(""),this.#C(),this.#r.set(!0),this.#T()}#R(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.#T()}#T(){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(At,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)}}#S(e){e.key==="Escape"?(e.stopPropagation(),this.#z()):(e.metaKey||e.ctrlKey)&&e.key==="Enter"&&this.#P()}render(){const e=this.#y();return l`
2452
2456
  <div class="backdrop" @click=${t=>t.target===t.currentTarget&&this.onClose()}>
2453
- <div class="modal" @keydown=${this.#c}>
2457
+ <div class="modal" @keydown=${this.#l}>
2454
2458
  <div class="search-row">
2455
2459
  <input
2456
2460
  type="search"
2457
2461
  placeholder="Search quick prompts…"
2458
2462
  .value=${this.#s.value}
2459
- @input=${t=>this.#v(t)}
2463
+ @input=${t=>this.#x(t)}
2460
2464
  />
2461
2465
  ${(this.memoryFolders?.length??0)>1?l`
2462
2466
  <select
@@ -2473,7 +2477,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2473
2477
  ${this.#g.value?l`<div class="error">${this.#g.value}</div>`:""}
2474
2478
  <div class="body">
2475
2479
  ${this.#r.value?l`
2476
- <div class="add-form" @keydown=${this.#E}>
2480
+ <div class="add-form" @keydown=${this.#S}>
2477
2481
  <input
2478
2482
  type="text"
2479
2483
  placeholder="Title (optional)"
@@ -2487,19 +2491,19 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2487
2491
  ></textarea>
2488
2492
  <div class="add-form-actions">
2489
2493
  <button class="secondary" @click=${()=>this.#z()}>Cancel</button>
2490
- <button class="primary" ?disabled=${!this.#o.value.trim()} @click=${()=>this.#R()}>
2494
+ <button class="primary" ?disabled=${!this.#o.value.trim()} @click=${()=>this.#P()}>
2491
2495
  ${this.#a.value?"Save changes":"Add prompt"}
2492
2496
  </button>
2493
2497
  </div>
2494
2498
  </div>
2495
2499
  `:this.#t.value?l`<div class="empty">Loading…</div>`:e.length===0&&!this.#s.value?l`
2496
2500
  <div class="grid">
2497
- <button class="add-tile" title="Add a quick prompt" @click=${()=>this.#T()}>+</button>
2501
+ <button class="add-tile" title="Add a quick prompt" @click=${()=>this.#A()}>+</button>
2498
2502
  </div>
2499
2503
  <div class="empty">No quick prompts yet — add one to get started.</div>
2500
2504
  `:l`
2501
2505
  <div class="grid">
2502
- <button class="add-tile" title="Add a quick prompt" @click=${()=>this.#T()}>+</button>
2506
+ <button class="add-tile" title="Add a quick prompt" @click=${()=>this.#A()}>+</button>
2503
2507
  ${e.map((t,s)=>l`
2504
2508
  <entity-card
2505
2509
  .entityTitle=${t.title}
@@ -2509,12 +2513,12 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2509
2513
  .pinned=${t.pinned}
2510
2514
  .selected=${s===this.#n.value}
2511
2515
  .onPin=${()=>this.#k(t)}
2512
- .onCopy=${()=>this.#l(t)}
2516
+ .onCopy=${()=>this.#c(t)}
2513
2517
  copyIcon="📋"
2514
- .onEdit=${()=>this.#S(t)}
2518
+ .onEdit=${()=>this.#R(t)}
2515
2519
  .onDelete=${()=>this.#_(t)}
2516
- .onClick=${()=>this.#l(t)}
2517
- .onActivate=${()=>this.#l(t)}
2520
+ .onClick=${()=>this.#c(t)}
2521
+ .onActivate=${()=>this.#c(t)}
2518
2522
  ></entity-card>
2519
2523
  `)}
2520
2524
  </div>
@@ -2526,7 +2530,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2526
2530
  </div>
2527
2531
  </div>
2528
2532
  </div>
2529
- `}}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 Pt=!1;const kr=[{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:[]},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=$`
2533
+ `}}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,publicToken:c})}}catch(o){console.error("[memory-bucket] failed to load folderfoo share-accept widgets:",o)}}}let Pt=!1;const kr=[{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"}],$r={tags:[],statuses:[],owners:[],doc_types:[],key_types:[],folders:[]},wr={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=w`
2530
2534
  :host { display: flex; flex-direction: column; height: 100vh; position: relative; }
2531
2535
  /* Mounted inside whichever header row #renderBody() renders for the current mode (.folders-bar,
2532
2536
  .toolbar-bar, or folder-view's own .mode-row, via a <slot>) so it's a normal flex child of
@@ -2728,7 +2732,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2728
2732
  cursor: pointer;
2729
2733
  }
2730
2734
  .bulk-bar button.danger { border-color: var(--danger); color: var(--danger); }
2731
- `}#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);#P=new h(null);#A=new h(!1);#I=new h([]);#z=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(Pt){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()=>{Pt=!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.#z.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.#z.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.#P.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()}#Pe(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()}#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`
2735
+ `}#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($r);#i=new h(null);#o=new h(wr);#d=new h(!1);#g=new h("");#h=new h(!1);#l=new h(_r());#b=new h("");#$=new h(!1);#y=new h(this.#e.sort??"");#x=new h(this.#e.deprecatedFilter??"all");#v=new h(this.#e.pausedFilter??"all");#p=new h(this.#e.dateFrom??"");#w=new h(this.#e.dateTo??"");#c=new h(new Set);#k=new h(Sr());#_=new h(!1);#m=new h("entries");#C=new h([]);#A=new h([]);#R=new h(null);#T=new h(null);#E=new h(!1);#I=new h([]);#z=new h(!1);#P=new h(null);#S=new h(!1);#O=new h(!1);#F=0;#M=e=>this.#K(e);#j=()=>this.#Q();#q=e=>this.#H(e);constructor(){super(),new N(this),It(this.#k.value)}#W(e){this.#k.set(e),localStorage.setItem(ns,e),It(e)}#B(){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)}}}#H(e){if((e.metaKey||e.ctrlKey)&&e.key==="Enter"&&!this.#S.value){e.preventDefault(),this.#O.set(!0),this.#S.set(!0);return}if(e.key!=="Shift"){this.#F=0;return}const t=Date.now();t-this.#F<450?(this.#F=0,this.#S.set(!this.#S.value)):this.#F=t}#Y(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.#l.set(Math.min(rs,Math.max(is,i)))}#Q(){this.#$.set(!1),document.removeEventListener("pointermove",this.#M),document.removeEventListener("pointerup",this.#j),localStorage.setItem(ss,String(this.#l.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.#y.value&&e.set("sort",this.#y.value),this.#x.value==="hide"?e.set("deprecated","0"):this.#x.value==="only"&&e.set("deprecated","1"),this.#v.value==="hide"?e.set("paused","0"):this.#v.value==="only"&&e.set("paused","1"),this.#p.value&&e.set("date_from",this.#p.value),this.#w.value&&e.set("date_to",this.#w.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.#x.value==="hide"?e.set("deprecated","0"):this.#x.value==="only"&&e.set("deprecated","1"),this.#v.value==="hide"?e.set("paused","0"):this.#v.value==="only"&&e.set("paused","1"),this.#p.value&&e.set("date_from",this.#p.value),this.#w.value&&e.set("date_to",this.#w.value),e.toString()});#N=()=>this.#he();#re=e=>this.#$e(e);#ne=e=>this.#we(e);#oe=()=>this.#de();#ae;connectedCallback(){super.connectedCallback(),this.#f(),this.#L(),this.#D().then(()=>this.#he()),window.addEventListener("focus",this.#N),document.addEventListener("visibilitychange",this.#N),window.addEventListener("keydown",this.#q),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.#U("entries")})}async#$e(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#we(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(Pt){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()=>{Pt=!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.#N),document.removeEventListener("visibilitychange",this.#N),window.removeEventListener("keydown",this.#q),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)}}#U(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.#z.set(!0);try{const e=await fetch("/api/shared-items/refresh",{method:"POST"});e.ok&&this.#P.set(await e.json()),await this.#Z()}finally{this.#z.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.#U("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.#U("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.#A.set(await e.json()),this.#R.value&&this.#ge(this.#R.value)}async#ge(e){this.#R.set(e),this.#E.set(!0);try{const t=await fetch(`/api/channels/${encodeURIComponent(e)}`);this.#T.set(t.ok?await t.json():null)}finally{this.#E.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()}#Pe(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()}#Ie(e){this.#r.value.includes(e)||this.#r.set([...this.#r.value,e]),this.#f()}#ve(e){this.#p.set(e),this.#w.set(e),this.#f()}#Le(e){this.#t.set(e.target.value),this.#f()}#V(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.#y.set(e.target.value),this.#f()}#Me(e){this.#x.set(e.target.value),this.#f()}#Ne(e){this.#v.set(e.target.value),this.#f()}#Ue(e){this.#p.set(e.target.value),this.#f()}#je(e){this.#w.set(e.target.value),this.#f()}#qe(){this.#p.set(""),this.#w.set(""),this.#f()}#Be(e){const t=new Set(this.#c.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#c.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.#c.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.#c.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.#c.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.#c.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.#c.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.#c.value.size} doc(s)? This can't be undone.`))return;const e=this.#ie(),t=this.#c.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.#c.set(new Set),await this.#f(),s.every(i=>i.ok)?y.success(`${t} item${t===1?"":"s"} deleted`):y.danger("Bulk delete failed")}#G(){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`
2732
2736
  <app-toolbar
2733
2737
  .showReindex=${e}
2734
2738
  .reindexing=${this.#_.value}
@@ -2738,28 +2742,28 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2738
2742
  .sharedActive=${this.#m.value==="shared"}
2739
2743
  .theme=${this.#k.value}
2740
2744
  .onReindex=${()=>this.#J()}
2741
- .onToggleChannels=${()=>this.#N(this.#m.value==="channels"?"entries":"channels")}
2742
- .onToggleFolderView=${()=>this.#N(this.#m.value==="folder-view"?"entries":"folder-view")}
2743
- .onToggleShared=${()=>this.#N(this.#m.value==="shared"?"entries":"shared")}
2744
- .onCycleTheme=${()=>this.#q()}
2745
+ .onToggleChannels=${()=>this.#U(this.#m.value==="channels"?"entries":"channels")}
2746
+ .onToggleFolderView=${()=>this.#U(this.#m.value==="folder-view"?"entries":"folder-view")}
2747
+ .onToggleShared=${()=>this.#U(this.#m.value==="shared"?"entries":"shared")}
2748
+ .onCycleTheme=${()=>this.#B()}
2745
2749
  .onCopyBridgeConfig=${()=>this.#Ke()}
2746
2750
  ></app-toolbar>
2747
2751
  `}async#Ke(){const e={slug:"memory-bucket",transport:"streamableHttp",url:`${window.location.origin}/mcp`};try{await navigator.clipboard.writeText(JSON.stringify(e,null,2)),y.success("MCP config copied — paste into js-bridge-mcp admin UI")}catch{y.danger("Could not copy to clipboard")}}updated(){this.#_e()}render(){return l`
2748
2752
  ${this.#Ve()}
2749
- ${this.#E.value?l`<quick-prompts-modal
2750
- .onClose=${()=>{this.#E.set(!1),this.#O.set(!1)}}
2753
+ ${this.#S.value?l`<quick-prompts-modal
2754
+ .onClose=${()=>{this.#S.set(!1),this.#O.set(!1)}}
2751
2755
  .memoryFolders=${this.#o.value.memory}
2752
2756
  .openToAdd=${this.#O.value}
2753
2757
  ></quick-prompts-modal>`:""}
2754
2758
  <toast-stack></toast-stack>
2755
2759
  `}#Ve(){const e=this.#a.value,t=this.#se();return this.#m.value==="shared"?l`
2756
2760
  <div class="toolbar-bar">
2757
- <div class="header-toolbar">${this.#V()}</div>
2761
+ <div class="header-toolbar">${this.#G()}</div>
2758
2762
  </div>
2759
2763
  <shared-with-me-panel
2760
2764
  .items=${this.#I.value}
2761
2765
  .refreshing=${this.#z.value}
2762
- .lastRefreshSummary=${this.#R.value}
2766
+ .lastRefreshSummary=${this.#P.value}
2763
2767
  .memoryFolderNames=${this.#o.value.memory.map(s=>s.name)}
2764
2768
  .skillFolderNames=${this.#o.value.skill.map(s=>s.name)}
2765
2769
  .onRefresh=${()=>this.#ue()}
@@ -2769,13 +2773,13 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2769
2773
  ></shared-with-me-panel>
2770
2774
  `:this.#m.value==="channels"?l`
2771
2775
  <div class="toolbar-bar">
2772
- <div class="header-toolbar">${this.#V()}</div>
2776
+ <div class="header-toolbar">${this.#G()}</div>
2773
2777
  </div>
2774
2778
  <channel-view
2775
- .channels=${this.#T.value}
2776
- .selected=${this.#S.value}
2777
- .detail=${this.#P.value}
2778
- .loading=${this.#A.value}
2779
+ .channels=${this.#A.value}
2780
+ .selected=${this.#R.value}
2781
+ .detail=${this.#T.value}
2782
+ .loading=${this.#E.value}
2779
2783
  .onSelect=${s=>this.#ge(s)}
2780
2784
  .onRefresh=${()=>this.#fe()}
2781
2785
  ></channel-view>
@@ -2788,13 +2792,13 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2788
2792
  .onTypeChange=${s=>this.#me(s)}
2789
2793
  .onChanged=${()=>{this.#f(),this.#L()}}
2790
2794
  .onDateClick=${s=>this.#ve(s)}
2791
- .onKeyClick=${s=>this.#K(s)}
2795
+ .onKeyClick=${s=>this.#V(s)}
2792
2796
  >
2793
- <div class="header-toolbar" slot="mode-row-end">${this.#V()}</div>
2797
+ <div class="header-toolbar" slot="mode-row-end">${this.#G()}</div>
2794
2798
  </folder-view>
2795
2799
  `:this.#h.value&&t.length===0&&!this.#d.value?l`
2796
2800
  <div class="toolbar-bar">
2797
- <div class="header-toolbar">${this.#V()}</div>
2801
+ <div class="header-toolbar">${this.#G()}</div>
2798
2802
  </div>
2799
2803
  <div class="first-run">
2800
2804
  <h1>No folders configured yet</h1>
@@ -2832,7 +2836,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2832
2836
  `)}
2833
2837
  <button class="add-folder-btn" @click=${()=>this.#d.set(!0)}>+ Add folder</button>
2834
2838
  </div>
2835
- <div class="header-toolbar">${this.#V()}</div>
2839
+ <div class="header-toolbar">${this.#G()}</div>
2836
2840
  </div>
2837
2841
  ${this.#b.value?l`
2838
2842
  <div class="folderfoo-open-banner">
@@ -2883,17 +2887,17 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2883
2887
  <input
2884
2888
  type="date"
2885
2889
  aria-label="From date"
2886
- .value=${this.#y.value}
2890
+ .value=${this.#p.value}
2887
2891
  @change=${s=>this.#Ue(s)}
2888
2892
  />
2889
2893
  <span class="date-range-sep">–</span>
2890
2894
  <input
2891
2895
  type="date"
2892
2896
  aria-label="To date"
2893
- .value=${this.#$.value}
2897
+ .value=${this.#w.value}
2894
2898
  @change=${s=>this.#je(s)}
2895
2899
  />
2896
- ${this.#y.value||this.#$.value?l`
2900
+ ${this.#p.value||this.#w.value?l`
2897
2901
  <button
2898
2902
  class="date-range-clear"
2899
2903
  title="Clear date range"
@@ -2906,7 +2910,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2906
2910
  </div>
2907
2911
  <span class="filter-label">Sort:</span>
2908
2912
  <select
2909
- .value=${this.#x.value||(this.#t.value.trim()?"relevance":"mtime_desc")}
2913
+ .value=${this.#y.value||(this.#t.value.trim()?"relevance":"mtime_desc")}
2910
2914
  @change=${s=>this.#De(s)}
2911
2915
  >
2912
2916
  ${this.#t.value.trim()?l`<option value="relevance">Relevance</option>`:""}
@@ -2916,39 +2920,39 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2916
2920
  <option value="name_asc">Name</option>
2917
2921
  </select>
2918
2922
  <span class="filter-label">Deprecated:</span>
2919
- <select .value=${this.#v.value} @change=${s=>this.#Me(s)}>
2923
+ <select .value=${this.#x.value} @change=${s=>this.#Me(s)}>
2920
2924
  ${zt.map(s=>l`<option value=${s.value}>${s.label}</option>`)}
2921
2925
  </select>
2922
2926
  <span class="filter-label">Paused:</span>
2923
- <select .value=${this.#p.value} @change=${s=>this.#Ne(s)}>
2927
+ <select .value=${this.#v.value} @change=${s=>this.#Ne(s)}>
2924
2928
  ${zt.map(s=>l`<option value=${s.value}>${s.label}</option>`)}
2925
2929
  </select>
2926
2930
  </div>
2927
2931
  </div>
2928
- ${this.#l.value.size>0?l`
2932
+ ${this.#c.value.size>0?l`
2929
2933
  <div class="bulk-bar">
2930
- <span>${this.#l.value.size} selected</span>
2934
+ <span>${this.#c.value.size} selected</span>
2931
2935
  <button @click=${()=>this.#ye(!0)}>Mark deprecated</button>
2932
2936
  <button @click=${()=>this.#ye(!1)}>Un-deprecate</button>
2933
2937
  <button @click=${()=>this.#ke(!0)}>Pause</button>
2934
2938
  <button @click=${()=>this.#ke(!1)}>Resume</button>
2935
2939
  <button class="danger" @click=${()=>this.#He()}>Delete</button>
2936
- <button @click=${()=>this.#l.set(new Set)}>Clear</button>
2940
+ <button @click=${()=>this.#c.set(new Set)}>Clear</button>
2937
2941
  </div>
2938
2942
  `:""}
2939
2943
  <div class="body-region">
2940
2944
  <result-list
2941
- style=${`width: ${this.#c.value}%; border-right: 1px solid var(--border);`}
2945
+ style=${`width: ${this.#l.value}%; border-right: 1px solid var(--border);`}
2942
2946
  .results=${this.#u.value}
2943
2947
  .showFolder=${t.length>1}
2944
2948
  .onSelect=${s=>this.#Oe(s)}
2945
- .selectedIds=${this.#l.value}
2949
+ .selectedIds=${this.#c.value}
2946
2950
  .onToggleSelect=${s=>this.#Be(s)}
2947
- .onKeyClick=${s=>this.#K(s)}
2948
- .onGroupClick=${s=>this.#K(s)}
2951
+ .onKeyClick=${s=>this.#V(s)}
2952
+ .onGroupClick=${s=>this.#V(s)}
2949
2953
  ></result-list>
2950
2954
  <div
2951
- class="splitter ${this.#w.value?"dragging":""}"
2955
+ class="splitter ${this.#$.value?"dragging":""}"
2952
2956
  @pointerdown=${s=>this.#Y(s)}
2953
2957
  ></div>
2954
2958
  <detail-panel
@@ -2958,8 +2962,8 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2958
2962
  .onTagClick=${s=>this.#ze(s)}
2959
2963
  .onFolderClick=${s=>this.#Ie(s)}
2960
2964
  .onDateClick=${s=>this.#ve(s)}
2961
- .onKeyClick=${s=>this.#K(s)}
2962
- .onGroupClick=${s=>this.#K(s)}
2965
+ .onKeyClick=${s=>this.#V(s)}
2966
+ .onGroupClick=${s=>this.#V(s)}
2963
2967
  .onGone=${()=>this.#i.set(null)}
2964
2968
  ></detail-panel>
2965
2969
  </div>