mcp-memory-bucket 0.2.0 → 0.2.2
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.
- package/README.md +39 -0
- package/dist/client/assets/index-BxAZ48QK.js +645 -0
- package/dist/client/index.html +1 -1
- package/package.json +3 -1
- package/dist/client/assets/index-CXe_noum.js +0 -344
package/README.md
CHANGED
|
@@ -18,6 +18,21 @@ root for the full design plan.
|
|
|
18
18
|
|
|
19
19
|
## Run
|
|
20
20
|
|
|
21
|
+
### Via npx
|
|
22
|
+
|
|
23
|
+
No install needed — runs the published package directly:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npx mcp-memory-bucket
|
|
27
|
+
# or, with the flags described below:
|
|
28
|
+
npx mcp-memory-bucket --memory-dir /path/to/dir
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
This is the simplest way to point an MCP client at a memory bucket
|
|
32
|
+
without cloning this repo.
|
|
33
|
+
|
|
34
|
+
### From source
|
|
35
|
+
|
|
21
36
|
```sh
|
|
22
37
|
npm install
|
|
23
38
|
npm run build
|
|
@@ -29,6 +44,30 @@ Starts a stateless StreamableHTTP MCP server at `http://localhost:8767/mcp`
|
|
|
29
44
|
the SQLite cache is kept current by a file watcher for as long as the
|
|
30
45
|
server runs.
|
|
31
46
|
|
|
47
|
+
### How the cache stays fresh
|
|
48
|
+
|
|
49
|
+
The cache is a single SQLite file, `.memory-bucket-cache.sqlite`, written
|
|
50
|
+
next to `memory-bucket.config.json` in the base directory (cwd by default,
|
|
51
|
+
or `MEMORY_BUCKET_DIR`/`--memory-dir` — see Configuration below). It's a
|
|
52
|
+
scan cache, not the source of truth — the markdown files on disk always
|
|
53
|
+
are, and the cache can be safely deleted; it's rebuilt on next startup.
|
|
54
|
+
|
|
55
|
+
- **On startup**, every configured root is fully walked and each file is
|
|
56
|
+
upserted into the cache, keyed by mtime — a file whose mtime hasn't
|
|
57
|
+
changed since it was last cached is skipped, so restarting is cheap
|
|
58
|
+
even with a large root.
|
|
59
|
+
- **While running**, each root is watched (via `chokidar`) for `add`,
|
|
60
|
+
`change`, and `unlink` events on matching files, and the cache is
|
|
61
|
+
updated incrementally as they happen — no polling, no manual reindex.
|
|
62
|
+
Only `SKILL.md` files count for skill roots; any `.md` file counts for
|
|
63
|
+
memory roots. The watcher only looks 10 directories deep. A rename
|
|
64
|
+
arrives as a delete-then-add, not a single rename event.
|
|
65
|
+
- **Adding a root** (via the web UI, or a `skill_sources`/`memory_sources`
|
|
66
|
+
entry present at startup) triggers a scan of just that root, not a
|
|
67
|
+
full rescan of every root already cached.
|
|
68
|
+
- **Removing a root** (via the web UI) drops its rows from the cache and
|
|
69
|
+
search index immediately — it never touches files on disk.
|
|
70
|
+
|
|
32
71
|
The same process also serves a browser UI at `http://localhost:8767/` for
|
|
33
72
|
searching/filtering skills and memory docs by tag, root, status, owner,
|
|
34
73
|
and fulltext (SQLite FTS5) — a way to review what's in the index without
|
|
@@ -0,0 +1,645 @@
|
|
|
1
|
+
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const n of r)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(r){const n={};return r.integrity&&(n.integrity=r.integrity),r.referrerPolicy&&(n.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?n.credentials="include":r.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function s(r){if(r.ep)return;r.ep=!0;const n=t(r);fetch(r.href,n)}})();/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/const J=globalThis,be=J.ShadowRoot&&(J.ShadyCSS===void 0||J.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ke=Symbol(),Le=new WeakMap;let et=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==ke)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(be&&e===void 0){const s=t!==void 0&&t.length===1;s&&(e=Le.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&Le.set(t,e))}return e}toString(){return this.cssText}};const vt=i=>new et(typeof i=="string"?i:i+"",void 0,ke),V=(i,...e)=>{const t=i.length===1?i[0]:e.reduce((s,r,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.")})(r)+i[n+1],i[0]);return new et(t,i,ke)},_t=(i,e)=>{if(be)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const s=document.createElement("style"),r=J.litNonce;r!==void 0&&s.setAttribute("nonce",r),s.textContent=t.cssText,i.appendChild(s)}},Me=be?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return vt(t)})(i):i;/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2017 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
+
*/const{is:St,defineProperty:At,getOwnPropertyDescriptor:Rt,getOwnPropertyNames:Et,getOwnPropertySymbols:Tt,getPrototypeOf:Pt}=Object,re=globalThis,Ie=re.trustedTypes,Ct=Ie?Ie.emptyScript:"",zt=re.reactiveElementPolyfillSupport,Q=(i,e)=>i,he={toAttribute(i,e){switch(e){case Boolean:i=i?Ct:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},tt=(i,e)=>!St(i,e),Oe={attribute:!0,type:String,converter:he,reflect:!1,useDefault:!1,hasChanged:tt};Symbol.metadata??=Symbol("metadata"),re.litPropertyMetadata??=new WeakMap;let D=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=Oe){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(),r=this.getPropertyDescriptor(e,s,t);r!==void 0&&At(this.prototype,e,r)}}static getPropertyDescriptor(e,t,s){const{get:r,set:n}=Rt(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:r,set(o){const a=r?.call(this);n?.call(this,o),this.requestUpdate(e,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Oe}static _$Ei(){if(this.hasOwnProperty(Q("elementProperties")))return;const e=Pt(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Q("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Q("properties"))){const t=this.properties,s=[...Et(t),...Tt(t)];for(const r of s)this.createProperty(r,t[r])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[s,r]of t)this.elementProperties.set(s,r)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const r=this._$Eu(t,s);r!==void 0&&this._$Eh.set(r,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 r of s)t.unshift(Me(r))}else e!==void 0&&t.push(Me(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 _t(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),r=this.constructor._$Eu(e,s);if(r!==void 0&&s.reflect===!0){const n=(s.converter?.toAttribute!==void 0?s.converter:he).toAttribute(t,s.type);this._$Em=e,n==null?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(e,t){const s=this.constructor,r=s._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const n=s.getPropertyOptions(r),o=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:he;this._$Em=r;const a=o.fromAttribute(t,n.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,s,r=!1,n){if(e!==void 0){const o=this.constructor;if(r===!1&&(n=this[e]),s??=o.getPropertyOptions(e),!((s.hasChanged??tt)(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:r,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)),r===!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[r,n]of this._$Ep)this[r]=n;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[r,n]of s){const{wrapped:o}=n,a=this[r];o!==!0||this._$AL.has(r)||a===void 0||this.C(r,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){}};D.elementStyles=[],D.shadowRootOptions={mode:"open"},D[Q("elementProperties")]=new Map,D[Q("finalized")]=new Map,zt?.({ReactiveElement:D}),(re.reactiveElementVersions??=[]).push("2.1.2");/**
|
|
10
|
+
* @license
|
|
11
|
+
* Copyright 2017 Google LLC
|
|
12
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
+
*/const xe=globalThis,De=i=>i,ee=xe.trustedTypes,Ne=ee?ee.createPolicy("lit-html",{createHTML:i=>i}):void 0,st="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,it="?"+E,Lt=`<${it}>`,z=document,W=()=>z.createComment(""),K=i=>i===null||typeof i!="object"&&typeof i!="function",me=Array.isArray,Mt=i=>me(i)||typeof i?.[Symbol.iterator]=="function",le=`[
|
|
14
|
+
\f\r]`,H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,qe=/-->/g,Ue=/>/g,T=RegExp(`>|${le}(?:([^\\s"'>=/]+)(${le}*=${le}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Be=/'/g,He=/"/g,rt=/^(?:script|style|textarea|title)$/i,It=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),b=It(1),L=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),je=new WeakMap,C=z.createTreeWalker(z,129);function nt(i,e){if(!me(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ne!==void 0?Ne.createHTML(e):e}const Ot=(i,e)=>{const t=i.length-1,s=[];let r,n=e===2?"<svg>":e===3?"<math>":"",o=H;for(let a=0;a<t;a++){const l=i[a];let c,p,h=-1,u=0;for(;u<l.length&&(o.lastIndex=u,p=o.exec(l),p!==null);)u=o.lastIndex,o===H?p[1]==="!--"?o=qe:p[1]!==void 0?o=Ue:p[2]!==void 0?(rt.test(p[2])&&(r=RegExp("</"+p[2],"g")),o=T):p[3]!==void 0&&(o=T):o===T?p[0]===">"?(o=r??H,h=-1):p[1]===void 0?h=-2:(h=o.lastIndex-p[2].length,c=p[1],o=p[3]===void 0?T:p[3]==='"'?He:Be):o===He||o===Be?o=T:o===qe||o===Ue?o=H:(o=T,r=void 0);const x=o===T&&i[a+1].startsWith("/>")?" ":"";n+=o===H?l+Lt:h>=0?(s.push(c),l.slice(0,h)+st+l.slice(h)+E+x):l+E+(h===-2?a:x)}return[nt(i,n+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};let pe=class ot{constructor({strings:e,_$litType$:t},s){let r;this.parts=[];let n=0,o=0;const a=e.length-1,l=this.parts,[c,p]=Ot(e,t);if(this.el=ot.createElement(c,s),C.currentNode=this.el.content,t===2||t===3){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=C.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const h of r.getAttributeNames())if(h.endsWith(st)){const u=p[o++],x=r.getAttribute(h).split(E),f=/([.?@])?(.*)/.exec(u);l.push({type:1,index:n,name:f[2],strings:x,ctor:f[1]==="."?Nt:f[1]==="?"?qt:f[1]==="@"?Ut:ne}),r.removeAttribute(h)}else h.startsWith(E)&&(l.push({type:6,index:n}),r.removeAttribute(h));if(rt.test(r.tagName)){const h=r.textContent.split(E),u=h.length-1;if(u>0){r.textContent=ee?ee.emptyScript:"";for(let x=0;x<u;x++)r.append(h[x],W()),C.nextNode(),l.push({type:2,index:++n});r.append(h[u],W())}}}else if(r.nodeType===8)if(r.data===it)l.push({type:2,index:n});else{let h=-1;for(;(h=r.data.indexOf(E,h+1))!==-1;)l.push({type:7,index:n}),h+=E.length-1}n++}}static createElement(e,t){const s=z.createElement("template");return s.innerHTML=e,s}};function N(i,e,t=i,s){if(e===L)return e;let r=s!==void 0?t._$Co?.[s]:t._$Cl;const n=K(e)?void 0:e._$litDirective$;return r?.constructor!==n&&(r?._$AO?.(!1),n===void 0?r=void 0:(r=new n(i),r._$AT(i,t,s)),s!==void 0?(t._$Co??=[])[s]=r:t._$Cl=r),r!==void 0&&(e=N(i,r._$AS(i,e.values),r,s)),e}let Dt=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,r=(e?.creationScope??z).importNode(t,!0);C.currentNode=r;let n=C.nextNode(),o=0,a=0,l=s[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new F(n,n.nextSibling,this,e):l.type===1?c=new l.ctor(n,l.name,l.strings,this,e):l.type===6&&(c=new Bt(n,this,e)),this._$AV.push(c),l=s[++a]}o!==l?.index&&(n=C.nextNode(),o++)}return C.currentNode=z,r}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++}};class F{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,r){this.type=2,this._$AH=m,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=r,this._$Cv=r?.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=N(this,e,t),K(e)?e===m||e==null||e===""?(this._$AH!==m&&this._$AR(),this._$AH=m):e!==this._$AH&&e!==L&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Mt(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==m&&K(this._$AH)?this._$AA.nextSibling.data=e:this.T(z.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:s}=e,r=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=pe.createElement(nt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(t);else{const n=new Dt(r,this),o=n.u(this.options);n.p(t),this.T(o),this._$AH=n}}_$AC(e){let t=je.get(e.strings);return t===void 0&&je.set(e.strings,t=new pe(e)),t}k(e){me(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,r=0;for(const n of e)r===t.length?t.push(s=new F(this.O(W()),this.O(W()),this,this.options)):s=t[r],s._$AI(n),r++;r<t.length&&(this._$AR(s&&s._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const s=De(e).nextSibling;De(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}let ne=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,r,n){this.type=1,this._$AH=m,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=m}_$AI(e,t=this,s,r){const n=this.strings;let o=!1;if(n===void 0)e=N(this,e,t,0),o=!K(e)||e!==this._$AH&&e!==L,o&&(this._$AH=e);else{const a=e;let l,c;for(e=n[0],l=0;l<n.length-1;l++)c=N(this,a[s+l],t,l),c===L&&(c=this._$AH[l]),o||=!K(c)||c!==this._$AH[l],c===m?e=m:e!==m&&(e+=(c??"")+n[l+1]),this._$AH[l]=c}o&&!r&&this.j(e)}j(e){e===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Nt=class extends ne{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===m?void 0:e}},qt=class extends ne{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==m)}},Ut=class extends ne{constructor(e,t,s,r,n){super(e,t,s,r,n),this.type=5}_$AI(e,t=this){if((e=N(this,e,t,0)??m)===L)return;const s=this._$AH,r=e===m&&s!==m||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==m&&(s===m||r);r&&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)}},Bt=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){N(this,e)}};const Ht=xe.litHtmlPolyfillSupport;Ht?.(pe,F),(xe.litHtmlVersions??=[]).push("3.3.3");const jt=(i,e,t)=>{const s=t?.renderBefore??e;let r=s._$litPart$;if(r===void 0){const n=t?.renderBefore??null;s._$litPart$=r=new F(e.insertBefore(W(),n),n,void 0,t??{})}return r._$AI(i),r};/**
|
|
16
|
+
* @license
|
|
17
|
+
* Copyright 2017 Google LLC
|
|
18
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
+
*/const $e=globalThis;let S=class extends D{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=jt(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return L}};S._$litElement$=!0,S.finalized=!0,$e.litElementHydrateSupport?.({LitElement:S});const Zt=$e.litElementPolyfillSupport;Zt?.({LitElement:S});($e.litElementVersions??=[]).push("4.2.2");var at;let ce=0;const Ze=new Set;function Qt(i){ce++;try{i()}finally{ce--,ce===0&&Wt()}}function Wt(){const i=new Set(Ze);Ze.clear();for(const e of i)e()}function Kt(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}function Vt(i){return i&&typeof i.deref=="function"}class we{static#t=0;#e;#s;#i=new Set;#r=at.#t++;name;constructor(e,t){this.#e=e,this.#s=e,this.name=t}_get(){return g.activeConsumer&&g.activeConsumer.track(this),this.#e}_set(e){return Kt(e,this.#e)?(this.#s=this.#e,this.#e=e,this._notify(),!0):!1}subscribe(e,t=!1){let s=e;return t&&(s=new WeakRef(e)),this.#i.add(s),()=>this.#i.delete(s)}_notify(){const e=[...this.#i];for(const t of e){let s;if(Vt(t)){if(s=t.deref(),!s){this.#i.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}`}}at=we;class g extends we{static#t=[];constructor(e,t){super(e,t)}static get activeConsumer(){return this.#t[this.#t.length-1]}static push(e){this.#t.push(e)}static pop(){this.#t.pop()}get(){return this._get()}set(e){Qt(()=>{this._set(e)})}get value(){return this.get()}set value(e){this.set(e)}update(e){this.set(e(this.get()))}}class Ft extends we{#t;#e=!0;#s=!1;#i=new Map;_debugParent;#r;#l=()=>{this.#e||(this.#e=!0,this._notify())};constructor(e,t,s){super(void 0,t),this.#t=e,this.#r=s?.weak??!0}track(e){if(this.#i.has(e))return;const t=e.subscribe(this.#l,this.#r);this.#i.set(e,t)}dispose(){this.#a()}#a(){for(const e of this.#i.values())e();this.#i.clear()}get(){if(g.activeConsumer&&g.activeConsumer.track(this),!this.#e)return this._get();if(this.#s)throw new Error(`Cycle detected in ${this}
|
|
20
|
+
↳ while computing ${this._debugParent??"root"}`);this.#s=!0,this.#a(),g.push(this);try{const e=this.#t();this._set(e)}finally{g.pop(),this.#e=!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 g.activeConsumer||this.get(),s}}class ye{#t;#e=new Map;_debugParent;constructor(e){this.#t=e,e.addController(this);const t=e,s=t.update,r=this;t.update=function(n){g.push(r);try{s.call(this,n)}finally{g.pop()}}}track(e){this.#e.has(e)||this.#e.set(e,e.subscribe(this.#s,!0))}#s=()=>{this.#t.requestUpdate()};hostUpdate(){for(const e of this.#e.values())e();this.#e.clear()}hostDisconnected(){for(const e of this.#e.values())e();this.#e.clear()}toString(){const e=this.#t;return`SignalWatcher(${e?.localName??e?.tagName??e?.constructor?.name??"unknown"})`}}class Gt extends S{static{this.properties={results:{attribute:!1},showRoot:{attribute:!1},onSelect:{attribute:!1}}}static{this.styles=V`
|
|
21
|
+
:host { display: block; }
|
|
22
|
+
.row { padding: 10px 14px; border-bottom: 1px solid #8882; cursor: pointer; }
|
|
23
|
+
.row:hover { background: #8881; }
|
|
24
|
+
.top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
|
|
25
|
+
.name { font-weight: 600; }
|
|
26
|
+
.meta { opacity: 0.65; font-size: 11px; white-space: nowrap; }
|
|
27
|
+
.desc { font-size: 12px; opacity: 0.8; margin-top: 3px; }
|
|
28
|
+
.tags { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
|
|
29
|
+
.tag { font-size: 10px; border: 1px solid #8886; border-radius: 999px; padding: 1px 6px; }
|
|
30
|
+
.type-badge { font-size: 10px; text-transform: uppercase; opacity: 0.6; }
|
|
31
|
+
.root-badge {
|
|
32
|
+
font-size: 10px; text-transform: uppercase; opacity: 0.9; border: 1px solid #a78bfa88;
|
|
33
|
+
color: #6d28d9; background: #a78bfa22; border-radius: 4px; padding: 0 4px;
|
|
34
|
+
}
|
|
35
|
+
@media (prefers-color-scheme: dark) {
|
|
36
|
+
.root-badge { color: #d8caff; }
|
|
37
|
+
}
|
|
38
|
+
.empty { padding: 24px; opacity: 0.6; font-size: 13px; }
|
|
39
|
+
`}render(){return!this.results||this.results.length===0?b`<div class="empty">No results.</div>`:b`
|
|
40
|
+
${this.results.map(e=>b`
|
|
41
|
+
<div class="row" @click=${()=>this.onSelect(e)}>
|
|
42
|
+
<div class="top">
|
|
43
|
+
<span class="name">${e.name}</span>
|
|
44
|
+
<span class="meta">${e.owner??"—"} · ${e.status}</span>
|
|
45
|
+
</div>
|
|
46
|
+
<div class="desc">${e.description}</div>
|
|
47
|
+
<div class="tags">
|
|
48
|
+
<span class="type-badge">${e._table==="skills"?"skill":"memory"}</span>
|
|
49
|
+
${this.showRoot&&e.root?b`<span class="root-badge">${e.root}</span>`:""}
|
|
50
|
+
${e.tags.map(t=>b`<span class="tag">${t}</span>`)}
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
`)}
|
|
54
|
+
`}}customElements.define("result-list",Gt);function ve(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var I=ve();function lt(i){I=i}var P={exec:()=>null};function O(i){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),r=e[s];return r||(r=i(s),e[s]=r),r}}function d(i,e=""){let t=typeof i=="string"?i:i.source,s={replace:(r,n)=>{let o=typeof n=="string"?n:n.source;return o=o.replace($.caret,"$1"),t=t.replace(r,o),s},getRegex:()=>new RegExp(t,e)};return s}var Xt=((i="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+i)}catch{return!1}})(),$={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:i=>new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:O(i=>new RegExp(`^ {0,${i}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:O(i=>new RegExp(`^ {0,${i}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:O(i=>new RegExp(`^ {0,${i}}(?:\`\`\`|~~~)`)),headingBeginRegex:O(i=>new RegExp(`^ {0,${i}}#`)),htmlBeginRegex:O(i=>new RegExp(`^ {0,${i}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:O(i=>new RegExp(`^ {0,${i}}>`))},Yt=/^(?:[ \t]*(?:\n|$))+/,Jt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,es=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,G=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ts=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,_e=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ct=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ht=d(ct).replace(/bull/g,_e).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(),ss=d(ct).replace(/bull/g,_e).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(),Se=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,is=/^[^\n]+/,Ae=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,rs=d(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ae).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ns=d(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,_e).getRegex(),oe="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",Re=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,os=d("^ {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",Re).replace("tag",oe).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),pt=i=>d(Se).replace("hr",G).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",i).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oe).getRegex(),as=pt(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),ls=pt(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),cs=d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ls).getRegex(),Ee={blockquote:cs,code:Jt,def:rs,fences:es,heading:ts,hr:G,html:os,lheading:ht,list:ns,newline:Yt,paragraph:as,table:P,text:is},Qe=d("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",G).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",oe).getRegex(),hs={...Ee,lheading:ss,table:Qe,paragraph:d(Se).replace("hr",G).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Qe).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",oe).getRegex()},ps={...Ee,html:d(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Re).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:P,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:d(Se).replace("hr",G).replace("heading",` *#{1,6} *[^
|
|
55
|
+
]`).replace("lheading",ht).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},us=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ds=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ut=/^( {2,}|\\)\n(?!\s*$)/,gs=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,A=/[\p{P}\p{S}]/u,q=/[\s\p{P}\p{S}]/u,X=/[^\s\p{P}\p{S}]/u,fs=d(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,q).getRegex(),bs=/[\p{Pi}\p{Ps}"']/u,dt=/(?!~)[\p{P}\p{S}]/u,ks=/(?!~)[\s\p{P}\p{S}]/u,xs=/(?:[^\s\p{P}\p{S}]|~)/u,ms=d(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Xt?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),gt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,$s=d(gt,"u").replace(/punct/g,A).getRegex(),ws=d(gt,"u").replace(/punct/g,dt).getRegex(),ys=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,vs=d(ys,"u").replace(/openQuote/g,bs).replace(/punct/g,A).getRegex(),ft="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",_s=d(ft,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Ss=d(ft,"gu").replace(/notPunctSpace/g,xs).replace(/punctSpace/g,ks).replace(/punct/g,dt).getRegex(),As="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",Rs=d(As,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Es=d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Ts="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Ps=d(Ts,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Cs=d(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,A).getRegex(),zs="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Ls=d(zs,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Ms=d(/\\(punct)/,"gu").replace(/punct/g,A).getRegex(),Is=d(/^<(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(),Os=d(Re).replace("(?:-->|$)","-->").getRegex(),Ds=d("^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",Os).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),te=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Ns=d(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",te).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),bt=d(/^!?\[(label)\]\[(ref)\]/).replace("label",te).replace("ref",Ae).getRegex(),kt=d(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ae).getRegex(),qs=d("reflink|nolink(?!\\()","g").replace("reflink",bt).replace("nolink",kt).getRegex(),We=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Te={_backpedal:P,anyPunctuation:Ms,autolink:Is,blockSkip:ms,br:ut,code:ds,del:P,delLDelim:P,delRDelim:P,emStrongLDelim:$s,emStrongRDelimAst:_s,emStrongRDelimUnd:Es,escape:us,link:Ns,nolink:kt,punctuation:fs,reflink:bt,reflinkSearch:qs,tag:Ds,text:gs,url:P},Us={...Te,emStrongLDelim:vs,emStrongRDelimAst:Rs,emStrongRDelimUnd:Ps,link:d(/^!?\[(label)\]\((.*?)\)/).replace("label",te).getRegex(),reflink:d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",te).getRegex()},ue={...Te,emStrongRDelimAst:Ss,emStrongLDelim:ws,delLDelim:Cs,delRDelim:Ls,url:d(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",We).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:d(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",We).getRegex()},Bs={...ue,br:d(ut).replace("{2,}","*").getRegex(),text:d(ue.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Y={normal:Ee,gfm:hs,pedantic:ps},j={normal:Te,gfm:ue,breaks:Bs,pedantic:Us},Hs={"&":"&","<":"<",">":">",'"':""","'":"'"},Ke=i=>Hs[i];function _(i,e){if(e){if($.escapeTest.test(i))return i.replace($.escapeReplace,Ke)}else if($.escapeTestNoEncode.test(i))return i.replace($.escapeReplaceNoEncode,Ke);return i}function Ve(i){try{i=encodeURI(i).replace($.percentDecode,"%")}catch{return null}return i}function Fe(i,e){let t=i.replace($.findPipe,(n,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),s=t.split($.splitPipe),r=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(;r<s.length;r++)s[r]=s[r].trim().replace($.slashPipe,"|");return s}function R(i,e,t){let s=i.length;if(s===0)return"";let r=0;for(;r<s&&i.charAt(s-r-1)===e;)r++;return i.slice(0,s-r)}function Ge(i){let e=i.split(`
|
|
56
|
+
`),t=e.length-1;for(;t>=0&&$.blankLine.test(e[t]);)t--;return e.length-t<=2?i:e.slice(0,t+1).join(`
|
|
57
|
+
`)}function js(i,e){if(i.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<i.length;s++)if(i[s]==="\\")s++;else if(i[s]===e[0])t++;else if(i[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function Zs(i,e=0){let t=e,s="";for(let r of i)if(r===" "){let n=4-t%4;s+=" ".repeat(n),t+=n}else s+=r,t++;return s}function Xe(i,e,t,s,r){let n=e.href,o=e.title||null,a=i[1].replace(r.other.outputLinkReplace,"$1");s.state.inLink=!0;let l={type:i[0].charAt(0)==="!"?"image":"link",raw:t,href:n,title:o,text:a,tokens:s.inlineTokens(a)};return s.state.inLink=!1,l}function Qs(i,e,t){let s=i.match(t.other.indentCodeCompensation);if(s===null)return e;let r=s[1];return e.split(`
|
|
58
|
+
`).map(n=>{let o=n.match(t.other.beginningSpace);if(o===null)return n;let[a]=o;return a.length>=r.length?n.slice(r.length):n}).join(`
|
|
59
|
+
`)}var se=class{options;rules;lexer;constructor(i){this.options=i||I}space(i){let e=this.rules.block.newline.exec(i);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(i){let e=this.rules.block.code.exec(i);if(e){let t=this.options.pedantic?e[0]:Ge(e[0]),s=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:s}}}fences(i){let e=this.rules.block.fences.exec(i);if(e){let t=e[0],s=Qs(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(i){let e=this.rules.block.heading.exec(i);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=R(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:R(e[0],`
|
|
60
|
+
`),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(i){let e=this.rules.block.hr.exec(i);if(e)return{type:"hr",raw:R(e[0],`
|
|
61
|
+
`)}}blockquote(i){let e=this.rules.block.blockquote.exec(i);if(e){let t=R(e[0],`
|
|
62
|
+
`).split(`
|
|
63
|
+
`),s="",r="",n=[];for(;t.length>0;){let o=!1,a=[],l;for(l=0;l<t.length;l++)if(this.rules.other.blockquoteStart.test(t[l]))a.push(t[l]),o=!0;else if(!o)a.push(t[l]);else break;t=t.slice(l);let c=a.join(`
|
|
64
|
+
`),p=c.replace(this.rules.other.blockquoteSetextReplace,`
|
|
65
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
66
|
+
${c}`:c,r=r?`${r}
|
|
67
|
+
${p}`:p;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,n,!0),this.lexer.state.top=h,t.length===0)break;let u=n.at(-1);if(u?.type==="code")break;if(u?.type==="blockquote"){let x=u,f=t.join(`
|
|
68
|
+
`),v=x.raw+`
|
|
69
|
+
`+f.replace(this.rules.other.blockquoteSetextReplace2,""),U=this.blockquote(v);n[n.length-1]=U,s=`${s}
|
|
70
|
+
${f}`,r=r.substring(0,r.length-x.text.length)+U.text;break}else if(u?.type==="list"){let x=u,f=x.raw+`
|
|
71
|
+
`+t.join(`
|
|
72
|
+
`),v=this.list(f);n[n.length-1]=v,s=s.substring(0,s.length-u.raw.length)+v.raw,r=r.substring(0,r.length-x.raw.length)+v.raw,t=f.substring(n.at(-1).raw.length).split(`
|
|
73
|
+
`);continue}}return{type:"blockquote",raw:s,tokens:n,text:r}}}list(i){let e=this.rules.block.list.exec(i);if(e){let t=e[1].trim(),s=t.length>1,r={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(;i;){let l=!1,c="",p="";if(!(e=n.exec(i))||this.rules.block.hr.test(i))break;c=e[0],i=i.substring(c.length);let h=Zs(e[2].split(`
|
|
74
|
+
`,1)[0],e[1].length),u=i.split(`
|
|
75
|
+
`,1)[0],x=!h.trim(),f=0;if(this.options.pedantic?(f=2,p=h.trimStart()):x?f=e[1].length+1:(f=h.search(this.rules.other.nonSpaceChar),f=f>4?1:f,p=h.slice(f),f+=e[1].length),x&&this.rules.other.blankLine.test(u)&&(c+=u+`
|
|
76
|
+
`,i=i.substring(u.length+1),l=!0),!l){let v=this.rules.other.nextBulletRegex(f),U=this.rules.other.hrRegex(f),Ce=this.rules.other.fencesBeginRegex(f),ze=this.rules.other.headingBeginRegex(f),wt=this.rules.other.htmlBeginRegex(f),yt=this.rules.other.blockquoteBeginRegex(f);for(;i;){let ae=i.split(`
|
|
77
|
+
`,1)[0],B;if(u=ae,this.options.pedantic?(u=u.replace(this.rules.other.listReplaceNesting," "),B=u):B=u.replace(this.rules.other.tabCharGlobal," "),Ce.test(u)||ze.test(u)||wt.test(u)||yt.test(u)||v.test(u)||U.test(u))break;if(B.search(this.rules.other.nonSpaceChar)>=f||!u.trim())p+=`
|
|
78
|
+
`+B.slice(f);else{if(x||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||Ce.test(h)||ze.test(h)||U.test(h))break;p+=`
|
|
79
|
+
`+u}x=!u.trim(),c+=ae+`
|
|
80
|
+
`,i=i.substring(ae.length+1),h=B.slice(f)}}r.loose||(o?r.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0)),r.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),r.raw+=c}let a=r.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let l of r.items)if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),!r.loose){let c=l.tokens.filter(h=>h.type==="space"),p=c.length>0&&c.some(h=>this.rules.other.anyLine.test(h.raw));r.loose=p}for(let l of r.items){let c=l.tokens[0];if(l.task&&(c?.type==="text"||c?.type==="paragraph")){l.text=l.text.replace(this.rules.other.listReplaceTask,""),c.raw=c.raw.replace(this.rules.other.listReplaceTask,""),c.text=c.text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(l.raw);if(p){let h={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};l.checked=h.checked,r.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=h.raw+l.tokens[0].raw,l.tokens[0].text=h.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(h)):l.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):l.tokens.unshift(h)}}else l.task&&(l.task=!1)}if(r.loose)for(let l of r.items){l.loose=!0;for(let c of l.tokens)c.type==="text"&&(c.type="paragraph")}return r}}html(i){let e=this.rules.block.html.exec(i);if(e){let t=Ge(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(i){let e=this.rules.block.def.exec(i);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"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:R(e[0],`
|
|
81
|
+
`),href:s,title:r}}}table(i){let e=this.rules.block.table.exec(i);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=Fe(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
82
|
+
`):[],n={type:"table",raw:R(e[0],`
|
|
83
|
+
`),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 r)n.rows.push(Fe(o,n.header.length).map((a,l)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:n.align[l]})));return n}}lheading(i){let e=this.rules.block.lheading.exec(i);if(e){let t=e[1].trim();return{type:"heading",raw:R(e[0],`
|
|
84
|
+
`),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(i){let e=this.rules.block.paragraph.exec(i);if(e){let t=e[1].charAt(e[1].length-1)===`
|
|
85
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(i){let e=this.rules.block.text.exec(i);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(i){let e=this.rules.inline.escape.exec(i);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(i){let e=this.rules.inline.tag.exec(i);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(i){let e=this.rules.inline.link.exec(i);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=R(t.slice(0,-1),"\\");if((t.length-n.length)%2===0)return}else{let n=js(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],r="";if(this.options.pedantic){let n=this.rules.other.pedanticHrefTitle.exec(s);n&&(s=n[1],r=n[3])}else r=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)),Xe(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(i,e){let t;if((t=this.rules.inline.reflink.exec(i))||(t=this.rules.inline.nolink.exec(i))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=e[s.toLowerCase()];if(!r){let n=t[0].charAt(0);return{type:"text",raw:n,text:n}}return Xe(t,r,t[0],this.lexer,this.rules)}}emStrong(i,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(i);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 r=[...s[0]].length-1,n,o,a=r,l=0,c=s[0][0],p=t===c,h=c==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*i.length+r);(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(r%3&&!((r+o)%3)){l+=o;continue}if(p)break}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let u=[...s[0]][0].length,x=i.slice(0,r+s.index+u+o);if(Math.min(r,o)%2){let v=x.slice(1,-1);return{type:"em",raw:x,text:v,tokens:this.lexer.inlineTokens(v)}}let f=x.slice(2,-2);return{type:"strong",raw:x,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(i){let e=this.rules.inline.code.exec(i);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),r=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&r&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(i){let e=this.rules.inline.br.exec(i);if(e)return{type:"br",raw:e[0]}}del(i,e,t=""){let s=this.rules.inline.delLDelim.exec(i);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let r=[...s[0]].length-1,n,o,a=r,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*i.length+r);(s=l.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n||(o=[...n].length,o!==r))continue;if(s[3]||s[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let c=[...s[0]][0].length,p=i.slice(0,r+s.index+c+o),h=p.slice(r,-r);return{type:"del",raw:p,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(i){let e=this.rules.inline.autolink.exec(i);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(i){let e;if(e=this.rules.inline.url.exec(i)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let r;do r=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(r!==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(i){let e=this.rules.inline.text.exec(i);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},w=class de{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||I,this.options.tokenizer=this.options.tokenizer||new se,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:$,block:Y.normal,inline:j.normal};this.options.pedantic?(t.block=Y.pedantic,t.inline=j.pedantic):this.options.gfm&&(t.block=Y.gfm,this.options.breaks?t.inline=j.breaks:t.inline=j.gfm),this.tokenizer.rules=t}static get rules(){return{block:Y,inline:j}}static lex(e,t){return new de(t).lex(e)}static lexInline(e,t){return new de(t).inlineTokens(e)}lex(e){e=e.replace($.carriageReturn,`
|
|
86
|
+
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace($.tabCharGlobal," ").replace($.spaceLine,""));let r=1/0;for(;e;){if(e.length<r)r=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+=`
|
|
87
|
+
`: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(`
|
|
88
|
+
`)?"":`
|
|
89
|
+
`)+n.raw,a.text+=`
|
|
90
|
+
`+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(`
|
|
91
|
+
`)?"":`
|
|
92
|
+
`)+n.raw,a.text+=`
|
|
93
|
+
`+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,l=e.slice(1),c;this.options.extensions.startBlock.forEach(p=>{c=p.call({lexer:this},l),typeof c=="number"&&c>=0&&(a=Math.min(a,c))}),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(`
|
|
94
|
+
`)?"":`
|
|
95
|
+
`)+n.raw,a.text+=`
|
|
96
|
+
`+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(`
|
|
97
|
+
`)?"":`
|
|
98
|
+
`)+n.raw,a.text+=`
|
|
99
|
+
`+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}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=e;if(this.tokens.links){let a=Object.keys(this.tokens.links);a.length>0&&(s=s.replace(this.tokenizer.rules.inline.reflinkSearch,l=>a.includes(l.slice(l.lastIndexOf("[")+1,-1))?"["+"a".repeat(l.length-2)+"]":l))}s=s.replace(this.tokenizer.rules.inline.anyPunctuation,a=>"+".repeat(a.length)),s=s.replace(this.tokenizer.rules.inline.blockSkip,(a,l,c)=>{let p=c?c.length:0;return a.slice(0,p)+"["+"a".repeat(a.length-p-2)+"]"}),s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let r=!1,n="",o=1/0;for(;e;){if(e.length<o)o=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(n=""),r=!1;let a;if(this.options.extensions?.inline?.some(c=>(a=c.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 c=t.at(-1);a.type==="text"&&c?.type==="text"?(c.raw+=a.raw,c.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 l=e;if(this.options.extensions?.startInline){let c=1/0,p=e.slice(1),h;this.options.extensions.startInline.forEach(u=>{h=u.call({lexer:this},p),typeof h=="number"&&h>=0&&(c=Math.min(c,h))}),c<1/0&&c>=0&&(l=e.substring(0,c+1))}if(a=this.tokenizer.inlineText(l)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(n=a.raw.slice(-1)),r=!0;let c=t.at(-1);c?.type==="text"?(c.raw+=a.raw,c.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)}},ie=class{options;parser;constructor(i){this.options=i||I}space(i){return""}code({text:i,lang:e,escaped:t}){let s=(e||"").match($.notSpaceStart)?.[0],r=i.replace($.endingNewline,"")+`
|
|
100
|
+
`;return s?'<pre><code class="language-'+_(s)+'">'+(t?r:_(r,!0))+`</code></pre>
|
|
101
|
+
`:"<pre><code>"+(t?r:_(r,!0))+`</code></pre>
|
|
102
|
+
`}blockquote({tokens:i}){return`<blockquote>
|
|
103
|
+
${this.parser.parse(i)}</blockquote>
|
|
104
|
+
`}html({text:i}){return i}def(i){return""}heading({tokens:i,depth:e}){return`<h${e}>${this.parser.parseInline(i)}</h${e}>
|
|
105
|
+
`}hr(i){return`<hr>
|
|
106
|
+
`}list(i){let e=i.ordered,t=i.start,s="";for(let o=0;o<i.items.length;o++){let a=i.items[o];s+=this.listitem(a)}let r=e?"ol":"ul",n=e&&t!==1?' start="'+t+'"':"";return"<"+r+n+`>
|
|
107
|
+
`+s+"</"+r+`>
|
|
108
|
+
`}listitem(i){return`<li>${this.parser.parse(i.tokens)}</li>
|
|
109
|
+
`}checkbox({checked:i}){return"<input "+(i?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:i}){return`<p>${this.parser.parseInline(i)}</p>
|
|
110
|
+
`}table(i){let e="",t="";for(let r=0;r<i.header.length;r++)t+=this.tablecell(i.header[r]);e+=this.tablerow({text:t});let s="";for(let r=0;r<i.rows.length;r++){let n=i.rows[r];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>
|
|
111
|
+
<thead>
|
|
112
|
+
`+e+`</thead>
|
|
113
|
+
`+s+`</table>
|
|
114
|
+
`}tablerow({text:i}){return`<tr>
|
|
115
|
+
${i}</tr>
|
|
116
|
+
`}tablecell(i){let e=this.parser.parseInline(i.tokens),t=i.header?"th":"td";return(i.align?`<${t} align="${i.align}">`:`<${t}>`)+e+`</${t}>
|
|
117
|
+
`}strong({tokens:i}){return`<strong>${this.parser.parseInline(i)}</strong>`}em({tokens:i}){return`<em>${this.parser.parseInline(i)}</em>`}codespan({text:i}){return`<code>${_(i,!0)}</code>`}br(i){return"<br>"}del({tokens:i}){return`<del>${this.parser.parseInline(i)}</del>`}link({href:i,title:e,tokens:t}){let s=this.parser.parseInline(t),r=Ve(i);if(r===null)return s;i=r;let n='<a href="'+i+'"';return e&&(n+=' title="'+_(e)+'"'),n+=">"+s+"</a>",n}image({href:i,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let r=Ve(i);if(r===null)return _(t);i=r;let n=`<img src="${i}" alt="${_(t)}"`;return e&&(n+=` title="${_(e)}"`),n+=">",n}text(i){return"tokens"in i&&i.tokens?this.parser.parseInline(i.tokens):"escaped"in i&&i.escaped?i.text:_(i.text)}},Pe=class{strong({text:i}){return i}em({text:i}){return i}codespan({text:i}){return i}del({text:i}){return i}html({text:i}){return i}text({text:i}){return i}link({text:i}){return""+i}image({text:i}){return""+i}br(){return""}checkbox({raw:i}){return i}},y=class ge{options;renderer;textRenderer;constructor(e){this.options=e||I,this.options.renderer=this.options.renderer||new ie,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Pe}static parse(e,t){return new ge(t).parse(e)}static parseInline(e,t){return new ge(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let r=e[s];if(this.options.extensions?.renderers?.[r.type]){let o=r,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=r;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 r=0;r<e.length;r++){let n=e[r];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(i){this.options=i||I}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(i){return i}postprocess(i){return i}processAllTokens(i){return i}emStrongMask(i){return i}provideLexer(i=this.block){return i?w.lex:w.lexInline}provideParser(i=this.block){return i?y.parse:y.parseInline}},Ws=class{defaults=ve();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=y;Renderer=ie;TextRenderer=Pe;Lexer=w;Tokenizer=se;Hooks=Z;constructor(...i){this.use(...i)}walkTokens(i,e){let t=[];for(let s of i)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let r=s;for(let n of r.header)t=t.concat(this.walkTokens(n.tokens,e));for(let n of r.rows)for(let o of n)t=t.concat(this.walkTokens(o.tokens,e));break}case"list":{let r=s;t=t.concat(this.walkTokens(r.items,e));break}default:{let r=s;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(n=>{let o=r[n].flat(1/0);t=t.concat(this.walkTokens(o,e))}):r.tokens&&(t=t.concat(this.walkTokens(r.tokens,e)))}}return t}use(...i){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return i.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let n=e.renderers[r.name];n?e.renderers[r.name]=function(...o){let a=r.renderer.apply(this,o);return a===!1&&(a=n.apply(this,o)),a}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let n=e[r.level];n?n.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),s.extensions=e),t.renderer){let r=this.defaults.renderer||new ie(this.defaults);for(let n in t.renderer){if(!(n in r))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let o=n,a=t.renderer[o],l=r[o];r[o]=(...c)=>{let p=a.apply(r,c);return p===!1&&(p=l.apply(r,c)),p||""}}s.renderer=r}if(t.tokenizer){let r=this.defaults.tokenizer||new se(this.defaults);for(let n in t.tokenizer){if(!(n in r))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let o=n,a=t.tokenizer[o],l=r[o];r[o]=(...c)=>{let p=a.apply(r,c);return p===!1&&(p=l.apply(r,c)),p}}s.tokenizer=r}if(t.hooks){let r=this.defaults.hooks||new Z;for(let n in t.hooks){if(!(n in r))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let o=n,a=t.hooks[o],l=r[o];Z.passThroughHooks.has(n)?r[o]=c=>{if(this.defaults.async&&Z.passThroughHooksRespectAsync.has(n))return(async()=>{let h=await a.call(r,c);return l.call(r,h)})();let p=a.call(r,c);return l.call(r,p)}:r[o]=(...c)=>{if(this.defaults.async)return(async()=>{let h=await a.apply(r,c);return h===!1&&(h=await l.apply(r,c)),h})();let p=a.apply(r,c);return p===!1&&(p=l.apply(r,c)),p}}s.hooks=r}if(t.walkTokens){let r=this.defaults.walkTokens,n=t.walkTokens;s.walkTokens=function(o){let a=[];return a.push(n.call(this,o)),r&&(a=a.concat(r.call(this,o))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(i){return this.defaults={...this.defaults,...i},this}lexer(i,e){return w.lex(i,e??this.defaults)}parser(i,e){return y.parse(i,e??this.defaults)}parseMarkdown(i){return(e,t)=>{let s={...t},r={...this.defaults,...s},n=this.onError(!!r.silent,!!r.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(r.hooks&&(r.hooks.options=r,r.hooks.block=i),r.async)return(async()=>{let o=r.hooks?await r.hooks.preprocess(e):e,a=await(r.hooks?await r.hooks.provideLexer(i):i?w.lex:w.lexInline)(o,r),l=r.hooks?await r.hooks.processAllTokens(a):a;r.walkTokens&&await Promise.all(this.walkTokens(l,r.walkTokens));let c=await(r.hooks?await r.hooks.provideParser(i):i?y.parse:y.parseInline)(l,r);return r.hooks?await r.hooks.postprocess(c):c})().catch(n);try{r.hooks&&(e=r.hooks.preprocess(e));let o=(r.hooks?r.hooks.provideLexer(i):i?w.lex:w.lexInline)(e,r);r.hooks&&(o=r.hooks.processAllTokens(o)),r.walkTokens&&this.walkTokens(o,r.walkTokens);let a=(r.hooks?r.hooks.provideParser(i):i?y.parse:y.parseInline)(o,r);return r.hooks&&(a=r.hooks.postprocess(a)),a}catch(o){return n(o)}}}onError(i,e){return t=>{if(t.message+=`
|
|
118
|
+
Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error occurred:</p><pre>"+_(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},M=new Ws;function k(i,e){return M.parse(i,e)}k.options=k.setOptions=function(i){return M.setOptions(i),k.defaults=M.defaults,lt(k.defaults),k};k.getDefaults=ve;k.defaults=I;function Ks(...i){return M.use(...i),k.defaults=M.defaults,lt(k.defaults),k}k.use=Ks;k.walkTokens=function(i,e){return M.walkTokens(i,e)};k.parseInline=M.parseInline;k.Parser=y;k.parser=y.parse;k.Renderer=ie;k.TextRenderer=Pe;k.Lexer=w;k.lexer=w.lex;k.Tokenizer=se;k.Hooks=Z;k.parse=k;k.options;k.setOptions;k.walkTokens;k.parseInline;y.parse;w.lex;/**
|
|
119
|
+
* @license
|
|
120
|
+
* Copyright 2017 Google LLC
|
|
121
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
122
|
+
*/const Vs={CHILD:2},Fs=i=>(...e)=>({_$litDirective$:i,values:e});class Gs{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)}}/**
|
|
123
|
+
* @license
|
|
124
|
+
* Copyright 2017 Google LLC
|
|
125
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
126
|
+
*/class fe extends Gs{constructor(e){if(super(e),this.it=m,e.type!==Vs.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===m||e==null)return this._t=void 0,this.it=e;if(e===L)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:[]}}}fe.directiveName="unsafeHTML",fe.resultType=1;const Xs=Fs(fe),Ye="mem-bucket-detail-view-mode";class Ys extends S{constructor(){super(...arguments),this._viewMode=localStorage.getItem(Ye)??"markdown"}static{this.properties={selected:{attribute:!1},_doc:{state:!0},_viewMode:{state:!0}}}static{this.styles=V`
|
|
127
|
+
:host { display: block; padding: 16px; }
|
|
128
|
+
h2 { margin: 0 0 4px; font-size: 16px; }
|
|
129
|
+
.meta { font-size: 12px; opacity: 0.7; margin-bottom: 12px; }
|
|
130
|
+
.source-path {
|
|
131
|
+
font-family: monospace;
|
|
132
|
+
font-size: 11px;
|
|
133
|
+
opacity: 0.6;
|
|
134
|
+
cursor: pointer;
|
|
135
|
+
word-break: break-all;
|
|
136
|
+
}
|
|
137
|
+
pre {
|
|
138
|
+
white-space: pre-wrap;
|
|
139
|
+
font-size: 12px;
|
|
140
|
+
background: #8881;
|
|
141
|
+
padding: 12px;
|
|
142
|
+
border-radius: 6px;
|
|
143
|
+
max-height: 60vh;
|
|
144
|
+
overflow-y: auto;
|
|
145
|
+
}
|
|
146
|
+
.empty { opacity: 0.5; font-size: 13px; }
|
|
147
|
+
.view-toggle {
|
|
148
|
+
display: flex;
|
|
149
|
+
gap: 4px;
|
|
150
|
+
margin-bottom: 8px;
|
|
151
|
+
}
|
|
152
|
+
.view-toggle button {
|
|
153
|
+
font-size: 11px;
|
|
154
|
+
padding: 3px 8px;
|
|
155
|
+
border: 1px solid #8884;
|
|
156
|
+
background: transparent;
|
|
157
|
+
border-radius: 4px;
|
|
158
|
+
cursor: pointer;
|
|
159
|
+
opacity: 0.6;
|
|
160
|
+
}
|
|
161
|
+
.view-toggle button.active {
|
|
162
|
+
opacity: 1;
|
|
163
|
+
background: #8882;
|
|
164
|
+
font-weight: 600;
|
|
165
|
+
}
|
|
166
|
+
.markdown-body {
|
|
167
|
+
font-size: 13px;
|
|
168
|
+
line-height: 1.5;
|
|
169
|
+
max-height: 60vh;
|
|
170
|
+
overflow-y: auto;
|
|
171
|
+
padding: 12px;
|
|
172
|
+
background: #8881;
|
|
173
|
+
border-radius: 6px;
|
|
174
|
+
}
|
|
175
|
+
.markdown-body :first-child { margin-top: 0; }
|
|
176
|
+
.markdown-body :last-child { margin-bottom: 0; }
|
|
177
|
+
.markdown-body pre {
|
|
178
|
+
background: #8882;
|
|
179
|
+
max-height: none;
|
|
180
|
+
}
|
|
181
|
+
.markdown-body code {
|
|
182
|
+
font-family: monospace;
|
|
183
|
+
font-size: 12px;
|
|
184
|
+
}
|
|
185
|
+
`}updated(e){e.has("selected")&&this.selected&&(this.#t(),this.scrollTop=0)}async#t(){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)}#e(){this._doc?.source_path&&navigator.clipboard?.writeText(this._doc.source_path)}#s(e){this._viewMode=e,localStorage.setItem(Ye,e)}render(){if(!this.selected)return b`<div class="empty">Select an entry to view its details.</div>`;if(!this._doc)return m;const e=this._doc;return b`
|
|
186
|
+
<h2>${e.name??e.key??e.id}</h2>
|
|
187
|
+
<div class="meta">
|
|
188
|
+
${e.tags?.join(", ")||"no tags"} · ${e.status}${e.owner?` · owner: ${e.owner}`:""}
|
|
189
|
+
</div>
|
|
190
|
+
<div class="meta">${e.description}</div>
|
|
191
|
+
<div class="view-toggle">
|
|
192
|
+
<button
|
|
193
|
+
class=${this._viewMode==="markdown"?"active":""}
|
|
194
|
+
@click=${()=>this.#s("markdown")}
|
|
195
|
+
>
|
|
196
|
+
Preview
|
|
197
|
+
</button>
|
|
198
|
+
<button
|
|
199
|
+
class=${this._viewMode==="raw"?"active":""}
|
|
200
|
+
@click=${()=>this.#s("raw")}
|
|
201
|
+
>
|
|
202
|
+
Raw
|
|
203
|
+
</button>
|
|
204
|
+
</div>
|
|
205
|
+
${this._viewMode==="markdown"?b`<div class="markdown-body">${Xs(k.parse(e.body??"",{async:!1}))}</div>`:b`<pre>${e.body}</pre>`}
|
|
206
|
+
<div class="source-path" title="click to copy" @click=${()=>this.#e()}>${e.source_path}</div>
|
|
207
|
+
`}}customElements.define("detail-panel",Ys);class Js extends S{static{this.properties={defaultKind:{attribute:!1},lockKind:{attribute:!1},onAdded:{attribute:!1},onCancel:{attribute:!1}}}#t=new g("skill");#e=new g("");#s=new g([]);#i=new g(null);#r=new g("");#l=new g("");#a=new g("");#o=new g(!1);#n=new g(!1);static{this.styles=V`
|
|
208
|
+
:host { display: block; }
|
|
209
|
+
.backdrop {
|
|
210
|
+
position: fixed; inset: 0; background: #0008;
|
|
211
|
+
display: flex; align-items: center; justify-content: center; z-index: 100;
|
|
212
|
+
}
|
|
213
|
+
.modal {
|
|
214
|
+
background: var(--modal-bg, Canvas);
|
|
215
|
+
color: inherit;
|
|
216
|
+
border-radius: 10px;
|
|
217
|
+
width: min(560px, 92vw);
|
|
218
|
+
max-height: 82vh;
|
|
219
|
+
display: flex;
|
|
220
|
+
flex-direction: column;
|
|
221
|
+
box-shadow: 0 8px 40px #0006;
|
|
222
|
+
border: 1px solid #8884;
|
|
223
|
+
}
|
|
224
|
+
.header { padding: 16px 20px 8px; }
|
|
225
|
+
h2 { margin: 0; font-size: 16px; }
|
|
226
|
+
.kind-toggle { display: flex; gap: 8px; padding: 0 20px 12px; }
|
|
227
|
+
.kind-toggle button {
|
|
228
|
+
flex: 1; padding: 8px; border: 1px solid #8886; background: none; color: inherit;
|
|
229
|
+
border-radius: 6px; cursor: pointer; font-size: 13px;
|
|
230
|
+
}
|
|
231
|
+
.kind-toggle button.active { background: #2563eb; border-color: #2563eb; color: white; }
|
|
232
|
+
.breadcrumb-row {
|
|
233
|
+
padding: 8px 20px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
|
|
234
|
+
}
|
|
235
|
+
.breadcrumb {
|
|
236
|
+
font-size: 12px; opacity: 0.7; font-family: monospace;
|
|
237
|
+
word-break: break-all;
|
|
238
|
+
}
|
|
239
|
+
.hidden-toggle {
|
|
240
|
+
font-size: 11px; opacity: 0.7; display: flex; align-items: center; gap: 4px;
|
|
241
|
+
cursor: pointer; white-space: nowrap; user-select: none;
|
|
242
|
+
}
|
|
243
|
+
.browser {
|
|
244
|
+
flex: 1; overflow-y: auto; border-top: 1px solid #8883; border-bottom: 1px solid #8883;
|
|
245
|
+
min-height: 200px;
|
|
246
|
+
}
|
|
247
|
+
.entry {
|
|
248
|
+
padding: 8px 20px; cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 8px;
|
|
249
|
+
}
|
|
250
|
+
.entry:hover { background: #8881; }
|
|
251
|
+
.entry .icon { opacity: 0.6; }
|
|
252
|
+
.up { opacity: 0.7; }
|
|
253
|
+
.empty { padding: 16px 20px; opacity: 0.6; font-size: 13px; }
|
|
254
|
+
.footer { padding: 14px 20px; display: flex; flex-direction: column; gap: 10px; }
|
|
255
|
+
.selected-row { font-size: 12px; }
|
|
256
|
+
.selected-row .path { font-family: monospace; opacity: 0.85; word-break: break-all; }
|
|
257
|
+
label { font-size: 12px; opacity: 0.7; display: block; margin-bottom: 4px; }
|
|
258
|
+
input[type='text'] { width: 100%; box-sizing: border-box; padding: 7px 9px; font-size: 13px; }
|
|
259
|
+
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
|
|
260
|
+
button.primary {
|
|
261
|
+
background: #2563eb; border: 1px solid #2563eb; color: white; padding: 7px 16px;
|
|
262
|
+
border-radius: 6px; cursor: pointer; font-size: 13px;
|
|
263
|
+
}
|
|
264
|
+
button.primary:disabled { opacity: 0.5; cursor: default; }
|
|
265
|
+
button.secondary {
|
|
266
|
+
background: none; border: 1px solid #8886; color: inherit; padding: 7px 16px;
|
|
267
|
+
border-radius: 6px; cursor: pointer; font-size: 13px;
|
|
268
|
+
}
|
|
269
|
+
.error { color: #dc2626; font-size: 12px; }
|
|
270
|
+
`}constructor(){super(),new ye(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#t.set(this.defaultKind),this.#c()}async#c(e){const t=new URLSearchParams;e&&t.set("path",e),this.#n.value&&t.set("hidden","1");const s=await fetch(`/api/fs/list?${t.toString()}`);if(!s.ok){this.#a.set((await s.json()).error??"failed to list directory");return}const r=await s.json();this.#e.set(r.path),this.#i.set(r.parent),this.#s.set(r.entries),this.#a.set("")}#d(){this.#n.set(!this.#n.value),this.#c(this.#e.value)}#h(){this.#r.set(this.#e.value),this.#l.value||this.#l.set(this.#e.value.split("/").filter(Boolean).pop()??"")}async#p(){const e=this.#r.value||this.#e.value;if(e){this.#o.set(!0),this.#a.set("");try{const t=await fetch("/api/roots",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#t.value,name:this.#l.value||void 0,path:e})}),s=await t.json();if(!t.ok){this.#a.set(s.error??"failed to add root");return}this.onAdded()}finally{this.#o.set(!1)}}}render(){const e=this.#s.value;return b`
|
|
271
|
+
<div class="backdrop" @click=${t=>t.target===t.currentTarget&&this.onCancel()}>
|
|
272
|
+
<div class="modal">
|
|
273
|
+
<div class="header"><h2>Add a root</h2></div>
|
|
274
|
+
${this.lockKind?b``:b`
|
|
275
|
+
<div class="kind-toggle">
|
|
276
|
+
<button
|
|
277
|
+
class=${this.#t.value==="skill"?"active":""}
|
|
278
|
+
@click=${()=>this.#t.set("skill")}
|
|
279
|
+
>
|
|
280
|
+
Skill root
|
|
281
|
+
</button>
|
|
282
|
+
<button
|
|
283
|
+
class=${this.#t.value==="memory"?"active":""}
|
|
284
|
+
@click=${()=>this.#t.set("memory")}
|
|
285
|
+
>
|
|
286
|
+
Memory root
|
|
287
|
+
</button>
|
|
288
|
+
</div>
|
|
289
|
+
`}
|
|
290
|
+
<div class="breadcrumb-row">
|
|
291
|
+
<div class="breadcrumb">${this.#e.value}</div>
|
|
292
|
+
<label class="hidden-toggle">
|
|
293
|
+
<input type="checkbox" .checked=${this.#n.value} @change=${()=>this.#d()} />
|
|
294
|
+
Show hidden
|
|
295
|
+
</label>
|
|
296
|
+
</div>
|
|
297
|
+
<div class="browser">
|
|
298
|
+
${this.#i.value?b`<div class="entry up" @click=${()=>this.#c(this.#i.value)}>
|
|
299
|
+
<span class="icon">📁</span> ..
|
|
300
|
+
</div>`:""}
|
|
301
|
+
${e.length===0&&!this.#i.value?b`<div class="empty">No subdirectories here.</div>`:e.map(t=>b`<div class="entry" @click=${()=>this.#c(t.path)}>
|
|
302
|
+
<span class="icon">📁</span> ${t.name}
|
|
303
|
+
</div>`)}
|
|
304
|
+
</div>
|
|
305
|
+
<div class="footer">
|
|
306
|
+
<button class="secondary" @click=${()=>this.#h()}>
|
|
307
|
+
Select this folder
|
|
308
|
+
</button>
|
|
309
|
+
${this.#r.value?b`<div class="selected-row">Selected: <span class="path">${this.#r.value}</span></div>`:""}
|
|
310
|
+
<div>
|
|
311
|
+
<label>Root name</label>
|
|
312
|
+
<input
|
|
313
|
+
type="text"
|
|
314
|
+
.value=${this.#l.value}
|
|
315
|
+
placeholder="e.g. personal, company"
|
|
316
|
+
@input=${t=>this.#l.set(t.target.value)}
|
|
317
|
+
/>
|
|
318
|
+
</div>
|
|
319
|
+
${this.#a.value?b`<div class="error">${this.#a.value}</div>`:""}
|
|
320
|
+
<div class="actions">
|
|
321
|
+
<button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
|
|
322
|
+
<button
|
|
323
|
+
class="primary"
|
|
324
|
+
?disabled=${!this.#r.value||this.#o.value}
|
|
325
|
+
@click=${()=>this.#p()}
|
|
326
|
+
>
|
|
327
|
+
${this.#o.value?"Adding…":"Add root"}
|
|
328
|
+
</button>
|
|
329
|
+
</div>
|
|
330
|
+
</div>
|
|
331
|
+
</div>
|
|
332
|
+
</div>
|
|
333
|
+
`}}customElements.define("add-root-modal",Js);let Je=0;class ei extends S{static{this.properties={tags:{attribute:!1},active:{attribute:!1},onToggle:{attribute:!1}}}#t=new g("");#e=new g(!1);#s=new g(-1);#i;#r;static{this.styles=V`
|
|
334
|
+
:host {
|
|
335
|
+
display: inline-block;
|
|
336
|
+
position: relative;
|
|
337
|
+
width: 260px;
|
|
338
|
+
font: inherit;
|
|
339
|
+
}
|
|
340
|
+
.field {
|
|
341
|
+
display: flex;
|
|
342
|
+
align-items: center;
|
|
343
|
+
flex-wrap: wrap;
|
|
344
|
+
gap: 4px;
|
|
345
|
+
border: 1px solid #8886;
|
|
346
|
+
border-radius: 6px;
|
|
347
|
+
background: none;
|
|
348
|
+
padding: 3px 4px 3px 8px;
|
|
349
|
+
}
|
|
350
|
+
.field:focus-within {
|
|
351
|
+
border-color: #2563eb;
|
|
352
|
+
box-shadow: 0 0 0 2px #2563eb33;
|
|
353
|
+
}
|
|
354
|
+
.selected-chip {
|
|
355
|
+
display: inline-flex;
|
|
356
|
+
align-items: center;
|
|
357
|
+
gap: 4px;
|
|
358
|
+
background: #2563eb;
|
|
359
|
+
color: white;
|
|
360
|
+
border-radius: 999px;
|
|
361
|
+
padding: 2px 6px 2px 10px;
|
|
362
|
+
font-size: 12px;
|
|
363
|
+
white-space: nowrap;
|
|
364
|
+
}
|
|
365
|
+
.selected-chip .remove {
|
|
366
|
+
cursor: pointer;
|
|
367
|
+
opacity: 0.85;
|
|
368
|
+
line-height: 1;
|
|
369
|
+
padding: 2px;
|
|
370
|
+
border-radius: 50%;
|
|
371
|
+
}
|
|
372
|
+
.selected-chip .remove:hover { opacity: 1; background: #ffffff33; }
|
|
373
|
+
.input {
|
|
374
|
+
flex: 1 1 60px;
|
|
375
|
+
min-width: 60px;
|
|
376
|
+
border: none;
|
|
377
|
+
outline: none;
|
|
378
|
+
padding: 5px 2px;
|
|
379
|
+
font: inherit;
|
|
380
|
+
font-size: 13px;
|
|
381
|
+
background: transparent;
|
|
382
|
+
color: inherit;
|
|
383
|
+
}
|
|
384
|
+
.clear-btn, .chevron-btn {
|
|
385
|
+
border: none;
|
|
386
|
+
background: transparent;
|
|
387
|
+
cursor: pointer;
|
|
388
|
+
color: inherit;
|
|
389
|
+
opacity: 0.6;
|
|
390
|
+
font-size: 12px;
|
|
391
|
+
padding: 2px 5px;
|
|
392
|
+
line-height: 1;
|
|
393
|
+
}
|
|
394
|
+
.clear-btn:hover, .chevron-btn:hover { opacity: 1; }
|
|
395
|
+
.chevron-btn { transition: transform 0.15s ease; }
|
|
396
|
+
.chevron-btn.open { transform: rotate(180deg); }
|
|
397
|
+
|
|
398
|
+
.menu {
|
|
399
|
+
position: fixed;
|
|
400
|
+
margin: 0;
|
|
401
|
+
inset: auto;
|
|
402
|
+
top: anchor(bottom);
|
|
403
|
+
left: anchor(left);
|
|
404
|
+
width: anchor-size(width);
|
|
405
|
+
position-try-fallbacks: flip-block;
|
|
406
|
+
list-style: none;
|
|
407
|
+
padding: 4px;
|
|
408
|
+
margin: 0;
|
|
409
|
+
border: 1px solid #8884;
|
|
410
|
+
border-radius: 8px;
|
|
411
|
+
background: var(--modal-bg, Canvas);
|
|
412
|
+
color: inherit;
|
|
413
|
+
box-shadow: 0 8px 24px #0006;
|
|
414
|
+
max-height: 260px;
|
|
415
|
+
overflow-y: auto;
|
|
416
|
+
box-sizing: border-box;
|
|
417
|
+
}
|
|
418
|
+
.menu:popover-open { margin-top: 4px; }
|
|
419
|
+
.menu[popover] { display: none; }
|
|
420
|
+
.menu.visible[popover] { display: block; }
|
|
421
|
+
|
|
422
|
+
.option {
|
|
423
|
+
display: flex;
|
|
424
|
+
align-items: center;
|
|
425
|
+
gap: 8px;
|
|
426
|
+
padding: 6px 8px;
|
|
427
|
+
border-radius: 5px;
|
|
428
|
+
cursor: pointer;
|
|
429
|
+
font-size: 13px;
|
|
430
|
+
}
|
|
431
|
+
.option:hover, .option.highlighted { background: #8881; }
|
|
432
|
+
.option input { margin: 0; pointer-events: none; }
|
|
433
|
+
.empty { padding: 6px 8px; opacity: 0.6; font-style: italic; font-size: 12px; }
|
|
434
|
+
`}constructor(){super(),new ye(this),this.tags=[],this.active=[],this.onToggle=()=>{},this.#i=`--tag-multiselect-${++Je}`,this.#r=`tag-multiselect-listbox-${Je}`}#l=e=>{e.composedPath().includes(this)||this.#n()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#l)}disconnectedCallback(){document.removeEventListener("click",this.#l),super.disconnectedCallback()}get#a(){const e=this.#t.value.trim().toLowerCase();return e?this.tags.filter(t=>t.toLowerCase().includes(e)):this.tags}#o(){this.#e.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#n(){this.#e.set(!1),this.#s.set(-1),this.renderRoot.querySelector(".menu")?.hidePopover()}#c(){this.#e.value?this.#n():(this.#o(),this.renderRoot.querySelector(".input")?.focus())}#d(e){this.#t.set(e.target.value),this.#s.set(-1),this.#o()}#h(e){this.onToggle(e),this.#t.set(""),this.#s.set(-1)}#p(e){e.stopPropagation(),this.active.forEach(t=>this.onToggle(t)),this.#t.set(""),this.renderRoot.querySelector(".input")?.focus(),this.#o()}#g(e){const t=this.#a;if(e.key==="ArrowDown")e.preventDefault(),this.#o(),t.length&&this.#s.set((this.#s.value+1)%t.length);else if(e.key==="ArrowUp")e.preventDefault(),this.#o(),t.length&&this.#s.set((this.#s.value-1+t.length)%t.length);else if(e.key==="Enter"){const s=t[this.#s.value];s!==void 0&&(e.preventDefault(),this.#h(s))}else if(e.key==="Backspace"&&!this.#t.value&&this.active.length>0){const s=this.active[this.active.length-1];s!==void 0&&this.onToggle(s)}else e.key==="Escape"&&this.#n()}render(){const e=this.active,t=this.#a,s=this.#e.value,r=this.#s.value;return b`
|
|
435
|
+
<div class="field" style=${`anchor-name: ${this.#i}`}>
|
|
436
|
+
${e.map(n=>b`
|
|
437
|
+
<span class="selected-chip">
|
|
438
|
+
${n}
|
|
439
|
+
<span class="remove" @click=${()=>this.onToggle(n)}>✕</span>
|
|
440
|
+
</span>
|
|
441
|
+
`)}
|
|
442
|
+
<input
|
|
443
|
+
class="input"
|
|
444
|
+
role="combobox"
|
|
445
|
+
aria-autocomplete="list"
|
|
446
|
+
aria-expanded=${s}
|
|
447
|
+
aria-controls=${this.#r}
|
|
448
|
+
aria-activedescendant=${r>=0?`${this.#r}-opt-${r}`:""}
|
|
449
|
+
placeholder=${e.length===0?"Filter by tag…":""}
|
|
450
|
+
.value=${this.#t.value}
|
|
451
|
+
@input=${n=>this.#d(n)}
|
|
452
|
+
@focus=${()=>this.#o()}
|
|
453
|
+
@click=${()=>this.#o()}
|
|
454
|
+
@keydown=${n=>this.#g(n)}
|
|
455
|
+
/>
|
|
456
|
+
${e.length>0?b`<button class="clear-btn" tabindex="-1" @mousedown=${n=>n.preventDefault()} @click=${n=>this.#p(n)}>✕</button>`:""}
|
|
457
|
+
<button
|
|
458
|
+
class="chevron-btn ${s?"open":""}"
|
|
459
|
+
tabindex="-1"
|
|
460
|
+
@mousedown=${n=>n.preventDefault()}
|
|
461
|
+
@click=${()=>this.#c()}
|
|
462
|
+
>
|
|
463
|
+
▾
|
|
464
|
+
</button>
|
|
465
|
+
</div>
|
|
466
|
+
|
|
467
|
+
<ul
|
|
468
|
+
id=${this.#r}
|
|
469
|
+
class="menu ${s?"visible":""}"
|
|
470
|
+
role="listbox"
|
|
471
|
+
aria-multiselectable="true"
|
|
472
|
+
popover="manual"
|
|
473
|
+
style=${`position-anchor: ${this.#i}`}
|
|
474
|
+
>
|
|
475
|
+
${t.length?t.map((n,o)=>b`
|
|
476
|
+
<li
|
|
477
|
+
id=${`${this.#r}-opt-${o}`}
|
|
478
|
+
role="option"
|
|
479
|
+
aria-selected=${e.includes(n)}
|
|
480
|
+
class=${o===r?"option highlighted":"option"}
|
|
481
|
+
@mousedown=${a=>a.preventDefault()}
|
|
482
|
+
@click=${()=>this.#h(n)}
|
|
483
|
+
>
|
|
484
|
+
<input type="checkbox" .checked=${e.includes(n)} tabindex="-1" />
|
|
485
|
+
${n}
|
|
486
|
+
</li>
|
|
487
|
+
`):b`<li class="empty">No matches</li>`}
|
|
488
|
+
</ul>
|
|
489
|
+
`}}customElements.define("tag-multiselect",ei);const ti=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],si={tags:[],statuses:[],owners:[],doc_types:[],key_types:[],roots:[]},ii={skill:[],memory:[]},xt="mem-bucket-split-pct",mt=20,$t=80;function ri(){const i=Number(localStorage.getItem(xt));return Number.isFinite(i)&&i>=mt&&i<=$t?i:40}class ni extends S{static{this.styles=V`
|
|
490
|
+
:host { display: block; height: 100vh; }
|
|
491
|
+
.filters {
|
|
492
|
+
padding: 12px 16px;
|
|
493
|
+
border-bottom: 1px solid #8883;
|
|
494
|
+
display: flex;
|
|
495
|
+
flex-direction: column;
|
|
496
|
+
gap: 8px;
|
|
497
|
+
}
|
|
498
|
+
.filters input[type='search'] {
|
|
499
|
+
font-size: 14px;
|
|
500
|
+
padding: 8px 10px;
|
|
501
|
+
width: 100%;
|
|
502
|
+
max-width: 480px;
|
|
503
|
+
box-sizing: border-box;
|
|
504
|
+
}
|
|
505
|
+
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
|
|
506
|
+
.filter-label { font-size: 12px; opacity: 0.6; font-weight: 600; }
|
|
507
|
+
.type-toggle button {
|
|
508
|
+
border: 1px solid #8886;
|
|
509
|
+
background: none;
|
|
510
|
+
color: inherit;
|
|
511
|
+
padding: 5px 12px;
|
|
512
|
+
font-size: 13px;
|
|
513
|
+
cursor: pointer;
|
|
514
|
+
}
|
|
515
|
+
.type-toggle button.active { background: #2563eb; border-color: #2563eb; color: white; }
|
|
516
|
+
.type-toggle button:first-child { border-radius: 6px 0 0 6px; }
|
|
517
|
+
.type-toggle button:last-child { border-radius: 0 6px 6px 0; }
|
|
518
|
+
.body-region { display: flex; height: calc(100vh - 130px); }
|
|
519
|
+
result-list { overflow-y: auto; flex: 0 0 auto; }
|
|
520
|
+
detail-panel { overflow-y: auto; flex: 1 1 auto; min-width: 0; }
|
|
521
|
+
.splitter {
|
|
522
|
+
flex: 0 0 auto;
|
|
523
|
+
width: 6px;
|
|
524
|
+
cursor: col-resize;
|
|
525
|
+
background: #8882;
|
|
526
|
+
position: relative;
|
|
527
|
+
}
|
|
528
|
+
.splitter:hover, .splitter.dragging { background: #2563eb55; }
|
|
529
|
+
.splitter::after {
|
|
530
|
+
content: '';
|
|
531
|
+
position: absolute;
|
|
532
|
+
top: 0; bottom: 0;
|
|
533
|
+
left: -3px; right: -3px;
|
|
534
|
+
}
|
|
535
|
+
label.small { font-size: 12px; opacity: 0.7; }
|
|
536
|
+
.roots-bar {
|
|
537
|
+
display: flex;
|
|
538
|
+
gap: 6px;
|
|
539
|
+
align-items: center;
|
|
540
|
+
flex-wrap: wrap;
|
|
541
|
+
padding: 10px 16px;
|
|
542
|
+
border-bottom: 1px solid #8883;
|
|
543
|
+
background: #8881a;
|
|
544
|
+
}
|
|
545
|
+
.root-chip {
|
|
546
|
+
border: 1px solid #8886; border-radius: 999px; padding: 3px 8px 3px 10px; font-size: 12px;
|
|
547
|
+
cursor: pointer; background: none; color: inherit; display: inline-flex; align-items: center; gap: 6px;
|
|
548
|
+
}
|
|
549
|
+
.root-chip.active { background: #a78bfa33; border-color: #a78bfa; color: #6d28d9; }
|
|
550
|
+
@media (prefers-color-scheme: dark) {
|
|
551
|
+
.root-chip.active { background: #a78bfa33; border-color: #a78bfa; color: #d8caff; }
|
|
552
|
+
}
|
|
553
|
+
.root-chip .remove {
|
|
554
|
+
opacity: 0.6; font-size: 12px; line-height: 1; padding: 2px; border-radius: 50%;
|
|
555
|
+
}
|
|
556
|
+
.root-chip .remove:hover { opacity: 1; background: #0002; }
|
|
557
|
+
.add-root-btn {
|
|
558
|
+
border: 1px dashed #8886; border-radius: 999px; padding: 3px 10px; font-size: 12px;
|
|
559
|
+
cursor: pointer; background: none; color: inherit; opacity: 0.75;
|
|
560
|
+
}
|
|
561
|
+
.add-root-btn:hover { opacity: 1; }
|
|
562
|
+
.first-run {
|
|
563
|
+
display: flex; flex-direction: column; align-items: center; justify-content: center;
|
|
564
|
+
height: 100vh; gap: 16px; text-align: center; padding: 24px;
|
|
565
|
+
}
|
|
566
|
+
.first-run h1 { font-size: 18px; margin: 0; }
|
|
567
|
+
.first-run p { opacity: 0.7; font-size: 13px; max-width: 420px; margin: 0; }
|
|
568
|
+
`}#t=new g("");#e=new g("all");#s=new g([]);#i=new g([]);#r=new g([]);#l=new g(si);#a=new g(null);#o=new g(ii);#n=new g(!1);#c=new g("");#d=new g(!1);#h=new g(ri());#p=new g(!1);#g=e=>this.#$(e);#k=()=>this.#w();constructor(){super(),new ye(this)}#m(e){e.preventDefault(),this.#p.set(!0),document.addEventListener("pointermove",this.#g),document.addEventListener("pointerup",this.#k)}#$(e){const t=this.renderRoot.querySelector(".body-region");if(!t)return;const s=t.getBoundingClientRect(),r=(e.clientX-s.left)/s.width*100;this.#h.set(Math.min($t,Math.max(mt,r)))}#w(){this.#p.set(!1),document.removeEventListener("pointermove",this.#g),document.removeEventListener("pointerup",this.#k),localStorage.setItem(xt,String(this.#h.value))}#y=new Ft(()=>{const e=new URLSearchParams;this.#e.value!=="all"&&e.set("type",this.#e.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim());for(const t of this.#s.value)e.append("tag",t);for(const t of this.#i.value)e.append("root",t);return e.toString()});connectedCallback(){super.connectedCallback(),this.#u(),this.#f(),this.#b()}async#u(){const e=await fetch(`/api/entries?${this.#y.value}`);this.#r.set(await e.json())}async#f(){const e=this.#e.value==="all"?"":`?type=${this.#e.value}`,t=await fetch(`/api/facets${e}`);this.#l.set(await t.json())}async#b(){const e=await fetch("/api/roots");this.#o.set(await e.json()),this.#d.set(!0)}#v(e){const t=this.#i.value;this.#i.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#u()}async#_(e,t){if(t.stopPropagation(),window.prompt(`Type "${e.name}" to remove this ${e.kind} root (files on disk are untouched):`)===e.name){this.#c.set(e.name);try{await fetch(`/api/roots/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"}),this.#i.set(this.#i.value.filter(r=>r!==e.name)),await Promise.all([this.#b(),this.#f(),this.#u()])}finally{this.#c.set("")}}}#x(){this.#n.set(!1),this.#b(),this.#f(),this.#u()}#S(){return[...this.#o.value.skill,...this.#o.value.memory]}#A(e){this.#e.set(e),this.#s.set([]),this.#f(),this.#u()}#R(e){const t=this.#s.value;this.#s.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#u()}#E(e){this.#t.set(e.target.value),this.#u()}#T(e){this.#a.set({table:e._table,id:e.id})}render(){const e=this.#l.value,t=this.#S();return this.#d.value&&t.length===0&&!this.#n.value?b`
|
|
569
|
+
<div class="first-run">
|
|
570
|
+
<h1>No roots configured yet</h1>
|
|
571
|
+
<p>
|
|
572
|
+
Add a folder of skills or memory docs to get started. You can add more roots later —
|
|
573
|
+
e.g. a personal skills repo plus a shared company repo.
|
|
574
|
+
</p>
|
|
575
|
+
<button class="add-root-btn" @click=${()=>this.#n.set(!0)}>+ Add your first root</button>
|
|
576
|
+
</div>
|
|
577
|
+
${this.#n.value?b`<add-root-modal
|
|
578
|
+
.defaultKind=${"skill"}
|
|
579
|
+
.lockKind=${!1}
|
|
580
|
+
.onAdded=${()=>this.#x()}
|
|
581
|
+
.onCancel=${()=>this.#n.set(!1)}
|
|
582
|
+
></add-root-modal>`:""}
|
|
583
|
+
`:b`
|
|
584
|
+
<div class="roots-bar">
|
|
585
|
+
<span class="filter-label">Roots:</span>
|
|
586
|
+
${t.map(s=>b`
|
|
587
|
+
<button class="root-chip ${this.#i.value.includes(s.name)?"active":""}" @click=${()=>this.#v(s.name)}>
|
|
588
|
+
${s.name}
|
|
589
|
+
<span
|
|
590
|
+
class="remove"
|
|
591
|
+
title="Remove root"
|
|
592
|
+
@click=${r=>this.#_(s,r)}
|
|
593
|
+
>${this.#c.value===s.name?"…":"✕"}</span
|
|
594
|
+
>
|
|
595
|
+
</button>
|
|
596
|
+
`)}
|
|
597
|
+
<button class="add-root-btn" @click=${()=>this.#n.set(!0)}>+ Add root</button>
|
|
598
|
+
</div>
|
|
599
|
+
<div class="filters">
|
|
600
|
+
<input
|
|
601
|
+
type="search"
|
|
602
|
+
placeholder="Search descriptions, bodies, tags..."
|
|
603
|
+
.value=${this.#t.value}
|
|
604
|
+
@input=${s=>this.#E(s)}
|
|
605
|
+
/>
|
|
606
|
+
<div class="row type-toggle">
|
|
607
|
+
${ti.map(s=>b`
|
|
608
|
+
<button
|
|
609
|
+
class=${this.#e.value===s.value?"active":""}
|
|
610
|
+
@click=${()=>this.#A(s.value)}
|
|
611
|
+
>
|
|
612
|
+
${s.label}
|
|
613
|
+
</button>
|
|
614
|
+
`)}
|
|
615
|
+
</div>
|
|
616
|
+
<div class="row">
|
|
617
|
+
${e.tags.length===0?b`<span class="filter-label">Tags:</span> <label class="small">no tags yet</label>`:b`
|
|
618
|
+
<tag-multiselect
|
|
619
|
+
.tags=${e.tags}
|
|
620
|
+
.active=${this.#s.value}
|
|
621
|
+
.onToggle=${s=>this.#R(s)}
|
|
622
|
+
></tag-multiselect>
|
|
623
|
+
`}
|
|
624
|
+
</div>
|
|
625
|
+
</div>
|
|
626
|
+
<div class="body-region">
|
|
627
|
+
<result-list
|
|
628
|
+
style=${`width: ${this.#h.value}%; border-right: 1px solid #8883;`}
|
|
629
|
+
.results=${this.#r.value}
|
|
630
|
+
.showRoot=${t.length>1}
|
|
631
|
+
.onSelect=${s=>this.#T(s)}
|
|
632
|
+
></result-list>
|
|
633
|
+
<div
|
|
634
|
+
class="splitter ${this.#p.value?"dragging":""}"
|
|
635
|
+
@pointerdown=${s=>this.#m(s)}
|
|
636
|
+
></div>
|
|
637
|
+
<detail-panel .selected=${this.#a.value}></detail-panel>
|
|
638
|
+
</div>
|
|
639
|
+
${this.#n.value?b`<add-root-modal
|
|
640
|
+
.defaultKind=${"skill"}
|
|
641
|
+
.lockKind=${!1}
|
|
642
|
+
.onAdded=${()=>this.#x()}
|
|
643
|
+
.onCancel=${()=>this.#n.set(!1)}
|
|
644
|
+
></add-root-modal>`:""}
|
|
645
|
+
`}}customElements.define("mem-bucket-app",ni);
|
package/dist/client/index.html
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
:root { color-scheme: light dark; }
|
|
8
8
|
body { font-family: system-ui, sans-serif; margin: 0; }
|
|
9
9
|
</style>
|
|
10
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
+
<script type="module" crossorigin src="/assets/index-BxAZ48QK.js"></script>
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
|
13
13
|
<mem-bucket-app></mem-bucket-app>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-memory-bucket",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "MCP server exposing skill_* (reusable coding patterns) and memory_* (point-in-time working context) tools over a markdown+frontmatter source, cached into SQLite at runtime.",
|
|
6
6
|
"repository": {
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"dev:server": "tsx watch src/server.ts",
|
|
28
28
|
"build": "tsc -p tsconfig.server.json && vite build && npm run copy:builtin-skills",
|
|
29
29
|
"copy:builtin-skills": "mkdir -p dist/src/skills/builtin && cp -r src/skills/builtin/. dist/src/skills/builtin/",
|
|
30
|
+
"prepublishOnly": "npm run build",
|
|
30
31
|
"start": "tsx src/server.ts",
|
|
31
32
|
"start_in_folder": "tsx src/server.ts --memory-dir",
|
|
32
33
|
"typecheck": "tsc --noEmit -p tsconfig.server.json && tsc --noEmit -p tsconfig.client.json",
|
|
@@ -40,6 +41,7 @@
|
|
|
40
41
|
"express": "^4.21.0",
|
|
41
42
|
"gray-matter": "^4.0.3",
|
|
42
43
|
"lit": "^3.3.3",
|
|
44
|
+
"marked": "^18.0.10",
|
|
43
45
|
"zod": "^3.23.8"
|
|
44
46
|
},
|
|
45
47
|
"devDependencies": {
|
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const n of r.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&s(n)}).observe(document,{childList:!0,subtree:!0});function e(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(i){if(i.ep)return;i.ep=!0;const r=e(i);fetch(i.href,r)}})();/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2019 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const O=globalThis,D=O.ShadowRoot&&(O.ShadyCSS===void 0||O.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,I=Symbol(),V=new WeakMap;let ot=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==I)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(D&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=V.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&V.set(e,t))}return t}toString(){return this.cssText}};const pt=o=>new ot(typeof o=="string"?o:o+"",void 0,I),T=(o,...t)=>{const e=o.length===1?o[0]:t.reduce((s,i,r)=>s+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[r+1],o[0]);return new ot(e,o,I)},ut=(o,t)=>{if(D)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const s=document.createElement("style"),i=O.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,o.appendChild(s)}},F=D?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return pt(e)})(o):o;/**
|
|
6
|
-
* @license
|
|
7
|
-
* Copyright 2017 Google LLC
|
|
8
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is:ft,defineProperty:$t,getOwnPropertyDescriptor:gt,getOwnPropertyNames:mt,getOwnPropertySymbols:bt,getPrototypeOf:vt}=Object,M=globalThis,Y=M.trustedTypes,yt=Y?Y.emptyScript:"",xt=M.reactiveElementPolyfillSupport,S=(o,t)=>o,L={toAttribute(o,t){switch(t){case Boolean:o=o?yt:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let e=o;switch(t){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},rt=(o,t)=>!ft(o,t),J={attribute:!0,type:String,converter:L,reflect:!1,useDefault:!1,hasChanged:rt};Symbol.metadata??=Symbol("metadata"),M.litPropertyMetadata??=new WeakMap;let _=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=J){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);i!==void 0&&$t(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:r}=gt(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get:i,set(n){const d=i?.call(this);r?.call(this,n),this.requestUpdate(t,d,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??J}static _$Ei(){if(this.hasOwnProperty(S("elementProperties")))return;const t=vt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(S("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(S("properties"))){const e=this.properties,s=[...mt(e),...bt(e)];for(const i of s)this.createProperty(i,e[i])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[s,i]of e)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const i=this._$Eu(e,s);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const i of s)e.unshift(F(i))}else t!==void 0&&e.push(F(t));return e}static _$Eu(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.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(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ut(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){const r=(s.converter?.toAttribute!==void 0?s.converter:L).toAttribute(e,s.type);this._$Em=t,r==null?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(t,e){const s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){const r=s.getPropertyOptions(i),n=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:L;this._$Em=i;const d=n.fromAttribute(e,r.type);this[i]=d??this._$Ej?.get(i)??d,this._$Em=null}}requestUpdate(t,e,s,i=!1,r){if(t!==void 0){const n=this.constructor;if(i===!1&&(r=this[t]),s??=n.getPropertyOptions(t),!((s.hasChanged??rt)(r,e)||s.useDefault&&s.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(n._$Eu(t,s))))return;this.C(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:i,wrapped:r},n){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,n??e??this[t]),r!==!0||n!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),i===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,r]of this._$Ep)this[i]=r;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,r]of s){const{wrapped:n}=r,d=this[i];n!==!0||this._$AL.has(i)||d===void 0||this.C(i,void 0,r,d)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(e)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};_.elementStyles=[],_.shadowRootOptions={mode:"open"},_[S("elementProperties")]=new Map,_[S("finalized")]=new Map,xt?.({ReactiveElement:_}),(M.reactiveElementVersions??=[]).push("2.1.2");/**
|
|
10
|
-
* @license
|
|
11
|
-
* Copyright 2017 Google LLC
|
|
12
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/const B=globalThis,Z=o=>o,U=B.trustedTypes,Q=U?U.createPolicy("lit-html",{createHTML:o=>o}):void 0,nt="$lit$",m=`lit$${Math.random().toFixed(9).slice(2)}$`,at="?"+m,_t=`<${at}>`,x=document,E=()=>x.createComment(""),C=o=>o===null||typeof o!="object"&&typeof o!="function",q=Array.isArray,wt=o=>q(o)||typeof o?.[Symbol.iterator]=="function",H=`[
|
|
14
|
-
\f\r]`,k=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,G=/-->/g,X=/>/g,v=RegExp(`>|${H}(?:([^\\s"'>=/]+)(${H}*=${H}*(?:[^
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),tt=/'/g,et=/"/g,lt=/^(?:script|style|textarea|title)$/i,At=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),h=At(1),w=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),st=new WeakMap,y=x.createTreeWalker(x,129);function ct(o,t){if(!q(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Q!==void 0?Q.createHTML(t):t}const kt=(o,t)=>{const e=o.length-1,s=[];let i,r=t===2?"<svg>":t===3?"<math>":"",n=k;for(let d=0;d<e;d++){const a=o[d];let u,f,c=-1,$=0;for(;$<a.length&&(n.lastIndex=$,f=n.exec(a),f!==null);)$=n.lastIndex,n===k?f[1]==="!--"?n=G:f[1]!==void 0?n=X:f[2]!==void 0?(lt.test(f[2])&&(i=RegExp("</"+f[2],"g")),n=v):f[3]!==void 0&&(n=v):n===v?f[0]===">"?(n=i??k,c=-1):f[1]===void 0?c=-2:(c=n.lastIndex-f[2].length,u=f[1],n=f[3]===void 0?v:f[3]==='"'?et:tt):n===et||n===tt?n=v:n===G||n===X?n=k:(n=v,i=void 0);const g=n===v&&o[d+1].startsWith("/>")?" ":"";r+=n===k?a+_t:c>=0?(s.push(u),a.slice(0,c)+nt+a.slice(c)+m+g):a+m+(c===-2?d:g)}return[ct(o,r+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class P{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let r=0,n=0;const d=t.length-1,a=this.parts,[u,f]=kt(t,e);if(this.el=P.createElement(u,s),y.currentNode=this.el.content,e===2||e===3){const c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(i=y.nextNode())!==null&&a.length<d;){if(i.nodeType===1){if(i.hasAttributes())for(const c of i.getAttributeNames())if(c.endsWith(nt)){const $=f[n++],g=i.getAttribute(c).split(m),z=/([.?@])?(.*)/.exec($);a.push({type:1,index:r,name:z[2],strings:g,ctor:z[1]==="."?Et:z[1]==="?"?Ct:z[1]==="@"?Pt:N}),i.removeAttribute(c)}else c.startsWith(m)&&(a.push({type:6,index:r}),i.removeAttribute(c));if(lt.test(i.tagName)){const c=i.textContent.split(m),$=c.length-1;if($>0){i.textContent=U?U.emptyScript:"";for(let g=0;g<$;g++)i.append(c[g],E()),y.nextNode(),a.push({type:2,index:++r});i.append(c[$],E())}}}else if(i.nodeType===8)if(i.data===at)a.push({type:2,index:r});else{let c=-1;for(;(c=i.data.indexOf(m,c+1))!==-1;)a.push({type:7,index:r}),c+=m.length-1}r++}}static createElement(t,e){const s=x.createElement("template");return s.innerHTML=t,s}}function A(o,t,e=o,s){if(t===w)return t;let i=s!==void 0?e._$Co?.[s]:e._$Cl;const r=C(t)?void 0:t._$litDirective$;return i?.constructor!==r&&(i?._$AO?.(!1),r===void 0?i=void 0:(i=new r(o),i._$AT(o,e,s)),s!==void 0?(e._$Co??=[])[s]=i:e._$Cl=i),i!==void 0&&(t=A(o,i._$AS(o,t.values),i,s)),t}class St{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,i=(t?.creationScope??x).importNode(e,!0);y.currentNode=i;let r=y.nextNode(),n=0,d=0,a=s[0];for(;a!==void 0;){if(n===a.index){let u;a.type===2?u=new R(r,r.nextSibling,this,t):a.type===1?u=new a.ctor(r,a.name,a.strings,this,t):a.type===6&&(u=new Rt(r,this,t)),this._$AV.push(u),a=s[++d]}n!==a?.index&&(r=y.nextNode(),n++)}return y.currentNode=x,i}p(t){let e=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=A(this,t,e),C(t)?t===p||t==null||t===""?(this._$AH!==p&&this._$AR(),this._$AH=p):t!==this._$AH&&t!==w&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):wt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==p&&C(this._$AH)?this._$AA.nextSibling.data=t:this.T(x.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=P.createElement(ct(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(e);else{const r=new St(i,this),n=r.u(this.options);r.p(e),this.T(n),this._$AH=r}}_$AC(t){let e=st.get(t.strings);return e===void 0&&st.set(t.strings,e=new P(t)),e}k(t){q(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const r of t)i===e.length?e.push(s=new R(this.O(E()),this.O(E()),this,this.options)):s=e[i],s._$AI(r),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const s=Z(t).nextSibling;Z(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}}class N{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,r){this.type=1,this._$AH=p,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=r,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=p}_$AI(t,e=this,s,i){const r=this.strings;let n=!1;if(r===void 0)t=A(this,t,e,0),n=!C(t)||t!==this._$AH&&t!==w,n&&(this._$AH=t);else{const d=t;let a,u;for(t=r[0],a=0;a<r.length-1;a++)u=A(this,d[s+a],e,a),u===w&&(u=this._$AH[a]),n||=!C(u)||u!==this._$AH[a],u===p?t=p:t!==p&&(t+=(u??"")+r[a+1]),this._$AH[a]=u}n&&!i&&this.j(t)}j(t){t===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Et extends N{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===p?void 0:t}}class Ct extends N{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==p)}}class Pt extends N{constructor(t,e,s,i,r){super(t,e,s,i,r),this.type=5}_$AI(t,e=this){if((t=A(this,t,e,0)??p)===w)return;const s=this._$AH,i=t===p&&s!==p||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==p&&(s===p||i);i&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class Rt{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){A(this,t)}}const zt=B.litHtmlPolyfillSupport;zt?.(P,R),(B.litHtmlVersions??=[]).push("3.3.3");const Ot=(o,t,e)=>{const s=e?.renderBefore??t;let i=s._$litPart$;if(i===void 0){const r=e?.renderBefore??null;s._$litPart$=i=new R(t.insertBefore(E(),r),r,void 0,e??{})}return i._$AI(o),i};/**
|
|
16
|
-
* @license
|
|
17
|
-
* Copyright 2017 Google LLC
|
|
18
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/const K=globalThis;class b extends _{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ot(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return w}}b._$litElement$=!0,b.finalized=!0,K.litElementHydrateSupport?.({LitElement:b});const Ut=K.litElementPolyfillSupport;Ut?.({LitElement:b});(K.litElementVersions??=[]).push("4.2.2");var ht;let j=0;const it=new Set;function Tt(o){j++;try{o()}finally{j--,j===0&&Mt()}}function Mt(){const o=new Set(it);it.clear();for(const t of o)t()}function Nt(o,t){return o!=o?t==t:o!==t||o&&typeof o=="object"||typeof o=="function"}function Ht(o){return o&&typeof o.deref=="function"}class W{static#e=0;#t;#i;#s=new Set;#o=ht.#e++;name;constructor(t,e){this.#t=t,this.#i=t,this.name=e}_get(){return l.activeConsumer&&l.activeConsumer.track(this),this.#t}_set(t){return Nt(t,this.#t)?(this.#i=this.#t,this.#t=t,this._notify(),!0):!1}subscribe(t,e=!1){let s=t;return e&&(s=new WeakRef(t)),this.#s.add(s),()=>this.#s.delete(s)}_notify(){const t=[...this.#s];for(const e of t){let s;if(Ht(e)){if(s=e.deref(),!s){this.#s.delete(e);continue}}else s=e;s()}}get id(){return this.#o}get previousValue(){return this.#i}toString(){return this.name?`${this.constructor.name}(${this.name})`:`${this.constructor.name}#${this.id}`}}ht=W;class l extends W{static#e=[];constructor(t,e){super(t,e)}static get activeConsumer(){return this.#e[this.#e.length-1]}static push(t){this.#e.push(t)}static pop(){this.#e.pop()}get(){return this._get()}set(t){Tt(()=>{this._set(t)})}get value(){return this.get()}set value(t){this.set(t)}update(t){this.set(t(this.get()))}}class jt extends W{#e;#t=!0;#i=!1;#s=new Map;_debugParent;#o;#a=()=>{this.#t||(this.#t=!0,this._notify())};constructor(t,e,s){super(void 0,e),this.#e=t,this.#o=s?.weak??!0}track(t){if(this.#s.has(t))return;const e=t.subscribe(this.#a,this.#o);this.#s.set(t,e)}dispose(){this.#n()}#n(){for(const t of this.#s.values())t();this.#s.clear()}get(){if(l.activeConsumer&&l.activeConsumer.track(this),!this.#t)return this._get();if(this.#i)throw new Error(`Cycle detected in ${this}
|
|
20
|
-
↳ while computing ${this._debugParent??"root"}`);this.#i=!0,this.#n(),l.push(this);try{const t=this.#e();this._set(t)}finally{l.pop(),this.#t=!1,this.#i=!1}return this._get()}get value(){return this.get()}set value(t){throw new Error(`Cannot set value of Computed ${this}. Computed values are read-only.`)}subscribe(t,e=!1){const s=super.subscribe(t,e);return l.activeConsumer||this.get(),s}}class dt{#e;#t=new Map;_debugParent;constructor(t){this.#e=t,t.addController(this);const e=t,s=e.update,i=this;e.update=function(r){l.push(i);try{s.call(this,r)}finally{l.pop()}}}track(t){this.#t.has(t)||this.#t.set(t,t.subscribe(this.#i,!0))}#i=()=>{this.#e.requestUpdate()};hostUpdate(){for(const t of this.#t.values())t();this.#t.clear()}hostDisconnected(){for(const t of this.#t.values())t();this.#t.clear()}toString(){const t=this.#e;return`SignalWatcher(${t?.localName??t?.tagName??t?.constructor?.name??"unknown"})`}}class Lt extends b{static{this.properties={results:{attribute:!1},showRoot:{attribute:!1},onSelect:{attribute:!1}}}static{this.styles=T`
|
|
21
|
-
:host { display: block; }
|
|
22
|
-
.row { padding: 10px 14px; border-bottom: 1px solid #8882; cursor: pointer; }
|
|
23
|
-
.row:hover { background: #8881; }
|
|
24
|
-
.top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
|
|
25
|
-
.name { font-weight: 600; }
|
|
26
|
-
.meta { opacity: 0.65; font-size: 11px; white-space: nowrap; }
|
|
27
|
-
.desc { font-size: 12px; opacity: 0.8; margin-top: 3px; }
|
|
28
|
-
.tags { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
|
|
29
|
-
.tag { font-size: 10px; border: 1px solid #8886; border-radius: 999px; padding: 1px 6px; }
|
|
30
|
-
.type-badge { font-size: 10px; text-transform: uppercase; opacity: 0.6; }
|
|
31
|
-
.root-badge {
|
|
32
|
-
font-size: 10px; text-transform: uppercase; opacity: 0.75; border: 1px solid #7c3aed88;
|
|
33
|
-
color: #7c3aed; border-radius: 4px; padding: 0 4px;
|
|
34
|
-
}
|
|
35
|
-
.empty { padding: 24px; opacity: 0.6; font-size: 13px; }
|
|
36
|
-
`}render(){return!this.results||this.results.length===0?h`<div class="empty">No results.</div>`:h`
|
|
37
|
-
${this.results.map(t=>h`
|
|
38
|
-
<div class="row" @click=${()=>this.onSelect(t)}>
|
|
39
|
-
<div class="top">
|
|
40
|
-
<span class="name">${t.name}</span>
|
|
41
|
-
<span class="meta">${t.owner??"—"} · ${t.status}</span>
|
|
42
|
-
</div>
|
|
43
|
-
<div class="desc">${t.description}</div>
|
|
44
|
-
<div class="tags">
|
|
45
|
-
<span class="type-badge">${t._table==="skills"?"skill":"memory"}</span>
|
|
46
|
-
${this.showRoot&&t.root?h`<span class="root-badge">${t.root}</span>`:""}
|
|
47
|
-
${t.tags.map(e=>h`<span class="tag">${e}</span>`)}
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
`)}
|
|
51
|
-
`}}customElements.define("result-list",Lt);class Dt extends b{static{this.properties={selected:{attribute:!1},_doc:{state:!0}}}static{this.styles=T`
|
|
52
|
-
:host { display: block; padding: 16px; }
|
|
53
|
-
h2 { margin: 0 0 4px; font-size: 16px; }
|
|
54
|
-
.meta { font-size: 12px; opacity: 0.7; margin-bottom: 12px; }
|
|
55
|
-
.source-path {
|
|
56
|
-
font-family: monospace;
|
|
57
|
-
font-size: 11px;
|
|
58
|
-
opacity: 0.6;
|
|
59
|
-
cursor: pointer;
|
|
60
|
-
word-break: break-all;
|
|
61
|
-
}
|
|
62
|
-
pre {
|
|
63
|
-
white-space: pre-wrap;
|
|
64
|
-
font-size: 12px;
|
|
65
|
-
background: #8881;
|
|
66
|
-
padding: 12px;
|
|
67
|
-
border-radius: 6px;
|
|
68
|
-
max-height: 60vh;
|
|
69
|
-
overflow-y: auto;
|
|
70
|
-
}
|
|
71
|
-
.empty { opacity: 0.5; font-size: 13px; }
|
|
72
|
-
`}updated(t){t.has("selected")&&this.selected&&this.#e()}async#e(){const{table:t,id:e}=this.selected,s=await fetch(`/api/entries/${t}/${encodeURIComponent(e)}`);this._doc=s.ok?await s.json():null}#t(){this._doc?.source_path&&navigator.clipboard?.writeText(this._doc.source_path)}render(){if(!this.selected)return h`<div class="empty">Select an entry to view its details.</div>`;if(!this._doc)return p;const t=this._doc;return h`
|
|
73
|
-
<h2>${t.name??t.key??t.id}</h2>
|
|
74
|
-
<div class="meta">
|
|
75
|
-
${t.tags?.join(", ")||"no tags"} · ${t.status}${t.owner?` · owner: ${t.owner}`:""}
|
|
76
|
-
</div>
|
|
77
|
-
<div class="meta">${t.description}</div>
|
|
78
|
-
<pre>${t.body}</pre>
|
|
79
|
-
<div class="source-path" title="click to copy" @click=${()=>this.#t()}>${t.source_path}</div>
|
|
80
|
-
`}}customElements.define("detail-panel",Dt);class It extends b{static{this.properties={defaultKind:{attribute:!1},lockKind:{attribute:!1},onAdded:{attribute:!1},onCancel:{attribute:!1}}}#e=new l("skill");#t=new l("");#i=new l([]);#s=new l(null);#o=new l("");#a=new l("");#n=new l("");#c=new l(!1);#r=new l(!1);static{this.styles=T`
|
|
81
|
-
:host { display: block; }
|
|
82
|
-
.backdrop {
|
|
83
|
-
position: fixed; inset: 0; background: #0008;
|
|
84
|
-
display: flex; align-items: center; justify-content: center; z-index: 100;
|
|
85
|
-
}
|
|
86
|
-
.modal {
|
|
87
|
-
background: var(--modal-bg, Canvas);
|
|
88
|
-
color: inherit;
|
|
89
|
-
border-radius: 10px;
|
|
90
|
-
width: min(560px, 92vw);
|
|
91
|
-
max-height: 82vh;
|
|
92
|
-
display: flex;
|
|
93
|
-
flex-direction: column;
|
|
94
|
-
box-shadow: 0 8px 40px #0006;
|
|
95
|
-
border: 1px solid #8884;
|
|
96
|
-
}
|
|
97
|
-
.header { padding: 16px 20px 8px; }
|
|
98
|
-
h2 { margin: 0; font-size: 16px; }
|
|
99
|
-
.kind-toggle { display: flex; gap: 8px; padding: 0 20px 12px; }
|
|
100
|
-
.kind-toggle button {
|
|
101
|
-
flex: 1; padding: 8px; border: 1px solid #8886; background: none; color: inherit;
|
|
102
|
-
border-radius: 6px; cursor: pointer; font-size: 13px;
|
|
103
|
-
}
|
|
104
|
-
.kind-toggle button.active { background: #2563eb; border-color: #2563eb; color: white; }
|
|
105
|
-
.breadcrumb-row {
|
|
106
|
-
padding: 8px 20px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
|
|
107
|
-
}
|
|
108
|
-
.breadcrumb {
|
|
109
|
-
font-size: 12px; opacity: 0.7; font-family: monospace;
|
|
110
|
-
word-break: break-all;
|
|
111
|
-
}
|
|
112
|
-
.hidden-toggle {
|
|
113
|
-
font-size: 11px; opacity: 0.7; display: flex; align-items: center; gap: 4px;
|
|
114
|
-
cursor: pointer; white-space: nowrap; user-select: none;
|
|
115
|
-
}
|
|
116
|
-
.browser {
|
|
117
|
-
flex: 1; overflow-y: auto; border-top: 1px solid #8883; border-bottom: 1px solid #8883;
|
|
118
|
-
min-height: 200px;
|
|
119
|
-
}
|
|
120
|
-
.entry {
|
|
121
|
-
padding: 8px 20px; cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 8px;
|
|
122
|
-
}
|
|
123
|
-
.entry:hover { background: #8881; }
|
|
124
|
-
.entry .icon { opacity: 0.6; }
|
|
125
|
-
.up { opacity: 0.7; }
|
|
126
|
-
.empty { padding: 16px 20px; opacity: 0.6; font-size: 13px; }
|
|
127
|
-
.footer { padding: 14px 20px; display: flex; flex-direction: column; gap: 10px; }
|
|
128
|
-
.selected-row { font-size: 12px; }
|
|
129
|
-
.selected-row .path { font-family: monospace; opacity: 0.85; word-break: break-all; }
|
|
130
|
-
label { font-size: 12px; opacity: 0.7; display: block; margin-bottom: 4px; }
|
|
131
|
-
input[type='text'] { width: 100%; box-sizing: border-box; padding: 7px 9px; font-size: 13px; }
|
|
132
|
-
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
|
|
133
|
-
button.primary {
|
|
134
|
-
background: #2563eb; border: 1px solid #2563eb; color: white; padding: 7px 16px;
|
|
135
|
-
border-radius: 6px; cursor: pointer; font-size: 13px;
|
|
136
|
-
}
|
|
137
|
-
button.primary:disabled { opacity: 0.5; cursor: default; }
|
|
138
|
-
button.secondary {
|
|
139
|
-
background: none; border: 1px solid #8886; color: inherit; padding: 7px 16px;
|
|
140
|
-
border-radius: 6px; cursor: pointer; font-size: 13px;
|
|
141
|
-
}
|
|
142
|
-
.error { color: #dc2626; font-size: 12px; }
|
|
143
|
-
`}constructor(){super(),new dt(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#e.set(this.defaultKind),this.#h()}async#h(t){const e=new URLSearchParams;t&&e.set("path",t),this.#r.value&&e.set("hidden","1");const s=await fetch(`/api/fs/list?${e.toString()}`);if(!s.ok){this.#n.set((await s.json()).error??"failed to list directory");return}const i=await s.json();this.#t.set(i.path),this.#s.set(i.parent),this.#i.set(i.entries),this.#n.set("")}#d(){this.#r.set(!this.#r.value),this.#h(this.#t.value)}#u(){this.#o.set(this.#t.value),this.#a.value||this.#a.set(this.#t.value.split("/").filter(Boolean).pop()??"")}async#l(){const t=this.#o.value||this.#t.value;if(t){this.#c.set(!0),this.#n.set("");try{const e=await fetch("/api/roots",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#a.value||void 0,path:t})}),s=await e.json();if(!e.ok){this.#n.set(s.error??"failed to add root");return}this.onAdded()}finally{this.#c.set(!1)}}}render(){const t=this.#i.value;return h`
|
|
144
|
-
<div class="backdrop" @click=${e=>e.target===e.currentTarget&&this.onCancel()}>
|
|
145
|
-
<div class="modal">
|
|
146
|
-
<div class="header"><h2>Add a root</h2></div>
|
|
147
|
-
${this.lockKind?h``:h`
|
|
148
|
-
<div class="kind-toggle">
|
|
149
|
-
<button
|
|
150
|
-
class=${this.#e.value==="skill"?"active":""}
|
|
151
|
-
@click=${()=>this.#e.set("skill")}
|
|
152
|
-
>
|
|
153
|
-
Skill root
|
|
154
|
-
</button>
|
|
155
|
-
<button
|
|
156
|
-
class=${this.#e.value==="memory"?"active":""}
|
|
157
|
-
@click=${()=>this.#e.set("memory")}
|
|
158
|
-
>
|
|
159
|
-
Memory root
|
|
160
|
-
</button>
|
|
161
|
-
</div>
|
|
162
|
-
`}
|
|
163
|
-
<div class="breadcrumb-row">
|
|
164
|
-
<div class="breadcrumb">${this.#t.value}</div>
|
|
165
|
-
<label class="hidden-toggle">
|
|
166
|
-
<input type="checkbox" .checked=${this.#r.value} @change=${()=>this.#d()} />
|
|
167
|
-
Show hidden
|
|
168
|
-
</label>
|
|
169
|
-
</div>
|
|
170
|
-
<div class="browser">
|
|
171
|
-
${this.#s.value?h`<div class="entry up" @click=${()=>this.#h(this.#s.value)}>
|
|
172
|
-
<span class="icon">📁</span> ..
|
|
173
|
-
</div>`:""}
|
|
174
|
-
${t.length===0&&!this.#s.value?h`<div class="empty">No subdirectories here.</div>`:t.map(e=>h`<div class="entry" @click=${()=>this.#h(e.path)}>
|
|
175
|
-
<span class="icon">📁</span> ${e.name}
|
|
176
|
-
</div>`)}
|
|
177
|
-
</div>
|
|
178
|
-
<div class="footer">
|
|
179
|
-
<button class="secondary" @click=${()=>this.#u()}>
|
|
180
|
-
Select this folder
|
|
181
|
-
</button>
|
|
182
|
-
${this.#o.value?h`<div class="selected-row">Selected: <span class="path">${this.#o.value}</span></div>`:""}
|
|
183
|
-
<div>
|
|
184
|
-
<label>Root name</label>
|
|
185
|
-
<input
|
|
186
|
-
type="text"
|
|
187
|
-
.value=${this.#a.value}
|
|
188
|
-
placeholder="e.g. personal, company"
|
|
189
|
-
@input=${e=>this.#a.set(e.target.value)}
|
|
190
|
-
/>
|
|
191
|
-
</div>
|
|
192
|
-
${this.#n.value?h`<div class="error">${this.#n.value}</div>`:""}
|
|
193
|
-
<div class="actions">
|
|
194
|
-
<button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
|
|
195
|
-
<button
|
|
196
|
-
class="primary"
|
|
197
|
-
?disabled=${!this.#o.value||this.#c.value}
|
|
198
|
-
@click=${()=>this.#l()}
|
|
199
|
-
>
|
|
200
|
-
${this.#c.value?"Adding…":"Add root"}
|
|
201
|
-
</button>
|
|
202
|
-
</div>
|
|
203
|
-
</div>
|
|
204
|
-
</div>
|
|
205
|
-
</div>
|
|
206
|
-
`}}customElements.define("add-root-modal",It);const Bt=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],qt={tags:[],statuses:[],owners:[],doc_types:[],key_types:[],roots:[]},Kt={skill:[],memory:[]};class Wt extends b{static{this.styles=T`
|
|
207
|
-
:host { display: block; height: 100vh; }
|
|
208
|
-
.filters {
|
|
209
|
-
padding: 12px 16px;
|
|
210
|
-
border-bottom: 1px solid #8883;
|
|
211
|
-
display: flex;
|
|
212
|
-
flex-direction: column;
|
|
213
|
-
gap: 8px;
|
|
214
|
-
}
|
|
215
|
-
.filters input[type='search'] {
|
|
216
|
-
font-size: 14px;
|
|
217
|
-
padding: 8px 10px;
|
|
218
|
-
width: 100%;
|
|
219
|
-
max-width: 480px;
|
|
220
|
-
box-sizing: border-box;
|
|
221
|
-
}
|
|
222
|
-
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
|
|
223
|
-
.filter-label { font-size: 12px; opacity: 0.6; font-weight: 600; }
|
|
224
|
-
.chip {
|
|
225
|
-
border: 1px solid #8886;
|
|
226
|
-
border-radius: 999px;
|
|
227
|
-
padding: 3px 10px;
|
|
228
|
-
font-size: 12px;
|
|
229
|
-
cursor: pointer;
|
|
230
|
-
background: none;
|
|
231
|
-
color: inherit;
|
|
232
|
-
}
|
|
233
|
-
.chip.active { background: #2563eb; border-color: #2563eb; color: white; }
|
|
234
|
-
.type-toggle button {
|
|
235
|
-
border: 1px solid #8886;
|
|
236
|
-
background: none;
|
|
237
|
-
color: inherit;
|
|
238
|
-
padding: 5px 12px;
|
|
239
|
-
font-size: 13px;
|
|
240
|
-
cursor: pointer;
|
|
241
|
-
}
|
|
242
|
-
.type-toggle button.active { background: #2563eb; border-color: #2563eb; color: white; }
|
|
243
|
-
.type-toggle button:first-child { border-radius: 6px 0 0 6px; }
|
|
244
|
-
.type-toggle button:last-child { border-radius: 0 6px 6px 0; }
|
|
245
|
-
.body-region { display: flex; height: calc(100vh - 130px); }
|
|
246
|
-
result-list { flex: 1 1 40%; overflow-y: auto; border-right: 1px solid #8883; }
|
|
247
|
-
detail-panel { flex: 1 1 60%; overflow-y: auto; }
|
|
248
|
-
label.small { font-size: 12px; opacity: 0.7; }
|
|
249
|
-
.roots-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
|
|
250
|
-
.root-chip {
|
|
251
|
-
border: 1px solid #8886; border-radius: 999px; padding: 3px 8px 3px 10px; font-size: 12px;
|
|
252
|
-
cursor: pointer; background: none; color: inherit; display: inline-flex; align-items: center; gap: 6px;
|
|
253
|
-
}
|
|
254
|
-
.root-chip.active { background: #7c3aed; border-color: #7c3aed; color: white; }
|
|
255
|
-
.root-chip .remove {
|
|
256
|
-
opacity: 0.6; font-size: 12px; line-height: 1; padding: 2px; border-radius: 50%;
|
|
257
|
-
}
|
|
258
|
-
.root-chip .remove:hover { opacity: 1; background: #0002; }
|
|
259
|
-
.add-root-btn {
|
|
260
|
-
border: 1px dashed #8886; border-radius: 999px; padding: 3px 10px; font-size: 12px;
|
|
261
|
-
cursor: pointer; background: none; color: inherit; opacity: 0.75;
|
|
262
|
-
}
|
|
263
|
-
.add-root-btn:hover { opacity: 1; }
|
|
264
|
-
.first-run {
|
|
265
|
-
display: flex; flex-direction: column; align-items: center; justify-content: center;
|
|
266
|
-
height: 100vh; gap: 16px; text-align: center; padding: 24px;
|
|
267
|
-
}
|
|
268
|
-
.first-run h1 { font-size: 18px; margin: 0; }
|
|
269
|
-
.first-run p { opacity: 0.7; font-size: 13px; max-width: 420px; margin: 0; }
|
|
270
|
-
`}#e=new l("");#t=new l("all");#i=new l([]);#s=new l([]);#o=new l([]);#a=new l(qt);#n=new l(null);#c=new l(Kt);#r=new l(!1);#h=new l("");#d=new l(!1);constructor(){super(),new dt(this)}#u=new jt(()=>{const t=new URLSearchParams;this.#t.value!=="all"&&t.set("type",this.#t.value),this.#e.value.trim()&&t.set("q",this.#e.value.trim());for(const e of this.#i.value)t.append("tag",e);for(const e of this.#s.value)t.append("root",e);return t.toString()});connectedCallback(){super.connectedCallback(),this.#l(),this.#p(),this.#f()}async#l(){const t=await fetch(`/api/entries?${this.#u.value}`);this.#o.set(await t.json())}async#p(){const t=this.#t.value==="all"?"":`?type=${this.#t.value}`,e=await fetch(`/api/facets${t}`);this.#a.set(await e.json())}async#f(){const t=await fetch("/api/roots");this.#c.set(await t.json()),this.#d.set(!0)}#g(t){const e=this.#s.value;this.#s.set(e.includes(t)?e.filter(s=>s!==t):[...e,t]),this.#l()}async#m(t,e){if(e.stopPropagation(),window.prompt(`Type "${t.name}" to remove this ${t.kind} root (files on disk are untouched):`)===t.name){this.#h.set(t.name);try{await fetch(`/api/roots/${t.kind}/${encodeURIComponent(t.name)}`,{method:"DELETE"}),this.#s.set(this.#s.value.filter(i=>i!==t.name)),await Promise.all([this.#f(),this.#p(),this.#l()])}finally{this.#h.set("")}}}#$(){this.#r.set(!1),this.#f(),this.#p(),this.#l()}#b(){return[...this.#c.value.skill,...this.#c.value.memory]}#v(t){this.#t.set(t),this.#i.set([]),this.#p(),this.#l()}#y(t){const e=this.#i.value;this.#i.set(e.includes(t)?e.filter(s=>s!==t):[...e,t]),this.#l()}#x(t){this.#e.set(t.target.value),this.#l()}#_(t){this.#n.set({table:t._table,id:t.id})}render(){const t=this.#a.value,e=this.#b();return this.#d.value&&e.length===0&&!this.#r.value?h`
|
|
271
|
-
<div class="first-run">
|
|
272
|
-
<h1>No roots configured yet</h1>
|
|
273
|
-
<p>
|
|
274
|
-
Add a folder of skills or memory docs to get started. You can add more roots later —
|
|
275
|
-
e.g. a personal skills repo plus a shared company repo.
|
|
276
|
-
</p>
|
|
277
|
-
<button class="add-root-btn" @click=${()=>this.#r.set(!0)}>+ Add your first root</button>
|
|
278
|
-
</div>
|
|
279
|
-
${this.#r.value?h`<add-root-modal
|
|
280
|
-
.defaultKind=${"skill"}
|
|
281
|
-
.lockKind=${!1}
|
|
282
|
-
.onAdded=${()=>this.#$()}
|
|
283
|
-
.onCancel=${()=>this.#r.set(!1)}
|
|
284
|
-
></add-root-modal>`:""}
|
|
285
|
-
`:h`
|
|
286
|
-
<div class="filters">
|
|
287
|
-
<input
|
|
288
|
-
type="search"
|
|
289
|
-
placeholder="Search descriptions, bodies, tags..."
|
|
290
|
-
.value=${this.#e.value}
|
|
291
|
-
@input=${s=>this.#x(s)}
|
|
292
|
-
/>
|
|
293
|
-
<div class="row type-toggle">
|
|
294
|
-
${Bt.map(s=>h`
|
|
295
|
-
<button
|
|
296
|
-
class=${this.#t.value===s.value?"active":""}
|
|
297
|
-
@click=${()=>this.#v(s.value)}
|
|
298
|
-
>
|
|
299
|
-
${s.label}
|
|
300
|
-
</button>
|
|
301
|
-
`)}
|
|
302
|
-
</div>
|
|
303
|
-
<div class="row">
|
|
304
|
-
<span class="filter-label">Tags:</span>
|
|
305
|
-
${t.tags.length===0?h`<label class="small">no tags yet</label>`:t.tags.map(s=>h`
|
|
306
|
-
<button
|
|
307
|
-
class="chip ${this.#i.value.includes(s)?"active":""}"
|
|
308
|
-
@click=${()=>this.#y(s)}
|
|
309
|
-
>
|
|
310
|
-
${s}
|
|
311
|
-
</button>
|
|
312
|
-
`)}
|
|
313
|
-
</div>
|
|
314
|
-
<div class="roots-bar">
|
|
315
|
-
<span class="filter-label">Roots:</span>
|
|
316
|
-
${e.map(s=>h`
|
|
317
|
-
<button class="root-chip ${this.#s.value.includes(s.name)?"active":""}" @click=${()=>this.#g(s.name)}>
|
|
318
|
-
${s.name}
|
|
319
|
-
<span
|
|
320
|
-
class="remove"
|
|
321
|
-
title="Remove root"
|
|
322
|
-
@click=${i=>this.#m(s,i)}
|
|
323
|
-
>${this.#h.value===s.name?"…":"✕"}</span
|
|
324
|
-
>
|
|
325
|
-
</button>
|
|
326
|
-
`)}
|
|
327
|
-
<button class="add-root-btn" @click=${()=>this.#r.set(!0)}>+ Add root</button>
|
|
328
|
-
</div>
|
|
329
|
-
</div>
|
|
330
|
-
<div class="body-region">
|
|
331
|
-
<result-list
|
|
332
|
-
.results=${this.#o.value}
|
|
333
|
-
.showRoot=${e.length>1}
|
|
334
|
-
.onSelect=${s=>this.#_(s)}
|
|
335
|
-
></result-list>
|
|
336
|
-
<detail-panel .selected=${this.#n.value}></detail-panel>
|
|
337
|
-
</div>
|
|
338
|
-
${this.#r.value?h`<add-root-modal
|
|
339
|
-
.defaultKind=${"skill"}
|
|
340
|
-
.lockKind=${!1}
|
|
341
|
-
.onAdded=${()=>this.#$()}
|
|
342
|
-
.onCancel=${()=>this.#r.set(!1)}
|
|
343
|
-
></add-root-modal>`:""}
|
|
344
|
-
`}}customElements.define("mem-bucket-app",Wt);
|