mcp-memory-bucket 0.4.0 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{index-vdbzlLML.js → index-DvTP9na1.js} +177 -136
- package/dist/client/index.html +1 -1
- package/dist/src/memory/repository.js +50 -9
- package/dist/src/memory/tools.js +15 -6
- package/dist/src/skills/repository.js +56 -14
- package/dist/src/skills/tools.js +22 -7
- package/dist/src/store/db.js +4 -0
- package/dist/src/store/sync.js +25 -2
- package/dist/src/web/routes.js +77 -4
- package/package.json +2 -2
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const
|
|
5
|
+
*/const X=globalThis,xe=X.ShadowRoot&&(X.ShadyCSS===void 0||X.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,me=Symbol(),Ie=new WeakMap;let it=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==me)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(xe&&e===void 0){const s=t!==void 0&&t.length===1;s&&(e=Ie.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&Ie.set(t,e))}return e}toString(){return this.cssText}};const Tt=i=>new it(typeof i=="string"?i:i+"",void 0,me),W=(i,...e)=>{const t=i.length===1?i[0]:e.reduce((s,r,n)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+i[n+1],i[0]);return new it(t,i,me)},Rt=(i,e)=>{if(xe)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const s=document.createElement("style"),r=X.litNonce;r!==void 0&&s.setAttribute("nonce",r),s.textContent=t.cssText,i.appendChild(s)}},Me=xe?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return Tt(t)})(i):i;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is:
|
|
9
|
+
*/const{is:Et,defineProperty:Ct,getOwnPropertyDescriptor:zt,getOwnPropertyNames:Pt,getOwnPropertySymbols:Lt,getPrototypeOf:It}=Object,re=globalThis,Oe=re.trustedTypes,Mt=Oe?Oe.emptyScript:"",Ot=re.reactiveElementPolyfillSupport,Z=(i,e)=>i,pe={toAttribute(i,e){switch(e){case Boolean:i=i?Mt:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},rt=(i,e)=>!Et(i,e),De={attribute:!0,type:String,converter:pe,reflect:!1,useDefault:!1,hasChanged:rt};Symbol.metadata??=Symbol("metadata"),re.litPropertyMetadata??=new WeakMap;let D=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=De){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const s=Symbol(),r=this.getPropertyDescriptor(e,s,t);r!==void 0&&Ct(this.prototype,e,r)}}static getPropertyDescriptor(e,t,s){const{get:r,set:n}=zt(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:r,set(o){const a=r?.call(this);n?.call(this,o),this.requestUpdate(e,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??De}static _$Ei(){if(this.hasOwnProperty(Z("elementProperties")))return;const e=It(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Z("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Z("properties"))){const t=this.properties,s=[...Pt(t),...Lt(t)];for(const r of s)this.createProperty(r,t[r])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[s,r]of t)this.elementProperties.set(s,r)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const r=this._$Eu(t,s);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const r of s)t.unshift(Me(r))}else e!==void 0&&t.push(Me(e));return t}static _$Eu(e,t){const s=t.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const s of t.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Rt(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){const s=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,s);if(r!==void 0&&s.reflect===!0){const n=(s.converter?.toAttribute!==void 0?s.converter:pe).toAttribute(t,s.type);this._$Em=e,n==null?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(e,t){const s=this.constructor,r=s._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const n=s.getPropertyOptions(r),o=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:pe;this._$Em=r;const a=o.fromAttribute(t,n.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,s,r=!1,n){if(e!==void 0){const o=this.constructor;if(r===!1&&(n=this[e]),s??=o.getPropertyOptions(e),!((s.hasChanged??rt)(n,t)||s.useDefault&&s.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,s))))return;this.C(e,t,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:s,reflect:r,wrapped:n},o){s&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),n!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),r===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[r,n]of this._$Ep)this[r]=n;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[r,n]of s){const{wrapped:o}=n,a=this[r];o!==!0||this._$AL.has(r)||a===void 0||this.C(r,void 0,n,a)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(t)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};D.elementStyles=[],D.shadowRootOptions={mode:"open"},D[Z("elementProperties")]=new Map,D[Z("finalized")]=new Map,Ot?.({ReactiveElement:D}),(re.reactiveElementVersions??=[]).push("2.1.2");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/const
|
|
14
|
-
\f\r]`,B=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Be=/'/g,je=/"/g,
|
|
13
|
+
*/const ke=globalThis,Ne=i=>i,ee=ke.trustedTypes,qe=ee?ee.createPolicy("lit-html",{createHTML:i=>i}):void 0,nt="$lit$",R=`lit$${Math.random().toFixed(9).slice(2)}$`,ot="?"+R,Dt=`<${ot}>`,P=document,Q=()=>P.createComment(""),K=i=>i===null||typeof i!="object"&&typeof i!="function",$e=Array.isArray,Nt=i=>$e(i)||typeof i?.[Symbol.iterator]=="function",le=`[
|
|
14
|
+
\f\r]`,B=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ue=/-->/g,He=/>/g,E=RegExp(`>|${le}(?:([^\\s"'>=/]+)(${le}*=${le}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Be=/'/g,je=/"/g,at=/^(?:script|style|textarea|title)$/i,qt=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),d=qt(1),L=Symbol.for("lit-noChange"),k=Symbol.for("lit-nothing"),Fe=new WeakMap,z=P.createTreeWalker(P,129);function lt(i,e){if(!$e(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return qe!==void 0?qe.createHTML(e):e}const Ut=(i,e)=>{const t=i.length-1,s=[];let r,n=e===2?"<svg>":e===3?"<math>":"",o=B;for(let a=0;a<t;a++){const l=i[a];let c,p,h=-1,g=0;for(;g<l.length&&(o.lastIndex=g,p=o.exec(l),p!==null);)g=o.lastIndex,o===B?p[1]==="!--"?o=Ue:p[1]!==void 0?o=He:p[2]!==void 0?(at.test(p[2])&&(r=RegExp("</"+p[2],"g")),o=E):p[3]!==void 0&&(o=E):o===E?p[0]===">"?(o=r??B,h=-1):p[1]===void 0?h=-2:(h=o.lastIndex-p[2].length,c=p[1],o=p[3]===void 0?E:p[3]==='"'?je:Be):o===je||o===Be?o=E:o===Ue||o===He?o=B:(o=E,r=void 0);const m=o===E&&i[a+1].startsWith("/>")?" ":"";n+=o===B?l+Dt:h>=0?(s.push(c),l.slice(0,h)+nt+l.slice(h)+R+m):l+R+(h===-2?a:m)}return[lt(i,n+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};let ue=class ct{constructor({strings:e,_$litType$:t},s){let r;this.parts=[];let n=0,o=0;const a=e.length-1,l=this.parts,[c,p]=Ut(e,t);if(this.el=ct.createElement(c,s),z.currentNode=this.el.content,t===2||t===3){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=z.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const h of r.getAttributeNames())if(h.endsWith(nt)){const g=p[o++],m=r.getAttribute(h).split(R),b=/([.?@])?(.*)/.exec(g);l.push({type:1,index:n,name:b[2],strings:m,ctor:b[1]==="."?Bt:b[1]==="?"?jt:b[1]==="@"?Ft:ne}),r.removeAttribute(h)}else h.startsWith(R)&&(l.push({type:6,index:n}),r.removeAttribute(h));if(at.test(r.tagName)){const h=r.textContent.split(R),g=h.length-1;if(g>0){r.textContent=ee?ee.emptyScript:"";for(let m=0;m<g;m++)r.append(h[m],Q()),z.nextNode(),l.push({type:2,index:++n});r.append(h[g],Q())}}}else if(r.nodeType===8)if(r.data===ot)l.push({type:2,index:n});else{let h=-1;for(;(h=r.data.indexOf(R,h+1))!==-1;)l.push({type:7,index:n}),h+=R.length-1}n++}}static createElement(e,t){const s=P.createElement("template");return s.innerHTML=e,s}};function N(i,e,t=i,s){if(e===L)return e;let r=s!==void 0?t._$Co?.[s]:t._$Cl;const n=K(e)?void 0:e._$litDirective$;return r?.constructor!==n&&(r?._$AO?.(!1),n===void 0?r=void 0:(r=new n(i),r._$AT(i,t,s)),s!==void 0?(t._$Co??=[])[s]=r:t._$Cl=r),r!==void 0&&(e=N(i,r._$AS(i,e.values),r,s)),e}let Ht=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,r=(e?.creationScope??P).importNode(t,!0);z.currentNode=r;let n=z.nextNode(),o=0,a=0,l=s[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new V(n,n.nextSibling,this,e):l.type===1?c=new l.ctor(n,l.name,l.strings,this,e):l.type===6&&(c=new Zt(n,this,e)),this._$AV.push(c),l=s[++a]}o!==l?.index&&(n=z.nextNode(),o++)}return z.currentNode=P,r}p(e){let t=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}};class V{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,r){this.type=2,this._$AH=k,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=N(this,e,t),K(e)?e===k||e==null||e===""?(this._$AH!==k&&this._$AR(),this._$AH=k):e!==this._$AH&&e!==L&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Nt(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==k&&K(this._$AH)?this._$AA.nextSibling.data=e:this.T(P.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:s}=e,r=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=ue.createElement(lt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(t);else{const n=new Ht(r,this),o=n.u(this.options);n.p(t),this.T(o),this._$AH=n}}_$AC(e){let t=Fe.get(e.strings);return t===void 0&&Fe.set(e.strings,t=new ue(e)),t}k(e){$e(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,r=0;for(const n of e)r===t.length?t.push(s=new V(this.O(Q()),this.O(Q()),this,this.options)):s=t[r],s._$AI(n),r++;r<t.length&&(this._$AR(s&&s._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const s=Ne(e).nextSibling;Ne(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}let ne=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,r,n){this.type=1,this._$AH=k,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=k}_$AI(e,t=this,s,r){const n=this.strings;let o=!1;if(n===void 0)e=N(this,e,t,0),o=!K(e)||e!==this._$AH&&e!==L,o&&(this._$AH=e);else{const a=e;let l,c;for(e=n[0],l=0;l<n.length-1;l++)c=N(this,a[s+l],t,l),c===L&&(c=this._$AH[l]),o||=!K(c)||c!==this._$AH[l],c===k?e=k:e!==k&&(e+=(c??"")+n[l+1]),this._$AH[l]=c}o&&!r&&this.j(e)}j(e){e===k?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Bt=class extends ne{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===k?void 0:e}},jt=class extends ne{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==k)}},Ft=class extends ne{constructor(e,t,s,r,n){super(e,t,s,r,n),this.type=5}_$AI(e,t=this){if((e=N(this,e,t,0)??k)===L)return;const s=this._$AH,r=e===k&&s!==k||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==k&&(s===k||r);r&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Zt=class{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){N(this,e)}};const Qt=ke.litHtmlPolyfillSupport;Qt?.(ue,V),(ke.litHtmlVersions??=[]).push("3.3.3");const Kt=(i,e,t)=>{const s=t?.renderBefore??e;let r=s._$litPart$;if(r===void 0){const n=t?.renderBefore??null;s._$litPart$=r=new V(e.insertBefore(Q(),n),n,void 0,t??{})}return r._$AI(i),r};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/const ve=globalThis;let S=class extends
|
|
20
|
-
↳ while computing ${this._debugParent??"root"}`);this.#s=!0,this.#
|
|
19
|
+
*/const ve=globalThis;let S=class extends D{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Kt(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return L}};S._$litElement$=!0,S.finalized=!0,ve.litElementHydrateSupport?.({LitElement:S});const Wt=ve.litElementPolyfillSupport;Wt?.({LitElement:S});(ve.litElementVersions??=[]).push("4.2.2");var ht;let ce=0;const Ze=new Set;function Vt(i){ce++;try{i()}finally{ce--,ce===0&&Gt()}}function Gt(){const i=new Set(Ze);Ze.clear();for(const e of i)e()}function Jt(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}function Yt(i){return i&&typeof i.deref=="function"}class ye{static#e=0;#t;#s;#i=new Set;#r=ht.#e++;name;constructor(e,t){this.#t=e,this.#s=e,this.name=t}_get(){return u.activeConsumer&&u.activeConsumer.track(this),this.#t}_set(e){return Jt(e,this.#t)?(this.#s=this.#t,this.#t=e,this._notify(),!0):!1}subscribe(e,t=!1){let s=e;return t&&(s=new WeakRef(e)),this.#i.add(s),()=>this.#i.delete(s)}_notify(){const e=[...this.#i];for(const t of e){let s;if(Yt(t)){if(s=t.deref(),!s){this.#i.delete(t);continue}}else s=t;s()}}get id(){return this.#r}get previousValue(){return this.#s}toString(){return this.name?`${this.constructor.name}(${this.name})`:`${this.constructor.name}#${this.id}`}}ht=ye;class u extends ye{static#e=[];constructor(e,t){super(e,t)}static get activeConsumer(){return this.#e[this.#e.length-1]}static push(e){this.#e.push(e)}static pop(){this.#e.pop()}get(){return this._get()}set(e){Vt(()=>{this._set(e)})}get value(){return this.get()}set value(e){this.set(e)}update(e){this.set(e(this.get()))}}class Xt extends ye{#e;#t=!0;#s=!1;#i=new Map;_debugParent;#r;#a=()=>{this.#t||(this.#t=!0,this._notify())};constructor(e,t,s){super(void 0,t),this.#e=e,this.#r=s?.weak??!0}track(e){if(this.#i.has(e))return;const t=e.subscribe(this.#a,this.#r);this.#i.set(e,t)}dispose(){this.#o()}#o(){for(const e of this.#i.values())e();this.#i.clear()}get(){if(u.activeConsumer&&u.activeConsumer.track(this),!this.#t)return this._get();if(this.#s)throw new Error(`Cycle detected in ${this}
|
|
20
|
+
↳ while computing ${this._debugParent??"root"}`);this.#s=!0,this.#o(),u.push(this);try{const e=this.#e();this._set(e)}finally{u.pop(),this.#t=!1,this.#s=!1}return this._get()}get value(){return this.get()}set value(e){throw new Error(`Cannot set value of Computed ${this}. Computed values are read-only.`)}subscribe(e,t=!1){const s=super.subscribe(e,t);return u.activeConsumer||this.get(),s}}class we{#e;#t=new Map;_debugParent;constructor(e){this.#e=e,e.addController(this);const t=e,s=t.update,r=this;t.update=function(n){u.push(r);try{s.call(this,n)}finally{u.pop()}}}track(e){this.#t.has(e)||this.#t.set(e,e.subscribe(this.#s,!0))}#s=()=>{this.#e.requestUpdate()};hostUpdate(){for(const e of this.#t.values())e();this.#t.clear()}hostDisconnected(){for(const e of this.#t.values())e();this.#t.clear()}toString(){const e=this.#e;return`SignalWatcher(${e?.localName??e?.tagName??e?.constructor?.name??"unknown"})`}}function es(i){if(!i)return"unknown age";const e=new Date(i);return Number.isNaN(e.getTime())?"unknown age":e.toISOString().slice(0,10)}class ts extends S{static{this.properties={results:{attribute:!1},showRoot:{attribute:!1},onSelect:{attribute:!1},selectedIds:{attribute:!1},onToggleSelect:{attribute:!1}}}static{this.styles=W`
|
|
21
21
|
:host { display: block; }
|
|
22
22
|
.count-header {
|
|
23
23
|
padding: 8px 14px;
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
.row { padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; gap: 8px; }
|
|
32
32
|
.row:hover { background: var(--hover); }
|
|
33
33
|
.row.deprecated { opacity: 0.55; }
|
|
34
|
+
.row.paused { opacity: 0.6; }
|
|
34
35
|
.row-checkbox { flex: 0 0 auto; margin-top: 2px; cursor: pointer; }
|
|
35
36
|
.row-body { flex: 1 1 auto; min-width: 0; }
|
|
36
37
|
.top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
|
|
@@ -49,40 +50,45 @@
|
|
|
49
50
|
font-size: 10px; text-transform: uppercase; border: 1px solid var(--danger);
|
|
50
51
|
color: var(--danger); background: color-mix(in srgb, var(--danger) 13%, transparent); border-radius: 4px; padding: 0 4px;
|
|
51
52
|
}
|
|
53
|
+
.paused-badge {
|
|
54
|
+
font-size: 10px; text-transform: uppercase; border: 1px solid var(--accent);
|
|
55
|
+
color: var(--accent); background: var(--accent-tint); border-radius: 4px; padding: 0 4px;
|
|
56
|
+
}
|
|
52
57
|
.empty { padding: 24px; opacity: 0.6; font-size: 13px; }
|
|
53
|
-
`}render(){return!this.results||this.results.length===0?
|
|
58
|
+
`}render(){return!this.results||this.results.length===0?d`<div class="empty">No results.</div>`:d`
|
|
54
59
|
<div class="count-header">${this.results.length} result${this.results.length===1?"":"s"}</div>
|
|
55
|
-
${this.results.map(e=>{const t=e._table==="skills"&&e.root==="builtin";return
|
|
56
|
-
<div class="row ${e.deprecated?"deprecated":""}" @click=${()=>this.onSelect(e)}>
|
|
60
|
+
${this.results.map(e=>{const t=e._table==="skills"&&e.root==="builtin";return d`
|
|
61
|
+
<div class="row ${e.deprecated?"deprecated":""} ${e.paused?"paused":""}" @click=${()=>this.onSelect(e)}>
|
|
57
62
|
<input
|
|
58
63
|
type="checkbox"
|
|
59
64
|
class="row-checkbox"
|
|
60
65
|
.checked=${this.selectedIds?.has(e.id)??!1}
|
|
61
66
|
.disabled=${t}
|
|
62
|
-
title=${t?"Builtin skills can't be bulk-deprecated or deleted":""}
|
|
67
|
+
title=${t?"Builtin skills can't be bulk-deprecated, paused, or deleted":""}
|
|
63
68
|
@click=${s=>{s.stopPropagation(),t||this.onToggleSelect(e)}}
|
|
64
69
|
/>
|
|
65
70
|
<div class="row-body">
|
|
66
71
|
<div class="top">
|
|
67
72
|
<span class="name">${e.name}</span>
|
|
68
|
-
<span class="meta">${
|
|
73
|
+
<span class="meta">${es(e.created_at)} · ${e.owner??"—"} · ${e.status}</span>
|
|
69
74
|
</div>
|
|
70
75
|
<div class="desc">${e.description}</div>
|
|
71
76
|
<div class="tags">
|
|
72
77
|
<span class="type-badge">${e._table==="skills"?"skill":"memory"}</span>
|
|
73
|
-
${this.showRoot&&e.root?
|
|
74
|
-
${e.deprecated?
|
|
75
|
-
${e.
|
|
78
|
+
${this.showRoot&&e.root?d`<span class="root-badge">${e.root}</span>`:""}
|
|
79
|
+
${e.deprecated?d`<span class="deprecated-badge">deprecated</span>`:""}
|
|
80
|
+
${e.paused?d`<span class="paused-badge">paused</span>`:""}
|
|
81
|
+
${e.tags.map(s=>d`<span class="tag">${s}</span>`)}
|
|
76
82
|
</div>
|
|
77
83
|
</div>
|
|
78
84
|
</div>
|
|
79
85
|
`})}
|
|
80
|
-
`}}customElements.define("result-list",
|
|
81
|
-
]`).replace("lheading",
|
|
86
|
+
`}}customElements.define("result-list",ts);function _e(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var M=_e();function pt(i){M=i}var C={exec:()=>null};function O(i){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),r=e[s];return r||(r=i(s),e[s]=r),r}}function f(i,e=""){let t=typeof i=="string"?i:i.source,s={replace:(r,n)=>{let o=typeof n=="string"?n:n.source;return o=o.replace($.caret,"$1"),t=t.replace(r,o),s},getRegex:()=>new RegExp(t,e)};return s}var ss=((i="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+i)}catch{return!1}})(),$={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:i=>new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:O(i=>new RegExp(`^ {0,${i}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:O(i=>new RegExp(`^ {0,${i}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:O(i=>new RegExp(`^ {0,${i}}(?:\`\`\`|~~~)`)),headingBeginRegex:O(i=>new RegExp(`^ {0,${i}}#`)),htmlBeginRegex:O(i=>new RegExp(`^ {0,${i}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:O(i=>new RegExp(`^ {0,${i}}>`))},is=/^(?:[ \t]*(?:\n|$))+/,rs=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ns=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,G=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,os=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Se=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ut=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,dt=f(ut).replace(/bull/g,Se).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),as=f(ut).replace(/bull/g,Se).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ae=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,ls=/^[^\n]+/,Te=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,cs=f(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Te).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),hs=f(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Se).getRegex(),oe="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Re=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ps=f("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Re).replace("tag",oe).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),gt=i=>f(Ae).replace("hr",G).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",i).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oe).getRegex(),us=gt(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),ds=gt(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),gs=f(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ds).getRegex(),Ee={blockquote:gs,code:rs,def:cs,fences:ns,heading:os,hr:G,html:ps,lheading:dt,list:hs,newline:is,paragraph:us,table:C,text:ls},Qe=f("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",G).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oe).getRegex(),fs={...Ee,lheading:as,table:Qe,paragraph:f(Ae).replace("hr",G).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Qe).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oe).getRegex()},bs={...Ee,html:f(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Re).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:C,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:f(Ae).replace("hr",G).replace("heading",` *#{1,6} *[^
|
|
87
|
+
]`).replace("lheading",dt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},xs=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ms=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ft=/^( {2,}|\\)\n(?!\s*$)/,ks=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,A=/[\p{P}\p{S}]/u,q=/[\s\p{P}\p{S}]/u,J=/[^\s\p{P}\p{S}]/u,$s=f(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,q).getRegex(),vs=/[\p{Pi}\p{Ps}"']/u,bt=/(?!~)[\p{P}\p{S}]/u,ys=/(?!~)[\s\p{P}\p{S}]/u,ws=/(?:[^\s\p{P}\p{S}]|~)/u,_s=f(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",ss?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),xt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ss=f(xt,"u").replace(/punct/g,A).getRegex(),As=f(xt,"u").replace(/punct/g,bt).getRegex(),Ts=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,Rs=f(Ts,"u").replace(/openQuote/g,vs).replace(/punct/g,A).getRegex(),mt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Es=f(mt,"gu").replace(/notPunctSpace/g,J).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Cs=f(mt,"gu").replace(/notPunctSpace/g,ws).replace(/punctSpace/g,ys).replace(/punct/g,bt).getRegex(),zs="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",Ps=f(zs,"gu").replace(/notPunctSpace/g,J).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Ls=f("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,J).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Is="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Ms=f(Is,"gu").replace(/notPunctSpace/g,J).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Os=f(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,A).getRegex(),Ds="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Ns=f(Ds,"gu").replace(/notPunctSpace/g,J).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),qs=f(/\\(punct)/,"gu").replace(/punct/g,A).getRegex(),Us=f(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Hs=f(Re).replace("(?:-->|$)","-->").getRegex(),Bs=f("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Hs).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),te=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,js=f(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",te).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),kt=f(/^!?\[(label)\]\[(ref)\]/).replace("label",te).replace("ref",Te).getRegex(),$t=f(/^!?\[(ref)\](?:\[\])?/).replace("ref",Te).getRegex(),Fs=f("reflink|nolink(?!\\()","g").replace("reflink",kt).replace("nolink",$t).getRegex(),Ke=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ce={_backpedal:C,anyPunctuation:qs,autolink:Us,blockSkip:_s,br:ft,code:ms,del:C,delLDelim:C,delRDelim:C,emStrongLDelim:Ss,emStrongRDelimAst:Es,emStrongRDelimUnd:Ls,escape:xs,link:js,nolink:$t,punctuation:$s,reflink:kt,reflinkSearch:Fs,tag:Bs,text:ks,url:C},Zs={...Ce,emStrongLDelim:Rs,emStrongRDelimAst:Ps,emStrongRDelimUnd:Ms,link:f(/^!?\[(label)\]\((.*?)\)/).replace("label",te).getRegex(),reflink:f(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",te).getRegex()},de={...Ce,emStrongRDelimAst:Cs,emStrongLDelim:As,delLDelim:Os,delRDelim:Ns,url:f(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ke).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:f(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ke).getRegex()},Qs={...de,br:f(ft).replace("{2,}","*").getRegex(),text:f(de.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Y={normal:Ee,gfm:fs,pedantic:bs},j={normal:Ce,gfm:de,breaks:Qs,pedantic:Zs},Ks={"&":"&","<":"<",">":">",'"':""","'":"'"},We=i=>Ks[i];function _(i,e){if(e){if($.escapeTest.test(i))return i.replace($.escapeReplace,We)}else if($.escapeTestNoEncode.test(i))return i.replace($.escapeReplaceNoEncode,We);return i}function Ve(i){try{i=encodeURI(i).replace($.percentDecode,"%")}catch{return null}return i}function Ge(i,e){let t=i.replace($.findPipe,(n,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),s=t.split($.splitPipe),r=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;r<s.length;r++)s[r]=s[r].trim().replace($.slashPipe,"|");return s}function T(i,e,t){let s=i.length;if(s===0)return"";let r=0;for(;r<s&&i.charAt(s-r-1)===e;)r++;return i.slice(0,s-r)}function Je(i){let e=i.split(`
|
|
82
88
|
`),t=e.length-1;for(;t>=0&&$.blankLine.test(e[t]);)t--;return e.length-t<=2?i:e.slice(0,t+1).join(`
|
|
83
|
-
`)}function Ws(i,e){if(i.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<i.length;s++)if(i[s]==="\\")s++;else if(i[s]===e[0])t++;else if(i[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function
|
|
89
|
+
`)}function Ws(i,e){if(i.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<i.length;s++)if(i[s]==="\\")s++;else if(i[s]===e[0])t++;else if(i[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function Vs(i,e=0){let t=e,s="";for(let r of i)if(r===" "){let n=4-t%4;s+=" ".repeat(n),t+=n}else s+=r,t++;return s}function Ye(i,e,t,s,r){let n=e.href,o=e.title||null,a=i[1].replace(r.other.outputLinkReplace,"$1");s.state.inLink=!0;let l={type:i[0].charAt(0)==="!"?"image":"link",raw:t,href:n,title:o,text:a,tokens:s.inlineTokens(a)};return s.state.inLink=!1,l}function Gs(i,e,t){let s=i.match(t.other.indentCodeCompensation);if(s===null)return e;let r=s[1];return e.split(`
|
|
84
90
|
`).map(n=>{let o=n.match(t.other.beginningSpace);if(o===null)return n;let[a]=o;return a.length>=r.length?n.slice(r.length):n}).join(`
|
|
85
|
-
`)}var se=class{options;rules;lexer;constructor(i){this.options=i||
|
|
91
|
+
`)}var se=class{options;rules;lexer;constructor(i){this.options=i||M}space(i){let e=this.rules.block.newline.exec(i);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(i){let e=this.rules.block.code.exec(i);if(e){let t=this.options.pedantic?e[0]:Je(e[0]),s=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:s}}}fences(i){let e=this.rules.block.fences.exec(i);if(e){let t=e[0],s=Gs(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(i){let e=this.rules.block.heading.exec(i);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=T(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:T(e[0],`
|
|
86
92
|
`),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(i){let e=this.rules.block.hr.exec(i);if(e)return{type:"hr",raw:T(e[0],`
|
|
87
93
|
`)}}blockquote(i){let e=this.rules.block.blockquote.exec(i);if(e){let t=T(e[0],`
|
|
88
94
|
`).split(`
|
|
@@ -90,25 +96,25 @@
|
|
|
90
96
|
`),p=c.replace(this.rules.other.blockquoteSetextReplace,`
|
|
91
97
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
92
98
|
${c}`:c,r=r?`${r}
|
|
93
|
-
${p}`:p;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,n,!0),this.lexer.state.top=h,t.length===0)break;let
|
|
94
|
-
`),
|
|
95
|
-
`+b.replace(this.rules.other.blockquoteSetextReplace2,""),
|
|
96
|
-
${b}`,r=r.substring(0,r.length-
|
|
99
|
+
${p}`:p;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,n,!0),this.lexer.state.top=h,t.length===0)break;let g=n.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){let m=g,b=t.join(`
|
|
100
|
+
`),w=m.raw+`
|
|
101
|
+
`+b.replace(this.rules.other.blockquoteSetextReplace2,""),U=this.blockquote(w);n[n.length-1]=U,s=`${s}
|
|
102
|
+
${b}`,r=r.substring(0,r.length-m.text.length)+U.text;break}else if(g?.type==="list"){let m=g,b=m.raw+`
|
|
97
103
|
`+t.join(`
|
|
98
|
-
`),
|
|
99
|
-
`);continue}}return{type:"blockquote",raw:s,tokens:n,text:r}}}list(i){let e=this.rules.block.list.exec(i);if(e){let t=e[1].trim(),s=t.length>1,r={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let n=this.rules.other.listItemRegex(t),o=!1;for(;i;){let l=!1,c="",p="";if(!(e=n.exec(i))||this.rules.block.hr.test(i))break;c=e[0],i=i.substring(c.length);let h=
|
|
100
|
-
`,1)[0],e[1].length),
|
|
101
|
-
`,1)[0],
|
|
102
|
-
`,i=i.substring(
|
|
103
|
-
`,1)[0],
|
|
104
|
-
`+
|
|
105
|
-
`+
|
|
106
|
-
`,i=i.substring(ae.length+1),h=
|
|
104
|
+
`),w=this.list(b);n[n.length-1]=w,s=s.substring(0,s.length-g.raw.length)+w.raw,r=r.substring(0,r.length-m.raw.length)+w.raw,t=b.substring(n.at(-1).raw.length).split(`
|
|
105
|
+
`);continue}}return{type:"blockquote",raw:s,tokens:n,text:r}}}list(i){let e=this.rules.block.list.exec(i);if(e){let t=e[1].trim(),s=t.length>1,r={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let n=this.rules.other.listItemRegex(t),o=!1;for(;i;){let l=!1,c="",p="";if(!(e=n.exec(i))||this.rules.block.hr.test(i))break;c=e[0],i=i.substring(c.length);let h=Vs(e[2].split(`
|
|
106
|
+
`,1)[0],e[1].length),g=i.split(`
|
|
107
|
+
`,1)[0],m=!h.trim(),b=0;if(this.options.pedantic?(b=2,p=h.trimStart()):m?b=e[1].length+1:(b=h.search(this.rules.other.nonSpaceChar),b=b>4?1:b,p=h.slice(b),b+=e[1].length),m&&this.rules.other.blankLine.test(g)&&(c+=g+`
|
|
108
|
+
`,i=i.substring(g.length+1),l=!0),!l){let w=this.rules.other.nextBulletRegex(b),U=this.rules.other.hrRegex(b),Pe=this.rules.other.fencesBeginRegex(b),Le=this.rules.other.headingBeginRegex(b),St=this.rules.other.htmlBeginRegex(b),At=this.rules.other.blockquoteBeginRegex(b);for(;i;){let ae=i.split(`
|
|
109
|
+
`,1)[0],H;if(g=ae,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),H=g):H=g.replace(this.rules.other.tabCharGlobal," "),Pe.test(g)||Le.test(g)||St.test(g)||At.test(g)||w.test(g)||U.test(g))break;if(H.search(this.rules.other.nonSpaceChar)>=b||!g.trim())p+=`
|
|
110
|
+
`+H.slice(b);else{if(m||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||Pe.test(h)||Le.test(h)||U.test(h))break;p+=`
|
|
111
|
+
`+g}m=!g.trim(),c+=ae+`
|
|
112
|
+
`,i=i.substring(ae.length+1),h=H.slice(b)}}r.loose||(o?r.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0)),r.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),r.raw+=c}let a=r.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let l of r.items)if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),!r.loose){let c=l.tokens.filter(h=>h.type==="space"),p=c.length>0&&c.some(h=>this.rules.other.anyLine.test(h.raw));r.loose=p}for(let l of r.items){let c=l.tokens[0];if(l.task&&(c?.type==="text"||c?.type==="paragraph")){l.text=l.text.replace(this.rules.other.listReplaceTask,""),c.raw=c.raw.replace(this.rules.other.listReplaceTask,""),c.text=c.text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(l.raw);if(p){let h={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};l.checked=h.checked,r.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=h.raw+l.tokens[0].raw,l.tokens[0].text=h.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(h)):l.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):l.tokens.unshift(h)}}else l.task&&(l.task=!1)}if(r.loose)for(let l of r.items){l.loose=!0;for(let c of l.tokens)c.type==="text"&&(c.type="paragraph")}return r}}html(i){let e=this.rules.block.html.exec(i);if(e){let t=Je(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(i){let e=this.rules.block.def.exec(i);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:T(e[0],`
|
|
107
113
|
`),href:s,title:r}}}table(i){let e=this.rules.block.table.exec(i);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=Ge(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
108
114
|
`):[],n={type:"table",raw:T(e[0],`
|
|
109
115
|
`),header:[],align:[],rows:[]};if(t.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?n.align.push("right"):this.rules.other.tableAlignCenter.test(o)?n.align.push("center"):this.rules.other.tableAlignLeft.test(o)?n.align.push("left"):n.align.push(null);for(let o=0;o<t.length;o++)n.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:n.align[o]});for(let o of r)n.rows.push(Ge(o,n.header.length).map((a,l)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:n.align[l]})));return n}}lheading(i){let e=this.rules.block.lheading.exec(i);if(e){let t=e[1].trim();return{type:"heading",raw:T(e[0],`
|
|
110
116
|
`),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(i){let e=this.rules.block.paragraph.exec(i);if(e){let t=e[1].charAt(e[1].length-1)===`
|
|
111
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(i){let e=this.rules.block.text.exec(i);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(i){let e=this.rules.inline.escape.exec(i);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(i){let e=this.rules.inline.tag.exec(i);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(i){let e=this.rules.inline.link.exec(i);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let n=T(t.slice(0,-1),"\\");if((t.length-n.length)%2===0)return}else{let n=Ws(e[2],"()");if(n===-2)return;if(n>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+n;e[2]=e[2].substring(0,n),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let s=e[2],r="";if(this.options.pedantic){let n=this.rules.other.pedanticHrefTitle.exec(s);n&&(s=n[1],r=n[3])}else r=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),
|
|
117
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(i){let e=this.rules.block.text.exec(i);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(i){let e=this.rules.inline.escape.exec(i);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(i){let e=this.rules.inline.tag.exec(i);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(i){let e=this.rules.inline.link.exec(i);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let n=T(t.slice(0,-1),"\\");if((t.length-n.length)%2===0)return}else{let n=Ws(e[2],"()");if(n===-2)return;if(n>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+n;e[2]=e[2].substring(0,n),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let s=e[2],r="";if(this.options.pedantic){let n=this.rules.other.pedanticHrefTitle.exec(s);n&&(s=n[1],r=n[3])}else r=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),Ye(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(i,e){let t;if((t=this.rules.inline.reflink.exec(i))||(t=this.rules.inline.nolink.exec(i))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=e[s.toLowerCase()];if(!r){let n=t[0].charAt(0);return{type:"text",raw:n,text:n}}return Ye(t,r,t[0],this.lexer,this.rules)}}emStrong(i,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(i);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let r=[...s[0]].length-1,n,o,a=r,l=0,c=s[0][0],p=t===c,h=c==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*i.length+r);(s=h.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n)continue;if(o=[...n].length,s[3]||s[4]){a+=o;continue}else if(s[5]||s[6]){if(r%3&&!((r+o)%3)){l+=o;continue}if(p)break}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let g=[...s[0]][0].length,m=i.slice(0,r+s.index+g+o);if(Math.min(r,o)%2){let w=m.slice(1,-1);return{type:"em",raw:m,text:w,tokens:this.lexer.inlineTokens(w)}}let b=m.slice(2,-2);return{type:"strong",raw:m,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(i){let e=this.rules.inline.code.exec(i);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),r=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&r&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(i){let e=this.rules.inline.br.exec(i);if(e)return{type:"br",raw:e[0]}}del(i,e,t=""){let s=this.rules.inline.delLDelim.exec(i);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let r=[...s[0]].length-1,n,o,a=r,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*i.length+r);(s=l.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n||(o=[...n].length,o!==r))continue;if(s[3]||s[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let c=[...s[0]][0].length,p=i.slice(0,r+s.index+c+o),h=p.slice(r,-r);return{type:"del",raw:p,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(i){let e=this.rules.inline.autolink.exec(i);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(i){let e;if(e=this.rules.inline.url.exec(i)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let r;do r=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(r!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(i){let e=this.rules.inline.text.exec(i);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},v=class ge{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||M,this.options.tokenizer=this.options.tokenizer||new se,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:$,block:Y.normal,inline:j.normal};this.options.pedantic?(t.block=Y.pedantic,t.inline=j.pedantic):this.options.gfm&&(t.block=Y.gfm,this.options.breaks?t.inline=j.breaks:t.inline=j.gfm),this.tokenizer.rules=t}static get rules(){return{block:Y,inline:j}}static lex(e,t){return new ge(t).lex(e)}static lexInline(e,t){return new ge(t).inlineTokens(e)}lex(e){e=e.replace($.carriageReturn,`
|
|
112
118
|
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace($.tabCharGlobal," ").replace($.spaceLine,""));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let n;if(this.options.extensions?.block?.some(a=>(n=a.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))continue;if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length);let a=t.at(-1);n.raw.length===1&&a!==void 0?a.raw+=`
|
|
113
119
|
`:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
114
120
|
`)?"":`
|
|
@@ -122,7 +128,7 @@ ${b}`,r=r.substring(0,r.length-k.text.length)+H.text;break}else if(d?.type==="li
|
|
|
122
128
|
`+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(n),s=o.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length);let a=t.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
123
129
|
`)?"":`
|
|
124
130
|
`)+n.raw,a.text+=`
|
|
125
|
-
`+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(n);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=e;if(this.tokens.links){let a=Object.keys(this.tokens.links);a.length>0&&(s=s.replace(this.tokenizer.rules.inline.reflinkSearch,l=>a.includes(l.slice(l.lastIndexOf("[")+1,-1))?"["+"a".repeat(l.length-2)+"]":l))}s=s.replace(this.tokenizer.rules.inline.anyPunctuation,a=>"+".repeat(a.length)),s=s.replace(this.tokenizer.rules.inline.blockSkip,(a,l,c)=>{let p=c?c.length:0;return a.slice(0,p)+"["+"a".repeat(a.length-p-2)+"]"}),s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let r=!1,n="",o=1/0;for(;e;){if(e.length<o)o=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(n=""),r=!1;let a;if(this.options.extensions?.inline?.some(c=>(a=c.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let c=t.at(-1);a.type==="text"&&c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,s,n)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e,s,n)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let l=e;if(this.options.extensions?.startInline){let c=1/0,p=e.slice(1),h;this.options.extensions.startInline.forEach(
|
|
131
|
+
`+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(n);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=e;if(this.tokens.links){let a=Object.keys(this.tokens.links);a.length>0&&(s=s.replace(this.tokenizer.rules.inline.reflinkSearch,l=>a.includes(l.slice(l.lastIndexOf("[")+1,-1))?"["+"a".repeat(l.length-2)+"]":l))}s=s.replace(this.tokenizer.rules.inline.anyPunctuation,a=>"+".repeat(a.length)),s=s.replace(this.tokenizer.rules.inline.blockSkip,(a,l,c)=>{let p=c?c.length:0;return a.slice(0,p)+"["+"a".repeat(a.length-p-2)+"]"}),s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let r=!1,n="",o=1/0;for(;e;){if(e.length<o)o=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(n=""),r=!1;let a;if(this.options.extensions?.inline?.some(c=>(a=c.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let c=t.at(-1);a.type==="text"&&c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,s,n)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e,s,n)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let l=e;if(this.options.extensions?.startInline){let c=1/0,p=e.slice(1),h;this.options.extensions.startInline.forEach(g=>{h=g.call({lexer:this},p),typeof h=="number"&&h>=0&&(c=Math.min(c,h))}),c<1/0&&c>=0&&(l=e.substring(0,c+1))}if(a=this.tokenizer.inlineText(l)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(n=a.raw.slice(-1)),r=!0;let c=t.at(-1);c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):t.push(a);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},ie=class{options;parser;constructor(i){this.options=i||M}space(i){return""}code({text:i,lang:e,escaped:t}){let s=(e||"").match($.notSpaceStart)?.[0],r=i.replace($.endingNewline,"")+`
|
|
126
132
|
`;return s?'<pre><code class="language-'+_(s)+'">'+(t?r:_(r,!0))+`</code></pre>
|
|
127
133
|
`:"<pre><code>"+(t?r:_(r,!0))+`</code></pre>
|
|
128
134
|
`}blockquote({tokens:i}){return`<blockquote>
|
|
@@ -140,16 +146,16 @@ ${this.parser.parse(i)}</blockquote>
|
|
|
140
146
|
`}tablerow({text:i}){return`<tr>
|
|
141
147
|
${i}</tr>
|
|
142
148
|
`}tablecell(i){let e=this.parser.parseInline(i.tokens),t=i.header?"th":"td";return(i.align?`<${t} align="${i.align}">`:`<${t}>`)+e+`</${t}>
|
|
143
|
-
`}strong({tokens:i}){return`<strong>${this.parser.parseInline(i)}</strong>`}em({tokens:i}){return`<em>${this.parser.parseInline(i)}</em>`}codespan({text:i}){return`<code>${_(i,!0)}</code>`}br(i){return"<br>"}del({tokens:i}){return`<del>${this.parser.parseInline(i)}</del>`}link({href:i,title:e,tokens:t}){let s=this.parser.parseInline(t),r=Ve(i);if(r===null)return s;i=r;let n='<a href="'+i+'"';return e&&(n+=' title="'+_(e)+'"'),n+=">"+s+"</a>",n}image({href:i,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let r=Ve(i);if(r===null)return _(t);i=r;let n=`<img src="${i}" alt="${_(t)}"`;return e&&(n+=` title="${_(e)}"`),n+=">",n}text(i){return"tokens"in i&&i.tokens?this.parser.parseInline(i.tokens):"escaped"in i&&i.escaped?i.text:_(i.text)}},ze=class{strong({text:i}){return i}em({text:i}){return i}codespan({text:i}){return i}del({text:i}){return i}html({text:i}){return i}text({text:i}){return i}link({text:i}){return""+i}image({text:i}){return""+i}br(){return""}checkbox({raw:i}){return i}},
|
|
144
|
-
Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error occurred:</p><pre>"+_(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},
|
|
149
|
+
`}strong({tokens:i}){return`<strong>${this.parser.parseInline(i)}</strong>`}em({tokens:i}){return`<em>${this.parser.parseInline(i)}</em>`}codespan({text:i}){return`<code>${_(i,!0)}</code>`}br(i){return"<br>"}del({tokens:i}){return`<del>${this.parser.parseInline(i)}</del>`}link({href:i,title:e,tokens:t}){let s=this.parser.parseInline(t),r=Ve(i);if(r===null)return s;i=r;let n='<a href="'+i+'"';return e&&(n+=' title="'+_(e)+'"'),n+=">"+s+"</a>",n}image({href:i,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let r=Ve(i);if(r===null)return _(t);i=r;let n=`<img src="${i}" alt="${_(t)}"`;return e&&(n+=` title="${_(e)}"`),n+=">",n}text(i){return"tokens"in i&&i.tokens?this.parser.parseInline(i.tokens):"escaped"in i&&i.escaped?i.text:_(i.text)}},ze=class{strong({text:i}){return i}em({text:i}){return i}codespan({text:i}){return i}del({text:i}){return i}html({text:i}){return i}text({text:i}){return i}link({text:i}){return""+i}image({text:i}){return""+i}br(){return""}checkbox({raw:i}){return i}},y=class fe{options;renderer;textRenderer;constructor(e){this.options=e||M,this.options.renderer=this.options.renderer||new ie,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ze}static parse(e,t){return new fe(t).parse(e)}static parseInline(e,t){return new fe(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let r=e[s];if(this.options.extensions?.renderers?.[r.type]){let o=r,a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(o.type)){t+=a||"";continue}}let n=r;switch(n.type){case"space":{t+=this.renderer.space(n);break}case"hr":{t+=this.renderer.hr(n);break}case"heading":{t+=this.renderer.heading(n);break}case"code":{t+=this.renderer.code(n);break}case"table":{t+=this.renderer.table(n);break}case"blockquote":{t+=this.renderer.blockquote(n);break}case"list":{t+=this.renderer.list(n);break}case"checkbox":{t+=this.renderer.checkbox(n);break}case"html":{t+=this.renderer.html(n);break}case"def":{t+=this.renderer.def(n);break}case"paragraph":{t+=this.renderer.paragraph(n);break}case"text":{t+=this.renderer.text(n);break}default:{let o='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let s="";for(let r=0;r<e.length;r++){let n=e[r];if(this.options.extensions?.renderers?.[n.type]){let a=this.options.extensions.renderers[n.type].call({parser:this},n);if(a!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(n.type)){s+=a||"";continue}}let o=n;switch(o.type){case"escape":{s+=t.text(o);break}case"html":{s+=t.html(o);break}case"link":{s+=t.link(o);break}case"image":{s+=t.image(o);break}case"checkbox":{s+=t.checkbox(o);break}case"strong":{s+=t.strong(o);break}case"em":{s+=t.em(o);break}case"codespan":{s+=t.codespan(o);break}case"br":{s+=t.br(o);break}case"del":{s+=t.del(o);break}case"text":{s+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return s}},F=class{options;block;constructor(i){this.options=i||M}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(i){return i}postprocess(i){return i}processAllTokens(i){return i}emStrongMask(i){return i}provideLexer(i=this.block){return i?v.lex:v.lexInline}provideParser(i=this.block){return i?y.parse:y.parseInline}},Js=class{defaults=_e();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=y;Renderer=ie;TextRenderer=ze;Lexer=v;Tokenizer=se;Hooks=F;constructor(...i){this.use(...i)}walkTokens(i,e){let t=[];for(let s of i)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let r=s;for(let n of r.header)t=t.concat(this.walkTokens(n.tokens,e));for(let n of r.rows)for(let o of n)t=t.concat(this.walkTokens(o.tokens,e));break}case"list":{let r=s;t=t.concat(this.walkTokens(r.items,e));break}default:{let r=s;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(n=>{let o=r[n].flat(1/0);t=t.concat(this.walkTokens(o,e))}):r.tokens&&(t=t.concat(this.walkTokens(r.tokens,e)))}}return t}use(...i){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return i.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let n=e.renderers[r.name];n?e.renderers[r.name]=function(...o){let a=r.renderer.apply(this,o);return a===!1&&(a=n.apply(this,o)),a}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let n=e[r.level];n?n.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),s.extensions=e),t.renderer){let r=this.defaults.renderer||new ie(this.defaults);for(let n in t.renderer){if(!(n in r))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let o=n,a=t.renderer[o],l=r[o];r[o]=(...c)=>{let p=a.apply(r,c);return p===!1&&(p=l.apply(r,c)),p||""}}s.renderer=r}if(t.tokenizer){let r=this.defaults.tokenizer||new se(this.defaults);for(let n in t.tokenizer){if(!(n in r))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let o=n,a=t.tokenizer[o],l=r[o];r[o]=(...c)=>{let p=a.apply(r,c);return p===!1&&(p=l.apply(r,c)),p}}s.tokenizer=r}if(t.hooks){let r=this.defaults.hooks||new F;for(let n in t.hooks){if(!(n in r))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let o=n,a=t.hooks[o],l=r[o];F.passThroughHooks.has(n)?r[o]=c=>{if(this.defaults.async&&F.passThroughHooksRespectAsync.has(n))return(async()=>{let h=await a.call(r,c);return l.call(r,h)})();let p=a.call(r,c);return l.call(r,p)}:r[o]=(...c)=>{if(this.defaults.async)return(async()=>{let h=await a.apply(r,c);return h===!1&&(h=await l.apply(r,c)),h})();let p=a.apply(r,c);return p===!1&&(p=l.apply(r,c)),p}}s.hooks=r}if(t.walkTokens){let r=this.defaults.walkTokens,n=t.walkTokens;s.walkTokens=function(o){let a=[];return a.push(n.call(this,o)),r&&(a=a.concat(r.call(this,o))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(i){return this.defaults={...this.defaults,...i},this}lexer(i,e){return v.lex(i,e??this.defaults)}parser(i,e){return y.parse(i,e??this.defaults)}parseMarkdown(i){return(e,t)=>{let s={...t},r={...this.defaults,...s},n=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&s.async===!1)return n(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return n(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return n(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=i),r.async)return(async()=>{let o=r.hooks?await r.hooks.preprocess(e):e,a=await(r.hooks?await r.hooks.provideLexer(i):i?v.lex:v.lexInline)(o,r),l=r.hooks?await r.hooks.processAllTokens(a):a;r.walkTokens&&await Promise.all(this.walkTokens(l,r.walkTokens));let c=await(r.hooks?await r.hooks.provideParser(i):i?y.parse:y.parseInline)(l,r);return r.hooks?await r.hooks.postprocess(c):c})().catch(n);try{r.hooks&&(e=r.hooks.preprocess(e));let o=(r.hooks?r.hooks.provideLexer(i):i?v.lex:v.lexInline)(e,r);r.hooks&&(o=r.hooks.processAllTokens(o)),r.walkTokens&&this.walkTokens(o,r.walkTokens);let a=(r.hooks?r.hooks.provideParser(i):i?y.parse:y.parseInline)(o,r);return r.hooks&&(a=r.hooks.postprocess(a)),a}catch(o){return n(o)}}}onError(i,e){return t=>{if(t.message+=`
|
|
150
|
+
Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error occurred:</p><pre>"+_(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},I=new Js;function x(i,e){return I.parse(i,e)}x.options=x.setOptions=function(i){return I.setOptions(i),x.defaults=I.defaults,pt(x.defaults),x};x.getDefaults=_e;x.defaults=M;function Ys(...i){return I.use(...i),x.defaults=I.defaults,pt(x.defaults),x}x.use=Ys;x.walkTokens=function(i,e){return I.walkTokens(i,e)};x.parseInline=I.parseInline;x.Parser=y;x.parser=y.parse;x.Renderer=ie;x.TextRenderer=ze;x.Lexer=v;x.lexer=v.lex;x.Tokenizer=se;x.Hooks=F;x.parse=x;x.options;x.setOptions;x.walkTokens;x.parseInline;y.parse;v.lex;/**
|
|
145
151
|
* @license
|
|
146
152
|
* Copyright 2017 Google LLC
|
|
147
153
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
148
|
-
*/const Xs={CHILD:2},
|
|
154
|
+
*/const Xs={CHILD:2},ei=i=>(...e)=>({_$litDirective$:i,values:e});class ti{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,s){this._$Ct=e,this._$AM=t,this._$Ci=s}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
|
|
149
155
|
* @license
|
|
150
156
|
* Copyright 2017 Google LLC
|
|
151
157
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
152
|
-
*/class be extends
|
|
158
|
+
*/class be extends ti{constructor(e){if(super(e),this.it=k,e.type!==Xs.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===k||e==null)return this._t=void 0,this.it=e;if(e===L)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}be.directiveName="unsafeHTML",be.resultType=1;const si=ei(be),Xe="mem-bucket-detail-view-mode";class ii extends S{constructor(){super(...arguments),this._viewMode=localStorage.getItem(Xe)??"markdown"}static{this.properties={selected:{attribute:!1},onChanged:{attribute:!1},_doc:{state:!0},_viewMode:{state:!0}}}static{this.styles=W`
|
|
153
159
|
:host { display: block; padding: 16px; }
|
|
154
160
|
h2 { margin: 0 0 4px; font-size: 16px; }
|
|
155
161
|
.meta { font-size: 12px; opacity: 0.7; margin-bottom: 12px; }
|
|
@@ -226,17 +232,19 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
|
|
|
226
232
|
border-color: var(--danger);
|
|
227
233
|
color: var(--danger);
|
|
228
234
|
}
|
|
229
|
-
`}updated(e){e.has("selected")&&this.selected&&(this.#
|
|
235
|
+
`}updated(e){e.has("selected")&&this.selected&&(this.#e(),this.scrollTop=0)}async#e(){const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);this._doc=s.ok?await s.json():null,await this.updateComplete,this.shadowRoot?.querySelector(".markdown-body")?.scrollTo(0,0),this.shadowRoot?.querySelector("pre")?.scrollTo(0,0)}#t(){this._doc?.source_path&&navigator.clipboard?.writeText(this._doc.source_path)}#s(e){this._viewMode=e,localStorage.setItem(Xe,e)}async#i(){const{table:e,id:t}=this.selected,s=!this._doc?.deprecated;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/deprecated`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({deprecated:s})}),await this.#e(),this.onChanged?.()}async#r(){const{table:e,id:t}=this.selected,s=!this._doc?.paused;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/paused`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({paused:s})}),await this.#e(),this.onChanged?.()}async#a(){if(!window.confirm("Delete this doc? This can't be undone."))return;const{table:e,id:t}=this.selected;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"DELETE"}),this._doc=null,this.onChanged?.()}render(){if(!this.selected)return d`<div class="empty">Select an entry to view its details.</div>`;if(!this._doc)return k;const e=this._doc,t=this.selected.table==="skills"&&e.root==="builtin";return d`
|
|
230
236
|
<h2>${e.name??e.key??e.id}</h2>
|
|
231
237
|
<div class="meta">
|
|
232
238
|
${e.tags?.join(", ")||"no tags"} · ${e.status}${e.owner?` · owner: ${e.owner}`:""}
|
|
233
|
-
${e.deprecated?" · deprecated":""}
|
|
239
|
+
${e.deprecated?" · deprecated":""}${e.paused?" · paused":""} · created
|
|
240
|
+
${e.created_at?e.created_at.slice(0,10):"unknown"}
|
|
234
241
|
</div>
|
|
235
242
|
<div class="meta">${e.description}</div>
|
|
236
|
-
${t?
|
|
243
|
+
${t?k:d`
|
|
237
244
|
<div class="actions">
|
|
238
245
|
<button @click=${()=>this.#i()}>${e.deprecated?"Un-deprecate":"Mark deprecated"}</button>
|
|
239
|
-
<button
|
|
246
|
+
<button @click=${()=>this.#r()}>${e.paused?"Resume":"Pause"}</button>
|
|
247
|
+
<button class="danger" @click=${()=>this.#a()}>Delete</button>
|
|
240
248
|
</div>
|
|
241
249
|
`}
|
|
242
250
|
<div class="view-toggle">
|
|
@@ -253,9 +261,9 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
|
|
|
253
261
|
Raw
|
|
254
262
|
</button>
|
|
255
263
|
</div>
|
|
256
|
-
${this._viewMode==="markdown"?
|
|
257
|
-
<div class="source-path" title="click to copy" @click=${()=>this.#
|
|
258
|
-
`}}customElements.define("detail-panel",
|
|
264
|
+
${this._viewMode==="markdown"?d`<div class="markdown-body">${si(x.parse(e.body??"",{async:!1}))}</div>`:d`<pre>${e.body}</pre>`}
|
|
265
|
+
<div class="source-path" title="click to copy" @click=${()=>this.#t()}>${e.source_path}</div>
|
|
266
|
+
`}}customElements.define("detail-panel",ii);class ri extends S{static{this.properties={defaultKind:{attribute:!1},lockKind:{attribute:!1},onAdded:{attribute:!1},onCancel:{attribute:!1}}}#e=new u("skill");#t=new u("");#s=new u([]);#i=new u(null);#r=new u("");#a=new u("");#o=new u("");#l=new u(!1);#h=new u(!1);#c=new u(!1);#p=new u("");static{this.styles=W`
|
|
259
267
|
:host { display: block; }
|
|
260
268
|
.backdrop {
|
|
261
269
|
position: fixed; inset: 0; background: var(--overlay);
|
|
@@ -291,6 +299,23 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
|
|
|
291
299
|
font-size: 11px; opacity: 0.7; display: flex; align-items: center; gap: 4px;
|
|
292
300
|
cursor: pointer; white-space: nowrap; user-select: none;
|
|
293
301
|
}
|
|
302
|
+
.new-folder-btn {
|
|
303
|
+
font-size: 11px; opacity: 0.7; background: none; border: none; color: inherit;
|
|
304
|
+
cursor: pointer; white-space: nowrap; padding: 0;
|
|
305
|
+
}
|
|
306
|
+
.new-folder-btn:hover { opacity: 1; }
|
|
307
|
+
.new-folder-row {
|
|
308
|
+
padding: 8px 20px; display: flex; align-items: center; gap: 8px;
|
|
309
|
+
border-top: 1px solid var(--border);
|
|
310
|
+
}
|
|
311
|
+
.new-folder-row input[type='text'] {
|
|
312
|
+
flex: 1; padding: 5px 8px; font-size: 12px;
|
|
313
|
+
border: 1px solid var(--border-strong); border-radius: 6px; background: none; color: inherit;
|
|
314
|
+
}
|
|
315
|
+
.new-folder-row button {
|
|
316
|
+
font-size: 11px; padding: 5px 10px; border: 1px solid var(--border-strong); background: none;
|
|
317
|
+
color: inherit; border-radius: 6px; cursor: pointer;
|
|
318
|
+
}
|
|
294
319
|
.browser {
|
|
295
320
|
flex: 1; overflow-y: auto; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
|
|
296
321
|
min-height: 200px;
|
|
@@ -321,70 +346,84 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
|
|
|
321
346
|
border-radius: 6px; cursor: pointer; font-size: 13px;
|
|
322
347
|
}
|
|
323
348
|
.error { color: var(--danger); font-size: 12px; }
|
|
324
|
-
`}constructor(){super(),new
|
|
349
|
+
`}constructor(){super(),new we(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#e.set(this.defaultKind),this.#u()}async#u(e){const t=new URLSearchParams;e&&t.set("path",e),this.#h.value&&t.set("hidden","1");const s=await fetch(`/api/fs/list?${t.toString()}`);if(!s.ok){this.#o.set((await s.json()).error??"failed to list directory");return}const r=await s.json();this.#t.set(r.path),this.#i.set(r.parent),this.#s.set(r.entries),this.#o.set(""),this.renderRoot.querySelector(".browser")?.scrollTo(0,0)}#f(){this.#h.set(!this.#h.value),this.#u(this.#t.value)}#b(){this.#p.set(""),this.#c.set(!0)}#x(){this.#c.set(!1),this.#p.set("")}async#m(){const e=this.#p.value.trim();if(e){this.#o.set("");try{const t=await fetch("/api/fs/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:this.#t.value,name:e})}),s=await t.json();if(!t.ok){this.#o.set(s.error??"failed to create folder");return}this.#c.set(!1),this.#p.set(""),await this.#u(this.#t.value)}catch(t){this.#o.set(t.message)}}}#k(){this.#r.set(this.#t.value),this.#a.value||this.#a.set(this.#t.value.split("/").filter(Boolean).pop()??"")}async#g(){const e=this.#r.value||this.#t.value;if(e){this.#l.set(!0),this.#o.set("");try{const t=await fetch("/api/roots",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#a.value||void 0,path:e})}),s=await t.json();if(!t.ok){this.#o.set(s.error??"failed to add root");return}this.onAdded()}finally{this.#l.set(!1)}}}render(){const e=this.#s.value;return d`
|
|
325
350
|
<div class="backdrop" @click=${t=>t.target===t.currentTarget&&this.onCancel()}>
|
|
326
351
|
<div class="modal">
|
|
327
352
|
<div class="header"><h2>Add a root</h2></div>
|
|
328
|
-
${this.lockKind?
|
|
353
|
+
${this.lockKind?d``:d`
|
|
329
354
|
<div class="kind-toggle">
|
|
330
355
|
<button
|
|
331
|
-
class=${this.#
|
|
332
|
-
@click=${()=>this.#
|
|
356
|
+
class=${this.#e.value==="skill"?"active":""}
|
|
357
|
+
@click=${()=>this.#e.set("skill")}
|
|
333
358
|
>
|
|
334
359
|
Skill root
|
|
335
360
|
</button>
|
|
336
361
|
<button
|
|
337
|
-
class=${this.#
|
|
338
|
-
@click=${()=>this.#
|
|
362
|
+
class=${this.#e.value==="memory"?"active":""}
|
|
363
|
+
@click=${()=>this.#e.set("memory")}
|
|
339
364
|
>
|
|
340
365
|
Memory root
|
|
341
366
|
</button>
|
|
342
367
|
</div>
|
|
343
368
|
`}
|
|
344
369
|
<div class="breadcrumb-row">
|
|
345
|
-
<div class="breadcrumb">${this.#
|
|
370
|
+
<div class="breadcrumb">${this.#t.value}</div>
|
|
371
|
+
<button class="new-folder-btn" @click=${()=>this.#b()}>+ New folder</button>
|
|
346
372
|
<label class="hidden-toggle">
|
|
347
|
-
<input type="checkbox" .checked=${this.#
|
|
373
|
+
<input type="checkbox" .checked=${this.#h.value} @change=${()=>this.#f()} />
|
|
348
374
|
Show hidden
|
|
349
375
|
</label>
|
|
350
376
|
</div>
|
|
377
|
+
${this.#c.value?d`
|
|
378
|
+
<div class="new-folder-row">
|
|
379
|
+
<input
|
|
380
|
+
type="text"
|
|
381
|
+
placeholder="Folder name"
|
|
382
|
+
.value=${this.#p.value}
|
|
383
|
+
@input=${t=>this.#p.set(t.target.value)}
|
|
384
|
+
@keydown=${t=>{t.key==="Enter"&&this.#m(),t.key==="Escape"&&this.#x()}}
|
|
385
|
+
/>
|
|
386
|
+
<button @click=${()=>this.#m()}>Create</button>
|
|
387
|
+
<button @click=${()=>this.#x()}>Cancel</button>
|
|
388
|
+
</div>
|
|
389
|
+
`:""}
|
|
351
390
|
<div class="browser">
|
|
352
|
-
${this.#i.value?
|
|
391
|
+
${this.#i.value?d`<div class="entry up" @click=${()=>this.#u(this.#i.value)}>
|
|
353
392
|
<span class="icon">📁</span> ..
|
|
354
393
|
</div>`:""}
|
|
355
|
-
${e.length===0&&!this.#i.value?
|
|
394
|
+
${e.length===0&&!this.#i.value?d`<div class="empty">No subdirectories here.</div>`:e.map(t=>d`<div class="entry" @click=${()=>this.#u(t.path)}>
|
|
356
395
|
<span class="icon">📁</span> ${t.name}
|
|
357
396
|
</div>`)}
|
|
358
397
|
</div>
|
|
359
398
|
<div class="footer">
|
|
360
|
-
<button class="secondary" @click=${()=>this.#
|
|
399
|
+
<button class="secondary" @click=${()=>this.#k()}>
|
|
361
400
|
Select this folder
|
|
362
401
|
</button>
|
|
363
|
-
${this.#r.value?
|
|
402
|
+
${this.#r.value?d`<div class="selected-row">Selected: <span class="path">${this.#r.value}</span></div>`:""}
|
|
364
403
|
<div>
|
|
365
404
|
<label>Root name</label>
|
|
366
405
|
<input
|
|
367
406
|
type="text"
|
|
368
|
-
.value=${this.#
|
|
407
|
+
.value=${this.#a.value}
|
|
369
408
|
placeholder="e.g. personal, company"
|
|
370
|
-
@input=${t=>this.#
|
|
409
|
+
@input=${t=>this.#a.set(t.target.value)}
|
|
371
410
|
/>
|
|
372
411
|
</div>
|
|
373
|
-
${this.#
|
|
412
|
+
${this.#o.value?d`<div class="error">${this.#o.value}</div>`:""}
|
|
374
413
|
<div class="actions">
|
|
375
414
|
<button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
|
|
376
415
|
<button
|
|
377
416
|
class="primary"
|
|
378
|
-
?disabled=${!this.#r.value||this.#
|
|
379
|
-
@click=${()=>this.#
|
|
417
|
+
?disabled=${!this.#r.value||this.#l.value}
|
|
418
|
+
@click=${()=>this.#g()}
|
|
380
419
|
>
|
|
381
|
-
${this.#
|
|
420
|
+
${this.#l.value?"Adding…":"Add root"}
|
|
382
421
|
</button>
|
|
383
422
|
</div>
|
|
384
423
|
</div>
|
|
385
424
|
</div>
|
|
386
425
|
</div>
|
|
387
|
-
`}}customElements.define("add-root-modal",
|
|
426
|
+
`}}customElements.define("add-root-modal",ri);let et=0;class ni extends S{static{this.properties={tags:{attribute:!1},active:{attribute:!1},onToggle:{attribute:!1}}}#e=new u("");#t=new u(!1);#s=new u(-1);#i;#r;static{this.styles=W`
|
|
388
427
|
:host {
|
|
389
428
|
display: inline-block;
|
|
390
429
|
position: relative;
|
|
@@ -488,9 +527,9 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
|
|
|
488
527
|
.option:hover, .option.highlighted { background: var(--hover); }
|
|
489
528
|
.option input { margin: 0; pointer-events: none; }
|
|
490
529
|
.empty { padding: 6px 8px; opacity: 0.6; font-style: italic; font-size: 12px; }
|
|
491
|
-
`}constructor(){super(),new
|
|
530
|
+
`}constructor(){super(),new we(this),this.tags=[],this.active=[],this.onToggle=()=>{},this.#i=`--tag-multiselect-${++et}`,this.#r=`tag-multiselect-listbox-${et}`}#a=e=>{e.composedPath().includes(this)||this.#h()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#a)}disconnectedCallback(){document.removeEventListener("click",this.#a),super.disconnectedCallback()}get#o(){const e=this.#e.value.trim().toLowerCase();return e?this.tags.filter(t=>t.toLowerCase().includes(e)):this.tags}#l(){this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#h(){this.#t.set(!1),this.#s.set(-1),this.renderRoot.querySelector(".menu")?.hidePopover()}#c(){this.#t.value?this.#h():(this.#l(),this.renderRoot.querySelector(".input")?.focus())}#p(e){this.#e.set(e.target.value),this.#s.set(-1),this.#l()}#u(e){this.onToggle(e),this.#e.set(""),this.#s.set(-1)}#f(e){e.stopPropagation(),this.active.forEach(t=>this.onToggle(t)),this.#e.set(""),this.renderRoot.querySelector(".input")?.focus(),this.#l()}#b(e){const t=this.#o;if(e.key==="ArrowDown")e.preventDefault(),this.#l(),t.length&&this.#s.set((this.#s.value+1)%t.length);else if(e.key==="ArrowUp")e.preventDefault(),this.#l(),t.length&&this.#s.set((this.#s.value-1+t.length)%t.length);else if(e.key==="Enter"){const s=t[this.#s.value];s!==void 0&&(e.preventDefault(),this.#u(s))}else if(e.key==="Backspace"&&!this.#e.value&&this.active.length>0){const s=this.active[this.active.length-1];s!==void 0&&this.onToggle(s)}else e.key==="Escape"&&this.#h()}render(){const e=this.active,t=this.#o,s=this.#t.value,r=this.#s.value;return d`
|
|
492
531
|
<div class="field" style=${`anchor-name: ${this.#i}`}>
|
|
493
|
-
${e.map(n=>
|
|
532
|
+
${e.map(n=>d`
|
|
494
533
|
<span class="selected-chip">
|
|
495
534
|
${n}
|
|
496
535
|
<span class="remove" @click=${()=>this.onToggle(n)}>✕</span>
|
|
@@ -504,18 +543,18 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
|
|
|
504
543
|
aria-controls=${this.#r}
|
|
505
544
|
aria-activedescendant=${r>=0?`${this.#r}-opt-${r}`:""}
|
|
506
545
|
placeholder=${e.length===0?"Filter by tag…":""}
|
|
507
|
-
.value=${this.#
|
|
508
|
-
@input=${n=>this.#
|
|
509
|
-
@focus=${()=>this.#
|
|
510
|
-
@click=${()=>this.#
|
|
511
|
-
@keydown=${n=>this.#
|
|
546
|
+
.value=${this.#e.value}
|
|
547
|
+
@input=${n=>this.#p(n)}
|
|
548
|
+
@focus=${()=>this.#l()}
|
|
549
|
+
@click=${()=>this.#l()}
|
|
550
|
+
@keydown=${n=>this.#b(n)}
|
|
512
551
|
/>
|
|
513
|
-
${e.length>0?
|
|
552
|
+
${e.length>0?d`<button class="clear-btn" tabindex="-1" @mousedown=${n=>n.preventDefault()} @click=${n=>this.#f(n)}>✕</button>`:""}
|
|
514
553
|
<button
|
|
515
554
|
class="chevron-btn ${s?"open":""}"
|
|
516
555
|
tabindex="-1"
|
|
517
556
|
@mousedown=${n=>n.preventDefault()}
|
|
518
|
-
@click=${()=>this.#
|
|
557
|
+
@click=${()=>this.#c()}
|
|
519
558
|
>
|
|
520
559
|
▾
|
|
521
560
|
</button>
|
|
@@ -529,7 +568,7 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
|
|
|
529
568
|
popover="manual"
|
|
530
569
|
style=${`position-anchor: ${this.#i}`}
|
|
531
570
|
>
|
|
532
|
-
${t.length?t.map((n,o)=>
|
|
571
|
+
${t.length?t.map((n,o)=>d`
|
|
533
572
|
<li
|
|
534
573
|
id=${`${this.#r}-opt-${o}`}
|
|
535
574
|
role="option"
|
|
@@ -541,9 +580,9 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
|
|
|
541
580
|
<input type="checkbox" .checked=${e.includes(n)} tabindex="-1" />
|
|
542
581
|
${n}
|
|
543
582
|
</li>
|
|
544
|
-
`):
|
|
583
|
+
`):d`<li class="empty">No matches</li>`}
|
|
545
584
|
</ul>
|
|
546
|
-
`}}customElements.define("tag-multiselect",
|
|
585
|
+
`}}customElements.define("tag-multiselect",ni);const oi=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],tt=[{value:"all",label:"Show all"},{value:"hide",label:"Hide"},{value:"only",label:"Only"}],ai={tags:[],statuses:[],owners:[],doc_types:[],key_types:[],roots:[]},li={skill:[],memory:[]},vt="mem-bucket-split-pct",yt=20,wt=80;function ci(){const i=Number(localStorage.getItem(vt));return Number.isFinite(i)&&i>=yt&&i<=wt?i:40}const _t="mem-bucket-theme",he=["system","light","dark"],hi={system:"◐",light:"☀",dark:"☾"},pi={system:"Auto",light:"Light",dark:"Dark"};function ui(){const i=localStorage.getItem(_t);return i==="light"||i==="dark"?i:"system"}function st(i){i==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",i)}function di(){const i=location.hash.slice(1);if(!i)return{};const e=new URLSearchParams(i),t={},s=e.get("q");s&&(t.query=s);const r=e.get("type");(r==="skill"||r==="memory"||r==="all")&&(t.typeFilter=r);const n=e.getAll("tag");n.length&&(t.activeTags=n);const o=e.getAll("root");o.length&&(t.activeRoots=o);const a=e.get("sort");a&&(t.sort=a);const l=e.get("deprecated");l==="0"?t.deprecatedFilter="hide":l==="1"&&(t.deprecatedFilter="only");const c=e.get("paused");c==="0"?t.pausedFilter="hide":c==="1"&&(t.pausedFilter="only");const p=e.get("date_from");p&&(t.dateFrom=p);const h=e.get("date_to");return h&&(t.dateTo=h),t}class gi extends S{static{this.styles=W`
|
|
547
586
|
:host { display: flex; flex-direction: column; height: 100vh; }
|
|
548
587
|
.theme-toggle {
|
|
549
588
|
position: fixed;
|
|
@@ -725,51 +764,51 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
|
|
|
725
764
|
cursor: pointer;
|
|
726
765
|
}
|
|
727
766
|
.bulk-bar button.danger { border-color: var(--danger); color: var(--danger); }
|
|
728
|
-
`}#t=new u("");#
|
|
767
|
+
`}#e=di();#t=new u(this.#e.query??"");#s=new u(this.#e.typeFilter??"all");#i=new u(this.#e.activeTags??[]);#r=new u(this.#e.activeRoots??[]);#a=new u([]);#o=new u(ai);#l=new u(null);#h=new u(li);#c=new u(!1);#p=new u("");#u=new u(!1);#f=new u(ci());#b=new u(!1);#x=new u(this.#e.sort??"mtime_desc");#m=new u(this.#e.deprecatedFilter??"all");#k=new u(this.#e.pausedFilter??"all");#g=new u(this.#e.dateFrom??"");#$=new u(this.#e.dateTo??"");#d=new u(new Set);#y=new u(ui());#A=e=>this.#M(e);#T=()=>this.#O();constructor(){super(),new we(this),st(this.#y.value)}#P(e){this.#y.set(e),localStorage.setItem(_t,e),st(e)}#L(){const e=he[(he.indexOf(this.#y.value)+1)%he.length];this.#P(e)}#I(e){e.preventDefault(),this.#b.set(!0),document.addEventListener("pointermove",this.#A),document.addEventListener("pointerup",this.#T)}#M(e){const t=this.renderRoot.querySelector(".body-region");if(!t)return;const s=t.getBoundingClientRect(),r=(e.clientX-s.left)/s.width*100;this.#f.set(Math.min(wt,Math.max(yt,r)))}#O(){this.#b.set(!1),document.removeEventListener("pointermove",this.#A),document.removeEventListener("pointerup",this.#T),localStorage.setItem(vt,String(this.#f.value))}#D=new Xt(()=>{const e=new URLSearchParams;this.#s.value!=="all"&&e.set("type",this.#s.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim());for(const t of this.#i.value)e.append("tag",t);for(const t of this.#r.value)e.append("root",t);return this.#x.value!=="mtime_desc"&&e.set("sort",this.#x.value),this.#m.value==="hide"?e.set("deprecated","0"):this.#m.value==="only"&&e.set("deprecated","1"),this.#k.value==="hide"?e.set("paused","0"):this.#k.value==="only"&&e.set("paused","1"),this.#g.value&&e.set("date_from",this.#g.value),this.#$.value&&e.set("date_to",this.#$.value),e.toString()});#w=()=>this.#N();connectedCallback(){super.connectedCallback(),this.#n(),this.#v(),this.#_(),window.addEventListener("focus",this.#w),document.addEventListener("visibilitychange",this.#w)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("focus",this.#w),document.removeEventListener("visibilitychange",this.#w)}#N(){document.visibilityState==="visible"&&(this.#n(),this.#v(),this.#_())}async#n(){const e=this.#D.value;history.replaceState(null,"",e?`#${e}`:location.pathname+location.search);const t=await fetch(`/api/entries?${e}`);this.#a.set(await t.json()),this.renderRoot.querySelector("result-list")?.scrollTo(0,0)}async#v(){const e=this.#s.value==="all"?"":`?type=${this.#s.value}`,t=await fetch(`/api/facets${e}`);this.#o.set(await t.json())}async#_(){const e=await fetch("/api/roots");this.#h.set(await e.json()),this.#u.set(!0)}#q(e){const t=this.#r.value;this.#r.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#n()}async#U(e,t){if(t.stopPropagation(),window.prompt(`Type "${e.name}" to remove this ${e.kind} root (files on disk are untouched):`)===e.name){this.#p.set(e.name);try{await fetch(`/api/roots/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"}),this.#r.set(this.#r.value.filter(r=>r!==e.name)),await Promise.all([this.#_(),this.#v(),this.#n()])}finally{this.#p.set("")}}}#R(){this.#c.set(!1),this.#_(),this.#v(),this.#n()}#H(){return[...this.#h.value.skill,...this.#h.value.memory]}#B(e){this.#s.set(e),this.#i.set([]),this.#v(),this.#n()}#j(e){const t=this.#i.value;this.#i.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#n()}#F(e){this.#t.set(e.target.value),this.#n()}#Z(){this.#t.set(""),this.#n()}#Q(e){this.#l.set({table:e._table,id:e.id})}#K(e){this.#x.set(e.target.value),this.#n()}#W(e){this.#m.set(e.target.value),this.#n()}#V(e){this.#k.set(e.target.value),this.#n()}#G(e){this.#g.set(e.target.value),this.#n()}#J(e){this.#$.set(e.target.value),this.#n()}#Y(){this.#g.set(""),this.#$.set(""),this.#n()}#X(e){const t=new Set(this.#d.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#d.set(t)}#ee(){return new Map(this.#a.value.map(e=>[e.id,e]))}#S(){const e=new Map,t=this.#ee();for(const s of this.#d.value){const r=t.get(s);if(!r)continue;const n=e.get(r._table)??[];n.push(s),e.set(r._table,n)}return e}async#E(e){const t=this.#S();await Promise.all([...t.entries()].map(([s,r])=>fetch(`/api/entries/${s}/bulk/deprecated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:r,deprecated:e})}))),this.#d.set(new Set),await this.#n()}async#C(e){const t=this.#S();await Promise.all([...t.entries()].map(([s,r])=>fetch(`/api/entries/${s}/bulk/paused`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:r,paused:e})}))),this.#d.set(new Set),await this.#n()}async#te(){if(!window.confirm(`Delete ${this.#d.value.size} doc(s)? This can't be undone.`))return;const e=this.#S();await Promise.all([...e.entries()].map(([t,s])=>fetch(`/api/entries/${t}/bulk/delete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:s})}))),this.#d.set(new Set),await this.#n()}#z(){const e=this.#y.value;return d`
|
|
729
768
|
<button
|
|
730
769
|
class="theme-toggle"
|
|
731
|
-
title=${`Theme: ${
|
|
770
|
+
title=${`Theme: ${pi[e]} (click to change)`}
|
|
732
771
|
aria-label="Toggle color theme"
|
|
733
|
-
@click=${()=>this.#
|
|
772
|
+
@click=${()=>this.#L()}
|
|
734
773
|
>
|
|
735
|
-
${
|
|
774
|
+
${hi[e]}
|
|
736
775
|
</button>
|
|
737
|
-
`}render(){const e=this.#
|
|
738
|
-
${this.#
|
|
776
|
+
`}render(){const e=this.#o.value,t=this.#H();return this.#u.value&&t.length===0&&!this.#c.value?d`
|
|
777
|
+
${this.#z()}
|
|
739
778
|
<div class="first-run">
|
|
740
779
|
<h1>No roots configured yet</h1>
|
|
741
780
|
<p>
|
|
742
781
|
Add a folder of skills or memory docs to get started. You can add more roots later —
|
|
743
782
|
e.g. a personal skills repo plus a shared company repo.
|
|
744
783
|
</p>
|
|
745
|
-
<button class="add-root-btn" @click=${()=>this.#
|
|
784
|
+
<button class="add-root-btn" @click=${()=>this.#c.set(!0)}>+ Add your first root</button>
|
|
746
785
|
</div>
|
|
747
|
-
${this.#
|
|
786
|
+
${this.#c.value?d`<add-root-modal
|
|
748
787
|
.defaultKind=${"skill"}
|
|
749
788
|
.lockKind=${!1}
|
|
750
|
-
.onAdded=${()=>this.#
|
|
751
|
-
.onCancel=${()=>this.#
|
|
789
|
+
.onAdded=${()=>this.#R()}
|
|
790
|
+
.onCancel=${()=>this.#c.set(!1)}
|
|
752
791
|
></add-root-modal>`:""}
|
|
753
|
-
`:
|
|
754
|
-
${this.#
|
|
792
|
+
`:d`
|
|
793
|
+
${this.#z()}
|
|
755
794
|
<div class="roots-bar">
|
|
756
795
|
<span class="filter-label">Roots:</span>
|
|
757
|
-
${t.map(s=>
|
|
796
|
+
${t.map(s=>d`
|
|
758
797
|
<button
|
|
759
|
-
class="root-chip ${this.#
|
|
798
|
+
class="root-chip ${this.#r.value.includes(s.name)?"active":""}"
|
|
760
799
|
title=${s.path}
|
|
761
|
-
@click=${()=>this.#
|
|
800
|
+
@click=${()=>this.#q(s.name)}
|
|
762
801
|
>
|
|
763
802
|
${s.name}
|
|
764
803
|
<span
|
|
765
804
|
class="remove"
|
|
766
805
|
title="Remove root"
|
|
767
|
-
@click=${r=>this.#
|
|
768
|
-
>${this.#
|
|
806
|
+
@click=${r=>this.#U(s,r)}
|
|
807
|
+
>${this.#p.value===s.name?"…":"✕"}</span
|
|
769
808
|
>
|
|
770
809
|
</button>
|
|
771
810
|
`)}
|
|
772
|
-
<button class="add-root-btn" @click=${()=>this.#
|
|
811
|
+
<button class="add-root-btn" @click=${()=>this.#c.set(!0)}>+ Add root</button>
|
|
773
812
|
</div>
|
|
774
813
|
<div class="filters">
|
|
775
814
|
<div class="row search-row">
|
|
@@ -778,34 +817,34 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
|
|
|
778
817
|
type="search"
|
|
779
818
|
placeholder="Search descriptions, bodies, tags..."
|
|
780
819
|
.value=${this.#t.value}
|
|
781
|
-
@input=${s=>this.#
|
|
820
|
+
@input=${s=>this.#F(s)}
|
|
782
821
|
/>
|
|
783
|
-
${this.#t.value?
|
|
822
|
+
${this.#t.value?d`
|
|
784
823
|
<button
|
|
785
824
|
class="search-clear-btn"
|
|
786
825
|
title="Clear search"
|
|
787
826
|
aria-label="Clear search"
|
|
788
|
-
@click=${()=>this.#
|
|
827
|
+
@click=${()=>this.#Z()}
|
|
789
828
|
>
|
|
790
829
|
✕
|
|
791
830
|
</button>
|
|
792
831
|
`:""}
|
|
793
832
|
</div>
|
|
794
833
|
<div class="row type-toggle">
|
|
795
|
-
${
|
|
834
|
+
${oi.map(s=>d`
|
|
796
835
|
<button
|
|
797
|
-
class=${this.#
|
|
798
|
-
@click=${()=>this.#
|
|
836
|
+
class=${this.#s.value===s.value?"active":""}
|
|
837
|
+
@click=${()=>this.#B(s.value)}
|
|
799
838
|
>
|
|
800
839
|
${s.label}
|
|
801
840
|
</button>
|
|
802
841
|
`)}
|
|
803
842
|
</div>
|
|
804
|
-
${e.tags.length===0?
|
|
843
|
+
${e.tags.length===0?d`<span class="filter-label">Tags:</span> <label class="small">no tags yet</label>`:d`
|
|
805
844
|
<tag-multiselect
|
|
806
845
|
.tags=${e.tags}
|
|
807
|
-
.active=${this.#
|
|
808
|
-
.onToggle=${s=>this.#
|
|
846
|
+
.active=${this.#i.value}
|
|
847
|
+
.onToggle=${s=>this.#j(s)}
|
|
809
848
|
></tag-multiselect>
|
|
810
849
|
`}
|
|
811
850
|
<span class="filter-label">Dates:</span>
|
|
@@ -813,72 +852,74 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
|
|
|
813
852
|
<input
|
|
814
853
|
type="date"
|
|
815
854
|
aria-label="From date"
|
|
816
|
-
.value=${this.#
|
|
817
|
-
@change=${s=>this.#
|
|
855
|
+
.value=${this.#g.value}
|
|
856
|
+
@change=${s=>this.#G(s)}
|
|
818
857
|
/>
|
|
819
858
|
<span class="date-range-sep">–</span>
|
|
820
859
|
<input
|
|
821
860
|
type="date"
|
|
822
861
|
aria-label="To date"
|
|
823
|
-
.value=${this
|
|
824
|
-
@change=${s=>this.#
|
|
862
|
+
.value=${this.#$.value}
|
|
863
|
+
@change=${s=>this.#J(s)}
|
|
825
864
|
/>
|
|
826
|
-
${this.#
|
|
865
|
+
${this.#g.value||this.#$.value?d`
|
|
827
866
|
<button
|
|
828
867
|
class="date-range-clear"
|
|
829
868
|
title="Clear date range"
|
|
830
869
|
aria-label="Clear date range"
|
|
831
|
-
@click=${()=>this.#
|
|
870
|
+
@click=${()=>this.#Y()}
|
|
832
871
|
>
|
|
833
872
|
✕
|
|
834
873
|
</button>
|
|
835
874
|
`:""}
|
|
836
875
|
</div>
|
|
837
876
|
<span class="filter-label">Sort:</span>
|
|
838
|
-
<select .value=${this.#
|
|
877
|
+
<select .value=${this.#x.value} @change=${s=>this.#K(s)}>
|
|
839
878
|
<option value="mtime_desc">Recently touched</option>
|
|
840
879
|
<option value="mtime_asc">Least recently touched</option>
|
|
841
880
|
<option value="created_at_asc">Oldest first</option>
|
|
842
881
|
<option value="name_asc">Name</option>
|
|
843
882
|
</select>
|
|
844
|
-
<
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
</
|
|
883
|
+
<span class="filter-label">Deprecated:</span>
|
|
884
|
+
<select .value=${this.#m.value} @change=${s=>this.#W(s)}>
|
|
885
|
+
${tt.map(s=>d`<option value=${s.value}>${s.label}</option>`)}
|
|
886
|
+
</select>
|
|
887
|
+
<span class="filter-label">Paused:</span>
|
|
888
|
+
<select .value=${this.#k.value} @change=${s=>this.#V(s)}>
|
|
889
|
+
${tt.map(s=>d`<option value=${s.value}>${s.label}</option>`)}
|
|
890
|
+
</select>
|
|
852
891
|
</div>
|
|
853
892
|
</div>
|
|
854
|
-
${this.#
|
|
893
|
+
${this.#d.value.size>0?d`
|
|
855
894
|
<div class="bulk-bar">
|
|
856
|
-
<span>${this.#
|
|
857
|
-
<button @click=${()=>this.#
|
|
858
|
-
<button @click=${()=>this.#
|
|
859
|
-
<button
|
|
860
|
-
<button @click=${()=>this.#
|
|
895
|
+
<span>${this.#d.value.size} selected</span>
|
|
896
|
+
<button @click=${()=>this.#E(!0)}>Mark deprecated</button>
|
|
897
|
+
<button @click=${()=>this.#E(!1)}>Un-deprecate</button>
|
|
898
|
+
<button @click=${()=>this.#C(!0)}>Pause</button>
|
|
899
|
+
<button @click=${()=>this.#C(!1)}>Resume</button>
|
|
900
|
+
<button class="danger" @click=${()=>this.#te()}>Delete</button>
|
|
901
|
+
<button @click=${()=>this.#d.set(new Set)}>Clear</button>
|
|
861
902
|
</div>
|
|
862
903
|
`:""}
|
|
863
904
|
<div class="body-region">
|
|
864
905
|
<result-list
|
|
865
|
-
style=${`width: ${this.#
|
|
866
|
-
.results=${this.#
|
|
906
|
+
style=${`width: ${this.#f.value}%; border-right: 1px solid var(--border);`}
|
|
907
|
+
.results=${this.#a.value}
|
|
867
908
|
.showRoot=${t.length>1}
|
|
868
|
-
.onSelect=${s=>this.#
|
|
869
|
-
.selectedIds=${this.#
|
|
870
|
-
.onToggleSelect=${s=>this.#
|
|
909
|
+
.onSelect=${s=>this.#Q(s)}
|
|
910
|
+
.selectedIds=${this.#d.value}
|
|
911
|
+
.onToggleSelect=${s=>this.#X(s)}
|
|
871
912
|
></result-list>
|
|
872
913
|
<div
|
|
873
|
-
class="splitter ${this.#
|
|
874
|
-
@pointerdown=${s=>this.#
|
|
914
|
+
class="splitter ${this.#b.value?"dragging":""}"
|
|
915
|
+
@pointerdown=${s=>this.#I(s)}
|
|
875
916
|
></div>
|
|
876
|
-
<detail-panel .selected=${this.#l.value} .onChanged=${()=>this.#
|
|
917
|
+
<detail-panel .selected=${this.#l.value} .onChanged=${()=>this.#n()}></detail-panel>
|
|
877
918
|
</div>
|
|
878
|
-
${this.#
|
|
919
|
+
${this.#c.value?d`<add-root-modal
|
|
879
920
|
.defaultKind=${"skill"}
|
|
880
921
|
.lockKind=${!1}
|
|
881
|
-
.onAdded=${()=>this.#
|
|
882
|
-
.onCancel=${()=>this.#
|
|
922
|
+
.onAdded=${()=>this.#R()}
|
|
923
|
+
.onCancel=${()=>this.#c.set(!1)}
|
|
883
924
|
></add-root-modal>`:""}
|
|
884
|
-
`}}customElements.define("mem-bucket-app",
|
|
925
|
+
`}}customElements.define("mem-bucket-app",gi);
|