mcp-memory-bucket 0.3.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,894 @@
1
+ (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const n of r)if(n.type==="childList")for(const o of n.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function t(r){const n={};return r.integrity&&(n.integrity=r.integrity),r.referrerPolicy&&(n.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?n.credentials="include":r.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function s(r){if(r.ep)return;r.ep=!0;const n=t(r);fetch(r.href,n)}})();/**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */const X=globalThis,xe=X.ShadowRoot&&(X.ShadyCSS===void 0||X.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,me=Symbol(),Ie=new WeakMap;let it=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=Ie.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&Ie.set(t,e))}return e}toString(){return this.cssText}};const Tt=i=>new it(typeof i=="string"?i:i+"",void 0,me),W=(i,...e)=>{const t=i.length===1?i[0]:e.reduce((s,r,n)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+i[n+1],i[0]);return new it(t,i,me)},Rt=(i,e)=>{if(xe)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const s=document.createElement("style"),r=X.litNonce;r!==void 0&&s.setAttribute("nonce",r),s.textContent=t.cssText,i.appendChild(s)}},Me=xe?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return Tt(t)})(i):i;/**
6
+ * @license
7
+ * Copyright 2017 Google LLC
8
+ * SPDX-License-Identifier: BSD-3-Clause
9
+ */const{is:Et,defineProperty:Ct,getOwnPropertyDescriptor:Pt,getOwnPropertyNames:zt,getOwnPropertySymbols:Lt,getPrototypeOf:It}=Object,re=globalThis,Oe=re.trustedTypes,Mt=Oe?Oe.emptyScript:"",Ot=re.reactiveElementPolyfillSupport,Z=(i,e)=>i,pe={toAttribute(i,e){switch(e){case Boolean:i=i?Mt:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},rt=(i,e)=>!Et(i,e),De={attribute:!0,type:String,converter:pe,reflect:!1,useDefault:!1,hasChanged:rt};Symbol.metadata??=Symbol("metadata"),re.litPropertyMetadata??=new WeakMap;let D=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=De){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const s=Symbol(),r=this.getPropertyDescriptor(e,s,t);r!==void 0&&Ct(this.prototype,e,r)}}static getPropertyDescriptor(e,t,s){const{get:r,set:n}=Pt(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:r,set(o){const a=r?.call(this);n?.call(this,o),this.requestUpdate(e,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??De}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=[...zt(t),...Lt(t)];for(const r of s)this.createProperty(r,t[r])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[s,r]of t)this.elementProperties.set(s,r)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const r=this._$Eu(t,s);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const r of s)t.unshift(Me(r))}else e!==void 0&&t.push(Me(e));return t}static _$Eu(e,t){const s=t.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const s of t.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Rt(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){const s=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,s);if(r!==void 0&&s.reflect===!0){const n=(s.converter?.toAttribute!==void 0?s.converter:pe).toAttribute(t,s.type);this._$Em=e,n==null?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(e,t){const s=this.constructor,r=s._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const n=s.getPropertyOptions(r),o=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:pe;this._$Em=r;const a=o.fromAttribute(t,n.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,s,r=!1,n){if(e!==void 0){const o=this.constructor;if(r===!1&&(n=this[e]),s??=o.getPropertyOptions(e),!((s.hasChanged??rt)(n,t)||s.useDefault&&s.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,s))))return;this.C(e,t,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:s,reflect:r,wrapped:n},o){s&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),n!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),r===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[r,n]of this._$Ep)this[r]=n;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[r,n]of s){const{wrapped:o}=n,a=this[r];o!==!0||this._$AL.has(r)||a===void 0||this.C(r,void 0,n,a)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(t)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};D.elementStyles=[],D.shadowRootOptions={mode:"open"},D[Z("elementProperties")]=new Map,D[Z("finalized")]=new Map,Ot?.({ReactiveElement:D}),(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=i=>i,ee=ke.trustedTypes,qe=ee?ee.createPolicy("lit-html",{createHTML:i=>i}):void 0,nt="$lit$",R=`lit$${Math.random().toFixed(9).slice(2)}$`,ot="?"+R,Dt=`<${ot}>`,z=document,Q=()=>z.createComment(""),K=i=>i===null||typeof i!="object"&&typeof i!="function",$e=Array.isArray,Nt=i=>$e(i)||typeof i?.[Symbol.iterator]=="function",le=`[
14
+ \f\r]`,B=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ue=/-->/g,He=/>/g,E=RegExp(`>|${le}(?:([^\\s"'>=/]+)(${le}*=${le}*(?:[^
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Be=/'/g,je=/"/g,at=/^(?:script|style|textarea|title)$/i,qt=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),d=qt(1),L=Symbol.for("lit-noChange"),k=Symbol.for("lit-nothing"),Fe=new WeakMap,P=z.createTreeWalker(z,129);function lt(i,e){if(!$e(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return qe!==void 0?qe.createHTML(e):e}const Ut=(i,e)=>{const t=i.length-1,s=[];let r,n=e===2?"<svg>":e===3?"<math>":"",o=B;for(let a=0;a<t;a++){const l=i[a];let c,p,h=-1,g=0;for(;g<l.length&&(o.lastIndex=g,p=o.exec(l),p!==null);)g=o.lastIndex,o===B?p[1]==="!--"?o=Ue:p[1]!==void 0?o=He:p[2]!==void 0?(at.test(p[2])&&(r=RegExp("</"+p[2],"g")),o=E):p[3]!==void 0&&(o=E):o===E?p[0]===">"?(o=r??B,h=-1):p[1]===void 0?h=-2:(h=o.lastIndex-p[2].length,c=p[1],o=p[3]===void 0?E:p[3]==='"'?je:Be):o===je||o===Be?o=E:o===Ue||o===He?o=B:(o=E,r=void 0);const m=o===E&&i[a+1].startsWith("/>")?" ":"";n+=o===B?l+Dt:h>=0?(s.push(c),l.slice(0,h)+nt+l.slice(h)+R+m):l+R+(h===-2?a:m)}return[lt(i,n+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};let ue=class ct{constructor({strings:e,_$litType$:t},s){let r;this.parts=[];let n=0,o=0;const a=e.length-1,l=this.parts,[c,p]=Ut(e,t);if(this.el=ct.createElement(c,s),P.currentNode=this.el.content,t===2||t===3){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=P.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const h of r.getAttributeNames())if(h.endsWith(nt)){const g=p[o++],m=r.getAttribute(h).split(R),b=/([.?@])?(.*)/.exec(g);l.push({type:1,index:n,name:b[2],strings:m,ctor:b[1]==="."?Bt:b[1]==="?"?jt:b[1]==="@"?Ft:ne}),r.removeAttribute(h)}else h.startsWith(R)&&(l.push({type:6,index:n}),r.removeAttribute(h));if(at.test(r.tagName)){const h=r.textContent.split(R),g=h.length-1;if(g>0){r.textContent=ee?ee.emptyScript:"";for(let m=0;m<g;m++)r.append(h[m],Q()),P.nextNode(),l.push({type:2,index:++n});r.append(h[g],Q())}}}else if(r.nodeType===8)if(r.data===ot)l.push({type:2,index:n});else{let h=-1;for(;(h=r.data.indexOf(R,h+1))!==-1;)l.push({type:7,index:n}),h+=R.length-1}n++}}static createElement(e,t){const s=z.createElement("template");return s.innerHTML=e,s}};function N(i,e,t=i,s){if(e===L)return e;let r=s!==void 0?t._$Co?.[s]:t._$Cl;const n=K(e)?void 0:e._$litDirective$;return r?.constructor!==n&&(r?._$AO?.(!1),n===void 0?r=void 0:(r=new n(i),r._$AT(i,t,s)),s!==void 0?(t._$Co??=[])[s]=r:t._$Cl=r),r!==void 0&&(e=N(i,r._$AS(i,e.values),r,s)),e}let Ht=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,r=(e?.creationScope??z).importNode(t,!0);P.currentNode=r;let n=P.nextNode(),o=0,a=0,l=s[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new V(n,n.nextSibling,this,e):l.type===1?c=new l.ctor(n,l.name,l.strings,this,e):l.type===6&&(c=new Zt(n,this,e)),this._$AV.push(c),l=s[++a]}o!==l?.index&&(n=P.nextNode(),o++)}return P.currentNode=z,r}p(e){let t=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}};class V{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,r){this.type=2,this._$AH=k,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=N(this,e,t),K(e)?e===k||e==null||e===""?(this._$AH!==k&&this._$AR(),this._$AH=k):e!==this._$AH&&e!==L&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Nt(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!==k&&K(this._$AH)?this._$AA.nextSibling.data=e:this.T(z.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:s}=e,r=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=ue.createElement(lt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(t);else{const n=new Ht(r,this),o=n.u(this.options);n.p(t),this.T(o),this._$AH=n}}_$AC(e){let t=Fe.get(e.strings);return t===void 0&&Fe.set(e.strings,t=new ue(e)),t}k(e){$e(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,r=0;for(const n of e)r===t.length?t.push(s=new V(this.O(Q()),this.O(Q()),this,this.options)):s=t[r],s._$AI(n),r++;r<t.length&&(this._$AR(s&&s._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const s=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,r,n){this.type=1,this._$AH=k,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=k}_$AI(e,t=this,s,r){const n=this.strings;let o=!1;if(n===void 0)e=N(this,e,t,0),o=!K(e)||e!==this._$AH&&e!==L,o&&(this._$AH=e);else{const a=e;let l,c;for(e=n[0],l=0;l<n.length-1;l++)c=N(this,a[s+l],t,l),c===L&&(c=this._$AH[l]),o||=!K(c)||c!==this._$AH[l],c===k?e=k:e!==k&&(e+=(c??"")+n[l+1]),this._$AH[l]=c}o&&!r&&this.j(e)}j(e){e===k?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Bt=class extends ne{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===k?void 0:e}},jt=class extends ne{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==k)}},Ft=class extends ne{constructor(e,t,s,r,n){super(e,t,s,r,n),this.type=5}_$AI(e,t=this){if((e=N(this,e,t,0)??k)===L)return;const s=this._$AH,r=e===k&&s!==k||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==k&&(s===k||r);r&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Zt=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 Qt=ke.litHtmlPolyfillSupport;Qt?.(ue,V),(ke.litHtmlVersions??=[]).push("3.3.3");const Kt=(i,e,t)=>{const s=t?.renderBefore??e;let r=s._$litPart$;if(r===void 0){const n=t?.renderBefore??null;s._$litPart$=r=new V(e.insertBefore(Q(),n),n,void 0,t??{})}return r._$AI(i),r};/**
16
+ * @license
17
+ * Copyright 2017 Google LLC
18
+ * SPDX-License-Identifier: BSD-3-Clause
19
+ */const ve=globalThis;let S=class extends D{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Kt(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,ve.litElementHydrateSupport?.({LitElement:S});const Wt=ve.litElementPolyfillSupport;Wt?.({LitElement:S});(ve.litElementVersions??=[]).push("4.2.2");var ht;let ce=0;const Ze=new Set;function Vt(i){ce++;try{i()}finally{ce--,ce===0&&Gt()}}function Gt(){const i=new Set(Ze);Ze.clear();for(const e of i)e()}function Yt(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}function Jt(i){return i&&typeof i.deref=="function"}class ye{static#e=0;#t;#s;#i=new Set;#r=ht.#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 Yt(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(Jt(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}`}}ht=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){Vt(()=>{this._set(e)})}get value(){return this.get()}set value(e){this.set(e)}update(e){this.set(e(this.get()))}}class Xt extends ye{#e;#t=!0;#s=!1;#i=new Map;_debugParent;#r;#o=()=>{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.#o,this.#r);this.#i.set(e,t)}dispose(){this.#a()}#a(){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.#a(),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,r=this;t.update=function(n){u.push(r);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"})`}}function es(i){if(!i)return"unknown age";const e=new Date(i);return Number.isNaN(e.getTime())?"unknown age":e.toISOString().slice(0,10)}class ts extends S{static{this.properties={results:{attribute:!1},showRoot:{attribute:!1},onSelect:{attribute:!1},selectedIds:{attribute:!1},onToggleSelect:{attribute:!1}}}static{this.styles=W`
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?d`<div class="empty">No results.</div>`:d`
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 d`
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">${es(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?d`<span class="root-badge">${e.root}</span>`:""}
79
+ ${e.deprecated?d`<span class="deprecated-badge">deprecated</span>`:""}
80
+ ${e.paused?d`<span class="paused-badge">paused</span>`:""}
81
+ ${e.tags.map(s=>d`<span class="tag">${s}</span>`)}
82
+ </div>
83
+ </div>
84
+ </div>
85
+ `})}
86
+ `}}customElements.define("result-list",ts);function _e(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var M=_e();function pt(i){M=i}var C={exec:()=>null};function O(i){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),r=e[s];return r||(r=i(s),e[s]=r),r}}function f(i,e=""){let t=typeof i=="string"?i:i.source,s={replace:(r,n)=>{let o=typeof n=="string"?n:n.source;return o=o.replace($.caret,"$1"),t=t.replace(r,o),s},getRegex:()=>new RegExp(t,e)};return s}var ss=((i="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+i)}catch{return!1}})(),$={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:i=>new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:O(i=>new RegExp(`^ {0,${i}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:O(i=>new RegExp(`^ {0,${i}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:O(i=>new RegExp(`^ {0,${i}}(?:\`\`\`|~~~)`)),headingBeginRegex:O(i=>new RegExp(`^ {0,${i}}#`)),htmlBeginRegex:O(i=>new RegExp(`^ {0,${i}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:O(i=>new RegExp(`^ {0,${i}}>`))},is=/^(?:[ \t]*(?:\n|$))+/,rs=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ns=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,G=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,os=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Se=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ut=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,dt=f(ut).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(),as=f(ut).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]+)*)/,ls=/^[^\n]+/,Te=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,cs=f(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Te).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),hs=f(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Se).getRegex(),oe="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Re=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ps=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",oe).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),gt=i=>f(Ae).replace("hr",G).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",i).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oe).getRegex(),us=gt(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),ds=gt(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),gs=f(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ds).getRegex(),Ee={blockquote:gs,code:rs,def:cs,fences:ns,heading:os,hr:G,html:ps,lheading:dt,list:hs,newline:is,paragraph:us,table:C,text:ls},Qe=f("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",G).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oe).getRegex(),fs={...Ee,lheading:as,table:Qe,paragraph:f(Ae).replace("hr",G).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Qe).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oe).getRegex()},bs={...Ee,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:C,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:f(Ae).replace("hr",G).replace("heading",` *#{1,6} *[^
87
+ ]`).replace("lheading",dt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},xs=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ms=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ft=/^( {2,}|\\)\n(?!\s*$)/,ks=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,A=/[\p{P}\p{S}]/u,q=/[\s\p{P}\p{S}]/u,Y=/[^\s\p{P}\p{S}]/u,$s=f(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,q).getRegex(),vs=/[\p{Pi}\p{Ps}"']/u,bt=/(?!~)[\p{P}\p{S}]/u,ys=/(?!~)[\s\p{P}\p{S}]/u,ws=/(?:[^\s\p{P}\p{S}]|~)/u,_s=f(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",ss?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),xt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ss=f(xt,"u").replace(/punct/g,A).getRegex(),As=f(xt,"u").replace(/punct/g,bt).getRegex(),Ts=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,Rs=f(Ts,"u").replace(/openQuote/g,vs).replace(/punct/g,A).getRegex(),mt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Es=f(mt,"gu").replace(/notPunctSpace/g,Y).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Cs=f(mt,"gu").replace(/notPunctSpace/g,ws).replace(/punctSpace/g,ys).replace(/punct/g,bt).getRegex(),Ps="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",zs=f(Ps,"gu").replace(/notPunctSpace/g,Y).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Ls=f("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Y).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Is="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Ms=f(Is,"gu").replace(/notPunctSpace/g,Y).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Os=f(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,A).getRegex(),Ds="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Ns=f(Ds,"gu").replace(/notPunctSpace/g,Y).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),qs=f(/\\(punct)/,"gu").replace(/punct/g,A).getRegex(),Us=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(),Hs=f(Re).replace("(?:-->|$)","-->").getRegex(),Bs=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",Hs).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),te=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,js=f(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",te).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),kt=f(/^!?\[(label)\]\[(ref)\]/).replace("label",te).replace("ref",Te).getRegex(),$t=f(/^!?\[(ref)\](?:\[\])?/).replace("ref",Te).getRegex(),Fs=f("reflink|nolink(?!\\()","g").replace("reflink",kt).replace("nolink",$t).getRegex(),Ke=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ce={_backpedal:C,anyPunctuation:qs,autolink:Us,blockSkip:_s,br:ft,code:ms,del:C,delLDelim:C,delRDelim:C,emStrongLDelim:Ss,emStrongRDelimAst:Es,emStrongRDelimUnd:Ls,escape:xs,link:js,nolink:$t,punctuation:$s,reflink:kt,reflinkSearch:Fs,tag:Bs,text:ks,url:C},Zs={...Ce,emStrongLDelim:Rs,emStrongRDelimAst:zs,emStrongRDelimUnd:Ms,link:f(/^!?\[(label)\]\((.*?)\)/).replace("label",te).getRegex(),reflink:f(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",te).getRegex()},de={...Ce,emStrongRDelimAst:Cs,emStrongLDelim:As,delLDelim:Os,delRDelim:Ns,url:f(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ke).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",Ke).getRegex()},Qs={...de,br:f(ft).replace("{2,}","*").getRegex(),text:f(de.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},J={normal:Ee,gfm:fs,pedantic:bs},j={normal:Ce,gfm:de,breaks:Qs,pedantic:Zs},Ks={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},We=i=>Ks[i];function _(i,e){if(e){if($.escapeTest.test(i))return i.replace($.escapeReplace,We)}else if($.escapeTestNoEncode.test(i))return i.replace($.escapeReplaceNoEncode,We);return i}function Ve(i){try{i=encodeURI(i).replace($.percentDecode,"%")}catch{return null}return i}function Ge(i,e){let t=i.replace($.findPipe,(n,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),s=t.split($.splitPipe),r=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;r<s.length;r++)s[r]=s[r].trim().replace($.slashPipe,"|");return s}function T(i,e,t){let s=i.length;if(s===0)return"";let r=0;for(;r<s&&i.charAt(s-r-1)===e;)r++;return i.slice(0,s-r)}function Ye(i){let e=i.split(`
88
+ `),t=e.length-1;for(;t>=0&&$.blankLine.test(e[t]);)t--;return e.length-t<=2?i:e.slice(0,t+1).join(`
89
+ `)}function Ws(i,e){if(i.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<i.length;s++)if(i[s]==="\\")s++;else if(i[s]===e[0])t++;else if(i[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function Vs(i,e=0){let t=e,s="";for(let r of i)if(r===" "){let n=4-t%4;s+=" ".repeat(n),t+=n}else s+=r,t++;return s}function Je(i,e,t,s,r){let n=e.href,o=e.title||null,a=i[1].replace(r.other.outputLinkReplace,"$1");s.state.inLink=!0;let l={type:i[0].charAt(0)==="!"?"image":"link",raw:t,href:n,title:o,text:a,tokens:s.inlineTokens(a)};return s.state.inLink=!1,l}function Gs(i,e,t){let s=i.match(t.other.indentCodeCompensation);if(s===null)return e;let r=s[1];return e.split(`
90
+ `).map(n=>{let o=n.match(t.other.beginningSpace);if(o===null)return n;let[a]=o;return a.length>=r.length?n.slice(r.length):n}).join(`
91
+ `)}var se=class{options;rules;lexer;constructor(i){this.options=i||M}space(i){let e=this.rules.block.newline.exec(i);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(i){let e=this.rules.block.code.exec(i);if(e){let t=this.options.pedantic?e[0]:Ye(e[0]),s=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:s}}}fences(i){let e=this.rules.block.fences.exec(i);if(e){let t=e[0],s=Gs(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(i){let e=this.rules.block.heading.exec(i);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=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(i){let e=this.rules.block.hr.exec(i);if(e)return{type:"hr",raw:T(e[0],`
93
+ `)}}blockquote(i){let e=this.rules.block.blockquote.exec(i);if(e){let t=T(e[0],`
94
+ `).split(`
95
+ `),s="",r="",n=[];for(;t.length>0;){let o=!1,a=[],l;for(l=0;l<t.length;l++)if(this.rules.other.blockquoteStart.test(t[l]))a.push(t[l]),o=!0;else if(!o)a.push(t[l]);else break;t=t.slice(l);let c=a.join(`
96
+ `),p=c.replace(this.rules.other.blockquoteSetextReplace,`
97
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
98
+ ${c}`:c,r=r?`${r}
99
+ ${p}`:p;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,n,!0),this.lexer.state.top=h,t.length===0)break;let g=n.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){let m=g,b=t.join(`
100
+ `),w=m.raw+`
101
+ `+b.replace(this.rules.other.blockquoteSetextReplace2,""),U=this.blockquote(w);n[n.length-1]=U,s=`${s}
102
+ ${b}`,r=r.substring(0,r.length-m.text.length)+U.text;break}else if(g?.type==="list"){let m=g,b=m.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,r=r.substring(0,r.length-m.raw.length)+w.raw,t=b.substring(n.at(-1).raw.length).split(`
105
+ `);continue}}return{type:"blockquote",raw:s,tokens:n,text:r}}}list(i){let e=this.rules.block.list.exec(i);if(e){let t=e[1].trim(),s=t.length>1,r={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let n=this.rules.other.listItemRegex(t),o=!1;for(;i;){let l=!1,c="",p="";if(!(e=n.exec(i))||this.rules.block.hr.test(i))break;c=e[0],i=i.substring(c.length);let h=Vs(e[2].split(`
106
+ `,1)[0],e[1].length),g=i.split(`
107
+ `,1)[0],m=!h.trim(),b=0;if(this.options.pedantic?(b=2,p=h.trimStart()):m?b=e[1].length+1:(b=h.search(this.rules.other.nonSpaceChar),b=b>4?1:b,p=h.slice(b),b+=e[1].length),m&&this.rules.other.blankLine.test(g)&&(c+=g+`
108
+ `,i=i.substring(g.length+1),l=!0),!l){let w=this.rules.other.nextBulletRegex(b),U=this.rules.other.hrRegex(b),ze=this.rules.other.fencesBeginRegex(b),Le=this.rules.other.headingBeginRegex(b),St=this.rules.other.htmlBeginRegex(b),At=this.rules.other.blockquoteBeginRegex(b);for(;i;){let ae=i.split(`
109
+ `,1)[0],H;if(g=ae,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),H=g):H=g.replace(this.rules.other.tabCharGlobal," "),ze.test(g)||Le.test(g)||St.test(g)||At.test(g)||w.test(g)||U.test(g))break;if(H.search(this.rules.other.nonSpaceChar)>=b||!g.trim())p+=`
110
+ `+H.slice(b);else{if(m||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||ze.test(h)||Le.test(h)||U.test(h))break;p+=`
111
+ `+g}m=!g.trim(),c+=ae+`
112
+ `,i=i.substring(ae.length+1),h=H.slice(b)}}r.loose||(o?r.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0)),r.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),r.raw+=c}let a=r.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let l of r.items)if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),!r.loose){let c=l.tokens.filter(h=>h.type==="space"),p=c.length>0&&c.some(h=>this.rules.other.anyLine.test(h.raw));r.loose=p}for(let l of r.items){let c=l.tokens[0];if(l.task&&(c?.type==="text"||c?.type==="paragraph")){l.text=l.text.replace(this.rules.other.listReplaceTask,""),c.raw=c.raw.replace(this.rules.other.listReplaceTask,""),c.text=c.text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(l.raw);if(p){let h={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};l.checked=h.checked,r.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=h.raw+l.tokens[0].raw,l.tokens[0].text=h.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(h)):l.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):l.tokens.unshift(h)}}else l.task&&(l.task=!1)}if(r.loose)for(let l of r.items){l.loose=!0;for(let c of l.tokens)c.type==="text"&&(c.type="paragraph")}return r}}html(i){let e=this.rules.block.html.exec(i);if(e){let t=Ye(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(i){let e=this.rules.block.def.exec(i);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:T(e[0],`
113
+ `),href:s,title:r}}}table(i){let e=this.rules.block.table.exec(i);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=Ge(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=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 o of s)this.rules.other.tableAlignRight.test(o)?n.align.push("right"):this.rules.other.tableAlignCenter.test(o)?n.align.push("center"):this.rules.other.tableAlignLeft.test(o)?n.align.push("left"):n.align.push(null);for(let o=0;o<t.length;o++)n.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:n.align[o]});for(let o of r)n.rows.push(Ge(o,n.header.length).map((a,l)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:n.align[l]})));return n}}lheading(i){let e=this.rules.block.lheading.exec(i);if(e){let t=e[1].trim();return{type:"heading",raw:T(e[0],`
116
+ `),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(i){let e=this.rules.block.paragraph.exec(i);if(e){let t=e[1].charAt(e[1].length-1)===`
117
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(i){let e=this.rules.block.text.exec(i);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(i){let e=this.rules.inline.escape.exec(i);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(i){let e=this.rules.inline.tag.exec(i);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(i){let e=this.rules.inline.link.exec(i);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let n=T(t.slice(0,-1),"\\");if((t.length-n.length)%2===0)return}else{let n=Ws(e[2],"()");if(n===-2)return;if(n>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+n;e[2]=e[2].substring(0,n),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let s=e[2],r="";if(this.options.pedantic){let n=this.rules.other.pedanticHrefTitle.exec(s);n&&(s=n[1],r=n[3])}else r=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),Je(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(i,e){let t;if((t=this.rules.inline.reflink.exec(i))||(t=this.rules.inline.nolink.exec(i))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=e[s.toLowerCase()];if(!r){let n=t[0].charAt(0);return{type:"text",raw:n,text:n}}return Je(t,r,t[0],this.lexer,this.rules)}}emStrong(i,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(i);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let r=[...s[0]].length-1,n,o,a=r,l=0,c=s[0][0],p=t===c,h=c==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*i.length+r);(s=h.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n)continue;if(o=[...n].length,s[3]||s[4]){a+=o;continue}else if(s[5]||s[6]){if(r%3&&!((r+o)%3)){l+=o;continue}if(p)break}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let g=[...s[0]][0].length,m=i.slice(0,r+s.index+g+o);if(Math.min(r,o)%2){let w=m.slice(1,-1);return{type:"em",raw:m,text:w,tokens:this.lexer.inlineTokens(w)}}let b=m.slice(2,-2);return{type:"strong",raw:m,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(i){let e=this.rules.inline.code.exec(i);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),r=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&r&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(i){let e=this.rules.inline.br.exec(i);if(e)return{type:"br",raw:e[0]}}del(i,e,t=""){let s=this.rules.inline.delLDelim.exec(i);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let r=[...s[0]].length-1,n,o,a=r,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*i.length+r);(s=l.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n||(o=[...n].length,o!==r))continue;if(s[3]||s[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let c=[...s[0]][0].length,p=i.slice(0,r+s.index+c+o),h=p.slice(r,-r);return{type:"del",raw:p,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(i){let e=this.rules.inline.autolink.exec(i);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(i){let e;if(e=this.rules.inline.url.exec(i)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let r;do r=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(r!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(i){let e=this.rules.inline.text.exec(i);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},v=class ge{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||M,this.options.tokenizer=this.options.tokenizer||new se,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:$,block:J.normal,inline:j.normal};this.options.pedantic?(t.block=J.pedantic,t.inline=j.pedantic):this.options.gfm&&(t.block=J.gfm,this.options.breaks?t.inline=j.breaks:t.inline=j.gfm),this.tokenizer.rules=t}static get rules(){return{block:J,inline:j}}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($.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($.tabCharGlobal," ").replace($.spaceLine,""));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let n;if(this.options.extensions?.block?.some(a=>(n=a.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))continue;if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length);let a=t.at(-1);n.raw.length===1&&a!==void 0?a.raw+=`
119
+ `:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
120
+ `)?"":`
121
+ `)+n.raw,a.text+=`
122
+ `+n.text,this.inlineQueue.at(-1).src=a.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
123
+ `)?"":`
124
+ `)+n.raw,a.text+=`
125
+ `+n.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title},t.push(n));continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}let o=e;if(this.options.extensions?.startBlock){let a=1/0,l=e.slice(1),c;this.options.extensions.startBlock.forEach(p=>{c=p.call({lexer:this},l),typeof c=="number"&&c>=0&&(a=Math.min(a,c))}),a<1/0&&a>=0&&(o=e.substring(0,a+1))}if(this.state.top&&(n=this.tokenizer.paragraph(o))){let a=t.at(-1);s&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
126
+ `)?"":`
127
+ `)+n.raw,a.text+=`
128
+ `+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(n),s=o.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length);let a=t.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(`
129
+ `)?"":`
130
+ `)+n.raw,a.text+=`
131
+ `+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(n);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=e;if(this.tokens.links){let a=Object.keys(this.tokens.links);a.length>0&&(s=s.replace(this.tokenizer.rules.inline.reflinkSearch,l=>a.includes(l.slice(l.lastIndexOf("[")+1,-1))?"["+"a".repeat(l.length-2)+"]":l))}s=s.replace(this.tokenizer.rules.inline.anyPunctuation,a=>"+".repeat(a.length)),s=s.replace(this.tokenizer.rules.inline.blockSkip,(a,l,c)=>{let p=c?c.length:0;return a.slice(0,p)+"["+"a".repeat(a.length-p-2)+"]"}),s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let r=!1,n="",o=1/0;for(;e;){if(e.length<o)o=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(n=""),r=!1;let a;if(this.options.extensions?.inline?.some(c=>(a=c.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let c=t.at(-1);a.type==="text"&&c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,s,n)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e,s,n)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let l=e;if(this.options.extensions?.startInline){let c=1/0,p=e.slice(1),h;this.options.extensions.startInline.forEach(g=>{h=g.call({lexer:this},p),typeof h=="number"&&h>=0&&(c=Math.min(c,h))}),c<1/0&&c>=0&&(l=e.substring(0,c+1))}if(a=this.tokenizer.inlineText(l)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(n=a.raw.slice(-1)),r=!0;let c=t.at(-1);c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):t.push(a);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},ie=class{options;parser;constructor(i){this.options=i||M}space(i){return""}code({text:i,lang:e,escaped:t}){let s=(e||"").match($.notSpaceStart)?.[0],r=i.replace($.endingNewline,"")+`
132
+ `;return s?'<pre><code class="language-'+_(s)+'">'+(t?r:_(r,!0))+`</code></pre>
133
+ `:"<pre><code>"+(t?r:_(r,!0))+`</code></pre>
134
+ `}blockquote({tokens:i}){return`<blockquote>
135
+ ${this.parser.parse(i)}</blockquote>
136
+ `}html({text:i}){return i}def(i){return""}heading({tokens:i,depth:e}){return`<h${e}>${this.parser.parseInline(i)}</h${e}>
137
+ `}hr(i){return`<hr>
138
+ `}list(i){let e=i.ordered,t=i.start,s="";for(let o=0;o<i.items.length;o++){let a=i.items[o];s+=this.listitem(a)}let r=e?"ol":"ul",n=e&&t!==1?' start="'+t+'"':"";return"<"+r+n+`>
139
+ `+s+"</"+r+`>
140
+ `}listitem(i){return`<li>${this.parser.parse(i.tokens)}</li>
141
+ `}checkbox({checked:i}){return"<input "+(i?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:i}){return`<p>${this.parser.parseInline(i)}</p>
142
+ `}table(i){let e="",t="";for(let r=0;r<i.header.length;r++)t+=this.tablecell(i.header[r]);e+=this.tablerow({text:t});let s="";for(let r=0;r<i.rows.length;r++){let n=i.rows[r];t="";for(let o=0;o<n.length;o++)t+=this.tablecell(n[o]);s+=this.tablerow({text:t})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
143
+ <thead>
144
+ `+e+`</thead>
145
+ `+s+`</table>
146
+ `}tablerow({text:i}){return`<tr>
147
+ ${i}</tr>
148
+ `}tablecell(i){let e=this.parser.parseInline(i.tokens),t=i.header?"th":"td";return(i.align?`<${t} align="${i.align}">`:`<${t}>`)+e+`</${t}>
149
+ `}strong({tokens:i}){return`<strong>${this.parser.parseInline(i)}</strong>`}em({tokens:i}){return`<em>${this.parser.parseInline(i)}</em>`}codespan({text:i}){return`<code>${_(i,!0)}</code>`}br(i){return"<br>"}del({tokens:i}){return`<del>${this.parser.parseInline(i)}</del>`}link({href:i,title:e,tokens:t}){let s=this.parser.parseInline(t),r=Ve(i);if(r===null)return s;i=r;let n='<a href="'+i+'"';return e&&(n+=' title="'+_(e)+'"'),n+=">"+s+"</a>",n}image({href:i,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let r=Ve(i);if(r===null)return _(t);i=r;let n=`<img src="${i}" alt="${_(t)}"`;return e&&(n+=` title="${_(e)}"`),n+=">",n}text(i){return"tokens"in i&&i.tokens?this.parser.parseInline(i.tokens):"escaped"in i&&i.escaped?i.text:_(i.text)}},Pe=class{strong({text:i}){return i}em({text:i}){return i}codespan({text:i}){return i}del({text:i}){return i}html({text:i}){return i}text({text:i}){return i}link({text:i}){return""+i}image({text:i}){return""+i}br(){return""}checkbox({raw:i}){return i}},y=class fe{options;renderer;textRenderer;constructor(e){this.options=e||M,this.options.renderer=this.options.renderer||new ie,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Pe}static parse(e,t){return new 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 r=e[s];if(this.options.extensions?.renderers?.[r.type]){let o=r,a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(o.type)){t+=a||"";continue}}let n=r;switch(n.type){case"space":{t+=this.renderer.space(n);break}case"hr":{t+=this.renderer.hr(n);break}case"heading":{t+=this.renderer.heading(n);break}case"code":{t+=this.renderer.code(n);break}case"table":{t+=this.renderer.table(n);break}case"blockquote":{t+=this.renderer.blockquote(n);break}case"list":{t+=this.renderer.list(n);break}case"checkbox":{t+=this.renderer.checkbox(n);break}case"html":{t+=this.renderer.html(n);break}case"def":{t+=this.renderer.def(n);break}case"paragraph":{t+=this.renderer.paragraph(n);break}case"text":{t+=this.renderer.text(n);break}default:{let o='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let s="";for(let r=0;r<e.length;r++){let n=e[r];if(this.options.extensions?.renderers?.[n.type]){let a=this.options.extensions.renderers[n.type].call({parser:this},n);if(a!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(n.type)){s+=a||"";continue}}let o=n;switch(o.type){case"escape":{s+=t.text(o);break}case"html":{s+=t.html(o);break}case"link":{s+=t.link(o);break}case"image":{s+=t.image(o);break}case"checkbox":{s+=t.checkbox(o);break}case"strong":{s+=t.strong(o);break}case"em":{s+=t.em(o);break}case"codespan":{s+=t.codespan(o);break}case"br":{s+=t.br(o);break}case"del":{s+=t.del(o);break}case"text":{s+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return s}},F=class{options;block;constructor(i){this.options=i||M}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(i){return i}postprocess(i){return i}processAllTokens(i){return i}emStrongMask(i){return i}provideLexer(i=this.block){return i?v.lex:v.lexInline}provideParser(i=this.block){return i?y.parse:y.parseInline}},Ys=class{defaults=_e();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=y;Renderer=ie;TextRenderer=Pe;Lexer=v;Tokenizer=se;Hooks=F;constructor(...i){this.use(...i)}walkTokens(i,e){let t=[];for(let s of i)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let r=s;for(let n of r.header)t=t.concat(this.walkTokens(n.tokens,e));for(let n of r.rows)for(let o of n)t=t.concat(this.walkTokens(o.tokens,e));break}case"list":{let r=s;t=t.concat(this.walkTokens(r.items,e));break}default:{let r=s;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(n=>{let o=r[n].flat(1/0);t=t.concat(this.walkTokens(o,e))}):r.tokens&&(t=t.concat(this.walkTokens(r.tokens,e)))}}return t}use(...i){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return i.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let n=e.renderers[r.name];n?e.renderers[r.name]=function(...o){let a=r.renderer.apply(this,o);return a===!1&&(a=n.apply(this,o)),a}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let n=e[r.level];n?n.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),s.extensions=e),t.renderer){let r=this.defaults.renderer||new ie(this.defaults);for(let n in t.renderer){if(!(n in r))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let o=n,a=t.renderer[o],l=r[o];r[o]=(...c)=>{let p=a.apply(r,c);return p===!1&&(p=l.apply(r,c)),p||""}}s.renderer=r}if(t.tokenizer){let r=this.defaults.tokenizer||new se(this.defaults);for(let n in t.tokenizer){if(!(n in r))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let o=n,a=t.tokenizer[o],l=r[o];r[o]=(...c)=>{let p=a.apply(r,c);return p===!1&&(p=l.apply(r,c)),p}}s.tokenizer=r}if(t.hooks){let r=this.defaults.hooks||new F;for(let n in t.hooks){if(!(n in r))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let o=n,a=t.hooks[o],l=r[o];F.passThroughHooks.has(n)?r[o]=c=>{if(this.defaults.async&&F.passThroughHooksRespectAsync.has(n))return(async()=>{let h=await a.call(r,c);return l.call(r,h)})();let p=a.call(r,c);return l.call(r,p)}:r[o]=(...c)=>{if(this.defaults.async)return(async()=>{let h=await a.apply(r,c);return h===!1&&(h=await l.apply(r,c)),h})();let p=a.apply(r,c);return p===!1&&(p=l.apply(r,c)),p}}s.hooks=r}if(t.walkTokens){let r=this.defaults.walkTokens,n=t.walkTokens;s.walkTokens=function(o){let a=[];return a.push(n.call(this,o)),r&&(a=a.concat(r.call(this,o))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(i){return this.defaults={...this.defaults,...i},this}lexer(i,e){return v.lex(i,e??this.defaults)}parser(i,e){return y.parse(i,e??this.defaults)}parseMarkdown(i){return(e,t)=>{let s={...t},r={...this.defaults,...s},n=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&s.async===!1)return n(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return n(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return n(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=i),r.async)return(async()=>{let o=r.hooks?await r.hooks.preprocess(e):e,a=await(r.hooks?await r.hooks.provideLexer(i):i?v.lex:v.lexInline)(o,r),l=r.hooks?await r.hooks.processAllTokens(a):a;r.walkTokens&&await Promise.all(this.walkTokens(l,r.walkTokens));let c=await(r.hooks?await r.hooks.provideParser(i):i?y.parse:y.parseInline)(l,r);return r.hooks?await r.hooks.postprocess(c):c})().catch(n);try{r.hooks&&(e=r.hooks.preprocess(e));let o=(r.hooks?r.hooks.provideLexer(i):i?v.lex:v.lexInline)(e,r);r.hooks&&(o=r.hooks.processAllTokens(o)),r.walkTokens&&this.walkTokens(o,r.walkTokens);let a=(r.hooks?r.hooks.provideParser(i):i?y.parse:y.parseInline)(o,r);return r.hooks&&(a=r.hooks.postprocess(a)),a}catch(o){return n(o)}}}onError(i,e){return t=>{if(t.message+=`
150
+ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error occurred:</p><pre>"+_(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},I=new Ys;function x(i,e){return I.parse(i,e)}x.options=x.setOptions=function(i){return I.setOptions(i),x.defaults=I.defaults,pt(x.defaults),x};x.getDefaults=_e;x.defaults=M;function Js(...i){return I.use(...i),x.defaults=I.defaults,pt(x.defaults),x}x.use=Js;x.walkTokens=function(i,e){return I.walkTokens(i,e)};x.parseInline=I.parseInline;x.Parser=y;x.parser=y.parse;x.Renderer=ie;x.TextRenderer=Pe;x.Lexer=v;x.lexer=v.lex;x.Tokenizer=se;x.Hooks=F;x.parse=x;x.options;x.setOptions;x.walkTokens;x.parseInline;y.parse;v.lex;/**
151
+ * @license
152
+ * Copyright 2017 Google LLC
153
+ * SPDX-License-Identifier: BSD-3-Clause
154
+ */const Xs={CHILD:2},ei=i=>(...e)=>({_$litDirective$:i,values:e});class ti{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 ti{constructor(e){if(super(e),this.it=k,e.type!==Xs.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===k||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 si=ei(be),Xe="mem-bucket-detail-view-mode";class ii extends S{constructor(){super(...arguments),this._viewMode=localStorage.getItem(Xe)??"markdown"}static{this.properties={selected:{attribute:!1},onChanged:{attribute:!1},_doc:{state:!0},_viewMode:{state:!0}}}static{this.styles=W`
159
+ :host { display: block; padding: 16px; }
160
+ h2 { margin: 0 0 4px; font-size: 16px; }
161
+ .meta { font-size: 12px; opacity: 0.7; margin-bottom: 12px; }
162
+ .source-path {
163
+ font-family: monospace;
164
+ font-size: 11px;
165
+ opacity: 0.6;
166
+ cursor: pointer;
167
+ word-break: break-all;
168
+ }
169
+ pre {
170
+ white-space: pre-wrap;
171
+ font-size: 12px;
172
+ background: var(--bg-subtle);
173
+ padding: 12px;
174
+ border-radius: 6px;
175
+ max-height: 60vh;
176
+ overflow-y: auto;
177
+ }
178
+ .empty { opacity: 0.5; font-size: 13px; }
179
+ .view-toggle {
180
+ display: flex;
181
+ gap: 4px;
182
+ margin-bottom: 8px;
183
+ }
184
+ .view-toggle button {
185
+ font-size: 11px;
186
+ padding: 3px 8px;
187
+ border: 1px solid var(--border);
188
+ background: transparent;
189
+ border-radius: 4px;
190
+ cursor: pointer;
191
+ opacity: 0.6;
192
+ }
193
+ .view-toggle button.active {
194
+ opacity: 1;
195
+ background: var(--hover);
196
+ font-weight: 600;
197
+ }
198
+ .markdown-body {
199
+ font-size: 13px;
200
+ line-height: 1.5;
201
+ max-height: 60vh;
202
+ overflow-y: auto;
203
+ padding: 12px;
204
+ background: var(--bg-subtle);
205
+ border-radius: 6px;
206
+ }
207
+ .markdown-body :first-child { margin-top: 0; }
208
+ .markdown-body :last-child { margin-bottom: 0; }
209
+ .markdown-body pre {
210
+ background: var(--hover);
211
+ max-height: none;
212
+ }
213
+ .markdown-body code {
214
+ font-family: monospace;
215
+ font-size: 12px;
216
+ }
217
+ .actions {
218
+ display: flex;
219
+ gap: 8px;
220
+ margin-bottom: 12px;
221
+ }
222
+ .actions button {
223
+ font-size: 11px;
224
+ padding: 4px 10px;
225
+ border: 1px solid var(--border);
226
+ background: transparent;
227
+ color: inherit;
228
+ border-radius: 4px;
229
+ cursor: pointer;
230
+ }
231
+ .actions button.danger {
232
+ border-color: var(--danger);
233
+ color: var(--danger);
234
+ }
235
+ `}updated(e){e.has("selected")&&this.selected&&(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(Xe,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#o(){if(!window.confirm("Delete this doc? This can't be undone."))return;const{table:e,id:t}=this.selected;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"DELETE"}),this._doc=null,this.onChanged?.()}render(){if(!this.selected)return d`<div class="empty">Select an entry to view its details.</div>`;if(!this._doc)return k;const e=this._doc,t=this.selected.table==="skills"&&e.root==="builtin";return d`
236
+ <h2>${e.name??e.key??e.id}</h2>
237
+ <div class="meta">
238
+ ${e.tags?.join(", ")||"no tags"} · ${e.status}${e.owner?` · owner: ${e.owner}`:""}
239
+ ${e.deprecated?" · deprecated":""}${e.paused?" · paused":""} · created
240
+ ${e.created_at?e.created_at.slice(0,10):"unknown"}
241
+ </div>
242
+ <div class="meta">${e.description}</div>
243
+ ${t?k:d`
244
+ <div class="actions">
245
+ <button @click=${()=>this.#i()}>${e.deprecated?"Un-deprecate":"Mark deprecated"}</button>
246
+ <button @click=${()=>this.#r()}>${e.paused?"Resume":"Pause"}</button>
247
+ <button class="danger" @click=${()=>this.#o()}>Delete</button>
248
+ </div>
249
+ `}
250
+ <div class="view-toggle">
251
+ <button
252
+ class=${this._viewMode==="markdown"?"active":""}
253
+ @click=${()=>this.#s("markdown")}
254
+ >
255
+ Preview
256
+ </button>
257
+ <button
258
+ class=${this._viewMode==="raw"?"active":""}
259
+ @click=${()=>this.#s("raw")}
260
+ >
261
+ Raw
262
+ </button>
263
+ </div>
264
+ ${this._viewMode==="markdown"?d`<div class="markdown-body">${si(x.parse(e.body??"",{async:!1}))}</div>`:d`<pre>${e.body}</pre>`}
265
+ <div class="source-path" title="click to copy" @click=${()=>this.#t()}>${e.source_path}</div>
266
+ `}}customElements.define("detail-panel",ii);class ri 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("");#o=new u("");#a=new u("");#l=new u(!1);#h=new u(!1);static{this.styles=W`
267
+ :host { display: block; }
268
+ .backdrop {
269
+ position: fixed; inset: 0; background: var(--overlay);
270
+ display: flex; align-items: center; justify-content: center; z-index: 100;
271
+ }
272
+ .modal {
273
+ background: var(--bg);
274
+ color: inherit;
275
+ border-radius: 10px;
276
+ width: min(560px, 92vw);
277
+ max-height: 82vh;
278
+ display: flex;
279
+ flex-direction: column;
280
+ box-shadow: 0 8px 40px var(--shadow);
281
+ border: 1px solid var(--border);
282
+ }
283
+ .header { padding: 16px 20px 8px; }
284
+ h2 { margin: 0; font-size: 16px; }
285
+ .kind-toggle { display: flex; gap: 8px; padding: 0 20px 12px; }
286
+ .kind-toggle button {
287
+ flex: 1; padding: 8px; border: 1px solid var(--border-strong); background: none; color: inherit;
288
+ border-radius: 6px; cursor: pointer; font-size: 13px;
289
+ }
290
+ .kind-toggle button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
291
+ .breadcrumb-row {
292
+ padding: 8px 20px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
293
+ }
294
+ .breadcrumb {
295
+ font-size: 12px; opacity: 0.7; font-family: monospace;
296
+ word-break: break-all;
297
+ }
298
+ .hidden-toggle {
299
+ font-size: 11px; opacity: 0.7; display: flex; align-items: center; gap: 4px;
300
+ cursor: pointer; white-space: nowrap; user-select: none;
301
+ }
302
+ .browser {
303
+ flex: 1; overflow-y: auto; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
304
+ min-height: 200px;
305
+ }
306
+ .entry {
307
+ padding: 8px 20px; cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 8px;
308
+ }
309
+ .entry:hover { background: var(--hover); }
310
+ .entry .icon { opacity: 0.6; }
311
+ .up { opacity: 0.7; }
312
+ .empty { padding: 16px 20px; opacity: 0.6; font-size: 13px; }
313
+ .footer { padding: 14px 20px; display: flex; flex-direction: column; gap: 10px; }
314
+ .selected-row { font-size: 12px; }
315
+ .selected-row .path { font-family: monospace; opacity: 0.85; word-break: break-all; }
316
+ label { font-size: 12px; opacity: 0.7; display: block; margin-bottom: 4px; }
317
+ input[type='text'] {
318
+ width: 100%; box-sizing: border-box; padding: 7px 9px; font-size: 13px;
319
+ border: 1px solid var(--border-strong); border-radius: 6px; background: none; color: inherit;
320
+ }
321
+ .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
322
+ button.primary {
323
+ background: var(--accent); border: 1px solid var(--accent); color: var(--accent-fg); padding: 7px 16px;
324
+ border-radius: 6px; cursor: pointer; font-size: 13px;
325
+ }
326
+ button.primary:disabled { opacity: 0.5; cursor: default; }
327
+ button.secondary {
328
+ background: none; border: 1px solid var(--border-strong); color: inherit; padding: 7px 16px;
329
+ border-radius: 6px; cursor: pointer; font-size: 13px;
330
+ }
331
+ .error { color: var(--danger); font-size: 12px; }
332
+ `}constructor(){super(),new we(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#e.set(this.defaultKind),this.#c()}async#c(e){const t=new URLSearchParams;e&&t.set("path",e),this.#h.value&&t.set("hidden","1");const s=await fetch(`/api/fs/list?${t.toString()}`);if(!s.ok){this.#a.set((await s.json()).error??"failed to list directory");return}const r=await s.json();this.#t.set(r.path),this.#i.set(r.parent),this.#s.set(r.entries),this.#a.set("")}#u(){this.#h.set(!this.#h.value),this.#c(this.#t.value)}#d(){this.#r.set(this.#t.value),this.#o.value||this.#o.set(this.#t.value.split("/").filter(Boolean).pop()??"")}async#g(){const e=this.#r.value||this.#t.value;if(e){this.#l.set(!0),this.#a.set("");try{const t=await fetch("/api/roots",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#o.value||void 0,path:e})}),s=await t.json();if(!t.ok){this.#a.set(s.error??"failed to add root");return}this.onAdded()}finally{this.#l.set(!1)}}}render(){const e=this.#s.value;return d`
333
+ <div class="backdrop" @click=${t=>t.target===t.currentTarget&&this.onCancel()}>
334
+ <div class="modal">
335
+ <div class="header"><h2>Add a root</h2></div>
336
+ ${this.lockKind?d``:d`
337
+ <div class="kind-toggle">
338
+ <button
339
+ class=${this.#e.value==="skill"?"active":""}
340
+ @click=${()=>this.#e.set("skill")}
341
+ >
342
+ Skill root
343
+ </button>
344
+ <button
345
+ class=${this.#e.value==="memory"?"active":""}
346
+ @click=${()=>this.#e.set("memory")}
347
+ >
348
+ Memory root
349
+ </button>
350
+ </div>
351
+ `}
352
+ <div class="breadcrumb-row">
353
+ <div class="breadcrumb">${this.#t.value}</div>
354
+ <label class="hidden-toggle">
355
+ <input type="checkbox" .checked=${this.#h.value} @change=${()=>this.#u()} />
356
+ Show hidden
357
+ </label>
358
+ </div>
359
+ <div class="browser">
360
+ ${this.#i.value?d`<div class="entry up" @click=${()=>this.#c(this.#i.value)}>
361
+ <span class="icon">📁</span> ..
362
+ </div>`:""}
363
+ ${e.length===0&&!this.#i.value?d`<div class="empty">No subdirectories here.</div>`:e.map(t=>d`<div class="entry" @click=${()=>this.#c(t.path)}>
364
+ <span class="icon">📁</span> ${t.name}
365
+ </div>`)}
366
+ </div>
367
+ <div class="footer">
368
+ <button class="secondary" @click=${()=>this.#d()}>
369
+ Select this folder
370
+ </button>
371
+ ${this.#r.value?d`<div class="selected-row">Selected: <span class="path">${this.#r.value}</span></div>`:""}
372
+ <div>
373
+ <label>Root name</label>
374
+ <input
375
+ type="text"
376
+ .value=${this.#o.value}
377
+ placeholder="e.g. personal, company"
378
+ @input=${t=>this.#o.set(t.target.value)}
379
+ />
380
+ </div>
381
+ ${this.#a.value?d`<div class="error">${this.#a.value}</div>`:""}
382
+ <div class="actions">
383
+ <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
384
+ <button
385
+ class="primary"
386
+ ?disabled=${!this.#r.value||this.#l.value}
387
+ @click=${()=>this.#g()}
388
+ >
389
+ ${this.#l.value?"Adding…":"Add root"}
390
+ </button>
391
+ </div>
392
+ </div>
393
+ </div>
394
+ </div>
395
+ `}}customElements.define("add-root-modal",ri);let et=0;class ni extends S{static{this.properties={tags:{attribute:!1},active:{attribute:!1},onToggle:{attribute:!1}}}#e=new u("");#t=new u(!1);#s=new u(-1);#i;#r;static{this.styles=W`
396
+ :host {
397
+ display: inline-block;
398
+ position: relative;
399
+ width: 260px;
400
+ font: inherit;
401
+ font-size: 13px;
402
+ }
403
+ .field {
404
+ display: flex;
405
+ align-items: center;
406
+ flex-wrap: wrap;
407
+ gap: 4px;
408
+ border: 1px solid var(--border-strong);
409
+ border-radius: 6px;
410
+ background: none;
411
+ padding: 3px 4px 3px 8px;
412
+ min-height: 30px;
413
+ box-sizing: border-box;
414
+ }
415
+ .field:focus-within {
416
+ border-color: var(--accent);
417
+ box-shadow: 0 0 0 2px var(--accent-tint);
418
+ }
419
+ .selected-chip {
420
+ display: inline-flex;
421
+ align-items: center;
422
+ gap: 4px;
423
+ background: var(--accent);
424
+ color: var(--accent-fg);
425
+ border-radius: 999px;
426
+ padding: 2px 6px 2px 10px;
427
+ font-size: 12px;
428
+ white-space: nowrap;
429
+ }
430
+ .selected-chip .remove {
431
+ cursor: pointer;
432
+ opacity: 0.85;
433
+ line-height: 1;
434
+ padding: 2px;
435
+ border-radius: 50%;
436
+ }
437
+ .selected-chip .remove:hover { opacity: 1; background: #ffffff33; }
438
+ .input {
439
+ flex: 1 1 60px;
440
+ min-width: 60px;
441
+ border: none;
442
+ outline: none;
443
+ padding: 5px 2px;
444
+ font: inherit;
445
+ font-size: 13px;
446
+ background: transparent;
447
+ color: inherit;
448
+ }
449
+ .clear-btn, .chevron-btn {
450
+ border: none;
451
+ background: transparent;
452
+ cursor: pointer;
453
+ color: inherit;
454
+ opacity: 0.6;
455
+ font-size: 12px;
456
+ padding: 2px 5px;
457
+ line-height: 1;
458
+ }
459
+ .clear-btn:hover, .chevron-btn:hover { opacity: 1; }
460
+ .chevron-btn { transition: transform 0.15s ease; }
461
+ .chevron-btn.open { transform: rotate(180deg); }
462
+
463
+ .menu {
464
+ position: fixed;
465
+ margin: 0;
466
+ inset: auto;
467
+ top: anchor(bottom);
468
+ left: anchor(left);
469
+ width: anchor-size(width);
470
+ position-try-fallbacks: flip-block;
471
+ list-style: none;
472
+ padding: 4px;
473
+ margin: 0;
474
+ border: 1px solid var(--border);
475
+ border-radius: 8px;
476
+ background: var(--bg);
477
+ color: inherit;
478
+ box-shadow: 0 8px 24px var(--shadow);
479
+ max-height: 260px;
480
+ overflow-y: auto;
481
+ box-sizing: border-box;
482
+ }
483
+ .menu:popover-open { margin-top: 4px; }
484
+ .menu[popover] { display: none; }
485
+ .menu.visible[popover] { display: block; }
486
+
487
+ .option {
488
+ display: flex;
489
+ align-items: center;
490
+ gap: 8px;
491
+ padding: 6px 8px;
492
+ border-radius: 5px;
493
+ cursor: pointer;
494
+ font-size: 13px;
495
+ }
496
+ .option:hover, .option.highlighted { background: var(--hover); }
497
+ .option input { margin: 0; pointer-events: none; }
498
+ .empty { padding: 6px 8px; opacity: 0.6; font-style: italic; font-size: 12px; }
499
+ `}constructor(){super(),new we(this),this.tags=[],this.active=[],this.onToggle=()=>{},this.#i=`--tag-multiselect-${++et}`,this.#r=`tag-multiselect-listbox-${et}`}#o=e=>{e.composedPath().includes(this)||this.#h()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#o)}disconnectedCallback(){document.removeEventListener("click",this.#o),super.disconnectedCallback()}get#a(){const e=this.#e.value.trim().toLowerCase();return e?this.tags.filter(t=>t.toLowerCase().includes(e)):this.tags}#l(){this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#h(){this.#t.set(!1),this.#s.set(-1),this.renderRoot.querySelector(".menu")?.hidePopover()}#c(){this.#t.value?this.#h():(this.#l(),this.renderRoot.querySelector(".input")?.focus())}#u(e){this.#e.set(e.target.value),this.#s.set(-1),this.#l()}#d(e){this.onToggle(e),this.#e.set(""),this.#s.set(-1)}#g(e){e.stopPropagation(),this.active.forEach(t=>this.onToggle(t)),this.#e.set(""),this.renderRoot.querySelector(".input")?.focus(),this.#l()}#x(e){const t=this.#a;if(e.key==="ArrowDown")e.preventDefault(),this.#l(),t.length&&this.#s.set((this.#s.value+1)%t.length);else if(e.key==="ArrowUp")e.preventDefault(),this.#l(),t.length&&this.#s.set((this.#s.value-1+t.length)%t.length);else if(e.key==="Enter"){const s=t[this.#s.value];s!==void 0&&(e.preventDefault(),this.#d(s))}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.#h()}render(){const e=this.active,t=this.#a,s=this.#t.value,r=this.#s.value;return d`
500
+ <div class="field" style=${`anchor-name: ${this.#i}`}>
501
+ ${e.map(n=>d`
502
+ <span class="selected-chip">
503
+ ${n}
504
+ <span class="remove" @click=${()=>this.onToggle(n)}>✕</span>
505
+ </span>
506
+ `)}
507
+ <input
508
+ class="input"
509
+ role="combobox"
510
+ aria-autocomplete="list"
511
+ aria-expanded=${s}
512
+ aria-controls=${this.#r}
513
+ aria-activedescendant=${r>=0?`${this.#r}-opt-${r}`:""}
514
+ placeholder=${e.length===0?"Filter by tag…":""}
515
+ .value=${this.#e.value}
516
+ @input=${n=>this.#u(n)}
517
+ @focus=${()=>this.#l()}
518
+ @click=${()=>this.#l()}
519
+ @keydown=${n=>this.#x(n)}
520
+ />
521
+ ${e.length>0?d`<button class="clear-btn" tabindex="-1" @mousedown=${n=>n.preventDefault()} @click=${n=>this.#g(n)}>✕</button>`:""}
522
+ <button
523
+ class="chevron-btn ${s?"open":""}"
524
+ tabindex="-1"
525
+ @mousedown=${n=>n.preventDefault()}
526
+ @click=${()=>this.#c()}
527
+ >
528
+
529
+ </button>
530
+ </div>
531
+
532
+ <ul
533
+ id=${this.#r}
534
+ class="menu ${s?"visible":""}"
535
+ role="listbox"
536
+ aria-multiselectable="true"
537
+ popover="manual"
538
+ style=${`position-anchor: ${this.#i}`}
539
+ >
540
+ ${t.length?t.map((n,o)=>d`
541
+ <li
542
+ id=${`${this.#r}-opt-${o}`}
543
+ role="option"
544
+ aria-selected=${e.includes(n)}
545
+ class=${o===r?"option highlighted":"option"}
546
+ @mousedown=${a=>a.preventDefault()}
547
+ @click=${()=>this.#d(n)}
548
+ >
549
+ <input type="checkbox" .checked=${e.includes(n)} tabindex="-1" />
550
+ ${n}
551
+ </li>
552
+ `):d`<li class="empty">No matches</li>`}
553
+ </ul>
554
+ `}}customElements.define("tag-multiselect",ni);const oi=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],tt=[{value:"all",label:"Show all"},{value:"hide",label:"Hide"},{value:"only",label:"Only"}],ai={tags:[],statuses:[],owners:[],doc_types:[],key_types:[],roots:[]},li={skill:[],memory:[]},vt="mem-bucket-split-pct",yt=20,wt=80;function ci(){const i=Number(localStorage.getItem(vt));return Number.isFinite(i)&&i>=yt&&i<=wt?i:40}const _t="mem-bucket-theme",he=["system","light","dark"],hi={system:"◐",light:"☀",dark:"☾"},pi={system:"Auto",light:"Light",dark:"Dark"};function ui(){const i=localStorage.getItem(_t);return i==="light"||i==="dark"?i:"system"}function st(i){i==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",i)}function di(){const i=location.hash.slice(1);if(!i)return{};const e=new URLSearchParams(i),t={},s=e.get("q");s&&(t.query=s);const r=e.get("type");(r==="skill"||r==="memory"||r==="all")&&(t.typeFilter=r);const n=e.getAll("tag");n.length&&(t.activeTags=n);const o=e.getAll("root");o.length&&(t.activeRoots=o);const a=e.get("sort");a&&(t.sort=a);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 p=e.get("date_from");p&&(t.dateFrom=p);const h=e.get("date_to");return h&&(t.dateTo=h),t}class gi extends S{static{this.styles=W`
555
+ :host { display: flex; flex-direction: column; height: 100vh; }
556
+ .theme-toggle {
557
+ position: fixed;
558
+ top: 10px;
559
+ right: 12px;
560
+ z-index: 10;
561
+ width: 28px;
562
+ height: 28px;
563
+ border: 1px solid var(--border-strong);
564
+ border-radius: 50%;
565
+ background: var(--bg);
566
+ color: inherit;
567
+ cursor: pointer;
568
+ font-size: 14px;
569
+ line-height: 1;
570
+ display: flex;
571
+ align-items: center;
572
+ justify-content: center;
573
+ opacity: 0.75;
574
+ }
575
+ .theme-toggle:hover { opacity: 1; background: var(--hover); }
576
+ .filters {
577
+ padding: 12px 16px;
578
+ border-bottom: 1px solid var(--border);
579
+ display: flex;
580
+ flex-direction: column;
581
+ gap: 8px;
582
+ }
583
+ .search-field {
584
+ position: relative;
585
+ flex: 1 1 240px;
586
+ max-width: 480px;
587
+ }
588
+ .filters input[type='search'] {
589
+ font-size: 13px;
590
+ padding: 6px 28px 6px 10px;
591
+ width: 100%;
592
+ box-sizing: border-box;
593
+ border: 1px solid var(--border-strong);
594
+ border-radius: 6px;
595
+ background: none;
596
+ color: inherit;
597
+ height: 30px;
598
+ }
599
+ .filters input[type='search']::-webkit-search-cancel-button { display: none; }
600
+ .search-clear-btn {
601
+ position: absolute;
602
+ right: 4px;
603
+ top: 50%;
604
+ transform: translateY(-50%);
605
+ border: none;
606
+ background: transparent;
607
+ cursor: pointer;
608
+ color: inherit;
609
+ opacity: 0.6;
610
+ font-size: 12px;
611
+ line-height: 1;
612
+ padding: 4px 6px;
613
+ border-radius: 50%;
614
+ }
615
+ .search-clear-btn:hover { opacity: 1; background: var(--hover); }
616
+ .date-range { display: flex; align-items: center; gap: 4px; }
617
+ .date-range input[type='date'] {
618
+ font-size: 13px;
619
+ padding: 5px 8px;
620
+ border: 1px solid var(--border-strong);
621
+ border-radius: 6px;
622
+ background: none;
623
+ color: inherit;
624
+ height: 30px;
625
+ box-sizing: border-box;
626
+ }
627
+ .date-range-sep { opacity: 0.5; font-size: 12px; }
628
+ .date-range-clear {
629
+ position: static;
630
+ transform: none;
631
+ opacity: 0.6;
632
+ font-size: 12px;
633
+ line-height: 1;
634
+ padding: 4px 6px;
635
+ border: none;
636
+ background: transparent;
637
+ cursor: pointer;
638
+ color: inherit;
639
+ border-radius: 50%;
640
+ }
641
+ .date-range-clear:hover { opacity: 1; background: var(--hover); }
642
+ .search-row { align-items: center; }
643
+ .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
644
+ .filter-label { font-size: 12px; opacity: 0.6; font-weight: 600; }
645
+ .type-toggle { gap: 0; }
646
+ .type-toggle button {
647
+ border: 1px solid var(--border-strong);
648
+ background: none;
649
+ color: inherit;
650
+ padding: 6px 12px;
651
+ font-size: 13px;
652
+ cursor: pointer;
653
+ height: 30px;
654
+ box-sizing: border-box;
655
+ }
656
+ .type-toggle button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
657
+ .type-toggle button:first-child { border-radius: 6px 0 0 6px; }
658
+ .type-toggle button:last-child { border-radius: 0 6px 6px 0; }
659
+ .type-toggle button:not(:first-child) { border-left: none; }
660
+ .body-region { display: flex; flex: 1 1 auto; min-height: 0; }
661
+ result-list { overflow-y: auto; flex: 0 0 auto; }
662
+ detail-panel { overflow-y: auto; flex: 1 1 auto; min-width: 0; }
663
+ .splitter {
664
+ flex: 0 0 auto;
665
+ width: 6px;
666
+ cursor: col-resize;
667
+ background: var(--hover);
668
+ position: relative;
669
+ }
670
+ .splitter:hover, .splitter.dragging { background: var(--accent-tint); }
671
+ .splitter::after {
672
+ content: '';
673
+ position: absolute;
674
+ top: 0; bottom: 0;
675
+ left: -3px; right: -3px;
676
+ }
677
+ label.small { font-size: 12px; opacity: 0.7; }
678
+ .roots-bar {
679
+ display: flex;
680
+ gap: 6px;
681
+ align-items: center;
682
+ flex-wrap: wrap;
683
+ padding: 10px 16px;
684
+ border-bottom: 1px solid var(--border);
685
+ background: var(--bg-subtle);
686
+ }
687
+ .root-chip {
688
+ border: 1px solid var(--border-strong); border-radius: 999px; padding: 3px 8px 3px 10px; font-size: 12px;
689
+ cursor: pointer; background: none; color: inherit; display: inline-flex; align-items: center; gap: 6px;
690
+ }
691
+ .root-chip.active { background: var(--purple-tint); border-color: var(--purple); color: var(--purple-fg); }
692
+ .root-chip .remove {
693
+ opacity: 0.6; font-size: 12px; line-height: 1; padding: 2px; border-radius: 50%;
694
+ }
695
+ .root-chip .remove:hover { opacity: 1; background: var(--hover-strong); }
696
+ .add-root-btn {
697
+ border: 1px dashed var(--border-strong); border-radius: 999px; padding: 3px 10px; font-size: 12px;
698
+ cursor: pointer; background: none; color: inherit; opacity: 0.75;
699
+ }
700
+ .add-root-btn:hover { opacity: 1; }
701
+ .first-run {
702
+ display: flex; flex-direction: column; align-items: center; justify-content: center;
703
+ flex: 1 1 auto; gap: 16px; text-align: center; padding: 24px;
704
+ }
705
+ .first-run h1 { font-size: 18px; margin: 0; }
706
+ .first-run p { opacity: 0.7; font-size: 13px; max-width: 420px; margin: 0; }
707
+ select {
708
+ font-size: 13px;
709
+ padding: 6px 8px;
710
+ height: 30px;
711
+ box-sizing: border-box;
712
+ border: 1px solid var(--border-strong);
713
+ border-radius: 6px;
714
+ background: none;
715
+ color: inherit;
716
+ }
717
+ .bulk-bar {
718
+ display: flex;
719
+ gap: 8px;
720
+ align-items: center;
721
+ padding: 6px 16px;
722
+ border-bottom: 1px solid var(--border);
723
+ background: var(--accent-tint);
724
+ font-size: 12px;
725
+ }
726
+ .bulk-bar button {
727
+ font-size: 11px;
728
+ padding: 4px 10px;
729
+ border: 1px solid var(--border);
730
+ background: transparent;
731
+ color: inherit;
732
+ border-radius: 4px;
733
+ cursor: pointer;
734
+ }
735
+ .bulk-bar button.danger { border-color: var(--danger); color: var(--danger); }
736
+ `}#e=di();#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??[]);#o=new u([]);#a=new u(ai);#l=new u(null);#h=new u(li);#c=new u(!1);#u=new u("");#d=new u(!1);#g=new u(ci());#x=new u(!1);#m=new u(this.#e.sort??"mtime_desc");#k=new u(this.#e.deprecatedFilter??"all");#$=new u(this.#e.pausedFilter??"all");#f=new u(this.#e.dateFrom??"");#b=new u(this.#e.dateTo??"");#p=new u(new Set);#v=new u(ui());#S=e=>this.#I(e);#A=()=>this.#M();constructor(){super(),new we(this),st(this.#v.value)}#P(e){this.#v.set(e),localStorage.setItem(_t,e),st(e)}#z(){const e=he[(he.indexOf(this.#v.value)+1)%he.length];this.#P(e)}#L(e){e.preventDefault(),this.#x.set(!0),document.addEventListener("pointermove",this.#S),document.addEventListener("pointerup",this.#A)}#I(e){const t=this.renderRoot.querySelector(".body-region");if(!t)return;const s=t.getBoundingClientRect(),r=(e.clientX-s.left)/s.width*100;this.#g.set(Math.min(wt,Math.max(yt,r)))}#M(){this.#x.set(!1),document.removeEventListener("pointermove",this.#S),document.removeEventListener("pointerup",this.#A),localStorage.setItem(vt,String(this.#g.value))}#O=new Xt(()=>{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.#m.value!=="mtime_desc"&&e.set("sort",this.#m.value),this.#k.value==="hide"?e.set("deprecated","0"):this.#k.value==="only"&&e.set("deprecated","1"),this.#$.value==="hide"?e.set("paused","0"):this.#$.value==="only"&&e.set("paused","1"),this.#f.value&&e.set("date_from",this.#f.value),this.#b.value&&e.set("date_to",this.#b.value),e.toString()});connectedCallback(){super.connectedCallback(),this.#n(),this.#y(),this.#w()}async#n(){const e=this.#O.value;history.replaceState(null,"",e?`#${e}`:location.pathname+location.search);const t=await fetch(`/api/entries?${e}`);this.#o.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.#a.set(await t.json())}async#w(){const e=await fetch("/api/roots");this.#h.set(await e.json()),this.#d.set(!0)}#D(e){const t=this.#r.value;this.#r.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#n()}async#N(e,t){if(t.stopPropagation(),window.prompt(`Type "${e.name}" to remove this ${e.kind} root (files on disk are untouched):`)===e.name){this.#u.set(e.name);try{await fetch(`/api/roots/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"}),this.#r.set(this.#r.value.filter(r=>r!==e.name)),await Promise.all([this.#w(),this.#y(),this.#n()])}finally{this.#u.set("")}}}#T(){this.#c.set(!1),this.#w(),this.#y(),this.#n()}#q(){return[...this.#h.value.skill,...this.#h.value.memory]}#U(e){this.#s.set(e),this.#i.set([]),this.#y(),this.#n()}#H(e){const t=this.#i.value;this.#i.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#n()}#B(e){this.#t.set(e.target.value),this.#n()}#j(){this.#t.set(""),this.#n()}#F(e){this.#l.set({table:e._table,id:e.id})}#Z(e){this.#m.set(e.target.value),this.#n()}#Q(e){this.#k.set(e.target.value),this.#n()}#K(e){this.#$.set(e.target.value),this.#n()}#W(e){this.#f.set(e.target.value),this.#n()}#V(e){this.#b.set(e.target.value),this.#n()}#G(){this.#f.set(""),this.#b.set(""),this.#n()}#Y(e){const t=new Set(this.#p.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#p.set(t)}#J(){return new Map(this.#o.value.map(e=>[e.id,e]))}#_(){const e=new Map,t=this.#J();for(const s of this.#p.value){const r=t.get(s);if(!r)continue;const n=e.get(r._table)??[];n.push(s),e.set(r._table,n)}return e}async#R(e){const t=this.#_();await Promise.all([...t.entries()].map(([s,r])=>fetch(`/api/entries/${s}/bulk/deprecated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:r,deprecated:e})}))),this.#p.set(new Set),await this.#n()}async#E(e){const t=this.#_();await Promise.all([...t.entries()].map(([s,r])=>fetch(`/api/entries/${s}/bulk/paused`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:r,paused:e})}))),this.#p.set(new Set),await this.#n()}async#X(){if(!window.confirm(`Delete ${this.#p.value.size} doc(s)? This can't be undone.`))return;const e=this.#_();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.#p.set(new Set),await this.#n()}#C(){const e=this.#v.value;return d`
737
+ <button
738
+ class="theme-toggle"
739
+ title=${`Theme: ${pi[e]} (click to change)`}
740
+ aria-label="Toggle color theme"
741
+ @click=${()=>this.#z()}
742
+ >
743
+ ${hi[e]}
744
+ </button>
745
+ `}render(){const e=this.#a.value,t=this.#q();return this.#d.value&&t.length===0&&!this.#c.value?d`
746
+ ${this.#C()}
747
+ <div class="first-run">
748
+ <h1>No roots configured yet</h1>
749
+ <p>
750
+ Add a folder of skills or memory docs to get started. You can add more roots later —
751
+ e.g. a personal skills repo plus a shared company repo.
752
+ </p>
753
+ <button class="add-root-btn" @click=${()=>this.#c.set(!0)}>+ Add your first root</button>
754
+ </div>
755
+ ${this.#c.value?d`<add-root-modal
756
+ .defaultKind=${"skill"}
757
+ .lockKind=${!1}
758
+ .onAdded=${()=>this.#T()}
759
+ .onCancel=${()=>this.#c.set(!1)}
760
+ ></add-root-modal>`:""}
761
+ `:d`
762
+ ${this.#C()}
763
+ <div class="roots-bar">
764
+ <span class="filter-label">Roots:</span>
765
+ ${t.map(s=>d`
766
+ <button
767
+ class="root-chip ${this.#r.value.includes(s.name)?"active":""}"
768
+ title=${s.path}
769
+ @click=${()=>this.#D(s.name)}
770
+ >
771
+ ${s.name}
772
+ <span
773
+ class="remove"
774
+ title="Remove root"
775
+ @click=${r=>this.#N(s,r)}
776
+ >${this.#u.value===s.name?"…":"✕"}</span
777
+ >
778
+ </button>
779
+ `)}
780
+ <button class="add-root-btn" @click=${()=>this.#c.set(!0)}>+ Add root</button>
781
+ </div>
782
+ <div class="filters">
783
+ <div class="row search-row">
784
+ <div class="search-field">
785
+ <input
786
+ type="search"
787
+ placeholder="Search descriptions, bodies, tags..."
788
+ .value=${this.#t.value}
789
+ @input=${s=>this.#B(s)}
790
+ />
791
+ ${this.#t.value?d`
792
+ <button
793
+ class="search-clear-btn"
794
+ title="Clear search"
795
+ aria-label="Clear search"
796
+ @click=${()=>this.#j()}
797
+ >
798
+
799
+ </button>
800
+ `:""}
801
+ </div>
802
+ <div class="row type-toggle">
803
+ ${oi.map(s=>d`
804
+ <button
805
+ class=${this.#s.value===s.value?"active":""}
806
+ @click=${()=>this.#U(s.value)}
807
+ >
808
+ ${s.label}
809
+ </button>
810
+ `)}
811
+ </div>
812
+ ${e.tags.length===0?d`<span class="filter-label">Tags:</span> <label class="small">no tags yet</label>`:d`
813
+ <tag-multiselect
814
+ .tags=${e.tags}
815
+ .active=${this.#i.value}
816
+ .onToggle=${s=>this.#H(s)}
817
+ ></tag-multiselect>
818
+ `}
819
+ <span class="filter-label">Dates:</span>
820
+ <div class="date-range">
821
+ <input
822
+ type="date"
823
+ aria-label="From date"
824
+ .value=${this.#f.value}
825
+ @change=${s=>this.#W(s)}
826
+ />
827
+ <span class="date-range-sep">–</span>
828
+ <input
829
+ type="date"
830
+ aria-label="To date"
831
+ .value=${this.#b.value}
832
+ @change=${s=>this.#V(s)}
833
+ />
834
+ ${this.#f.value||this.#b.value?d`
835
+ <button
836
+ class="date-range-clear"
837
+ title="Clear date range"
838
+ aria-label="Clear date range"
839
+ @click=${()=>this.#G()}
840
+ >
841
+
842
+ </button>
843
+ `:""}
844
+ </div>
845
+ <span class="filter-label">Sort:</span>
846
+ <select .value=${this.#m.value} @change=${s=>this.#Z(s)}>
847
+ <option value="mtime_desc">Recently touched</option>
848
+ <option value="mtime_asc">Least recently touched</option>
849
+ <option value="created_at_asc">Oldest first</option>
850
+ <option value="name_asc">Name</option>
851
+ </select>
852
+ <span class="filter-label">Deprecated:</span>
853
+ <select .value=${this.#k.value} @change=${s=>this.#Q(s)}>
854
+ ${tt.map(s=>d`<option value=${s.value}>${s.label}</option>`)}
855
+ </select>
856
+ <span class="filter-label">Paused:</span>
857
+ <select .value=${this.#$.value} @change=${s=>this.#K(s)}>
858
+ ${tt.map(s=>d`<option value=${s.value}>${s.label}</option>`)}
859
+ </select>
860
+ </div>
861
+ </div>
862
+ ${this.#p.value.size>0?d`
863
+ <div class="bulk-bar">
864
+ <span>${this.#p.value.size} selected</span>
865
+ <button @click=${()=>this.#R(!0)}>Mark deprecated</button>
866
+ <button @click=${()=>this.#R(!1)}>Un-deprecate</button>
867
+ <button @click=${()=>this.#E(!0)}>Pause</button>
868
+ <button @click=${()=>this.#E(!1)}>Resume</button>
869
+ <button class="danger" @click=${()=>this.#X()}>Delete</button>
870
+ <button @click=${()=>this.#p.set(new Set)}>Clear</button>
871
+ </div>
872
+ `:""}
873
+ <div class="body-region">
874
+ <result-list
875
+ style=${`width: ${this.#g.value}%; border-right: 1px solid var(--border);`}
876
+ .results=${this.#o.value}
877
+ .showRoot=${t.length>1}
878
+ .onSelect=${s=>this.#F(s)}
879
+ .selectedIds=${this.#p.value}
880
+ .onToggleSelect=${s=>this.#Y(s)}
881
+ ></result-list>
882
+ <div
883
+ class="splitter ${this.#x.value?"dragging":""}"
884
+ @pointerdown=${s=>this.#L(s)}
885
+ ></div>
886
+ <detail-panel .selected=${this.#l.value} .onChanged=${()=>this.#n()}></detail-panel>
887
+ </div>
888
+ ${this.#c.value?d`<add-root-modal
889
+ .defaultKind=${"skill"}
890
+ .lockKind=${!1}
891
+ .onAdded=${()=>this.#T()}
892
+ .onCancel=${()=>this.#c.set(!1)}
893
+ ></add-root-modal>`:""}
894
+ `}}customElements.define("mem-bucket-app",gi);