mcp-memory-bucket 0.4.3 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1329 @@
1
+ (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const n of i)if(n.type==="childList")for(const a of n.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function t(i){const n={};return i.integrity&&(n.integrity=i.integrity),i.referrerPolicy&&(n.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?n.credentials="include":i.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function s(i){if(i.ep)return;i.ep=!0;const n=t(i);fetch(i.href,n)}})();/**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */const X=globalThis,xe=X.ShadowRoot&&(X.ShadyCSS===void 0||X.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,me=Symbol(),De=new WeakMap;let nt=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==me)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(xe&&e===void 0){const s=t!==void 0&&t.length===1;s&&(e=De.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&De.set(t,e))}return e}toString(){return this.cssText}};const Ct=r=>new nt(typeof r=="string"?r:r+"",void 0,me),V=(r,...e)=>{const t=r.length===1?r[0]:e.reduce((s,i,n)=>s+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[n+1],r[0]);return new nt(t,r,me)},Et=(r,e)=>{if(xe)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const s=document.createElement("style"),i=X.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=t.cssText,r.appendChild(s)}},Oe=xe?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return Ct(t)})(r):r;/**
6
+ * @license
7
+ * Copyright 2017 Google LLC
8
+ * SPDX-License-Identifier: BSD-3-Clause
9
+ */const{is:zt,defineProperty:Pt,getOwnPropertyDescriptor:Lt,getOwnPropertyNames:Dt,getOwnPropertySymbols:Ot,getPrototypeOf:It}=Object,re=globalThis,Ie=re.trustedTypes,Mt=Ie?Ie.emptyScript:"",Nt=re.reactiveElementPolyfillSupport,Z=(r,e)=>r,pe={toAttribute(r,e){switch(e){case Boolean:r=r?Mt:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},at=(r,e)=>!zt(r,e),Me={attribute:!0,type:String,converter:pe,reflect:!1,useDefault:!1,hasChanged:at};Symbol.metadata??=Symbol("metadata"),re.litPropertyMetadata??=new WeakMap;let M=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=Me){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(e,s,t);i!==void 0&&Pt(this.prototype,e,i)}}static getPropertyDescriptor(e,t,s){const{get:i,set:n}=Lt(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:i,set(a){const o=i?.call(this);n?.call(this,a),this.requestUpdate(e,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Me}static _$Ei(){if(this.hasOwnProperty(Z("elementProperties")))return;const e=It(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Z("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Z("properties"))){const t=this.properties,s=[...Dt(t),...Ot(t)];for(const i of s)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[s,i]of t)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const i of s)t.unshift(Oe(i))}else e!==void 0&&t.push(Oe(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 Et(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){const s=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,s);if(i!==void 0&&s.reflect===!0){const n=(s.converter?.toAttribute!==void 0?s.converter:pe).toAttribute(t,s.type);this._$Em=e,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(e,t){const s=this.constructor,i=s._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const n=s.getPropertyOptions(i),a=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:pe;this._$Em=i;const o=a.fromAttribute(t,n.type);this[i]=o??this._$Ej?.get(i)??o,this._$Em=null}}requestUpdate(e,t,s,i=!1,n){if(e!==void 0){const a=this.constructor;if(i===!1&&(n=this[e]),s??=a.getPropertyOptions(e),!((s.hasChanged??at)(n,t)||s.useDefault&&s.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,s))))return;this.C(e,t,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:s,reflect:i,wrapped:n},a){s&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),n!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,n]of this._$Ep)this[i]=n;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,n]of s){const{wrapped:a}=n,o=this[i];a!==!0||this._$AL.has(i)||o===void 0||this.C(i,void 0,n,o)}}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){}};M.elementStyles=[],M.shadowRootOptions={mode:"open"},M[Z("elementProperties")]=new Map,M[Z("finalized")]=new Map,Nt?.({ReactiveElement:M}),(re.reactiveElementVersions??=[]).push("2.1.2");/**
10
+ * @license
11
+ * Copyright 2017 Google LLC
12
+ * SPDX-License-Identifier: BSD-3-Clause
13
+ */const ke=globalThis,Ne=r=>r,ee=ke.trustedTypes,qe=ee?ee.createPolicy("lit-html",{createHTML:r=>r}):void 0,ot="$lit$",R=`lit$${Math.random().toFixed(9).slice(2)}$`,lt="?"+R,qt=`<${lt}>`,P=document,K=()=>P.createComment(""),Q=r=>r===null||typeof r!="object"&&typeof r!="function",ve=Array.isArray,Ut=r=>ve(r)||typeof r?.[Symbol.iterator]=="function",le=`[
14
+ \f\r]`,B=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ue=/-->/g,He=/>/g,C=RegExp(`>|${le}(?:([^\\s"'>=/]+)(${le}*=${le}*(?:[^
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Be=/'/g,Fe=/"/g,ct=/^(?:script|style|textarea|title)$/i,Ht=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),p=Ht(1),L=Symbol.for("lit-noChange"),x=Symbol.for("lit-nothing"),je=new WeakMap,z=P.createTreeWalker(P,129);function ht(r,e){if(!ve(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return qe!==void 0?qe.createHTML(e):e}const Bt=(r,e)=>{const t=r.length-1,s=[];let i,n=e===2?"<svg>":e===3?"<math>":"",a=B;for(let o=0;o<t;o++){const l=r[o];let c,d,h=-1,g=0;for(;g<l.length&&(a.lastIndex=g,d=a.exec(l),d!==null);)g=a.lastIndex,a===B?d[1]==="!--"?a=Ue:d[1]!==void 0?a=He:d[2]!==void 0?(ct.test(d[2])&&(i=RegExp("</"+d[2],"g")),a=C):d[3]!==void 0&&(a=C):a===C?d[0]===">"?(a=i??B,h=-1):d[1]===void 0?h=-2:(h=a.lastIndex-d[2].length,c=d[1],a=d[3]===void 0?C:d[3]==='"'?Fe:Be):a===Fe||a===Be?a=C:a===Ue||a===He?a=B:(a=C,i=void 0);const k=a===C&&r[o+1].startsWith("/>")?" ":"";n+=a===B?l+qt:h>=0?(s.push(c),l.slice(0,h)+ot+l.slice(h)+R+k):l+R+(h===-2?o:k)}return[ht(r,n+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};let de=class pt{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let n=0,a=0;const o=e.length-1,l=this.parts,[c,d]=Bt(e,t);if(this.el=pt.createElement(c,s),z.currentNode=this.el.content,t===2||t===3){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=z.nextNode())!==null&&l.length<o;){if(i.nodeType===1){if(i.hasAttributes())for(const h of i.getAttributeNames())if(h.endsWith(ot)){const g=d[a++],k=i.getAttribute(h).split(R),b=/([.?@])?(.*)/.exec(g);l.push({type:1,index:n,name:b[2],strings:k,ctor:b[1]==="."?jt:b[1]==="?"?Zt:b[1]==="@"?Kt:ne}),i.removeAttribute(h)}else h.startsWith(R)&&(l.push({type:6,index:n}),i.removeAttribute(h));if(ct.test(i.tagName)){const h=i.textContent.split(R),g=h.length-1;if(g>0){i.textContent=ee?ee.emptyScript:"";for(let k=0;k<g;k++)i.append(h[k],K()),z.nextNode(),l.push({type:2,index:++n});i.append(h[g],K())}}}else if(i.nodeType===8)if(i.data===lt)l.push({type:2,index:n});else{let h=-1;for(;(h=i.data.indexOf(R,h+1))!==-1;)l.push({type:7,index:n}),h+=R.length-1}n++}}static createElement(e,t){const s=P.createElement("template");return s.innerHTML=e,s}};function N(r,e,t=r,s){if(e===L)return e;let i=s!==void 0?t._$Co?.[s]:t._$Cl;const n=Q(e)?void 0:e._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),n===void 0?i=void 0:(i=new n(r),i._$AT(r,t,s)),s!==void 0?(t._$Co??=[])[s]=i:t._$Cl=i),i!==void 0&&(e=N(r,i._$AS(r,e.values),i,s)),e}let Ft=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,i=(e?.creationScope??P).importNode(t,!0);z.currentNode=i;let n=z.nextNode(),a=0,o=0,l=s[0];for(;l!==void 0;){if(a===l.index){let c;l.type===2?c=new W(n,n.nextSibling,this,e):l.type===1?c=new l.ctor(n,l.name,l.strings,this,e):l.type===6&&(c=new Qt(n,this,e)),this._$AV.push(c),l=s[++o]}a!==l?.index&&(n=z.nextNode(),a++)}return z.currentNode=P,i}p(e){let t=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}};class W{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,i){this.type=2,this._$AH=x,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=N(this,e,t),Q(e)?e===x||e==null||e===""?(this._$AH!==x&&this._$AR(),this._$AH=x):e!==this._$AH&&e!==L&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ut(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!==x&&Q(this._$AH)?this._$AA.nextSibling.data=e:this.T(P.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:s}=e,i=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=de.createElement(ht(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const n=new Ft(i,this),a=n.u(this.options);n.p(t),this.T(a),this._$AH=n}}_$AC(e){let t=je.get(e.strings);return t===void 0&&je.set(e.strings,t=new de(e)),t}k(e){ve(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,i=0;for(const n of e)i===t.length?t.push(s=new W(this.O(K()),this.O(K()),this,this.options)):s=t[i],s._$AI(n),i++;i<t.length&&(this._$AR(s&&s._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const s=Ne(e).nextSibling;Ne(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,i,n){this.type=1,this._$AH=x,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=x}_$AI(e,t=this,s,i){const n=this.strings;let a=!1;if(n===void 0)e=N(this,e,t,0),a=!Q(e)||e!==this._$AH&&e!==L,a&&(this._$AH=e);else{const o=e;let l,c;for(e=n[0],l=0;l<n.length-1;l++)c=N(this,o[s+l],t,l),c===L&&(c=this._$AH[l]),a||=!Q(c)||c!==this._$AH[l],c===x?e=x:e!==x&&(e+=(c??"")+n[l+1]),this._$AH[l]=c}a&&!i&&this.j(e)}j(e){e===x?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},jt=class extends ne{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===x?void 0:e}},Zt=class extends ne{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==x)}},Kt=class extends ne{constructor(e,t,s,i,n){super(e,t,s,i,n),this.type=5}_$AI(e,t=this){if((e=N(this,e,t,0)??x)===L)return;const s=this._$AH,i=e===x&&s!==x||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==x&&(s===x||i);i&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Qt=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 Vt=ke.litHtmlPolyfillSupport;Vt?.(de,W),(ke.litHtmlVersions??=[]).push("3.3.3");const Wt=(r,e,t)=>{const s=t?.renderBefore??e;let i=s._$litPart$;if(i===void 0){const n=t?.renderBefore??null;s._$litPart$=i=new W(e.insertBefore(K(),n),n,void 0,t??{})}return i._$AI(r),i};/**
16
+ * @license
17
+ * Copyright 2017 Google LLC
18
+ * SPDX-License-Identifier: BSD-3-Clause
19
+ */const $e=globalThis;let S=class extends M{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=Wt(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 Yt=$e.litElementPolyfillSupport;Yt?.({LitElement:S});($e.litElementVersions??=[]).push("4.2.2");var dt;let ce=0;const Ze=new Set;function Gt(r){ce++;try{r()}finally{ce--,ce===0&&Jt()}}function Jt(){const r=new Set(Ze);Ze.clear();for(const e of r)e()}function Xt(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function es(r){return r&&typeof r.deref=="function"}class ye{static#e=0;#t;#s;#i=new Set;#r=dt.#e++;name;constructor(e,t){this.#t=e,this.#s=e,this.name=t}_get(){return u.activeConsumer&&u.activeConsumer.track(this),this.#t}_set(e){return Xt(e,this.#t)?(this.#s=this.#t,this.#t=e,this._notify(),!0):!1}subscribe(e,t=!1){let s=e;return t&&(s=new WeakRef(e)),this.#i.add(s),()=>this.#i.delete(s)}_notify(){const e=[...this.#i];for(const t of e){let s;if(es(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}`}}dt=ye;class u extends ye{static#e=[];constructor(e,t){super(e,t)}static get activeConsumer(){return this.#e[this.#e.length-1]}static push(e){this.#e.push(e)}static pop(){this.#e.pop()}get(){return this._get()}set(e){Gt(()=>{this._set(e)})}get value(){return this.get()}set value(e){this.set(e)}update(e){this.set(e(this.get()))}}class ts extends ye{#e;#t=!0;#s=!1;#i=new Map;_debugParent;#r;#h=()=>{this.#t||(this.#t=!0,this._notify())};constructor(e,t,s){super(void 0,t),this.#e=e,this.#r=s?.weak??!0}track(e){if(this.#i.has(e))return;const t=e.subscribe(this.#h,this.#r);this.#i.set(e,t)}dispose(){this.#o()}#o(){for(const e of this.#i.values())e();this.#i.clear()}get(){if(u.activeConsumer&&u.activeConsumer.track(this),!this.#t)return this._get();if(this.#s)throw new Error(`Cycle detected in ${this}
20
+ ↳ while computing ${this._debugParent??"root"}`);this.#s=!0,this.#o(),u.push(this);try{const e=this.#e();this._set(e)}finally{u.pop(),this.#t=!1,this.#s=!1}return this._get()}get value(){return this.get()}set value(e){throw new Error(`Cannot set value of Computed ${this}. Computed values are read-only.`)}subscribe(e,t=!1){const s=super.subscribe(e,t);return u.activeConsumer||this.get(),s}}class we{#e;#t=new Map;_debugParent;constructor(e){this.#e=e,e.addController(this);const t=e,s=t.update,i=this;t.update=function(n){u.push(i);try{s.call(this,n)}finally{u.pop()}}}track(e){this.#t.has(e)||this.#t.set(e,e.subscribe(this.#s,!0))}#s=()=>{this.#e.requestUpdate()};hostUpdate(){for(const e of this.#t.values())e();this.#t.clear()}hostDisconnected(){for(const e of this.#t.values())e();this.#t.clear()}toString(){const e=this.#e;return`SignalWatcher(${e?.localName??e?.tagName??e?.constructor?.name??"unknown"})`}}const ss=new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"});function is(r){if(!r)return"unknown age";const e=new Date(r);return Number.isNaN(e.getTime())?"unknown age":ss.format(e)}class rs extends S{static{this.properties={results:{attribute:!1},showRoot:{attribute:!1},onSelect:{attribute:!1},selectedIds:{attribute:!1},onToggleSelect:{attribute:!1}}}static{this.styles=V`
21
+ :host { display: block; }
22
+ .count-header {
23
+ padding: 8px 14px;
24
+ font-size: 11px;
25
+ font-weight: 600;
26
+ text-transform: uppercase;
27
+ opacity: 0.6;
28
+ background: var(--bg);
29
+ border-bottom: 1px solid var(--border);
30
+ }
31
+ .row { padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; gap: 8px; }
32
+ .row:hover { background: var(--hover); }
33
+ .row.deprecated { opacity: 0.55; }
34
+ .row.paused { opacity: 0.6; }
35
+ .row-checkbox { flex: 0 0 auto; margin-top: 2px; cursor: pointer; }
36
+ .row-body { flex: 1 1 auto; min-width: 0; }
37
+ .top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
38
+ .name { font-weight: 600; }
39
+ .deprecated .name { text-decoration: line-through; }
40
+ .meta { opacity: 0.65; font-size: 11px; white-space: nowrap; }
41
+ .desc { font-size: 12px; opacity: 0.8; margin-top: 3px; }
42
+ .tags { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
43
+ .tag { font-size: 10px; border: 1px solid var(--border-strong); border-radius: 999px; padding: 1px 6px; }
44
+ .type-badge { font-size: 10px; text-transform: uppercase; opacity: 0.6; }
45
+ .root-badge {
46
+ font-size: 10px; text-transform: uppercase; opacity: 0.9; border: 1px solid var(--purple);
47
+ color: var(--purple-fg); background: var(--purple-tint); border-radius: 4px; padding: 0 4px;
48
+ }
49
+ .deprecated-badge {
50
+ font-size: 10px; text-transform: uppercase; border: 1px solid var(--danger);
51
+ color: var(--danger); background: color-mix(in srgb, var(--danger) 13%, transparent); border-radius: 4px; padding: 0 4px;
52
+ }
53
+ .paused-badge {
54
+ font-size: 10px; text-transform: uppercase; border: 1px solid var(--accent);
55
+ color: var(--accent); background: var(--accent-tint); border-radius: 4px; padding: 0 4px;
56
+ }
57
+ .empty { padding: 24px; opacity: 0.6; font-size: 13px; }
58
+ `}render(){return!this.results||this.results.length===0?p`<div class="empty">No results.</div>`:p`
59
+ <div class="count-header">${this.results.length} result${this.results.length===1?"":"s"}</div>
60
+ ${this.results.map(e=>{const t=e._table==="skills"&&e.root==="builtin";return p`
61
+ <div class="row ${e.deprecated?"deprecated":""} ${e.paused?"paused":""}" @click=${()=>this.onSelect(e)}>
62
+ <input
63
+ type="checkbox"
64
+ class="row-checkbox"
65
+ .checked=${this.selectedIds?.has(e.id)??!1}
66
+ .disabled=${t}
67
+ title=${t?"Builtin skills can't be bulk-deprecated, paused, or deleted":""}
68
+ @click=${s=>{s.stopPropagation(),t||this.onToggleSelect(e)}}
69
+ />
70
+ <div class="row-body">
71
+ <div class="top">
72
+ <span class="name">${e.name}</span>
73
+ <span class="meta">${is(e.created_at)} · ${e.owner??"—"} · ${e.status}</span>
74
+ </div>
75
+ <div class="desc">${e.description}</div>
76
+ <div class="tags">
77
+ <span class="type-badge">${e._table==="skills"?"skill":"memory"}</span>
78
+ ${this.showRoot&&e.root?p`<span class="root-badge">${e.root}</span>`:""}
79
+ ${e.deprecated?p`<span class="deprecated-badge">deprecated</span>`:""}
80
+ ${e.paused?p`<span class="paused-badge">paused</span>`:""}
81
+ ${e.tags.map(s=>p`<span class="tag">${s}</span>`)}
82
+ </div>
83
+ </div>
84
+ </div>
85
+ `})}
86
+ `}}customElements.define("result-list",rs);function _e(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var O=_e();function ut(r){O=r}var E={exec:()=>null};function I(r){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),i=e[s];return i||(i=r(s),e[s]=i),i}}function f(r,e=""){let t=typeof r=="string"?r:r.source,s={replace:(i,n)=>{let a=typeof n=="string"?n:n.source;return a=a.replace(v.caret,"$1"),t=t.replace(i,a),s},getRegex:()=>new RegExp(t,e)};return s}var ns=((r="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+r)}catch{return!1}})(),v={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:I(r=>new RegExp(`^ {0,${r}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:I(r=>new RegExp(`^ {0,${r}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:I(r=>new RegExp(`^ {0,${r}}(?:\`\`\`|~~~)`)),headingBeginRegex:I(r=>new RegExp(`^ {0,${r}}#`)),htmlBeginRegex:I(r=>new RegExp(`^ {0,${r}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:I(r=>new RegExp(`^ {0,${r}}>`))},as=/^(?:[ \t]*(?:\n|$))+/,os=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ls=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Y=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,cs=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Se=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,gt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ft=f(gt).replace(/bull/g,Se).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),hs=f(gt).replace(/bull/g,Se).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(),Ae=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,ps=/^[^\n]+/,Te=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ds=f(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Te).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),us=f(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Se).getRegex(),ae="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]*?(?:-->|$))/,gs=f("^ {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",ae).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),bt=r=>f(Ae).replace("hr",Y).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",r).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ae).getRegex(),fs=bt(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),bs=bt(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),xs=f(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",bs).getRegex(),Ce={blockquote:xs,code:os,def:ds,fences:ls,heading:cs,hr:Y,html:gs,lheading:ft,list:us,newline:as,paragraph:fs,table:E,text:ps},Ke=f("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Y).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",ae).getRegex(),ms={...Ce,lheading:hs,table:Ke,paragraph:f(Ae).replace("hr",Y).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ke).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",ae).getRegex()},ks={...Ce,html:f(`^ *(?: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:E,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:f(Ae).replace("hr",Y).replace("heading",` *#{1,6} *[^
87
+ ]`).replace("lheading",ft).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},vs=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,$s=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,xt=/^( {2,}|\\)\n(?!\s*$)/,ys=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,A=/[\p{P}\p{S}]/u,q=/[\s\p{P}\p{S}]/u,G=/[^\s\p{P}\p{S}]/u,ws=f(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,q).getRegex(),_s=/[\p{Pi}\p{Ps}"']/u,mt=/(?!~)[\p{P}\p{S}]/u,Ss=/(?!~)[\s\p{P}\p{S}]/u,As=/(?:[^\s\p{P}\p{S}]|~)/u,Ts=f(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",ns?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),kt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Rs=f(kt,"u").replace(/punct/g,A).getRegex(),Cs=f(kt,"u").replace(/punct/g,mt).getRegex(),Es=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,zs=f(Es,"u").replace(/openQuote/g,_s).replace(/punct/g,A).getRegex(),vt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Ps=f(vt,"gu").replace(/notPunctSpace/g,G).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Ls=f(vt,"gu").replace(/notPunctSpace/g,As).replace(/punctSpace/g,Ss).replace(/punct/g,mt).getRegex(),Ds="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",Os=f(Ds,"gu").replace(/notPunctSpace/g,G).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Is=f("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,G).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Ms="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Ns=f(Ms,"gu").replace(/notPunctSpace/g,G).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),qs=f(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,A).getRegex(),Us="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Hs=f(Us,"gu").replace(/notPunctSpace/g,G).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Bs=f(/\\(punct)/,"gu").replace(/punct/g,A).getRegex(),Fs=f(/^<(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(),js=f(Re).replace("(?:-->|$)","-->").getRegex(),Zs=f("^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",js).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),te=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Ks=f(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",te).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),$t=f(/^!?\[(label)\]\[(ref)\]/).replace("label",te).replace("ref",Te).getRegex(),yt=f(/^!?\[(ref)\](?:\[\])?/).replace("ref",Te).getRegex(),Qs=f("reflink|nolink(?!\\()","g").replace("reflink",$t).replace("nolink",yt).getRegex(),Qe=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ee={_backpedal:E,anyPunctuation:Bs,autolink:Fs,blockSkip:Ts,br:xt,code:$s,del:E,delLDelim:E,delRDelim:E,emStrongLDelim:Rs,emStrongRDelimAst:Ps,emStrongRDelimUnd:Is,escape:vs,link:Ks,nolink:yt,punctuation:ws,reflink:$t,reflinkSearch:Qs,tag:Zs,text:ys,url:E},Vs={...Ee,emStrongLDelim:zs,emStrongRDelimAst:Os,emStrongRDelimUnd:Ns,link:f(/^!?\[(label)\]\((.*?)\)/).replace("label",te).getRegex(),reflink:f(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",te).getRegex()},ue={...Ee,emStrongRDelimAst:Ls,emStrongLDelim:Cs,delLDelim:qs,delRDelim:Hs,url:f(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Qe).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:f(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Qe).getRegex()},Ws={...ue,br:f(xt).replace("{2,}","*").getRegex(),text:f(ue.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},J={normal:Ce,gfm:ms,pedantic:ks},F={normal:Ee,gfm:ue,breaks:Ws,pedantic:Vs},Ys={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Ve=r=>Ys[r];function _(r,e){if(e){if(v.escapeTest.test(r))return r.replace(v.escapeReplace,Ve)}else if(v.escapeTestNoEncode.test(r))return r.replace(v.escapeReplaceNoEncode,Ve);return r}function We(r){try{r=encodeURI(r).replace(v.percentDecode,"%")}catch{return null}return r}function Ye(r,e){let t=r.replace(v.findPipe,(n,a,o)=>{let l=!1,c=a;for(;--c>=0&&o[c]==="\\";)l=!l;return l?"|":" |"}),s=t.split(v.splitPipe),i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(v.slashPipe,"|");return s}function T(r,e,t){let s=r.length;if(s===0)return"";let i=0;for(;i<s&&r.charAt(s-i-1)===e;)i++;return r.slice(0,s-i)}function Ge(r){let e=r.split(`
88
+ `),t=e.length-1;for(;t>=0&&v.blankLine.test(e[t]);)t--;return e.length-t<=2?r:e.slice(0,t+1).join(`
89
+ `)}function Gs(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<r.length;s++)if(r[s]==="\\")s++;else if(r[s]===e[0])t++;else if(r[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function Js(r,e=0){let t=e,s="";for(let i of r)if(i===" "){let n=4-t%4;s+=" ".repeat(n),t+=n}else s+=i,t++;return s}function Je(r,e,t,s,i){let n=e.href,a=e.title||null,o=r[1].replace(i.other.outputLinkReplace,"$1");s.state.inLink=!0;let l={type:r[0].charAt(0)==="!"?"image":"link",raw:t,href:n,title:a,text:o,tokens:s.inlineTokens(o)};return s.state.inLink=!1,l}function Xs(r,e,t){let s=r.match(t.other.indentCodeCompensation);if(s===null)return e;let i=s[1];return e.split(`
90
+ `).map(n=>{let a=n.match(t.other.beginningSpace);if(a===null)return n;let[o]=a;return o.length>=i.length?n.slice(i.length):n}).join(`
91
+ `)}var se=class{options;rules;lexer;constructor(r){this.options=r||O}space(r){let e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){let e=this.rules.block.code.exec(r);if(e){let t=this.options.pedantic?e[0]:Ge(e[0]),s=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:s}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let t=e[0],s=Xs(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(r){let e=this.rules.block.heading.exec(r);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=T(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:T(e[0],`
92
+ `),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(r){let e=this.rules.block.hr.exec(r);if(e)return{type:"hr",raw:T(e[0],`
93
+ `)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=T(e[0],`
94
+ `).split(`
95
+ `),s="",i="",n=[];for(;t.length>0;){let a=!1,o=[],l;for(l=0;l<t.length;l++)if(this.rules.other.blockquoteStart.test(t[l]))o.push(t[l]),a=!0;else if(!a)o.push(t[l]);else break;t=t.slice(l);let c=o.join(`
96
+ `),d=c.replace(this.rules.other.blockquoteSetextReplace,`
97
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
98
+ ${c}`:c,i=i?`${i}
99
+ ${d}`:d;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(d,n,!0),this.lexer.state.top=h,t.length===0)break;let g=n.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){let k=g,b=t.join(`
100
+ `),w=k.raw+`
101
+ `+b.replace(this.rules.other.blockquoteSetextReplace2,""),U=this.blockquote(w);n[n.length-1]=U,s=`${s}
102
+ ${b}`,i=i.substring(0,i.length-k.text.length)+U.text;break}else if(g?.type==="list"){let k=g,b=k.raw+`
103
+ `+t.join(`
104
+ `),w=this.list(b);n[n.length-1]=w,s=s.substring(0,s.length-g.raw.length)+w.raw,i=i.substring(0,i.length-k.raw.length)+w.raw,t=b.substring(n.at(-1).raw.length).split(`
105
+ `);continue}}return{type:"blockquote",raw:s,tokens:n,text:i}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=e[1].trim(),s=t.length>1,i={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let n=this.rules.other.listItemRegex(t),a=!1;for(;r;){let l=!1,c="",d="";if(!(e=n.exec(r))||this.rules.block.hr.test(r))break;c=e[0],r=r.substring(c.length);let h=Js(e[2].split(`
106
+ `,1)[0],e[1].length),g=r.split(`
107
+ `,1)[0],k=!h.trim(),b=0;if(this.options.pedantic?(b=2,d=h.trimStart()):k?b=e[1].length+1:(b=h.search(this.rules.other.nonSpaceChar),b=b>4?1:b,d=h.slice(b),b+=e[1].length),k&&this.rules.other.blankLine.test(g)&&(c+=g+`
108
+ `,r=r.substring(g.length+1),l=!0),!l){let w=this.rules.other.nextBulletRegex(b),U=this.rules.other.hrRegex(b),Pe=this.rules.other.fencesBeginRegex(b),Le=this.rules.other.headingBeginRegex(b),Tt=this.rules.other.htmlBeginRegex(b),Rt=this.rules.other.blockquoteBeginRegex(b);for(;r;){let oe=r.split(`
109
+ `,1)[0],H;if(g=oe,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),H=g):H=g.replace(this.rules.other.tabCharGlobal," "),Pe.test(g)||Le.test(g)||Tt.test(g)||Rt.test(g)||w.test(g)||U.test(g))break;if(H.search(this.rules.other.nonSpaceChar)>=b||!g.trim())d+=`
110
+ `+H.slice(b);else{if(k||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||Pe.test(h)||Le.test(h)||U.test(h))break;d+=`
111
+ `+g}k=!g.trim(),c+=oe+`
112
+ `,r=r.substring(oe.length+1),h=H.slice(b)}}i.loose||(a?i.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(a=!0)),i.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(d),loose:!1,text:d,tokens:[]}),i.raw+=c}let o=i.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let l of i.items)if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),!i.loose){let c=l.tokens.filter(h=>h.type==="space"),d=c.length>0&&c.some(h=>this.rules.other.anyLine.test(h.raw));i.loose=d}for(let l of i.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 d=this.rules.other.listTaskCheckbox.exec(l.raw);if(d){let h={type:"checkbox",raw:d[0]+" ",checked:d[0]!=="[ ]"};l.checked=h.checked,i.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(i.loose)for(let l of i.items){l.loose=!0;for(let c of l.tokens)c.type==="text"&&(c.type="paragraph")}return i}}html(r){let e=this.rules.block.html.exec(r);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(r){let e=this.rules.block.def.exec(r);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:T(e[0],`
113
+ `),href:s,title:i}}}table(r){let e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=Ye(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
114
+ `):[],n={type:"table",raw:T(e[0],`
115
+ `),header:[],align:[],rows:[]};if(t.length===s.length){for(let a of s)this.rules.other.tableAlignRight.test(a)?n.align.push("right"):this.rules.other.tableAlignCenter.test(a)?n.align.push("center"):this.rules.other.tableAlignLeft.test(a)?n.align.push("left"):n.align.push(null);for(let a=0;a<t.length;a++)n.header.push({text:t[a],tokens:this.lexer.inline(t[a]),header:!0,align:n.align[a]});for(let a of i)n.rows.push(Ye(a,n.header.length).map((o,l)=>({text:o,tokens:this.lexer.inline(o),header:!1,align:n.align[l]})));return n}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e){let t=e[1].trim();return{type:"heading",raw:T(e[0],`
116
+ `),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(r){let e=this.rules.block.paragraph.exec(r);if(e){let t=e[1].charAt(e[1].length-1)===`
117
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(r){let e=this.rules.inline.link.exec(r);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let n=T(t.slice(0,-1),"\\");if((t.length-n.length)%2===0)return}else{let n=Gs(e[2],"()");if(n===-2)return;if(n>-1){let a=(e[0].indexOf("!")===0?5:4)+e[1].length+n;e[2]=e[2].substring(0,n),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let s=e[2],i="";if(this.options.pedantic){let n=this.rules.other.pedanticHrefTitle.exec(s);n&&(s=n[1],i=n[3])}else i=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),Je(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[s.toLowerCase()];if(!i){let n=t[0].charAt(0);return{type:"text",raw:n,text:n}}return Je(t,i,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(r);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,n,a,o=i,l=0,c=s[0][0],d=t===c,h=c==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*r.length+i);(s=h.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n)continue;if(a=[...n].length,s[3]||s[4]){o+=a;continue}else if(s[5]||s[6]){if(i%3&&!((i+a)%3)){l+=a;continue}if(d)break}if(o-=a,o>0)continue;a=Math.min(a,a+o+l);let g=[...s[0]][0].length,k=r.slice(0,i+s.index+g+a);if(Math.min(i,a)%2){let w=k.slice(1,-1);return{type:"em",raw:k,text:w,tokens:this.lexer.inlineTokens(w)}}let b=k.slice(2,-2);return{type:"strong",raw:k,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r,e,t=""){let s=this.rules.inline.delLDelim.exec(r);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,n,a,o=i,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*r.length+i);(s=l.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n||(a=[...n].length,a!==i))continue;if(s[3]||s[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let c=[...s[0]][0].length,d=r.slice(0,i+s.index+c+a),h=d.slice(i,-i);return{type:"del",raw:d,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(r){let e=this.rules.inline.autolink.exec(r);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(r){let e;if(e=this.rules.inline.url.exec(r)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(r){let e=this.rules.inline.text.exec(r);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},$=class ge{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||O,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:v,block:J.normal,inline:F.normal};this.options.pedantic?(t.block=J.pedantic,t.inline=F.pedantic):this.options.gfm&&(t.block=J.gfm,this.options.breaks?t.inline=F.breaks:t.inline=F.gfm),this.tokenizer.rules=t}static get rules(){return{block:J,inline:F}}static lex(e,t){return new ge(t).lex(e)}static lexInline(e,t){return new ge(t).inlineTokens(e)}lex(e){e=e.replace(v.carriageReturn,`
118
+ `),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(v.tabCharGlobal," ").replace(v.spaceLine,""));let i=1/0;for(;e;){if(e.length<i)i=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let n;if(this.options.extensions?.block?.some(o=>(n=o.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 o=t.at(-1);n.raw.length===1&&o!==void 0?o.raw+=`
119
+ `:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length);let o=t.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
120
+ `)?"":`
121
+ `)+n.raw,o.text+=`
122
+ `+n.text,this.inlineQueue.at(-1).src=o.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 o=t.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
123
+ `)?"":`
124
+ `)+n.raw,o.text+=`
125
+ `+n.raw,this.inlineQueue.at(-1).src=o.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 a=e;if(this.options.extensions?.startBlock){let o=1/0,l=e.slice(1),c;this.options.extensions.startBlock.forEach(d=>{c=d.call({lexer:this},l),typeof c=="number"&&c>=0&&(o=Math.min(o,c))}),o<1/0&&o>=0&&(a=e.substring(0,o+1))}if(this.state.top&&(n=this.tokenizer.paragraph(a))){let o=t.at(-1);s&&o?.type==="paragraph"?(o.raw+=(o.raw.endsWith(`
126
+ `)?"":`
127
+ `)+n.raw,o.text+=`
128
+ `+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(n),s=a.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length);let o=t.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(`
129
+ `)?"":`
130
+ `)+n.raw,o.text+=`
131
+ `+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.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 o=Object.keys(this.tokens.links);o.length>0&&(s=s.replace(this.tokenizer.rules.inline.reflinkSearch,l=>o.includes(l.slice(l.lastIndexOf("[")+1,-1))?"["+"a".repeat(l.length-2)+"]":l))}s=s.replace(this.tokenizer.rules.inline.anyPunctuation,o=>"+".repeat(o.length)),s=s.replace(this.tokenizer.rules.inline.blockSkip,(o,l,c)=>{let d=c?c.length:0;return o.slice(0,d)+"["+"a".repeat(o.length-d-2)+"]"}),s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let i=!1,n="",a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}i||(n=""),i=!1;let o;if(this.options.extensions?.inline?.some(c=>(o=c.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let c=t.at(-1);o.type==="text"&&c?.type==="text"?(c.raw+=o.raw,c.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,s,n)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,s,n)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let l=e;if(this.options.extensions?.startInline){let c=1/0,d=e.slice(1),h;this.options.extensions.startInline.forEach(g=>{h=g.call({lexer:this},d),typeof h=="number"&&h>=0&&(c=Math.min(c,h))}),c<1/0&&c>=0&&(l=e.substring(0,c+1))}if(o=this.tokenizer.inlineText(l)){e=e.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(n=o.raw.slice(-1)),i=!0;let c=t.at(-1);c?.type==="text"?(c.raw+=o.raw,c.text+=o.text):t.push(o);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(r){this.options=r||O}space(r){return""}code({text:r,lang:e,escaped:t}){let s=(e||"").match(v.notSpaceStart)?.[0],i=r.replace(v.endingNewline,"")+`
132
+ `;return s?'<pre><code class="language-'+_(s)+'">'+(t?i:_(i,!0))+`</code></pre>
133
+ `:"<pre><code>"+(t?i:_(i,!0))+`</code></pre>
134
+ `}blockquote({tokens:r}){return`<blockquote>
135
+ ${this.parser.parse(r)}</blockquote>
136
+ `}html({text:r}){return r}def(r){return""}heading({tokens:r,depth:e}){return`<h${e}>${this.parser.parseInline(r)}</h${e}>
137
+ `}hr(r){return`<hr>
138
+ `}list(r){let e=r.ordered,t=r.start,s="";for(let a=0;a<r.items.length;a++){let o=r.items[a];s+=this.listitem(o)}let i=e?"ol":"ul",n=e&&t!==1?' start="'+t+'"':"";return"<"+i+n+`>
139
+ `+s+"</"+i+`>
140
+ `}listitem(r){return`<li>${this.parser.parse(r.tokens)}</li>
141
+ `}checkbox({checked:r}){return"<input "+(r?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:r}){return`<p>${this.parser.parseInline(r)}</p>
142
+ `}table(r){let e="",t="";for(let i=0;i<r.header.length;i++)t+=this.tablecell(r.header[i]);e+=this.tablerow({text:t});let s="";for(let i=0;i<r.rows.length;i++){let n=r.rows[i];t="";for(let a=0;a<n.length;a++)t+=this.tablecell(n[a]);s+=this.tablerow({text:t})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
143
+ <thead>
144
+ `+e+`</thead>
145
+ `+s+`</table>
146
+ `}tablerow({text:r}){return`<tr>
147
+ ${r}</tr>
148
+ `}tablecell(r){let e=this.parser.parseInline(r.tokens),t=r.header?"th":"td";return(r.align?`<${t} align="${r.align}">`:`<${t}>`)+e+`</${t}>
149
+ `}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${_(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:t}){let s=this.parser.parseInline(t),i=We(r);if(i===null)return s;r=i;let n='<a href="'+r+'"';return e&&(n+=' title="'+_(e)+'"'),n+=">"+s+"</a>",n}image({href:r,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let i=We(r);if(i===null)return _(t);r=i;let n=`<img src="${r}" alt="${_(t)}"`;return e&&(n+=` title="${_(e)}"`),n+=">",n}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:_(r.text)}},ze=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}checkbox({raw:r}){return r}},y=class fe{options;renderer;textRenderer;constructor(e){this.options=e||O,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 ze}static parse(e,t){return new fe(t).parse(e)}static parseInline(e,t){return new fe(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let a=i,o=this.options.extensions.renderers[a.type].call({parser:this},a);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(a.type)){t+=o||"";continue}}let n=i;switch(n.type){case"space":{t+=this.renderer.space(n);break}case"hr":{t+=this.renderer.hr(n);break}case"heading":{t+=this.renderer.heading(n);break}case"code":{t+=this.renderer.code(n);break}case"table":{t+=this.renderer.table(n);break}case"blockquote":{t+=this.renderer.blockquote(n);break}case"list":{t+=this.renderer.list(n);break}case"checkbox":{t+=this.renderer.checkbox(n);break}case"html":{t+=this.renderer.html(n);break}case"def":{t+=this.renderer.def(n);break}case"paragraph":{t+=this.renderer.paragraph(n);break}case"text":{t+=this.renderer.text(n);break}default:{let a='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let s="";for(let i=0;i<e.length;i++){let n=e[i];if(this.options.extensions?.renderers?.[n.type]){let o=this.options.extensions.renderers[n.type].call({parser:this},n);if(o!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(n.type)){s+=o||"";continue}}let a=n;switch(a.type){case"escape":{s+=t.text(a);break}case"html":{s+=t.html(a);break}case"link":{s+=t.link(a);break}case"image":{s+=t.image(a);break}case"checkbox":{s+=t.checkbox(a);break}case"strong":{s+=t.strong(a);break}case"em":{s+=t.em(a);break}case"codespan":{s+=t.codespan(a);break}case"br":{s+=t.br(a);break}case"del":{s+=t.del(a);break}case"text":{s+=t.text(a);break}default:{let o='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return s}},j=class{options;block;constructor(r){this.options=r||O}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}emStrongMask(r){return r}provideLexer(r=this.block){return r?$.lex:$.lexInline}provideParser(r=this.block){return r?y.parse:y.parseInline}},ei=class{defaults=_e();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=y;Renderer=ie;TextRenderer=ze;Lexer=$;Tokenizer=se;Hooks=j;constructor(...r){this.use(...r)}walkTokens(r,e){let t=[];for(let s of r)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let i=s;for(let n of i.header)t=t.concat(this.walkTokens(n.tokens,e));for(let n of i.rows)for(let a of n)t=t.concat(this.walkTokens(a.tokens,e));break}case"list":{let i=s;t=t.concat(this.walkTokens(i.items,e));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(n=>{let a=i[n].flat(1/0);t=t.concat(this.walkTokens(a,e))}):i.tokens&&(t=t.concat(this.walkTokens(i.tokens,e)))}}return t}use(...r){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let n=e.renderers[i.name];n?e.renderers[i.name]=function(...a){let o=i.renderer.apply(this,a);return o===!1&&(o=n.apply(this,a)),o}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let n=e[i.level];n?n.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),s.extensions=e),t.renderer){let i=this.defaults.renderer||new ie(this.defaults);for(let n in t.renderer){if(!(n in i))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let a=n,o=t.renderer[a],l=i[a];i[a]=(...c)=>{let d=o.apply(i,c);return d===!1&&(d=l.apply(i,c)),d||""}}s.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new se(this.defaults);for(let n in t.tokenizer){if(!(n in i))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let a=n,o=t.tokenizer[a],l=i[a];i[a]=(...c)=>{let d=o.apply(i,c);return d===!1&&(d=l.apply(i,c)),d}}s.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new j;for(let n in t.hooks){if(!(n in i))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let a=n,o=t.hooks[a],l=i[a];j.passThroughHooks.has(n)?i[a]=c=>{if(this.defaults.async&&j.passThroughHooksRespectAsync.has(n))return(async()=>{let h=await o.call(i,c);return l.call(i,h)})();let d=o.call(i,c);return l.call(i,d)}:i[a]=(...c)=>{if(this.defaults.async)return(async()=>{let h=await o.apply(i,c);return h===!1&&(h=await l.apply(i,c)),h})();let d=o.apply(i,c);return d===!1&&(d=l.apply(i,c)),d}}s.hooks=i}if(t.walkTokens){let i=this.defaults.walkTokens,n=t.walkTokens;s.walkTokens=function(a){let o=[];return o.push(n.call(this,a)),i&&(o=o.concat(i.call(this,a))),o}}this.defaults={...this.defaults,...s}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return $.lex(r,e??this.defaults)}parser(r,e){return y.parse(r,e??this.defaults)}parseMarkdown(r){return(e,t)=>{let s={...t},i={...this.defaults,...s},n=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return n(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return n(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return n(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=r),i.async)return(async()=>{let a=i.hooks?await i.hooks.preprocess(e):e,o=await(i.hooks?await i.hooks.provideLexer(r):r?$.lex:$.lexInline)(a,i),l=i.hooks?await i.hooks.processAllTokens(o):o;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let c=await(i.hooks?await i.hooks.provideParser(r):r?y.parse:y.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(c):c})().catch(n);try{i.hooks&&(e=i.hooks.preprocess(e));let a=(i.hooks?i.hooks.provideLexer(r):r?$.lex:$.lexInline)(e,i);i.hooks&&(a=i.hooks.processAllTokens(a)),i.walkTokens&&this.walkTokens(a,i.walkTokens);let o=(i.hooks?i.hooks.provideParser(r):r?y.parse:y.parseInline)(a,i);return i.hooks&&(o=i.hooks.postprocess(o)),o}catch(a){return n(a)}}}onError(r,e){return t=>{if(t.message+=`
150
+ Please report this to https://github.com/markedjs/marked.`,r){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}}},D=new ei;function m(r,e){return D.parse(r,e)}m.options=m.setOptions=function(r){return D.setOptions(r),m.defaults=D.defaults,ut(m.defaults),m};m.getDefaults=_e;m.defaults=O;function ti(...r){return D.use(...r),m.defaults=D.defaults,ut(m.defaults),m}m.use=ti;m.walkTokens=function(r,e){return D.walkTokens(r,e)};m.parseInline=D.parseInline;m.Parser=y;m.parser=y.parse;m.Renderer=ie;m.TextRenderer=ze;m.Lexer=$;m.lexer=$.lex;m.Tokenizer=se;m.Hooks=j;m.parse=m;m.options;m.setOptions;m.walkTokens;m.parseInline;y.parse;$.lex;/**
151
+ * @license
152
+ * Copyright 2017 Google LLC
153
+ * SPDX-License-Identifier: BSD-3-Clause
154
+ */const si={CHILD:2},ii=r=>(...e)=>({_$litDirective$:r,values:e});class ri{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)}}/**
155
+ * @license
156
+ * Copyright 2017 Google LLC
157
+ * SPDX-License-Identifier: BSD-3-Clause
158
+ */class be extends ri{constructor(e){if(super(e),this.it=x,e.type!==si.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===x||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:[]}}}be.directiveName="unsafeHTML",be.resultType=1;const ni=ii(be);let Xe=0;class ai extends S{static{this.properties={tags:{attribute:!1},active:{attribute:!1},onToggle:{attribute:!1},allowCreate:{attribute:!1}}}#e=new u("");#t=new u(!1);#s=new u(-1);#i;#r;static{this.styles=V`
159
+ :host {
160
+ display: inline-block;
161
+ position: relative;
162
+ width: 260px;
163
+ font: inherit;
164
+ font-size: 13px;
165
+ }
166
+ .field {
167
+ display: flex;
168
+ align-items: center;
169
+ flex-wrap: wrap;
170
+ gap: 4px;
171
+ border: 1px solid var(--border-strong);
172
+ border-radius: 6px;
173
+ background: none;
174
+ padding: 3px 4px 3px 8px;
175
+ min-height: 30px;
176
+ box-sizing: border-box;
177
+ }
178
+ .field:focus-within {
179
+ border-color: var(--accent);
180
+ box-shadow: 0 0 0 2px var(--accent-tint);
181
+ }
182
+ .selected-chip {
183
+ display: inline-flex;
184
+ align-items: center;
185
+ gap: 4px;
186
+ background: var(--accent);
187
+ color: var(--accent-fg);
188
+ border-radius: 999px;
189
+ padding: 2px 6px 2px 10px;
190
+ font-size: 12px;
191
+ white-space: nowrap;
192
+ }
193
+ .selected-chip .remove {
194
+ cursor: pointer;
195
+ opacity: 0.85;
196
+ line-height: 1;
197
+ padding: 2px;
198
+ border-radius: 50%;
199
+ }
200
+ .selected-chip .remove:hover { opacity: 1; background: #ffffff33; }
201
+ .input {
202
+ flex: 1 1 60px;
203
+ min-width: 60px;
204
+ border: none;
205
+ outline: none;
206
+ padding: 5px 2px;
207
+ font: inherit;
208
+ font-size: 13px;
209
+ background: transparent;
210
+ color: inherit;
211
+ }
212
+ .clear-btn, .chevron-btn {
213
+ border: none;
214
+ background: transparent;
215
+ cursor: pointer;
216
+ color: inherit;
217
+ opacity: 0.6;
218
+ font-size: 12px;
219
+ padding: 2px 5px;
220
+ line-height: 1;
221
+ }
222
+ .clear-btn:hover, .chevron-btn:hover { opacity: 1; }
223
+ .chevron-btn { transition: transform 0.15s ease; }
224
+ .chevron-btn.open { transform: rotate(180deg); }
225
+
226
+ .menu {
227
+ position: fixed;
228
+ margin: 0;
229
+ inset: auto;
230
+ top: anchor(bottom);
231
+ left: anchor(left);
232
+ width: anchor-size(width);
233
+ position-try-fallbacks: flip-block;
234
+ list-style: none;
235
+ padding: 4px;
236
+ margin: 0;
237
+ border: 1px solid var(--border);
238
+ border-radius: 8px;
239
+ background: var(--bg);
240
+ color: inherit;
241
+ box-shadow: 0 8px 24px var(--shadow);
242
+ max-height: 260px;
243
+ overflow-y: auto;
244
+ box-sizing: border-box;
245
+ }
246
+ .menu:popover-open { margin-top: 4px; }
247
+ .menu[popover] { display: none; }
248
+ .menu.visible[popover] { display: block; }
249
+
250
+ .option {
251
+ display: flex;
252
+ align-items: center;
253
+ gap: 8px;
254
+ padding: 6px 8px;
255
+ border-radius: 5px;
256
+ cursor: pointer;
257
+ font-size: 13px;
258
+ }
259
+ .option:hover, .option.highlighted { background: var(--hover); }
260
+ .option input { margin: 0; pointer-events: none; }
261
+ .empty { padding: 6px 8px; opacity: 0.6; font-style: italic; font-size: 12px; }
262
+ .create-option { color: var(--accent); font-style: italic; }
263
+ `}constructor(){super(),new we(this),this.tags=[],this.active=[],this.onToggle=()=>{},this.allowCreate=!1,this.#i=`--tag-multiselect-${++Xe}`,this.#r=`tag-multiselect-listbox-${Xe}`}#h=e=>{e.composedPath().includes(this)||this.#u()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#h)}disconnectedCallback(){document.removeEventListener("click",this.#h),super.disconnectedCallback()}get#o(){const e=this.#e.value.trim().toLowerCase();return e?this.tags.filter(t=>t.toLowerCase().includes(e)):this.tags}#c(){this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#u(){this.#t.set(!1),this.#s.set(-1),this.renderRoot.querySelector(".menu")?.hidePopover()}#l(){this.#t.value?this.#u():(this.#c(),this.renderRoot.querySelector(".input")?.focus())}#n(e){this.#e.set(e.target.value),this.#s.set(-1),this.#c()}#p(e){this.onToggle(e),this.#e.set(""),this.#s.set(-1)}get#b(){if(!this.allowCreate)return!1;const e=this.#e.value.trim();return e.length>0&&!this.tags.includes(e)&&!this.active.includes(e)}#x(e){e.stopPropagation(),this.active.forEach(t=>this.onToggle(t)),this.#e.set(""),this.renderRoot.querySelector(".input")?.focus(),this.#c()}#g(e){const t=this.#o;if(e.key==="ArrowDown")e.preventDefault(),this.#c(),t.length&&this.#s.set((this.#s.value+1)%t.length);else if(e.key==="ArrowUp")e.preventDefault(),this.#c(),t.length&&this.#s.set((this.#s.value-1+t.length)%t.length);else if(e.key==="Enter"||this.allowCreate&&e.key===","){const s=t[this.#s.value];s!==void 0?(e.preventDefault(),this.#p(s)):this.#b&&(e.preventDefault(),this.#p(this.#e.value.trim()))}else if(e.key==="Backspace"&&!this.#e.value&&this.active.length>0){const s=this.active[this.active.length-1];s!==void 0&&this.onToggle(s)}else e.key==="Escape"&&this.#u()}render(){const e=this.active,t=this.#o,s=this.#t.value,i=this.#s.value;return p`
264
+ <div class="field" style=${`anchor-name: ${this.#i}`}>
265
+ ${e.map(n=>p`
266
+ <span class="selected-chip">
267
+ ${n}
268
+ <span class="remove" @click=${()=>this.onToggle(n)}>✕</span>
269
+ </span>
270
+ `)}
271
+ <input
272
+ class="input"
273
+ role="combobox"
274
+ aria-autocomplete="list"
275
+ aria-expanded=${s}
276
+ aria-controls=${this.#r}
277
+ aria-activedescendant=${i>=0?`${this.#r}-opt-${i}`:""}
278
+ placeholder=${e.length===0?"Filter by tag…":""}
279
+ .value=${this.#e.value}
280
+ @input=${n=>this.#n(n)}
281
+ @focus=${()=>this.#c()}
282
+ @click=${()=>this.#c()}
283
+ @keydown=${n=>this.#g(n)}
284
+ />
285
+ ${e.length>0?p`<button class="clear-btn" tabindex="-1" @mousedown=${n=>n.preventDefault()} @click=${n=>this.#x(n)}>✕</button>`:""}
286
+ <button
287
+ class="chevron-btn ${s?"open":""}"
288
+ tabindex="-1"
289
+ @mousedown=${n=>n.preventDefault()}
290
+ @click=${()=>this.#l()}
291
+ >
292
+
293
+ </button>
294
+ </div>
295
+
296
+ <ul
297
+ id=${this.#r}
298
+ class="menu ${s?"visible":""}"
299
+ role="listbox"
300
+ aria-multiselectable="true"
301
+ popover="manual"
302
+ style=${`position-anchor: ${this.#i}`}
303
+ >
304
+ ${t.length?t.map((n,a)=>p`
305
+ <li
306
+ id=${`${this.#r}-opt-${a}`}
307
+ role="option"
308
+ aria-selected=${e.includes(n)}
309
+ class=${a===i?"option highlighted":"option"}
310
+ @mousedown=${o=>o.preventDefault()}
311
+ @click=${()=>this.#p(n)}
312
+ >
313
+ <input type="checkbox" .checked=${e.includes(n)} tabindex="-1" />
314
+ ${n}
315
+ </li>
316
+ `):this.#b?p`
317
+ <li
318
+ class="option create-option"
319
+ @mousedown=${n=>n.preventDefault()}
320
+ @click=${()=>this.#p(this.#e.value.trim())}
321
+ >
322
+ No match. Create '${this.#e.value.trim()}'
323
+ </li>
324
+ `:p`<li class="empty">${this.allowCreate?"Type to create a tag":"No matches"}</li>`}
325
+ </ul>
326
+ `}}customElements.define("tag-multiselect",ai);const et="mem-bucket-detail-view-mode";function oi(r){return new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(r))}const li=["stable","beta","unreviewed"],ci=["active","shipped","abandoned"],tt=["plan","spec","sql","testing-todo","discovery","session-summary","other"],hi=["ticket","freeform"];function st(r){return{description:r.description??"",tags:r.tags??[],status:r.status??"",name:r.name??"",owner:r.owner??"",extends:r.extends??"",trigger_phrases:r.trigger_phrases??[],key:r.key??"",key_type:r.key_type??"",doc_type:r.doc_type??"",related_to:r.related_to??""}}class pi extends S{constructor(){super(...arguments),this._viewMode=localStorage.getItem(et)??"markdown",this._editing=!1,this._draft=null,this._addingFrontmatter=!1,this._renaming=!1,this._renameValue=""}static{this.properties={selected:{attribute:!1},onChanged:{attribute:!1},facets:{attribute:!1},onTagClick:{attribute:!1},onRootClick:{attribute:!1},onDateClick:{attribute:!1},_doc:{state:!0},_viewMode:{state:!0},_editing:{state:!0},_draft:{state:!0},_addingFrontmatter:{state:!0},_renaming:{state:!0},_renameValue:{state:!0}}}static{this.styles=V`
327
+ :host { display: block; padding: 16px; }
328
+ h2 { margin: 0 0 4px; font-size: 16px; }
329
+ .title-row {
330
+ display: flex;
331
+ align-items: center;
332
+ gap: 8px;
333
+ flex-wrap: wrap;
334
+ margin-bottom: 10px;
335
+ }
336
+ .title-row h2 { margin: 0; }
337
+ .pill {
338
+ border: 1px solid var(--border-strong);
339
+ border-radius: 999px;
340
+ padding: 2px 9px;
341
+ font-size: 11px;
342
+ display: inline-flex;
343
+ align-items: center;
344
+ background: none;
345
+ color: inherit;
346
+ font-family: inherit;
347
+ }
348
+ .pill.root-pill {
349
+ cursor: pointer;
350
+ color: var(--purple-fg);
351
+ border-color: var(--purple);
352
+ background: var(--purple-tint);
353
+ }
354
+ .pill.root-pill:hover { background: var(--hover-strong); }
355
+ .pill.tag-pill {
356
+ cursor: pointer;
357
+ background: var(--bg-subtle);
358
+ }
359
+ .pill.tag-pill:hover { background: var(--hover); border-color: var(--border-strong); }
360
+ .pill.warn-pill {
361
+ border-color: var(--danger);
362
+ color: var(--danger);
363
+ background: none;
364
+ }
365
+ .pill.muted-pill {
366
+ opacity: 0.65;
367
+ }
368
+ .info-grid {
369
+ display: grid;
370
+ grid-template-columns: max-content 1fr;
371
+ column-gap: 10px;
372
+ row-gap: 7px;
373
+ font-size: 12px;
374
+ margin-bottom: 12px;
375
+ align-items: start;
376
+ }
377
+ .info-grid dt {
378
+ opacity: 0.55;
379
+ font-size: 10.5px;
380
+ text-transform: uppercase;
381
+ letter-spacing: 0.04em;
382
+ padding-top: 2px;
383
+ white-space: nowrap;
384
+ }
385
+ .info-grid dd {
386
+ margin: 0;
387
+ display: flex;
388
+ flex-wrap: wrap;
389
+ gap: 5px;
390
+ align-items: center;
391
+ }
392
+ .info-grid dd.description { opacity: 0.85; }
393
+ .info-grid .date-value {
394
+ cursor: pointer;
395
+ text-decoration: underline dotted;
396
+ text-underline-offset: 2px;
397
+ }
398
+ .info-grid .date-value:hover { opacity: 0.75; }
399
+ .info-grid .hint { opacity: 0.5; font-style: italic; }
400
+ .bare-notice { font-size: 12px; opacity: 0.6; font-style: italic; margin-bottom: 12px; }
401
+ .source-path {
402
+ font-family: monospace;
403
+ font-size: 11px;
404
+ opacity: 0.6;
405
+ cursor: pointer;
406
+ word-break: break-all;
407
+ }
408
+ pre {
409
+ white-space: pre-wrap;
410
+ font-size: 12px;
411
+ background: var(--bg-subtle);
412
+ padding: 12px;
413
+ border-radius: 6px;
414
+ max-height: 60vh;
415
+ overflow-y: auto;
416
+ }
417
+ textarea {
418
+ width: 100%;
419
+ box-sizing: border-box;
420
+ font-family: monospace;
421
+ font-size: 12px;
422
+ background: var(--bg-subtle);
423
+ color: inherit;
424
+ border: 1px solid var(--border);
425
+ border-radius: 6px;
426
+ padding: 12px;
427
+ min-height: 30vh;
428
+ resize: vertical;
429
+ }
430
+ .empty { opacity: 0.5; font-size: 13px; }
431
+ .view-toggle {
432
+ display: flex;
433
+ gap: 4px;
434
+ margin-bottom: 8px;
435
+ }
436
+ .view-toggle button {
437
+ font-size: 11px;
438
+ padding: 3px 8px;
439
+ border: 1px solid var(--border);
440
+ background: transparent;
441
+ border-radius: 4px;
442
+ cursor: pointer;
443
+ opacity: 0.6;
444
+ }
445
+ .view-toggle button.active {
446
+ opacity: 1;
447
+ background: var(--hover);
448
+ font-weight: 600;
449
+ }
450
+ .markdown-body {
451
+ font-size: 13px;
452
+ line-height: 1.5;
453
+ max-height: 60vh;
454
+ overflow-y: auto;
455
+ padding: 12px;
456
+ background: var(--bg-subtle);
457
+ border-radius: 6px;
458
+ }
459
+ .markdown-body :first-child { margin-top: 0; }
460
+ .markdown-body :last-child { margin-bottom: 0; }
461
+ .markdown-body pre {
462
+ background: var(--hover);
463
+ max-height: none;
464
+ }
465
+ .markdown-body code {
466
+ font-family: monospace;
467
+ font-size: 12px;
468
+ }
469
+ .actions {
470
+ display: flex;
471
+ flex-wrap: wrap;
472
+ gap: 8px;
473
+ margin-bottom: 12px;
474
+ }
475
+ .actions button {
476
+ font-size: 11px;
477
+ padding: 4px 10px;
478
+ border: 1px solid var(--border);
479
+ background: transparent;
480
+ color: inherit;
481
+ border-radius: 4px;
482
+ cursor: pointer;
483
+ }
484
+ .actions button.danger {
485
+ border-color: var(--danger);
486
+ color: var(--danger);
487
+ }
488
+ .actions button.primary {
489
+ border-color: var(--accent);
490
+ color: var(--accent);
491
+ font-weight: 600;
492
+ }
493
+ .edit-form {
494
+ display: flex;
495
+ flex-direction: column;
496
+ gap: 10px;
497
+ margin-bottom: 12px;
498
+ padding: 12px;
499
+ background: var(--bg-subtle);
500
+ border-radius: 6px;
501
+ }
502
+ .field {
503
+ display: flex;
504
+ flex-direction: column;
505
+ gap: 4px;
506
+ }
507
+ .field label {
508
+ font-size: 11px;
509
+ font-weight: 600;
510
+ opacity: 0.7;
511
+ }
512
+ .field input[type='text'],
513
+ .field select,
514
+ .field textarea {
515
+ font-size: 13px;
516
+ padding: 6px 8px;
517
+ border: 1px solid var(--border-strong);
518
+ border-radius: 6px;
519
+ background: var(--bg);
520
+ color: inherit;
521
+ font-family: inherit;
522
+ }
523
+ .field textarea {
524
+ min-height: 60px;
525
+ resize: vertical;
526
+ }
527
+ .field-row {
528
+ display: flex;
529
+ gap: 10px;
530
+ }
531
+ .field-row .field { flex: 1; }
532
+ .form-actions {
533
+ display: flex;
534
+ gap: 8px;
535
+ margin-top: 4px;
536
+ }
537
+ .form-actions button {
538
+ font-size: 12px;
539
+ padding: 5px 12px;
540
+ border-radius: 4px;
541
+ cursor: pointer;
542
+ }
543
+ .form-actions button.save {
544
+ border: 1px solid var(--accent);
545
+ background: var(--accent);
546
+ color: var(--accent-fg);
547
+ }
548
+ .form-actions button.cancel {
549
+ border: 1px solid var(--border);
550
+ background: transparent;
551
+ color: inherit;
552
+ }
553
+ .rename-row {
554
+ display: flex;
555
+ gap: 6px;
556
+ align-items: center;
557
+ }
558
+ .rename-row input {
559
+ flex: 1;
560
+ font-size: 12px;
561
+ padding: 4px 6px;
562
+ border: 1px solid var(--border-strong);
563
+ border-radius: 4px;
564
+ background: var(--bg);
565
+ color: inherit;
566
+ }
567
+ .hint { font-size: 11px; opacity: 0.6; }
568
+ `}updated(e){e.has("selected")&&this.selected&&(this._editing=!1,this._addingFrontmatter=!1,this._renaming=!1,this.#e(),this.scrollTop=0)}async#e(){const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);this._doc=s.ok?await s.json():null,await this.updateComplete,this.shadowRoot?.querySelector(".markdown-body")?.scrollTo(0,0),this.shadowRoot?.querySelector("pre")?.scrollTo(0,0)}#t(){this._doc?.source_path&&navigator.clipboard?.writeText(this._doc.source_path)}#s(e){this._viewMode=e,localStorage.setItem(et,e)}async#i(){const{table:e,id:t}=this.selected,s=!this._doc?.deprecated;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/deprecated`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({deprecated:s})}),await this.#e(),this.onChanged?.()}async#r(){const{table:e,id:t}=this.selected,s=!this._doc?.paused;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/paused`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({paused:s})}),await this.#e(),this.onChanged?.()}async#h(){if(!window.confirm("Delete this doc? This can't be undone."))return;const{table:e,id:t}=this.selected;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"DELETE"}),this._doc=null,this.onChanged?.()}#o(){this._doc&&(this._draft=st(this._doc),this._editing=!0,this._addingFrontmatter=!1)}#c(){this._doc&&(this._draft=st(this._doc),this._addingFrontmatter=!0,this._editing=!1)}#u(e){this._draft&&(this._draft={...this._draft,doc_type:e},this._addingFrontmatter=!1,this._editing=!0)}#l(){this._editing=!1,this._addingFrontmatter=!1,this._draft=null}#n(e){this._draft&&(this._draft={...this._draft,...e})}#p(e){if(!this._draft)return;const t=this._draft.tags.includes(e)?this._draft.tags.filter(s=>s!==e):[...this._draft.tags,e];this.#n({tags:t})}#b(e){if(!this._draft)return;const t=this._draft.trigger_phrases.includes(e)?this._draft.trigger_phrases.filter(s=>s!==e):[...this._draft.trigger_phrases,e];this.#n({trigger_phrases:t})}async#x(){if(!this._draft||!this.selected)return;const{table:e,id:t}=this.selected,s=e==="skills",i={description:this._draft.description,tags:this._draft.tags,status:this._draft.status};s?(i.owner=this._draft.owner||null,i.extends=this._draft.extends||null,i.trigger_phrases=this._draft.trigger_phrases):(i.key=this._draft.key,i.key_type=this._draft.key_type,i.doc_type=this._draft.doc_type,i.related_to=this._draft.related_to||null);const n=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({frontmatter:i})});if(!n.ok){const a=await n.json().catch(()=>({}));window.alert(`Save failed: ${a.error??n.statusText}`);return}this._editing=!1,this._draft=null,await this.#e(),this.onChanged?.()}async#g(){if(!this.selected||!this._doc||this.selected.table!=="memory_docs")return;const{table:e,id:t}=this.selected;if(!window.confirm(`Delete frontmatter for "${this._doc.key}"?
569
+
570
+ This removes the doc's key, tags, and status — it drops out of key-based lookup and full-text search, and becomes a plain unmanaged file, until frontmatter is added again.`))return;const i=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/frontmatter`,{method:"DELETE"});if(!i.ok){const n=await i.json().catch(()=>({}));window.alert(`Delete failed: ${n.error??i.statusText}`);return}this._doc=null,this.selected=null,this.onChanged?.()}#m(){this._doc&&(this._renameValue=this._doc.name??"",this._renaming=!0)}async#k(){if(!this._doc||!this._renameValue.trim())return;const e=this._renameValue.trim();if(e===this._doc.name){this._renaming=!1;return}const t=await fetch(`/api/entries/skills/${encodeURIComponent(this._doc.name)}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({new_name:e})});if(!t.ok){const s=await t.json().catch(()=>({}));window.alert(`Rename failed: ${s.error??t.statusText}`);return}this._renaming=!1,this.selected={table:"skills",id:e},await this.#e(),this.onChanged?.()}#f(){return p`
571
+ <div class="edit-form">
572
+ <div class="hint">What kind of doc is this? This shapes which fields apply next.</div>
573
+ <div class="field">
574
+ <label>doc_type</label>
575
+ <select
576
+ @change=${e=>this.#u(e.target.value)}
577
+ >
578
+ <option value="" selected disabled>Choose…</option>
579
+ ${tt.map(e=>p`<option value=${e}>${e}</option>`)}
580
+ </select>
581
+ </div>
582
+ <div class="form-actions">
583
+ <button class="cancel" @click=${()=>this.#l()}>Cancel</button>
584
+ </div>
585
+ </div>
586
+ `}#v(e){const t=this._draft,s=this.facets;return p`
587
+ <div class="edit-form">
588
+ ${e?p`
589
+ <div class="field">
590
+ <label>name</label>
591
+ <div class="hint">Renaming moves the skill's folder on disk — kept as a separate action.</div>
592
+ </div>
593
+ `:p`
594
+ <div class="field-row">
595
+ <div class="field">
596
+ <label>key</label>
597
+ <input
598
+ type="text"
599
+ .value=${t.key}
600
+ @input=${i=>this.#n({key:i.target.value})}
601
+ />
602
+ </div>
603
+ <div class="field">
604
+ <label>key_type</label>
605
+ <select
606
+ .value=${t.key_type}
607
+ @change=${i=>this.#n({key_type:i.target.value})}
608
+ >
609
+ ${hi.map(i=>p`<option value=${i} ?selected=${i===t.key_type}>${i}</option>`)}
610
+ </select>
611
+ </div>
612
+ </div>
613
+ <div class="field">
614
+ <label>doc_type</label>
615
+ <select
616
+ .value=${t.doc_type}
617
+ @change=${i=>this.#n({doc_type:i.target.value})}
618
+ >
619
+ ${tt.map(i=>p`<option value=${i} ?selected=${i===t.doc_type}>${i}</option>`)}
620
+ </select>
621
+ </div>
622
+ `}
623
+ <div class="field">
624
+ <label>description</label>
625
+ <textarea
626
+ .value=${t.description}
627
+ @input=${i=>this.#n({description:i.target.value})}
628
+ ></textarea>
629
+ </div>
630
+ <div class="field">
631
+ <label>tags</label>
632
+ <tag-multiselect
633
+ .tags=${s?.tags??[]}
634
+ .active=${t.tags}
635
+ .allowCreate=${!0}
636
+ .onToggle=${i=>this.#p(i)}
637
+ ></tag-multiselect>
638
+ </div>
639
+ <div class="field">
640
+ <label>status</label>
641
+ <select
642
+ .value=${t.status}
643
+ @change=${i=>this.#n({status:i.target.value})}
644
+ >
645
+ ${(e?li:ci).map(i=>p`<option value=${i} ?selected=${i===t.status}>${i}</option>`)}
646
+ </select>
647
+ </div>
648
+ ${e?p`
649
+ <div class="field-row">
650
+ <div class="field">
651
+ <label>owner</label>
652
+ <input
653
+ type="text"
654
+ .value=${t.owner}
655
+ @input=${i=>this.#n({owner:i.target.value})}
656
+ />
657
+ </div>
658
+ <div class="field">
659
+ <label>extends</label>
660
+ <input
661
+ type="text"
662
+ .value=${t.extends}
663
+ @input=${i=>this.#n({extends:i.target.value})}
664
+ />
665
+ </div>
666
+ </div>
667
+ <div class="field">
668
+ <label>trigger_phrases</label>
669
+ <tag-multiselect
670
+ .tags=${[]}
671
+ .active=${t.trigger_phrases}
672
+ .allowCreate=${!0}
673
+ .onToggle=${i=>this.#b(i)}
674
+ ></tag-multiselect>
675
+ </div>
676
+ `:p`
677
+ <div class="field">
678
+ <label>related_to</label>
679
+ <input
680
+ type="text"
681
+ .value=${t.related_to}
682
+ @input=${i=>this.#n({related_to:i.target.value})}
683
+ />
684
+ </div>
685
+ `}
686
+ <div class="form-actions">
687
+ <button class="save" @click=${()=>this.#x()}>Save</button>
688
+ <button class="cancel" @click=${()=>this.#l()}>Cancel</button>
689
+ </div>
690
+ </div>
691
+ `}#d(e){return p`
692
+ <div class="title-row">
693
+ <h2>${e.name??e.key??e.id}</h2>
694
+ <button class="pill root-pill" title="Filter by root '${e.root}'" @click=${()=>this.onRootClick?.(e.root)}>
695
+ ${e.root}
696
+ </button>
697
+ </div>
698
+ `}#$(e,t){const s=e.created_at?oi(e.created_at):null;return p`
699
+ <dl class="info-grid">
700
+ <dt>Description</dt>
701
+ <dd class="description">${e.description||"—"}</dd>
702
+
703
+ <dt>Tags</dt>
704
+ <dd>
705
+ ${e.tags?.length?e.tags.map(i=>p`<button class="pill tag-pill" @click=${()=>this.onTagClick?.(i)}>${i}</button>`):p`<span class="hint">no tags</span>`}
706
+ </dd>
707
+
708
+ <dt>Status</dt>
709
+ <dd>${e.status}</dd>
710
+
711
+ ${e.deprecated||e.paused?p`
712
+ <dt>Flags</dt>
713
+ <dd>
714
+ ${e.deprecated?p`<span class="pill warn-pill">deprecated</span>`:x}
715
+ ${e.paused?p`<span class="pill muted-pill">paused</span>`:x}
716
+ </dd>
717
+ `:x}
718
+
719
+ ${t?p`
720
+ ${e.owner?p`<dt>Owner</dt>
721
+ <dd>${e.owner}</dd>`:x}
722
+ ${e.extends?p`<dt>Extends</dt>
723
+ <dd>${e.extends}</dd>`:x}
724
+ `:p`
725
+ <dt>Key</dt>
726
+ <dd>${e.key}</dd>
727
+
728
+ <dt>Key type</dt>
729
+ <dd>${e.key_type}</dd>
730
+
731
+ <dt>Doc type</dt>
732
+ <dd>${e.doc_type}</dd>
733
+
734
+ ${e.related_to?p`<dt>Related to</dt>
735
+ <dd>${e.related_to}</dd>`:x}
736
+ `}
737
+
738
+ <dt>Created</dt>
739
+ <dd>
740
+ ${s?p`<span class="date-value" title="Filter to this day" @click=${()=>this.onDateClick?.(s)}
741
+ >${s}</span
742
+ >`:p`<span class="hint">unknown</span>`}
743
+ </dd>
744
+ </dl>
745
+ `}render(){if(!this.selected)return p`<div class="empty">Select an entry to view its details.</div>`;if(!this._doc)return x;const e=this._doc,t=this.selected.table==="skills",s=t&&e.root==="builtin",i=!t&&e.has_frontmatter===!1;return this._addingFrontmatter?p`${this.#d(e)}${this.#f()}`:this._editing&&this._draft?p`${this.#d(e)}${this.#v(t)}`:p`
746
+ ${this.#d(e)}
747
+ ${i?p`<div class="bare-notice">No frontmatter — this is a plain, unmanaged file.</div>`:this.#$(e,t)}
748
+ ${s?x:p`
749
+ <div class="actions">
750
+ ${i?p`<button class="primary" @click=${()=>this.#c()}>Add frontmatter</button>`:p`
751
+ <button @click=${()=>this.#o()}>Edit</button>
752
+ ${t?p`<button @click=${()=>this.#m()}>Rename</button>`:x}
753
+ <button @click=${()=>this.#i()}>${e.deprecated?"Un-deprecate":"Mark deprecated"}</button>
754
+ <button @click=${()=>this.#r()}>${e.paused?"Resume":"Pause"}</button>
755
+ ${t?x:p`<button class="danger" @click=${()=>this.#g()}>Delete frontmatter</button>`}
756
+ `}
757
+ <button class="danger" @click=${()=>this.#h()}>Delete</button>
758
+ </div>
759
+ ${this._renaming?p`
760
+ <div class="rename-row">
761
+ <input
762
+ type="text"
763
+ .value=${this._renameValue}
764
+ @input=${n=>this._renameValue=n.target.value}
765
+ @keydown=${n=>n.key==="Enter"&&this.#k()}
766
+ />
767
+ <button @click=${()=>this.#k()}>Save</button>
768
+ <button @click=${()=>this._renaming=!1}>Cancel</button>
769
+ </div>
770
+ `:x}
771
+ `}
772
+ <div class="view-toggle">
773
+ <button
774
+ class=${this._viewMode==="markdown"?"active":""}
775
+ @click=${()=>this.#s("markdown")}
776
+ >
777
+ Preview
778
+ </button>
779
+ <button
780
+ class=${this._viewMode==="raw"?"active":""}
781
+ @click=${()=>this.#s("raw")}
782
+ >
783
+ Raw
784
+ </button>
785
+ </div>
786
+ ${this._viewMode==="markdown"?p`<div class="markdown-body">${ni(m.parse(e.body??"",{async:!1}))}</div>`:p`<pre>${e.raw_file??e.body}</pre>`}
787
+ <div class="source-path" title="click to copy" @click=${()=>this.#t()}>${e.source_path}</div>
788
+ `}}customElements.define("detail-panel",pi);class di extends S{static{this.properties={defaultKind:{attribute:!1},lockKind:{attribute:!1},onAdded:{attribute:!1},onCancel:{attribute:!1}}}#e=new u("skill");#t=new u("");#s=new u([]);#i=new u(null);#r=new u("");#h=new u("");#o=new u("");#c=new u(!1);#u=new u(!1);#l=new u(!1);#n=new u("");static{this.styles=V`
789
+ :host { display: block; }
790
+ .backdrop {
791
+ position: fixed; inset: 0; background: var(--overlay);
792
+ display: flex; align-items: center; justify-content: center; z-index: 100;
793
+ }
794
+ .modal {
795
+ background: var(--bg);
796
+ color: inherit;
797
+ border-radius: 10px;
798
+ width: min(560px, 92vw);
799
+ max-height: 82vh;
800
+ display: flex;
801
+ flex-direction: column;
802
+ box-shadow: 0 8px 40px var(--shadow);
803
+ border: 1px solid var(--border);
804
+ }
805
+ .header { padding: 16px 20px 8px; }
806
+ h2 { margin: 0; font-size: 16px; }
807
+ .kind-toggle { display: flex; gap: 8px; padding: 0 20px 12px; }
808
+ .kind-toggle button {
809
+ flex: 1; padding: 8px; border: 1px solid var(--border-strong); background: none; color: inherit;
810
+ border-radius: 6px; cursor: pointer; font-size: 13px;
811
+ }
812
+ .kind-toggle button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
813
+ .breadcrumb-row {
814
+ padding: 8px 20px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
815
+ }
816
+ .breadcrumb {
817
+ font-size: 12px; opacity: 0.7; font-family: monospace;
818
+ word-break: break-all;
819
+ }
820
+ .hidden-toggle {
821
+ font-size: 11px; opacity: 0.7; display: flex; align-items: center; gap: 4px;
822
+ cursor: pointer; white-space: nowrap; user-select: none;
823
+ }
824
+ .new-folder-btn {
825
+ font-size: 11px; opacity: 0.7; background: none; border: none; color: inherit;
826
+ cursor: pointer; white-space: nowrap; padding: 0;
827
+ }
828
+ .new-folder-btn:hover { opacity: 1; }
829
+ .new-folder-row {
830
+ padding: 8px 20px; display: flex; align-items: center; gap: 8px;
831
+ border-top: 1px solid var(--border);
832
+ }
833
+ .new-folder-row input[type='text'] {
834
+ flex: 1; padding: 5px 8px; font-size: 12px;
835
+ border: 1px solid var(--border-strong); border-radius: 6px; background: none; color: inherit;
836
+ }
837
+ .new-folder-row button {
838
+ font-size: 11px; padding: 5px 10px; border: 1px solid var(--border-strong); background: none;
839
+ color: inherit; border-radius: 6px; cursor: pointer;
840
+ }
841
+ .browser {
842
+ flex: 1; overflow-y: auto; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
843
+ min-height: 200px;
844
+ }
845
+ .entry {
846
+ padding: 8px 20px; cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 8px;
847
+ }
848
+ .entry:hover { background: var(--hover); }
849
+ .entry .icon { opacity: 0.6; }
850
+ .up { opacity: 0.7; }
851
+ .empty { padding: 16px 20px; opacity: 0.6; font-size: 13px; }
852
+ .footer { padding: 14px 20px; display: flex; flex-direction: column; gap: 10px; }
853
+ .selected-row { font-size: 12px; }
854
+ .selected-row .path { font-family: monospace; opacity: 0.85; word-break: break-all; }
855
+ label { font-size: 12px; opacity: 0.7; display: block; margin-bottom: 4px; }
856
+ input[type='text'] {
857
+ width: 100%; box-sizing: border-box; padding: 7px 9px; font-size: 13px;
858
+ border: 1px solid var(--border-strong); border-radius: 6px; background: none; color: inherit;
859
+ }
860
+ .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
861
+ button.primary {
862
+ background: var(--accent); border: 1px solid var(--accent); color: var(--accent-fg); padding: 7px 16px;
863
+ border-radius: 6px; cursor: pointer; font-size: 13px;
864
+ }
865
+ button.primary:disabled { opacity: 0.5; cursor: default; }
866
+ button.secondary {
867
+ background: none; border: 1px solid var(--border-strong); color: inherit; padding: 7px 16px;
868
+ border-radius: 6px; cursor: pointer; font-size: 13px;
869
+ }
870
+ .error { color: var(--danger); font-size: 12px; }
871
+ `}constructor(){super(),new we(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#e.set(this.defaultKind),this.#p()}async#p(e){const t=new URLSearchParams;e&&t.set("path",e),this.#u.value&&t.set("hidden","1");const s=await fetch(`/api/fs/list?${t.toString()}`);if(!s.ok){this.#o.set((await s.json()).error??"failed to list directory");return}const i=await s.json();this.#t.set(i.path),this.#i.set(i.parent),this.#s.set(i.entries),this.#o.set(""),this.renderRoot.querySelector(".browser")?.scrollTo(0,0)}#b(){this.#u.set(!this.#u.value),this.#p(this.#t.value)}#x(){this.#n.set(""),this.#l.set(!0)}#g(){this.#l.set(!1),this.#n.set("")}async#m(){const e=this.#n.value.trim();if(e){this.#o.set("");try{const t=await fetch("/api/fs/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:this.#t.value,name:e})}),s=await t.json();if(!t.ok){this.#o.set(s.error??"failed to create folder");return}this.#l.set(!1),this.#n.set(""),await this.#p(this.#t.value)}catch(t){this.#o.set(t.message)}}}#k(){this.#r.set(this.#t.value),this.#h.value||this.#h.set(this.#t.value.split("/").filter(Boolean).pop()??"")}async#f(){const e=this.#r.value||this.#t.value;if(e){this.#c.set(!0),this.#o.set("");try{const t=await fetch("/api/roots",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#h.value||void 0,path:e})}),s=await t.json();if(!t.ok){this.#o.set(s.error??"failed to add root");return}this.onAdded()}finally{this.#c.set(!1)}}}render(){const e=this.#s.value;return p`
872
+ <div class="backdrop" @click=${t=>t.target===t.currentTarget&&this.onCancel()}>
873
+ <div class="modal">
874
+ <div class="header"><h2>Add a root</h2></div>
875
+ ${this.lockKind?p``:p`
876
+ <div class="kind-toggle">
877
+ <button
878
+ class=${this.#e.value==="skill"?"active":""}
879
+ @click=${()=>this.#e.set("skill")}
880
+ >
881
+ Skill root
882
+ </button>
883
+ <button
884
+ class=${this.#e.value==="memory"?"active":""}
885
+ @click=${()=>this.#e.set("memory")}
886
+ >
887
+ Memory root
888
+ </button>
889
+ </div>
890
+ `}
891
+ <div class="breadcrumb-row">
892
+ <div class="breadcrumb">${this.#t.value}</div>
893
+ <button class="new-folder-btn" @click=${()=>this.#x()}>+ New folder</button>
894
+ <label class="hidden-toggle">
895
+ <input type="checkbox" .checked=${this.#u.value} @change=${()=>this.#b()} />
896
+ Show hidden
897
+ </label>
898
+ </div>
899
+ ${this.#l.value?p`
900
+ <div class="new-folder-row">
901
+ <input
902
+ type="text"
903
+ placeholder="Folder name"
904
+ .value=${this.#n.value}
905
+ @input=${t=>this.#n.set(t.target.value)}
906
+ @keydown=${t=>{t.key==="Enter"&&this.#m(),t.key==="Escape"&&this.#g()}}
907
+ />
908
+ <button @click=${()=>this.#m()}>Create</button>
909
+ <button @click=${()=>this.#g()}>Cancel</button>
910
+ </div>
911
+ `:""}
912
+ <div class="browser">
913
+ ${this.#i.value?p`<div class="entry up" @click=${()=>this.#p(this.#i.value)}>
914
+ <span class="icon">📁</span> ..
915
+ </div>`:""}
916
+ ${e.length===0&&!this.#i.value?p`<div class="empty">No subdirectories here.</div>`:e.map(t=>p`<div class="entry" @click=${()=>this.#p(t.path)}>
917
+ <span class="icon">📁</span> ${t.name}
918
+ </div>`)}
919
+ </div>
920
+ <div class="footer">
921
+ <button class="secondary" @click=${()=>this.#k()}>
922
+ Select this folder
923
+ </button>
924
+ ${this.#r.value?p`<div class="selected-row">Selected: <span class="path">${this.#r.value}</span></div>`:""}
925
+ <div>
926
+ <label>Root name</label>
927
+ <input
928
+ type="text"
929
+ .value=${this.#h.value}
930
+ placeholder="e.g. personal, company"
931
+ @input=${t=>this.#h.set(t.target.value)}
932
+ />
933
+ </div>
934
+ ${this.#o.value?p`<div class="error">${this.#o.value}</div>`:""}
935
+ <div class="actions">
936
+ <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
937
+ <button
938
+ class="primary"
939
+ ?disabled=${!this.#r.value||this.#c.value}
940
+ @click=${()=>this.#f()}
941
+ >
942
+ ${this.#c.value?"Adding…":"Add root"}
943
+ </button>
944
+ </div>
945
+ </div>
946
+ </div>
947
+ </div>
948
+ `}}customElements.define("add-root-modal",di);const ui=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],it=[{value:"all",label:"Show all"},{value:"hide",label:"Hide"},{value:"only",label:"Only"}],gi={tags:[],statuses:[],owners:[],doc_types:[],key_types:[],roots:[]},fi={skill:[],memory:[]},wt="mem-bucket-split-pct",_t=20,St=80;function bi(){const r=Number(localStorage.getItem(wt));return Number.isFinite(r)&&r>=_t&&r<=St?r:40}const At="mem-bucket-theme",he=["system","light","dark"],xi={system:"◐",light:"☀",dark:"☾"},mi={system:"Auto",light:"Light",dark:"Dark"};function ki(){const r=localStorage.getItem(At);return r==="light"||r==="dark"?r:"system"}function rt(r){r==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",r)}function vi(){const r=location.hash.slice(1);if(!r)return{};const e=new URLSearchParams(r),t={},s=e.get("q");s&&(t.query=s);const i=e.get("type");(i==="skill"||i==="memory"||i==="all")&&(t.typeFilter=i);const n=e.getAll("tag");n.length&&(t.activeTags=n);const a=e.getAll("root");a.length&&(t.activeRoots=a);const o=e.get("sort");o&&(t.sort=o);const l=e.get("deprecated");l==="0"?t.deprecatedFilter="hide":l==="1"&&(t.deprecatedFilter="only");const c=e.get("paused");c==="0"?t.pausedFilter="hide":c==="1"&&(t.pausedFilter="only");const d=e.get("date_from");d&&(t.dateFrom=d);const h=e.get("date_to");return h&&(t.dateTo=h),t}class $i extends S{static{this.styles=V`
949
+ :host { display: flex; flex-direction: column; height: 100vh; }
950
+ .theme-toggle {
951
+ position: fixed;
952
+ top: 10px;
953
+ right: 12px;
954
+ z-index: 10;
955
+ width: 28px;
956
+ height: 28px;
957
+ border: 1px solid var(--border-strong);
958
+ border-radius: 50%;
959
+ background: var(--bg);
960
+ color: inherit;
961
+ cursor: pointer;
962
+ font-size: 14px;
963
+ line-height: 1;
964
+ display: flex;
965
+ align-items: center;
966
+ justify-content: center;
967
+ opacity: 0.75;
968
+ }
969
+ .theme-toggle:hover { opacity: 1; background: var(--hover); }
970
+ .reindex-toggle {
971
+ position: fixed;
972
+ top: 10px;
973
+ right: 46px;
974
+ z-index: 10;
975
+ width: 28px;
976
+ height: 28px;
977
+ border: 1px solid var(--border-strong);
978
+ border-radius: 50%;
979
+ background: var(--bg);
980
+ color: inherit;
981
+ cursor: pointer;
982
+ font-size: 14px;
983
+ line-height: 1;
984
+ display: flex;
985
+ align-items: center;
986
+ justify-content: center;
987
+ opacity: 0.75;
988
+ }
989
+ .reindex-toggle:hover { opacity: 1; background: var(--hover); }
990
+ .reindex-toggle:disabled { cursor: default; opacity: 0.4; }
991
+ .reindex-toggle.spinning { animation: reindex-spin 0.8s linear infinite; }
992
+ @keyframes reindex-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
993
+ .filters {
994
+ padding: 12px 16px;
995
+ border-bottom: 1px solid var(--border);
996
+ display: flex;
997
+ flex-direction: column;
998
+ gap: 8px;
999
+ }
1000
+ .search-field {
1001
+ position: relative;
1002
+ flex: 1 1 240px;
1003
+ max-width: 480px;
1004
+ }
1005
+ .filters input[type='search'] {
1006
+ font-size: 13px;
1007
+ padding: 6px 28px 6px 10px;
1008
+ width: 100%;
1009
+ box-sizing: border-box;
1010
+ border: 1px solid var(--border-strong);
1011
+ border-radius: 6px;
1012
+ background: none;
1013
+ color: inherit;
1014
+ height: 30px;
1015
+ }
1016
+ .filters input[type='search']::-webkit-search-cancel-button { display: none; }
1017
+ .search-clear-btn {
1018
+ position: absolute;
1019
+ right: 4px;
1020
+ top: 50%;
1021
+ transform: translateY(-50%);
1022
+ border: none;
1023
+ background: transparent;
1024
+ cursor: pointer;
1025
+ color: inherit;
1026
+ opacity: 0.6;
1027
+ font-size: 12px;
1028
+ line-height: 1;
1029
+ padding: 4px 6px;
1030
+ border-radius: 50%;
1031
+ }
1032
+ .search-clear-btn:hover { opacity: 1; background: var(--hover); }
1033
+ .date-range { display: flex; align-items: center; gap: 4px; }
1034
+ .date-range input[type='date'] {
1035
+ font-size: 13px;
1036
+ padding: 5px 8px;
1037
+ border: 1px solid var(--border-strong);
1038
+ border-radius: 6px;
1039
+ background: none;
1040
+ color: inherit;
1041
+ height: 30px;
1042
+ box-sizing: border-box;
1043
+ }
1044
+ .date-range-sep { opacity: 0.5; font-size: 12px; }
1045
+ .date-range-clear {
1046
+ position: static;
1047
+ transform: none;
1048
+ opacity: 0.6;
1049
+ font-size: 12px;
1050
+ line-height: 1;
1051
+ padding: 4px 6px;
1052
+ border: none;
1053
+ background: transparent;
1054
+ cursor: pointer;
1055
+ color: inherit;
1056
+ border-radius: 50%;
1057
+ }
1058
+ .date-range-clear:hover { opacity: 1; background: var(--hover); }
1059
+ .search-row { align-items: center; }
1060
+ .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
1061
+ .filter-label { font-size: 12px; opacity: 0.6; font-weight: 600; }
1062
+ .type-toggle { gap: 0; }
1063
+ .type-toggle button {
1064
+ border: 1px solid var(--border-strong);
1065
+ background: none;
1066
+ color: inherit;
1067
+ padding: 6px 12px;
1068
+ font-size: 13px;
1069
+ cursor: pointer;
1070
+ height: 30px;
1071
+ box-sizing: border-box;
1072
+ }
1073
+ .type-toggle button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
1074
+ .type-toggle button:first-child { border-radius: 6px 0 0 6px; }
1075
+ .type-toggle button:last-child { border-radius: 0 6px 6px 0; }
1076
+ .type-toggle button:not(:first-child) { border-left: none; }
1077
+ .body-region { display: flex; flex: 1 1 auto; min-height: 0; }
1078
+ result-list { overflow-y: auto; flex: 0 0 auto; }
1079
+ detail-panel { overflow-y: auto; flex: 1 1 auto; min-width: 0; }
1080
+ .splitter {
1081
+ flex: 0 0 auto;
1082
+ width: 6px;
1083
+ cursor: col-resize;
1084
+ background: var(--hover);
1085
+ position: relative;
1086
+ }
1087
+ .splitter:hover, .splitter.dragging { background: var(--accent-tint); }
1088
+ .splitter::after {
1089
+ content: '';
1090
+ position: absolute;
1091
+ top: 0; bottom: 0;
1092
+ left: -3px; right: -3px;
1093
+ }
1094
+ label.small { font-size: 12px; opacity: 0.7; }
1095
+ .roots-bar {
1096
+ display: flex;
1097
+ gap: 6px;
1098
+ align-items: center;
1099
+ flex-wrap: wrap;
1100
+ padding: 10px 16px;
1101
+ border-bottom: 1px solid var(--border);
1102
+ background: var(--bg-subtle);
1103
+ }
1104
+ .root-chip {
1105
+ border: 1px solid var(--border-strong); border-radius: 999px; padding: 3px 8px 3px 10px; font-size: 12px;
1106
+ cursor: pointer; background: none; color: inherit; display: inline-flex; align-items: center; gap: 6px;
1107
+ }
1108
+ .root-chip.active { background: var(--purple-tint); border-color: var(--purple); color: var(--purple-fg); }
1109
+ .root-chip .remove {
1110
+ opacity: 0.6; font-size: 12px; line-height: 1; padding: 2px; border-radius: 50%;
1111
+ }
1112
+ .root-chip .remove:hover { opacity: 1; background: var(--hover-strong); }
1113
+ .add-root-btn {
1114
+ border: 1px dashed var(--border-strong); border-radius: 999px; padding: 3px 10px; font-size: 12px;
1115
+ cursor: pointer; background: none; color: inherit; opacity: 0.75;
1116
+ }
1117
+ .add-root-btn:hover { opacity: 1; }
1118
+ .first-run {
1119
+ display: flex; flex-direction: column; align-items: center; justify-content: center;
1120
+ flex: 1 1 auto; gap: 16px; text-align: center; padding: 24px;
1121
+ }
1122
+ .first-run h1 { font-size: 18px; margin: 0; }
1123
+ .first-run p { opacity: 0.7; font-size: 13px; max-width: 420px; margin: 0; }
1124
+ select {
1125
+ font-size: 13px;
1126
+ padding: 6px 8px;
1127
+ height: 30px;
1128
+ box-sizing: border-box;
1129
+ border: 1px solid var(--border-strong);
1130
+ border-radius: 6px;
1131
+ background: none;
1132
+ color: inherit;
1133
+ }
1134
+ .bulk-bar {
1135
+ display: flex;
1136
+ gap: 8px;
1137
+ align-items: center;
1138
+ padding: 6px 16px;
1139
+ border-bottom: 1px solid var(--border);
1140
+ background: var(--accent-tint);
1141
+ font-size: 12px;
1142
+ }
1143
+ .bulk-bar button {
1144
+ font-size: 11px;
1145
+ padding: 4px 10px;
1146
+ border: 1px solid var(--border);
1147
+ background: transparent;
1148
+ color: inherit;
1149
+ border-radius: 4px;
1150
+ cursor: pointer;
1151
+ }
1152
+ .bulk-bar button.danger { border-color: var(--danger); color: var(--danger); }
1153
+ `}#e=vi();#t=new u(this.#e.query??"");#s=new u(this.#e.typeFilter??"all");#i=new u(this.#e.activeTags??[]);#r=new u(this.#e.activeRoots??[]);#h=new u([]);#o=new u(gi);#c=new u(null);#u=new u(fi);#l=new u(!1);#n=new u("");#p=new u(!1);#b=new u(bi());#x=new u(!1);#g=new u(this.#e.sort??"mtime_desc");#m=new u(this.#e.deprecatedFilter??"all");#k=new u(this.#e.pausedFilter??"all");#f=new u(this.#e.dateFrom??"");#v=new u(this.#e.dateTo??"");#d=new u(new Set);#$=new u(ki());#_=new u(!1);#T=e=>this.#M(e);#R=()=>this.#N();constructor(){super(),new we(this),rt(this.#$.value)}#L(e){this.#$.set(e),localStorage.setItem(At,e),rt(e)}#D(){const e=he[(he.indexOf(this.#$.value)+1)%he.length];this.#L(e)}async#O(){if(!this.#_.value){this.#_.set(!0);try{await fetch("/api/rebuild-cache",{method:"POST"}),await Promise.all([this.#w(),this.#y(),this.#a()])}finally{this.#_.set(!1)}}}#I(e){e.preventDefault(),this.#x.set(!0),document.addEventListener("pointermove",this.#T),document.addEventListener("pointerup",this.#R)}#M(e){const t=this.renderRoot.querySelector(".body-region");if(!t)return;const s=t.getBoundingClientRect(),i=(e.clientX-s.left)/s.width*100;this.#b.set(Math.min(St,Math.max(_t,i)))}#N(){this.#x.set(!1),document.removeEventListener("pointermove",this.#T),document.removeEventListener("pointerup",this.#R),localStorage.setItem(wt,String(this.#b.value))}#q=new ts(()=>{const e=new URLSearchParams;this.#s.value!=="all"&&e.set("type",this.#s.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim());for(const t of this.#i.value)e.append("tag",t);for(const t of this.#r.value)e.append("root",t);return this.#g.value!=="mtime_desc"&&e.set("sort",this.#g.value),this.#m.value==="hide"?e.set("deprecated","0"):this.#m.value==="only"&&e.set("deprecated","1"),this.#k.value==="hide"?e.set("paused","0"):this.#k.value==="only"&&e.set("paused","1"),this.#f.value&&e.set("date_from",this.#f.value),this.#v.value&&e.set("date_to",this.#v.value),e.toString()});#S=()=>this.#U();connectedCallback(){super.connectedCallback(),this.#a(),this.#y(),this.#w(),window.addEventListener("focus",this.#S),document.addEventListener("visibilitychange",this.#S)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("focus",this.#S),document.removeEventListener("visibilitychange",this.#S)}#U(){document.visibilityState==="visible"&&(this.#a(),this.#y(),this.#w())}async#a(){const e=this.#q.value;history.replaceState(null,"",e?`#${e}`:location.pathname+location.search);const t=await fetch(`/api/entries?${e}`);this.#h.set(await t.json()),this.renderRoot.querySelector("result-list")?.scrollTo(0,0)}async#y(){const e=this.#s.value==="all"?"":`?type=${this.#s.value}`,t=await fetch(`/api/facets${e}`);this.#o.set(await t.json())}async#w(){const e=await fetch("/api/roots");this.#u.set(await e.json()),this.#p.set(!0)}#H(e){const t=this.#r.value;this.#r.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#a()}async#B(e,t){if(t.stopPropagation(),window.prompt(`Type "${e.name}" to remove this ${e.kind} root (files on disk are untouched):`)===e.name){this.#n.set(e.name);try{await fetch(`/api/roots/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"}),this.#r.set(this.#r.value.filter(i=>i!==e.name)),await Promise.all([this.#w(),this.#y(),this.#a()])}finally{this.#n.set("")}}}#C(){this.#l.set(!1),this.#w(),this.#y(),this.#a()}#F(){return[...this.#u.value.skill,...this.#u.value.memory]}#j(e){this.#s.set(e),this.#i.set([]),this.#y(),this.#a()}#Z(e){const t=this.#i.value;this.#i.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#a()}#K(e){this.#i.value.includes(e)||this.#i.set([...this.#i.value,e]),this.#a()}#Q(e){this.#r.value.includes(e)||this.#r.set([...this.#r.value,e]),this.#a()}#V(e){this.#f.set(e),this.#v.set(e),this.#a()}#W(e){this.#t.set(e.target.value),this.#a()}#Y(){this.#t.set(""),this.#a()}#G(e){this.#c.set({table:e._table,id:e.id})}#J(e){this.#g.set(e.target.value),this.#a()}#X(e){this.#m.set(e.target.value),this.#a()}#ee(e){this.#k.set(e.target.value),this.#a()}#te(e){this.#f.set(e.target.value),this.#a()}#se(e){this.#v.set(e.target.value),this.#a()}#ie(){this.#f.set(""),this.#v.set(""),this.#a()}#re(e){const t=new Set(this.#d.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#d.set(t)}#ne(){return new Map(this.#h.value.map(e=>[e.id,e]))}#A(){const e=new Map,t=this.#ne();for(const s of this.#d.value){const i=t.get(s);if(!i)continue;const n=e.get(i._table)??[];n.push(s),e.set(i._table,n)}return e}async#E(e){const t=this.#A();await Promise.all([...t.entries()].map(([s,i])=>fetch(`/api/entries/${s}/bulk/deprecated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i,deprecated:e})}))),this.#d.set(new Set),await this.#a()}async#z(e){const t=this.#A();await Promise.all([...t.entries()].map(([s,i])=>fetch(`/api/entries/${s}/bulk/paused`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i,paused:e})}))),this.#d.set(new Set),await this.#a()}async#ae(){if(!window.confirm(`Delete ${this.#d.value.size} doc(s)? This can't be undone.`))return;const e=this.#A();await Promise.all([...e.entries()].map(([t,s])=>fetch(`/api/entries/${t}/bulk/delete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:s})}))),this.#d.set(new Set),await this.#a()}#P(){const e=this.#$.value;return p`
1154
+ <button
1155
+ class="theme-toggle"
1156
+ title=${`Theme: ${mi[e]} (click to change)`}
1157
+ aria-label="Toggle color theme"
1158
+ @click=${()=>this.#D()}
1159
+ >
1160
+ ${xi[e]}
1161
+ </button>
1162
+ `}#oe(){const e=this.#_.value;return p`
1163
+ <button
1164
+ class=${`reindex-toggle${e?" spinning":""}`}
1165
+ title=${e?"Reindexing…":"Rebuild cache from disk"}
1166
+ aria-label="Rebuild cache from disk"
1167
+ ?disabled=${e}
1168
+ @click=${()=>this.#O()}
1169
+ >
1170
+
1171
+ </button>
1172
+ `}render(){const e=this.#o.value,t=this.#F();return this.#p.value&&t.length===0&&!this.#l.value?p`
1173
+ ${this.#P()}
1174
+ <div class="first-run">
1175
+ <h1>No roots configured yet</h1>
1176
+ <p>
1177
+ Add a folder of skills or memory docs to get started. You can add more roots later —
1178
+ e.g. a personal skills repo plus a shared company repo.
1179
+ </p>
1180
+ <button class="add-root-btn" @click=${()=>this.#l.set(!0)}>+ Add your first root</button>
1181
+ </div>
1182
+ ${this.#l.value?p`<add-root-modal
1183
+ .defaultKind=${"skill"}
1184
+ .lockKind=${!1}
1185
+ .onAdded=${()=>this.#C()}
1186
+ .onCancel=${()=>this.#l.set(!1)}
1187
+ ></add-root-modal>`:""}
1188
+ `:p`
1189
+ ${this.#oe()}
1190
+ ${this.#P()}
1191
+ <div class="roots-bar">
1192
+ <span class="filter-label">Roots:</span>
1193
+ ${t.map(s=>p`
1194
+ <button
1195
+ class="root-chip ${this.#r.value.includes(s.name)?"active":""}"
1196
+ title=${s.path}
1197
+ @click=${()=>this.#H(s.name)}
1198
+ >
1199
+ ${s.name}
1200
+ <span
1201
+ class="remove"
1202
+ title="Remove root"
1203
+ @click=${i=>this.#B(s,i)}
1204
+ >${this.#n.value===s.name?"…":"✕"}</span
1205
+ >
1206
+ </button>
1207
+ `)}
1208
+ <button class="add-root-btn" @click=${()=>this.#l.set(!0)}>+ Add root</button>
1209
+ </div>
1210
+ <div class="filters">
1211
+ <div class="row search-row">
1212
+ <div class="search-field">
1213
+ <input
1214
+ type="search"
1215
+ placeholder="Search descriptions, bodies, tags..."
1216
+ .value=${this.#t.value}
1217
+ @input=${s=>this.#W(s)}
1218
+ />
1219
+ ${this.#t.value?p`
1220
+ <button
1221
+ class="search-clear-btn"
1222
+ title="Clear search"
1223
+ aria-label="Clear search"
1224
+ @click=${()=>this.#Y()}
1225
+ >
1226
+
1227
+ </button>
1228
+ `:""}
1229
+ </div>
1230
+ <div class="row type-toggle">
1231
+ ${ui.map(s=>p`
1232
+ <button
1233
+ class=${this.#s.value===s.value?"active":""}
1234
+ @click=${()=>this.#j(s.value)}
1235
+ >
1236
+ ${s.label}
1237
+ </button>
1238
+ `)}
1239
+ </div>
1240
+ ${e.tags.length===0?p`<span class="filter-label">Tags:</span> <label class="small">no tags yet</label>`:p`
1241
+ <tag-multiselect
1242
+ .tags=${e.tags}
1243
+ .active=${this.#i.value}
1244
+ .onToggle=${s=>this.#Z(s)}
1245
+ ></tag-multiselect>
1246
+ `}
1247
+ <span class="filter-label">Dates:</span>
1248
+ <div class="date-range">
1249
+ <input
1250
+ type="date"
1251
+ aria-label="From date"
1252
+ .value=${this.#f.value}
1253
+ @change=${s=>this.#te(s)}
1254
+ />
1255
+ <span class="date-range-sep">–</span>
1256
+ <input
1257
+ type="date"
1258
+ aria-label="To date"
1259
+ .value=${this.#v.value}
1260
+ @change=${s=>this.#se(s)}
1261
+ />
1262
+ ${this.#f.value||this.#v.value?p`
1263
+ <button
1264
+ class="date-range-clear"
1265
+ title="Clear date range"
1266
+ aria-label="Clear date range"
1267
+ @click=${()=>this.#ie()}
1268
+ >
1269
+
1270
+ </button>
1271
+ `:""}
1272
+ </div>
1273
+ <span class="filter-label">Sort:</span>
1274
+ <select .value=${this.#g.value} @change=${s=>this.#J(s)}>
1275
+ <option value="mtime_desc">Recently touched</option>
1276
+ <option value="mtime_asc">Least recently touched</option>
1277
+ <option value="created_at_asc">Oldest first</option>
1278
+ <option value="name_asc">Name</option>
1279
+ </select>
1280
+ <span class="filter-label">Deprecated:</span>
1281
+ <select .value=${this.#m.value} @change=${s=>this.#X(s)}>
1282
+ ${it.map(s=>p`<option value=${s.value}>${s.label}</option>`)}
1283
+ </select>
1284
+ <span class="filter-label">Paused:</span>
1285
+ <select .value=${this.#k.value} @change=${s=>this.#ee(s)}>
1286
+ ${it.map(s=>p`<option value=${s.value}>${s.label}</option>`)}
1287
+ </select>
1288
+ </div>
1289
+ </div>
1290
+ ${this.#d.value.size>0?p`
1291
+ <div class="bulk-bar">
1292
+ <span>${this.#d.value.size} selected</span>
1293
+ <button @click=${()=>this.#E(!0)}>Mark deprecated</button>
1294
+ <button @click=${()=>this.#E(!1)}>Un-deprecate</button>
1295
+ <button @click=${()=>this.#z(!0)}>Pause</button>
1296
+ <button @click=${()=>this.#z(!1)}>Resume</button>
1297
+ <button class="danger" @click=${()=>this.#ae()}>Delete</button>
1298
+ <button @click=${()=>this.#d.set(new Set)}>Clear</button>
1299
+ </div>
1300
+ `:""}
1301
+ <div class="body-region">
1302
+ <result-list
1303
+ style=${`width: ${this.#b.value}%; border-right: 1px solid var(--border);`}
1304
+ .results=${this.#h.value}
1305
+ .showRoot=${t.length>1}
1306
+ .onSelect=${s=>this.#G(s)}
1307
+ .selectedIds=${this.#d.value}
1308
+ .onToggleSelect=${s=>this.#re(s)}
1309
+ ></result-list>
1310
+ <div
1311
+ class="splitter ${this.#x.value?"dragging":""}"
1312
+ @pointerdown=${s=>this.#I(s)}
1313
+ ></div>
1314
+ <detail-panel
1315
+ .selected=${this.#c.value}
1316
+ .facets=${e}
1317
+ .onChanged=${()=>this.#a()}
1318
+ .onTagClick=${s=>this.#K(s)}
1319
+ .onRootClick=${s=>this.#Q(s)}
1320
+ .onDateClick=${s=>this.#V(s)}
1321
+ ></detail-panel>
1322
+ </div>
1323
+ ${this.#l.value?p`<add-root-modal
1324
+ .defaultKind=${"skill"}
1325
+ .lockKind=${!1}
1326
+ .onAdded=${()=>this.#C()}
1327
+ .onCancel=${()=>this.#l.set(!1)}
1328
+ ></add-root-modal>`:""}
1329
+ `}}customElements.define("mem-bucket-app",$i);