mcp-memory-bucket 0.8.7 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,23 +1,23 @@
1
- (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const n of i)if(n.type==="childList")for(const o of n.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const n={};return i.integrity&&(n.integrity=i.integrity),i.referrerPolicy&&(n.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?n.credentials="include":i.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function s(i){if(i.ep)return;i.ep=!0;const n=t(i);fetch(i.href,n)}})();const Nt="modulepreload",qt=function(r){return"/"+r},Fe={},ut=function(e,t,s){let i=Promise.resolve();if(t&&t.length>0){let o=function(h){return Promise.all(h.map(p=>Promise.resolve(p).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=a?.nonce||a?.getAttribute("nonce");i=o(t.map(h=>{if(h=qt(h),h in Fe)return;Fe[h]=!0;const p=h.endsWith(".css"),d=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${d}`))return;const f=document.createElement("link");if(f.rel=p?"stylesheet":Nt,p||(f.as="script"),f.crossOrigin="",f.href=h,l&&f.setAttribute("nonce",l),document.head.appendChild(f),p)return new Promise((v,b)=>{f.addEventListener("load",v),f.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${h}`)))})}))}function n(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&n(a.reason);return e().catch(n)})};/**
1
+ (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const n of i)if(n.type==="childList")for(const o of n.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const n={};return i.integrity&&(n.integrity=i.integrity),i.referrerPolicy&&(n.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?n.credentials="include":i.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function s(i){if(i.ep)return;i.ep=!0;const n=t(i);fetch(i.href,n)}})();const qt="modulepreload",Ut=function(r){return"/"+r},Me={},ut=function(e,t,s){let i=Promise.resolve();if(t&&t.length>0){let o=function(l){return Promise.all(l.map(p=>Promise.resolve(p).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),c=a?.nonce||a?.getAttribute("nonce");i=o(t.map(l=>{if(l=Ut(l),l in Me)return;Me[l]=!0;const p=l.endsWith(".css"),d=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const f=document.createElement("link");if(f.rel=p?"stylesheet":qt,p||(f.as="script"),f.crossOrigin="",f.href=l,c&&f.setAttribute("nonce",c),document.head.appendChild(f),p)return new Promise((v,b)=>{f.addEventListener("load",v),f.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${l}`)))})}))}function n(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&n(a.reason);return e().catch(n)})};/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */const te=globalThis,$e=te.ShadowRoot&&(te.ShadyCSS===void 0||te.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,we=Symbol(),Ne=new WeakMap;let ft=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==we)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($e&&e===void 0){const s=t!==void 0&&t.length===1;s&&(e=Ne.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&Ne.set(t,e))}return e}toString(){return this.cssText}};const Ut=r=>new ft(typeof r=="string"?r:r+"",void 0,we),R=(r,...e)=>{const t=r.length===1?r[0]:e.reduce((s,i,n)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[n+1],r[0]);return new ft(t,r,we)},jt=(r,e)=>{if($e)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const s=document.createElement("style"),i=te.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=t.cssText,r.appendChild(s)}},qe=$e?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return Ut(t)})(r):r;/**
5
+ */const ee=globalThis,ye=ee.ShadowRoot&&(ee.ShadyCSS===void 0||ee.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,$e=Symbol(),Ne=new WeakMap;let ft=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==$e)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(ye&&e===void 0){const s=t!==void 0&&t.length===1;s&&(e=Ne.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&Ne.set(t,e))}return e}toString(){return this.cssText}};const jt=r=>new ft(typeof r=="string"?r:r+"",void 0,$e),R=(r,...e)=>{const t=r.length===1?r[0]:e.reduce((s,i,n)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[n+1],r[0]);return new ft(t,r,$e)},Ht=(r,e)=>{if(ye)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const s=document.createElement("style"),i=ee.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=t.cssText,r.appendChild(s)}},qe=ye?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return jt(t)})(r):r;/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:Ht,defineProperty:Bt,getOwnPropertyDescriptor:Kt,getOwnPropertyNames:Zt,getOwnPropertySymbols:Wt,getPrototypeOf:Vt}=Object,ae=globalThis,Ue=ae.trustedTypes,Qt=Ue?Ue.emptyScript:"",Jt=ae.reactiveElementPolyfillSupport,V=(r,e)=>r,be={toAttribute(r,e){switch(e){case Boolean:r=r?Qt:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},gt=(r,e)=>!Ht(r,e),je={attribute:!0,type:String,converter:be,reflect:!1,useDefault:!1,hasChanged:gt};Symbol.metadata??=Symbol("metadata"),ae.litPropertyMetadata??=new WeakMap;let N=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=je){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(e,s,t);i!==void 0&&Bt(this.prototype,e,i)}}static getPropertyDescriptor(e,t,s){const{get:i,set:n}=Kt(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:i,set(o){const a=i?.call(this);n?.call(this,o),this.requestUpdate(e,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??je}static _$Ei(){if(this.hasOwnProperty(V("elementProperties")))return;const e=Vt(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(V("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(V("properties"))){const t=this.properties,s=[...Zt(t),...Wt(t)];for(const i of s)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[s,i]of t)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const i of s)t.unshift(qe(i))}else e!==void 0&&t.push(qe(e));return t}static _$Eu(e,t){const s=t.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const s of t.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return jt(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){const s=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,s);if(i!==void 0&&s.reflect===!0){const n=(s.converter?.toAttribute!==void 0?s.converter:be).toAttribute(t,s.type);this._$Em=e,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(e,t){const s=this.constructor,i=s._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const n=s.getPropertyOptions(i),o=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:be;this._$Em=i;const a=o.fromAttribute(t,n.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,s,i=!1,n){if(e!==void 0){const o=this.constructor;if(i===!1&&(n=this[e]),s??=o.getPropertyOptions(e),!((s.hasChanged??gt)(n,t)||s.useDefault&&s.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,s))))return;this.C(e,t,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:s,reflect:i,wrapped:n},o){s&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),n!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,n]of this._$Ep)this[i]=n;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,n]of s){const{wrapped:o}=n,a=this[i];o!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,n,a)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(t)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};N.elementStyles=[],N.shadowRootOptions={mode:"open"},N[V("elementProperties")]=new Map,N[V("finalized")]=new Map,Jt?.({ReactiveElement:N}),(ae.reactiveElementVersions??=[]).push("2.1.2");/**
9
+ */const{is:Bt,defineProperty:Kt,getOwnPropertyDescriptor:Zt,getOwnPropertyNames:Wt,getOwnPropertySymbols:Vt,getPrototypeOf:Qt}=Object,oe=globalThis,Ue=oe.trustedTypes,Jt=Ue?Ue.emptyScript:"",Yt=oe.reactiveElementPolyfillSupport,V=(r,e)=>r,ge={toAttribute(r,e){switch(e){case Boolean:r=r?Jt:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},gt=(r,e)=>!Bt(r,e),je={attribute:!0,type:String,converter:ge,reflect:!1,useDefault:!1,hasChanged:gt};Symbol.metadata??=Symbol("metadata"),oe.litPropertyMetadata??=new WeakMap;let N=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=je){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(e,s,t);i!==void 0&&Kt(this.prototype,e,i)}}static getPropertyDescriptor(e,t,s){const{get:i,set:n}=Zt(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:i,set(o){const a=i?.call(this);n?.call(this,o),this.requestUpdate(e,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??je}static _$Ei(){if(this.hasOwnProperty(V("elementProperties")))return;const e=Qt(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(V("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(V("properties"))){const t=this.properties,s=[...Wt(t),...Vt(t)];for(const i of s)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[s,i]of t)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const i of s)t.unshift(qe(i))}else e!==void 0&&t.push(qe(e));return t}static _$Eu(e,t){const s=t.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const s of t.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ht(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){const s=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,s);if(i!==void 0&&s.reflect===!0){const n=(s.converter?.toAttribute!==void 0?s.converter:ge).toAttribute(t,s.type);this._$Em=e,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(e,t){const s=this.constructor,i=s._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const n=s.getPropertyOptions(i),o=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:ge;this._$Em=i;const a=o.fromAttribute(t,n.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,s,i=!1,n){if(e!==void 0){const o=this.constructor;if(i===!1&&(n=this[e]),s??=o.getPropertyOptions(e),!((s.hasChanged??gt)(n,t)||s.useDefault&&s.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,s))))return;this.C(e,t,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:s,reflect:i,wrapped:n},o){s&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),n!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,n]of this._$Ep)this[i]=n;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,n]of s){const{wrapped:o}=n,a=this[i];o!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,n,a)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(t)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};N.elementStyles=[],N.shadowRootOptions={mode:"open"},N[V("elementProperties")]=new Map,N[V("finalized")]=new Map,Yt?.({ReactiveElement:N}),(oe.reactiveElementVersions??=[]).push("2.1.2");/**
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */const _e=globalThis,He=r=>r,se=_e.trustedTypes,Be=se?se.createPolicy("lit-html",{createHTML:r=>r}):void 0,bt="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,mt="?"+E,Yt=`<${mt}>`,I=document,Q=()=>I.createComment(""),J=r=>r===null||typeof r!="object"&&typeof r!="function",Se=Array.isArray,Gt=r=>Se(r)||typeof r?.[Symbol.iterator]=="function",pe=`[
14
- \f\r]`,B=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ke=/-->/g,Ze=/>/g,P=RegExp(`>|${pe}(?:([^\\s"'>=/]+)(${pe}*=${pe}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),We=/'/g,Ve=/"/g,xt=/^(?:script|style|textarea|title)$/i,Xt=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),c=Xt(1),O=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),Qe=new WeakMap,L=I.createTreeWalker(I,129);function vt(r,e){if(!Se(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Be!==void 0?Be.createHTML(e):e}const es=(r,e)=>{const t=r.length-1,s=[];let i,n=e===2?"<svg>":e===3?"<math>":"",o=B;for(let a=0;a<t;a++){const l=r[a];let h,p,d=-1,f=0;for(;f<l.length&&(o.lastIndex=f,p=o.exec(l),p!==null);)f=o.lastIndex,o===B?p[1]==="!--"?o=Ke:p[1]!==void 0?o=Ze:p[2]!==void 0?(xt.test(p[2])&&(i=RegExp("</"+p[2],"g")),o=P):p[3]!==void 0&&(o=P):o===P?p[0]===">"?(o=i??B,d=-1):p[1]===void 0?d=-2:(d=o.lastIndex-p[2].length,h=p[1],o=p[3]===void 0?P:p[3]==='"'?Ve:We):o===Ve||o===We?o=P:o===Ke||o===Ze?o=B:(o=P,i=void 0);const v=o===P&&r[a+1].startsWith("/>")?" ":"";n+=o===B?l+Yt:d>=0?(s.push(h),l.slice(0,d)+bt+l.slice(d)+E+v):l+E+(d===-2?a:v)}return[vt(r,n+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};let me=class yt{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let n=0,o=0;const a=e.length-1,l=this.parts,[h,p]=es(e,t);if(this.el=yt.createElement(h,s),L.currentNode=this.el.content,t===2||t===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=L.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const d of i.getAttributeNames())if(d.endsWith(bt)){const f=p[o++],v=i.getAttribute(d).split(E),b=/([.?@])?(.*)/.exec(f);l.push({type:1,index:n,name:b[2],strings:v,ctor:b[1]==="."?ss:b[1]==="?"?is:b[1]==="@"?rs:le}),i.removeAttribute(d)}else d.startsWith(E)&&(l.push({type:6,index:n}),i.removeAttribute(d));if(xt.test(i.tagName)){const d=i.textContent.split(E),f=d.length-1;if(f>0){i.textContent=se?se.emptyScript:"";for(let v=0;v<f;v++)i.append(d[v],Q()),L.nextNode(),l.push({type:2,index:++n});i.append(d[f],Q())}}}else if(i.nodeType===8)if(i.data===mt)l.push({type:2,index:n});else{let d=-1;for(;(d=i.data.indexOf(E,d+1))!==-1;)l.push({type:7,index:n}),d+=E.length-1}n++}}static createElement(e,t){const s=I.createElement("template");return s.innerHTML=e,s}};function q(r,e,t=r,s){if(e===O)return e;let i=s!==void 0?t._$Co?.[s]:t._$Cl;const n=J(e)?void 0:e._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),n===void 0?i=void 0:(i=new n(r),i._$AT(r,t,s)),s!==void 0?(t._$Co??=[])[s]=i:t._$Cl=i),i!==void 0&&(e=q(r,i._$AS(r,e.values),i,s)),e}let ts=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,i=(e?.creationScope??I).importNode(t,!0);L.currentNode=i;let n=L.nextNode(),o=0,a=0,l=s[0];for(;l!==void 0;){if(o===l.index){let h;l.type===2?h=new Y(n,n.nextSibling,this,e):l.type===1?h=new l.ctor(n,l.name,l.strings,this,e):l.type===6&&(h=new ns(n,this,e)),this._$AV.push(h),l=s[++a]}o!==l?.index&&(n=L.nextNode(),o++)}return L.currentNode=I,i}p(e){let t=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}};class Y{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,i){this.type=2,this._$AH=m,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=q(this,e,t),J(e)?e===m||e==null||e===""?(this._$AH!==m&&this._$AR(),this._$AH=m):e!==this._$AH&&e!==O&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Gt(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==m&&J(this._$AH)?this._$AA.nextSibling.data=e:this.T(I.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:s}=e,i=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=me.createElement(vt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const n=new ts(i,this),o=n.u(this.options);n.p(t),this.T(o),this._$AH=n}}_$AC(e){let t=Qe.get(e.strings);return t===void 0&&Qe.set(e.strings,t=new me(e)),t}k(e){Se(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,i=0;for(const n of e)i===t.length?t.push(s=new Y(this.O(Q()),this.O(Q()),this,this.options)):s=t[i],s._$AI(n),i++;i<t.length&&(this._$AR(s&&s._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const s=He(e).nextSibling;He(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}let le=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,i,n){this.type=1,this._$AH=m,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=m}_$AI(e,t=this,s,i){const n=this.strings;let o=!1;if(n===void 0)e=q(this,e,t,0),o=!J(e)||e!==this._$AH&&e!==O,o&&(this._$AH=e);else{const a=e;let l,h;for(e=n[0],l=0;l<n.length-1;l++)h=q(this,a[s+l],t,l),h===O&&(h=this._$AH[l]),o||=!J(h)||h!==this._$AH[l],h===m?e=m:e!==m&&(e+=(h??"")+n[l+1]),this._$AH[l]=h}o&&!i&&this.j(e)}j(e){e===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},ss=class extends le{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===m?void 0:e}},is=class extends le{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==m)}},rs=class extends le{constructor(e,t,s,i,n){super(e,t,s,i,n),this.type=5}_$AI(e,t=this){if((e=q(this,e,t,0)??m)===O)return;const s=this._$AH,i=e===m&&s!==m||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==m&&(s===m||i);i&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},ns=class{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){q(this,e)}};const os=_e.litHtmlPolyfillSupport;os?.(me,Y),(_e.litHtmlVersions??=[]).push("3.3.3");const as=(r,e,t)=>{const s=t?.renderBefore??e;let i=s._$litPart$;if(i===void 0){const n=t?.renderBefore??null;s._$litPart$=i=new Y(e.insertBefore(Q(),n),n,void 0,t??{})}return i._$AI(r),i};/**
13
+ */const we=globalThis,He=r=>r,te=we.trustedTypes,Be=te?te.createPolicy("lit-html",{createHTML:r=>r}):void 0,bt="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,mt="?"+E,Gt=`<${mt}>`,I=document,Q=()=>I.createComment(""),J=r=>r===null||typeof r!="object"&&typeof r!="function",_e=Array.isArray,Xt=r=>_e(r)||typeof r?.[Symbol.iterator]=="function",de=`[
14
+ \f\r]`,B=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ke=/-->/g,Ze=/>/g,z=RegExp(`>|${de}(?:([^\\s"'>=/]+)(${de}*=${de}*(?:[^
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),We=/'/g,Ve=/"/g,xt=/^(?:script|style|textarea|title)$/i,es=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),h=es(1),O=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),Qe=new WeakMap,L=I.createTreeWalker(I,129);function vt(r,e){if(!_e(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Be!==void 0?Be.createHTML(e):e}const ts=(r,e)=>{const t=r.length-1,s=[];let i,n=e===2?"<svg>":e===3?"<math>":"",o=B;for(let a=0;a<t;a++){const c=r[a];let l,p,d=-1,f=0;for(;f<c.length&&(o.lastIndex=f,p=o.exec(c),p!==null);)f=o.lastIndex,o===B?p[1]==="!--"?o=Ke:p[1]!==void 0?o=Ze:p[2]!==void 0?(xt.test(p[2])&&(i=RegExp("</"+p[2],"g")),o=z):p[3]!==void 0&&(o=z):o===z?p[0]===">"?(o=i??B,d=-1):p[1]===void 0?d=-2:(d=o.lastIndex-p[2].length,l=p[1],o=p[3]===void 0?z:p[3]==='"'?Ve:We):o===Ve||o===We?o=z:o===Ke||o===Ze?o=B:(o=z,i=void 0);const v=o===z&&r[a+1].startsWith("/>")?" ":"";n+=o===B?c+Gt:d>=0?(s.push(l),c.slice(0,d)+bt+c.slice(d)+E+v):c+E+(d===-2?a:v)}return[vt(r,n+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};let be=class kt{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let n=0,o=0;const a=e.length-1,c=this.parts,[l,p]=ts(e,t);if(this.el=kt.createElement(l,s),L.currentNode=this.el.content,t===2||t===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=L.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const d of i.getAttributeNames())if(d.endsWith(bt)){const f=p[o++],v=i.getAttribute(d).split(E),b=/([.?@])?(.*)/.exec(f);c.push({type:1,index:n,name:b[2],strings:v,ctor:b[1]==="."?is:b[1]==="?"?rs:b[1]==="@"?ns:ae}),i.removeAttribute(d)}else d.startsWith(E)&&(c.push({type:6,index:n}),i.removeAttribute(d));if(xt.test(i.tagName)){const d=i.textContent.split(E),f=d.length-1;if(f>0){i.textContent=te?te.emptyScript:"";for(let v=0;v<f;v++)i.append(d[v],Q()),L.nextNode(),c.push({type:2,index:++n});i.append(d[f],Q())}}}else if(i.nodeType===8)if(i.data===mt)c.push({type:2,index:n});else{let d=-1;for(;(d=i.data.indexOf(E,d+1))!==-1;)c.push({type:7,index:n}),d+=E.length-1}n++}}static createElement(e,t){const s=I.createElement("template");return s.innerHTML=e,s}};function q(r,e,t=r,s){if(e===O)return e;let i=s!==void 0?t._$Co?.[s]:t._$Cl;const n=J(e)?void 0:e._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),n===void 0?i=void 0:(i=new n(r),i._$AT(r,t,s)),s!==void 0?(t._$Co??=[])[s]=i:t._$Cl=i),i!==void 0&&(e=q(r,i._$AS(r,e.values),i,s)),e}let ss=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,i=(e?.creationScope??I).importNode(t,!0);L.currentNode=i;let n=L.nextNode(),o=0,a=0,c=s[0];for(;c!==void 0;){if(o===c.index){let l;c.type===2?l=new Se(n,n.nextSibling,this,e):c.type===1?l=new c.ctor(n,c.name,c.strings,this,e):c.type===6&&(l=new os(n,this,e)),this._$AV.push(l),c=s[++a]}o!==c?.index&&(n=L.nextNode(),o++)}return L.currentNode=I,i}p(e){let t=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}},Se=class yt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,i){this.type=2,this._$AH=m,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=q(this,e,t),J(e)?e===m||e==null||e===""?(this._$AH!==m&&this._$AR(),this._$AH=m):e!==this._$AH&&e!==O&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Xt(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==m&&J(this._$AH)?this._$AA.nextSibling.data=e:this.T(I.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:s}=e,i=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=be.createElement(vt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const n=new ss(i,this),o=n.u(this.options);n.p(t),this.T(o),this._$AH=n}}_$AC(e){let t=Qe.get(e.strings);return t===void 0&&Qe.set(e.strings,t=new be(e)),t}k(e){_e(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,i=0;for(const n of e)i===t.length?t.push(s=new yt(this.O(Q()),this.O(Q()),this,this.options)):s=t[i],s._$AI(n),i++;i<t.length&&(this._$AR(s&&s._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const s=He(e).nextSibling;He(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ae=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,i,n){this.type=1,this._$AH=m,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=m}_$AI(e,t=this,s,i){const n=this.strings;let o=!1;if(n===void 0)e=q(this,e,t,0),o=!J(e)||e!==this._$AH&&e!==O,o&&(this._$AH=e);else{const a=e;let c,l;for(e=n[0],c=0;c<n.length-1;c++)l=q(this,a[s+c],t,c),l===O&&(l=this._$AH[c]),o||=!J(l)||l!==this._$AH[c],l===m?e=m:e!==m&&(e+=(l??"")+n[c+1]),this._$AH[c]=l}o&&!i&&this.j(e)}j(e){e===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},is=class extends ae{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===m?void 0:e}},rs=class extends ae{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==m)}},ns=class extends ae{constructor(e,t,s,i,n){super(e,t,s,i,n),this.type=5}_$AI(e,t=this){if((e=q(this,e,t,0)??m)===O)return;const s=this._$AH,i=e===m&&s!==m||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==m&&(s===m||i);i&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},os=class{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){q(this,e)}};const as=we.litHtmlPolyfillSupport;as?.(be,Se),(we.litHtmlVersions??=[]).push("3.3.3");const ls=(r,e,t)=>{const s=t?.renderBefore??e;let i=s._$litPart$;if(i===void 0){const n=t?.renderBefore??null;s._$litPart$=i=new Se(e.insertBefore(Q(),n),n,void 0,t??{})}return i._$AI(r),i};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
- */const Ce=globalThis;let $=class extends N{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=as(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return O}};$._$litElement$=!0,$.finalized=!0,Ce.litElementHydrateSupport?.({LitElement:$});const ls=Ce.litElementPolyfillSupport;ls?.({LitElement:$});(Ce.litElementVersions??=[]).push("4.2.2");var kt;let ue=0;const Je=new Set;function cs(r){ue++;try{r()}finally{ue--,ue===0&&hs()}}function hs(){const r=new Set(Je);Je.clear();for(const e of r)e()}function ds(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function ps(r){return r&&typeof r.deref=="function"}class Ae{static#e=0;#t;#s;#n=new Set;#r=kt.#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 ds(e,this.#t)?(this.#s=this.#t,this.#t=e,this._notify(),!0):!1}subscribe(e,t=!1){let s=e;return t&&(s=new WeakRef(e)),this.#n.add(s),()=>this.#n.delete(s)}_notify(){const e=[...this.#n];for(const t of e){let s;if(ps(t)){if(s=t.deref(),!s){this.#n.delete(t);continue}}else s=t;s()}}get id(){return this.#r}get previousValue(){return this.#s}toString(){return this.name?`${this.constructor.name}(${this.name})`:`${this.constructor.name}#${this.id}`}}kt=Ae;class u extends Ae{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){cs(()=>{this._set(e)})}get value(){return this.get()}set value(e){this.set(e)}update(e){this.set(e(this.get()))}}class us extends Ae{#e;#t=!0;#s=!1;#n=new Map;_debugParent;#r;#g=()=>{this.#t||(this.#t=!0,this._notify())};constructor(e,t,s){super(void 0,t),this.#e=e,this.#r=s?.weak??!0}track(e){if(this.#n.has(e))return;const t=e.subscribe(this.#g,this.#r);this.#n.set(e,t)}dispose(){this.#a()}#a(){for(const e of this.#n.values())e();this.#n.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 ce{#e;#t=new Map;_debugParent;constructor(e){this.#e=e,e.addController(this);const t=e,s=t.update,i=this;t.update=function(n){u.push(i);try{s.call(this,n)}finally{u.pop()}}}track(e){this.#t.has(e)||this.#t.set(e,e.subscribe(this.#s,!0))}#s=()=>{this.#e.requestUpdate()};hostUpdate(){for(const e of this.#t.values())e();this.#t.clear()}hostDisconnected(){for(const e of this.#t.values())e();this.#t.clear()}toString(){const e=this.#e;return`SignalWatcher(${e?.localName??e?.tagName??e?.constructor?.name??"unknown"})`}}const fs=new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"});function gs(r){if(!r)return"unknown age";const e=new Date(r);return Number.isNaN(e.getTime())?"unknown age":fs.format(e)}function bs(r){const e=[],t=new Map,s=[];for(const n of r){if(n._table!=="memory_docs"){s.push(n);continue}t.has(n.name)||(t.set(n.name,[]),e.push(n.name)),t.get(n.name).push(n)}const i=e.map(n=>({key:n,items:t.get(n)}));return s.length>0&&i.push({key:null,items:s}),i}class ms extends ${static{this.properties={results:{attribute:!1},showFolder:{attribute:!1},onSelect:{attribute:!1},selectedIds:{attribute:!1},onToggleSelect:{attribute:!1},onKeyClick:{attribute:!1}}}static{this.styles=R`
19
+ */const Ce=globalThis;let $=class extends N{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=ls(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return O}};$._$litElement$=!0,$.finalized=!0,Ce.litElementHydrateSupport?.({LitElement:$});const cs=Ce.litElementPolyfillSupport;cs?.({LitElement:$});(Ce.litElementVersions??=[]).push("4.2.2");var $t;let pe=0;const Je=new Set;function hs(r){pe++;try{r()}finally{pe--,pe===0&&ds()}}function ds(){const r=new Set(Je);Je.clear();for(const e of r)e()}function ps(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function us(r){return r&&typeof r.deref=="function"}class Ae{static#e=0;#t;#s;#n=new Set;#r=$t.#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 ps(e,this.#t)?(this.#s=this.#t,this.#t=e,this._notify(),!0):!1}subscribe(e,t=!1){let s=e;return t&&(s=new WeakRef(e)),this.#n.add(s),()=>this.#n.delete(s)}_notify(){const e=[...this.#n];for(const t of e){let s;if(us(t)){if(s=t.deref(),!s){this.#n.delete(t);continue}}else s=t;s()}}get id(){return this.#r}get previousValue(){return this.#s}toString(){return this.name?`${this.constructor.name}(${this.name})`:`${this.constructor.name}#${this.id}`}}$t=Ae;class u extends Ae{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){hs(()=>{this._set(e)})}get value(){return this.get()}set value(e){this.set(e)}update(e){this.set(e(this.get()))}}class fs extends Ae{#e;#t=!0;#s=!1;#n=new Map;_debugParent;#r;#g=()=>{this.#t||(this.#t=!0,this._notify())};constructor(e,t,s){super(void 0,t),this.#e=e,this.#r=s?.weak??!0}track(e){if(this.#n.has(e))return;const t=e.subscribe(this.#g,this.#r);this.#n.set(e,t)}dispose(){this.#a()}#a(){for(const e of this.#n.values())e();this.#n.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 le{#e;#t=new Map;_debugParent;constructor(e){this.#e=e,e.addController(this);const t=e,s=t.update,i=this;t.update=function(n){u.push(i);try{s.call(this,n)}finally{u.pop()}}}track(e){this.#t.has(e)||this.#t.set(e,e.subscribe(this.#s,!0))}#s=()=>{this.#e.requestUpdate()};hostUpdate(){for(const e of this.#t.values())e();this.#t.clear()}hostDisconnected(){for(const e of this.#t.values())e();this.#t.clear()}toString(){const e=this.#e;return`SignalWatcher(${e?.localName??e?.tagName??e?.constructor?.name??"unknown"})`}}const gs=new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"});function bs(r){if(!r)return"unknown age";const e=new Date(r);return Number.isNaN(e.getTime())?"unknown age":gs.format(e)}function ms(r){const e=[],t=new Map,s=[];for(const n of r){if(n._table!=="memory_docs"){s.push(n);continue}t.has(n.name)||(t.set(n.name,[]),e.push(n.name)),t.get(n.name).push(n)}const i=e.map(n=>({key:n,items:t.get(n)}));return s.length>0&&i.push({key:null,items:s}),i}class xs extends ${static{this.properties={results:{attribute:!1},showFolder:{attribute:!1},onSelect:{attribute:!1},selectedIds:{attribute:!1},onToggleSelect:{attribute:!1},onKeyClick:{attribute:!1}}}static{this.styles=R`
21
21
  :host { display: block; }
22
22
  .count-header {
23
23
  padding: 8px 14px;
@@ -58,7 +58,16 @@
58
58
  .desc { font-size: 12px; opacity: 0.8; margin-top: 3px; }
59
59
  .tags { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
60
60
  .tag { font-size: 10px; border: 1px solid var(--border-strong); border-radius: 999px; padding: 1px 6px; }
61
- .type-badge { font-size: 10px; text-transform: uppercase; opacity: 0.6; }
61
+ .type-badge {
62
+ font-size: 10px; text-transform: uppercase; font-weight: 700; flex: 0 0 auto;
63
+ border-radius: 4px; padding: 1px 5px; display: inline-flex; align-items: center; gap: 3px;
64
+ }
65
+ .type-badge.skill {
66
+ border: 1px solid var(--purple); color: var(--purple-fg); background: var(--purple-tint);
67
+ }
68
+ .type-badge.memory {
69
+ border: 1px solid var(--accent); color: var(--accent); background: var(--accent-tint);
70
+ }
62
71
  .folder-badge {
63
72
  font-size: 10px; text-transform: uppercase; opacity: 0.9; border: 1px solid var(--purple);
64
73
  color: var(--purple-fg); background: var(--purple-tint); border-radius: 4px; padding: 0 4px;
@@ -72,10 +81,10 @@
72
81
  color: var(--accent); background: var(--accent-tint); border-radius: 4px; padding: 0 4px;
73
82
  }
74
83
  .empty { padding: 24px; opacity: 0.6; font-size: 13px; }
75
- `}render(){return!this.results||this.results.length===0?c`<div class="empty">No results.</div>`:c`
84
+ `}render(){return!this.results||this.results.length===0?h`<div class="empty">No results.</div>`:h`
76
85
  <div class="count-header">${this.results.length} result${this.results.length===1?"":"s"}</div>
77
- ${bs(this.results).map(e=>c`
78
- ${e.key?c`<div class="key-group-header">
86
+ ${ms(this.results).map(e=>h`
87
+ ${e.key?h`<div class="key-group-header">
79
88
  🔑
80
89
  <button
81
90
  class="key-group-link"
@@ -88,7 +97,7 @@
88
97
  </div>`:""}
89
98
  ${e.items.map(t=>this.#e(t))}
90
99
  `)}
91
- `}#e(e){const t=e._table==="skills"&&e.folder==="builtin";return c`
100
+ `}#e(e){const t=e._table==="skills"&&e.folder==="builtin";return h`
92
101
  <div class="row ${e.deprecated?"deprecated":""} ${e.paused?"paused":""}" @click=${()=>this.onSelect(e)}>
93
102
  <input
94
103
  type="checkbox"
@@ -100,65 +109,69 @@
100
109
  />
101
110
  <div class="row-body">
102
111
  <div class="top">
103
- <span class="name">${e.name}</span>
104
- <span class="meta">${gs(e.created_at)} · ${e.owner??""} · ${e.status}</span>
112
+ <span class="name">
113
+ <span class="type-badge ${e._table==="skills"?"skill":"memory"}"
114
+ >${e._table==="skills"?"⚡ skill":"📝 memory"}</span
115
+ >
116
+ ${e.name}
117
+ </span>
118
+ <span class="meta">${bs(e.created_at)} · ${e.owner??"—"} · ${e.status}</span>
105
119
  </div>
106
120
  <div class="desc">${e.description}</div>
107
121
  <div class="tags">
108
- <span class="type-badge">${e._table==="skills"?"skill":"memory"}</span>
109
- ${this.showFolder&&e.folder?c`<span class="folder-badge">📁 ${e.folder}</span>`:""}
110
- ${e.deprecated?c`<span class="deprecated-badge">deprecated</span>`:""}
111
- ${e.paused?c`<span class="paused-badge">paused</span>`:""}
112
- ${e.tags.map(s=>c`<span class="tag">${s}</span>`)}
122
+ ${this.showFolder&&e.folder?h`<span class="folder-badge">📁 ${e.folder}</span>`:""}
123
+ ${e.deprecated?h`<span class="deprecated-badge">deprecated</span>`:""}
124
+ ${e.paused?h`<span class="paused-badge">paused</span>`:""}
125
+ ${e.tags.map(s=>h`<span class="tag">${s}</span>`)}
113
126
  </div>
114
127
  </div>
115
128
  </div>
116
- `}}customElements.define("result-list",ms);function Te(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var M=Te();function $t(r){M=r}var z={exec:()=>null};function F(r){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),i=e[s];return i||(i=r(s),e[s]=i),i}}function g(r,e=""){let t=typeof r=="string"?r:r.source,s={replace:(i,n)=>{let o=typeof n=="string"?n:n.source;return o=o.replace(y.caret,"$1"),t=t.replace(i,o),s},getRegex:()=>new RegExp(t,e)};return s}var xs=((r="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+r)}catch{return!1}})(),y={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:F(r=>new RegExp(`^ {0,${r}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:F(r=>new RegExp(`^ {0,${r}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:F(r=>new RegExp(`^ {0,${r}}(?:\`\`\`|~~~)`)),headingBeginRegex:F(r=>new RegExp(`^ {0,${r}}#`)),htmlBeginRegex:F(r=>new RegExp(`^ {0,${r}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:F(r=>new RegExp(`^ {0,${r}}>`))},vs=/^(?:[ \t]*(?:\n|$))+/,ys=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ks=/^ {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+|$)/,$s=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ee=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,wt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_t=g(wt).replace(/bull/g,Ee).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(),ws=g(wt).replace(/bull/g,Ee).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(),Re=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,_s=/^[^\n]+/,Pe=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ss=g(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Pe).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Cs=g(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ee).getRegex(),he="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ze=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,As=g("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ze).replace("tag",he).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),St=r=>g(Re).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",r).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",he).getRegex(),Ts=St(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Es=St(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Rs=g(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Es).getRegex(),Le={blockquote:Rs,code:ys,def:Ss,fences:ks,heading:$s,hr:G,html:As,lheading:_t,list:Cs,newline:vs,paragraph:Ts,table:z,text:_s},Ye=g("^ *([^\\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",he).getRegex(),Ps={...Le,lheading:ws,table:Ye,paragraph:g(Re).replace("hr",G).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ye).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",he).getRegex()},zs={...Le,html:g(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ze).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:z,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:g(Re).replace("hr",G).replace("heading",` *#{1,6} *[^
117
- ]`).replace("lheading",_t).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ls=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Is=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ct=/^( {2,}|\\)\n(?!\s*$)/,Os=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,A=/[\p{P}\p{S}]/u,U=/[\s\p{P}\p{S}]/u,X=/[^\s\p{P}\p{S}]/u,Ds=g(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,U).getRegex(),Ms=/[\p{Pi}\p{Ps}"']/u,At=/(?!~)[\p{P}\p{S}]/u,Fs=/(?!~)[\s\p{P}\p{S}]/u,Ns=/(?:[^\s\p{P}\p{S}]|~)/u,qs=g(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",xs?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Tt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Us=g(Tt,"u").replace(/punct/g,A).getRegex(),js=g(Tt,"u").replace(/punct/g,At).getRegex(),Hs=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,Bs=g(Hs,"u").replace(/openQuote/g,Ms).replace(/punct/g,A).getRegex(),Et="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Ks=g(Et,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),Zs=g(Et,"gu").replace(/notPunctSpace/g,Ns).replace(/punctSpace/g,Fs).replace(/punct/g,At).getRegex(),Ws="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",Vs=g(Ws,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),Qs=g("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),Js="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Ys=g(Js,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),Gs=g(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,A).getRegex(),Xs="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",ei=g(Xs,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),ti=g(/\\(punct)/,"gu").replace(/punct/g,A).getRegex(),si=g(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ii=g(ze).replace("(?:-->|$)","-->").getRegex(),ri=g("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",ii).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ie=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,ni=g(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ie).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Rt=g(/^!?\[(label)\]\[(ref)\]/).replace("label",ie).replace("ref",Pe).getRegex(),Pt=g(/^!?\[(ref)\](?:\[\])?/).replace("ref",Pe).getRegex(),oi=g("reflink|nolink(?!\\()","g").replace("reflink",Rt).replace("nolink",Pt).getRegex(),Ge=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ie={_backpedal:z,anyPunctuation:ti,autolink:si,blockSkip:qs,br:Ct,code:Is,del:z,delLDelim:z,delRDelim:z,emStrongLDelim:Us,emStrongRDelimAst:Ks,emStrongRDelimUnd:Qs,escape:Ls,link:ni,nolink:Pt,punctuation:Ds,reflink:Rt,reflinkSearch:oi,tag:ri,text:Os,url:z},ai={...Ie,emStrongLDelim:Bs,emStrongRDelimAst:Vs,emStrongRDelimUnd:Ys,link:g(/^!?\[(label)\]\((.*?)\)/).replace("label",ie).getRegex(),reflink:g(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ie).getRegex()},xe={...Ie,emStrongRDelimAst:Zs,emStrongLDelim:js,delLDelim:Gs,delRDelim:ei,url:g(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ge).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:g(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ge).getRegex()},li={...xe,br:g(Ct).replace("{2,}","*").getRegex(),text:g(xe.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ee={normal:Le,gfm:Ps,pedantic:zs},K={normal:Ie,gfm:xe,breaks:li,pedantic:ai},ci={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Xe=r=>ci[r];function C(r,e){if(e){if(y.escapeTest.test(r))return r.replace(y.escapeReplace,Xe)}else if(y.escapeTestNoEncode.test(r))return r.replace(y.escapeReplaceNoEncode,Xe);return r}function et(r){try{r=encodeURI(r).replace(y.percentDecode,"%")}catch{return null}return r}function tt(r,e){let t=r.replace(y.findPipe,(n,o,a)=>{let l=!1,h=o;for(;--h>=0&&a[h]==="\\";)l=!l;return l?"|":" |"}),s=t.split(y.splitPipe),i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(y.slashPipe,"|");return s}function T(r,e,t){let s=r.length;if(s===0)return"";let i=0;for(;i<s&&r.charAt(s-i-1)===e;)i++;return r.slice(0,s-i)}function st(r){let e=r.split(`
118
- `),t=e.length-1;for(;t>=0&&y.blankLine.test(e[t]);)t--;return e.length-t<=2?r:e.slice(0,t+1).join(`
119
- `)}function hi(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<r.length;s++)if(r[s]==="\\")s++;else if(r[s]===e[0])t++;else if(r[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function di(r,e=0){let t=e,s="";for(let i of r)if(i===" "){let n=4-t%4;s+=" ".repeat(n),t+=n}else s+=i,t++;return s}function it(r,e,t,s,i){let n=e.href,o=e.title||null,a=r[1].replace(i.other.outputLinkReplace,"$1");s.state.inLink=!0;let l={type:r[0].charAt(0)==="!"?"image":"link",raw:t,href:n,title:o,text:a,tokens:s.inlineTokens(a)};return s.state.inLink=!1,l}function pi(r,e,t){let s=r.match(t.other.indentCodeCompensation);if(s===null)return e;let i=s[1];return e.split(`
129
+ `}}customElements.define("result-list",xs);function Te(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var F=Te();function wt(r){F=r}var P={exec:()=>null};function M(r){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),i=e[s];return i||(i=r(s),e[s]=i),i}}function g(r,e=""){let t=typeof r=="string"?r:r.source,s={replace:(i,n)=>{let o=typeof n=="string"?n:n.source;return o=o.replace(k.caret,"$1"),t=t.replace(i,o),s},getRegex:()=>new RegExp(t,e)};return s}var vs=((r="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+r)}catch{return!1}})(),k={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:M(r=>new RegExp(`^ {0,${r}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:M(r=>new RegExp(`^ {0,${r}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:M(r=>new RegExp(`^ {0,${r}}(?:\`\`\`|~~~)`)),headingBeginRegex:M(r=>new RegExp(`^ {0,${r}}#`)),htmlBeginRegex:M(r=>new RegExp(`^ {0,${r}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:M(r=>new RegExp(`^ {0,${r}}>`))},ks=/^(?:[ \t]*(?:\n|$))+/,ys=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,$s=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Y=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ws=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ee=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,_t=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,St=g(_t).replace(/bull/g,Ee).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(),_s=g(_t).replace(/bull/g,Ee).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(),Re=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Ss=/^[^\n]+/,ze=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Cs=g(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ze).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),As=g(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ee).getRegex(),ce="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",Pe=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ts=g("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Pe).replace("tag",ce).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ct=r=>g(Re).replace("hr",Y).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",r).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ce).getRegex(),Es=Ct(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Rs=Ct(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),zs=g(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Rs).getRegex(),Le={blockquote:zs,code:ys,def:Cs,fences:$s,heading:ws,hr:Y,html:Ts,lheading:St,list:As,newline:ks,paragraph:Es,table:P,text:Ss},Ye=g("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Y).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ce).getRegex(),Ps={...Le,lheading:_s,table:Ye,paragraph:g(Re).replace("hr",Y).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ye).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",ce).getRegex()},Ls={...Le,html:g(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Pe).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:P,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:g(Re).replace("hr",Y).replace("heading",` *#{1,6} *[^
130
+ ]`).replace("lheading",St).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Is=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Os=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,At=/^( {2,}|\\)\n(?!\s*$)/,Ds=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,A=/[\p{P}\p{S}]/u,U=/[\s\p{P}\p{S}]/u,G=/[^\s\p{P}\p{S}]/u,Fs=g(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,U).getRegex(),Ms=/[\p{Pi}\p{Ps}"']/u,Tt=/(?!~)[\p{P}\p{S}]/u,Ns=/(?!~)[\s\p{P}\p{S}]/u,qs=/(?:[^\s\p{P}\p{S}]|~)/u,Us=g(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",vs?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Et=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,js=g(Et,"u").replace(/punct/g,A).getRegex(),Hs=g(Et,"u").replace(/punct/g,Tt).getRegex(),Bs=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,Ks=g(Bs,"u").replace(/openQuote/g,Ms).replace(/punct/g,A).getRegex(),Rt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Zs=g(Rt,"gu").replace(/notPunctSpace/g,G).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),Ws=g(Rt,"gu").replace(/notPunctSpace/g,qs).replace(/punctSpace/g,Ns).replace(/punct/g,Tt).getRegex(),Vs="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",Qs=g(Vs,"gu").replace(/notPunctSpace/g,G).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),Js=g("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,G).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),Ys="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Gs=g(Ys,"gu").replace(/notPunctSpace/g,G).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),Xs=g(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,A).getRegex(),ei="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",ti=g(ei,"gu").replace(/notPunctSpace/g,G).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),si=g(/\\(punct)/,"gu").replace(/punct/g,A).getRegex(),ii=g(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ri=g(Pe).replace("(?:-->|$)","-->").getRegex(),ni=g("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",ri).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),se=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,oi=g(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",se).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),zt=g(/^!?\[(label)\]\[(ref)\]/).replace("label",se).replace("ref",ze).getRegex(),Pt=g(/^!?\[(ref)\](?:\[\])?/).replace("ref",ze).getRegex(),ai=g("reflink|nolink(?!\\()","g").replace("reflink",zt).replace("nolink",Pt).getRegex(),Ge=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ie={_backpedal:P,anyPunctuation:si,autolink:ii,blockSkip:Us,br:At,code:Os,del:P,delLDelim:P,delRDelim:P,emStrongLDelim:js,emStrongRDelimAst:Zs,emStrongRDelimUnd:Js,escape:Is,link:oi,nolink:Pt,punctuation:Fs,reflink:zt,reflinkSearch:ai,tag:ni,text:Ds,url:P},li={...Ie,emStrongLDelim:Ks,emStrongRDelimAst:Qs,emStrongRDelimUnd:Gs,link:g(/^!?\[(label)\]\((.*?)\)/).replace("label",se).getRegex(),reflink:g(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",se).getRegex()},me={...Ie,emStrongRDelimAst:Ws,emStrongLDelim:Hs,delLDelim:Xs,delRDelim:ti,url:g(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ge).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:g(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ge).getRegex()},ci={...me,br:g(At).replace("{2,}","*").getRegex(),text:g(me.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},X={normal:Le,gfm:Ps,pedantic:Ls},K={normal:Ie,gfm:me,breaks:ci,pedantic:li},hi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Xe=r=>hi[r];function C(r,e){if(e){if(k.escapeTest.test(r))return r.replace(k.escapeReplace,Xe)}else if(k.escapeTestNoEncode.test(r))return r.replace(k.escapeReplaceNoEncode,Xe);return r}function et(r){try{r=encodeURI(r).replace(k.percentDecode,"%")}catch{return null}return r}function tt(r,e){let t=r.replace(k.findPipe,(n,o,a)=>{let c=!1,l=o;for(;--l>=0&&a[l]==="\\";)c=!c;return c?"|":" |"}),s=t.split(k.splitPipe),i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(k.slashPipe,"|");return s}function T(r,e,t){let s=r.length;if(s===0)return"";let i=0;for(;i<s&&r.charAt(s-i-1)===e;)i++;return r.slice(0,s-i)}function st(r){let e=r.split(`
131
+ `),t=e.length-1;for(;t>=0&&k.blankLine.test(e[t]);)t--;return e.length-t<=2?r:e.slice(0,t+1).join(`
132
+ `)}function di(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<r.length;s++)if(r[s]==="\\")s++;else if(r[s]===e[0])t++;else if(r[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function pi(r,e=0){let t=e,s="";for(let i of r)if(i===" "){let n=4-t%4;s+=" ".repeat(n),t+=n}else s+=i,t++;return s}function it(r,e,t,s,i){let n=e.href,o=e.title||null,a=r[1].replace(i.other.outputLinkReplace,"$1"),c=r[0].charAt(0)==="!";s.state.inLink=!0;let l=s.state.linkEmitted,p=s.state.inRawBlock;s.state.linkEmitted=!1;let d=s.inlineTokens(a),f=s.state.linkEmitted;if(s.state.linkEmitted=l,s.state.inLink=!1,!c){if(f){s.state.inRawBlock=p;return}s.state.linkEmitted=!0}return{type:c?"image":"link",raw:t,href:n,title:o,text:a,tokens:d}}function ui(r,e,t){let s=r.match(t.other.indentCodeCompensation);if(s===null)return e;let i=s[1];return e.split(`
120
133
  `).map(n=>{let o=n.match(t.other.beginningSpace);if(o===null)return n;let[a]=o;return a.length>=i.length?n.slice(i.length):n}).join(`
121
- `)}var re=class{options;rules;lexer;constructor(r){this.options=r||M}space(r){let e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){let e=this.rules.block.code.exec(r);if(e){let t=this.options.pedantic?e[0]:st(e[0]),s=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:s}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let t=e[0],s=pi(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(r){let e=this.rules.block.heading.exec(r);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=T(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:T(e[0],`
134
+ `)}var ie=class{options;rules;lexer;constructor(r){this.options=r||F}space(r){let e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){let e=this.rules.block.code.exec(r);if(e){let t=this.options.pedantic?e[0]:st(e[0]),s=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:s}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let t=e[0],s=ui(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(r){let e=this.rules.block.heading.exec(r);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=T(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:T(e[0],`
122
135
  `),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(r){let e=this.rules.block.hr.exec(r);if(e)return{type:"hr",raw:T(e[0],`
123
136
  `)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=T(e[0],`
124
137
  `).split(`
125
- `),s="",i="",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 h=a.join(`
126
- `),p=h.replace(this.rules.other.blockquoteSetextReplace,`
138
+ `),s="",i="",n=[];for(;t.length>0;){let o=!1,a=[],c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))a.push(t[c]),o=!0;else if(!o)a.push(t[c]);else break;t=t.slice(c);let l=a.join(`
139
+ `),p=l.replace(this.rules.other.blockquoteSetextReplace,`
127
140
  $1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
128
- ${h}`:h,i=i?`${i}
141
+ ${l}`:l,i=i?`${i}
129
142
  ${p}`:p;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,n,!0),this.lexer.state.top=d,t.length===0)break;let f=n.at(-1);if(f?.type==="code")break;if(f?.type==="blockquote"){let v=f,b=t.join(`
130
143
  `),S=v.raw+`
131
144
  `+b.replace(this.rules.other.blockquoteSetextReplace2,""),j=this.blockquote(S);n[n.length-1]=j,s=`${s}
132
145
  ${b}`,i=i.substring(0,i.length-v.text.length)+j.text;break}else if(f?.type==="list"){let v=f,b=v.raw+`
133
146
  `+t.join(`
134
147
  `),S=this.list(b);n[n.length-1]=S,s=s.substring(0,s.length-f.raw.length)+S.raw,i=i.substring(0,i.length-v.raw.length)+S.raw,t=b.substring(n.at(-1).raw.length).split(`
135
- `);continue}}return{type:"blockquote",raw:s,tokens:n,text:i}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=e[1].trim(),s=t.length>1,i={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let n=this.rules.other.listItemRegex(t),o=!1;for(;r;){let l=!1,h="",p="";if(!(e=n.exec(r))||this.rules.block.hr.test(r))break;h=e[0],r=r.substring(h.length);let d=di(e[2].split(`
148
+ `);continue}}return{type:"blockquote",raw:s,tokens:n,text:i}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=e[1].trim(),s=t.length>1,i={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let n=this.rules.other.listItemRegex(t),o=!1;for(;r;){let c=!1,l="",p="";if(!(e=n.exec(r))||this.rules.block.hr.test(r))break;l=e[0],r=r.substring(l.length);let d=pi(e[2].split(`
136
149
  `,1)[0],e[1].length),f=r.split(`
137
- `,1)[0],v=!d.trim(),b=0;if(this.options.pedantic?(b=2,p=d.trimStart()):v?b=e[1].length+1:(b=d.search(this.rules.other.nonSpaceChar),b=b>4?1:b,p=d.slice(b),b+=e[1].length),v&&this.rules.other.blankLine.test(f)&&(h+=f+`
138
- `,r=r.substring(f.length+1),l=!0),!l){let S=this.rules.other.nextBulletRegex(b),j=this.rules.other.hrRegex(b),De=this.rules.other.fencesBeginRegex(b),Me=this.rules.other.headingBeginRegex(b),Mt=this.rules.other.htmlBeginRegex(b),Ft=this.rules.other.blockquoteBeginRegex(b);for(;r;){let de=r.split(`
139
- `,1)[0],H;if(f=de,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),H=f):H=f.replace(this.rules.other.tabCharGlobal," "),De.test(f)||Me.test(f)||Mt.test(f)||Ft.test(f)||S.test(f)||j.test(f))break;if(H.search(this.rules.other.nonSpaceChar)>=b||!f.trim())p+=`
140
- `+H.slice(b);else{if(v||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||De.test(d)||Me.test(d)||j.test(d))break;p+=`
141
- `+f}v=!f.trim(),h+=de+`
142
- `,r=r.substring(de.length+1),d=H.slice(b)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(o=!0)),i.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),i.raw+=h}let a=i.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let l of i.items)if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),!i.loose){let h=l.tokens.filter(d=>d.type==="space"),p=h.length>0&&h.some(d=>this.rules.other.anyLine.test(d.raw));i.loose=p}for(let l of i.items){let h=l.tokens[0];if(l.task&&(h?.type==="text"||h?.type==="paragraph")){l.text=l.text.replace(this.rules.other.listReplaceTask,""),h.raw=h.raw.replace(this.rules.other.listReplaceTask,""),h.text=h.text.replace(this.rules.other.listReplaceTask,"");for(let d=this.lexer.inlineQueue.length-1;d>=0;d--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[d].src)){this.lexer.inlineQueue[d].src=this.lexer.inlineQueue[d].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(l.raw);if(p){let d={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};l.checked=d.checked,i.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=d.raw+l.tokens[0].raw,l.tokens[0].text=d.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(d)):l.tokens.unshift({type:"paragraph",raw:d.raw,text:d.raw,tokens:[d]}):l.tokens.unshift(d)}}else l.task&&(l.task=!1)}if(i.loose)for(let l of i.items){l.loose=!0;for(let h of l.tokens)h.type==="text"&&(h.type="paragraph")}return i}}html(r){let e=this.rules.block.html.exec(r);if(e){let t=st(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(r){let e=this.rules.block.def.exec(r);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:T(e[0],`
150
+ `,1)[0],v=!d.trim(),b=0;if(this.options.pedantic?(b=2,p=d.trimStart()):v?b=e[1].length+1:(b=d.search(this.rules.other.nonSpaceChar),b=b>4?1:b,p=d.slice(b),b+=e[1].length),v&&this.rules.other.blankLine.test(f)&&(l+=f+`
151
+ `,r=r.substring(f.length+1),c=!0),!c){let S=this.rules.other.nextBulletRegex(b),j=this.rules.other.hrRegex(b),De=this.rules.other.fencesBeginRegex(b),Fe=this.rules.other.headingBeginRegex(b),Mt=this.rules.other.htmlBeginRegex(b),Nt=this.rules.other.blockquoteBeginRegex(b);for(;r;){let he=r.split(`
152
+ `,1)[0],H;if(f=he,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),H=f):H=f.replace(this.rules.other.tabCharGlobal," "),De.test(f)||Fe.test(f)||Mt.test(f)||Nt.test(f)||S.test(f)||j.test(f))break;if(H.search(this.rules.other.nonSpaceChar)>=b||!f.trim())p+=`
153
+ `+H.slice(b);else{if(v||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||De.test(d)||Fe.test(d)||j.test(d))break;p+=`
154
+ `+f}v=!f.trim(),l+=he+`
155
+ `,r=r.substring(he.length+1),d=H.slice(b)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(l)&&(o=!0)),i.items.push({type:"list_item",raw:l,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),i.raw+=l}let a=i.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let c of i.items)if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),!i.loose){let l=c.tokens.filter(d=>d.type==="space"),p=l.length>0&&l.some(d=>this.rules.other.anyLine.test(d.raw));i.loose=p}for(let c of i.items){let l=c.tokens[0];if(c.task&&(l?.type==="text"||l?.type==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),l.raw=l.raw.replace(this.rules.other.listReplaceTask,""),l.text=l.text.replace(this.rules.other.listReplaceTask,"");for(let d=this.lexer.inlineQueue.length-1;d>=0;d--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[d].src)){this.lexer.inlineQueue[d].src=this.lexer.inlineQueue[d].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(c.raw);if(p){let d={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};c.checked=d.checked,i.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=d.raw+c.tokens[0].raw,c.tokens[0].text=d.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(d)):c.tokens.unshift({type:"paragraph",raw:d.raw,text:d.raw,tokens:[d]}):c.tokens.unshift(d)}}else c.task&&(c.task=!1)}if(i.loose)for(let c of i.items){c.loose=!0;for(let l of c.tokens)l.type==="text"&&(l.type="paragraph")}return i}}html(r){let e=this.rules.block.html.exec(r);if(e){let t=st(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(r){let e=this.rules.block.def.exec(r);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:T(e[0],`
143
156
  `),href:s,title:i}}}table(r){let e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=tt(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
144
157
  `):[],n={type:"table",raw:T(e[0],`
145
- `),header:[],align:[],rows:[]};if(t.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?n.align.push("right"):this.rules.other.tableAlignCenter.test(o)?n.align.push("center"):this.rules.other.tableAlignLeft.test(o)?n.align.push("left"):n.align.push(null);for(let o=0;o<t.length;o++)n.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:n.align[o]});for(let o of i)n.rows.push(tt(o,n.header.length).map((a,l)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:n.align[l]})));return n}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e){let t=e[1].trim();return{type:"heading",raw:T(e[0],`
158
+ `),header:[],align:[],rows:[]};if(t.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?n.align.push("right"):this.rules.other.tableAlignCenter.test(o)?n.align.push("center"):this.rules.other.tableAlignLeft.test(o)?n.align.push("left"):n.align.push(null);for(let o=0;o<t.length;o++)n.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:n.align[o]});for(let o of i)n.rows.push(tt(o,n.header.length).map((a,c)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:n.align[c]})));return n}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e){let t=e[1].trim();return{type:"heading",raw:T(e[0],`
146
159
  `),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(r){let e=this.rules.block.paragraph.exec(r);if(e){let t=e[1].charAt(e[1].length-1)===`
147
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(r){let e=this.rules.inline.link.exec(r);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let n=T(t.slice(0,-1),"\\");if((t.length-n.length)%2===0)return}else{let n=hi(e[2],"()");if(n===-2)return;if(n>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+n;e[2]=e[2].substring(0,n),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let s=e[2],i="";if(this.options.pedantic){let n=this.rules.other.pedanticHrefTitle.exec(s);n&&(s=n[1],i=n[3])}else i=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),it(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[s.toLowerCase()];if(!i){let n=t[0].charAt(0);return{type:"text",raw:n,text:n}}return it(t,i,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(r);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,n,o,a=i,l=0,h=s[0][0],p=t===h,d=h==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,e=e.slice(-1*r.length+i);(s=d.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n)continue;if(o=[...n].length,s[3]||s[4]){a+=o;continue}else if(s[5]||s[6]){if(i%3&&!((i+o)%3)){l+=o;continue}if(p)break}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let f=[...s[0]][0].length,v=r.slice(0,i+s.index+f+o);if(Math.min(i,o)%2){let S=v.slice(1,-1);return{type:"em",raw:v,text:S,tokens:this.lexer.inlineTokens(S)}}let b=v.slice(2,-2);return{type:"strong",raw:v,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r,e,t=""){let s=this.rules.inline.delLDelim.exec(r);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,n,o,a=i,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*r.length+i);(s=l.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n||(o=[...n].length,o!==i))continue;if(s[3]||s[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let h=[...s[0]][0].length,p=r.slice(0,i+s.index+h+o),d=p.slice(i,-i);return{type:"del",raw:p,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(r){let e=this.rules.inline.autolink.exec(r);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(r){let e;if(e=this.rules.inline.url.exec(r)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(r){let e=this.rules.inline.text.exec(r);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},w=class ve{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 re,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:y,block:ee.normal,inline:K.normal};this.options.pedantic?(t.block=ee.pedantic,t.inline=K.pedantic):this.options.gfm&&(t.block=ee.gfm,this.options.breaks?t.inline=K.breaks:t.inline=K.gfm),this.tokenizer.rules=t}static get rules(){return{block:ee,inline:K}}static lex(e,t){return new ve(t).lex(e)}static lexInline(e,t){return new ve(t).inlineTokens(e)}lex(e){e=e.replace(y.carriageReturn,`
148
- `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(y.tabCharGlobal," ").replace(y.spaceLine,""));let i=1/0;for(;e;){if(e.length<i)i=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let n;if(this.options.extensions?.block?.some(a=>(n=a.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))continue;if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length);let a=t.at(-1);n.raw.length===1&&a!==void 0?a.raw+=`
160
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(r){let e=this.rules.inline.link.exec(r);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let n=T(t.slice(0,-1),"\\");if((t.length-n.length)%2===0)return}else{let n=di(e[2],"()");if(n===-2)return;if(n>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+n;e[2]=e[2].substring(0,n),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let s=e[2],i="";if(this.options.pedantic){let n=this.rules.other.pedanticHrefTitle.exec(s);n&&(s=n[1],i=n[3])}else i=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),it(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[s.toLowerCase()];if(!i){let n=t[0].charAt(0);return{type:"text",raw:n,text:n}}return it(t,i,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(r);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,n,o,a=i,c=0,l=s[0][0],p=t===l,d=l==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,e=e.slice(-1*r.length+i);(s=d.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n)continue;if(o=[...n].length,s[3]||s[4]){a+=o;continue}else if(s[5]||s[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(p)break}if(a-=o,a>0)continue;o=Math.min(o,o+a+c);let f=[...s[0]][0].length,v=r.slice(0,i+s.index+f+o);if(Math.min(i,o)%2){let S=v.slice(1,-1);return{type:"em",raw:v,text:S,tokens:this.lexer.inlineTokens(S)}}let b=v.slice(2,-2);return{type:"strong",raw:v,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r,e,t=""){let s=this.rules.inline.delLDelim.exec(r);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,n,o,a=i,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*r.length+i);(s=c.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n||(o=[...n].length,o!==i))continue;if(s[3]||s[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let l=[...s[0]][0].length,p=r.slice(0,i+s.index+l+o),d=p.slice(i,-i);return{type:"del",raw:p,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(r){let e=this.rules.inline.autolink.exec(r);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(r){let e;if(e=this.rules.inline.url.exec(r)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(r){let e=this.rules.inline.text.exec(r);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},w=class xe{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||F,this.options.tokenizer=this.options.tokenizer||new ie,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:k,block:X.normal,inline:K.normal};this.options.pedantic?(t.block=X.pedantic,t.inline=K.pedantic):this.options.gfm&&(t.block=X.gfm,this.options.breaks?t.inline=K.breaks:t.inline=K.gfm),this.tokenizer.rules=t}static get rules(){return{block:X,inline:K}}static lex(e,t){return new xe(t).lex(e)}static lexInline(e,t){return new xe(t).inlineTokens(e)}lex(e){e=e.replace(k.carriageReturn,`
161
+ `),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(k.tabCharGlobal," ").replace(k.spaceLine,""));let i=1/0;for(;e;){if(e.length<i)i=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let n;if(this.options.extensions?.block?.some(a=>(n=a.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))continue;if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length);let a=t.at(-1);n.raw.length===1&&a!==void 0?a.raw+=`
149
162
  `: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(`
150
163
  `)?"":`
151
164
  `)+n.raw,a.text+=`
152
165
  `+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(`
153
166
  `)?"":`
154
167
  `)+n.raw,a.text+=`
155
- `+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),h;this.options.extensions.startBlock.forEach(p=>{h=p.call({lexer:this},l),typeof h=="number"&&h>=0&&(a=Math.min(a,h))}),a<1/0&&a>=0&&(o=e.substring(0,a+1))}if(this.state.top&&(n=this.tokenizer.paragraph(o))){let a=t.at(-1);s&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
168
+ `+n.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title},t.push(n));continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}let o=e;if(this.options.extensions?.startBlock){let a=1/0,c=e.slice(1),l;this.options.extensions.startBlock.forEach(p=>{l=p.call({lexer:this},c),typeof l=="number"&&l>=0&&(a=Math.min(a,l))}),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(`
156
169
  `)?"":`
157
170
  `)+n.raw,a.text+=`
158
171
  `+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(`
159
172
  `)?"":`
160
173
  `)+n.raw,a.text+=`
161
- `+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,h)=>{let p=h?h.length:0;return a.slice(0,p)+"["+"a".repeat(a.length-p-2)+"]"}),s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let i=!1,n="",o=1/0;for(;e;){if(e.length<o)o=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}i||(n=""),i=!1;let a;if(this.options.extensions?.inline?.some(h=>(a=h.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 h=t.at(-1);a.type==="text"&&h?.type==="text"?(h.raw+=a.raw,h.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 h=1/0,p=e.slice(1),d;this.options.extensions.startInline.forEach(f=>{d=f.call({lexer:this},p),typeof d=="number"&&d>=0&&(h=Math.min(h,d))}),h<1/0&&h>=0&&(l=e.substring(0,h+1))}if(a=this.tokenizer.inlineText(l)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(n=a.raw.slice(-1)),i=!0;let h=t.at(-1);h?.type==="text"?(h.raw+=a.raw,h.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)}},ne=class{options;parser;constructor(r){this.options=r||M}space(r){return""}code({text:r,lang:e,escaped:t}){let s=(e||"").match(y.notSpaceStart)?.[0],i=r.replace(y.endingNewline,"")+`
174
+ `+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(n);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes("["))return!1;let t=this.tokenizer.rules.inline.link;for(let s of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(s[0])&&e.charAt(s.index-1)!=="!")return!0;for(let s of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let i=s[0],n=i.lastIndexOf("[");if(!(i.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,i.slice(n+1,-1)))&&!(n>1&&this.linkInText(i.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=e;if(this.tokens.links&&e.includes("[")){let a=this.tokenizer.rules.inline.reflinkSearch,c=l=>{let p=l.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,l.slice(p+1,-1)))return l;if(p>1&&l.charAt(0)!=="!"){let d=l.slice(1,p-1);if(this.linkInText(d))return"["+d.replace(a,c)+"]["+"a".repeat(l.length-p-2)+"]"}return"["+"a".repeat(l.length-2)+"]"};s=s.replace(a,c)}s=s.replace(this.tokenizer.rules.inline.anyPunctuation,a=>"+".repeat(a.length)),s=s.replace(this.tokenizer.rules.inline.blockSkip,(a,c,l)=>{let p=l?l.length:0;return a.slice(0,p)+"["+"a".repeat(a.length-p-2)+"]"}),s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let i=!1,n="",o=1/0;for(;e;){if(e.length<o)o=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}i||(n=""),i=!1;let a;if(this.options.extensions?.inline?.some(l=>(a=l.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 l=t.at(-1);a.type==="text"&&l?.type==="text"?(l.raw+=a.raw,l.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,s,n)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e,s,n)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let c=e;if(this.options.extensions?.startInline){let l=1/0,p=e.slice(1),d;this.options.extensions.startInline.forEach(f=>{d=f.call({lexer:this},p),typeof d=="number"&&d>=0&&(l=Math.min(l,d))}),l<1/0&&l>=0&&(c=e.substring(0,l+1))}if(a=this.tokenizer.inlineText(c)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(n=a.raw.slice(-1)),i=!0;let l=t.at(-1);l?.type==="text"?(l.raw+=a.raw,l.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)}},re=class{options;parser;constructor(r){this.options=r||F}space(r){return""}code({text:r,lang:e,escaped:t}){let s=(e||"").match(k.notSpaceStart)?.[0],i=r.replace(k.endingNewline,"")+`
162
175
  `;return s?'<pre><code class="language-'+C(s)+'">'+(t?i:C(i,!0))+`</code></pre>
163
176
  `:"<pre><code>"+(t?i:C(i,!0))+`</code></pre>
164
177
  `}blockquote({tokens:r}){return`<blockquote>
@@ -176,16 +189,16 @@ ${this.parser.parse(r)}</blockquote>
176
189
  `}tablerow({text:r}){return`<tr>
177
190
  ${r}</tr>
178
191
  `}tablecell(r){let e=this.parser.parseInline(r.tokens),t=r.header?"th":"td";return(r.align?`<${t} align="${r.align}">`:`<${t}>`)+e+`</${t}>
179
- `}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${C(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:t}){let s=this.parser.parseInline(t),i=et(r);if(i===null)return s;r=i;let n='<a href="'+r+'"';return e&&(n+=' title="'+C(e)+'"'),n+=">"+s+"</a>",n}image({href:r,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let i=et(r);if(i===null)return C(t);r=i;let n=`<img src="${r}" alt="${C(t)}"`;return e&&(n+=` title="${C(e)}"`),n+=">",n}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:C(r.text)}},Oe=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}checkbox({raw:r}){return r}},_=class ye{options;renderer;textRenderer;constructor(e){this.options=e||M,this.options.renderer=this.options.renderer||new ne,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Oe}static parse(e,t){return new ye(t).parse(e)}static parseInline(e,t){return new ye(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let o=i,a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(o.type)){t+=a||"";continue}}let n=i;switch(n.type){case"space":{t+=this.renderer.space(n);break}case"hr":{t+=this.renderer.hr(n);break}case"heading":{t+=this.renderer.heading(n);break}case"code":{t+=this.renderer.code(n);break}case"table":{t+=this.renderer.table(n);break}case"blockquote":{t+=this.renderer.blockquote(n);break}case"list":{t+=this.renderer.list(n);break}case"checkbox":{t+=this.renderer.checkbox(n);break}case"html":{t+=this.renderer.html(n);break}case"def":{t+=this.renderer.def(n);break}case"paragraph":{t+=this.renderer.paragraph(n);break}case"text":{t+=this.renderer.text(n);break}default:{let o='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let s="";for(let i=0;i<e.length;i++){let n=e[i];if(this.options.extensions?.renderers?.[n.type]){let a=this.options.extensions.renderers[n.type].call({parser:this},n);if(a!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(n.type)){s+=a||"";continue}}let o=n;switch(o.type){case"escape":{s+=t.text(o);break}case"html":{s+=t.html(o);break}case"link":{s+=t.link(o);break}case"image":{s+=t.image(o);break}case"checkbox":{s+=t.checkbox(o);break}case"strong":{s+=t.strong(o);break}case"em":{s+=t.em(o);break}case"codespan":{s+=t.codespan(o);break}case"br":{s+=t.br(o);break}case"del":{s+=t.del(o);break}case"text":{s+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return s}},Z=class{options;block;constructor(r){this.options=r||M}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}emStrongMask(r){return r}provideLexer(r=this.block){return r?w.lex:w.lexInline}provideParser(r=this.block){return r?_.parse:_.parseInline}},ui=class{defaults=Te();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=_;Renderer=ne;TextRenderer=Oe;Lexer=w;Tokenizer=re;Hooks=Z;constructor(...r){this.use(...r)}walkTokens(r,e){let t=[];for(let s of r)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let i=s;for(let n of i.header)t=t.concat(this.walkTokens(n.tokens,e));for(let n of i.rows)for(let o of n)t=t.concat(this.walkTokens(o.tokens,e));break}case"list":{let i=s;t=t.concat(this.walkTokens(i.items,e));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(n=>{let o=i[n].flat(1/0);t=t.concat(this.walkTokens(o,e))}):i.tokens&&(t=t.concat(this.walkTokens(i.tokens,e)))}}return t}use(...r){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let n=e.renderers[i.name];n?e.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=n.apply(this,o)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let n=e[i.level];n?n.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),s.extensions=e),t.renderer){let i=this.defaults.renderer||new ne(this.defaults);for(let n in t.renderer){if(!(n in i))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let o=n,a=t.renderer[o],l=i[o];i[o]=(...h)=>{let p=a.apply(i,h);return p===!1&&(p=l.apply(i,h)),p||""}}s.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new re(this.defaults);for(let n in t.tokenizer){if(!(n in i))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let o=n,a=t.tokenizer[o],l=i[o];i[o]=(...h)=>{let p=a.apply(i,h);return p===!1&&(p=l.apply(i,h)),p}}s.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new Z;for(let n in t.hooks){if(!(n in i))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let o=n,a=t.hooks[o],l=i[o];Z.passThroughHooks.has(n)?i[o]=h=>{if(this.defaults.async&&Z.passThroughHooksRespectAsync.has(n))return(async()=>{let d=await a.call(i,h);return l.call(i,d)})();let p=a.call(i,h);return l.call(i,p)}:i[o]=(...h)=>{if(this.defaults.async)return(async()=>{let d=await a.apply(i,h);return d===!1&&(d=await l.apply(i,h)),d})();let p=a.apply(i,h);return p===!1&&(p=l.apply(i,h)),p}}s.hooks=i}if(t.walkTokens){let i=this.defaults.walkTokens,n=t.walkTokens;s.walkTokens=function(o){let a=[];return a.push(n.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return w.lex(r,e??this.defaults)}parser(r,e){return _.parse(r,e??this.defaults)}parseMarkdown(r){return(e,t)=>{let s={...t},i={...this.defaults,...s},n=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return n(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return n(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return n(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=r),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,a=await(i.hooks?await i.hooks.provideLexer(r):r?w.lex:w.lexInline)(o,i),l=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let h=await(i.hooks?await i.hooks.provideParser(r):r?_.parse:_.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(h):h})().catch(n);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer(r):r?w.lex:w.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser(r):r?_.parse:_.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return n(o)}}}onError(r,e){return t=>{if(t.message+=`
180
- Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error occurred:</p><pre>"+C(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},D=new ui;function x(r,e){return D.parse(r,e)}x.options=x.setOptions=function(r){return D.setOptions(r),x.defaults=D.defaults,$t(x.defaults),x};x.getDefaults=Te;x.defaults=M;function fi(...r){return D.use(...r),x.defaults=D.defaults,$t(x.defaults),x}x.use=fi;x.walkTokens=function(r,e){return D.walkTokens(r,e)};x.parseInline=D.parseInline;x.Parser=_;x.parser=_.parse;x.Renderer=ne;x.TextRenderer=Oe;x.Lexer=w;x.lexer=w.lex;x.Tokenizer=re;x.Hooks=Z;x.parse=x;x.options;x.setOptions;x.walkTokens;x.parseInline;_.parse;w.lex;/**
192
+ `}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${C(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:t}){let s=this.parser.parseInline(t),i=et(r);if(i===null)return s;r=i;let n='<a href="'+r+'"';return e&&(n+=' title="'+C(e)+'"'),n+=">"+s+"</a>",n}image({href:r,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let i=et(r);if(i===null)return C(t);r=i;let n=`<img src="${r}" alt="${C(t)}"`;return e&&(n+=` title="${C(e)}"`),n+=">",n}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:C(r.text)}},Oe=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}checkbox({raw:r}){return r}},_=class ve{options;renderer;textRenderer;constructor(e){this.options=e||F,this.options.renderer=this.options.renderer||new re,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Oe}static parse(e,t){return new ve(t).parse(e)}static parseInline(e,t){return new ve(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let o=i,a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(o.type)){t+=a||"";continue}}let n=i;switch(n.type){case"space":{t+=this.renderer.space(n);break}case"hr":{t+=this.renderer.hr(n);break}case"heading":{t+=this.renderer.heading(n);break}case"code":{t+=this.renderer.code(n);break}case"table":{t+=this.renderer.table(n);break}case"blockquote":{t+=this.renderer.blockquote(n);break}case"list":{t+=this.renderer.list(n);break}case"checkbox":{t+=this.renderer.checkbox(n);break}case"html":{t+=this.renderer.html(n);break}case"def":{t+=this.renderer.def(n);break}case"paragraph":{t+=this.renderer.paragraph(n);break}case"text":{t+=this.renderer.text(n);break}default:{let o='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let s="";for(let i=0;i<e.length;i++){let n=e[i];if(this.options.extensions?.renderers?.[n.type]){let a=this.options.extensions.renderers[n.type].call({parser:this},n);if(a!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(n.type)){s+=a||"";continue}}let o=n;switch(o.type){case"escape":{s+=t.text(o);break}case"html":{s+=t.html(o);break}case"link":{s+=t.link(o);break}case"image":{s+=t.image(o);break}case"checkbox":{s+=t.checkbox(o);break}case"strong":{s+=t.strong(o);break}case"em":{s+=t.em(o);break}case"codespan":{s+=t.codespan(o);break}case"br":{s+=t.br(o);break}case"del":{s+=t.del(o);break}case"text":{s+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return s}},Z=class{options;block;constructor(r){this.options=r||F}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}emStrongMask(r){return r}provideLexer(r=this.block){return r?w.lex:w.lexInline}provideParser(r=this.block){return r?_.parse:_.parseInline}},fi=class{defaults=Te();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=_;Renderer=re;TextRenderer=Oe;Lexer=w;Tokenizer=ie;Hooks=Z;constructor(...r){this.use(...r)}walkTokens(r,e){let t=[];for(let s of r)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let i=s;for(let n of i.header)t=t.concat(this.walkTokens(n.tokens,e));for(let n of i.rows)for(let o of n)t=t.concat(this.walkTokens(o.tokens,e));break}case"list":{let i=s;t=t.concat(this.walkTokens(i.items,e));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(n=>{let o=i[n].flat(1/0);t=t.concat(this.walkTokens(o,e))}):i.tokens&&(t=t.concat(this.walkTokens(i.tokens,e)))}}return t}use(...r){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let n=e.renderers[i.name];n?e.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=n.apply(this,o)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let n=e[i.level];n?n.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),s.extensions=e),t.renderer){let i=this.defaults.renderer||new re(this.defaults);for(let n in t.renderer){if(!(n in i))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let o=n,a=t.renderer[o],c=i[o];i[o]=(...l)=>{let p=a.apply(i,l);return p===!1&&(p=c.apply(i,l)),p||""}}s.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new ie(this.defaults);for(let n in t.tokenizer){if(!(n in i))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let o=n,a=t.tokenizer[o],c=i[o];i[o]=(...l)=>{let p=a.apply(i,l);return p===!1&&(p=c.apply(i,l)),p}}s.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new Z;for(let n in t.hooks){if(!(n in i))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let o=n,a=t.hooks[o],c=i[o];Z.passThroughHooks.has(n)?i[o]=l=>{if(this.defaults.async&&Z.passThroughHooksRespectAsync.has(n))return(async()=>{let d=await a.call(i,l);return c.call(i,d)})();let p=a.call(i,l);return c.call(i,p)}:i[o]=(...l)=>{if(this.defaults.async)return(async()=>{let d=await a.apply(i,l);return d===!1&&(d=await c.apply(i,l)),d})();let p=a.apply(i,l);return p===!1&&(p=c.apply(i,l)),p}}s.hooks=i}if(t.walkTokens){let i=this.defaults.walkTokens,n=t.walkTokens;s.walkTokens=function(o){let a=[];return a.push(n.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return w.lex(r,e??this.defaults)}parser(r,e){return _.parse(r,e??this.defaults)}parseMarkdown(r){return(e,t)=>{let s={...t},i={...this.defaults,...s},n=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return n(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return n(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return n(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=r),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,a=await(i.hooks?await i.hooks.provideLexer(r):r?w.lex:w.lexInline)(o,i),c=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let l=await(i.hooks?await i.hooks.provideParser(r):r?_.parse:_.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(l):l})().catch(n);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer(r):r?w.lex:w.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser(r):r?_.parse:_.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return n(o)}}}onError(r,e){return t=>{if(t.message+=`
193
+ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error occurred:</p><pre>"+C(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},D=new fi;function x(r,e){return D.parse(r,e)}x.options=x.setOptions=function(r){return D.setOptions(r),x.defaults=D.defaults,wt(x.defaults),x};x.getDefaults=Te;x.defaults=F;function gi(...r){return D.use(...r),x.defaults=D.defaults,wt(x.defaults),x}x.use=gi;x.walkTokens=function(r,e){return D.walkTokens(r,e)};x.parseInline=D.parseInline;x.Parser=_;x.parser=_.parse;x.Renderer=re;x.TextRenderer=Oe;x.Lexer=w;x.lexer=w.lex;x.Tokenizer=ie;x.Hooks=Z;x.parse=x;x.options;x.setOptions;x.walkTokens;x.parseInline;_.parse;w.lex;/**
181
194
  * @license
182
195
  * Copyright 2017 Google LLC
183
196
  * SPDX-License-Identifier: BSD-3-Clause
184
- */const gi={CHILD:2},bi=r=>(...e)=>({_$litDirective$:r,values:e});class mi{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,s){this._$Ct=e,this._$AM=t,this._$Ci=s}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
197
+ */const bi={CHILD:2},mi=r=>(...e)=>({_$litDirective$:r,values:e});class xi{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)}}/**
185
198
  * @license
186
199
  * Copyright 2017 Google LLC
187
200
  * SPDX-License-Identifier: BSD-3-Clause
188
- */class ke extends mi{constructor(e){if(super(e),this.it=m,e.type!==gi.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===m||e==null)return this._t=void 0,this.it=e;if(e===O)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}ke.directiveName="unsafeHTML",ke.resultType=1;const xi=bi(ke);let rt=0;class vi extends ${static{this.properties={tags:{attribute:!1},active:{attribute:!1},onToggle:{attribute:!1},allowCreate:{attribute:!1},width:{attribute:!1}}}#e=new u("");#t=new u(!1);#s=new u(-1);#n;#r;static{this.styles=R`
201
+ */class ke extends xi{constructor(e){if(super(e),this.it=m,e.type!==bi.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===m||e==null)return this._t=void 0,this.it=e;if(e===O)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}ke.directiveName="unsafeHTML",ke.resultType=1;const vi=mi(ke);let rt=0;class ki extends ${static{this.properties={tags:{attribute:!1},active:{attribute:!1},onToggle:{attribute:!1},allowCreate:{attribute:!1},width:{attribute:!1}}}#e=new u("");#t=new u(!1);#s=new u(-1);#n;#r;static{this.styles=R`
189
202
  :host {
190
203
  display: inline-block;
191
204
  position: relative;
@@ -299,10 +312,10 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
299
312
  .option input { margin: 0; pointer-events: none; }
300
313
  .empty { padding: 6px 8px; opacity: 0.6; font-style: italic; font-size: 12px; }
301
314
  .create-option { color: var(--accent); font-style: italic; }
302
- `}constructor(){super(),new ce(this),this.tags=[],this.active=[],this.onToggle=()=>{},this.allowCreate=!1,this.#n=`--tag-multiselect-${++rt}`,this.#r=`tag-multiselect-listbox-${rt}`}willUpdate(){this.style.width=this.width??""}#g=e=>{e.composedPath().includes(this)||this.#l()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#g)}disconnectedCallback(){document.removeEventListener("click",this.#g),super.disconnectedCallback()}get#a(){const e=this.#e.value.trim().toLowerCase();return e?this.tags.filter(t=>t.toLowerCase().includes(e)):this.tags}#i(){this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#l(){this.#t.set(!1),this.#s.set(-1),this.renderRoot.querySelector(".menu")?.hidePopover()}#u(){this.#t.value?this.#l():(this.#i(),this.renderRoot.querySelector(".input")?.focus())}#h(e){this.#e.set(e.target.value),this.#s.set(-1),this.#i()}#d(e){this.onToggle(e),this.#e.set(""),this.#s.set(-1)}get#o(){if(!this.allowCreate)return!1;const e=this.#e.value.trim();return e.length>0&&!this.tags.includes(e)&&!this.active.includes(e)}#f(e){e.stopPropagation(),this.active.forEach(t=>this.onToggle(t)),this.#e.set(""),this.renderRoot.querySelector(".input")?.focus(),this.#i()}#b(e){const t=this.#a;if(e.key==="ArrowDown")e.preventDefault(),this.#i(),t.length&&this.#s.set((this.#s.value+1)%t.length);else if(e.key==="ArrowUp")e.preventDefault(),this.#i(),t.length&&this.#s.set((this.#s.value-1+t.length)%t.length);else if(e.key==="Enter"||this.allowCreate&&e.key===","){const s=t[this.#s.value];s!==void 0?(e.preventDefault(),this.#d(s)):this.#o&&(e.preventDefault(),this.#d(this.#e.value.trim()))}else if(e.key==="Backspace"&&!this.#e.value&&this.active.length>0){const s=this.active[this.active.length-1];s!==void 0&&this.onToggle(s)}else e.key==="Escape"&&this.#l()}render(){const e=this.active,t=this.#a,s=this.#t.value,i=this.#s.value;return c`
315
+ `}constructor(){super(),new le(this),this.tags=[],this.active=[],this.onToggle=()=>{},this.allowCreate=!1,this.#n=`--tag-multiselect-${++rt}`,this.#r=`tag-multiselect-listbox-${rt}`}willUpdate(){this.style.width=this.width??""}#g=e=>{e.composedPath().includes(this)||this.#l()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#g)}disconnectedCallback(){document.removeEventListener("click",this.#g),super.disconnectedCallback()}get#a(){const e=this.#e.value.trim().toLowerCase();return e?this.tags.filter(t=>t.toLowerCase().includes(e)):this.tags}#i(){this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#l(){this.#t.set(!1),this.#s.set(-1),this.renderRoot.querySelector(".menu")?.hidePopover()}#u(){this.#t.value?this.#l():(this.#i(),this.renderRoot.querySelector(".input")?.focus())}#h(e){this.#e.set(e.target.value),this.#s.set(-1),this.#i()}#d(e){this.onToggle(e),this.#e.set(""),this.#s.set(-1)}get#o(){if(!this.allowCreate)return!1;const e=this.#e.value.trim();return e.length>0&&!this.tags.includes(e)&&!this.active.includes(e)}#f(e){e.stopPropagation(),this.active.forEach(t=>this.onToggle(t)),this.#e.set(""),this.renderRoot.querySelector(".input")?.focus(),this.#i()}#b(e){const t=this.#a;if(e.key==="ArrowDown")e.preventDefault(),this.#i(),t.length&&this.#s.set((this.#s.value+1)%t.length);else if(e.key==="ArrowUp")e.preventDefault(),this.#i(),t.length&&this.#s.set((this.#s.value-1+t.length)%t.length);else if(e.key==="Enter"||this.allowCreate&&e.key===","){const s=t[this.#s.value];s!==void 0?(e.preventDefault(),this.#d(s)):this.#o&&(e.preventDefault(),this.#d(this.#e.value.trim()))}else if(e.key==="Backspace"&&!this.#e.value&&this.active.length>0){const s=this.active[this.active.length-1];s!==void 0&&this.onToggle(s)}else e.key==="Escape"&&this.#l()}render(){const e=this.active,t=this.#a,s=this.#t.value,i=this.#s.value;return h`
303
316
  <div class="field" style=${`anchor-name: ${this.#n}`}>
304
317
  <div class="chips-and-input">
305
- ${e.map(n=>c`
318
+ ${e.map(n=>h`
306
319
  <span class="selected-chip">
307
320
  ${n}
308
321
  <span class="remove" @click=${()=>this.onToggle(n)}>✕</span>
@@ -323,7 +336,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
323
336
  @keydown=${n=>this.#b(n)}
324
337
  />
325
338
  </div>
326
- ${e.length>0?c`<button class="clear-btn" tabindex="-1" @mousedown=${n=>n.preventDefault()} @click=${n=>this.#f(n)}>✕</button>`:""}
339
+ ${e.length>0?h`<button class="clear-btn" tabindex="-1" @mousedown=${n=>n.preventDefault()} @click=${n=>this.#f(n)}>✕</button>`:""}
327
340
  <button
328
341
  class="chevron-btn ${s?"open":""}"
329
342
  tabindex="-1"
@@ -342,7 +355,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
342
355
  popover="manual"
343
356
  style=${`position-anchor: ${this.#n}`}
344
357
  >
345
- ${t.length?t.map((n,o)=>c`
358
+ ${t.length?t.map((n,o)=>h`
346
359
  <li
347
360
  id=${`${this.#r}-opt-${o}`}
348
361
  role="option"
@@ -354,7 +367,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
354
367
  <input type="checkbox" .checked=${e.includes(n)} tabindex="-1" />
355
368
  ${n}
356
369
  </li>
357
- `):this.#o?c`
370
+ `):this.#o?h`
358
371
  <li
359
372
  class="option create-option"
360
373
  @mousedown=${n=>n.preventDefault()}
@@ -362,9 +375,9 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
362
375
  >
363
376
  No match. Create '${this.#e.value.trim()}'
364
377
  </li>
365
- `:c`<li class="empty">${this.allowCreate?"Type to create a tag":"No matches"}</li>`}
378
+ `:h`<li class="empty">${this.allowCreate?"Type to create a tag":"No matches"}</li>`}
366
379
  </ul>
367
- `}}customElements.define("tag-multiselect",vi);let nt=0;class yi extends ${static{this.properties={options:{attribute:!1},value:{attribute:!1},onChange:{attribute:!1}}}#e=new u("");#t=new u(!1);#s=new u(-1);#n;#r;static{this.styles=R`
380
+ `}}customElements.define("tag-multiselect",ki);let nt=0;class yi extends ${static{this.properties={options:{attribute:!1},value:{attribute:!1},onChange:{attribute:!1}}}#e=new u("");#t=new u(!1);#s=new u(-1);#n;#r;static{this.styles=R`
368
381
  :host {
369
382
  display: inline-block;
370
383
  position: relative;
@@ -451,7 +464,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
451
464
  .option.selected { font-weight: 600; }
452
465
  .empty { padding: 6px 8px; opacity: 0.6; font-style: italic; font-size: 12px; }
453
466
  .create-option { color: var(--accent); font-style: italic; }
454
- `}constructor(){super(),new ce(this),this.options=[],this.value="",this.onChange=()=>{},this.#n=`--status-select-${++nt}`,this.#r=`status-select-listbox-${nt}`}#g=e=>{e.composedPath().includes(this)||this.#l()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#g)}disconnectedCallback(){document.removeEventListener("click",this.#g),super.disconnectedCallback()}get#a(){const e=this.#e.value.trim().toLowerCase();return!e||e===this.value.trim().toLowerCase()?this.options:this.options.filter(t=>t.toLowerCase().includes(e))}#i(){this.#e.set(this.value),this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#l(){this.#t.set(!1),this.#s.set(-1),this.#e.set(this.value),this.renderRoot.querySelector(".menu")?.hidePopover()}#u(){this.#t.value?this.#l():(this.#i(),this.renderRoot.querySelector(".input")?.focus())}#h(e){this.#e.set(e.target.value),this.#s.set(-1),this.#t.value||this.#i()}#d(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}#o(e){const t=this.#d(e);if(!t)return this.#l();this.onChange(t),this.#e.set(t),this.#s.set(-1),this.#l()}get#f(){const e=this.#d(this.#e.value);return e.length>0&&!this.options.some(t=>t.toLowerCase()===e)}get#b(){return this.#a.length+(this.#f?1:0)}#k(e){const t=this.#b;if(e.key==="ArrowDown")e.preventDefault(),this.#i(),t&&this.#s.set((this.#s.value+1)%t);else if(e.key==="ArrowUp")e.preventDefault(),this.#i(),t&&this.#s.set((this.#s.value-1+t)%t);else if(e.key==="Enter"){e.preventDefault();const s=this.#a,i=s[this.#s.value];i!==void 0?this.#o(i):this.#s.value===s.length&&this.#f?this.#o(this.#e.value):this.#e.value.trim()&&this.#o(this.#e.value)}else e.key==="Escape"&&(e.preventDefault(),this.#l())}render(){const e=this.value,t=this.#a,s=this.#t.value,i=this.#s.value;return c`
467
+ `}constructor(){super(),new le(this),this.options=[],this.value="",this.onChange=()=>{},this.#n=`--status-select-${++nt}`,this.#r=`status-select-listbox-${nt}`}#g=e=>{e.composedPath().includes(this)||this.#l()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#g)}disconnectedCallback(){document.removeEventListener("click",this.#g),super.disconnectedCallback()}get#a(){const e=this.#e.value.trim().toLowerCase();return!e||e===this.value.trim().toLowerCase()?this.options:this.options.filter(t=>t.toLowerCase().includes(e))}#i(){this.#e.set(this.value),this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#l(){this.#t.set(!1),this.#s.set(-1),this.#e.set(this.value),this.renderRoot.querySelector(".menu")?.hidePopover()}#u(){this.#t.value?this.#l():(this.#i(),this.renderRoot.querySelector(".input")?.focus())}#h(e){this.#e.set(e.target.value),this.#s.set(-1),this.#t.value||this.#i()}#d(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}#o(e){const t=this.#d(e);if(!t)return this.#l();this.onChange(t),this.#e.set(t),this.#s.set(-1),this.#l()}get#f(){const e=this.#d(this.#e.value);return e.length>0&&!this.options.some(t=>t.toLowerCase()===e)}get#b(){return this.#a.length+(this.#f?1:0)}#y(e){const t=this.#b;if(e.key==="ArrowDown")e.preventDefault(),this.#i(),t&&this.#s.set((this.#s.value+1)%t);else if(e.key==="ArrowUp")e.preventDefault(),this.#i(),t&&this.#s.set((this.#s.value-1+t)%t);else if(e.key==="Enter"){e.preventDefault();const s=this.#a,i=s[this.#s.value];i!==void 0?this.#o(i):this.#s.value===s.length&&this.#f?this.#o(this.#e.value):this.#e.value.trim()&&this.#o(this.#e.value)}else e.key==="Escape"&&(e.preventDefault(),this.#l())}render(){const e=this.value,t=this.#a,s=this.#t.value,i=this.#s.value;return h`
455
468
  <div class="field" style=${`anchor-name: ${this.#n}`}>
456
469
  <input
457
470
  class="input"
@@ -464,7 +477,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
464
477
  @input=${n=>this.#h(n)}
465
478
  @focus=${()=>this.#i()}
466
479
  @click=${()=>this.#i()}
467
- @keydown=${n=>this.#k(n)}
480
+ @keydown=${n=>this.#y(n)}
468
481
  @blur=${()=>{this.#t.value&&this.#e.value.trim()&&this.#d(this.#e.value)!==e?this.#o(this.#e.value):this.#l()}}
469
482
  />
470
483
  <button
@@ -484,7 +497,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
484
497
  popover="manual"
485
498
  style=${`position-anchor: ${this.#n}`}
486
499
  >
487
- ${t.map((n,o)=>c`
500
+ ${t.map((n,o)=>h`
488
501
  <li
489
502
  id=${`${this.#r}-opt-${o}`}
490
503
  role="option"
@@ -496,7 +509,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
496
509
  ${n}
497
510
  </li>
498
511
  `)}
499
- ${this.#f?c`
512
+ ${this.#f?h`
500
513
  <li
501
514
  id=${`${this.#r}-opt-${t.length}`}
502
515
  role="option"
@@ -507,9 +520,9 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
507
520
  ${t.length?"Create":"No match. Create"} '${this.#d(this.#e.value)}'
508
521
  </li>
509
522
  `:""}
510
- ${!t.length&&!this.#f?c`<li class="empty">No options</li>`:""}
523
+ ${!t.length&&!this.#f?h`<li class="empty">No options</li>`:""}
511
524
  </ul>
512
- `}}customElements.define("status-select",yi);let ki=0;const $i={top:"top: auto; bottom: anchor(top); left: anchor(center); right: auto; translate: -50% 0; margin-top: 0; margin-bottom: 6px;",bottom:"top: anchor(bottom); bottom: auto; left: anchor(center); right: auto; translate: -50% 0; margin-top: 6px; margin-bottom: 0;",left:"top: anchor(center); bottom: auto; left: auto; right: anchor(left); translate: 0 -50%; margin-right: 6px;",right:"top: anchor(center); bottom: auto; left: anchor(right); right: auto; translate: 0 -50%; margin-left: 6px;"},wi=["top","bottom","left","right"];class _i extends ${static{this.properties={text:{attribute:!1},placement:{attribute:!1}}}#e;#t=null;static{this.styles=R`
525
+ `}}customElements.define("status-select",yi);let $i=0;const wi={top:"top: auto; bottom: anchor(top); left: anchor(center); right: auto; translate: -50% 0; margin-top: 0; margin-bottom: 6px;",bottom:"top: anchor(bottom); bottom: auto; left: anchor(center); right: auto; translate: -50% 0; margin-top: 6px; margin-bottom: 0;",left:"top: anchor(center); bottom: auto; left: auto; right: anchor(left); translate: 0 -50%; margin-right: 6px;",right:"top: anchor(center); bottom: auto; left: anchor(right); right: auto; translate: 0 -50%; margin-left: 6px;"},_i=["top","bottom","left","right"];class Si extends ${static{this.properties={text:{attribute:!1},placement:{attribute:!1}}}#e;#t=null;static{this.styles=R`
513
526
  :host {
514
527
  display: inline-flex;
515
528
  position: relative;
@@ -593,7 +606,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
593
606
  translate: 0 -50%;
594
607
  margin: 0 0 0 6px;
595
608
  }
596
- `}constructor(){super(),this.text="",this.placement="top",this.#e=`--help-tooltip-${++ki}`}get#s(){const e=wi.filter(t=>t!==this.placement);return[this.placement,...e].map(t=>`--bubble-${t}`).join(", ")}disconnectedCallback(){this.#t&&clearTimeout(this.#t),super.disconnectedCallback()}#n(){this.#t&&(clearTimeout(this.#t),this.#t=null);const e=this.renderRoot.querySelector(".bubble");e&&!e.matches(":popover-open")&&e.showPopover()}#r(){this.#t=setTimeout(()=>{this.renderRoot.querySelector(".bubble")?.hidePopover()},100)}render(){return c`
609
+ `}constructor(){super(),this.text="",this.placement="top",this.#e=`--help-tooltip-${++$i}`}get#s(){const e=_i.filter(t=>t!==this.placement);return[this.placement,...e].map(t=>`--bubble-${t}`).join(", ")}disconnectedCallback(){this.#t&&clearTimeout(this.#t),super.disconnectedCallback()}#n(){this.#t&&(clearTimeout(this.#t),this.#t=null);const e=this.renderRoot.querySelector(".bubble");e&&!e.matches(":popover-open")&&e.showPopover()}#r(){this.#t=setTimeout(()=>{this.renderRoot.querySelector(".bubble")?.hidePopover()},100)}render(){return h`
597
610
  <button
598
611
  type="button"
599
612
  class="icon"
@@ -609,13 +622,13 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
609
622
  role="tooltip"
610
623
  class="bubble"
611
624
  popover="manual"
612
- style=${`position-anchor: ${this.#e}; position-try-fallbacks: ${this.#s}; ${$i[this.placement]}`}
625
+ style=${`position-anchor: ${this.#e}; position-try-fallbacks: ${this.#s}; ${wi[this.placement]}`}
613
626
  @mouseenter=${()=>this.#n()}
614
627
  @mouseleave=${()=>this.#r()}
615
628
  >
616
629
  ${this.text}
617
630
  </div>
618
- `}}customElements.define("help-tooltip",_i);const ot="mem-bucket-detail-view-mode";function Si(r){return new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(r))}const Ci=["stable","beta","unreviewed"],Ai=["active","shipped","abandoned"],at=["plan","spec","sql","testing-todo","discovery","session-summary","other"],Ti=["ticket","freeform"],k={description:"What this doc is / does, shown in search results and list views. For skills, this is also the only thing an agent sees before deciding whether to load the full body — so state both what it does and when to use it.",tags:"Free-form keywords used to filter and search. Not the only thing matched during full-text search, but the fastest way to narrow a list view.",status:`Lifecycle state — stable/beta/unreviewed for skills, active/shipped/abandoned for memory docs. Skills default to "unreviewed" if left unset, so low-trust content doesn't read as equivalent to a reviewed pattern.`,name:"The skill's identifier — becomes its containing folder name on disk. Lowercase letters, numbers, and hyphens only.",owner:"Who authored or maintains this skill — a person or team name, free text.",extends:"Name of another skill this one builds on or specializes, if any. Leave blank if it doesn't extend anything.",trigger_phrases:"Extra keyword phrases beyond the description that should surface this skill in search — phrasings a user might type that don't literally appear in the description text.",key:"The lookup handle for this memory doc — usually a ticket ID, sometimes a free-form name. One key can have several docs attached (a plan, a spec, session notes) all retrievable together.",key_type:'"ticket" if the key is a real ticket ID, "freeform" for a name like "Spot Chart Design".',doc_type:"What kind of content this is — shapes how it should be read (a plan reads differently than raw SQL or a session summary).",related_to:"Another key this doc relates to, if any — free text, not validated against existing keys."};function lt(r){return{description:r.description??"",tags:r.tags??[],status:r.status??"",name:r.name??"",owner:r.owner??"",extends:r.extends??"",trigger_phrases:r.trigger_phrases??[],key:r.key??"",key_type:r.key_type??"",doc_type:r.doc_type??"",related_to:r.related_to??""}}class Ei extends ${constructor(){super(...arguments),this._viewMode=localStorage.getItem(ot)??"markdown",this._editing=!1,this._draft=null,this._addingFrontmatter=!1,this._renaming=!1,this._renameValue=""}static{this.properties={selected:{attribute:!1},onChanged:{attribute:!1},facets:{attribute:!1},onTagClick:{attribute:!1},onFolderClick:{attribute:!1},onDateClick:{attribute:!1},onKeyClick:{attribute:!1},_doc:{state:!0},_viewMode:{state:!0},_editing:{state:!0},_draft:{state:!0},_addingFrontmatter:{state:!0},_renaming:{state:!0},_renameValue:{state:!0}}}static{this.styles=R`
631
+ `}}customElements.define("help-tooltip",Si);const ot="mem-bucket-detail-view-mode";function Ci(r){return new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(r))}const Ai=["stable","beta","unreviewed"],Ti=["active","shipped","abandoned"],at=["plan","spec","sql","testing-todo","discovery","session-summary","other"],Ei=["ticket","freeform"],y={description:"What this doc is / does, shown in search results and list views. For skills, this is also the only thing an agent sees before deciding whether to load the full body — so state both what it does and when to use it.",tags:"Free-form keywords used to filter and search. Not the only thing matched during full-text search, but the fastest way to narrow a list view.",status:`Lifecycle state — stable/beta/unreviewed for skills, active/shipped/abandoned for memory docs. Skills default to "unreviewed" if left unset, so low-trust content doesn't read as equivalent to a reviewed pattern.`,name:"The skill's identifier — becomes its containing folder name on disk. Lowercase letters, numbers, and hyphens only.",owner:"Who authored or maintains this skill — a person or team name, free text.",extends:"Name of another skill this one builds on or specializes, if any. Leave blank if it doesn't extend anything.",trigger_phrases:"Extra keyword phrases beyond the description that should surface this skill in search — phrasings a user might type that don't literally appear in the description text.",key:"The lookup handle for this memory doc — usually a ticket ID, sometimes a free-form name. One key can have several docs attached (a plan, a spec, session notes) all retrievable together.",key_type:'"ticket" if the key is a real ticket ID, "freeform" for a name like "Spot Chart Design".',doc_type:"What kind of content this is — shapes how it should be read (a plan reads differently than raw SQL or a session summary).",related_to:"Another key this doc relates to, if any — free text, not validated against existing keys."};function lt(r){return{description:r.description??"",tags:r.tags??[],status:r.status??"",name:r.name??"",owner:r.owner??"",extends:r.extends??"",trigger_phrases:r.trigger_phrases??[],key:r.key??"",key_type:r.key_type??"",doc_type:r.doc_type??"",related_to:r.related_to??""}}class Ri extends ${constructor(){super(...arguments),this._viewMode=localStorage.getItem(ot)??"markdown",this._editing=!1,this._draft=null,this._addingFrontmatter=!1,this._renaming=!1,this._renameValue=""}static{this.properties={selected:{attribute:!1},onChanged:{attribute:!1},facets:{attribute:!1},onTagClick:{attribute:!1},onFolderClick:{attribute:!1},onDateClick:{attribute:!1},onKeyClick:{attribute:!1},_doc:{state:!0},_viewMode:{state:!0},_editing:{state:!0},_draft:{state:!0},_addingFrontmatter:{state:!0},_renaming:{state:!0},_renameValue:{state:!0}}}static{this.styles=R`
619
632
  :host { display: block; padding: 16px; }
620
633
  h2 { margin: 0 0 4px; font-size: 16px; }
621
634
  .title-row {
@@ -904,33 +917,33 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
904
917
  .hint { font-size: 11px; opacity: 0.6; }
905
918
  `}updated(e){e.has("selected")&&this.selected&&(this._editing=!1,this._addingFrontmatter=!1,this._renaming=!1,this.#e(),this.scrollTop=0)}async#e(){const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);this._doc=s.ok?await s.json():null,await this.updateComplete,this.shadowRoot?.querySelector(".markdown-body")?.scrollTo(0,0),this.shadowRoot?.querySelector("pre")?.scrollTo(0,0)}async refresh(){if(!this.selected||this._editing||this._addingFrontmatter||this._renaming)return;const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);if(!s.ok)return;const n=(this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre"))?.scrollTop??0;this._doc=await s.json(),await this.updateComplete;const o=this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre");o&&(o.scrollTop=n)}#t(){this._doc?.source_path&&navigator.clipboard?.writeText(this._doc.source_path)}#s(e){this._viewMode=e,localStorage.setItem(ot,e)}async#n(){const{table:e,id:t}=this.selected,s=!this._doc?.deprecated;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/deprecated`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({deprecated:s})}),await this.#e(),this.onChanged?.()}async#r(){const{table:e,id:t}=this.selected,s=!this._doc?.paused;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/paused`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({paused:s})}),await this.#e(),this.onChanged?.()}async#g(){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?.()}#a(){this._doc&&(this._draft=lt(this._doc),this._editing=!0,this._addingFrontmatter=!1)}#i(){this._doc&&(this._draft=lt(this._doc),this._addingFrontmatter=!0,this._editing=!1)}#l(e){this._draft&&(this._draft={...this._draft,doc_type:e},this._addingFrontmatter=!1,this._editing=!0)}#u(){this._editing=!1,this._addingFrontmatter=!1,this._draft=null}#h(e){this._draft&&(this._draft={...this._draft,...e})}#d(e){if(!this._draft)return;const t=this._draft.tags.includes(e)?this._draft.tags.filter(s=>s!==e):[...this._draft.tags,e];this.#h({tags:t})}#o(e){if(!this._draft)return;const t=this._draft.trigger_phrases.includes(e)?this._draft.trigger_phrases.filter(s=>s!==e):[...this._draft.trigger_phrases,e];this.#h({trigger_phrases:t})}async#f(){if(!this._draft||!this.selected)return;const{table:e,id:t}=this.selected,s=e==="skills",i={description:this._draft.description,tags:this._draft.tags,status:this._draft.status};s?(i.owner=this._draft.owner||null,i.extends=this._draft.extends||null,i.trigger_phrases=this._draft.trigger_phrases):(i.key=this._draft.key,i.key_type=this._draft.key_type,i.doc_type=this._draft.doc_type,i.related_to=this._draft.related_to||null);const n=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({frontmatter:i})});if(!n.ok){const o=await n.json().catch(()=>({}));window.alert(`Save failed: ${o.error??n.statusText}`);return}this._editing=!1,this._draft=null,await this.#e(),this.onChanged?.()}async#b(){if(!this.selected||!this._doc||this.selected.table!=="memory_docs")return;const{table:e,id:t}=this.selected;if(!window.confirm(`Delete frontmatter for "${this._doc.key}"?
906
919
 
907
- This removes the doc's key, tags, and status — it drops out of key-based lookup and full-text search, and becomes a plain unmanaged file, until frontmatter is added again.`))return;const i=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/frontmatter`,{method:"DELETE"});if(!i.ok){const n=await i.json().catch(()=>({}));window.alert(`Delete failed: ${n.error??i.statusText}`);return}this._doc=null,this.selected=null,this.onChanged?.()}#k(){this._doc&&(this._renameValue=this._doc.name??"",this._renaming=!0)}async#x(){if(!this._doc||!this._renameValue.trim())return;const e=this._renameValue.trim();if(e===this._doc.name){this._renaming=!1;return}const t=await fetch(`/api/entries/skills/${encodeURIComponent(this._doc.name)}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({new_name:e})});if(!t.ok){const s=await t.json().catch(()=>({}));window.alert(`Rename failed: ${s.error??t.statusText}`);return}this._renaming=!1,this.selected={table:"skills",id:e},await this.#e(),this.onChanged?.()}#y(){return c`
920
+ This removes the doc's key, tags, and status — it drops out of key-based lookup and full-text search, and becomes a plain unmanaged file, until frontmatter is added again.`))return;const i=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/frontmatter`,{method:"DELETE"});if(!i.ok){const n=await i.json().catch(()=>({}));window.alert(`Delete failed: ${n.error??i.statusText}`);return}this._doc=null,this.selected=null,this.onChanged?.()}#y(){this._doc&&(this._renameValue=this._doc.name??"",this._renaming=!0)}async#x(){if(!this._doc||!this._renameValue.trim())return;const e=this._renameValue.trim();if(e===this._doc.name){this._renaming=!1;return}const t=await fetch(`/api/entries/skills/${encodeURIComponent(this._doc.name)}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({new_name:e})});if(!t.ok){const s=await t.json().catch(()=>({}));window.alert(`Rename failed: ${s.error??t.statusText}`);return}this._renaming=!1,this.selected={table:"skills",id:e},await this.#e(),this.onChanged?.()}#k(){return h`
908
921
  <div class="edit-form">
909
922
  <div class="hint">What kind of doc is this? This shapes which fields apply next.</div>
910
923
  <div class="field">
911
- <label>doc_type <help-tooltip .text=${k.doc_type}></help-tooltip></label>
924
+ <label>doc_type <help-tooltip .text=${y.doc_type}></help-tooltip></label>
912
925
  <select
913
926
  @change=${e=>this.#l(e.target.value)}
914
927
  >
915
928
  <option value="" selected disabled>Choose…</option>
916
- ${at.map(e=>c`<option value=${e}>${e}</option>`)}
929
+ ${at.map(e=>h`<option value=${e}>${e}</option>`)}
917
930
  </select>
918
931
  </div>
919
932
  <div class="form-actions">
920
933
  <button class="cancel" @click=${()=>this.#u()}>Cancel</button>
921
934
  </div>
922
935
  </div>
923
- `}#v(e){const t=this._draft,s=this.facets;return c`
936
+ `}#v(e){const t=this._draft,s=this.facets;return h`
924
937
  <div class="edit-form">
925
- ${e?c`
938
+ ${e?h`
926
939
  <div class="field">
927
- <label>name <help-tooltip .text=${k.name}></help-tooltip></label>
940
+ <label>name <help-tooltip .text=${y.name}></help-tooltip></label>
928
941
  <div class="hint">Renaming moves the skill's folder on disk — kept as a separate action.</div>
929
942
  </div>
930
- `:c`
943
+ `:h`
931
944
  <div class="field-row">
932
945
  <div class="field">
933
- <label>key <help-tooltip .text=${k.key}></help-tooltip></label>
946
+ <label>key <help-tooltip .text=${y.key}></help-tooltip></label>
934
947
  <input
935
948
  type="text"
936
949
  .value=${t.key}
@@ -938,34 +951,34 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
938
951
  />
939
952
  </div>
940
953
  <div class="field">
941
- <label>key_type <help-tooltip .text=${k.key_type}></help-tooltip></label>
954
+ <label>key_type <help-tooltip .text=${y.key_type}></help-tooltip></label>
942
955
  <select
943
956
  .value=${t.key_type}
944
957
  @change=${i=>this.#h({key_type:i.target.value})}
945
958
  >
946
- ${Ti.map(i=>c`<option value=${i} ?selected=${i===t.key_type}>${i}</option>`)}
959
+ ${Ei.map(i=>h`<option value=${i} ?selected=${i===t.key_type}>${i}</option>`)}
947
960
  </select>
948
961
  </div>
949
962
  </div>
950
963
  <div class="field">
951
- <label>doc_type <help-tooltip .text=${k.doc_type}></help-tooltip></label>
964
+ <label>doc_type <help-tooltip .text=${y.doc_type}></help-tooltip></label>
952
965
  <select
953
966
  .value=${t.doc_type}
954
967
  @change=${i=>this.#h({doc_type:i.target.value})}
955
968
  >
956
- ${at.map(i=>c`<option value=${i} ?selected=${i===t.doc_type}>${i}</option>`)}
969
+ ${at.map(i=>h`<option value=${i} ?selected=${i===t.doc_type}>${i}</option>`)}
957
970
  </select>
958
971
  </div>
959
972
  `}
960
973
  <div class="field">
961
- <label>description <help-tooltip .text=${k.description}></help-tooltip></label>
974
+ <label>description <help-tooltip .text=${y.description}></help-tooltip></label>
962
975
  <textarea
963
976
  .value=${t.description}
964
977
  @input=${i=>this.#h({description:i.target.value})}
965
978
  ></textarea>
966
979
  </div>
967
980
  <div class="field">
968
- <label>tags <help-tooltip .text=${k.tags}></help-tooltip></label>
981
+ <label>tags <help-tooltip .text=${y.tags}></help-tooltip></label>
969
982
  <tag-multiselect
970
983
  .tags=${s?.tags??[]}
971
984
  .active=${t.tags}
@@ -974,17 +987,17 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
974
987
  ></tag-multiselect>
975
988
  </div>
976
989
  <div class="field">
977
- <label>status <help-tooltip .text=${k.status}></help-tooltip></label>
990
+ <label>status <help-tooltip .text=${y.status}></help-tooltip></label>
978
991
  <status-select
979
- .options=${[...new Set([...e?Ci:Ai,...s?.statuses??[]])]}
992
+ .options=${[...new Set([...e?Ai:Ti,...s?.statuses??[]])]}
980
993
  .value=${t.status}
981
994
  .onChange=${i=>this.#h({status:i})}
982
995
  ></status-select>
983
996
  </div>
984
- ${e?c`
997
+ ${e?h`
985
998
  <div class="field-row">
986
999
  <div class="field">
987
- <label>owner <help-tooltip .text=${k.owner}></help-tooltip></label>
1000
+ <label>owner <help-tooltip .text=${y.owner}></help-tooltip></label>
988
1001
  <input
989
1002
  type="text"
990
1003
  .value=${t.owner}
@@ -992,7 +1005,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
992
1005
  />
993
1006
  </div>
994
1007
  <div class="field">
995
- <label>extends <help-tooltip .text=${k.extends}></help-tooltip></label>
1008
+ <label>extends <help-tooltip .text=${y.extends}></help-tooltip></label>
996
1009
  <input
997
1010
  type="text"
998
1011
  .value=${t.extends}
@@ -1001,7 +1014,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1001
1014
  </div>
1002
1015
  </div>
1003
1016
  <div class="field">
1004
- <label>trigger_phrases <help-tooltip .text=${k.trigger_phrases}></help-tooltip></label>
1017
+ <label>trigger_phrases <help-tooltip .text=${y.trigger_phrases}></help-tooltip></label>
1005
1018
  <tag-multiselect
1006
1019
  .tags=${[]}
1007
1020
  .active=${t.trigger_phrases}
@@ -1009,9 +1022,9 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1009
1022
  .onToggle=${i=>this.#o(i)}
1010
1023
  ></tag-multiselect>
1011
1024
  </div>
1012
- `:c`
1025
+ `:h`
1013
1026
  <div class="field">
1014
- <label>related_to <help-tooltip .text=${k.related_to}></help-tooltip></label>
1027
+ <label>related_to <help-tooltip .text=${y.related_to}></help-tooltip></label>
1015
1028
  <input
1016
1029
  type="text"
1017
1030
  .value=${t.related_to}
@@ -1024,10 +1037,10 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1024
1037
  <button class="cancel" @click=${()=>this.#u()}>Cancel</button>
1025
1038
  </div>
1026
1039
  </div>
1027
- `}#m(e,t){const s=t?void 0:e.key;return c`
1040
+ `}#m(e,t){const s=t?void 0:e.key;return h`
1028
1041
  <div class="title-row">
1029
1042
  <h2>
1030
- ${s?c`<button class="title-link" title="Search for key '${s}'" @click=${()=>this.onKeyClick?.(s)}>
1043
+ ${s?h`<button class="title-link" title="Search for key '${s}'" @click=${()=>this.onKeyClick?.(s)}>
1031
1044
  ${e.name??s??e.id}
1032
1045
  </button>`:e.name??e.key??e.id}
1033
1046
  </h2>
@@ -1035,33 +1048,33 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1035
1048
  📁 ${e.folder}
1036
1049
  </button>
1037
1050
  </div>
1038
- `}#p(e,t){const s=e.created_at?Si(e.created_at):null;return c`
1051
+ `}#p(e,t){const s=e.created_at?Ci(e.created_at):null;return h`
1039
1052
  <dl class="info-grid">
1040
1053
  <dt>Description</dt>
1041
1054
  <dd class="description">${e.description||"—"}</dd>
1042
1055
 
1043
1056
  <dt>Tags</dt>
1044
1057
  <dd>
1045
- ${e.tags?.length?e.tags.map(i=>c`<button class="pill tag-pill" @click=${()=>this.onTagClick?.(i)}>${i}</button>`):c`<span class="hint">no tags</span>`}
1058
+ ${e.tags?.length?e.tags.map(i=>h`<button class="pill tag-pill" @click=${()=>this.onTagClick?.(i)}>${i}</button>`):h`<span class="hint">no tags</span>`}
1046
1059
  </dd>
1047
1060
 
1048
1061
  <dt>Status</dt>
1049
1062
  <dd>${e.status}</dd>
1050
1063
 
1051
- ${e.deprecated||e.paused?c`
1064
+ ${e.deprecated||e.paused?h`
1052
1065
  <dt>Flags</dt>
1053
1066
  <dd>
1054
- ${e.deprecated?c`<span class="pill warn-pill">deprecated</span>`:m}
1055
- ${e.paused?c`<span class="pill muted-pill">paused</span>`:m}
1067
+ ${e.deprecated?h`<span class="pill warn-pill">deprecated</span>`:m}
1068
+ ${e.paused?h`<span class="pill muted-pill">paused</span>`:m}
1056
1069
  </dd>
1057
1070
  `:m}
1058
1071
 
1059
- ${t?c`
1060
- ${e.owner?c`<dt>Owner</dt>
1072
+ ${t?h`
1073
+ ${e.owner?h`<dt>Owner</dt>
1061
1074
  <dd>${e.owner}</dd>`:m}
1062
- ${e.extends?c`<dt>Extends</dt>
1075
+ ${e.extends?h`<dt>Extends</dt>
1063
1076
  <dd>${e.extends}</dd>`:m}
1064
- `:c`
1077
+ `:h`
1065
1078
  <dt>Key</dt>
1066
1079
  <dd>
1067
1080
  <button class="key-link" title="Search for this key" @click=${()=>e.key&&this.onKeyClick?.(e.key)}>
@@ -1075,22 +1088,22 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1075
1088
  <dt>Doc type</dt>
1076
1089
  <dd>${e.doc_type}</dd>
1077
1090
 
1078
- ${e.related_to?c`<dt>Related to</dt>
1091
+ ${e.related_to?h`<dt>Related to</dt>
1079
1092
  <dd>${e.related_to}</dd>`:m}
1080
1093
  `}
1081
1094
 
1082
1095
  <dt>Created</dt>
1083
1096
  <dd>
1084
- ${s?c`<span class="date-value" title="Filter to this day" @click=${()=>this.onDateClick?.(s)}
1097
+ ${s?h`<span class="date-value" title="Filter to this day" @click=${()=>this.onDateClick?.(s)}
1085
1098
  >${s}</span
1086
- >`:c`<span class="hint">unknown</span>`}
1099
+ >`:h`<span class="hint">unknown</span>`}
1087
1100
  </dd>
1088
1101
  </dl>
1089
- `}#$(e,t){const s=new x.Renderer,i=s.link.bind(s);return s.link=n=>{if(typeof n.href=="string"&&n.href.startsWith("attachment://")){const o=n.href.slice(13);return i({...n,href:`/api/entries/${e}/${encodeURIComponent(t)}/attachments/${encodeURIComponent(o)}`})}return i(n)},s}#w(e,t){return e.attachments?.length?c`
1102
+ `}#$(e,t){const s=new x.Renderer,i=s.link.bind(s);return s.link=n=>{if(typeof n.href=="string"&&n.href.startsWith("attachment://")){const o=n.href.slice(13);return i({...n,href:`/api/entries/${e}/${encodeURIComponent(t)}/attachments/${encodeURIComponent(o)}`})}return i(n)},s}#w(e,t){return e.attachments?.length?h`
1090
1103
  <div class="attachments-section">
1091
1104
  <h4>Attachments</h4>
1092
1105
  <ul>
1093
- ${e.attachments.map(s=>c`
1106
+ ${e.attachments.map(s=>h`
1094
1107
  <li>
1095
1108
  <a href="/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(s.filename)}/view" target="_blank" rel="noopener"
1096
1109
  >${s.filename}</a
@@ -1106,21 +1119,21 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1106
1119
  `)}
1107
1120
  </ul>
1108
1121
  </div>
1109
- `:m}render(){if(!this.selected)return c`<div class="empty">Select an entry to view its details.</div>`;if(!this._doc)return m;const e=this._doc,t=this.selected.table==="skills",s=t&&e.folder==="builtin",i=!t&&e.has_frontmatter===!1;return this._addingFrontmatter?c`${this.#m(e,t)}${this.#y()}`:this._editing&&this._draft?c`${this.#m(e,t)}${this.#v(t)}`:c`
1122
+ `:m}render(){if(!this.selected)return h`<div class="empty">Select an entry to view its details.</div>`;if(!this._doc)return m;const e=this._doc,t=this.selected.table==="skills",s=t&&e.folder==="builtin",i=!t&&e.has_frontmatter===!1;return this._addingFrontmatter?h`${this.#m(e,t)}${this.#k()}`:this._editing&&this._draft?h`${this.#m(e,t)}${this.#v(t)}`:h`
1110
1123
  ${this.#m(e,t)}
1111
- ${i?c`<div class="bare-notice">No frontmatter — this is a plain, unmanaged file.</div>`:this.#p(e,t)}
1112
- ${s?m:c`
1124
+ ${i?h`<div class="bare-notice">No frontmatter — this is a plain, unmanaged file.</div>`:this.#p(e,t)}
1125
+ ${s?m:h`
1113
1126
  <div class="actions">
1114
- ${i?c`<button class="primary" @click=${()=>this.#i()}>Add frontmatter</button>`:c`
1127
+ ${i?h`<button class="primary" @click=${()=>this.#i()}>Add frontmatter</button>`:h`
1115
1128
  <button @click=${()=>this.#a()}>Edit</button>
1116
- ${t?c`<button @click=${()=>this.#k()}>Rename</button>`:m}
1129
+ ${t?h`<button @click=${()=>this.#y()}>Rename</button>`:m}
1117
1130
  <button @click=${()=>this.#n()}>${e.deprecated?"Un-deprecate":"Mark deprecated"}</button>
1118
1131
  <button @click=${()=>this.#r()}>${e.paused?"Resume":"Pause"}</button>
1119
- ${t?m:c`<button class="danger" @click=${()=>this.#b()}>Delete frontmatter</button>`}
1132
+ ${t?m:h`<button class="danger" @click=${()=>this.#b()}>Delete frontmatter</button>`}
1120
1133
  `}
1121
1134
  <button class="danger" @click=${()=>this.#g()}>Delete</button>
1122
1135
  </div>
1123
- ${this._renaming?c`
1136
+ ${this._renaming?h`
1124
1137
  <div class="rename-row">
1125
1138
  <input
1126
1139
  type="text"
@@ -1148,9 +1161,9 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1148
1161
  Raw
1149
1162
  </button>
1150
1163
  </div>
1151
- ${this._viewMode==="markdown"?c`<div class="markdown-body">${xi(x.parse(e.body??"",{async:!1,renderer:this.#$(this.selected.table,e.id)}))}</div>`:c`<pre>${e.raw_file??e.body}</pre>`}
1164
+ ${this._viewMode==="markdown"?h`<div class="markdown-body">${vi(x.parse(e.body??"",{async:!1,renderer:this.#$(this.selected.table,e.id)}))}</div>`:h`<pre>${e.raw_file??e.body}</pre>`}
1152
1165
  <div class="source-path" title="click to copy" @click=${()=>this.#t()}>${e.source_path}</div>
1153
- `}}customElements.define("detail-panel",Ei);const oe="membkt";let fe;function W(){return fe||(fe=fetch("/api/config").then(r=>r.json()).catch(()=>({folderfooMode:"off",folderfooHost:null}))),fe}class Ri extends ${static{this.properties={defaultKind:{attribute:!1},lockKind:{attribute:!1},onAdded:{attribute:!1},onCancel:{attribute:!1}}}#e=new u("skill");#t=new u("local");#s=new u("");#n=new u([]);#r=new u(null);#g=new u("");#a=new u("");#i=new u("");#l=new u(!1);#u=new u(!1);#h=new u(!1);#d=new u("");#o=new u("");#f=new u(!1);#b=new u("");#k=new u(!1);#x=new u("");#y=new u(!1);#v=new u(!1);#m=new u([]);#p=new u("");#$=new u(!1);#w;static{this.styles=R`
1166
+ `}}customElements.define("detail-panel",Ri);const ne="membkt";let ue;function W(){return ue||(ue=fetch("/api/config").then(r=>r.json()).catch(()=>({folderfooMode:"off",folderfooHost:null}))),ue}class zi extends ${static{this.properties={defaultKind:{attribute:!1},lockKind:{attribute:!1},onAdded:{attribute:!1},onCancel:{attribute:!1}}}#e=new u("skill");#t=new u("local");#s=new u("");#n=new u([]);#r=new u(null);#g=new u("");#a=new u("");#i=new u("");#l=new u(!1);#u=new u(!1);#h=new u(!1);#d=new u("");#o=new u("");#f=new u(!1);#b=new u("");#y=new u(!1);#x=new u("");#k=new u(!1);#v=new u(!1);#m=new u([]);#p=new u("");#$=new u(!1);#w;static{this.styles=R`
1154
1167
  :host { display: block; }
1155
1168
  .backdrop {
1156
1169
  position: fixed; inset: 0; background: var(--overlay);
@@ -1253,16 +1266,16 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1253
1266
  .ff-folder-entry.selected { background: var(--accent); color: var(--accent-fg); }
1254
1267
  .ff-empty { padding: 12px; opacity: 0.6; font-size: 13px; }
1255
1268
  .ff-widget-slot { display: flex; }
1256
- `}constructor(){super(),new ce(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#e.set(this.defaultKind),this.#_()}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this.#w)}async#_(e){const t=new URLSearchParams;e&&t.set("path",e),this.#u.value&&t.set("hidden","1");const s=await fetch(`/api/fs/list?${t.toString()}`);if(!s.ok){this.#i.set((await s.json()).error??"failed to list directory");return}const i=await s.json();this.#s.set(i.path),this.#r.set(i.parent),this.#n.set(i.entries),this.#i.set(""),this.renderRoot.querySelector(".browser")?.scrollTo(0,0)}#P(){this.#u.set(!this.#u.value),this.#_(this.#s.value)}#A(){this.#d.set(""),this.#h.set(!0)}#R(){this.#h.set(!1),this.#d.set("")}async#T(){const e=this.#d.value.trim();if(e){this.#i.set("");try{const t=await fetch("/api/fs/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:this.#s.value,name:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to create folder");return}this.#h.set(!1),this.#d.set(""),await this.#_(this.#s.value)}catch(t){this.#i.set(t.message)}}}#z(){this.#g.set(this.#s.value),this.#a.value||this.#a.set(this.#s.value.split("/").filter(Boolean).pop()??"")}async#L(){const e=this.#g.value||this.#s.value;if(e){this.#l.set(!0),this.#i.set("");try{const t=await fetch("/api/folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#a.value||void 0,path:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to add folder");return}this.onAdded()}finally{this.#l.set(!1)}}}async#F(){if(this.#y.value)return;const{folderfooMode:e,folderfooHost:t}=await W();if(e==="off"||!t)return;let s=null;try{s=localStorage.getItem("folderfoo_token")}catch{}s&&(this.#o.set(t),this.#x.set(oe),this.#k.set(!0),this.#D(s))}async#I(){if(!this.#o.value){this.#i.set("enter a server URL first");return}this.#i.set("");try{await ut(()=>import(`${this.#o.value}/elements/folderfoo-profile-circle.js`),[]),this.#f.set(!0),this.#b.set(""),await this.updateComplete;const e=this.renderRoot.querySelector(".ff-widget-slot");if(e&&!e.querySelector("folderfoo-profile-circle")){const t=document.createElement("folderfoo-profile-circle");t.setAttribute("app-name","Memory Bucket"),e.appendChild(t)}this.#w=setInterval(()=>this.#O(),800),this.#O()}catch(e){this.#b.set(e.message)}}#O(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{}!e||this.#y.value||(clearInterval(this.#w),this.#D(e))}async#D(e){this.#v.set(!0),this.#i.set("");try{const t=await fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:this.#o.value,token:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to persist folderfoo session");return}this.#y.set(!0),this.#x.set(oe),await this.#N()}finally{this.#v.set(!1)}}async#N(){this.#$.set(!0),this.#i.set("");try{const e=new URLSearchParams({server:this.#o.value,tenantId:this.#x.value}),t=await fetch(`/api/folderfoo/folders?${e.toString()}`),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to list folderfoo folders");return}this.#m.set(s)}finally{this.#$.set(!1)}}#q(e){this.#p.set(e),this.#a.value||this.#a.set(e.split("/").filter(Boolean).pop()??this.#x.value)}async#U(){if(this.#p.value){this.#l.set(!0),this.#i.set("");try{const e=await fetch("/api/remote-folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#a.value||void 0,server:this.#o.value,tenantId:this.#x.value,folderPath:this.#p.value})}),t=await e.json();if(!e.ok){this.#i.set(t.error??"failed to connect folder");return}this.onAdded()}finally{this.#l.set(!1)}}}#E(){const e=this.#n.value;return c`
1269
+ `}constructor(){super(),new le(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#e.set(this.defaultKind),this.#_()}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this.#w)}async#_(e){const t=new URLSearchParams;e&&t.set("path",e),this.#u.value&&t.set("hidden","1");const s=await fetch(`/api/fs/list?${t.toString()}`);if(!s.ok){this.#i.set((await s.json()).error??"failed to list directory");return}const i=await s.json();this.#s.set(i.path),this.#r.set(i.parent),this.#n.set(i.entries),this.#i.set(""),this.renderRoot.querySelector(".browser")?.scrollTo(0,0)}#z(){this.#u.set(!this.#u.value),this.#_(this.#s.value)}#A(){this.#d.set(""),this.#h.set(!0)}#R(){this.#h.set(!1),this.#d.set("")}async#T(){const e=this.#d.value.trim();if(e){this.#i.set("");try{const t=await fetch("/api/fs/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:this.#s.value,name:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to create folder");return}this.#h.set(!1),this.#d.set(""),await this.#_(this.#s.value)}catch(t){this.#i.set(t.message)}}}#P(){this.#g.set(this.#s.value),this.#a.value||this.#a.set(this.#s.value.split("/").filter(Boolean).pop()??"")}async#L(){const e=this.#g.value||this.#s.value;if(e){this.#l.set(!0),this.#i.set("");try{const t=await fetch("/api/folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#a.value||void 0,path:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to add folder");return}this.onAdded()}finally{this.#l.set(!1)}}}async#M(){if(this.#k.value)return;const{folderfooMode:e,folderfooHost:t}=await W();if(e==="off"||!t)return;let s=null;try{s=localStorage.getItem("folderfoo_token")}catch{}s&&(this.#o.set(t),this.#x.set(ne),this.#y.set(!0),this.#D(s))}async#I(){if(!this.#o.value){this.#i.set("enter a server URL first");return}this.#i.set("");try{await ut(()=>import(`${this.#o.value}/elements/folderfoo-profile-circle.js`),[]),this.#f.set(!0),this.#b.set(""),await this.updateComplete;const e=this.renderRoot.querySelector(".ff-widget-slot");if(e&&!e.querySelector("folderfoo-profile-circle")){const t=document.createElement("folderfoo-profile-circle");t.setAttribute("app-name","Memory Bucket"),e.appendChild(t)}this.#w=setInterval(()=>this.#O(),800),this.#O()}catch(e){this.#b.set(e.message)}}#O(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{}!e||this.#k.value||(clearInterval(this.#w),this.#D(e))}async#D(e){this.#v.set(!0),this.#i.set("");try{const t=await fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:this.#o.value,token:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to persist folderfoo session");return}this.#k.set(!0),this.#x.set(ne),await this.#N()}finally{this.#v.set(!1)}}async#N(){this.#$.set(!0),this.#i.set("");try{const e=new URLSearchParams({server:this.#o.value,tenantId:this.#x.value}),t=await fetch(`/api/folderfoo/folders?${e.toString()}`),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to list folderfoo folders");return}this.#m.set(s)}finally{this.#$.set(!1)}}#q(e){this.#p.set(e),this.#a.value||this.#a.set(e.split("/").filter(Boolean).pop()??this.#x.value)}async#U(){if(this.#p.value){this.#l.set(!0),this.#i.set("");try{const e=await fetch("/api/remote-folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#a.value||void 0,server:this.#o.value,tenantId:this.#x.value,folderPath:this.#p.value})}),t=await e.json();if(!e.ok){this.#i.set(t.error??"failed to connect folder");return}this.onAdded()}finally{this.#l.set(!1)}}}#E(){const e=this.#n.value;return h`
1257
1270
  <div class="breadcrumb-row">
1258
1271
  <div class="breadcrumb">${this.#s.value}</div>
1259
1272
  <button class="new-folder-btn" @click=${()=>this.#A()}>+ New folder</button>
1260
1273
  <label class="hidden-toggle">
1261
- <input type="checkbox" .checked=${this.#u.value} @change=${()=>this.#P()} />
1274
+ <input type="checkbox" .checked=${this.#u.value} @change=${()=>this.#z()} />
1262
1275
  Show hidden
1263
1276
  </label>
1264
1277
  </div>
1265
- ${this.#h.value?c`
1278
+ ${this.#h.value?h`
1266
1279
  <div class="new-folder-row">
1267
1280
  <input
1268
1281
  type="text"
@@ -1276,18 +1289,18 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1276
1289
  </div>
1277
1290
  `:""}
1278
1291
  <div class="browser">
1279
- ${this.#r.value?c`<div class="entry up" @click=${()=>this.#_(this.#r.value)}>
1292
+ ${this.#r.value?h`<div class="entry up" @click=${()=>this.#_(this.#r.value)}>
1280
1293
  <span class="icon">📁</span> ..
1281
1294
  </div>`:""}
1282
- ${e.length===0&&!this.#r.value?c`<div class="empty">No subdirectories here.</div>`:e.map(t=>c`<div class="entry" @click=${()=>this.#_(t.path)}>
1295
+ ${e.length===0&&!this.#r.value?h`<div class="empty">No subdirectories here.</div>`:e.map(t=>h`<div class="entry" @click=${()=>this.#_(t.path)}>
1283
1296
  <span class="icon">📁</span> ${t.name}
1284
1297
  </div>`)}
1285
1298
  </div>
1286
1299
  <div class="footer">
1287
- <button class="secondary" @click=${()=>this.#z()}>
1300
+ <button class="secondary" @click=${()=>this.#P()}>
1288
1301
  Select this folder
1289
1302
  </button>
1290
- ${this.#g.value?c`<div class="selected-row">Selected: <span class="path">${this.#g.value}</span></div>`:""}
1303
+ ${this.#g.value?h`<div class="selected-row">Selected: <span class="path">${this.#g.value}</span></div>`:""}
1291
1304
  <div>
1292
1305
  <label>Folder name</label>
1293
1306
  <input
@@ -1297,7 +1310,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1297
1310
  @input=${t=>this.#a.set(t.target.value)}
1298
1311
  />
1299
1312
  </div>
1300
- ${this.#i.value?c`<div class="error">${this.#i.value}</div>`:""}
1313
+ ${this.#i.value?h`<div class="error">${this.#i.value}</div>`:""}
1301
1314
  <div class="actions">
1302
1315
  <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
1303
1316
  <button
@@ -1309,28 +1322,28 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1309
1322
  </button>
1310
1323
  </div>
1311
1324
  </div>
1312
- `}#M(){const e=this.#m.value;return this.#k.value&&!this.#y.value?c`
1325
+ `}#F(){const e=this.#m.value;return this.#y.value&&!this.#k.value?h`
1313
1326
  <div class="ff-body">
1314
1327
  <div class="ff-connected-row"><span class="ff-connected-dot"></span> Already signed in to ${this.#o.value} — connecting…</div>
1315
- ${this.#i.value?c`<div class="error">${this.#i.value}</div>`:""}
1328
+ ${this.#i.value?h`<div class="error">${this.#i.value}</div>`:""}
1316
1329
  <div class="actions">
1317
1330
  <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
1318
1331
  </div>
1319
1332
  </div>
1320
- `:this.#y.value?c`
1333
+ `:this.#k.value?h`
1321
1334
  <div class="ff-body">
1322
1335
  <div class="ff-connected-row"><span class="ff-connected-dot"></span> Connected to ${this.#o.value}</div>
1323
- ${e.length>0?c`
1336
+ ${e.length>0?h`
1324
1337
  <div class="ff-folder-list">
1325
- ${e.map(t=>c`<div
1338
+ ${e.map(t=>h`<div
1326
1339
  class="ff-folder-entry ${this.#p.value===t.path?"selected":""}"
1327
1340
  @click=${()=>this.#q(t.path)}
1328
1341
  >
1329
1342
  ${t.path}
1330
1343
  </div>`)}
1331
1344
  </div>
1332
- `:this.#$.value?c`<div class="ff-hint">Loading folders…</div>`:c`<div class="ff-empty">No folders found.</div>`}
1333
- ${this.#p.value?c`<div class="selected-row">Selected: <span class="path">${this.#p.value}</span></div>`:""}
1345
+ `:this.#$.value?h`<div class="ff-hint">Loading folders…</div>`:h`<div class="ff-empty">No folders found.</div>`}
1346
+ ${this.#p.value?h`<div class="selected-row">Selected: <span class="path">${this.#p.value}</span></div>`:""}
1334
1347
  <div>
1335
1348
  <label>Folder name</label>
1336
1349
  <input
@@ -1340,7 +1353,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1340
1353
  @input=${t=>this.#a.set(t.target.value)}
1341
1354
  />
1342
1355
  </div>
1343
- ${this.#i.value?c`<div class="error">${this.#i.value}</div>`:""}
1356
+ ${this.#i.value?h`<div class="error">${this.#i.value}</div>`:""}
1344
1357
  <div class="actions">
1345
1358
  <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
1346
1359
  <button
@@ -1352,7 +1365,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1352
1365
  </button>
1353
1366
  </div>
1354
1367
  </div>
1355
- `:c`
1368
+ `:h`
1356
1369
  <div class="ff-body">
1357
1370
  <div class="ff-hint">
1358
1371
  Sign in to a folderfoo server to mount one of your folders (or a folder shared with you) as a
@@ -1370,26 +1383,26 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1370
1383
  @keydown=${t=>t.key==="Enter"&&this.#I()}
1371
1384
  />
1372
1385
  </div>
1373
- ${this.#f.value?c`
1386
+ ${this.#f.value?h`
1374
1387
  <div class="ff-hint">Sign in below (this is folderfoo's own login widget, same one every folderfoo app uses):</div>
1375
1388
  <div class="ff-widget-slot"></div>
1376
- ${this.#v.value?c`<div class="ff-hint">Finishing connection…</div>`:""}
1377
- `:c`
1389
+ ${this.#v.value?h`<div class="ff-hint">Finishing connection…</div>`:""}
1390
+ `:h`
1378
1391
  <div class="actions" style="justify-content: flex-start; margin-top: 0;">
1379
1392
  <button class="secondary" @click=${()=>this.#I()}>Continue</button>
1380
1393
  </div>
1381
1394
  `}
1382
- ${this.#b.value?c`<div class="error">${this.#b.value}</div>`:""}
1383
- ${this.#i.value?c`<div class="error">${this.#i.value}</div>`:""}
1395
+ ${this.#b.value?h`<div class="error">${this.#b.value}</div>`:""}
1396
+ ${this.#i.value?h`<div class="error">${this.#i.value}</div>`:""}
1384
1397
  <div class="actions">
1385
1398
  <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
1386
1399
  </div>
1387
1400
  </div>
1388
- `}render(){return c`
1401
+ `}render(){return h`
1389
1402
  <div class="backdrop" @click=${e=>e.target===e.currentTarget&&this.onCancel()}>
1390
1403
  <div class="modal">
1391
1404
  <div class="header"><h2>Add a folder</h2></div>
1392
- ${this.lockKind?c``:c`
1405
+ ${this.lockKind?h``:h`
1393
1406
  <div class="kind-toggle">
1394
1407
  <button
1395
1408
  class=${this.#e.value==="skill"?"active":""}
@@ -1411,15 +1424,15 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1411
1424
  </button>
1412
1425
  <button
1413
1426
  class=${this.#t.value==="folderfoo"?"active":""}
1414
- @click=${()=>{this.#t.set("folderfoo"),this.#F()}}
1427
+ @click=${()=>{this.#t.set("folderfoo"),this.#M()}}
1415
1428
  >
1416
1429
  Connect folderfoo
1417
1430
  </button>
1418
1431
  </div>
1419
- ${this.#t.value==="local"?this.#E():this.#M()}
1432
+ ${this.#t.value==="local"?this.#E():this.#F()}
1420
1433
  </div>
1421
1434
  </div>
1422
- `}}customElements.define("add-folder-modal",Ri);function ct(r){const e=Date.now()-r,t=Math.floor(e/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;const s=Math.floor(t/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}class Pi extends ${static{this.properties={channels:{attribute:!1},selected:{attribute:!1},detail:{attribute:!1},loading:{attribute:!1},onSelect:{attribute:!1},onRefresh:{attribute:!1}}}static{this.styles=R`
1435
+ `}}customElements.define("add-folder-modal",zi);function ct(r){const e=Date.now()-r,t=Math.floor(e/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;const s=Math.floor(t/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}class Pi extends ${static{this.properties={channels:{attribute:!1},selected:{attribute:!1},detail:{attribute:!1},loading:{attribute:!1},onSelect:{attribute:!1},onRefresh:{attribute:!1}}}static{this.styles=R`
1423
1436
  :host { display: flex; flex: 1 1 auto; min-height: 0; }
1424
1437
  .nav {
1425
1438
  flex: 0 0 260px;
@@ -1478,7 +1491,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1478
1491
  opacity: 0.5; font-size: 13px; padding-top: 46px;
1479
1492
  }
1480
1493
  .placeholder-empty { opacity: 0.5; font-style: italic; }
1481
- `}#e(){return!this.channels||this.channels.length===0?c`<div class="empty">No live channels right now. Channels appear here once an agent posts to one with memory_channel_post — they're ephemeral and disappear after a long idle period or server restart.</div>`:[...this.channels].sort((t,s)=>s.lastActivityAt-t.lastActivityAt).map(t=>c`
1494
+ `}#e(){return!this.channels||this.channels.length===0?h`<div class="empty">No live channels right now. Channels appear here once an agent posts to one with memory_channel_post — they're ephemeral and disappear after a long idle period or server restart.</div>`:[...this.channels].sort((t,s)=>s.lastActivityAt-t.lastActivityAt).map(t=>h`
1482
1495
  <div
1483
1496
  class="channel-row ${this.selected===t.name?"active":""}"
1484
1497
  @click=${()=>this.onSelect(t.name)}
@@ -1486,15 +1499,15 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1486
1499
  <span class="channel-name">${t.name}</span>
1487
1500
  <span class="channel-meta">${ct(t.lastActivityAt)}</span>
1488
1501
  </div>
1489
- `)}#t(){return this.selected?this.loading?c`<div class="content-pane"><div class="content-meta">Loading…</div></div>`:this.detail?c`
1502
+ `)}#t(){return this.selected?this.loading?h`<div class="content-pane"><div class="content-meta">Loading…</div></div>`:this.detail?h`
1490
1503
  <div class="content-pane">
1491
1504
  <div class="content-header">
1492
1505
  <span class="content-title">${this.detail.name}</span>
1493
1506
  <span class="content-meta">last activity ${ct(this.detail.lastActivityAt)}</span>
1494
1507
  </div>
1495
- ${this.detail.content?c`<div class="content-body">${this.detail.content}</div>`:c`<div class="placeholder-empty">Channel exists but nothing has been posted yet.</div>`}
1508
+ ${this.detail.content?h`<div class="content-body">${this.detail.content}</div>`:h`<div class="placeholder-empty">Channel exists but nothing has been posted yet.</div>`}
1496
1509
  </div>
1497
- `:c`<div class="content-pane"><div class="content-meta">Channel not found — it may have gone idle and been swept.</div></div>`:c`<div class="no-selection">Select a channel to view its content.</div>`}render(){return c`
1510
+ `:h`<div class="content-pane"><div class="content-meta">Channel not found — it may have gone idle and been swept.</div></div>`:h`<div class="no-selection">Select a channel to view its content.</div>`}render(){return h`
1498
1511
  <div class="nav">
1499
1512
  <div class="nav-header">
1500
1513
  <span>Live channels</span>
@@ -1503,7 +1516,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1503
1516
  ${this.#e()}
1504
1517
  </div>
1505
1518
  ${this.#t()}
1506
- `}}customElements.define("channel-view",Pi);function zi(r){const e=r.split(":");if(e.length===1)return{folderPath:"",name:e[0]};if(e.length===2){const[n,o]=e;return n.includes("/")?{folderPath:n,name:o}:{owner:n,folderPath:"",name:o}}const[t,s,...i]=e;return{owner:t===""?void 0:t,folderPath:s,name:i.join(":")}}const zt=new u({mode:"off",username:null});let ht=!1;function Li(){if(ht)return;ht=!0;const r=new EventSource("/api/folderfoo/identity-stream");r.onmessage=e=>{try{zt.set(JSON.parse(e.data))}catch{}}}const Ii=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],dt=[{value:"all",label:"Show all"},{value:"hide",label:"Hide"},{value:"only",label:"Only"}],Oi={tags:[],statuses:[],owners:[],doc_types:[],key_types:[],folders:[]},Di={skill:[],memory:[]},Lt="mem-bucket-split-pct",It=20,Ot=80;function Mi(){const r=Number(localStorage.getItem(Lt));return Number.isFinite(r)&&r>=It&&r<=Ot?r:40}const Dt="mem-bucket-theme",ge=["system","light","dark"],Fi={system:"◐",light:"☀",dark:"☾"},Ni={system:"Auto",light:"Light",dark:"Dark"};function qi(){const r=localStorage.getItem(Dt);return r==="light"||r==="dark"?r:"system"}function pt(r){r==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",r)}function Ui(){const r=location.hash.slice(1);if(!r)return{};const e=new URLSearchParams(r),t={},s=e.get("q");s&&(t.query=s);const i=e.get("type");(i==="skill"||i==="memory"||i==="all")&&(t.typeFilter=i);const n=e.getAll("tag");n.length&&(t.activeTags=n);const o=e.getAll("folder");o.length&&(t.activeFolders=o);const a=e.get("sort");a&&(t.sort=a);const l=e.get("deprecated");l==="0"?t.deprecatedFilter="hide":l==="1"&&(t.deprecatedFilter="only");const h=e.get("paused");h==="0"?t.pausedFilter="hide":h==="1"&&(t.pausedFilter="only");const p=e.get("date_from");p&&(t.dateFrom=p);const d=e.get("date_to");return d&&(t.dateTo=d),t}class ji extends ${static{this.styles=R`
1519
+ `}}customElements.define("channel-view",Pi);function Li(r){const e=r.split(":");if(e.length===1)return{folderPath:"",name:e[0]};if(e.length===2){const[n,o]=e;return n.includes("/")?{folderPath:n,name:o}:{owner:n,folderPath:"",name:o}}const[t,s,...i]=e;return{owner:t===""?void 0:t,folderPath:s,name:i.join(":")}}const Lt=new u({mode:"off",username:null});let ht=!1;function Ii(){if(ht)return;ht=!0;const r=new EventSource("/api/folderfoo/identity-stream");r.onmessage=e=>{try{Lt.set(JSON.parse(e.data))}catch{}}}const Oi=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],dt=[{value:"all",label:"Show all"},{value:"hide",label:"Hide"},{value:"only",label:"Only"}],Di={tags:[],statuses:[],owners:[],doc_types:[],key_types:[],folders:[]},Fi={skill:[],memory:[]},It="mem-bucket-split-pct",Ot=20,Dt=80;function Mi(){const r=Number(localStorage.getItem(It));return Number.isFinite(r)&&r>=Ot&&r<=Dt?r:40}const Ft="mem-bucket-theme",fe=["system","light","dark"],Ni={system:"◐",light:"☀",dark:"☾"},qi={system:"Auto",light:"Light",dark:"Dark"};function Ui(){const r=localStorage.getItem(Ft);return r==="light"||r==="dark"?r:"system"}function pt(r){r==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",r)}function ji(){const r=location.hash.slice(1);if(!r)return{};const e=new URLSearchParams(r),t={},s=e.get("q");s&&(t.query=s);const i=e.get("type");(i==="skill"||i==="memory"||i==="all")&&(t.typeFilter=i);const n=e.getAll("tag");n.length&&(t.activeTags=n);const o=e.getAll("folder");o.length&&(t.activeFolders=o);const a=e.get("sort");a&&(t.sort=a);const c=e.get("deprecated");c==="0"?t.deprecatedFilter="hide":c==="1"&&(t.deprecatedFilter="only");const l=e.get("paused");l==="0"?t.pausedFilter="hide":l==="1"&&(t.pausedFilter="only");const p=e.get("date_from");p&&(t.dateFrom=p);const d=e.get("date_to");return d&&(t.dateTo=d),t}class Hi extends ${static{this.styles=R`
1507
1520
  :host { display: flex; flex-direction: column; height: 100vh; }
1508
1521
  .toolbar {
1509
1522
  display: flex;
@@ -1745,16 +1758,16 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1745
1758
  cursor: pointer;
1746
1759
  }
1747
1760
  .bulk-bar button.danger { border-color: var(--danger); color: var(--danger); }
1748
- `}#e=Ui();#t=new u(this.#e.query??"");#s=new u(this.#e.typeFilter??"all");#n=new u(this.#e.activeTags??[]);#r=new u(this.#e.activeFolders??[]);#g=new u([]);#a=new u(Oi);#i=new u(null);#l=new u(Di);#u=new u(!1);#h=new u("");#d=new u(!1);#o=new u(Mi());#f=new u("");#b=new u(!1);#k=new u(this.#e.sort??"mtime_desc");#x=new u(this.#e.deprecatedFilter??"all");#y=new u(this.#e.pausedFilter??"all");#v=new u(this.#e.dateFrom??"");#m=new u(this.#e.dateTo??"");#p=new u(new Set);#$=new u(qi());#w=new u(!1);#_=new u("entries");#P=new u([]);#A=new u(null);#R=new u(null);#T=new u(!1);#z=e=>this.#N(e);#L=()=>this.#q();constructor(){super(),new ce(this),pt(this.#$.value)}#F(e){this.#$.set(e),localStorage.setItem(Dt,e),pt(e)}#I(){const e=ge[(ge.indexOf(this.#$.value)+1)%ge.length];this.#F(e)}async#O(){if(!this.#w.value){this.#w.set(!0);try{await fetch("/api/rebuild-cache",{method:"POST"}),await Promise.all([this.#C(),this.#S(),this.#c()])}finally{this.#w.set(!1)}}}#D(e){e.preventDefault(),this.#b.set(!0),document.addEventListener("pointermove",this.#z),document.addEventListener("pointerup",this.#L)}#N(e){const t=this.renderRoot.querySelector(".body-region");if(!t)return;const s=t.getBoundingClientRect(),i=(e.clientX-s.left)/s.width*100;this.#o.set(Math.min(Ot,Math.max(It,i)))}#q(){this.#b.set(!1),document.removeEventListener("pointermove",this.#z),document.removeEventListener("pointerup",this.#L),localStorage.setItem(Lt,String(this.#o.value))}#U=new us(()=>{const e=new URLSearchParams;this.#s.value!=="all"&&e.set("type",this.#s.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim());for(const t of this.#n.value)e.append("tag",t);for(const t of this.#r.value)e.append("folder",t);return this.#k.value!=="mtime_desc"&&e.set("sort",this.#k.value),this.#x.value==="hide"?e.set("deprecated","0"):this.#x.value==="only"&&e.set("deprecated","1"),this.#y.value==="hide"?e.set("paused","0"):this.#y.value==="only"&&e.set("paused","1"),this.#v.value&&e.set("date_from",this.#v.value),this.#m.value&&e.set("date_to",this.#m.value),e.toString()});#E=()=>this.#Q();#M=e=>this.#ie(e);#K=e=>this.#re(e);#Z=()=>this.#V();#W;connectedCallback(){super.connectedCallback(),this.#c(),this.#S(),this.#C().then(()=>this.#Q()),window.addEventListener("focus",this.#E),document.addEventListener("visibilitychange",this.#E),document.addEventListener("folderfoo-file-open",this.#M),document.addEventListener("folderfoo-folder-changed",this.#K),window.addEventListener("folderfoo-auth-change",this.#Z),this.#ne(),this.#V(),Li(),this.#W=zt.subscribe(()=>this.#C())}async#ie(e){const t=e.detail?.name;if(!t)return;const s=zi(t);if(s.owner){this.#f.set(`"${s.name}" is from a shared folder — opening shared files here isn't supported yet.`);return}const{folderfooMode:i,folderfooHost:n}=await W();if(!(i==="off"||!n))try{const o=await fetch("/api/folderfoo/resolve-open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:n,tenantId:oe,folderPath:s.folderPath,name:s.name})}),a=await o.json();if(!o.ok){this.#f.set(a.error??`couldn't open "${s.name}"`);return}this.#f.set(""),this.#i.set({table:a.table,id:a.id})}catch(o){this.#f.set(o.message)}}async#re(e){const{path:t,action:s,newPath:i}=e.detail??{};if(!(t===void 0||!s)){if((s==="rename"||s==="move")&&i){const{folderfooHost:n}=await W();if(!n)return;try{await fetch("/api/folders/renamed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:n,oldPath:t,newPath:i})})}catch{}}this.#C()}}async#ne(){if(this.shadowRoot?.querySelector("folderfoo-profile-circle"))return;const{folderfooMode:e,folderfooHost:t}=await W();e==="off"||!t||ut(()=>import(`${t}/elements/folderfoo-profile-circle.js`),[]).then(async()=>{await this.updateComplete;const s=document.createElement("folderfoo-profile-circle");s.setAttribute("app-name","Memory Bucket"),s.setAttribute("tenant-id",oe),s.style.zoom="0.875",this.shadowRoot?.querySelector(".folderfoo-slot")?.appendChild(s)}).catch(s=>{console.warn("folderfoo-profile-circle unavailable:",s.message)})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("focus",this.#E),document.removeEventListener("visibilitychange",this.#E),document.removeEventListener("folderfoo-file-open",this.#M),document.removeEventListener("folderfoo-folder-changed",this.#K),window.removeEventListener("folderfoo-auth-change",this.#Z),this.#W?.()}async#V(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{return}if(!e){fetch("/api/folderfoo/logout",{method:"POST"}).catch(()=>{});return}const{folderfooMode:t,folderfooHost:s}=await W();t==="off"||!s||fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:s,token:e})}).catch(()=>{})}#j=!1;async#Q(){if(document.visibilityState==="visible"){if(this.#X().some(e=>e.remote)&&!this.#j){this.#j=!0;try{await fetch("/api/remote-folders/resync-all",{method:"POST"})}catch{}finally{this.#j=!1}}this.#c(),this.#S(),this.#C(),this.renderRoot.querySelector("detail-panel")?.refresh?.()}}async#c(){const e=this.#U.value;history.replaceState(null,"",e?`#${e}`:location.pathname+location.search);const t=await fetch(`/api/entries?${e}`);this.#g.set(await t.json()),this.renderRoot.querySelector("result-list")?.scrollTo(0,0)}async#S(){const e=this.#s.value==="all"?"":`?type=${this.#s.value}`,t=await fetch(`/api/facets${e}`);this.#a.set(await t.json())}async#C(){const t=await(await fetch("/api/folders")).json();this.#l.set(t),this.#d.set(!0);const s=new Set([...t.skill,...t.memory].map(n=>n.name)),i=this.#r.value.filter(n=>s.has(n));i.length!==this.#r.value.length&&(this.#r.set(i),this.#c())}#oe(e){this.#_.set(e),e==="channels"&&this.#J()}async#J(){const e=await fetch("/api/channels");this.#P.set(await e.json()),this.#A.value&&this.#Y(this.#A.value)}async#Y(e){this.#A.set(e),this.#T.set(!0);try{const t=await fetch(`/api/channels/${encodeURIComponent(e)}`);this.#R.set(t.ok?await t.json():null)}finally{this.#T.set(!1)}}#ae(e){const t=this.#r.value;this.#r.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#c()}async#le(e,t){if(t.stopPropagation(),window.prompt(`Type "${e.name}" to remove this ${e.kind} folder (files on disk are untouched):`)===e.name){this.#h.set(e.name);try{await fetch(`/api/folders/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"}),this.#r.set(this.#r.value.filter(i=>i!==e.name)),await Promise.all([this.#C(),this.#S(),this.#c()])}finally{this.#h.set("")}}}#G(){this.#u.set(!1),this.#C(),this.#S(),this.#c()}#X(){return[...this.#l.value.skill,...this.#l.value.memory].sort((e,t)=>Number(e.remote)-Number(t.remote))}#ce(e){this.#s.set(e),this.#n.set([]),this.#S(),this.#c()}#he(e){const t=this.#n.value;this.#n.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#c()}#de(e){this.#n.value.includes(e)||this.#n.set([...this.#n.value,e]),this.#c()}#pe(e){this.#r.value.includes(e)||this.#r.set([...this.#r.value,e]),this.#c()}#ue(e){this.#v.set(e),this.#m.set(e),this.#c()}#fe(e){this.#t.set(e.target.value),this.#c()}#ee(e){this.#t.set(e),this.#c()}#ge(){this.#t.set(""),this.#c()}#be(e){this.#i.set({table:e._table,id:e.id})}#me(e){this.#k.set(e.target.value),this.#c()}#xe(e){this.#x.set(e.target.value),this.#c()}#ve(e){this.#y.set(e.target.value),this.#c()}#ye(e){this.#v.set(e.target.value),this.#c()}#ke(e){this.#m.set(e.target.value),this.#c()}#$e(){this.#v.set(""),this.#m.set(""),this.#c()}#we(e){const t=new Set(this.#p.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#p.set(t)}#_e(){return new Map(this.#g.value.map(e=>[e.id,e]))}#H(){const e=new Map,t=this.#_e();for(const s of this.#p.value){const i=t.get(s);if(!i)continue;const n=e.get(i._table)??[];n.push(s),e.set(i._table,n)}return e}async#te(e){const t=this.#H();await Promise.all([...t.entries()].map(([s,i])=>fetch(`/api/entries/${s}/bulk/deprecated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i,deprecated:e})}))),this.#p.set(new Set),await this.#c()}async#se(e){const t=this.#H();await Promise.all([...t.entries()].map(([s,i])=>fetch(`/api/entries/${s}/bulk/paused`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i,paused:e})}))),this.#p.set(new Set),await this.#c()}async#Se(){if(!window.confirm(`Delete ${this.#p.value.size} doc(s)? This can't be undone.`))return;const e=this.#H();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.#c()}#Ce(){const e=this.#$.value;return c`
1761
+ `}#e=ji();#t=new u(this.#e.query??"");#s=new u(this.#e.typeFilter??"all");#n=new u(this.#e.activeTags??[]);#r=new u(this.#e.activeFolders??[]);#g=new u([]);#a=new u(Di);#i=new u(null);#l=new u(Fi);#u=new u(!1);#h=new u("");#d=new u(!1);#o=new u(Mi());#f=new u("");#b=new u(!1);#y=new u(this.#e.sort??"");#x=new u(this.#e.deprecatedFilter??"all");#k=new u(this.#e.pausedFilter??"all");#v=new u(this.#e.dateFrom??"");#m=new u(this.#e.dateTo??"");#p=new u(new Set);#$=new u(Ui());#w=new u(!1);#_=new u("entries");#z=new u([]);#A=new u(null);#R=new u(null);#T=new u(!1);#P=e=>this.#N(e);#L=()=>this.#q();constructor(){super(),new le(this),pt(this.#$.value)}#M(e){this.#$.set(e),localStorage.setItem(Ft,e),pt(e)}#I(){const e=fe[(fe.indexOf(this.#$.value)+1)%fe.length];this.#M(e)}async#O(){if(!this.#w.value){this.#w.set(!0);try{await fetch("/api/rebuild-cache",{method:"POST"}),await Promise.all([this.#C(),this.#S(),this.#c()])}finally{this.#w.set(!1)}}}#D(e){e.preventDefault(),this.#b.set(!0),document.addEventListener("pointermove",this.#P),document.addEventListener("pointerup",this.#L)}#N(e){const t=this.renderRoot.querySelector(".body-region");if(!t)return;const s=t.getBoundingClientRect(),i=(e.clientX-s.left)/s.width*100;this.#o.set(Math.min(Dt,Math.max(Ot,i)))}#q(){this.#b.set(!1),document.removeEventListener("pointermove",this.#P),document.removeEventListener("pointerup",this.#L),localStorage.setItem(It,String(this.#o.value))}#U=new fs(()=>{const e=new URLSearchParams;this.#s.value!=="all"&&e.set("type",this.#s.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim());for(const t of this.#n.value)e.append("tag",t);for(const t of this.#r.value)e.append("folder",t);return this.#y.value&&e.set("sort",this.#y.value),this.#x.value==="hide"?e.set("deprecated","0"):this.#x.value==="only"&&e.set("deprecated","1"),this.#k.value==="hide"?e.set("paused","0"):this.#k.value==="only"&&e.set("paused","1"),this.#v.value&&e.set("date_from",this.#v.value),this.#m.value&&e.set("date_to",this.#m.value),e.toString()});#E=()=>this.#Q();#F=e=>this.#ie(e);#K=e=>this.#re(e);#Z=()=>this.#V();#W;connectedCallback(){super.connectedCallback(),this.#c(),this.#S(),this.#C().then(()=>this.#Q()),window.addEventListener("focus",this.#E),document.addEventListener("visibilitychange",this.#E),document.addEventListener("folderfoo-file-open",this.#F),document.addEventListener("folderfoo-folder-changed",this.#K),window.addEventListener("folderfoo-auth-change",this.#Z),this.#ne(),this.#V(),Ii(),this.#W=Lt.subscribe(()=>this.#C())}async#ie(e){const t=e.detail?.name;if(!t)return;const s=Li(t);if(s.owner){this.#f.set(`"${s.name}" is from a shared folder — opening shared files here isn't supported yet.`);return}const{folderfooMode:i,folderfooHost:n}=await W();if(!(i==="off"||!n))try{const o=await fetch("/api/folderfoo/resolve-open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:n,tenantId:ne,folderPath:s.folderPath,name:s.name})}),a=await o.json();if(!o.ok){this.#f.set(a.error??`couldn't open "${s.name}"`);return}this.#f.set(""),this.#i.set({table:a.table,id:a.id})}catch(o){this.#f.set(o.message)}}async#re(e){const{path:t,action:s,newPath:i}=e.detail??{};if(!(t===void 0||!s)){if((s==="rename"||s==="move")&&i){const{folderfooHost:n}=await W();if(!n)return;try{await fetch("/api/folders/renamed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:n,oldPath:t,newPath:i})})}catch{}}this.#C()}}async#ne(){if(this.shadowRoot?.querySelector("folderfoo-profile-circle"))return;const{folderfooMode:e,folderfooHost:t}=await W();e==="off"||!t||ut(()=>import(`${t}/elements/folderfoo-profile-circle.js`),[]).then(async()=>{await this.updateComplete;const s=document.createElement("folderfoo-profile-circle");s.setAttribute("app-name","Memory Bucket"),s.setAttribute("tenant-id",ne),s.style.zoom="0.875",this.shadowRoot?.querySelector(".folderfoo-slot")?.appendChild(s)}).catch(s=>{console.warn("folderfoo-profile-circle unavailable:",s.message)})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("focus",this.#E),document.removeEventListener("visibilitychange",this.#E),document.removeEventListener("folderfoo-file-open",this.#F),document.removeEventListener("folderfoo-folder-changed",this.#K),window.removeEventListener("folderfoo-auth-change",this.#Z),this.#W?.()}async#V(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{return}if(!e){fetch("/api/folderfoo/logout",{method:"POST"}).catch(()=>{});return}const{folderfooMode:t,folderfooHost:s}=await W();t==="off"||!s||fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:s,token:e})}).catch(()=>{})}#j=!1;async#Q(){if(document.visibilityState==="visible"){if(this.#X().some(e=>e.remote)&&!this.#j){this.#j=!0;try{await fetch("/api/remote-folders/resync-all",{method:"POST"})}catch{}finally{this.#j=!1}}this.#c(),this.#S(),this.#C(),this.renderRoot.querySelector("detail-panel")?.refresh?.()}}async#c(){const e=this.#U.value;history.replaceState(null,"",e?`#${e}`:location.pathname+location.search);const t=await fetch(`/api/entries?${e}`);this.#g.set(await t.json()),this.renderRoot.querySelector("result-list")?.scrollTo(0,0)}async#S(){const e=this.#s.value==="all"?"":`?type=${this.#s.value}`,t=await fetch(`/api/facets${e}`);this.#a.set(await t.json())}async#C(){const t=await(await fetch("/api/folders")).json();this.#l.set(t),this.#d.set(!0);const s=new Set([...t.skill,...t.memory].map(n=>n.name)),i=this.#r.value.filter(n=>s.has(n));i.length!==this.#r.value.length&&(this.#r.set(i),this.#c())}#oe(e){this.#_.set(e),e==="channels"&&this.#J()}async#J(){const e=await fetch("/api/channels");this.#z.set(await e.json()),this.#A.value&&this.#Y(this.#A.value)}async#Y(e){this.#A.set(e),this.#T.set(!0);try{const t=await fetch(`/api/channels/${encodeURIComponent(e)}`);this.#R.set(t.ok?await t.json():null)}finally{this.#T.set(!1)}}#ae(e){const t=this.#r.value;this.#r.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#c()}async#le(e,t){if(t.stopPropagation(),window.prompt(`Type "${e.name}" to remove this ${e.kind} folder (files on disk are untouched):`)===e.name){this.#h.set(e.name);try{await fetch(`/api/folders/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"}),this.#r.set(this.#r.value.filter(i=>i!==e.name)),await Promise.all([this.#C(),this.#S(),this.#c()])}finally{this.#h.set("")}}}#G(){this.#u.set(!1),this.#C(),this.#S(),this.#c()}#X(){return[...this.#l.value.skill,...this.#l.value.memory].sort((e,t)=>Number(e.remote)-Number(t.remote))}#ce(e){this.#s.set(e),this.#n.set([]),this.#S(),this.#c()}#he(e){const t=this.#n.value;this.#n.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#c()}#de(e){this.#n.value.includes(e)||this.#n.set([...this.#n.value,e]),this.#c()}#pe(e){this.#r.value.includes(e)||this.#r.set([...this.#r.value,e]),this.#c()}#ue(e){this.#v.set(e),this.#m.set(e),this.#c()}#fe(e){this.#t.set(e.target.value),this.#c()}#ee(e){this.#t.set(e),this.#c()}#ge(){this.#t.set(""),this.#c()}#be(e){this.#i.set({table:e._table,id:e.id})}#me(e){this.#y.set(e.target.value),this.#c()}#xe(e){this.#x.set(e.target.value),this.#c()}#ve(e){this.#k.set(e.target.value),this.#c()}#ke(e){this.#v.set(e.target.value),this.#c()}#ye(e){this.#m.set(e.target.value),this.#c()}#$e(){this.#v.set(""),this.#m.set(""),this.#c()}#we(e){const t=new Set(this.#p.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#p.set(t)}#_e(){return new Map(this.#g.value.map(e=>[e.id,e]))}#H(){const e=new Map,t=this.#_e();for(const s of this.#p.value){const i=t.get(s);if(!i)continue;const n=e.get(i._table)??[];n.push(s),e.set(i._table,n)}return e}async#te(e){const t=this.#H();await Promise.all([...t.entries()].map(([s,i])=>fetch(`/api/entries/${s}/bulk/deprecated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i,deprecated:e})}))),this.#p.set(new Set),await this.#c()}async#se(e){const t=this.#H();await Promise.all([...t.entries()].map(([s,i])=>fetch(`/api/entries/${s}/bulk/paused`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i,paused:e})}))),this.#p.set(new Set),await this.#c()}async#Se(){if(!window.confirm(`Delete ${this.#p.value.size} doc(s)? This can't be undone.`))return;const e=this.#H();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.#c()}#Ce(){const e=this.#$.value;return h`
1749
1762
  <button
1750
1763
  class="theme-toggle"
1751
- title=${`Theme: ${Ni[e]} (click to change)`}
1764
+ title=${`Theme: ${qi[e]} (click to change)`}
1752
1765
  aria-label="Toggle color theme"
1753
1766
  @click=${()=>this.#I()}
1754
1767
  >
1755
- ${Fi[e]}
1768
+ ${Ni[e]}
1756
1769
  </button>
1757
- `}#Ae(){const e=this.#_.value==="channels";return c`
1770
+ `}#Ae(){const e=this.#_.value==="channels";return h`
1758
1771
  <button
1759
1772
  class="channels-toggle ${e?"active":""}"
1760
1773
  title="Live memory channels"
@@ -1762,7 +1775,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1762
1775
  >
1763
1776
  ⛓ Channels
1764
1777
  </button>
1765
- `}#Te(){const e=this.#w.value;return c`
1778
+ `}#Te(){const e=this.#w.value;return h`
1766
1779
  <button
1767
1780
  class=${`reindex-toggle${e?" spinning":""}`}
1768
1781
  title=${e?"Reindexing…":"Rebuild cache from disk"}
@@ -1772,24 +1785,24 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1772
1785
  >
1773
1786
 
1774
1787
  </button>
1775
- `}#B(e){return c`
1788
+ `}#B(e){return h`
1776
1789
  <div class="toolbar">
1777
1790
  ${e?this.#Te():""}
1778
1791
  ${this.#Ae()}
1779
1792
  ${this.#Ce()}
1780
1793
  <div class="folderfoo-slot"></div>
1781
1794
  </div>
1782
- `}render(){const e=this.#a.value,t=this.#X();return this.#_.value==="channels"?c`
1795
+ `}render(){const e=this.#a.value,t=this.#X();return this.#_.value==="channels"?h`
1783
1796
  <div class="toolbar-bar">${this.#B(!1)}</div>
1784
1797
  <channel-view
1785
- .channels=${this.#P.value}
1798
+ .channels=${this.#z.value}
1786
1799
  .selected=${this.#A.value}
1787
1800
  .detail=${this.#R.value}
1788
1801
  .loading=${this.#T.value}
1789
1802
  .onSelect=${s=>this.#Y(s)}
1790
1803
  .onRefresh=${()=>this.#J()}
1791
1804
  ></channel-view>
1792
- `:this.#d.value&&t.length===0&&!this.#u.value?c`
1805
+ `:this.#d.value&&t.length===0&&!this.#u.value?h`
1793
1806
  <div class="toolbar-bar">${this.#B(!1)}</div>
1794
1807
  <div class="first-run">
1795
1808
  <h1>No folders configured yet</h1>
@@ -1799,23 +1812,23 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1799
1812
  </p>
1800
1813
  <button class="add-folder-btn" @click=${()=>this.#u.set(!0)}>+ Add your first folder</button>
1801
1814
  </div>
1802
- ${this.#u.value?c`<add-folder-modal
1815
+ ${this.#u.value?h`<add-folder-modal
1803
1816
  .defaultKind=${"skill"}
1804
1817
  .lockKind=${!1}
1805
1818
  .onAdded=${()=>this.#G()}
1806
1819
  .onCancel=${()=>this.#u.set(!1)}
1807
1820
  ></add-folder-modal>`:""}
1808
- `:c`
1821
+ `:h`
1809
1822
  <div class="folders-bar">
1810
1823
  <span class="filter-label">Folders:</span>
1811
1824
  <div class="folder-chips">
1812
- ${t.map(s=>c`
1825
+ ${t.map(s=>h`
1813
1826
  <button
1814
1827
  class="folder-chip ${s.remote?"remote":""} ${this.#r.value.includes(s.name)?"active":""}"
1815
1828
  title=${s.remote?`${s.path} (remote — folderfoo)`:s.path}
1816
1829
  @click=${()=>this.#ae(s.name)}
1817
1830
  >
1818
- ${s.remote?c`<span class="remote-dot"></span>`:"📁"} ${s.name}
1831
+ ${s.remote?h`<span class="remote-dot"></span>`:"📁"} ${s.name}
1819
1832
  <span class="kind">(${s.kind==="skill"?"s":"m"})</span>
1820
1833
  <span
1821
1834
  class="remove"
@@ -1829,7 +1842,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1829
1842
  </div>
1830
1843
  ${this.#B(!0)}
1831
1844
  </div>
1832
- ${this.#f.value?c`
1845
+ ${this.#f.value?h`
1833
1846
  <div class="folderfoo-open-banner">
1834
1847
  ${this.#f.value}
1835
1848
  <button class="dismiss" @click=${()=>this.#f.set("")}>✕</button>
@@ -1844,7 +1857,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1844
1857
  .value=${this.#t.value}
1845
1858
  @input=${s=>this.#fe(s)}
1846
1859
  />
1847
- ${this.#t.value?c`
1860
+ ${this.#t.value?h`
1848
1861
  <button
1849
1862
  class="search-clear-btn"
1850
1863
  title="Clear search"
@@ -1856,7 +1869,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1856
1869
  `:""}
1857
1870
  </div>
1858
1871
  <div class="row type-toggle">
1859
- ${Ii.map(s=>c`
1872
+ ${Oi.map(s=>h`
1860
1873
  <button
1861
1874
  class=${this.#s.value===s.value?"active":""}
1862
1875
  @click=${()=>this.#ce(s.value)}
@@ -1865,7 +1878,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1865
1878
  </button>
1866
1879
  `)}
1867
1880
  </div>
1868
- ${e.tags.length===0?c`<span class="filter-label">Tags:</span> <label class="small">no tags yet</label>`:c`
1881
+ ${e.tags.length===0?h`<span class="filter-label">Tags:</span> <label class="small">no tags yet</label>`:h`
1869
1882
  <tag-multiselect
1870
1883
  .tags=${e.tags}
1871
1884
  .active=${this.#n.value}
@@ -1879,16 +1892,16 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1879
1892
  type="date"
1880
1893
  aria-label="From date"
1881
1894
  .value=${this.#v.value}
1882
- @change=${s=>this.#ye(s)}
1895
+ @change=${s=>this.#ke(s)}
1883
1896
  />
1884
1897
  <span class="date-range-sep">–</span>
1885
1898
  <input
1886
1899
  type="date"
1887
1900
  aria-label="To date"
1888
1901
  .value=${this.#m.value}
1889
- @change=${s=>this.#ke(s)}
1902
+ @change=${s=>this.#ye(s)}
1890
1903
  />
1891
- ${this.#v.value||this.#m.value?c`
1904
+ ${this.#v.value||this.#m.value?h`
1892
1905
  <button
1893
1906
  class="date-range-clear"
1894
1907
  title="Clear date range"
@@ -1900,7 +1913,11 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1900
1913
  `:""}
1901
1914
  </div>
1902
1915
  <span class="filter-label">Sort:</span>
1903
- <select .value=${this.#k.value} @change=${s=>this.#me(s)}>
1916
+ <select
1917
+ .value=${this.#y.value||(this.#t.value.trim()?"relevance":"mtime_desc")}
1918
+ @change=${s=>this.#me(s)}
1919
+ >
1920
+ ${this.#t.value.trim()?h`<option value="relevance">Relevance</option>`:""}
1904
1921
  <option value="mtime_desc">Recently touched</option>
1905
1922
  <option value="mtime_asc">Least recently touched</option>
1906
1923
  <option value="created_at_asc">Oldest first</option>
@@ -1908,15 +1925,15 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1908
1925
  </select>
1909
1926
  <span class="filter-label">Deprecated:</span>
1910
1927
  <select .value=${this.#x.value} @change=${s=>this.#xe(s)}>
1911
- ${dt.map(s=>c`<option value=${s.value}>${s.label}</option>`)}
1928
+ ${dt.map(s=>h`<option value=${s.value}>${s.label}</option>`)}
1912
1929
  </select>
1913
1930
  <span class="filter-label">Paused:</span>
1914
- <select .value=${this.#y.value} @change=${s=>this.#ve(s)}>
1915
- ${dt.map(s=>c`<option value=${s.value}>${s.label}</option>`)}
1931
+ <select .value=${this.#k.value} @change=${s=>this.#ve(s)}>
1932
+ ${dt.map(s=>h`<option value=${s.value}>${s.label}</option>`)}
1916
1933
  </select>
1917
1934
  </div>
1918
1935
  </div>
1919
- ${this.#p.value.size>0?c`
1936
+ ${this.#p.value.size>0?h`
1920
1937
  <div class="bulk-bar">
1921
1938
  <span>${this.#p.value.size} selected</span>
1922
1939
  <button @click=${()=>this.#te(!0)}>Mark deprecated</button>
@@ -1951,10 +1968,10 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1951
1968
  .onKeyClick=${s=>this.#ee(s)}
1952
1969
  ></detail-panel>
1953
1970
  </div>
1954
- ${this.#u.value?c`<add-folder-modal
1971
+ ${this.#u.value?h`<add-folder-modal
1955
1972
  .defaultKind=${"skill"}
1956
1973
  .lockKind=${!1}
1957
1974
  .onAdded=${()=>this.#G()}
1958
1975
  .onCancel=${()=>this.#u.set(!1)}
1959
1976
  ></add-folder-modal>`:""}
1960
- `}}customElements.define("mem-bucket-app",ji);
1977
+ `}}customElements.define("mem-bucket-app",Hi);