|
|
|
@@ -360,8 +360,8 @@ export const HTML = `<!doctype html>
|
|
|
|
|
\`;try{const T={name:e,host:t,port:r,username:n,auth_method:d,tags:l,jump_server_id:c};if(u)T.credential=u;const k=document.getElementById("server-region");if(k&&c===null){T.region=k.value||""}let _;if(this.editingServerId){_=await fetch(\`/api/servers/\${this.editingServerId}\`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)})}else{_=await fetch("/api/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)})}if(!_.ok){const Q=await _.json();throw new Error(Q.error||"Save failed")}const C=await _.json();const w=Array.isArray(C._debug)?C._debug.filter(Q=>typeof Q==="string"):null;if(w){console.log("[locationHint 调试信息]");for(const Q of w)console.log(Q);this.showDebugNotification(w)}if(!w){if(c===null){const Q=C.inferred_hint||null;const D=T.region||null;if(D||Q){const I=D||Q;Y(g("server.savedRegion",{region:Gu(I)}),{variant:"success"})}else{Y(g("server.savedAuto"),{title:g("feedback.success"),variant:"warning"})}}else{Y(g("server.savedViaJump"),{variant:"success"})}}this.hideModal();await this.fetchServers()}catch(T){Y(T instanceof Error?T.message:String(T),{title:g("feedback.danger"),variant:"danger"})}finally{p.disabled=false;p.innerHTML=\`
|
|
|
|
|
<span class="material-symbols-outlined" style="font-size: 18px;">save</span>
|
|
|
|
|
\${this.editingServerId?g("server.update"):g("server.save")}
|
|
|
|
|
\`}}showDebugNotification(e){const t=document.createElement("div");t.className="fixed bottom-4 right-4 z-[200] max-w-md p-4 rounded-lg shadow-2xl border border-[var(--accent)] bg-[var(--bg-surface)] text-[var(--text)] font-mono text-[11px] leading-relaxed custom-scrollbar";t.style.maxHeight="300px";t.style.overflowY="auto";const s=document.createElement("div");s.className="text-[var(--accent)] font-bold mb-2 text-xs";s.textContent="[locationHint 调试信息]";t.appendChild(s);const r=document.createElement("div");r.className="text-muted whitespace-pre-wrap";r.textContent=e.join("\\n");t.appendChild(r);const n=document.createElement("button");n.className="absolute top-2 right-2 text-muted hover:text-[var(--accent)] cursor-pointer";n.innerHTML='<span class="material-symbols-outlined" style="font-size: 16px;">close</span>';n.onclick=()=>t.remove();t.appendChild(n);document.body.appendChild(t);setTimeout(()=>{if(t.parentNode){t.style.transition="opacity 0.3s";t.style.opacity="0";setTimeout(()=>t.remove(),300)}},8e3)}async logout(){try{await fetch("/api/auth/logout",{method:"POST"})}catch{}this.onLogout()}escapeHtml(e){const t=document.createElement("div");t.textContent=e;return t.innerHTML}escapeAttr(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}}const x4="v1";const k4=58e3;function C4(i,e,t){return\`cloudssh-resume:\${x4}:\${i}:\${e}:\${t}\`}const T4="cloudssh_device_identity";const P4=1;const Mo="keys";const T1="share-device-signing-v1";function OO(){return typeof crypto!=="undefined"&&typeof crypto.subtle!=="undefined"&&typeof crypto.subtle.generateKey==="function"&&typeof indexedDB!=="undefined"}function $4(){return new Promise((i,e)=>{const t=indexedDB.open(T4,P4);t.onupgradeneeded=()=>{if(!t.result.objectStoreNames.contains(Mo)){t.result.createObjectStore(Mo)}};t.onsuccess=()=>i(t.result);t.onerror=()=>e(t.error??new Error("IndexedDB open failed"))})}async function Pw(){const i=await $4();try{const e=await new Promise((s,r)=>{const n=i.transaction(Mo,"readonly");const o=n.objectStore(Mo).get(T1);o.onsuccess=()=>s(o.result);o.onerror=()=>r(o.error??new Error("IndexedDB read failed"))});if((e==null?void 0:e.publicKey)&&(e==null?void 0:e.privateKey))return e;const t=await crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},false,["sign","verify"]);await new Promise((s,r)=>{const n=i.transaction(Mo,"readwrite");n.objectStore(Mo).put(t,T1);n.oncomplete=()=>s();n.onerror=()=>r(n.error??new Error("IndexedDB write failed"));n.onabort=()=>r(n.error??new Error("IndexedDB write aborted"))});return t}finally{i.close()}}function $w(i){const e=new Uint8Array(i);let t="";for(let s=0;s<e.length;s++)t+=String.fromCharCode(e[s]);return btoa(t).replace(/\\+/g,"-").replace(/\\//g,"_").replace(/=+$/g,"")}function E4(){const i=crypto.getRandomValues(new Uint8Array(16));let e="";for(let t=0;t<i.length;t++)e+=i[t].toString(16).padStart(2,"0");return e}async function Q4(){if(!OO())return null;try{const i=await P1();if(!i)return null;const e=await P1();if(!e||e!==i)return null;return i}catch{return null}}async function P1(){const{publicKey:i}=await Pw();const e=await crypto.subtle.exportKey("spki",i);return $w(e)}async function R4(i){if(!OO())return null;try{const{privateKey:e}=await Pw();const t=E4();const s=Date.now();const r=C4(i,t,s);const n=await crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},e,new TextEncoder().encode(r));return{nonce:t,timestamp:s,signature:$w(n)}}catch{return null}}function A4(i){var e;return((e=i.match(/^#\\/share\\/([A-Za-z0-9_-]{40,128})$/))==null?void 0:e[1])??null}function L4(){const i=A4(window.location.hash);if(!i)return null;history.replaceState(null,"",\`\${window.location.pathname}\${window.location.search}\`);return i}function Bt(i,e,t){const s=document.createElement(i);if(e)s.className=e;if(t!==void 0)s.textContent=t;return s}function Kp(i,e){const t=document.createElement("span");t.className=\`material-symbols-outlined\${e?" animate-spin":""}\`;t.style.fontSize="18px";t.textContent=e?"progress_activity":"login";const s=document.createElement("span");s.textContent=e?g("share.claiming"):g("share.claimAndConnect");i.replaceChildren(t,s)}function M4(){var a;const i=Bt("main","w-full max-w-lg relative z-10");i.id="share-landing-card";const e=Bt("div","mb-8 text-center");e.append(Bt("div","text-3xl font-bold text-primary tracking-tighter mb-2","CloudSSH"));i.append(e);const t=Bt("div","cyber-box p-6 shadow-2xl relative");t.append(Bt("div","theme-accent-line absolute top-0 left-0 w-full h-1 bg-gradient-to-r from-transparent via-[var(--accent)] to-transparent opacity-50"));const s=Bt("div","flex items-center justify-between mb-5 pb-4 border-b border-dim");s.append(Bt("span","text-sm font-bold text-primary",g("share.accessTitle")));s.append(Bt("div",void 0));(a=s.lastElementChild)==null?void 0:a.setAttribute("data-language-switcher","");t.append(s);t.append(Bt("p","text-sm text-on-surface mb-4",g("share.accessDescription")));const r
Line truncated
|
|
|
|
|
]\`).replace("lheading",Bw).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()};var I$=/^\\\\([!"#$%&'()*+,\\-./:;<=>?@\\[\\]\\\\^_\`{|}~])/;var D$=/^(\`+)([^\`]|[^\`][\\s\\S]*?[^\`])\\1(?!\`)/;var Dw=/^( {2,}|\\\\)\\n(?!\\s*$)/;var z$=/^(\`+|[^\`])(?:(?= {2,}\\n)|[\\s\\S]*?(?:(?=[\\\\<!\\[\`*_]|\\b_|$)|[^ ](?= {2,}\\n)))/;var ma=/[\\p{P}\\p{S}]/u;var nu=/[\\s\\p{P}\\p{S}]/u;var PO=/[^\\s\\p{P}\\p{S}]/u;var W$=xe(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,nu).getRegex();var zw=/(?!~)[\\p{P}\\p{S}]/u;var q$=/(?!~)[\\s\\p{P}\\p{S}]/u;var X$=/(?:[^\\s\\p{P}\\p{S}]|~)/u;var N$=xe(/link|precode-code|html/,"g").replace("link",/\\[(?:[^\\[\\]\`]|(?<a>\`+)[^\`]+\\k<a>(?!\`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)/).replace("precode-",x$?"(?<!\`)()":"(^^|[^\`])").replace("code",/(?<b>\`+)[^\`]+\\k<b>(?!\`)/).replace("html",/<(?! )[^<>]*?>/).getRegex();var Ww=/^(?:\\*+(?:((?!\\*)punct)|([^\\s*]))?)|^_+(?:((?!_)punct)|([^\\s_]))?/;var F$=xe(Ww,"u").replace(/punct/g,ma).getRegex();var Z$=xe(Ww,"u").replace(/punct/g,zw).getRegex();var qw="^[^_*]*?__[^_*]*?\\\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\\\*)punct(\\\\*+)(?=[\\\\s]|$)|notPunctSpace(\\\\*+)(?!\\\\*)(?=punctSpace|$)|(?!\\\\*)punctSpace(\\\\*+)(?=notPunctSpace)|[\\\\s](\\\\*+)(?!\\\\*)(?=punct)|(?!\\\\*)punct(\\\\*+)(?!\\\\*)(?=punct)|notPunctSpace(\\\\*+)(?=notPunctSpace)";var U$=xe(qw,"gu").replace(/notPunctSpace/g,PO).replace(/punctSpace/g,nu).replace(/punct/g,ma).getRegex();var j$=xe(qw,"gu").replace(/notPunctSpace/g,X$).replace(/punctSpace/g,q$).replace(/punct/g,zw).getRegex();var H$=xe("^[^_*]*?\\\\*\\\\*[^_*]*?_[^_*]*?(?=\\\\*\\\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,PO).replace(/punctSpace/g,nu).replace(/punct/g,ma).getRegex();var V$=xe(/^~~?(?:((?!~)punct)|[^\\s~])/,"u").replace(/punct/g,ma).getRegex();var Y$="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)";var G$=xe(Y$,"gu").replace(/notPunctSpace/g,PO).replace(/punctSpace/g,nu).replace(/punct/g,ma).getRegex();var K$=xe(/\\\\(punct)/,"gu").replace(/punct/g,ma).getRegex();var J$=xe(/^<(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();var eE=xe(CO).replace("(?:-->|$)","-->").getRegex();var tE=xe("^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",eE).replace("attribute",/\\s+[a-zA-Z:_][\\w.:-]*(?:\\s*=\\s*"[^"]*"|\\s*=\\s*'[^']*'|\\s*=\\s*[^\\s"'=<>\`]+)?/).getRegex();var ad=/(?:\\[(?:\\\\[\\s\\S]|[^\\[\\]\\\\])*\\]|\\\\[\\s\\S]|\`+(?!\`)[^\`]*?\`+(?!\`)|\`\`+(?=\\])|[^\\[\\]\\\\\`])*?/;var iE=xe(/^!?\\[(label)\\]\\(\\s*(href)(?:(?:[ \\t]+(?:\\n[ \\t]*)?|\\n[ \\t]*)(title))?\\s*\\)/).replace("label",ad).replace("href",/<(?:\\\\.|[^\\n<>\\\\])+>|[^ \\t\\n\\x00-\\x1f]*/).replace("title",/"(?:\\\\"?|[^"\\\\])*"|'(?:\\\\'?|[^'\\\\])*'|\\((?:\\\\\\)?|[^)\\\\])*\\)/).getRegex();var Xw=xe(/^!?\\[(label)\\]\\[(ref)\\]/).replace("label",ad).replace("ref",kO).getRegex();var Nw=xe(/^!?\\[(ref)\\](?:\\[\\])?/).replace("ref",kO).getRegex();var sE=xe("reflink|nolink(?!\\\\()","g").replace("reflink",Xw).replace("nolink",Nw).getRegex();var H1=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;var $O={_backpedal:Pn,anyPunctuation:K$,autolink:J$,blockSkip:N$,br:Dw,code:D$,del:Pn,delLDelim:Pn,delRDelim:Pn,emStrongLDelim:F$,emStrongRDelimAst:U$,emStrongRDelimUnd:H$,escape:I$,link:iE,nolink:Nw,punctuation:W$,reflink:Xw,reflinkSearch:sE,tag:tE,text:z$,url:Pn};var rE={...$O,link:xe(/^!?\\[(label)\\]\\((.*?)\\)/).replace("label",ad).getRegex(),reflink:xe(/^!?\\[(label)\\]\\s*\\[([^\\]]*)\\]/).replace("label",ad).getRegex()};var im={...$O,emStrongRDelimAst:j$,emStrongLDelim:Z$,delLDelim:V$,delRDelim:G$,url:xe(/^((?:protocol):\\/\\/|www\\.)(?:[a-zA-Z0-9\\-]+\\.?)+[^\\s<]*|^email/).replace("protocol",H1).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:xe(/^([\`~]+|[^\`~])(?:(?= {2,}\\n)|(?=[a-zA-Z0-9.!#$%&'*+\\/=?_\`{\\|}~-]+@)|[\\s\\S]*?(?:(?=[\\\\<!\\[\`*~_]|\\b_|protocol:\\/\\/|www\\.|$)|[^ ](?= {2,}\\n)|[^a-zA-Z0-9.!#$%&'*+\\/=?_\`{\\|}~-](?=[a-zA-Z0-9.!#$%&'*+\\/=?_\`{\\|}
Line truncated
|
|
|
|
|
\`}}showDebugNotification(e){const t=document.createElement("div");t.className="fixed bottom-4 right-4 z-[200] max-w-md p-4 rounded-lg shadow-2xl border border-[var(--accent)] bg-[var(--bg-surface)] text-[var(--text)] font-mono text-[11px] leading-relaxed custom-scrollbar";t.style.maxHeight="300px";t.style.overflowY="auto";const s=document.createElement("div");s.className="text-[var(--accent)] font-bold mb-2 text-xs";s.textContent="[locationHint 调试信息]";t.appendChild(s);const r=document.createElement("div");r.className="text-muted whitespace-pre-wrap";r.textContent=e.join("\\n");t.appendChild(r);const n=document.createElement("button");n.className="absolute top-2 right-2 text-muted hover:text-[var(--accent)] cursor-pointer";n.innerHTML='<span class="material-symbols-outlined" style="font-size: 16px;">close</span>';n.onclick=()=>t.remove();t.appendChild(n);document.body.appendChild(t);setTimeout(()=>{if(t.parentNode){t.style.transition="opacity 0.3s";t.style.opacity="0";setTimeout(()=>t.remove(),300)}},8e3)}async logout(){try{await fetch("/api/auth/logout",{method:"POST"})}catch{}this.onLogout()}escapeHtml(e){const t=document.createElement("div");t.textContent=e;return t.innerHTML}escapeAttr(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}}const x4="v1";const k4=58e3;function C4(i,e,t){return\`cloudssh-resume:\${x4}:\${i}:\${e}:\${t}\`}const T4="cloudssh_device_identity";const P4=1;const Mo="keys";const T1="share-device-signing-v1";function OO(){return typeof crypto!=="undefined"&&typeof crypto.subtle!=="undefined"&&typeof crypto.subtle.generateKey==="function"&&typeof indexedDB!=="undefined"}function $4(){return new Promise((i,e)=>{const t=indexedDB.open(T4,P4);t.onupgradeneeded=()=>{if(!t.result.objectStoreNames.contains(Mo)){t.result.createObjectStore(Mo)}};t.onsuccess=()=>i(t.result);t.onerror=()=>e(t.error??new Error("IndexedDB open failed"))})}async function Pw(){const i=await $4();try{const e=await new Promise((s,r)=>{const n=i.transaction(Mo,"readonly");const o=n.objectStore(Mo).get(T1);o.onsuccess=()=>s(o.result);o.onerror=()=>r(o.error??new Error("IndexedDB read failed"))});if((e==null?void 0:e.publicKey)&&(e==null?void 0:e.privateKey))return e;const t=await crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},false,["sign","verify"]);await new Promise((s,r)=>{const n=i.transaction(Mo,"readwrite");n.objectStore(Mo).put(t,T1);n.oncomplete=()=>s();n.onerror=()=>r(n.error??new Error("IndexedDB write failed"));n.onabort=()=>r(n.error??new Error("IndexedDB write aborted"))});return t}finally{i.close()}}function $w(i){const e=new Uint8Array(i);let t="";for(let s=0;s<e.length;s++)t+=String.fromCharCode(e[s]);return btoa(t).replace(/\\+/g,"-").replace(/\\//g,"_").replace(/=+$/g,"")}function E4(){const i=crypto.getRandomValues(new Uint8Array(16));let e="";for(let t=0;t<i.length;t++)e+=i[t].toString(16).padStart(2,"0");return e}async function Q4(){if(!OO())return null;try{const i=await P1();if(!i)return null;const e=await P1();if(!e||e!==i)return null;return i}catch{return null}}async function P1(){const{publicKey:i}=await Pw();const e=await crypto.subtle.exportKey("spki",i);return $w(e)}async function R4(i){if(!OO())return null;try{const{privateKey:e}=await Pw();const t=E4();const s=Date.now();const r=C4(i,t,s);const n=await crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},e,new TextEncoder().encode(r));return{nonce:t,timestamp:s,signature:$w(n)}}catch{return null}}function A4(i){var e;return((e=i.match(/^#\\/share\\/([A-Za-z0-9_-]{40,128})$/))==null?void 0:e[1])??null}function L4(){const i=A4(window.location.hash);if(!i)return null;history.replaceState(null,"",\`\${window.location.pathname}\${window.location.search}\`);return i}function Bt(i,e,t){const s=document.createElement(i);if(e)s.className=e;if(t!==void 0)s.textContent=t;return s}function Kp(i,e){const t=document.createElement("span");t.className=\`material-symbols-outlined\${e?" animate-spin":""}\`;t.style.fontSize="18px";t.textContent=e?"progress_activity":"login";const s=document.createElement("span");s.textContent=e?g("share.claiming"):g("share.claimAndConnect");i.replaceChildren(t,s)}function M4(){var a;const i=Bt("main","w-full max-w-lg relative z-10");i.id="share-landing-card";const e=Bt("div","mb-8 text-center");e.append(Bt("div","text-3xl font-bold text-primary tracking-tighter mb-2","CloudSSH"));i.append(e);const t=Bt("div","cyber-box p-6 shadow-2xl relative");t.append(Bt("div","theme-accent-line absolute top-0 left-0 w-full h-1 bg-gradient-to-r from-transparent via-[var(--accent)] to-transparent opacity-50"));const s=Bt("div","flex items-center justify-between mb-5 pb-4 border-b border-dim");s.append(Bt("span","text-sm font-bold text-primary",g("share.accessTitle")));s.append(Bt("div",void 0));(a=s.lastElementChild)==null?void 0:a.setAttribute("data-language-switcher","");t.append(s);t.append(Bt("p","text-sm text-on-surface mb-4",g("share.accessDescription")));const r
Line truncated
|
|
|
|
|
]\`).replace("lheading",Bw).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()};var I$=/^\\\\([!"#$%&'()*+,\\-./:;<=>?@\\[\\]\\\\^_\`{|}~])/;var D$=/^(\`+)([^\`]|[^\`][\\s\\S]*?[^\`])\\1(?!\`)/;var Dw=/^( {2,}|\\\\)\\n(?!\\s*$)/;var z$=/^(\`+|[^\`])(?:(?= {2,}\\n)|[\\s\\S]*?(?:(?=[\\\\<!\\[\`*_]|\\b_|$)|[^ ](?= {2,}\\n)))/;var ma=/[\\p{P}\\p{S}]/u;var nu=/[\\s\\p{P}\\p{S}]/u;var PO=/[^\\s\\p{P}\\p{S}]/u;var W$=ke(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,nu).getRegex();var zw=/(?!~)[\\p{P}\\p{S}]/u;var q$=/(?!~)[\\s\\p{P}\\p{S}]/u;var X$=/(?:[^\\s\\p{P}\\p{S}]|~)/u;var N$=ke(/link|precode-code|html/,"g").replace("link",/\\[(?:[^\\[\\]\`]|(?<a>\`+)[^\`]+\\k<a>(?!\`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)/).replace("precode-",x$?"(?<!\`)()":"(^^|[^\`])").replace("code",/(?<b>\`+)[^\`]+\\k<b>(?!\`)/).replace("html",/<(?! )[^<>]*?>/).getRegex();var Ww=/^(?:\\*+(?:((?!\\*)punct)|([^\\s*]))?)|^_+(?:((?!_)punct)|([^\\s_]))?/;var F$=ke(Ww,"u").replace(/punct/g,ma).getRegex();var Z$=ke(Ww,"u").replace(/punct/g,zw).getRegex();var qw="^[^_*]*?__[^_*]*?\\\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\\\*)punct(\\\\*+)(?=[\\\\s]|$)|notPunctSpace(\\\\*+)(?!\\\\*)(?=punctSpace|$)|(?!\\\\*)punctSpace(\\\\*+)(?=notPunctSpace)|[\\\\s](\\\\*+)(?!\\\\*)(?=punct)|(?!\\\\*)punct(\\\\*+)(?!\\\\*)(?=punct)|notPunctSpace(\\\\*+)(?=notPunctSpace)";var U$=ke(qw,"gu").replace(/notPunctSpace/g,PO).replace(/punctSpace/g,nu).replace(/punct/g,ma).getRegex();var j$=ke(qw,"gu").replace(/notPunctSpace/g,X$).replace(/punctSpace/g,q$).replace(/punct/g,zw).getRegex();var H$=ke("^[^_*]*?\\\\*\\\\*[^_*]*?_[^_*]*?(?=\\\\*\\\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,PO).replace(/punctSpace/g,nu).replace(/punct/g,ma).getRegex();var V$=ke(/^~~?(?:((?!~)punct)|[^\\s~])/,"u").replace(/punct/g,ma).getRegex();var Y$="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)";var G$=ke(Y$,"gu").replace(/notPunctSpace/g,PO).replace(/punctSpace/g,nu).replace(/punct/g,ma).getRegex();var K$=ke(/\\\\(punct)/,"gu").replace(/punct/g,ma).getRegex();var J$=ke(/^<(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();var eE=ke(CO).replace("(?:-->|$)","-->").getRegex();var tE=ke("^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",eE).replace("attribute",/\\s+[a-zA-Z:_][\\w.:-]*(?:\\s*=\\s*"[^"]*"|\\s*=\\s*'[^']*'|\\s*=\\s*[^\\s"'=<>\`]+)?/).getRegex();var ad=/(?:\\[(?:\\\\[\\s\\S]|[^\\[\\]\\\\])*\\]|\\\\[\\s\\S]|\`+(?!\`)[^\`]*?\`+(?!\`)|\`\`+(?=\\])|[^\\[\\]\\\\\`])*?/;var iE=ke(/^!?\\[(label)\\]\\(\\s*(href)(?:(?:[ \\t]+(?:\\n[ \\t]*)?|\\n[ \\t]*)(title))?\\s*\\)/).replace("label",ad).replace("href",/<(?:\\\\.|[^\\n<>\\\\])+>|[^ \\t\\n\\x00-\\x1f]*/).replace("title",/"(?:\\\\"?|[^"\\\\])*"|'(?:\\\\'?|[^'\\\\])*'|\\((?:\\\\\\)?|[^)\\\\])*\\)/).getRegex();var Xw=ke(/^!?\\[(label)\\]\\[(ref)\\]/).replace("label",ad).replace("ref",kO).getRegex();var Nw=ke(/^!?\\[(ref)\\](?:\\[\\])?/).replace("ref",kO).getRegex();var sE=ke("reflink|nolink(?!\\\\()","g").replace("reflink",Xw).replace("nolink",Nw).getRegex();var H1=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;var $O={_backpedal:Pn,anyPunctuation:K$,autolink:J$,blockSkip:N$,br:Dw,code:D$,del:Pn,delLDelim:Pn,delRDelim:Pn,emStrongLDelim:F$,emStrongRDelimAst:U$,emStrongRDelimUnd:H$,escape:I$,link:iE,nolink:Nw,punctuation:W$,reflink:Xw,reflinkSearch:sE,tag:tE,text:z$,url:Pn};var rE={...$O,link:ke(/^!?\\[(label)\\]\\((.*?)\\)/).replace("label",ad).getRegex(),reflink:ke(/^!?\\[(label)\\]\\s*\\[([^\\]]*)\\]/).replace("label",ad).getRegex()};var im={...$O,emStrongRDelimAst:j$,emStrongLDelim:Z$,delLDelim:V$,delRDelim:G$,url:ke(/^((?:protocol):\\/\\/|www\\.)(?:[a-zA-Z0-9\\-]+\\.?)+[^\\s<]*|^email/).replace("protocol",H1).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:ke(/^([\`~]+|[^\`~])(?:(?= {2,}\\n)|(?=[a-zA-Z0-9.!#$%&'*+\\/=?_\`{\\|}~-]+@)|[\\s\\S]*?(?:(?=[\\\\<!\\[\`*~_]|\\b_|protocol:\\/\\/|www\\.|$)|[^ ](?= {2,}\\n)|[^a-zA-Z0-9.!#$%&'*+\\/=?_\`{\\|}~-](?=[a-zA-Z0-9.!#$%&'*+\\/=?_\`{\\|}
Line truncated
|
|
|
|
|
\`),t=e.length-1;for(;t>=0&&Yt.blankLine.test(e[t]);)t--;return e.length-t<=2?i:e.slice(0,t+1).join(\`
|
|
|
|
|
\`)}function aE(i,e){if(i.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<i.length;s++)if(i[s]==="\\\\")s++;else if(i[s]===e[0])t++;else if(i[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function lE(i,e=0){let t=e,s="";for(let r of i)if(r===" "){let n=4-t%4;s+=" ".repeat(n),t+=n}else s+=r,t++;return s}function J1(i,e,t,s,r){let n=e.href,o=e.title||null,a=i[1].replace(r.other.outputLinkReplace,"$1");s.state.inLink=true;let l={type:i[0].charAt(0)==="!"?"image":"link",raw:t,href:n,title:o,text:a,tokens:s.inlineTokens(a)};return s.state.inLink=false,l}function hE(i,e,t){let s=i.match(t.other.indentCodeCompensation);if(s===null)return e;let r=s[1];return e.split(\`
|
|
|
|
|
\`).map(n=>{let o=n.match(t.other.beginningSpace);if(o===null)return n;let[a]=o;return a.length>=r.length?n.slice(r.length):n}).join(\`
|
|
|
|
@@ -423,14 +423,14 @@ export const HTML = `<!doctype html>
|
|
|
|
|
\${e}</tr>
|
|
|
|
|
\`}tablecell(e){let t=this.parser.parseInline(e.tokens),s=e.header?"th":"td";return(e.align?\`<\${s} align="\${e.align}">\`:\`<\${s}>\`)+t+\`</\${s}>
|
|
|
|
|
\`}strong({tokens:e}){return\`<strong>\${this.parser.parseInline(e)}</strong>\`}em({tokens:e}){return\`<em>\${this.parser.parseInline(e)}</em>\`}codespan({text:e}){return\`<code>\${ws(e,true)}</code>\`}br(e){return"<br>"}del({tokens:e}){return\`<del>\${this.parser.parseInline(e)}</del>\`}link({href:e,title:t,tokens:s}){let r=this.parser.parseInline(s),n=Y1(e);if(n===null)return r;e=n;let o='<a href="'+e+'"';return t&&(o+=' title="'+ws(t)+'"'),o+=">"+r+"</a>",o}image({href:e,title:t,text:s,tokens:r}){r&&(s=this.parser.parseInline(r,this.parser.textRenderer));let n=Y1(e);if(n===null)return ws(s);e=n;let o=\`<img src="\${e}" alt="\${ws(s)}"\`;return t&&(o+=\` title="\${ws(t)}"\`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:ws(e.text)}};var EO=class PU{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}};var is=class rm{constructor(e){b(this,"options");b(this,"renderer");b(this,"textRenderer");this.options=e||lo,this.options.renderer=this.options.renderer||new hd,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new EO}static parse(e,t){return new rm(t).parse(e)}static parseInline(e,t){return new rm(t).parseInline(e)}parse(e){var s,r;this.renderer.parser=this;let t="";for(let n=0;n<e.length;n++){let o=e[n];if((r=(s=this.options.extensions)==null?void 0:s.renderers)==null?void 0:r[o.type]){let l=o,h=this.options.extensions.renderers[l.type].call({parser:this},l);if(h!==false||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){t+=h||"";continue}}let a=o;switch(a.type){case"space":{t+=this.renderer.space(a);break}case"hr":{t+=this.renderer.hr(a);break}case"heading":{t+=this.renderer.heading(a);break}case"code":{t+=this.renderer.code(a);break}case"table":{t+=this.renderer.table(a);break}case"blockquote":{t+=this.renderer.blockquote(a);break}case"list":{t+=this.renderer.list(a);break}case"checkbox":{t+=this.renderer.checkbox(a);break}case"html":{t+=this.renderer.html(a);break}case"def":{t+=this.renderer.def(a);break}case"paragraph":{t+=this.renderer.paragraph(a);break}case"text":{t+=this.renderer.text(a);break}default:{let l='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return t}parseInline(e,t=this.renderer){var r,n;this.renderer.parser=this;let s="";for(let o=0;o<e.length;o++){let a=e[o];if((n=(r=this.options.extensions)==null?void 0:r.renderers)==null?void 0:n[a.type]){let h=this.options.extensions.renderers[a.type].call({parser:this},a);if(h!==false||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){s+=h||"";continue}}let l=a;switch(l.type){case"escape":{s+=t.text(l);break}case"html":{s+=t.html(l);break}case"link":{s+=t.link(l);break}case"image":{s+=t.image(l);break}case"checkbox":{s+=t.checkbox(l);break}case"strong":{s+=t.strong(l);break}case"em":{s+=t.em(l);break}case"codespan":{s+=t.codespan(l);break}case"br":{s+=t.br(l);break}case"del":{s+=t.del(l);break}case"text":{s+=t.text(l);break}default:{let h='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return s}};var fl;var el=(fl=class{constructor(e){b(this,"options");b(this,"block");this.options=e||lo}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?ts.lex:ts.lexInline}provideParser(e=this.block){return e?is.parse:is.parseInline}},b(fl,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),b(fl,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),fl);var cE=class $U{constructor(...e){b(this,"defaults",SO());b(this,"options",this.setOptions);b(this,"parse",this.parseMarkdown(true));b(this,"parseInline",this.parseMarkdown(false));b(this,"Parser",is);b(this,"Renderer",hd);b(this,"TextRenderer",EO);b(this,"Lexer",ts);b(this,"Tokenizer",ld);b(this,"Hooks",el);this.use(...e)}walkTokens(e,t){var r,n;let s=[];for(let o of e)switch(s=s.concat(t.call(this,o)),o.type){case"table":{let a=o;for(let l of a.header)s=s.concat(this.walkTokens(l.tokens,t));for(let l of a.rows)for(let h of l)s=s.concat(this.walkTokens(h.tokens,t));break}case"list":{let a=o;s=s.concat(this.walkTokens(a.items,t));break}default:{let a=o;((n=(r=this.defaults.extensions)==null?void 0:r.childTokens)==null?void 0:n[a.type])?this.defaults.extensions.childTokens[a.type].forEach(l=>{let h=a[l].flat(1/0);s=s.concat(this.walkTokens(h,t))}):a.tokens&&(s=s.concat(this.walkTokens(a.tokens,t)))}}return s}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(s=>{l
Line truncated
|
|
|
|
|
Please report this to https://github.com/markedjs/marked.\`,e){let r="<p>An error occurred:</p><pre>"+ws(s.message+"",true)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(s);throw s}}};var Vn=new cE;function Qe(i,e){return Vn.parse(i,e)}Qe.options=Qe.setOptions=function(i){return Vn.setOptions(i),Qe.defaults=Vn.defaults,Lw(Qe.defaults),Qe};Qe.getDefaults=SO;Qe.defaults=lo;Qe.use=function(...i){return Vn.use(...i),Qe.defaults=Vn.defaults,Lw(Qe.defaults),Qe};Qe.walkTokens=function(i,e){return Vn.walkTokens(i,e)};Qe.parseInline=Vn.parseInline;Qe.Parser=is;Qe.parser=is.parse;Qe.Renderer=hd;Qe.TextRenderer=EO;Qe.Lexer=ts;Qe.lexer=ts.lex;Qe.Tokenizer=ld;Qe.Hooks=el;Qe.parse=Qe;Qe.options;Qe.setOptions;Qe.use;Qe.walkTokens;Qe.parseInline;is.parse;ts.lex;const dE=10;const uE=50;const fE=64;const pE=512;const mE=["credential","config","rule","note"];const gE=/^(.*_)?(password|passwd|secret|token|api_?key|auth_?token|credential|private_?key)(_.*)?$/i;const OE=[/-----BEGIN\\s+[A-Z\\s]*PRIVATE\\s+KEY-----/i,/(?:password|passwd|secret|api[_-]?key|access[_-]?token|auth_?token)\\s*[:=]\\s*[^\\s]+/i,/bearer\\s+[a-zA-Z0-9_.-]{16,}/i,/\\b(?:sk-[a-zA-Z0-9_-]{20,}|gh[pousr]_[a-zA-Z0-9]{20,}|xox[baprs]-[a-zA-Z0-9]{10,})\\b/i];function Fw(i,e){if(gE.test(i.trim()))return true;return OE.some(t=>t.test(e))}function _E(i){if(typeof i.key!=="string")return{ok:false,error:"keyRequired"};const e=i.key.trim();if(!e)return{ok:false,error:"keyRequired"};if([...e].length>fE){return{ok:false,error:"keyTooLong"}}if(typeof i.value!=="string")return{ok:false,error:"valueRequired"};const t=i.value.trim();if(!t)return{ok:false,error:"valueRequired"};if([...t].length>pE){return{ok:false,error:"valueTooLong"}}let s="note";if(typeof i.category==="string"&&mE.includes(i.category)){s=i.category}else if(Fw(e,t)){s="credential"}return{ok:true,value:{category:s,key:e,value:t}}}function e_(i,e){if(!e){const t=new Date(i);return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hours:t.getHours(),minutes:t.getMinutes(),seconds:t.getSeconds(),dayOfWeek:t.getDay()}}try{const t=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:false,weekday:"short"});const s=t.formatToParts(new Date(i));const r={};for(const a of s){r[a.type]=a.value}const n=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];const o=n.includes(r.weekday)?n.indexOf(r.weekday):new Date(i).getDay();return{year:parseInt(r.year,10),month:parseInt(r.month,10),day:parseInt(r.day,10),hours:parseInt(r.hour,10)===24?0:parseInt(r.hour,10),minutes:parseInt(r.minute,10),seconds:parseInt(r.second,10),dayOfWeek:o}}catch{const t=new Date(i);return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hours:t.getHours(),minutes:t.getMinutes(),seconds:t.getSeconds(),dayOfWeek:t.getDay()}}}function vE(i,e=Date.now(),t="zh-CN",s){const r=t==="en-US";const n=e_(i,s);const o=e_(e,s);const a=v=>String(v).padStart(2,"0");const l=n.year;const h=a(n.month);const c=a(n.day);const d=a(n.hours);const u=a(n.minutes);const f=new Date(Date.UTC(n.year,n.month-1,n.day)).getTime();const p=new Date(Date.UTC(o.year,o.month-1,o.day)).getTime();const m=Math.round((p-f)/864e5);let O="";if(m===0){O=r?"Today":"今天"}else if(m===1){O=r?"Yesterday":"昨天"}else if(m===2){O=r?"2 days ago":"前天"}else if(m>2&&m<=30){O=r?\`\${m} days ago\`:\`\${m}天前\`}else{O=\`\${l}-\${h}-\${c}\`}return\`\${l}-\${h}-\${c} \${d}:\${u} (\${O})\`}const yE=new Set(["bash","cmd","fish","powershell","pwsh","sh","shell","shellscript","zsh"]);function Zw(i){return(i||"").trim().split(/\\s+/,1)[0].toLowerCase().replace(/^language-/,"")}function bE(i,e){if(!yE.has(Zw(i)))return null;const t=e.replace(/\\r\\n?/g,"\\n").trim();if(!t||t.includes("\\n"))return null;if(/[\\u0000-\\u001f\\u007f]/.test(t))return null;return t.startsWith("$ ")?t.slice(2).trimStart()||null:t}function SE(i,e){if(!i.trim())return null;return{content:i,sourceLabel:e.trim(),lineCount:i.split(/\\r\\n|\\r|\\n/).length,characterCount:i.length}}function wE(i,e){return g("agent.selectionContextPrompt",{source:e.sourceLabel||g("agent.selectionUnknownSource"),content:e.content,question:i.trim()})}Qe.use({gfm:true,renderer:{code({text:i,lang:e}){const t=Zw(e);const s=t?\`<span class="agent-md-lang">\${Te(t)}</span>\`:'<span class="agent-md-lang" aria-hidden="true"></span>';return\`<div class="agent-md-code-block" data-code-language="\${Te(t)}">
|
|
|
|
|
Please report this to https://github.com/markedjs/marked.\`,e){let r="<p>An error occurred:</p><pre>"+ws(s.message+"",true)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(s);throw s}}};var Vn=new cE;function Qe(i,e){return Vn.parse(i,e)}Qe.options=Qe.setOptions=function(i){return Vn.setOptions(i),Qe.defaults=Vn.defaults,Lw(Qe.defaults),Qe};Qe.getDefaults=SO;Qe.defaults=lo;Qe.use=function(...i){return Vn.use(...i),Qe.defaults=Vn.defaults,Lw(Qe.defaults),Qe};Qe.walkTokens=function(i,e){return Vn.walkTokens(i,e)};Qe.parseInline=Vn.parseInline;Qe.Parser=is;Qe.parser=is.parse;Qe.Renderer=hd;Qe.TextRenderer=EO;Qe.Lexer=ts;Qe.lexer=ts.lex;Qe.Tokenizer=ld;Qe.Hooks=el;Qe.parse=Qe;Qe.options;Qe.setOptions;Qe.use;Qe.walkTokens;Qe.parseInline;is.parse;ts.lex;const dE=10;const uE=50;const fE=64;const pE=512;const mE=["credential","config","rule","note"];const gE=/^(.*_)?(password|passwd|secret|token|api_?key|auth_?token|credential|private_?key)(_.*)?$/i;const OE=[/-----BEGIN\\s+[A-Z\\s]*PRIVATE\\s+KEY-----/i,/(?:password|passwd|secret|api[_-]?key|access[_-]?token|auth_?token)\\s*[:=]\\s*[^\\s]+/i,/bearer\\s+[a-zA-Z0-9_.-]{16,}/i,/\\b(?:sk-[a-zA-Z0-9_-]{20,}|gh[pousr]_[a-zA-Z0-9]{20,}|xox[baprs]-[a-zA-Z0-9]{10,})\\b/i];function Fw(i,e){if(gE.test(i.trim()))return true;return OE.some(t=>t.test(e))}function _E(i){if(typeof i.key!=="string")return{ok:false,error:"keyRequired"};const e=i.key.trim();if(!e)return{ok:false,error:"keyRequired"};if([...e].length>fE){return{ok:false,error:"keyTooLong"}}const t=i.action==="delete"?"delete":"set";if(t==="delete"){return{ok:true,value:{action:"delete",category:"note",key:e,value:""}}}if(typeof i.value!=="string")return{ok:false,error:"valueRequired"};const s=i.value.trim();if(!s)return{ok:false,error:"valueRequired"};if([...s].length>pE){return{ok:false,error:"valueTooLong"}}let r="note";if(typeof i.category==="string"&&mE.includes(i.category)){r=i.category}else if(Fw(e,s)){r="credential"}return{ok:true,value:{action:"set",category:r,key:e,value:s}}}function e_(i,e){if(!e){const t=new Date(i);return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hours:t.getHours(),minutes:t.getMinutes(),seconds:t.getSeconds(),dayOfWeek:t.getDay()}}try{const t=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:false,weekday:"short"});const s=t.formatToParts(new Date(i));const r={};for(const a of s){r[a.type]=a.value}const n=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];const o=n.includes(r.weekday)?n.indexOf(r.weekday):new Date(i).getDay();return{year:parseInt(r.year,10),month:parseInt(r.month,10),day:parseInt(r.day,10),hours:parseInt(r.hour,10)===24?0:parseInt(r.hour,10),minutes:parseInt(r.minute,10),seconds:parseInt(r.second,10),dayOfWeek:o}}catch{const t=new Date(i);return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hours:t.getHours(),minutes:t.getMinutes(),seconds:t.getSeconds(),dayOfWeek:t.getDay()}}}function vE(i,e=Date.now(),t="zh-CN",s){const r=t==="en-US";const n=e_(i,s);const o=e_(e,s);const a=v=>String(v).padStart(2,"0");const l=n.year;const h=a(n.month);const c=a(n.day);const d=a(n.hours);const u=a(n.minutes);const f=new Date(Date.UTC(n.year,n.month-1,n.day)).getTime();const p=new Date(Date.UTC(o.year,o.month-1,o.day)).getTime();const m=Math.round((p-f)/864e5);let O="";if(m===0){O=r?"Today":"今天"}else if(m===1){O=r?"Yesterday":"昨天"}else if(m===2){O=r?"2 days ago":"前天"}else if(m>2&&m<=30){O=r?\`\${m} days ago\`:\`\${m}天前\`}else{O=\`\${l}-\${h}-\${c}\`}return\`\${l}-\${h}-\${c} \${d}:\${u} (\${O})\`}const yE=new Set(["bash","cmd","fish","powershell","pwsh","sh","shell","shellscript","zsh"]);function Zw(i){return(i||"").trim().split(/\\s+/,1)[0].toLowerCase().replace(/^language-/,"")}function bE(i,e){if(!yE.has(Zw(i)))return null;const t=e.replace(/\\r\\n?/g,"\\n").trim();if(!t||t.includes("\\n"))return null;if(/[\\u0000-\\u001f\\u007f]/.test(t))return null;return t.startsWith("$ ")?t.slice(2).trimStart()||null:t}function SE(i,e){if(!i.trim())return null;return{content:i,sourceLabel:e.trim(),lineCount:i.split(/\\r\\n|\\r|\\n/).length,characterCount:i.length}}function wE(i,e){return g("agent.selectionContextPrompt",{source:e.sourceLabel||g("agent.selectionUnknownSource"),content:e.content,question:i.trim()})}Qe.use({gfm:true,renderer:{code({text:i,lang:e}){const t=Zw(e);const s=t?\`<span class="agent-md-lang">\${Se(t)}</span>\`:'<span class="agent-md-lang" aria-hidden="true"></span>';return\`<div class="agent-md-code-block" data-code-language="\${Se(t)}">
|
|
|
|
|
<div class="agent-md-code-toolbar">
|
|
|
|
|
\${s}
|
|
|
|
|
<div class="agent-md-code-meta"></div>
|
|
|
|
|
<div class="agent-md-code-actions"></div>
|
|
|
|
|
</div>
|
|
|
|
|
<pre class="agent-md-pre"><code>\${Te(i)}</code></pre>
|
|
|
|
|
</div>\`},codespan({text:i}){return\`<code class="agent-md-inline-code">\${Te(i)}</code>\`},link({href:i,title:e,text:t}){const s=e?\` title="\${Te(e)}"\`:"";return\`<a href="\${Te(i)}"\${s} target="_blank" rel="noopener noreferrer" class="agent-md-link">\${t}</a>\`},image({href:i,title:e,text:t}){const s=e?\` title="\${Te(e)}"\`:"";return\`<img src="\${Te(i)}"\${s} alt="\${Te(t)}" class="agent-md-img" loading="lazy">\`}}});function Te(i){if(!i)return"";return i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}class xE{constructor(e,t,s){b(this,"panelEl",null);b(this,"messagesEl",null);b(this,"contextEl",null);b(this,"inputEl",null);b(this,"sendBtn",null);b(this,"isVisible",false);b(this,"isAgentRunning",false);b(this,"isWaitingConfirmation",false);b(this,"wsSend",null);b(this,"getTerminalFillTarget",null);b(this,"fillTerminalInput",null);b(this,"onLayoutChange");b(this,"streamingEl",null);b(this,"streamingText","");b(this,"thinkingProcessEl",null);b(this,"thinkingStepsEl",null);b(this,"thinkingCurrentEl",null);b(this,"thinkingStatusEl",null);b(this,"thinkingIsDone",false);b(this,"thinkingStepCount",0);b(this,"thinkingLiveEl",null);b(this,"thinkingAllSteps",[]);b(this,"livePreviewCache",[]);b(this,"localeCleanup",null);b(this,"pendingTerminalSelection",null);b(this,"pendingConfirmation",null);b(this,"isMemoryDrawerOpen",false);b(this,"activeMemoryTab","workLog");b(this,"unifiedMemory",{workLogs:[],knowledge:[]});b(this,"memoryDrawerEl",null);b(this,"memoryTabWorkLogBtn",null);b(this,"memoryTabKnowledgeBtn",null);b(this,"memoryContentEl",null);b(this,"memoryCountEl",null);b(this,"memoryAddBtn",null);b(this,"memoryAddFormContainerEl",null);b(this,"revealedSecretIds",new Set);this.parentEl=e;this.isLoggedIn=t;this.serverId=s}setServerId(e){this.serverId=e;this.revealedSecretIds.clear();if(this.isMemoryDrawerOpen){void this.fetchServerMemory()}else if(this.isVisible&&this.serverId){void this.fetchServerMemory()}}setLayoutChangeHandler(e){this.onLayoutChange=e}setWebSocketSend(e){this.wsSend=e}setTerminalFillHandler(e,t){this.getTerminalFillTarget=e;this.fillTerminalInput=t}render(){if(this.panelEl)return;this.panelEl=document.createElement("div");this.panelEl.id="agent-panel";this.panelEl.className="shrink-0 border-l border-[var(--border)] flex flex-col bg-[var(--bg)] overflow-hidden h-full relative";this.panelEl.style.width="min(clamp(420px, 40vw, 600px), 100%)";this.panelEl.style.display="none";this.panelEl.innerHTML=\`
|
|
|
|
|
<pre class="agent-md-pre"><code>\${Se(i)}</code></pre>
|
|
|
|
|
</div>\`},codespan({text:i}){return\`<code class="agent-md-inline-code">\${Se(i)}</code>\`},link({href:i,title:e,text:t}){const s=e?\` title="\${Se(e)}"\`:"";return\`<a href="\${Se(i)}"\${s} target="_blank" rel="noopener noreferrer" class="agent-md-link">\${t}</a>\`},image({href:i,title:e,text:t}){const s=e?\` title="\${Se(e)}"\`:"";return\`<img src="\${Se(i)}"\${s} alt="\${Se(t)}" class="agent-md-img" loading="lazy">\`}}});function Se(i){if(!i)return"";return i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}class xE{constructor(e,t,s){b(this,"panelEl",null);b(this,"messagesEl",null);b(this,"contextEl",null);b(this,"inputEl",null);b(this,"sendBtn",null);b(this,"isVisible",false);b(this,"isAgentRunning",false);b(this,"isWaitingConfirmation",false);b(this,"wsSend",null);b(this,"getTerminalFillTarget",null);b(this,"fillTerminalInput",null);b(this,"onLayoutChange");b(this,"streamingEl",null);b(this,"streamingText","");b(this,"thinkingProcessEl",null);b(this,"thinkingStepsEl",null);b(this,"thinkingCurrentEl",null);b(this,"thinkingStatusEl",null);b(this,"thinkingIsDone",false);b(this,"thinkingStepCount",0);b(this,"thinkingLiveEl",null);b(this,"thinkingAllSteps",[]);b(this,"livePreviewCache",[]);b(this,"localeCleanup",null);b(this,"pendingTerminalSelection",null);b(this,"pendingConfirmation",null);b(this,"isMemoryDrawerOpen",false);b(this,"activeMemoryTab","workLog");b(this,"unifiedMemory",{workLogs:[],knowledge:[]});b(this,"memoryDrawerEl",null);b(this,"memoryTabWorkLogBtn",null);b(this,"memoryTabKnowledgeBtn",null);b(this,"memoryContentEl",null);b(this,"memoryCountEl",null);b(this,"memoryAddBtn",null);b(this,"memoryAddFormContainerEl",null);b(this,"revealedSecretIds",new Set);this.parentEl=e;this.isLoggedIn=t;this.serverId=s}setServerId(e){this.serverId=e;this.revealedSecretIds.clear();if(this.isMemoryDrawerOpen){void this.fetchServerMemory()}else if(this.isVisible&&this.serverId){void this.fetchServerMemory()}}setLayoutChangeHandler(e){this.onLayoutChange=e}setWebSocketSend(e){this.wsSend=e}setTerminalFillHandler(e,t){this.getTerminalFillTarget=e;this.fillTerminalInput=t}render(){if(this.panelEl)return;this.panelEl=document.createElement("div");this.panelEl.id="agent-panel";this.panelEl.className="shrink-0 border-l border-[var(--border)] flex flex-col bg-[var(--bg)] overflow-hidden h-full relative";this.panelEl.style.width="min(clamp(420px, 40vw, 600px), 100%)";this.panelEl.style.display="none";this.panelEl.innerHTML=\`
|
|
|
|
|
<div class="agent-panel-header flex items-center justify-between px-4 h-12 border-b border-[var(--border)] bg-[var(--bg-elevated)] shrink-0">
|
|
|
|
|
<div class="flex items-center gap-2 min-w-0">
|
|
|
|
|
<span class="material-symbols-outlined text-[var(--accent-secondary)]" style="font-size: 18px; font-variation-settings: 'FILL' 1;">smart_toy</span>
|
|
|
|
@@ -509,15 +509,15 @@ Please report this to https://github.com/markedjs/marked.\`,e){let r="<p>An erro
|
|
|
|
|
<summary class="agent-context-summary">
|
|
|
|
|
<span class="material-symbols-outlined agent-context-icon" aria-hidden="true">terminal</span>
|
|
|
|
|
<span class="agent-context-title">\${g("agent.selectionAttachment")}</span>
|
|
|
|
|
<span class="agent-context-meta">\${Te(g("agent.selectionAttachmentMeta",{lines:e.lineCount,characters:e.characterCount}))}</span>
|
|
|
|
|
<span class="agent-context-meta">\${Se(g("agent.selectionAttachmentMeta",{lines:e.lineCount,characters:e.characterCount}))}</span>
|
|
|
|
|
<span class="material-symbols-outlined agent-context-expand" aria-hidden="true">expand_more</span>
|
|
|
|
|
</summary>
|
|
|
|
|
<div class="agent-context-source">\${Te(t)}</div>
|
|
|
|
|
<pre class="agent-context-preview">\${Te(e.content)}</pre>
|
|
|
|
|
<div class="agent-context-source">\${Se(t)}</div>
|
|
|
|
|
<pre class="agent-context-preview">\${Se(e.content)}</pre>
|
|
|
|
|
</details>
|
|
|
|
|
<button type="button" class="agent-context-remove"
|
|
|
|
|
aria-label="\${Te(g("agent.removeSelection"))}"
|
|
|
|
|
title="\${Te(g("agent.removeSelection"))}">
|
|
|
|
|
aria-label="\${Se(g("agent.removeSelection"))}"
|
|
|
|
|
title="\${Se(g("agent.removeSelection"))}">
|
|
|
|
|
<span class="material-symbols-outlined" aria-hidden="true">close</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
@@ -537,7 +537,7 @@ Please report this to https://github.com/markedjs/marked.\`,e){let r="<p>An erro
|
|
|
|
|
<div class="tp-steps"></div>
|
|
|
|
|
<div class="tp-current"></div>
|
|
|
|
|
</div>
|
|
|
|
|
\`;const t=e.querySelector(".tp-accordion");t==null?void 0:t.addEventListener("click",()=>{if(!this.thinkingIsDone)return;e.classList.toggle("tp-expanded")});this.thinkingProcessEl=e;this.thinkingStepsEl=e.querySelector(".tp-steps");this.thinkingStatusEl=e.querySelector(".tp-status");this.thinkingCurrentEl=e.querySelector(".tp-current");this.thinkingLiveEl=e.querySelector(".tp-live-preview");this.thinkingIsDone=false;(s=this.messagesEl)==null?void 0:s.appendChild(e);this.scrollToBottom()}updateLivePreview(e){if(!this.thinkingLiveEl)return;this.livePreviewCache.push(e);if(this.livePreviewCache.length>2)this.livePreviewCache.shift();const t=\`<span class="material-symbols-outlined tp-live-icon" style="font-variation-settings:'FILL' 0;">terminal</span>\`;this.thinkingLiveEl.innerHTML=this.livePreviewCache.map(s=>\`<div class="tp-live-item">\${t}<span>\${Te(s)}</span></div>\`).join("")}addThinkingStep(e,t){if(!this.thinkingStepsEl||!this.thinkingCurrentEl)return;this.thinkingAllSteps.push({tool:e,label:t});if(this.thinkingCurrentEl.childElementCount>0){this.thinkingStepsEl.appendChild(this.thinkingCurrentEl.firstElementChild);while(this.thinkingStepsEl.children.length>2){this.thinkingStepsEl.removeChild(this.thinkingStepsEl.firstChild)}}this.thinkingCurrentEl.replaceChildren();this.thinkingStepCount++;const s=document.createElement("div");s.className="tp-step tp-step-active";const r=e==="execute_command"||e==="terminal"?\`<span class="material-symbols-outlined tp-step-icon" style="font-variation-settings:'FILL' 0;">terminal</span>\`:\`<span class="material-symbols-outlined tp-step-icon" style="font-variation-settings:'FILL' 1;">smart_toy</span>\`;s.innerHTML=\`\${r}<span class="tp-step-label">\${Te(t)}</span>\`;this.thinkingCurrentEl.appendChild(s);if(this.thinkingStatusEl){this.thinkingStatusEl.textContent=g(this.thinkingIsDone?"agent.completedSteps":"agent.processingSteps",{count:this.thinkingStepCount})}this.scrollToBottom()}collapseThinkingProcess(){var s,r;if(!this.thinkingProcessEl||this.thinkingIsDone)return;this.thinkingIsDone=true;if((s=this.thinkingCurrentEl)==null?void 0:s.firstElementChild){(r=this.thinkingStepsEl)==null?void 0:r.appendChild(this.thinkingCurrentEl.firstElementChild)}this.thinkingCurrentEl.replaceChildren();if(this.thinkingStepsEl){this.thinkingStepsEl.replaceChildren();for(const n of this.thinkingAllSteps){const o=document.createElement("div");o.className="tp-step tp-step-done";const a=n.tool==="execute_command"||n.tool==="terminal"?\`<span class="material-symbols-outlined tp-step-icon" style="font-variation-settings:'FILL' 0;">check_circle</span>\`:\`<span class="material-symbols-outlined tp-step-icon" style="font-variation-settings:'FILL' 1;">check_circle</span>\`;o.innerHTML=\`\${a}<span class="tp-step-label">\${Te(n.label)}</span>\`;this.thinkingStepsEl.appendChild(o)}}this.thinkingProcessEl.querySelectorAll(".tp-step-active").forEach(n=>{n.classList.remove("tp-step-active");n.classList.add("tp-step-done");const o=n.querySelector(".tp-step-icon");if(o)o.textContent="check_circle"});if(this.thinkingStatusEl){this.thinkingStatusEl.textContent=g("agent.completedSteps",{count:this.thinkingStepCount})}const e=this.thinkingProcessEl.querySelector(".tp-icon");if(e)e.textContent="check_circle";const t=this.thinkingProcessEl.querySelector(".thinking-dots");if(t)t.style.display="none";this.thinkingProcessEl.classList.add("tp-done");if(this.thinkingLiveEl)this.thinkingLiveEl.replaceChildren()}removeThinkingProcess(){if(this.thinkingProcessEl){this.thinkingProcessEl.remove()}this.thinkingProcessEl=null;this.thinkingStepsEl=null;this.thinkingCurrentEl=null;this.thinkingStatusEl=null;this.thinkingLiveEl=null;this.thinkingIsDone=false;this.thinkingAllSteps=[];this.livePreviewCache=[]}addAgentResponse(e){this.collapseThinkingProcess();this.appendMessage("response",e||"")}handleStreamChunk(e){var s;if(!this.streamingEl){this.collapseThinkingProcess()}if(!this.streamingEl){this.streamingText="";const r=document.createElement("div");r.className="agent-message agent-response";const n="var(--agent-agent-color)";const o=\`<span class="material-symbols-outlined text-[14px]" style="color:\${n};font-variation-settings:'FILL' 1;">smart_toy</span>\`;r.innerHTML=\`
|
|
|
|
|
\`;const t=e.querySelector(".tp-accordion");t==null?void 0:t.addEventListener("click",()=>{if(!this.thinkingIsDone)return;e.classList.toggle("tp-expanded")});this.thinkingProcessEl=e;this.thinkingStepsEl=e.querySelector(".tp-steps");this.thinkingStatusEl=e.querySelector(".tp-status");this.thinkingCurrentEl=e.querySelector(".tp-current");this.thinkingLiveEl=e.querySelector(".tp-live-preview");this.thinkingIsDone=false;(s=this.messagesEl)==null?void 0:s.appendChild(e);this.scrollToBottom()}updateLivePreview(e){if(!this.thinkingLiveEl)return;this.livePreviewCache.push(e);if(this.livePreviewCache.length>2)this.livePreviewCache.shift();const t=\`<span class="material-symbols-outlined tp-live-icon" style="font-variation-settings:'FILL' 0;">terminal</span>\`;this.thinkingLiveEl.innerHTML=this.livePreviewCache.map(s=>\`<div class="tp-live-item">\${t}<span>\${Se(s)}</span></div>\`).join("")}addThinkingStep(e,t){if(!this.thinkingStepsEl||!this.thinkingCurrentEl)return;this.thinkingAllSteps.push({tool:e,label:t});if(this.thinkingCurrentEl.childElementCount>0){this.thinkingStepsEl.appendChild(this.thinkingCurrentEl.firstElementChild);while(this.thinkingStepsEl.children.length>2){this.thinkingStepsEl.removeChild(this.thinkingStepsEl.firstChild)}}this.thinkingCurrentEl.replaceChildren();this.thinkingStepCount++;const s=document.createElement("div");s.className="tp-step tp-step-active";const r=e==="execute_command"||e==="terminal"?\`<span class="material-symbols-outlined tp-step-icon" style="font-variation-settings:'FILL' 0;">terminal</span>\`:\`<span class="material-symbols-outlined tp-step-icon" style="font-variation-settings:'FILL' 1;">smart_toy</span>\`;s.innerHTML=\`\${r}<span class="tp-step-label">\${Se(t)}</span>\`;this.thinkingCurrentEl.appendChild(s);if(this.thinkingStatusEl){this.thinkingStatusEl.textContent=g(this.thinkingIsDone?"agent.completedSteps":"agent.processingSteps",{count:this.thinkingStepCount})}this.scrollToBottom()}collapseThinkingProcess(){var s,r;if(!this.thinkingProcessEl||this.thinkingIsDone)return;this.thinkingIsDone=true;if((s=this.thinkingCurrentEl)==null?void 0:s.firstElementChild){(r=this.thinkingStepsEl)==null?void 0:r.appendChild(this.thinkingCurrentEl.firstElementChild)}this.thinkingCurrentEl.replaceChildren();if(this.thinkingStepsEl){this.thinkingStepsEl.replaceChildren();for(const n of this.thinkingAllSteps){const o=document.createElement("div");o.className="tp-step tp-step-done";const a=n.tool==="execute_command"||n.tool==="terminal"?\`<span class="material-symbols-outlined tp-step-icon" style="font-variation-settings:'FILL' 0;">check_circle</span>\`:\`<span class="material-symbols-outlined tp-step-icon" style="font-variation-settings:'FILL' 1;">check_circle</span>\`;o.innerHTML=\`\${a}<span class="tp-step-label">\${Se(n.label)}</span>\`;this.thinkingStepsEl.appendChild(o)}}this.thinkingProcessEl.querySelectorAll(".tp-step-active").forEach(n=>{n.classList.remove("tp-step-active");n.classList.add("tp-step-done");const o=n.querySelector(".tp-step-icon");if(o)o.textContent="check_circle"});if(this.thinkingStatusEl){this.thinkingStatusEl.textContent=g("agent.completedSteps",{count:this.thinkingStepCount})}const e=this.thinkingProcessEl.querySelector(".tp-icon");if(e)e.textContent="check_circle";const t=this.thinkingProcessEl.querySelector(".thinking-dots");if(t)t.style.display="none";this.thinkingProcessEl.classList.add("tp-done");if(this.thinkingLiveEl)this.thinkingLiveEl.replaceChildren()}removeThinkingProcess(){if(this.thinkingProcessEl){this.thinkingProcessEl.remove()}this.thinkingProcessEl=null;this.thinkingStepsEl=null;this.thinkingCurrentEl=null;this.thinkingStatusEl=null;this.thinkingLiveEl=null;this.thinkingIsDone=false;this.thinkingAllSteps=[];this.livePreviewCache=[]}addAgentResponse(e){this.collapseThinkingProcess();this.appendMessage("response",e||"")}handleStreamChunk(e){var s;if(!this.streamingEl){this.collapseThinkingProcess()}if(!this.streamingEl){this.streamingText="";const r=document.createElement("div");r.className="agent-message agent-response";const n="var(--agent-agent-color)";const o=\`<span class="material-symbols-outlined text-[14px]" style="color:\${n};font-variation-settings:'FILL' 1;">smart_toy</span>\`;r.innerHTML=\`
|
|
|
|
|
<div class="flex gap-2 items-start">
|
|
|
|
|
<div class="shrink-0 mt-0.5">\${o}</div>
|
|
|
|
|
<div class="flex-1 min-w-0 text-[13px] whitespace-pre-wrap agent-md-content"></div>
|
|
|
|
@@ -548,20 +548,20 @@ Please report this to https://github.com/markedjs/marked.\`,e){let r="<p>An erro
|
|
|
|
|
<span class="font-bold text-[var(--accent)]">\${g("agent.progressTitle")}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="agent-progress-detail mt-1">
|
|
|
|
|
\${Te(g("agent.progressCurrent",{message:e,current:t,max:s}))}
|
|
|
|
|
\${Se(g("agent.progressCurrent",{message:e,current:t,max:s}))}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="agent-progress-detail mt-1 text-[11px]">
|
|
|
|
|
\${Te(g("agent.progressReason",{reason:r}))}
|
|
|
|
|
\${Se(g("agent.progressReason",{reason:r}))}
|
|
|
|
|
</div>
|
|
|
|
|
\`;(o=this.messagesEl)==null?void 0:o.appendChild(n);this.scrollToBottom()}showConfirmDialog(e,t){var a,l,h;if(this.streamingEl){this.convertStreamToThoughtStep()}const s=((a=document.getElementById("terminal-section"))==null?void 0:a.classList.contains("hidden"))??false;if(!this.isVisible||this.parentEl.style.display==="none"||s){(l=this.wsSend)==null?void 0:l.call(this,JSON.stringify({type:"agent_confirm",approved:false,command:e}));return}this.rejectPendingConfirmation(false);this.isWaitingConfirmation=true;this.updateInputState();const r=document.createElement("div");r.className="agent-confirm p-3 rounded border border-[var(--error)] bg-[var(--error-bg)]";r.setAttribute("role","alertdialog");r.setAttribute("aria-modal","true");r.setAttribute("aria-labelledby","agent-confirm-title");r.setAttribute("aria-describedby","agent-confirm-description");r.innerHTML=\`
|
|
|
|
|
<div id="agent-confirm-title" class="text-[11px] font-bold text-[var(--error)] mb-1">⚠ \${g("agent.confirmTitle")}</div>
|
|
|
|
|
<div class="text-[12px] mb-1 font-code bg-black/20 p-1 rounded">$ \${Te(e)}</div>
|
|
|
|
|
<div id="agent-confirm-description" class="text-[11px] text-[var(--on-surface-variant)] mb-2">\${Te(t)}</div>
|
|
|
|
|
<div class="text-[12px] mb-1 font-code bg-black/20 p-1 rounded">$ \${Se(e)}</div>
|
|
|
|
|
<div id="agent-confirm-description" class="text-[11px] text-[var(--on-surface-variant)] mb-2">\${Se(t)}</div>
|
|
|
|
|
<div class="flex gap-2">
|
|
|
|
|
<button type="button" class="agent-confirm-no cyber-button flex-1 py-1 text-[11px] font-bold">\${g("agent.reject")}</button>
|
|
|
|
|
<button type="button" class="agent-confirm-yes cyber-button flex-1 py-1 text-[11px] font-bold bg-[var(--error)] text-white">\${g("agent.confirm")}</button>
|
|
|
|
|
</div>
|
|
|
|
|
\`;const n=r.querySelector(".agent-confirm-no");const o=r.querySelector(".agent-confirm-yes");this.pendingConfirmation={command:e,element:r,previousFocus:document.activeElement instanceof HTMLElement?document.activeElement:null};n.addEventListener("click",()=>{this.resolvePendingConfirmation(false)});o.addEventListener("click",()=>{this.resolvePendingConfirmation(true)});r.addEventListener("keydown",c=>{if(c.key==="Escape"){c.preventDefault();c.stopPropagation();this.resolvePendingConfirmation(false);return}if(c.key!=="Tab")return;const d=n;const u=o;if(c.shiftKey&&document.activeElement===d){c.preventDefault();u.focus()}else if(!c.shiftKey&&document.activeElement===u){c.preventDefault();d.focus()}});(h=this.messagesEl)==null?void 0:h.appendChild(r);this.scrollToBottom();requestAnimationFrame(()=>n.focus())}resolvePendingConfirmation(e,t=true){var r;const s=this.pendingConfirmation;if(!s)return;this.pendingConfirmation=null;(r=this.wsSend)==null?void 0:r.call(this,JSON.stringify({type:"agent_confirm",approved:e,command:s.command}));s.element.remove();this.isWaitingConfirmation=false;this.updateInputState();if(t){requestAnimationFrame(()=>{var o;const n=((o=s.previousFocus)==null?void 0:o.isConnected)?s.previousFocus:this.inputEl;n==null?void 0:n.focus()})}}convertStreamToThoughtStep(){if(!this.streamingEl)return;const e=this.streamingText.trim();this.streamingEl.remove();this.streamingEl=null;this.streamingText="";if(e&&this.thinkingProcessEl){this.thinkingIsDone=false;this.thinkingProcessEl.classList.remove("tp-done");const t=this.thinkingProcessEl.querySelector(".tp-icon");if(t)t.textContent="smart_toy";const s=this.thinkingProcessEl.querySelector(".thinking-dots");if(s)s.style.display="";this.addThinkingStep("thought",e)}}appendMessage(e,t,s={}){var f;const r=document.createElement("div");r.className=\`agent-message agent-\${e}\`;const n=e==="user";const o=e==="response";const a=e==="executing";const l=e==="error";const h=n?"var(--agent-user-color)":o?"var(--agent-agent-color)":l?"var(--error)":"var(--on-surface-variant)";const c=n?\`<span class="material-symbols-outlined text-[14px]" style="color:\${h};font-variation-settings:'FILL' 1;">person</span>\`:o?\`<span class="material-symbols-outlined text-[14px]" style="color:\${h};font-variation-settings:'FILL' 1;">smart_toy</span>\`:a?\`<span class="material-symbols-outlined text-[14px]" style="color:\${h};font-variation-settings:'FILL' 0;">terminal</span>\`:\`<span class="material-symbols-outlined text-[14px]" style="color:\${h};font-variation-settings:'FILL' 1;">error</span>\`;let d;if(o){d=this.renderMarkdown(t||"")}else if(n){d=\`<div style="color:\${h};white-space:pre-wrap;word-break:break-word;">\${Te(t)}</div>\`}else if(a){d=\`<div class="font-code text-[11px]" style="color:\${h};white-space:pre-wrap;word-break:break-all;">\${Te(t)}</div>\`}else{d=\`<div style="color:\${h};word-break:break-word;">\${Te(t)}</div>\`}const u=n&&s.hasTerminalSelection?\`<div class="agent-message-context">
|
|
|
|
|
\`;const n=r.querySelector(".agent-confirm-no");const o=r.querySelector(".agent-confirm-yes");this.pendingConfirmation={command:e,element:r,previousFocus:document.activeElement instanceof HTMLElement?document.activeElement:null};n.addEventListener("click",()=>{this.resolvePendingConfirmation(false)});o.addEventListener("click",()=>{this.resolvePendingConfirmation(true)});r.addEventListener("keydown",c=>{if(c.key==="Escape"){c.preventDefault();c.stopPropagation();this.resolvePendingConfirmation(false);return}if(c.key!=="Tab")return;const d=n;const u=o;if(c.shiftKey&&document.activeElement===d){c.preventDefault();u.focus()}else if(!c.shiftKey&&document.activeElement===u){c.preventDefault();d.focus()}});(h=this.messagesEl)==null?void 0:h.appendChild(r);this.scrollToBottom();requestAnimationFrame(()=>n.focus())}resolvePendingConfirmation(e,t=true){var r;const s=this.pendingConfirmation;if(!s)return;this.pendingConfirmation=null;(r=this.wsSend)==null?void 0:r.call(this,JSON.stringify({type:"agent_confirm",approved:e,command:s.command}));s.element.remove();this.isWaitingConfirmation=false;this.updateInputState();if(t){requestAnimationFrame(()=>{var o;const n=((o=s.previousFocus)==null?void 0:o.isConnected)?s.previousFocus:this.inputEl;n==null?void 0:n.focus()})}}convertStreamToThoughtStep(){if(!this.streamingEl)return;const e=this.streamingText.trim();this.streamingEl.remove();this.streamingEl=null;this.streamingText="";if(e&&this.thinkingProcessEl){this.thinkingIsDone=false;this.thinkingProcessEl.classList.remove("tp-done");const t=this.thinkingProcessEl.querySelector(".tp-icon");if(t)t.textContent="smart_toy";const s=this.thinkingProcessEl.querySelector(".thinking-dots");if(s)s.style.display="";this.addThinkingStep("thought",e)}}appendMessage(e,t,s={}){var f;const r=document.createElement("div");r.className=\`agent-message agent-\${e}\`;const n=e==="user";const o=e==="response";const a=e==="executing";const l=e==="error";const h=n?"var(--agent-user-color)":o?"var(--agent-agent-color)":l?"var(--error)":"var(--on-surface-variant)";const c=n?\`<span class="material-symbols-outlined text-[14px]" style="color:\${h};font-variation-settings:'FILL' 1;">person</span>\`:o?\`<span class="material-symbols-outlined text-[14px]" style="color:\${h};font-variation-settings:'FILL' 1;">smart_toy</span>\`:a?\`<span class="material-symbols-outlined text-[14px]" style="color:\${h};font-variation-settings:'FILL' 0;">terminal</span>\`:\`<span class="material-symbols-outlined text-[14px]" style="color:\${h};font-variation-settings:'FILL' 1;">error</span>\`;let d;if(o){d=this.renderMarkdown(t||"")}else if(n){d=\`<div style="color:\${h};white-space:pre-wrap;word-break:break-word;">\${Se(t)}</div>\`}else if(a){d=\`<div class="font-code text-[11px]" style="color:\${h};white-space:pre-wrap;word-break:break-all;">\${Se(t)}</div>\`}else{d=\`<div style="color:\${h};word-break:break-word;">\${Se(t)}</div>\`}const u=n&&s.hasTerminalSelection?\`<div class="agent-message-context">
|
|
|
|
|
<span class="material-symbols-outlined" aria-hidden="true">terminal</span>
|
|
|
|
|
<span>\${g("agent.selectionAttachedMessage")}</span>
|
|
|
|
|
</div>\`:"";if(n){r.innerHTML=\`
|
|
|
|
@@ -579,7 +579,7 @@ Please report this to https://github.com/markedjs/marked.\`,e){let r="<p>An erro
|
|
|
|
|
<div class="shrink-0 mt-0.5">\${c}</div>
|
|
|
|
|
<div class="flex-1 min-w-0 text-[13px]">\${d}</div>
|
|
|
|
|
</div>
|
|
|
|
|
\`}(f=this.messagesEl)==null?void 0:f.appendChild(r);if(o){this.enhanceCodeBlocks(r)}this.scrollToBottom()}renderMarkdown(e){let t;try{t=Qe.parse(e,{async:false})}catch{return\`<div class="agent-md-content">\${Te(e)}</div>\`}const s=w$.sanitize(t,{ADD_ATTR:["target","rel","class","loading","data-code-language"],ALLOW_UNKNOWN_PROTOCOLS:false,USE_PROFILES:{html:true}});return\`<div class="agent-md-content">\${s}</div>\`}enhanceCodeBlocks(e){e.querySelectorAll(".agent-md-code-block").forEach(t=>{if(t.dataset.actionsReady==="true")return;const s=t.querySelector("code");const r=t.querySelector(".agent-md-code-actions");const n=t.querySelector(".agent-md-code-meta");if(!s||!r||!n)return;const o=s.textContent||"";const a=this.createCodeActionButton("copy","content_copy",g("agent.codeCopy"));a.addEventListener("click",async()=>{const h=await Hn(o);this.showCodeActionFeedback(a,h?"check":"error",h?g("agent.codeCopied"):g("agent.codeCopyFailed"))});r.appendChild(a);const l=bE(t.dataset.codeLanguage,o);if(l&&this.getTerminalFillTarget&&this.fillTerminalInput){const h=this.getTerminalFillTarget();n.textContent=g("agent.codeTarget",{target:h.label});n.title=h.label;const c=this.createCodeActionButton("fill","input",g("agent.codeFill"));c.disabled=!h.available;c.addEventListener("click",()=>{var f,p;const d=(f=this.getTerminalFillTarget)==null?void 0:f.call(this);const u=!!(d==null?void 0:d.available)&&!!((p=this.fillTerminalInput)==null?void 0:p.call(this,l));this.showCodeActionFeedback(c,u?"check":"error",u?g("agent.codeFilled"):g("agent.codeFillFailed"))});r.appendChild(c)}t.dataset.actionsReady="true"})}refreshCodeBlockActions(){var e;(e=this.panelEl)==null?void 0:e.querySelectorAll(".agent-md-code-block").forEach(t=>{var n;const s=t.querySelector('[data-code-action="copy"]');if(s)this.setCodeActionButton(s,"content_copy",g("agent.codeCopy"));const r=t.querySelector('[data-code-action="fill"]');if(r){this.setCodeActionButton(r,"input",g("agent.codeFill"));const o=(n=this.getTerminalFillTarget)==null?void 0:n.call(this);r.disabled=!(o==null?void 0:o.available);const a=t.querySelector(".agent-md-code-meta");if(a&&o){a.textContent=g("agent.codeTarget",{target:o.label});a.title=o.label}}})}createCodeActionButton(e,t,s){const r=document.createElement("button");r.type="button";r.className="agent-md-code-action";r.dataset.codeAction=e;this.setCodeActionButton(r,t,s);return r}setCodeActionButton(e,t,s){e.replaceChildren();const r=document.createElement("span");r.className="material-symbols-outlined";r.setAttribute("aria-hidden","true");r.textContent=t;const n=document.createElement("span");n.textContent=s;e.append(r,n);e.title=s;e.setAttribute("aria-label",s)}showCodeActionFeedback(e,t,s){this.setCodeActionButton(e,t,s);window.setTimeout(()=>{if(!e.isConnected)return;const r=e.dataset.codeAction==="fill";this.setCodeActionButton(e,r?"input":"content_copy",r?g("agent.codeFill"):g("agent.codeCopy"))},1600)}scrollToBottom(){if(this.messagesEl){requestAnimationFrame(()=>{this.messagesEl.scrollTop=this.messagesEl.scrollHeight})}}dispose(){var e,t;this.rejectPendingConfirmation(false);(e=this.localeCleanup)==null?void 0:e.call(this);this.localeCleanup=null;this.pendingTerminalSelection=null;(t=this.panelEl)==null?void 0:t.remove();this.panelEl=null;this.messagesEl=null;this.contextEl=null;this.inputEl=null;this.sendBtn=null;this.memoryDrawerEl=null;this.memoryTabWorkLogBtn=null;this.memoryTabKnowledgeBtn=null;this.memoryContentEl=null;this.memoryCountEl=null;this.memoryAddBtn=null;this.memoryAddFormContainerEl=null;this.isVisible=false;document.body.classList.remove("agent-panel-open")}toggleMemoryDrawer(){if(this.isMemoryDrawerOpen){this.closeMemoryDrawer()}else{this.openMemoryDrawer()}}openMemoryDrawer(){this.isMemoryDrawerOpen=true;if(this.memoryDrawerEl){this.memoryDrawerEl.classList.remove("hidden")}void this.fetchServerMemory()}closeMemoryDrawer(){this.isMemoryDrawerOpen=false;if(this.memoryDrawerEl){this.memoryDrawerEl.classList.add("hidden")}this.closeAddKnowledgeForm()}switchMemoryTab(e){var t,s;this.activeMemoryTab=e;if(this.memoryTabWorkLogBtn&&this.memoryTabKnowledgeBtn){if(e==="workLog"){this.memoryTabWorkLogBtn.className="flex-1 py-1.5 text-center font-medium border-b-2 border-[var(--accent)] text-[var(--accent)] transition-colors cursor-pointer";this.memoryTabKnowledgeBtn.className="flex-1 py-1.5 text-center font-medium border-b-2 border-transparent text-muted hover:text-primary transition-colors cursor-pointer";(t=this.memoryAddBtn)==null?void 0:t.classList.add("hidden")}else{this.memoryTabWorkLogBtn.className="flex-1 py-1.5 text-center font-medium border-b-2 border-transparent text-muted hover:text-primary transition-colors cursor-pointer";this.memoryTabKnowledgeBtn.className="flex-1 py-1.5 text-center font-medium border-b-2 border-[var(--accent)] text-[var(--accent)] transition-colors cursor-pointer";(s=this.memoryAddBtn)==null?void 0:s.classList.remove("hidden")}}this.closeAddKnowledgeForm();this.renderMe
Line truncated
|
|
|
|
|
\`}(f=this.messagesEl)==null?void 0:f.appendChild(r);if(o){this.enhanceCodeBlocks(r)}this.scrollToBottom()}renderMarkdown(e){let t;try{t=Qe.parse(e,{async:false})}catch{return\`<div class="agent-md-content">\${Se(e)}</div>\`}const s=w$.sanitize(t,{ADD_ATTR:["target","rel","class","loading","data-code-language"],ALLOW_UNKNOWN_PROTOCOLS:false,USE_PROFILES:{html:true}});return\`<div class="agent-md-content">\${s}</div>\`}enhanceCodeBlocks(e){e.querySelectorAll(".agent-md-code-block").forEach(t=>{if(t.dataset.actionsReady==="true")return;const s=t.querySelector("code");const r=t.querySelector(".agent-md-code-actions");const n=t.querySelector(".agent-md-code-meta");if(!s||!r||!n)return;const o=s.textContent||"";const a=this.createCodeActionButton("copy","content_copy",g("agent.codeCopy"));a.addEventListener("click",async()=>{const h=await Hn(o);this.showCodeActionFeedback(a,h?"check":"error",h?g("agent.codeCopied"):g("agent.codeCopyFailed"))});r.appendChild(a);const l=bE(t.dataset.codeLanguage,o);if(l&&this.getTerminalFillTarget&&this.fillTerminalInput){const h=this.getTerminalFillTarget();n.textContent=g("agent.codeTarget",{target:h.label});n.title=h.label;const c=this.createCodeActionButton("fill","input",g("agent.codeFill"));c.disabled=!h.available;c.addEventListener("click",()=>{var f,p;const d=(f=this.getTerminalFillTarget)==null?void 0:f.call(this);const u=!!(d==null?void 0:d.available)&&!!((p=this.fillTerminalInput)==null?void 0:p.call(this,l));this.showCodeActionFeedback(c,u?"check":"error",u?g("agent.codeFilled"):g("agent.codeFillFailed"))});r.appendChild(c)}t.dataset.actionsReady="true"})}refreshCodeBlockActions(){var e;(e=this.panelEl)==null?void 0:e.querySelectorAll(".agent-md-code-block").forEach(t=>{var n;const s=t.querySelector('[data-code-action="copy"]');if(s)this.setCodeActionButton(s,"content_copy",g("agent.codeCopy"));const r=t.querySelector('[data-code-action="fill"]');if(r){this.setCodeActionButton(r,"input",g("agent.codeFill"));const o=(n=this.getTerminalFillTarget)==null?void 0:n.call(this);r.disabled=!(o==null?void 0:o.available);const a=t.querySelector(".agent-md-code-meta");if(a&&o){a.textContent=g("agent.codeTarget",{target:o.label});a.title=o.label}}})}createCodeActionButton(e,t,s){const r=document.createElement("button");r.type="button";r.className="agent-md-code-action";r.dataset.codeAction=e;this.setCodeActionButton(r,t,s);return r}setCodeActionButton(e,t,s){e.replaceChildren();const r=document.createElement("span");r.className="material-symbols-outlined";r.setAttribute("aria-hidden","true");r.textContent=t;const n=document.createElement("span");n.textContent=s;e.append(r,n);e.title=s;e.setAttribute("aria-label",s)}showCodeActionFeedback(e,t,s){this.setCodeActionButton(e,t,s);window.setTimeout(()=>{if(!e.isConnected)return;const r=e.dataset.codeAction==="fill";this.setCodeActionButton(e,r?"input":"content_copy",r?g("agent.codeFill"):g("agent.codeCopy"))},1600)}scrollToBottom(){if(this.messagesEl){requestAnimationFrame(()=>{this.messagesEl.scrollTop=this.messagesEl.scrollHeight})}}dispose(){var e,t;this.rejectPendingConfirmation(false);(e=this.localeCleanup)==null?void 0:e.call(this);this.localeCleanup=null;this.pendingTerminalSelection=null;(t=this.panelEl)==null?void 0:t.remove();this.panelEl=null;this.messagesEl=null;this.contextEl=null;this.inputEl=null;this.sendBtn=null;this.memoryDrawerEl=null;this.memoryTabWorkLogBtn=null;this.memoryTabKnowledgeBtn=null;this.memoryContentEl=null;this.memoryCountEl=null;this.memoryAddBtn=null;this.memoryAddFormContainerEl=null;this.isVisible=false;document.body.classList.remove("agent-panel-open")}toggleMemoryDrawer(){if(this.isMemoryDrawerOpen){this.closeMemoryDrawer()}else{this.openMemoryDrawer()}}openMemoryDrawer(){this.isMemoryDrawerOpen=true;if(this.memoryDrawerEl){this.memoryDrawerEl.classList.remove("hidden")}void this.fetchServerMemory()}closeMemoryDrawer(){this.isMemoryDrawerOpen=false;if(this.memoryDrawerEl){this.memoryDrawerEl.classList.add("hidden")}this.closeAddKnowledgeForm()}switchMemoryTab(e){var t,s;this.activeMemoryTab=e;if(this.memoryTabWorkLogBtn&&this.memoryTabKnowledgeBtn){if(e==="workLog"){this.memoryTabWorkLogBtn.className="flex-1 py-1.5 text-center font-medium border-b-2 border-[var(--accent)] text-[var(--accent)] transition-colors cursor-pointer";this.memoryTabKnowledgeBtn.className="flex-1 py-1.5 text-center font-medium border-b-2 border-transparent text-muted hover:text-primary transition-colors cursor-pointer";(t=this.memoryAddBtn)==null?void 0:t.classList.add("hidden")}else{this.memoryTabWorkLogBtn.className="flex-1 py-1.5 text-center font-medium border-b-2 border-transparent text-muted hover:text-primary transition-colors cursor-pointer";this.memoryTabKnowledgeBtn.className="flex-1 py-1.5 text-center font-medium border-b-2 border-[var(--accent)] text-[var(--accent)] transition-colors cursor-pointer";(s=this.memoryAddBtn)==null?void 0:s.classList.remove("hidden")}}this.closeAddKnowledgeForm();this.renderMe
Line truncated
|
|
|
|
|
<div class="p-4 text-center text-muted text-xs">
|
|
|
|
|
\${g("agent.memoryDirectNotice")}
|
|
|
|
|
</div>
|
|
|
|
@@ -591,16 +591,16 @@ Please report this to https://github.com/markedjs/marked.\`,e){let r="<p>An erro
|
|
|
|
|
<div class="agent-memory-card p-2.5 rounded border border-[var(--border)] bg-[var(--bg-elevated)] flex flex-col gap-1.5" data-log-id="\${o.id}">
|
|
|
|
|
<div class="flex items-center justify-between text-[11px]">
|
|
|
|
|
<div class="flex items-center gap-1.5 min-w-0">
|
|
|
|
|
<span class="font-bold text-primary truncate">\${Te(o.title)}</span>
|
|
|
|
|
<span class="text-[10px] text-muted font-code shrink-0">\${Te(a)}</span>
|
|
|
|
|
<span class="font-bold text-primary truncate" title="\${Se(o.title)}">\${Se(o.title)}</span>
|
|
|
|
|
<span class="text-[10px] text-muted font-code shrink-0">\${Se(a)}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<button type="button" class="agent-log-delete-btn text-muted hover:text-error transition-colors p-0.5 cursor-pointer shrink-0" data-id="\${o.id}" title="\${g("common.delete")}">
|
|
|
|
|
<span class="material-symbols-outlined text-[15px]">delete</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="text-[11px] text-muted leading-relaxed">\${Te(o.summary)}</div>
|
|
|
|
|
<div class="agent-log-summary text-[11px] text-muted leading-relaxed cursor-pointer hover:text-text transition-colors select-text" title="\${Se(o.summary)}">\${Se(o.summary)}</div>
|
|
|
|
|
</div>
|
|
|
|
|
\`}).join("");this.memoryContentEl.innerHTML=n;this.memoryContentEl.querySelectorAll(".agent-log-delete-btn").forEach(o=>{o.addEventListener("click",async()=>{const a=Number(o.dataset.id);if(!a||!this.serverId)return;const l=await Ui({title:g("common.delete"),message:g("agent.memoryDeleteConfirm"),variant:"danger"});if(!l)return;try{const h=await fetch(\`/api/servers/\${this.serverId}/work-logs/\${a}\`,{method:"DELETE"});if(h.ok){Y(g("agent.memoryDeleted"),{variant:"success"});void this.fetchServerMemory()}}catch{}})});return}if(this.unifiedMemory.knowledge.length===0){this.memoryContentEl.innerHTML=\`
|
|
|
|
|
\`}).join("");this.memoryContentEl.innerHTML=n;this.memoryContentEl.querySelectorAll(".agent-log-summary").forEach(o=>{o.addEventListener("click",a=>{a.stopPropagation();o.classList.toggle("expanded")})});this.memoryContentEl.querySelectorAll(".agent-log-delete-btn").forEach(o=>{o.addEventListener("click",async()=>{const a=Number(o.dataset.id);if(!a||!this.serverId)return;const l=await Ui({title:g("common.delete"),message:g("agent.memoryDeleteConfirm"),variant:"danger"});if(!l)return;try{const h=await fetch(\`/api/servers/\${this.serverId}/work-logs/\${a}\`,{method:"DELETE"});if(h.ok){Y(g("agent.memoryDeleted"),{variant:"success"});void this.fetchServerMemory()}}catch{}})});return}if(this.unifiedMemory.knowledge.length===0){this.memoryContentEl.innerHTML=\`
|
|
|
|
|
<div class="p-4 text-center text-muted text-xs">
|
|
|
|
|
\${g("agent.knowledgeEmpty")}
|
|
|
|
|
</div>
|
|
|
|
@@ -608,8 +608,8 @@ Please report this to https://github.com/markedjs/marked.\`,e){let r="<p>An erro
|
|
|
|
|
<div class="agent-memory-card p-2.5 rounded-lg border border-[var(--border)] bg-[var(--bg-elevated)] flex flex-col gap-1.5 select-text" data-knowledge-id="\${n.id}">
|
|
|
|
|
<div class="flex items-center justify-between text-[11px]">
|
|
|
|
|
<div class="flex items-center gap-2 min-w-0">
|
|
|
|
|
<span class="px-1.5 py-0.5 rounded text-[10px] font-medium tracking-wide uppercase \${o.tagClass}">\${Te(o.label)}</span>
|
|
|
|
|
<span class="font-mono font-bold text-primary truncate select-all">\${Te(n.key)}</span>
|
|
|
|
|
<span class="px-1.5 py-0.5 rounded text-[10px] font-medium tracking-wide uppercase \${o.tagClass}">\${Se(o.label)}</span>
|
|
|
|
|
<span class="font-mono font-bold text-primary truncate select-all">\${Se(n.key)}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="flex items-center gap-1 shrink-0">
|
|
|
|
|
\${a?\`
|
|
|
|
@@ -617,7 +617,7 @@ Please report this to https://github.com/markedjs/marked.\`,e){let r="<p>An erro
|
|
|
|
|
<span class="material-symbols-outlined text-[15px]">\${l?"visibility_off":"visibility"}</span>
|
|
|
|
|
</button>
|
|
|
|
|
\`:""}
|
|
|
|
|
<button type="button" class="agent-knowledge-copy-btn text-muted hover:text-primary transition-colors p-1 rounded hover:bg-[var(--bg-hover)] cursor-pointer flex items-center justify-center" data-value="\${Te(n.value)}" title="\${g("agent.codeCopy")}">
|
|
|
|
|
<button type="button" class="agent-knowledge-copy-btn text-muted hover:text-primary transition-colors p-1 rounded hover:bg-[var(--bg-hover)] cursor-pointer flex items-center justify-center" data-value="\${Se(n.value)}" title="\${g("agent.codeCopy")}">
|
|
|
|
|
<span class="material-symbols-outlined text-[15px]">content_copy</span>
|
|
|
|
|
</button>
|
|
|
|
|
<button type="button" class="agent-knowledge-delete-btn text-muted hover:text-error transition-colors p-1 rounded hover:bg-[var(--bg-hover)] cursor-pointer flex items-center justify-center" data-id="\${n.id}" title="\${g("common.delete")}">
|
|
|
|
@@ -625,7 +625,7 @@ Please report this to https://github.com/markedjs/marked.\`,e){let r="<p>An erro
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="text-[12px] font-mono text-primary/90 bg-[var(--bg-hover)]/30 rounded-r px-2.5 py-1.5 break-all select-all leading-relaxed border-l-2 \${o.borderClass}">\${Te(h)}</div>
|
|
|
|
|
<div class="text-[12px] font-mono text-primary/90 bg-[var(--bg-hover)]/30 rounded-r px-2.5 py-1.5 break-all select-all leading-relaxed border-l-2 \${o.borderClass}">\${Se(h)}</div>
|
|
|
|
|
</div>
|
|
|
|
|
\`}).join("");this.memoryContentEl.innerHTML=r;this.memoryContentEl.querySelectorAll(".agent-secret-toggle-btn").forEach(n=>{n.addEventListener("click",()=>{const o=Number(n.dataset.id);if(this.revealedSecretIds.has(o)){this.revealedSecretIds.delete(o)}else{this.revealedSecretIds.add(o)}this.renderMemoryContent()})});this.memoryContentEl.querySelectorAll(".agent-knowledge-copy-btn").forEach(n=>{n.addEventListener("click",async()=>{const o=n.dataset.value||"";await Hn(o);Y(g("agent.copySuccess"),{variant:"success"})})});this.memoryContentEl.querySelectorAll(".agent-knowledge-delete-btn").forEach(n=>{n.addEventListener("click",async()=>{const o=Number(n.dataset.id);if(!o||!this.serverId)return;const a=await Ui({title:g("common.delete"),message:g("agent.memoryDeleteConfirm"),variant:"danger"});if(!a)return;try{const l=await fetch(\`/api/servers/\${this.serverId}/knowledge/\${o}\`,{method:"DELETE"});if(l.ok){Y(g("agent.memoryDeleted"),{variant:"success"});void this.fetchServerMemory()}}catch{}})})}toggleAddKnowledgeForm(){if(!this.memoryAddFormContainerEl)return;if(this.memoryAddFormContainerEl.classList.contains("hidden")){this.openAddKnowledgeForm()}else{this.closeAddKnowledgeForm()}}openAddKnowledgeForm(){if(!this.memoryAddFormContainerEl)return;this.memoryAddFormContainerEl.classList.remove("hidden");this.memoryAddFormContainerEl.innerHTML=\`
|
|
|
|
|
<form id="agent-add-knowledge-form" class="space-y-2">
|
|
|
|
@@ -646,7 +646,7 @@ Please report this to https://github.com/markedjs/marked.\`,e){let r="<p>An erro
|
|
|
|
|
<button type="submit" id="agent-knowledge-submit-btn" class="cyber-button px-3 py-0.5 text-xs font-bold text-white bg-[var(--accent)] cursor-pointer">\${g("agent.memorySave")}</button>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
\`;const e=this.memoryAddFormContainerEl.querySelector("#agent-add-knowledge-form");const t=this.memoryAddFormContainerEl.querySelector("#agent-knowledge-cancel-btn");t==null?void 0:t.addEventListener("click",()=>this.closeAddKnowledgeForm());e==null?void 0:e.addEventListener("submit",async r=>{r.preventDefault();await this.handleSaveKnowledge()});const s=this.memoryAddFormContainerEl.querySelector("#agent-knowledge-key");s==null?void 0:s.focus()}closeAddKnowledgeForm(){if(!this.memoryAddFormContainerEl)return;this.memoryAddFormContainerEl.classList.add("hidden");this.memoryAddFormContainerEl.replaceChildren()}async handleSaveKnowledge(){if(!this.serverId||!this.memoryAddFormContainerEl)return;const e=this.memoryAddFormContainerEl.querySelector("#agent-knowledge-category");const t=this.memoryAddFormContainerEl.querySelector("#agent-knowledge-key");const s=this.memoryAddFormContainerEl.querySelector("#agent-knowledge-value");const r=(e==null?void 0:e.value)||"note";const n=(t==null?void 0:t.value)||"";const o=(s==null?void 0:s.value)||"";const a=_E({category:r,key:n,value:o});if(!a.ok)return;try{const l=await fetch(\`/api/servers/\${this.serverId}/knowledge\`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a.value)});if(l.ok){Y(g("agent.memorySaved"),{variant:"success"});this.closeAddKnowledgeForm();void this.fetchServerMemory()}}catch{}}}const kE={cf:{goodMax:100,fairMax:250},ws:{goodMax:100,fairMax:200}};function t_(i,e){const t=kE[e];if(i<=t.goodMax)return"good";if(i<=t.fairMax)return"fair";return"poor"}let nm=[];let Uw=[];(()=>{let i="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<i.length;e++)(e%2?Uw:nm).push(t=t+i[e])})();function CE(i){if(i<768)return false;for(let e=0,t=nm.length;;){let s=e+t>>1;if(i<nm[s])t=s;else if(i>=Uw[s])e=s+1;else return true;if(e==t)return false}}function i_(i){return i>=127462&&i<=127487}const s_=8205;function TE(i,e,t=true,s=true){return(t?jw:PE)(i,e,s)}function jw(i,e,t){if(e==i.length)return e;if(e&&Hw(i.charCodeAt(e))&&Vw(i.charCodeAt(e-1)))e--;let s=nf(i,e);e+=r_(s);while(e<i.length){let r=nf(i,e);if(s==s_||r==s_||t&&CE(r)){e+=r_(r);s=r}else if(i_(r)){let n=0,o=e-2;while(o>=0&&i_(nf(i,o))){n++;o-=2}if(n%2==0)break;else e+=2}else{break}}return e}function PE(i,e,t){while(e>1){let s=jw(i,e-2,t);if(s<e)return s;e--}return 0}function nf(i,e){let t=i.charCodeAt(e);if(!Vw(t)||e+1==i.length)return t;let s=i.charCodeAt(e+1);if(!Hw(s))return t;return(t-55296<<10)+(s-56320)+65536}function Hw(i){return i>=56320&&i<57344}function Vw(i){return i>=55296&&i<56320}function r_(i){return i<65536?1:2}let Pe=class Yw{lineAt(e){if(e<0||e>this.length)throw new RangeError(\`Invalid position \${e} in document of length \${this.length}\`);return this.lineInner(e,false,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(\`Invalid line number \${e} in \${this.lines}-line document\`);return this.lineInner(e,true,1,0)}replace(e,t,s){[e,t]=ia(this,e,t);let r=[];this.decompose(0,e,r,2);if(s.length)s.decompose(0,s.length,r,1|2);this.decompose(t,this.length,r,1);return $s.from(r,this.length-(t-e)+s.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=ia(this,e,t);let s=[];this.decompose(e,t,s,0);return $s.from(s,t-e)}eq(e){if(e==this)return true;if(e.length!=this.length||e.lines!=this.lines)return false;let t=this.scanIdentical(e,1),s=this.length-this.scanIdentical(e,-1);let r=new pl(this),n=new pl(e);for(let o=t,a=t;;){r.next(o);n.next(o);o=0;if(r.lineBreak!=n.lineBreak||r.done!=n.done||r.value!=n.value)return false;a+=r.value.length;if(r.done||a>=s)return true}}iter(e=1){return new pl(this,e)}iterRange(e,t=this
Line truncated
|
|
|
|
|
\`;const e=this.memoryAddFormContainerEl.querySelector("#agent-add-knowledge-form");const t=this.memoryAddFormContainerEl.querySelector("#agent-knowledge-cancel-btn");t==null?void 0:t.addEventListener("click",()=>this.closeAddKnowledgeForm());e==null?void 0:e.addEventListener("submit",async r=>{r.preventDefault();await this.handleSaveKnowledge()});const s=this.memoryAddFormContainerEl.querySelector("#agent-knowledge-key");s==null?void 0:s.focus()}closeAddKnowledgeForm(){if(!this.memoryAddFormContainerEl)return;this.memoryAddFormContainerEl.classList.add("hidden");this.memoryAddFormContainerEl.replaceChildren()}async handleSaveKnowledge(){if(!this.serverId||!this.memoryAddFormContainerEl)return;const e=this.memoryAddFormContainerEl.querySelector("#agent-knowledge-category");const t=this.memoryAddFormContainerEl.querySelector("#agent-knowledge-key");const s=this.memoryAddFormContainerEl.querySelector("#agent-knowledge-value");const r=(e==null?void 0:e.value)||"note";const n=(t==null?void 0:t.value)||"";const o=(s==null?void 0:s.value)||"";const a=_E({category:r,key:n,value:o});if(!a.ok)return;try{const l=await fetch(\`/api/servers/\${this.serverId}/knowledge\`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a.value)});if(l.ok){Y(g("agent.memorySaved"),{variant:"success"});this.closeAddKnowledgeForm();void this.fetchServerMemory()}}catch{}}}const kE={cf:{goodMax:100,fairMax:250},ws:{goodMax:100,fairMax:200}};function t_(i,e){const t=kE[e];if(i<=t.goodMax)return"good";if(i<=t.fairMax)return"fair";return"poor"}let nm=[];let Uw=[];(()=>{let i="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<i.length;e++)(e%2?Uw:nm).push(t=t+i[e])})();function CE(i){if(i<768)return false;for(let e=0,t=nm.length;;){let s=e+t>>1;if(i<nm[s])t=s;else if(i>=Uw[s])e=s+1;else return true;if(e==t)return false}}function i_(i){return i>=127462&&i<=127487}const s_=8205;function TE(i,e,t=true,s=true){return(t?jw:PE)(i,e,s)}function jw(i,e,t){if(e==i.length)return e;if(e&&Hw(i.charCodeAt(e))&&Vw(i.charCodeAt(e-1)))e--;let s=nf(i,e);e+=r_(s);while(e<i.length){let r=nf(i,e);if(s==s_||r==s_||t&&CE(r)){e+=r_(r);s=r}else if(i_(r)){let n=0,o=e-2;while(o>=0&&i_(nf(i,o))){n++;o-=2}if(n%2==0)break;else e+=2}else{break}}return e}function PE(i,e,t){while(e>1){let s=jw(i,e-2,t);if(s<e)return s;e--}return 0}function nf(i,e){let t=i.charCodeAt(e);if(!Vw(t)||e+1==i.length)return t;let s=i.charCodeAt(e+1);if(!Hw(s))return t;return(t-55296<<10)+(s-56320)+65536}function Hw(i){return i>=56320&&i<57344}function Vw(i){return i>=55296&&i<56320}function r_(i){return i<65536?1:2}let Pe=class Yw{lineAt(e){if(e<0||e>this.length)throw new RangeError(\`Invalid position \${e} in document of length \${this.length}\`);return this.lineInner(e,false,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(\`Invalid line number \${e} in \${this.lines}-line document\`);return this.lineInner(e,true,1,0)}replace(e,t,s){[e,t]=ia(this,e,t);let r=[];this.decompose(0,e,r,2);if(s.length)s.decompose(0,s.length,r,1|2);this.decompose(t,this.length,r,1);return $s.from(r,this.length-(t-e)+s.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=ia(this,e,t);let s=[];this.decompose(e,t,s,0);return $s.from(s,t-e)}eq(e){if(e==this)return true;if(e.length!=this.length||e.lines!=this.lines)return false;let t=this.scanIdentical(e,1),s=this.length-this.scanIdentical(e,-1);let r=new pl(this),n=new pl(e);for(let o=t,a=t;;){r.next(o);n.next(o);o=0;if(r.lineBreak!=n.lineBreak||r.done!=n.done||r.value!=n.value)return false;a+=r.value.length;if(r.done||a>=s)return true}}iter(e=1){return new pl(this,e)}iterRange(e,t=this
Line truncated
|
|
|
|
|
<div class="remote-editor__panel">
|
|
|
|
|
<div class="remote-editor__header">
|
|
|
|
|
<span class="material-symbols-outlined remote-editor__icon" aria-hidden="true">edit_note</span>
|
|
|
|
@@ -669,7 +669,7 @@ Please report this to https://github.com/markedjs/marked.\`,e){let r="<p>An erro
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
\`;return e}buildState(){const e=[dR(),sA(),AA(),zQ(),FQ(),pA(),ZR(),_I({top:true}),hI(),YQ(),JQ(),lD,aD,du.of([{key:"Mod-s",preventDefault:true,run:()=>{void this.requestSave();return true}},...M8,...QI,...XA,...JR,B8]),hD(this.options.filename),this.wrapCompartment.of(this.wrapEnabled?J.lineWrapping:[]),J.updateListener.of(t=>{if(t.docChanged)this.updateStatus()})];if(this.options.readOnly){e.push(we.readOnly.of(true),J.editable.of(false))}return we.create({doc:this.options.content.text,extensions:e})}isDirty(){return this.view.state.doc.toString()!==this.baseline}getContent(){return this.view.state.doc.toString()}markSaved(){this.baseline=this.view.state.doc.toString();this.updateStatus()}focus(){if(!this.closed)this.view.focus()}toggleWrap(){this.wrapEnabled=!this.wrapEnabled;this.view.dispatch({effects:this.wrapCompartment.reconfigure(this.wrapEnabled?J.lineWrapping:[])});uD(this.wrapEnabled);this.syncWrapButton();this.view.focus()}syncWrapButton(){var e;(e=this.wrapButton)==null?void 0:e.setAttribute("aria-pressed",String(this.wrapEnabled))}close(){this.destroy()}updateStatus(){if(this.closed)return;const e=this.options.content.encoding==="gb18030"?g("sftp.editorEncodingGb18030"):g("sftp.editorEncodingUtf8");const t=this.options.content.eol==="\\r\\n"?"CRLF":"LF";const s=this.isDirty()?g("sftp.editorStatusDirty"):g("sftp.editorStatusSaved");this.statusEl.textContent=\`\${e} · \${t} · \${s}\`;if(!this.options.readOnly&&!this.saving){this.saveButton.disabled=!this.isDirty()}}async requestSave(){if(this.closed||this.saving||this.options.readOnly)return;if(!this.isDirty()){Y(g("sftp.editorNoChanges"));return}this.saving=true;this.saveButton.disabled=true;const e=this.saveButton.textContent;this.saveButton.textContent=g("sftp.editorSaving");try{const t=await this.options.onSave();if(t)this.baseline=this.view.state.doc.toString()}finally{this.saving=false;this.saveButton.disabled=this.options.readOnly||!this.isDirty();this.saveButton.textContent=e??g("common.save");this.updateStatus()}}async requestClose(){if(this.closed)return;if(this.saving){Y(g("sftp.editorSavingWait"));return}if(this.isDirty()&&!this.options.readOnly){const e=await Ui({title:g("sftp.editorDirtyTitle"),message:g("sftp.editorDirtyMessage",{name:this.options.filename}),confirmText:g("sftp.editorDiscard"),cancelText:g("common.cancel"),variant:"danger"});if(!e){this.focus();return}}this.destroy()}destroy(){if(this.closed)return;this.closed=true;this.view.destroy();this.dialog.close();this.dialog.remove();this.options.onClose()}}function pD(i){return new fD(i)}const kC=2*1024*1024;const mD=8192;function gD(i,e=mD){const t=Math.min(i.length,e);for(let s=0;s<t;s++){if(i[s]===0)return true}return false}function OD(i){return Number.isFinite(i)&&i>=0&&i<=kC}function Yf(i,e){return(i.match(e)||[]).length}function Qy(i){const e=Yf(i,/\\r\\n/g);const t=Yf(i,/\\n/g)-e;const s=Yf(i,/\\r/g)-e;return e>t+s?"\\r\\n":"\\n"}function _D(i){if(gD(i)){return{ok:false,reason:"binary"}}const e=i.length>=3&&i[0]===239&&i[1]===187&&i[2]===191;const t=e?i.subarray(3):i;try{const s=new TextDecoder("utf-8",{fatal:true}).decode(t);const r=Qy(s);const n=s.replace(/\\r\\n?/g,"\\n");return{ok:true,content:{text:n,encoding:"utf-8",bom:e,eol:r}}}catch{}try{const s=new TextDecoder("gb18030",{fatal:true}).decode(t);const r=Qy(s);const n=s.replace(/\\r\\n?/g,"\\n");return{ok:true,content:{text:n,encoding:"gb18030",bom:e,eol:r}}}catch{return{ok:false,reason:"encoding"}}}function vD(i,e){const t=e.eol==="\\r\\n"?i.split("\\n").join("\\r\\n"):i;const s=new TextEncoder().encode(t);if(!e.bom)return s;const r=new Uint8Array(s.length+3);r[0]=239;r[1]=187;r[2]=191;r.set(s,3);return r}function yD(i){const e=i.startsWith("/")?i:\`/\${i}\`;const t=e.split("/").filter(Boolean);const s=[{name:"/",path:"/"}];let r="";for(const n of t){r+=\`/\${n}\`;s.push({name:n,path:r})}return s}function bD(i,e){return[...i].sort((t,s)=>{if(t.isDir&&!s.isDir)return-1;if(!t.isDir&&s.isDir)return 1;let r=0;if(e.field==="name"){r=t.name.localeCompare(s.name)}else if(e.field==="size"){const n=t.isDir?0:t.size??0;const o=s.isDir?0:s.size??0;r=n-o}else if(e.field==="mtime"){const n=t.modifiedTime??0;const o=s.modifiedTime??0;r=n-o}if(r===0){return t.name.localeCompare(s.name)}return e.direction==="asc"?r:-r})}function SD(i){var t;const e=((t=i.split(".").pop())==null?void 0:t.toLowerCase())||"";switch(e){case"js":case"ts":case"jsx":case"tsx":return"javascript";case"py":return"code";case"sh":case"bash":case"zsh":return"terminal";case"json":case"yaml":case"yml":case"toml":return"data_object";case"md":case"txt":case"log":return"description";case"png":case"jpg":case"jpeg":case"gif":case"svg":case"webp":return"image";case"mp4":case"mkv":case"avi":case"mov":return"movie";case"mp3":case"wav":case"ogg":return"audio_file";case"zip":case"tar":case"gz":case"bz2":case"xz":case"7z":return"folder_zip";case"pdf":return"picture_as_pdf";case"html":case"htm":return"html";case"css":case"scss":case"less":return"css";case"g
Line truncated
|
|
|
|
|
\`;return e}buildState(){const e=[dR(),sA(),AA(),zQ(),FQ(),pA(),ZR(),_I({top:true}),hI(),YQ(),JQ(),lD,aD,du.of([{key:"Mod-s",preventDefault:true,run:()=>{void this.requestSave();return true}},...M8,...QI,...XA,...JR,B8]),hD(this.options.filename),this.wrapCompartment.of(this.wrapEnabled?J.lineWrapping:[]),J.updateListener.of(t=>{if(t.docChanged)this.updateStatus()})];if(this.options.readOnly){e.push(xe.readOnly.of(true),J.editable.of(false))}return xe.create({doc:this.options.content.text,extensions:e})}isDirty(){return this.view.state.doc.toString()!==this.baseline}getContent(){return this.view.state.doc.toString()}markSaved(){this.baseline=this.view.state.doc.toString();this.updateStatus()}focus(){if(!this.closed)this.view.focus()}toggleWrap(){this.wrapEnabled=!this.wrapEnabled;this.view.dispatch({effects:this.wrapCompartment.reconfigure(this.wrapEnabled?J.lineWrapping:[])});uD(this.wrapEnabled);this.syncWrapButton();this.view.focus()}syncWrapButton(){var e;(e=this.wrapButton)==null?void 0:e.setAttribute("aria-pressed",String(this.wrapEnabled))}close(){this.destroy()}updateStatus(){if(this.closed)return;const e=this.options.content.encoding==="gb18030"?g("sftp.editorEncodingGb18030"):g("sftp.editorEncodingUtf8");const t=this.options.content.eol==="\\r\\n"?"CRLF":"LF";const s=this.isDirty()?g("sftp.editorStatusDirty"):g("sftp.editorStatusSaved");this.statusEl.textContent=\`\${e} · \${t} · \${s}\`;if(!this.options.readOnly&&!this.saving){this.saveButton.disabled=!this.isDirty()}}async requestSave(){if(this.closed||this.saving||this.options.readOnly)return;if(!this.isDirty()){Y(g("sftp.editorNoChanges"));return}this.saving=true;this.saveButton.disabled=true;const e=this.saveButton.textContent;this.saveButton.textContent=g("sftp.editorSaving");try{const t=await this.options.onSave();if(t)this.baseline=this.view.state.doc.toString()}finally{this.saving=false;this.saveButton.disabled=this.options.readOnly||!this.isDirty();this.saveButton.textContent=e??g("common.save");this.updateStatus()}}async requestClose(){if(this.closed)return;if(this.saving){Y(g("sftp.editorSavingWait"));return}if(this.isDirty()&&!this.options.readOnly){const e=await Ui({title:g("sftp.editorDirtyTitle"),message:g("sftp.editorDirtyMessage",{name:this.options.filename}),confirmText:g("sftp.editorDiscard"),cancelText:g("common.cancel"),variant:"danger"});if(!e){this.focus();return}}this.destroy()}destroy(){if(this.closed)return;this.closed=true;this.view.destroy();this.dialog.close();this.dialog.remove();this.options.onClose()}}function pD(i){return new fD(i)}const kC=2*1024*1024;const mD=8192;function gD(i,e=mD){const t=Math.min(i.length,e);for(let s=0;s<t;s++){if(i[s]===0)return true}return false}function OD(i){return Number.isFinite(i)&&i>=0&&i<=kC}function Yf(i,e){return(i.match(e)||[]).length}function Qy(i){const e=Yf(i,/\\r\\n/g);const t=Yf(i,/\\n/g)-e;const s=Yf(i,/\\r/g)-e;return e>t+s?"\\r\\n":"\\n"}function _D(i){if(gD(i)){return{ok:false,reason:"binary"}}const e=i.length>=3&&i[0]===239&&i[1]===187&&i[2]===191;const t=e?i.subarray(3):i;try{const s=new TextDecoder("utf-8",{fatal:true}).decode(t);const r=Qy(s);const n=s.replace(/\\r\\n?/g,"\\n");return{ok:true,content:{text:n,encoding:"utf-8",bom:e,eol:r}}}catch{}try{const s=new TextDecoder("gb18030",{fatal:true}).decode(t);const r=Qy(s);const n=s.replace(/\\r\\n?/g,"\\n");return{ok:true,content:{text:n,encoding:"gb18030",bom:e,eol:r}}}catch{return{ok:false,reason:"encoding"}}}function vD(i,e){const t=e.eol==="\\r\\n"?i.split("\\n").join("\\r\\n"):i;const s=new TextEncoder().encode(t);if(!e.bom)return s;const r=new Uint8Array(s.length+3);r[0]=239;r[1]=187;r[2]=191;r.set(s,3);return r}function yD(i){const e=i.startsWith("/")?i:\`/\${i}\`;const t=e.split("/").filter(Boolean);const s=[{name:"/",path:"/"}];let r="";for(const n of t){r+=\`/\${n}\`;s.push({name:n,path:r})}return s}function bD(i,e){return[...i].sort((t,s)=>{if(t.isDir&&!s.isDir)return-1;if(!t.isDir&&s.isDir)return 1;let r=0;if(e.field==="name"){r=t.name.localeCompare(s.name)}else if(e.field==="size"){const n=t.isDir?0:t.size??0;const o=s.isDir?0:s.size??0;r=n-o}else if(e.field==="mtime"){const n=t.modifiedTime??0;const o=s.modifiedTime??0;r=n-o}if(r===0){return t.name.localeCompare(s.name)}return e.direction==="asc"?r:-r})}function SD(i){var t;const e=((t=i.split(".").pop())==null?void 0:t.toLowerCase())||"";switch(e){case"js":case"ts":case"jsx":case"tsx":return"javascript";case"py":return"code";case"sh":case"bash":case"zsh":return"terminal";case"json":case"yaml":case"yml":case"toml":return"data_object";case"md":case"txt":case"log":return"description";case"png":case"jpg":case"jpeg":case"gif":case"svg":case"webp":return"image";case"mp4":case"mkv":case"avi":case"mov":return"movie";case"mp3":case"wav":case"ogg":return"audio_file";case"zip":case"tar":case"gz":case"bz2":case"xz":case"7z":return"folder_zip";case"pdf":return"picture_as_pdf";case"html":case"htm":return"html";case"css":case"scss":case"less":return"css";case"g
Line truncated
|
|
|
|
|
<div class="flex flex-col w-full h-full bg-surface border-l border-outline-variant text-on-surface">
|
|
|
|
|
<!-- Header -->
|
|
|
|
|
<div class="sftp-panel-header flex items-center justify-between px-4 h-12 border-b border-outline-variant bg-elevated shrink-0">
|
|
|
|
@@ -850,7 +850,7 @@ Please report this to https://github.com/markedjs/marked.\`,e){let r="<p>An erro
|
|
|
|
|
|
|
|
|
|
\`+e.stack):new Error(e.message+\`
|
|
|
|
|
|
|
|
|
|
\`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};var XD=new qD;function Gf(i){ND(i)||XD.onUnexpectedError(i)}var pg="Canceled";function ND(i){return i instanceof FD?true:i instanceof Error&&i.name===pg&&i.message===pg}var FD=class XU extends Error{constructor(){super(pg),this.name=this.message}};var Ly=class mg extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof mg)return e;let t=new mg;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}};var ZD;(i=>{function e(n){return n<0}i.isLessThan=e;function t(n){return n<=0}i.isLessThanOrEqual=t;function s(n){return n>0}i.isGreaterThan=s;function r(n){return n===0}i.isNeitherLessOrGreaterThan=r,i.greaterThan=1,i.lessThan=-1,i.neitherLessOrGreaterThan=0})(ZD||(ZD={}));function UD(i,e){let t=this,s=false,r;return function(){if(s)return r;if(s=true,e);else r=i.apply(t,arguments);return r}}var CC;(i=>{function e(_){return _&&typeof _=="object"&&typeof _[Symbol.iterator]=="function"}i.is=e;let t=Object.freeze([]);function s(){return t}i.empty=s;function*r(_){yield _}i.single=r;function n(_){return e(_)?_:r(_)}i.wrap=n;function o(_){return _||t}i.from=o;function*a(_){for(let C=_.length-1;C>=0;C--)yield _[C]}i.reverse=a;function l(_){return!_||_[Symbol.iterator]().next().done===true}i.isEmpty=l;function h(_){return _[Symbol.iterator]().next().value}i.first=h;function c(_,C){let w=0;for(let Q of _)if(C(Q,w++))return true;return false}i.some=c;function d(_,C){for(let w of _)if(C(w))return w}i.find=d;function*u(_,C){for(let w of _)C(w)&&(yield w)}i.filter=u;function*f(_,C){let w=0;for(let Q of _)yield C(Q,w++)}i.map=f;function*p(_,C){let w=0;for(let Q of _)yield*C(Q,w++)}i.flatMap=p;function*m(..._){for(let C of _)yield*C}i.concat=m;function O(_,C,w){let Q=w;for(let D of _)Q=C(Q,D);return Q}i.reduce=O;function*v(_,C,w=_.length){for(C<0&&(C+=_.length),w<0?w+=_.length:w>_.length&&(w=_.length);C<w;C++)yield _[C]}i.slice=v;function T(_,C=Number.POSITIVE_INFINITY){let w=[];if(C===0)return[w,_];let Q=_[Symbol.iterator]();for(let D=0;D<C;D++){let I=Q.next();if(I.done)return[w,i.empty()];w.push(I.value)}return[w,{[Symbol.iterator](){return Q}}]}i.consume=T;async function k(_){let C=[];for await(let w of _)C.push(w);return Promise.resolve(C)}i.asyncToArray=k})(CC||(CC={}));function jD(i){return i}function TC(i,e){}function wl(i){if(CC.is(i)){let e=[];for(let t of i)if(t)try{t.dispose()}catch(s){e.push(s)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(i)?[]:i}else if(i)return i.dispose(),i}function PC(...i){let e=va(()=>wl(i));return e}function va(i){let e=jD({dispose:UD(()=>{i()})});return e}var $C=class EC{constructor(){this._toDispose=new Set;this._isDisposed=false}dispose(){this._isDisposed||(this._isDisposed=true,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{wl(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?EC.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),TC())}};$C.DISABLE_DISPOSED_WARNING=false;var $0=$C;var mn=class NU{constructor(){this._store=new $0;TC(this._store)}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};mn.None=Object.freeze({dispose(){}});var Xd=class FU{constructor(){this._isDisposed=false}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null?void 0:t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=true,(e=this._value)==null?void 0:e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}};var HD=globalThis.performance&&typeof globalThis.performance.now=="function";var VD=class QC{static create(e){return new QC(e)}constructor(e){this._now=HD&&e===false?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=th
Line truncated
|
|
|
|
|
\`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};var XD=new qD;function Gf(i){ND(i)||XD.onUnexpectedError(i)}var pg="Canceled";function ND(i){return i instanceof FD?true:i instanceof Error&&i.name===pg&&i.message===pg}var FD=class XU extends Error{constructor(){super(pg),this.name=this.message}};var Ly=class mg extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof mg)return e;let t=new mg;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}};var ZD;(i=>{function e(n){return n<0}i.isLessThan=e;function t(n){return n<=0}i.isLessThanOrEqual=t;function s(n){return n>0}i.isGreaterThan=s;function r(n){return n===0}i.isNeitherLessOrGreaterThan=r,i.greaterThan=1,i.lessThan=-1,i.neitherLessOrGreaterThan=0})(ZD||(ZD={}));function UD(i,e){let t=this,s=false,r;return function(){if(s)return r;if(s=true,e);else r=i.apply(t,arguments);return r}}var CC;(i=>{function e(_){return _&&typeof _=="object"&&typeof _[Symbol.iterator]=="function"}i.is=e;let t=Object.freeze([]);function s(){return t}i.empty=s;function*r(_){yield _}i.single=r;function n(_){return e(_)?_:r(_)}i.wrap=n;function o(_){return _||t}i.from=o;function*a(_){for(let C=_.length-1;C>=0;C--)yield _[C]}i.reverse=a;function l(_){return!_||_[Symbol.iterator]().next().done===true}i.isEmpty=l;function h(_){return _[Symbol.iterator]().next().value}i.first=h;function c(_,C){let w=0;for(let Q of _)if(C(Q,w++))return true;return false}i.some=c;function d(_,C){for(let w of _)if(C(w))return w}i.find=d;function*u(_,C){for(let w of _)C(w)&&(yield w)}i.filter=u;function*f(_,C){let w=0;for(let Q of _)yield C(Q,w++)}i.map=f;function*p(_,C){let w=0;for(let Q of _)yield*C(Q,w++)}i.flatMap=p;function*m(..._){for(let C of _)yield*C}i.concat=m;function O(_,C,w){let Q=w;for(let D of _)Q=C(Q,D);return Q}i.reduce=O;function*v(_,C,w=_.length){for(C<0&&(C+=_.length),w<0?w+=_.length:w>_.length&&(w=_.length);C<w;C++)yield _[C]}i.slice=v;function T(_,C=Number.POSITIVE_INFINITY){let w=[];if(C===0)return[w,_];let Q=_[Symbol.iterator]();for(let D=0;D<C;D++){let I=Q.next();if(I.done)return[w,i.empty()];w.push(I.value)}return[w,{[Symbol.iterator](){return Q}}]}i.consume=T;async function k(_){let C=[];for await(let w of _)C.push(w);return Promise.resolve(C)}i.asyncToArray=k})(CC||(CC={}));function jD(i){return i}function TC(i,e){}function wl(i){if(CC.is(i)){let e=[];for(let t of i)if(t)try{t.dispose()}catch(s){e.push(s)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(i)?[]:i}else if(i)return i.dispose(),i}function PC(...i){let e=va(()=>wl(i));return e}function va(i){let e=jD({dispose:UD(()=>{i()})});return e}var $C=class EC{constructor(){this._toDispose=new Set;this._isDisposed=false}dispose(){this._isDisposed||(this._isDisposed=true,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{wl(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?EC.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),TC())}};$C.DISABLE_DISPOSED_WARNING=false;var $0=$C;var mn=class NU{constructor(){this._store=new $0;TC(this._store)}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};mn.None=Object.freeze({dispose(){}});var Xd=class FU{constructor(){this._isDisposed=false}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null?void 0:t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=true,(e=this._value)==null?void 0:e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}};var HD=globalThis.performance&&typeof globalThis.performance.now=="function";var VD=class QC{static create(e){return new QC(e)}constructor(e){this._now=HD&&e===false?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=th
Line truncated
|
|
|
|
|
\`).slice(2).join(\`
|
|
|
|
|
\`))}};var ez=class ZU extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}};var tz=class UU extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}};var iz=0;var Kf=class jU{constructor(e){this.value=e;this.id=iz++}};var sz=2;var rz;var Cs=class HU{constructor(e){var t,s,r,n;this._size=0;this._options=e,this._leakageMon=((t=this._options)==null?void 0:t.leakWarningThreshold)?new KD((e==null?void 0:e.onListenerError)??Gf,((s=this._options)==null?void 0:s.leakWarningThreshold)??GD):void 0,this._perfMon=((r=this._options)==null?void 0:r._profName)?new YD(this._options._profName):void 0,this._deliveryQueue=(n=this._options)==null?void 0:n.deliveryQueue}dispose(){var e,t,s,r;if(!this._disposed){if(this._disposed=true,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners){this._listeners=void 0,this._size=0}(s=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null?void 0:s.call(t),(r=this._leakageMon)==null?void 0:r.dispose()}}get event(){return this._event??(this._event=(e,t,s)=>{var a,l,h,c,d;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let u=\`[\${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (\${this._size} vs \${this._leakageMon.threshold})\`;console.warn(u);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new tz(\`\${u}. HINT: Stack shows most frequent listener (\${f[1]}-times)\`,f[0]);return(((a=this._options)==null?void 0:a.onListenerError)||Gf)(p),mn.None}if(this._disposed)return mn.None;t&&(e=e.bind(t));let r=new Kf(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=JD.create(),n=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Kf?(this._deliveryQueue??(this._deliveryQueue=new nz),this._listeners=[this._listeners,r]):this._listeners.push(r):((h=(l=this._options)==null?void 0:l.onWillAddFirstListener)==null?void 0:h.call(l,this),this._listeners=r,(d=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null?void 0:d.call(c,this)),this._size++;let o=va(()=>{n==null?void 0:n(),this._removeListener(r)});if(s instanceof $0?s.add(o):Array.isArray(s)&&s.push(o),rz);return o}),this._event}_removeListener(e){var n,o,a,l;if((o=(n=this._options)==null?void 0:n.onWillRemoveListener)==null?void 0:o.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(l=(a=this._options)==null?void 0:a.onDidRemoveLastListener)==null?void 0:l.call(a,this),this._size=0;return}let t=this._listeners,s=t.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[s]=void 0;let r=this._deliveryQueue.current===this;if(this._size*sz<=t.length){let h=0;for(let c=0;c<t.length;c++)t[c]?t[h++]=t[c]:r&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){var r;if(!e)return;let s=((r=this._options)==null?void 0:r.onListenerError)||Gf;if(!s){e.value(t);return}try{e.value(t)}catch(n){s(n)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,s,r,n;if(((t=this._deliveryQueue)==null?void 0:t.current)&&(this._deliverQueue(this._deliveryQueue),(s=this._perfMon)==null?void 0:s.stop()),(r=this._perfMon)==null?void 0:r.start(this._size),this._listeners)if(this._listeners instanceof Kf)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(n=this._perfMon)==null?void 0:n.stop()}hasListeners(){return this._size>0}};var nz=class VU{constructor(){this.i=-1;this.end=0}enqueue(e,t,s){this.i=0,this.end=s,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}};var MC=Object.freeze(function(i,e){let t=setTimeout(i.bind(e),0);return{dispose(){clearTimeout(t)}}});var oz;(i=>{function e(t){return t===i.None||t===i.Cancelled||t instanceof az?true:!t||typeof t!="object"?false:typeof t.isCancellationRequested=="boolean"&&typeof t.onCancellationRequested=="function"}i.isCancellationToken=e,i.None=Object.freeze({isCancellationRequested:false,onCancellationRequested:E0.None}),i.Cancelled=Object.freeze({isCancellationRequested:true,onCancellationRequested:MC})})(oz||(oz={}));var az=class YU{constructor(){this._isCancelled=false;this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=true,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?MC:(this._emitter||(this._emitter=new Cs),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var Do="en";var Jf=false;var lc;var Xc=Do;var My=Do;var lz;var Ki;var Fn=globalThis;var Dt;var NS;t
Line truncated
|
|
|
|
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
|
|
@@ -878,9 +878,9 @@ Please report this to https://github.com/markedjs/marked.\`,e){let r="<p>An erro
|
|
|
|
|
|
|
|
|
|
\`+e.stack):new Error(e.message+\`
|
|
|
|
|
|
|
|
|
|
\`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};var Ez=new $z;function ep(i){Qz(i)||Ez.onUnexpectedError(i)}var _g="Canceled";function Qz(i){return i instanceof Rz?true:i instanceof Error&&i.name===_g&&i.message===_g}var Rz=class oj extends Error{constructor(){super(_g),this.name=this.message}};var Iy=class vg extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof vg)return e;let t=new vg;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}};var Az;(i=>{function e(n){return n<0}i.isLessThan=e;function t(n){return n<=0}i.isLessThanOrEqual=t;function s(n){return n>0}i.isGreaterThan=s;function r(n){return n===0}i.isNeitherLessOrGreaterThan=r,i.greaterThan=1,i.lessThan=-1,i.neitherLessOrGreaterThan=0})(Az||(Az={}));function Lz(i,e){let t=this,s=false,r;return function(){if(s)return r;if(s=true,e);else r=i.apply(t,arguments);return r}}var IC;(i=>{function e(_){return _&&typeof _=="object"&&typeof _[Symbol.iterator]=="function"}i.is=e;let t=Object.freeze([]);function s(){return t}i.empty=s;function*r(_){yield _}i.single=r;function n(_){return e(_)?_:r(_)}i.wrap=n;function o(_){return _||t}i.from=o;function*a(_){for(let C=_.length-1;C>=0;C--)yield _[C]}i.reverse=a;function l(_){return!_||_[Symbol.iterator]().next().done===true}i.isEmpty=l;function h(_){return _[Symbol.iterator]().next().value}i.first=h;function c(_,C){let w=0;for(let Q of _)if(C(Q,w++))return true;return false}i.some=c;function d(_,C){for(let w of _)if(C(w))return w}i.find=d;function*u(_,C){for(let w of _)C(w)&&(yield w)}i.filter=u;function*f(_,C){let w=0;for(let Q of _)yield C(Q,w++)}i.map=f;function*p(_,C){let w=0;for(let Q of _)yield*C(Q,w++)}i.flatMap=p;function*m(..._){for(let C of _)yield*C}i.concat=m;function O(_,C,w){let Q=w;for(let D of _)Q=C(Q,D);return Q}i.reduce=O;function*v(_,C,w=_.length){for(C<0&&(C+=_.length),w<0?w+=_.length:w>_.length&&(w=_.length);C<w;C++)yield _[C]}i.slice=v;function T(_,C=Number.POSITIVE_INFINITY){let w=[];if(C===0)return[w,_];let Q=_[Symbol.iterator]();for(let D=0;D<C;D++){let I=Q.next();if(I.done)return[w,i.empty()];w.push(I.value)}return[w,{[Symbol.iterator](){return Q}}]}i.consume=T;async function k(_){let C=[];for await(let w of _)C.push(w);return Promise.resolve(C)}i.asyncToArray=k})(IC||(IC={}));function Mz(i){return i}function DC(i,e){}function zC(i){if(IC.is(i)){let e=[];for(let t of i)if(t)try{t.dispose()}catch(s){e.push(s)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(i)?[]:i}else if(i)return i.dispose(),i}function WC(...i){let e=Vt(()=>zC(i));return e}function Vt(i){let e=Mz({dispose:Lz(()=>{i()})});return e}var qC=class XC{constructor(){this._toDispose=new Set;this._isDisposed=false}dispose(){this._isDisposed||(this._isDisposed=true,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{zC(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?XC.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),DC())}};qC.DISABLE_DISPOSED_WARNING=false;var Ko=qC;var os=class aj{constructor(){this._store=new Ko;DC(this._store)}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};os.None=Object.freeze({dispose(){}});var za=class lj{constructor(){this._isDisposed=false}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null?void 0:t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=true,(e=this._value)==null?void 0:e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}};var Q0=typeof process<"u"&&"title"in process;var ku=Q0?"node":navigator.userAgent;var Bz=Q0?"node":navigator.platform;var Iz=ku.includes("Firefox");var Dz=ku.includes("Edge");var NC=/^((?!chrome|android).)*safari/i.test(ku);function zz(){if(!NC)return 0;let i=ku.match(/Version\\/(\\d+)/);return i===null||i.length<2?0:parseInt(i[1])}Bz.
Line truncated
|
|
|
|
|
\`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};var Ez=new $z;function ep(i){Qz(i)||Ez.onUnexpectedError(i)}var _g="Canceled";function Qz(i){return i instanceof Rz?true:i instanceof Error&&i.name===_g&&i.message===_g}var Rz=class oj extends Error{constructor(){super(_g),this.name=this.message}};var Iy=class vg extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof vg)return e;let t=new vg;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}};var Az;(i=>{function e(n){return n<0}i.isLessThan=e;function t(n){return n<=0}i.isLessThanOrEqual=t;function s(n){return n>0}i.isGreaterThan=s;function r(n){return n===0}i.isNeitherLessOrGreaterThan=r,i.greaterThan=1,i.lessThan=-1,i.neitherLessOrGreaterThan=0})(Az||(Az={}));function Lz(i,e){let t=this,s=false,r;return function(){if(s)return r;if(s=true,e);else r=i.apply(t,arguments);return r}}var IC;(i=>{function e(_){return _&&typeof _=="object"&&typeof _[Symbol.iterator]=="function"}i.is=e;let t=Object.freeze([]);function s(){return t}i.empty=s;function*r(_){yield _}i.single=r;function n(_){return e(_)?_:r(_)}i.wrap=n;function o(_){return _||t}i.from=o;function*a(_){for(let C=_.length-1;C>=0;C--)yield _[C]}i.reverse=a;function l(_){return!_||_[Symbol.iterator]().next().done===true}i.isEmpty=l;function h(_){return _[Symbol.iterator]().next().value}i.first=h;function c(_,C){let w=0;for(let Q of _)if(C(Q,w++))return true;return false}i.some=c;function d(_,C){for(let w of _)if(C(w))return w}i.find=d;function*u(_,C){for(let w of _)C(w)&&(yield w)}i.filter=u;function*f(_,C){let w=0;for(let Q of _)yield C(Q,w++)}i.map=f;function*p(_,C){let w=0;for(let Q of _)yield*C(Q,w++)}i.flatMap=p;function*m(..._){for(let C of _)yield*C}i.concat=m;function O(_,C,w){let Q=w;for(let D of _)Q=C(Q,D);return Q}i.reduce=O;function*v(_,C,w=_.length){for(C<0&&(C+=_.length),w<0?w+=_.length:w>_.length&&(w=_.length);C<w;C++)yield _[C]}i.slice=v;function T(_,C=Number.POSITIVE_INFINITY){let w=[];if(C===0)return[w,_];let Q=_[Symbol.iterator]();for(let D=0;D<C;D++){let I=Q.next();if(I.done)return[w,i.empty()];w.push(I.value)}return[w,{[Symbol.iterator](){return Q}}]}i.consume=T;async function k(_){let C=[];for await(let w of _)C.push(w);return Promise.resolve(C)}i.asyncToArray=k})(IC||(IC={}));function Mz(i){return i}function DC(i,e){}function zC(i){if(IC.is(i)){let e=[];for(let t of i)if(t)try{t.dispose()}catch(s){e.push(s)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(i)?[]:i}else if(i)return i.dispose(),i}function WC(...i){let e=Vt(()=>zC(i));return e}function Vt(i){let e=Mz({dispose:Lz(()=>{i()})});return e}var qC=class XC{constructor(){this._toDispose=new Set;this._isDisposed=false}dispose(){this._isDisposed||(this._isDisposed=true,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{zC(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?XC.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),DC())}};qC.DISABLE_DISPOSED_WARNING=false;var Ko=qC;var os=class aj{constructor(){this._store=new Ko;DC(this._store)}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};os.None=Object.freeze({dispose(){}});var za=class lj{constructor(){this._isDisposed=false}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null?void 0:t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=true,(e=this._value)==null?void 0:e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}};var Q0=typeof process<"u"&&"title"in process;var ku=Q0?"node":navigator.userAgent;var Bz=Q0?"node":navigator.platform;var Iz=ku.includes("Firefox");var Dz=ku.includes("Edge");var NC=/^((?!chrome|android).)*safari/i.test(ku);function zz(){if(!NC)return 0;let i=ku.match(/Version\\/(\\d+)/);return i===null||i.length<2?0:parseInt(i[1])}Bz.
Line truncated
|
|
|
|
|
\`).slice(2).join(\`
|
|
|
|
|
\`))}};var pW=class mj extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}};var mW=class gj extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}};var gW=0;var ip=class Oj{constructor(e){this.value=e;this.id=gW++}};var OW=2;var _W;var Ne=class _j{constructor(e){var t,s,r,n;this._size=0;this._options=e,this._leakageMon=((t=this._options)==null?void 0:t.leakWarningThreshold)?new uW((e==null?void 0:e.onListenerError)??ep,((s=this._options)==null?void 0:s.leakWarningThreshold)??dW):void 0,this._perfMon=((r=this._options)==null?void 0:r._profName)?new cW(this._options._profName):void 0,this._deliveryQueue=(n=this._options)==null?void 0:n.deliveryQueue}dispose(){var e,t,s,r;if(!this._disposed){if(this._disposed=true,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners){this._listeners=void 0,this._size=0}(s=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null?void 0:s.call(t),(r=this._leakageMon)==null?void 0:r.dispose()}}get event(){return this._event??(this._event=(e,t,s)=>{var a,l,h,c,d;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let u=\`[\${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (\${this._size} vs \${this._leakageMon.threshold})\`;console.warn(u);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new mW(\`\${u}. HINT: Stack shows most frequent listener (\${f[1]}-times)\`,f[0]);return(((a=this._options)==null?void 0:a.onListenerError)||ep)(p),os.None}if(this._disposed)return os.None;t&&(e=e.bind(t));let r=new ip(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=fW.create(),n=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof ip?(this._deliveryQueue??(this._deliveryQueue=new vW),this._listeners=[this._listeners,r]):this._listeners.push(r):((h=(l=this._options)==null?void 0:l.onWillAddFirstListener)==null?void 0:h.call(l,this),this._listeners=r,(d=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null?void 0:d.call(c,this)),this._size++;let o=Vt(()=>{n==null?void 0:n(),this._removeListener(r)});if(s instanceof Ko?s.add(o):Array.isArray(s)&&s.push(o),_W);return o}),this._event}_removeListener(e){var n,o,a,l;if((o=(n=this._options)==null?void 0:n.onWillRemoveListener)==null?void 0:o.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(l=(a=this._options)==null?void 0:a.onDidRemoveLastListener)==null?void 0:l.call(a,this),this._size=0;return}let t=this._listeners,s=t.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[s]=void 0;let r=this._deliveryQueue.current===this;if(this._size*OW<=t.length){let h=0;for(let c=0;c<t.length;c++)t[c]?t[h++]=t[c]:r&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){var r;if(!e)return;let s=((r=this._options)==null?void 0:r.onListenerError)||ep;if(!s){e.value(t);return}try{e.value(t)}catch(n){s(n)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,s,r,n;if(((t=this._deliveryQueue)==null?void 0:t.current)&&(this._deliverQueue(this._deliveryQueue),(s=this._perfMon)==null?void 0:s.stop()),(r=this._perfMon)==null?void 0:r.start(this._size),this._listeners)if(this._listeners instanceof ip)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(n=this._perfMon)==null?void 0:n.stop()}hasListeners(){return this._size>0}};var vW=class vj{constructor(){this.i=-1;this.end=0}enqueue(e,t,s){this.i=0,this.end=s,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}};var Xy={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};var Wa=2;var qa;var Dr=class Lo{constructor(e,t,s){this._document=e;this._config=t;this._unicodeService=s;this._didWarmUp=false;this._cacheMap=new qy;this._cacheMapCombined=new qy;this._pages=[];this._activePages=[];this._workBoundingBox={top:0,left:0,bottom:0,right:0};this._workAttributeData=new zo;this._textureSize=512;this._onAddTextureAtlasCanvas=new Ne;this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event;this._onRemoveTextureAtlasCanvas=new Ne;this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event;this._requestClearModel=false;this._createNewPage(),this._tmpCanvas=i3(e,this._config.deviceCellWidth*4+Wa*2,this._config.deviceCellHeight+Wa*2),this._tmpCtx=ct(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:true}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();t
Line truncated
|
|
|
|
|
\`))}};var pW=class mj extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}};var mW=class gj extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}};var gW=0;var ip=class Oj{constructor(e){this.value=e;this.id=gW++}};var OW=2;var _W;var Ne=class _j{constructor(e){var t,s,r,n;this._size=0;this._options=e,this._leakageMon=((t=this._options)==null?void 0:t.leakWarningThreshold)?new uW((e==null?void 0:e.onListenerError)??ep,((s=this._options)==null?void 0:s.leakWarningThreshold)??dW):void 0,this._perfMon=((r=this._options)==null?void 0:r._profName)?new cW(this._options._profName):void 0,this._deliveryQueue=(n=this._options)==null?void 0:n.deliveryQueue}dispose(){var e,t,s,r;if(!this._disposed){if(this._disposed=true,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners){this._listeners=void 0,this._size=0}(s=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null?void 0:s.call(t),(r=this._leakageMon)==null?void 0:r.dispose()}}get event(){return this._event??(this._event=(e,t,s)=>{var a,l,h,c,d;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let u=\`[\${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (\${this._size} vs \${this._leakageMon.threshold})\`;console.warn(u);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new mW(\`\${u}. HINT: Stack shows most frequent listener (\${f[1]}-times)\`,f[0]);return(((a=this._options)==null?void 0:a.onListenerError)||ep)(p),os.None}if(this._disposed)return os.None;t&&(e=e.bind(t));let r=new ip(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=fW.create(),n=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof ip?(this._deliveryQueue??(this._deliveryQueue=new vW),this._listeners=[this._listeners,r]):this._listeners.push(r):((h=(l=this._options)==null?void 0:l.onWillAddFirstListener)==null?void 0:h.call(l,this),this._listeners=r,(d=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null?void 0:d.call(c,this)),this._size++;let o=Vt(()=>{n==null?void 0:n(),this._removeListener(r)});if(s instanceof Ko?s.add(o):Array.isArray(s)&&s.push(o),_W);return o}),this._event}_removeListener(e){var n,o,a,l;if((o=(n=this._options)==null?void 0:n.onWillRemoveListener)==null?void 0:o.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(l=(a=this._options)==null?void 0:a.onDidRemoveLastListener)==null?void 0:l.call(a,this),this._size=0;return}let t=this._listeners,s=t.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[s]=void 0;let r=this._deliveryQueue.current===this;if(this._size*OW<=t.length){let h=0;for(let c=0;c<t.length;c++)t[c]?t[h++]=t[c]:r&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){var r;if(!e)return;let s=((r=this._options)==null?void 0:r.onListenerError)||ep;if(!s){e.value(t);return}try{e.value(t)}catch(n){s(n)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,s,r,n;if(((t=this._deliveryQueue)==null?void 0:t.current)&&(this._deliverQueue(this._deliveryQueue),(s=this._perfMon)==null?void 0:s.stop()),(r=this._perfMon)==null?void 0:r.start(this._size),this._listeners)if(this._listeners instanceof ip)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(n=this._perfMon)==null?void 0:n.stop()}hasListeners(){return this._size>0}};var vW=class vj{constructor(){this.i=-1;this.end=0}enqueue(e,t,s){this.i=0,this.end=s,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}};var Xy={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};var Wa=2;var qa;var Dr=class Lo{constructor(e,t,s){this._document=e;this._config=t;this._unicodeService=s;this._didWarmUp=false;this._cacheMap=new qy;this._cacheMapCombined=new qy;this._pages=[];this._activePages=[];this._workBoundingBox={top:0,left:0,bottom:0,right:0};this._workAttributeData=new zo;this._textureSize=512;this._onAddTextureAtlasCanvas=new Ne;this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event;this._onRemoveTextureAtlasCanvas=new Ne;this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event;this._requestClearModel=false;this._createNewPage(),this._tmpCanvas=i3(e,this._config.deviceCellWidth*4+Wa*2,this._config.deviceCellHeight+Wa*2),this._tmpCtx=ct(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:true}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();t
Line truncated
|
|
|
|
|
layout (location = 0) in vec2 a_unitquad;
|
|
|
|
|
layout (location = 1) in vec2 a_cellpos;
|
|
|
|
|
layout (location = 2) in vec2 a_offset;
|
|
|
|
@@ -954,11 +954,11 @@ WARNING: This link could potentially be dangerous\`)){let t=window.open();if(t){
|
|
|
|
|
|
|
|
|
|
\`+i.stack):new Error(i.message+\`
|
|
|
|
|
|
|
|
|
|
\`+i.stack):i},0)}}addListener(i){return this.listeners.push(i),()=>{this._removeListener(i)}}emit(i){this.listeners.forEach(e=>{e(i)})}_removeListener(i){this.listeners.splice(this.listeners.indexOf(i),1)}setUnexpectedErrorHandler(i){this.unexpectedErrorHandler=i}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(i){this.unexpectedErrorHandler(i),this.emit(i)}onUnexpectedExternalError(i){this.unexpectedErrorHandler(i)}};var xq=new wq;function jc(i){kq(i)||xq.onUnexpectedError(i)}var Pg="Canceled";function kq(i){return i instanceof Cq?true:i instanceof Error&&i.name===Pg&&i.message===Pg}var Cq=class qj extends Error{constructor(){super(Pg),this.name=this.message}};function Tq(i){return new Error(\`Illegal argument: \${i}\`)}var pb=class $g extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof $g)return e;let t=new $g;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}};var Eg=class S3 extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,S3.prototype)}};function wi(i,e=0){return i[i.length-(1+e)]}var Pq;(i=>{function e(n){return n<0}i.isLessThan=e;function t(n){return n<=0}i.isLessThanOrEqual=t;function s(n){return n>0}i.isGreaterThan=s;function r(n){return n===0}i.isNeitherLessOrGreaterThan=r,i.greaterThan=1,i.lessThan=-1,i.neitherLessOrGreaterThan=0})(Pq||(Pq={}));function $q(i,e){let t=this,s=false,r;return function(){if(s)return r;if(s=true,e);else r=i.apply(t,arguments);return r}}var w3;(i=>{function e(_){return _&&typeof _=="object"&&typeof _[Symbol.iterator]=="function"}i.is=e;let t=Object.freeze([]);function s(){return t}i.empty=s;function*r(_){yield _}i.single=r;function n(_){return e(_)?_:r(_)}i.wrap=n;function o(_){return _||t}i.from=o;function*a(_){for(let C=_.length-1;C>=0;C--)yield _[C]}i.reverse=a;function l(_){return!_||_[Symbol.iterator]().next().done===true}i.isEmpty=l;function h(_){return _[Symbol.iterator]().next().value}i.first=h;function c(_,C){let w=0;for(let Q of _)if(C(Q,w++))return true;return false}i.some=c;function d(_,C){for(let w of _)if(C(w))return w}i.find=d;function*u(_,C){for(let w of _)C(w)&&(yield w)}i.filter=u;function*f(_,C){let w=0;for(let Q of _)yield C(Q,w++)}i.map=f;function*p(_,C){let w=0;for(let Q of _)yield*C(Q,w++)}i.flatMap=p;function*m(..._){for(let C of _)yield*C}i.concat=m;function O(_,C,w){let Q=w;for(let D of _)Q=C(Q,D);return Q}i.reduce=O;function*v(_,C,w=_.length){for(C<0&&(C+=_.length),w<0?w+=_.length:w>_.length&&(w=_.length);C<w;C++)yield _[C]}i.slice=v;function T(_,C=Number.POSITIVE_INFINITY){let w=[];if(C===0)return[w,_];let Q=_[Symbol.iterator]();for(let D=0;D<C;D++){let I=Q.next();if(I.done)return[w,i.empty()];w.push(I.value)}return[w,{[Symbol.iterator](){return Q}}]}i.consume=T;async function k(_){let C=[];for await(let w of _)C.push(w);return Promise.resolve(C)}i.asyncToArray=k})(w3||(w3={}));function Eq(i){return i}function x3(i,e){}function mb(i){return i}function no(i){if(w3.is(i)){let e=[];for(let t of i)if(t)try{t.dispose()}catch(s){e.push(s)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(i)?[]:i}else if(i)return i.dispose(),i}function Qq(...i){let e=je(()=>no(i));return e}function je(i){let e=Eq({dispose:$q(()=>{i()})});return e}var k3=class C3{constructor(){this._toDispose=new Set;this._isDisposed=false}dispose(){this._isDisposed||(this._isDisposed=true,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{no(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?C3.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),x3())}};k3.DISABLE_DISPOSED_WARNING=false;var tn=k3;var Oe=class Xj{constructor(){this._store=new tn;x3(this._store)}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Oe.None=Object.freeze({dispose(){}});var fa=class Nj{constructor(){this._isDisposed=false}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null?void 0:t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=true,(e=this._value)==null?void 0:e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}};var fr=typeof window=="object"?window:globalThis;var Qg=class Rg{constructor(e){
Line truncated
|
|
|
|
|
\`+i.stack):i},0)}}addListener(i){return this.listeners.push(i),()=>{this._removeListener(i)}}emit(i){this.listeners.forEach(e=>{e(i)})}_removeListener(i){this.listeners.splice(this.listeners.indexOf(i),1)}setUnexpectedErrorHandler(i){this.unexpectedErrorHandler=i}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(i){this.unexpectedErrorHandler(i),this.emit(i)}onUnexpectedExternalError(i){this.unexpectedErrorHandler(i)}};var xq=new wq;function jc(i){kq(i)||xq.onUnexpectedError(i)}var Pg="Canceled";function kq(i){return i instanceof Cq?true:i instanceof Error&&i.name===Pg&&i.message===Pg}var Cq=class qj extends Error{constructor(){super(Pg),this.name=this.message}};function Tq(i){return new Error(\`Illegal argument: \${i}\`)}var pb=class $g extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof $g)return e;let t=new $g;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}};var Eg=class S3 extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,S3.prototype)}};function wi(i,e=0){return i[i.length-(1+e)]}var Pq;(i=>{function e(n){return n<0}i.isLessThan=e;function t(n){return n<=0}i.isLessThanOrEqual=t;function s(n){return n>0}i.isGreaterThan=s;function r(n){return n===0}i.isNeitherLessOrGreaterThan=r,i.greaterThan=1,i.lessThan=-1,i.neitherLessOrGreaterThan=0})(Pq||(Pq={}));function $q(i,e){let t=this,s=false,r;return function(){if(s)return r;if(s=true,e);else r=i.apply(t,arguments);return r}}var w3;(i=>{function e(_){return _&&typeof _=="object"&&typeof _[Symbol.iterator]=="function"}i.is=e;let t=Object.freeze([]);function s(){return t}i.empty=s;function*r(_){yield _}i.single=r;function n(_){return e(_)?_:r(_)}i.wrap=n;function o(_){return _||t}i.from=o;function*a(_){for(let C=_.length-1;C>=0;C--)yield _[C]}i.reverse=a;function l(_){return!_||_[Symbol.iterator]().next().done===true}i.isEmpty=l;function h(_){return _[Symbol.iterator]().next().value}i.first=h;function c(_,C){let w=0;for(let Q of _)if(C(Q,w++))return true;return false}i.some=c;function d(_,C){for(let w of _)if(C(w))return w}i.find=d;function*u(_,C){for(let w of _)C(w)&&(yield w)}i.filter=u;function*f(_,C){let w=0;for(let Q of _)yield C(Q,w++)}i.map=f;function*p(_,C){let w=0;for(let Q of _)yield*C(Q,w++)}i.flatMap=p;function*m(..._){for(let C of _)yield*C}i.concat=m;function O(_,C,w){let Q=w;for(let D of _)Q=C(Q,D);return Q}i.reduce=O;function*v(_,C,w=_.length){for(C<0&&(C+=_.length),w<0?w+=_.length:w>_.length&&(w=_.length);C<w;C++)yield _[C]}i.slice=v;function T(_,C=Number.POSITIVE_INFINITY){let w=[];if(C===0)return[w,_];let Q=_[Symbol.iterator]();for(let D=0;D<C;D++){let I=Q.next();if(I.done)return[w,i.empty()];w.push(I.value)}return[w,{[Symbol.iterator](){return Q}}]}i.consume=T;async function k(_){let C=[];for await(let w of _)C.push(w);return Promise.resolve(C)}i.asyncToArray=k})(w3||(w3={}));function Eq(i){return i}function x3(i,e){}function mb(i){return i}function no(i){if(w3.is(i)){let e=[];for(let t of i)if(t)try{t.dispose()}catch(s){e.push(s)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(i)?[]:i}else if(i)return i.dispose(),i}function Qq(...i){let e=je(()=>no(i));return e}function je(i){let e=Eq({dispose:$q(()=>{i()})});return e}var k3=class C3{constructor(){this._toDispose=new Set;this._isDisposed=false}dispose(){this._isDisposed||(this._isDisposed=true,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{no(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?C3.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),x3())}};k3.DISABLE_DISPOSED_WARNING=false;var tn=k3;var Oe=class Xj{constructor(){this._store=new tn;x3(this._store)}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Oe.None=Object.freeze({dispose(){}});var fa=class Nj{constructor(){this._isDisposed=false}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null?void 0:t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=true,(e=this._value)==null?void 0:e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}};var fr=typeof window=="object"?window:globalThis;var Qg=class Rg{constructor(e){
Line truncated
|
|
|
|
|
\`).slice(2).join(\`
|
|
|
|
|
\`))}};var Dq=class extends Error{constructor(i,e){super(i),this.name="ListenerLeakError",this.stack=e}};var zq=class extends Error{constructor(i,e){super(i),this.name="ListenerRefusalError",this.stack=e}};var Wq=0;var fp=class Zj{constructor(e){this.value=e;this.id=Wq++}};var qq=2;var Xq;var j=class Uj{constructor(e){var t,s,r,n;this._size=0;this._options=e,this._leakageMon=((t=this._options)==null?void 0:t.leakWarningThreshold)?new Bq((e==null?void 0:e.onListenerError)??jc,((s=this._options)==null?void 0:s.leakWarningThreshold)??Mq):void 0,this._perfMon=((r=this._options)==null?void 0:r._profName)?new Lq(this._options._profName):void 0,this._deliveryQueue=(n=this._options)==null?void 0:n.deliveryQueue}dispose(){var e,t,s,r;if(!this._disposed){if(this._disposed=true,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners){this._listeners=void 0,this._size=0}(s=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null?void 0:s.call(t),(r=this._leakageMon)==null?void 0:r.dispose()}}get event(){return this._event??(this._event=(e,t,s)=>{var a,l,h,c,d;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let u=\`[\${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (\${this._size} vs \${this._leakageMon.threshold})\`;console.warn(u);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new zq(\`\${u}. HINT: Stack shows most frequent listener (\${f[1]}-times)\`,f[0]);return(((a=this._options)==null?void 0:a.onListenerError)||jc)(p),Oe.None}if(this._disposed)return Oe.None;t&&(e=e.bind(t));let r=new fp(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Iq.create(),n=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof fp?(this._deliveryQueue??(this._deliveryQueue=new Nq),this._listeners=[this._listeners,r]):this._listeners.push(r):((h=(l=this._options)==null?void 0:l.onWillAddFirstListener)==null?void 0:h.call(l,this),this._listeners=r,(d=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null?void 0:d.call(c,this)),this._size++;let o=je(()=>{n==null?void 0:n(),this._removeListener(r)});if(s instanceof tn?s.add(o):Array.isArray(s)&&s.push(o),Xq);return o}),this._event}_removeListener(e){var n,o,a,l;if((o=(n=this._options)==null?void 0:n.onWillRemoveListener)==null?void 0:o.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(l=(a=this._options)==null?void 0:a.onDidRemoveLastListener)==null?void 0:l.call(a,this),this._size=0;return}let t=this._listeners,s=t.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[s]=void 0;let r=this._deliveryQueue.current===this;if(this._size*qq<=t.length){let h=0;for(let c=0;c<t.length;c++)t[c]?t[h++]=t[c]:r&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){var r;if(!e)return;let s=((r=this._options)==null?void 0:r.onListenerError)||jc;if(!s){e.value(t);return}try{e.value(t)}catch(n){s(n)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,s,r,n;if(((t=this._deliveryQueue)==null?void 0:t.current)&&(this._deliverQueue(this._deliveryQueue),(s=this._perfMon)==null?void 0:s.stop()),(r=this._perfMon)==null?void 0:r.start(this._size),this._listeners)if(this._listeners instanceof fp)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(n=this._perfMon)==null?void 0:n.stop()}hasListeners(){return this._size>0}};var Nq=class{constructor(){this.i=-1;this.end=0}enqueue(i,e,t){this.i=0,this.end=t,this.current=i,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}};var Mg=class jj{constructor(){this.mapWindowIdToZoomLevel=new Map;this._onDidChangeZoomLevel=new j;this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event;this.mapWindowIdToZoomFactor=new Map;this._onDidChangeFullscreen=new j;this.onDidChangeFullscreen=this._onDidChangeFullscreen.event;this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let s=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(s,e),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let s=this.getWindowId(t);this.mapWindowIdToFullScreen.set(s,e),this._onDidChangeFullscreen.fire(s)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Mg.INSTANCE=new Mg;var B0=Mg;function Fq(i,e,t){typeof e=="string"&
Line truncated
|
|
|
|
|
\`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(c=>this._handleScroll(c)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:true,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=true,this._suppressOnScrollHandler=true,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=false,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=false)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=true;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),s=t-this._bufferService.buffer.ydisp;s!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(s)),this._isHandlingScroll=false}};Ng=st([K(2,hi),K(3,kr),K(4,O3),K(5,ba),K(6,ci),K(7,Cr)],Ng);var Fg=class oH extends Oe{constructor(e,t,s,r,n){super();this._screenElement=e;this._bufferService=t;this._coreBrowserService=s;this._decorationService=r;this._renderService=n;this._decorationElements=new Map;this._altBufferIsActive=false;this._dimensionsChanged=false;this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=true,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(o=>this._removeDecoration(o))),this._register(je(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=false}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.layer)==="top"),t.style.width=\`\${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px\`,t.style.height=\`\${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px\`,t.style.top=\`\${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px\`,t.style.lineHeight=\`\${this._renderService.dimensions.css.cell.height}px\`;let s=e.options.x??0;return s&&s>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let s=this._decorationElements.get(e);s||(s=this._createElement(e),e.element=s,this._decorationElements.set(e,s),this._container.appendChild(s),e.onDispose(()=>{this._decorationElements.delete(e),s.remove()})),s.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(s.style.width=\`\${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px\`,s.style.heigh
Line truncated
|
|
|
|
|
\`,i.VT="\\v",i.FF="\\f",i.CR="\\r",i.SO="",i.SI="",i.DLE="",i.DC1="",i.DC2="",i.DC3="",i.DC4="",i.NAK="",i.SYN="",i.ETB="",i.CAN="",i.EM="",i.SUB="",i.ESC="\\x1B",i.FS="",i.GS="",i.RS="",i.US="",i.SP=" ",i.DEL=""))(W||(W={}));var Yc;(i=>(i.PAD="",i.HOP="",i.BPH="",i.NBH="",i.IND="",i.NEL="
",i.SSA="",i.ESA="",i.HTS="",i.HTJ="",i.VTS="",i.PLD="",i.PLU="",i.RI="",i.SS2="",i.SS3="",i.DCS="",i.PU1="",i.PU2="",i.STS="",i.CCH="",i.MW="",i.SPA="",i.EPA="",i.SOS="",i.SGCI="",i.SCI="",i.CSI="",i.ST="",i.OSC="",i.PM="",i.APC=""))(Yc||(Yc={}));var z3;(i=>i.ST=\`\${W.ESC}\\\\\`)(z3||(z3={}));var Zg=class lH{constructor(e,t,s,r,n,o){this._textarea=e;this._compositionView=t;this._bufferService=s;this._optionsService=r;this._coreService=n;this._renderService=o;this._isComposing=false,this._isSendingComposition=false,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=true,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(true)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return false;this._finalizeComposition(false)}return e.keyCode===229?(this._handleAnyTextareaChanges(),false):true}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=false,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=true,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=false;let s;t.start+=this._dataAlreadySent.length,this._isComposing?s=this._textarea.value.substring(t.start,this._compositionPosition.start):s=this._textarea.value.substring(t.start),s.length>0&&this._coreService.triggerDataEvent(s,true)}},0)}else{this._isSendingComposition=false;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,true)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,s=t.replace(e,"");this._dataAlreadySent=s,t.length>e.length?this._coreService.triggerDataEvent(s,true):t.length<e.length?this._coreService.triggerDataEvent(\`\${W.DEL}\`,true):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,true)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),s=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(true),0)}}};Zg=st([K(2,hi),K(3,ci),K(4,po),K(5,Cr)],Zg);var $t=0;var Et=0;var Qt=0;var tt=0;var Qb={css:"#00000000",rgba:0};var dt;(i=>{function e(r,n,o,a){return a!==void 0?\`#\${xn(r)}\${xn(n)}\${xn(o)}\${xn(a)}\`:\`#\${xn(r)}\${xn(n)}\${xn(o)}\`}i.toCss=e;function t(r,n,o,a=255){return(r<<24|n<<16|o<<8|a)>>>0}i.toRgba=t;function s(r,n,o,a){return{css:i.toCss(r,n,o,a),rgba:i.toRgba(r,n,o,a)}}i.toColor=s})(dt||(dt={}));var Xe;(i=>{function e(l,h){if(tt=(h.rgba&255)/255,tt===1)return{css:h.css,rgba:h.rgba};let c=h.rgba>>24&255,d=h.rgba>>16&255,u=h.rgba>>8&255,f=l.rgba>>24&255,p=l.rgba>>16&255,m=l.rgba>>8&255;$t=f+Math.round((c-f)*tt),Et=p+Math.round((d-p)*tt),Qt=m+Math.round((u-m)*tt);let O=dt.toCss($t,Et,Qt),v=dt.toRgba($t,Et,Qt);return{css:O,rgba:v}}i.blend=e;function t(l){return(l.rgba&255)===255}i.isOpaque=t;function s(l,h,c){let d=Gc.ensureContrastRatio(l.rgba,h.rgba,c);if(d)return dt.toColor(d>>24&255,d>>16&255,d>>8&255)}i.ensureContrastRatio=s;function r(l){let h=(l.rgba|255)>>>0;return[$t,Et,Qt]=Gc.toChannels(h),{css:dt.toCss($t,Et,Qt),rgba:h}}i.opaque=r;function n(l,h){return tt=Math.round(h*255),[$t,Et,Qt]=Gc.toChannels(l.rgba),{css:dt.toCss($t,Et,Qt,tt),rgba:dt.toRgba($t,Et,Qt,tt)}}i.o
Line truncated
|
|
|
|
|
\`,i.VT="\\v",i.FF="\\f",i.CR="\\r",i.SO="",i.SI="",i.DLE="",i.DC1="",i.DC2="",i.DC3="",i.DC4="",i.NAK="",i.SYN="",i.ETB="",i.CAN="",i.EM="",i.SUB="",i.ESC="\\x1B",i.FS="",i.GS="",i.RS="",i.US="",i.SP=" ",i.DEL=""))(W||(W={}));var Yc;(i=>(i.PAD="",i.HOP="",i.BPH="",i.NBH="",i.IND="",i.NEL="
",i.SSA="",i.ESA="",i.HTS="",i.HTJ="",i.VTS="",i.PLD="",i.PLU="",i.RI="",i.SS2="",i.SS3="",i.DCS="",i.PU1="",i.PU2="",i.STS="",i.CCH="",i.MW="",i.SPA="",i.EPA="",i.SOS="",i.SGCI="",i.SCI="",i.CSI="",i.ST="",i.OSC="",i.PM="",i.APC=""))(Yc||(Yc={}));var z3;(i=>i.ST=\`\${W.ESC}\\\\\`)(z3||(z3={}));var Zg=class lH{constructor(e,t,s,r,n,o){this._textarea=e;this._compositionView=t;this._bufferService=s;this._optionsService=r;this._coreService=n;this._renderService=o;this._isComposing=false,this._isSendingComposition=false,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=true,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(true)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return false;this._finalizeComposition(false)}return e.keyCode===229?(this._handleAnyTextareaChanges(),false):true}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=false,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=true,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=false;let s;t.start+=this._dataAlreadySent.length,this._isComposing?s=this._textarea.value.substring(t.start,this._compositionPosition.start):s=this._textarea.value.substring(t.start),s.length>0&&this._coreService.triggerDataEvent(s,true)}},0)}else{this._isSendingComposition=false;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,true)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,s=t.replace(e,"");this._dataAlreadySent=s,t.length>e.length?this._coreService.triggerDataEvent(s,true):t.length<e.length?this._coreService.triggerDataEvent(\`\${W.DEL}\`,true):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,true)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),s=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(true),0)}}};Zg=st([K(2,hi),K(3,ci),K(4,po),K(5,Cr)],Zg);var $t=0;var Et=0;var Qt=0;var tt=0;var Qb={css:"#00000000",rgba:0};var dt;(i=>{function e(r,n,o,a){return a!==void 0?\`#\${xn(r)}\${xn(n)}\${xn(o)}\${xn(a)}\`:\`#\${xn(r)}\${xn(n)}\${xn(o)}\`}i.toCss=e;function t(r,n,o,a=255){return(r<<24|n<<16|o<<8|a)>>>0}i.toRgba=t;function s(r,n,o,a){return{css:i.toCss(r,n,o,a),rgba:i.toRgba(r,n,o,a)}}i.toColor=s})(dt||(dt={}));var Xe;(i=>{function e(l,h){if(tt=(h.rgba&255)/255,tt===1)return{css:h.css,rgba:h.rgba};let c=h.rgba>>24&255,d=h.rgba>>16&255,u=h.rgba>>8&255,f=l.rgba>>24&255,p=l.rgba>>16&255,m=l.rgba>>8&255;$t=f+Math.round((c-f)*tt),Et=p+Math.round((d-p)*tt),Qt=m+Math.round((u-m)*tt);let O=dt.toCss($t,Et,Qt),v=dt.toRgba($t,Et,Qt);return{css:O,rgba:v}}i.blend=e;function t(l){return(l.rgba&255)===255}i.isOpaque=t;function s(l,h,c){let d=Gc.ensureContrastRatio(l.rgba,h.rgba,c);if(d)return dt.toColor(d>>24&255,d>>16&255,d>>8&255)}i.ensureContrastRatio=s;function r(l){let h=(l.rgba|255)>>>0;return[$t,Et,Qt]=Gc.toChannels(h),{css:dt.toCss($t,Et,Qt),rgba:h}}i.opaque=r;function n(l,h){return tt=Math.round(h*255),[$t,Et,Qt]=Gc.toChannels(l.rgba),{css:dt.toCss($t,Et,Qt,tt),rgba:dt.toRgba($t,Et,Qt,tt)}}i.o
Line truncated
|
|
|
|
|
\`:\`
|
|
|
|
|
\`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),N0&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!s||!r||!t?false:this._areCoordsInSelection(t,s,r)}isCellInSelection(e,t){let s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!s||!r?false:this._areCoordsInSelection([e,t],s,r)}_areCoordsInSelection(e,t,s){return e[1]>t[1]&&e[1]<s[1]||t[1]===s[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<s[0]||t[1]<s[1]&&e[1]===s[1]&&e[0]<s[0]||t[1]<s[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var n,o;let s=(o=(n=this._linkifier.currentLink)==null?void 0:n.link)==null?void 0:o.range;if(s)return this._model.selectionStart=[s.start.x-1,s.start.y-1],this._model.selectionStartLength=Lb(s,this._bufferService.cols),this._model.selectionEnd=void 0,true;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,true):false}selectAll(){this._model.isSelectAllActive=true,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,true);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=X0(this._coreBrowserService.window,e,this._screenElement)[1],s=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=s?0:(t>s&&(t-=s),t=Math.min(Math.max(t,-_p),_p),t/=_p,t/Math.abs(t)+Math.round(t*(_N-1)))}shouldForceSelection(e){return jd?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(true)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),vN)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=false,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,true)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(jd&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(true);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWor
Line truncated
|
|
|
|
|
\`))),this._register(this._terminal.onA11yTab(o=>this._handleTab(o))),this._register(this._terminal.onKey(o=>this._handleKey(o.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(de(n,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(je(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<sS+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===\`
|
|
|
|
@@ -970,7 +970,7 @@ WARNING: This link could potentially be dangerous\`)){let t=window.open();if(t){
|
|
|
|
|
\\r
|
|
|
|
|
\`)}stopHeartbeat(){if(this.heartbeatInterval){clearInterval(this.heartbeatInterval);this.heartbeatInterval=null}if(this.heartbeatResponseTimeout){clearTimeout(this.heartbeatResponseTimeout);this.heartbeatResponseTimeout=null}this.pendingHeartbeatId=null;this.lastPingTime=null}disposeConnectionDisposables(){for(const e of this.disposables)e.dispose();this.disposables=[]}clearReconnectTimeout(){if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);this.reconnectTimeout=null}}resetActiveConnection(){var t;(t=this.authChallengeDialog)==null?void 0:t.dismiss();this.stopHeartbeat();this.clearReconnectTimeout();this.disposeConnectionDisposables();const e=this.ws;this.ws=null;this.sftpAttachUrl=null;this.trzszFilter=null;this.sessionReady=false;this.cfLatency=null;this.cfColo=null;this.wsLatency=null;if(e&&e.readyState!==WebSocket.CLOSED&&e.readyState!==WebSocket.CLOSING){e.close(1e3)}}hasReconnectStrategy(){if(this.resumeOnlyMode){return this.shareResumeSupported&&Boolean(this.activeSessionId&&this.activeResumeToken)&&(this.shareResumeDeadline===null||Date.now()<this.shareResumeDeadline)}return this.canReconnect&&this.reconnectAttempts<this.maxReconnectAttempts&&Boolean(this.lastConfig||this.reconnectWebSocketFactory||this.activeSessionId&&this.activeResumeToken)}async tryResumeSession(){if(!this.activeSessionId||!this.activeResumeToken)return false;try{const e=new URLSearchParams({session:this.activeSessionId,resume_token:this.activeResumeToken,cols:String(this.terminal.cols),rows:String(this.terminal.rows)});const t=await R4(this.activeSessionId);this.shareResumeChallengeMissing=!t&&OO();if(t){e.set("did_nonce",t.nonce);e.set("did_ts",String(t.timestamp));e.set("did_sig",t.signature)}const s=window.location.protocol==="https:"?"wss:":"ws:";const r=new WebSocket(\`\${s}//\${window.location.host}/api/ssh?\${e.toString()}\`);r.binaryType="arraybuffer";this.resetActiveConnection();this.ws=r;this.setupWebSocketHandlers();return true}catch{this.activeSessionId=null;this.activeResumeToken=null;return false}}scheduleReconnect(){this.clearReconnectTimeout();this.reconnectAttempts++;if(this.resumeOnlyMode){this.scheduleShareResume();return}if(this.reconnectAttempts===1&&this.activeSessionId&&this.activeResumeToken){this.terminal.writeln(\`\\x1B[32m[+] \${g("terminal.reconnecting")}\\x1B[0m\`);void this.tryResumeSession().then(e=>{if(!e)this.scheduleFallbackReconnect()});return}this.scheduleFallbackReconnect()}scheduleShareResume(){if(this.shareSessionEndedByServer){this.finishShareResume();return}if(!this.hasReconnectStrategy()){this.finishShareResume();return}if(this.shareResumeDeadline===null){this.shareResumeDeadline=Date.now()+k4}const e=this.shareResumeDeadline-Date.now();if(e<=sU){this.finishShareResume();return}if(this.reconnectAttempts===1&&this.sessionRequiresDeviceSig&&this.shareResumeChallengeMissing){this.terminal.writeln(\`\\x1B[33m[!] \${g("terminal.shareResumeNoDeviceIdentity")}\\x1B[0m\`)}if(this.reconnectAttempts===2&&this.sessionRequiresDeviceSig&&!this.shareResumeChallengeMissing){this.terminal.writeln(\`\\x1B[33m[!] \${g("terminal.shareResumeEnvironmentHint")}\\x1B[0m\`)}const t=Math.min(1e3*2**Math.max(0,this.reconnectAttempts-1),3e4);const s=t>e;const r=Math.min(t,e);const n=Math.max(1,Math.round(r/1e3));if(s){this.terminal.writeln(\`\\x1B[33m[*] \${g("terminal.shareResumeFinalAttempt")}\\x1B[0m\`)}this.terminal.writeln(\`\\x1B[33m[*] \${g("terminal.resumingSession",{seconds:n,attempt:this.reconnectAttempts})}\\x1B[0m\`);this.reconnectTimeout=setTimeout(()=>{this.reconnectTimeout=null;void this.tryResumeSession().then(o=>{if(!o)this.finishShareResume()})},r)}finishShareResume(){this.resumeOnlyMode=false;this.shareResumeDeadline=null;this.shareResumeChallengeMissing=false;this.sessionRequiresDeviceSig=false;this.activeSessionId=null;this.activeResumeToken=null;this.terminal.writeln(\`\\x1B[31m[!] \${g("terminal.shareResumeEnded")}\\x1B[0m\`)}scheduleFallbackReconnect(){this.clearReconnectTimeout();const e=Math.min(1e3*2**this.reconnectAttempts,3e4);this.terminal.writeln(\`\\x1B[33m[*] \${g("terminal.reconnectWait",{seconds:e/1e3,attempt:this.reconnectAttempts,max:this.maxReconnectAttempts})}\\x1B[0m\`);this.reconnectTimeout=setTimeout(async()=>{this.reconnectTimeout=null;if(this.lastConfig){this.terminal.writeln(\`\\x1B[32m[+] \${g("terminal.reconnecting")}\\x1B[0m\`);try{await this.connect(this.lastConfig,{resetDisplay:false})}catch{this.terminal.writeln(\`\\x1B[31m[!] \${g("terminal.reconnectFailed")}\\x1B[0m\`)}}else if(this.reconnectWebSocketFactory){this.terminal.writeln(\`\\x1B[32m[+] \${g("terminal.reconnecting")}\\x1B[0m\`);const t=this.reconnectWebSocketFactory;try{const s=await t();if(this.reconnectWebSocketFactory!==t||!this.canReconnect||this.reconnectAttempts>=this.maxReconnectAttempts){s.close(1e3);return}this.connectWithWebSocket(s,this.lastHostInfo??void 0,{resetDisplay:false,reconnectFactory:t})}catch{this.terminal.writeln(\`\\x1B[31m[!] \${g("terminal.reconnectFailed")}\\x1
Line truncated
|
|
|
|
|
</script>
|
|
|
|
|
<style>*,::before,::after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / 0.5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / 0.5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,::before,::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}::before,::after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}input:where([type=text]),input:where(:not([type])),input:where([type=email]),input:where([type=url]),input:where([type=password]),input:where([type=number]),input:where([type=date]),input:where([type=datetimLine truncated
|
|
|
|
|
<style>*,::before,::after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / 0.5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / 0.5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,::before,::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}::before,::after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}input:where([type=text]),input:where(:not([type])),input:where([type=email]),input:where([type=url]),input:where([type=password]),input:where([type=number]),input:where([type=date]),input:where([type=datetimLine truncated
|
|
|
|
|
* Copyright (c) 2014 The xterm.js authors. All rights reserved.
|
|
|
|
|
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
|
|
|
* https://github.com/chjj/term.js
|
|
|
|
|