mcp-memory-bucket 0.12.2 → 0.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,10 @@
1
1
  #!/usr/bin/env node
2
+ // Shorthand: `mcp-memory-bucket cloud` (or dev/off) is equivalent to
3
+ // `mcp-memory-bucket --folderfoo-mode cloud` — lets people skip the flag name.
4
+ if (['off', 'dev', 'cloud'].includes(process.argv[2])) {
5
+ process.argv.splice(2, 1, '--folderfoo-mode', process.argv[2]);
6
+ }
7
+
2
8
  if (process.argv[2] === 'stop') {
3
9
  const { execSync } = await import('node:child_process');
4
10
  const port = process.env.PORT || 8767;
@@ -10,13 +10,13 @@
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */const Ee=globalThis,Ze=n=>n,le=Ee.trustedTypes,Je=le?le.createPolicy("lit-html",{createHTML:n=>n}):void 0,Ot="$lit$",z=`lit$${Math.random().toFixed(9).slice(2)}$`,Dt="?"+z,ys=`<${Dt}>`,O=document,X=()=>O.createComment(""),ee=n=>n===null||typeof n!="object"&&typeof n!="function",Re=Array.isArray,ks=n=>Re(n)||typeof n?.[Symbol.iterator]=="function",be=`[
14
- \f\r]`,Z=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ye=/-->/g,Qe=/>/g,P=RegExp(`>|${be}(?:([^\\s"'>=/]+)(${be}*=${be}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Xe=/'/g,et=/"/g,Mt=/^(?:script|style|textarea|title)$/i,ws=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),l=ws(1),D=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),tt=new WeakMap,L=O.createTreeWalker(O,129);function Nt(n,e){if(!Re(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Je!==void 0?Je.createHTML(e):e}const $s=(n,e)=>{const t=n.length-1,s=[];let i,r=e===2?"<svg>":e===3?"<math>":"",o=Z;for(let a=0;a<t;a++){const c=n[a];let d,u,p=-1,g=0;for(;g<c.length&&(o.lastIndex=g,u=o.exec(c),u!==null);)g=o.lastIndex,o===Z?u[1]==="!--"?o=Ye:u[1]!==void 0?o=Qe:u[2]!==void 0?(Mt.test(u[2])&&(i=RegExp("</"+u[2],"g")),o=P):u[3]!==void 0&&(o=P):o===P?u[0]===">"?(o=i??Z,p=-1):u[1]===void 0?p=-2:(p=o.lastIndex-u[2].length,d=u[1],o=u[3]===void 0?P:u[3]==='"'?et:Xe):o===et||o===Xe?o=P:o===Ye||o===Qe?o=Z:(o=P,i=void 0);const x=o===P&&n[a+1].startsWith("/>")?" ":"";r+=o===Z?c+ys:p>=0?(s.push(d),c.slice(0,p)+Ot+c.slice(p)+z+x):c+z+(p===-2?a:x)}return[Nt(n,r+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};let ke=class Ut{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let r=0,o=0;const a=e.length-1,c=this.parts,[d,u]=$s(e,t);if(this.el=Ut.createElement(d,s),L.currentNode=this.el.content,t===2||t===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=L.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const p of i.getAttributeNames())if(p.endsWith(Ot)){const g=u[o++],x=i.getAttribute(p).split(z),m=/([.?@])?(.*)/.exec(g);c.push({type:1,index:r,name:m[2],strings:x,ctor:m[1]==="."?Ss:m[1]==="?"?Cs:m[1]==="@"?Ts:ue}),i.removeAttribute(p)}else p.startsWith(z)&&(c.push({type:6,index:r}),i.removeAttribute(p));if(Mt.test(i.tagName)){const p=i.textContent.split(z),g=p.length-1;if(g>0){i.textContent=le?le.emptyScript:"";for(let x=0;x<g;x++)i.append(p[x],X()),L.nextNode(),c.push({type:2,index:++r});i.append(p[g],X())}}}else if(i.nodeType===8)if(i.data===Dt)c.push({type:2,index:r});else{let p=-1;for(;(p=i.data.indexOf(z,p+1))!==-1;)c.push({type:7,index:r}),p+=z.length-1}r++}}static createElement(e,t){const s=O.createElement("template");return s.innerHTML=e,s}};function K(n,e,t=n,s){if(e===D)return e;let i=s!==void 0?t._$Co?.[s]:t._$Cl;const r=ee(e)?void 0:e._$litDirective$;return i?.constructor!==r&&(i?._$AO?.(!1),r===void 0?i=void 0:(i=new r(n),i._$AT(n,t,s)),s!==void 0?(t._$Co??=[])[s]=i:t._$Cl=i),i!==void 0&&(e=K(n,i._$AS(n,e.values),i,s)),e}let _s=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,i=(e?.creationScope??O).importNode(t,!0);L.currentNode=i;let r=L.nextNode(),o=0,a=0,c=s[0];for(;c!==void 0;){if(o===c.index){let d;c.type===2?d=new ze(r,r.nextSibling,this,e):c.type===1?d=new c.ctor(r,c.name,c.strings,this,e):c.type===6&&(d=new As(r,this,e)),this._$AV.push(d),c=s[++a]}o!==c?.index&&(r=L.nextNode(),o++)}return L.currentNode=O,i}p(e){let t=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}},ze=class jt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,i){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=K(this,e,t),ee(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==D&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):ks(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==f&&ee(this._$AH)?this._$AA.nextSibling.data=e:this.T(O.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:s}=e,i=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=ke.createElement(Nt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const r=new _s(i,this),o=r.u(this.options);r.p(t),this.T(o),this._$AH=r}}_$AC(e){let t=tt.get(e.strings);return t===void 0&&tt.set(e.strings,t=new ke(e)),t}k(e){Re(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,i=0;for(const r of e)i===t.length?t.push(s=new jt(this.O(X()),this.O(X()),this,this.options)):s=t[i],s._$AI(r),i++;i<t.length&&(this._$AR(s&&s._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const s=Ze(e).nextSibling;Ze(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ue=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,i,r){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=r,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=f}_$AI(e,t=this,s,i){const r=this.strings;let o=!1;if(r===void 0)e=K(this,e,t,0),o=!ee(e)||e!==this._$AH&&e!==D,o&&(this._$AH=e);else{const a=e;let c,d;for(e=r[0],c=0;c<r.length-1;c++)d=K(this,a[s+c],t,c),d===D&&(d=this._$AH[c]),o||=!ee(d)||d!==this._$AH[c],d===f?e=f:e!==f&&(e+=(d??"")+r[c+1]),this._$AH[c]=d}o&&!i&&this.j(e)}j(e){e===f?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Ss=class extends ue{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===f?void 0:e}},Cs=class extends ue{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==f)}},Ts=class extends ue{constructor(e,t,s,i,r){super(e,t,s,i,r),this.type=5}_$AI(e,t=this){if((e=K(this,e,t,0)??f)===D)return;const s=this._$AH,i=e===f&&s!==f||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,r=e!==f&&(s===f||i);i&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},As=class{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){K(this,e)}};const Es=Ee.litHtmlPolyfillSupport;Es?.(ke,ze),(Ee.litHtmlVersions??=[]).push("3.3.3");const Rs=(n,e,t)=>{const s=t?.renderBefore??e;let i=s._$litPart$;if(i===void 0){const r=t?.renderBefore??null;s._$litPart$=i=new ze(e.insertBefore(X(),r),r,void 0,t??{})}return i._$AI(n),i};/**
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
+ \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};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
- */const Pe=globalThis;let k=class extends B{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Rs(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return D}};k._$litElement$=!0,k.finalized=!0,Pe.litElementHydrateSupport?.({LitElement:k});const zs=Pe.litElementPolyfillSupport;zs?.({LitElement:k});(Pe.litElementVersions??=[]).push("4.2.2");var qt;let me=0;const st=new Set;function Ps(n){me++;try{n()}finally{me--,me===0&&Is()}}function Is(){const n=new Set(st);st.clear();for(const e of n)e()}function Ls(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function Fs(n){return n&&typeof n.deref=="function"}class Ie{static#e=0;#t;#s;#n=new Set;#r=qt.#e++;name;constructor(e,t){this.#t=e,this.#s=e,this.name=t}_get(){return h.activeConsumer&&h.activeConsumer.track(this),this.#t}_set(e){return Ls(e,this.#t)?(this.#s=this.#t,this.#t=e,this._notify(),!0):!1}subscribe(e,t=!1){let s=e;return t&&(s=new WeakRef(e)),this.#n.add(s),()=>this.#n.delete(s)}_notify(){const e=[...this.#n];for(const t of e){let s;if(Fs(t)){if(s=t.deref(),!s){this.#n.delete(t);continue}}else s=t;s()}}get id(){return this.#r}get previousValue(){return this.#s}toString(){return this.name?`${this.constructor.name}(${this.name})`:`${this.constructor.name}#${this.id}`}}qt=Ie;class h extends Ie{static#e=[];constructor(e,t){super(e,t)}static get activeConsumer(){return this.#e[this.#e.length-1]}static push(e){this.#e.push(e)}static pop(){this.#e.pop()}get(){return this._get()}set(e){Ps(()=>{this._set(e)})}get value(){return this.get()}set value(e){this.set(e)}update(e){this.set(e(this.get()))}}class it extends Ie{#e;#t=!0;#s=!1;#n=new Map;_debugParent;#r;#u=()=>{this.#t||(this.#t=!0,this._notify())};constructor(e,t,s){super(void 0,t),this.#e=e,this.#r=s?.weak??!0}track(e){if(this.#n.has(e))return;const t=e.subscribe(this.#u,this.#r);this.#n.set(e,t)}dispose(){this.#a()}#a(){for(const e of this.#n.values())e();this.#n.clear()}get(){if(h.activeConsumer&&h.activeConsumer.track(this),!this.#t)return this._get();if(this.#s)throw new Error(`Cycle detected in ${this}
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
20
  ↳ while computing ${this._debugParent??"root"}`);this.#s=!0,this.#a(),h.push(this);try{const e=this.#e();this._set(e)}finally{h.pop(),this.#t=!1,this.#s=!1}return this._get()}get value(){return this.get()}set value(e){throw new Error(`Cannot set value of Computed ${this}. Computed values are read-only.`)}subscribe(e,t=!1){const s=super.subscribe(e,t);return h.activeConsumer||this.get(),s}}class N{#e;#t=new Map;_debugParent;constructor(e){this.#e=e,e.addController(this);const t=e,s=t.update,i=this;t.update=function(r){h.push(i);try{s.call(this,r)}finally{h.pop()}}}track(e){this.#t.has(e)||this.#t.set(e,e.subscribe(this.#s,!0))}#s=()=>{this.#e.requestUpdate()};hostUpdate(){for(const e of this.#t.values())e();this.#t.clear()}hostDisconnected(){for(const e of this.#t.values())e();this.#t.clear()}toString(){const e=this.#e;return`SignalWatcher(${e?.localName??e?.tagName??e?.constructor?.name??"unknown"})`}}const Os=new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"});function Ds(n){if(!n)return"unknown age";const e=new Date(n);return Number.isNaN(e.getTime())?"unknown age":Os.format(e)}function Ms(n){const e=[],t=new Map,s=[];for(const r of n){const o=r._table==="memory_docs"?r.key:r.group;if(!o){s.push(r);continue}t.has(o)||(t.set(o,[]),e.push(o)),t.get(o).push(r)}const i=e.map(r=>({label:r,icon:t.get(r)[0]._table==="memory_docs"?"🔑":"📂",items:t.get(r)}));return s.length>0&&i.push({label:null,icon:s[0]._table==="memory_docs"?"🔑":"📂",items:s}),i}class Ns extends k{static{this.properties={results:{attribute:!1},showFolder:{attribute:!1},onSelect:{attribute:!1},selectedIds:{attribute:!1},onToggleSelect:{attribute:!1},onKeyClick:{attribute:!1},onGroupClick:{attribute:!1}}}static{this.styles=$`
21
21
  :host { display: block; }
22
22
  .count-header {
@@ -138,9 +138,9 @@
138
138
  </div>
139
139
  </div>
140
140
  `}}customElements.define("result-list",Ns);function Le(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var U=Le();function Bt(n){U=n}var I={exec:()=>null};function j(n){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),i=e[s];return i||(i=n(s),e[s]=i),i}}function b(n,e=""){let t=typeof n=="string"?n:n.source,s={replace:(i,r)=>{let o=typeof r=="string"?r:r.source;return o=o.replace(w.caret,"$1"),t=t.replace(i,o),s},getRegex:()=>new RegExp(t,e)};return s}var Us=((n="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+n)}catch{return!1}})(),w={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:j(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:j(n=>new RegExp(`^ {0,${n}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:j(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:j(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:j(n=>new RegExp(`^ {0,${n}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:j(n=>new RegExp(`^ {0,${n}}>`))},js=/^(?:[ \t]*(?:\n|$))+/,qs=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Bs=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,te=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Hs=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Fe=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Ht=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Kt=b(Ht).replace(/bull/g,Fe).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ks=b(Ht).replace(/bull/g,Fe).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Oe=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Vs=/^[^\n]+/,De=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Gs=b(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",De).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ws=b(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Fe).getRegex(),fe="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Me=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Zs=b("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Me).replace("tag",fe).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Vt=n=>b(Oe).replace("hr",te).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",n).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",fe).getRegex(),Js=Vt(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Ys=Vt(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Qs=b(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ys).getRegex(),Ne={blockquote:Qs,code:qs,def:Gs,fences:Bs,heading:Hs,hr:te,html:Zs,lheading:Kt,list:Ws,newline:js,paragraph:Js,table:I,text:Vs},rt=b("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",te).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",fe).getRegex(),Xs={...Ne,lheading:Ks,table:rt,paragraph:b(Oe).replace("hr",te).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",rt).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",fe).getRegex()},ei={...Ne,html:b(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Me).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:I,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:b(Oe).replace("hr",te).replace("heading",` *#{1,6} *[^
141
- ]`).replace("lheading",Kt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ti=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,si=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Gt=/^( {2,}|\\)\n(?!\s*$)/,ii=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,E=/[\p{P}\p{S}]/u,V=/[\s\p{P}\p{S}]/u,se=/[^\s\p{P}\p{S}]/u,ri=b(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,V).getRegex(),ni=/[\p{Pi}\p{Ps}"']/u,Wt=/(?!~)[\p{P}\p{S}]/u,oi=/(?!~)[\s\p{P}\p{S}]/u,ai=/(?:[^\s\p{P}\p{S}]|~)/u,li=b(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Us?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Zt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ci=b(Zt,"u").replace(/punct/g,E).getRegex(),di=b(Zt,"u").replace(/punct/g,Wt).getRegex(),hi=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,pi=b(hi,"u").replace(/openQuote/g,ni).replace(/punct/g,E).getRegex(),Jt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ui=b(Jt,"gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,V).replace(/punct/g,E).getRegex(),fi=b(Jt,"gu").replace(/notPunctSpace/g,ai).replace(/punctSpace/g,oi).replace(/punct/g,Wt).getRegex(),gi="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",bi=b(gi,"gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,V).replace(/punct/g,E).getRegex(),mi=b("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,V).replace(/punct/g,E).getRegex(),vi="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",xi=b(vi,"gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,V).replace(/punct/g,E).getRegex(),yi=b(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,E).getRegex(),ki="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",wi=b(ki,"gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,V).replace(/punct/g,E).getRegex(),$i=b(/\\(punct)/,"gu").replace(/punct/g,E).getRegex(),_i=b(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Si=b(Me).replace("(?:-->|$)","-->").getRegex(),Ci=b("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Si).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ce=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Ti=b(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ce).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Yt=b(/^!?\[(label)\]\[(ref)\]/).replace("label",ce).replace("ref",De).getRegex(),Qt=b(/^!?\[(ref)\](?:\[\])?/).replace("ref",De).getRegex(),Ai=b("reflink|nolink(?!\\()","g").replace("reflink",Yt).replace("nolink",Qt).getRegex(),nt=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ue={_backpedal:I,anyPunctuation:$i,autolink:_i,blockSkip:li,br:Gt,code:si,del:I,delLDelim:I,delRDelim:I,emStrongLDelim:ci,emStrongRDelimAst:ui,emStrongRDelimUnd:mi,escape:ti,link:Ti,nolink:Qt,punctuation:ri,reflink:Yt,reflinkSearch:Ai,tag:Ci,text:ii,url:I},Ei={...Ue,emStrongLDelim:pi,emStrongRDelimAst:bi,emStrongRDelimUnd:xi,link:b(/^!?\[(label)\]\((.*?)\)/).replace("label",ce).getRegex(),reflink:b(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ce).getRegex()},we={...Ue,emStrongRDelimAst:fi,emStrongLDelim:di,delLDelim:yi,delRDelim:wi,url:b(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",nt).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:b(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",nt).getRegex()},Ri={...we,br:b(Gt).replace("{2,}","*").getRegex(),text:b(we.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ie={normal:Ne,gfm:Xs,pedantic:ei},J={normal:Ue,gfm:we,breaks:Ri,pedantic:Ei},zi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ot=n=>zi[n];function A(n,e){if(e){if(w.escapeTest.test(n))return n.replace(w.escapeReplace,ot)}else if(w.escapeTestNoEncode.test(n))return n.replace(w.escapeReplaceNoEncode,ot);return n}function at(n){try{n=encodeURI(n).replace(w.percentDecode,"%")}catch{return null}return n}function lt(n,e){let t=n.replace(w.findPipe,(r,o,a)=>{let c=!1,d=o;for(;--d>=0&&a[d]==="\\";)c=!c;return c?"|":" |"}),s=t.split(w.splitPipe),i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(w.slashPipe,"|");return s}function R(n,e,t){let s=n.length;if(s===0)return"";let i=0;for(;i<s&&n.charAt(s-i-1)===e;)i++;return n.slice(0,s-i)}function ct(n){let e=n.split(`
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
142
  `),t=e.length-1;for(;t>=0&&w.blankLine.test(e[t]);)t--;return e.length-t<=2?n:e.slice(0,t+1).join(`
143
- `)}function Pi(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<n.length;s++)if(n[s]==="\\")s++;else if(n[s]===e[0])t++;else if(n[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function Ii(n,e=0){let t=e,s="";for(let i of n)if(i===" "){let r=4-t%4;s+=" ".repeat(r),t+=r}else s+=i,t++;return s}function dt(n,e,t,s,i){let r=e.href,o=e.title||null,a=n[1].replace(i.other.outputLinkReplace,"$1"),c=n[0].charAt(0)==="!";s.state.inLink=!0;let d=s.state.linkEmitted,u=s.state.inRawBlock;s.state.linkEmitted=!1;let p=s.inlineTokens(a),g=s.state.linkEmitted;if(s.state.linkEmitted=d,s.state.inLink=!1,!c){if(g){s.state.inRawBlock=u;return}s.state.linkEmitted=!0}return{type:c?"image":"link",raw:t,href:r,title:o,text:a,tokens:p}}function Li(n,e,t){let s=n.match(t.other.indentCodeCompensation);if(s===null)return e;let i=s[1];return e.split(`
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],`
146
146
  `),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:R(e[0],`
@@ -168,7 +168,7 @@ ${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=Pi(e[2],"()");if(r===-2)return;if(r>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+r;e[2]=e[2].substring(0,r),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let s=e[2],i="";if(this.options.pedantic){let r=this.rules.other.pedanticHrefTitle.exec(s);r&&(s=r[1],i=r[3])}else i=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),dt(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[s.toLowerCase()];if(!i){let r=t[0].charAt(0);return{type:"text",raw:r,text:r}}return dt(t,i,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(n);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,r,o,a=i,c=0,d=s[0][0],u=t===d,p=d==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,e=e.slice(-1*n.length+i);(s=p.exec(e))!==null;){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r)continue;if(o=[...r].length,s[3]||s[4]){a+=o;continue}else if(s[5]||s[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(a-=o,a>0)continue;o=Math.min(o,o+a+c);let g=[...s[0]][0].length,x=n.slice(0,i+s.index+g+o);if(Math.min(i,o)%2){let T=x.slice(1,-1);return{type:"em",raw:x,text:T,tokens:this.lexer.inlineTokens(T)}}let m=x.slice(2,-2);return{type:"strong",raw:x,text:m,tokens:this.lexer.inlineTokens(m)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,t=""){let s=this.rules.inline.delLDelim.exec(n);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,r,o,a=i,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*n.length+i);(s=c.exec(e))!==null;){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r||(o=[...r].length,o!==i))continue;if(s[3]||s[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let d=[...s[0]][0].length,u=n.slice(0,i+s.index+d+o),p=u.slice(i,-i);return{type:"del",raw:u,text:p,tokens:this.lexer.inlineTokens(p)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(n){let e;if(e=this.rules.inline.url.exec(n)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},S=class $e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||U,this.options.tokenizer=this.options.tokenizer||new de,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:w,block:ie.normal,inline:J.normal};this.options.pedantic?(t.block=ie.pedantic,t.inline=J.pedantic):this.options.gfm&&(t.block=ie.gfm,this.options.breaks?t.inline=J.breaks:t.inline=J.gfm),this.tokenizer.rules=t}static get rules(){return{block:ie,inline:J}}static lex(e,t){return new $e(t).lex(e)}static lexInline(e,t){return new $e(t).inlineTokens(e)}lex(e){e=e.replace(w.carriageReturn,`
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
172
  `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(w.tabCharGlobal," ").replace(w.spaceLine,""));let i=1/0;for(;e;){if(e.length<i)i=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let r;if(this.options.extensions?.block?.some(a=>(r=a.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let a=t.at(-1);r.raw.length===1&&a!==void 0?a.raw+=`
173
173
  `:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
174
174
  `)?"":`
@@ -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
- `}#z(e,t){const s=e.created_at?Yi(e.created_at):null;return l`
1206
+ `}#P(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>
@@ -1283,7 +1283,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1283
1283
  </div>
1284
1284
  ${this._shareStatus?l`<div class="share-status">${this._shareStatus}</div>`:f}
1285
1285
  </div>
1286
- `}#P(e,t,s,i){return l`
1286
+ `}#z(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"
@@ -1312,10 +1312,10 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
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.#P(e,t,a,c))}
1315
+ ${this.#R(r,[],(a,c)=>this.#z(e,t,a,c))}
1316
1316
  </ul>`:l`
1317
1317
  <ul>
1318
- ${s.map(a=>l`<li>${this.#P(e,t,a,a.filename)}</li>`)}
1318
+ ${s.map(a=>l`<li>${this.#z(e,t,a,a.filename)}</li>`)}
1319
1319
  </ul>
1320
1320
  `:f}
1321
1321
  <label class="attachment-add">
@@ -1334,7 +1334,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
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
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
1336
  ${this.#S(e,t)}
1337
- ${i?l`<div class="bare-notice">No frontmatter — this is a plain, unmanaged file.</div>`:this.#z(e,t)}
1337
+ ${i?l`<div class="bare-notice">No frontmatter — this is a plain, unmanaged file.</div>`:this.#P(e,t)}
1338
1338
  ${s?f:l`
1339
1339
  <div class="actions">
1340
1340
  ${i?l`<button class="primary" @click=${()=>this.#w()}>Add frontmatter</button>`:l`
@@ -1379,7 +1379,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1379
1379
  </div>
1380
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>`}
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);#z=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("");#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=$`
1383
1383
  :host { display: block; }
1384
1384
  .backdrop {
1385
1385
  position: fixed; inset: 0; background: var(--overlay);
@@ -1482,10 +1482,10 @@ 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)}#P(){this.#h.set(""),this.#g.set(!0)}#R(){this.#g.set(!1),this.#h.set("")}async#E(){const e=this.#h.value.trim();if(e){this.#i.set("");try{const t=await fetch("/api/fs/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:this.#s.value,name:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to create folder");return}this.#g.set(!1),this.#h.set(""),await this.#A(this.#s.value)}catch(t){this.#i.set(t.message)}}}#O(){this.#u.set(this.#s.value),this.#a.value||this.#a.set(this.#s.value.split("/").filter(Boolean).pop()??"")}async#F(){const e=this.#u.value||this.#s.value;if(e){this.#o.set(!0),this.#i.set("");try{const t=await fetch("/api/folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#a.value||void 0,path:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to add folder");return}this.onAdded()}finally{this.#o.set(!1)}}}async#G(){if(this.#p.value)return;const{folderfooMode:e,folderfooHost:t}=await H();if(e==="off"||!t)return;let s=null;try{s=localStorage.getItem("folderfoo_token")}catch{}s&&(this.#c.set(t),this.#v.set(F),this.#x.set(!0),this.#W(s))}async#U(){if(!this.#c.value){this.#i.set("enter a server URL first");return}this.#i.set("");try{await ae(()=>import(`${this.#c.value}/elements/folderfoo-profile-circle.js`),[]),this.#b.set(!0),this.#w.set(""),await this.updateComplete;const e=this.renderRoot.querySelector(".ff-widget-slot");if(e&&!e.querySelector("folderfoo-profile-circle")){const t=document.createElement("folderfoo-profile-circle");t.setAttribute("app-name","Memory Bucket"),e.appendChild(t)}this.#m=setInterval(()=>this.#j(),800),this.#j()}catch(e){this.#w.set(e.message)}}#j(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{}!e||this.#p.value||(clearInterval(this.#m),this.#W(e))}async#W(e){this.#y.set(!0),this.#i.set("");try{const t=await fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:this.#c.value,token:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to persist folderfoo session");return}this.#p.set(!0),this.#v.set(F),await this.#q()}finally{this.#y.set(!1)}}async#q(e,t){this.#_.set(!0),this.#i.set("");try{const s=new URLSearchParams({server:this.#c.value,tenantId:this.#v.value});e&&s.set("owner",e),t&&s.set("rootFolder",t);const i=await fetch(`/api/folderfoo/folders?${s.toString()}`),r=await i.json();if(!i.ok){this.#i.set(r.error??"failed to list folderfoo folders");return}this.#$.set(r)}finally{this.#_.set(!1)}}async#J(){this.#S.set(!0),this.#i.set("");try{const e=new URLSearchParams({server:this.#c.value,tenantId:this.#v.value}),t=await fetch(`/api/folderfoo/shared-folders?${e.toString()}`),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to list folders shared with you");return}this.#T.set(s)}finally{this.#S.set(!1)}}#B(e){this.#C.set(e),this.#z.set(null),this.#l.set(""),this.#k.set(""),e==="shared"&&this.#T.value.length===0?this.#J():e==="mine"&&this.#q()}#Y(e){this.#z.set(e),this.#q(e.owner,e.path)}#H(e,t){this.#l.set(e),this.#k.set(t??""),this.#a.value||this.#a.set(e.split("/").filter(Boolean).pop()??this.#v.value)}#Q(e){this.#H(e.path,e.owner)}async#X(){if(this.#l.value){this.#o.set(!0),this.#i.set("");try{const e=await fetch("/api/remote-folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#a.value||void 0,server:this.#c.value,tenantId:this.#v.value,folderPath:this.#l.value,owner:this.#k.value||void 0})}),t=await e.json();if(!e.ok){this.#i.set(t.error??"failed to connect folder");return}this.onAdded(t.kindMismatchWarning)}finally{this.#o.set(!1)}}}#ee(){const e=this.#n.value;return l`
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`
1486
1486
  <div class="breadcrumb-row">
1487
1487
  <div class="breadcrumb">${this.#s.value}</div>
1488
- <button class="new-folder-btn" @click=${()=>this.#P()}>+ New folder</button>
1488
+ <button class="new-folder-btn" @click=${()=>this.#z()}>+ New folder</button>
1489
1489
  <label class="hidden-toggle">
1490
1490
  <input type="checkbox" .checked=${this.#d.value} @change=${()=>this.#I()} />
1491
1491
  Show hidden
@@ -1579,7 +1579,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1579
1579
  <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
1580
1580
  </div>
1581
1581
  </div>
1582
- `;const t=this.#T.value,s=this.#z.value;return l`
1582
+ `;const t=this.#T.value,s=this.#P.value;return l`
1583
1583
  <div class="ff-body">
1584
1584
  <div class="ff-connected-row"><span class="ff-connected-dot"></span> Connected to ${this.#c.value}</div>
1585
1585
  <div class="kind-toggle">
@@ -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}}}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=$`
1984
1984
  :host {
1985
1985
  display: flex;
1986
1986
  align-items: center;
@@ -2032,6 +2032,23 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2032
2032
  .channels-toggle.active, .folder-view-toggle.active, .shared-toggle.active {
2033
2033
  background: var(--accent); border-color: var(--accent); color: var(--accent-fg); opacity: 1;
2034
2034
  }
2035
+ .bridge-toggle {
2036
+ height: 28px;
2037
+ padding: 0 12px;
2038
+ border: 1px solid var(--border-strong);
2039
+ border-radius: 14px;
2040
+ background: var(--bg);
2041
+ color: inherit;
2042
+ cursor: pointer;
2043
+ font-size: 12px;
2044
+ line-height: 1;
2045
+ display: flex;
2046
+ align-items: center;
2047
+ gap: 5px;
2048
+ opacity: 0.75;
2049
+ font-family: inherit;
2050
+ }
2051
+ .bridge-toggle:hover { opacity: 1; background: var(--hover); }
2035
2052
  `}#e(){return l`
2036
2053
  <button
2037
2054
  class=${`reindex-toggle${this.reindexing?" spinning":""}`}
@@ -2067,6 +2084,13 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2067
2084
  🤝 Shared
2068
2085
  </button>
2069
2086
  `:""}
2087
+ <button
2088
+ class="bridge-toggle"
2089
+ title="Copy js-bridge-mcp proxy config for this server"
2090
+ @click=${()=>this.onCopyBridgeConfig()}
2091
+ >
2092
+ 🔌 Copy MCP config
2093
+ </button>
2070
2094
  <button
2071
2095
  class="theme-toggle"
2072
2096
  title=${`Theme: ${pr[this.theme]} (click to change)`}
@@ -2424,7 +2448,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2424
2448
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
2425
2449
  padding: 8px 16px; border-top: 1px solid var(--border); font-size: 11px; opacity: 0.6;
2426
2450
  }
2427
- `}constructor(){super(),new N(this)}willUpdate(e){e.has("memoryFolders")&&this.#C()}connectedCallback(){super.connectedCallback(),this.#w(),this.#C(),this.openToAdd&&(this.#u=!0,this.#T()),window.addEventListener("keydown",this.#b)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.#b)}firstUpdated(){this.renderRoot.querySelector(".search-row input")?.focus()}async#w(){this.#t.set(!0);try{const t=await(await fetch("/api/quick-prompts")).json();this.#e.set(t)}catch(e){this.#g.set(e.message)}finally{this.#t.set(!1)}}#x(){const e=this.#d.value?this.#e.value.filter(i=>i.folder===this.#d.value):this.#e.value,t=this.#s.value.trim().toLowerCase();return[...t?e.filter(i=>i.title.toLowerCase().includes(t)||i.body.toLowerCase().includes(t)||i.tags.some(r=>r.toLowerCase().includes(t))):e].sort((i,r)=>Number(r.pinned)-Number(i.pinned))}#v(e){const t=this.#x()[this.#n.value];this.#s.set(e.target.value);const s=this.#x(),i=t?s.findIndex(r=>r.id===t.id):-1;this.#n.set(i!==-1?i:s.length>0?0:-1)}#p(){const e=this.renderRoot.querySelector(".grid");if(!e)return 1;const t=getComputedStyle(e).gridTemplateColumns;return Math.max(1,t.split(" ").filter(Boolean).length)}#y(e){if((e.metaKey||e.ctrlKey)&&e.key==="Enter"&&!this.#r.value){e.preventDefault(),this.#T();return}const t=this.#x(),s=this.#p(),i=e.target,r=i instanceof HTMLInputElement,o=i instanceof HTMLTextAreaElement,a=(r||o)&&i.value.length>0;if(!((e.key==="ArrowLeft"||e.key==="ArrowRight")&&a)&&!((e.key==="ArrowUp"||e.key==="ArrowDown")&&o)){if(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight"){e.preventDefault();let c=this.#n.value;c===-1?c=0:e.key==="ArrowDown"?c=Math.min(t.length-1,c+s):e.key==="ArrowUp"?c=Math.max(0,c-s):e.key==="ArrowRight"?c=Math.min(t.length-1,c+1):e.key==="ArrowLeft"&&(c=Math.max(0,c-1)),this.#n.set(c);return}if(e.key==="Enter"){const c=t[this.#n.value];c&&(e.preventDefault(),this.#l(c));return}e.key==="Escape"&&!this.#r.value&&this.onClose()}}#$(e){(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()==="z"&&re&&(e.preventDefault(),this.#m())}async#l(e){try{await navigator.clipboard.writeText(e.body),y.success("Copied to clipboard")}catch{y.danger("Copy failed")}this.onClose()}async#k(e){const t=!e.pinned;this.#e.set(this.#e.value.map(s=>s.id===e.id?{...s,pinned:t}:s)),await fetch(`/api/quick-prompts/${encodeURIComponent(e.id)}/pinned`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({pinned:t})})}async#_(e){re={title:e.title,body:e.body,tags:e.tags,pinned:e.pinned,folder:e.folder},this.#e.set(this.#e.value.filter(t=>t.id!==e.id)),this.#h.set("Deleted — press Cmd+Z / Ctrl+Z to undo");try{await fetch(`/api/quick-prompts/${encodeURIComponent(e.id)}`,{method:"DELETE"})}catch(t){this.#g.set(t.message)}}async#m(){const e=re;if(e){re=null,this.#h.set("");try{const s=await(await fetch("/api/quick-prompts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e.title,body:e.body,tags:e.tags,folder:e.folder})})).json();e.pinned&&(await fetch(`/api/quick-prompts/${encodeURIComponent(s.id)}/pinned`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({pinned:!0})}),s.pinned=!0),this.#e.set([s,...this.#e.value]),this.#h.set("Prompt restored"),setTimeout(()=>this.#h.set(""),2e3)}catch(t){this.#g.set(t.message)}}}#C(){const e=this.memoryFolders??[];e.length!==0&&(e.some(t=>t.name===this.#d.value)||this.#d.set(e[0].name))}#T(){this.#a.set(null),this.#i.set(""),this.#o.set(""),this.#C(),this.#r.set(!0),this.#z()}#S(e){this.#a.set(e.id),this.#i.set(e.title),this.#o.set(e.body),this.#d.set(e.folder),this.#r.set(!0),this.#z()}#z(){this.updateComplete.then(()=>{this.renderRoot.querySelector(".add-form textarea")?.focus()})}#A(){this.updateComplete.then(()=>{this.renderRoot.querySelector(".search-row input")?.focus()})}#I(e){this.#d.set(e),localStorage.setItem(At,e),this.#n.set(-1)}#P(){if(this.#u){this.onClose();return}this.#r.set(!1),this.#a.set(null),this.#A()}async#R(){const e=this.#o.value.trim();if(!e)return;this.#g.set("");const t=this.#a.value;try{const s=await fetch(t?`/api/quick-prompts/${encodeURIComponent(t)}`:"/api/quick-prompts",{method:t?"PATCH":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:this.#i.value.trim(),body:e,folder:this.#d.value||void 0})}),i=await s.json();if(!s.ok){this.#g.set(i.error??(t?"failed to update prompt":"failed to create prompt"));return}t?this.#e.set(this.#e.value.map(r=>r.id===t?i:r)):this.#e.set([i,...this.#e.value]),this.#r.set(!1),this.#a.set(null)}catch(s){this.#g.set(s.message)}}#E(e){e.key==="Escape"?(e.stopPropagation(),this.#P()):(e.metaKey||e.ctrlKey)&&e.key==="Enter"&&this.#R()}render(){const e=this.#x();return l`
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`
2428
2452
  <div class="backdrop" @click=${t=>t.target===t.currentTarget&&this.onClose()}>
2429
2453
  <div class="modal" @keydown=${this.#c}>
2430
2454
  <div class="search-row">
@@ -2462,7 +2486,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2462
2486
  @input=${t=>this.#o.set(t.target.value)}
2463
2487
  ></textarea>
2464
2488
  <div class="add-form-actions">
2465
- <button class="secondary" @click=${()=>this.#P()}>Cancel</button>
2489
+ <button class="secondary" @click=${()=>this.#z()}>Cancel</button>
2466
2490
  <button class="primary" ?disabled=${!this.#o.value.trim()} @click=${()=>this.#R()}>
2467
2491
  ${this.#a.value?"Save changes":"Add prompt"}
2468
2492
  </button>
@@ -2502,7 +2526,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2502
2526
  </div>
2503
2527
  </div>
2504
2528
  </div>
2505
- `}}customElements.define("quick-prompts-modal",mr);function vr(n){const e=n.split(":");if(e.length===1)return{folderPath:"",name:e[0]};if(e.length===2){const[r,o]=e;return r.includes("/")?{folderPath:r,name:o}:{owner:r,folderPath:"",name:o}}const[t,s,...i]=e;return{owner:t===""?void 0:t,folderPath:s,name:i.join(":")}}const oe=new h({mode:"off",username:null});let Et=!1;function xr(){if(Et)return;Et=!0;const n=new EventSource("/api/folderfoo/identity-stream");n.onmessage=e=>{try{oe.set(JSON.parse(e.data))}catch{}}}let Rt=!1;async function yr(n){if(Rt)return;Rt=!0;const{folderfooMode:e,folderfooHost:t}=await H();if(e==="off"||!t)return;const s=new URL(window.location.href),i=s.searchParams.has("shareToken"),r=s.searchParams.has("publicToken");if(!(!i&&!r)){document.addEventListener("folderfoo-share-redeemed",o=>{const a=o.detail;!a?.owner||!a?.path||a.type!=="file"||!a.originId||!a.kind||n({owner:a.owner,path:a.path,originId:a.originId,kind:a.kind,role:a.role??"member",server:t,tenantId:F})}),document.addEventListener("folderfoo-share-redeem-failed",o=>{const a=o.detail?.message;alert(a||"This link is invalid or has expired.")});try{const[o,a]=await Promise.all([ae(()=>import(`${t}/elements/auth-guard.js`),[]),ae(()=>import(`${t}/elements/api-client.js`),[])]);if(a.setTenantId(F),i&&o.redeemShareTokenFromUrl(),r){const c=s.searchParams.get("publicToken");s.searchParams.delete("publicToken"),window.history.replaceState(null,"",s.toString());const d=await o.getPublicLink(c).catch(u=>(alert(u.message||"This link is invalid or has expired."),null));d?.type==="file"&&d.originId&&d.kind&&n({owner:d.owner,path:d.path,originId:d.originId,kind:d.kind,role:"member",server:t,tenantId:F})}}catch(o){console.error("[memory-bucket] failed to load folderfoo share-accept widgets:",o)}}}let zt=!1;const kr=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],Pt=[{value:"all",label:"Show all"},{value:"hide",label:"Hide"},{value:"only",label:"Only"}],wr={tags:[],statuses:[],owners:[],doc_types:[],key_types:[],folders:[]},$r={skill:[],memory:[]},ss="mem-bucket-split-pct",is=20,rs=80;function _r(){const n=Number(localStorage.getItem(ss));return Number.isFinite(n)&&n>=is&&n<=rs?n:40}const ns="mem-bucket-theme",xe=["system","light","dark"];function Sr(){const n=localStorage.getItem(ns);return n==="light"||n==="dark"?n:"system"}function It(n){n==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",n)}function Cr(){const n=location.hash.slice(1);if(!n)return{};const e=new URLSearchParams(n),t={},s=e.get("q");s&&(t.query=s);const i=e.get("type");(i==="skill"||i==="memory"||i==="all")&&(t.typeFilter=i);const r=e.getAll("tag");r.length&&(t.activeTags=r);const o=e.getAll("folder");o.length&&(t.activeFolders=o);const a=e.get("sort");a&&(t.sort=a);const c=e.get("deprecated");c==="0"?t.deprecatedFilter="hide":c==="1"&&(t.deprecatedFilter="only");const d=e.get("paused");d==="0"?t.pausedFilter="hide":d==="1"&&(t.pausedFilter="only");const u=e.get("date_from");u&&(t.dateFrom=u);const p=e.get("date_to");return p&&(t.dateTo=p),t}class Tr extends k{static{this.styles=$`
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=$`
2506
2530
  :host { display: flex; flex-direction: column; height: 100vh; position: relative; }
2507
2531
  /* Mounted inside whichever header row #renderBody() renders for the current mode (.folders-bar,
2508
2532
  .toolbar-bar, or folder-view's own .mode-row, via a <slot>) so it's a normal flex child of
@@ -2704,7 +2728,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2704
2728
  cursor: pointer;
2705
2729
  }
2706
2730
  .bulk-bar button.danger { border-color: var(--danger); color: var(--danger); }
2707
- `}#e=Cr();#t=new h(this.#e.query??"");#s=new h(this.#e.typeFilter??"all");#n=new h(this.#e.activeTags??[]);#r=new h(this.#e.activeFolders??[]);#u=new h([]);#a=new h(wr);#i=new h(null);#o=new h($r);#d=new h(!1);#g=new h("");#h=new h(!1);#c=new h(_r());#b=new h("");#w=new h(!1);#x=new h(this.#e.sort??"");#v=new h(this.#e.deprecatedFilter??"all");#p=new h(this.#e.pausedFilter??"all");#y=new h(this.#e.dateFrom??"");#$=new h(this.#e.dateTo??"");#l=new h(new Set);#k=new h(Sr());#_=new h(!1);#m=new h("entries");#C=new h([]);#T=new h([]);#S=new h(null);#z=new h(null);#A=new h(!1);#I=new h([]);#P=new h(!1);#R=new h(null);#E=new h(!1);#O=new h(!1);#F=0;#G=e=>this.#H(e);#U=()=>this.#Q();#j=e=>this.#B(e);constructor(){super(),new N(this),It(this.#k.value)}#W(e){this.#k.set(e),localStorage.setItem(ns,e),It(e)}#q(){const e=xe[(xe.indexOf(this.#k.value)+1)%xe.length];this.#W(e)}async#J(){if(!this.#_.value){this.#_.set(!0);try{if(!(await fetch("/api/rebuild-cache",{method:"POST"})).ok)throw new Error("rebuild-cache request failed");await Promise.all([this.#D(),this.#L(),this.#f()]),y.success("Reindex complete")}catch{y.danger("Reindex failed")}finally{this.#_.set(!1)}}}#B(e){if((e.metaKey||e.ctrlKey)&&e.key==="Enter"&&!this.#E.value){e.preventDefault(),this.#O.set(!0),this.#E.set(!0);return}if(e.key!=="Shift"){this.#F=0;return}const t=Date.now();t-this.#F<450?(this.#F=0,this.#E.set(!this.#E.value)):this.#F=t}#Y(e){e.preventDefault(),this.#w.set(!0),document.addEventListener("pointermove",this.#G),document.addEventListener("pointerup",this.#U)}#H(e){const t=this.renderRoot.querySelector(".body-region");if(!t)return;const s=t.getBoundingClientRect(),i=(e.clientX-s.left)/s.width*100;this.#c.set(Math.min(rs,Math.max(is,i)))}#Q(){this.#w.set(!1),document.removeEventListener("pointermove",this.#G),document.removeEventListener("pointerup",this.#U),localStorage.setItem(ss,String(this.#c.value))}#X=new it(()=>{const e=new URLSearchParams;this.#s.value!=="all"&&e.set("type",this.#s.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim());for(const t of this.#n.value)e.append("tag",t);for(const t of this.#r.value)e.append("folder",t);return this.#x.value&&e.set("sort",this.#x.value),this.#v.value==="hide"?e.set("deprecated","0"):this.#v.value==="only"&&e.set("deprecated","1"),this.#p.value==="hide"?e.set("paused","0"):this.#p.value==="only"&&e.set("paused","1"),this.#y.value&&e.set("date_from",this.#y.value),this.#$.value&&e.set("date_to",this.#$.value),e.toString()});#ee=new it(()=>{const e=new URLSearchParams;return this.#s.value!=="all"&&e.set("type",this.#s.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim()),this.#v.value==="hide"?e.set("deprecated","0"):this.#v.value==="only"&&e.set("deprecated","1"),this.#p.value==="hide"?e.set("paused","0"):this.#p.value==="only"&&e.set("paused","1"),this.#y.value&&e.set("date_from",this.#y.value),this.#$.value&&e.set("date_to",this.#$.value),e.toString()});#M=()=>this.#he();#re=e=>this.#we(e);#ne=e=>this.#$e(e);#oe=()=>this.#de();#ae;connectedCallback(){super.connectedCallback(),this.#f(),this.#L(),this.#D().then(()=>this.#he()),window.addEventListener("focus",this.#M),document.addEventListener("visibilitychange",this.#M),window.addEventListener("keydown",this.#j),document.addEventListener("folderfoo-file-open",this.#re),document.addEventListener("folderfoo-folder-changed",this.#ne),window.addEventListener("folderfoo-auth-change",this.#oe),this.#de(),xr(),yr(e=>this.#Te(e)),this.#Z(),this.#ae=oe.subscribe(()=>{this.#D(),this.#f(),this.#L(),this.#m.value==="shared"&&oe.value.username===null&&this.#N("entries")})}async#we(e){const t=e.detail?.name;if(!t)return;const s=vr(t);if(s.owner){this.#b.set(`"${s.name}" is from a shared folder — opening shared files here isn't supported yet.`);return}const{folderfooMode:i,folderfooHost:r}=await H();if(!(i==="off"||!r))try{const o=await fetch("/api/folderfoo/resolve-open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:r,tenantId:F,folderPath:s.folderPath,name:s.name})}),a=await o.json();if(!o.ok){this.#b.set(a.error??`couldn't open "${s.name}"`);return}this.#b.set(""),this.#i.set({table:a.table,id:a.id})}catch(o){this.#b.set(o.message)}}async#$e(e){const{path:t,action:s,newPath:i}=e.detail??{};if(!(t===void 0||!s)){if((s==="rename"||s==="move")&&i){const{folderfooHost:r}=await H();if(!r)return;try{await fetch("/api/folders/renamed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:r,oldPath:t,newPath:i})})}catch{}}this.#D()}}#le(){return this.shadowRoot?.querySelector("app-toolbar")?.shadowRoot?.querySelector(".folderfoo-slot")??null}#ce(e){const t=document.createElement("folderfoo-profile-circle");t.setAttribute("app-name","Memory Bucket"),t.setAttribute("tenant-id",F),t.style.zoom="0.875",e.appendChild(t)}async#_e(){const e=this.#le();if(!e||e.querySelector("folderfoo-profile-circle"))return;if(zt){this.#ce(e);return}if(e.hasAttribute("data-ff-attempted"))return;e.setAttribute("data-ff-attempted","");const{folderfooMode:t,folderfooHost:s}=await H();t==="off"||!s||ae(()=>import(`${s}/elements/folderfoo-profile-circle.js`),[]).then(async()=>{zt=!0,await this.updateComplete;const i=this.#le();i&&!i.querySelector("folderfoo-profile-circle")&&this.#ce(i)}).catch(i=>{console.warn("folderfoo-profile-circle unavailable:",i.message)})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("focus",this.#M),document.removeEventListener("visibilitychange",this.#M),window.removeEventListener("keydown",this.#j),document.removeEventListener("folderfoo-file-open",this.#re),document.removeEventListener("folderfoo-folder-changed",this.#ne),window.removeEventListener("folderfoo-auth-change",this.#oe),this.#ae?.()}async#de(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{return}if(!e){fetch("/api/folderfoo/logout",{method:"POST"}).catch(()=>{});return}const{folderfooMode:t,folderfooHost:s}=await H();t==="off"||!s||fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:s,token:e})}).catch(()=>{})}#te=!1;async#he(){if(document.visibilityState==="visible"){if(this.#se().some(e=>e.remote)&&!this.#te){this.#te=!0;try{await fetch("/api/remote-folders/resync-all",{method:"POST"})}catch{}finally{this.#te=!1}}this.#f(),this.#L(),this.#D(),this.renderRoot.querySelector("detail-panel")?.refresh?.()}}async#f(){const e=this.#X.value;history.replaceState(null,"",e?`#${e}`:location.pathname+location.search);const t=await fetch(`/api/entries?${e}`);this.#u.set(await t.json()),this.renderRoot.querySelector("result-list")?.scrollTo(0,0),this.#m.value==="folder-view"&&this.#pe()}async#pe(){const e=await fetch(`/api/entries?${this.#ee.value}`);this.#C.set(await e.json())}async#L(){const e=this.#s.value==="all"?"":`?type=${this.#s.value}`,t=await fetch(`/api/facets${e}`);this.#a.set(await t.json())}async#D(){const t=await(await fetch("/api/folders")).json();this.#o.set(t),this.#h.set(!0);const s=new Set([...t.skill,...t.memory].map(o=>o.name)),i=this.#r.value.filter(o=>s.has(o));i.length!==this.#r.value.length&&(this.#r.set(i),this.#f());const r=this.#i.value;if(r){const o=this.#xe().get(r.id);o&&!s.has(o.folder)&&this.#i.set(null)}}#N(e){this.#m.set(e),e==="channels"?this.#fe():e==="folder-view"?this.#pe():e==="shared"&&(this.#Z(),this.#ue())}async#Z(){const e=await fetch("/api/shared-items");this.#I.set(e.ok?await e.json():[])}async#ue(){this.#P.set(!0);try{const e=await fetch("/api/shared-items/refresh",{method:"POST"});e.ok&&this.#R.set(await e.json()),await this.#Z()}finally{this.#P.set(!1)}}async#Se(e){await fetch(`/api/shared-items/${encodeURIComponent(e)}`,{method:"DELETE"}),await this.#Z()}#Ce(e){e.entryId&&(this.#i.set({table:e.kind==="skill"?"skills":"memory_docs",id:e.entryId}),this.#N("entries"))}async#Te(e){const t=await fetch("/api/shared-items/accept",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const s=await t.json().catch(()=>({}));alert(s.error||"Failed to accept the shared item.");return}this.#N("shared")}async#Ae(e,t){const s=await fetch(`/api/shared-items/${encodeURIComponent(e.origin_id)}/fork`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folder:t})}),i=await s.json().catch(()=>({}));return s.ok?(await this.#f(),{ok:!0,message:`Copied into "${t}".`}):{ok:!1,message:i.error||`Fork failed (${s.status}).`}}async#fe(){const e=await fetch("/api/channels");this.#T.set(await e.json()),this.#S.value&&this.#ge(this.#S.value)}async#ge(e){this.#S.set(e),this.#A.set(!0);try{const t=await fetch(`/api/channels/${encodeURIComponent(e)}`);this.#z.set(t.ok?await t.json():null)}finally{this.#A.set(!1)}}#Ee(e){const t=this.#r.value;this.#r.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#f()}async#Re(e,t){if(t.stopPropagation(),window.prompt(`Type "${e.name}" to remove this ${e.kind} folder (files on disk are untouched):`)===e.name){this.#g.set(e.name);try{if(!(await fetch(`/api/folders/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"})).ok)throw new Error("remove folder request failed");this.#r.set(this.#r.value.filter(r=>r!==e.name)),await Promise.all([this.#D(),this.#L(),this.#f()]),y.success("Folder removed")}catch{y.danger("Failed to remove folder")}finally{this.#g.set("")}}}#be(e){this.#d.set(!1),this.#D(),this.#L(),this.#f(),y.success("Folder connected"),e&&alert(e)}#se(){return[...this.#o.value.skill,...this.#o.value.memory].sort((e,t)=>Number(e.remote)-Number(t.remote))}#me(e){this.#s.set(e),this.#n.set([]),this.#L(),this.#f()}#ze(e){const t=this.#n.value;this.#n.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#f()}#Pe(e){this.#n.value.includes(e)||this.#n.set([...this.#n.value,e]),this.#f()}#Ie(e){this.#r.value.includes(e)||this.#r.set([...this.#r.value,e]),this.#f()}#ve(e){this.#y.set(e),this.#$.set(e),this.#f()}#Le(e){this.#t.set(e.target.value),this.#f()}#K(e){this.#t.set(e),this.#f()}#Fe(){this.#t.set(""),this.#f()}#Oe(e){this.#i.set({table:e._table,id:e.id})}#De(e){this.#x.set(e.target.value),this.#f()}#Me(e){this.#v.set(e.target.value),this.#f()}#Ne(e){this.#p.set(e.target.value),this.#f()}#Ue(e){this.#y.set(e.target.value),this.#f()}#je(e){this.#$.set(e.target.value),this.#f()}#qe(){this.#y.set(""),this.#$.set(""),this.#f()}#Be(e){const t=new Set(this.#l.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#l.set(t)}#xe(){return new Map(this.#u.value.map(e=>[e.id,e]))}#ie(){const e=new Map,t=this.#xe();for(const s of this.#l.value){const i=t.get(s);if(!i)continue;const r=e.get(i._table)??[];r.push(s),e.set(i._table,r)}return e}async#ye(e){const t=this.#ie(),s=this.#l.value.size,i=await Promise.all([...t.entries()].map(([r,o])=>fetch(`/api/entries/${r}/bulk/deprecated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:o,deprecated:e})})));this.#l.set(new Set),await this.#f(),i.every(r=>r.ok)?y.success(`${s} item${s===1?"":"s"} updated`):y.danger("Bulk update failed")}async#ke(e){const t=this.#ie(),s=this.#l.value.size,i=await Promise.all([...t.entries()].map(([r,o])=>fetch(`/api/entries/${r}/bulk/paused`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:o,paused:e})})));this.#l.set(new Set),await this.#f(),i.every(r=>r.ok)?y.success(`${s} item${s===1?"":"s"} updated`):y.danger("Bulk update failed")}async#He(){if(!window.confirm(`Delete ${this.#l.value.size} doc(s)? This can't be undone.`))return;const e=this.#ie(),t=this.#l.value.size,s=await Promise.all([...e.entries()].map(([i,r])=>fetch(`/api/entries/${i}/bulk/delete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:r})})));this.#l.set(new Set),await this.#f(),s.every(i=>i.ok)?y.success(`${t} item${t===1?"":"s"} deleted`):y.danger("Bulk delete failed")}#V(){const e=this.#m.value!=="channels"&&this.#m.value!=="shared"&&this.#h.value&&this.#se().length>0,t=oe.value.username!==null||this.#I.value.length>0;return l`
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`
2708
2732
  <app-toolbar
2709
2733
  .showReindex=${e}
2710
2734
  .reindexing=${this.#_.value}
@@ -2718,22 +2742,23 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2718
2742
  .onToggleFolderView=${()=>this.#N(this.#m.value==="folder-view"?"entries":"folder-view")}
2719
2743
  .onToggleShared=${()=>this.#N(this.#m.value==="shared"?"entries":"shared")}
2720
2744
  .onCycleTheme=${()=>this.#q()}
2745
+ .onCopyBridgeConfig=${()=>this.#Ke()}
2721
2746
  ></app-toolbar>
2722
- `}updated(){this.#_e()}render(){return l`
2723
- ${this.#Ke()}
2747
+ `}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
+ ${this.#Ve()}
2724
2749
  ${this.#E.value?l`<quick-prompts-modal
2725
2750
  .onClose=${()=>{this.#E.set(!1),this.#O.set(!1)}}
2726
2751
  .memoryFolders=${this.#o.value.memory}
2727
2752
  .openToAdd=${this.#O.value}
2728
2753
  ></quick-prompts-modal>`:""}
2729
2754
  <toast-stack></toast-stack>
2730
- `}#Ke(){const e=this.#a.value,t=this.#se();return this.#m.value==="shared"?l`
2755
+ `}#Ve(){const e=this.#a.value,t=this.#se();return this.#m.value==="shared"?l`
2731
2756
  <div class="toolbar-bar">
2732
2757
  <div class="header-toolbar">${this.#V()}</div>
2733
2758
  </div>
2734
2759
  <shared-with-me-panel
2735
2760
  .items=${this.#I.value}
2736
- .refreshing=${this.#P.value}
2761
+ .refreshing=${this.#z.value}
2737
2762
  .lastRefreshSummary=${this.#R.value}
2738
2763
  .memoryFolderNames=${this.#o.value.memory.map(s=>s.name)}
2739
2764
  .skillFolderNames=${this.#o.value.skill.map(s=>s.name)}
@@ -2749,7 +2774,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2749
2774
  <channel-view
2750
2775
  .channels=${this.#T.value}
2751
2776
  .selected=${this.#S.value}
2752
- .detail=${this.#z.value}
2777
+ .detail=${this.#P.value}
2753
2778
  .loading=${this.#A.value}
2754
2779
  .onSelect=${s=>this.#ge(s)}
2755
2780
  .onRefresh=${()=>this.#fe()}
@@ -2849,7 +2874,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2849
2874
  <tag-multiselect
2850
2875
  .tags=${e.tags}
2851
2876
  .active=${this.#n.value}
2852
- .onToggle=${s=>this.#ze(s)}
2877
+ .onToggle=${s=>this.#Pe(s)}
2853
2878
  .width=${"260px"}
2854
2879
  ></tag-multiselect>
2855
2880
  `}
@@ -2892,11 +2917,11 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2892
2917
  </select>
2893
2918
  <span class="filter-label">Deprecated:</span>
2894
2919
  <select .value=${this.#v.value} @change=${s=>this.#Me(s)}>
2895
- ${Pt.map(s=>l`<option value=${s.value}>${s.label}</option>`)}
2920
+ ${zt.map(s=>l`<option value=${s.value}>${s.label}</option>`)}
2896
2921
  </select>
2897
2922
  <span class="filter-label">Paused:</span>
2898
2923
  <select .value=${this.#p.value} @change=${s=>this.#Ne(s)}>
2899
- ${Pt.map(s=>l`<option value=${s.value}>${s.label}</option>`)}
2924
+ ${zt.map(s=>l`<option value=${s.value}>${s.label}</option>`)}
2900
2925
  </select>
2901
2926
  </div>
2902
2927
  </div>
@@ -2930,7 +2955,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2930
2955
  .selected=${this.#i.value}
2931
2956
  .facets=${e}
2932
2957
  .onChanged=${()=>{this.#f(),this.#L()}}
2933
- .onTagClick=${s=>this.#Pe(s)}
2958
+ .onTagClick=${s=>this.#ze(s)}
2934
2959
  .onFolderClick=${s=>this.#Ie(s)}
2935
2960
  .onDateClick=${s=>this.#ve(s)}
2936
2961
  .onKeyClick=${s=>this.#K(s)}
@@ -44,7 +44,7 @@
44
44
  z-index: 2147483000;
45
45
  }
46
46
  </style>
47
- <script type="module" crossorigin src="/assets/index-Ac8jz7cY.js"></script>
47
+ <script type="module" crossorigin src="/assets/index-B4HSkaso.js"></script>
48
48
  </head>
49
49
  <body>
50
50
  <mem-bucket-app></mem-bucket-app>
@@ -629,9 +629,11 @@ export class MemoryRepository {
629
629
  const existing = await this.get(folder, filename);
630
630
  if (!existing)
631
631
  throw new Error(`memory doc "${filename}" not found`);
632
- // `paused` is local-cache-only and must never reach writeMarkdownFile — split it off of
633
- // `existing` before spreading the rest into the frontmatter that gets written to disk.
634
- const { paused: existingPaused, ...existingForFile } = existing;
632
+ // `paused` is local-cache-only and `body` is written separately as the markdown body, not
633
+ // frontmatter — both must be split off of `existing` before spreading the rest into
634
+ // `merged`, or they'd ride along into the MemoryFrontmatter written to disk (duplicating the
635
+ // body inside its own frontmatter as a `body:` key).
636
+ const { paused: existingPaused, body: _existingBody, ...existingForFile } = existing;
635
637
  const merged = {
636
638
  ...existingForFile,
637
639
  ...frontmatter,
@@ -531,9 +531,11 @@ export class SkillRepository {
531
531
  const existing = await this.get(name, folder);
532
532
  if (!existing)
533
533
  throw new Error(`skill with name "${name}" not found`);
534
- // `paused` is local-cache-only and must never reach writeMarkdownFile — split it off of
535
- // `existing` before spreading the rest into the frontmatter that gets written to disk.
536
- const { paused: existingPaused, ...existingForFile } = existing;
534
+ // `paused` is local-cache-only and `body` is written separately as the markdown body, not
535
+ // frontmatter — both must be split off of `existing` before spreading the rest into
536
+ // `merged`, or they'd ride along into the SkillFrontmatter written to disk (duplicating the
537
+ // body inside its own frontmatter as a `body:` key).
538
+ const { paused: existingPaused, body: _existingBody, ...existingForFile } = existing;
537
539
  // Builtin skills (e.g. memory-bucket-authoring) are the server's own always-present
538
540
  // documentation, not user content — deprecating them would hide guidance every session needs.
539
541
  const deprecated = this.isBuiltin(existing) ? existing.deprecated : frontmatter?.deprecated;
@@ -585,7 +587,9 @@ export class SkillRepository {
585
587
  const newFilePath = path.join(newDir, 'SKILL.md');
586
588
  // Rename changes the skill's id, so it becomes a fresh cache row — paused (local-only,
587
589
  // keyed by id) does not carry over, same as it wouldn't survive deleting the cache file.
588
- const { paused: _existingPaused, ...existingForFile } = existing;
590
+ // `body` is split off too, for the same reason as in update() — it must not ride along into
591
+ // the SkillFrontmatter written to disk.
592
+ const { paused: _existingPaused, body: _existingBody, ...existingForFile } = existing;
589
593
  const merged = { ...existingForFile, name: newName };
590
594
  const fileContents = formatMarkdownFile(stripSourcePath(merged), existing.body);
591
595
  const remote = this.remoteFor(existing.folder);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-memory-bucket",
3
- "version": "0.12.2",
3
+ "version": "0.12.4",
4
4
  "type": "module",
5
5
  "description": "MCP server exposing skill_* (reusable coding patterns) and memory_* (point-in-time working context) tools over a markdown+frontmatter source, cached into SQLite at runtime.",
6
6
  "repository": {