eminiar 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +2 -2
- package/dist/cli.js +1355 -206
- package/dist/hook.js +23 -6
- package/dist/server.js +1415 -266
- package/dist/ui/app.global.js +30 -30
- package/eminiar.config.schema.json +4 -2
- package/package.json +2 -1
- package/vendor/grammars/php.wasm +0 -0
package/dist/ui/app.global.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
"use strict";(()=>{var wi=Object.create;var nn=Object.defineProperty;var Si=Object.getOwnPropertyDescriptor;var Ti=Object.getOwnPropertyNames;var Ei=Object.getPrototypeOf,Ai=Object.prototype.hasOwnProperty;var Kn=t=>{throw TypeError(t)};var Ci=(t,n,s)=>n in t?nn(t,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[n]=s;var $i=(t,n)=>()=>(n||t((n={exports:{}}).exports,n),n.exports);var Ri=(t,n,s,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of Ti(n))!Ai.call(t,r)&&r!==s&&nn(t,r,{get:()=>n[r],enumerable:!(i=Si(n,r))||i.enumerable});return t};var Fi=(t,n,s)=>(s=t!=null?wi(Ei(t)):{},Ri(n||!t||!t.__esModule?nn(s,"default",{value:t,enumerable:!0}):s,t));var V=(t,n,s)=>Ci(t,typeof n!="symbol"?n+"":n,s),Mi=(t,n,s)=>n.has(t)||Kn("Cannot "+s);var Yn=(t,n,s)=>n.has(t)?Kn("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(t):n.set(t,s);var Qn=(t,n,s)=>(Mi(t,n,"access private method"),s);var Ar=$i((gd,Ht)=>{"use strict";var _a=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var N=(function(t){var n=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,s=0,i={},r={manual:t.Prism&&t.Prism.manual,disableWorkerMessageHandler:t.Prism&&t.Prism.disableWorkerMessageHandler,util:{encode:function m(p){return p instanceof a?new a(p.type,m(p.content),p.alias):Array.isArray(p)?p.map(m):p.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(m){return Object.prototype.toString.call(m).slice(8,-1)},objId:function(m){return m.__id||Object.defineProperty(m,"__id",{value:++s}),m.__id},clone:function m(p,y){y=y||{};var v,b;switch(r.util.type(p)){case"Object":if(b=r.util.objId(p),y[b])return y[b];v={},y[b]=v;for(var k in p)p.hasOwnProperty(k)&&(v[k]=m(p[k],y));return v;case"Array":return b=r.util.objId(p),y[b]?y[b]:(v=[],y[b]=v,p.forEach(function(S,A){v[A]=m(S,y)}),v);default:return p}},getLanguage:function(m){for(;m;){var p=n.exec(m.className);if(p)return p[1].toLowerCase();m=m.parentElement}return"none"},setLanguage:function(m,p){m.className=m.className.replace(RegExp(n,"gi"),""),m.classList.add("language-"+p)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(v){var m=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(v.stack)||[])[1];if(m){var p=document.getElementsByTagName("script");for(var y in p)if(p[y].src==m)return p[y]}return null}},isActive:function(m,p,y){for(var v="no-"+p;m;){var b=m.classList;if(b.contains(p))return!0;if(b.contains(v))return!1;m=m.parentElement}return!!y}},languages:{plain:i,plaintext:i,text:i,txt:i,extend:function(m,p){var y=r.util.clone(r.languages[m]);for(var v in p)y[v]=p[v];return y},insertBefore:function(m,p,y,v){v=v||r.languages;var b=v[m],k={};for(var S in b)if(b.hasOwnProperty(S)){if(S==p)for(var A in y)y.hasOwnProperty(A)&&(k[A]=y[A]);y.hasOwnProperty(S)||(k[S]=b[S])}var _=v[m];return v[m]=k,r.languages.DFS(r.languages,function(E,R){R===_&&E!=m&&(this[E]=k)}),k},DFS:function m(p,y,v,b){b=b||{};var k=r.util.objId;for(var S in p)if(p.hasOwnProperty(S)){y.call(p,S,p[S],v||S);var A=p[S],_=r.util.type(A);_==="Object"&&!b[k(A)]?(b[k(A)]=!0,m(A,y,null,b)):_==="Array"&&!b[k(A)]&&(b[k(A)]=!0,m(A,y,S,b))}}},plugins:{},highlightAll:function(m,p){r.highlightAllUnder(document,m,p)},highlightAllUnder:function(m,p,y){var v={callback:y,container:m,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",v),v.elements=Array.prototype.slice.apply(v.container.querySelectorAll(v.selector)),r.hooks.run("before-all-elements-highlight",v);for(var b=0,k;k=v.elements[b++];)r.highlightElement(k,p===!0,v.callback)},highlightElement:function(m,p,y){var v=r.util.getLanguage(m),b=r.languages[v];r.util.setLanguage(m,v);var k=m.parentElement;k&&k.nodeName.toLowerCase()==="pre"&&r.util.setLanguage(k,v);var S=m.textContent,A={element:m,language:v,grammar:b,code:S};function _(R){A.highlightedCode=R,r.hooks.run("before-insert",A),A.element.innerHTML=A.highlightedCode,r.hooks.run("after-highlight",A),r.hooks.run("complete",A),y&&y.call(A.element)}if(r.hooks.run("before-sanity-check",A),k=A.element.parentElement,k&&k.nodeName.toLowerCase()==="pre"&&!k.hasAttribute("tabindex")&&k.setAttribute("tabindex","0"),!A.code){r.hooks.run("complete",A),y&&y.call(A.element);return}if(r.hooks.run("before-highlight",A),!A.grammar){_(r.util.encode(A.code));return}if(p&&t.Worker){var E=new Worker(r.filename);E.onmessage=function(R){_(R.data)},E.postMessage(JSON.stringify({language:A.language,code:A.code,immediateClose:!0}))}else _(r.highlight(A.code,A.grammar,A.language))},highlight:function(m,p,y){var v={code:m,grammar:p,language:y};if(r.hooks.run("before-tokenize",v),!v.grammar)throw new Error('The language "'+v.language+'" has no grammar.');return v.tokens=r.tokenize(v.code,v.grammar),r.hooks.run("after-tokenize",v),a.stringify(r.util.encode(v.tokens),v.language)},tokenize:function(m,p){var y=p.rest;if(y){for(var v in y)p[v]=y[v];delete p.rest}var b=new d;return c(b,b.head,m),l(m,b,p,b.head,0),h(b)},hooks:{all:{},add:function(m,p){var y=r.hooks.all;y[m]=y[m]||[],y[m].push(p)},run:function(m,p){var y=r.hooks.all[m];if(!(!y||!y.length))for(var v=0,b;b=y[v++];)b(p)}},Token:a};t.Prism=r;function a(m,p,y,v){this.type=m,this.content=p,this.alias=y,this.length=(v||"").length|0}a.stringify=function m(p,y){if(typeof p=="string")return p;if(Array.isArray(p)){var v="";return p.forEach(function(_){v+=m(_,y)}),v}var b={type:p.type,content:m(p.content,y),tag:"span",classes:["token",p.type],attributes:{},language:y},k=p.alias;k&&(Array.isArray(k)?Array.prototype.push.apply(b.classes,k):b.classes.push(k)),r.hooks.run("wrap",b);var S="";for(var A in b.attributes)S+=" "+A+'="'+(b.attributes[A]||"").replace(/"/g,""")+'"';return"<"+b.tag+' class="'+b.classes.join(" ")+'"'+S+">"+b.content+"</"+b.tag+">"};function o(m,p,y,v){m.lastIndex=p;var b=m.exec(y);if(b&&v&&b[1]){var k=b[1].length;b.index+=k,b[0]=b[0].slice(k)}return b}function l(m,p,y,v,b,k){for(var S in y)if(!(!y.hasOwnProperty(S)||!y[S])){var A=y[S];A=Array.isArray(A)?A:[A];for(var _=0;_<A.length;++_){if(k&&k.cause==S+","+_)return;var E=A[_],R=E.inside,T=!!E.lookbehind,$=!!E.greedy,w=E.alias;if($&&!E.pattern.global){var F=E.pattern.toString().match(/[imsuy]*$/)[0];E.pattern=RegExp(E.pattern.source,F+"g")}for(var W=E.pattern||E,X=v.next,D=b;X!==p.tail&&!(k&&D>=k.reach);D+=X.value.length,X=X.next){var ee=X.value;if(p.length>m.length)return;if(!(ee instanceof a)){var ue=1,pe;if($){if(pe=o(W,D,m,T),!pe||pe.index>=m.length)break;var Ue=pe.index,ye=pe.index+pe[0].length,ie=D;for(ie+=X.value.length;Ue>=ie;)X=X.next,ie+=X.value.length;if(ie-=X.value.length,D=ie,X.value instanceof a)continue;for(var fe=X;fe!==p.tail&&(ie<ye||typeof fe.value=="string");fe=fe.next)ue++,ie+=fe.value.length;ue--,ee=m.slice(D,ie),pe.index-=D}else if(pe=o(W,0,ee,T),!pe)continue;var Ue=pe.index,j=pe[0],de=ee.slice(0,Ue),oe=ee.slice(Ue+j.length),$e=D+ee.length;k&&$e>k.reach&&(k.reach=$e);var Se=X.prev;de&&(Se=c(p,Se,de),D+=de.length),u(p,Se,ue);var Qt=new a(S,R?r.tokenize(j,R):j,w,j);if(X=c(p,Se,Qt),oe&&c(p,X,oe),ue>1){var Xe={cause:S+","+_,reach:$e};l(m,p,y,X.prev,D,Xe),k&&Xe.reach>k.reach&&(k.reach=Xe.reach)}}}}}}function d(){var m={value:null,prev:null,next:null},p={value:null,prev:m,next:null};m.next=p,this.head=m,this.tail=p,this.length=0}function c(m,p,y){var v=p.next,b={value:y,prev:p,next:v};return p.next=b,v.prev=b,m.length++,b}function u(m,p,y){for(var v=p.next,b=0;b<y&&v!==m.tail;b++)v=v.next;p.next=v,v.prev=p,m.length-=b}function h(m){for(var p=[],y=m.head.next;y!==m.tail;)p.push(y.value),y=y.next;return p}if(!t.document)return t.addEventListener&&(r.disableWorkerMessageHandler||t.addEventListener("message",function(m){var p=JSON.parse(m.data),y=p.language,v=p.code,b=p.immediateClose;t.postMessage(r.highlight(v,r.languages[y],y)),b&&t.close()},!1)),r;var g=r.util.currentScript();g&&(r.filename=g.src,g.hasAttribute("data-manual")&&(r.manual=!0));function f(){r.manual||r.highlightAll()}if(!r.manual){var x=document.readyState;x==="loading"||x==="interactive"&&g&&g.defer?document.addEventListener("DOMContentLoaded",f):window.requestAnimationFrame?window.requestAnimationFrame(f):window.setTimeout(f,16)}return r})(_a);typeof Ht<"u"&&Ht.exports&&(Ht.exports=N);typeof global<"u"&&(global.Prism=N);N.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]};N.languages.markup.tag.inside["attr-value"].inside.entity=N.languages.markup.entity;N.languages.markup.doctype.inside["internal-subset"].inside=N.languages.markup;N.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.replace(/&/,"&"))});Object.defineProperty(N.languages.markup.tag,"addInlined",{value:function(n,s){var i={};i["language-"+s]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:N.languages[s]},i.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:i}};r["language-"+s]={pattern:/[\s\S]+/,inside:N.languages[s]};var a={};a[n]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return n}),"i"),lookbehind:!0,greedy:!0,inside:r},N.languages.insertBefore("markup","cdata",a)}});Object.defineProperty(N.languages.markup.tag,"addAttribute",{value:function(t,n){N.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,"language-"+n],inside:N.languages[n]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}});N.languages.html=N.languages.markup;N.languages.mathml=N.languages.markup;N.languages.svg=N.languages.markup;N.languages.xml=N.languages.extend("markup",{});N.languages.ssml=N.languages.xml;N.languages.atom=N.languages.xml;N.languages.rss=N.languages.xml;(function(t){var n=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+n.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+n.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+n.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+n.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:n,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var s=t.languages.markup;s&&(s.tag.addInlined("style","css"),s.tag.addAttribute("style","css"))})(N);N.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};N.languages.javascript=N.languages.extend("clike",{"class-name":[N.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});N.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;N.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:N.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:N.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:N.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:N.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:N.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});N.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:N.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});N.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});N.languages.markup&&(N.languages.markup.tag.addInlined("script","javascript"),N.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));N.languages.js=N.languages.javascript;(function(){if(typeof N>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var t="Loading\u2026",n=function(g,f){return"\u2716 Error "+g+" while fetching file: "+f},s="\u2716 Error: File does not exist or is empty",i={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},r="data-src-status",a="loading",o="loaded",l="failed",d="pre[data-src]:not(["+r+'="'+o+'"]):not(['+r+'="'+a+'"])';function c(g,f,x){var m=new XMLHttpRequest;m.open("GET",g,!0),m.onreadystatechange=function(){m.readyState==4&&(m.status<400&&m.responseText?f(m.responseText):m.status>=400?x(n(m.status,m.statusText)):x(s))},m.send(null)}function u(g){var f=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(g||"");if(f){var x=Number(f[1]),m=f[2],p=f[3];return m?p?[x,Number(p)]:[x,void 0]:[x,x]}}N.hooks.add("before-highlightall",function(g){g.selector+=", "+d}),N.hooks.add("before-sanity-check",function(g){var f=g.element;if(f.matches(d)){g.code="",f.setAttribute(r,a);var x=f.appendChild(document.createElement("CODE"));x.textContent=t;var m=f.getAttribute("data-src"),p=g.language;if(p==="none"){var y=(/\.(\w+)$/.exec(m)||[,"none"])[1];p=i[y]||y}N.util.setLanguage(x,p),N.util.setLanguage(f,p);var v=N.plugins.autoloader;v&&v.loadLanguages(p),c(m,function(b){f.setAttribute(r,o);var k=u(f.getAttribute("data-range"));if(k){var S=b.split(/\r\n?|\n/g),A=k[0],_=k[1]==null?S.length:k[1];A<0&&(A+=S.length),A=Math.max(0,Math.min(A-1,S.length)),_<0&&(_+=S.length),_=Math.max(0,Math.min(_,S.length)),b=S.slice(A,_).join(`
|
|
2
|
-
`),f.hasAttribute("data-start")||f.setAttribute("data-start",String(A+1))}x.textContent=b,N.highlightElement(x)},function(b){f.setAttribute(r,l),x.textContent=b})}}),N.plugins.fileHighlight={highlight:function(f){for(var x=(f||document).querySelectorAll(d),m=0,p;p=x[m++];)N.highlightElement(p)}};var h=!1;N.fileHighlight=function(){h||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),h=!0),N.plugins.fileHighlight.highlight.apply(this,arguments)}})()});var Tt,Z,rs,Li,Fe,es,is,as,sn,yt,rt,os,on,rn,an,Ii,_t={},wt=[],Di=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Et=Array.isArray;function Ae(t,n){for(var s in n)t[s]=n[s];return t}function ln(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function At(t,n,s){var i,r,a,o={};for(a in n)a=="key"?i=n[a]:a=="ref"?r=n[a]:o[a]=n[a];if(arguments.length>2&&(o.children=arguments.length>3?Tt.call(arguments,2):s),typeof t=="function"&&t.defaultProps!=null)for(a in t.defaultProps)o[a]===void 0&&(o[a]=t.defaultProps[a]);return kt(t,o,i,r,null)}function kt(t,n,s,i,r){var a={type:t,props:n,key:s,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++rs,__i:-1,__u:0};return r==null&&Z.vnode!=null&&Z.vnode(a),a}function L(t){return t.children}function xt(t,n){this.props=t,this.context=n}function De(t,n){if(n==null)return t.__?De(t.__,t.__i+1):null;for(var s;n<t.__k.length;n++)if((s=t.__k[n])!=null&&s.__e!=null)return s.__e;return typeof t.type=="function"?De(t):null}function Ni(t){if(t.__P&&t.__d){var n=t.__v,s=n.__e,i=[],r=[],a=Ae({},n);a.__v=n.__v+1,Z.vnode&&Z.vnode(a),cn(t.__P,a,n,t.__n,t.__P.namespaceURI,32&n.__u?[s]:null,i,s??De(n),!!(32&n.__u),r),a.__v=n.__v,a.__.__k[a.__i]=a,ps(i,a,r),n.__e=n.__=null,a.__e!=s&&ls(a)}}function ls(t){if((t=t.__)!=null&&t.__c!=null)return t.__e=t.__c.base=null,t.__k.some(function(n){if(n!=null&&n.__e!=null)return t.__e=t.__c.base=n.__e}),ls(t)}function ts(t){(!t.__d&&(t.__d=!0)&&Fe.push(t)&&!St.__r++||es!=Z.debounceRendering)&&((es=Z.debounceRendering)||is)(St)}function St(){try{for(var t,n=1;Fe.length;)Fe.length>n&&Fe.sort(as),t=Fe.shift(),n=Fe.length,Ni(t)}finally{Fe.length=St.__r=0}}function cs(t,n,s,i,r,a,o,l,d,c,u){var h,g,f,x,m,p,y=i&&i.__k||wt,v=n.length;for(d=Pi(s,n,y,d,v),h=0;h<v;h++)(f=s.__k[h])!=null&&(g=f.__i!=-1&&y[f.__i]||_t,f.__i=h,p=cn(t,f,g,r,a,o,l,d,c,u),x=f.__e,f.ref&&g.ref!=f.ref&&(g.ref&&dn(g.ref,null,f),u.push(f.ref,f.__c||x,f)),m==null&&x!=null&&(m=x),4&f.__u?(d=ds(f,d,t),g.__e&&(g.__e=null)):typeof f.type=="function"&&p!==void 0?d=p:x&&(d=x.nextSibling),f.__u&=-7);return s.__e=m,d}function Pi(t,n,s,i,r){var a,o,l,d,c,u=s.length,h=u,g=0;for(t.__k=new Array(r),a=0;a<r;a++)(o=n[a])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=t.__k[a]=kt(null,o,null,null,null):Et(o)?o=t.__k[a]=kt(L,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=t.__k[a]=kt(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):t.__k[a]=o,d=a+g,o.__=t,o.__b=t.__b+1,l=null,(c=o.__i=Bi(o,s,d,h))!=-1&&(h--,(l=s[c])&&(l.__u|=2)),l==null||l.__v==null?(c==-1&&(r>u?g--:r<u&&g++),typeof o.type!="function"&&(o.__u|=4)):c!=d&&(c==d-1?g--:c==d+1?g++:(c>d?g--:g++,o.__u|=4))):t.__k[a]=null;if(h)for(a=0;a<u;a++)(l=s[a])!=null&&(2&l.__u)==0&&(l.__e==i&&(i=De(l)),ms(l,l));return i}function ds(t,n,s){var i,r;if(typeof t.type=="function"){for(i=t.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=t,n=ds(i[r],n,s));return n}t.__e!=n&&(n&&t.type&&!n.parentNode&&(n=De(t)),n=s.insertBefore(t.__e,n||null));do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function Bi(t,n,s,i){var r,a,o,l=t.key,d=t.type,c=n[s],u=c!=null&&(2&c.__u)==0;if(c===null&&l==null||u&&l==c.key&&d==c.type)return s;if(i>(u?1:0)){for(r=s-1,a=s+1;r>=0||a<n.length;)if((c=n[o=r>=0?r--:a++])!=null&&(2&c.__u)==0&&l==c.key&&d==c.type)return o}return-1}function ns(t,n,s){n[0]=="-"?t.setProperty(n,s??""):t[n]=s==null?"":typeof s!="number"||Di.test(n)?s:s+"px"}function vt(t,n,s,i,r){var a,o;e:if(n=="style")if(typeof s=="string")t.style.cssText=s;else{if(typeof i=="string"&&(t.style.cssText=i=""),i)for(n in i)s&&n in s||ns(t.style,n,"");if(s)for(n in s)i&&s[n]==i[n]||ns(t.style,n,s[n])}else if(n[0]=="o"&&n[1]=="n")a=n!=(n=n.replace(os,"$1")),o=n.toLowerCase(),n=o in t||n=="onFocusOut"||n=="onFocusIn"?o.slice(2):n.slice(2),t.l||(t.l={}),t.l[n+a]=s,s?i?s[rt]=i[rt]:(s[rt]=on,t.addEventListener(n,a?an:rn,a)):t.removeEventListener(n,a?an:rn,a);else{if(r=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in t)try{t[n]=s??"";break e}catch{}typeof s=="function"||(s==null||s===!1&&n[4]!="-"?t.removeAttribute(n):t.setAttribute(n,n=="popover"&&s==1?"":s))}}function ss(t){return function(n){if(this.l){var s=this.l[n.type+t];if(n[yt]==null)n[yt]=on++;else if(n[yt]<s[rt])return;return s(Z.event?Z.event(n):n)}}}function cn(t,n,s,i,r,a,o,l,d,c){var u,h,g,f,x,m,p,y,v,b,k,S,A,_,E,R,T=n.type;if(n.constructor!==void 0)return null;128&s.__u&&(d=!!(32&s.__u),a=[l=n.__e=s.__e]),(u=Z.__b)&&u(n);e:if(typeof T=="function"){h=o.length;try{if(v=n.props,b=T.prototype&&T.prototype.render,k=(u=T.contextType)&&i[u.__c],S=u?k?k.props.value:u.__:i,s.__c?y=(g=n.__c=s.__c).__=g.__E:(b?n.__c=g=new T(v,S):(n.__c=g=new xt(v,S),g.constructor=T,g.render=ji),k&&k.sub(g),g.state||(g.state={}),g.__n=i,f=g.__d=!0,g.__h=[],g._sb=[]),b&&g.__s==null&&(g.__s=g.state),b&&T.getDerivedStateFromProps!=null&&(g.__s==g.state&&(g.__s=Ae({},g.__s)),Ae(g.__s,T.getDerivedStateFromProps(v,g.__s))),x=g.props,m=g.state,g.__v=n,f)b&&T.getDerivedStateFromProps==null&&g.componentWillMount!=null&&g.componentWillMount(),b&&g.componentDidMount!=null&&g.__h.push(g.componentDidMount);else{if(b&&T.getDerivedStateFromProps==null&&v!==x&&g.componentWillReceiveProps!=null&&g.componentWillReceiveProps(v,S),n.__v==s.__v||!g.__e&&g.shouldComponentUpdate!=null&&g.shouldComponentUpdate(v,g.__s,S)===!1){n.__v!=s.__v&&(g.props=v,g.state=g.__s,g.__d=!1),n.__e=s.__e,n.__k=s.__k,n.__k.some(function($){$&&($.__=n)}),wt.push.apply(g.__h,g._sb),g._sb=[],g.__h.length&&o.push(g),l=De(s);break e}g.componentWillUpdate!=null&&g.componentWillUpdate(v,g.__s,S),b&&g.componentDidUpdate!=null&&g.__h.push(function(){g.componentDidUpdate(x,m,p)})}if(g.context=S,g.props=v,g.__P=t,g.__e=!1,A=Z.__r,_=0,b)g.state=g.__s,g.__d=!1,A&&A(n),u=g.render(g.props,g.state,g.context),wt.push.apply(g.__h,g._sb),g._sb=[];else do g.__d=!1,A&&A(n),u=g.render(g.props,g.state,g.context),g.state=g.__s;while(g.__d&&++_<25);g.state=g.__s,g.getChildContext!=null&&(i=Ae(Ae({},i),g.getChildContext())),b&&!f&&g.getSnapshotBeforeUpdate!=null&&(p=g.getSnapshotBeforeUpdate(x,m)),E=u!=null&&u.type===L&&u.key==null?hs(u.props.children):u,l=cs(t,Et(E)?E:[E],n,s,i,r,a,o,l,d,c),g.base=n.__e,n.__u&=-161,g.__h.length&&o.push(g),y&&(g.__E=g.__=null)}catch($){if(o.length=h,n.__v=null,d||a!=null){if($.then){for(n.__u|=d?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;a!=null&&(a[a.indexOf(l)]=null),n.__e=l}else if(a!=null)for(R=a.length;R--;)ln(a[R])}else n.__e=s.__e;n.__k==null&&(n.__k=s.__k||[]),$.then||us(n),Z.__e($,n,s)}}else a==null&&n.__v==s.__v?(n.__k=s.__k,n.__e=s.__e):l=n.__e=Hi(s.__e,n,s,i,r,a,o,d,c);return(u=Z.diffed)&&u(n),128&n.__u?void 0:l}function us(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(us))}function ps(t,n,s){for(var i=0;i<s.length;i++)dn(s[i],s[++i],s[++i]);Z.__c&&Z.__c(n,t),t.some(function(r){try{t=r.__h,r.__h=[],t.some(function(a){a.call(r)})}catch(a){Z.__e(a,r.__v)}})}function hs(t){return typeof t!="object"||t==null||t.__b>0?t:Et(t)?t.map(hs):t.constructor!==void 0?null:Ae({},t)}function Hi(t,n,s,i,r,a,o,l,d){var c,u,h,g,f,x,m,p=s.props||_t,y=n.props,v=n.type;if(v=="svg"?r="http://www.w3.org/2000/svg":v=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),a!=null){for(c=0;c<a.length;c++)if((f=a[c])&&"setAttribute"in f==!!v&&(v?f.localName==v:f.nodeType==3)){t=f,a[c]=null;break}}if(t==null){if(v==null)return document.createTextNode(y);t=document.createElementNS(r,v,y.is&&y),l&&(Z.__m&&Z.__m(n,a),l=!1),a=null}if(v==null)p===y||l&&t.data==y||(t.data=y);else{if(a=v=="textarea"&&y.defaultValue!=null?null:a&&Tt.call(t.childNodes),!l&&a!=null)for(p={},c=0;c<t.attributes.length;c++)p[(f=t.attributes[c]).name]=f.value;for(c in p)f=p[c],c=="dangerouslySetInnerHTML"?h=f:c=="children"||c in y||c=="value"&&"defaultValue"in y||c=="checked"&&"defaultChecked"in y||vt(t,c,null,f,r);for(c in y)f=y[c],c=="children"?g=f:c=="dangerouslySetInnerHTML"?u=f:c=="value"?x=f:c=="checked"?m=f:l&&typeof f!="function"||p[c]===f||vt(t,c,f,p[c],r);if(u)l||h&&(u.__html==h.__html||u.__html==t.innerHTML)||(t.innerHTML=u.__html),n.__k=[];else if(h&&(t.innerHTML=""),cs(n.type=="template"?t.content:t,Et(g)?g:[g],n,s,i,v=="foreignObject"?"http://www.w3.org/1999/xhtml":r,a,o,a?a[0]:s.__k&&De(s,0),l,d),a!=null)for(c=a.length;c--;)ln(a[c]);l&&v!="textarea"||(c="value",v=="progress"&&x==null?t.removeAttribute("value"):x!=null&&(x!==t[c]||v=="progress"&&!x||v=="option"&&x!=p[c])&&vt(t,c,x,p[c],r),c="checked",m!=null&&m!=t[c]&&vt(t,c,m,p[c],r))}return t}function dn(t,n,s){try{if(typeof t=="function"){var i=typeof t.__u=="function";i&&t.__u(),i&&n==null||(t.__u=t(n))}else t.current=n}catch(r){Z.__e(r,s)}}function ms(t,n,s){var i,r;if(Z.unmount&&Z.unmount(t),(i=t.ref)&&(i.current&&i.current!=t.__e||dn(i,null,n)),(i=t.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(a){Z.__e(a,n)}i.base=i.__P=i.__n=null}if(i=t.__k)for(r=0;r<i.length;r++)i[r]&&ms(i[r],n,s||typeof t.type!="function");s||ln(t.__e),t.__c=t.__=t.__e=void 0}function ji(t,n,s){return this.constructor(t,s)}function gs(t,n,s){var i,r,a,o;n==document&&(n=document.documentElement),Z.__&&Z.__(t,n),r=(i=typeof s=="function")?null:s&&s.__k||n.__k,a=[],o=[],cn(n,t=(!i&&s||n).__k=At(L,null,[t]),r||_t,_t,n.namespaceURI,!i&&s?[s]:r?null:n.firstChild?Tt.call(n.childNodes):null,a,!i&&s?s:r?r.__e:n.firstChild,i,o),ps(a,t,o),t.props.children=null}Tt=wt.slice,Z={__e:function(t,n,s,i){for(var r,a,o;n=n.__;)if((r=n.__c)&&!r.__)try{if((a=r.constructor)&&a.getDerivedStateFromError!=null&&(r.setState(a.getDerivedStateFromError(t)),o=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(t,i||{}),o=r.__d),o)return r.__E=r}catch(l){t=l}throw t}},rs=0,Li=function(t){return t!=null&&t.constructor===void 0},xt.prototype.setState=function(t,n){var s;s=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ae({},this.state),typeof t=="function"&&(t=t(Ae({},s),this.props)),t&&Ae(s,t),t!=null&&this.__v&&(n&&this._sb.push(n),ts(this))},xt.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),ts(this))},xt.prototype.render=L,Fe=[],is=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,as=function(t,n){return t.__v.__b-n.__v.__b},St.__r=0,sn=Math.random().toString(8),yt="__d"+sn,rt="__a"+sn,os=/(PointerCapture)$|Capture$/i,on=0,rn=ss(!1),an=ss(!0),Ii=0;var Ge,te,un,fs,qe=0,Ss=[],se=Z,bs=se.__b,vs=se.__r,ys=se.diffed,ks=se.__c,xs=se.unmount,_s=se.__;function $t(t,n){se.__h&&se.__h(te,t,qe||n),qe=0;var s=te.__H||(te.__H={__:[],__h:[]});return t>=s.__.length&&s.__.push({}),s.__[t]}function C(t){return qe=1,zi(As,t)}function zi(t,n,s){var i=$t(Ge++,2);if(i.t=t,!i.__c&&(i.__=[s?s(n):As(void 0,n),function(l){var d=i.__N?i.__N[0]:i.__[0],c=i.t(d,l);d!==c&&(i.__N=[c,i.__[1]],i.__c.setState({}))}],i.__c=te,!te.__f)){var r=function(l,d,c){if(!i.__c.__H)return!0;var u=!1,h=i.__c.props!==l;if(i.__c.__H.__.some(function(f){if(f.__N){u=!0;var x=f.__[0];f.__=f.__N,f.__N=void 0,x!==f.__[0]&&(h=!0)}}),a){var g=a.call(this,l,d,c);return u?g||h:g}return!u||h};te.__f=!0;var a=te.shouldComponentUpdate,o=te.componentWillUpdate;te.componentWillUpdate=function(l,d,c){if(this.__e){var u=a;a=void 0,r(l,d,c),a=u}o&&o.call(this,l,d,c)},te.shouldComponentUpdate=r}return i.__N||i.__}function O(t,n){var s=$t(Ge++,3);!se.__s&&hn(s.__H,n)&&(s.__=t,s.u=n,te.__H.__h.push(s))}function Oi(t,n){var s=$t(Ge++,4);!se.__s&&hn(s.__H,n)&&(s.__=t,s.u=n,te.__h.push(s))}function re(t){return qe=5,Y(function(){return{current:t}},[])}function Ts(t,n,s){qe=6,Oi(function(){if(typeof t=="function"){var i=t(n());return function(){t(null),i&&typeof i=="function"&&i()}}if(t)return t.current=n(),function(){return t.current=null}},s==null?s:s.concat(t))}function Y(t,n){var s=$t(Ge++,7);return hn(s.__H,n)&&(s.__=t(),s.__H=n,s.__h=t),s.__}function Es(t,n){return qe=8,Y(function(){return t},n)}function Ui(){for(var t;t=Ss.shift();){var n=t.__H;if(t.__P&&n)try{n.__h.some(Ct),n.__h.some(pn),n.__h=[]}catch(s){n.__h=[],se.__e(s,t.__v)}}}se.__b=function(t){te=null,bs&&bs(t)},se.__=function(t,n){t&&n.__k&&n.__k.__m&&(t.__m=n.__k.__m),_s&&_s(t,n)},se.__r=function(t){vs&&vs(t),Ge=0;var n=(te=t.__c).__H;n&&(un===te?(n.__h=[],te.__h=[],n.__.some(function(s){s.__N&&(s.__=s.__N),s.u=s.__N=void 0})):(n.__h.some(Ct),n.__h.some(pn),n.__h=[],Ge=0)),un=te},se.diffed=function(t){ys&&ys(t);var n=t.__c;n&&n.__H&&(n.__H.__h.length&&(Ss.push(n)!==1&&fs===se.requestAnimationFrame||((fs=se.requestAnimationFrame)||Xi)(Ui)),n.__H.__.some(function(s){s.u&&(s.__H=s.u,s.u=void 0)})),un=te=null},se.__c=function(t,n){n.some(function(s){try{s.__h.some(Ct),s.__h=s.__h.filter(function(i){return!i.__||pn(i)})}catch(i){n.some(function(r){r.__h&&(r.__h=[])}),n=[],se.__e(i,s.__v)}}),ks&&ks(t,n)},se.unmount=function(t){xs&&xs(t);var n,s=t.__c;s&&s.__H&&(s.__H.__.some(function(i){try{Ct(i)}catch(r){n=r}}),s.__H=void 0,n&&se.__e(n,s.__v))};var ws=typeof requestAnimationFrame=="function";function Xi(t){var n,s=function(){clearTimeout(i),ws&&cancelAnimationFrame(n),setTimeout(t)},i=setTimeout(s,35);ws&&(n=requestAnimationFrame(s))}function Ct(t){var n=te,s=t.__c;typeof s=="function"&&(t.__c=void 0,s()),te=n}function pn(t){var n=te;t.__c=t.__(),te=n}function hn(t,n){return!t||t.length!==n.length||n.some(function(s,i){return s!==t[i]})}function As(t,n){return typeof n=="function"?n(t):n}var Rt=new URLSearchParams(location.search).get("root")??"",mn=()=>Rt;function Cs(t){Rt=t;let n=new URL(location.href);n.searchParams.set("root",t),history.replaceState(null,"",n.toString())}function Gi(t,n){let s=new URL(t,location.origin);Rt&&s.searchParams.set("root",Rt);for(let[i,r]of Object.entries(n??{}))r==null||r===""||s.searchParams.set(i,String(r));return s.toString()}var it=class extends Error{constructor(s,i){super(s);V(this,"status",i)}};async function P(t,n,s){let i=await fetch(Gi(t,n),s),r=await i.json().catch(()=>({error:"bad response"}));if(i.status===404&&r.error==="not found"&&t.startsWith("/api/"))throw new it(`${t} is not available on the running server; restart \`eminiar ui\` to pick up the rebuilt bundle`,i.status);if(!i.ok)throw new it(r.error??`HTTP ${i.status}`,i.status);if(r&&typeof r=="object"&&"error"in r&&r.error)throw new it(String(r.error),i.status);return r}function be(t,n,s="POST",i){return P(t,i,{method:s,headers:{"content-type":"application/json"},body:JSON.stringify(n)})}function Ft(t,n){return P(t,n,{method:"DELETE",headers:{"content-type":"application/json"}})}var K=t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(Math.round(t));function ne(t){if(!t)return"";let n=Date.now()-t;return n<6e4?"just now":n<36e5?`${Math.round(n/6e4)}m ago`:n<864e5?`${Math.round(n/36e5)}h ago`:`${Math.round(n/864e5)}d ago`}var he=t=>t?new Date(t).toISOString().slice(0,10):"",$s=t=>t?new Date(t).toLocaleTimeString():"",Mt=t=>t.split("/").pop()??t;var qi={file:"#2563eb",function:"#16a34a",method:"#0d9488",class:"#d97706",interface:"#7c3aed",type:"#8b5cf6",enum:"#a855f7",field:"#64748b",variable:"#64748b",route:"#e11d48",package:"#6b7280",memory:"#db2777",person:"#f59e0b",concept:"#0ea5e9",cluster:"#2563eb"},We=t=>qi[t]??"#94a3b8",Wi={imports:"#2563eb",reexports:"#3b82f6",calls:"#16a34a",references:"#0ea5e9",extends:"#7c3aed",implements:"#8b5cf6",handles:"#e11d48",defines:"#9ca3af",exports:"#9ca3af",co_changes:"#f59e0b",mentions:"#db2777",supersedes:"#db2777",authored:"#d97706",link:"#2563eb"},Lt=t=>Wi[t]??"#94a3b8",Rs=new Set(["imports","reexports","calls","references","extends","implements","handles","mentions","supersedes"]),Fs=["imports","calls","references","extends","implements","handles","reexports","co_changes","mentions","defines"],M=(...t)=>t.filter(Boolean).join(" ");function Ms(t,n){let s;return(...i)=>{clearTimeout(s),s=setTimeout(()=>t(...i),n)}}var Je=t=>`${Math.round((t??0)*100)}%`;function Ls(t){let n=t.slice(t.lastIndexOf(".")+1).toLowerCase();return{ts:"typescript",mts:"typescript",cts:"typescript",tsx:"tsx",js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"jsx",py:"python",go:"go",json:"json",md:"markdown",sh:"bash"}[n]??"plain"}var Ji=0;function e(t,n,s,i,r,a){n||(n={});var o,l,d=n;if("ref"in d)for(l in d={},n)l=="ref"?o=n[l]:d[l]=n[l];var c={type:t,props:d,key:s,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ji,__i:-1,__u:0,__source:r,__self:a};if(typeof t=="function"&&(o=t.defaultProps))for(l in o)d[l]===void 0&&(d[l]=o[l]);return Z.vnode&&Z.vnode(c),c}var gn=new Set;function J(t,n=!1){for(let s of gn)s(t,n)}function Is(){let[t,n]=C(null);return O(()=>{let s,i=(r,a)=>{n({msg:r,bad:a}),clearTimeout(s),s=setTimeout(()=>n(null),a?6e3:2500)};return gn.add(i),()=>{gn.delete(i),clearTimeout(s)}},[]),t?e("div",{class:M("toast",t.bad&&"bad"),children:t.msg}):null}function H(t,n){let[s,i]=C({data:void 0,error:void 0,loading:!0}),[r,a]=C(0),o=re(0);O(()=>{let d=++o.current;i(c=>({...c,loading:!0,error:void 0})),t().then(c=>d===o.current&&i({data:c,error:void 0,loading:!1}),c=>d===o.current&&i(u=>({...u,error:c.message,loading:!1})))},[...n,r]);let l=Es(()=>a(d=>d+1),[]);return{...s,reload:l}}var B=()=>e("span",{class:"spin"}),q=({children:t})=>e("div",{class:"empty",children:t}),G=({error:t})=>e("div",{class:"empty bad",children:t});function ge({kind:t}){return e("span",{class:"tag kind",style:{color:We(t)},children:t})}function I({children:t,class:n}){return e("span",{class:M("tag",n),children:t})}function Ce({value:t,max:n,width:s=80}){let i=n>0?Math.max(2,t/n*s):2;return e("span",{class:"bar",style:{width:`${i}px`},title:String(t)})}function Me({rows:t}){return e("dl",{class:"kv",children:t.map(([n,s])=>e(L,{children:[e("dt",{children:n}),e("dd",{children:s})]}))})}function Te({tabs:t,value:n,onChange:s}){return e("div",{class:"subtabs",children:t.map(([i,r])=>e("button",{type:"button",class:M(n===i&&"active"),onClick:()=>s(i),children:r}))})}function Ds({left:t,center:n,right:s,leftWidth:i=280,rightWidth:r=340}){let[a,o]=C(i),[l,d]=C(r),c=re(null),[u,h]=C(null);O(()=>{let f=m=>{let p=c.current;if(!p)return;let y=m.clientX-p.x;p.side==="l"?o(Math.max(160,Math.min(700,p.start+y))):d(Math.max(200,Math.min(800,p.start-y)))},x=()=>{c.current=null,h(null)};return window.addEventListener("mousemove",f),window.addEventListener("mouseup",x),()=>{window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",x)}},[]);let g=[t?`${a}px 5px`:"","minmax(0, 1fr)",s?`5px ${l}px`:""].filter(Boolean).join(" ");return e("div",{class:"split",style:{gridTemplateColumns:g},children:[t&&e(L,{children:[e("div",{class:"pane",children:t}),e("div",{class:M("gutter",u==="l"&&"on"),onMouseDown:f=>{c.current={side:"l",x:f.clientX,start:a},h("l"),f.preventDefault()}})]}),e("div",{class:"pane",children:n}),s&&e(L,{children:[e("div",{class:M("gutter",u==="r"&&"on"),onMouseDown:f=>{c.current={side:"r",x:f.clientX,start:l},h("r"),f.preventDefault()}}),e("div",{class:"pane",children:s})]})]})}function Ve(t,n,s=!0){let[i,r]=C(n),[a,o]=C(s?-1:1);return{sorted:(t??[]).slice().sort((c,u)=>{let h=c[i],g=u[i];return typeof h=="number"&&typeof g=="number"?(h-g)*a:String(h??"").localeCompare(String(g??""))*a}),th:(c,u,h=!1)=>e("th",{class:M("sortable",h&&"num",i===c&&"sorted"),onClick:()=>{i===c?o(g=>g===1?-1:1):(r(c),o(h?-1:1))},children:[u,i===c?a===1?" \u25B2":" \u25BC":""]})}}var Vi=["overview","explore","galaxy","architecture","history","memory","docs","coverage","sessions","system"];function Ns(){let t=location.hash.replace(/^#\/?/,""),[n="",s=""]=t.split("?"),i=Vi.includes(n)?n:"overview",r={};for(let[a,o]of new URLSearchParams(s))r[a]=o;return{view:i,params:r}}function z(t,n={}){let s=new URLSearchParams;for(let[r,a]of Object.entries(n))a&&s.set(r,a);let i=s.toString();location.hash=`/${t}${i?`?${i}`:""}`}function Ps(){let[t,n]=C(Ns);return O(()=>{let s=()=>n(Ns());return window.addEventListener("hashchange",s),()=>window.removeEventListener("hashchange",s)},[]),t}function fn(t,n){var s,i=1;t==null&&(t=0),n==null&&(n=0);function r(){var a,o=s.length,l,d=0,c=0;for(a=0;a<o;++a)l=s[a],d+=l.x,c+=l.y;for(d=(d/o-t)*i,c=(c/o-n)*i,a=0;a<o;++a)l=s[a],l.x-=d,l.y-=c}return r.initialize=function(a){s=a},r.x=function(a){return arguments.length?(t=+a,r):t},r.y=function(a){return arguments.length?(n=+a,r):n},r.strength=function(a){return arguments.length?(i=+a,r):i},r}function Bs(t){let n=+this._x.call(null,t),s=+this._y.call(null,t);return Hs(this.cover(n,s),n,s,t)}function Hs(t,n,s,i){if(isNaN(n)||isNaN(s))return t;var r,a=t._root,o={data:i},l=t._x0,d=t._y0,c=t._x1,u=t._y1,h,g,f,x,m,p,y,v;if(!a)return t._root=o,t;for(;a.length;)if((m=n>=(h=(l+c)/2))?l=h:c=h,(p=s>=(g=(d+u)/2))?d=g:u=g,r=a,!(a=a[y=p<<1|m]))return r[y]=o,t;if(f=+t._x.call(null,a.data),x=+t._y.call(null,a.data),n===f&&s===x)return o.next=a,r?r[y]=o:t._root=o,t;do r=r?r[y]=new Array(4):t._root=new Array(4),(m=n>=(h=(l+c)/2))?l=h:c=h,(p=s>=(g=(d+u)/2))?d=g:u=g;while((y=p<<1|m)===(v=(x>=g)<<1|f>=h));return r[v]=a,r[y]=o,t}function js(t){var n,s,i=t.length,r,a,o=new Array(i),l=new Array(i),d=1/0,c=1/0,u=-1/0,h=-1/0;for(s=0;s<i;++s)isNaN(r=+this._x.call(null,n=t[s]))||isNaN(a=+this._y.call(null,n))||(o[s]=r,l[s]=a,r<d&&(d=r),r>u&&(u=r),a<c&&(c=a),a>h&&(h=a));if(d>u||c>h)return this;for(this.cover(d,c).cover(u,h),s=0;s<i;++s)Hs(this,o[s],l[s],t[s]);return this}function zs(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var s=this._x0,i=this._y0,r=this._x1,a=this._y1;if(isNaN(s))r=(s=Math.floor(t))+1,a=(i=Math.floor(n))+1;else{for(var o=r-s||1,l=this._root,d,c;s>t||t>=r||i>n||n>=a;)switch(c=(n<i)<<1|t<s,d=new Array(4),d[c]=l,l=d,o*=2,c){case 0:r=s+o,a=i+o;break;case 1:s=r-o,a=i+o;break;case 2:r=s+o,i=a-o;break;case 3:s=r-o,i=a-o;break}this._root&&this._root.length&&(this._root=l)}return this._x0=s,this._y0=i,this._x1=r,this._y1=a,this}function Os(){var t=[];return this.visit(function(n){if(!n.length)do t.push(n.data);while(n=n.next)}),t}function Us(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function le(t,n,s,i,r){this.node=t,this.x0=n,this.y0=s,this.x1=i,this.y1=r}function Xs(t,n,s){var i,r=this._x0,a=this._y0,o,l,d,c,u=this._x1,h=this._y1,g=[],f=this._root,x,m;for(f&&g.push(new le(f,r,a,u,h)),s==null?s=1/0:(r=t-s,a=n-s,u=t+s,h=n+s,s*=s);x=g.pop();)if(!(!(f=x.node)||(o=x.x0)>u||(l=x.y0)>h||(d=x.x1)<r||(c=x.y1)<a))if(f.length){var p=(o+d)/2,y=(l+c)/2;g.push(new le(f[3],p,y,d,c),new le(f[2],o,y,p,c),new le(f[1],p,l,d,y),new le(f[0],o,l,p,y)),(m=(n>=y)<<1|t>=p)&&(x=g[g.length-1],g[g.length-1]=g[g.length-1-m],g[g.length-1-m]=x)}else{var v=t-+this._x.call(null,f.data),b=n-+this._y.call(null,f.data),k=v*v+b*b;if(k<s){var S=Math.sqrt(s=k);r=t-S,a=n-S,u=t+S,h=n+S,i=f.data}}return i}function Gs(t){if(isNaN(u=+this._x.call(null,t))||isNaN(h=+this._y.call(null,t)))return this;var n,s=this._root,i,r,a,o=this._x0,l=this._y0,d=this._x1,c=this._y1,u,h,g,f,x,m,p,y;if(!s)return this;if(s.length)for(;;){if((x=u>=(g=(o+d)/2))?o=g:d=g,(m=h>=(f=(l+c)/2))?l=f:c=f,n=s,!(s=s[p=m<<1|x]))return this;if(!s.length)break;(n[p+1&3]||n[p+2&3]||n[p+3&3])&&(i=n,y=p)}for(;s.data!==t;)if(r=s,!(s=s.next))return this;return(a=s.next)&&delete s.next,r?(a?r.next=a:delete r.next,this):n?(a?n[p]=a:delete n[p],(s=n[0]||n[1]||n[2]||n[3])&&s===(n[3]||n[2]||n[1]||n[0])&&!s.length&&(i?i[y]=s:this._root=s),this):(this._root=a,this)}function qs(t){for(var n=0,s=t.length;n<s;++n)this.remove(t[n]);return this}function Ws(){return this._root}function Js(){var t=0;return this.visit(function(n){if(!n.length)do++t;while(n=n.next)}),t}function Vs(t){var n=[],s,i=this._root,r,a,o,l,d;for(i&&n.push(new le(i,this._x0,this._y0,this._x1,this._y1));s=n.pop();)if(!t(i=s.node,a=s.x0,o=s.y0,l=s.x1,d=s.y1)&&i.length){var c=(a+l)/2,u=(o+d)/2;(r=i[3])&&n.push(new le(r,c,u,l,d)),(r=i[2])&&n.push(new le(r,a,u,c,d)),(r=i[1])&&n.push(new le(r,c,o,l,u)),(r=i[0])&&n.push(new le(r,a,o,c,u))}return this}function Zs(t){var n=[],s=[],i;for(this._root&&n.push(new le(this._root,this._x0,this._y0,this._x1,this._y1));i=n.pop();){var r=i.node;if(r.length){var a,o=i.x0,l=i.y0,d=i.x1,c=i.y1,u=(o+d)/2,h=(l+c)/2;(a=r[0])&&n.push(new le(a,o,l,u,h)),(a=r[1])&&n.push(new le(a,u,l,d,h)),(a=r[2])&&n.push(new le(a,o,h,u,c)),(a=r[3])&&n.push(new le(a,u,h,d,c))}s.push(i)}for(;i=s.pop();)t(i.node,i.x0,i.y0,i.x1,i.y1);return this}function Ks(t){return t[0]}function Ys(t){return arguments.length?(this._x=t,this):this._x}function Qs(t){return t[1]}function er(t){return arguments.length?(this._y=t,this):this._y}function Ne(t,n,s){var i=new bn(n??Ks,s??Qs,NaN,NaN,NaN,NaN);return t==null?i:i.addAll(t)}function bn(t,n,s,i,r,a){this._x=t,this._y=n,this._x0=s,this._y0=i,this._x1=r,this._y1=a,this._root=void 0}function tr(t){for(var n={data:t.data},s=n;t=t.next;)s=s.next={data:t.data};return n}var me=Ne.prototype=bn.prototype;me.copy=function(){var t=new bn(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root,s,i;if(!n)return t;if(!n.length)return t._root=tr(n),t;for(s=[{source:n,target:t._root=new Array(4)}];n=s.pop();)for(var r=0;r<4;++r)(i=n.source[r])&&(i.length?s.push({source:i,target:n.target[r]=new Array(4)}):n.target[r]=tr(i));return t};me.add=Bs;me.addAll=js;me.cover=zs;me.data=Os;me.extent=Us;me.find=Xs;me.remove=Gs;me.removeAll=qs;me.root=Ws;me.size=Js;me.visit=Vs;me.visitAfter=Zs;me.x=Ys;me.y=er;function ae(t){return function(){return t}}function ke(t){return(t()-.5)*1e-6}function Zi(t){return t.x+t.vx}function Ki(t){return t.y+t.vy}function vn(t){var n,s,i,r=1,a=1;typeof t!="function"&&(t=ae(t==null?1:+t));function o(){for(var c,u=n.length,h,g,f,x,m,p,y=0;y<a;++y)for(h=Ne(n,Zi,Ki).visitAfter(l),c=0;c<u;++c)g=n[c],m=s[g.index],p=m*m,f=g.x+g.vx,x=g.y+g.vy,h.visit(v);function v(b,k,S,A,_){var E=b.data,R=b.r,T=m+R;if(E){if(E.index>g.index){var $=f-E.x-E.vx,w=x-E.y-E.vy,F=$*$+w*w;F<T*T&&($===0&&($=ke(i),F+=$*$),w===0&&(w=ke(i),F+=w*w),F=(T-(F=Math.sqrt(F)))/F*r,g.vx+=($*=F)*(T=(R*=R)/(p+R)),g.vy+=(w*=F)*T,E.vx-=$*(T=1-T),E.vy-=w*T)}return}return k>f+T||A<f-T||S>x+T||_<x-T}}function l(c){if(c.data)return c.r=s[c.data.index];for(var u=c.r=0;u<4;++u)c[u]&&c[u].r>c.r&&(c.r=c[u].r)}function d(){if(n){var c,u=n.length,h;for(s=new Array(u),c=0;c<u;++c)h=n[c],s[h.index]=+t(h,c,n)}}return o.initialize=function(c,u){n=c,i=u,d()},o.iterations=function(c){return arguments.length?(a=+c,o):a},o.strength=function(c){return arguments.length?(r=+c,o):r},o.radius=function(c){return arguments.length?(t=typeof c=="function"?c:ae(+c),d(),o):t},o}function Yi(t){return t.index}function nr(t,n){var s=t.get(n);if(!s)throw new Error("node not found: "+n);return s}function yn(t){var n=Yi,s=h,i,r=ae(30),a,o,l,d,c,u=1;t==null&&(t=[]);function h(p){return 1/Math.min(l[p.source.index],l[p.target.index])}function g(p){for(var y=0,v=t.length;y<u;++y)for(var b=0,k,S,A,_,E,R,T;b<v;++b)k=t[b],S=k.source,A=k.target,_=A.x+A.vx-S.x-S.vx||ke(c),E=A.y+A.vy-S.y-S.vy||ke(c),R=Math.sqrt(_*_+E*E),R=(R-a[b])/R*p*i[b],_*=R,E*=R,A.vx-=_*(T=d[b]),A.vy-=E*T,S.vx+=_*(T=1-T),S.vy+=E*T}function f(){if(o){var p,y=o.length,v=t.length,b=new Map(o.map((S,A)=>[n(S,A,o),S])),k;for(p=0,l=new Array(y);p<v;++p)k=t[p],k.index=p,typeof k.source!="object"&&(k.source=nr(b,k.source)),typeof k.target!="object"&&(k.target=nr(b,k.target)),l[k.source.index]=(l[k.source.index]||0)+1,l[k.target.index]=(l[k.target.index]||0)+1;for(p=0,d=new Array(v);p<v;++p)k=t[p],d[p]=l[k.source.index]/(l[k.source.index]+l[k.target.index]);i=new Array(v),x(),a=new Array(v),m()}}function x(){if(o)for(var p=0,y=t.length;p<y;++p)i[p]=+s(t[p],p,t)}function m(){if(o)for(var p=0,y=t.length;p<y;++p)a[p]=+r(t[p],p,t)}return g.initialize=function(p,y){o=p,c=y,f()},g.links=function(p){return arguments.length?(t=p,f(),g):t},g.id=function(p){return arguments.length?(n=p,g):n},g.iterations=function(p){return arguments.length?(u=+p,g):u},g.strength=function(p){return arguments.length?(s=typeof p=="function"?p:ae(+p),x(),g):s},g.distance=function(p){return arguments.length?(r=typeof p=="function"?p:ae(+p),m(),g):r},g}var Qi={value:()=>{}};function rr(){for(var t=0,n=arguments.length,s={},i;t<n;++t){if(!(i=arguments[t]+"")||i in s||/[\s.]/.test(i))throw new Error("illegal type: "+i);s[i]=[]}return new It(s)}function It(t){this._=t}function ea(t,n){return t.trim().split(/^|\s+/).map(function(s){var i="",r=s.indexOf(".");if(r>=0&&(i=s.slice(r+1),s=s.slice(0,r)),s&&!n.hasOwnProperty(s))throw new Error("unknown type: "+s);return{type:s,name:i}})}It.prototype=rr.prototype={constructor:It,on:function(t,n){var s=this._,i=ea(t+"",s),r,a=-1,o=i.length;if(arguments.length<2){for(;++a<o;)if((r=(t=i[a]).type)&&(r=ta(s[r],t.name)))return r;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++a<o;)if(r=(t=i[a]).type)s[r]=sr(s[r],t.name,n);else if(n==null)for(r in s)s[r]=sr(s[r],t.name,null);return this},copy:function(){var t={},n=this._;for(var s in n)t[s]=n[s].slice();return new It(t)},call:function(t,n){if((r=arguments.length-2)>0)for(var s=new Array(r),i=0,r,a;i<r;++i)s[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=this._[t],i=0,r=a.length;i<r;++i)a[i].value.apply(n,s)},apply:function(t,n,s){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,a=i.length;r<a;++r)i[r].value.apply(n,s)}};function ta(t,n){for(var s=0,i=t.length,r;s<i;++s)if((r=t[s]).name===n)return r.value}function sr(t,n,s){for(var i=0,r=t.length;i<r;++i)if(t[i].name===n){t[i]=Qi,t=t.slice(0,i).concat(t.slice(i+1));break}return s!=null&&t.push({name:n,value:s}),t}var kn=rr;var Ze=0,ot=0,at=0,ar=1e3,Dt,lt,Nt=0,Pe=0,Pt=0,ct=typeof performance=="object"&&performance.now?performance:Date,or=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function wn(){return Pe||(or(na),Pe=ct.now()+Pt)}function na(){Pe=0}function xn(){this._call=this._time=this._next=null}xn.prototype=Bt.prototype={constructor:xn,restart:function(t,n,s){if(typeof t!="function")throw new TypeError("callback is not a function");s=(s==null?wn():+s)+(n==null?0:+n),!this._next&<!==this&&(lt?lt._next=this:Dt=this,lt=this),this._call=t,this._time=s,_n()},stop:function(){this._call&&(this._call=null,this._time=1/0,_n())}};function Bt(t,n,s){var i=new xn;return i.restart(t,n,s),i}function lr(){wn(),++Ze;for(var t=Dt,n;t;)(n=Pe-t._time)>=0&&t._call.call(void 0,n),t=t._next;--Ze}function ir(){Pe=(Nt=ct.now())+Pt,Ze=ot=0;try{lr()}finally{Ze=0,ra(),Pe=0}}function sa(){var t=ct.now(),n=t-Nt;n>ar&&(Pt-=n,Nt=t)}function ra(){for(var t,n=Dt,s,i=1/0;n;)n._call?(i>n._time&&(i=n._time),t=n,n=n._next):(s=n._next,n._next=null,n=t?t._next=s:Dt=s);lt=t,_n(i)}function _n(t){if(!Ze){ot&&(ot=clearTimeout(ot));var n=t-Pe;n>24?(t<1/0&&(ot=setTimeout(ir,t-ct.now()-Pt)),at&&(at=clearInterval(at))):(at||(Nt=ct.now(),at=setInterval(sa,ar)),Ze=1,or(ir))}}function cr(){let t=1;return()=>(t=(1664525*t+1013904223)%4294967296)/4294967296}function dr(t){return t.x}function ur(t){return t.y}var ia=10,aa=Math.PI*(3-Math.sqrt(5));function Sn(t){var n,s=1,i=.001,r=1-Math.pow(i,1/300),a=0,o=.6,l=new Map,d=Bt(h),c=kn("tick","end"),u=cr();t==null&&(t=[]);function h(){g(),c.call("tick",n),s<i&&(d.stop(),c.call("end",n))}function g(m){var p,y=t.length,v;m===void 0&&(m=1);for(var b=0;b<m;++b)for(s+=(a-s)*r,l.forEach(function(k){k(s)}),p=0;p<y;++p)v=t[p],v.fx==null?v.x+=v.vx*=o:(v.x=v.fx,v.vx=0),v.fy==null?v.y+=v.vy*=o:(v.y=v.fy,v.vy=0);return n}function f(){for(var m=0,p=t.length,y;m<p;++m){if(y=t[m],y.index=m,y.fx!=null&&(y.x=y.fx),y.fy!=null&&(y.y=y.fy),isNaN(y.x)||isNaN(y.y)){var v=ia*Math.sqrt(.5+m),b=m*aa;y.x=v*Math.cos(b),y.y=v*Math.sin(b)}(isNaN(y.vx)||isNaN(y.vy))&&(y.vx=y.vy=0)}}function x(m){return m.initialize&&m.initialize(t,u),m}return f(),n={tick:g,restart:function(){return d.restart(h),n},stop:function(){return d.stop(),n},nodes:function(m){return arguments.length?(t=m,f(),l.forEach(x),n):t},alpha:function(m){return arguments.length?(s=+m,n):s},alphaMin:function(m){return arguments.length?(i=+m,n):i},alphaDecay:function(m){return arguments.length?(r=+m,n):+r},alphaTarget:function(m){return arguments.length?(a=+m,n):a},velocityDecay:function(m){return arguments.length?(o=1-m,n):1-o},randomSource:function(m){return arguments.length?(u=m,l.forEach(x),n):u},force:function(m,p){return arguments.length>1?(p==null?l.delete(m):l.set(m,x(p)),n):l.get(m)},find:function(m,p,y){var v=0,b=t.length,k,S,A,_,E;for(y==null?y=1/0:y*=y,v=0;v<b;++v)_=t[v],k=m-_.x,S=p-_.y,A=k*k+S*S,A<y&&(E=_,y=A);return E},on:function(m,p){return arguments.length>1?(c.on(m,p),n):c.on(m)}}}function Tn(){var t,n,s,i,r=ae(-30),a,o=1,l=1/0,d=.81;function c(f){var x,m=t.length,p=Ne(t,dr,ur).visitAfter(h);for(i=f,x=0;x<m;++x)n=t[x],p.visit(g)}function u(){if(t){var f,x=t.length,m;for(a=new Array(x),f=0;f<x;++f)m=t[f],a[m.index]=+r(m,f,t)}}function h(f){var x=0,m,p,y=0,v,b,k;if(f.length){for(v=b=k=0;k<4;++k)(m=f[k])&&(p=Math.abs(m.value))&&(x+=m.value,y+=p,v+=p*m.x,b+=p*m.y);f.x=v/y,f.y=b/y}else{m=f,m.x=m.data.x,m.y=m.data.y;do x+=a[m.data.index];while(m=m.next)}f.value=x}function g(f,x,m,p){if(!f.value)return!0;var y=f.x-n.x,v=f.y-n.y,b=p-x,k=y*y+v*v;if(b*b/d<k)return k<l&&(y===0&&(y=ke(s),k+=y*y),v===0&&(v=ke(s),k+=v*v),k<o&&(k=Math.sqrt(o*k)),n.vx+=y*f.value*i/k,n.vy+=v*f.value*i/k),!0;if(f.length||k>=l)return;(f.data!==n||f.next)&&(y===0&&(y=ke(s),k+=y*y),v===0&&(v=ke(s),k+=v*v),k<o&&(k=Math.sqrt(o*k)));do f.data!==n&&(b=a[f.data.index]*i/k,n.vx+=y*b,n.vy+=v*b);while(f=f.next)}return c.initialize=function(f,x){t=f,s=x,u()},c.strength=function(f){return arguments.length?(r=typeof f=="function"?f:ae(+f),u(),c):r},c.distanceMin=function(f){return arguments.length?(o=f*f,c):Math.sqrt(o)},c.distanceMax=function(f){return arguments.length?(l=f*f,c):Math.sqrt(l)},c.theta=function(f){return arguments.length?(d=f*f,c):Math.sqrt(d)},c}function En(t){var n=ae(.1),s,i,r;typeof t!="function"&&(t=ae(t==null?0:+t));function a(l){for(var d=0,c=s.length,u;d<c;++d)u=s[d],u.vx+=(r[d]-u.x)*i[d]*l}function o(){if(s){var l,d=s.length;for(i=new Array(d),r=new Array(d),l=0;l<d;++l)i[l]=isNaN(r[l]=+t(s[l],l,s))?0:+n(s[l],l,s)}}return a.initialize=function(l){s=l,o()},a.strength=function(l){return arguments.length?(n=typeof l=="function"?l:ae(+l),o(),a):n},a.x=function(l){return arguments.length?(t=typeof l=="function"?l:ae(+l),o(),a):t},a}function An(t){var n=ae(.1),s,i,r;typeof t!="function"&&(t=ae(t==null?0:+t));function a(l){for(var d=0,c=s.length,u;d<c;++d)u=s[d],u.vy+=(r[d]-u.y)*i[d]*l}function o(){if(s){var l,d=s.length;for(i=new Array(d),r=new Array(d),l=0;l<d;++l)i[l]=isNaN(r[l]=+t(s[l],l,s))?0:+n(s[l],l,s)}}return a.initialize=function(l){s=l,o()},a.strength=function(l){return arguments.length?(n=typeof l=="function"?l:ae(+l),o(),a):n},a.y=function(l){return arguments.length?(t=typeof l=="function"?l:ae(+l),o(),a):t},a}function Cn(t,n,s){let i=new Map,r=t.map(d=>{let c=s?.get(d.id),u={...d,deg:0,r:4};return c&&(u.x=c.x,u.y=c.y),i.set(d.id,u),u}),a=[];for(let d of n){let c=i.get(d.src),u=i.get(d.dst);!c||!u||c===u||(c.deg++,u.deg++,a.push({source:c,target:u,kind:d.kind,weight:d.weight,count:d.count,lines:d.lines}))}for(let d of r)d.r=4+Math.min(12,Math.sqrt(d.deg)*1.8)+(d.root?3:0);let o=r.length,l=Sn(r).force("link",yn(a).distance(d=>d.kind==="co_changes"?90:d.kind==="defines"?36:60).strength(d=>d.kind==="co_changes"?.15:.5)).force("charge",Tn().strength(o>400?-60:-140).distanceMax(600)).force("collide",vn().radius(d=>d.r+4).iterations(2)).force("center",fn(0,0).strength(.05)).force("x",En(0).strength(.02)).force("y",An(0).strength(.02)).alphaDecay(o>400?.05:.03).velocityDecay(.4);return{nodes:r,links:a,sim:l,byId:i}}function pr(t,n){let s=Cn(t,n);s.sim.stop();let i=s.nodes.filter(x=>x.kind==="file"),r=s.nodes.filter(x=>x.kind!=="file"),a=new Map;for(let x of i){let m=(x.path??x.label).split("/").slice(0,-1).join("/")||".";(a.get(m)??a.set(m,[]).get(m)).push(x)}let o=[...a.keys()].sort((x,m)=>x.split("/").length-m.split("/").length||x.localeCompare(m)),l=220,d=34,c=-(o.length-1)*l/2,u=new Map;for(let x of o){let m=a.get(x).sort((y,v)=>y.label.localeCompare(v.label)),p=-(m.length-1)*d/2;for(let y of m)y.x=c,y.y=p,y.fx=c,y.fy=p,u.set(y.path??y.label,y),p+=d;c+=l}let h=new Map,g=[];for(let x of r){let m=x.path?u.get(x.path):void 0;if(!m){g.push(x);continue}let p=h.get(m.id)??0;h.set(m.id,p+1),x.x=(m.x??0)+70+p%3*46,x.y=(m.y??0)+Math.floor(p/3)*14-8,x.fx=x.x,x.fy=x.y}let f=(o.length?a.get(o[0]).length:0)*d/2+60;for(let x of g)x.x=-(g.length-1)*60/2+g.indexOf(x)*60,x.y=f,x.fx=x.x,x.fy=x.y;return f+=40,s}var oa=()=>document.documentElement.getAttribute("data-theme")==="dark"||document.documentElement.getAttribute("data-theme")!=="light"&&window.matchMedia("(prefers-color-scheme: dark)").matches;function Ke(t){let n=re(null),s=re(null),i=re(null),r=re({k:1,x:0,y:0}),a=re(null),o=re(null),[l,d]=C(null),[c,u]=C(!1),h=re(t);h.current=t;let g=()=>{let T=n.current,$=i.current;if(!T||!$)return;let w=T.getContext("2d");if(!w)return;let F=window.devicePixelRatio||1,W=T.width/F,X=T.height/F,D=r.current,ee=oa(),{selected:ue,highlight:pe}=h.current,ye=ue?$.byId.get(ue):void 0,ie=new Set;if(ye){ie.add(ye.id);for(let j of $.links){let de=j.source,oe=j.target;de.id===ye.id&&ie.add(oe.id),oe.id===ye.id&&ie.add(de.id)}}w.setTransform(F,0,0,F,0,0),w.clearRect(0,0,W,X),w.translate(W/2+D.x,X/2+D.y),w.scale(D.k,D.k);for(let j of $.links){let de=j.source,oe=j.target;if(de.x===void 0||oe.x===void 0)continue;let $e=`${de.id}|${oe.id}|${j.kind}`,Se=pe?.has($e),Qt=ye&&!(ie.has(de.id)&&ie.has(oe.id))&&de.id!==ye.id&&oe.id!==ye.id;if(w.globalAlpha=Se?1:Qt?.06:j.kind==="co_changes"?.35:.45,w.strokeStyle=Lt(j.kind),w.lineWidth=(Se?2.5:j.kind==="co_changes"?1+j.weight*2:1)/D.k,w.setLineDash(j.kind==="calls"?[4/D.k,3/D.k]:j.kind==="co_changes"?[1/D.k,3/D.k]:j.kind==="references"?[2/D.k,2/D.k]:[]),w.beginPath(),w.moveTo(de.x,de.y??0),w.lineTo(oe.x,oe.y??0),w.stroke(),w.setLineDash([]),Rs.has(j.kind)&&D.k>.5){let Xe=oe.x-de.x,Vn=(oe.y??0)-(de.y??0),Zn=Math.hypot(Xe,Vn)||1,nt=Xe/Zn,st=Vn/Zn,en=oe.x-nt*(oe.r+2),tn=(oe.y??0)-st*(oe.r+2),Re=5/D.k;w.fillStyle=Lt(j.kind),w.beginPath(),w.moveTo(en,tn),w.lineTo(en-nt*Re*2-st*Re,tn-st*Re*2+nt*Re),w.lineTo(en-nt*Re*2+st*Re,tn-st*Re*2-nt*Re),w.closePath(),w.fill()}}let Ue=$.nodes.length<=120||D.k>1.6;w.font=`${11/D.k}px system-ui, sans-serif`,w.textBaseline="middle";for(let j of $.nodes){if(j.x===void 0||j.y===void 0)continue;let de=ye&&!ie.has(j.id);if(w.globalAlpha=de?.2:1,w.beginPath(),w.arc(j.x,j.y,j.r/Math.max(1,D.k**.5),0,Math.PI*2),w.fillStyle=We(j.kind),w.fill(),j.root||j.id===ue||j===a.current?(w.lineWidth=2.5/D.k,w.strokeStyle=ee?"#e5e7eb":"#1b1f24",w.stroke()):j.kind==="file"&&j.exported,Ue||j.root||j.deg>3||ie.has(j.id)||j===a.current||j.id===ue){let $e=j.kind==="file"||j.kind==="package"?Mt(j.label):j.label.split(".").pop()??j.label,Se=j.x+j.r/Math.max(1,D.k**.5)+3/D.k;w.lineWidth=3/D.k,w.strokeStyle=ee?"#171a21":"#ffffff",w.strokeText($e,Se,j.y),w.fillStyle=ee?"#e5e7eb":"#1b1f24",w.fillText($e,Se,j.y)}}w.globalAlpha=1},f=()=>{let T=n.current,$=i.current;if(!T||!$?.nodes.length)return;let w=window.devicePixelRatio||1,F=T.width/w,W=T.height/w,X=Number.POSITIVE_INFINITY,D=Number.POSITIVE_INFINITY,ee=Number.NEGATIVE_INFINITY,ue=Number.NEGATIVE_INFINITY;for(let fe of $.nodes)fe.x===void 0||fe.y===void 0||(X=Math.min(X,fe.x),D=Math.min(D,fe.y),ee=Math.max(ee,fe.x),ue=Math.max(ue,fe.y));let pe=Math.max(100,ee-X+120),ye=Math.max(100,ue-D+120),ie=Math.min(2.5,Math.min(F/pe,W/ye));r.current={k:ie,x:-((X+ee)/2)*ie,y:-((D+ue)/2)*ie},g()};Ts(t.handle??null,()=>({fit:f}),[]);let x=t.nodes.map(T=>T.id).join("|"),m=t.edges.length,p=t.mode??"galaxy";O(()=>{let T=t.keepPositions?i.current?.byId:void 0;i.current?.sim.stop();let $=p==="hierarchy"?pr(t.nodes,t.edges):Cn(t.nodes,t.edges,T);i.current=$;let w=!1,F=0;if(p==="hierarchy"){f();return}return $.sim.on("tick",()=>{F++,(F%2===0||$.sim.alpha()<.05)&&g(),!w&&(F===30||$.sim.alpha()<.3)&&(w=!0,f())}),$.sim.on("end",()=>{w=!0,f()}),()=>$.sim.stop()},[x,m,p]),O(()=>{g()},[t.selected,t.highlight,l]),O(()=>{let T=s.current,$=n.current;if(!T||!$)return;let w=()=>{let D=window.devicePixelRatio||1;$.width=Math.max(1,T.clientWidth*D),$.height=Math.max(1,T.clientHeight*D),g()};w();let F=new ResizeObserver(w);F.observe(T);let W=window.matchMedia("(prefers-color-scheme: dark)");W.addEventListener("change",g);let X=new MutationObserver(g);return X.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>{F.disconnect(),W.removeEventListener("change",g),X.disconnect()}},[]);let y=T=>{let w=n.current.getBoundingClientRect(),F=r.current;return{x:(T.clientX-w.left-w.width/2-F.x)/F.k,y:(T.clientY-w.top-w.height/2-F.y)/F.k}},v=T=>{let $=i.current;if(!$)return null;let w=y(T),F=r.current,W=null,X=Number.POSITIVE_INFINITY;for(let D of $.nodes){if(D.x===void 0||D.y===void 0)continue;let ee=Math.hypot(D.x-w.x,D.y-w.y),ue=D.r/Math.max(1,F.k**.5)+6/F.k;ee<ue&&ee<X&&(X=ee,W=D)}return W},b=T=>{let $=v(T),w=r.current;o.current={node:$??void 0,px:T.clientX,py:T.clientY,vx:w.x,vy:w.y,moved:!1},$&&($.fx=$.x,$.fy=$.y,i.current?.sim.alphaTarget(.2).restart()),u(!0),T.preventDefault()},k=T=>{let $=o.current;if($){let F=T.clientX-$.px,W=T.clientY-$.py;if(Math.abs(F)+Math.abs(W)>3&&($.moved=!0),$.node){let X=y(T);$.node.fx=X.x,$.node.fy=X.y,p==="hierarchy"&&($.node.x=X.x,$.node.y=X.y,g())}else r.current={...r.current,x:$.vx+F,y:$.vy+W},g();return}let w=v(T);w!==a.current&&(a.current=w,d(w))},S=T=>{let $=o.current;o.current=null,u(!1),$&&($.node?(p!=="hierarchy"&&($.node.fx=null,$.node.fy=null,i.current?.sim.alphaTarget(0)),$.moved||h.current.onSelect?.($.node.id===h.current.selected?null:$.node.id)):$.moved||h.current.onSelect?.(null))},A=T=>{T.preventDefault();let w=n.current.getBoundingClientRect(),F=r.current,W=T.deltaY>0?.9:1.1,X=Math.max(.05,Math.min(8,F.k*W)),D=T.clientX-w.left-w.width/2,ee=T.clientY-w.top-w.height/2;r.current={k:X,x:D-(D-F.x)*X/F.k,y:ee-(ee-F.y)*X/F.k},g()},_=T=>{let $=v(T);$&&h.current.onActivate?.($.id)},E=[...new Set(t.nodes.map(T=>T.kind))],R=[...new Set(t.edges.map(T=>T.kind))];return e("div",{class:"gwrap",ref:s,children:[e("canvas",{ref:n,class:M(c&&"drag",l&&!c&&"hover"),onMouseDown:b,onMouseMove:k,onMouseUp:S,onMouseLeave:()=>{a.current=null,d(null),o.current&&!o.current.node&&(o.current=null)},onWheel:A,onDblClick:_}),l&&!c&&e("div",{class:"overlay tip",style:{left:12,top:12},children:[e("b",{children:l.kind})," ",l.label,l.path&&l.kind!=="file"?e("span",{class:"muted",children:[" ","\xB7 ",l.path,l.line?`:${l.line}`:""]}):null,e("span",{class:"muted",children:[" ","\xB7 ",l.deg," edge",l.deg===1?"":"s"]})]}),t.legend!==!1&&e("div",{class:"overlay legend",children:[E.map(T=>e("span",{children:[e("i",{style:{background:We(T)}}),T]})),R.map(T=>e("span",{children:[e("s",{style:{borderColor:Lt(T)}}),T]}))]}),e("button",{type:"button",class:"overlay fit",onClick:f,children:"fit view"})]})}function hr(t,n,s,i,r){let a=t.reduce((x,m)=>x+(m.value??m.size),0);if(!a||!t.length)return[];let o=i*r/a,l=[],d=0,c=n,u=s,h=i,g=r,f=[...t].sort((x,m)=>(m.value??m.size)-(x.value??x.size));for(;d<f.length;){let x=h>=g,m=x?g:h,p=[],y=0,v=Number.POSITIVE_INFINITY;for(;d<f.length;){let S=f[d],A=(S.value??S.size)*o,_=[...p,S],E=y+A,R=Math.max(..._.map(w=>(w.value??w.size)*o)),T=Math.min(..._.map(w=>(w.value??w.size)*o)),$=Math.max(m*m*R/(E*E),E*E/(m*m*T));if($>v&&p.length)break;v=$,p=_,y=E,d++}let b=m?y/m:0,k=0;for(let S of p){let A=b?(S.value??S.size)*o/b:0;l.push(x?{node:S,x:c,y:u+k,w:b,h:A,depth:0}:{node:S,x:c+k,y:u,w:A,h:b,depth:0}),k+=A}x?(c+=b,h-=b):(u+=b,g-=b)}return l}function mr(t,n,s,i=18){let r=[];for(let a of hr(t.children??[],0,0,n,s))if(r.push({...a,depth:0}),a.node.children?.length&&a.w>40&&a.h>30)for(let o of hr(a.node.children,a.x+2,a.y+i,Math.max(0,a.w-4),Math.max(0,a.h-i-2)))r.push({...o,depth:1});return r}function gr(t,n,s){let i={name:n||"(project)",path:n,size:0,children:[]},r=new Map([["",i]]),a=l=>{let d=r.get(l);if(d)return d;let c=a(l.includes("/")?l.slice(0,l.lastIndexOf("/")):""),u={name:l.split("/").pop()??l,path:l,size:0,children:[]};return c.children.push(u),r.set(l,u),u};for(let l of t){if(n&&!l.path.startsWith(n))continue;let d=n?l.path.slice(n.length).replace(/^\//,""):l.path,c=d.includes("/")?d.slice(0,d.lastIndexOf("/")):"",u=Math.max(1,s(l));a(c).children.push({name:d.split("/").pop()??d,path:l.path,size:u,data:l})}let o=l=>(l.children?.length&&(l.size=l.children.reduce((d,c)=>d+o(c),0)),l.size);return o(i),i}var fr={typescript:"#2563eb",tsx:"#3b82f6",javascript:"#d97706",python:"#16a34a",go:"#0d9488",other:"#6b7280"};function la(t){let n=Math.max(0,Math.min(1,t)),s=Math.round(37+180*n),i=Math.round(99+20*n),r=Math.round(235+-229*n);return`rgb(${s},${i},${r})`}function ca({files:t,arch:n}){let[s,i]=C(""),[r,a]=C("language"),[o,l]=C("loc"),[d,c]=C(null),u=re(null),[h,g]=C({w:900,h:520});O(()=>{let v=u.current;if(!v)return;let b=new ResizeObserver(()=>g({w:v.clientWidth,h:v.clientHeight}));return b.observe(v),g({w:v.clientWidth,h:v.clientHeight}),()=>b.disconnect()},[]);let f=Y(()=>{let v=gr(t,s,b=>o==="uniform"?1:b.loc||Math.max(1,b.size/40));return mr(v,h.w,h.h)},[t,s,o,h]),m=d?(v=>t.filter(b=>b.path===v||b.path.startsWith(`${v}/`)))(d):[],p=m.length===1&&m[0]?.path===d?m[0]:void 0,y=n?.entryPoints.filter(v=>v.kind!=="script")??[];return e("div",{class:"grid wide",style:{alignItems:"start"},children:[e("div",{children:[e("div",{class:"row",style:{marginBottom:8},children:[e("span",{class:"row tight",children:[e("a",{onClick:()=>i(""),children:n?.project.name??"project"}),s.split("/").filter(Boolean).map((v,b,k)=>e(L,{children:[e("span",{class:"muted",children:"\u203A"}),e("a",{onClick:()=>i(k.slice(0,b+1).join("/")),children:v})]}))]}),e("span",{class:"spacer"}),e("span",{class:"row tight",children:[e("button",{type:"button",class:M("chip",o==="loc"&&"on"),onClick:()=>l("loc"),children:"size: loc"}),e("button",{type:"button",class:M("chip",o==="uniform"&&"on"),onClick:()=>l("uniform"),children:"uniform"}),e("button",{type:"button",class:M("chip",r==="language"&&"on"),onClick:()=>a("language"),children:"color: language"}),e("button",{type:"button",class:M("chip",r==="heat"&&"on"),onClick:()=>a("heat"),children:"heat"})]})]}),e("div",{class:"treemap",ref:u,children:f.map(v=>{let b=v.node.data,k=!!v.node.children?.length,S=b?r==="heat"?la(b.score):fr[b.language??"other"]??fr.other:void 0;return e("div",{class:M("cell",k&&"dir",d===v.node.path&&"sel"),style:{left:v.x,top:v.y,width:Math.max(0,v.w),height:Math.max(0,v.h),background:S},title:b?`${b.path} \xB7 ${b.loc} loc \xB7 ${b.symbols} symbols \xB7 heat ${b.score.toFixed(2)}`:`${v.node.path} \xB7 ${v.node.size} loc`,onClick:A=>{A.stopPropagation(),c(v.node.path)},onDblClick:A=>{A.stopPropagation(),k?i(v.node.path):b&&z("explore",{file:b.path})},children:k?e("span",{class:"lbl",children:[v.node.name,"/"]}):v.w>50&&v.h>14?v.node.name:""})})}),e("div",{class:"muted small",style:{marginTop:6},children:"Area is lines of code (or uniform). Double-click a folder to open it, a file to read it. Heat mixes fan-in, recent commits and complexity; it is a signal, not a grade."})]}),e("div",{class:"stack",children:[e("div",{class:"card",children:[e("h3",{children:d??"selection"}),p?e(L,{children:[e("div",{class:"row small",children:[e(I,{children:p.language??"?"}),e(I,{children:[p.loc," loc"]}),e(I,{children:[p.symbols," symbols"]}),e(I,{children:["fan-in ",p.fanIn]}),e(I,{children:["heat ",p.score.toFixed(2)]}),e(I,{children:p.status})]}),e("div",{class:"row",style:{marginTop:8},children:[e("button",{type:"button",class:"sm",onClick:()=>z("explore",{file:p.path}),children:"Open source"}),e("button",{type:"button",class:"sm",onClick:()=>z("galaxy",{node:`file:${p.path}`}),children:"Galaxy"})]})]}):m.length?e("div",{class:"row small",children:[e(I,{children:[m.length," files"]}),e(I,{children:[K(m.reduce((v,b)=>v+b.loc,0))," loc"]}),e(I,{children:[m.reduce((v,b)=>v+b.symbols,0)," symbols"]}),e(I,{children:["mean heat ",(m.reduce((v,b)=>v+b.score,0)/m.length).toFixed(2)]})]}):e("div",{class:"muted small",children:"Click a cell."})]}),e("div",{class:"card",children:[e("h3",{children:"entry points"}),y.length?e("table",{children:e("tbody",{children:y.map(v=>e("tr",{class:"click",onClick:()=>z("explore",{file:v.path}),children:[e("td",{children:e(I,{children:v.kind})}),e("td",{class:"break",children:v.name}),e("td",{class:"muted small break",children:v.path})]}))})}):e("div",{class:"muted small",children:"none found"})]}),n&&e("div",{class:"card",children:[e("h3",{children:"overview"}),e("div",{class:"row small",children:[e(I,{children:[n.overview.files," files"]}),e(I,{children:[n.overview.symbols," symbols"]}),e(I,{children:[n.overview.edges," edges"]}),Object.entries(n.overview.languages).map(([v,b])=>e(I,{children:[v," ",b]}))]}),n.project.description?e("div",{class:"muted small",style:{marginTop:6},children:n.project.description}):null]})]})]})}function da(){let t=H(()=>P("/api/routes"),[]);return t.error?e(G,{error:t.error}):t.data?t.data.length?e("div",{class:"card flush",children:e("table",{children:[e("thead",{children:e("tr",{children:[e("th",{children:"method"}),e("th",{children:"path"}),e("th",{children:"framework"}),e("th",{children:"handler"}),e("th",{children:"registered in"})]})}),e("tbody",{children:t.data.map(n=>e("tr",{children:[e("td",{children:e(I,{children:n.method})}),e("td",{class:"mono",children:n.path}),e("td",{class:"muted",children:n.framework}),e("td",{children:n.handlers.map(s=>e("div",{children:[e("a",{onClick:()=>s.path?z("explore",{file:s.path,symbol:s.id}):z("galaxy",{node:s.id}),children:s.name}),s.path?e("span",{class:"muted small",children:[" ",s.path]}):null]}))}),e("td",{class:"muted small",children:e("a",{onClick:()=>z("explore",{file:n.file,line:n.line?String(n.line):void 0}),children:[n.file,n.line?`:${n.line}`:""]})})]}))})]})}):e(q,{children:"No routes detected. express/fastify/hono/koa/hapi/restify registrations, moleculer service schemas and gateway aliases, and Next.js route files are recognised."}):e(B,{})}function ua(){let[t,n]=C("file"),[s,i]=C(""),r=H(()=>P("/api/hotspots",{kind:t,path:s.trim()||void 0,limit:80}),[t,s]),{sorted:a,th:o}=Ve(r.data,"score"),l={fan_in:Math.max(1,...a.map(d=>d.fan_in)),commits_90d:Math.max(1,...a.map(d=>d.commits_90d)),complexity:Math.max(1,...a.map(d=>d.complexity))};return e(L,{children:[e("div",{class:"row",style:{marginBottom:10},children:[e("button",{type:"button",class:M("chip",t==="file"&&"on"),onClick:()=>n("file"),children:"files"}),e("button",{type:"button",class:M("chip",t==="symbol"&&"on"),onClick:()=>n("symbol"),children:"functions and classes"}),e("input",{type:"text",placeholder:"folder prefix, e.g. src/graph/",value:s,onInput:d=>i(d.target.value),style:{width:260}}),e("span",{class:"muted small",children:"Score = 0.4\xB7fan-in + 0.4\xB7commits/90d + 0.2\xB7complexity, log-scaled. A signal of where attention goes, not a quality grade."})]}),r.error?e(G,{error:r.error}):r.data?e("div",{class:"card flush",children:e("table",{children:[e("thead",{children:e("tr",{children:[o("path",t==="file"?"file":"symbol"),o("fan_in","fan-in",!0),o("commits_90d","commits/90d",!0),o("complexity","complexity",!0),o("loc","loc",!0),o("score","score",!0),e("th",{children:"last"})]})}),e("tbody",{children:a.map(d=>e("tr",{class:"click",onClick:()=>d.kind==="file"?z("explore",{file:d.path}):z("explore",{file:d.path.split(" > ")[0],symbol:d.id}),children:[e("td",{class:"break",children:[d.kind!=="file"?e(ge,{kind:d.kind}):null,d.path]}),e("td",{class:"num",children:[e(Ce,{value:d.fan_in,max:l.fan_in,width:60})," ",d.fan_in]}),e("td",{class:"num",children:[e(Ce,{value:d.commits_90d,max:l.commits_90d,width:60})," ",d.commits_90d]}),e("td",{class:"num",children:[e(Ce,{value:d.complexity,max:l.complexity,width:60})," ",d.complexity]}),e("td",{class:"num",children:d.loc}),e("td",{class:"num",children:e("b",{children:d.score.toFixed(2)})}),e("td",{class:"muted small",children:d.last_touched})]}))})]})}):e(B,{})]})}function pa(){let t=H(()=>P("/api/clusters"),[]),[n,s]=C(null),[i,r]=C(null),[a,o]=C(new Set),l=Y(()=>{let u=t.data;if(!u)return{nodes:[],edges:[]};let h=[],g=[];if(i!==null){let f=u.cycles[i]??[];for(let x of f)h.push({id:`file:${x}`,label:x,kind:"file",path:x,line:null});for(let x=0;x<f.length;x++)g.push({src:`file:${f[x]}`,dst:`file:${f[(x+1)%f.length]}`,kind:"imports",weight:1});return{nodes:h,edges:g}}for(let f of u.clusters){if(a.has(f.id))for(let x of u.members[String(f.id)]??[])h.push({id:`file:${x.path}`,label:x.path,kind:"file",path:x.path,line:null,score:x.score});if(h.push({id:`cluster:${f.id}`,label:`#${f.id} ${f.label} (${f.size})`,kind:"cluster",path:null,line:null}),a.has(f.id))for(let x of u.members[String(f.id)]??[])g.push({src:`file:${x.path}`,dst:`cluster:${f.id}`,kind:"link",weight:.5});for(let[x,m]of Object.entries(f.links))g.push({src:`cluster:${f.id}`,dst:`cluster:${x}`,kind:"imports",weight:Math.min(1,m/10),count:m})}return{nodes:h,edges:g}},[t.data,i,a]);if(t.error)return e(G,{error:t.error});let d=t.data;if(!d)return e(B,{});let c=n?.startsWith("cluster:")?d.clusters.find(u=>String(u.id)===n.slice(8)):void 0;return e("div",{class:"grid wide",style:{alignItems:"start"},children:[e("div",{class:"card flush",style:{height:560},children:l.nodes.length?e(Ke,{nodes:l.nodes,edges:l.edges,selected:n,onSelect:s,onActivate:u=>{if(u.startsWith("cluster:")){let h=Number(u.slice(8));o(g=>{let f=new Set(g);return f.has(h)?f.delete(h):f.add(h),f})}else u.startsWith("file:")&&z("explore",{file:u.slice(5)})}}):e(q,{children:"No clusters yet. Run a reindex."})}),e("div",{class:"stack",children:[e("div",{class:"card",children:[e("h3",{children:["clusters \xB7 ",d.clusters.length]}),e("div",{class:"muted small",style:{marginBottom:6},children:"Connectivity groups from imports and co-change (label propagation). Double-click a cluster to expand its files; they are not proof of architectural boundaries."}),e("div",{class:"list",style:{maxHeight:260},children:d.clusters.map(u=>e("div",{class:M("item",n===`cluster:${u.id}`&&"sel"),onClick:()=>{r(null),s(`cluster:${u.id}`)},children:[e("div",{class:"n",children:["#",u.id," ",u.label," ",e("span",{class:"muted",children:["\xB7 ",u.size," files"]})]}),e("div",{class:"p",children:u.files.slice(0,3).join(", ")})]}))})]}),c&&e("div",{class:"card",children:[e("h3",{children:["cluster #",c.id," members"]}),e("div",{class:"list",style:{maxHeight:220},children:(d.members[String(c.id)]??[]).map(u=>e("div",{class:"item",onClick:()=>z("explore",{file:u.path}),children:e("div",{class:"p",children:[u.path," ",e("span",{class:"muted",children:["\xB7 heat ",u.score.toFixed(2)]})]})}))})]}),e("div",{class:"card",children:[e("h3",{children:["import cycles \xB7 ",d.cycles.length]}),d.cycles.length?e("div",{class:"list",style:{maxHeight:220},children:d.cycles.map((u,h)=>e("div",{class:M("item",i===h&&"sel"),onClick:()=>{r(i===h?null:h),s(null)},children:e("div",{class:"p",children:[u.length," files: ",u.slice(0,4).join(" \u2192 "),u.length>4?" \u2026":""]})}))}):e("div",{class:"muted small",children:"none"}),i!==null?e("button",{type:"button",class:"sm",style:{marginTop:6},onClick:()=>r(null),children:"show clusters"}):null]})]})]})}function br({id:t,depth:n,onSelect:s,selected:i}){let r=H(()=>P("/api/behavior",{id:t}),[t]),[a,o]=C(new Set);if(r.error)return e("div",{class:"muted small",children:r.error});if(!r.data)return e(B,{});let l=r.data;return e(L,{children:[n===0&&e("div",{class:M("bnode",i===l.root.id&&"sel"),onClick:()=>s(l),children:[e(I,{children:"start"}),e(ge,{kind:l.root.kind}),e("b",{children:l.root.label}),e("span",{class:"muted small",children:l.root.path})]}),e("div",{class:"kids",children:l.callees.length?l.callees.map(d=>{let c=a.has(d.node.id);return e(L,{children:[e("div",{class:M("bnode",i===d.node.id&&"sel"),onClick:()=>s({root:d.node,callees:[]}),children:[e("span",{class:"arrow",onClick:u=>{u.stopPropagation(),o(h=>{let g=new Set(h);return g.has(d.node.id)?g.delete(d.node.id):g.add(d.node.id),g})},children:d.node.kind==="package"||d.node.kind==="route"?"\xB7":c?"\u25BE":"\u25B8"}),e(I,{children:d.kind==="handles"?"handles":"possible call"}),e(ge,{kind:d.node.kind}),e("span",{children:d.node.label}),e("span",{class:"muted small",children:[d.lines?.length?`L${d.lines.join(", L")}`:"",d.count&&d.count>1?` \xD7${d.count}`:""]})]}),c&&n<6?e(br,{id:d.node.id,depth:n+1,onSelect:s,selected:i}):null]})}):e("div",{class:"muted small",style:{padding:"2px 6px"},children:"no resolved calls"})})]})}function ha({params:t}){let[n,s]=C(t.node??null),[i,r]=C(""),[a,o]=C([]),[l,d]=C(null);return O(()=>{if(i.trim().length<2)return o([]);let c=setTimeout(()=>{P("/api/nodes/search",{q:i.trim(),limit:10}).then(u=>o(u.filter(h=>h.kind!=="file"&&h.kind!=="package"))).catch(()=>o([]))},180);return()=>clearTimeout(c)},[i]),e("div",{class:"grid wide",style:{alignItems:"start"},children:[e("div",{class:"card",children:[e("div",{class:"row",style:{marginBottom:10,position:"relative"},children:[e("span",{class:"muted small",children:"Start"}),e("input",{type:"text",placeholder:"function or method\u2026",value:i,onInput:c=>r(c.target.value),style:{width:320}}),a.length>0&&e("div",{class:"suggest",style:{top:36,left:40},children:a.map(c=>e("div",{onMouseDown:()=>{s(c.id),r(""),o([]),d(null)},children:[e(ge,{kind:c.kind}),e("span",{class:"ellipsis",children:c.label}),e("span",{class:"path",children:c.path})]}))}),e("span",{class:"muted small",children:"Branches are possible static calls from the index, not an execution order."})]}),e("div",{class:"btree",children:n?e(br,{id:n,depth:0,onSelect:d,selected:l?.root.id??null}):e(q,{children:"Choose a starting operation."})})]}),e("div",{class:"card",children:[e("h3",{children:l?"selected operation":"starting operation"}),l?e(L,{children:[e("div",{class:"row tight",children:[e(ge,{kind:l.root.kind}),e("b",{class:"break",children:l.root.label})]}),e("div",{class:"muted small",children:[l.root.path,l.root.line?`:${l.root.line}`:"",l.root.endLine?`\u2013${l.root.endLine}`:""]}),l.root.complexity?e("div",{class:"row small",style:{marginTop:6},children:[e(I,{children:["complexity ",l.root.complexity]}),e(I,{children:[l.root.loc," loc"]})]}):null,e("div",{class:"row",style:{marginTop:8},children:[l.root.path?e("button",{type:"button",class:"sm",onClick:()=>z("explore",{file:l.root.path,line:l.root.line?String(l.root.line):void 0,symbol:l.root.id}),children:"Open definition"}):null,e("button",{type:"button",class:"sm",onClick:()=>{s(l.root.id),d(null)},children:"Start here"}),e("button",{type:"button",class:"sm",onClick:()=>z("galaxy",{node:l.root.id}),children:"Galaxy"})]})]}):e("div",{class:"muted small",children:"Click an operation in the tree."})]})]})}function vr({params:t}){let[n,s]=C(t.tab||"overview");O(()=>{t.tab&&s(t.tab)},[t.tab]);let i=H(()=>P("/api/tree"),[]),r=H(()=>P("/api/architecture",{aspects:"overview,entry_points"}),[]);return e("div",{class:"page",children:[e(Te,{tabs:[["overview","Overview"],["routes","Routes"],["hotspots","Hotspots"],["structure","System structure"],["behavior","Behavior"]],value:n,onChange:s}),n==="overview"&&(i.data?e(ca,{files:i.data.files,arch:r.data}):i.error?e(G,{error:i.error}):e(B,{})),n==="routes"&&e(da,{}),n==="hotspots"&&e(ua,{}),n==="structure"&&e(pa,{}),n==="behavior"&&e(ha,{params:t})]})}function yr(){let t=H(()=>P("/api/coverage"),[]),[n,s]=C(""),[i,r]=C(""),[a,o]=C(null),l=Y(()=>{let p=i.trim().toLowerCase();return(t.data?.files??[]).filter(y=>(!n||y.status===n)&&(!p||y.path.toLowerCase().includes(p)||(y.reason??"").toLowerCase().includes(p)))},[t.data,n,i]),{sorted:d,th:c}=Ve(l,"path",!1),u=async(p,y)=>{o(p);try{let v=await be("/api/actions",y);J(v.output.split(`
|
|
3
|
-
`)[0]??"done",!
|
|
4
|
-
`)}):null,e("h3",{style:{marginTop:12},children:["indexed pages ",e("span",{class:"muted small",children:["(",t.documents,")"]})]}),r.error?e(
|
|
5
|
-
`):wr(t),children:[e(Sr,{kind:t.kind}),t.provider?e("span",{class:"muted",children:[t.provider," \xB7 "]}):null,e("span",{class:"muted",children:wr(t)})]}),e("div",{class:"p",children:e("span",{class:"muted",children:[t.documents," docs \xB7 ",t.chunks," chunks \xB7"," ",t.sync?`synced ${ne(t.sync.at)}`:"never synced",t.sync?.errors.length?e("span",{class:"bad",children:[" \xB7 ",t.sync.errors.length," errors"]}):null]})})]})}function ya({params:t,onLog:n}){let s=H(()=>P("/api/docs"),[]),[i,r]=C(t.name??null),[a,o]=C(""),[l,d]=C(!1),[c,u]=C(null);O(()=>{t.name&&r(t.name)},[t.name]);let[h,g]=C("all"),[f,x]=C(new Set),m=s.data,p=Y(()=>{let _=a.trim().toLowerCase();return(m?.sources??[]).filter(E=>(h==="all"||E.category===h)&&(!_||E.name.includes(_)||(E.title??"").toLowerCase().includes(_)||(E.provider??"").includes(_)||(E.tags??[]).some(R=>R.includes(_))||(E.urls??[]).some(R=>R.includes(_))||(E.path??"").includes(_)))},[m,a,h]),y=Y(()=>{let _=new Map;for(let E of m?.sources??[])_.set(E.category,(_.get(E.category)??0)+1);return _},[m]),v=Y(()=>{let _=new Map;for(let T of p){let $=_.get(T.category)??[];$.push(T),_.set(T.category,$)}let E=[..._.entries()].sort((T,$)=>$n(T[0])-$n($[0])).map(([T,$])=>({info:xr(T),items:$.sort((w,F)=>Rn(w).localeCompare(Rn(F)))})),R=[];for(let T of E){let $=R[R.length-1];$?.group===T.info.group?$.cats.push(T):R.push({group:T.info.group,label:_r[T.info.group],cats:[T]})}return R},[p]),b=_=>x(E=>{let R=new Set(E);return R.has(_)?R.delete(_):R.add(_),R}),k=p.find(_=>_.name===i)??m?.sources.find(_=>_.name===i),S=async(_,E)=>{let R=_?.length===1?`sync ${_[0]}`:"sync all";u(R);try{let T=await be("/api/docs/sync",{names:_,force:E});n(T.text),J(`${R} done`),s.reload()}catch(T){J(T.message,!0)}finally{u(null)}},A=async _=>{if(confirm(`Remove documentation source "${_}" and its indexed pages?`))try{let E=await Ft("/api/docs",{name:_});J(`removed ${_} (${E.documents} document(s))`),r(null),s.reload()}catch(E){J(E.message,!0)}};return s.error?e(G,{error:s.error}):e(L,{children:[e("div",{class:"row",style:{marginBottom:12},children:[e("button",{type:"button",class:"primary",onClick:()=>d(_=>!_),children:l?"close":"+ Add source"}),e("button",{type:"button",disabled:!!c||!m?.sources.length,onClick:()=>S(void 0,!1),children:c==="sync all"?e(B,{}):"\u21BB Sync all"}),e("input",{type:"search",class:"grow",placeholder:"filter by name, provider, tag or url\u2026",value:a,onInput:_=>o(_.target.value)}),e("span",{class:"muted small nowrap",children:m?`${m.sources.length} sources \xB7 ${K(m.totals.documents)} docs \xB7 ${K(m.totals.chunks)} chunks \xB7 ${m.manifest}`:""})]}),m?.sources.length?e("div",{class:"row wrap",style:{marginBottom:10,gap:4},children:[e("button",{type:"button",class:M("chip",h==="all"&&"on"),onClick:()=>g("all"),children:["All \xB7 ",m.sources.length]}),dt.filter(_=>y.get(_.id)).map(_=>e("button",{type:"button",class:M("chip",h===_.id&&"on"),title:_.blurb,onClick:()=>g(h===_.id?"all":_.id),children:[_.label," \xB7 ",y.get(_.id)]}))]}):null,l&&e(ba,{onDone:_=>{n(_.text),s.reload();let E=[..._.added,..._.updated][0];E&&r(E)}}),m?.orphans.length?e("div",{class:"empty",style:{marginBottom:12},children:["indexed under docs: but missing from the manifest:"," ",m.orphans.map(_=>`${_.source} (${_.documents})`).join(", ")," \u2014 re-add them or purge the index."]}):null,e("div",{class:"grid wide",style:{gridTemplateColumns:"minmax(280px,1fr) minmax(0,2fr)",alignItems:"start"},children:[e("div",{class:"card flush",children:e("div",{class:"list",children:m?p.length?v.map(_=>e(L,{children:[v.length>1?e("div",{class:"group-h",children:_.label}):null,_.cats.map(({info:E,items:R})=>{let T=!f.has(E.id);return e(L,{children:[e("div",{class:M("cat-h",!T&&"closed"),title:E.blurb,onClick:()=>b(E.id),children:[e("span",{class:"caret",children:T?"\u25BE":"\u25B8"}),E.label,e("span",{class:"muted",children:[" \xB7 ",R.length]}),e("span",{class:"muted small right",children:[K(R.reduce(($,w)=>$+w.documents,0))," docs"]})]}),T?R.map($=>e(va,{s:$,sel:i===$.name,onSelect:()=>r($.name)})):null]})})]})):e(q,{children:m.sources.length?"no sources match":"No documentation sources yet. Use Discover, or add a url, path or provider."}):e(q,{children:e(B,{})})})}),e("div",{class:"card",children:k?e(fa,{s:k,busy:c,onSync:_=>S([k.name],_),onRemove:()=>A(k.name)}):e(q,{children:"Select a source to see its pages and sync state."})})]})]})}function ka({onLog:t,onAdded:n}){let[s,i]=C(!1),[r,a]=C(!1),o=H(()=>r?P("/api/docs/discover",{dev:s?1:void 0}):Promise.resolve(void 0),[r,s]),[l,d]=C(new Set),[c,u]=C({}),[h,g]=C(!1),f=o.data;O(()=>{if(!f)return;let b=new Set;for(let k of f.local)k.registered||b.add(`local:${k.name}`);for(let k of f.providers)!k.registered&&(k.confidence==="probe"||k.confidence==="catalog"&&k.tier!=="library"&&k.tier!=="infra")&&b.add(`prov:${k.name}`);d(b)},[f]);let x=b=>d(k=>{let S=new Set(k);return S.has(b)?S.delete(b):S.add(b),S}),m=async()=>{if(!f)return;let b=[];for(let k of f.local)l.has(`local:${k.name}`)&&b.push({name:k.name,path:k.path,glob:k.glob,title:k.why,tags:k.project?[k.project]:void 0});for(let k of f.providers){if(!l.has(`prov:${k.name}`))continue;let S=c[k.name]?.trim(),A=S?S.split(/\s+/).filter(Boolean):k.urls.length?k.urls:void 0;!A&&k.confidence==="unknown"||b.push({name:k.name,provider:k.provider,urls:A,title:k.title,crawl:k.crawl})}if(!b.length)return J("nothing selected",!0);g(!0),t(`adding ${b.length} source(s)\u2026`);try{let k=await be("/api/docs",{sources:b,sync:!0});t(k.text),J(`${k.added.length+k.updated.length} added${k.failed.length?`, ${k.failed.length} failed`:""}`,!!k.failed.length&&!k.added.length),n(),a(!1),setTimeout(()=>a(!0),0)}catch(k){J(k.message,!0)}finally{g(!1)}},p=b=>(f?.providers??[]).filter(k=>k.confidence===b),y=({keyId:b,title:k,meta:S,right:A,registered:_})=>e("tr",{class:M(_&&"muted"),children:[e("td",{style:{width:24},children:e("input",{type:"checkbox",disabled:_,checked:l.has(b),onChange:()=>x(b)})}),e("td",{class:"break",children:[k,_?e("span",{class:"tag",children:" registered"}):null]}),e("td",{class:"break muted small",children:S}),e("td",{children:A??null})]}),v=({conf:b,note:k})=>{let S=p(b);return S.length?e("div",{class:"card flush",style:{marginBottom:12},children:[e("h3",{style:{padding:"10px 12px 0"},children:[e("span",{class:"tag kind",style:{color:ga[b]},children:b})," ",b==="catalog"?"libraries, services and infrastructure":b==="probe"?"third-party APIs called from code":b==="registry"?"packages resolved through npm / PyPI / Go":"unknown env prefixes and images"," ",e("span",{class:"muted small",children:["\u2014 ",k]})]}),e("table",{children:e("tbody",{children:S.map(A=>e(y,{keyId:`prov:${A.name}`,registered:A.registered,title:e(L,{children:[e("b",{children:A.name})," ",e("span",{class:"muted small",children:["\u2190 ",A.provider]})]}),meta:e(L,{children:[A.title,A.usedBy.length>1?` \xB7 used by ${A.usedBy.length} projects`:A.usedBy[0]&&A.usedBy[0]!=="."?` \xB7 ${A.usedBy[0]}`:"",A.urls.length?e(L,{children:[" \xB7 ",e(Tr,{urls:A.urls.slice(0,2)})]}):b==="probe"||b==="unknown"?` \xB7 ${A.evidence[0]}`:""]}),right:b==="unknown"||b==="probe"?e("input",{type:"text",placeholder:b==="probe"?"docs url (optional; probed if empty)":"docs url",style:{minWidth:220},value:c[A.name]??"",onInput:_=>u({...c,[A.name]:_.target.value})}):void 0}))})})]}):null};return e(L,{children:[e("div",{class:"row",style:{marginBottom:12},children:[e("button",{type:"button",class:"primary",disabled:o.loading&&r,onClick:()=>r?o.reload():a(!0),children:o.loading&&r?e(B,{}):r?"\u21BB Scan again":"Scan project"}),e("label",{class:"small",children:[e("input",{type:"checkbox",checked:s,onChange:b=>i(b.target.checked)})," ","include devDependencies"]}),e("span",{class:"spacer"}),f?e(L,{children:[e("span",{class:"muted small",children:[f.projects.length>1?`${f.projects.length} projects \xB7 `:"",f.local.length," local \xB7 ",f.providers.length," providers \xB7 ",l.size," selected"]}),e("button",{type:"button",class:"primary",disabled:h||!l.size,onClick:m,children:h?e(B,{}):"Add selected & index"})]}):null]}),o.error?e(G,{error:o.error}):null,r?f?e(L,{children:[f.local.length?e("div",{class:"card flush",style:{marginBottom:12},children:[e("h3",{style:{padding:"10px 12px 0"},children:["local documentation ",e("span",{class:"muted small",children:"\u2014 indexed from the working tree"})]}),e("table",{children:e("tbody",{children:f.local.map(b=>e(y,{keyId:`local:${b.name}`,registered:b.registered,title:e(L,{children:[e("b",{children:b.name})," ",e("span",{class:"muted small",children:b.path})]}),meta:`${b.files} file(s) \xB7 ${K(b.bytes)} B \xB7 ${b.why}${b.glob&&b.glob.length<=4?` \xB7 ${b.glob.join(", ")}`:""}`}))})})]}):null,e(v,{conf:"catalog",note:"documentation URLs known offline"}),e(v,{conf:"probe",note:"docs., developer. and /docs locations are probed when added; give a url to skip the guess"}),e(v,{conf:"registry",note:"homepage and README come from the package registry when added"}),e(v,{conf:"unknown",note:"needs a documentation url"})]}):e(B,{}):e(q,{children:"Scans the project (and one level of sub-projects) for READMEs, docs folders, ADRs, API specs, agent instructions and env references, plus the npm / PyPI / Go packages, env var prefixes, container images, infrastructure files and outbound API calls \u2014 and maps each to its documentation. Nothing is fetched until you add."})]})}function xa({sources:t}){let[n,s]=C(""),[i,r]=C(""),[a,o]=C(""),l=H(()=>a?P("/api/search",{q:a,source:i?`docs:${i}`:"docs:*",limit:15}):Promise.resolve(void 0),[a,i]);return e(L,{children:[e("div",{class:"row",style:{marginBottom:12},children:[e("input",{type:"search",class:"grow",placeholder:"ask the documentation\u2026 (hybrid keyword + semantic)",value:n,onInput:d=>s(d.target.value),onKeyDown:d=>{d.key==="Enter"&&o(n.trim())}}),e("select",{value:i,onChange:d=>r(d.target.value),children:[e("option",{value:"",children:"all documentation"}),t.map(d=>e("option",{value:d,children:d}))]}),e("button",{type:"button",class:"primary",onClick:()=>o(n.trim()),children:"Search"})]}),l.error?e(G,{error:l.error}):null,a?l.data?l.data.hits.length?e("div",{class:"stack",children:[l.data.corrections.length?e("div",{class:"muted small",children:["corrected: ",l.data.corrections.map(d=>`${d.from}\u2192${d.to}`).join(", ")]}):null,l.data.hits.map(d=>e("div",{class:"card hit",children:[e("div",{class:"row tight",children:[e("b",{class:"break",children:d.uri?.startsWith("http")?e("a",{href:d.uri,target:"_blank",rel:"noreferrer",children:d.title}):d.title}),e("span",{class:"tag",children:d.source.replace(/^docs:/,"")}),e("span",{class:"muted small",children:["doc ",d.doc," \xB7 ",d.score.toFixed(3)]})]}),e("pre",{class:"json",style:{whiteSpace:"pre-wrap",fontFamily:"inherit",fontSize:13,marginTop:4},children:d.snippet})]}))]}):e(q,{children:"no matches"}):e(B,{}):e(q,{children:"Searches only the documentation sources (source docs:*). Claude uses the same index through em_docs lookup."})]})}function Er({params:t}){let[n,s]=C(t.tab??"sources"),[i,r]=C([]),[a,o]=C(0),l=H(()=>P("/api/docs"),[a]),d=c=>r(u=>[...u,`[${new Date().toLocaleTimeString()}]
|
|
6
|
-
${c}`]);return e("div",{class:"page",children:[e(Te,{tabs:[["sources","Sources"],["discover","Discover"],["search","Search"]],value:n,onChange:c=>{s(c),
|
|
1
|
+
"use strict";(()=>{var wi=Object.create;var nn=Object.defineProperty;var Si=Object.getOwnPropertyDescriptor;var Ti=Object.getOwnPropertyNames;var Ei=Object.getPrototypeOf,$i=Object.prototype.hasOwnProperty;var Kn=t=>{throw TypeError(t)};var Ai=(t,n,s)=>n in t?nn(t,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[n]=s;var Ci=(t,n)=>()=>(n||t((n={exports:{}}).exports,n),n.exports);var Ri=(t,n,s,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of Ti(n))!$i.call(t,r)&&r!==s&&nn(t,r,{get:()=>n[r],enumerable:!(i=Si(n,r))||i.enumerable});return t};var Fi=(t,n,s)=>(s=t!=null?wi(Ei(t)):{},Ri(n||!t||!t.__esModule?nn(s,"default",{value:t,enumerable:!0}):s,t));var V=(t,n,s)=>Ai(t,typeof n!="symbol"?n+"":n,s),Mi=(t,n,s)=>n.has(t)||Kn("Cannot "+s);var Yn=(t,n,s)=>n.has(t)?Kn("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(t):n.set(t,s);var Qn=(t,n,s)=>(Mi(t,n,"access private method"),s);var $r=Ci((gd,zt)=>{"use strict";var _a=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var N=(function(t){var n=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,s=0,i={},r={manual:t.Prism&&t.Prism.manual,disableWorkerMessageHandler:t.Prism&&t.Prism.disableWorkerMessageHandler,util:{encode:function m(p){return p instanceof a?new a(p.type,m(p.content),p.alias):Array.isArray(p)?p.map(m):p.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(m){return Object.prototype.toString.call(m).slice(8,-1)},objId:function(m){return m.__id||Object.defineProperty(m,"__id",{value:++s}),m.__id},clone:function m(p,v){v=v||{};var b,y;switch(r.util.type(p)){case"Object":if(y=r.util.objId(p),v[y])return v[y];b={},v[y]=b;for(var k in p)p.hasOwnProperty(k)&&(b[k]=m(p[k],v));return b;case"Array":return y=r.util.objId(p),v[y]?v[y]:(b=[],v[y]=b,p.forEach(function(S,$){b[$]=m(S,v)}),b);default:return p}},getLanguage:function(m){for(;m;){var p=n.exec(m.className);if(p)return p[1].toLowerCase();m=m.parentElement}return"none"},setLanguage:function(m,p){m.className=m.className.replace(RegExp(n,"gi"),""),m.classList.add("language-"+p)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(b){var m=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(b.stack)||[])[1];if(m){var p=document.getElementsByTagName("script");for(var v in p)if(p[v].src==m)return p[v]}return null}},isActive:function(m,p,v){for(var b="no-"+p;m;){var y=m.classList;if(y.contains(p))return!0;if(y.contains(b))return!1;m=m.parentElement}return!!v}},languages:{plain:i,plaintext:i,text:i,txt:i,extend:function(m,p){var v=r.util.clone(r.languages[m]);for(var b in p)v[b]=p[b];return v},insertBefore:function(m,p,v,b){b=b||r.languages;var y=b[m],k={};for(var S in y)if(y.hasOwnProperty(S)){if(S==p)for(var $ in v)v.hasOwnProperty($)&&(k[$]=v[$]);v.hasOwnProperty(S)||(k[S]=y[S])}var _=b[m];return b[m]=k,r.languages.DFS(r.languages,function(E,R){R===_&&E!=m&&(this[E]=k)}),k},DFS:function m(p,v,b,y){y=y||{};var k=r.util.objId;for(var S in p)if(p.hasOwnProperty(S)){v.call(p,S,p[S],b||S);var $=p[S],_=r.util.type($);_==="Object"&&!y[k($)]?(y[k($)]=!0,m($,v,null,y)):_==="Array"&&!y[k($)]&&(y[k($)]=!0,m($,v,S,y))}}},plugins:{},highlightAll:function(m,p){r.highlightAllUnder(document,m,p)},highlightAllUnder:function(m,p,v){var b={callback:v,container:m,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",b),b.elements=Array.prototype.slice.apply(b.container.querySelectorAll(b.selector)),r.hooks.run("before-all-elements-highlight",b);for(var y=0,k;k=b.elements[y++];)r.highlightElement(k,p===!0,b.callback)},highlightElement:function(m,p,v){var b=r.util.getLanguage(m),y=r.languages[b];r.util.setLanguage(m,b);var k=m.parentElement;k&&k.nodeName.toLowerCase()==="pre"&&r.util.setLanguage(k,b);var S=m.textContent,$={element:m,language:b,grammar:y,code:S};function _(R){$.highlightedCode=R,r.hooks.run("before-insert",$),$.element.innerHTML=$.highlightedCode,r.hooks.run("after-highlight",$),r.hooks.run("complete",$),v&&v.call($.element)}if(r.hooks.run("before-sanity-check",$),k=$.element.parentElement,k&&k.nodeName.toLowerCase()==="pre"&&!k.hasAttribute("tabindex")&&k.setAttribute("tabindex","0"),!$.code){r.hooks.run("complete",$),v&&v.call($.element);return}if(r.hooks.run("before-highlight",$),!$.grammar){_(r.util.encode($.code));return}if(p&&t.Worker){var E=new Worker(r.filename);E.onmessage=function(R){_(R.data)},E.postMessage(JSON.stringify({language:$.language,code:$.code,immediateClose:!0}))}else _(r.highlight($.code,$.grammar,$.language))},highlight:function(m,p,v){var b={code:m,grammar:p,language:v};if(r.hooks.run("before-tokenize",b),!b.grammar)throw new Error('The language "'+b.language+'" has no grammar.');return b.tokens=r.tokenize(b.code,b.grammar),r.hooks.run("after-tokenize",b),a.stringify(r.util.encode(b.tokens),b.language)},tokenize:function(m,p){var v=p.rest;if(v){for(var b in v)p[b]=v[b];delete p.rest}var y=new d;return c(y,y.head,m),l(m,y,p,y.head,0),h(y)},hooks:{all:{},add:function(m,p){var v=r.hooks.all;v[m]=v[m]||[],v[m].push(p)},run:function(m,p){var v=r.hooks.all[m];if(!(!v||!v.length))for(var b=0,y;y=v[b++];)y(p)}},Token:a};t.Prism=r;function a(m,p,v,b){this.type=m,this.content=p,this.alias=v,this.length=(b||"").length|0}a.stringify=function m(p,v){if(typeof p=="string")return p;if(Array.isArray(p)){var b="";return p.forEach(function(_){b+=m(_,v)}),b}var y={type:p.type,content:m(p.content,v),tag:"span",classes:["token",p.type],attributes:{},language:v},k=p.alias;k&&(Array.isArray(k)?Array.prototype.push.apply(y.classes,k):y.classes.push(k)),r.hooks.run("wrap",y);var S="";for(var $ in y.attributes)S+=" "+$+'="'+(y.attributes[$]||"").replace(/"/g,""")+'"';return"<"+y.tag+' class="'+y.classes.join(" ")+'"'+S+">"+y.content+"</"+y.tag+">"};function o(m,p,v,b){m.lastIndex=p;var y=m.exec(v);if(y&&b&&y[1]){var k=y[1].length;y.index+=k,y[0]=y[0].slice(k)}return y}function l(m,p,v,b,y,k){for(var S in v)if(!(!v.hasOwnProperty(S)||!v[S])){var $=v[S];$=Array.isArray($)?$:[$];for(var _=0;_<$.length;++_){if(k&&k.cause==S+","+_)return;var E=$[_],R=E.inside,T=!!E.lookbehind,C=!!E.greedy,w=E.alias;if(C&&!E.pattern.global){var F=E.pattern.toString().match(/[imsuy]*$/)[0];E.pattern=RegExp(E.pattern.source,F+"g")}for(var W=E.pattern||E,X=b.next,D=y;X!==p.tail&&!(k&&D>=k.reach);D+=X.value.length,X=X.next){var ee=X.value;if(p.length>m.length)return;if(!(ee instanceof a)){var ue=1,pe;if(C){if(pe=o(W,D,m,T),!pe||pe.index>=m.length)break;var Ue=pe.index,ve=pe.index+pe[0].length,ie=D;for(ie+=X.value.length;Ue>=ie;)X=X.next,ie+=X.value.length;if(ie-=X.value.length,D=ie,X.value instanceof a)continue;for(var fe=X;fe!==p.tail&&(ie<ve||typeof fe.value=="string");fe=fe.next)ue++,ie+=fe.value.length;ue--,ee=m.slice(D,ie),pe.index-=D}else if(pe=o(W,0,ee,T),!pe)continue;var Ue=pe.index,H=pe[0],de=ee.slice(0,Ue),oe=ee.slice(Ue+H.length),Ce=D+ee.length;k&&Ce>k.reach&&(k.reach=Ce);var Se=X.prev;de&&(Se=c(p,Se,de),D+=de.length),u(p,Se,ue);var Qt=new a(S,R?r.tokenize(H,R):H,w,H);if(X=c(p,Se,Qt),oe&&c(p,X,oe),ue>1){var Xe={cause:S+","+_,reach:Ce};l(m,p,v,X.prev,D,Xe),k&&Xe.reach>k.reach&&(k.reach=Xe.reach)}}}}}}function d(){var m={value:null,prev:null,next:null},p={value:null,prev:m,next:null};m.next=p,this.head=m,this.tail=p,this.length=0}function c(m,p,v){var b=p.next,y={value:v,prev:p,next:b};return p.next=y,b.prev=y,m.length++,y}function u(m,p,v){for(var b=p.next,y=0;y<v&&b!==m.tail;y++)b=b.next;p.next=b,b.prev=p,m.length-=y}function h(m){for(var p=[],v=m.head.next;v!==m.tail;)p.push(v.value),v=v.next;return p}if(!t.document)return t.addEventListener&&(r.disableWorkerMessageHandler||t.addEventListener("message",function(m){var p=JSON.parse(m.data),v=p.language,b=p.code,y=p.immediateClose;t.postMessage(r.highlight(b,r.languages[v],v)),y&&t.close()},!1)),r;var g=r.util.currentScript();g&&(r.filename=g.src,g.hasAttribute("data-manual")&&(r.manual=!0));function f(){r.manual||r.highlightAll()}if(!r.manual){var x=document.readyState;x==="loading"||x==="interactive"&&g&&g.defer?document.addEventListener("DOMContentLoaded",f):window.requestAnimationFrame?window.requestAnimationFrame(f):window.setTimeout(f,16)}return r})(_a);typeof zt<"u"&&zt.exports&&(zt.exports=N);typeof global<"u"&&(global.Prism=N);N.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]};N.languages.markup.tag.inside["attr-value"].inside.entity=N.languages.markup.entity;N.languages.markup.doctype.inside["internal-subset"].inside=N.languages.markup;N.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.replace(/&/,"&"))});Object.defineProperty(N.languages.markup.tag,"addInlined",{value:function(n,s){var i={};i["language-"+s]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:N.languages[s]},i.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:i}};r["language-"+s]={pattern:/[\s\S]+/,inside:N.languages[s]};var a={};a[n]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return n}),"i"),lookbehind:!0,greedy:!0,inside:r},N.languages.insertBefore("markup","cdata",a)}});Object.defineProperty(N.languages.markup.tag,"addAttribute",{value:function(t,n){N.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,"language-"+n],inside:N.languages[n]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}});N.languages.html=N.languages.markup;N.languages.mathml=N.languages.markup;N.languages.svg=N.languages.markup;N.languages.xml=N.languages.extend("markup",{});N.languages.ssml=N.languages.xml;N.languages.atom=N.languages.xml;N.languages.rss=N.languages.xml;(function(t){var n=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+n.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+n.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+n.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+n.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:n,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var s=t.languages.markup;s&&(s.tag.addInlined("style","css"),s.tag.addAttribute("style","css"))})(N);N.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};N.languages.javascript=N.languages.extend("clike",{"class-name":[N.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});N.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;N.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:N.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:N.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:N.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:N.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:N.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});N.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:N.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});N.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});N.languages.markup&&(N.languages.markup.tag.addInlined("script","javascript"),N.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));N.languages.js=N.languages.javascript;(function(){if(typeof N>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var t="Loading\u2026",n=function(g,f){return"\u2716 Error "+g+" while fetching file: "+f},s="\u2716 Error: File does not exist or is empty",i={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},r="data-src-status",a="loading",o="loaded",l="failed",d="pre[data-src]:not(["+r+'="'+o+'"]):not(['+r+'="'+a+'"])';function c(g,f,x){var m=new XMLHttpRequest;m.open("GET",g,!0),m.onreadystatechange=function(){m.readyState==4&&(m.status<400&&m.responseText?f(m.responseText):m.status>=400?x(n(m.status,m.statusText)):x(s))},m.send(null)}function u(g){var f=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(g||"");if(f){var x=Number(f[1]),m=f[2],p=f[3];return m?p?[x,Number(p)]:[x,void 0]:[x,x]}}N.hooks.add("before-highlightall",function(g){g.selector+=", "+d}),N.hooks.add("before-sanity-check",function(g){var f=g.element;if(f.matches(d)){g.code="",f.setAttribute(r,a);var x=f.appendChild(document.createElement("CODE"));x.textContent=t;var m=f.getAttribute("data-src"),p=g.language;if(p==="none"){var v=(/\.(\w+)$/.exec(m)||[,"none"])[1];p=i[v]||v}N.util.setLanguage(x,p),N.util.setLanguage(f,p);var b=N.plugins.autoloader;b&&b.loadLanguages(p),c(m,function(y){f.setAttribute(r,o);var k=u(f.getAttribute("data-range"));if(k){var S=y.split(/\r\n?|\n/g),$=k[0],_=k[1]==null?S.length:k[1];$<0&&($+=S.length),$=Math.max(0,Math.min($-1,S.length)),_<0&&(_+=S.length),_=Math.max(0,Math.min(_,S.length)),y=S.slice($,_).join(`
|
|
2
|
+
`),f.hasAttribute("data-start")||f.setAttribute("data-start",String($+1))}x.textContent=y,N.highlightElement(x)},function(y){f.setAttribute(r,l),x.textContent=y})}}),N.plugins.fileHighlight={highlight:function(f){for(var x=(f||document).querySelectorAll(d),m=0,p;p=x[m++];)N.highlightElement(p)}};var h=!1;N.fileHighlight=function(){h||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),h=!0),N.plugins.fileHighlight.highlight.apply(this,arguments)}})()});var Tt,Z,rs,Li,Fe,es,is,as,sn,vt,rt,os,on,rn,an,Ii,_t={},wt=[],Di=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Et=Array.isArray;function $e(t,n){for(var s in n)t[s]=n[s];return t}function ln(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function $t(t,n,s){var i,r,a,o={};for(a in n)a=="key"?i=n[a]:a=="ref"?r=n[a]:o[a]=n[a];if(arguments.length>2&&(o.children=arguments.length>3?Tt.call(arguments,2):s),typeof t=="function"&&t.defaultProps!=null)for(a in t.defaultProps)o[a]===void 0&&(o[a]=t.defaultProps[a]);return kt(t,o,i,r,null)}function kt(t,n,s,i,r){var a={type:t,props:n,key:s,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++rs,__i:-1,__u:0};return r==null&&Z.vnode!=null&&Z.vnode(a),a}function L(t){return t.children}function xt(t,n){this.props=t,this.context=n}function De(t,n){if(n==null)return t.__?De(t.__,t.__i+1):null;for(var s;n<t.__k.length;n++)if((s=t.__k[n])!=null&&s.__e!=null)return s.__e;return typeof t.type=="function"?De(t):null}function Ni(t){if(t.__P&&t.__d){var n=t.__v,s=n.__e,i=[],r=[],a=$e({},n);a.__v=n.__v+1,Z.vnode&&Z.vnode(a),cn(t.__P,a,n,t.__n,t.__P.namespaceURI,32&n.__u?[s]:null,i,s??De(n),!!(32&n.__u),r),a.__v=n.__v,a.__.__k[a.__i]=a,ps(i,a,r),n.__e=n.__=null,a.__e!=s&&ls(a)}}function ls(t){if((t=t.__)!=null&&t.__c!=null)return t.__e=t.__c.base=null,t.__k.some(function(n){if(n!=null&&n.__e!=null)return t.__e=t.__c.base=n.__e}),ls(t)}function ts(t){(!t.__d&&(t.__d=!0)&&Fe.push(t)&&!St.__r++||es!=Z.debounceRendering)&&((es=Z.debounceRendering)||is)(St)}function St(){try{for(var t,n=1;Fe.length;)Fe.length>n&&Fe.sort(as),t=Fe.shift(),n=Fe.length,Ni(t)}finally{Fe.length=St.__r=0}}function cs(t,n,s,i,r,a,o,l,d,c,u){var h,g,f,x,m,p,v=i&&i.__k||wt,b=n.length;for(d=Pi(s,n,v,d,b),h=0;h<b;h++)(f=s.__k[h])!=null&&(g=f.__i!=-1&&v[f.__i]||_t,f.__i=h,p=cn(t,f,g,r,a,o,l,d,c,u),x=f.__e,f.ref&&g.ref!=f.ref&&(g.ref&&dn(g.ref,null,f),u.push(f.ref,f.__c||x,f)),m==null&&x!=null&&(m=x),4&f.__u?(d=ds(f,d,t),g.__e&&(g.__e=null)):typeof f.type=="function"&&p!==void 0?d=p:x&&(d=x.nextSibling),f.__u&=-7);return s.__e=m,d}function Pi(t,n,s,i,r){var a,o,l,d,c,u=s.length,h=u,g=0;for(t.__k=new Array(r),a=0;a<r;a++)(o=n[a])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=t.__k[a]=kt(null,o,null,null,null):Et(o)?o=t.__k[a]=kt(L,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=t.__k[a]=kt(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):t.__k[a]=o,d=a+g,o.__=t,o.__b=t.__b+1,l=null,(c=o.__i=Bi(o,s,d,h))!=-1&&(h--,(l=s[c])&&(l.__u|=2)),l==null||l.__v==null?(c==-1&&(r>u?g--:r<u&&g++),typeof o.type!="function"&&(o.__u|=4)):c!=d&&(c==d-1?g--:c==d+1?g++:(c>d?g--:g++,o.__u|=4))):t.__k[a]=null;if(h)for(a=0;a<u;a++)(l=s[a])!=null&&(2&l.__u)==0&&(l.__e==i&&(i=De(l)),ms(l,l));return i}function ds(t,n,s){var i,r;if(typeof t.type=="function"){for(i=t.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=t,n=ds(i[r],n,s));return n}t.__e!=n&&(n&&t.type&&!n.parentNode&&(n=De(t)),n=s.insertBefore(t.__e,n||null));do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function Bi(t,n,s,i){var r,a,o,l=t.key,d=t.type,c=n[s],u=c!=null&&(2&c.__u)==0;if(c===null&&l==null||u&&l==c.key&&d==c.type)return s;if(i>(u?1:0)){for(r=s-1,a=s+1;r>=0||a<n.length;)if((c=n[o=r>=0?r--:a++])!=null&&(2&c.__u)==0&&l==c.key&&d==c.type)return o}return-1}function ns(t,n,s){n[0]=="-"?t.setProperty(n,s??""):t[n]=s==null?"":typeof s!="number"||Di.test(n)?s:s+"px"}function yt(t,n,s,i,r){var a,o;e:if(n=="style")if(typeof s=="string")t.style.cssText=s;else{if(typeof i=="string"&&(t.style.cssText=i=""),i)for(n in i)s&&n in s||ns(t.style,n,"");if(s)for(n in s)i&&s[n]==i[n]||ns(t.style,n,s[n])}else if(n[0]=="o"&&n[1]=="n")a=n!=(n=n.replace(os,"$1")),o=n.toLowerCase(),n=o in t||n=="onFocusOut"||n=="onFocusIn"?o.slice(2):n.slice(2),t.l||(t.l={}),t.l[n+a]=s,s?i?s[rt]=i[rt]:(s[rt]=on,t.addEventListener(n,a?an:rn,a)):t.removeEventListener(n,a?an:rn,a);else{if(r=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in t)try{t[n]=s??"";break e}catch{}typeof s=="function"||(s==null||s===!1&&n[4]!="-"?t.removeAttribute(n):t.setAttribute(n,n=="popover"&&s==1?"":s))}}function ss(t){return function(n){if(this.l){var s=this.l[n.type+t];if(n[vt]==null)n[vt]=on++;else if(n[vt]<s[rt])return;return s(Z.event?Z.event(n):n)}}}function cn(t,n,s,i,r,a,o,l,d,c){var u,h,g,f,x,m,p,v,b,y,k,S,$,_,E,R,T=n.type;if(n.constructor!==void 0)return null;128&s.__u&&(d=!!(32&s.__u),a=[l=n.__e=s.__e]),(u=Z.__b)&&u(n);e:if(typeof T=="function"){h=o.length;try{if(b=n.props,y=T.prototype&&T.prototype.render,k=(u=T.contextType)&&i[u.__c],S=u?k?k.props.value:u.__:i,s.__c?v=(g=n.__c=s.__c).__=g.__E:(y?n.__c=g=new T(b,S):(n.__c=g=new xt(b,S),g.constructor=T,g.render=Hi),k&&k.sub(g),g.state||(g.state={}),g.__n=i,f=g.__d=!0,g.__h=[],g._sb=[]),y&&g.__s==null&&(g.__s=g.state),y&&T.getDerivedStateFromProps!=null&&(g.__s==g.state&&(g.__s=$e({},g.__s)),$e(g.__s,T.getDerivedStateFromProps(b,g.__s))),x=g.props,m=g.state,g.__v=n,f)y&&T.getDerivedStateFromProps==null&&g.componentWillMount!=null&&g.componentWillMount(),y&&g.componentDidMount!=null&&g.__h.push(g.componentDidMount);else{if(y&&T.getDerivedStateFromProps==null&&b!==x&&g.componentWillReceiveProps!=null&&g.componentWillReceiveProps(b,S),n.__v==s.__v||!g.__e&&g.shouldComponentUpdate!=null&&g.shouldComponentUpdate(b,g.__s,S)===!1){n.__v!=s.__v&&(g.props=b,g.state=g.__s,g.__d=!1),n.__e=s.__e,n.__k=s.__k,n.__k.some(function(C){C&&(C.__=n)}),wt.push.apply(g.__h,g._sb),g._sb=[],g.__h.length&&o.push(g),l=De(s);break e}g.componentWillUpdate!=null&&g.componentWillUpdate(b,g.__s,S),y&&g.componentDidUpdate!=null&&g.__h.push(function(){g.componentDidUpdate(x,m,p)})}if(g.context=S,g.props=b,g.__P=t,g.__e=!1,$=Z.__r,_=0,y)g.state=g.__s,g.__d=!1,$&&$(n),u=g.render(g.props,g.state,g.context),wt.push.apply(g.__h,g._sb),g._sb=[];else do g.__d=!1,$&&$(n),u=g.render(g.props,g.state,g.context),g.state=g.__s;while(g.__d&&++_<25);g.state=g.__s,g.getChildContext!=null&&(i=$e($e({},i),g.getChildContext())),y&&!f&&g.getSnapshotBeforeUpdate!=null&&(p=g.getSnapshotBeforeUpdate(x,m)),E=u!=null&&u.type===L&&u.key==null?hs(u.props.children):u,l=cs(t,Et(E)?E:[E],n,s,i,r,a,o,l,d,c),g.base=n.__e,n.__u&=-161,g.__h.length&&o.push(g),v&&(g.__E=g.__=null)}catch(C){if(o.length=h,n.__v=null,d||a!=null){if(C.then){for(n.__u|=d?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;a!=null&&(a[a.indexOf(l)]=null),n.__e=l}else if(a!=null)for(R=a.length;R--;)ln(a[R])}else n.__e=s.__e;n.__k==null&&(n.__k=s.__k||[]),C.then||us(n),Z.__e(C,n,s)}}else a==null&&n.__v==s.__v?(n.__k=s.__k,n.__e=s.__e):l=n.__e=zi(s.__e,n,s,i,r,a,o,d,c);return(u=Z.diffed)&&u(n),128&n.__u?void 0:l}function us(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(us))}function ps(t,n,s){for(var i=0;i<s.length;i++)dn(s[i],s[++i],s[++i]);Z.__c&&Z.__c(n,t),t.some(function(r){try{t=r.__h,r.__h=[],t.some(function(a){a.call(r)})}catch(a){Z.__e(a,r.__v)}})}function hs(t){return typeof t!="object"||t==null||t.__b>0?t:Et(t)?t.map(hs):t.constructor!==void 0?null:$e({},t)}function zi(t,n,s,i,r,a,o,l,d){var c,u,h,g,f,x,m,p=s.props||_t,v=n.props,b=n.type;if(b=="svg"?r="http://www.w3.org/2000/svg":b=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),a!=null){for(c=0;c<a.length;c++)if((f=a[c])&&"setAttribute"in f==!!b&&(b?f.localName==b:f.nodeType==3)){t=f,a[c]=null;break}}if(t==null){if(b==null)return document.createTextNode(v);t=document.createElementNS(r,b,v.is&&v),l&&(Z.__m&&Z.__m(n,a),l=!1),a=null}if(b==null)p===v||l&&t.data==v||(t.data=v);else{if(a=b=="textarea"&&v.defaultValue!=null?null:a&&Tt.call(t.childNodes),!l&&a!=null)for(p={},c=0;c<t.attributes.length;c++)p[(f=t.attributes[c]).name]=f.value;for(c in p)f=p[c],c=="dangerouslySetInnerHTML"?h=f:c=="children"||c in v||c=="value"&&"defaultValue"in v||c=="checked"&&"defaultChecked"in v||yt(t,c,null,f,r);for(c in v)f=v[c],c=="children"?g=f:c=="dangerouslySetInnerHTML"?u=f:c=="value"?x=f:c=="checked"?m=f:l&&typeof f!="function"||p[c]===f||yt(t,c,f,p[c],r);if(u)l||h&&(u.__html==h.__html||u.__html==t.innerHTML)||(t.innerHTML=u.__html),n.__k=[];else if(h&&(t.innerHTML=""),cs(n.type=="template"?t.content:t,Et(g)?g:[g],n,s,i,b=="foreignObject"?"http://www.w3.org/1999/xhtml":r,a,o,a?a[0]:s.__k&&De(s,0),l,d),a!=null)for(c=a.length;c--;)ln(a[c]);l&&b!="textarea"||(c="value",b=="progress"&&x==null?t.removeAttribute("value"):x!=null&&(x!==t[c]||b=="progress"&&!x||b=="option"&&x!=p[c])&&yt(t,c,x,p[c],r),c="checked",m!=null&&m!=t[c]&&yt(t,c,m,p[c],r))}return t}function dn(t,n,s){try{if(typeof t=="function"){var i=typeof t.__u=="function";i&&t.__u(),i&&n==null||(t.__u=t(n))}else t.current=n}catch(r){Z.__e(r,s)}}function ms(t,n,s){var i,r;if(Z.unmount&&Z.unmount(t),(i=t.ref)&&(i.current&&i.current!=t.__e||dn(i,null,n)),(i=t.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(a){Z.__e(a,n)}i.base=i.__P=i.__n=null}if(i=t.__k)for(r=0;r<i.length;r++)i[r]&&ms(i[r],n,s||typeof t.type!="function");s||ln(t.__e),t.__c=t.__=t.__e=void 0}function Hi(t,n,s){return this.constructor(t,s)}function gs(t,n,s){var i,r,a,o;n==document&&(n=document.documentElement),Z.__&&Z.__(t,n),r=(i=typeof s=="function")?null:s&&s.__k||n.__k,a=[],o=[],cn(n,t=(!i&&s||n).__k=$t(L,null,[t]),r||_t,_t,n.namespaceURI,!i&&s?[s]:r?null:n.firstChild?Tt.call(n.childNodes):null,a,!i&&s?s:r?r.__e:n.firstChild,i,o),ps(a,t,o),t.props.children=null}Tt=wt.slice,Z={__e:function(t,n,s,i){for(var r,a,o;n=n.__;)if((r=n.__c)&&!r.__)try{if((a=r.constructor)&&a.getDerivedStateFromError!=null&&(r.setState(a.getDerivedStateFromError(t)),o=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(t,i||{}),o=r.__d),o)return r.__E=r}catch(l){t=l}throw t}},rs=0,Li=function(t){return t!=null&&t.constructor===void 0},xt.prototype.setState=function(t,n){var s;s=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=$e({},this.state),typeof t=="function"&&(t=t($e({},s),this.props)),t&&$e(s,t),t!=null&&this.__v&&(n&&this._sb.push(n),ts(this))},xt.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),ts(this))},xt.prototype.render=L,Fe=[],is=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,as=function(t,n){return t.__v.__b-n.__v.__b},St.__r=0,sn=Math.random().toString(8),vt="__d"+sn,rt="__a"+sn,os=/(PointerCapture)$|Capture$/i,on=0,rn=ss(!1),an=ss(!0),Ii=0;var qe,te,un,fs,Ge=0,Ss=[],se=Z,bs=se.__b,ys=se.__r,vs=se.diffed,ks=se.__c,xs=se.unmount,_s=se.__;function Ct(t,n){se.__h&&se.__h(te,t,Ge||n),Ge=0;var s=te.__H||(te.__H={__:[],__h:[]});return t>=s.__.length&&s.__.push({}),s.__[t]}function A(t){return Ge=1,ji($s,t)}function ji(t,n,s){var i=Ct(qe++,2);if(i.t=t,!i.__c&&(i.__=[s?s(n):$s(void 0,n),function(l){var d=i.__N?i.__N[0]:i.__[0],c=i.t(d,l);d!==c&&(i.__N=[c,i.__[1]],i.__c.setState({}))}],i.__c=te,!te.__f)){var r=function(l,d,c){if(!i.__c.__H)return!0;var u=!1,h=i.__c.props!==l;if(i.__c.__H.__.some(function(f){if(f.__N){u=!0;var x=f.__[0];f.__=f.__N,f.__N=void 0,x!==f.__[0]&&(h=!0)}}),a){var g=a.call(this,l,d,c);return u?g||h:g}return!u||h};te.__f=!0;var a=te.shouldComponentUpdate,o=te.componentWillUpdate;te.componentWillUpdate=function(l,d,c){if(this.__e){var u=a;a=void 0,r(l,d,c),a=u}o&&o.call(this,l,d,c)},te.shouldComponentUpdate=r}return i.__N||i.__}function O(t,n){var s=Ct(qe++,3);!se.__s&&hn(s.__H,n)&&(s.__=t,s.u=n,te.__H.__h.push(s))}function Oi(t,n){var s=Ct(qe++,4);!se.__s&&hn(s.__H,n)&&(s.__=t,s.u=n,te.__h.push(s))}function re(t){return Ge=5,Y(function(){return{current:t}},[])}function Ts(t,n,s){Ge=6,Oi(function(){if(typeof t=="function"){var i=t(n());return function(){t(null),i&&typeof i=="function"&&i()}}if(t)return t.current=n(),function(){return t.current=null}},s==null?s:s.concat(t))}function Y(t,n){var s=Ct(qe++,7);return hn(s.__H,n)&&(s.__=t(),s.__H=n,s.__h=t),s.__}function Es(t,n){return Ge=8,Y(function(){return t},n)}function Ui(){for(var t;t=Ss.shift();){var n=t.__H;if(t.__P&&n)try{n.__h.some(At),n.__h.some(pn),n.__h=[]}catch(s){n.__h=[],se.__e(s,t.__v)}}}se.__b=function(t){te=null,bs&&bs(t)},se.__=function(t,n){t&&n.__k&&n.__k.__m&&(t.__m=n.__k.__m),_s&&_s(t,n)},se.__r=function(t){ys&&ys(t),qe=0;var n=(te=t.__c).__H;n&&(un===te?(n.__h=[],te.__h=[],n.__.some(function(s){s.__N&&(s.__=s.__N),s.u=s.__N=void 0})):(n.__h.some(At),n.__h.some(pn),n.__h=[],qe=0)),un=te},se.diffed=function(t){vs&&vs(t);var n=t.__c;n&&n.__H&&(n.__H.__h.length&&(Ss.push(n)!==1&&fs===se.requestAnimationFrame||((fs=se.requestAnimationFrame)||Xi)(Ui)),n.__H.__.some(function(s){s.u&&(s.__H=s.u,s.u=void 0)})),un=te=null},se.__c=function(t,n){n.some(function(s){try{s.__h.some(At),s.__h=s.__h.filter(function(i){return!i.__||pn(i)})}catch(i){n.some(function(r){r.__h&&(r.__h=[])}),n=[],se.__e(i,s.__v)}}),ks&&ks(t,n)},se.unmount=function(t){xs&&xs(t);var n,s=t.__c;s&&s.__H&&(s.__H.__.some(function(i){try{At(i)}catch(r){n=r}}),s.__H=void 0,n&&se.__e(n,s.__v))};var ws=typeof requestAnimationFrame=="function";function Xi(t){var n,s=function(){clearTimeout(i),ws&&cancelAnimationFrame(n),setTimeout(t)},i=setTimeout(s,35);ws&&(n=requestAnimationFrame(s))}function At(t){var n=te,s=t.__c;typeof s=="function"&&(t.__c=void 0,s()),te=n}function pn(t){var n=te;t.__c=t.__(),te=n}function hn(t,n){return!t||t.length!==n.length||n.some(function(s,i){return s!==t[i]})}function $s(t,n){return typeof n=="function"?n(t):n}var Rt=new URLSearchParams(location.search).get("root")??"",mn=()=>Rt;function As(t){Rt=t;let n=new URL(location.href);n.searchParams.set("root",t),history.replaceState(null,"",n.toString())}function qi(t,n){let s=new URL(t,location.origin);Rt&&s.searchParams.set("root",Rt);for(let[i,r]of Object.entries(n??{}))r==null||r===""||s.searchParams.set(i,String(r));return s.toString()}var it=class extends Error{constructor(s,i){super(s);V(this,"status",i)}};async function P(t,n,s){let i=await fetch(qi(t,n),s),r=await i.json().catch(()=>({error:"bad response"}));if(i.status===404&&r.error==="not found"&&t.startsWith("/api/"))throw new it(`${t} is not available on the running server; restart \`eminiar ui\` to pick up the rebuilt bundle`,i.status);if(!i.ok)throw new it(r.error??`HTTP ${i.status}`,i.status);if(r&&typeof r=="object"&&"error"in r&&r.error)throw new it(String(r.error),i.status);return r}function be(t,n,s="POST",i){return P(t,i,{method:s,headers:{"content-type":"application/json"},body:JSON.stringify(n)})}function Ft(t,n){return P(t,n,{method:"DELETE",headers:{"content-type":"application/json"}})}var K=t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(Math.round(t));function ne(t){if(!t)return"";let n=Date.now()-t;return n<6e4?"just now":n<36e5?`${Math.round(n/6e4)}m ago`:n<864e5?`${Math.round(n/36e5)}h ago`:`${Math.round(n/864e5)}d ago`}var he=t=>t?new Date(t).toISOString().slice(0,10):"",Cs=t=>t?new Date(t).toLocaleTimeString():"",Mt=t=>t.split("/").pop()??t;var Gi={file:"#2563eb",function:"#16a34a",method:"#0d9488",class:"#d97706",interface:"#7c3aed",type:"#8b5cf6",enum:"#a855f7",field:"#64748b",variable:"#64748b",route:"#e11d48",package:"#6b7280",memory:"#db2777",person:"#f59e0b",concept:"#0ea5e9",cluster:"#2563eb"},We=t=>Gi[t]??"#94a3b8",Wi={imports:"#2563eb",reexports:"#3b82f6",calls:"#16a34a",references:"#0ea5e9",extends:"#7c3aed",implements:"#8b5cf6",handles:"#e11d48",defines:"#9ca3af",exports:"#9ca3af",co_changes:"#f59e0b",mentions:"#db2777",supersedes:"#db2777",authored:"#d97706",link:"#2563eb"},Lt=t=>Wi[t]??"#94a3b8",Rs=new Set(["imports","reexports","calls","references","extends","implements","handles","mentions","supersedes"]),Fs=["imports","calls","references","extends","implements","handles","reexports","co_changes","mentions","defines"],M=(...t)=>t.filter(Boolean).join(" ");function Ms(t,n){let s;return(...i)=>{clearTimeout(s),s=setTimeout(()=>t(...i),n)}}var Je=t=>`${Math.round((t??0)*100)}%`;function Ls(t){let n=t.slice(t.lastIndexOf(".")+1).toLowerCase();return{ts:"typescript",mts:"typescript",cts:"typescript",tsx:"tsx",js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"jsx",py:"python",go:"go",php:"php",json:"json",md:"markdown",sh:"bash"}[n]??"plain"}var Ji=0;function e(t,n,s,i,r,a){n||(n={});var o,l,d=n;if("ref"in d)for(l in d={},n)l=="ref"?o=n[l]:d[l]=n[l];var c={type:t,props:d,key:s,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ji,__i:-1,__u:0,__source:r,__self:a};if(typeof t=="function"&&(o=t.defaultProps))for(l in o)d[l]===void 0&&(d[l]=o[l]);return Z.vnode&&Z.vnode(c),c}var gn=new Set;function J(t,n=!1){for(let s of gn)s(t,n)}function Is(){let[t,n]=A(null);return O(()=>{let s,i=(r,a)=>{n({msg:r,bad:a}),clearTimeout(s),s=setTimeout(()=>n(null),a?6e3:2500)};return gn.add(i),()=>{gn.delete(i),clearTimeout(s)}},[]),t?e("div",{class:M("toast",t.bad&&"bad"),children:t.msg}):null}function z(t,n){let[s,i]=A({data:void 0,error:void 0,loading:!0}),[r,a]=A(0),o=re(0);O(()=>{let d=++o.current;i(c=>({...c,loading:!0,error:void 0})),t().then(c=>d===o.current&&i({data:c,error:void 0,loading:!1}),c=>d===o.current&&i(u=>({...u,error:c.message,loading:!1})))},[...n,r]);let l=Es(()=>a(d=>d+1),[]);return{...s,reload:l}}var B=()=>e("span",{class:"spin"}),G=({children:t})=>e("div",{class:"empty",children:t}),q=({error:t})=>e("div",{class:"empty bad",children:t});function ge({kind:t}){return e("span",{class:"tag kind",style:{color:We(t)},children:t})}function I({children:t,class:n}){return e("span",{class:M("tag",n),children:t})}function Ae({value:t,max:n,width:s=80}){let i=n>0?Math.max(2,t/n*s):2;return e("span",{class:"bar",style:{width:`${i}px`},title:String(t)})}function Me({rows:t}){return e("dl",{class:"kv",children:t.map(([n,s])=>e(L,{children:[e("dt",{children:n}),e("dd",{children:s})]}))})}function Te({tabs:t,value:n,onChange:s}){return e("div",{class:"subtabs",children:t.map(([i,r])=>e("button",{type:"button",class:M(n===i&&"active"),onClick:()=>s(i),children:r}))})}function Ds({left:t,center:n,right:s,leftWidth:i=280,rightWidth:r=340}){let[a,o]=A(i),[l,d]=A(r),c=re(null),[u,h]=A(null);O(()=>{let f=m=>{let p=c.current;if(!p)return;let v=m.clientX-p.x;p.side==="l"?o(Math.max(160,Math.min(700,p.start+v))):d(Math.max(200,Math.min(800,p.start-v)))},x=()=>{c.current=null,h(null)};return window.addEventListener("mousemove",f),window.addEventListener("mouseup",x),()=>{window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",x)}},[]);let g=[t?`${a}px 5px`:"","minmax(0, 1fr)",s?`5px ${l}px`:""].filter(Boolean).join(" ");return e("div",{class:"split",style:{gridTemplateColumns:g},children:[t&&e(L,{children:[e("div",{class:"pane",children:t}),e("div",{class:M("gutter",u==="l"&&"on"),onMouseDown:f=>{c.current={side:"l",x:f.clientX,start:a},h("l"),f.preventDefault()}})]}),e("div",{class:"pane",children:n}),s&&e(L,{children:[e("div",{class:M("gutter",u==="r"&&"on"),onMouseDown:f=>{c.current={side:"r",x:f.clientX,start:l},h("r"),f.preventDefault()}}),e("div",{class:"pane",children:s})]})]})}function Ve(t,n,s=!0){let[i,r]=A(n),[a,o]=A(s?-1:1);return{sorted:(t??[]).slice().sort((c,u)=>{let h=c[i],g=u[i];return typeof h=="number"&&typeof g=="number"?(h-g)*a:String(h??"").localeCompare(String(g??""))*a}),th:(c,u,h=!1)=>e("th",{class:M("sortable",h&&"num",i===c&&"sorted"),onClick:()=>{i===c?o(g=>g===1?-1:1):(r(c),o(h?-1:1))},children:[u,i===c?a===1?" \u25B2":" \u25BC":""]})}}var Vi=["overview","explore","galaxy","architecture","history","memory","docs","coverage","sessions","system"];function Ns(){let t=location.hash.replace(/^#\/?/,""),[n="",s=""]=t.split("?"),i=Vi.includes(n)?n:"overview",r={};for(let[a,o]of new URLSearchParams(s))r[a]=o;return{view:i,params:r}}function j(t,n={}){let s=new URLSearchParams;for(let[r,a]of Object.entries(n))a&&s.set(r,a);let i=s.toString();location.hash=`/${t}${i?`?${i}`:""}`}function Ps(){let[t,n]=A(Ns);return O(()=>{let s=()=>n(Ns());return window.addEventListener("hashchange",s),()=>window.removeEventListener("hashchange",s)},[]),t}function fn(t,n){var s,i=1;t==null&&(t=0),n==null&&(n=0);function r(){var a,o=s.length,l,d=0,c=0;for(a=0;a<o;++a)l=s[a],d+=l.x,c+=l.y;for(d=(d/o-t)*i,c=(c/o-n)*i,a=0;a<o;++a)l=s[a],l.x-=d,l.y-=c}return r.initialize=function(a){s=a},r.x=function(a){return arguments.length?(t=+a,r):t},r.y=function(a){return arguments.length?(n=+a,r):n},r.strength=function(a){return arguments.length?(i=+a,r):i},r}function Bs(t){let n=+this._x.call(null,t),s=+this._y.call(null,t);return zs(this.cover(n,s),n,s,t)}function zs(t,n,s,i){if(isNaN(n)||isNaN(s))return t;var r,a=t._root,o={data:i},l=t._x0,d=t._y0,c=t._x1,u=t._y1,h,g,f,x,m,p,v,b;if(!a)return t._root=o,t;for(;a.length;)if((m=n>=(h=(l+c)/2))?l=h:c=h,(p=s>=(g=(d+u)/2))?d=g:u=g,r=a,!(a=a[v=p<<1|m]))return r[v]=o,t;if(f=+t._x.call(null,a.data),x=+t._y.call(null,a.data),n===f&&s===x)return o.next=a,r?r[v]=o:t._root=o,t;do r=r?r[v]=new Array(4):t._root=new Array(4),(m=n>=(h=(l+c)/2))?l=h:c=h,(p=s>=(g=(d+u)/2))?d=g:u=g;while((v=p<<1|m)===(b=(x>=g)<<1|f>=h));return r[b]=a,r[v]=o,t}function Hs(t){var n,s,i=t.length,r,a,o=new Array(i),l=new Array(i),d=1/0,c=1/0,u=-1/0,h=-1/0;for(s=0;s<i;++s)isNaN(r=+this._x.call(null,n=t[s]))||isNaN(a=+this._y.call(null,n))||(o[s]=r,l[s]=a,r<d&&(d=r),r>u&&(u=r),a<c&&(c=a),a>h&&(h=a));if(d>u||c>h)return this;for(this.cover(d,c).cover(u,h),s=0;s<i;++s)zs(this,o[s],l[s],t[s]);return this}function js(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var s=this._x0,i=this._y0,r=this._x1,a=this._y1;if(isNaN(s))r=(s=Math.floor(t))+1,a=(i=Math.floor(n))+1;else{for(var o=r-s||1,l=this._root,d,c;s>t||t>=r||i>n||n>=a;)switch(c=(n<i)<<1|t<s,d=new Array(4),d[c]=l,l=d,o*=2,c){case 0:r=s+o,a=i+o;break;case 1:s=r-o,a=i+o;break;case 2:r=s+o,i=a-o;break;case 3:s=r-o,i=a-o;break}this._root&&this._root.length&&(this._root=l)}return this._x0=s,this._y0=i,this._x1=r,this._y1=a,this}function Os(){var t=[];return this.visit(function(n){if(!n.length)do t.push(n.data);while(n=n.next)}),t}function Us(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function le(t,n,s,i,r){this.node=t,this.x0=n,this.y0=s,this.x1=i,this.y1=r}function Xs(t,n,s){var i,r=this._x0,a=this._y0,o,l,d,c,u=this._x1,h=this._y1,g=[],f=this._root,x,m;for(f&&g.push(new le(f,r,a,u,h)),s==null?s=1/0:(r=t-s,a=n-s,u=t+s,h=n+s,s*=s);x=g.pop();)if(!(!(f=x.node)||(o=x.x0)>u||(l=x.y0)>h||(d=x.x1)<r||(c=x.y1)<a))if(f.length){var p=(o+d)/2,v=(l+c)/2;g.push(new le(f[3],p,v,d,c),new le(f[2],o,v,p,c),new le(f[1],p,l,d,v),new le(f[0],o,l,p,v)),(m=(n>=v)<<1|t>=p)&&(x=g[g.length-1],g[g.length-1]=g[g.length-1-m],g[g.length-1-m]=x)}else{var b=t-+this._x.call(null,f.data),y=n-+this._y.call(null,f.data),k=b*b+y*y;if(k<s){var S=Math.sqrt(s=k);r=t-S,a=n-S,u=t+S,h=n+S,i=f.data}}return i}function qs(t){if(isNaN(u=+this._x.call(null,t))||isNaN(h=+this._y.call(null,t)))return this;var n,s=this._root,i,r,a,o=this._x0,l=this._y0,d=this._x1,c=this._y1,u,h,g,f,x,m,p,v;if(!s)return this;if(s.length)for(;;){if((x=u>=(g=(o+d)/2))?o=g:d=g,(m=h>=(f=(l+c)/2))?l=f:c=f,n=s,!(s=s[p=m<<1|x]))return this;if(!s.length)break;(n[p+1&3]||n[p+2&3]||n[p+3&3])&&(i=n,v=p)}for(;s.data!==t;)if(r=s,!(s=s.next))return this;return(a=s.next)&&delete s.next,r?(a?r.next=a:delete r.next,this):n?(a?n[p]=a:delete n[p],(s=n[0]||n[1]||n[2]||n[3])&&s===(n[3]||n[2]||n[1]||n[0])&&!s.length&&(i?i[v]=s:this._root=s),this):(this._root=a,this)}function Gs(t){for(var n=0,s=t.length;n<s;++n)this.remove(t[n]);return this}function Ws(){return this._root}function Js(){var t=0;return this.visit(function(n){if(!n.length)do++t;while(n=n.next)}),t}function Vs(t){var n=[],s,i=this._root,r,a,o,l,d;for(i&&n.push(new le(i,this._x0,this._y0,this._x1,this._y1));s=n.pop();)if(!t(i=s.node,a=s.x0,o=s.y0,l=s.x1,d=s.y1)&&i.length){var c=(a+l)/2,u=(o+d)/2;(r=i[3])&&n.push(new le(r,c,u,l,d)),(r=i[2])&&n.push(new le(r,a,u,c,d)),(r=i[1])&&n.push(new le(r,c,o,l,u)),(r=i[0])&&n.push(new le(r,a,o,c,u))}return this}function Zs(t){var n=[],s=[],i;for(this._root&&n.push(new le(this._root,this._x0,this._y0,this._x1,this._y1));i=n.pop();){var r=i.node;if(r.length){var a,o=i.x0,l=i.y0,d=i.x1,c=i.y1,u=(o+d)/2,h=(l+c)/2;(a=r[0])&&n.push(new le(a,o,l,u,h)),(a=r[1])&&n.push(new le(a,u,l,d,h)),(a=r[2])&&n.push(new le(a,o,h,u,c)),(a=r[3])&&n.push(new le(a,u,h,d,c))}s.push(i)}for(;i=s.pop();)t(i.node,i.x0,i.y0,i.x1,i.y1);return this}function Ks(t){return t[0]}function Ys(t){return arguments.length?(this._x=t,this):this._x}function Qs(t){return t[1]}function er(t){return arguments.length?(this._y=t,this):this._y}function Ne(t,n,s){var i=new bn(n??Ks,s??Qs,NaN,NaN,NaN,NaN);return t==null?i:i.addAll(t)}function bn(t,n,s,i,r,a){this._x=t,this._y=n,this._x0=s,this._y0=i,this._x1=r,this._y1=a,this._root=void 0}function tr(t){for(var n={data:t.data},s=n;t=t.next;)s=s.next={data:t.data};return n}var me=Ne.prototype=bn.prototype;me.copy=function(){var t=new bn(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root,s,i;if(!n)return t;if(!n.length)return t._root=tr(n),t;for(s=[{source:n,target:t._root=new Array(4)}];n=s.pop();)for(var r=0;r<4;++r)(i=n.source[r])&&(i.length?s.push({source:i,target:n.target[r]=new Array(4)}):n.target[r]=tr(i));return t};me.add=Bs;me.addAll=Hs;me.cover=js;me.data=Os;me.extent=Us;me.find=Xs;me.remove=qs;me.removeAll=Gs;me.root=Ws;me.size=Js;me.visit=Vs;me.visitAfter=Zs;me.x=Ys;me.y=er;function ae(t){return function(){return t}}function ke(t){return(t()-.5)*1e-6}function Zi(t){return t.x+t.vx}function Ki(t){return t.y+t.vy}function yn(t){var n,s,i,r=1,a=1;typeof t!="function"&&(t=ae(t==null?1:+t));function o(){for(var c,u=n.length,h,g,f,x,m,p,v=0;v<a;++v)for(h=Ne(n,Zi,Ki).visitAfter(l),c=0;c<u;++c)g=n[c],m=s[g.index],p=m*m,f=g.x+g.vx,x=g.y+g.vy,h.visit(b);function b(y,k,S,$,_){var E=y.data,R=y.r,T=m+R;if(E){if(E.index>g.index){var C=f-E.x-E.vx,w=x-E.y-E.vy,F=C*C+w*w;F<T*T&&(C===0&&(C=ke(i),F+=C*C),w===0&&(w=ke(i),F+=w*w),F=(T-(F=Math.sqrt(F)))/F*r,g.vx+=(C*=F)*(T=(R*=R)/(p+R)),g.vy+=(w*=F)*T,E.vx-=C*(T=1-T),E.vy-=w*T)}return}return k>f+T||$<f-T||S>x+T||_<x-T}}function l(c){if(c.data)return c.r=s[c.data.index];for(var u=c.r=0;u<4;++u)c[u]&&c[u].r>c.r&&(c.r=c[u].r)}function d(){if(n){var c,u=n.length,h;for(s=new Array(u),c=0;c<u;++c)h=n[c],s[h.index]=+t(h,c,n)}}return o.initialize=function(c,u){n=c,i=u,d()},o.iterations=function(c){return arguments.length?(a=+c,o):a},o.strength=function(c){return arguments.length?(r=+c,o):r},o.radius=function(c){return arguments.length?(t=typeof c=="function"?c:ae(+c),d(),o):t},o}function Yi(t){return t.index}function nr(t,n){var s=t.get(n);if(!s)throw new Error("node not found: "+n);return s}function vn(t){var n=Yi,s=h,i,r=ae(30),a,o,l,d,c,u=1;t==null&&(t=[]);function h(p){return 1/Math.min(l[p.source.index],l[p.target.index])}function g(p){for(var v=0,b=t.length;v<u;++v)for(var y=0,k,S,$,_,E,R,T;y<b;++y)k=t[y],S=k.source,$=k.target,_=$.x+$.vx-S.x-S.vx||ke(c),E=$.y+$.vy-S.y-S.vy||ke(c),R=Math.sqrt(_*_+E*E),R=(R-a[y])/R*p*i[y],_*=R,E*=R,$.vx-=_*(T=d[y]),$.vy-=E*T,S.vx+=_*(T=1-T),S.vy+=E*T}function f(){if(o){var p,v=o.length,b=t.length,y=new Map(o.map((S,$)=>[n(S,$,o),S])),k;for(p=0,l=new Array(v);p<b;++p)k=t[p],k.index=p,typeof k.source!="object"&&(k.source=nr(y,k.source)),typeof k.target!="object"&&(k.target=nr(y,k.target)),l[k.source.index]=(l[k.source.index]||0)+1,l[k.target.index]=(l[k.target.index]||0)+1;for(p=0,d=new Array(b);p<b;++p)k=t[p],d[p]=l[k.source.index]/(l[k.source.index]+l[k.target.index]);i=new Array(b),x(),a=new Array(b),m()}}function x(){if(o)for(var p=0,v=t.length;p<v;++p)i[p]=+s(t[p],p,t)}function m(){if(o)for(var p=0,v=t.length;p<v;++p)a[p]=+r(t[p],p,t)}return g.initialize=function(p,v){o=p,c=v,f()},g.links=function(p){return arguments.length?(t=p,f(),g):t},g.id=function(p){return arguments.length?(n=p,g):n},g.iterations=function(p){return arguments.length?(u=+p,g):u},g.strength=function(p){return arguments.length?(s=typeof p=="function"?p:ae(+p),x(),g):s},g.distance=function(p){return arguments.length?(r=typeof p=="function"?p:ae(+p),m(),g):r},g}var Qi={value:()=>{}};function rr(){for(var t=0,n=arguments.length,s={},i;t<n;++t){if(!(i=arguments[t]+"")||i in s||/[\s.]/.test(i))throw new Error("illegal type: "+i);s[i]=[]}return new It(s)}function It(t){this._=t}function ea(t,n){return t.trim().split(/^|\s+/).map(function(s){var i="",r=s.indexOf(".");if(r>=0&&(i=s.slice(r+1),s=s.slice(0,r)),s&&!n.hasOwnProperty(s))throw new Error("unknown type: "+s);return{type:s,name:i}})}It.prototype=rr.prototype={constructor:It,on:function(t,n){var s=this._,i=ea(t+"",s),r,a=-1,o=i.length;if(arguments.length<2){for(;++a<o;)if((r=(t=i[a]).type)&&(r=ta(s[r],t.name)))return r;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++a<o;)if(r=(t=i[a]).type)s[r]=sr(s[r],t.name,n);else if(n==null)for(r in s)s[r]=sr(s[r],t.name,null);return this},copy:function(){var t={},n=this._;for(var s in n)t[s]=n[s].slice();return new It(t)},call:function(t,n){if((r=arguments.length-2)>0)for(var s=new Array(r),i=0,r,a;i<r;++i)s[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=this._[t],i=0,r=a.length;i<r;++i)a[i].value.apply(n,s)},apply:function(t,n,s){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,a=i.length;r<a;++r)i[r].value.apply(n,s)}};function ta(t,n){for(var s=0,i=t.length,r;s<i;++s)if((r=t[s]).name===n)return r.value}function sr(t,n,s){for(var i=0,r=t.length;i<r;++i)if(t[i].name===n){t[i]=Qi,t=t.slice(0,i).concat(t.slice(i+1));break}return s!=null&&t.push({name:n,value:s}),t}var kn=rr;var Ze=0,ot=0,at=0,ar=1e3,Dt,lt,Nt=0,Pe=0,Pt=0,ct=typeof performance=="object"&&performance.now?performance:Date,or=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function wn(){return Pe||(or(na),Pe=ct.now()+Pt)}function na(){Pe=0}function xn(){this._call=this._time=this._next=null}xn.prototype=Bt.prototype={constructor:xn,restart:function(t,n,s){if(typeof t!="function")throw new TypeError("callback is not a function");s=(s==null?wn():+s)+(n==null?0:+n),!this._next&<!==this&&(lt?lt._next=this:Dt=this,lt=this),this._call=t,this._time=s,_n()},stop:function(){this._call&&(this._call=null,this._time=1/0,_n())}};function Bt(t,n,s){var i=new xn;return i.restart(t,n,s),i}function lr(){wn(),++Ze;for(var t=Dt,n;t;)(n=Pe-t._time)>=0&&t._call.call(void 0,n),t=t._next;--Ze}function ir(){Pe=(Nt=ct.now())+Pt,Ze=ot=0;try{lr()}finally{Ze=0,ra(),Pe=0}}function sa(){var t=ct.now(),n=t-Nt;n>ar&&(Pt-=n,Nt=t)}function ra(){for(var t,n=Dt,s,i=1/0;n;)n._call?(i>n._time&&(i=n._time),t=n,n=n._next):(s=n._next,n._next=null,n=t?t._next=s:Dt=s);lt=t,_n(i)}function _n(t){if(!Ze){ot&&(ot=clearTimeout(ot));var n=t-Pe;n>24?(t<1/0&&(ot=setTimeout(ir,t-ct.now()-Pt)),at&&(at=clearInterval(at))):(at||(Nt=ct.now(),at=setInterval(sa,ar)),Ze=1,or(ir))}}function cr(){let t=1;return()=>(t=(1664525*t+1013904223)%4294967296)/4294967296}function dr(t){return t.x}function ur(t){return t.y}var ia=10,aa=Math.PI*(3-Math.sqrt(5));function Sn(t){var n,s=1,i=.001,r=1-Math.pow(i,1/300),a=0,o=.6,l=new Map,d=Bt(h),c=kn("tick","end"),u=cr();t==null&&(t=[]);function h(){g(),c.call("tick",n),s<i&&(d.stop(),c.call("end",n))}function g(m){var p,v=t.length,b;m===void 0&&(m=1);for(var y=0;y<m;++y)for(s+=(a-s)*r,l.forEach(function(k){k(s)}),p=0;p<v;++p)b=t[p],b.fx==null?b.x+=b.vx*=o:(b.x=b.fx,b.vx=0),b.fy==null?b.y+=b.vy*=o:(b.y=b.fy,b.vy=0);return n}function f(){for(var m=0,p=t.length,v;m<p;++m){if(v=t[m],v.index=m,v.fx!=null&&(v.x=v.fx),v.fy!=null&&(v.y=v.fy),isNaN(v.x)||isNaN(v.y)){var b=ia*Math.sqrt(.5+m),y=m*aa;v.x=b*Math.cos(y),v.y=b*Math.sin(y)}(isNaN(v.vx)||isNaN(v.vy))&&(v.vx=v.vy=0)}}function x(m){return m.initialize&&m.initialize(t,u),m}return f(),n={tick:g,restart:function(){return d.restart(h),n},stop:function(){return d.stop(),n},nodes:function(m){return arguments.length?(t=m,f(),l.forEach(x),n):t},alpha:function(m){return arguments.length?(s=+m,n):s},alphaMin:function(m){return arguments.length?(i=+m,n):i},alphaDecay:function(m){return arguments.length?(r=+m,n):+r},alphaTarget:function(m){return arguments.length?(a=+m,n):a},velocityDecay:function(m){return arguments.length?(o=1-m,n):1-o},randomSource:function(m){return arguments.length?(u=m,l.forEach(x),n):u},force:function(m,p){return arguments.length>1?(p==null?l.delete(m):l.set(m,x(p)),n):l.get(m)},find:function(m,p,v){var b=0,y=t.length,k,S,$,_,E;for(v==null?v=1/0:v*=v,b=0;b<y;++b)_=t[b],k=m-_.x,S=p-_.y,$=k*k+S*S,$<v&&(E=_,v=$);return E},on:function(m,p){return arguments.length>1?(c.on(m,p),n):c.on(m)}}}function Tn(){var t,n,s,i,r=ae(-30),a,o=1,l=1/0,d=.81;function c(f){var x,m=t.length,p=Ne(t,dr,ur).visitAfter(h);for(i=f,x=0;x<m;++x)n=t[x],p.visit(g)}function u(){if(t){var f,x=t.length,m;for(a=new Array(x),f=0;f<x;++f)m=t[f],a[m.index]=+r(m,f,t)}}function h(f){var x=0,m,p,v=0,b,y,k;if(f.length){for(b=y=k=0;k<4;++k)(m=f[k])&&(p=Math.abs(m.value))&&(x+=m.value,v+=p,b+=p*m.x,y+=p*m.y);f.x=b/v,f.y=y/v}else{m=f,m.x=m.data.x,m.y=m.data.y;do x+=a[m.data.index];while(m=m.next)}f.value=x}function g(f,x,m,p){if(!f.value)return!0;var v=f.x-n.x,b=f.y-n.y,y=p-x,k=v*v+b*b;if(y*y/d<k)return k<l&&(v===0&&(v=ke(s),k+=v*v),b===0&&(b=ke(s),k+=b*b),k<o&&(k=Math.sqrt(o*k)),n.vx+=v*f.value*i/k,n.vy+=b*f.value*i/k),!0;if(f.length||k>=l)return;(f.data!==n||f.next)&&(v===0&&(v=ke(s),k+=v*v),b===0&&(b=ke(s),k+=b*b),k<o&&(k=Math.sqrt(o*k)));do f.data!==n&&(y=a[f.data.index]*i/k,n.vx+=v*y,n.vy+=b*y);while(f=f.next)}return c.initialize=function(f,x){t=f,s=x,u()},c.strength=function(f){return arguments.length?(r=typeof f=="function"?f:ae(+f),u(),c):r},c.distanceMin=function(f){return arguments.length?(o=f*f,c):Math.sqrt(o)},c.distanceMax=function(f){return arguments.length?(l=f*f,c):Math.sqrt(l)},c.theta=function(f){return arguments.length?(d=f*f,c):Math.sqrt(d)},c}function En(t){var n=ae(.1),s,i,r;typeof t!="function"&&(t=ae(t==null?0:+t));function a(l){for(var d=0,c=s.length,u;d<c;++d)u=s[d],u.vx+=(r[d]-u.x)*i[d]*l}function o(){if(s){var l,d=s.length;for(i=new Array(d),r=new Array(d),l=0;l<d;++l)i[l]=isNaN(r[l]=+t(s[l],l,s))?0:+n(s[l],l,s)}}return a.initialize=function(l){s=l,o()},a.strength=function(l){return arguments.length?(n=typeof l=="function"?l:ae(+l),o(),a):n},a.x=function(l){return arguments.length?(t=typeof l=="function"?l:ae(+l),o(),a):t},a}function $n(t){var n=ae(.1),s,i,r;typeof t!="function"&&(t=ae(t==null?0:+t));function a(l){for(var d=0,c=s.length,u;d<c;++d)u=s[d],u.vy+=(r[d]-u.y)*i[d]*l}function o(){if(s){var l,d=s.length;for(i=new Array(d),r=new Array(d),l=0;l<d;++l)i[l]=isNaN(r[l]=+t(s[l],l,s))?0:+n(s[l],l,s)}}return a.initialize=function(l){s=l,o()},a.strength=function(l){return arguments.length?(n=typeof l=="function"?l:ae(+l),o(),a):n},a.y=function(l){return arguments.length?(t=typeof l=="function"?l:ae(+l),o(),a):t},a}function An(t,n,s){let i=new Map,r=t.map(d=>{let c=s?.get(d.id),u={...d,deg:0,r:4};return c&&(u.x=c.x,u.y=c.y),i.set(d.id,u),u}),a=[];for(let d of n){let c=i.get(d.src),u=i.get(d.dst);!c||!u||c===u||(c.deg++,u.deg++,a.push({source:c,target:u,kind:d.kind,weight:d.weight,count:d.count,lines:d.lines}))}for(let d of r)d.r=4+Math.min(12,Math.sqrt(d.deg)*1.8)+(d.root?3:0);let o=r.length,l=Sn(r).force("link",vn(a).distance(d=>d.kind==="co_changes"?90:d.kind==="defines"?36:60).strength(d=>d.kind==="co_changes"?.15:.5)).force("charge",Tn().strength(o>400?-60:-140).distanceMax(600)).force("collide",yn().radius(d=>d.r+4).iterations(2)).force("center",fn(0,0).strength(.05)).force("x",En(0).strength(.02)).force("y",$n(0).strength(.02)).alphaDecay(o>400?.05:.03).velocityDecay(.4);return{nodes:r,links:a,sim:l,byId:i}}function pr(t,n){let s=An(t,n);s.sim.stop();let i=s.nodes.filter(x=>x.kind==="file"),r=s.nodes.filter(x=>x.kind!=="file"),a=new Map;for(let x of i){let m=(x.path??x.label).split("/").slice(0,-1).join("/")||".";(a.get(m)??a.set(m,[]).get(m)).push(x)}let o=[...a.keys()].sort((x,m)=>x.split("/").length-m.split("/").length||x.localeCompare(m)),l=220,d=34,c=-(o.length-1)*l/2,u=new Map;for(let x of o){let m=a.get(x).sort((v,b)=>v.label.localeCompare(b.label)),p=-(m.length-1)*d/2;for(let v of m)v.x=c,v.y=p,v.fx=c,v.fy=p,u.set(v.path??v.label,v),p+=d;c+=l}let h=new Map,g=[];for(let x of r){let m=x.path?u.get(x.path):void 0;if(!m){g.push(x);continue}let p=h.get(m.id)??0;h.set(m.id,p+1),x.x=(m.x??0)+70+p%3*46,x.y=(m.y??0)+Math.floor(p/3)*14-8,x.fx=x.x,x.fy=x.y}let f=(o.length?a.get(o[0]).length:0)*d/2+60;for(let x of g)x.x=-(g.length-1)*60/2+g.indexOf(x)*60,x.y=f,x.fx=x.x,x.fy=x.y;return f+=40,s}var oa=()=>document.documentElement.getAttribute("data-theme")==="dark"||document.documentElement.getAttribute("data-theme")!=="light"&&window.matchMedia("(prefers-color-scheme: dark)").matches;function Ke(t){let n=re(null),s=re(null),i=re(null),r=re({k:1,x:0,y:0}),a=re(null),o=re(null),[l,d]=A(null),[c,u]=A(!1),h=re(t);h.current=t;let g=()=>{let T=n.current,C=i.current;if(!T||!C)return;let w=T.getContext("2d");if(!w)return;let F=window.devicePixelRatio||1,W=T.width/F,X=T.height/F,D=r.current,ee=oa(),{selected:ue,highlight:pe}=h.current,ve=ue?C.byId.get(ue):void 0,ie=new Set;if(ve){ie.add(ve.id);for(let H of C.links){let de=H.source,oe=H.target;de.id===ve.id&&ie.add(oe.id),oe.id===ve.id&&ie.add(de.id)}}w.setTransform(F,0,0,F,0,0),w.clearRect(0,0,W,X),w.translate(W/2+D.x,X/2+D.y),w.scale(D.k,D.k);for(let H of C.links){let de=H.source,oe=H.target;if(de.x===void 0||oe.x===void 0)continue;let Ce=`${de.id}|${oe.id}|${H.kind}`,Se=pe?.has(Ce),Qt=ve&&!(ie.has(de.id)&&ie.has(oe.id))&&de.id!==ve.id&&oe.id!==ve.id;if(w.globalAlpha=Se?1:Qt?.06:H.kind==="co_changes"?.35:.45,w.strokeStyle=Lt(H.kind),w.lineWidth=(Se?2.5:H.kind==="co_changes"?1+H.weight*2:1)/D.k,w.setLineDash(H.kind==="calls"?[4/D.k,3/D.k]:H.kind==="co_changes"?[1/D.k,3/D.k]:H.kind==="references"?[2/D.k,2/D.k]:[]),w.beginPath(),w.moveTo(de.x,de.y??0),w.lineTo(oe.x,oe.y??0),w.stroke(),w.setLineDash([]),Rs.has(H.kind)&&D.k>.5){let Xe=oe.x-de.x,Vn=(oe.y??0)-(de.y??0),Zn=Math.hypot(Xe,Vn)||1,nt=Xe/Zn,st=Vn/Zn,en=oe.x-nt*(oe.r+2),tn=(oe.y??0)-st*(oe.r+2),Re=5/D.k;w.fillStyle=Lt(H.kind),w.beginPath(),w.moveTo(en,tn),w.lineTo(en-nt*Re*2-st*Re,tn-st*Re*2+nt*Re),w.lineTo(en-nt*Re*2+st*Re,tn-st*Re*2-nt*Re),w.closePath(),w.fill()}}let Ue=C.nodes.length<=120||D.k>1.6;w.font=`${11/D.k}px system-ui, sans-serif`,w.textBaseline="middle";for(let H of C.nodes){if(H.x===void 0||H.y===void 0)continue;let de=ve&&!ie.has(H.id);if(w.globalAlpha=de?.2:1,w.beginPath(),w.arc(H.x,H.y,H.r/Math.max(1,D.k**.5),0,Math.PI*2),w.fillStyle=We(H.kind),w.fill(),H.root||H.id===ue||H===a.current?(w.lineWidth=2.5/D.k,w.strokeStyle=ee?"#e5e7eb":"#1b1f24",w.stroke()):H.kind==="file"&&H.exported,Ue||H.root||H.deg>3||ie.has(H.id)||H===a.current||H.id===ue){let Ce=H.kind==="file"||H.kind==="package"?Mt(H.label):H.label.split(".").pop()??H.label,Se=H.x+H.r/Math.max(1,D.k**.5)+3/D.k;w.lineWidth=3/D.k,w.strokeStyle=ee?"#171a21":"#ffffff",w.strokeText(Ce,Se,H.y),w.fillStyle=ee?"#e5e7eb":"#1b1f24",w.fillText(Ce,Se,H.y)}}w.globalAlpha=1},f=()=>{let T=n.current,C=i.current;if(!T||!C?.nodes.length)return;let w=window.devicePixelRatio||1,F=T.width/w,W=T.height/w,X=Number.POSITIVE_INFINITY,D=Number.POSITIVE_INFINITY,ee=Number.NEGATIVE_INFINITY,ue=Number.NEGATIVE_INFINITY;for(let fe of C.nodes)fe.x===void 0||fe.y===void 0||(X=Math.min(X,fe.x),D=Math.min(D,fe.y),ee=Math.max(ee,fe.x),ue=Math.max(ue,fe.y));let pe=Math.max(100,ee-X+120),ve=Math.max(100,ue-D+120),ie=Math.min(2.5,Math.min(F/pe,W/ve));r.current={k:ie,x:-((X+ee)/2)*ie,y:-((D+ue)/2)*ie},g()};Ts(t.handle??null,()=>({fit:f}),[]);let x=t.nodes.map(T=>T.id).join("|"),m=t.edges.length,p=t.mode??"galaxy";O(()=>{let T=t.keepPositions?i.current?.byId:void 0;i.current?.sim.stop();let C=p==="hierarchy"?pr(t.nodes,t.edges):An(t.nodes,t.edges,T);i.current=C;let w=!1,F=0;if(p==="hierarchy"){f();return}return C.sim.on("tick",()=>{F++,(F%2===0||C.sim.alpha()<.05)&&g(),!w&&(F===30||C.sim.alpha()<.3)&&(w=!0,f())}),C.sim.on("end",()=>{w=!0,f()}),()=>C.sim.stop()},[x,m,p]),O(()=>{g()},[t.selected,t.highlight,l]),O(()=>{let T=s.current,C=n.current;if(!T||!C)return;let w=()=>{let D=window.devicePixelRatio||1;C.width=Math.max(1,T.clientWidth*D),C.height=Math.max(1,T.clientHeight*D),g()};w();let F=new ResizeObserver(w);F.observe(T);let W=window.matchMedia("(prefers-color-scheme: dark)");W.addEventListener("change",g);let X=new MutationObserver(g);return X.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>{F.disconnect(),W.removeEventListener("change",g),X.disconnect()}},[]);let v=T=>{let w=n.current.getBoundingClientRect(),F=r.current;return{x:(T.clientX-w.left-w.width/2-F.x)/F.k,y:(T.clientY-w.top-w.height/2-F.y)/F.k}},b=T=>{let C=i.current;if(!C)return null;let w=v(T),F=r.current,W=null,X=Number.POSITIVE_INFINITY;for(let D of C.nodes){if(D.x===void 0||D.y===void 0)continue;let ee=Math.hypot(D.x-w.x,D.y-w.y),ue=D.r/Math.max(1,F.k**.5)+6/F.k;ee<ue&&ee<X&&(X=ee,W=D)}return W},y=T=>{let C=b(T),w=r.current;o.current={node:C??void 0,px:T.clientX,py:T.clientY,vx:w.x,vy:w.y,moved:!1},C&&(C.fx=C.x,C.fy=C.y,i.current?.sim.alphaTarget(.2).restart()),u(!0),T.preventDefault()},k=T=>{let C=o.current;if(C){let F=T.clientX-C.px,W=T.clientY-C.py;if(Math.abs(F)+Math.abs(W)>3&&(C.moved=!0),C.node){let X=v(T);C.node.fx=X.x,C.node.fy=X.y,p==="hierarchy"&&(C.node.x=X.x,C.node.y=X.y,g())}else r.current={...r.current,x:C.vx+F,y:C.vy+W},g();return}let w=b(T);w!==a.current&&(a.current=w,d(w))},S=T=>{let C=o.current;o.current=null,u(!1),C&&(C.node?(p!=="hierarchy"&&(C.node.fx=null,C.node.fy=null,i.current?.sim.alphaTarget(0)),C.moved||h.current.onSelect?.(C.node.id===h.current.selected?null:C.node.id)):C.moved||h.current.onSelect?.(null))},$=T=>{T.preventDefault();let w=n.current.getBoundingClientRect(),F=r.current,W=T.deltaY>0?.9:1.1,X=Math.max(.05,Math.min(8,F.k*W)),D=T.clientX-w.left-w.width/2,ee=T.clientY-w.top-w.height/2;r.current={k:X,x:D-(D-F.x)*X/F.k,y:ee-(ee-F.y)*X/F.k},g()},_=T=>{let C=b(T);C&&h.current.onActivate?.(C.id)},E=[...new Set(t.nodes.map(T=>T.kind))],R=[...new Set(t.edges.map(T=>T.kind))];return e("div",{class:"gwrap",ref:s,children:[e("canvas",{ref:n,class:M(c&&"drag",l&&!c&&"hover"),onMouseDown:y,onMouseMove:k,onMouseUp:S,onMouseLeave:()=>{a.current=null,d(null),o.current&&!o.current.node&&(o.current=null)},onWheel:$,onDblClick:_}),l&&!c&&e("div",{class:"overlay tip",style:{left:12,top:12},children:[e("b",{children:l.kind})," ",l.label,l.path&&l.kind!=="file"?e("span",{class:"muted",children:[" ","\xB7 ",l.path,l.line?`:${l.line}`:""]}):null,e("span",{class:"muted",children:[" ","\xB7 ",l.deg," edge",l.deg===1?"":"s"]})]}),t.legend!==!1&&e("div",{class:"overlay legend",children:[E.map(T=>e("span",{children:[e("i",{style:{background:We(T)}}),T]})),R.map(T=>e("span",{children:[e("s",{style:{borderColor:Lt(T)}}),T]}))]}),e("button",{type:"button",class:"overlay fit",onClick:f,children:"fit view"})]})}function hr(t,n,s,i,r){let a=t.reduce((x,m)=>x+(m.value??m.size),0);if(!a||!t.length)return[];let o=i*r/a,l=[],d=0,c=n,u=s,h=i,g=r,f=[...t].sort((x,m)=>(m.value??m.size)-(x.value??x.size));for(;d<f.length;){let x=h>=g,m=x?g:h,p=[],v=0,b=Number.POSITIVE_INFINITY;for(;d<f.length;){let S=f[d],$=(S.value??S.size)*o,_=[...p,S],E=v+$,R=Math.max(..._.map(w=>(w.value??w.size)*o)),T=Math.min(..._.map(w=>(w.value??w.size)*o)),C=Math.max(m*m*R/(E*E),E*E/(m*m*T));if(C>b&&p.length)break;b=C,p=_,v=E,d++}let y=m?v/m:0,k=0;for(let S of p){let $=y?(S.value??S.size)*o/y:0;l.push(x?{node:S,x:c,y:u+k,w:y,h:$,depth:0}:{node:S,x:c+k,y:u,w:$,h:y,depth:0}),k+=$}x?(c+=y,h-=y):(u+=y,g-=y)}return l}function mr(t,n,s,i=18){let r=[];for(let a of hr(t.children??[],0,0,n,s))if(r.push({...a,depth:0}),a.node.children?.length&&a.w>40&&a.h>30)for(let o of hr(a.node.children,a.x+2,a.y+i,Math.max(0,a.w-4),Math.max(0,a.h-i-2)))r.push({...o,depth:1});return r}function gr(t,n,s){let i={name:n||"(project)",path:n,size:0,children:[]},r=new Map([["",i]]),a=l=>{let d=r.get(l);if(d)return d;let c=a(l.includes("/")?l.slice(0,l.lastIndexOf("/")):""),u={name:l.split("/").pop()??l,path:l,size:0,children:[]};return c.children.push(u),r.set(l,u),u};for(let l of t){if(n&&!l.path.startsWith(n))continue;let d=n?l.path.slice(n.length).replace(/^\//,""):l.path,c=d.includes("/")?d.slice(0,d.lastIndexOf("/")):"",u=Math.max(1,s(l));a(c).children.push({name:d.split("/").pop()??d,path:l.path,size:u,data:l})}let o=l=>(l.children?.length&&(l.size=l.children.reduce((d,c)=>d+o(c),0)),l.size);return o(i),i}var fr={typescript:"#2563eb",tsx:"#3b82f6",javascript:"#d97706",python:"#16a34a",go:"#0d9488",php:"#6366f1",other:"#6b7280"};function la(t){let n=Math.max(0,Math.min(1,t)),s=Math.round(37+180*n),i=Math.round(99+20*n),r=Math.round(235+-229*n);return`rgb(${s},${i},${r})`}function ca({files:t,arch:n}){let[s,i]=A(""),[r,a]=A("language"),[o,l]=A("loc"),[d,c]=A(null),u=re(null),[h,g]=A({w:900,h:520});O(()=>{let b=u.current;if(!b)return;let y=new ResizeObserver(()=>g({w:b.clientWidth,h:b.clientHeight}));return y.observe(b),g({w:b.clientWidth,h:b.clientHeight}),()=>y.disconnect()},[]);let f=Y(()=>{let b=gr(t,s,y=>o==="uniform"?1:y.loc||Math.max(1,y.size/40));return mr(b,h.w,h.h)},[t,s,o,h]),m=d?(b=>t.filter(y=>y.path===b||y.path.startsWith(`${b}/`)))(d):[],p=m.length===1&&m[0]?.path===d?m[0]:void 0,v=n?.entryPoints.filter(b=>b.kind!=="script")??[];return e("div",{class:"grid wide",style:{alignItems:"start"},children:[e("div",{children:[e("div",{class:"row",style:{marginBottom:8},children:[e("span",{class:"row tight",children:[e("a",{onClick:()=>i(""),children:n?.project.name??"project"}),s.split("/").filter(Boolean).map((b,y,k)=>e(L,{children:[e("span",{class:"muted",children:"\u203A"}),e("a",{onClick:()=>i(k.slice(0,y+1).join("/")),children:b})]}))]}),e("span",{class:"spacer"}),e("span",{class:"row tight",children:[e("button",{type:"button",class:M("chip",o==="loc"&&"on"),onClick:()=>l("loc"),children:"size: loc"}),e("button",{type:"button",class:M("chip",o==="uniform"&&"on"),onClick:()=>l("uniform"),children:"uniform"}),e("button",{type:"button",class:M("chip",r==="language"&&"on"),onClick:()=>a("language"),children:"color: language"}),e("button",{type:"button",class:M("chip",r==="heat"&&"on"),onClick:()=>a("heat"),children:"heat"})]})]}),e("div",{class:"treemap",ref:u,children:f.map(b=>{let y=b.node.data,k=!!b.node.children?.length,S=y?r==="heat"?la(y.score):fr[y.language??"other"]??fr.other:void 0;return e("div",{class:M("cell",k&&"dir",d===b.node.path&&"sel"),style:{left:b.x,top:b.y,width:Math.max(0,b.w),height:Math.max(0,b.h),background:S},title:y?`${y.path} \xB7 ${y.loc} loc \xB7 ${y.symbols} symbols \xB7 heat ${y.score.toFixed(2)}`:`${b.node.path} \xB7 ${b.node.size} loc`,onClick:$=>{$.stopPropagation(),c(b.node.path)},onDblClick:$=>{$.stopPropagation(),k?i(b.node.path):y&&j("explore",{file:y.path})},children:k?e("span",{class:"lbl",children:[b.node.name,"/"]}):b.w>50&&b.h>14?b.node.name:""})})}),e("div",{class:"muted small",style:{marginTop:6},children:"Area is lines of code (or uniform). Double-click a folder to open it, a file to read it. Heat mixes fan-in, recent commits and complexity; it is a signal, not a grade."})]}),e("div",{class:"stack",children:[e("div",{class:"card",children:[e("h3",{children:d??"selection"}),p?e(L,{children:[e("div",{class:"row small",children:[e(I,{children:p.language??"?"}),e(I,{children:[p.loc," loc"]}),e(I,{children:[p.symbols," symbols"]}),e(I,{children:["fan-in ",p.fanIn]}),e(I,{children:["heat ",p.score.toFixed(2)]}),e(I,{children:p.status})]}),e("div",{class:"row",style:{marginTop:8},children:[e("button",{type:"button",class:"sm",onClick:()=>j("explore",{file:p.path}),children:"Open source"}),e("button",{type:"button",class:"sm",onClick:()=>j("galaxy",{node:`file:${p.path}`}),children:"Galaxy"})]})]}):m.length?e("div",{class:"row small",children:[e(I,{children:[m.length," files"]}),e(I,{children:[K(m.reduce((b,y)=>b+y.loc,0))," loc"]}),e(I,{children:[m.reduce((b,y)=>b+y.symbols,0)," symbols"]}),e(I,{children:["mean heat ",(m.reduce((b,y)=>b+y.score,0)/m.length).toFixed(2)]})]}):e("div",{class:"muted small",children:"Click a cell."})]}),e("div",{class:"card",children:[e("h3",{children:"entry points"}),v.length?e("table",{children:e("tbody",{children:v.map(b=>e("tr",{class:"click",onClick:()=>j("explore",{file:b.path}),children:[e("td",{children:e(I,{children:b.kind})}),e("td",{class:"break",children:b.name}),e("td",{class:"muted small break",children:b.path})]}))})}):e("div",{class:"muted small",children:"none found"})]}),n&&e("div",{class:"card",children:[e("h3",{children:"overview"}),e("div",{class:"row small",children:[e(I,{children:[n.overview.files," files"]}),e(I,{children:[n.overview.symbols," symbols"]}),e(I,{children:[n.overview.edges," edges"]}),Object.entries(n.overview.languages).map(([b,y])=>e(I,{children:[b," ",y]}))]}),n.project.description?e("div",{class:"muted small",style:{marginTop:6},children:n.project.description}):null]})]})]})}function da(){let t=z(()=>P("/api/routes"),[]);return t.error?e(q,{error:t.error}):t.data?t.data.length?e("div",{class:"card flush",children:e("table",{children:[e("thead",{children:e("tr",{children:[e("th",{children:"method"}),e("th",{children:"path"}),e("th",{children:"framework"}),e("th",{children:"handler"}),e("th",{children:"registered in"})]})}),e("tbody",{children:t.data.map(n=>e("tr",{children:[e("td",{children:e(I,{children:n.method})}),e("td",{class:"mono",children:n.path}),e("td",{class:"muted",children:n.framework}),e("td",{children:n.handlers.map(s=>e("div",{children:[e("a",{onClick:()=>s.path?j("explore",{file:s.path,symbol:s.id}):j("galaxy",{node:s.id}),children:s.name}),s.path?e("span",{class:"muted small",children:[" ",s.path]}):null]}))}),e("td",{class:"muted small",children:e("a",{onClick:()=>j("explore",{file:n.file,line:n.line?String(n.line):void 0}),children:[n.file,n.line?`:${n.line}`:""]})})]}))})]})}):e(G,{children:"No routes detected. express/fastify/hono/koa/hapi/restify registrations, moleculer service schemas and gateway aliases, and Next.js route files are recognised."}):e(B,{})}function ua(){let[t,n]=A("file"),[s,i]=A(""),r=z(()=>P("/api/hotspots",{kind:t,path:s.trim()||void 0,limit:80}),[t,s]),{sorted:a,th:o}=Ve(r.data,"score"),l={fan_in:Math.max(1,...a.map(d=>d.fan_in)),commits_90d:Math.max(1,...a.map(d=>d.commits_90d)),complexity:Math.max(1,...a.map(d=>d.complexity))};return e(L,{children:[e("div",{class:"row",style:{marginBottom:10},children:[e("button",{type:"button",class:M("chip",t==="file"&&"on"),onClick:()=>n("file"),children:"files"}),e("button",{type:"button",class:M("chip",t==="symbol"&&"on"),onClick:()=>n("symbol"),children:"functions and classes"}),e("input",{type:"text",placeholder:"folder prefix, e.g. src/graph/",value:s,onInput:d=>i(d.target.value),style:{width:260}}),e("span",{class:"muted small",children:"Score = 0.4\xB7fan-in + 0.4\xB7commits/90d + 0.2\xB7complexity, log-scaled. A signal of where attention goes, not a quality grade."})]}),r.error?e(q,{error:r.error}):r.data?e("div",{class:"card flush",children:e("table",{children:[e("thead",{children:e("tr",{children:[o("path",t==="file"?"file":"symbol"),o("fan_in","fan-in",!0),o("commits_90d","commits/90d",!0),o("complexity","complexity",!0),o("loc","loc",!0),o("score","score",!0),e("th",{children:"last"})]})}),e("tbody",{children:a.map(d=>e("tr",{class:"click",onClick:()=>d.kind==="file"?j("explore",{file:d.path}):j("explore",{file:d.path.split(" > ")[0],symbol:d.id}),children:[e("td",{class:"break",children:[d.kind!=="file"?e(ge,{kind:d.kind}):null,d.path]}),e("td",{class:"num",children:[e(Ae,{value:d.fan_in,max:l.fan_in,width:60})," ",d.fan_in]}),e("td",{class:"num",children:[e(Ae,{value:d.commits_90d,max:l.commits_90d,width:60})," ",d.commits_90d]}),e("td",{class:"num",children:[e(Ae,{value:d.complexity,max:l.complexity,width:60})," ",d.complexity]}),e("td",{class:"num",children:d.loc}),e("td",{class:"num",children:e("b",{children:d.score.toFixed(2)})}),e("td",{class:"muted small",children:d.last_touched})]}))})]})}):e(B,{})]})}function pa(){let t=z(()=>P("/api/clusters"),[]),[n,s]=A(null),[i,r]=A(null),[a,o]=A(new Set),l=Y(()=>{let u=t.data;if(!u)return{nodes:[],edges:[]};let h=[],g=[];if(i!==null){let f=u.cycles[i]??[];for(let x of f)h.push({id:`file:${x}`,label:x,kind:"file",path:x,line:null});for(let x=0;x<f.length;x++)g.push({src:`file:${f[x]}`,dst:`file:${f[(x+1)%f.length]}`,kind:"imports",weight:1});return{nodes:h,edges:g}}for(let f of u.clusters){if(a.has(f.id))for(let x of u.members[String(f.id)]??[])h.push({id:`file:${x.path}`,label:x.path,kind:"file",path:x.path,line:null,score:x.score});if(h.push({id:`cluster:${f.id}`,label:`#${f.id} ${f.label} (${f.size})`,kind:"cluster",path:null,line:null}),a.has(f.id))for(let x of u.members[String(f.id)]??[])g.push({src:`file:${x.path}`,dst:`cluster:${f.id}`,kind:"link",weight:.5});for(let[x,m]of Object.entries(f.links))g.push({src:`cluster:${f.id}`,dst:`cluster:${x}`,kind:"imports",weight:Math.min(1,m/10),count:m})}return{nodes:h,edges:g}},[t.data,i,a]);if(t.error)return e(q,{error:t.error});let d=t.data;if(!d)return e(B,{});let c=n?.startsWith("cluster:")?d.clusters.find(u=>String(u.id)===n.slice(8)):void 0;return e("div",{class:"grid wide",style:{alignItems:"start"},children:[e("div",{class:"card flush",style:{height:560},children:l.nodes.length?e(Ke,{nodes:l.nodes,edges:l.edges,selected:n,onSelect:s,onActivate:u=>{if(u.startsWith("cluster:")){let h=Number(u.slice(8));o(g=>{let f=new Set(g);return f.has(h)?f.delete(h):f.add(h),f})}else u.startsWith("file:")&&j("explore",{file:u.slice(5)})}}):e(G,{children:"No clusters yet. Run a reindex."})}),e("div",{class:"stack",children:[e("div",{class:"card",children:[e("h3",{children:["clusters \xB7 ",d.clusters.length]}),e("div",{class:"muted small",style:{marginBottom:6},children:"Connectivity groups from imports and co-change (label propagation). Double-click a cluster to expand its files; they are not proof of architectural boundaries."}),e("div",{class:"list",style:{maxHeight:260},children:d.clusters.map(u=>e("div",{class:M("item",n===`cluster:${u.id}`&&"sel"),onClick:()=>{r(null),s(`cluster:${u.id}`)},children:[e("div",{class:"n",children:["#",u.id," ",u.label," ",e("span",{class:"muted",children:["\xB7 ",u.size," files"]})]}),e("div",{class:"p",children:u.files.slice(0,3).join(", ")})]}))})]}),c&&e("div",{class:"card",children:[e("h3",{children:["cluster #",c.id," members"]}),e("div",{class:"list",style:{maxHeight:220},children:(d.members[String(c.id)]??[]).map(u=>e("div",{class:"item",onClick:()=>j("explore",{file:u.path}),children:e("div",{class:"p",children:[u.path," ",e("span",{class:"muted",children:["\xB7 heat ",u.score.toFixed(2)]})]})}))})]}),e("div",{class:"card",children:[e("h3",{children:["import cycles \xB7 ",d.cycles.length]}),d.cycles.length?e("div",{class:"list",style:{maxHeight:220},children:d.cycles.map((u,h)=>e("div",{class:M("item",i===h&&"sel"),onClick:()=>{r(i===h?null:h),s(null)},children:e("div",{class:"p",children:[u.length," files: ",u.slice(0,4).join(" \u2192 "),u.length>4?" \u2026":""]})}))}):e("div",{class:"muted small",children:"none"}),i!==null?e("button",{type:"button",class:"sm",style:{marginTop:6},onClick:()=>r(null),children:"show clusters"}):null]})]})]})}function br({id:t,depth:n,onSelect:s,selected:i}){let r=z(()=>P("/api/behavior",{id:t}),[t]),[a,o]=A(new Set);if(r.error)return e("div",{class:"muted small",children:r.error});if(!r.data)return e(B,{});let l=r.data;return e(L,{children:[n===0&&e("div",{class:M("bnode",i===l.root.id&&"sel"),onClick:()=>s(l),children:[e(I,{children:"start"}),e(ge,{kind:l.root.kind}),e("b",{children:l.root.label}),e("span",{class:"muted small",children:l.root.path})]}),e("div",{class:"kids",children:l.callees.length?l.callees.map(d=>{let c=a.has(d.node.id);return e(L,{children:[e("div",{class:M("bnode",i===d.node.id&&"sel"),onClick:()=>s({root:d.node,callees:[]}),children:[e("span",{class:"arrow",onClick:u=>{u.stopPropagation(),o(h=>{let g=new Set(h);return g.has(d.node.id)?g.delete(d.node.id):g.add(d.node.id),g})},children:d.node.kind==="package"||d.node.kind==="route"?"\xB7":c?"\u25BE":"\u25B8"}),e(I,{children:d.kind==="handles"?"handles":"possible call"}),e(ge,{kind:d.node.kind}),e("span",{children:d.node.label}),e("span",{class:"muted small",children:[d.lines?.length?`L${d.lines.join(", L")}`:"",d.count&&d.count>1?` \xD7${d.count}`:""]})]}),c&&n<6?e(br,{id:d.node.id,depth:n+1,onSelect:s,selected:i}):null]})}):e("div",{class:"muted small",style:{padding:"2px 6px"},children:"no resolved calls"})})]})}function ha({params:t}){let[n,s]=A(t.node??null),[i,r]=A(""),[a,o]=A([]),[l,d]=A(null);return O(()=>{if(i.trim().length<2)return o([]);let c=setTimeout(()=>{P("/api/nodes/search",{q:i.trim(),limit:10}).then(u=>o(u.filter(h=>h.kind!=="file"&&h.kind!=="package"))).catch(()=>o([]))},180);return()=>clearTimeout(c)},[i]),e("div",{class:"grid wide",style:{alignItems:"start"},children:[e("div",{class:"card",children:[e("div",{class:"row",style:{marginBottom:10,position:"relative"},children:[e("span",{class:"muted small",children:"Start"}),e("input",{type:"text",placeholder:"function or method\u2026",value:i,onInput:c=>r(c.target.value),style:{width:320}}),a.length>0&&e("div",{class:"suggest",style:{top:36,left:40},children:a.map(c=>e("div",{onMouseDown:()=>{s(c.id),r(""),o([]),d(null)},children:[e(ge,{kind:c.kind}),e("span",{class:"ellipsis",children:c.label}),e("span",{class:"path",children:c.path})]}))}),e("span",{class:"muted small",children:"Branches are possible static calls from the index, not an execution order."})]}),e("div",{class:"btree",children:n?e(br,{id:n,depth:0,onSelect:d,selected:l?.root.id??null}):e(G,{children:"Choose a starting operation."})})]}),e("div",{class:"card",children:[e("h3",{children:l?"selected operation":"starting operation"}),l?e(L,{children:[e("div",{class:"row tight",children:[e(ge,{kind:l.root.kind}),e("b",{class:"break",children:l.root.label})]}),e("div",{class:"muted small",children:[l.root.path,l.root.line?`:${l.root.line}`:"",l.root.endLine?`\u2013${l.root.endLine}`:""]}),l.root.complexity?e("div",{class:"row small",style:{marginTop:6},children:[e(I,{children:["complexity ",l.root.complexity]}),e(I,{children:[l.root.loc," loc"]})]}):null,e("div",{class:"row",style:{marginTop:8},children:[l.root.path?e("button",{type:"button",class:"sm",onClick:()=>j("explore",{file:l.root.path,line:l.root.line?String(l.root.line):void 0,symbol:l.root.id}),children:"Open definition"}):null,e("button",{type:"button",class:"sm",onClick:()=>{s(l.root.id),d(null)},children:"Start here"}),e("button",{type:"button",class:"sm",onClick:()=>j("galaxy",{node:l.root.id}),children:"Galaxy"})]})]}):e("div",{class:"muted small",children:"Click an operation in the tree."})]})]})}function yr({params:t}){let[n,s]=A(t.tab||"overview");O(()=>{t.tab&&s(t.tab)},[t.tab]);let i=z(()=>P("/api/tree"),[]),r=z(()=>P("/api/architecture",{aspects:"overview,entry_points"}),[]);return e("div",{class:"page",children:[e(Te,{tabs:[["overview","Overview"],["routes","Routes"],["hotspots","Hotspots"],["structure","System structure"],["behavior","Behavior"]],value:n,onChange:s}),n==="overview"&&(i.data?e(ca,{files:i.data.files,arch:r.data}):i.error?e(q,{error:i.error}):e(B,{})),n==="routes"&&e(da,{}),n==="hotspots"&&e(ua,{}),n==="structure"&&e(pa,{}),n==="behavior"&&e(ha,{params:t})]})}function vr(){let t=z(()=>P("/api/coverage"),[]),[n,s]=A(""),[i,r]=A(""),[a,o]=A(null),l=Y(()=>{let p=i.trim().toLowerCase();return(t.data?.files??[]).filter(v=>(!n||v.status===n)&&(!p||v.path.toLowerCase().includes(p)||(v.reason??"").toLowerCase().includes(p)))},[t.data,n,i]),{sorted:d,th:c}=Ve(l,"path",!1),u=async(p,v)=>{o(p);try{let b=await be("/api/actions",v);J(b.output.split(`
|
|
3
|
+
`)[0]??"done",!b.ok),t.reload()}catch(b){J(b.message,!0)}finally{o(null)}};if(t.error)return e("div",{class:"page",children:e(q,{error:t.error})});let h=t.data;if(!h)return e("div",{class:"page",children:e(B,{})});let g=h.summary.byStatus,f=Object.values(g).reduce((p,v)=>p+v,0),x=h.freshness.headMatches&&!h.freshness.dirty.length&&!h.freshness.queued,m=[["indexed",g.indexed??0,"parsed into the graph and search"],["partial",g.partial??0,"indexed, syntax errors recovered"],["skipped",g.skipped??0,"too large or parser error"],["unsupported",g.unsupported??0,"matched by globs, no parser"]];return e("div",{class:"page",children:[e("div",{class:"grid",children:[m.map(([p,v,b])=>e("div",{class:M("card"),style:{cursor:"pointer"},onClick:()=>s(n===p?"":p),children:[e("h3",{children:[p,n===p?e("span",{class:"right",children:"filtering"}):null]}),e("div",{class:M("big",p==="skipped"&&v>0&&"bad",p==="partial"&&v>0&&"warn"),children:v}),e("div",{class:"sub",children:b})]})),e("div",{class:"card",children:[e("h3",{children:"freshness"}),e("div",{class:M("big",x?"ok":"warn"),children:x?"fresh":h.freshness.dirty.length||h.freshness.queued?"stale":"git behind"}),e("div",{class:"sub",children:[h.freshness.dirty.length," changed \xB7 ",h.freshness.queued," queued"]})]})]}),e("div",{class:"grid wide",children:[e("div",{class:"card",children:[e("h3",{children:["files"," ",e("span",{class:"right",children:[d.length," of ",f]})]}),e("div",{class:"row",style:{marginBottom:8},children:[e("input",{type:"search",class:"grow",placeholder:"filter by path or reason\u2026",value:i,onInput:p=>r(p.target.value)}),e("select",{value:n,onChange:p=>s(p.target.value),children:[e("option",{value:"",children:"any status"}),["indexed","partial","skipped","unsupported"].map(p=>e("option",{value:p,children:p}))]}),e("button",{type:"button",disabled:!!a,onClick:()=>u("code",{action:"reindex",scope:"code"}),children:a==="code"?e(B,{}):"Reindex code"}),e("button",{type:"button",disabled:!!a,onClick:()=>u("full",{action:"reindex",scope:"code",full:!0}),children:a==="full"?e(B,{}):"Full reindex"})]}),e("div",{class:"list",style:{maxHeight:560},children:e("table",{children:[e("thead",{children:e("tr",{children:[c("path","path"),c("status","status"),c("reason","reason"),c("symbols","symbols",!0),c("size","size",!0),c("indexed_at","indexed",!0),e("th",{})]})}),e("tbody",{children:d.length?d.slice(0,500).map(p=>e("tr",{children:[e("td",{class:"break",children:e("a",{onClick:()=>j("explore",{file:p.path}),children:p.path})}),e("td",{children:e(I,{class:p.status==="indexed"?"s-accepted":p.status==="partial"?"s-proposed":"risk-high",children:p.status})}),e("td",{class:"muted small",children:[p.reason??"",p.errors?e("div",{class:"bad small",children:p.errors.slice(0,160)}):null]}),e("td",{class:"num",children:p.symbols??""}),e("td",{class:"num",children:K(p.size??0)}),e("td",{class:"num muted small",children:ne(p.indexed_at)}),e("td",{children:e("button",{type:"button",class:"sm",disabled:!!a,onClick:()=>u(p.path,{action:"reindex",scope:"code",paths:[p.path]}),children:a===p.path?e(B,{}):"reindex"})})]})):e("tr",{children:e("td",{colSpan:7,children:e(G,{children:"no files match"})})})})]})})]}),e("div",{class:"stack",children:[e("div",{class:"card",children:[e("h3",{children:"index state"}),e(Me,{rows:[["HEAD",h.freshness.head?.slice(0,10)??"no git"],["git signals at",h.freshness.indexedHead?`${h.freshness.indexedHead.slice(0,10)}${h.freshness.headMatches?" (current)":" (behind)"}`:"never"],["last run",h.freshness.lastRun?ne(h.freshness.lastRun):"never"],["queued",String(h.freshness.queued)],["last scan",h.scan?.at?`${ne(h.scan.at)} \xB7 ${h.scan.scanned} files \xB7 ${h.scan.durationMs} ms`:"n/a"]]})]}),h.freshness.dirty.length?e("div",{class:"card",children:[e("h3",{children:["changed since indexed \xB7 ",h.freshness.dirty.length]}),e("div",{class:"list",style:{maxHeight:200},children:h.freshness.dirty.map(p=>e("div",{class:"item",onClick:()=>j("explore",{file:p}),children:e("div",{class:"p",children:p})}))}),e("button",{type:"button",class:"sm",style:{marginTop:6},disabled:!!a,onClick:()=>u("dirty",{action:"reindex",scope:"code",paths:h.freshness.dirty}),children:a==="dirty"?e(B,{}):"Reindex changed files"})]}):null,h.summary.reasons.length?e("div",{class:"card",children:[e("h3",{children:"why files are not fully indexed"}),e("table",{children:e("tbody",{children:h.summary.reasons.map(p=>e("tr",{class:"click",onClick:()=>r(p.reason),children:[e("td",{children:p.reason}),e("td",{class:"num",children:p.n})]}))})})]}):null,e("div",{class:"card",children:[e("h3",{children:"scope"}),e("div",{class:"small",children:[e("div",{class:"muted",children:"include"}),e("div",{class:"mono break",children:(h.scan?.include??[]).join(" ")||"(defaults)"}),e("div",{class:"muted",style:{marginTop:4},children:"exclude"}),e("div",{class:"mono break",children:(h.scan?.exclude??[]).join(" ")||"(defaults)"}),e("div",{class:"muted",style:{marginTop:6},children:"Change them in eminiar.config.json under graph.include / graph.exclude. A clean coverage result means no recorded gap, not proof of completeness."})]})]})]})]})]})}var dt=[{id:"readme",group:"project",label:"Readme & guides",blurb:"README, CONTRIBUTING, CHANGELOG and other top-level guides"},{id:"guides",group:"project",label:"Docs folders",blurb:"docs/ directories: handbooks, how-tos, references"},{id:"adr",group:"project",label:"Decision records",blurb:"architecture decision records"},{id:"agent-instructions",group:"project",label:"Agent instructions",blurb:"Copilot, Claude and Cursor instructions, agents and skills"},{id:"api-specs",group:"project",label:"API specs",blurb:"OpenAPI, Postman, GraphQL and protobuf definitions"},{id:"env-reference",group:"project",label:"Environment reference",blurb:".env examples: every variable the project reads"},{id:"deploy-config",group:"project",label:"Deploy config",blurb:"Terraform, Kubernetes, Helm, Compose and CI workflows"},{id:"local",group:"project",label:"Other local files",blurb:"hand-registered paths"},{id:"service",group:"external",label:"Services",blurb:"third-party products and APIs the project integrates"},{id:"api",group:"external",label:"External APIs",blurb:"hosts the code calls, found by probing their docs"},{id:"infra",group:"external",label:"Infrastructure",blurb:"platforms the project runs on"},{id:"library",group:"external",label:"Libraries",blurb:"frameworks and packages"},{id:"web",group:"external",label:"Web pages",blurb:"hand-registered URLs"}],kr=new Map(dt.map(t=>[t.id,t]));function xr(t){return kr.get(t)??kr.get("local")}var _r={project:"Project documentation",external:"External documentation"};function Cn(t){let n=dt.findIndex(s=>s.id===t);return n===-1?dt.length:n}var ma={url:"#2563eb",path:"#16a34a"},ga={catalog:"#16a34a",probe:"#2563eb",registry:"#d97706",unknown:"#6b7280"};function Sr({kind:t}){return e("span",{class:"tag kind",style:{color:ma[t]??"#6b7280"},children:t})}function Tr({urls:t}){return e("span",{class:"break",children:t.map((n,s)=>e(L,{children:[s?", ":"",e("a",{href:n,target:"_blank",rel:"noreferrer",children:n})]}))})}function fa({s:t,busy:n,onSync:s,onRemove:i}){let r=z(()=>P("/api/docs/pages",{name:t.name}),[t.name,t.sync?.at]),a=[["kind",e(Sr,{kind:t.kind})],...t.provider?[["provider",t.provider]]:[],...t.title?[["title",t.title]]:[],t.kind==="url"?["seeds",e(Tr,{urls:t.urls??[]})]:["path",`${t.path}${t.glob?.length?` [${t.glob.join(", ")}]`:""}`],...t.kind==="url"?[["crawl",`depth ${t.crawl?.depth??"default"}, max ${t.crawl?.maxPages??"default"} pages, ttl ${t.ttlHours??"default"} h`]]:[],...t.tags?.length?[["tags",t.tags.join(", ")]]:[],["added",t.addedAt.slice(0,10)],["last sync",t.sync?`${ne(t.sync.at)} \xB7 ${t.sync.pages} ${t.kind==="url"?"pages":"files"} \xB7 ${t.sync.documents} docs \xB7 ${t.sync.chunks} chunks \xB7 ${t.sync.ms} ms${t.sync.errors.length?` \xB7 ${t.sync.errors.length} error(s)`:""}`:"never"]];return e("div",{children:[e("div",{class:"row",style:{marginBottom:6},children:[e("b",{class:"grow break",children:t.name}),e("button",{type:"button",class:"sm",disabled:!!n,onClick:()=>s(!1),children:n===`sync ${t.name}`?e(B,{}):"sync"}),e("button",{type:"button",class:"sm",disabled:!!n,title:"refetch ignoring the cache and drop stale pages",onClick:()=>s(!0),children:"force"}),e("button",{type:"button",class:"sm danger",disabled:!!n,onClick:i,children:"remove"})]}),e(Me,{rows:a}),t.sync?.errors.length?e("pre",{class:"log",style:{marginTop:8},children:t.sync.errors.join(`
|
|
4
|
+
`)}):null,e("h3",{style:{marginTop:12},children:["indexed pages ",e("span",{class:"muted small",children:["(",t.documents,")"]})]}),r.error?e(q,{error:r.error}):r.data?r.data.length?e("table",{children:[e("thead",{children:e("tr",{children:[e("th",{children:"title"}),e("th",{class:"num",children:"chunks"}),e("th",{children:"indexed"})]})}),e("tbody",{children:r.data.map(o=>e("tr",{children:[e("td",{class:"break",children:o.uri?.startsWith("http")?e("a",{href:o.uri,target:"_blank",rel:"noreferrer",children:o.title}):o.title}),e("td",{class:"num",children:o.chunks}),e("td",{class:"muted nowrap",children:he(o.created_at)})]}))})]}):e(G,{children:"nothing indexed yet \u2014 run sync"}):e(B,{})]})}function ba({onDone:t}){let[n,s]=A(""),[i,r]=A(""),[a,o]=A(""),[l,d]=A(""),[c,u]=A(""),[h,g]=A(""),[f,x]=A(""),[m,p]=A(""),[v,b]=A(!1);return e("div",{class:"card",children:[e("h3",{children:"add a source"}),e("div",{class:"grid",style:{gridTemplateColumns:"1fr 2fr 1fr",gap:8},children:[e("div",{class:"field",children:[e("label",{children:"name (optional)"}),e("input",{type:"text",placeholder:"moleculer",value:n,onInput:k=>s(k.target.value)})]}),e("div",{class:"field",children:[e("label",{children:"url(s) \u2014 one per line; same-origin pages under each are crawled"}),e("textarea",{rows:2,placeholder:"https://moleculer.services/docs/0.14/",value:i,onInput:k=>r(k.target.value)})]}),e("div",{class:"field",children:[e("label",{children:"or provider (npm:zod, pypi:fastapi, api:api.example.com)"}),e("input",{type:"text",value:c,onInput:k=>u(k.target.value)})]})]}),e("div",{class:"grid",style:{gridTemplateColumns:"2fr 2fr 1fr 1fr 2fr",gap:8},children:[e("div",{class:"field",children:[e("label",{children:"or local path"}),e("input",{type:"text",placeholder:"docs/",value:a,onInput:k=>o(k.target.value)})]}),e("div",{class:"field",children:[e("label",{children:"globs (comma separated)"}),e("input",{type:"text",placeholder:"**/*.md",value:l,onInput:k=>d(k.target.value)})]}),e("div",{class:"field",children:[e("label",{children:"crawl depth"}),e("input",{type:"number",min:0,max:3,value:h,onInput:k=>g(k.target.value)})]}),e("div",{class:"field",children:[e("label",{children:"max pages"}),e("input",{type:"number",min:1,max:200,value:f,onInput:k=>x(k.target.value)})]}),e("div",{class:"field",children:[e("label",{children:"tags"}),e("input",{type:"text",value:m,onInput:k=>p(k.target.value)})]})]}),e("div",{class:"row",children:e("button",{type:"button",class:"primary",disabled:v,onClick:async()=>{let k=i.split(/\s+/).map(S=>S.trim()).filter(Boolean);if(!k.length&&!a.trim()&&!c.trim())return J("give a url, a path or a provider",!0);b(!0);try{let S=await be("/api/docs",{sources:[{name:n.trim()||void 0,urls:k.length?k:void 0,path:a.trim()||void 0,glob:l.trim()?l.split(",").map($=>$.trim()).filter(Boolean):void 0,provider:c.trim()||void 0,crawl:h||f?{depth:h?Number(h):void 0,maxPages:f?Number(f):void 0}:void 0,tags:m.trim()?m.split(",").map($=>$.trim()).filter(Boolean):void 0}],sync:!0});J(S.failed.length?S.failed[0].reason:`added ${[...S.added,...S.updated].join(", ")}`,!!S.failed.length),t(S),S.failed.length||(s(""),r(""),o(""),d(""),u(""))}catch(S){J(S.message,!0)}finally{b(!1)}},children:v?e(B,{}):"Add & index"})})]})}function Rn(t){let n=t.tags?.[0];return t.kind==="path"&&n&&(t.name===n||t.name.startsWith(`${n}-`))?n:t.name}function wr(t){if(t.kind==="path"){let s=t.path&&t.path!=="."?t.path:"",i=t.glob?.length?t.glob.length<=2?t.glob.join(", "):`${t.glob.length} globs`:"";return[s,i].filter(Boolean).join(" \xB7 ")||t.title||"project root"}return[...new Set((t.urls??[]).map(s=>s.replace(/^https?:\/\//,"").split("/")[0]))].join(", ")||t.provider||""}function ya({s:t,sel:n,onSelect:s}){let i=Rn(t);return e("div",{class:M("item",n&&"sel"),onClick:s,children:[e("div",{class:"n",children:[i,i!==t.name?e("span",{class:"muted small",children:[" ",t.name]}):null]}),e("div",{class:"p",title:t.kind==="url"?(t.urls??[]).join(`
|
|
5
|
+
`):wr(t),children:[e(Sr,{kind:t.kind}),t.provider?e("span",{class:"muted",children:[t.provider," \xB7 "]}):null,e("span",{class:"muted",children:wr(t)})]}),e("div",{class:"p",children:e("span",{class:"muted",children:[t.documents," docs \xB7 ",t.chunks," chunks \xB7"," ",t.sync?`synced ${ne(t.sync.at)}`:"never synced",t.sync?.errors.length?e("span",{class:"bad",children:[" \xB7 ",t.sync.errors.length," errors"]}):null]})})]})}function va({params:t,onLog:n}){let s=z(()=>P("/api/docs"),[]),[i,r]=A(t.name??null),[a,o]=A(""),[l,d]=A(!1),[c,u]=A(null);O(()=>{t.name&&r(t.name)},[t.name]);let[h,g]=A("all"),[f,x]=A(new Set),m=s.data,p=Y(()=>{let _=a.trim().toLowerCase();return(m?.sources??[]).filter(E=>(h==="all"||E.category===h)&&(!_||E.name.includes(_)||(E.title??"").toLowerCase().includes(_)||(E.provider??"").includes(_)||(E.tags??[]).some(R=>R.includes(_))||(E.urls??[]).some(R=>R.includes(_))||(E.path??"").includes(_)))},[m,a,h]),v=Y(()=>{let _=new Map;for(let E of m?.sources??[])_.set(E.category,(_.get(E.category)??0)+1);return _},[m]),b=Y(()=>{let _=new Map;for(let T of p){let C=_.get(T.category)??[];C.push(T),_.set(T.category,C)}let E=[..._.entries()].sort((T,C)=>Cn(T[0])-Cn(C[0])).map(([T,C])=>({info:xr(T),items:C.sort((w,F)=>Rn(w).localeCompare(Rn(F)))})),R=[];for(let T of E){let C=R[R.length-1];C?.group===T.info.group?C.cats.push(T):R.push({group:T.info.group,label:_r[T.info.group],cats:[T]})}return R},[p]),y=_=>x(E=>{let R=new Set(E);return R.has(_)?R.delete(_):R.add(_),R}),k=p.find(_=>_.name===i)??m?.sources.find(_=>_.name===i),S=async(_,E)=>{let R=_?.length===1?`sync ${_[0]}`:"sync all";u(R);try{let T=await be("/api/docs/sync",{names:_,force:E});n(T.text),J(`${R} done`),s.reload()}catch(T){J(T.message,!0)}finally{u(null)}},$=async _=>{if(confirm(`Remove documentation source "${_}" and its indexed pages?`))try{let E=await Ft("/api/docs",{name:_});J(`removed ${_} (${E.documents} document(s))`),r(null),s.reload()}catch(E){J(E.message,!0)}};return s.error?e(q,{error:s.error}):e(L,{children:[e("div",{class:"row",style:{marginBottom:12},children:[e("button",{type:"button",class:"primary",onClick:()=>d(_=>!_),children:l?"close":"+ Add source"}),e("button",{type:"button",disabled:!!c||!m?.sources.length,onClick:()=>S(void 0,!1),children:c==="sync all"?e(B,{}):"\u21BB Sync all"}),e("input",{type:"search",class:"grow",placeholder:"filter by name, provider, tag or url\u2026",value:a,onInput:_=>o(_.target.value)}),e("span",{class:"muted small nowrap",children:m?`${m.sources.length} sources \xB7 ${K(m.totals.documents)} docs \xB7 ${K(m.totals.chunks)} chunks \xB7 ${m.manifest}`:""})]}),m?.sources.length?e("div",{class:"row wrap",style:{marginBottom:10,gap:4},children:[e("button",{type:"button",class:M("chip",h==="all"&&"on"),onClick:()=>g("all"),children:["All \xB7 ",m.sources.length]}),dt.filter(_=>v.get(_.id)).map(_=>e("button",{type:"button",class:M("chip",h===_.id&&"on"),title:_.blurb,onClick:()=>g(h===_.id?"all":_.id),children:[_.label," \xB7 ",v.get(_.id)]}))]}):null,l&&e(ba,{onDone:_=>{n(_.text),s.reload();let E=[..._.added,..._.updated][0];E&&r(E)}}),m?.orphans.length?e("div",{class:"empty",style:{marginBottom:12},children:["indexed under docs: but missing from the manifest:"," ",m.orphans.map(_=>`${_.source} (${_.documents})`).join(", ")," \u2014 re-add them or purge the index."]}):null,e("div",{class:"grid wide",style:{gridTemplateColumns:"minmax(280px,1fr) minmax(0,2fr)",alignItems:"start"},children:[e("div",{class:"card flush",children:e("div",{class:"list",children:m?p.length?b.map(_=>e(L,{children:[b.length>1?e("div",{class:"group-h",children:_.label}):null,_.cats.map(({info:E,items:R})=>{let T=!f.has(E.id);return e(L,{children:[e("div",{class:M("cat-h",!T&&"closed"),title:E.blurb,onClick:()=>y(E.id),children:[e("span",{class:"caret",children:T?"\u25BE":"\u25B8"}),E.label,e("span",{class:"muted",children:[" \xB7 ",R.length]}),e("span",{class:"muted small right",children:[K(R.reduce((C,w)=>C+w.documents,0))," docs"]})]}),T?R.map(C=>e(ya,{s:C,sel:i===C.name,onSelect:()=>r(C.name)})):null]})})]})):e(G,{children:m.sources.length?"no sources match":"No documentation sources yet. Use Discover, or add a url, path or provider."}):e(G,{children:e(B,{})})})}),e("div",{class:"card",children:k?e(fa,{s:k,busy:c,onSync:_=>S([k.name],_),onRemove:()=>$(k.name)}):e(G,{children:"Select a source to see its pages and sync state."})})]})]})}function ka({onLog:t,onAdded:n}){let[s,i]=A(!1),[r,a]=A(!1),o=z(()=>r?P("/api/docs/discover",{dev:s?1:void 0}):Promise.resolve(void 0),[r,s]),[l,d]=A(new Set),[c,u]=A({}),[h,g]=A(!1),f=o.data;O(()=>{if(!f)return;let y=new Set;for(let k of f.local)k.registered||y.add(`local:${k.name}`);for(let k of f.providers)!k.registered&&(k.confidence==="probe"||k.confidence==="catalog"&&k.tier!=="library"&&k.tier!=="infra")&&y.add(`prov:${k.name}`);d(y)},[f]);let x=y=>d(k=>{let S=new Set(k);return S.has(y)?S.delete(y):S.add(y),S}),m=async()=>{if(!f)return;let y=[];for(let k of f.local)l.has(`local:${k.name}`)&&y.push({name:k.name,path:k.path,glob:k.glob,title:k.why,tags:k.project?[k.project]:void 0});for(let k of f.providers){if(!l.has(`prov:${k.name}`))continue;let S=c[k.name]?.trim(),$=S?S.split(/\s+/).filter(Boolean):k.urls.length?k.urls:void 0;!$&&k.confidence==="unknown"||y.push({name:k.name,provider:k.provider,urls:$,title:k.title,crawl:k.crawl})}if(!y.length)return J("nothing selected",!0);g(!0),t(`adding ${y.length} source(s)\u2026`);try{let k=await be("/api/docs",{sources:y,sync:!0});t(k.text),J(`${k.added.length+k.updated.length} added${k.failed.length?`, ${k.failed.length} failed`:""}`,!!k.failed.length&&!k.added.length),n(),a(!1),setTimeout(()=>a(!0),0)}catch(k){J(k.message,!0)}finally{g(!1)}},p=y=>(f?.providers??[]).filter(k=>k.confidence===y),v=({keyId:y,title:k,meta:S,right:$,registered:_})=>e("tr",{class:M(_&&"muted"),children:[e("td",{style:{width:24},children:e("input",{type:"checkbox",disabled:_,checked:l.has(y),onChange:()=>x(y)})}),e("td",{class:"break",children:[k,_?e("span",{class:"tag",children:" registered"}):null]}),e("td",{class:"break muted small",children:S}),e("td",{children:$??null})]}),b=({conf:y,note:k})=>{let S=p(y);return S.length?e("div",{class:"card flush",style:{marginBottom:12},children:[e("h3",{style:{padding:"10px 12px 0"},children:[e("span",{class:"tag kind",style:{color:ga[y]},children:y})," ",y==="catalog"?"libraries, services and infrastructure":y==="probe"?"third-party APIs called from code":y==="registry"?"packages resolved through npm / PyPI / Go":"unknown env prefixes and images"," ",e("span",{class:"muted small",children:["\u2014 ",k]})]}),e("table",{children:e("tbody",{children:S.map($=>e(v,{keyId:`prov:${$.name}`,registered:$.registered,title:e(L,{children:[e("b",{children:$.name})," ",e("span",{class:"muted small",children:["\u2190 ",$.provider]})]}),meta:e(L,{children:[$.title,$.usedBy.length>1?` \xB7 used by ${$.usedBy.length} projects`:$.usedBy[0]&&$.usedBy[0]!=="."?` \xB7 ${$.usedBy[0]}`:"",$.urls.length?e(L,{children:[" \xB7 ",e(Tr,{urls:$.urls.slice(0,2)})]}):y==="probe"||y==="unknown"?` \xB7 ${$.evidence[0]}`:""]}),right:y==="unknown"||y==="probe"?e("input",{type:"text",placeholder:y==="probe"?"docs url (optional; probed if empty)":"docs url",style:{minWidth:220},value:c[$.name]??"",onInput:_=>u({...c,[$.name]:_.target.value})}):void 0}))})})]}):null};return e(L,{children:[e("div",{class:"row",style:{marginBottom:12},children:[e("button",{type:"button",class:"primary",disabled:o.loading&&r,onClick:()=>r?o.reload():a(!0),children:o.loading&&r?e(B,{}):r?"\u21BB Scan again":"Scan project"}),e("label",{class:"small",children:[e("input",{type:"checkbox",checked:s,onChange:y=>i(y.target.checked)})," ","include devDependencies"]}),e("span",{class:"spacer"}),f?e(L,{children:[e("span",{class:"muted small",children:[f.projects.length>1?`${f.projects.length} projects \xB7 `:"",f.local.length," local \xB7 ",f.providers.length," providers \xB7 ",l.size," selected"]}),e("button",{type:"button",class:"primary",disabled:h||!l.size,onClick:m,children:h?e(B,{}):"Add selected & index"})]}):null]}),o.error?e(q,{error:o.error}):null,r?f?e(L,{children:[f.local.length?e("div",{class:"card flush",style:{marginBottom:12},children:[e("h3",{style:{padding:"10px 12px 0"},children:["local documentation ",e("span",{class:"muted small",children:"\u2014 indexed from the working tree"})]}),e("table",{children:e("tbody",{children:f.local.map(y=>e(v,{keyId:`local:${y.name}`,registered:y.registered,title:e(L,{children:[e("b",{children:y.name})," ",e("span",{class:"muted small",children:y.path})]}),meta:`${y.files} file(s) \xB7 ${K(y.bytes)} B \xB7 ${y.why}${y.glob&&y.glob.length<=4?` \xB7 ${y.glob.join(", ")}`:""}`}))})})]}):null,e(b,{conf:"catalog",note:"documentation URLs known offline"}),e(b,{conf:"probe",note:"docs., developer. and /docs locations are probed when added; give a url to skip the guess"}),e(b,{conf:"registry",note:"homepage and README come from the package registry when added"}),e(b,{conf:"unknown",note:"needs a documentation url"})]}):e(B,{}):e(G,{children:"Scans the project (and one level of sub-projects) for READMEs, docs folders, ADRs, API specs, agent instructions and env references, plus the npm / PyPI / Go packages, env var prefixes, container images, infrastructure files and outbound API calls \u2014 and maps each to its documentation. Nothing is fetched until you add."})]})}function xa({sources:t}){let[n,s]=A(""),[i,r]=A(""),[a,o]=A(""),l=z(()=>a?P("/api/search",{q:a,source:i?`docs:${i}`:"docs:*",limit:15}):Promise.resolve(void 0),[a,i]);return e(L,{children:[e("div",{class:"row",style:{marginBottom:12},children:[e("input",{type:"search",class:"grow",placeholder:"ask the documentation\u2026 (hybrid keyword + semantic)",value:n,onInput:d=>s(d.target.value),onKeyDown:d=>{d.key==="Enter"&&o(n.trim())}}),e("select",{value:i,onChange:d=>r(d.target.value),children:[e("option",{value:"",children:"all documentation"}),t.map(d=>e("option",{value:d,children:d}))]}),e("button",{type:"button",class:"primary",onClick:()=>o(n.trim()),children:"Search"})]}),l.error?e(q,{error:l.error}):null,a?l.data?l.data.hits.length?e("div",{class:"stack",children:[l.data.corrections.length?e("div",{class:"muted small",children:["corrected: ",l.data.corrections.map(d=>`${d.from}\u2192${d.to}`).join(", ")]}):null,l.data.hits.map(d=>e("div",{class:"card hit",children:[e("div",{class:"row tight",children:[e("b",{class:"break",children:d.uri?.startsWith("http")?e("a",{href:d.uri,target:"_blank",rel:"noreferrer",children:d.title}):d.title}),e("span",{class:"tag",children:d.source.replace(/^docs:/,"")}),e("span",{class:"muted small",children:["doc ",d.doc," \xB7 ",d.score.toFixed(3)]})]}),e("pre",{class:"json",style:{whiteSpace:"pre-wrap",fontFamily:"inherit",fontSize:13,marginTop:4},children:d.snippet})]}))]}):e(G,{children:"no matches"}):e(B,{}):e(G,{children:"Searches only the documentation sources (source docs:*). Claude uses the same index through em_docs lookup."})]})}function Er({params:t}){let[n,s]=A(t.tab??"sources"),[i,r]=A([]),[a,o]=A(0),l=z(()=>P("/api/docs"),[a]),d=c=>r(u=>[...u,`[${new Date().toLocaleTimeString()}]
|
|
6
|
+
${c}`]);return e("div",{class:"page",children:[e(Te,{tabs:[["sources","Sources"],["discover","Discover"],["search","Search"]],value:n,onChange:c=>{s(c),j("docs",{tab:c})}}),n==="sources"&&e(va,{params:t,onLog:d},a),n==="discover"&&e(ka,{onLog:d,onAdded:()=>o(c=>c+1)}),n==="search"&&e(xa,{sources:(l.data?.sources??[]).map(c=>c.name)}),i.length?e("div",{class:"card",style:{marginTop:12},children:[e("h3",{children:["sync log"," ",e("button",{type:"button",class:"sm right",onClick:()=>r([]),children:"clear"})]}),e("pre",{class:"log",children:i.join(`
|
|
7
7
|
|
|
8
|
-
`)})]}):null]})}var Fn=Fi(Ar(),1);Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));Prism.languages.js=Prism.languages.javascript;(function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var n=t.languages.extend("typescript",{});delete n["class-name"],t.languages.typescript["class-name"].inside=n,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:n}}}}),t.languages.ts=t.languages.typescript})(Prism);(function(t){var n=t.util.clone(t.languages.javascript),s=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,i=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,r=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function a(d,c){return d=d.replace(/<S>/g,function(){return s}).replace(/<BRACES>/g,function(){return i}).replace(/<SPREAD>/g,function(){return r}),RegExp(d,c)}r=a(r).source,t.languages.jsx=t.languages.extend("markup",n),t.languages.jsx.tag.pattern=a(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),t.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,t.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,t.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,t.languages.jsx.tag.inside.comment=n.comment,t.languages.insertBefore("inside","attr-name",{spread:{pattern:a(/<SPREAD>/.source),inside:t.languages.jsx}},t.languages.jsx.tag),t.languages.insertBefore("inside","special-attr",{script:{pattern:a(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:t.languages.jsx}}},t.languages.jsx.tag);var o=function(d){return d?typeof d=="string"?d:typeof d.content=="string"?d.content:d.content.map(o).join(""):""},l=function(d){for(var c=[],u=0;u<d.length;u++){var h=d[u],g=!1;if(typeof h!="string"&&(h.type==="tag"&&h.content[0]&&h.content[0].type==="tag"?h.content[0].content[0].content==="</"?c.length>0&&c[c.length-1].tagName===o(h.content[0].content[1])&&c.pop():h.content[h.content.length-1].content==="/>"||c.push({tagName:o(h.content[0].content[1]),openedBraces:0}):c.length>0&&h.type==="punctuation"&&h.content==="{"?c[c.length-1].openedBraces++:c.length>0&&c[c.length-1].openedBraces>0&&h.type==="punctuation"&&h.content==="}"?c[c.length-1].openedBraces--:g=!0),(g||typeof h=="string")&&c.length>0&&c[c.length-1].openedBraces===0){var f=o(h);u<d.length-1&&(typeof d[u+1]=="string"||d[u+1].type==="plain-text")&&(f+=o(d[u+1]),d.splice(u+1,1)),u>0&&(typeof d[u-1]=="string"||d[u-1].type==="plain-text")&&(f=o(d[u-1])+f,d.splice(u-1,1),u--),d[u]=new t.Token("plain-text",f,null,f)}h.content&&typeof h.content!="string"&&l(h.content)}};t.hooks.add("after-tokenize",function(d){d.language!=="jsx"&&d.language!=="tsx"||l(d.tokens)})})(Prism);(function(t){var n=t.util.clone(t.languages.typescript);t.languages.tsx=t.languages.extend("jsx",n),delete t.languages.tsx.parameter,delete t.languages.tsx["literal-property"];var s=t.languages.tsx.tag;s.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+s.pattern.source+")",s.pattern.flags),s.lookbehind=!0})(Prism);Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/};Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python;Prism.languages.py=Prism.languages.python;Prism.languages.go=Prism.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/});Prism.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}});delete Prism.languages.go["class-name"];Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}};Prism.languages.webmanifest=Prism.languages.json;(function(t){var n=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function s(u){return u=u.replace(/<inner>/g,function(){return n}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+u+")")}var i=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,r=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return i}),a=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;t.languages.markdown=t.languages.extend("markup",{}),t.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+r+a+"(?:"+r+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+r+a+")(?:"+r+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(i),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+r+")"+a+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+r+"$"),inside:{"table-header":{pattern:RegExp(i),alias:"important",inside:t.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:s(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:s(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:s(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:s(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(u){["url","bold","italic","strike","code-snippet"].forEach(function(h){u!==h&&(t.languages.markdown[u].inside.content.inside[h]=t.languages.markdown[h])})}),t.hooks.add("after-tokenize",function(u){if(u.language!=="markdown"&&u.language!=="md")return;function h(g){if(!(!g||typeof g=="string"))for(var f=0,x=g.length;f<x;f++){var m=g[f];if(m.type!=="code"){h(m.content);continue}var p=m.content[1],y=m.content[3];if(p&&y&&p.type==="code-language"&&y.type==="code-block"&&typeof p.content=="string"){var v=p.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");v=(/[a-z][\w-]*/i.exec(v)||[""])[0].toLowerCase();var b="language-"+v;y.alias?typeof y.alias=="string"?y.alias=[y.alias,b]:y.alias.push(b):y.alias=[b]}}}h(u.tokens)}),t.hooks.add("wrap",function(u){if(u.type==="code-block"){for(var h="",g=0,f=u.classes.length;g<f;g++){var x=u.classes[g],m=/language-(.+)/.exec(x);if(m){h=m[1];break}}var p=t.languages[h];if(p)u.content=t.highlight(c(u.content),p,h);else if(h&&h!=="none"&&t.plugins.autoloader){var y="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);u.attributes.id=y,t.plugins.autoloader.loadLanguages(h,function(){var v=document.getElementById(y);v&&(v.innerHTML=t.highlight(v.textContent,t.languages[h],h))})}}});var o=RegExp(t.languages.markup.tag.pattern.source,"gi"),l={amp:"&",lt:"<",gt:">",quot:'"'},d=String.fromCodePoint||String.fromCharCode;function c(u){var h=u.replace(o,"");return h=h.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(g,f){if(f=f.toLowerCase(),f[0]==="#"){var x;return f[1]==="x"?x=parseInt(f.slice(2),16):x=Number(f.slice(1)),d(x)}else{var m=l[f];return m||g}}),h}t.languages.md=t.languages.markdown})(Prism);(function(t){var n="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",s={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},i={bash:s,environment:{pattern:RegExp("\\$"+n),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+n),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};t.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+n),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:i},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:s}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:i},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:i.entity}}],environment:{pattern:RegExp("\\$?"+n),alias:"constant"},variable:i.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},s.inside=t.languages.bash;for(var r=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],a=i.variable[1].inside,o=0;o<r.length;o++)a[r[o]]=t.languages.bash[r[o]];t.languages.sh=t.languages.bash,t.languages.shell=t.languages.bash})(Prism);var wa=t=>t.replace(/[&<>]/g,n=>({"&":"&","<":"<",">":">"})[n]??n);function jt(t,n){let s=Fn.default.languages[n];if(!s)return t.split(`
|
|
8
|
+
`)})]}):null]})}var Fn=Fi($r(),1);Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));Prism.languages.js=Prism.languages.javascript;(function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var n=t.languages.extend("typescript",{});delete n["class-name"],t.languages.typescript["class-name"].inside=n,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:n}}}}),t.languages.ts=t.languages.typescript})(Prism);(function(t){var n=t.util.clone(t.languages.javascript),s=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,i=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,r=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function a(d,c){return d=d.replace(/<S>/g,function(){return s}).replace(/<BRACES>/g,function(){return i}).replace(/<SPREAD>/g,function(){return r}),RegExp(d,c)}r=a(r).source,t.languages.jsx=t.languages.extend("markup",n),t.languages.jsx.tag.pattern=a(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),t.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,t.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,t.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,t.languages.jsx.tag.inside.comment=n.comment,t.languages.insertBefore("inside","attr-name",{spread:{pattern:a(/<SPREAD>/.source),inside:t.languages.jsx}},t.languages.jsx.tag),t.languages.insertBefore("inside","special-attr",{script:{pattern:a(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:t.languages.jsx}}},t.languages.jsx.tag);var o=function(d){return d?typeof d=="string"?d:typeof d.content=="string"?d.content:d.content.map(o).join(""):""},l=function(d){for(var c=[],u=0;u<d.length;u++){var h=d[u],g=!1;if(typeof h!="string"&&(h.type==="tag"&&h.content[0]&&h.content[0].type==="tag"?h.content[0].content[0].content==="</"?c.length>0&&c[c.length-1].tagName===o(h.content[0].content[1])&&c.pop():h.content[h.content.length-1].content==="/>"||c.push({tagName:o(h.content[0].content[1]),openedBraces:0}):c.length>0&&h.type==="punctuation"&&h.content==="{"?c[c.length-1].openedBraces++:c.length>0&&c[c.length-1].openedBraces>0&&h.type==="punctuation"&&h.content==="}"?c[c.length-1].openedBraces--:g=!0),(g||typeof h=="string")&&c.length>0&&c[c.length-1].openedBraces===0){var f=o(h);u<d.length-1&&(typeof d[u+1]=="string"||d[u+1].type==="plain-text")&&(f+=o(d[u+1]),d.splice(u+1,1)),u>0&&(typeof d[u-1]=="string"||d[u-1].type==="plain-text")&&(f=o(d[u-1])+f,d.splice(u-1,1),u--),d[u]=new t.Token("plain-text",f,null,f)}h.content&&typeof h.content!="string"&&l(h.content)}};t.hooks.add("after-tokenize",function(d){d.language!=="jsx"&&d.language!=="tsx"||l(d.tokens)})})(Prism);(function(t){var n=t.util.clone(t.languages.typescript);t.languages.tsx=t.languages.extend("jsx",n),delete t.languages.tsx.parameter,delete t.languages.tsx["literal-property"];var s=t.languages.tsx.tag;s.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+s.pattern.source+")",s.pattern.flags),s.lookbehind=!0})(Prism);Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/};Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python;Prism.languages.py=Prism.languages.python;Prism.languages.go=Prism.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/});Prism.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}});delete Prism.languages.go["class-name"];(function(t){function n(s,i){return"___"+s.toUpperCase()+i+"___"}Object.defineProperties(t.languages["markup-templating"]={},{buildPlaceholders:{value:function(s,i,r,a){if(s.language===i){var o=s.tokenStack=[];s.code=s.code.replace(r,function(l){if(typeof a=="function"&&!a(l))return l;for(var d=o.length,c;s.code.indexOf(c=n(i,d))!==-1;)++d;return o[d]=l,c}),s.grammar=t.languages.markup}}},tokenizePlaceholders:{value:function(s,i){if(s.language!==i||!s.tokenStack)return;s.grammar=t.languages[i];var r=0,a=Object.keys(s.tokenStack);function o(l){for(var d=0;d<l.length&&!(r>=a.length);d++){var c=l[d];if(typeof c=="string"||c.content&&typeof c.content=="string"){var u=a[r],h=s.tokenStack[u],g=typeof c=="string"?c:c.content,f=n(i,u),x=g.indexOf(f);if(x>-1){++r;var m=g.substring(0,x),p=new t.Token(i,t.tokenize(h,s.grammar),"language-"+i,h),v=g.substring(x+f.length),b=[];m&&b.push.apply(b,o([m])),b.push(p),v&&b.push.apply(b,o([v])),typeof c=="string"?l.splice.apply(l,[d,1].concat(b)):c.content=b}}else c.content&&o(c.content)}return l}o(s.tokens)}}})})(Prism);(function(t){var n=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,s=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],i=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,r=/<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,a=/[{}\[\](),:;]/;t.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:n,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:s,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:i,operator:r,punctuation:a};var o={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:t.languages.php},l=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:o}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:o}}];t.languages.insertBefore("php","variable",{string:l,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:n,string:l,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:s,number:i,operator:r,punctuation:a}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),t.hooks.add("before-tokenize",function(d){if(/<\?/.test(d.code)){var c=/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;t.languages["markup-templating"].buildPlaceholders(d,"php",c)}}),t.hooks.add("after-tokenize",function(d){t.languages["markup-templating"].tokenizePlaceholders(d,"php")})})(Prism);Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}};Prism.languages.webmanifest=Prism.languages.json;(function(t){var n=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function s(u){return u=u.replace(/<inner>/g,function(){return n}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+u+")")}var i=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,r=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return i}),a=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;t.languages.markdown=t.languages.extend("markup",{}),t.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+r+a+"(?:"+r+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+r+a+")(?:"+r+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(i),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+r+")"+a+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+r+"$"),inside:{"table-header":{pattern:RegExp(i),alias:"important",inside:t.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:s(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:s(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:s(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:s(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(u){["url","bold","italic","strike","code-snippet"].forEach(function(h){u!==h&&(t.languages.markdown[u].inside.content.inside[h]=t.languages.markdown[h])})}),t.hooks.add("after-tokenize",function(u){if(u.language!=="markdown"&&u.language!=="md")return;function h(g){if(!(!g||typeof g=="string"))for(var f=0,x=g.length;f<x;f++){var m=g[f];if(m.type!=="code"){h(m.content);continue}var p=m.content[1],v=m.content[3];if(p&&v&&p.type==="code-language"&&v.type==="code-block"&&typeof p.content=="string"){var b=p.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");b=(/[a-z][\w-]*/i.exec(b)||[""])[0].toLowerCase();var y="language-"+b;v.alias?typeof v.alias=="string"?v.alias=[v.alias,y]:v.alias.push(y):v.alias=[y]}}}h(u.tokens)}),t.hooks.add("wrap",function(u){if(u.type==="code-block"){for(var h="",g=0,f=u.classes.length;g<f;g++){var x=u.classes[g],m=/language-(.+)/.exec(x);if(m){h=m[1];break}}var p=t.languages[h];if(p)u.content=t.highlight(c(u.content),p,h);else if(h&&h!=="none"&&t.plugins.autoloader){var v="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);u.attributes.id=v,t.plugins.autoloader.loadLanguages(h,function(){var b=document.getElementById(v);b&&(b.innerHTML=t.highlight(b.textContent,t.languages[h],h))})}}});var o=RegExp(t.languages.markup.tag.pattern.source,"gi"),l={amp:"&",lt:"<",gt:">",quot:'"'},d=String.fromCodePoint||String.fromCharCode;function c(u){var h=u.replace(o,"");return h=h.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(g,f){if(f=f.toLowerCase(),f[0]==="#"){var x;return f[1]==="x"?x=parseInt(f.slice(2),16):x=Number(f.slice(1)),d(x)}else{var m=l[f];return m||g}}),h}t.languages.md=t.languages.markdown})(Prism);(function(t){var n="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",s={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},i={bash:s,environment:{pattern:RegExp("\\$"+n),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+n),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};t.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+n),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:i},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:s}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:i},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:i.entity}}],environment:{pattern:RegExp("\\$?"+n),alias:"constant"},variable:i.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},s.inside=t.languages.bash;for(var r=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],a=i.variable[1].inside,o=0;o<r.length;o++)a[r[o]]=t.languages.bash[r[o]];t.languages.sh=t.languages.bash,t.languages.shell=t.languages.bash})(Prism);var wa=t=>t.replace(/[&<>]/g,n=>({"&":"&","<":"<",">":">"})[n]??n);function Ht(t,n){let s=Fn.default.languages[n];if(!s)return t.split(`
|
|
9
9
|
`).map(wa);let i=Fn.default.highlight(t,s,n),r=[],a=[],o="",l=i.split(/(<span[^>]*>|<\/span>|\n)/);for(let d of l)d===`
|
|
10
|
-
`?(r.push(o+"</span>".repeat(a.length)),o=a.join("")):d.startsWith("<span")?(a.push(d),o+=d):(d==="</span>"&&a.pop(),o+=d);return r.push(o+"</span>".repeat(a.length)),r}function Cr({code:t,lang:n,symbols:s,highlight:i,scrollTo:r,onLine:a}){let o=Y(()=>jt(t,n),[t,n]),l=Y(()=>{let u=new Map;for(let h of s??[])h.start_line&&!u.has(h.start_line)&&u.set(h.start_line,h);return u},[s]),d=u=>{let h;for(let g of s??[])g.start_line&&g.end_line&&g.start_line<=u&&g.end_line>=u&&(!h||g.end_line-g.start_line<h.end_line-h.start_line)&&(h=g);return h},c=re(null);return O(()=>{if(!r||!c.current)return;let u=c.current.querySelector(`tr[data-l="${r}"]`);u&&u.scrollIntoView({block:"center"})},[r]),e("div",{class:"code",ref:c,children:e("table",{children:e("tbody",{children:o.map((u,h)=>{let g=h+1,f=l.get(g),x=i&&g>=i[0]&&g<=i[1];return e("tr",{"data-l":g,class:M(x&&"hl",f&&"sym"),children:[e("td",{class:"ln",onClick:()=>a?.(g,d(g)),title:f?`${f.kind} ${f.name}`:void 0,children:g}),e("td",{dangerouslySetInnerHTML:{__html:u||" "}})]})})})})})}function Sa(t){let n={name:"",path:"",dirs:new Map,files:[]};for(let s of t){let i=s.path.split("/"),r=n;for(let a of i.slice(0,-1)){let o=r.dirs.get(a);o||(o={name:a,path:r.path?`${r.path}/${a}`:a,dirs:new Map,files:[]},r.dirs.set(a,o)),r=o}r.files.push(s)}return n}function Rr({dir:t,depth:n,open:s,toggle:i,selected:r,onSelect:a,filter:o}){let l=[...t.dirs.values()].sort((u,h)=>u.name.localeCompare(h.name)),d=[...t.files].sort((u,h)=>u.path.localeCompare(h.path)),c={paddingLeft:`${8+n*14}px`};return e(L,{children:[l.map(u=>{let h=s.has(u.path)||!!o;return e(L,{children:[e("div",{class:"node",style:c,onClick:()=>i(u.path),children:[e("span",{class:"arrow",children:h?"\u25BE":"\u25B8"}),e("span",{class:"name",children:u.name})]}),h&&e(Rr,{dir:u,depth:n+1,open:s,toggle:i,selected:r,onSelect:a,filter:o})]})}),d.map(u=>e("div",{class:M("node",r===u.path&&"sel"),style:c,title:`${u.status}${u.reason?` (${u.reason})`:""} \xB7 ${u.symbols} symbols \xB7 ${u.loc} loc`,onClick:()=>a(u.path),children:[e("span",{class:"arrow"}),e("i",{class:M("st",u.status)}),e("span",{class:"name",children:Mt(u.path)}),e("span",{class:M("heat",u.score>.6&&"hot"),children:u.score?u.score.toFixed(2):""})]}))]})}function Ta({files:t,selected:n,onSelect:s}){let[i,r]=C(""),[a,o]=C(()=>{let c=new Set;if(n){let u=n.split("/");for(let h=1;h<u.length;h++)c.add(u.slice(0,h).join("/"))}else{let u=new Map;for(let h of t){let g=h.path.split("/")[0];h.path.includes("/")&&u.set(g,(u.get(g)??0)+1)}for(let[h]of[...u].sort((g,f)=>f[1]-g[1]).slice(0,2))c.add(h)}return c});O(()=>{n&&o(c=>{let u=new Set(c),h=n.split("/");for(let g=1;g<h.length;g++)u.add(h.slice(0,g).join("/"));return u})},[n]);let l=Y(()=>{let c=i.trim().toLowerCase();return c?t.filter(u=>u.path.toLowerCase().includes(c)):t},[t,i]),d=Y(()=>Sa(l),[l]);return e("div",{class:"panel",children:[e("div",{class:"head",children:["explorer ",e("span",{class:"spacer"}),e("span",{children:[t.length," files"]})]}),e("div",{style:{padding:"6px 8px",borderBottom:"1px solid var(--line)"},children:e("input",{type:"search",placeholder:"filter files\u2026",style:{width:"100%"},value:i,onInput:c=>r(c.target.value)})}),e("div",{class:"body tree",children:e(Rr,{dir:d,depth:0,open:a,toggle:c=>o(u=>{let h=new Set(u);return h.has(c)?h.delete(c):h.add(c),h}),selected:n,onSelect:s,filter:i})})]})}function $r({title:t,rows:n,onPick:s}){return n.length?e("div",{class:"section",children:[e("h4",{children:[t," \xB7 ",n.length]}),e("table",{children:e("tbody",{children:n.slice(0,40).map(i=>e("tr",{class:"click",onClick:()=>s(i.node.id,i.node.path,i.node.line),children:[e("td",{children:e(I,{children:i.kind})}),e("td",{class:"break",children:[e(ge,{kind:i.node.kind})," ",i.node.label,i.node.path&&i.node.kind!=="file"?e("div",{class:"muted small",children:[i.node.path,i.lines?.length?` \xB7 L${i.lines.join(", L")}`:""]}):null]}),e("td",{class:"num muted",children:i.count??""})]}))})}),n.length>40?e("div",{class:"muted small",children:["\u2026 ",n.length-40," more"]}):null]}):null}function Ea({file:t,impact:n,symbol:s,onPick:i}){return t?e("div",{class:"panel right",children:[e("div",{class:"head",children:[s?"code details":"file impact"," ",e("span",{class:"spacer"}),e("a",{onClick:()=>z("history",{file:t}),children:"history"}),e("a",{onClick:()=>z("galaxy",{node:s?s.node.id:`file:${t}`}),children:"open in Galaxy \u2192"})]}),e("div",{class:"body",children:s?e(L,{children:[e("div",{class:"section",children:[e("div",{class:"row tight",children:[e(ge,{kind:s.node.kind}),e("b",{class:"break",children:s.node.label})]}),e("div",{class:"muted small",children:[s.node.path,s.node.line?`:${s.node.line}`:"",s.node.exported?" \xB7 exported":""]}),s.metrics&&e("div",{class:"row small",style:{marginTop:6},children:[e(I,{children:["fan-in ",s.metrics.fan_in]}),e(I,{children:["fan-out ",s.metrics.fan_out]}),e(I,{children:["complexity ",s.metrics.complexity]}),e(I,{children:[s.metrics.loc," loc"]}),e(I,{children:["heat ",s.metrics.score.toFixed(2)]})]}),s.routes.length?e("div",{class:"small",style:{marginTop:6},children:["handles"," ",s.routes.map(r=>e("code",{children:r.label}))]}):null]}),e($r,{title:"callers and references",rows:s.callers,onPick:i}),e($r,{title:"calls and uses",rows:s.callees,onPick:i}),s.members.length?e("div",{class:"section",children:[e("h4",{children:["members \xB7 ",s.members.length]}),s.members.map(r=>e("div",{class:"small",children:e("a",{onClick:()=>i(r.id,r.path,r.line),children:[e(ge,{kind:r.kind}),r.label]})}))]}):null,s.memories.length?e("div",{class:"section",children:[e("h4",{children:"memories mentioning it"}),s.memories.map(r=>e("div",{class:"small",children:[e("a",{onClick:()=>z("memory",{name:r.name}),children:r.name})," ",e(I,{children:r.kind})]}))]}):null]}):n?e(L,{children:[e("div",{class:"section",children:[e("div",{class:"row small",children:[e(I,{children:[n.directDependents," direct dependents"]}),e(I,{children:[n.affected," affected files"]}),e(I,{children:[n.tests," test file",n.tests===1?"":"s"]}),e(I,{children:[n.coChanged.length," co-changed"]})]}),e("div",{class:"muted small",style:{marginTop:4},children:"Structural edges from the index plus git co-change history. Files outside the index are invisible here."})]}),n.graph.nodes.length>1&&e("div",{class:"section",style:{padding:0,height:240},children:e(Ke,{nodes:n.graph.nodes,edges:n.graph.edges,legend:!1,onActivate:r=>r.startsWith("file:")&&i(r,r.slice(5),null)})}),e("div",{class:"section",children:[e("h4",{children:["affected \xB7 ",n.hits.length]}),e("table",{children:e("tbody",{children:n.hits.map(r=>e("tr",{class:"click",onClick:()=>i(r.id,r.path,null),children:[e("td",{class:"break",children:[e(ge,{kind:r.kind}),r.label.replace(/^[a-z]+ /,""),e("div",{class:"muted small",children:r.reasons.join("; ")})]}),e("td",{class:"num muted",children:r.score.toFixed(2)})]}))})})]}),n.memories.length?e("div",{class:"section",children:[e("h4",{children:"memories"}),n.memories.map(r=>e("div",{class:"small",children:e("a",{onClick:()=>z("memory",{name:r}),children:r})}))]}):null]}):e("div",{class:"section",children:e(B,{})})})]}):e("div",{class:"panel right",children:e(q,{children:"Select a file to see what depends on it."})})}function Fr({params:t}){let n=t.file,s=t.line?Number(t.line):void 0,i=H(()=>P("/api/tree"),[]),r=H(()=>n?P("/api/file",{path:n}):Promise.resolve(void 0),[n]),a=H(()=>n?P("/api/file-impact",{path:n}):Promise.resolve(void 0),[n]),[o,l]=C(t.symbol??null);O(()=>l(t.symbol??null),[t.symbol,n]);let d=H(()=>o?P("/api/symbol",{id:o}):Promise.resolve(void 0),[o]),c=(x,m,p)=>z("explore",{file:x,line:m?String(m):void 0,symbol:p}),u=(x,m,p)=>{x.startsWith("file:")?c(x.slice(5)):m?c(m,p,x):z("galaxy",{node:x})},h=d.data&&o?d.data:void 0,g=r.data?.symbols.find(x=>x.id===o),f=r.data;return e(Ds,{left:i.data?e(Ta,{files:i.data.files,selected:n,onSelect:x=>c(x)}):e("div",{class:"panel",children:e(q,{children:i.error??e(B,{})})}),center:e("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[e("div",{class:"crumbs",children:[n?n.split("/").map((x,m,p)=>e(L,{children:[m>0&&e("span",{class:"sep",children:"\u203A"}),e("span",{class:m===p.length-1?"":"muted",children:x})]})):e("span",{class:"muted",children:"no file selected"}),e("span",{class:"spacer"}),f?.status&&f.status!=="indexed"?e("span",{class:"warn small",children:[f.status,f.reason?` \xB7 ${f.reason}`:""]}):null,f?e("span",{class:"muted small",children:[f.symbols.length," symbols \xB7 ",K(f.size??0)," B"]}):null,o?e("button",{type:"button",class:"sm",onClick:()=>l(null),children:"\u2190 file impact"}):null]}),e("div",{style:{flex:1,minHeight:0},children:n?r.error?e(G,{error:r.error}):f?f.tooLarge?e(q,{children:[f.path," is over the 1.5 MB limit and is not shown."]}):e(Cr,{code:f.content??"",lang:Ls(f.path),symbols:f.symbols,highlight:g?.start_line&&g.end_line?[g.start_line,g.end_line]:null,scrollTo:s??g?.start_line??null,onLine:(x,m)=>l(m?.id??null)}):e(q,{children:e(B,{})}):e(q,{children:"Pick a file in the explorer. Click a line number to inspect the symbol around it."})})]}),right:e(Ea,{file:n,impact:a.data,symbol:h,onPick:u})})}var Aa=["imports","calls","references","extends","implements","handles","reexports"];function Ca({value:t,onPick:n}){let[s,i]=C(t),[r,a]=C([]),[o,l]=C(!1),[d,c]=C(0);O(()=>i(t),[t]);let u=re(Ms(async h=>{if(h.trim().length<2)return a([]);try{a(await P("/api/nodes/search",{q:h.trim(),limit:12})),l(!0),c(0)}catch{a([])}},180)).current;return e("div",{style:{position:"relative"},children:[e("input",{type:"text",placeholder:"search a file, symbol, route or memory\u2026",value:s,onInput:h=>{let g=h.target.value;i(g),u(g)},onFocus:()=>r.length&&l(!0),onBlur:()=>setTimeout(()=>l(!1),150),onKeyDown:h=>{if(h.key==="ArrowDown")c(g=>Math.min(r.length-1,g+1));else if(h.key==="ArrowUp")c(g=>Math.max(0,g-1));else if(h.key==="Enter"){let g=r[d];g&&(n(g),l(!1))}else h.key==="Escape"&&l(!1)}}),o&&r.length>0&&e("div",{class:"suggest",children:r.map((h,g)=>e("div",{class:M(g===d&&"on"),onMouseDown:()=>n(h),children:[e(ge,{kind:h.kind}),e("span",{class:"ellipsis",children:h.label}),h.path&&h.kind!=="file"?e("span",{class:"path",children:h.path}):null]}))})]})}function Mr({params:t}){let[n,s]=C({node:t.node??null,depth:1,direction:"both",kinds:Aa,mode:"galaxy"}),[i,r]=C({back:[],fwd:[]}),[a,o]=C(null),[l,d]=C(!1),[c,u]=C(null),[h,g]=C(""),[f,x]=C(),[m,p]=C(!0),[y,v]=C(!1),b=re(null);O(()=>{t.node&&t.node!==n.node&&k({...n,node:t.node})},[t.node]);let k=(w,F=!0)=>{F&&r(W=>({back:[...W.back,n].slice(-30),fwd:[]})),s(w)};O(()=>{let w=!0;return d(!0),x(void 0),(n.node?P("/api/graph",{mode:"expand",node:n.node,direction:n.direction,kinds:n.kinds.join(","),depth:n.depth,limit:400}):P("/api/graph",{mode:"map",limit:200})).then(W=>{w&&(o(W),u(W.root??null))}).catch(W=>w&&J(W.message,!0)).finally(()=>w&&d(!1)),()=>{w=!1}},[n]);let S=w=>{v(!0),k({...n,node:w})},A=async()=>{if(!(!n.node||!h.trim()))try{let w=await P("/api/graph",{mode:"path",node:n.node,to:h.trim()});o(F=>{if(!F)return F;let W=new Set(F.nodes.map(D=>D.id)),X=new Set(F.edges.map(D=>`${D.src}|${D.dst}|${D.kind}`));return{...F,nodes:[...F.nodes,...w.nodes.filter(D=>!W.has(D.id))],edges:[...F.edges,...w.edges.filter(D=>!X.has(`${D.src}|${D.dst}|${D.kind}`))]}}),v(!0),x(new Set(w.edges.map(F=>`${F.src}|${F.dst}|${F.kind}`)))}catch(w){J(w.message,!0)}},_=a?.nodes.find(w=>w.id===c),E=_?a.edges.filter(w=>w.dst===_.id):[],R=_?a.edges.filter(w=>w.src===_.id):[],T=w=>a?.nodes.find(F=>F.id===w)?.label??w,$=w=>k({...n,kinds:n.kinds.includes(w)?n.kinds.filter(F=>F!==w):[...n.kinds,w]});return e("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[e("div",{class:"gtoolbar",children:[e("button",{type:"button",class:"sm",disabled:!i.back.length,title:"back",onClick:()=>{let w=i.back[i.back.length-1];w&&(r(F=>({back:F.back.slice(0,-1),fwd:[n,...F.fwd]})),s(w))},children:"\u2190"}),e("button",{type:"button",class:"sm",disabled:!i.fwd.length,title:"forward",onClick:()=>{let w=i.fwd[0];w&&(r(F=>({back:[...F.back,n],fwd:F.fwd.slice(1)})),s(w))},children:"\u2192"}),e(Ca,{value:n.node??"",onPick:w=>k({...n,node:w.id})}),e("button",{type:"button",class:"sm",onClick:()=>k({...n,node:null}),title:"whole project (file map)",children:"All"}),e("select",{value:n.direction,onChange:w=>k({...n,direction:w.target.value}),children:[e("option",{value:"both",children:"Both directions"}),e("option",{value:"in",children:"Incoming (who uses it)"}),e("option",{value:"out",children:"Outgoing (what it uses)"})]}),e("span",{class:"row tight",children:[e("button",{type:"button",class:"sm",disabled:n.depth<=1,onClick:()=>k({...n,depth:n.depth-1}),children:"\u2212"}),e("span",{class:"small nowrap",children:[n.depth," layer",n.depth===1?"":"s"]}),e("button",{type:"button",class:"sm",disabled:n.depth>=4,onClick:()=>k({...n,depth:n.depth+1}),children:"+1"})]}),e("span",{class:"row tight",children:[e("input",{type:"text",placeholder:"path to\u2026",style:{width:160},value:h,onInput:w=>g(w.target.value),onKeyDown:w=>w.key==="Enter"&&A()}),e("button",{type:"button",class:"sm",onClick:A,disabled:!n.node,children:"Path"})]}),e("span",{class:"row tight",children:[e("button",{type:"button",class:M("chip",n.mode==="galaxy"&&"on"),onClick:()=>s({...n,mode:"galaxy"}),children:"galaxy"}),e("button",{type:"button",class:M("chip",n.mode==="hierarchy"&&"on"),onClick:()=>s({...n,mode:"hierarchy"}),children:"hierarchy"}),e("button",{type:"button",class:M("chip",m&&"on"),onClick:()=>p(!m),children:"legend"})]}),e("span",{class:"count",children:l?e(B,{}):a?`${a.nodes.length} nodes \xB7 ${a.edges.length} edges${a.truncated?" \xB7 truncated":""}${a.total&&a.total>a.nodes.length?` \xB7 top ${a.nodes.length} of ${a.total} files`:""}`:""})]}),e("div",{class:"gtoolbar",style:{paddingTop:4,paddingBottom:6},children:[e("span",{class:"muted small",children:"edges:"}),Fs.map(w=>e("button",{type:"button",class:M("chip",n.kinds.includes(w)&&"on"),onClick:()=>$(w),children:w}))]}),e("div",{style:{flex:1,minHeight:0,display:"grid",gridTemplateColumns:_?"minmax(0,1fr) 340px":"1fr"},children:[e("div",{style:{minWidth:0},children:a?a.nodes.length?e(Ke,{nodes:a.nodes,edges:a.edges,mode:n.mode,selected:c,highlight:f,onSelect:u,onActivate:S,legend:m,handle:b,keepPositions:y}):e(q,{children:"The graph is empty. Run a reindex from System."}):e(q,{children:e(B,{})})}),_&&e("div",{class:"panel right",children:[e("div",{class:"head",children:["selection ",e("span",{class:"spacer"}),e("a",{onClick:()=>u(null),children:"close"})]}),e("div",{class:"body",children:[e("div",{class:"section",children:[e("div",{class:"row tight",children:[e(ge,{kind:_.kind}),e("b",{class:"break",children:_.label})]}),_.path&&_.kind!=="file"?e("div",{class:"muted small",children:[_.path,_.line?`:${_.line}`:""]}):null,e("div",{class:"row",style:{marginTop:8},children:[e("button",{type:"button",class:"sm primary",onClick:()=>S(_.id),children:"Expand from here"}),_.path?e("button",{type:"button",class:"sm",onClick:()=>z("explore",{file:_.path,line:_.line?String(_.line):void 0,symbol:_.kind==="file"?void 0:_.id}),children:"Open source"}):null,_.kind==="memory"?e("button",{type:"button",class:"sm",onClick:()=>z("memory",{name:_.label}),children:"Open memory"}):null]})]}),e("div",{class:"section",children:[e("h4",{children:["incoming \xB7 ",E.length]}),e("table",{children:e("tbody",{children:E.slice(0,60).map(w=>e("tr",{class:"click",onClick:()=>u(w.src),children:[e("td",{children:e(I,{children:w.kind})}),e("td",{class:"break",children:T(w.src)})]}))})})]}),e("div",{class:"section",children:[e("h4",{children:["outgoing \xB7 ",R.length]}),e("table",{children:e("tbody",{children:R.slice(0,60).map(w=>e("tr",{class:"click",onClick:()=>u(w.dst),children:[e("td",{children:e(I,{children:w.kind})}),e("td",{class:"break",children:T(w.dst)})]}))})})]})]})]})]})]})}function Mn(t){let n=[],s=[],i=0,r=a=>{let o=n.indexOf(null);return o===-1?(o=n.length,n.push(a)):n[o]=a,o};for(let a of t){let o=n.indexOf(a.sha);o===-1&&(o=r(a.sha));let l=[];for(let u=0;u<n.length;u++)u!==o&&n[u]===a.sha&&(l.push(u),n[u]=null);let d=[],c=a.parents;if(!c.length)n[o]=null;else{n[o]=c[0];for(let u of c.slice(1)){let h=n.indexOf(u);h===-1&&(h=r(u)),d.push(h)}}for(;n.length&&n[n.length-1]===null;)n.pop();i=Math.max(i,n.length,o+1),s.push({c:a,lane:o,after:[...n],joins:l,forks:d})}return{rows:s,lanes:i}}function Lr(t){let n=[];for(let s=0;s<t.length-1;s++){let i=t[s],r=t[s+1];for(let a=0;a<i.after.length;a++){let o=i.after[a];o&&(o===r.c.sha&&a!==r.lane?n.push({kind:"curve",fromLane:a,toLane:r.lane,from:s,to:s+1,lane:a}):i.forks.includes(a)&&a!==i.lane?n.push({kind:"curve",fromLane:i.lane,toLane:a,from:s,to:s+1,lane:a}):n.push({kind:"line",lane:a,from:s,to:s+1}))}}return n}var Ot=["feat","test","perf","refactor","fix","docs","other"],ut={feat:"#2563eb",test:"#16a34a",perf:"#d97706",refactor:"#7c3aed",fix:"#e11d48",docs:"#0284c7",other:"#9ca3af"},Dr=t=>ut[t]??ut.other;function Ln(t){let n=Math.max(0,Math.min(1,t)),s=[191,219,254],i=[30,58,138],r=s.map((a,o)=>Math.round(a+((i[o]??0)-a)*n));return`rgb(${r[0]},${r[1]},${r[2]})`}function Nr(t=800){let n=re(null),[s,i]=C(t);return O(()=>{let r=n.current;if(!r)return;let a=new ResizeObserver(()=>i(r.clientWidth||t));return a.observe(r),i(r.clientWidth||t),()=>a.disconnect()},[]),[n,s]}function Pr({weeks:t,range:n,onRange:s,hidden:i}){let[r,a]=Nr(),o=150,l={l:34,r:8,t:8,b:22},d=Math.max(10,a-l.l-l.r),c=o-l.t-l.b,u=t.length,h=u?d/u:d,g=h>=5?1:0,f=Math.max(1,...t.map(E=>Ot.reduce((R,T)=>R+(i.has(T)?0:E.byBucket[T]),0))),x=E=>l.t+c-E/f*c,[m,p]=C(null),y=re(null),[v,b]=C(null),k=(E,R)=>{let T=R.getBoundingClientRect(),$=E-T.left-l.l;return Math.max(0,Math.min(u-1,Math.floor($/h)))},S=Y(()=>{let E=[],R="";for(let $=0;$<u;$++){let w=t[$].week.slice(0,7);if(w!==R){R=w;let F=new Date(t[$].at),W=F.getUTCMonth()===0||!E.length?`${F.getUTCFullYear()}`:F.toLocaleString("en",{month:"short",timeZone:"UTC"});E.push({i:$,label:W})}}let T=Math.max(1,Math.ceil(E.length/Math.max(4,d/60)));return E.filter(($,w)=>w%T===0)},[t,d]),A=v??(n?[t.findIndex(E=>E.at+7*864e5>n[0]),t.findIndex(E=>E.at>n[1])-1]:null),_=m!==null?t[m]:void 0;return e("div",{class:"hist-chart",ref:r,children:[e("svg",{width:a,height:o,onMouseMove:E=>{let R=E.currentTarget,T=k(E.clientX,R);p(T),y.current&&b([Math.min(y.current.i0,T),Math.max(y.current.i0,T)])},onMouseLeave:()=>p(null),onMouseDown:E=>{let R=E.currentTarget,T=k(E.clientX,R);y.current={x0:E.clientX,i0:T},b([T,T]),E.preventDefault()},onMouseUp:E=>{let R=y.current;if(y.current=null,!R)return;if(Math.abs(E.clientX-R.x0)<3){b(null),s(null);return}let T=v;b(null),T&&s([t[T[0]].at,t[T[1]].at+7*864e5-1])},children:[e("title",{children:"commits per week by kind"}),[0,.5,1].map(E=>e("g",{children:[e("line",{x1:l.l,x2:a-l.r,y1:x(f*E),y2:x(f*E),class:"grid"}),e("text",{x:l.l-6,y:x(f*E)+3,class:"axis","text-anchor":"end",children:Math.round(f*E)})]})),S.map(E=>e("text",{x:l.l+E.i*h,y:o-6,class:"axis",children:E.label})),A&&A[0]>=0&&A[1]>=A[0]?e("rect",{x:l.l+A[0]*h,y:l.t,width:(A[1]-A[0]+1)*h,height:c,class:"brush"}):null,t.map((E,R)=>{let T=0;return e("g",{opacity:A&&(R<A[0]||R>A[1])?.35:1,children:Ot.map($=>{if(i.has($))return null;let w=E.byBucket[$];if(!w)return null;let F=x(T+w),W=x(T);return T+=w,e("rect",{x:l.l+R*h+g/2,y:F,width:Math.max(.5,h-g),height:Math.max(0,W-F-(g&&W-F>2?1:0)),fill:ut[$],rx:h>=6?1.5:0})})})}),m!==null?e("line",{x1:l.l+m*h+h/2,x2:l.l+m*h+h/2,y1:l.t,y2:l.t+c,class:"cross"}):null]}),_?e("div",{class:"tip",style:{left:Math.min(a-190,l.l+m*h+10),top:4},children:[e("b",{children:["week of ",_.week]})," \xB7 ",_.total," commit",_.total===1?"":"s"," \xB7 +",_.added,"/-",_.deleted,e("div",{class:"row tight",style:{marginTop:4,flexWrap:"wrap"},children:Ot.filter(E=>_.byBucket[E]).map(E=>e("span",{class:"kdot-lbl",children:[e("i",{class:"kdot",style:{background:ut[E]}}),E," ",_.byBucket[E]]}))})]}):null]})}function Br({counts:t,hidden:n,onToggle:s}){return e("div",{class:"row tight",style:{flexWrap:"wrap"},children:Ot.map(i=>e("button",{type:"button",class:M("chip",!n.has(i)&&"on"),onClick:()=>s(i),title:n.has(i)?`show ${i}`:`hide ${i}`,children:[e("i",{class:"kdot",style:{background:ut[i],opacity:n.has(i)?.3:1}}),i," ",t[i]??0]}))})}function In({values:t,width:n=72,height:s=16}){let i=Math.max(1,...t),r=t.length,a=t.map((o,l)=>`${l/Math.max(1,r-1)*(n-2)+1},${s-1-o/i*(s-3)}`);return e("svg",{width:n,height:s,class:"spark",title:t.join(" "),children:[e("title",{children:["commits per month: ",t.join(" ")]}),e("polyline",{points:a.join(" ")}),t.map((o,l)=>o?e("circle",{cx:l/Math.max(1,r-1)*(n-2)+1,cy:s-1-o/i*(s-3),r:1.4}):null)]})}function Hr({files:t,selected:n,onSelect:s}){let[i,r]=Nr(),a=300,o={l:42,r:16,t:12,b:30},l=Math.max(10,r-o.l-o.r),d=a-o.t-o.b,c=t.filter(b=>b.commits>=2),u=Math.max(2,...c.map(b=>b.commits)),h=Math.max(1,...c.map(b=>b.added+b.deleted)),g=b=>o.l+Math.log(b)/Math.log(u)*l,f=b=>o.t+d-b*d,x=b=>3+Math.sqrt((b.added+b.deleted)/h)*13,[m,p]=C(null),y=[...c].sort((b,k)=>k.risk-b.risk).slice(0,5),v=[1,2,5,10,20,50,100,200,500,1e3].filter(b=>b<=u);return e("div",{class:"hist-chart",ref:i,children:[e("svg",{width:r,height:a,children:[e("title",{children:"files by commits and fix share, sized by lines changed"}),[0,.25,.5,.75,1].map(b=>e("g",{children:[e("line",{x1:o.l,x2:r-o.r,y1:f(b),y2:f(b),class:"grid"}),e("text",{x:o.l-6,y:f(b)+3,class:"axis","text-anchor":"end",children:[Math.round(b*100),"%"]})]})),v.filter(b=>g(b)<r-o.r-70).map(b=>e("text",{x:g(b),y:a-8,class:"axis","text-anchor":"middle",children:b})),e("text",{x:r-o.r,y:a-8,class:"axis","text-anchor":"end",children:"commits (log) \u2192"}),e("text",{x:o.l+4,y:o.t+10,class:"axis",children:"share of commits that were fixes \u2191"}),c.map(b=>e("circle",{cx:g(b.commits),cy:f(b.commits?b.fixes/b.commits:0),r:x(b),fill:Ln(b.risk),class:M("dot",n===b.path&&"sel"),onMouseEnter:()=>p(b),onMouseLeave:()=>p(null),onClick:()=>s(b.path)})),y.map(b=>{let k=g(b.commits)>r-160;return e("text",{x:k?g(b.commits)-x(b)-3:g(b.commits)+x(b)+3,y:f(b.fixes/b.commits)+3,class:"lbl","text-anchor":k?"end":"start",children:b.path.split("/").slice(-2).join("/")})})]}),m?e("div",{class:"tip",style:{left:Math.min(r-260,g(m.commits)+12),top:Math.max(0,f(m.fixes/m.commits)-60)},children:[e("b",{children:m.path}),e("div",{class:"muted",children:[m.commits," commits \xB7 ",m.fixes," fixes \xB7 +",m.added,"/-",m.deleted," \xB7 risk"," ",m.risk.toFixed(2)]}),m.reasons.length?e("div",{class:"muted",children:m.reasons.join("; ")}):null]}):null]})}var Ir=["#2563eb","#d97706","#16a34a","#7c3aed","#e11d48","#0284c7","#db2777","#0d9488"],zt=t=>Ir[t%Ir.length];function jr({rows:t,lanes:n,rowH:s,selected:i}){let a=n*14+10,o=c=>7+c*14,l=c=>c*s+s/2,d=Lr(t);return e("svg",{class:"lanes",width:a,height:t.length*s,children:[e("title",{children:"commit graph"}),d.map(c=>c.kind==="line"?e("line",{x1:o(c.lane),x2:o(c.lane),y1:l(c.from),y2:l(c.to),stroke:zt(c.lane)}):e("path",{d:`M${o(c.fromLane)},${l(c.from)} C${o(c.fromLane)},${l(c.from)+s/2} ${o(c.toLane)},${l(c.to)-s/2} ${o(c.toLane)},${l(c.to)}`,stroke:zt(c.lane)})),t.map((c,u)=>e("circle",{cx:o(c.lane),cy:l(u),r:c.c.merge?3.5:4,fill:c.c.merge?"var(--card)":zt(c.lane),stroke:zt(c.lane),"stroke-width":i===c.c.sha?3:c.c.merge?2:1,class:M(i===c.c.sha&&"sel",!c.c.onHead&&"off")}))]})}function Ut({kind:t,bucket:n}){return e("span",{class:"tag kind",style:{color:Dr(n)},children:t})}function zr({added:t,deleted:n}){let s=t+n,i=5,r=s?Math.round(t/s*i):0,a=s?Math.min(i-r,Math.round(n/s*i)):0;return e("span",{class:"pm",title:`+${t} / -${n}`,children:[e("span",{class:"add",children:["+",K(t)]}),e("span",{class:"del",children:["-",K(n)]}),e("span",{class:"bars",children:Array.from({length:i},(o,l)=>e("i",{class:l<r?"a":l<r+a?"d":""}))})]})}function Or({refs:t,tags:n,max:s=3}){let i=t.filter(r=>!r.startsWith("tag: "));return!i.length&&!n.length?null:e(L,{children:[n.slice(0,2).map(r=>e("span",{class:"ref tag",children:r})),i.slice(0,s).map(r=>e("span",{class:M("ref",r.includes("/")&&"remote"),children:r})),i.length>s?e("span",{class:"ref remote",children:["+",i.length-s]}):null]})}function $a({c:t}){return e(L,{children:[t.blamedBy?e("span",{class:"flag warn",title:`${t.blamedBy} later fix(es) removed lines from this commit`,children:["\u26A0 ",t.blamedBy]}):null,t.reverted?e("span",{class:"flag bad",title:"reverted",children:"\u21A9"}):null,t.origins&&(t.kind==="fix"||t.kind==="revert")?e("span",{class:"flag ok",title:`traced to ${t.origins} earlier commit(s)`,children:["\u21E0 ",t.origins]}):null,t.breaking?e("span",{class:"flag bad",children:"BREAKING"}):null]})}function Ye({value:t}){return e("span",{class:"riskbar",title:t.toFixed(2),children:e("i",{style:{width:`${Math.round(t*100)}%`,background:Ln(.3+t*.7)}})})}function Le({v:t,k:n,sub:s}){return e("div",{class:"stat",children:[e("div",{class:"v",children:[t,s?e("small",{children:s}):null]}),e("div",{class:"k",children:n})]})}function Qe({commits:t,selected:n,onSelect:s,lanes:i,empty:r}){return t.length?e("div",{class:"commits",children:[i?e(jr,{rows:i.rows,lanes:i.lanes,rowH:28,selected:n}):null,e("div",{class:"rows",children:t.map(o=>e("div",{class:M("crow",n===o.sha&&"sel",!o.onHead&&"off"),onClick:()=>s(o.sha),title:`${o.sha}
|
|
10
|
+
`?(r.push(o+"</span>".repeat(a.length)),o=a.join("")):d.startsWith("<span")?(a.push(d),o+=d):(d==="</span>"&&a.pop(),o+=d);return r.push(o+"</span>".repeat(a.length)),r}function Ar({code:t,lang:n,symbols:s,highlight:i,scrollTo:r,onLine:a}){let o=Y(()=>Ht(t,n),[t,n]),l=Y(()=>{let u=new Map;for(let h of s??[])h.start_line&&!u.has(h.start_line)&&u.set(h.start_line,h);return u},[s]),d=u=>{let h;for(let g of s??[])g.start_line&&g.end_line&&g.start_line<=u&&g.end_line>=u&&(!h||g.end_line-g.start_line<h.end_line-h.start_line)&&(h=g);return h},c=re(null);return O(()=>{if(!r||!c.current)return;let u=c.current.querySelector(`tr[data-l="${r}"]`);u&&u.scrollIntoView({block:"center"})},[r]),e("div",{class:"code",ref:c,children:e("table",{children:e("tbody",{children:o.map((u,h)=>{let g=h+1,f=l.get(g),x=i&&g>=i[0]&&g<=i[1];return e("tr",{"data-l":g,class:M(x&&"hl",f&&"sym"),children:[e("td",{class:"ln",onClick:()=>a?.(g,d(g)),title:f?`${f.kind} ${f.name}`:void 0,children:g}),e("td",{dangerouslySetInnerHTML:{__html:u||" "}})]})})})})})}function Sa(t){let n={name:"",path:"",dirs:new Map,files:[]};for(let s of t){let i=s.path.split("/"),r=n;for(let a of i.slice(0,-1)){let o=r.dirs.get(a);o||(o={name:a,path:r.path?`${r.path}/${a}`:a,dirs:new Map,files:[]},r.dirs.set(a,o)),r=o}r.files.push(s)}return n}function Rr({dir:t,depth:n,open:s,toggle:i,selected:r,onSelect:a,filter:o}){let l=[...t.dirs.values()].sort((u,h)=>u.name.localeCompare(h.name)),d=[...t.files].sort((u,h)=>u.path.localeCompare(h.path)),c={paddingLeft:`${8+n*14}px`};return e(L,{children:[l.map(u=>{let h=s.has(u.path)||!!o;return e(L,{children:[e("div",{class:"node",style:c,onClick:()=>i(u.path),children:[e("span",{class:"arrow",children:h?"\u25BE":"\u25B8"}),e("span",{class:"name",children:u.name})]}),h&&e(Rr,{dir:u,depth:n+1,open:s,toggle:i,selected:r,onSelect:a,filter:o})]})}),d.map(u=>e("div",{class:M("node",r===u.path&&"sel"),style:c,title:`${u.status}${u.reason?` (${u.reason})`:""} \xB7 ${u.symbols} symbols \xB7 ${u.loc} loc`,onClick:()=>a(u.path),children:[e("span",{class:"arrow"}),e("i",{class:M("st",u.status)}),e("span",{class:"name",children:Mt(u.path)}),e("span",{class:M("heat",u.score>.6&&"hot"),children:u.score?u.score.toFixed(2):""})]}))]})}function Ta({files:t,selected:n,onSelect:s}){let[i,r]=A(""),[a,o]=A(()=>{let c=new Set;if(n){let u=n.split("/");for(let h=1;h<u.length;h++)c.add(u.slice(0,h).join("/"))}else{let u=new Map;for(let h of t){let g=h.path.split("/")[0];h.path.includes("/")&&u.set(g,(u.get(g)??0)+1)}for(let[h]of[...u].sort((g,f)=>f[1]-g[1]).slice(0,2))c.add(h)}return c});O(()=>{n&&o(c=>{let u=new Set(c),h=n.split("/");for(let g=1;g<h.length;g++)u.add(h.slice(0,g).join("/"));return u})},[n]);let l=Y(()=>{let c=i.trim().toLowerCase();return c?t.filter(u=>u.path.toLowerCase().includes(c)):t},[t,i]),d=Y(()=>Sa(l),[l]);return e("div",{class:"panel",children:[e("div",{class:"head",children:["explorer ",e("span",{class:"spacer"}),e("span",{children:[t.length," files"]})]}),e("div",{style:{padding:"6px 8px",borderBottom:"1px solid var(--line)"},children:e("input",{type:"search",placeholder:"filter files\u2026",style:{width:"100%"},value:i,onInput:c=>r(c.target.value)})}),e("div",{class:"body tree",children:e(Rr,{dir:d,depth:0,open:a,toggle:c=>o(u=>{let h=new Set(u);return h.has(c)?h.delete(c):h.add(c),h}),selected:n,onSelect:s,filter:i})})]})}function Cr({title:t,rows:n,onPick:s}){return n.length?e("div",{class:"section",children:[e("h4",{children:[t," \xB7 ",n.length]}),e("table",{children:e("tbody",{children:n.slice(0,40).map(i=>e("tr",{class:"click",onClick:()=>s(i.node.id,i.node.path,i.node.line),children:[e("td",{children:e(I,{children:i.kind})}),e("td",{class:"break",children:[e(ge,{kind:i.node.kind})," ",i.node.label,i.node.path&&i.node.kind!=="file"?e("div",{class:"muted small",children:[i.node.path,i.lines?.length?` \xB7 L${i.lines.join(", L")}`:""]}):null]}),e("td",{class:"num muted",children:i.count??""})]}))})}),n.length>40?e("div",{class:"muted small",children:["\u2026 ",n.length-40," more"]}):null]}):null}function Ea({file:t,impact:n,symbol:s,onPick:i}){return t?e("div",{class:"panel right",children:[e("div",{class:"head",children:[s?"code details":"file impact"," ",e("span",{class:"spacer"}),e("a",{onClick:()=>j("history",{file:t}),children:"history"}),e("a",{onClick:()=>j("galaxy",{node:s?s.node.id:`file:${t}`}),children:"open in Galaxy \u2192"})]}),e("div",{class:"body",children:s?e(L,{children:[e("div",{class:"section",children:[e("div",{class:"row tight",children:[e(ge,{kind:s.node.kind}),e("b",{class:"break",children:s.node.label})]}),e("div",{class:"muted small",children:[s.node.path,s.node.line?`:${s.node.line}`:"",s.node.exported?" \xB7 exported":""]}),s.metrics&&e("div",{class:"row small",style:{marginTop:6},children:[e(I,{children:["fan-in ",s.metrics.fan_in]}),e(I,{children:["fan-out ",s.metrics.fan_out]}),e(I,{children:["complexity ",s.metrics.complexity]}),e(I,{children:[s.metrics.loc," loc"]}),e(I,{children:["heat ",s.metrics.score.toFixed(2)]})]}),s.routes.length?e("div",{class:"small",style:{marginTop:6},children:["handles"," ",s.routes.map(r=>e("code",{children:r.label}))]}):null]}),e(Cr,{title:"callers and references",rows:s.callers,onPick:i}),e(Cr,{title:"calls and uses",rows:s.callees,onPick:i}),s.members.length?e("div",{class:"section",children:[e("h4",{children:["members \xB7 ",s.members.length]}),s.members.map(r=>e("div",{class:"small",children:e("a",{onClick:()=>i(r.id,r.path,r.line),children:[e(ge,{kind:r.kind}),r.label]})}))]}):null,s.memories.length?e("div",{class:"section",children:[e("h4",{children:"memories mentioning it"}),s.memories.map(r=>e("div",{class:"small",children:[e("a",{onClick:()=>j("memory",{name:r.name}),children:r.name})," ",e(I,{children:r.kind})]}))]}):null]}):n?e(L,{children:[e("div",{class:"section",children:[e("div",{class:"row small",children:[e(I,{children:[n.directDependents," direct dependents"]}),e(I,{children:[n.affected," affected files"]}),e(I,{children:[n.tests," test file",n.tests===1?"":"s"]}),e(I,{children:[n.coChanged.length," co-changed"]})]}),e("div",{class:"muted small",style:{marginTop:4},children:"Structural edges from the index plus git co-change history. Files outside the index are invisible here."})]}),n.graph.nodes.length>1&&e("div",{class:"section",style:{padding:0,height:240},children:e(Ke,{nodes:n.graph.nodes,edges:n.graph.edges,legend:!1,onActivate:r=>r.startsWith("file:")&&i(r,r.slice(5),null)})}),e("div",{class:"section",children:[e("h4",{children:["affected \xB7 ",n.hits.length]}),e("table",{children:e("tbody",{children:n.hits.map(r=>e("tr",{class:"click",onClick:()=>i(r.id,r.path,null),children:[e("td",{class:"break",children:[e(ge,{kind:r.kind}),r.label.replace(/^[a-z]+ /,""),e("div",{class:"muted small",children:r.reasons.join("; ")})]}),e("td",{class:"num muted",children:r.score.toFixed(2)})]}))})})]}),n.memories.length?e("div",{class:"section",children:[e("h4",{children:"memories"}),n.memories.map(r=>e("div",{class:"small",children:e("a",{onClick:()=>j("memory",{name:r}),children:r})}))]}):null]}):e("div",{class:"section",children:e(B,{})})})]}):e("div",{class:"panel right",children:e(G,{children:"Select a file to see what depends on it."})})}function Fr({params:t}){let n=t.file,s=t.line?Number(t.line):void 0,i=z(()=>P("/api/tree"),[]),r=z(()=>n?P("/api/file",{path:n}):Promise.resolve(void 0),[n]),a=z(()=>n?P("/api/file-impact",{path:n}):Promise.resolve(void 0),[n]),[o,l]=A(t.symbol??null);O(()=>l(t.symbol??null),[t.symbol,n]);let d=z(()=>o?P("/api/symbol",{id:o}):Promise.resolve(void 0),[o]),c=(x,m,p)=>j("explore",{file:x,line:m?String(m):void 0,symbol:p}),u=(x,m,p)=>{x.startsWith("file:")?c(x.slice(5)):m?c(m,p,x):j("galaxy",{node:x})},h=d.data&&o?d.data:void 0,g=r.data?.symbols.find(x=>x.id===o),f=r.data;return e(Ds,{left:i.data?e(Ta,{files:i.data.files,selected:n,onSelect:x=>c(x)}):e("div",{class:"panel",children:e(G,{children:i.error??e(B,{})})}),center:e("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[e("div",{class:"crumbs",children:[n?n.split("/").map((x,m,p)=>e(L,{children:[m>0&&e("span",{class:"sep",children:"\u203A"}),e("span",{class:m===p.length-1?"":"muted",children:x})]})):e("span",{class:"muted",children:"no file selected"}),e("span",{class:"spacer"}),f?.status&&f.status!=="indexed"?e("span",{class:"warn small",children:[f.status,f.reason?` \xB7 ${f.reason}`:""]}):null,f?e("span",{class:"muted small",children:[f.symbols.length," symbols \xB7 ",K(f.size??0)," B"]}):null,o?e("button",{type:"button",class:"sm",onClick:()=>l(null),children:"\u2190 file impact"}):null]}),e("div",{style:{flex:1,minHeight:0},children:n?r.error?e(q,{error:r.error}):f?f.tooLarge?e(G,{children:[f.path," is over the 1.5 MB limit and is not shown."]}):e(Ar,{code:f.content??"",lang:Ls(f.path),symbols:f.symbols,highlight:g?.start_line&&g.end_line?[g.start_line,g.end_line]:null,scrollTo:s??g?.start_line??null,onLine:(x,m)=>l(m?.id??null)}):e(G,{children:e(B,{})}):e(G,{children:"Pick a file in the explorer. Click a line number to inspect the symbol around it."})})]}),right:e(Ea,{file:n,impact:a.data,symbol:h,onPick:u})})}var $a=["imports","calls","references","extends","implements","handles","reexports"];function Aa({value:t,onPick:n}){let[s,i]=A(t),[r,a]=A([]),[o,l]=A(!1),[d,c]=A(0);O(()=>i(t),[t]);let u=re(Ms(async h=>{if(h.trim().length<2)return a([]);try{a(await P("/api/nodes/search",{q:h.trim(),limit:12})),l(!0),c(0)}catch{a([])}},180)).current;return e("div",{style:{position:"relative"},children:[e("input",{type:"text",placeholder:"search a file, symbol, route or memory\u2026",value:s,onInput:h=>{let g=h.target.value;i(g),u(g)},onFocus:()=>r.length&&l(!0),onBlur:()=>setTimeout(()=>l(!1),150),onKeyDown:h=>{if(h.key==="ArrowDown")c(g=>Math.min(r.length-1,g+1));else if(h.key==="ArrowUp")c(g=>Math.max(0,g-1));else if(h.key==="Enter"){let g=r[d];g&&(n(g),l(!1))}else h.key==="Escape"&&l(!1)}}),o&&r.length>0&&e("div",{class:"suggest",children:r.map((h,g)=>e("div",{class:M(g===d&&"on"),onMouseDown:()=>n(h),children:[e(ge,{kind:h.kind}),e("span",{class:"ellipsis",children:h.label}),h.path&&h.kind!=="file"?e("span",{class:"path",children:h.path}):null]}))})]})}function Mr({params:t}){let[n,s]=A({node:t.node??null,depth:1,direction:"both",kinds:$a,mode:"galaxy"}),[i,r]=A({back:[],fwd:[]}),[a,o]=A(null),[l,d]=A(!1),[c,u]=A(null),[h,g]=A(""),[f,x]=A(),[m,p]=A(!0),[v,b]=A(!1),y=re(null);O(()=>{t.node&&t.node!==n.node&&k({...n,node:t.node})},[t.node]);let k=(w,F=!0)=>{F&&r(W=>({back:[...W.back,n].slice(-30),fwd:[]})),s(w)};O(()=>{let w=!0;return d(!0),x(void 0),(n.node?P("/api/graph",{mode:"expand",node:n.node,direction:n.direction,kinds:n.kinds.join(","),depth:n.depth,limit:400}):P("/api/graph",{mode:"map",limit:200})).then(W=>{w&&(o(W),u(W.root??null))}).catch(W=>w&&J(W.message,!0)).finally(()=>w&&d(!1)),()=>{w=!1}},[n]);let S=w=>{b(!0),k({...n,node:w})},$=async()=>{if(!(!n.node||!h.trim()))try{let w=await P("/api/graph",{mode:"path",node:n.node,to:h.trim()});o(F=>{if(!F)return F;let W=new Set(F.nodes.map(D=>D.id)),X=new Set(F.edges.map(D=>`${D.src}|${D.dst}|${D.kind}`));return{...F,nodes:[...F.nodes,...w.nodes.filter(D=>!W.has(D.id))],edges:[...F.edges,...w.edges.filter(D=>!X.has(`${D.src}|${D.dst}|${D.kind}`))]}}),b(!0),x(new Set(w.edges.map(F=>`${F.src}|${F.dst}|${F.kind}`)))}catch(w){J(w.message,!0)}},_=a?.nodes.find(w=>w.id===c),E=_?a.edges.filter(w=>w.dst===_.id):[],R=_?a.edges.filter(w=>w.src===_.id):[],T=w=>a?.nodes.find(F=>F.id===w)?.label??w,C=w=>k({...n,kinds:n.kinds.includes(w)?n.kinds.filter(F=>F!==w):[...n.kinds,w]});return e("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[e("div",{class:"gtoolbar",children:[e("button",{type:"button",class:"sm",disabled:!i.back.length,title:"back",onClick:()=>{let w=i.back[i.back.length-1];w&&(r(F=>({back:F.back.slice(0,-1),fwd:[n,...F.fwd]})),s(w))},children:"\u2190"}),e("button",{type:"button",class:"sm",disabled:!i.fwd.length,title:"forward",onClick:()=>{let w=i.fwd[0];w&&(r(F=>({back:[...F.back,n],fwd:F.fwd.slice(1)})),s(w))},children:"\u2192"}),e(Aa,{value:n.node??"",onPick:w=>k({...n,node:w.id})}),e("button",{type:"button",class:"sm",onClick:()=>k({...n,node:null}),title:"whole project (file map)",children:"All"}),e("select",{value:n.direction,onChange:w=>k({...n,direction:w.target.value}),children:[e("option",{value:"both",children:"Both directions"}),e("option",{value:"in",children:"Incoming (who uses it)"}),e("option",{value:"out",children:"Outgoing (what it uses)"})]}),e("span",{class:"row tight",children:[e("button",{type:"button",class:"sm",disabled:n.depth<=1,onClick:()=>k({...n,depth:n.depth-1}),children:"\u2212"}),e("span",{class:"small nowrap",children:[n.depth," layer",n.depth===1?"":"s"]}),e("button",{type:"button",class:"sm",disabled:n.depth>=4,onClick:()=>k({...n,depth:n.depth+1}),children:"+1"})]}),e("span",{class:"row tight",children:[e("input",{type:"text",placeholder:"path to\u2026",style:{width:160},value:h,onInput:w=>g(w.target.value),onKeyDown:w=>w.key==="Enter"&&$()}),e("button",{type:"button",class:"sm",onClick:$,disabled:!n.node,children:"Path"})]}),e("span",{class:"row tight",children:[e("button",{type:"button",class:M("chip",n.mode==="galaxy"&&"on"),onClick:()=>s({...n,mode:"galaxy"}),children:"galaxy"}),e("button",{type:"button",class:M("chip",n.mode==="hierarchy"&&"on"),onClick:()=>s({...n,mode:"hierarchy"}),children:"hierarchy"}),e("button",{type:"button",class:M("chip",m&&"on"),onClick:()=>p(!m),children:"legend"})]}),e("span",{class:"count",children:l?e(B,{}):a?`${a.nodes.length} nodes \xB7 ${a.edges.length} edges${a.truncated?" \xB7 truncated":""}${a.total&&a.total>a.nodes.length?` \xB7 top ${a.nodes.length} of ${a.total} files`:""}`:""})]}),e("div",{class:"gtoolbar",style:{paddingTop:4,paddingBottom:6},children:[e("span",{class:"muted small",children:"edges:"}),Fs.map(w=>e("button",{type:"button",class:M("chip",n.kinds.includes(w)&&"on"),onClick:()=>C(w),children:w}))]}),e("div",{style:{flex:1,minHeight:0,display:"grid",gridTemplateColumns:_?"minmax(0,1fr) 340px":"1fr"},children:[e("div",{style:{minWidth:0},children:a?a.nodes.length?e(Ke,{nodes:a.nodes,edges:a.edges,mode:n.mode,selected:c,highlight:f,onSelect:u,onActivate:S,legend:m,handle:y,keepPositions:v}):e(G,{children:"The graph is empty. Run a reindex from System."}):e(G,{children:e(B,{})})}),_&&e("div",{class:"panel right",children:[e("div",{class:"head",children:["selection ",e("span",{class:"spacer"}),e("a",{onClick:()=>u(null),children:"close"})]}),e("div",{class:"body",children:[e("div",{class:"section",children:[e("div",{class:"row tight",children:[e(ge,{kind:_.kind}),e("b",{class:"break",children:_.label})]}),_.path&&_.kind!=="file"?e("div",{class:"muted small",children:[_.path,_.line?`:${_.line}`:""]}):null,e("div",{class:"row",style:{marginTop:8},children:[e("button",{type:"button",class:"sm primary",onClick:()=>S(_.id),children:"Expand from here"}),_.path?e("button",{type:"button",class:"sm",onClick:()=>j("explore",{file:_.path,line:_.line?String(_.line):void 0,symbol:_.kind==="file"?void 0:_.id}),children:"Open source"}):null,_.kind==="memory"?e("button",{type:"button",class:"sm",onClick:()=>j("memory",{name:_.label}),children:"Open memory"}):null]})]}),e("div",{class:"section",children:[e("h4",{children:["incoming \xB7 ",E.length]}),e("table",{children:e("tbody",{children:E.slice(0,60).map(w=>e("tr",{class:"click",onClick:()=>u(w.src),children:[e("td",{children:e(I,{children:w.kind})}),e("td",{class:"break",children:T(w.src)})]}))})})]}),e("div",{class:"section",children:[e("h4",{children:["outgoing \xB7 ",R.length]}),e("table",{children:e("tbody",{children:R.slice(0,60).map(w=>e("tr",{class:"click",onClick:()=>u(w.dst),children:[e("td",{children:e(I,{children:w.kind})}),e("td",{class:"break",children:T(w.dst)})]}))})})]})]})]})]})]})}function Mn(t){let n=[],s=[],i=0,r=a=>{let o=n.indexOf(null);return o===-1?(o=n.length,n.push(a)):n[o]=a,o};for(let a of t){let o=n.indexOf(a.sha);o===-1&&(o=r(a.sha));let l=[];for(let u=0;u<n.length;u++)u!==o&&n[u]===a.sha&&(l.push(u),n[u]=null);let d=[],c=a.parents;if(!c.length)n[o]=null;else{n[o]=c[0];for(let u of c.slice(1)){let h=n.indexOf(u);h===-1&&(h=r(u)),d.push(h)}}for(;n.length&&n[n.length-1]===null;)n.pop();i=Math.max(i,n.length,o+1),s.push({c:a,lane:o,after:[...n],joins:l,forks:d})}return{rows:s,lanes:i}}function Lr(t){let n=[];for(let s=0;s<t.length-1;s++){let i=t[s],r=t[s+1];for(let a=0;a<i.after.length;a++){let o=i.after[a];o&&(o===r.c.sha&&a!==r.lane?n.push({kind:"curve",fromLane:a,toLane:r.lane,from:s,to:s+1,lane:a}):i.forks.includes(a)&&a!==i.lane?n.push({kind:"curve",fromLane:i.lane,toLane:a,from:s,to:s+1,lane:a}):n.push({kind:"line",lane:a,from:s,to:s+1}))}}return n}var Ot=["feat","test","perf","refactor","fix","docs","other"],ut={feat:"#2563eb",test:"#16a34a",perf:"#d97706",refactor:"#7c3aed",fix:"#e11d48",docs:"#0284c7",other:"#9ca3af"},Dr=t=>ut[t]??ut.other;function Ln(t){let n=Math.max(0,Math.min(1,t)),s=[191,219,254],i=[30,58,138],r=s.map((a,o)=>Math.round(a+((i[o]??0)-a)*n));return`rgb(${r[0]},${r[1]},${r[2]})`}function Nr(t=800){let n=re(null),[s,i]=A(t);return O(()=>{let r=n.current;if(!r)return;let a=new ResizeObserver(()=>i(r.clientWidth||t));return a.observe(r),i(r.clientWidth||t),()=>a.disconnect()},[]),[n,s]}function Pr({weeks:t,range:n,onRange:s,hidden:i}){let[r,a]=Nr(),o=150,l={l:34,r:8,t:8,b:22},d=Math.max(10,a-l.l-l.r),c=o-l.t-l.b,u=t.length,h=u?d/u:d,g=h>=5?1:0,f=Math.max(1,...t.map(E=>Ot.reduce((R,T)=>R+(i.has(T)?0:E.byBucket[T]),0))),x=E=>l.t+c-E/f*c,[m,p]=A(null),v=re(null),[b,y]=A(null),k=(E,R)=>{let T=R.getBoundingClientRect(),C=E-T.left-l.l;return Math.max(0,Math.min(u-1,Math.floor(C/h)))},S=Y(()=>{let E=[],R="";for(let C=0;C<u;C++){let w=t[C].week.slice(0,7);if(w!==R){R=w;let F=new Date(t[C].at),W=F.getUTCMonth()===0||!E.length?`${F.getUTCFullYear()}`:F.toLocaleString("en",{month:"short",timeZone:"UTC"});E.push({i:C,label:W})}}let T=Math.max(1,Math.ceil(E.length/Math.max(4,d/60)));return E.filter((C,w)=>w%T===0)},[t,d]),$=b??(n?[t.findIndex(E=>E.at+7*864e5>n[0]),t.findIndex(E=>E.at>n[1])-1]:null),_=m!==null?t[m]:void 0;return e("div",{class:"hist-chart",ref:r,children:[e("svg",{width:a,height:o,onMouseMove:E=>{let R=E.currentTarget,T=k(E.clientX,R);p(T),v.current&&y([Math.min(v.current.i0,T),Math.max(v.current.i0,T)])},onMouseLeave:()=>p(null),onMouseDown:E=>{let R=E.currentTarget,T=k(E.clientX,R);v.current={x0:E.clientX,i0:T},y([T,T]),E.preventDefault()},onMouseUp:E=>{let R=v.current;if(v.current=null,!R)return;if(Math.abs(E.clientX-R.x0)<3){y(null),s(null);return}let T=b;y(null),T&&s([t[T[0]].at,t[T[1]].at+7*864e5-1])},children:[e("title",{children:"commits per week by kind"}),[0,.5,1].map(E=>e("g",{children:[e("line",{x1:l.l,x2:a-l.r,y1:x(f*E),y2:x(f*E),class:"grid"}),e("text",{x:l.l-6,y:x(f*E)+3,class:"axis","text-anchor":"end",children:Math.round(f*E)})]})),S.map(E=>e("text",{x:l.l+E.i*h,y:o-6,class:"axis",children:E.label})),$&&$[0]>=0&&$[1]>=$[0]?e("rect",{x:l.l+$[0]*h,y:l.t,width:($[1]-$[0]+1)*h,height:c,class:"brush"}):null,t.map((E,R)=>{let T=0;return e("g",{opacity:$&&(R<$[0]||R>$[1])?.35:1,children:Ot.map(C=>{if(i.has(C))return null;let w=E.byBucket[C];if(!w)return null;let F=x(T+w),W=x(T);return T+=w,e("rect",{x:l.l+R*h+g/2,y:F,width:Math.max(.5,h-g),height:Math.max(0,W-F-(g&&W-F>2?1:0)),fill:ut[C],rx:h>=6?1.5:0})})})}),m!==null?e("line",{x1:l.l+m*h+h/2,x2:l.l+m*h+h/2,y1:l.t,y2:l.t+c,class:"cross"}):null]}),_?e("div",{class:"tip",style:{left:Math.min(a-190,l.l+m*h+10),top:4},children:[e("b",{children:["week of ",_.week]})," \xB7 ",_.total," commit",_.total===1?"":"s"," \xB7 +",_.added,"/-",_.deleted,e("div",{class:"row tight",style:{marginTop:4,flexWrap:"wrap"},children:Ot.filter(E=>_.byBucket[E]).map(E=>e("span",{class:"kdot-lbl",children:[e("i",{class:"kdot",style:{background:ut[E]}}),E," ",_.byBucket[E]]}))})]}):null]})}function Br({counts:t,hidden:n,onToggle:s}){return e("div",{class:"row tight",style:{flexWrap:"wrap"},children:Ot.map(i=>e("button",{type:"button",class:M("chip",!n.has(i)&&"on"),onClick:()=>s(i),title:n.has(i)?`show ${i}`:`hide ${i}`,children:[e("i",{class:"kdot",style:{background:ut[i],opacity:n.has(i)?.3:1}}),i," ",t[i]??0]}))})}function In({values:t,width:n=72,height:s=16}){let i=Math.max(1,...t),r=t.length,a=t.map((o,l)=>`${l/Math.max(1,r-1)*(n-2)+1},${s-1-o/i*(s-3)}`);return e("svg",{width:n,height:s,class:"spark",title:t.join(" "),children:[e("title",{children:["commits per month: ",t.join(" ")]}),e("polyline",{points:a.join(" ")}),t.map((o,l)=>o?e("circle",{cx:l/Math.max(1,r-1)*(n-2)+1,cy:s-1-o/i*(s-3),r:1.4}):null)]})}function zr({files:t,selected:n,onSelect:s}){let[i,r]=Nr(),a=300,o={l:42,r:16,t:12,b:30},l=Math.max(10,r-o.l-o.r),d=a-o.t-o.b,c=t.filter(y=>y.commits>=2),u=Math.max(2,...c.map(y=>y.commits)),h=Math.max(1,...c.map(y=>y.added+y.deleted)),g=y=>o.l+Math.log(y)/Math.log(u)*l,f=y=>o.t+d-y*d,x=y=>3+Math.sqrt((y.added+y.deleted)/h)*13,[m,p]=A(null),v=[...c].sort((y,k)=>k.risk-y.risk).slice(0,5),b=[1,2,5,10,20,50,100,200,500,1e3].filter(y=>y<=u);return e("div",{class:"hist-chart",ref:i,children:[e("svg",{width:r,height:a,children:[e("title",{children:"files by commits and fix share, sized by lines changed"}),[0,.25,.5,.75,1].map(y=>e("g",{children:[e("line",{x1:o.l,x2:r-o.r,y1:f(y),y2:f(y),class:"grid"}),e("text",{x:o.l-6,y:f(y)+3,class:"axis","text-anchor":"end",children:[Math.round(y*100),"%"]})]})),b.filter(y=>g(y)<r-o.r-70).map(y=>e("text",{x:g(y),y:a-8,class:"axis","text-anchor":"middle",children:y})),e("text",{x:r-o.r,y:a-8,class:"axis","text-anchor":"end",children:"commits (log) \u2192"}),e("text",{x:o.l+4,y:o.t+10,class:"axis",children:"share of commits that were fixes \u2191"}),c.map(y=>e("circle",{cx:g(y.commits),cy:f(y.commits?y.fixes/y.commits:0),r:x(y),fill:Ln(y.risk),class:M("dot",n===y.path&&"sel"),onMouseEnter:()=>p(y),onMouseLeave:()=>p(null),onClick:()=>s(y.path)})),v.map(y=>{let k=g(y.commits)>r-160;return e("text",{x:k?g(y.commits)-x(y)-3:g(y.commits)+x(y)+3,y:f(y.fixes/y.commits)+3,class:"lbl","text-anchor":k?"end":"start",children:y.path.split("/").slice(-2).join("/")})})]}),m?e("div",{class:"tip",style:{left:Math.min(r-260,g(m.commits)+12),top:Math.max(0,f(m.fixes/m.commits)-60)},children:[e("b",{children:m.path}),e("div",{class:"muted",children:[m.commits," commits \xB7 ",m.fixes," fixes \xB7 +",m.added,"/-",m.deleted," \xB7 risk"," ",m.risk.toFixed(2)]}),m.reasons.length?e("div",{class:"muted",children:m.reasons.join("; ")}):null]}):null]})}var Ir=["#2563eb","#d97706","#16a34a","#7c3aed","#e11d48","#0284c7","#db2777","#0d9488"],jt=t=>Ir[t%Ir.length];function Hr({rows:t,lanes:n,rowH:s,selected:i}){let a=n*14+10,o=c=>7+c*14,l=c=>c*s+s/2,d=Lr(t);return e("svg",{class:"lanes",width:a,height:t.length*s,children:[e("title",{children:"commit graph"}),d.map(c=>c.kind==="line"?e("line",{x1:o(c.lane),x2:o(c.lane),y1:l(c.from),y2:l(c.to),stroke:jt(c.lane)}):e("path",{d:`M${o(c.fromLane)},${l(c.from)} C${o(c.fromLane)},${l(c.from)+s/2} ${o(c.toLane)},${l(c.to)-s/2} ${o(c.toLane)},${l(c.to)}`,stroke:jt(c.lane)})),t.map((c,u)=>e("circle",{cx:o(c.lane),cy:l(u),r:c.c.merge?3.5:4,fill:c.c.merge?"var(--card)":jt(c.lane),stroke:jt(c.lane),"stroke-width":i===c.c.sha?3:c.c.merge?2:1,class:M(i===c.c.sha&&"sel",!c.c.onHead&&"off")}))]})}function Ut({kind:t,bucket:n}){return e("span",{class:"tag kind",style:{color:Dr(n)},children:t})}function jr({added:t,deleted:n}){let s=t+n,i=5,r=s?Math.round(t/s*i):0,a=s?Math.min(i-r,Math.round(n/s*i)):0;return e("span",{class:"pm",title:`+${t} / -${n}`,children:[e("span",{class:"add",children:["+",K(t)]}),e("span",{class:"del",children:["-",K(n)]}),e("span",{class:"bars",children:Array.from({length:i},(o,l)=>e("i",{class:l<r?"a":l<r+a?"d":""}))})]})}function Or({refs:t,tags:n,max:s=3}){let i=t.filter(r=>!r.startsWith("tag: "));return!i.length&&!n.length?null:e(L,{children:[n.slice(0,2).map(r=>e("span",{class:"ref tag",children:r})),i.slice(0,s).map(r=>e("span",{class:M("ref",r.includes("/")&&"remote"),children:r})),i.length>s?e("span",{class:"ref remote",children:["+",i.length-s]}):null]})}function Ca({c:t}){return e(L,{children:[t.blamedBy?e("span",{class:"flag warn",title:`${t.blamedBy} later fix(es) removed lines from this commit`,children:["\u26A0 ",t.blamedBy]}):null,t.reverted?e("span",{class:"flag bad",title:"reverted",children:"\u21A9"}):null,t.origins&&(t.kind==="fix"||t.kind==="revert")?e("span",{class:"flag ok",title:`traced to ${t.origins} earlier commit(s)`,children:["\u21E0 ",t.origins]}):null,t.breaking?e("span",{class:"flag bad",children:"BREAKING"}):null]})}function Ye({value:t}){return e("span",{class:"riskbar",title:t.toFixed(2),children:e("i",{style:{width:`${Math.round(t*100)}%`,background:Ln(.3+t*.7)}})})}function Le({v:t,k:n,sub:s}){return e("div",{class:"stat",children:[e("div",{class:"v",children:[t,s?e("small",{children:s}):null]}),e("div",{class:"k",children:n})]})}function Qe({commits:t,selected:n,onSelect:s,lanes:i,empty:r}){return t.length?e("div",{class:"commits",children:[i?e(Hr,{rows:i.rows,lanes:i.lanes,rowH:28,selected:n}):null,e("div",{class:"rows",children:t.map(o=>e("div",{class:M("crow",n===o.sha&&"sel",!o.onHead&&"off"),onClick:()=>s(o.sha),title:`${o.sha}
|
|
11
11
|
${o.subject}
|
|
12
12
|
${o.author} \xB7 ${new Date(o.at).toLocaleString()}${o.riskReasons.length?`
|
|
13
|
-
${o.riskReasons.join("; ")}`:""}`,children:[e("span",{class:"when",children:he(o.at)}),e("span",{class:"subj",children:[e("span",{class:"sha",children:o.short}),e(Ut,{kind:o.kind,bucket:o.bucket}),o.subject,e(Or,{refs:o.refs,tags:o.tags})]}),e("span",{class:"meta",children:[e(
|
|
14
|
-
`);return e(L,{children:[e("div",{class:"diff",children:i.map(r=>e("div",{class:r.startsWith("+++")||r.startsWith("---")?"muted":r.startsWith("diff --git")?"file":r.startsWith("@@")?"hunk":r.startsWith("+")?"add":r.startsWith("-")?"del":"",children:r.startsWith("diff --git")?r.replace(/^diff --git a\/(.*) b\/.*$/,"$1"):r||" "}))}),s.data.truncated?e("div",{class:"muted small",children:"diff truncated"}):null]})}function Fa({sha:t,onSelect:n}){let s=H(()=>P("/api/history/commit",{sha:t}),[t]),[i,r]=C(!1);if(O(()=>r(!1),[t]),s.error)return e(G,{error:s.error});if(!s.data)return e(B,{});if(s.data.error)return e(G,{error:s.data.error});let a=s.data,o=a.commit,l=Math.max(1,...a.files.map(d=>d.added+d.deleted));return e("div",{class:"stack",children:[e("div",{class:"card",children:[e("div",{class:"row tight",style:{flexWrap:"wrap"},children:[e(Ut,{kind:o.kind,bucket:o.bucket}),o.scope?e(I,{children:o.scope}):null,o.breaking?e(I,{class:"risk-high",children:"breaking"}):null,o.pr?e(I,{children:["PR #",o.pr]}):null,o.issues.map(d=>e(I,{children:d})),e(Or,{refs:o.refs,tags:o.tags,max:6}),e("span",{class:"spacer"}),e("span",{class:"mono small muted",title:o.sha,children:o.sha.slice(0,12)})]}),e("h3",{style:{marginTop:6},children:o.subject}),e("div",{class:"muted small",children:[o.author," <",o.email,"> \xB7 ",new Date(o.at).toLocaleString()," (",ne(o.at),")",o.merge?" \xB7 merge":` \xB7 +${o.added}/-${o.deleted} in ${o.files} file${o.files===1?"":"s"} (${o.size})`,o.onHead?"":" \xB7 not reachable from HEAD"]}),o.body?e("div",{class:"msg",style:{marginTop:8},children:o.body}):null,o.riskReasons.length?e("div",{class:"row small",style:{marginTop:8,alignItems:"baseline"},children:[e(I,{class:o.risk>=.5?"risk-high":o.risk>=.3?"risk-medium":"risk-low",children:["hindsight ",o.risk.toFixed(2)]}),e("span",{class:"muted",children:o.riskReasons.join("; ")})]}):null,e("div",{class:"row",style:{marginTop:8},children:[e("button",{type:"button",class:"sm",onClick:()=>r(i===!1?null:!1),children:i===!1?"Show diff":"Hide diff"}),a.branches.length?e("span",{class:"muted small",children:["on ",a.branches.slice(0,5).join(", "),a.branches.length>5?` +${a.branches.length-5}`:""]}):null]})]}),a.blamedBy.length||a.origins.length||a.revertedBy?e("div",{class:"card",children:[e("h3",{children:"what history says"}),a.origins.length?e(L,{children:[e("div",{class:"muted small",style:{marginBottom:4},children:o.kind==="revert"?"reverts":"removed lines last written by (likely cause of the bug)"}),e("div",{class:"chain",children:a.origins.map(d=>e("div",{class:M("step","origin"),children:e(Dn,{l:d,onSelect:n})}))})]}):null,a.blamedBy.length?e(L,{children:[e("div",{class:"muted small",style:{margin:"6px 0 4px"},children:"later fixes that removed lines from this commit"}),e("div",{class:"chain",children:a.blamedBy.map(d=>e("div",{class:M("step","fix"),children:[e(Dn,{l:d,onSelect:n}),d.at?e("span",{class:"muted small",children:[Math.max(0,Math.round((d.at-o.at)/864e5)),"d later"]}):null]}))})]}):null,a.revertedBy?e(L,{children:[e("div",{class:"muted small",style:{margin:"6px 0 4px"},children:"reverted by"}),e("div",{class:"chain",children:e("div",{class:"step fix",children:e(Dn,{l:a.revertedBy,onSelect:n})})})]}):null]}):null,i!==!1?e("div",{class:"card",children:[e("div",{class:"row",style:{marginBottom:6},children:[e("h3",{style:{margin:0},children:["diff",i?` \xB7 ${i}`:""]}),i?e("button",{type:"button",class:"sm ghost",onClick:()=>r(null),children:"whole commit"}):null]}),e(Ra,{sha:o.sha,path:i??void 0})]}):null,a.files.length?e("div",{class:"card",children:[e("h3",{children:["files \xB7 ",a.files.length,e("span",{class:"muted small",style:{fontWeight:400,marginLeft:8},children:"symbols are listed when the file has not changed since this commit"})]}),e("div",{class:"cfiles",children:a.files.map(d=>e("div",{class:"cfile",children:[e("div",{class:"row tight",children:[e("a",{class:"ellipsis grow",title:d.path,onClick:()=>z("explore",{file:d.path}),children:d.path}),e(Ce,{value:d.added+d.deleted,max:l,width:44}),e(zr,{added:d.added,deleted:d.deleted})]}),e("div",{class:"row tight small",style:{flexWrap:"wrap"},children:[e("a",{class:"muted",onClick:()=>r(d.path),children:"diff"}),e("a",{class:"muted",onClick:()=>z("history",{tab:"files",file:d.path}),children:"history"}),d.renamedFrom?e("span",{class:"muted",children:["\u2190 ",d.renamedFrom]}):null,d.fileFixes?e("span",{class:"muted",title:`history risk ${d.fileRisk.toFixed(2)}`,children:[e(Ye,{value:d.fileRisk})," ",d.fileFixes," past fix",d.fileFixes===1?"":"es"]}):null,d.symbols.map(c=>e("a",{onClick:()=>z("explore",{file:d.path,symbol:c.id,line:c.line?String(c.line):void 0}),children:[e("span",{class:"muted",children:c.kind})," ",c.name]}))]})]}))})]}):null]})}function Ma({ov:t,params:n,selected:s,onSelect:i}){let[r,a]=C(new Set),[o,l]=C(null),[d,c]=C(n.q??""),[u,h]=C(""),[g,f]=C(n.path??""),[x,m]=C(!1),[p,y]=C(!1),[v,b]=C(150),k=t.buckets.filter(R=>!r.has(R)),S=H(()=>P("/api/history/commits",{buckets:r.size?k.join(","):void 0,q:d.trim()||void 0,author:u||void 0,path:g.trim()||void 0,since:o?new Date(o[0]).toISOString():void 0,until:o?new Date(o[1]).toISOString():void 0,risky:x?1:void 0,head:p?1:void 0,limit:v}),[r,d,u,g,o,x,p,v]),A=H(()=>P("/api/history/graph",{limit:400}),[t.head]),_=Y(()=>{if(!A.data||!S.data)return;let R=new Set(S.data.commits.map($=>$.sha)),T=A.data.commits.slice(0,S.data.commits.length);if(!(T.length!==R.size||!T.every($=>R.has($.sha))))return Mn(T)},[A.data,S.data]),E=Y(()=>{let R={};for(let T of t.weeks)for(let $ of t.buckets)R[$]=(R[$]??0)+T.byBucket[$];return R},[t]);return e("div",{class:"grid wide",style:{alignItems:"start",gridTemplateColumns:"minmax(0, 1.4fr) minmax(320px, 1fr)"},children:[e("div",{class:"stack",children:[e("div",{class:"card",children:[e("div",{class:"row",style:{marginBottom:6,flexWrap:"wrap"},children:[e(Br,{counts:E,hidden:r,onToggle:R=>a(T=>{let $=new Set(T);return $.has(R)?$.delete(R):$.add(R),$})}),e("span",{class:"spacer"}),e("span",{class:"muted small",children:o?e(L,{children:[he(o[0])," \u2192 ",he(o[1])," ",e("a",{onClick:()=>l(null),children:"clear"})]}):"drag across the chart to focus a period"})]}),e(Pr,{weeks:t.weeks,range:o,onRange:l,hidden:r})]}),e("div",{class:"card",children:[e("div",{class:"row",style:{flexWrap:"wrap",marginBottom:8},children:[e("input",{type:"search",placeholder:"search message, sha, issue\u2026",value:d,onInput:R=>c(R.target.value),style:{width:240}}),e("select",{value:u,onChange:R=>h(R.target.value),children:[e("option",{value:"",children:"everyone"}),t.authors.map(R=>e("option",{value:R.name,children:[R.name," (",R.commits,")"]}))]}),e("input",{type:"text",placeholder:"path prefix",value:g,onInput:R=>f(R.target.value),style:{width:180}}),e("button",{type:"button",class:M("chip",x&&"on"),onClick:()=>m(!x),title:"only commits later fixed, reverted, large or touching hotspots",children:"\u26A0 hindsight flags"}),e("button",{type:"button",class:M("chip",p&&"on"),onClick:()=>y(!p),children:"HEAD only"}),e("span",{class:"spacer"}),e("span",{class:"muted small",children:S.data?`${S.data.total} commits`:""})]}),S.error?e(G,{error:S.error}):S.data?e(L,{children:[e(Qe,{commits:S.data.commits,selected:s,onSelect:i,lanes:_}),S.data.total>S.data.commits.length?e("div",{class:"row",style:{marginTop:8},children:e("button",{type:"button",class:"sm",onClick:()=>b(R=>R+200),children:["show more (",S.data.total-S.data.commits.length," left)"]})}):null]}):e(B,{})]})]}),e("div",{class:"stack",children:s?e(Fa,{sha:s,onSelect:i}):e(L,{children:[e("div",{class:"card",children:[e("h3",{children:"worth knowing"}),t.notable.length?e(Qe,{commits:t.notable,selected:null,onSelect:i}):e("div",{class:"muted small",children:"No commit stands out in hindsight."})]}),e("div",{class:"card",children:[e("h3",{children:"people"}),e("table",{children:e("tbody",{children:t.authors.slice(0,8).map(R=>e("tr",{class:"click",onClick:()=>h(R.name),children:[e("td",{children:R.name}),e("td",{class:"num",children:[e(Ce,{value:R.commits,max:t.authors[0]?.commits??1,width:70})," ",R.commits]}),e("td",{class:"muted small",children:[R.fixes," fixes \xB7 ",R.files," files"]}),e("td",{class:"muted small",children:ne(R.lastAt)})]}))})})]}),t.tags.length?e("div",{class:"card",children:[e("h3",{children:"releases"}),e("div",{class:"row tight",style:{flexWrap:"wrap"},children:t.tags.slice(0,20).map(R=>e("a",{onClick:()=>i(R.sha),title:he(R.at),children:e("span",{class:"ref tag",children:R.name})}))})]}):null]})})]})}function La({ov:t,params:n,onSelectCommit:s}){let[i,r]=C(n.branch??null),[a,o]=C(!1),[l,d]=C(!0),c=H(()=>P("/api/history/graph",{limit:120}),[t.head]),u=H(()=>i?P("/api/history/branch",{name:i}):Promise.resolve(null),[i]),h=Y(()=>c.data?Mn(c.data.commits):void 0,[c.data]),g=t.branches.filter(p=>(a||!p.remote)&&(l||!p.merged||p.isDefault)),f=Math.max(1,...g.map(p=>Math.max(p.ahead,p.behind))),[x,m]=C(null);return e("div",{class:"grid wide",style:{alignItems:"start",gridTemplateColumns:"minmax(0, 1fr) minmax(360px, 1fr)"},children:[e("div",{class:"card",children:[e("h3",{children:["commit graph"," ",e("span",{class:"muted small",children:["\xB7 latest ",c.data?.commits.length??""," across all branches"]})]}),c.error?e(G,{error:c.error}):c.data?e(Qe,{commits:c.data.commits,selected:x,onSelect:p=>{m(p),s(p)},lanes:h}):e(B,{})]}),e("div",{class:"stack",children:[e("div",{class:"card",children:[e("div",{class:"row",style:{marginBottom:6},children:[e("h3",{style:{margin:0},children:["branches \xB7 ",g.length]}),e("span",{class:"spacer"}),e("button",{type:"button",class:M("chip",a&&"on"),onClick:()=>o(!a),children:"remotes"}),e("button",{type:"button",class:M("chip",l&&"on"),onClick:()=>d(!l),children:"merged"})]}),e("table",{children:[e("thead",{children:e("tr",{children:[e("th",{children:"branch"}),e("th",{children:["vs ",t.base??"base"]}),e("th",{children:"last"})]})}),e("tbody",{children:g.map(p=>e("tr",{class:M("click",i===p.name&&"sel"),onClick:()=>r(p.name),children:[e("td",{class:"break",children:[e("span",{class:M("ref",p.remote&&"remote"),children:p.name}),p.current?e(I,{children:"current"}):null,p.isDefault?e(I,{children:"base"}):null,!p.merged&&!p.isDefault?e(I,{class:"risk-medium",children:"unmerged"}):null,p.lastSubject?e("div",{class:"muted small ellipsis",style:{maxWidth:260},children:p.lastSubject}):null]}),e("td",{children:p.isDefault?e("span",{class:"muted small",children:"\u2014"}):e("span",{class:"ab",title:`${p.ahead} ahead, ${p.behind} behind`,children:[e("span",{class:"ok",children:["+",p.ahead]}),e(Ce,{value:p.ahead,max:f,width:40}),e(Ce,{value:p.behind,max:f,width:40}),e("span",{class:"bad",children:["-",p.behind]})]})}),e("td",{class:"muted small nowrap",children:[ne(p.at),p.lastAuthor?` \xB7 ${p.lastAuthor.split(" ")[0]}`:""]})]}))})]})]}),i?e("div",{class:"card",children:[e("h3",{children:i}),u.error?e(G,{error:u.error}):u.data?u.data.error?e(G,{error:u.data.error}):e(Ia,{d:u.data,onSelect:p=>{m(p),s(p)}}):e(B,{})]}):e("div",{class:"card muted small",children:"Select a branch to see the commits only it has, the files they touch, and how bug-prone those files have been."})]})]})}function Ia({d:t,onSelect:n}){let s=t.branch,i=t.files.filter(r=>r.risk>=.3);return e(L,{children:[e("div",{class:"row small",style:{flexWrap:"wrap"},children:[e(I,{children:["tip ",s.sha.slice(0,7)]}),e(I,{children:ne(s.at)}),s.upstream?e(I,{children:["tracks ",s.upstream]}):null,s.isDefault?null:e(I,{class:s.merged?"s-accepted":"risk-medium",children:s.merged?"merged":`+${s.ahead} / -${s.behind}`})]}),s.isDefault?e("div",{class:"muted small",style:{marginTop:6},children:"This is the base branch; other branches are compared against it."}):e(L,{children:[e("div",{class:"muted small",style:{margin:"8px 0 4px"},children:[t.commits.length," commit",t.commits.length===1?"":"s"," only on this branch"]}),e(Qe,{commits:t.commits,selected:null,onSelect:n,empty:"Nothing unique: the branch is fully merged or behind."}),t.files.length?e(L,{children:[e("div",{class:"muted small",style:{margin:"8px 0 4px"},children:["files touched ",i.length?`\xB7 ${i.length} with a fix-heavy history`:""]}),e("div",{class:"list",style:{maxHeight:220},children:t.files.map(r=>e("div",{class:"item",onClick:()=>z("history",{tab:"files",file:r.path}),children:e("div",{class:"p",children:[r.risk>=.3?e(Ye,{value:r.risk}):null," ",r.path,e("span",{class:"muted",children:[" ","\xB7 ",r.commits," commit",r.commits===1?"":"s",r.fixes?`, ${r.fixes} past fixes`:""]})]})}))})]}):null]})]})}function Da({params:t,onSelectCommit:n}){let[s,i]=C(""),[r,a]=C(t.file??null);O(()=>{t.file&&a(t.file)},[t.file]);let o=H(()=>P("/api/history/files",{path:s.trim()||void 0,limit:400}),[s]),{sorted:l,th:d}=Ve(o.data?.files,"risk"),[c,u]=C(null);return e("div",{class:"grid wide",style:{alignItems:"start",gridTemplateColumns:"minmax(0, 1fr) minmax(360px, 1fr)"},children:[e("div",{class:"stack",children:[e("div",{class:"card",children:[e("div",{class:"row",style:{marginBottom:6},children:[e("h3",{style:{margin:0},children:"churn vs fix share"}),e("input",{type:"text",placeholder:"folder prefix, e.g. src/graph/",value:s,onInput:h=>i(h.target.value),style:{width:220}}),e("span",{class:"spacer"}),e("span",{class:"muted small",children:"size = lines changed \xB7 colour = history risk"})]}),o.data?e(Hr,{files:o.data.files,selected:r,onSelect:a}):o.error?e(G,{error:o.error}):e(B,{})]}),e("div",{class:"card flush",children:e("table",{children:[e("thead",{children:e("tr",{children:[d("path","file"),d("commits","commits",!0),d("fixes","fixes",!0),d("bugOrigins","caused fixes",!0),d("commits90d","90d",!0),e("th",{children:"12 months"}),d("risk","risk",!0)]})}),e("tbody",{children:l.slice(0,150).map(h=>e("tr",{class:M("click",r===h.path&&"sel"),onClick:()=>a(h.path),children:[e("td",{class:"break",children:h.path}),e("td",{class:"num",children:h.commits}),e("td",{class:"num",children:h.fixes}),e("td",{class:"num",children:h.bugOrigins}),e("td",{class:"num",children:h.commits90d}),e("td",{children:e(In,{values:h.months})}),e("td",{class:"num",children:[e(Ye,{value:h.risk})," ",h.risk.toFixed(2)]})]}))})]})})]}),e("div",{class:"stack",children:r?e(Na,{path:r,selected:c,onSelect:h=>{u(h),n(h)}}):e("div",{class:"card muted small",children:"Pick a file to read its story: who changed it, what broke afterwards, and which fixes restored behaviour worth a test."})})]})}function Na({path:t,selected:n,onSelect:s}){let i=H(()=>P("/api/history/file",{path:t}),[t]);if(i.error)return e(G,{error:i.error});if(!i.data)return e(B,{});let r=i.data,a=r.file;return e(L,{children:[e("div",{class:"card",children:[e("h3",{class:"break",children:t}),a?e(L,{children:[e("div",{class:"row small",style:{flexWrap:"wrap"},children:[e(I,{children:[a.commits," commits"]}),e(I,{children:[a.fixes," fixes"]}),e(I,{children:["+",K(a.added),"/-",K(a.deleted)]}),e(I,{children:[he(a.firstAt)," \u2192 ",he(a.lastAt)]}),a.renamedFrom?e(I,{children:["from ",a.renamedFrom]}):null]}),e("div",{class:"row small",style:{marginTop:6,alignItems:"center"},children:[e(Ye,{value:a.risk}),e("span",{class:"muted",children:["history risk ",a.risk.toFixed(2),a.reasons.length?`: ${a.reasons.join("; ")}`:""]})]}),e("div",{class:"row small",style:{marginTop:6,flexWrap:"wrap"},children:[e("span",{class:"muted",children:"authors:"}),a.authors.map(([o,l])=>e(I,{children:[o," ",l]})),e("span",{class:"spacer"}),e(In,{values:a.months,width:120,height:22})]}),e("div",{class:"row",style:{marginTop:8},children:[e("button",{type:"button",class:"sm",onClick:()=>z("explore",{file:t}),children:"Open source"}),e("button",{type:"button",class:"sm",onClick:()=>z("galaxy",{node:`file:${t}`}),children:"Galaxy"})]})]}):e("div",{class:"muted small",children:"No commits in the loaded window touch this file."})]}),r.origins.length?e("div",{class:"card",children:[e("h3",{children:"changes that later needed fixing"}),e("div",{class:"chain",children:r.origins.map(o=>e("div",{class:"step origin",children:[e("a",{onClick:()=>s(o.sha),children:[e("span",{class:"mono muted small",children:o.short})," ",e(Ut,{kind:o.kind,bucket:o.bucket})," ",o.subject]}),e("span",{class:"muted small",children:[" \xB7 ",he(o.at)]}),e("div",{class:"chain",style:{marginTop:2},children:o.fixes.map(l=>e("div",{class:"step fix",children:[e("a",{onClick:()=>s(l.sha),children:[e("span",{class:"mono muted small",children:l.short})," ",l.subject]}),e("span",{class:"muted small",children:[" \xB7 ",l.daysLater,"d later"]})]}))})]}))})]}):null,e("div",{class:"card",children:[e("h3",{children:["timeline \xB7 ",r.commits.length]}),e(Qe,{commits:r.commits,selected:n,onSelect:s})]})]})}function Pa({ov:t,onSelectCommit:n}){let s=H(()=>P("/api/history/risk"),[t.head,t.stats.workingTree]),[i,r]=C(""),a=H(()=>i.trim()?P("/api/history/risk",{paths:i.trim()}):Promise.resolve(null),[i]),o=i.trim()?a.data:s.data,l=H(()=>P("/api/history/commits",{risky:1,limit:40}).then(d=>d.commits.filter(c=>c.blamedBy||c.reverted)),[t.head]);return e("div",{class:"grid wide",style:{alignItems:"start"},children:[e("div",{class:"stack",children:[e("div",{class:"card",children:[e("div",{class:"row",style:{marginBottom:6},children:[e("h3",{style:{margin:0},children:i.trim()?"history risk for these paths":"working tree exposure"}),e("input",{type:"text",placeholder:"or paths, comma separated",value:i,onInput:d=>r(d.target.value),style:{width:300}})]}),e("div",{class:"muted small",style:{marginBottom:8},children:"What the past says about the files you are changing now: fix density, changes here that were later fixed, and the last fix to re-read before editing."}),o?o.files.length?e("table",{children:[e("thead",{children:e("tr",{children:[e("th",{children:"file"}),e("th",{children:"risk"}),e("th",{children:"history"})]})}),e("tbody",{children:[...o.files].sort((d,c)=>(c.file?.risk??-1)-(d.file?.risk??-1)).map(d=>e("tr",{children:[e("td",{class:"break",children:e("a",{onClick:()=>z("history",{tab:"files",file:d.path}),children:d.path})}),e("td",{class:"nowrap",children:d.file?e(L,{children:[e(Ye,{value:d.file.risk})," ",d.file.risk.toFixed(2)]}):e("span",{class:"muted small",children:"new"})}),e("td",{class:"small",children:d.file?e(L,{children:[e("div",{class:"muted",children:[d.file.commits," commits \xB7 ",d.file.fixes," fixes \xB7 last"," ",ne(d.file.lastAt),d.file.reasons.length?` \xB7 ${d.file.reasons.join("; ")}`:""]}),d.lastFix?e("div",{children:["last fix: ",d.lastFix]}):null,d.origins.length?e("div",{children:["needed fixing before:"," ",d.origins.map(c=>e("a",{onClick:()=>n(c.sha),style:{marginRight:6},children:[c.short," ",c.subject.slice(0,40)]}))]}):null]}):e("span",{class:"muted",children:"no history yet"})})]}))})]}):e(q,{children:"Working tree is clean."}):s.error?e(G,{error:s.error}):e(B,{})]}),e("div",{class:"card",children:[e("h3",{children:"bug-prone files"}),t.risky.length?e("table",{children:e("tbody",{children:t.risky.map(d=>e("tr",{class:"click",onClick:()=>z("history",{tab:"files",file:d.path}),children:[e("td",{class:"break",children:d.path}),e("td",{class:"nowrap",children:[e(Ye,{value:d.risk})," ",d.risk.toFixed(2)]}),e("td",{class:"muted small",children:d.reasons.join("; ")||`${d.commits} commits`})]}))})}):e("div",{class:"muted small",children:"No file shows a fix pattern yet."})]})]}),e("div",{class:"stack",children:[e("div",{class:"card",children:[e("h3",{children:"lessons from this history"}),t.lessons.length?t.lessons.map(d=>e(Ba,{text:d})):e("div",{class:"muted small",children:"Not enough history yet."}),t.stats.tracePending?e("div",{class:"muted small",style:{marginTop:6},children:[t.stats.tracePending," fixes still to trace; reload to continue."]}):null]}),e("div",{class:"card",children:[e("h3",{children:"changes that later needed fixing"}),e("div",{class:"muted small",style:{marginBottom:6},children:"A fix removed lines these commits wrote. The pattern, not the blame, is the lesson: what kind of change tends to break here?"}),l.data?e(Qe,{commits:l.data,selected:null,onSelect:n,empty:"No traced fix origins yet."}):e(B,{})]})]})]})}function Ba({text:t}){return e("div",{class:"lesson",children:[e("span",{class:"i",children:"\u25C6"}),e("span",{children:t})]})}function Ur({params:t}){let[n,s]=C(t.tab||(t.file?"files":t.branch?"branches":"timeline")),[i,r]=C(t.sha??null);O(()=>{t.tab?s(t.tab):t.file?s("files"):t.branch&&s("branches")},[t.tab,t.file,t.branch]),O(()=>{t.sha&&r(t.sha)},[t.sha]);let a=H(()=>P("/api/history"),[]),o=u=>{r(u),s("timeline")};if(a.error)return e("div",{class:"page",children:e(G,{error:a.error})});if(!a.data)return e("div",{class:"page",children:e(B,{})});let l=a.data;if(!l.git)return e("div",{class:"page",children:e(q,{children:[l.error??"Not a git repository."," The history explorer reads `git log`; initialise a repository and commit to use it."]})});let d=l.stats,c=d.prior30?Math.round((d.last30-d.prior30)/d.prior30*100):null;return e("div",{class:"page",children:[e("div",{class:"hist-stats",children:[e(Le,{v:d.commits,k:"commits",sub:`${d.onHead} on HEAD`}),e(Le,{v:d.last30,k:"last 30 days",sub:c===null?`${d.prior30} in the 30 before`:`${c>=0?"+":""}${c}% vs prior 30`}),e(Le,{v:d.fixes,k:"fixes",sub:`${Math.round(d.fixes/Math.max(1,d.commits-d.merges)*100)}%`}),e(Le,{v:d.linksTraced,k:"traced fix origins",sub:d.tracePending?`${d.tracePending} pending`:`${d.fixesTraced} fixes`}),e(Le,{v:d.branches,k:"branches",sub:d.unmerged?`${d.unmerged} unmerged`:"all merged"}),e(Le,{v:d.authors,k:"authors",sub:`${d.files} files`}),e(Le,{v:d.tags,k:"tags",sub:l.tags[0]?.name??""}),e(Le,{v:d.workingTree,k:"working tree",sub:l.branch??"detached"})]}),e("div",{class:"row",style:{marginBottom:8},children:[e(Te,{tabs:[["timeline","Timeline"],["branches","Branches"],["files","Files"],["risk","Risk & lessons"]],value:n,onChange:u=>{s(u),z("history",{tab:u,sha:i??void 0})}}),e("span",{class:"spacer"}),e("span",{class:"muted small",children:[l.branch??"detached"," @ ",l.head.slice(0,7)," \xB7 built ",ne(l.builtAt)," ",e("a",{onClick:()=>P("/api/history",{refresh:1}).then(()=>a.reload()),children:"rebuild"})]})]}),n==="timeline"&&e(Ma,{ov:l,params:t,selected:i,onSelect:r}),n==="branches"&&e(La,{ov:l,params:t,onSelectCommit:o}),n==="files"&&e(Da,{params:t,onSelectCommit:o}),n==="risk"&&e(Pa,{ov:l,onSelectCommit:o})]})}var Ha=/^([a-z][a-z0-9+.-]*):(.*)$/i;function pt(t){let n=t.trim();if(!n)return{kind:"text"};if(n.startsWith("#"))return{kind:"anchor",href:n};let s=Ha.exec(n);if(!s){let a=n.replace(/^\.\//,"").split("#")[0]??"";return a?{kind:"file",file:a}:{kind:"text"}}let i=s[1].toLowerCase(),r=s[2];switch(i){case"mem":return r?{kind:"memory",name:r}:{kind:"text"};case"file":case"sym":{let a=r.replace(/^\/+/,"").split("#")[0]??"";return a?{kind:"file",file:a}:{kind:"text"}}case"http":case"https":case"mailto":return{kind:"external",href:n};default:return{kind:"text"}}}function Xt(t){if(t.kind==="memory")return`#/memory?name=${encodeURIComponent(t.name)}`;if(t.kind==="file")return`#/explore?file=${encodeURIComponent(t.file)}`}function Hn(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Oe=Hn();function ei(t){Oe=t}var He={exec:()=>null};function et(t){let n=[];return s=>{let i=Math.max(0,Math.min(3,s-1)),r=n[i];return r||(r=t(i),n[i]=r),r}}function U(t,n=""){let s=typeof t=="string"?t:t.source,i={replace:(r,a)=>{let o=typeof a=="string"?a:a.source;return o=o.replace(ce.caret,"$1"),s=s.replace(r,o),i},getRegex:()=>new RegExp(s,n)};return i}var ja=((t="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+t)}catch{return!1}})(),ce={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:et(t=>new RegExp(`^ {0,${t}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:et(t=>new RegExp(`^ {0,${t}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:et(t=>new RegExp(`^ {0,${t}}(?:\`\`\`|~~~)`)),headingBeginRegex:et(t=>new RegExp(`^ {0,${t}}#`)),htmlBeginRegex:et(t=>new RegExp(`^ {0,${t}}(?:</?(?:${ft})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,"i")),blockquoteBeginRegex:et(t=>new RegExp(`^ {0,${t}}>`))},za=/^(?:[ \t]*(?:\n|$))+/,Oa=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ua=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,gt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Xa=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,jn=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ti=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ni=U(ti).replace(/bull/g,jn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ga=U(ti).replace(/bull/g,jn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),zn=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,qa=/^[^\n]+/,On=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Wa=U(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",On).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ja=U(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,jn).getRegex(),ft="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Un=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Va=U("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Un).replace("tag",ft).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),si=t=>U(zn).replace("hr",gt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",t).replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",ft).getRegex(),Za=si(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Ka=si(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Ya=U(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ka).getRegex(),Xn={blockquote:Ya,code:Oa,def:Wa,fences:Ua,heading:Xa,hr:gt,html:Va,lheading:ni,list:Ja,newline:za,paragraph:Za,table:He,text:qa},Xr=U("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",gt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",ft).getRegex(),Qa={...Xn,lheading:Ga,table:Xr,paragraph:U(zn).replace("hr",gt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Xr).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",ft).getRegex()},eo={...Xn,html:U(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Un).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:He,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:U(zn).replace("hr",gt).replace("heading",` *#{1,6} *[^
|
|
15
|
-
]`).replace("lheading",ni).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},to=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,no=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ri=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,so=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ee=/[\p{P}\p{S}]/u,tt=/[\s\p{P}\p{S}]/u,bt=/[^\s\p{P}\p{S}]/u,ro=U(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,tt).getRegex(),io=/[\p{Pi}\p{Ps}"']/u,ii=/(?!~)[\p{P}\p{S}]/u,ao=/(?!~)[\s\p{P}\p{S}]/u,oo=/(?:[^\s\p{P}\p{S}]|~)/u,lo=U(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",
|
|
13
|
+
${o.riskReasons.join("; ")}`:""}`,children:[e("span",{class:"when",children:he(o.at)}),e("span",{class:"subj",children:[e("span",{class:"sha",children:o.short}),e(Ut,{kind:o.kind,bucket:o.bucket}),o.subject,e(Or,{refs:o.refs,tags:o.tags})]}),e("span",{class:"meta",children:[e(Ca,{c:o}),o.merge?e("span",{children:"merge"}):e(jr,{added:o.added,deleted:o.deleted}),e("span",{children:o.author.split(" ")[0]})]})]}))})]}):e(G,{children:r??"No commits match."})}function Dn({l:t,onSelect:n}){return e("div",{class:"step",onClick:()=>n(t.sha),style:{cursor:"pointer"},children:[e("span",{class:"sha mono muted",children:t.short})," ",t.kind&&t.bucket?e(Ut,{kind:t.kind,bucket:t.bucket}):null,e("a",{children:t.subject}),t.at?e("span",{class:"muted small",children:[" \xB7 ",he(t.at)]}):null,t.paths.length?e("div",{class:"muted small",children:t.paths.join(", ")}):null]})}function Ra({sha:t,path:n}){let s=z(()=>P("/api/history/diff",{sha:t,path:n}),[t,n]);if(s.error)return e(q,{error:s.error});if(!s.data)return e(B,{});let i=s.data.text.split(`
|
|
14
|
+
`);return e(L,{children:[e("div",{class:"diff",children:i.map(r=>e("div",{class:r.startsWith("+++")||r.startsWith("---")?"muted":r.startsWith("diff --git")?"file":r.startsWith("@@")?"hunk":r.startsWith("+")?"add":r.startsWith("-")?"del":"",children:r.startsWith("diff --git")?r.replace(/^diff --git a\/(.*) b\/.*$/,"$1"):r||" "}))}),s.data.truncated?e("div",{class:"muted small",children:"diff truncated"}):null]})}function Fa({sha:t,onSelect:n}){let s=z(()=>P("/api/history/commit",{sha:t}),[t]),[i,r]=A(!1);if(O(()=>r(!1),[t]),s.error)return e(q,{error:s.error});if(!s.data)return e(B,{});if(s.data.error)return e(q,{error:s.data.error});let a=s.data,o=a.commit,l=Math.max(1,...a.files.map(d=>d.added+d.deleted));return e("div",{class:"stack",children:[e("div",{class:"card",children:[e("div",{class:"row tight",style:{flexWrap:"wrap"},children:[e(Ut,{kind:o.kind,bucket:o.bucket}),o.scope?e(I,{children:o.scope}):null,o.breaking?e(I,{class:"risk-high",children:"breaking"}):null,o.pr?e(I,{children:["PR #",o.pr]}):null,o.issues.map(d=>e(I,{children:d})),e(Or,{refs:o.refs,tags:o.tags,max:6}),e("span",{class:"spacer"}),e("span",{class:"mono small muted",title:o.sha,children:o.sha.slice(0,12)})]}),e("h3",{style:{marginTop:6},children:o.subject}),e("div",{class:"muted small",children:[o.author," <",o.email,"> \xB7 ",new Date(o.at).toLocaleString()," (",ne(o.at),")",o.merge?" \xB7 merge":` \xB7 +${o.added}/-${o.deleted} in ${o.files} file${o.files===1?"":"s"} (${o.size})`,o.onHead?"":" \xB7 not reachable from HEAD"]}),o.body?e("div",{class:"msg",style:{marginTop:8},children:o.body}):null,o.riskReasons.length?e("div",{class:"row small",style:{marginTop:8,alignItems:"baseline"},children:[e(I,{class:o.risk>=.5?"risk-high":o.risk>=.3?"risk-medium":"risk-low",children:["hindsight ",o.risk.toFixed(2)]}),e("span",{class:"muted",children:o.riskReasons.join("; ")})]}):null,e("div",{class:"row",style:{marginTop:8},children:[e("button",{type:"button",class:"sm",onClick:()=>r(i===!1?null:!1),children:i===!1?"Show diff":"Hide diff"}),a.branches.length?e("span",{class:"muted small",children:["on ",a.branches.slice(0,5).join(", "),a.branches.length>5?` +${a.branches.length-5}`:""]}):null]})]}),a.blamedBy.length||a.origins.length||a.revertedBy?e("div",{class:"card",children:[e("h3",{children:"what history says"}),a.origins.length?e(L,{children:[e("div",{class:"muted small",style:{marginBottom:4},children:o.kind==="revert"?"reverts":"removed lines last written by (likely cause of the bug)"}),e("div",{class:"chain",children:a.origins.map(d=>e("div",{class:M("step","origin"),children:e(Dn,{l:d,onSelect:n})}))})]}):null,a.blamedBy.length?e(L,{children:[e("div",{class:"muted small",style:{margin:"6px 0 4px"},children:"later fixes that removed lines from this commit"}),e("div",{class:"chain",children:a.blamedBy.map(d=>e("div",{class:M("step","fix"),children:[e(Dn,{l:d,onSelect:n}),d.at?e("span",{class:"muted small",children:[Math.max(0,Math.round((d.at-o.at)/864e5)),"d later"]}):null]}))})]}):null,a.revertedBy?e(L,{children:[e("div",{class:"muted small",style:{margin:"6px 0 4px"},children:"reverted by"}),e("div",{class:"chain",children:e("div",{class:"step fix",children:e(Dn,{l:a.revertedBy,onSelect:n})})})]}):null]}):null,i!==!1?e("div",{class:"card",children:[e("div",{class:"row",style:{marginBottom:6},children:[e("h3",{style:{margin:0},children:["diff",i?` \xB7 ${i}`:""]}),i?e("button",{type:"button",class:"sm ghost",onClick:()=>r(null),children:"whole commit"}):null]}),e(Ra,{sha:o.sha,path:i??void 0})]}):null,a.files.length?e("div",{class:"card",children:[e("h3",{children:["files \xB7 ",a.files.length,e("span",{class:"muted small",style:{fontWeight:400,marginLeft:8},children:"symbols are listed when the file has not changed since this commit"})]}),e("div",{class:"cfiles",children:a.files.map(d=>e("div",{class:"cfile",children:[e("div",{class:"row tight",children:[e("a",{class:"ellipsis grow",title:d.path,onClick:()=>j("explore",{file:d.path}),children:d.path}),e(Ae,{value:d.added+d.deleted,max:l,width:44}),e(jr,{added:d.added,deleted:d.deleted})]}),e("div",{class:"row tight small",style:{flexWrap:"wrap"},children:[e("a",{class:"muted",onClick:()=>r(d.path),children:"diff"}),e("a",{class:"muted",onClick:()=>j("history",{tab:"files",file:d.path}),children:"history"}),d.renamedFrom?e("span",{class:"muted",children:["\u2190 ",d.renamedFrom]}):null,d.fileFixes?e("span",{class:"muted",title:`history risk ${d.fileRisk.toFixed(2)}`,children:[e(Ye,{value:d.fileRisk})," ",d.fileFixes," past fix",d.fileFixes===1?"":"es"]}):null,d.symbols.map(c=>e("a",{onClick:()=>j("explore",{file:d.path,symbol:c.id,line:c.line?String(c.line):void 0}),children:[e("span",{class:"muted",children:c.kind})," ",c.name]}))]})]}))})]}):null]})}function Ma({ov:t,params:n,selected:s,onSelect:i}){let[r,a]=A(new Set),[o,l]=A(null),[d,c]=A(n.q??""),[u,h]=A(""),[g,f]=A(n.path??""),[x,m]=A(!1),[p,v]=A(!1),[b,y]=A(150),k=t.buckets.filter(R=>!r.has(R)),S=z(()=>P("/api/history/commits",{buckets:r.size?k.join(","):void 0,q:d.trim()||void 0,author:u||void 0,path:g.trim()||void 0,since:o?new Date(o[0]).toISOString():void 0,until:o?new Date(o[1]).toISOString():void 0,risky:x?1:void 0,head:p?1:void 0,limit:b}),[r,d,u,g,o,x,p,b]),$=z(()=>P("/api/history/graph",{limit:400}),[t.head]),_=Y(()=>{if(!$.data||!S.data)return;let R=new Set(S.data.commits.map(C=>C.sha)),T=$.data.commits.slice(0,S.data.commits.length);if(!(T.length!==R.size||!T.every(C=>R.has(C.sha))))return Mn(T)},[$.data,S.data]),E=Y(()=>{let R={};for(let T of t.weeks)for(let C of t.buckets)R[C]=(R[C]??0)+T.byBucket[C];return R},[t]);return e("div",{class:"grid wide",style:{alignItems:"start",gridTemplateColumns:"minmax(0, 1.4fr) minmax(320px, 1fr)"},children:[e("div",{class:"stack",children:[e("div",{class:"card",children:[e("div",{class:"row",style:{marginBottom:6,flexWrap:"wrap"},children:[e(Br,{counts:E,hidden:r,onToggle:R=>a(T=>{let C=new Set(T);return C.has(R)?C.delete(R):C.add(R),C})}),e("span",{class:"spacer"}),e("span",{class:"muted small",children:o?e(L,{children:[he(o[0])," \u2192 ",he(o[1])," ",e("a",{onClick:()=>l(null),children:"clear"})]}):"drag across the chart to focus a period"})]}),e(Pr,{weeks:t.weeks,range:o,onRange:l,hidden:r})]}),e("div",{class:"card",children:[e("div",{class:"row",style:{flexWrap:"wrap",marginBottom:8},children:[e("input",{type:"search",placeholder:"search message, sha, issue\u2026",value:d,onInput:R=>c(R.target.value),style:{width:240}}),e("select",{value:u,onChange:R=>h(R.target.value),children:[e("option",{value:"",children:"everyone"}),t.authors.map(R=>e("option",{value:R.name,children:[R.name," (",R.commits,")"]}))]}),e("input",{type:"text",placeholder:"path prefix",value:g,onInput:R=>f(R.target.value),style:{width:180}}),e("button",{type:"button",class:M("chip",x&&"on"),onClick:()=>m(!x),title:"only commits later fixed, reverted, large or touching hotspots",children:"\u26A0 hindsight flags"}),e("button",{type:"button",class:M("chip",p&&"on"),onClick:()=>v(!p),children:"HEAD only"}),e("span",{class:"spacer"}),e("span",{class:"muted small",children:S.data?`${S.data.total} commits`:""})]}),S.error?e(q,{error:S.error}):S.data?e(L,{children:[e(Qe,{commits:S.data.commits,selected:s,onSelect:i,lanes:_}),S.data.total>S.data.commits.length?e("div",{class:"row",style:{marginTop:8},children:e("button",{type:"button",class:"sm",onClick:()=>y(R=>R+200),children:["show more (",S.data.total-S.data.commits.length," left)"]})}):null]}):e(B,{})]})]}),e("div",{class:"stack",children:s?e(Fa,{sha:s,onSelect:i}):e(L,{children:[e("div",{class:"card",children:[e("h3",{children:"worth knowing"}),t.notable.length?e(Qe,{commits:t.notable,selected:null,onSelect:i}):e("div",{class:"muted small",children:"No commit stands out in hindsight."})]}),e("div",{class:"card",children:[e("h3",{children:"people"}),e("table",{children:e("tbody",{children:t.authors.slice(0,8).map(R=>e("tr",{class:"click",onClick:()=>h(R.name),children:[e("td",{children:R.name}),e("td",{class:"num",children:[e(Ae,{value:R.commits,max:t.authors[0]?.commits??1,width:70})," ",R.commits]}),e("td",{class:"muted small",children:[R.fixes," fixes \xB7 ",R.files," files"]}),e("td",{class:"muted small",children:ne(R.lastAt)})]}))})})]}),t.tags.length?e("div",{class:"card",children:[e("h3",{children:"releases"}),e("div",{class:"row tight",style:{flexWrap:"wrap"},children:t.tags.slice(0,20).map(R=>e("a",{onClick:()=>i(R.sha),title:he(R.at),children:e("span",{class:"ref tag",children:R.name})}))})]}):null]})})]})}function La({ov:t,params:n,onSelectCommit:s}){let[i,r]=A(n.branch??null),[a,o]=A(!1),[l,d]=A(!0),c=z(()=>P("/api/history/graph",{limit:120}),[t.head]),u=z(()=>i?P("/api/history/branch",{name:i}):Promise.resolve(null),[i]),h=Y(()=>c.data?Mn(c.data.commits):void 0,[c.data]),g=t.branches.filter(p=>(a||!p.remote)&&(l||!p.merged||p.isDefault)),f=Math.max(1,...g.map(p=>Math.max(p.ahead,p.behind))),[x,m]=A(null);return e("div",{class:"grid wide",style:{alignItems:"start",gridTemplateColumns:"minmax(0, 1fr) minmax(360px, 1fr)"},children:[e("div",{class:"card",children:[e("h3",{children:["commit graph"," ",e("span",{class:"muted small",children:["\xB7 latest ",c.data?.commits.length??""," across all branches"]})]}),c.error?e(q,{error:c.error}):c.data?e(Qe,{commits:c.data.commits,selected:x,onSelect:p=>{m(p),s(p)},lanes:h}):e(B,{})]}),e("div",{class:"stack",children:[e("div",{class:"card",children:[e("div",{class:"row",style:{marginBottom:6},children:[e("h3",{style:{margin:0},children:["branches \xB7 ",g.length]}),e("span",{class:"spacer"}),e("button",{type:"button",class:M("chip",a&&"on"),onClick:()=>o(!a),children:"remotes"}),e("button",{type:"button",class:M("chip",l&&"on"),onClick:()=>d(!l),children:"merged"})]}),e("table",{children:[e("thead",{children:e("tr",{children:[e("th",{children:"branch"}),e("th",{children:["vs ",t.base??"base"]}),e("th",{children:"last"})]})}),e("tbody",{children:g.map(p=>e("tr",{class:M("click",i===p.name&&"sel"),onClick:()=>r(p.name),children:[e("td",{class:"break",children:[e("span",{class:M("ref",p.remote&&"remote"),children:p.name}),p.current?e(I,{children:"current"}):null,p.isDefault?e(I,{children:"base"}):null,!p.merged&&!p.isDefault?e(I,{class:"risk-medium",children:"unmerged"}):null,p.lastSubject?e("div",{class:"muted small ellipsis",style:{maxWidth:260},children:p.lastSubject}):null]}),e("td",{children:p.isDefault?e("span",{class:"muted small",children:"\u2014"}):e("span",{class:"ab",title:`${p.ahead} ahead, ${p.behind} behind`,children:[e("span",{class:"ok",children:["+",p.ahead]}),e(Ae,{value:p.ahead,max:f,width:40}),e(Ae,{value:p.behind,max:f,width:40}),e("span",{class:"bad",children:["-",p.behind]})]})}),e("td",{class:"muted small nowrap",children:[ne(p.at),p.lastAuthor?` \xB7 ${p.lastAuthor.split(" ")[0]}`:""]})]}))})]})]}),i?e("div",{class:"card",children:[e("h3",{children:i}),u.error?e(q,{error:u.error}):u.data?u.data.error?e(q,{error:u.data.error}):e(Ia,{d:u.data,onSelect:p=>{m(p),s(p)}}):e(B,{})]}):e("div",{class:"card muted small",children:"Select a branch to see the commits only it has, the files they touch, and how bug-prone those files have been."})]})]})}function Ia({d:t,onSelect:n}){let s=t.branch,i=t.files.filter(r=>r.risk>=.3);return e(L,{children:[e("div",{class:"row small",style:{flexWrap:"wrap"},children:[e(I,{children:["tip ",s.sha.slice(0,7)]}),e(I,{children:ne(s.at)}),s.upstream?e(I,{children:["tracks ",s.upstream]}):null,s.isDefault?null:e(I,{class:s.merged?"s-accepted":"risk-medium",children:s.merged?"merged":`+${s.ahead} / -${s.behind}`})]}),s.isDefault?e("div",{class:"muted small",style:{marginTop:6},children:"This is the base branch; other branches are compared against it."}):e(L,{children:[e("div",{class:"muted small",style:{margin:"8px 0 4px"},children:[t.commits.length," commit",t.commits.length===1?"":"s"," only on this branch"]}),e(Qe,{commits:t.commits,selected:null,onSelect:n,empty:"Nothing unique: the branch is fully merged or behind."}),t.files.length?e(L,{children:[e("div",{class:"muted small",style:{margin:"8px 0 4px"},children:["files touched ",i.length?`\xB7 ${i.length} with a fix-heavy history`:""]}),e("div",{class:"list",style:{maxHeight:220},children:t.files.map(r=>e("div",{class:"item",onClick:()=>j("history",{tab:"files",file:r.path}),children:e("div",{class:"p",children:[r.risk>=.3?e(Ye,{value:r.risk}):null," ",r.path,e("span",{class:"muted",children:[" ","\xB7 ",r.commits," commit",r.commits===1?"":"s",r.fixes?`, ${r.fixes} past fixes`:""]})]})}))})]}):null]})]})}function Da({params:t,onSelectCommit:n}){let[s,i]=A(""),[r,a]=A(t.file??null);O(()=>{t.file&&a(t.file)},[t.file]);let o=z(()=>P("/api/history/files",{path:s.trim()||void 0,limit:400}),[s]),{sorted:l,th:d}=Ve(o.data?.files,"risk"),[c,u]=A(null);return e("div",{class:"grid wide",style:{alignItems:"start",gridTemplateColumns:"minmax(0, 1fr) minmax(360px, 1fr)"},children:[e("div",{class:"stack",children:[e("div",{class:"card",children:[e("div",{class:"row",style:{marginBottom:6},children:[e("h3",{style:{margin:0},children:"churn vs fix share"}),e("input",{type:"text",placeholder:"folder prefix, e.g. src/graph/",value:s,onInput:h=>i(h.target.value),style:{width:220}}),e("span",{class:"spacer"}),e("span",{class:"muted small",children:"size = lines changed \xB7 colour = history risk"})]}),o.data?e(zr,{files:o.data.files,selected:r,onSelect:a}):o.error?e(q,{error:o.error}):e(B,{})]}),e("div",{class:"card flush",children:e("table",{children:[e("thead",{children:e("tr",{children:[d("path","file"),d("commits","commits",!0),d("fixes","fixes",!0),d("bugOrigins","caused fixes",!0),d("commits90d","90d",!0),e("th",{children:"12 months"}),d("risk","risk",!0)]})}),e("tbody",{children:l.slice(0,150).map(h=>e("tr",{class:M("click",r===h.path&&"sel"),onClick:()=>a(h.path),children:[e("td",{class:"break",children:h.path}),e("td",{class:"num",children:h.commits}),e("td",{class:"num",children:h.fixes}),e("td",{class:"num",children:h.bugOrigins}),e("td",{class:"num",children:h.commits90d}),e("td",{children:e(In,{values:h.months})}),e("td",{class:"num",children:[e(Ye,{value:h.risk})," ",h.risk.toFixed(2)]})]}))})]})})]}),e("div",{class:"stack",children:r?e(Na,{path:r,selected:c,onSelect:h=>{u(h),n(h)}}):e("div",{class:"card muted small",children:"Pick a file to read its story: who changed it, what broke afterwards, and which fixes restored behaviour worth a test."})})]})}function Na({path:t,selected:n,onSelect:s}){let i=z(()=>P("/api/history/file",{path:t}),[t]);if(i.error)return e(q,{error:i.error});if(!i.data)return e(B,{});let r=i.data,a=r.file;return e(L,{children:[e("div",{class:"card",children:[e("h3",{class:"break",children:t}),a?e(L,{children:[e("div",{class:"row small",style:{flexWrap:"wrap"},children:[e(I,{children:[a.commits," commits"]}),e(I,{children:[a.fixes," fixes"]}),e(I,{children:["+",K(a.added),"/-",K(a.deleted)]}),e(I,{children:[he(a.firstAt)," \u2192 ",he(a.lastAt)]}),a.renamedFrom?e(I,{children:["from ",a.renamedFrom]}):null]}),e("div",{class:"row small",style:{marginTop:6,alignItems:"center"},children:[e(Ye,{value:a.risk}),e("span",{class:"muted",children:["history risk ",a.risk.toFixed(2),a.reasons.length?`: ${a.reasons.join("; ")}`:""]})]}),e("div",{class:"row small",style:{marginTop:6,flexWrap:"wrap"},children:[e("span",{class:"muted",children:"authors:"}),a.authors.map(([o,l])=>e(I,{children:[o," ",l]})),e("span",{class:"spacer"}),e(In,{values:a.months,width:120,height:22})]}),e("div",{class:"row",style:{marginTop:8},children:[e("button",{type:"button",class:"sm",onClick:()=>j("explore",{file:t}),children:"Open source"}),e("button",{type:"button",class:"sm",onClick:()=>j("galaxy",{node:`file:${t}`}),children:"Galaxy"})]})]}):e("div",{class:"muted small",children:"No commits in the loaded window touch this file."})]}),r.origins.length?e("div",{class:"card",children:[e("h3",{children:"changes that later needed fixing"}),e("div",{class:"chain",children:r.origins.map(o=>e("div",{class:"step origin",children:[e("a",{onClick:()=>s(o.sha),children:[e("span",{class:"mono muted small",children:o.short})," ",e(Ut,{kind:o.kind,bucket:o.bucket})," ",o.subject]}),e("span",{class:"muted small",children:[" \xB7 ",he(o.at)]}),e("div",{class:"chain",style:{marginTop:2},children:o.fixes.map(l=>e("div",{class:"step fix",children:[e("a",{onClick:()=>s(l.sha),children:[e("span",{class:"mono muted small",children:l.short})," ",l.subject]}),e("span",{class:"muted small",children:[" \xB7 ",l.daysLater,"d later"]})]}))})]}))})]}):null,e("div",{class:"card",children:[e("h3",{children:["timeline \xB7 ",r.commits.length]}),e(Qe,{commits:r.commits,selected:n,onSelect:s})]})]})}function Pa({ov:t,onSelectCommit:n}){let s=z(()=>P("/api/history/risk"),[t.head,t.stats.workingTree]),[i,r]=A(""),a=z(()=>i.trim()?P("/api/history/risk",{paths:i.trim()}):Promise.resolve(null),[i]),o=i.trim()?a.data:s.data,l=z(()=>P("/api/history/commits",{risky:1,limit:40}).then(d=>d.commits.filter(c=>c.blamedBy||c.reverted)),[t.head]);return e("div",{class:"grid wide",style:{alignItems:"start"},children:[e("div",{class:"stack",children:[e("div",{class:"card",children:[e("div",{class:"row",style:{marginBottom:6},children:[e("h3",{style:{margin:0},children:i.trim()?"history risk for these paths":"working tree exposure"}),e("input",{type:"text",placeholder:"or paths, comma separated",value:i,onInput:d=>r(d.target.value),style:{width:300}})]}),e("div",{class:"muted small",style:{marginBottom:8},children:"What the past says about the files you are changing now: fix density, changes here that were later fixed, and the last fix to re-read before editing."}),o?o.files.length?e("table",{children:[e("thead",{children:e("tr",{children:[e("th",{children:"file"}),e("th",{children:"risk"}),e("th",{children:"history"})]})}),e("tbody",{children:[...o.files].sort((d,c)=>(c.file?.risk??-1)-(d.file?.risk??-1)).map(d=>e("tr",{children:[e("td",{class:"break",children:e("a",{onClick:()=>j("history",{tab:"files",file:d.path}),children:d.path})}),e("td",{class:"nowrap",children:d.file?e(L,{children:[e(Ye,{value:d.file.risk})," ",d.file.risk.toFixed(2)]}):e("span",{class:"muted small",children:"new"})}),e("td",{class:"small",children:d.file?e(L,{children:[e("div",{class:"muted",children:[d.file.commits," commits \xB7 ",d.file.fixes," fixes \xB7 last"," ",ne(d.file.lastAt),d.file.reasons.length?` \xB7 ${d.file.reasons.join("; ")}`:""]}),d.lastFix?e("div",{children:["last fix: ",d.lastFix]}):null,d.origins.length?e("div",{children:["needed fixing before:"," ",d.origins.map(c=>e("a",{onClick:()=>n(c.sha),style:{marginRight:6},children:[c.short," ",c.subject.slice(0,40)]}))]}):null]}):e("span",{class:"muted",children:"no history yet"})})]}))})]}):e(G,{children:"Working tree is clean."}):s.error?e(q,{error:s.error}):e(B,{})]}),e("div",{class:"card",children:[e("h3",{children:"bug-prone files"}),t.risky.length?e("table",{children:e("tbody",{children:t.risky.map(d=>e("tr",{class:"click",onClick:()=>j("history",{tab:"files",file:d.path}),children:[e("td",{class:"break",children:d.path}),e("td",{class:"nowrap",children:[e(Ye,{value:d.risk})," ",d.risk.toFixed(2)]}),e("td",{class:"muted small",children:d.reasons.join("; ")||`${d.commits} commits`})]}))})}):e("div",{class:"muted small",children:"No file shows a fix pattern yet."})]})]}),e("div",{class:"stack",children:[e("div",{class:"card",children:[e("h3",{children:"lessons from this history"}),t.lessons.length?t.lessons.map(d=>e(Ba,{text:d})):e("div",{class:"muted small",children:"Not enough history yet."}),t.stats.tracePending?e("div",{class:"muted small",style:{marginTop:6},children:[t.stats.tracePending," fixes still to trace; reload to continue."]}):null]}),e("div",{class:"card",children:[e("h3",{children:"changes that later needed fixing"}),e("div",{class:"muted small",style:{marginBottom:6},children:"A fix removed lines these commits wrote. The pattern, not the blame, is the lesson: what kind of change tends to break here?"}),l.data?e(Qe,{commits:l.data,selected:null,onSelect:n,empty:"No traced fix origins yet."}):e(B,{})]})]})]})}function Ba({text:t}){return e("div",{class:"lesson",children:[e("span",{class:"i",children:"\u25C6"}),e("span",{children:t})]})}function Ur({params:t}){let[n,s]=A(t.tab||(t.file?"files":t.branch?"branches":"timeline")),[i,r]=A(t.sha??null);O(()=>{t.tab?s(t.tab):t.file?s("files"):t.branch&&s("branches")},[t.tab,t.file,t.branch]),O(()=>{t.sha&&r(t.sha)},[t.sha]);let a=z(()=>P("/api/history"),[]),o=u=>{r(u),s("timeline")};if(a.error)return e("div",{class:"page",children:e(q,{error:a.error})});if(!a.data)return e("div",{class:"page",children:e(B,{})});let l=a.data;if(!l.git)return e("div",{class:"page",children:e(G,{children:[l.error??"Not a git repository."," The history explorer reads `git log`; initialise a repository and commit to use it."]})});let d=l.stats,c=d.prior30?Math.round((d.last30-d.prior30)/d.prior30*100):null;return e("div",{class:"page",children:[e("div",{class:"hist-stats",children:[e(Le,{v:d.commits,k:"commits",sub:`${d.onHead} on HEAD`}),e(Le,{v:d.last30,k:"last 30 days",sub:c===null?`${d.prior30} in the 30 before`:`${c>=0?"+":""}${c}% vs prior 30`}),e(Le,{v:d.fixes,k:"fixes",sub:`${Math.round(d.fixes/Math.max(1,d.commits-d.merges)*100)}%`}),e(Le,{v:d.linksTraced,k:"traced fix origins",sub:d.tracePending?`${d.tracePending} pending`:`${d.fixesTraced} fixes`}),e(Le,{v:d.branches,k:"branches",sub:d.unmerged?`${d.unmerged} unmerged`:"all merged"}),e(Le,{v:d.authors,k:"authors",sub:`${d.files} files`}),e(Le,{v:d.tags,k:"tags",sub:l.tags[0]?.name??""}),e(Le,{v:d.workingTree,k:"working tree",sub:l.branch??"detached"})]}),e("div",{class:"row",style:{marginBottom:8},children:[e(Te,{tabs:[["timeline","Timeline"],["branches","Branches"],["files","Files"],["risk","Risk & lessons"]],value:n,onChange:u=>{s(u),j("history",{tab:u,sha:i??void 0})}}),e("span",{class:"spacer"}),e("span",{class:"muted small",children:[l.branch??"detached"," @ ",l.head.slice(0,7)," \xB7 built ",ne(l.builtAt)," ",e("a",{onClick:()=>P("/api/history",{refresh:1}).then(()=>a.reload()),children:"rebuild"})]})]}),n==="timeline"&&e(Ma,{ov:l,params:t,selected:i,onSelect:r}),n==="branches"&&e(La,{ov:l,params:t,onSelectCommit:o}),n==="files"&&e(Da,{params:t,onSelectCommit:o}),n==="risk"&&e(Pa,{ov:l,onSelectCommit:o})]})}var za=/^([a-z][a-z0-9+.-]*):(.*)$/i;function pt(t){let n=t.trim();if(!n)return{kind:"text"};if(n.startsWith("#"))return{kind:"anchor",href:n};let s=za.exec(n);if(!s){let a=n.replace(/^\.\//,"").split("#")[0]??"";return a?{kind:"file",file:a}:{kind:"text"}}let i=s[1].toLowerCase(),r=s[2];switch(i){case"mem":return r?{kind:"memory",name:r}:{kind:"text"};case"file":case"sym":{let a=r.replace(/^\/+/,"").split("#")[0]??"";return a?{kind:"file",file:a}:{kind:"text"}}case"http":case"https":case"mailto":return{kind:"external",href:n};default:return{kind:"text"}}}function Xt(t){if(t.kind==="memory")return`#/memory?name=${encodeURIComponent(t.name)}`;if(t.kind==="file")return`#/explore?file=${encodeURIComponent(t.file)}`}function zn(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Oe=zn();function ei(t){Oe=t}var ze={exec:()=>null};function et(t){let n=[];return s=>{let i=Math.max(0,Math.min(3,s-1)),r=n[i];return r||(r=t(i),n[i]=r),r}}function U(t,n=""){let s=typeof t=="string"?t:t.source,i={replace:(r,a)=>{let o=typeof a=="string"?a:a.source;return o=o.replace(ce.caret,"$1"),s=s.replace(r,o),i},getRegex:()=>new RegExp(s,n)};return i}var Ha=((t="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+t)}catch{return!1}})(),ce={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:et(t=>new RegExp(`^ {0,${t}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:et(t=>new RegExp(`^ {0,${t}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:et(t=>new RegExp(`^ {0,${t}}(?:\`\`\`|~~~)`)),headingBeginRegex:et(t=>new RegExp(`^ {0,${t}}#`)),htmlBeginRegex:et(t=>new RegExp(`^ {0,${t}}(?:</?(?:${ft})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,"i")),blockquoteBeginRegex:et(t=>new RegExp(`^ {0,${t}}>`))},ja=/^(?:[ \t]*(?:\n|$))+/,Oa=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ua=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,gt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Xa=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Hn=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ti=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ni=U(ti).replace(/bull/g,Hn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),qa=U(ti).replace(/bull/g,Hn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),jn=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Ga=/^[^\n]+/,On=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Wa=U(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",On).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ja=U(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Hn).getRegex(),ft="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Un=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Va=U("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Un).replace("tag",ft).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),si=t=>U(jn).replace("hr",gt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",t).replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",ft).getRegex(),Za=si(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Ka=si(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Ya=U(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ka).getRegex(),Xn={blockquote:Ya,code:Oa,def:Wa,fences:Ua,heading:Xa,hr:gt,html:Va,lheading:ni,list:Ja,newline:ja,paragraph:Za,table:ze,text:Ga},Xr=U("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",gt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",ft).getRegex(),Qa={...Xn,lheading:qa,table:Xr,paragraph:U(jn).replace("hr",gt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Xr).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",ft).getRegex()},eo={...Xn,html:U(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Un).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:ze,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:U(jn).replace("hr",gt).replace("heading",` *#{1,6} *[^
|
|
15
|
+
]`).replace("lheading",ni).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},to=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,no=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ri=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,so=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ee=/[\p{P}\p{S}]/u,tt=/[\s\p{P}\p{S}]/u,bt=/[^\s\p{P}\p{S}]/u,ro=U(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,tt).getRegex(),io=/[\p{Pi}\p{Ps}"']/u,ii=/(?!~)[\p{P}\p{S}]/u,ao=/(?!~)[\s\p{P}\p{S}]/u,oo=/(?:[^\s\p{P}\p{S}]|~)/u,lo=U(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Ha?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ai=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,co=U(ai,"u").replace(/punct/g,Ee).getRegex(),uo=U(ai,"u").replace(/punct/g,ii).getRegex(),po=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,ho=U(po,"u").replace(/openQuote/g,io).replace(/punct/g,Ee).getRegex(),oi="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",mo=U(oi,"gu").replace(/notPunctSpace/g,bt).replace(/punctSpace/g,tt).replace(/punct/g,Ee).getRegex(),go=U(oi,"gu").replace(/notPunctSpace/g,oo).replace(/punctSpace/g,ao).replace(/punct/g,ii).getRegex(),fo="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",bo=U(fo,"gu").replace(/notPunctSpace/g,bt).replace(/punctSpace/g,tt).replace(/punct/g,Ee).getRegex(),yo=U("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,bt).replace(/punctSpace/g,tt).replace(/punct/g,Ee).getRegex(),vo="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",ko=U(vo,"gu").replace(/notPunctSpace/g,bt).replace(/punctSpace/g,tt).replace(/punct/g,Ee).getRegex(),xo=U(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Ee).getRegex(),_o="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",wo=U(_o,"gu").replace(/notPunctSpace/g,bt).replace(/punctSpace/g,tt).replace(/punct/g,Ee).getRegex(),So=U(/\\(punct)/,"gu").replace(/punct/g,Ee).getRegex(),To=U(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,"gu").replace(/punct/g,Ee).getRegex(),Eo=U(/^<(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(),$o=U(Un).replace("(?:-->|$)","-->").getRegex(),Ao=U("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",$o).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),li=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,Wt=U(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",li).getRegex(),Co=U(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",Wt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ro=U(/^!?\[(label)\]\[(ref)\]/).replace("label",Wt).replace("ref",On).getRegex(),Fo=U(/^!?\[(ref)\](?:\[\])?/).replace("ref",On).getRegex(),qr=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Mo=U(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",li).getRegex(),Lo=U("reflink|nolink(?!\\()","g").replace("reflink",U(/^!?\[(label)\]\[(ref)\]/).replace("label",Mo).replace("ref",qr).getRegex()).replace("nolink",U(/^!?\[(ref)\](?:\[\])?/).replace("ref",qr).getRegex()).getRegex(),Gr=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Io=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,Do=U(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,Io).getRegex(),qn={_backpedal:ze,anyPunctuation:So,anyPunctuationOutsideCode:To,autolink:Eo,blockSkip:lo,br:ri,code:no,del:ze,delLDelim:ze,delRDelim:ze,emStrongLDelim:co,emStrongRDelimAst:mo,emStrongRDelimUnd:yo,escape:to,link:Co,nolink:Fo,punctuation:ro,reflink:Ro,reflinkSearch:Lo,tag:Ao,text:so,url:ze},No={...qn,emStrongLDelim:ho,emStrongRDelimAst:bo,emStrongRDelimUnd:ko,link:U(/^!?\[(label)\]\((.*?)\)/).replace("label",Wt).getRegex(),reflink:U(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Wt).getRegex()},Pn={...qn,emStrongRDelimAst:go,emStrongLDelim:uo,delLDelim:xo,delRDelim:wo,url:U(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",Do).replace("protocol",Gr).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:U(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol",Gr).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},Po={...Pn,br:U(ri).replace("{2,}","*").getRegex(),text:U(Pn.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},qt={normal:Xn,gfm:Qa,pedantic:eo},ht={normal:qn,gfm:Pn,breaks:Po,pedantic:No},Bo={"&":"&","<":"<",">":">",'"':""","'":"'"},Wr=t=>Bo[t];function ye(t,n){if(n){if(ce.escapeTest.test(t))return t.replace(ce.escapeReplace,Wr)}else if(ce.escapeTestNoEncode.test(t))return t.replace(ce.escapeReplaceNoEncode,Wr);return t}function zo(t){return ce.numericCharacterReference.test(t)?t.replace(ce.numericCharacterReferenceOrAmpersand,(n,s,i)=>{if(s===void 0&&i===void 0)return"&";let r=s===void 0?Number.parseInt(i,16):Number.parseInt(s,10);return r===0||r>1114111||r>=55296&&r<=57343?"\uFFFD":r===38?"&":String.fromCodePoint(r)}):t}function Jr(t){try{t=encodeURI(t).replace(ce.percentDecode,"%")}catch{return null}return t}function Vr(t,n){let s=t.replace(ce.findPipe,(a,o,l)=>{let d=!1,c=o;for(;--c>=0&&l[c]==="\\";)d=!d;return d?"|":" |"}),i=s.split(ce.splitPipe),r=0;if(i[0].trim()||i.shift(),i.length>0&&!i.at(-1)?.trim()&&i.pop(),n)if(i.length>n)i.splice(n);else for(;i.length<n;)i.push("");for(;r<i.length;r++)i[r]=i[r].trim().replace(ce.slashPipe,"|");return i}function Ie(t,n,s){let i=t.length;if(i===0)return"";let r=0;for(;r<i;){let a=t.charAt(i-r-1);if(a===n&&!s)r++;else if(a!==n&&s)r++;else break}return t.slice(0,i-r)}function Zr(t){let n=t.split(`
|
|
16
16
|
`),s=n.length-1;for(;s>=0&&ce.blankLine.test(n[s]);)s--;return n.length-s<=2?t:n.slice(0,s+1).join(`
|
|
17
|
-
`)}function Jt(t){return t.trim().toLowerCase().toUpperCase().toLowerCase()}function Kr(t,n){if(t.indexOf(n[0])===-1&&t.indexOf(n[1])===-1)return-1;let s=0;for(let i=0;i<t.length;i++)if(t[i]==="\\")i++;else if(t[i]===n[0])s++;else if(t[i]===n[1]&&(s--,s<0))return i;return s>0?-2:-1}function Nn(t,n=0){let s=n,i="";for(let r of t)if(r===" "){let a=4-s%4;i+=" ".repeat(a),s+=a}else i+=r,s++;return i}function Yr(t,n,s,i,r){let a=n.href,o=n.title||null,l=t[1].replace(r.other.outputLinkReplace,"$1"),d=t[0].charAt(0)==="!",c=i.state.inLink,u=i.state.linkEmitted,h=i.state.inRawBlock;i.state.inLink=!0,i.state.linkEmitted=!1;let g=i.inlineTokens(l),f=i.state.linkEmitted;if(i.state.linkEmitted=u,i.state.inLink=c,!d){if(f){i.state.inRawBlock=h;return}i.state.linkEmitted=!0}return{type:d?"image":"link",raw:s,href:a,title:o,text:l,tokens:g}}function
|
|
17
|
+
`)}function Jt(t){return t.trim().toLowerCase().toUpperCase().toLowerCase()}function Kr(t,n){if(t.indexOf(n[0])===-1&&t.indexOf(n[1])===-1)return-1;let s=0;for(let i=0;i<t.length;i++)if(t[i]==="\\")i++;else if(t[i]===n[0])s++;else if(t[i]===n[1]&&(s--,s<0))return i;return s>0?-2:-1}function Nn(t,n=0){let s=n,i="";for(let r of t)if(r===" "){let a=4-s%4;i+=" ".repeat(a),s+=a}else i+=r,s++;return i}function Yr(t,n,s,i,r){let a=n.href,o=n.title||null,l=t[1].replace(r.other.outputLinkReplace,"$1"),d=t[0].charAt(0)==="!",c=i.state.inLink,u=i.state.linkEmitted,h=i.state.inRawBlock;i.state.inLink=!0,i.state.linkEmitted=!1;let g=i.inlineTokens(l),f=i.state.linkEmitted;if(i.state.linkEmitted=u,i.state.inLink=c,!d){if(f){i.state.inRawBlock=h;return}i.state.linkEmitted=!0}return{type:d?"image":"link",raw:s,href:a,title:o,text:l,tokens:g}}function Ho(t,n,s){let i=t.match(s.other.indentCodeCompensation);if(i===null)return n;let r=i[1];return n.split(`
|
|
18
18
|
`).map(a=>{let o=a.match(s.other.beginningSpace);if(o===null)return a;let[l]=o;return a.slice(Math.min(l.length,r.length))}).join(`
|
|
19
|
-
`)}function Qr(t,n,s,i){if(!n.includes("<"))return!1;for(let r=0;r<n.length;r++){if(n[r]==="\\"){r++;continue}if(n[r]==="`"){let l=i.inline.code.exec(n.slice(r));if(l){r+=l[0].length-1;continue}}if(n[r]!=="<")continue;let a=t.slice(s+r),o=i.inline.tag.exec(a)||i.inline.autolink.exec(a);if(o){if(o[0].length>n.length-r)return!0;r+=o[0].length-1}}return!1}var Vt=class{constructor(t){V(this,"options");V(this,"rules");V(this,"lexer");this.options=t||Oe}space(t){let n=this.rules.block.newline.exec(t);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(t){let n=this.rules.block.code.exec(t);if(n){let s=this.options.pedantic?n[0]:Zr(n[0]),i=s.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:s,codeBlockStyle:"indented",text:i}}}fences(t){let n=this.rules.block.fences.exec(t);if(n){let s=n[0],i=
|
|
19
|
+
`)}function Qr(t,n,s,i){if(!n.includes("<"))return!1;for(let r=0;r<n.length;r++){if(n[r]==="\\"){r++;continue}if(n[r]==="`"){let l=i.inline.code.exec(n.slice(r));if(l){r+=l[0].length-1;continue}}if(n[r]!=="<")continue;let a=t.slice(s+r),o=i.inline.tag.exec(a)||i.inline.autolink.exec(a);if(o){if(o[0].length>n.length-r)return!0;r+=o[0].length-1}}return!1}var Vt=class{constructor(t){V(this,"options");V(this,"rules");V(this,"lexer");this.options=t||Oe}space(t){let n=this.rules.block.newline.exec(t);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(t){let n=this.rules.block.code.exec(t);if(n){let s=this.options.pedantic?n[0]:Zr(n[0]),i=s.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:s,codeBlockStyle:"indented",text:i}}}fences(t){let n=this.rules.block.fences.exec(t);if(n){let s=n[0],i=Ho(s,n[3]||"",this.rules);return{type:"code",raw:s,lang:n[2]?n[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):n[2],text:i}}}heading(t){let n=this.rules.block.heading.exec(t);if(n){let s=n[2].trim();if(this.rules.other.endingHash.test(s)){let i=Ie(s,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceTabChar.test(i))&&(s=i.trim())}return{type:"heading",raw:Ie(n[0],`
|
|
20
20
|
`),depth:n[1].length,text:s,tokens:this.lexer.inline(s)}}}hr(t){let n=this.rules.block.hr.exec(t);if(n)return{type:"hr",raw:Ie(n[0],`
|
|
21
21
|
`)}}blockquote(t){let n=this.rules.block.blockquote.exec(t);if(n){let s=Ie(n[0],`
|
|
22
22
|
`).split(`
|
|
@@ -26,23 +26,23 @@ ${o.riskReasons.join("; ")}`:""}`,children:[e("span",{class:"when",children:he(o
|
|
|
26
26
|
${c}`:c,r=r?`${r}
|
|
27
27
|
${u}`:u;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,a,!0),this.lexer.state.top=h,s.length===0)break;let g=a.at(-1);if(g?.type==="code"||g?.type==="heading"||g?.type==="hr"||g?.type==="html")break;if(g?.type==="blockquote"){let f=g,x=s.join(`
|
|
28
28
|
`),m=f.raw+`
|
|
29
|
-
`+x.replace(this.rules.other.blockquoteSetextReplace2,""),p=this.blockquote(m);a[a.length-1]=p;let
|
|
30
|
-
`).length:0,b
|
|
31
|
-
${
|
|
29
|
+
`+x.replace(this.rules.other.blockquoteSetextReplace2,""),p=this.blockquote(m);a[a.length-1]=p;let v=m.substring(p.raw.length).replace(/^\n/,""),b=v?v.split(`
|
|
30
|
+
`).length:0,y=b?s.slice(0,-b):s;y.length>0&&(i=`${i}
|
|
31
|
+
${y.join(`
|
|
32
32
|
`)}`),r=r.substring(0,r.length-f.text.length)+p.text;break}else if(g?.type==="list"){let f=g,x=f.raw+`
|
|
33
33
|
`+s.join(`
|
|
34
34
|
`),m=this.list(x);a[a.length-1]=m,i=i.substring(0,i.length-g.raw.length)+m.raw,r=r.substring(0,r.length-f.raw.length)+m.raw,s=x.substring(a.at(-1).raw.length).split(`
|
|
35
35
|
`);continue}}return{type:"blockquote",raw:i,tokens:a,text:r}}}list(t){let n=this.rules.block.list.exec(t);if(n){let s=t,i=()=>s.length-t.length,r=n[1].trim(),a=r.length>1,o={type:"list",raw:"",ordered:a,start:a?+r.slice(0,-1):"",loose:!1,items:[]};r=a?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=a?r:"[*+-]");let l=this.rules.other.listItemRegex(r),d=!1;for(;t;){let u=!1,h="";if(!(n=l.exec(t))||this.rules.block.hr.test(t))break;let g=i();t=t.substring(n[0].length);let f=n[2].split(`
|
|
36
36
|
`,1)[0],x=n[1].length,m=this.options.pedantic?Nn(f,x):f.replace(this.rules.other.leadingSpaceTab,k=>Nn(k,x)),p=t.split(`
|
|
37
|
-
`,1)[0],
|
|
38
|
-
`,1)[0]
|
|
39
|
-
|
|
40
|
-
`+p}
|
|
37
|
+
`,1)[0],v=!m.trim(),b=0;if(this.options.pedantic?(b=2,h=m.trimStart()):v?b=x+1:(b=m.search(this.rules.other.nonSpaceChar),b=b>4?1:b,h=m.slice(b),b+=x),v&&this.rules.other.blankLine.test(p)&&(t=t.substring(p.length+1),u=!0),!u){let k=this.rules.other.nextBulletRegex(b),S=this.rules.other.hrRegex(b),$=this.rules.other.fencesBeginRegex(b),_=this.rules.other.headingBeginRegex(b),E=this.rules.other.htmlBeginRegex(b),R=this.rules.other.blockquoteBeginRegex(b);for(;t;){let T=t.split(`
|
|
38
|
+
`,1)[0],C;if(p=T,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),C=p):C=p.replace(this.rules.other.leadingSpaceTab,w=>Nn(w)),$.test(p)||_.test(p)||E.test(p)||R.test(p)||k.test(p)||S.test(p))break;if(C.search(this.rules.other.nonSpaceChar)>=b||!p.trim())h+=`
|
|
39
|
+
`+C.slice(b);else{if(v||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||$.test(m)||_.test(m)||S.test(m))break;h+=`
|
|
40
|
+
`+p}v=!p.trim(),t=t.substring(T.length+1),m=C.slice(b)}}let y=s.slice(g,i());o.loose||(d?o.loose=!0:this.rules.other.doubleBlankLine.test(y)&&(d=!0)),o.items.push({type:"list_item",raw:y,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]})}let c=o.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;o.raw=s.slice(0,i()).trimEnd();for(let u of o.items)if(this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]),!o.loose){let h=u.tokens.filter(f=>f.type==="space"),g=h.length>0&&h.some(f=>this.rules.other.anyLine.test(f.raw));o.loose=g}for(let u of o.items){let h=u.tokens[0];if(u.task&&(h?.type==="text"||h?.type==="paragraph")){u.text=u.text.replace(this.rules.other.listReplaceTask,""),h.raw=h.raw.replace(this.rules.other.listReplaceTask,""),h.text=h.text.replace(this.rules.other.listReplaceTask,"");for(let f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}let g=this.rules.other.listTaskCheckbox.exec(u.raw);if(g){let f={type:"checkbox",raw:g[0]+" ",checked:g[0]!=="[ ]"};u.checked=f.checked,o.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=f.raw+u.tokens[0].raw,u.tokens[0].text=f.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(f)):u.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):u.tokens.unshift(f)}}else u.task&&(u.task=!1)}if(o.loose)for(let u of o.items){u.loose=!0;for(let h of u.tokens)h.type==="text"&&(h.type="paragraph")}return o}}html(t){let n=this.rules.block.html.exec(t);if(n){let s=Zr(n[0]);return{type:"html",block:!0,raw:s,pre:n[1]==="pre"||n[1]==="script"||n[1]==="style",text:s}}}def(t){let n=this.rules.block.def.exec(t);if(n){if(!this.rules.other.startAngleBracket.test(n[2])&&Kr(n[2],"()")!==-1)return;let s=Jt(n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=n[2]?n[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):n[3];return{type:"def",tag:s,raw:Ie(n[0],`
|
|
41
41
|
`),href:i,title:r}}}table(t){let n=this.rules.block.table.exec(t);if(!n||!this.rules.other.tableDelimiter.test(n[2]))return;let s=Vr(n[1]),i=n[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=n[3]?.trim()?n[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
42
42
|
`):[],a={type:"table",raw:Ie(n[0],`
|
|
43
43
|
`),header:[],align:[],rows:[]};if(s.length===i.length){for(let o of i)this.rules.other.tableAlignRight.test(o)?a.align.push("right"):this.rules.other.tableAlignCenter.test(o)?a.align.push("center"):this.rules.other.tableAlignLeft.test(o)?a.align.push("left"):a.align.push(null);for(let o=0;o<s.length;o++)a.header.push({text:s[o],tokens:this.lexer.inline(s[o]),header:!0,align:a.align[o]});for(let o of r)a.rows.push(Vr(o,a.header.length).map((l,d)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:a.align[d]})));return a}}lheading(t){let n=this.rules.block.lheading.exec(t);if(n){let s=n[1].trim();return{type:"heading",raw:Ie(n[0],`
|
|
44
44
|
`),depth:n[2].charAt(0)==="="?1:2,text:s,tokens:this.lexer.inline(s)}}}paragraph(t){let n=this.rules.block.paragraph.exec(t);if(n){let s=n[1].charAt(n[1].length-1)===`
|
|
45
|
-
`?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:s,tokens:this.lexer.inline(s)}}}text(t){let n=this.rules.block.text.exec(t);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(t){let n=this.rules.inline.escape.exec(t);if(n)return{type:"escape",raw:n[0],text:n[1]}}tag(t){let n=this.rules.inline.tag.exec(t);if(n)return!this.lexer.state.inLink&&this.rules.other.startATag.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(t){if(this.lexer.state.linkParenPossible===!1)return;let n=this.rules.inline.link.exec(t);if(n){let s=n[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Qr(t,n[1],s,this.rules))return;let i=n[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(i)){if(!this.rules.other.endAngleBracket.test(i))return;let o=Ie(i.slice(0,-1),"\\");if((i.length-o.length)%2===0)return}else{let o=Kr(n[2],"()");if(o===-2)return;if(o>-1){let l=(n[0].indexOf("!")===0?5:4)+n[1].length+o;n[2]=n[2].substring(0,o),n[0]=n[0].substring(0,l).trim(),n[3]=""}}let r=n[2],a="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(r);o&&(r=o[1],a=o[3])}else a=n[3]?n[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(i)?r=r.slice(1):r=r.slice(1,-1)),Yr(n,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:a&&a.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer,this.rules)}}reflink(t,n){let s;if((s=this.rules.inline.reflink.exec(t))||(s=this.rules.inline.nolink.exec(t))){let i=s[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Qr(t,s[1],i,this.rules))return;let r=(s[2]||s[1]).replace(this.rules.other.multipleSpaceGlobal," "),a=n[Jt(r)];if(!a){let o=s[0].charAt(0);return{type:"text",raw:o,text:o}}return Yr(s,a,s[0],this.lexer,this.rules)}}emStrong(t,n,s=""){let i=this.rules.inline.emStrongLDelim.exec(t);if(!(!i||!i[1]&&!i[2]&&!i[3]&&!i[4]||i[4]&&s.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[3])||!s||this.rules.inline.punctuation.exec(s))){let r=[...i[0]].length-1,a,o,l=r,d=0,c=i[0][0],u=s===c,h=c==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,n=n.slice(-1*t.length+r);(i=h.exec(n))!==null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a)continue;if(o=[...a].length,i[3]||i[4]){l+=o;continue}else if(i[5]||i[6]){if(r%3&&!((r+o)%3)){d+=o;continue}if(u)break}if(l-=o,l>0)continue;o=Math.min(o,o+l+d);let g=[...i[0]][0].length,f=t.slice(0,r+i.index+g+o);if(Math.min(r,o)%2){let m=f.slice(1,-1);return{type:"em",raw:f,text:m,tokens:this.lexer.inlineTokens(m)}}let x=f.slice(2,-2);return{type:"strong",raw:f,text:x,tokens:this.lexer.inlineTokens(x)}}}}codespan(t){let n=this.rules.inline.code.exec(t);if(n){let s=n[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(s),r=this.rules.other.startingSpaceChar.test(s)&&this.rules.other.endingSpaceChar.test(s);return i&&r&&(s=s.substring(1,s.length-1)),{type:"codespan",raw:n[0],text:s}}}br(t){let n=this.rules.inline.br.exec(t);if(n)return{type:"br",raw:n[0]}}del(t,n,s=""){let i=this.rules.inline.delLDelim.exec(t);if(i&&(!i[1]||!s||this.rules.inline.punctuation.exec(s))){let r=[...i[0]].length-1,a,o,l=r,d=this.rules.inline.delRDelim;for(d.lastIndex=0,n=n.slice(-1*t.length+r);(i=d.exec(n))!==null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a||(o=[...a].length,o!==r))continue;if(i[3]||i[4]){l+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l);let c=[...i[0]][0].length,u=t.slice(0,r+i.index+c+o),h=u.slice(r,-r);return{type:"del",raw:u,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(t){let n=this.rules.inline.autolink.exec(t);if(n){let s,i;return n[2]==="@"?(s=n[1],i="mailto:"+s):(s=n[1],i=s),{type:"link",raw:n[0],text:s,href:i,autolink:!0,tokens:[{type:"text",raw:s,text:s}]}}}url(t){let n;if(n=this.rules.inline.url.exec(t)){let s,i;if(n[2]==="@")s=n[0],i="mailto:"+s;else{let r;do r=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])?.[0]??"";while(r!==n[0]);s=n[0],n[1]==="www."?i="http://"+n[0]:i=n[0]}return{type:"link",raw:n[0],text:s,href:i,autolink:!0,tokens:[{type:"text",raw:s,text:s}]}}}inlineText(t){let n=this.rules.inline.text.exec(t);if(n){let s=this.lexer.state.inRawBlock;return{type:"text",raw:n[0],text:s?n[0]:
|
|
45
|
+
`?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:s,tokens:this.lexer.inline(s)}}}text(t){let n=this.rules.block.text.exec(t);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(t){let n=this.rules.inline.escape.exec(t);if(n)return{type:"escape",raw:n[0],text:n[1]}}tag(t){let n=this.rules.inline.tag.exec(t);if(n)return!this.lexer.state.inLink&&this.rules.other.startATag.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(t){if(this.lexer.state.linkParenPossible===!1)return;let n=this.rules.inline.link.exec(t);if(n){let s=n[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Qr(t,n[1],s,this.rules))return;let i=n[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(i)){if(!this.rules.other.endAngleBracket.test(i))return;let o=Ie(i.slice(0,-1),"\\");if((i.length-o.length)%2===0)return}else{let o=Kr(n[2],"()");if(o===-2)return;if(o>-1){let l=(n[0].indexOf("!")===0?5:4)+n[1].length+o;n[2]=n[2].substring(0,o),n[0]=n[0].substring(0,l).trim(),n[3]=""}}let r=n[2],a="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(r);o&&(r=o[1],a=o[3])}else a=n[3]?n[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(i)?r=r.slice(1):r=r.slice(1,-1)),Yr(n,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:a&&a.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer,this.rules)}}reflink(t,n){let s;if((s=this.rules.inline.reflink.exec(t))||(s=this.rules.inline.nolink.exec(t))){let i=s[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Qr(t,s[1],i,this.rules))return;let r=(s[2]||s[1]).replace(this.rules.other.multipleSpaceGlobal," "),a=n[Jt(r)];if(!a){let o=s[0].charAt(0);return{type:"text",raw:o,text:o}}return Yr(s,a,s[0],this.lexer,this.rules)}}emStrong(t,n,s=""){let i=this.rules.inline.emStrongLDelim.exec(t);if(!(!i||!i[1]&&!i[2]&&!i[3]&&!i[4]||i[4]&&s.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[3])||!s||this.rules.inline.punctuation.exec(s))){let r=[...i[0]].length-1,a,o,l=r,d=0,c=i[0][0],u=s===c,h=c==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,n=n.slice(-1*t.length+r);(i=h.exec(n))!==null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a)continue;if(o=[...a].length,i[3]||i[4]){l+=o;continue}else if(i[5]||i[6]){if(r%3&&!((r+o)%3)){d+=o;continue}if(u)break}if(l-=o,l>0)continue;o=Math.min(o,o+l+d);let g=[...i[0]][0].length,f=t.slice(0,r+i.index+g+o);if(Math.min(r,o)%2){let m=f.slice(1,-1);return{type:"em",raw:f,text:m,tokens:this.lexer.inlineTokens(m)}}let x=f.slice(2,-2);return{type:"strong",raw:f,text:x,tokens:this.lexer.inlineTokens(x)}}}}codespan(t){let n=this.rules.inline.code.exec(t);if(n){let s=n[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(s),r=this.rules.other.startingSpaceChar.test(s)&&this.rules.other.endingSpaceChar.test(s);return i&&r&&(s=s.substring(1,s.length-1)),{type:"codespan",raw:n[0],text:s}}}br(t){let n=this.rules.inline.br.exec(t);if(n)return{type:"br",raw:n[0]}}del(t,n,s=""){let i=this.rules.inline.delLDelim.exec(t);if(i&&(!i[1]||!s||this.rules.inline.punctuation.exec(s))){let r=[...i[0]].length-1,a,o,l=r,d=this.rules.inline.delRDelim;for(d.lastIndex=0,n=n.slice(-1*t.length+r);(i=d.exec(n))!==null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a||(o=[...a].length,o!==r))continue;if(i[3]||i[4]){l+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l);let c=[...i[0]][0].length,u=t.slice(0,r+i.index+c+o),h=u.slice(r,-r);return{type:"del",raw:u,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(t){let n=this.rules.inline.autolink.exec(t);if(n){let s,i;return n[2]==="@"?(s=n[1],i="mailto:"+s):(s=n[1],i=s),{type:"link",raw:n[0],text:s,href:i,autolink:!0,tokens:[{type:"text",raw:s,text:s}]}}}url(t){let n;if(n=this.rules.inline.url.exec(t)){let s,i;if(n[2]==="@")s=n[0],i="mailto:"+s;else{let r;do r=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])?.[0]??"";while(r!==n[0]);s=n[0],n[1]==="www."?i="http://"+n[0]:i=n[0]}return{type:"link",raw:n[0],text:s,href:i,autolink:!0,tokens:[{type:"text",raw:s,text:s}]}}}inlineText(t){let n=this.rules.inline.text.exec(t);if(n){let s=this.lexer.state.inRawBlock;return{type:"text",raw:n[0],text:s?n[0]:zo(n[0]),escaped:s}}}},Kt,ci,He,xe=(He=class{constructor(n){Yn(this,Kt);V(this,"tokens");V(this,"options");V(this,"state");V(this,"inlineQueue");V(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=n||Oe,this.options.tokenizer=this.options.tokenizer||new Vt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let s={other:ce,block:qt.normal,inline:ht.normal};this.options.pedantic?(s.block=qt.pedantic,s.inline=ht.pedantic):this.options.gfm&&(s.block=qt.gfm,this.options.breaks?s.inline=ht.breaks:s.inline=ht.gfm),this.tokenizer.rules=s}static get rules(){return{block:qt,inline:ht}}static lex(n,s){return new He(s).lex(n)}static lexInline(n,s){return new He(s).inlineTokens(n)}lex(n){n=n.replace(ce.carriageReturn,`
|
|
46
46
|
`),this.blockTokens(n,this.tokens);for(let s=0;s<this.inlineQueue.length;s++){let i=this.inlineQueue[s];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(n,s=[],i=!1){this.tokenizer.lexer=this,this.options.pedantic&&(n=n.replace(ce.tabCharGlobal," ").replace(ce.spaceLine,""));let r=1/0;for(;n;){if(n.length<r)r=n.length;else{this.infiniteLoopError(n.charCodeAt(0));break}let a;if(this.options.extensions?.block?.some(l=>(a=l.call({lexer:this},n,s))?(n=n.substring(a.raw.length),s.push(a),!0):!1))continue;if(a=this.tokenizer.space(n)){n=n.substring(a.raw.length);let l=s.at(-1);a.raw.length===1&&l!==void 0?l.raw+=`
|
|
47
47
|
`:s.push(a);continue}if(a=this.tokenizer.code(n)){n=n.substring(a.raw.length);let l=s.at(-1);l?.type==="paragraph"||l?.type==="text"?(l.raw+=(l.raw.endsWith(`
|
|
48
48
|
`)?"":`
|
|
@@ -56,9 +56,9 @@ ${b.join(`
|
|
|
56
56
|
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):s.push(a),i=o.length!==n.length,n=n.substring(a.raw.length);continue}if(a=this.tokenizer.text(n)){n=n.substring(a.raw.length);let l=s.at(-1);l?.type==="text"?(l.raw+=(l.raw.endsWith(`
|
|
57
57
|
`)?"":`
|
|
58
58
|
`)+a.raw,l.text+=`
|
|
59
|
-
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):s.push(a);continue}if(n){this.infiniteLoopError(n.charCodeAt(0));break}}return this.state.top=!0,s}inline(n,s=[]){return this.inlineQueue.push({src:n,tokens:s}),s}linkInText(n){if(!n.includes("["))return!1;let s=this.tokenizer.rules.inline.link;for(let i of n.matchAll(this.tokenizer.rules.inline.blockSkip))if(s.test(i[0])&&n.charAt(i.index-1)!=="!")return!0;for(let i of n.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let r=i[0],a=r.lastIndexOf("[");if(!(r.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,Jt(r.slice(a+1,-1))))&&!(a>1&&this.linkInText(r.slice(1,a-1))))return!0}return!1}inlineTokens(n,s=[]){this.tokenizer.lexer=this;let i=this.state.linkParenPossible;this.state.linkParenPossible=i&&n.includes(")");try{return Qn(this,Kt,ci).call(this,n,s)}finally{this.state.linkParenPossible=i}}infiniteLoopError(n){let s="Infinite loop on byte: "+n;if(this.options.silent)console.error(s);else throw new Error(s)}},Kt=new WeakSet,ci=function(n,s){let i=n;if(this.tokens.links&&n.includes("[")){let l=this.tokenizer.rules.inline.reflinkSearch,d=c=>{let u=c.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,Jt(c.slice(u+1,-1))))return c;if(u>1&&c.charAt(0)!=="!"){let h=c.slice(1,u-1);if(this.linkInText(h))return"["+h.replace(l,d)+"]["+"a".repeat(c.length-u-2)+"]"}return"["+"a".repeat(c.length-2)+"]"};i=i.replace(l,d)}i=i.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(l,d,c)=>c?"+".repeat(l.length):d?d+l.slice(d.length,-d.length).replace(/`/g,"+")+d:l),i=i.replace(this.tokenizer.rules.inline.blockSkip,(l,d,c)=>{let u=c?c.length:0;return l.slice(0,u)+"["+"a".repeat(l.length-u-2)+"]"}),i=this.options.hooks?.emStrongMask?.call({lexer:this},i)??i;let r=!1,a="",o=1/0;for(;n;){if(n.length<o)o=n.length;else{this.infiniteLoopError(n.charCodeAt(0));break}r||(a=""),r=!1;let l;if(this.options.extensions?.inline?.some(c=>(l=c.call({lexer:this},n,s))?(n=n.substring(l.raw.length),s.push(l),!0):!1))continue;if(l=this.tokenizer.escape(n)){n=n.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.tag(n)){n=n.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.link(n)){n=n.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.reflink(n,this.tokens.links)){n=n.substring(l.raw.length);let c=s.at(-1);l.type==="text"&&c?.type==="text"?(c.raw+=l.raw,c.text+=l.text):s.push(l);continue}if(l=this.tokenizer.emStrong(n,i,a)){n=n.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.codespan(n)){n=n.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.br(n)){n=n.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.del(n,i,a)){n=n.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.autolink(n)){n=n.substring(l.raw.length),s.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(n))){n=n.substring(l.raw.length),s.push(l);continue}let d=n;if(this.options.extensions?.startInline){let c=1/0,u=n.slice(1),h;this.options.extensions.startInline.forEach(g=>{h=g.call({lexer:this},u),typeof h=="number"&&h>=0&&(c=Math.min(c,h))}),c<1/0&&c>=0&&(d=n.substring(0,c+1))}if(l=this.tokenizer.inlineText(d)){n=n.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(a=l.raw.slice(-1)),r=!0;let c=s.at(-1);c?.type==="text"?(c.raw+=l.raw,c.text+=l.text):s.push(l);continue}if(n){this.infiniteLoopError(n.charCodeAt(0));break}}return s},
|
|
60
|
-
`:"";return i?'<pre><code class="language-'+
|
|
61
|
-
`:"<pre><code>"+(s?r:
|
|
59
|
+
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):s.push(a);continue}if(n){this.infiniteLoopError(n.charCodeAt(0));break}}return this.state.top=!0,s}inline(n,s=[]){return this.inlineQueue.push({src:n,tokens:s}),s}linkInText(n){if(!n.includes("["))return!1;let s=this.tokenizer.rules.inline.link;for(let i of n.matchAll(this.tokenizer.rules.inline.blockSkip))if(s.test(i[0])&&n.charAt(i.index-1)!=="!")return!0;for(let i of n.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let r=i[0],a=r.lastIndexOf("[");if(!(r.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,Jt(r.slice(a+1,-1))))&&!(a>1&&this.linkInText(r.slice(1,a-1))))return!0}return!1}inlineTokens(n,s=[]){this.tokenizer.lexer=this;let i=this.state.linkParenPossible;this.state.linkParenPossible=i&&n.includes(")");try{return Qn(this,Kt,ci).call(this,n,s)}finally{this.state.linkParenPossible=i}}infiniteLoopError(n){let s="Infinite loop on byte: "+n;if(this.options.silent)console.error(s);else throw new Error(s)}},Kt=new WeakSet,ci=function(n,s){let i=n;if(this.tokens.links&&n.includes("[")){let l=this.tokenizer.rules.inline.reflinkSearch,d=c=>{let u=c.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,Jt(c.slice(u+1,-1))))return c;if(u>1&&c.charAt(0)!=="!"){let h=c.slice(1,u-1);if(this.linkInText(h))return"["+h.replace(l,d)+"]["+"a".repeat(c.length-u-2)+"]"}return"["+"a".repeat(c.length-2)+"]"};i=i.replace(l,d)}i=i.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(l,d,c)=>c?"+".repeat(l.length):d?d+l.slice(d.length,-d.length).replace(/`/g,"+")+d:l),i=i.replace(this.tokenizer.rules.inline.blockSkip,(l,d,c)=>{let u=c?c.length:0;return l.slice(0,u)+"["+"a".repeat(l.length-u-2)+"]"}),i=this.options.hooks?.emStrongMask?.call({lexer:this},i)??i;let r=!1,a="",o=1/0;for(;n;){if(n.length<o)o=n.length;else{this.infiniteLoopError(n.charCodeAt(0));break}r||(a=""),r=!1;let l;if(this.options.extensions?.inline?.some(c=>(l=c.call({lexer:this},n,s))?(n=n.substring(l.raw.length),s.push(l),!0):!1))continue;if(l=this.tokenizer.escape(n)){n=n.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.tag(n)){n=n.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.link(n)){n=n.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.reflink(n,this.tokens.links)){n=n.substring(l.raw.length);let c=s.at(-1);l.type==="text"&&c?.type==="text"?(c.raw+=l.raw,c.text+=l.text):s.push(l);continue}if(l=this.tokenizer.emStrong(n,i,a)){n=n.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.codespan(n)){n=n.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.br(n)){n=n.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.del(n,i,a)){n=n.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.autolink(n)){n=n.substring(l.raw.length),s.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(n))){n=n.substring(l.raw.length),s.push(l);continue}let d=n;if(this.options.extensions?.startInline){let c=1/0,u=n.slice(1),h;this.options.extensions.startInline.forEach(g=>{h=g.call({lexer:this},u),typeof h=="number"&&h>=0&&(c=Math.min(c,h))}),c<1/0&&c>=0&&(d=n.substring(0,c+1))}if(l=this.tokenizer.inlineText(d)){n=n.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(a=l.raw.slice(-1)),r=!0;let c=s.at(-1);c?.type==="text"?(c.raw+=l.raw,c.text+=l.text):s.push(l);continue}if(n){this.infiniteLoopError(n.charCodeAt(0));break}}return s},He),Zt=class{constructor(t){V(this,"options");V(this,"parser");this.options=t||Oe}space(t){return""}code({text:t,lang:n,escaped:s}){let i=(n||"").match(ce.notSpaceStart)?.[0],r=t?t.replace(ce.endingNewline,"")+`
|
|
60
|
+
`:"";return i?'<pre><code class="language-'+ye(i)+'">'+(s?r:ye(r,!0))+`</code></pre>
|
|
61
|
+
`:"<pre><code>"+(s?r:ye(r,!0))+`</code></pre>
|
|
62
62
|
`}blockquote({tokens:t}){return`<blockquote>
|
|
63
63
|
${this.parser.parse(t)}</blockquote>
|
|
64
64
|
`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:n}){return`<h${n}>${this.parser.parseInline(t)}</h${n}>
|
|
@@ -74,14 +74,14 @@ ${this.parser.parse(t)}</blockquote>
|
|
|
74
74
|
`}tablerow({text:t}){return`<tr>
|
|
75
75
|
${t}</tr>
|
|
76
76
|
`}tablecell(t){let n=this.parser.parseInline(t.tokens),s=t.header?"th":"td";return(t.align?`<${s} align="${t.align}">`:`<${s}>`)+n+`</${s}>
|
|
77
|
-
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${
|
|
78
|
-
Please report this to https://github.com/markedjs/marked.`,t){let i="<p>An error occurred:</p><pre>"+
|
|
79
|
-
`),[t.text,s]);return e("pre",{class:"code","data-lang":n||void 0,children:e("code",{dangerouslySetInnerHTML:{__html:i}})})}function Wn({tokens:t}){return e(L,{children:(t??[]).map((n,s)=>Wo(n,s))})}function Wo(t,n){switch(t.type){case"space":case"def":return null;case"heading":{let s=t;return
|
|
80
|
-
`).find(n=>n.trim())?.replace(/^#+\s*/,"").slice(0,120)??""}var mi={kind:"fact",tags:"",related:"",body:"",name:"",status:"",supersedes:""};function gi(t){return{kind:t.kind,tags:t.tags.join(", "),related:t.related.join(", "),body:t.body,name:t.name,status:t.status??"",supersedes:t.supersedes??""}}function Zo({name:t,kinds:n,statuses:s,onSaved:i,onDeleted:r}){let a=H(()=>t?P("/api/memories",{name:t}):Promise.resolve(void 0),[t]),[o,l]=C(!t),[d,c]=C(!1),[u,h]=C(mi),[g,f]=C(!1);O(()=>{l(!t),c(!1)},[t]),O(()=>{let _=a.data;t&&_&&h(gi(_)),t||h(mi)},[t,a.data]);let x=_=>E=>h({...u,[_]:E.target.value}),m=()=>{l(!1),c(!1)},p=async()=>{if(!u.body.trim())return J("body required",!0);f(!0);try{let _={kind:u.kind,content:u.body,tags:u.tags,related:u.related,status:u.status||void 0,supersedes:u.supersedes||void 0},E=t?await be("/api/memories",_,"PUT",{name:t}):await be("/api/memories",{..._,name:u.name.trim()||void 0});J(`${t?"saved":"created"} ${E.name}${E.superseded?` \xB7 ${E.superseded} marked superseded`:""}`),t===E.name&&a.reload(),i(E.name),m()}catch(_){J(_.message,!0)}finally{f(!1)}},y=()=>{a.data&&h(gi(a.data)),m()},v=async()=>{if(!(!t||!confirm(`Delete memory "${t}" and its file?`)))try{await Ft("/api/memories",{name:t}),J(`deleted ${t}`),r()}catch(_){J(_.message,!0)}},b=async()=>{if(!t)return;let _=prompt("New name (topic/slug):",t);if(!(!_||_===t))try{let E=await be("/api/memories",{to:_},"PATCH",{name:t});J(`renamed \u2192 ${E.name}${E.refsUpdated?` (${E.refsUpdated} references updated)`:""}`),i(E.name)}catch(E){J(E.message,!0)}},k=_=>{(_.metaKey||_.ctrlKey)&&_.key.toLowerCase()==="s"?(_.preventDefault(),p()):_.key==="Escape"&&t&&(_.preventDefault(),y())};if(t&&a.error)return e(G,{error:a.error});if(t&&!a.data)return e(B,{});let S=a.data,A=u.kind==="decision";return t&&S&&!o?e("div",{children:[e("div",{class:"row",style:{marginBottom:6},children:[e("b",{class:"grow break",children:t}),e("button",{type:"button",class:"sm primary",onClick:()=>l(!0),children:"edit"}),e("button",{type:"button",class:"sm",onClick:b,children:"rename"}),e("button",{type:"button",class:"sm danger",onClick:v,children:"delete"})]}),e("div",{class:"muted small",style:{marginBottom:8},children:[S.path," \xB7 created ",S.created.slice(0,10)," \xB7 updated ",S.updated.slice(0,10)]}),e("div",{class:"row tight mem-refs",style:{marginBottom:12},children:[e(Jn,{m:S}),S.tags.map(_=>e("span",{class:"tag",children:["#",_]})),S.related.map(_=>e(hi,{value:_})),S.supersedes?e("span",{class:"muted small",children:["supersedes ",e(hi,{value:`mem:${S.supersedes}`})]}):null]}),e(Yt,{source:S.body})]}):e("div",{children:[e("div",{class:"row",style:{marginBottom:6},children:[e("b",{class:"grow break",children:t??"New memory"}),t?e(L,{children:[e("span",{class:"muted small",children:"editing"}),e("button",{type:"button",class:"sm",onClick:b,children:"rename"}),e("button",{type:"button",class:"sm danger",onClick:v,children:"delete"})]}):null]}),t&&S?e("div",{class:"muted small",style:{marginBottom:8},children:[S.path," \xB7 created ",S.created.slice(0,10)," \xB7 updated ",S.updated.slice(0,10)]}):e("div",{class:"field",children:[e("label",{children:"name (topic/slug, optional \u2014 derived from kind + content)"}),e("input",{type:"text",placeholder:"auth/session-tokens",value:u.name,onInput:x("name")})]}),e("div",{class:"grid",style:{gridTemplateColumns:A?"1fr 1fr 2fr 2fr":"1fr 2fr 2fr",gap:8,marginBottom:0},children:[e("div",{class:"field",children:[e("label",{children:"kind"}),e("select",{value:u.kind,onChange:x("kind"),children:n.map(_=>e("option",{value:_,children:_}))})]}),A&&e("div",{class:"field",children:[e("label",{children:"status"}),e("select",{value:u.status,onChange:x("status"),children:[e("option",{value:"",children:"accepted (default)"}),s.map(_=>e("option",{value:_,children:_}))]})]}),e("div",{class:"field",children:[e("label",{children:"tags (comma separated)"}),e("input",{type:"text",value:u.tags,onInput:x("tags")})]}),e("div",{class:"field",children:[e("label",{children:"related (file:path, sym:path#Name, mem:name)"}),e("input",{type:"text",value:u.related,onInput:x("related")})]})]}),A&&e("div",{class:"field",children:[e("label",{children:"supersedes (name of the decision this replaces; it is marked superseded on save)"}),e("input",{type:"text",placeholder:"decision/old-approach",value:u.supersedes,onInput:x("supersedes")})]}),e("div",{class:"field",children:[e("div",{class:"row tight",children:[e("label",{class:"grow",children:"body (raw markdown)"}),e("a",{class:"small",onClick:()=>c(!d),children:d?"back to markdown":"preview"})]}),d?e(Yt,{class:"preview",source:u.body.trim()?u.body:"_Nothing to preview yet._"}):e("textarea",{value:u.body,onInput:x("body"),onKeyDown:k,spellcheck:!1})]}),e("div",{class:"row",children:[e("button",{type:"button",class:"primary",disabled:g,onClick:p,children:g?e(B,{}):t?"Save":"Create"}),t?e("button",{type:"button",disabled:g,onClick:y,children:"Cancel"}):null,e("span",{class:"muted small",children:["\u2318S / Ctrl+S saves",t?", Esc cancels":""]})]})]})}function Ko({rows:t}){let n=new Map;for(let s of t)(n.get(s.topic||"(no topic)")??n.set(s.topic||"(no topic)",[]).get(s.topic||"(no topic)")).push(s);return t.length?e("div",{class:"stack",children:[...n.entries()].sort().map(([s,i])=>e("div",{class:"card",children:[e("h3",{children:s}),i.map(r=>e("div",{style:{padding:"8px 0",borderBottom:"1px solid var(--line)"},children:[e("div",{class:"row tight",children:[e("b",{children:r.name}),e(Jn,{m:r}),e("span",{class:"muted small",children:he(r.updated_at)}),e("span",{class:"spacer"}),e("a",{class:"small",onClick:()=>z("memory",{name:r.name}),children:"open"})]}),r.supersedes?e("div",{class:"muted small",children:["supersedes ",r.supersedes]}):null,e("div",{style:{marginTop:6,fontSize:13},children:e(Yt,{source:r.content})})]}))]}))}):e(q,{children:'No accepted decisions yet. Record one with kind "decision", or ask Claude to em_remember it.'})}function fi({params:t}){let[n,s]=C(t.name?.startsWith("decision/")?"decision":t.tab??"all"),[i,r]=C(t.name??null),[a,o]=C(!1),[l,d]=C(""),[c,u]=C(""),h=H(()=>P("/api/memories"),[]);O(()=>{t.name&&(r(t.name),o(!1))},[t.name]),O(()=>{h.data?.gitignored&&J(`.gitignore keeps ${h.data.dir} out of git; memories stay local`,!0),h.data?.skipped.length&&J(`skipped invalid memory files: ${h.data.skipped.join(", ")}`,!0)},[h.data]);let g=Y(()=>{let m=h.data?.memories??[],p=l.trim().toLowerCase();return m.filter(y=>(n==="all"||n==="record"||y.kind===n)&&(!c||(y.status??"accepted")===c)&&(!p||y.name.includes(p)||y.tags.some(v=>v.includes(p))||y.content.toLowerCase().includes(p)))},[h.data,n,l,c]);if(h.error)return e("div",{class:"page",children:e(G,{error:h.error})});let f=h.data,x=[["all","All"],...(f?.kinds??[]).map(m=>[m,m]),["record","Decision record"]];return e("div",{class:"page",children:[e(Te,{tabs:x,value:n,onChange:m=>{s(m),m!=="decision"&&u("")}}),n==="record"?e(Ko,{rows:(f?.memories??[]).filter(m=>m.kind==="decision"&&(m.status??"accepted")==="accepted")}):e(L,{children:[e("div",{class:"row",style:{marginBottom:12},children:[e("button",{type:"button",class:"primary",onClick:()=>{o(!0),r(null)},children:"+ New memory"}),e("input",{type:"search",class:"grow",placeholder:"filter by name, tag or text\u2026",value:l,onInput:m=>d(m.target.value)}),n==="decision"&&e("select",{value:c,onChange:m=>u(m.target.value),children:[e("option",{value:"",children:"any status"}),(f?.statuses??[]).map(m=>e("option",{value:m,children:m}))]}),e("button",{type:"button",title:"re-import files edited by hand",onClick:async()=>{let m=await be("/api/actions",{action:"reconcile"});J(m.output,!m.ok),h.reload()},children:"\u21BB Reconcile"}),e("span",{class:"muted small",children:[g.length," of ",f?.memories.length??0]})]}),e("div",{class:"grid wide",style:{gridTemplateColumns:"minmax(280px,1fr) minmax(0,2fr)",alignItems:"start"},children:[e("div",{class:"card flush",children:e("div",{class:"list",children:f?g.length?g.map(m=>e("div",{class:M("item",i===m.name&&"sel"),onClick:()=>{r(m.name),o(!1)},children:[e("div",{class:"n",children:m.name}),e("div",{class:"p",children:[e(Jn,{m}),e("span",{class:"muted",children:[he(m.updated_at)," \xB7 ",K(m.size??0),"B"]})]}),e("div",{class:"p",children:Vo(m.content)})]})):e(q,{children:"no memories match"}):e(q,{children:e(B,{})})})}),e("div",{class:"card",children:a||i?e(Zo,{name:a?null:i,kinds:f?.kinds??[],statuses:f?.statuses??[],onSaved:m=>{o(!1),r(m),h.reload()},onDeleted:()=>{r(null),h.reload()}}):e(q,{children:"Select a memory, or create a new one."})})]})]}),e("div",{style:{display:"none"},children:e(I,{children:"x"})})]})}function bi({rows:t}){let n=[...t].sort((s,i)=>i.raw_chars-s.raw_chars);return e("table",{children:[e("thead",{children:e("tr",{children:[e("th",{children:"tool"}),e("th",{class:"num",children:"calls"}),e("th",{class:"num",children:"seen"}),e("th",{class:"num",children:"returned"}),e("th",{class:"num",children:"saved"})]})}),e("tbody",{children:n.length?n.map(s=>{let i=Math.ceil(s.raw_chars/4),r=Math.ceil(s.returned_chars/4);return e("tr",{children:[e("td",{children:s.tool}),e("td",{class:"num",children:s.calls}),e("td",{class:"num",children:K(i)}),e("td",{class:"num",children:K(r)}),e("td",{class:"num",children:K(Math.max(0,i-r))})]})}):e("tr",{children:e("td",{class:"muted",colSpan:5,children:"no calls yet"})})})]})}function vi(){let t=H(()=>P("/api/stats"),[]);if(t.error)return e("div",{class:"page",children:e(G,{error:t.error})});let n=t.data;if(!n)return e("div",{class:"page",children:e(B,{})});let s=[["session saved",K(n.session.savedTokens),`${Je(n.session.efficiency)} efficient \xB7 ${n.session.calls} calls`],["project saved",K(n.projectTotals.savedTokens),`${Je(n.projectTotals.efficiency)} efficient \xB7 ${n.projectTotals.calls} calls`],["lifetime saved",K(n.lifetime.savedTokens),`${Je(n.lifetime.efficiency)} efficient \xB7 ${n.lifetime.calls} calls`],["documents",String(n.index.documents),e(L,{children:[n.index.vectors," vectors",n.index.pendingEmbeddings?e("span",{class:"warn",children:" \xB7 backlog"}):null]})],["memories",String(n.index.memories),`${n.onboarding.length}/4 onboarding`],["graph",`${n.index.graph.nodes} nodes`,`${n.index.graph.edges} edges`]],i=Math.max(1,...n.daily.map(a=>a.saved_chars)),r=["overview","structure","commands","conventions"].filter(a=>!n.onboarding.includes(a));return e("div",{class:"page",children:[e("div",{class:"grid",children:s.map(([a,o,l])=>e("div",{class:"card",children:[e("h3",{children:a}),e("div",{class:"big",children:o}),e("div",{class:"sub",children:l})]}))}),e("div",{class:"grid wide",children:[e("div",{class:"card",children:[e("h3",{children:["tokens saved per day",e("span",{class:"right",children:n.daily.length?`${n.daily[0]?.day} \u2192 ${n.daily[n.daily.length-1]?.day}`:""})]}),e("div",{class:"bars",children:n.daily.length?n.daily.map(a=>e("div",{title:`${a.day}: ${K(Math.ceil(a.saved_chars/4))} tokens, ${a.calls} calls`,style:{height:`${Math.max(2,100*a.saved_chars/i)}%`}})):e("div",{class:"muted",children:"no data yet"})})]}),e("div",{class:"card",children:[e("h3",{children:"system"}),e(Me,{rows:[["project",n.project],["database",n.dbPath],["routing",n.routing],["embeddings",n.index.embeddings],["memories dir",n.memoriesDir],["onboarding",r.length?e("span",{class:"warn",children:["missing: ",r.join(", ")," \u2014 run /eminiar:em-onboard"]}):e("span",{class:"ok",children:"complete"})],["session",n.session.id]]})]})]}),e("div",{class:"grid two",children:[e("div",{class:"card",children:[e("h3",{children:"this session \xB7 by tool"}),e(bi,{rows:n.session.tools})]}),e("div",{class:"card",children:[e("h3",{children:"lifetime \xB7 by tool"}),e(bi,{rows:n.lifetime.tools})]})]}),e("div",{class:"grid",children:[e("div",{class:"card",children:[e("h3",{children:"index by source"}),e("table",{children:e("tbody",{children:Object.entries(n.index.bySource).filter(([,a])=>a).map(([a,o])=>e("tr",{children:[e("td",{children:a}),e("td",{class:"num",children:o})]}))})})]}),e("div",{class:"card",children:[e("h3",{children:"graph by edge kind"}),e("table",{children:e("tbody",{children:Object.entries(n.index.graph.byKind??{}).sort((a,o)=>o[1]-a[1]).map(([a,o])=>e("tr",{children:[e("td",{children:a}),e("td",{class:"num",children:o})]}))})})]}),e("div",{class:"card",style:{gridColumn:"span 2"},children:[e("h3",{children:["recent sessions"," ",e("a",{class:"right",onClick:()=>z("sessions"),children:"all \u2192"})]}),e("table",{children:[e("thead",{children:e("tr",{children:[e("th",{children:"started"}),e("th",{children:"session"}),e("th",{children:"last prompt"}),e("th",{class:"num",children:"calls"}),e("th",{class:"num",children:"saved"})]})}),e("tbody",{children:n.sessions.map(a=>e("tr",{children:[e("td",{class:"muted",children:[ne(a.started_at)," ",a.current?e(I,{children:"current"}):null]}),e("td",{children:e("code",{children:a.id.slice(0,8)})}),e("td",{class:"muted",children:(a.last_prompt??"").slice(0,90)}),e("td",{class:"num",children:a.calls}),e("td",{class:"num",children:K(a.savedTokens)})]}))})]})]})]})]})}function yi(){let t=H(()=>P("/api/sessions",{limit:60}),[]),[n,s]=C(null),[i,r]=C(""),[a,o]=C(100);O(()=>{!n&&t.data?.[0]&&s(t.data[0].id)},[t.data]);let l=H(()=>n?P("/api/events",{session:n,category:i||void 0,limit:a}):Promise.resolve([]),[n,i,a]),d=[...new Set((l.data??[]).map(c=>c.category))].sort();return t.error?e("div",{class:"page",children:e(G,{error:t.error})}):e("div",{class:"page",children:e("div",{class:"grid wide",style:{gridTemplateColumns:"minmax(280px,1fr) minmax(0,2fr)",alignItems:"start"},children:[e("div",{class:"card flush",children:e("div",{class:"list",children:t.data?t.data.length?t.data.map(c=>e("div",{class:M("item",n===c.id&&"sel"),onClick:()=>s(c.id),children:[e("div",{class:"n",children:[e("code",{children:c.id.slice(0,8)})," ",c.current?e(I,{children:"current"}):null,e("span",{class:"muted",style:{float:"right",fontWeight:400},children:ne(c.started_at)})]}),e("div",{class:"p",children:(c.last_prompt??"(no prompt yet)").slice(0,100)}),e("div",{class:"p",children:[c.calls," calls \xB7 ",K(c.savedTokens)," saved \xB7 ",Je(c.efficiency),c.source?` \xB7 ${c.source}`:""]})]})):e(q,{children:"no sessions yet"}):e(q,{children:e(B,{})})})}),e("div",{class:"card",children:[e("h3",{children:["events \xB7 ",n?n.slice(0,8):"all"," \xB7 ",l.data?.length??0]}),e("div",{class:"row",style:{marginBottom:8},children:[e("select",{value:i,onChange:c=>r(c.target.value),children:[e("option",{value:"",children:"all categories"}),d.map(c=>e("option",{value:c,children:c}))]}),e("label",{class:"muted small",children:["limit"," ",e("select",{value:String(a),onChange:c=>o(Number(c.target.value)),children:[100,300,1e3].map(c=>e("option",{value:String(c),children:c}))})]})]}),l.error?e(G,{error:l.error}):e("table",{children:[e("thead",{children:e("tr",{children:[e("th",{children:"time"}),e("th",{children:"category"}),e("th",{children:"tool"}),e("th",{children:"payload"})]})}),e("tbody",{children:(l.data??[]).length?(l.data??[]).map(c=>e("tr",{children:[e("td",{class:"muted nowrap",title:new Date(c.ts).toLocaleString(),children:$s(c.ts)}),e("td",{class:"nowrap",children:[e(I,{children:["P",c.priority]}),c.category]}),e("td",{children:c.tool??""}),e("td",{children:e("pre",{class:"json",children:JSON.stringify(c.payload).slice(0,400)})})]})):e("tr",{children:e("td",{colSpan:4,class:"muted",children:"no events"})})})]})]})]})})}function Yo(){let[t,n]=C(!1),s=H(()=>P("/api/doctor",{fix:t?1:void 0}),[t]),i=(s.data??[]).filter(r=>!r.ok).length;return e(L,{children:[e("div",{class:"row",style:{marginBottom:10},children:[e("button",{type:"button",class:"primary",onClick:()=>s.reload(),children:"Re-run"}),e("button",{type:"button",onClick:()=>{n(!0),s.reload()},children:"Run with --fix"}),e("span",{class:"muted small",children:s.loading?e(B,{}):s.data?i?e("span",{class:"bad",children:[i," problem",i>1?"s":""]}):e("span",{class:"ok",children:"all checks pass"}):""})]}),s.error?e(G,{error:s.error}):e("div",{class:"card flush",children:e("table",{children:e("tbody",{children:(s.data??[]).map(r=>e("tr",{children:[e("td",{class:M(r.ok?"ok":"bad"),style:{width:24},children:r.ok?"\u2713":"\u2717"}),e("td",{class:"nowrap",children:r.name}),e("td",{class:"break",children:r.detail})]}))})})})]})}function Qo({onChanged:t}){let[n,s]=C([]),[i,r]=C(null),[a,o]=C("all"),[l,d]=C(!1),[c,u]=C(""),[h,g]=C(""),[f,x]=C("index"),[m,p]=C(""),y=H(()=>P("/api/stats"),[]),v=async(k,S)=>{r(k);let A=new Date().toLocaleTimeString();s(_=>[..._,`[${A}] ${k} \u2026`]);try{let _=await be("/api/actions",S);s(E=>[...E,`${_.ok?"\u2713":"\u2717"} ${k} (${_.ms} ms)
|
|
77
|
+
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${ye(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:n,text:s,tokens:i,autolink:r}){let a=r?ye(s,!0):this.parser.parseInline(i),o=Jr(t);if(o===null)return a;t=ye(o,r);let l='<a href="'+t+'"';return n&&(l+=' title="'+ye(n)+'"'),l+=">"+a+"</a>",l}image({href:t,title:n,text:s,tokens:i}){i&&(s=this.parser.parseInline(i,this.parser.textRenderer));let r=Jr(t);if(r===null)return ye(s);t=r;let a=`<img src="${ye(t)}" alt="${ye(s)}"`;return n&&(a+=` title="${ye(n)}"`),a+=">",a}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:ye(t.text)}},Gn=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},_e=class Bn{constructor(n){V(this,"options");V(this,"renderer");V(this,"textRenderer");this.options=n||Oe,this.options.renderer=this.options.renderer||new Zt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Gn}static parse(n,s){return new Bn(s).parse(n)}static parseInline(n,s){return new Bn(s).parseInline(n)}parse(n){this.renderer.parser=this;let s="";for(let i=0;i<n.length;i++){let r=n[i];if(this.options.extensions?.renderers?.[r.type]){let o=r,l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(o.type)){s+=l||"";continue}}let a=r;switch(a.type){case"space":{s+=this.renderer.space(a);break}case"hr":{s+=this.renderer.hr(a);break}case"heading":{s+=this.renderer.heading(a);break}case"code":{s+=this.renderer.code(a);break}case"table":{s+=this.renderer.table(a);break}case"blockquote":{s+=this.renderer.blockquote(a);break}case"list":{s+=this.renderer.list(a);break}case"checkbox":{s+=this.renderer.checkbox(a);break}case"html":{s+=this.renderer.html(a);break}case"def":{s+=this.renderer.def(a);break}case"paragraph":{s+=this.renderer.paragraph(a);break}case"text":{s+=this.renderer.text(a);break}default:{let o='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return s}parseInline(n,s=this.renderer){this.renderer.parser=this;let i="";for(let r=0;r<n.length;r++){let a=n[r];if(this.options.extensions?.renderers?.[a.type]){let l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(a.type)){i+=l||"";continue}}let o=a;switch(o.type){case"escape":{i+=s.text(o);break}case"html":{i+=s.html(o);break}case"link":{i+=s.link(o);break}case"image":{i+=s.image(o);break}case"checkbox":{i+=s.checkbox(o);break}case"strong":{i+=s.strong(o);break}case"em":{i+=s.em(o);break}case"codespan":{i+=s.codespan(o);break}case"br":{i+=s.br(o);break}case"del":{i+=s.del(o);break}case"text":{i+=s.text(o);break}default:{let l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return i}},Gt,mt=(Gt=class{constructor(t){V(this,"options");V(this,"block");this.options=t||Oe}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?xe.lex:xe.lexInline}provideParser(t=this.block){return t?_e.parse:_e.parseInline}},V(Gt,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),V(Gt,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Gt);function Be(t,n){if(Array.isArray(n))for(let s=0;s<n.length;s++)t.push(n[s]);else t.push(n)}var jo=class{constructor(...t){V(this,"defaults",zn());V(this,"options",this.setOptions);V(this,"parse",this.parseMarkdown(!0));V(this,"parseInline",this.parseMarkdown(!1));V(this,"Parser",_e);V(this,"Renderer",Zt);V(this,"TextRenderer",Gn);V(this,"Lexer",xe);V(this,"Tokenizer",Vt);V(this,"Hooks",mt);this.use(...t)}walkTokens(t,n){let s=[];for(let i of t)switch(Be(s,n.call(this,i)),i.type){case"table":{let r=i;for(let a of r.header)Be(s,this.walkTokens(a.tokens,n));for(let a of r.rows)for(let o of a)Be(s,this.walkTokens(o.tokens,n));break}case"list":{let r=i;Be(s,this.walkTokens(r.items,n));break}default:{let r=i;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(a=>{let o=r[a].flat(1/0);Be(s,this.walkTokens(o,n))}):r.tokens&&Be(s,this.walkTokens(r.tokens,n))}}return s}use(...t){let n=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(s=>{let i={...s};if(i.async=this.defaults.async||i.async||!1,s.extensions&&(s.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let a=n.renderers[r.name];a?n.renderers[r.name]=function(...o){let l=r.renderer.apply(this,o);return l===!1&&(l=a.apply(this,o)),l}:n.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=n[r.level];a?a.unshift(r.tokenizer):n[r.level]=[r.tokenizer],r.start&&(r.level==="block"?n.startBlock?n.startBlock.push(r.start):n.startBlock=[r.start]:r.level==="inline"&&(n.startInline?n.startInline.push(r.start):n.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(n.childTokens[r.name]=r.childTokens)}),i.extensions=n),s.renderer){let r=this.defaults.renderer||new Zt(this.defaults);for(let a in s.renderer){if(!(a in r))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let o=a,l=s.renderer[o],d=r[o];r[o]=(...c)=>{let u=l.apply(r,c);return u===!1&&(u=d.apply(r,c)),u||""}}i.renderer=r}if(s.tokenizer){let r=this.defaults.tokenizer||new Vt(this.defaults);for(let a in s.tokenizer){if(!(a in r))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let o=a,l=s.tokenizer[o],d=r[o];r[o]=(...c)=>{let u=l.apply(r,c);return u===!1&&(u=d.apply(r,c)),u}}i.tokenizer=r}if(s.hooks){let r=this.defaults.hooks||new mt;for(let a in s.hooks){if(!(a in r))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let o=a,l=s.hooks[o],d=r[o];mt.passThroughHooks.has(a)?r[o]=c=>{if(this.defaults.async&&mt.passThroughHooksRespectAsync.has(a))return(async()=>{let h=await l.call(r,c);return d.call(r,h)})();let u=l.call(r,c);return d.call(r,u)}:r[o]=(...c)=>{if(this.defaults.async)return(async()=>{let h=await l.apply(r,c);return h===!1&&(h=await d.apply(r,c)),h})();let u=l.apply(r,c);return u===!1&&(u=d.apply(r,c)),u}}i.hooks=r}if(s.walkTokens){let r=this.defaults.walkTokens,a=s.walkTokens;i.walkTokens=function(o){let l=[];return l.push(a.call(this,o)),r&&Be(l,r.call(this,o)),l}}this.defaults={...this.defaults,...i}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,n){return xe.lex(t,n??this.defaults)}parser(t,n){return _e.parse(t,n??this.defaults)}parseMarkdown(t){return(n,s)=>{let i={...s},r={...this.defaults,...i},a=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&i.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=t),r.async)return(async()=>{let o=r.hooks?await r.hooks.preprocess(n):n,l=await(r.hooks?await r.hooks.provideLexer(t):t?xe.lex:xe.lexInline)(o,r),d=r.hooks?await r.hooks.processAllTokens(l):l;r.walkTokens&&await Promise.all(this.walkTokens(d,r.walkTokens));let c=await(r.hooks?await r.hooks.provideParser(t):t?_e.parse:_e.parseInline)(d,r);return r.hooks?await r.hooks.postprocess(c):c})().catch(a);try{r.hooks&&(n=r.hooks.preprocess(n));let o=(r.hooks?r.hooks.provideLexer(t):t?xe.lex:xe.lexInline)(n,r);r.hooks&&(o=r.hooks.processAllTokens(o)),r.walkTokens&&this.walkTokens(o,r.walkTokens);let l=(r.hooks?r.hooks.provideParser(t):t?_e.parse:_e.parseInline)(o,r);return r.hooks&&(l=r.hooks.postprocess(l)),l}catch(o){return a(o)}}}onError(t,n){return s=>{if(s.message+=`
|
|
78
|
+
Please report this to https://github.com/markedjs/marked.`,t){let i="<p>An error occurred:</p><pre>"+ye(s.message+"",!0)+"</pre>";return n?Promise.resolve(i):i}if(n)return Promise.reject(s);throw s}}},je=new jo;function Q(t,n){return je.parse(t,n)}Q.options=Q.setOptions=function(t){return je.setOptions(t),Q.defaults=je.defaults,ei(Q.defaults),Q};Q.getDefaults=zn;Q.defaults=Oe;function Oo(...t){return je.use(...t),Q.defaults=je.defaults,ei(Q.defaults),Q}Q.use=Oo;Q.walkTokens=function(t,n){return je.walkTokens(t,n)};Q.parseInline=je.parseInline;Q.Parser=_e;Q.parser=_e.parse;Q.Renderer=Zt;Q.TextRenderer=Gn;Q.Lexer=xe;Q.lexer=xe.lex;Q.Tokenizer=Vt;Q.Hooks=mt;Q.parse=Q;var pu=Q.options,hu=Q.setOptions,mu=Q.walkTokens,gu=Q.parseInline;var fu=_e.parse,di=xe.lex;var Uo={ts:"typescript",js:"javascript",mjs:"javascript",cjs:"javascript",py:"python",sh:"bash",shell:"bash",zsh:"bash",console:"bash",jsonc:"json",md:"markdown"},ui={amp:"&",lt:"<",gt:">",quot:'"',apos:"'","#39":"'"};function Xo(t){return t.replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/gi,(n,s)=>s in ui?ui[s]:s.startsWith("#x")?String.fromCodePoint(Number.parseInt(s.slice(2),16)):s.startsWith("#")?String.fromCodePoint(Number.parseInt(s.slice(1),10)):n)}function we({tokens:t}){return e(L,{children:(t??[]).map((n,s)=>pi(n,s))})}function qo({t}){let n=pt(t.href),s=e(we,{tokens:t.tokens}),i=t.title??void 0,r=Xt(n);return r?e("a",{class:"ref",href:r,title:i??t.href,children:s}):n.kind==="external"?e("a",{href:n.href,title:i,target:"_blank",rel:"noopener noreferrer",children:s}):n.kind==="anchor"?e("a",{href:n.href,title:i,children:s}):e("span",{title:t.href,children:s})}function pi(t,n){switch(t.type){case"text":{let s=t;return s.tokens?e(we,{tokens:s.tokens},n):s.escaped?Xo(s.text):s.text}case"escape":return t.text;case"strong":return e("strong",{children:e(we,{tokens:t.tokens})},n);case"em":return e("em",{children:e(we,{tokens:t.tokens})},n);case"del":return e("del",{children:e(we,{tokens:t.tokens})},n);case"codespan":return e("code",{children:t.text},n);case"br":return e("br",{},n);case"link":return e(qo,{t},n);case"image":{let s=t,i=pt(s.href);return i.kind==="external"?e("img",{src:i.href,alt:s.text,title:s.title??void 0,loading:"lazy"},n):e("span",{class:"md-html",title:s.href,children:s.text},n)}case"checkbox":return e("input",{type:"checkbox",checked:t.checked,disabled:!0},n);case"html":return e("span",{class:"md-html",children:t.text},n);default:{let s=t;return s.tokens?e(we,{tokens:s.tokens},n):s.raw}}}function Go({t}){let n=(t.lang??"").trim().split(/\s+/)[0]?.toLowerCase()??"",s=Uo[n]??n,i=Y(()=>Ht(t.text,s).join(`
|
|
79
|
+
`),[t.text,s]);return e("pre",{class:"code","data-lang":n||void 0,children:e("code",{dangerouslySetInnerHTML:{__html:i}})})}function Wn({tokens:t}){return e(L,{children:(t??[]).map((n,s)=>Wo(n,s))})}function Wo(t,n){switch(t.type){case"space":case"def":return null;case"heading":{let s=t;return $t(`h${Math.min(Math.max(s.depth,1),6)}`,{key:n},e(we,{tokens:s.tokens}))}case"paragraph":return e("p",{children:e(we,{tokens:t.tokens})},n);case"text":{let s=t;return s.tokens?e(we,{tokens:s.tokens},n):s.text}case"checkbox":return pi(t,n);case"code":return e(Go,{t},n);case"blockquote":return e("blockquote",{children:e(Wn,{tokens:t.tokens})},n);case"list":{let s=t,i=s.items.map((r,a)=>e("li",{class:r.task?"task":void 0,children:e(Wn,{tokens:r.tokens})},a));return s.ordered?e("ol",{start:s.start===""?void 0:s.start,children:i},n):e("ul",{children:i},n)}case"table":{let s=t,i=(r,a)=>$t(r.header?"th":"td",{key:a,style:r.align?{textAlign:r.align}:void 0},e(we,{tokens:r.tokens}));return e("table",{children:[e("thead",{children:e("tr",{children:s.header.map(i)})}),e("tbody",{children:s.rows.map((r,a)=>e("tr",{children:r.map(i)},a))})]},n)}case"hr":return e("hr",{},n);case"html":return e("pre",{class:"md-html",children:t.text},n);default:{let s=t;return e("p",{children:s.tokens?e(we,{tokens:s.tokens}):s.raw},n)}}}function Yt({source:t,class:n}){let s=Y(()=>di(t,{gfm:!0}),[t]);return e("div",{class:n?`md ${n}`:"md",children:e(Wn,{tokens:s})})}var Jo={decision:"#7c3aed",constraint:"#dc2626",fact:"#2563eb",preference:"#0d9488",todo:"#d97706",note:"#6b7280",onboarding:"#16a34a"};function Jn({m:t}){return e(L,{children:[e("span",{class:"tag kind",style:{color:Jo[t.kind]??"#6b7280"},children:t.kind}),t.status&&t.status!=="accepted"?e("span",{class:`tag s-${t.status}`,children:t.status}):null]})}function hi({value:t}){let n=Xt(pt(t));return n?e("a",{class:"ref",href:n,title:t,children:t}):e("span",{class:"tag",title:t,children:t})}function Vo(t){return t.split(`
|
|
80
|
+
`).find(n=>n.trim())?.replace(/^#+\s*/,"").slice(0,120)??""}var mi={kind:"fact",tags:"",related:"",body:"",name:"",status:"",supersedes:""};function gi(t){return{kind:t.kind,tags:t.tags.join(", "),related:t.related.join(", "),body:t.body,name:t.name,status:t.status??"",supersedes:t.supersedes??""}}function Zo({name:t,kinds:n,statuses:s,onSaved:i,onDeleted:r}){let a=z(()=>t?P("/api/memories",{name:t}):Promise.resolve(void 0),[t]),[o,l]=A(!t),[d,c]=A(!1),[u,h]=A(mi),[g,f]=A(!1);O(()=>{l(!t),c(!1)},[t]),O(()=>{let _=a.data;t&&_&&h(gi(_)),t||h(mi)},[t,a.data]);let x=_=>E=>h({...u,[_]:E.target.value}),m=()=>{l(!1),c(!1)},p=async()=>{if(!u.body.trim())return J("body required",!0);f(!0);try{let _={kind:u.kind,content:u.body,tags:u.tags,related:u.related,status:u.status||void 0,supersedes:u.supersedes||void 0},E=t?await be("/api/memories",_,"PUT",{name:t}):await be("/api/memories",{..._,name:u.name.trim()||void 0});J(`${t?"saved":"created"} ${E.name}${E.superseded?` \xB7 ${E.superseded} marked superseded`:""}`),t===E.name&&a.reload(),i(E.name),m()}catch(_){J(_.message,!0)}finally{f(!1)}},v=()=>{a.data&&h(gi(a.data)),m()},b=async()=>{if(!(!t||!confirm(`Delete memory "${t}" and its file?`)))try{await Ft("/api/memories",{name:t}),J(`deleted ${t}`),r()}catch(_){J(_.message,!0)}},y=async()=>{if(!t)return;let _=prompt("New name (topic/slug):",t);if(!(!_||_===t))try{let E=await be("/api/memories",{to:_},"PATCH",{name:t});J(`renamed \u2192 ${E.name}${E.refsUpdated?` (${E.refsUpdated} references updated)`:""}`),i(E.name)}catch(E){J(E.message,!0)}},k=_=>{(_.metaKey||_.ctrlKey)&&_.key.toLowerCase()==="s"?(_.preventDefault(),p()):_.key==="Escape"&&t&&(_.preventDefault(),v())};if(t&&a.error)return e(q,{error:a.error});if(t&&!a.data)return e(B,{});let S=a.data,$=u.kind==="decision";return t&&S&&!o?e("div",{children:[e("div",{class:"row",style:{marginBottom:6},children:[e("b",{class:"grow break",children:t}),e("button",{type:"button",class:"sm primary",onClick:()=>l(!0),children:"edit"}),e("button",{type:"button",class:"sm",onClick:y,children:"rename"}),e("button",{type:"button",class:"sm danger",onClick:b,children:"delete"})]}),e("div",{class:"muted small",style:{marginBottom:8},children:[S.path," \xB7 created ",S.created.slice(0,10)," \xB7 updated ",S.updated.slice(0,10)]}),e("div",{class:"row tight mem-refs",style:{marginBottom:12},children:[e(Jn,{m:S}),S.tags.map(_=>e("span",{class:"tag",children:["#",_]})),S.related.map(_=>e(hi,{value:_})),S.supersedes?e("span",{class:"muted small",children:["supersedes ",e(hi,{value:`mem:${S.supersedes}`})]}):null]}),e(Yt,{source:S.body})]}):e("div",{children:[e("div",{class:"row",style:{marginBottom:6},children:[e("b",{class:"grow break",children:t??"New memory"}),t?e(L,{children:[e("span",{class:"muted small",children:"editing"}),e("button",{type:"button",class:"sm",onClick:y,children:"rename"}),e("button",{type:"button",class:"sm danger",onClick:b,children:"delete"})]}):null]}),t&&S?e("div",{class:"muted small",style:{marginBottom:8},children:[S.path," \xB7 created ",S.created.slice(0,10)," \xB7 updated ",S.updated.slice(0,10)]}):e("div",{class:"field",children:[e("label",{children:"name (topic/slug, optional \u2014 derived from kind + content)"}),e("input",{type:"text",placeholder:"auth/session-tokens",value:u.name,onInput:x("name")})]}),e("div",{class:"grid",style:{gridTemplateColumns:$?"1fr 1fr 2fr 2fr":"1fr 2fr 2fr",gap:8,marginBottom:0},children:[e("div",{class:"field",children:[e("label",{children:"kind"}),e("select",{value:u.kind,onChange:x("kind"),children:n.map(_=>e("option",{value:_,children:_}))})]}),$&&e("div",{class:"field",children:[e("label",{children:"status"}),e("select",{value:u.status,onChange:x("status"),children:[e("option",{value:"",children:"accepted (default)"}),s.map(_=>e("option",{value:_,children:_}))]})]}),e("div",{class:"field",children:[e("label",{children:"tags (comma separated)"}),e("input",{type:"text",value:u.tags,onInput:x("tags")})]}),e("div",{class:"field",children:[e("label",{children:"related (file:path, sym:path#Name, mem:name)"}),e("input",{type:"text",value:u.related,onInput:x("related")})]})]}),$&&e("div",{class:"field",children:[e("label",{children:"supersedes (name of the decision this replaces; it is marked superseded on save)"}),e("input",{type:"text",placeholder:"decision/old-approach",value:u.supersedes,onInput:x("supersedes")})]}),e("div",{class:"field",children:[e("div",{class:"row tight",children:[e("label",{class:"grow",children:"body (raw markdown)"}),e("a",{class:"small",onClick:()=>c(!d),children:d?"back to markdown":"preview"})]}),d?e(Yt,{class:"preview",source:u.body.trim()?u.body:"_Nothing to preview yet._"}):e("textarea",{value:u.body,onInput:x("body"),onKeyDown:k,spellcheck:!1})]}),e("div",{class:"row",children:[e("button",{type:"button",class:"primary",disabled:g,onClick:p,children:g?e(B,{}):t?"Save":"Create"}),t?e("button",{type:"button",disabled:g,onClick:v,children:"Cancel"}):null,e("span",{class:"muted small",children:["\u2318S / Ctrl+S saves",t?", Esc cancels":""]})]})]})}function Ko({rows:t}){let n=new Map;for(let s of t)(n.get(s.topic||"(no topic)")??n.set(s.topic||"(no topic)",[]).get(s.topic||"(no topic)")).push(s);return t.length?e("div",{class:"stack",children:[...n.entries()].sort().map(([s,i])=>e("div",{class:"card",children:[e("h3",{children:s}),i.map(r=>e("div",{style:{padding:"8px 0",borderBottom:"1px solid var(--line)"},children:[e("div",{class:"row tight",children:[e("b",{children:r.name}),e(Jn,{m:r}),e("span",{class:"muted small",children:he(r.updated_at)}),e("span",{class:"spacer"}),e("a",{class:"small",onClick:()=>j("memory",{name:r.name}),children:"open"})]}),r.supersedes?e("div",{class:"muted small",children:["supersedes ",r.supersedes]}):null,e("div",{style:{marginTop:6,fontSize:13},children:e(Yt,{source:r.content})})]}))]}))}):e(G,{children:'No accepted decisions yet. Record one with kind "decision", or ask Claude to em_remember it.'})}function fi({params:t}){let[n,s]=A(t.name?.startsWith("decision/")?"decision":t.tab??"all"),[i,r]=A(t.name??null),[a,o]=A(!1),[l,d]=A(""),[c,u]=A(""),h=z(()=>P("/api/memories"),[]);O(()=>{t.name&&(r(t.name),o(!1))},[t.name]),O(()=>{h.data?.gitignored&&J(`.gitignore keeps ${h.data.dir} out of git; memories stay local`,!0),h.data?.skipped.length&&J(`skipped invalid memory files: ${h.data.skipped.join(", ")}`,!0)},[h.data]);let g=Y(()=>{let m=h.data?.memories??[],p=l.trim().toLowerCase();return m.filter(v=>(n==="all"||n==="record"||v.kind===n)&&(!c||(v.status??"accepted")===c)&&(!p||v.name.includes(p)||v.tags.some(b=>b.includes(p))||v.content.toLowerCase().includes(p)))},[h.data,n,l,c]);if(h.error)return e("div",{class:"page",children:e(q,{error:h.error})});let f=h.data,x=[["all","All"],...(f?.kinds??[]).map(m=>[m,m]),["record","Decision record"]];return e("div",{class:"page",children:[e(Te,{tabs:x,value:n,onChange:m=>{s(m),m!=="decision"&&u("")}}),n==="record"?e(Ko,{rows:(f?.memories??[]).filter(m=>m.kind==="decision"&&(m.status??"accepted")==="accepted")}):e(L,{children:[e("div",{class:"row",style:{marginBottom:12},children:[e("button",{type:"button",class:"primary",onClick:()=>{o(!0),r(null)},children:"+ New memory"}),e("input",{type:"search",class:"grow",placeholder:"filter by name, tag or text\u2026",value:l,onInput:m=>d(m.target.value)}),n==="decision"&&e("select",{value:c,onChange:m=>u(m.target.value),children:[e("option",{value:"",children:"any status"}),(f?.statuses??[]).map(m=>e("option",{value:m,children:m}))]}),e("button",{type:"button",title:"re-import files edited by hand",onClick:async()=>{let m=await be("/api/actions",{action:"reconcile"});J(m.output,!m.ok),h.reload()},children:"\u21BB Reconcile"}),e("span",{class:"muted small",children:[g.length," of ",f?.memories.length??0]})]}),e("div",{class:"grid wide",style:{gridTemplateColumns:"minmax(280px,1fr) minmax(0,2fr)",alignItems:"start"},children:[e("div",{class:"card flush",children:e("div",{class:"list",children:f?g.length?g.map(m=>e("div",{class:M("item",i===m.name&&"sel"),onClick:()=>{r(m.name),o(!1)},children:[e("div",{class:"n",children:m.name}),e("div",{class:"p",children:[e(Jn,{m}),e("span",{class:"muted",children:[he(m.updated_at)," \xB7 ",K(m.size??0),"B"]})]}),e("div",{class:"p",children:Vo(m.content)})]})):e(G,{children:"no memories match"}):e(G,{children:e(B,{})})})}),e("div",{class:"card",children:a||i?e(Zo,{name:a?null:i,kinds:f?.kinds??[],statuses:f?.statuses??[],onSaved:m=>{o(!1),r(m),h.reload()},onDeleted:()=>{r(null),h.reload()}}):e(G,{children:"Select a memory, or create a new one."})})]})]}),e("div",{style:{display:"none"},children:e(I,{children:"x"})})]})}function bi({rows:t}){let n=[...t].sort((s,i)=>i.raw_chars-s.raw_chars);return e("table",{children:[e("thead",{children:e("tr",{children:[e("th",{children:"tool"}),e("th",{class:"num",children:"calls"}),e("th",{class:"num",children:"seen"}),e("th",{class:"num",children:"returned"}),e("th",{class:"num",children:"saved"})]})}),e("tbody",{children:n.length?n.map(s=>{let i=Math.ceil(s.raw_chars/4),r=Math.ceil(s.returned_chars/4);return e("tr",{children:[e("td",{children:s.tool}),e("td",{class:"num",children:s.calls}),e("td",{class:"num",children:K(i)}),e("td",{class:"num",children:K(r)}),e("td",{class:"num",children:K(Math.max(0,i-r))})]})}):e("tr",{children:e("td",{class:"muted",colSpan:5,children:"no calls yet"})})})]})}function yi(){let t=z(()=>P("/api/stats"),[]);if(t.error)return e("div",{class:"page",children:e(q,{error:t.error})});let n=t.data;if(!n)return e("div",{class:"page",children:e(B,{})});let s=[["session saved",K(n.session.savedTokens),`${Je(n.session.efficiency)} efficient \xB7 ${n.session.calls} calls`],["project saved",K(n.projectTotals.savedTokens),`${Je(n.projectTotals.efficiency)} efficient \xB7 ${n.projectTotals.calls} calls`],["lifetime saved",K(n.lifetime.savedTokens),`${Je(n.lifetime.efficiency)} efficient \xB7 ${n.lifetime.calls} calls`],["documents",String(n.index.documents),e(L,{children:[n.index.vectors," vectors",n.index.pendingEmbeddings?e("span",{class:"warn",children:" \xB7 backlog"}):null]})],["memories",String(n.index.memories),`${n.onboarding.length}/4 onboarding`],["graph",`${n.index.graph.nodes} nodes`,`${n.index.graph.edges} edges`]],i=Math.max(1,...n.daily.map(a=>a.saved_chars)),r=["overview","structure","commands","conventions"].filter(a=>!n.onboarding.includes(a));return e("div",{class:"page",children:[e("div",{class:"grid",children:s.map(([a,o,l])=>e("div",{class:"card",children:[e("h3",{children:a}),e("div",{class:"big",children:o}),e("div",{class:"sub",children:l})]}))}),e("div",{class:"grid wide",children:[e("div",{class:"card",children:[e("h3",{children:["tokens saved per day",e("span",{class:"right",children:n.daily.length?`${n.daily[0]?.day} \u2192 ${n.daily[n.daily.length-1]?.day}`:""})]}),e("div",{class:"bars",children:n.daily.length?n.daily.map(a=>e("div",{title:`${a.day}: ${K(Math.ceil(a.saved_chars/4))} tokens, ${a.calls} calls`,style:{height:`${Math.max(2,100*a.saved_chars/i)}%`}})):e("div",{class:"muted",children:"no data yet"})})]}),e("div",{class:"card",children:[e("h3",{children:"system"}),e(Me,{rows:[["project",n.project],["database",n.dbPath],["routing",n.routing],["embeddings",n.index.embeddings],["memories dir",n.memoriesDir],["onboarding",r.length?e("span",{class:"warn",children:["missing: ",r.join(", ")," \u2014 run /eminiar:em-onboard"]}):e("span",{class:"ok",children:"complete"})],["session",n.session.id]]})]})]}),e("div",{class:"grid two",children:[e("div",{class:"card",children:[e("h3",{children:"this session \xB7 by tool"}),e(bi,{rows:n.session.tools})]}),e("div",{class:"card",children:[e("h3",{children:"lifetime \xB7 by tool"}),e(bi,{rows:n.lifetime.tools})]})]}),e("div",{class:"grid",children:[e("div",{class:"card",children:[e("h3",{children:"index by source"}),e("table",{children:e("tbody",{children:Object.entries(n.index.bySource).filter(([,a])=>a).map(([a,o])=>e("tr",{children:[e("td",{children:a}),e("td",{class:"num",children:o})]}))})})]}),e("div",{class:"card",children:[e("h3",{children:"graph by edge kind"}),e("table",{children:e("tbody",{children:Object.entries(n.index.graph.byKind??{}).sort((a,o)=>o[1]-a[1]).map(([a,o])=>e("tr",{children:[e("td",{children:a}),e("td",{class:"num",children:o})]}))})})]}),e("div",{class:"card",style:{gridColumn:"span 2"},children:[e("h3",{children:["recent sessions"," ",e("a",{class:"right",onClick:()=>j("sessions"),children:"all \u2192"})]}),e("table",{children:[e("thead",{children:e("tr",{children:[e("th",{children:"started"}),e("th",{children:"session"}),e("th",{children:"last prompt"}),e("th",{class:"num",children:"calls"}),e("th",{class:"num",children:"saved"})]})}),e("tbody",{children:n.sessions.map(a=>e("tr",{children:[e("td",{class:"muted",children:[ne(a.started_at)," ",a.current?e(I,{children:"current"}):null]}),e("td",{children:e("code",{children:a.id.slice(0,8)})}),e("td",{class:"muted",children:(a.last_prompt??"").slice(0,90)}),e("td",{class:"num",children:a.calls}),e("td",{class:"num",children:K(a.savedTokens)})]}))})]})]})]})]})}function vi(){let t=z(()=>P("/api/sessions",{limit:60}),[]),[n,s]=A(null),[i,r]=A(""),[a,o]=A(100);O(()=>{!n&&t.data?.[0]&&s(t.data[0].id)},[t.data]);let l=z(()=>n?P("/api/events",{session:n,category:i||void 0,limit:a}):Promise.resolve([]),[n,i,a]),d=[...new Set((l.data??[]).map(c=>c.category))].sort();return t.error?e("div",{class:"page",children:e(q,{error:t.error})}):e("div",{class:"page",children:e("div",{class:"grid wide",style:{gridTemplateColumns:"minmax(280px,1fr) minmax(0,2fr)",alignItems:"start"},children:[e("div",{class:"card flush",children:e("div",{class:"list",children:t.data?t.data.length?t.data.map(c=>e("div",{class:M("item",n===c.id&&"sel"),onClick:()=>s(c.id),children:[e("div",{class:"n",children:[e("code",{children:c.id.slice(0,8)})," ",c.current?e(I,{children:"current"}):null,e("span",{class:"muted",style:{float:"right",fontWeight:400},children:ne(c.started_at)})]}),e("div",{class:"p",children:(c.last_prompt??"(no prompt yet)").slice(0,100)}),e("div",{class:"p",children:[c.calls," calls \xB7 ",K(c.savedTokens)," saved \xB7 ",Je(c.efficiency),c.source?` \xB7 ${c.source}`:""]})]})):e(G,{children:"no sessions yet"}):e(G,{children:e(B,{})})})}),e("div",{class:"card",children:[e("h3",{children:["events \xB7 ",n?n.slice(0,8):"all"," \xB7 ",l.data?.length??0]}),e("div",{class:"row",style:{marginBottom:8},children:[e("select",{value:i,onChange:c=>r(c.target.value),children:[e("option",{value:"",children:"all categories"}),d.map(c=>e("option",{value:c,children:c}))]}),e("label",{class:"muted small",children:["limit"," ",e("select",{value:String(a),onChange:c=>o(Number(c.target.value)),children:[100,300,1e3].map(c=>e("option",{value:String(c),children:c}))})]})]}),l.error?e(q,{error:l.error}):e("table",{children:[e("thead",{children:e("tr",{children:[e("th",{children:"time"}),e("th",{children:"category"}),e("th",{children:"tool"}),e("th",{children:"payload"})]})}),e("tbody",{children:(l.data??[]).length?(l.data??[]).map(c=>e("tr",{children:[e("td",{class:"muted nowrap",title:new Date(c.ts).toLocaleString(),children:Cs(c.ts)}),e("td",{class:"nowrap",children:[e(I,{children:["P",c.priority]}),c.category]}),e("td",{children:c.tool??""}),e("td",{children:e("pre",{class:"json",children:JSON.stringify(c.payload).slice(0,400)})})]})):e("tr",{children:e("td",{colSpan:4,class:"muted",children:"no events"})})})]})]})]})})}function Yo(){let[t,n]=A(!1),s=z(()=>P("/api/doctor",{fix:t?1:void 0}),[t]),i=(s.data??[]).filter(r=>!r.ok).length;return e(L,{children:[e("div",{class:"row",style:{marginBottom:10},children:[e("button",{type:"button",class:"primary",onClick:()=>s.reload(),children:"Re-run"}),e("button",{type:"button",onClick:()=>{n(!0),s.reload()},children:"Run with --fix"}),e("span",{class:"muted small",children:s.loading?e(B,{}):s.data?i?e("span",{class:"bad",children:[i," problem",i>1?"s":""]}):e("span",{class:"ok",children:"all checks pass"}):""})]}),s.error?e(q,{error:s.error}):e("div",{class:"card flush",children:e("table",{children:e("tbody",{children:(s.data??[]).map(r=>e("tr",{children:[e("td",{class:M(r.ok?"ok":"bad"),style:{width:24},children:r.ok?"\u2713":"\u2717"}),e("td",{class:"nowrap",children:r.name}),e("td",{class:"break",children:r.detail})]}))})})})]})}function Qo({onChanged:t}){let[n,s]=A([]),[i,r]=A(null),[a,o]=A("all"),[l,d]=A(!1),[c,u]=A(""),[h,g]=A(""),[f,x]=A("index"),[m,p]=A(""),v=z(()=>P("/api/stats"),[]),b=async(k,S)=>{r(k);let $=new Date().toLocaleTimeString();s(_=>[..._,`[${$}] ${k} \u2026`]);try{let _=await be("/api/actions",S);s(E=>[...E,`${_.ok?"\u2713":"\u2717"} ${k} (${_.ms} ms)
|
|
81
81
|
${_.output}`]),_.ok?J(`${k} done`):J(_.output.split(`
|
|
82
|
-
`)[0]??"failed",!0),t()}catch(_){s(E=>[...E,`\u2717 ${k} failed: ${_.message}`]),J(_.message,!0)}finally{r(null)}},
|
|
82
|
+
`)[0]??"failed",!0),t()}catch(_){s(E=>[...E,`\u2717 ${k} failed: ${_.message}`]),J(_.message,!0)}finally{r(null)}},y=({label:k,body:S,cls:$})=>e("button",{type:"button",class:$??"primary",disabled:!!i,onClick:()=>b(k,S),children:i===k?e(B,{}):k});return e(L,{children:[e("div",{class:"actions",children:[e("div",{class:"card",children:[e("h3",{children:"reindex"}),e("p",{children:"Rebuild the code graph, git signals, metrics, docs, memories or embeddings. Incremental unless full."}),e("div",{class:"row",children:[e("select",{value:a,onChange:k=>o(k.target.value),children:["all","code","git","metrics","docs","memories","embeddings"].map(k=>e("option",{value:k,children:k}))}),e("label",{class:"small",children:[e("input",{type:"checkbox",checked:l,onChange:k=>d(k.target.checked)})," ","full"]}),e(y,{label:`reindex ${a}`,body:{action:"reindex",scope:a,full:l}})]})]}),e("div",{class:"card",children:[e("h3",{children:"index a path"}),e("p",{children:"Index files or a directory into search (markdown by default; pass globs for other files)."}),e("div",{class:"row",children:[e("input",{type:"text",class:"grow",placeholder:"docs/ or README.md",value:c,onInput:k=>u(k.target.value)}),e("input",{type:"text",placeholder:"globs, comma separated",style:{maxWidth:200},value:h,onInput:k=>g(k.target.value)}),e("button",{type:"button",class:"primary",disabled:!!i||!c.trim(),onClick:()=>b("index",{action:"index",path:c,glob:h}),children:"Index"})]})]}),e("div",{class:"card",children:[e("h3",{children:"embeddings"}),e("p",{children:["Embed every chunk that still has no vector. Loads the model on first use."," ",v.data?e("span",{class:"muted",children:["(",v.data.index.embeddings,")"]}):null]}),e("div",{class:"row",children:e(y,{label:"embed pending",body:{action:"embed"}})})]}),e("div",{class:"card",children:[e("h3",{children:"memories"}),e("p",{children:["Re-import memory files edited, added or removed by hand under"," ",e("code",{children:v.data?.memoriesDir??".eminiar/memories"}),"."]}),e("div",{class:"row",children:e(y,{label:"reconcile",body:{action:"reconcile"}})})]}),e("div",{class:"card",children:[e("h3",{children:"purge"}),e("p",{children:"Permanently delete project data. Memory files stay on disk and are re-imported."}),e("div",{class:"row",children:[e("select",{value:f,onChange:k=>x(k.target.value),children:["index","sessions","graph","memories","all"].map(k=>e("option",{value:k,children:k}))}),e("input",{type:"text",placeholder:'type "purge" to confirm',style:{maxWidth:180},value:m,onInput:k=>p(k.target.value)}),e("button",{type:"button",class:"danger",disabled:!!i||m.trim()!=="purge",onClick:()=>{p(""),b(`purge ${f}`,{action:"purge",scope:f,confirm:!0})},children:"Purge"}),e(y,{label:"empty fetch cache",body:{action:"purge-fetch-cache"},cls:""})]})]}),e("div",{class:"card",children:[e("h3",{children:"server"}),v.data?e(Me,{rows:[["project",v.data.project],["database",v.data.dbPath],["routing",v.data.routing]]}):e(B,{})]})]}),e("div",{class:"card",children:[e("h3",{children:["action log"," ",e("button",{type:"button",class:"sm right",onClick:()=>s([]),children:"clear"})]}),e("pre",{class:"log",children:n.length?n.join(`
|
|
83
83
|
|
|
84
|
-
`):"ready."})]})]})}function el(){let t=
|
|
84
|
+
`):"ready."})]})]})}function el(){let t=z(()=>P("/api/runs"),[]);return t.error?e(q,{error:t.error}):t.data?e("div",{class:"card flush",children:e("table",{children:[e("thead",{children:e("tr",{children:[e("th",{children:"started"}),e("th",{children:"scope"}),e("th",{class:"num",children:"scanned"}),e("th",{class:"num",children:"indexed"}),e("th",{class:"num",children:"unchanged"}),e("th",{class:"num",children:"skipped"}),e("th",{class:"num",children:"removed"}),e("th",{class:"num",children:"errors"}),e("th",{class:"num",children:"ms"}),e("th",{children:"git"}),e("th",{children:"detail"})]})}),e("tbody",{children:t.data.length?t.data.map(n=>e("tr",{children:[e("td",{class:"muted nowrap",title:new Date(n.started_at).toLocaleString(),children:ne(n.started_at)}),e("td",{children:n.scope}),e("td",{class:"num",children:n.scanned}),e("td",{class:"num",children:n.indexed}),e("td",{class:"num",children:n.unchanged}),e("td",{class:"num",children:n.skipped}),e("td",{class:"num",children:n.removed}),e("td",{class:M("num",n.errors>0&&"bad"),children:n.errors}),e("td",{class:"num",children:n.finished_at?n.finished_at-n.started_at:"\u2026"}),e("td",{class:"muted small",children:n.head_sha?.slice(0,7)??""}),e("td",{class:"muted small break",children:n.detail??""})]})):e("tr",{children:e("td",{colSpan:11,class:"muted",children:"no runs logged yet"})})})]})}):e(B,{})}function ki({onChanged:t}){let[n,s]=A("actions");return e("div",{class:"page",children:[e(Te,{tabs:[["actions","Actions"],["doctor","Doctor"],["runs","Index runs"]],value:n,onChange:s}),n==="actions"&&e(Qo,{onChanged:t}),n==="doctor"&&e(Yo,{}),n==="runs"&&e(el,{})]})}var tl=[["overview","Overview"],["explore","Explore"],["galaxy","Galaxy"],["architecture","Architecture"],["history","History"],["memory","Memory"],["docs","Docs"],["coverage","Coverage"],["sessions","Sessions"],["system","System"]],nl=new Set(["explore","galaxy"]);function sl(){try{let t=localStorage.getItem("eminiar.theme");return t==="light"||t==="dark"?t:"auto"}catch{return"auto"}}function rl(t){t==="auto"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",t);try{t==="auto"?localStorage.removeItem("eminiar.theme"):localStorage.setItem("eminiar.theme",t)}catch{}}function xi(){let t=Ps(),[n,s]=A(sl),[i,r]=A(0),[a,o]=A(mn),l=f=>{As(f),o(f)},d=z(()=>P("/api/projects"),[i]),c=z(()=>P("/api/status"),[t.view,i,a]);O(()=>{d.data&&!mn()&&l(d.data.current)},[d.data]),O(()=>{let f=setInterval(()=>r(x=>x+1),45e3);return()=>clearInterval(f)},[]);let u=[...new Set([d.data?.current,...d.data?.projects.map(f=>f.root)??[]].filter(Boolean))],h=c.data,g=t.view;return e(L,{children:[e("header",{class:"top",children:[e("div",{class:"brand",children:[e("span",{children:"em"}),"iniar",e("small",{children:h?.version?`v${h.version}`:""})]}),e("nav",{class:"tabs",children:tl.map(([f,x])=>e("button",{type:"button",class:M(g===f&&"active"),onClick:()=>j(f),children:x}))}),e("span",{class:"spacer"}),e("span",{class:"small nowrap",title:h?`${h.graph.nodes} nodes \xB7 ${h.freshness.dirty.length} changed \xB7 ${h.freshness.queued} queued`:"",children:[e("i",{class:M("dot",h?.state)}),h?h.state==="empty"?"no graph":h.state==="stale"?"index stale":"index fresh":"\u2026"]}),e("button",{type:"button",class:"ghost sm",title:"theme",onClick:()=>{let f=n==="auto"?"dark":n==="dark"?"light":"auto";s(f),rl(f)},children:n==="auto"?"\u25D0 auto":n==="dark"?"\u25CF dark":"\u25CB light"}),e("select",{class:"project",title:a,value:a,onChange:f=>{l(f.target.value),r(x=>x+1)},children:u.map(f=>e("option",{value:f,children:f.split("/").slice(-2).join("/")}))})]}),e("main",{class:M("work",nl.has(g)&&"fill"),children:[g==="overview"&&e(yi,{}),g==="explore"&&e(Fr,{params:t.params}),g==="galaxy"&&e(Mr,{params:t.params}),g==="architecture"&&e(yr,{params:t.params}),g==="history"&&e(Ur,{params:t.params}),g==="memory"&&e(fi,{params:t.params}),g==="docs"&&e(Er,{params:t.params}),g==="coverage"&&e(vr,{}),g==="sessions"&&e(vi,{}),g==="system"&&e(ki,{onChanged:()=>r(f=>f+1)})]},a),e("footer",{class:"status",children:[e("span",{children:["server ",e("b",{class:"ok",children:"ready"})]}),h&&e(L,{children:[e("span",{children:[e("b",{children:h.graph.nodes})," nodes \xB7 ",e("b",{children:h.graph.edges})," edges"]}),e("span",{children:["files: ",e("b",{children:h.files.byStatus.indexed??0})," indexed",h.files.byStatus.partial?` \xB7 ${h.files.byStatus.partial} partial`:"",h.files.byStatus.skipped?` \xB7 ${h.files.byStatus.skipped} skipped`:""]}),e("span",{children:["git ",h.freshness.head?.slice(0,7)??"n/a",h.freshness.indexedHead&&h.freshness.indexedHead!==h.freshness.head?` (signals at ${h.freshness.indexedHead.slice(0,7)})`:""]}),e("span",{children:["last index ",h.freshness.lastRun?ne(h.freshness.lastRun):"never"]})]}),e("span",{class:"spacer"}),e("span",{class:"ellipsis",children:a})]}),e(Is,{})]})}var _i=document.getElementById("app");_i&&gs(e(xi,{}),_i);})();
|
|
85
85
|
/*! Bundled license information:
|
|
86
86
|
|
|
87
87
|
prismjs/prism.js:
|