mcp-memory-bucket 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -13
- package/dist/client/assets/{index-BxAZ48QK.js → index-DIO48C0V.js} +212 -113
- package/dist/client/index.html +1 -1
- package/dist/src/memory/repository.js +117 -0
- package/dist/src/memory/tools.js +52 -0
- package/dist/src/server.js +3 -1
- package/dist/src/shared/relocate-tool.js +32 -18
- package/dist/src/shared/relocate.js +9 -0
- package/dist/src/shared/search-tool.js +18 -0
- package/dist/src/skills/builtin/memory-bucket-authoring/SKILL.md +423 -7
- package/dist/src/skills/repository.js +129 -0
- package/dist/src/skills/tools.js +71 -0
- package/dist/src/store/db.js +21 -8
- package/dist/src/store/search.js +60 -0
- package/dist/src/store/sync.js +6 -2
- package/dist/src/web/routes.js +98 -4
- package/dist/src/web/ui-tool.js +1 -1
- package/package.json +1 -1
|
@@ -1,28 +1,32 @@
|
|
|
1
|
-
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const
|
|
1
|
+
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const n of i)if(n.type==="childList")for(const o of n.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const n={};return i.integrity&&(n.integrity=i.integrity),i.referrerPolicy&&(n.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?n.credentials="include":i.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function s(i){if(i.ep)return;i.ep=!0;const n=t(i);fetch(i.href,n)}})();/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const
|
|
5
|
+
*/const Y=globalThis,be=Y.ShadowRoot&&(Y.ShadyCSS===void 0||Y.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ke=Symbol(),Le=new WeakMap;let et=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==ke)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(be&&e===void 0){const s=t!==void 0&&t.length===1;s&&(e=Le.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&Le.set(t,e))}return e}toString(){return this.cssText}};const vt=r=>new et(typeof r=="string"?r:r+"",void 0,ke),V=(r,...e)=>{const t=r.length===1?r[0]:e.reduce((s,i,n)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[n+1],r[0]);return new et(t,r,ke)},_t=(r,e)=>{if(be)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const s=document.createElement("style"),i=Y.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=t.cssText,r.appendChild(s)}},Me=be?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return vt(t)})(r):r;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is:St,defineProperty:At,getOwnPropertyDescriptor:Rt,getOwnPropertyNames:
|
|
9
|
+
*/const{is:St,defineProperty:At,getOwnPropertyDescriptor:Rt,getOwnPropertyNames:Tt,getOwnPropertySymbols:Et,getPrototypeOf:Ct}=Object,re=globalThis,Ie=re.trustedTypes,Pt=Ie?Ie.emptyScript:"",zt=re.reactiveElementPolyfillSupport,Q=(r,e)=>r,he={toAttribute(r,e){switch(e){case Boolean:r=r?Pt:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},tt=(r,e)=>!St(r,e),De={attribute:!0,type:String,converter:he,reflect:!1,useDefault:!1,hasChanged:tt};Symbol.metadata??=Symbol("metadata"),re.litPropertyMetadata??=new WeakMap;let O=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(),i=this.getPropertyDescriptor(e,s,t);i!==void 0&&At(this.prototype,e,i)}}static getPropertyDescriptor(e,t,s){const{get:i,set:n}=Rt(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:i,set(o){const a=i?.call(this);n?.call(this,o),this.requestUpdate(e,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??De}static _$Ei(){if(this.hasOwnProperty(Q("elementProperties")))return;const e=Ct(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Q("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Q("properties"))){const t=this.properties,s=[...Tt(t),...Et(t)];for(const i of s)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[s,i]of t)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const i of s)t.unshift(Me(i))}else e!==void 0&&t.push(Me(e));return t}static _$Eu(e,t){const s=t.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const s of t.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return _t(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){const s=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,s);if(i!==void 0&&s.reflect===!0){const n=(s.converter?.toAttribute!==void 0?s.converter:he).toAttribute(t,s.type);this._$Em=e,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(e,t){const s=this.constructor,i=s._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const n=s.getPropertyOptions(i),o=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:he;this._$Em=i;const a=o.fromAttribute(t,n.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,s,i=!1,n){if(e!==void 0){const o=this.constructor;if(i===!1&&(n=this[e]),s??=o.getPropertyOptions(e),!((s.hasChanged??tt)(n,t)||s.useDefault&&s.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,s))))return;this.C(e,t,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:s,reflect:i,wrapped:n},o){s&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),n!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,n]of this._$Ep)this[i]=n;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,n]of s){const{wrapped:o}=n,a=this[i];o!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,n,a)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(t)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};O.elementStyles=[],O.shadowRootOptions={mode:"open"},O[Q("elementProperties")]=new Map,O[Q("finalized")]=new Map,zt?.({ReactiveElement:O}),(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 xe=globalThis,
|
|
14
|
-
\f\r]`,H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Be=/'/g,He=/"/g,rt=/^(?:script|style|textarea|title)$/i,It=
|
|
13
|
+
*/const xe=globalThis,Oe=r=>r,ee=xe.trustedTypes,Ne=ee?ee.createPolicy("lit-html",{createHTML:r=>r}):void 0,st="$lit$",T=`lit$${Math.random().toFixed(9).slice(2)}$`,it="?"+T,Lt=`<${it}>`,z=document,W=()=>z.createComment(""),K=r=>r===null||typeof r!="object"&&typeof r!="function",me=Array.isArray,Mt=r=>me(r)||typeof r?.[Symbol.iterator]=="function",le=`[
|
|
14
|
+
\f\r]`,H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ue=/-->/g,qe=/>/g,E=RegExp(`>|${le}(?:([^\\s"'>=/]+)(${le}*=${le}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Be=/'/g,He=/"/g,rt=/^(?:script|style|textarea|title)$/i,It=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),f=It(1),L=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),je=new WeakMap,P=z.createTreeWalker(z,129);function nt(r,e){if(!me(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ne!==void 0?Ne.createHTML(e):e}const Dt=(r,e)=>{const t=r.length-1,s=[];let i,n=e===2?"<svg>":e===3?"<math>":"",o=H;for(let a=0;a<t;a++){const l=r[a];let c,p,h=-1,u=0;for(;u<l.length&&(o.lastIndex=u,p=o.exec(l),p!==null);)u=o.lastIndex,o===H?p[1]==="!--"?o=Ue:p[1]!==void 0?o=qe:p[2]!==void 0?(rt.test(p[2])&&(i=RegExp("</"+p[2],"g")),o=E):p[3]!==void 0&&(o=E):o===E?p[0]===">"?(o=i??H,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]==='"'?He:Be):o===He||o===Be?o=E:o===Ue||o===qe?o=H:(o=E,i=void 0);const x=o===E&&r[a+1].startsWith("/>")?" ":"";n+=o===H?l+Lt:h>=0?(s.push(c),l.slice(0,h)+st+l.slice(h)+T+x):l+T+(h===-2?a:x)}return[nt(r,n+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};let pe=class ot{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let n=0,o=0;const a=e.length-1,l=this.parts,[c,p]=Dt(e,t);if(this.el=ot.createElement(c,s),P.currentNode=this.el.content,t===2||t===3){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=P.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const h of i.getAttributeNames())if(h.endsWith(st)){const u=p[o++],x=i.getAttribute(h).split(T),b=/([.?@])?(.*)/.exec(u);l.push({type:1,index:n,name:b[2],strings:x,ctor:b[1]==="."?Nt:b[1]==="?"?Ut:b[1]==="@"?qt:ne}),i.removeAttribute(h)}else h.startsWith(T)&&(l.push({type:6,index:n}),i.removeAttribute(h));if(rt.test(i.tagName)){const h=i.textContent.split(T),u=h.length-1;if(u>0){i.textContent=ee?ee.emptyScript:"";for(let x=0;x<u;x++)i.append(h[x],W()),P.nextNode(),l.push({type:2,index:++n});i.append(h[u],W())}}}else if(i.nodeType===8)if(i.data===it)l.push({type:2,index:n});else{let h=-1;for(;(h=i.data.indexOf(T,h+1))!==-1;)l.push({type:7,index:n}),h+=T.length-1}n++}}static createElement(e,t){const s=z.createElement("template");return s.innerHTML=e,s}};function N(r,e,t=r,s){if(e===L)return e;let i=s!==void 0?t._$Co?.[s]:t._$Cl;const n=K(e)?void 0:e._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),n===void 0?i=void 0:(i=new n(r),i._$AT(r,t,s)),s!==void 0?(t._$Co??=[])[s]=i:t._$Cl=i),i!==void 0&&(e=N(r,i._$AS(r,e.values),i,s)),e}let Ot=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,i=(e?.creationScope??z).importNode(t,!0);P.currentNode=i;let n=P.nextNode(),o=0,a=0,l=s[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new F(n,n.nextSibling,this,e):l.type===1?c=new l.ctor(n,l.name,l.strings,this,e):l.type===6&&(c=new Bt(n,this,e)),this._$AV.push(c),l=s[++a]}o!==l?.index&&(n=P.nextNode(),o++)}return P.currentNode=z,i}p(e){let t=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}};class F{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,i){this.type=2,this._$AH=m,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=N(this,e,t),K(e)?e===m||e==null||e===""?(this._$AH!==m&&this._$AR(),this._$AH=m):e!==this._$AH&&e!==L&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Mt(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==m&&K(this._$AH)?this._$AA.nextSibling.data=e:this.T(z.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:s}=e,i=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=pe.createElement(nt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const n=new Ot(i,this),o=n.u(this.options);n.p(t),this.T(o),this._$AH=n}}_$AC(e){let t=je.get(e.strings);return t===void 0&&je.set(e.strings,t=new pe(e)),t}k(e){me(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,i=0;for(const n of e)i===t.length?t.push(s=new F(this.O(W()),this.O(W()),this,this.options)):s=t[i],s._$AI(n),i++;i<t.length&&(this._$AR(s&&s._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const s=Oe(e).nextSibling;Oe(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}let ne=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,i,n){this.type=1,this._$AH=m,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=m}_$AI(e,t=this,s,i){const n=this.strings;let o=!1;if(n===void 0)e=N(this,e,t,0),o=!K(e)||e!==this._$AH&&e!==L,o&&(this._$AH=e);else{const a=e;let l,c;for(e=n[0],l=0;l<n.length-1;l++)c=N(this,a[s+l],t,l),c===L&&(c=this._$AH[l]),o||=!K(c)||c!==this._$AH[l],c===m?e=m:e!==m&&(e+=(c??"")+n[l+1]),this._$AH[l]=c}o&&!i&&this.j(e)}j(e){e===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Nt=class extends ne{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===m?void 0:e}},Ut=class extends ne{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==m)}},qt=class extends ne{constructor(e,t,s,i,n){super(e,t,s,i,n),this.type=5}_$AI(e,t=this){if((e=N(this,e,t,0)??m)===L)return;const s=this._$AH,i=e===m&&s!==m||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==m&&(s===m||i);i&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Bt=class{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){N(this,e)}};const Ht=xe.litHtmlPolyfillSupport;Ht?.(pe,F),(xe.litHtmlVersions??=[]).push("3.3.3");const jt=(r,e,t)=>{const s=t?.renderBefore??e;let i=s._$litPart$;if(i===void 0){const n=t?.renderBefore??null;s._$litPart$=i=new F(e.insertBefore(W(),n),n,void 0,t??{})}return i._$AI(r),i};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/const $e=globalThis;let S=class extends
|
|
20
|
-
↳ while computing ${this._debugParent??"root"}`);this.#s=!0,this.#a(),
|
|
19
|
+
*/const $e=globalThis;let S=class extends O{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=jt(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return L}};S._$litElement$=!0,S.finalized=!0,$e.litElementHydrateSupport?.({LitElement:S});const Zt=$e.litElementPolyfillSupport;Zt?.({LitElement:S});($e.litElementVersions??=[]).push("4.2.2");var at;let ce=0;const Ze=new Set;function Qt(r){ce++;try{r()}finally{ce--,ce===0&&Wt()}}function Wt(){const r=new Set(Ze);Ze.clear();for(const e of r)e()}function Kt(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function Vt(r){return r&&typeof r.deref=="function"}class we{static#t=0;#e;#s;#i=new Set;#r=at.#t++;name;constructor(e,t){this.#e=e,this.#s=e,this.name=t}_get(){return d.activeConsumer&&d.activeConsumer.track(this),this.#e}_set(e){return Kt(e,this.#e)?(this.#s=this.#e,this.#e=e,this._notify(),!0):!1}subscribe(e,t=!1){let s=e;return t&&(s=new WeakRef(e)),this.#i.add(s),()=>this.#i.delete(s)}_notify(){const e=[...this.#i];for(const t of e){let s;if(Vt(t)){if(s=t.deref(),!s){this.#i.delete(t);continue}}else s=t;s()}}get id(){return this.#r}get previousValue(){return this.#s}toString(){return this.name?`${this.constructor.name}(${this.name})`:`${this.constructor.name}#${this.id}`}}at=we;class d extends we{static#t=[];constructor(e,t){super(e,t)}static get activeConsumer(){return this.#t[this.#t.length-1]}static push(e){this.#t.push(e)}static pop(){this.#t.pop()}get(){return this._get()}set(e){Qt(()=>{this._set(e)})}get value(){return this.get()}set value(e){this.set(e)}update(e){this.set(e(this.get()))}}class Ft extends we{#t;#e=!0;#s=!1;#i=new Map;_debugParent;#r;#l=()=>{this.#e||(this.#e=!0,this._notify())};constructor(e,t,s){super(void 0,t),this.#t=e,this.#r=s?.weak??!0}track(e){if(this.#i.has(e))return;const t=e.subscribe(this.#l,this.#r);this.#i.set(e,t)}dispose(){this.#a()}#a(){for(const e of this.#i.values())e();this.#i.clear()}get(){if(d.activeConsumer&&d.activeConsumer.track(this),!this.#e)return this._get();if(this.#s)throw new Error(`Cycle detected in ${this}
|
|
20
|
+
↳ while computing ${this._debugParent??"root"}`);this.#s=!0,this.#a(),d.push(this);try{const e=this.#t();this._set(e)}finally{d.pop(),this.#e=!1,this.#s=!1}return this._get()}get value(){return this.get()}set value(e){throw new Error(`Cannot set value of Computed ${this}. Computed values are read-only.`)}subscribe(e,t=!1){const s=super.subscribe(e,t);return d.activeConsumer||this.get(),s}}class ye{#t;#e=new Map;_debugParent;constructor(e){this.#t=e,e.addController(this);const t=e,s=t.update,i=this;t.update=function(n){d.push(i);try{s.call(this,n)}finally{d.pop()}}}track(e){this.#e.has(e)||this.#e.set(e,e.subscribe(this.#s,!0))}#s=()=>{this.#t.requestUpdate()};hostUpdate(){for(const e of this.#e.values())e();this.#e.clear()}hostDisconnected(){for(const e of this.#e.values())e();this.#e.clear()}toString(){const e=this.#t;return`SignalWatcher(${e?.localName??e?.tagName??e?.constructor?.name??"unknown"})`}}function Gt(r){if(!r)return"unknown age";const e=new Date(r);return Number.isNaN(e.getTime())?"unknown age":e.toISOString().slice(0,10)}class Xt extends S{static{this.properties={results:{attribute:!1},showRoot:{attribute:!1},onSelect:{attribute:!1},selectedIds:{attribute:!1},onToggleSelect:{attribute:!1}}}static{this.styles=V`
|
|
21
21
|
:host { display: block; }
|
|
22
|
-
.row { padding: 10px 14px; border-bottom: 1px solid #8882; cursor: pointer; }
|
|
22
|
+
.row { padding: 10px 14px; border-bottom: 1px solid #8882; cursor: pointer; display: flex; gap: 8px; }
|
|
23
23
|
.row:hover { background: #8881; }
|
|
24
|
+
.row.deprecated { opacity: 0.55; }
|
|
25
|
+
.row-checkbox { flex: 0 0 auto; margin-top: 2px; cursor: pointer; }
|
|
26
|
+
.row-body { flex: 1 1 auto; min-width: 0; }
|
|
24
27
|
.top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
|
|
25
28
|
.name { font-weight: 600; }
|
|
29
|
+
.deprecated .name { text-decoration: line-through; }
|
|
26
30
|
.meta { opacity: 0.65; font-size: 11px; white-space: nowrap; }
|
|
27
31
|
.desc { font-size: 12px; opacity: 0.8; margin-top: 3px; }
|
|
28
32
|
.tags { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
|
|
@@ -32,58 +36,74 @@
|
|
|
32
36
|
font-size: 10px; text-transform: uppercase; opacity: 0.9; border: 1px solid #a78bfa88;
|
|
33
37
|
color: #6d28d9; background: #a78bfa22; border-radius: 4px; padding: 0 4px;
|
|
34
38
|
}
|
|
39
|
+
.deprecated-badge {
|
|
40
|
+
font-size: 10px; text-transform: uppercase; border: 1px solid #dc262688;
|
|
41
|
+
color: #dc2626; background: #dc262622; border-radius: 4px; padding: 0 4px;
|
|
42
|
+
}
|
|
35
43
|
@media (prefers-color-scheme: dark) {
|
|
36
44
|
.root-badge { color: #d8caff; }
|
|
45
|
+
.deprecated-badge { color: #fca5a5; }
|
|
37
46
|
}
|
|
38
47
|
.empty { padding: 24px; opacity: 0.6; font-size: 13px; }
|
|
39
|
-
`}render(){return!this.results||this.results.length===0?
|
|
40
|
-
${this.results.map(e=>
|
|
41
|
-
<div class="row" @click=${()=>this.onSelect(e)}>
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
`}render(){return!this.results||this.results.length===0?f`<div class="empty">No results.</div>`:f`
|
|
49
|
+
${this.results.map(e=>{const t=e._table==="skills"&&e.root==="builtin";return f`
|
|
50
|
+
<div class="row ${e.deprecated?"deprecated":""}" @click=${()=>this.onSelect(e)}>
|
|
51
|
+
<input
|
|
52
|
+
type="checkbox"
|
|
53
|
+
class="row-checkbox"
|
|
54
|
+
.checked=${this.selectedIds?.has(e.id)??!1}
|
|
55
|
+
.disabled=${t}
|
|
56
|
+
title=${t?"Builtin skills can't be bulk-deprecated or deleted":""}
|
|
57
|
+
@click=${s=>{s.stopPropagation(),t||this.onToggleSelect(e)}}
|
|
58
|
+
/>
|
|
59
|
+
<div class="row-body">
|
|
60
|
+
<div class="top">
|
|
61
|
+
<span class="name">${e.name}</span>
|
|
62
|
+
<span class="meta">${Gt(e.created_at)} · ${e.owner??"—"} · ${e.status}</span>
|
|
63
|
+
</div>
|
|
64
|
+
<div class="desc">${e.description}</div>
|
|
65
|
+
<div class="tags">
|
|
66
|
+
<span class="type-badge">${e._table==="skills"?"skill":"memory"}</span>
|
|
67
|
+
${this.showRoot&&e.root?f`<span class="root-badge">${e.root}</span>`:""}
|
|
68
|
+
${e.deprecated?f`<span class="deprecated-badge">deprecated</span>`:""}
|
|
69
|
+
${e.tags.map(s=>f`<span class="tag">${s}</span>`)}
|
|
70
|
+
</div>
|
|
51
71
|
</div>
|
|
52
72
|
</div>
|
|
53
|
-
`)}
|
|
54
|
-
`}}customElements.define("result-list",
|
|
55
|
-
]`).replace("lheading",ht).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},
|
|
56
|
-
`),t=e.length-1;for(;t>=0&&$.blankLine.test(e[t]);)t--;return e.length-t<=2?
|
|
57
|
-
`)}function
|
|
58
|
-
`).map(n=>{let o=n.match(t.other.beginningSpace);if(o===null)return n;let[a]=o;return a.length>=
|
|
59
|
-
`)}var se=class{options;rules;lexer;constructor(
|
|
60
|
-
`),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(
|
|
61
|
-
`)}}blockquote(
|
|
73
|
+
`})}
|
|
74
|
+
`}}customElements.define("result-list",Xt);function ve(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var I=ve();function lt(r){I=r}var C={exec:()=>null};function D(r){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),i=e[s];return i||(i=r(s),e[s]=i),i}}function g(r,e=""){let t=typeof r=="string"?r:r.source,s={replace:(i,n)=>{let o=typeof n=="string"?n:n.source;return o=o.replace($.caret,"$1"),t=t.replace(i,o),s},getRegex:()=>new RegExp(t,e)};return s}var Jt=((r="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+r)}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:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:D(r=>new RegExp(`^ {0,${r}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:D(r=>new RegExp(`^ {0,${r}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:D(r=>new RegExp(`^ {0,${r}}(?:\`\`\`|~~~)`)),headingBeginRegex:D(r=>new RegExp(`^ {0,${r}}#`)),htmlBeginRegex:D(r=>new RegExp(`^ {0,${r}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:D(r=>new RegExp(`^ {0,${r}}>`))},Yt=/^(?:[ \t]*(?:\n|$))+/,es=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ts=/^ {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+|$)/,ss=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,_e=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ct=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ht=g(ct).replace(/bull/g,_e).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),is=g(ct).replace(/bull/g,_e).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Se=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,rs=/^[^\n]+/,Ae=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ns=g(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ae).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),os=g(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,_e).getRegex(),oe="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Re=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,as=g("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Re).replace("tag",oe).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),pt=r=>g(Se).replace("hr",G).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",r).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oe).getRegex(),ls=pt(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),cs=pt(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),hs=g(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",cs).getRegex(),Te={blockquote:hs,code:es,def:ns,fences:ts,heading:ss,hr:G,html:as,lheading:ht,list:os,newline:Yt,paragraph:ls,table:C,text:rs},Qe=g("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",G).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oe).getRegex(),ps={...Te,lheading:is,table:Qe,paragraph:g(Se).replace("hr",G).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Qe).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oe).getRegex()},us={...Te,html:g(`^ *(?: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:g(Se).replace("hr",G).replace("heading",` *#{1,6} *[^
|
|
75
|
+
]`).replace("lheading",ht).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ds=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,gs=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ut=/^( {2,}|\\)\n(?!\s*$)/,fs=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,A=/[\p{P}\p{S}]/u,U=/[\s\p{P}\p{S}]/u,X=/[^\s\p{P}\p{S}]/u,bs=g(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,U).getRegex(),ks=/[\p{Pi}\p{Ps}"']/u,dt=/(?!~)[\p{P}\p{S}]/u,xs=/(?!~)[\s\p{P}\p{S}]/u,ms=/(?:[^\s\p{P}\p{S}]|~)/u,$s=g(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Jt?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),gt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ws=g(gt,"u").replace(/punct/g,A).getRegex(),ys=g(gt,"u").replace(/punct/g,dt).getRegex(),vs=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,_s=g(vs,"u").replace(/openQuote/g,ks).replace(/punct/g,A).getRegex(),ft="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Ss=g(ft,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),As=g(ft,"gu").replace(/notPunctSpace/g,ms).replace(/punctSpace/g,xs).replace(/punct/g,dt).getRegex(),Rs="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",Ts=g(Rs,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),Es=g("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),Cs="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Ps=g(Cs,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),zs=g(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,A).getRegex(),Ls="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Ms=g(Ls,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),Is=g(/\\(punct)/,"gu").replace(/punct/g,A).getRegex(),Ds=g(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Os=g(Re).replace("(?:-->|$)","-->").getRegex(),Ns=g("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Os).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),te=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Us=g(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",te).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),bt=g(/^!?\[(label)\]\[(ref)\]/).replace("label",te).replace("ref",Ae).getRegex(),kt=g(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ae).getRegex(),qs=g("reflink|nolink(?!\\()","g").replace("reflink",bt).replace("nolink",kt).getRegex(),We=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ee={_backpedal:C,anyPunctuation:Is,autolink:Ds,blockSkip:$s,br:ut,code:gs,del:C,delLDelim:C,delRDelim:C,emStrongLDelim:ws,emStrongRDelimAst:Ss,emStrongRDelimUnd:Es,escape:ds,link:Us,nolink:kt,punctuation:bs,reflink:bt,reflinkSearch:qs,tag:Ns,text:fs,url:C},Bs={...Ee,emStrongLDelim:_s,emStrongRDelimAst:Ts,emStrongRDelimUnd:Ps,link:g(/^!?\[(label)\]\((.*?)\)/).replace("label",te).getRegex(),reflink:g(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",te).getRegex()},ue={...Ee,emStrongRDelimAst:As,emStrongLDelim:ys,delLDelim:zs,delRDelim:Ms,url:g(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",We).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:g(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",We).getRegex()},Hs={...ue,br:g(ut).replace("{2,}","*").getRegex(),text:g(ue.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},J={normal:Te,gfm:ps,pedantic:us},j={normal:Ee,gfm:ue,breaks:Hs,pedantic:Bs},js={"&":"&","<":"<",">":">",'"':""","'":"'"},Ke=r=>js[r];function _(r,e){if(e){if($.escapeTest.test(r))return r.replace($.escapeReplace,Ke)}else if($.escapeTestNoEncode.test(r))return r.replace($.escapeReplaceNoEncode,Ke);return r}function Ve(r){try{r=encodeURI(r).replace($.percentDecode,"%")}catch{return null}return r}function Fe(r,e){let t=r.replace($.findPipe,(n,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),s=t.split($.splitPipe),i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace($.slashPipe,"|");return s}function R(r,e,t){let s=r.length;if(s===0)return"";let i=0;for(;i<s&&r.charAt(s-i-1)===e;)i++;return r.slice(0,s-i)}function Ge(r){let e=r.split(`
|
|
76
|
+
`),t=e.length-1;for(;t>=0&&$.blankLine.test(e[t]);)t--;return e.length-t<=2?r:e.slice(0,t+1).join(`
|
|
77
|
+
`)}function Zs(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<r.length;s++)if(r[s]==="\\")s++;else if(r[s]===e[0])t++;else if(r[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function Qs(r,e=0){let t=e,s="";for(let i of r)if(i===" "){let n=4-t%4;s+=" ".repeat(n),t+=n}else s+=i,t++;return s}function Xe(r,e,t,s,i){let n=e.href,o=e.title||null,a=r[1].replace(i.other.outputLinkReplace,"$1");s.state.inLink=!0;let l={type:r[0].charAt(0)==="!"?"image":"link",raw:t,href:n,title:o,text:a,tokens:s.inlineTokens(a)};return s.state.inLink=!1,l}function Ws(r,e,t){let s=r.match(t.other.indentCodeCompensation);if(s===null)return e;let i=s[1];return e.split(`
|
|
78
|
+
`).map(n=>{let o=n.match(t.other.beginningSpace);if(o===null)return n;let[a]=o;return a.length>=i.length?n.slice(i.length):n}).join(`
|
|
79
|
+
`)}var se=class{options;rules;lexer;constructor(r){this.options=r||I}space(r){let e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){let e=this.rules.block.code.exec(r);if(e){let t=this.options.pedantic?e[0]:Ge(e[0]),s=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:s}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let t=e[0],s=Ws(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(r){let e=this.rules.block.heading.exec(r);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=R(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:R(e[0],`
|
|
80
|
+
`),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(r){let e=this.rules.block.hr.exec(r);if(e)return{type:"hr",raw:R(e[0],`
|
|
81
|
+
`)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=R(e[0],`
|
|
62
82
|
`).split(`
|
|
63
|
-
`),s="",
|
|
83
|
+
`),s="",i="",n=[];for(;t.length>0;){let o=!1,a=[],l;for(l=0;l<t.length;l++)if(this.rules.other.blockquoteStart.test(t[l]))a.push(t[l]),o=!0;else if(!o)a.push(t[l]);else break;t=t.slice(l);let c=a.join(`
|
|
64
84
|
`),p=c.replace(this.rules.other.blockquoteSetextReplace,`
|
|
65
85
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
66
|
-
${c}`:c,
|
|
67
|
-
${p}`:p;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,n,!0),this.lexer.state.top=h,t.length===0)break;let u=n.at(-1);if(u?.type==="code")break;if(u?.type==="blockquote"){let x=u,
|
|
86
|
+
${c}`:c,i=i?`${i}
|
|
87
|
+
${p}`:p;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,n,!0),this.lexer.state.top=h,t.length===0)break;let u=n.at(-1);if(u?.type==="code")break;if(u?.type==="blockquote"){let x=u,b=t.join(`
|
|
68
88
|
`),v=x.raw+`
|
|
69
|
-
`+
|
|
70
|
-
${
|
|
89
|
+
`+b.replace(this.rules.other.blockquoteSetextReplace2,""),q=this.blockquote(v);n[n.length-1]=q,s=`${s}
|
|
90
|
+
${b}`,i=i.substring(0,i.length-x.text.length)+q.text;break}else if(u?.type==="list"){let x=u,b=x.raw+`
|
|
71
91
|
`+t.join(`
|
|
72
|
-
`),v=this.list(
|
|
73
|
-
`);continue}}return{type:"blockquote",raw:s,tokens:n,text:
|
|
74
|
-
`,1)[0],e[1].length),u=
|
|
75
|
-
`,1)[0],x=!h.trim(),
|
|
76
|
-
`,
|
|
77
|
-
`,1)[0],B;if(u=ae,this.options.pedantic?(u=u.replace(this.rules.other.listReplaceNesting," "),B=u):B=u.replace(this.rules.other.tabCharGlobal," "),
|
|
78
|
-
`+B.slice(
|
|
92
|
+
`),v=this.list(b);n[n.length-1]=v,s=s.substring(0,s.length-u.raw.length)+v.raw,i=i.substring(0,i.length-x.raw.length)+v.raw,t=b.substring(n.at(-1).raw.length).split(`
|
|
93
|
+
`);continue}}return{type:"blockquote",raw:s,tokens:n,text:i}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=e[1].trim(),s=t.length>1,i={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let n=this.rules.other.listItemRegex(t),o=!1;for(;r;){let l=!1,c="",p="";if(!(e=n.exec(r))||this.rules.block.hr.test(r))break;c=e[0],r=r.substring(c.length);let h=Qs(e[2].split(`
|
|
94
|
+
`,1)[0],e[1].length),u=r.split(`
|
|
95
|
+
`,1)[0],x=!h.trim(),b=0;if(this.options.pedantic?(b=2,p=h.trimStart()):x?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),x&&this.rules.other.blankLine.test(u)&&(c+=u+`
|
|
96
|
+
`,r=r.substring(u.length+1),l=!0),!l){let v=this.rules.other.nextBulletRegex(b),q=this.rules.other.hrRegex(b),Pe=this.rules.other.fencesBeginRegex(b),ze=this.rules.other.headingBeginRegex(b),wt=this.rules.other.htmlBeginRegex(b),yt=this.rules.other.blockquoteBeginRegex(b);for(;r;){let ae=r.split(`
|
|
97
|
+
`,1)[0],B;if(u=ae,this.options.pedantic?(u=u.replace(this.rules.other.listReplaceNesting," "),B=u):B=u.replace(this.rules.other.tabCharGlobal," "),Pe.test(u)||ze.test(u)||wt.test(u)||yt.test(u)||v.test(u)||q.test(u))break;if(B.search(this.rules.other.nonSpaceChar)>=b||!u.trim())p+=`
|
|
98
|
+
`+B.slice(b);else{if(x||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||Pe.test(h)||ze.test(h)||q.test(h))break;p+=`
|
|
79
99
|
`+u}x=!u.trim(),c+=ae+`
|
|
80
|
-
`,
|
|
81
|
-
`),href:s,title:
|
|
100
|
+
`,r=r.substring(ae.length+1),h=B.slice(b)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0)),i.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),i.raw+=c}let a=i.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let l of i.items)if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),!i.loose){let c=l.tokens.filter(h=>h.type==="space"),p=c.length>0&&c.some(h=>this.rules.other.anyLine.test(h.raw));i.loose=p}for(let l of i.items){let c=l.tokens[0];if(l.task&&(c?.type==="text"||c?.type==="paragraph")){l.text=l.text.replace(this.rules.other.listReplaceTask,""),c.raw=c.raw.replace(this.rules.other.listReplaceTask,""),c.text=c.text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(l.raw);if(p){let h={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};l.checked=h.checked,i.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=h.raw+l.tokens[0].raw,l.tokens[0].text=h.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(h)):l.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):l.tokens.unshift(h)}}else l.task&&(l.task=!1)}if(i.loose)for(let l of i.items){l.loose=!0;for(let c of l.tokens)c.type==="text"&&(c.type="paragraph")}return i}}html(r){let e=this.rules.block.html.exec(r);if(e){let t=Ge(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(r){let e=this.rules.block.def.exec(r);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:R(e[0],`
|
|
101
|
+
`),href:s,title:i}}}table(r){let e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=Fe(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
82
102
|
`):[],n={type:"table",raw:R(e[0],`
|
|
83
|
-
`),header:[],align:[],rows:[]};if(t.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?n.align.push("right"):this.rules.other.tableAlignCenter.test(o)?n.align.push("center"):this.rules.other.tableAlignLeft.test(o)?n.align.push("left"):n.align.push(null);for(let o=0;o<t.length;o++)n.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:n.align[o]});for(let o of
|
|
84
|
-
`),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(
|
|
85
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(
|
|
86
|
-
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace($.tabCharGlobal," ").replace($.spaceLine,""));let
|
|
103
|
+
`),header:[],align:[],rows:[]};if(t.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?n.align.push("right"):this.rules.other.tableAlignCenter.test(o)?n.align.push("center"):this.rules.other.tableAlignLeft.test(o)?n.align.push("left"):n.align.push(null);for(let o=0;o<t.length;o++)n.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:n.align[o]});for(let o of i)n.rows.push(Fe(o,n.header.length).map((a,l)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:n.align[l]})));return n}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e){let t=e[1].trim();return{type:"heading",raw:R(e[0],`
|
|
104
|
+
`),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(r){let e=this.rules.block.paragraph.exec(r);if(e){let t=e[1].charAt(e[1].length-1)===`
|
|
105
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(r){let e=this.rules.inline.link.exec(r);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let n=R(t.slice(0,-1),"\\");if((t.length-n.length)%2===0)return}else{let n=Zs(e[2],"()");if(n===-2)return;if(n>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+n;e[2]=e[2].substring(0,n),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let s=e[2],i="";if(this.options.pedantic){let n=this.rules.other.pedanticHrefTitle.exec(s);n&&(s=n[1],i=n[3])}else i=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),Xe(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[s.toLowerCase()];if(!i){let n=t[0].charAt(0);return{type:"text",raw:n,text:n}}return Xe(t,i,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(r);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,n,o,a=i,l=0,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*r.length+i);(s=h.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n)continue;if(o=[...n].length,s[3]||s[4]){a+=o;continue}else if(s[5]||s[6]){if(i%3&&!((i+o)%3)){l+=o;continue}if(p)break}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let u=[...s[0]][0].length,x=r.slice(0,i+s.index+u+o);if(Math.min(i,o)%2){let v=x.slice(1,-1);return{type:"em",raw:x,text:v,tokens:this.lexer.inlineTokens(v)}}let b=x.slice(2,-2);return{type:"strong",raw:x,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r,e,t=""){let s=this.rules.inline.delLDelim.exec(r);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,n,o,a=i,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*r.length+i);(s=l.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n||(o=[...n].length,o!==i))continue;if(s[3]||s[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let c=[...s[0]][0].length,p=r.slice(0,i+s.index+c+o),h=p.slice(i,-i);return{type:"del",raw:p,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(r){let e=this.rules.inline.autolink.exec(r);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(r){let e;if(e=this.rules.inline.url.exec(r)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(r){let e=this.rules.inline.text.exec(r);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},w=class de{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||I,this.options.tokenizer=this.options.tokenizer||new se,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:$,block:J.normal,inline:j.normal};this.options.pedantic?(t.block=J.pedantic,t.inline=j.pedantic):this.options.gfm&&(t.block=J.gfm,this.options.breaks?t.inline=j.breaks:t.inline=j.gfm),this.tokenizer.rules=t}static get rules(){return{block:J,inline:j}}static lex(e,t){return new de(t).lex(e)}static lexInline(e,t){return new de(t).inlineTokens(e)}lex(e){e=e.replace($.carriageReturn,`
|
|
106
|
+
`),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 i=1/0;for(;e;){if(e.length<i)i=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let n;if(this.options.extensions?.block?.some(a=>(n=a.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))continue;if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length);let a=t.at(-1);n.raw.length===1&&a!==void 0?a.raw+=`
|
|
87
107
|
`:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
88
108
|
`)?"":`
|
|
89
109
|
`)+n.raw,a.text+=`
|
|
@@ -96,34 +116,34 @@ ${f}`,r=r.substring(0,r.length-x.text.length)+U.text;break}else if(u?.type==="li
|
|
|
96
116
|
`+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(n),s=o.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length);let a=t.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
97
117
|
`)?"":`
|
|
98
118
|
`)+n.raw,a.text+=`
|
|
99
|
-
`+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(n);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=e;if(this.tokens.links){let a=Object.keys(this.tokens.links);a.length>0&&(s=s.replace(this.tokenizer.rules.inline.reflinkSearch,l=>a.includes(l.slice(l.lastIndexOf("[")+1,-1))?"["+"a".repeat(l.length-2)+"]":l))}s=s.replace(this.tokenizer.rules.inline.anyPunctuation,a=>"+".repeat(a.length)),s=s.replace(this.tokenizer.rules.inline.blockSkip,(a,l,c)=>{let p=c?c.length:0;return a.slice(0,p)+"["+"a".repeat(a.length-p-2)+"]"}),s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let
|
|
100
|
-
`;return s?'<pre><code class="language-'+_(s)+'">'+(t?
|
|
101
|
-
`:"<pre><code>"+(t?
|
|
102
|
-
`}blockquote({tokens:
|
|
103
|
-
${this.parser.parse(
|
|
104
|
-
`}html({text:
|
|
105
|
-
`}hr(
|
|
106
|
-
`}list(
|
|
107
|
-
`+s+"</"+
|
|
108
|
-
`}listitem(
|
|
109
|
-
`}checkbox({checked:
|
|
110
|
-
`}table(
|
|
119
|
+
`+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 i=!1,n="",o=1/0;for(;e;){if(e.length<o)o=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}i||(n=""),i=!1;let a;if(this.options.extensions?.inline?.some(c=>(a=c.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let c=t.at(-1);a.type==="text"&&c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,s,n)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e,s,n)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let l=e;if(this.options.extensions?.startInline){let c=1/0,p=e.slice(1),h;this.options.extensions.startInline.forEach(u=>{h=u.call({lexer:this},p),typeof h=="number"&&h>=0&&(c=Math.min(c,h))}),c<1/0&&c>=0&&(l=e.substring(0,c+1))}if(a=this.tokenizer.inlineText(l)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(n=a.raw.slice(-1)),i=!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(r){this.options=r||I}space(r){return""}code({text:r,lang:e,escaped:t}){let s=(e||"").match($.notSpaceStart)?.[0],i=r.replace($.endingNewline,"")+`
|
|
120
|
+
`;return s?'<pre><code class="language-'+_(s)+'">'+(t?i:_(i,!0))+`</code></pre>
|
|
121
|
+
`:"<pre><code>"+(t?i:_(i,!0))+`</code></pre>
|
|
122
|
+
`}blockquote({tokens:r}){return`<blockquote>
|
|
123
|
+
${this.parser.parse(r)}</blockquote>
|
|
124
|
+
`}html({text:r}){return r}def(r){return""}heading({tokens:r,depth:e}){return`<h${e}>${this.parser.parseInline(r)}</h${e}>
|
|
125
|
+
`}hr(r){return`<hr>
|
|
126
|
+
`}list(r){let e=r.ordered,t=r.start,s="";for(let o=0;o<r.items.length;o++){let a=r.items[o];s+=this.listitem(a)}let i=e?"ol":"ul",n=e&&t!==1?' start="'+t+'"':"";return"<"+i+n+`>
|
|
127
|
+
`+s+"</"+i+`>
|
|
128
|
+
`}listitem(r){return`<li>${this.parser.parse(r.tokens)}</li>
|
|
129
|
+
`}checkbox({checked:r}){return"<input "+(r?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:r}){return`<p>${this.parser.parseInline(r)}</p>
|
|
130
|
+
`}table(r){let e="",t="";for(let i=0;i<r.header.length;i++)t+=this.tablecell(r.header[i]);e+=this.tablerow({text:t});let s="";for(let i=0;i<r.rows.length;i++){let n=r.rows[i];t="";for(let o=0;o<n.length;o++)t+=this.tablecell(n[o]);s+=this.tablerow({text:t})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
|
|
111
131
|
<thead>
|
|
112
132
|
`+e+`</thead>
|
|
113
133
|
`+s+`</table>
|
|
114
|
-
`}tablerow({text:
|
|
115
|
-
${
|
|
116
|
-
`}tablecell(
|
|
117
|
-
`}strong({tokens:
|
|
118
|
-
Please report this to https://github.com/markedjs/marked.`,
|
|
134
|
+
`}tablerow({text:r}){return`<tr>
|
|
135
|
+
${r}</tr>
|
|
136
|
+
`}tablecell(r){let e=this.parser.parseInline(r.tokens),t=r.header?"th":"td";return(r.align?`<${t} align="${r.align}">`:`<${t}>`)+e+`</${t}>
|
|
137
|
+
`}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${_(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:t}){let s=this.parser.parseInline(t),i=Ve(r);if(i===null)return s;r=i;let n='<a href="'+r+'"';return e&&(n+=' title="'+_(e)+'"'),n+=">"+s+"</a>",n}image({href:r,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let i=Ve(r);if(i===null)return _(t);r=i;let n=`<img src="${r}" alt="${_(t)}"`;return e&&(n+=` title="${_(e)}"`),n+=">",n}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:_(r.text)}},Ce=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}checkbox({raw:r}){return r}},y=class ge{options;renderer;textRenderer;constructor(e){this.options=e||I,this.options.renderer=this.options.renderer||new ie,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ce}static parse(e,t){return new ge(t).parse(e)}static parseInline(e,t){return new ge(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let o=i,a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(o.type)){t+=a||"";continue}}let n=i;switch(n.type){case"space":{t+=this.renderer.space(n);break}case"hr":{t+=this.renderer.hr(n);break}case"heading":{t+=this.renderer.heading(n);break}case"code":{t+=this.renderer.code(n);break}case"table":{t+=this.renderer.table(n);break}case"blockquote":{t+=this.renderer.blockquote(n);break}case"list":{t+=this.renderer.list(n);break}case"checkbox":{t+=this.renderer.checkbox(n);break}case"html":{t+=this.renderer.html(n);break}case"def":{t+=this.renderer.def(n);break}case"paragraph":{t+=this.renderer.paragraph(n);break}case"text":{t+=this.renderer.text(n);break}default:{let o='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let s="";for(let i=0;i<e.length;i++){let n=e[i];if(this.options.extensions?.renderers?.[n.type]){let a=this.options.extensions.renderers[n.type].call({parser:this},n);if(a!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(n.type)){s+=a||"";continue}}let o=n;switch(o.type){case"escape":{s+=t.text(o);break}case"html":{s+=t.html(o);break}case"link":{s+=t.link(o);break}case"image":{s+=t.image(o);break}case"checkbox":{s+=t.checkbox(o);break}case"strong":{s+=t.strong(o);break}case"em":{s+=t.em(o);break}case"codespan":{s+=t.codespan(o);break}case"br":{s+=t.br(o);break}case"del":{s+=t.del(o);break}case"text":{s+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return s}},Z=class{options;block;constructor(r){this.options=r||I}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}emStrongMask(r){return r}provideLexer(r=this.block){return r?w.lex:w.lexInline}provideParser(r=this.block){return r?y.parse:y.parseInline}},Ks=class{defaults=ve();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=y;Renderer=ie;TextRenderer=Ce;Lexer=w;Tokenizer=se;Hooks=Z;constructor(...r){this.use(...r)}walkTokens(r,e){let t=[];for(let s of r)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let i=s;for(let n of i.header)t=t.concat(this.walkTokens(n.tokens,e));for(let n of i.rows)for(let o of n)t=t.concat(this.walkTokens(o.tokens,e));break}case"list":{let i=s;t=t.concat(this.walkTokens(i.items,e));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(n=>{let o=i[n].flat(1/0);t=t.concat(this.walkTokens(o,e))}):i.tokens&&(t=t.concat(this.walkTokens(i.tokens,e)))}}return t}use(...r){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let n=e.renderers[i.name];n?e.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=n.apply(this,o)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let n=e[i.level];n?n.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),s.extensions=e),t.renderer){let i=this.defaults.renderer||new ie(this.defaults);for(let n in t.renderer){if(!(n in i))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let o=n,a=t.renderer[o],l=i[o];i[o]=(...c)=>{let p=a.apply(i,c);return p===!1&&(p=l.apply(i,c)),p||""}}s.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new se(this.defaults);for(let n in t.tokenizer){if(!(n in i))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let o=n,a=t.tokenizer[o],l=i[o];i[o]=(...c)=>{let p=a.apply(i,c);return p===!1&&(p=l.apply(i,c)),p}}s.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new Z;for(let n in t.hooks){if(!(n in i))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let o=n,a=t.hooks[o],l=i[o];Z.passThroughHooks.has(n)?i[o]=c=>{if(this.defaults.async&&Z.passThroughHooksRespectAsync.has(n))return(async()=>{let h=await a.call(i,c);return l.call(i,h)})();let p=a.call(i,c);return l.call(i,p)}:i[o]=(...c)=>{if(this.defaults.async)return(async()=>{let h=await a.apply(i,c);return h===!1&&(h=await l.apply(i,c)),h})();let p=a.apply(i,c);return p===!1&&(p=l.apply(i,c)),p}}s.hooks=i}if(t.walkTokens){let i=this.defaults.walkTokens,n=t.walkTokens;s.walkTokens=function(o){let a=[];return a.push(n.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return w.lex(r,e??this.defaults)}parser(r,e){return y.parse(r,e??this.defaults)}parseMarkdown(r){return(e,t)=>{let s={...t},i={...this.defaults,...s},n=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return n(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return n(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return n(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=r),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,a=await(i.hooks?await i.hooks.provideLexer(r):r?w.lex:w.lexInline)(o,i),l=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let c=await(i.hooks?await i.hooks.provideParser(r):r?y.parse:y.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(c):c})().catch(n);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer(r):r?w.lex:w.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser(r):r?y.parse:y.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return n(o)}}}onError(r,e){return t=>{if(t.message+=`
|
|
138
|
+
Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error occurred:</p><pre>"+_(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},M=new Ks;function k(r,e){return M.parse(r,e)}k.options=k.setOptions=function(r){return M.setOptions(r),k.defaults=M.defaults,lt(k.defaults),k};k.getDefaults=ve;k.defaults=I;function Vs(...r){return M.use(...r),k.defaults=M.defaults,lt(k.defaults),k}k.use=Vs;k.walkTokens=function(r,e){return M.walkTokens(r,e)};k.parseInline=M.parseInline;k.Parser=y;k.parser=y.parse;k.Renderer=ie;k.TextRenderer=Ce;k.Lexer=w;k.lexer=w.lex;k.Tokenizer=se;k.Hooks=Z;k.parse=k;k.options;k.setOptions;k.walkTokens;k.parseInline;y.parse;w.lex;/**
|
|
119
139
|
* @license
|
|
120
140
|
* Copyright 2017 Google LLC
|
|
121
141
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
122
|
-
*/const
|
|
142
|
+
*/const Fs={CHILD:2},Gs=r=>(...e)=>({_$litDirective$:r,values:e});class Xs{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,s){this._$Ct=e,this._$AM=t,this._$Ci=s}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
|
|
123
143
|
* @license
|
|
124
144
|
* Copyright 2017 Google LLC
|
|
125
145
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
126
|
-
*/class fe extends
|
|
146
|
+
*/class fe extends Xs{constructor(e){if(super(e),this.it=m,e.type!==Fs.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===m||e==null)return this._t=void 0,this.it=e;if(e===L)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}fe.directiveName="unsafeHTML",fe.resultType=1;const Js=Gs(fe),Je="mem-bucket-detail-view-mode";class Ys extends S{constructor(){super(...arguments),this._viewMode=localStorage.getItem(Je)??"markdown"}static{this.properties={selected:{attribute:!1},onChanged:{attribute:!1},_doc:{state:!0},_viewMode:{state:!0}}}static{this.styles=V`
|
|
127
147
|
:host { display: block; padding: 16px; }
|
|
128
148
|
h2 { margin: 0 0 4px; font-size: 16px; }
|
|
129
149
|
.meta { font-size: 12px; opacity: 0.7; margin-bottom: 12px; }
|
|
@@ -182,12 +202,40 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
|
|
|
182
202
|
font-family: monospace;
|
|
183
203
|
font-size: 12px;
|
|
184
204
|
}
|
|
185
|
-
|
|
205
|
+
.actions {
|
|
206
|
+
display: flex;
|
|
207
|
+
gap: 8px;
|
|
208
|
+
margin-bottom: 12px;
|
|
209
|
+
}
|
|
210
|
+
.actions button {
|
|
211
|
+
font-size: 11px;
|
|
212
|
+
padding: 4px 10px;
|
|
213
|
+
border: 1px solid #8884;
|
|
214
|
+
background: transparent;
|
|
215
|
+
color: inherit;
|
|
216
|
+
border-radius: 4px;
|
|
217
|
+
cursor: pointer;
|
|
218
|
+
}
|
|
219
|
+
.actions button.danger {
|
|
220
|
+
border-color: #dc262688;
|
|
221
|
+
color: #dc2626;
|
|
222
|
+
}
|
|
223
|
+
@media (prefers-color-scheme: dark) {
|
|
224
|
+
.actions button.danger { color: #fca5a5; }
|
|
225
|
+
}
|
|
226
|
+
`}updated(e){e.has("selected")&&this.selected&&(this.#t(),this.scrollTop=0)}async#t(){const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);this._doc=s.ok?await s.json():null,await this.updateComplete,this.shadowRoot?.querySelector(".markdown-body")?.scrollTo(0,0),this.shadowRoot?.querySelector("pre")?.scrollTo(0,0)}#e(){this._doc?.source_path&&navigator.clipboard?.writeText(this._doc.source_path)}#s(e){this._viewMode=e,localStorage.setItem(Je,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.#t(),this.onChanged?.()}async#r(){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 f`<div class="empty">Select an entry to view its details.</div>`;if(!this._doc)return m;const e=this._doc,t=this.selected.table==="skills"&&e.root==="builtin";return f`
|
|
186
227
|
<h2>${e.name??e.key??e.id}</h2>
|
|
187
228
|
<div class="meta">
|
|
188
229
|
${e.tags?.join(", ")||"no tags"} · ${e.status}${e.owner?` · owner: ${e.owner}`:""}
|
|
230
|
+
${e.deprecated?" · deprecated":""} · created ${e.created_at?e.created_at.slice(0,10):"unknown"}
|
|
189
231
|
</div>
|
|
190
232
|
<div class="meta">${e.description}</div>
|
|
233
|
+
${t?m:f`
|
|
234
|
+
<div class="actions">
|
|
235
|
+
<button @click=${()=>this.#i()}>${e.deprecated?"Un-deprecate":"Mark deprecated"}</button>
|
|
236
|
+
<button class="danger" @click=${()=>this.#r()}>Delete</button>
|
|
237
|
+
</div>
|
|
238
|
+
`}
|
|
191
239
|
<div class="view-toggle">
|
|
192
240
|
<button
|
|
193
241
|
class=${this._viewMode==="markdown"?"active":""}
|
|
@@ -202,9 +250,9 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
|
|
|
202
250
|
Raw
|
|
203
251
|
</button>
|
|
204
252
|
</div>
|
|
205
|
-
${this._viewMode==="markdown"?
|
|
253
|
+
${this._viewMode==="markdown"?f`<div class="markdown-body">${Js(k.parse(e.body??"",{async:!1}))}</div>`:f`<pre>${e.body}</pre>`}
|
|
206
254
|
<div class="source-path" title="click to copy" @click=${()=>this.#e()}>${e.source_path}</div>
|
|
207
|
-
`}}customElements.define("detail-panel",Ys);class
|
|
255
|
+
`}}customElements.define("detail-panel",Ys);class ei extends S{static{this.properties={defaultKind:{attribute:!1},lockKind:{attribute:!1},onAdded:{attribute:!1},onCancel:{attribute:!1}}}#t=new d("skill");#e=new d("");#s=new d([]);#i=new d(null);#r=new d("");#l=new d("");#a=new d("");#o=new d(!1);#n=new d(!1);static{this.styles=V`
|
|
208
256
|
:host { display: block; }
|
|
209
257
|
.backdrop {
|
|
210
258
|
position: fixed; inset: 0; background: #0008;
|
|
@@ -267,11 +315,11 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
|
|
|
267
315
|
border-radius: 6px; cursor: pointer; font-size: 13px;
|
|
268
316
|
}
|
|
269
317
|
.error { color: #dc2626; font-size: 12px; }
|
|
270
|
-
`}constructor(){super(),new ye(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#t.set(this.defaultKind),this.#
|
|
318
|
+
`}constructor(){super(),new ye(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#t.set(this.defaultKind),this.#h()}async#h(e){const t=new URLSearchParams;e&&t.set("path",e),this.#n.value&&t.set("hidden","1");const s=await fetch(`/api/fs/list?${t.toString()}`);if(!s.ok){this.#a.set((await s.json()).error??"failed to list directory");return}const i=await s.json();this.#e.set(i.path),this.#i.set(i.parent),this.#s.set(i.entries),this.#a.set("")}#g(){this.#n.set(!this.#n.value),this.#h(this.#e.value)}#u(){this.#r.set(this.#e.value),this.#l.value||this.#l.set(this.#e.value.split("/").filter(Boolean).pop()??"")}async#d(){const e=this.#r.value||this.#e.value;if(e){this.#o.set(!0),this.#a.set("");try{const t=await fetch("/api/roots",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#t.value,name:this.#l.value||void 0,path:e})}),s=await t.json();if(!t.ok){this.#a.set(s.error??"failed to add root");return}this.onAdded()}finally{this.#o.set(!1)}}}render(){const e=this.#s.value;return f`
|
|
271
319
|
<div class="backdrop" @click=${t=>t.target===t.currentTarget&&this.onCancel()}>
|
|
272
320
|
<div class="modal">
|
|
273
321
|
<div class="header"><h2>Add a root</h2></div>
|
|
274
|
-
${this.lockKind?
|
|
322
|
+
${this.lockKind?f``:f`
|
|
275
323
|
<div class="kind-toggle">
|
|
276
324
|
<button
|
|
277
325
|
class=${this.#t.value==="skill"?"active":""}
|
|
@@ -290,23 +338,23 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
|
|
|
290
338
|
<div class="breadcrumb-row">
|
|
291
339
|
<div class="breadcrumb">${this.#e.value}</div>
|
|
292
340
|
<label class="hidden-toggle">
|
|
293
|
-
<input type="checkbox" .checked=${this.#n.value} @change=${()=>this.#
|
|
341
|
+
<input type="checkbox" .checked=${this.#n.value} @change=${()=>this.#g()} />
|
|
294
342
|
Show hidden
|
|
295
343
|
</label>
|
|
296
344
|
</div>
|
|
297
345
|
<div class="browser">
|
|
298
|
-
${this.#i.value?
|
|
346
|
+
${this.#i.value?f`<div class="entry up" @click=${()=>this.#h(this.#i.value)}>
|
|
299
347
|
<span class="icon">📁</span> ..
|
|
300
348
|
</div>`:""}
|
|
301
|
-
${e.length===0&&!this.#i.value?
|
|
349
|
+
${e.length===0&&!this.#i.value?f`<div class="empty">No subdirectories here.</div>`:e.map(t=>f`<div class="entry" @click=${()=>this.#h(t.path)}>
|
|
302
350
|
<span class="icon">📁</span> ${t.name}
|
|
303
351
|
</div>`)}
|
|
304
352
|
</div>
|
|
305
353
|
<div class="footer">
|
|
306
|
-
<button class="secondary" @click=${()=>this.#
|
|
354
|
+
<button class="secondary" @click=${()=>this.#u()}>
|
|
307
355
|
Select this folder
|
|
308
356
|
</button>
|
|
309
|
-
${this.#r.value?
|
|
357
|
+
${this.#r.value?f`<div class="selected-row">Selected: <span class="path">${this.#r.value}</span></div>`:""}
|
|
310
358
|
<div>
|
|
311
359
|
<label>Root name</label>
|
|
312
360
|
<input
|
|
@@ -316,13 +364,13 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
|
|
|
316
364
|
@input=${t=>this.#l.set(t.target.value)}
|
|
317
365
|
/>
|
|
318
366
|
</div>
|
|
319
|
-
${this.#a.value?
|
|
367
|
+
${this.#a.value?f`<div class="error">${this.#a.value}</div>`:""}
|
|
320
368
|
<div class="actions">
|
|
321
369
|
<button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
|
|
322
370
|
<button
|
|
323
371
|
class="primary"
|
|
324
372
|
?disabled=${!this.#r.value||this.#o.value}
|
|
325
|
-
@click=${()=>this.#
|
|
373
|
+
@click=${()=>this.#d()}
|
|
326
374
|
>
|
|
327
375
|
${this.#o.value?"Adding…":"Add root"}
|
|
328
376
|
</button>
|
|
@@ -330,7 +378,7 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
|
|
|
330
378
|
</div>
|
|
331
379
|
</div>
|
|
332
380
|
</div>
|
|
333
|
-
`}}customElements.define("add-root-modal",
|
|
381
|
+
`}}customElements.define("add-root-modal",ei);let Ye=0;class ti extends S{static{this.properties={tags:{attribute:!1},active:{attribute:!1},onToggle:{attribute:!1}}}#t=new d("");#e=new d(!1);#s=new d(-1);#i;#r;static{this.styles=V`
|
|
334
382
|
:host {
|
|
335
383
|
display: inline-block;
|
|
336
384
|
position: relative;
|
|
@@ -431,9 +479,9 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
|
|
|
431
479
|
.option:hover, .option.highlighted { background: #8881; }
|
|
432
480
|
.option input { margin: 0; pointer-events: none; }
|
|
433
481
|
.empty { padding: 6px 8px; opacity: 0.6; font-style: italic; font-size: 12px; }
|
|
434
|
-
`}constructor(){super(),new ye(this),this.tags=[],this.active=[],this.onToggle=()=>{},this.#i=`--tag-multiselect-${++
|
|
482
|
+
`}constructor(){super(),new ye(this),this.tags=[],this.active=[],this.onToggle=()=>{},this.#i=`--tag-multiselect-${++Ye}`,this.#r=`tag-multiselect-listbox-${Ye}`}#l=e=>{e.composedPath().includes(this)||this.#n()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#l)}disconnectedCallback(){document.removeEventListener("click",this.#l),super.disconnectedCallback()}get#a(){const e=this.#t.value.trim().toLowerCase();return e?this.tags.filter(t=>t.toLowerCase().includes(e)):this.tags}#o(){this.#e.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#n(){this.#e.set(!1),this.#s.set(-1),this.renderRoot.querySelector(".menu")?.hidePopover()}#h(){this.#e.value?this.#n():(this.#o(),this.renderRoot.querySelector(".input")?.focus())}#g(e){this.#t.set(e.target.value),this.#s.set(-1),this.#o()}#u(e){this.onToggle(e),this.#t.set(""),this.#s.set(-1)}#d(e){e.stopPropagation(),this.active.forEach(t=>this.onToggle(t)),this.#t.set(""),this.renderRoot.querySelector(".input")?.focus(),this.#o()}#f(e){const t=this.#a;if(e.key==="ArrowDown")e.preventDefault(),this.#o(),t.length&&this.#s.set((this.#s.value+1)%t.length);else if(e.key==="ArrowUp")e.preventDefault(),this.#o(),t.length&&this.#s.set((this.#s.value-1+t.length)%t.length);else if(e.key==="Enter"){const s=t[this.#s.value];s!==void 0&&(e.preventDefault(),this.#u(s))}else if(e.key==="Backspace"&&!this.#t.value&&this.active.length>0){const s=this.active[this.active.length-1];s!==void 0&&this.onToggle(s)}else e.key==="Escape"&&this.#n()}render(){const e=this.active,t=this.#a,s=this.#e.value,i=this.#s.value;return f`
|
|
435
483
|
<div class="field" style=${`anchor-name: ${this.#i}`}>
|
|
436
|
-
${e.map(n=>
|
|
484
|
+
${e.map(n=>f`
|
|
437
485
|
<span class="selected-chip">
|
|
438
486
|
${n}
|
|
439
487
|
<span class="remove" @click=${()=>this.onToggle(n)}>✕</span>
|
|
@@ -445,20 +493,20 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
|
|
|
445
493
|
aria-autocomplete="list"
|
|
446
494
|
aria-expanded=${s}
|
|
447
495
|
aria-controls=${this.#r}
|
|
448
|
-
aria-activedescendant=${
|
|
496
|
+
aria-activedescendant=${i>=0?`${this.#r}-opt-${i}`:""}
|
|
449
497
|
placeholder=${e.length===0?"Filter by tag…":""}
|
|
450
498
|
.value=${this.#t.value}
|
|
451
|
-
@input=${n=>this.#
|
|
499
|
+
@input=${n=>this.#g(n)}
|
|
452
500
|
@focus=${()=>this.#o()}
|
|
453
501
|
@click=${()=>this.#o()}
|
|
454
|
-
@keydown=${n=>this.#
|
|
502
|
+
@keydown=${n=>this.#f(n)}
|
|
455
503
|
/>
|
|
456
|
-
${e.length>0?
|
|
504
|
+
${e.length>0?f`<button class="clear-btn" tabindex="-1" @mousedown=${n=>n.preventDefault()} @click=${n=>this.#d(n)}>✕</button>`:""}
|
|
457
505
|
<button
|
|
458
506
|
class="chevron-btn ${s?"open":""}"
|
|
459
507
|
tabindex="-1"
|
|
460
508
|
@mousedown=${n=>n.preventDefault()}
|
|
461
|
-
@click=${()=>this.#
|
|
509
|
+
@click=${()=>this.#h()}
|
|
462
510
|
>
|
|
463
511
|
▾
|
|
464
512
|
</button>
|
|
@@ -472,21 +520,21 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
|
|
|
472
520
|
popover="manual"
|
|
473
521
|
style=${`position-anchor: ${this.#i}`}
|
|
474
522
|
>
|
|
475
|
-
${t.length?t.map((n,o)=>
|
|
523
|
+
${t.length?t.map((n,o)=>f`
|
|
476
524
|
<li
|
|
477
525
|
id=${`${this.#r}-opt-${o}`}
|
|
478
526
|
role="option"
|
|
479
527
|
aria-selected=${e.includes(n)}
|
|
480
|
-
class=${o===
|
|
528
|
+
class=${o===i?"option highlighted":"option"}
|
|
481
529
|
@mousedown=${a=>a.preventDefault()}
|
|
482
|
-
@click=${()=>this.#
|
|
530
|
+
@click=${()=>this.#u(n)}
|
|
483
531
|
>
|
|
484
532
|
<input type="checkbox" .checked=${e.includes(n)} tabindex="-1" />
|
|
485
533
|
${n}
|
|
486
534
|
</li>
|
|
487
|
-
`):
|
|
535
|
+
`):f`<li class="empty">No matches</li>`}
|
|
488
536
|
</ul>
|
|
489
|
-
`}}customElements.define("tag-multiselect",
|
|
537
|
+
`}}customElements.define("tag-multiselect",ti);const si=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],ii={tags:[],statuses:[],owners:[],doc_types:[],key_types:[],roots:[]},ri={skill:[],memory:[]},xt="mem-bucket-split-pct",mt=20,$t=80;function ni(){const r=Number(localStorage.getItem(xt));return Number.isFinite(r)&&r>=mt&&r<=$t?r:40}class oi extends S{static{this.styles=V`
|
|
490
538
|
:host { display: block; height: 100vh; }
|
|
491
539
|
.filters {
|
|
492
540
|
padding: 12px 16px;
|
|
@@ -565,7 +613,30 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
|
|
|
565
613
|
}
|
|
566
614
|
.first-run h1 { font-size: 18px; margin: 0; }
|
|
567
615
|
.first-run p { opacity: 0.7; font-size: 13px; max-width: 420px; margin: 0; }
|
|
568
|
-
|
|
616
|
+
select { font-size: 12px; padding: 4px 6px; }
|
|
617
|
+
.bulk-bar {
|
|
618
|
+
display: flex;
|
|
619
|
+
gap: 8px;
|
|
620
|
+
align-items: center;
|
|
621
|
+
padding: 6px 16px;
|
|
622
|
+
border-bottom: 1px solid #8883;
|
|
623
|
+
background: #2563eb11;
|
|
624
|
+
font-size: 12px;
|
|
625
|
+
}
|
|
626
|
+
.bulk-bar button {
|
|
627
|
+
font-size: 11px;
|
|
628
|
+
padding: 4px 10px;
|
|
629
|
+
border: 1px solid #8884;
|
|
630
|
+
background: transparent;
|
|
631
|
+
color: inherit;
|
|
632
|
+
border-radius: 4px;
|
|
633
|
+
cursor: pointer;
|
|
634
|
+
}
|
|
635
|
+
.bulk-bar button.danger { border-color: #dc262688; color: #dc2626; }
|
|
636
|
+
@media (prefers-color-scheme: dark) {
|
|
637
|
+
.bulk-bar button.danger { color: #fca5a5; }
|
|
638
|
+
}
|
|
639
|
+
`}#t=new d("");#e=new d("all");#s=new d([]);#i=new d([]);#r=new d([]);#l=new d(ii);#a=new d(null);#o=new d(ri);#n=new d(!1);#h=new d("");#g=new d(!1);#u=new d(ni());#d=new d(!1);#f=new d("mtime_desc");#k=new d(!1);#p=new d(new Set);#m=e=>this.#S(e);#$=()=>this.#A();constructor(){super(),new ye(this)}#_(e){e.preventDefault(),this.#d.set(!0),document.addEventListener("pointermove",this.#m),document.addEventListener("pointerup",this.#$)}#S(e){const t=this.renderRoot.querySelector(".body-region");if(!t)return;const s=t.getBoundingClientRect(),i=(e.clientX-s.left)/s.width*100;this.#u.set(Math.min($t,Math.max(mt,i)))}#A(){this.#d.set(!1),document.removeEventListener("pointermove",this.#m),document.removeEventListener("pointerup",this.#$),localStorage.setItem(xt,String(this.#u.value))}#R=new Ft(()=>{const e=new URLSearchParams;this.#e.value!=="all"&&e.set("type",this.#e.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim());for(const t of this.#s.value)e.append("tag",t);for(const t of this.#i.value)e.append("root",t);return this.#f.value!=="mtime_desc"&&e.set("sort",this.#f.value),this.#k.value&&e.set("deprecated","0"),e.toString()});connectedCallback(){super.connectedCallback(),this.#c(),this.#b(),this.#x()}async#c(){const e=await fetch(`/api/entries?${this.#R.value}`);this.#r.set(await e.json())}async#b(){const e=this.#e.value==="all"?"":`?type=${this.#e.value}`,t=await fetch(`/api/facets${e}`);this.#l.set(await t.json())}async#x(){const e=await fetch("/api/roots");this.#o.set(await e.json()),this.#g.set(!0)}#T(e){const t=this.#i.value;this.#i.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#c()}async#E(e,t){if(t.stopPropagation(),window.prompt(`Type "${e.name}" to remove this ${e.kind} root (files on disk are untouched):`)===e.name){this.#h.set(e.name);try{await fetch(`/api/roots/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"}),this.#i.set(this.#i.value.filter(i=>i!==e.name)),await Promise.all([this.#x(),this.#b(),this.#c()])}finally{this.#h.set("")}}}#w(){this.#n.set(!1),this.#x(),this.#b(),this.#c()}#C(){return[...this.#o.value.skill,...this.#o.value.memory]}#P(e){this.#e.set(e),this.#s.set([]),this.#b(),this.#c()}#z(e){const t=this.#s.value;this.#s.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#c()}#L(e){this.#t.set(e.target.value),this.#c()}#M(e){this.#a.set({table:e._table,id:e.id})}#I(e){this.#f.set(e.target.value),this.#c()}#D(e){this.#k.set(e.target.checked),this.#c()}#O(e){const t=new Set(this.#p.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#p.set(t)}#N(){return new Map(this.#r.value.map(e=>[e.id,e]))}#y(){const e=new Map,t=this.#N();for(const s of this.#p.value){const i=t.get(s);if(!i)continue;const n=e.get(i._table)??[];n.push(s),e.set(i._table,n)}return e}async#v(e){const t=this.#y();await Promise.all([...t.entries()].map(([s,i])=>fetch(`/api/entries/${s}/bulk/deprecated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i,deprecated:e})}))),this.#p.set(new Set),await this.#c()}async#U(){if(!window.confirm(`Delete ${this.#p.value.size} doc(s)? This can't be undone.`))return;const e=this.#y();await Promise.all([...e.entries()].map(([t,s])=>fetch(`/api/entries/${t}/bulk/delete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:s})}))),this.#p.set(new Set),await this.#c()}render(){const e=this.#l.value,t=this.#C();return this.#g.value&&t.length===0&&!this.#n.value?f`
|
|
569
640
|
<div class="first-run">
|
|
570
641
|
<h1>No roots configured yet</h1>
|
|
571
642
|
<p>
|
|
@@ -574,23 +645,23 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
|
|
|
574
645
|
</p>
|
|
575
646
|
<button class="add-root-btn" @click=${()=>this.#n.set(!0)}>+ Add your first root</button>
|
|
576
647
|
</div>
|
|
577
|
-
${this.#n.value?
|
|
648
|
+
${this.#n.value?f`<add-root-modal
|
|
578
649
|
.defaultKind=${"skill"}
|
|
579
650
|
.lockKind=${!1}
|
|
580
|
-
.onAdded=${()=>this.#
|
|
651
|
+
.onAdded=${()=>this.#w()}
|
|
581
652
|
.onCancel=${()=>this.#n.set(!1)}
|
|
582
653
|
></add-root-modal>`:""}
|
|
583
|
-
`:
|
|
654
|
+
`:f`
|
|
584
655
|
<div class="roots-bar">
|
|
585
656
|
<span class="filter-label">Roots:</span>
|
|
586
|
-
${t.map(s=>
|
|
587
|
-
<button class="root-chip ${this.#i.value.includes(s.name)?"active":""}" @click=${()=>this.#
|
|
657
|
+
${t.map(s=>f`
|
|
658
|
+
<button class="root-chip ${this.#i.value.includes(s.name)?"active":""}" @click=${()=>this.#T(s.name)}>
|
|
588
659
|
${s.name}
|
|
589
660
|
<span
|
|
590
661
|
class="remove"
|
|
591
662
|
title="Remove root"
|
|
592
|
-
@click=${
|
|
593
|
-
>${this.#
|
|
663
|
+
@click=${i=>this.#E(s,i)}
|
|
664
|
+
>${this.#h.value===s.name?"…":"✕"}</span
|
|
594
665
|
>
|
|
595
666
|
</button>
|
|
596
667
|
`)}
|
|
@@ -601,45 +672,73 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
|
|
|
601
672
|
type="search"
|
|
602
673
|
placeholder="Search descriptions, bodies, tags..."
|
|
603
674
|
.value=${this.#t.value}
|
|
604
|
-
@input=${s=>this.#
|
|
675
|
+
@input=${s=>this.#L(s)}
|
|
605
676
|
/>
|
|
606
677
|
<div class="row type-toggle">
|
|
607
|
-
${
|
|
678
|
+
${si.map(s=>f`
|
|
608
679
|
<button
|
|
609
680
|
class=${this.#e.value===s.value?"active":""}
|
|
610
|
-
@click=${()=>this.#
|
|
681
|
+
@click=${()=>this.#P(s.value)}
|
|
611
682
|
>
|
|
612
683
|
${s.label}
|
|
613
684
|
</button>
|
|
614
685
|
`)}
|
|
615
686
|
</div>
|
|
616
687
|
<div class="row">
|
|
617
|
-
${e.tags.length===0?
|
|
688
|
+
${e.tags.length===0?f`<span class="filter-label">Tags:</span> <label class="small">no tags yet</label>`:f`
|
|
618
689
|
<tag-multiselect
|
|
619
690
|
.tags=${e.tags}
|
|
620
691
|
.active=${this.#s.value}
|
|
621
|
-
.onToggle=${s=>this.#
|
|
692
|
+
.onToggle=${s=>this.#z(s)}
|
|
622
693
|
></tag-multiselect>
|
|
623
694
|
`}
|
|
624
695
|
</div>
|
|
696
|
+
<div class="row">
|
|
697
|
+
<span class="filter-label">Sort:</span>
|
|
698
|
+
<select .value=${this.#f.value} @change=${s=>this.#I(s)}>
|
|
699
|
+
<option value="mtime_desc">Recently touched</option>
|
|
700
|
+
<option value="mtime_asc">Least recently touched</option>
|
|
701
|
+
<option value="created_at_asc">Oldest first</option>
|
|
702
|
+
<option value="name_asc">Name</option>
|
|
703
|
+
</select>
|
|
704
|
+
<label class="small">
|
|
705
|
+
<input
|
|
706
|
+
type="checkbox"
|
|
707
|
+
.checked=${this.#k.value}
|
|
708
|
+
@change=${s=>this.#D(s)}
|
|
709
|
+
/>
|
|
710
|
+
Hide deprecated
|
|
711
|
+
</label>
|
|
712
|
+
</div>
|
|
625
713
|
</div>
|
|
714
|
+
${this.#p.value.size>0?f`
|
|
715
|
+
<div class="bulk-bar">
|
|
716
|
+
<span>${this.#p.value.size} selected</span>
|
|
717
|
+
<button @click=${()=>this.#v(!0)}>Mark deprecated</button>
|
|
718
|
+
<button @click=${()=>this.#v(!1)}>Un-deprecate</button>
|
|
719
|
+
<button class="danger" @click=${()=>this.#U()}>Delete</button>
|
|
720
|
+
<button @click=${()=>this.#p.set(new Set)}>Clear</button>
|
|
721
|
+
</div>
|
|
722
|
+
`:""}
|
|
626
723
|
<div class="body-region">
|
|
627
724
|
<result-list
|
|
628
|
-
style=${`width: ${this.#
|
|
725
|
+
style=${`width: ${this.#u.value}%; border-right: 1px solid #8883;`}
|
|
629
726
|
.results=${this.#r.value}
|
|
630
727
|
.showRoot=${t.length>1}
|
|
631
|
-
.onSelect=${s=>this.#
|
|
728
|
+
.onSelect=${s=>this.#M(s)}
|
|
729
|
+
.selectedIds=${this.#p.value}
|
|
730
|
+
.onToggleSelect=${s=>this.#O(s)}
|
|
632
731
|
></result-list>
|
|
633
732
|
<div
|
|
634
|
-
class="splitter ${this.#
|
|
635
|
-
@pointerdown=${s=>this.#
|
|
733
|
+
class="splitter ${this.#d.value?"dragging":""}"
|
|
734
|
+
@pointerdown=${s=>this.#_(s)}
|
|
636
735
|
></div>
|
|
637
|
-
<detail-panel .selected=${this.#a.value}></detail-panel>
|
|
736
|
+
<detail-panel .selected=${this.#a.value} .onChanged=${()=>this.#c()}></detail-panel>
|
|
638
737
|
</div>
|
|
639
|
-
${this.#n.value?
|
|
738
|
+
${this.#n.value?f`<add-root-modal
|
|
640
739
|
.defaultKind=${"skill"}
|
|
641
740
|
.lockKind=${!1}
|
|
642
|
-
.onAdded=${()=>this.#
|
|
741
|
+
.onAdded=${()=>this.#w()}
|
|
643
742
|
.onCancel=${()=>this.#n.set(!1)}
|
|
644
743
|
></add-root-modal>`:""}
|
|
645
|
-
`}}customElements.define("mem-bucket-app",
|
|
744
|
+
`}}customElements.define("mem-bucket-app",oi);
|