mcp-memory-bucket 0.10.12 → 0.10.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{index-3eH2lCtQ.js → index-BuS9zM5d.js} +265 -217
- package/dist/client/index.html +1 -1
- package/dist/src/config.js +9 -4
- package/dist/src/memory/repository.js +74 -19
- package/dist/src/remote/folderfoo-client.js +71 -31
- package/dist/src/remote/remote-sync.js +4 -4
- package/dist/src/remote/shared-items.js +51 -12
- package/dist/src/shared/bucket-folder-tool.js +11 -5
- package/dist/src/shared/bucket-share-tool.js +1 -1
- package/dist/src/skills/repository.js +48 -15
- package/dist/src/web/routes.js +165 -46
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const n of i)if(n.type==="childList")for(const o of n.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const n={};return i.integrity&&(n.integrity=i.integrity),i.referrerPolicy&&(n.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?n.credentials="include":i.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function s(i){if(i.ep)return;i.ep=!0;const n=t(i);fetch(i.href,n)}})();const es="modulepreload",ts=function(r){return"/"+r},Ue={},re=function(e,t,s){let i=Promise.resolve();if(t&&t.length>0){let o=function(d){return Promise.all(d.map(
|
|
1
|
+
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const n of i)if(n.type==="childList")for(const o of n.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const n={};return i.integrity&&(n.integrity=i.integrity),i.referrerPolicy&&(n.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?n.credentials="include":i.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function s(i){if(i.ep)return;i.ep=!0;const n=t(i);fetch(i.href,n)}})();const es="modulepreload",ts=function(r){return"/"+r},Ue={},re=function(e,t,s){let i=Promise.resolve();if(t&&t.length>0){let o=function(d){return Promise.all(d.map(u=>Promise.resolve(u).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),c=a?.nonce||a?.getAttribute("nonce");i=o(t.map(d=>{if(d=ts(d),d in Ue)return;Ue[d]=!0;const u=d.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${h}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":es,u||(f.as="script"),f.crossOrigin="",f.href=d,c&&f.setAttribute("nonce",c),document.head.appendChild(f),u)return new Promise((x,m)=>{f.addEventListener("load",x),f.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${d}`)))})}))}function n(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&n(a.reason);return e().catch(n)})};/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/const Se=globalThis,Ke=r=>r,ne=Se.trustedTypes,Ve=ne?ne.createPolicy("lit-html",{createHTML:r=>r}):void 0,Et="$lit$",R=`lit$${Math.random().toFixed(9).slice(2)}$`,Rt="?"+R,ps=`<${Rt}>`,
|
|
13
|
+
*/const Se=globalThis,Ke=r=>r,ne=Se.trustedTypes,Ve=ne?ne.createPolicy("lit-html",{createHTML:r=>r}):void 0,Et="$lit$",R=`lit$${Math.random().toFixed(9).slice(2)}$`,Rt="?"+R,ps=`<${Rt}>`,F=document,J=()=>F.createComment(""),Q=r=>r===null||typeof r!="object"&&typeof r!="function",Ce=Array.isArray,us=r=>Ce(r)||typeof r?.[Symbol.iterator]=="function",ue=`[
|
|
14
14
|
\f\r]`,V=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,We=/-->/g,Ze=/>/g,P=RegExp(`>|${ue}(?:([^\\s"'>=/]+)(${ue}*=${ue}*(?:[^
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ge=/'/g,Je=/"/g,Pt=/^(?:script|style|textarea|title)$/i,fs=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),l=fs(1),
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ge=/'/g,Je=/"/g,Pt=/^(?:script|style|textarea|title)$/i,fs=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),l=fs(1),O=Symbol.for("lit-noChange"),b=Symbol.for("lit-nothing"),Qe=new WeakMap,I=F.createTreeWalker(F,129);function zt(r,e){if(!Ce(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ve!==void 0?Ve.createHTML(e):e}const gs=(r,e)=>{const t=r.length-1,s=[];let i,n=e===2?"<svg>":e===3?"<math>":"",o=V;for(let a=0;a<t;a++){const c=r[a];let d,u,h=-1,f=0;for(;f<c.length&&(o.lastIndex=f,u=o.exec(c),u!==null);)f=o.lastIndex,o===V?u[1]==="!--"?o=We:u[1]!==void 0?o=Ze:u[2]!==void 0?(Pt.test(u[2])&&(i=RegExp("</"+u[2],"g")),o=P):u[3]!==void 0&&(o=P):o===P?u[0]===">"?(o=i??V,h=-1):u[1]===void 0?h=-2:(h=o.lastIndex-u[2].length,d=u[1],o=u[3]===void 0?P:u[3]==='"'?Je:Ge):o===Je||o===Ge?o=P:o===We||o===Ze?o=V:(o=P,i=void 0);const x=o===P&&r[a+1].startsWith("/>")?" ":"";n+=o===V?c+ps:h>=0?(s.push(d),c.slice(0,h)+Et+c.slice(h)+R+x):c+R+(h===-2?a:x)}return[zt(r,n+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};let ve=class It{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let n=0,o=0;const a=e.length-1,c=this.parts,[d,u]=gs(e,t);if(this.el=It.createElement(d,s),I.currentNode=this.el.content,t===2||t===3){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=I.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const h of i.getAttributeNames())if(h.endsWith(Et)){const f=u[o++],x=i.getAttribute(h).split(R),m=/([.?@])?(.*)/.exec(f);c.push({type:1,index:n,name:m[2],strings:x,ctor:m[1]==="."?ms:m[1]==="?"?vs:m[1]==="@"?xs:de}),i.removeAttribute(h)}else h.startsWith(R)&&(c.push({type:6,index:n}),i.removeAttribute(h));if(Pt.test(i.tagName)){const h=i.textContent.split(R),f=h.length-1;if(f>0){i.textContent=ne?ne.emptyScript:"";for(let x=0;x<f;x++)i.append(h[x],J()),I.nextNode(),c.push({type:2,index:++n});i.append(h[f],J())}}}else if(i.nodeType===8)if(i.data===Rt)c.push({type:2,index:n});else{let h=-1;for(;(h=i.data.indexOf(R,h+1))!==-1;)c.push({type:7,index:n}),h+=R.length-1}n++}}static createElement(e,t){const s=F.createElement("template");return s.innerHTML=e,s}};function q(r,e,t=r,s){if(e===O)return e;let i=s!==void 0?t._$Co?.[s]:t._$Cl;const n=Q(e)?void 0:e._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),n===void 0?i=void 0:(i=new n(r),i._$AT(r,t,s)),s!==void 0?(t._$Co??=[])[s]=i:t._$Cl=i),i!==void 0&&(e=q(r,i._$AS(r,e.values),i,s)),e}let bs=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??F).importNode(t,!0);I.currentNode=i;let n=I.nextNode(),o=0,a=0,c=s[0];for(;c!==void 0;){if(o===c.index){let d;c.type===2?d=new Te(n,n.nextSibling,this,e):c.type===1?d=new c.ctor(n,c.name,c.strings,this,e):c.type===6&&(d=new ys(n,this,e)),this._$AV.push(d),c=s[++a]}o!==c?.index&&(n=I.nextNode(),o++)}return I.currentNode=F,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++}},Te=class Lt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,i){this.type=2,this._$AH=b,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=q(this,e,t),Q(e)?e===b||e==null||e===""?(this._$AH!==b&&this._$AR(),this._$AH=b):e!==this._$AH&&e!==O&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):us(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!==b&&Q(this._$AH)?this._$AA.nextSibling.data=e:this.T(F.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=ve.createElement(zt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const n=new bs(i,this),o=n.u(this.options);n.p(t),this.T(o),this._$AH=n}}_$AC(e){let t=Qe.get(e.strings);return t===void 0&&Qe.set(e.strings,t=new ve(e)),t}k(e){Ce(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 Lt(this.O(J()),this.O(J()),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=Ke(e).nextSibling;Ke(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},de=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,i,n){this.type=1,this._$AH=b,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=b}_$AI(e,t=this,s,i){const n=this.strings;let o=!1;if(n===void 0)e=q(this,e,t,0),o=!Q(e)||e!==this._$AH&&e!==O,o&&(this._$AH=e);else{const a=e;let c,d;for(e=n[0],c=0;c<n.length-1;c++)d=q(this,a[s+c],t,c),d===O&&(d=this._$AH[c]),o||=!Q(d)||d!==this._$AH[c],d===b?e=b:e!==b&&(e+=(d??"")+n[c+1]),this._$AH[c]=d}o&&!i&&this.j(e)}j(e){e===b?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},ms=class extends de{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===b?void 0:e}},vs=class extends de{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==b)}},xs=class extends de{constructor(e,t,s,i,n){super(e,t,s,i,n),this.type=5}_$AI(e,t=this){if((e=q(this,e,t,0)??b)===O)return;const s=this._$AH,i=e===b&&s!==b||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==b&&(s===b||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)}},ys=class{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){q(this,e)}};const ks=Se.litHtmlPolyfillSupport;ks?.(ve,Te),(Se.litHtmlVersions??=[]).push("3.3.3");const $s=(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 Te(e.insertBefore(J(),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 Ae=globalThis;let k=class extends U{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=$s(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return
|
|
20
|
-
↳ while computing ${this._debugParent??"root"}`);this.#s=!0,this.#l(),
|
|
19
|
+
*/const Ae=globalThis;let k=class extends U{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=$s(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return O}};k._$litElement$=!0,k.finalized=!0,Ae.litElementHydrateSupport?.({LitElement:k});const ws=Ae.litElementPolyfillSupport;ws?.({LitElement:k});(Ae.litElementVersions??=[]).push("4.2.2");var Ft;let fe=0;const Ye=new Set;function _s(r){fe++;try{r()}finally{fe--,fe===0&&Ss()}}function Ss(){const r=new Set(Ye);Ye.clear();for(const e of r)e()}function Cs(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function Ts(r){return r&&typeof r.deref=="function"}class Ee{static#e=0;#t;#s;#n=new Set;#r=Ft.#e++;name;constructor(e,t){this.#t=e,this.#s=e,this.name=t}_get(){return p.activeConsumer&&p.activeConsumer.track(this),this.#t}_set(e){return Cs(e,this.#t)?(this.#s=this.#t,this.#t=e,this._notify(),!0):!1}subscribe(e,t=!1){let s=e;return t&&(s=new WeakRef(e)),this.#n.add(s),()=>this.#n.delete(s)}_notify(){const e=[...this.#n];for(const t of e){let s;if(Ts(t)){if(s=t.deref(),!s){this.#n.delete(t);continue}}else s=t;s()}}get id(){return this.#r}get previousValue(){return this.#s}toString(){return this.name?`${this.constructor.name}(${this.name})`:`${this.constructor.name}#${this.id}`}}Ft=Ee;class p extends Ee{static#e=[];constructor(e,t){super(e,t)}static get activeConsumer(){return this.#e[this.#e.length-1]}static push(e){this.#e.push(e)}static pop(){this.#e.pop()}get(){return this._get()}set(e){_s(()=>{this._set(e)})}get value(){return this.get()}set value(e){this.set(e)}update(e){this.set(e(this.get()))}}class Xe extends Ee{#e;#t=!0;#s=!1;#n=new Map;_debugParent;#r;#p=()=>{this.#t||(this.#t=!0,this._notify())};constructor(e,t,s){super(void 0,t),this.#e=e,this.#r=s?.weak??!0}track(e){if(this.#n.has(e))return;const t=e.subscribe(this.#p,this.#r);this.#n.set(e,t)}dispose(){this.#l()}#l(){for(const e of this.#n.values())e();this.#n.clear()}get(){if(p.activeConsumer&&p.activeConsumer.track(this),!this.#t)return this._get();if(this.#s)throw new Error(`Cycle detected in ${this}
|
|
20
|
+
↳ while computing ${this._debugParent??"root"}`);this.#s=!0,this.#l(),p.push(this);try{const e=this.#e();this._set(e)}finally{p.pop(),this.#t=!1,this.#s=!1}return this._get()}get value(){return this.get()}set value(e){throw new Error(`Cannot set value of Computed ${this}. Computed values are read-only.`)}subscribe(e,t=!1){const s=super.subscribe(e,t);return p.activeConsumer||this.get(),s}}class Y{#e;#t=new Map;_debugParent;constructor(e){this.#e=e,e.addController(this);const t=e,s=t.update,i=this;t.update=function(n){p.push(i);try{s.call(this,n)}finally{p.pop()}}}track(e){this.#t.has(e)||this.#t.set(e,e.subscribe(this.#s,!0))}#s=()=>{this.#e.requestUpdate()};hostUpdate(){for(const e of this.#t.values())e();this.#t.clear()}hostDisconnected(){for(const e of this.#t.values())e();this.#t.clear()}toString(){const e=this.#e;return`SignalWatcher(${e?.localName??e?.tagName??e?.constructor?.name??"unknown"})`}}const As=new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"});function Es(r){if(!r)return"unknown age";const e=new Date(r);return Number.isNaN(e.getTime())?"unknown age":As.format(e)}function Rs(r){const e=[],t=new Map,s=[];for(const n of r){if(n._table!=="memory_docs"||!n.key){s.push(n);continue}t.has(n.key)||(t.set(n.key,[]),e.push(n.key)),t.get(n.key).push(n)}const i=e.map(n=>({key:n,items:t.get(n)}));return s.length>0&&i.push({key:null,items:s}),i}class Ps extends k{static{this.properties={results:{attribute:!1},showFolder:{attribute:!1},onSelect:{attribute:!1},selectedIds:{attribute:!1},onToggleSelect:{attribute:!1},onKeyClick:{attribute:!1}}}static{this.styles=S`
|
|
21
21
|
:host { display: block; }
|
|
22
22
|
.count-header {
|
|
23
23
|
padding: 8px 14px;
|
|
@@ -125,38 +125,38 @@
|
|
|
125
125
|
</div>
|
|
126
126
|
</div>
|
|
127
127
|
</div>
|
|
128
|
-
`}}customElements.define("result-list",Ps);function Re(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var N=Re();function
|
|
129
|
-
]`).replace("lheading",Nt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ws=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Zs=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ut=/^( {2,}|\\)\n(?!\s*$)/,Gs=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,A=/[\p{P}\p{S}]/u,B=/[\s\p{P}\p{S}]/u,ee=/[^\s\p{P}\p{S}]/u,Js=g(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,B).getRegex(),Qs=/[\p{Pi}\p{Ps}"']/u,jt=/(?!~)[\p{P}\p{S}]/u,Ys=/(?!~)[\s\p{P}\p{S}]/u,Xs=/(?:[^\s\p{P}\p{S}]|~)/u,ei=g(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",zs?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),qt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ti=g(qt,"u").replace(/punct/g,A).getRegex(),si=g(qt,"u").replace(/punct/g,jt).getRegex(),ii=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,ri=g(ii,"u").replace(/openQuote/g,Qs).replace(/punct/g,A).getRegex(),Bt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ni=g(Bt,"gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,B).replace(/punct/g,A).getRegex(),oi=g(Bt,"gu").replace(/notPunctSpace/g,Xs).replace(/punctSpace/g,Ys).replace(/punct/g,jt).getRegex(),ai="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",li=g(ai,"gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,B).replace(/punct/g,A).getRegex(),ci=g("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,B).replace(/punct/g,A).getRegex(),di="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",hi=g(di,"gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,B).replace(/punct/g,A).getRegex(),pi=g(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,A).getRegex(),ui="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",fi=g(ui,"gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,B).replace(/punct/g,A).getRegex(),gi=g(/\\(punct)/,"gu").replace(/punct/g,A).getRegex(),bi=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(),mi=g(Le).replace("(?:-->|$)","-->").getRegex(),vi=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",mi).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),oe=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,xi=g(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",oe).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ht=g(/^!?\[(label)\]\[(ref)\]/).replace("label",oe).replace("ref",Ie).getRegex(),Kt=g(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ie).getRegex(),yi=g("reflink|nolink(?!\\()","g").replace("reflink",Ht).replace("nolink",Kt).getRegex(),tt=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,
|
|
128
|
+
`}}customElements.define("result-list",Ps);function Re(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var N=Re();function Ot(r){N=r}var z={exec:()=>null};function M(r){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),i=e[s];return i||(i=r(s),e[s]=i),i}}function g(r,e=""){let t=typeof r=="string"?r:r.source,s={replace:(i,n)=>{let o=typeof n=="string"?n:n.source;return o=o.replace(y.caret,"$1"),t=t.replace(i,o),s},getRegex:()=>new RegExp(t,e)};return s}var zs=((r="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+r)}catch{return!1}})(),y={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:M(r=>new RegExp(`^ {0,${r}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:M(r=>new RegExp(`^ {0,${r}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:M(r=>new RegExp(`^ {0,${r}}(?:\`\`\`|~~~)`)),headingBeginRegex:M(r=>new RegExp(`^ {0,${r}}#`)),htmlBeginRegex:M(r=>new RegExp(`^ {0,${r}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:M(r=>new RegExp(`^ {0,${r}}>`))},Is=/^(?:[ \t]*(?:\n|$))+/,Ls=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Fs=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,X=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Os=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Pe=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Dt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Nt=g(Dt).replace(/bull/g,Pe).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(),Ds=g(Dt).replace(/bull/g,Pe).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(),ze=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Ns=/^[^\n]+/,Ie=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ms=g(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ie).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Us=g(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Pe).getRegex(),he="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Le=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,js=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",Le).replace("tag",he).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Mt=r=>g(ze).replace("hr",X).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",r).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",he).getRegex(),qs=Mt(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Bs=Mt(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Hs=g(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Bs).getRegex(),Fe={blockquote:Hs,code:Ls,def:Ms,fences:Fs,heading:Os,hr:X,html:js,lheading:Nt,list:Us,newline:Is,paragraph:qs,table:z,text:Ns},et=g("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",X).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",he).getRegex(),Ks={...Fe,lheading:Ds,table:et,paragraph:g(ze).replace("hr",X).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",et).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",he).getRegex()},Vs={...Fe,html:g(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Le).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:z,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:g(ze).replace("hr",X).replace("heading",` *#{1,6} *[^
|
|
129
|
+
]`).replace("lheading",Nt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ws=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Zs=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ut=/^( {2,}|\\)\n(?!\s*$)/,Gs=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,A=/[\p{P}\p{S}]/u,B=/[\s\p{P}\p{S}]/u,ee=/[^\s\p{P}\p{S}]/u,Js=g(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,B).getRegex(),Qs=/[\p{Pi}\p{Ps}"']/u,jt=/(?!~)[\p{P}\p{S}]/u,Ys=/(?!~)[\s\p{P}\p{S}]/u,Xs=/(?:[^\s\p{P}\p{S}]|~)/u,ei=g(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",zs?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),qt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ti=g(qt,"u").replace(/punct/g,A).getRegex(),si=g(qt,"u").replace(/punct/g,jt).getRegex(),ii=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,ri=g(ii,"u").replace(/openQuote/g,Qs).replace(/punct/g,A).getRegex(),Bt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ni=g(Bt,"gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,B).replace(/punct/g,A).getRegex(),oi=g(Bt,"gu").replace(/notPunctSpace/g,Xs).replace(/punctSpace/g,Ys).replace(/punct/g,jt).getRegex(),ai="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",li=g(ai,"gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,B).replace(/punct/g,A).getRegex(),ci=g("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,B).replace(/punct/g,A).getRegex(),di="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",hi=g(di,"gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,B).replace(/punct/g,A).getRegex(),pi=g(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,A).getRegex(),ui="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",fi=g(ui,"gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,B).replace(/punct/g,A).getRegex(),gi=g(/\\(punct)/,"gu").replace(/punct/g,A).getRegex(),bi=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(),mi=g(Le).replace("(?:-->|$)","-->").getRegex(),vi=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",mi).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),oe=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,xi=g(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",oe).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ht=g(/^!?\[(label)\]\[(ref)\]/).replace("label",oe).replace("ref",Ie).getRegex(),Kt=g(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ie).getRegex(),yi=g("reflink|nolink(?!\\()","g").replace("reflink",Ht).replace("nolink",Kt).getRegex(),tt=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Oe={_backpedal:z,anyPunctuation:gi,autolink:bi,blockSkip:ei,br:Ut,code:Zs,del:z,delLDelim:z,delRDelim:z,emStrongLDelim:ti,emStrongRDelimAst:ni,emStrongRDelimUnd:ci,escape:Ws,link:xi,nolink:Kt,punctuation:Js,reflink:Ht,reflinkSearch:yi,tag:vi,text:Gs,url:z},ki={...Oe,emStrongLDelim:ri,emStrongRDelimAst:li,emStrongRDelimUnd:hi,link:g(/^!?\[(label)\]\((.*?)\)/).replace("label",oe).getRegex(),reflink:g(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",oe).getRegex()},xe={...Oe,emStrongRDelimAst:oi,emStrongLDelim:si,delLDelim:pi,delRDelim:fi,url:g(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",tt).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",tt).getRegex()},$i={...xe,br:g(Ut).replace("{2,}","*").getRegex(),text:g(xe.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},te={normal:Fe,gfm:Ks,pedantic:Vs},W={normal:Oe,gfm:xe,breaks:$i,pedantic:ki},wi={"&":"&","<":"<",">":">",'"':""","'":"'"},st=r=>wi[r];function T(r,e){if(e){if(y.escapeTest.test(r))return r.replace(y.escapeReplace,st)}else if(y.escapeTestNoEncode.test(r))return r.replace(y.escapeReplaceNoEncode,st);return r}function it(r){try{r=encodeURI(r).replace(y.percentDecode,"%")}catch{return null}return r}function rt(r,e){let t=r.replace(y.findPipe,(n,o,a)=>{let c=!1,d=o;for(;--d>=0&&a[d]==="\\";)c=!c;return c?"|":" |"}),s=t.split(y.splitPipe),i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(y.slashPipe,"|");return s}function E(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 nt(r){let e=r.split(`
|
|
130
130
|
`),t=e.length-1;for(;t>=0&&y.blankLine.test(e[t]);)t--;return e.length-t<=2?r:e.slice(0,t+1).join(`
|
|
131
|
-
`)}function _i(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 Si(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 ot(r,e,t,s,i){let n=e.href,o=e.title||null,a=r[1].replace(i.other.outputLinkReplace,"$1"),c=r[0].charAt(0)==="!";s.state.inLink=!0;let d=s.state.linkEmitted,
|
|
131
|
+
`)}function _i(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 Si(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 ot(r,e,t,s,i){let n=e.href,o=e.title||null,a=r[1].replace(i.other.outputLinkReplace,"$1"),c=r[0].charAt(0)==="!";s.state.inLink=!0;let d=s.state.linkEmitted,u=s.state.inRawBlock;s.state.linkEmitted=!1;let h=s.inlineTokens(a),f=s.state.linkEmitted;if(s.state.linkEmitted=d,s.state.inLink=!1,!c){if(f){s.state.inRawBlock=u;return}s.state.linkEmitted=!0}return{type:c?"image":"link",raw:t,href:n,title:o,text:a,tokens:h}}function Ci(r,e,t){let s=r.match(t.other.indentCodeCompensation);if(s===null)return e;let i=s[1];return e.split(`
|
|
132
132
|
`).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(`
|
|
133
133
|
`)}var ae=class{options;rules;lexer;constructor(r){this.options=r||N}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]:nt(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=Ci(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=E(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:E(e[0],`
|
|
134
134
|
`),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:E(e[0],`
|
|
135
135
|
`)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=E(e[0],`
|
|
136
136
|
`).split(`
|
|
137
137
|
`),s="",i="",n=[];for(;t.length>0;){let o=!1,a=[],c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))a.push(t[c]),o=!0;else if(!o)a.push(t[c]);else break;t=t.slice(c);let d=a.join(`
|
|
138
|
-
`),
|
|
138
|
+
`),u=d.replace(this.rules.other.blockquoteSetextReplace,`
|
|
139
139
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
140
140
|
${d}`:d,i=i?`${i}
|
|
141
|
-
${
|
|
141
|
+
${u}`:u;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,n,!0),this.lexer.state.top=h,t.length===0)break;let f=n.at(-1);if(f?.type==="code")break;if(f?.type==="blockquote"){let x=f,m=t.join(`
|
|
142
142
|
`),C=x.raw+`
|
|
143
143
|
`+m.replace(this.rules.other.blockquoteSetextReplace2,""),H=this.blockquote(C);n[n.length-1]=H,s=`${s}
|
|
144
144
|
${m}`,i=i.substring(0,i.length-x.text.length)+H.text;break}else if(f?.type==="list"){let x=f,m=x.raw+`
|
|
145
145
|
`+t.join(`
|
|
146
146
|
`),C=this.list(m);n[n.length-1]=C,s=s.substring(0,s.length-f.raw.length)+C.raw,i=i.substring(0,i.length-x.raw.length)+C.raw,t=m.substring(n.at(-1).raw.length).split(`
|
|
147
|
-
`);continue}}return{type:"blockquote",raw:s,tokens:n,text:i}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=e[1].trim(),s=t.length>1,i={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let n=this.rules.other.listItemRegex(t),o=!1;for(;r;){let c=!1,d="",
|
|
147
|
+
`);continue}}return{type:"blockquote",raw:s,tokens:n,text:i}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=e[1].trim(),s=t.length>1,i={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let n=this.rules.other.listItemRegex(t),o=!1;for(;r;){let c=!1,d="",u="";if(!(e=n.exec(r))||this.rules.block.hr.test(r))break;d=e[0],r=r.substring(d.length);let h=Si(e[2].split(`
|
|
148
148
|
`,1)[0],e[1].length),f=r.split(`
|
|
149
|
-
`,1)[0],x=!h.trim(),m=0;if(this.options.pedantic?(m=2,
|
|
149
|
+
`,1)[0],x=!h.trim(),m=0;if(this.options.pedantic?(m=2,u=h.trimStart()):x?m=e[1].length+1:(m=h.search(this.rules.other.nonSpaceChar),m=m>4?1:m,u=h.slice(m),m+=e[1].length),x&&this.rules.other.blankLine.test(f)&&(d+=f+`
|
|
150
150
|
`,r=r.substring(f.length+1),c=!0),!c){let C=this.rules.other.nextBulletRegex(m),H=this.rules.other.hrRegex(m),Ne=this.rules.other.fencesBeginRegex(m),Me=this.rules.other.headingBeginRegex(m),Yt=this.rules.other.htmlBeginRegex(m),Xt=this.rules.other.blockquoteBeginRegex(m);for(;r;){let pe=r.split(`
|
|
151
|
-
`,1)[0],K;if(f=pe,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),K=f):K=f.replace(this.rules.other.tabCharGlobal," "),Ne.test(f)||Me.test(f)||Yt.test(f)||Xt.test(f)||C.test(f)||H.test(f))break;if(K.search(this.rules.other.nonSpaceChar)>=m||!f.trim())
|
|
152
|
-
`+K.slice(m);else{if(x||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||Ne.test(h)||Me.test(h)||H.test(h))break;
|
|
151
|
+
`,1)[0],K;if(f=pe,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),K=f):K=f.replace(this.rules.other.tabCharGlobal," "),Ne.test(f)||Me.test(f)||Yt.test(f)||Xt.test(f)||C.test(f)||H.test(f))break;if(K.search(this.rules.other.nonSpaceChar)>=m||!f.trim())u+=`
|
|
152
|
+
`+K.slice(m);else{if(x||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||Ne.test(h)||Me.test(h)||H.test(h))break;u+=`
|
|
153
153
|
`+f}x=!f.trim(),d+=pe+`
|
|
154
|
-
`,r=r.substring(pe.length+1),h=K.slice(m)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(o=!0)),i.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(
|
|
154
|
+
`,r=r.substring(pe.length+1),h=K.slice(m)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(o=!0)),i.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),i.raw+=d}let a=i.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let c of i.items)if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),!i.loose){let d=c.tokens.filter(h=>h.type==="space"),u=d.length>0&&d.some(h=>this.rules.other.anyLine.test(h.raw));i.loose=u}for(let c of i.items){let d=c.tokens[0];if(c.task&&(d?.type==="text"||d?.type==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),d.raw=d.raw.replace(this.rules.other.listReplaceTask,""),d.text=d.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 u=this.rules.other.listTaskCheckbox.exec(c.raw);if(u){let h={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};c.checked=h.checked,i.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=h.raw+c.tokens[0].raw,c.tokens[0].text=h.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(h)):c.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):c.tokens.unshift(h)}}else c.task&&(c.task=!1)}if(i.loose)for(let c of i.items){c.loose=!0;for(let d of c.tokens)d.type==="text"&&(d.type="paragraph")}return i}}html(r){let e=this.rules.block.html.exec(r);if(e){let t=nt(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:E(e[0],`
|
|
155
155
|
`),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=rt(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
156
156
|
`):[],n={type:"table",raw:E(e[0],`
|
|
157
157
|
`),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(rt(o,n.header.length).map((a,c)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:n.align[c]})));return n}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e){let t=e[1].trim();return{type:"heading",raw:E(e[0],`
|
|
158
158
|
`),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)===`
|
|
159
|
-
`?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=E(t.slice(0,-1),"\\");if((t.length-n.length)%2===0)return}else{let n=_i(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)),ot(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 ot(t,i,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(r);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,n,o,a=i,c=0,d=s[0][0],
|
|
159
|
+
`?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=E(t.slice(0,-1),"\\");if((t.length-n.length)%2===0)return}else{let n=_i(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)),ot(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 ot(t,i,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(r);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,n,o,a=i,c=0,d=s[0][0],u=t===d,h=d==="*"?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)){c+=o;continue}if(u)break}if(a-=o,a>0)continue;o=Math.min(o,o+a+c);let f=[...s[0]][0].length,x=r.slice(0,i+s.index+f+o);if(Math.min(i,o)%2){let C=x.slice(1,-1);return{type:"em",raw:x,text:C,tokens:this.lexer.inlineTokens(C)}}let m=x.slice(2,-2);return{type:"strong",raw:x,text:m,tokens:this.lexer.inlineTokens(m)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r,e,t=""){let s=this.rules.inline.delLDelim.exec(r);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,n,o,a=i,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*r.length+i);(s=c.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n||(o=[...n].length,o!==i))continue;if(s[3]||s[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let d=[...s[0]][0].length,u=r.slice(0,i+s.index+d+o),h=u.slice(i,-i);return{type:"del",raw:u,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 ye{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||N,this.options.tokenizer=this.options.tokenizer||new ae,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:y,block:te.normal,inline:W.normal};this.options.pedantic?(t.block=te.pedantic,t.inline=W.pedantic):this.options.gfm&&(t.block=te.gfm,this.options.breaks?t.inline=W.breaks:t.inline=W.gfm),this.tokenizer.rules=t}static get rules(){return{block:te,inline:W}}static lex(e,t){return new ye(t).lex(e)}static lexInline(e,t){return new ye(t).inlineTokens(e)}lex(e){e=e.replace(y.carriageReturn,`
|
|
160
160
|
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(y.tabCharGlobal," ").replace(y.spaceLine,""));let i=1/0;for(;e;){if(e.length<i)i=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let n;if(this.options.extensions?.block?.some(a=>(n=a.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))continue;if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length);let a=t.at(-1);n.raw.length===1&&a!==void 0?a.raw+=`
|
|
161
161
|
`: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(`
|
|
162
162
|
`)?"":`
|
|
@@ -164,13 +164,13 @@ ${m}`,i=i.substring(0,i.length-x.text.length)+H.text;break}else if(f?.type==="li
|
|
|
164
164
|
`+n.text,this.inlineQueue.at(-1).src=a.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
165
165
|
`)?"":`
|
|
166
166
|
`)+n.raw,a.text+=`
|
|
167
|
-
`+n.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title},t.push(n));continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}let o=e;if(this.options.extensions?.startBlock){let a=1/0,c=e.slice(1),d;this.options.extensions.startBlock.forEach(
|
|
167
|
+
`+n.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title},t.push(n));continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}let o=e;if(this.options.extensions?.startBlock){let a=1/0,c=e.slice(1),d;this.options.extensions.startBlock.forEach(u=>{d=u.call({lexer:this},c),typeof d=="number"&&d>=0&&(a=Math.min(a,d))}),a<1/0&&a>=0&&(o=e.substring(0,a+1))}if(this.state.top&&(n=this.tokenizer.paragraph(o))){let a=t.at(-1);s&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
|
|
168
168
|
`)?"":`
|
|
169
169
|
`)+n.raw,a.text+=`
|
|
170
170
|
`+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(`
|
|
171
171
|
`)?"":`
|
|
172
172
|
`)+n.raw,a.text+=`
|
|
173
|
-
`+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(n);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes("["))return!1;let t=this.tokenizer.rules.inline.link;for(let s of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(s[0])&&e.charAt(s.index-1)!=="!")return!0;for(let s of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let i=s[0],n=i.lastIndexOf("[");if(!(i.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,i.slice(n+1,-1)))&&!(n>1&&this.linkInText(i.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=e;if(this.tokens.links&&e.includes("[")){let a=this.tokenizer.rules.inline.reflinkSearch,c=d=>{let
|
|
173
|
+
`+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(n);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes("["))return!1;let t=this.tokenizer.rules.inline.link;for(let s of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(s[0])&&e.charAt(s.index-1)!=="!")return!0;for(let s of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let i=s[0],n=i.lastIndexOf("[");if(!(i.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,i.slice(n+1,-1)))&&!(n>1&&this.linkInText(i.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=e;if(this.tokens.links&&e.includes("[")){let a=this.tokenizer.rules.inline.reflinkSearch,c=d=>{let u=d.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,d.slice(u+1,-1)))return d;if(u>1&&d.charAt(0)!=="!"){let h=d.slice(1,u-1);if(this.linkInText(h))return"["+h.replace(a,c)+"]["+"a".repeat(d.length-u-2)+"]"}return"["+"a".repeat(d.length-2)+"]"};s=s.replace(a,c)}s=s.replace(this.tokenizer.rules.inline.anyPunctuation,a=>"+".repeat(a.length)),s=s.replace(this.tokenizer.rules.inline.blockSkip,(a,c,d)=>{let u=d?d.length:0;return a.slice(0,u)+"["+"a".repeat(a.length-u-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(d=>(a=d.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 d=t.at(-1);a.type==="text"&&d?.type==="text"?(d.raw+=a.raw,d.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,s,n)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e,s,n)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let c=e;if(this.options.extensions?.startInline){let d=1/0,u=e.slice(1),h;this.options.extensions.startInline.forEach(f=>{h=f.call({lexer:this},u),typeof h=="number"&&h>=0&&(d=Math.min(d,h))}),d<1/0&&d>=0&&(c=e.substring(0,d+1))}if(a=this.tokenizer.inlineText(c)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(n=a.raw.slice(-1)),i=!0;let d=t.at(-1);d?.type==="text"?(d.raw+=a.raw,d.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)}},le=class{options;parser;constructor(r){this.options=r||N}space(r){return""}code({text:r,lang:e,escaped:t}){let s=(e||"").match(y.notSpaceStart)?.[0],i=r.replace(y.endingNewline,"")+`
|
|
174
174
|
`;return s?'<pre><code class="language-'+T(s)+'">'+(t?i:T(i,!0))+`</code></pre>
|
|
175
175
|
`:"<pre><code>"+(t?i:T(i,!0))+`</code></pre>
|
|
176
176
|
`}blockquote({tokens:r}){return`<blockquote>
|
|
@@ -188,8 +188,8 @@ ${this.parser.parse(r)}</blockquote>
|
|
|
188
188
|
`}tablerow({text:r}){return`<tr>
|
|
189
189
|
${r}</tr>
|
|
190
190
|
`}tablecell(r){let e=this.parser.parseInline(r.tokens),t=r.header?"th":"td";return(r.align?`<${t} align="${r.align}">`:`<${t}>`)+e+`</${t}>
|
|
191
|
-
`}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>${T(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=it(r);if(i===null)return s;r=i;let n='<a href="'+r+'"';return e&&(n+=' title="'+T(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=it(r);if(i===null)return T(t);r=i;let n=`<img src="${r}" alt="${T(t)}"`;return e&&(n+=` title="${T(e)}"`),n+=">",n}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:T(r.text)}},De=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}checkbox({raw:r}){return r}},_=class ke{options;renderer;textRenderer;constructor(e){this.options=e||N,this.options.renderer=this.options.renderer||new le,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new De}static parse(e,t){return new ke(t).parse(e)}static parseInline(e,t){return new ke(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||N}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}emStrongMask(r){return r}provideLexer(r=this.block){return r?w.lex:w.lexInline}provideParser(r=this.block){return r?_.parse:_.parseInline}},Ti=class{defaults=Re();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=_;Renderer=le;TextRenderer=De;Lexer=w;Tokenizer=ae;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 le(this.defaults);for(let n in t.renderer){if(!(n in i))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let o=n,a=t.renderer[o],c=i[o];i[o]=(...d)=>{let
|
|
192
|
-
Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error occurred:</p><pre>"+T(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},D=new Ti;function v(r,e){return D.parse(r,e)}v.options=v.setOptions=function(r){return D.setOptions(r),v.defaults=D.defaults,
|
|
191
|
+
`}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>${T(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=it(r);if(i===null)return s;r=i;let n='<a href="'+r+'"';return e&&(n+=' title="'+T(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=it(r);if(i===null)return T(t);r=i;let n=`<img src="${r}" alt="${T(t)}"`;return e&&(n+=` title="${T(e)}"`),n+=">",n}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:T(r.text)}},De=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}checkbox({raw:r}){return r}},_=class ke{options;renderer;textRenderer;constructor(e){this.options=e||N,this.options.renderer=this.options.renderer||new le,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new De}static parse(e,t){return new ke(t).parse(e)}static parseInline(e,t){return new ke(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||N}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}emStrongMask(r){return r}provideLexer(r=this.block){return r?w.lex:w.lexInline}provideParser(r=this.block){return r?_.parse:_.parseInline}},Ti=class{defaults=Re();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=_;Renderer=le;TextRenderer=De;Lexer=w;Tokenizer=ae;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 le(this.defaults);for(let n in t.renderer){if(!(n in i))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let o=n,a=t.renderer[o],c=i[o];i[o]=(...d)=>{let u=a.apply(i,d);return u===!1&&(u=c.apply(i,d)),u||""}}s.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new ae(this.defaults);for(let n in t.tokenizer){if(!(n in i))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let o=n,a=t.tokenizer[o],c=i[o];i[o]=(...d)=>{let u=a.apply(i,d);return u===!1&&(u=c.apply(i,d)),u}}s.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new Z;for(let n in t.hooks){if(!(n in i))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let o=n,a=t.hooks[o],c=i[o];Z.passThroughHooks.has(n)?i[o]=d=>{if(this.defaults.async&&Z.passThroughHooksRespectAsync.has(n))return(async()=>{let h=await a.call(i,d);return c.call(i,h)})();let u=a.call(i,d);return c.call(i,u)}:i[o]=(...d)=>{if(this.defaults.async)return(async()=>{let h=await a.apply(i,d);return h===!1&&(h=await c.apply(i,d)),h})();let u=a.apply(i,d);return u===!1&&(u=c.apply(i,d)),u}}s.hooks=i}if(t.walkTokens){let i=this.defaults.walkTokens,n=t.walkTokens;s.walkTokens=function(o){let a=[];return a.push(n.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return w.lex(r,e??this.defaults)}parser(r,e){return _.parse(r,e??this.defaults)}parseMarkdown(r){return(e,t)=>{let s={...t},i={...this.defaults,...s},n=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return n(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return n(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return n(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=r),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,a=await(i.hooks?await i.hooks.provideLexer(r):r?w.lex:w.lexInline)(o,i),c=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let d=await(i.hooks?await i.hooks.provideParser(r):r?_.parse:_.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(d):d})().catch(n);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer(r):r?w.lex:w.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser(r):r?_.parse:_.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return n(o)}}}onError(r,e){return t=>{if(t.message+=`
|
|
192
|
+
Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error occurred:</p><pre>"+T(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},D=new Ti;function v(r,e){return D.parse(r,e)}v.options=v.setOptions=function(r){return D.setOptions(r),v.defaults=D.defaults,Ot(v.defaults),v};v.getDefaults=Re;v.defaults=N;function Ai(...r){return D.use(...r),v.defaults=D.defaults,Ot(v.defaults),v}v.use=Ai;v.walkTokens=function(r,e){return D.walkTokens(r,e)};v.parseInline=D.parseInline;v.Parser=_;v.parser=_.parse;v.Renderer=le;v.TextRenderer=De;v.Lexer=w;v.lexer=w.lex;v.Tokenizer=ae;v.Hooks=Z;v.parse=v;v.options;v.setOptions;v.walkTokens;v.parseInline;_.parse;w.lex;/**
|
|
193
193
|
* @license
|
|
194
194
|
* Copyright 2017 Google LLC
|
|
195
195
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -197,7 +197,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
|
|
|
197
197
|
* @license
|
|
198
198
|
* Copyright 2017 Google LLC
|
|
199
199
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
200
|
-
*/class $e extends Pi{constructor(e){if(super(e),this.it=b,e.type!==Ei.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===b||e==null)return this._t=void 0,this.it=e;if(e===
|
|
200
|
+
*/class $e extends Pi{constructor(e){if(super(e),this.it=b,e.type!==Ei.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===b||e==null)return this._t=void 0,this.it=e;if(e===O)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}$e.directiveName="unsafeHTML",$e.resultType=1;const zi=Ri($e);let at=0;class Ii extends k{static{this.properties={tags:{attribute:!1},active:{attribute:!1},onToggle:{attribute:!1},allowCreate:{attribute:!1},width:{attribute:!1}}}#e=new p("");#t=new p(!1);#s=new p(-1);#n;#r;static{this.styles=S`
|
|
201
201
|
:host {
|
|
202
202
|
display: inline-block;
|
|
203
203
|
position: relative;
|
|
@@ -311,7 +311,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
|
|
|
311
311
|
.option input { margin: 0; pointer-events: none; }
|
|
312
312
|
.empty { padding: 6px 8px; opacity: 0.6; font-style: italic; font-size: 12px; }
|
|
313
313
|
.create-option { color: var(--accent); font-style: italic; }
|
|
314
|
-
`}constructor(){super(),new Y(this),this.tags=[],this.active=[],this.onToggle=()=>{},this.allowCreate=!1,this.#n=`--tag-multiselect-${++at}`,this.#r=`tag-multiselect-listbox-${at}`}willUpdate(){this.style.width=this.width??""}#
|
|
314
|
+
`}constructor(){super(),new Y(this),this.tags=[],this.active=[],this.onToggle=()=>{},this.allowCreate=!1,this.#n=`--tag-multiselect-${++at}`,this.#r=`tag-multiselect-listbox-${at}`}willUpdate(){this.style.width=this.width??""}#p=e=>{e.composedPath().includes(this)||this.#a()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#p)}disconnectedCallback(){document.removeEventListener("click",this.#p),super.disconnectedCallback()}get#l(){const e=this.#e.value.trim().toLowerCase();return e?this.tags.filter(t=>t.toLowerCase().includes(e)):this.tags}#i(){this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#a(){this.#t.set(!1),this.#s.set(-1),this.renderRoot.querySelector(".menu")?.hidePopover()}#g(){this.#t.value?this.#a():(this.#i(),this.renderRoot.querySelector(".input")?.focus())}#v(e){this.#e.set(e.target.value),this.#s.set(-1),this.#i()}#u(e){this.onToggle(e),this.#e.set(""),this.#s.set(-1)}get#o(){if(!this.allowCreate)return!1;const e=this.#e.value.trim();return e.length>0&&!this.tags.includes(e)&&!this.active.includes(e)}#b(e){e.stopPropagation(),this.active.forEach(t=>this.onToggle(t)),this.#e.set(""),this.renderRoot.querySelector(".input")?.focus(),this.#i()}#k(e){const t=this.#l;if(e.key==="ArrowDown")e.preventDefault(),this.#i(),t.length&&this.#s.set((this.#s.value+1)%t.length);else if(e.key==="ArrowUp")e.preventDefault(),this.#i(),t.length&&this.#s.set((this.#s.value-1+t.length)%t.length);else if(e.key==="Enter"||this.allowCreate&&e.key===","){const s=t[this.#s.value];s!==void 0?(e.preventDefault(),this.#u(s)):this.#o&&(e.preventDefault(),this.#u(this.#e.value.trim()))}else if(e.key==="Backspace"&&!this.#e.value&&this.active.length>0){const s=this.active[this.active.length-1];s!==void 0&&this.onToggle(s)}else e.key==="Escape"&&this.#a()}render(){const e=this.active,t=this.#l,s=this.#t.value,i=this.#s.value;return l`
|
|
315
315
|
<div class="field" style=${`anchor-name: ${this.#n}`}>
|
|
316
316
|
<div class="chips-and-input">
|
|
317
317
|
${e.map(n=>l`
|
|
@@ -332,7 +332,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
|
|
|
332
332
|
@input=${n=>this.#v(n)}
|
|
333
333
|
@focus=${()=>this.#i()}
|
|
334
334
|
@click=${()=>this.#i()}
|
|
335
|
-
@keydown=${n=>this.#
|
|
335
|
+
@keydown=${n=>this.#k(n)}
|
|
336
336
|
/>
|
|
337
337
|
</div>
|
|
338
338
|
${e.length>0?l`<button class="clear-btn" tabindex="-1" @mousedown=${n=>n.preventDefault()} @click=${n=>this.#b(n)}>✕</button>`:""}
|
|
@@ -361,22 +361,22 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
|
|
|
361
361
|
aria-selected=${e.includes(n)}
|
|
362
362
|
class=${o===i?"option highlighted":"option"}
|
|
363
363
|
@mousedown=${a=>a.preventDefault()}
|
|
364
|
-
@click=${()=>this.#
|
|
364
|
+
@click=${()=>this.#u(n)}
|
|
365
365
|
>
|
|
366
366
|
<input type="checkbox" .checked=${e.includes(n)} tabindex="-1" />
|
|
367
367
|
${n}
|
|
368
368
|
</li>
|
|
369
|
-
`):this.#
|
|
369
|
+
`):this.#o?l`
|
|
370
370
|
<li
|
|
371
371
|
class="option create-option"
|
|
372
372
|
@mousedown=${n=>n.preventDefault()}
|
|
373
|
-
@click=${()=>this.#
|
|
373
|
+
@click=${()=>this.#u(this.#e.value.trim())}
|
|
374
374
|
>
|
|
375
375
|
No match. Create '${this.#e.value.trim()}'
|
|
376
376
|
</li>
|
|
377
377
|
`:l`<li class="empty">${this.allowCreate?"Type to create a tag":"No matches"}</li>`}
|
|
378
378
|
</ul>
|
|
379
|
-
`}}customElements.define("tag-multiselect",Ii);let lt=0;class Li extends k{static{this.properties={options:{attribute:!1},value:{attribute:!1},onChange:{attribute:!1}}}#e=new
|
|
379
|
+
`}}customElements.define("tag-multiselect",Ii);let lt=0;class Li extends k{static{this.properties={options:{attribute:!1},value:{attribute:!1},onChange:{attribute:!1}}}#e=new p("");#t=new p(!1);#s=new p(-1);#n;#r;static{this.styles=S`
|
|
380
380
|
:host {
|
|
381
381
|
display: inline-block;
|
|
382
382
|
position: relative;
|
|
@@ -463,7 +463,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
|
|
|
463
463
|
.option.selected { font-weight: 600; }
|
|
464
464
|
.empty { padding: 6px 8px; opacity: 0.6; font-style: italic; font-size: 12px; }
|
|
465
465
|
.create-option { color: var(--accent); font-style: italic; }
|
|
466
|
-
`}constructor(){super(),new Y(this),this.options=[],this.value="",this.onChange=()=>{},this.#n=`--status-select-${++lt}`,this.#r=`status-select-listbox-${lt}`}#
|
|
466
|
+
`}constructor(){super(),new Y(this),this.options=[],this.value="",this.onChange=()=>{},this.#n=`--status-select-${++lt}`,this.#r=`status-select-listbox-${lt}`}#p=e=>{e.composedPath().includes(this)||this.#a()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#p)}disconnectedCallback(){document.removeEventListener("click",this.#p),super.disconnectedCallback()}get#l(){const e=this.#e.value.trim().toLowerCase();return!e||e===this.value.trim().toLowerCase()?this.options:this.options.filter(t=>t.toLowerCase().includes(e))}#i(){this.#e.set(this.value),this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#a(){this.#t.set(!1),this.#s.set(-1),this.#e.set(this.value),this.renderRoot.querySelector(".menu")?.hidePopover()}#g(){this.#t.value?this.#a():(this.#i(),this.renderRoot.querySelector(".input")?.focus())}#v(e){this.#e.set(e.target.value),this.#s.set(-1),this.#t.value||this.#i()}#u(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}#o(e){const t=this.#u(e);if(!t)return this.#a();this.onChange(t),this.#e.set(t),this.#s.set(-1),this.#a()}get#b(){const e=this.#u(this.#e.value);return e.length>0&&!this.options.some(t=>t.toLowerCase()===e)}get#k(){return this.#l.length+(this.#b?1:0)}#w(e){const t=this.#k;if(e.key==="ArrowDown")e.preventDefault(),this.#i(),t&&this.#s.set((this.#s.value+1)%t);else if(e.key==="ArrowUp")e.preventDefault(),this.#i(),t&&this.#s.set((this.#s.value-1+t)%t);else if(e.key==="Enter"){e.preventDefault();const s=this.#l,i=s[this.#s.value];i!==void 0?this.#o(i):this.#s.value===s.length&&this.#b?this.#o(this.#e.value):this.#e.value.trim()&&this.#o(this.#e.value)}else e.key==="Escape"&&(e.preventDefault(),this.#a())}render(){const e=this.value,t=this.#l,s=this.#t.value,i=this.#s.value;return l`
|
|
467
467
|
<div class="field" style=${`anchor-name: ${this.#n}`}>
|
|
468
468
|
<input
|
|
469
469
|
class="input"
|
|
@@ -476,8 +476,8 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
|
|
|
476
476
|
@input=${n=>this.#v(n)}
|
|
477
477
|
@focus=${()=>this.#i()}
|
|
478
478
|
@click=${()=>this.#i()}
|
|
479
|
-
@keydown=${n=>this
|
|
480
|
-
@blur=${()=>{this.#t.value&&this.#e.value.trim()&&this.#
|
|
479
|
+
@keydown=${n=>this.#w(n)}
|
|
480
|
+
@blur=${()=>{this.#t.value&&this.#e.value.trim()&&this.#u(this.#e.value)!==e?this.#o(this.#e.value):this.#a()}}
|
|
481
481
|
/>
|
|
482
482
|
<button
|
|
483
483
|
class="chevron-btn ${s?"open":""}"
|
|
@@ -503,7 +503,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
|
|
|
503
503
|
aria-selected=${n===e}
|
|
504
504
|
class=${`option ${n===e?"selected":""} ${o===i?"highlighted":""}`}
|
|
505
505
|
@mousedown=${a=>a.preventDefault()}
|
|
506
|
-
@click=${()=>this.#
|
|
506
|
+
@click=${()=>this.#o(n)}
|
|
507
507
|
>
|
|
508
508
|
${n}
|
|
509
509
|
</li>
|
|
@@ -514,14 +514,14 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
|
|
|
514
514
|
role="option"
|
|
515
515
|
class=${`option create-option ${t.length===i?"highlighted":""}`}
|
|
516
516
|
@mousedown=${n=>n.preventDefault()}
|
|
517
|
-
@click=${()=>this.#
|
|
517
|
+
@click=${()=>this.#o(this.#e.value)}
|
|
518
518
|
>
|
|
519
|
-
${t.length?"Create":"No match. Create"} '${this.#
|
|
519
|
+
${t.length?"Create":"No match. Create"} '${this.#u(this.#e.value)}'
|
|
520
520
|
</li>
|
|
521
521
|
`:""}
|
|
522
522
|
${!t.length&&!this.#b?l`<li class="empty">No options</li>`:""}
|
|
523
523
|
</ul>
|
|
524
|
-
`}}customElements.define("status-select",Li);let
|
|
524
|
+
`}}customElements.define("status-select",Li);let Fi=0;const Oi={top:"top: auto; bottom: anchor(top); left: anchor(center); right: auto; translate: -50% 0; margin-top: 0; margin-bottom: 6px;",bottom:"top: anchor(bottom); bottom: auto; left: anchor(center); right: auto; translate: -50% 0; margin-top: 6px; margin-bottom: 0;",left:"top: anchor(center); bottom: auto; left: auto; right: anchor(left); translate: 0 -50%; margin-right: 6px;",right:"top: anchor(center); bottom: auto; left: anchor(right); right: auto; translate: 0 -50%; margin-left: 6px;"},Di=["top","bottom","left","right"];class Ni extends k{static{this.properties={text:{attribute:!1},placement:{attribute:!1}}}#e;#t=null;static{this.styles=S`
|
|
525
525
|
:host {
|
|
526
526
|
display: inline-flex;
|
|
527
527
|
position: relative;
|
|
@@ -605,7 +605,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
|
|
|
605
605
|
translate: 0 -50%;
|
|
606
606
|
margin: 0 0 0 6px;
|
|
607
607
|
}
|
|
608
|
-
`}constructor(){super(),this.text="",this.placement="top",this.#e=`--help-tooltip-${++
|
|
608
|
+
`}constructor(){super(),this.text="",this.placement="top",this.#e=`--help-tooltip-${++Fi}`}get#s(){const e=Di.filter(t=>t!==this.placement);return[this.placement,...e].map(t=>`--bubble-${t}`).join(", ")}disconnectedCallback(){this.#t&&clearTimeout(this.#t),super.disconnectedCallback()}#n(){this.#t&&(clearTimeout(this.#t),this.#t=null);const e=this.renderRoot.querySelector(".bubble");e&&!e.matches(":popover-open")&&e.showPopover()}#r(){this.#t=setTimeout(()=>{this.renderRoot.querySelector(".bubble")?.hidePopover()},100)}render(){return l`
|
|
609
609
|
<button
|
|
610
610
|
type="button"
|
|
611
611
|
class="icon"
|
|
@@ -621,13 +621,13 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
|
|
|
621
621
|
role="tooltip"
|
|
622
622
|
class="bubble"
|
|
623
623
|
popover="manual"
|
|
624
|
-
style=${`position-anchor: ${this.#e}; position-try-fallbacks: ${this.#s}; ${
|
|
624
|
+
style=${`position-anchor: ${this.#e}; position-try-fallbacks: ${this.#s}; ${Oi[this.placement]}`}
|
|
625
625
|
@mouseenter=${()=>this.#n()}
|
|
626
626
|
@mouseleave=${()=>this.#r()}
|
|
627
627
|
>
|
|
628
628
|
${this.text}
|
|
629
629
|
</div>
|
|
630
|
-
`}}customElements.define("help-tooltip",Ni);const ct="mem-bucket-detail-view-mode",Mi=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg"]);function Ui(r){const e=r.lastIndexOf(".");return e===-1?!1:Mi.has(r.slice(e).toLowerCase())}function ji(r){return new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(r))}const qi=["stable","beta","unreviewed"],Bi=["active","shipped","abandoned"],dt=["plan","spec","sql","testing-todo","discovery","session-summary","other"],Hi=["ticket","freeform"],$={description:"What this doc is / does, shown in search results and list views. For skills, this is also the only thing an agent sees before deciding whether to load the full body — so state both what it does and when to use it.",tags:"Free-form keywords used to filter and search. Not the only thing matched during full-text search, but the fastest way to narrow a list view.",status:`Lifecycle state — stable/beta/unreviewed for skills, active/shipped/abandoned for memory docs. Skills default to "unreviewed" if left unset, so low-trust content doesn't read as equivalent to a reviewed pattern.`,name:"The skill's identifier — becomes its containing folder name on disk. Lowercase letters, numbers, and hyphens only.",owner:"Who authored or maintains this skill — a person or team name, free text.",extends:"Name of another skill this one builds on or specializes, if any. Leave blank if it doesn't extend anything.",trigger_phrases:"Extra keyword phrases beyond the description that should surface this skill in search — phrasings a user might type that don't literally appear in the description text.",key:"The lookup handle for this memory doc — usually a ticket ID, sometimes a free-form name. One key can have several docs attached (a plan, a spec, session notes) all retrievable together.",key_type:'"ticket" if the key is a real ticket ID, "freeform" for a name like "Spot Chart Design".',doc_type:"What kind of content this is — shapes how it should be read (a plan reads differently than raw SQL or a session summary).",related_to:"Another key this doc relates to, if any — free text, not validated against existing keys."};function ht(r){return{description:r.description??"",tags:r.tags??[],status:r.status??"",name:r.name??"",owner:r.owner??"",extends:r.extends??"",trigger_phrases:r.trigger_phrases??[],key:r.key??"",key_type:r.key_type??"",doc_type:r.doc_type??"",related_to:r.related_to??""}}class Ki extends k{constructor(){super(...arguments),this._viewMode=localStorage.getItem(ct)??"markdown",this._editing=!1,this._draft=null,this._addingFrontmatter=!1,this._renaming=!1,this._renameValue="",this._viewingAttachment=null,this._sharing=!1,this._shareUsername="",this._shareRole="member",this._shareBusy=!1,this._shareStatus=null}static{this.properties={selected:{attribute:!1},onChanged:{attribute:!1},facets:{attribute:!1},onTagClick:{attribute:!1},onFolderClick:{attribute:!1},onDateClick:{attribute:!1},onKeyClick:{attribute:!1},_doc:{state:!0},_viewMode:{state:!0},_editing:{state:!0},_draft:{state:!0},_addingFrontmatter:{state:!0},_renaming:{state:!0},_renameValue:{state:!0},_viewingAttachment:{state:!0},_sharing:{state:!0},_shareUsername:{state:!0},_shareRole:{state:!0},_shareBusy:{state:!0},_shareStatus:{state:!0}}}static{this.styles=S`
|
|
630
|
+
`}}customElements.define("help-tooltip",Ni);const ct="mem-bucket-detail-view-mode",Mi=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg"]);function Ui(r){const e=r.lastIndexOf(".");return e===-1?!1:Mi.has(r.slice(e).toLowerCase())}function ji(r){return new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(r))}const qi=["stable","beta","unreviewed"],Bi=["active","shipped","abandoned"],dt=["plan","spec","sql","testing-todo","discovery","session-summary","other"],Hi=["ticket","freeform"],$={description:"What this doc is / does, shown in search results and list views. For skills, this is also the only thing an agent sees before deciding whether to load the full body — so state both what it does and when to use it.",tags:"Free-form keywords used to filter and search. Not the only thing matched during full-text search, but the fastest way to narrow a list view.",status:`Lifecycle state — stable/beta/unreviewed for skills, active/shipped/abandoned for memory docs. Skills default to "unreviewed" if left unset, so low-trust content doesn't read as equivalent to a reviewed pattern.`,name:"The skill's identifier — becomes its containing folder name on disk. Lowercase letters, numbers, and hyphens only.",owner:"Who authored or maintains this skill — a person or team name, free text.",extends:"Name of another skill this one builds on or specializes, if any. Leave blank if it doesn't extend anything.",trigger_phrases:"Extra keyword phrases beyond the description that should surface this skill in search — phrasings a user might type that don't literally appear in the description text.",key:"The lookup handle for this memory doc — usually a ticket ID, sometimes a free-form name. One key can have several docs attached (a plan, a spec, session notes) all retrievable together.",key_type:'"ticket" if the key is a real ticket ID, "freeform" for a name like "Spot Chart Design".',doc_type:"What kind of content this is — shapes how it should be read (a plan reads differently than raw SQL or a session summary).",related_to:"Another key this doc relates to, if any — free text, not validated against existing keys."};function ht(r){return{description:r.description??"",tags:r.tags??[],status:r.status??"",name:r.name??"",owner:r.owner??"",extends:r.extends??"",trigger_phrases:r.trigger_phrases??[],key:r.key??"",key_type:r.key_type??"",doc_type:r.doc_type??"",related_to:r.related_to??""}}class Ki extends k{constructor(){super(...arguments),this._viewMode=localStorage.getItem(ct)??"markdown",this._editing=!1,this._draft=null,this._addingFrontmatter=!1,this._renaming=!1,this._renameValue="",this._viewingAttachment=null,this._sharing=!1,this._shareUsername="",this._shareRole="member",this._shareBusy=!1,this._shareStatus=null}static{this.properties={selected:{attribute:!1},onChanged:{attribute:!1},facets:{attribute:!1},onTagClick:{attribute:!1},onFolderClick:{attribute:!1},onDateClick:{attribute:!1},onKeyClick:{attribute:!1},onGone:{attribute:!1},_doc:{state:!0},_viewMode:{state:!0},_editing:{state:!0},_draft:{state:!0},_addingFrontmatter:{state:!0},_renaming:{state:!0},_renameValue:{state:!0},_viewingAttachment:{state:!0},_sharing:{state:!0},_shareUsername:{state:!0},_shareRole:{state:!0},_shareBusy:{state:!0},_shareStatus:{state:!0}}}static{this.styles=S`
|
|
631
631
|
:host { display: block; padding: 16px; }
|
|
632
632
|
h2 { margin: 0 0 4px; font-size: 16px; }
|
|
633
633
|
.title-row {
|
|
@@ -999,15 +999,15 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
|
|
|
999
999
|
}
|
|
1000
1000
|
.share-links-row { display: flex; gap: 6px; }
|
|
1001
1001
|
.share-status { font-size: 11px; opacity: 0.75; }
|
|
1002
|
-
`}updated(e){e.has("selected")&&this.selected&&(this._editing=!1,this._addingFrontmatter=!1,this._renaming=!1,this._viewingAttachment=null,this.#e(),this.scrollTop=0)}async#e(){const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);this._doc=s.ok?await s.json():null,await this.updateComplete,this.shadowRoot?.querySelector(".markdown-body")?.scrollTo(0,0),this.shadowRoot?.querySelector("pre")?.scrollTo(0,0)}async refresh(){if(!this.selected||this._editing||this._addingFrontmatter||this._renaming)return;const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);if(!s.ok)return
|
|
1002
|
+
`}updated(e){e.has("selected")&&this.selected&&(this._editing=!1,this._addingFrontmatter=!1,this._renaming=!1,this._viewingAttachment=null,this.#e(),this.scrollTop=0)}async#e(){const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);this._doc=s.ok?await s.json():null,await this.updateComplete,this.shadowRoot?.querySelector(".markdown-body")?.scrollTo(0,0),this.shadowRoot?.querySelector("pre")?.scrollTo(0,0)}async refresh(){if(!this.selected||this._editing||this._addingFrontmatter||this._renaming)return;const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);if(!s.ok){this._doc=null,this.onGone?.();return}const n=(this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre"))?.scrollTop??0;this._doc=await s.json(),await this.updateComplete;const o=this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre");o&&(o.scrollTop=n)}#t(){this._doc?.source_path&&navigator.clipboard?.writeText(this._doc.source_path)}#s(e){this._viewMode=e,localStorage.setItem(ct,e)}async#n(){const{table:e,id:t}=this.selected,s=!this._doc?.deprecated;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/deprecated`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({deprecated:s})}),await this.#e(),this.onChanged?.()}async#r(){const{table:e,id:t}=this.selected,s=!this._doc?.paused;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/paused`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({paused:s})}),await this.#e(),this.onChanged?.()}async#p(e){const{table:t,id:s}=this.selected,i=await e.arrayBuffer(),n=await fetch(`/api/entries/${t}/${encodeURIComponent(s)}/attachments?filename=${encodeURIComponent(e.name)}`,{method:"POST",headers:{"Content-Type":"application/octet-stream"},body:i});if(!n.ok){const{error:o}=await n.json().catch(()=>({error:`upload failed (${n.status})`}));window.alert(o);return}await this.#e(),this.onChanged?.()}#l(e){const t=e.currentTarget,s=t.files?.[0];t.value="",s&&this.#p(s)}async#i(e){if(!window.confirm(`Remove attachment "${e}"? This can't be undone.`))return;const{table:t,id:s}=this.selected;await fetch(`/api/entries/${t}/${encodeURIComponent(s)}/attachments/${encodeURIComponent(e)}`,{method:"DELETE"}),this._viewingAttachment?.filename===e&&(this._viewingAttachment=null),await this.#e(),this.onChanged?.()}#a(){this._sharing=!0,this._shareUsername="",this._shareRole="member",this._shareStatus=null}#g(){this._sharing=!1,this._shareStatus=null}async#v(){if(!this.selected||!this._shareUsername.trim())return;const{table:e,id:t}=this.selected;this._shareBusy=!0,this._shareStatus=null;try{const s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/share`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:this._shareUsername.trim(),role:this._shareRole})}),i=await s.json().catch(()=>({}));this._shareStatus=s.ok?`Shared with ${this._shareUsername.trim()}.`:`Share failed: ${i.error??s.statusText}`,s.ok&&(this._shareUsername="")}finally{this._shareBusy=!1}}async#u(e){if(!this.selected)return;const{table:t,id:s}=this.selected;this._shareBusy=!0,this._shareStatus=null;try{const i=await fetch(`/api/entries/${t}/${encodeURIComponent(s)}/${e}`,{method:"POST"}),n=await i.json().catch(()=>({}));if(!i.ok){this._shareStatus=`Failed to create link: ${n.error??i.statusText}`;return}const o=e==="share-link"?"shareToken":"publicToken",a=new URL(window.location.href);a.search=`?${o}=${encodeURIComponent(n.token)}`;const c=a.toString();try{await navigator.clipboard?.writeText(c),this._shareStatus=`${e==="share-link"?"Share":"Public"} link copied to clipboard.`}catch{this._shareStatus=`Link: ${c}`}}finally{this._shareBusy=!1}}async#o(){if(!window.confirm("Delete this doc? This can't be undone."))return;const{table:e,id:t}=this.selected;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"DELETE"}),this._doc=null,this.onChanged?.()}#b(){this._doc&&(this._draft=ht(this._doc),this._editing=!0,this._addingFrontmatter=!1)}#k(){this._doc&&(this._draft=ht(this._doc),this._addingFrontmatter=!0,this._editing=!1)}#w(e){this._draft&&(this._draft={...this._draft,doc_type:e},this._addingFrontmatter=!1,this._editing=!0)}#m(){this._editing=!1,this._addingFrontmatter=!1,this._draft=null}#d(e){this._draft&&(this._draft={...this._draft,...e})}#x(e){if(!this._draft)return;const t=this._draft.tags.includes(e)?this._draft.tags.filter(s=>s!==e):[...this._draft.tags,e];this.#d({tags:t})}#$(e){if(!this._draft)return;const t=this._draft.trigger_phrases.includes(e)?this._draft.trigger_phrases.filter(s=>s!==e):[...this._draft.trigger_phrases,e];this.#d({trigger_phrases:t})}async#h(){if(!this._draft||!this.selected)return;const{table:e,id:t}=this.selected,s=e==="skills",i={description:this._draft.description,tags:this._draft.tags,status:this._draft.status};s?(i.owner=this._draft.owner||null,i.extends=this._draft.extends||null,i.trigger_phrases=this._draft.trigger_phrases):(i.key=this._draft.key,i.key_type=this._draft.key_type,i.doc_type=this._draft.doc_type,i.related_to=this._draft.related_to||null);const n=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({frontmatter:i})});if(!n.ok){const o=await n.json().catch(()=>({}));window.alert(`Save failed: ${o.error??n.statusText}`);return}this._editing=!1,this._draft=null,await this.#e(),this.onChanged?.()}async#y(){if(!this.selected||!this._doc||this.selected.table!=="memory_docs")return;const{table:e,id:t}=this.selected;if(!window.confirm(`Delete frontmatter for "${this._doc.key}"?
|
|
1003
1003
|
|
|
1004
|
-
This removes the doc's key, tags, and status — it drops out of key-based lookup and full-text search, and becomes a plain unmanaged file, until frontmatter is added again.`))return;const i=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/frontmatter`,{method:"DELETE"});if(!i.ok){const n=await i.json().catch(()=>({}));window.alert(`Delete failed: ${n.error??i.statusText}`);return}this._doc=null,this.selected=null,this.onChanged?.()}#_(){if(!this._doc||!this.selected)return;const e=this.selected.table==="skills";this._renameValue=e?this._doc.name??"":this._doc.source_path.split("/").pop()??"",this._renaming=!0}async#
|
|
1004
|
+
This removes the doc's key, tags, and status — it drops out of key-based lookup and full-text search, and becomes a plain unmanaged file, until frontmatter is added again.`))return;const i=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/frontmatter`,{method:"DELETE"});if(!i.ok){const n=await i.json().catch(()=>({}));window.alert(`Delete failed: ${n.error??i.statusText}`);return}this._doc=null,this.selected=null,this.onChanged?.()}#_(){if(!this._doc||!this.selected)return;const e=this.selected.table==="skills";this._renameValue=e?this._doc.name??"":this._doc.source_path.split("/").pop()??"",this._renaming=!0}async#f(){if(!this._doc||!this.selected||!this._renameValue.trim())return;const e=this.selected.table==="skills",t=this._renameValue.trim(),s=e?this._doc.name:this._doc.source_path.split("/").pop();if(t===s){this._renaming=!1;return}const i=e?await fetch(`/api/entries/skills/${encodeURIComponent(this._doc.name)}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({new_name:t})}):await fetch(`/api/entries/memory_docs/${encodeURIComponent(this.selected.id)}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({new_filename:t})});if(!i.ok){const n=await i.json().catch(()=>({}));window.alert(`Rename failed: ${n.error??i.statusText}`);return}if(this._renaming=!1,e)this.selected={table:"skills",id:t};else{const n=await i.json();this.selected={table:"memory_docs",id:n.source_path}}await this.#e(),this.onChanged?.()}#T(){return l`
|
|
1005
1005
|
<div class="edit-form">
|
|
1006
1006
|
<div class="hint">What kind of doc is this? This shapes which fields apply next.</div>
|
|
1007
1007
|
<div class="field">
|
|
1008
1008
|
<label>doc_type <help-tooltip .text=${$.doc_type}></help-tooltip></label>
|
|
1009
1009
|
<select
|
|
1010
|
-
@change=${e=>this
|
|
1010
|
+
@change=${e=>this.#w(e.target.value)}
|
|
1011
1011
|
>
|
|
1012
1012
|
<option value="" selected disabled>Choose…</option>
|
|
1013
1013
|
${dt.map(e=>l`<option value=${e}>${e}</option>`)}
|
|
@@ -1017,7 +1017,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1017
1017
|
<button class="cancel" @click=${()=>this.#m()}>Cancel</button>
|
|
1018
1018
|
</div>
|
|
1019
1019
|
</div>
|
|
1020
|
-
`}#
|
|
1020
|
+
`}#E(e){const t=this._draft,s=this.facets;return l`
|
|
1021
1021
|
<div class="edit-form">
|
|
1022
1022
|
${e?l`
|
|
1023
1023
|
<div class="field">
|
|
@@ -1031,14 +1031,14 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1031
1031
|
<input
|
|
1032
1032
|
type="text"
|
|
1033
1033
|
.value=${t.key}
|
|
1034
|
-
@input=${i=>this.#
|
|
1034
|
+
@input=${i=>this.#d({key:i.target.value})}
|
|
1035
1035
|
/>
|
|
1036
1036
|
</div>
|
|
1037
1037
|
<div class="field">
|
|
1038
1038
|
<label>key_type <help-tooltip .text=${$.key_type}></help-tooltip></label>
|
|
1039
1039
|
<select
|
|
1040
1040
|
.value=${t.key_type}
|
|
1041
|
-
@change=${i=>this.#
|
|
1041
|
+
@change=${i=>this.#d({key_type:i.target.value})}
|
|
1042
1042
|
>
|
|
1043
1043
|
${Hi.map(i=>l`<option value=${i} ?selected=${i===t.key_type}>${i}</option>`)}
|
|
1044
1044
|
</select>
|
|
@@ -1048,7 +1048,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1048
1048
|
<label>doc_type <help-tooltip .text=${$.doc_type}></help-tooltip></label>
|
|
1049
1049
|
<select
|
|
1050
1050
|
.value=${t.doc_type}
|
|
1051
|
-
@change=${i=>this.#
|
|
1051
|
+
@change=${i=>this.#d({doc_type:i.target.value})}
|
|
1052
1052
|
>
|
|
1053
1053
|
${dt.map(i=>l`<option value=${i} ?selected=${i===t.doc_type}>${i}</option>`)}
|
|
1054
1054
|
</select>
|
|
@@ -1058,7 +1058,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1058
1058
|
<label>description <help-tooltip .text=${$.description}></help-tooltip></label>
|
|
1059
1059
|
<textarea
|
|
1060
1060
|
.value=${t.description}
|
|
1061
|
-
@input=${i=>this.#
|
|
1061
|
+
@input=${i=>this.#d({description:i.target.value})}
|
|
1062
1062
|
></textarea>
|
|
1063
1063
|
</div>
|
|
1064
1064
|
<div class="field">
|
|
@@ -1075,7 +1075,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1075
1075
|
<status-select
|
|
1076
1076
|
.options=${[...new Set([...e?qi:Bi,...s?.statuses??[]])]}
|
|
1077
1077
|
.value=${t.status}
|
|
1078
|
-
.onChange=${i=>this.#
|
|
1078
|
+
.onChange=${i=>this.#d({status:i})}
|
|
1079
1079
|
></status-select>
|
|
1080
1080
|
</div>
|
|
1081
1081
|
${e?l`
|
|
@@ -1085,7 +1085,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1085
1085
|
<input
|
|
1086
1086
|
type="text"
|
|
1087
1087
|
.value=${t.owner}
|
|
1088
|
-
@input=${i=>this.#
|
|
1088
|
+
@input=${i=>this.#d({owner:i.target.value})}
|
|
1089
1089
|
/>
|
|
1090
1090
|
</div>
|
|
1091
1091
|
<div class="field">
|
|
@@ -1093,7 +1093,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1093
1093
|
<input
|
|
1094
1094
|
type="text"
|
|
1095
1095
|
.value=${t.extends}
|
|
1096
|
-
@input=${i=>this.#
|
|
1096
|
+
@input=${i=>this.#d({extends:i.target.value})}
|
|
1097
1097
|
/>
|
|
1098
1098
|
</div>
|
|
1099
1099
|
</div>
|
|
@@ -1103,7 +1103,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1103
1103
|
.tags=${[]}
|
|
1104
1104
|
.active=${t.trigger_phrases}
|
|
1105
1105
|
.allowCreate=${!0}
|
|
1106
|
-
.onToggle=${i=>this
|
|
1106
|
+
.onToggle=${i=>this.#$(i)}
|
|
1107
1107
|
></tag-multiselect>
|
|
1108
1108
|
</div>
|
|
1109
1109
|
`:l`
|
|
@@ -1112,12 +1112,12 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1112
1112
|
<input
|
|
1113
1113
|
type="text"
|
|
1114
1114
|
.value=${t.related_to}
|
|
1115
|
-
@input=${i=>this.#
|
|
1115
|
+
@input=${i=>this.#d({related_to:i.target.value})}
|
|
1116
1116
|
/>
|
|
1117
1117
|
</div>
|
|
1118
1118
|
`}
|
|
1119
1119
|
<div class="form-actions">
|
|
1120
|
-
<button class="save" @click=${()=>this.#
|
|
1120
|
+
<button class="save" @click=${()=>this.#h()}>Save</button>
|
|
1121
1121
|
<button class="cancel" @click=${()=>this.#m()}>Cancel</button>
|
|
1122
1122
|
</div>
|
|
1123
1123
|
</div>
|
|
@@ -1133,7 +1133,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1133
1133
|
📁 ${e.folder}
|
|
1134
1134
|
</button>
|
|
1135
1135
|
</div>
|
|
1136
|
-
`}#
|
|
1136
|
+
`}#R(e,t){const s=e.created_at?ji(e.created_at):null;return l`
|
|
1137
1137
|
<dl class="info-grid">
|
|
1138
1138
|
<dt>Description</dt>
|
|
1139
1139
|
<dd class="description">${e.description||"—"}</dd>
|
|
@@ -1184,7 +1184,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1184
1184
|
>`:l`<span class="hint">unknown</span>`}
|
|
1185
1185
|
</dd>
|
|
1186
1186
|
</dl>
|
|
1187
|
-
`}#
|
|
1187
|
+
`}#C(e,t){const s=new v.Renderer,i=s.link.bind(s);return s.link=n=>{if(typeof n.href=="string"&&n.href.startsWith("attachment://")){const o=n.href.slice(13);return i({...n,href:`/api/entries/${e}/${encodeURIComponent(t)}/attachments/${encodeURIComponent(o)}`})}return i(n)},s}#P(){return l`
|
|
1188
1188
|
<div class="share-form">
|
|
1189
1189
|
<div class="share-row">
|
|
1190
1190
|
<input
|
|
@@ -1201,13 +1201,13 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1201
1201
|
<button ?disabled=${this._shareBusy||!this._shareUsername.trim()} @click=${()=>this.#v()}>Share</button>
|
|
1202
1202
|
</div>
|
|
1203
1203
|
<div class="share-links-row">
|
|
1204
|
-
<button ?disabled=${this._shareBusy} @click=${()=>this.#
|
|
1205
|
-
<button ?disabled=${this._shareBusy} @click=${()=>this.#
|
|
1204
|
+
<button ?disabled=${this._shareBusy} @click=${()=>this.#u("share-link")}>Copy share link</button>
|
|
1205
|
+
<button ?disabled=${this._shareBusy} @click=${()=>this.#u("public-link")}>Copy public link</button>
|
|
1206
1206
|
<button @click=${()=>this.#g()}>Close</button>
|
|
1207
1207
|
</div>
|
|
1208
1208
|
${this._shareStatus?l`<div class="share-status">${this._shareStatus}</div>`:b}
|
|
1209
1209
|
</div>
|
|
1210
|
-
`}#
|
|
1210
|
+
`}#z(e,t){return l`
|
|
1211
1211
|
<div class="attachments-section">
|
|
1212
1212
|
<h4>Attachments</h4>
|
|
1213
1213
|
${e.attachments?.length?l`
|
|
@@ -1237,7 +1237,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1237
1237
|
<input type="file" @change=${s=>this.#l(s)} />
|
|
1238
1238
|
</label>
|
|
1239
1239
|
</div>
|
|
1240
|
-
`}#
|
|
1240
|
+
`}#I(e,t,s){const i=document.documentElement.getAttribute("data-theme"),n=i==="light"||i==="dark"?`?theme=${i}`:"",o=`/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(s.filename)}/view${n}`,a=`/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(s.filename)}`;return l`
|
|
1241
1241
|
<div class="attachment-view-header">
|
|
1242
1242
|
<button class="back-button" title="Back to ${e.name??e.key??e.id}" @click=${()=>this._viewingAttachment=null}>
|
|
1243
1243
|
← Back
|
|
@@ -1246,20 +1246,20 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1246
1246
|
<a class="attachment-view-download" href=${a} title="Download ${s.filename}">⇩ Download</a>
|
|
1247
1247
|
</div>
|
|
1248
1248
|
${Ui(s.filename)?l`<img class="attachment-image" src=${o} alt=${s.filename} />`:l`<iframe class="attachment-frame" src=${o} title=${s.filename}></iframe>`}
|
|
1249
|
-
`}render(){if(!this.selected)return l`<div class="empty">Select an entry to view its details.</div>`;if(!this._doc)return b;const e=this._doc,t=this.selected.table==="skills",s=t&&e.folder==="builtin",i=!t&&e.has_frontmatter===!1;return this._addingFrontmatter?l`${this.#S(e,t)}${this.#
|
|
1249
|
+
`}render(){if(!this.selected)return l`<div class="empty">Select an entry to view its details.</div>`;if(!this._doc)return b;const e=this._doc,t=this.selected.table==="skills",s=t&&e.folder==="builtin",i=!t&&e.has_frontmatter===!1;return this._addingFrontmatter?l`${this.#S(e,t)}${this.#T()}`:this._editing&&this._draft?l`${this.#S(e,t)}${this.#E(t)}`:this._viewingAttachment?l`${this.#S(e,t)}${this.#I(e,this.selected.table,this._viewingAttachment)}`:l`
|
|
1250
1250
|
${this.#S(e,t)}
|
|
1251
|
-
${i?l`<div class="bare-notice">No frontmatter — this is a plain, unmanaged file.</div>`:this.#
|
|
1251
|
+
${i?l`<div class="bare-notice">No frontmatter — this is a plain, unmanaged file.</div>`:this.#R(e,t)}
|
|
1252
1252
|
${s?b:l`
|
|
1253
1253
|
<div class="actions">
|
|
1254
|
-
${i?l`<button class="primary" @click=${()=>this.#
|
|
1254
|
+
${i?l`<button class="primary" @click=${()=>this.#k()}>Add frontmatter</button>`:l`
|
|
1255
1255
|
<button @click=${()=>this.#b()}>Edit</button>
|
|
1256
1256
|
<button @click=${()=>this.#_()}>Rename</button>
|
|
1257
1257
|
<button @click=${()=>this.#n()}>${e.deprecated?"Un-deprecate":"Mark deprecated"}</button>
|
|
1258
1258
|
<button @click=${()=>this.#r()}>${e.paused?"Resume":"Pause"}</button>
|
|
1259
|
-
${t?b:l`<button class="danger" @click=${()=>this.#
|
|
1260
|
-
${e.remoteInfo?l`<button @click=${()=>this.#
|
|
1259
|
+
${t?b:l`<button class="danger" @click=${()=>this.#y()}>Delete frontmatter</button>`}
|
|
1260
|
+
${e.remoteInfo?l`<button @click=${()=>this.#a()}>Share…</button>`:b}
|
|
1261
1261
|
`}
|
|
1262
|
-
<button class="danger" @click=${()=>this.#
|
|
1262
|
+
<button class="danger" @click=${()=>this.#o()}>Delete</button>
|
|
1263
1263
|
</div>
|
|
1264
1264
|
${this._renaming?l`
|
|
1265
1265
|
<div class="rename-row">
|
|
@@ -1267,15 +1267,15 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1267
1267
|
type="text"
|
|
1268
1268
|
.value=${this._renameValue}
|
|
1269
1269
|
@input=${n=>this._renameValue=n.target.value}
|
|
1270
|
-
@keydown=${n=>n.key==="Enter"&&this.#
|
|
1270
|
+
@keydown=${n=>n.key==="Enter"&&this.#f()}
|
|
1271
1271
|
/>
|
|
1272
|
-
<button @click=${()=>this.#
|
|
1272
|
+
<button @click=${()=>this.#f()}>Save</button>
|
|
1273
1273
|
<button @click=${()=>this._renaming=!1}>Cancel</button>
|
|
1274
1274
|
</div>
|
|
1275
1275
|
`:b}
|
|
1276
|
-
${this._sharing?this.#
|
|
1276
|
+
${this._sharing?this.#P():b}
|
|
1277
1277
|
`}
|
|
1278
|
-
${this.#
|
|
1278
|
+
${this.#z(e,this.selected.table)}
|
|
1279
1279
|
<div class="view-toggle">
|
|
1280
1280
|
<button
|
|
1281
1281
|
class=${this._viewMode==="markdown"?"active":""}
|
|
@@ -1290,9 +1290,9 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1290
1290
|
Raw
|
|
1291
1291
|
</button>
|
|
1292
1292
|
</div>
|
|
1293
|
-
${this._viewMode==="markdown"?l`<div class="markdown-body">${zi(v.parse(e.body??"",{async:!1,renderer:this.#
|
|
1293
|
+
${this._viewMode==="markdown"?l`<div class="markdown-body">${zi(v.parse(e.body??"",{async:!1,renderer:this.#C(this.selected.table,e.id)}))}</div>`:l`<pre>${e.raw_file??e.body}</pre>`}
|
|
1294
1294
|
<div class="source-path" title="click to copy" @click=${()=>this.#t()}>${e.source_path}</div>
|
|
1295
|
-
`}}customElements.define("detail-panel",Ki);const L="membkt";let ge;function j(){return ge||(ge=fetch("/api/config").then(r=>r.json()).catch(()=>({folderfooMode:"off",folderfooHost:null}))),ge}class Vi extends k{static{this.properties={defaultKind:{attribute:!1},lockKind:{attribute:!1},onAdded:{attribute:!1},onCancel:{attribute:!1}}}#e=new
|
|
1295
|
+
`}}customElements.define("detail-panel",Ki);const L="membkt";let ge;function j(){return ge||(ge=fetch("/api/config").then(r=>r.json()).catch(()=>({folderfooMode:"off",folderfooHost:null}))),ge}class Vi extends k{static{this.properties={defaultKind:{attribute:!1},lockKind:{attribute:!1},onAdded:{attribute:!1},onCancel:{attribute:!1}}}#e=new p("skill");#t=new p("local");#s=new p("");#n=new p([]);#r=new p(null);#p=new p("");#l=new p("");#i=new p("");#a=new p(!1);#g=new p(!1);#v=new p(!1);#u=new p("");#o=new p("");#b=new p(!1);#k=new p("");#w=new p(!1);#m=new p("");#d=new p(!1);#x=new p(!1);#$=new p([]);#h=new p("");#y=new p("");#_=new p(!1);#f;#T=new p("mine");#E=new p([]);#S=new p(!1);#R=new p(null);static{this.styles=S`
|
|
1296
1296
|
:host { display: block; }
|
|
1297
1297
|
.backdrop {
|
|
1298
1298
|
position: fixed; inset: 0; background: var(--overlay);
|
|
@@ -1395,12 +1395,12 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1395
1395
|
.ff-folder-entry.selected { background: var(--accent); color: var(--accent-fg); }
|
|
1396
1396
|
.ff-empty { padding: 12px; opacity: 0.6; font-size: 13px; }
|
|
1397
1397
|
.ff-widget-slot { display: flex; }
|
|
1398
|
-
`}constructor(){super(),new Y(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#e.set(this.defaultKind),this.#
|
|
1398
|
+
`}constructor(){super(),new Y(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#e.set(this.defaultKind),this.#C()}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this.#f)}async#C(e){const t=new URLSearchParams;e&&t.set("path",e),this.#g.value&&t.set("hidden","1");const s=await fetch(`/api/fs/list?${t.toString()}`);if(!s.ok){this.#i.set((await s.json()).error??"failed to list directory");return}const i=await s.json();this.#s.set(i.path),this.#r.set(i.parent),this.#n.set(i.entries),this.#i.set(""),this.renderRoot.querySelector(".browser")?.scrollTo(0,0)}#P(){this.#g.set(!this.#g.value),this.#C(this.#s.value)}#z(){this.#u.set(""),this.#v.set(!0)}#I(){this.#v.set(!1),this.#u.set("")}async#N(){const e=this.#u.value.trim();if(e){this.#i.set("");try{const t=await fetch("/api/fs/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:this.#s.value,name:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to create folder");return}this.#v.set(!1),this.#u.set(""),await this.#C(this.#s.value)}catch(t){this.#i.set(t.message)}}}#j(){this.#p.set(this.#s.value),this.#l.value||this.#l.set(this.#s.value.split("/").filter(Boolean).pop()??"")}async#G(){const e=this.#p.value||this.#s.value;if(e){this.#a.set(!0),this.#i.set("");try{const t=await fetch("/api/folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#l.value||void 0,path:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to add folder");return}this.onAdded()}finally{this.#a.set(!1)}}}async#J(){if(this.#d.value)return;const{folderfooMode:e,folderfooHost:t}=await j();if(e==="off"||!t)return;let s=null;try{s=localStorage.getItem("folderfoo_token")}catch{}s&&(this.#o.set(t),this.#m.set(L),this.#w.set(!0),this.#H(s))}async#q(){if(!this.#o.value){this.#i.set("enter a server URL first");return}this.#i.set("");try{await re(()=>import(`${this.#o.value}/elements/folderfoo-profile-circle.js`),[]),this.#b.set(!0),this.#k.set(""),await this.updateComplete;const e=this.renderRoot.querySelector(".ff-widget-slot");if(e&&!e.querySelector("folderfoo-profile-circle")){const t=document.createElement("folderfoo-profile-circle");t.setAttribute("app-name","Memory Bucket"),e.appendChild(t)}this.#f=setInterval(()=>this.#B(),800),this.#B()}catch(e){this.#k.set(e.message)}}#B(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{}!e||this.#d.value||(clearInterval(this.#f),this.#H(e))}async#H(e){this.#x.set(!0),this.#i.set("");try{const t=await fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:this.#o.value,token:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to persist folderfoo session");return}this.#d.set(!0),this.#m.set(L),await this.#M()}finally{this.#x.set(!1)}}async#M(e,t){this.#_.set(!0),this.#i.set("");try{const s=new URLSearchParams({server:this.#o.value,tenantId:this.#m.value});e&&s.set("owner",e),t&&s.set("rootFolder",t);const i=await fetch(`/api/folderfoo/folders?${s.toString()}`),n=await i.json();if(!i.ok){this.#i.set(n.error??"failed to list folderfoo folders");return}this.#$.set(n)}finally{this.#_.set(!1)}}async#Q(){this.#S.set(!0),this.#i.set("");try{const e=new URLSearchParams({server:this.#o.value,tenantId:this.#m.value}),t=await fetch(`/api/folderfoo/shared-folders?${e.toString()}`),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to list folders shared with you");return}this.#E.set(s)}finally{this.#S.set(!1)}}#U(e){this.#T.set(e),this.#R.set(null),this.#h.set(""),this.#y.set(""),e==="shared"&&this.#E.value.length===0?this.#Q():e==="mine"&&this.#M()}#F(e){this.#R.set(e),this.#M(e.owner,e.path)}#O(e,t){this.#h.set(e),this.#y.set(t??""),this.#l.value||this.#l.set(e.split("/").filter(Boolean).pop()??this.#m.value)}#K(e){this.#O(e.path,e.owner)}async#V(){if(this.#h.value){this.#a.set(!0),this.#i.set("");try{const e=await fetch("/api/remote-folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#l.value||void 0,server:this.#o.value,tenantId:this.#m.value,folderPath:this.#h.value,owner:this.#y.value||void 0})}),t=await e.json();if(!e.ok){this.#i.set(t.error??"failed to connect folder");return}this.onAdded(t.kindMismatchWarning)}finally{this.#a.set(!1)}}}#W(){const e=this.#n.value;return l`
|
|
1399
1399
|
<div class="breadcrumb-row">
|
|
1400
1400
|
<div class="breadcrumb">${this.#s.value}</div>
|
|
1401
|
-
<button class="new-folder-btn" @click=${()=>this.#
|
|
1401
|
+
<button class="new-folder-btn" @click=${()=>this.#z()}>+ New folder</button>
|
|
1402
1402
|
<label class="hidden-toggle">
|
|
1403
|
-
<input type="checkbox" .checked=${this.#g.value} @change=${()=>this.#
|
|
1403
|
+
<input type="checkbox" .checked=${this.#g.value} @change=${()=>this.#P()} />
|
|
1404
1404
|
Show hidden
|
|
1405
1405
|
</label>
|
|
1406
1406
|
</div>
|
|
@@ -1409,27 +1409,27 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1409
1409
|
<input
|
|
1410
1410
|
type="text"
|
|
1411
1411
|
placeholder="Folder name"
|
|
1412
|
-
.value=${this.#
|
|
1413
|
-
@input=${t=>this.#
|
|
1414
|
-
@keydown=${t=>{t.key==="Enter"&&this.#
|
|
1412
|
+
.value=${this.#u.value}
|
|
1413
|
+
@input=${t=>this.#u.set(t.target.value)}
|
|
1414
|
+
@keydown=${t=>{t.key==="Enter"&&this.#N(),t.key==="Escape"&&this.#I()}}
|
|
1415
1415
|
/>
|
|
1416
|
-
<button @click=${()=>this.#
|
|
1417
|
-
<button @click=${()=>this.#
|
|
1416
|
+
<button @click=${()=>this.#N()}>Create</button>
|
|
1417
|
+
<button @click=${()=>this.#I()}>Cancel</button>
|
|
1418
1418
|
</div>
|
|
1419
1419
|
`:""}
|
|
1420
1420
|
<div class="browser">
|
|
1421
|
-
${this.#r.value?l`<div class="entry up" @click=${()=>this.#
|
|
1421
|
+
${this.#r.value?l`<div class="entry up" @click=${()=>this.#C(this.#r.value)}>
|
|
1422
1422
|
<span class="icon">📁</span> ..
|
|
1423
1423
|
</div>`:""}
|
|
1424
|
-
${e.length===0&&!this.#r.value?l`<div class="empty">No subdirectories here.</div>`:e.map(t=>l`<div class="entry" @click=${()=>this.#
|
|
1424
|
+
${e.length===0&&!this.#r.value?l`<div class="empty">No subdirectories here.</div>`:e.map(t=>l`<div class="entry" @click=${()=>this.#C(t.path)}>
|
|
1425
1425
|
<span class="icon">📁</span> ${t.name}
|
|
1426
1426
|
</div>`)}
|
|
1427
1427
|
</div>
|
|
1428
1428
|
<div class="footer">
|
|
1429
|
-
<button class="secondary" @click=${()=>this.#
|
|
1429
|
+
<button class="secondary" @click=${()=>this.#j()}>
|
|
1430
1430
|
Select this folder
|
|
1431
1431
|
</button>
|
|
1432
|
-
${this.#
|
|
1432
|
+
${this.#p.value?l`<div class="selected-row">Selected: <span class="path">${this.#p.value}</span></div>`:""}
|
|
1433
1433
|
<div>
|
|
1434
1434
|
<label>Folder name</label>
|
|
1435
1435
|
<input
|
|
@@ -1444,57 +1444,22 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1444
1444
|
<button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
|
|
1445
1445
|
<button
|
|
1446
1446
|
class="primary"
|
|
1447
|
-
?disabled=${!this.#
|
|
1448
|
-
@click=${()=>this.#
|
|
1447
|
+
?disabled=${!this.#p.value||this.#a.value}
|
|
1448
|
+
@click=${()=>this.#G()}
|
|
1449
1449
|
>
|
|
1450
|
-
${this.#
|
|
1450
|
+
${this.#a.value?"Adding…":"Add folder"}
|
|
1451
1451
|
</button>
|
|
1452
1452
|
</div>
|
|
1453
1453
|
</div>
|
|
1454
|
-
`}#
|
|
1454
|
+
`}#Y(){const e=this.#$.value;if(this.#w.value&&!this.#d.value)return l`
|
|
1455
1455
|
<div class="ff-body">
|
|
1456
|
-
<div class="ff-connected-row"><span class="ff-connected-dot"></span> Already signed in to ${this.#
|
|
1456
|
+
<div class="ff-connected-row"><span class="ff-connected-dot"></span> Already signed in to ${this.#o.value} — connecting…</div>
|
|
1457
1457
|
${this.#i.value?l`<div class="error">${this.#i.value}</div>`:""}
|
|
1458
1458
|
<div class="actions">
|
|
1459
1459
|
<button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
|
|
1460
1460
|
</div>
|
|
1461
1461
|
</div>
|
|
1462
|
-
|
|
1463
|
-
<div class="ff-body">
|
|
1464
|
-
<div class="ff-connected-row"><span class="ff-connected-dot"></span> Connected to ${this.#a.value}</div>
|
|
1465
|
-
${e.length>0?l`
|
|
1466
|
-
<div class="ff-folder-list">
|
|
1467
|
-
${e.map(t=>l`<div
|
|
1468
|
-
class="ff-folder-entry ${this.#f.value===t.path?"selected":""}"
|
|
1469
|
-
@click=${()=>this.#j(t.path)}
|
|
1470
|
-
>
|
|
1471
|
-
${t.path}
|
|
1472
|
-
</div>`)}
|
|
1473
|
-
</div>
|
|
1474
|
-
`:this.#w.value?l`<div class="ff-hint">Loading folders…</div>`:l`<div class="ff-empty">No folders found.</div>`}
|
|
1475
|
-
${this.#f.value?l`<div class="selected-row">Selected: <span class="path">${this.#f.value}</span></div>`:""}
|
|
1476
|
-
<div>
|
|
1477
|
-
<label>Folder name</label>
|
|
1478
|
-
<input
|
|
1479
|
-
type="text"
|
|
1480
|
-
.value=${this.#l.value}
|
|
1481
|
-
placeholder="e.g. team-qa"
|
|
1482
|
-
@input=${t=>this.#l.set(t.target.value)}
|
|
1483
|
-
/>
|
|
1484
|
-
</div>
|
|
1485
|
-
${this.#i.value?l`<div class="error">${this.#i.value}</div>`:""}
|
|
1486
|
-
<div class="actions">
|
|
1487
|
-
<button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
|
|
1488
|
-
<button
|
|
1489
|
-
class="primary"
|
|
1490
|
-
?disabled=${!this.#f.value||this.#o.value}
|
|
1491
|
-
@click=${()=>this.#q()}
|
|
1492
|
-
>
|
|
1493
|
-
${this.#o.value?"Connecting…":"Connect folder"}
|
|
1494
|
-
</button>
|
|
1495
|
-
</div>
|
|
1496
|
-
</div>
|
|
1497
|
-
`:l`
|
|
1462
|
+
`;if(!this.#d.value)return l`
|
|
1498
1463
|
<div class="ff-body">
|
|
1499
1464
|
<div class="ff-hint">
|
|
1500
1465
|
Sign in to a folderfoo server to mount one of your folders (or a folder shared with you) as a
|
|
@@ -1505,11 +1470,11 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1505
1470
|
<label>Server URL</label>
|
|
1506
1471
|
<input
|
|
1507
1472
|
type="text"
|
|
1508
|
-
.value=${this.#
|
|
1473
|
+
.value=${this.#o.value}
|
|
1509
1474
|
placeholder="https://folderfoo.example.com"
|
|
1510
1475
|
?disabled=${this.#b.value}
|
|
1511
|
-
@input=${
|
|
1512
|
-
@keydown=${
|
|
1476
|
+
@input=${i=>this.#o.set(i.target.value)}
|
|
1477
|
+
@keydown=${i=>i.key==="Enter"&&this.#q()}
|
|
1513
1478
|
/>
|
|
1514
1479
|
</div>
|
|
1515
1480
|
${this.#b.value?l`
|
|
@@ -1518,16 +1483,98 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1518
1483
|
${this.#x.value?l`<div class="ff-hint">Finishing connection…</div>`:""}
|
|
1519
1484
|
`:l`
|
|
1520
1485
|
<div class="actions" style="justify-content: flex-start; margin-top: 0;">
|
|
1521
|
-
<button class="secondary" @click=${()=>this.#
|
|
1486
|
+
<button class="secondary" @click=${()=>this.#q()}>Continue</button>
|
|
1522
1487
|
</div>
|
|
1523
1488
|
`}
|
|
1524
|
-
${this.#
|
|
1489
|
+
${this.#k.value?l`<div class="error">${this.#k.value}</div>`:""}
|
|
1525
1490
|
${this.#i.value?l`<div class="error">${this.#i.value}</div>`:""}
|
|
1526
1491
|
<div class="actions">
|
|
1527
1492
|
<button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
|
|
1528
1493
|
</div>
|
|
1529
1494
|
</div>
|
|
1530
|
-
|
|
1495
|
+
`;const t=this.#E.value,s=this.#R.value;return l`
|
|
1496
|
+
<div class="ff-body">
|
|
1497
|
+
<div class="ff-connected-row"><span class="ff-connected-dot"></span> Connected to ${this.#o.value}</div>
|
|
1498
|
+
<div class="kind-toggle">
|
|
1499
|
+
<button
|
|
1500
|
+
class=${this.#T.value==="mine"?"active":""}
|
|
1501
|
+
@click=${()=>this.#U("mine")}
|
|
1502
|
+
>
|
|
1503
|
+
My folders
|
|
1504
|
+
</button>
|
|
1505
|
+
<button
|
|
1506
|
+
class=${this.#T.value==="shared"?"active":""}
|
|
1507
|
+
@click=${()=>this.#U("shared")}
|
|
1508
|
+
>
|
|
1509
|
+
Shared with me
|
|
1510
|
+
</button>
|
|
1511
|
+
</div>
|
|
1512
|
+
${this.#T.value==="mine"?l`
|
|
1513
|
+
${e.length>0?l`
|
|
1514
|
+
<div class="ff-folder-list">
|
|
1515
|
+
${e.map(i=>l`<div
|
|
1516
|
+
class="ff-folder-entry ${this.#h.value===i.path&&!this.#y.value?"selected":""}"
|
|
1517
|
+
@click=${()=>this.#O(i.path)}
|
|
1518
|
+
>
|
|
1519
|
+
${i.path}
|
|
1520
|
+
</div>`)}
|
|
1521
|
+
</div>
|
|
1522
|
+
`:this.#_.value?l`<div class="ff-hint">Loading folders…</div>`:l`<div class="ff-empty">No folders found.</div>`}
|
|
1523
|
+
`:s?l`
|
|
1524
|
+
<div class="breadcrumb-row">
|
|
1525
|
+
<div class="breadcrumb">${s.owner}:${s.path}</div>
|
|
1526
|
+
<button class="new-folder-btn" @click=${()=>this.#U("shared")}>← Back</button>
|
|
1527
|
+
</div>
|
|
1528
|
+
<div
|
|
1529
|
+
class="ff-folder-entry ${this.#h.value===s.path&&this.#y.value===s.owner?"selected":""}"
|
|
1530
|
+
@click=${()=>this.#K(s)}
|
|
1531
|
+
>
|
|
1532
|
+
(connect this folder itself)
|
|
1533
|
+
</div>
|
|
1534
|
+
${e.length>0?l`
|
|
1535
|
+
<div class="ff-folder-list">
|
|
1536
|
+
${e.map(i=>l`<div
|
|
1537
|
+
class="ff-folder-entry ${this.#h.value===i.path&&this.#y.value===s.owner?"selected":""}"
|
|
1538
|
+
@click=${()=>this.#O(i.path,s.owner)}
|
|
1539
|
+
>
|
|
1540
|
+
${i.path}
|
|
1541
|
+
</div>`)}
|
|
1542
|
+
</div>
|
|
1543
|
+
`:this.#_.value?l`<div class="ff-hint">Loading folders…</div>`:l`<div class="ff-empty">No subfolders.</div>`}
|
|
1544
|
+
`:l`
|
|
1545
|
+
${t.length>0?l`
|
|
1546
|
+
<div class="ff-folder-list">
|
|
1547
|
+
${t.map(i=>l`<div class="ff-folder-entry" @click=${()=>this.#F(i)}>
|
|
1548
|
+
${i.path} <span style="opacity:0.6">— shared by ${i.owner}${i.role==="member"?" (read-only)":""}</span>
|
|
1549
|
+
</div>`)}
|
|
1550
|
+
</div>
|
|
1551
|
+
`:this.#S.value?l`<div class="ff-hint">Loading shared folders…</div>`:l`<div class="ff-empty">No one has shared a folder with you yet.</div>`}
|
|
1552
|
+
`}
|
|
1553
|
+
${this.#h.value?l`<div class="selected-row">
|
|
1554
|
+
Selected: <span class="path">${this.#y.value?`${this.#y.value}:`:""}${this.#h.value}</span>
|
|
1555
|
+
</div>`:""}
|
|
1556
|
+
<div>
|
|
1557
|
+
<label>Folder name</label>
|
|
1558
|
+
<input
|
|
1559
|
+
type="text"
|
|
1560
|
+
.value=${this.#l.value}
|
|
1561
|
+
placeholder="e.g. team-qa"
|
|
1562
|
+
@input=${i=>this.#l.set(i.target.value)}
|
|
1563
|
+
/>
|
|
1564
|
+
</div>
|
|
1565
|
+
${this.#i.value?l`<div class="error">${this.#i.value}</div>`:""}
|
|
1566
|
+
<div class="actions">
|
|
1567
|
+
<button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
|
|
1568
|
+
<button
|
|
1569
|
+
class="primary"
|
|
1570
|
+
?disabled=${!this.#h.value||this.#a.value}
|
|
1571
|
+
@click=${()=>this.#V()}
|
|
1572
|
+
>
|
|
1573
|
+
${this.#a.value?"Connecting…":"Connect folder"}
|
|
1574
|
+
</button>
|
|
1575
|
+
</div>
|
|
1576
|
+
</div>
|
|
1577
|
+
`}render(){return l`
|
|
1531
1578
|
<div class="backdrop" @click=${e=>e.target===e.currentTarget&&this.onCancel()}>
|
|
1532
1579
|
<div class="modal">
|
|
1533
1580
|
<div class="header"><h2>Add a folder</h2></div>
|
|
@@ -1553,12 +1600,12 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1553
1600
|
</button>
|
|
1554
1601
|
<button
|
|
1555
1602
|
class=${this.#t.value==="folderfoo"?"active":""}
|
|
1556
|
-
@click=${()=>{this.#t.set("folderfoo"),this.#
|
|
1603
|
+
@click=${()=>{this.#t.set("folderfoo"),this.#J()}}
|
|
1557
1604
|
>
|
|
1558
1605
|
Connect folderfoo
|
|
1559
1606
|
</button>
|
|
1560
1607
|
</div>
|
|
1561
|
-
${this.#t.value==="local"?this.#
|
|
1608
|
+
${this.#t.value==="local"?this.#W():this.#Y()}
|
|
1562
1609
|
</div>
|
|
1563
1610
|
</div>
|
|
1564
1611
|
`}}customElements.define("add-folder-modal",Vi);function pt(r){const e=Date.now()-r,t=Math.floor(e/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;const s=Math.floor(t/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}class Wi extends k{static{this.properties={channels:{attribute:!1},selected:{attribute:!1},detail:{attribute:!1},loading:{attribute:!1},onSelect:{attribute:!1},onRefresh:{attribute:!1}}}static{this.styles=S`
|
|
@@ -1645,7 +1692,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1645
1692
|
${this.#e()}
|
|
1646
1693
|
</div>
|
|
1647
1694
|
${this.#t()}
|
|
1648
|
-
`}}customElements.define("channel-view",Wi);function Zi(r){const e=new Map;for(const t of r){const s=t.tags.length>0?t.tags:[null];for(const i of s){const n=e.get(i);n?n.push(t):e.set(i,[t])}}return[...e.entries()].map(([t,s])=>({tag:t,items:s})).sort((t,s)=>t.tag===null?1:s.tag===null?-1:t.tag.localeCompare(s.tag))}function Gi(r,e){const t=new Map;for(const n of r){const o=t.get(n.folder);o?o.push(n):t.set(n.folder,[n])}const s=[],i=[];for(const n of e){const o=t.get(n.name);if(!o)continue;const a={folder:n,tagGroups:[{tag:null,items:o}]};(n.remote?i:s).push(a)}return{local:s,remote:i}}const Vt="mem-bucket-folder-view-mode",Wt="mem-bucket-folder-view-expanded",ut="mem-bucket-folder-view-tree-split-pct",ft="mem-bucket-folder-view-list-split-pct",gt=12,bt=40,mt=20,vt=80;function xt(r,e,t,s){const i=Number(localStorage.getItem(r));return Number.isFinite(i)&&i>=t&&i<=s?i:e}const Ji=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],Qi=[{value:"a",label:"Folder tree"},{value:"b",label:"Breadcrumb drill-down"},{value:"c",label:"Tag → Name"}];function Yi(){const r=localStorage.getItem(Vt);return r==="a"||r==="b"||r==="c"?r:"a"}function Xi(){try{const r=localStorage.getItem(Wt);if(!r)return new Set;const e=JSON.parse(r);return Array.isArray(e)?new Set(e.map(String)):new Set}catch{return new Set}}function yt(r){localStorage.setItem(Wt,JSON.stringify([...r]))}class er extends k{static{this.properties={entries:{attribute:!1},allFolders:{attribute:!1},facets:{attribute:!1},typeFilter:{attribute:!1},onTypeChange:{attribute:!1},onChanged:{attribute:!1},onDateClick:{attribute:!1},onKeyClick:{attribute:!1}}}#e=new
|
|
1695
|
+
`}}customElements.define("channel-view",Wi);function Zi(r){const e=new Map;for(const t of r){const s=t.tags.length>0?t.tags:[null];for(const i of s){const n=e.get(i);n?n.push(t):e.set(i,[t])}}return[...e.entries()].map(([t,s])=>({tag:t,items:s})).sort((t,s)=>t.tag===null?1:s.tag===null?-1:t.tag.localeCompare(s.tag))}function Gi(r,e){const t=new Map;for(const n of r){const o=t.get(n.folder);o?o.push(n):t.set(n.folder,[n])}const s=[],i=[];for(const n of e){const o=t.get(n.name);if(!o)continue;const a={folder:n,tagGroups:[{tag:null,items:o}]};(n.remote?i:s).push(a)}return{local:s,remote:i}}const Vt="mem-bucket-folder-view-mode",Wt="mem-bucket-folder-view-expanded",ut="mem-bucket-folder-view-tree-split-pct",ft="mem-bucket-folder-view-list-split-pct",gt=12,bt=40,mt=20,vt=80;function xt(r,e,t,s){const i=Number(localStorage.getItem(r));return Number.isFinite(i)&&i>=t&&i<=s?i:e}const Ji=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],Qi=[{value:"a",label:"Folder tree"},{value:"b",label:"Breadcrumb drill-down"},{value:"c",label:"Tag → Name"}];function Yi(){const r=localStorage.getItem(Vt);return r==="a"||r==="b"||r==="c"?r:"a"}function Xi(){try{const r=localStorage.getItem(Wt);if(!r)return new Set;const e=JSON.parse(r);return Array.isArray(e)?new Set(e.map(String)):new Set}catch{return new Set}}function yt(r){localStorage.setItem(Wt,JSON.stringify([...r]))}class er extends k{static{this.properties={entries:{attribute:!1},allFolders:{attribute:!1},facets:{attribute:!1},typeFilter:{attribute:!1},onTypeChange:{attribute:!1},onChanged:{attribute:!1},onDateClick:{attribute:!1},onKeyClick:{attribute:!1}}}#e=new p(Yi());#t=new p(Xi());#s=new p([]);#n=new p(null);#r=new p(null);#p=new p(xt(ut,20,gt,bt));#l=new p(xt(ft,40,mt,vt));#i=new p(null);#a=e=>this.#b(e);#g=()=>this.#k();static{this.styles=S`
|
|
1649
1696
|
:host { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
|
|
1650
1697
|
/* padding-right reserves room for mem-bucket-app's absolutely-positioned .header-toolbar
|
|
1651
1698
|
overlay (rendered outside this element entirely - see its own comment), which lines up with
|
|
@@ -1724,8 +1771,8 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1724
1771
|
border: none; background: none; color: inherit; width: 100%; text-align: left; box-sizing: border-box;
|
|
1725
1772
|
}
|
|
1726
1773
|
.folder-card:hover { background: var(--hover); }
|
|
1727
|
-
`}constructor(){super(),new Y(this)}#v(e){this.#e.set(e),localStorage.setItem(Vt,e),this.#t.set(new Set),yt(new Set),this.#s.set([]),this.#n.set(null),this.#r.set(null)}#
|
|
1728
|
-
<button class="node ${e.folder.remote?"remote":""} ${n?"active":""}" @click=${()=>this
|
|
1774
|
+
`}constructor(){super(),new Y(this)}#v(e){this.#e.set(e),localStorage.setItem(Vt,e),this.#t.set(new Set),yt(new Set),this.#s.set([]),this.#n.set(null),this.#r.set(null)}#u(e){this.#v(e.target.value)}#o(e,t){t.preventDefault(),this.#i.set(e),document.addEventListener("pointermove",this.#a),document.addEventListener("pointerup",this.#g)}#b(e){const t=this.#i.value;if(!t)return;const s=this.renderRoot.querySelector(".body-region");if(!s)return;const i=s.getBoundingClientRect(),n=(e.clientX-i.left)/i.width*100;if(t==="tree")this.#p.set(Math.min(bt,Math.max(gt,n)));else{const o=100-this.#p.value,a=o>0?(n-this.#p.value)/o*100:0;this.#l.set(Math.min(vt,Math.max(mt,a)))}}#k(){const e=this.#i.value;this.#i.set(null),document.removeEventListener("pointermove",this.#a),document.removeEventListener("pointerup",this.#g),e==="tree"?localStorage.setItem(ut,String(this.#p.value)):e==="list"&&localStorage.setItem(ft,String(this.#l.value))}#w(e){const t=new Set(this.#t.value);t.has(e)?t.delete(e):t.add(e),this.#t.set(t),yt(t)}#m(e,t){this.#n.set({folder:e,tag:t})}#d(e){this.#n.set(null),this.#r.set({table:e._table,id:e.id})}#x(e){this.#r.set({table:e._table,id:e.id})}#$(e,t){const s=this.#t.value.has(t),i=e.tagGroups.reduce((o,a)=>o+a.items.length,0),n=this.#n.value?.folder===e.folder.name&&this.#n.value?.tag===null;return l`
|
|
1775
|
+
<button class="node ${e.folder.remote?"remote":""} ${n?"active":""}" @click=${()=>this.#w(t)}>
|
|
1729
1776
|
<span class="caret">${s?"▾":"▸"}</span>
|
|
1730
1777
|
<span class="icon">${e.folder.remote?"☁":"📁"}</span>
|
|
1731
1778
|
<span
|
|
@@ -1735,19 +1782,19 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1735
1782
|
>
|
|
1736
1783
|
<span class="count">${i}</span>
|
|
1737
1784
|
</button>
|
|
1738
|
-
`}#
|
|
1785
|
+
`}#h(e){const t=(s,i)=>s.length===0?"":l`
|
|
1739
1786
|
<div class="section-header">${i}</div>
|
|
1740
1787
|
${s.map(n=>{const o=`folder:${n.folder.name}`,a=this.#t.value.has(o),c=n.tagGroups[0]?.items??[];return l`
|
|
1741
|
-
${this
|
|
1788
|
+
${this.#$(n,o)}
|
|
1742
1789
|
${a?c.map(d=>l`
|
|
1743
|
-
<button class="node indent-1" @click=${()=>this.#
|
|
1790
|
+
<button class="node indent-1" @click=${()=>this.#d(d)}>
|
|
1744
1791
|
<span class="caret"></span>
|
|
1745
1792
|
<span class="icon">${d._table==="skills"?"⚡":"📝"}</span>
|
|
1746
1793
|
<span class="label">${d.name}</span>
|
|
1747
1794
|
</button>
|
|
1748
1795
|
`):""}
|
|
1749
1796
|
`})}
|
|
1750
|
-
`;return e.local.length===0&&e.remote.length===0?l`<div class="empty">No entries.</div>`:l`${t(e.local,"Folders")}${t(e.remote,"Remote")}`}#
|
|
1797
|
+
`;return e.local.length===0&&e.remote.length===0?l`<div class="empty">No entries.</div>`:l`${t(e.local,"Folders")}${t(e.remote,"Remote")}`}#y(e){const t=this.#s.value;if(t.length===0){const o=[...e.local,...e.remote];return o.length===0?l`<div class="empty">No entries.</div>`:o.map(a=>{const c=a.tagGroups.reduce((d,u)=>d+u.items.length,0);return l`
|
|
1751
1798
|
<button
|
|
1752
1799
|
class="folder-card ${a.folder.remote?"remote":""}"
|
|
1753
1800
|
@click=${()=>this.#s.set([a.folder.name])}
|
|
@@ -1763,14 +1810,14 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1763
1810
|
<span>${s}</span>
|
|
1764
1811
|
</div>
|
|
1765
1812
|
${n.length===0?l`<div class="empty">No entries in this folder.</div>`:n.map(o=>l`
|
|
1766
|
-
<button class="node" @click=${()=>this.#
|
|
1813
|
+
<button class="node" @click=${()=>this.#d(o)}>
|
|
1767
1814
|
<span class="caret"></span>
|
|
1768
1815
|
<span class="icon">${o._table==="skills"?"⚡":"📝"}</span>
|
|
1769
1816
|
<span class="label">${o.name}</span>
|
|
1770
1817
|
</button>
|
|
1771
1818
|
`)}
|
|
1772
1819
|
`}#_(e){return e.length===0?l`<div class="empty">No entries.</div>`:e.map(t=>{const s=`tag:${t.tag??""}`,i=this.#t.value.has(s),n=this.#n.value?.folder===null&&this.#n.value?.tag===t.tag;return l`
|
|
1773
|
-
<button class="node ${n?"active":""}" @click=${()=>this
|
|
1820
|
+
<button class="node ${n?"active":""}" @click=${()=>this.#w(s)}>
|
|
1774
1821
|
<span class="caret">${i?"▾":"▸"}</span>
|
|
1775
1822
|
<span class="icon">${t.tag===null?"":"🏷"}</span>
|
|
1776
1823
|
<span
|
|
@@ -1781,17 +1828,17 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1781
1828
|
<span class="count">${t.items.length}</span>
|
|
1782
1829
|
</button>
|
|
1783
1830
|
${i?t.items.map(o=>l`
|
|
1784
|
-
<button class="node indent-1" @click=${()=>this.#
|
|
1831
|
+
<button class="node indent-1" @click=${()=>this.#d(o)}>
|
|
1785
1832
|
<span class="caret"></span>
|
|
1786
1833
|
<span class="icon">${o._table==="skills"?"⚡":"📝"}</span>
|
|
1787
1834
|
<span class="label">${o.name}</span>
|
|
1788
1835
|
<span class="count">${o.folder}</span>
|
|
1789
1836
|
</button>
|
|
1790
1837
|
`):""}
|
|
1791
|
-
`})}#
|
|
1838
|
+
`})}#f(){const e=this.#n.value;return e?(this.entries??[]).filter(s=>(e.folder===null||s.folder===e.folder)&&(e.tag===null||s.tags.includes(e.tag))):[]}render(){const e=this.#e.value,t=this.entries??[],s=this.allFolders??[],i=e==="c"?null:Gi(t,s),n=e==="c"?Zi(t):null,o=this.#n.value,a=this.#r.value;return l`
|
|
1792
1839
|
<div class="mode-row">
|
|
1793
1840
|
<span class="filter-label">View:</span>
|
|
1794
|
-
<select .value=${e} @change=${c=>this.#
|
|
1841
|
+
<select .value=${e} @change=${c=>this.#u(c)}>
|
|
1795
1842
|
${Qi.map(c=>l`<option value=${c.value}>${c.label}</option>`)}
|
|
1796
1843
|
</select>
|
|
1797
1844
|
<div class="type-toggle">
|
|
@@ -1808,18 +1855,18 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1808
1855
|
<div class="body-region">
|
|
1809
1856
|
<div
|
|
1810
1857
|
class="tree-rail"
|
|
1811
|
-
style=${`width: ${this.#
|
|
1858
|
+
style=${`width: ${this.#p.value}%; border-right: 1px solid var(--border);`}
|
|
1812
1859
|
>
|
|
1813
|
-
${e==="a"?this.#
|
|
1860
|
+
${e==="a"?this.#h(i):e==="b"?this.#y(i):this.#_(n)}
|
|
1814
1861
|
</div>
|
|
1815
1862
|
${o?l`
|
|
1816
1863
|
<div
|
|
1817
1864
|
class="splitter ${this.#i.value==="tree"?"dragging":""}"
|
|
1818
|
-
@pointerdown=${c=>this.#
|
|
1865
|
+
@pointerdown=${c=>this.#o("tree",c)}
|
|
1819
1866
|
></div>
|
|
1820
1867
|
<result-list
|
|
1821
1868
|
style=${`width: ${this.#l.value}%; border-right: 1px solid var(--border);`}
|
|
1822
|
-
.results=${this.#
|
|
1869
|
+
.results=${this.#f()}
|
|
1823
1870
|
.showFolder=${!0}
|
|
1824
1871
|
.onSelect=${c=>this.#x(c)}
|
|
1825
1872
|
.selectedIds=${new Set}
|
|
@@ -1828,12 +1875,12 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1828
1875
|
></result-list>
|
|
1829
1876
|
<div
|
|
1830
1877
|
class="splitter ${this.#i.value==="list"?"dragging":""}"
|
|
1831
|
-
@pointerdown=${c=>this.#
|
|
1878
|
+
@pointerdown=${c=>this.#o("list",c)}
|
|
1832
1879
|
></div>
|
|
1833
1880
|
`:l`
|
|
1834
1881
|
<div
|
|
1835
1882
|
class="splitter ${this.#i.value==="tree"?"dragging":""}"
|
|
1836
|
-
@pointerdown=${c=>this.#
|
|
1883
|
+
@pointerdown=${c=>this.#o("tree",c)}
|
|
1837
1884
|
></div>
|
|
1838
1885
|
`}
|
|
1839
1886
|
${a?l`
|
|
@@ -2017,7 +2064,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
2017
2064
|
`}render(){const e=this.items??[],t=this.#e(e),s=this.lastRefreshSummary;return l`
|
|
2018
2065
|
<div class="header">
|
|
2019
2066
|
<h2>Shared with me</h2>
|
|
2020
|
-
${s?l`<span class="summary">${s.updated} updated · ${s.revoked} revoked · ${s.unchanged} unchanged</span>`:""}
|
|
2067
|
+
${s?l`<span class="summary">${s.added} added · ${s.updated} updated · ${s.revoked} revoked · ${s.unchanged} unchanged</span>`:""}
|
|
2021
2068
|
<button
|
|
2022
2069
|
class="refresh-btn ${this.refreshing?"spinning":""}"
|
|
2023
2070
|
title="Refresh — check for updates or revoked shares"
|
|
@@ -2036,7 +2083,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
2036
2083
|
</div>
|
|
2037
2084
|
`)}
|
|
2038
2085
|
</div>
|
|
2039
|
-
`}}customElements.define("shared-with-me-panel",rr);function nr(r){const e=r.split(":");if(e.length===1)return{folderPath:"",name:e[0]};if(e.length===2){const[n,o]=e;return n.includes("/")?{folderPath:n,name:o}:{owner:n,folderPath:"",name:o}}const[t,s,...i]=e;return{owner:t===""?void 0:t,folderPath:s,name:i.join(":")}}const ie=new
|
|
2086
|
+
`}}customElements.define("shared-with-me-panel",rr);function nr(r){const e=r.split(":");if(e.length===1)return{folderPath:"",name:e[0]};if(e.length===2){const[n,o]=e;return n.includes("/")?{folderPath:n,name:o}:{owner:n,folderPath:"",name:o}}const[t,s,...i]=e;return{owner:t===""?void 0:t,folderPath:s,name:i.join(":")}}const ie=new p({mode:"off",username:null});let $t=!1;function or(){if($t)return;$t=!0;const r=new EventSource("/api/folderfoo/identity-stream");r.onmessage=e=>{try{ie.set(JSON.parse(e.data))}catch{}}}let wt=!1;async function ar(r){if(wt)return;wt=!0;const{folderfooMode:e,folderfooHost:t}=await j();if(e==="off"||!t)return;const s=new URL(window.location.href),i=s.searchParams.has("shareToken"),n=s.searchParams.has("publicToken");if(!(!i&&!n)){document.addEventListener("folderfoo-share-redeemed",o=>{const a=o.detail;!a?.owner||!a?.path||a.type!=="file"||!a.originId||!a.kind||r({owner:a.owner,path:a.path,originId:a.originId,kind:a.kind,role:a.role??"member",server:t,tenantId:L})}),document.addEventListener("folderfoo-share-redeem-failed",o=>{const a=o.detail?.message;alert(a||"This link is invalid or has expired.")});try{const[o,a]=await Promise.all([re(()=>import(`${t}/elements/auth-guard.js`),[]),re(()=>import(`${t}/elements/api-client.js`),[])]);if(a.setTenantId(L),i&&o.redeemShareTokenFromUrl(),n){const c=s.searchParams.get("publicToken");s.searchParams.delete("publicToken"),window.history.replaceState(null,"",s.toString());const d=await o.getPublicLink(c).catch(u=>(alert(u.message||"This link is invalid or has expired."),null));d?.type==="file"&&d.originId&&d.kind&&r({owner:d.owner,path:d.path,originId:d.originId,kind:d.kind,role:"member",server:t,tenantId:L})}}catch(o){console.error("[memory-bucket] failed to load folderfoo share-accept widgets:",o)}}}let _t=!1;const lr=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],St=[{value:"all",label:"Show all"},{value:"hide",label:"Hide"},{value:"only",label:"Only"}],cr={tags:[],statuses:[],owners:[],doc_types:[],key_types:[],folders:[]},dr={skill:[],memory:[]},Zt="mem-bucket-split-pct",Gt=20,Jt=80;function hr(){const r=Number(localStorage.getItem(Zt));return Number.isFinite(r)&&r>=Gt&&r<=Jt?r:40}const Qt="mem-bucket-theme",be=["system","light","dark"];function pr(){const r=localStorage.getItem(Qt);return r==="light"||r==="dark"?r:"system"}function Ct(r){r==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",r)}function ur(){const r=location.hash.slice(1);if(!r)return{};const e=new URLSearchParams(r),t={},s=e.get("q");s&&(t.query=s);const i=e.get("type");(i==="skill"||i==="memory"||i==="all")&&(t.typeFilter=i);const n=e.getAll("tag");n.length&&(t.activeTags=n);const o=e.getAll("folder");o.length&&(t.activeFolders=o);const a=e.get("sort");a&&(t.sort=a);const c=e.get("deprecated");c==="0"?t.deprecatedFilter="hide":c==="1"&&(t.deprecatedFilter="only");const d=e.get("paused");d==="0"?t.pausedFilter="hide":d==="1"&&(t.pausedFilter="only");const u=e.get("date_from");u&&(t.dateFrom=u);const h=e.get("date_to");return h&&(t.dateTo=h),t}class fr extends k{static{this.styles=S`
|
|
2040
2087
|
:host { display: flex; flex-direction: column; height: 100vh; position: relative; }
|
|
2041
2088
|
/* Overlays whichever header row #renderBody() renders for the current mode (.folders-bar,
|
|
2042
2089
|
.toolbar-bar, or folder-view's own .mode-row) - all three share the same 10px/16px padding,
|
|
@@ -2240,56 +2287,56 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
2240
2287
|
cursor: pointer;
|
|
2241
2288
|
}
|
|
2242
2289
|
.bulk-bar button.danger { border-color: var(--danger); color: var(--danger); }
|
|
2243
|
-
`}#e=ur();#t=new u(this.#e.query??"");#s=new u(this.#e.typeFilter??"all");#n=new u(this.#e.activeTags??[]);#r=new u(this.#e.activeFolders??[]);#h=new u([]);#l=new u(cr);#i=new u(null);#o=new u(dr);#g=new u(!1);#v=new u("");#p=new u(!1);#a=new u(hr());#b=new u("");#y=new u(!1);#$=new u(this.#e.sort??"");#m=new u(this.#e.deprecatedFilter??"all");#c=new u(this.#e.pausedFilter??"all");#x=new u(this.#e.dateFrom??"");#k=new u(this.#e.dateTo??"");#f=new u(new Set);#w=new u(pr());#_=new u(!1);#u=new u("entries");#I=new u([]);#L=new u([]);#S=new u(null);#T=new u(null);#A=new u(!1);#E=new u([]);#R=new u(!1);#P=new u(null);#F=e=>this.#H(e);#D=()=>this.#he();constructor(){super(),new Y(this),Ct(this.#w.value)}#U(e){this.#w.set(e),localStorage.setItem(Qt,e),Ct(e)}#j(){const e=be[(be.indexOf(this.#w.value)+1)%be.length];this.#U(e)}async#q(){if(!this.#_.value){this.#_.set(!0);try{await fetch("/api/rebuild-cache",{method:"POST"}),await Promise.all([this.#z(),this.#C(),this.#d()])}finally{this.#_.set(!1)}}}#B(e){e.preventDefault(),this.#y.set(!0),document.addEventListener("pointermove",this.#F),document.addEventListener("pointerup",this.#D)}#H(e){const t=this.renderRoot.querySelector(".body-region");if(!t)return;const s=t.getBoundingClientRect(),i=(e.clientX-s.left)/s.width*100;this.#a.set(Math.min(Jt,Math.max(Gt,i)))}#he(){this.#y.set(!1),document.removeEventListener("pointermove",this.#F),document.removeEventListener("pointerup",this.#D),localStorage.setItem(Zt,String(this.#a.value))}#pe=new Xe(()=>{const e=new URLSearchParams;this.#s.value!=="all"&&e.set("type",this.#s.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim());for(const t of this.#n.value)e.append("tag",t);for(const t of this.#r.value)e.append("folder",t);return this.#$.value&&e.set("sort",this.#$.value),this.#m.value==="hide"?e.set("deprecated","0"):this.#m.value==="only"&&e.set("deprecated","1"),this.#c.value==="hide"?e.set("paused","0"):this.#c.value==="only"&&e.set("paused","1"),this.#x.value&&e.set("date_from",this.#x.value),this.#k.value&&e.set("date_to",this.#k.value),e.toString()});#ue=new Xe(()=>{const e=new URLSearchParams;return this.#s.value!=="all"&&e.set("type",this.#s.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim()),this.#m.value==="hide"?e.set("deprecated","0"):this.#m.value==="only"&&e.set("deprecated","1"),this.#c.value==="hide"?e.set("paused","0"):this.#c.value==="only"&&e.set("paused","1"),this.#x.value&&e.set("date_from",this.#x.value),this.#k.value&&e.set("date_to",this.#k.value),e.toString()});#N=()=>this.#se();#G=e=>this.#fe(e);#J=e=>this.#ge(e);#Q=()=>this.#te();#Y;connectedCallback(){super.connectedCallback(),this.#d(),this.#C(),this.#z().then(()=>this.#se()),window.addEventListener("focus",this.#N),document.addEventListener("visibilitychange",this.#N),document.addEventListener("folderfoo-file-open",this.#G),document.addEventListener("folderfoo-folder-changed",this.#J),window.addEventListener("folderfoo-auth-change",this.#Q),this.#te(),or(),ar(e=>this.#ye(e)),this.#M(),this.#Y=ie.subscribe(()=>{this.#z(),this.#u.value==="shared"&&ie.value.username===null&&this.#O("entries")})}async#fe(e){const t=e.detail?.name;if(!t)return;const s=nr(t);if(s.owner){this.#b.set(`"${s.name}" is from a shared folder — opening shared files here isn't supported yet.`);return}const{folderfooMode:i,folderfooHost:n}=await j();if(!(i==="off"||!n))try{const o=await fetch("/api/folderfoo/resolve-open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:n,tenantId:L,folderPath:s.folderPath,name:s.name})}),a=await o.json();if(!o.ok){this.#b.set(a.error??`couldn't open "${s.name}"`);return}this.#b.set(""),this.#i.set({table:a.table,id:a.id})}catch(o){this.#b.set(o.message)}}async#ge(e){const{path:t,action:s,newPath:i}=e.detail??{};if(!(t===void 0||!s)){if((s==="rename"||s==="move")&&i){const{folderfooHost:n}=await j();if(!n)return;try{await fetch("/api/folders/renamed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:n,oldPath:t,newPath:i})})}catch{}}this.#z()}}#X(){return this.shadowRoot?.querySelector("app-toolbar")?.shadowRoot?.querySelector(".folderfoo-slot")??null}#ee(e){const t=document.createElement("folderfoo-profile-circle");t.setAttribute("app-name","Memory Bucket"),t.setAttribute("tenant-id",L),t.style.zoom="0.875",e.appendChild(t)}async#be(){const e=this.#X();if(!e||e.querySelector("folderfoo-profile-circle"))return;if(_t){this.#ee(e);return}if(e.hasAttribute("data-ff-attempted"))return;e.setAttribute("data-ff-attempted","");const{folderfooMode:t,folderfooHost:s}=await j();t==="off"||!s||re(()=>import(`${s}/elements/folderfoo-profile-circle.js`),[]).then(async()=>{_t=!0,await this.updateComplete;const i=this.#X();i&&!i.querySelector("folderfoo-profile-circle")&&this.#ee(i)}).catch(i=>{console.warn("folderfoo-profile-circle unavailable:",i.message)})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("focus",this.#N),document.removeEventListener("visibilitychange",this.#N),document.removeEventListener("folderfoo-file-open",this.#G),document.removeEventListener("folderfoo-folder-changed",this.#J),window.removeEventListener("folderfoo-auth-change",this.#Q),this.#Y?.()}async#te(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{return}if(!e){fetch("/api/folderfoo/logout",{method:"POST"}).catch(()=>{});return}const{folderfooMode:t,folderfooHost:s}=await j();t==="off"||!s||fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:s,token:e})}).catch(()=>{})}#K=!1;async#se(){if(document.visibilityState==="visible"){if(this.#V().some(e=>e.remote)&&!this.#K){this.#K=!0;try{await fetch("/api/remote-folders/resync-all",{method:"POST"})}catch{}finally{this.#K=!1}}this.#d(),this.#C(),this.#z(),this.renderRoot.querySelector("detail-panel")?.refresh?.()}}async#d(){const e=this.#pe.value;history.replaceState(null,"",e?`#${e}`:location.pathname+location.search);const t=await fetch(`/api/entries?${e}`);this.#h.set(await t.json()),this.renderRoot.querySelector("result-list")?.scrollTo(0,0),this.#u.value==="folder-view"&&this.#ie()}async#ie(){const e=await fetch(`/api/entries?${this.#ue.value}`);this.#I.set(await e.json())}async#C(){const e=this.#s.value==="all"?"":`?type=${this.#s.value}`,t=await fetch(`/api/facets${e}`);this.#l.set(await t.json())}async#z(){const t=await(await fetch("/api/folders")).json();this.#o.set(t),this.#p.set(!0);const s=new Set([...t.skill,...t.memory].map(n=>n.name)),i=this.#r.value.filter(n=>s.has(n));i.length!==this.#r.value.length&&(this.#r.set(i),this.#d())}#O(e){this.#u.set(e),e==="channels"?this.#re():e==="folder-view"?this.#ie():e==="shared"&&this.#M()}async#M(){const e=await fetch("/api/shared-items");this.#E.set(e.ok?await e.json():[])}async#me(){this.#R.set(!0);try{const e=await fetch("/api/shared-items/refresh",{method:"POST"});e.ok&&this.#P.set(await e.json()),await this.#M()}finally{this.#R.set(!1)}}async#ve(e){await fetch(`/api/shared-items/${encodeURIComponent(e)}`,{method:"DELETE"}),await this.#M()}#xe(e){e.entryId&&(this.#i.set({table:e.kind==="skill"?"skills":"memory_docs",id:e.entryId}),this.#O("entries"))}async#ye(e){const t=await fetch("/api/shared-items/accept",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const s=await t.json().catch(()=>({}));alert(s.error||"Failed to accept the shared item.");return}this.#O("shared")}async#ke(e,t){const s=await fetch(`/api/shared-items/${encodeURIComponent(e.origin_id)}/fork`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folder:t})}),i=await s.json().catch(()=>({}));return s.ok?(await this.#d(),{ok:!0,message:`Copied into "${t}".`}):{ok:!1,message:i.error||`Fork failed (${s.status}).`}}async#re(){const e=await fetch("/api/channels");this.#L.set(await e.json()),this.#S.value&&this.#ne(this.#S.value)}async#ne(e){this.#S.set(e),this.#A.set(!0);try{const t=await fetch(`/api/channels/${encodeURIComponent(e)}`);this.#T.set(t.ok?await t.json():null)}finally{this.#A.set(!1)}}#$e(e){const t=this.#r.value;this.#r.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#d()}async#we(e,t){if(t.stopPropagation(),window.prompt(`Type "${e.name}" to remove this ${e.kind} folder (files on disk are untouched):`)===e.name){this.#v.set(e.name);try{await fetch(`/api/folders/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"}),this.#r.set(this.#r.value.filter(i=>i!==e.name)),await Promise.all([this.#z(),this.#C(),this.#d()])}finally{this.#v.set("")}}}#oe(){this.#g.set(!1),this.#z(),this.#C(),this.#d()}#V(){return[...this.#o.value.skill,...this.#o.value.memory].sort((e,t)=>Number(e.remote)-Number(t.remote))}#ae(e){this.#s.set(e),this.#n.set([]),this.#C(),this.#d()}#_e(e){const t=this.#n.value;this.#n.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#d()}#Se(e){this.#n.value.includes(e)||this.#n.set([...this.#n.value,e]),this.#d()}#Ce(e){this.#r.value.includes(e)||this.#r.set([...this.#r.value,e]),this.#d()}#le(e){this.#x.set(e),this.#k.set(e),this.#d()}#Te(e){this.#t.set(e.target.value),this.#d()}#W(e){this.#t.set(e),this.#d()}#Ae(){this.#t.set(""),this.#d()}#Ee(e){this.#i.set({table:e._table,id:e.id})}#Re(e){this.#$.set(e.target.value),this.#d()}#Pe(e){this.#m.set(e.target.value),this.#d()}#ze(e){this.#c.set(e.target.value),this.#d()}#Ie(e){this.#x.set(e.target.value),this.#d()}#Le(e){this.#k.set(e.target.value),this.#d()}#Oe(){this.#x.set(""),this.#k.set(""),this.#d()}#Fe(e){const t=new Set(this.#f.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#f.set(t)}#De(){return new Map(this.#h.value.map(e=>[e.id,e]))}#Z(){const e=new Map,t=this.#De();for(const s of this.#f.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#ce(e){const t=this.#Z();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.#f.set(new Set),await this.#d()}async#de(e){const t=this.#Z();await Promise.all([...t.entries()].map(([s,i])=>fetch(`/api/entries/${s}/bulk/paused`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i,paused:e})}))),this.#f.set(new Set),await this.#d()}async#Ne(){if(!window.confirm(`Delete ${this.#f.value.size} doc(s)? This can't be undone.`))return;const e=this.#Z();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.#f.set(new Set),await this.#d()}#Me(){const e=this.#u.value!=="channels"&&this.#u.value!=="shared"&&this.#p.value&&this.#V().length>0,t=ie.value.username!==null||this.#E.value.length>0;return l`
|
|
2290
|
+
`}#e=ur();#t=new p(this.#e.query??"");#s=new p(this.#e.typeFilter??"all");#n=new p(this.#e.activeTags??[]);#r=new p(this.#e.activeFolders??[]);#p=new p([]);#l=new p(cr);#i=new p(null);#a=new p(dr);#g=new p(!1);#v=new p("");#u=new p(!1);#o=new p(hr());#b=new p("");#k=new p(!1);#w=new p(this.#e.sort??"");#m=new p(this.#e.deprecatedFilter??"all");#d=new p(this.#e.pausedFilter??"all");#x=new p(this.#e.dateFrom??"");#$=new p(this.#e.dateTo??"");#h=new p(new Set);#y=new p(pr());#_=new p(!1);#f=new p("entries");#T=new p([]);#E=new p([]);#S=new p(null);#R=new p(null);#C=new p(!1);#P=new p([]);#z=new p(!1);#I=new p(null);#N=e=>this.#H(e);#j=()=>this.#M();constructor(){super(),new Y(this),Ct(this.#y.value)}#G(e){this.#y.set(e),localStorage.setItem(Qt,e),Ct(e)}#J(){const e=be[(be.indexOf(this.#y.value)+1)%be.length];this.#G(e)}async#q(){if(!this.#_.value){this.#_.set(!0);try{await fetch("/api/rebuild-cache",{method:"POST"}),await Promise.all([this.#L(),this.#A(),this.#c()])}finally{this.#_.set(!1)}}}#B(e){e.preventDefault(),this.#k.set(!0),document.addEventListener("pointermove",this.#N),document.addEventListener("pointerup",this.#j)}#H(e){const t=this.renderRoot.querySelector(".body-region");if(!t)return;const s=t.getBoundingClientRect(),i=(e.clientX-s.left)/s.width*100;this.#o.set(Math.min(Jt,Math.max(Gt,i)))}#M(){this.#k.set(!1),document.removeEventListener("pointermove",this.#N),document.removeEventListener("pointerup",this.#j),localStorage.setItem(Zt,String(this.#o.value))}#Q=new Xe(()=>{const e=new URLSearchParams;this.#s.value!=="all"&&e.set("type",this.#s.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim());for(const t of this.#n.value)e.append("tag",t);for(const t of this.#r.value)e.append("folder",t);return this.#w.value&&e.set("sort",this.#w.value),this.#m.value==="hide"?e.set("deprecated","0"):this.#m.value==="only"&&e.set("deprecated","1"),this.#d.value==="hide"?e.set("paused","0"):this.#d.value==="only"&&e.set("paused","1"),this.#x.value&&e.set("date_from",this.#x.value),this.#$.value&&e.set("date_to",this.#$.value),e.toString()});#U=new Xe(()=>{const e=new URLSearchParams;return this.#s.value!=="all"&&e.set("type",this.#s.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim()),this.#m.value==="hide"?e.set("deprecated","0"):this.#m.value==="only"&&e.set("deprecated","1"),this.#d.value==="hide"?e.set("paused","0"):this.#d.value==="only"&&e.set("paused","1"),this.#x.value&&e.set("date_from",this.#x.value),this.#$.value&&e.set("date_to",this.#$.value),e.toString()});#F=()=>this.#oe();#O=e=>this.#Y(e);#K=e=>this.#me(e);#V=()=>this.#ne();#W;connectedCallback(){super.connectedCallback(),this.#c(),this.#A(),this.#L().then(()=>this.#oe()),window.addEventListener("focus",this.#F),document.addEventListener("visibilitychange",this.#F),document.addEventListener("folderfoo-file-open",this.#O),document.addEventListener("folderfoo-folder-changed",this.#K),window.addEventListener("folderfoo-auth-change",this.#V),this.#ne(),or(),ar(e=>this.#ke(e)),this.#Z(),this.#W=ie.subscribe(()=>{this.#L(),this.#c(),this.#A(),this.#f.value==="shared"&&ie.value.username===null&&this.#D("entries")})}async#Y(e){const t=e.detail?.name;if(!t)return;const s=nr(t);if(s.owner){this.#b.set(`"${s.name}" is from a shared folder — opening shared files here isn't supported yet.`);return}const{folderfooMode:i,folderfooHost:n}=await j();if(!(i==="off"||!n))try{const o=await fetch("/api/folderfoo/resolve-open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:n,tenantId:L,folderPath:s.folderPath,name:s.name})}),a=await o.json();if(!o.ok){this.#b.set(a.error??`couldn't open "${s.name}"`);return}this.#b.set(""),this.#i.set({table:a.table,id:a.id})}catch(o){this.#b.set(o.message)}}async#me(e){const{path:t,action:s,newPath:i}=e.detail??{};if(!(t===void 0||!s)){if((s==="rename"||s==="move")&&i){const{folderfooHost:n}=await j();if(!n)return;try{await fetch("/api/folders/renamed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:n,oldPath:t,newPath:i})})}catch{}}this.#L()}}#ie(){return this.shadowRoot?.querySelector("app-toolbar")?.shadowRoot?.querySelector(".folderfoo-slot")??null}#re(e){const t=document.createElement("folderfoo-profile-circle");t.setAttribute("app-name","Memory Bucket"),t.setAttribute("tenant-id",L),t.style.zoom="0.875",e.appendChild(t)}async#ve(){const e=this.#ie();if(!e||e.querySelector("folderfoo-profile-circle"))return;if(_t){this.#re(e);return}if(e.hasAttribute("data-ff-attempted"))return;e.setAttribute("data-ff-attempted","");const{folderfooMode:t,folderfooHost:s}=await j();t==="off"||!s||re(()=>import(`${s}/elements/folderfoo-profile-circle.js`),[]).then(async()=>{_t=!0,await this.updateComplete;const i=this.#ie();i&&!i.querySelector("folderfoo-profile-circle")&&this.#re(i)}).catch(i=>{console.warn("folderfoo-profile-circle unavailable:",i.message)})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("focus",this.#F),document.removeEventListener("visibilitychange",this.#F),document.removeEventListener("folderfoo-file-open",this.#O),document.removeEventListener("folderfoo-folder-changed",this.#K),window.removeEventListener("folderfoo-auth-change",this.#V),this.#W?.()}async#ne(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{return}if(!e){fetch("/api/folderfoo/logout",{method:"POST"}).catch(()=>{});return}const{folderfooMode:t,folderfooHost:s}=await j();t==="off"||!s||fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:s,token:e})}).catch(()=>{})}#X=!1;async#oe(){if(document.visibilityState==="visible"){if(this.#ee().some(e=>e.remote)&&!this.#X){this.#X=!0;try{await fetch("/api/remote-folders/resync-all",{method:"POST"})}catch{}finally{this.#X=!1}}this.#c(),this.#A(),this.#L(),this.renderRoot.querySelector("detail-panel")?.refresh?.()}}async#c(){const e=this.#Q.value;history.replaceState(null,"",e?`#${e}`:location.pathname+location.search);const t=await fetch(`/api/entries?${e}`);this.#p.set(await t.json()),this.renderRoot.querySelector("result-list")?.scrollTo(0,0),this.#f.value==="folder-view"&&this.#ae()}async#ae(){const e=await fetch(`/api/entries?${this.#U.value}`);this.#T.set(await e.json())}async#A(){const e=this.#s.value==="all"?"":`?type=${this.#s.value}`,t=await fetch(`/api/facets${e}`);this.#l.set(await t.json())}async#L(){const t=await(await fetch("/api/folders")).json();this.#a.set(t),this.#u.set(!0);const s=new Set([...t.skill,...t.memory].map(o=>o.name)),i=this.#r.value.filter(o=>s.has(o));i.length!==this.#r.value.length&&(this.#r.set(i),this.#c());const n=this.#i.value;if(n){const o=this.#fe().get(n.id);o&&!s.has(o.folder)&&this.#i.set(null)}}#D(e){this.#f.set(e),e==="channels"?this.#ce():e==="folder-view"?this.#ae():e==="shared"&&(this.#Z(),this.#le())}async#Z(){const e=await fetch("/api/shared-items");this.#P.set(e.ok?await e.json():[])}async#le(){this.#z.set(!0);try{const e=await fetch("/api/shared-items/refresh",{method:"POST"});e.ok&&this.#I.set(await e.json()),await this.#Z()}finally{this.#z.set(!1)}}async#xe(e){await fetch(`/api/shared-items/${encodeURIComponent(e)}`,{method:"DELETE"}),await this.#Z()}#ye(e){e.entryId&&(this.#i.set({table:e.kind==="skill"?"skills":"memory_docs",id:e.entryId}),this.#D("entries"))}async#ke(e){const t=await fetch("/api/shared-items/accept",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const s=await t.json().catch(()=>({}));alert(s.error||"Failed to accept the shared item.");return}this.#D("shared")}async#$e(e,t){const s=await fetch(`/api/shared-items/${encodeURIComponent(e.origin_id)}/fork`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folder:t})}),i=await s.json().catch(()=>({}));return s.ok?(await this.#c(),{ok:!0,message:`Copied into "${t}".`}):{ok:!1,message:i.error||`Fork failed (${s.status}).`}}async#ce(){const e=await fetch("/api/channels");this.#E.set(await e.json()),this.#S.value&&this.#de(this.#S.value)}async#de(e){this.#S.set(e),this.#C.set(!0);try{const t=await fetch(`/api/channels/${encodeURIComponent(e)}`);this.#R.set(t.ok?await t.json():null)}finally{this.#C.set(!1)}}#we(e){const t=this.#r.value;this.#r.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} folder (files on disk are untouched):`)===e.name){this.#v.set(e.name);try{await fetch(`/api/folders/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"}),this.#r.set(this.#r.value.filter(i=>i!==e.name)),await Promise.all([this.#L(),this.#A(),this.#c()])}finally{this.#v.set("")}}}#he(e){this.#g.set(!1),this.#L(),this.#A(),this.#c(),e&&alert(e)}#ee(){return[...this.#a.value.skill,...this.#a.value.memory].sort((e,t)=>Number(e.remote)-Number(t.remote))}#pe(e){this.#s.set(e),this.#n.set([]),this.#A(),this.#c()}#Se(e){const t=this.#n.value;this.#n.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#c()}#Ce(e){this.#n.value.includes(e)||this.#n.set([...this.#n.value,e]),this.#c()}#Te(e){this.#r.value.includes(e)||this.#r.set([...this.#r.value,e]),this.#c()}#ue(e){this.#x.set(e),this.#$.set(e),this.#c()}#Ae(e){this.#t.set(e.target.value),this.#c()}#te(e){this.#t.set(e),this.#c()}#Ee(){this.#t.set(""),this.#c()}#Re(e){this.#i.set({table:e._table,id:e.id})}#Pe(e){this.#w.set(e.target.value),this.#c()}#ze(e){this.#m.set(e.target.value),this.#c()}#Ie(e){this.#d.set(e.target.value),this.#c()}#Le(e){this.#x.set(e.target.value),this.#c()}#Fe(e){this.#$.set(e.target.value),this.#c()}#Oe(){this.#x.set(""),this.#$.set(""),this.#c()}#De(e){const t=new Set(this.#h.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#h.set(t)}#fe(){return new Map(this.#p.value.map(e=>[e.id,e]))}#se(){const e=new Map,t=this.#fe();for(const s of this.#h.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#ge(e){const t=this.#se();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.#h.set(new Set),await this.#c()}async#be(e){const t=this.#se();await Promise.all([...t.entries()].map(([s,i])=>fetch(`/api/entries/${s}/bulk/paused`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i,paused:e})}))),this.#h.set(new Set),await this.#c()}async#Ne(){if(!window.confirm(`Delete ${this.#h.value.size} doc(s)? This can't be undone.`))return;const e=this.#se();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.#h.set(new Set),await this.#c()}#Me(){const e=this.#f.value!=="channels"&&this.#f.value!=="shared"&&this.#u.value&&this.#ee().length>0,t=ie.value.username!==null||this.#P.value.length>0;return l`
|
|
2244
2291
|
<app-toolbar
|
|
2245
2292
|
.showReindex=${e}
|
|
2246
2293
|
.reindexing=${this.#_.value}
|
|
2247
|
-
.channelsActive=${this.#
|
|
2248
|
-
.folderViewActive=${this.#
|
|
2294
|
+
.channelsActive=${this.#f.value==="channels"}
|
|
2295
|
+
.folderViewActive=${this.#f.value==="folder-view"}
|
|
2249
2296
|
.showShared=${t}
|
|
2250
|
-
.sharedActive=${this.#
|
|
2251
|
-
.theme=${this.#
|
|
2297
|
+
.sharedActive=${this.#f.value==="shared"}
|
|
2298
|
+
.theme=${this.#y.value}
|
|
2252
2299
|
.onReindex=${()=>this.#q()}
|
|
2253
|
-
.onToggleChannels=${()=>this.#
|
|
2254
|
-
.onToggleFolderView=${()=>this.#
|
|
2255
|
-
.onToggleShared=${()=>this.#
|
|
2256
|
-
.onCycleTheme=${()=>this.#
|
|
2300
|
+
.onToggleChannels=${()=>this.#D(this.#f.value==="channels"?"entries":"channels")}
|
|
2301
|
+
.onToggleFolderView=${()=>this.#D(this.#f.value==="folder-view"?"entries":"folder-view")}
|
|
2302
|
+
.onToggleShared=${()=>this.#D(this.#f.value==="shared"?"entries":"shared")}
|
|
2303
|
+
.onCycleTheme=${()=>this.#J()}
|
|
2257
2304
|
></app-toolbar>
|
|
2258
|
-
`}updated(){this.#
|
|
2305
|
+
`}updated(){this.#ve()}render(){return l` <div class="header-toolbar">${this.#Me()}</div>${this.#Ue()} `}#Ue(){const e=this.#l.value,t=this.#ee();return this.#f.value==="shared"?l`
|
|
2259
2306
|
<div class="toolbar-bar"></div>
|
|
2260
2307
|
<shared-with-me-panel
|
|
2261
|
-
.items=${this.#
|
|
2262
|
-
.refreshing=${this.#
|
|
2263
|
-
.lastRefreshSummary=${this.#
|
|
2264
|
-
.memoryFolderNames=${this.#
|
|
2265
|
-
.skillFolderNames=${this.#
|
|
2266
|
-
.onRefresh=${()=>this.#
|
|
2267
|
-
.onDismiss=${s=>this.#
|
|
2268
|
-
.onOpen=${s=>this.#
|
|
2269
|
-
.onFork=${(s,i)=>this
|
|
2308
|
+
.items=${this.#P.value}
|
|
2309
|
+
.refreshing=${this.#z.value}
|
|
2310
|
+
.lastRefreshSummary=${this.#I.value}
|
|
2311
|
+
.memoryFolderNames=${this.#a.value.memory.map(s=>s.name)}
|
|
2312
|
+
.skillFolderNames=${this.#a.value.skill.map(s=>s.name)}
|
|
2313
|
+
.onRefresh=${()=>this.#le()}
|
|
2314
|
+
.onDismiss=${s=>this.#xe(s)}
|
|
2315
|
+
.onOpen=${s=>this.#ye(s)}
|
|
2316
|
+
.onFork=${(s,i)=>this.#$e(s,i)}
|
|
2270
2317
|
></shared-with-me-panel>
|
|
2271
|
-
`:this.#
|
|
2318
|
+
`:this.#f.value==="channels"?l`
|
|
2272
2319
|
<div class="toolbar-bar"></div>
|
|
2273
2320
|
<channel-view
|
|
2274
|
-
.channels=${this.#
|
|
2321
|
+
.channels=${this.#E.value}
|
|
2275
2322
|
.selected=${this.#S.value}
|
|
2276
|
-
.detail=${this.#
|
|
2277
|
-
.loading=${this.#
|
|
2278
|
-
.onSelect=${s=>this.#
|
|
2279
|
-
.onRefresh=${()=>this.#
|
|
2323
|
+
.detail=${this.#R.value}
|
|
2324
|
+
.loading=${this.#C.value}
|
|
2325
|
+
.onSelect=${s=>this.#de(s)}
|
|
2326
|
+
.onRefresh=${()=>this.#ce()}
|
|
2280
2327
|
></channel-view>
|
|
2281
|
-
`:this.#
|
|
2328
|
+
`:this.#f.value==="folder-view"?l`
|
|
2282
2329
|
<folder-view
|
|
2283
|
-
.entries=${this.#
|
|
2330
|
+
.entries=${this.#T.value}
|
|
2284
2331
|
.allFolders=${t}
|
|
2285
2332
|
.facets=${e}
|
|
2286
2333
|
.typeFilter=${this.#s.value}
|
|
2287
|
-
.onTypeChange=${s=>this.#
|
|
2288
|
-
.onChanged=${()=>{this.#
|
|
2289
|
-
.onDateClick=${s=>this.#
|
|
2290
|
-
.onKeyClick=${s=>this.#
|
|
2334
|
+
.onTypeChange=${s=>this.#pe(s)}
|
|
2335
|
+
.onChanged=${()=>{this.#c(),this.#A()}}
|
|
2336
|
+
.onDateClick=${s=>this.#ue(s)}
|
|
2337
|
+
.onKeyClick=${s=>this.#te(s)}
|
|
2291
2338
|
></folder-view>
|
|
2292
|
-
`:this.#
|
|
2339
|
+
`:this.#u.value&&t.length===0&&!this.#g.value?l`
|
|
2293
2340
|
<div class="toolbar-bar"></div>
|
|
2294
2341
|
<div class="first-run">
|
|
2295
2342
|
<h1>No folders configured yet</h1>
|
|
@@ -2302,7 +2349,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
2302
2349
|
${this.#g.value?l`<add-folder-modal
|
|
2303
2350
|
.defaultKind=${"skill"}
|
|
2304
2351
|
.lockKind=${!1}
|
|
2305
|
-
.onAdded=${
|
|
2352
|
+
.onAdded=${s=>this.#he(s)}
|
|
2306
2353
|
.onCancel=${()=>this.#g.set(!1)}
|
|
2307
2354
|
></add-folder-modal>`:""}
|
|
2308
2355
|
`:l`
|
|
@@ -2313,14 +2360,14 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
2313
2360
|
<button
|
|
2314
2361
|
class="folder-chip ${s.remote?"remote":""} ${this.#r.value.includes(s.name)?"active":""}"
|
|
2315
2362
|
title=${s.remote?`${s.path} (remote — folderfoo)`:s.path}
|
|
2316
|
-
@click=${()=>this
|
|
2363
|
+
@click=${()=>this.#we(s.name)}
|
|
2317
2364
|
>
|
|
2318
2365
|
${s.remote?l`<span class="remote-dot"></span>`:"📁"} ${s.name}
|
|
2319
2366
|
<span class="kind">(${s.kind==="skill"?"s":"m"})</span>
|
|
2320
2367
|
<span
|
|
2321
2368
|
class="remove"
|
|
2322
2369
|
title="Remove folder"
|
|
2323
|
-
@click=${i=>this.#
|
|
2370
|
+
@click=${i=>this.#_e(s,i)}
|
|
2324
2371
|
>${this.#v.value===s.name?"…":"✕"}</span
|
|
2325
2372
|
>
|
|
2326
2373
|
</button>
|
|
@@ -2341,14 +2388,14 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
2341
2388
|
type="search"
|
|
2342
2389
|
placeholder="Search descriptions, bodies, tags..."
|
|
2343
2390
|
.value=${this.#t.value}
|
|
2344
|
-
@input=${s=>this.#
|
|
2391
|
+
@input=${s=>this.#Ae(s)}
|
|
2345
2392
|
/>
|
|
2346
2393
|
${this.#t.value?l`
|
|
2347
2394
|
<button
|
|
2348
2395
|
class="search-clear-btn"
|
|
2349
2396
|
title="Clear search"
|
|
2350
2397
|
aria-label="Clear search"
|
|
2351
|
-
@click=${()=>this.#
|
|
2398
|
+
@click=${()=>this.#Ee()}
|
|
2352
2399
|
>
|
|
2353
2400
|
✕
|
|
2354
2401
|
</button>
|
|
@@ -2358,7 +2405,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
2358
2405
|
${lr.map(s=>l`
|
|
2359
2406
|
<button
|
|
2360
2407
|
class=${this.#s.value===s.value?"active":""}
|
|
2361
|
-
@click=${()=>this.#
|
|
2408
|
+
@click=${()=>this.#pe(s.value)}
|
|
2362
2409
|
>
|
|
2363
2410
|
${s.label}
|
|
2364
2411
|
</button>
|
|
@@ -2368,7 +2415,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
2368
2415
|
<tag-multiselect
|
|
2369
2416
|
.tags=${e.tags}
|
|
2370
2417
|
.active=${this.#n.value}
|
|
2371
|
-
.onToggle=${s=>this.#
|
|
2418
|
+
.onToggle=${s=>this.#Se(s)}
|
|
2372
2419
|
.width=${"260px"}
|
|
2373
2420
|
></tag-multiselect>
|
|
2374
2421
|
`}
|
|
@@ -2378,16 +2425,16 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
2378
2425
|
type="date"
|
|
2379
2426
|
aria-label="From date"
|
|
2380
2427
|
.value=${this.#x.value}
|
|
2381
|
-
@change=${s=>this.#
|
|
2428
|
+
@change=${s=>this.#Le(s)}
|
|
2382
2429
|
/>
|
|
2383
2430
|
<span class="date-range-sep">–</span>
|
|
2384
2431
|
<input
|
|
2385
2432
|
type="date"
|
|
2386
2433
|
aria-label="To date"
|
|
2387
|
-
.value=${this
|
|
2388
|
-
@change=${s=>this.#
|
|
2434
|
+
.value=${this.#$.value}
|
|
2435
|
+
@change=${s=>this.#Fe(s)}
|
|
2389
2436
|
/>
|
|
2390
|
-
${this.#x.value||this
|
|
2437
|
+
${this.#x.value||this.#$.value?l`
|
|
2391
2438
|
<button
|
|
2392
2439
|
class="date-range-clear"
|
|
2393
2440
|
title="Clear date range"
|
|
@@ -2400,8 +2447,8 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
2400
2447
|
</div>
|
|
2401
2448
|
<span class="filter-label">Sort:</span>
|
|
2402
2449
|
<select
|
|
2403
|
-
.value=${this
|
|
2404
|
-
@change=${s=>this.#
|
|
2450
|
+
.value=${this.#w.value||(this.#t.value.trim()?"relevance":"mtime_desc")}
|
|
2451
|
+
@change=${s=>this.#Pe(s)}
|
|
2405
2452
|
>
|
|
2406
2453
|
${this.#t.value.trim()?l`<option value="relevance">Relevance</option>`:""}
|
|
2407
2454
|
<option value="mtime_desc">Recently touched</option>
|
|
@@ -2410,54 +2457,55 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
2410
2457
|
<option value="name_asc">Name</option>
|
|
2411
2458
|
</select>
|
|
2412
2459
|
<span class="filter-label">Deprecated:</span>
|
|
2413
|
-
<select .value=${this.#m.value} @change=${s=>this.#
|
|
2460
|
+
<select .value=${this.#m.value} @change=${s=>this.#ze(s)}>
|
|
2414
2461
|
${St.map(s=>l`<option value=${s.value}>${s.label}</option>`)}
|
|
2415
2462
|
</select>
|
|
2416
2463
|
<span class="filter-label">Paused:</span>
|
|
2417
|
-
<select .value=${this.#
|
|
2464
|
+
<select .value=${this.#d.value} @change=${s=>this.#Ie(s)}>
|
|
2418
2465
|
${St.map(s=>l`<option value=${s.value}>${s.label}</option>`)}
|
|
2419
2466
|
</select>
|
|
2420
2467
|
</div>
|
|
2421
2468
|
</div>
|
|
2422
|
-
${this.#
|
|
2469
|
+
${this.#h.value.size>0?l`
|
|
2423
2470
|
<div class="bulk-bar">
|
|
2424
|
-
<span>${this.#
|
|
2425
|
-
<button @click=${()=>this.#
|
|
2426
|
-
<button @click=${()=>this.#
|
|
2427
|
-
<button @click=${()=>this.#
|
|
2428
|
-
<button @click=${()=>this.#
|
|
2471
|
+
<span>${this.#h.value.size} selected</span>
|
|
2472
|
+
<button @click=${()=>this.#ge(!0)}>Mark deprecated</button>
|
|
2473
|
+
<button @click=${()=>this.#ge(!1)}>Un-deprecate</button>
|
|
2474
|
+
<button @click=${()=>this.#be(!0)}>Pause</button>
|
|
2475
|
+
<button @click=${()=>this.#be(!1)}>Resume</button>
|
|
2429
2476
|
<button class="danger" @click=${()=>this.#Ne()}>Delete</button>
|
|
2430
|
-
<button @click=${()=>this.#
|
|
2477
|
+
<button @click=${()=>this.#h.set(new Set)}>Clear</button>
|
|
2431
2478
|
</div>
|
|
2432
2479
|
`:""}
|
|
2433
2480
|
<div class="body-region">
|
|
2434
2481
|
<result-list
|
|
2435
|
-
style=${`width: ${this.#
|
|
2436
|
-
.results=${this.#
|
|
2482
|
+
style=${`width: ${this.#o.value}%; border-right: 1px solid var(--border);`}
|
|
2483
|
+
.results=${this.#p.value}
|
|
2437
2484
|
.showFolder=${t.length>1}
|
|
2438
|
-
.onSelect=${s=>this.#
|
|
2439
|
-
.selectedIds=${this.#
|
|
2440
|
-
.onToggleSelect=${s=>this.#
|
|
2441
|
-
.onKeyClick=${s=>this.#
|
|
2485
|
+
.onSelect=${s=>this.#Re(s)}
|
|
2486
|
+
.selectedIds=${this.#h.value}
|
|
2487
|
+
.onToggleSelect=${s=>this.#De(s)}
|
|
2488
|
+
.onKeyClick=${s=>this.#te(s)}
|
|
2442
2489
|
></result-list>
|
|
2443
2490
|
<div
|
|
2444
|
-
class="splitter ${this.#
|
|
2491
|
+
class="splitter ${this.#k.value?"dragging":""}"
|
|
2445
2492
|
@pointerdown=${s=>this.#B(s)}
|
|
2446
2493
|
></div>
|
|
2447
2494
|
<detail-panel
|
|
2448
2495
|
.selected=${this.#i.value}
|
|
2449
2496
|
.facets=${e}
|
|
2450
|
-
.onChanged=${()=>{this.#
|
|
2451
|
-
.onTagClick=${s=>this.#
|
|
2452
|
-
.onFolderClick=${s=>this.#
|
|
2453
|
-
.onDateClick=${s=>this.#
|
|
2454
|
-
.onKeyClick=${s=>this.#
|
|
2497
|
+
.onChanged=${()=>{this.#c(),this.#A()}}
|
|
2498
|
+
.onTagClick=${s=>this.#Ce(s)}
|
|
2499
|
+
.onFolderClick=${s=>this.#Te(s)}
|
|
2500
|
+
.onDateClick=${s=>this.#ue(s)}
|
|
2501
|
+
.onKeyClick=${s=>this.#te(s)}
|
|
2502
|
+
.onGone=${()=>this.#i.set(null)}
|
|
2455
2503
|
></detail-panel>
|
|
2456
2504
|
</div>
|
|
2457
2505
|
${this.#g.value?l`<add-folder-modal
|
|
2458
2506
|
.defaultKind=${"skill"}
|
|
2459
2507
|
.lockKind=${!1}
|
|
2460
|
-
.onAdded=${
|
|
2508
|
+
.onAdded=${s=>this.#he(s)}
|
|
2461
2509
|
.onCancel=${()=>this.#g.set(!1)}
|
|
2462
2510
|
></add-folder-modal>`:""}
|
|
2463
2511
|
`}}customElements.define("mem-bucket-app",fr);
|