mcp-memory-bucket 0.10.11 → 0.10.13

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.
@@ -0,0 +1,2511 @@
1
+ (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const n of i)if(n.type==="childList")for(const o of n.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const n={};return i.integrity&&(n.integrity=i.integrity),i.referrerPolicy&&(n.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?n.credentials="include":i.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function s(i){if(i.ep)return;i.ep=!0;const n=t(i);fetch(i.href,n)}})();const es="modulepreload",ts=function(r){return"/"+r},Ue={},re=function(e,t,s){let i=Promise.resolve();if(t&&t.length>0){let o=function(d){return Promise.all(d.map(u=>Promise.resolve(u).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),c=a?.nonce||a?.getAttribute("nonce");i=o(t.map(d=>{if(d=ts(d),d in Ue)return;Ue[d]=!0;const u=d.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${h}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":es,u||(f.as="script"),f.crossOrigin="",f.href=d,c&&f.setAttribute("nonce",c),document.head.appendChild(f),u)return new Promise((x,m)=>{f.addEventListener("load",x),f.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${d}`)))})}))}function n(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&n(a.reason);return e().catch(n)})};/**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */const se=globalThis,we=se.ShadowRoot&&(se.ShadyCSS===void 0||se.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,_e=Symbol(),je=new WeakMap;let Tt=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==_e)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(we&&e===void 0){const s=t!==void 0&&t.length===1;s&&(e=je.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&je.set(t,e))}return e}toString(){return this.cssText}};const ss=r=>new Tt(typeof r=="string"?r:r+"",void 0,_e),S=(r,...e)=>{const t=r.length===1?r[0]:e.reduce((s,i,n)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[n+1],r[0]);return new Tt(t,r,_e)},is=(r,e)=>{if(we)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const s=document.createElement("style"),i=se.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=t.cssText,r.appendChild(s)}},qe=we?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return ss(t)})(r):r;/**
6
+ * @license
7
+ * Copyright 2017 Google LLC
8
+ * SPDX-License-Identifier: BSD-3-Clause
9
+ */const{is:rs,defineProperty:ns,getOwnPropertyDescriptor:os,getOwnPropertyNames:as,getOwnPropertySymbols:ls,getPrototypeOf:cs}=Object,ce=globalThis,Be=ce.trustedTypes,ds=Be?Be.emptyScript:"",hs=ce.reactiveElementPolyfillSupport,G=(r,e)=>r,me={toAttribute(r,e){switch(e){case Boolean:r=r?ds:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},At=(r,e)=>!rs(r,e),He={attribute:!0,type:String,converter:me,reflect:!1,useDefault:!1,hasChanged:At};Symbol.metadata??=Symbol("metadata"),ce.litPropertyMetadata??=new WeakMap;let U=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=He){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(e,s,t);i!==void 0&&ns(this.prototype,e,i)}}static getPropertyDescriptor(e,t,s){const{get:i,set:n}=os(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:i,set(o){const a=i?.call(this);n?.call(this,o),this.requestUpdate(e,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??He}static _$Ei(){if(this.hasOwnProperty(G("elementProperties")))return;const e=cs(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(G("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(G("properties"))){const t=this.properties,s=[...as(t),...ls(t)];for(const i of s)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[s,i]of t)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const i of s)t.unshift(qe(i))}else e!==void 0&&t.push(qe(e));return t}static _$Eu(e,t){const s=t.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const s of t.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return is(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){const s=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,s);if(i!==void 0&&s.reflect===!0){const n=(s.converter?.toAttribute!==void 0?s.converter:me).toAttribute(t,s.type);this._$Em=e,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(e,t){const s=this.constructor,i=s._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const n=s.getPropertyOptions(i),o=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:me;this._$Em=i;const a=o.fromAttribute(t,n.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,s,i=!1,n){if(e!==void 0){const o=this.constructor;if(i===!1&&(n=this[e]),s??=o.getPropertyOptions(e),!((s.hasChanged??At)(n,t)||s.useDefault&&s.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,s))))return;this.C(e,t,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:s,reflect:i,wrapped:n},o){s&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),n!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,n]of this._$Ep)this[i]=n;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,n]of s){const{wrapped:o}=n,a=this[i];o!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,n,a)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(t)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};U.elementStyles=[],U.shadowRootOptions={mode:"open"},U[G("elementProperties")]=new Map,U[G("finalized")]=new Map,hs?.({ReactiveElement:U}),(ce.reactiveElementVersions??=[]).push("2.1.2");/**
10
+ * @license
11
+ * Copyright 2017 Google LLC
12
+ * SPDX-License-Identifier: BSD-3-Clause
13
+ */const Se=globalThis,Ke=r=>r,ne=Se.trustedTypes,Ve=ne?ne.createPolicy("lit-html",{createHTML:r=>r}):void 0,Et="$lit$",R=`lit$${Math.random().toFixed(9).slice(2)}$`,Rt="?"+R,ps=`<${Rt}>`,F=document,J=()=>F.createComment(""),Q=r=>r===null||typeof r!="object"&&typeof r!="function",Ce=Array.isArray,us=r=>Ce(r)||typeof r?.[Symbol.iterator]=="function",ue=`[
14
+ \f\r]`,V=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,We=/-->/g,Ze=/>/g,P=RegExp(`>|${ue}(?:([^\\s"'>=/]+)(${ue}*=${ue}*(?:[^
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Ge=/'/g,Je=/"/g,Pt=/^(?:script|style|textarea|title)$/i,fs=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),l=fs(1),O=Symbol.for("lit-noChange"),b=Symbol.for("lit-nothing"),Qe=new WeakMap,I=F.createTreeWalker(F,129);function zt(r,e){if(!Ce(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ve!==void 0?Ve.createHTML(e):e}const gs=(r,e)=>{const t=r.length-1,s=[];let i,n=e===2?"<svg>":e===3?"<math>":"",o=V;for(let a=0;a<t;a++){const c=r[a];let d,u,h=-1,f=0;for(;f<c.length&&(o.lastIndex=f,u=o.exec(c),u!==null);)f=o.lastIndex,o===V?u[1]==="!--"?o=We:u[1]!==void 0?o=Ze:u[2]!==void 0?(Pt.test(u[2])&&(i=RegExp("</"+u[2],"g")),o=P):u[3]!==void 0&&(o=P):o===P?u[0]===">"?(o=i??V,h=-1):u[1]===void 0?h=-2:(h=o.lastIndex-u[2].length,d=u[1],o=u[3]===void 0?P:u[3]==='"'?Je:Ge):o===Je||o===Ge?o=P:o===We||o===Ze?o=V:(o=P,i=void 0);const x=o===P&&r[a+1].startsWith("/>")?" ":"";n+=o===V?c+ps:h>=0?(s.push(d),c.slice(0,h)+Et+c.slice(h)+R+x):c+R+(h===-2?a:x)}return[zt(r,n+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};let ve=class It{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let n=0,o=0;const a=e.length-1,c=this.parts,[d,u]=gs(e,t);if(this.el=It.createElement(d,s),I.currentNode=this.el.content,t===2||t===3){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=I.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const h of i.getAttributeNames())if(h.endsWith(Et)){const f=u[o++],x=i.getAttribute(h).split(R),m=/([.?@])?(.*)/.exec(f);c.push({type:1,index:n,name:m[2],strings:x,ctor:m[1]==="."?ms:m[1]==="?"?vs:m[1]==="@"?xs:de}),i.removeAttribute(h)}else h.startsWith(R)&&(c.push({type:6,index:n}),i.removeAttribute(h));if(Pt.test(i.tagName)){const h=i.textContent.split(R),f=h.length-1;if(f>0){i.textContent=ne?ne.emptyScript:"";for(let x=0;x<f;x++)i.append(h[x],J()),I.nextNode(),c.push({type:2,index:++n});i.append(h[f],J())}}}else if(i.nodeType===8)if(i.data===Rt)c.push({type:2,index:n});else{let h=-1;for(;(h=i.data.indexOf(R,h+1))!==-1;)c.push({type:7,index:n}),h+=R.length-1}n++}}static createElement(e,t){const s=F.createElement("template");return s.innerHTML=e,s}};function q(r,e,t=r,s){if(e===O)return e;let i=s!==void 0?t._$Co?.[s]:t._$Cl;const n=Q(e)?void 0:e._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),n===void 0?i=void 0:(i=new n(r),i._$AT(r,t,s)),s!==void 0?(t._$Co??=[])[s]=i:t._$Cl=i),i!==void 0&&(e=q(r,i._$AS(r,e.values),i,s)),e}let bs=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??F).importNode(t,!0);I.currentNode=i;let n=I.nextNode(),o=0,a=0,c=s[0];for(;c!==void 0;){if(o===c.index){let d;c.type===2?d=new Te(n,n.nextSibling,this,e):c.type===1?d=new c.ctor(n,c.name,c.strings,this,e):c.type===6&&(d=new ys(n,this,e)),this._$AV.push(d),c=s[++a]}o!==c?.index&&(n=I.nextNode(),o++)}return I.currentNode=F,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++}},Te=class Lt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,i){this.type=2,this._$AH=b,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=q(this,e,t),Q(e)?e===b||e==null||e===""?(this._$AH!==b&&this._$AR(),this._$AH=b):e!==this._$AH&&e!==O&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):us(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!==b&&Q(this._$AH)?this._$AA.nextSibling.data=e:this.T(F.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=ve.createElement(zt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const n=new bs(i,this),o=n.u(this.options);n.p(t),this.T(o),this._$AH=n}}_$AC(e){let t=Qe.get(e.strings);return t===void 0&&Qe.set(e.strings,t=new ve(e)),t}k(e){Ce(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,i=0;for(const n of e)i===t.length?t.push(s=new Lt(this.O(J()),this.O(J()),this,this.options)):s=t[i],s._$AI(n),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=Ke(e).nextSibling;Ke(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},de=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,i,n){this.type=1,this._$AH=b,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=b}_$AI(e,t=this,s,i){const n=this.strings;let o=!1;if(n===void 0)e=q(this,e,t,0),o=!Q(e)||e!==this._$AH&&e!==O,o&&(this._$AH=e);else{const a=e;let c,d;for(e=n[0],c=0;c<n.length-1;c++)d=q(this,a[s+c],t,c),d===O&&(d=this._$AH[c]),o||=!Q(d)||d!==this._$AH[c],d===b?e=b:e!==b&&(e+=(d??"")+n[c+1]),this._$AH[c]=d}o&&!i&&this.j(e)}j(e){e===b?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},ms=class extends de{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===b?void 0:e}},vs=class extends de{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==b)}},xs=class extends de{constructor(e,t,s,i,n){super(e,t,s,i,n),this.type=5}_$AI(e,t=this){if((e=q(this,e,t,0)??b)===O)return;const s=this._$AH,i=e===b&&s!==b||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==b&&(s===b||i);i&&this.element.removeEventListener(this.name,this,s),n&&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)}},ys=class{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){q(this,e)}};const ks=Se.litHtmlPolyfillSupport;ks?.(ve,Te),(Se.litHtmlVersions??=[]).push("3.3.3");const $s=(r,e,t)=>{const s=t?.renderBefore??e;let i=s._$litPart$;if(i===void 0){const n=t?.renderBefore??null;s._$litPart$=i=new Te(e.insertBefore(J(),n),n,void 0,t??{})}return i._$AI(r),i};/**
16
+ * @license
17
+ * Copyright 2017 Google LLC
18
+ * SPDX-License-Identifier: BSD-3-Clause
19
+ */const Ae=globalThis;let k=class extends U{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=$s(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return O}};k._$litElement$=!0,k.finalized=!0,Ae.litElementHydrateSupport?.({LitElement:k});const ws=Ae.litElementPolyfillSupport;ws?.({LitElement:k});(Ae.litElementVersions??=[]).push("4.2.2");var Ft;let fe=0;const Ye=new Set;function _s(r){fe++;try{r()}finally{fe--,fe===0&&Ss()}}function Ss(){const r=new Set(Ye);Ye.clear();for(const e of r)e()}function Cs(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function Ts(r){return r&&typeof r.deref=="function"}class Ee{static#e=0;#t;#s;#n=new Set;#r=Ft.#e++;name;constructor(e,t){this.#t=e,this.#s=e,this.name=t}_get(){return p.activeConsumer&&p.activeConsumer.track(this),this.#t}_set(e){return Cs(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(Ts(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}`}}Ft=Ee;class p extends Ee{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){_s(()=>{this._set(e)})}get value(){return this.get()}set value(e){this.set(e)}update(e){this.set(e(this.get()))}}class Xe extends Ee{#e;#t=!0;#s=!1;#n=new Map;_debugParent;#r;#p=()=>{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.#p,this.#r);this.#n.set(e,t)}dispose(){this.#l()}#l(){for(const e of this.#n.values())e();this.#n.clear()}get(){if(p.activeConsumer&&p.activeConsumer.track(this),!this.#t)return this._get();if(this.#s)throw new Error(`Cycle detected in ${this}
20
+ ↳ while computing ${this._debugParent??"root"}`);this.#s=!0,this.#l(),p.push(this);try{const e=this.#e();this._set(e)}finally{p.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 p.activeConsumer||this.get(),s}}class Y{#e;#t=new Map;_debugParent;constructor(e){this.#e=e,e.addController(this);const t=e,s=t.update,i=this;t.update=function(n){p.push(i);try{s.call(this,n)}finally{p.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 As=new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"});function Es(r){if(!r)return"unknown age";const e=new Date(r);return Number.isNaN(e.getTime())?"unknown age":As.format(e)}function Rs(r){const e=[],t=new Map,s=[];for(const n of r){if(n._table!=="memory_docs"||!n.key){s.push(n);continue}t.has(n.key)||(t.set(n.key,[]),e.push(n.key)),t.get(n.key).push(n)}const i=e.map(n=>({key:n,items:t.get(n)}));return s.length>0&&i.push({key:null,items:s}),i}class Ps extends k{static{this.properties={results:{attribute:!1},showFolder:{attribute:!1},onSelect:{attribute:!1},selectedIds:{attribute:!1},onToggleSelect:{attribute:!1},onKeyClick:{attribute:!1}}}static{this.styles=S`
21
+ :host { display: block; }
22
+ .count-header {
23
+ padding: 8px 14px;
24
+ font-size: 11px;
25
+ font-weight: 600;
26
+ text-transform: uppercase;
27
+ opacity: 0.6;
28
+ background: var(--bg);
29
+ border-bottom: 1px solid var(--border);
30
+ }
31
+ .key-group-header {
32
+ padding: 6px 14px;
33
+ font-size: 11px;
34
+ font-weight: 700;
35
+ opacity: 0.7;
36
+ background: var(--bg-subtle);
37
+ border-bottom: 1px solid var(--border);
38
+ display: flex;
39
+ align-items: center;
40
+ gap: 6px;
41
+ }
42
+ .key-group-count { opacity: 0.6; font-weight: 400; }
43
+ .key-group-link {
44
+ background: none; border: none; padding: 0; margin: 0; font: inherit; font-weight: 700;
45
+ color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
46
+ }
47
+ .key-group-link:hover { opacity: 0.8; }
48
+ .row { padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; gap: 8px; }
49
+ .row:hover { background: var(--hover); }
50
+ .row.deprecated { opacity: 0.55; }
51
+ .row.paused { opacity: 0.6; }
52
+ .row-checkbox { flex: 0 0 auto; margin-top: 2px; cursor: pointer; }
53
+ .row-body { flex: 1 1 auto; min-width: 0; }
54
+ .top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
55
+ .name { font-weight: 600; }
56
+ .deprecated .name { text-decoration: line-through; }
57
+ .meta { opacity: 0.65; font-size: 11px; white-space: nowrap; }
58
+ .folder-path { font-size: 10.5px; opacity: 0.55; margin-top: 1px; }
59
+ .key-line { font-size: 10.5px; opacity: 0.6; margin-top: 1px; }
60
+ .desc { font-size: 12px; opacity: 0.8; margin-top: 3px; }
61
+ .tags { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
62
+ .tag { font-size: 10px; border: 1px solid var(--border-strong); border-radius: 999px; padding: 1px 6px; }
63
+ .type-badge {
64
+ font-size: 10px; text-transform: uppercase; font-weight: 700; flex: 0 0 auto;
65
+ border-radius: 4px; padding: 1px 5px; display: inline-flex; align-items: center; gap: 3px;
66
+ }
67
+ .type-badge.skill {
68
+ border: 1px solid var(--purple); color: var(--purple-fg); background: var(--purple-tint);
69
+ }
70
+ .type-badge.memory {
71
+ border: 1px solid var(--accent); color: var(--accent); background: var(--accent-tint);
72
+ }
73
+ .deprecated-badge {
74
+ font-size: 10px; text-transform: uppercase; border: 1px solid var(--danger);
75
+ color: var(--danger); background: color-mix(in srgb, var(--danger) 13%, transparent); border-radius: 4px; padding: 0 4px;
76
+ }
77
+ .paused-badge {
78
+ font-size: 10px; text-transform: uppercase; border: 1px solid var(--accent);
79
+ color: var(--accent); background: var(--accent-tint); border-radius: 4px; padding: 0 4px;
80
+ }
81
+ .empty { padding: 24px; opacity: 0.6; font-size: 13px; }
82
+ `}render(){return!this.results||this.results.length===0?l`<div class="empty">No results.</div>`:l`
83
+ <div class="count-header">${this.results.length} result${this.results.length===1?"":"s"}</div>
84
+ ${Rs(this.results).map(e=>l`
85
+ ${e.key?l`<div class="key-group-header">
86
+ 🔑
87
+ <button
88
+ class="key-group-link"
89
+ title="Search for this key"
90
+ @click=${()=>this.onKeyClick?.(e.key)}
91
+ >
92
+ ${e.key}
93
+ </button>
94
+ <span class="key-group-count">(${e.items.length})</span>
95
+ </div>`:""}
96
+ ${e.items.map(t=>this.#e(t))}
97
+ `)}
98
+ `}#e(e){const t=e._table==="skills"&&e.folder==="builtin";return l`
99
+ <div class="row ${e.deprecated?"deprecated":""} ${e.paused?"paused":""}" @click=${()=>this.onSelect(e)}>
100
+ <input
101
+ type="checkbox"
102
+ class="row-checkbox"
103
+ .checked=${this.selectedIds?.has(e.id)??!1}
104
+ .disabled=${t}
105
+ title=${t?"Builtin skills can't be bulk-deprecated, paused, or deleted":""}
106
+ @click=${s=>{s.stopPropagation(),t||this.onToggleSelect(e)}}
107
+ />
108
+ <div class="row-body">
109
+ <div class="top">
110
+ <span class="name">
111
+ <span class="type-badge ${e._table==="skills"?"skill":"memory"}"
112
+ >${e._table==="skills"?"⚡ skill":"📝 memory"}</span
113
+ >
114
+ ${e.name}
115
+ </span>
116
+ <span class="meta">${Es(e.created_at)} · ${e.owner??"—"} · ${e.status}</span>
117
+ </div>
118
+ ${e._table==="memory_docs"&&e.key?l`<div class="key-line">🔑 ${e.key}</div>`:""}
119
+ ${this.showFolder&&e.folder?l`<div class="folder-path">📁 ${e.folder}</div>`:""}
120
+ <div class="desc">${e.description}</div>
121
+ <div class="tags">
122
+ ${e.deprecated?l`<span class="deprecated-badge">deprecated</span>`:""}
123
+ ${e.paused?l`<span class="paused-badge">paused</span>`:""}
124
+ ${e.tags.map(s=>l`<span class="tag">${s}</span>`)}
125
+ </div>
126
+ </div>
127
+ </div>
128
+ `}}customElements.define("result-list",Ps);function Re(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var N=Re();function Ot(r){N=r}var z={exec:()=>null};function M(r){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),i=e[s];return i||(i=r(s),e[s]=i),i}}function g(r,e=""){let t=typeof r=="string"?r:r.source,s={replace:(i,n)=>{let o=typeof n=="string"?n:n.source;return o=o.replace(y.caret,"$1"),t=t.replace(i,o),s},getRegex:()=>new RegExp(t,e)};return s}var zs=((r="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+r)}catch{return!1}})(),y={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:M(r=>new RegExp(`^ {0,${r}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:M(r=>new RegExp(`^ {0,${r}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:M(r=>new RegExp(`^ {0,${r}}(?:\`\`\`|~~~)`)),headingBeginRegex:M(r=>new RegExp(`^ {0,${r}}#`)),htmlBeginRegex:M(r=>new RegExp(`^ {0,${r}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:M(r=>new RegExp(`^ {0,${r}}>`))},Is=/^(?:[ \t]*(?:\n|$))+/,Ls=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Fs=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,X=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Os=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Pe=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Dt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Nt=g(Dt).replace(/bull/g,Pe).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(),Ds=g(Dt).replace(/bull/g,Pe).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(),ze=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Ns=/^[^\n]+/,Ie=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ms=g(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ie).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Us=g(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Pe).getRegex(),he="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",Le=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,js=g("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Le).replace("tag",he).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Mt=r=>g(ze).replace("hr",X).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",r).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",he).getRegex(),qs=Mt(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Bs=Mt(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Hs=g(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Bs).getRegex(),Fe={blockquote:Hs,code:Ls,def:Ms,fences:Fs,heading:Os,hr:X,html:js,lheading:Nt,list:Us,newline:Is,paragraph:qs,table:z,text:Ns},et=g("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",X).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",he).getRegex(),Ks={...Fe,lheading:Ds,table:et,paragraph:g(ze).replace("hr",X).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",et).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",he).getRegex()},Vs={...Fe,html:g(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Le).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:z,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:g(ze).replace("hr",X).replace("heading",` *#{1,6} *[^
129
+ ]`).replace("lheading",Nt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ws=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Zs=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ut=/^( {2,}|\\)\n(?!\s*$)/,Gs=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,A=/[\p{P}\p{S}]/u,B=/[\s\p{P}\p{S}]/u,ee=/[^\s\p{P}\p{S}]/u,Js=g(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,B).getRegex(),Qs=/[\p{Pi}\p{Ps}"']/u,jt=/(?!~)[\p{P}\p{S}]/u,Ys=/(?!~)[\s\p{P}\p{S}]/u,Xs=/(?:[^\s\p{P}\p{S}]|~)/u,ei=g(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",zs?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),qt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ti=g(qt,"u").replace(/punct/g,A).getRegex(),si=g(qt,"u").replace(/punct/g,jt).getRegex(),ii=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,ri=g(ii,"u").replace(/openQuote/g,Qs).replace(/punct/g,A).getRegex(),Bt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ni=g(Bt,"gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,B).replace(/punct/g,A).getRegex(),oi=g(Bt,"gu").replace(/notPunctSpace/g,Xs).replace(/punctSpace/g,Ys).replace(/punct/g,jt).getRegex(),ai="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",li=g(ai,"gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,B).replace(/punct/g,A).getRegex(),ci=g("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,B).replace(/punct/g,A).getRegex(),di="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",hi=g(di,"gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,B).replace(/punct/g,A).getRegex(),pi=g(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,A).getRegex(),ui="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",fi=g(ui,"gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,B).replace(/punct/g,A).getRegex(),gi=g(/\\(punct)/,"gu").replace(/punct/g,A).getRegex(),bi=g(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),mi=g(Le).replace("(?:-->|$)","-->").getRegex(),vi=g("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",mi).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),oe=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,xi=g(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",oe).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ht=g(/^!?\[(label)\]\[(ref)\]/).replace("label",oe).replace("ref",Ie).getRegex(),Kt=g(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ie).getRegex(),yi=g("reflink|nolink(?!\\()","g").replace("reflink",Ht).replace("nolink",Kt).getRegex(),tt=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Oe={_backpedal:z,anyPunctuation:gi,autolink:bi,blockSkip:ei,br:Ut,code:Zs,del:z,delLDelim:z,delRDelim:z,emStrongLDelim:ti,emStrongRDelimAst:ni,emStrongRDelimUnd:ci,escape:Ws,link:xi,nolink:Kt,punctuation:Js,reflink:Ht,reflinkSearch:yi,tag:vi,text:Gs,url:z},ki={...Oe,emStrongLDelim:ri,emStrongRDelimAst:li,emStrongRDelimUnd:hi,link:g(/^!?\[(label)\]\((.*?)\)/).replace("label",oe).getRegex(),reflink:g(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",oe).getRegex()},xe={...Oe,emStrongRDelimAst:oi,emStrongLDelim:si,delLDelim:pi,delRDelim:fi,url:g(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",tt).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:g(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",tt).getRegex()},$i={...xe,br:g(Ut).replace("{2,}","*").getRegex(),text:g(xe.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},te={normal:Fe,gfm:Ks,pedantic:Vs},W={normal:Oe,gfm:xe,breaks:$i,pedantic:ki},wi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},st=r=>wi[r];function T(r,e){if(e){if(y.escapeTest.test(r))return r.replace(y.escapeReplace,st)}else if(y.escapeTestNoEncode.test(r))return r.replace(y.escapeReplaceNoEncode,st);return r}function it(r){try{r=encodeURI(r).replace(y.percentDecode,"%")}catch{return null}return r}function rt(r,e){let t=r.replace(y.findPipe,(n,o,a)=>{let c=!1,d=o;for(;--d>=0&&a[d]==="\\";)c=!c;return c?"|":" |"}),s=t.split(y.splitPipe),i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(y.slashPipe,"|");return s}function E(r,e,t){let s=r.length;if(s===0)return"";let i=0;for(;i<s&&r.charAt(s-i-1)===e;)i++;return r.slice(0,s-i)}function nt(r){let e=r.split(`
130
+ `),t=e.length-1;for(;t>=0&&y.blankLine.test(e[t]);)t--;return e.length-t<=2?r:e.slice(0,t+1).join(`
131
+ `)}function _i(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<r.length;s++)if(r[s]==="\\")s++;else if(r[s]===e[0])t++;else if(r[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function Si(r,e=0){let t=e,s="";for(let i of r)if(i===" "){let n=4-t%4;s+=" ".repeat(n),t+=n}else s+=i,t++;return s}function ot(r,e,t,s,i){let n=e.href,o=e.title||null,a=r[1].replace(i.other.outputLinkReplace,"$1"),c=r[0].charAt(0)==="!";s.state.inLink=!0;let d=s.state.linkEmitted,u=s.state.inRawBlock;s.state.linkEmitted=!1;let h=s.inlineTokens(a),f=s.state.linkEmitted;if(s.state.linkEmitted=d,s.state.inLink=!1,!c){if(f){s.state.inRawBlock=u;return}s.state.linkEmitted=!0}return{type:c?"image":"link",raw:t,href:n,title:o,text:a,tokens:h}}function Ci(r,e,t){let s=r.match(t.other.indentCodeCompensation);if(s===null)return e;let i=s[1];return e.split(`
132
+ `).map(n=>{let o=n.match(t.other.beginningSpace);if(o===null)return n;let[a]=o;return a.length>=i.length?n.slice(i.length):n}).join(`
133
+ `)}var ae=class{options;rules;lexer;constructor(r){this.options=r||N}space(r){let e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){let e=this.rules.block.code.exec(r);if(e){let t=this.options.pedantic?e[0]:nt(e[0]),s=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:s}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let t=e[0],s=Ci(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(r){let e=this.rules.block.heading.exec(r);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=E(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:E(e[0],`
134
+ `),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(r){let e=this.rules.block.hr.exec(r);if(e)return{type:"hr",raw:E(e[0],`
135
+ `)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=E(e[0],`
136
+ `).split(`
137
+ `),s="",i="",n=[];for(;t.length>0;){let o=!1,a=[],c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))a.push(t[c]),o=!0;else if(!o)a.push(t[c]);else break;t=t.slice(c);let d=a.join(`
138
+ `),u=d.replace(this.rules.other.blockquoteSetextReplace,`
139
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
140
+ ${d}`:d,i=i?`${i}
141
+ ${u}`:u;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,n,!0),this.lexer.state.top=h,t.length===0)break;let f=n.at(-1);if(f?.type==="code")break;if(f?.type==="blockquote"){let x=f,m=t.join(`
142
+ `),C=x.raw+`
143
+ `+m.replace(this.rules.other.blockquoteSetextReplace2,""),H=this.blockquote(C);n[n.length-1]=H,s=`${s}
144
+ ${m}`,i=i.substring(0,i.length-x.text.length)+H.text;break}else if(f?.type==="list"){let x=f,m=x.raw+`
145
+ `+t.join(`
146
+ `),C=this.list(m);n[n.length-1]=C,s=s.substring(0,s.length-f.raw.length)+C.raw,i=i.substring(0,i.length-x.raw.length)+C.raw,t=m.substring(n.at(-1).raw.length).split(`
147
+ `);continue}}return{type:"blockquote",raw:s,tokens:n,text:i}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=e[1].trim(),s=t.length>1,i={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let n=this.rules.other.listItemRegex(t),o=!1;for(;r;){let c=!1,d="",u="";if(!(e=n.exec(r))||this.rules.block.hr.test(r))break;d=e[0],r=r.substring(d.length);let h=Si(e[2].split(`
148
+ `,1)[0],e[1].length),f=r.split(`
149
+ `,1)[0],x=!h.trim(),m=0;if(this.options.pedantic?(m=2,u=h.trimStart()):x?m=e[1].length+1:(m=h.search(this.rules.other.nonSpaceChar),m=m>4?1:m,u=h.slice(m),m+=e[1].length),x&&this.rules.other.blankLine.test(f)&&(d+=f+`
150
+ `,r=r.substring(f.length+1),c=!0),!c){let C=this.rules.other.nextBulletRegex(m),H=this.rules.other.hrRegex(m),Ne=this.rules.other.fencesBeginRegex(m),Me=this.rules.other.headingBeginRegex(m),Yt=this.rules.other.htmlBeginRegex(m),Xt=this.rules.other.blockquoteBeginRegex(m);for(;r;){let pe=r.split(`
151
+ `,1)[0],K;if(f=pe,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),K=f):K=f.replace(this.rules.other.tabCharGlobal," "),Ne.test(f)||Me.test(f)||Yt.test(f)||Xt.test(f)||C.test(f)||H.test(f))break;if(K.search(this.rules.other.nonSpaceChar)>=m||!f.trim())u+=`
152
+ `+K.slice(m);else{if(x||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||Ne.test(h)||Me.test(h)||H.test(h))break;u+=`
153
+ `+f}x=!f.trim(),d+=pe+`
154
+ `,r=r.substring(pe.length+1),h=K.slice(m)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(o=!0)),i.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),i.raw+=d}let a=i.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let c of i.items)if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),!i.loose){let d=c.tokens.filter(h=>h.type==="space"),u=d.length>0&&d.some(h=>this.rules.other.anyLine.test(h.raw));i.loose=u}for(let c of i.items){let d=c.tokens[0];if(c.task&&(d?.type==="text"||d?.type==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),d.raw=d.raw.replace(this.rules.other.listReplaceTask,""),d.text=d.text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}let u=this.rules.other.listTaskCheckbox.exec(c.raw);if(u){let h={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};c.checked=h.checked,i.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=h.raw+c.tokens[0].raw,c.tokens[0].text=h.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(h)):c.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):c.tokens.unshift(h)}}else c.task&&(c.task=!1)}if(i.loose)for(let c of i.items){c.loose=!0;for(let d of c.tokens)d.type==="text"&&(d.type="paragraph")}return i}}html(r){let e=this.rules.block.html.exec(r);if(e){let t=nt(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(r){let e=this.rules.block.def.exec(r);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:E(e[0],`
155
+ `),href:s,title:i}}}table(r){let e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=rt(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
156
+ `):[],n={type:"table",raw:E(e[0],`
157
+ `),header:[],align:[],rows:[]};if(t.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?n.align.push("right"):this.rules.other.tableAlignCenter.test(o)?n.align.push("center"):this.rules.other.tableAlignLeft.test(o)?n.align.push("left"):n.align.push(null);for(let o=0;o<t.length;o++)n.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:n.align[o]});for(let o of i)n.rows.push(rt(o,n.header.length).map((a,c)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:n.align[c]})));return n}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e){let t=e[1].trim();return{type:"heading",raw:E(e[0],`
158
+ `),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(r){let e=this.rules.block.paragraph.exec(r);if(e){let t=e[1].charAt(e[1].length-1)===`
159
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);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(r){let e=this.rules.inline.link.exec(r);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 n=E(t.slice(0,-1),"\\");if((t.length-n.length)%2===0)return}else{let n=_i(e[2],"()");if(n===-2)return;if(n>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+n;e[2]=e[2].substring(0,n),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let s=e[2],i="";if(this.options.pedantic){let n=this.rules.other.pedanticHrefTitle.exec(s);n&&(s=n[1],i=n[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)),ot(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(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[s.toLowerCase()];if(!i){let n=t[0].charAt(0);return{type:"text",raw:n,text:n}}return ot(t,i,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(r);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,n,o,a=i,c=0,d=s[0][0],u=t===d,h=d==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*r.length+i);(s=h.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n)continue;if(o=[...n].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 f=[...s[0]][0].length,x=r.slice(0,i+s.index+f+o);if(Math.min(i,o)%2){let C=x.slice(1,-1);return{type:"em",raw:x,text:C,tokens:this.lexer.inlineTokens(C)}}let m=x.slice(2,-2);return{type:"strong",raw:x,text:m,tokens:this.lexer.inlineTokens(m)}}}}codespan(r){let e=this.rules.inline.code.exec(r);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(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r,e,t=""){let s=this.rules.inline.delLDelim.exec(r);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,n,o,a=i,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*r.length+i);(s=c.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n||(o=[...n].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=r.slice(0,i+s.index+d+o),h=u.slice(i,-i);return{type:"del",raw:u,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(r){let e=this.rules.inline.autolink.exec(r);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(r){let e;if(e=this.rules.inline.url.exec(r)){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(r){let e=this.rules.inline.text.exec(r);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},w=class ye{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||N,this.options.tokenizer=this.options.tokenizer||new ae,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:y,block:te.normal,inline:W.normal};this.options.pedantic?(t.block=te.pedantic,t.inline=W.pedantic):this.options.gfm&&(t.block=te.gfm,this.options.breaks?t.inline=W.breaks:t.inline=W.gfm),this.tokenizer.rules=t}static get rules(){return{block:te,inline:W}}static lex(e,t){return new ye(t).lex(e)}static lexInline(e,t){return new ye(t).inlineTokens(e)}lex(e){e=e.replace(y.carriageReturn,`
160
+ `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(y.tabCharGlobal," ").replace(y.spaceLine,""));let i=1/0;for(;e;){if(e.length<i)i=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let n;if(this.options.extensions?.block?.some(a=>(n=a.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))continue;if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length);let a=t.at(-1);n.raw.length===1&&a!==void 0?a.raw+=`
161
+ `:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
162
+ `)?"":`
163
+ `)+n.raw,a.text+=`
164
+ `+n.text,this.inlineQueue.at(-1).src=a.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
165
+ `)?"":`
166
+ `)+n.raw,a.text+=`
167
+ `+n.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title},t.push(n));continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}let o=e;if(this.options.extensions?.startBlock){let a=1/0,c=e.slice(1),d;this.options.extensions.startBlock.forEach(u=>{d=u.call({lexer:this},c),typeof d=="number"&&d>=0&&(a=Math.min(a,d))}),a<1/0&&a>=0&&(o=e.substring(0,a+1))}if(this.state.top&&(n=this.tokenizer.paragraph(o))){let a=t.at(-1);s&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
168
+ `)?"":`
169
+ `)+n.raw,a.text+=`
170
+ `+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(n),s=o.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length);let a=t.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(`
171
+ `)?"":`
172
+ `)+n.raw,a.text+=`
173
+ `+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(n);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes("["))return!1;let t=this.tokenizer.rules.inline.link;for(let s of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(s[0])&&e.charAt(s.index-1)!=="!")return!0;for(let s of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let i=s[0],n=i.lastIndexOf("[");if(!(i.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,i.slice(n+1,-1)))&&!(n>1&&this.linkInText(i.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=e;if(this.tokens.links&&e.includes("[")){let a=this.tokenizer.rules.inline.reflinkSearch,c=d=>{let u=d.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,d.slice(u+1,-1)))return d;if(u>1&&d.charAt(0)!=="!"){let h=d.slice(1,u-1);if(this.linkInText(h))return"["+h.replace(a,c)+"]["+"a".repeat(d.length-u-2)+"]"}return"["+"a".repeat(d.length-2)+"]"};s=s.replace(a,c)}s=s.replace(this.tokenizer.rules.inline.anyPunctuation,a=>"+".repeat(a.length)),s=s.replace(this.tokenizer.rules.inline.blockSkip,(a,c,d)=>{let u=d?d.length:0;return a.slice(0,u)+"["+"a".repeat(a.length-u-2)+"]"}),s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let i=!1,n="",o=1/0;for(;e;){if(e.length<o)o=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}i||(n=""),i=!1;let a;if(this.options.extensions?.inline?.some(d=>(a=d.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let d=t.at(-1);a.type==="text"&&d?.type==="text"?(d.raw+=a.raw,d.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,s,n)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e,s,n)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let c=e;if(this.options.extensions?.startInline){let d=1/0,u=e.slice(1),h;this.options.extensions.startInline.forEach(f=>{h=f.call({lexer:this},u),typeof h=="number"&&h>=0&&(d=Math.min(d,h))}),d<1/0&&d>=0&&(c=e.substring(0,d+1))}if(a=this.tokenizer.inlineText(c)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(n=a.raw.slice(-1)),i=!0;let d=t.at(-1);d?.type==="text"?(d.raw+=a.raw,d.text+=a.text):t.push(a);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},le=class{options;parser;constructor(r){this.options=r||N}space(r){return""}code({text:r,lang:e,escaped:t}){let s=(e||"").match(y.notSpaceStart)?.[0],i=r.replace(y.endingNewline,"")+`
174
+ `;return s?'<pre><code class="language-'+T(s)+'">'+(t?i:T(i,!0))+`</code></pre>
175
+ `:"<pre><code>"+(t?i:T(i,!0))+`</code></pre>
176
+ `}blockquote({tokens:r}){return`<blockquote>
177
+ ${this.parser.parse(r)}</blockquote>
178
+ `}html({text:r}){return r}def(r){return""}heading({tokens:r,depth:e}){return`<h${e}>${this.parser.parseInline(r)}</h${e}>
179
+ `}hr(r){return`<hr>
180
+ `}list(r){let e=r.ordered,t=r.start,s="";for(let o=0;o<r.items.length;o++){let a=r.items[o];s+=this.listitem(a)}let i=e?"ol":"ul",n=e&&t!==1?' start="'+t+'"':"";return"<"+i+n+`>
181
+ `+s+"</"+i+`>
182
+ `}listitem(r){return`<li>${this.parser.parse(r.tokens)}</li>
183
+ `}checkbox({checked:r}){return"<input "+(r?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:r}){return`<p>${this.parser.parseInline(r)}</p>
184
+ `}table(r){let e="",t="";for(let i=0;i<r.header.length;i++)t+=this.tablecell(r.header[i]);e+=this.tablerow({text:t});let s="";for(let i=0;i<r.rows.length;i++){let n=r.rows[i];t="";for(let o=0;o<n.length;o++)t+=this.tablecell(n[o]);s+=this.tablerow({text:t})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
185
+ <thead>
186
+ `+e+`</thead>
187
+ `+s+`</table>
188
+ `}tablerow({text:r}){return`<tr>
189
+ ${r}</tr>
190
+ `}tablecell(r){let e=this.parser.parseInline(r.tokens),t=r.header?"th":"td";return(r.align?`<${t} align="${r.align}">`:`<${t}>`)+e+`</${t}>
191
+ `}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${T(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:t}){let s=this.parser.parseInline(t),i=it(r);if(i===null)return s;r=i;let n='<a href="'+r+'"';return e&&(n+=' title="'+T(e)+'"'),n+=">"+s+"</a>",n}image({href:r,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let i=it(r);if(i===null)return T(t);r=i;let n=`<img src="${r}" alt="${T(t)}"`;return e&&(n+=` title="${T(e)}"`),n+=">",n}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:T(r.text)}},De=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}checkbox({raw:r}){return r}},_=class ke{options;renderer;textRenderer;constructor(e){this.options=e||N,this.options.renderer=this.options.renderer||new le,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new De}static parse(e,t){return new ke(t).parse(e)}static parseInline(e,t){return new ke(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let o=i,a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(o.type)){t+=a||"";continue}}let n=i;switch(n.type){case"space":{t+=this.renderer.space(n);break}case"hr":{t+=this.renderer.hr(n);break}case"heading":{t+=this.renderer.heading(n);break}case"code":{t+=this.renderer.code(n);break}case"table":{t+=this.renderer.table(n);break}case"blockquote":{t+=this.renderer.blockquote(n);break}case"list":{t+=this.renderer.list(n);break}case"checkbox":{t+=this.renderer.checkbox(n);break}case"html":{t+=this.renderer.html(n);break}case"def":{t+=this.renderer.def(n);break}case"paragraph":{t+=this.renderer.paragraph(n);break}case"text":{t+=this.renderer.text(n);break}default:{let o='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let s="";for(let i=0;i<e.length;i++){let n=e[i];if(this.options.extensions?.renderers?.[n.type]){let a=this.options.extensions.renderers[n.type].call({parser:this},n);if(a!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(n.type)){s+=a||"";continue}}let o=n;switch(o.type){case"escape":{s+=t.text(o);break}case"html":{s+=t.html(o);break}case"link":{s+=t.link(o);break}case"image":{s+=t.image(o);break}case"checkbox":{s+=t.checkbox(o);break}case"strong":{s+=t.strong(o);break}case"em":{s+=t.em(o);break}case"codespan":{s+=t.codespan(o);break}case"br":{s+=t.br(o);break}case"del":{s+=t.del(o);break}case"text":{s+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return s}},Z=class{options;block;constructor(r){this.options=r||N}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}emStrongMask(r){return r}provideLexer(r=this.block){return r?w.lex:w.lexInline}provideParser(r=this.block){return r?_.parse:_.parseInline}},Ti=class{defaults=Re();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=_;Renderer=le;TextRenderer=De;Lexer=w;Tokenizer=ae;Hooks=Z;constructor(...r){this.use(...r)}walkTokens(r,e){let t=[];for(let s of r)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let i=s;for(let n of i.header)t=t.concat(this.walkTokens(n.tokens,e));for(let n of i.rows)for(let o of n)t=t.concat(this.walkTokens(o.tokens,e));break}case"list":{let i=s;t=t.concat(this.walkTokens(i.items,e));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(n=>{let o=i[n].flat(1/0);t=t.concat(this.walkTokens(o,e))}):i.tokens&&(t=t.concat(this.walkTokens(i.tokens,e)))}}return t}use(...r){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let n=e.renderers[i.name];n?e.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=n.apply(this,o)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let n=e[i.level];n?n.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),s.extensions=e),t.renderer){let i=this.defaults.renderer||new le(this.defaults);for(let n in t.renderer){if(!(n in i))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let o=n,a=t.renderer[o],c=i[o];i[o]=(...d)=>{let u=a.apply(i,d);return u===!1&&(u=c.apply(i,d)),u||""}}s.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new ae(this.defaults);for(let n in t.tokenizer){if(!(n in i))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let o=n,a=t.tokenizer[o],c=i[o];i[o]=(...d)=>{let u=a.apply(i,d);return u===!1&&(u=c.apply(i,d)),u}}s.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new Z;for(let n in t.hooks){if(!(n in i))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let o=n,a=t.hooks[o],c=i[o];Z.passThroughHooks.has(n)?i[o]=d=>{if(this.defaults.async&&Z.passThroughHooksRespectAsync.has(n))return(async()=>{let h=await a.call(i,d);return c.call(i,h)})();let u=a.call(i,d);return c.call(i,u)}:i[o]=(...d)=>{if(this.defaults.async)return(async()=>{let h=await a.apply(i,d);return h===!1&&(h=await c.apply(i,d)),h})();let u=a.apply(i,d);return u===!1&&(u=c.apply(i,d)),u}}s.hooks=i}if(t.walkTokens){let i=this.defaults.walkTokens,n=t.walkTokens;s.walkTokens=function(o){let a=[];return a.push(n.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return w.lex(r,e??this.defaults)}parser(r,e){return _.parse(r,e??this.defaults)}parseMarkdown(r){return(e,t)=>{let s={...t},i={...this.defaults,...s},n=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return n(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return n(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return n(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=r),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,a=await(i.hooks?await i.hooks.provideLexer(r):r?w.lex:w.lexInline)(o,i),c=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let d=await(i.hooks?await i.hooks.provideParser(r):r?_.parse:_.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(d):d})().catch(n);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer(r):r?w.lex:w.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser(r):r?_.parse:_.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return n(o)}}}onError(r,e){return t=>{if(t.message+=`
192
+ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error occurred:</p><pre>"+T(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},D=new Ti;function v(r,e){return D.parse(r,e)}v.options=v.setOptions=function(r){return D.setOptions(r),v.defaults=D.defaults,Ot(v.defaults),v};v.getDefaults=Re;v.defaults=N;function Ai(...r){return D.use(...r),v.defaults=D.defaults,Ot(v.defaults),v}v.use=Ai;v.walkTokens=function(r,e){return D.walkTokens(r,e)};v.parseInline=D.parseInline;v.Parser=_;v.parser=_.parse;v.Renderer=le;v.TextRenderer=De;v.Lexer=w;v.lexer=w.lex;v.Tokenizer=ae;v.Hooks=Z;v.parse=v;v.options;v.setOptions;v.walkTokens;v.parseInline;_.parse;w.lex;/**
193
+ * @license
194
+ * Copyright 2017 Google LLC
195
+ * SPDX-License-Identifier: BSD-3-Clause
196
+ */const Ei={CHILD:2},Ri=r=>(...e)=>({_$litDirective$:r,values:e});class Pi{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,s){this._$Ct=e,this._$AM=t,this._$Ci=s}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
197
+ * @license
198
+ * Copyright 2017 Google LLC
199
+ * SPDX-License-Identifier: BSD-3-Clause
200
+ */class $e extends Pi{constructor(e){if(super(e),this.it=b,e.type!==Ei.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===b||e==null)return this._t=void 0,this.it=e;if(e===O)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}$e.directiveName="unsafeHTML",$e.resultType=1;const zi=Ri($e);let at=0;class Ii extends k{static{this.properties={tags:{attribute:!1},active:{attribute:!1},onToggle:{attribute:!1},allowCreate:{attribute:!1},width:{attribute:!1}}}#e=new p("");#t=new p(!1);#s=new p(-1);#n;#r;static{this.styles=S`
201
+ :host {
202
+ display: inline-block;
203
+ position: relative;
204
+ width: fit-content;
205
+ min-width: 200px;
206
+ max-width: 100%;
207
+ font: inherit;
208
+ font-size: 13px;
209
+ }
210
+ .field {
211
+ display: flex;
212
+ align-items: center;
213
+ gap: 4px;
214
+ border: 1px solid var(--border-strong);
215
+ border-radius: 6px;
216
+ background: none;
217
+ padding: 3px 4px 3px 8px;
218
+ min-height: 30px;
219
+ box-sizing: border-box;
220
+ }
221
+ .chips-and-input {
222
+ display: flex;
223
+ align-items: center;
224
+ flex-wrap: wrap;
225
+ gap: 4px;
226
+ flex: 1 1 auto;
227
+ min-width: 0;
228
+ }
229
+ .field:focus-within {
230
+ border-color: var(--accent);
231
+ box-shadow: 0 0 0 2px var(--accent-tint);
232
+ }
233
+ .selected-chip {
234
+ display: inline-flex;
235
+ align-items: center;
236
+ gap: 4px;
237
+ background: var(--accent);
238
+ color: var(--accent-fg);
239
+ border-radius: 999px;
240
+ padding: 2px 6px 2px 10px;
241
+ font-size: 12px;
242
+ white-space: nowrap;
243
+ }
244
+ .selected-chip .remove {
245
+ cursor: pointer;
246
+ opacity: 0.85;
247
+ line-height: 1;
248
+ padding: 2px;
249
+ border-radius: 50%;
250
+ }
251
+ .selected-chip .remove:hover { opacity: 1; background: #ffffff33; }
252
+ .input {
253
+ flex: 1 1 60px;
254
+ min-width: 60px;
255
+ border: none;
256
+ outline: none;
257
+ padding: 5px 2px;
258
+ font: inherit;
259
+ font-size: 13px;
260
+ background: transparent;
261
+ color: inherit;
262
+ }
263
+ .clear-btn, .chevron-btn {
264
+ border: none;
265
+ background: transparent;
266
+ cursor: pointer;
267
+ color: inherit;
268
+ opacity: 0.6;
269
+ font-size: 12px;
270
+ padding: 2px 5px;
271
+ line-height: 1;
272
+ }
273
+ .clear-btn:hover, .chevron-btn:hover { opacity: 1; }
274
+ .chevron-btn { transition: transform 0.15s ease; }
275
+ .chevron-btn.open { transform: rotate(180deg); }
276
+
277
+ .menu {
278
+ position: fixed;
279
+ margin: 0;
280
+ inset: auto;
281
+ top: anchor(bottom);
282
+ left: anchor(left);
283
+ width: anchor-size(width);
284
+ position-try-fallbacks: flip-block;
285
+ list-style: none;
286
+ padding: 4px;
287
+ margin: 0;
288
+ border: 1px solid var(--border);
289
+ border-radius: 8px;
290
+ background: var(--bg);
291
+ color: inherit;
292
+ box-shadow: 0 8px 24px var(--shadow);
293
+ max-height: 260px;
294
+ overflow-y: auto;
295
+ box-sizing: border-box;
296
+ }
297
+ .menu:popover-open { margin-top: 4px; }
298
+ .menu[popover] { display: none; }
299
+ .menu.visible[popover] { display: block; }
300
+
301
+ .option {
302
+ display: flex;
303
+ align-items: center;
304
+ gap: 8px;
305
+ padding: 6px 8px;
306
+ border-radius: 5px;
307
+ cursor: pointer;
308
+ font-size: 13px;
309
+ }
310
+ .option:hover, .option.highlighted { background: var(--hover); }
311
+ .option input { margin: 0; pointer-events: none; }
312
+ .empty { padding: 6px 8px; opacity: 0.6; font-style: italic; font-size: 12px; }
313
+ .create-option { color: var(--accent); font-style: italic; }
314
+ `}constructor(){super(),new Y(this),this.tags=[],this.active=[],this.onToggle=()=>{},this.allowCreate=!1,this.#n=`--tag-multiselect-${++at}`,this.#r=`tag-multiselect-listbox-${at}`}willUpdate(){this.style.width=this.width??""}#p=e=>{e.composedPath().includes(this)||this.#a()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#p)}disconnectedCallback(){document.removeEventListener("click",this.#p),super.disconnectedCallback()}get#l(){const e=this.#e.value.trim().toLowerCase();return e?this.tags.filter(t=>t.toLowerCase().includes(e)):this.tags}#i(){this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#a(){this.#t.set(!1),this.#s.set(-1),this.renderRoot.querySelector(".menu")?.hidePopover()}#g(){this.#t.value?this.#a():(this.#i(),this.renderRoot.querySelector(".input")?.focus())}#v(e){this.#e.set(e.target.value),this.#s.set(-1),this.#i()}#u(e){this.onToggle(e),this.#e.set(""),this.#s.set(-1)}get#o(){if(!this.allowCreate)return!1;const e=this.#e.value.trim();return e.length>0&&!this.tags.includes(e)&&!this.active.includes(e)}#b(e){e.stopPropagation(),this.active.forEach(t=>this.onToggle(t)),this.#e.set(""),this.renderRoot.querySelector(".input")?.focus(),this.#i()}#k(e){const t=this.#l;if(e.key==="ArrowDown")e.preventDefault(),this.#i(),t.length&&this.#s.set((this.#s.value+1)%t.length);else if(e.key==="ArrowUp")e.preventDefault(),this.#i(),t.length&&this.#s.set((this.#s.value-1+t.length)%t.length);else if(e.key==="Enter"||this.allowCreate&&e.key===","){const s=t[this.#s.value];s!==void 0?(e.preventDefault(),this.#u(s)):this.#o&&(e.preventDefault(),this.#u(this.#e.value.trim()))}else if(e.key==="Backspace"&&!this.#e.value&&this.active.length>0){const s=this.active[this.active.length-1];s!==void 0&&this.onToggle(s)}else e.key==="Escape"&&this.#a()}render(){const e=this.active,t=this.#l,s=this.#t.value,i=this.#s.value;return l`
315
+ <div class="field" style=${`anchor-name: ${this.#n}`}>
316
+ <div class="chips-and-input">
317
+ ${e.map(n=>l`
318
+ <span class="selected-chip">
319
+ ${n}
320
+ <span class="remove" @click=${()=>this.onToggle(n)}>✕</span>
321
+ </span>
322
+ `)}
323
+ <input
324
+ class="input"
325
+ role="combobox"
326
+ aria-autocomplete="list"
327
+ aria-expanded=${s}
328
+ aria-controls=${this.#r}
329
+ aria-activedescendant=${i>=0?`${this.#r}-opt-${i}`:""}
330
+ placeholder=${e.length===0?"Filter by tag…":""}
331
+ .value=${this.#e.value}
332
+ @input=${n=>this.#v(n)}
333
+ @focus=${()=>this.#i()}
334
+ @click=${()=>this.#i()}
335
+ @keydown=${n=>this.#k(n)}
336
+ />
337
+ </div>
338
+ ${e.length>0?l`<button class="clear-btn" tabindex="-1" @mousedown=${n=>n.preventDefault()} @click=${n=>this.#b(n)}>✕</button>`:""}
339
+ <button
340
+ class="chevron-btn ${s?"open":""}"
341
+ tabindex="-1"
342
+ @mousedown=${n=>n.preventDefault()}
343
+ @click=${()=>this.#g()}
344
+ >
345
+
346
+ </button>
347
+ </div>
348
+
349
+ <ul
350
+ id=${this.#r}
351
+ class="menu ${s?"visible":""}"
352
+ role="listbox"
353
+ aria-multiselectable="true"
354
+ popover="manual"
355
+ style=${`position-anchor: ${this.#n}`}
356
+ >
357
+ ${t.length?t.map((n,o)=>l`
358
+ <li
359
+ id=${`${this.#r}-opt-${o}`}
360
+ role="option"
361
+ aria-selected=${e.includes(n)}
362
+ class=${o===i?"option highlighted":"option"}
363
+ @mousedown=${a=>a.preventDefault()}
364
+ @click=${()=>this.#u(n)}
365
+ >
366
+ <input type="checkbox" .checked=${e.includes(n)} tabindex="-1" />
367
+ ${n}
368
+ </li>
369
+ `):this.#o?l`
370
+ <li
371
+ class="option create-option"
372
+ @mousedown=${n=>n.preventDefault()}
373
+ @click=${()=>this.#u(this.#e.value.trim())}
374
+ >
375
+ No match. Create '${this.#e.value.trim()}'
376
+ </li>
377
+ `:l`<li class="empty">${this.allowCreate?"Type to create a tag":"No matches"}</li>`}
378
+ </ul>
379
+ `}}customElements.define("tag-multiselect",Ii);let lt=0;class Li extends k{static{this.properties={options:{attribute:!1},value:{attribute:!1},onChange:{attribute:!1}}}#e=new p("");#t=new p(!1);#s=new p(-1);#n;#r;static{this.styles=S`
380
+ :host {
381
+ display: inline-block;
382
+ position: relative;
383
+ width: 100%;
384
+ max-width: 320px;
385
+ font: inherit;
386
+ font-size: 13px;
387
+ }
388
+ .field {
389
+ display: flex;
390
+ align-items: center;
391
+ gap: 4px;
392
+ border: 1px solid var(--border-strong);
393
+ border-radius: 6px;
394
+ background: var(--bg);
395
+ padding: 3px 4px 3px 8px;
396
+ min-height: 30px;
397
+ box-sizing: border-box;
398
+ }
399
+ .field:focus-within {
400
+ border-color: var(--accent);
401
+ box-shadow: 0 0 0 2px var(--accent-tint);
402
+ }
403
+ .input {
404
+ flex: 1 1 auto;
405
+ min-width: 0;
406
+ border: none;
407
+ outline: none;
408
+ padding: 5px 2px;
409
+ font: inherit;
410
+ font-size: 13px;
411
+ background: transparent;
412
+ color: inherit;
413
+ }
414
+ .chevron-btn {
415
+ border: none;
416
+ background: transparent;
417
+ cursor: pointer;
418
+ color: inherit;
419
+ opacity: 0.6;
420
+ font-size: 12px;
421
+ padding: 2px 5px;
422
+ line-height: 1;
423
+ flex: 0 0 auto;
424
+ }
425
+ .chevron-btn:hover { opacity: 1; }
426
+ .chevron-btn { transition: transform 0.15s ease; }
427
+ .chevron-btn.open { transform: rotate(180deg); }
428
+
429
+ .menu {
430
+ position: fixed;
431
+ margin: 0;
432
+ inset: auto;
433
+ top: anchor(bottom);
434
+ left: anchor(left);
435
+ width: anchor-size(width);
436
+ position-try-fallbacks: flip-block;
437
+ list-style: none;
438
+ padding: 4px;
439
+ margin: 0;
440
+ border: 1px solid var(--border);
441
+ border-radius: 8px;
442
+ background: var(--bg);
443
+ color: inherit;
444
+ box-shadow: 0 8px 24px var(--shadow);
445
+ max-height: 260px;
446
+ overflow-y: auto;
447
+ box-sizing: border-box;
448
+ }
449
+ .menu:popover-open { margin-top: 4px; }
450
+ .menu[popover] { display: none; }
451
+ .menu.visible[popover] { display: block; }
452
+
453
+ .option {
454
+ display: flex;
455
+ align-items: center;
456
+ gap: 8px;
457
+ padding: 6px 8px;
458
+ border-radius: 5px;
459
+ cursor: pointer;
460
+ font-size: 13px;
461
+ }
462
+ .option:hover, .option.highlighted { background: var(--hover); }
463
+ .option.selected { font-weight: 600; }
464
+ .empty { padding: 6px 8px; opacity: 0.6; font-style: italic; font-size: 12px; }
465
+ .create-option { color: var(--accent); font-style: italic; }
466
+ `}constructor(){super(),new Y(this),this.options=[],this.value="",this.onChange=()=>{},this.#n=`--status-select-${++lt}`,this.#r=`status-select-listbox-${lt}`}#p=e=>{e.composedPath().includes(this)||this.#a()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#p)}disconnectedCallback(){document.removeEventListener("click",this.#p),super.disconnectedCallback()}get#l(){const e=this.#e.value.trim().toLowerCase();return!e||e===this.value.trim().toLowerCase()?this.options:this.options.filter(t=>t.toLowerCase().includes(e))}#i(){this.#e.set(this.value),this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#a(){this.#t.set(!1),this.#s.set(-1),this.#e.set(this.value),this.renderRoot.querySelector(".menu")?.hidePopover()}#g(){this.#t.value?this.#a():(this.#i(),this.renderRoot.querySelector(".input")?.focus())}#v(e){this.#e.set(e.target.value),this.#s.set(-1),this.#t.value||this.#i()}#u(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}#o(e){const t=this.#u(e);if(!t)return this.#a();this.onChange(t),this.#e.set(t),this.#s.set(-1),this.#a()}get#b(){const e=this.#u(this.#e.value);return e.length>0&&!this.options.some(t=>t.toLowerCase()===e)}get#k(){return this.#l.length+(this.#b?1:0)}#w(e){const t=this.#k;if(e.key==="ArrowDown")e.preventDefault(),this.#i(),t&&this.#s.set((this.#s.value+1)%t);else if(e.key==="ArrowUp")e.preventDefault(),this.#i(),t&&this.#s.set((this.#s.value-1+t)%t);else if(e.key==="Enter"){e.preventDefault();const s=this.#l,i=s[this.#s.value];i!==void 0?this.#o(i):this.#s.value===s.length&&this.#b?this.#o(this.#e.value):this.#e.value.trim()&&this.#o(this.#e.value)}else e.key==="Escape"&&(e.preventDefault(),this.#a())}render(){const e=this.value,t=this.#l,s=this.#t.value,i=this.#s.value;return l`
467
+ <div class="field" style=${`anchor-name: ${this.#n}`}>
468
+ <input
469
+ class="input"
470
+ role="combobox"
471
+ aria-autocomplete="list"
472
+ aria-expanded=${s}
473
+ aria-controls=${this.#r}
474
+ aria-activedescendant=${i>=0?`${this.#r}-opt-${i}`:""}
475
+ .value=${s?this.#e.value:e}
476
+ @input=${n=>this.#v(n)}
477
+ @focus=${()=>this.#i()}
478
+ @click=${()=>this.#i()}
479
+ @keydown=${n=>this.#w(n)}
480
+ @blur=${()=>{this.#t.value&&this.#e.value.trim()&&this.#u(this.#e.value)!==e?this.#o(this.#e.value):this.#a()}}
481
+ />
482
+ <button
483
+ class="chevron-btn ${s?"open":""}"
484
+ tabindex="-1"
485
+ @mousedown=${n=>n.preventDefault()}
486
+ @click=${()=>this.#g()}
487
+ >
488
+
489
+ </button>
490
+ </div>
491
+
492
+ <ul
493
+ id=${this.#r}
494
+ class="menu ${s?"visible":""}"
495
+ role="listbox"
496
+ popover="manual"
497
+ style=${`position-anchor: ${this.#n}`}
498
+ >
499
+ ${t.map((n,o)=>l`
500
+ <li
501
+ id=${`${this.#r}-opt-${o}`}
502
+ role="option"
503
+ aria-selected=${n===e}
504
+ class=${`option ${n===e?"selected":""} ${o===i?"highlighted":""}`}
505
+ @mousedown=${a=>a.preventDefault()}
506
+ @click=${()=>this.#o(n)}
507
+ >
508
+ ${n}
509
+ </li>
510
+ `)}
511
+ ${this.#b?l`
512
+ <li
513
+ id=${`${this.#r}-opt-${t.length}`}
514
+ role="option"
515
+ class=${`option create-option ${t.length===i?"highlighted":""}`}
516
+ @mousedown=${n=>n.preventDefault()}
517
+ @click=${()=>this.#o(this.#e.value)}
518
+ >
519
+ ${t.length?"Create":"No match. Create"} '${this.#u(this.#e.value)}'
520
+ </li>
521
+ `:""}
522
+ ${!t.length&&!this.#b?l`<li class="empty">No options</li>`:""}
523
+ </ul>
524
+ `}}customElements.define("status-select",Li);let Fi=0;const Oi={top:"top: auto; bottom: anchor(top); left: anchor(center); right: auto; translate: -50% 0; margin-top: 0; margin-bottom: 6px;",bottom:"top: anchor(bottom); bottom: auto; left: anchor(center); right: auto; translate: -50% 0; margin-top: 6px; margin-bottom: 0;",left:"top: anchor(center); bottom: auto; left: auto; right: anchor(left); translate: 0 -50%; margin-right: 6px;",right:"top: anchor(center); bottom: auto; left: anchor(right); right: auto; translate: 0 -50%; margin-left: 6px;"},Di=["top","bottom","left","right"];class Ni extends k{static{this.properties={text:{attribute:!1},placement:{attribute:!1}}}#e;#t=null;static{this.styles=S`
525
+ :host {
526
+ display: inline-flex;
527
+ position: relative;
528
+ vertical-align: middle;
529
+ }
530
+ .icon {
531
+ display: inline-flex;
532
+ align-items: center;
533
+ justify-content: center;
534
+ width: 14px;
535
+ height: 14px;
536
+ border-radius: 50%;
537
+ border: 1px solid var(--border-strong);
538
+ background: transparent;
539
+ color: inherit;
540
+ opacity: 0.55;
541
+ font-size: 10px;
542
+ line-height: 1;
543
+ cursor: help;
544
+ padding: 0;
545
+ }
546
+ .icon:hover, .icon:focus-visible {
547
+ opacity: 1;
548
+ border-color: var(--accent);
549
+ color: var(--accent);
550
+ }
551
+
552
+ .bubble {
553
+ /* Primary position (top/bottom/left/right + translate + margin) and
554
+ position-try-fallbacks are both set inline per-instance from the placement property —
555
+ see PRIMARY_POSITION/#fallbackNames and the inline style in render() below. */
556
+ position: fixed;
557
+ inset: auto;
558
+ border: 1px solid var(--border);
559
+ border-radius: 6px;
560
+ background: var(--bg);
561
+ color: inherit;
562
+ box-shadow: 0 6px 20px var(--shadow);
563
+ padding: 6px 9px;
564
+ max-width: 240px;
565
+ width: max-content;
566
+ font-size: 12px;
567
+ line-height: 1.4;
568
+ font-weight: 400;
569
+ text-align: left;
570
+ }
571
+ .bubble[popover] { display: none; }
572
+ .bubble:popover-open { display: block; }
573
+
574
+ /* One @position-try block per side. Named per-side (not per-placement-order) so any
575
+ placement's fallback list can reference the same four blocks in a different order. */
576
+ @position-try --bubble-top {
577
+ top: auto;
578
+ bottom: anchor(top);
579
+ left: anchor(center);
580
+ right: auto;
581
+ translate: -50% 0;
582
+ margin: 0 0 6px;
583
+ }
584
+ @position-try --bubble-bottom {
585
+ top: anchor(bottom);
586
+ bottom: auto;
587
+ left: anchor(center);
588
+ right: auto;
589
+ translate: -50% 0;
590
+ margin: 6px 0 0;
591
+ }
592
+ @position-try --bubble-left {
593
+ top: anchor(center);
594
+ bottom: auto;
595
+ left: auto;
596
+ right: anchor(left);
597
+ translate: 0 -50%;
598
+ margin: 0 6px 0 0;
599
+ }
600
+ @position-try --bubble-right {
601
+ top: anchor(center);
602
+ bottom: auto;
603
+ left: anchor(right);
604
+ right: auto;
605
+ translate: 0 -50%;
606
+ margin: 0 0 0 6px;
607
+ }
608
+ `}constructor(){super(),this.text="",this.placement="top",this.#e=`--help-tooltip-${++Fi}`}get#s(){const e=Di.filter(t=>t!==this.placement);return[this.placement,...e].map(t=>`--bubble-${t}`).join(", ")}disconnectedCallback(){this.#t&&clearTimeout(this.#t),super.disconnectedCallback()}#n(){this.#t&&(clearTimeout(this.#t),this.#t=null);const e=this.renderRoot.querySelector(".bubble");e&&!e.matches(":popover-open")&&e.showPopover()}#r(){this.#t=setTimeout(()=>{this.renderRoot.querySelector(".bubble")?.hidePopover()},100)}render(){return l`
609
+ <button
610
+ type="button"
611
+ class="icon"
612
+ style=${`anchor-name: ${this.#e}`}
613
+ aria-describedby="bubble"
614
+ @mouseenter=${()=>this.#n()}
615
+ @mouseleave=${()=>this.#r()}
616
+ @focus=${()=>this.#n()}
617
+ @blur=${()=>this.#r()}
618
+ >?</button>
619
+ <div
620
+ id="bubble"
621
+ role="tooltip"
622
+ class="bubble"
623
+ popover="manual"
624
+ style=${`position-anchor: ${this.#e}; position-try-fallbacks: ${this.#s}; ${Oi[this.placement]}`}
625
+ @mouseenter=${()=>this.#n()}
626
+ @mouseleave=${()=>this.#r()}
627
+ >
628
+ ${this.text}
629
+ </div>
630
+ `}}customElements.define("help-tooltip",Ni);const ct="mem-bucket-detail-view-mode",Mi=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg"]);function Ui(r){const e=r.lastIndexOf(".");return e===-1?!1:Mi.has(r.slice(e).toLowerCase())}function ji(r){return new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(r))}const qi=["stable","beta","unreviewed"],Bi=["active","shipped","abandoned"],dt=["plan","spec","sql","testing-todo","discovery","session-summary","other"],Hi=["ticket","freeform"],$={description:"What this doc is / does, shown in search results and list views. For skills, this is also the only thing an agent sees before deciding whether to load the full body — so state both what it does and when to use it.",tags:"Free-form keywords used to filter and search. Not the only thing matched during full-text search, but the fastest way to narrow a list view.",status:`Lifecycle state — stable/beta/unreviewed for skills, active/shipped/abandoned for memory docs. Skills default to "unreviewed" if left unset, so low-trust content doesn't read as equivalent to a reviewed pattern.`,name:"The skill's identifier — becomes its containing folder name on disk. Lowercase letters, numbers, and hyphens only.",owner:"Who authored or maintains this skill — a person or team name, free text.",extends:"Name of another skill this one builds on or specializes, if any. Leave blank if it doesn't extend anything.",trigger_phrases:"Extra keyword phrases beyond the description that should surface this skill in search — phrasings a user might type that don't literally appear in the description text.",key:"The lookup handle for this memory doc — usually a ticket ID, sometimes a free-form name. One key can have several docs attached (a plan, a spec, session notes) all retrievable together.",key_type:'"ticket" if the key is a real ticket ID, "freeform" for a name like "Spot Chart Design".',doc_type:"What kind of content this is — shapes how it should be read (a plan reads differently than raw SQL or a session summary).",related_to:"Another key this doc relates to, if any — free text, not validated against existing keys."};function ht(r){return{description:r.description??"",tags:r.tags??[],status:r.status??"",name:r.name??"",owner:r.owner??"",extends:r.extends??"",trigger_phrases:r.trigger_phrases??[],key:r.key??"",key_type:r.key_type??"",doc_type:r.doc_type??"",related_to:r.related_to??""}}class Ki extends k{constructor(){super(...arguments),this._viewMode=localStorage.getItem(ct)??"markdown",this._editing=!1,this._draft=null,this._addingFrontmatter=!1,this._renaming=!1,this._renameValue="",this._viewingAttachment=null,this._sharing=!1,this._shareUsername="",this._shareRole="member",this._shareBusy=!1,this._shareStatus=null}static{this.properties={selected:{attribute:!1},onChanged:{attribute:!1},facets:{attribute:!1},onTagClick:{attribute:!1},onFolderClick:{attribute:!1},onDateClick:{attribute:!1},onKeyClick:{attribute:!1},onGone:{attribute:!1},_doc:{state:!0},_viewMode:{state:!0},_editing:{state:!0},_draft:{state:!0},_addingFrontmatter:{state:!0},_renaming:{state:!0},_renameValue:{state:!0},_viewingAttachment:{state:!0},_sharing:{state:!0},_shareUsername:{state:!0},_shareRole:{state:!0},_shareBusy:{state:!0},_shareStatus:{state:!0}}}static{this.styles=S`
631
+ :host { display: block; padding: 16px; }
632
+ h2 { margin: 0 0 4px; font-size: 16px; }
633
+ .title-row {
634
+ display: flex;
635
+ align-items: center;
636
+ gap: 8px;
637
+ flex-wrap: wrap;
638
+ margin-bottom: 10px;
639
+ }
640
+ .title-row h2 { margin: 0; }
641
+ .title-link {
642
+ background: none; border: none; padding: 0; margin: 0; font: inherit; font-weight: inherit;
643
+ color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
644
+ text-align: left;
645
+ }
646
+ .title-link:hover { opacity: 0.8; }
647
+ .key-subtitle { display: block; font-size: 12px; opacity: 0.65; margin-top: 2px; font-weight: 400; }
648
+ .key-link {
649
+ background: none; border: none; padding: 0; margin: 0; font: inherit;
650
+ color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
651
+ }
652
+ .key-link:hover { opacity: 0.8; }
653
+ .pill {
654
+ border: 1px solid var(--border-strong);
655
+ border-radius: 999px;
656
+ padding: 2px 9px;
657
+ font-size: 11px;
658
+ display: inline-flex;
659
+ align-items: center;
660
+ background: none;
661
+ color: inherit;
662
+ font-family: inherit;
663
+ }
664
+ .pill.folder-pill {
665
+ cursor: pointer;
666
+ color: var(--purple-fg);
667
+ border-color: var(--purple);
668
+ background: var(--purple-tint);
669
+ }
670
+ .pill.folder-pill:hover { background: var(--hover-strong); }
671
+ .pill.tag-pill {
672
+ cursor: pointer;
673
+ background: var(--bg-subtle);
674
+ }
675
+ .pill.tag-pill:hover { background: var(--hover); border-color: var(--border-strong); }
676
+ .pill.warn-pill {
677
+ border-color: var(--danger);
678
+ color: var(--danger);
679
+ background: none;
680
+ }
681
+ .pill.muted-pill {
682
+ opacity: 0.65;
683
+ }
684
+ .info-grid {
685
+ display: grid;
686
+ grid-template-columns: max-content 1fr;
687
+ column-gap: 10px;
688
+ row-gap: 7px;
689
+ font-size: 12px;
690
+ margin-bottom: 12px;
691
+ align-items: start;
692
+ }
693
+ .info-grid dt {
694
+ opacity: 0.55;
695
+ font-size: 10.5px;
696
+ text-transform: uppercase;
697
+ letter-spacing: 0.04em;
698
+ padding-top: 2px;
699
+ white-space: nowrap;
700
+ }
701
+ .info-grid dd {
702
+ margin: 0;
703
+ display: flex;
704
+ flex-wrap: wrap;
705
+ gap: 5px;
706
+ align-items: center;
707
+ }
708
+ .info-grid dd.description { opacity: 0.85; }
709
+ .info-grid .date-value {
710
+ cursor: pointer;
711
+ text-decoration: underline dotted;
712
+ text-underline-offset: 2px;
713
+ }
714
+ .info-grid .date-value:hover { opacity: 0.75; }
715
+ .info-grid .hint { opacity: 0.5; font-style: italic; }
716
+ .bare-notice { font-size: 12px; opacity: 0.6; font-style: italic; margin-bottom: 12px; }
717
+ .attachments-section {
718
+ font-size: 12px;
719
+ margin-bottom: 12px;
720
+ }
721
+ .attachments-section h4 {
722
+ margin: 0 0 6px;
723
+ font-size: 10.5px;
724
+ text-transform: uppercase;
725
+ letter-spacing: 0.04em;
726
+ opacity: 0.55;
727
+ font-weight: 600;
728
+ }
729
+ .attachment-add {
730
+ position: relative;
731
+ display: inline-block;
732
+ margin-top: 6px;
733
+ font-weight: 500;
734
+ opacity: 0.85;
735
+ cursor: pointer;
736
+ }
737
+ .attachment-add:hover { opacity: 1; }
738
+ .attachment-add input[type='file'] {
739
+ position: absolute;
740
+ inset: 0;
741
+ opacity: 0;
742
+ cursor: pointer;
743
+ }
744
+ .attachment-remove {
745
+ opacity: 0.55;
746
+ background: none;
747
+ border: none;
748
+ cursor: pointer;
749
+ font-size: 13px;
750
+ line-height: 1;
751
+ padding: 0 0 0 4px;
752
+ color: inherit;
753
+ }
754
+ .attachment-remove:hover { opacity: 1; color: var(--danger); }
755
+ .attachments-section ul {
756
+ list-style: none;
757
+ margin: 0;
758
+ padding: 0;
759
+ display: flex;
760
+ flex-direction: column;
761
+ gap: 4px;
762
+ }
763
+ .attachment-download {
764
+ opacity: 0.55;
765
+ text-decoration: none;
766
+ margin-left: 2px;
767
+ }
768
+ .attachment-download:hover { opacity: 1; }
769
+ .attachment-view-header {
770
+ display: flex;
771
+ align-items: center;
772
+ gap: 10px;
773
+ margin-bottom: 8px;
774
+ }
775
+ .back-button {
776
+ font-size: 11px;
777
+ padding: 3px 8px;
778
+ border: 1px solid var(--border);
779
+ background: transparent;
780
+ color: inherit;
781
+ border-radius: 4px;
782
+ cursor: pointer;
783
+ }
784
+ .back-button:hover { background: var(--hover); }
785
+ .attachment-view-title {
786
+ font-size: 12px;
787
+ font-weight: 600;
788
+ flex: 1;
789
+ overflow: hidden;
790
+ text-overflow: ellipsis;
791
+ white-space: nowrap;
792
+ }
793
+ .attachment-view-download {
794
+ font-size: 11px;
795
+ text-decoration: none;
796
+ color: inherit;
797
+ opacity: 0.75;
798
+ }
799
+ .attachment-view-download:hover { opacity: 1; }
800
+ .attachment-frame {
801
+ width: 100%;
802
+ height: 65vh;
803
+ border: 1px solid var(--border);
804
+ border-radius: 6px;
805
+ background: var(--bg-subtle);
806
+ }
807
+ .attachment-image {
808
+ display: block;
809
+ max-width: 100%;
810
+ max-height: 65vh;
811
+ border-radius: 6px;
812
+ }
813
+ .source-path {
814
+ font-family: monospace;
815
+ font-size: 11px;
816
+ opacity: 0.6;
817
+ cursor: pointer;
818
+ word-break: break-all;
819
+ }
820
+ pre {
821
+ white-space: pre-wrap;
822
+ font-size: 12px;
823
+ background: var(--bg-subtle);
824
+ padding: 12px;
825
+ border-radius: 6px;
826
+ max-height: 60vh;
827
+ overflow-y: auto;
828
+ }
829
+ textarea {
830
+ width: 100%;
831
+ box-sizing: border-box;
832
+ font-family: monospace;
833
+ font-size: 12px;
834
+ background: var(--bg-subtle);
835
+ color: inherit;
836
+ border: 1px solid var(--border);
837
+ border-radius: 6px;
838
+ padding: 12px;
839
+ min-height: 30vh;
840
+ resize: vertical;
841
+ }
842
+ .empty { opacity: 0.5; font-size: 13px; }
843
+ .view-toggle {
844
+ display: flex;
845
+ gap: 4px;
846
+ margin-bottom: 8px;
847
+ }
848
+ .view-toggle button {
849
+ font-size: 11px;
850
+ padding: 3px 8px;
851
+ border: 1px solid var(--border);
852
+ background: transparent;
853
+ border-radius: 4px;
854
+ cursor: pointer;
855
+ opacity: 0.6;
856
+ }
857
+ .view-toggle button.active {
858
+ opacity: 1;
859
+ background: var(--hover);
860
+ font-weight: 600;
861
+ }
862
+ .markdown-body {
863
+ font-size: 13px;
864
+ line-height: 1.5;
865
+ max-height: 60vh;
866
+ overflow-y: auto;
867
+ padding: 12px;
868
+ background: var(--bg-subtle);
869
+ border-radius: 6px;
870
+ }
871
+ .markdown-body :first-child { margin-top: 0; }
872
+ .markdown-body :last-child { margin-bottom: 0; }
873
+ .markdown-body pre {
874
+ background: var(--hover);
875
+ max-height: none;
876
+ }
877
+ .markdown-body code {
878
+ font-family: monospace;
879
+ font-size: 12px;
880
+ }
881
+ .actions {
882
+ display: flex;
883
+ flex-wrap: wrap;
884
+ gap: 8px;
885
+ margin-bottom: 12px;
886
+ }
887
+ .actions button {
888
+ font-size: 11px;
889
+ padding: 4px 10px;
890
+ border: 1px solid var(--border);
891
+ background: transparent;
892
+ color: inherit;
893
+ border-radius: 4px;
894
+ cursor: pointer;
895
+ }
896
+ .actions button.danger {
897
+ border-color: var(--danger);
898
+ color: var(--danger);
899
+ }
900
+ .actions button.primary {
901
+ border-color: var(--accent);
902
+ color: var(--accent);
903
+ font-weight: 600;
904
+ }
905
+ .edit-form {
906
+ display: flex;
907
+ flex-direction: column;
908
+ gap: 10px;
909
+ margin-bottom: 12px;
910
+ padding: 12px;
911
+ background: var(--bg-subtle);
912
+ border-radius: 6px;
913
+ }
914
+ .field {
915
+ display: flex;
916
+ flex-direction: column;
917
+ gap: 4px;
918
+ }
919
+ .field label {
920
+ font-size: 11px;
921
+ font-weight: 600;
922
+ opacity: 0.7;
923
+ display: inline-flex;
924
+ align-items: center;
925
+ gap: 4px;
926
+ }
927
+ .field input[type='text'],
928
+ .field select,
929
+ .field textarea {
930
+ font-size: 13px;
931
+ padding: 6px 8px;
932
+ border: 1px solid var(--border-strong);
933
+ border-radius: 6px;
934
+ background: var(--bg);
935
+ color: inherit;
936
+ font-family: inherit;
937
+ }
938
+ .field input[type='text'],
939
+ .field select {
940
+ max-width: 320px;
941
+ }
942
+ .field textarea {
943
+ min-height: 60px;
944
+ resize: vertical;
945
+ }
946
+ .field-row {
947
+ display: flex;
948
+ gap: 10px;
949
+ }
950
+ .field-row .field { flex: 1; }
951
+ .form-actions {
952
+ display: flex;
953
+ gap: 8px;
954
+ margin-top: 4px;
955
+ }
956
+ .form-actions button {
957
+ font-size: 12px;
958
+ padding: 5px 12px;
959
+ border-radius: 4px;
960
+ cursor: pointer;
961
+ }
962
+ .form-actions button.save {
963
+ border: 1px solid var(--accent);
964
+ background: var(--accent);
965
+ color: var(--accent-fg);
966
+ }
967
+ .form-actions button.cancel {
968
+ border: 1px solid var(--border);
969
+ background: transparent;
970
+ color: inherit;
971
+ }
972
+ .rename-row {
973
+ display: flex;
974
+ gap: 6px;
975
+ align-items: center;
976
+ }
977
+ .rename-row input {
978
+ flex: 1;
979
+ font-size: 12px;
980
+ padding: 4px 6px;
981
+ border: 1px solid var(--border-strong);
982
+ border-radius: 4px;
983
+ background: var(--bg);
984
+ color: inherit;
985
+ }
986
+ .hint { font-size: 11px; opacity: 0.6; }
987
+ .share-form {
988
+ display: flex; flex-direction: column; gap: 8px; padding: 10px; margin-top: 4px;
989
+ border: 1px solid var(--border-strong); border-radius: 6px; background: var(--bg-subtle);
990
+ }
991
+ .share-row { display: flex; gap: 6px; align-items: center; }
992
+ .share-row input[type='text'] {
993
+ flex: 1; font-size: 12px; padding: 4px 6px; border: 1px solid var(--border-strong);
994
+ border-radius: 4px; background: var(--bg); color: inherit;
995
+ }
996
+ .share-row select {
997
+ font-size: 12px; padding: 4px 6px; border: 1px solid var(--border-strong); border-radius: 4px;
998
+ background: var(--bg); color: inherit;
999
+ }
1000
+ .share-links-row { display: flex; gap: 6px; }
1001
+ .share-status { font-size: 11px; opacity: 0.75; }
1002
+ `}updated(e){e.has("selected")&&this.selected&&(this._editing=!1,this._addingFrontmatter=!1,this._renaming=!1,this._viewingAttachment=null,this.#e(),this.scrollTop=0)}async#e(){const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);this._doc=s.ok?await s.json():null,await this.updateComplete,this.shadowRoot?.querySelector(".markdown-body")?.scrollTo(0,0),this.shadowRoot?.querySelector("pre")?.scrollTo(0,0)}async refresh(){if(!this.selected||this._editing||this._addingFrontmatter||this._renaming)return;const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);if(!s.ok){this._doc=null,this.onGone?.();return}const n=(this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre"))?.scrollTop??0;this._doc=await s.json(),await this.updateComplete;const o=this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre");o&&(o.scrollTop=n)}#t(){this._doc?.source_path&&navigator.clipboard?.writeText(this._doc.source_path)}#s(e){this._viewMode=e,localStorage.setItem(ct,e)}async#n(){const{table:e,id:t}=this.selected,s=!this._doc?.deprecated;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/deprecated`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({deprecated:s})}),await this.#e(),this.onChanged?.()}async#r(){const{table:e,id:t}=this.selected,s=!this._doc?.paused;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/paused`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({paused:s})}),await this.#e(),this.onChanged?.()}async#p(e){const{table:t,id:s}=this.selected,i=await e.arrayBuffer(),n=await fetch(`/api/entries/${t}/${encodeURIComponent(s)}/attachments?filename=${encodeURIComponent(e.name)}`,{method:"POST",headers:{"Content-Type":"application/octet-stream"},body:i});if(!n.ok){const{error:o}=await n.json().catch(()=>({error:`upload failed (${n.status})`}));window.alert(o);return}await this.#e(),this.onChanged?.()}#l(e){const t=e.currentTarget,s=t.files?.[0];t.value="",s&&this.#p(s)}async#i(e){if(!window.confirm(`Remove attachment "${e}"? This can't be undone.`))return;const{table:t,id:s}=this.selected;await fetch(`/api/entries/${t}/${encodeURIComponent(s)}/attachments/${encodeURIComponent(e)}`,{method:"DELETE"}),this._viewingAttachment?.filename===e&&(this._viewingAttachment=null),await this.#e(),this.onChanged?.()}#a(){this._sharing=!0,this._shareUsername="",this._shareRole="member",this._shareStatus=null}#g(){this._sharing=!1,this._shareStatus=null}async#v(){if(!this.selected||!this._shareUsername.trim())return;const{table:e,id:t}=this.selected;this._shareBusy=!0,this._shareStatus=null;try{const s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/share`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:this._shareUsername.trim(),role:this._shareRole})}),i=await s.json().catch(()=>({}));this._shareStatus=s.ok?`Shared with ${this._shareUsername.trim()}.`:`Share failed: ${i.error??s.statusText}`,s.ok&&(this._shareUsername="")}finally{this._shareBusy=!1}}async#u(e){if(!this.selected)return;const{table:t,id:s}=this.selected;this._shareBusy=!0,this._shareStatus=null;try{const i=await fetch(`/api/entries/${t}/${encodeURIComponent(s)}/${e}`,{method:"POST"}),n=await i.json().catch(()=>({}));if(!i.ok){this._shareStatus=`Failed to create link: ${n.error??i.statusText}`;return}const o=e==="share-link"?"shareToken":"publicToken",a=new URL(window.location.href);a.search=`?${o}=${encodeURIComponent(n.token)}`;const c=a.toString();try{await navigator.clipboard?.writeText(c),this._shareStatus=`${e==="share-link"?"Share":"Public"} link copied to clipboard.`}catch{this._shareStatus=`Link: ${c}`}}finally{this._shareBusy=!1}}async#o(){if(!window.confirm("Delete this doc? This can't be undone."))return;const{table:e,id:t}=this.selected;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"DELETE"}),this._doc=null,this.onChanged?.()}#b(){this._doc&&(this._draft=ht(this._doc),this._editing=!0,this._addingFrontmatter=!1)}#k(){this._doc&&(this._draft=ht(this._doc),this._addingFrontmatter=!0,this._editing=!1)}#w(e){this._draft&&(this._draft={...this._draft,doc_type:e},this._addingFrontmatter=!1,this._editing=!0)}#m(){this._editing=!1,this._addingFrontmatter=!1,this._draft=null}#d(e){this._draft&&(this._draft={...this._draft,...e})}#x(e){if(!this._draft)return;const t=this._draft.tags.includes(e)?this._draft.tags.filter(s=>s!==e):[...this._draft.tags,e];this.#d({tags:t})}#$(e){if(!this._draft)return;const t=this._draft.trigger_phrases.includes(e)?this._draft.trigger_phrases.filter(s=>s!==e):[...this._draft.trigger_phrases,e];this.#d({trigger_phrases:t})}async#h(){if(!this._draft||!this.selected)return;const{table:e,id:t}=this.selected,s=e==="skills",i={description:this._draft.description,tags:this._draft.tags,status:this._draft.status};s?(i.owner=this._draft.owner||null,i.extends=this._draft.extends||null,i.trigger_phrases=this._draft.trigger_phrases):(i.key=this._draft.key,i.key_type=this._draft.key_type,i.doc_type=this._draft.doc_type,i.related_to=this._draft.related_to||null);const n=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({frontmatter:i})});if(!n.ok){const o=await n.json().catch(()=>({}));window.alert(`Save failed: ${o.error??n.statusText}`);return}this._editing=!1,this._draft=null,await this.#e(),this.onChanged?.()}async#y(){if(!this.selected||!this._doc||this.selected.table!=="memory_docs")return;const{table:e,id:t}=this.selected;if(!window.confirm(`Delete frontmatter for "${this._doc.key}"?
1003
+
1004
+ This removes the doc's key, tags, and status — it drops out of key-based lookup and full-text search, and becomes a plain unmanaged file, until frontmatter is added again.`))return;const i=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/frontmatter`,{method:"DELETE"});if(!i.ok){const n=await i.json().catch(()=>({}));window.alert(`Delete failed: ${n.error??i.statusText}`);return}this._doc=null,this.selected=null,this.onChanged?.()}#_(){if(!this._doc||!this.selected)return;const e=this.selected.table==="skills";this._renameValue=e?this._doc.name??"":this._doc.source_path.split("/").pop()??"",this._renaming=!0}async#f(){if(!this._doc||!this.selected||!this._renameValue.trim())return;const e=this.selected.table==="skills",t=this._renameValue.trim(),s=e?this._doc.name:this._doc.source_path.split("/").pop();if(t===s){this._renaming=!1;return}const i=e?await fetch(`/api/entries/skills/${encodeURIComponent(this._doc.name)}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({new_name:t})}):await fetch(`/api/entries/memory_docs/${encodeURIComponent(this.selected.id)}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({new_filename:t})});if(!i.ok){const n=await i.json().catch(()=>({}));window.alert(`Rename failed: ${n.error??i.statusText}`);return}if(this._renaming=!1,e)this.selected={table:"skills",id:t};else{const n=await i.json();this.selected={table:"memory_docs",id:n.source_path}}await this.#e(),this.onChanged?.()}#T(){return l`
1005
+ <div class="edit-form">
1006
+ <div class="hint">What kind of doc is this? This shapes which fields apply next.</div>
1007
+ <div class="field">
1008
+ <label>doc_type <help-tooltip .text=${$.doc_type}></help-tooltip></label>
1009
+ <select
1010
+ @change=${e=>this.#w(e.target.value)}
1011
+ >
1012
+ <option value="" selected disabled>Choose…</option>
1013
+ ${dt.map(e=>l`<option value=${e}>${e}</option>`)}
1014
+ </select>
1015
+ </div>
1016
+ <div class="form-actions">
1017
+ <button class="cancel" @click=${()=>this.#m()}>Cancel</button>
1018
+ </div>
1019
+ </div>
1020
+ `}#E(e){const t=this._draft,s=this.facets;return l`
1021
+ <div class="edit-form">
1022
+ ${e?l`
1023
+ <div class="field">
1024
+ <label>name <help-tooltip .text=${$.name}></help-tooltip></label>
1025
+ <div class="hint">Renaming moves the skill's folder on disk — kept as a separate action.</div>
1026
+ </div>
1027
+ `:l`
1028
+ <div class="field-row">
1029
+ <div class="field">
1030
+ <label>key <help-tooltip .text=${$.key}></help-tooltip></label>
1031
+ <input
1032
+ type="text"
1033
+ .value=${t.key}
1034
+ @input=${i=>this.#d({key:i.target.value})}
1035
+ />
1036
+ </div>
1037
+ <div class="field">
1038
+ <label>key_type <help-tooltip .text=${$.key_type}></help-tooltip></label>
1039
+ <select
1040
+ .value=${t.key_type}
1041
+ @change=${i=>this.#d({key_type:i.target.value})}
1042
+ >
1043
+ ${Hi.map(i=>l`<option value=${i} ?selected=${i===t.key_type}>${i}</option>`)}
1044
+ </select>
1045
+ </div>
1046
+ </div>
1047
+ <div class="field">
1048
+ <label>doc_type <help-tooltip .text=${$.doc_type}></help-tooltip></label>
1049
+ <select
1050
+ .value=${t.doc_type}
1051
+ @change=${i=>this.#d({doc_type:i.target.value})}
1052
+ >
1053
+ ${dt.map(i=>l`<option value=${i} ?selected=${i===t.doc_type}>${i}</option>`)}
1054
+ </select>
1055
+ </div>
1056
+ `}
1057
+ <div class="field">
1058
+ <label>description <help-tooltip .text=${$.description}></help-tooltip></label>
1059
+ <textarea
1060
+ .value=${t.description}
1061
+ @input=${i=>this.#d({description:i.target.value})}
1062
+ ></textarea>
1063
+ </div>
1064
+ <div class="field">
1065
+ <label>tags <help-tooltip .text=${$.tags}></help-tooltip></label>
1066
+ <tag-multiselect
1067
+ .tags=${s?.tags??[]}
1068
+ .active=${t.tags}
1069
+ .allowCreate=${!0}
1070
+ .onToggle=${i=>this.#x(i)}
1071
+ ></tag-multiselect>
1072
+ </div>
1073
+ <div class="field">
1074
+ <label>status <help-tooltip .text=${$.status}></help-tooltip></label>
1075
+ <status-select
1076
+ .options=${[...new Set([...e?qi:Bi,...s?.statuses??[]])]}
1077
+ .value=${t.status}
1078
+ .onChange=${i=>this.#d({status:i})}
1079
+ ></status-select>
1080
+ </div>
1081
+ ${e?l`
1082
+ <div class="field-row">
1083
+ <div class="field">
1084
+ <label>owner <help-tooltip .text=${$.owner}></help-tooltip></label>
1085
+ <input
1086
+ type="text"
1087
+ .value=${t.owner}
1088
+ @input=${i=>this.#d({owner:i.target.value})}
1089
+ />
1090
+ </div>
1091
+ <div class="field">
1092
+ <label>extends <help-tooltip .text=${$.extends}></help-tooltip></label>
1093
+ <input
1094
+ type="text"
1095
+ .value=${t.extends}
1096
+ @input=${i=>this.#d({extends:i.target.value})}
1097
+ />
1098
+ </div>
1099
+ </div>
1100
+ <div class="field">
1101
+ <label>trigger_phrases <help-tooltip .text=${$.trigger_phrases}></help-tooltip></label>
1102
+ <tag-multiselect
1103
+ .tags=${[]}
1104
+ .active=${t.trigger_phrases}
1105
+ .allowCreate=${!0}
1106
+ .onToggle=${i=>this.#$(i)}
1107
+ ></tag-multiselect>
1108
+ </div>
1109
+ `:l`
1110
+ <div class="field">
1111
+ <label>related_to <help-tooltip .text=${$.related_to}></help-tooltip></label>
1112
+ <input
1113
+ type="text"
1114
+ .value=${t.related_to}
1115
+ @input=${i=>this.#d({related_to:i.target.value})}
1116
+ />
1117
+ </div>
1118
+ `}
1119
+ <div class="form-actions">
1120
+ <button class="save" @click=${()=>this.#h()}>Save</button>
1121
+ <button class="cancel" @click=${()=>this.#m()}>Cancel</button>
1122
+ </div>
1123
+ </div>
1124
+ `}#S(e,t){const s=t?void 0:e.key,i=t?e.name??e.id:e.source_path?e.source_path.split("/").pop():e.id;return l`
1125
+ <div class="title-row">
1126
+ <div>
1127
+ <h2>${i}</h2>
1128
+ ${s?l`<button class="title-link key-subtitle" title="Search for key '${s}'" @click=${()=>this.onKeyClick?.(s)}>
1129
+ 🔑 ${s}
1130
+ </button>`:""}
1131
+ </div>
1132
+ <button class="pill folder-pill" title="Filter by folder '${e.folder}'" @click=${()=>this.onFolderClick?.(e.folder)}>
1133
+ 📁 ${e.folder}
1134
+ </button>
1135
+ </div>
1136
+ `}#R(e,t){const s=e.created_at?ji(e.created_at):null;return l`
1137
+ <dl class="info-grid">
1138
+ <dt>Description</dt>
1139
+ <dd class="description">${e.description||"—"}</dd>
1140
+
1141
+ <dt>Tags</dt>
1142
+ <dd>
1143
+ ${e.tags?.length?e.tags.map(i=>l`<button class="pill tag-pill" @click=${()=>this.onTagClick?.(i)}>${i}</button>`):l`<span class="hint">no tags</span>`}
1144
+ </dd>
1145
+
1146
+ <dt>Status</dt>
1147
+ <dd>${e.status}</dd>
1148
+
1149
+ ${e.deprecated||e.paused?l`
1150
+ <dt>Flags</dt>
1151
+ <dd>
1152
+ ${e.deprecated?l`<span class="pill warn-pill">deprecated</span>`:b}
1153
+ ${e.paused?l`<span class="pill muted-pill">paused</span>`:b}
1154
+ </dd>
1155
+ `:b}
1156
+
1157
+ ${t?l`
1158
+ ${e.owner?l`<dt>Owner</dt>
1159
+ <dd>${e.owner}</dd>`:b}
1160
+ ${e.extends?l`<dt>Extends</dt>
1161
+ <dd>${e.extends}</dd>`:b}
1162
+ `:l`
1163
+ <dt>Key</dt>
1164
+ <dd>
1165
+ <button class="key-link" title="Search for this key" @click=${()=>e.key&&this.onKeyClick?.(e.key)}>
1166
+ ${e.key}
1167
+ </button>
1168
+ </dd>
1169
+
1170
+ <dt>Key type</dt>
1171
+ <dd>${e.key_type}</dd>
1172
+
1173
+ <dt>Doc type</dt>
1174
+ <dd>${e.doc_type}</dd>
1175
+
1176
+ ${e.related_to?l`<dt>Related to</dt>
1177
+ <dd>${e.related_to}</dd>`:b}
1178
+ `}
1179
+
1180
+ <dt>Created</dt>
1181
+ <dd>
1182
+ ${s?l`<span class="date-value" title="Filter to this day" @click=${()=>this.onDateClick?.(s)}
1183
+ >${s}</span
1184
+ >`:l`<span class="hint">unknown</span>`}
1185
+ </dd>
1186
+ </dl>
1187
+ `}#C(e,t){const s=new v.Renderer,i=s.link.bind(s);return s.link=n=>{if(typeof n.href=="string"&&n.href.startsWith("attachment://")){const o=n.href.slice(13);return i({...n,href:`/api/entries/${e}/${encodeURIComponent(t)}/attachments/${encodeURIComponent(o)}`})}return i(n)},s}#P(){return l`
1188
+ <div class="share-form">
1189
+ <div class="share-row">
1190
+ <input
1191
+ type="text"
1192
+ placeholder="username"
1193
+ .value=${this._shareUsername}
1194
+ @input=${e=>this._shareUsername=e.target.value}
1195
+ @keydown=${e=>e.key==="Enter"&&this.#v()}
1196
+ />
1197
+ <select .value=${this._shareRole} @change=${e=>this._shareRole=e.target.value}>
1198
+ <option value="member">Read-only</option>
1199
+ <option value="editor">Can edit</option>
1200
+ </select>
1201
+ <button ?disabled=${this._shareBusy||!this._shareUsername.trim()} @click=${()=>this.#v()}>Share</button>
1202
+ </div>
1203
+ <div class="share-links-row">
1204
+ <button ?disabled=${this._shareBusy} @click=${()=>this.#u("share-link")}>Copy share link</button>
1205
+ <button ?disabled=${this._shareBusy} @click=${()=>this.#u("public-link")}>Copy public link</button>
1206
+ <button @click=${()=>this.#g()}>Close</button>
1207
+ </div>
1208
+ ${this._shareStatus?l`<div class="share-status">${this._shareStatus}</div>`:b}
1209
+ </div>
1210
+ `}#z(e,t){return l`
1211
+ <div class="attachments-section">
1212
+ <h4>Attachments</h4>
1213
+ ${e.attachments?.length?l`
1214
+ <ul>
1215
+ ${e.attachments.map(s=>l`
1216
+ <li>
1217
+ <a
1218
+ href="/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(s.filename)}/view"
1219
+ target="_blank"
1220
+ rel="noopener"
1221
+ @click=${i=>{i.button!==0||i.metaKey||i.ctrlKey||i.shiftKey||i.altKey||(i.preventDefault(),this._viewingAttachment=s)}}
1222
+ >${s.filename}</a
1223
+ >
1224
+ <a
1225
+ class="attachment-download"
1226
+ href="/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(s.filename)}"
1227
+ title="Download"
1228
+ >⇩</a
1229
+ >
1230
+ <button class="attachment-remove" title="Remove" @click=${()=>this.#i(s.filename)}>×</button>
1231
+ </li>
1232
+ `)}
1233
+ </ul>
1234
+ `:b}
1235
+ <label class="attachment-add">
1236
+ + Add
1237
+ <input type="file" @change=${s=>this.#l(s)} />
1238
+ </label>
1239
+ </div>
1240
+ `}#I(e,t,s){const i=document.documentElement.getAttribute("data-theme"),n=i==="light"||i==="dark"?`?theme=${i}`:"",o=`/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(s.filename)}/view${n}`,a=`/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(s.filename)}`;return l`
1241
+ <div class="attachment-view-header">
1242
+ <button class="back-button" title="Back to ${e.name??e.key??e.id}" @click=${()=>this._viewingAttachment=null}>
1243
+ ← Back
1244
+ </button>
1245
+ <span class="attachment-view-title" title=${s.filename}>${s.filename}</span>
1246
+ <a class="attachment-view-download" href=${a} title="Download ${s.filename}">⇩ Download</a>
1247
+ </div>
1248
+ ${Ui(s.filename)?l`<img class="attachment-image" src=${o} alt=${s.filename} />`:l`<iframe class="attachment-frame" src=${o} title=${s.filename}></iframe>`}
1249
+ `}render(){if(!this.selected)return l`<div class="empty">Select an entry to view its details.</div>`;if(!this._doc)return b;const e=this._doc,t=this.selected.table==="skills",s=t&&e.folder==="builtin",i=!t&&e.has_frontmatter===!1;return this._addingFrontmatter?l`${this.#S(e,t)}${this.#T()}`:this._editing&&this._draft?l`${this.#S(e,t)}${this.#E(t)}`:this._viewingAttachment?l`${this.#S(e,t)}${this.#I(e,this.selected.table,this._viewingAttachment)}`:l`
1250
+ ${this.#S(e,t)}
1251
+ ${i?l`<div class="bare-notice">No frontmatter — this is a plain, unmanaged file.</div>`:this.#R(e,t)}
1252
+ ${s?b:l`
1253
+ <div class="actions">
1254
+ ${i?l`<button class="primary" @click=${()=>this.#k()}>Add frontmatter</button>`:l`
1255
+ <button @click=${()=>this.#b()}>Edit</button>
1256
+ <button @click=${()=>this.#_()}>Rename</button>
1257
+ <button @click=${()=>this.#n()}>${e.deprecated?"Un-deprecate":"Mark deprecated"}</button>
1258
+ <button @click=${()=>this.#r()}>${e.paused?"Resume":"Pause"}</button>
1259
+ ${t?b:l`<button class="danger" @click=${()=>this.#y()}>Delete frontmatter</button>`}
1260
+ ${e.remoteInfo?l`<button @click=${()=>this.#a()}>Share…</button>`:b}
1261
+ `}
1262
+ <button class="danger" @click=${()=>this.#o()}>Delete</button>
1263
+ </div>
1264
+ ${this._renaming?l`
1265
+ <div class="rename-row">
1266
+ <input
1267
+ type="text"
1268
+ .value=${this._renameValue}
1269
+ @input=${n=>this._renameValue=n.target.value}
1270
+ @keydown=${n=>n.key==="Enter"&&this.#f()}
1271
+ />
1272
+ <button @click=${()=>this.#f()}>Save</button>
1273
+ <button @click=${()=>this._renaming=!1}>Cancel</button>
1274
+ </div>
1275
+ `:b}
1276
+ ${this._sharing?this.#P():b}
1277
+ `}
1278
+ ${this.#z(e,this.selected.table)}
1279
+ <div class="view-toggle">
1280
+ <button
1281
+ class=${this._viewMode==="markdown"?"active":""}
1282
+ @click=${()=>this.#s("markdown")}
1283
+ >
1284
+ Preview
1285
+ </button>
1286
+ <button
1287
+ class=${this._viewMode==="raw"?"active":""}
1288
+ @click=${()=>this.#s("raw")}
1289
+ >
1290
+ Raw
1291
+ </button>
1292
+ </div>
1293
+ ${this._viewMode==="markdown"?l`<div class="markdown-body">${zi(v.parse(e.body??"",{async:!1,renderer:this.#C(this.selected.table,e.id)}))}</div>`:l`<pre>${e.raw_file??e.body}</pre>`}
1294
+ <div class="source-path" title="click to copy" @click=${()=>this.#t()}>${e.source_path}</div>
1295
+ `}}customElements.define("detail-panel",Ki);const L="membkt";let ge;function j(){return ge||(ge=fetch("/api/config").then(r=>r.json()).catch(()=>({folderfooMode:"off",folderfooHost:null}))),ge}class Vi extends k{static{this.properties={defaultKind:{attribute:!1},lockKind:{attribute:!1},onAdded:{attribute:!1},onCancel:{attribute:!1}}}#e=new p("skill");#t=new p("local");#s=new p("");#n=new p([]);#r=new p(null);#p=new p("");#l=new p("");#i=new p("");#a=new p(!1);#g=new p(!1);#v=new p(!1);#u=new p("");#o=new p("");#b=new p(!1);#k=new p("");#w=new p(!1);#m=new p("");#d=new p(!1);#x=new p(!1);#$=new p([]);#h=new p("");#y=new p("");#_=new p(!1);#f;#T=new p("mine");#E=new p([]);#S=new p(!1);#R=new p(null);static{this.styles=S`
1296
+ :host { display: block; }
1297
+ .backdrop {
1298
+ position: fixed; inset: 0; background: var(--overlay);
1299
+ display: flex; align-items: center; justify-content: center; z-index: 100;
1300
+ }
1301
+ .modal {
1302
+ background: var(--bg);
1303
+ color: inherit;
1304
+ border-radius: 10px;
1305
+ width: min(560px, 92vw);
1306
+ max-height: 82vh;
1307
+ display: flex;
1308
+ flex-direction: column;
1309
+ box-shadow: 0 8px 40px var(--shadow);
1310
+ border: 1px solid var(--border);
1311
+ }
1312
+ .header { padding: 16px 20px 8px; }
1313
+ h2 { margin: 0; font-size: 16px; }
1314
+ .kind-toggle { display: flex; gap: 8px; padding: 0 20px 12px; }
1315
+ .kind-toggle button {
1316
+ flex: 1; padding: 8px; border: 1px solid var(--border-strong); background: none; color: inherit;
1317
+ border-radius: 6px; cursor: pointer; font-size: 13px;
1318
+ }
1319
+ .kind-toggle button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
1320
+ .breadcrumb-row {
1321
+ padding: 8px 20px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
1322
+ }
1323
+ .breadcrumb {
1324
+ font-size: 12px; opacity: 0.7; font-family: monospace;
1325
+ word-break: break-all;
1326
+ }
1327
+ .hidden-toggle {
1328
+ font-size: 11px; opacity: 0.7; display: flex; align-items: center; gap: 4px;
1329
+ cursor: pointer; white-space: nowrap; user-select: none;
1330
+ }
1331
+ .new-folder-btn {
1332
+ font-size: 11px; opacity: 0.7; background: none; border: none; color: inherit;
1333
+ cursor: pointer; white-space: nowrap; padding: 0;
1334
+ }
1335
+ .new-folder-btn:hover { opacity: 1; }
1336
+ .new-folder-row {
1337
+ padding: 8px 20px; display: flex; align-items: center; gap: 8px;
1338
+ border-top: 1px solid var(--border);
1339
+ }
1340
+ .new-folder-row input[type='text'] {
1341
+ flex: 1; padding: 5px 8px; font-size: 12px;
1342
+ border: 1px solid var(--border-strong); border-radius: 6px; background: none; color: inherit;
1343
+ }
1344
+ .new-folder-row button {
1345
+ font-size: 11px; padding: 5px 10px; border: 1px solid var(--border-strong); background: none;
1346
+ color: inherit; border-radius: 6px; cursor: pointer;
1347
+ }
1348
+ .browser {
1349
+ flex: 1; overflow-y: auto; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
1350
+ min-height: 200px;
1351
+ }
1352
+ .entry {
1353
+ padding: 8px 20px; cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 8px;
1354
+ }
1355
+ .entry:hover { background: var(--hover); }
1356
+ .entry .icon { opacity: 0.6; }
1357
+ .up { opacity: 0.7; }
1358
+ .empty { padding: 16px 20px; opacity: 0.6; font-size: 13px; }
1359
+ .footer { padding: 14px 20px; display: flex; flex-direction: column; gap: 10px; }
1360
+ .selected-row { font-size: 12px; }
1361
+ .selected-row .path { font-family: monospace; opacity: 0.85; word-break: break-all; }
1362
+ label { font-size: 12px; opacity: 0.7; display: block; margin-bottom: 4px; }
1363
+ input[type='text'] {
1364
+ width: 100%; box-sizing: border-box; padding: 7px 9px; font-size: 13px;
1365
+ border: 1px solid var(--border-strong); border-radius: 6px; background: none; color: inherit;
1366
+ }
1367
+ .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
1368
+ button.primary {
1369
+ background: var(--accent); border: 1px solid var(--accent); color: var(--accent-fg); padding: 7px 16px;
1370
+ border-radius: 6px; cursor: pointer; font-size: 13px;
1371
+ }
1372
+ button.primary:disabled { opacity: 0.5; cursor: default; }
1373
+ button.secondary {
1374
+ background: none; border: 1px solid var(--border-strong); color: inherit; padding: 7px 16px;
1375
+ border-radius: 6px; cursor: pointer; font-size: 13px;
1376
+ }
1377
+ .error { color: var(--danger); font-size: 12px; }
1378
+ .source-toggle { display: flex; gap: 8px; padding: 0 20px 12px; }
1379
+ .source-toggle button {
1380
+ flex: 1; padding: 8px; border: 1px solid var(--border-strong); background: none; color: inherit;
1381
+ border-radius: 6px; cursor: pointer; font-size: 13px;
1382
+ }
1383
+ .source-toggle button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
1384
+ .ff-body { padding: 4px 20px 14px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
1385
+ .ff-hint { font-size: 12px; opacity: 0.7; }
1386
+ .ff-connected-row {
1387
+ font-size: 12px; display: flex; align-items: center; gap: 6px; padding: 6px 0;
1388
+ }
1389
+ .ff-connected-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }
1390
+ .ff-folder-list { border: 1px solid var(--border); border-radius: 6px; max-height: 220px; overflow-y: auto; }
1391
+ .ff-folder-entry {
1392
+ padding: 8px 12px; cursor: pointer; font-size: 13px; font-family: monospace;
1393
+ }
1394
+ .ff-folder-entry:hover { background: var(--hover); }
1395
+ .ff-folder-entry.selected { background: var(--accent); color: var(--accent-fg); }
1396
+ .ff-empty { padding: 12px; opacity: 0.6; font-size: 13px; }
1397
+ .ff-widget-slot { display: flex; }
1398
+ `}constructor(){super(),new Y(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#e.set(this.defaultKind),this.#C()}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this.#f)}async#C(e){const t=new URLSearchParams;e&&t.set("path",e),this.#g.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)}#P(){this.#g.set(!this.#g.value),this.#C(this.#s.value)}#z(){this.#u.set(""),this.#v.set(!0)}#I(){this.#v.set(!1),this.#u.set("")}async#N(){const e=this.#u.value.trim();if(e){this.#i.set("");try{const t=await fetch("/api/fs/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:this.#s.value,name:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to create folder");return}this.#v.set(!1),this.#u.set(""),await this.#C(this.#s.value)}catch(t){this.#i.set(t.message)}}}#j(){this.#p.set(this.#s.value),this.#l.value||this.#l.set(this.#s.value.split("/").filter(Boolean).pop()??"")}async#G(){const e=this.#p.value||this.#s.value;if(e){this.#a.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.#l.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.#a.set(!1)}}}async#J(){if(this.#d.value)return;const{folderfooMode:e,folderfooHost:t}=await j();if(e==="off"||!t)return;let s=null;try{s=localStorage.getItem("folderfoo_token")}catch{}s&&(this.#o.set(t),this.#m.set(L),this.#w.set(!0),this.#H(s))}async#q(){if(!this.#o.value){this.#i.set("enter a server URL first");return}this.#i.set("");try{await re(()=>import(`${this.#o.value}/elements/folderfoo-profile-circle.js`),[]),this.#b.set(!0),this.#k.set(""),await this.updateComplete;const e=this.renderRoot.querySelector(".ff-widget-slot");if(e&&!e.querySelector("folderfoo-profile-circle")){const t=document.createElement("folderfoo-profile-circle");t.setAttribute("app-name","Memory Bucket"),e.appendChild(t)}this.#f=setInterval(()=>this.#B(),800),this.#B()}catch(e){this.#k.set(e.message)}}#B(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{}!e||this.#d.value||(clearInterval(this.#f),this.#H(e))}async#H(e){this.#x.set(!0),this.#i.set("");try{const t=await fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:this.#o.value,token:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to persist folderfoo session");return}this.#d.set(!0),this.#m.set(L),await this.#M()}finally{this.#x.set(!1)}}async#M(e,t){this.#_.set(!0),this.#i.set("");try{const s=new URLSearchParams({server:this.#o.value,tenantId:this.#m.value});e&&s.set("owner",e),t&&s.set("rootFolder",t);const i=await fetch(`/api/folderfoo/folders?${s.toString()}`),n=await i.json();if(!i.ok){this.#i.set(n.error??"failed to list folderfoo folders");return}this.#$.set(n)}finally{this.#_.set(!1)}}async#Q(){this.#S.set(!0),this.#i.set("");try{const e=new URLSearchParams({server:this.#o.value,tenantId:this.#m.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.#E.set(s)}finally{this.#S.set(!1)}}#U(e){this.#T.set(e),this.#R.set(null),this.#h.set(""),this.#y.set(""),e==="shared"&&this.#E.value.length===0?this.#Q():e==="mine"&&this.#M()}#F(e){this.#R.set(e),this.#M(e.owner,e.path)}#O(e,t){this.#h.set(e),this.#y.set(t??""),this.#l.value||this.#l.set(e.split("/").filter(Boolean).pop()??this.#m.value)}#K(e){this.#O(e.path,e.owner)}async#V(){if(this.#h.value){this.#a.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.#l.value||void 0,server:this.#o.value,tenantId:this.#m.value,folderPath:this.#h.value,owner:this.#y.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.#a.set(!1)}}}#W(){const e=this.#n.value;return l`
1399
+ <div class="breadcrumb-row">
1400
+ <div class="breadcrumb">${this.#s.value}</div>
1401
+ <button class="new-folder-btn" @click=${()=>this.#z()}>+ New folder</button>
1402
+ <label class="hidden-toggle">
1403
+ <input type="checkbox" .checked=${this.#g.value} @change=${()=>this.#P()} />
1404
+ Show hidden
1405
+ </label>
1406
+ </div>
1407
+ ${this.#v.value?l`
1408
+ <div class="new-folder-row">
1409
+ <input
1410
+ type="text"
1411
+ placeholder="Folder name"
1412
+ .value=${this.#u.value}
1413
+ @input=${t=>this.#u.set(t.target.value)}
1414
+ @keydown=${t=>{t.key==="Enter"&&this.#N(),t.key==="Escape"&&this.#I()}}
1415
+ />
1416
+ <button @click=${()=>this.#N()}>Create</button>
1417
+ <button @click=${()=>this.#I()}>Cancel</button>
1418
+ </div>
1419
+ `:""}
1420
+ <div class="browser">
1421
+ ${this.#r.value?l`<div class="entry up" @click=${()=>this.#C(this.#r.value)}>
1422
+ <span class="icon">📁</span> ..
1423
+ </div>`:""}
1424
+ ${e.length===0&&!this.#r.value?l`<div class="empty">No subdirectories here.</div>`:e.map(t=>l`<div class="entry" @click=${()=>this.#C(t.path)}>
1425
+ <span class="icon">📁</span> ${t.name}
1426
+ </div>`)}
1427
+ </div>
1428
+ <div class="footer">
1429
+ <button class="secondary" @click=${()=>this.#j()}>
1430
+ Select this folder
1431
+ </button>
1432
+ ${this.#p.value?l`<div class="selected-row">Selected: <span class="path">${this.#p.value}</span></div>`:""}
1433
+ <div>
1434
+ <label>Folder name</label>
1435
+ <input
1436
+ type="text"
1437
+ .value=${this.#l.value}
1438
+ placeholder="e.g. personal, company"
1439
+ @input=${t=>this.#l.set(t.target.value)}
1440
+ />
1441
+ </div>
1442
+ ${this.#i.value?l`<div class="error">${this.#i.value}</div>`:""}
1443
+ <div class="actions">
1444
+ <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
1445
+ <button
1446
+ class="primary"
1447
+ ?disabled=${!this.#p.value||this.#a.value}
1448
+ @click=${()=>this.#G()}
1449
+ >
1450
+ ${this.#a.value?"Adding…":"Add folder"}
1451
+ </button>
1452
+ </div>
1453
+ </div>
1454
+ `}#Y(){const e=this.#$.value;if(this.#w.value&&!this.#d.value)return l`
1455
+ <div class="ff-body">
1456
+ <div class="ff-connected-row"><span class="ff-connected-dot"></span> Already signed in to ${this.#o.value} — connecting…</div>
1457
+ ${this.#i.value?l`<div class="error">${this.#i.value}</div>`:""}
1458
+ <div class="actions">
1459
+ <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
1460
+ </div>
1461
+ </div>
1462
+ `;if(!this.#d.value)return l`
1463
+ <div class="ff-body">
1464
+ <div class="ff-hint">
1465
+ Sign in to a folderfoo server to mount one of your folders (or a folder shared with you) as a
1466
+ ${this.#e.value==="skill"?"skill":"memory"} source. Content stays live-synced from folderfoo —
1467
+ reads and writes go straight through, with a local cache for fast search.
1468
+ </div>
1469
+ <div>
1470
+ <label>Server URL</label>
1471
+ <input
1472
+ type="text"
1473
+ .value=${this.#o.value}
1474
+ placeholder="https://folderfoo.example.com"
1475
+ ?disabled=${this.#b.value}
1476
+ @input=${i=>this.#o.set(i.target.value)}
1477
+ @keydown=${i=>i.key==="Enter"&&this.#q()}
1478
+ />
1479
+ </div>
1480
+ ${this.#b.value?l`
1481
+ <div class="ff-hint">Sign in below (this is folderfoo's own login widget, same one every folderfoo app uses):</div>
1482
+ <div class="ff-widget-slot"></div>
1483
+ ${this.#x.value?l`<div class="ff-hint">Finishing connection…</div>`:""}
1484
+ `:l`
1485
+ <div class="actions" style="justify-content: flex-start; margin-top: 0;">
1486
+ <button class="secondary" @click=${()=>this.#q()}>Continue</button>
1487
+ </div>
1488
+ `}
1489
+ ${this.#k.value?l`<div class="error">${this.#k.value}</div>`:""}
1490
+ ${this.#i.value?l`<div class="error">${this.#i.value}</div>`:""}
1491
+ <div class="actions">
1492
+ <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
1493
+ </div>
1494
+ </div>
1495
+ `;const t=this.#E.value,s=this.#R.value;return l`
1496
+ <div class="ff-body">
1497
+ <div class="ff-connected-row"><span class="ff-connected-dot"></span> Connected to ${this.#o.value}</div>
1498
+ <div class="kind-toggle">
1499
+ <button
1500
+ class=${this.#T.value==="mine"?"active":""}
1501
+ @click=${()=>this.#U("mine")}
1502
+ >
1503
+ My folders
1504
+ </button>
1505
+ <button
1506
+ class=${this.#T.value==="shared"?"active":""}
1507
+ @click=${()=>this.#U("shared")}
1508
+ >
1509
+ Shared with me
1510
+ </button>
1511
+ </div>
1512
+ ${this.#T.value==="mine"?l`
1513
+ ${e.length>0?l`
1514
+ <div class="ff-folder-list">
1515
+ ${e.map(i=>l`<div
1516
+ class="ff-folder-entry ${this.#h.value===i.path&&!this.#y.value?"selected":""}"
1517
+ @click=${()=>this.#O(i.path)}
1518
+ >
1519
+ ${i.path}
1520
+ </div>`)}
1521
+ </div>
1522
+ `:this.#_.value?l`<div class="ff-hint">Loading folders…</div>`:l`<div class="ff-empty">No folders found.</div>`}
1523
+ `:s?l`
1524
+ <div class="breadcrumb-row">
1525
+ <div class="breadcrumb">${s.owner}:${s.path}</div>
1526
+ <button class="new-folder-btn" @click=${()=>this.#U("shared")}>← Back</button>
1527
+ </div>
1528
+ <div
1529
+ class="ff-folder-entry ${this.#h.value===s.path&&this.#y.value===s.owner?"selected":""}"
1530
+ @click=${()=>this.#K(s)}
1531
+ >
1532
+ (connect this folder itself)
1533
+ </div>
1534
+ ${e.length>0?l`
1535
+ <div class="ff-folder-list">
1536
+ ${e.map(i=>l`<div
1537
+ class="ff-folder-entry ${this.#h.value===i.path&&this.#y.value===s.owner?"selected":""}"
1538
+ @click=${()=>this.#O(i.path,s.owner)}
1539
+ >
1540
+ ${i.path}
1541
+ </div>`)}
1542
+ </div>
1543
+ `:this.#_.value?l`<div class="ff-hint">Loading folders…</div>`:l`<div class="ff-empty">No subfolders.</div>`}
1544
+ `:l`
1545
+ ${t.length>0?l`
1546
+ <div class="ff-folder-list">
1547
+ ${t.map(i=>l`<div class="ff-folder-entry" @click=${()=>this.#F(i)}>
1548
+ ${i.path} <span style="opacity:0.6">— shared by ${i.owner}${i.role==="member"?" (read-only)":""}</span>
1549
+ </div>`)}
1550
+ </div>
1551
+ `:this.#S.value?l`<div class="ff-hint">Loading shared folders…</div>`:l`<div class="ff-empty">No one has shared a folder with you yet.</div>`}
1552
+ `}
1553
+ ${this.#h.value?l`<div class="selected-row">
1554
+ Selected: <span class="path">${this.#y.value?`${this.#y.value}:`:""}${this.#h.value}</span>
1555
+ </div>`:""}
1556
+ <div>
1557
+ <label>Folder name</label>
1558
+ <input
1559
+ type="text"
1560
+ .value=${this.#l.value}
1561
+ placeholder="e.g. team-qa"
1562
+ @input=${i=>this.#l.set(i.target.value)}
1563
+ />
1564
+ </div>
1565
+ ${this.#i.value?l`<div class="error">${this.#i.value}</div>`:""}
1566
+ <div class="actions">
1567
+ <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
1568
+ <button
1569
+ class="primary"
1570
+ ?disabled=${!this.#h.value||this.#a.value}
1571
+ @click=${()=>this.#V()}
1572
+ >
1573
+ ${this.#a.value?"Connecting…":"Connect folder"}
1574
+ </button>
1575
+ </div>
1576
+ </div>
1577
+ `}render(){return l`
1578
+ <div class="backdrop" @click=${e=>e.target===e.currentTarget&&this.onCancel()}>
1579
+ <div class="modal">
1580
+ <div class="header"><h2>Add a folder</h2></div>
1581
+ ${this.lockKind?l``:l`
1582
+ <div class="kind-toggle">
1583
+ <button
1584
+ class=${this.#e.value==="skill"?"active":""}
1585
+ @click=${()=>this.#e.set("skill")}
1586
+ >
1587
+ Skill folder
1588
+ </button>
1589
+ <button
1590
+ class=${this.#e.value==="memory"?"active":""}
1591
+ @click=${()=>this.#e.set("memory")}
1592
+ >
1593
+ Memory folder
1594
+ </button>
1595
+ </div>
1596
+ `}
1597
+ <div class="source-toggle">
1598
+ <button class=${this.#t.value==="local"?"active":""} @click=${()=>this.#t.set("local")}>
1599
+ Local folder
1600
+ </button>
1601
+ <button
1602
+ class=${this.#t.value==="folderfoo"?"active":""}
1603
+ @click=${()=>{this.#t.set("folderfoo"),this.#J()}}
1604
+ >
1605
+ Connect folderfoo
1606
+ </button>
1607
+ </div>
1608
+ ${this.#t.value==="local"?this.#W():this.#Y()}
1609
+ </div>
1610
+ </div>
1611
+ `}}customElements.define("add-folder-modal",Vi);function pt(r){const e=Date.now()-r,t=Math.floor(e/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;const s=Math.floor(t/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}class Wi extends k{static{this.properties={channels:{attribute:!1},selected:{attribute:!1},detail:{attribute:!1},loading:{attribute:!1},onSelect:{attribute:!1},onRefresh:{attribute:!1}}}static{this.styles=S`
1612
+ :host { display: flex; flex: 1 1 auto; min-height: 0; }
1613
+ .nav {
1614
+ flex: 0 0 260px;
1615
+ overflow-y: auto;
1616
+ border-right: 1px solid var(--border);
1617
+ display: flex;
1618
+ flex-direction: column;
1619
+ }
1620
+ .nav-header {
1621
+ padding: 10px 14px;
1622
+ padding-top: 46px;
1623
+ font-size: 11px;
1624
+ font-weight: 600;
1625
+ text-transform: uppercase;
1626
+ opacity: 0.6;
1627
+ background: var(--bg);
1628
+ border-bottom: 1px solid var(--border);
1629
+ display: flex;
1630
+ align-items: center;
1631
+ justify-content: space-between;
1632
+ }
1633
+ .refresh-btn {
1634
+ border: none; background: none; color: inherit; cursor: pointer; opacity: 0.6;
1635
+ font-size: 12px; padding: 2px 4px; border-radius: 4px;
1636
+ }
1637
+ .refresh-btn:hover { opacity: 1; background: var(--hover); }
1638
+ .channel-row {
1639
+ padding: 10px 14px;
1640
+ border-bottom: 1px solid var(--border);
1641
+ cursor: pointer;
1642
+ display: flex;
1643
+ flex-direction: column;
1644
+ gap: 2px;
1645
+ }
1646
+ .channel-row:hover { background: var(--hover); }
1647
+ .channel-row.active { background: var(--accent-tint); border-left: 3px solid var(--accent); padding-left: 11px; }
1648
+ .channel-name { font-size: 13px; font-weight: 600; font-family: ui-monospace, monospace; }
1649
+ .channel-meta { font-size: 11px; opacity: 0.6; }
1650
+ .empty { padding: 24px; opacity: 0.6; font-size: 13px; }
1651
+ .content-pane { flex: 1 1 auto; min-width: 0; overflow-y: auto; padding: 16px 20px; padding-top: 46px; }
1652
+ .content-header {
1653
+ display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
1654
+ margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
1655
+ }
1656
+ .content-title { font-size: 15px; font-weight: 700; font-family: ui-monospace, monospace; }
1657
+ .content-meta { font-size: 12px; opacity: 0.6; }
1658
+ .content-body {
1659
+ white-space: pre-wrap;
1660
+ word-break: break-word;
1661
+ font-family: ui-monospace, monospace;
1662
+ font-size: 13px;
1663
+ line-height: 1.5;
1664
+ }
1665
+ .no-selection {
1666
+ flex: 1 1 auto; display: flex; align-items: center; justify-content: center;
1667
+ opacity: 0.5; font-size: 13px; padding-top: 46px;
1668
+ }
1669
+ .placeholder-empty { opacity: 0.5; font-style: italic; }
1670
+ `}#e(){return!this.channels||this.channels.length===0?l`<div class="empty">No live channels right now. Channels appear here once an agent posts to one with memory_channel_post — they're ephemeral and disappear after a long idle period or server restart.</div>`:[...this.channels].sort((t,s)=>s.lastActivityAt-t.lastActivityAt).map(t=>l`
1671
+ <div
1672
+ class="channel-row ${this.selected===t.name?"active":""}"
1673
+ @click=${()=>this.onSelect(t.name)}
1674
+ >
1675
+ <span class="channel-name">${t.name}</span>
1676
+ <span class="channel-meta">${pt(t.lastActivityAt)}</span>
1677
+ </div>
1678
+ `)}#t(){return this.selected?this.loading?l`<div class="content-pane"><div class="content-meta">Loading…</div></div>`:this.detail?l`
1679
+ <div class="content-pane">
1680
+ <div class="content-header">
1681
+ <span class="content-title">${this.detail.name}</span>
1682
+ <span class="content-meta">last activity ${pt(this.detail.lastActivityAt)}</span>
1683
+ </div>
1684
+ ${this.detail.content?l`<div class="content-body">${this.detail.content}</div>`:l`<div class="placeholder-empty">Channel exists but nothing has been posted yet.</div>`}
1685
+ </div>
1686
+ `:l`<div class="content-pane"><div class="content-meta">Channel not found — it may have gone idle and been swept.</div></div>`:l`<div class="no-selection">Select a channel to view its content.</div>`}render(){return l`
1687
+ <div class="nav">
1688
+ <div class="nav-header">
1689
+ <span>Live channels</span>
1690
+ <button class="refresh-btn" title="Refresh" @click=${()=>this.onRefresh()}>⟳</button>
1691
+ </div>
1692
+ ${this.#e()}
1693
+ </div>
1694
+ ${this.#t()}
1695
+ `}}customElements.define("channel-view",Wi);function Zi(r){const e=new Map;for(const t of r){const s=t.tags.length>0?t.tags:[null];for(const i of s){const n=e.get(i);n?n.push(t):e.set(i,[t])}}return[...e.entries()].map(([t,s])=>({tag:t,items:s})).sort((t,s)=>t.tag===null?1:s.tag===null?-1:t.tag.localeCompare(s.tag))}function Gi(r,e){const t=new Map;for(const n of r){const o=t.get(n.folder);o?o.push(n):t.set(n.folder,[n])}const s=[],i=[];for(const n of e){const o=t.get(n.name);if(!o)continue;const a={folder:n,tagGroups:[{tag:null,items:o}]};(n.remote?i:s).push(a)}return{local:s,remote:i}}const Vt="mem-bucket-folder-view-mode",Wt="mem-bucket-folder-view-expanded",ut="mem-bucket-folder-view-tree-split-pct",ft="mem-bucket-folder-view-list-split-pct",gt=12,bt=40,mt=20,vt=80;function xt(r,e,t,s){const i=Number(localStorage.getItem(r));return Number.isFinite(i)&&i>=t&&i<=s?i:e}const Ji=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],Qi=[{value:"a",label:"Folder tree"},{value:"b",label:"Breadcrumb drill-down"},{value:"c",label:"Tag → Name"}];function Yi(){const r=localStorage.getItem(Vt);return r==="a"||r==="b"||r==="c"?r:"a"}function Xi(){try{const r=localStorage.getItem(Wt);if(!r)return new Set;const e=JSON.parse(r);return Array.isArray(e)?new Set(e.map(String)):new Set}catch{return new Set}}function yt(r){localStorage.setItem(Wt,JSON.stringify([...r]))}class er extends k{static{this.properties={entries:{attribute:!1},allFolders:{attribute:!1},facets:{attribute:!1},typeFilter:{attribute:!1},onTypeChange:{attribute:!1},onChanged:{attribute:!1},onDateClick:{attribute:!1},onKeyClick:{attribute:!1}}}#e=new p(Yi());#t=new p(Xi());#s=new p([]);#n=new p(null);#r=new p(null);#p=new p(xt(ut,20,gt,bt));#l=new p(xt(ft,40,mt,vt));#i=new p(null);#a=e=>this.#b(e);#g=()=>this.#k();static{this.styles=S`
1696
+ :host { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
1697
+ /* padding-right reserves room for mem-bucket-app's absolutely-positioned .header-toolbar
1698
+ overlay (rendered outside this element entirely - see its own comment), which lines up with
1699
+ this row's top-right corner via matching padding. */
1700
+ .mode-row {
1701
+ display: flex; align-items: center; gap: 8px; padding: 10px 320px 10px 16px;
1702
+ border-bottom: 1px solid var(--border); background: var(--bg-subtle);
1703
+ }
1704
+ .mode-row .filter-label { font-size: 12px; opacity: 0.6; font-weight: 600; }
1705
+ .mode-row select {
1706
+ font-size: 13px; padding: 6px 8px; height: 30px; box-sizing: border-box;
1707
+ border: 1px solid var(--border-strong); border-radius: 6px; background: none; color: inherit;
1708
+ }
1709
+ .type-toggle { display: flex; gap: 0; }
1710
+ .type-toggle button {
1711
+ border: 1px solid var(--border-strong);
1712
+ background: none;
1713
+ color: inherit;
1714
+ padding: 6px 12px;
1715
+ font-size: 13px;
1716
+ cursor: pointer;
1717
+ height: 30px;
1718
+ box-sizing: border-box;
1719
+ }
1720
+ .type-toggle button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
1721
+ .type-toggle button:first-child { border-radius: 6px 0 0 6px; }
1722
+ .type-toggle button:last-child { border-radius: 0 6px 6px 0; }
1723
+ .type-toggle button:not(:first-child) { border-left: none; }
1724
+ .body-region { display: flex; flex: 1 1 auto; min-height: 0; }
1725
+ .tree-rail { flex: 0 0 auto; overflow-y: auto; padding: 8px 0; box-sizing: border-box; }
1726
+ result-list { flex: 0 0 auto; overflow-y: auto; box-sizing: border-box; }
1727
+ detail-panel { flex: 1 1 auto; min-width: 0; overflow-y: auto; }
1728
+ .no-selection {
1729
+ flex: 1 1 auto; display: flex; align-items: center; justify-content: center;
1730
+ opacity: 0.5; font-size: 13px;
1731
+ }
1732
+ .splitter {
1733
+ flex: 0 0 auto;
1734
+ width: 6px;
1735
+ cursor: col-resize;
1736
+ background: var(--hover);
1737
+ position: relative;
1738
+ }
1739
+ .splitter:hover, .splitter.dragging { background: var(--accent-tint); }
1740
+ .splitter::after {
1741
+ content: '';
1742
+ position: absolute;
1743
+ top: 0; bottom: 0;
1744
+ left: -3px; right: -3px;
1745
+ }
1746
+ .section-header {
1747
+ padding: 8px 14px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; opacity: 0.55;
1748
+ }
1749
+ .node {
1750
+ display: flex; align-items: center; gap: 6px; padding: 6px 14px; cursor: pointer; font-size: 13px;
1751
+ border: none; background: none; color: inherit; width: 100%; text-align: left; box-sizing: border-box;
1752
+ }
1753
+ .node:hover { background: var(--hover); }
1754
+ .node.active { background: var(--accent-tint); }
1755
+ .node .caret { width: 12px; flex: 0 0 auto; opacity: 0.6; font-size: 10px; }
1756
+ .node .icon { flex: 0 0 auto; }
1757
+ .node .label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1758
+ .node .count { flex: 0 0 auto; opacity: 0.5; font-size: 11px; }
1759
+ .node.remote .icon { color: var(--accent); }
1760
+ .indent-1 { padding-left: 30px; }
1761
+ .indent-2 { padding-left: 46px; }
1762
+ .empty { padding: 24px; opacity: 0.6; font-size: 13px; }
1763
+ .breadcrumb-bar { display: flex; align-items: center; gap: 6px; padding: 8px 14px; font-size: 13px; }
1764
+ .breadcrumb-bar button {
1765
+ background: none; border: none; color: inherit; cursor: pointer; padding: 2px 4px;
1766
+ text-decoration: underline; text-underline-offset: 2px; font: inherit;
1767
+ }
1768
+ .breadcrumb-sep { opacity: 0.5; }
1769
+ .folder-card {
1770
+ display: flex; align-items: center; gap: 8px; padding: 8px 14px; cursor: pointer; font-size: 13px;
1771
+ border: none; background: none; color: inherit; width: 100%; text-align: left; box-sizing: border-box;
1772
+ }
1773
+ .folder-card:hover { background: var(--hover); }
1774
+ `}constructor(){super(),new Y(this)}#v(e){this.#e.set(e),localStorage.setItem(Vt,e),this.#t.set(new Set),yt(new Set),this.#s.set([]),this.#n.set(null),this.#r.set(null)}#u(e){this.#v(e.target.value)}#o(e,t){t.preventDefault(),this.#i.set(e),document.addEventListener("pointermove",this.#a),document.addEventListener("pointerup",this.#g)}#b(e){const t=this.#i.value;if(!t)return;const s=this.renderRoot.querySelector(".body-region");if(!s)return;const i=s.getBoundingClientRect(),n=(e.clientX-i.left)/i.width*100;if(t==="tree")this.#p.set(Math.min(bt,Math.max(gt,n)));else{const o=100-this.#p.value,a=o>0?(n-this.#p.value)/o*100:0;this.#l.set(Math.min(vt,Math.max(mt,a)))}}#k(){const e=this.#i.value;this.#i.set(null),document.removeEventListener("pointermove",this.#a),document.removeEventListener("pointerup",this.#g),e==="tree"?localStorage.setItem(ut,String(this.#p.value)):e==="list"&&localStorage.setItem(ft,String(this.#l.value))}#w(e){const t=new Set(this.#t.value);t.has(e)?t.delete(e):t.add(e),this.#t.set(t),yt(t)}#m(e,t){this.#n.set({folder:e,tag:t})}#d(e){this.#n.set(null),this.#r.set({table:e._table,id:e.id})}#x(e){this.#r.set({table:e._table,id:e.id})}#$(e,t){const s=this.#t.value.has(t),i=e.tagGroups.reduce((o,a)=>o+a.items.length,0),n=this.#n.value?.folder===e.folder.name&&this.#n.value?.tag===null;return l`
1775
+ <button class="node ${e.folder.remote?"remote":""} ${n?"active":""}" @click=${()=>this.#w(t)}>
1776
+ <span class="caret">${s?"▾":"▸"}</span>
1777
+ <span class="icon">${e.folder.remote?"☁":"📁"}</span>
1778
+ <span
1779
+ class="label"
1780
+ @click=${o=>{o.stopPropagation(),this.#m(e.folder.name,null)}}
1781
+ >${e.folder.name}</span
1782
+ >
1783
+ <span class="count">${i}</span>
1784
+ </button>
1785
+ `}#h(e){const t=(s,i)=>s.length===0?"":l`
1786
+ <div class="section-header">${i}</div>
1787
+ ${s.map(n=>{const o=`folder:${n.folder.name}`,a=this.#t.value.has(o),c=n.tagGroups[0]?.items??[];return l`
1788
+ ${this.#$(n,o)}
1789
+ ${a?c.map(d=>l`
1790
+ <button class="node indent-1" @click=${()=>this.#d(d)}>
1791
+ <span class="caret"></span>
1792
+ <span class="icon">${d._table==="skills"?"⚡":"📝"}</span>
1793
+ <span class="label">${d.name}</span>
1794
+ </button>
1795
+ `):""}
1796
+ `})}
1797
+ `;return e.local.length===0&&e.remote.length===0?l`<div class="empty">No entries.</div>`:l`${t(e.local,"Folders")}${t(e.remote,"Remote")}`}#y(e){const t=this.#s.value;if(t.length===0){const o=[...e.local,...e.remote];return o.length===0?l`<div class="empty">No entries.</div>`:o.map(a=>{const c=a.tagGroups.reduce((d,u)=>d+u.items.length,0);return l`
1798
+ <button
1799
+ class="folder-card ${a.folder.remote?"remote":""}"
1800
+ @click=${()=>this.#s.set([a.folder.name])}
1801
+ >
1802
+ <span class="icon">${a.folder.remote?"☁":"📁"}</span>
1803
+ <span class="label">${a.folder.name}</span>
1804
+ <span class="count">${c}</span>
1805
+ </button>
1806
+ `})}const s=t[0],n=[...e.local,...e.remote].find(o=>o.folder.name===s)?.tagGroups[0]?.items??[];return l`
1807
+ <div class="breadcrumb-bar">
1808
+ <button @click=${()=>this.#s.set([])}>🏠 Folders</button>
1809
+ <span class="breadcrumb-sep">›</span>
1810
+ <span>${s}</span>
1811
+ </div>
1812
+ ${n.length===0?l`<div class="empty">No entries in this folder.</div>`:n.map(o=>l`
1813
+ <button class="node" @click=${()=>this.#d(o)}>
1814
+ <span class="caret"></span>
1815
+ <span class="icon">${o._table==="skills"?"⚡":"📝"}</span>
1816
+ <span class="label">${o.name}</span>
1817
+ </button>
1818
+ `)}
1819
+ `}#_(e){return e.length===0?l`<div class="empty">No entries.</div>`:e.map(t=>{const s=`tag:${t.tag??""}`,i=this.#t.value.has(s),n=this.#n.value?.folder===null&&this.#n.value?.tag===t.tag;return l`
1820
+ <button class="node ${n?"active":""}" @click=${()=>this.#w(s)}>
1821
+ <span class="caret">${i?"▾":"▸"}</span>
1822
+ <span class="icon">${t.tag===null?"":"🏷"}</span>
1823
+ <span
1824
+ class="label"
1825
+ @click=${o=>{o.stopPropagation(),this.#m(null,t.tag)}}
1826
+ >${t.tag??"(untagged)"}</span
1827
+ >
1828
+ <span class="count">${t.items.length}</span>
1829
+ </button>
1830
+ ${i?t.items.map(o=>l`
1831
+ <button class="node indent-1" @click=${()=>this.#d(o)}>
1832
+ <span class="caret"></span>
1833
+ <span class="icon">${o._table==="skills"?"⚡":"📝"}</span>
1834
+ <span class="label">${o.name}</span>
1835
+ <span class="count">${o.folder}</span>
1836
+ </button>
1837
+ `):""}
1838
+ `})}#f(){const e=this.#n.value;return e?(this.entries??[]).filter(s=>(e.folder===null||s.folder===e.folder)&&(e.tag===null||s.tags.includes(e.tag))):[]}render(){const e=this.#e.value,t=this.entries??[],s=this.allFolders??[],i=e==="c"?null:Gi(t,s),n=e==="c"?Zi(t):null,o=this.#n.value,a=this.#r.value;return l`
1839
+ <div class="mode-row">
1840
+ <span class="filter-label">View:</span>
1841
+ <select .value=${e} @change=${c=>this.#u(c)}>
1842
+ ${Qi.map(c=>l`<option value=${c.value}>${c.label}</option>`)}
1843
+ </select>
1844
+ <div class="type-toggle">
1845
+ ${Ji.map(c=>l`
1846
+ <button
1847
+ class=${this.typeFilter===c.value?"active":""}
1848
+ @click=${()=>this.onTypeChange(c.value)}
1849
+ >
1850
+ ${c.label}
1851
+ </button>
1852
+ `)}
1853
+ </div>
1854
+ </div>
1855
+ <div class="body-region">
1856
+ <div
1857
+ class="tree-rail"
1858
+ style=${`width: ${this.#p.value}%; border-right: 1px solid var(--border);`}
1859
+ >
1860
+ ${e==="a"?this.#h(i):e==="b"?this.#y(i):this.#_(n)}
1861
+ </div>
1862
+ ${o?l`
1863
+ <div
1864
+ class="splitter ${this.#i.value==="tree"?"dragging":""}"
1865
+ @pointerdown=${c=>this.#o("tree",c)}
1866
+ ></div>
1867
+ <result-list
1868
+ style=${`width: ${this.#l.value}%; border-right: 1px solid var(--border);`}
1869
+ .results=${this.#f()}
1870
+ .showFolder=${!0}
1871
+ .onSelect=${c=>this.#x(c)}
1872
+ .selectedIds=${new Set}
1873
+ .onToggleSelect=${()=>{}}
1874
+ .onKeyClick=${this.onKeyClick}
1875
+ ></result-list>
1876
+ <div
1877
+ class="splitter ${this.#i.value==="list"?"dragging":""}"
1878
+ @pointerdown=${c=>this.#o("list",c)}
1879
+ ></div>
1880
+ `:l`
1881
+ <div
1882
+ class="splitter ${this.#i.value==="tree"?"dragging":""}"
1883
+ @pointerdown=${c=>this.#o("tree",c)}
1884
+ ></div>
1885
+ `}
1886
+ ${a?l`
1887
+ <detail-panel
1888
+ .selected=${a}
1889
+ .facets=${this.facets}
1890
+ .onChanged=${this.onChanged}
1891
+ .onTagClick=${()=>{}}
1892
+ .onFolderClick=${()=>{}}
1893
+ .onDateClick=${this.onDateClick}
1894
+ .onKeyClick=${this.onKeyClick}
1895
+ ></detail-panel>
1896
+ `:l`<div class="no-selection">Select an item to view it.</div>`}
1897
+ </div>
1898
+ `}}customElements.define("folder-view",er);const tr={system:"◐",light:"☀",dark:"☾"},sr={system:"Auto",light:"Light",dark:"Dark"};class ir 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=S`
1899
+ :host {
1900
+ display: flex;
1901
+ align-items: center;
1902
+ gap: 6px;
1903
+ flex-shrink: 0;
1904
+ font-family: system-ui, sans-serif;
1905
+ font-size: 13px;
1906
+ line-height: normal;
1907
+ color: inherit;
1908
+ }
1909
+ .theme-toggle, .reindex-toggle {
1910
+ width: 28px;
1911
+ height: 28px;
1912
+ border: 1px solid var(--border-strong);
1913
+ border-radius: 50%;
1914
+ background: var(--bg);
1915
+ color: inherit;
1916
+ cursor: pointer;
1917
+ font-size: 14px;
1918
+ line-height: 1;
1919
+ display: flex;
1920
+ align-items: center;
1921
+ justify-content: center;
1922
+ opacity: 0.75;
1923
+ font-family: inherit;
1924
+ }
1925
+ .theme-toggle:hover, .reindex-toggle:hover { opacity: 1; background: var(--hover); }
1926
+ .folderfoo-slot { display: contents; }
1927
+ .reindex-toggle:disabled { cursor: default; opacity: 0.4; }
1928
+ .reindex-toggle.spinning { animation: reindex-spin 0.8s linear infinite; }
1929
+ @keyframes reindex-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
1930
+ .channels-toggle, .folder-view-toggle, .shared-toggle {
1931
+ height: 28px;
1932
+ padding: 0 12px;
1933
+ border: 1px solid var(--border-strong);
1934
+ border-radius: 14px;
1935
+ background: var(--bg);
1936
+ color: inherit;
1937
+ cursor: pointer;
1938
+ font-size: 12px;
1939
+ line-height: 1;
1940
+ display: flex;
1941
+ align-items: center;
1942
+ gap: 5px;
1943
+ opacity: 0.75;
1944
+ font-family: inherit;
1945
+ }
1946
+ .channels-toggle:hover, .folder-view-toggle:hover, .shared-toggle:hover { opacity: 1; background: var(--hover); }
1947
+ .channels-toggle.active, .folder-view-toggle.active, .shared-toggle.active {
1948
+ background: var(--accent); border-color: var(--accent); color: var(--accent-fg); opacity: 1;
1949
+ }
1950
+ `}#e(){return l`
1951
+ <button
1952
+ class=${`reindex-toggle${this.reindexing?" spinning":""}`}
1953
+ title=${this.reindexing?"Reindexing…":"Rebuild cache from disk"}
1954
+ aria-label="Rebuild cache from disk"
1955
+ ?disabled=${this.reindexing}
1956
+ @click=${()=>this.onReindex()}
1957
+ >
1958
+
1959
+ </button>
1960
+ `}render(){return l`
1961
+ ${this.showReindex?this.#e():""}
1962
+ <button
1963
+ class="channels-toggle ${this.channelsActive?"active":""}"
1964
+ title="Live memory channels"
1965
+ @click=${()=>this.onToggleChannels()}
1966
+ >
1967
+ ⛓ Channels
1968
+ </button>
1969
+ <button
1970
+ class="folder-view-toggle ${this.folderViewActive?"active":""}"
1971
+ title="Browse by folder"
1972
+ @click=${()=>this.onToggleFolderView()}
1973
+ >
1974
+ 🗂 Folder View
1975
+ </button>
1976
+ ${this.showShared?l`
1977
+ <button
1978
+ class="shared-toggle ${this.sharedActive?"active":""}"
1979
+ title="Items shared with you"
1980
+ @click=${()=>this.onToggleShared()}
1981
+ >
1982
+ 🤝 Shared
1983
+ </button>
1984
+ `:""}
1985
+ <button
1986
+ class="theme-toggle"
1987
+ title=${`Theme: ${sr[this.theme]} (click to change)`}
1988
+ aria-label="Toggle color theme"
1989
+ @click=${()=>this.onCycleTheme()}
1990
+ >
1991
+ ${tr[this.theme]}
1992
+ </button>
1993
+ <div class="folderfoo-slot"></div>
1994
+ `}}customElements.define("app-toolbar",ir);const kt="mem-bucket-last-fork-folder";class rr extends k{constructor(){super(...arguments),this._forkOpenFor=null,this._forkFolder=localStorage.getItem(kt)??"",this._forkBusy=!1,this._forkStatus=null}static{this.properties={items:{attribute:!1},refreshing:{attribute:!1},lastRefreshSummary:{attribute:!1},memoryFolderNames:{attribute:!1},skillFolderNames:{attribute:!1},onRefresh:{attribute:!1},onDismiss:{attribute:!1},onOpen:{attribute:!1},onFork:{attribute:!1},_forkOpenFor:{state:!0},_forkFolder:{state:!0},_forkBusy:{state:!0},_forkStatus:{state:!0}}}static{this.styles=S`
1995
+ :host { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
1996
+ .header {
1997
+ display: flex; align-items: center; gap: 10px; padding: 10px 16px;
1998
+ border-bottom: 1px solid var(--border); background: var(--bg-subtle);
1999
+ }
2000
+ .header h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; opacity: 0.6; margin: 0; flex: 1 1 auto; }
2001
+ .refresh-btn {
2002
+ width: 28px; height: 28px; border: 1px solid var(--border-strong); border-radius: 50%;
2003
+ background: var(--bg); color: inherit; cursor: pointer; font-size: 14px; line-height: 1;
2004
+ display: flex; align-items: center; justify-content: center; opacity: 0.75;
2005
+ }
2006
+ .refresh-btn:hover { opacity: 1; background: var(--hover); }
2007
+ .refresh-btn:disabled { cursor: default; opacity: 0.4; }
2008
+ .refresh-btn.spinning { animation: shared-refresh-spin 0.8s linear infinite; }
2009
+ @keyframes shared-refresh-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
2010
+ .summary { font-size: 12px; opacity: 0.6; }
2011
+ .body { flex: 1 1 auto; overflow-y: auto; }
2012
+ .owner-group { border-bottom: 1px solid var(--border); }
2013
+ .owner-header { padding: 8px 16px 4px; font-size: 12px; font-weight: 600; opacity: 0.7; }
2014
+ .row {
2015
+ display: flex; align-items: center; gap: 8px; padding: 8px 16px; font-size: 13px; cursor: pointer;
2016
+ }
2017
+ .row:hover { background: var(--hover); }
2018
+ .row.revoked { opacity: 0.55; cursor: default; }
2019
+ .row .icon { flex: 0 0 auto; }
2020
+ .row .name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
2021
+ .role-badge {
2022
+ flex: 0 0 auto; font-size: 10px; padding: 1px 6px; border-radius: 10px; border: 1px solid var(--border-strong);
2023
+ opacity: 0.7; text-transform: uppercase;
2024
+ }
2025
+ .revoked-badge {
2026
+ flex: 0 0 auto; font-size: 11px; opacity: 0.8; font-style: italic;
2027
+ }
2028
+ .dismiss-btn {
2029
+ flex: 0 0 auto; border: none; background: none; color: inherit; cursor: pointer; opacity: 0.5; font-size: 13px;
2030
+ }
2031
+ .dismiss-btn:hover { opacity: 1; }
2032
+ .fork-btn {
2033
+ flex: 0 0 auto; font-size: 11px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--border-strong);
2034
+ background: var(--bg); color: inherit; cursor: pointer; opacity: 0.75;
2035
+ }
2036
+ .fork-btn:hover { opacity: 1; background: var(--hover); }
2037
+ .fork-row {
2038
+ display: flex; align-items: center; gap: 6px; padding: 6px 16px 10px 40px; font-size: 12px;
2039
+ }
2040
+ .fork-row select {
2041
+ font-size: 12px; padding: 3px 6px; border: 1px solid var(--border-strong); border-radius: 4px;
2042
+ background: var(--bg); color: inherit;
2043
+ }
2044
+ .fork-status { font-size: 11px; opacity: 0.75; padding: 0 16px 8px 40px; }
2045
+ .empty { padding: 24px; opacity: 0.6; font-size: 13px; text-align: center; }
2046
+ `}#e(e){const t=new Map;for(const s of e){const i=t.get(s.owner)??[];i.push(s),t.set(s.owner,i)}return t}#t(e){return e==="skill"?this.skillFolderNames??[]:this.memoryFolderNames??[]}#s(e){this._forkOpenFor=this._forkOpenFor===e.origin_id?null:e.origin_id,this._forkStatus=null;const t=this.#t(e.kind);!t.includes(this._forkFolder)&&t.length&&(this._forkFolder=t[0])}async#n(e){if(this._forkFolder){this._forkBusy=!0,this._forkStatus=null;try{const t=await this.onFork(e,this._forkFolder);this._forkStatus=t.message,t.ok&&(localStorage.setItem(kt,this._forkFolder),this._forkOpenFor=null)}finally{this._forkBusy=!1}}}#r(e){const t=e.status==="revoked",s=!t&&e.entryId!==null,i=this._forkOpenFor===e.origin_id;return l`
2047
+ <div class="row ${t?"revoked":""}" @click=${()=>s&&this.onOpen(e)}>
2048
+ <span class="icon">${e.kind==="skill"?"⚡":"📝"}</span>
2049
+ <span class="name">${e.remote_path}</span>
2050
+ ${t?l`<span class="revoked-badge">no longer shared with you</span>`:l`<span class="role-badge">${e.role}</span>`}
2051
+ ${t?"":l`<button class="fork-btn" @click=${n=>{n.stopPropagation(),this.#s(e)}}>Fork to mine</button>`}
2052
+ ${t?l`<button class="dismiss-btn" title="Dismiss" @click=${n=>{n.stopPropagation(),this.onDismiss(e.origin_id)}}>✕</button>`:""}
2053
+ </div>
2054
+ ${i?l`
2055
+ <div class="fork-row" @click=${n=>n.stopPropagation()}>
2056
+ <select .value=${this._forkFolder} @change=${n=>this._forkFolder=n.target.value}>
2057
+ ${this.#t(e.kind).map(n=>l`<option value=${n}>${n}</option>`)}
2058
+ </select>
2059
+ <button ?disabled=${this._forkBusy||!this._forkFolder} @click=${()=>this.#n(e)}>Copy here</button>
2060
+ <button @click=${()=>this._forkOpenFor=null}>Cancel</button>
2061
+ </div>
2062
+ `:""}
2063
+ ${i&&this._forkStatus?l`<div class="fork-status">${this._forkStatus}</div>`:""}
2064
+ `}render(){const e=this.items??[],t=this.#e(e),s=this.lastRefreshSummary;return l`
2065
+ <div class="header">
2066
+ <h2>Shared with me</h2>
2067
+ ${s?l`<span class="summary">${s.added} added · ${s.updated} updated · ${s.revoked} revoked · ${s.unchanged} unchanged</span>`:""}
2068
+ <button
2069
+ class="refresh-btn ${this.refreshing?"spinning":""}"
2070
+ title="Refresh — check for updates or revoked shares"
2071
+ aria-label="Refresh shared items"
2072
+ ?disabled=${this.refreshing}
2073
+ @click=${()=>this.onRefresh()}
2074
+ >
2075
+
2076
+ </button>
2077
+ </div>
2078
+ <div class="body">
2079
+ ${e.length===0?l`<div class="empty">Nothing shared with you yet. Items shared directly with you, or via a share link, appear here.</div>`:[...t.entries()].map(([i,n])=>l`
2080
+ <div class="owner-group">
2081
+ <div class="owner-header">From ${i}</div>
2082
+ ${n.map(o=>this.#r(o))}
2083
+ </div>
2084
+ `)}
2085
+ </div>
2086
+ `}}customElements.define("shared-with-me-panel",rr);function nr(r){const e=r.split(":");if(e.length===1)return{folderPath:"",name:e[0]};if(e.length===2){const[n,o]=e;return n.includes("/")?{folderPath:n,name:o}:{owner:n,folderPath:"",name:o}}const[t,s,...i]=e;return{owner:t===""?void 0:t,folderPath:s,name:i.join(":")}}const ie=new p({mode:"off",username:null});let $t=!1;function or(){if($t)return;$t=!0;const r=new EventSource("/api/folderfoo/identity-stream");r.onmessage=e=>{try{ie.set(JSON.parse(e.data))}catch{}}}let wt=!1;async function ar(r){if(wt)return;wt=!0;const{folderfooMode:e,folderfooHost:t}=await j();if(e==="off"||!t)return;const s=new URL(window.location.href),i=s.searchParams.has("shareToken"),n=s.searchParams.has("publicToken");if(!(!i&&!n)){document.addEventListener("folderfoo-share-redeemed",o=>{const a=o.detail;!a?.owner||!a?.path||a.type!=="file"||!a.originId||!a.kind||r({owner:a.owner,path:a.path,originId:a.originId,kind:a.kind,role:a.role??"member",server:t,tenantId:L})}),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([re(()=>import(`${t}/elements/auth-guard.js`),[]),re(()=>import(`${t}/elements/api-client.js`),[])]);if(a.setTenantId(L),i&&o.redeemShareTokenFromUrl(),n){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&&r({owner:d.owner,path:d.path,originId:d.originId,kind:d.kind,role:"member",server:t,tenantId:L})}}catch(o){console.error("[memory-bucket] failed to load folderfoo share-accept widgets:",o)}}}let _t=!1;const lr=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],St=[{value:"all",label:"Show all"},{value:"hide",label:"Hide"},{value:"only",label:"Only"}],cr={tags:[],statuses:[],owners:[],doc_types:[],key_types:[],folders:[]},dr={skill:[],memory:[]},Zt="mem-bucket-split-pct",Gt=20,Jt=80;function hr(){const r=Number(localStorage.getItem(Zt));return Number.isFinite(r)&&r>=Gt&&r<=Jt?r:40}const Qt="mem-bucket-theme",be=["system","light","dark"];function pr(){const r=localStorage.getItem(Qt);return r==="light"||r==="dark"?r:"system"}function Ct(r){r==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",r)}function ur(){const r=location.hash.slice(1);if(!r)return{};const e=new URLSearchParams(r),t={},s=e.get("q");s&&(t.query=s);const i=e.get("type");(i==="skill"||i==="memory"||i==="all")&&(t.typeFilter=i);const n=e.getAll("tag");n.length&&(t.activeTags=n);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 h=e.get("date_to");return h&&(t.dateTo=h),t}class fr extends k{static{this.styles=S`
2087
+ :host { display: flex; flex-direction: column; height: 100vh; position: relative; }
2088
+ /* Overlays whichever header row #renderBody() renders for the current mode (.folders-bar,
2089
+ .toolbar-bar, or folder-view's own .mode-row) - all three share the same 10px/16px padding,
2090
+ so this lines up with them pixel-for-pixel without needing to sit inside any of them. */
2091
+ .header-toolbar { position: absolute; top: 10px; right: 16px; z-index: 1; }
2092
+ .filters {
2093
+ padding: 12px 16px;
2094
+ border-bottom: 1px solid var(--border);
2095
+ display: flex;
2096
+ flex-direction: column;
2097
+ gap: 8px;
2098
+ }
2099
+ .search-field {
2100
+ position: relative;
2101
+ flex: 1 1 240px;
2102
+ max-width: 480px;
2103
+ }
2104
+ .filters input[type='search'] {
2105
+ font-size: 13px;
2106
+ padding: 6px 28px 6px 10px;
2107
+ width: 100%;
2108
+ box-sizing: border-box;
2109
+ border: 1px solid var(--border-strong);
2110
+ border-radius: 6px;
2111
+ background: none;
2112
+ color: inherit;
2113
+ height: 30px;
2114
+ }
2115
+ .filters input[type='search']::-webkit-search-cancel-button { display: none; }
2116
+ .search-clear-btn {
2117
+ position: absolute;
2118
+ right: 4px;
2119
+ top: 50%;
2120
+ transform: translateY(-50%);
2121
+ border: none;
2122
+ background: transparent;
2123
+ cursor: pointer;
2124
+ color: inherit;
2125
+ opacity: 0.6;
2126
+ font-size: 12px;
2127
+ line-height: 1;
2128
+ padding: 4px 6px;
2129
+ border-radius: 50%;
2130
+ }
2131
+ .search-clear-btn:hover { opacity: 1; background: var(--hover); }
2132
+ .date-range { display: flex; align-items: center; gap: 4px; }
2133
+ .date-range input[type='date'] {
2134
+ font-size: 13px;
2135
+ padding: 5px 8px;
2136
+ border: 1px solid var(--border-strong);
2137
+ border-radius: 6px;
2138
+ background: none;
2139
+ color: inherit;
2140
+ height: 30px;
2141
+ box-sizing: border-box;
2142
+ }
2143
+ .date-range-sep { opacity: 0.5; font-size: 12px; }
2144
+ .date-range-clear {
2145
+ position: static;
2146
+ transform: none;
2147
+ opacity: 0.6;
2148
+ font-size: 12px;
2149
+ line-height: 1;
2150
+ padding: 4px 6px;
2151
+ border: none;
2152
+ background: transparent;
2153
+ cursor: pointer;
2154
+ color: inherit;
2155
+ border-radius: 50%;
2156
+ }
2157
+ .date-range-clear:hover { opacity: 1; background: var(--hover); }
2158
+ .search-row { align-items: center; }
2159
+ .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
2160
+ .filter-label { font-size: 12px; opacity: 0.6; font-weight: 600; }
2161
+ .type-toggle { gap: 0; }
2162
+ .type-toggle button {
2163
+ border: 1px solid var(--border-strong);
2164
+ background: none;
2165
+ color: inherit;
2166
+ padding: 6px 12px;
2167
+ font-size: 13px;
2168
+ cursor: pointer;
2169
+ height: 30px;
2170
+ box-sizing: border-box;
2171
+ }
2172
+ .type-toggle button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
2173
+ .type-toggle button:first-child { border-radius: 6px 0 0 6px; }
2174
+ .type-toggle button:last-child { border-radius: 0 6px 6px 0; }
2175
+ .type-toggle button:not(:first-child) { border-left: none; }
2176
+ .body-region { display: flex; flex: 1 1 auto; min-height: 0; }
2177
+ result-list { overflow-y: auto; flex: 0 0 auto; }
2178
+ detail-panel { overflow-y: auto; flex: 1 1 auto; min-width: 0; }
2179
+ .splitter {
2180
+ flex: 0 0 auto;
2181
+ width: 6px;
2182
+ cursor: col-resize;
2183
+ background: var(--hover);
2184
+ position: relative;
2185
+ }
2186
+ .splitter:hover, .splitter.dragging { background: var(--accent-tint); }
2187
+ .splitter::after {
2188
+ content: '';
2189
+ position: absolute;
2190
+ top: 0; bottom: 0;
2191
+ left: -3px; right: -3px;
2192
+ }
2193
+ label.small { font-size: 12px; opacity: 0.7; }
2194
+ /* padding-right reserves room for .header-toolbar (an absolutely-positioned overlay, so it
2195
+ takes no space in this row's own flex layout) so wrapped folder chips don't run under it. */
2196
+ .folders-bar {
2197
+ display: flex;
2198
+ gap: 6px;
2199
+ align-items: center;
2200
+ flex-wrap: wrap;
2201
+ padding: 10px 320px 10px 16px;
2202
+ border-bottom: 1px solid var(--border);
2203
+ background: var(--bg-subtle);
2204
+ }
2205
+ .folders-bar .folder-chips {
2206
+ display: flex;
2207
+ gap: 6px;
2208
+ align-items: center;
2209
+ flex-wrap: wrap;
2210
+ flex: 1 1 auto;
2211
+ min-width: 0;
2212
+ }
2213
+ .toolbar-bar {
2214
+ display: flex;
2215
+ align-items: center;
2216
+ padding: 10px 16px;
2217
+ border-bottom: 1px solid var(--border);
2218
+ background: var(--bg-subtle);
2219
+ }
2220
+ .folder-chip {
2221
+ border: 1px solid var(--border-strong); border-radius: 999px; padding: 3px 8px 3px 10px; font-size: 12px;
2222
+ cursor: pointer; background: none; color: inherit; display: inline-flex; align-items: center; gap: 6px;
2223
+ }
2224
+ /* Active chips invert to a solid white fill with dark text in both themes, so they read
2225
+ clearly against remote chips' accent outline instead of blending into a similar tint. */
2226
+ .folder-chip.active { background: #ffffff; border-color: var(--purple); color: #111111; }
2227
+ /* Remote (folderfoo) folders get the accent color instead of the default border, so they're
2228
+ visually distinct from local folders at a glance — active-state purple still wins when both apply. */
2229
+ .folder-chip.remote { border-color: var(--accent); color: var(--accent); }
2230
+ .folder-chip.remote.active { background: #ffffff; border-color: var(--purple); color: #111111; }
2231
+ .folder-chip .remote-dot {
2232
+ width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0;
2233
+ }
2234
+ .folder-chip.active .remote-dot { background: var(--purple); }
2235
+ .folder-chip .kind {
2236
+ opacity: 0.55; font-size: 10px;
2237
+ }
2238
+ .folder-chip .remove {
2239
+ opacity: 0.6; font-size: 12px; line-height: 1; padding: 2px; border-radius: 50%;
2240
+ }
2241
+ .folder-chip .remove:hover { opacity: 1; background: var(--hover-strong); }
2242
+ .add-folder-btn {
2243
+ border: 1px dashed var(--border-strong); border-radius: 999px; padding: 3px 10px; font-size: 12px;
2244
+ cursor: pointer; background: none; color: inherit; opacity: 0.75;
2245
+ }
2246
+ .add-folder-btn:hover { opacity: 1; }
2247
+ .folderfoo-open-banner {
2248
+ display: flex; align-items: center; justify-content: space-between; gap: 12px;
2249
+ padding: 8px 16px; font-size: 12px; background: var(--accent-tint); border-bottom: 1px solid var(--border);
2250
+ }
2251
+ .folderfoo-open-banner .dismiss {
2252
+ background: none; border: none; color: inherit; cursor: pointer; opacity: 0.6; padding: 2px; border-radius: 50%;
2253
+ }
2254
+ .folderfoo-open-banner .dismiss:hover { opacity: 1; background: var(--hover-strong); }
2255
+ .first-run {
2256
+ display: flex; flex-direction: column; align-items: center; justify-content: center;
2257
+ flex: 1 1 auto; gap: 16px; text-align: center; padding: 24px;
2258
+ }
2259
+ .first-run h1 { font-size: 18px; margin: 0; }
2260
+ .first-run p { opacity: 0.7; font-size: 13px; max-width: 420px; margin: 0; }
2261
+ select {
2262
+ font-size: 13px;
2263
+ padding: 6px 8px;
2264
+ height: 30px;
2265
+ box-sizing: border-box;
2266
+ border: 1px solid var(--border-strong);
2267
+ border-radius: 6px;
2268
+ background: none;
2269
+ color: inherit;
2270
+ }
2271
+ .bulk-bar {
2272
+ display: flex;
2273
+ gap: 8px;
2274
+ align-items: center;
2275
+ padding: 6px 16px;
2276
+ border-bottom: 1px solid var(--border);
2277
+ background: var(--accent-tint);
2278
+ font-size: 12px;
2279
+ }
2280
+ .bulk-bar button {
2281
+ font-size: 11px;
2282
+ padding: 4px 10px;
2283
+ border: 1px solid var(--border);
2284
+ background: transparent;
2285
+ color: inherit;
2286
+ border-radius: 4px;
2287
+ cursor: pointer;
2288
+ }
2289
+ .bulk-bar button.danger { border-color: var(--danger); color: var(--danger); }
2290
+ `}#e=ur();#t=new p(this.#e.query??"");#s=new p(this.#e.typeFilter??"all");#n=new p(this.#e.activeTags??[]);#r=new p(this.#e.activeFolders??[]);#p=new p([]);#l=new p(cr);#i=new p(null);#a=new p(dr);#g=new p(!1);#v=new p("");#u=new p(!1);#o=new p(hr());#b=new p("");#k=new p(!1);#w=new p(this.#e.sort??"");#m=new p(this.#e.deprecatedFilter??"all");#d=new p(this.#e.pausedFilter??"all");#x=new p(this.#e.dateFrom??"");#$=new p(this.#e.dateTo??"");#h=new p(new Set);#y=new p(pr());#_=new p(!1);#f=new p("entries");#T=new p([]);#E=new p([]);#S=new p(null);#R=new p(null);#C=new p(!1);#P=new p([]);#z=new p(!1);#I=new p(null);#N=e=>this.#H(e);#j=()=>this.#M();constructor(){super(),new Y(this),Ct(this.#y.value)}#G(e){this.#y.set(e),localStorage.setItem(Qt,e),Ct(e)}#J(){const e=be[(be.indexOf(this.#y.value)+1)%be.length];this.#G(e)}async#q(){if(!this.#_.value){this.#_.set(!0);try{await fetch("/api/rebuild-cache",{method:"POST"}),await Promise.all([this.#L(),this.#A(),this.#c()])}finally{this.#_.set(!1)}}}#B(e){e.preventDefault(),this.#k.set(!0),document.addEventListener("pointermove",this.#N),document.addEventListener("pointerup",this.#j)}#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.#o.set(Math.min(Jt,Math.max(Gt,i)))}#M(){this.#k.set(!1),document.removeEventListener("pointermove",this.#N),document.removeEventListener("pointerup",this.#j),localStorage.setItem(Zt,String(this.#o.value))}#Q=new Xe(()=>{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.#w.value&&e.set("sort",this.#w.value),this.#m.value==="hide"?e.set("deprecated","0"):this.#m.value==="only"&&e.set("deprecated","1"),this.#d.value==="hide"?e.set("paused","0"):this.#d.value==="only"&&e.set("paused","1"),this.#x.value&&e.set("date_from",this.#x.value),this.#$.value&&e.set("date_to",this.#$.value),e.toString()});#U=new Xe(()=>{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.#m.value==="hide"?e.set("deprecated","0"):this.#m.value==="only"&&e.set("deprecated","1"),this.#d.value==="hide"?e.set("paused","0"):this.#d.value==="only"&&e.set("paused","1"),this.#x.value&&e.set("date_from",this.#x.value),this.#$.value&&e.set("date_to",this.#$.value),e.toString()});#F=()=>this.#oe();#O=e=>this.#Y(e);#K=e=>this.#me(e);#V=()=>this.#ne();#W;connectedCallback(){super.connectedCallback(),this.#c(),this.#A(),this.#L().then(()=>this.#oe()),window.addEventListener("focus",this.#F),document.addEventListener("visibilitychange",this.#F),document.addEventListener("folderfoo-file-open",this.#O),document.addEventListener("folderfoo-folder-changed",this.#K),window.addEventListener("folderfoo-auth-change",this.#V),this.#ne(),or(),ar(e=>this.#ke(e)),this.#Z(),this.#W=ie.subscribe(()=>{this.#L(),this.#c(),this.#A(),this.#f.value==="shared"&&ie.value.username===null&&this.#D("entries")})}async#Y(e){const t=e.detail?.name;if(!t)return;const s=nr(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:n}=await j();if(!(i==="off"||!n))try{const o=await fetch("/api/folderfoo/resolve-open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:n,tenantId:L,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#me(e){const{path:t,action:s,newPath:i}=e.detail??{};if(!(t===void 0||!s)){if((s==="rename"||s==="move")&&i){const{folderfooHost:n}=await j();if(!n)return;try{await fetch("/api/folders/renamed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:n,oldPath:t,newPath:i})})}catch{}}this.#L()}}#ie(){return this.shadowRoot?.querySelector("app-toolbar")?.shadowRoot?.querySelector(".folderfoo-slot")??null}#re(e){const t=document.createElement("folderfoo-profile-circle");t.setAttribute("app-name","Memory Bucket"),t.setAttribute("tenant-id",L),t.style.zoom="0.875",e.appendChild(t)}async#ve(){const e=this.#ie();if(!e||e.querySelector("folderfoo-profile-circle"))return;if(_t){this.#re(e);return}if(e.hasAttribute("data-ff-attempted"))return;e.setAttribute("data-ff-attempted","");const{folderfooMode:t,folderfooHost:s}=await j();t==="off"||!s||re(()=>import(`${s}/elements/folderfoo-profile-circle.js`),[]).then(async()=>{_t=!0,await this.updateComplete;const i=this.#ie();i&&!i.querySelector("folderfoo-profile-circle")&&this.#re(i)}).catch(i=>{console.warn("folderfoo-profile-circle unavailable:",i.message)})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("focus",this.#F),document.removeEventListener("visibilitychange",this.#F),document.removeEventListener("folderfoo-file-open",this.#O),document.removeEventListener("folderfoo-folder-changed",this.#K),window.removeEventListener("folderfoo-auth-change",this.#V),this.#W?.()}async#ne(){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 j();t==="off"||!s||fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:s,token:e})}).catch(()=>{})}#X=!1;async#oe(){if(document.visibilityState==="visible"){if(this.#ee().some(e=>e.remote)&&!this.#X){this.#X=!0;try{await fetch("/api/remote-folders/resync-all",{method:"POST"})}catch{}finally{this.#X=!1}}this.#c(),this.#A(),this.#L(),this.renderRoot.querySelector("detail-panel")?.refresh?.()}}async#c(){const e=this.#Q.value;history.replaceState(null,"",e?`#${e}`:location.pathname+location.search);const t=await fetch(`/api/entries?${e}`);this.#p.set(await t.json()),this.renderRoot.querySelector("result-list")?.scrollTo(0,0),this.#f.value==="folder-view"&&this.#ae()}async#ae(){const e=await fetch(`/api/entries?${this.#U.value}`);this.#T.set(await e.json())}async#A(){const e=this.#s.value==="all"?"":`?type=${this.#s.value}`,t=await fetch(`/api/facets${e}`);this.#l.set(await t.json())}async#L(){const t=await(await fetch("/api/folders")).json();this.#a.set(t),this.#u.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.#c());const n=this.#i.value;if(n){const o=this.#fe().get(n.id);o&&!s.has(o.folder)&&this.#i.set(null)}}#D(e){this.#f.set(e),e==="channels"?this.#ce():e==="folder-view"?this.#ae():e==="shared"&&(this.#Z(),this.#le())}async#Z(){const e=await fetch("/api/shared-items");this.#P.set(e.ok?await e.json():[])}async#le(){this.#z.set(!0);try{const e=await fetch("/api/shared-items/refresh",{method:"POST"});e.ok&&this.#I.set(await e.json()),await this.#Z()}finally{this.#z.set(!1)}}async#xe(e){await fetch(`/api/shared-items/${encodeURIComponent(e)}`,{method:"DELETE"}),await this.#Z()}#ye(e){e.entryId&&(this.#i.set({table:e.kind==="skill"?"skills":"memory_docs",id:e.entryId}),this.#D("entries"))}async#ke(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.#D("shared")}async#$e(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.#c(),{ok:!0,message:`Copied into "${t}".`}):{ok:!1,message:i.error||`Fork failed (${s.status}).`}}async#ce(){const e=await fetch("/api/channels");this.#E.set(await e.json()),this.#S.value&&this.#de(this.#S.value)}async#de(e){this.#S.set(e),this.#C.set(!0);try{const t=await fetch(`/api/channels/${encodeURIComponent(e)}`);this.#R.set(t.ok?await t.json():null)}finally{this.#C.set(!1)}}#we(e){const t=this.#r.value;this.#r.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#c()}async#_e(e,t){if(t.stopPropagation(),window.prompt(`Type "${e.name}" to remove this ${e.kind} folder (files on disk are untouched):`)===e.name){this.#v.set(e.name);try{await fetch(`/api/folders/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"}),this.#r.set(this.#r.value.filter(i=>i!==e.name)),await Promise.all([this.#L(),this.#A(),this.#c()])}finally{this.#v.set("")}}}#he(e){this.#g.set(!1),this.#L(),this.#A(),this.#c(),e&&alert(e)}#ee(){return[...this.#a.value.skill,...this.#a.value.memory].sort((e,t)=>Number(e.remote)-Number(t.remote))}#pe(e){this.#s.set(e),this.#n.set([]),this.#A(),this.#c()}#Se(e){const t=this.#n.value;this.#n.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#c()}#Ce(e){this.#n.value.includes(e)||this.#n.set([...this.#n.value,e]),this.#c()}#Te(e){this.#r.value.includes(e)||this.#r.set([...this.#r.value,e]),this.#c()}#ue(e){this.#x.set(e),this.#$.set(e),this.#c()}#Ae(e){this.#t.set(e.target.value),this.#c()}#te(e){this.#t.set(e),this.#c()}#Ee(){this.#t.set(""),this.#c()}#Re(e){this.#i.set({table:e._table,id:e.id})}#Pe(e){this.#w.set(e.target.value),this.#c()}#ze(e){this.#m.set(e.target.value),this.#c()}#Ie(e){this.#d.set(e.target.value),this.#c()}#Le(e){this.#x.set(e.target.value),this.#c()}#Fe(e){this.#$.set(e.target.value),this.#c()}#Oe(){this.#x.set(""),this.#$.set(""),this.#c()}#De(e){const t=new Set(this.#h.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#h.set(t)}#fe(){return new Map(this.#p.value.map(e=>[e.id,e]))}#se(){const e=new Map,t=this.#fe();for(const s of this.#h.value){const i=t.get(s);if(!i)continue;const n=e.get(i._table)??[];n.push(s),e.set(i._table,n)}return e}async#ge(e){const t=this.#se();await Promise.all([...t.entries()].map(([s,i])=>fetch(`/api/entries/${s}/bulk/deprecated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i,deprecated:e})}))),this.#h.set(new Set),await this.#c()}async#be(e){const t=this.#se();await Promise.all([...t.entries()].map(([s,i])=>fetch(`/api/entries/${s}/bulk/paused`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i,paused:e})}))),this.#h.set(new Set),await this.#c()}async#Ne(){if(!window.confirm(`Delete ${this.#h.value.size} doc(s)? This can't be undone.`))return;const e=this.#se();await Promise.all([...e.entries()].map(([t,s])=>fetch(`/api/entries/${t}/bulk/delete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:s})}))),this.#h.set(new Set),await this.#c()}#Me(){const e=this.#f.value!=="channels"&&this.#f.value!=="shared"&&this.#u.value&&this.#ee().length>0,t=ie.value.username!==null||this.#P.value.length>0;return l`
2291
+ <app-toolbar
2292
+ .showReindex=${e}
2293
+ .reindexing=${this.#_.value}
2294
+ .channelsActive=${this.#f.value==="channels"}
2295
+ .folderViewActive=${this.#f.value==="folder-view"}
2296
+ .showShared=${t}
2297
+ .sharedActive=${this.#f.value==="shared"}
2298
+ .theme=${this.#y.value}
2299
+ .onReindex=${()=>this.#q()}
2300
+ .onToggleChannels=${()=>this.#D(this.#f.value==="channels"?"entries":"channels")}
2301
+ .onToggleFolderView=${()=>this.#D(this.#f.value==="folder-view"?"entries":"folder-view")}
2302
+ .onToggleShared=${()=>this.#D(this.#f.value==="shared"?"entries":"shared")}
2303
+ .onCycleTheme=${()=>this.#J()}
2304
+ ></app-toolbar>
2305
+ `}updated(){this.#ve()}render(){return l` <div class="header-toolbar">${this.#Me()}</div>${this.#Ue()} `}#Ue(){const e=this.#l.value,t=this.#ee();return this.#f.value==="shared"?l`
2306
+ <div class="toolbar-bar"></div>
2307
+ <shared-with-me-panel
2308
+ .items=${this.#P.value}
2309
+ .refreshing=${this.#z.value}
2310
+ .lastRefreshSummary=${this.#I.value}
2311
+ .memoryFolderNames=${this.#a.value.memory.map(s=>s.name)}
2312
+ .skillFolderNames=${this.#a.value.skill.map(s=>s.name)}
2313
+ .onRefresh=${()=>this.#le()}
2314
+ .onDismiss=${s=>this.#xe(s)}
2315
+ .onOpen=${s=>this.#ye(s)}
2316
+ .onFork=${(s,i)=>this.#$e(s,i)}
2317
+ ></shared-with-me-panel>
2318
+ `:this.#f.value==="channels"?l`
2319
+ <div class="toolbar-bar"></div>
2320
+ <channel-view
2321
+ .channels=${this.#E.value}
2322
+ .selected=${this.#S.value}
2323
+ .detail=${this.#R.value}
2324
+ .loading=${this.#C.value}
2325
+ .onSelect=${s=>this.#de(s)}
2326
+ .onRefresh=${()=>this.#ce()}
2327
+ ></channel-view>
2328
+ `:this.#f.value==="folder-view"?l`
2329
+ <folder-view
2330
+ .entries=${this.#T.value}
2331
+ .allFolders=${t}
2332
+ .facets=${e}
2333
+ .typeFilter=${this.#s.value}
2334
+ .onTypeChange=${s=>this.#pe(s)}
2335
+ .onChanged=${()=>{this.#c(),this.#A()}}
2336
+ .onDateClick=${s=>this.#ue(s)}
2337
+ .onKeyClick=${s=>this.#te(s)}
2338
+ ></folder-view>
2339
+ `:this.#u.value&&t.length===0&&!this.#g.value?l`
2340
+ <div class="toolbar-bar"></div>
2341
+ <div class="first-run">
2342
+ <h1>No folders configured yet</h1>
2343
+ <p>
2344
+ Add a folder of skills or memory docs to get started. You can add more folders later —
2345
+ e.g. a personal skills repo plus a shared company repo.
2346
+ </p>
2347
+ <button class="add-folder-btn" @click=${()=>this.#g.set(!0)}>+ Add your first folder</button>
2348
+ </div>
2349
+ ${this.#g.value?l`<add-folder-modal
2350
+ .defaultKind=${"skill"}
2351
+ .lockKind=${!1}
2352
+ .onAdded=${s=>this.#he(s)}
2353
+ .onCancel=${()=>this.#g.set(!1)}
2354
+ ></add-folder-modal>`:""}
2355
+ `:l`
2356
+ <div class="folders-bar">
2357
+ <span class="filter-label">Folders:</span>
2358
+ <div class="folder-chips">
2359
+ ${t.map(s=>l`
2360
+ <button
2361
+ class="folder-chip ${s.remote?"remote":""} ${this.#r.value.includes(s.name)?"active":""}"
2362
+ title=${s.remote?`${s.path} (remote — folderfoo)`:s.path}
2363
+ @click=${()=>this.#we(s.name)}
2364
+ >
2365
+ ${s.remote?l`<span class="remote-dot"></span>`:"📁"} ${s.name}
2366
+ <span class="kind">(${s.kind==="skill"?"s":"m"})</span>
2367
+ <span
2368
+ class="remove"
2369
+ title="Remove folder"
2370
+ @click=${i=>this.#_e(s,i)}
2371
+ >${this.#v.value===s.name?"…":"✕"}</span
2372
+ >
2373
+ </button>
2374
+ `)}
2375
+ <button class="add-folder-btn" @click=${()=>this.#g.set(!0)}>+ Add folder</button>
2376
+ </div>
2377
+ </div>
2378
+ ${this.#b.value?l`
2379
+ <div class="folderfoo-open-banner">
2380
+ ${this.#b.value}
2381
+ <button class="dismiss" @click=${()=>this.#b.set("")}>✕</button>
2382
+ </div>
2383
+ `:""}
2384
+ <div class="filters">
2385
+ <div class="row search-row">
2386
+ <div class="search-field">
2387
+ <input
2388
+ type="search"
2389
+ placeholder="Search descriptions, bodies, tags..."
2390
+ .value=${this.#t.value}
2391
+ @input=${s=>this.#Ae(s)}
2392
+ />
2393
+ ${this.#t.value?l`
2394
+ <button
2395
+ class="search-clear-btn"
2396
+ title="Clear search"
2397
+ aria-label="Clear search"
2398
+ @click=${()=>this.#Ee()}
2399
+ >
2400
+
2401
+ </button>
2402
+ `:""}
2403
+ </div>
2404
+ <div class="row type-toggle">
2405
+ ${lr.map(s=>l`
2406
+ <button
2407
+ class=${this.#s.value===s.value?"active":""}
2408
+ @click=${()=>this.#pe(s.value)}
2409
+ >
2410
+ ${s.label}
2411
+ </button>
2412
+ `)}
2413
+ </div>
2414
+ ${e.tags.length===0?l`<span class="filter-label">Tags:</span> <label class="small">no tags yet</label>`:l`
2415
+ <tag-multiselect
2416
+ .tags=${e.tags}
2417
+ .active=${this.#n.value}
2418
+ .onToggle=${s=>this.#Se(s)}
2419
+ .width=${"260px"}
2420
+ ></tag-multiselect>
2421
+ `}
2422
+ <span class="filter-label">Dates:</span>
2423
+ <div class="date-range">
2424
+ <input
2425
+ type="date"
2426
+ aria-label="From date"
2427
+ .value=${this.#x.value}
2428
+ @change=${s=>this.#Le(s)}
2429
+ />
2430
+ <span class="date-range-sep">–</span>
2431
+ <input
2432
+ type="date"
2433
+ aria-label="To date"
2434
+ .value=${this.#$.value}
2435
+ @change=${s=>this.#Fe(s)}
2436
+ />
2437
+ ${this.#x.value||this.#$.value?l`
2438
+ <button
2439
+ class="date-range-clear"
2440
+ title="Clear date range"
2441
+ aria-label="Clear date range"
2442
+ @click=${()=>this.#Oe()}
2443
+ >
2444
+
2445
+ </button>
2446
+ `:""}
2447
+ </div>
2448
+ <span class="filter-label">Sort:</span>
2449
+ <select
2450
+ .value=${this.#w.value||(this.#t.value.trim()?"relevance":"mtime_desc")}
2451
+ @change=${s=>this.#Pe(s)}
2452
+ >
2453
+ ${this.#t.value.trim()?l`<option value="relevance">Relevance</option>`:""}
2454
+ <option value="mtime_desc">Recently touched</option>
2455
+ <option value="mtime_asc">Least recently touched</option>
2456
+ <option value="created_at_asc">Oldest first</option>
2457
+ <option value="name_asc">Name</option>
2458
+ </select>
2459
+ <span class="filter-label">Deprecated:</span>
2460
+ <select .value=${this.#m.value} @change=${s=>this.#ze(s)}>
2461
+ ${St.map(s=>l`<option value=${s.value}>${s.label}</option>`)}
2462
+ </select>
2463
+ <span class="filter-label">Paused:</span>
2464
+ <select .value=${this.#d.value} @change=${s=>this.#Ie(s)}>
2465
+ ${St.map(s=>l`<option value=${s.value}>${s.label}</option>`)}
2466
+ </select>
2467
+ </div>
2468
+ </div>
2469
+ ${this.#h.value.size>0?l`
2470
+ <div class="bulk-bar">
2471
+ <span>${this.#h.value.size} selected</span>
2472
+ <button @click=${()=>this.#ge(!0)}>Mark deprecated</button>
2473
+ <button @click=${()=>this.#ge(!1)}>Un-deprecate</button>
2474
+ <button @click=${()=>this.#be(!0)}>Pause</button>
2475
+ <button @click=${()=>this.#be(!1)}>Resume</button>
2476
+ <button class="danger" @click=${()=>this.#Ne()}>Delete</button>
2477
+ <button @click=${()=>this.#h.set(new Set)}>Clear</button>
2478
+ </div>
2479
+ `:""}
2480
+ <div class="body-region">
2481
+ <result-list
2482
+ style=${`width: ${this.#o.value}%; border-right: 1px solid var(--border);`}
2483
+ .results=${this.#p.value}
2484
+ .showFolder=${t.length>1}
2485
+ .onSelect=${s=>this.#Re(s)}
2486
+ .selectedIds=${this.#h.value}
2487
+ .onToggleSelect=${s=>this.#De(s)}
2488
+ .onKeyClick=${s=>this.#te(s)}
2489
+ ></result-list>
2490
+ <div
2491
+ class="splitter ${this.#k.value?"dragging":""}"
2492
+ @pointerdown=${s=>this.#B(s)}
2493
+ ></div>
2494
+ <detail-panel
2495
+ .selected=${this.#i.value}
2496
+ .facets=${e}
2497
+ .onChanged=${()=>{this.#c(),this.#A()}}
2498
+ .onTagClick=${s=>this.#Ce(s)}
2499
+ .onFolderClick=${s=>this.#Te(s)}
2500
+ .onDateClick=${s=>this.#ue(s)}
2501
+ .onKeyClick=${s=>this.#te(s)}
2502
+ .onGone=${()=>this.#i.set(null)}
2503
+ ></detail-panel>
2504
+ </div>
2505
+ ${this.#g.value?l`<add-folder-modal
2506
+ .defaultKind=${"skill"}
2507
+ .lockKind=${!1}
2508
+ .onAdded=${s=>this.#he(s)}
2509
+ .onCancel=${()=>this.#g.set(!1)}
2510
+ ></add-folder-modal>`:""}
2511
+ `}}customElements.define("mem-bucket-app",fr);