diff --git a/scripts/engine.browser.d.mts b/scripts/engine.browser.d.mts index 8f5068a..a1dcc32 100644 --- a/scripts/engine.browser.d.mts +++ b/scripts/engine.browser.d.mts @@ -1,6 +1,6 @@ declare const ENGINE_VERSION = "2.31.8"; declare const SCHEMA_VERSION = 5; -declare const EXTRACTOR_VERSION = 17; +declare const EXTRACTOR_VERSION = 18; type FileKind = "code" | "doc" | "config" | "asset" | "other"; type EdgeKind = "contains" | "doc-link" | "import" | "call" | "extends" | "implements" | "use" | "mention"; type Tier = 0 | 1 | 2; diff --git a/scripts/engine.browser.mjs b/scripts/engine.browser.mjs index ba5636a..0ec7890 100644 --- a/scripts/engine.browser.mjs +++ b/scripts/engine.browser.mjs @@ -1,31 +1,31 @@ -var Xb=Object.defineProperty;var H=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var Rc=(e,t)=>{for(var n in t)Xb(e,n,{get:t[n],enumerable:!0})};function um(e){let t="";for(let r=0;r{"use strict";Zb=new TextDecoder("utf-8"),Yb=new TextDecoder("utf-16le"),cm=new TextEncoder,dm="0123456789abcdef";W=class e extends Uint8Array{static from(t,n){if(typeof t=="string"){if(n==="hex"){let l=new e(t.length>>1);for(let c=0;ca+l.byteLength,0),o=new e(r),s=0;for(let a of t){if(s+a.byteLength>r){o.set(a.subarray(0,r-s),s);break}o.set(a,s),s+=a.byteLength}return o}subarray(t,n){return super.subarray(t,n)}toString(t,n,r){let o=n!==void 0||r!==void 0?this.subarray(n??0,r??this.length):this;switch((t??"utf8").toLowerCase()){case"utf8":case"utf-8":return Zb.decode(o);case"utf16le":case"utf-16le":case"ucs2":case"ucs-2":return Yb.decode(o);case"latin1":case"binary":case"ascii":return um(o);case"hex":{let s="";for(let a of o)s+=dm[a>>4]+dm[a&15];return s}case"base64":return btoa(um(o));default:throw new TypeError(`Unknown encoding: ${t}`)}}swap16(){if(this.length%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t"/",exit:e=>{throw new Error(`process.exit(${e??0}) is not available in the browser build`)},hrtime:Object.assign(e=>{let t=performance.now(),n=Math.floor(t/1e3),r=Math.floor(t%1e3*1e6);return e?[n-e[0],r-e[1]]:[n,r]},{bigint:()=>BigInt(Math.floor(performance.now()*1e6))}),memoryUsage:()=>({rss:0,heapTotal:0,heapUsed:0,external:0,arrayBuffers:0}),stdout:{write:e=>(console.log(e.replace(/\n$/,"")),!0),isTTY:!1},stderr:{write:e=>(console.warn(e.replace(/\n$/,"")),!0),isTTY:!1},on:()=>F,emitWarning:e=>console.warn(e)}});var Ie,ut,fn,bt=H(()=>{"use strict";$();Ie="2.31.8",ut=5,fn=17});function fm(e,t){let n="",r=0,o=-1,s=0,a=0;for(let l=0;l<=e.length;++l){if(l2){let c=n.lastIndexOf("/");c===-1?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),o=l,s=0;continue}else if(n.length!==0){n="",r=0,o=l,s=0;continue}}t&&(n+=n.length>0?"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,l):n=e.slice(o+1,l),r=l-o-1;o=l,s=0}else a===46&&s!==-1?++s:s=-1}return n}function Jo(e){if(e.length===0)return".";let t=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47,r=fm(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&n&&(r+="/"),t?"/"+r:r}function Pe(e){return e.length>0&&e.charCodeAt(0)===47}function j(...e){if(e.length===0)return".";let t;for(let n of e)n.length>0&&(t=t===void 0?n:t+"/"+n);return t===void 0?".":Jo(t)}function le(...e){let t="",n=!1;for(let o=e.length-1;o>=0&&!n;o--){let s=e[o];s===void 0||s.length===0||(t=t.length===0?s:s+"/"+t,n=s.charCodeAt(0)===47)}n||(t=t.length===0?"/":"/"+t);let r=fm(t,!1);return r.length>0?"/"+r:"/"}function je(e,t){if(e===t)return"";let n=le(e),r=le(t);if(n===r)return"";let o=n.slice(1).split("/").filter(Boolean),s=r.slice(1).split("/").filter(Boolean),a=0;for(;a=1;--o)if(e.charCodeAt(o)===47){if(!r){n=o;break}}else r=!1;return n===-1?t?"/":".":t&&n===1?"//":e.slice(0,n)}function We(e,t){let n=0,r=-1,o=!0;for(let a=e.length-1;a>=0;--a)if(e.charCodeAt(a)===47){if(!o){n=a+1;break}}else r===-1&&(o=!1,r=a+1);if(r===-1)return"";let s=e.slice(n,r);return t!==void 0&&t!==s&&s.endsWith(t)?s.slice(0,s.length-t.length):s}function mn(e){let t=-1,n=0,r=-1,o=!0,s=0;for(let a=e.length-1;a>=0;--a){let l=e.charCodeAt(a);if(l===47){if(!o){n=a+1;break}continue}r===-1&&(o=!1,r=a+1),l===46?t===-1?t=a:s!==1&&(s=1):t!==-1&&(s=-1)}return t===-1||r===-1||s===0||s===1&&t===r-1&&t===n+1?"":e.slice(t,r)}function Qb(e){let t=Pe(e)?"/":"",n=We(e),r=mn(e),o=Ce(e);return{root:t,dir:o==="."&&t===""?"":o,base:n,ext:r,name:n.slice(0,n.length-r.length)}}function ew(e){let t=e.dir||e.root||"",n=e.base||(e.name??"")+(e.ext??"");return t?t===e.root?t+n:t+"/"+n:n}function tw(e){return e}var J,U$,me=H(()=>{"use strict";$();J={sep:"/",delimiter:":",normalize:Jo,isAbsolute:Pe,join:j,resolve:le,relative:je,dirname:Ce,basename:We,extname:mn,parse:Qb,format:ew,toNamespacedPath:tw},U$={...J,posix:J,win32:J}});function pm(){return++mm}function Mt(e){let t=e.startsWith("/")?e:"/"+e,n=Jo(t);return n.length>1&&n.endsWith("/")?n.slice(0,-1):n}function Gn(e,t){let n=new Error(`ENOENT: no such file or directory, ${t} '${e}'`);return n.code="ENOENT",n.errno=-2,n.path=e,n.syscall=t,n}function gm(e,t){let n=new Error(`ENOTDIR: not a directory, ${t} '${e}'`);return n.code="ENOTDIR",n.errno=-20,n.path=e,n.syscall=t,n}function ds(e){let t=Mt(e),n=He.get(t);if(n){if(n.kind!=="dir")throw gm(e,"mkdir");return n}let r={kind:"dir",mtimeMs:0,mode:511,children:new Set};return He.set(t,r),t!==br&&ds(Ce(t)).children.add(We(t)),r}function nw(){He.clear(),mm=0,ym=0,He.set(br,{kind:"dir",mtimeMs:0,mode:511,children:new Set})}function hm(e){for(let t of e){let n=Mt(t.path);ds(Ce(n)).children.add(We(n)),He.set(n,{kind:"file",size:t.size,mtimeMs:pm(),mode:438,bytes:t.bytes})}}function Ko(e,t){let n=Mt(e),r=He.get(n);if(r&&r.kind==="file"){r.bytes=t,r.size=t.byteLength,r.mtimeMs=pm();return}hm([{path:n,size:t.byteLength,bytes:t}])}function rw(e){let t=He.get(Mt(e));return!!t&&t.kind==="file"&&t.bytes!==void 0}function sw(){let e=0;for(let[t,n]of[...He]){if(n.kind!=="file"||n.bytes!==void 0)continue;He.delete(t);let r=He.get(Ce(t));r&&r.kind==="dir"&&r.children.delete(We(t)),e++}return e}function iw(){let e=0;for(let t of He.values())t.kind==="file"&&t.bytes&&(e+=t.bytes.byteLength);return e}function ow(e,t,n){return{name:e,parentPath:t,path:t,isFile:()=>n==="file",isDirectory:()=>n==="dir",isSymbolicLink:pn,isBlockDevice:pn,isCharacterDevice:pn,isFIFO:pn,isSocket:pn}}function aw(e){return{size:e.kind==="file"?e.size:0,mode:e.mode,mtimeMs:e.mtimeMs,mtime:new Date(e.mtimeMs),isFile:()=>e.kind==="file",isDirectory:()=>e.kind==="dir",isSymbolicLink:pn,isBlockDevice:pn,isCharacterDevice:pn,isFIFO:pn,isSocket:pn}}function Q(e){return He.has(Mt(e))}function Me(e){let t=He.get(Mt(e));if(!t)throw Gn(e,"stat");return aw(t)}function rt(e){let t=Mt(e);if(!He.has(t))throw Gn(e,"realpath");return t}function Vn(e,t){let n=Mt(e),r=He.get(n);if(!r)throw Gn(e,"scandir");if(r.kind!=="dir")throw gm(e,"scandir");let o=[...r.children];return t?.withFileTypes?o.map(s=>{let a=He.get(n===br?`/${s}`:`${n}/${s}`);return ow(s,n,a?.kind==="dir"?"dir":"file")}):o}function ie(e,t){let n=He.get(Mt(e));if(!n)throw Gn(e,"open");if(n.kind!=="file"){let o=new Error("EISDIR: illegal operation on a directory, read");throw o.code="EISDIR",o}if(!n.bytes)throw Gn(e,"open");let r=W.from(n.bytes);return t?r.toString(typeof t=="string"?t:t.encoding):r}function it(e,t){let n=typeof t=="string"?new TextEncoder().encode(t):t;Ko(e,n)}function Xo(e,t){let n=He.get(Mt(e));if(!n)throw Gn(e,"chmod");n.mode=t}function Yt(e,t){ds(e)}function wr(e){let t=`${e}${ym++}`;return ds(t),t}function Ke(e,t){let n=Mt(e),r=He.get(n);if(!r){if(t?.force)return;throw Gn(e,"unlink")}if(r.kind==="dir"){if(!t?.recursive)throw Object.assign(new Error(`Path is a directory: rm returned EISDIR (is a directory) ${e}`),{code:"ERR_FS_EISDIR"});for(let s of[...r.children])Ke(n===br?`/${s}`:`${n}/${s}`,t)}He.delete(n);let o=He.get(Ce(n));o&&o.kind==="dir"&&o.children.delete(We(n))}function Rn(e,t){let n=Mt(e),r=He.get(n);if(!r)throw Gn(e,"rename");let o=Mt(t);if(o!==n){if(r.kind==="dir"){ds(o);for(let s of[...r.children])Rn(n===br?`/${s}`:`${n}/${s}`,o===br?`/${s}`:`${o}/${s}`)}else ds(Ce(o)).children.add(We(o)),He.set(o,r);Ke(n,{recursive:!0,force:!0})}}function Zo(){throw new Error("recursive filesystem watching is unavailable in the browser VFS")}var br,He,mm,pn,qn,ym,ke=H(()=>{"use strict";$();me();br="/",He=new Map([[br,{kind:"dir",mtimeMs:0,mode:511,children:new Set}]]),mm=0;pn=()=>!1;qn=Me;ym=0});function Yo(e,t,n){let r=new Error(`spawnSync ${e} ENOENT`);return r.code="ENOENT",r.errno=-2,r.syscall=`spawnSync ${e}`,r.path=e,{pid:0,output:[],stdout:"",stderr:"",status:null,signal:null,error:r}}function _m(e,t,n){let r=new Map,o={pid:void 0,stdin:null,stdout:null,stderr:null,on(a,l){let c=r.get(a)??[];return c.push(l),r.set(a,c),o},kill:()=>!1},s=new Error(`spawn ${e} ENOENT`);return s.code="ENOENT",s.syscall=`spawn ${e}`,s.path=e,Promise.resolve().then(()=>{for(let a of r.get("error")??[])a(s);for(let a of r.get("close")??[])a(null)}),o}var Qo=H(()=>{$()});function $e(e,t,n={}){let r=n.env??F.env,o=Yo(e,t,{cwd:n.cwd,input:n.input,encoding:"utf8",timeout:n.timeoutMs??12e4,maxBuffer:n.maxBufferBytes??64*1024*1024,env:e==="git"?{...r,...Cc}:r}),s=o.error?o.error.code:void 0;return{ok:!o.error&&o.status===0,status:o.status,stdout:o.stdout??"",stderr:o.stderr??(o.error?String(o.error.message):""),missing:s==="ENOENT",...s?{errorCode:s}:{}}}function Qt(e){let t=bm.get(e);if(t!==void 0)return t;let n=$e(F.platform==="win32"?"where":"which",[e]),r=n.ok&&n.stdout.trim().length>0;return bm.set(e,r),r}function si(e){return e.toLowerCase().replace(/^https?:\/\//,"").replace(/^git@/,"").replace(/\.git$/,"").replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,120)}function lw(e,t){return e.length<=t?e:e.slice(0,t)+` -\u2026 [truncated ${e.length-t} chars]`}function cw(e,t){let n=e.replace(/\s+/g," ").trim();if(n.length<=t)return n;let r=n.slice(0,t).replace(/\s+\S*$/,"");return r||(r=n.slice(0,t)),(r.match(/`/g)?.length??0)%2===1&&(r=r.replace(/`[^`]*$/,"")),r.lastIndexOf("[")>r.lastIndexOf("]")&&(r=r.slice(0,r.lastIndexOf("["))),r.replace(/\s+$/,"")+"\u2026"}function wt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Jn(e){return xm.test(e)?e.normalize("NFKD").replace(/[̀-ͯ]/g,""):e}function us(e,t){let n=new Set,r=[];for(let o of Jn(e).split(Sm)){if(!o)continue;let s=o.toLowerCase();o.length<2||wm.has(s)&&!t?.(o)||n.has(s)||(n.add(s),r.push(o))}return r}function ii(e,t){let n=[];for(let r of Jn(e).split(Sm))r&&(r.length<2||wm.has(r.toLowerCase())&&!t?.(r))&&n.push(r);return n}function dw(e){let t=us(e),n=r=>{let o=0;return/\d/.test(r)&&(o+=3),/[A-Z]/.test(r)&&!/^[A-Z0-9]+$/.test(r)&&(o+=2),/_/.test(r)&&(o+=2),r.length>=8?o+=1.5:r.length>=5&&(o+=.5),o};return t.map((r,o)=>({k:r,s:n(r),i:o})).sort((r,o)=>o.s-r.s||r.i-o.i).map(r=>r.k)}function Mc(e,t,n=60){let r=new Map;for(let o of e)o.forEach((s,a)=>{let l=t(s);r.set(l,(r.get(l)??0)+1/(n+a+1))});return r}function gn(e){let t=!xm.test(e),n=t?e:Jn(e),r=t?n.replace(uw,"$1 $2").replace(fw,"$1 $2"):n.replace(gw,"$1 $2").replace(hw,"$1 $2"),o=[],s=new Set,a=l=>{l.length<2||s.has(l)||(s.add(l),o.push(l))};/\s/.test(e.trim())||a(n.toLowerCase().replace(t?mw:yw,""));for(let l of r.split(t?pw:_w))a(l.toLowerCase());return o}function ea(e){if(e.length<4)return e;let t=e;return t.endsWith("ies")&&t.length>4?t=t.slice(0,-3)+"y":t.endsWith("sses")?t=t.slice(0,-2):(t.endsWith("ses")&&t.length>4||t.endsWith("s")&&!t.endsWith("ss")&&!t.endsWith("us")&&!t.endsWith("is"))&&(t=t.slice(0,-1)),t.endsWith("ying")&&t.length>5?t=t.slice(0,-4)+"y":t.endsWith("ing")&&t.length>5?t=t.slice(0,-3):t.endsWith("ed")&&t.length>4&&(t=t.slice(0,-2)),t.endsWith("e")&&t.length>3&&(t=t.slice(0,-1)),t}var Cc,bm,wm,xm,Sm,uw,fw,mw,pw,gw,hw,yw,_w,et=H(()=>{"use strict";$();Qo();Cc={LC_ALL:"C",LANGUAGE:""};bm=new Map;wm=new Set(["the","a","an","is","are","was","were","be","been","being","do","does","did","how","what","why","when","where","which","who","whom","this","that","these","those","of","in","on","to","for","with","and","or","but","if","then","else","than","as","at","by","from","into","about","it","its","i","you","we","they","he","she","there","here","can","could","should","would","will","shall","may","might","must","have","has","had","not","no","yes","so","such","only","any","some","all","get","set","use","used","using","work","works","working","handle","handled","happen","happens","default","value","values","please","explain","tell","me","my","our"]),xm=/[^\x00-\x7F]/;Sm=/[^\p{L}\p{N}_]+/u;uw=/([a-z0-9])([A-Z])/g,fw=/([A-Z]+)([A-Z][a-z])/g,mw=/[^a-z0-9_]+/g,pw=/[^A-Za-z0-9]+/,gw=/([\p{Ll}\p{N}])(\p{Lu})/gu,hw=/(\p{Lu}+)(\p{Lu}\p{Ll})/gu,yw=/[^\p{L}\p{N}_]+/gu,_w=/[^\p{L}\p{N}]+/u});function bw(e){let t="";for(let n=0;n=e.length))return s?{source:"(?!)",end:n}:{source:r?`[^/${o}]`:`(?!/)[${o}]`,end:n}}function km(e){return e==="\\"||e==="]"||e==="^"||e==="["||e==="-"?"\\"+e:e}function ms(e,t,n){let r=[],o=t?wt(t)+"/":"",s=e.split(/\r?\n/);for(let a=0;af===u:f=>f.startsWith(u)&&o.test(f)}let{head:s,whole:a}=Ac(e);if(a)return(c,d)=>d===s&&c.startsWith(r);if(e[0]==="*"&&e[1]!=="*"){let c=Ac(e.slice(1));if(c.whole)return(d,u)=>u.endsWith(c.head)&&d.startsWith(r)}let l=new RegExp(`^${t}$`);return(c,d)=>c.startsWith(r)&&l.test(d)}function oi(e,t,n){let r=ta(e,t,n);return r!==void 0&&!r.negated}function ta(e,t,n){let r=t.slice(t.lastIndexOf("/")+1);for(let o=e.length-1;o>=0;o--){let s=e[o];if(!(s.dirOnly&&!n)&&(s.test?s.test(t,r):s.re.test(t)))return s}}var ww,Ic=H(()=>{"use strict";$();et();ww={alnum:"A-Za-z0-9",alpha:"A-Za-z",blank:" \\t",cntrl:"\\x00-\\x1f\\x7f",digit:"0-9",graph:"\\x21-\\x7e",lower:"a-z",print:"\\x20-\\x7e",punct:"!-\\/:-@\\[-`{-~",space:" \\t\\n\\r\\f\\v",upper:"A-Z",xdigit:"0-9A-Fa-f"}});function ps(e){let t;try{t=ie(e)}catch{return kw}let n=t.length,r={buf:t,bytes:n,ok:!0,binary:!1};if(n>=2&&t[0]===255&&t[1]===254){let s=t.subarray(2,2+(n-2&-2)).toString("utf16le");return{...r,text:s,encoding:"utf16le",byteAddressable:!1,bodyStart:2}}if(n>=2&&t[0]===254&&t[1]===255){let s=W.from(t.subarray(2,2+(n-2&-2)));return s.swap16(),{...r,text:s.toString("utf16le"),encoding:"utf16be",byteAddressable:!1,bodyStart:2}}if(n>=3&&t[0]===239&&t[1]===187&&t[2]===191)return{...r,text:t.subarray(3).toString("utf8"),encoding:"utf8-bom",byteAddressable:!0,bodyStart:3};if(t.includes(0))return{...r,text:"",encoding:null,binary:!0,byteAddressable:!1,bodyStart:0};let o=t.toString("utf8");return o.includes("\uFFFD")&&!vw(t)?{...r,text:t.toString("latin1"),encoding:"latin1",byteAddressable:!1,bodyStart:0}:{...r,text:o,encoding:"utf8",byteAddressable:!0,bodyStart:0}}function vw(e){try{return Ew.decode(e),!0}catch{return!1}}function Rw(e){let t=new Int32Array(e.length+1),n=0;for(let r=0;r=55296&&o<=56319&&r+1{"use strict";$();ke();kw={text:"",buf:W.alloc(0),encoding:null,binary:!1,bytes:0,ok:!1,byteAddressable:!1,bodyStart:0};Ew=new TextDecoder("utf-8",{fatal:!0});$c=class{constructor(t){this.text=t;this.ascii=!/[^\x00-\x7F]/.test(t),this.table=this.ascii?null:Rw(t),this.lineStarts=Cw(t)}text;ascii;table;lineStarts;byteOf(t){if(this.ascii)return t;let n=this.table;return t<=0?0:t>=n.length?n[n.length-1]:n[t]}lineColOf(t){let n=this.lineStarts,r=0,o=n.length-1;for(;r>1;n[s]<=t?r=s:o=s-1}return{line:r+1,col:t-n[r]+1}}get lineCount(){return this.lineStarts.length}}});function Mw(e){let t=[...Tc].map(o=>`:(glob)**/${o}/**`),n=$e("git",["-C",e,"ls-files","-z","--",...t]);if(!n.ok)return;let r=new Set;for(let o of n.stdout.split("\0")){let s=0;for(let a=o.indexOf("/");a!==-1;a=o.indexOf("/",s))Tc.has(o.slice(s,a))&&r.add(o.slice(0,a)),s=a+1}return r}function Iw(e,t){return e===xr||e===Aw||t.has(e)||e.startsWith(".codeindex-edit-")}function vm(e,t){let n=t.find(o=>o.name===xr);if(!n)return;let r=j(e,xr);try{if(n.isDirectory())return r;let o=Me(r);if(o.isDirectory())return r;if(!o.isFile()||o.size>$w)return;let s=ie(r,"utf8");if(!s.startsWith(Em))return;let a=s.slice(Em.length).replace(/[\r\n]+$/,"");if(!a)return;let l=le(e,a),c=j(l,"commondir");return Q(c)?le(l,ie(c,"utf8").trim()):l}catch{return}}function Rm(e){if(!e)return"";try{let t=j(e,"info","exclude");return Q(t)?re(t):""}catch{return""}}function Tw(e){let t=d=>{if(Q(j(d,xr)))try{return vm(d,Vn(d,{withFileTypes:!0}).filter(u=>u.name===xr))}catch{return}};if(t(e))return[];let n=[],r;for(let d=e,u=Ce(d);u!==d&&(n.push(u),r=t(u),!r);d=u,u=Ce(d));if(!r)return[];let o=n[n.length-1],s=d=>d.split("/").join("/"),a=s(je(o,e))+"/",l=d=>s(je(e,d)),c=ms(Rm(r),"",l(j(r,"info","exclude")));for(let d of n.reverse()){let u=j(d,".gitignore");Q(u)&&c.push(...ms(re(u),s(je(o,d)),l(u)))}return c.map(d=>({...d,test:(u,f)=>d.test?d.test(a+u,f):d.re.test(a+u)}))}function Xe(e,t={}){let n=t.maxFileBytes??1048576,r=t.maxFiles??1/0,o=t.gitignore!==!1,s=t.ignoreDirs?new Set(t.ignoreDirs):Cn,a=!t.ignoreDirs&&t.trackedBuildDirs!==!1,l=null,c=k=>(l===null&&(l=Mw(e)),l?.has(k)??!1),d=(k,R,I)=>Iw(k,s)&&!(a&&Tc.has(k)&&!(o&&I.length&&oi(I,R,!0))&&c(R)),u=[],f=!1,m=0,p=[],g=(k,R,I=!1,P)=>{t.onSkip?.({rel:k,reason:R,directory:I,...P===void 0?{}:{size:P}})},h=(k,R,I,P)=>{if(!t.onSkip)return;let v=ta(R,k,I);t.onSkip({rel:k,reason:"gitignored",directory:I,...P===void 0?{}:{size:P},...v?.source!==void 0?{rule:{source:v.source,line:v.line,pattern:v.pattern}}:{}})},_;try{_=rt(e)}catch{return{files:u,capped:f,excluded:m}}let y=k=>k===_||k.startsWith(_+"/"),b=[{dir:e,rel:"",rules:o?Tw(_):[]}],S=new Set;e:for(;b.length;){let k=b.pop(),R=[],I;try{I=rt(k.dir)}catch{continue}if(S.has(I)||(S.add(I),!y(I)))continue;let P;try{P=Vn(k.dir,{withFileTypes:!0}).sort((M,x)=>M.namex.name?1:0)}catch{continue}let v=P.some(M=>M.name===xr)?vm(k.dir,P):void 0;if(k.rel&&v){m++,g(k.rel,"nested-repo",!0);continue}let C=k.rules;if(o&&!k.rel){let M=ms(Rm(v),"",".git/info/exclude");M.length&&(C=[...C,...M])}if(o&&P.some(M=>M.name===".gitignore")){let M=k.rel?`${k.rel}/.gitignore`:".gitignore",x=ms(re(j(k.dir,".gitignore")),k.rel,M);x.length&&(C=[...C,...x])}for(let M of P){let x=M.name,w=j(k.dir,x),E=k.rel?`${k.rel}/${x}`:x,N=M.isSymbolicLink();if(x===xr)continue;if(M.isDirectory()&&d(x,E,C)){g(E,"ignore-dir",!0);continue}let O;try{O=N?Me(w):qn(w)}catch{g(E,N?"broken-symlink":"unreadable");continue}if(O.isDirectory()){if(d(x,E,C)){g(E,"ignore-dir",!0);continue}if(N){g(E,"directory-symlink",!0);continue}if(o&&C.length&&oi(C,E,!0)){h(E,C,!0);continue}if(t.filter&&!t.filter({rel:E,abs:w,directory:!0})){g(E,"filter",!0);continue}R.push({dir:w,rel:E,rules:C});continue}if(!O.isFile())continue;let L=mn(x).toLowerCase(),G;if(o&&C.length&&oi(C,E,!1)?G="gitignored":t.filter&&!t.filter({rel:E,abs:w,directory:!1})?G="filter":O.size>n&&!t.includeOversize?G="over-max-bytes":na.has(x.toLowerCase())&&!t.includeLockfiles?G="lockfile":(t.binaryExtensions??ra).has(L)&&!t.includeBinary?G="binary-ext":(x.endsWith(".min.js")||x.endsWith(".min.css"))&&!t.includeMinified&&(G="minified"),G){m++,G==="over-max-bytes"&&p.push({rel:E.split("/").join("/"),size:O.size}),G==="gitignored"?h(E,C,!1,O.size):g(E,G,!1,O.size);continue}if(N){try{if(!y(rt(w))){g(E,"symlink-outside-root");continue}}catch{g(E,"broken-symlink");continue}if(!t.includeFileSymlinks){g(E,"file-symlink");continue}}if(u.length>=r){f=!0;break e}u.push({rel:E.split("/").join("/"),abs:w,size:O.size,ext:L,mtimeMs:O.mtimeMs})}for(let M=R.length-1;M>=0;M--)b.push(R[M])}return{files:u,capped:f,excluded:m,...p.length?{oversized:p}:{}}}function re(e){return ps(e).text}var Cn,Tc,xr,Aw,Em,$w,na,ra,Fw,Ze=H(()=>{"use strict";$();ke();me();Ic();ai();et();ai();Cn=new Set([".git","node_modules",".pnpm","bower_components","vendor","dist","build","out","target",".next",".nuxt",".svelte-kit",".turbo","coverage","__pycache__",".venv","venv",".tox",".mypy_cache",".pytest_cache",".gradle",".idea",".vscode",".cache","tmp",".ultraindex",".codeindex","Pods","DerivedData",".terraform","elm-stuff",".dart_tool"]),Tc=new Set(["build","out","target","tmp"]);xr=".git",Aw=".codeindex";Em="gitdir: ",$w=4096;na=new Set(["package-lock.json","npm-shrinkwrap.json","yarn.lock","pnpm-lock.yaml","bun.lockb","composer.lock","cargo.lock","poetry.lock","pipfile.lock","gemfile.lock","go.sum","flake.lock","packages.lock.json","podfile.lock","mix.lock"]),ra=new Set([".png",".jpg",".jpeg",".gif",".webp",".bmp",".ico",".icns",".svg",".pdf",".zip",".gz",".tar",".tgz",".bz2",".xz",".7z",".rar",".jar",".war",".class",".so",".dylib",".dll",".exe",".bin",".o",".a",".wasm",".woff",".woff2",".ttf",".otf",".eot",".mp3",".mp4",".mov",".avi",".webm",".wav",".flac",".ogg",".lock",".min.js",".map"]),Fw=2e4});function T(e,t){return et?1:0}function Sr(e){return(t,n)=>T(e(t),e(n))}var ce=H(()=>{"use strict";$()});function en(e){let t=$e("git",["-C",e,"rev-parse","HEAD"]);return t.ok?t.stdout.trim().slice(0,Ow):void 0}function Nc(e){let t=$e("git",[...xt(e),"hash-object","-t","tree","--stdin"],{input:""});return t.ok?t.stdout.trim():void 0}function Pc(e){return $e("git",["-C",e,"rev-parse","--is-inside-work-tree"]).ok}function Lc(e,t){let n=c=>$e("git",[...xt(e),"rev-parse","--verify","--quiet",`${c}^{commit}`]).ok,r=c=>{let d=$e("git",[...xt(e),"merge-base",c,"HEAD"]);return d.ok?d.stdout.trim():void 0};if(t){if(Oc(t)||!n(t))return{error:`base ref "${t}" not found (tried git rev-parse --verify)`};let c=r(t);return c?{ref:t,mergeBase:c}:{error:`no merge-base between "${t}" and HEAD`}}let o=$e("git",[...xt(e),"symbolic-ref","--quiet","refs/remotes/origin/HEAD"]),s=[...o.ok?[o.stdout.trim().replace("refs/remotes/","")]:[],"origin/main","origin/master","main","master"];for(let c of s){if(!n(c))continue;let d=r(c);if(d)return{ref:c,mergeBase:d}}let a=$e("git",[...xt(e),"rev-parse","--verify","--quiet","HEAD"]);if(a.ok)return{ref:"HEAD",mergeBase:a.stdout.trim(),note:"base: HEAD (no default branch found \u2014 reviewing uncommitted work)"};let l=Nc(e);return l?{ref:sa,mergeBase:l,note:"no commits yet \u2014 every file is reviewed as added"}:{error:"cannot resolve HEAD, nor the empty tree"}}function Dc(e,t){let n=[],r=$e("git",[...xt(e),"diff","--no-color","--relative","-z","-M","--name-status",...Fc(t)]);if(r.ok){let a=r.stdout.split("\0"),l=0;for(;l[a.path,a])),s=$e("git",[...xt(e),"diff","--no-color","--relative","-z","-M","--numstat",...Fc(t)]);if(s.ok){let a=s.stdout.split("\0"),l=0;for(;l0){a.startsWith("\\")||s--;continue}if(a.startsWith("+++ ")){let l=Pw(a.slice(4));if(l===void 0){o=void 0;continue}o=n.get(l)??[],n.set(l,o)}else if(a.startsWith("@@")){let l=a.match(/^@@ -\d+(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);if(!l)continue;let c=Number(l[2]),d=l[3]===void 0?1:Number(l[3]);if(s=(l[1]===void 0?1:Number(l[1]))+d,!o)continue;d===0?o.push({start:Math.max(c,1),end:Math.max(c,1),approx:!0}):o.push({start:c,end:c+d-1})}}return n}function Pw(e){let t=e.endsWith(" ")?e.slice(0,-1):e;if(t.startsWith('"')&&t.endsWith('"')&&t.length>=2&&(t=Dw(t)),t!=="/dev/null")return t.startsWith("b/")?t.slice(2):t}function Dw(e){let t=W.from(e.slice(1,-1),"utf8"),n=[];for(let r=0;r=t.length){n.push(o);continue}let s=t[++r];s>=48&&s<=55?(n.push(parseInt(t.toString("latin1",r,r+3),8)&255),r+=2):n.push(Lw[String.fromCharCode(s)]??s)}return W.from(n).toString("utf8")}function ia(e){let t=$e("git",[...xt(e),"ls-files","--others","--exclude-standard","-z"]);return t.ok?t.stdout.split("\0").filter(n=>n.length>0):[]}function Wc(e,t){let n=$e("git",[...xt(e),"rev-parse","--show-prefix","--git-path","shallow","--verify","--quiet","HEAD"]);if(n.missing)return{ok:!1,error:"git was not found on PATH"};if(!n.ok)return{ok:!1,error:n.status===1?"no commits yet (empty repository)":Mm(n.stderr)||"not a git repository"};let[r="",o="",s=""]=n.stdout.split(` -`),a=Bw(e,t),l=Uw(le(e,o)),c=[s,...a.exclude,...l.map(g=>`^${g}`)],d=JSON.stringify([le(e),c,a.args]),u=kr.get(d);if(u)return kr.delete(d),kr.set(d,u),{ok:!0,log:u};let f=[...xt(e),"log","--no-color","--no-renames",...a.args,"--pretty=format:%x1e","--name-only","-z","--stdin"];r&&f.push("--full-history","--full-diff","--",".");let m=Yo("git",f,{input:c.join(` +var ow=Object.defineProperty;var z=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var Fc=(e,t)=>{for(var n in t)ow(e,n,{get:t[n],enumerable:!0})};function xm(e){let t="";for(let r=0;r{"use strict";aw=new TextDecoder("utf-8"),lw=new TextDecoder("utf-16le"),bm=new TextEncoder,wm="0123456789abcdef";W=class e extends Uint8Array{static from(t,n){if(typeof t=="string"){if(n==="hex"){let l=new e(t.length>>1);for(let c=0;ca+l.byteLength,0),o=new e(r),s=0;for(let a of t){if(s+a.byteLength>r){o.set(a.subarray(0,r-s),s);break}o.set(a,s),s+=a.byteLength}return o}subarray(t,n){return super.subarray(t,n)}toString(t,n,r){let o=n!==void 0||r!==void 0?this.subarray(n??0,r??this.length):this;switch((t??"utf8").toLowerCase()){case"utf8":case"utf-8":return aw.decode(o);case"utf16le":case"utf-16le":case"ucs2":case"ucs-2":return lw.decode(o);case"latin1":case"binary":case"ascii":return xm(o);case"hex":{let s="";for(let a of o)s+=wm[a>>4]+wm[a&15];return s}case"base64":return btoa(xm(o));default:throw new TypeError(`Unknown encoding: ${t}`)}}swap16(){if(this.length%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t"/",exit:e=>{throw new Error(`process.exit(${e??0}) is not available in the browser build`)},hrtime:Object.assign(e=>{let t=performance.now(),n=Math.floor(t/1e3),r=Math.floor(t%1e3*1e6);return e?[n-e[0],r-e[1]]:[n,r]},{bigint:()=>BigInt(Math.floor(performance.now()*1e6))}),memoryUsage:()=>({rss:0,heapTotal:0,heapUsed:0,external:0,arrayBuffers:0}),stdout:{write:e=>(console.log(e.replace(/\n$/,"")),!0),isTTY:!1},stderr:{write:e=>(console.warn(e.replace(/\n$/,"")),!0),isTTY:!1},on:()=>F,emitWarning:e=>console.warn(e)}});var Ne,yt,hn,Rt=z(()=>{"use strict";$();Ne="2.31.8",yt=5,hn=18});function Sm(e,t){let n="",r=0,o=-1,s=0,a=0;for(let l=0;l<=e.length;++l){if(l2){let c=n.lastIndexOf("/");c===-1?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),o=l,s=0;continue}else if(n.length!==0){n="",r=0,o=l,s=0;continue}}t&&(n+=n.length>0?"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,l):n=e.slice(o+1,l),r=l-o-1;o=l,s=0}else a===46&&s!==-1?++s:s=-1}return n}function ta(e){if(e.length===0)return".";let t=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47,r=Sm(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&n&&(r+="/"),t?"/"+r:r}function We(e){return e.length>0&&e.charCodeAt(0)===47}function j(...e){if(e.length===0)return".";let t;for(let n of e)n.length>0&&(t=t===void 0?n:t+"/"+n);return t===void 0?".":ta(t)}function ce(...e){let t="",n=!1;for(let o=e.length-1;o>=0&&!n;o--){let s=e[o];s===void 0||s.length===0||(t=t.length===0?s:s+"/"+t,n=s.charCodeAt(0)===47)}n||(t=t.length===0?"/":"/"+t);let r=Sm(t,!1);return r.length>0?"/"+r:"/"}function ze(e,t){if(e===t)return"";let n=ce(e),r=ce(t);if(n===r)return"";let o=n.slice(1).split("/").filter(Boolean),s=r.slice(1).split("/").filter(Boolean),a=0;for(;a=1;--o)if(e.charCodeAt(o)===47){if(!r){n=o;break}}else r=!1;return n===-1?t?"/":".":t&&n===1?"//":e.slice(0,n)}function He(e,t){let n=0,r=-1,o=!0;for(let a=e.length-1;a>=0;--a)if(e.charCodeAt(a)===47){if(!o){n=a+1;break}}else r===-1&&(o=!1,r=a+1);if(r===-1)return"";let s=e.slice(n,r);return t!==void 0&&t!==s&&s.endsWith(t)?s.slice(0,s.length-t.length):s}function yn(e){let t=-1,n=0,r=-1,o=!0,s=0;for(let a=e.length-1;a>=0;--a){let l=e.charCodeAt(a);if(l===47){if(!o){n=a+1;break}continue}r===-1&&(o=!1,r=a+1),l===46?t===-1?t=a:s!==1&&(s=1):t!==-1&&(s=-1)}return t===-1||r===-1||s===0||s===1&&t===r-1&&t===n+1?"":e.slice(t,r)}function cw(e){let t=We(e)?"/":"",n=He(e),r=yn(e),o=Ie(e);return{root:t,dir:o==="."&&t===""?"":o,base:n,ext:r,name:n.slice(0,n.length-r.length)}}function dw(e){let t=e.dir||e.root||"",n=e.base||(e.name??"")+(e.ext??"");return t?t===e.root?t+n:t+"/"+n:n}function uw(e){return e}var V,e1,ge=z(()=>{"use strict";$();V={sep:"/",delimiter:":",normalize:ta,isAbsolute:We,join:j,resolve:ce,relative:ze,dirname:Ie,basename:He,extname:yn,parse:cw,format:dw,toNamespacedPath:uw},e1={...V,posix:V,win32:V}});function Em(){return++km}function Nt(e){let t=e.startsWith("/")?e:"/"+e,n=ta(t);return n.length>1&&n.endsWith("/")?n.slice(0,-1):n}function Xn(e,t){let n=new Error(`ENOENT: no such file or directory, ${t} '${e}'`);return n.code="ENOENT",n.errno=-2,n.path=e,n.syscall=t,n}function vm(e,t){let n=new Error(`ENOTDIR: not a directory, ${t} '${e}'`);return n.code="ENOTDIR",n.errno=-20,n.path=e,n.syscall=t,n}function ys(e){let t=Nt(e),n=Ke.get(t);if(n){if(n.kind!=="dir")throw vm(e,"mkdir");return n}let r={kind:"dir",mtimeMs:0,mode:511,children:new Set};return Ke.set(t,r),t!==Er&&ys(Ie(t)).children.add(He(t)),r}function fw(){Ke.clear(),km=0,Cm=0,Ke.set(Er,{kind:"dir",mtimeMs:0,mode:511,children:new Set})}function Rm(e){for(let t of e){let n=Nt(t.path);ys(Ie(n)).children.add(He(n)),Ke.set(n,{kind:"file",size:t.size,mtimeMs:Em(),mode:438,bytes:t.bytes})}}function na(e,t){let n=Nt(e),r=Ke.get(n);if(r&&r.kind==="file"){r.bytes=t,r.size=t.byteLength,r.mtimeMs=Em();return}Rm([{path:n,size:t.byteLength,bytes:t}])}function mw(e){let t=Ke.get(Nt(e));return!!t&&t.kind==="file"&&t.bytes!==void 0}function pw(){let e=0;for(let[t,n]of[...Ke]){if(n.kind!=="file"||n.bytes!==void 0)continue;Ke.delete(t);let r=Ke.get(Ie(t));r&&r.kind==="dir"&&r.children.delete(He(t)),e++}return e}function gw(){let e=0;for(let t of Ke.values())t.kind==="file"&&t.bytes&&(e+=t.bytes.byteLength);return e}function hw(e,t,n){return{name:e,parentPath:t,path:t,isFile:()=>n==="file",isDirectory:()=>n==="dir",isSymbolicLink:_n,isBlockDevice:_n,isCharacterDevice:_n,isFIFO:_n,isSocket:_n}}function yw(e){return{size:e.kind==="file"?e.size:0,mode:e.mode,mtimeMs:e.mtimeMs,mtime:new Date(e.mtimeMs),isFile:()=>e.kind==="file",isDirectory:()=>e.kind==="dir",isSymbolicLink:_n,isBlockDevice:_n,isCharacterDevice:_n,isFIFO:_n,isSocket:_n}}function Q(e){return Ke.has(Nt(e))}function $e(e){let t=Ke.get(Nt(e));if(!t)throw Xn(e,"stat");return yw(t)}function ct(e){let t=Nt(e);if(!Ke.has(t))throw Xn(e,"realpath");return t}function Yn(e,t){let n=Nt(e),r=Ke.get(n);if(!r)throw Xn(e,"scandir");if(r.kind!=="dir")throw vm(e,"scandir");let o=[...r.children];return t?.withFileTypes?o.map(s=>{let a=Ke.get(n===Er?`/${s}`:`${n}/${s}`);return hw(s,n,a?.kind==="dir"?"dir":"file")}):o}function oe(e,t){let n=Ke.get(Nt(e));if(!n)throw Xn(e,"open");if(n.kind!=="file"){let o=new Error("EISDIR: illegal operation on a directory, read");throw o.code="EISDIR",o}if(!n.bytes)throw Xn(e,"open");let r=W.from(n.bytes);return t?r.toString(typeof t=="string"?t:t.encoding):r}function ut(e,t){let n=typeof t=="string"?new TextEncoder().encode(t):t;na(e,n)}function ra(e,t){let n=Ke.get(Nt(e));if(!n)throw Xn(e,"chmod");n.mode=t}function rn(e,t){ys(e)}function vr(e){let t=`${e}${Cm++}`;return ys(t),t}function et(e,t){let n=Nt(e),r=Ke.get(n);if(!r){if(t?.force)return;throw Xn(e,"unlink")}if(r.kind==="dir"){if(!t?.recursive)throw Object.assign(new Error(`Path is a directory: rm returned EISDIR (is a directory) ${e}`),{code:"ERR_FS_EISDIR"});for(let s of[...r.children])et(n===Er?`/${s}`:`${n}/${s}`,t)}Ke.delete(n);let o=Ke.get(Ie(n));o&&o.kind==="dir"&&o.children.delete(He(n))}function An(e,t){let n=Nt(e),r=Ke.get(n);if(!r)throw Xn(e,"rename");let o=Nt(t);if(o!==n){if(r.kind==="dir"){ys(o);for(let s of[...r.children])An(n===Er?`/${s}`:`${n}/${s}`,o===Er?`/${s}`:`${o}/${s}`)}else ys(Ie(o)).children.add(He(o)),Ke.set(o,r);et(n,{recursive:!0,force:!0})}}function sa(){throw new Error("recursive filesystem watching is unavailable in the browser VFS")}var Er,Ke,km,_n,Zn,Cm,Re=z(()=>{"use strict";$();ge();Er="/",Ke=new Map([[Er,{kind:"dir",mtimeMs:0,mode:511,children:new Set}]]),km=0;_n=()=>!1;Zn=$e;Cm=0});function ia(e,t,n){let r=new Error(`spawnSync ${e} ENOENT`);return r.code="ENOENT",r.errno=-2,r.syscall=`spawnSync ${e}`,r.path=e,{pid:0,output:[],stdout:"",stderr:"",status:null,signal:null,error:r}}function Mm(e,t,n){let r=new Map,o={pid:void 0,stdin:null,stdout:null,stderr:null,on(a,l){let c=r.get(a)??[];return c.push(l),r.set(a,c),o},kill:()=>!1},s=new Error(`spawn ${e} ENOENT`);return s.code="ENOENT",s.syscall=`spawn ${e}`,s.path=e,Promise.resolve().then(()=>{for(let a of r.get("error")??[])a(s);for(let a of r.get("close")??[])a(null)}),o}var oa=z(()=>{$()});function Pe(e,t,n={}){let r=n.env??F.env,o=ia(e,t,{cwd:n.cwd,input:n.input,encoding:"utf8",timeout:n.timeoutMs??12e4,maxBuffer:n.maxBufferBytes??64*1024*1024,env:e==="git"?{...r,...Oc}:r}),s=o.error?o.error.code:void 0;return{ok:!o.error&&o.status===0,status:o.status,stdout:o.stdout??"",stderr:o.stderr??(o.error?String(o.error.message):""),missing:s==="ENOENT",...s?{errorCode:s}:{}}}function sn(e){let t=Am.get(e);if(t!==void 0)return t;let n=Pe(F.platform==="win32"?"where":"which",[e]),r=n.ok&&n.stdout.trim().length>0;return Am.set(e,r),r}function di(e){return e.toLowerCase().replace(/^https?:\/\//,"").replace(/^git@/,"").replace(/\.git$/,"").replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,120)}function _w(e,t){return e.length<=t?e:e.slice(0,t)+` +\u2026 [truncated ${e.length-t} chars]`}function bw(e,t){let n=e.replace(/\s+/g," ").trim();if(n.length<=t)return n;let r=n.slice(0,t).replace(/\s+\S*$/,"");return r||(r=n.slice(0,t)),(r.match(/`/g)?.length??0)%2===1&&(r=r.replace(/`[^`]*$/,"")),r.lastIndexOf("[")>r.lastIndexOf("]")&&(r=r.slice(0,r.lastIndexOf("["))),r.replace(/\s+$/,"")+"\u2026"}function Ct(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qn(e){return $m.test(e)?e.normalize("NFKD").replace(/[̀-ͯ]/g,""):e}function _s(e,t){let n=new Set,r=[];for(let o of Qn(e).split(Tm)){if(!o)continue;let s=o.toLowerCase();o.length<2||Im.has(s)&&!t?.(o)||n.has(s)||(n.add(s),r.push(o))}return r}function ui(e,t){let n=[];for(let r of Qn(e).split(Tm))r&&(r.length<2||Im.has(r.toLowerCase())&&!t?.(r))&&n.push(r);return n}function ww(e){let t=_s(e),n=r=>{let o=0;return/\d/.test(r)&&(o+=3),/[A-Z]/.test(r)&&!/^[A-Z0-9]+$/.test(r)&&(o+=2),/_/.test(r)&&(o+=2),r.length>=8?o+=1.5:r.length>=5&&(o+=.5),o};return t.map((r,o)=>({k:r,s:n(r),i:o})).sort((r,o)=>o.s-r.s||r.i-o.i).map(r=>r.k)}function Nc(e,t,n=60){let r=new Map;for(let o of e)o.forEach((s,a)=>{let l=t(s);r.set(l,(r.get(l)??0)+1/(n+a+1))});return r}function bn(e){let t=!$m.test(e),n=t?e:Qn(e),r=t?n.replace(xw,"$1 $2").replace(Sw,"$1 $2"):n.replace(vw,"$1 $2").replace(Rw,"$1 $2"),o=[],s=new Set,a=l=>{l.length<2||s.has(l)||(s.add(l),o.push(l))};/\s/.test(e.trim())||a(n.toLowerCase().replace(t?kw:Cw,""));for(let l of r.split(t?Ew:Mw))a(l.toLowerCase());return o}function aa(e){if(e.length<4)return e;let t=e;return t.endsWith("ies")&&t.length>4?t=t.slice(0,-3)+"y":t.endsWith("sses")?t=t.slice(0,-2):(t.endsWith("ses")&&t.length>4||t.endsWith("s")&&!t.endsWith("ss")&&!t.endsWith("us")&&!t.endsWith("is"))&&(t=t.slice(0,-1)),t.endsWith("ying")&&t.length>5?t=t.slice(0,-4)+"y":t.endsWith("ing")&&t.length>5?t=t.slice(0,-3):t.endsWith("ed")&&t.length>4&&(t=t.slice(0,-2)),t.endsWith("e")&&t.length>3&&(t=t.slice(0,-1)),t}var Oc,Am,Im,$m,Tm,xw,Sw,kw,Ew,vw,Rw,Cw,Mw,it=z(()=>{"use strict";$();oa();Oc={LC_ALL:"C",LANGUAGE:""};Am=new Map;Im=new Set(["the","a","an","is","are","was","were","be","been","being","do","does","did","how","what","why","when","where","which","who","whom","this","that","these","those","of","in","on","to","for","with","and","or","but","if","then","else","than","as","at","by","from","into","about","it","its","i","you","we","they","he","she","there","here","can","could","should","would","will","shall","may","might","must","have","has","had","not","no","yes","so","such","only","any","some","all","get","set","use","used","using","work","works","working","handle","handled","happen","happens","default","value","values","please","explain","tell","me","my","our"]),$m=/[^\x00-\x7F]/;Tm=/[^\p{L}\p{N}_]+/u;xw=/([a-z0-9])([A-Z])/g,Sw=/([A-Z]+)([A-Z][a-z])/g,kw=/[^a-z0-9_]+/g,Ew=/[^A-Za-z0-9]+/,vw=/([\p{Ll}\p{N}])(\p{Lu})/gu,Rw=/(\p{Lu}+)(\p{Lu}\p{Ll})/gu,Cw=/[^\p{L}\p{N}_]+/gu,Mw=/[^\p{L}\p{N}]+/u});function Aw(e){let t="";for(let n=0;n=e.length))return s?{source:"(?!)",end:n}:{source:r?`[^/${o}]`:`(?!/)[${o}]`,end:n}}function Fm(e){return e==="\\"||e==="]"||e==="^"||e==="["||e==="-"?"\\"+e:e}function bs(e,t,n){let r=[],o=t?Ct(t)+"/":"",s=e.split(/\r?\n/);for(let a=0;af===u:f=>f.startsWith(u)&&o.test(f)}let{head:s,whole:a}=Pc(e);if(a)return(c,d)=>d===s&&c.startsWith(r);if(e[0]==="*"&&e[1]!=="*"){let c=Pc(e.slice(1));if(c.whole)return(d,u)=>u.endsWith(c.head)&&d.startsWith(r)}let l=new RegExp(`^${t}$`);return(c,d)=>c.startsWith(r)&&l.test(d)}function fi(e,t,n){let r=la(e,t,n);return r!==void 0&&!r.negated}function la(e,t,n){let r=t.slice(t.lastIndexOf("/")+1);for(let o=e.length-1;o>=0;o--){let s=e[o];if(!(s.dirOnly&&!n)&&(s.test?s.test(t,r):s.re.test(t)))return s}}var Iw,Lc=z(()=>{"use strict";$();it();Iw={alnum:"A-Za-z0-9",alpha:"A-Za-z",blank:" \\t",cntrl:"\\x00-\\x1f\\x7f",digit:"0-9",graph:"\\x21-\\x7e",lower:"a-z",print:"\\x20-\\x7e",punct:"!-\\/:-@\\[-`{-~",space:" \\t\\n\\r\\f\\v",upper:"A-Z",xdigit:"0-9A-Fa-f"}});function ws(e){let t;try{t=oe(e)}catch{return Fw}let n=t.length,r={buf:t,bytes:n,ok:!0,binary:!1};if(n>=2&&t[0]===255&&t[1]===254){let s=t.subarray(2,2+(n-2&-2)).toString("utf16le");return{...r,text:s,encoding:"utf16le",byteAddressable:!1,bodyStart:2}}if(n>=2&&t[0]===254&&t[1]===255){let s=W.from(t.subarray(2,2+(n-2&-2)));return s.swap16(),{...r,text:s.toString("utf16le"),encoding:"utf16be",byteAddressable:!1,bodyStart:2}}if(n>=3&&t[0]===239&&t[1]===187&&t[2]===191)return{...r,text:t.subarray(3).toString("utf8"),encoding:"utf8-bom",byteAddressable:!0,bodyStart:3};if(t.includes(0))return{...r,text:"",encoding:null,binary:!0,byteAddressable:!1,bodyStart:0};let o=t.toString("utf8");return o.includes("\uFFFD")&&!Nw(t)?{...r,text:t.toString("latin1"),encoding:"latin1",byteAddressable:!1,bodyStart:0}:{...r,text:o,encoding:"utf8",byteAddressable:!0,bodyStart:0}}function Nw(e){try{return Ow.decode(e),!0}catch{return!1}}function Pw(e){let t=new Int32Array(e.length+1),n=0;for(let r=0;r=55296&&o<=56319&&r+1{"use strict";$();Re();Fw={text:"",buf:W.alloc(0),encoding:null,binary:!1,bytes:0,ok:!1,byteAddressable:!1,bodyStart:0};Ow=new TextDecoder("utf-8",{fatal:!0});Dc=class{constructor(t){this.text=t;this.ascii=!/[^\x00-\x7F]/.test(t),this.table=this.ascii?null:Pw(t),this.lineStarts=Lw(t)}text;ascii;table;lineStarts;byteOf(t){if(this.ascii)return t;let n=this.table;return t<=0?0:t>=n.length?n[n.length-1]:n[t]}lineColOf(t){let n=this.lineStarts,r=0,o=n.length-1;for(;r>1;n[s]<=t?r=s:o=s-1}return{line:r+1,col:t-n[r]+1}}get lineCount(){return this.lineStarts.length}}});function Dw(e){let t=[...jc].map(o=>`:(glob)**/${o}/**`),n=Pe("git",["-C",e,"ls-files","-z","--",...t]);if(!n.ok)return;let r=new Set;for(let o of n.stdout.split("\0")){let s=0;for(let a=o.indexOf("/");a!==-1;a=o.indexOf("/",s))jc.has(o.slice(s,a))&&r.add(o.slice(0,a)),s=a+1}return r}function Ww(e,t){return e===Rr||e===jw||t.has(e)||e.startsWith(".codeindex-edit-")}function Nm(e,t){let n=t.find(o=>o.name===Rr);if(!n)return;let r=j(e,Rr);try{if(n.isDirectory())return r;let o=$e(r);if(o.isDirectory())return r;if(!o.isFile()||o.size>Bw)return;let s=oe(r,"utf8");if(!s.startsWith(Om))return;let a=s.slice(Om.length).replace(/[\r\n]+$/,"");if(!a)return;let l=ce(e,a),c=j(l,"commondir");return Q(c)?ce(l,oe(c,"utf8").trim()):l}catch{return}}function Pm(e){if(!e)return"";try{let t=j(e,"info","exclude");return Q(t)?se(t):""}catch{return""}}function Uw(e){let t=d=>{if(Q(j(d,Rr)))try{return Nm(d,Yn(d,{withFileTypes:!0}).filter(u=>u.name===Rr))}catch{return}};if(t(e))return[];let n=[],r;for(let d=e,u=Ie(d);u!==d&&(n.push(u),r=t(u),!r);d=u,u=Ie(d));if(!r)return[];let o=n[n.length-1],s=d=>d.split("/").join("/"),a=s(ze(o,e))+"/",l=d=>s(ze(e,d)),c=bs(Pm(r),"",l(j(r,"info","exclude")));for(let d of n.reverse()){let u=j(d,".gitignore");Q(u)&&c.push(...bs(se(u),s(ze(o,d)),l(u)))}return c.map(d=>({...d,test:(u,f)=>d.test?d.test(a+u,f):d.re.test(a+u)}))}function tt(e,t={}){let n=t.maxFileBytes??1048576,r=t.maxFiles??1/0,o=t.gitignore!==!1,s=t.ignoreDirs?new Set(t.ignoreDirs):In,a=!t.ignoreDirs&&t.trackedBuildDirs!==!1,l=null,c=k=>(l===null&&(l=Dw(e)),l?.has(k)??!1),d=(k,C,I)=>Ww(k,s)&&!(a&&jc.has(k)&&!(o&&I.length&&fi(I,C,!0))&&c(C)),u=[],f=!1,m=0,p=[],g=(k,C,I=!1,P)=>{t.onSkip?.({rel:k,reason:C,directory:I,...P===void 0?{}:{size:P}})},h=(k,C,I,P)=>{if(!t.onSkip)return;let v=la(C,k,I);t.onSkip({rel:k,reason:"gitignored",directory:I,...P===void 0?{}:{size:P},...v?.source!==void 0?{rule:{source:v.source,line:v.line,pattern:v.pattern}}:{}})},_;try{_=ct(e)}catch{return{files:u,capped:f,excluded:m}}let y=k=>k===_||k.startsWith(_+"/"),b=[{dir:e,rel:"",rules:o?Uw(_):[]}],S=new Set;e:for(;b.length;){let k=b.pop(),C=[],I;try{I=ct(k.dir)}catch{continue}if(S.has(I)||(S.add(I),!y(I)))continue;let P;try{P=Yn(k.dir,{withFileTypes:!0}).sort((M,x)=>M.namex.name?1:0)}catch{continue}let v=P.some(M=>M.name===Rr)?Nm(k.dir,P):void 0;if(k.rel&&v){m++,g(k.rel,"nested-repo",!0);continue}let R=k.rules;if(o&&!k.rel){let M=bs(Pm(v),"",".git/info/exclude");M.length&&(R=[...R,...M])}if(o&&P.some(M=>M.name===".gitignore")){let M=k.rel?`${k.rel}/.gitignore`:".gitignore",x=bs(se(j(k.dir,".gitignore")),k.rel,M);x.length&&(R=[...R,...x])}for(let M of P){let x=M.name,w=j(k.dir,x),E=k.rel?`${k.rel}/${x}`:x,N=M.isSymbolicLink();if(x===Rr)continue;if(M.isDirectory()&&d(x,E,R)){g(E,"ignore-dir",!0);continue}let O;try{O=N?$e(w):Zn(w)}catch{g(E,N?"broken-symlink":"unreadable");continue}if(O.isDirectory()){if(d(x,E,R)){g(E,"ignore-dir",!0);continue}if(N){g(E,"directory-symlink",!0);continue}if(o&&R.length&&fi(R,E,!0)){h(E,R,!0);continue}if(t.filter&&!t.filter({rel:E,abs:w,directory:!0})){g(E,"filter",!0);continue}C.push({dir:w,rel:E,rules:R});continue}if(!O.isFile())continue;let L=yn(x).toLowerCase(),H;if(o&&R.length&&fi(R,E,!1)?H="gitignored":t.filter&&!t.filter({rel:E,abs:w,directory:!1})?H="filter":O.size>n&&!t.includeOversize?H="over-max-bytes":ca.has(x.toLowerCase())&&!t.includeLockfiles?H="lockfile":(t.binaryExtensions??da).has(L)&&!t.includeBinary?H="binary-ext":(x.endsWith(".min.js")||x.endsWith(".min.css"))&&!t.includeMinified&&(H="minified"),H){m++,H==="over-max-bytes"&&p.push({rel:E.split("/").join("/"),size:O.size}),H==="gitignored"?h(E,R,!1,O.size):g(E,H,!1,O.size);continue}if(N){try{if(!y(ct(w))){g(E,"symlink-outside-root");continue}}catch{g(E,"broken-symlink");continue}if(!t.includeFileSymlinks){g(E,"file-symlink");continue}}if(u.length>=r){f=!0;break e}u.push({rel:E.split("/").join("/"),abs:w,size:O.size,ext:L,mtimeMs:O.mtimeMs})}for(let M=C.length-1;M>=0;M--)b.push(C[M])}return{files:u,capped:f,excluded:m,...p.length?{oversized:p}:{}}}function se(e){return ws(e).text}var In,jc,Rr,jw,Om,Bw,ca,da,zw,nt=z(()=>{"use strict";$();Re();ge();Lc();mi();it();mi();In=new Set([".git","node_modules",".pnpm","bower_components","vendor","dist","build","out","target",".next",".nuxt",".svelte-kit",".turbo","coverage","__pycache__",".venv","venv",".tox",".mypy_cache",".pytest_cache",".gradle",".idea",".vscode",".cache","tmp",".ultraindex",".codeindex","Pods","DerivedData",".terraform","elm-stuff",".dart_tool"]),jc=new Set(["build","out","target","tmp"]);Rr=".git",jw=".codeindex";Om="gitdir: ",Bw=4096;ca=new Set(["package-lock.json","npm-shrinkwrap.json","yarn.lock","pnpm-lock.yaml","bun.lockb","composer.lock","cargo.lock","poetry.lock","pipfile.lock","gemfile.lock","go.sum","flake.lock","packages.lock.json","podfile.lock","mix.lock"]),da=new Set([".png",".jpg",".jpeg",".gif",".webp",".bmp",".ico",".icns",".svg",".pdf",".zip",".gz",".tar",".tgz",".bz2",".xz",".7z",".rar",".jar",".war",".class",".so",".dylib",".dll",".exe",".bin",".o",".a",".wasm",".woff",".woff2",".ttf",".otf",".eot",".mp3",".mp4",".mov",".avi",".webm",".wav",".flac",".ogg",".lock",".min.js",".map"]),zw=2e4});function T(e,t){return et?1:0}function Cr(e){return(t,n)=>T(e(t),e(n))}var de=z(()=>{"use strict";$()});function on(e){let t=Pe("git",["-C",e,"rev-parse","HEAD"]);return t.ok?t.stdout.trim().slice(0,Hw):void 0}function Uc(e){let t=Pe("git",[...Mt(e),"hash-object","-t","tree","--stdin"],{input:""});return t.ok?t.stdout.trim():void 0}function zc(e){return Pe("git",["-C",e,"rev-parse","--is-inside-work-tree"]).ok}function Hc(e,t){let n=c=>Pe("git",[...Mt(e),"rev-parse","--verify","--quiet",`${c}^{commit}`]).ok,r=c=>{let d=Pe("git",[...Mt(e),"merge-base",c,"HEAD"]);return d.ok?d.stdout.trim():void 0};if(t){if(Bc(t)||!n(t))return{error:`base ref "${t}" not found (tried git rev-parse --verify)`};let c=r(t);return c?{ref:t,mergeBase:c}:{error:`no merge-base between "${t}" and HEAD`}}let o=Pe("git",[...Mt(e),"symbolic-ref","--quiet","refs/remotes/origin/HEAD"]),s=[...o.ok?[o.stdout.trim().replace("refs/remotes/","")]:[],"origin/main","origin/master","main","master"];for(let c of s){if(!n(c))continue;let d=r(c);if(d)return{ref:c,mergeBase:d}}let a=Pe("git",[...Mt(e),"rev-parse","--verify","--quiet","HEAD"]);if(a.ok)return{ref:"HEAD",mergeBase:a.stdout.trim(),note:"base: HEAD (no default branch found \u2014 reviewing uncommitted work)"};let l=Uc(e);return l?{ref:ua,mergeBase:l,note:"no commits yet \u2014 every file is reviewed as added"}:{error:"cannot resolve HEAD, nor the empty tree"}}function Gc(e,t){let n=[],r=Pe("git",[...Mt(e),"diff","--no-color","--relative","-z","-M","--name-status",...Wc(t)]);if(r.ok){let a=r.stdout.split("\0"),l=0;for(;l[a.path,a])),s=Pe("git",[...Mt(e),"diff","--no-color","--relative","-z","-M","--numstat",...Wc(t)]);if(s.ok){let a=s.stdout.split("\0"),l=0;for(;l0){a.startsWith("\\")||s--;continue}if(a.startsWith("+++ ")){let l=qw(a.slice(4));if(l===void 0){o=void 0;continue}o=n.get(l)??[],n.set(l,o)}else if(a.startsWith("@@")){let l=a.match(/^@@ -\d+(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);if(!l)continue;let c=Number(l[2]),d=l[3]===void 0?1:Number(l[3]);if(s=(l[1]===void 0?1:Number(l[1]))+d,!o)continue;d===0?o.push({start:Math.max(c,1),end:Math.max(c,1),approx:!0}):o.push({start:c,end:c+d-1})}}return n}function qw(e){let t=e.endsWith(" ")?e.slice(0,-1):e;if(t.startsWith('"')&&t.endsWith('"')&&t.length>=2&&(t=Jw(t)),t!=="/dev/null")return t.startsWith("b/")?t.slice(2):t}function Jw(e){let t=W.from(e.slice(1,-1),"utf8"),n=[];for(let r=0;r=t.length){n.push(o);continue}let s=t[++r];s>=48&&s<=55?(n.push(parseInt(t.toString("latin1",r,r+3),8)&255),r+=2):n.push(Vw[String.fromCharCode(s)]??s)}return W.from(n).toString("utf8")}function fa(e){let t=Pe("git",[...Mt(e),"ls-files","--others","--exclude-standard","-z"]);return t.ok?t.stdout.split("\0").filter(n=>n.length>0):[]}function Vc(e,t){let n=Pe("git",[...Mt(e),"rev-parse","--show-prefix","--git-path","shallow","--verify","--quiet","HEAD"]);if(n.missing)return{ok:!1,error:"git was not found on PATH"};if(!n.ok)return{ok:!1,error:n.status===1?"no commits yet (empty repository)":Dm(n.stderr)||"not a git repository"};let[r="",o="",s=""]=n.stdout.split(` +`),a=Zw(e,t),l=Yw(ce(e,o)),c=[s,...a.exclude,...l.map(g=>`^${g}`)],d=JSON.stringify([ce(e),c,a.args]),u=Mr.get(d);if(u)return Mr.delete(d),Mr.set(d,u),{ok:!0,log:u};let f=[...Mt(e),"log","--no-color","--no-renames",...a.args,"--pretty=format:%x1e","--name-only","-z","--stdin"];r&&f.push("--full-history","--full-diff","--",".");let m=ia("git",f,{input:c.join(` `)+` -`,maxBuffer:Cm,timeout:6e5,env:{...F.env,...Cc}});if(m.error){let g=m.error.code;return{ok:!1,error:g==="ENOBUFS"?`git log output exceeds ${Cm/1024/1024} MiB \u2014 bound the window with since`:g==="ENOENT"?"git was not found on PATH":m.error.message}}if(m.status!==0)return{ok:!1,error:Mm(String(m.stderr??""))||`git log exited with ${m.status}`};let p=zw(m.stdout,r,l.length>0);return kr.set(d,p),kr.size>Ww&&kr.delete(kr.keys().next().value),{ok:!0,log:p}}function Bw(e,t){if(!t)return{exclude:[],args:[]};let n=Oc(t)?void 0:$e("git",[...xt(e),"rev-parse","--verify","--quiet",`${t}^{commit}`]);if(n?.ok)return{exclude:[`^${n.stdout.trim()}`],args:[]};if(jw.test(t.trim())){let r=$e("git",[...xt(e),"rev-parse",`--since=${t}`]),o=/^--max-age=(-?\d+)$/m.exec(r.stdout);if(r.ok&&o){let s=BigInt(o[1]);return s<0n||s>=2n**63n?{exclude:[],args:[]}:{exclude:[],args:[`--max-age=${o[1]}`]}}}throw new Error(`since "${t}" is neither a commit (tag, branch, sha) nor a date (2024-01-01, "6 months ago")`)}function Uw(e){try{return ie(e,"utf8").split(` -`).map(t=>t.trim()).filter(Boolean).sort(T)}catch{return[]}}function zw(e,t,n){let r=new Map,o=[],s=[],a=[];for(let l=0;ld&&s.length){let u=e.toString("utf8",d,c),f=r.get(u);f===void 0&&(f=o.length,o.push(u),r.set(u,f)),a.push(f)}l=c+1}return s.push(a.length),{prefix:t,paths:o,starts:s,ids:a,shallow:n}}function Bc(e){if(!e.prefix)return e.paths;let t=e.prefix.length;return e.paths.map(n=>n.startsWith(e.prefix)?n.slice(t):void 0)}function tn(e,t={}){let n=new Map,r=Wc(e,t.since);if(!r.ok)return{churn:n,ok:!1,error:r.error,commits:0};let{log:o}=r,s=Bc(o),a=new Int32Array(o.paths.length).fill(-1),l=0;for(let c=0;c+1{"use strict";$();Qo();ke();me();ce();et();Ow=7;Nw=["-c","core.quotePath=false","-c","color.ui=false","-c","diff.noprefix=false","-c","diff.mnemonicPrefix=false","-c","diff.relative=false","-c","log.showSignature=false","-c","log.follow=false","-c","log.showRoot=true"],xt=e=>["-C",e,...Nw],Oc=e=>e.startsWith("-"),Fc=e=>e.staged?["--cached"]:[e.mergeBase],sa="(no commits)";Lw={a:7,b:8,t:9,n:10,v:11,f:12,r:13};Cm=1024*1024*1024,jw=/^(?:\d{4}-\d{2}-\d{2}(?:[ T]\d{2}:\d{2}(?::\d{2})?)?(?:Z|[+-]\d{2}:?\d{2})?|(?:\d+[ .](?:second|minute|hour|day|week|month|year)s?[ .]*)+(?:ago)?)$/i,kr=new Map,Ww=4});function Gw(e){return typeof e=="string"?new TextEncoder().encode(e):e}function qw(e,t){if(e.length===1)return e[0];let n=new Uint8Array(t),r=0;for(let o of e)n.set(o,r),r+=o.byteLength;return n}function Im(e){let t=Math.floor(e.byteLength/536870912|0),n=e.byteLength<<3>>>0,r=Math.ceil((e.byteLength+9)/64),o=new Uint8Array(r*64);o.set(e),o[e.byteLength]=128;let s=new DataView(o.buffer);return s.setUint32(o.byteLength-8,t,!1),s.setUint32(o.byteLength-4,n,!1),s}function Uc(e,t){return(e<>>32-t)>>>0}function yn(e,t){return(e>>>t|e<<32-t)>>>0}function Vw(e){let t=Im(e),n=1732584193,r=4023233417,o=2562383102,s=271733878,a=3285377520,l=new Uint32Array(80);for(let u=0;u>>0;h=g,g=p,p=Uc(m,30),m=f,f=S}n=n+f>>>0,r=r+m>>>0,o=o+p>>>0,s=s+g>>>0,a=a+h>>>0}let c=new Uint8Array(20),d=new DataView(c.buffer);return[n,r,o,s,a].forEach((u,f)=>d.setUint32(f*4,u,!1)),c}function Kw(e){let t=Im(e),n=1779033703,r=3144134277,o=1013904242,s=2773480762,a=1359893119,l=2600822924,c=528734635,d=1541459225,u=new Uint32Array(64);for(let p=0;p>>3,M=yn(v,17)^yn(v,19)^v>>>10;u[I]=u[I-16]+C+u[I-7]+M>>>0}let g=n,h=r,_=o,y=s,b=a,S=l,k=c,R=d;for(let I=0;I<64;I++){let P=yn(b,6)^yn(b,11)^yn(b,25),v=b&S^~b&k,C=R+P+v+Jw[I]+u[I]>>>0,M=yn(g,2)^yn(g,13)^yn(g,22),x=g&h^g&_^h&_,w=M+x>>>0;R=k,k=S,S=b,b=y+C>>>0,y=_,_=h,h=g,g=C+w>>>0}n=n+g>>>0,r=r+h>>>0,o=o+_>>>0,s=s+y>>>0,a=a+b>>>0,l=l+S>>>0,c=c+k>>>0,d=d+R>>>0}let f=new Uint8Array(32),m=new DataView(f.buffer);return[n,r,o,s,a,l,c,d].forEach((p,g)=>m.setUint32(g*4,p,!1)),f}function Xw(e){let t="";for(let n of e)t+=Am[n>>4]+Am[n&15];return t}function Zw(e){let t="";for(let n of e)t+=String.fromCharCode(n);return btoa(t)}function gs(e){let t=e.toLowerCase().replace("-","");if(t!=="sha1"&&t!=="sha256")throw new Error(`createHash: unsupported algorithm "${e}" in the browser build (sha1, sha256)`);let n=[],r=0,o={update(s){let a=Gw(s);return n.push(a),r+=a.byteLength,o},digest(s){let a=r===0?new Uint8Array(0):qw(n,r),l=t==="sha1"?Vw(a):Kw(a);return s==="hex"?Xw(l):s==="base64"?Zw(l):l}};return o}var Jw,Am,oa=H(()=>{$();Jw=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);Am="0123456789abcdef"});function Re(e){return gs("sha1").update(e).digest("hex")}function Yw(e,t=8){return Re(e).slice(0,t)}var St=H(()=>{"use strict";$();oa()});function ex(e){return Qw.test(e.trim())}function nx(e){return tx.test(e.trim())}function sx(e){return rx.test(e.trim())}function Dt(e){return e.replace(/\*+\/\s*$/,"").replace(/^\s*\/\*+!?/,"").replace(/^\s*\/\/[/!]?/,"").replace(/^\s*--+/,"").replace(/^\s*#+/,"").replace(/^\s*\*+/,"").replace(/^\s*(?:"""|''')/,"").replace(/(?:"""|''')\s*$/,"").replace(/[-=~_]{3,}|\/{3,}|\*{3,}|#{3,}/g," ").trim()}function ix(e){return e.replace(/<\/?[A-Za-z][^>]*>/g," ").replace(/\s+/g," ").trim()}function Er(e,t=ox,n=3){let r=[],o=!1;for(let l of e){let c=l.trim();if(!c){o=!1;continue}if(!o){if(sx(c)){if(r.length)break;o=!0;continue}if(!(ex(c)||nx(c))){if(/^@[a-z]/i.test(c))break;r.push(c)}}}let s=ix(r.join(" "));if(s.length|\]=*\]|-\})\s*$/,"")).replace(/^\|(?:\s+|$)/,"").replace(mx,"")}function zc(e,t){let n=ax.has(e),r=lx.has(e),o=fx.filter(([d])=>d==="/*"||d===""],["--[[","]]"],["{-","-}"],['"""','"""'],["'''","'''"]],mx=/^@(?:file|fileoverview|overview|desc|description)\b\s*/i,px=/^created by\b.*\bon\s+\d{1,4}[./-]\d{1,2}[./-]\d{1,4}\.?$/i,gx=60,hx=200,yx=8});function xe(e,t,n,r,o){let s=[],a=t.split(/\r?\n/),l=o===void 0?a:o.split(/\r?\n/),c=o!==void 0&&r.some(u=>u.scope==="member")?xx(o):void 0,d=new Map;for(let u=0;u{let l=a.doc??kx(o,a.line-1,n),c=a.endLine??s?.endOf(a.line-1,o);return l===void 0&&c===void 0?a:{...a,...c!==void 0?{endLine:c}:{},...l!==void 0?{doc:l}:{}}})}function kx(e,t,n){let r=t-1;for(;r>=0&&n.decoration?.test(e[r]);)r--;if(n.docAttr){let s=Ex(e,r);if(s)return Er(s)}let o=[];for(;r>=0;){let s=e[r];if(n.comment.test(s)){o.push(s),r--;continue}if(!n.block||!/\*\/\s*$/.test(s))break;let a=r;for(;a>=0&&!e[a].includes("/*");)a--;if(a<0||!/^\s*\/\*(?!!)/.test(e[a]))break;for(let l=r;l>=a;l--)o.push(e[l]);r=a-1}if(o.length)return Er(o.reverse().map(Dt))}function Ex(e,t){if(t<0)return;let n=/^\s*@doc\s+(?:~[sS])?"(.*)"\s*$/.exec(e[t]);if(n)return[n[1]];if(/^\s*"""\s*$/.test(e[t]))for(let r=t-1;r>=0&&t-r<400;r--){if(/^\s*@doc\s+(?:~[sS])?"""\s*$/.test(e[r]))return e.slice(r+1,t);if(/"""/.test(e[r]))return}}function rn(e){return vx[e]??"other"}function Cx(e){let t=e.length,n="",r=0,o=0;for(;o{if(!a){a=[0];for(let _=0;_>>1;a[_]<=p?g=_+1:h=_}return g},c=new Map;for(let p of n)c.has(p.name)||c.set(p.name,p);let d=Cx(t),u=/export\s*\{([\s\S]*?)\}\s*(?:from\s*['"]([^'"]+)['"])?\s*;?/g,f;for(;(f=u.exec(d))&&o.length{"use strict";$();li();Ee=String.raw`[\p{L}\p{Nl}_$][\p{L}\p{Nl}\p{Mn}\p{Mc}\p{Nd}\p{Pc}$\u200c\u200d]*`,bx=new Set(["class","struct","enum","interface","protocol","actor","extension","object","trait","mixin"]);Gc=class{constructor(t){this.masked=t;let n=[];for(let r=0;r>>1;this.lineStarts[o]<=t?n=o+1:r=o}return n-1}endOf(t,n){let r=this.masked,o=/^\s*/.exec(n[t])[0],s=0,a=t;for(let l=this.lineStarts[t];l60||a>=this.lineStarts.length)return;let d=r.slice(this.lineStarts[a],this.lineStarts[a+1]??r.length),u=/^\s*/.exec(d)[0],f=d.charAt(u.length);if(s===0&&f&&!"{)]".includes(f)&&u.length<=o.length)return;continue}if(c===40||c===91)s++;else if(c===41||c===93){if(--s<0)return}else{if(s===0&&c===59)return;if(s===0&&c===123){let d=this.closeOf.get(l);if(d===void 0)return;let u=this.lineOf(d),f=r.slice(d+1,this.lineStarts[u+1]??r.length);if(u===this.lineOf(l)){if(u===t&&/^[\s;,)\]}]*$/.test(f))return this.continued(u)?void 0:u+1;l=d;continue}return f.includes("{")?void 0:n[u].startsWith(o+"}")&&!this.continued(u)?u+1:void 0}}}}continued(t){for(let n=t+1;n)/.test(r)}return!1}},vx={".ts":"typescript",".tsx":"typescript",".mts":"typescript",".cts":"typescript",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".go":"go",".rb":"ruby",".rake":"ruby",".java":"java",".rs":"rust",".c":"c",".h":"c",".cc":"cpp",".cpp":"cpp",".cxx":"cpp",".hpp":"cpp",".cs":"csharp",".php":"php",".swift":"swift",".kt":"kotlin",".kts":"kotlin",".scala":"scala",".sc":"scala",".clj":"clojure",".ex":"elixir",".exs":"elixir",".erl":"erlang",".hs":"haskell",".dart":"dart",".lua":"lua",".sh":"shell",".bash":"shell",".zsh":"shell",".ksh":"shell",".fish":"shell",".hh":"cpp",".m":"objective-c",".mm":"objective-c",".sql":"sql",".graphql":"graphql",".gql":"graphql",".proto":"protobuf",".md":"markdown",".mdx":"markdown",".rst":"restructuredtext",".txt":"text",".json":"json",".yaml":"yaml",".yml":"yaml",".toml":"toml",".ini":"ini",".html":"html",".css":"css",".scss":"scss",".vue":"vue",".svelte":"svelte",".astro":"astro",".zig":"zig",".hcl":"hcl",".tf":"terraform",".tfvars":"terraform",".sol":"solidity"};Rx=new Set([".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"]);Hc=47,$m=42,Tm=10,Mx=34,Ax=39,Ix=96,$x=92,aa=400});function Jc(e,t=[]){if(t.length>=da)return t;let n=e.indexOf("{");if(n===-1){let c=e.replace(/\s+as\s+\w+\s*$/,"").replace(/::\s*\*\s*$/,"").replace(/^::/,"").trim();return c&&t.push(c),t}let r=e.slice(0,n),o=0,s=-1;for(let c=n;c|\bas\b/).map(u=>u.trim());if(!a||l==="_")continue;let c=a==="_"||a==="*"||/^given\b/.test(a),d=Kc(c?r+".*":r+"."+a);d&&t.length=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===Gm||e>127}function vr(e){let t=e.length,n=new mi(e),r=[],o=0,s=c=>{let d=c;for(;d{let d=c-1;for(;d>=0&&n.codeAt(d)<=Hm;)d--;if(d<0)return!0;let u=n.codeAt(d);if(Ux.has(u))return!0;if(!Lm(u))return!1;let f=d;for(;f>0&&Lm(e.charCodeAt(f-1));)f--;return zx.has(e.slice(f,d+1))},l=0;for(;l0&&e.charCodeAt(l-1)===Xc;)l--;let c=o-l;if(t.raw==="r"?/[rR]$/.test(e.slice(Math.max(0,l-2),l)):c>0){let u=e.indexOf('"'+"#".repeat(c),o+1),f=u===-1?n:u;r.blank(o+1,f),o=u===-1?n:u+1+c;continue}}let a=s===ci||s===ua&&t.squote==="string";if(a||s===fi&&t.backtick){let l=a&&t.triple&&e.charCodeAt(o+1)===s&&e.charCodeAt(o+2)===s,c=o+(l?3:1),d=c;if(l){let f=e.indexOf(s===ci?'"""':"'''",c);d=f===-1?n:f}else for(;d{n.get(s)===!0&&n.delete(s),n.set(s,!1)},o=s=>{n.has(s)||n.set(s,!0)};if(Tx.has(e)){if(!t.includes("import")&&!t.includes("require")&&!t.includes("from"))return[];let s=vr(t);for(let a of[Gx,qx,Vx,Jx]){a.lastIndex=0;for(let l;l=a.exec(s);){let[c,d]=l.indices[1];r(t.slice(c,d))}}}else if(Fx.has(e)){if(!t.includes("import"))return[];let s=Hx(t);jm.lastIndex=0;for(let a;a=jm.exec(s);){let l=a[1];if(l!==void 0){if(r(l),!l||l==="__future__")continue;let c=a[2].startsWith("(")?a[2].slice(1,-1):a[2].replace(/\\\r?\n/g," ");for(let d of c.split(",")){let u=d.trim().split(/\s+as\s+/)[0].trim();/^[A-Za-z_]\w*$/.test(u)&&o(Zx(l,u))}continue}for(let c of a[3].split(",")){let d=c.trim().split(/\s+as\s+/)[0].trim();d&&/^[\w.]+$/.test(d)&&r(d)}}}else if(e===".go"){let s=t.split(/\r?\n/),a=!1;for(let l of s){let c=l.trim();if(a){if(c===")"){a=!1;continue}let u=/"([^"]+)"/.exec(c);u&&r(u[1]);continue}if(/^import\s*\($/.test(c)){a=!0;continue}let d=/^import\s+(?:[\w.]+\s+)?"([^"]+)"/.exec(c);d&&r(d[1])}}else if(e===".rs"){let s,a=new Set,l=/#\[\s*path\s*=\s*"([^"]+)"\s*\]\s*(?:(?:#\[[^\]]*\]|\/\/[^\n]*)\s*)*(?:pub(?:\([^)]*\))?\s+)?mod\s+[A-Za-z_]\w*\s*;/g;for(;s=l.exec(t);)r(`mod-path ${s[1]}`),a.add(s.index+s[0].length);let c=/^[^\S\r\n]*(?:pub(?:\([^)]*\))?\s+)?mod\s+([A-Za-z_]\w*)\s*;/gm;for(;s=c.exec(t);)a.has(s.index+s[0].length)||r(`mod ${s[1]}`);let d=/^[^\S\r\n]*(?:pub(?:\([^)]*\))?\s+)?use\s+([^;]+);/gm;for(;s=d.exec(t);)for(let u of Jc(s[1].trim()))r(u)}else if(e===".java"){let s,a=/^[^\S\r\n]*import\s+(?:static\s+)?([\w.]+(?:\.\*)?)\s*;/gm;for(;s=a.exec(t);)r(s[1])}else if(e===".rb"||e===".rake"){let s,a=/^[^\S\r\n]*require_relative\s+['"]([^'"]+)['"]/gm;for(;s=a.exec(t);)r(Vc(s[1]));let l=/^[^\S\r\n]*require\s+['"]([^'"]+)['"]/gm;for(;s=l.exec(t);)r(s[1])}else if(Ox.has(e)){let s,a=/^[^\S\r\n]*#\s*include\s*"([^"]+)"/gm;for(;s=a.exec(t);)r(s[1])}else if(e===".php"){let s,a=Kx.exec(t)?.index??1/0;for(Wm.lastIndex=0;s=Wm.exec(t);){if(s[1]&&s.index>a)continue;let l=s[2].trim().replace(/^(?:function|const)\s+/,""),c=/^\\?([\w\\]*?)\\?\s*\{([^}]*)\}$/.exec(l),d=c?c[2].split(",").map(u=>`${c[1]}\\${u.trim()}`):l.split(",");for(let u of d){let f=u.trim().replace(/\\(?:function|const)\s+/,"\\").replace(/\s+as\s+\w+$/,"").replace(/^\\/,"");Xx.test(f)&&r(f)}}for(Bm.lastIndex=0;s=Bm.exec(t);){let{here:l,up:c,levels:d,path:u}=s.groups;r(l?Vc(u.replace(/^\/+/,"")):c?"../".repeat(Number(d??1))+u.replace(/^\/+/,""):Vc(u))}}else if(e===".cs"){let s,a=/^[^\S\r\n]*(?:global\s+)?using\s+(?:static\s+)?([A-Za-z_][\w.]*)\s*;/gm;for(;s=a.exec(t);)r(s[1])}else if(Um.has(e)){let s,a=/^[ \t]*import[ \t]+([\w.`*]+)/gm;for(;s=a.exec(t);){let l=Kc(s[1]);l&&r(l)}}else if(zm.has(e)){let s,a=/^[ \t]*import[ \t]+((?:[^\n;{]|\{[^}]*\})+)/gm;for(;s=a.exec(t);){let l=[],c=0,d="";for(let u of s[1].replace(/\/\/.*$/gm,""))u==="{"?c++:u==="}"&&c--,u===","&&c===0?(Om(d,l),d=""):d+=u;Om(d,l);for(let u of l)r(u)}}else if(e===".dart"){let s,a=/^[ \t]*(?:import|export|part)[ \t]+(?:'([^'\n]+)'|"([^"\n]+)")/gm;for(;s=a.exec(t);)r(s[1]??s[2])}else if(e===".lua"){let s,a=/\brequire\s*\(?\s*['"]([\w-]+(?:[./][\w-]+)*)['"]/g;for(;s=a.exec(t);)r(s[1])}else if(Nx.has(e)){let s,a=/(?:^|[;&|]|\b(?:then|do|else)\b)[ \t]*(?:source|\.)[ \t]+([^\n]+)/gm;for(;s=a.exec(t);){let l=Lx(s[1]);l&&r(l)}}else if(e===".ex"||e===".exs"){let s,a=/^[ \t]*(?:alias|import|require|use)[ \t]+([A-Z]\w*(?:\.[A-Z]\w*)*)(?:\.\{([^}]*)\})?/gm;for(;s=a.exec(t);){if(s[2]===void 0){r(s[1]);continue}let l=0;for(let c of s[2].split(",")){let d=c.trim();/^[A-Z]\w*(?:\.[A-Z]\w*)*$/.test(d)&&l++a?{kind:"import",spec:s,soft:!0}:{kind:"import",spec:s})}function fa(e,t){if(e===".java")return/^\s*package\s+([\w.]+)\s*;/m.exec(t)?.[1];if(e===".cs")return/^\s*(?:file-scoped\s+)?namespace\s+([\w.]+)/m.exec(t)?.[1];if(Um.has(e)){let n=/^[ \t]*package[ \t]+([\w.`]+)/m.exec(t);return n?n[1].replace(/`/g,""):void 0}if(zm.has(e))return Dx(t)}var Tx,Fx,Ox,Um,zm,Nx,da,Px,mi,Nm,pi,Hm,Xc,Gm,ua,ci,di,Mn,jx,ui,Wx,fi,Pm,Bx,Ux,zx,Dm,ca,qc,Gx,qx,Vx,Jx,jm,Kx,Wm,Xx,Bm,ft=H(()=>{"use strict";$();Tx=new Set([".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"]),Fx=new Set([".py",".pyi"]),Ox=new Set([".c",".h",".cc",".cpp",".cxx",".hpp",".hh"]),Um=new Set([".kt",".kts"]),zm=new Set([".scala",".sc"]),Nx=new Set([".sh",".bash",".zsh",".ksh",".fish"]),da=16;Px=/^(["']?)(?:\$\(\s*dirname\s+(["']?)\$(?:0|\{BASH_SOURCE(?:\[0\])?\}|BASH_SOURCE)\2\s*\)|\$\{(?:BASH_SOURCE(?:\[0\])?|0)%\/\*\})\//;mi=class{constructor(t){this.src=t}src;codes;blank(t,n){if(n<=t)return;let r=this.codes;if(!r){r=this.codes=new Uint16Array(this.src.length);for(let o=0;o~^"].map(e=>e.charCodeAt(0))),zx=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]),Dm=/\bimport\(\s*['"][^'"\n]*['"]\s*[,)]|@import\b[^'"@]{0,2048}?\bfrom\s*['"][^'"\n]*['"]/g;ca=/'(?:\\(?:u\{[0-9A-Fa-f]{1,6}\}|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{2}|.)|[^\\'\n])'/y;qc="[\\w$\\u00a0-\\uffff]+",Gx=new RegExp(`(?:^|[^\\w$.])(?:import|export)\\b\\s*(?:(?:type|typeof|defer|source)\\s+)?(?:${qc}\\s*,\\s*)?(?:${qc}|\\*\\s*(?:as\\s+${qc})?|\\{[^{}]*\\})\\s*from\\s*['"]([^'"]+)['"]`,"dg"),qx=/(?:^|[\n;])[ \t]*import\s*['"]([^'"]+)['"]/dg,Vx=/\brequire\(\s*['"]([^'"]+)['"]\s*\)/dg,Jx=/\bimport\(\s*['"]([^'"]+)['"]\s*[,)]/dg,jm=/(?:^|;)[ \t]*(?:from[ \t]+(\.*[\w.]*)[ \t]+import\b[ \t]*(\([^)]*\)|(?:\\\r?\n|[^\n;])*)|import[ \t]+([^\n;]*))/gm,Kx=/^[ \t]*(?:(?:abstract|final|readonly)[ \t]+)*(?:class|interface|trait|enum)[ \t]+[A-Za-z_]/m,Wm=/^([ \t]*)use\s+([^;]*);/gm,Xx=/^[A-Za-z_][\w\\]*$/,Bm=/\b(?:require|include)(?:_once)?\s*\(?\s*(?:(?__DIR__|dirname\(\s*__FILE__\s*\))\s*\.\s*|(?dirname\(\s*__DIR__\s*(?:,\s*(?\d+)\s*)?\))\s*\.\s*)?['"](?[^'"]+)['"]/g});function tS(e){return(e.split("/").pop()??"").replace(/\.[^.]+$/,"")}function nS(e,t){let n=s=>{if(!(!s||s==="default"))for(let a of t)a.name===s&&(a.exported=!0)},r=(s,a)=>{for(let l of s.split(",")){let c=l.trim().replace(/^type\s+/,"");if(!c)continue;let d=/^([\w$]+)\s+as\s+([\w$]+)$/.exec(c);if(d){d[2]!=="default"&&n(d[1]);continue}if(a){let u=/^([\w$]+)\s*:\s*([\w$]+)$/.exec(c);if(u){n(u[1]),n(u[2]);continue}}n(/^([\w$]+)/.exec(c)?.[1])}},o;for(qm.lastIndex=0;o=qm.exec(e);)o[2]||r(o[1]??"",!1);for(Vm.lastIndex=0;o=Vm.exec(e);)r(o[1]??"",!0);for(Jm.lastIndex=0;o=Jm.exec(e);)n(o[2])}var ot,Zc,At,nt,Yx,Qx,eS,qm,Vm,Jm,Km,Xm=H(()=>{"use strict";$();ft();tt();ot=`(?${Ee})`,Zc=String.raw`function(?:\s*\*\s*|\s+)`,At=String.raw`(?:declare\s+)?`,nt=e=>new RegExp(e,"u"),Yx=[{re:nt(String.raw`^\s*export\s+${At}(?:async\s+)?${Zc}${ot}`),kind:"function",exported:!0},{re:nt(String.raw`^\s*export\s+default\s+(?:async\s+)?${Zc}${ot}`),kind:"function",exported:!0},{re:nt(String.raw`^\s*export\s+default\s+(?:abstract\s+)?class\s+(?!extends\b)${ot}`),kind:"class",exported:!0},{re:nt(String.raw`^\s*${At}(?:async\s+)?${Zc}${ot}`),kind:"function",exported:!1},{re:nt(String.raw`^\s*export\s+${At}(?:abstract\s+)?class\s+${ot}`),kind:"class",exported:!0},{re:nt(String.raw`^\s*${At}(?:abstract\s+)?class\s+${ot}`),kind:"class",exported:!1},{re:nt(String.raw`^\s*export\s+${At}interface\s+${ot}`),kind:"interface",exported:!0},{re:nt(String.raw`^\s*${At}interface\s+${ot}`),kind:"interface",exported:!1},{re:nt(String.raw`^\s*export\s+${At}type\s+${ot}`),kind:"type",exported:!0},{re:nt(String.raw`^\s*${At}type\s+${ot}\s*[=<]`),kind:"type",exported:!1},{re:nt(String.raw`^\s*export\s+${At}(?:const\s+)?enum\s+${ot}`),kind:"enum",exported:!0},{re:nt(String.raw`^\s*export\s+${At}(?:namespace|module)\s+(?${Ee}(?:\.${Ee})*)`),kind:"namespace",exported:!0},{re:nt(String.raw`^\s*${At}(?:namespace|module)\s+(?${Ee}(?:\.${Ee})*)\s*\{`),kind:"namespace",exported:!1},{re:nt(String.raw`^\s*export\s+${At}(?:const|let|var)\s+${ot}\s*[:=;]`),kind:"const",exported:!0},{re:nt(String.raw`^\s*exports\.${ot}\s*=`),kind:"const",exported:!0},{re:nt(String.raw`^\s*module\.exports\.${ot}\s*=`),kind:"const",exported:!0},{re:nt(String.raw`^\s*(?:const|let)\s+${ot}\s*=\s*(?:async\s*)?\([^)]*\)\s*(?::[^=]+)?=>`),kind:"const",exported:!1},{re:nt(String.raw`^${At}(?:const|let|var)\s+${ot}\s*[:=]`),kind:"const",exported:!1},{re:nt(String.raw`^\s*export\s+default\s+${ot}\s*;?\s*$`),kind:"default",exported:!0}],Qx=/^\s*export\s+default\s+(?:async\s+)?(?:function|class)?\s*(?:\(|\{|extends\b)/,eS=/^\s*export\s+default\s+(?:async\s+)?(?:function|class)\s+(?!extends\b)[\w$]+/;qm=/export\s*\{([^}]*)\}\s*(from\b)?/g,Vm=/module\.exports\s*=\s*\{([^}]*)\}/g,Jm=/(^|\n)[ \t]*export(?:\s+default\s+|\s*=\s*)([A-Za-z_$][\w$]*)[ \t]*;?[ \t]*(?=\r?\n|$)/g;Km={lang:"javascript/typescript",exts:[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"],lexis:{mask:vr,comment:/^\s*\/\//,block:!0,decoration:/^\s*@/},extract(e,t,n=t){let r=e.match(/\.(ts|tsx|mts|cts)$/)?"typescript":"javascript",o=xe(e,t,r,Yx,n),s=n.split(/\r?\n/);for(let a=0;a{"use strict";$();tt();ma=e=>!e.startsWith("_")||e.startsWith("__"),rS=[{re:/^(?:async\s+)?def\s+(?[\w]+)\s*\(/,kind:"function",exported:e=>ma(e.groups.name)},{re:/^\s+(?:async\s+)?def\s+(?[\w]+)\s*\(/,kind:"method",exported:e=>ma(e.groups.name)},{re:/^class\s+(?[\w]+)/,kind:"class",exported:e=>ma(e.groups.name)},{re:/^\s+class\s+(?[\w]+)/,kind:"class",exported:e=>ma(e.groups.name)}],Zm={lang:"python",exts:[".py",".pyi"],lexis:{comment:/^\s*#(?!!)/,decoration:/^\s*@/},extract(e,t){return xe(e,t,"python",rS)}}});function Qm(e){return[{re:new RegExp(String.raw`${e}(?${Ee})${pa}\s+struct\b`,"u"),kind:"struct",exported:An},{re:new RegExp(String.raw`${e}(?${Ee})${pa}\s+interface\b`,"u"),kind:"interface",exported:An},{re:new RegExp(String.raw`${e}(?${Ee})${pa}\s+`,"u"),kind:"type",exported:An}]}function lS(e,t,n){let r=[],o=t.split(/\r?\n/),s=n.split(/\r?\n/);for(let a=0;a{"use strict";$();ft();tt();sS=e=>/^\p{Lu}/u.test(e),An=e=>sS(e.groups.name),pa=String.raw`(?:\[[^\]]*\])?`,iS=[{re:new RegExp(String.raw`^func\s+\([^)]*\)\s+(?${Ee})\s*\(`,"u"),kind:"method",exported:An},{re:new RegExp(String.raw`^func\s+(?${Ee})${pa}\s*\(`,"u"),kind:"function",exported:An},...Qm("^type\\s+"),{re:new RegExp(String.raw`^const\s+(?(?!_\b)${Ee})`,"u"),kind:"const",exported:An},{re:new RegExp(String.raw`^var\s+(?(?!_\b)${Ee})`,"u"),kind:"var",exported:An}];oS=/^(const|var|type)\s*\(\s*$/,aS={const:[{re:new RegExp(String.raw`^\s+(?(?!_\b)${Ee})\b`,"u"),kind:"const",exported:An}],var:[{re:new RegExp(String.raw`^\s+(?(?!_\b)${Ee})\b`,"u"),kind:"var",exported:An}],type:Qm("^\\s+")};ep={lang:"go",exts:[".go"],lexis:{mask:e=>Ye(e,{squote:"char",backtick:!0}),comment:/^\s*\/\//,block:!0},extract(e,t,n){let r=xe(e,t,"go",iS,n),o=n===void 0?[]:lS(e,t,n);return o.length?[...r,...o].sort((s,a)=>s.line-a.line):r}}});var cS,np,rp=H(()=>{"use strict";$();tt();cS=[{re:/^\s*def\s+(?:self\.)?(?[\w?!=]+)/,kind:"method",exported:!0},{re:/^\s*(?public|private|protected|module_function|(?:public|private)_class_method)\s+def\s+(?:self\.)?(?[\w?!=]+)/,kind:"method",exported:e=>/^(public|module_function|public_class_method)$/.test(e.groups.vis)},{re:/^\s*class\s+(?[\w:]+)/,kind:"class",exported:!0},{re:/^\s*module\s+(?[\w:]+)/,kind:"module",exported:!0}],np={lang:"ruby",exts:[".rb",".rake"],lexis:{comment:/^\s*#(?![!{])/},extract(e,t){return xe(e,t,"ruby",cS)}}});var dS,sp,ip=H(()=>{"use strict";$();ft();tt();dS=[{re:/^\s*(?:public|protected|private)?\s*(?:abstract\s+|final\s+)?class\s+(?[\w]+)/,kind:"class",exported:(e,t)=>/\bpublic\b/.test(t)},{re:/^\s*(?:public|protected|private)?\s*interface\s+(?[\w]+)/,kind:"interface",exported:(e,t)=>/\bpublic\b/.test(t)},{re:/^\s*(?:public|protected|private)?\s*enum\s+(?[\w]+)/,kind:"enum",exported:(e,t)=>/\bpublic\b/.test(t)},{re:/^\s*(?:public|protected|private)\s+(?:static\s+|final\s+|abstract\s+|synchronized\s+)*[\w<>\[\],.?\s]+\s+(?[\w]+)\s*\(/,kind:"method",exported:(e,t)=>/\bpublic\b/.test(t)}],sp={lang:"java",exts:[".java"],lexis:{mask:e=>Ye(e,{triple:!0,squote:"char"}),comment:/^\s*\/\//,block:!0,decoration:/^\s*@/},extract(e,t,n){return xe(e,t,"java",dS,n)}}});var hi,uS,op,ap=H(()=>{"use strict";$();ft();tt();hi=(e,t)=>/^\s*pub\b/.test(t),uS=[{re:/^\s*(?:pub(?:\([^)]*\))?\s+)?(?:async\s+)?(?:unsafe\s+)?fn\s+(?[\w]+)/,kind:"function",exported:hi},{re:/^\s*(?:pub(?:\([^)]*\))?\s+)?struct\s+(?[\w]+)/,kind:"struct",exported:hi},{re:/^\s*(?:pub(?:\([^)]*\))?\s+)?enum\s+(?[\w]+)/,kind:"enum",exported:hi},{re:/^\s*(?:pub(?:\([^)]*\))?\s+)?trait\s+(?[\w]+)/,kind:"trait",exported:hi},{re:/^\s*(?:pub(?:\([^)]*\))?\s+)?type\s+(?[\w]+)/,kind:"type",exported:hi}],op={lang:"rust",exts:[".rs"],lexis:{mask:e=>Ye(e,{nested:!0,squote:"char",multiline:!0,raw:"r"}),comment:/^\s*\/\/(?!!)/,block:!0,decoration:/^\s*#\[/},extract(e,t,n){return xe(e,t,"rust",uS,n)}}});var yi,fS,lp,cp=H(()=>{"use strict";$();ft();tt();yi=(e,t)=>/\b(public|internal)\b/.test(t),fS=[{re:/^\s*(?:public|internal|protected|private)?\s*(?:static\s+|sealed\s+|abstract\s+|partial\s+)*(?:class|record)\s+(?\w+)/,kind:"class",exported:yi},{re:/^\s*(?:public|internal|protected|private)?\s*(?:partial\s+)?interface\s+(?\w+)/,kind:"interface",exported:yi},{re:/^\s*(?:public|internal|protected|private)?\s*(?:readonly\s+)?(?:ref\s+)?struct\s+(?\w+)/,kind:"struct",exported:yi},{re:/^\s*(?:public|internal|protected|private)?\s*enum\s+(?\w+)/,kind:"enum",exported:yi},{re:/^\s*(?:public|internal|protected|private)\s+(?:static\s+|virtual\s+|override\s+|async\s+|sealed\s+|abstract\s+|new\s+)*[\w<>\[\],.?]+\s+(?\w+)\s*(?:<[^>]*>)?\s*\(/,kind:"method",exported:yi}],lp={lang:"csharp",exts:[".cs"],lexis:{mask:e=>Ye(e,{squote:"char"}),comment:/^\s*\/\//,block:!0,decoration:/^\s*\[/},extract(e,t,n){return xe(e,t,"csharp",fS,n)}}});var mS,dp,up=H(()=>{"use strict";$();ft();tt();mS=[{re:/^\s*(?:abstract\s+|final\s+)*class\s+(?\w+)/,kind:"class",exported:!0},{re:/^\s*interface\s+(?\w+)/,kind:"interface",exported:!0},{re:/^\s*trait\s+(?\w+)/,kind:"trait",exported:!0},{re:/^\s*enum\s+(?\w+)/,kind:"enum",exported:!0},{re:/^\s*(?:public\s+|protected\s+|private\s+|static\s+|abstract\s+|final\s+)*function\s+(?\w+)\s*\(/,kind:"function",exported:(e,t)=>!/\b(private|protected)\b/.test(t)}],dp={lang:"php",exts:[".php"],lexis:{mask:e=>Ye(e,{hash:!0,squote:"string",multiline:!0}),comment:/^\s*(?:\/\/|#(?!\[))/,block:!0,decoration:/^\s*#\[/},extract(e,t,n){return xe(e,t,"php",mS,n)}}});var hs,pS,gS,ys,Rr,hS,fp,mp=H(()=>{"use strict";$();ft();tt();hs=(e,t)=>!/\b(?:private|fileprivate)\b(?!\s*\(\s*set\s*\))/.test(t),pS=String.raw`(?:@${Ee}(?:\([^)]*\))?\s+)*`,gS=String.raw`(?:(?:public|open|internal|private|fileprivate|package|final|static|class|override|mutating|nonmutating|convenience|required|dynamic|lazy|weak|unowned|indirect|nonisolated|isolated|distributed|optional|prefix|postfix|infix|async)(?:\([^)]*\))?\s+)*`,ys=String.raw`^\s*${pS}${gS}`,Rr=(e,t,n={})=>({re:new RegExp(String.raw`${ys}${e}\s+(?!(?:func|var|let|subscript|init)\b)(?${Ee})`,"u"),kind:t,exported:hs,...n}),hS=[Rr("class","class"),Rr("struct","struct"),Rr("enum","enum"),Rr("protocol","protocol"),Rr("actor","actor"),{re:new RegExp(String.raw`${ys}extension\s+(?${Ee}(?:\.${Ee})*)`,"u"),kind:"extension",exported:hs},Rr("typealias","type"),Rr("func","function"),{re:new RegExp(String.raw`${ys}(?init)[?!]?\s*[<(]`,"u"),kind:"constructor",exported:hs},{re:new RegExp(String.raw`${ys}(?deinit)\s*\{`,"u"),kind:"destructor",exported:hs},{re:new RegExp(String.raw`${ys}(?subscript)\s*[<(]`,"u"),kind:"method",exported:hs},{re:new RegExp(String.raw`${ys}(?:let|var)\s+(?${Ee})\s*[:={]`,"u"),kind:"property",exported:hs,scope:"member"}],fp={lang:"swift",exts:[".swift"],lexis:{mask:e=>Ye(e,{nested:!0,triple:!0,squote:"none",raw:"#"}),comment:/^\s*\/\//,block:!0,decoration:/^\s*@/},extract(e,t,n){return xe(e,t,"swift",hS,n)}}});var Kn,yS,_S,Xn,pp,bS,gp,hp=H(()=>{"use strict";$();ft();tt();Kn=(e,t)=>!/\bprivate\b/.test(t),yS=String.raw`(?:@[\w.:]+(?:\([^)]*\))?\s+)*`,_S=String.raw`(?:(?:public|internal|private|protected|abstract|sealed|open|final|data|value|inline|inner|override|suspend|operator|infix|tailrec|external|lateinit|expect|actual|const|companion|enum|annotation)\s+)*`,Xn=String.raw`^\s*${yS}${_S}`,pp=String.raw`(?:${Ee}(?:<[^()=]*>)?\??\.)*`,bS=[{re:new RegExp(String.raw`${Xn}enum\s+class\s+(?${Ee})`,"u"),kind:"enum",exported:Kn},{re:new RegExp(String.raw`${Xn}annotation\s+class\s+(?${Ee})`,"u"),kind:"annotation",exported:Kn},{re:new RegExp(String.raw`${Xn}class\s+(?${Ee})`,"u"),kind:"class",exported:Kn},{re:new RegExp(String.raw`${Xn}(?:fun\s+)?interface\s+(?${Ee})`,"u"),kind:"interface",exported:Kn},{re:new RegExp(String.raw`${Xn}object\s+(?${Ee})`,"u"),kind:"object",exported:Kn},{re:new RegExp(String.raw`${Xn}typealias\s+(?${Ee})`,"u"),kind:"type",exported:Kn},{re:new RegExp(String.raw`${Xn}fun\s+(?:<[^>]*(?:>[^>]*)?>\s*)?${pp}(?${Ee})\s*\(`,"u"),kind:"function",exported:Kn},{re:new RegExp(String.raw`${Xn}(?:val|var)\s+(?:<[^>]*>\s*)?${pp}(?${Ee})\s*(?:[:=]|by\b)`,"u"),kind:"property",exported:Kn,scope:"member"}],gp={lang:"kotlin",exts:[".kt",".kts"],lexis:{mask:e=>Ye(e,{nested:!0,triple:!0,squote:"char"}),comment:/^\s*\/\//,block:!0,decoration:/^\s*@/},extract(e,t,n){return xe(e,t,"kotlin",bS,n)}}});var wS,xS,yp,_p=H(()=>{"use strict";$();ft();tt();wS="(?!\\s*(?:if|for|while|switch|return|else|do|sizeof|typedef)\\b)",xS=[{re:/^\s*(?:class|struct)\s+(?[A-Za-z_]\w+)\s*(?:[:{]|$)/,kind:"class",exported:!0},{re:/^\s*namespace\s+(?[A-Za-z_]\w+)/,kind:"namespace",exported:!0},{re:/^\s*(?:typedef\s+)?(?:struct|enum|union)\s+(?[A-Za-z_]\w+)\s*\{/,kind:"struct",exported:!0},{re:new RegExp(`^${wS}[A-Za-z_][\\w\\s\\*&<>:,]*?\\b(?[A-Za-z_]\\w+)\\s*\\([^;{]*\\)\\s*(?:const)?\\s*\\{?\\s*$`),kind:"function",exported:!0}],yp={lang:"c/cpp",exts:[".c",".h",".cc",".cpp",".cxx",".hpp",".hh"],lexis:{mask:e=>Ye(e,{squote:"char"}),comment:/^\s*\/\//,block:!0},extract(e,t,n){return xe(e,t,e.match(/\.(c|h)$/)?"c":"cpp",xS,n)}}});var SS,bp,wp=H(()=>{"use strict";$();tt();SS=[{re:/^\s*local\s+function\s+(?[\w.:]+)\s*\(/,kind:"function",exported:!1},{re:/^\s*function\s+(?[\w.:]+)\s*\(/,kind:"function",exported:!0},{re:/^\s*(?:local\s+)?(?[\w.]+)\s*=\s*function\s*\(/,kind:"function",exported:!0}],bp={lang:"lua",exts:[".lua"],lexis:{comment:/^\s*--/},extract(e,t){return xe(e,t,"lua",SS).map(n=>{let r=Math.max(n.name.lastIndexOf("."),n.name.lastIndexOf(":"));return r>0&&r{"use strict";$();tt();kS=[{re:/^\s*function\s+(?[\w:-]+)\s*(?:\(\))?\s*\{?/,kind:"function",exported:!0},{re:/^\s*(?[A-Za-z_][\w:-]*)\s*\(\)\s*\{?/,kind:"function",exported:!0}],xp={lang:"shell",exts:[".sh",".bash",".zsh",".ksh"],lexis:{comment:/^\s*#(?!!)/},extract(e,t){return xe(e,t,"shell",kS)}}});var ES,kp,Ep=H(()=>{"use strict";$();tt();ES=[{re:/^\s*defmodule\s+(?[\w.]+)/,kind:"module",exported:!0},{re:/^\s*defp\s+(?[\w?!]+)/,kind:"function",exported:!1},{re:/^\s*def\s+(?[\w?!]+)/,kind:"function",exported:!0},{re:/^\s*defmacrop\s+(?[\w?!]+)/,kind:"macro",exported:!1},{re:/^\s*defmacro\s+(?[\w?!]+)/,kind:"macro",exported:!0},{re:/^\s*defguardp\s+(?[\w?!]+)/,kind:"guard",exported:!1},{re:/^\s*defguard\s+(?[\w?!]+)/,kind:"guard",exported:!0}],kp={lang:"elixir",exts:[".ex",".exs"],lexis:{comment:/^\s*#/,decoration:/^\s*@(?!(?:doc|moduledoc|typedoc)\b)\w+/,docAttr:!0},extract(e,t){return xe(e,t,"elixir",ES)}}});var vS,vp,Rp=H(()=>{"use strict";$();ft();tt();vS=[{re:/^\s*(?:final\s+|sealed\s+|abstract\s+|implicit\s+)*(?:case\s+)?class\s+(?\w+)/,kind:"class",exported:!0},{re:/^\s*(?:sealed\s+)?trait\s+(?\w+)/,kind:"trait",exported:!0},{re:/^\s*(?:case\s+)?object\s+(?\w+)/,kind:"object",exported:!0},{re:/^\s*(?:override\s+|final\s+|private\s+|protected\s+|implicit\s+)*def\s+(?\w+)/,kind:"def",exported:(e,t)=>!/\b(private|protected)\b/.test(t)}],vp={lang:"scala",exts:[".scala",".sc"],lexis:{mask:e=>Ye(e,{nested:!0,triple:!0,squote:"char"}),comment:/^\s*\/\//,block:!0,decoration:/^\s*@/},extract(e,t,n){return xe(e,t,"scala",vS,n)}}});function AS(e,t,n,r){let o=[],s=n.split(/\r?\n/),a=t.split(/\r?\n/),l,c=0,d;for(let u=0;uc?p:-1),p!==d||r.has(u+1))continue;let g=MS.exec(f);if(!g||g.groups.type!==l)continue;let h=g.groups.name??l;o.push({name:h,kind:"constructor",file:e,line:u+1,signature:a[u].trim().slice(0,200),exported:!h.startsWith("_")&&!l.startsWith("_"),lang:"dart"})}return o}var sn,ha,ga,Cp,Mp,RS,CS,MS,Ap,Ip=H(()=>{"use strict";$();ft();tt();sn=e=>!(e.groups?.name??"").startsWith("_"),ha=String.raw`(?:@[\w$.]+(?:\([^)]*\))?\s+)*`,ga=String.raw`(?!(?:return|await|throw|new|else|if|for|while|do|switch|yield|case|const|final|var|late|factory|get|set|is|as|in)\b)[\w$.]+(?:<[^;{}()=]*>)?\??`,Cp=String.raw`(?!(?:if|for|while|switch|catch|return|assert|super|this|Function)\b)`,Mp=String.raw`\((?:[^()]|\([^()]*\))*(?:\)\s*(?:async\s*\*?|sync\s*\*)?\s*(?:=>|\{|;)|$)`,RS=[{re:/^\s*(?:(?:abstract|base|final|sealed|interface|mixin)\s+)*class\s+(?[\w$]+)/,kind:"class",exported:sn},{re:/^\s*(?:base\s+)?mixin\s+(?[\w$]+)/,kind:"mixin",exported:sn},{re:/^\s*extension\s+(?:type\s+(?:const\s+)?)?(?!on\b)(?[\w$]+)/,kind:"extension",exported:sn},{re:/^\s*enum\s+(?[\w$]+)/,kind:"enum",exported:sn},{re:/^\s*typedef\s+(?[\w$]+)/,kind:"type",exported:sn},{re:new RegExp(String.raw`^\s*${ha}(?:(?:static|external)\s+)*(?:${ga}\s+)?get\s+(?[\w$]+)\s*(?:=>|\{|;|async\b|sync\b)`),kind:"getter",exported:sn},{re:new RegExp(String.raw`^\s*${ha}(?:(?:static|external)\s+)*(?:void\s+)?set\s+(?[\w$]+)\s*\(`),kind:"setter",exported:sn},{re:new RegExp(String.raw`^\s*${ha}(?:(?:static|external)\s+)*${ga}\s+${Cp}(?[\w$]+)\s*(?:<[^()]*>)?\s*${Mp}`),kind:"function",exported:sn},{re:new RegExp(String.raw`^${Cp}(?[\w$]+)\s*(?:<[^()]*>)?\s*${Mp}`),kind:"function",exported:sn},{re:new RegExp(String.raw`^(?:const|final)\s+(?:${ga}\s+)?(?[\w$]+)\s*[=;]`),kind:"const",exported:sn},{re:new RegExp(String.raw`^(?:late\s+final|late|var)\s+(?:${ga}\s+)?(?[\w$]+)\s*[=;]`),kind:"var",exported:sn}],CS=/^(?\s*)(?:(?:abstract|base|final|sealed|interface|mixin)\s+)*(?:class|enum|mixin|extension(?:\s+type(?:\s+const)?)?)\s+(?[\w$]+)/,MS=new RegExp(String.raw`^(?\s*)${ha}(?:(?:const|factory|external)\s+)*(?[\w$]+)(?:\.(?[\w$]+))?\s*\(`);Ap={lang:"dart",exts:[".dart"],lexis:{mask:e=>Ye(e,{nested:!0,triple:!0,squote:"string"}),comment:/^\s*\/\//,block:!0,decoration:/^\s*@/},extract(e,t,n=t){let r=xe(e,t,"dart",RS,n),o=AS(e,t,n,new Set(r.map(s=>s.line)));return o.length?[...r,...o].sort((s,a)=>s.line-a.line):r}}});function Qc(e,t,n){let r=Yc.get(t),o;if(!r)o=[];else try{let l=r.lexis,c=l?.mask?.(n);o=r.extract(e,n,c),l&&(o=Fm(o,n,l,c))}catch{o=[]}let s=new Set(o.map(l=>l.name)),a=la(e,n,o).filter(l=>!s.has(l.name));return a.length?[...o,...a]:o}function ed(e){return Yc.get(e)?.lang??rn(e)}var IS,Yc,Cr=H(()=>{"use strict";$();tt();Xm();Ym();tp();rp();ip();ap();cp();up();mp();hp();_p();wp();Sp();Ep();Rp();Ip();IS=[Km,Zm,ep,np,sp,op,lp,dp,fp,gp,yp,bp,xp,kp,vp,Ap],Yc=new Map;for(let e of IS)for(let t of e.exts)Yc.set(t,e)});function $p(e,t){let n=e.split("/").pop().toLowerCase();return TS.has(t)||$S.test(n)||FS.test(e)}function PS(e,t){let n=e.split("/").pop().toLowerCase();return OS.has(n)||NS.has(t)}function Tp(e){return!LS.has(ed(e))}function mt(e,t){return Tp(t)?"code":$p(e,t)?"doc":PS(e,t)?"config":"other"}var $S,TS,FS,OS,NS,td,LS,In=H(()=>{"use strict";$();Cr();$S=/^(readme|changelog|contributing|history|news|authors|notice|security|code_of_conduct|faq|getting[-_]?started|usage|guide|tutorial)\b/i,TS=new Set([".md",".mdx",".rst",".adoc",".txt"]),FS=/^(docs?|documentation|wiki|guides?|website|site|book)\//i,OS=new Set(["package.json","pnpm-workspace.yaml","tsconfig.json","jsconfig.json","pyproject.toml","setup.py","setup.cfg","requirements.txt","pipfile","go.mod","cargo.toml","gemfile","pom.xml","build.gradle","build.gradle.kts","composer.json","mix.exs","pubspec.yaml","build.sbt","dockerfile","docker-compose.yml","docker-compose.yaml","makefile",".env.example","manifest.json"]),NS=new Set([".json",".yaml",".yml",".toml",".ini",".cfg"]),td=new Set([".md",".mdx"]);LS=new Set(["markdown","restructuredtext","text","json","yaml","toml","ini","other","html","css","scss"])});function nd(e){let t="";for(let n=0;nt.some(r=>r.test(n))}function rd(e){if(!e||e.length===0)return null;let t=e.map(n=>n.split("/").map(r=>r.includes("**")?null:nd(r)));return n=>{let r=n.split("/");return t.some(o=>{for(let s=0;sn.endsWith("/**")&&n.length>3).map(n=>nd(n.slice(0,-3)));return t.length===0?null:n=>t.some(r=>r.test(n))}function Op(e){if(!e||e.length===0)return null;let t=It(e.filter(r=>!r.startsWith("!"))),n=It(e.filter(r=>r.startsWith("!")).map(r=>r.slice(1)));return r=>(!t||t(r))&&!n?.(r)}var _i=H(()=>{"use strict";$();et()});function DS(e){let t=e.split(/\r?\n/),n=[],r=null,o=!1,s=!1,a=!0;for(let l of t){if(r){r.test(l)&&(r=null),n.push("");continue}let c=/^\s*(`{3,}|~{3,})/.exec(l);if(c){r=new RegExp(`^\\s*${c[1][0]}{${c[1].length},}\\s*$`),s=!1,a=!1,n.push("");continue}let d=!l.trim(),u=/^(?: {4}|\t)/.test(l);if(s&&(d||u)){n.push("");continue}if(s=!1,u&&a&&!o){s=!0,n.push("");continue}d||(/^ {0,3}(?:[-*+]|\d+[.)])(?:\s|$)/.test(l)?o=!0:a&&!/^\s/.test(l)&&(o=!1)),a=d,n.push(l)}return n.join(` -`)}function jS(e){return!e||e.startsWith("#")||e.startsWith("//")?!0:/^[a-z][a-z0-9+.-]*:/i.test(e)}function Np(e){return e.replace(/!\[[^\]]*\]\([^)]*\)/g,"").replace(/`([^`]*)`/g,"$1").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/[#>*_~-]+/g," ").replace(/\s+/g," ").trim()}function WS(e){return/[A-Za-zÀ-ɏ]{3,}/.test(e)}function BS(e){return/^(all notable changes to this project|in the interest of fostering|this project adheres to|we as members and leaders|table of contents)\b/i.test(e)}function zS(e){let t=e.trim();return!!t&&!/^ {4}|^\t/.test(e)&&!/^([-*+]|\d+[.)])(\s|$)/.test(t)&&!/^[>|<]/.test(t)}function GS(e,t){let n=1;for(let r=t;rt?e.slice(t,r):void 0}}}function sd(e){let t=e,n,r=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/.exec(t);if(r){let y=/(^|\n)title:\s*["']?(.+?)["']?\s*(\n|$)/i.exec(r[1]);y&&(n=y[2].trim()),t=t.slice(r[0].length)}let o=DS(t),s=o.split(/\r?\n/),a=[],l=n,c,d=!1,u=(y,b)=>{let S=Np(b);a.push(S),!l&&y===1&&(l=S),!c&&y>=2&&(d=!0)};for(let y=0;y");)y++;continue}if(!c&&!d&&R&&!/^([-*+]|\d+\.)\s/.test(R)&&!R.startsWith("|")&&!R.startsWith("<")){let I=Np(R);I.length>=8&&WS(I)&&!I.endsWith(":")&&!BS(I)&&(c=I.slice(0,200))}}let f=[],m=new Set,p=y=>{let b=y.trim();b=b.replace(/\s+["'(].*$/,"").trim(),b=b.replace(/^<|>$/g,""),!jS(b)&&(m.has(b)||(m.add(b),f.push({kind:"doc-link",spec:b})))},g=/!?\[[^\]]*\]\(/g,h;for(;h=g.exec(o);){let y=GS(o,g.lastIndex);y&&p(y)}let _=/^[^\S\r\n]*\[(?!\^)[^\]]+\]:\s+(\S+)/gm;for(;h=_.exec(o);)p(h[1]);return{title:l,summary:c,headings:a,refs:f}}var US,HS,id=H(()=>{"use strict";$();US=/^ {0,3}(=+|-+)\s*$/;HS=/^>\s*\[!(?:note|tip|important|warning|caution)\]\s*$/i});function qS(e,t){if(!ya.test(e))return!1;let n=e.trimEnd().length;return n>=[...t.trim()].length||n>=4}function Pp(e){return e.replace(/``([^`]+)``/g,"$1").replace(/:[\w:.+-]+:`([^`<]*?)\s*<[^`>]*>`/g,"$1").replace(/:doc:`([^`]*)`/g,(t,n)=>n.slice(n.lastIndexOf("/")+1)).replace(/:[\w:.+-]+:`!?~?([^`]*)`/g,(t,n)=>n.startsWith("~")?n.slice(n.lastIndexOf(".")+1):n).replace(/`([^`<]*?)\s*<[^`>]*>`__?/g,"$1").replace(/`([^`]+)`__?/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/\|([^|\s][^|]*)\|/g,"$1").replace(/\s+/g," ").trim()}function od(e,t,n,r){let o=t.trim();if(!o||o==="self"||/[:*?[\]\s]/.test(o))return;if(!o.startsWith("/")){r({kind:"doc-link",spec:o+n});return}let s=e.split("/").length-1;for(let a=0;a<=s;a++)r({kind:"doc-link",spec:"../".repeat(a)+o.slice(1)+n,soft:!0})}function ld(e,t){let n=t.split(/\r?\n/),r=[],o,s,a=[],l=!1,c=[],d=new Set,u=y=>{let b=`${y.soft?"~":""}${y.spec}`;d.has(b)||(d.add(b),c.push(y))},f=(y,b)=>{let S=a.indexOf(y);S===-1&&(S=a.push(y)-1);let k=Pp(b);r.push(k),o||(o=k),S>0&&!s&&(l=!0)},m=y=>!(n[y]??"").trim();for(let y=0;y]+)>\s*$/.exec(C);od(e,M?M[1]:C,".rst",u)}else KS.has(R)||p(v)}y=P-1;continue}if(/^\s*\.\.(?:\s|$)/.test(b)){y=g(y);continue}p(b),!s&&!l&&h(y)&&(s=_(y)),/::\s*$/.test(b)&&(y=g(y))}return{title:o,summary:s,headings:r,refs:c};function p(y){for(let b of y.matchAll(JS))od(e,b[1]??b[2],".rst",u)}function g(y){let b=ad(n[y]);for(;y+1b);)y++;return y}function h(y){let b=n[y];return!!b.trim()&&!/^\s/.test(b)&&(y===0||m(y-1))}function _(y){if(/^(?:[-*+•]\s|#\.\s|\d+[.)]\s|\(?[a-z0-9]\)\s|[+=|]|:[^:\s][^:]*:(?:\s|$))/i.test(n[y]))return;let b=[];for(let R=y;R{"use strict";$();ya=/^([!-/:-@[-`{-~])\1+\s*$/;ad=e=>e.length-e.trimStart().length,VS=/^(\s*)\.\.\s+([\w:-]+)::\s*(.*)$/,JS=/:doc:`(?:[^`<]*<([^`>]+)>|([^`]+))`/g,KS=new Set(["code-block","code","sourcecode","literalinclude","doctest","testcode","testoutput","testsetup","testcleanup","ipython","math","raw","graphviz","productionlist","highlight","jinja"])});function ek(e){return e.lengthLp?!1:QS.test(e)}function tk(e){let t=e.trim();return!t||t.length>Lp||YS.has(t)?!1:Number.isFinite(Number(t))}function dd(e){let t=e,n=/^(?:[rRbBuUfF]{1,2}|@|\$)?(?:#*)?(['"`])/.exec(t);if(n){let r=n[1],o=t.indexOf(r),s=t.lastIndexOf(r),a=t.startsWith(r.repeat(3),o)&&s-o>=5&&t.endsWith(r.repeat(3),s+1)?3:1;s>o&&(t=t.slice(o+a,s+1-a))}return t}var Lp,XS,ZS,YS,QS,Zn,_a=H(()=>{"use strict";$();ce();Lp=80,XS=2,ZS=256,YS=new Set(["0","1","-1","2","-2"]),QS=/[\p{L}\p{N}]/u;Zn=class{seen=new Set;out=[];get full(){return this.out.length>=ZS}add(t,n,r){if(this.full||t==="string"&&!ek(n)||t==="number"&&!tk(n)||t==="regex"&&!n)return;let o=`${t}\0${n}\0${r}`;this.seen.has(o)||(this.seen.add(o),this.out.push({value:n,line:r,kind:t}))}addString(t,n){this.add("string",dd(t),n)}result(){if(this.out.length)return this.out.sort((t,n)=>T(t.value,n.value)||t.line-n.line||T(t.kind,n.kind))}}});function ba(){return"/home"}function Dp(){return"/tmp"}function wa(){return typeof navigator<"u"&&navigator?.hardwareConcurrency?navigator.hardwareConcurrency:1}function jp(){return Array.from({length:wa()},()=>({model:"browser",speed:0,times:{user:0,nice:0,sys:0,idle:0,irq:0}}))}var bi=H(()=>{$()});function xa(e){let t=typeof e=="string"?e:e.href;try{return decodeURIComponent(new URL(t).pathname)}catch{return t}}function Mr(e){return new URL(`file://${e.startsWith("/")?"":"/"}${e}`)}var wi=H(()=>{$()});var ud={};Rc(ud,{createRequire:()=>rk,default:()=>sk});var rk,sk,fd=H(()=>{$();rk=()=>{throw new Error("node-only API in the browser build")},sk={}});function _s(e){if(e!==Yn)throw new Error("Illegal constructor")}function Si(e){return!!e&&typeof e.row=="number"&&typeof e.column=="number"}function Vp(e){A=e}function bs(e){try{return new FinalizationRegistry(e)}catch(t){console.error("Unsupported FinalizationRegistry:",t);return}}function _d(e,t,n,r){let o=n-t,s=e.textCallback(t,r);if(s){for(t+=s.length;t0)t+=a.length,s+=a;else break}t>n&&(s=s.slice(0,o))}return s??""}function yd(e,t,n,r,o){for(let s=0,a=o.length;s>>0,column:A.getValue(e+ee,"i32")>>>0}}function Kp(e,t){jt(e,t.startPosition),e+=_n,jt(e,t.endPosition),e+=_n,A.setValue(e,t.startIndex,"i32"),e+=ee,A.setValue(e,t.endIndex,"i32"),e+=ee}function ka(e){let t={};return t.startPosition=Ar(e),e+=_n,t.endPosition=Ar(e),e+=_n,t.startIndex=A.getValue(e,"i32")>>>0,e+=ee,t.endIndex=A.getValue(e,"i32")>>>0,t}function Xp(e,t=Y){jt(t,e.startPosition),t+=_n,jt(t,e.oldEndPosition),t+=_n,jt(t,e.newEndPosition),t+=_n,A.setValue(t,e.startIndex,"i32"),t+=ee,A.setValue(t,e.oldEndIndex,"i32"),t+=ee,A.setValue(t,e.newEndIndex,"i32"),t+=ee}function Zp(e){let t=A.getValue(e,"i32"),n=A.getValue(e+=ee,"i32"),r=A.getValue(e+=ee,"i32");return{major_version:t,minor_version:n,patch_version:r}}async function Yp(moduleArg={}){var moduleRtn,Module=moduleArg,ENVIRONMENT_IS_WEB=typeof window=="object",ENVIRONMENT_IS_WORKER=typeof WorkerGlobalScope<"u",ENVIRONMENT_IS_NODE=typeof F=="object"&&F.versions?.node&&F.type!="renderer";if(ENVIRONMENT_IS_NODE){let{createRequire:e}=await Promise.resolve().then(()=>(fd(),ud));var require=e(import.meta.url)}Module.currentQueryProgressCallback=null,Module.currentProgressCallback=null,Module.currentLogCallback=null,Module.currentParseCallback=null;var arguments_=[],thisProgram="./this.program",quit_=D((e,t)=>{throw t},"quit_"),_scriptName=import.meta.url,scriptDirectory="";function locateFile(e){return Module.locateFile?Module.locateFile(e,scriptDirectory):scriptDirectory+e}D(locateFile,"locateFile");var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("fs");_scriptName.startsWith("file:")&&(scriptDirectory=require("path").dirname(require("url").fileURLToPath(_scriptName))+"/"),readBinary=D(e=>{e=isFileURI(e)?new URL(e):e;var t=fs.readFileSync(e);return t},"readBinary"),readAsync=D(async(e,t=!0)=>{e=isFileURI(e)?new URL(e):e;var n=fs.readFileSync(e,t?void 0:"utf8");return n},"readAsync"),F.argv.length>1&&(thisProgram=F.argv[1].replace(/\\/g,"/")),arguments_=F.argv.slice(2),quit_=D((e,t)=>{throw F.exitCode=e,t},"quit_")}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}ENVIRONMENT_IS_WORKER&&(readBinary=D(e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)},"readBinary")),readAsync=D(async e=>{if(isFileURI(e))return new Promise((n,r)=>{var o=new XMLHttpRequest;o.open("GET",e,!0),o.responseType="arraybuffer",o.onload=()=>{if(o.status==200||o.status==0&&o.response){n(o.response);return}r(o.status)},o.onerror=r,o.send(null)});var t=await fetch(e,{credentials:"same-origin"});if(t.ok)return t.arrayBuffer();throw new Error(t.status+" : "+t.url)},"readAsync")}var out=console.log.bind(console),err=console.error.bind(console),dynamicLibraries=[],wasmBinary,ABORT=!1,EXITSTATUS,isFileURI=D(e=>e.startsWith("file://"),"isFileURI"),readyPromiseResolve,readyPromiseReject,wasmMemory,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64,HEAP64,HEAPU64,HEAP_DATA_VIEW,runtimeInitialized=!1;function updateMemoryViews(){var e=wasmMemory.buffer;Module.HEAP8=HEAP8=new Int8Array(e),Module.HEAP16=HEAP16=new Int16Array(e),Module.HEAPU8=HEAPU8=new Uint8Array(e),Module.HEAPU16=HEAPU16=new Uint16Array(e),Module.HEAP32=HEAP32=new Int32Array(e),Module.HEAPU32=HEAPU32=new Uint32Array(e),Module.HEAPF32=HEAPF32=new Float32Array(e),Module.HEAPF64=HEAPF64=new Float64Array(e),Module.HEAP64=HEAP64=new BigInt64Array(e),Module.HEAPU64=HEAPU64=new BigUint64Array(e),Module.HEAP_DATA_VIEW=HEAP_DATA_VIEW=new DataView(e),LE_HEAP_UPDATE()}D(updateMemoryViews,"updateMemoryViews");function initMemory(){if(Module.wasmMemory)wasmMemory=Module.wasmMemory;else{var e=Module.INITIAL_MEMORY||33554432;wasmMemory=new WebAssembly.Memory({initial:e/65536,maximum:32768})}updateMemoryViews()}D(initMemory,"initMemory");var __RELOC_FUNCS__=[];function preRun(){if(Module.preRun)for(typeof Module.preRun=="function"&&(Module.preRun=[Module.preRun]);Module.preRun.length;)addOnPreRun(Module.preRun.shift());callRuntimeCallbacks(onPreRuns)}D(preRun,"preRun");function initRuntime(){runtimeInitialized=!0,callRuntimeCallbacks(__RELOC_FUNCS__),wasmExports.__wasm_call_ctors(),callRuntimeCallbacks(onPostCtors)}D(initRuntime,"initRuntime");function preMain(){}D(preMain,"preMain");function postRun(){if(Module.postRun)for(typeof Module.postRun=="function"&&(Module.postRun=[Module.postRun]);Module.postRun.length;)addOnPostRun(Module.postRun.shift());callRuntimeCallbacks(onPostRuns)}D(postRun,"postRun");function abort(e){Module.onAbort?.(e),e="Aborted("+e+")",err(e),ABORT=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw readyPromiseReject?.(t),t}D(abort,"abort");var wasmBinaryFile;function findWasmBinary(){return Module.locateFile?locateFile("web-tree-sitter.wasm"):new URL("web-tree-sitter.wasm",import.meta.url).href}D(findWasmBinary,"findWasmBinary");function getBinarySync(e){if(e==wasmBinaryFile&&wasmBinary)return new Uint8Array(wasmBinary);if(readBinary)return readBinary(e);throw"both async and sync fetching of the wasm failed"}D(getBinarySync,"getBinarySync");async function getWasmBinary(e){if(!wasmBinary)try{var t=await readAsync(e);return new Uint8Array(t)}catch{}return getBinarySync(e)}D(getWasmBinary,"getWasmBinary");async function instantiateArrayBuffer(e,t){try{var n=await getWasmBinary(e),r=await WebAssembly.instantiate(n,t);return r}catch(o){err(`failed to asynchronously prepare wasm: ${o}`),abort(o)}}D(instantiateArrayBuffer,"instantiateArrayBuffer");async function instantiateAsync(e,t,n){if(!e&&!isFileURI(t)&&!ENVIRONMENT_IS_NODE)try{var r=fetch(t,{credentials:"same-origin"}),o=await WebAssembly.instantiateStreaming(r,n);return o}catch(s){err(`wasm streaming compile failed: ${s}`),err("falling back to ArrayBuffer instantiation")}return instantiateArrayBuffer(t,n)}D(instantiateAsync,"instantiateAsync");function getWasmImports(){return{env:wasmImports,wasi_snapshot_preview1:wasmImports,"GOT.mem":new Proxy(wasmImports,GOTHandler),"GOT.func":new Proxy(wasmImports,GOTHandler)}}D(getWasmImports,"getWasmImports");async function createWasm(){function e(s,a){wasmExports=s.exports,wasmExports=relocateExports(wasmExports,1024);var l=getDylinkMetadata(a);return l.neededDynlibs&&(dynamicLibraries=l.neededDynlibs.concat(dynamicLibraries)),mergeLibSymbols(wasmExports,"main"),LDSO.init(),loadDylibs(),__RELOC_FUNCS__.push(wasmExports.__wasm_apply_data_relocs),assignWasmExports(wasmExports),wasmExports}D(e,"receiveInstance");function t(s){return e(s.instance,s.module)}D(t,"receiveInstantiationResult");var n=getWasmImports();if(Module.instantiateWasm)return new Promise((s,a)=>{Module.instantiateWasm(n,(l,c)=>{s(e(l,c))})});wasmBinaryFile??=findWasmBinary();var r=await instantiateAsync(wasmBinary,wasmBinaryFile,n),o=t(r);return o}D(createWasm,"createWasm");class ExitStatus{static{D(this,"ExitStatus")}name="ExitStatus";constructor(t){this.message=`Program terminated with exit(${t})`,this.status=t}}var GOT={},currentModuleWeakSymbols=new Set([]),GOTHandler={get(e,t){var n=GOT[t];return n||(n=GOT[t]=new WebAssembly.Global({value:"i32",mutable:!0})),currentModuleWeakSymbols.has(t)||(n.required=!0),n}},LE_ATOMICS_NATIVE_BYTE_ORDER=[],LE_HEAP_LOAD_F32=D(e=>HEAP_DATA_VIEW.getFloat32(e,!0),"LE_HEAP_LOAD_F32"),LE_HEAP_LOAD_F64=D(e=>HEAP_DATA_VIEW.getFloat64(e,!0),"LE_HEAP_LOAD_F64"),LE_HEAP_LOAD_I16=D(e=>HEAP_DATA_VIEW.getInt16(e,!0),"LE_HEAP_LOAD_I16"),LE_HEAP_LOAD_I32=D(e=>HEAP_DATA_VIEW.getInt32(e,!0),"LE_HEAP_LOAD_I32"),LE_HEAP_LOAD_I64=D(e=>HEAP_DATA_VIEW.getBigInt64(e,!0),"LE_HEAP_LOAD_I64"),LE_HEAP_LOAD_U32=D(e=>HEAP_DATA_VIEW.getUint32(e,!0),"LE_HEAP_LOAD_U32"),LE_HEAP_STORE_F32=D((e,t)=>HEAP_DATA_VIEW.setFloat32(e,t,!0),"LE_HEAP_STORE_F32"),LE_HEAP_STORE_F64=D((e,t)=>HEAP_DATA_VIEW.setFloat64(e,t,!0),"LE_HEAP_STORE_F64"),LE_HEAP_STORE_I16=D((e,t)=>HEAP_DATA_VIEW.setInt16(e,t,!0),"LE_HEAP_STORE_I16"),LE_HEAP_STORE_I32=D((e,t)=>HEAP_DATA_VIEW.setInt32(e,t,!0),"LE_HEAP_STORE_I32"),LE_HEAP_STORE_I64=D((e,t)=>HEAP_DATA_VIEW.setBigInt64(e,t,!0),"LE_HEAP_STORE_I64"),LE_HEAP_STORE_U32=D((e,t)=>HEAP_DATA_VIEW.setUint32(e,t,!0),"LE_HEAP_STORE_U32"),callRuntimeCallbacks=D(e=>{for(;e.length>0;)e.shift()(Module)},"callRuntimeCallbacks"),onPostRuns=[],addOnPostRun=D(e=>onPostRuns.push(e),"addOnPostRun"),onPreRuns=[],addOnPreRun=D(e=>onPreRuns.push(e),"addOnPreRun"),UTF8Decoder=typeof TextDecoder<"u"?new TextDecoder:void 0,findStringEnd=D((e,t,n,r)=>{var o=t+n;if(r)return o;for(;e[t]&&!(t>=o);)++t;return t},"findStringEnd"),UTF8ArrayToString=D((e,t=0,n,r)=>{var o=findStringEnd(e,t,n,r);if(o-t>16&&e.buffer&&UTF8Decoder)return UTF8Decoder.decode(e.subarray(t,o));for(var s="";t>10,56320|d&1023)}}return s},"UTF8ArrayToString"),getDylinkMetadata=D(e=>{var t=0,n=0;function r(){return e[t++]}D(r,"getU8");function o(){for(var w=0,E=1;;){var N=e[t++];if(w+=(N&127)*E,E*=128,!(N&128))break}return w}D(o,"getLEB");function s(){var w=o();return t+=w,UTF8ArrayToString(e,t-w,w)}D(s,"getString");function a(){for(var w=o(),E=[];w--;)E.push(s());return E}D(a,"getStringList");function l(w,E){if(w)throw new Error(E)}if(D(l,"failIf"),e instanceof WebAssembly.Module){var c=WebAssembly.Module.customSections(e,"dylink.0");l(c.length===0,"need dylink section"),e=new Uint8Array(c[0]),n=e.length}else{var d=new Uint32Array(new Uint8Array(e.subarray(0,24)).buffer),u=d[0]==1836278016||d[0]==6386541;l(!u,"need to see wasm magic number"),l(e[8]!==0,"need the dylink section to be first"),t=9;var f=o();n=t+f;var m=s();l(m!=="dylink.0")}for(var p={neededDynlibs:[],tlsExports:new Set,weakImports:new Set,runtimePaths:[]},g=1,h=2,_=3,y=4,b=5,S=256,k=3,R=1;t>1)*2);case"i32":return LE_HEAP_LOAD_I32((e>>2)*4);case"i64":return LE_HEAP_LOAD_I64((e>>3)*8);case"float":return LE_HEAP_LOAD_F32((e>>2)*4);case"double":return LE_HEAP_LOAD_F64((e>>3)*8);case"*":return LE_HEAP_LOAD_U32((e>>2)*4);default:abort(`invalid type for getValue: ${t}`)}}D(getValue,"getValue");var newDSO=D((e,t,n)=>{var r={refcount:1/0,name:e,exports:n,global:!0};return LDSO.loadedLibsByName[e]=r,t!=null&&(LDSO.loadedLibsByHandle[t]=r),r},"newDSO"),LDSO={loadedLibsByName:{},loadedLibsByHandle:{},init(){newDSO("__main__",0,wasmImports)}},___heap_base=82240,alignMemory=D((e,t)=>Math.ceil(e/t)*t,"alignMemory"),getMemory=D(e=>{if(runtimeInitialized)return _calloc(e,1);var t=___heap_base,n=t+alignMemory(e,16);return ___heap_base=n,GOT.__heap_base.value=n,t},"getMemory"),isInternalSym=D(e=>["__cpp_exception","__c_longjmp","__wasm_apply_data_relocs","__dso_handle","__tls_size","__tls_align","__set_stack_limits","_emscripten_tls_init","__wasm_init_tls","__wasm_call_ctors","__start_em_asm","__stop_em_asm","__start_em_js","__stop_em_js"].includes(e)||e.startsWith("__em_js__"),"isInternalSym"),uleb128EncodeWithLen=D(e=>{let t=e.length;return[t%128|128,t>>7,...e]},"uleb128EncodeWithLen"),wasmTypeCodes={i:127,p:127,j:126,f:125,d:124,e:111},generateTypePack=D(e=>uleb128EncodeWithLen(Array.from(e,t=>{var n=wasmTypeCodes[t];return n})),"generateTypePack"),convertJsFunctionToWasm=D((e,t)=>{var n=Uint8Array.of(0,97,115,109,1,0,0,0,1,...uleb128EncodeWithLen([1,96,...generateTypePack(t.slice(1)),...generateTypePack(t[0]==="v"?"":t[0])]),2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),r=new WebAssembly.Module(n),o=new WebAssembly.Instance(r,{e:{f:e}}),s=o.exports.f;return s},"convertJsFunctionToWasm"),wasmTableMirror=[],wasmTable=new WebAssembly.Table({initial:31,element:"anyfunc"}),getWasmTableEntry=D(e=>{var t=wasmTableMirror[e];return t||(wasmTableMirror[e]=t=wasmTable.get(e)),t},"getWasmTableEntry"),updateTableMap=D((e,t)=>{if(functionsInTableMap)for(var n=e;n(functionsInTableMap||(functionsInTableMap=new WeakMap,updateTableMap(0,wasmTable.length)),functionsInTableMap.get(e)||0),"getFunctionAddress"),freeTableIndexes=[],getEmptyTableSlot=D(()=>freeTableIndexes.length?freeTableIndexes.pop():wasmTable.grow(1),"getEmptyTableSlot"),setWasmTableEntry=D((e,t)=>{wasmTable.set(e,t),wasmTableMirror[e]=wasmTable.get(e)},"setWasmTableEntry"),addFunction=D((e,t)=>{var n=getFunctionAddress(e);if(n)return n;var r=getEmptyTableSlot();try{setWasmTableEntry(r,e)}catch(s){if(!(s instanceof TypeError))throw s;var o=convertJsFunctionToWasm(e,t);setWasmTableEntry(r,o)}return functionsInTableMap.set(e,r),r},"addFunction"),updateGOT=D((e,t)=>{for(var n in e)if(!isInternalSym(n)){var r=e[n];GOT[n]||=new WebAssembly.Global({value:"i32",mutable:!0}),(t||GOT[n].value==0)&&(typeof r=="function"?GOT[n].value=addFunction(r):typeof r=="number"?GOT[n].value=r:err(`unhandled export type for '${n}': ${typeof r}`))}},"updateGOT"),relocateExports=D((e,t,n)=>{var r={};for(var o in e){var s=e[o];typeof s=="object"&&(s=s.value),typeof s=="number"&&(s+=t),r[o]=s}return updateGOT(r,n),r},"relocateExports"),isSymbolDefined=D(e=>{var t=wasmImports[e];return!(!t||t.stub)},"isSymbolDefined"),dynCall=D((e,t,n=[],r=!1)=>{var o=getWasmTableEntry(t),s=o(...n);function a(l){return l}return D(a,"convert"),s},"dynCall"),stackSave=D(()=>_emscripten_stack_get_current(),"stackSave"),stackRestore=D(e=>__emscripten_stack_restore(e),"stackRestore"),createInvokeFunction=D(e=>(t,...n)=>{var r=stackSave();try{return dynCall(e,t,n)}catch(o){if(stackRestore(r),o!==o+0)throw o;if(_setThrew(1,0),e[0]=="j")return 0n}},"createInvokeFunction"),resolveGlobalSymbol=D((e,t=!1)=>{var n;return isSymbolDefined(e)?n=wasmImports[e]:e.startsWith("invoke_")&&(n=wasmImports[e]=createInvokeFunction(e.split("_")[1])),{sym:n,name:e}},"resolveGlobalSymbol"),onPostCtors=[],addOnPostCtor=D(e=>onPostCtors.push(e),"addOnPostCtor"),UTF8ToString=D((e,t,n)=>e?UTF8ArrayToString(HEAPU8,e,t,n):"","UTF8ToString"),loadWebAssemblyModule=D((binary,flags,libName,localScope,handle)=>{var metadata=getDylinkMetadata(binary);function loadModule(){var memAlign=Math.pow(2,metadata.memoryAlign),memoryBase=metadata.memorySize?alignMemory(getMemory(metadata.memorySize+memAlign),memAlign):0,tableBase=metadata.tableSize?wasmTable.length:0;handle&&(HEAP8[handle+8]=1,LE_HEAP_STORE_U32((handle+12>>2)*4,memoryBase),LE_HEAP_STORE_I32((handle+16>>2)*4,metadata.memorySize),LE_HEAP_STORE_U32((handle+20>>2)*4,tableBase),LE_HEAP_STORE_I32((handle+24>>2)*4,metadata.tableSize)),metadata.tableSize&&wasmTable.grow(metadata.tableSize);var moduleExports;function resolveSymbol(e){var t=resolveGlobalSymbol(e).sym;return!t&&localScope&&(t=localScope[e]),t||(t=moduleExports[e]),t}D(resolveSymbol,"resolveSymbol");var proxyHandler={get(e,t){switch(t){case"__memory_base":return memoryBase;case"__table_base":return tableBase}if(t in wasmImports&&!wasmImports[t].stub){var n=wasmImports[t];return n}if(!(t in e)){var r;e[t]=(...o)=>(r||=resolveSymbol(t),r(...o))}return e[t]}},proxy=new Proxy({},proxyHandler);currentModuleWeakSymbols=metadata.weakImports;var info={"GOT.mem":new Proxy({},GOTHandler),"GOT.func":new Proxy({},GOTHandler),env:proxy,wasi_snapshot_preview1:proxy};function postInstantiation(module,instance){updateTableMap(tableBase,metadata.tableSize),moduleExports=relocateExports(instance.exports,memoryBase),flags.allowUndefined||reportUndefinedSymbols();function addEmAsm(addr,body){for(var args=[],arity=0;arity<16&&body.indexOf("$"+arity)!=-1;arity++)args.push("$"+arity);args=args.join(",");var func=`(${args}) => { ${body} };`;ASM_CONSTS[start]=eval(func)}if(D(addEmAsm,"addEmAsm"),"__start_em_asm"in moduleExports)for(var start=moduleExports.__start_em_asm,stop=moduleExports.__stop_em_asm;start ${body};`;moduleExports[name]=eval(func)}D(addEmJs,"addEmJs");for(var name in moduleExports)if(name.startsWith("__em_js__")){var start=moduleExports[name],jsString=UTF8ToString(start),parts=jsString.split("<::>");addEmJs(name.replace("__em_js__",""),parts[0],parts[1]),delete moduleExports[name]}var applyRelocs=moduleExports.__wasm_apply_data_relocs;applyRelocs&&(runtimeInitialized?applyRelocs():__RELOC_FUNCS__.push(applyRelocs));var init=moduleExports.__wasm_call_ctors;return init&&(runtimeInitialized?init():addOnPostCtor(init)),moduleExports}if(D(postInstantiation,"postInstantiation"),flags.loadAsync)return(async()=>{var e;return binary instanceof WebAssembly.Module?e=new WebAssembly.Instance(binary,info):{module:binary,instance:e}=await WebAssembly.instantiate(binary,info),postInstantiation(binary,e)})();var module=binary instanceof WebAssembly.Module?binary:new WebAssembly.Module(binary),instance=new WebAssembly.Instance(module,info);return postInstantiation(module,instance)}return D(loadModule,"loadModule"),flags={...flags,rpath:{parentLibPath:libName,paths:metadata.runtimePaths}},flags.loadAsync?metadata.neededDynlibs.reduce((e,t)=>e.then(()=>loadDynamicLibrary(t,flags,localScope)),Promise.resolve()).then(loadModule):(metadata.neededDynlibs.forEach(e=>loadDynamicLibrary(e,flags,localScope)),loadModule())},"loadWebAssemblyModule"),mergeLibSymbols=D((e,t)=>{for(var[n,r]of Object.entries(e)){let o=D(a=>{isSymbolDefined(a)||(wasmImports[a]=r)},"setImport");o(n);let s="__main_argc_argv";n=="main"&&o(s),n==s&&o("main")}},"mergeLibSymbols"),asyncLoad=D(async e=>{var t=await readAsync(e);return new Uint8Array(t)},"asyncLoad");function loadDynamicLibrary(e,t={global:!0,nodelete:!0},n,r){var o=LDSO.loadedLibsByName[e];if(o)return t.global?o.global||(o.global=!0,mergeLibSymbols(o.exports,e)):n&&Object.assign(n,o.exports),t.nodelete&&o.refcount!==1/0&&(o.refcount=1/0),o.refcount++,r&&(LDSO.loadedLibsByHandle[r]=o),t.loadAsync?Promise.resolve(!0):!0;o=newDSO(e,r,"loading"),o.refcount=t.nodelete?1/0:1,o.global=t.global;function s(){if(r){var c=LE_HEAP_LOAD_U32((r+28>>2)*4),d=LE_HEAP_LOAD_U32((r+32>>2)*4);if(c&&d){var u=HEAP8.slice(c,c+d);return t.loadAsync?Promise.resolve(u):u}}var f=locateFile(e);if(t.loadAsync)return asyncLoad(f);if(!readBinary)throw new Error(`${f}: file not found, and synchronous loading of external files is not available`);return readBinary(f)}D(s,"loadLibData");function a(){return t.loadAsync?s().then(c=>loadWebAssemblyModule(c,t,e,n,r)):loadWebAssemblyModule(s(),t,e,n,r)}D(a,"getExports");function l(c){o.global?mergeLibSymbols(c,e):n&&Object.assign(n,c),o.exports=c}return D(l,"moduleLoaded"),t.loadAsync?a().then(c=>(l(c),!0)):(l(a()),!0)}D(loadDynamicLibrary,"loadDynamicLibrary");var reportUndefinedSymbols=D(()=>{for(var[e,t]of Object.entries(GOT))if(t.value==0){var n=resolveGlobalSymbol(e,!0).sym;if(!n&&!t.required)continue;if(typeof n=="function")t.value=addFunction(n,n.sig);else if(typeof n=="number")t.value=n;else throw new Error(`bad export type for '${e}': ${typeof n}`)}},"reportUndefinedSymbols"),runDependencies=0,dependenciesFulfilled=null,removeRunDependency=D(e=>{if(runDependencies--,Module.monitorRunDependencies?.(runDependencies),runDependencies==0&&dependenciesFulfilled){var t=dependenciesFulfilled;dependenciesFulfilled=null,t()}},"removeRunDependency"),addRunDependency=D(e=>{runDependencies++,Module.monitorRunDependencies?.(runDependencies)},"addRunDependency"),loadDylibs=D(async()=>{if(!dynamicLibraries.length){reportUndefinedSymbols();return}addRunDependency("loadDylibs");for(var e of dynamicLibraries)await loadDynamicLibrary(e,{loadAsync:!0,global:!0,nodelete:!0,allowUndefined:!0});reportUndefinedSymbols(),removeRunDependency("loadDylibs")},"loadDylibs"),noExitRuntime=!0;function setValue(e,t,n="i8"){switch(n.endsWith("*")&&(n="*"),n){case"i1":HEAP8[e]=t;break;case"i8":HEAP8[e]=t;break;case"i16":LE_HEAP_STORE_I16((e>>1)*2,t);break;case"i32":LE_HEAP_STORE_I32((e>>2)*4,t);break;case"i64":LE_HEAP_STORE_I64((e>>3)*8,BigInt(t));break;case"float":LE_HEAP_STORE_F32((e>>2)*4,t);break;case"double":LE_HEAP_STORE_F64((e>>3)*8,t);break;case"*":LE_HEAP_STORE_U32((e>>2)*4,t);break;default:abort(`invalid type for setValue: ${n}`)}}D(setValue,"setValue");var ___memory_base=new WebAssembly.Global({value:"i32",mutable:!1},1024),___stack_high=82240,___stack_low=16704,___stack_pointer=new WebAssembly.Global({value:"i32",mutable:!0},82240),___table_base=new WebAssembly.Global({value:"i32",mutable:!1},1),__abort_js=D(()=>abort(""),"__abort_js");__abort_js.sig="v";var getHeapMax=D(()=>2147483648,"getHeapMax"),growMemory=D(e=>{var t=wasmMemory.buffer.byteLength,n=(e-t+65535)/65536|0;try{return wasmMemory.grow(n),updateMemoryViews(),1}catch{}},"growMemory"),_emscripten_resize_heap=D(e=>{var t=HEAPU8.length;e>>>=0;var n=getHeapMax();if(e>n)return!1;for(var r=1;r<=4;r*=2){var o=t*(1+.2/r);o=Math.min(o,e+100663296);var s=Math.min(n,alignMemory(Math.max(e,o),65536)),a=growMemory(s);if(a)return!0}return!1},"_emscripten_resize_heap");_emscripten_resize_heap.sig="ip";var _fd_close=D(e=>52,"_fd_close");_fd_close.sig="ii";var INT53_MAX=9007199254740992,INT53_MIN=-9007199254740992,bigintToI53Checked=D(e=>eINT53_MAX?NaN:Number(e),"bigintToI53Checked");function _fd_seek(e,t,n,r){return t=bigintToI53Checked(t),70}D(_fd_seek,"_fd_seek"),_fd_seek.sig="iijip";var printCharBuffers=[null,[],[]],printChar=D((e,t)=>{var n=printCharBuffers[e];t===0||t===10?((e===1?out:err)(UTF8ArrayToString(n)),n.length=0):n.push(t)},"printChar"),_fd_write=D((e,t,n,r)=>{for(var o=0,s=0;s>2)*4),l=LE_HEAP_LOAD_U32((t+4>>2)*4);t+=8;for(var c=0;c>2)*4,o),0},"_fd_write");_fd_write.sig="iippp";function _tree_sitter_log_callback(e,t){if(Module.currentLogCallback){let n=UTF8ToString(t);Module.currentLogCallback(n,e!==0)}}D(_tree_sitter_log_callback,"_tree_sitter_log_callback");function _tree_sitter_parse_callback(e,t,n,r,o){let a=Module.currentParseCallback(t,{row:n,column:r});typeof a=="string"?(setValue(o,a.length,"i32"),stringToUTF16(a,e,10240)):setValue(o,0,"i32")}D(_tree_sitter_parse_callback,"_tree_sitter_parse_callback");function _tree_sitter_progress_callback(e,t){return Module.currentProgressCallback?Module.currentProgressCallback({currentOffset:e,hasError:t}):!1}D(_tree_sitter_progress_callback,"_tree_sitter_progress_callback");function _tree_sitter_query_progress_callback(e){return Module.currentQueryProgressCallback?Module.currentQueryProgressCallback({currentOffset:e}):!1}D(_tree_sitter_query_progress_callback,"_tree_sitter_query_progress_callback");var runtimeKeepaliveCounter=0,keepRuntimeAlive=D(()=>noExitRuntime||runtimeKeepaliveCounter>0,"keepRuntimeAlive"),_proc_exit=D(e=>{EXITSTATUS=e,keepRuntimeAlive()||(Module.onExit?.(e),ABORT=!0),quit_(e,new ExitStatus(e))},"_proc_exit");_proc_exit.sig="vi";var exitJS=D((e,t)=>{EXITSTATUS=e,_proc_exit(e)},"exitJS"),handleException=D(e=>{if(e instanceof ExitStatus||e=="unwind")return EXITSTATUS;quit_(1,e)},"handleException"),lengthBytesUTF8=D(e=>{for(var t=0,n=0;n=55296&&r<=57343?(t+=4,++n):t+=3}return t},"lengthBytesUTF8"),stringToUTF8Array=D((e,t,n,r)=>{if(!(r>0))return 0;for(var o=n,s=n+r-1,a=0;a=s)break;t[n++]=l}else if(l<=2047){if(n+1>=s)break;t[n++]=192|l>>6,t[n++]=128|l&63}else if(l<=65535){if(n+2>=s)break;t[n++]=224|l>>12,t[n++]=128|l>>6&63,t[n++]=128|l&63}else{if(n+3>=s)break;t[n++]=240|l>>18,t[n++]=128|l>>12&63,t[n++]=128|l>>6&63,t[n++]=128|l&63,a++}}return t[n]=0,n-o},"stringToUTF8Array"),stringToUTF8=D((e,t,n)=>stringToUTF8Array(e,HEAPU8,t,n),"stringToUTF8"),stackAlloc=D(e=>__emscripten_stack_alloc(e),"stackAlloc"),stringToUTF8OnStack=D(e=>{var t=lengthBytesUTF8(e)+1,n=stackAlloc(t);return stringToUTF8(e,n,t),n},"stringToUTF8OnStack"),AsciiToString=D(e=>{for(var t="";;){var n=HEAPU8[e++];if(!n)return t;t+=String.fromCharCode(n)}},"AsciiToString"),stringToUTF16=D((e,t,n)=>{if(n??=2147483647,n<2)return 0;n-=2;for(var r=t,o=n>1)*2,a),t+=2}return LE_HEAP_STORE_I16((t>>1)*2,0),t-r},"stringToUTF16");LE_ATOMICS_NATIVE_BYTE_ORDER=new Int8Array(new Int16Array([1]).buffer)[0]===1?[(e=>e),(e=>e),void 0,(e=>e)]:[(e=>e),(e=>((e&65280)<<8|(e&255)<<24)>>16),void 0,(e=>e>>24&255|e>>8&65280|(e&65280)<<8|(e&255)<<24)];function LE_HEAP_UPDATE(){HEAPU16.unsigned=(e=>e&65535),HEAPU32.unsigned=(e=>e>>>0)}if(D(LE_HEAP_UPDATE,"LE_HEAP_UPDATE"),initMemory(),Module.noExitRuntime&&(noExitRuntime=Module.noExitRuntime),Module.print&&(out=Module.print),Module.printErr&&(err=Module.printErr),Module.dynamicLibraries&&(dynamicLibraries=Module.dynamicLibraries),Module.wasmBinary&&(wasmBinary=Module.wasmBinary),Module.arguments&&(arguments_=Module.arguments),Module.thisProgram&&(thisProgram=Module.thisProgram),Module.preInit)for(typeof Module.preInit=="function"&&(Module.preInit=[Module.preInit]);Module.preInit.length>0;)Module.preInit.shift()();Module.setValue=setValue,Module.getValue=getValue,Module.UTF8ToString=UTF8ToString,Module.stringToUTF8=stringToUTF8,Module.lengthBytesUTF8=lengthBytesUTF8,Module.AsciiToString=AsciiToString,Module.stringToUTF16=stringToUTF16,Module.loadWebAssemblyModule=loadWebAssemblyModule,Module.LE_HEAP_STORE_I64=LE_HEAP_STORE_I64;var ASM_CONSTS={},_malloc,_calloc,_realloc,_free,_ts_range_edit,_memcmp,_ts_language_symbol_count,_ts_language_state_count,_ts_language_abi_version,_ts_language_name,_ts_language_field_count,_ts_language_next_state,_ts_language_symbol_name,_ts_language_symbol_for_name,_strncmp,_ts_language_symbol_type,_ts_language_field_name_for_id,_ts_lookahead_iterator_new,_ts_lookahead_iterator_delete,_ts_lookahead_iterator_reset_state,_ts_lookahead_iterator_reset,_ts_lookahead_iterator_next,_ts_lookahead_iterator_current_symbol,_ts_point_edit,_ts_parser_delete,_ts_parser_reset,_ts_parser_set_language,_ts_parser_set_included_ranges,_ts_query_new,_ts_query_delete,_iswspace,_iswalnum,_ts_query_copy,_ts_query_pattern_count,_ts_query_capture_count,_ts_query_string_count,_ts_query_capture_name_for_id,_ts_query_capture_quantifier_for_id,_ts_query_string_value_for_id,_ts_query_predicates_for_pattern,_ts_query_start_byte_for_pattern,_ts_query_end_byte_for_pattern,_ts_query_is_pattern_rooted,_ts_query_is_pattern_non_local,_ts_query_is_pattern_guaranteed_at_step,_ts_query_disable_capture,_ts_query_disable_pattern,_ts_tree_copy,_ts_tree_delete,_ts_init,_ts_parser_new_wasm,_ts_parser_enable_logger_wasm,_ts_parser_parse_wasm,_ts_parser_included_ranges_wasm,_ts_language_type_is_named_wasm,_ts_language_type_is_visible_wasm,_ts_language_metadata_wasm,_ts_language_supertypes_wasm,_ts_language_subtypes_wasm,_ts_tree_root_node_wasm,_ts_tree_root_node_with_offset_wasm,_ts_tree_edit_wasm,_ts_tree_included_ranges_wasm,_ts_tree_get_changed_ranges_wasm,_ts_tree_cursor_new_wasm,_ts_tree_cursor_copy_wasm,_ts_tree_cursor_delete_wasm,_ts_tree_cursor_reset_wasm,_ts_tree_cursor_reset_to_wasm,_ts_tree_cursor_goto_first_child_wasm,_ts_tree_cursor_goto_last_child_wasm,_ts_tree_cursor_goto_first_child_for_index_wasm,_ts_tree_cursor_goto_first_child_for_position_wasm,_ts_tree_cursor_goto_next_sibling_wasm,_ts_tree_cursor_goto_previous_sibling_wasm,_ts_tree_cursor_goto_descendant_wasm,_ts_tree_cursor_goto_parent_wasm,_ts_tree_cursor_current_node_type_id_wasm,_ts_tree_cursor_current_node_state_id_wasm,_ts_tree_cursor_current_node_is_named_wasm,_ts_tree_cursor_current_node_is_missing_wasm,_ts_tree_cursor_current_node_id_wasm,_ts_tree_cursor_start_position_wasm,_ts_tree_cursor_end_position_wasm,_ts_tree_cursor_start_index_wasm,_ts_tree_cursor_end_index_wasm,_ts_tree_cursor_current_field_id_wasm,_ts_tree_cursor_current_depth_wasm,_ts_tree_cursor_current_descendant_index_wasm,_ts_tree_cursor_current_node_wasm,_ts_node_symbol_wasm,_ts_node_field_name_for_child_wasm,_ts_node_field_name_for_named_child_wasm,_ts_node_children_by_field_id_wasm,_ts_node_first_child_for_byte_wasm,_ts_node_first_named_child_for_byte_wasm,_ts_node_grammar_symbol_wasm,_ts_node_child_count_wasm,_ts_node_named_child_count_wasm,_ts_node_child_wasm,_ts_node_named_child_wasm,_ts_node_child_by_field_id_wasm,_ts_node_next_sibling_wasm,_ts_node_prev_sibling_wasm,_ts_node_next_named_sibling_wasm,_ts_node_prev_named_sibling_wasm,_ts_node_descendant_count_wasm,_ts_node_parent_wasm,_ts_node_child_with_descendant_wasm,_ts_node_descendant_for_index_wasm,_ts_node_named_descendant_for_index_wasm,_ts_node_descendant_for_position_wasm,_ts_node_named_descendant_for_position_wasm,_ts_node_start_point_wasm,_ts_node_end_point_wasm,_ts_node_start_index_wasm,_ts_node_end_index_wasm,_ts_node_to_string_wasm,_ts_node_children_wasm,_ts_node_named_children_wasm,_ts_node_descendants_of_type_wasm,_ts_node_is_named_wasm,_ts_node_has_changes_wasm,_ts_node_has_error_wasm,_ts_node_is_error_wasm,_ts_node_is_missing_wasm,_ts_node_is_extra_wasm,_ts_node_parse_state_wasm,_ts_node_next_parse_state_wasm,_ts_query_matches_wasm,_ts_query_captures_wasm,_memset,_memcpy,_memmove,_iswalpha,_iswblank,_iswdigit,_iswlower,_iswpunct,_iswupper,_iswxdigit,_memchr,_strlen,_strcmp,_strncat,_strncpy,_towlower,_towupper,_setThrew,__emscripten_stack_restore,__emscripten_stack_alloc,_emscripten_stack_get_current,___wasm_apply_data_relocs;function assignWasmExports(e){Module._malloc=_malloc=e.malloc,Module._calloc=_calloc=e.calloc,Module._realloc=_realloc=e.realloc,Module._free=_free=e.free,Module._ts_range_edit=_ts_range_edit=e.ts_range_edit,Module._memcmp=_memcmp=e.memcmp,Module._ts_language_symbol_count=_ts_language_symbol_count=e.ts_language_symbol_count,Module._ts_language_state_count=_ts_language_state_count=e.ts_language_state_count,Module._ts_language_abi_version=_ts_language_abi_version=e.ts_language_abi_version,Module._ts_language_name=_ts_language_name=e.ts_language_name,Module._ts_language_field_count=_ts_language_field_count=e.ts_language_field_count,Module._ts_language_next_state=_ts_language_next_state=e.ts_language_next_state,Module._ts_language_symbol_name=_ts_language_symbol_name=e.ts_language_symbol_name,Module._ts_language_symbol_for_name=_ts_language_symbol_for_name=e.ts_language_symbol_for_name,Module._strncmp=_strncmp=e.strncmp,Module._ts_language_symbol_type=_ts_language_symbol_type=e.ts_language_symbol_type,Module._ts_language_field_name_for_id=_ts_language_field_name_for_id=e.ts_language_field_name_for_id,Module._ts_lookahead_iterator_new=_ts_lookahead_iterator_new=e.ts_lookahead_iterator_new,Module._ts_lookahead_iterator_delete=_ts_lookahead_iterator_delete=e.ts_lookahead_iterator_delete,Module._ts_lookahead_iterator_reset_state=_ts_lookahead_iterator_reset_state=e.ts_lookahead_iterator_reset_state,Module._ts_lookahead_iterator_reset=_ts_lookahead_iterator_reset=e.ts_lookahead_iterator_reset,Module._ts_lookahead_iterator_next=_ts_lookahead_iterator_next=e.ts_lookahead_iterator_next,Module._ts_lookahead_iterator_current_symbol=_ts_lookahead_iterator_current_symbol=e.ts_lookahead_iterator_current_symbol,Module._ts_point_edit=_ts_point_edit=e.ts_point_edit,Module._ts_parser_delete=_ts_parser_delete=e.ts_parser_delete,Module._ts_parser_reset=_ts_parser_reset=e.ts_parser_reset,Module._ts_parser_set_language=_ts_parser_set_language=e.ts_parser_set_language,Module._ts_parser_set_included_ranges=_ts_parser_set_included_ranges=e.ts_parser_set_included_ranges,Module._ts_query_new=_ts_query_new=e.ts_query_new,Module._ts_query_delete=_ts_query_delete=e.ts_query_delete,Module._iswspace=_iswspace=e.iswspace,Module._iswalnum=_iswalnum=e.iswalnum,Module._ts_query_copy=_ts_query_copy=e.ts_query_copy,Module._ts_query_pattern_count=_ts_query_pattern_count=e.ts_query_pattern_count,Module._ts_query_capture_count=_ts_query_capture_count=e.ts_query_capture_count,Module._ts_query_string_count=_ts_query_string_count=e.ts_query_string_count,Module._ts_query_capture_name_for_id=_ts_query_capture_name_for_id=e.ts_query_capture_name_for_id,Module._ts_query_capture_quantifier_for_id=_ts_query_capture_quantifier_for_id=e.ts_query_capture_quantifier_for_id,Module._ts_query_string_value_for_id=_ts_query_string_value_for_id=e.ts_query_string_value_for_id,Module._ts_query_predicates_for_pattern=_ts_query_predicates_for_pattern=e.ts_query_predicates_for_pattern,Module._ts_query_start_byte_for_pattern=_ts_query_start_byte_for_pattern=e.ts_query_start_byte_for_pattern,Module._ts_query_end_byte_for_pattern=_ts_query_end_byte_for_pattern=e.ts_query_end_byte_for_pattern,Module._ts_query_is_pattern_rooted=_ts_query_is_pattern_rooted=e.ts_query_is_pattern_rooted,Module._ts_query_is_pattern_non_local=_ts_query_is_pattern_non_local=e.ts_query_is_pattern_non_local,Module._ts_query_is_pattern_guaranteed_at_step=_ts_query_is_pattern_guaranteed_at_step=e.ts_query_is_pattern_guaranteed_at_step,Module._ts_query_disable_capture=_ts_query_disable_capture=e.ts_query_disable_capture,Module._ts_query_disable_pattern=_ts_query_disable_pattern=e.ts_query_disable_pattern,Module._ts_tree_copy=_ts_tree_copy=e.ts_tree_copy,Module._ts_tree_delete=_ts_tree_delete=e.ts_tree_delete,Module._ts_init=_ts_init=e.ts_init,Module._ts_parser_new_wasm=_ts_parser_new_wasm=e.ts_parser_new_wasm,Module._ts_parser_enable_logger_wasm=_ts_parser_enable_logger_wasm=e.ts_parser_enable_logger_wasm,Module._ts_parser_parse_wasm=_ts_parser_parse_wasm=e.ts_parser_parse_wasm,Module._ts_parser_included_ranges_wasm=_ts_parser_included_ranges_wasm=e.ts_parser_included_ranges_wasm,Module._ts_language_type_is_named_wasm=_ts_language_type_is_named_wasm=e.ts_language_type_is_named_wasm,Module._ts_language_type_is_visible_wasm=_ts_language_type_is_visible_wasm=e.ts_language_type_is_visible_wasm,Module._ts_language_metadata_wasm=_ts_language_metadata_wasm=e.ts_language_metadata_wasm,Module._ts_language_supertypes_wasm=_ts_language_supertypes_wasm=e.ts_language_supertypes_wasm,Module._ts_language_subtypes_wasm=_ts_language_subtypes_wasm=e.ts_language_subtypes_wasm,Module._ts_tree_root_node_wasm=_ts_tree_root_node_wasm=e.ts_tree_root_node_wasm,Module._ts_tree_root_node_with_offset_wasm=_ts_tree_root_node_with_offset_wasm=e.ts_tree_root_node_with_offset_wasm,Module._ts_tree_edit_wasm=_ts_tree_edit_wasm=e.ts_tree_edit_wasm,Module._ts_tree_included_ranges_wasm=_ts_tree_included_ranges_wasm=e.ts_tree_included_ranges_wasm,Module._ts_tree_get_changed_ranges_wasm=_ts_tree_get_changed_ranges_wasm=e.ts_tree_get_changed_ranges_wasm,Module._ts_tree_cursor_new_wasm=_ts_tree_cursor_new_wasm=e.ts_tree_cursor_new_wasm,Module._ts_tree_cursor_copy_wasm=_ts_tree_cursor_copy_wasm=e.ts_tree_cursor_copy_wasm,Module._ts_tree_cursor_delete_wasm=_ts_tree_cursor_delete_wasm=e.ts_tree_cursor_delete_wasm,Module._ts_tree_cursor_reset_wasm=_ts_tree_cursor_reset_wasm=e.ts_tree_cursor_reset_wasm,Module._ts_tree_cursor_reset_to_wasm=_ts_tree_cursor_reset_to_wasm=e.ts_tree_cursor_reset_to_wasm,Module._ts_tree_cursor_goto_first_child_wasm=_ts_tree_cursor_goto_first_child_wasm=e.ts_tree_cursor_goto_first_child_wasm,Module._ts_tree_cursor_goto_last_child_wasm=_ts_tree_cursor_goto_last_child_wasm=e.ts_tree_cursor_goto_last_child_wasm,Module._ts_tree_cursor_goto_first_child_for_index_wasm=_ts_tree_cursor_goto_first_child_for_index_wasm=e.ts_tree_cursor_goto_first_child_for_index_wasm,Module._ts_tree_cursor_goto_first_child_for_position_wasm=_ts_tree_cursor_goto_first_child_for_position_wasm=e.ts_tree_cursor_goto_first_child_for_position_wasm,Module._ts_tree_cursor_goto_next_sibling_wasm=_ts_tree_cursor_goto_next_sibling_wasm=e.ts_tree_cursor_goto_next_sibling_wasm,Module._ts_tree_cursor_goto_previous_sibling_wasm=_ts_tree_cursor_goto_previous_sibling_wasm=e.ts_tree_cursor_goto_previous_sibling_wasm,Module._ts_tree_cursor_goto_descendant_wasm=_ts_tree_cursor_goto_descendant_wasm=e.ts_tree_cursor_goto_descendant_wasm,Module._ts_tree_cursor_goto_parent_wasm=_ts_tree_cursor_goto_parent_wasm=e.ts_tree_cursor_goto_parent_wasm,Module._ts_tree_cursor_current_node_type_id_wasm=_ts_tree_cursor_current_node_type_id_wasm=e.ts_tree_cursor_current_node_type_id_wasm,Module._ts_tree_cursor_current_node_state_id_wasm=_ts_tree_cursor_current_node_state_id_wasm=e.ts_tree_cursor_current_node_state_id_wasm,Module._ts_tree_cursor_current_node_is_named_wasm=_ts_tree_cursor_current_node_is_named_wasm=e.ts_tree_cursor_current_node_is_named_wasm,Module._ts_tree_cursor_current_node_is_missing_wasm=_ts_tree_cursor_current_node_is_missing_wasm=e.ts_tree_cursor_current_node_is_missing_wasm,Module._ts_tree_cursor_current_node_id_wasm=_ts_tree_cursor_current_node_id_wasm=e.ts_tree_cursor_current_node_id_wasm,Module._ts_tree_cursor_start_position_wasm=_ts_tree_cursor_start_position_wasm=e.ts_tree_cursor_start_position_wasm,Module._ts_tree_cursor_end_position_wasm=_ts_tree_cursor_end_position_wasm=e.ts_tree_cursor_end_position_wasm,Module._ts_tree_cursor_start_index_wasm=_ts_tree_cursor_start_index_wasm=e.ts_tree_cursor_start_index_wasm,Module._ts_tree_cursor_end_index_wasm=_ts_tree_cursor_end_index_wasm=e.ts_tree_cursor_end_index_wasm,Module._ts_tree_cursor_current_field_id_wasm=_ts_tree_cursor_current_field_id_wasm=e.ts_tree_cursor_current_field_id_wasm,Module._ts_tree_cursor_current_depth_wasm=_ts_tree_cursor_current_depth_wasm=e.ts_tree_cursor_current_depth_wasm,Module._ts_tree_cursor_current_descendant_index_wasm=_ts_tree_cursor_current_descendant_index_wasm=e.ts_tree_cursor_current_descendant_index_wasm,Module._ts_tree_cursor_current_node_wasm=_ts_tree_cursor_current_node_wasm=e.ts_tree_cursor_current_node_wasm,Module._ts_node_symbol_wasm=_ts_node_symbol_wasm=e.ts_node_symbol_wasm,Module._ts_node_field_name_for_child_wasm=_ts_node_field_name_for_child_wasm=e.ts_node_field_name_for_child_wasm,Module._ts_node_field_name_for_named_child_wasm=_ts_node_field_name_for_named_child_wasm=e.ts_node_field_name_for_named_child_wasm,Module._ts_node_children_by_field_id_wasm=_ts_node_children_by_field_id_wasm=e.ts_node_children_by_field_id_wasm,Module._ts_node_first_child_for_byte_wasm=_ts_node_first_child_for_byte_wasm=e.ts_node_first_child_for_byte_wasm,Module._ts_node_first_named_child_for_byte_wasm=_ts_node_first_named_child_for_byte_wasm=e.ts_node_first_named_child_for_byte_wasm,Module._ts_node_grammar_symbol_wasm=_ts_node_grammar_symbol_wasm=e.ts_node_grammar_symbol_wasm,Module._ts_node_child_count_wasm=_ts_node_child_count_wasm=e.ts_node_child_count_wasm,Module._ts_node_named_child_count_wasm=_ts_node_named_child_count_wasm=e.ts_node_named_child_count_wasm,Module._ts_node_child_wasm=_ts_node_child_wasm=e.ts_node_child_wasm,Module._ts_node_named_child_wasm=_ts_node_named_child_wasm=e.ts_node_named_child_wasm,Module._ts_node_child_by_field_id_wasm=_ts_node_child_by_field_id_wasm=e.ts_node_child_by_field_id_wasm,Module._ts_node_next_sibling_wasm=_ts_node_next_sibling_wasm=e.ts_node_next_sibling_wasm,Module._ts_node_prev_sibling_wasm=_ts_node_prev_sibling_wasm=e.ts_node_prev_sibling_wasm,Module._ts_node_next_named_sibling_wasm=_ts_node_next_named_sibling_wasm=e.ts_node_next_named_sibling_wasm,Module._ts_node_prev_named_sibling_wasm=_ts_node_prev_named_sibling_wasm=e.ts_node_prev_named_sibling_wasm,Module._ts_node_descendant_count_wasm=_ts_node_descendant_count_wasm=e.ts_node_descendant_count_wasm,Module._ts_node_parent_wasm=_ts_node_parent_wasm=e.ts_node_parent_wasm,Module._ts_node_child_with_descendant_wasm=_ts_node_child_with_descendant_wasm=e.ts_node_child_with_descendant_wasm,Module._ts_node_descendant_for_index_wasm=_ts_node_descendant_for_index_wasm=e.ts_node_descendant_for_index_wasm,Module._ts_node_named_descendant_for_index_wasm=_ts_node_named_descendant_for_index_wasm=e.ts_node_named_descendant_for_index_wasm,Module._ts_node_descendant_for_position_wasm=_ts_node_descendant_for_position_wasm=e.ts_node_descendant_for_position_wasm,Module._ts_node_named_descendant_for_position_wasm=_ts_node_named_descendant_for_position_wasm=e.ts_node_named_descendant_for_position_wasm,Module._ts_node_start_point_wasm=_ts_node_start_point_wasm=e.ts_node_start_point_wasm,Module._ts_node_end_point_wasm=_ts_node_end_point_wasm=e.ts_node_end_point_wasm,Module._ts_node_start_index_wasm=_ts_node_start_index_wasm=e.ts_node_start_index_wasm,Module._ts_node_end_index_wasm=_ts_node_end_index_wasm=e.ts_node_end_index_wasm,Module._ts_node_to_string_wasm=_ts_node_to_string_wasm=e.ts_node_to_string_wasm,Module._ts_node_children_wasm=_ts_node_children_wasm=e.ts_node_children_wasm,Module._ts_node_named_children_wasm=_ts_node_named_children_wasm=e.ts_node_named_children_wasm,Module._ts_node_descendants_of_type_wasm=_ts_node_descendants_of_type_wasm=e.ts_node_descendants_of_type_wasm,Module._ts_node_is_named_wasm=_ts_node_is_named_wasm=e.ts_node_is_named_wasm,Module._ts_node_has_changes_wasm=_ts_node_has_changes_wasm=e.ts_node_has_changes_wasm,Module._ts_node_has_error_wasm=_ts_node_has_error_wasm=e.ts_node_has_error_wasm,Module._ts_node_is_error_wasm=_ts_node_is_error_wasm=e.ts_node_is_error_wasm,Module._ts_node_is_missing_wasm=_ts_node_is_missing_wasm=e.ts_node_is_missing_wasm,Module._ts_node_is_extra_wasm=_ts_node_is_extra_wasm=e.ts_node_is_extra_wasm,Module._ts_node_parse_state_wasm=_ts_node_parse_state_wasm=e.ts_node_parse_state_wasm,Module._ts_node_next_parse_state_wasm=_ts_node_next_parse_state_wasm=e.ts_node_next_parse_state_wasm,Module._ts_query_matches_wasm=_ts_query_matches_wasm=e.ts_query_matches_wasm,Module._ts_query_captures_wasm=_ts_query_captures_wasm=e.ts_query_captures_wasm,Module._memset=_memset=e.memset,Module._memcpy=_memcpy=e.memcpy,Module._memmove=_memmove=e.memmove,Module._iswalpha=_iswalpha=e.iswalpha,Module._iswblank=_iswblank=e.iswblank,Module._iswdigit=_iswdigit=e.iswdigit,Module._iswlower=_iswlower=e.iswlower,Module._iswpunct=_iswpunct=e.iswpunct,Module._iswupper=_iswupper=e.iswupper,Module._iswxdigit=_iswxdigit=e.iswxdigit,Module._memchr=_memchr=e.memchr,Module._strlen=_strlen=e.strlen,Module._strcmp=_strcmp=e.strcmp,Module._strncat=_strncat=e.strncat,Module._strncpy=_strncpy=e.strncpy,Module._towlower=_towlower=e.towlower,Module._towupper=_towupper=e.towupper,_setThrew=e.setThrew,__emscripten_stack_restore=e._emscripten_stack_restore,__emscripten_stack_alloc=e._emscripten_stack_alloc,_emscripten_stack_get_current=e.emscripten_stack_get_current,___wasm_apply_data_relocs=e.__wasm_apply_data_relocs}D(assignWasmExports,"assignWasmExports");var wasmImports={__heap_base:___heap_base,__indirect_function_table:wasmTable,__memory_base:___memory_base,__stack_high:___stack_high,__stack_low:___stack_low,__stack_pointer:___stack_pointer,__table_base:___table_base,_abort_js:__abort_js,emscripten_resize_heap:_emscripten_resize_heap,fd_close:_fd_close,fd_seek:_fd_seek,fd_write:_fd_write,memory:wasmMemory,tree_sitter_log_callback:_tree_sitter_log_callback,tree_sitter_parse_callback:_tree_sitter_parse_callback,tree_sitter_progress_callback:_tree_sitter_progress_callback,tree_sitter_query_progress_callback:_tree_sitter_query_progress_callback};function callMain(e=[]){var t=resolveGlobalSymbol("main").sym;if(t){e.unshift(thisProgram);var n=e.length,r=stackAlloc((n+1)*4),o=r;e.forEach(a=>{LE_HEAP_STORE_U32((o>>2)*4,stringToUTF8OnStack(a)),o+=4}),LE_HEAP_STORE_U32((o>>2)*4,0);try{var s=t(n,r);return exitJS(s,!0),s}catch(a){return handleException(a)}}}D(callMain,"callMain");function run(e=arguments_){if(runDependencies>0){dependenciesFulfilled=run;return}if(preRun(),runDependencies>0){dependenciesFulfilled=run;return}function t(){if(Module.calledRun=!0,!ABORT){initRuntime(),readyPromiseResolve?.(Module),Module.onRuntimeInitialized?.();var n=Module.noInitialRun||!1;n||callMain(e),postRun()}}D(t,"doRun"),Module.setStatus?(Module.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>Module.setStatus(""),1),t()},1)):t()}D(run,"run");var wasmExports;return wasmExports=await createWasm(),run(),runtimeInitialized?moduleRtn=Module:moduleRtn=new Promise((e,t)=>{readyPromiseResolve=e,readyPromiseReject=t}),moduleRtn}async function eg(e){return Qp??=await uk(e)}function tg(){return!!Qp}function rg(e,t,n,r){if(e.length!==3)throw new Error(`Wrong number of arguments to \`#${n}\` predicate. Expected 2, got ${e.length-1}`);if(!Gp(e[1]))throw new Error(`First argument of \`#${n}\` predicate must be a capture. Got "${e[1].value}"`);let o=n==="eq?"||n==="any-eq?",s=!n.startsWith("any-");if(Gp(e[2])){let a=e[1].name,l=e[2].name;r[t].push(c=>{let d=[],u=[];for(let m of c)m.name===a&&d.push(m.node),m.name===l&&u.push(m.node);let f=D((m,p,g)=>g?m.text===p.text:m.text!==p.text,"compare");return s?d.every(m=>u.some(p=>f(m,p,o))):d.some(m=>u.some(p=>f(m,p,o)))})}else{let a=e[1].name,l=e[2].value,c=D(u=>u.text===l,"matches"),d=D(u=>u.text!==l,"doesNotMatch");r[t].push(u=>{let f=[];for(let p of u)p.name===a&&f.push(p.node);let m=o?c:d;return s?f.every(m):f.some(m)})}}function sg(e,t,n,r){if(e.length!==3)throw new Error(`Wrong number of arguments to \`#${n}\` predicate. Expected 2, got ${e.length-1}.`);if(e[1].type!=="capture")throw new Error(`First argument of \`#${n}\` predicate must be a capture. Got "${e[1].value}".`);if(e[2].type!=="string")throw new Error(`Second argument of \`#${n}\` predicate must be a string. Got @${e[2].name}.`);let o=n==="match?"||n==="any-match?",s=!n.startsWith("any-"),a=e[1].name,l=new RegExp(e[2].value);r[t].push(c=>{let d=[];for(let f of c)f.name===a&&d.push(f.node.text);let u=D((f,m)=>m?l.test(f):!l.test(f),"test");return d.length===0?!o:s?d.every(f=>u(f,o)):d.some(f=>u(f,o))})}function ig(e,t,n,r){if(e.length<2)throw new Error(`Wrong number of arguments to \`#${n}\` predicate. Expected at least 1. Got ${e.length-1}.`);if(e[1].type!=="capture")throw new Error(`First argument of \`#${n}\` predicate must be a capture. Got "${e[1].value}".`);let o=n==="any-of?",s=e[1].name,a=e.slice(2);if(!a.every(xd))throw new Error(`Arguments to \`#${n}\` predicate must be strings.".`);let l=a.map(c=>c.value);r[t].push(c=>{let d=[];for(let u of c)u.name===s&&d.push(u.node.text);return d.length===0?!o:d.every(u=>l.includes(u))===o})}function og(e,t,n,r,o){if(e.length<2||e.length>3)throw new Error(`Wrong number of arguments to \`#${n}\` predicate. Expected 1 or 2. Got ${e.length-1}.`);if(!e.every(xd))throw new Error(`Arguments to \`#${n}\` predicate must be strings.".`);let s=n==="is?"?r:o;s[t]||(s[t]={}),s[t][e[1].value]=e[2]?.value??null}function ag(e,t,n){if(e.length<2||e.length>3)throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${e.length-1}.`);if(!e.every(xd))throw new Error('Arguments to `#set!` predicate must be strings.".');n[t]||(n[t]={}),n[t][e[1].value]=e[2]?.value??null}function lg(e,t,n,r,o,s,a,l,c,d,u){if(t===fk){let f=r[n];s.push({type:"capture",name:f})}else if(t===mk)s.push({type:"string",value:o[n]});else if(s.length>0){if(s[0].type!=="string")throw new Error("Predicates must begin with a literal value");let f=s[0].value;switch(f){case"any-not-eq?":case"not-eq?":case"any-eq?":case"eq?":rg(s,e,f,a);break;case"any-not-match?":case"not-match?":case"any-match?":case"match?":sg(s,e,f,a);break;case"not-any-of?":case"any-of?":ig(s,e,f,a);break;case"is?":case"is-not?":og(s,e,f,d,u);break;case"set!":ag(s,e,c);break;default:l[e].push({operator:f,operands:s.slice(1)})}s.length=0}}var ik,D,xF,Wp,ee,md,Et,_n,ki,kt,Yn,A,Bp,ok,Up,ak,zp,lk,ck,dk,bd,uk,Qp,Y,pd,gd,Hp,wd,fk,mk,pk,SF,Gp,xd,on,xi,qp,cg,Sd=H(()=>{$();ik=Object.defineProperty,D=(e,t)=>ik(e,"name",{value:t,configurable:!0}),xF=class{static{D(this,"Edit")}startPosition;oldEndPosition;newEndPosition;startIndex;oldEndIndex;newEndIndex;constructor({startIndex:e,oldEndIndex:t,newEndIndex:n,startPosition:r,oldEndPosition:o,newEndPosition:s}){this.startIndex=e>>>0,this.oldEndIndex=t>>>0,this.newEndIndex=n>>>0,this.startPosition=r,this.oldEndPosition=o,this.newEndPosition=s}editPoint(e,t){let n=t,r={...e};if(t>=this.oldEndIndex){n=this.newEndIndex+(t-this.oldEndIndex);let o=e.row;r.row=this.newEndPosition.row+(e.row-this.oldEndPosition.row),r.column=o===this.oldEndPosition.row?this.newEndPosition.column+(e.column-this.oldEndPosition.column):e.column}else t>this.startIndex&&(n=this.newEndIndex,r.row=this.newEndPosition.row,r.column=this.newEndPosition.column);return{point:r,index:n}}editRange(e){let t={startIndex:e.startIndex,startPosition:{...e.startPosition},endIndex:e.endIndex,endPosition:{...e.endPosition}};return e.endIndex>=this.oldEndIndex?e.endIndex!==Number.MAX_SAFE_INTEGER&&(t.endIndex=this.newEndIndex+(e.endIndex-this.oldEndIndex),t.endPosition={row:this.newEndPosition.row+(e.endPosition.row-this.oldEndPosition.row),column:e.endPosition.row===this.oldEndPosition.row?this.newEndPosition.column+(e.endPosition.column-this.oldEndPosition.column):e.endPosition.column},t.endIndexthis.startIndex&&(t.endIndex=this.startIndex,t.endPosition={...this.startPosition}),e.startIndex>=this.oldEndIndex?(t.startIndex=this.newEndIndex+(e.startIndex-this.oldEndIndex),t.startPosition={row:this.newEndPosition.row+(e.startPosition.row-this.oldEndPosition.row),column:e.startPosition.row===this.oldEndPosition.row?this.newEndPosition.column+(e.startPosition.column-this.oldEndPosition.column):e.startPosition.column},t.startIndexthis.startIndex&&(t.startIndex=this.startIndex,t.startPosition={...this.startPosition}),t}},Wp=2,ee=4,md=4*ee,Et=5*ee,_n=2*ee,ki=2*ee+2*_n,kt={row:0,column:0},Yn=Symbol("INTERNAL");D(_s,"assertInternal");D(Si,"isPoint");D(Vp,"setModule");D(bs,"newFinalizer");Bp=bs(e=>{A._ts_lookahead_iterator_delete(e)}),ok=class{static{D(this,"LookaheadIterator")}0=0;language;positioned=!1;constructor(e,t,n){_s(e),this[0]=t,this.language=n,Bp?.register(this,t,this)}get currentTypeId(){return this.positioned?A._ts_lookahead_iterator_current_symbol(this[0]):null}get currentType(){let e=this.currentTypeId;return e===null?null:this.language.types[e]??A.UTF8ToString(A._ts_language_symbol_name(this.language[0],e))}delete(){Bp?.unregister(this),A._ts_lookahead_iterator_delete(this[0]),this[0]=0}reset(e,t){return A._ts_lookahead_iterator_reset(this[0],e[0],t)?(this.language=e,this.positioned=!1,!0):!1}resetState(e){return A._ts_lookahead_iterator_reset_state(this[0],e)?(this.positioned=!1,!0):!1}[Symbol.iterator](){return{next:D(()=>{this.positioned=!!A._ts_lookahead_iterator_next(this[0]);let e=this.currentType;return e===null?{done:!0,value:""}:{done:!1,value:e}},"next")}}};D(_d,"getText");Up=bs(e=>{A._ts_tree_delete(e)}),ak=class hd{static{D(this,"Tree")}0=0;textCallback;language;constructor(t,n,r,o){_s(t),this[0]=n,this.language=r,this.textCallback=o,Up?.register(this,n,this)}copy(){let t=A._ts_tree_copy(this[0]);return new hd(Yn,t,this.language,this.textCallback)}delete(){Up?.unregister(this),A._ts_tree_delete(this[0]),this[0]=0}get rootNode(){return A._ts_tree_root_node_wasm(this[0]),Be(this)}rootNodeWithOffset(t,n){let r=Y+Et;return A.setValue(r,t,"i32"),jt(r+ee,n),A._ts_tree_root_node_with_offset_wasm(this[0]),Be(this)}edit(t){Xp(t),A._ts_tree_edit_wasm(this[0])}walk(){return this.rootNode.walk()}getChangedRanges(t){if(!(t instanceof hd))throw new TypeError("Argument must be a Tree");A._ts_tree_get_changed_ranges_wasm(this[0],t[0]);let n=A.getValue(Y,"i32"),r=A.getValue(Y+ee,"i32"),o=new Array(n);if(n>0){let s=r;for(let a=0;a0){let o=n;for(let s=0;s{A._ts_tree_cursor_delete_wasm(e)}),lk=class Jp{static{D(this,"TreeCursor")}0=0;1=0;2=0;3=0;tree;constructor(t,n){_s(t),this.tree=n,$t(this),zp?.register(this,this.tree[0],this)}copy(){let t=new Jp(Yn,this.tree);return A._ts_tree_cursor_copy_wasm(this.tree[0]),$t(t),t}delete(){zp?.unregister(this),Te(this),A._ts_tree_cursor_delete_wasm(this.tree[0]),this[0]=this[1]=this[2]=0}get currentNode(){return Te(this),A._ts_tree_cursor_current_node_wasm(this.tree[0]),Be(this.tree)}get currentFieldId(){return Te(this),A._ts_tree_cursor_current_field_id_wasm(this.tree[0])}get currentFieldName(){return this.tree.language.fields[this.currentFieldId]}get currentDepth(){return Te(this),A._ts_tree_cursor_current_depth_wasm(this.tree[0])}get currentDescendantIndex(){return Te(this),A._ts_tree_cursor_current_descendant_index_wasm(this.tree[0])}get nodeType(){return this.tree.language.types[this.nodeTypeId]||"ERROR"}get nodeTypeId(){return Te(this),A._ts_tree_cursor_current_node_type_id_wasm(this.tree[0])}get nodeStateId(){return Te(this),A._ts_tree_cursor_current_node_state_id_wasm(this.tree[0])}get nodeId(){return Te(this),A._ts_tree_cursor_current_node_id_wasm(this.tree[0])}get nodeIsNamed(){return Te(this),A._ts_tree_cursor_current_node_is_named_wasm(this.tree[0])===1}get nodeIsMissing(){return Te(this),A._ts_tree_cursor_current_node_is_missing_wasm(this.tree[0])===1}get nodeText(){Te(this);let t=A._ts_tree_cursor_start_index_wasm(this.tree[0]),n=A._ts_tree_cursor_end_index_wasm(this.tree[0]);A._ts_tree_cursor_start_position_wasm(this.tree[0]);let r=Ar(Y);return _d(this.tree,t,n,r)}get startPosition(){return Te(this),A._ts_tree_cursor_start_position_wasm(this.tree[0]),Ar(Y)}get endPosition(){return Te(this),A._ts_tree_cursor_end_position_wasm(this.tree[0]),Ar(Y)}get startIndex(){return Te(this),A._ts_tree_cursor_start_index_wasm(this.tree[0])}get endIndex(){return Te(this),A._ts_tree_cursor_end_index_wasm(this.tree[0])}gotoFirstChild(){Te(this);let t=A._ts_tree_cursor_goto_first_child_wasm(this.tree[0]);return $t(this),t===1}gotoLastChild(){Te(this);let t=A._ts_tree_cursor_goto_last_child_wasm(this.tree[0]);return $t(this),t===1}gotoParent(){Te(this);let t=A._ts_tree_cursor_goto_parent_wasm(this.tree[0]);return $t(this),t===1}gotoNextSibling(){Te(this);let t=A._ts_tree_cursor_goto_next_sibling_wasm(this.tree[0]);return $t(this),t===1}gotoPreviousSibling(){Te(this);let t=A._ts_tree_cursor_goto_previous_sibling_wasm(this.tree[0]);return $t(this),t===1}gotoDescendant(t){Te(this),A._ts_tree_cursor_goto_descendant_wasm(this.tree[0],t),$t(this)}gotoFirstChildForIndex(t){Te(this),A.setValue(Y+md,t,"i32");let n=A._ts_tree_cursor_goto_first_child_for_index_wasm(this.tree[0]);return $t(this),n===1}gotoFirstChildForPosition(t){Te(this),jt(Y+md,t);let n=A._ts_tree_cursor_goto_first_child_for_position_wasm(this.tree[0]);return $t(this),n===1}reset(t){de(t),Te(this,Y+Et),A._ts_tree_cursor_reset_wasm(this.tree[0]),$t(this)}resetTo(t){Te(this,Y),Te(t,Y+md),A._ts_tree_cursor_reset_to_wasm(this.tree[0],t.tree[0]),$t(this)}},ck=class{static{D(this,"Node")}0=0;_children;_namedChildren;constructor(e,{id:t,tree:n,startIndex:r,startPosition:o,other:s}){_s(e),this[0]=s,this.id=t,this.tree=n,this.startIndex=r,this.startPosition=o}id;startIndex;startPosition;tree;get typeId(){return de(this),A._ts_node_symbol_wasm(this.tree[0])}get grammarId(){return de(this),A._ts_node_grammar_symbol_wasm(this.tree[0])}get type(){return this.tree.language.types[this.typeId]||"ERROR"}get grammarType(){return this.tree.language.types[this.grammarId]||"ERROR"}get isNamed(){return de(this),A._ts_node_is_named_wasm(this.tree[0])===1}get isExtra(){return de(this),A._ts_node_is_extra_wasm(this.tree[0])===1}get isError(){return de(this),A._ts_node_is_error_wasm(this.tree[0])===1}get isMissing(){return de(this),A._ts_node_is_missing_wasm(this.tree[0])===1}get hasChanges(){return de(this),A._ts_node_has_changes_wasm(this.tree[0])===1}get hasError(){return de(this),A._ts_node_has_error_wasm(this.tree[0])===1}get endIndex(){return de(this),A._ts_node_end_index_wasm(this.tree[0])}get endPosition(){return de(this),A._ts_node_end_point_wasm(this.tree[0]),Ar(Y)}get text(){return _d(this.tree,this.startIndex,this.endIndex,this.startPosition)}get parseState(){return de(this),A._ts_node_parse_state_wasm(this.tree[0])}get nextParseState(){return de(this),A._ts_node_next_parse_state_wasm(this.tree[0])}equals(e){return this.tree===e.tree&&this.id===e.id}child(e){return de(this),A._ts_node_child_wasm(this.tree[0],e),Be(this.tree)}namedChild(e){return de(this),A._ts_node_named_child_wasm(this.tree[0],e),Be(this.tree)}childForFieldId(e){return de(this),A._ts_node_child_by_field_id_wasm(this.tree[0],e),Be(this.tree)}childForFieldName(e){let t=this.tree.language.fields.indexOf(e);return t!==-1?this.childForFieldId(t):null}fieldNameForChild(e){de(this);let t=A._ts_node_field_name_for_child_wasm(this.tree[0],e);return t?A.AsciiToString(t):null}fieldNameForNamedChild(e){de(this);let t=A._ts_node_field_name_for_named_child_wasm(this.tree[0],e);return t?A.AsciiToString(t):null}childrenForFieldName(e){let t=this.tree.language.fields.indexOf(e);return t!==-1&&t!==0?this.childrenForFieldId(t):[]}childrenForFieldId(e){de(this),A._ts_node_children_by_field_id_wasm(this.tree[0],e);let t=A.getValue(Y,"i32"),n=A.getValue(Y+ee,"i32"),r=new Array(t);if(t>0){let o=n;for(let s=0;s0){let n=t;for(let r=0;r0){let n=t;for(let r=0;r0){let d=l;for(let u=0;u=e.oldEndIndex){this.startIndex=e.newEndIndex+(this.startIndex-e.oldEndIndex);let t,n;this.startPosition.row>e.oldEndPosition.row?(t=this.startPosition.row-e.oldEndPosition.row,n=this.startPosition.column):(t=0,n=this.startPosition.column,this.startPosition.column>=e.oldEndPosition.column&&(n=this.startPosition.column-e.oldEndPosition.column)),t>0?(this.startPosition.row+=t,this.startPosition.column=n):this.startPosition.column+=n}else this.startIndex>e.startIndex&&(this.startIndex=e.newEndIndex,this.startPosition.row=e.newEndPosition.row,this.startPosition.column=e.newEndPosition.column)}toString(){de(this);let e=A._ts_node_to_string_wasm(this.tree[0]),t=A.AsciiToString(e);return A._free(e),t}};D(yd,"unmarshalCaptures");D(de,"marshalNode");D(Be,"unmarshalNode");D(Te,"marshalTreeCursor");D($t,"unmarshalTreeCursor");D(jt,"marshalPoint");D(Ar,"unmarshalPoint");D(Kp,"marshalRange");D(ka,"unmarshalRange");D(Xp,"marshalEdit");D(Zp,"unmarshalLanguageMetadata");dk=/^tree_sitter_\w+$/,bd=class Sa{static{D(this,"Language")}0=0;types;fields;constructor(t,n){_s(t),this[0]=n,this.types=new Array(A._ts_language_symbol_count(this[0]));for(let r=0,o=this.types.length;r0){let o=n;for(let s=0;s0){let s=r;for(let a=0;a(fd(),ud))).readFile(t);else{let o=await fetch(t);if(!o.ok){let a=await o.text();throw new Error(`Language.load failed with status ${o.status}. +`,maxBuffer:Lm,timeout:6e5,env:{...F.env,...Oc}});if(m.error){let g=m.error.code;return{ok:!1,error:g==="ENOBUFS"?`git log output exceeds ${Lm/1024/1024} MiB \u2014 bound the window with since`:g==="ENOENT"?"git was not found on PATH":m.error.message}}if(m.status!==0)return{ok:!1,error:Dm(String(m.stderr??""))||`git log exited with ${m.status}`};let p=Qw(m.stdout,r,l.length>0);return Mr.set(d,p),Mr.size>Xw&&Mr.delete(Mr.keys().next().value),{ok:!0,log:p}}function Zw(e,t){if(!t)return{exclude:[],args:[]};let n=Bc(t)?void 0:Pe("git",[...Mt(e),"rev-parse","--verify","--quiet",`${t}^{commit}`]);if(n?.ok)return{exclude:[`^${n.stdout.trim()}`],args:[]};if(Kw.test(t.trim())){let r=Pe("git",[...Mt(e),"rev-parse",`--since=${t}`]),o=/^--max-age=(-?\d+)$/m.exec(r.stdout);if(r.ok&&o){let s=BigInt(o[1]);return s<0n||s>=2n**63n?{exclude:[],args:[]}:{exclude:[],args:[`--max-age=${o[1]}`]}}}throw new Error(`since "${t}" is neither a commit (tag, branch, sha) nor a date (2024-01-01, "6 months ago")`)}function Yw(e){try{return oe(e,"utf8").split(` +`).map(t=>t.trim()).filter(Boolean).sort(T)}catch{return[]}}function Qw(e,t,n){let r=new Map,o=[],s=[],a=[];for(let l=0;ld&&s.length){let u=e.toString("utf8",d,c),f=r.get(u);f===void 0&&(f=o.length,o.push(u),r.set(u,f)),a.push(f)}l=c+1}return s.push(a.length),{prefix:t,paths:o,starts:s,ids:a,shallow:n}}function Jc(e){if(!e.prefix)return e.paths;let t=e.prefix.length;return e.paths.map(n=>n.startsWith(e.prefix)?n.slice(t):void 0)}function an(e,t={}){let n=new Map,r=Vc(e,t.since);if(!r.ok)return{churn:n,ok:!1,error:r.error,commits:0};let{log:o}=r,s=Jc(o),a=new Int32Array(o.paths.length).fill(-1),l=0;for(let c=0;c+1{"use strict";$();oa();Re();ge();de();it();Hw=7;Gw=["-c","core.quotePath=false","-c","color.ui=false","-c","diff.noprefix=false","-c","diff.mnemonicPrefix=false","-c","diff.relative=false","-c","log.showSignature=false","-c","log.follow=false","-c","log.showRoot=true"],Mt=e=>["-C",e,...Gw],Bc=e=>e.startsWith("-"),Wc=e=>e.staged?["--cached"]:[e.mergeBase],ua="(no commits)";Vw={a:7,b:8,t:9,n:10,v:11,f:12,r:13};Lm=1024*1024*1024,Kw=/^(?:\d{4}-\d{2}-\d{2}(?:[ T]\d{2}:\d{2}(?::\d{2})?)?(?:Z|[+-]\d{2}:?\d{2})?|(?:\d+[ .](?:second|minute|hour|day|week|month|year)s?[ .]*)+(?:ago)?)$/i,Mr=new Map,Xw=4});function tx(e){return typeof e=="string"?new TextEncoder().encode(e):e}function nx(e,t){if(e.length===1)return e[0];let n=new Uint8Array(t),r=0;for(let o of e)n.set(o,r),r+=o.byteLength;return n}function Wm(e){let t=Math.floor(e.byteLength/536870912|0),n=e.byteLength<<3>>>0,r=Math.ceil((e.byteLength+9)/64),o=new Uint8Array(r*64);o.set(e),o[e.byteLength]=128;let s=new DataView(o.buffer);return s.setUint32(o.byteLength-8,t,!1),s.setUint32(o.byteLength-4,n,!1),s}function Kc(e,t){return(e<>>32-t)>>>0}function xn(e,t){return(e>>>t|e<<32-t)>>>0}function rx(e){let t=Wm(e),n=1732584193,r=4023233417,o=2562383102,s=271733878,a=3285377520,l=new Uint32Array(80);for(let u=0;u>>0;h=g,g=p,p=Kc(m,30),m=f,f=S}n=n+f>>>0,r=r+m>>>0,o=o+p>>>0,s=s+g>>>0,a=a+h>>>0}let c=new Uint8Array(20),d=new DataView(c.buffer);return[n,r,o,s,a].forEach((u,f)=>d.setUint32(f*4,u,!1)),c}function ix(e){let t=Wm(e),n=1779033703,r=3144134277,o=1013904242,s=2773480762,a=1359893119,l=2600822924,c=528734635,d=1541459225,u=new Uint32Array(64);for(let p=0;p>>3,M=xn(v,17)^xn(v,19)^v>>>10;u[I]=u[I-16]+R+u[I-7]+M>>>0}let g=n,h=r,_=o,y=s,b=a,S=l,k=c,C=d;for(let I=0;I<64;I++){let P=xn(b,6)^xn(b,11)^xn(b,25),v=b&S^~b&k,R=C+P+v+sx[I]+u[I]>>>0,M=xn(g,2)^xn(g,13)^xn(g,22),x=g&h^g&_^h&_,w=M+x>>>0;C=k,k=S,S=b,b=y+R>>>0,y=_,_=h,h=g,g=R+w>>>0}n=n+g>>>0,r=r+h>>>0,o=o+_>>>0,s=s+y>>>0,a=a+b>>>0,l=l+S>>>0,c=c+k>>>0,d=d+C>>>0}let f=new Uint8Array(32),m=new DataView(f.buffer);return[n,r,o,s,a,l,c,d].forEach((p,g)=>m.setUint32(g*4,p,!1)),f}function ox(e){let t="";for(let n of e)t+=jm[n>>4]+jm[n&15];return t}function ax(e){let t="";for(let n of e)t+=String.fromCharCode(n);return btoa(t)}function xs(e){let t=e.toLowerCase().replace("-","");if(t!=="sha1"&&t!=="sha256")throw new Error(`createHash: unsupported algorithm "${e}" in the browser build (sha1, sha256)`);let n=[],r=0,o={update(s){let a=tx(s);return n.push(a),r+=a.byteLength,o},digest(s){let a=r===0?new Uint8Array(0):nx(n,r),l=t==="sha1"?rx(a):ix(a);return s==="hex"?ox(l):s==="base64"?ax(l):l}};return o}var sx,jm,ma=z(()=>{$();sx=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);jm="0123456789abcdef"});function Ae(e){return xs("sha1").update(e).digest("hex")}function lx(e,t=8){return Ae(e).slice(0,t)}var At=z(()=>{"use strict";$();ma()});function dx(e){return cx.test(e.trim())}function fx(e){return ux.test(e.trim())}function px(e){return mx.test(e.trim())}function Ht(e){return e.replace(/\*+\/\s*$/,"").replace(/^\s*\/\*+!?/,"").replace(/^\s*\/\/[/!]?/,"").replace(/^\s*--+/,"").replace(/^\s*#+/,"").replace(/^\s*\*+/,"").replace(/^\s*(?:"""|''')/,"").replace(/(?:"""|''')\s*$/,"").replace(/[-=~_]{3,}|\/{3,}|\*{3,}|#{3,}/g," ").trim()}function gx(e){return e.replace(/<\/?[A-Za-z][^>]*>/g," ").replace(/\s+/g," ").trim()}function Ar(e,t=hx,n=3){let r=[],o=!1;for(let l of e){let c=l.trim();if(!c){o=!1;continue}if(!o){if(px(c)){if(r.length)break;o=!0;continue}if(!(dx(c)||fx(c))){if(/^@[a-z]/i.test(c))break;r.push(c)}}}let s=gx(r.join(" "));if(s.length|\]=*\]|-\})\s*$/,"")).replace(/^\|(?:\s+|$)/,"").replace(kx,"")}function Xc(e,t){let n=yx.has(e),r=_x.has(e),o=Sx.filter(([d])=>d==="/*"||d===""],["--[[","]]"],["{-","-}"],['"""','"""'],["'''","'''"]],kx=/^@(?:file|fileoverview|overview|desc|description)\b\s*/i,Ex=/^created by\b.*\bon\s+\d{1,4}[./-]\d{1,2}[./-]\d{1,4}\.?$/i,vx=60,Rx=200,Cx=8});function ke(e,t,n,r,o){let s=[],a=t.split(/\r?\n/),l=o===void 0?a:o.split(/\r?\n/),c=o!==void 0&&r.some(u=>u.scope==="member")?$x(o):void 0,d=new Map;for(let u=0;u{let l=a.doc??Fx(o,a.line-1,n),c=a.endLine??s?.endOf(a.line-1,o);return l===void 0&&c===void 0?a:{...a,...c!==void 0?{endLine:c}:{},...l!==void 0?{doc:l}:{}}})}function Fx(e,t,n){let r=t-1;for(;r>=0&&n.decoration?.test(e[r]);)r--;if(n.docAttr){let s=Ox(e,r);if(s)return Ar(s)}let o=[];for(;r>=0;){let s=e[r];if(n.comment.test(s)){o.push(s),r--;continue}if(!n.block||!/\*\/\s*$/.test(s))break;let a=r;for(;a>=0&&!e[a].includes("/*");)a--;if(a<0||!/^\s*\/\*(?!!)/.test(e[a]))break;for(let l=r;l>=a;l--)o.push(e[l]);r=a-1}if(o.length)return Ar(o.reverse().map(Ht))}function Ox(e,t){if(t<0)return;let n=/^\s*@doc\s+(?:~[sS])?"(.*)"\s*$/.exec(e[t]);if(n)return[n[1]];if(/^\s*"""\s*$/.test(e[t]))for(let r=t-1;r>=0&&t-r<400;r--){if(/^\s*@doc\s+(?:~[sS])?"""\s*$/.test(e[r]))return e.slice(r+1,t);if(/"""/.test(e[r]))return}}function cn(e){return Nx[e]??"other"}function Lx(e){let t=e.length,n="",r=0,o=0;for(;o{if(!a){a=[0];for(let _=0;_>>1;a[_]<=p?g=_+1:h=_}return g},c=new Map;for(let p of n)c.has(p.name)||c.set(p.name,p);let d=Lx(t),u=/export\s*\{([\s\S]*?)\}\s*(?:from\s*['"]([^'"]+)['"])?\s*;?/g,f;for(;(f=u.exec(d))&&o.length{"use strict";$();pi();Ce=String.raw`[\p{L}\p{Nl}_$][\p{L}\p{Nl}\p{Mn}\p{Mc}\p{Nd}\p{Pc}$\u200c\u200d]*`,Ax=new Set(["class","struct","enum","interface","protocol","actor","extension","object","trait","mixin"]);Yc=class{constructor(t){this.masked=t;let n=[];for(let r=0;r>>1;this.lineStarts[o]<=t?n=o+1:r=o}return n-1}endOf(t,n){let r=this.masked,o=/^\s*/.exec(n[t])[0],s=0,a=t;for(let l=this.lineStarts[t];l60||a>=this.lineStarts.length)return;let d=r.slice(this.lineStarts[a],this.lineStarts[a+1]??r.length),u=/^\s*/.exec(d)[0],f=d.charAt(u.length);if(s===0&&f&&!"{)]".includes(f)&&u.length<=o.length)return;continue}if(c===40||c===91)s++;else if(c===41||c===93){if(--s<0)return}else{if(s===0&&c===59)return;if(s===0&&c===123){let d=this.closeOf.get(l);if(d===void 0)return;let u=this.lineOf(d),f=r.slice(d+1,this.lineStarts[u+1]??r.length);if(u===this.lineOf(l)){if(u===t&&/^[\s;,)\]}]*$/.test(f))return this.continued(u)?void 0:u+1;l=d;continue}return f.includes("{")?void 0:n[u].startsWith(o+"}")&&!this.continued(u)?u+1:void 0}}}}continued(t){for(let n=t+1;n)/.test(r)}return!1}},Nx={".ts":"typescript",".tsx":"typescript",".mts":"typescript",".cts":"typescript",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".go":"go",".rb":"ruby",".rake":"ruby",".java":"java",".rs":"rust",".c":"c",".h":"c",".cc":"cpp",".cpp":"cpp",".cxx":"cpp",".hpp":"cpp",".cs":"csharp",".php":"php",".swift":"swift",".kt":"kotlin",".kts":"kotlin",".scala":"scala",".sc":"scala",".clj":"clojure",".ex":"elixir",".exs":"elixir",".erl":"erlang",".hs":"haskell",".dart":"dart",".lua":"lua",".sh":"shell",".bash":"shell",".zsh":"shell",".ksh":"shell",".fish":"shell",".hh":"cpp",".m":"objective-c",".mm":"objective-c",".sql":"sql",".graphql":"graphql",".gql":"graphql",".proto":"protobuf",".md":"markdown",".mdx":"markdown",".rst":"restructuredtext",".txt":"text",".json":"json",".yaml":"yaml",".yml":"yaml",".toml":"toml",".ini":"ini",".html":"html",".css":"css",".scss":"scss",".vue":"vue",".svelte":"svelte",".astro":"astro",".zig":"zig",".hcl":"hcl",".tf":"terraform",".tfvars":"terraform",".sol":"solidity"};Px=new Set([".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"]);Zc=47,Bm=42,Um=10,Dx=34,jx=39,Wx=96,Bx=92,pa=400});function td(e,t=[]){if(t.length>=ya)return t;let n=e.indexOf("{");if(n===-1){let c=e.replace(/\s+as\s+\w+\s*$/,"").replace(/::\s*\*\s*$/,"").replace(/^::/,"").trim();return c&&t.push(c),t}let r=e.slice(0,n),o=0,s=-1;for(let c=n;c|\bas\b/).map(u=>u.trim());if(!a||l==="_")continue;let c=a==="_"||a==="*"||/^given\b/.test(a),d=nd(c?r+".*":r+"."+a);d&&t.length=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===tp||e>127}function Ir(e){let t=e.length,n=new bi(e),r=[],o=0,s=c=>{let d=c;for(;d{let d=c-1;for(;d>=0&&n.codeAt(d)<=ep;)d--;if(d<0)return!0;let u=n.codeAt(d);if(Yx.has(u))return!0;if(!Vm(u))return!1;let f=d;for(;f>0&&Vm(e.charCodeAt(f-1));)f--;return Qx.has(e.slice(f,d+1))},l=0;for(;l0&&e.charCodeAt(l-1)===rd;)l--;let c=o-l;if(t.raw==="r"?/[rR]$/.test(e.slice(Math.max(0,l-2),l)):c>0){let u=e.indexOf('"'+"#".repeat(c),o+1),f=u===-1?n:u;r.blank(o+1,f),o=u===-1?n:u+1+c;continue}}let a=s===gi||s===_a&&t.squote==="string";if(a||s===_i&&t.backtick){let l=a&&t.triple&&e.charCodeAt(o+1)===s&&e.charCodeAt(o+2)===s,c=o+(l?3:1),d=c;if(l){let f=e.indexOf(s===gi?'"""':"'''",c);d=f===-1?n:f}else for(;d{n.get(s)===!0&&n.delete(s),n.set(s,!1)},o=s=>{n.has(s)||n.set(s,!0)};if(Ux.has(e)){if(!t.includes("import")&&!t.includes("require")&&!t.includes("from"))return[];let s=Ir(t);for(let a of[tS,nS,rS,sS]){a.lastIndex=0;for(let l;l=a.exec(s);){let[c,d]=l.indices[1];r(t.slice(c,d))}}}else if(zx.has(e)){if(!t.includes("import"))return[];let s=eS(t);Km.lastIndex=0;for(let a;a=Km.exec(s);){let l=a[1];if(l!==void 0){if(r(l),!l||l==="__future__")continue;let c=a[2].startsWith("(")?a[2].slice(1,-1):a[2].replace(/\\\r?\n/g," ");for(let d of c.split(",")){let u=d.trim().split(/\s+as\s+/)[0].trim();/^[A-Za-z_]\w*$/.test(u)&&o(aS(l,u))}continue}for(let c of a[3].split(",")){let d=c.trim().split(/\s+as\s+/)[0].trim();d&&/^[\w.]+$/.test(d)&&r(d)}}}else if(e===".go"){let s=t.split(/\r?\n/),a=!1;for(let l of s){let c=l.trim();if(a){if(c===")"){a=!1;continue}let u=/"([^"]+)"/.exec(c);u&&r(u[1]);continue}if(/^import\s*\($/.test(c)){a=!0;continue}let d=/^import\s+(?:[\w.]+\s+)?"([^"]+)"/.exec(c);d&&r(d[1])}}else if(e===".rs"){let s,a=new Set,l=/#\[\s*path\s*=\s*"([^"]+)"\s*\]\s*(?:(?:#\[[^\]]*\]|\/\/[^\n]*)\s*)*(?:pub(?:\([^)]*\))?\s+)?mod\s+[A-Za-z_]\w*\s*;/g;for(;s=l.exec(t);)r(`mod-path ${s[1]}`),a.add(s.index+s[0].length);let c=/^[^\S\r\n]*(?:pub(?:\([^)]*\))?\s+)?mod\s+([A-Za-z_]\w*)\s*;/gm;for(;s=c.exec(t);)a.has(s.index+s[0].length)||r(`mod ${s[1]}`);let d=/^[^\S\r\n]*(?:pub(?:\([^)]*\))?\s+)?use\s+([^;]+);/gm;for(;s=d.exec(t);)for(let u of td(s[1].trim()))r(u)}else if(e===".java"){let s,a=/^[^\S\r\n]*import\s+(?:static\s+)?([\w.]+(?:\.\*)?)\s*;/gm;for(;s=a.exec(t);)r(s[1])}else if(e===".rb"||e===".rake"){let s,a=/^[^\S\r\n]*require_relative\s+['"]([^'"]+)['"]/gm;for(;s=a.exec(t);)r(ed(s[1]));let l=/^[^\S\r\n]*require\s+['"]([^'"]+)['"]/gm;for(;s=l.exec(t);)r(s[1])}else if(Hx.has(e)){let s,a=/^[^\S\r\n]*#\s*include\s*"([^"]+)"/gm;for(;s=a.exec(t);)r(s[1])}else if(e===".php"){let s,a=iS.exec(t)?.index??1/0;for(Xm.lastIndex=0;s=Xm.exec(t);){if(s[1]&&s.index>a)continue;let l=s[2].trim().replace(/^(?:function|const)\s+/,""),c=/^\\?([\w\\]*?)\\?\s*\{([^}]*)\}$/.exec(l),d=c?c[2].split(",").map(u=>`${c[1]}\\${u.trim()}`):l.split(",");for(let u of d){let f=u.trim().replace(/\\(?:function|const)\s+/,"\\").replace(/\s+as\s+\w+$/,"").replace(/^\\/,"");oS.test(f)&&r(f)}}for(Zm.lastIndex=0;s=Zm.exec(t);){let{here:l,up:c,levels:d,path:u}=s.groups;r(l?ed(u.replace(/^\/+/,"")):c?"../".repeat(Number(d??1))+u.replace(/^\/+/,""):ed(u))}}else if(e===".cs"){let s,a=/^[^\S\r\n]*(?:global\s+)?using\s+(?:static\s+)?([A-Za-z_][\w.]*)\s*;/gm;for(;s=a.exec(t);)r(s[1])}else if(Ym.has(e)){let s,a=/^[ \t]*import[ \t]+([\w.`*]+)/gm;for(;s=a.exec(t);){let l=nd(s[1]);l&&r(l)}}else if(Qm.has(e)){let s,a=/^[ \t]*import[ \t]+((?:[^\n;{]|\{[^}]*\})+)/gm;for(;s=a.exec(t);){let l=[],c=0,d="";for(let u of s[1].replace(/\/\/.*$/gm,""))u==="{"?c++:u==="}"&&c--,u===","&&c===0?(Hm(d,l),d=""):d+=u;Hm(d,l);for(let u of l)r(u)}}else if(e===".dart"){let s,a=/^[ \t]*(?:import|export|part)[ \t]+(?:'([^'\n]+)'|"([^"\n]+)")/gm;for(;s=a.exec(t);)r(s[1]??s[2])}else if(e===".lua"){let s,a=/\brequire\s*\(?\s*['"]([\w-]+(?:[./][\w-]+)*)['"]/g;for(;s=a.exec(t);)r(s[1])}else if(Gx.has(e)){let s,a=/(?:^|[;&|]|\b(?:then|do|else)\b)[ \t]*(?:source|\.)[ \t]+([^\n]+)/gm;for(;s=a.exec(t);){let l=Vx(s[1]);l&&r(l)}}else if(e===".ex"||e===".exs"){let s,a=/^[ \t]*(?:alias|import|require|use)[ \t]+([A-Z]\w*(?:\.[A-Z]\w*)*)(?:\.\{([^}]*)\})?/gm;for(;s=a.exec(t);){if(s[2]===void 0){r(s[1]);continue}let l=0;for(let c of s[2].split(",")){let d=c.trim();/^[A-Z]\w*(?:\.[A-Z]\w*)*$/.test(d)&&l++a?{kind:"import",spec:s,soft:!0}:{kind:"import",spec:s})}function ba(e,t){if(e===".java")return/^\s*package\s+([\w.]+)\s*;/m.exec(t)?.[1];if(e===".cs")return/^\s*(?:file-scoped\s+)?namespace\s+([\w.]+)/m.exec(t)?.[1];if(Ym.has(e)){let n=/^[ \t]*package[ \t]+([\w.`]+)/m.exec(t);return n?n[1].replace(/`/g,""):void 0}if(Qm.has(e))return Jx(t)}var Ux,zx,Hx,Ym,Qm,Gx,ya,qx,bi,Gm,wi,ep,rd,tp,_a,gi,hi,$n,Kx,yi,Xx,_i,qm,Zx,Yx,Qx,Jm,ha,Qc,tS,nS,rS,sS,Km,iS,Xm,oS,Zm,_t=z(()=>{"use strict";$();Ux=new Set([".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"]),zx=new Set([".py",".pyi"]),Hx=new Set([".c",".h",".cc",".cpp",".cxx",".hpp",".hh"]),Ym=new Set([".kt",".kts"]),Qm=new Set([".scala",".sc"]),Gx=new Set([".sh",".bash",".zsh",".ksh",".fish"]),ya=16;qx=/^(["']?)(?:\$\(\s*dirname\s+(["']?)\$(?:0|\{BASH_SOURCE(?:\[0\])?\}|BASH_SOURCE)\2\s*\)|\$\{(?:BASH_SOURCE(?:\[0\])?|0)%\/\*\})\//;bi=class{constructor(t){this.src=t}src;codes;blank(t,n){if(n<=t)return;let r=this.codes;if(!r){r=this.codes=new Uint16Array(this.src.length);for(let o=0;o~^"].map(e=>e.charCodeAt(0))),Qx=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]),Jm=/\bimport\(\s*['"][^'"\n]*['"]\s*[,)]|@import\b[^'"@]{0,2048}?\bfrom\s*['"][^'"\n]*['"]/g;ha=/'(?:\\(?:u\{[0-9A-Fa-f]{1,6}\}|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{2}|.)|[^\\'\n])'/y;Qc="[\\w$\\u00a0-\\uffff]+",tS=new RegExp(`(?:^|[^\\w$.])(?:import|export)\\b\\s*(?:(?:type|typeof|defer|source)\\s+)?(?:${Qc}\\s*,\\s*)?(?:${Qc}|\\*\\s*(?:as\\s+${Qc})?|\\{[^{}]*\\})\\s*from\\s*['"]([^'"]+)['"]`,"dg"),nS=/(?:^|[\n;])[ \t]*import\s*['"]([^'"]+)['"]/dg,rS=/\brequire\(\s*['"]([^'"]+)['"]\s*\)/dg,sS=/\bimport\(\s*['"]([^'"]+)['"]\s*[,)]/dg,Km=/(?:^|;)[ \t]*(?:from[ \t]+(\.*[\w.]*)[ \t]+import\b[ \t]*(\([^)]*\)|(?:\\\r?\n|[^\n;])*)|import[ \t]+([^\n;]*))/gm,iS=/^[ \t]*(?:(?:abstract|final|readonly)[ \t]+)*(?:class|interface|trait|enum)[ \t]+[A-Za-z_]/m,Xm=/^([ \t]*)use\s+([^;]*);/gm,oS=/^[A-Za-z_][\w\\]*$/,Zm=/\b(?:require|include)(?:_once)?\s*\(?\s*(?:(?__DIR__|dirname\(\s*__FILE__\s*\))\s*\.\s*|(?dirname\(\s*__DIR__\s*(?:,\s*(?\d+)\s*)?\))\s*\.\s*)?['"](?[^'"]+)['"]/g});function uS(e){return(e.split("/").pop()??"").replace(/\.[^.]+$/,"")}function fS(e,t){let n=s=>{if(!(!s||s==="default"))for(let a of t)a.name===s&&(a.exported=!0)},r=(s,a)=>{for(let l of s.split(",")){let c=l.trim().replace(/^type\s+/,"");if(!c)continue;let d=/^([\w$]+)\s+as\s+([\w$]+)$/.exec(c);if(d){d[2]!=="default"&&n(d[1]);continue}if(a){let u=/^([\w$]+)\s*:\s*([\w$]+)$/.exec(c);if(u){n(u[1]),n(u[2]);continue}}n(/^([\w$]+)/.exec(c)?.[1])}},o;for(np.lastIndex=0;o=np.exec(e);)o[2]||r(o[1]??"",!1);for(rp.lastIndex=0;o=rp.exec(e);)r(o[1]??"",!0);for(sp.lastIndex=0;o=sp.exec(e);)n(o[2])}var ft,sd,Pt,at,lS,cS,dS,np,rp,sp,ip,op=z(()=>{"use strict";$();_t();ot();ft=`(?${Ce})`,sd=String.raw`function(?:\s*\*\s*|\s+)`,Pt=String.raw`(?:declare\s+)?`,at=e=>new RegExp(e,"u"),lS=[{re:at(String.raw`^\s*export\s+${Pt}(?:async\s+)?${sd}${ft}`),kind:"function",exported:!0},{re:at(String.raw`^\s*export\s+default\s+(?:async\s+)?${sd}${ft}`),kind:"function",exported:!0},{re:at(String.raw`^\s*export\s+default\s+(?:abstract\s+)?class\s+(?!extends\b)${ft}`),kind:"class",exported:!0},{re:at(String.raw`^\s*${Pt}(?:async\s+)?${sd}${ft}`),kind:"function",exported:!1},{re:at(String.raw`^\s*export\s+${Pt}(?:abstract\s+)?class\s+${ft}`),kind:"class",exported:!0},{re:at(String.raw`^\s*${Pt}(?:abstract\s+)?class\s+${ft}`),kind:"class",exported:!1},{re:at(String.raw`^\s*export\s+${Pt}interface\s+${ft}`),kind:"interface",exported:!0},{re:at(String.raw`^\s*${Pt}interface\s+${ft}`),kind:"interface",exported:!1},{re:at(String.raw`^\s*export\s+${Pt}type\s+${ft}`),kind:"type",exported:!0},{re:at(String.raw`^\s*${Pt}type\s+${ft}\s*[=<]`),kind:"type",exported:!1},{re:at(String.raw`^\s*export\s+${Pt}(?:const\s+)?enum\s+${ft}`),kind:"enum",exported:!0},{re:at(String.raw`^\s*export\s+${Pt}(?:namespace|module)\s+(?${Ce}(?:\.${Ce})*)`),kind:"namespace",exported:!0},{re:at(String.raw`^\s*${Pt}(?:namespace|module)\s+(?${Ce}(?:\.${Ce})*)\s*\{`),kind:"namespace",exported:!1},{re:at(String.raw`^\s*export\s+${Pt}(?:const|let|var)\s+${ft}\s*[:=;]`),kind:"const",exported:!0},{re:at(String.raw`^\s*exports\.${ft}\s*=`),kind:"const",exported:!0},{re:at(String.raw`^\s*module\.exports\.${ft}\s*=`),kind:"const",exported:!0},{re:at(String.raw`^\s*(?:const|let)\s+${ft}\s*=\s*(?:async\s*)?\([^)]*\)\s*(?::[^=]+)?=>`),kind:"const",exported:!1},{re:at(String.raw`^${Pt}(?:const|let|var)\s+${ft}\s*[:=]`),kind:"const",exported:!1},{re:at(String.raw`^\s*export\s+default\s+${ft}\s*;?\s*$`),kind:"default",exported:!0}],cS=/^\s*export\s+default\s+(?:async\s+)?(?:function|class)?\s*(?:\(|\{|extends\b)/,dS=/^\s*export\s+default\s+(?:async\s+)?(?:function|class)\s+(?!extends\b)[\w$]+/;np=/export\s*\{([^}]*)\}\s*(from\b)?/g,rp=/module\.exports\s*=\s*\{([^}]*)\}/g,sp=/(^|\n)[ \t]*export(?:\s+default\s+|\s*=\s*)([A-Za-z_$][\w$]*)[ \t]*;?[ \t]*(?=\r?\n|$)/g;ip={lang:"javascript/typescript",exts:[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"],lexis:{mask:Ir,comment:/^\s*\/\//,block:!0,decoration:/^\s*@/},extract(e,t,n=t){let r=e.match(/\.(ts|tsx|mts|cts)$/)?"typescript":"javascript",o=ke(e,t,r,lS,n),s=n.split(/\r?\n/);for(let a=0;a{"use strict";$();ot();wa=e=>!e.startsWith("_")||e.startsWith("__"),mS=[{re:/^(?:async\s+)?def\s+(?[\w]+)\s*\(/,kind:"function",exported:e=>wa(e.groups.name)},{re:/^\s+(?:async\s+)?def\s+(?[\w]+)\s*\(/,kind:"method",exported:e=>wa(e.groups.name)},{re:/^class\s+(?[\w]+)/,kind:"class",exported:e=>wa(e.groups.name)},{re:/^\s+class\s+(?[\w]+)/,kind:"class",exported:e=>wa(e.groups.name)}],ap={lang:"python",exts:[".py",".pyi"],lexis:{comment:/^\s*#(?!!)/,decoration:/^\s*@/},extract(e,t){return ke(e,t,"python",mS)}}});function cp(e){return[{re:new RegExp(String.raw`${e}(?${Ce})${xa}\s+struct\b`,"u"),kind:"struct",exported:Tn},{re:new RegExp(String.raw`${e}(?${Ce})${xa}\s+interface\b`,"u"),kind:"interface",exported:Tn},{re:new RegExp(String.raw`${e}(?${Ce})${xa}\s+`,"u"),kind:"type",exported:Tn}]}function _S(e,t,n){let r=[],o=t.split(/\r?\n/),s=n.split(/\r?\n/);for(let a=0;a{"use strict";$();_t();ot();pS=e=>/^\p{Lu}/u.test(e),Tn=e=>pS(e.groups.name),xa=String.raw`(?:\[[^\]]*\])?`,gS=[{re:new RegExp(String.raw`^func\s+\([^)]*\)\s+(?${Ce})\s*\(`,"u"),kind:"method",exported:Tn},{re:new RegExp(String.raw`^func\s+(?${Ce})${xa}\s*\(`,"u"),kind:"function",exported:Tn},...cp("^type\\s+"),{re:new RegExp(String.raw`^const\s+(?(?!_\b)${Ce})`,"u"),kind:"const",exported:Tn},{re:new RegExp(String.raw`^var\s+(?(?!_\b)${Ce})`,"u"),kind:"var",exported:Tn}];hS=/^(const|var|type)\s*\(\s*$/,yS={const:[{re:new RegExp(String.raw`^\s+(?(?!_\b)${Ce})\b`,"u"),kind:"const",exported:Tn}],var:[{re:new RegExp(String.raw`^\s+(?(?!_\b)${Ce})\b`,"u"),kind:"var",exported:Tn}],type:cp("^\\s+")};dp={lang:"go",exts:[".go"],lexis:{mask:e=>rt(e,{squote:"char",backtick:!0}),comment:/^\s*\/\//,block:!0},extract(e,t,n){let r=ke(e,t,"go",gS,n),o=n===void 0?[]:_S(e,t,n);return o.length?[...r,...o].sort((s,a)=>s.line-a.line):r}}});var bS,fp,mp=z(()=>{"use strict";$();ot();bS=[{re:/^\s*def\s+(?:self\.)?(?[\w?!=]+)/,kind:"method",exported:!0},{re:/^\s*(?public|private|protected|module_function|(?:public|private)_class_method)\s+def\s+(?:self\.)?(?[\w?!=]+)/,kind:"method",exported:e=>/^(public|module_function|public_class_method)$/.test(e.groups.vis)},{re:/^\s*class\s+(?[\w:]+)/,kind:"class",exported:!0},{re:/^\s*module\s+(?[\w:]+)/,kind:"module",exported:!0}],fp={lang:"ruby",exts:[".rb",".rake"],lexis:{comment:/^\s*#(?![!{])/},extract(e,t){return ke(e,t,"ruby",bS)}}});var wS,pp,gp=z(()=>{"use strict";$();_t();ot();wS=[{re:/^\s*(?:public|protected|private)?\s*(?:abstract\s+|final\s+)?class\s+(?[\w]+)/,kind:"class",exported:(e,t)=>/\bpublic\b/.test(t)},{re:/^\s*(?:public|protected|private)?\s*interface\s+(?[\w]+)/,kind:"interface",exported:(e,t)=>/\bpublic\b/.test(t)},{re:/^\s*(?:public|protected|private)?\s*enum\s+(?[\w]+)/,kind:"enum",exported:(e,t)=>/\bpublic\b/.test(t)},{re:/^\s*(?:public|protected|private)\s+(?:static\s+|final\s+|abstract\s+|synchronized\s+)*[\w<>\[\],.?\s]+\s+(?[\w]+)\s*\(/,kind:"method",exported:(e,t)=>/\bpublic\b/.test(t)}],pp={lang:"java",exts:[".java"],lexis:{mask:e=>rt(e,{triple:!0,squote:"char"}),comment:/^\s*\/\//,block:!0,decoration:/^\s*@/},extract(e,t,n){return ke(e,t,"java",wS,n)}}});var Si,xS,hp,yp=z(()=>{"use strict";$();_t();ot();Si=(e,t)=>/^\s*pub\b/.test(t),xS=[{re:/^\s*(?:pub(?:\([^)]*\))?\s+)?(?:async\s+)?(?:unsafe\s+)?fn\s+(?[\w]+)/,kind:"function",exported:Si},{re:/^\s*(?:pub(?:\([^)]*\))?\s+)?struct\s+(?[\w]+)/,kind:"struct",exported:Si},{re:/^\s*(?:pub(?:\([^)]*\))?\s+)?enum\s+(?[\w]+)/,kind:"enum",exported:Si},{re:/^\s*(?:pub(?:\([^)]*\))?\s+)?trait\s+(?[\w]+)/,kind:"trait",exported:Si},{re:/^\s*(?:pub(?:\([^)]*\))?\s+)?type\s+(?[\w]+)/,kind:"type",exported:Si}],hp={lang:"rust",exts:[".rs"],lexis:{mask:e=>rt(e,{nested:!0,squote:"char",multiline:!0,raw:"r"}),comment:/^\s*\/\/(?!!)/,block:!0,decoration:/^\s*#\[/},extract(e,t,n){return ke(e,t,"rust",xS,n)}}});var ki,SS,_p,bp=z(()=>{"use strict";$();_t();ot();ki=(e,t)=>/\b(public|internal)\b/.test(t),SS=[{re:/^\s*(?:public|internal|protected|private)?\s*(?:static\s+|sealed\s+|abstract\s+|partial\s+)*(?:class|record)\s+(?\w+)/,kind:"class",exported:ki},{re:/^\s*(?:public|internal|protected|private)?\s*(?:partial\s+)?interface\s+(?\w+)/,kind:"interface",exported:ki},{re:/^\s*(?:public|internal|protected|private)?\s*(?:readonly\s+)?(?:ref\s+)?struct\s+(?\w+)/,kind:"struct",exported:ki},{re:/^\s*(?:public|internal|protected|private)?\s*enum\s+(?\w+)/,kind:"enum",exported:ki},{re:/^\s*(?:public|internal|protected|private)\s+(?:static\s+|virtual\s+|override\s+|async\s+|sealed\s+|abstract\s+|new\s+)*[\w<>\[\],.?]+\s+(?\w+)\s*(?:<[^>]*>)?\s*\(/,kind:"method",exported:ki}],_p={lang:"csharp",exts:[".cs"],lexis:{mask:e=>rt(e,{squote:"char"}),comment:/^\s*\/\//,block:!0,decoration:/^\s*\[/},extract(e,t,n){return ke(e,t,"csharp",SS,n)}}});var kS,wp,xp=z(()=>{"use strict";$();_t();ot();kS=[{re:/^\s*(?:abstract\s+|final\s+)*class\s+(?\w+)/,kind:"class",exported:!0},{re:/^\s*interface\s+(?\w+)/,kind:"interface",exported:!0},{re:/^\s*trait\s+(?\w+)/,kind:"trait",exported:!0},{re:/^\s*enum\s+(?\w+)/,kind:"enum",exported:!0},{re:/^\s*(?:public\s+|protected\s+|private\s+|static\s+|abstract\s+|final\s+)*function\s+(?\w+)\s*\(/,kind:"function",exported:(e,t)=>!/\b(private|protected)\b/.test(t)}],wp={lang:"php",exts:[".php"],lexis:{mask:e=>rt(e,{hash:!0,squote:"string",multiline:!0}),comment:/^\s*(?:\/\/|#(?!\[))/,block:!0,decoration:/^\s*#\[/},extract(e,t,n){return ke(e,t,"php",kS,n)}}});var Ss,ES,vS,ks,$r,RS,Sp,kp=z(()=>{"use strict";$();_t();ot();Ss=(e,t)=>!/\b(?:private|fileprivate)\b(?!\s*\(\s*set\s*\))/.test(t),ES=String.raw`(?:@${Ce}(?:\([^)]*\))?\s+)*`,vS=String.raw`(?:(?:public|open|internal|private|fileprivate|package|final|static|class|override|mutating|nonmutating|convenience|required|dynamic|lazy|weak|unowned|indirect|nonisolated|isolated|distributed|optional|prefix|postfix|infix|async)(?:\([^)]*\))?\s+)*`,ks=String.raw`^\s*${ES}${vS}`,$r=(e,t,n={})=>({re:new RegExp(String.raw`${ks}${e}\s+(?!(?:func|var|let|subscript|init)\b)(?${Ce})`,"u"),kind:t,exported:Ss,...n}),RS=[$r("class","class"),$r("struct","struct"),$r("enum","enum"),$r("protocol","protocol"),$r("actor","actor"),{re:new RegExp(String.raw`${ks}extension\s+(?${Ce}(?:\.${Ce})*)`,"u"),kind:"extension",exported:Ss},$r("typealias","type"),$r("func","function"),{re:new RegExp(String.raw`${ks}(?init)[?!]?\s*[<(]`,"u"),kind:"constructor",exported:Ss},{re:new RegExp(String.raw`${ks}(?deinit)\s*\{`,"u"),kind:"destructor",exported:Ss},{re:new RegExp(String.raw`${ks}(?subscript)\s*[<(]`,"u"),kind:"method",exported:Ss},{re:new RegExp(String.raw`${ks}(?:let|var)\s+(?${Ce})\s*[:={]`,"u"),kind:"property",exported:Ss,scope:"member"}],Sp={lang:"swift",exts:[".swift"],lexis:{mask:e=>rt(e,{nested:!0,triple:!0,squote:"none",raw:"#"}),comment:/^\s*\/\//,block:!0,decoration:/^\s*@/},extract(e,t,n){return ke(e,t,"swift",RS,n)}}});var er,CS,MS,tr,Ep,AS,vp,Rp=z(()=>{"use strict";$();_t();ot();er=(e,t)=>!/\bprivate\b/.test(t),CS=String.raw`(?:@[\w.:]+(?:\([^)]*\))?\s+)*`,MS=String.raw`(?:(?:public|internal|private|protected|abstract|sealed|open|final|data|value|inline|inner|override|suspend|operator|infix|tailrec|external|lateinit|expect|actual|const|companion|enum|annotation)\s+)*`,tr=String.raw`^\s*${CS}${MS}`,Ep=String.raw`(?:${Ce}(?:<[^()=]*>)?\??\.)*`,AS=[{re:new RegExp(String.raw`${tr}enum\s+class\s+(?${Ce})`,"u"),kind:"enum",exported:er},{re:new RegExp(String.raw`${tr}annotation\s+class\s+(?${Ce})`,"u"),kind:"annotation",exported:er},{re:new RegExp(String.raw`${tr}class\s+(?${Ce})`,"u"),kind:"class",exported:er},{re:new RegExp(String.raw`${tr}(?:fun\s+)?interface\s+(?${Ce})`,"u"),kind:"interface",exported:er},{re:new RegExp(String.raw`${tr}object\s+(?${Ce})`,"u"),kind:"object",exported:er},{re:new RegExp(String.raw`${tr}typealias\s+(?${Ce})`,"u"),kind:"type",exported:er},{re:new RegExp(String.raw`${tr}fun\s+(?:<[^>]*(?:>[^>]*)?>\s*)?${Ep}(?${Ce})\s*\(`,"u"),kind:"function",exported:er},{re:new RegExp(String.raw`${tr}(?:val|var)\s+(?:<[^>]*>\s*)?${Ep}(?${Ce})\s*(?:[:=]|by\b)`,"u"),kind:"property",exported:er,scope:"member"}],vp={lang:"kotlin",exts:[".kt",".kts"],lexis:{mask:e=>rt(e,{nested:!0,triple:!0,squote:"char"}),comment:/^\s*\/\//,block:!0,decoration:/^\s*@/},extract(e,t,n){return ke(e,t,"kotlin",AS,n)}}});var IS,$S,Cp,Mp=z(()=>{"use strict";$();_t();ot();IS="(?!\\s*(?:if|for|while|switch|return|else|do|sizeof|typedef)\\b)",$S=[{re:/^\s*(?:class|struct)\s+(?[A-Za-z_]\w+)\s*(?:[:{]|$)/,kind:"class",exported:!0},{re:/^\s*namespace\s+(?[A-Za-z_]\w+)/,kind:"namespace",exported:!0},{re:/^\s*(?:typedef\s+)?(?:struct|enum|union)\s+(?[A-Za-z_]\w+)\s*\{/,kind:"struct",exported:!0},{re:new RegExp(`^${IS}[A-Za-z_][\\w\\s\\*&<>:,]*?\\b(?[A-Za-z_]\\w+)\\s*\\([^;{]*\\)\\s*(?:const)?\\s*\\{?\\s*$`),kind:"function",exported:!0}],Cp={lang:"c/cpp",exts:[".c",".h",".cc",".cpp",".cxx",".hpp",".hh"],lexis:{mask:e=>rt(e,{squote:"char"}),comment:/^\s*\/\//,block:!0},extract(e,t,n){return ke(e,t,e.match(/\.(c|h)$/)?"c":"cpp",$S,n)}}});var TS,Ap,Ip=z(()=>{"use strict";$();ot();TS=[{re:/^\s*local\s+function\s+(?[\w.:]+)\s*\(/,kind:"function",exported:!1},{re:/^\s*function\s+(?[\w.:]+)\s*\(/,kind:"function",exported:!0},{re:/^\s*(?:local\s+)?(?[\w.]+)\s*=\s*function\s*\(/,kind:"function",exported:!0}],Ap={lang:"lua",exts:[".lua"],lexis:{comment:/^\s*--/},extract(e,t){return ke(e,t,"lua",TS).map(n=>{let r=Math.max(n.name.lastIndexOf("."),n.name.lastIndexOf(":"));return r>0&&r{"use strict";$();ot();FS=[{re:/^\s*function\s+(?[\w:-]+)\s*(?:\(\))?\s*\{?/,kind:"function",exported:!0},{re:/^\s*(?[A-Za-z_][\w:-]*)\s*\(\)\s*\{?/,kind:"function",exported:!0}],$p={lang:"shell",exts:[".sh",".bash",".zsh",".ksh"],lexis:{comment:/^\s*#(?!!)/},extract(e,t){return ke(e,t,"shell",FS)}}});var OS,Fp,Op=z(()=>{"use strict";$();ot();OS=[{re:/^\s*defmodule\s+(?[\w.]+)/,kind:"module",exported:!0},{re:/^\s*defp\s+(?[\w?!]+)/,kind:"function",exported:!1},{re:/^\s*def\s+(?[\w?!]+)/,kind:"function",exported:!0},{re:/^\s*defmacrop\s+(?[\w?!]+)/,kind:"macro",exported:!1},{re:/^\s*defmacro\s+(?[\w?!]+)/,kind:"macro",exported:!0},{re:/^\s*defguardp\s+(?[\w?!]+)/,kind:"guard",exported:!1},{re:/^\s*defguard\s+(?[\w?!]+)/,kind:"guard",exported:!0}],Fp={lang:"elixir",exts:[".ex",".exs"],lexis:{comment:/^\s*#/,decoration:/^\s*@(?!(?:doc|moduledoc|typedoc)\b)\w+/,docAttr:!0},extract(e,t){return ke(e,t,"elixir",OS)}}});var NS,Np,Pp=z(()=>{"use strict";$();_t();ot();NS=[{re:/^\s*(?:final\s+|sealed\s+|abstract\s+|implicit\s+)*(?:case\s+)?class\s+(?\w+)/,kind:"class",exported:!0},{re:/^\s*(?:sealed\s+)?trait\s+(?\w+)/,kind:"trait",exported:!0},{re:/^\s*(?:case\s+)?object\s+(?\w+)/,kind:"object",exported:!0},{re:/^\s*(?:override\s+|final\s+|private\s+|protected\s+|implicit\s+)*def\s+(?\w+)/,kind:"def",exported:(e,t)=>!/\b(private|protected)\b/.test(t)}],Np={lang:"scala",exts:[".scala",".sc"],lexis:{mask:e=>rt(e,{nested:!0,triple:!0,squote:"char"}),comment:/^\s*\/\//,block:!0,decoration:/^\s*@/},extract(e,t,n){return ke(e,t,"scala",NS,n)}}});function jS(e,t,n,r){let o=[],s=n.split(/\r?\n/),a=t.split(/\r?\n/),l,c=0,d;for(let u=0;uc?p:-1),p!==d||r.has(u+1))continue;let g=DS.exec(f);if(!g||g.groups.type!==l)continue;let h=g.groups.name??l;o.push({name:h,kind:"constructor",file:e,line:u+1,signature:a[u].trim().slice(0,200),exported:!h.startsWith("_")&&!l.startsWith("_"),lang:"dart"})}return o}var dn,ka,Sa,Lp,Dp,PS,LS,DS,jp,Wp=z(()=>{"use strict";$();_t();ot();dn=e=>!(e.groups?.name??"").startsWith("_"),ka=String.raw`(?:@[\w$.]+(?:\([^)]*\))?\s+)*`,Sa=String.raw`(?!(?:return|await|throw|new|else|if|for|while|do|switch|yield|case|const|final|var|late|factory|get|set|is|as|in)\b)[\w$.]+(?:<[^;{}()=]*>)?\??`,Lp=String.raw`(?!(?:if|for|while|switch|catch|return|assert|super|this|Function)\b)`,Dp=String.raw`\((?:[^()]|\([^()]*\))*(?:\)\s*(?:async\s*\*?|sync\s*\*)?\s*(?:=>|\{|;)|$)`,PS=[{re:/^\s*(?:(?:abstract|base|final|sealed|interface|mixin)\s+)*class\s+(?[\w$]+)/,kind:"class",exported:dn},{re:/^\s*(?:base\s+)?mixin\s+(?[\w$]+)/,kind:"mixin",exported:dn},{re:/^\s*extension\s+(?:type\s+(?:const\s+)?)?(?!on\b)(?[\w$]+)/,kind:"extension",exported:dn},{re:/^\s*enum\s+(?[\w$]+)/,kind:"enum",exported:dn},{re:/^\s*typedef\s+(?[\w$]+)/,kind:"type",exported:dn},{re:new RegExp(String.raw`^\s*${ka}(?:(?:static|external)\s+)*(?:${Sa}\s+)?get\s+(?[\w$]+)\s*(?:=>|\{|;|async\b|sync\b)`),kind:"getter",exported:dn},{re:new RegExp(String.raw`^\s*${ka}(?:(?:static|external)\s+)*(?:void\s+)?set\s+(?[\w$]+)\s*\(`),kind:"setter",exported:dn},{re:new RegExp(String.raw`^\s*${ka}(?:(?:static|external)\s+)*${Sa}\s+${Lp}(?[\w$]+)\s*(?:<[^()]*>)?\s*${Dp}`),kind:"function",exported:dn},{re:new RegExp(String.raw`^${Lp}(?[\w$]+)\s*(?:<[^()]*>)?\s*${Dp}`),kind:"function",exported:dn},{re:new RegExp(String.raw`^(?:const|final)\s+(?:${Sa}\s+)?(?[\w$]+)\s*[=;]`),kind:"const",exported:dn},{re:new RegExp(String.raw`^(?:late\s+final|late|var)\s+(?:${Sa}\s+)?(?[\w$]+)\s*[=;]`),kind:"var",exported:dn}],LS=/^(?\s*)(?:(?:abstract|base|final|sealed|interface|mixin)\s+)*(?:class|enum|mixin|extension(?:\s+type(?:\s+const)?)?)\s+(?[\w$]+)/,DS=new RegExp(String.raw`^(?\s*)${ka}(?:(?:const|factory|external)\s+)*(?[\w$]+)(?:\.(?[\w$]+))?\s*\(`);jp={lang:"dart",exts:[".dart"],lexis:{mask:e=>rt(e,{nested:!0,triple:!0,squote:"string"}),comment:/^\s*\/\//,block:!0,decoration:/^\s*@/},extract(e,t,n=t){let r=ke(e,t,"dart",PS,n),o=jS(e,t,n,new Set(r.map(s=>s.line)));return o.length?[...r,...o].sort((s,a)=>s.line-a.line):r}}});function od(e,t,n){let r=id.get(t),o;if(!r)o=[];else try{let l=r.lexis,c=l?.mask?.(n);o=r.extract(e,n,c),l&&(o=zm(o,n,l,c))}catch{o=[]}let s=new Set(o.map(l=>l.name)),a=ga(e,n,o).filter(l=>!s.has(l.name));return a.length?[...o,...a]:o}function ad(e){return id.get(e)?.lang??cn(e)}var WS,id,Tr=z(()=>{"use strict";$();ot();op();lp();up();mp();gp();yp();bp();xp();kp();Rp();Mp();Ip();Tp();Op();Pp();Wp();WS=[ip,ap,dp,fp,pp,hp,_p,wp,Sp,vp,Cp,Ap,$p,Fp,Np,jp],id=new Map;for(let e of WS)for(let t of e.exts)id.set(t,e)});function Bp(e,t){let n=e.split("/").pop().toLowerCase();return US.has(t)||BS.test(n)||zS.test(e)}function qS(e,t){let n=e.split("/").pop().toLowerCase();return HS.has(n)||GS.has(t)}function Up(e){return!VS.has(ad(e))}function bt(e,t){return Up(t)?"code":Bp(e,t)?"doc":qS(e,t)?"config":"other"}var BS,US,zS,HS,GS,ld,VS,Fn=z(()=>{"use strict";$();Tr();BS=/^(readme|changelog|contributing|history|news|authors|notice|security|code_of_conduct|faq|getting[-_]?started|usage|guide|tutorial)\b/i,US=new Set([".md",".mdx",".rst",".adoc",".txt"]),zS=/^(docs?|documentation|wiki|guides?|website|site|book)\//i,HS=new Set(["package.json","pnpm-workspace.yaml","tsconfig.json","jsconfig.json","pyproject.toml","setup.py","setup.cfg","requirements.txt","pipfile","go.mod","cargo.toml","gemfile","pom.xml","build.gradle","build.gradle.kts","composer.json","mix.exs","pubspec.yaml","build.sbt","dockerfile","docker-compose.yml","docker-compose.yaml","makefile",".env.example","manifest.json"]),GS=new Set([".json",".yaml",".yml",".toml",".ini",".cfg"]),ld=new Set([".md",".mdx"]);VS=new Set(["markdown","restructuredtext","text","json","yaml","toml","ini","other","html","css","scss"])});function cd(e){let t="";for(let n=0;nt.some(r=>r.test(n))}function dd(e){if(!e||e.length===0)return null;let t=e.map(n=>n.split("/").map(r=>r.includes("**")?null:cd(r)));return n=>{let r=n.split("/");return t.some(o=>{for(let s=0;sn.endsWith("/**")&&n.length>3).map(n=>cd(n.slice(0,-3)));return t.length===0?null:n=>t.some(r=>r.test(n))}function Hp(e){if(!e||e.length===0)return null;let t=Lt(e.filter(r=>!r.startsWith("!"))),n=Lt(e.filter(r=>r.startsWith("!")).map(r=>r.slice(1)));return r=>(!t||t(r))&&!n?.(r)}var Ei=z(()=>{"use strict";$();it()});function JS(e){let t=e.split(/\r?\n/),n=[],r=null,o=!1,s=!1,a=!0;for(let l of t){if(r){r.test(l)&&(r=null),n.push("");continue}let c=/^\s*(`{3,}|~{3,})/.exec(l);if(c){r=new RegExp(`^\\s*${c[1][0]}{${c[1].length},}\\s*$`),s=!1,a=!1,n.push("");continue}let d=!l.trim(),u=/^(?: {4}|\t)/.test(l);if(s&&(d||u)){n.push("");continue}if(s=!1,u&&a&&!o){s=!0,n.push("");continue}d||(/^ {0,3}(?:[-*+]|\d+[.)])(?:\s|$)/.test(l)?o=!0:a&&!/^\s/.test(l)&&(o=!1)),a=d,n.push(l)}return n.join(` +`)}function KS(e){return!e||e.startsWith("#")||e.startsWith("//")?!0:/^[a-z][a-z0-9+.-]*:/i.test(e)}function Gp(e){return e.replace(/!\[[^\]]*\]\([^)]*\)/g,"").replace(/`([^`]*)`/g,"$1").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/[#>*_~-]+/g," ").replace(/\s+/g," ").trim()}function XS(e){return/[A-Za-zÀ-ɏ]{3,}/.test(e)}function ZS(e){return/^(all notable changes to this project|in the interest of fostering|this project adheres to|we as members and leaders|table of contents)\b/i.test(e)}function QS(e){let t=e.trim();return!!t&&!/^ {4}|^\t/.test(e)&&!/^([-*+]|\d+[.)])(\s|$)/.test(t)&&!/^[>|<]/.test(t)}function tk(e,t){let n=1;for(let r=t;rt?e.slice(t,r):void 0}}}function ud(e){let t=e,n,r=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/.exec(t);if(r){let y=/(^|\n)title:\s*["']?(.+?)["']?\s*(\n|$)/i.exec(r[1]);y&&(n=y[2].trim()),t=t.slice(r[0].length)}let o=JS(t),s=o.split(/\r?\n/),a=[],l=n,c,d=!1,u=(y,b)=>{let S=Gp(b);a.push(S),!l&&y===1&&(l=S),!c&&y>=2&&(d=!0)};for(let y=0;y");)y++;continue}if(!c&&!d&&C&&!/^([-*+]|\d+\.)\s/.test(C)&&!C.startsWith("|")&&!C.startsWith("<")){let I=Gp(C);I.length>=8&&XS(I)&&!I.endsWith(":")&&!ZS(I)&&(c=I.slice(0,200))}}let f=[],m=new Set,p=y=>{let b=y.trim();b=b.replace(/\s+["'(].*$/,"").trim(),b=b.replace(/^<|>$/g,""),!KS(b)&&(m.has(b)||(m.add(b),f.push({kind:"doc-link",spec:b})))},g=/!?\[[^\]]*\]\(/g,h;for(;h=g.exec(o);){let y=tk(o,g.lastIndex);y&&p(y)}let _=/^[^\S\r\n]*\[(?!\^)[^\]]+\]:\s+(\S+)/gm;for(;h=_.exec(o);)p(h[1]);return{title:l,summary:c,headings:a,refs:f}}var YS,ek,fd=z(()=>{"use strict";$();YS=/^ {0,3}(=+|-+)\s*$/;ek=/^>\s*\[!(?:note|tip|important|warning|caution)\]\s*$/i});function nk(e,t){if(!Ea.test(e))return!1;let n=e.trimEnd().length;return n>=[...t.trim()].length||n>=4}function qp(e){return e.replace(/``([^`]+)``/g,"$1").replace(/:[\w:.+-]+:`([^`<]*?)\s*<[^`>]*>`/g,"$1").replace(/:doc:`([^`]*)`/g,(t,n)=>n.slice(n.lastIndexOf("/")+1)).replace(/:[\w:.+-]+:`!?~?([^`]*)`/g,(t,n)=>n.startsWith("~")?n.slice(n.lastIndexOf(".")+1):n).replace(/`([^`<]*?)\s*<[^`>]*>`__?/g,"$1").replace(/`([^`]+)`__?/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/\|([^|\s][^|]*)\|/g,"$1").replace(/\s+/g," ").trim()}function md(e,t,n,r){let o=t.trim();if(!o||o==="self"||/[:*?[\]\s]/.test(o))return;if(!o.startsWith("/")){r({kind:"doc-link",spec:o+n});return}let s=e.split("/").length-1;for(let a=0;a<=s;a++)r({kind:"doc-link",spec:"../".repeat(a)+o.slice(1)+n,soft:!0})}function gd(e,t){let n=t.split(/\r?\n/),r=[],o,s,a=[],l=!1,c=[],d=new Set,u=y=>{let b=`${y.soft?"~":""}${y.spec}`;d.has(b)||(d.add(b),c.push(y))},f=(y,b)=>{let S=a.indexOf(y);S===-1&&(S=a.push(y)-1);let k=qp(b);r.push(k),o||(o=k),S>0&&!s&&(l=!0)},m=y=>!(n[y]??"").trim();for(let y=0;y]+)>\s*$/.exec(R);md(e,M?M[1]:R,".rst",u)}else ik.has(C)||p(v)}y=P-1;continue}if(/^\s*\.\.(?:\s|$)/.test(b)){y=g(y);continue}p(b),!s&&!l&&h(y)&&(s=_(y)),/::\s*$/.test(b)&&(y=g(y))}return{title:o,summary:s,headings:r,refs:c};function p(y){for(let b of y.matchAll(sk))md(e,b[1]??b[2],".rst",u)}function g(y){let b=pd(n[y]);for(;y+1b);)y++;return y}function h(y){let b=n[y];return!!b.trim()&&!/^\s/.test(b)&&(y===0||m(y-1))}function _(y){if(/^(?:[-*+•]\s|#\.\s|\d+[.)]\s|\(?[a-z0-9]\)\s|[+=|]|:[^:\s][^:]*:(?:\s|$))/i.test(n[y]))return;let b=[];for(let C=y;C{"use strict";$();Ea=/^([!-/:-@[-`{-~])\1+\s*$/;pd=e=>e.length-e.trimStart().length,rk=/^(\s*)\.\.\s+([\w:-]+)::\s*(.*)$/,sk=/:doc:`(?:[^`<]*<([^`>]+)>|([^`]+))`/g,ik=new Set(["code-block","code","sourcecode","literalinclude","doctest","testcode","testoutput","testsetup","testcleanup","ipython","math","raw","graphviz","productionlist","highlight","jinja"])});function dk(e){return e.lengthVp?!1:ck.test(e)}function uk(e){let t=e.trim();return!t||t.length>Vp||lk.has(t)?!1:Number.isFinite(Number(t))}function yd(e){let t=e,n=/^(?:[rRbBuUfF]{1,2}|@|\$)?(?:#*)?(['"`])/.exec(t);if(n){let r=n[1],o=t.indexOf(r),s=t.lastIndexOf(r),a=t.startsWith(r.repeat(3),o)&&s-o>=5&&t.endsWith(r.repeat(3),s+1)?3:1;s>o&&(t=t.slice(o+a,s+1-a))}return t}var Vp,ok,ak,lk,ck,nr,va=z(()=>{"use strict";$();de();Vp=80,ok=2,ak=256,lk=new Set(["0","1","-1","2","-2"]),ck=/[\p{L}\p{N}]/u;nr=class{seen=new Set;out=[];get full(){return this.out.length>=ak}add(t,n,r){if(this.full||t==="string"&&!dk(n)||t==="number"&&!uk(n)||t==="regex"&&!n)return;let o=`${t}\0${n}\0${r}`;this.seen.has(o)||(this.seen.add(o),this.out.push({value:n,line:r,kind:t}))}addString(t,n){this.add("string",yd(t),n)}result(){if(this.out.length)return this.out.sort((t,n)=>T(t.value,n.value)||t.line-n.line||T(t.kind,n.kind))}}});function Ra(){return"/home"}function Jp(){return"/tmp"}function Ca(){return typeof navigator<"u"&&navigator?.hardwareConcurrency?navigator.hardwareConcurrency:1}function Kp(){return Array.from({length:Ca()},()=>({model:"browser",speed:0,times:{user:0,nice:0,sys:0,idle:0,irq:0}}))}var vi=z(()=>{$()});function Ma(e){let t=typeof e=="string"?e:e.href;try{return decodeURIComponent(new URL(t).pathname)}catch{return t}}function Fr(e){return new URL(`file://${e.startsWith("/")?"":"/"}${e}`)}var Ri=z(()=>{$()});var _d={};Fc(_d,{createRequire:()=>mk,default:()=>pk});var mk,pk,bd=z(()=>{$();mk=()=>{throw new Error("node-only API in the browser build")},pk={}});function Es(e){if(e!==rr)throw new Error("Illegal constructor")}function Mi(e){return!!e&&typeof e.row=="number"&&typeof e.column=="number"}function rg(e){A=e}function vs(e){try{return new FinalizationRegistry(e)}catch(t){console.error("Unsupported FinalizationRegistry:",t);return}}function vd(e,t,n,r){let o=n-t,s=e.textCallback(t,r);if(s){for(t+=s.length;t0)t+=a.length,s+=a;else break}t>n&&(s=s.slice(0,o))}return s??""}function Ed(e,t,n,r,o){for(let s=0,a=o.length;s>>0,column:A.getValue(e+ee,"i32")>>>0}}function ig(e,t){Gt(e,t.startPosition),e+=Sn,Gt(e,t.endPosition),e+=Sn,A.setValue(e,t.startIndex,"i32"),e+=ee,A.setValue(e,t.endIndex,"i32"),e+=ee}function Ia(e){let t={};return t.startPosition=Or(e),e+=Sn,t.endPosition=Or(e),e+=Sn,t.startIndex=A.getValue(e,"i32")>>>0,e+=ee,t.endIndex=A.getValue(e,"i32")>>>0,t}function og(e,t=Z){Gt(t,e.startPosition),t+=Sn,Gt(t,e.oldEndPosition),t+=Sn,Gt(t,e.newEndPosition),t+=Sn,A.setValue(t,e.startIndex,"i32"),t+=ee,A.setValue(t,e.oldEndIndex,"i32"),t+=ee,A.setValue(t,e.newEndIndex,"i32"),t+=ee}function ag(e){let t=A.getValue(e,"i32"),n=A.getValue(e+=ee,"i32"),r=A.getValue(e+=ee,"i32");return{major_version:t,minor_version:n,patch_version:r}}async function lg(moduleArg={}){var moduleRtn,Module=moduleArg,ENVIRONMENT_IS_WEB=typeof window=="object",ENVIRONMENT_IS_WORKER=typeof WorkerGlobalScope<"u",ENVIRONMENT_IS_NODE=typeof F=="object"&&F.versions?.node&&F.type!="renderer";if(ENVIRONMENT_IS_NODE){let{createRequire:e}=await Promise.resolve().then(()=>(bd(),_d));var require=e(import.meta.url)}Module.currentQueryProgressCallback=null,Module.currentProgressCallback=null,Module.currentLogCallback=null,Module.currentParseCallback=null;var arguments_=[],thisProgram="./this.program",quit_=D((e,t)=>{throw t},"quit_"),_scriptName=import.meta.url,scriptDirectory="";function locateFile(e){return Module.locateFile?Module.locateFile(e,scriptDirectory):scriptDirectory+e}D(locateFile,"locateFile");var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("fs");_scriptName.startsWith("file:")&&(scriptDirectory=require("path").dirname(require("url").fileURLToPath(_scriptName))+"/"),readBinary=D(e=>{e=isFileURI(e)?new URL(e):e;var t=fs.readFileSync(e);return t},"readBinary"),readAsync=D(async(e,t=!0)=>{e=isFileURI(e)?new URL(e):e;var n=fs.readFileSync(e,t?void 0:"utf8");return n},"readAsync"),F.argv.length>1&&(thisProgram=F.argv[1].replace(/\\/g,"/")),arguments_=F.argv.slice(2),quit_=D((e,t)=>{throw F.exitCode=e,t},"quit_")}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}ENVIRONMENT_IS_WORKER&&(readBinary=D(e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)},"readBinary")),readAsync=D(async e=>{if(isFileURI(e))return new Promise((n,r)=>{var o=new XMLHttpRequest;o.open("GET",e,!0),o.responseType="arraybuffer",o.onload=()=>{if(o.status==200||o.status==0&&o.response){n(o.response);return}r(o.status)},o.onerror=r,o.send(null)});var t=await fetch(e,{credentials:"same-origin"});if(t.ok)return t.arrayBuffer();throw new Error(t.status+" : "+t.url)},"readAsync")}var out=console.log.bind(console),err=console.error.bind(console),dynamicLibraries=[],wasmBinary,ABORT=!1,EXITSTATUS,isFileURI=D(e=>e.startsWith("file://"),"isFileURI"),readyPromiseResolve,readyPromiseReject,wasmMemory,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64,HEAP64,HEAPU64,HEAP_DATA_VIEW,runtimeInitialized=!1;function updateMemoryViews(){var e=wasmMemory.buffer;Module.HEAP8=HEAP8=new Int8Array(e),Module.HEAP16=HEAP16=new Int16Array(e),Module.HEAPU8=HEAPU8=new Uint8Array(e),Module.HEAPU16=HEAPU16=new Uint16Array(e),Module.HEAP32=HEAP32=new Int32Array(e),Module.HEAPU32=HEAPU32=new Uint32Array(e),Module.HEAPF32=HEAPF32=new Float32Array(e),Module.HEAPF64=HEAPF64=new Float64Array(e),Module.HEAP64=HEAP64=new BigInt64Array(e),Module.HEAPU64=HEAPU64=new BigUint64Array(e),Module.HEAP_DATA_VIEW=HEAP_DATA_VIEW=new DataView(e),LE_HEAP_UPDATE()}D(updateMemoryViews,"updateMemoryViews");function initMemory(){if(Module.wasmMemory)wasmMemory=Module.wasmMemory;else{var e=Module.INITIAL_MEMORY||33554432;wasmMemory=new WebAssembly.Memory({initial:e/65536,maximum:32768})}updateMemoryViews()}D(initMemory,"initMemory");var __RELOC_FUNCS__=[];function preRun(){if(Module.preRun)for(typeof Module.preRun=="function"&&(Module.preRun=[Module.preRun]);Module.preRun.length;)addOnPreRun(Module.preRun.shift());callRuntimeCallbacks(onPreRuns)}D(preRun,"preRun");function initRuntime(){runtimeInitialized=!0,callRuntimeCallbacks(__RELOC_FUNCS__),wasmExports.__wasm_call_ctors(),callRuntimeCallbacks(onPostCtors)}D(initRuntime,"initRuntime");function preMain(){}D(preMain,"preMain");function postRun(){if(Module.postRun)for(typeof Module.postRun=="function"&&(Module.postRun=[Module.postRun]);Module.postRun.length;)addOnPostRun(Module.postRun.shift());callRuntimeCallbacks(onPostRuns)}D(postRun,"postRun");function abort(e){Module.onAbort?.(e),e="Aborted("+e+")",err(e),ABORT=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw readyPromiseReject?.(t),t}D(abort,"abort");var wasmBinaryFile;function findWasmBinary(){return Module.locateFile?locateFile("web-tree-sitter.wasm"):new URL("web-tree-sitter.wasm",import.meta.url).href}D(findWasmBinary,"findWasmBinary");function getBinarySync(e){if(e==wasmBinaryFile&&wasmBinary)return new Uint8Array(wasmBinary);if(readBinary)return readBinary(e);throw"both async and sync fetching of the wasm failed"}D(getBinarySync,"getBinarySync");async function getWasmBinary(e){if(!wasmBinary)try{var t=await readAsync(e);return new Uint8Array(t)}catch{}return getBinarySync(e)}D(getWasmBinary,"getWasmBinary");async function instantiateArrayBuffer(e,t){try{var n=await getWasmBinary(e),r=await WebAssembly.instantiate(n,t);return r}catch(o){err(`failed to asynchronously prepare wasm: ${o}`),abort(o)}}D(instantiateArrayBuffer,"instantiateArrayBuffer");async function instantiateAsync(e,t,n){if(!e&&!isFileURI(t)&&!ENVIRONMENT_IS_NODE)try{var r=fetch(t,{credentials:"same-origin"}),o=await WebAssembly.instantiateStreaming(r,n);return o}catch(s){err(`wasm streaming compile failed: ${s}`),err("falling back to ArrayBuffer instantiation")}return instantiateArrayBuffer(t,n)}D(instantiateAsync,"instantiateAsync");function getWasmImports(){return{env:wasmImports,wasi_snapshot_preview1:wasmImports,"GOT.mem":new Proxy(wasmImports,GOTHandler),"GOT.func":new Proxy(wasmImports,GOTHandler)}}D(getWasmImports,"getWasmImports");async function createWasm(){function e(s,a){wasmExports=s.exports,wasmExports=relocateExports(wasmExports,1024);var l=getDylinkMetadata(a);return l.neededDynlibs&&(dynamicLibraries=l.neededDynlibs.concat(dynamicLibraries)),mergeLibSymbols(wasmExports,"main"),LDSO.init(),loadDylibs(),__RELOC_FUNCS__.push(wasmExports.__wasm_apply_data_relocs),assignWasmExports(wasmExports),wasmExports}D(e,"receiveInstance");function t(s){return e(s.instance,s.module)}D(t,"receiveInstantiationResult");var n=getWasmImports();if(Module.instantiateWasm)return new Promise((s,a)=>{Module.instantiateWasm(n,(l,c)=>{s(e(l,c))})});wasmBinaryFile??=findWasmBinary();var r=await instantiateAsync(wasmBinary,wasmBinaryFile,n),o=t(r);return o}D(createWasm,"createWasm");class ExitStatus{static{D(this,"ExitStatus")}name="ExitStatus";constructor(t){this.message=`Program terminated with exit(${t})`,this.status=t}}var GOT={},currentModuleWeakSymbols=new Set([]),GOTHandler={get(e,t){var n=GOT[t];return n||(n=GOT[t]=new WebAssembly.Global({value:"i32",mutable:!0})),currentModuleWeakSymbols.has(t)||(n.required=!0),n}},LE_ATOMICS_NATIVE_BYTE_ORDER=[],LE_HEAP_LOAD_F32=D(e=>HEAP_DATA_VIEW.getFloat32(e,!0),"LE_HEAP_LOAD_F32"),LE_HEAP_LOAD_F64=D(e=>HEAP_DATA_VIEW.getFloat64(e,!0),"LE_HEAP_LOAD_F64"),LE_HEAP_LOAD_I16=D(e=>HEAP_DATA_VIEW.getInt16(e,!0),"LE_HEAP_LOAD_I16"),LE_HEAP_LOAD_I32=D(e=>HEAP_DATA_VIEW.getInt32(e,!0),"LE_HEAP_LOAD_I32"),LE_HEAP_LOAD_I64=D(e=>HEAP_DATA_VIEW.getBigInt64(e,!0),"LE_HEAP_LOAD_I64"),LE_HEAP_LOAD_U32=D(e=>HEAP_DATA_VIEW.getUint32(e,!0),"LE_HEAP_LOAD_U32"),LE_HEAP_STORE_F32=D((e,t)=>HEAP_DATA_VIEW.setFloat32(e,t,!0),"LE_HEAP_STORE_F32"),LE_HEAP_STORE_F64=D((e,t)=>HEAP_DATA_VIEW.setFloat64(e,t,!0),"LE_HEAP_STORE_F64"),LE_HEAP_STORE_I16=D((e,t)=>HEAP_DATA_VIEW.setInt16(e,t,!0),"LE_HEAP_STORE_I16"),LE_HEAP_STORE_I32=D((e,t)=>HEAP_DATA_VIEW.setInt32(e,t,!0),"LE_HEAP_STORE_I32"),LE_HEAP_STORE_I64=D((e,t)=>HEAP_DATA_VIEW.setBigInt64(e,t,!0),"LE_HEAP_STORE_I64"),LE_HEAP_STORE_U32=D((e,t)=>HEAP_DATA_VIEW.setUint32(e,t,!0),"LE_HEAP_STORE_U32"),callRuntimeCallbacks=D(e=>{for(;e.length>0;)e.shift()(Module)},"callRuntimeCallbacks"),onPostRuns=[],addOnPostRun=D(e=>onPostRuns.push(e),"addOnPostRun"),onPreRuns=[],addOnPreRun=D(e=>onPreRuns.push(e),"addOnPreRun"),UTF8Decoder=typeof TextDecoder<"u"?new TextDecoder:void 0,findStringEnd=D((e,t,n,r)=>{var o=t+n;if(r)return o;for(;e[t]&&!(t>=o);)++t;return t},"findStringEnd"),UTF8ArrayToString=D((e,t=0,n,r)=>{var o=findStringEnd(e,t,n,r);if(o-t>16&&e.buffer&&UTF8Decoder)return UTF8Decoder.decode(e.subarray(t,o));for(var s="";t>10,56320|d&1023)}}return s},"UTF8ArrayToString"),getDylinkMetadata=D(e=>{var t=0,n=0;function r(){return e[t++]}D(r,"getU8");function o(){for(var w=0,E=1;;){var N=e[t++];if(w+=(N&127)*E,E*=128,!(N&128))break}return w}D(o,"getLEB");function s(){var w=o();return t+=w,UTF8ArrayToString(e,t-w,w)}D(s,"getString");function a(){for(var w=o(),E=[];w--;)E.push(s());return E}D(a,"getStringList");function l(w,E){if(w)throw new Error(E)}if(D(l,"failIf"),e instanceof WebAssembly.Module){var c=WebAssembly.Module.customSections(e,"dylink.0");l(c.length===0,"need dylink section"),e=new Uint8Array(c[0]),n=e.length}else{var d=new Uint32Array(new Uint8Array(e.subarray(0,24)).buffer),u=d[0]==1836278016||d[0]==6386541;l(!u,"need to see wasm magic number"),l(e[8]!==0,"need the dylink section to be first"),t=9;var f=o();n=t+f;var m=s();l(m!=="dylink.0")}for(var p={neededDynlibs:[],tlsExports:new Set,weakImports:new Set,runtimePaths:[]},g=1,h=2,_=3,y=4,b=5,S=256,k=3,C=1;t>1)*2);case"i32":return LE_HEAP_LOAD_I32((e>>2)*4);case"i64":return LE_HEAP_LOAD_I64((e>>3)*8);case"float":return LE_HEAP_LOAD_F32((e>>2)*4);case"double":return LE_HEAP_LOAD_F64((e>>3)*8);case"*":return LE_HEAP_LOAD_U32((e>>2)*4);default:abort(`invalid type for getValue: ${t}`)}}D(getValue,"getValue");var newDSO=D((e,t,n)=>{var r={refcount:1/0,name:e,exports:n,global:!0};return LDSO.loadedLibsByName[e]=r,t!=null&&(LDSO.loadedLibsByHandle[t]=r),r},"newDSO"),LDSO={loadedLibsByName:{},loadedLibsByHandle:{},init(){newDSO("__main__",0,wasmImports)}},___heap_base=82240,alignMemory=D((e,t)=>Math.ceil(e/t)*t,"alignMemory"),getMemory=D(e=>{if(runtimeInitialized)return _calloc(e,1);var t=___heap_base,n=t+alignMemory(e,16);return ___heap_base=n,GOT.__heap_base.value=n,t},"getMemory"),isInternalSym=D(e=>["__cpp_exception","__c_longjmp","__wasm_apply_data_relocs","__dso_handle","__tls_size","__tls_align","__set_stack_limits","_emscripten_tls_init","__wasm_init_tls","__wasm_call_ctors","__start_em_asm","__stop_em_asm","__start_em_js","__stop_em_js"].includes(e)||e.startsWith("__em_js__"),"isInternalSym"),uleb128EncodeWithLen=D(e=>{let t=e.length;return[t%128|128,t>>7,...e]},"uleb128EncodeWithLen"),wasmTypeCodes={i:127,p:127,j:126,f:125,d:124,e:111},generateTypePack=D(e=>uleb128EncodeWithLen(Array.from(e,t=>{var n=wasmTypeCodes[t];return n})),"generateTypePack"),convertJsFunctionToWasm=D((e,t)=>{var n=Uint8Array.of(0,97,115,109,1,0,0,0,1,...uleb128EncodeWithLen([1,96,...generateTypePack(t.slice(1)),...generateTypePack(t[0]==="v"?"":t[0])]),2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),r=new WebAssembly.Module(n),o=new WebAssembly.Instance(r,{e:{f:e}}),s=o.exports.f;return s},"convertJsFunctionToWasm"),wasmTableMirror=[],wasmTable=new WebAssembly.Table({initial:31,element:"anyfunc"}),getWasmTableEntry=D(e=>{var t=wasmTableMirror[e];return t||(wasmTableMirror[e]=t=wasmTable.get(e)),t},"getWasmTableEntry"),updateTableMap=D((e,t)=>{if(functionsInTableMap)for(var n=e;n(functionsInTableMap||(functionsInTableMap=new WeakMap,updateTableMap(0,wasmTable.length)),functionsInTableMap.get(e)||0),"getFunctionAddress"),freeTableIndexes=[],getEmptyTableSlot=D(()=>freeTableIndexes.length?freeTableIndexes.pop():wasmTable.grow(1),"getEmptyTableSlot"),setWasmTableEntry=D((e,t)=>{wasmTable.set(e,t),wasmTableMirror[e]=wasmTable.get(e)},"setWasmTableEntry"),addFunction=D((e,t)=>{var n=getFunctionAddress(e);if(n)return n;var r=getEmptyTableSlot();try{setWasmTableEntry(r,e)}catch(s){if(!(s instanceof TypeError))throw s;var o=convertJsFunctionToWasm(e,t);setWasmTableEntry(r,o)}return functionsInTableMap.set(e,r),r},"addFunction"),updateGOT=D((e,t)=>{for(var n in e)if(!isInternalSym(n)){var r=e[n];GOT[n]||=new WebAssembly.Global({value:"i32",mutable:!0}),(t||GOT[n].value==0)&&(typeof r=="function"?GOT[n].value=addFunction(r):typeof r=="number"?GOT[n].value=r:err(`unhandled export type for '${n}': ${typeof r}`))}},"updateGOT"),relocateExports=D((e,t,n)=>{var r={};for(var o in e){var s=e[o];typeof s=="object"&&(s=s.value),typeof s=="number"&&(s+=t),r[o]=s}return updateGOT(r,n),r},"relocateExports"),isSymbolDefined=D(e=>{var t=wasmImports[e];return!(!t||t.stub)},"isSymbolDefined"),dynCall=D((e,t,n=[],r=!1)=>{var o=getWasmTableEntry(t),s=o(...n);function a(l){return l}return D(a,"convert"),s},"dynCall"),stackSave=D(()=>_emscripten_stack_get_current(),"stackSave"),stackRestore=D(e=>__emscripten_stack_restore(e),"stackRestore"),createInvokeFunction=D(e=>(t,...n)=>{var r=stackSave();try{return dynCall(e,t,n)}catch(o){if(stackRestore(r),o!==o+0)throw o;if(_setThrew(1,0),e[0]=="j")return 0n}},"createInvokeFunction"),resolveGlobalSymbol=D((e,t=!1)=>{var n;return isSymbolDefined(e)?n=wasmImports[e]:e.startsWith("invoke_")&&(n=wasmImports[e]=createInvokeFunction(e.split("_")[1])),{sym:n,name:e}},"resolveGlobalSymbol"),onPostCtors=[],addOnPostCtor=D(e=>onPostCtors.push(e),"addOnPostCtor"),UTF8ToString=D((e,t,n)=>e?UTF8ArrayToString(HEAPU8,e,t,n):"","UTF8ToString"),loadWebAssemblyModule=D((binary,flags,libName,localScope,handle)=>{var metadata=getDylinkMetadata(binary);function loadModule(){var memAlign=Math.pow(2,metadata.memoryAlign),memoryBase=metadata.memorySize?alignMemory(getMemory(metadata.memorySize+memAlign),memAlign):0,tableBase=metadata.tableSize?wasmTable.length:0;handle&&(HEAP8[handle+8]=1,LE_HEAP_STORE_U32((handle+12>>2)*4,memoryBase),LE_HEAP_STORE_I32((handle+16>>2)*4,metadata.memorySize),LE_HEAP_STORE_U32((handle+20>>2)*4,tableBase),LE_HEAP_STORE_I32((handle+24>>2)*4,metadata.tableSize)),metadata.tableSize&&wasmTable.grow(metadata.tableSize);var moduleExports;function resolveSymbol(e){var t=resolveGlobalSymbol(e).sym;return!t&&localScope&&(t=localScope[e]),t||(t=moduleExports[e]),t}D(resolveSymbol,"resolveSymbol");var proxyHandler={get(e,t){switch(t){case"__memory_base":return memoryBase;case"__table_base":return tableBase}if(t in wasmImports&&!wasmImports[t].stub){var n=wasmImports[t];return n}if(!(t in e)){var r;e[t]=(...o)=>(r||=resolveSymbol(t),r(...o))}return e[t]}},proxy=new Proxy({},proxyHandler);currentModuleWeakSymbols=metadata.weakImports;var info={"GOT.mem":new Proxy({},GOTHandler),"GOT.func":new Proxy({},GOTHandler),env:proxy,wasi_snapshot_preview1:proxy};function postInstantiation(module,instance){updateTableMap(tableBase,metadata.tableSize),moduleExports=relocateExports(instance.exports,memoryBase),flags.allowUndefined||reportUndefinedSymbols();function addEmAsm(addr,body){for(var args=[],arity=0;arity<16&&body.indexOf("$"+arity)!=-1;arity++)args.push("$"+arity);args=args.join(",");var func=`(${args}) => { ${body} };`;ASM_CONSTS[start]=eval(func)}if(D(addEmAsm,"addEmAsm"),"__start_em_asm"in moduleExports)for(var start=moduleExports.__start_em_asm,stop=moduleExports.__stop_em_asm;start ${body};`;moduleExports[name]=eval(func)}D(addEmJs,"addEmJs");for(var name in moduleExports)if(name.startsWith("__em_js__")){var start=moduleExports[name],jsString=UTF8ToString(start),parts=jsString.split("<::>");addEmJs(name.replace("__em_js__",""),parts[0],parts[1]),delete moduleExports[name]}var applyRelocs=moduleExports.__wasm_apply_data_relocs;applyRelocs&&(runtimeInitialized?applyRelocs():__RELOC_FUNCS__.push(applyRelocs));var init=moduleExports.__wasm_call_ctors;return init&&(runtimeInitialized?init():addOnPostCtor(init)),moduleExports}if(D(postInstantiation,"postInstantiation"),flags.loadAsync)return(async()=>{var e;return binary instanceof WebAssembly.Module?e=new WebAssembly.Instance(binary,info):{module:binary,instance:e}=await WebAssembly.instantiate(binary,info),postInstantiation(binary,e)})();var module=binary instanceof WebAssembly.Module?binary:new WebAssembly.Module(binary),instance=new WebAssembly.Instance(module,info);return postInstantiation(module,instance)}return D(loadModule,"loadModule"),flags={...flags,rpath:{parentLibPath:libName,paths:metadata.runtimePaths}},flags.loadAsync?metadata.neededDynlibs.reduce((e,t)=>e.then(()=>loadDynamicLibrary(t,flags,localScope)),Promise.resolve()).then(loadModule):(metadata.neededDynlibs.forEach(e=>loadDynamicLibrary(e,flags,localScope)),loadModule())},"loadWebAssemblyModule"),mergeLibSymbols=D((e,t)=>{for(var[n,r]of Object.entries(e)){let o=D(a=>{isSymbolDefined(a)||(wasmImports[a]=r)},"setImport");o(n);let s="__main_argc_argv";n=="main"&&o(s),n==s&&o("main")}},"mergeLibSymbols"),asyncLoad=D(async e=>{var t=await readAsync(e);return new Uint8Array(t)},"asyncLoad");function loadDynamicLibrary(e,t={global:!0,nodelete:!0},n,r){var o=LDSO.loadedLibsByName[e];if(o)return t.global?o.global||(o.global=!0,mergeLibSymbols(o.exports,e)):n&&Object.assign(n,o.exports),t.nodelete&&o.refcount!==1/0&&(o.refcount=1/0),o.refcount++,r&&(LDSO.loadedLibsByHandle[r]=o),t.loadAsync?Promise.resolve(!0):!0;o=newDSO(e,r,"loading"),o.refcount=t.nodelete?1/0:1,o.global=t.global;function s(){if(r){var c=LE_HEAP_LOAD_U32((r+28>>2)*4),d=LE_HEAP_LOAD_U32((r+32>>2)*4);if(c&&d){var u=HEAP8.slice(c,c+d);return t.loadAsync?Promise.resolve(u):u}}var f=locateFile(e);if(t.loadAsync)return asyncLoad(f);if(!readBinary)throw new Error(`${f}: file not found, and synchronous loading of external files is not available`);return readBinary(f)}D(s,"loadLibData");function a(){return t.loadAsync?s().then(c=>loadWebAssemblyModule(c,t,e,n,r)):loadWebAssemblyModule(s(),t,e,n,r)}D(a,"getExports");function l(c){o.global?mergeLibSymbols(c,e):n&&Object.assign(n,c),o.exports=c}return D(l,"moduleLoaded"),t.loadAsync?a().then(c=>(l(c),!0)):(l(a()),!0)}D(loadDynamicLibrary,"loadDynamicLibrary");var reportUndefinedSymbols=D(()=>{for(var[e,t]of Object.entries(GOT))if(t.value==0){var n=resolveGlobalSymbol(e,!0).sym;if(!n&&!t.required)continue;if(typeof n=="function")t.value=addFunction(n,n.sig);else if(typeof n=="number")t.value=n;else throw new Error(`bad export type for '${e}': ${typeof n}`)}},"reportUndefinedSymbols"),runDependencies=0,dependenciesFulfilled=null,removeRunDependency=D(e=>{if(runDependencies--,Module.monitorRunDependencies?.(runDependencies),runDependencies==0&&dependenciesFulfilled){var t=dependenciesFulfilled;dependenciesFulfilled=null,t()}},"removeRunDependency"),addRunDependency=D(e=>{runDependencies++,Module.monitorRunDependencies?.(runDependencies)},"addRunDependency"),loadDylibs=D(async()=>{if(!dynamicLibraries.length){reportUndefinedSymbols();return}addRunDependency("loadDylibs");for(var e of dynamicLibraries)await loadDynamicLibrary(e,{loadAsync:!0,global:!0,nodelete:!0,allowUndefined:!0});reportUndefinedSymbols(),removeRunDependency("loadDylibs")},"loadDylibs"),noExitRuntime=!0;function setValue(e,t,n="i8"){switch(n.endsWith("*")&&(n="*"),n){case"i1":HEAP8[e]=t;break;case"i8":HEAP8[e]=t;break;case"i16":LE_HEAP_STORE_I16((e>>1)*2,t);break;case"i32":LE_HEAP_STORE_I32((e>>2)*4,t);break;case"i64":LE_HEAP_STORE_I64((e>>3)*8,BigInt(t));break;case"float":LE_HEAP_STORE_F32((e>>2)*4,t);break;case"double":LE_HEAP_STORE_F64((e>>3)*8,t);break;case"*":LE_HEAP_STORE_U32((e>>2)*4,t);break;default:abort(`invalid type for setValue: ${n}`)}}D(setValue,"setValue");var ___memory_base=new WebAssembly.Global({value:"i32",mutable:!1},1024),___stack_high=82240,___stack_low=16704,___stack_pointer=new WebAssembly.Global({value:"i32",mutable:!0},82240),___table_base=new WebAssembly.Global({value:"i32",mutable:!1},1),__abort_js=D(()=>abort(""),"__abort_js");__abort_js.sig="v";var getHeapMax=D(()=>2147483648,"getHeapMax"),growMemory=D(e=>{var t=wasmMemory.buffer.byteLength,n=(e-t+65535)/65536|0;try{return wasmMemory.grow(n),updateMemoryViews(),1}catch{}},"growMemory"),_emscripten_resize_heap=D(e=>{var t=HEAPU8.length;e>>>=0;var n=getHeapMax();if(e>n)return!1;for(var r=1;r<=4;r*=2){var o=t*(1+.2/r);o=Math.min(o,e+100663296);var s=Math.min(n,alignMemory(Math.max(e,o),65536)),a=growMemory(s);if(a)return!0}return!1},"_emscripten_resize_heap");_emscripten_resize_heap.sig="ip";var _fd_close=D(e=>52,"_fd_close");_fd_close.sig="ii";var INT53_MAX=9007199254740992,INT53_MIN=-9007199254740992,bigintToI53Checked=D(e=>eINT53_MAX?NaN:Number(e),"bigintToI53Checked");function _fd_seek(e,t,n,r){return t=bigintToI53Checked(t),70}D(_fd_seek,"_fd_seek"),_fd_seek.sig="iijip";var printCharBuffers=[null,[],[]],printChar=D((e,t)=>{var n=printCharBuffers[e];t===0||t===10?((e===1?out:err)(UTF8ArrayToString(n)),n.length=0):n.push(t)},"printChar"),_fd_write=D((e,t,n,r)=>{for(var o=0,s=0;s>2)*4),l=LE_HEAP_LOAD_U32((t+4>>2)*4);t+=8;for(var c=0;c>2)*4,o),0},"_fd_write");_fd_write.sig="iippp";function _tree_sitter_log_callback(e,t){if(Module.currentLogCallback){let n=UTF8ToString(t);Module.currentLogCallback(n,e!==0)}}D(_tree_sitter_log_callback,"_tree_sitter_log_callback");function _tree_sitter_parse_callback(e,t,n,r,o){let a=Module.currentParseCallback(t,{row:n,column:r});typeof a=="string"?(setValue(o,a.length,"i32"),stringToUTF16(a,e,10240)):setValue(o,0,"i32")}D(_tree_sitter_parse_callback,"_tree_sitter_parse_callback");function _tree_sitter_progress_callback(e,t){return Module.currentProgressCallback?Module.currentProgressCallback({currentOffset:e,hasError:t}):!1}D(_tree_sitter_progress_callback,"_tree_sitter_progress_callback");function _tree_sitter_query_progress_callback(e){return Module.currentQueryProgressCallback?Module.currentQueryProgressCallback({currentOffset:e}):!1}D(_tree_sitter_query_progress_callback,"_tree_sitter_query_progress_callback");var runtimeKeepaliveCounter=0,keepRuntimeAlive=D(()=>noExitRuntime||runtimeKeepaliveCounter>0,"keepRuntimeAlive"),_proc_exit=D(e=>{EXITSTATUS=e,keepRuntimeAlive()||(Module.onExit?.(e),ABORT=!0),quit_(e,new ExitStatus(e))},"_proc_exit");_proc_exit.sig="vi";var exitJS=D((e,t)=>{EXITSTATUS=e,_proc_exit(e)},"exitJS"),handleException=D(e=>{if(e instanceof ExitStatus||e=="unwind")return EXITSTATUS;quit_(1,e)},"handleException"),lengthBytesUTF8=D(e=>{for(var t=0,n=0;n=55296&&r<=57343?(t+=4,++n):t+=3}return t},"lengthBytesUTF8"),stringToUTF8Array=D((e,t,n,r)=>{if(!(r>0))return 0;for(var o=n,s=n+r-1,a=0;a=s)break;t[n++]=l}else if(l<=2047){if(n+1>=s)break;t[n++]=192|l>>6,t[n++]=128|l&63}else if(l<=65535){if(n+2>=s)break;t[n++]=224|l>>12,t[n++]=128|l>>6&63,t[n++]=128|l&63}else{if(n+3>=s)break;t[n++]=240|l>>18,t[n++]=128|l>>12&63,t[n++]=128|l>>6&63,t[n++]=128|l&63,a++}}return t[n]=0,n-o},"stringToUTF8Array"),stringToUTF8=D((e,t,n)=>stringToUTF8Array(e,HEAPU8,t,n),"stringToUTF8"),stackAlloc=D(e=>__emscripten_stack_alloc(e),"stackAlloc"),stringToUTF8OnStack=D(e=>{var t=lengthBytesUTF8(e)+1,n=stackAlloc(t);return stringToUTF8(e,n,t),n},"stringToUTF8OnStack"),AsciiToString=D(e=>{for(var t="";;){var n=HEAPU8[e++];if(!n)return t;t+=String.fromCharCode(n)}},"AsciiToString"),stringToUTF16=D((e,t,n)=>{if(n??=2147483647,n<2)return 0;n-=2;for(var r=t,o=n>1)*2,a),t+=2}return LE_HEAP_STORE_I16((t>>1)*2,0),t-r},"stringToUTF16");LE_ATOMICS_NATIVE_BYTE_ORDER=new Int8Array(new Int16Array([1]).buffer)[0]===1?[(e=>e),(e=>e),void 0,(e=>e)]:[(e=>e),(e=>((e&65280)<<8|(e&255)<<24)>>16),void 0,(e=>e>>24&255|e>>8&65280|(e&65280)<<8|(e&255)<<24)];function LE_HEAP_UPDATE(){HEAPU16.unsigned=(e=>e&65535),HEAPU32.unsigned=(e=>e>>>0)}if(D(LE_HEAP_UPDATE,"LE_HEAP_UPDATE"),initMemory(),Module.noExitRuntime&&(noExitRuntime=Module.noExitRuntime),Module.print&&(out=Module.print),Module.printErr&&(err=Module.printErr),Module.dynamicLibraries&&(dynamicLibraries=Module.dynamicLibraries),Module.wasmBinary&&(wasmBinary=Module.wasmBinary),Module.arguments&&(arguments_=Module.arguments),Module.thisProgram&&(thisProgram=Module.thisProgram),Module.preInit)for(typeof Module.preInit=="function"&&(Module.preInit=[Module.preInit]);Module.preInit.length>0;)Module.preInit.shift()();Module.setValue=setValue,Module.getValue=getValue,Module.UTF8ToString=UTF8ToString,Module.stringToUTF8=stringToUTF8,Module.lengthBytesUTF8=lengthBytesUTF8,Module.AsciiToString=AsciiToString,Module.stringToUTF16=stringToUTF16,Module.loadWebAssemblyModule=loadWebAssemblyModule,Module.LE_HEAP_STORE_I64=LE_HEAP_STORE_I64;var ASM_CONSTS={},_malloc,_calloc,_realloc,_free,_ts_range_edit,_memcmp,_ts_language_symbol_count,_ts_language_state_count,_ts_language_abi_version,_ts_language_name,_ts_language_field_count,_ts_language_next_state,_ts_language_symbol_name,_ts_language_symbol_for_name,_strncmp,_ts_language_symbol_type,_ts_language_field_name_for_id,_ts_lookahead_iterator_new,_ts_lookahead_iterator_delete,_ts_lookahead_iterator_reset_state,_ts_lookahead_iterator_reset,_ts_lookahead_iterator_next,_ts_lookahead_iterator_current_symbol,_ts_point_edit,_ts_parser_delete,_ts_parser_reset,_ts_parser_set_language,_ts_parser_set_included_ranges,_ts_query_new,_ts_query_delete,_iswspace,_iswalnum,_ts_query_copy,_ts_query_pattern_count,_ts_query_capture_count,_ts_query_string_count,_ts_query_capture_name_for_id,_ts_query_capture_quantifier_for_id,_ts_query_string_value_for_id,_ts_query_predicates_for_pattern,_ts_query_start_byte_for_pattern,_ts_query_end_byte_for_pattern,_ts_query_is_pattern_rooted,_ts_query_is_pattern_non_local,_ts_query_is_pattern_guaranteed_at_step,_ts_query_disable_capture,_ts_query_disable_pattern,_ts_tree_copy,_ts_tree_delete,_ts_init,_ts_parser_new_wasm,_ts_parser_enable_logger_wasm,_ts_parser_parse_wasm,_ts_parser_included_ranges_wasm,_ts_language_type_is_named_wasm,_ts_language_type_is_visible_wasm,_ts_language_metadata_wasm,_ts_language_supertypes_wasm,_ts_language_subtypes_wasm,_ts_tree_root_node_wasm,_ts_tree_root_node_with_offset_wasm,_ts_tree_edit_wasm,_ts_tree_included_ranges_wasm,_ts_tree_get_changed_ranges_wasm,_ts_tree_cursor_new_wasm,_ts_tree_cursor_copy_wasm,_ts_tree_cursor_delete_wasm,_ts_tree_cursor_reset_wasm,_ts_tree_cursor_reset_to_wasm,_ts_tree_cursor_goto_first_child_wasm,_ts_tree_cursor_goto_last_child_wasm,_ts_tree_cursor_goto_first_child_for_index_wasm,_ts_tree_cursor_goto_first_child_for_position_wasm,_ts_tree_cursor_goto_next_sibling_wasm,_ts_tree_cursor_goto_previous_sibling_wasm,_ts_tree_cursor_goto_descendant_wasm,_ts_tree_cursor_goto_parent_wasm,_ts_tree_cursor_current_node_type_id_wasm,_ts_tree_cursor_current_node_state_id_wasm,_ts_tree_cursor_current_node_is_named_wasm,_ts_tree_cursor_current_node_is_missing_wasm,_ts_tree_cursor_current_node_id_wasm,_ts_tree_cursor_start_position_wasm,_ts_tree_cursor_end_position_wasm,_ts_tree_cursor_start_index_wasm,_ts_tree_cursor_end_index_wasm,_ts_tree_cursor_current_field_id_wasm,_ts_tree_cursor_current_depth_wasm,_ts_tree_cursor_current_descendant_index_wasm,_ts_tree_cursor_current_node_wasm,_ts_node_symbol_wasm,_ts_node_field_name_for_child_wasm,_ts_node_field_name_for_named_child_wasm,_ts_node_children_by_field_id_wasm,_ts_node_first_child_for_byte_wasm,_ts_node_first_named_child_for_byte_wasm,_ts_node_grammar_symbol_wasm,_ts_node_child_count_wasm,_ts_node_named_child_count_wasm,_ts_node_child_wasm,_ts_node_named_child_wasm,_ts_node_child_by_field_id_wasm,_ts_node_next_sibling_wasm,_ts_node_prev_sibling_wasm,_ts_node_next_named_sibling_wasm,_ts_node_prev_named_sibling_wasm,_ts_node_descendant_count_wasm,_ts_node_parent_wasm,_ts_node_child_with_descendant_wasm,_ts_node_descendant_for_index_wasm,_ts_node_named_descendant_for_index_wasm,_ts_node_descendant_for_position_wasm,_ts_node_named_descendant_for_position_wasm,_ts_node_start_point_wasm,_ts_node_end_point_wasm,_ts_node_start_index_wasm,_ts_node_end_index_wasm,_ts_node_to_string_wasm,_ts_node_children_wasm,_ts_node_named_children_wasm,_ts_node_descendants_of_type_wasm,_ts_node_is_named_wasm,_ts_node_has_changes_wasm,_ts_node_has_error_wasm,_ts_node_is_error_wasm,_ts_node_is_missing_wasm,_ts_node_is_extra_wasm,_ts_node_parse_state_wasm,_ts_node_next_parse_state_wasm,_ts_query_matches_wasm,_ts_query_captures_wasm,_memset,_memcpy,_memmove,_iswalpha,_iswblank,_iswdigit,_iswlower,_iswpunct,_iswupper,_iswxdigit,_memchr,_strlen,_strcmp,_strncat,_strncpy,_towlower,_towupper,_setThrew,__emscripten_stack_restore,__emscripten_stack_alloc,_emscripten_stack_get_current,___wasm_apply_data_relocs;function assignWasmExports(e){Module._malloc=_malloc=e.malloc,Module._calloc=_calloc=e.calloc,Module._realloc=_realloc=e.realloc,Module._free=_free=e.free,Module._ts_range_edit=_ts_range_edit=e.ts_range_edit,Module._memcmp=_memcmp=e.memcmp,Module._ts_language_symbol_count=_ts_language_symbol_count=e.ts_language_symbol_count,Module._ts_language_state_count=_ts_language_state_count=e.ts_language_state_count,Module._ts_language_abi_version=_ts_language_abi_version=e.ts_language_abi_version,Module._ts_language_name=_ts_language_name=e.ts_language_name,Module._ts_language_field_count=_ts_language_field_count=e.ts_language_field_count,Module._ts_language_next_state=_ts_language_next_state=e.ts_language_next_state,Module._ts_language_symbol_name=_ts_language_symbol_name=e.ts_language_symbol_name,Module._ts_language_symbol_for_name=_ts_language_symbol_for_name=e.ts_language_symbol_for_name,Module._strncmp=_strncmp=e.strncmp,Module._ts_language_symbol_type=_ts_language_symbol_type=e.ts_language_symbol_type,Module._ts_language_field_name_for_id=_ts_language_field_name_for_id=e.ts_language_field_name_for_id,Module._ts_lookahead_iterator_new=_ts_lookahead_iterator_new=e.ts_lookahead_iterator_new,Module._ts_lookahead_iterator_delete=_ts_lookahead_iterator_delete=e.ts_lookahead_iterator_delete,Module._ts_lookahead_iterator_reset_state=_ts_lookahead_iterator_reset_state=e.ts_lookahead_iterator_reset_state,Module._ts_lookahead_iterator_reset=_ts_lookahead_iterator_reset=e.ts_lookahead_iterator_reset,Module._ts_lookahead_iterator_next=_ts_lookahead_iterator_next=e.ts_lookahead_iterator_next,Module._ts_lookahead_iterator_current_symbol=_ts_lookahead_iterator_current_symbol=e.ts_lookahead_iterator_current_symbol,Module._ts_point_edit=_ts_point_edit=e.ts_point_edit,Module._ts_parser_delete=_ts_parser_delete=e.ts_parser_delete,Module._ts_parser_reset=_ts_parser_reset=e.ts_parser_reset,Module._ts_parser_set_language=_ts_parser_set_language=e.ts_parser_set_language,Module._ts_parser_set_included_ranges=_ts_parser_set_included_ranges=e.ts_parser_set_included_ranges,Module._ts_query_new=_ts_query_new=e.ts_query_new,Module._ts_query_delete=_ts_query_delete=e.ts_query_delete,Module._iswspace=_iswspace=e.iswspace,Module._iswalnum=_iswalnum=e.iswalnum,Module._ts_query_copy=_ts_query_copy=e.ts_query_copy,Module._ts_query_pattern_count=_ts_query_pattern_count=e.ts_query_pattern_count,Module._ts_query_capture_count=_ts_query_capture_count=e.ts_query_capture_count,Module._ts_query_string_count=_ts_query_string_count=e.ts_query_string_count,Module._ts_query_capture_name_for_id=_ts_query_capture_name_for_id=e.ts_query_capture_name_for_id,Module._ts_query_capture_quantifier_for_id=_ts_query_capture_quantifier_for_id=e.ts_query_capture_quantifier_for_id,Module._ts_query_string_value_for_id=_ts_query_string_value_for_id=e.ts_query_string_value_for_id,Module._ts_query_predicates_for_pattern=_ts_query_predicates_for_pattern=e.ts_query_predicates_for_pattern,Module._ts_query_start_byte_for_pattern=_ts_query_start_byte_for_pattern=e.ts_query_start_byte_for_pattern,Module._ts_query_end_byte_for_pattern=_ts_query_end_byte_for_pattern=e.ts_query_end_byte_for_pattern,Module._ts_query_is_pattern_rooted=_ts_query_is_pattern_rooted=e.ts_query_is_pattern_rooted,Module._ts_query_is_pattern_non_local=_ts_query_is_pattern_non_local=e.ts_query_is_pattern_non_local,Module._ts_query_is_pattern_guaranteed_at_step=_ts_query_is_pattern_guaranteed_at_step=e.ts_query_is_pattern_guaranteed_at_step,Module._ts_query_disable_capture=_ts_query_disable_capture=e.ts_query_disable_capture,Module._ts_query_disable_pattern=_ts_query_disable_pattern=e.ts_query_disable_pattern,Module._ts_tree_copy=_ts_tree_copy=e.ts_tree_copy,Module._ts_tree_delete=_ts_tree_delete=e.ts_tree_delete,Module._ts_init=_ts_init=e.ts_init,Module._ts_parser_new_wasm=_ts_parser_new_wasm=e.ts_parser_new_wasm,Module._ts_parser_enable_logger_wasm=_ts_parser_enable_logger_wasm=e.ts_parser_enable_logger_wasm,Module._ts_parser_parse_wasm=_ts_parser_parse_wasm=e.ts_parser_parse_wasm,Module._ts_parser_included_ranges_wasm=_ts_parser_included_ranges_wasm=e.ts_parser_included_ranges_wasm,Module._ts_language_type_is_named_wasm=_ts_language_type_is_named_wasm=e.ts_language_type_is_named_wasm,Module._ts_language_type_is_visible_wasm=_ts_language_type_is_visible_wasm=e.ts_language_type_is_visible_wasm,Module._ts_language_metadata_wasm=_ts_language_metadata_wasm=e.ts_language_metadata_wasm,Module._ts_language_supertypes_wasm=_ts_language_supertypes_wasm=e.ts_language_supertypes_wasm,Module._ts_language_subtypes_wasm=_ts_language_subtypes_wasm=e.ts_language_subtypes_wasm,Module._ts_tree_root_node_wasm=_ts_tree_root_node_wasm=e.ts_tree_root_node_wasm,Module._ts_tree_root_node_with_offset_wasm=_ts_tree_root_node_with_offset_wasm=e.ts_tree_root_node_with_offset_wasm,Module._ts_tree_edit_wasm=_ts_tree_edit_wasm=e.ts_tree_edit_wasm,Module._ts_tree_included_ranges_wasm=_ts_tree_included_ranges_wasm=e.ts_tree_included_ranges_wasm,Module._ts_tree_get_changed_ranges_wasm=_ts_tree_get_changed_ranges_wasm=e.ts_tree_get_changed_ranges_wasm,Module._ts_tree_cursor_new_wasm=_ts_tree_cursor_new_wasm=e.ts_tree_cursor_new_wasm,Module._ts_tree_cursor_copy_wasm=_ts_tree_cursor_copy_wasm=e.ts_tree_cursor_copy_wasm,Module._ts_tree_cursor_delete_wasm=_ts_tree_cursor_delete_wasm=e.ts_tree_cursor_delete_wasm,Module._ts_tree_cursor_reset_wasm=_ts_tree_cursor_reset_wasm=e.ts_tree_cursor_reset_wasm,Module._ts_tree_cursor_reset_to_wasm=_ts_tree_cursor_reset_to_wasm=e.ts_tree_cursor_reset_to_wasm,Module._ts_tree_cursor_goto_first_child_wasm=_ts_tree_cursor_goto_first_child_wasm=e.ts_tree_cursor_goto_first_child_wasm,Module._ts_tree_cursor_goto_last_child_wasm=_ts_tree_cursor_goto_last_child_wasm=e.ts_tree_cursor_goto_last_child_wasm,Module._ts_tree_cursor_goto_first_child_for_index_wasm=_ts_tree_cursor_goto_first_child_for_index_wasm=e.ts_tree_cursor_goto_first_child_for_index_wasm,Module._ts_tree_cursor_goto_first_child_for_position_wasm=_ts_tree_cursor_goto_first_child_for_position_wasm=e.ts_tree_cursor_goto_first_child_for_position_wasm,Module._ts_tree_cursor_goto_next_sibling_wasm=_ts_tree_cursor_goto_next_sibling_wasm=e.ts_tree_cursor_goto_next_sibling_wasm,Module._ts_tree_cursor_goto_previous_sibling_wasm=_ts_tree_cursor_goto_previous_sibling_wasm=e.ts_tree_cursor_goto_previous_sibling_wasm,Module._ts_tree_cursor_goto_descendant_wasm=_ts_tree_cursor_goto_descendant_wasm=e.ts_tree_cursor_goto_descendant_wasm,Module._ts_tree_cursor_goto_parent_wasm=_ts_tree_cursor_goto_parent_wasm=e.ts_tree_cursor_goto_parent_wasm,Module._ts_tree_cursor_current_node_type_id_wasm=_ts_tree_cursor_current_node_type_id_wasm=e.ts_tree_cursor_current_node_type_id_wasm,Module._ts_tree_cursor_current_node_state_id_wasm=_ts_tree_cursor_current_node_state_id_wasm=e.ts_tree_cursor_current_node_state_id_wasm,Module._ts_tree_cursor_current_node_is_named_wasm=_ts_tree_cursor_current_node_is_named_wasm=e.ts_tree_cursor_current_node_is_named_wasm,Module._ts_tree_cursor_current_node_is_missing_wasm=_ts_tree_cursor_current_node_is_missing_wasm=e.ts_tree_cursor_current_node_is_missing_wasm,Module._ts_tree_cursor_current_node_id_wasm=_ts_tree_cursor_current_node_id_wasm=e.ts_tree_cursor_current_node_id_wasm,Module._ts_tree_cursor_start_position_wasm=_ts_tree_cursor_start_position_wasm=e.ts_tree_cursor_start_position_wasm,Module._ts_tree_cursor_end_position_wasm=_ts_tree_cursor_end_position_wasm=e.ts_tree_cursor_end_position_wasm,Module._ts_tree_cursor_start_index_wasm=_ts_tree_cursor_start_index_wasm=e.ts_tree_cursor_start_index_wasm,Module._ts_tree_cursor_end_index_wasm=_ts_tree_cursor_end_index_wasm=e.ts_tree_cursor_end_index_wasm,Module._ts_tree_cursor_current_field_id_wasm=_ts_tree_cursor_current_field_id_wasm=e.ts_tree_cursor_current_field_id_wasm,Module._ts_tree_cursor_current_depth_wasm=_ts_tree_cursor_current_depth_wasm=e.ts_tree_cursor_current_depth_wasm,Module._ts_tree_cursor_current_descendant_index_wasm=_ts_tree_cursor_current_descendant_index_wasm=e.ts_tree_cursor_current_descendant_index_wasm,Module._ts_tree_cursor_current_node_wasm=_ts_tree_cursor_current_node_wasm=e.ts_tree_cursor_current_node_wasm,Module._ts_node_symbol_wasm=_ts_node_symbol_wasm=e.ts_node_symbol_wasm,Module._ts_node_field_name_for_child_wasm=_ts_node_field_name_for_child_wasm=e.ts_node_field_name_for_child_wasm,Module._ts_node_field_name_for_named_child_wasm=_ts_node_field_name_for_named_child_wasm=e.ts_node_field_name_for_named_child_wasm,Module._ts_node_children_by_field_id_wasm=_ts_node_children_by_field_id_wasm=e.ts_node_children_by_field_id_wasm,Module._ts_node_first_child_for_byte_wasm=_ts_node_first_child_for_byte_wasm=e.ts_node_first_child_for_byte_wasm,Module._ts_node_first_named_child_for_byte_wasm=_ts_node_first_named_child_for_byte_wasm=e.ts_node_first_named_child_for_byte_wasm,Module._ts_node_grammar_symbol_wasm=_ts_node_grammar_symbol_wasm=e.ts_node_grammar_symbol_wasm,Module._ts_node_child_count_wasm=_ts_node_child_count_wasm=e.ts_node_child_count_wasm,Module._ts_node_named_child_count_wasm=_ts_node_named_child_count_wasm=e.ts_node_named_child_count_wasm,Module._ts_node_child_wasm=_ts_node_child_wasm=e.ts_node_child_wasm,Module._ts_node_named_child_wasm=_ts_node_named_child_wasm=e.ts_node_named_child_wasm,Module._ts_node_child_by_field_id_wasm=_ts_node_child_by_field_id_wasm=e.ts_node_child_by_field_id_wasm,Module._ts_node_next_sibling_wasm=_ts_node_next_sibling_wasm=e.ts_node_next_sibling_wasm,Module._ts_node_prev_sibling_wasm=_ts_node_prev_sibling_wasm=e.ts_node_prev_sibling_wasm,Module._ts_node_next_named_sibling_wasm=_ts_node_next_named_sibling_wasm=e.ts_node_next_named_sibling_wasm,Module._ts_node_prev_named_sibling_wasm=_ts_node_prev_named_sibling_wasm=e.ts_node_prev_named_sibling_wasm,Module._ts_node_descendant_count_wasm=_ts_node_descendant_count_wasm=e.ts_node_descendant_count_wasm,Module._ts_node_parent_wasm=_ts_node_parent_wasm=e.ts_node_parent_wasm,Module._ts_node_child_with_descendant_wasm=_ts_node_child_with_descendant_wasm=e.ts_node_child_with_descendant_wasm,Module._ts_node_descendant_for_index_wasm=_ts_node_descendant_for_index_wasm=e.ts_node_descendant_for_index_wasm,Module._ts_node_named_descendant_for_index_wasm=_ts_node_named_descendant_for_index_wasm=e.ts_node_named_descendant_for_index_wasm,Module._ts_node_descendant_for_position_wasm=_ts_node_descendant_for_position_wasm=e.ts_node_descendant_for_position_wasm,Module._ts_node_named_descendant_for_position_wasm=_ts_node_named_descendant_for_position_wasm=e.ts_node_named_descendant_for_position_wasm,Module._ts_node_start_point_wasm=_ts_node_start_point_wasm=e.ts_node_start_point_wasm,Module._ts_node_end_point_wasm=_ts_node_end_point_wasm=e.ts_node_end_point_wasm,Module._ts_node_start_index_wasm=_ts_node_start_index_wasm=e.ts_node_start_index_wasm,Module._ts_node_end_index_wasm=_ts_node_end_index_wasm=e.ts_node_end_index_wasm,Module._ts_node_to_string_wasm=_ts_node_to_string_wasm=e.ts_node_to_string_wasm,Module._ts_node_children_wasm=_ts_node_children_wasm=e.ts_node_children_wasm,Module._ts_node_named_children_wasm=_ts_node_named_children_wasm=e.ts_node_named_children_wasm,Module._ts_node_descendants_of_type_wasm=_ts_node_descendants_of_type_wasm=e.ts_node_descendants_of_type_wasm,Module._ts_node_is_named_wasm=_ts_node_is_named_wasm=e.ts_node_is_named_wasm,Module._ts_node_has_changes_wasm=_ts_node_has_changes_wasm=e.ts_node_has_changes_wasm,Module._ts_node_has_error_wasm=_ts_node_has_error_wasm=e.ts_node_has_error_wasm,Module._ts_node_is_error_wasm=_ts_node_is_error_wasm=e.ts_node_is_error_wasm,Module._ts_node_is_missing_wasm=_ts_node_is_missing_wasm=e.ts_node_is_missing_wasm,Module._ts_node_is_extra_wasm=_ts_node_is_extra_wasm=e.ts_node_is_extra_wasm,Module._ts_node_parse_state_wasm=_ts_node_parse_state_wasm=e.ts_node_parse_state_wasm,Module._ts_node_next_parse_state_wasm=_ts_node_next_parse_state_wasm=e.ts_node_next_parse_state_wasm,Module._ts_query_matches_wasm=_ts_query_matches_wasm=e.ts_query_matches_wasm,Module._ts_query_captures_wasm=_ts_query_captures_wasm=e.ts_query_captures_wasm,Module._memset=_memset=e.memset,Module._memcpy=_memcpy=e.memcpy,Module._memmove=_memmove=e.memmove,Module._iswalpha=_iswalpha=e.iswalpha,Module._iswblank=_iswblank=e.iswblank,Module._iswdigit=_iswdigit=e.iswdigit,Module._iswlower=_iswlower=e.iswlower,Module._iswpunct=_iswpunct=e.iswpunct,Module._iswupper=_iswupper=e.iswupper,Module._iswxdigit=_iswxdigit=e.iswxdigit,Module._memchr=_memchr=e.memchr,Module._strlen=_strlen=e.strlen,Module._strcmp=_strcmp=e.strcmp,Module._strncat=_strncat=e.strncat,Module._strncpy=_strncpy=e.strncpy,Module._towlower=_towlower=e.towlower,Module._towupper=_towupper=e.towupper,_setThrew=e.setThrew,__emscripten_stack_restore=e._emscripten_stack_restore,__emscripten_stack_alloc=e._emscripten_stack_alloc,_emscripten_stack_get_current=e.emscripten_stack_get_current,___wasm_apply_data_relocs=e.__wasm_apply_data_relocs}D(assignWasmExports,"assignWasmExports");var wasmImports={__heap_base:___heap_base,__indirect_function_table:wasmTable,__memory_base:___memory_base,__stack_high:___stack_high,__stack_low:___stack_low,__stack_pointer:___stack_pointer,__table_base:___table_base,_abort_js:__abort_js,emscripten_resize_heap:_emscripten_resize_heap,fd_close:_fd_close,fd_seek:_fd_seek,fd_write:_fd_write,memory:wasmMemory,tree_sitter_log_callback:_tree_sitter_log_callback,tree_sitter_parse_callback:_tree_sitter_parse_callback,tree_sitter_progress_callback:_tree_sitter_progress_callback,tree_sitter_query_progress_callback:_tree_sitter_query_progress_callback};function callMain(e=[]){var t=resolveGlobalSymbol("main").sym;if(t){e.unshift(thisProgram);var n=e.length,r=stackAlloc((n+1)*4),o=r;e.forEach(a=>{LE_HEAP_STORE_U32((o>>2)*4,stringToUTF8OnStack(a)),o+=4}),LE_HEAP_STORE_U32((o>>2)*4,0);try{var s=t(n,r);return exitJS(s,!0),s}catch(a){return handleException(a)}}}D(callMain,"callMain");function run(e=arguments_){if(runDependencies>0){dependenciesFulfilled=run;return}if(preRun(),runDependencies>0){dependenciesFulfilled=run;return}function t(){if(Module.calledRun=!0,!ABORT){initRuntime(),readyPromiseResolve?.(Module),Module.onRuntimeInitialized?.();var n=Module.noInitialRun||!1;n||callMain(e),postRun()}}D(t,"doRun"),Module.setStatus?(Module.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>Module.setStatus(""),1),t()},1)):t()}D(run,"run");var wasmExports;return wasmExports=await createWasm(),run(),runtimeInitialized?moduleRtn=Module:moduleRtn=new Promise((e,t)=>{readyPromiseResolve=e,readyPromiseReject=t}),moduleRtn}async function dg(e){return cg??=await xk(e)}function ug(){return!!cg}function mg(e,t,n,r){if(e.length!==3)throw new Error(`Wrong number of arguments to \`#${n}\` predicate. Expected 2, got ${e.length-1}`);if(!tg(e[1]))throw new Error(`First argument of \`#${n}\` predicate must be a capture. Got "${e[1].value}"`);let o=n==="eq?"||n==="any-eq?",s=!n.startsWith("any-");if(tg(e[2])){let a=e[1].name,l=e[2].name;r[t].push(c=>{let d=[],u=[];for(let m of c)m.name===a&&d.push(m.node),m.name===l&&u.push(m.node);let f=D((m,p,g)=>g?m.text===p.text:m.text!==p.text,"compare");return s?d.every(m=>u.some(p=>f(m,p,o))):d.some(m=>u.some(p=>f(m,p,o)))})}else{let a=e[1].name,l=e[2].value,c=D(u=>u.text===l,"matches"),d=D(u=>u.text!==l,"doesNotMatch");r[t].push(u=>{let f=[];for(let p of u)p.name===a&&f.push(p.node);let m=o?c:d;return s?f.every(m):f.some(m)})}}function pg(e,t,n,r){if(e.length!==3)throw new Error(`Wrong number of arguments to \`#${n}\` predicate. Expected 2, got ${e.length-1}.`);if(e[1].type!=="capture")throw new Error(`First argument of \`#${n}\` predicate must be a capture. Got "${e[1].value}".`);if(e[2].type!=="string")throw new Error(`Second argument of \`#${n}\` predicate must be a string. Got @${e[2].name}.`);let o=n==="match?"||n==="any-match?",s=!n.startsWith("any-"),a=e[1].name,l=new RegExp(e[2].value);r[t].push(c=>{let d=[];for(let f of c)f.name===a&&d.push(f.node.text);let u=D((f,m)=>m?l.test(f):!l.test(f),"test");return d.length===0?!o:s?d.every(f=>u(f,o)):d.some(f=>u(f,o))})}function gg(e,t,n,r){if(e.length<2)throw new Error(`Wrong number of arguments to \`#${n}\` predicate. Expected at least 1. Got ${e.length-1}.`);if(e[1].type!=="capture")throw new Error(`First argument of \`#${n}\` predicate must be a capture. Got "${e[1].value}".`);let o=n==="any-of?",s=e[1].name,a=e.slice(2);if(!a.every(Md))throw new Error(`Arguments to \`#${n}\` predicate must be strings.".`);let l=a.map(c=>c.value);r[t].push(c=>{let d=[];for(let u of c)u.name===s&&d.push(u.node.text);return d.length===0?!o:d.every(u=>l.includes(u))===o})}function hg(e,t,n,r,o){if(e.length<2||e.length>3)throw new Error(`Wrong number of arguments to \`#${n}\` predicate. Expected 1 or 2. Got ${e.length-1}.`);if(!e.every(Md))throw new Error(`Arguments to \`#${n}\` predicate must be strings.".`);let s=n==="is?"?r:o;s[t]||(s[t]={}),s[t][e[1].value]=e[2]?.value??null}function yg(e,t,n){if(e.length<2||e.length>3)throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${e.length-1}.`);if(!e.every(Md))throw new Error('Arguments to `#set!` predicate must be strings.".');n[t]||(n[t]={}),n[t][e[1].value]=e[2]?.value??null}function _g(e,t,n,r,o,s,a,l,c,d,u){if(t===Sk){let f=r[n];s.push({type:"capture",name:f})}else if(t===kk)s.push({type:"string",value:o[n]});else if(s.length>0){if(s[0].type!=="string")throw new Error("Predicates must begin with a literal value");let f=s[0].value;switch(f){case"any-not-eq?":case"not-eq?":case"any-eq?":case"eq?":mg(s,e,f,a);break;case"any-not-match?":case"not-match?":case"any-match?":case"match?":pg(s,e,f,a);break;case"not-any-of?":case"any-of?":gg(s,e,f,a);break;case"is?":case"is-not?":hg(s,e,f,d,u);break;case"set!":yg(s,e,c);break;default:l[e].push({operator:f,operands:s.slice(1)})}s.length=0}}var gk,D,FF,Xp,ee,wd,$t,Sn,Ai,It,rr,A,Zp,hk,Yp,yk,Qp,_k,bk,wk,Rd,xk,cg,Z,xd,Sd,eg,Cd,Sk,kk,Ek,OF,tg,Md,un,Ci,ng,bg,Ad=z(()=>{$();gk=Object.defineProperty,D=(e,t)=>gk(e,"name",{value:t,configurable:!0}),FF=class{static{D(this,"Edit")}startPosition;oldEndPosition;newEndPosition;startIndex;oldEndIndex;newEndIndex;constructor({startIndex:e,oldEndIndex:t,newEndIndex:n,startPosition:r,oldEndPosition:o,newEndPosition:s}){this.startIndex=e>>>0,this.oldEndIndex=t>>>0,this.newEndIndex=n>>>0,this.startPosition=r,this.oldEndPosition=o,this.newEndPosition=s}editPoint(e,t){let n=t,r={...e};if(t>=this.oldEndIndex){n=this.newEndIndex+(t-this.oldEndIndex);let o=e.row;r.row=this.newEndPosition.row+(e.row-this.oldEndPosition.row),r.column=o===this.oldEndPosition.row?this.newEndPosition.column+(e.column-this.oldEndPosition.column):e.column}else t>this.startIndex&&(n=this.newEndIndex,r.row=this.newEndPosition.row,r.column=this.newEndPosition.column);return{point:r,index:n}}editRange(e){let t={startIndex:e.startIndex,startPosition:{...e.startPosition},endIndex:e.endIndex,endPosition:{...e.endPosition}};return e.endIndex>=this.oldEndIndex?e.endIndex!==Number.MAX_SAFE_INTEGER&&(t.endIndex=this.newEndIndex+(e.endIndex-this.oldEndIndex),t.endPosition={row:this.newEndPosition.row+(e.endPosition.row-this.oldEndPosition.row),column:e.endPosition.row===this.oldEndPosition.row?this.newEndPosition.column+(e.endPosition.column-this.oldEndPosition.column):e.endPosition.column},t.endIndexthis.startIndex&&(t.endIndex=this.startIndex,t.endPosition={...this.startPosition}),e.startIndex>=this.oldEndIndex?(t.startIndex=this.newEndIndex+(e.startIndex-this.oldEndIndex),t.startPosition={row:this.newEndPosition.row+(e.startPosition.row-this.oldEndPosition.row),column:e.startPosition.row===this.oldEndPosition.row?this.newEndPosition.column+(e.startPosition.column-this.oldEndPosition.column):e.startPosition.column},t.startIndexthis.startIndex&&(t.startIndex=this.startIndex,t.startPosition={...this.startPosition}),t}},Xp=2,ee=4,wd=4*ee,$t=5*ee,Sn=2*ee,Ai=2*ee+2*Sn,It={row:0,column:0},rr=Symbol("INTERNAL");D(Es,"assertInternal");D(Mi,"isPoint");D(rg,"setModule");D(vs,"newFinalizer");Zp=vs(e=>{A._ts_lookahead_iterator_delete(e)}),hk=class{static{D(this,"LookaheadIterator")}0=0;language;positioned=!1;constructor(e,t,n){Es(e),this[0]=t,this.language=n,Zp?.register(this,t,this)}get currentTypeId(){return this.positioned?A._ts_lookahead_iterator_current_symbol(this[0]):null}get currentType(){let e=this.currentTypeId;return e===null?null:this.language.types[e]??A.UTF8ToString(A._ts_language_symbol_name(this.language[0],e))}delete(){Zp?.unregister(this),A._ts_lookahead_iterator_delete(this[0]),this[0]=0}reset(e,t){return A._ts_lookahead_iterator_reset(this[0],e[0],t)?(this.language=e,this.positioned=!1,!0):!1}resetState(e){return A._ts_lookahead_iterator_reset_state(this[0],e)?(this.positioned=!1,!0):!1}[Symbol.iterator](){return{next:D(()=>{this.positioned=!!A._ts_lookahead_iterator_next(this[0]);let e=this.currentType;return e===null?{done:!0,value:""}:{done:!1,value:e}},"next")}}};D(vd,"getText");Yp=vs(e=>{A._ts_tree_delete(e)}),yk=class kd{static{D(this,"Tree")}0=0;textCallback;language;constructor(t,n,r,o){Es(t),this[0]=n,this.language=r,this.textCallback=o,Yp?.register(this,n,this)}copy(){let t=A._ts_tree_copy(this[0]);return new kd(rr,t,this.language,this.textCallback)}delete(){Yp?.unregister(this),A._ts_tree_delete(this[0]),this[0]=0}get rootNode(){return A._ts_tree_root_node_wasm(this[0]),Ge(this)}rootNodeWithOffset(t,n){let r=Z+$t;return A.setValue(r,t,"i32"),Gt(r+ee,n),A._ts_tree_root_node_with_offset_wasm(this[0]),Ge(this)}edit(t){og(t),A._ts_tree_edit_wasm(this[0])}walk(){return this.rootNode.walk()}getChangedRanges(t){if(!(t instanceof kd))throw new TypeError("Argument must be a Tree");A._ts_tree_get_changed_ranges_wasm(this[0],t[0]);let n=A.getValue(Z,"i32"),r=A.getValue(Z+ee,"i32"),o=new Array(n);if(n>0){let s=r;for(let a=0;a0){let o=n;for(let s=0;s{A._ts_tree_cursor_delete_wasm(e)}),_k=class sg{static{D(this,"TreeCursor")}0=0;1=0;2=0;3=0;tree;constructor(t,n){Es(t),this.tree=n,Dt(this),Qp?.register(this,this.tree[0],this)}copy(){let t=new sg(rr,this.tree);return A._ts_tree_cursor_copy_wasm(this.tree[0]),Dt(t),t}delete(){Qp?.unregister(this),Le(this),A._ts_tree_cursor_delete_wasm(this.tree[0]),this[0]=this[1]=this[2]=0}get currentNode(){return Le(this),A._ts_tree_cursor_current_node_wasm(this.tree[0]),Ge(this.tree)}get currentFieldId(){return Le(this),A._ts_tree_cursor_current_field_id_wasm(this.tree[0])}get currentFieldName(){return this.tree.language.fields[this.currentFieldId]}get currentDepth(){return Le(this),A._ts_tree_cursor_current_depth_wasm(this.tree[0])}get currentDescendantIndex(){return Le(this),A._ts_tree_cursor_current_descendant_index_wasm(this.tree[0])}get nodeType(){return this.tree.language.types[this.nodeTypeId]||"ERROR"}get nodeTypeId(){return Le(this),A._ts_tree_cursor_current_node_type_id_wasm(this.tree[0])}get nodeStateId(){return Le(this),A._ts_tree_cursor_current_node_state_id_wasm(this.tree[0])}get nodeId(){return Le(this),A._ts_tree_cursor_current_node_id_wasm(this.tree[0])}get nodeIsNamed(){return Le(this),A._ts_tree_cursor_current_node_is_named_wasm(this.tree[0])===1}get nodeIsMissing(){return Le(this),A._ts_tree_cursor_current_node_is_missing_wasm(this.tree[0])===1}get nodeText(){Le(this);let t=A._ts_tree_cursor_start_index_wasm(this.tree[0]),n=A._ts_tree_cursor_end_index_wasm(this.tree[0]);A._ts_tree_cursor_start_position_wasm(this.tree[0]);let r=Or(Z);return vd(this.tree,t,n,r)}get startPosition(){return Le(this),A._ts_tree_cursor_start_position_wasm(this.tree[0]),Or(Z)}get endPosition(){return Le(this),A._ts_tree_cursor_end_position_wasm(this.tree[0]),Or(Z)}get startIndex(){return Le(this),A._ts_tree_cursor_start_index_wasm(this.tree[0])}get endIndex(){return Le(this),A._ts_tree_cursor_end_index_wasm(this.tree[0])}gotoFirstChild(){Le(this);let t=A._ts_tree_cursor_goto_first_child_wasm(this.tree[0]);return Dt(this),t===1}gotoLastChild(){Le(this);let t=A._ts_tree_cursor_goto_last_child_wasm(this.tree[0]);return Dt(this),t===1}gotoParent(){Le(this);let t=A._ts_tree_cursor_goto_parent_wasm(this.tree[0]);return Dt(this),t===1}gotoNextSibling(){Le(this);let t=A._ts_tree_cursor_goto_next_sibling_wasm(this.tree[0]);return Dt(this),t===1}gotoPreviousSibling(){Le(this);let t=A._ts_tree_cursor_goto_previous_sibling_wasm(this.tree[0]);return Dt(this),t===1}gotoDescendant(t){Le(this),A._ts_tree_cursor_goto_descendant_wasm(this.tree[0],t),Dt(this)}gotoFirstChildForIndex(t){Le(this),A.setValue(Z+wd,t,"i32");let n=A._ts_tree_cursor_goto_first_child_for_index_wasm(this.tree[0]);return Dt(this),n===1}gotoFirstChildForPosition(t){Le(this),Gt(Z+wd,t);let n=A._ts_tree_cursor_goto_first_child_for_position_wasm(this.tree[0]);return Dt(this),n===1}reset(t){fe(t),Le(this,Z+$t),A._ts_tree_cursor_reset_wasm(this.tree[0]),Dt(this)}resetTo(t){Le(this,Z),Le(t,Z+wd),A._ts_tree_cursor_reset_to_wasm(this.tree[0],t.tree[0]),Dt(this)}},bk=class{static{D(this,"Node")}0=0;_children;_namedChildren;constructor(e,{id:t,tree:n,startIndex:r,startPosition:o,other:s}){Es(e),this[0]=s,this.id=t,this.tree=n,this.startIndex=r,this.startPosition=o}id;startIndex;startPosition;tree;get typeId(){return fe(this),A._ts_node_symbol_wasm(this.tree[0])}get grammarId(){return fe(this),A._ts_node_grammar_symbol_wasm(this.tree[0])}get type(){return this.tree.language.types[this.typeId]||"ERROR"}get grammarType(){return this.tree.language.types[this.grammarId]||"ERROR"}get isNamed(){return fe(this),A._ts_node_is_named_wasm(this.tree[0])===1}get isExtra(){return fe(this),A._ts_node_is_extra_wasm(this.tree[0])===1}get isError(){return fe(this),A._ts_node_is_error_wasm(this.tree[0])===1}get isMissing(){return fe(this),A._ts_node_is_missing_wasm(this.tree[0])===1}get hasChanges(){return fe(this),A._ts_node_has_changes_wasm(this.tree[0])===1}get hasError(){return fe(this),A._ts_node_has_error_wasm(this.tree[0])===1}get endIndex(){return fe(this),A._ts_node_end_index_wasm(this.tree[0])}get endPosition(){return fe(this),A._ts_node_end_point_wasm(this.tree[0]),Or(Z)}get text(){return vd(this.tree,this.startIndex,this.endIndex,this.startPosition)}get parseState(){return fe(this),A._ts_node_parse_state_wasm(this.tree[0])}get nextParseState(){return fe(this),A._ts_node_next_parse_state_wasm(this.tree[0])}equals(e){return this.tree===e.tree&&this.id===e.id}child(e){return fe(this),A._ts_node_child_wasm(this.tree[0],e),Ge(this.tree)}namedChild(e){return fe(this),A._ts_node_named_child_wasm(this.tree[0],e),Ge(this.tree)}childForFieldId(e){return fe(this),A._ts_node_child_by_field_id_wasm(this.tree[0],e),Ge(this.tree)}childForFieldName(e){let t=this.tree.language.fields.indexOf(e);return t!==-1?this.childForFieldId(t):null}fieldNameForChild(e){fe(this);let t=A._ts_node_field_name_for_child_wasm(this.tree[0],e);return t?A.AsciiToString(t):null}fieldNameForNamedChild(e){fe(this);let t=A._ts_node_field_name_for_named_child_wasm(this.tree[0],e);return t?A.AsciiToString(t):null}childrenForFieldName(e){let t=this.tree.language.fields.indexOf(e);return t!==-1&&t!==0?this.childrenForFieldId(t):[]}childrenForFieldId(e){fe(this),A._ts_node_children_by_field_id_wasm(this.tree[0],e);let t=A.getValue(Z,"i32"),n=A.getValue(Z+ee,"i32"),r=new Array(t);if(t>0){let o=n;for(let s=0;s0){let n=t;for(let r=0;r0){let n=t;for(let r=0;r0){let d=l;for(let u=0;u=e.oldEndIndex){this.startIndex=e.newEndIndex+(this.startIndex-e.oldEndIndex);let t,n;this.startPosition.row>e.oldEndPosition.row?(t=this.startPosition.row-e.oldEndPosition.row,n=this.startPosition.column):(t=0,n=this.startPosition.column,this.startPosition.column>=e.oldEndPosition.column&&(n=this.startPosition.column-e.oldEndPosition.column)),t>0?(this.startPosition.row+=t,this.startPosition.column=n):this.startPosition.column+=n}else this.startIndex>e.startIndex&&(this.startIndex=e.newEndIndex,this.startPosition.row=e.newEndPosition.row,this.startPosition.column=e.newEndPosition.column)}toString(){fe(this);let e=A._ts_node_to_string_wasm(this.tree[0]),t=A.AsciiToString(e);return A._free(e),t}};D(Ed,"unmarshalCaptures");D(fe,"marshalNode");D(Ge,"unmarshalNode");D(Le,"marshalTreeCursor");D(Dt,"unmarshalTreeCursor");D(Gt,"marshalPoint");D(Or,"unmarshalPoint");D(ig,"marshalRange");D(Ia,"unmarshalRange");D(og,"marshalEdit");D(ag,"unmarshalLanguageMetadata");wk=/^tree_sitter_\w+$/,Rd=class Aa{static{D(this,"Language")}0=0;types;fields;constructor(t,n){Es(t),this[0]=n,this.types=new Array(A._ts_language_symbol_count(this[0]));for(let r=0,o=this.types.length;r0){let o=n;for(let s=0;s0){let s=r;for(let a=0;a(bd(),_d))).readFile(t);else{let o=await fetch(t);if(!o.ok){let a=await o.text();throw new Error(`Language.load failed with status ${o.status}. -${a}`)}let s=o.clone();try{n=await WebAssembly.compileStreaming(o)}catch(a){console.error("wasm streaming compile failed:",a),console.error("falling back to ArrayBuffer instantiation"),n=new Uint8Array(await s.arrayBuffer())}}let r=await A.loadWebAssemblyModule(n,{loadAsync:!0});return Sa.loadFromWasmExports(r,{sync:!1})}static loadFromWasmExports(t,{sync:n}){let r=Object.keys(t),o=r.find(a=>dk.test(a)&&!a.includes("external_scanner_"));if(!o)throw console.log(`Couldn't find language function in Wasm file. Symbols: -${JSON.stringify(r,null,2)}`),new Error(`Language.${n?"loadSync":"load"} failed: no language function found in Wasm file`);let s=t[o]();return new Sa(Yn,s)}static loadSync(t){let n=A.loadWebAssemblyModule(t,{loadAsync:!1});return Sa.loadFromWasmExports(n,{sync:!0})}};D(Yp,"Module");uk=Yp,Qp=null;D(eg,"initializeBinding");D(tg,"checkModule");Hp=bs(e=>{A._ts_parser_delete(e[0]),A._free(e[1])}),wd=class{static{D(this,"Parser")}0=0;1=0;logCallback=null;language=null;static async init(e){Vp(await eg(e)),Y=A._ts_init(),pd=A.getValue(Y,"i32"),gd=A.getValue(Y+ee,"i32")}constructor(){this.initialize(),Hp?.register(this,[this[0],this[1]],this)}initialize(){if(!tg())throw new Error("cannot construct a Parser before calling `init()`");A._ts_parser_new_wasm(),this[0]=A.getValue(Y,"i32"),this[1]=A.getValue(Y+ee,"i32")}delete(){Hp?.unregister(this),A._ts_parser_delete(this[0]),A._free(this[1]),this[0]=0,this[1]=0}setLanguage(e){let t;if(!e)t=0,this.language=null;else if(e.constructor===bd){t=e[0];let n=A._ts_language_abi_version(t);if(ne.slice(l);else if(typeof e=="function")A.currentParseCallback=e;else throw new Error("Argument must be a string or a function");n?.progressCallback?A.currentProgressCallback=n.progressCallback:A.currentProgressCallback=null,this.logCallback?(A.currentLogCallback=this.logCallback,A._ts_parser_enable_logger_wasm(this[0],1)):(A.currentLogCallback=null,A._ts_parser_enable_logger_wasm(this[0],0));let r=0,o=0;if(n?.includedRanges){r=n.includedRanges.length,o=A._calloc(r,ki);let l=o;for(let c=0;c0){let r=t;for(let o=0;oe.type==="capture","isCaptureStep"),xd=D(e=>e.type==="string","isStringStep"),on={Syntax:1,NodeName:2,FieldName:3,CaptureName:4,PatternStructure:5},xi=class ng extends Error{constructor(t,n,r,o){super(ng.formatMessage(t,n)),this.kind=t,this.info=n,this.index=r,this.length=o,this.name="QueryError"}kind;info;index;length;static{D(this,"QueryError")}static formatMessage(t,n){switch(t){case on.NodeName:return`Bad node name '${n.word}'`;case on.FieldName:return`Bad field name '${n.word}'`;case on.CaptureName:return`Bad capture name @${n.word}`;case on.PatternStructure:return`Bad pattern structure at offset ${n.suffix}`;case on.Syntax:return`Bad syntax at offset ${n.suffix}`}}};D(rg,"parseAnyPredicate");D(sg,"parseMatchPredicate");D(ig,"parseAnyOfPredicate");D(og,"parseIsPredicate");D(ag,"parseSetDirective");D(lg,"parsePattern");qp=bs(e=>{A._ts_query_delete(e)}),cg=class{static{D(this,"Query")}0=0;exceededMatchLimit;textPredicates;captureNames;captureQuantifiers;predicates;setProperties;assertedProperties;refutedProperties;matchLimit;constructor(e,t){let n=A.lengthBytesUTF8(t),r=A._malloc(n+1);A.stringToUTF8(t,r,n+1);let o=A._ts_query_new(e[0],r,n,Y,Y+ee);if(!o){let _=A.getValue(Y+ee,"i32"),y=A.getValue(Y,"i32"),b=A.UTF8ToString(r,y).length,S=t.slice(b,b+100).split(` -`)[0],k=S.match(pk)?.[0]??"";switch(A._free(r),_){case on.Syntax:throw new xi(on.Syntax,{suffix:`${b}: '${S}'...`},b,0);case on.NodeName:throw new xi(_,{word:k},b,k.length);case on.FieldName:throw new xi(_,{word:k},b,k.length);case on.CaptureName:throw new xi(_,{word:k},b,k.length);case on.PatternStructure:throw new xi(_,{suffix:`${b}: '${S}'...`},b,0)}}let s=A._ts_query_string_count(o),a=A._ts_query_capture_count(o),l=A._ts_query_pattern_count(o),c=new Array(a),d=new Array(l),u=new Array(s);for(let _=0;_s)throw new Error("`startIndex` cannot be greater than `endIndex`");if(r!==kt&&(n.row>r.row||n.row===r.row&&n.column>r.column))throw new Error("`startPosition` cannot be greater than `endPosition`");if(d!==0&&c>d)throw new Error("`startContainingIndex` cannot be greater than `endContainingIndex`");if(l!==kt&&(a.row>l.row||a.row===l.row&&a.column>l.column))throw new Error("`startContainingPosition` cannot be greater than `endContainingPosition`");m&&(A.currentQueryProgressCallback=m),de(e),A._ts_query_matches_wasm(this[0],e.tree[0],n.row,n.column,r.row,r.column,o,s,a.row,a.column,l.row,l.column,c,d,u,f);let p=A.getValue(Y,"i32"),g=A.getValue(Y+ee,"i32"),h=A.getValue(Y+2*ee,"i32"),_=new Array(p);this.exceededMatchLimit=!!h;let y=0,b=g;for(let S=0;SP(I))){_[y]={patternIndex:k,captures:I};let P=this.setProperties[k];_[y].setProperties=P;let v=this.assertedProperties[k];_[y].assertedProperties=v;let C=this.refutedProperties[k];_[y].refutedProperties=C,y++}}return _.length=y,A._free(g),A.currentQueryProgressCallback=null,_}captures(e,t={}){let n=t.startPosition??kt,r=t.endPosition??kt,o=t.startIndex??0,s=t.endIndex??0,a=t.startContainingPosition??kt,l=t.endContainingPosition??kt,c=t.startContainingIndex??0,d=t.endContainingIndex??0,u=t.matchLimit??4294967295,f=t.maxStartDepth??4294967295,m=t.progressCallback;if(typeof u!="number")throw new Error("Arguments must be numbers");if(this.matchLimit=u,s!==0&&o>s)throw new Error("`startIndex` cannot be greater than `endIndex`");if(r!==kt&&(n.row>r.row||n.row===r.row&&n.column>r.column))throw new Error("`startPosition` cannot be greater than `endPosition`");if(d!==0&&c>d)throw new Error("`startContainingIndex` cannot be greater than `endContainingIndex`");if(l!==kt&&(a.row>l.row||a.row===l.row&&a.column>l.column))throw new Error("`startContainingPosition` cannot be greater than `endContainingPosition`");m&&(A.currentQueryProgressCallback=m),de(e),A._ts_query_captures_wasm(this[0],e.tree[0],n.row,n.column,r.row,r.column,o,s,a.row,a.column,l.row,l.column,c,d,u,f);let p=A.getValue(Y,"i32"),g=A.getValue(Y+ee,"i32"),h=A.getValue(Y+2*ee,"i32"),_=new Array;this.exceededMatchLimit=!!h;let y=new Array,b=g;for(let S=0;SP(y))){let P=y[I],v=this.setProperties[k];P.setProperties=v;let C=this.assertedProperties[k];P.assertedProperties=C;let M=this.refutedProperties[k];P.refutedProperties=M,_.push(P)}}return A._free(g),A.currentQueryProgressCallback=null,_}predicatesForPattern(e){return this.predicates[e]}disableCapture(e){let t=A.lengthBytesUTF8(e),n=A._malloc(t+1);A.stringToUTF8(e,n,t+1),A._ts_query_disable_capture(this[0],n,t),A._free(n)}disablePattern(e){if(e>=this.predicates.length)throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`);A._ts_query_disable_pattern(this[0],e)}didExceedMatchLimit(){return this.exceededMatchLimit}startIndexForPattern(e){if(e>=this.predicates.length)throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`);return A._ts_query_start_byte_for_pattern(this[0],e)}endIndexForPattern(e){if(e>=this.predicates.length)throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`);return A._ts_query_end_byte_for_pattern(this[0],e)}patternCount(){return A._ts_query_pattern_count(this[0])}captureIndexForName(e){return this.captureNames.indexOf(e)}isPatternRooted(e){return A._ts_query_is_pattern_rooted(this[0],e)===1}isPatternNonLocal(e){return A._ts_query_is_pattern_non_local(this[0],e)===1}isPatternGuaranteedAtStep(e){return A._ts_query_is_pattern_guaranteed_at_step(this[0],e)===1}}});function Ir(e){return Ri[e]}function Ra(e,t){let n=Ri[e];return e===".h"&&hk.test(t)?"cpp":n}function xs(){let e=F.env.XDG_CACHE_HOME,t=e&&e.trim()?e.trim():j(ba(),".cache");return j(t,"codeindex","grammars",Ie)}function Wt(e={}){let t=xs(),n=F.env.CODEINDEX_GRAMMARS_DIR,r=n&&n.trim()&&Q(n)?n:void 0,o=Q(t)?t:void 0,s=(d,u,f)=>{let m=j(u,"..",yk),p=[];for(let g of[u,Q(m)?m:void 0,...f])g!==void 0&&!p.includes(g)&&p.push(g);return{tier:d,dir:u,cacheDir:t,dirs:p}},a=F.env.CODEINDEX_GRAMMAR_DIR??F.env.ULTRAINDEX_GRAMMAR_DIR;if(a&&a.trim()&&Q(a))return s("env",a,[]);let l=e.moduleDir??Ce(xa(import.meta.url)),c=[j(l,"grammars"),j(l,"..","..","scripts","grammars"),j(l,"..","scripts","grammars")];for(let d of c)if(Q(d))return s("adjacent",d,[r,o]);return r?s("env",r,[o]):o?s("cache",o,[]):{tier:"none",cacheDir:t,dirs:[]}}function Ca(){let{dirs:e}=Wt(),t=n=>e.some(r=>Q(j(r,n)));return t("web-tree-sitter.wasm")?new Set(Ma().filter(n=>t(`${n}.wasm`))):new Set}function _k(e){return Wt(e).dir}async function an(e){let{dirs:t}=Wt();if(!t.length)return;let n=r=>{for(let o of t){let s=j(o,r);if(Q(s))return s}};if(!dg){let r=n("web-tree-sitter.wasm");if(!r)return;await wd.init({wasmBinary:ie(r)}),dg=!0,va=new wd}for(let r of new Set(e)){if(Ei.has(r))continue;let o=n(`${r}.wasm`),s=o?(()=>{try{let a=Me(o);return`${o}:${a.size}:${a.mtimeMs}`}catch{return`${o}:unreadable`}})():`missing:${t.join("|")}`;if(Ea.get(r)!==s){if(!o){Ea.set(r,s);continue}try{Ei.set(r,await bd.load(new Uint8Array(ie(o)))),Ea.delete(r)}catch{Ea.set(r,s)}}}}function Ma(){return[...new Set(Object.values(Ri))]}function Bt(e){let t=new Set;for(let n of e){for(let o of gk[n]??[])t.add(o);let r=Ri[n];r!==void 0&&t.add(r),n===".h"&&t.add("cpp")}return[...t].sort()}function De(e){return Ei.has(e)}function kd(e){return Ei.get(e)}function Ss(e){let t=Ei.get(e);return!va||!t?null:(va.setLanguage(t),va)}var vi,ws,Ri,gk,hk,yk,dg,va,Ei,Ea,pt=H(()=>{"use strict";$();ke();bi();me();wi();Sd();bt();vi=new Set(["typescript","tsx","javascript","python","go","rust","java","ruby","c","cpp","c_sharp","php","scala","bash","lua"]),ws=new Set(["kotlin","elixir","zig","hcl","terraform","solidity"]),Ri={".ts":"typescript",".mts":"typescript",".cts":"typescript",".tsx":"tsx",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".go":"go",".rs":"rust",".java":"java",".rb":"ruby",".rake":"ruby",".c":"c",".h":"c",".cc":"cpp",".cpp":"cpp",".cxx":"cpp",".hpp":"cpp",".hh":"cpp",".cs":"c_sharp",".php":"php",".scala":"scala",".sc":"scala",".sh":"bash",".bash":"bash",".lua":"lua",".kt":"kotlin",".kts":"kotlin",".ex":"elixir",".exs":"elixir",".zig":"zig",".hcl":"hcl",".tf":"terraform",".tfvars":"terraform",".sol":"solidity"},gk={".vue":["javascript","tsx","typescript"],".svelte":["javascript","tsx","typescript"],".astro":["typescript"]};hk=/^[ \t]*(?:namespace(?:[ \t]+[A-Za-z_][\w:]*)?\s*\{|using[ \t]+namespace[ \t]|template[ \t]*<|class[ \t]+(?:[A-Z_][A-Z0-9_]*[ \t]+)?[A-Za-z_]\w*(?:[ \t]+final)?[ \t]*(?:[:;{]|$)|(?:public|private|protected)[ \t]*:(?!:)|#[ \t]*include[ \t]*<[a-z_]+>|extern[ \t]+"C\+\+")/m;yk="grammars-extended";dg=!1,va=null,Ei=new Map,Ea=new Map});function Tt(e,t){let n=[...e.namedChildren].reverse();for(;n.length;){let r=n.pop();if(t(r))return r;let o=r.namedChildren;for(let s=o.length-1;s>=0;s--)n.push(o[s])}}function ug(e){switch(e.type){case"operator_name":return e.text.replace(/\s+/g,"").replace(/^operator(?=\w)/,"operator ");case"operator_cast":{let t=e.text.split("(")[0].replace(/\s+/g," ").replace(/\s*([*&])\s*/g,"$1").trim();return t.length>8?t:void 0}case"destructor_name":return e.text.replace(/\s+/g,"")}}function Ed(e){return e.childForFieldName("declarator")??(bk.has(e.type)?e.namedChildren[0]??null:null)}function Tr(e){let t=e.childForFieldName("name");if(t?.text)return t.text;let n=e.childForFieldName("declarator");for(;n;){let s=n.childForFieldName("name");if(s?.text){if(s.type==="qualified_identifier"){n=s;continue}return ug(s)??s.text}if(n.namedChildren.length===0&&/(^|_)identifier$/.test(n.type))return n.text;let a=ug(n);if(a)return a;let l=Ed(n);if(!l||l===n)break;n=l}let o=Tt(e,s=>s.type==="variable_declarator")?.childForFieldName("name");if(o?.text)return o.text;for(let s of e.namedChildren)if(/(^|_)(identifier|name|constant)$/.test(s.type))return s.text}function $r(e){if(!e)return;let t=e.namedChildren;if(t.length===0)return ks.test(e.type)?e.text:void 0;let n=e.childForFieldName("name")??e.childForFieldName("property")??e.childForFieldName("attribute")??e.childForFieldName("field")??e.childForFieldName("function");if(n)return $r(n);let r=t[t.length-1];return r&&r!==e?$r(r):void 0}function Ci(e){if(!e||e.namedChildren.length===0)return;let t=e.childForFieldName("object")??e.childForFieldName("operand")??e.childForFieldName("value")??e.childForFieldName("path")??e.childForFieldName("expression")??e.childForFieldName("argument")??e.childForFieldName("receiver")??e.childForFieldName("table");if(t&&(t.type==="crate"||t.type==="super"))return t.type;let n=t?$r(t):void 0;return n&&/^[A-Za-z_]\w*$/.test(n)?n:void 0}function vt(e){if(!e)return;let t=e.childForFieldName("type")??e.childForFieldName("name");if(t&&/generic|qualified|scoped|nested/.test(e.type))return vt(t);if(e.namedChildren.length===0)return fg.test(e.type)?e.text:void 0;let n,r=o=>{if(o.namedChildren.length===0){fg.test(o.type)&&(n=o.text);return}if(!/arguments|parameters|argument_list/.test(o.type))for(let s of o.namedChildren)r(s)};return r(e),n}var ks,Aa,bk,fg,Ia=H(()=>{"use strict";$();ks=/(^|_)(identifier|name|constant|word)$/,Aa=/(^|_)comment$/;bk=new Set(["reference_declarator","parenthesized_declarator"]);fg=/identifier|constant|(^|_)name$/});function kk(e){let t=[],n=e.previousNamedSibling,r=e.startPosition.row;for(;n;){let s=wk.test(n.type);if(!s&&!Sk.test(n.type)||r-n.endPosition.row>1)break;s&&t.push(n),r=n.startPosition.row,n=n.previousNamedSibling}if(!t.length)return[];t.reverse();let o=[];for(let s of t)for(let a of s.text.split(/\r?\n/))o.push(Dt(a));return o}function Qn(e){let t=e;for(;t;){let n=kk(t);if(n.length){let s=Er(n);if(s)return s}let r=t.parent;if(!r||!xk.has(r.type))return;let o=t.previousNamedSibling;if(o&&!Ek.test(o.type))return;t=r}}function mg(e){let n=e.childForFieldName("body")?.namedChildren[0];if(!n)return;let r=n.type==="string"?n:n.type==="expression_statement"?n.namedChildren[0]:void 0;if(!(!r||r.type!=="string"))return Er(r.text.split(/\r?\n/).map(Dt))}var wk,xk,Sk,Ek,vd=H(()=>{"use strict";$();li();wk=/(^|_)comment$/,xk=new Set(["export_statement","ambient_declaration","decorated_definition","template_declaration","labeled_statement","lexical_declaration","variable_declaration","type_declaration","const_declaration","var_declaration","body_statement","body"]),Sk=/^(attribute_item|decorator)$/;Ek=/decorator|annotation|modifiers/});function lt(e){if(!e)return[];let t=[];for(let n of e.namedChildren){if(/arguments|parameters/.test(n.type))continue;let r=vt(n);r&&t.push(r)}return t}function pg(e,t){if(!t.self)return[];let n=qe(e,"class_heritage");if(!n)return[];let r=n.namedChildren.some(s=>s.type.endsWith("_clause")),o=[];for(let s of lt(r?qe(n,"extends_clause"):n))o.push(Ge("extends",t.self,s,e));for(let s of lt(qe(n,"implements_clause")))o.push(Ge("implements",t.self,s,e));return o}function Mi(e,t,n){return lt(e).map((o,s)=>Ge(s===0?"extends":"implements",t,o,n))}function Ak(e){for(let t=e.parent;t&&t.type!=="module";t=t.parent)if(t.type==="if_statement"&&Mk.test(t.childForFieldName("condition")?.text??""))return!0;return!1}function $k(e){let t=new Set,n=!1,r=c=>{if(c?.type!=="string"||c.namedChildren.some(u=>u.type==="interpolation"))return;let d=c.namedChildren.filter(u=>u.type==="string_content");return d.length<=1?d[0]?.text??"":void 0},o=c=>{if(c?.type!=="list"&&c?.type!=="tuple")return;let d=[];for(let u of c.namedChildren){let f=r(u);if(f===void 0)return;d.push(f)}return d},s=c=>c?.type==="identifier"&&c.text==="__all__",a=c=>{let d=c.namedChildren[0];if(!d)return[];if((d.type==="assignment"||d.type==="augmented_assignment")&&s(d.childForFieldName("left"))){if(d.type==="assignment")n=!0;else if(d.childForFieldName("operator")?.text!=="+=")return;return o(d.childForFieldName("right"))}let u=d.type==="call"?d.childForFieldName("function"):null;if(u?.type!=="attribute"||!s(u.childForFieldName("object")))return[];let f=d.childForFieldName("arguments")?.namedChildren,m=u.childForFieldName("attribute")?.text;if(m==="extend"&&f?.length===1)return o(f[0]);let p=m==="append"&&f?.length===1?r(f[0]):void 0;return p===void 0?void 0:[p]},l=c=>{for(let d of c.namedChildren){if(Ik.has(d.type)){if(!l(d))return!1;continue}if(d.type!=="expression_statement")continue;let u=a(d);if(u===void 0)return!1;for(let f of u)t.add(f)}return!0};return l(e)&&n?t:void 0}function wg(e){if(e.type!=="type_definition")return[];let t=Ad(e),n=t?.childForFieldName("name")?.text;return t&&n&&n!==Tr(e)?[{name:n,kind:Ag[t.type]}]:[]}function xg(e){if(e.childForFieldName("value"))return!1;let t=e.parent;return t?.type!=="preproc_ifdef"||t.namedChildCount<=2||t.childForFieldName("name")?.text!==e.childForFieldName("name")?.text?!1:t.firstChild?.type==="#ifndef"}function Sg(e){let t=e.childForFieldName("declarator");for(;t&&t.type!=="qualified_identifier";)t=Ed(t);let n=null;for(;t?.type==="qualified_identifier";)n=t.childForFieldName("scope"),t=t.childForFieldName("name");return n?vt(n):void 0}function kg(e,t){if(t)return/\b(val|var)\s*$/.exec(e.text.slice(0,t.startIndex-e.startIndex))?.[1]}function Fa(e){if(!e)return;if(e.type==="identifier")return{name:e.text};if(e.type!=="dot_index_expression"&&e.type!=="method_index_expression")return;let t=e.childForFieldName("table"),n=e.childForFieldName("field")??e.childForFieldName("method");return t&&n&&/^[\w.]+$/.test(t.text)?{name:n.text,table:t.text}:void 0}function Rg(e){if(e.childForFieldName("left")?.type!=="constant")return;let t=e.childForFieldName("right");if(t?.type==="call")return Fk[`${t.childForFieldName("receiver")?.text}.${t.childForFieldName("method")?.text}`]}function Nk(e,t){if(t.inFunctionBody||e.type!=="method_definition"||e.childForFieldName("name")?.text!=="constructor")return[];let n=[];for(let r of e.childForFieldName("parameters")?.namedChildren??[]){if(r.type!=="required_parameter"&&r.type!=="optional_parameter"||!r.children.some(s=>s.type==="accessibility_modifier"||s.type==="override_modifier"||s.type==="readonly"))continue;let o=r.childForFieldName("pattern");o?.type==="identifier"&&n.push({name:o.text,kind:"property",node:r})}return n}function Pk(e,t){if(t.inFunctionBody||e.type!=="method_declaration")return[];if(!/^__construct$/i.test(e.childForFieldName("name")?.text??""))return[];let n=[];for(let r of e.childForFieldName("parameters")?.namedChildren??[]){if(r.type!=="property_promotion_parameter")continue;let o=r.childForFieldName("name")?.text.replace(/^\$/,"");o&&n.push({name:o,kind:"property",node:r})}return n}var qe,Ge,Mg,Id,Oa,gg,Rd,vk,hg,yg,Rk,Ai,Ck,Mk,Ik,$a,Cd,_g,bg,Ta,Ag,Ad,Eg,Ig,Tk,vg,Fk,Ok,Cg,Md,$d,$g=H(()=>{"use strict";$();Ia();vd();qe=(e,t)=>e.namedChildren.find(n=>n.type===t),Ge=(e,t,n,r)=>({kind:e,from:t,to:n,line:r.startPosition.row+1});Mg=new Set(["interface","trait","enum","protocol","annotation"]),Id=new Set(["function","method","def","constructor","operator"]),Oa=new Set(["function","function_expression","arrow_function","generator_function","class","function_definition","lambda"]),gg=(e,t,n)=>/\b(public|internal)\b/.test(n),Rd=(e,t,n)=>!/\b(private|protected)\b/.test(n),vk=e=>!/^local\b/.test(e),hg=(e,t,n)=>/\bpub\b/.test(n),yg=(e,t)=>/^[A-Z]/.test(t),Rk=(e,t)=>!t.startsWith("_")||/^__\w+__$/.test(t),Ai=()=>!0,Ck=()=>!1,Mk=/^(__name__\s*==\s*(["'])__main__\2|(["'])__main__\3\s*==\s*__name__)$/;Ik=new Set(["block","if_statement","elif_clause","else_clause","try_statement","except_clause","finally_clause","with_statement"]);$a=e=>Tt(e,t=>t.type==="function_declarator"||t.type==="operator_cast")!==void 0,Cd=e=>t=>t.childrenForFieldName(e).flatMap(n=>/identifier$/.test(n.type)?n.text:[]),_g=e=>(qe(e,"variable_declaration")?.namedChildren??[]).flatMap(t=>t.type==="variable_declarator"?t.childForFieldName("name")?.text??[]:[]),bg=e=>e.childrenForFieldName("declarator").flatMap(t=>t.childForFieldName("name")?.text??[]),Ta=e=>e.childrenForFieldName("declarator").flatMap(t=>t.namedChildren.length>0?Tr(t)??[]:/identifier$/.test(t.type)?t.text:[]),Ag={struct_specifier:"struct",union_specifier:"union",enum_specifier:"enum",class_specifier:"class"},Ad=e=>{let t=e.childForFieldName("type");return t&&Ag[t.type]&&t.childForFieldName("body")?t:void 0};Eg={defmodule:"module",defprotocol:"protocol",defimpl:"impl",defstruct:"struct",defexception:"exception",def:"function",defp:"function",defmacro:"macro",defmacrop:"macro",defguard:"guard",defguardp:"guard",defdelegate:"function"},Ig=e=>e.type==="binary_operator"&&e.childForFieldName("operator")?.text==="when",Tk=e=>Ig(e)?e.childForFieldName("left")??e:e;vg={public:!0,private:!1,protected:!1,module_function:!0,public_class_method:!0,private_class_method:!1},Fk={"Struct.new":"class","Class.new":"class","Data.define":"class","Module.new":"module"};Ok=new Set(["resource","data","variable","output","module","provider","locals","terraform"]),Cg={lang:"terraform",defs:{block:"block"},containers:new Set(["config_file","body"]),exported:Ai,kindFrom:{block:e=>{let t=e.namedChildren.find(n=>n.type==="identifier")?.text;return t&&Ok.has(t)?t:void 0}},nameFrom:{block:e=>{let t=e.namedChildren.filter(n=>n.type==="string_lit").map(n=>n.text.replace(/^"|"$/g,""));return t.length?t.join("."):e.namedChildren.find(n=>n.type==="identifier")?.text}}};Md={lang:"typescript",defs:{function_declaration:"function",generator_function_declaration:"function",function_signature:"function",class_declaration:"class",abstract_class_declaration:"class",interface_declaration:"interface",type_alias_declaration:"type",enum_declaration:"enum",enum_assignment:"enum-member",method_definition:"method",method_signature:"method",abstract_method_signature:"method",property_signature:"property",public_field_definition:"property",call_signature:"call-signature",construct_signature:"construct-signature",index_signature:"index-signature",internal_module:"namespace",module:"namespace",variable_declarator:"const"},containers:new Set(["class_body","export_statement","ambient_declaration","program","lexical_declaration","variable_declaration","interface_body","object_type","enum_body","statement_block","try_statement","catch_clause","finally_clause","if_statement","else_clause","for_statement","for_in_statement","while_statement","do_statement","switch_statement","switch_body","switch_case","switch_default","labeled_statement","return_statement","expression_statement","call_expression","arguments","arrow_function","function_expression","function","parenthesized_expression"]),exported:Ck,exportMarkers:new Set(["export_statement","ambient_declaration"]),bareMembers:{enum_body:"enum-member"},nameFrom:{call_signature:()=>"(call)",construct_signature:()=>"(construct)",index_signature:e=>`[${e.namedChildren.find(t=>t.type==="identifier")?.text??"key"}]`},privateMember:e=>{for(let t of e.namedChildren)if(t.type==="accessibility_modifier"&&/^(private|protected)/.test(t.text)||t.type==="private_property_identifier")return!0;return!1},imports:{import_statement:"string"},calls:{call_expression:"function",new_expression:"constructor"},assignments:!0,extraMembers:Nk,relationsFrom:{class_declaration:pg,abstract_class_declaration:pg,interface_declaration:(e,t)=>t.self?lt(qe(e,"extends_type_clause")).map(n=>Ge("extends",t.self,n,e)):[]}},$d={typescript:Md,tsx:{...Md,lang:"typescript"},javascript:{...Md,lang:"javascript",defs:{function_declaration:"function",generator_function_declaration:"function",class_declaration:"class",method_definition:"method",field_definition:"property",variable_declarator:"const"}},python:{lang:"python",defs:{function_definition:"function",class_definition:"class"},containers:new Set(["block","decorated_definition","module","if_statement","elif_clause","else_clause","try_statement","except_clause","finally_clause","with_statement","match_statement","case_clause"]),exported:Rk,publicNames:$k,imports:{import_statement:"path",import_from_statement:"path"},calls:{call:"function"},docstring:!0,relationsFrom:{class_definition:(e,t)=>t.self?lt(e.childForFieldName("superclasses")).map(n=>Ge("extends",t.self,n,e)):[]},extraMembers:(e,t)=>{if(t.inFunctionBody)return[];if(e.type==="import_from_statement"){let s=[],a=e.childForFieldName("module_name");for(let l of e.namedChildren)if(!(a&&l.startIndex===a.startIndex))if(l.type==="aliased_import"){let c=l.namedChildren[0]?.text,d=l.childForFieldName("alias")?.text;d&&(c===d||t.ownerKind===void 0&&t.publicNames?.has(d))&&s.push({name:d,kind:"reexport"})}else l.type==="dotted_name"&&t.ownerKind===void 0&&t.publicNames?.has(l.text)&&s.push({name:l.text,kind:"reexport"});return s}if(e.type!=="expression_statement")return[];let n=e.namedChildren[0];if(!n||n.type!=="assignment")return[];if(Ak(e))return[];let r=[];for(let s=n;s?.type==="assignment";s=s.childForFieldName("right")){let a=s.childForFieldName("left");if(a?.type==="identifier")r.push(a.text);else if(a&&/^(pattern_list|tuple_pattern|list_pattern)$/.test(a.type))for(let l of a.namedChildren){let c=l.type==="list_splat_pattern"?l.namedChildren[0]:l;c?.type==="identifier"&&r.push(c.text)}}let o=t.ownerKind==="class"?"field":"const";return r.map(s=>({name:s,kind:o}))}},go:{lang:"go",defs:{function_declaration:"function",method_declaration:"method",type_spec:"type",type_alias:"type",const_spec:"const",var_spec:"var",field_declaration:"field",method_spec:"method",method_elem:"method",package_clause:"package"},containers:new Set(["type_declaration","const_declaration","var_declaration","var_spec_list","source_file","struct_type","interface_type","field_declaration_list"]),exported:yg,imports:{import_declaration:"string"},calls:{call_expression:"function"},parentFrom:{method_declaration:e=>vt(e.childForFieldName("receiver"))},nameFrom:{field_declaration:e=>e.childForFieldName("name")?.text},namesFrom:{var_spec:Cd("name"),const_spec:Cd("name"),field_declaration:Cd("name")},relationsFrom:{field_declaration:(e,t)=>{if(!t.self||e.childForFieldName("name"))return[];let n=vt(e.childForFieldName("type"));return n?[Ge("extends",t.self,n,e)]:[]}}},ruby:{lang:"ruby",defs:{method:"def",singleton_method:"def",class:"class",module:"module"},containers:new Set(["class","module","body_statement","program","singleton_class","block_body"]),sectionScopes:new Set(["singleton_class"]),exported:Ai,kindFrom:{assignment:Rg},nameFrom:{assignment:e=>e.childForFieldName("left")?.text},bodyFrom:{assignment:e=>e.childForFieldName("right")?.childForFieldName("block")?.childForFieldName("body")??void 0},inlineVisibility:e=>{if(e.type!=="call"||e.childForFieldName("receiver"))return;let t=vg[e.childForFieldName("method")?.text??""];if(t===void 0)return;let n=(e.childForFieldName("arguments")?.namedChildren??[]).filter(r=>r.type==="method"||r.type==="singleton_method"||r.type==="call");return n.length?{nodes:n,public:t}:void 0},docFrom:e=>{let t=e.parent?.type==="argument_list"?e.parent.parent:null;return t?.type==="call"&&vg[t.childForFieldName("method")?.text??""]!==void 0?Qn(t):void 0},calls:{call:"function"},sectionVisibility:e=>(e.type==="identifier"||e.type==="call")&&/^(private|protected)$/.test(e.text)?!1:e.type==="identifier"&&e.text==="public"?!0:void 0,relationsFrom:{class:(e,t)=>{if(!t.self)return[];let n=vt(e.childForFieldName("superclass"));return n?[Ge("extends",t.self,n,e)]:[]},call:(e,t)=>{let n=e.childForFieldName("method"),r=e.childForFieldName("receiver");if(!t.self||!n||!/^(include|prepend|extend)$/.test(n.text))return[];if(r&&r.type!=="self")return[];let o=[];for(let s of e.childForFieldName("arguments")?.namedChildren??[]){let a=vt(s);a&&o.push(Ge("implements",t.self,a,e))}return o}},extraMembers:(e,t)=>{if(t.inFunctionBody)return[];if(e.type==="assignment"){let n=e.childForFieldName("left");return n?.type==="constant"&&!Rg(e)?[{name:n.text,kind:"const"}]:[]}if(e.type==="call"){let n=e.childForFieldName("method");if(!n||!/^attr_(reader|writer|accessor)$/.test(n.text))return[];let r=e.childForFieldName("arguments"),o=[];for(let s of r?.namedChildren??[])s.type==="simple_symbol"&&o.push({name:s.text.replace(/^:/,""),kind:"attr"});return o}return[]}},java:{lang:"java",defs:{class_declaration:"class",interface_declaration:"interface",annotation_type_declaration:"annotation",enum_declaration:"enum",enum_constant:"enum-member",record_declaration:"record",method_declaration:"method",constructor_declaration:"constructor",compact_constructor_declaration:"constructor",field_declaration:"field",constant_declaration:"field",annotation_type_element_declaration:"method"},containers:new Set(["class_body","interface_body","enum_body","enum_body_declarations","annotation_type_body","program","formal_parameters"]),exported:gg,imports:{import_declaration:"path"},calls:{method_invocation:"function",object_creation_expression:"constructor"},kindFrom:{formal_parameter:e=>e.parent?.parent?.type==="record_declaration"?"field":void 0},publicMember:e=>e.parent?.parent?.type==="record_declaration",nameFrom:{field_declaration:e=>Tt(e,t=>t.type==="variable_declarator")?.childForFieldName("name")?.text,constant_declaration:e=>Tt(e,t=>t.type==="variable_declarator")?.childForFieldName("name")?.text},namesFrom:{field_declaration:bg,constant_declaration:bg},relationsFrom:{class_declaration:(e,t)=>{if(!t.self)return[];let n=[];for(let o of lt(e.childForFieldName("superclass")))n.push(Ge("extends",t.self,o,e));let r=e.childForFieldName("interfaces");for(let o of lt(qe(r??e,"type_list")??r))n.push(Ge("implements",t.self,o,e));return n},interface_declaration:(e,t)=>{let n=e.childForFieldName("interfaces")??qe(e,"extends_interfaces");return t.self?lt(qe(n??e,"type_list")??n).map(r=>Ge("extends",t.self,r,e)):[]},record_declaration:(e,t)=>{let n=e.childForFieldName("interfaces");return t.self?lt(qe(n??e,"type_list")??n).map(r=>Ge("implements",t.self,r,e)):[]}}},rust:{lang:"rust",defs:{function_item:"function",function_signature_item:"function",struct_item:"struct",enum_item:"enum",enum_variant:"enum-member",field_declaration:"field",trait_item:"trait",type_item:"type",associated_type:"type",mod_item:"mod",const_item:"const",static_item:"static",union_item:"union",macro_definition:"macro"},containers:new Set(["impl_item","declaration_list","source_file","field_declaration_list","enum_variant_list","foreign_mod_item","block"]),exported:hg,calls:{call_expression:"function"},parentFrom:{impl_item:e=>vt(e.childForFieldName("type"))},nestedDefs:new Set(["const_item","static_item"]),publicMembersIn:{impl_item:e=>e.childForFieldName("trait")!==null},relationsFrom:{impl_item:(e,t)=>{let n=vt(e.childForFieldName("trait"));return t.self&&n?[Ge("implements",t.self,n,e)]:[]}}},c_sharp:{lang:"csharp",defs:{class_declaration:"class",interface_declaration:"interface",struct_declaration:"struct",enum_declaration:"enum",enum_member_declaration:"enum-member",record_declaration:"record",delegate_declaration:"delegate",method_declaration:"method",constructor_declaration:"constructor",property_declaration:"property",indexer_declaration:"indexer",operator_declaration:"operator",field_declaration:"field",event_declaration:"event",event_field_declaration:"event",conversion_operator_declaration:"operator",destructor_declaration:"destructor"},containers:new Set(["namespace_declaration","declaration_list","compilation_unit","file_scoped_namespace_declaration","enum_member_declaration_list","parameter_list"]),exported:gg,calls:{invocation_expression:"function",object_creation_expression:"constructor"},kindFrom:{parameter:e=>e.parent?.parent?.type==="record_declaration"?"field":void 0},publicMember:e=>e.parent?.parent?.type==="record_declaration",nameFrom:{field_declaration:e=>Tt(e,t=>t.type==="variable_declarator")?.childForFieldName("name")?.text,event_field_declaration:e=>Tt(e,t=>t.type==="variable_declarator")?.childForFieldName("name")?.text,conversion_operator_declaration:e=>e.childForFieldName("type")?.text,operator_declaration:e=>{let t=e.childForFieldName("operator")?.text;return t?`operator${/^\w/.test(t)?" ":""}${t}`:void 0},indexer_declaration:()=>"this[]"},namesFrom:{field_declaration:e=>_g(e),event_field_declaration:e=>_g(e)},relationsFrom:{class_declaration:(e,t)=>t.self?Mi(qe(e,"base_list"),t.self,e):[],struct_declaration:(e,t)=>t.self?Mi(qe(e,"base_list"),t.self,e):[],record_declaration:(e,t)=>t.self?Mi(qe(e,"base_list"),t.self,e):[],interface_declaration:(e,t)=>t.self?lt(qe(e,"base_list")).map(n=>Ge("extends",t.self,n,e)):[]}},php:{lang:"php",defs:{function_definition:"function",class_declaration:"class",interface_declaration:"interface",trait_declaration:"trait",enum_declaration:"enum",enum_case:"enum-member",method_declaration:"method",property_declaration:"property",const_declaration:"const",namespace_definition:"namespace"},containers:new Set(["declaration_list","enum_declaration_list","program"]),exported:Rd,calls:{function_call_expression:"function",member_call_expression:"member",object_creation_expression:"constructor"},extraMembers:Pk,nameFrom:{property_declaration:e=>Tt(e,t=>t.type==="variable_name")?.text.replace(/^\$/,""),const_declaration:e=>Tt(e,t=>t.type==="const_element")?.namedChildren[0]?.text},namesFrom:{property_declaration:e=>e.namedChildren.flatMap(t=>t.type==="property_element"?t.childForFieldName("name")?.text.replace(/^\$/,"")??[]:[]),const_declaration:e=>e.namedChildren.flatMap(t=>t.type==="const_element"?t.namedChildren[0]?.text??[]:[])},relationsFrom:{class_declaration:(e,t)=>{if(!t.self)return[];let n=[];for(let r of lt(qe(e,"base_clause")))n.push(Ge("extends",t.self,r,e));for(let r of lt(qe(e,"class_interface_clause")))n.push(Ge("implements",t.self,r,e));return n},interface_declaration:(e,t)=>t.self?lt(qe(e,"base_clause")).map(n=>Ge("extends",t.self,n,e)):[]}},c:{lang:"c",defs:{function_definition:"function",struct_specifier:"struct",enum_specifier:"enum",enumerator:"enum-member",union_specifier:"union",type_definition:"type",field_declaration:"field",declaration:"const",preproc_def:"macro",preproc_function_def:"macro"},containers:new Set(["translation_unit","declaration_list","field_declaration_list","enumerator_list","linkage_specification","preproc_ifdef","preproc_if"]),exported:Ai,calls:{call_expression:"function"},kindFrom:{field_declaration:e=>$a(e)?"method":"field",declaration:e=>$a(e)?"function":"const"},nameFrom:{preproc_def:e=>xg(e)?void 0:e.childForFieldName("name")?.text},namesFrom:{field_declaration:Ta,declaration:Ta},bodyFrom:{type_definition:Ad},extraMembers:wg},cpp:{lang:"cpp",defs:{function_definition:"function",class_specifier:"class",struct_specifier:"struct",enum_specifier:"enum",enumerator:"enum-member",union_specifier:"union",type_definition:"type",alias_declaration:"type",concept_definition:"concept",namespace_definition:"namespace",namespace_alias_definition:"namespace",field_declaration:"field",declaration:"const",using_declaration:"using",friend_declaration:"friend",preproc_def:"macro",preproc_function_def:"macro"},containers:new Set(["translation_unit","declaration_list","field_declaration_list","enumerator_list","template_declaration","linkage_specification","preproc_ifdef","preproc_if"]),exported:Ai,calls:{call_expression:"function",new_expression:"constructor"},kindFrom:{field_declaration:e=>$a(e)?"method":"field",declaration:e=>$a(e)?"function":"const"},sectionVisibility:e=>e.type==="access_specifier"?!/^(private|protected)/.test(e.text):void 0,nameFrom:{friend_declaration:e=>Tr(e)??(e.namedChildren[0]?Tr(e.namedChildren[0]):void 0),preproc_def:e=>xg(e)?void 0:e.childForFieldName("name")?.text},namesFrom:{field_declaration:Ta,declaration:Ta},parentFrom:{function_definition:Sg,declaration:Sg},bodyFrom:{type_definition:Ad},extraMembers:wg,relationsFrom:{class_specifier:(e,t)=>t.self?lt(qe(e,"base_class_clause")).map(n=>Ge("extends",t.self,n,e)):[],struct_specifier:(e,t)=>t.self?lt(qe(e,"base_class_clause")).map(n=>Ge("extends",t.self,n,e)):[]}},scala:{lang:"scala",defs:{class_definition:"class",object_definition:"object",trait_definition:"trait",enum_definition:"enum",function_definition:"def",function_declaration:"def",val_definition:"val",val_declaration:"val",var_definition:"var",type_definition:"type",given_definition:"given",package_clause:"package"},containers:new Set(["compilation_unit","package_clause","template_body","class_parameters","parameters","extension_definition"]),parentFrom:{extension_definition:e=>vt(qe(e,"parameters")?.namedChildren[0]?.childForFieldName("type")??null)},exported:Rd,kindFrom:{class_parameter:e=>{let t=kg(e,e.childForFieldName("name"));return t||(e.parent?.parent?.type==="class_definition"&&/\bcase\s+class\b/.test(e.parent.parent.text.slice(0,80))?"val":void 0)}},calls:{call_expression:"function",instance_expression:"constructor"},relationsFrom:{class_definition:(e,t)=>t.self?Mi(qe(e,"extends_clause"),t.self,e):[],object_definition:(e,t)=>t.self?Mi(qe(e,"extends_clause"),t.self,e):[],trait_definition:(e,t)=>t.self?lt(qe(e,"extends_clause")).map(n=>Ge("extends",t.self,n,e)):[]}},bash:{lang:"shell",defs:{function_definition:"function",declaration_command:"const"},containers:new Set(["program","if_statement","compound_statement"]),exported:Ai,calls:{command:"function"},nameFrom:{declaration_command:e=>/^\s*local\b/.test(e.text)?void 0:Tt(e,t=>t.type==="variable_name")?.text}},kotlin:{lang:"kotlin",defs:{class_declaration:"class",object_declaration:"object",function_declaration:"function",property_declaration:"property",enum_entry:"enum-member",type_alias:"type",class_parameter:"property"},containers:new Set(["source_file","class_body","enum_class_body","companion_object","object_declaration","primary_constructor","class_parameters"]),exported:Rd,calls:{call_expression:"function"},kindFrom:{class_parameter:e=>kg(e,e.namedChildren.find(t=>/identifier$/.test(t.type)))||/\bdata\s+class\b/.test(e.parent?.parent?.parent?.text.slice(0,80)??"")?"property":void 0,class_declaration:e=>{let t=e.text.slice(0,80);return/\binterface\b/.test(t)?"interface":/\benum\s+class\b/.test(t)?"enum":/\bannotation\s+class\b/.test(t)?"annotation":"class"}},nameFrom:{property_declaration:e=>Tt(e,t=>t.type==="variable_declaration")?.namedChildren[0]?.text??e.namedChildren.find(t=>t.type==="identifier")?.text},relationsFrom:{class_declaration:(e,t)=>{if(!t.self)return[];let n=[];for(let r of qe(e,"delegation_specifiers")?.namedChildren??[]){let o=vt(r);o&&n.push(Ge(Tt(r,s=>s.type==="constructor_invocation")?"extends":"implements",t.self,o,e))}return n}}},elixir:{lang:"elixir",defs:{},containers:new Set(["source","do_block","call","stab_clause"]),exported:e=>!/^\s*def(p|macrop|guardp)\b/.test(e),calls:{call:"function"},kindFrom:{call:e=>Eg[e.childForFieldName("target")?.text??e.namedChildren[0]?.text??""]},skipCall:e=>{if(e.parent?.type==="unary_operator")return!0;let t=e.parent,n=t&&Ig(t)&&t.startIndex===e.startIndex?t:e;if(n.parent?.type!=="arguments")return!1;let r=n.parent.parent,o=r?.childForFieldName("target")??r?.namedChildren[0];return o!==void 0&&Eg[o.text]!==void 0},docFrom:e=>{let t=e.previousNamedSibling;for(;t&&t.type==="unary_operator";){let n=t.namedChildren[0],r=n?.childForFieldName("target")??n?.namedChildren[0];if(r&&/^(doc|moduledoc)$/.test(r.text)){let o=Tt(t,s=>s.type==="string");if(o)return o.text.replace(/^"""|"""$/g,"").replace(/^"|"$/g,"").trim()||void 0}t=t.previousNamedSibling}},nameFrom:{call:e=>{let n=(e.childForFieldName("arguments")??e.namedChildren.find(s=>s.type==="arguments"))?.namedChildren[0];if(!n)return;let r=Tk(n);if(r.type==="alias"||r.type==="identifier")return r.text;if(r.type==="binary_operator")return r.childForFieldName("operator")?.text;let o=r.childForFieldName("target")??r.namedChildren[0];return o&&/identifier|alias/.test(o.type)?o.text:void 0}}},zig:{lang:"zig",defs:{function_declaration:"function",variable_declaration:"const",container_field:"field",test_declaration:"test"},containers:new Set(["source_file","variable_declaration","struct_declaration","enum_declaration","union_declaration","error_set_declaration","opaque_declaration","block"]),exported:hg,calls:{call_expression:"function"},kindFrom:{variable_declaration:e=>{let t=e.namedChildren.find(n=>n.type==="builtin_function");if(!(t&&/^@(import|cImport)\b/.test(t.text))){for(let n of e.namedChildren){if(n.type==="struct_declaration")return"struct";if(n.type==="enum_declaration")return"enum";if(n.type==="union_declaration")return"union";if(n.type==="error_set_declaration")return"error";if(n.type==="opaque_declaration")return"opaque"}return/^\s*(?:pub\s+)?var\b/.test(e.text.slice(0,24))?"var":"const"}},container_field:e=>e.parent?.type==="enum_declaration"?"enum-member":"field"}},solidity:{lang:"solidity",defs:{contract_declaration:"contract",interface_declaration:"interface",library_declaration:"library",function_definition:"function",constructor_definition:"constructor",modifier_definition:"modifier",event_definition:"event",error_declaration:"error",struct_declaration:"struct",struct_member:"field",enum_declaration:"enum",enum_value:"enum-member",state_variable_declaration:"field",constant_variable_declaration:"const",user_defined_type_definition:"type",fallback_receive_definition:"function"},containers:new Set(["source_file","contract_body","struct_declaration","enum_declaration","enum_body"]),exported:(e,t)=>/\b(public|external)\b/.test(e)?!0:/\b(internal|private)\b/.test(e)?!1:yg(e,t)||!0,calls:{call_expression:"function"},nameFrom:{state_variable_declaration:e=>e.namedChildren.find(t=>t.type==="identifier")?.text,fallback_receive_definition:e=>/^\s*receive\b/.test(e.text)?"receive":"fallback",enum_value:e=>e.text},relationsFrom:{contract_declaration:(e,t)=>t.self?e.namedChildren.filter(n=>n.type==="inheritance_specifier").map(n=>vt(n)).filter(n=>n!==void 0).map(n=>Ge("extends",t.self,n,e)):[],interface_declaration:(e,t)=>t.self?e.namedChildren.filter(n=>n.type==="inheritance_specifier").map(n=>vt(n)).filter(n=>n!==void 0).map(n=>Ge("extends",t.self,n,e)):[]}},terraform:Cg,hcl:{...Cg,lang:"hcl"},lua:{lang:"lua",defs:{function_declaration:"function"},containers:new Set(["chunk","variable_declaration"]),exported:vk,calls:{function_call:"function"},assignments:!0,nameFrom:{function_declaration:e=>Fa(e.childForFieldName("name"))?.name},parentFrom:{function_declaration:e=>Fa(e.childForFieldName("name"))?.table}}}});function Tg(e){for(let t of e.children)if(t.type==="{"||t.type==="("||t.type==="[")return t.startIndex}function Bk(e,t){let n,r=s=>{s!==void 0&&s>e.startIndex&&(n===void 0||s{Lk.has(s.type)?r(s.startIndex):r(Dk.get(s.type)?.(s))};r(e.childForFieldName("body")?.startIndex),o(e);for(let s of e.namedChildren){if(n!==void 0&&s.startIndex>=n)break;o(s),Fg.has(s.type)&&r(s.childForFieldName("body")?.startIndex);let a;for(let l of s.namedChildren){if(n!==void 0&&l.startIndex>=n)break;o(l),Fg.has(l.type)&&(a===void 0&&(a=s.childForFieldName("value")??s.childForFieldName("right")),a?.startIndex===l.startIndex&&r(l.childForFieldName("body")?.startIndex))}}if(n===void 0&&t.startsWith("end",e.endIndex-3)){let s=e.children,a=s.length-1;if(s[a]?.type==="end"){for(;a>0&&s[a-1].type===";";)a--;r(s[a].startIndex)}}return n}function zk(e,t,n){let r=[],o=s=>{for(let a of s.namedChildren){if(a.startIndex>=n)return;a.endIndex<=t||(Aa.test(a.type)?r.push(a):ks.test(a.type)||o(a))}};return o(e),r}function er(e,t){let n=e.startIndex,r=Math.min(Bk(e,t)??e.endIndex,n+Wk),o=t.slice(n,r),s="",a=n;for(let l of Uk.test(o)?zk(e,n,r):[])for(s=Og(s,t.slice(a,Math.max(a,l.startIndex)).replace(/[ \t]+$/,"")),a=Math.min(l.endIndex,r);a|=)$/,"").trim().slice(0,jk)}var Lk,Dk,Fg,jk,Wk,Uk,Og,Ng=H(()=>{"use strict";$();Ia();Lk=new Set(["block","statement_block","class_body","declaration_list","field_declaration_list","template_body","compound_statement","body_statement","enum_body","enum_body_declarations","enum_variant_list","enum_member_declaration_list","enumerator_list","interface_body","object_type","do_block","struct_declaration","enum_declaration","union_declaration","error_set_declaration","opaque_declaration","contract_body","enum_class_body"]),Dk=new Map([["interface_type",e=>e.namedChildren.some(t=>t.type==="method_elem")?Tg(e):void 0],["macro_definition",e=>Tg(e)],["preproc_function_def",e=>e.childForFieldName("value")?.startIndex]]);Fg=new Set(["arrow_function","function_expression","function","generator_function","function_definition","lambda","lambda_expression"]),jk=400,Wk=4096;Uk=/\/[/*]|#|--|=begin/;Og=(e,t)=>e&&t&&!/[\s([{]$/.test(e)&&!/^[\s,;)\]}]/.test(t)?`${e} ${t}`:e+t});function Td(e){return e.replace(/^['"`]|['"`]$/g,"")}function qk(e,t){if(e.type==="import_statement"){let n=e.childForFieldName("source");if(!n)return;let r=Td(n.text);for(let o of e.namedChildren)if(o.type==="import_clause"){for(let s of o.namedChildren)if(s.type==="identifier")t.push({local:s.text,name:"default",from:r});else if(s.type==="namespace_import"){let a=s.namedChildren.find(l=>l.type==="identifier");a&&t.push({local:a.text,name:"*",from:r})}else if(s.type==="named_imports")for(let a of s.namedChildren){if(a.type!=="import_specifier")continue;let l=a.childForFieldName("name")?.text,c=a.childForFieldName("alias")?.text;l&&c&&c!==l&&t.push({local:c,name:Td(l),from:r})}}}else if(e.type==="export_statement"&&e.children.some(n=>n.type==="default")){let n=e.childForFieldName("declaration"),r=n?n.childForFieldName("name")?.text:e.childForFieldName("value")?.type==="identifier"?e.childForFieldName("value").text:void 0;r&&t.push({local:"default",name:r})}}function Pg(e,t){if(e.type==="import_statement"){for(let n of e.namedChildren)if(n.type==="dotted_name"){let r=n.namedChildren[0]?.text;r&&t.push({local:r,name:"*",from:r})}else if(n.type==="aliased_import"){let r=n.childForFieldName("name")?.text,o=n.childForFieldName("alias")?.text;r&&o&&t.push({local:o,name:"*",from:r})}}else if(e.type==="import_from_statement"){let n=e.childForFieldName("module_name")?.text;if(!n)return;for(let r of e.namedChildren){if(r.type!=="aliased_import")continue;let o=r.childForFieldName("name")?.text,s=r.childForFieldName("alias")?.text;o&&s&&s!==o&&t.push({local:s,name:o,from:n})}}else if(Gk.has(e.type))for(let n of e.namedChildren)Pg(n,t)}function Lg(e,t){if(e.type==="import_declaration"||e.type==="import_spec_list")for(let n of e.namedChildren)Lg(n,t);else if(e.type==="import_spec"){let n=e.childForFieldName("name"),r=e.childForFieldName("path");n?.type==="package_identifier"&&r&&t.push({local:n.text,name:"*",from:Td(r.text)})}}function Dg(e,t){let n=t==="typescript"||t==="javascript"?qk:t==="python"?Pg:t==="go"?Lg:void 0;if(!n)return[];let r=[];for(let a of e.namedChildren)n(a,r);let o=new Set,s=[];for(let a of r.sort((l,c)=>T(l.local,c.local)||T(l.name,c.name)||T(l.from??"",c.from??""))){let l=`${a.local}\0${a.name}\0${a.from??""}`;if(!o.has(l)&&(o.add(l),s.push(a),s.length>=Hk))break}return s}var Hk,Gk,jg=H(()=>{"use strict";$();ce();Hk=256,Gk=new Set(["if_statement","elif_clause","else_clause","try_statement","except_clause","finally_clause","with_statement","block"])});function dE(e){let t=Bg.get(e);return t===void 0&&(t=(rE.test(e)?Ug:0)|(Aa.test(e)?zg:0)|(iE.test(e)?Na:0)|(oE.test(e)?Hg:0)|(aE.test(e)?Gg:0),Bg.set(e,t)),t}function uE(e){return e.namedChildren.every(t=>lE.test(t.type))}function fE(e){let t=e.parent;return t!==null&&t.type==="expression_statement"&&t.namedChildCount===1}function Pa(e,t){let n=e.slice();if(e.length>t){let r=new Uint8Array(e.length),o=new Set,s=0;for(let a=0;ar[l]===1)}return n.sort((r,o)=>T(r.name,o.name)||r.line-o.line||T(r.receiver??"",o.receiver??""))}function mE(e,t,n,r){let o=new Set,s=t.calls!==void 0,a=[],l=new Set,c=(h,_,y)=>{if(!h||h==="_"||!/^[A-Za-z_]\w*$/.test(h))return;let b=_.startPosition.row+1,S=`${h} ${b} ${y??""}`;l.has(S)||(l.add(S),a.push(y?{name:h,line:b,receiver:y}:{name:h,line:b}))},d=new Set,u=h=>{if(!(d.size>=Wg))for(let _ of gn(h)){if(d.size>=Wg)return;d.add(_)}},f=new Zn,m=t.imports?.import_statement!==void 0,p=new Set,g=[e];for(;g.length;){let h=g.pop(),_=h.type,y=h.namedChildren,b=dE(_);if(y.length===0&&b&Ug){let k=h.text;sE.test(k)&&!n.has(k)&&o.add(k)}let S=b&Na?uE(h):!1;if(b&zg)for(let k of h.text.split(/\r?\n/))u(Dt(k));else if(b&Na&&h.endIndex-h.startIndex<=Zk)if(S)u(dd(h.text));else for(let k of y)cE.test(k.type)&&u(k.text);if(f.full||(b&Na?S&&!fE(h)&&f.addString(h.text,h.startPosition.row+1):y.length===0&&b&Hg?f.add("number",h.text.trim(),h.startPosition.row+1):b&Gg&&f.add("regex",h.text,h.startPosition.row+1)),s&&!(t.kindFrom?.[_]&&t.kindFrom[_](h))&&!t.skipCall?.(h)){let k=t.calls[_];if(k==="function"){let R=h.childForFieldName("function")??h.childForFieldName("callee")??h.childForFieldName("method")??h.childForFieldName("name")??h.childForFieldName("target")??y[0]??null,I=R&&t.calls[R.type]==="function"?R.childForFieldName("function"):null;c($r(R),h,Ci(I??R)??Ci(h))}else if(k==="member")c($r(h.childForFieldName("name")),h,Ci(h));else if(k==="constructor"){let R=h.childForFieldName("constructor")??h.childForFieldName("type")??h.childForFieldName("name");for(let I=0;!R&&I=0;k--)g.push(y[k])}return{idents:[...o].slice(0,Vk).sort(),calls:Pa(a,r),importedNames:[...p].slice(0,Jk).sort(T),terms:[...d].sort(T),literals:f.result()??[]}}function gE(e,t){let n=(r,o)=>{for(let s of r.namedChildren)if(s.namedChildren.length===0){if(s.text===t)return s.startIndex}else if(o<3&&!pE.test(s.type)){let a=n(s,o+1);if(a!==void 0)return a}};return n(e,0)}function tr(e){let t=e.endPosition;return t.column===0&&t.row>e.startPosition.row?t.row:t.row+1}function hE(e){let t=[],n=r=>{if(/^(shorthand_property_identifier_pattern|identifier)$/.test(r.type)){t.includes(r.text)||t.push(r.text);return}if(r.type==="pair_pattern"){let o=r.childForFieldName("value");o&&n(o);return}for(let o of r.namedChildren)n(o)};for(let r of e.namedChildren)n(r);return t}function Fd(e,t,n,r={}){let o=Ra(t,n);if(!o||!De(o))return;let s=$d[o];if(!s)return;let a=Ss(o);if(!a)return;let l=$d[Ir(t)??o]?.lang??s.lang,c=null;try{if(c=a.parse(n),!c)return;let d=r.maxSymbols??Kk,u=[],f=c.rootNode,m=(e.split("/").pop()??"").replace(/\.[^.]+$/,""),p=new Map,g=z=>z.parentPath??z.parent??"",h=(z,U)=>{let q=g(U),te=p.get(q);te||p.set(q,te=new Set),te.add(z)},_=z=>{u.length{let te=s.relationsFrom?.[q];if(te)for(let ae of te(z,{self:U})){if(ae.from===ae.to)continue;let ge=`${ae.kind} ${ae.from} ${ae.to}`;S.has(ge)||b.length>=Xk||(S.add(ge),b.push(ae))}},R=(z,U,q,te)=>{if(te.inFunctionBody||s.privateMember?.(z)===!0)return!1;if(s.publicMember?.(z)===!0)return!0;if(!te.sectionPublic)return!1;if(te.forcePublic||te.exported)return!0;let ae=gE(z,q);return s.exported(U,q,ae===void 0?U:n.slice(z.startIndex,ae))},I=z=>s.docFrom?.(z)??(s.docstring?mg(z):void 0)??Qn(z),P=(z,U)=>{let q=U.sectionPublic,te=s.bareMembers?.[z.type];for(let ae of z.namedChildren){if(s.sectionVisibility){let Je=s.sectionVisibility(ae);if(Je!==void 0){q=Je;continue}}let ge=q===U.sectionPublic?U:{...U,sectionPublic:q},st=s.inlineVisibility?.(ae);if(st)for(let Je of st.nodes)v(Je,te,{...ge,sectionPublic:st.public});else v(ae,te,ge)}},v=(z,U,q)=>{if(U&&z.namedChildren.length===0&&ks.test(z.type)){_({name:z.text,kind:U,file:e,line:z.startPosition.row+1,endLine:tr(z),...q.parent?{parent:q.parent}:{},exported:q.forcePublic||q.exported,lang:l});return}let te=s.extraMembers?.(z,{ownerKind:q.ownerKind,inFunctionBody:q.inFunctionBody,publicNames:y});for(let ae of te??[]){let ge=ae.node??z,st=er(ge,n),Je=s.docFrom?.(ge)??Qn(ge);_({name:ae.name,kind:ae.kind,file:e,line:ge.startPosition.row+1,endLine:tr(ge),...q.parent?{parent:q.parent}:{},...q.parentPath&&q.parentPath!==q.parent?{parentPath:q.parentPath}:{},signature:st,...Je?{doc:Je}:{},exported:R(ge,st,ae.name,q),lang:l})}E(z,q)},C=(z,U,q,te,ae)=>{let ge=Id.has(U);return{parent:z,parentPath:q?`${q}/${z}`:z,ownerKind:U,exported:ae,forcePublic:Mg.has(U),inFunctionBody:te.inFunctionBody||ge,funcDepth:te.funcDepth+(ge?1:0),sectionPublic:!0}},M=(z,U)=>{let q=s.bodyFrom?.[z.type]?.(z);if(q)return M(q,U);let te=!1;for(let ae of z.namedChildren)s.containers.has(ae.type)&&(te=!0,P(ae,U));!te&&s.containers.has(z.type)&&P(z,U)},x=(z,U,q,te,ae)=>{k(z,U,z.type==="class"?"class_declaration":z.type),M(z,C(U,q,te.parentPath,te,ae))},w=0,E=(z,U)=>{if(!(w>=Qk)){w++;try{N(z,U)}finally{w--}}},N=(z,U)=>{if(U.funcDepth>Yk)return;let q=z.type,te=s.exportMarkers?.has(q)===!0,ae=U.exported||te;if(q==="export_statement"&&!z.childForFieldName("source")){for(let he of z.namedChildren)if(he.type==="identifier")h(he.text,U);else if(he.type==="export_clause")for(let fe of he.namedChildren){let ye=fe.childForFieldName("name")??fe.namedChildren[0];ye?.text&&h(ye.text,U)}}if(q==="export_statement"&&m&&z.children.some(he=>he.type==="default"))for(let he of z.namedChildren){let fe=tE.has(he.type),ye=nE.has(he.type);if((fe||ye)&&!he.childForFieldName("name")){let at=Qn(z),ne=ye?"class":"function";_({name:m,kind:ne,file:e,line:z.startPosition.row+1,endLine:tr(z),signature:er(z,n),...at?{doc:at}:{},exported:!0,lang:l}),x(he,m,ne,U,!0);return}}if(s.assignments&&q==="expression_statement"){let he=z.namedChildren[0];if(he?.type==="assignment_expression"){let fe=he.childForFieldName("left"),ye=he.childForFieldName("right");if(fe?.type==="member_expression"&&fe.text==="module.exports"&&ye){if(ye.type==="object"){for(let ne of ye.namedChildren)if(ne.type==="shorthand_property_identifier")h(ne.text,U);else if(ne.type==="pair"){let V=ne.childForFieldName("key"),Z=ne.childForFieldName("value");V?.type==="property_identifier"&&h(V.text,U),Z?.type==="identifier"&&h(Z.text,U)}return}if(ye.type==="identifier"){h(ye.text,U);return}}let at=ye&&Oa.has(ye.type);if(fe&&ye&&at){let ne,V=!1;if(fe.type==="member_expression"&&fe.text==="module.exports")ne=ye.childForFieldName("name")?.text??(m||void 0),V=!0;else if(fe.type==="member_expression"){let Z=fe.childForFieldName("property");if(Z?.type==="property_identifier"){ne=Z.text;let B=fe.text.slice(0,fe.text.length-Z.text.length-1);V=B==="exports"||B==="module.exports"}}else fe.type==="identifier"&&(ne=fe.text);if(ne){let Z=Qn(z),B=ye.type==="class"?"class":"function",K=!U.inFunctionBody&&(ae||V);_({name:ne,kind:B,file:e,line:he.startPosition.row+1,endLine:tr(he),...U.parent?{parent:U.parent}:{},signature:er(he,n),...Z?{doc:Z}:{},exported:K,lang:l}),x(ye,ne,B,U,K);return}}else if(fe?.type==="member_expression"&&ye){let ne=fe.childForFieldName("property");if(ne?.type==="property_identifier"){let V=fe.text.slice(0,fe.text.length-ne.text.length-1);if(V==="exports"||V==="module.exports"){ye.type==="identifier"&&h(ye.text,U),(ye.type!=="identifier"||ye.text!==ne.text)&&_({name:ne.text,kind:"const",file:e,line:he.startPosition.row+1,endLine:tr(he),...U.parent?{parent:U.parent}:{},signature:er(he,n),exported:!0,lang:l});return}}}}}if(s.assignments&&q==="assignment_statement"){let he=z.children.find(V=>V.type==="variable_list"),fe=z.children.find(V=>V.type==="expression_list"),ye=he?.namedChildren??[],at=fe?.namedChildren??[],ne=Math.min(ye.length,at.length);for(let V=0;Vne.type==="object_pattern"||ne.type==="array_pattern");if(ye&&!U.inFunctionBody){let ne=er(z,n),V=I(z);for(let Z of hE(ye))_({name:Z,kind:Je,file:e,line:z.startPosition.row+1,endLine:tr(z),...U.parent?{parent:U.parent}:{},signature:ne,...V?{doc:V}:{},exported:R(z,ne,Z,{...U,exported:ae}),lang:l});return}let at=Id.has(Je)||eE.has(Je)||s.nestedDefs?.has(q)===!0||Oa.has(z.childForFieldName("value")?.type??"");if(fe&&(!U.inFunctionBody||at)){let ne=er(z,n),V=I(z),Z=ge??U.parent,B=ge??U.parentPath,K=s.namesFrom?.[q]?.(z);for(let se of K&&K.length>1?K:[fe])_({name:se,kind:Je,file:e,line:z.startPosition.row+1,endLine:tr(z),...Z?{parent:Z}:{},...B&&B!==Z?{parentPath:B}:{},signature:ne,...V?{doc:V}:{},exported:R(z,ne,se,{...U,exported:ae}),lang:l});k(z,fe),M(z,C(fe,Je,B,U,ae));return}}if(k(z,ge??U.parent),s.containers.has(q)){let he=U.forcePublic||s.publicMembersIn?.[q]?.(z)===!0,fe=Oa.has(q);P(z,{...U,exported:ae,forcePublic:he,inFunctionBody:U.inFunctionBody||fe,funcDepth:U.funcDepth+(fe?1:0),...ge?{parent:ge,parentPath:ge,ownerKind:"type"}:{},...s.sectionScopes?.has(q)?{sectionPublic:!0}:{}})}};if(P(f,{exported:!1,forcePublic:!1,inFunctionBody:!1,funcDepth:0,sectionPublic:!0}),p.size)for(let z of u)!z.exported&&p.get(g(z))?.has(z.name)&&(z.exported=!0);if(y){for(let q of u)q.parent===void 0&&(q.exported=y.has(q.name));let z=new Set(u.filter(q=>q.parent===void 0&&q.kind!=="reexport").map(q=>q.name)),U=0;for(let q of u)(q.parent!==void 0||q.kind!=="reexport"||!z.has(q.name))&&(u[U++]=q);u.length=U}let{idents:O,calls:L,importedNames:G,terms:X,literals:oe}=mE(f,s,new Set(u.map(z=>z.name)),r.maxCalls??Ii),ue=r.imports!==!1,ve=ue?gi(t,n):[],Oe=ue?fa(t,n):void 0;return b.sort((z,U)=>T(z.from,U.from)||T(z.kind,U.kind)||T(z.to,U.to)),{symbols:u,refs:ve,pkg:Oe,idents:O,calls:L,importedNames:G,importAliases:Dg(f,s.lang),relations:b,terms:X,literals:oe,...u.length>=d?{truncated:!0}:{}}}catch(d){r.onFailure?.(d);return}finally{c?.delete()}}var Vk,Ii,Jk,Kk,Xk,Wg,Zk,Yk,Qk,eE,tE,nE,rE,sE,iE,oE,aE,lE,cE,Ug,zg,Na,Hg,Gg,Bg,pE,Od=H(()=>{"use strict";$();_a();ce();pt();Ia();$g();Ng();vd();jg();li();ft();et();Vk=512,Ii=8192,Jk=256,Kk=2e3,Xk=256,Wg=512,Zk=80,Yk=2,Qk=256,eE=new Set(["class","struct","enum","interface","trait","type","record","union"]),tE=new Set(["function","function_expression","function_declaration","generator_function","generator_function_declaration","arrow_function"]),nE=new Set(["class","class_declaration","abstract_class_declaration"]),rE=/identifier|constant|(^|_)name$/,sE=/^[A-Za-z_]\w{4,}$/,iE=/(^|_)string(_literal)?$/,oE=/(^|_)(integer|float|number|decimal|numeric)(_literal)?$/,aE=/(^|_)(regex|regular_expression)(_pattern|_literal)?$/,lE=/(^|_)(fragment|content|escape_sequence|character|start|end)$/,cE=/(^|_)(fragment|content)$/,Ug=1,zg=2,Na=4,Hg=8,Gg=16,Bg=new Map;pE=/annotation|attribute|decorator|modifier|parameter|argument|body|block|string|comment|_list$/});function Pd(e,t){let n=t.exec(e);return n?(n[1]??n[2]??n[3]??"").trim().toLowerCase():void 0}function Ld(e){return e.replace(/[^\r\n]/g," ")}function qg(e,t,n){let r="",o=0;for(let[a,l]of t){let c=e.slice(o,a),d=e.slice(a,l);r+=n?Ld(c)+d:c+Ld(d),o=l}let s=e.slice(o);return r+(n?Ld(s):s)}function vE(e,t){let n=[],r=1,o=0,s=a=>{for(let l=e.indexOf(` +${a}`)}let s=o.clone();try{n=await WebAssembly.compileStreaming(o)}catch(a){console.error("wasm streaming compile failed:",a),console.error("falling back to ArrayBuffer instantiation"),n=new Uint8Array(await s.arrayBuffer())}}let r=await A.loadWebAssemblyModule(n,{loadAsync:!0});return Aa.loadFromWasmExports(r,{sync:!1})}static loadFromWasmExports(t,{sync:n}){let r=Object.keys(t),o=r.find(a=>wk.test(a)&&!a.includes("external_scanner_"));if(!o)throw console.log(`Couldn't find language function in Wasm file. Symbols: +${JSON.stringify(r,null,2)}`),new Error(`Language.${n?"loadSync":"load"} failed: no language function found in Wasm file`);let s=t[o]();return new Aa(rr,s)}static loadSync(t){let n=A.loadWebAssemblyModule(t,{loadAsync:!1});return Aa.loadFromWasmExports(n,{sync:!0})}};D(lg,"Module");xk=lg,cg=null;D(dg,"initializeBinding");D(ug,"checkModule");eg=vs(e=>{A._ts_parser_delete(e[0]),A._free(e[1])}),Cd=class{static{D(this,"Parser")}0=0;1=0;logCallback=null;language=null;static async init(e){rg(await dg(e)),Z=A._ts_init(),xd=A.getValue(Z,"i32"),Sd=A.getValue(Z+ee,"i32")}constructor(){this.initialize(),eg?.register(this,[this[0],this[1]],this)}initialize(){if(!ug())throw new Error("cannot construct a Parser before calling `init()`");A._ts_parser_new_wasm(),this[0]=A.getValue(Z,"i32"),this[1]=A.getValue(Z+ee,"i32")}delete(){eg?.unregister(this),A._ts_parser_delete(this[0]),A._free(this[1]),this[0]=0,this[1]=0}setLanguage(e){let t;if(!e)t=0,this.language=null;else if(e.constructor===Rd){t=e[0];let n=A._ts_language_abi_version(t);if(ne.slice(l);else if(typeof e=="function")A.currentParseCallback=e;else throw new Error("Argument must be a string or a function");n?.progressCallback?A.currentProgressCallback=n.progressCallback:A.currentProgressCallback=null,this.logCallback?(A.currentLogCallback=this.logCallback,A._ts_parser_enable_logger_wasm(this[0],1)):(A.currentLogCallback=null,A._ts_parser_enable_logger_wasm(this[0],0));let r=0,o=0;if(n?.includedRanges){r=n.includedRanges.length,o=A._calloc(r,Ai);let l=o;for(let c=0;c0){let r=t;for(let o=0;oe.type==="capture","isCaptureStep"),Md=D(e=>e.type==="string","isStringStep"),un={Syntax:1,NodeName:2,FieldName:3,CaptureName:4,PatternStructure:5},Ci=class fg extends Error{constructor(t,n,r,o){super(fg.formatMessage(t,n)),this.kind=t,this.info=n,this.index=r,this.length=o,this.name="QueryError"}kind;info;index;length;static{D(this,"QueryError")}static formatMessage(t,n){switch(t){case un.NodeName:return`Bad node name '${n.word}'`;case un.FieldName:return`Bad field name '${n.word}'`;case un.CaptureName:return`Bad capture name @${n.word}`;case un.PatternStructure:return`Bad pattern structure at offset ${n.suffix}`;case un.Syntax:return`Bad syntax at offset ${n.suffix}`}}};D(mg,"parseAnyPredicate");D(pg,"parseMatchPredicate");D(gg,"parseAnyOfPredicate");D(hg,"parseIsPredicate");D(yg,"parseSetDirective");D(_g,"parsePattern");ng=vs(e=>{A._ts_query_delete(e)}),bg=class{static{D(this,"Query")}0=0;exceededMatchLimit;textPredicates;captureNames;captureQuantifiers;predicates;setProperties;assertedProperties;refutedProperties;matchLimit;constructor(e,t){let n=A.lengthBytesUTF8(t),r=A._malloc(n+1);A.stringToUTF8(t,r,n+1);let o=A._ts_query_new(e[0],r,n,Z,Z+ee);if(!o){let _=A.getValue(Z+ee,"i32"),y=A.getValue(Z,"i32"),b=A.UTF8ToString(r,y).length,S=t.slice(b,b+100).split(` +`)[0],k=S.match(Ek)?.[0]??"";switch(A._free(r),_){case un.Syntax:throw new Ci(un.Syntax,{suffix:`${b}: '${S}'...`},b,0);case un.NodeName:throw new Ci(_,{word:k},b,k.length);case un.FieldName:throw new Ci(_,{word:k},b,k.length);case un.CaptureName:throw new Ci(_,{word:k},b,k.length);case un.PatternStructure:throw new Ci(_,{suffix:`${b}: '${S}'...`},b,0)}}let s=A._ts_query_string_count(o),a=A._ts_query_capture_count(o),l=A._ts_query_pattern_count(o),c=new Array(a),d=new Array(l),u=new Array(s);for(let _=0;_s)throw new Error("`startIndex` cannot be greater than `endIndex`");if(r!==It&&(n.row>r.row||n.row===r.row&&n.column>r.column))throw new Error("`startPosition` cannot be greater than `endPosition`");if(d!==0&&c>d)throw new Error("`startContainingIndex` cannot be greater than `endContainingIndex`");if(l!==It&&(a.row>l.row||a.row===l.row&&a.column>l.column))throw new Error("`startContainingPosition` cannot be greater than `endContainingPosition`");m&&(A.currentQueryProgressCallback=m),fe(e),A._ts_query_matches_wasm(this[0],e.tree[0],n.row,n.column,r.row,r.column,o,s,a.row,a.column,l.row,l.column,c,d,u,f);let p=A.getValue(Z,"i32"),g=A.getValue(Z+ee,"i32"),h=A.getValue(Z+2*ee,"i32"),_=new Array(p);this.exceededMatchLimit=!!h;let y=0,b=g;for(let S=0;SP(I))){_[y]={patternIndex:k,captures:I};let P=this.setProperties[k];_[y].setProperties=P;let v=this.assertedProperties[k];_[y].assertedProperties=v;let R=this.refutedProperties[k];_[y].refutedProperties=R,y++}}return _.length=y,A._free(g),A.currentQueryProgressCallback=null,_}captures(e,t={}){let n=t.startPosition??It,r=t.endPosition??It,o=t.startIndex??0,s=t.endIndex??0,a=t.startContainingPosition??It,l=t.endContainingPosition??It,c=t.startContainingIndex??0,d=t.endContainingIndex??0,u=t.matchLimit??4294967295,f=t.maxStartDepth??4294967295,m=t.progressCallback;if(typeof u!="number")throw new Error("Arguments must be numbers");if(this.matchLimit=u,s!==0&&o>s)throw new Error("`startIndex` cannot be greater than `endIndex`");if(r!==It&&(n.row>r.row||n.row===r.row&&n.column>r.column))throw new Error("`startPosition` cannot be greater than `endPosition`");if(d!==0&&c>d)throw new Error("`startContainingIndex` cannot be greater than `endContainingIndex`");if(l!==It&&(a.row>l.row||a.row===l.row&&a.column>l.column))throw new Error("`startContainingPosition` cannot be greater than `endContainingPosition`");m&&(A.currentQueryProgressCallback=m),fe(e),A._ts_query_captures_wasm(this[0],e.tree[0],n.row,n.column,r.row,r.column,o,s,a.row,a.column,l.row,l.column,c,d,u,f);let p=A.getValue(Z,"i32"),g=A.getValue(Z+ee,"i32"),h=A.getValue(Z+2*ee,"i32"),_=new Array;this.exceededMatchLimit=!!h;let y=new Array,b=g;for(let S=0;SP(y))){let P=y[I],v=this.setProperties[k];P.setProperties=v;let R=this.assertedProperties[k];P.assertedProperties=R;let M=this.refutedProperties[k];P.refutedProperties=M,_.push(P)}}return A._free(g),A.currentQueryProgressCallback=null,_}predicatesForPattern(e){return this.predicates[e]}disableCapture(e){let t=A.lengthBytesUTF8(e),n=A._malloc(t+1);A.stringToUTF8(e,n,t+1),A._ts_query_disable_capture(this[0],n,t),A._free(n)}disablePattern(e){if(e>=this.predicates.length)throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`);A._ts_query_disable_pattern(this[0],e)}didExceedMatchLimit(){return this.exceededMatchLimit}startIndexForPattern(e){if(e>=this.predicates.length)throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`);return A._ts_query_start_byte_for_pattern(this[0],e)}endIndexForPattern(e){if(e>=this.predicates.length)throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`);return A._ts_query_end_byte_for_pattern(this[0],e)}patternCount(){return A._ts_query_pattern_count(this[0])}captureIndexForName(e){return this.captureNames.indexOf(e)}isPatternRooted(e){return A._ts_query_is_pattern_rooted(this[0],e)===1}isPatternNonLocal(e){return A._ts_query_is_pattern_non_local(this[0],e)===1}isPatternGuaranteedAtStep(e){return A._ts_query_is_pattern_guaranteed_at_step(this[0],e)===1}}});function Nr(e){return Ti[e]}function Fa(e,t){let n=Ti[e];return e===".h"&&Rk.test(t)?"cpp":n}function Cs(){let e=F.env.XDG_CACHE_HOME,t=e&&e.trim()?e.trim():j(Ra(),".cache");return j(t,"codeindex","grammars",Ne)}function qt(e={}){let t=Cs(),n=F.env.CODEINDEX_GRAMMARS_DIR,r=n&&n.trim()&&Q(n)?n:void 0,o=Q(t)?t:void 0,s=(d,u,f)=>{let m=j(u,"..",Ck),p=[];for(let g of[u,Q(m)?m:void 0,...f])g!==void 0&&!p.includes(g)&&p.push(g);return{tier:d,dir:u,cacheDir:t,dirs:p}},a=F.env.CODEINDEX_GRAMMAR_DIR??F.env.ULTRAINDEX_GRAMMAR_DIR;if(a&&a.trim()&&Q(a))return s("env",a,[]);let l=e.moduleDir??Ie(Ma(import.meta.url)),c=[j(l,"grammars"),j(l,"..","..","scripts","grammars"),j(l,"..","scripts","grammars")];for(let d of c)if(Q(d))return s("adjacent",d,[r,o]);return r?s("env",r,[o]):o?s("cache",o,[]):{tier:"none",cacheDir:t,dirs:[]}}function Oa(){let{dirs:e}=qt(),t=n=>e.some(r=>Q(j(r,n)));return t("web-tree-sitter.wasm")?new Set(Na().filter(n=>t(`${n}.wasm`))):new Set}function Mk(e){return qt(e).dir}async function fn(e){let{dirs:t}=qt();if(!t.length)return;let n=r=>{for(let o of t){let s=j(o,r);if(Q(s))return s}};if(!wg){let r=n("web-tree-sitter.wasm");if(!r)return;await Cd.init({wasmBinary:oe(r)}),wg=!0,Ta=new Cd}for(let r of new Set(e)){if(Ii.has(r))continue;let o=n(`${r}.wasm`),s=o?(()=>{try{let a=$e(o);return`${o}:${a.size}:${a.mtimeMs}`}catch{return`${o}:unreadable`}})():`missing:${t.join("|")}`;if($a.get(r)!==s){if(!o){$a.set(r,s);continue}try{Ii.set(r,await Rd.load(new Uint8Array(oe(o)))),$a.delete(r)}catch{$a.set(r,s)}}}}function Na(){return[...new Set(Object.values(Ti))]}function Vt(e){let t=new Set;for(let n of e){for(let o of vk[n]??[])t.add(o);let r=Ti[n];r!==void 0&&t.add(r),n===".h"&&t.add("cpp")}return[...t].sort()}function Ue(e){return Ii.has(e)}function Id(e){return Ii.get(e)}function Ms(e){let t=Ii.get(e);return!Ta||!t?null:(Ta.setLanguage(t),Ta)}var $i,Rs,Ti,vk,Rk,Ck,wg,Ta,Ii,$a,wt=z(()=>{"use strict";$();Re();vi();ge();Ri();Ad();Rt();$i=new Set(["typescript","tsx","javascript","python","go","rust","java","ruby","c","cpp","c_sharp","php","scala","bash","lua"]),Rs=new Set(["kotlin","elixir","zig","hcl","terraform","solidity"]),Ti={".ts":"typescript",".mts":"typescript",".cts":"typescript",".tsx":"tsx",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".go":"go",".rs":"rust",".java":"java",".rb":"ruby",".rake":"ruby",".c":"c",".h":"c",".cc":"cpp",".cpp":"cpp",".cxx":"cpp",".hpp":"cpp",".hh":"cpp",".cs":"c_sharp",".php":"php",".scala":"scala",".sc":"scala",".sh":"bash",".bash":"bash",".lua":"lua",".kt":"kotlin",".kts":"kotlin",".ex":"elixir",".exs":"elixir",".zig":"zig",".hcl":"hcl",".tf":"terraform",".tfvars":"terraform",".sol":"solidity"},vk={".vue":["javascript","tsx","typescript"],".svelte":["javascript","tsx","typescript"],".astro":["typescript"]};Rk=/^[ \t]*(?:namespace(?:[ \t]+[A-Za-z_][\w:]*)?\s*\{|using[ \t]+namespace[ \t]|template[ \t]*<|class[ \t]+(?:[A-Z_][A-Z0-9_]*[ \t]+)?[A-Za-z_]\w*(?:[ \t]+final)?[ \t]*(?:[:;{]|$)|(?:public|private|protected)[ \t]*:(?!:)|#[ \t]*include[ \t]*<[a-z_]+>|extern[ \t]+"C\+\+")/m;Ck="grammars-extended";wg=!1,Ta=null,Ii=new Map,$a=new Map});function jt(e,t){let n=[...e.namedChildren].reverse();for(;n.length;){let r=n.pop();if(t(r))return r;let o=r.namedChildren;for(let s=o.length-1;s>=0;s--)n.push(o[s])}}function xg(e){switch(e.type){case"operator_name":return e.text.replace(/\s+/g,"").replace(/^operator(?=\w)/,"operator ");case"operator_cast":{let t=e.text.split("(")[0].replace(/\s+/g," ").replace(/\s*([*&])\s*/g,"$1").trim();return t.length>8?t:void 0}case"destructor_name":return e.text.replace(/\s+/g,"")}}function $d(e){return e.childForFieldName("declarator")??(Ak.has(e.type)?e.namedChildren[0]??null:null)}function Lr(e){let t=e.childForFieldName("name");if(t?.text)return t.text;let n=e.childForFieldName("declarator");for(;n;){let s=n.childForFieldName("name");if(s?.text){if(s.type==="qualified_identifier"){n=s;continue}return xg(s)??s.text}if(n.namedChildren.length===0&&/(^|_)identifier$/.test(n.type))return n.text;let a=xg(n);if(a)return a;let l=$d(n);if(!l||l===n)break;n=l}let o=jt(e,s=>s.type==="variable_declarator")?.childForFieldName("name");if(o?.text)return o.text;for(let s of e.namedChildren)if(/(^|_)(identifier|name|constant)$/.test(s.type))return s.text}function Pr(e){if(!e)return;let t=e.namedChildren;if(t.length===0)return As.test(e.type)?e.text:void 0;let n=e.childForFieldName("name")??e.childForFieldName("property")??e.childForFieldName("attribute")??e.childForFieldName("field")??e.childForFieldName("function");if(n)return Pr(n);let r=t[t.length-1];return r&&r!==e?Pr(r):void 0}function Fi(e){if(!e||e.namedChildren.length===0)return;let t=e.childForFieldName("object")??e.childForFieldName("operand")??e.childForFieldName("value")??e.childForFieldName("path")??e.childForFieldName("expression")??e.childForFieldName("argument")??e.childForFieldName("receiver")??e.childForFieldName("table");if(t?.type==="super"||t?.type==="crate"&&e.type==="scoped_identifier")return t.type;if(t?.type==="composite_literal"){let r=t.childForFieldName("type"),o=r?xt(r):void 0;return o&&/^[A-Za-z_]\w*$/.test(o)?o:void 0}let n=t?Pr(t):void 0;return n&&/^[A-Za-z_]\w*$/.test(n)?n:void 0}function xt(e){if(!e)return;let t=e.childForFieldName("type")??e.childForFieldName("name");if(t&&/generic|qualified|scoped|nested/.test(e.type))return xt(t);if(e.namedChildren.length===0)return Sg.test(e.type)?e.text:void 0;let n,r=o=>{if(o.namedChildren.length===0){Sg.test(o.type)&&(n=o.text);return}if(!/arguments|parameters|argument_list/.test(o.type))for(let s of o.namedChildren)r(s)};return r(e),n}var As,Pa,Ak,Sg,La=z(()=>{"use strict";$();As=/(^|_)(identifier|name|constant|word)$/,Pa=/(^|_)comment$/;Ak=new Set(["reference_declarator","parenthesized_declarator"]);Sg=/identifier|constant|(^|_)name$/});function Fk(e){let t=[],n=e.previousNamedSibling,r=e.startPosition.row;for(;n;){let s=Ik.test(n.type);if(!s&&!Tk.test(n.type)||r-n.endPosition.row>1)break;s&&t.push(n),r=n.startPosition.row,n=n.previousNamedSibling}if(!t.length)return[];t.reverse();let o=[];for(let s of t)for(let a of s.text.split(/\r?\n/))o.push(Ht(a));return o}function sr(e){let t=e;for(;t;){let n=Fk(t);if(n.length){let s=Ar(n);if(s)return s}let r=t.parent;if(!r||!$k.has(r.type))return;let o=t.previousNamedSibling;if(o&&!Ok.test(o.type))return;t=r}}function kg(e){let n=e.childForFieldName("body")?.namedChildren[0];if(!n)return;let r=n.type==="string"?n:n.type==="expression_statement"?n.namedChildren[0]:void 0;if(!(!r||r.type!=="string"))return Ar(r.text.split(/\r?\n/).map(Ht))}var Ik,$k,Tk,Ok,Td=z(()=>{"use strict";$();pi();Ik=/(^|_)comment$/,$k=new Set(["export_statement","ambient_declaration","decorated_definition","template_declaration","labeled_statement","lexical_declaration","variable_declaration","type_declaration","const_declaration","var_declaration","body_statement","body"]),Tk=/^(attribute_item|decorator)$/;Ok=/decorator|annotation|modifiers/});function pt(e){if(!e)return[];let t=[];for(let n of e.namedChildren){if(/arguments|parameters/.test(n.type))continue;let r=xt(n);r&&t.push(r)}return t}function Eg(e,t){if(!t.self)return[];let n=Ze(e,"class_heritage");if(!n)return[];let r=n.namedChildren.some(s=>s.type.endsWith("_clause")),o=[];for(let s of pt(r?Ze(n,"extends_clause"):n))o.push(Xe("extends",t.self,s,e));for(let s of pt(Ze(n,"implements_clause")))o.push(Xe("implements",t.self,s,e));return o}function Oi(e,t,n){return pt(e).map((o,s)=>Xe(s===0?"extends":"implements",t,o,n))}function jk(e){for(let t=e.parent;t&&t.type!=="module";t=t.parent)if(t.type==="if_statement"&&Dk.test(t.childForFieldName("condition")?.text??""))return!0;return!1}function Bk(e){let t=new Set,n=!1,r=c=>{if(c?.type!=="string"||c.namedChildren.some(u=>u.type==="interpolation"))return;let d=c.namedChildren.filter(u=>u.type==="string_content");return d.length<=1?d[0]?.text??"":void 0},o=c=>{if(c?.type!=="list"&&c?.type!=="tuple")return;let d=[];for(let u of c.namedChildren){let f=r(u);if(f===void 0)return;d.push(f)}return d},s=c=>c?.type==="identifier"&&c.text==="__all__",a=c=>{let d=c.namedChildren[0];if(!d)return[];if((d.type==="assignment"||d.type==="augmented_assignment")&&s(d.childForFieldName("left"))){if(d.type==="assignment")n=!0;else if(d.childForFieldName("operator")?.text!=="+=")return;return o(d.childForFieldName("right"))}let u=d.type==="call"?d.childForFieldName("function"):null;if(u?.type!=="attribute"||!s(u.childForFieldName("object")))return[];let f=d.childForFieldName("arguments")?.namedChildren,m=u.childForFieldName("attribute")?.text;if(m==="extend"&&f?.length===1)return o(f[0]);let p=m==="append"&&f?.length===1?r(f[0]):void 0;return p===void 0?void 0:[p]},l=c=>{for(let d of c.namedChildren){if(Wk.has(d.type)){if(!l(d))return!1;continue}if(d.type!=="expression_statement")continue;let u=a(d);if(u===void 0)return!1;for(let f of u)t.add(f)}return!0};return l(e)&&n?t:void 0}function Ig(e){if(e.type!=="type_definition")return[];let t=Pd(e),n=t?.childForFieldName("name")?.text;return t&&n&&n!==Lr(e)?[{name:n,kind:jg[t.type]}]:[]}function $g(e){if(e.childForFieldName("value"))return!1;let t=e.parent;return t?.type!=="preproc_ifdef"||t.namedChildCount<=2||t.childForFieldName("name")?.text!==e.childForFieldName("name")?.text?!1:t.firstChild?.type==="#ifndef"}function Tg(e){let t=e.childForFieldName("declarator");for(;t&&t.type!=="qualified_identifier";)t=$d(t);let n=null;for(;t?.type==="qualified_identifier";)n=t.childForFieldName("scope"),t=t.childForFieldName("name");return n?xt(n):void 0}function Fg(e,t){if(t)return/\b(val|var)\s*$/.exec(e.text.slice(0,t.startIndex-e.startIndex))?.[1]}function Wa(e){if(!e)return;if(e.type==="identifier")return{name:e.text};if(e.type!=="dot_index_expression"&&e.type!=="method_index_expression")return;let t=e.childForFieldName("table"),n=e.childForFieldName("field")??e.childForFieldName("method");return t&&n&&/^[\w.]+$/.test(t.text)?{name:n.text,table:t.text}:void 0}function Pg(e){if(e.childForFieldName("left")?.type!=="constant")return;let t=e.childForFieldName("right");if(t?.type==="call")return zk[`${t.childForFieldName("receiver")?.text}.${t.childForFieldName("method")?.text}`]}function Gk(e,t){if(t.inFunctionBody||e.type!=="method_definition"||e.childForFieldName("name")?.text!=="constructor")return[];let n=[];for(let r of e.childForFieldName("parameters")?.namedChildren??[]){if(r.type!=="required_parameter"&&r.type!=="optional_parameter"||!r.children.some(s=>s.type==="accessibility_modifier"||s.type==="override_modifier"||s.type==="readonly"))continue;let o=r.childForFieldName("pattern");o?.type==="identifier"&&n.push({name:o.text,kind:"property",node:r})}return n}function qk(e,t){if(t.inFunctionBody||e.type!=="method_declaration")return[];if(!/^__construct$/i.test(e.childForFieldName("name")?.text??""))return[];let n=[];for(let r of e.childForFieldName("parameters")?.namedChildren??[]){if(r.type!=="property_promotion_parameter")continue;let o=r.childForFieldName("name")?.text.replace(/^\$/,"");o&&n.push({name:o,kind:"property",node:r})}return n}var Ze,Xe,Dg,Ld,Ba,vg,Fd,Nk,Rg,Cg,Pk,Ni,Lk,Dk,Wk,Da,Od,Mg,Ag,ja,jg,Pd,Og,Wg,Uk,Ng,zk,Hk,Lg,Nd,Dd,Bg=z(()=>{"use strict";$();La();Td();Ze=(e,t)=>e.namedChildren.find(n=>n.type===t),Xe=(e,t,n,r)=>({kind:e,from:t,to:n,line:r.startPosition.row+1});Dg=new Set(["interface","trait","enum","protocol","annotation"]),Ld=new Set(["function","method","def","constructor","operator"]),Ba=new Set(["function","function_expression","arrow_function","generator_function","class","function_definition","lambda"]),vg=(e,t,n)=>/\b(public|internal)\b/.test(n),Fd=(e,t,n)=>!/\b(private|protected)\b/.test(n),Nk=e=>!/^local\b/.test(e),Rg=(e,t,n)=>/\bpub\b/.test(n),Cg=(e,t)=>/^[A-Z]/.test(t),Pk=(e,t)=>!t.startsWith("_")||/^__\w+__$/.test(t),Ni=()=>!0,Lk=()=>!1,Dk=/^(__name__\s*==\s*(["'])__main__\2|(["'])__main__\3\s*==\s*__name__)$/;Wk=new Set(["block","if_statement","elif_clause","else_clause","try_statement","except_clause","finally_clause","with_statement"]);Da=e=>jt(e,t=>t.type==="function_declarator"||t.type==="operator_cast")!==void 0,Od=e=>t=>t.childrenForFieldName(e).flatMap(n=>/identifier$/.test(n.type)?n.text:[]),Mg=e=>(Ze(e,"variable_declaration")?.namedChildren??[]).flatMap(t=>t.type==="variable_declarator"?t.childForFieldName("name")?.text??[]:[]),Ag=e=>e.childrenForFieldName("declarator").flatMap(t=>t.childForFieldName("name")?.text??[]),ja=e=>e.childrenForFieldName("declarator").flatMap(t=>t.namedChildren.length>0?Lr(t)??[]:/identifier$/.test(t.type)?t.text:[]),jg={struct_specifier:"struct",union_specifier:"union",enum_specifier:"enum",class_specifier:"class"},Pd=e=>{let t=e.childForFieldName("type");return t&&jg[t.type]&&t.childForFieldName("body")?t:void 0};Og={defmodule:"module",defprotocol:"protocol",defimpl:"impl",defstruct:"struct",defexception:"exception",def:"function",defp:"function",defmacro:"macro",defmacrop:"macro",defguard:"guard",defguardp:"guard",defdelegate:"function"},Wg=e=>e.type==="binary_operator"&&e.childForFieldName("operator")?.text==="when",Uk=e=>Wg(e)?e.childForFieldName("left")??e:e;Ng={public:!0,private:!1,protected:!1,module_function:!0,public_class_method:!0,private_class_method:!1},zk={"Struct.new":"class","Class.new":"class","Data.define":"class","Module.new":"module"};Hk=new Set(["resource","data","variable","output","module","provider","locals","terraform"]),Lg={lang:"terraform",defs:{block:"block"},containers:new Set(["config_file","body"]),exported:Ni,kindFrom:{block:e=>{let t=e.namedChildren.find(n=>n.type==="identifier")?.text;return t&&Hk.has(t)?t:void 0}},nameFrom:{block:e=>{let t=e.namedChildren.filter(n=>n.type==="string_lit").map(n=>n.text.replace(/^"|"$/g,""));return t.length?t.join("."):e.namedChildren.find(n=>n.type==="identifier")?.text}}};Nd={lang:"typescript",defs:{function_declaration:"function",generator_function_declaration:"function",function_signature:"function",class_declaration:"class",abstract_class_declaration:"class",interface_declaration:"interface",type_alias_declaration:"type",enum_declaration:"enum",enum_assignment:"enum-member",method_definition:"method",method_signature:"method",abstract_method_signature:"method",property_signature:"property",public_field_definition:"property",call_signature:"call-signature",construct_signature:"construct-signature",index_signature:"index-signature",internal_module:"namespace",module:"namespace",variable_declarator:"const"},containers:new Set(["class_body","export_statement","ambient_declaration","program","lexical_declaration","variable_declaration","interface_body","object_type","enum_body","statement_block","try_statement","catch_clause","finally_clause","if_statement","else_clause","for_statement","for_in_statement","while_statement","do_statement","switch_statement","switch_body","switch_case","switch_default","labeled_statement","return_statement","expression_statement","call_expression","arguments","arrow_function","function_expression","function","parenthesized_expression"]),exported:Lk,exportMarkers:new Set(["export_statement","ambient_declaration"]),bareMembers:{enum_body:"enum-member"},nameFrom:{call_signature:()=>"(call)",construct_signature:()=>"(construct)",index_signature:e=>`[${e.namedChildren.find(t=>t.type==="identifier")?.text??"key"}]`},privateMember:e=>{for(let t of e.namedChildren)if(t.type==="accessibility_modifier"&&/^(private|protected)/.test(t.text)||t.type==="private_property_identifier")return!0;return!1},imports:{import_statement:"string"},calls:{call_expression:"function",new_expression:"constructor"},assignments:!0,extraMembers:Gk,relationsFrom:{class_declaration:Eg,abstract_class_declaration:Eg,interface_declaration:(e,t)=>t.self?pt(Ze(e,"extends_type_clause")).map(n=>Xe("extends",t.self,n,e)):[]}},Dd={typescript:Nd,tsx:{...Nd,lang:"typescript"},javascript:{...Nd,lang:"javascript",defs:{function_declaration:"function",generator_function_declaration:"function",class_declaration:"class",method_definition:"method",field_definition:"property",variable_declarator:"const"}},python:{lang:"python",defs:{function_definition:"function",class_definition:"class"},containers:new Set(["block","decorated_definition","module","if_statement","elif_clause","else_clause","try_statement","except_clause","finally_clause","with_statement","match_statement","case_clause"]),exported:Pk,publicNames:Bk,imports:{import_statement:"path",import_from_statement:"path"},calls:{call:"function"},docstring:!0,relationsFrom:{class_definition:(e,t)=>t.self?pt(e.childForFieldName("superclasses")).map(n=>Xe("extends",t.self,n,e)):[]},extraMembers:(e,t)=>{if(t.inFunctionBody)return[];if(e.type==="import_from_statement"){let s=[],a=e.childForFieldName("module_name");for(let l of e.namedChildren)if(!(a&&l.startIndex===a.startIndex))if(l.type==="aliased_import"){let c=l.namedChildren[0]?.text,d=l.childForFieldName("alias")?.text;d&&(c===d||t.ownerKind===void 0&&t.publicNames?.has(d))&&s.push({name:d,kind:"reexport"})}else l.type==="dotted_name"&&t.ownerKind===void 0&&t.publicNames?.has(l.text)&&s.push({name:l.text,kind:"reexport"});return s}if(e.type!=="expression_statement")return[];let n=e.namedChildren[0];if(!n||n.type!=="assignment")return[];if(jk(e))return[];let r=[];for(let s=n;s?.type==="assignment";s=s.childForFieldName("right")){let a=s.childForFieldName("left");if(a?.type==="identifier")r.push(a.text);else if(a&&/^(pattern_list|tuple_pattern|list_pattern)$/.test(a.type))for(let l of a.namedChildren){let c=l.type==="list_splat_pattern"?l.namedChildren[0]:l;c?.type==="identifier"&&r.push(c.text)}}let o=t.ownerKind==="class"?"field":"const";return r.map(s=>({name:s,kind:o}))}},go:{lang:"go",defs:{function_declaration:"function",method_declaration:"method",type_spec:"type",type_alias:"type",const_spec:"const",var_spec:"var",field_declaration:"field",method_spec:"method",method_elem:"method",package_clause:"package"},containers:new Set(["type_declaration","const_declaration","var_declaration","var_spec_list","source_file","struct_type","interface_type","field_declaration_list"]),exported:Cg,imports:{import_declaration:"string"},calls:{call_expression:"function"},parentFrom:{method_declaration:e=>xt(e.childForFieldName("receiver"))},nameFrom:{field_declaration:e=>e.childForFieldName("name")?.text},namesFrom:{var_spec:Od("name"),const_spec:Od("name"),field_declaration:Od("name")},relationsFrom:{field_declaration:(e,t)=>{if(!t.self||e.childForFieldName("name"))return[];let n=xt(e.childForFieldName("type"));return n?[Xe("extends",t.self,n,e)]:[]}}},ruby:{lang:"ruby",defs:{method:"def",singleton_method:"def",class:"class",module:"module"},containers:new Set(["class","module","body_statement","program","singleton_class","block_body"]),sectionScopes:new Set(["singleton_class"]),exported:Ni,kindFrom:{assignment:Pg},nameFrom:{assignment:e=>e.childForFieldName("left")?.text},bodyFrom:{assignment:e=>e.childForFieldName("right")?.childForFieldName("block")?.childForFieldName("body")??void 0},inlineVisibility:e=>{if(e.type!=="call"||e.childForFieldName("receiver"))return;let t=Ng[e.childForFieldName("method")?.text??""];if(t===void 0)return;let n=(e.childForFieldName("arguments")?.namedChildren??[]).filter(r=>r.type==="method"||r.type==="singleton_method"||r.type==="call");return n.length?{nodes:n,public:t}:void 0},docFrom:e=>{let t=e.parent?.type==="argument_list"?e.parent.parent:null;return t?.type==="call"&&Ng[t.childForFieldName("method")?.text??""]!==void 0?sr(t):void 0},calls:{call:"function"},sectionVisibility:e=>(e.type==="identifier"||e.type==="call")&&/^(private|protected)$/.test(e.text)?!1:e.type==="identifier"&&e.text==="public"?!0:void 0,relationsFrom:{class:(e,t)=>{if(!t.self)return[];let n=xt(e.childForFieldName("superclass"));return n?[Xe("extends",t.self,n,e)]:[]},call:(e,t)=>{let n=e.childForFieldName("method"),r=e.childForFieldName("receiver");if(!t.self||!n||!/^(include|prepend|extend)$/.test(n.text))return[];if(r&&r.type!=="self")return[];let o=[];for(let s of e.childForFieldName("arguments")?.namedChildren??[]){let a=xt(s);a&&o.push(Xe("implements",t.self,a,e))}return o}},extraMembers:(e,t)=>{if(t.inFunctionBody)return[];if(e.type==="assignment"){let n=e.childForFieldName("left");return n?.type==="constant"&&!Pg(e)?[{name:n.text,kind:"const"}]:[]}if(e.type==="call"){let n=e.childForFieldName("method");if(!n||!/^attr_(reader|writer|accessor)$/.test(n.text))return[];let r=e.childForFieldName("arguments"),o=[];for(let s of r?.namedChildren??[])s.type==="simple_symbol"&&o.push({name:s.text.replace(/^:/,""),kind:"attr"});return o}return[]}},java:{lang:"java",defs:{class_declaration:"class",interface_declaration:"interface",annotation_type_declaration:"annotation",enum_declaration:"enum",enum_constant:"enum-member",record_declaration:"record",method_declaration:"method",constructor_declaration:"constructor",compact_constructor_declaration:"constructor",field_declaration:"field",constant_declaration:"field",annotation_type_element_declaration:"method"},containers:new Set(["class_body","interface_body","enum_body","enum_body_declarations","annotation_type_body","program","formal_parameters"]),exported:vg,imports:{import_declaration:"path"},calls:{method_invocation:"function",object_creation_expression:"constructor"},kindFrom:{formal_parameter:e=>e.parent?.parent?.type==="record_declaration"?"field":void 0},publicMember:e=>e.parent?.parent?.type==="record_declaration",nameFrom:{field_declaration:e=>jt(e,t=>t.type==="variable_declarator")?.childForFieldName("name")?.text,constant_declaration:e=>jt(e,t=>t.type==="variable_declarator")?.childForFieldName("name")?.text},namesFrom:{field_declaration:Ag,constant_declaration:Ag},relationsFrom:{class_declaration:(e,t)=>{if(!t.self)return[];let n=[];for(let o of pt(e.childForFieldName("superclass")))n.push(Xe("extends",t.self,o,e));let r=e.childForFieldName("interfaces");for(let o of pt(Ze(r??e,"type_list")??r))n.push(Xe("implements",t.self,o,e));return n},interface_declaration:(e,t)=>{let n=e.childForFieldName("interfaces")??Ze(e,"extends_interfaces");return t.self?pt(Ze(n??e,"type_list")??n).map(r=>Xe("extends",t.self,r,e)):[]},record_declaration:(e,t)=>{let n=e.childForFieldName("interfaces");return t.self?pt(Ze(n??e,"type_list")??n).map(r=>Xe("implements",t.self,r,e)):[]}}},rust:{lang:"rust",defs:{function_item:"function",function_signature_item:"function",struct_item:"struct",enum_item:"enum",enum_variant:"enum-member",field_declaration:"field",trait_item:"trait",type_item:"type",associated_type:"type",mod_item:"mod",const_item:"const",static_item:"static",union_item:"union",macro_definition:"macro"},containers:new Set(["impl_item","declaration_list","source_file","field_declaration_list","enum_variant_list","foreign_mod_item","block"]),exported:Rg,calls:{call_expression:"function"},parentFrom:{impl_item:e=>xt(e.childForFieldName("type"))},nestedDefs:new Set(["const_item","static_item"]),publicMembersIn:{impl_item:e=>e.childForFieldName("trait")!==null},relationsFrom:{impl_item:(e,t)=>{let n=xt(e.childForFieldName("trait"));return t.self&&n?[Xe("implements",t.self,n,e)]:[]}}},c_sharp:{lang:"csharp",defs:{class_declaration:"class",interface_declaration:"interface",struct_declaration:"struct",enum_declaration:"enum",enum_member_declaration:"enum-member",record_declaration:"record",delegate_declaration:"delegate",method_declaration:"method",constructor_declaration:"constructor",property_declaration:"property",indexer_declaration:"indexer",operator_declaration:"operator",field_declaration:"field",event_declaration:"event",event_field_declaration:"event",conversion_operator_declaration:"operator",destructor_declaration:"destructor"},containers:new Set(["namespace_declaration","declaration_list","compilation_unit","file_scoped_namespace_declaration","enum_member_declaration_list","parameter_list"]),exported:vg,calls:{invocation_expression:"function",object_creation_expression:"constructor"},kindFrom:{parameter:e=>e.parent?.parent?.type==="record_declaration"?"field":void 0},publicMember:e=>e.parent?.parent?.type==="record_declaration",nameFrom:{field_declaration:e=>jt(e,t=>t.type==="variable_declarator")?.childForFieldName("name")?.text,event_field_declaration:e=>jt(e,t=>t.type==="variable_declarator")?.childForFieldName("name")?.text,conversion_operator_declaration:e=>e.childForFieldName("type")?.text,operator_declaration:e=>{let t=e.childForFieldName("operator")?.text;return t?`operator${/^\w/.test(t)?" ":""}${t}`:void 0},indexer_declaration:()=>"this[]"},namesFrom:{field_declaration:e=>Mg(e),event_field_declaration:e=>Mg(e)},relationsFrom:{class_declaration:(e,t)=>t.self?Oi(Ze(e,"base_list"),t.self,e):[],struct_declaration:(e,t)=>t.self?Oi(Ze(e,"base_list"),t.self,e):[],record_declaration:(e,t)=>t.self?Oi(Ze(e,"base_list"),t.self,e):[],interface_declaration:(e,t)=>t.self?pt(Ze(e,"base_list")).map(n=>Xe("extends",t.self,n,e)):[]}},php:{lang:"php",defs:{function_definition:"function",class_declaration:"class",interface_declaration:"interface",trait_declaration:"trait",enum_declaration:"enum",enum_case:"enum-member",method_declaration:"method",property_declaration:"property",const_declaration:"const",namespace_definition:"namespace"},containers:new Set(["declaration_list","enum_declaration_list","program"]),exported:Fd,calls:{function_call_expression:"function",member_call_expression:"member",object_creation_expression:"constructor"},extraMembers:qk,nameFrom:{property_declaration:e=>jt(e,t=>t.type==="variable_name")?.text.replace(/^\$/,""),const_declaration:e=>jt(e,t=>t.type==="const_element")?.namedChildren[0]?.text},namesFrom:{property_declaration:e=>e.namedChildren.flatMap(t=>t.type==="property_element"?t.childForFieldName("name")?.text.replace(/^\$/,"")??[]:[]),const_declaration:e=>e.namedChildren.flatMap(t=>t.type==="const_element"?t.namedChildren[0]?.text??[]:[])},relationsFrom:{class_declaration:(e,t)=>{if(!t.self)return[];let n=[];for(let r of pt(Ze(e,"base_clause")))n.push(Xe("extends",t.self,r,e));for(let r of pt(Ze(e,"class_interface_clause")))n.push(Xe("implements",t.self,r,e));return n},interface_declaration:(e,t)=>t.self?pt(Ze(e,"base_clause")).map(n=>Xe("extends",t.self,n,e)):[]}},c:{lang:"c",defs:{function_definition:"function",struct_specifier:"struct",enum_specifier:"enum",enumerator:"enum-member",union_specifier:"union",type_definition:"type",field_declaration:"field",declaration:"const",preproc_def:"macro",preproc_function_def:"macro"},containers:new Set(["translation_unit","declaration_list","field_declaration_list","enumerator_list","linkage_specification","preproc_ifdef","preproc_if"]),exported:Ni,calls:{call_expression:"function"},kindFrom:{field_declaration:e=>Da(e)?"method":"field",declaration:e=>Da(e)?"function":"const"},nameFrom:{preproc_def:e=>$g(e)?void 0:e.childForFieldName("name")?.text},namesFrom:{field_declaration:ja,declaration:ja},bodyFrom:{type_definition:Pd},extraMembers:Ig},cpp:{lang:"cpp",defs:{function_definition:"function",class_specifier:"class",struct_specifier:"struct",enum_specifier:"enum",enumerator:"enum-member",union_specifier:"union",type_definition:"type",alias_declaration:"type",concept_definition:"concept",namespace_definition:"namespace",namespace_alias_definition:"namespace",field_declaration:"field",declaration:"const",using_declaration:"using",friend_declaration:"friend",preproc_def:"macro",preproc_function_def:"macro"},containers:new Set(["translation_unit","declaration_list","field_declaration_list","enumerator_list","template_declaration","linkage_specification","preproc_ifdef","preproc_if"]),exported:Ni,calls:{call_expression:"function",new_expression:"constructor"},kindFrom:{field_declaration:e=>Da(e)?"method":"field",declaration:e=>Da(e)?"function":"const"},sectionVisibility:e=>e.type==="access_specifier"?!/^(private|protected)/.test(e.text):void 0,nameFrom:{friend_declaration:e=>Lr(e)??(e.namedChildren[0]?Lr(e.namedChildren[0]):void 0),preproc_def:e=>$g(e)?void 0:e.childForFieldName("name")?.text},namesFrom:{field_declaration:ja,declaration:ja},parentFrom:{function_definition:Tg,declaration:Tg},bodyFrom:{type_definition:Pd},extraMembers:Ig,relationsFrom:{class_specifier:(e,t)=>t.self?pt(Ze(e,"base_class_clause")).map(n=>Xe("extends",t.self,n,e)):[],struct_specifier:(e,t)=>t.self?pt(Ze(e,"base_class_clause")).map(n=>Xe("extends",t.self,n,e)):[]}},scala:{lang:"scala",defs:{class_definition:"class",object_definition:"object",trait_definition:"trait",enum_definition:"enum",function_definition:"def",function_declaration:"def",val_definition:"val",val_declaration:"val",var_definition:"var",type_definition:"type",given_definition:"given",package_clause:"package"},containers:new Set(["compilation_unit","package_clause","template_body","class_parameters","parameters","extension_definition"]),parentFrom:{extension_definition:e=>xt(Ze(e,"parameters")?.namedChildren[0]?.childForFieldName("type")??null)},exported:Fd,kindFrom:{class_parameter:e=>{let t=Fg(e,e.childForFieldName("name"));return t||(e.parent?.parent?.type==="class_definition"&&/\bcase\s+class\b/.test(e.parent.parent.text.slice(0,80))?"val":void 0)}},calls:{call_expression:"function",instance_expression:"constructor"},relationsFrom:{class_definition:(e,t)=>t.self?Oi(Ze(e,"extends_clause"),t.self,e):[],object_definition:(e,t)=>t.self?Oi(Ze(e,"extends_clause"),t.self,e):[],trait_definition:(e,t)=>t.self?pt(Ze(e,"extends_clause")).map(n=>Xe("extends",t.self,n,e)):[]}},bash:{lang:"shell",defs:{function_definition:"function",declaration_command:"const"},containers:new Set(["program","if_statement","compound_statement"]),exported:Ni,calls:{command:"function"},nameFrom:{declaration_command:e=>/^\s*local\b/.test(e.text)?void 0:jt(e,t=>t.type==="variable_name")?.text}},kotlin:{lang:"kotlin",defs:{class_declaration:"class",object_declaration:"object",function_declaration:"function",property_declaration:"property",enum_entry:"enum-member",type_alias:"type",class_parameter:"property"},containers:new Set(["source_file","class_body","enum_class_body","companion_object","object_declaration","primary_constructor","class_parameters"]),exported:Fd,calls:{call_expression:"function"},kindFrom:{class_parameter:e=>Fg(e,e.namedChildren.find(t=>/identifier$/.test(t.type)))||/\bdata\s+class\b/.test(e.parent?.parent?.parent?.text.slice(0,80)??"")?"property":void 0,class_declaration:e=>{let t=e.text.slice(0,80);return/\binterface\b/.test(t)?"interface":/\benum\s+class\b/.test(t)?"enum":/\bannotation\s+class\b/.test(t)?"annotation":"class"}},nameFrom:{property_declaration:e=>jt(e,t=>t.type==="variable_declaration")?.namedChildren[0]?.text??e.namedChildren.find(t=>t.type==="identifier")?.text},relationsFrom:{class_declaration:(e,t)=>{if(!t.self)return[];let n=[];for(let r of Ze(e,"delegation_specifiers")?.namedChildren??[]){let o=xt(r);o&&n.push(Xe(jt(r,s=>s.type==="constructor_invocation")?"extends":"implements",t.self,o,e))}return n}}},elixir:{lang:"elixir",defs:{},containers:new Set(["source","do_block","call","stab_clause"]),exported:e=>!/^\s*def(p|macrop|guardp)\b/.test(e),calls:{call:"function"},kindFrom:{call:e=>Og[e.childForFieldName("target")?.text??e.namedChildren[0]?.text??""]},skipCall:e=>{if(e.parent?.type==="unary_operator")return!0;let t=e.parent,n=t&&Wg(t)&&t.startIndex===e.startIndex?t:e;if(n.parent?.type!=="arguments")return!1;let r=n.parent.parent,o=r?.childForFieldName("target")??r?.namedChildren[0];return o!==void 0&&Og[o.text]!==void 0},docFrom:e=>{let t=e.previousNamedSibling;for(;t&&t.type==="unary_operator";){let n=t.namedChildren[0],r=n?.childForFieldName("target")??n?.namedChildren[0];if(r&&/^(doc|moduledoc)$/.test(r.text)){let o=jt(t,s=>s.type==="string");if(o)return o.text.replace(/^"""|"""$/g,"").replace(/^"|"$/g,"").trim()||void 0}t=t.previousNamedSibling}},nameFrom:{call:e=>{let n=(e.childForFieldName("arguments")??e.namedChildren.find(s=>s.type==="arguments"))?.namedChildren[0];if(!n)return;let r=Uk(n);if(r.type==="alias"||r.type==="identifier")return r.text;if(r.type==="binary_operator")return r.childForFieldName("operator")?.text;let o=r.childForFieldName("target")??r.namedChildren[0];return o&&/identifier|alias/.test(o.type)?o.text:void 0}}},zig:{lang:"zig",defs:{function_declaration:"function",variable_declaration:"const",container_field:"field",test_declaration:"test"},containers:new Set(["source_file","variable_declaration","struct_declaration","enum_declaration","union_declaration","error_set_declaration","opaque_declaration","block"]),exported:Rg,calls:{call_expression:"function"},kindFrom:{variable_declaration:e=>{let t=e.namedChildren.find(n=>n.type==="builtin_function");if(!(t&&/^@(import|cImport)\b/.test(t.text))){for(let n of e.namedChildren){if(n.type==="struct_declaration")return"struct";if(n.type==="enum_declaration")return"enum";if(n.type==="union_declaration")return"union";if(n.type==="error_set_declaration")return"error";if(n.type==="opaque_declaration")return"opaque"}return/^\s*(?:pub\s+)?var\b/.test(e.text.slice(0,24))?"var":"const"}},container_field:e=>e.parent?.type==="enum_declaration"?"enum-member":"field"}},solidity:{lang:"solidity",defs:{contract_declaration:"contract",interface_declaration:"interface",library_declaration:"library",function_definition:"function",constructor_definition:"constructor",modifier_definition:"modifier",event_definition:"event",error_declaration:"error",struct_declaration:"struct",struct_member:"field",enum_declaration:"enum",enum_value:"enum-member",state_variable_declaration:"field",constant_variable_declaration:"const",user_defined_type_definition:"type",fallback_receive_definition:"function"},containers:new Set(["source_file","contract_body","struct_declaration","enum_declaration","enum_body"]),exported:(e,t)=>/\b(public|external)\b/.test(e)?!0:/\b(internal|private)\b/.test(e)?!1:Cg(e,t)||!0,calls:{call_expression:"function"},nameFrom:{state_variable_declaration:e=>e.namedChildren.find(t=>t.type==="identifier")?.text,fallback_receive_definition:e=>/^\s*receive\b/.test(e.text)?"receive":"fallback",enum_value:e=>e.text},relationsFrom:{contract_declaration:(e,t)=>t.self?e.namedChildren.filter(n=>n.type==="inheritance_specifier").map(n=>xt(n)).filter(n=>n!==void 0).map(n=>Xe("extends",t.self,n,e)):[],interface_declaration:(e,t)=>t.self?e.namedChildren.filter(n=>n.type==="inheritance_specifier").map(n=>xt(n)).filter(n=>n!==void 0).map(n=>Xe("extends",t.self,n,e)):[]}},terraform:Lg,hcl:{...Lg,lang:"hcl"},lua:{lang:"lua",defs:{function_declaration:"function"},containers:new Set(["chunk","variable_declaration"]),exported:Nk,calls:{function_call:"function"},assignments:!0,nameFrom:{function_declaration:e=>Wa(e.childForFieldName("name"))?.name},parentFrom:{function_declaration:e=>Wa(e.childForFieldName("name"))?.table}}}});function Ug(e){for(let t of e.children)if(t.type==="{"||t.type==="("||t.type==="[")return t.startIndex}function Zk(e,t){let n,r=s=>{s!==void 0&&s>e.startIndex&&(n===void 0||s{Vk.has(s.type)?r(s.startIndex):r(Jk.get(s.type)?.(s))};r(e.childForFieldName("body")?.startIndex),o(e);for(let s of e.namedChildren){if(n!==void 0&&s.startIndex>=n)break;o(s),zg.has(s.type)&&r(s.childForFieldName("body")?.startIndex);let a;for(let l of s.namedChildren){if(n!==void 0&&l.startIndex>=n)break;o(l),zg.has(l.type)&&(a===void 0&&(a=s.childForFieldName("value")??s.childForFieldName("right")),a?.startIndex===l.startIndex&&r(l.childForFieldName("body")?.startIndex))}}if(n===void 0&&t.startsWith("end",e.endIndex-3)){let s=e.children,a=s.length-1;if(s[a]?.type==="end"){for(;a>0&&s[a-1].type===";";)a--;r(s[a].startIndex)}}return n}function Qk(e,t,n){let r=[],o=s=>{for(let a of s.namedChildren){if(a.startIndex>=n)return;a.endIndex<=t||(Pa.test(a.type)?r.push(a):As.test(a.type)||o(a))}};return o(e),r}function ir(e,t){let n=e.startIndex,r=Math.min(Zk(e,t)??e.endIndex,n+Xk),o=t.slice(n,r),s="",a=n;for(let l of Yk.test(o)?Qk(e,n,r):[])for(s=Hg(s,t.slice(a,Math.max(a,l.startIndex)).replace(/[ \t]+$/,"")),a=Math.min(l.endIndex,r);a|=)$/,"").trim().slice(0,Kk)}var Vk,Jk,zg,Kk,Xk,Yk,Hg,Gg=z(()=>{"use strict";$();La();Vk=new Set(["block","statement_block","class_body","declaration_list","field_declaration_list","template_body","compound_statement","body_statement","enum_body","enum_body_declarations","enum_variant_list","enum_member_declaration_list","enumerator_list","interface_body","object_type","do_block","struct_declaration","enum_declaration","union_declaration","error_set_declaration","opaque_declaration","contract_body","enum_class_body"]),Jk=new Map([["interface_type",e=>e.namedChildren.some(t=>t.type==="method_elem")?Ug(e):void 0],["macro_definition",e=>Ug(e)],["preproc_function_def",e=>e.childForFieldName("value")?.startIndex]]);zg=new Set(["arrow_function","function_expression","function","generator_function","function_definition","lambda","lambda_expression"]),Kk=400,Xk=4096;Yk=/\/[/*]|#|--|=begin/;Hg=(e,t)=>e&&t&&!/[\s([{]$/.test(e)&&!/^[\s,;)\]}]/.test(t)?`${e} ${t}`:e+t});function jd(e){return e.replace(/^['"`]|['"`]$/g,"")}function nE(e,t){if(e.type==="import_statement"){let n=e.childForFieldName("source");if(!n)return;let r=jd(n.text);for(let o of e.namedChildren)if(o.type==="import_clause"){for(let s of o.namedChildren)if(s.type==="identifier")t.push({local:s.text,name:"default",from:r});else if(s.type==="namespace_import"){let a=s.namedChildren.find(l=>l.type==="identifier");a&&t.push({local:a.text,name:"*",from:r})}else if(s.type==="named_imports")for(let a of s.namedChildren){if(a.type!=="import_specifier")continue;let l=a.childForFieldName("name")?.text,c=a.childForFieldName("alias")?.text;l&&c&&c!==l&&t.push({local:c,name:jd(l),from:r})}}}else if(e.type==="export_statement"&&e.children.some(n=>n.type==="default")){let n=e.childForFieldName("declaration"),r=n?n.childForFieldName("name")?.text:e.childForFieldName("value")?.type==="identifier"?e.childForFieldName("value").text:void 0;r&&t.push({local:"default",name:r})}}function qg(e,t){if(e.type==="import_statement"){for(let n of e.namedChildren)if(n.type==="dotted_name"){let r=n.namedChildren[0]?.text;r&&t.push({local:r,name:"*",from:r})}else if(n.type==="aliased_import"){let r=n.childForFieldName("name")?.text,o=n.childForFieldName("alias")?.text;r&&o&&t.push({local:o,name:"*",from:r})}}else if(e.type==="import_from_statement"){let n=e.childForFieldName("module_name")?.text;if(!n)return;for(let r of e.namedChildren){if(r.type!=="aliased_import")continue;let o=r.childForFieldName("name")?.text,s=r.childForFieldName("alias")?.text;o&&s&&s!==o&&t.push({local:s,name:o,from:n})}}else if(tE.has(e.type))for(let n of e.namedChildren)qg(n,t)}function Vg(e,t){if(e.type==="import_declaration"||e.type==="import_spec_list")for(let n of e.namedChildren)Vg(n,t);else if(e.type==="import_spec"){let n=e.childForFieldName("name"),r=e.childForFieldName("path");n?.type==="package_identifier"&&r&&t.push({local:n.text,name:"*",from:jd(r.text)})}}function Jg(e,t){let n=t==="typescript"||t==="javascript"?nE:t==="python"?qg:t==="go"?Vg:void 0;if(!n)return[];let r=[];for(let a of e.namedChildren)n(a,r);let o=new Set,s=[];for(let a of r.sort((l,c)=>T(l.local,c.local)||T(l.name,c.name)||T(l.from??"",c.from??""))){let l=`${a.local}\0${a.name}\0${a.from??""}`;if(!o.has(l)&&(o.add(l),s.push(a),s.length>=eE))break}return s}var eE,tE,Kg=z(()=>{"use strict";$();de();eE=256,tE=new Set(["if_statement","elif_clause","else_clause","try_statement","except_clause","finally_clause","with_statement","block"])});function wE(e){let t=Zg.get(e);return t===void 0&&(t=(mE.test(e)?Yg:0)|(Pa.test(e)?Qg:0)|(gE.test(e)?Ua:0)|(hE.test(e)?eh:0)|(yE.test(e)?th:0),Zg.set(e,t)),t}function xE(e){return e.namedChildren.every(t=>_E.test(t.type))}function SE(e){let t=e.parent;return t!==null&&t.type==="expression_statement"&&t.namedChildCount===1}function za(e,t){let n=e.slice();if(e.length>t){let r=new Uint8Array(e.length),o=new Set,s=0;for(let a=0;ar[l]===1)}return n.sort((r,o)=>T(r.name,o.name)||r.line-o.line||T(r.receiver??"",o.receiver??""))}function kE(e,t,n,r){let o=new Set,s=t.calls!==void 0,a=[],l=new Set,c=(h,_,y)=>{if(!h||h==="_"||!/^[A-Za-z_]\w*$/.test(h))return;let b=_.startPosition.row+1,S=`${h} ${b} ${y??""}`;l.has(S)||(l.add(S),a.push(y?{name:h,line:b,receiver:y}:{name:h,line:b}))},d=new Set,u=h=>{if(!(d.size>=Xg))for(let _ of bn(h)){if(d.size>=Xg)return;d.add(_)}},f=new nr,m=t.imports?.import_statement!==void 0,p=new Set,g=[e];for(;g.length;){let h=g.pop(),_=h.type,y=h.namedChildren,b=wE(_);if(y.length===0&&b&Yg){let k=h.text;pE.test(k)&&!n.has(k)&&o.add(k)}let S=b&Ua?xE(h):!1;if(b&Qg)for(let k of h.text.split(/\r?\n/))u(Ht(k));else if(b&Ua&&h.endIndex-h.startIndex<=aE)if(S)u(yd(h.text));else for(let k of y)bE.test(k.type)&&u(k.text);if(f.full||(b&Ua?S&&!SE(h)&&f.addString(h.text,h.startPosition.row+1):y.length===0&&b&eh?f.add("number",h.text.trim(),h.startPosition.row+1):b&th&&f.add("regex",h.text,h.startPosition.row+1)),s&&!(t.kindFrom?.[_]&&t.kindFrom[_](h))&&!t.skipCall?.(h)){let k=t.calls[_];if(k==="function"){let C=h.childForFieldName("function")??h.childForFieldName("callee")??h.childForFieldName("method")??h.childForFieldName("name")??h.childForFieldName("target")??y[0]??null,I=C&&t.calls[C.type]==="function"?C.childForFieldName("function"):null;c(Pr(C),h,Fi(I??C)??Fi(h))}else if(k==="member")c(Pr(h.childForFieldName("name")),h,Fi(h));else if(k==="constructor"){let C=h.childForFieldName("constructor")??h.childForFieldName("type")??h.childForFieldName("name");for(let I=0;!C&&I=0;k--)g.push(y[k])}return{idents:[...o].slice(0,rE).sort(),calls:za(a,r),importedNames:[...p].slice(0,sE).sort(T),terms:[...d].sort(T),literals:f.result()??[]}}function vE(e,t){let n=(r,o)=>{for(let s of r.namedChildren)if(s.namedChildren.length===0){if(s.text===t)return s.startIndex}else if(o<3&&!EE.test(s.type)){let a=n(s,o+1);if(a!==void 0)return a}};return n(e,0)}function or(e){let t=e.endPosition;return t.column===0&&t.row>e.startPosition.row?t.row:t.row+1}function RE(e){let t=[],n=r=>{if(/^(shorthand_property_identifier_pattern|identifier)$/.test(r.type)){t.includes(r.text)||t.push(r.text);return}if(r.type==="pair_pattern"){let o=r.childForFieldName("value");o&&n(o);return}for(let o of r.namedChildren)n(o)};for(let r of e.namedChildren)n(r);return t}function Wd(e,t,n,r={}){let o=Fa(t,n);if(!o||!Ue(o))return;let s=Dd[o];if(!s)return;let a=Ms(o);if(!a)return;let l=Dd[Nr(t)??o]?.lang??s.lang,c=null;try{if(c=a.parse(n),!c)return;let d=r.maxSymbols??iE,u=[],f=c.rootNode,m=(e.split("/").pop()??"").replace(/\.[^.]+$/,""),p=new Map,g=U=>U.parentPath??U.parent??"",h=(U,B)=>{let G=g(B),te=p.get(G);te||p.set(G,te=new Set),te.add(U)},_=U=>{u.length{let te=s.relationsFrom?.[G];if(te)for(let ie of te(U,{self:B})){if(ie.from===ie.to)continue;let ve=`${ie.kind} ${ie.from} ${ie.to}`;S.has(ve)||b.length>=oE||(S.add(ve),b.push(ie))}},C=(U,B,G,te)=>{if(te.inFunctionBody||s.privateMember?.(U)===!0)return!1;if(s.publicMember?.(U)===!0)return!0;if(!te.sectionPublic)return!1;if(te.forcePublic||te.exported)return!0;let ie=vE(U,G);return s.exported(B,G,ie===void 0?B:n.slice(U.startIndex,ie))},I=U=>s.docFrom?.(U)??(s.docstring?kg(U):void 0)??sr(U),P=(U,B)=>{let G=B.sectionPublic,te=s.bareMembers?.[U.type];for(let ie of U.namedChildren){if(s.sectionVisibility){let Qe=s.sectionVisibility(ie);if(Qe!==void 0){G=Qe;continue}}let ve=G===B.sectionPublic?B:{...B,sectionPublic:G},Je=s.inlineVisibility?.(ie);if(Je)for(let Qe of Je.nodes)v(Qe,te,{...ve,sectionPublic:Je.public});else v(ie,te,ve)}},v=(U,B,G)=>{if(B&&U.namedChildren.length===0&&As.test(U.type)){_({name:U.text,kind:B,file:e,line:U.startPosition.row+1,endLine:or(U),...G.parent?{parent:G.parent}:{},exported:G.forcePublic||G.exported,lang:l});return}let te=s.extraMembers?.(U,{ownerKind:G.ownerKind,inFunctionBody:G.inFunctionBody,publicNames:y});for(let ie of te??[]){let ve=ie.node??U,Je=ir(ve,n),Qe=s.docFrom?.(ve)??sr(ve);_({name:ie.name,kind:ie.kind,file:e,line:ve.startPosition.row+1,endLine:or(ve),...G.parent?{parent:G.parent}:{},...G.parentPath&&G.parentPath!==G.parent?{parentPath:G.parentPath}:{},signature:Je,...Qe?{doc:Qe}:{},exported:C(ve,Je,ie.name,G),lang:l})}E(U,G)},R=(U,B,G,te,ie)=>{let ve=Ld.has(B);return{parent:U,parentPath:G?`${G}/${U}`:U,ownerKind:B,exported:ie,forcePublic:Dg.has(B),inFunctionBody:te.inFunctionBody||ve,funcDepth:te.funcDepth+(ve?1:0),sectionPublic:!0}},M=(U,B)=>{let G=s.bodyFrom?.[U.type]?.(U);if(G)return M(G,B);let te=!1;for(let ie of U.namedChildren)s.containers.has(ie.type)&&(te=!0,P(ie,B));!te&&s.containers.has(U.type)&&P(U,B)},x=(U,B,G,te,ie)=>{k(U,B,U.type==="class"?"class_declaration":U.type),M(U,R(B,G,te.parentPath,te,ie))},w=0,E=(U,B)=>{if(!(w>=cE)){w++;try{N(U,B)}finally{w--}}},N=(U,B)=>{if(B.funcDepth>lE)return;let G=U.type,te=s.exportMarkers?.has(G)===!0,ie=B.exported||te;if(G==="export_statement"&&!U.childForFieldName("source")){for(let be of U.namedChildren)if(be.type==="identifier")h(be.text,B);else if(be.type==="export_clause")for(let pe of be.namedChildren){let ue=pe.childForFieldName("name")??pe.namedChildren[0];ue?.text&&h(ue.text,B)}}if(G==="export_statement"&&m&&U.children.some(be=>be.type==="default"))for(let be of U.namedChildren){let pe=uE.has(be.type),ue=fE.has(be.type);if((pe||ue)&&!be.childForFieldName("name")){let mt=sr(U),re=ue?"class":"function";_({name:m,kind:re,file:e,line:U.startPosition.row+1,endLine:or(U),signature:ir(U,n),...mt?{doc:mt}:{},exported:!0,lang:l}),x(be,m,re,B,!0);return}}if(s.assignments&&G==="expression_statement"){let be=U.namedChildren[0];if(be?.type==="assignment_expression"){let pe=be.childForFieldName("left"),ue=be.childForFieldName("right");if(pe?.type==="member_expression"&&pe.text==="module.exports"&&ue){if(ue.type==="object"){for(let re of ue.namedChildren)if(re.type==="shorthand_property_identifier")h(re.text,B);else if(re.type==="pair"){let ye=re.childForFieldName("key"),we=re.childForFieldName("value");ye?.type==="property_identifier"&&h(ye.text,B),we?.type==="identifier"&&h(we.text,B)}return}if(ue.type==="identifier"){h(ue.text,B);return}}let mt=ue&&Ba.has(ue.type);if(pe&&ue&&mt){let re,ye=!1;if(pe.type==="member_expression"&&pe.text==="module.exports")re=ue.childForFieldName("name")?.text??(m||void 0),ye=!0;else if(pe.type==="member_expression"){let we=pe.childForFieldName("property");if(we?.type==="property_identifier"){re=we.text;let K=pe.text.slice(0,pe.text.length-we.text.length-1);ye=K==="exports"||K==="module.exports"}}else pe.type==="identifier"&&(re=pe.text);if(re){let we=sr(U),K=ue.type==="class"?"class":"function",ae=!B.inFunctionBody&&(ie||ye);_({name:re,kind:K,file:e,line:be.startPosition.row+1,endLine:or(be),...B.parent?{parent:B.parent}:{},signature:ir(be,n),...we?{doc:we}:{},exported:ae,lang:l}),x(ue,re,K,B,ae);return}}else if(pe?.type==="member_expression"&&ue){let re=pe.childForFieldName("property");if(re?.type==="property_identifier"){let ye=pe.text.slice(0,pe.text.length-re.text.length-1);if(ye==="exports"||ye==="module.exports"){ue.type==="identifier"&&h(ue.text,B),(ue.type!=="identifier"||ue.text!==re.text)&&_({name:re.text,kind:"const",file:e,line:be.startPosition.row+1,endLine:or(be),...B.parent?{parent:B.parent}:{},signature:ir(be,n),exported:!0,lang:l});return}}}}}if(s.assignments&&G==="assignment_statement"){let be=U.children.find(ye=>ye.type==="variable_list"),pe=U.children.find(ye=>ye.type==="expression_list"),ue=be?.namedChildren??[],mt=pe?.namedChildren??[],re=Math.min(ue.length,mt.length);for(let ye=0;yere.type==="object_pattern"||re.type==="array_pattern");if(ue&&!B.inFunctionBody){let re=ir(U,n),ye=I(U);for(let we of RE(ue))_({name:we,kind:Qe,file:e,line:U.startPosition.row+1,endLine:or(U),...B.parent?{parent:B.parent}:{},signature:re,...ye?{doc:ye}:{},exported:C(U,re,we,{...B,exported:ie}),lang:l});return}let mt=Ld.has(Qe)||dE.has(Qe)||s.nestedDefs?.has(G)===!0||Ba.has(U.childForFieldName("value")?.type??"");if(pe&&(!B.inFunctionBody||mt)){let re=ir(U,n),ye=I(U),we=ve??B.parent,K=ve??B.parentPath,ae=s.namesFrom?.[G]?.(U);for(let Fe of ae&&ae.length>1?ae:[pe])_({name:Fe,kind:Qe,file:e,line:U.startPosition.row+1,endLine:or(U),...we?{parent:we}:{},...K&&K!==we?{parentPath:K}:{},signature:re,...ye?{doc:ye}:{},exported:C(U,re,Fe,{...B,exported:ie}),lang:l});k(U,pe),M(U,R(pe,Qe,K,B,ie));return}}if(k(U,ve??B.parent),s.containers.has(G)){let be=B.forcePublic||s.publicMembersIn?.[G]?.(U)===!0,pe=Ba.has(G);P(U,{...B,exported:ie,forcePublic:be,inFunctionBody:B.inFunctionBody||pe,funcDepth:B.funcDepth+(pe?1:0),...ve?{parent:ve,parentPath:ve,ownerKind:"type"}:{},...s.sectionScopes?.has(G)?{sectionPublic:!0}:{}})}};if(P(f,{exported:!1,forcePublic:!1,inFunctionBody:!1,funcDepth:0,sectionPublic:!0}),p.size)for(let U of u)!U.exported&&p.get(g(U))?.has(U.name)&&(U.exported=!0);if(y){for(let G of u)G.parent===void 0&&(G.exported=y.has(G.name));let U=new Set(u.filter(G=>G.parent===void 0&&G.kind!=="reexport").map(G=>G.name)),B=0;for(let G of u)(G.parent!==void 0||G.kind!=="reexport"||!U.has(G.name))&&(u[B++]=G);u.length=B}let{idents:O,calls:L,importedNames:H,terms:X,literals:le}=kE(f,s,new Set(u.map(U=>U.name)),r.maxCalls??Pi),me=r.imports!==!1,Ee=me?xi(t,n):[],je=me?ba(t,n):void 0;return b.sort((U,B)=>T(U.from,B.from)||T(U.kind,B.kind)||T(U.to,B.to)),{symbols:u,refs:Ee,pkg:je,idents:O,calls:L,importedNames:H,importAliases:Jg(f,s.lang),relations:b,terms:X,literals:le,...u.length>=d?{truncated:!0}:{}}}catch(d){r.onFailure?.(d);return}finally{c?.delete()}}var rE,Pi,sE,iE,oE,Xg,aE,lE,cE,dE,uE,fE,mE,pE,gE,hE,yE,_E,bE,Yg,Qg,Ua,eh,th,Zg,EE,Bd=z(()=>{"use strict";$();va();de();wt();La();Bg();Gg();Td();Kg();pi();_t();it();rE=512,Pi=8192,sE=256,iE=2e3,oE=256,Xg=512,aE=80,lE=2,cE=256,dE=new Set(["class","struct","enum","interface","trait","type","record","union"]),uE=new Set(["function","function_expression","function_declaration","generator_function","generator_function_declaration","arrow_function"]),fE=new Set(["class","class_declaration","abstract_class_declaration"]),mE=/identifier|constant|(^|_)name$/,pE=/^[A-Za-z_]\w{4,}$/,gE=/(^|_)string(_literal)?$/,hE=/(^|_)(integer|float|number|decimal|numeric)(_literal)?$/,yE=/(^|_)(regex|regular_expression)(_pattern|_literal)?$/,_E=/(^|_)(fragment|content|escape_sequence|character|start|end)$/,bE=/(^|_)(fragment|content)$/,Yg=1,Qg=2,Ua=4,eh=8,th=16,Zg=new Map;EE=/annotation|attribute|decorator|modifier|parameter|argument|body|block|string|comment|_list$/});function zd(e,t){let n=t.exec(e);return n?(n[1]??n[2]??n[3]??"").trim().toLowerCase():void 0}function Hd(e){return e.replace(/[^\r\n]/g," ")}function nh(e,t,n){let r="",o=0;for(let[a,l]of t){let c=e.slice(o,a),d=e.slice(a,l);r+=n?Hd(c)+d:c+Hd(d),o=l}let s=e.slice(o);return r+(n?Hd(s):s)}function NE(e,t){let n=[],r=1,o=0,s=a=>{for(let l=e.indexOf(` `,o);l!==-1&&l`,"gi");m.lastIndex=f;let p=m.exec(t),g=p?p.index:t.length;if(Nd.lastIndex=p?p.index+p[0].length:t.length,r.push([f,g]),d!=="script")continue;let h=Pd(u,bE);if(h!==void 0&&!SE.test(h))continue;let _=Pd(u,_E)??"js";if(_==="ts"||_==="typescript")s=!0;else if(_==="tsx")s=a=!0;else if(_==="jsx")a=!0;else if(_!=="js"&&_!=="javascript")continue;n.push([f,g]);let y=Pd(u,wE)==="module"||xE.test(u);(e===".astro"||e===".svelte"&&!y)&&o.push([f,g])}return{script:qg(t,n,!0),ext:s?a?".tsx":".ts":a?".jsx":".js",markup:qg(t,r,!1),notExported:vE(t,o)}}var yE,Nd,Dd,_E,bE,wE,xE,SE,kE,EE,Jg=H(()=>{"use strict";$();yE=new Set([".vue",".svelte",".astro"]),Nd=/|$)|<(script|style)(?=[\s>/])((?:[^>"']|"[^"]*"|'[^']*')*)>/gi,Dd=e=>new RegExp(`(?:^|\\s)${e}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'>]+))`,"i"),_E=Dd("lang"),bE=Dd("type"),wE=Dd("context"),xE=/(?:^|\s)module(?=[\s/=]|$)/i,SE=/^(?:module|(?:text|application)\/(?:javascript|ecmascript|typescript|babel)|text\/jsx|)$/i,kE=/^\s*---[ \t]*\r?\n/,EE=/^---[ \t]*\r?$/m});function Zg(e,t){if(Wd.has(e)){if(TE(e,t))return"minified";if(OE(e,t))return"bundle"}}function TE(e,t){if(!Wd.has(e))return!1;let n=0;for(let m=0;m{o+=a,a>=jd&&l*100<=a*RE&&c*100>=a*CE&&(s+=a),a=l=c=0,d=!1};for(let m=0;m32?(d&&u&&a>0&&l++,d=!1,a++,(p===ME||p===AE||p===IE||p===$E)&&c++):(d||(d=!0,u=!0),t.charCodeAt(m)>32&&(u=!1))}return f(),s>0&&s*2>=o}function OE(e,t){if(!Wd.has(e))return!1;let n;if(t.includes("_require__")&&FE.test(n=vr(t)))return!0;let r=[];Kg.lastIndex=0;for(let s;s=Kg.exec(t);)r.push(s);if(new Set(r.map(s=>s[1])).size=Xg}var Wd,jd,RE,CE,ME,AE,IE,$E,Kg,FE,Xg,Yg=H(()=>{"use strict";$();ft();Wd=new Set([".js",".mjs",".cjs"]);jd=300,RE=6,CE=1,ME=59,AE=40,IE=123,$E=125;Kg=/^\/\/ ((?:[\w@$.+~-]+\/)*[\w@$.+~-]+\.(?:[cm]?[jt]sx?|json|vue|svelte|astro))\r?$/gm,FE=/\bfunction __(?:webpack|nccwpck)_require__\s*\(/,Xg=3});function eh(e,t){let n=t;for(;n>0&&Qg.test(e[n-1]);)n--;if(n>0&&e[n-1]==="*")for(n--;n>0&&Qg.test(e[n-1]);)n--;let r=n;for(;r>0&&DE.test(e[r-1]);)r--;return r`${l.name} ${l.line}`)),s=e.split(` -`),a=/(?:\bnew\s+)?(?:([A-Za-z_$][\w$]*)\s*\.\s*)?([A-Za-z_$][\w$]*)\s*\(/g;for(let l=0;l{if(!(t.size>=Bd))for(let s of gn(o)){if(t.size>=Bd)return;t.add(s)}},r=!1;for(let o of e.split(` -`)){if(t.size>=Bd)break;let s=o;if(r){let c=s.indexOf("*/");if(n(Dt(c===-1?s:s.slice(0,c))),c===-1)continue;r=!1,s=s.slice(c+2)}let a=s.indexOf("/*");if(a!==-1){let c=s.indexOf("*/",a+2);n(Dt(s.slice(a,c===-1?void 0:c))),c===-1?(r=!0,s=s.slice(0,a)):s=s.slice(0,a)+s.slice(c+2)}let l=/(^|\s)(\/\/|#|--)(.*)$/.exec(s);l&&(n(Dt(l[2]+l[3])),s=s.slice(0,l.index));for(let c of s.matchAll(/(['"`])((?:\\.|(?!\1)[^\\])*)\1/g)){let d=c[2];d.length&&d.length<=jE&&n(d)}}return[...t].sort()}function BE(e){let t=new Zn,n=!1,r=0;for(let o of e.split(` -`)){if(r++,t.full)break;let s=o;if(n){let c=s.indexOf("*/");if(c===-1)continue;n=!1,s=s.slice(c+2)}let a=s.indexOf("/*");if(a!==-1){let c=s.indexOf("*/",a+2);c===-1?(n=!0,s=s.slice(0,a)):s=s.slice(0,a)+s.slice(c+2)}let l=/(^|\s)(\/\/|#|--)(.*)$/.exec(s);l&&(s=s.slice(0,l.index));for(let c of s.matchAll(/(['"`])((?:\\.|(?!\1)[^\\])*)\1/g))t.add("string",c[2],r);for(let c of s.replace(/(['"`])(?:\\.|(?!\1)[^\\])*\1/g," ").matchAll(/(?`${a.name} ${a.line} ${a.receiver??""}`,o=new Set(e.map(r)),s=[...e];for(let a of t)o.has(r(a))||s.push(a);return Pa(s,n)}function $i(e,t,n,r={}){let o=Zg(t,n);if(o)return{symbols:[],generated:o,summary:zc(t,n),refs:gi(t,n)};let s=Vg(t,n),a=s?s.script:n,l=s?s.ext:t,c=!1,d=Fd(e,l,a,{maxCalls:r.maxCallsPerFile,imports:!1,onFailure:()=>c=!0}),u=d?d.symbols:Qc(e,l,a),f=u.slice(0,NE),m=s?f.map(S=>({...S,lang:rn(t),exported:S.exported&&!s.notExported.some(([k,R])=>S.line>=k&&S.line<=R)})):f,p=new Set(m.map(S=>S.name)),g=la(e,a,m).filter(S=>!p.has(S.name)),h=gi(l,a),_=new Set(h.filter(S=>!S.soft).map(S=>S.spec)),y=(d&&!s?d.literals.length?d.literals:void 0:BE(n))?.filter(S=>!(S.kind==="string"&&_.has(S.value))),b=d?d.calls:th(a,m,r.maxCallsPerFile);return s&&(b=UE(b,th(s.markup,[],r.maxCallsPerFile),r.maxCallsPerFile)),{symbols:[...m,...g],...d?.truncated||u.length>m.length||g.length>=aa?{truncated:!0}:{},...c?{astFallback:!0}:{},...b.length>=(r.maxCallsPerFile??Ii)?{callsCapped:!0}:{},summary:zc(t,n),refs:h,pkg:fa(t,n),idents:d?.idents,calls:b,importedNames:d?.importedNames,importAliases:d?.importAliases.length?d.importAliases:void 0,relations:d?.relations?.length?d.relations:void 0,terms:d&&!s?d.terms:WE(n),literals:y?.length?y:void 0}}var NE,PE,LE,Qg,DE,Bd,jE,La=H(()=>{"use strict";$();_a();Cr();Od();tt();ft();Jg();Yg();li();et();NE=2e3,PE=new Set(["if","else","elif","for","while","do","switch","case","match","when","unless","until","catch","except","return","throw","raise","yield","await","typeof","instanceof","sizeof","delete","void","in","of","not","and","or","assert","defer","select","with","loop"]),LE=new Set(["function","def","func","fun","fn","class","sub","macro","proc"]),Qg=/\s/,DE=/\w/;Bd=512,jE=80});function rh(e){let t=new Zn,n=0;for(let r of e.split(` -`)){if(n++,t.full)break;let o=VE(r);for(let c of o.matchAll(nh))t.add("string",c[1]??c[2].replace(/''/g,"'"),n);let a=qE.exec(o)?.[1].trim(),l=a&&!/^[[{|>&*-]/.test(a)&&!zE.test(a)?a:void 0;if(l!==void 0&&!GE.test(l)){t.add("string",l,n);continue}for(let c of o.replace(nh," ").matchAll(HE))t.add("number",c[0].replace(/_/g,""),n)}return t.result()}function VE(e){let t;for(let n=0;n{"use strict";$();_a();nh=/"((?:\\.|[^"\\])*)"|'((?:[^']|'')*)'/g,zE=/"(?:\\.|[^"\\])*"|'(?:[^']|'')*'/,HE=/(?zd(e,m)),s=t.exclude?.map(m=>zd(e,m)),a=It(r),l=It(o),c=It(s);if(!a&&!l&&!c)return;let d=rd(r),u=rd(o),f=Fp(s);return({rel:m,directory:p})=>p?(!d||d(m))&&(!u||u(m))&&!f?.(m):(!a||a(m))&&(!l||l(m))&&!c?.(m)}function oh(e,t,n){let r=l=>It(l.map(c=>zd(e,c)))?.(n)??!0,o=t.scope===void 0?"":nr(e,t.scope),s={};o&&!r([o,`${o}/**`])&&(s.scope=t.scope),t.include?.length&&!r(t.include)&&(s.include=t.include);let a=t.exclude?.find(l=>r([l]));return a!==void 0&&(s.exclude=a),s.scope!==void 0||s.include||s.exclude!==void 0?s:void 0}function Fr(e,t){let n=Hd(e,t);return{maxFileBytes:t.maxBytes,maxFiles:t.maxFiles,gitignore:t.gitignore,ignoreDirs:t.ignoreDirs,...n?{filter:n}:{},...t.onSkip?{onSkip:t.onSkip}:{}}}function*ja(e,t){let n=Fr(e,t),{files:r,capped:o,excluded:s,oversized:a}=t.precomputedWalk??Xe(e,n),l=XE(e,t.out),c=t.precomputedWalk?n.filter:void 0;for(let d of r){if(l&&l(d)){t.onSkip?.({rel:d.rel,reason:"index-output",directory:!1,size:d.size});continue}if(c&&!c({rel:d.rel,abs:d.abs,directory:!1})){t.onSkip?.({rel:d.rel,reason:"filter",directory:!1,size:d.size});continue}yield{f:d,kind:mt(d.rel,d.ext),lang:rn(d.ext)}}return{capped:o,excluded:s,oversized:a}}function XE(e,t){if(!t)return;let n=le(t),r=je(n,le(e));if(r==="")return a=>!a.rel.includes("/")&&KE(a.rel);if(r!==".."&&!r.startsWith(`..${"/"}`)&&!Pe(r))return;let o=je(le(e),n);if(o===".."||o.startsWith(`..${"/"}`)||Pe(o))return;let s=o.split("/").join("/");return a=>a.rel===s||a.rel.startsWith(`${s}/`)}function Gd(e,t={}){let n=[],r=ja(e,t);for(let o=r.next();!o.done;o=r.next())o.value.kind==="code"&&n.push({f:o.value.f,lang:o.value.lang});return n}function Es(e,t={}){let n=[],r=ja(e,t),o=r.next();for(;!o.done;o=r.next())n.push(o.value.f);return{files:n,capped:o.value.capped}}function Ti(e,t={}){let n={},r=0,o=ja(e,t),s=o.next();for(;!s.done;s=o.next())n[s.value.lang]=(n[s.value.lang]??0)+1,r++;return{root:e,commit:en(e),fileCount:r,languages:n,capped:s.value.capped,excluded:s.value.excluded}}function Rt(e,t={}){let n=[],r={},o=new Ud,s=new Map,a=t.cache,l=a!==void 0,c=a===void 0,d=ja(e,t),u=d.next();for(;!u.done;u=d.next()){let{f,kind:m,lang:p}=u.value;r[p]=(r[p]??0)+1,s.set(f.rel,f.mtimeMs);let g=t.cache?.get(f.rel);if(!t.fullHash&&g&&g.size!==void 0&&g.mtimeMs!==void 0&&g.size===f.size&&g.mtimeMs===f.mtimeMs){n.push(g.record),m==="doc"&&o.defer(f.rel,f.abs);continue}let h=t.extracted?.get(f.rel),_=h&&h.size===f.size&&h.mtimeMs===f.mtimeMs&&(h.record||h.hash===g?.hash)?h:void 0,y=_?void 0:re(f.abs),b=_?_.hash:Re(y);if(g&&g.hash===b){n.push(g.record.size===f.size?g.record:{...g.record,size:f.size}),m==="doc"&&y&&o.set(f.rel,y),(g.size!==f.size||g.mtimeMs!==f.mtimeMs)&&(c=!0);continue}if(l=!1,c=!0,_?.record){n.push(_.record);continue}let S=m==="code"?Da(f.rel,f.ext,f.size,y,b,p,t):{rel:f.rel,ext:f.ext,size:f.size,lines:ih(y),hash:b,kind:m,lang:p,headings:[],symbols:[],refs:[]};if(m!=="code")if(y&&m==="doc"&&(td.has(f.ext)||f.ext===".rst")){let k=f.ext===".rst"?ld(f.rel,y):sd(y);S.title=k.title??We(f.rel),S.summary=k.summary,S.headings=k.headings,S.refs=k.refs}else y&&m==="doc"?S.title=We(f.rel):y&&m==="config"?(S.title=We(f.rel),S.literals=rh(y)):S.title=We(f.rel);m==="doc"&&y&&o.set(f.rel,y),n.push(S)}return n.sort(Sr(f=>f.rel)),a!==void 0&&n.length!==a.size&&(l=!1,c=!0),{root:e,commit:en(e),files:n,languages:r,docText:o,mtimes:s,capped:u.value.capped,excluded:u.value.excluded,...u.value.oversized?{oversized:u.value.oversized}:{},contentUnchanged:l,cacheDirty:c}}var Ud,JE,KE,Ut=H(()=>{"use strict";$();me();Ze();nn();St();In();Cr();_i();ce();id();cd();La();sh();Ud=class extends Map{pending=new Map;defer(t,n){this.pending.set(t,n)}load(t){let n=this.pending.get(t);if(n===void 0)return;this.pending.delete(t);let r=re(n);r&&super.set(t,r)}loadAll(){for(let t of[...this.pending.keys()])this.load(t)}get(t){return this.load(t),super.get(t)}has(t){return this.load(t),super.has(t)}set(t,n){return this.pending?.delete(t),super.set(t,n)}delete(t){let n=this.pending.delete(t);return super.delete(t)||n}clear(){this.pending.clear(),super.clear()}get size(){return this.loadAll(),super.size}forEach(t,n){this.loadAll(),super.forEach(t,n)}entries(){return this.loadAll(),super.entries()}keys(){return this.loadAll(),super.keys()}values(){return this.loadAll(),super.values()}[Symbol.iterator](){return this.entries()}};JE=["graph.json","symbols.json","cache.json","freshness.json","embeddings.bin"],KE=e=>JE.some(t=>e===t||e.startsWith(`${t}.tmp-`))});function Vd(e,t,n){return t.every(r=>e[r]===void 0||n(e[r]))}function rv(e,t){return ln(e)&&Qe(e.name)&&Qe(e.kind)&&e.file===t&&Fi(e.line)&&(e.endLine===void 0||Fi(e.endLine)&&e.endLine>=e.line)&&typeof e.exported=="boolean"&&Qe(e.lang)&&Vd(e,ev,Qe)}function sv(e){return ln(e)&&(e.kind==="import"||e.kind==="doc-link")&&Qe(e.spec)&&(e.soft===void 0||e.soft===!0)}function iv(e){return ln(e)&&Qe(e.name)&&Fi(e.line)&&(e.receiver===void 0||Qe(e.receiver))}function ov(e){return ln(e)&&Qe(e.local)&&Qe(e.name)&&(e.from===void 0||Qe(e.from))}function av(e){return ln(e)&&(e.kind==="extends"||e.kind==="implements")&&Qe(e.from)&&Qe(e.to)&&Fi(e.line)}function lv(e){return ln(e)&&(e.kind==="string"||e.kind==="number"||e.kind==="regex")&&Qe(e.value)&&Fi(e.line)}function Ba(e,t){return e===void 0||Array.isArray(e)&&e.every(t)}function cv(e,t){return ln(e)&&e.rel===t&&Qe(e.ext)&&Ua(e.size)&&Ua(e.lines)&&ch(e.hash)&&Qe(e.kind)&&QE.has(e.kind)&&Qe(e.lang)&&Vd(e,tv,Qe)&&Vd(e,nv,lh)&&lh(e.headings)&&Array.isArray(e.symbols)&&e.symbols.every(n=>rv(n,t))&&Array.isArray(e.refs)&&e.refs.every(sv)&&Ba(e.calls,iv)&&Ba(e.importAliases,ov)&&Ba(e.relations,av)&&Ba(e.literals,lv)&&(e.truncated===void 0||e.truncated===!0)&&(e.callsCapped===void 0||e.callsCapped===!0)&&(e.astFallback===void 0||e.astFallback===!0)&&(e.generated===void 0||e.generated==="minified"||e.generated==="bundle")}function dv(e,t){return ln(e)&&ch(e.hash)&&cv(e.record,t)&&e.hash===e.record.hash&&(e.size===void 0||Ua(e.size)&&e.size===e.record.size)&&(e.mtimeMs===void 0||typeof e.mtimeMs=="number"&&Number.isFinite(e.mtimeMs))}function dh(e){if(!ln(e)||e.schemaVersion!==5||e.extractorVersion!==17||!ln(e.files))return;let t=new Map;for(let[n,r]of Object.entries(e.files)){if(n.split("/").some(o=>o===""||o==="."||o==="..")||!dv(r,n))return;t.set(n,r)}return t}function Jd(e,t,n){let r=Bt(e.filter(o=>o.kind==="code").map(o=>o.ext)).filter(n);return t===void 0?{grammars:r}:{grammars:r,maxCallsPerFile:t}}function Kd(e,t){return e!==void 0&&e.maxCallsPerFile===t.maxCallsPerFile&&e.grammars.join(",")===t.grammars.join(",")}function za(e){if(!ln(e)||!Array.isArray(e.grammars)||!e.grammars.every(Qe))return;let t=e.maxCallsPerFile;if(t!==void 0&&!(typeof t=="number"&&Number.isFinite(t)&&t>0))return;let n=[...e.grammars];return t===void 0?{grammars:n}:{grammars:n,maxCallsPerFile:t}}function Oi(e,t,n){let r=Ni(t,n),o=new Map;for(let[s,a]of e)r(a.record.kind,a.record.ext)&&o.set(s,a);return o}function Ni(e,t){let n=new Set(e?.grammars),r=e!==void 0&&e.maxCallsPerFile===t.maxCallsPerFile;return(o,s)=>o!=="code"?!0:r?Bt([s]).every(a=>n.has(a)===t.ast(a)):!1}var ln,Qe,Ua,Fi,lh,ch,QE,ev,tv,nv,Pi=H(()=>{"use strict";$();bt();pt();ln=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Qe=e=>typeof e=="string",Ua=e=>typeof e=="number"&&Number.isSafeInteger(e)&&e>=0,Fi=e=>Ua(e)&&e>0,lh=e=>Array.isArray(e)&&e.every(Qe),ch=e=>Qe(e)&&/^[a-f0-9]{40}$/.test(e),QE=new Set(["code","doc","config","asset","other"]),ev=["parent","parentPath","signature","doc"],tv=["title","summary","pkg"],nv=["idents","importedNames","terms"]});var vs,Ha,Xd=H(()=>{$();vs=class{constructor(){throw new Error("worker_threads is not available in the browser build (the engine runs single-threaded here)")}},Ha=class{constructor(){throw new Error("worker_threads is not available in the browser build (the engine runs single-threaded here)")}}});function uv(e=xa(import.meta.url)){try{if(We(e)==="engine.mjs")return Mr(e).href;let t=j(Ce(e),"engine.mjs");return Q(t)?Mr(t).href:void 0}catch{return}}function uh(e){let t=F.env.CODEINDEX_WORKERS,n=e??(t!==void 0&&t!==""?Number(t):void 0);if(n!==void 0)return Number.isFinite(n)&&n>0?Math.floor(n):0;let r=1;try{r=typeof wa=="function"?wa():jp().length}catch{r=1}return Math.max(0,Math.min(r-1,8))}async function pv(e,t){await an(e.grammarKeys);let n=e.grammarKeys.filter(o=>De(o)),r=[];for(let o of e.jobs){let s,a;try{let u=Me(o.abs);s=u.size,a=u.mtimeMs}catch{continue}let l=re(o.abs),c=Re(l);if(c===o.cachedHash){r.push({rel:o.rel,size:s,mtimeMs:a,hash:c});continue}let d=Da(o.rel,o.ext,s,l,c,rn(o.ext),{maxCallsPerFile:e.maxCallsPerFile});r.push({rel:o.rel,size:s,mtimeMs:a,hash:c,record:d})}t({ready:n,records:r})}async function fh(e,t,n,r={}){if(n<2||e.length===0)return;let o=r.engineUrl??uv();if(!o)return;let s=t.filter(m=>De(m)).sort(),a=Math.min(n,e.length),l=`import { runExtractWorker } from ${JSON.stringify(o)}; +`,l+1))r++;o=a};for(let[a,l]of t){s(a);let c=r;s(l),n.push([c,r])}return n}function rh(e,t){if(!CE.has(e))return;let n=[],r=[],o=[],s=!1,a=!1,l=0;if(e===".astro"){s=!0;let c=FE.exec(t);if(c){let d=c[0].length,u=OE.exec(t.slice(d)),f=u?d+u.index:t.length;n.push([d,f]),r.push([d,f]),o.push([d,f]),l=u?f+u[0].length:f}}Ud.lastIndex=l;for(let c;c=Ud.exec(t);){let d=c[1]?.toLowerCase();if(!d){r.push([c.index,c.index+c[0].length]);continue}let u=c[2],f=c.index+c[0].length;if(u.trimEnd().endsWith("/"))continue;let m=new RegExp(``,"gi");m.lastIndex=f;let p=m.exec(t),g=p?p.index:t.length;if(Ud.lastIndex=p?p.index+p[0].length:t.length,r.push([f,g]),d!=="script")continue;let h=zd(u,AE);if(h!==void 0&&!TE.test(h))continue;let _=zd(u,ME)??"js";if(_==="ts"||_==="typescript")s=!0;else if(_==="tsx")s=a=!0;else if(_==="jsx")a=!0;else if(_!=="js"&&_!=="javascript")continue;n.push([f,g]);let y=zd(u,IE)==="module"||$E.test(u);(e===".astro"||e===".svelte"&&!y)&&o.push([f,g])}return{script:nh(t,n,!0),ext:s?a?".tsx":".ts":a?".jsx":".js",markup:nh(t,r,!1),notExported:NE(t,o)}}var CE,Ud,Gd,ME,AE,IE,$E,TE,FE,OE,sh=z(()=>{"use strict";$();CE=new Set([".vue",".svelte",".astro"]),Ud=/|$)|<(script|style)(?=[\s>/])((?:[^>"']|"[^"]*"|'[^']*')*)>/gi,Gd=e=>new RegExp(`(?:^|\\s)${e}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'>]+))`,"i"),ME=Gd("lang"),AE=Gd("type"),IE=Gd("context"),$E=/(?:^|\s)module(?=[\s/=]|$)/i,TE=/^(?:module|(?:text|application)\/(?:javascript|ecmascript|typescript|babel)|text\/jsx|)$/i,FE=/^\s*---[ \t]*\r?\n/,OE=/^---[ \t]*\r?$/m});function ah(e,t){if(Vd.has(e)){if(UE(e,t))return"minified";if(HE(e,t))return"bundle"}}function UE(e,t){if(!Vd.has(e))return!1;let n=0;for(let m=0;m{o+=a,a>=qd&&l*100<=a*PE&&c*100>=a*LE&&(s+=a),a=l=c=0,d=!1};for(let m=0;m32?(d&&u&&a>0&&l++,d=!1,a++,(p===DE||p===jE||p===WE||p===BE)&&c++):(d||(d=!0,u=!0),t.charCodeAt(m)>32&&(u=!1))}return f(),s>0&&s*2>=o}function HE(e,t){if(!Vd.has(e))return!1;let n;if(t.includes("_require__")&&zE.test(n=Ir(t)))return!0;let r=[];ih.lastIndex=0;for(let s;s=ih.exec(t);)r.push(s);if(new Set(r.map(s=>s[1])).size=oh}var Vd,qd,PE,LE,DE,jE,WE,BE,ih,zE,oh,lh=z(()=>{"use strict";$();_t();Vd=new Set([".js",".mjs",".cjs"]);qd=300,PE=6,LE=1,DE=59,jE=40,WE=123,BE=125;ih=/^\/\/ ((?:[\w@$.+~-]+\/)*[\w@$.+~-]+\.(?:[cm]?[jt]sx?|json|vue|svelte|astro))\r?$/gm,zE=/\bfunction __(?:webpack|nccwpck)_require__\s*\(/,oh=3});function dh(e,t){let n=t;for(;n>0&&ch.test(e[n-1]);)n--;if(n>0&&e[n-1]==="*")for(n--;n>0&&ch.test(e[n-1]);)n--;let r=n;for(;r>0&&JE.test(e[r-1]);)r--;return r`${l.name} ${l.line}`)),s=e.split(` +`),a=/(?:\bnew\s+)?(?:([A-Za-z_$][\w$]*)\s*\.\s*)?([A-Za-z_$][\w$]*)\s*\(/g;for(let l=0;l{if(!(t.size>=Jd))for(let s of bn(o)){if(t.size>=Jd)return;t.add(s)}},r=!1;for(let o of e.split(` +`)){if(t.size>=Jd)break;let s=o;if(r){let c=s.indexOf("*/");if(n(Ht(c===-1?s:s.slice(0,c))),c===-1)continue;r=!1,s=s.slice(c+2)}let a=s.indexOf("/*");if(a!==-1){let c=s.indexOf("*/",a+2);n(Ht(s.slice(a,c===-1?void 0:c))),c===-1?(r=!0,s=s.slice(0,a)):s=s.slice(0,a)+s.slice(c+2)}let l=/(^|\s)(\/\/|#|--)(.*)$/.exec(s);l&&(n(Ht(l[2]+l[3])),s=s.slice(0,l.index));for(let c of s.matchAll(/(['"`])((?:\\.|(?!\1)[^\\])*)\1/g)){let d=c[2];d.length&&d.length<=KE&&n(d)}}return[...t].sort()}function ZE(e){let t=new nr,n=!1,r=0;for(let o of e.split(` +`)){if(r++,t.full)break;let s=o;if(n){let c=s.indexOf("*/");if(c===-1)continue;n=!1,s=s.slice(c+2)}let a=s.indexOf("/*");if(a!==-1){let c=s.indexOf("*/",a+2);c===-1?(n=!0,s=s.slice(0,a)):s=s.slice(0,a)+s.slice(c+2)}let l=/(^|\s)(\/\/|#|--)(.*)$/.exec(s);l&&(s=s.slice(0,l.index));for(let c of s.matchAll(/(['"`])((?:\\.|(?!\1)[^\\])*)\1/g))t.add("string",c[2],r);for(let c of s.replace(/(['"`])(?:\\.|(?!\1)[^\\])*\1/g," ").matchAll(/(?`${a.name} ${a.line} ${a.receiver??""}`,o=new Set(e.map(r)),s=[...e];for(let a of t)o.has(r(a))||s.push(a);return za(s,n)}function Li(e,t,n,r={}){let o=ah(t,n);if(o)return{symbols:[],generated:o,summary:Xc(t,n),refs:xi(t,n)};let s=rh(t,n),a=s?s.script:n,l=s?s.ext:t,c=!1,d=Wd(e,l,a,{maxCalls:r.maxCallsPerFile,imports:!1,onFailure:()=>c=!0}),u=d?d.symbols:od(e,l,a),f=u.slice(0,GE),m=s?f.map(S=>({...S,lang:cn(t),exported:S.exported&&!s.notExported.some(([k,C])=>S.line>=k&&S.line<=C)})):f,p=new Set(m.map(S=>S.name)),g=ga(e,a,m).filter(S=>!p.has(S.name)),h=xi(l,a),_=new Set(h.filter(S=>!S.soft).map(S=>S.spec)),y=(d&&!s?d.literals.length?d.literals:void 0:ZE(n))?.filter(S=>!(S.kind==="string"&&_.has(S.value))),b=d?d.calls:uh(a,m,r.maxCallsPerFile);return s&&(b=YE(b,uh(s.markup,[],r.maxCallsPerFile),r.maxCallsPerFile)),{symbols:[...m,...g],...d?.truncated||u.length>m.length||g.length>=pa?{truncated:!0}:{},...c?{astFallback:!0}:{},...b.length>=(r.maxCallsPerFile??Pi)?{callsCapped:!0}:{},summary:Xc(t,n),refs:h,pkg:ba(t,n),idents:d?.idents,calls:b,importedNames:d?.importedNames,importAliases:d?.importAliases.length?d.importAliases:void 0,relations:d?.relations?.length?d.relations:void 0,terms:d&&!s?d.terms:XE(n),literals:y?.length?y:void 0}}var GE,qE,VE,ch,JE,Jd,KE,Ha=z(()=>{"use strict";$();va();Tr();Bd();ot();_t();sh();lh();pi();it();GE=2e3,qE=new Set(["if","else","elif","for","while","do","switch","case","match","when","unless","until","catch","except","return","throw","raise","yield","await","typeof","instanceof","sizeof","delete","void","in","of","not","and","or","assert","defer","select","with","loop"]),VE=new Set(["function","def","func","fun","fn","class","sub","macro","proc"]),ch=/\s/,JE=/\w/;Jd=512,KE=80});function mh(e){let t=new nr,n=0;for(let r of e.split(` +`)){if(n++,t.full)break;let o=rv(r);for(let c of o.matchAll(fh))t.add("string",c[1]??c[2].replace(/''/g,"'"),n);let a=nv.exec(o)?.[1].trim(),l=a&&!/^[[{|>&*-]/.test(a)&&!QE.test(a)?a:void 0;if(l!==void 0&&!tv.test(l)){t.add("string",l,n);continue}for(let c of o.replace(fh," ").matchAll(ev))t.add("number",c[0].replace(/_/g,""),n)}return t.result()}function rv(e){let t;for(let n=0;n{"use strict";$();va();fh=/"((?:\\.|[^"\\])*)"|'((?:[^']|'')*)'/g,QE=/"(?:\\.|[^"\\])*"|'(?:[^']|'')*'/,ev=/(?Xd(e,m)),s=t.exclude?.map(m=>Xd(e,m)),a=Lt(r),l=Lt(o),c=Lt(s);if(!a&&!l&&!c)return;let d=dd(r),u=dd(o),f=zp(s);return({rel:m,directory:p})=>p?(!d||d(m))&&(!u||u(m))&&!f?.(m):(!a||a(m))&&(!l||l(m))&&!c?.(m)}function hh(e,t,n){let r=l=>Lt(l.map(c=>Xd(e,c)))?.(n)??!0,o=t.scope===void 0?"":ar(e,t.scope),s={};o&&!r([o,`${o}/**`])&&(s.scope=t.scope),t.include?.length&&!r(t.include)&&(s.include=t.include);let a=t.exclude?.find(l=>r([l]));return a!==void 0&&(s.exclude=a),s.scope!==void 0||s.include||s.exclude!==void 0?s:void 0}function Dr(e,t){let n=Zd(e,t);return{maxFileBytes:t.maxBytes,maxFiles:t.maxFiles,gitignore:t.gitignore,ignoreDirs:t.ignoreDirs,...n?{filter:n}:{},...t.onSkip?{onSkip:t.onSkip}:{}}}function*qa(e,t){let n=Dr(e,t),{files:r,capped:o,excluded:s,oversized:a}=t.precomputedWalk??tt(e,n),l=ov(e,t.out),c=t.precomputedWalk?n.filter:void 0;for(let d of r){if(l&&l(d)){t.onSkip?.({rel:d.rel,reason:"index-output",directory:!1,size:d.size});continue}if(c&&!c({rel:d.rel,abs:d.abs,directory:!1})){t.onSkip?.({rel:d.rel,reason:"filter",directory:!1,size:d.size});continue}yield{f:d,kind:bt(d.rel,d.ext),lang:cn(d.ext)}}return{capped:o,excluded:s,oversized:a}}function ov(e,t){if(!t)return;let n=ce(t),r=ze(n,ce(e));if(r==="")return a=>!a.rel.includes("/")&&iv(a.rel);if(r!==".."&&!r.startsWith(`..${"/"}`)&&!We(r))return;let o=ze(ce(e),n);if(o===".."||o.startsWith(`..${"/"}`)||We(o))return;let s=o.split("/").join("/");return a=>a.rel===s||a.rel.startsWith(`${s}/`)}function Yd(e,t={}){let n=[],r=qa(e,t);for(let o=r.next();!o.done;o=r.next())o.value.kind==="code"&&n.push({f:o.value.f,lang:o.value.lang});return n}function Is(e,t={}){let n=[],r=qa(e,t),o=r.next();for(;!o.done;o=r.next())n.push(o.value.f);return{files:n,capped:o.value.capped}}function Di(e,t={}){let n={},r=0,o=qa(e,t),s=o.next();for(;!s.done;s=o.next())n[s.value.lang]=(n[s.value.lang]??0)+1,r++;return{root:e,commit:on(e),fileCount:r,languages:n,capped:s.value.capped,excluded:s.value.excluded}}function Tt(e,t={}){let n=[],r={},o=new Kd,s=new Map,a=t.cache,l=a!==void 0,c=a===void 0,d=qa(e,t),u=d.next();for(;!u.done;u=d.next()){let{f,kind:m,lang:p}=u.value;r[p]=(r[p]??0)+1,s.set(f.rel,f.mtimeMs);let g=t.cache?.get(f.rel);if(!t.fullHash&&g&&g.size!==void 0&&g.mtimeMs!==void 0&&g.size===f.size&&g.mtimeMs===f.mtimeMs){n.push(g.record),m==="doc"&&o.defer(f.rel,f.abs);continue}let h=t.extracted?.get(f.rel),_=h&&h.size===f.size&&h.mtimeMs===f.mtimeMs&&(h.record||h.hash===g?.hash)?h:void 0,y=_?void 0:se(f.abs),b=_?_.hash:Ae(y);if(g&&g.hash===b){n.push(g.record.size===f.size?g.record:{...g.record,size:f.size}),m==="doc"&&y&&o.set(f.rel,y),(g.size!==f.size||g.mtimeMs!==f.mtimeMs)&&(c=!0);continue}if(l=!1,c=!0,_?.record){n.push(_.record);continue}let S=m==="code"?Ga(f.rel,f.ext,f.size,y,b,p,t):{rel:f.rel,ext:f.ext,size:f.size,lines:gh(y),hash:b,kind:m,lang:p,headings:[],symbols:[],refs:[]};if(m!=="code")if(y&&m==="doc"&&(ld.has(f.ext)||f.ext===".rst")){let k=f.ext===".rst"?gd(f.rel,y):ud(y);S.title=k.title??He(f.rel),S.summary=k.summary,S.headings=k.headings,S.refs=k.refs}else y&&m==="doc"?S.title=He(f.rel):y&&m==="config"?(S.title=He(f.rel),S.literals=mh(y)):S.title=He(f.rel);m==="doc"&&y&&o.set(f.rel,y),n.push(S)}return n.sort(Cr(f=>f.rel)),a!==void 0&&n.length!==a.size&&(l=!1,c=!0),{root:e,commit:on(e),files:n,languages:r,docText:o,mtimes:s,capped:u.value.capped,excluded:u.value.excluded,...u.value.oversized?{oversized:u.value.oversized}:{},contentUnchanged:l,cacheDirty:c}}var Kd,sv,iv,Jt=z(()=>{"use strict";$();ge();nt();ln();At();Fn();Tr();Ei();de();fd();hd();Ha();ph();Kd=class extends Map{pending=new Map;defer(t,n){this.pending.set(t,n)}load(t){let n=this.pending.get(t);if(n===void 0)return;this.pending.delete(t);let r=se(n);r&&super.set(t,r)}loadAll(){for(let t of[...this.pending.keys()])this.load(t)}get(t){return this.load(t),super.get(t)}has(t){return this.load(t),super.has(t)}set(t,n){return this.pending?.delete(t),super.set(t,n)}delete(t){let n=this.pending.delete(t);return super.delete(t)||n}clear(){this.pending.clear(),super.clear()}get size(){return this.loadAll(),super.size}forEach(t,n){this.loadAll(),super.forEach(t,n)}entries(){return this.loadAll(),super.entries()}keys(){return this.loadAll(),super.keys()}values(){return this.loadAll(),super.values()}[Symbol.iterator](){return this.entries()}};sv=["graph.json","symbols.json","cache.json","freshness.json","embeddings.bin"],iv=e=>sv.some(t=>e===t||e.startsWith(`${t}.tmp-`))});function eu(e,t,n){return t.every(r=>e[r]===void 0||n(e[r]))}function mv(e,t){return mn(e)&&st(e.name)&&st(e.kind)&&e.file===t&&ji(e.line)&&(e.endLine===void 0||ji(e.endLine)&&e.endLine>=e.line)&&typeof e.exported=="boolean"&&st(e.lang)&&eu(e,dv,st)}function pv(e){return mn(e)&&(e.kind==="import"||e.kind==="doc-link")&&st(e.spec)&&(e.soft===void 0||e.soft===!0)}function gv(e){return mn(e)&&st(e.name)&&ji(e.line)&&(e.receiver===void 0||st(e.receiver))}function hv(e){return mn(e)&&st(e.local)&&st(e.name)&&(e.from===void 0||st(e.from))}function yv(e){return mn(e)&&(e.kind==="extends"||e.kind==="implements")&&st(e.from)&&st(e.to)&&ji(e.line)}function _v(e){return mn(e)&&(e.kind==="string"||e.kind==="number"||e.kind==="regex")&&st(e.value)&&ji(e.line)}function Ja(e,t){return e===void 0||Array.isArray(e)&&e.every(t)}function bv(e,t){return mn(e)&&e.rel===t&&st(e.ext)&&Ka(e.size)&&Ka(e.lines)&&bh(e.hash)&&st(e.kind)&&cv.has(e.kind)&&st(e.lang)&&eu(e,uv,st)&&eu(e,fv,_h)&&_h(e.headings)&&Array.isArray(e.symbols)&&e.symbols.every(n=>mv(n,t))&&Array.isArray(e.refs)&&e.refs.every(pv)&&Ja(e.calls,gv)&&Ja(e.importAliases,hv)&&Ja(e.relations,yv)&&Ja(e.literals,_v)&&(e.truncated===void 0||e.truncated===!0)&&(e.callsCapped===void 0||e.callsCapped===!0)&&(e.astFallback===void 0||e.astFallback===!0)&&(e.generated===void 0||e.generated==="minified"||e.generated==="bundle")}function wv(e,t){return mn(e)&&bh(e.hash)&&bv(e.record,t)&&e.hash===e.record.hash&&(e.size===void 0||Ka(e.size)&&e.size===e.record.size)&&(e.mtimeMs===void 0||typeof e.mtimeMs=="number"&&Number.isFinite(e.mtimeMs))}function wh(e){if(!mn(e)||e.schemaVersion!==5||e.extractorVersion!==18||!mn(e.files))return;let t=new Map;for(let[n,r]of Object.entries(e.files)){if(n.split("/").some(o=>o===""||o==="."||o==="..")||!wv(r,n))return;t.set(n,r)}return t}function tu(e,t,n){let r=Vt(e.filter(o=>o.kind==="code").map(o=>o.ext)).filter(n);return t===void 0?{grammars:r}:{grammars:r,maxCallsPerFile:t}}function nu(e,t){return e!==void 0&&e.maxCallsPerFile===t.maxCallsPerFile&&e.grammars.join(",")===t.grammars.join(",")}function Xa(e){if(!mn(e)||!Array.isArray(e.grammars)||!e.grammars.every(st))return;let t=e.maxCallsPerFile;if(t!==void 0&&!(typeof t=="number"&&Number.isFinite(t)&&t>0))return;let n=[...e.grammars];return t===void 0?{grammars:n}:{grammars:n,maxCallsPerFile:t}}function Wi(e,t,n){let r=Bi(t,n),o=new Map;for(let[s,a]of e)r(a.record.kind,a.record.ext)&&o.set(s,a);return o}function Bi(e,t){let n=new Set(e?.grammars),r=e!==void 0&&e.maxCallsPerFile===t.maxCallsPerFile;return(o,s)=>o!=="code"?!0:r?Vt([s]).every(a=>n.has(a)===t.ast(a)):!1}var mn,st,Ka,ji,_h,bh,cv,dv,uv,fv,Ui=z(()=>{"use strict";$();Rt();wt();mn=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),st=e=>typeof e=="string",Ka=e=>typeof e=="number"&&Number.isSafeInteger(e)&&e>=0,ji=e=>Ka(e)&&e>0,_h=e=>Array.isArray(e)&&e.every(st),bh=e=>st(e)&&/^[a-f0-9]{40}$/.test(e),cv=new Set(["code","doc","config","asset","other"]),dv=["parent","parentPath","signature","doc"],uv=["title","summary","pkg"],fv=["idents","importedNames","terms"]});var $s,Za,ru=z(()=>{$();$s=class{constructor(){throw new Error("worker_threads is not available in the browser build (the engine runs single-threaded here)")}},Za=class{constructor(){throw new Error("worker_threads is not available in the browser build (the engine runs single-threaded here)")}}});function xv(e=Ma(import.meta.url)){try{if(He(e)==="engine.mjs")return Fr(e).href;let t=j(Ie(e),"engine.mjs");return Q(t)?Fr(t).href:void 0}catch{return}}function xh(e){let t=F.env.CODEINDEX_WORKERS,n=e??(t!==void 0&&t!==""?Number(t):void 0);if(n!==void 0)return Number.isFinite(n)&&n>0?Math.floor(n):0;let r=1;try{r=typeof Ca=="function"?Ca():Kp().length}catch{r=1}return Math.max(0,Math.min(r-1,8))}async function Ev(e,t){await fn(e.grammarKeys);let n=e.grammarKeys.filter(o=>Ue(o)),r=[];for(let o of e.jobs){let s,a;try{let u=$e(o.abs);s=u.size,a=u.mtimeMs}catch{continue}let l=se(o.abs),c=Ae(l);if(c===o.cachedHash){r.push({rel:o.rel,size:s,mtimeMs:a,hash:c});continue}let d=Ga(o.rel,o.ext,s,l,c,cn(o.ext),{maxCallsPerFile:e.maxCallsPerFile});r.push({rel:o.rel,size:s,mtimeMs:a,hash:c,record:d})}t({ready:n,records:r})}async function Sh(e,t,n,r={}){if(n<2||e.length===0)return;let o=r.engineUrl??xv();if(!o)return;let s=t.filter(m=>Ue(m)).sort(),a=Math.min(n,e.length),l=`import { runExtractWorker } from ${JSON.stringify(o)}; import { parentPort, workerData } from "node:worker_threads"; const base = workerData.input; const post = (o) => parentPort.postMessage(o); @@ -36,83 +36,83 @@ runExtractWorker({ ...base, jobs: [] }, post).then(() => { runExtractWorker({ ...base, jobs: m.jobs }, post).catch(fail); }); }).catch(fail); -`,c=new Map,d=0,u=()=>{let m=e.length-d;if(m<=0)return[];let p=Math.max(hv,Math.ceil(m/(a*gv))),g=e.slice(d,d+p);return d+=g.length,g},f=[];try{return await Promise.all(Array.from({length:a},()=>new Promise((m,p)=>{let g=new vs(l,{eval:!0,workerData:{input:{jobs:[],grammarKeys:s,maxCallsPerFile:r.maxCallsPerFile}}});f.push(g);let h=!1,_,y=()=>{_&&clearTimeout(_),_=setTimeout(()=>{b(()=>p(new Error("extraction worker timed out"))),g.terminate()},fv)},b=R=>{_&&clearTimeout(_),h=!0,R()};y();let S=0,k=()=>{let R=u();return R.length===0?!1:(S++,g.postMessage({jobs:R}),!0)};g.on("message",R=>{if(!h){if("error"in R){b(()=>p(new Error(R.error))),g.terminate();return}if(R.ready.slice().sort().join(",")!==s.join(",")){b(()=>p(new Error("extraction worker grammar tier mismatch"))),g.terminate();return}for(let I of R.records)c.set(I.rel,I.record?{size:I.size,mtimeMs:I.mtimeMs,hash:I.hash,record:I.record}:{size:I.size,mtimeMs:I.mtimeMs,hash:I.hash});if(S===0?k():S--,k(),S===0){b(()=>m()),g.postMessage({done:!0}),g.terminate();return}y()}}),g.once("error",R=>b(()=>p(R))),g.once("exit",R=>{h||b(()=>p(new Error(`extraction worker exited with ${R} before finishing`)))})}))),c}catch{for(let m of f)m.terminate();return}}async function bn(e,t={}){let n=uh(t.workers);if(n<2)return Rt(e,t);let r=t.precomputedWalk??Xe(e,Fr(e,t)),o={...t,precomputedWalk:r},s=[];for(let{f:d}of Gd(e,{...o,onSkip:void 0})){let u=t.cache?.get(d.rel);!t.fullHash&&u&&u.size!==void 0&&u.mtimeMs!==void 0&&u.size===d.size&&u.mtimeMs===d.mtimeMs||s.push(u?{abs:d.abs,rel:d.rel,ext:d.ext,cachedHash:u.hash}:{abs:d.abs,rel:d.rel,ext:d.ext})}if(s.length===0)return Rt(e,o);if(!(t.workers!==void 0||(F.env.CODEINDEX_WORKERS??"")!=="")&&s.lengthd.ext)),c=await fh(s,l,n,{maxCallsPerFile:t.maxCallsPerFile});return Rt(e,c?{...o,extracted:c}:o)}var fv,mv,gv,hv,Li=H(()=>{"use strict";$();ke();bi();me();wi();Xd();St();Ze();Cr();pt();Ut();fv=600*1e3,mv=200;gv=4,hv=4});function zt(e,t=Ve){return le(e,t)}function Ct(e){let t=new Map;for(let n of e.files)t.set(n.rel,{hash:n.hash,record:n,size:n.size,mtimeMs:e.mtimes.get(n.rel)});return t}function Zd(e,t,n=!1){let r=e.files.filter(o=>mt(o.rel,o.ext)==="code");return n&&r.length>0||r.some(o=>{let s=t.get(o.rel);return!s||s.size!==o.size||s.mtimeMs!==o.mtimeMs})}function Yd(e,t){return e>=t}function Di(e,t=Ve){let n=ji(e,t);return"unusable"in n?void 0:n}function ji(e,t=Ve){let n,r;try{let a=j(zt(e,t),"cache.json");n=ie(a,"utf8"),r=Me(a).mtimeMs}catch(a){let l=a.code;return{unusable:l==="ENOENT"||l==="ENOTDIR"?"absent":"unreadable"}}let o;try{o=JSON.parse(n)}catch{return{unusable:"corrupt"}}if(o===null||typeof o!="object"||Array.isArray(o)||typeof o.schemaVersion!="number")return{unusable:"corrupt"};if(o.schemaVersion!==5)return{unusable:"schema"};if(o.extractorVersion!==17)return{unusable:"extractor"};let s=dh(o);if(!s)return{unusable:"corrupt"};for(let[a,l]of s)if(l.mtimeMs!==void 0&&Yd(l.mtimeMs,r)){let{mtimeMs:c,...d}=l;s.set(a,d)}return{cacheMap:s,meta:{engineVersion:o.engineVersion,commit:o.commit,graphSha1:o.graphSha1,symbolsSha1:o.symbolsSha1,embed:o.embed,extraction:za(o.extraction)}}}function Rs(e,t,n){if(n===void 0)return;let r;try{r=ie(j(e,`${t}.json`))}catch{return}return Re(r)===n?r:void 0}function mh(e){if(e)try{let t=JSON.parse(e.toString("utf8"));return t.schemaVersion===5?t:void 0}catch{return}}function yv(e,t){if(e.commit===t)return e;let{schemaVersion:n,version:r,commit:o,...s}=e;return{schemaVersion:n,version:r,commit:t,...s}}function Or(e,t,n,r=Ve){if(!t.contentUnchanged||n.engineVersion!==Ie||n.graphSha1===void 0||n.symbolsSha1===void 0)return;let o=zt(e,r),s=a=>a==="graph"?n.graphSha1:n.symbolsSha1;return{bytes:a=>a==="graph"&&n.commit!==t.commit?void 0:Rs(o,a,s(a)),graph:()=>{let a=mh(Rs(o,"graph",n.graphSha1));return a&&yv(a,t.commit)},symbols:()=>mh(Rs(o,"symbols",n.symbolsSha1))}}function ph(e,t,n,r=Ve){return gh(t,Or(e,t,n,r))}function gh(e,t){let n=t?.graph(),r=n?t?.symbols():void 0;return n&&r?{scan:e,graph:n,symbols:r}:void 0}function Qd(e,t,n=Ve){let r=Di(e,n);if(!r)return;let o=Oi(r.cacheMap,r.meta.extraction,{maxCallsPerFile:t.maxCallsPerFile,ast:De}),s=Rt(e,{...t,cache:o});return{scan:s,cacheMap:Ct(s),arts:ph(e,s,r.meta,n)}}async function Ga(e,t,n,r=Ve){let o=Di(e,r);if(!o)return;let{ast:s,workers:a,...l}=t,c=l.precomputedWalk??Xe(e,Fr(e,l)),d=s===!1?new Set:Ca(),u=y=>Oi(o.cacheMap,o.meta.extraction,{maxCallsPerFile:l.maxCallsPerFile,ast:y}),f=u(y=>De(y)||d.has(y));Zd(c,f,l.fullHash)&&(await n(),f=u(De));let p=await bn(e,{...l,workers:a,cache:f,precomputedWalk:c}),g=Or(e,p,o.meta,r),h=!1,_;return{scan:p,cacheMap:Ct(p),loadArtifacts:()=>(h||(h=!0,_=gh(p,g)),_),...g?{artifacts:g}:{}}}var Ve,rr=H(()=>{"use strict";$();ke();me();bt();Pi();pt();Ut();Li();St();Ze();In();Ve=".codeindex"});function tu(e){if(e===!1)return()=>!1;let t=Ca();return n=>De(n)||t.has(n)}function nu(e,t,n,r=!1){let o={indexed:t.size,unchanged:0,touched:0,modified:0,added:0,deleted:0,reextract:0};for(let s of e){let a=t.get(s.rel);a?n(s)?!r&&a.size===s.size&&a.mtimeMs===s.mtimeMs?o.unchanged++:Re(re(s.abs))===a.hash?o.touched++:o.modified++:o.reextract++:o.added++}return o.deleted=t.size-(e.length-o.added),o}function hh(e,t,n,r){let o=Object.create(null);for(let s of e.files)o[s.rel]=[s.hash,s.size,e.mtimes.get(s.rel)];return JSON.stringify({schemaVersion:5,extractorVersion:17,engineVersion:Ie,commit:e.commit,graphSha1:t.graphSha1,symbolsSha1:t.symbolsSha1,embed:t.embed,extraction:n,cache:r,files:o})+` -`}function ru(e,t=Ve){let n=zt(e,t),r,o;try{r=JSON.parse(ie(j(n,eu),"utf8"));let{size:d,mtimeMs:u}=Me(j(n,"cache.json"));o={size:d,mtimeMs:u}}catch{return}if(r===null||typeof r!="object"||r.schemaVersion!==5||r.extractorVersion!==17)return;let s=r.cache;if(!s||s.size!==o.size||s.mtimeMs!==o.mtimeMs)return;let a=d=>typeof d=="string"?d:void 0,l=r.embed;if(l!==void 0&&(l===null||typeof l!="object")||typeof r.files!="object"||r.files===null)return;let c=new Map;for(let[d,u]of Object.entries(r.files)){if(!Array.isArray(u)||!bv(u[0])||!wv(u[1])||!xv(u[2]))return;c.set(d,Yd(u[2],o.mtimeMs)?{hash:u[0],size:u[1]}:{hash:u[0],size:u[1],mtimeMs:u[2]})}return{meta:{engineVersion:a(r.engineVersion),commit:a(r.commit),graphSha1:a(r.graphSha1),symbolsSha1:a(r.symbolsSha1),embed:l&&{embedVersion:typeof l.embedVersion=="number"?l.embedVersion:void 0,modelId:a(l.modelId),sha1:a(l.sha1)},extraction:za(r.extraction)},cache:o,files:c}}function su(e,t,n,r=Ve){let o=ru(e,r);if(!o)return;let s=Ni(o.meta.extraction,{maxCallsPerFile:t.maxCallsPerFile,ast:n}),{files:a,capped:l}=Es(e,t),c=nu(a,o.files,d=>s(mt(d.rel,d.ext),d.ext),t.fullHash);return{fresh:o,walked:a,capped:l,drift:c,commit:en(e)}}function yh(e,t,n=Ve){let{ast:r,...o}=t,s=su(e,o,tu(r),n);if(!s||!_v(s.drift))return;let a=Or(e,{contentUnchanged:!0,commit:s.commit},s.fresh.meta,n);return a&&{artifacts:a,fileCount:s.walked.length}}var eu,_v,bv,wv,xv,iu=H(()=>{"use strict";$();ke();me();bt();Pi();pt();In();rr();Ut();Ze();nn();St();eu="freshness.json";_v=e=>!(e.added||e.deleted||e.modified||e.reextract);bv=e=>typeof e=="string"&&/^[a-f0-9]{40}$/.test(e),wv=e=>typeof e=="number"&&Number.isSafeInteger(e)&&e>=0,xv=e=>typeof e=="number"&&Number.isFinite(e)});function Wi(e,t={},n=Ve){let{ast:r,...o}=t,s=zt(e,n),a=en(e)??null,c=ru(e,n)??ji(e,n);if("unusable"in c)return{indexDir:s,present:c.unusable!=="absent",usable:!1,reason:c.unusable,engineVersion:{index:null,current:Ie},commit:{index:null,head:a},files:null,artifactsFresh:!1,stale:[c.unusable]};let d=c.meta,u="files"in c?c.files:c.cacheMap,f=Ni(d.extraction,{maxCallsPerFile:o.maxCallsPerFile,ast:tu(r)}),m=Es(e,o).files,p=nu(m,u,h=>f(mt(h.rel,h.ext),h.ext),o.fullHash),g=[];return d.engineVersion!==Ie&&g.push("engine-version"),p.reextract&&g.push("extraction"),(p.added||p.deleted||p.modified)&&g.push("files"),Rs(s,"graph",d.graphSha1)||g.push("graph.json"),Rs(s,"symbols",d.symbolsSha1)||g.push("symbols.json"),{indexDir:s,present:!0,usable:!0,engineVersion:{index:d.engineVersion??null,current:Ie},commit:{index:d.commit??null,head:a},files:p,artifactsFresh:g.length===0,stale:g}}var qa=H(()=>{"use strict";$();bt();Pi();In();rr();Ut();nn();iu()});function jv(e,t,n){let r=e.dirFilesMemo??=new Map,o=n+"\0"+t,s=r.get(o);return s||r.set(o,s=(e.filesByDir.get(t)??[]).filter(a=>a.endsWith(n)).sort()),s}function du(e){let t=Ae(e).split("/").filter(o=>o!=="."),n=[],r=0;for(;rt?1:0)}function Nr(e){let t="",n=!1;for(let o=0;o{let m=e.length-d;if(m<=0)return[];let p=Math.max(Rv,Math.ceil(m/(a*vv))),g=e.slice(d,d+p);return d+=g.length,g},f=[];try{return await Promise.all(Array.from({length:a},()=>new Promise((m,p)=>{let g=new $s(l,{eval:!0,workerData:{input:{jobs:[],grammarKeys:s,maxCallsPerFile:r.maxCallsPerFile}}});f.push(g);let h=!1,_,y=()=>{_&&clearTimeout(_),_=setTimeout(()=>{b(()=>p(new Error("extraction worker timed out"))),g.terminate()},Sv)},b=C=>{_&&clearTimeout(_),h=!0,C()};y();let S=0,k=()=>{let C=u();return C.length===0?!1:(S++,g.postMessage({jobs:C}),!0)};g.on("message",C=>{if(!h){if("error"in C){b(()=>p(new Error(C.error))),g.terminate();return}if(C.ready.slice().sort().join(",")!==s.join(",")){b(()=>p(new Error("extraction worker grammar tier mismatch"))),g.terminate();return}for(let I of C.records)c.set(I.rel,I.record?{size:I.size,mtimeMs:I.mtimeMs,hash:I.hash,record:I.record}:{size:I.size,mtimeMs:I.mtimeMs,hash:I.hash});if(S===0?k():S--,k(),S===0){b(()=>m()),g.postMessage({done:!0}),g.terminate();return}y()}}),g.once("error",C=>b(()=>p(C))),g.once("exit",C=>{h||b(()=>p(new Error(`extraction worker exited with ${C} before finishing`)))})}))),c}catch{for(let m of f)m.terminate();return}}async function kn(e,t={}){let n=xh(t.workers);if(n<2)return Tt(e,t);let r=t.precomputedWalk??tt(e,Dr(e,t)),o={...t,precomputedWalk:r},s=[];for(let{f:d}of Yd(e,{...o,onSkip:void 0})){let u=t.cache?.get(d.rel);!t.fullHash&&u&&u.size!==void 0&&u.mtimeMs!==void 0&&u.size===d.size&&u.mtimeMs===d.mtimeMs||s.push(u?{abs:d.abs,rel:d.rel,ext:d.ext,cachedHash:u.hash}:{abs:d.abs,rel:d.rel,ext:d.ext})}if(s.length===0)return Tt(e,o);if(!(t.workers!==void 0||(F.env.CODEINDEX_WORKERS??"")!=="")&&s.lengthd.ext)),c=await Sh(s,l,n,{maxCallsPerFile:t.maxCallsPerFile});return Tt(e,c?{...o,extracted:c}:o)}var Sv,kv,vv,Rv,zi=z(()=>{"use strict";$();Re();vi();ge();Ri();ru();At();nt();Tr();wt();Jt();Sv=600*1e3,kv=200;vv=4,Rv=4});function Kt(e,t=Ye){return ce(e,t)}function Ft(e){let t=new Map;for(let n of e.files)t.set(n.rel,{hash:n.hash,record:n,size:n.size,mtimeMs:e.mtimes.get(n.rel)});return t}function su(e,t,n=!1){let r=e.files.filter(o=>bt(o.rel,o.ext)==="code");return n&&r.length>0||r.some(o=>{let s=t.get(o.rel);return!s||s.size!==o.size||s.mtimeMs!==o.mtimeMs})}function iu(e,t){return e>=t}function Hi(e,t=Ye){let n=Gi(e,t);return"unusable"in n?void 0:n}function Gi(e,t=Ye){let n,r;try{let a=j(Kt(e,t),"cache.json");n=oe(a,"utf8"),r=$e(a).mtimeMs}catch(a){let l=a.code;return{unusable:l==="ENOENT"||l==="ENOTDIR"?"absent":"unreadable"}}let o;try{o=JSON.parse(n)}catch{return{unusable:"corrupt"}}if(o===null||typeof o!="object"||Array.isArray(o)||typeof o.schemaVersion!="number")return{unusable:"corrupt"};if(o.schemaVersion!==5)return{unusable:"schema"};if(o.extractorVersion!==18)return{unusable:"extractor"};let s=wh(o);if(!s)return{unusable:"corrupt"};for(let[a,l]of s)if(l.mtimeMs!==void 0&&iu(l.mtimeMs,r)){let{mtimeMs:c,...d}=l;s.set(a,d)}return{cacheMap:s,meta:{engineVersion:o.engineVersion,commit:o.commit,graphSha1:o.graphSha1,symbolsSha1:o.symbolsSha1,embed:o.embed,extraction:Xa(o.extraction)}}}function Ts(e,t,n){if(n===void 0)return;let r;try{r=oe(j(e,`${t}.json`))}catch{return}return Ae(r)===n?r:void 0}function kh(e){if(e)try{let t=JSON.parse(e.toString("utf8"));return t.schemaVersion===5?t:void 0}catch{return}}function Cv(e,t){if(e.commit===t)return e;let{schemaVersion:n,version:r,commit:o,...s}=e;return{schemaVersion:n,version:r,commit:t,...s}}function jr(e,t,n,r=Ye){if(!t.contentUnchanged||n.engineVersion!==Ne||n.graphSha1===void 0||n.symbolsSha1===void 0)return;let o=Kt(e,r),s=a=>a==="graph"?n.graphSha1:n.symbolsSha1;return{bytes:a=>a==="graph"&&n.commit!==t.commit?void 0:Ts(o,a,s(a)),graph:()=>{let a=kh(Ts(o,"graph",n.graphSha1));return a&&Cv(a,t.commit)},symbols:()=>kh(Ts(o,"symbols",n.symbolsSha1))}}function Eh(e,t,n,r=Ye){return vh(t,jr(e,t,n,r))}function vh(e,t){let n=t?.graph(),r=n?t?.symbols():void 0;return n&&r?{scan:e,graph:n,symbols:r}:void 0}function ou(e,t,n=Ye){let r=Hi(e,n);if(!r)return;let o=Wi(r.cacheMap,r.meta.extraction,{maxCallsPerFile:t.maxCallsPerFile,ast:Ue}),s=Tt(e,{...t,cache:o});return{scan:s,cacheMap:Ft(s),arts:Eh(e,s,r.meta,n)}}async function Ya(e,t,n,r=Ye){let o=Hi(e,r);if(!o)return;let{ast:s,workers:a,...l}=t,c=l.precomputedWalk??tt(e,Dr(e,l)),d=s===!1?new Set:Oa(),u=y=>Wi(o.cacheMap,o.meta.extraction,{maxCallsPerFile:l.maxCallsPerFile,ast:y}),f=u(y=>Ue(y)||d.has(y));su(c,f,l.fullHash)&&(await n(),f=u(Ue));let p=await kn(e,{...l,workers:a,cache:f,precomputedWalk:c}),g=jr(e,p,o.meta,r),h=!1,_;return{scan:p,cacheMap:Ft(p),loadArtifacts:()=>(h||(h=!0,_=vh(p,g)),_),...g?{artifacts:g}:{}}}var Ye,lr=z(()=>{"use strict";$();Re();ge();Rt();Ui();wt();Jt();zi();At();nt();Fn();Ye=".codeindex"});function lu(e){if(e===!1)return()=>!1;let t=Oa();return n=>Ue(n)||t.has(n)}function cu(e,t,n,r=!1){let o={indexed:t.size,unchanged:0,touched:0,modified:0,added:0,deleted:0,reextract:0};for(let s of e){let a=t.get(s.rel);a?n(s)?!r&&a.size===s.size&&a.mtimeMs===s.mtimeMs?o.unchanged++:Ae(se(s.abs))===a.hash?o.touched++:o.modified++:o.reextract++:o.added++}return o.deleted=t.size-(e.length-o.added),o}function Rh(e,t,n,r){let o=Object.create(null);for(let s of e.files)o[s.rel]=[s.hash,s.size,e.mtimes.get(s.rel)];return JSON.stringify({schemaVersion:5,extractorVersion:18,engineVersion:Ne,commit:e.commit,graphSha1:t.graphSha1,symbolsSha1:t.symbolsSha1,embed:t.embed,extraction:n,cache:r,files:o})+` +`}function du(e,t=Ye){let n=Kt(e,t),r,o;try{r=JSON.parse(oe(j(n,au),"utf8"));let{size:d,mtimeMs:u}=$e(j(n,"cache.json"));o={size:d,mtimeMs:u}}catch{return}if(r===null||typeof r!="object"||r.schemaVersion!==5||r.extractorVersion!==18)return;let s=r.cache;if(!s||s.size!==o.size||s.mtimeMs!==o.mtimeMs)return;let a=d=>typeof d=="string"?d:void 0,l=r.embed;if(l!==void 0&&(l===null||typeof l!="object")||typeof r.files!="object"||r.files===null)return;let c=new Map;for(let[d,u]of Object.entries(r.files)){if(!Array.isArray(u)||!Av(u[0])||!Iv(u[1])||!$v(u[2]))return;c.set(d,iu(u[2],o.mtimeMs)?{hash:u[0],size:u[1]}:{hash:u[0],size:u[1],mtimeMs:u[2]})}return{meta:{engineVersion:a(r.engineVersion),commit:a(r.commit),graphSha1:a(r.graphSha1),symbolsSha1:a(r.symbolsSha1),embed:l&&{embedVersion:typeof l.embedVersion=="number"?l.embedVersion:void 0,modelId:a(l.modelId),sha1:a(l.sha1)},extraction:Xa(r.extraction)},cache:o,files:c}}function uu(e,t,n,r=Ye){let o=du(e,r);if(!o)return;let s=Bi(o.meta.extraction,{maxCallsPerFile:t.maxCallsPerFile,ast:n}),{files:a,capped:l}=Is(e,t),c=cu(a,o.files,d=>s(bt(d.rel,d.ext),d.ext),t.fullHash);return{fresh:o,walked:a,capped:l,drift:c,commit:on(e)}}function Ch(e,t,n=Ye){let{ast:r,...o}=t,s=uu(e,o,lu(r),n);if(!s||!Mv(s.drift))return;let a=jr(e,{contentUnchanged:!0,commit:s.commit},s.fresh.meta,n);return a&&{artifacts:a,fileCount:s.walked.length}}var au,Mv,Av,Iv,$v,fu=z(()=>{"use strict";$();Re();ge();Rt();Ui();wt();Fn();lr();Jt();nt();ln();At();au="freshness.json";Mv=e=>!(e.added||e.deleted||e.modified||e.reextract);Av=e=>typeof e=="string"&&/^[a-f0-9]{40}$/.test(e),Iv=e=>typeof e=="number"&&Number.isSafeInteger(e)&&e>=0,$v=e=>typeof e=="number"&&Number.isFinite(e)});function qi(e,t={},n=Ye){let{ast:r,...o}=t,s=Kt(e,n),a=on(e)??null,c=du(e,n)??Gi(e,n);if("unusable"in c)return{indexDir:s,present:c.unusable!=="absent",usable:!1,reason:c.unusable,engineVersion:{index:null,current:Ne},commit:{index:null,head:a},files:null,artifactsFresh:!1,stale:[c.unusable]};let d=c.meta,u="files"in c?c.files:c.cacheMap,f=Bi(d.extraction,{maxCallsPerFile:o.maxCallsPerFile,ast:lu(r)}),m=Is(e,o).files,p=cu(m,u,h=>f(bt(h.rel,h.ext),h.ext),o.fullHash),g=[];return d.engineVersion!==Ne&&g.push("engine-version"),p.reextract&&g.push("extraction"),(p.added||p.deleted||p.modified)&&g.push("files"),Ts(s,"graph",d.graphSha1)||g.push("graph.json"),Ts(s,"symbols",d.symbolsSha1)||g.push("symbols.json"),{indexDir:s,present:!0,usable:!0,engineVersion:{index:d.engineVersion??null,current:Ne},commit:{index:d.commit??null,head:a},files:p,artifactsFresh:g.length===0,stale:g}}var Qa=z(()=>{"use strict";$();Rt();Ui();Fn();lr();Jt();ln();fu()});function Kv(e,t,n){let r=e.dirFilesMemo??=new Map,o=n+"\0"+t,s=r.get(o);return s||r.set(o,s=(e.filesByDir.get(t)??[]).filter(a=>a.endsWith(n)).sort()),s}function yu(e){let t=Te(e).split("/").filter(o=>o!=="."),n=[],r=0;for(;rt?1:0)}function Wr(e){let t="",n=!1;for(let o=0;o=Vv)){if(typeof e=="string")t.includes(e)||t.push(e);else if(Array.isArray(e))for(let n of e)Ka(n,t);else if(e!==null&&typeof e=="object"){let n=Object.keys(e).sort((r,o)=>Rh(r)-Rh(o)||(ro?1:0));for(let r of n)Ka(e[r],t)}}}function Jv(e){if(e==null)return[];let t=[],n=(r,o)=>{let s=[];Ka(o,s),s.length&&t.push({key:r,star:r.includes("*"),targets:s})};if(typeof e=="string"||Array.isArray(e))n(".",e);else if(typeof e=="object"){let r=Object.keys(e);if(r.every(o=>o==="."||o.startsWith("./")))for(let o of r)n(o,e[o]);else n(".",e)}return t.sort((r,o)=>Number(r.star)-Number(o.star)||o.key.length-r.key.length||(r.keyNumber(n.star)-Number(r.star)||r.key.length-n.key.length||T(n.key,r.key)),t}function Ch(e,t){for(let n of e){if(!n.star){if(n.key===t)return n.targets;continue}let r=n.key.indexOf("*"),o=n.key.slice(0,r),s=n.key.slice(r+1);if(!t.startsWith(o)||!t.endsWith(s)||t.lengthl.replace(/\*/g,()=>a))}}function Xv(e,t){let n=[],r=o=>{let s=/^\s*([^\s=]+)(?:\s+v\S+)?\s*=>\s*(\S+)(?:\s+v\S+)?\s*$/.exec(o);if(!s)return;let a=s[2];if(!/^\.\.?\//.test(a))return;let l=Ae(J.join(t,a));l.startsWith("..")||n.push({from:s[1],toDir:l})};for(let o of e.matchAll(/^[ \t]*replace[ \t]+([^(\r\n][^\r\n]*)$/gm))r(o[1]);for(let o of e.matchAll(/^[ \t]*replace[ \t]*\(([\s\S]*?)\)/gm))for(let s of o[1].split(/\r?\n/))r(s);return n}function Zv(e,t){let n={dir:t,deps:new Map},r=l=>{let c=/^(?:"([^"]*)"|'([^']*)')$/.exec(l);return c?c[1]??c[2]:void 0},o=(l,c)=>{let d=l.get(c);return d||l.set(c,d={}),d},s=(l,c,d)=>{c==="package"||c==="path"?l[c]=r(d)??l[c]:c==="workspace"&&(l.workspace=d==="true")},a="";for(let l of e.split(/\r?\n/)){let c=l.replace(/^((?:[^"'#]|"[^"]*"|'[^']*')*)#.*$/,"$1").trim(),d=/^\[\[?([^\]]+)\]\]?$/.exec(c);if(d){a=d[1].replace(/["'\s]/g,""),(a==="workspace"||a.startsWith("workspace."))&&(n.workspaceDeps??=new Map);continue}let u=/^([\w.-]+)\s*=\s*(.+)$/.exec(c);if(!u)continue;let f=u[1],m=u[2];if(a==="package"){f==="name"?n.packageName=r(m)??n.packageName:f==="edition"?n.edition=r(m)??(/workspace\s*=\s*true/.test(m)?"workspace":void 0):f==="edition.workspace"&&(n.edition="workspace");continue}if(a==="lib"){f==="name"?n.libName=r(m)??n.libName:f==="path"&&(n.libPath=r(m)??n.libPath);continue}let p=/^(?:(workspace)\.|target\..+\.)?(?:dev-|build-)?dependencies(?:\.(.+))?$/.exec(a);if(!p)continue;let g=p[1]?n.workspaceDeps:n.deps;if(p[2]){s(o(g,p[2]),f,m);continue}let h=/^([\w-]+)\.(package|path|workspace)$/.exec(f);if(h)s(o(g,h[1]),h[2],m);else if(m.startsWith("{")){let _=o(g,f);for(let y of m.matchAll(/\b(package|path|workspace)\s*=\s*("[^"]*"|'[^']*'|true|false)/g))s(_,y[1],y[2])}}return n}function Yv(e,t){let n=[],r=[...t].filter(c=>c==="Cargo.toml"||c.endsWith("/Cargo.toml"));for(let c of r.sort(T))n.push(Zv(re(j(e,c)),c.includes("/")?J.dirname(c):""));let o=n.filter(c=>c.packageName!==void 0),s=new Map(o.map(c=>[c.dir,c])),a=(c,d)=>!d||c===d||c.startsWith(d+"/"),l=[];for(let c of o){let d=Ae(J.join(c.dir,"src")).replace(/^\.$/,""),u=c.libPath?Ae(J.join(c.dir,c.libPath)):void 0,f=u&&!u.startsWith("..")&&t.has(u)?u:void 0,m=f?f.includes("/")?J.dirname(f):"":d,p=f??Hv(t,[J.join(d,"lib.rs"),J.join(d,"main.rs")]),g=n.filter(_=>_.workspaceDeps&&a(c.dir,_.dir)).sort((_,y)=>y.dir.length-_.dir.length)[0],h=new Map;for(let[_,y]of[...c.deps].sort((b,S)=>T(b[0],S[0]))){let b=y.workspace?g?.workspaceDeps?.get(_):y;if(!b?.package)continue;let S=y.workspace?g.dir:c.dir,k=b.path?s.get(Ae(J.join(S,b.path)).replace(/^\.$/,"")):o.find(R=>R.packageName===b.package);k&&h.set(_.replace(/-/g,"_"),k.dir)}l.push({name:(c.libName??c.packageName).replace(/-/g,"_"),dir:c.dir,srcDir:m,rootFile:p,...h.size?{renames:h}:{},...c.edition===void 0||c.edition==="2015"?{edition2015:!0}:{}})}return l.sort((c,d)=>d.dir.length-c.dir.length||(c.dirv.rel)),n=new Map,r=new Set;for(let v of e.files){let C=v.rel.includes("/")?J.dirname(v.rel):"",M=n.get(C);M||n.set(C,M=[]),M.push(v.rel);let x=C;for(;x&&!r.has(x);)r.add(x),x=x.includes("/")?J.dirname(x):""}let o=[],s=[],a=[],l=[];for(let v of t){if(v!=="package.json"&&!v.endsWith("/package.json"))continue;let C=Nr(re(j(e.root,v)));if(C===void 0){s.push(`unparseable ${v} \u2014 skipped for workspace resolution`);continue}let M=v.includes("/")?J.dirname(v):"";if(l.push({dir:M,importEntries:Kv(C.imports)}),typeof C.name!="string")continue;let x=[C.source,C.main,C.module,C.types].filter(w=>typeof w=="string");a.push({name:C.name,dir:M,exportEntries:Jv(C.exports),mainCandidates:x,...typeof C.tsconfig=="string"?{tsconfig:C.tsconfig}:{}})}a.sort((v,C)=>C.name.length-v.name.length),l.sort((v,C)=>C.dir.length-v.dir.length||T(v.dir,C.dir));let c=[];for(let v of t){let C=v.slice(v.lastIndexOf("/")+1);if(C!=="tsconfig.json"&&C!=="jsconfig.json"&&!(v==="tsconfig.base.json"))continue;let x=v.includes("/")?J.dirname(v):"",w=Ph(e.root,t,v,o,new Set,a);if(!w||!w.paths&&w.baseUrl===void 0)continue;let E=w.baseUrl===void 0?w.pathsDir:w.baseUrl.startsWith(Ja)?Ae(J.join(x,w.baseUrl.slice(Ja.length))).replace(/^\.$/,""):Ae(J.join(w.baseUrlDir,w.baseUrl)).replace(/^\.$/,""),N=J.relative(E,x)||".",O=[];for(let[L,G]of Object.entries(w.paths??{})){if(!Array.isArray(G))continue;let X=L.endsWith("*");O.push({prefix:X?L.slice(0,-1):L,star:X,targets:G.filter(oe=>typeof oe=="string").map(oe=>oe.startsWith(Ja)?J.join(N,oe.slice(Ja.length)):oe)})}O.sort((L,G)=>Number(L.star)-Number(G.star)||G.prefix.length-L.prefix.length||T(L.prefix,G.prefix)),!(!O.length&&w.baseUrl===void 0)&&c.push({dir:x,file:C,baseUrl:E,baseUrlSet:w.baseUrl!==void 0,paths:O})}let d=v=>v==="tsconfig.json"?0:v==="jsconfig.json"?1:2;c.sort((v,C)=>C.dir.length-v.dir.length||d(v.file)-d(C.file)),o.push(...s);let u=[];for(let v of t){if(v!=="go.mod"&&!v.endsWith("/go.mod"))continue;let C=re(j(e.root,v)),M=/^\s*module\s+(\S+)/m.exec(C);if(!M)continue;let x=v.includes("/")?J.dirname(v):"";u.push({module:M[1],dir:x,replaces:Xv(C,x)})}u.sort((v,C)=>C.dir.length-v.dir.length||(v.dirC.prefix.length-v.prefix.length);let b=new Map;for(let v of e.files){if(v.ext!==".cs"||!v.pkg)continue;let C=b.get(v.pkg);C||b.set(v.pkg,C=[]),C.push(v.rel)}for(let v of b.values())v.sort(T);let S=[...m].sort(Ui),k=new Map,R=[...t].filter(v=>v==="pubspec.yaml"||v.endsWith("/pubspec.yaml"));for(let v of R.sort(T)){let C=/^name:[ \t]*["']?(\w+)["']?[ \t]*(?:#.*)?$/m.exec(re(j(e.root,v)));C&&!k.has(C[1])&&k.set(C[1],v.includes("/")?J.dirname(v):"")}let I=new Set([""]);for(let v of r){let C=v.slice(v.lastIndexOf("/")+1);(C==="lua"||C==="src"||C==="lib")&&I.add(v)}let P=new Map;for(let v of e.files)if(!(v.ext!==".ex"&&v.ext!==".exs"))for(let C of v.symbols){if(C.kind!=="module")continue;let M=C.parentPath?C.parentPath.replace(/\//g,"."):C.parent,x=M?M+"."+C.name:C.name,w=P.get(x);(w===void 0||T(v.rel,w)<0)&&P.set(x,v.rel)}return{fileSet:t,dirSet:r,filesByDir:n,tsConfigs:c,goModules:u,rustCrates:f,javaRoots:S,jvm:Lh({filesByDir:n,javaRoots:S},e.files),dartPackages:k,luaRoots:[...I].sort(Ui),root:e.root,svelteKitRoots:[...t].filter(v=>/(?:^|\/)svelte\.config\.(?:js|ts|mjs|cjs)$/.test(v)).map(v=>v.includes("/")?J.dirname(v):"").sort((v,C)=>C.length-v.length||T(v,C)),elixirModules:P,pyRoots:[...g].sort(Ui),workspacePackages:a,packageScopes:l,cIncludeRoots:[...h].sort(Ui),rubyLibRoots:[..._].sort(Ui),phpPsr4:y,csharpNamespaces:b,warnings:o}}function Ht(e,t){for(let n of t){let r=Ae(n);if(r&&!r.startsWith("..")&&e.fileSet.has(r))return r}}function sr(e,t,n){let r=t.split("#")[0].split("?")[0];if(!r)return{kind:"external"};if(r.startsWith("//")||/^[a-z][a-z0-9+.-]*:/i.test(r))return{kind:"external"};let o=r.startsWith("/"),s=o||!e.includes("/")?"":J.dirname(e),a=Ae(J.join(s,o?r.slice(1):r));if(a==="."&&(a=""),a.startsWith(".."))return{kind:"dangling",reason:"escapes-repo-root"};let l=u=>[u,u+".md",u+".mdx",J.join(u,"README.md"),J.join(u,"readme.md"),J.join(u,"index.md"),J.join(u,"index.mdx")],c=a;try{c=Ae(decodeURIComponent(a))}catch{}if(c.startsWith(".."))return{kind:"dangling",reason:"escapes-repo-root"};let d=Ht(n,c===a?l(a):[...l(a),...l(c)]);return d?{kind:"resolved",target:d}:!a||n.dirSet.has(a)?{kind:"external"}:n.root&&[a,c].some(u=>Q(j(n.root,u)))?{kind:"external"}:{kind:"dangling",reason:"missing-target"}}function Qv(e,t,n){let r=f=>Ht(n,[...Bv.map(m=>f+m),...Uv.map(m=>J.join(f,m))]),o=f=>{let m=r(f);if(m)return m;let p=f.replace(/\.(js|jsx|mjs|cjs)$/,"");return p!==f?r(p):void 0},s=(f,m)=>{for(let p of[m,...du(m)]){let g=o(Ae(J.join(f,p)));if(g)return g}},a=t.indexOf("?"),l=a===-1?t:t.slice(0,a);if(!l)return{kind:"external"};let c=n.svelteKitRoots?.find(f=>!f||e.startsWith(f+"/"));if(l.startsWith(".")){let f=e.includes("/")?J.dirname(e):"",m=Ae(J.join(f,l));if(m.startsWith(".."))return{kind:"dangling",reason:"escapes-repo-root"};let p=o(m);return p?{kind:"resolved",target:p}:c!==void 0&&/(?:^|\/)\$types(?:\.d\.ts|\.js)?$/.test(l)?{kind:"external"}:{kind:"dangling",reason:"missing-module"}}let d,u;for(let f of n.tsConfigs){if(f.dir&&e!==f.dir&&!e.startsWith(f.dir+"/"))continue;u===void 0&&f.baseUrlSet&&(u=f.baseUrl);let m=!1;for(let p of f.paths){if(!(p.star?l.startsWith(p.prefix):l===p.prefix))continue;m=!0;let g=p.star?l.slice(p.prefix.length):"",h=!1;for(let _ of p.targets){let y=p.star?_.replace(/\*/,()=>g):_,b=Ae(J.join(f.baseUrl,y)),S=o(b);if(S)return{kind:"resolved",target:S};let k=b.includes("/")?J.dirname(b):"";(n.dirSet.has(k)||n.fileSet.has(b))&&(h=!0)}d=h?{kind:"dangling",reason:"alias-unresolved"}:{kind:"external"};break}if(m)break}if(u!==void 0&&!l.startsWith("/")){let f=o(Ae(J.join(u,l)));if(f)return{kind:"resolved",target:f}}if(c!==void 0&&!d&&(l==="$lib"||l.startsWith("$lib/"))){let f=Ae(J.join(c,"src/lib",l.slice(4))),m=o(f);if(m)return{kind:"resolved",target:m};if(n.dirSet.has(Ae(J.join(c,"src/lib"))))return{kind:"dangling",reason:"alias-unresolved"}}if(l.startsWith("#")){let f=n.packageScopes.find(p=>!p.dir||e.startsWith(p.dir+"/")),m=f?Ch(f.importEntries,l):void 0;for(let p of m??[]){let g=f&&p.startsWith("./")?s(f.dir,p):void 0;if(g)return{kind:"resolved",target:g}}return d??{kind:"external"}}for(let f of n.workspacePackages){if(l!==f.name&&!l.startsWith(f.name+"/"))continue;let m=l.slice(f.name.length).replace(/^\//,"");for(let g of Ch(f.exportEntries,m?"./"+m:".")??[]){let h=s(f.dir,g);if(h)return{kind:"resolved",target:h}}if(!m)for(let g of f.mainCandidates){let h=s(f.dir,g);if(h)return{kind:"resolved",target:h}}let p=m?[J.join(f.dir,"src",m),J.join(f.dir,m)]:[J.join(f.dir,"src","index"),J.join(f.dir,"index"),J.join(f.dir,"src")];for(let g of p){let h=o(Ae(g));if(h)return{kind:"resolved",target:h}}return{kind:"external"}}return d??{kind:"external"}}function e0(e,t,n){let r=(a,l)=>{let c=l?l.replace(/\./g,"/"):"",d=Ae(J.join(a,c));return Ht(n,[d+".py",d+".pyi",J.join(d,"__init__.py")])};if(t.startsWith(".")){let a=/^\.+/.exec(t)[0].length,l=t.slice(a),c=e.includes("/")?J.dirname(e):"",d=c?c.split("/"):[];if(a-1>d.length)return{kind:"dangling",reason:"escapes-repo-root"};let u=d.slice(0,d.length-(a-1)).join("/");if(l){let m=r(u,l);return m?{kind:"resolved",target:m}:{kind:"dangling",reason:"missing-module"}}let f=Ht(n,[J.join(u,"__init__.py")]);return f?{kind:"resolved",target:f}:{kind:"external"}}let o=[],s=[];for(let a of n.pyRoots)(!a||e.startsWith(a+"/")?o:s).push(a);for(let a of[...o.reverse(),...s]){let l=r(a,t);if(l)return{kind:"resolved",target:l}}return{kind:"external"}}function t0(e,t,n){if(!n.goModules.length)return{kind:"external"};let r=c=>{let d=Ae(c).replace(/^\.$/,""),u=jv(n,d,".go"),f=u.find(m=>!m.endsWith("_test.go"))??u[0];return f?{kind:"resolved",target:f}:{kind:"dangling",reason:"missing-package"}},o=n.goModules.find(c=>!c.dir||e===c.dir||e.startsWith(c.dir+"/"));if(o)for(let c of o.replaces){if(t!==c.from&&!t.startsWith(c.from+"/"))continue;let d=t.slice(c.from.length).replace(/^\//,"");return r(J.join(c.toDir,d))}let s;for(let c of n.goModules)t!==c.module&&!t.startsWith(c.module+"/")||(!s||c.module.length>s.module.length||c.module.length===s.module.length&&c===o)&&(s=c);if(!s)return{kind:"external"};let a=Ae(J.join(s.dir,t.slice(s.module.length).replace(/^\//,""))).replace(/^\.$/,""),l=(c,d)=>!d||c===d||c.startsWith(d+"/");return n.goModules.some(c=>c!==s&&c.dir!==s.dir&&l(c.dir,s.dir)&&l(a,c.dir))?{kind:"dangling",reason:"missing-package"}:r(a)}function n0(e,t,n){if(!n.rustCrates.length)return{kind:"external"};let r=(b,S)=>Ht(n,[J.join(b,S+".rs"),J.join(b,S,"mod.rs")]),o=(b,S)=>{for(let k=S.length;k>=1;k--){let R=Ae(J.join(b,...S.slice(0,k-1))),I=r(R,S[k-1]);if(I)return I}},s=e.includes("/")?J.dirname(e):"",a=e.slice(e.lastIndexOf("/")+1).replace(/\.rs$/,""),l=a==="mod"||a==="lib"||a==="main",c=l?s:J.join(s,a);if(t.startsWith("mod ")){let b=t.slice(4),S=r(c,b)??(l?void 0:r(s,b));return S?{kind:"resolved",target:S}:{kind:"dangling",reason:"missing-module"}}if(t.startsWith("mod-path ")){let b=Ae(J.join(s,t.slice(9)));return b.startsWith("..")?{kind:"dangling",reason:"escapes-repo-root"}:n.fileSet.has(b)?{kind:"resolved",target:b}:{kind:"dangling",reason:"missing-module"}}let d=t.split("::").map(b=>b.trim()).filter(Boolean);if(!d.length)return{kind:"external"};let u=d[0],f=n.rustCrates.find(b=>!b.dir||e===b.dir||e.startsWith(b.dir+"/")),m,p=[];if(u==="crate"&&f)m=f.srcDir,p=d.slice(1);else if(u==="self")m=c,p=d.slice(1);else if(u==="super"){let b=l?s.includes("/")?J.dirname(s):"":s,S=1;for(;SR.dir===S):n.rustCrates.find(R=>R.name===u);if(k){let R=o(k.srcDir,d.slice(1));if(R)return{kind:"resolved",target:R};if(k.rootFile)return{kind:"resolved",target:k.rootFile}}return{kind:"external"}}if(!p.length)return{kind:"external"};let g=o(m,p);if(g)return{kind:"resolved",target:g};if(f&&m===f.srcDir&&f.rootFile)return{kind:"resolved",target:f.rootFile};let h=m.includes("/")?J.dirname(m):"",_=m.slice(m.lastIndexOf("/")+1),y=_?r(h,_):void 0;return y&&y!==e?{kind:"resolved",target:y}:{kind:"external"}}function*r0(e,t){for(let n=e;;n=n.includes("/")?J.dirname(n):""){let r=t.get(n);if(r!==void 0){let o=n?e.slice(n.length+1):e;o.includes(".")||(yield{rank:r,pkg:o.replace(/\//g,".")})}if(!n)return}}function Lh(e,t=[]){let n={types:new Map,packages:new Map,scalaPkg:new Map};s0(n,e);let r=t.filter(s=>cu.has(s.ext)&&s.pkg).sort((s,a)=>T(s.rel,a.rel)),o=(s,a,l)=>{s.has(a)||s.set(a,l)};for(let s of r){Oh.has(s.ext)&&n.scalaPkg.set(s.rel,s.pkg),o(n.packages,s.pkg,s.rel);for(let a of s.symbols)!a.parent&&a.kind!=="package"&&o(n.types,s.pkg+"."+a.name,s.rel)}for(let s of r){let a=s.rel.slice(s.rel.lastIndexOf("/")+1,s.rel.length-s.ext.length);/^\w+$/.test(a)&&(o(n.types,s.pkg+"."+a,s.rel),Fh.has(s.ext)&&o(n.types,s.pkg+"."+a+"Kt",s.rel))}return n}function s0(e,t){let n=new Map(t.javaRoots.map((c,d)=>[c,d]));if(!n.size)return;let{types:r,packages:o}=e,s=new Map,a=new Map,l=(c,d,u,f,m)=>{f>=(d.get(u)??1/0)||(d.set(u,f),c.set(u,m))};for(let[c,d]of t.filesByDir){let u=d.filter(m=>m.endsWith(".java"));if(!u.length)continue;let f=u.reduce((m,p)=>p=Math.min(2,n.length);r--){let o=e.types.get(r===n.length?n.join("."):n.slice(0,r).join("."));if(o)return o}}function i0(e,t,n){let r=n.jvm??=Lh(n),o=Mh(r,t),s=o?void 0:r.scalaPkg.get(e);for(let a=s;a&&!o;a=a.includes(".")?a.slice(0,a.lastIndexOf(".")):void 0)o=Mh(r,a+"."+t);return o?{kind:"resolved",target:o}:{kind:"external"}}function l0(e,t,n){let r=e.includes("/")?J.dirname(e):"",o=Ht(n,[J.join(r,t),...n.cIncludeRoots.map(s=>J.join(s,t))]);return o?{kind:"resolved",target:o}:o0.has(t)||a0.test(t)?{kind:"external"}:{kind:"dangling",reason:"missing-include"}}function c0(e,t,n){if(t.startsWith(".")){let r=e.includes("/")?J.dirname(e):"",o=Ae(J.join(r,t)),s=Ht(n,[o+".rb",J.join(o,"index.rb")]);return s?{kind:"resolved",target:s}:{kind:"dangling",reason:"missing-module"}}for(let r of n.rubyLibRoots){let o=Ht(n,[J.join(r,t+".rb")]);if(o)return{kind:"resolved",target:o}}return{kind:"external"}}function d0(e,t,n){if(t.startsWith(".")){let o=e.includes("/")?J.dirname(e):"",s=Ae(J.join(o,t)),a=Ht(n,[s,s+".php"]);return a?{kind:"resolved",target:a}:{kind:"dangling",reason:"missing-module"}}let r=t.replace(/^\\+/,"");for(let{prefix:o,dir:s}of n.phpPsr4){if(o&&r!==o&&!r.startsWith(o+"\\"))continue;let a=o?r.slice(o.length).replace(/^\\+/,""):r,l=Ht(n,[J.join(s,a.replace(/\\/g,"/"))+".php"]);if(l)return{kind:"resolved",target:l}}return{kind:"external"}}function u0(e,t){let n=t.csharpNamespaces.get(e);if(n?.length)return{kind:"resolved",target:n[0]};let r=(t.csharpPrefix??=f0(t.csharpNamespaces)).get(e);return r?{kind:"resolved",target:r}:{kind:"external"}}function f0(e){let t=new Map;for(let[n,r]of e){let o=r[0];if(o!==void 0)for(let s=n.indexOf(".");;s=n.indexOf(".",s+1)){let a=s===-1?n:n.slice(0,s),l=t.get(a);if((l===void 0||T(o,l)<0)&&t.set(a,o),s===-1)break}}return t}function m0(e,t,n){let r,o=/^package:([^/]+)\/(.+)$/.exec(t);if(o){let s=n.dartPackages?.get(o[1]);if(s===void 0)return{kind:"external"};r=Ae(J.join(s,"lib",o[2]))}else{if(/^[a-z][\w+.-]*:/i.test(t)||t.startsWith("/"))return{kind:"external"};r=Ae(J.join(e.includes("/")?J.dirname(e):"",t))}return r.startsWith("..")?{kind:"dangling",reason:"escapes-repo-root"}:n.fileSet.has(r)?{kind:"resolved",target:r}:/\.[\w-]+\.dart$/.test(r.slice(r.lastIndexOf("/")+1))?{kind:"external"}:{kind:"dangling",reason:"missing-module"}}function p0(e,t,n){let r=t.replace(/\./g,"/"),o=e.includes("/")?J.dirname(e):"",s=n.luaRoots??[""],a=s.filter(c=>!c||o===c||o.startsWith(c+"/")).reverse(),l=[...a,o,...s.filter(c=>!a.includes(c))];for(let c of l){let d=Ht(n,[J.join(c,r+".lua"),J.join(c,r,"init.lua")]);if(d)return{kind:"resolved",target:d}}return{kind:"external"}}function g0(e,t,n){let r=e.includes("/")?J.dirname(e):"",o=Ht(n,[J.join(r,t),t]);return o?{kind:"resolved",target:o}:{kind:"external"}}function Dh(e){return Ah.has(e)||Ih.has(e)||$h.has(e)||Th.has(e)||cu.has(e)||Nh.has(e)||h0.has(e)}function ct(e,t,n,r){if(Ah.has(t)||Ih.has(t)){let o=n.lastIndexOf(".");if(o!==-1&&Wv.has(n.slice(o).toLowerCase().replace(/[?#].*$/,"")))return{kind:"external"};let a=(e.includes("/")?J.dirname(e):"")+"\0"+n,l=r.jsMemo??=new Map,c=l.get(a);return c||l.set(a,c=Qv(e,n,r)),{...c}}if($h.has(t)){let s=(e.includes("/")?J.dirname(e):"")+"\0"+n,a=r.pyMemo??=new Map,l=a.get(s);return l||a.set(s,l=e0(e,n,r)),{...l}}if(t===".go")return t0(e,n,r);if(t===".rs")return n0(e,n,r);if(t===".java"||cu.has(t))return i0(e,n,r);if(Th.has(t))return l0(e,n,r);if(t===".rb"||t===".rake")return c0(e,n,r);if(t===".php")return d0(e,n,r);if(t===".cs")return u0(n,r);if(t===".dart")return m0(e,n,r);if(t===".lua")return p0(e,n,r);if(Nh.has(t))return g0(e,n,r);if(t===".ex"||t===".exs"){let o=r.elixirModules?.get(n);return o?{kind:"resolved",target:o}:{kind:"external"}}return{kind:"external"}}var Wv,Bv,Uv,Ah,Ih,$h,Th,Fh,Oh,cu,Nh,zv,Ja,lu,Vv,o0,a0,h0,$n=H(()=>{"use strict";$();ke();me();me();Ze();ce();Wv=new Set([".svg",".png",".jpg",".jpeg",".gif",".webp",".bmp",".ico",".icns",".pdf",".woff",".woff2",".ttf",".otf",".eot",".mp3",".mp4",".mov",".avi",".webm",".wav",".flac",".ogg",".map"]),Bv=["",".ts",".tsx",".d.ts",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".svelte",".astro",".html",".htm"],Uv=["index.ts","index.tsx","index.js","index.jsx","index.mjs","index.cjs"],Ah=new Set([".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"]),Ih=new Set([".vue",".svelte",".astro",".html",".htm"]),$h=new Set([".py",".pyi"]),Th=new Set([".c",".h",".cc",".cpp",".cxx",".hpp",".hh"]),Fh=new Set([".kt",".kts"]),Oh=new Set([".scala",".sc"]),cu=new Set([...Fh,...Oh]),Nh=new Set([".sh",".bash",".zsh",".ksh",".fish"]),zv=new Set(["dist","build","lib","out","output","esm","cjs","umd"]);Ja="${configDir}";lu=["source","ts","import","module","require","node","default"],Vv=8;o0=new Set(["assert.h","complex.h","ctype.h","errno.h","fenv.h","float.h","inttypes.h","iso646.h","limits.h","locale.h","math.h","setjmp.h","signal.h","stdalign.h","stdarg.h","stdatomic.h","stdbool.h","stddef.h","stdint.h","stdio.h","stdlib.h","stdnoreturn.h","string.h","tgmath.h","threads.h","time.h","uchar.h","wchar.h","wctype.h","unistd.h","fcntl.h","pthread.h","dirent.h","dlfcn.h","poll.h","sched.h","semaphore.h","strings.h","termios.h","glob.h","regex.h","syslog.h","netdb.h","pwd.h","grp.h","libgen.h","fnmatch.h","spawn.h","utime.h","windows.h"]),a0=/^(?:sys|arpa|netinet|net)\//;h0=new Set([".go",".rs",".java",".rb",".rake",".php",".cs",".dart",".lua",".ex",".exs"])});function Za(e){return w0.test(e.split("/").pop())}function x0(e){return e.includes("/")?J.dirname(e):Xa}function Cs(e){return e===Xa?0:_0.test(e)||b0.test(e)?2:y0.test(e)?0:null}function S0(e,t){let n=Cs(e);return n!==null?n:t.every(r=>r.kind==="doc"||r.kind==="config"||Za(r.rel))?2:1}function k0(e,t){let n=t.find(a=>/^(readme|index)\.(md|mdx)$/i.test(a.rel.split("/").pop()));if(n?.summary)return n.summary;if(n?.title)return n.title;let r=t.filter(a=>a.summary).sort((a,l)=>(l.summary?.length??0)-(a.summary?.length??0));if(r[0]?.summary)return r[0].summary;let o=[...new Set(t.map(a=>a.lang))].filter(a=>a!=="other"),s=e===Xa?"the repository root":`\`${e}/\``;return`${t.length} file(s) in ${s}${o.length?` (${o.slice(0,3).join(", ")})`:""}.`}function uu(e){let t=new Map;for(let c of e.files){let d=x0(c.rel),u=t.get(d);u||t.set(d,u=[]),u.push(c)}let n=[...t.keys()].sort(T),r=new Map,o=new Map;for(let c of n){let d=c===Xa?"root":si(c);r.set(c,d),o.set(d,(o.get(d)??0)+1)}let s=c=>{let d=r.get(c);return d&&o.get(d)===1?d:`${d||"module"}-${Re(c).slice(0,8)}`},a=[],l=new Map;for(let c of n){let d=t.get(c).slice().sort((m,p)=>T(m.rel,p.rel)),u=s(c),f={slug:u,path:c,title:c,tier:S0(c,d),members:d.map(m=>m.rel),summary:k0(c,d)};a.push(f);for(let m of d)l.set(m.rel,u)}return a.sort((c,d)=>T(c.slug,d.slug)),{modules:a,moduleOf:l}}var Xa,y0,_0,b0,w0,Ms=H(()=>{"use strict";$();me();et();St();ce();Xa="(root)",y0=/(^|\/)(types?|util|utils|lib|libs|common|core|config|configs|constants|shared|helpers|internal)$/i,_0=/(^|\/)(tests?|__tests?__|__mocks?__|__snapshots?__|spec|specs|e2e|examples?|example|benchmark|benchmarks|fixtures?|docs?|documentation|\.github)(\/|$)/i,b0=/(^|\/)(scripts?|bin|\.storybook)$/i,w0=/\.(test|spec|e2e|stories|story)\.[cm]?[jt]sx?$/i});function fu(e){let t=Pr(e),n=new Map;if(!t.size)return n;let r=(s,a)=>{let l=n.get(s);l||n.set(s,l=new Set),l.add(a)},o=Qa(e);for(let s of e.files)if(s.kind==="code"&&s.idents)for(let a of s.idents){let l=t.get(a);l&&l!==s.rel&&r(a,s.rel)}else if(s.kind==="doc"){let a=o.get(s.rel);if(!a||!a.retained)continue;for(let l of a.counts.keys()){let c=t.get(l);c&&c!==s.rel&&r(l,s.rel)}}return n}function mu(e,t=new Map,n=5){let r=new Map;for(let a of e.files)for(let l of a.symbols){let c=r.get(l.name);c||r.set(l.name,c=[]),c.push({file:l.file,line:l.line,...l.endLine!==void 0?{endLine:l.endLine}:{},kind:l.kind,exported:l.exported,lang:l.lang,...l.parent?{parent:l.parent}:{}})}let o=Object.create(null);for(let a of[...r.keys()].sort(T))o[a]=r.get(a).slice().sort((l,c)=>T(l.file,c.file)||l.line-c.line||T(l.kind,c.kind));let s=Object.create(null);for(let a of[...t.keys()].sort(T)){let l=[...t.get(a)].sort(T);l.length&&(s[a]=l)}return{schemaVersion:n,defs:o,refs:s}}function Ya(e){return JSON.stringify(e,null,2)+` -`}var Hi=H(()=>{"use strict";$();bt();ce();gt()});function Tn(e){let t=[{name:e}],n=e.lastIndexOf("#");n>0&&n0&&r0&&n{"use strict";$()});function Wh(e){let t=new Map;for(let n of e.files)for(let r of n.symbols)v0.has(r.kind)&&Vi(t,r.name,{name:r.name,file:r.file,kind:r.kind,lang:r.lang,line:r.line});return t}function ir(e,t,n){return Bh(e,t,n).map(r=>r.rel)}function Bh(e,t,n){let r=Wh(e),o=hu(e,t,n),s=[];for(let a of e.files){if(!a.relations?.length)continue;let l=Fe(a.lang),c=o.aliases(a);for(let d of a.relations){let u=c.names.get(d.to),f=u?.name??d.to,m=r.get(f)?.get(l);if(!m)continue;let p;if(u){if(!u.files)continue;p=Dr(a.rel,o.within(m,u.files,f))}else{let g=o.reached(m,a,f),h=m.byFile.get(a.rel);h&&g.push(h),p=Dr(a.rel,g.length?g:m.list)}p&&s.push({written:d.to,rel:{kind:E0.has(p.kind)?"implements":d.kind,from:d.from,fromFile:a.rel,fromLine:d.line,to:p.name,toFile:p.file,toKind:p.kind}})}}return s.sort((a,l)=>T(a.rel.fromFile,l.rel.fromFile)||T(a.rel.from,l.rel.from)||T(a.rel.kind,l.rel.kind)||T(a.rel.to,l.rel.to))}function pu(e,t,n){let r=new Map;for(let o of ir(e,t,n)){if(o.toFile===o.fromFile)continue;let s=`${o.fromFile}${Ue}${o.toFile}${Ue}${o.kind}`,a=r.get(s);a?a.weight=Math.min(a.weight+1,5):r.set(s,{from:o.fromFile,to:o.toFile,kind:o.kind,weight:1})}return[...r.values()].sort((o,s)=>T(o.from,s.from)||T(o.to,s.to)||T(o.kind,s.kind))}function gu(e,t){let n=Wh(e),r=Bh(e,t),o=r.map(m=>m.rel),s=new Map,a=(m,p)=>`${m}${Ue}${p}`;for(let m of n.values())for(let p of[...m.values()].flatMap(g=>g.list))s.set(a(p.name,p.file),{name:p.name,file:p.file,line:p.line,kind:p.kind,extends:[],implements:[],extendedBy:[],implementedBy:[],unresolved:[]});let l=m=>({name:m.name,file:m.file,line:m.line,kind:m.kind});for(let m of o){let p=s.get(a(m.from,m.fromFile)),g=s.get(a(m.to,m.toFile));g&&(p?((m.kind==="extends"?p.extends:p.implements).push(l(g)),(m.kind==="extends"?g.extendedBy:g.implementedBy).push(l(p))):(m.kind==="extends"?g.extendedBy:g.implementedBy).push({name:m.from,file:m.fromFile,line:m.fromLine,kind:"unknown"}))}for(let m of Gi(e)){let p=s.get(a(m.from,m.fromFile)),g=s.get(a(m.to,m.toFile));if(!p||!g)continue;let h=_=>m.structural?{..._,structural:!0}:_;p.implements.push(h(l(g))),g.implementedBy.push(h(l(p)))}let c=new Set(r.map(({rel:m,written:p})=>`${m.fromFile}${Ue}${m.from}${Ue}${m.kind}${Ue}${p}`));for(let m of e.files)for(let p of m.relations??[]){if(c.has(`${m.rel}${Ue}${p.from}${Ue}${p.kind}${Ue}${p.to}`))continue;let g=p.kind==="extends"?"implements":"extends";c.has(`${m.rel}${Ue}${p.from}${Ue}${g}${Ue}${p.to}`)||s.get(a(p.from,m.rel))?.unresolved.push({kind:p.kind,to:p.to})}let d=(m,p)=>T(m.name,p.name)||T(m.file,p.file),u=new Map,f=[...s.keys()].sort(T);for(let m of f){let p=s.get(m);p.extends.sort(d),p.implements.sort(d),p.extendedBy.sort(d),p.implementedBy.sort(d),p.unresolved.sort((g,h)=>T(g.kind,h.kind)||T(g.to,h.to)),u.has(p.name)?u.set(`${p.name}@${p.file}`,p):u.set(p.name,p)}return u}function C0(e,t){let n=e.indexOf(`${t}(`);if(n===-1)return;let r=0,o=0,s=!0;for(let a=n+t.length;a=1&&!/\s/.test(l)&&(s=!1)}}function Gi(e){let t=h=>h.includes("/")?h.slice(0,h.lastIndexOf("/")):"",n=new Map,r=new Map,o=new Map,s=new Map,a=[],l=e.files.filter(h=>h.lang==="go"&&!h.rel.endsWith("_test.go"));for(let h of l){let _=t(h.rel);for(let y of h.symbols)if(y.kind==="type"&&!y.parent){let b=`${_}${Ue}${y.name}`;n.has(b)||n.set(b,y);let S=r.get(y.name)??[];S.push(y),r.set(y.name,S)}else if(y.kind==="method"&&y.parent){let b=`${_}${Ue}${y.parent}`,S=o.get(b);S||o.set(b,S=new Map),S.set(y.name,y.signature?C0(y.signature,y.name):void 0);let k=s.get(y.name);k||s.set(y.name,k=new Set),k.add(b)}else if(y.name==="_"&&y.signature){let b=R0.exec(y.signature);b&&a.push({sym:y,iface:b[1],type:b[2]??b[3]??b[4]})}}let c=[];for(let h of l)for(let _ of h.relations??[])_.kind==="extends"&&/^\w+$/.test(_.to)&&c.push([`${t(h.rel)}${Ue}${_.from}`,`${t(h.rel)}${Ue}${_.to}`]);c.sort((h,_)=>T(h[0],_[0])||T(h[1],_[1]));for(let h=0;h<3;h++)for(let[_,y]of c){let b=o.get(y);if(!b)continue;let S=o.get(_);S||o.set(_,S=new Map);for(let[k,R]of b)S.has(k)||(S.set(k,R),s.get(k).add(_))}let d=h=>!!h.signature?.startsWith(h.name)&&/^(\[[^\]]*\])?\s+interface\b/.test(h.signature.slice(h.name.length)),u=new Map,f=(h,_,y)=>{let b=u.get(h);if(b!==void 0)return b??void 0;if(y.has(h))return;y.add(h);let S=new Map(o.get(h)??[]),k=!0,R=re(j(e.root,_.file)).split(` -`).slice(_.line,(_.endLine??_.line)-1);for(let P of R){let v=P.replace(/\/\/.*$/,"").trim();if(/[~|]/.test(v)&&!v.includes("(")&&(k=!1),!/^[\w.]+$/.test(v))continue;let M=v.lastIndexOf(".")===-1?n.get(`${t(_.file)}${Ue}${v}`):void 0,x=M&&d(M)?f(`${t(M.file)}${Ue}${M.name}`,M,y):void 0;if(!x)k=!1;else for(let[w,E]of x)S.set(w,E)}let I=k&&S.size?S:void 0;return u.set(h,I??null),I},m=new Map,p=(h,_,y)=>{let b=`${h.file}${Ue}${h.name}${Ue}${_.file}${Ue}${_.name}`,S=m.get(b);if(S){y||delete S.structural;return}m.set(b,{from:h.name,fromFile:h.file,to:_.name,toFile:_.file,...y?{structural:!0}:{}})};for(let[h,_]of[...n].sort((y,b)=>T(y[0],b[0]))){if(!d(_))continue;let y=f(h,_,new Set);if(!y)continue;let b=[...y.keys()].sort(T),S=b.some(R=>!/^[A-Z]/.test(R)),k=b.reduce((R,I)=>(s.get(I)?.size??0)<(s.get(R)?.size??0)?I:R);for(let R of[...s.get(k)??[]].sort(T)){if(R===h)continue;let I=n.get(R);if(!I||d(I)||S&&t(I.file)!==t(_.file))continue;let P=o.get(R);b.every(C=>{if(!P.has(C))return!1;let M=P.get(C),x=y.get(C);return M===void 0||x===void 0||M===x})&&p(I,_,!0)}}let g=(h,_)=>{let y=h.slice(h.lastIndexOf(".")+1);if(!h.includes(".")){let S=n.get(`${_}${Ue}${y}`);if(S)return S}let b=(r.get(y)??[]).slice().sort((S,k)=>T(S.file,k.file));return b.length===1?b[0]:void 0};for(let h of a){let _=t(h.sym.file),y=g(h.iface,_),b=g(h.type,_);y&&b&&d(y)&&!d(b)&&p(b,y,!1)}return[...m.values()].sort((h,_)=>T(h.fromFile,_.fromFile)||T(h.from,_.from)||T(h.toFile,_.toFile)||T(h.to,_.to))}function qi(e,t,n){let r=or(e,t,n);if(!r)return[];let o=new Set([`${r.name}${Ue}${r.file}`]),s=[],a=[r];for(;a.length;){let l=[];for(let c of a)for(let d of[...c.implementedBy,...c.extendedBy]){let u=`${d.name}${Ue}${d.file}`;if(o.has(u))continue;o.add(u),s.push(d);let f=Uh(e,d.name,d.file);f&&l.push(f)}a=l}return s.sort((l,c)=>T(l.name,c.name)||T(l.file,c.file))}function or(e,t,n){let r=e.get(t);if(r)return r;for(let o of Tn(t).slice(1))if(o.parent===void 0){for(let s of e.values())if(As(o,s))return s}for(let o of n??[]){let s=Uh(e,o.name,o.file);if(s)return s}}function Uh(e,t,n){let r=e.get(t);return r?.file===n?r:e.get(`${t}@${n}`)}var Ue,E0,v0,R0,Fn=H(()=>{"use strict";$();me();ar();Is();ce();Lr();Ze();Ue="\0",E0=new Set(["interface","trait","protocol"]),v0=new Set(["class","interface","trait","struct","type","enum","record","object","protocol","module","mod","union","annotation"]);R0=/^_\s+([\w.]+)\s*=\s*(?:\(\s*\*\s*([\w.]+)\s*\)\s*\(\s*nil\s*\)|&?([\w.]+)\s*\{|new\(\s*([\w.]+)\s*\))/});function jr(e,t,n,r,o){let s=[...new Set(e)].sort(T),a=s.filter(b=>t.has(b));if(a.length)return{hops:0,paths:a.slice(0,o).map(b=>[{node:b}]),pathCount:a.length};let l=new Map(s.map(b=>[b,0])),c=new Map,d=[s],u;for(let b=1;b<=r&&!u;b++){let S=[];for(let R of d[b-1])for(let[I,P]of n(R)){let v=l.get(I);if(v===void 0)l.set(I,b),c.set(I,new Map),S.push(I);else if(v!==b)continue;let C=c.get(I);C.has(R)||C.set(R,P)}if(!S.length)break;S.sort(T),d.push(S);let k=S.filter(R=>t.has(R));k.length&&(u=k)}if(!u)return{hops:null,paths:[],pathCount:0};let f=d.length-1,m=new Set(u),p=[...u];for(;p.length;)for(let b of c.get(p.pop())?.keys()??[])m.has(b)||(m.add(b),p.push(b));let g=new Map,h=new Map;for(let b of s)m.has(b)&&g.set(b,1);for(let b=1;b<=f;b++)for(let S of d[b]){if(!m.has(S))continue;let k=0;for(let[R,I]of c.get(S)){k+=g.get(R)??0;let P=h.get(R);P?P.push([S,I]):h.set(R,[[S,I]])}g.set(S,k)}let _=[],y=b=>{if(_.length>=o)return;let S=b[b.length-1].node;if(b.length===f+1){_.push(b.slice());return}for(let[k,R]of h.get(S)??[])if(b.push({node:k,via:R}),y(b),b.pop(),_.length>=o)return};for(let b of s)m.has(b)&&y([{node:b}]);return{hops:f,paths:_,pathCount:u.reduce((b,S)=>b+(g.get(S)??0),0)}}var yu=H(()=>{"use strict";$();ce()});function ht(e){return e.parent?`${e.file}#${e.parent}/${e.name}`:`${e.file}#${e.name}`}function A0(e){return{id:ht(e),name:e.name,kind:e.kind,file:e.file,line:e.line,...e.endLine!==void 0?{endLine:e.endLine}:{},exported:e.exported,...e.doc?{doc:e.doc}:{},...e.signature?{signature:e.signature}:{}}}function xu(e,t){let n=new Map,r=new Map;for(let p of e.files){let g=[];for(let h of p.symbols)M0.has(h.kind)||(g.push(h),n.set(ht(h),A0(h)));r.set(p.rel,g)}let o=new Map,s=(p,g,h)=>{if(p===g)return;let _=`${p}${Wr}${g}${Wr}${h}`,y=o.get(_);y?y.weight+=1:o.set(_,{from:p,to:g,kind:h,weight:1})},a=cr(e,t);for(let p of e.files){let g=a.forFile(p);if(!g)continue;let h=r.get(p.rel)??[];for(let _ of p.calls){let y=On(h,_.line);if(!y)continue;let b=g(_,y);b&&s(ht(y),ht(b.def),"calls")}}let l=new Map;for(let p of n.values()){let g=`${p.name} ${p.file}`;(!l.has(g)||p.id===`${p.file}#${p.name}`)&&l.set(g,p.id)}let c=ir(e,t);for(let p of Gi(e))c.push({...p,kind:"implements"});for(let p of c){let g=l.get(`${p.from} ${p.fromFile}`),h=l.get(`${p.to} ${p.toFile}`);g&&h&&s(g,h,p.kind)}for(let{sub:p,sup:g}of Su(e,c))s(ht(p),ht(g),"overrides");let d=[...o.values()].sort((p,g)=>T(p.from,g.from)||T(p.kind,g.kind)||T(p.to,g.to)),u=new Map,f=new Map;for(let p of d)(u.get(p.from)??u.set(p.from,[]).get(p.from)).push(p),(f.get(p.to)??f.set(p.to,[]).get(p.to)).push(p);let m=new Map;for(let p of[...n.keys()].sort(T)){let g=n.get(p);(m.get(g.name)??m.set(g.name,[]).get(g.name)).push(p)}return{nodes:n,edges:d,out:u,in:f,byName:m}}function Su(e,t){let n=new Map(e.files.map(d=>[d.rel,d.lang])),r=d=>d.includes("/")?d.slice(0,d.lastIndexOf("/")):"",o=(d,u)=>Fe(n.get(u)??"")==="go"?`go${Wr}${r(u)}${Wr}${d}`:`${u}${Wr}${d}`,s=new Map;for(let d of e.files)for(let u of d.symbols){if(!u.parent||!I0.has(u.kind))continue;let f=o(u.parent,u.file),m=s.get(f);m||s.set(f,m=new Map),m.has(u.name)||m.set(u.name,u)}let a=new Map;for(let d of t){let u=o(d.from,d.fromFile),f=a.get(u)??[],m=o(d.to,d.toFile);m!==u&&!f.includes(m)&&f.push(m),a.set(u,f)}for(let d of a.values())d.sort(T);let l=(d,u,f,m)=>{for(let p of a.get(d)??[]){if(f.has(p))continue;f.add(p);let g=s.get(p)?.get(u);g?m.push(g):l(p,u,f,m)}},c=[];for(let d of[...a.keys()].sort(T)){let u=s.get(d);if(u)for(let f of[...u.keys()].sort(T)){let m=[];l(d,f,new Set([d]),m);for(let p of m)c.push({sub:u.get(f),sup:p})}}return c.sort((d,u)=>T(ht(d.sub),ht(u.sub))||T(ht(d.sup),ht(u.sup)))}function wu(e,t){if(e.nodes.has(t))return[t];for(let n of Tn(t)){let r=n.parent?.slice(n.parent.lastIndexOf("/")+1),o=(e.byName.get(n.name)??[]).filter(s=>{let a=e.nodes.get(s);return n.file!==void 0&&a.file!==n.file?!1:r===void 0||s===`${a.file}#${r}/${a.name}`});if(o.length)return o}return[]}function Ji(e,t,n={}){let r=n.depth??2,o=Math.max(1,Math.min(r,_u)),s=n.direction??"both",a=wu(e,t),l=a.map(g=>e.nodes.get(g));if(!l.length)return{root:[],nodes:[],edges:[]};let c=new Map;for(let g of a)c.set(g,0);let d=new Map,u=[...a],f=!1;for(let g=1;g<=o&&u.length;g++){let h=[];for(let _ of u){let y=(k,R)=>{for(let I of k??[]){d.set(`${I.from}${Wr}${I.to}${Wr}${I.kind}`,I);let P=R(I);if(!c.has(P)){if(c.size>=$0){f=!0;continue}c.set(P,g),h.push(P)}}},b=e.out.get(_),S=e.in.get(_);s==="both"?(y(b,k=>k.to),y(S,k=>k.from)):s==="out"?(y(b?.filter(k=>k.kind!=="overrides"),k=>k.to),y(S?.filter(k=>k.kind==="overrides"),k=>k.from)):(y(S?.filter(k=>k.kind!=="overrides"),k=>k.from),y(b?.filter(k=>k.kind==="overrides"),k=>k.to))}u=h}let m=[...c.entries()].map(([g,h])=>({...e.nodes.get(g),depth:h})).sort((g,h)=>g.depth-h.depth||T(g.file,h.file)||T(g.name,h.name)),p=[...d.values()].filter(g=>c.has(g.from)&&c.has(g.to)).sort((g,h)=>T(g.from,h.from)||T(g.kind,h.kind)||T(g.to,h.to));return{root:l,nodes:m,edges:p,...f?{truncated:!0}:{},...r>_u?{depthClamped:_u}:{}}}function tl(e,t,n,r={}){let o=r.depth??T0,s=Math.max(1,Math.min(o,bu)),a=Math.max(1,r.maxPaths??5),l=wu(e,t),c=wu(e,n),d=l.map(_=>e.nodes.get(_)),u=c.map(_=>e.nodes.get(_)),f=o>bu?{depthClamped:bu}:{};if(!d.length||!u.length)return{from:d,to:u,hops:null,paths:[],pathCount:0,...f};let m=function*(_){for(let y of e.out.get(_)??[])y.kind==="calls"&&(yield[y.to,"calls"]);for(let y of e.in.get(_)??[])y.kind==="overrides"&&(yield[y.from,"dispatch"])},p=jr(l,new Set(c),m,s,a),g=_=>{let y=e.nodes.get(_.node);return{id:y.id,name:y.name,kind:y.kind,file:y.file,line:y.line,..._.via?{via:_.via}:{}}},h={from:d,to:u,hops:p.hops,paths:p.paths.map(_=>_.map(g)),pathCount:p.pathCount,...p.paths.length{"use strict";$();Is();lr();ar();Fn();ce();yu();Lr();Wr="\0",M0=new Set(["reexport","reexport-all","default"]);I0=new Set(["method","function","def","getter","setter","operator"]);_u=5,$0=400;T0=8,bu=16});function F0(e){let t=new Array(e.length*nl);for(let n=0;nT(u.to,f.to));for(let d of a.values())d.sort((u,f)=>T(u.from,f.from));let c={out:s,inn:a,degree:l,threshold:qh([...l.values()])};return r.views.set(n,c),c}function qh(e){let t=e.slice().sort((o,s)=>o-s),n=t.length,r=n===0?0:t[Math.min(n-1,Math.floor(.99*n))];return Math.max(50,r)}function Ki(e,t,n=1/0,r={}){return Ru(vu(e,r),t,n)}function vu(e,t={}){let n=new Map,r=new Map,o=(s,a,l)=>{let c=s.get(a);c?c.push(l):s.set(a,[l])};for(let s of e)s.dangling||!$s.has(s.kind)||t.skipInferred&&s.confidence==="inferred"||(o(n,s.to,s),t.goPackages&&s.kind==="import"&&s.to.endsWith(".go")&&o(r,rl(s.to),s));return{dependents:n,packageImports:r,goPackages:t.goPackages===!0}}function Ru(e,t,n=1/0){let{dependents:r,packageImports:o,goPackages:s}=e,a=new Map,l=new Set(t),c=[...t];for(let d=1;d<=n&&c.length;d++){let u=[];for(let f of c){let m=r.get(f)??[];s&&Eu(f)&&(m=m.concat(o.get(rl(f))??[]));for(let p of m.slice().sort((g,h)=>T(g.from,h.from)))l.has(p.from)||(l.add(p.from),a.set(p.from,d),u.push(p.from))}c=u}return a}function Xi(e,t,n=1/0,r={}){let o=new Map(e.files.map(p=>[p.rel,p.module])),s=e.modules.find(p=>p.slug===t),a=s?void 0:e.files.find(p=>p.rel===t);if(!s&&!a)return;let l=s?s.members:[a.rel],c=r.includeInferred===!0,d=Ki(e.fileEdges,l,n,{skipInferred:!c,goPackages:!0}),u=[...d.entries()].map(([p,g])=>({rel:p,module:o.get(p)??"root",depth:g})).sort((p,g)=>p.depth-g.depth||T(p.rel,g.rel)),f=[...new Set(u.map(p=>p.module).filter(p=>p!==t))].sort(T),m={target:t,scope:s?"module":"file",seeds:l,files:u,modules:f};if(!c){let p=Ki(e.fileEdges,l,n,{goPackages:!0}).size-d.size;p>0&&(m.inferredDependents=p)}return m}function Hh(e){return e.kind==="call"?e.confidence==="inferred"?4:1:e.kind==="import"||e.kind==="extends"||e.kind==="implements"?0:e.kind==="use"?2:3}function Gh(e,t,n,r){let{out:o,inn:s,degree:a,threshold:l}=N0(e,r),c=new Set([t]),d=[],u=[t];for(let f=1;f<=n;f++){let m=new Map,p=(g,h,_)=>{let y=m.get(g);if(!y){if(c.has(g))return;c.add(g),m.set(g,y=[])}y.some(b=>b.direction===h&&b.kind===_.kind)||y.push({node:g,direction:h,kind:_.kind,weight:_.weight,depth:f,confidence:_.confidence})};for(let g of u)if(!(g!==t&&(a.get(g)??0)>=l)){for(let h of o.get(g)??[])p(h.to,"out",h);for(let h of s.get(g)??[])p(h.from,"in",h)}for(let g of m.values())g.sort((h,_)=>Hh(h)-Hh(_)||+(h.direction==="in")-+(_.direction==="in")||T(h.kind,_.kind)),d.push(...g);u=[...m.keys()]}return d}function Zi(e,t,n=1,r){let o=e.modules.find(a=>a.slug===t);if(o)return{target:t,scope:"module",links:Gh(e.moduleEdges,t,n,r),members:o.members};if(e.files.find(a=>a.rel===t))return{target:t,scope:"file",links:Gh(e.fileEdges,t,n,r)}}function sl(e,t,n,r={}){let o=new Set(e.files.map(g=>g.rel));if(!o.has(t)||!o.has(n))return;let s=r.depth??P0,a=Math.max(1,Math.min(s,ku)),l=Math.max(1,r.maxPaths??5),c=new Map;for(let g of[...o].sort(T)){if(!Eu(g))continue;let h=rl(g),_=c.get(h);_?_.push(g):c.set(h,[g])}let d=g=>{let h=new Map;for(let y of e.fileEdges){if(y.dangling||!$s.has(y.kind)||!g&&y.confidence==="inferred")continue;let b=y.kind==="import"&&Eu(y.to)&&c.get(rl(y.to))||[y.to],S=h.get(y.from)??h.set(y.from,[]).get(y.from);for(let k of b)S.push([k,y.kind])}let _=y=>y==="import"?0:y==="extends"||y==="implements"?1:y==="use"?2:3;for(let y of h.values())y.sort((b,S)=>T(b[0],S[0])||_(b[1])-_(S[1]));return y=>h.get(y)??[]},u=r.includeInferred===!0,f=d(u),m=jr([t],new Set([n]),f,a,l),p={from:t,to:n,hops:m.hops,paths:m.paths.map(g=>g.map(h=>h.via?{file:h.node,via:h.via}:{file:h.node})),pathCount:m.pathCount,...m.paths.lengthku?{depthClamped:ku}:{}};if(m.hops===null){let g=jr([n],new Set([t]),f,a,0);if(g.hops!==null&&(p.reverseHops=g.hops),!u){let h=jr([t],new Set([n]),d(!0),a,0);h.hops!==null&&(p.inferredHops=h.hops)}}return p}var $s,nl,zh,rl,Eu,Ts,P0,ku,Ur=H(()=>{"use strict";$();ce();yu();$s=new Set(["import","use","call","extends","implements"]),nl=6;zh=new WeakMap;rl=e=>e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",Eu=e=>e.endsWith(".go")&&!e.endsWith("_test.go");Ts=["import","call","use","extends","implements","doc-link","mention","contains"];P0=8,ku=16});function Ft(e){return D0.test(e)||Cu(e)}function Cu(e){if(Za(e))return!0;let t=e.split("/").pop();return L0.some(n=>n.test(t))}function W0(e){let t=e.lastIndexOf("/"),n=t===-1?"":e.slice(0,t+1),r=e.slice(t+1),o;if(o=/^(.+)\.(?:test|spec)(\.[cm]?[jt]sx?)$/.exec(r)){let s=[n];return/(^|\/)__tests__\/$/.test(n)&&s.push(n.slice(0,-10)),s.flatMap(a=>[o[2],...j0.filter(l=>l!==o[2])].map(l=>a+o[1]+l))}if(o=/^test_(.+)\.py$/.exec(r)??/^(.+)_test\.py$/.exec(r))return[n+o[1]+".py"];if(o=/^(.+)_test\.go$/.exec(r))return[n+o[1]+".go"];if(o=/^(.+)_(?:spec|test)\.rb$/.exec(r))return[n+o[1]+".rb"];if(o=/^(.+?)(?:Tests?|IT)\.(java|kt)$/.exec(r)){let s=n+o[1]+"."+o[2],a=s.replace(/(^|\/)src\/test\//,"$1src/main/");return a===s?[s]:[s,a]}return[]}function Yi(e){let t=new Set,n=new Map,r=new Set,o=new Map;for(let d of e.files)if(n.set(d.rel,d.module),d.fileKind==="code"){if(Ft(d.rel)){t.add(d.rel);continue}if(r.add(d.rel),d.rel.endsWith(".go")){let u=d.rel.includes("/")?d.rel.slice(0,d.rel.lastIndexOf("/")):"",f=o.get(u);f?f.push(d.rel):o.set(u,[d.rel])}}let s=new Map,a=new Map,l=(d,u)=>{let f=s.get(u);f||s.set(u,f=new Set),f.add(d);let m=n.get(u);if(m!==void 0){let p=a.get(m);p||a.set(m,p=new Set),p.add(d)}};for(let d of e.fileEdges)d.dangling||$s.has(d.kind)&&(!t.has(d.from)||t.has(d.to)||l(d.from,d.to));for(let d of t){for(let u of W0(d))r.has(u)&&l(d,u);if(d.endsWith("_test.go")){let u=d.includes("/")?d.slice(0,d.lastIndexOf("/")):"";for(let f of o.get(u)??[])l(d,f)}}let c=d=>{let u=new Map;for(let f of[...d.keys()].sort(T))u.set(f,[...d.get(f)].sort(T));return u};return{testFiles:t,testedByFile:c(s),testedByModule:c(a)}}function B0(e,t){let n=e.modules.find(r=>r.slug===t);return n?.testedBy?n.testedBy:Yi(e).testedByModule.get(t)??[]}function U0(e){let t=Yi(e),n=new Map;for(let r of e.files)r.fileKind!=="code"||t.testFiles.has(r.rel)||n.set(r.module,(n.get(r.module)??0)+1);return e.modules.filter(r=>r.tier<=1&&r.symbols>0&&(n.get(r.slug)??0)>0&&!t.testedByModule.has(r.slug))}var L0,D0,j0,dr=H(()=>{"use strict";$();Ms();ce();Ur();L0=[/^test_.*\.py$/i,/_test\.py$/i,/_test\.go$/,/(Test|Tests|IT)\.java$/,/(Test|Tests)\.kt$/,/_spec\.rb$/,/_test\.rb$/,/Test\.php$/,/(Test|Tests)\.cs$/,/_test\.exs$/],D0=/(^|\/)(tests?|__tests?__|spec|specs|e2e)(\/|$)/i;j0=[".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts"]});function zr(e,t,n){let r=e.fields[t];for(let o of gn(n))r.tf.set(o,(r.tf.get(o)??0)+1),r.len++,e.all.add(o)}function tR(){let e={};for(let t of il)e[t]={tf:new Map,len:0};return e}function ol(e){let t=[];for(let n of e.files){let r={file:n.rel,fields:tR(),all:new Set,symbols:[],decls:[],exactNames:new Set,isTest:Ft(n.rel),isFixture:eR.test(n.rel)},o=new Set;for(let a of n.symbols){if(a.doc&&zr(r,"doc",a.doc),X0.has(a.kind)){zr(r,"body",a.name);continue}zr(r,"name",a.name),r.exactNames.add(Jn(a.name).toLowerCase()),o.has(a.name)||(o.add(a.name),r.symbols.push(a.name),r.decls.push({name:a.name,kind:a.kind,line:a.line}))}for(let a of n.rel.split("/"))zr(r,"path",a);for(let a of n.headings)zr(r,"heading",a);n.summary&&zr(r,"summary",n.summary);let s=r.fields.body;for(let a of n.terms??[]){if(!oR.test(a)){zr(r,"body",a);continue}s.tf.set(a,(s.tf.get(a)??0)+1),s.len++,r.all.add(a)}t.push(r)}return sR(t),t}function sR(e){let t=new Set;for(let r of e)for(let o of r.fields.name.tf.keys())o.length>=Mu&&/^[a-z]+$/.test(o)&&t.add(o);let n=new Map;for(let r of e){if(r.isTest||r.isFixture)continue;let o=r.fields.path;for(let s of[...o.tf.keys()]){if(s.lengthrR||!/^[a-z]+$/.test(s))continue;let a=n.get(s);if(n.has(s)||n.set(s,a=iR(s,t)),!a)continue;let l=o.tf.get(s);for(let c of a)o.tf.set(c,(o.tf.get(c)??0)+l),o.len+=l,r.all.add(c)}}}function iR(e,t){let n=e.length,r=new Array(n+1);r[n]=[];for(let s=n-Mu;s>=0;s--)for(let a=s+Mu;a<=n;a++){let l=r[a],c=e.slice(s,a);if(!l||!t.has(c))continue;let d=[c,...l],u=r[s];(!u||d.length=2?o:void 0}function aR(e){let t=Xh.get(e);if(t)return t;t={};for(let n of il){let r=0;for(let o of e)r+=o.fields[n].len;t[n]=r/e.length||1}return Xh.set(e,t),t}function Yh(e){let t=`^^${e}$$`,n=new Set;for(let r=0;r+3<=t.length;r++)n.add(t.slice(r,r+3));return n}function Qh(e){let t=new Set,n=new Map;for(let r of e)for(let o of r.all){if(t.has(o))continue;t.add(o);let s=ea(o);if(s===o)continue;let a=n.get(s);a||n.set(s,a=[]),a.push(o)}for(let r of n.values())r.sort(T);return n}function ey(e){let t=[],n=new Set;for(let a of e)for(let l of a.all)n.has(l)||(n.add(l),t.push(l));let r=new Uint32Array(t.length),o=new Map;for(let a=0;a=G0&&s.push({term:e.terms[a],dice:l})}return s}function cR(e,t,n={}){return ty(e,t,n).results}function Gt(e,t,n={}){return ty(e,t,n)}function Zh(e,t,n,r){return{results:[],explain:{query:e,terms:[],droppedStopwords:ii(e,r),unresolvedTerms:[],verdict:t,note:n,bridgedOnlyResults:0,resultCount:0}}}function dR(e,t){let n=ii(t).filter(l=>l.length>=2);if(!n.length)return;let r=new Set(n.map(l=>l.toLowerCase()));if(r.size===1&&!us(t).length)return l=>r.has(l.toLowerCase());let o=n.filter(l=>/[A-Z]/.test(l));if(!o.length)return;let s=Au(e),a=new Set(o.filter(l=>{let c=l.toLowerCase();return s.some(d=>d.exactNames.has(c)&&d.symbols.includes(l))}));return a.size?l=>a.has(l):void 0}function ty(e,t,n={}){let r=dR(e,t),o=[],s=new Set;for(let I of us(t,r))for(let P of gn(I))s.has(P)||(s.add(P),o.push(P));if(!o.length){let I=ii(t,r);return Zh(t,"none",I.length?`Nothing was searched for: every token in this query (${I.join(", ")}) is a stopword or too short to index. Search with the identifiers or domain words you are actually looking for.`:"Nothing was searched for: the query carried no indexable token.",r)}let a=o.some(I=>Y0.test(I)),l=Au(e),c=l.length;if(!c)return Zh(t,"none","This index contains no files.",r);let d=aR(l),u=new Uint8Array(c),f=I=>{let P=0;for(let v=0;vm.get(P)===0);if(I.length){let P=sy(e),v=[];for(let C of I){let M=ea(C),x=(P.get(M)??[]).filter(w=>w!==C);M!==C&&ea(M)===M&&l.some(w=>w.all.has(M))&&(x.push(M),x.sort(T)),x.length?g.set(C,x.slice(0,Jh).map(w=>({term:w,dice:q0,via:"stem"}))):v.push(C)}if(v.length){let C=ny(e);for(let M of v){let x=lR(C,M);x.sort((w,E)=>E.dice-w.dice||T(w.term,E.term)),g.set(M,x.slice(0,Jh).map(w=>({...w,via:"trigram"})))}}}}let h=new Map;for(let I of g.values())for(let{term:P}of I)!m.has(P)&&!h.has(P)&&h.set(P,f(P));let _=I=>m.get(I)??h.get(I),y=I=>Math.log(1+(c-I+.5)/(I+.5)),b=n.rank==="graph"?ry(e):void 0,S=I=>(1+Kh*Math.log1p(I*c))/(1+Kh*Math.LN2),k=[];for(let I=0;I{let L=0;for(let G of il){let X=P.fields[G],oe=X.tf.get(O);if(!oe)continue;M.add(G);let ue=J0[G];L+=V0[G]*oe/(1-ue+ue*X.len/d[G])}return L};for(let O of o){let L=N(O);if(L>0){C.push(O),x.add(O),P.exactNames.has(O)&&(E=!0),v+=y(m.get(O))*(L/(Vh+L));continue}for(let G of g.get(O)??[]){let X=N(G.term);X&&(v+=y(_(G.term))*(X/(Vh+X))*G.dice,x.add(G.term),w.add(O))}}!C.length&&!w.size||(E&&(v*=K0),a||(P.isFixture?v*=Q0:P.isTest&&(v*=Z0)),b&&!P.file.endsWith(".go")&&(v*=S(b.get(P.file)??0)),k.push({d:P,score:Number(v.toFixed(4)),matched:C,matchedFields:M,symbolTerms:x,fuzzyHit:w}))}k.sort((I,P)=>P.score-I.score||T(I.d.file,P.d.file));let R=(n.exact?k.filter(I=>I.matched.length):k).slice(0,n.limit??z0).map(uR);return{results:R,explain:fR(t,o,m,g,R,r)}}function uR({d:e,score:t,matched:n,matchedFields:r,symbolTerms:o,fuzzyHit:s}){let l=e.decls.map(d=>{let u=new Set(gn(d.name)),f=0;for(let m of o)u.has(m)&&f++;return{decl:d,hits:f}}).filter(d=>d.hits>0).sort((d,u)=>u.hits-d.hits||T(d.decl.name,u.decl.name)).slice(0,H0).map(d=>d.decl),c={file:e.file,score:t,matchedTerms:n.sort(T),topSymbols:l.map(d=>d.name)};return r.size&&(c.matchedFields=il.filter(d=>r.has(d))),l.length&&(c.symbolHits=l,c.line=Math.min(...l.map(d=>d.line))),s.size&&(c.fuzzyTerms=[...s].sort(T)),n.length||(c.bridgedOnly=!0),c}function fR(e,t,n,r,o,s){let a=t.map(y=>{let b=n.get(y)??0,S=b===0?r.get(y)??[]:[];return S.length?{term:y,df:b,bridge:{via:S[0].via,to:S.map(k=>k.term),dice:S[0].dice}}:{term:y,df:b}}),l=a.filter(y=>y.df===0&&!y.bridge).map(y=>y.term).sort(T),c=!/\s/.test(e.trim()),d=c?us(e,s).map(y=>gn(y)[0]).filter(y=>y!==void 0):[],u=!c||!t.length?void 0:d.length>1?{term:e.trim(),df:Math.min(...d.map(y=>n.get(y)??0))}:{term:t[0],df:n.get(t[0])??0},f=o.filter(y=>y.bridgedOnly).length,m=o.length>0&&f===o.length,p=u?.df===0,g=o.length?p||m?"weak":"match":"none",h={query:e,terms:a,droppedStopwords:ii(e,s),unresolvedTerms:l,...u?{wholeIdentifier:u}:{},verdict:g,bridgedOnlyResults:f,resultCount:o.length},_=mR(h,p,m);return _&&(h.note=_),h}function mR(e,t,n){let{verdict:r,wholeIdentifier:o,resultCount:s,terms:a}=e;if(r!=="match"){if(!s){let l=e.unresolvedTerms;return l.length?`No file matches. ${l.length===1?"The term":"The terms"} ${l.join(", ")} ${l.length===1?"appears":"appear"} nowhere in this index.`:"No file matches this query."}if(t&&o){let l=a.filter(m=>m.term!==o.term&&m.df>0).map(m=>m.term).join(", "),c=a.find(m=>m.term===o.term),d=(c?c.bridge?.to:a.find(m=>m.df===0&&m.bridge)?.bridge?.to)??[],u=l?` The ${s} result${s===1?"":"s"} below match only its parts (${l}).`:"",f=d.length?` Closest indexed name${d.length===1?"":"s"}: ${d.join(", ")}.`:"";return`No file in this index defines or mentions "${o.term}".${u}${f} If you expected it here, check you are indexing the right branch or commit.`}if(n)return`Nothing matched verbatim. Every result below came from a near match: ${a.filter(d=>d.bridge).map(d=>`"${d.term}" \u2192 ${d.bridge.to.join(", ")}`).join("; ")}. Re-run with --exact to see only literal matches.`}}var Vh,z0,H0,G0,Jh,q0,il,V0,J0,K0,X0,Z0,Y0,Q0,eR,Kh,nR,rR,Mu,oR,Xh,Fs=H(()=>{"use strict";$();gt();et();dr();ce();Vh=1.2,z0=20,H0=5,G0=.6,Jh=3,q0=.9,il=["name","path","heading","summary","doc","body"],V0={name:3,path:2,heading:1.5,summary:1.5,doc:1.6,body:.7},J0={name:.75,path:.75,heading:.75,summary:.75,doc:.75,body:.4},K0=1.35,X0=new Set(["reexport","reexport-all"]),Z0=.65,Y0=/^(test|tests|spec|specs|fixture|fixtures|testdata|mock|mocks|stub|stubs)$/,Q0=.5,eR=/(^|\/)(testdata|test-data|test_data|fixtures?|__fixtures__|__snapshots__)(\/|$)/i,Kh=.1;nR=7,rR=32,Mu=3;oR=/^[a-z0-9]{2,}$/,Xh=new WeakMap});function Hr(e,t,n=.85){let r=new Map,o=e.length;if(o===0)return r;let s=new Map(e.map((d,u)=>[d,u])),a=Array.from({length:o},()=>[]),l=new Array(o).fill(0);for(let d of t){if(d.dangling)continue;let u=s.get(d.from),f=s.get(d.to);u===void 0||f===void 0||u===f||(a[u].push([f,d.weight]),l[u]+=d.weight)}let c=new Array(o).fill(1/o);for(let d=0;d<200;d++){let u=0;for(let g=0;gr.set(d,c[u])),r}function iy(e,t){let n=new Map;for(let h of e)n.set(h,0);let r=e.length;if(r<3)return n;let o=new Map(e.map((h,_)=>[h,_])),s=Array.from({length:r},()=>new Set);for(let h of t){if(h.dangling)continue;let _=o.get(h.from),y=o.get(h.to);_===void 0||y===void 0||_===y||(s[_].add(y),s[y].add(_))}let a=s.map(h=>[...h].sort((_,y)=>_-y)),l=new Float64Array(r),c=[],d=[],u=Array.from({length:r},()=>[]),f=new Float64Array(r),m=new Int32Array(r).fill(-1),p=new Float64Array(r);for(let h=0;h=0;_--){let y=c[_];for(let b of u[y])p[b]+=f[b]/f[y]*(1+p[y]);y!==h&&(l[y]+=p[y])}}let g=(r-1)*(r-2)/2;return e.forEach((h,_)=>n.set(h,l[_]/2/g)),n}function Iu(e){let t=[],n=e.modules.length;if(n>0){let o=e.modules.map(a=>a.id),s=Hr(o,e.moduleEdges);for(let a of e.modules)a.pagerank=Number(((s.get(a.id)??0)*n).toFixed(4));if(n>3e3)t.push(`betweenness skipped (${n} modules > 3000)`);else{let a=iy(o,e.moduleEdges);for(let l of e.modules)l.betweenness=Number((a.get(l.id)??0).toFixed(6))}}let r=e.files.length;if(r>0){let o=e.files.map(a=>a.id),s=Hr(o,e.fileEdges);for(let a of e.files)a.pagerank=Number(((s.get(a.id)??0)*r).toFixed(4))}return t}var Qi=H(()=>{"use strict";$()});function hR(e){let t=oy.get(e);if(!t){let n=["if","for","while",...pR[e]??gR];t=new RegExp(`(?r[0])]);e.block&&n.add("/"),e.backtick&&n.add("`"),t=new RegExp(`[${[...n].map(r=>"\\"+r).join("")}]`,"g"),ay.set(e,t)}return t}function al(e,t){let n=t&&xR[Fe(t)]||ur,r=e.length,o="",s=0,a=(u,f)=>{o+=e.slice(s,u)+e.slice(u,f).replace(/[^\n]/g," "),s=f},l=(u,f,m,p)=>{for(;ue.startsWith(f,d))){let f=e.indexOf(` -`,d),m=f===-1?r:f;a(d,m),d=m}else if(n.triple&&(e.startsWith('"""',d)||e.startsWith("'''",d))){let f=l(d+3,e.slice(d,d+3),!0,!0);a(d,f),d=f}else if(u==='"'||u==="'"&&!n.charOnly){let f=l(d+1,u,!0,!1);a(d,f),d=f}else if(u==="'"){ly.lastIndex=d;let f=ly.exec(e);f&&a(d,d+f[0].length),d+=f?f[0].length:1}else if(u==="`"&&n.backtick){let f=l(d+1,"`",n.backtick==="template",!0);a(d,f),d=f}else d++}return s===0?e:o+e.slice(s)}function cy(e,t){let n=t?Fe(t):"",r=(e.match(hR(n))??[]).length;return n==="python"&&(r+=(e.match(yR)??[]).length),bR.has(n)&&(r+=(e.match(_R)??[]).length),r}function $u(e,t){return 1+cy(al(e,t),t)}function eo(e,t,n=50){let r=[];for(let o of e.files){if(o.kind!=="code"||t&&o.rel!==t||!o.symbols.length)continue;let s=al(re(j(e.root,o.rel)),o.lang).split(` -`),a=o.symbols.filter(l=>l.kind!=="reexport"&&l.kind!=="reexport-all").sort((l,c)=>l.line-c.line||(c.endLine??c.line)-(l.endLine??l.line));a.forEach((l,c)=>{if(wR.has(l.kind))return;let d=l.endLine??l.line,u=s.slice(l.line-1,d);for(let m of kR(a,c,d))for(let p=m.line;p<=m.endLine;p++)u[p-l.line]="";let f={file:o.rel,name:l.name,line:l.line,complexity:1+cy(u.join(` -`),o.lang)};l.endLine!==void 0&&(f.endLine=l.endLine),r.push(f)})}return r.sort((o,s)=>s.complexity-o.complexity||T(o.file,s.file)||o.line-s.line),r.slice(0,n)}function kR(e,t,n){let r=e[t],o=[];for(let s=t+1;sn||(a.line>r.line||a.endLines.kind==="code"&&(t.get(s.rel)??0)>0).map(s=>{let a=r.get(s.rel),l=t.get(s.rel)??0;return{file:s.rel,complexity:a,commits:l,score:(l+1)*a}});return o.sort((s,a)=>a.score-s.score||T(s.file,a.file)),o.slice(0,n)}var pR,gR,oy,yR,_R,bR,wR,ur,qt,xR,ay,ly,Os=H(()=>{"use strict";$();me();ar();gt();Ze();ce();pR={js:["else\\s+if","case","catch"],c:["else\\s+if","case"],java:["else\\s+if","case","catch"],csharp:["else\\s+if","foreach","case","catch"],go:["else\\s+if","case"],rust:["else\\s+if","match"],kotlin:["else\\s+if","when","catch"],scala:["else\\s+if","match","case","catch"],swift:["else\\s+if","case","catch","guard"],php:["elseif","else\\s+if","foreach","case","catch"],dart:["else\\s+if","case","catch"],python:["elif","except"],ruby:["elsif","unless","until","when","rescue"],elixir:["unless","case","cond","rescue"],lua:["elseif"],shell:["elif","until","case"],perl:["elsif","unless","until","foreach"]},gR=["elif","elsif","else\\s+if","foreach","until","unless","case","when","match","catch","rescue","except"],oy=new Map;yR=/^[ \t]*case\b[^\n]*:[ \t]*$/gm,_R=/(?[n.rel,n]))}function ll(e){let t=dt(e);if(!t.symbolsByName){let n=new Map;for(let r of e.files)for(let o of r.symbols){let s=n.get(o.name);s?s.push(o):n.set(o.name,[o])}t.symbolsByName=n}return t.symbolsByName}function cn(e){let t=dt(e);return t.resolveCtx??=zi(e)}function Ot(e){let t=dt(e);if(!t.importPairs){let n=cn(e),r=new Set;for(let o of e.files)for(let s of o.refs){if(s.kind!=="import")continue;let a=ct(o.rel,o.ext,s.spec,n);a.kind==="resolved"&&a.target!==o.rel&&r.add(`${o.rel}|${a.target}`)}t.importPairs=r}return t.importPairs}function uy(e,t,n){let r=Tu.get(e);!r||r.resolveCtx!==t||r.importPairs||(r.importPairs=n)}function Pr(e){let t=dt(e);return t.uniqueDefs??=Fu(e)}function cl(e){let t=dt(e);return t.symbolRefs??=fu(e)}function Qa(e){let t=dt(e);if(t.docMentions)return t.docMentions;let n=Pr(e),r=new Map;if(n.size)for(let o of e.files){if(o.kind!=="doc")continue;let s=e.docText.get(o.rel),a=s??re(j(e.root,o.rel));if(!a)continue;let l=new Map;for(let c of a.split(/[^A-Za-z0-9_]+/))n.has(c)&&l.set(c,(l.get(c)??0)+1);r.set(o.rel,{counts:l,retained:s!==void 0})}return t.docMentions=r}function fy(e){let t=dt(e);if(t.identSets)return t.identSets;let n=new Map;for(let r of e.files)r.kind==="code"&&r.idents?.length&&n.set(r.rel,new Set(r.idents));return t.identSets=n}function Ns(e){let t=dt(e);return t.callerIndex??=Gr(e,Ot(e))}function Ps(e){let t=dt(e);return t.hierarchy??=gu(e,Ot(e))}function Ls(e){let t=dt(e);return t.symbolGraph??=xu(e,Ot(e))}function Au(e){let t=dt(e);return(t.bm25??={docs:ol(e)}).docs}function ny(e){let t=dt(e),n=t.bm25??={docs:ol(e)};return n.trigrams??=ey(n.docs)}function ry(e){let t=dt(e);if(!t.importPagerank){let n=e.files.map(o=>o.rel),r=[];for(let o of Ot(e)){let s=o.indexOf("|");r.push({from:o.slice(0,s),to:o.slice(s+1),kind:"import",weight:1})}t.importPagerank=Hr(n,r)}return t.importPagerank}function sy(e){let t=dt(e),n=t.bm25??={docs:ol(e)};return n.stems??=Qh(n.docs)}function dy(e){let t=dt(e);if(!t.fileComplexity){let n=new Map;for(let r of e.files)r.kind==="code"&&n.set(r.rel,$u(re(j(e.root,r.rel)),r.lang));t.fileComplexity=n}return t.fileComplexity}var Tu,gt=H(()=>{"use strict";$();me();$n();dl();Hi();lr();Fn();Br();Fs();Qi();Os();Ze();Tu=new WeakMap});function ul(e,t){let n=e.get(t);if(n)return n;for(let r of Tn(t).slice(1))for(let o of e.values())if(As(r,o.def))return o}function py(e,t,n={}){return hy(e,Ot(e),n.recall===!0,new Set(t))}function gy(e){return[...new Set(Tn(e).map(t=>t.name))]}function ER(e){return new Set(Ot(e))}function Gr(e,t,n={}){return hy(e,t??Ot(e),n.recall===!0)}function hy(e,t,n,r){let o=cr(e,t,{recall:n,only:r}),s=new Map;for(let c of e.files){let d=o.forFile(c);if(d)for(let u of c.calls){let f=d(u);if(!f)continue;let m=f.def.name+"\0"+f.def.file,p=s.get(m);p?f.def.lineT(f.file,m.file)||f.line-m.line),a.has(d.name)?a.set(`${d.name}@${d.file}`,{def:d,callers:u}):a.set(d.name,{def:d,callers:u})}return a}function vR(e,t,n){let r=e.files.find(o=>o.rel===t);if(r?.symbols.length)return On(r.symbols,n)}function On(e,t){let n;for(let r of e)my.has(r.kind)||r.line>t||r.endLine!==void 0&&t>r.endLine||(!n||r.line>n.line||r.line===n.line&&(r.endLine??1/0)<=(n.endLine??1/0))&&(n=r);return n}function Ou(e){return yy(e)}function mr(e,t){return yy(e,t).get(t)??[]}function yy(e,t){let n=new Map;for(let o of e.files){if(!o.calls?.length)continue;let s;for(let a of o.calls){if(t!==void 0&&a.name!==t)continue;s??=o.symbols.filter(u=>!my.has(u.kind));let l={file:o.rel,line:a.line};a.receiver!==void 0&&(l.receiver=a.receiver);let c=On(s,a.line);c&&(l.enclosingSymbol=c);let d=n.get(a.name);d||n.set(a.name,d=[]),d.push(l)}}let r=new Map;for(let o of[...n.keys()].sort(T)){let s=n.get(o);s.sort((a,l)=>T(a.file,l.file)||a.line-l.line),r.set(o,s)}return r}var my,lr=H(()=>{"use strict";$();Is();gt();ce();Lr();my=new Set(["reexport","reexport-all","default"])});function AR(e){let t=e.split("/"),n=t.pop()??e;return(/^v\d+$/.test(n)||n==="go")&&t.length&&(n=t.pop()),n.replace(/\.v\d+$/,"").replace(/^go-/,"").replace(/[-.]go$/,"").replace(/\W/g,"")}function IR(e,t){if(!e.includes(t))return;let n=Lu.get(t);n||(n=new RegExp(`(?:^|[(,\\s])${t}\\s*(?::\\s*["']?|\\s+[*&]?)\\s*(?:([A-Za-z_]\\w*)\\.)?(?:[A-Za-z_]\\w*\\.)*([A-Za-z_]\\w*)`),Lu.size<4096&&Lu.set(t,n));let r=n.exec(e);return r?{type:r[2],qualifier:r[1]}:void 0}function $R(e){if(!(!e?.signature||e.kind!=="method"))return/^func\s*\(\s*([A-Za-z_]\w*)\s/.exec(e.signature)?.[1]}function hu(e,t,n){let r=Ds(t),o,s=C=>(o??=new Map(e.files.map(M=>[M.rel,M]))).get(C),a=new Map;for(let C of e.files){let M=C.rel.endsWith("/__init__.py")||C.rel==="__init__.py"?{all:!0,names:new Set}:void 0;for(let x of C.symbols)x.kind!=="reexport"&&x.kind!=="reexport-all"||(M??={all:!1,names:new Set},x.kind==="reexport-all"?M.all=!0:M.names.add(x.name));M&&a.set(C.rel,M)}let l=new Map,c=(C,M)=>{let x=`${C}\0${M}`,w=l.get(x);if(w)return w;w=new Set;let E=[C];for(let N=0;N{if(!d){d=new Map;for(let x of e.files){let w=Fe(x.lang);if(!wy.has(w)||x.kind!=="code")continue;let E=`${w}\0${yt(x.rel)}`,N=d.get(E);N||d.set(E,N=[]),N.push(x)}}return d.get(`${C}\0${M}`)??[]},f=new Map,m=C=>{let M=Fe(C.lang);if(!wy.has(M))return null;let x=f.get(C.rel);if(x!==void 0)return x;let w=yt(C.rel),E=new Set;if(M==="go")for(let N of r.get(C.rel)??[])N.endsWith(".go")&&yt(N)!==w&&E.add(yt(N));return f.set(C.rel,x={own:w,test:no(C.rel),imported:E}),x},p=new WeakMap,g=(C,M,x,w,E)=>{let N=(L,G)=>{L.file===M.rel||E.has(L.file)||(G===x.own?x.test||!no(L.file):x.imported.has(G)&&!no(L.file))&&(E.add(L.file),w.push(L))};if(C.list.length<=x.imported.size+1){for(let L of C.list)N(L,yt(L.file));return}let O=p.get(C);if(!O){O=new Map;for(let L of C.list){let G=yt(L.file),X=O.get(G);X?X.push(L):O.set(G,[L])}p.set(C,O)}for(let L of O.get(x.own)??[])N(L,x.own);for(let L of x.imported)for(let G of O.get(L)??[])N(G,L)},h=(C,M,x,w)=>{if(M.size{for(let N of M){let O=a.get(N);if(O&&(h(C,c(N,x),w,E),!(O.all||!O.names.size)))for(let L of C.list)L.parent&&!E.has(L.file)&&O.names.has(L.parent)&&c(N,L.parent).has(L.file)&&(E.add(L.file),w.push(L))}},y=(C,M,x)=>{if(!C)return[];let w=m(M);if(w&&M.lang==="go"){let L=[];return g(C,M,w,L,new Set),L}let E=r.get(M.rel),N=Du(C,E),O=new Set(N.map(L=>L.file));return O.add(M.rel),E&&_(C,E,x,N,O),w&&g(C,M,w,N,O),N},b=(C,M,x)=>{if(!C)return[];let w=[],E=new Set;return h(C,new Set(M),w,E),_(C,M,x,w,E),w},S=n,k=ky.get(e),R=()=>(S??=cn(e),k?.ctx!==S&&ky.set(e,k={ctx:S,files:new Map}),k.files),I=C=>{let M=s(C);if(!M)return;let x=M.importAliases?.find(N=>N.local==="default"&&N.from===void 0);if(x)return x.name;let w=M.symbols.find(N=>N.kind==="default");if(w)return w.name;let E=C.slice(C.lastIndexOf("/")+1).replace(/\.[^.]+$/,"");return M.symbols.some(N=>N.name===E&&!N.parent)?E:void 0},P=C=>u("go",C).find(M=>!no(M.rel))?.symbols.find(M=>M.kind==="package")?.name;return{targets:C=>r.get(C),reached:y,within:b,aliases:C=>{let M=C.lang==="go";if(!C.importAliases?.length&&!(M&&C.refs.length))return MR;let x=R(),w=x.get(C.rel);if(w)return w;w={modules:new Map,names:new Map};let E=O=>{let L=ct(C.rel,C.ext,O,S);return L.kind==="resolved"&&L.target!==C.rel?L.target:null},N=(O,L)=>{let G=w.modules.get(O);G==null?w.modules.set(O,L):L&&w.modules.set(O,[...new Set([...G,...L])].sort(T))};if(M){let O=new Map;for(let L of C.importAliases??[])L.from!==void 0&&O.set(L.from,L.local);for(let L of C.refs){if(L.kind!=="import")continue;let G=E(L.spec),X=G===null?void 0:yt(G),oe=O.get(L.spec)??(X!==void 0?P(X):void 0)??AR(L.spec);N(oe,X!==void 0?u("go",X).filter(ue=>!no(ue.rel)).map(ue=>ue.rel):null)}}else for(let O of C.importAliases??[]){if(O.from===void 0)continue;let L=E(O.from);if(O.name==="*"){N(O.local,L?[L]:null);continue}if(C.lang==="python"){let X=E(O.from.endsWith(".")?O.from+O.name:`${O.from}.${O.name}`);if(X&&X!==L){N(O.local,[X]);continue}}if(w.names.has(O.local))continue;let G=O.name==="default"?(L?I(L):void 0)??O.local:O.name;w.names.set(O.local,{name:G,files:L?[L]:null})}return x.set(C.rel,w),w}}}function vy(e,t,n){Vi(e.any,t.name,t),Vi(n?e.member:e.free,t.name,t)}function Ry(e,t,n,r){if(r!=="member-first")return e[r].get(t)?.get(n);let o=e.member.get(t)?.get(n),s=e.free.get(t)?.get(n);if(!o||!s)return o??s;let a=new Map(o.byFile),l=[...o.list];for(let c of s.list)a.has(c.file)||(a.set(c.file,c),l.push(c));return{list:l,byFile:a}}function cr(e,t,n={}){let r=n.recall===!0,o=n.only,s=hu(e,t,n.ctx),a,l=new Map,c=new Set,d=v=>{let C=l.get(v);if(C)return C;let M=(a??=new Map(e.files.map(E=>[E.rel,E]))).get(v)?.symbols??[],x,w;for(let E of M)if(E.parent!==void 0){if(!w){w=new Map;for(let N of M)w.has(N.name)||w.set(N.name,N.kind)}RR.has(w.get(E.parent)??"")&&(x??=new Set).add(E.parent)}return l.set(v,C=x??c),C},u=v=>(a??=new Map(e.files.map(C=>[C.rel,C]))).has(v),f=(v,C)=>C.map(M=>v?`${v}/${M}`:M).find(u),m=(v,C)=>{if(C==="lib.rs"||C==="main.rs")return!0;let M=yt(v),x=M.slice(M.lastIndexOf("/")+1);return x==="examples"||x==="tests"||x==="benches"||x==="bin"&&/(^|\/)src\/bin$/.test(M)},p=(v,C)=>{let M=v.slice(v.lastIndexOf("/")+1),x;if(m(v,M))C==="crate"&&(x=v);else if(C==="crate")for(let w=yt(v);!x&&(x=f(w,["lib.rs","main.rs"]),!!w);w=yt(w));else{let w=yt(M==="mod.rs"?yt(v):v.slice(0,-3));x=f(w,["mod.rs","lib.rs","main.rs"])??(w&&u(`${w}.rs`)?`${w}.rs`:void 0)}return x===void 0?void 0:[x]},g=v=>v.parent!==void 0&&d(v.file).has(v.parent),h=v=>v.parent!==void 0&&!d(v.file).has(v.parent),_=new Map;for(let v of e.files){let C=xy[Fe(v.lang)]!==void 0;for(let M of v.symbols){if(fl.has(M.kind)||Nu.has(M.kind)||!M.exported&&!C||o&&!o.has(M.name))continue;let x=_.get(M.name);x?x.push(M):_.set(M.name,[M])}}let y=new Map,b=v=>{let C=y.get(v);if(C!==void 0)return C;let M=_.get(v);if(C=null,M){C={exported:Ey(),hidden:Ey()};for(let x of M)x.exported?vy(C.exported,x,h(x)):g(x)||vy(C.hidden,x,h(x))}return y.set(v,C),C},S=(v,C,M)=>{let x=b(v);return x?Ry(x.exported,v,C,M):void 0},k=(v,C,M)=>{let x=b(v);return x?Ry(x.hidden,v,C,M):void 0},R=new Map,I=v=>{let C=R.get(v);return C===void 0&&R.set(v,C=Ft(v)||Cs(yt(v)||"(root)")===2),C};return{forFile:v=>{if(!v.calls?.length||o&&!v.calls.some(V=>o.has(V.name)||v.importAliases?.some(Z=>Z.local===V.name)))return;let C=Fe(v.lang),M=!r&&by.has(C),x=xy[C],w=new Map,E=new Map,N=new Map,O=new Set,L=d(v.rel),G=V=>V.parent!==void 0&&!L.has(V.parent);for(let V of v.symbols)fl.has(V.kind)||Nu.has(V.kind)||(w.has(V.name)||w.set(V.name,V),G(V)?(N.has(V.name)||N.set(V.name,V),O.add(V.parent)):E.has(V.name)||E.set(V.name,V));let X,oe,ue,ve=(V,Z)=>{if(!oe){oe=new Map;for(let B of v.symbols){if(fl.has(B.kind)||Nu.has(B.kind)||!G(B))continue;let K=`${B.parent}\0${B.name}`;oe.has(K)||oe.set(K,B)}}return oe.get(`${V}\0${Z}`)},Oe=V=>{if(O.size){if(!ue){ue=new Map;for(let Z of O){let B=Z.toLowerCase();ue.set(B,ue.has(B)?null:Z)}}return ue.get(V.toLowerCase())}},z=s.aliases(v),U,q;if(C==="rust"){for(let V of["crate","super"]){let Z=p(v.rel,V);Z&&(U??=new Map).set(V,Z)}q=v.symbols.filter(V=>V.kind==="mod"&&V.endLine!==void 0&&V.endLine>V.line),q.length&&(U??=new Map).set(Sy,[v.rel])}let te=(V,Z)=>{let B=s.reached(S(V,C,Z),v,V),K=k(V,C,Z);if(K&&(x==="package"||x==="import")){let se=new Set(B.map(Ne=>Ne.file));for(let Ne of x==="package"?s.reached(K,v,V):Du(K,s.targets(v.rel)))x==="package"&&yt(Ne.file)!==yt(v.rel)||Ne.file!==v.rel&&!se.has(Ne.file)&&(se.add(Ne.file),B.push(Ne))}return B},ae=(V,Z,B)=>{if(Z!==void 0&&V.some(se=>se.parent===Z))return V.filter(se=>se.parent===Z);let K=B?.toLowerCase();return K!==void 0&&V.some(se=>se.parent?.toLowerCase()===K)?V.filter(se=>se.parent?.toLowerCase()===K):V},ge=(V,Z,B,K)=>({shape:V,receiver:Z,selfType:B,typeHint:K,results:new Map}),st=ge("bare"),Je=ge("outside"),he=new Map,fe=new Map,ye=(V,Z)=>{let B=V.receiver;if(B===void 0)return st;B==="super"&&q?.some(Se=>V.line>Se.line&&V.line<=Se.endLine)&&(B=Sy);let K=he.get(B);if(K)return K;let se=Se=>ge("self",B,Se,Se);if(!Pu.has(B)){if(U?.has(B))K=ge("module",B);else if(z.modules.has(B))K=ge("module",B);else if(O.has(B))K=se(B);else if(!by.has(C)){let Se=Oe(B);K=Se?se(Se):ge("foreign",B,void 0,z.names.get(B)?.name??B)}if(K)return he.set(B,K),K}Z===void 0&&(X??=v.symbols.filter(Se=>!fl.has(Se.kind)),Z=On(X,V.line));let Ne=fe.get(Z??null);return Ne||fe.set(Z??null,Ne=new Map),K=Ne.get(B),K||(K=at(B,Z,se),Ne.set(B,K),K)},at=(V,Z,B)=>{if(Pu.has(V))return B(Z?.parent);if(C==="go"&&$R(Z)===V)return B(Z.parent);let K=Z?.signature?IR(Z.signature,V):void 0;if(K?.qualifier!==void 0&&!r&&z.modules.get(K.qualifier)===null)return Je;if(K!==void 0&&O.has(K.type))return B(K.type);let se=K===void 0?Oe(V):void 0;return se?B(se):ge("foreign",V,void 0,K?.type??z.names.get(V)?.name??V)},ne=(V,Z)=>{let{shape:B,receiver:K,selfType:se,typeHint:Ne}=Z;if(B==="outside")return null;let Se;if(r?Se=w.get(V):B==="bare"?Se=M?E.get(V):w.get(V):B==="self"&&(Se=se!==void 0?ve(se,V):void 0,!Se&&K!==void 0&&Pu.has(K)&&(Se=N.get(V))),Se)return o&&!o.has(Se.name)?null:{hit:{def:Se,corroborated:!0},local:!0};let Zt,un=V;if(B==="bare"){let Lt=z.names.get(V);Lt&&({name:un,files:Zt}=Lt)}else B==="module"&&(Zt=U?.get(K)??z.modules.get(K));let vn=U?.has(K)===!0&&B==="module";if(o&&!o.has(un))return null;let ni=M?B==="bare"||B==="module"?"free":B==="self"||C==="go"?"member":"member-first":"any",Kb=ni==="member-first"?"member":ni;if(Zt!==void 0)if(Zt===null){if(!r)return null}else{let Lt=s.within(S(un,C,ni),Zt,un);if(x==="import"||vn)for(let lm of s.within(k(un,C,ni),Zt,un))Lt.includes(lm)||Lt.push(lm);let ri=Dr(v.rel,Lt);if(ri)return{hit:{def:ri,corroborated:!0},local:!1};if(Lt.length||!r&&_y.has(C))return null}let im=ae(te(un,ni),Ne,K);if(im.length){let Lt=Dr(v.rel,im);return Lt?{hit:{def:Lt,corroborated:!0},local:!1}:null}let om=S(un,C,r?"any":Kb);if(!om)return null;let Ec=Cy(om,v.rel);if(!Ec.length)return null;let vc=[...Ec];if(r){if(C==="js"&&Ec.length!==1)return null}else{if(_y.has(C))return null;let Lt=I(v.rel);vc=vc.filter(ri=>!Cu(ri.file)&&(Lt||!I(ri.file)))}let am=Dr(v.rel,ae(vc,Ne,K));return am?{hit:{def:am,corroborated:!1},local:!1}:null};return(V,Z)=>{let B=ye(V,Z),K=B.results.get(V.name);if(K===void 0&&B.results.set(V.name,K=ne(V.name,B)),!!K&&!(K.local&&K.hit.def.line===V.line))return K.hit}}}}var fl,_y,by,wy,xy,Nu,Sy,Pu,RR,CR,MR,yt,no,Lu,ky,Ey,Is=H(()=>{"use strict";$();$n();ar();lr();gt();Ms();dr();ce();fl=new Set(["reexport","reexport-all","default"]),_y=new Set(["js","go"]),by=new Set(["go","python"]),wy=new Set(["go","java"]),xy={go:"package",java:"package",python:"import",rust:"path"},Nu=new Set(["mod","module","package","namespace"]),Sy="super\0inline",Pu=new Set(["self","cls","this","Self"]),RR=new Set(["function","method","def","constructor","operator"]),CR=3,MR={modules:new Map,names:new Map},yt=e=>e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",no=e=>e.endsWith("_test.go");Lu=new Map;ky=new WeakMap;Ey=()=>({any:new Map,free:new Map,member:new Map})});function Fe(e){return TR.has(e)?"js":e==="c"||e==="cpp"?"c":e}function FR(e,t){let n=Math.min(e.length,t.length),r=0,o=0;for(;or?(r=a,n=s,o=!1):a===r&&(o=!0)}return o?void 0:n}function Vi(e,t,n){let r=e.get(t);r||e.set(t,r=new Map);for(let a of r.values())if(a.byFile.has(n.file))return!1;let o=Fe(n.lang),s=r.get(o);return s||r.set(o,s={list:[],byFile:new Map}),s.list.push(n),s.byFile.set(n.file,n),!0}function Ds(e){let t=new Map;for(let n of e)for(let r=n.indexOf("|");r!==-1;r=n.indexOf("|",r+1)){let o=n.slice(0,r),s=n.slice(r+1);if(o===s)continue;let a=t.get(o);a||t.set(o,a=new Set),a.add(s)}return t}function Du(e,t){if(!t?.size)return[];if(t.sizet.has(n.file))}function Cy(e,t){return e.byFile.has(t)?e.list.filter(n=>n.file!==t):e.list}function ju(e,t,n){let r=cr(e,t,{ctx:n}),o=new Map;for(let s of e.files){let a=r.forFile(s);if(a)for(let l of s.calls){let c=a(l);if(!c||c.def.file===s.rel)continue;let d=c.corroborated?"extracted":"inferred",u=`${s.rel}|${c.def.file}`,f=o.get(u);f?(f.weight+=1,d==="extracted"&&(f.confidence="extracted")):o.set(u,{from:s.rel,to:c.def.file,weight:1,confidence:d})}}return[...o.values()].map(s=>({from:s.from,to:s.to,kind:"call",weight:Math.min(s.weight,5),confidence:s.confidence})).sort((s,a)=>T(s.from,a.from)||T(s.to,a.to))}var TR,ar=H(()=>{"use strict";$();Is();ce();TR=new Set(["typescript","javascript","vue","svelte","astro"])});function OR(e){return e.length<5?!1:/[a-z][A-Z]/.test(e)||/[A-Z]{2}/.test(e)||e.includes("_")||/\d/.test(e)}function Fu(e){let t=new Map;for(let r of e.files)for(let o of r.symbols){if(!o.exported||NR.has(o.kind)||!OR(o.name))continue;let s=t.get(o.name);s||t.set(o.name,s=new Set),s.add(r.rel)}let n=new Map;for(let[r,o]of t)o.size===1&&n.set(r,[...o][0]);return n}function Nn(e,t){let n=My(t.from,t.to,t.kind),r=e.get(n);if(r){r.weight+=t.weight;return}e.set(n,{...t})}function Bu(e,t,n,r,o){let s=new Map,a=new Set;for(let R of e.files){let I;for(let P of R.refs){if(P.soft){(I??=[]).push(P);continue}if(P.kind==="doc-link"){let v=sr(R.rel,P.spec,t);if(v.kind==="external")continue;v.kind==="dangling"?Nn(s,{from:R.rel,to:P.spec,kind:"doc-link",weight:1,dangling:!0,reason:v.reason}):v.target!==R.rel&&Nn(s,{from:R.rel,to:v.target,kind:"doc-link",weight:1})}else{let v=ct(R.rel,R.ext,P.spec,t);if(v.kind==="external")continue;v.kind==="dangling"?Nn(s,{from:R.rel,to:P.spec,kind:"import",weight:1,dangling:!0,reason:v.reason}):v.target!==R.rel&&(Nn(s,{from:R.rel,to:v.target,kind:"import",weight:1}),a.add(`${R.rel}|${v.target}`))}}for(let P of I??[]){let v=P.kind==="doc-link"?sr(R.rel,P.spec,t):ct(R.rel,R.ext,P.spec,t);v.kind!=="resolved"||v.target===R.rel||s.has(My(R.rel,v.target,P.kind))||(Nn(s,{from:R.rel,to:v.target,kind:P.kind,weight:1}),P.kind==="import"&&a.add(`${R.rel}|${v.target}`))}}let l=new Set;for(let R of ju(e,a,t))Nn(s,R),l.add(`${R.from}|${R.to}`);for(let R of pu(e,a,t))Nn(s,R);uy(e,t,a);let c=Pr(e);if(c.size){let R,I=(v,C)=>{let M=ml(C);for(let x of(R??=Ds(a)).get(v)??[])if(ml(x)===M)return!0;return!1},P=new Map(e.files.map(v=>[v.rel,v.lang]));for(let v of e.files){if(v.kind!=="code"||!v.idents?.length)continue;let C=new Set([...v.importedNames??[],...(v.importAliases??[]).map(E=>E.local)]),M=Fe(v.lang),x=new Map;for(let E of v.idents){let N=c.get(E);!N||N===v.rel||C.has(E)||Fe(P.get(N)??"")===M&&x.set(N,(x.get(N)??0)+1)}let w=v.lang==="go";for(let[E,N]of x){let O=`${v.rel}|${E}`;a.has(O)||l.has(O)||w&&E.endsWith(".go")&&ml(E)!==ml(v.rel)&&!I(v.rel,E)||Nn(s,{from:v.rel,to:E,kind:"use",weight:Math.min(N,5)})}}}if(c.size)for(let[R,{counts:I}]of Qa(e))for(let[P,v]of I){let C=c.get(P);C!==R&&Nn(s,{from:R,to:C,kind:"mention",weight:Math.min(v,5)})}let d=[...s.values()].sort((R,I)=>T(R.from,I.from)||T(R.to,I.to)||T(R.kind,I.kind)),u=new Map,f=new Map,m=new Set(e.files.map(R=>R.rel));for(let R of d)R.dangling||!m.has(R.to)||(f.set(R.from,(f.get(R.from)??0)+1),u.set(R.to,(u.get(R.to)??0)+1));let p={import:7,extends:6,implements:5,call:4,use:3,"doc-link":2,mention:1,contains:0},g=new Map;for(let R of d){if(R.dangling||!m.has(R.to))continue;let I=r.get(R.from),P=r.get(R.to);if(!I||!P||I===P)continue;let v=`${I}${Wu}${P}`,C=g.get(v);C?(C.weight+=R.weight,(p[R.kind]??0)>(p[C.kind]??0)&&(C.kind=R.kind)):g.set(v,{from:I,to:P,kind:R.kind,weight:R.weight})}let h=[...g.values()].sort((R,I)=>T(R.from,I.from)||T(R.to,I.to)),_=new Map,y=new Map;for(let R of h)y.set(R.from,(y.get(R.from)??0)+1),_.set(R.to,(_.get(R.to)??0)+1);let b=e.files.map(R=>({id:R.rel,kind:"file",rel:R.rel,fileKind:R.kind,lang:R.lang,module:r.get(R.rel)??"root",title:R.title,summary:R.summary,symbols:R.symbols.length,lines:R.lines,degIn:u.get(R.rel)??0,degOut:f.get(R.rel)??0,...R.generated?{generated:R.generated}:{}})).sort((R,I)=>T(R.rel,I.rel)),S=new Map;for(let R of e.files){let I=r.get(R.rel)??"root";S.set(I,(S.get(I)??0)+R.symbols.length)}let k=n.map(R=>({id:R.slug,kind:"module",slug:R.slug,path:R.path,title:R.title,summary:R.summary,tier:R.tier,members:R.members,symbols:S.get(R.slug)??0,degIn:_.get(R.slug)??0,degOut:y.get(R.slug)??0})).sort((R,I)=>T(R.slug,I.slug));return{schemaVersion:o?.schemaVersion??5,version:o?.version??Ie,commit:e.commit,fileCount:e.files.length,languages:e.languages,files:b,modules:k,fileEdges:d,moduleEdges:h}}var ml,NR,Wu,My,dl=H(()=>{"use strict";$();bt();$n();ar();Fn();gt();ce();ml=e=>e.includes("/")?e.slice(0,e.lastIndexOf("/")):"";NR=new Set(["reexport","reexport-all","default"]);Wu="\0",My=(e,t,n)=>`${e}${Wu}${t}${Wu}${n}`});function*PR(e){for(let t of e.files)yield*t.symbols}function ro(e,t){let n=fr(e).get(t);return n?[...n.symbols].filter(r=>!pl.has(r.kind)).sort((r,o)=>r.line-o.line||T(r.name,o.name)):[]}function gl(e,t,n){let r=fr(e).get(t);if(!r)return;let o=On(r.symbols,n);if(!o)return{file:t,line:n,symbol:null,enclosing:[]};let s=Math.max(n,o.endLine??n),a=r.symbols.filter(c=>c!==o&&!pl.has(c.kind)&&c.endLine!==void 0&&c.line<=o.line&&c.endLine>=s).sort((c,d)=>c.line-d.line||d.endLine-c.endLine||T(c.name,d.name)).map(ht),l=ht(o);return{file:t,line:n,symbol:{...o,id:l},enclosing:[...new Set(a)].filter(c=>c!==l),...o.endLine===void 0?{approximate:!0}:{}}}function so(e,t){let n=fr(e);return{...t,callers:t.callers.map(r=>{let o=On(n.get(r.file)?.symbols??[],r.line);return o?{...r,caller:ht(o)}:{...r}})}}function wn(e,t,n={}){let r=t.split("/").filter(Boolean);if(!r.length)return[];let o=r[r.length-1],s=r.slice(0,-1),a=(u,f)=>n.substring?u.toLowerCase().includes(f.toLowerCase()):u===f,l=[],c=n.substring?PR(e):ll(e).get(o)??[];for(let u of c)if(!pl.has(u.kind)&&a(u.name,o)){if(s.length){let f=s[s.length-1];if(!u.parent||u.parent!==f)continue}l.push({...u})}l.sort((u,f)=>+(f.name===o)-+(u.name===o)||T(u.file,f.file)||u.line-f.line);let d=l.slice(0,n.maxResults??50);if(n.includeBody){let u=new Map,f=new Set;for(let m of d){let p=m.endLine??m.line;if(f.has(m.file))continue;let g=u.get(m.file);if(!g){let h=re(j(e.root,m.file));if(!h){f.add(m.file);continue}g=h.split(` +`||t[a]==="\r");)a++;if(t[a]==="}"||t[a]==="]")continue}r+=s}try{return JSON.parse(r)}catch{return}}function t0(e,t,n,r){let o=Te(V.join(t,n)),s=n.endsWith(".json")?[o]:[o+".json",V.join(o,"tsconfig.json")];for(let a of s)if(e.has(a))return a;if(!(n.startsWith(".")||n.startsWith("/")))for(let a of r){let l;if(n===a.name)l=[...a.tsconfig?[a.tsconfig]:[],"tsconfig.json"];else if(n.startsWith(a.name+"/")){let c=n.slice(a.name.length+1);l=c.endsWith(".json")?[c]:[c+".json",V.join(c,"tsconfig.json")]}else continue;for(let c of l){let d=Te(V.join(a.dir,c));if(!d.startsWith("..")&&e.has(d))return d}return}}function qh(e,t,n,r,o,s){if(!o.has(n)){o.add(n);try{return n0(e,t,n,r,o,s)}finally{o.delete(n)}}}function n0(e,t,n,r,o,s){let a=Wr(se(j(e,n)));if(a===void 0){r.push(`unparseable ${n} \u2014 its path aliases were ignored`);return}let l=n.includes("/")?V.dirname(n):"",c={baseUrlDir:"",pathsDir:""},d=a.extends===void 0?[]:Array.isArray(a.extends)?a.extends:[a.extends];for(let f of d){if(typeof f!="string")continue;let m=t0(t,l,f,s);if(!m){/^\.\.?\//.test(f)&&r.push(`${n} extends "${f}" which is missing \u2014 its path aliases were ignored`);continue}let p=qh(e,t,m,r,o,s);p?.baseUrl!==void 0&&(c.baseUrl=p.baseUrl,c.baseUrlDir=p.baseUrlDir),p?.paths&&(c.paths=p.paths,c.pathsDir=p.pathsDir)}let u=a.compilerOptions;return typeof u?.baseUrl=="string"&&(c.baseUrl=u.baseUrl,c.baseUrlDir=l),u?.paths&&(c.paths=u.paths,c.pathsDir=l),c}function Ph(e){let t=gu.indexOf(e);return t!==-1?t:e==="types"?gu.length+1:gu.length}function nl(e,t){if(!(t.length>=r0)){if(typeof e=="string")t.includes(e)||t.push(e);else if(Array.isArray(e))for(let n of e)nl(n,t);else if(e!==null&&typeof e=="object"){let n=Object.keys(e).sort((r,o)=>Ph(r)-Ph(o)||(ro?1:0));for(let r of n)nl(e[r],t)}}}function s0(e){if(e==null)return[];let t=[],n=(r,o)=>{let s=[];nl(o,s),s.length&&t.push({key:r,star:r.includes("*"),targets:s})};if(typeof e=="string"||Array.isArray(e))n(".",e);else if(typeof e=="object"){let r=Object.keys(e);if(r.every(o=>o==="."||o.startsWith("./")))for(let o of r)n(o,e[o]);else n(".",e)}return t.sort((r,o)=>Number(r.star)-Number(o.star)||o.key.length-r.key.length||(r.keyNumber(n.star)-Number(r.star)||r.key.length-n.key.length||T(n.key,r.key)),t}function Lh(e,t){for(let n of e){if(!n.star){if(n.key===t)return n.targets;continue}let r=n.key.indexOf("*"),o=n.key.slice(0,r),s=n.key.slice(r+1);if(!t.startsWith(o)||!t.endsWith(s)||t.lengthl.replace(/\*/g,()=>a))}}function o0(e,t){let n=[],r=o=>{let s=/^\s*([^\s=]+)(?:\s+v\S+)?\s*=>\s*(\S+)(?:\s+v\S+)?\s*$/.exec(o);if(!s)return;let a=s[2];if(!/^\.\.?\//.test(a))return;let l=Te(V.join(t,a));l.startsWith("..")||n.push({from:s[1],toDir:l})};for(let o of e.matchAll(/^[ \t]*replace[ \t]+([^(\r\n][^\r\n]*)$/gm))r(o[1]);for(let o of e.matchAll(/^[ \t]*replace[ \t]*\(([\s\S]*?)\)/gm))for(let s of o[1].split(/\r?\n/))r(s);return n}function a0(e,t){let n={dir:t,deps:new Map},r=l=>{let c=/^(?:"([^"]*)"|'([^']*)')$/.exec(l);return c?c[1]??c[2]:void 0},o=(l,c)=>{let d=l.get(c);return d||l.set(c,d={}),d},s=(l,c,d)=>{c==="package"||c==="path"?l[c]=r(d)??l[c]:c==="workspace"&&(l.workspace=d==="true")},a="";for(let l of e.split(/\r?\n/)){let c=l.replace(/^((?:[^"'#]|"[^"]*"|'[^']*')*)#.*$/,"$1").trim(),d=/^\[\[?([^\]]+)\]\]?$/.exec(c);if(d){a=d[1].replace(/["'\s]/g,""),(a==="workspace"||a.startsWith("workspace."))&&(n.workspaceDeps??=new Map);continue}let u=/^([\w.-]+)\s*=\s*(.+)$/.exec(c);if(!u)continue;let f=u[1],m=u[2];if(a==="package"){f==="name"?n.packageName=r(m)??n.packageName:f==="edition"?n.edition=r(m)??(/workspace\s*=\s*true/.test(m)?"workspace":void 0):f==="edition.workspace"&&(n.edition="workspace");continue}if(a==="lib"){f==="name"?n.libName=r(m)??n.libName:f==="path"&&(n.libPath=r(m)??n.libPath);continue}let p=/^(?:(workspace)\.|target\..+\.)?(?:dev-|build-)?dependencies(?:\.(.+))?$/.exec(a);if(!p)continue;let g=p[1]?n.workspaceDeps:n.deps;if(p[2]){s(o(g,p[2]),f,m);continue}let h=/^([\w-]+)\.(package|path|workspace)$/.exec(f);if(h)s(o(g,h[1]),h[2],m);else if(m.startsWith("{")){let _=o(g,f);for(let y of m.matchAll(/\b(package|path|workspace)\s*=\s*("[^"]*"|'[^']*'|true|false)/g))s(_,y[1],y[2])}}return n}function l0(e,t){let n=[],r=[...t].filter(c=>c==="Cargo.toml"||c.endsWith("/Cargo.toml"));for(let c of r.sort(T))n.push(a0(se(j(e,c)),c.includes("/")?V.dirname(c):""));let o=n.filter(c=>c.packageName!==void 0),s=new Map(o.map(c=>[c.dir,c])),a=(c,d)=>!d||c===d||c.startsWith(d+"/"),l=[];for(let c of o){let d=Te(V.join(c.dir,"src")).replace(/^\.$/,""),u=c.libPath?Te(V.join(c.dir,c.libPath)):void 0,f=u&&!u.startsWith("..")&&t.has(u)?u:void 0,m=f?f.includes("/")?V.dirname(f):"":d,p=f??e0(t,[V.join(d,"lib.rs"),V.join(d,"main.rs")]),g=n.filter(_=>_.workspaceDeps&&a(c.dir,_.dir)).sort((_,y)=>y.dir.length-_.dir.length)[0],h=new Map;for(let[_,y]of[...c.deps].sort((b,S)=>T(b[0],S[0]))){let b=y.workspace?g?.workspaceDeps?.get(_):y;if(!b?.package)continue;let S=y.workspace?g.dir:c.dir,k=b.path?s.get(Te(V.join(S,b.path)).replace(/^\.$/,"")):o.find(C=>C.packageName===b.package);k&&h.set(_.replace(/-/g,"_"),k.dir)}l.push({name:(c.libName??c.packageName).replace(/-/g,"_"),dir:c.dir,srcDir:m,rootFile:p,...h.size?{renames:h}:{},...c.edition===void 0||c.edition==="2015"?{edition2015:!0}:{}})}return l.sort((c,d)=>d.dir.length-c.dir.length||(c.dirv.rel)),n=new Map,r=new Set;for(let v of e.files){let R=v.rel.includes("/")?V.dirname(v.rel):"",M=n.get(R);M||n.set(R,M=[]),M.push(v.rel);let x=R;for(;x&&!r.has(x);)r.add(x),x=x.includes("/")?V.dirname(x):""}let o=[],s=[],a=[],l=[];for(let v of t){if(v!=="package.json"&&!v.endsWith("/package.json"))continue;let R=Wr(se(j(e.root,v)));if(R===void 0){s.push(`unparseable ${v} \u2014 skipped for workspace resolution`);continue}let M=v.includes("/")?V.dirname(v):"";if(l.push({dir:M,importEntries:i0(R.imports)}),typeof R.name!="string")continue;let x=[R.source,R.main,R.module,R.types].filter(w=>typeof w=="string");a.push({name:R.name,dir:M,exportEntries:s0(R.exports),mainCandidates:x,...typeof R.tsconfig=="string"?{tsconfig:R.tsconfig}:{}})}a.sort((v,R)=>R.name.length-v.name.length),l.sort((v,R)=>R.dir.length-v.dir.length||T(v.dir,R.dir));let c=[];for(let v of t){let R=v.slice(v.lastIndexOf("/")+1);if(R!=="tsconfig.json"&&R!=="jsconfig.json"&&!(v==="tsconfig.base.json"))continue;let x=v.includes("/")?V.dirname(v):"",w=qh(e.root,t,v,o,new Set,a);if(!w||!w.paths&&w.baseUrl===void 0)continue;let E=w.baseUrl===void 0?w.pathsDir:w.baseUrl.startsWith(tl)?Te(V.join(x,w.baseUrl.slice(tl.length))).replace(/^\.$/,""):Te(V.join(w.baseUrlDir,w.baseUrl)).replace(/^\.$/,""),N=V.relative(E,x)||".",O=[];for(let[L,H]of Object.entries(w.paths??{})){if(!Array.isArray(H))continue;let X=L.endsWith("*");O.push({prefix:X?L.slice(0,-1):L,star:X,targets:H.filter(le=>typeof le=="string").map(le=>le.startsWith(tl)?V.join(N,le.slice(tl.length)):le)})}O.sort((L,H)=>Number(L.star)-Number(H.star)||H.prefix.length-L.prefix.length||T(L.prefix,H.prefix)),!(!O.length&&w.baseUrl===void 0)&&c.push({dir:x,file:R,baseUrl:E,baseUrlSet:w.baseUrl!==void 0,paths:O})}let d=v=>v==="tsconfig.json"?0:v==="jsconfig.json"?1:2;c.sort((v,R)=>R.dir.length-v.dir.length||d(v.file)-d(R.file)),o.push(...s);let u=[];for(let v of t){if(v!=="go.mod"&&!v.endsWith("/go.mod"))continue;let R=se(j(e.root,v)),M=/^\s*module\s+(\S+)/m.exec(R);if(!M)continue;let x=v.includes("/")?V.dirname(v):"";u.push({module:M[1],dir:x,replaces:o0(R,x)})}u.sort((v,R)=>R.dir.length-v.dir.length||(v.dirR.prefix.length-v.prefix.length);let b=new Map;for(let v of e.files){if(v.ext!==".cs"||!v.pkg)continue;let R=b.get(v.pkg);R||b.set(v.pkg,R=[]),R.push(v.rel)}for(let v of b.values())v.sort(T);let S=[...m].sort(Ji),k=new Map,C=[...t].filter(v=>v==="pubspec.yaml"||v.endsWith("/pubspec.yaml"));for(let v of C.sort(T)){let R=/^name:[ \t]*["']?(\w+)["']?[ \t]*(?:#.*)?$/m.exec(se(j(e.root,v)));R&&!k.has(R[1])&&k.set(R[1],v.includes("/")?V.dirname(v):"")}let I=new Set([""]);for(let v of r){let R=v.slice(v.lastIndexOf("/")+1);(R==="lua"||R==="src"||R==="lib")&&I.add(v)}let P=new Map;for(let v of e.files)if(!(v.ext!==".ex"&&v.ext!==".exs"))for(let R of v.symbols){if(R.kind!=="module")continue;let M=R.parentPath?R.parentPath.replace(/\//g,"."):R.parent,x=M?M+"."+R.name:R.name,w=P.get(x);(w===void 0||T(v.rel,w)<0)&&P.set(x,v.rel)}return{fileSet:t,dirSet:r,filesByDir:n,tsConfigs:c,goModules:u,rustCrates:f,javaRoots:S,jvm:Vh({filesByDir:n,javaRoots:S},e.files),dartPackages:k,luaRoots:[...I].sort(Ji),root:e.root,svelteKitRoots:[...t].filter(v=>/(?:^|\/)svelte\.config\.(?:js|ts|mjs|cjs)$/.test(v)).map(v=>v.includes("/")?V.dirname(v):"").sort((v,R)=>R.length-v.length||T(v,R)),elixirModules:P,pyRoots:[...g].sort(Ji),workspacePackages:a,packageScopes:l,cIncludeRoots:[...h].sort(Ji),rubyLibRoots:[..._].sort(Ji),phpPsr4:y,csharpNamespaces:b,warnings:o}}function Xt(e,t){for(let n of t){let r=Te(n);if(r&&!r.startsWith("..")&&e.fileSet.has(r))return r}}function cr(e,t,n){let r=t.split("#")[0].split("?")[0];if(!r)return{kind:"external"};if(r.startsWith("//")||/^[a-z][a-z0-9+.-]*:/i.test(r))return{kind:"external"};let o=r.startsWith("/"),s=o||!e.includes("/")?"":V.dirname(e),a=Te(V.join(s,o?r.slice(1):r));if(a==="."&&(a=""),a.startsWith(".."))return{kind:"dangling",reason:"escapes-repo-root"};let l=u=>[u,u+".md",u+".mdx",V.join(u,"README.md"),V.join(u,"readme.md"),V.join(u,"index.md"),V.join(u,"index.mdx")],c=a;try{c=Te(decodeURIComponent(a))}catch{}if(c.startsWith(".."))return{kind:"dangling",reason:"escapes-repo-root"};let d=Xt(n,c===a?l(a):[...l(a),...l(c)]);return d?{kind:"resolved",target:d}:!a||n.dirSet.has(a)?{kind:"external"}:n.root&&[a,c].some(u=>Q(j(n.root,u)))?{kind:"external"}:{kind:"dangling",reason:"missing-target"}}function c0(e,t,n){let r=f=>Xt(n,[...Zv.map(m=>f+m),...Yv.map(m=>V.join(f,m))]),o=f=>{let m=r(f);if(m)return m;let p=f.replace(/\.(js|jsx|mjs|cjs)$/,"");return p!==f?r(p):void 0},s=(f,m)=>{for(let p of[m,...yu(m)]){let g=o(Te(V.join(f,p)));if(g)return g}},a=t.indexOf("?"),l=a===-1?t:t.slice(0,a);if(!l)return{kind:"external"};let c=n.svelteKitRoots?.find(f=>!f||e.startsWith(f+"/"));if(l.startsWith(".")){let f=e.includes("/")?V.dirname(e):"",m=Te(V.join(f,l));if(m.startsWith(".."))return{kind:"dangling",reason:"escapes-repo-root"};let p=o(m);return p?{kind:"resolved",target:p}:c!==void 0&&/(?:^|\/)\$types(?:\.d\.ts|\.js)?$/.test(l)?{kind:"external"}:{kind:"dangling",reason:"missing-module"}}let d,u;for(let f of n.tsConfigs){if(f.dir&&e!==f.dir&&!e.startsWith(f.dir+"/"))continue;u===void 0&&f.baseUrlSet&&(u=f.baseUrl);let m=!1;for(let p of f.paths){if(!(p.star?l.startsWith(p.prefix):l===p.prefix))continue;m=!0;let g=p.star?l.slice(p.prefix.length):"",h=!1;for(let _ of p.targets){let y=p.star?_.replace(/\*/,()=>g):_,b=Te(V.join(f.baseUrl,y)),S=o(b);if(S)return{kind:"resolved",target:S};let k=b.includes("/")?V.dirname(b):"";(n.dirSet.has(k)||n.fileSet.has(b))&&(h=!0)}d=h?{kind:"dangling",reason:"alias-unresolved"}:{kind:"external"};break}if(m)break}if(u!==void 0&&!l.startsWith("/")){let f=o(Te(V.join(u,l)));if(f)return{kind:"resolved",target:f}}if(c!==void 0&&!d&&(l==="$lib"||l.startsWith("$lib/"))){let f=Te(V.join(c,"src/lib",l.slice(4))),m=o(f);if(m)return{kind:"resolved",target:m};if(n.dirSet.has(Te(V.join(c,"src/lib"))))return{kind:"dangling",reason:"alias-unresolved"}}if(l.startsWith("#")){let f=n.packageScopes.find(p=>!p.dir||e.startsWith(p.dir+"/")),m=f?Lh(f.importEntries,l):void 0;for(let p of m??[]){let g=f&&p.startsWith("./")?s(f.dir,p):void 0;if(g)return{kind:"resolved",target:g}}return d??{kind:"external"}}for(let f of n.workspacePackages){if(l!==f.name&&!l.startsWith(f.name+"/"))continue;let m=l.slice(f.name.length).replace(/^\//,"");for(let g of Lh(f.exportEntries,m?"./"+m:".")??[]){let h=s(f.dir,g);if(h)return{kind:"resolved",target:h}}if(!m)for(let g of f.mainCandidates){let h=s(f.dir,g);if(h)return{kind:"resolved",target:h}}let p=m?[V.join(f.dir,"src",m),V.join(f.dir,m)]:[V.join(f.dir,"src","index"),V.join(f.dir,"index"),V.join(f.dir,"src")];for(let g of p){let h=o(Te(g));if(h)return{kind:"resolved",target:h}}return{kind:"external"}}return d??{kind:"external"}}function d0(e,t,n){let r=(a,l)=>{let c=l?l.replace(/\./g,"/"):"",d=Te(V.join(a,c));return Xt(n,[d+".py",d+".pyi",V.join(d,"__init__.py")])};if(t.startsWith(".")){let a=/^\.+/.exec(t)[0].length,l=t.slice(a),c=e.includes("/")?V.dirname(e):"",d=c?c.split("/"):[];if(a-1>d.length)return{kind:"dangling",reason:"escapes-repo-root"};let u=d.slice(0,d.length-(a-1)).join("/");if(l){let m=r(u,l);return m?{kind:"resolved",target:m}:{kind:"dangling",reason:"missing-module"}}let f=Xt(n,[V.join(u,"__init__.py")]);return f?{kind:"resolved",target:f}:{kind:"external"}}let o=[],s=[];for(let a of n.pyRoots)(!a||e.startsWith(a+"/")?o:s).push(a);for(let a of[...o.reverse(),...s]){let l=r(a,t);if(l)return{kind:"resolved",target:l}}return{kind:"external"}}function u0(e,t,n){if(!n.goModules.length)return{kind:"external"};let r=c=>{let d=Te(c).replace(/^\.$/,""),u=Kv(n,d,".go"),f=u.find(m=>!m.endsWith("_test.go"))??u[0];return f?{kind:"resolved",target:f}:{kind:"dangling",reason:"missing-package"}},o=n.goModules.find(c=>!c.dir||e===c.dir||e.startsWith(c.dir+"/"));if(o)for(let c of o.replaces){if(t!==c.from&&!t.startsWith(c.from+"/"))continue;let d=t.slice(c.from.length).replace(/^\//,"");return r(V.join(c.toDir,d))}let s;for(let c of n.goModules)t!==c.module&&!t.startsWith(c.module+"/")||(!s||c.module.length>s.module.length||c.module.length===s.module.length&&c===o)&&(s=c);if(!s)return{kind:"external"};let a=Te(V.join(s.dir,t.slice(s.module.length).replace(/^\//,""))).replace(/^\.$/,""),l=(c,d)=>!d||c===d||c.startsWith(d+"/");return n.goModules.some(c=>c!==s&&c.dir!==s.dir&&l(c.dir,s.dir)&&l(a,c.dir))?{kind:"dangling",reason:"missing-package"}:r(a)}function f0(e,t,n){if(!n.rustCrates.length)return{kind:"external"};let r=(b,S)=>Xt(n,[V.join(b,S+".rs"),V.join(b,S,"mod.rs")]),o=(b,S)=>{for(let k=S.length;k>=1;k--){let C=Te(V.join(b,...S.slice(0,k-1))),I=r(C,S[k-1]);if(I)return I}},s=e.includes("/")?V.dirname(e):"",a=e.slice(e.lastIndexOf("/")+1).replace(/\.rs$/,""),l=a==="mod"||a==="lib"||a==="main",c=l?s:V.join(s,a);if(t.startsWith("mod ")){let b=t.slice(4),S=r(c,b)??(l?void 0:r(s,b));return S?{kind:"resolved",target:S}:{kind:"dangling",reason:"missing-module"}}if(t.startsWith("mod-path ")){let b=Te(V.join(s,t.slice(9)));return b.startsWith("..")?{kind:"dangling",reason:"escapes-repo-root"}:n.fileSet.has(b)?{kind:"resolved",target:b}:{kind:"dangling",reason:"missing-module"}}let d=t.split("::").map(b=>b.trim()).filter(Boolean);if(!d.length)return{kind:"external"};let u=d[0],f=n.rustCrates.find(b=>!b.dir||e===b.dir||e.startsWith(b.dir+"/")),m,p=[];if(u==="crate"&&f)m=f.srcDir,p=d.slice(1);else if(u==="self")m=c,p=d.slice(1);else if(u==="super"){let b=l?s.includes("/")?V.dirname(s):"":s,S=1;for(;SC.dir===S):n.rustCrates.find(C=>C.name===u);if(k){let C=o(k.srcDir,d.slice(1));if(C)return{kind:"resolved",target:C};if(k.rootFile)return{kind:"resolved",target:k.rootFile}}return{kind:"external"}}if(!p.length)return{kind:"external"};let g=o(m,p);if(g)return{kind:"resolved",target:g};if(f&&m===f.srcDir&&f.rootFile)return{kind:"resolved",target:f.rootFile};let h=m.includes("/")?V.dirname(m):"",_=m.slice(m.lastIndexOf("/")+1),y=_?r(h,_):void 0;return y&&y!==e?{kind:"resolved",target:y}:{kind:"external"}}function*m0(e,t){for(let n=e;;n=n.includes("/")?V.dirname(n):""){let r=t.get(n);if(r!==void 0){let o=n?e.slice(n.length+1):e;o.includes(".")||(yield{rank:r,pkg:o.replace(/\//g,".")})}if(!n)return}}function Vh(e,t=[]){let n={types:new Map,packages:new Map,scalaPkg:new Map};p0(n,e);let r=t.filter(s=>hu.has(s.ext)&&s.pkg).sort((s,a)=>T(s.rel,a.rel)),o=(s,a,l)=>{s.has(a)||s.set(a,l)};for(let s of r){Hh.has(s.ext)&&n.scalaPkg.set(s.rel,s.pkg),o(n.packages,s.pkg,s.rel);for(let a of s.symbols)!a.parent&&a.kind!=="package"&&o(n.types,s.pkg+"."+a.name,s.rel)}for(let s of r){let a=s.rel.slice(s.rel.lastIndexOf("/")+1,s.rel.length-s.ext.length);/^\w+$/.test(a)&&(o(n.types,s.pkg+"."+a,s.rel),zh.has(s.ext)&&o(n.types,s.pkg+"."+a+"Kt",s.rel))}return n}function p0(e,t){let n=new Map(t.javaRoots.map((c,d)=>[c,d]));if(!n.size)return;let{types:r,packages:o}=e,s=new Map,a=new Map,l=(c,d,u,f,m)=>{f>=(d.get(u)??1/0)||(d.set(u,f),c.set(u,m))};for(let[c,d]of t.filesByDir){let u=d.filter(m=>m.endsWith(".java"));if(!u.length)continue;let f=u.reduce((m,p)=>p=Math.min(2,n.length);r--){let o=e.types.get(r===n.length?n.join("."):n.slice(0,r).join("."));if(o)return o}}function g0(e,t,n){let r=n.jvm??=Vh(n),o=Dh(r,t),s=o?void 0:r.scalaPkg.get(e);for(let a=s;a&&!o;a=a.includes(".")?a.slice(0,a.lastIndexOf(".")):void 0)o=Dh(r,a+"."+t);return o?{kind:"resolved",target:o}:{kind:"external"}}function _0(e,t,n){let r=e.includes("/")?V.dirname(e):"",o=Xt(n,[V.join(r,t),...n.cIncludeRoots.map(s=>V.join(s,t))]);return o?{kind:"resolved",target:o}:h0.has(t)||y0.test(t)?{kind:"external"}:{kind:"dangling",reason:"missing-include"}}function b0(e,t,n){if(t.startsWith(".")){let r=e.includes("/")?V.dirname(e):"",o=Te(V.join(r,t)),s=Xt(n,[o+".rb",V.join(o,"index.rb")]);return s?{kind:"resolved",target:s}:{kind:"dangling",reason:"missing-module"}}for(let r of n.rubyLibRoots){let o=Xt(n,[V.join(r,t+".rb")]);if(o)return{kind:"resolved",target:o}}return{kind:"external"}}function w0(e,t,n){if(t.startsWith(".")){let o=e.includes("/")?V.dirname(e):"",s=Te(V.join(o,t)),a=Xt(n,[s,s+".php"]);return a?{kind:"resolved",target:a}:{kind:"dangling",reason:"missing-module"}}let r=t.replace(/^\\+/,"");for(let{prefix:o,dir:s}of n.phpPsr4){if(o&&r!==o&&!r.startsWith(o+"\\"))continue;let a=o?r.slice(o.length).replace(/^\\+/,""):r,l=Xt(n,[V.join(s,a.replace(/\\/g,"/"))+".php"]);if(l)return{kind:"resolved",target:l}}return{kind:"external"}}function x0(e,t){let n=t.csharpNamespaces.get(e);if(n?.length)return{kind:"resolved",target:n[0]};let r=(t.csharpPrefix??=S0(t.csharpNamespaces)).get(e);return r?{kind:"resolved",target:r}:{kind:"external"}}function S0(e){let t=new Map;for(let[n,r]of e){let o=r[0];if(o!==void 0)for(let s=n.indexOf(".");;s=n.indexOf(".",s+1)){let a=s===-1?n:n.slice(0,s),l=t.get(a);if((l===void 0||T(o,l)<0)&&t.set(a,o),s===-1)break}}return t}function k0(e,t,n){let r,o=/^package:([^/]+)\/(.+)$/.exec(t);if(o){let s=n.dartPackages?.get(o[1]);if(s===void 0)return{kind:"external"};r=Te(V.join(s,"lib",o[2]))}else{if(/^[a-z][\w+.-]*:/i.test(t)||t.startsWith("/"))return{kind:"external"};r=Te(V.join(e.includes("/")?V.dirname(e):"",t))}return r.startsWith("..")?{kind:"dangling",reason:"escapes-repo-root"}:n.fileSet.has(r)?{kind:"resolved",target:r}:/\.[\w-]+\.dart$/.test(r.slice(r.lastIndexOf("/")+1))?{kind:"external"}:{kind:"dangling",reason:"missing-module"}}function E0(e,t,n){let r=t.replace(/\./g,"/"),o=e.includes("/")?V.dirname(e):"",s=n.luaRoots??[""],a=s.filter(c=>!c||o===c||o.startsWith(c+"/")).reverse(),l=[...a,o,...s.filter(c=>!a.includes(c))];for(let c of l){let d=Xt(n,[V.join(c,r+".lua"),V.join(c,r,"init.lua")]);if(d)return{kind:"resolved",target:d}}return{kind:"external"}}function v0(e,t,n){let r=e.includes("/")?V.dirname(e):"",o=Xt(n,[V.join(r,t),t]);return o?{kind:"resolved",target:o}:{kind:"external"}}function Jh(e){return jh.has(e)||Wh.has(e)||Bh.has(e)||Uh.has(e)||hu.has(e)||Gh.has(e)||R0.has(e)}function gt(e,t,n,r){if(jh.has(t)||Wh.has(t)){let o=n.lastIndexOf(".");if(o!==-1&&Xv.has(n.slice(o).toLowerCase().replace(/[?#].*$/,"")))return{kind:"external"};let a=(e.includes("/")?V.dirname(e):"")+"\0"+n,l=r.jsMemo??=new Map,c=l.get(a);return c||l.set(a,c=c0(e,n,r)),{...c}}if(Bh.has(t)){let s=(e.includes("/")?V.dirname(e):"")+"\0"+n,a=r.pyMemo??=new Map,l=a.get(s);return l||a.set(s,l=d0(e,n,r)),{...l}}if(t===".go")return u0(e,n,r);if(t===".rs")return f0(e,n,r);if(t===".java"||hu.has(t))return g0(e,n,r);if(Uh.has(t))return _0(e,n,r);if(t===".rb"||t===".rake")return b0(e,n,r);if(t===".php")return w0(e,n,r);if(t===".cs")return x0(n,r);if(t===".dart")return k0(e,n,r);if(t===".lua")return E0(e,n,r);if(Gh.has(t))return v0(e,n,r);if(t===".ex"||t===".exs"){let o=r.elixirModules?.get(n);return o?{kind:"resolved",target:o}:{kind:"external"}}return{kind:"external"}}var Xv,Zv,Yv,jh,Wh,Bh,Uh,zh,Hh,hu,Gh,Qv,tl,gu,r0,h0,y0,R0,On=z(()=>{"use strict";$();Re();ge();ge();nt();de();Xv=new Set([".svg",".png",".jpg",".jpeg",".gif",".webp",".bmp",".ico",".icns",".pdf",".woff",".woff2",".ttf",".otf",".eot",".mp3",".mp4",".mov",".avi",".webm",".wav",".flac",".ogg",".map"]),Zv=["",".ts",".tsx",".d.ts",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".svelte",".astro",".html",".htm"],Yv=["index.ts","index.tsx","index.js","index.jsx","index.mjs","index.cjs"],jh=new Set([".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"]),Wh=new Set([".vue",".svelte",".astro",".html",".htm"]),Bh=new Set([".py",".pyi"]),Uh=new Set([".c",".h",".cc",".cpp",".cxx",".hpp",".hh"]),zh=new Set([".kt",".kts"]),Hh=new Set([".scala",".sc"]),hu=new Set([...zh,...Hh]),Gh=new Set([".sh",".bash",".zsh",".ksh",".fish"]),Qv=new Set(["dist","build","lib","out","output","esm","cjs","umd"]);tl="${configDir}";gu=["source","ts","import","module","require","node","default"],r0=8;h0=new Set(["assert.h","complex.h","ctype.h","errno.h","fenv.h","float.h","inttypes.h","iso646.h","limits.h","locale.h","math.h","setjmp.h","signal.h","stdalign.h","stdarg.h","stdatomic.h","stdbool.h","stddef.h","stdint.h","stdio.h","stdlib.h","stdnoreturn.h","string.h","tgmath.h","threads.h","time.h","uchar.h","wchar.h","wctype.h","unistd.h","fcntl.h","pthread.h","dirent.h","dlfcn.h","poll.h","sched.h","semaphore.h","strings.h","termios.h","glob.h","regex.h","syslog.h","netdb.h","pwd.h","grp.h","libgen.h","fnmatch.h","spawn.h","utime.h","windows.h"]),y0=/^(?:sys|arpa|netinet|net)\//;R0=new Set([".go",".rs",".java",".rb",".rake",".php",".cs",".dart",".lua",".ex",".exs"])});function sl(e){return I0.test(e.split("/").pop())}function $0(e){return e.includes("/")?V.dirname(e):rl}function Fs(e){return e===rl?0:M0.test(e)||A0.test(e)?2:C0.test(e)?0:null}function T0(e,t){let n=Fs(e);return n!==null?n:t.every(r=>r.kind==="doc"||r.kind==="config"||sl(r.rel))?2:1}function F0(e,t){let n=t.find(a=>/^(readme|index)\.(md|mdx)$/i.test(a.rel.split("/").pop()));if(n?.summary)return n.summary;if(n?.title)return n.title;let r=t.filter(a=>a.summary).sort((a,l)=>(l.summary?.length??0)-(a.summary?.length??0));if(r[0]?.summary)return r[0].summary;let o=[...new Set(t.map(a=>a.lang))].filter(a=>a!=="other"),s=e===rl?"the repository root":`\`${e}/\``;return`${t.length} file(s) in ${s}${o.length?` (${o.slice(0,3).join(", ")})`:""}.`}function _u(e){let t=new Map;for(let c of e.files){let d=$0(c.rel),u=t.get(d);u||t.set(d,u=[]),u.push(c)}let n=[...t.keys()].sort(T),r=new Map,o=new Map;for(let c of n){let d=c===rl?"root":di(c);r.set(c,d),o.set(d,(o.get(d)??0)+1)}let s=c=>{let d=r.get(c);return d&&o.get(d)===1?d:`${d||"module"}-${Ae(c).slice(0,8)}`},a=[],l=new Map;for(let c of n){let d=t.get(c).slice().sort((m,p)=>T(m.rel,p.rel)),u=s(c),f={slug:u,path:c,title:c,tier:T0(c,d),members:d.map(m=>m.rel),summary:F0(c,d)};a.push(f);for(let m of d)l.set(m.rel,u)}return a.sort((c,d)=>T(c.slug,d.slug)),{modules:a,moduleOf:l}}var rl,C0,M0,A0,I0,Os=z(()=>{"use strict";$();ge();it();At();de();rl="(root)",C0=/(^|\/)(types?|util|utils|lib|libs|common|core|config|configs|constants|shared|helpers|internal)$/i,M0=/(^|\/)(tests?|__tests?__|__mocks?__|__snapshots?__|spec|specs|e2e|examples?|example|benchmark|benchmarks|fixtures?|docs?|documentation|\.github)(\/|$)/i,A0=/(^|\/)(scripts?|bin|\.storybook)$/i,I0=/\.(test|spec|e2e|stories|story)\.[cm]?[jt]sx?$/i});function bu(e){let t=Br(e),n=new Map;if(!t.size)return n;let r=(s,a)=>{let l=n.get(s);l||n.set(s,l=new Set),l.add(a)},o=ol(e);for(let s of e.files)if(s.kind==="code"&&s.idents)for(let a of s.idents){let l=t.get(a);l&&l!==s.rel&&r(a,s.rel)}else if(s.kind==="doc"){let a=o.get(s.rel);if(!a||!a.retained)continue;for(let l of a.counts.keys()){let c=t.get(l);c&&c!==s.rel&&r(l,s.rel)}}return n}function wu(e,t=new Map,n=5){let r=new Map;for(let a of e.files)for(let l of a.symbols){let c=r.get(l.name);c||r.set(l.name,c=[]),c.push({file:l.file,line:l.line,...l.endLine!==void 0?{endLine:l.endLine}:{},kind:l.kind,exported:l.exported,lang:l.lang,...l.parent?{parent:l.parent}:{}})}let o=Object.create(null);for(let a of[...r.keys()].sort(T))o[a]=r.get(a).slice().sort((l,c)=>T(l.file,c.file)||l.line-c.line||T(l.kind,c.kind));let s=Object.create(null);for(let a of[...t.keys()].sort(T)){let l=[...t.get(a)].sort(T);l.length&&(s[a]=l)}return{schemaVersion:n,defs:o,refs:s}}function il(e){return JSON.stringify(e,null,2)+` +`}var Xi=z(()=>{"use strict";$();Rt();de();St()});function Nn(e){let t=[{name:e}],n=e.lastIndexOf("#");n>0&&n0&&r0&&n{"use strict";$()});function Xh(e){let t=new Map;for(let n of e.files)for(let r of n.symbols)N0.has(r.kind)&&Qi(t,r.name,{name:r.name,file:r.file,kind:r.kind,lang:r.lang,line:r.line});return t}function dr(e,t,n){return Zh(e,t,n).map(r=>r.rel)}function Zh(e,t,n){let r=Xh(e),o=ku(e,t,n),s=[];for(let a of e.files){if(!a.relations?.length)continue;let l=De(a.lang),c=o.aliases(a);for(let d of a.relations){let u=c.names.get(d.to),f=u?.name??d.to,m=r.get(f)?.get(l);if(!m)continue;let p;if(u){if(!u.files)continue;p=zr(a.rel,o.within(m,u.files,f))}else{let g=o.reached(m,a,f),h=m.byFile.get(a.rel);h&&g.push(h),p=zr(a.rel,g.length?g:m.list)}p&&s.push({written:d.to,rel:{kind:O0.has(p.kind)?"implements":d.kind,from:d.from,fromFile:a.rel,fromLine:d.line,to:p.name,toFile:p.file,toKind:p.kind}})}}return s.sort((a,l)=>T(a.rel.fromFile,l.rel.fromFile)||T(a.rel.from,l.rel.from)||T(a.rel.kind,l.rel.kind)||T(a.rel.to,l.rel.to))}function xu(e,t,n){let r=new Map;for(let o of dr(e,t,n)){if(o.toFile===o.fromFile)continue;let s=`${o.fromFile}${qe}${o.toFile}${qe}${o.kind}`,a=r.get(s);a?a.weight=Math.min(a.weight+1,5):r.set(s,{from:o.fromFile,to:o.toFile,kind:o.kind,weight:1})}return[...r.values()].sort((o,s)=>T(o.from,s.from)||T(o.to,s.to)||T(o.kind,s.kind))}function Su(e,t){let n=Xh(e),r=Zh(e,t),o=r.map(m=>m.rel),s=new Map,a=(m,p)=>`${m}${qe}${p}`;for(let m of n.values())for(let p of[...m.values()].flatMap(g=>g.list))s.set(a(p.name,p.file),{name:p.name,file:p.file,line:p.line,kind:p.kind,extends:[],implements:[],extendedBy:[],implementedBy:[],unresolved:[]});let l=m=>({name:m.name,file:m.file,line:m.line,kind:m.kind});for(let m of o){let p=s.get(a(m.from,m.fromFile)),g=s.get(a(m.to,m.toFile));g&&(p?((m.kind==="extends"?p.extends:p.implements).push(l(g)),(m.kind==="extends"?g.extendedBy:g.implementedBy).push(l(p))):(m.kind==="extends"?g.extendedBy:g.implementedBy).push({name:m.from,file:m.fromFile,line:m.fromLine,kind:"unknown"}))}for(let m of Zi(e)){let p=s.get(a(m.from,m.fromFile)),g=s.get(a(m.to,m.toFile));if(!p||!g)continue;let h=_=>m.structural?{..._,structural:!0}:_;p.implements.push(h(l(g))),g.implementedBy.push(h(l(p)))}let c=new Set(r.map(({rel:m,written:p})=>`${m.fromFile}${qe}${m.from}${qe}${m.kind}${qe}${p}`));for(let m of e.files)for(let p of m.relations??[]){if(c.has(`${m.rel}${qe}${p.from}${qe}${p.kind}${qe}${p.to}`))continue;let g=p.kind==="extends"?"implements":"extends";c.has(`${m.rel}${qe}${p.from}${qe}${g}${qe}${p.to}`)||s.get(a(p.from,m.rel))?.unresolved.push({kind:p.kind,to:p.to})}let d=(m,p)=>T(m.name,p.name)||T(m.file,p.file),u=new Map,f=[...s.keys()].sort(T);for(let m of f){let p=s.get(m);p.extends.sort(d),p.implements.sort(d),p.extendedBy.sort(d),p.implementedBy.sort(d),p.unresolved.sort((g,h)=>T(g.kind,h.kind)||T(g.to,h.to)),u.has(p.name)?u.set(`${p.name}@${p.file}`,p):u.set(p.name,p)}return u}function L0(e,t){let n=e.indexOf(`${t}(`);if(n===-1)return;let r=0,o=0,s=!0;for(let a=n+t.length;a=1&&!/\s/.test(l)&&(s=!1)}}function Zi(e){let t=h=>h.includes("/")?h.slice(0,h.lastIndexOf("/")):"",n=new Map,r=new Map,o=new Map,s=new Map,a=[],l=e.files.filter(h=>h.lang==="go"&&!h.rel.endsWith("_test.go"));for(let h of l){let _=t(h.rel);for(let y of h.symbols)if(y.kind==="type"&&!y.parent){let b=`${_}${qe}${y.name}`;n.has(b)||n.set(b,y);let S=r.get(y.name)??[];S.push(y),r.set(y.name,S)}else if(y.kind==="method"&&y.parent){let b=`${_}${qe}${y.parent}`,S=o.get(b);S||o.set(b,S=new Map),S.set(y.name,y.signature?L0(y.signature,y.name):void 0);let k=s.get(y.name);k||s.set(y.name,k=new Set),k.add(b)}else if(y.name==="_"&&y.signature){let b=P0.exec(y.signature);b&&a.push({sym:y,iface:b[1],type:b[2]??b[3]??b[4]})}}let c=[];for(let h of l)for(let _ of h.relations??[])_.kind==="extends"&&/^\w+$/.test(_.to)&&c.push([`${t(h.rel)}${qe}${_.from}`,`${t(h.rel)}${qe}${_.to}`]);c.sort((h,_)=>T(h[0],_[0])||T(h[1],_[1]));for(let h=0;h<3;h++)for(let[_,y]of c){let b=o.get(y);if(!b)continue;let S=o.get(_);S||o.set(_,S=new Map);for(let[k,C]of b)S.has(k)||(S.set(k,C),s.get(k).add(_))}let d=h=>!!h.signature?.startsWith(h.name)&&/^(\[[^\]]*\])?\s+interface\b/.test(h.signature.slice(h.name.length)),u=new Map,f=(h,_,y)=>{let b=u.get(h);if(b!==void 0)return b??void 0;if(y.has(h))return;y.add(h);let S=new Map(o.get(h)??[]),k=!0,C=se(j(e.root,_.file)).split(` +`).slice(_.line,(_.endLine??_.line)-1);for(let P of C){let v=P.replace(/\/\/.*$/,"").trim();if(/[~|]/.test(v)&&!v.includes("(")&&(k=!1),!/^[\w.]+$/.test(v))continue;let M=v.lastIndexOf(".")===-1?n.get(`${t(_.file)}${qe}${v}`):void 0,x=M&&d(M)?f(`${t(M.file)}${qe}${M.name}`,M,y):void 0;if(!x)k=!1;else for(let[w,E]of x)S.set(w,E)}let I=k&&S.size?S:void 0;return u.set(h,I??null),I},m=new Map,p=(h,_,y)=>{let b=`${h.file}${qe}${h.name}${qe}${_.file}${qe}${_.name}`,S=m.get(b);if(S){y||delete S.structural;return}m.set(b,{from:h.name,fromFile:h.file,to:_.name,toFile:_.file,...y?{structural:!0}:{}})};for(let[h,_]of[...n].sort((y,b)=>T(y[0],b[0]))){if(!d(_))continue;let y=f(h,_,new Set);if(!y)continue;let b=[...y.keys()].sort(T),S=b.some(C=>!/^[A-Z]/.test(C)),k=b.reduce((C,I)=>(s.get(I)?.size??0)<(s.get(C)?.size??0)?I:C);for(let C of[...s.get(k)??[]].sort(T)){if(C===h)continue;let I=n.get(C);if(!I||d(I)||S&&t(I.file)!==t(_.file))continue;let P=o.get(C);b.every(R=>{if(!P.has(R))return!1;let M=P.get(R),x=y.get(R);return M===void 0||x===void 0||M===x})&&p(I,_,!0)}}let g=(h,_)=>{let y=h.slice(h.lastIndexOf(".")+1);if(!h.includes(".")){let S=n.get(`${_}${qe}${y}`);if(S)return S}let b=(r.get(y)??[]).slice().sort((S,k)=>T(S.file,k.file));return b.length===1?b[0]:void 0};for(let h of a){let _=t(h.sym.file),y=g(h.iface,_),b=g(h.type,_);y&&b&&d(y)&&!d(b)&&p(b,y,!1)}return[...m.values()].sort((h,_)=>T(h.fromFile,_.fromFile)||T(h.from,_.from)||T(h.toFile,_.toFile)||T(h.to,_.to))}function Yi(e,t,n){let r=ur(e,t,n);if(!r)return[];let o=new Set([`${r.name}${qe}${r.file}`]),s=[],a=[r];for(;a.length;){let l=[];for(let c of a)for(let d of[...c.implementedBy,...c.extendedBy]){let u=`${d.name}${qe}${d.file}`;if(o.has(u))continue;o.add(u),s.push(d);let f=Yh(e,d.name,d.file);f&&l.push(f)}a=l}return s.sort((l,c)=>T(l.name,c.name)||T(l.file,c.file))}function ur(e,t,n){let r=e.get(t);if(r)return r;for(let o of Nn(t).slice(1))if(o.parent===void 0){for(let s of e.values())if(Ns(o,s))return s}for(let o of n??[]){let s=Yh(e,o.name,o.file);if(s)return s}}function Yh(e,t,n){let r=e.get(t);return r?.file===n?r:e.get(`${t}@${n}`)}var qe,O0,N0,P0,Pn=z(()=>{"use strict";$();ge();fr();Ps();de();Ur();nt();qe="\0",O0=new Set(["interface","trait","protocol"]),N0=new Set(["class","interface","trait","struct","type","enum","record","object","protocol","module","mod","union","annotation"]);P0=/^_\s+([\w.]+)\s*=\s*(?:\(\s*\*\s*([\w.]+)\s*\)\s*\(\s*nil\s*\)|&?([\w.]+)\s*\{|new\(\s*([\w.]+)\s*\))/});function Hr(e,t,n,r,o){let s=[...new Set(e)].sort(T),a=s.filter(b=>t.has(b));if(a.length)return{hops:0,paths:a.slice(0,o).map(b=>[{node:b}]),pathCount:a.length};let l=new Map(s.map(b=>[b,0])),c=new Map,d=[s],u;for(let b=1;b<=r&&!u;b++){let S=[];for(let C of d[b-1])for(let[I,P]of n(C)){let v=l.get(I);if(v===void 0)l.set(I,b),c.set(I,new Map),S.push(I);else if(v!==b)continue;let R=c.get(I);R.has(C)||R.set(C,P)}if(!S.length)break;S.sort(T),d.push(S);let k=S.filter(C=>t.has(C));k.length&&(u=k)}if(!u)return{hops:null,paths:[],pathCount:0};let f=d.length-1,m=new Set(u),p=[...u];for(;p.length;)for(let b of c.get(p.pop())?.keys()??[])m.has(b)||(m.add(b),p.push(b));let g=new Map,h=new Map;for(let b of s)m.has(b)&&g.set(b,1);for(let b=1;b<=f;b++)for(let S of d[b]){if(!m.has(S))continue;let k=0;for(let[C,I]of c.get(S)){k+=g.get(C)??0;let P=h.get(C);P?P.push([S,I]):h.set(C,[[S,I]])}g.set(S,k)}let _=[],y=b=>{if(_.length>=o)return;let S=b[b.length-1].node;if(b.length===f+1){_.push(b.slice());return}for(let[k,C]of h.get(S)??[])if(b.push({node:k,via:C}),y(b),b.pop(),_.length>=o)return};for(let b of s)m.has(b)&&y([{node:b}]);return{hops:f,paths:_,pathCount:u.reduce((b,S)=>b+(g.get(S)??0),0)}}var Eu=z(()=>{"use strict";$();de()});function kt(e){return e.parent?`${e.file}#${e.parent}/${e.name}`:`${e.file}#${e.name}`}function j0(e){return{id:kt(e),name:e.name,kind:e.kind,file:e.file,line:e.line,...e.endLine!==void 0?{endLine:e.endLine}:{},exported:e.exported,...e.doc?{doc:e.doc}:{},...e.signature?{signature:e.signature}:{}}}function Mu(e,t){let n=new Map,r=new Map;for(let p of e.files){let g=[];for(let h of p.symbols)D0.has(h.kind)||(g.push(h),n.set(kt(h),j0(h)));r.set(p.rel,g)}let o=new Map,s=(p,g,h)=>{if(p===g)return;let _=`${p}${Gr}${g}${Gr}${h}`,y=o.get(_);y?y.weight+=1:o.set(_,{from:p,to:g,kind:h,weight:1})},a=pr(e,t);for(let p of e.files){let g=a.forFile(p);if(!g)continue;let h=r.get(p.rel)??[];for(let _ of p.calls){let y=Ln(h,_.line);if(!y)continue;let b=g(_,y);b&&s(kt(y),kt(b.def),"calls")}}let l=new Map;for(let p of n.values()){let g=`${p.name} ${p.file}`;(!l.has(g)||p.id===`${p.file}#${p.name}`)&&l.set(g,p.id)}let c=dr(e,t);for(let p of Zi(e))c.push({...p,kind:"implements"});for(let p of c){let g=l.get(`${p.from} ${p.fromFile}`),h=l.get(`${p.to} ${p.toFile}`);g&&h&&s(g,h,p.kind)}for(let{sub:p,sup:g}of Au(e,c))s(kt(p),kt(g),"overrides");let d=[...o.values()].sort((p,g)=>T(p.from,g.from)||T(p.kind,g.kind)||T(p.to,g.to)),u=new Map,f=new Map;for(let p of d)(u.get(p.from)??u.set(p.from,[]).get(p.from)).push(p),(f.get(p.to)??f.set(p.to,[]).get(p.to)).push(p);let m=new Map;for(let p of[...n.keys()].sort(T)){let g=n.get(p);(m.get(g.name)??m.set(g.name,[]).get(g.name)).push(p)}return{nodes:n,edges:d,out:u,in:f,byName:m}}function Au(e,t){let n=new Map(e.files.map(d=>[d.rel,d.lang])),r=d=>d.includes("/")?d.slice(0,d.lastIndexOf("/")):"",o=(d,u)=>De(n.get(u)??"")==="go"?`go${Gr}${r(u)}${Gr}${d}`:`${u}${Gr}${d}`,s=new Map;for(let d of e.files)for(let u of d.symbols){if(!u.parent||!W0.has(u.kind))continue;let f=o(u.parent,u.file),m=s.get(f);m||s.set(f,m=new Map),m.has(u.name)||m.set(u.name,u)}let a=new Map;for(let d of t){let u=o(d.from,d.fromFile),f=a.get(u)??[],m=o(d.to,d.toFile);m!==u&&!f.includes(m)&&f.push(m),a.set(u,f)}for(let d of a.values())d.sort(T);let l=(d,u,f,m)=>{for(let p of a.get(d)??[]){if(f.has(p))continue;f.add(p);let g=s.get(p)?.get(u);g?m.push(g):l(p,u,f,m)}},c=[];for(let d of[...a.keys()].sort(T)){let u=s.get(d);if(u)for(let f of[...u.keys()].sort(T)){let m=[];l(d,f,new Set([d]),m);for(let p of m)c.push({sub:u.get(f),sup:p})}}return c.sort((d,u)=>T(kt(d.sub),kt(u.sub))||T(kt(d.sup),kt(u.sup)))}function Cu(e,t){if(e.nodes.has(t))return[t];for(let n of Nn(t)){let r=n.parent?.slice(n.parent.lastIndexOf("/")+1),o=(e.byName.get(n.name)??[]).filter(s=>{let a=e.nodes.get(s);return n.file!==void 0&&a.file!==n.file?!1:r===void 0||s===`${a.file}#${r}/${a.name}`});if(o.length)return o}return[]}function eo(e,t,n={}){let r=n.depth??2,o=Math.max(1,Math.min(r,vu)),s=n.direction??"both",a=Cu(e,t),l=a.map(g=>e.nodes.get(g));if(!l.length)return{root:[],nodes:[],edges:[]};let c=new Map;for(let g of a)c.set(g,0);let d=new Map,u=[...a],f=!1;for(let g=1;g<=o&&u.length;g++){let h=[];for(let _ of u){let y=(k,C)=>{for(let I of k??[]){d.set(`${I.from}${Gr}${I.to}${Gr}${I.kind}`,I);let P=C(I);if(!c.has(P)){if(c.size>=B0){f=!0;continue}c.set(P,g),h.push(P)}}},b=e.out.get(_),S=e.in.get(_);s==="both"?(y(b,k=>k.to),y(S,k=>k.from)):s==="out"?(y(b?.filter(k=>k.kind!=="overrides"),k=>k.to),y(S?.filter(k=>k.kind==="overrides"),k=>k.from)):(y(S?.filter(k=>k.kind!=="overrides"),k=>k.from),y(b?.filter(k=>k.kind==="overrides"),k=>k.to))}u=h}let m=[...c.entries()].map(([g,h])=>({...e.nodes.get(g),depth:h})).sort((g,h)=>g.depth-h.depth||T(g.file,h.file)||T(g.name,h.name)),p=[...d.values()].filter(g=>c.has(g.from)&&c.has(g.to)).sort((g,h)=>T(g.from,h.from)||T(g.kind,h.kind)||T(g.to,h.to));return{root:l,nodes:m,edges:p,...f?{truncated:!0}:{},...r>vu?{depthClamped:vu}:{}}}function ll(e,t,n,r={}){let o=r.depth??U0,s=Math.max(1,Math.min(o,Ru)),a=Math.max(1,r.maxPaths??5),l=Cu(e,t),c=Cu(e,n),d=l.map(_=>e.nodes.get(_)),u=c.map(_=>e.nodes.get(_)),f=o>Ru?{depthClamped:Ru}:{};if(!d.length||!u.length)return{from:d,to:u,hops:null,paths:[],pathCount:0,...f};let m=function*(_){for(let y of e.out.get(_)??[])y.kind==="calls"&&(yield[y.to,"calls"]);for(let y of e.in.get(_)??[])y.kind==="overrides"&&(yield[y.from,"dispatch"])},p=Hr(l,new Set(c),m,s,a),g=_=>{let y=e.nodes.get(_.node);return{id:y.id,name:y.name,kind:y.kind,file:y.file,line:y.line,..._.via?{via:_.via}:{}}},h={from:d,to:u,hops:p.hops,paths:p.paths.map(_=>_.map(g)),pathCount:p.pathCount,...p.paths.length{"use strict";$();Ps();mr();fr();Pn();de();Eu();Ur();Gr="\0",D0=new Set(["reexport","reexport-all","default"]);W0=new Set(["method","function","def","getter","setter","operator"]);vu=5,B0=400;U0=8,Ru=16});function z0(e){let t=new Array(e.length*cl);for(let n=0;nT(u.to,f.to));for(let d of a.values())d.sort((u,f)=>T(u.from,f.from));let c={out:s,inn:a,degree:l,threshold:ny([...l.values()])};return r.views.set(n,c),c}function ny(e){let t=e.slice().sort((o,s)=>o-s),n=t.length,r=n===0?0:t[Math.min(n-1,Math.floor(.99*n))];return Math.max(50,r)}function to(e,t,n=1/0,r={}){return Fu(Tu(e,r),t,n)}function Tu(e,t={}){let n=new Map,r=new Map,o=(s,a,l)=>{let c=s.get(a);c?c.push(l):s.set(a,[l])};for(let s of e)s.dangling||!Ls.has(s.kind)||t.skipInferred&&s.confidence==="inferred"||(o(n,s.to,s),t.goPackages&&s.kind==="import"&&s.to.endsWith(".go")&&o(r,dl(s.to),s));return{dependents:n,packageImports:r,goPackages:t.goPackages===!0}}function Fu(e,t,n=1/0){let{dependents:r,packageImports:o,goPackages:s}=e,a=new Map,l=new Set(t),c=[...t];for(let d=1;d<=n&&c.length;d++){let u=[];for(let f of c){let m=r.get(f)??[];s&&$u(f)&&(m=m.concat(o.get(dl(f))??[]));for(let p of m.slice().sort((g,h)=>T(g.from,h.from)))l.has(p.from)||(l.add(p.from),a.set(p.from,d),u.push(p.from))}c=u}return a}function no(e,t,n=1/0,r={}){let o=new Map(e.files.map(p=>[p.rel,p.module])),s=e.modules.find(p=>p.slug===t),a=s?void 0:e.files.find(p=>p.rel===t);if(!s&&!a)return;let l=s?s.members:[a.rel],c=r.includeInferred===!0,d=to(e.fileEdges,l,n,{skipInferred:!c,goPackages:!0}),u=[...d.entries()].map(([p,g])=>({rel:p,module:o.get(p)??"root",depth:g})).sort((p,g)=>p.depth-g.depth||T(p.rel,g.rel)),f=[...new Set(u.map(p=>p.module).filter(p=>p!==t))].sort(T),m={target:t,scope:s?"module":"file",seeds:l,files:u,modules:f};if(!c){let p=to(e.fileEdges,l,n,{goPackages:!0}).size-d.size;p>0&&(m.inferredDependents=p)}return m}function ey(e){return e.kind==="call"?e.confidence==="inferred"?4:1:e.kind==="import"||e.kind==="extends"||e.kind==="implements"?0:e.kind==="use"?2:3}function ty(e,t,n,r){let{out:o,inn:s,degree:a,threshold:l}=G0(e,r),c=new Set([t]),d=[],u=[t];for(let f=1;f<=n;f++){let m=new Map,p=(g,h,_)=>{let y=m.get(g);if(!y){if(c.has(g))return;c.add(g),m.set(g,y=[])}y.some(b=>b.direction===h&&b.kind===_.kind)||y.push({node:g,direction:h,kind:_.kind,weight:_.weight,depth:f,confidence:_.confidence})};for(let g of u)if(!(g!==t&&(a.get(g)??0)>=l)){for(let h of o.get(g)??[])p(h.to,"out",h);for(let h of s.get(g)??[])p(h.from,"in",h)}for(let g of m.values())g.sort((h,_)=>ey(h)-ey(_)||+(h.direction==="in")-+(_.direction==="in")||T(h.kind,_.kind)),d.push(...g);u=[...m.keys()]}return d}function ro(e,t,n=1,r){let o=e.modules.find(a=>a.slug===t);if(o)return{target:t,scope:"module",links:ty(e.moduleEdges,t,n,r),members:o.members};if(e.files.find(a=>a.rel===t))return{target:t,scope:"file",links:ty(e.fileEdges,t,n,r)}}function ul(e,t,n,r={}){let o=new Set(e.files.map(g=>g.rel));if(!o.has(t)||!o.has(n))return;let s=r.depth??q0,a=Math.max(1,Math.min(s,Iu)),l=Math.max(1,r.maxPaths??5),c=new Map;for(let g of[...o].sort(T)){if(!$u(g))continue;let h=dl(g),_=c.get(h);_?_.push(g):c.set(h,[g])}let d=g=>{let h=new Map;for(let y of e.fileEdges){if(y.dangling||!Ls.has(y.kind)||!g&&y.confidence==="inferred")continue;let b=y.kind==="import"&&$u(y.to)&&c.get(dl(y.to))||[y.to],S=h.get(y.from)??h.set(y.from,[]).get(y.from);for(let k of b)S.push([k,y.kind])}let _=y=>y==="import"?0:y==="extends"||y==="implements"?1:y==="use"?2:3;for(let y of h.values())y.sort((b,S)=>T(b[0],S[0])||_(b[1])-_(S[1]));return y=>h.get(y)??[]},u=r.includeInferred===!0,f=d(u),m=Hr([t],new Set([n]),f,a,l),p={from:t,to:n,hops:m.hops,paths:m.paths.map(g=>g.map(h=>h.via?{file:h.node,via:h.via}:{file:h.node})),pathCount:m.pathCount,...m.paths.lengthIu?{depthClamped:Iu}:{}};if(m.hops===null){let g=Hr([n],new Set([t]),f,a,0);if(g.hops!==null&&(p.reverseHops=g.hops),!u){let h=Hr([t],new Set([n]),d(!0),a,0);h.hops!==null&&(p.inferredHops=h.hops)}}return p}var Ls,cl,Qh,dl,$u,Ds,q0,Iu,Vr=z(()=>{"use strict";$();de();Eu();Ls=new Set(["import","use","call","extends","implements"]),cl=6;Qh=new WeakMap;dl=e=>e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",$u=e=>e.endsWith(".go")&&!e.endsWith("_test.go");Ds=["import","call","use","extends","implements","doc-link","mention","contains"];q0=8,Iu=16});function Wt(e){return J0.test(e)||Ou(e)}function Ou(e){if(sl(e))return!0;let t=e.split("/").pop();return V0.some(n=>n.test(t))}function X0(e){let t=e.lastIndexOf("/"),n=t===-1?"":e.slice(0,t+1),r=e.slice(t+1),o;if(o=/^(.+)\.(?:test|spec)(\.[cm]?[jt]sx?)$/.exec(r)){let s=[n];return/(^|\/)__tests__\/$/.test(n)&&s.push(n.slice(0,-10)),s.flatMap(a=>[o[2],...K0.filter(l=>l!==o[2])].map(l=>a+o[1]+l))}if(o=/^test_(.+)\.py$/.exec(r)??/^(.+)_test\.py$/.exec(r))return[n+o[1]+".py"];if(o=/^(.+)_test\.go$/.exec(r))return[n+o[1]+".go"];if(o=/^(.+)_(?:spec|test)\.rb$/.exec(r))return[n+o[1]+".rb"];if(o=/^(.+?)(?:Tests?|IT)\.(java|kt)$/.exec(r)){let s=n+o[1]+"."+o[2],a=s.replace(/(^|\/)src\/test\//,"$1src/main/");return a===s?[s]:[s,a]}return[]}function so(e){let t=new Set,n=new Map,r=new Set,o=new Map;for(let d of e.files)if(n.set(d.rel,d.module),d.fileKind==="code"){if(Wt(d.rel)){t.add(d.rel);continue}if(r.add(d.rel),d.rel.endsWith(".go")){let u=d.rel.includes("/")?d.rel.slice(0,d.rel.lastIndexOf("/")):"",f=o.get(u);f?f.push(d.rel):o.set(u,[d.rel])}}let s=new Map,a=new Map,l=(d,u)=>{let f=s.get(u);f||s.set(u,f=new Set),f.add(d);let m=n.get(u);if(m!==void 0){let p=a.get(m);p||a.set(m,p=new Set),p.add(d)}};for(let d of e.fileEdges)d.dangling||Ls.has(d.kind)&&(!t.has(d.from)||t.has(d.to)||l(d.from,d.to));for(let d of t){for(let u of X0(d))r.has(u)&&l(d,u);if(d.endsWith("_test.go")){let u=d.includes("/")?d.slice(0,d.lastIndexOf("/")):"";for(let f of o.get(u)??[])l(d,f)}}let c=d=>{let u=new Map;for(let f of[...d.keys()].sort(T))u.set(f,[...d.get(f)].sort(T));return u};return{testFiles:t,testedByFile:c(s),testedByModule:c(a)}}function Z0(e,t){let n=e.modules.find(r=>r.slug===t);return n?.testedBy?n.testedBy:so(e).testedByModule.get(t)??[]}function Y0(e){let t=so(e),n=new Map;for(let r of e.files)r.fileKind!=="code"||t.testFiles.has(r.rel)||n.set(r.module,(n.get(r.module)??0)+1);return e.modules.filter(r=>r.tier<=1&&r.symbols>0&&(n.get(r.slug)??0)>0&&!t.testedByModule.has(r.slug))}var V0,J0,K0,gr=z(()=>{"use strict";$();Os();de();Vr();V0=[/^test_.*\.py$/i,/_test\.py$/i,/_test\.go$/,/(Test|Tests|IT)\.java$/,/(Test|Tests)\.kt$/,/_spec\.rb$/,/_test\.rb$/,/Test\.php$/,/(Test|Tests)\.cs$/,/_test\.exs$/],J0=/(^|\/)(tests?|__tests?__|spec|specs|e2e)(\/|$)/i;K0=[".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts"]});function Jr(e,t,n){let r=e.fields[t];for(let o of bn(n))r.tf.set(o,(r.tf.get(o)??0)+1),r.len++,e.all.add(o)}function uR(){let e={};for(let t of fl)e[t]={tf:new Map,len:0};return e}function ml(e){let t=[];for(let n of e.files){let r={file:n.rel,fields:uR(),all:new Set,symbols:[],decls:[],exactNames:new Set,isTest:Wt(n.rel),isFixture:dR.test(n.rel)},o=new Set;for(let a of n.symbols){if(a.doc&&Jr(r,"doc",a.doc),oR.has(a.kind)){Jr(r,"body",a.name);continue}Jr(r,"name",a.name),r.exactNames.add(Qn(a.name).toLowerCase()),o.has(a.name)||(o.add(a.name),r.symbols.push(a.name),r.decls.push({name:a.name,kind:a.kind,line:a.line}))}for(let a of n.rel.split("/"))Jr(r,"path",a);for(let a of n.headings)Jr(r,"heading",a);n.summary&&Jr(r,"summary",n.summary);let s=r.fields.body;for(let a of n.terms??[]){if(!hR.test(a)){Jr(r,"body",a);continue}s.tf.set(a,(s.tf.get(a)??0)+1),s.len++,r.all.add(a)}t.push(r)}return pR(t),t}function pR(e){let t=new Set;for(let r of e)for(let o of r.fields.name.tf.keys())o.length>=Nu&&/^[a-z]+$/.test(o)&&t.add(o);let n=new Map;for(let r of e){if(r.isTest||r.isFixture)continue;let o=r.fields.path;for(let s of[...o.tf.keys()]){if(s.lengthmR||!/^[a-z]+$/.test(s))continue;let a=n.get(s);if(n.has(s)||n.set(s,a=gR(s,t)),!a)continue;let l=o.tf.get(s);for(let c of a)o.tf.set(c,(o.tf.get(c)??0)+l),o.len+=l,r.all.add(c)}}}function gR(e,t){let n=e.length,r=new Array(n+1);r[n]=[];for(let s=n-Nu;s>=0;s--)for(let a=s+Nu;a<=n;a++){let l=r[a],c=e.slice(s,a);if(!l||!t.has(c))continue;let d=[c,...l],u=r[s];(!u||d.length=2?o:void 0}function yR(e){let t=oy.get(e);if(t)return t;t={};for(let n of fl){let r=0;for(let o of e)r+=o.fields[n].len;t[n]=r/e.length||1}return oy.set(e,t),t}function ly(e){let t=`^^${e}$$`,n=new Set;for(let r=0;r+3<=t.length;r++)n.add(t.slice(r,r+3));return n}function cy(e){let t=new Set,n=new Map;for(let r of e)for(let o of r.all){if(t.has(o))continue;t.add(o);let s=aa(o);if(s===o)continue;let a=n.get(s);a||n.set(s,a=[]),a.push(o)}for(let r of n.values())r.sort(T);return n}function dy(e){let t=[],n=new Set;for(let a of e)for(let l of a.all)n.has(l)||(n.add(l),t.push(l));let r=new Uint32Array(t.length),o=new Map;for(let a=0;a=tR&&s.push({term:e.terms[a],dice:l})}return s}function bR(e,t,n={}){return uy(e,t,n).results}function Zt(e,t,n={}){return uy(e,t,n)}function ay(e,t,n,r){return{results:[],explain:{query:e,terms:[],droppedStopwords:ui(e,r),unresolvedTerms:[],verdict:t,note:n,bridgedOnlyResults:0,resultCount:0}}}function wR(e,t){let n=ui(t).filter(l=>l.length>=2);if(!n.length)return;let r=new Set(n.map(l=>l.toLowerCase()));if(r.size===1&&!_s(t).length)return l=>r.has(l.toLowerCase());let o=n.filter(l=>/[A-Z]/.test(l));if(!o.length)return;let s=Pu(e),a=new Set(o.filter(l=>{let c=l.toLowerCase();return s.some(d=>d.exactNames.has(c)&&d.symbols.includes(l))}));return a.size?l=>a.has(l):void 0}function uy(e,t,n={}){let r=wR(e,t),o=[],s=new Set;for(let I of _s(t,r))for(let P of bn(I))s.has(P)||(s.add(P),o.push(P));if(!o.length){let I=ui(t,r);return ay(t,"none",I.length?`Nothing was searched for: every token in this query (${I.join(", ")}) is a stopword or too short to index. Search with the identifiers or domain words you are actually looking for.`:"Nothing was searched for: the query carried no indexable token.",r)}let a=o.some(I=>lR.test(I)),l=Pu(e),c=l.length;if(!c)return ay(t,"none","This index contains no files.",r);let d=yR(l),u=new Uint8Array(c),f=I=>{let P=0;for(let v=0;vm.get(P)===0);if(I.length){let P=py(e),v=[];for(let R of I){let M=aa(R),x=(P.get(M)??[]).filter(w=>w!==R);M!==R&&aa(M)===M&&l.some(w=>w.all.has(M))&&(x.push(M),x.sort(T)),x.length?g.set(R,x.slice(0,sy).map(w=>({term:w,dice:nR,via:"stem"}))):v.push(R)}if(v.length){let R=fy(e);for(let M of v){let x=_R(R,M);x.sort((w,E)=>E.dice-w.dice||T(w.term,E.term)),g.set(M,x.slice(0,sy).map(w=>({...w,via:"trigram"})))}}}}let h=new Map;for(let I of g.values())for(let{term:P}of I)!m.has(P)&&!h.has(P)&&h.set(P,f(P));let _=I=>m.get(I)??h.get(I),y=I=>Math.log(1+(c-I+.5)/(I+.5)),b=n.rank==="graph"?my(e):void 0,S=I=>(1+iy*Math.log1p(I*c))/(1+iy*Math.LN2),k=[];for(let I=0;I{let L=0;for(let H of fl){let X=P.fields[H],le=X.tf.get(O);if(!le)continue;M.add(H);let me=sR[H];L+=rR[H]*le/(1-me+me*X.len/d[H])}return L};for(let O of o){let L=N(O);if(L>0){R.push(O),x.add(O),P.exactNames.has(O)&&(E=!0),v+=y(m.get(O))*(L/(ry+L));continue}for(let H of g.get(O)??[]){let X=N(H.term);X&&(v+=y(_(H.term))*(X/(ry+X))*H.dice,x.add(H.term),w.add(O))}}!R.length&&!w.size||(E&&(v*=iR),a||(P.isFixture?v*=cR:P.isTest&&(v*=aR)),b&&!P.file.endsWith(".go")&&(v*=S(b.get(P.file)??0)),k.push({d:P,score:Number(v.toFixed(4)),matched:R,matchedFields:M,symbolTerms:x,fuzzyHit:w}))}k.sort((I,P)=>P.score-I.score||T(I.d.file,P.d.file));let C=(n.exact?k.filter(I=>I.matched.length):k).slice(0,n.limit??Q0).map(xR);return{results:C,explain:SR(t,o,m,g,C,r)}}function xR({d:e,score:t,matched:n,matchedFields:r,symbolTerms:o,fuzzyHit:s}){let l=e.decls.map(d=>{let u=new Set(bn(d.name)),f=0;for(let m of o)u.has(m)&&f++;return{decl:d,hits:f}}).filter(d=>d.hits>0).sort((d,u)=>u.hits-d.hits||T(d.decl.name,u.decl.name)).slice(0,eR).map(d=>d.decl),c={file:e.file,score:t,matchedTerms:n.sort(T),topSymbols:l.map(d=>d.name)};return r.size&&(c.matchedFields=fl.filter(d=>r.has(d))),l.length&&(c.symbolHits=l,c.line=Math.min(...l.map(d=>d.line))),s.size&&(c.fuzzyTerms=[...s].sort(T)),n.length||(c.bridgedOnly=!0),c}function SR(e,t,n,r,o,s){let a=t.map(y=>{let b=n.get(y)??0,S=b===0?r.get(y)??[]:[];return S.length?{term:y,df:b,bridge:{via:S[0].via,to:S.map(k=>k.term),dice:S[0].dice}}:{term:y,df:b}}),l=a.filter(y=>y.df===0&&!y.bridge).map(y=>y.term).sort(T),c=!/\s/.test(e.trim()),d=c?_s(e,s).map(y=>bn(y)[0]).filter(y=>y!==void 0):[],u=!c||!t.length?void 0:d.length>1?{term:e.trim(),df:Math.min(...d.map(y=>n.get(y)??0))}:{term:t[0],df:n.get(t[0])??0},f=o.filter(y=>y.bridgedOnly).length,m=o.length>0&&f===o.length,p=u?.df===0,g=o.length?p||m?"weak":"match":"none",h={query:e,terms:a,droppedStopwords:ui(e,s),unresolvedTerms:l,...u?{wholeIdentifier:u}:{},verdict:g,bridgedOnlyResults:f,resultCount:o.length},_=kR(h,p,m);return _&&(h.note=_),h}function kR(e,t,n){let{verdict:r,wholeIdentifier:o,resultCount:s,terms:a}=e;if(r!=="match"){if(!s){let l=e.unresolvedTerms;return l.length?`No file matches. ${l.length===1?"The term":"The terms"} ${l.join(", ")} ${l.length===1?"appears":"appear"} nowhere in this index.`:"No file matches this query."}if(t&&o){let l=a.filter(m=>m.term!==o.term&&m.df>0).map(m=>m.term).join(", "),c=a.find(m=>m.term===o.term),d=(c?c.bridge?.to:a.find(m=>m.df===0&&m.bridge)?.bridge?.to)??[],u=l?` The ${s} result${s===1?"":"s"} below match only its parts (${l}).`:"",f=d.length?` Closest indexed name${d.length===1?"":"s"}: ${d.join(", ")}.`:"";return`No file in this index defines or mentions "${o.term}".${u}${f} If you expected it here, check you are indexing the right branch or commit.`}if(n)return`Nothing matched verbatim. Every result below came from a near match: ${a.filter(d=>d.bridge).map(d=>`"${d.term}" \u2192 ${d.bridge.to.join(", ")}`).join("; ")}. Re-run with --exact to see only literal matches.`}}var ry,Q0,eR,tR,sy,nR,fl,rR,sR,iR,oR,aR,lR,cR,dR,iy,fR,mR,Nu,hR,oy,js=z(()=>{"use strict";$();St();it();gr();de();ry=1.2,Q0=20,eR=5,tR=.6,sy=3,nR=.9,fl=["name","path","heading","summary","doc","body"],rR={name:3,path:2,heading:1.5,summary:1.5,doc:1.6,body:.7},sR={name:.75,path:.75,heading:.75,summary:.75,doc:.75,body:.4},iR=1.35,oR=new Set(["reexport","reexport-all"]),aR=.65,lR=/^(test|tests|spec|specs|fixture|fixtures|testdata|mock|mocks|stub|stubs)$/,cR=.5,dR=/(^|\/)(testdata|test-data|test_data|fixtures?|__fixtures__|__snapshots__)(\/|$)/i,iy=.1;fR=7,mR=32,Nu=3;hR=/^[a-z0-9]{2,}$/,oy=new WeakMap});function Kr(e,t,n=.85){let r=new Map,o=e.length;if(o===0)return r;let s=new Map(e.map((d,u)=>[d,u])),a=Array.from({length:o},()=>[]),l=new Array(o).fill(0);for(let d of t){if(d.dangling)continue;let u=s.get(d.from),f=s.get(d.to);u===void 0||f===void 0||u===f||(a[u].push([f,d.weight]),l[u]+=d.weight)}let c=new Array(o).fill(1/o);for(let d=0;d<200;d++){let u=0;for(let g=0;gr.set(d,c[u])),r}function gy(e,t){let n=new Map;for(let h of e)n.set(h,0);let r=e.length;if(r<3)return n;let o=new Map(e.map((h,_)=>[h,_])),s=Array.from({length:r},()=>new Set);for(let h of t){if(h.dangling)continue;let _=o.get(h.from),y=o.get(h.to);_===void 0||y===void 0||_===y||(s[_].add(y),s[y].add(_))}let a=s.map(h=>[...h].sort((_,y)=>_-y)),l=new Float64Array(r),c=[],d=[],u=Array.from({length:r},()=>[]),f=new Float64Array(r),m=new Int32Array(r).fill(-1),p=new Float64Array(r);for(let h=0;h=0;_--){let y=c[_];for(let b of u[y])p[b]+=f[b]/f[y]*(1+p[y]);y!==h&&(l[y]+=p[y])}}let g=(r-1)*(r-2)/2;return e.forEach((h,_)=>n.set(h,l[_]/2/g)),n}function Lu(e){let t=[],n=e.modules.length;if(n>0){let o=e.modules.map(a=>a.id),s=Kr(o,e.moduleEdges);for(let a of e.modules)a.pagerank=Number(((s.get(a.id)??0)*n).toFixed(4));if(n>3e3)t.push(`betweenness skipped (${n} modules > 3000)`);else{let a=gy(o,e.moduleEdges);for(let l of e.modules)l.betweenness=Number((a.get(l.id)??0).toFixed(6))}}let r=e.files.length;if(r>0){let o=e.files.map(a=>a.id),s=Kr(o,e.fileEdges);for(let a of e.files)a.pagerank=Number(((s.get(a.id)??0)*r).toFixed(4))}return t}var io=z(()=>{"use strict";$()});function RR(e){let t=hy.get(e);if(!t){let n=["if","for","while",...ER[e]??vR];t=new RegExp(`(?r[0])]);e.block&&n.add("/"),e.backtick&&n.add("`"),t=new RegExp(`[${[...n].map(r=>"\\"+r).join("")}]`,"g"),yy.set(e,t)}return t}function pl(e,t){let n=t&&$R[De(t)]||hr,r=e.length,o="",s=0,a=(u,f)=>{o+=e.slice(s,u)+e.slice(u,f).replace(/[^\n]/g," "),s=f},l=(u,f,m,p)=>{for(;ue.startsWith(f,d))){let f=e.indexOf(` +`,d),m=f===-1?r:f;a(d,m),d=m}else if(n.triple&&(e.startsWith('"""',d)||e.startsWith("'''",d))){let f=l(d+3,e.slice(d,d+3),!0,!0);a(d,f),d=f}else if(u==='"'||u==="'"&&!n.charOnly){let f=l(d+1,u,!0,!1);a(d,f),d=f}else if(u==="'"){_y.lastIndex=d;let f=_y.exec(e);f&&a(d,d+f[0].length),d+=f?f[0].length:1}else if(u==="`"&&n.backtick){let f=l(d+1,"`",n.backtick==="template",!0);a(d,f),d=f}else d++}return s===0?e:o+e.slice(s)}function by(e,t){let n=t?De(t):"",r=(e.match(RR(n))??[]).length;return n==="python"&&(r+=(e.match(CR)??[]).length),AR.has(n)&&(r+=(e.match(MR)??[]).length),r}function Du(e,t){return 1+by(pl(e,t),t)}function oo(e,t,n=50){let r=[];for(let o of e.files){if(o.kind!=="code"||t&&o.rel!==t||!o.symbols.length)continue;let s=pl(se(j(e.root,o.rel)),o.lang).split(` +`),a=o.symbols.filter(l=>l.kind!=="reexport"&&l.kind!=="reexport-all").sort((l,c)=>l.line-c.line||(c.endLine??c.line)-(l.endLine??l.line));a.forEach((l,c)=>{if(IR.has(l.kind))return;let d=l.endLine??l.line,u=s.slice(l.line-1,d);for(let m of FR(a,c,d))for(let p=m.line;p<=m.endLine;p++)u[p-l.line]="";let f={file:o.rel,name:l.name,line:l.line,complexity:1+by(u.join(` +`),o.lang)};l.endLine!==void 0&&(f.endLine=l.endLine),r.push(f)})}return r.sort((o,s)=>s.complexity-o.complexity||T(o.file,s.file)||o.line-s.line),r.slice(0,n)}function FR(e,t,n){let r=e[t],o=[];for(let s=t+1;sn||(a.line>r.line||a.endLines.kind==="code"&&(t.get(s.rel)??0)>0).map(s=>{let a=r.get(s.rel),l=t.get(s.rel)??0;return{file:s.rel,complexity:a,commits:l,score:(l+1)*a}});return o.sort((s,a)=>a.score-s.score||T(s.file,a.file)),o.slice(0,n)}var ER,vR,hy,CR,MR,AR,IR,hr,Yt,$R,yy,_y,Ws=z(()=>{"use strict";$();ge();fr();St();nt();de();ER={js:["else\\s+if","case","catch"],c:["else\\s+if","case"],java:["else\\s+if","case","catch"],csharp:["else\\s+if","foreach","case","catch"],go:["else\\s+if","case"],rust:["else\\s+if","match"],kotlin:["else\\s+if","when","catch"],scala:["else\\s+if","match","case","catch"],swift:["else\\s+if","case","catch","guard"],php:["elseif","else\\s+if","foreach","case","catch"],dart:["else\\s+if","case","catch"],python:["elif","except"],ruby:["elsif","unless","until","when","rescue"],elixir:["unless","case","cond","rescue"],lua:["elseif"],shell:["elif","until","case"],perl:["elsif","unless","until","foreach"]},vR=["elif","elsif","else\\s+if","foreach","until","unless","case","when","match","catch","rescue","except"],hy=new Map;CR=/^[ \t]*case\b[^\n]*:[ \t]*$/gm,MR=/(?[n.rel,n]))}function gl(e){let t=ht(e);if(!t.symbolsByName){let n=new Map;for(let r of e.files)for(let o of r.symbols){let s=n.get(o.name);s?s.push(o):n.set(o.name,[o])}t.symbolsByName=n}return t.symbolsByName}function pn(e){let t=ht(e);return t.resolveCtx??=Ki(e)}function Bt(e){let t=ht(e);if(!t.importPairs){let n=pn(e),r=new Set;for(let o of e.files)for(let s of o.refs){if(s.kind!=="import")continue;let a=gt(o.rel,o.ext,s.spec,n);a.kind==="resolved"&&a.target!==o.rel&&r.add(`${o.rel}|${a.target}`)}t.importPairs=r}return t.importPairs}function xy(e,t,n){let r=ju.get(e);!r||r.resolveCtx!==t||r.importPairs||(r.importPairs=n)}function Br(e){let t=ht(e);return t.uniqueDefs??=Wu(e)}function hl(e){let t=ht(e);return t.symbolRefs??=bu(e)}function ol(e){let t=ht(e);if(t.docMentions)return t.docMentions;let n=Br(e),r=new Map;if(n.size)for(let o of e.files){if(o.kind!=="doc")continue;let s=e.docText.get(o.rel),a=s??se(j(e.root,o.rel));if(!a)continue;let l=new Map;for(let c of a.split(/[^A-Za-z0-9_]+/))n.has(c)&&l.set(c,(l.get(c)??0)+1);r.set(o.rel,{counts:l,retained:s!==void 0})}return t.docMentions=r}function Sy(e){let t=ht(e);if(t.identSets)return t.identSets;let n=new Map;for(let r of e.files)r.kind==="code"&&r.idents?.length&&n.set(r.rel,new Set(r.idents));return t.identSets=n}function Bs(e){let t=ht(e);return t.callerIndex??=Xr(e,Bt(e))}function Us(e){let t=ht(e);return t.hierarchy??=Su(e,Bt(e))}function zs(e){let t=ht(e);return t.symbolGraph??=Mu(e,Bt(e))}function Pu(e){let t=ht(e);return(t.bm25??={docs:ml(e)}).docs}function fy(e){let t=ht(e),n=t.bm25??={docs:ml(e)};return n.trigrams??=dy(n.docs)}function my(e){let t=ht(e);if(!t.importPagerank){let n=e.files.map(o=>o.rel),r=[];for(let o of Bt(e)){let s=o.indexOf("|");r.push({from:o.slice(0,s),to:o.slice(s+1),kind:"import",weight:1})}t.importPagerank=Kr(n,r)}return t.importPagerank}function py(e){let t=ht(e),n=t.bm25??={docs:ml(e)};return n.stems??=cy(n.docs)}function wy(e){let t=ht(e);if(!t.fileComplexity){let n=new Map;for(let r of e.files)r.kind==="code"&&n.set(r.rel,Du(se(j(e.root,r.rel)),r.lang));t.fileComplexity=n}return t.fileComplexity}var ju,St=z(()=>{"use strict";$();ge();On();yl();Xi();mr();Pn();qr();js();io();Ws();nt();ju=new WeakMap});function _l(e,t){let n=e.get(t);if(n)return n;for(let r of Nn(t).slice(1))for(let o of e.values())if(Ns(r,o.def))return o}function Ey(e,t,n={}){return Ry(e,Bt(e),n.recall===!0,new Set(t))}function vy(e){return[...new Set(Nn(e).map(t=>t.name))]}function OR(e){return new Set(Bt(e))}function Xr(e,t,n={}){return Ry(e,t??Bt(e),n.recall===!0)}function Ry(e,t,n,r){let o=pr(e,t,{recall:n,only:r}),s=new Map;for(let c of e.files){let d=o.forFile(c);if(d)for(let u of c.calls){let f=d(u);if(!f)continue;let m=f.def.name+"\0"+f.def.file,p=s.get(m);p?f.def.lineT(f.file,m.file)||f.line-m.line),a.has(d.name)?a.set(`${d.name}@${d.file}`,{def:d,callers:u}):a.set(d.name,{def:d,callers:u})}return a}function NR(e,t,n){let r=e.files.find(o=>o.rel===t);if(r?.symbols.length)return Ln(r.symbols,n)}function Ln(e,t){let n;for(let r of e)ky.has(r.kind)||r.line>t||r.endLine!==void 0&&t>r.endLine||(!n||r.line>n.line||r.line===n.line&&(r.endLine??1/0)<=(n.endLine??1/0))&&(n=r);return n}function Bu(e){return Cy(e)}function _r(e,t){return Cy(e,t).get(t)??[]}function Cy(e,t){let n=new Map;for(let o of e.files){if(!o.calls?.length)continue;let s;for(let a of o.calls){if(t!==void 0&&a.name!==t)continue;s??=o.symbols.filter(u=>!ky.has(u.kind));let l={file:o.rel,line:a.line};a.receiver!==void 0&&(l.receiver=a.receiver);let c=Ln(s,a.line);c&&(l.enclosingSymbol=c);let d=n.get(a.name);d||n.set(a.name,d=[]),d.push(l)}}let r=new Map;for(let o of[...n.keys()].sort(T)){let s=n.get(o);s.sort((a,l)=>T(a.file,l.file)||a.line-l.line),r.set(o,s)}return r}var ky,mr=z(()=>{"use strict";$();Ps();St();de();Ur();ky=new Set(["reexport","reexport-all","default"])});function BR(e){let t=e.split("/"),n=t.pop()??e;return(/^v\d+$/.test(n)||n==="go")&&t.length&&(n=t.pop()),n.replace(/\.v\d+$/,"").replace(/^go-/,"").replace(/[-.]go$/,"").replace(/\W/g,"")}function UR(e,t){if(!e.includes(t))return;let n=Hu.get(t);n||(n=new RegExp(`(?:^|[(,\\s])${t}\\s*(?::\\s*["']?|\\s+[*&]?)\\s*(?:([A-Za-z_]\\w*)\\.)?(?:[A-Za-z_]\\w*\\.)*([A-Za-z_]\\w*)`),Hu.size<4096&&Hu.set(t,n));let r=n.exec(e);return r?{type:r[2],qualifier:r[1]}:void 0}function zR(e){if(!(!e?.signature||e.kind!=="method"))return/^func\s*\(\s*([A-Za-z_]\w*)\s/.exec(e.signature)?.[1]}function ku(e,t,n){let r=Hs(t),o,s=R=>(o??=new Map(e.files.map(M=>[M.rel,M]))).get(R),a=new Map;for(let R of e.files){let M=R.rel.endsWith("/__init__.py")||R.rel==="__init__.py"?{all:!0,names:new Set}:void 0;for(let x of R.symbols)x.kind!=="reexport"&&x.kind!=="reexport-all"||(M??={all:!1,names:new Set},x.kind==="reexport-all"?M.all=!0:M.names.add(x.name));M&&a.set(R.rel,M)}let l=new Map,c=(R,M)=>{let x=`${R}\0${M}`,w=l.get(x);if(w)return w;w=new Set;let E=[R];for(let N=0;N{if(!d){d=new Map;for(let x of e.files){let w=De(x.lang);if(!Iy.has(w)||x.kind!=="code")continue;let E=`${w}\0${Et(x.rel)}`,N=d.get(E);N||d.set(E,N=[]),N.push(x)}}return d.get(`${R}\0${M}`)??[]},f=new Map,m=R=>{let M=De(R.lang);if(!Iy.has(M))return null;let x=f.get(R.rel);if(x!==void 0)return x;let w=Et(R.rel),E=new Set;if(M==="go")for(let N of r.get(R.rel)??[])N.endsWith(".go")&&Et(N)!==w&&E.add(Et(N));return f.set(R.rel,x={own:w,test:co(R.rel),imported:E}),x},p=new WeakMap,g=(R,M,x,w,E)=>{let N=(L,H)=>{L.file===M.rel||E.has(L.file)||(H===x.own?x.test||!co(L.file):x.imported.has(H)&&!co(L.file))&&(E.add(L.file),w.push(L))};if(R.list.length<=x.imported.size+1){for(let L of R.list)N(L,Et(L.file));return}let O=p.get(R);if(!O){O=new Map;for(let L of R.list){let H=Et(L.file),X=O.get(H);X?X.push(L):O.set(H,[L])}p.set(R,O)}for(let L of O.get(x.own)??[])N(L,x.own);for(let L of x.imported)for(let H of O.get(L)??[])N(H,L)},h=(R,M,x,w)=>{if(M.size{for(let N of M){let O=a.get(N);if(O&&(h(R,c(N,x),w,E),!(O.all||!O.names.size)))for(let L of R.list)L.parent&&!E.has(L.file)&&O.names.has(L.parent)&&c(N,L.parent).has(L.file)&&(E.add(L.file),w.push(L))}},y=(R,M,x)=>{if(!R)return[];let w=m(M);if(w&&M.lang==="go"){let L=[];return g(R,M,w,L,new Set),L}let E=r.get(M.rel),N=Gu(R,E),O=new Set(N.map(L=>L.file));return O.add(M.rel),E&&_(R,E,x,N,O),w&&g(R,M,w,N,O),N},b=(R,M,x)=>{if(!R)return[];let w=[],E=new Set;return h(R,new Set(M),w,E),_(R,M,x,w,E),w},S=n,k=Ty.get(e),C=()=>(S??=pn(e),k?.ctx!==S&&Ty.set(e,k={ctx:S,files:new Map}),k.files),I=R=>{let M=s(R);if(!M)return;let x=M.importAliases?.find(N=>N.local==="default"&&N.from===void 0);if(x)return x.name;let w=M.symbols.find(N=>N.kind==="default");if(w)return w.name;let E=R.slice(R.lastIndexOf("/")+1).replace(/\.[^.]+$/,"");return M.symbols.some(N=>N.name===E&&!N.parent)?E:void 0},P=R=>u("go",R).find(M=>!co(M.rel))?.symbols.find(M=>M.kind==="package")?.name;return{targets:R=>r.get(R),reached:y,within:b,aliases:R=>{let M=R.lang==="go";if(!R.importAliases?.length&&!(M&&R.refs.length))return WR;let x=C(),w=x.get(R.rel);if(w)return w;w={modules:new Map,names:new Map};let E=O=>{let L=gt(R.rel,R.ext,O,S);return L.kind==="resolved"&&L.target!==R.rel?L.target:null},N=(O,L)=>{let H=w.modules.get(O);H==null?w.modules.set(O,L):L&&w.modules.set(O,[...new Set([...H,...L])].sort(T))};if(M){let O=new Map;for(let L of R.importAliases??[])L.from!==void 0&&O.set(L.from,L.local);for(let L of R.refs){if(L.kind!=="import")continue;let H=E(L.spec),X=H===null?void 0:Et(H),le=O.get(L.spec)??(X!==void 0?P(X):void 0)??BR(L.spec);N(le,X!==void 0?u("go",X).filter(me=>!co(me.rel)).map(me=>me.rel):null)}}else for(let O of R.importAliases??[]){if(O.from===void 0)continue;let L=E(O.from);if(O.name==="*"){N(O.local,L?[L]:null);continue}if(R.lang==="python"){let X=E(O.from.endsWith(".")?O.from+O.name:`${O.from}.${O.name}`);if(X&&X!==L){N(O.local,[X]);continue}}if(w.names.has(O.local))continue;let H=O.name==="default"?(L?I(L):void 0)??O.local:O.name;w.names.set(O.local,{name:H,files:L?[L]:null})}return x.set(R.rel,w),w}}}function Oy(e,t,n){Qi(e.any,t.name,t),Qi(n?e.member:e.free,t.name,t)}function Ny(e,t,n,r){if(r!=="member-first")return e[r].get(t)?.get(n);let o=e.member.get(t)?.get(n),s=e.free.get(t)?.get(n);if(!o||!s)return o??s;let a=new Map(o.byFile),l=[...o.list];for(let c of s.list)a.has(c.file)||(a.set(c.file,c),l.push(c));return{list:l,byFile:a}}function pr(e,t,n={}){let r=n.recall===!0,o=n.only,s=ku(e,t,n.ctx),a,l=new Map,c=new Set,d=v=>{let R=l.get(v);if(R)return R;let M=(a??=new Map(e.files.map(E=>[E.rel,E]))).get(v)?.symbols??[],x,w;for(let E of M)if(E.parent!==void 0){if(!w){w=new Map;for(let N of M)w.has(N.name)||w.set(N.name,N.kind)}DR.has(w.get(E.parent)??"")&&(x??=new Set).add(E.parent)}return l.set(v,R=x??c),R},u=v=>(a??=new Map(e.files.map(R=>[R.rel,R]))).has(v),f=(v,R)=>R.map(M=>v?`${v}/${M}`:M).find(u),m=(v,R)=>{if(R==="lib.rs"||R==="main.rs")return!0;let M=Et(v),x=M.slice(M.lastIndexOf("/")+1);return x==="examples"||x==="tests"||x==="benches"||x==="bin"&&/(^|\/)src\/bin$/.test(M)},p=(v,R)=>{let M=v.slice(v.lastIndexOf("/")+1),x;if(m(v,M))R==="crate"&&(x=v);else if(R==="crate")for(let w=Et(v);!x&&(x=f(w,["lib.rs","main.rs"]),!!w);w=Et(w));else{let w=Et(M==="mod.rs"?Et(v):v.slice(0,-3));x=f(w,["mod.rs","lib.rs","main.rs"])??(w&&u(`${w}.rs`)?`${w}.rs`:void 0)}return x===void 0?void 0:[x]},g=v=>v.parent!==void 0&&d(v.file).has(v.parent),h=v=>v.parent!==void 0&&!d(v.file).has(v.parent),_=new Map;for(let v of e.files){let R=$y[De(v.lang)]!==void 0;for(let M of v.symbols){if(lo.has(M.kind)||bl.has(M.kind)||!M.exported&&!R||o&&!o.has(M.name))continue;let x=_.get(M.name);x?x.push(M):_.set(M.name,[M])}}let y=new Map,b=v=>{let R=y.get(v);if(R!==void 0)return R;let M=_.get(v);if(R=null,M){R={exported:Fy(),hidden:Fy()};for(let x of M)x.exported?Oy(R.exported,x,h(x)):g(x)||Oy(R.hidden,x,h(x))}return y.set(v,R),R},S=(v,R,M)=>{let x=b(v);return x?Ny(x.exported,v,R,M):void 0},k=(v,R,M)=>{let x=b(v);return x?Ny(x.hidden,v,R,M):void 0},C=new Map,I=v=>{let R=C.get(v);return R===void 0&&C.set(v,R=Wt(v)||Fs(Et(v)||"(root)")===2),R};return{forFile:v=>{if(!v.calls?.length||o&&!v.calls.some(q=>o.has(q.name)||v.importAliases?.some(Y=>Y.local===q.name)))return;let R=De(v.lang),M=!r&&Ay.has(R),x=$y[R],w=new Map,E=new Map,N=new Map,O=new Set,L=d(v.rel),H=q=>q.parent!==void 0&&!L.has(q.parent);for(let q of v.symbols)lo.has(q.kind)||bl.has(q.kind)||(w.has(q.name)||w.set(q.name,q),H(q)?(N.has(q.name)||N.set(q.name,q),O.add(q.parent)):E.has(q.name)||E.set(q.name,q));let X,le,me,Ee=(q,Y)=>{if(!le){le=new Map;for(let J of v.symbols){if(lo.has(J.kind)||bl.has(J.kind)||!H(J))continue;let ne=`${J.parent}\0${J.name}`;le.has(ne)||le.set(ne,J)}}return le.get(`${q}\0${Y}`)},je=q=>{if(O.size){if(!me){me=new Map;for(let Y of O){let J=Y.toLowerCase();me.set(J,me.has(J)?null:Y)}}return me.get(q.toLowerCase())}},U=s.aliases(v),B,G;if(R==="rust"){for(let q of["crate","super"]){let Y=p(v.rel,q);Y&&(B??=new Map).set(q,Y)}G=v.symbols.filter(q=>q.kind==="mod"&&q.endLine!==void 0&&q.endLine>q.line)}let te=q=>{let Y=0;for(let J of G??[])q>J.line&&q<=J.endLine&&J.line>Y&&(Y=J.line);return Y},ie=q=>v.relations?.find(Y=>Y.kind==="extends"&&Y.from===q)?.to,ve=q=>{if(q===void 0)return;if(q.parent!==void 0&&ie(q.parent)!==void 0)return q.parent;let Y;for(let J of v.symbols)J.endLine===void 0||J.line>q.line||q.line>J.endLine||ie(J.name)===void 0||(!Y||J.line>Y.line)&&(Y=J);return Y?.name??q.parent},Je,Qe=q=>{if(q.file!==v.rel||q.parent===void 0)return!1;if(!Je){Je=new Set;for(let Y of v.refs){if(Y.kind!=="import")continue;let J=Y.spec.split("::");Je.add(J[J.length-1]),J.length>1&&Je.add(`${J[J.length-2]}::${J[J.length-1]}`)}}return LR.has(q.name)?Je.has(`${q.parent}::${q.name}`):Je.has(q.parent)||Je.has(`${q.parent}::${q.name}`)},be=(q,Y)=>{let J=s.reached(S(q,R,Y),v,q),ne=k(q,R,Y);if(ne&&(x==="package"||x==="import")){let Oe=new Set(J.map(lt=>lt.file));for(let lt of x==="package"?s.reached(ne,v,q):Gu(ne,s.targets(v.rel)))x==="package"&&Et(lt.file)!==Et(v.rel)||lt.file!==v.rel&&!Oe.has(lt.file)&&(Oe.add(lt.file),J.push(lt))}return J},pe=(q,Y,J)=>{if(Y!==void 0&&q.some(Oe=>Oe.parent===Y))return q.filter(Oe=>Oe.parent===Y);let ne=J?.toLowerCase();return ne!==void 0&&q.some(Oe=>Oe.parent?.toLowerCase()===ne)?q.filter(Oe=>Oe.parent?.toLowerCase()===ne):q},ue=(q,Y,J,ne)=>({shape:q,receiver:Y,selfType:J,typeHint:ne,results:new Map}),mt=ue("bare"),re=ue("outside"),ye=new Map,we=new Map,K=(q,Y)=>{let J=q.receiver;if(J===void 0)return mt;if(R==="rust"&&J==="super"){let dt=te(q.line);dt&&(J=`${Uu}${te(dt)}`,B?.has(J)||(B??=new Map).set(J,[v.rel]))}let ne=ye.get(J);if(ne)return ne;let Oe=dt=>ue("self",J,dt,dt);if(!zu.has(J)&&!(J==="super"&&R!=="rust")){if(B?.has(J))ne=ue("module",J);else if(U.modules.has(J))ne=ue("module",J);else if(O.has(J))ne=Oe(J);else if(!Ay.has(R)){let dt=je(J);ne=dt?Oe(dt):ue("foreign",J,void 0,U.names.get(J)?.name??J)}if(ne)return ye.set(J,ne),ne}Y===void 0&&(X??=v.symbols.filter(dt=>!lo.has(dt.kind)),Y=Ln(X,q.line));let lt=we.get(Y??null);return lt||we.set(Y??null,lt=new Map),ne=lt.get(J),ne||(ne=ae(J,Y,Oe),lt.set(J,ne),ne)},ae=(q,Y,J)=>{if(zu.has(q))return J(Y?.parent);if(q==="super"){let lt=ve(Y),dt=lt!==void 0?ie(lt):void 0;return dt!==void 0&&O.has(dt)?J(dt):ue("foreign",q,void 0,dt)}if(R==="go"&&zR(Y)===q)return J(Y.parent);let ne=Y?.signature?UR(Y.signature,q):void 0;if(ne?.qualifier!==void 0&&!r&&U.modules.get(ne.qualifier)===null)return re;if(ne!==void 0&&O.has(ne.type))return J(ne.type);let Oe=ne===void 0?je(q):void 0;return Oe?J(Oe):ue("foreign",q,void 0,ne?.type??U.names.get(q)?.name??q)},Fe=(q,Y)=>{let{shape:J,receiver:ne,selfType:Oe,typeHint:lt}=Y;if(J==="outside")return null;let dt=R==="rust"&&J==="bare",fm=ne?.startsWith(Uu)?Number(ne.slice(Uu.length)):void 0,li=Me=>!(dt&&Me.kind==="enum-member"&&!Qe(Me))&&!(fm!==void 0&&(Me.file!==v.rel||te(Me.line)!==fm)),Ot;if(r)Ot=w.get(q);else if(J==="bare")Ot=M?E.get(q):w.get(q);else if(J==="self"){if(Ot=Oe!==void 0?Ee(Oe,q):void 0,ne==="super")for(let Me=Oe,Kn=0;!Ot&&Me!==void 0&&KnMe.name===q&&!lo.has(Me.kind)&&!bl.has(Me.kind)&&li(Me))),Ot)return o&&!o.has(Ot.name)?null:{hit:{def:Ot,corroborated:!0},local:!0};let hs,Jn=q;if(J==="bare"){let Me=U.names.get(q);Me&&({name:Jn,files:hs}=Me)}else J==="module"&&(hs=B?.get(ne)??U.modules.get(ne));let sw=B?.has(ne)===!0&&J==="module";if(o&&!o.has(Jn))return null;let ci=M?J==="bare"||J==="module"?"free":J==="self"||R==="go"?"member":"member-first":"any",iw=ci==="member-first"?"member":ci;if(hs!==void 0)if(hs===null){if(!r)return null}else{let Me=s.within(S(Jn,R,ci),hs,Jn);if(x==="import"||sw)for(let _m of s.within(k(Jn,R,ci),hs,Jn))Me.includes(_m)||Me.push(_m);R==="rust"&&(Me=Me.filter(li));let Kn=zr(v.rel,Me);if(Kn)return{hit:{def:Kn,corroborated:!0},local:!1};if(Me.length||!r&&My.has(R))return null}let mm=be(Jn,ci),pm=pe(R==="rust"?mm.filter(li):mm,lt,ne);if(pm.length){let Me=zr(v.rel,pm);return Me?{hit:{def:Me,corroborated:!0},local:!1}:null}let gm=S(Jn,R,r?"any":iw);if(!gm)return null;let hm=Py(gm,v.rel),$c=R==="rust"?hm.filter(li):hm;if(!$c.length)return null;let Tc=[...$c];if(r){if(R==="js"&&$c.length!==1)return null}else{if(My.has(R))return null;let Me=I(v.rel);Tc=Tc.filter(Kn=>!Ou(Kn.file)&&(Me||!I(Kn.file)))}let ym=zr(v.rel,pe(Tc,lt,ne));return ym?{hit:{def:ym,corroborated:!1},local:!1}:null};return(q,Y)=>{let J=K(q,Y),ne=J.results.get(q.name);if(ne===void 0&&J.results.set(q.name,ne=Fe(q.name,J)),!!ne&&!(ne.local&&ne.hit.def.line===q.line))return ne.hit}}}}var lo,My,Ay,Iy,$y,bl,Uu,PR,LR,zu,DR,jR,WR,Et,co,Hu,Ty,Fy,Ps=z(()=>{"use strict";$();On();fr();mr();St();Os();gr();de();lo=new Set(["reexport","reexport-all","default"]),My=new Set(["js","go"]),Ay=new Set(["go","python"]),Iy=new Set(["go","java"]),$y={go:"package",java:"package",python:"import",rust:"path"},bl=new Set(["mod","module","package","namespace"]),Uu="super\0inline\0",PR=8,LR=new Set(["Ok","Err","Some","None"]),zu=new Set(["self","cls","this","Self"]),DR=new Set(["function","method","def","constructor","operator"]),jR=3,WR={modules:new Map,names:new Map},Et=e=>e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",co=e=>e.endsWith("_test.go");Hu=new Map;Ty=new WeakMap;Fy=()=>({any:new Map,free:new Map,member:new Map})});function De(e){return HR.has(e)?"js":e==="c"||e==="cpp"?"c":e}function GR(e,t){let n=Math.min(e.length,t.length),r=0,o=0;for(;or?(r=a,n=s,o=!1):a===r&&(o=!0)}return o?void 0:n}function Qi(e,t,n){let r=e.get(t);r||e.set(t,r=new Map);for(let a of r.values())if(a.byFile.has(n.file))return!1;let o=De(n.lang),s=r.get(o);return s||r.set(o,s={list:[],byFile:new Map}),s.list.push(n),s.byFile.set(n.file,n),!0}function Hs(e){let t=new Map;for(let n of e)for(let r=n.indexOf("|");r!==-1;r=n.indexOf("|",r+1)){let o=n.slice(0,r),s=n.slice(r+1);if(o===s)continue;let a=t.get(o);a||t.set(o,a=new Set),a.add(s)}return t}function Gu(e,t){if(!t?.size)return[];if(t.sizet.has(n.file))}function Py(e,t){return e.byFile.has(t)?e.list.filter(n=>n.file!==t):e.list}function qu(e,t,n){let r=pr(e,t,{ctx:n}),o=new Map;for(let s of e.files){let a=r.forFile(s);if(a)for(let l of s.calls){let c=a(l);if(!c||c.def.file===s.rel)continue;let d=c.corroborated?"extracted":"inferred",u=`${s.rel}|${c.def.file}`,f=o.get(u);f?(f.weight+=1,d==="extracted"&&(f.confidence="extracted")):o.set(u,{from:s.rel,to:c.def.file,weight:1,confidence:d})}}return[...o.values()].map(s=>({from:s.from,to:s.to,kind:"call",weight:Math.min(s.weight,5),confidence:s.confidence})).sort((s,a)=>T(s.from,a.from)||T(s.to,a.to))}var HR,fr=z(()=>{"use strict";$();Ps();de();HR=new Set(["typescript","javascript","vue","svelte","astro"])});function qR(e){return e.length<5?!1:/[a-z][A-Z]/.test(e)||/[A-Z]{2}/.test(e)||e.includes("_")||/\d/.test(e)}function Wu(e){let t=new Map;for(let r of e.files)for(let o of r.symbols){if(!o.exported||VR.has(o.kind)||!qR(o.name))continue;let s=t.get(o.name);s||t.set(o.name,s=new Set),s.add(r.rel)}let n=new Map;for(let[r,o]of t)o.size===1&&n.set(r,[...o][0]);return n}function Dn(e,t){let n=Ly(t.from,t.to,t.kind),r=e.get(n);if(r){r.weight+=t.weight;return}e.set(n,{...t})}function Ju(e,t,n,r,o){let s=new Map,a=new Set;for(let C of e.files){let I;for(let P of C.refs){if(P.soft){(I??=[]).push(P);continue}if(P.kind==="doc-link"){let v=cr(C.rel,P.spec,t);if(v.kind==="external")continue;v.kind==="dangling"?Dn(s,{from:C.rel,to:P.spec,kind:"doc-link",weight:1,dangling:!0,reason:v.reason}):v.target!==C.rel&&Dn(s,{from:C.rel,to:v.target,kind:"doc-link",weight:1})}else{let v=gt(C.rel,C.ext,P.spec,t);if(v.kind==="external")continue;v.kind==="dangling"?Dn(s,{from:C.rel,to:P.spec,kind:"import",weight:1,dangling:!0,reason:v.reason}):v.target!==C.rel&&(Dn(s,{from:C.rel,to:v.target,kind:"import",weight:1}),a.add(`${C.rel}|${v.target}`))}}for(let P of I??[]){let v=P.kind==="doc-link"?cr(C.rel,P.spec,t):gt(C.rel,C.ext,P.spec,t);v.kind!=="resolved"||v.target===C.rel||s.has(Ly(C.rel,v.target,P.kind))||(Dn(s,{from:C.rel,to:v.target,kind:P.kind,weight:1}),P.kind==="import"&&a.add(`${C.rel}|${v.target}`))}}let l=new Set;for(let C of qu(e,a,t))Dn(s,C),l.add(`${C.from}|${C.to}`);for(let C of xu(e,a,t))Dn(s,C);xy(e,t,a);let c=Br(e);if(c.size){let C,I=(v,R)=>{let M=wl(R);for(let x of(C??=Hs(a)).get(v)??[])if(wl(x)===M)return!0;return!1},P=new Map(e.files.map(v=>[v.rel,v.lang]));for(let v of e.files){if(v.kind!=="code"||!v.idents?.length)continue;let R=new Set([...v.importedNames??[],...(v.importAliases??[]).map(E=>E.local)]),M=De(v.lang),x=new Map;for(let E of v.idents){let N=c.get(E);!N||N===v.rel||R.has(E)||De(P.get(N)??"")===M&&x.set(N,(x.get(N)??0)+1)}let w=v.lang==="go";for(let[E,N]of x){let O=`${v.rel}|${E}`;a.has(O)||l.has(O)||w&&E.endsWith(".go")&&wl(E)!==wl(v.rel)&&!I(v.rel,E)||Dn(s,{from:v.rel,to:E,kind:"use",weight:Math.min(N,5)})}}}if(c.size)for(let[C,{counts:I}]of ol(e))for(let[P,v]of I){let R=c.get(P);R!==C&&Dn(s,{from:C,to:R,kind:"mention",weight:Math.min(v,5)})}let d=[...s.values()].sort((C,I)=>T(C.from,I.from)||T(C.to,I.to)||T(C.kind,I.kind)),u=new Map,f=new Map,m=new Set(e.files.map(C=>C.rel));for(let C of d)C.dangling||!m.has(C.to)||(f.set(C.from,(f.get(C.from)??0)+1),u.set(C.to,(u.get(C.to)??0)+1));let p={import:7,extends:6,implements:5,call:4,use:3,"doc-link":2,mention:1,contains:0},g=new Map;for(let C of d){if(C.dangling||!m.has(C.to))continue;let I=r.get(C.from),P=r.get(C.to);if(!I||!P||I===P)continue;let v=`${I}${Vu}${P}`,R=g.get(v);R?(R.weight+=C.weight,(p[C.kind]??0)>(p[R.kind]??0)&&(R.kind=C.kind)):g.set(v,{from:I,to:P,kind:C.kind,weight:C.weight})}let h=[...g.values()].sort((C,I)=>T(C.from,I.from)||T(C.to,I.to)),_=new Map,y=new Map;for(let C of h)y.set(C.from,(y.get(C.from)??0)+1),_.set(C.to,(_.get(C.to)??0)+1);let b=e.files.map(C=>({id:C.rel,kind:"file",rel:C.rel,fileKind:C.kind,lang:C.lang,module:r.get(C.rel)??"root",title:C.title,summary:C.summary,symbols:C.symbols.length,lines:C.lines,degIn:u.get(C.rel)??0,degOut:f.get(C.rel)??0,...C.generated?{generated:C.generated}:{}})).sort((C,I)=>T(C.rel,I.rel)),S=new Map;for(let C of e.files){let I=r.get(C.rel)??"root";S.set(I,(S.get(I)??0)+C.symbols.length)}let k=n.map(C=>({id:C.slug,kind:"module",slug:C.slug,path:C.path,title:C.title,summary:C.summary,tier:C.tier,members:C.members,symbols:S.get(C.slug)??0,degIn:_.get(C.slug)??0,degOut:y.get(C.slug)??0})).sort((C,I)=>T(C.slug,I.slug));return{schemaVersion:o?.schemaVersion??5,version:o?.version??Ne,commit:e.commit,fileCount:e.files.length,languages:e.languages,files:b,modules:k,fileEdges:d,moduleEdges:h}}var wl,VR,Vu,Ly,yl=z(()=>{"use strict";$();Rt();On();fr();Pn();St();de();wl=e=>e.includes("/")?e.slice(0,e.lastIndexOf("/")):"";VR=new Set(["reexport","reexport-all","default"]);Vu="\0",Ly=(e,t,n)=>`${e}${Vu}${t}${Vu}${n}`});function*JR(e){for(let t of e.files)yield*t.symbols}function uo(e,t){let n=yr(e).get(t);return n?[...n.symbols].filter(r=>!xl.has(r.kind)).sort((r,o)=>r.line-o.line||T(r.name,o.name)):[]}function Sl(e,t,n){let r=yr(e).get(t);if(!r)return;let o=Ln(r.symbols,n);if(!o)return{file:t,line:n,symbol:null,enclosing:[]};let s=Math.max(n,o.endLine??n),a=r.symbols.filter(c=>c!==o&&!xl.has(c.kind)&&c.endLine!==void 0&&c.line<=o.line&&c.endLine>=s).sort((c,d)=>c.line-d.line||d.endLine-c.endLine||T(c.name,d.name)).map(kt),l=kt(o);return{file:t,line:n,symbol:{...o,id:l},enclosing:[...new Set(a)].filter(c=>c!==l),...o.endLine===void 0?{approximate:!0}:{}}}function fo(e,t){let n=yr(e);return{...t,callers:t.callers.map(r=>{let o=Ln(n.get(r.file)?.symbols??[],r.line);return o?{...r,caller:kt(o)}:{...r}})}}function En(e,t,n={}){let r=t.split("/").filter(Boolean);if(!r.length)return[];let o=r[r.length-1],s=r.slice(0,-1),a=(u,f)=>n.substring?u.toLowerCase().includes(f.toLowerCase()):u===f,l=[],c=n.substring?JR(e):gl(e).get(o)??[];for(let u of c)if(!xl.has(u.kind)&&a(u.name,o)){if(s.length){let f=s[s.length-1];if(!u.parent||u.parent!==f)continue}l.push({...u})}l.sort((u,f)=>+(f.name===o)-+(u.name===o)||T(u.file,f.file)||u.line-f.line);let d=l.slice(0,n.maxResults??50);if(n.includeBody){let u=new Map,f=new Set;for(let m of d){let p=m.endLine??m.line;if(f.has(m.file))continue;let g=u.get(m.file);if(!g){let h=se(j(e.root,m.file));if(!h){f.add(m.file);continue}g=h.split(` `),u.set(m.file,g)}m.body=g.slice(m.line-1,p).join(` -`)}}return n.concise?d.map(u=>({name:u.name,kind:u.kind,file:u.file,line:u.line,...u.parent?{parent:u.parent}:{},...u.body!==void 0?{body:u.body}:{}})):d}function Nt(e,t){let n=ll(e);for(let r of Tn(t)){let o=(n.get(r.name)??[]).filter(s=>!pl.has(s.kind)&&As(r,s));if(o.length)return{reading:r,defs:o.sort((s,a)=>T(s.file,a.file)||s.line-a.line)}}}function hl(e,t){let n=mr(e,t),r=n.length?t:Nt(e,t)?.reading.name;return r===void 0||r===t?{name:t,sites:n}:{name:r,sites:mr(e,r)}}function yl(e,t,n){let r=Nt(e,t);if(!r)return;let o=r.reading.name,s=(c,d)=>`${d}:${c}`,a=new Set;for(let c of n.values())if(c.def.name===o)for(let d of c.callers)a.add(s(d.file,d.line));for(let c of ll(e).get(o)??[])a.add(s(c.file,c.line));let l=mr(e,o).filter(c=>!a.has(s(c.file,c.line)));return{name:t,error:`no tracked callers for "${t}"`,defs:r.defs.map(c=>({name:c.name,kind:c.kind,file:c.file,line:c.line})),unresolvedSites:l.length,sample:l.slice(0,5).map(c=>c.receiver!==void 0?{file:c.file,line:c.line,receiver:c.receiver}:{file:c.file,line:c.line}),hint:l.length?`${l.length} call site(s) name "${o}" but none could be bound to a single definition; raw mode (CLI --raw, MCP raw:true) lists every site, recall mode (--recall, recall:true) relaxes the JS/TS import gate`:`no call site in the index names "${o}"`}}function io(e,t){let n=Nt(e,t),r=n?.defs??[],o=n?.reading.name??t,s=Ns(e),a=s.get(o),l=[...new Set(r.map(g=>g.file))],c=[];for(let g of l){let h=a?.def.file===g?a:s.get(`${o}@${g}`);if(h)for(let _ of h.callers)c.push(l.length>1?{..._,def:g}:{..._})}c.sort((g,h)=>T(g.file,h.file)||g.line-h.line);let d=new Set,f=Pr(e).get(o),m=fy(e),p=new RegExp(`(?{"use strict";$();me();Ze();lr();gt();ce();Lr();Br();pl=new Set(["reexport","reexport-all","default"])});function Iy(e,t,n){if(!LR.has(n)||t<0||t>=e.length)return;let r=Uu(e[t]),o=[{t:"code",close:null,nest:0}],s=0,a=0,l=!1,c=Math.min(e.length,t+DR),d=(u,f,m)=>{let p=e[u];if(jR.test(p.slice(f+1))&&!(m&&u!==t&&(Uu(p)!==r||p.trim()[0]!=="}")))return u};for(let u=t;u1||l||s>0||a>0)continue;let g=e.slice(u+1,c).findIndex(_=>_.trim()!=="");if(g<0)return;let h=e[u+1+g];if(!h.trim().startsWith("{")&&!(/[,:=>|&+\-*/?.]/.test(m)&&Uu(h).length>r.length&&h.startsWith(r)))return}}function WR(e,t,n){let r=e[t];if(n==="swift"){let c=0;for(;e[t+c]==="#";)c++;if(e[t+c]!=='"')return r==="`"?Ay("`"):void 0;let d=e.startsWith('"""',t+c),u=d?'"""':'"';return{frame:{t:"str",quote:u,hashes:c,escapes:c===0,interp:"swift",multiline:d},length:c+u.length}}if(n==="kotlin")return e.startsWith('"""',t)?{frame:{t:"str",quote:'"""',hashes:0,escapes:!1,interp:"dollar",multiline:!0},length:3}:r==='"'?{frame:{t:"str",quote:'"',hashes:0,escapes:!0,interp:"dollar",multiline:!1},length:1}:r==="'"?{frame:{t:"str",quote:"'",hashes:0,escapes:!0,interp:null,multiline:!1},length:1}:r==="`"?Ay("`"):void 0;let o=r==="r"&&(e[t+1]==='"'||e[t+1]==="'")&&!/[\w$]/.test(e[t-1]??""),s=o?t+1:t;if(e[s]!=='"'&&e[s]!=="'")return;let a=e.startsWith(e[s].repeat(3),s),l=a?e[s].repeat(3):e[s];return{frame:{t:"str",quote:l,hashes:0,escapes:!o,interp:o?null:"dollar",multiline:a},length:(o?1:0)+l.length}}function Ay(e){return{frame:{t:"str",quote:e,hashes:0,escapes:!1,interp:null,multiline:!1},length:e.length}}function VR(e,t,n){return t==="rust"&&Ty.test(e)?!1:$y.has(t)&&(e.startsWith("//")||e.startsWith("/*")&&e.endsWith("*/"))||BR.has(t)&&e.startsWith("#")&&!(n===0&&e.startsWith("#!"))?!0:UR.has(t)&&e.startsWith("--")}function Fy(e,t){return zR.has(t)&&/^@[A-Za-z_]/.test(e)||HR.has(t)&&/^#\[/.test(e)||GR.has(t)&&e.startsWith("[")?!0:t==="cpp"&&/^template\b/.test(e)}function Oy(e){let t=0;for(let n of e.replace(/"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\.|[^`\\])*`/g,""))n==="("||n==="["||n==="{"?t++:(n===")"||n==="]"||n==="}")&&t--;return t}function JR(e,t,n){let r=e[t].trim(),o=Math.max(0,t-qR);if($y.has(n)&&r.endsWith("*/")){for(let a=t;a>=o;a--){let l=e[a];if(l.lastIndexOf("/*")<0)continue;let d=l.trim();return d.startsWith("/*")&&!(n==="rust"&&Ty.test(d))?a:void 0}return}if(n==="elixir"&&r.endsWith('"""')){for(let a=t-1;a>=o;a--)if(e[a].includes('"""'))return/^@\w+\s.*"""\s*$/.test(e[a].trim())?a:void 0;return}if(n==="cpp"&&r.endsWith(">")){for(let a=t;a>=o&&e[a].trim()!=="";a--)if(/^template\b/.test(e[a].trim()))return a;return}if(!/[)\]}]$/.test(r))return;let s=0;for(let a=t;a>=o;a--){let l=e[a];if(l.trim()===""||(s+=Oy(l),s>0))return;if(s===0)return Fy(l.trim(),n)?a:void 0}}function Ny(e,t,n){let r=t;for(let o=t-1;o>=0;){let s=e[o].trim();if(s==="")break;if(VR(s,n,o)||Fy(s,n)&&Oy(s)===0){r=o--;continue}let a=JR(e,o,n);if(a===void 0)break;r=a,o=a-1}return r}var LR,DR,jR,Uu,$y,BR,UR,zR,HR,GR,qR,Ty,Py=H(()=>{"use strict";$();LR=new Set(["swift","kotlin","dart"]),DR=1e4,jR=/^\s*[;,]?\s*(?:\/\/.*)?$/,Uu=e=>/^\s*/.exec(e)[0];$y=new Set(["typescript","javascript","java","kotlin","scala","dart","swift","go","rust","csharp","c","cpp","php","zig","solidity","hcl","terraform"]),BR=new Set(["python","ruby","shell","elixir","php","hcl","terraform"]),UR=new Set(["lua"]),zR=new Set(["python","typescript","javascript","java","kotlin","scala","dart","swift","elixir"]),HR=new Set(["rust","php"]),GR=new Set(["csharp","cpp"]),qR=200,Ty=/^(?:\/\/!|\/\*!|#!\[)/});function By(e,t,n,r){let o=wn(e,t,{maxResults:1/0}),s=n===void 0?void 0:XR(e.root,n);n!==void 0&&(o=o.filter(c=>c.file===n||c.file===s));let a=s!==void 0?` in ${s}`:"";if(o.length===0){let c=wn(e,t,{substring:!0,maxResults:5}).map(d=>`${d.file}:${d.line} ${d.parent?d.parent+"/":""}${d.name}`).join(", ");throw new Error(`no symbol matches "${t}"${a}${c?` \u2014 near matches: ${c}`:""}`)}if(r!==void 0){let c=o;if(o=c.filter(d=>d.line===r),!o.length){let d=m=>(m.endLine??m.line)-m.line,u=c.filter(m=>m.line<=r&&r<=(m.endLine??m.line)),f=Math.min(...u.map(d));o=u.filter(m=>d(m)===f)}if(!o.length)throw new Error(`no "${t}"${a} is declared at or spans line ${r} \u2014 candidates: ${Ly(c)}`)}if(o.length===1)return o[0];if(new Set(o.map(c=>c.file)).size===1){let c=o.map(d=>d.line).join(", ");throw new Error(`"${t}" is ambiguous (${o.length} declarations in ${o[0].file}, lines ${c}) \u2014 pass \`line\`: one of ${c}`)}throw new Error(`"${t}" is ambiguous (${o.length} matches: ${Ly(o)}) \u2014 qualify with \`file\` or a Parent/name path, and \`line\` for same-file homonyms`)}function Ly(e){let t=e.slice(0,zu).map(n=>`${n.file}:${n.line}`).join(", ");return e.length>zu?`${t}, \u2026 ${e.length-zu} more`:t}function XR(e,t){let n=Pe(t)?je(e,t):t;return J.normalize(n.replace(/\\/g,"/"))}function ZR(e){let t=ps(e);if(!t.ok)throw new Error(`cannot read ${e}`);if(t.binary||t.encoding===null)throw new Error(`cannot edit a binary file: ${e}`);let n=t.encoding;if((n==="utf16le"||n==="utf16be")&&(t.bytes-2)%2)throw new Error("cannot edit malformed UTF-16 source: odd byte length");let r=t.text.split(/(\r?\n)/),o=[],s=[];for(let l=0;lc)??e.newline,l=n?s[t+n-1]:t0&&(s[t-1]=a),o.splice(t,n,...r),s.splice(t,n,...r.map((c,d)=>d===r.length-1?l:a))}function QR(e){return e.replace(/\r\n/g,` +`)}}return n.concise?d.map(u=>({name:u.name,kind:u.kind,file:u.file,line:u.line,...u.parent?{parent:u.parent}:{},...u.body!==void 0?{body:u.body}:{}})):d}function Ut(e,t){let n=gl(e);for(let r of Nn(t)){let o=(n.get(r.name)??[]).filter(s=>!xl.has(s.kind)&&Ns(r,s));if(o.length)return{reading:r,defs:o.sort((s,a)=>T(s.file,a.file)||s.line-a.line)}}}function kl(e,t){let n=_r(e,t),r=n.length?t:Ut(e,t)?.reading.name;return r===void 0||r===t?{name:t,sites:n}:{name:r,sites:_r(e,r)}}function El(e,t,n){let r=Ut(e,t);if(!r)return;let o=r.reading.name,s=(c,d)=>`${d}:${c}`,a=new Set;for(let c of n.values())if(c.def.name===o)for(let d of c.callers)a.add(s(d.file,d.line));for(let c of gl(e).get(o)??[])a.add(s(c.file,c.line));let l=_r(e,o).filter(c=>!a.has(s(c.file,c.line)));return{name:t,error:`no tracked callers for "${t}"`,defs:r.defs.map(c=>({name:c.name,kind:c.kind,file:c.file,line:c.line})),unresolvedSites:l.length,sample:l.slice(0,5).map(c=>c.receiver!==void 0?{file:c.file,line:c.line,receiver:c.receiver}:{file:c.file,line:c.line}),hint:l.length?`${l.length} call site(s) name "${o}" but none could be bound to a single definition; raw mode (CLI --raw, MCP raw:true) lists every site, recall mode (--recall, recall:true) relaxes the JS/TS import gate`:`no call site in the index names "${o}"`}}function mo(e,t){let n=Ut(e,t),r=n?.defs??[],o=n?.reading.name??t,s=Bs(e),a=s.get(o),l=[...new Set(r.map(g=>g.file))],c=[];for(let g of l){let h=a?.def.file===g?a:s.get(`${o}@${g}`);if(h)for(let _ of h.callers)c.push(l.length>1?{..._,def:g}:{..._})}c.sort((g,h)=>T(g.file,h.file)||g.line-h.line);let d=new Set,f=Br(e).get(o),m=Sy(e),p=new RegExp(`(?{"use strict";$();ge();nt();mr();St();de();Ur();qr();xl=new Set(["reexport","reexport-all","default"])});function jy(e,t,n){if(!KR.has(n)||t<0||t>=e.length)return;let r=Ku(e[t]),o=[{t:"code",close:null,nest:0}],s=0,a=0,l=!1,c=Math.min(e.length,t+XR),d=(u,f,m)=>{let p=e[u];if(ZR.test(p.slice(f+1))&&!(m&&u!==t&&(Ku(p)!==r||p.trim()[0]!=="}")))return u};for(let u=t;u1||l||s>0||a>0)continue;let g=e.slice(u+1,c).findIndex(_=>_.trim()!=="");if(g<0)return;let h=e[u+1+g];if(!h.trim().startsWith("{")&&!(/[,:=>|&+\-*/?.]/.test(m)&&Ku(h).length>r.length&&h.startsWith(r)))return}}function YR(e,t,n){let r=e[t];if(n==="swift"){let c=0;for(;e[t+c]==="#";)c++;if(e[t+c]!=='"')return r==="`"?Dy("`"):void 0;let d=e.startsWith('"""',t+c),u=d?'"""':'"';return{frame:{t:"str",quote:u,hashes:c,escapes:c===0,interp:"swift",multiline:d},length:c+u.length}}if(n==="kotlin")return e.startsWith('"""',t)?{frame:{t:"str",quote:'"""',hashes:0,escapes:!1,interp:"dollar",multiline:!0},length:3}:r==='"'?{frame:{t:"str",quote:'"',hashes:0,escapes:!0,interp:"dollar",multiline:!1},length:1}:r==="'"?{frame:{t:"str",quote:"'",hashes:0,escapes:!0,interp:null,multiline:!1},length:1}:r==="`"?Dy("`"):void 0;let o=r==="r"&&(e[t+1]==='"'||e[t+1]==="'")&&!/[\w$]/.test(e[t-1]??""),s=o?t+1:t;if(e[s]!=='"'&&e[s]!=="'")return;let a=e.startsWith(e[s].repeat(3),s),l=a?e[s].repeat(3):e[s];return{frame:{t:"str",quote:l,hashes:0,escapes:!o,interp:o?null:"dollar",multiline:a},length:(o?1:0)+l.length}}function Dy(e){return{frame:{t:"str",quote:e,hashes:0,escapes:!1,interp:null,multiline:!1},length:e.length}}function iC(e,t,n){return t==="rust"&&By.test(e)?!1:Wy.has(t)&&(e.startsWith("//")||e.startsWith("/*")&&e.endsWith("*/"))||QR.has(t)&&e.startsWith("#")&&!(n===0&&e.startsWith("#!"))?!0:eC.has(t)&&e.startsWith("--")}function Uy(e,t){return tC.has(t)&&/^@[A-Za-z_]/.test(e)||nC.has(t)&&/^#\[/.test(e)||rC.has(t)&&e.startsWith("[")?!0:t==="cpp"&&/^template\b/.test(e)}function zy(e){let t=0;for(let n of e.replace(/"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\.|[^`\\])*`/g,""))n==="("||n==="["||n==="{"?t++:(n===")"||n==="]"||n==="}")&&t--;return t}function oC(e,t,n){let r=e[t].trim(),o=Math.max(0,t-sC);if(Wy.has(n)&&r.endsWith("*/")){for(let a=t;a>=o;a--){let l=e[a];if(l.lastIndexOf("/*")<0)continue;let d=l.trim();return d.startsWith("/*")&&!(n==="rust"&&By.test(d))?a:void 0}return}if(n==="elixir"&&r.endsWith('"""')){for(let a=t-1;a>=o;a--)if(e[a].includes('"""'))return/^@\w+\s.*"""\s*$/.test(e[a].trim())?a:void 0;return}if(n==="cpp"&&r.endsWith(">")){for(let a=t;a>=o&&e[a].trim()!=="";a--)if(/^template\b/.test(e[a].trim()))return a;return}if(!/[)\]}]$/.test(r))return;let s=0;for(let a=t;a>=o;a--){let l=e[a];if(l.trim()===""||(s+=zy(l),s>0))return;if(s===0)return Uy(l.trim(),n)?a:void 0}}function Hy(e,t,n){let r=t;for(let o=t-1;o>=0;){let s=e[o].trim();if(s==="")break;if(iC(s,n,o)||Uy(s,n)&&zy(s)===0){r=o--;continue}let a=oC(e,o,n);if(a===void 0)break;r=a,o=a-1}return r}var KR,XR,ZR,Ku,Wy,QR,eC,tC,nC,rC,sC,By,Gy=z(()=>{"use strict";$();KR=new Set(["swift","kotlin","dart"]),XR=1e4,ZR=/^\s*[;,]?\s*(?:\/\/.*)?$/,Ku=e=>/^\s*/.exec(e)[0];Wy=new Set(["typescript","javascript","java","kotlin","scala","dart","swift","go","rust","csharp","c","cpp","php","zig","solidity","hcl","terraform"]),QR=new Set(["python","ruby","shell","elixir","php","hcl","terraform"]),eC=new Set(["lua"]),tC=new Set(["python","typescript","javascript","java","kotlin","scala","dart","swift","elixir"]),nC=new Set(["rust","php"]),rC=new Set(["csharp","cpp"]),sC=200,By=/^(?:\/\/!|\/\*!|#!\[)/});function Xy(e,t,n,r){let o=En(e,t,{maxResults:1/0}),s=n===void 0?void 0:lC(e.root,n);n!==void 0&&(o=o.filter(c=>c.file===n||c.file===s));let a=s!==void 0?` in ${s}`:"";if(o.length===0){let c=En(e,t,{substring:!0,maxResults:5}).map(d=>`${d.file}:${d.line} ${d.parent?d.parent+"/":""}${d.name}`).join(", ");throw new Error(`no symbol matches "${t}"${a}${c?` \u2014 near matches: ${c}`:""}`)}if(r!==void 0){let c=o;if(o=c.filter(d=>d.line===r),!o.length){let d=m=>(m.endLine??m.line)-m.line,u=c.filter(m=>m.line<=r&&r<=(m.endLine??m.line)),f=Math.min(...u.map(d));o=u.filter(m=>d(m)===f)}if(!o.length)throw new Error(`no "${t}"${a} is declared at or spans line ${r} \u2014 candidates: ${qy(c)}`)}if(o.length===1)return o[0];if(new Set(o.map(c=>c.file)).size===1){let c=o.map(d=>d.line).join(", ");throw new Error(`"${t}" is ambiguous (${o.length} declarations in ${o[0].file}, lines ${c}) \u2014 pass \`line\`: one of ${c}`)}throw new Error(`"${t}" is ambiguous (${o.length} matches: ${qy(o)}) \u2014 qualify with \`file\` or a Parent/name path, and \`line\` for same-file homonyms`)}function qy(e){let t=e.slice(0,Xu).map(n=>`${n.file}:${n.line}`).join(", ");return e.length>Xu?`${t}, \u2026 ${e.length-Xu} more`:t}function lC(e,t){let n=We(t)?ze(e,t):t;return V.normalize(n.replace(/\\/g,"/"))}function cC(e){let t=ws(e);if(!t.ok)throw new Error(`cannot read ${e}`);if(t.binary||t.encoding===null)throw new Error(`cannot edit a binary file: ${e}`);let n=t.encoding;if((n==="utf16le"||n==="utf16be")&&(t.bytes-2)%2)throw new Error("cannot edit malformed UTF-16 source: odd byte length");let r=t.text.split(/(\r?\n)/),o=[],s=[];for(let l=0;lc)??e.newline,l=n?s[t+n-1]:t0&&(s[t-1]=a),o.splice(t,n,...r),s.splice(t,n,...r.map((c,d)=>d===r.length-1?l:a))}function uC(e){return e.replace(/\r\n/g,` `).replace(/^\n+|\n+$/g,"").split(` -`)}function eC(e,t,n=Ke){let r=rt(e),o=Me(r).mode,s;try{s=wr(j(Ce(r),".codeindex-edit-"))}catch{it(r,t),Xo(r,o);return}let a=j(s,We(r));try{it(a,t),Xo(a,o);try{Rn(a,r)}catch{it(r,t),Xo(r,o)}}finally{try{n(s,{recursive:!0,force:!0})}catch{}}}function Uy(e,t,n,r){if(r&&r.hash===Re(n)&&r.symbols.some(s=>s.endLine!==void 0)===tC(t))return{symbols:r.symbols,truncated:r.truncated===!0};let o=$i(e,t,n);return{symbols:o.symbols,truncated:o.truncated===!0}}function nC(e,t){let n=t.symbols.filter(o=>o.name===e.name&&o.line===e.line&&!Wy.has(o.kind)),r=n.find(o=>o.kind===e.kind&&o.parent===e.parent)??n[0];if(!r)throw new Error(`"${e.name}" is no longer declared at ${e.file}:${e.line} \u2014 the file changed after it was indexed; re-scan and retry`);return r}function Dy(e,t,n){if(e.endLine!==void 0)return e.endLine;let r=Iy(t,e.line-1,e.lang);if(r!==void 0)return r+1;let o=Ir(n)!==void 0?"; `codeindex grammars pull` installs its AST grammar":"";throw new Error(`cannot tell where "${e.name}" ends in ${e.file}: ${e.lang} symbols come from the regex tier, which records only the first line${o}. Inserting before the symbol still works; otherwise edit the file directly`)}function rC(e,t,n,r,o,s){let a=[],{index:l,count:c,len:d,target:u}=s,f=l+1,m=l+c,p=l+d,g=d-c,h=n.truncated?void 0:Uy(e,t,o);if(h&&!h.truncated){let y=c?f:l,b=(C,M,x)=>C===void 0||C>=y&&C<=M?"":`-${C>M?C+x:C}`,S=(C,M,x)=>{let w=new Map;for(let E of C){if(Wy.has(E.kind)||E.line>=f&&E.line<=M)continue;let N=b(E.endLine,M,x),O=`${E.kind} ${oo(E)} ${E.line>M?E.line+x:E.line}${N}`,L=w.get(O);L?L.n++:w.set(O,{n:1,label:`${oo(E)} (${E.kind}, ${N?`lines ${E.line}-${E.endLine}`:`line ${E.line}`})`})}return w},k=S(n.symbols,m,g),R=S(h.symbols,p,0),I=(C,M)=>[...C.keys()].filter(x=>C.get(x).n>(M.get(x)?.n??0)).sort(T),P=I(k,R),v=I(R,k);if(P.length||v.length){let C=(x,w)=>x.slice(0,5).map(E=>w.get(E).label).join(", ")+(x.length>5?`, \u2026 ${x.length-5} more`:""),M=[P.length?`lost ${C(P,k)}`:"",v.length?`gained ${C(v,R)}`:""];a.push(`the edit changed declarations outside lines ${f}-${p}: ${M.filter(Boolean).join("; ")}`)}u&&!h.symbols.some(C=>C.line>=f&&C.line<=p&&C.name===u.name&&oo(C)===oo(u))&&a.push(`"${oo(u)}" is no longer declared in lines ${f}-${p}`)}let _=jy(t,o);if(_?.length){let y=new Set((jy(t,r)??[]).map(S=>S>m?S+g:S)),b=_.filter(S=>!y.has(S));b.length&&a.push(`the edited file has ${b.length} new syntax error(s), first at line ${b[0]}`)}return a}function jy(e,t){let n=Ir(e);if(!n||!De(n))return;let o=Ss(n)?.parse(t);if(o)try{let s=[],a=o.rootNode.hasError?[o.rootNode]:[];for(;a.length;){let l=a.pop();(l.isError||l.isMissing)&&s.push(l.startPosition.row+1);for(let c of l.children)c.hasError&&a.push(c)}return s.sort((l,c)=>l-c)}finally{o.delete()}}function Hu(e,t,n,r,o,s={}){let a=By(e,t,o,s.line),l=j(e.root,a.file),c=ZR(l),d=c.text(),u=fr(e).get(a.file),f=u?.ext??mn(a.file),m=Uy(a.file,f,d,u),p=nC(a,m),g=QR(n),h,_=0,y=g;if(r==="replace")h=p.line-1,_=Dy(p,c.lines,f)-h;else{h=r==="after"?Dy(p,c.lines,f):Ny(c.lines,p.line-1,p.lang);let k=KR.has(p.kind);y=[...k&&h>0&&c.lines[h-1].trim()!==""?[""]:[],...g,...k&&h{"use strict";$();ke();me();js();gt();La();pt();ai();St();Py();ce();KR=new Set(["function","method","class","interface","struct","trait","enum","def"]),Wy=new Set(["reexport","reexport-all","default"]),zu=20;tC=e=>{let t=Ir(e);return t!==void 0&&De(t)};oo=e=>{let t=e.parentPath??e.parent;return t?`${t}/${e.name}`:e.name}});function zy(e){let t=e.replace(/^mem:/,"").replace(/\.md$/,"");if(!t)throw new Error("memory name is empty");let n=t.split("/");for(let r of n){if(!r||r==="."||r===".."||r.includes("\\"))throw new Error(`invalid memory name: "${e}"`);if(!/^[\w][\w.-]*$/.test(r))throw new Error(`invalid memory name segment: "${r}"`)}return t}function Ku(e,t){let n=rt(e);for(let r of[...sC,...t]){n=j(n,r);try{let o=qn(n);if(o.isSymbolicLink())throw new Error(`memory path contains a symbolic link: ${n}`);if(o.isFile()&&o.nlink>1)throw new Error(`memory path contains a hard link: ${n}`)}catch(o){if(o.code!=="ENOENT")throw o}}return n}function _l(e,t){return Ku(e,`${zy(t)}.md`.split("/"))}function ao(e,t,n){let r=_l(e,t);return Yt(Ce(r),{recursive:!0}),_l(e,t),it(r,n.endsWith(` +`)}function fC(e,t,n=et){let r=ct(e),o=$e(r).mode,s;try{s=vr(j(Ie(r),".codeindex-edit-"))}catch{ut(r,t),ra(r,o);return}let a=j(s,He(r));try{ut(a,t),ra(a,o);try{An(a,r)}catch{ut(r,t),ra(r,o)}}finally{try{n(s,{recursive:!0,force:!0})}catch{}}}function Zy(e,t,n,r){if(r&&r.hash===Ae(n)&&r.symbols.some(s=>s.endLine!==void 0)===mC(t))return{symbols:r.symbols,truncated:r.truncated===!0};let o=Li(e,t,n);return{symbols:o.symbols,truncated:o.truncated===!0}}function pC(e,t){let n=t.symbols.filter(o=>o.name===e.name&&o.line===e.line&&!Ky.has(o.kind)),r=n.find(o=>o.kind===e.kind&&o.parent===e.parent)??n[0];if(!r)throw new Error(`"${e.name}" is no longer declared at ${e.file}:${e.line} \u2014 the file changed after it was indexed; re-scan and retry`);return r}function Vy(e,t,n){if(e.endLine!==void 0)return e.endLine;let r=jy(t,e.line-1,e.lang);if(r!==void 0)return r+1;let o=Nr(n)!==void 0?"; `codeindex grammars pull` installs its AST grammar":"";throw new Error(`cannot tell where "${e.name}" ends in ${e.file}: ${e.lang} symbols come from the regex tier, which records only the first line${o}. Inserting before the symbol still works; otherwise edit the file directly`)}function gC(e,t,n,r,o,s){let a=[],{index:l,count:c,len:d,target:u}=s,f=l+1,m=l+c,p=l+d,g=d-c,h=n.truncated?void 0:Zy(e,t,o);if(h&&!h.truncated){let y=c?f:l,b=(R,M,x)=>R===void 0||R>=y&&R<=M?"":`-${R>M?R+x:R}`,S=(R,M,x)=>{let w=new Map;for(let E of R){if(Ky.has(E.kind)||E.line>=f&&E.line<=M)continue;let N=b(E.endLine,M,x),O=`${E.kind} ${po(E)} ${E.line>M?E.line+x:E.line}${N}`,L=w.get(O);L?L.n++:w.set(O,{n:1,label:`${po(E)} (${E.kind}, ${N?`lines ${E.line}-${E.endLine}`:`line ${E.line}`})`})}return w},k=S(n.symbols,m,g),C=S(h.symbols,p,0),I=(R,M)=>[...R.keys()].filter(x=>R.get(x).n>(M.get(x)?.n??0)).sort(T),P=I(k,C),v=I(C,k);if(P.length||v.length){let R=(x,w)=>x.slice(0,5).map(E=>w.get(E).label).join(", ")+(x.length>5?`, \u2026 ${x.length-5} more`:""),M=[P.length?`lost ${R(P,k)}`:"",v.length?`gained ${R(v,C)}`:""];a.push(`the edit changed declarations outside lines ${f}-${p}: ${M.filter(Boolean).join("; ")}`)}u&&!h.symbols.some(R=>R.line>=f&&R.line<=p&&R.name===u.name&&po(R)===po(u))&&a.push(`"${po(u)}" is no longer declared in lines ${f}-${p}`)}let _=Jy(t,o);if(_?.length){let y=new Set((Jy(t,r)??[]).map(S=>S>m?S+g:S)),b=_.filter(S=>!y.has(S));b.length&&a.push(`the edited file has ${b.length} new syntax error(s), first at line ${b[0]}`)}return a}function Jy(e,t){let n=Nr(e);if(!n||!Ue(n))return;let o=Ms(n)?.parse(t);if(o)try{let s=[],a=o.rootNode.hasError?[o.rootNode]:[];for(;a.length;){let l=a.pop();(l.isError||l.isMissing)&&s.push(l.startPosition.row+1);for(let c of l.children)c.hasError&&a.push(c)}return s.sort((l,c)=>l-c)}finally{o.delete()}}function Zu(e,t,n,r,o,s={}){let a=Xy(e,t,o,s.line),l=j(e.root,a.file),c=cC(l),d=c.text(),u=yr(e).get(a.file),f=u?.ext??yn(a.file),m=Zy(a.file,f,d,u),p=pC(a,m),g=uC(n),h,_=0,y=g;if(r==="replace")h=p.line-1,_=Vy(p,c.lines,f)-h;else{h=r==="after"?Vy(p,c.lines,f):Hy(c.lines,p.line-1,p.lang);let k=aC.has(p.kind);y=[...k&&h>0&&c.lines[h-1].trim()!==""?[""]:[],...g,...k&&h{"use strict";$();Re();ge();Gs();St();Ha();wt();mi();At();Gy();de();aC=new Set(["function","method","class","interface","struct","trait","enum","def"]),Ky=new Set(["reexport","reexport-all","default"]),Xu=20;mC=e=>{let t=Nr(e);return t!==void 0&&Ue(t)};po=e=>{let t=e.parentPath??e.parent;return t?`${t}/${e.name}`:e.name}});function Yy(e){let t=e.replace(/^mem:/,"").replace(/\.md$/,"");if(!t)throw new Error("memory name is empty");let n=t.split("/");for(let r of n){if(!r||r==="."||r===".."||r.includes("\\"))throw new Error(`invalid memory name: "${e}"`);if(!/^[\w][\w.-]*$/.test(r))throw new Error(`invalid memory name segment: "${r}"`)}return t}function nf(e,t){let n=ct(e);for(let r of[...hC,...t]){n=j(n,r);try{let o=Zn(n);if(o.isSymbolicLink())throw new Error(`memory path contains a symbolic link: ${n}`);if(o.isFile()&&o.nlink>1)throw new Error(`memory path contains a hard link: ${n}`)}catch(o){if(o.code!=="ENOENT")throw o}}return n}function vl(e,t){return nf(e,`${Yy(t)}.md`.split("/"))}function go(e,t,n){let r=vl(e,t);return rn(Ie(r),{recursive:!0}),vl(e,t),ut(r,n.endsWith(` `)?n:n+` -`),zy(t)}function Xu(e,t){try{return ie(_l(e,t),"utf8")}catch{return}}function Zu(e,t){let n=_l(e,t);try{Me(n)}catch{return!1}return Ke(n),!0}function Yu(e){let t;try{t=Ku(e,[])}catch{return[]}let n=[],r=(o,s)=>{let a;try{a=Vn(o,{withFileTypes:!0})}catch{return}for(let l of a)if(!l.isSymbolicLink()){if(l.isDirectory())r(j(o,l.name),s?`${s}/${l.name}`:l.name);else if(l.isFile()&&l.name.endsWith(".md")){let c=s?`${s}/${l.name.slice(0,-3)}`:l.name.slice(0,-3);try{Ku(e,`${c}.md`.split("/")),n.push(c)}catch{}}}};return r(t,""),n.sort()}var sC,bl=H(()=>{"use strict";$();ke();me();sC=[".codeindex","memories"]});function xn(e,t,n){let r=re(e);if(!r)return;let o;try{o=JSON.parse(r)}catch(s){if(o=Nr(r),o===void 0){if(t&&n){let a=String(s instanceof Error?s.message:s).split(` -`)[0];n.push(`malformed ${t}: ${a}`)}return}}if(o&&typeof o=="object"&&!Array.isArray(o))return o;t&&n&&n.push(`malformed ${t}: not a JSON object`)}function dn(e,t){let n=new RegExp(`^\\[${wt(t)}\\]\\s*$([\\s\\S]*?)(?=^\\[|$(?![\\s\\S]))`,"m"),r=e.match(n);return r?r[1]:null}function lo(e,t){let n=e.match(new RegExp(`${wt(t)}\\s*=\\s*\\[([^\\]]*)\\]`));return n?n[1].split(/\r?\n/).map(r=>r.replace(/#.*$/,"")).join(` -`).split(",").map(r=>r.trim().replace(/^["']|["']$/g,"")).filter(Boolean):[]}function Vt(e,t){return e?.match(new RegExp(`^\\s*${wt(t)}\\s*=\\s*["']([^"']+)["']`,"m"))?.[1]}function tf(e){let t="";for(let n=0;niC(e,t,n,r),s=()=>oC(e,t),a=()=>aC(e,t),l=()=>lC(e,t),c=()=>cC(e,t),d=()=>dC(e,t,r),u=()=>uC(e,t,r),m=n==="go"?[a,o,s,l,c,d,u]:n==="uv"?[c,o,s,a,l,d,u]:n==="composer"?[d,o,c,s,a,l,u]:n==="gradle"?[o,l,s,a,c,d,u,()=>fC(e,t)]:[o,s,a,l,c,d,u];for(let p of m){let g=p();if(g)return g}}function Gy(e){return e.replace(/[\s\S]*?<\/parent>/g,"").replace(/[\s\S]*?<\/dependencies>/g,"").match(/\s*([^<]+?)\s*<\/artifactId>/)?.[1]}function Ws(e,t,n,r,o){let s=t.replace(/^\.\//,"").replace(/\/+$/,"");if(!s||s==="."||n.has(s)||s.split("/").includes(".."))return;let a=mC(e,s,r,o);a&&n.set(s,a)}function pC(e,t){try{return Me(j(e,t)).isDirectory()}catch{return!1}}function qy(e,t){let n;try{n=Vn(t?j(e,t):e,{withFileTypes:!0})}catch{return[]}return n.filter(r=>r.isDirectory()&&!r.name.startsWith(".")&&!Hy.has(r.name)).map(r=>t?`${t}/${r.name}`:r.name).sort(T)}function Vy(e,t,n,r){if(!(n>ef))for(let o of qy(e,t))r.push(o),Vy(e,o,n+1,r)}function gC(e,t){let n=t.split("/").filter(o=>o&&o!==".");if(n.includes(".."))return[];let r=[""];for(let o of n){let s=new Set;if(o==="**")for(let a of r){a&&s.add(a);let l=[];Vy(e,a,0,l);for(let c of l)s.add(c)}else if(o.includes("*")){let a=new RegExp(`^${o.split("*").map(wt).join("[^/]*")}$`);for(let l of r)for(let c of qy(e,l))a.test(c.split("/").pop())&&s.add(c)}else for(let a of r){let l=a?`${a}/${o}`:o;pC(e,l)&&s.add(l)}if(r=[...s],!r.length)return[]}return r.filter(Boolean)}function wl(e,t,n,r,o){let s=t.replace(/^\.\//,"").replace(/\/+$/,"");if(s){if(!s.includes("*")){Ws(e,s,n,r,o);return}for(let a of gC(e,s))Ws(e,a,n,r,o)}}function hC(e,t){let n=[],r=[],o=(l,c)=>{let d=l.trim();d&&(d.startsWith("!")?r.push(d.slice(1)):n.push({pattern:d,kind:c}))},a=xn(j(e,"package.json"),"package.json",t)?.workspaces;if(Array.isArray(a))for(let l of a)typeof l=="string"&&o(l,"npm");else if(a&&typeof a=="object"&&Array.isArray(a.packages))for(let l of a.packages)typeof l=="string"&&o(l,"npm");for(let l of _C(re(j(e,"pnpm-workspace.yaml"))))o(l,"pnpm");return{positives:n,negations:r}}function Qu(e){let t="";for(let n=0;ntypeof o=="string").map(o=>({pattern:o,kind:"lerna"}));let r=xn(j(e,"nx.json"),"nx.json",t);if(r){let o=r.workspaceLayout??{},s=typeof o.appsDir=="string"?o.appsDir:"apps",a=typeof o.libsDir=="string"?o.libsDir:"libs";return[...new Set([s,a])].map(l=>({pattern:`${l}/*`,kind:"nx"}))}return[]}function wC(e,t,n){let r=re(j(e,"Cargo.toml"));if(!r)return;let o=dn(r,"workspace");if(!o)return;let s=lo(o,"members");if(!s.length)return;let a=lo(o,"exclude").map(tf),l=new Map;for(let c of s)wl(e,c,l,"cargo",n);for(let[c,d]of l)a.some(u=>u.test(c))||t.has(c)||t.set(c,d)}function Jy(e,t,n,r){let o;try{o=Vn(t?j(e,t):e,{withFileTypes:!0})}catch{return}if(t&&o.some(a=>a.name==="go.mod"&&!a.isDirectory())&&r.push(t),n>ef)return;let s=o.filter(a=>a.isDirectory()&&!/^[._]/.test(a.name)&&!Hy.has(a.name)&&!xC.has(a.name)).map(a=>a.name).sort(T);for(let a of s)Jy(e,t?`${t}/${a}`:a,n+1,r)}function SC(e,t,n){let r=re(j(e,"go.work"));if(!r){if(Q(j(e,"go.work")))return;let s=[];Jy(e,"",0,s);for(let a of s)Ws(e,a,t,"go",n);return}let o=[];for(let s of r.matchAll(/^use\s*\(([\s\S]*?)\)/gm))for(let a of s[1].split(/\r?\n/)){let l=a.replace(/\/\/.*$/,"").trim();l&&o.push(l)}for(let s of r.matchAll(/^use\s+([^\s(]+)/gm))o.push(s[1]);for(let s of o)s==="."||s==="./"||Ws(e,s,t,"go",n)}function kC(e,t,n){let r=new Set,o=(s,a)=>{if(a>ef||r.has(s))return;r.add(s);let l=re(j(e,s,"pom.xml")).replace(//g,"");for(let c of l.matchAll(/([\s\S]*?)<\/modules>/g))for(let d of c[1].matchAll(/\s*([^<]+?)\s*<\/module>/g)){let u=d[1].endsWith(".xml")?J.dirname(d[1]):d[1],f=J.normalize(J.join(s||".",u)).replace(/\/+$/,"");f==="."||f===".."||f.startsWith("../")||(Ws(e,f,t,"maven",n),o(f,a+1))}};o("",0)}function EC(e,t,n){let r=re(j(e,"pyproject.toml"));if(!r)return;let o=dn(r,"tool.uv.workspace");if(!o)return;let s=lo(o,"members");if(!s.length)return;let a=lo(o,"exclude").map(tf),l=new Map;for(let c of s)wl(e,c,l,"uv",n);for(let[c,d]of l)a.some(u=>u.test(c))||t.has(c)||t.set(c,d)}function vC(e,t,n){let o=xn(j(e,"composer.json"),"composer.json",n)?.repositories;if(Array.isArray(o))for(let s of o){if(!s||typeof s!="object")continue;let{type:a,url:l}=s;a==="path"&&typeof l=="string"&&l&&wl(e,l,t,"composer",n)}}function RC(e,t,n){for(let r of["settings.gradle","settings.gradle.kts"]){let o=re(j(e,r));if(!o)continue;let s=o.replace(/\/\*[\s\S]*?\*\//g,"").replace(/(^|[^:])\/\/.*$/gm,"$1");for(let a of s.matchAll(/^[ \t]*include\b[ \t]*(\([^)]*\)|(?:[^\n]*,[ \t]*\r?\n)*[^\n]*)/gm))for(let l of a[1].matchAll(/["']([^"']+)["']/g)){let c=l[1].replace(/^:/,"").replace(/:/g,"/");c&&Ws(e,c,t,"gradle",n)}}}function CC(e,t,n,r){let o=xn(j(e,t.dir,"package.json"),`${t.dir}/package.json`,r);if(!o)return[];let s=new Set;for(let a of["dependencies","devDependencies","peerDependencies"]){let l=o[a];if(!(!l||typeof l!="object"))for(let c of Object.keys(l))c!==t.name&&n.has(c)&&s.add(c)}return[...s]}function Ky(e,t){let n=`${e}/${t}`.split("/"),r=[];for(let o of n)!o||o==="."||(o===".."?r.pop():r.push(o));return r.join("/")}function MC(e,t,n,r){let o=re(j(e,t.dir,"Cargo.toml"));if(!o)return[];let s=new Set;for(let a of["dependencies","dev-dependencies","build-dependencies"]){let l=dn(o,a);if(l)for(let c of l.split(/\r?\n/)){let d=c.match(/^\s*([A-Za-z0-9_-]+)\s*=\s*(.+)$/);if(!d)continue;let u=d[1];if(u!==t.name&&n.has(u)){s.add(u);continue}let f=d[2].match(/path\s*=\s*["']([^"']+)["']/);if(f){let m=r.get(Ky(t.dir,f[1]));m&&m!==t.name&&s.add(m)}}}return[...s]}function AC(e,t,n,r){let o=re(j(e,t.dir,"go.mod"));if(!o)return[];let s=new Set;for(let a of o.matchAll(/^\s*(?:require\s+)?([^\s/(][^\s]*)\s+v[^\s]+/gm)){let l=a[1];l!==t.name&&n.has(l)&&s.add(l)}for(let a of o.matchAll(/^\s*(?:replace\s+)?(\S+)(?:\s+\S+)?\s*=>\s*(\.\.?\/\S+)/gm)){let l=r.get(Ky(t.dir,a[2]));l&&l!==t.name&&s.add(l)}return[...s]}function IC(e,t,n){let r=re(j(e,t.dir,"pom.xml"));if(!r)return[];let o=new Set;for(let s of r.replace(/[\s\S]*?<\/parent>/g,"").matchAll(/([\s\S]*?)<\/dependency>/g)){let a=s[1].match(/\s*([^<]+?)\s*<\/artifactId>/)?.[1];a&&a!==t.name&&n.has(a)&&o.add(a)}return[...o]}function $C(e,t,n){let r=re(j(e,t.dir,"pyproject.toml"));if(!r)return[];let o=new Set,s=dn(r,"project");if(s)for(let l of lo(s,"dependencies")){let c=l.match(/^[A-Za-z0-9_.-]+/)?.[0];c&&c!==t.name&&n.has(c)&&o.add(c)}let a=dn(r,"tool.uv.sources");if(a)for(let l of a.split(/\r?\n/)){let c=l.match(/^\s*([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*workspace\s*=\s*true/);c&&c[1]!==t.name&&n.has(c[1])&&o.add(c[1])}return[...o]}function TC(e,t,n,r){let o=xn(j(e,t.dir,"composer.json"),`${t.dir}/composer.json`,r);if(!o)return[];let s=new Set;for(let a of["require","require-dev"]){let l=o[a];if(!(!l||typeof l!="object"))for(let c of Object.keys(l))c!==t.name&&n.has(c)&&s.add(c)}return[...s]}function FC(e){return e.split("/").map(t=>t.replace(/[-_]+([A-Za-z0-9])/g,(n,r)=>r.toUpperCase())).join(".")}function OC(e,t,n,r,o){for(let s of["build.gradle","build.gradle.kts"]){let a=re(j(e,t.dir,s));if(!a)continue;let l=new Set;for(let c of a.matchAll(/project\s*\(\s*(?:path\s*[:=]\s*)?["']:?([^"']+)["']/g)){let d=c[1].replace(/:/g,"/"),u=r.get(d)??(n.has(d)?d:void 0);u&&u!==t.name&&l.add(u)}for(let c of a.matchAll(/\bprojects((?:\.[A-Za-z_]\w*)+)/g)){let d=c[1].slice(1).split(".");for(let u=d.length;u>0;u--){let f=o.get(d.slice(0,u).join("."));if(f){f!==t.name&&l.add(f);break}}}return[...l]}return[]}function NC(e,t,n,r,o,s){switch(t.kind){case"cargo":return MC(e,t,n,r);case"go":return AC(e,t,n,r);case"maven":return IC(e,t,n);case"uv":return $C(e,t,n);case"composer":return TC(e,t,n,s);case"gradle":return OC(e,t,n,r,o);default:return CC(e,t,n,s)}}function PC(e){let t=new Map(e.map(s=>[s.name,[...s.dependsOn??[]].sort(T)])),n=new Map,r=[],o=s=>{n.set(s,"visiting"),r.push(s);for(let a of t.get(s)??[])if(t.has(a)){if(n.get(a)==="visiting")return[...r.slice(r.indexOf(a)),a];if(!n.has(a)){let l=o(a);if(l)return l}}return r.pop(),n.set(s,"done"),null};for(let s of[...t.keys()].sort(T))if(!n.has(s)){let a=o(s);if(a)return a}}function LC(e){let t=new Map(e.map(r=>[r.name,new Set(r.dependsOn??[])])),n=[];for(;t.size>0;){let r=[...t.entries()].filter(([,o])=>[...o].every(s=>!t.has(s))).map(([o])=>o).sort(T);if(!r.length){n.push(...[...t.keys()].sort(T));break}for(let o of r)n.push(o),t.delete(o)}return n}function Pn(e){let t=[],n=new Map,{positives:r,negations:o}=hC(e,t),s=r.length?r:bC(e,t);if(s.length){let f=new Map;for(let{pattern:p,kind:g}of s)wl(e,p,f,g,t);let m=o.map(tf);for(let[p,g]of f)m.some(h=>h.test(p))||n.set(p,g)}wC(e,n,t),SC(e,n,t),kC(e,n,t),EC(e,n,t),vC(e,n,t),RC(e,n,t);let a=[...n.values()].sort((f,m)=>T(f.dir,m.dir)),l=new Set(a.map(f=>f.name)),c=new Map(a.map(f=>[f.dir,f.name])),d=new Map(a.map(f=>[FC(f.dir),f.name]));for(let f of a){let m=NC(e,f,l,c,d,t);m.length&&(f.dependsOn=m.sort(T))}let u=[...a].sort((f,m)=>m.dir.length-f.dir.length);return{packages:a,cycle:PC(a),topoOrder:LC(a),warnings:[...new Set(t)].sort(T),packageOf:f=>u.find(m=>f===m.dir||f.startsWith(m.dir+"/"))}}function DC(e){return e.replace(/<(parent|dependencies|dependencyManagement|build|profiles|reporting)>[\s\S]*?<\/\1>/g,"").match(/\s*([^<]+?)\s*<\/version>/)?.[1]}function Xy(e,t,n){let r=j(e,t,n),o=re(r);if(!o)return;let s=l=>typeof l=="string"&&l.trim()?l.trim():void 0,a=(l,c,d)=>c?{manager:l,name:c,...d?{version:d}:{}}:void 0;switch(n){case"package.json":case"composer.json":{let l=xn(r);return a(n==="package.json"?"npm":"composer",s(l?.name),s(l?.version))}case"go.mod":return a("gomod",o.match(/^module\s+"?([^\s"]+)/m)?.[1],void 0);case"Cargo.toml":{let l=dn(o,"package");return a("cargo",Vt(l,"name"),Vt(l,"version"))}case"pyproject.toml":{let l=dn(o,"project"),c=dn(o,"tool.poetry");return a("python",Vt(l,"name")??Vt(c,"name"),Vt(l,"version")??Vt(c,"version"))}case"pom.xml":return a("maven",Gy(o),DC(o));default:return}}function xl(e,t){let n=new Map;for(let a of t.fileEdges){if(a.kind!=="import"||a.dangling)continue;let l=e.packageOf(a.from),c=e.packageOf(a.to);if(!l||!c||l===c)continue;let d=`${l.name}\0${c.name}`,u=n.get(d);u||n.set(d,u={from:l,to:c,files:new Set}),u.files.add(a.from)}let r=[];for(let{from:a,to:l,files:c}of n.values()){if(jC.has(a.kind)||a.dependsOn?.includes(l.name))continue;let d=[...c].sort(T);r.push({from:a.name,to:l.name,files:d.length,example:d[0]})}let o=[];for(let a of e.packages)if(WC.has(a.kind))for(let l of a.dependsOn??[])n.has(`${a.name}\0${l}`)||o.push({from:a.name,to:l});let s=(a,l)=>T(a.from,l.from)||T(a.to,l.to);return{ok:r.length===0,undeclared:r.sort(s),unusedDeclared:o.sort(s)}}function Sl(e,t){let n={packages:e.packages,cycle:e.cycle??null,topoOrder:e.topoOrder};return e.warnings.length&&(n.warnings=e.warnings),t&&(n.check=t),n}var Hy,ef,yC,xC,jC,WC,qr=H(()=>{"use strict";$();ke();me();Ze();$n();ce();et();Hy=new Set(["node_modules",".git","dist","build","target","coverage"]),ef=4;yC=e=>e.trim().replace(/^(["'])(.*)\1$/,"$2").trim();xC=new Set(["vendor","testdata","fixtures","__fixtures__"]);jC=new Set(["nx"]),WC=new Set(["npm","pnpm","lerna","cargo","go"])});function BC(e,t){return e.modules.find(n=>n.slug===t)?.community}function VC(e,t){let n=e.length,r=new Map(e.map((l,c)=>[l,c])),o=Array.from({length:n},()=>new Map);for(let l of t){if(l.dangling)continue;let c=r.get(l.from),d=r.get(l.to);c===void 0||d===void 0||c===d||(o[c].set(d,(o[c].get(d)??0)+l.weight),o[d].set(c,(o[d].get(c)??0)+l.weight))}let s=o.map(l=>{let c=0;for(let d of l.values())c+=d;return c}),a=s.reduce((l,c)=>l+c,0);return{n,adj:o,k:s,twoM:a}}function nf(e){let t=new Map,n=new Array(e.length);for(let r=0;ru);if(o===0)return nf(s);let a=r.slice(),l=!0,c=0;for(;l&&ch-_)){if(g===u)continue;let h=f.get(g)-Zy*r[d]*a[g]/o;h>p+HC&&(p=h,m=g)}a[m]+=r[d],m!==u&&(s[d]=m,l=!0)}}return nf(s)}function KC(e,t,n){let r=Array.from({length:n},()=>new Map);for(let a=0;a{let l=0;for(let c of a.values())l+=c;return l}),s=o.reduce((a,l)=>a+l,0);return{n,adj:r,k:o,twoM:s}}function Yy(e){if(e.n===0)return[];let t=e,n=Array.from({length:e.n},(r,o)=>o);for(let r=0;rn&&n.length>0)}function XC(e,t){let n=t.length,r=new Map;t.forEach((c,d)=>r.set(c,d));let o=Array.from({length:n},()=>new Map);for(let c=0;c{let d=0;for(let u of c.values())d+=u;return d}),a=s.reduce((c,d)=>c+d,0),l=Yy({n,adj:o,k:s,twoM:a});return Qy(l).map(c=>c.map(d=>t[d]))}function ZC(e,t,n){let r=[];for(let o of e){if(o.length>GC*n&&o.length>=qC){let s=XC(t,o);if(s.length>1){r.push(...s);continue}}r.push(o)}return r}function YC(e,t){if(e.length!==t.length)return t.length-e.length;for(let n=0;n({id:Number(f),set:new Set(m)})),s=[];e.forEach((f,m)=>{for(let p of o){let g=0;for(let h of f)p.set.has(h)&&g++;g>0&&s.push({ni:m,prevId:p.id,inter:g})}}),s.sort((f,m)=>m.inter-f.inter||f.ni-m.ni||f.prevId-m.prevId);let a=new Map,l=new Set;for(let f of s)a.has(f.ni)||l.has(f.prevId)||(a.set(f.ni,f.prevId),l.add(f.prevId));let c=new Set;for(let f=0;f=0&&mu.slug).sort(T),s=VC(o,t),a=Yy(s),c=ZC(Qy(a),s,o.length).map(u=>u.map(f=>o[f]).sort(T));c.sort(YC);let d=QC(c,n);return c.forEach((u,f)=>{for(let m of u)r.set(m,d[f])}),r}var Zy,UC,zC,HC,GC,qC,sf=H(()=>{"use strict";$();ce();Zy=1,UC=20,zC=10,HC=1e-12,GC=.25,qC=10});function kl(e){let t=new Map,n=new Map;for(let a of e.modules)a.community!==void 0&&t.set(a.slug,a.community),n.set(a.slug,a.tier);let r=new Map,o=(a,l)=>ar.get(o(a.comms[0],a.comms[1]))<=tM).map(a=>({from:a.edge.from,to:a.edge.to,kind:a.edge.kind,weight:a.edge.weight,communities:a.comms,pairEdges:r.get(o(a.comms[0],a.comms[1]))})).sort((a,l)=>a.pairEdges-l.pairEdges||T(a.from,l.from)||T(a.to,l.to)).slice(0,eM)}function rM(e,t,n){return(e.surprises??kl(e)).some(o=>o.from===t&&o.to===n)}var eM,tM,nM,of=H(()=>{"use strict";$();ce();Ur();eM=24,tM=2,nM=$s});function sM(e){let t={};for(let n of Object.keys(e).sort(T))t[n]=e[n];return t}function Vr(e){let t={...e,languages:sM(e.languages)};return JSON.stringify(t,null,2)+` -`}var El=H(()=>{"use strict";$();ce()});function HM(e,t){return t!=="string"?!0:e.length>=UM||zM.test(e)}function KM(e){if(!e)return!1;for(let t=0;t")&&!"=!<>+-*/%&|^".includes(e[t-1]??""))return JM.test(e.slice(t+1));return!1}function XM(e){let t=[];for(let n of e)WM.has(n.kind)&&(KM(n.signature)||(n.endLine??n.line)-n.line>BM||t.push(n));return t}function ZM(e){return`${e.file.endsWith(".go")&&e.file.includes("/")?e.file.slice(0,e.file.lastIndexOf("/")):e.file}\0${e.holder}`}function eA(e){if(e.every(n=>YM.test(n.file)))return!0;let t=u_(e[0].file);return QM.has(t)&&e.every(n=>u_(n.file)===t)}function tA(e,t){let n;for(let r of e){let o=r.endLine??r.line;to||(!n||r.line>n.line)&&(n=r)}return n}function Dn(e,t={}){let n=t.minFiles??d_.minFiles,r=t.minCount??d_.minCount,o=new Map;for(let a of e.files){if(!a.literals?.length||!t.includeTests&&Ft(a.rel))continue;let l;for(let c of a.literals){if(t.kinds&&!t.kinds.has(c.kind)||!HM(c.value,c.kind))continue;let d=`${c.kind}\0${c.value}`,u=o.get(d);u||o.set(d,u={value:c.value,kind:c.kind,sites:[]});let f=tA(l??=XM(a.symbols),c.line);u.sites.push(f?{file:a.rel,line:c.line,holder:f.name,holderExported:f.exported}:{file:a.rel,line:c.line})}}let s=[];for(let a of o.values()){let l=new Set(a.sites.map(p=>p.file));if(l.sizep.holder),d=a.sites.filter(p=>!p.holder),u=new Set(c.map(p=>p.holder)),m=new Set(c.map(ZM)).size>=2?"competing":c.length>0?"bypassed":"uncentralized";if(a.kind==="number"){if(u.size!==1||d.length===0)continue;m="bypassed"}m==="bypassed"&&d.length===0||s.push({value:a.value,kind:a.kind,tier:m,holders:c.sort(f_),literals:d.sort(f_),files:l.size,count:a.sites.length})}return s.sort((a,l)=>m_(a.tier)-m_(l.tier)||l.files-a.files||l.count-a.count||T(a.value,l.value)),{duplications:s,families:nA(s)}}function f_(e,t){return T(e.file,t.file)||e.line-t.line}function m_(e){return e==="competing"?0:e==="bypassed"?1:2}function nA(e){let t=new Map;for(let r of e){if(r.kind!=="string"||!GM.test(r.value))continue;let o=rA(r.value);if(!o)continue;let s=t.get(o);s?s.push(r):t.set(o,[r])}let n=[];for(let[r,o]of t){if(o.lengtho.files-r.files||o.count-r.count||T(r.prefix,o.prefix)),n}function rA(e){let t=e.startsWith("/")?e.slice(1):e,n=t.search(/[/:]/);if(n<=0)return;let r=(e.startsWith("/")?"/":"")+t.slice(0,n);return r.length>=VM?r:void 0}var p_,d_,WM,BM,UM,zM,GM,qM,VM,JM,YM,QM,u_,Us=H(()=>{"use strict";$();dr();ce();p_=24,d_={minFiles:2,minCount:3},WM=new Set(["const","constant","variable","enum","enumerator","property","field","static"]),BM=12,UM=6,zM=/[/:._-]/;GM=/^[/@a-z0-9][\w./:@-]*$/i,qM=2,VM=4,JM=/^\s*(?:async\b|function\b|\(|[A-Za-z_$][\w$]*\s*(?:=>|$))/;YM=/(?:^|\/)\.github\/workflows\//,QM=new Set(["package.json","pyproject.toml","composer.json","go.mod"]),u_=e=>e.slice(e.lastIndexOf("/")+1)});function sA(e,t={}){return jn(Rt(e,t),t)}function jn(e,t={}){let n=cn(e),{modules:r,moduleOf:o}=uu(e),s=Bu(e,n,r,o,t.meta),a=rf(s.modules,s.moduleEdges,t.previousCommunities);for(let m of s.modules){let p=a.get(m.slug);p!==void 0&&(m.community=p)}let l=Iu(s),c=Yi(s);for(let m of s.files)c.testFiles.has(m.rel)&&(m.testFile=!0);for(let m of s.modules){let p=c.testedByModule.get(m.slug);p?.length&&(m.testedBy=p)}let d=kl(s);d.length&&(s.surprises=d);let{duplications:u}=Dn(e);u.length&&(s.literalDuplications=u.slice(0,p_));let f=mu(e,cl(e),t.meta?.schemaVersion);return l.length?{scan:e,graph:s,symbols:f,notes:l}:{scan:e,graph:s,symbols:f}}var Rl=H(()=>{"use strict";$();Ut();gt();Ms();dl();sf();Qi();dr();of();Us();Hi()});function lA(e){let t=!1;for(let n=0;n`\`\\${a}\` is not JavaScript regex syntax (the pattern dialect)${g_[o]?`: ${g_[o]}`:""}`;if(o==="<"||o===">")return s(o);if(!/[A-Za-z0-9]/.test(o))continue;if(!aA.has(o))return s(o);if(o==="x"&&!/^[0-9A-Fa-f]{2}/.test(e.slice(n+1))||o==="u"&&!/^[0-9A-Fa-f]{4}/.test(e.slice(n+1)))return s(e.slice(n,n+2));if(o==="c"&&!/^[A-Za-z]/.test(e.slice(n+1)))return s("c");if(o==="k"&&e[n+1]!=="<")return s("k");continue}if(t){if(r==="]")t=!1;else{if(r==="["&&/^\[:\^?[a-z]+:\]/.test(e.slice(n)))return"POSIX classes like [[:alpha:]] are not JavaScript regex syntax (the pattern dialect): use [A-Za-z] or \\p{L}";if((r==="&"||r==="~")&&e[n+1]===r)return`\`${r}${r}\` inside a class is set syntax in other dialects, a literal in JavaScript: escape it`}continue}r==="["&&(t=!0,e[n+1]==="^"&&n++,e[n+1]==="]"&&n++)}}function df(e,t=!1){let n=t?"i":"";try{return new RegExp(e,`u${n}`)}catch{let r=new RegExp(e,n),o=lA(e);if(o)throw new SyntaxError(`Invalid regular expression: /${e}/: ${o}`);return r}}function cA(e){let t=e.source,n=e.flags.includes("u"),r="",o=!1,s=!1;for(let a=0;a=55296&&u<=57343)return;r+=`\\u{${u.toString(16)}}`,a+=d[0].length}else if(c==="p"||c==="P"){if(!n)return;let d=/^\{[^}]*\}/.exec(t.slice(a+1));if(!d)return;r+=`\\${c}${d[0]}`,a+=d[0].length}else{if(/[A-Za-z0-9]/.test(c))return;c.charCodeAt(0)>127?r+=c:r+=`\\${c}`}continue}if(o){if(l==="]"){if(s)return;o=!1,r+=l}else l==="["||l==="&"||l==="~"||l==="-"&&t[a-1]==="-"?r+=`\\${l}`:r+=l;s=!1;continue}if(l==="[")o=!0,s=!0,r+=l,t[a+1]==="^"&&(r+=t[++a]);else if(l===".")r+="[^\\n\\r\\u{2028}\\u{2029}]";else if(l==="{"){let c=/^\{\d+(?:,\d*)?\}/.exec(t.slice(a));c?(r+=c[0],a+=c[0].length-1):r+="\\{"}else if(l==="}"||l==="]")r+=`\\${l}`;else if(l==="("&&t[a+1]==="?"){let c=/^\(\?(?::|<[A-Za-z_][A-Za-z0-9_]*>)/.exec(t.slice(a));if(!c)return;r+=c[0],a+=c[0].length-1}else r+=l}return o?void 0:r}function dA(e,t){let n=Op(t.globs?.map(o=>o.replace(/^(!?)\//,"$1"))),r=uA(e,t.scope);return r?n?o=>r(o)&&n(o):r:n}function uA(e,t){if(!t)return null;let n=nr(e,t);if(n===".."||n.startsWith("../")||Pe(n))throw new Error(`--scope is outside the repository: ${t}`);return n===""?null:It([n,`${n}/**`])}function uf(e,t,n){if(e.length<=n)return e;let r=Math.max(0,Math.min(t-(n>>2),e.length-n)),o=r+n,s=a=>{let l=e.charCodeAt(a);return l>=56320&&l<=57343};return r>0&&s(r)&&r++,o0?"\u2026":"")+e.slice(r,o)+(oT(t.file,n.file)||t.line-n.line)}function mA(e){let t=["--no-config","--no-messages","--color=never","--hidden","--no-require-git","--no-ignore-global","--no-ignore-parent","--no-ignore-dot","--max-filesize",String(e.maxFileBytes??oA)];e.gitignore===!1&&t.push("--no-ignore-vcs");let n=e.ignoreDirs?new Set([".git",...e.ignoreDirs]):Cn;for(let r of[...n].sort(T))t.push("--glob",`!**/${fA(r)}/**`);t.push("--glob","!**/.codeindex-edit-*/**"),t.push("--glob","!**/.codeindex/**");for(let r of na)t.push("--iglob",`!**/${r}`);for(let r of ra)t.push("--iglob",`!**/*${r}`);t.push("--glob","!*.min.js","--glob","!*.min.css");for(let r of e.globs??[]){let o=r.slice(1).replace(/^\//,"");r.startsWith("!")&&o.endsWith("/**")&&!/[{}[\]\\!]/.test(o)&&t.push("--glob",`!/${o}`)}return e.ignoreCase&&t.push("--ignore-case"),t}function pA(e,t,n,r,o){let s=mA(n),a=$e("rg",[...s,"--files-with-matches","--null","--regexp",t,"./"],{cwd:e,maxBufferBytes:y_});if(a.missing)return;if(a.errorCode||a.status!==0&&a.status!==1&&!a.stdout){let p=a.stderr.split(` -`).map(_=>_.trim()).filter(Boolean),g=p.find(_=>/^error:/.test(_))??p[0]??a.errorCode??`exit ${a.status}`;return{fallback:`${/regex parse error|error parsing|not allowed|impossible to match/i.test(a.stderr)?"ripgrep rejected the pattern":"ripgrep failed"} (${g}); searched with the slower JavaScript engine`}}let l=a.stdout.split("\0").filter(Boolean).map(p=>p.replace(/^\.\//,"")).filter(p=>!r||r(p)).sort(T),c=o+1,d=[],u=[],f=(p,g)=>{let h=$e("rg",["--no-config","--no-messages","--json",...n.ignoreCase?["--ignore-case"]:[],"--max-count",String(n.filesWithMatches?1:g),"--regexp",t,"--",...p.map(_=>`./${_}`)],{cwd:e,maxBufferBytes:y_});if(h.errorCode==="ENOBUFS"&&p.length>1){let _=p.length>>1;f(p.slice(0,_),g),f(p.slice(_),g);return}h.errorCode&&u.push(`ripgrep could not search ${p.length===1?p[0]:`${p.length} files`} (${h.errorCode})`);for(let _ of h.stdout.split(` -`)){if(!_.startsWith('{"type":"match"'))continue;let y=JSON.parse(_).data,b=y.lines.text!==void 0?W.from(y.lines.text,"utf8"):W.from(y.lines.bytes??"","base64"),S=y.path.text??W.from(y.path.bytes??"","base64").toString("utf8"),k=b.toString("utf8").replace(/\n$/,""),R=b.subarray(0,y.submatches[0]?.start??0).toString("utf8").length;d.push({file:S.replace(/^\.\//,""),line:y.line_number,col:R+1,text:uf(k,R,b_)})}},m=F.platform==="win32"?24e3:512e3;for(let p=0,g=64;pm&&h>p));h++);f(l.slice(p,h),c-d.length),p=h}return w_(d),{hits:d.slice(0,o),filesMatched:l.length,truncated:d.length>o,notes:u}}function x_(e,t){let n=new RegExp(e.source,e.flags),r=s=>{let a=s.length;if(a>=2&&s[0]===255&&s[1]===254)return s.subarray(2,2+(a-2&-2)).toString("utf16le");if(a>=2&&s[0]===254&&s[1]===255){let l=W.from(s.subarray(2,2+(a-2&-2)));return l.swap16(),l.toString("utf16le")}if(a>=3&&s[0]===239&&s[1]===187&&s[2]===191)return s.subarray(3).toString("utf8");if(!s.includes(0))return s.toString("utf8")},o=0;for(let s=0;se.deadline){t.emit({stoppedAt:s});return}t.progress(s);let a;try{a=r(t.readFile(e.files[s][1]))}catch{a=void 0}if(!a)continue;let l=a.split(` +`),Yy(t)}function rf(e,t){try{return oe(vl(e,t),"utf8")}catch{return}}function sf(e,t){let n=vl(e,t);try{$e(n)}catch{return!1}return et(n),!0}function of(e){let t;try{t=nf(e,[])}catch{return[]}let n=[],r=(o,s)=>{let a;try{a=Yn(o,{withFileTypes:!0})}catch{return}for(let l of a)if(!l.isSymbolicLink()){if(l.isDirectory())r(j(o,l.name),s?`${s}/${l.name}`:l.name);else if(l.isFile()&&l.name.endsWith(".md")){let c=s?`${s}/${l.name.slice(0,-3)}`:l.name.slice(0,-3);try{nf(e,`${c}.md`.split("/")),n.push(c)}catch{}}}};return r(t,""),n.sort()}var hC,Rl=z(()=>{"use strict";$();Re();ge();hC=[".codeindex","memories"]});function vn(e,t,n){let r=se(e);if(!r)return;let o;try{o=JSON.parse(r)}catch(s){if(o=Wr(r),o===void 0){if(t&&n){let a=String(s instanceof Error?s.message:s).split(` +`)[0];n.push(`malformed ${t}: ${a}`)}return}}if(o&&typeof o=="object"&&!Array.isArray(o))return o;t&&n&&n.push(`malformed ${t}: not a JSON object`)}function gn(e,t){let n=new RegExp(`^\\[${Ct(t)}\\]\\s*$([\\s\\S]*?)(?=^\\[|$(?![\\s\\S]))`,"m"),r=e.match(n);return r?r[1]:null}function ho(e,t){let n=e.match(new RegExp(`${Ct(t)}\\s*=\\s*\\[([^\\]]*)\\]`));return n?n[1].split(/\r?\n/).map(r=>r.replace(/#.*$/,"")).join(` +`).split(",").map(r=>r.trim().replace(/^["']|["']$/g,"")).filter(Boolean):[]}function Qt(e,t){return e?.match(new RegExp(`^\\s*${Ct(t)}\\s*=\\s*["']([^"']+)["']`,"m"))?.[1]}function cf(e){let t="";for(let n=0;nyC(e,t,n,r),s=()=>_C(e,t),a=()=>bC(e,t),l=()=>wC(e,t),c=()=>xC(e,t),d=()=>SC(e,t,r),u=()=>kC(e,t,r),m=n==="go"?[a,o,s,l,c,d,u]:n==="uv"?[c,o,s,a,l,d,u]:n==="composer"?[d,o,c,s,a,l,u]:n==="gradle"?[o,l,s,a,c,d,u,()=>EC(e,t)]:[o,s,a,l,c,d,u];for(let p of m){let g=p();if(g)return g}}function e_(e){return e.replace(/[\s\S]*?<\/parent>/g,"").replace(/[\s\S]*?<\/dependencies>/g,"").match(/\s*([^<]+?)\s*<\/artifactId>/)?.[1]}function qs(e,t,n,r,o){let s=t.replace(/^\.\//,"").replace(/\/+$/,"");if(!s||s==="."||n.has(s)||s.split("/").includes(".."))return;let a=vC(e,s,r,o);a&&n.set(s,a)}function RC(e,t){try{return $e(j(e,t)).isDirectory()}catch{return!1}}function t_(e,t){let n;try{n=Yn(t?j(e,t):e,{withFileTypes:!0})}catch{return[]}return n.filter(r=>r.isDirectory()&&!r.name.startsWith(".")&&!Qy.has(r.name)).map(r=>t?`${t}/${r.name}`:r.name).sort(T)}function n_(e,t,n,r){if(!(n>lf))for(let o of t_(e,t))r.push(o),n_(e,o,n+1,r)}function CC(e,t){let n=t.split("/").filter(o=>o&&o!==".");if(n.includes(".."))return[];let r=[""];for(let o of n){let s=new Set;if(o==="**")for(let a of r){a&&s.add(a);let l=[];n_(e,a,0,l);for(let c of l)s.add(c)}else if(o.includes("*")){let a=new RegExp(`^${o.split("*").map(Ct).join("[^/]*")}$`);for(let l of r)for(let c of t_(e,l))a.test(c.split("/").pop())&&s.add(c)}else for(let a of r){let l=a?`${a}/${o}`:o;RC(e,l)&&s.add(l)}if(r=[...s],!r.length)return[]}return r.filter(Boolean)}function Cl(e,t,n,r,o){let s=t.replace(/^\.\//,"").replace(/\/+$/,"");if(s){if(!s.includes("*")){qs(e,s,n,r,o);return}for(let a of CC(e,s))qs(e,a,n,r,o)}}function MC(e,t){let n=[],r=[],o=(l,c)=>{let d=l.trim();d&&(d.startsWith("!")?r.push(d.slice(1)):n.push({pattern:d,kind:c}))},a=vn(j(e,"package.json"),"package.json",t)?.workspaces;if(Array.isArray(a))for(let l of a)typeof l=="string"&&o(l,"npm");else if(a&&typeof a=="object"&&Array.isArray(a.packages))for(let l of a.packages)typeof l=="string"&&o(l,"npm");for(let l of IC(se(j(e,"pnpm-workspace.yaml"))))o(l,"pnpm");return{positives:n,negations:r}}function af(e){let t="";for(let n=0;ntypeof o=="string").map(o=>({pattern:o,kind:"lerna"}));let r=vn(j(e,"nx.json"),"nx.json",t);if(r){let o=r.workspaceLayout??{},s=typeof o.appsDir=="string"?o.appsDir:"apps",a=typeof o.libsDir=="string"?o.libsDir:"libs";return[...new Set([s,a])].map(l=>({pattern:`${l}/*`,kind:"nx"}))}return[]}function TC(e,t,n){let r=se(j(e,"Cargo.toml"));if(!r)return;let o=gn(r,"workspace");if(!o)return;let s=ho(o,"members");if(!s.length)return;let a=ho(o,"exclude").map(cf),l=new Map;for(let c of s)Cl(e,c,l,"cargo",n);for(let[c,d]of l)a.some(u=>u.test(c))||t.has(c)||t.set(c,d)}function r_(e,t,n,r){let o;try{o=Yn(t?j(e,t):e,{withFileTypes:!0})}catch{return}if(t&&o.some(a=>a.name==="go.mod"&&!a.isDirectory())&&r.push(t),n>lf)return;let s=o.filter(a=>a.isDirectory()&&!/^[._]/.test(a.name)&&!Qy.has(a.name)&&!FC.has(a.name)).map(a=>a.name).sort(T);for(let a of s)r_(e,t?`${t}/${a}`:a,n+1,r)}function OC(e,t,n){let r=se(j(e,"go.work"));if(!r){if(Q(j(e,"go.work")))return;let s=[];r_(e,"",0,s);for(let a of s)qs(e,a,t,"go",n);return}let o=[];for(let s of r.matchAll(/^use\s*\(([\s\S]*?)\)/gm))for(let a of s[1].split(/\r?\n/)){let l=a.replace(/\/\/.*$/,"").trim();l&&o.push(l)}for(let s of r.matchAll(/^use\s+([^\s(]+)/gm))o.push(s[1]);for(let s of o)s==="."||s==="./"||qs(e,s,t,"go",n)}function NC(e,t,n){let r=new Set,o=(s,a)=>{if(a>lf||r.has(s))return;r.add(s);let l=se(j(e,s,"pom.xml")).replace(//g,"");for(let c of l.matchAll(/([\s\S]*?)<\/modules>/g))for(let d of c[1].matchAll(/\s*([^<]+?)\s*<\/module>/g)){let u=d[1].endsWith(".xml")?V.dirname(d[1]):d[1],f=V.normalize(V.join(s||".",u)).replace(/\/+$/,"");f==="."||f===".."||f.startsWith("../")||(qs(e,f,t,"maven",n),o(f,a+1))}};o("",0)}function PC(e,t,n){let r=se(j(e,"pyproject.toml"));if(!r)return;let o=gn(r,"tool.uv.workspace");if(!o)return;let s=ho(o,"members");if(!s.length)return;let a=ho(o,"exclude").map(cf),l=new Map;for(let c of s)Cl(e,c,l,"uv",n);for(let[c,d]of l)a.some(u=>u.test(c))||t.has(c)||t.set(c,d)}function LC(e,t,n){let o=vn(j(e,"composer.json"),"composer.json",n)?.repositories;if(Array.isArray(o))for(let s of o){if(!s||typeof s!="object")continue;let{type:a,url:l}=s;a==="path"&&typeof l=="string"&&l&&Cl(e,l,t,"composer",n)}}function DC(e,t,n){for(let r of["settings.gradle","settings.gradle.kts"]){let o=se(j(e,r));if(!o)continue;let s=o.replace(/\/\*[\s\S]*?\*\//g,"").replace(/(^|[^:])\/\/.*$/gm,"$1");for(let a of s.matchAll(/^[ \t]*include\b[ \t]*(\([^)]*\)|(?:[^\n]*,[ \t]*\r?\n)*[^\n]*)/gm))for(let l of a[1].matchAll(/["']([^"']+)["']/g)){let c=l[1].replace(/^:/,"").replace(/:/g,"/");c&&qs(e,c,t,"gradle",n)}}}function jC(e,t,n,r){let o=vn(j(e,t.dir,"package.json"),`${t.dir}/package.json`,r);if(!o)return[];let s=new Set;for(let a of["dependencies","devDependencies","peerDependencies"]){let l=o[a];if(!(!l||typeof l!="object"))for(let c of Object.keys(l))c!==t.name&&n.has(c)&&s.add(c)}return[...s]}function s_(e,t){let n=`${e}/${t}`.split("/"),r=[];for(let o of n)!o||o==="."||(o===".."?r.pop():r.push(o));return r.join("/")}function WC(e,t,n,r){let o=se(j(e,t.dir,"Cargo.toml"));if(!o)return[];let s=new Set;for(let a of["dependencies","dev-dependencies","build-dependencies"]){let l=gn(o,a);if(l)for(let c of l.split(/\r?\n/)){let d=c.match(/^\s*([A-Za-z0-9_-]+)\s*=\s*(.+)$/);if(!d)continue;let u=d[1];if(u!==t.name&&n.has(u)){s.add(u);continue}let f=d[2].match(/path\s*=\s*["']([^"']+)["']/);if(f){let m=r.get(s_(t.dir,f[1]));m&&m!==t.name&&s.add(m)}}}return[...s]}function BC(e,t,n,r){let o=se(j(e,t.dir,"go.mod"));if(!o)return[];let s=new Set;for(let a of o.matchAll(/^\s*(?:require\s+)?([^\s/(][^\s]*)\s+v[^\s]+/gm)){let l=a[1];l!==t.name&&n.has(l)&&s.add(l)}for(let a of o.matchAll(/^\s*(?:replace\s+)?(\S+)(?:\s+\S+)?\s*=>\s*(\.\.?\/\S+)/gm)){let l=r.get(s_(t.dir,a[2]));l&&l!==t.name&&s.add(l)}return[...s]}function UC(e,t,n){let r=se(j(e,t.dir,"pom.xml"));if(!r)return[];let o=new Set;for(let s of r.replace(/[\s\S]*?<\/parent>/g,"").matchAll(/([\s\S]*?)<\/dependency>/g)){let a=s[1].match(/\s*([^<]+?)\s*<\/artifactId>/)?.[1];a&&a!==t.name&&n.has(a)&&o.add(a)}return[...o]}function zC(e,t,n){let r=se(j(e,t.dir,"pyproject.toml"));if(!r)return[];let o=new Set,s=gn(r,"project");if(s)for(let l of ho(s,"dependencies")){let c=l.match(/^[A-Za-z0-9_.-]+/)?.[0];c&&c!==t.name&&n.has(c)&&o.add(c)}let a=gn(r,"tool.uv.sources");if(a)for(let l of a.split(/\r?\n/)){let c=l.match(/^\s*([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*workspace\s*=\s*true/);c&&c[1]!==t.name&&n.has(c[1])&&o.add(c[1])}return[...o]}function HC(e,t,n,r){let o=vn(j(e,t.dir,"composer.json"),`${t.dir}/composer.json`,r);if(!o)return[];let s=new Set;for(let a of["require","require-dev"]){let l=o[a];if(!(!l||typeof l!="object"))for(let c of Object.keys(l))c!==t.name&&n.has(c)&&s.add(c)}return[...s]}function GC(e){return e.split("/").map(t=>t.replace(/[-_]+([A-Za-z0-9])/g,(n,r)=>r.toUpperCase())).join(".")}function qC(e,t,n,r,o){for(let s of["build.gradle","build.gradle.kts"]){let a=se(j(e,t.dir,s));if(!a)continue;let l=new Set;for(let c of a.matchAll(/project\s*\(\s*(?:path\s*[:=]\s*)?["']:?([^"']+)["']/g)){let d=c[1].replace(/:/g,"/"),u=r.get(d)??(n.has(d)?d:void 0);u&&u!==t.name&&l.add(u)}for(let c of a.matchAll(/\bprojects((?:\.[A-Za-z_]\w*)+)/g)){let d=c[1].slice(1).split(".");for(let u=d.length;u>0;u--){let f=o.get(d.slice(0,u).join("."));if(f){f!==t.name&&l.add(f);break}}}return[...l]}return[]}function VC(e,t,n,r,o,s){switch(t.kind){case"cargo":return WC(e,t,n,r);case"go":return BC(e,t,n,r);case"maven":return UC(e,t,n);case"uv":return zC(e,t,n);case"composer":return HC(e,t,n,s);case"gradle":return qC(e,t,n,r,o);default:return jC(e,t,n,s)}}function JC(e){let t=new Map(e.map(s=>[s.name,[...s.dependsOn??[]].sort(T)])),n=new Map,r=[],o=s=>{n.set(s,"visiting"),r.push(s);for(let a of t.get(s)??[])if(t.has(a)){if(n.get(a)==="visiting")return[...r.slice(r.indexOf(a)),a];if(!n.has(a)){let l=o(a);if(l)return l}}return r.pop(),n.set(s,"done"),null};for(let s of[...t.keys()].sort(T))if(!n.has(s)){let a=o(s);if(a)return a}}function KC(e){let t=new Map(e.map(r=>[r.name,new Set(r.dependsOn??[])])),n=[];for(;t.size>0;){let r=[...t.entries()].filter(([,o])=>[...o].every(s=>!t.has(s))).map(([o])=>o).sort(T);if(!r.length){n.push(...[...t.keys()].sort(T));break}for(let o of r)n.push(o),t.delete(o)}return n}function jn(e){let t=[],n=new Map,{positives:r,negations:o}=MC(e,t),s=r.length?r:$C(e,t);if(s.length){let f=new Map;for(let{pattern:p,kind:g}of s)Cl(e,p,f,g,t);let m=o.map(cf);for(let[p,g]of f)m.some(h=>h.test(p))||n.set(p,g)}TC(e,n,t),OC(e,n,t),NC(e,n,t),PC(e,n,t),LC(e,n,t),DC(e,n,t);let a=[...n.values()].sort((f,m)=>T(f.dir,m.dir)),l=new Set(a.map(f=>f.name)),c=new Map(a.map(f=>[f.dir,f.name])),d=new Map(a.map(f=>[GC(f.dir),f.name]));for(let f of a){let m=VC(e,f,l,c,d,t);m.length&&(f.dependsOn=m.sort(T))}let u=[...a].sort((f,m)=>m.dir.length-f.dir.length);return{packages:a,cycle:JC(a),topoOrder:KC(a),warnings:[...new Set(t)].sort(T),packageOf:f=>u.find(m=>f===m.dir||f.startsWith(m.dir+"/"))}}function XC(e){return e.replace(/<(parent|dependencies|dependencyManagement|build|profiles|reporting)>[\s\S]*?<\/\1>/g,"").match(/\s*([^<]+?)\s*<\/version>/)?.[1]}function i_(e,t,n){let r=j(e,t,n),o=se(r);if(!o)return;let s=l=>typeof l=="string"&&l.trim()?l.trim():void 0,a=(l,c,d)=>c?{manager:l,name:c,...d?{version:d}:{}}:void 0;switch(n){case"package.json":case"composer.json":{let l=vn(r);return a(n==="package.json"?"npm":"composer",s(l?.name),s(l?.version))}case"go.mod":return a("gomod",o.match(/^module\s+"?([^\s"]+)/m)?.[1],void 0);case"Cargo.toml":{let l=gn(o,"package");return a("cargo",Qt(l,"name"),Qt(l,"version"))}case"pyproject.toml":{let l=gn(o,"project"),c=gn(o,"tool.poetry");return a("python",Qt(l,"name")??Qt(c,"name"),Qt(l,"version")??Qt(c,"version"))}case"pom.xml":return a("maven",e_(o),XC(o));default:return}}function Ml(e,t){let n=new Map;for(let a of t.fileEdges){if(a.kind!=="import"||a.dangling)continue;let l=e.packageOf(a.from),c=e.packageOf(a.to);if(!l||!c||l===c)continue;let d=`${l.name}\0${c.name}`,u=n.get(d);u||n.set(d,u={from:l,to:c,files:new Set}),u.files.add(a.from)}let r=[];for(let{from:a,to:l,files:c}of n.values()){if(ZC.has(a.kind)||a.dependsOn?.includes(l.name))continue;let d=[...c].sort(T);r.push({from:a.name,to:l.name,files:d.length,example:d[0]})}let o=[];for(let a of e.packages)if(YC.has(a.kind))for(let l of a.dependsOn??[])n.has(`${a.name}\0${l}`)||o.push({from:a.name,to:l});let s=(a,l)=>T(a.from,l.from)||T(a.to,l.to);return{ok:r.length===0,undeclared:r.sort(s),unusedDeclared:o.sort(s)}}function Al(e,t){let n={packages:e.packages,cycle:e.cycle??null,topoOrder:e.topoOrder};return e.warnings.length&&(n.warnings=e.warnings),t&&(n.check=t),n}var Qy,lf,AC,FC,ZC,YC,Zr=z(()=>{"use strict";$();Re();ge();nt();On();de();it();Qy=new Set(["node_modules",".git","dist","build","target","coverage"]),lf=4;AC=e=>e.trim().replace(/^(["'])(.*)\1$/,"$2").trim();FC=new Set(["vendor","testdata","fixtures","__fixtures__"]);ZC=new Set(["nx"]),YC=new Set(["npm","pnpm","lerna","cargo","go"])});function QC(e,t){return e.modules.find(n=>n.slug===t)?.community}function iM(e,t){let n=e.length,r=new Map(e.map((l,c)=>[l,c])),o=Array.from({length:n},()=>new Map);for(let l of t){if(l.dangling)continue;let c=r.get(l.from),d=r.get(l.to);c===void 0||d===void 0||c===d||(o[c].set(d,(o[c].get(d)??0)+l.weight),o[d].set(c,(o[d].get(c)??0)+l.weight))}let s=o.map(l=>{let c=0;for(let d of l.values())c+=d;return c}),a=s.reduce((l,c)=>l+c,0);return{n,adj:o,k:s,twoM:a}}function df(e){let t=new Map,n=new Array(e.length);for(let r=0;ru);if(o===0)return df(s);let a=r.slice(),l=!0,c=0;for(;l&&ch-_)){if(g===u)continue;let h=f.get(g)-o_*r[d]*a[g]/o;h>p+nM&&(p=h,m=g)}a[m]+=r[d],m!==u&&(s[d]=m,l=!0)}}return df(s)}function aM(e,t,n){let r=Array.from({length:n},()=>new Map);for(let a=0;a{let l=0;for(let c of a.values())l+=c;return l}),s=o.reduce((a,l)=>a+l,0);return{n,adj:r,k:o,twoM:s}}function a_(e){if(e.n===0)return[];let t=e,n=Array.from({length:e.n},(r,o)=>o);for(let r=0;rn&&n.length>0)}function lM(e,t){let n=t.length,r=new Map;t.forEach((c,d)=>r.set(c,d));let o=Array.from({length:n},()=>new Map);for(let c=0;c{let d=0;for(let u of c.values())d+=u;return d}),a=s.reduce((c,d)=>c+d,0),l=a_({n,adj:o,k:s,twoM:a});return l_(l).map(c=>c.map(d=>t[d]))}function cM(e,t,n){let r=[];for(let o of e){if(o.length>rM*n&&o.length>=sM){let s=lM(t,o);if(s.length>1){r.push(...s);continue}}r.push(o)}return r}function dM(e,t){if(e.length!==t.length)return t.length-e.length;for(let n=0;n({id:Number(f),set:new Set(m)})),s=[];e.forEach((f,m)=>{for(let p of o){let g=0;for(let h of f)p.set.has(h)&&g++;g>0&&s.push({ni:m,prevId:p.id,inter:g})}}),s.sort((f,m)=>m.inter-f.inter||f.ni-m.ni||f.prevId-m.prevId);let a=new Map,l=new Set;for(let f of s)a.has(f.ni)||l.has(f.prevId)||(a.set(f.ni,f.prevId),l.add(f.prevId));let c=new Set;for(let f=0;f=0&&mu.slug).sort(T),s=iM(o,t),a=a_(s),c=cM(l_(a),s,o.length).map(u=>u.map(f=>o[f]).sort(T));c.sort(dM);let d=uM(c,n);return c.forEach((u,f)=>{for(let m of u)r.set(m,d[f])}),r}var o_,eM,tM,nM,rM,sM,ff=z(()=>{"use strict";$();de();o_=1,eM=20,tM=10,nM=1e-12,rM=.25,sM=10});function Il(e){let t=new Map,n=new Map;for(let a of e.modules)a.community!==void 0&&t.set(a.slug,a.community),n.set(a.slug,a.tier);let r=new Map,o=(a,l)=>ar.get(o(a.comms[0],a.comms[1]))<=mM).map(a=>({from:a.edge.from,to:a.edge.to,kind:a.edge.kind,weight:a.edge.weight,communities:a.comms,pairEdges:r.get(o(a.comms[0],a.comms[1]))})).sort((a,l)=>a.pairEdges-l.pairEdges||T(a.from,l.from)||T(a.to,l.to)).slice(0,fM)}function gM(e,t,n){return(e.surprises??Il(e)).some(o=>o.from===t&&o.to===n)}var fM,mM,pM,mf=z(()=>{"use strict";$();de();Vr();fM=24,mM=2,pM=Ls});function hM(e){let t={};for(let n of Object.keys(e).sort(T))t[n]=e[n];return t}function Yr(e){let t={...e,languages:hM(e.languages)};return JSON.stringify(t,null,2)+` +`}var $l=z(()=>{"use strict";$();de()});function nA(e,t){return t!=="string"?!0:e.length>=eA||tA.test(e)}function aA(e){if(!e)return!1;for(let t=0;t")&&!"=!<>+-*/%&|^".includes(e[t-1]??""))return oA.test(e.slice(t+1));return!1}function lA(e){let t=[];for(let n of e)YM.has(n.kind)&&(aA(n.signature)||(n.endLine??n.line)-n.line>QM||t.push(n));return t}function cA(e){return`${e.file.endsWith(".go")&&e.file.includes("/")?e.file.slice(0,e.file.lastIndexOf("/")):e.file}\0${e.holder}`}function fA(e){if(e.every(n=>dA.test(n.file)))return!0;let t=w_(e[0].file);return uA.has(t)&&e.every(n=>w_(n.file)===t)}function mA(e,t){let n;for(let r of e){let o=r.endLine??r.line;to||(!n||r.line>n.line)&&(n=r)}return n}function Bn(e,t={}){let n=t.minFiles??b_.minFiles,r=t.minCount??b_.minCount,o=new Map;for(let a of e.files){if(!a.literals?.length||!t.includeTests&&Wt(a.rel))continue;let l;for(let c of a.literals){if(t.kinds&&!t.kinds.has(c.kind)||!nA(c.value,c.kind))continue;let d=`${c.kind}\0${c.value}`,u=o.get(d);u||o.set(d,u={value:c.value,kind:c.kind,sites:[]});let f=mA(l??=lA(a.symbols),c.line);u.sites.push(f?{file:a.rel,line:c.line,holder:f.name,holderExported:f.exported}:{file:a.rel,line:c.line})}}let s=[];for(let a of o.values()){let l=new Set(a.sites.map(p=>p.file));if(l.sizep.holder),d=a.sites.filter(p=>!p.holder),u=new Set(c.map(p=>p.holder)),m=new Set(c.map(cA)).size>=2?"competing":c.length>0?"bypassed":"uncentralized";if(a.kind==="number"){if(u.size!==1||d.length===0)continue;m="bypassed"}m==="bypassed"&&d.length===0||s.push({value:a.value,kind:a.kind,tier:m,holders:c.sort(x_),literals:d.sort(x_),files:l.size,count:a.sites.length})}return s.sort((a,l)=>S_(a.tier)-S_(l.tier)||l.files-a.files||l.count-a.count||T(a.value,l.value)),{duplications:s,families:pA(s)}}function x_(e,t){return T(e.file,t.file)||e.line-t.line}function S_(e){return e==="competing"?0:e==="bypassed"?1:2}function pA(e){let t=new Map;for(let r of e){if(r.kind!=="string"||!rA.test(r.value))continue;let o=gA(r.value);if(!o)continue;let s=t.get(o);s?s.push(r):t.set(o,[r])}let n=[];for(let[r,o]of t){if(o.lengtho.files-r.files||o.count-r.count||T(r.prefix,o.prefix)),n}function gA(e){let t=e.startsWith("/")?e.slice(1):e,n=t.search(/[/:]/);if(n<=0)return;let r=(e.startsWith("/")?"/":"")+t.slice(0,n);return r.length>=iA?r:void 0}var k_,b_,YM,QM,eA,tA,rA,sA,iA,oA,dA,uA,w_,Js=z(()=>{"use strict";$();gr();de();k_=24,b_={minFiles:2,minCount:3},YM=new Set(["const","constant","variable","enum","enumerator","property","field","static"]),QM=12,eA=6,tA=/[/:._-]/;rA=/^[/@a-z0-9][\w./:@-]*$/i,sA=2,iA=4,oA=/^\s*(?:async\b|function\b|\(|[A-Za-z_$][\w$]*\s*(?:=>|$))/;dA=/(?:^|\/)\.github\/workflows\//,uA=new Set(["package.json","pyproject.toml","composer.json","go.mod"]),w_=e=>e.slice(e.lastIndexOf("/")+1)});function hA(e,t={}){return Un(Tt(e,t),t)}function Un(e,t={}){let n=pn(e),{modules:r,moduleOf:o}=_u(e),s=Ju(e,n,r,o,t.meta),a=uf(s.modules,s.moduleEdges,t.previousCommunities);for(let m of s.modules){let p=a.get(m.slug);p!==void 0&&(m.community=p)}let l=Lu(s),c=so(s);for(let m of s.files)c.testFiles.has(m.rel)&&(m.testFile=!0);for(let m of s.modules){let p=c.testedByModule.get(m.slug);p?.length&&(m.testedBy=p)}let d=Il(s);d.length&&(s.surprises=d);let{duplications:u}=Bn(e);u.length&&(s.literalDuplications=u.slice(0,k_));let f=wu(e,hl(e),t.meta?.schemaVersion);return l.length?{scan:e,graph:s,symbols:f,notes:l}:{scan:e,graph:s,symbols:f}}var Fl=z(()=>{"use strict";$();Jt();St();Os();yl();ff();io();gr();mf();Js();Xi()});function wA(e){let t=!1;for(let n=0;n`\`\\${a}\` is not JavaScript regex syntax (the pattern dialect)${E_[o]?`: ${E_[o]}`:""}`;if(o==="<"||o===">")return s(o);if(!/[A-Za-z0-9]/.test(o))continue;if(!bA.has(o))return s(o);if(o==="x"&&!/^[0-9A-Fa-f]{2}/.test(e.slice(n+1))||o==="u"&&!/^[0-9A-Fa-f]{4}/.test(e.slice(n+1)))return s(e.slice(n,n+2));if(o==="c"&&!/^[A-Za-z]/.test(e.slice(n+1)))return s("c");if(o==="k"&&e[n+1]!=="<")return s("k");continue}if(t){if(r==="]")t=!1;else{if(r==="["&&/^\[:\^?[a-z]+:\]/.test(e.slice(n)))return"POSIX classes like [[:alpha:]] are not JavaScript regex syntax (the pattern dialect): use [A-Za-z] or \\p{L}";if((r==="&"||r==="~")&&e[n+1]===r)return`\`${r}${r}\` inside a class is set syntax in other dialects, a literal in JavaScript: escape it`}continue}r==="["&&(t=!0,e[n+1]==="^"&&n++,e[n+1]==="]"&&n++)}}function yf(e,t=!1){let n=t?"i":"";try{return new RegExp(e,`u${n}`)}catch{let r=new RegExp(e,n),o=wA(e);if(o)throw new SyntaxError(`Invalid regular expression: /${e}/: ${o}`);return r}}function xA(e){let t=e.source,n=e.flags.includes("u"),r="",o=!1,s=!1;for(let a=0;a=55296&&u<=57343)return;r+=`\\u{${u.toString(16)}}`,a+=d[0].length}else if(c==="p"||c==="P"){if(!n)return;let d=/^\{[^}]*\}/.exec(t.slice(a+1));if(!d)return;r+=`\\${c}${d[0]}`,a+=d[0].length}else{if(/[A-Za-z0-9]/.test(c))return;c.charCodeAt(0)>127?r+=c:r+=`\\${c}`}continue}if(o){if(l==="]"){if(s)return;o=!1,r+=l}else l==="["||l==="&"||l==="~"||l==="-"&&t[a-1]==="-"?r+=`\\${l}`:r+=l;s=!1;continue}if(l==="[")o=!0,s=!0,r+=l,t[a+1]==="^"&&(r+=t[++a]);else if(l===".")r+="[^\\n\\r\\u{2028}\\u{2029}]";else if(l==="{"){let c=/^\{\d+(?:,\d*)?\}/.exec(t.slice(a));c?(r+=c[0],a+=c[0].length-1):r+="\\{"}else if(l==="}"||l==="]")r+=`\\${l}`;else if(l==="("&&t[a+1]==="?"){let c=/^\(\?(?::|<[A-Za-z_][A-Za-z0-9_]*>)/.exec(t.slice(a));if(!c)return;r+=c[0],a+=c[0].length-1}else r+=l}return o?void 0:r}function SA(e,t){let n=Hp(t.globs?.map(o=>o.replace(/^(!?)\//,"$1"))),r=kA(e,t.scope);return r?n?o=>r(o)&&n(o):r:n}function kA(e,t){if(!t)return null;let n=ar(e,t);if(n===".."||n.startsWith("../")||We(n))throw new Error(`--scope is outside the repository: ${t}`);return n===""?null:Lt([n,`${n}/**`])}function _f(e,t,n){if(e.length<=n)return e;let r=Math.max(0,Math.min(t-(n>>2),e.length-n)),o=r+n,s=a=>{let l=e.charCodeAt(a);return l>=56320&&l<=57343};return r>0&&s(r)&&r++,o0?"\u2026":"")+e.slice(r,o)+(oT(t.file,n.file)||t.line-n.line)}function vA(e){let t=["--no-config","--no-messages","--color=never","--hidden","--no-require-git","--no-ignore-global","--no-ignore-parent","--no-ignore-dot","--max-filesize",String(e.maxFileBytes??_A)];e.gitignore===!1&&t.push("--no-ignore-vcs");let n=e.ignoreDirs?new Set([".git",...e.ignoreDirs]):In;for(let r of[...n].sort(T))t.push("--glob",`!**/${EA(r)}/**`);t.push("--glob","!**/.codeindex-edit-*/**"),t.push("--glob","!**/.codeindex/**");for(let r of ca)t.push("--iglob",`!**/${r}`);for(let r of da)t.push("--iglob",`!**/*${r}`);t.push("--glob","!*.min.js","--glob","!*.min.css");for(let r of e.globs??[]){let o=r.slice(1).replace(/^\//,"");r.startsWith("!")&&o.endsWith("/**")&&!/[{}[\]\\!]/.test(o)&&t.push("--glob",`!/${o}`)}return e.ignoreCase&&t.push("--ignore-case"),t}function RA(e,t,n,r,o){let s=vA(n),a=Pe("rg",[...s,"--files-with-matches","--null","--regexp",t,"./"],{cwd:e,maxBufferBytes:R_});if(a.missing)return;if(a.errorCode||a.status!==0&&a.status!==1&&!a.stdout){let p=a.stderr.split(` +`).map(_=>_.trim()).filter(Boolean),g=p.find(_=>/^error:/.test(_))??p[0]??a.errorCode??`exit ${a.status}`;return{fallback:`${/regex parse error|error parsing|not allowed|impossible to match/i.test(a.stderr)?"ripgrep rejected the pattern":"ripgrep failed"} (${g}); searched with the slower JavaScript engine`}}let l=a.stdout.split("\0").filter(Boolean).map(p=>p.replace(/^\.\//,"")).filter(p=>!r||r(p)).sort(T),c=o+1,d=[],u=[],f=(p,g)=>{let h=Pe("rg",["--no-config","--no-messages","--json",...n.ignoreCase?["--ignore-case"]:[],"--max-count",String(n.filesWithMatches?1:g),"--regexp",t,"--",...p.map(_=>`./${_}`)],{cwd:e,maxBufferBytes:R_});if(h.errorCode==="ENOBUFS"&&p.length>1){let _=p.length>>1;f(p.slice(0,_),g),f(p.slice(_),g);return}h.errorCode&&u.push(`ripgrep could not search ${p.length===1?p[0]:`${p.length} files`} (${h.errorCode})`);for(let _ of h.stdout.split(` +`)){if(!_.startsWith('{"type":"match"'))continue;let y=JSON.parse(_).data,b=y.lines.text!==void 0?W.from(y.lines.text,"utf8"):W.from(y.lines.bytes??"","base64"),S=y.path.text??W.from(y.path.bytes??"","base64").toString("utf8"),k=b.toString("utf8").replace(/\n$/,""),C=b.subarray(0,y.submatches[0]?.start??0).toString("utf8").length;d.push({file:S.replace(/^\.\//,""),line:y.line_number,col:C+1,text:_f(k,C,M_)})}},m=F.platform==="win32"?24e3:512e3;for(let p=0,g=64;pm&&h>p));h++);f(l.slice(p,h),c-d.length),p=h}return A_(d),{hits:d.slice(0,o),filesMatched:l.length,truncated:d.length>o,notes:u}}function I_(e,t){let n=new RegExp(e.source,e.flags),r=s=>{let a=s.length;if(a>=2&&s[0]===255&&s[1]===254)return s.subarray(2,2+(a-2&-2)).toString("utf16le");if(a>=2&&s[0]===254&&s[1]===255){let l=W.from(s.subarray(2,2+(a-2&-2)));return l.swap16(),l.toString("utf16le")}if(a>=3&&s[0]===239&&s[1]===187&&s[2]===191)return s.subarray(3).toString("utf8");if(!s.includes(0))return s.toString("utf8")},o=0;for(let s=0;se.deadline){t.emit({stoppedAt:s});return}t.progress(s);let a;try{a=r(t.readFile(e.files[s][1]))}catch{a=void 0}if(!a)continue;let l=a.split(` `);a.endsWith(` -`)&&l.pop();let c=[],d=!1;for(let u=0;u=e.want||(o++,c.push([u+1,f.index+1,t.clip(l[u],f.index,e.textMax)]),e.firstOnly)))break}d&&t.emit({i:s,hits:c})}t.emit({done:!0})}function hA(e,t){let n,r,o;try{o=new Int32Array(new SharedArrayBuffer(8));let s=new Ha;r=s.port1,n=new vs(gA,{eval:!0,workerData:{port:s.port2,sig:o.buffer,job:e},transferList:[s.port2]}),n.unref()}catch{let s;return x_(e,{readFile:a=>ie(a),clip:uf,emit:a=>"stoppedAt"in a?s=a.stoppedAt:t(a),progress:()=>{}}),s===void 0?{}:{stoppedAt:s}}try{for(;;){let s=Atomics.load(o,0),a=void 0;if(a){let c=a.message;if("error"in c)throw new Error(`grep worker failed: ${c.error}`);if("stoppedAt"in c)return{stoppedAt:c.stoppedAt};if("done"in c)return{};t(c);continue}let l=e.deadline-Date.now();if(l<=0){let c=Atomics.load(o,1);for(let d;d=void 0;)"i"in d.message&&d.message.i!r||r(g.rel)).map(g=>[g.rel,g.abs]).sort((g,h)=>T(g[0],h[0])),c={source:t.source,flags:t.flags,files:l,want:o+1,firstOnly:n.filesWithMatches===!0,textMax:b_,deadline:s},d=[],u=0,{stoppedAt:f}=hA(c,g=>{if(!("i"in g))return;u++;let h=l[g.i][0];for(let[_,y,b]of g.hits)d.push({file:h,line:_,col:y,text:b})}),m=[],p=f!==void 0;return p&&m.push(`the JavaScript regex engine ran out of its ${n.timeoutMs??__} ms budget in ${l[f]?.[0]??"the last file"}: hits cover only the ${f} file${f===1?"":"s"} before it in path order \u2014 simplify the pattern, narrow scope/globs, or raise the budget (--timeout-ms)`),{hits:w_(d).slice(0,o),filesMatched:u,truncated:d.length>o,notes:m,timedOut:p}}function zs(e,t,n={}){let r=Date.now()+(n.timeoutMs??__),o=df(t,n.ignoreCase),s=n.maxHits??iA,a=dA(e,n),l=[],c;if(!n.noRipgrep&&Qt("rg")){let d=cA(o),u=d===void 0?void 0:pA(e,d,n,a,s);u&&"fallback"in u?l.push(u.fallback):u?c=u:d===void 0&&l.push("the pattern uses JavaScript-only syntax (lookaround, backreference\u2026); searched with the slower JavaScript engine")}if(c??=yA(e,o,n,a,s,r),l.push(...c.notes),c.truncated){let d=n.filesWithMatches?`${s} matching files by path`:`${s} hits by (file, line)`;l.push(`showing the first ${d}; ${c.filesMatched} files match in all \u2014 raise maxHits (--max-hits) or narrow scope/globs for the rest`)}return{hits:c.hits,truncated:c.truncated,filesMatched:c.filesMatched,timedOut:c.timedOut??!1,notes:l}}function _A(e,t,n={}){return zs(e,t,n).hits}var iA,__,oA,b_,aA,g_,h_,fA,y_,gA,uo=H(()=>{"use strict";$();Xd();ke();me();Ze();_i();et();ce();Ut();iA=200,__=1e4,oA=1024*1024,b_=300,aA=new Set("bBdDwWsSfnrtvcxuk0123456789"),g_={A:"use ^",z:"use $",Z:"use $",Q:"escape the metacharacters instead",E:"escape the metacharacters instead",h:"use [ \\t]",p:"\\p{\u2026} needs a pattern that is otherwise valid with the u flag",P:"\\P{\u2026} needs a pattern that is otherwise valid with the u flag","<":"use \\b",">":"use \\b"};h_={w:"[:word:]",W:"[:^word:]",d:"[:digit:]",D:"[:^digit:]"};fA=e=>e.replace(/[\\*?[\]{}!]/g,t=>`\\${t}`);y_=256*1024*1024;gA=`var __name = (fn) => fn; +`)&&l.pop();let c=[],d=!1;for(let u=0;u=e.want||(o++,c.push([u+1,f.index+1,t.clip(l[u],f.index,e.textMax)]),e.firstOnly)))break}d&&t.emit({i:s,hits:c})}t.emit({done:!0})}function MA(e,t){let n,r,o;try{o=new Int32Array(new SharedArrayBuffer(8));let s=new Za;r=s.port1,n=new $s(CA,{eval:!0,workerData:{port:s.port2,sig:o.buffer,job:e},transferList:[s.port2]}),n.unref()}catch{let s;return I_(e,{readFile:a=>oe(a),clip:_f,emit:a=>"stoppedAt"in a?s=a.stoppedAt:t(a),progress:()=>{}}),s===void 0?{}:{stoppedAt:s}}try{for(;;){let s=Atomics.load(o,0),a=void 0;if(a){let c=a.message;if("error"in c)throw new Error(`grep worker failed: ${c.error}`);if("stoppedAt"in c)return{stoppedAt:c.stoppedAt};if("done"in c)return{};t(c);continue}let l=e.deadline-Date.now();if(l<=0){let c=Atomics.load(o,1);for(let d;d=void 0;)"i"in d.message&&d.message.i!r||r(g.rel)).map(g=>[g.rel,g.abs]).sort((g,h)=>T(g[0],h[0])),c={source:t.source,flags:t.flags,files:l,want:o+1,firstOnly:n.filesWithMatches===!0,textMax:M_,deadline:s},d=[],u=0,{stoppedAt:f}=MA(c,g=>{if(!("i"in g))return;u++;let h=l[g.i][0];for(let[_,y,b]of g.hits)d.push({file:h,line:_,col:y,text:b})}),m=[],p=f!==void 0;return p&&m.push(`the JavaScript regex engine ran out of its ${n.timeoutMs??C_} ms budget in ${l[f]?.[0]??"the last file"}: hits cover only the ${f} file${f===1?"":"s"} before it in path order \u2014 simplify the pattern, narrow scope/globs, or raise the budget (--timeout-ms)`),{hits:A_(d).slice(0,o),filesMatched:u,truncated:d.length>o,notes:m,timedOut:p}}function Ks(e,t,n={}){let r=Date.now()+(n.timeoutMs??C_),o=yf(t,n.ignoreCase),s=n.maxHits??yA,a=SA(e,n),l=[],c;if(!n.noRipgrep&&sn("rg")){let d=xA(o),u=d===void 0?void 0:RA(e,d,n,a,s);u&&"fallback"in u?l.push(u.fallback):u?c=u:d===void 0&&l.push("the pattern uses JavaScript-only syntax (lookaround, backreference\u2026); searched with the slower JavaScript engine")}if(c??=AA(e,o,n,a,s,r),l.push(...c.notes),c.truncated){let d=n.filesWithMatches?`${s} matching files by path`:`${s} hits by (file, line)`;l.push(`showing the first ${d}; ${c.filesMatched} files match in all \u2014 raise maxHits (--max-hits) or narrow scope/globs for the rest`)}return{hits:c.hits,truncated:c.truncated,filesMatched:c.filesMatched,timedOut:c.timedOut??!1,notes:l}}function IA(e,t,n={}){return Ks(e,t,n).hits}var yA,C_,_A,M_,bA,E_,v_,EA,R_,CA,_o=z(()=>{"use strict";$();ru();Re();ge();nt();Ei();it();de();Jt();yA=200,C_=1e4,_A=1024*1024,M_=300,bA=new Set("bBdDwWsSfnrtvcxuk0123456789"),E_={A:"use ^",z:"use $",Z:"use $",Q:"escape the metacharacters instead",E:"escape the metacharacters instead",h:"use [ \\t]",p:"\\p{\u2026} needs a pattern that is otherwise valid with the u flag",P:"\\P{\u2026} needs a pattern that is otherwise valid with the u flag","<":"use \\b",">":"use \\b"};v_={w:"[:word:]",W:"[:^word:]",d:"[:digit:]",D:"[:^digit:]"};EA=e=>e.replace(/[\\*?[\]{}!]/g,t=>`\\${t}`);R_=256*1024*1024;CA=`var __name = (fn) => fn; const { workerData } = require("node:worker_threads"); const { readFileSync } = require("node:fs"); const { port, sig, job } = workerData; const s = new Int32Array(sig); -const clip = ${uf.toString()}; +const clip = ${_f.toString()}; const emit = (ev) => { port.postMessage(ev); Atomics.add(s, 0, 1); Atomics.notify(s, 0); }; try { - (${x_.toString()})(job, { readFile: readFileSync, clip, emit, progress: (i) => Atomics.store(s, 1, i) }); + (${I_.toString()})(job, { readFile: readFileSync, clip, emit, progress: (i) => Atomics.store(s, 1, i) }); } catch (e) { emit({ error: String(e && e.message || e) }); } -`});function Wn(e){let t=F.env.CODEINDEX_EMBED_DIR,n=[];t&&n.push(t),e&&n.push(j(e,".codeindex",S_)),n.push(j(F.cwd(),".codeindex",S_));for(let r of n)if(Q(j(r,"model.json")))return r}function xA(e){return Wn(e)!==void 0}function ff(e,t){let{modelId:n,dim:r,vocab:o,weights:s,unk:a}=e??{};if(typeof n!="string"||!n)throw new Error(`embed model: missing modelId in ${t}`);if(!Number.isInteger(r)||r<=0)throw new Error(`embed model: bad dim ${r} in ${t}`);if(!Array.isArray(o)||!Array.isArray(s)||o.length!==s.length)throw new Error(`embed model: vocab/weights length mismatch in ${t}`);let l=o.length,c=new Float64Array(l*r),d=new Map;for(let m=0;m{"use strict";$();oa();ke();me();Jt=3,S_="models",bA="https://github.com/maxgfr/codeindex/releases/download/embed-model-v1/model.json",wA="163ad053eab4e9a80d421ed4164f32292c83290f02fbbe6fe4b9b1cd6ea18d34"});function v_(e){let t=Jn(e).replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2"),n=[];for(let r of t.toLowerCase().split(/[^a-z0-9]+/))r&&n.push(r);return n}function kA(e){let t=E_.get(e);if(t===void 0){t=0;for(let n of e.vocab.keys())t=Math.max(t,n.startsWith("##")?n.length-2:n.length);E_.set(e,t)}return t}function R_(e,t){if(!e)return[];if(e.length>SA)return t.unkId>=0?[t.unkId]:[];let n=[],r=0,o=e.length,s=kA(t);for(;rr;){let c=r===0?e.slice(r,a):"##"+e.slice(r,a),d=t.vocab.get(c);if(d!==void 0){l=d;break}a--}if(l===-1)return t.unkId>=0?[t.unkId]:[];n.push(l),r=a}return n}function C_(e,t){let n=[];for(let r of v_(e))for(let o of R_(r,t))n.push(o);return n}function M_(e){let t=Math.floor(e),n=e-t;return n<.5?t:n>.5?t+1:t%2===0?t:t+1}function Gs(e){let t=e.length,n=new Int8Array(t),r=0;for(let s=0;sfo?a=fo:a<-fo&&(a=-fo),n[s]=a}return n}function mo(e,t){let{dim:n,weights:r}=e,o=C_(t,e);if(o.length===0)return new Int8Array(n);let s=new Float64Array(n);for(let l of o){let c=l*n;for(let d=0;d{"use strict";$();et();fo=127;SA=100,E_=new WeakMap});function EA(e,t,n){return[t.name,t.signature??"",t.doc??"",n??"",e.replace(/\//g," ")].join(` -`)}function RA(e,t,n,r){return[t??"",n??"",...r,e.replace(/\//g," ")].join(` -`)}function Cl(e){return Re(e).slice(0,16)}function gf(e,t,n){let r=new Map;if(!e||e.embedVersion!==Jt||e.modelId!==t||n!==void 0&&e.dim!==n)return r;for(let o of e.records)o.textHash&&(n===void 0||o.vec.length===n)&&r.set(o.textHash,o.vec);return r}function A_(e,t){return!e||e.embedVersion!==t.embedVersion||e.modelId!==t.modelId||e.dim!==t.dim||e.records.length!==t.records.length?!1:e.records.every((n,r)=>{let o=t.records[r];return n.file===o.file&&n.symbol===o.symbol&&n.line===o.line&&n.textHash===o.textHash})}function Ml(e){let t=[];for(let n of e.files){let r=new Set,o=!1;for(let s of n.symbols)vA.has(s.kind)||r.has(s.name)||(r.add(s.name),o=!0,t.push({file:n.rel,symbol:s.name,line:s.line,text:EA(n.rel,s,n.summary)}));if(!o){let s=RA(n.rel,n.title,n.summary,n.headings);s.replace(/\s+/g,"")&&t.push({file:n.rel,text:s})}}return t}function Zr(e,t,n={}){let r=gf(n.previous,t.modelId,t.dim),o=Ml(e).map(s=>{let a=Cl(s.text);return hf(s,a,r.get(a)??mo(t,s.text))});return{embedVersion:Jt,modelId:t.modelId,dim:t.dim,records:o}}function hf(e,t,n){return{file:e.file,...e.symbol!==void 0?{symbol:e.symbol}:{},...e.line!==void 0?{line:e.line}:{},textHash:t,vec:n}}function go(e){let t=JSON.stringify({embedVersion:e.embedVersion,modelId:e.modelId,dim:e.dim,count:e.records.length,records:e.records.map(a=>({file:a.file,symbol:a.symbol??"",line:a.line??0,hash:a.textHash??""}))}),n=new TextEncoder().encode(t),r=e.records.length*e.dim,o=new Uint8Array(8+n.length+r);o.set([67,73,69,49],0),new DataView(o.buffer,o.byteOffset,o.byteLength).setUint32(4,n.length,!0),o.set(n,8);let s=8+n.length;for(let a of e.records)for(let l=0;le.byteLength)throw new Error("embeddings.bin: truncated header");let r=JSON.parse(new TextDecoder().decode(e.subarray(8,8+n))),{dim:o}=r;if(typeof r.embedVersion!="number"||typeof r.modelId!="string"||!Number.isInteger(o)||o<0||!Array.isArray(r.records)||r.records.length!==r.count)throw new Error("embeddings.bin: malformed header");let s=8+n,a=r.records.length*o;if(s+a>e.byteLength)throw new Error("embeddings.bin: truncated body");let l=new Int8Array(a);l.set(new Int8Array(e.buffer,e.byteOffset+s,a));let c=r.records.map((d,u)=>({file:d.file,...d.symbol?{symbol:d.symbol}:{},...d.line?{line:d.line}:{},...d.hash?{textHash:d.hash}:{},vec:l.subarray(u*o,(u+1)*o)}));return{embedVersion:r.embedVersion,modelId:r.modelId,dim:o,records:c}}var vA,CA,Yr=H(()=>{"use strict";$();St();po();Xr();vA=new Set(["reexport","reexport-all"]);CA="CIE1"});function pr(e,t,n,r={}){let o=r.limit??MA,s={...r.fuzzy!==void 0?{fuzzy:r.fuzzy}:{},...r.exact?{exact:!0}:{},...r.rank?{rank:r.rank}:{}},a=r.queryVec??(r.model?mo(r.model,t):void 0);if(!a||!n||n.records.length===0)return Gt(e,t,{...s,limit:o});let l=r.model&&n.modelId!==r.model.modelId?`the embedding index was built with model ${n.modelId}, not ${r.model.modelId}`:a.length!==n.dim?`the embedding index holds ${n.dim}-dimension vectors and the query has ${a.length}`:void 0;if(l){let h=Gt(e,t,{...s,limit:o}),_=`Semantic ranking skipped: ${l} \u2014 rebuild it (codeindex index).`;return{...h,explain:{...h.explain,note:h.explain.note?`${h.explain.note} ${_}`:_}}}let c=Gt(e,t,{...s,limit:Math.max(o,50)}),d=new Map;for(let h of n.records){let _=pf(a,h.vec),y=d.get(h.file);(!y||_>y.score)&&d.set(h.file,{score:_,symbol:h.symbol,line:h.line})}let u=[...d.entries()].filter(([,h])=>h.score>0).sort((h,_)=>_[1].score-h[1].score||T(h[0],_[0])).map(([h])=>h),f=c.results.map(h=>h.file),m=Mc([f,u],h=>h,r.rrfK??AA),p=new Map(c.results.map(h=>[h.file,h])),g=[...m.entries()].sort((h,_)=>_[1]-h[1]||T(h[0],_[0])).slice(0,o).map(([h,_])=>{let y=p.get(h),b=d.get(h),S=y?{...y,score:Number(_.toFixed(4))}:{file:h,score:Number(_.toFixed(4)),matchedTerms:[],topSymbols:[],...b?.line?{line:b.line}:{}};return b?.symbol&&b.score>0&&(S.semanticSymbol=b.symbol),S});return{results:g,explain:$A(c.explain,g,p)}}function IA(e,t,n,r={}){return pr(e,t,n,r).results}function Al(e,t,n){return`${e} ${e===1?t:n}`}function $A(e,t,n){let r=t.filter(m=>!n.has(m.file)).length,o=t.filter(m=>m.bridgedOnly).length,s=t.length-r-o,a=e.wholeIdentifier?.df===0?e.wholeIdentifier.term:void 0,{note:l,...c}=e,d={...c,verdict:t.length?a!==void 0||s===0?"weak":"match":"none",bridgedOnlyResults:o,resultCount:t.length,semanticOnlyResults:r};if(!t.length)return e.note&&(d.note=e.note),d;if(d.verdict==="match")return d;let u=[];if(s){let m=e.terms.filter(p=>p.df>0&&p.term!==a).map(p=>p.term);u.push(`${Al(s,"lexical match","lexical matches")}${a&&m.length?` on its parts (${m.join(", ")})`:""}`)}if(o){let m=e.terms.filter(p=>p.bridge).map(p=>`"${p.term}" \u2192 ${p.bridge.to.join(", ")}`).join("; ");u.push(`${Al(o,"near match","near matches")}${m?` (${m})`:""}`)}r&&u.push(`${Al(r,"embedding neighbour","embedding neighbours")} with no lexical match (see semanticSymbol)`);let f=`The ${Al(t.length,"result","results")} below: ${u.join("; ")}.`;if(a!==void 0){let m=e.terms.find(g=>g.term===a)?.bridge?.to??[],p=m.length?` Closest indexed name${m.length===1?"":"s"}: ${m.join(", ")}.`:"";d.note=`No file in this index defines or mentions "${a}". ${f}${p}`}else{let m=e.unresolvedTerms,p=m.length?` (${m.length===1?"the term":"the terms"} ${m.join(", ")} ${m.length===1?"appears":"appear"} nowhere in this index)`:"";d.note=`Nothing matched the query verbatim${p}. ${f}`}return d}var MA,AA,Il=H(()=>{"use strict";$();et();ce();Fs();po();MA=20,AA=60});function gr(e={}){let t=e.url??F.env.CODEINDEX_EMBED_ENDPOINT;return t&&t.trim()?t.trim():void 0}function I_(e){return e.replace(/\/+$/,"")}function $l(e){let t=I_(e);return t.endsWith("/embed")?t:t+"/embed"}function $_(e){return I_(e).replace(/\/embed$/,"")+"/healthz"}function T_(e){if(typeof e.timeoutMs=="number")return e.timeoutMs;let t=Number(F.env.CODEINDEX_EMBED_TIMEOUT_MS);return Number.isFinite(t)&&t>0?t:3e4}async function Tl(e,t={}){let n=gr(t);if(!n)throw new Error("no embedding endpoint configured (set CODEINDEX_EMBED_ENDPOINT or pass opts.url)");let r=$l(n),o=new AbortController,s=setTimeout(()=>o.abort(),T_(t));try{let a=await fetch(r,{method:"POST",headers:{"content-type":"application/json",...t.headers??{}},body:JSON.stringify({texts:e}),signal:o.signal});if(!a.ok)throw new Error(`embedding endpoint ${r} returned HTTP ${a.status}`);let c=(await a.json()).vectors;if(!Array.isArray(c)||!c.every(d=>Array.isArray(d)&&d.every(u=>typeof u=="number")))throw new Error(`embedding endpoint ${r} returned a malformed { vectors } payload`);return c}finally{clearTimeout(s)}}async function ho(e,t={}){let n=new AbortController,r=setTimeout(()=>n.abort(),T_(t));try{return(await fetch($_(e),{signal:n.signal,headers:t.headers})).ok}catch{return!1}finally{clearTimeout(r)}}async function yo(e,t={}){let[n]=await Tl([e],t);if(!n)throw new Error("embedding endpoint returned no vector for the query");return Gs(n)}async function _f(e={}){let[t]=await Tl([TA],e);if(!t)throw new Error("embedding endpoint returned no vector for the fingerprint text");let n=Gs(t);return`endpoint@${Re(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)).slice(0,16)}`}async function _o(e,t={}){let n=t.modelId??"endpoint",r=Ml(e),o=r.map(y=>Cl(y.text)),s=gf(t.previous,n),a=o.map(y=>s.get(y)),l=new Map;o.forEach((y,b)=>{if(a[b])return;let S=l.get(y);S?S.push(b):l.set(y,[b])});let c=[...l.values()],d=t.batchSize&&t.batchSize>0?t.batchSize:64,u=[];for(let y=0;y{for(;!m&&fr[S[0]].text),t);if(b.length!==y.length)throw new Error(`embedding endpoint returned ${b.length} vectors for ${y.length} texts`);y.forEach((S,k)=>{let R=Gs(b[k]);for(let I of S)a[I]=R})}catch(b){throw m=!0,b}}},g=t.concurrency&&t.concurrency>0?t.concurrency:4;await Promise.all(Array.from({length:Math.min(g,u.length)},p));let h=0,_=r.map((y,b)=>{let S=a[b];return S.length>h&&(h=S.length),hf(y,o[b],S)});return{embedVersion:Jt,modelId:n,dim:h,records:_}}var TA,Fl=H(()=>{"use strict";$();St();po();Xr();Yr();TA="codeindex endpoint fingerprint: parse the request, retry on timeout"});function NA(e){let t=e.parent!==void 0;return O_.has(e.kind)||OA.has(e.kind)?t?2:O_.has(e.kind)?0:1:t?4:3}function PA(e,t){let n=new Map;for(let s of e)s.parent===void 0&&!n.has(s.name)&&n.set(s.name,s);let r=s=>s.exported&&!s.name.startsWith("_"),o=s=>{let a=s.parent===void 0?void 0:n.get(s.parent);return r(s)&&(a===void 0||r(a))};return e.map(s=>({s,pub:o(s),tier:NA(s)})).sort((s,a)=>Number(a.pub)-Number(s.pub)||s.tier-a.tier||s.s.line-a.s.line||T(s.s.name,a.s.name)).slice(0,t).map(s=>s.s)}function LA(e){let t=new Set(e.files.filter(o=>o.testFile).map(o=>o.rel)),n=e.fileEdges.filter(o=>!t.has(o.from));if(n.length===e.fileEdges.length)return new Map(e.files.map(o=>[o.rel,o.pagerank??0]));let r=Hr(e.files.map(o=>o.id),n);return new Map(e.files.map(o=>[o.rel,r.get(o.id)??0]))}function Qr(e,t,n={}){let r=(n.budgetTokens??1024)*F_,o=n.maxSymbolsPerFile??8,s=LA(t),a=t.files.filter(f=>f.fileKind==="code"&&!f.testFile).sort((f,m)=>s.get(m.rel)-s.get(f.rel)||m.symbols-f.symbols||T(f.rel,m.rel)),l=new Map(e.files.map(f=>[f.rel,f])),c=n.bare?"":`# repo map \u2014 ${t.fileCount} files -`,d=0,u=0;for(let f of a){let m=l.get(f.rel);if(!m)continue;let p=m.symbols.filter(_=>!FA.has(_.kind)&&_.name!=="_"),g=PA(p,o).sort((_,y)=>_.line-y.line||T(_.name,y.name)),h=` +`});function zn(e){let t=F.env.CODEINDEX_EMBED_DIR,n=[];t&&n.push(t),e&&n.push(j(e,".codeindex",$_)),n.push(j(F.cwd(),".codeindex",$_));for(let r of n)if(Q(j(r,"model.json")))return r}function FA(e){return zn(e)!==void 0}function bf(e,t){let{modelId:n,dim:r,vocab:o,weights:s,unk:a}=e??{};if(typeof n!="string"||!n)throw new Error(`embed model: missing modelId in ${t}`);if(!Number.isInteger(r)||r<=0)throw new Error(`embed model: bad dim ${r} in ${t}`);if(!Array.isArray(o)||!Array.isArray(s)||o.length!==s.length)throw new Error(`embed model: vocab/weights length mismatch in ${t}`);let l=o.length,c=new Float64Array(l*r),d=new Map;for(let m=0;m{"use strict";$();ma();Re();ge();en=3,$_="models",$A="https://github.com/maxgfr/codeindex/releases/download/embed-model-v1/model.json",TA="163ad053eab4e9a80d421ed4164f32292c83290f02fbbe6fe4b9b1cd6ea18d34"});function O_(e){let t=Qn(e).replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2"),n=[];for(let r of t.toLowerCase().split(/[^a-z0-9]+/))r&&n.push(r);return n}function NA(e){let t=F_.get(e);if(t===void 0){t=0;for(let n of e.vocab.keys())t=Math.max(t,n.startsWith("##")?n.length-2:n.length);F_.set(e,t)}return t}function N_(e,t){if(!e)return[];if(e.length>OA)return t.unkId>=0?[t.unkId]:[];let n=[],r=0,o=e.length,s=NA(t);for(;rr;){let c=r===0?e.slice(r,a):"##"+e.slice(r,a),d=t.vocab.get(c);if(d!==void 0){l=d;break}a--}if(l===-1)return t.unkId>=0?[t.unkId]:[];n.push(l),r=a}return n}function P_(e,t){let n=[];for(let r of O_(e))for(let o of N_(r,t))n.push(o);return n}function L_(e){let t=Math.floor(e),n=e-t;return n<.5?t:n>.5?t+1:t%2===0?t:t+1}function Zs(e){let t=e.length,n=new Int8Array(t),r=0;for(let s=0;sbo?a=bo:a<-bo&&(a=-bo),n[s]=a}return n}function wo(e,t){let{dim:n,weights:r}=e,o=P_(t,e);if(o.length===0)return new Int8Array(n);let s=new Float64Array(n);for(let l of o){let c=l*n;for(let d=0;d{"use strict";$();it();bo=127;OA=100,F_=new WeakMap});function PA(e,t,n){return[t.name,t.signature??"",t.doc??"",n??"",e.replace(/\//g," ")].join(` +`)}function DA(e,t,n,r){return[t??"",n??"",...r,e.replace(/\//g," ")].join(` +`)}function Ol(e){return Ae(e).slice(0,16)}function Sf(e,t,n){let r=new Map;if(!e||e.embedVersion!==en||e.modelId!==t||n!==void 0&&e.dim!==n)return r;for(let o of e.records)o.textHash&&(n===void 0||o.vec.length===n)&&r.set(o.textHash,o.vec);return r}function D_(e,t){return!e||e.embedVersion!==t.embedVersion||e.modelId!==t.modelId||e.dim!==t.dim||e.records.length!==t.records.length?!1:e.records.every((n,r)=>{let o=t.records[r];return n.file===o.file&&n.symbol===o.symbol&&n.line===o.line&&n.textHash===o.textHash})}function Nl(e){let t=[];for(let n of e.files){let r=new Set,o=!1;for(let s of n.symbols)LA.has(s.kind)||r.has(s.name)||(r.add(s.name),o=!0,t.push({file:n.rel,symbol:s.name,line:s.line,text:PA(n.rel,s,n.summary)}));if(!o){let s=DA(n.rel,n.title,n.summary,n.headings);s.replace(/\s+/g,"")&&t.push({file:n.rel,text:s})}}return t}function ns(e,t,n={}){let r=Sf(n.previous,t.modelId,t.dim),o=Nl(e).map(s=>{let a=Ol(s.text);return kf(s,a,r.get(a)??wo(t,s.text))});return{embedVersion:en,modelId:t.modelId,dim:t.dim,records:o}}function kf(e,t,n){return{file:e.file,...e.symbol!==void 0?{symbol:e.symbol}:{},...e.line!==void 0?{line:e.line}:{},textHash:t,vec:n}}function So(e){let t=JSON.stringify({embedVersion:e.embedVersion,modelId:e.modelId,dim:e.dim,count:e.records.length,records:e.records.map(a=>({file:a.file,symbol:a.symbol??"",line:a.line??0,hash:a.textHash??""}))}),n=new TextEncoder().encode(t),r=e.records.length*e.dim,o=new Uint8Array(8+n.length+r);o.set([67,73,69,49],0),new DataView(o.buffer,o.byteOffset,o.byteLength).setUint32(4,n.length,!0),o.set(n,8);let s=8+n.length;for(let a of e.records)for(let l=0;le.byteLength)throw new Error("embeddings.bin: truncated header");let r=JSON.parse(new TextDecoder().decode(e.subarray(8,8+n))),{dim:o}=r;if(typeof r.embedVersion!="number"||typeof r.modelId!="string"||!Number.isInteger(o)||o<0||!Array.isArray(r.records)||r.records.length!==r.count)throw new Error("embeddings.bin: malformed header");let s=8+n,a=r.records.length*o;if(s+a>e.byteLength)throw new Error("embeddings.bin: truncated body");let l=new Int8Array(a);l.set(new Int8Array(e.buffer,e.byteOffset+s,a));let c=r.records.map((d,u)=>({file:d.file,...d.symbol?{symbol:d.symbol}:{},...d.line?{line:d.line}:{},...d.hash?{textHash:d.hash}:{},vec:l.subarray(u*o,(u+1)*o)}));return{embedVersion:r.embedVersion,modelId:r.modelId,dim:o,records:c}}var LA,jA,rs=z(()=>{"use strict";$();At();xo();ts();LA=new Set(["reexport","reexport-all"]);jA="CIE1"});function br(e,t,n,r={}){let o=r.limit??WA,s={...r.fuzzy!==void 0?{fuzzy:r.fuzzy}:{},...r.exact?{exact:!0}:{},...r.rank?{rank:r.rank}:{}},a=r.queryVec??(r.model?wo(r.model,t):void 0);if(!a||!n||n.records.length===0)return Zt(e,t,{...s,limit:o});let l=r.model&&n.modelId!==r.model.modelId?`the embedding index was built with model ${n.modelId}, not ${r.model.modelId}`:a.length!==n.dim?`the embedding index holds ${n.dim}-dimension vectors and the query has ${a.length}`:void 0;if(l){let h=Zt(e,t,{...s,limit:o}),_=`Semantic ranking skipped: ${l} \u2014 rebuild it (codeindex index).`;return{...h,explain:{...h.explain,note:h.explain.note?`${h.explain.note} ${_}`:_}}}let c=Zt(e,t,{...s,limit:Math.max(o,50)}),d=new Map;for(let h of n.records){let _=xf(a,h.vec),y=d.get(h.file);(!y||_>y.score)&&d.set(h.file,{score:_,symbol:h.symbol,line:h.line})}let u=[...d.entries()].filter(([,h])=>h.score>0).sort((h,_)=>_[1].score-h[1].score||T(h[0],_[0])).map(([h])=>h),f=c.results.map(h=>h.file),m=Nc([f,u],h=>h,r.rrfK??BA),p=new Map(c.results.map(h=>[h.file,h])),g=[...m.entries()].sort((h,_)=>_[1]-h[1]||T(h[0],_[0])).slice(0,o).map(([h,_])=>{let y=p.get(h),b=d.get(h),S=y?{...y,score:Number(_.toFixed(4))}:{file:h,score:Number(_.toFixed(4)),matchedTerms:[],topSymbols:[],...b?.line?{line:b.line}:{}};return b?.symbol&&b.score>0&&(S.semanticSymbol=b.symbol),S});return{results:g,explain:zA(c.explain,g,p)}}function UA(e,t,n,r={}){return br(e,t,n,r).results}function Pl(e,t,n){return`${e} ${e===1?t:n}`}function zA(e,t,n){let r=t.filter(m=>!n.has(m.file)).length,o=t.filter(m=>m.bridgedOnly).length,s=t.length-r-o,a=e.wholeIdentifier?.df===0?e.wholeIdentifier.term:void 0,{note:l,...c}=e,d={...c,verdict:t.length?a!==void 0||s===0?"weak":"match":"none",bridgedOnlyResults:o,resultCount:t.length,semanticOnlyResults:r};if(!t.length)return e.note&&(d.note=e.note),d;if(d.verdict==="match")return d;let u=[];if(s){let m=e.terms.filter(p=>p.df>0&&p.term!==a).map(p=>p.term);u.push(`${Pl(s,"lexical match","lexical matches")}${a&&m.length?` on its parts (${m.join(", ")})`:""}`)}if(o){let m=e.terms.filter(p=>p.bridge).map(p=>`"${p.term}" \u2192 ${p.bridge.to.join(", ")}`).join("; ");u.push(`${Pl(o,"near match","near matches")}${m?` (${m})`:""}`)}r&&u.push(`${Pl(r,"embedding neighbour","embedding neighbours")} with no lexical match (see semanticSymbol)`);let f=`The ${Pl(t.length,"result","results")} below: ${u.join("; ")}.`;if(a!==void 0){let m=e.terms.find(g=>g.term===a)?.bridge?.to??[],p=m.length?` Closest indexed name${m.length===1?"":"s"}: ${m.join(", ")}.`:"";d.note=`No file in this index defines or mentions "${a}". ${f}${p}`}else{let m=e.unresolvedTerms,p=m.length?` (${m.length===1?"the term":"the terms"} ${m.join(", ")} ${m.length===1?"appears":"appear"} nowhere in this index)`:"";d.note=`Nothing matched the query verbatim${p}. ${f}`}return d}var WA,BA,Ll=z(()=>{"use strict";$();it();de();js();xo();WA=20,BA=60});function wr(e={}){let t=e.url??F.env.CODEINDEX_EMBED_ENDPOINT;return t&&t.trim()?t.trim():void 0}function j_(e){return e.replace(/\/+$/,"")}function Dl(e){let t=j_(e);return t.endsWith("/embed")?t:t+"/embed"}function W_(e){return j_(e).replace(/\/embed$/,"")+"/healthz"}function B_(e){if(typeof e.timeoutMs=="number")return e.timeoutMs;let t=Number(F.env.CODEINDEX_EMBED_TIMEOUT_MS);return Number.isFinite(t)&&t>0?t:3e4}async function jl(e,t={}){let n=wr(t);if(!n)throw new Error("no embedding endpoint configured (set CODEINDEX_EMBED_ENDPOINT or pass opts.url)");let r=Dl(n),o=new AbortController,s=setTimeout(()=>o.abort(),B_(t));try{let a=await fetch(r,{method:"POST",headers:{"content-type":"application/json",...t.headers??{}},body:JSON.stringify({texts:e}),signal:o.signal});if(!a.ok)throw new Error(`embedding endpoint ${r} returned HTTP ${a.status}`);let c=(await a.json()).vectors;if(!Array.isArray(c)||!c.every(d=>Array.isArray(d)&&d.every(u=>typeof u=="number")))throw new Error(`embedding endpoint ${r} returned a malformed { vectors } payload`);return c}finally{clearTimeout(s)}}async function ko(e,t={}){let n=new AbortController,r=setTimeout(()=>n.abort(),B_(t));try{return(await fetch(W_(e),{signal:n.signal,headers:t.headers})).ok}catch{return!1}finally{clearTimeout(r)}}async function Eo(e,t={}){let[n]=await jl([e],t);if(!n)throw new Error("embedding endpoint returned no vector for the query");return Zs(n)}async function vf(e={}){let[t]=await jl([HA],e);if(!t)throw new Error("embedding endpoint returned no vector for the fingerprint text");let n=Zs(t);return`endpoint@${Ae(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)).slice(0,16)}`}async function vo(e,t={}){let n=t.modelId??"endpoint",r=Nl(e),o=r.map(y=>Ol(y.text)),s=Sf(t.previous,n),a=o.map(y=>s.get(y)),l=new Map;o.forEach((y,b)=>{if(a[b])return;let S=l.get(y);S?S.push(b):l.set(y,[b])});let c=[...l.values()],d=t.batchSize&&t.batchSize>0?t.batchSize:64,u=[];for(let y=0;y{for(;!m&&fr[S[0]].text),t);if(b.length!==y.length)throw new Error(`embedding endpoint returned ${b.length} vectors for ${y.length} texts`);y.forEach((S,k)=>{let C=Zs(b[k]);for(let I of S)a[I]=C})}catch(b){throw m=!0,b}}},g=t.concurrency&&t.concurrency>0?t.concurrency:4;await Promise.all(Array.from({length:Math.min(g,u.length)},p));let h=0,_=r.map((y,b)=>{let S=a[b];return S.length>h&&(h=S.length),kf(y,o[b],S)});return{embedVersion:en,modelId:n,dim:h,records:_}}var HA,Wl=z(()=>{"use strict";$();At();xo();ts();rs();HA="codeindex endpoint fingerprint: parse the request, retry on timeout"});function VA(e){let t=e.parent!==void 0;return z_.has(e.kind)||qA.has(e.kind)?t?2:z_.has(e.kind)?0:1:t?4:3}function JA(e,t){let n=new Map;for(let s of e)s.parent===void 0&&!n.has(s.name)&&n.set(s.name,s);let r=s=>s.exported&&!s.name.startsWith("_"),o=s=>{let a=s.parent===void 0?void 0:n.get(s.parent);return r(s)&&(a===void 0||r(a))};return e.map(s=>({s,pub:o(s),tier:VA(s)})).sort((s,a)=>Number(a.pub)-Number(s.pub)||s.tier-a.tier||s.s.line-a.s.line||T(s.s.name,a.s.name)).slice(0,t).map(s=>s.s)}function KA(e){let t=new Set(e.files.filter(o=>o.testFile).map(o=>o.rel)),n=e.fileEdges.filter(o=>!t.has(o.from));if(n.length===e.fileEdges.length)return new Map(e.files.map(o=>[o.rel,o.pagerank??0]));let r=Kr(e.files.map(o=>o.id),n);return new Map(e.files.map(o=>[o.rel,r.get(o.id)??0]))}function ss(e,t,n={}){let r=(n.budgetTokens??1024)*U_,o=n.maxSymbolsPerFile??8,s=KA(t),a=t.files.filter(f=>f.fileKind==="code"&&!f.testFile).sort((f,m)=>s.get(m.rel)-s.get(f.rel)||m.symbols-f.symbols||T(f.rel,m.rel)),l=new Map(e.files.map(f=>[f.rel,f])),c=n.bare?"":`# repo map \u2014 ${t.fileCount} files +`,d=0,u=0;for(let f of a){let m=l.get(f.rel);if(!m)continue;let p=m.symbols.filter(_=>!GA.has(_.kind)&&_.name!=="_"),g=JA(p,o).sort((_,y)=>_.line-y.line||T(_.name,y.name)),h=` ${f.rel}: `;for(let _ of g){let y=(_.signature??`${_.kind} ${_.name}`).replace(/\s+/g," ").trim().slice(0,120);h+=` ${_.line}: ${y} `}if(p.length>g.length&&(h+=` \u2026 ${p.length-g.length} more -`),c.length+h.length>r){if(++u>=DA)break;continue}u=0,c+=h,d++}return`${c} -(${d} of ${a.length} code files shown, ~${Math.ceil(c.length/F_)} tokens) -`}var F_,FA,O_,OA,DA,bo=H(()=>{"use strict";$();Qi();ce();F_=4,FA=new Set(["reexport","reexport-all","package"]),O_=new Set(["class","struct","interface","type","enum","trait","record","protocol","typedef","union","object","module"]),OA=new Set(["function","def","fn","func","method","constructor","macro"]);DA=32});function wo(e,t={}){let n=t.maxCommitFiles??30,r=t.minTogether??3,o=t.maxPairs??100,s=Wc(e,t.since);if(!s.ok)return{ok:!1,error:s.error,couplings:[]};let{log:a}=s,l=t.graph?new Set(t.graph.files.map(S=>S.rel)):void 0,c=Bc(a),d=c.filter(S=>S!==void 0&&(!l||l.has(S))).sort(T),u=new Map(d.map((S,k)=>[S,k])),f=c.map(S=>S===void 0?-1:u.get(S)??-1),m=d.length,p=new Int32Array(m),g=new Map,h=new Int32Array(a.paths.length).fill(-1),_=[];for(let S=0;S+1=0&&_.push(f[I]))}if(!(k===0||k>n)){_.sort((R,I)=>R-I);for(let R=0;R<_.length;R++){let I=_[R];p[I]++;for(let P=R+1;P<_.length;P++){let v=I*m+_[P];g.set(v,(g.get(v)??0)+1)}}}}let y;if(t.graph){y=new Set;for(let S of t.graph.fileEdges){if(S.dangling||S.kind==="mention"||S.kind==="contains")continue;let k=u.get(S.from),R=u.get(S.to);k===void 0||R===void 0||k===R||y.add(kk.confidence-S.confidence||k.strength-S.strength||k.together-S.together||T(S.a,k.a)||T(S.b,k.b)),{ok:!0,...a.shallow?{shallow:!0}:{},couplings:b.slice(0,o)}}function N_(e){let t=e.indexOf(".",e.lastIndexOf("/")+2);return t<0?e:e.slice(0,t)}function jA(e,t){let n=3.8415999999999997,r=e/t;return(r+n/(2*t)-Math.sqrt(n*(r*(1-r)+n/(4*t))/t))/(1+n/t)}function es(e,t,n=20){let r=[];for(let o of e.files){if(o.kind!=="code")continue;let s=t.get(o.rel)??0,a=Number((s*Math.log2(o.lines+1)).toFixed(2));a<=0||r.push({rel:o.rel,lines:o.lines,commits:s,score:a,...Ft(o.rel)?{test:!0}:{}})}return r.sort((o,s)=>s.score-o.score||s.lines-o.lines||T(o.rel,s.rel)),r.slice(0,n)}var P_,xo=H(()=>{"use strict";$();nn();ce();dr();P_=e=>Number(e.toFixed(3))});function UA(e){let t=0,n,r=e.replace(/\r\n?/g,` +`),c.length+h.length>r){if(++u>=XA)break;continue}u=0,c+=h,d++}return`${c} +(${d} of ${a.length} code files shown, ~${Math.ceil(c.length/U_)} tokens) +`}var U_,GA,z_,qA,XA,Ro=z(()=>{"use strict";$();io();de();U_=4,GA=new Set(["reexport","reexport-all","package"]),z_=new Set(["class","struct","interface","type","enum","trait","record","protocol","typedef","union","object","module"]),qA=new Set(["function","def","fn","func","method","constructor","macro"]);XA=32});function Co(e,t={}){let n=t.maxCommitFiles??30,r=t.minTogether??3,o=t.maxPairs??100,s=Vc(e,t.since);if(!s.ok)return{ok:!1,error:s.error,couplings:[]};let{log:a}=s,l=t.graph?new Set(t.graph.files.map(S=>S.rel)):void 0,c=Jc(a),d=c.filter(S=>S!==void 0&&(!l||l.has(S))).sort(T),u=new Map(d.map((S,k)=>[S,k])),f=c.map(S=>S===void 0?-1:u.get(S)??-1),m=d.length,p=new Int32Array(m),g=new Map,h=new Int32Array(a.paths.length).fill(-1),_=[];for(let S=0;S+1=0&&_.push(f[I]))}if(!(k===0||k>n)){_.sort((C,I)=>C-I);for(let C=0;C<_.length;C++){let I=_[C];p[I]++;for(let P=C+1;P<_.length;P++){let v=I*m+_[P];g.set(v,(g.get(v)??0)+1)}}}}let y;if(t.graph){y=new Set;for(let S of t.graph.fileEdges){if(S.dangling||S.kind==="mention"||S.kind==="contains")continue;let k=u.get(S.from),C=u.get(S.to);k===void 0||C===void 0||k===C||y.add(kk.confidence-S.confidence||k.strength-S.strength||k.together-S.together||T(S.a,k.a)||T(S.b,k.b)),{ok:!0,...a.shallow?{shallow:!0}:{},couplings:b.slice(0,o)}}function H_(e){let t=e.indexOf(".",e.lastIndexOf("/")+2);return t<0?e:e.slice(0,t)}function ZA(e,t){let n=3.8415999999999997,r=e/t;return(r+n/(2*t)-Math.sqrt(n*(r*(1-r)+n/(4*t))/t))/(1+n/t)}function is(e,t,n=20){let r=[];for(let o of e.files){if(o.kind!=="code")continue;let s=t.get(o.rel)??0,a=Number((s*Math.log2(o.lines+1)).toFixed(2));a<=0||r.push({rel:o.rel,lines:o.lines,commits:s,score:a,...Wt(o.rel)?{test:!0}:{}})}return r.sort((o,s)=>s.score-o.score||s.lines-o.lines||T(o.rel,s.rel)),r.slice(0,n)}var G_,Mo=z(()=>{"use strict";$();ln();de();gr();G_=e=>Number(e.toFixed(3))});function eI(e){let t=0,n,r=e.replace(/\r\n?/g,` `).replace(/^ {0,3}(`{3,}|~{3,})[^\n]*\n[\s\S]*?^ {0,3}\1[^\n]*$/gm,"");for(let o of r.split(/\n\s*\n/)){let s=o.trim().split(` -`),a=/^(#{1,6})\s/.exec(s[0]??"");if(a)t=a[1].length,s=s.slice(1);else if(s.length>=2&&/^(=+|-+)\s*$/.test(s[s.length-1])){t=s[s.length-1].startsWith("=")?1:2;continue}else if(s.length===1&&/^(?:[-*_]\s*){3,}$/.test(s[0])){t=Math.min(t,1);continue}let l=s.join(" ").trim();if(!l||l.startsWith("<")||l.startsWith("#")||/^(\[!\[|!\[|\[)/.test(l)&&!/[.:]\s/.test(l)||/^\[[^\]]+\]:\s/.test(l))continue;let c=l.replace(/!\[[^\]]*\]\([^)]*\)/g,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]+)\](?:\[[^\]]*\])?/g,"$1").replace(/[*_`]/g,"").replace(/\s+/g," ").trim();if(!(c.length<=20)){if(t<=1)return c.slice(0,400);n??=c.slice(0,400)}}return n}function zA(e){for(let t of WA){let n=j(e,t);if(Q(n))try{return UA(ie(n,"utf8"))}catch{continue}}}function bf(e,t,n={}){let r=[],o=le(e.root).replace(/\/+$/,"").split("/").pop()||"repository";r.push(`# ${o}`,"");let s=zA(e.root);s&&r.push(s,"");let a=Object.entries(t.languages).sort((f,m)=>m[1]-f[1]||T(f[0],m[0])).slice(0,6).map(([f,m])=>`${f} ${m}`).join(", ");r.push(`**${t.fileCount} indexed files** \xB7 ${a}`,"");let l=Pn(e.root);if(l.packages.length>1){r.push(`## Layout \u2014 monorepo, ${l.packages.length} packages`,"");for(let f of l.packages.slice(0,20))r.push(`- \`${f.dir}\` \u2014 ${f.name}`);l.packages.length>20&&r.push(`- \u2026and ${l.packages.length-20} more`),l.cycle?.length&&r.push("",`\u26A0 dependency cycle: ${l.cycle.join(" \u2192 ")}`),r.push("")}r.push("## Key files","",Qr(e,t,{budgetTokens:n.budgetTokens??900,bare:!0}).trim(),"");let c=tn(e.root);if(c.ok&&c.commits>=BA){let f=es(e,c.churn,8);if(f.length){let m=c.shallow?` Shallow clone: only ${c.commits} commits of history are visible.`:"";r.push("## Where work concentrates","",`Files ranked by commits \xD7 size \u2014 where changes and defects cluster.${m}`,"");for(let p of f)r.push(`- \`${p.rel}\` \u2014 ${p.commits} commits, ${p.lines} lines${p.test?" (test)":""}`);r.push("")}}r.push("## Next","","- `search ` \u2014 BM25 over names, paths, doc comments and prose; `explain_search` says whether it really matched","- `find_symbol ` / `symbols_overview ` \u2014 read structure without reading files","- `find_references ` \u2014 three labelled tiers; add `lsp: true` when a language server is configured","");let d=r.join(` -`);if(n.remember===!1)return{brief:d};let u=n.memoryName??"onboarding";try{ao(e.root,u,d)}catch(f){return{brief:d,memoryError:`not saved as the ${u} memory: ${f instanceof Error?f.message:String(f)}`}}return{brief:d,memory:u}}var WA,BA,wf=H(()=>{"use strict";$();ke();me();bo();qr();xo();nn();bl();ce();WA=["README.md","README.markdown","README.rst","README.txt","README"],BA=10});function HA(e={}){if(e.trustRepoConfig===!0)return!0;let t=(F.env.CODEINDEX_TRUST_LSP_CONFIG??"").trim().toLowerCase();return t==="1"||t==="true"||t==="yes"}function GA(){let e=F.env.XDG_CONFIG_HOME?.trim();return j(e?le(e):j(ba(),".config"),"codeindex",xf)}function qs(e,t={}){let n=F.env.CODEINDEX_LSP_CONFIG;if(n!==void 0){let c=n.trim();return!c||c==="0"||c.toLowerCase()==="off"?{path:void 0,source:"none"}:{path:le(c),source:"env"}}let r=HA(t),o,s=j(e,L_,xf),a=j(F.cwd(),L_,xf);for(let[c,d]of[[s,"repo"],[a,"cwd"]])if(!(d==="cwd"&&c===s)&&Q(c)){if(r)return{path:c,source:d};o??=c}let l=GA();return Q(l)?{path:l,source:"user",...o?{ignored:o}:{}}:{path:void 0,source:"none",...o?{ignored:o}:{}}}function j_(e){if(!e||typeof e!="object")throw new Error("lsp.json must be a JSON object");let t=e;if(t.version!==1)throw new Error(`lsp.json: unsupported version ${JSON.stringify(t.version)} (expected 1)`);if(!Array.isArray(t.servers))throw new Error("lsp.json: `servers` must be an array");let n=new Set;return{version:1,servers:t.servers.map((o,s)=>{if(!o||typeof o!="object")throw new Error(`lsp.json: servers[${s}] must be an object`);let a=o,l=typeof a.id=="string"&&a.id.trim()?a.id.trim():void 0;if(!l)throw new Error(`lsp.json: servers[${s}].id must be a non-empty string`);if(n.has(l))throw new Error(`lsp.json: duplicate server id ${JSON.stringify(l)}`);if(n.add(l),typeof a.command!="string"||!a.command.trim())throw new Error(`lsp.json: servers[${s}].command must be a non-empty string`);if(!Array.isArray(a.languages)||!a.languages.length||a.languages.some(c=>typeof c!="string"))throw new Error(`lsp.json: servers[${s}].languages must be a non-empty array of strings`);if(a.args!==void 0&&(!Array.isArray(a.args)||a.args.some(c=>typeof c!="string")))throw new Error(`lsp.json: servers[${s}].args must be an array of strings`);return{id:l,languages:a.languages,...typeof a.languageId=="string"?{languageId:a.languageId}:{},command:a.command,...Array.isArray(a.args)?{args:a.args}:{},...a.env&&typeof a.env=="object"?{env:a.env}:{},...a.initializationOptions!==void 0?{initializationOptions:a.initializationOptions}:{},...a.timeoutMs!==void 0?{timeoutMs:D_(a.timeoutMs,`servers[${s}].timeoutMs`)}:{},...a.startupTimeoutMs!==void 0?{startupTimeoutMs:D_(a.startupTimeoutMs,`servers[${s}].startupTimeoutMs`)}:{}}})}}function D_(e,t){if(typeof e!="number"||!Number.isFinite(e)||e<=0)throw new Error(`lsp.json: ${t} must be a positive number of milliseconds, got ${JSON.stringify(e)}`);return e}function So(e,t={}){let{path:n}=qs(e,t);if(!n||!Q(n))return;let r;try{r=JSON.parse(ie(n,"utf8"))}catch(o){throw new Error(`${n}: ${o instanceof Error?o.message:String(o)}`)}return j_(r)}function Sf(e,t){return e.servers.find(n=>n.languages.includes(t))}function Nl(e){return B_("CODEINDEX_LSP_TIMEOUT_MS")??e.timeoutMs??qA}function W_(e){return B_("CODEINDEX_LSP_STARTUP_TIMEOUT_MS")??e.startupTimeoutMs??VA}function B_(e){let t=F.env[e];if(t===void 0)return;let n=Number(t);return Number.isFinite(n)&&n>0?n:void 0}var xf,L_,Ol,qA,VA,Pl=H(()=>{"use strict";$();ke();bi();me();xf="lsp.json",L_=".codeindex",Ol="a repository's lsp.json names commands to run, so it is read only with --trust-lsp-config or CODEINDEX_TRUST_LSP_CONFIG=1";qA=5e3,VA=15e3});function ts(e,t){return{server:e,ok:!1,reason:t,refs:[],agreement:{both:[],lspOnly:[],staticOnly:[]}}}function Dl(e,t,n,r){try{let o=ie(j(e,t),"utf8").split(/\r?\n/)[n-1];return o===void 0?0:JA(o,r)}catch{return 0}}function JA(e,t){if(!t)return 0;let n=Ll.test(t[0]),r=Ll.test(t[t.length-1]),o=c=>(!n||c===0||!Ll.test(e[c-1]))&&(!r||c+t.length>=e.length||!Ll.test(e[c+t.length])),s=c=>{let d=[];for(let u=e.indexOf(t,c);u>=0;u=e.indexOf(t,u+1))o(u)&&d.push(u);return d},a=ZA(e),l=s(a);if(l.length){if(!KA.has(t))return l[0];let c=XA(e,a),d=l.filter(u=>u0?s(0)[0]??0:0}function XA(e,t){for(let n=t;nl.file)),r=new Set([...t.callSites.map(l=>l.file),...t.referencingFiles,...t.defs.map(l=>l.file)]),o=[],s=[],a=[];for(let l of n)(r.has(l)?o:s).push(l);for(let l of r)n.has(l)||a.push(l);return{both:o.sort(T),lspOnly:s.sort(T),staticOnly:a.sort(T)}}async function z_(e,t,n,r,o,s){if(!r.capabilities.references)return{...n,lsp:ts(o,"server does not provide textDocument/references")};if(!n.defs.length)return{...n,lsp:ts(o,`no declaration of ${t} to anchor a request on`)};let a=new Set,l=[];try{for(let c of n.defs){let d=YA(e.root,c.file);if(!d)continue;r.didOpen(c.file,d,s??c.lang);let u=Dl(e.root,c.file,c.line,t);for(let f of await r.references(c.file,c.line,u)){let m=`${f.file}:${f.line}:${f.character??""}`;a.has(m)||(a.add(m),l.push(f))}}}catch(c){return{...n,lsp:{server:o,ok:!1,reason:c instanceof Error?c.message:String(c),refs:l.sort(U_),agreement:ko(l,n)}}}return l.sort(U_),{...n,lsp:{server:o,ok:!0,refs:l,agreement:ko(l,n)}}}function U_(e,t){return T(e.file,t.file)||e.line-t.line||(e.character??0)-(t.character??0)}function YA(e,t){try{return ie(j(e,t),"utf8")}catch{return""}}var Ll,KA,jl=H(()=>{"use strict";$();ke();me();ce();Ll=/[\p{L}\p{N}_$]/u;KA=new Set(["abstract","async","const","declare","def","default","export","final","fn","fun","func","function","get","internal","let","open","override","private","protected","pub","public","readonly","set","static","type","val","var","virtual"])});function G_(e,t){if(!Array.isArray(t))return[];let n=[];for(let r of t){let o=r?.from;if(!o||typeof o.uri!="string"||typeof o.name!="string"||typeof o.kind!="number")continue;let s=Vs(e,{uri:o.uri,range:o.selectionRange})[0];if(!(!s||!Array.isArray(r.fromRanges)))for(let a of r.fromRanges){let l=a?.start;if(!(!Number.isInteger(l?.line)||l.line<0||!Number.isInteger(l?.character)||l.character<0))for(let c of Vs(e,{uri:o.uri,range:a}))n.push({...c,caller:{...s,name:o.name,kind:o.kind}})}}return Bn(n)}function Bn(e){let t=new Set;return e.filter(n=>{let r=JSON.stringify([n.file,n.line,n.character,n.caller]);return t.has(r)?!1:(t.add(r),!0)}).sort((n,r)=>T(n.file,r.file)||n.line-r.line||(n.character??0)-(r.character??0)||T(n.caller.name,r.caller.name)||n.caller.line-r.caller.line)}function Wl(e){let t=JSON.stringify(e);return`Content-Length: ${eI(t)}${QA}${t}`}function eI(e){return new TextEncoder().encode(e).byteLength}function kf(){let e=new TextEncoder,t=new TextDecoder,n=new Uint8Array(0),r=[],o=0,s=0,a=0,l=f=>{n=n.subarray(f),a=0},c=f=>{r.push(f),o+=f.length},d=()=>{if(!r.length)return;let f=new Uint8Array(n.length+o);f.set(n);let m=n.length;for(let p of r)f.set(p,m),m+=p.length;n=f,r.length=0,o=0},u=()=>{for(let f=a;f+3H_&&l(n.length-H_),m;let g=t.decode(n.subarray(0,p)),h=/content-length:\s*(\d+)/i.exec(g);if(!h){l(p+4);continue}let _=Number(h[1]);if(!Number.isSafeInteger(_)||_<0||_>q_){l(p+4);continue}let y=p+4;if(n.lengthc===0||c===1&&/^[A-Za-z]:$/.test(l)?l:encodeURIComponent(l)).join("/")}function Ef(e,t){if(typeof e!="string"){for(let l of e){let c=Ef(l,t);if(c!==void 0)return c}return}if(!t.startsWith("file://"))return;let n;try{let l=t.slice(7);n=decodeURIComponent(l.startsWith("/")?l:`//${l}`).replace(/\\/g,"/")}catch{return}/^\/[A-Za-z]:/.test(n)&&(n=n.slice(1));let r=e.replace(/\\/g,"/").replace(/\/+$/,""),o=/^[A-Za-z]:/.test(r)||r.startsWith("//"),s=o?n.toLowerCase():n,a=o?r.toLowerCase():r;if(s===a)return"";if(s.startsWith(`${a}/`))return n.slice(r.length+1)}function Vs(e,t){let n=Array.isArray(t)?t:t&&typeof t=="object"?[t]:[],r=new Set,o=[];for(let s of n){if(!s||typeof s!="object")continue;let a=s.uri??s.targetUri;if(!a)continue;let l=Ef(e,a);if(l===void 0||l==="")continue;let c=(s.range??s.targetSelectionRange??s.targetRange)?.start,d=typeof c?.line=="number"?c.line+1:1,u=typeof c?.character=="number"?c.character:void 0,f=`${l}:${d}:${u??""}`;r.has(f)||(r.add(f),o.push(u===void 0?{file:l,line:d}:{file:l,line:d,character:u}))}return o.sort((s,a)=>T(s.file,a.file)||s.line-a.line||(s.character??0)-(a.character??0))}var q_,H_,QA,Eo=H(()=>{"use strict";$();ce();q_=32*1024*1024,H_=64*1024,QA=`\r +`),a=/^(#{1,6})\s/.exec(s[0]??"");if(a)t=a[1].length,s=s.slice(1);else if(s.length>=2&&/^(=+|-+)\s*$/.test(s[s.length-1])){t=s[s.length-1].startsWith("=")?1:2;continue}else if(s.length===1&&/^(?:[-*_]\s*){3,}$/.test(s[0])){t=Math.min(t,1);continue}let l=s.join(" ").trim();if(!l||l.startsWith("<")||l.startsWith("#")||/^(\[!\[|!\[|\[)/.test(l)&&!/[.:]\s/.test(l)||/^\[[^\]]+\]:\s/.test(l))continue;let c=l.replace(/!\[[^\]]*\]\([^)]*\)/g,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]+)\](?:\[[^\]]*\])?/g,"$1").replace(/[*_`]/g,"").replace(/\s+/g," ").trim();if(!(c.length<=20)){if(t<=1)return c.slice(0,400);n??=c.slice(0,400)}}return n}function tI(e){for(let t of YA){let n=j(e,t);if(Q(n))try{return eI(oe(n,"utf8"))}catch{continue}}}function Rf(e,t,n={}){let r=[],o=ce(e.root).replace(/\/+$/,"").split("/").pop()||"repository";r.push(`# ${o}`,"");let s=tI(e.root);s&&r.push(s,"");let a=Object.entries(t.languages).sort((f,m)=>m[1]-f[1]||T(f[0],m[0])).slice(0,6).map(([f,m])=>`${f} ${m}`).join(", ");r.push(`**${t.fileCount} indexed files** \xB7 ${a}`,"");let l=jn(e.root);if(l.packages.length>1){r.push(`## Layout \u2014 monorepo, ${l.packages.length} packages`,"");for(let f of l.packages.slice(0,20))r.push(`- \`${f.dir}\` \u2014 ${f.name}`);l.packages.length>20&&r.push(`- \u2026and ${l.packages.length-20} more`),l.cycle?.length&&r.push("",`\u26A0 dependency cycle: ${l.cycle.join(" \u2192 ")}`),r.push("")}r.push("## Key files","",ss(e,t,{budgetTokens:n.budgetTokens??900,bare:!0}).trim(),"");let c=an(e.root);if(c.ok&&c.commits>=QA){let f=is(e,c.churn,8);if(f.length){let m=c.shallow?` Shallow clone: only ${c.commits} commits of history are visible.`:"";r.push("## Where work concentrates","",`Files ranked by commits \xD7 size \u2014 where changes and defects cluster.${m}`,"");for(let p of f)r.push(`- \`${p.rel}\` \u2014 ${p.commits} commits, ${p.lines} lines${p.test?" (test)":""}`);r.push("")}}r.push("## Next","","- `search ` \u2014 BM25 over names, paths, doc comments and prose; `explain_search` says whether it really matched","- `find_symbol ` / `symbols_overview ` \u2014 read structure without reading files","- `find_references ` \u2014 three labelled tiers; add `lsp: true` when a language server is configured","");let d=r.join(` +`);if(n.remember===!1)return{brief:d};let u=n.memoryName??"onboarding";try{go(e.root,u,d)}catch(f){return{brief:d,memoryError:`not saved as the ${u} memory: ${f instanceof Error?f.message:String(f)}`}}return{brief:d,memory:u}}var YA,QA,Cf=z(()=>{"use strict";$();Re();ge();Ro();Zr();Mo();ln();Rl();de();YA=["README.md","README.markdown","README.rst","README.txt","README"],QA=10});function nI(e={}){if(e.trustRepoConfig===!0)return!0;let t=(F.env.CODEINDEX_TRUST_LSP_CONFIG??"").trim().toLowerCase();return t==="1"||t==="true"||t==="yes"}function rI(){let e=F.env.XDG_CONFIG_HOME?.trim();return j(e?ce(e):j(Ra(),".config"),"codeindex",Mf)}function Ys(e,t={}){let n=F.env.CODEINDEX_LSP_CONFIG;if(n!==void 0){let c=n.trim();return!c||c==="0"||c.toLowerCase()==="off"?{path:void 0,source:"none"}:{path:ce(c),source:"env"}}let r=nI(t),o,s=j(e,q_,Mf),a=j(F.cwd(),q_,Mf);for(let[c,d]of[[s,"repo"],[a,"cwd"]])if(!(d==="cwd"&&c===s)&&Q(c)){if(r)return{path:c,source:d};o??=c}let l=rI();return Q(l)?{path:l,source:"user",...o?{ignored:o}:{}}:{path:void 0,source:"none",...o?{ignored:o}:{}}}function J_(e){if(!e||typeof e!="object")throw new Error("lsp.json must be a JSON object");let t=e;if(t.version!==1)throw new Error(`lsp.json: unsupported version ${JSON.stringify(t.version)} (expected 1)`);if(!Array.isArray(t.servers))throw new Error("lsp.json: `servers` must be an array");let n=new Set;return{version:1,servers:t.servers.map((o,s)=>{if(!o||typeof o!="object")throw new Error(`lsp.json: servers[${s}] must be an object`);let a=o,l=typeof a.id=="string"&&a.id.trim()?a.id.trim():void 0;if(!l)throw new Error(`lsp.json: servers[${s}].id must be a non-empty string`);if(n.has(l))throw new Error(`lsp.json: duplicate server id ${JSON.stringify(l)}`);if(n.add(l),typeof a.command!="string"||!a.command.trim())throw new Error(`lsp.json: servers[${s}].command must be a non-empty string`);if(!Array.isArray(a.languages)||!a.languages.length||a.languages.some(c=>typeof c!="string"))throw new Error(`lsp.json: servers[${s}].languages must be a non-empty array of strings`);if(a.args!==void 0&&(!Array.isArray(a.args)||a.args.some(c=>typeof c!="string")))throw new Error(`lsp.json: servers[${s}].args must be an array of strings`);return{id:l,languages:a.languages,...typeof a.languageId=="string"?{languageId:a.languageId}:{},command:a.command,...Array.isArray(a.args)?{args:a.args}:{},...a.env&&typeof a.env=="object"?{env:a.env}:{},...a.initializationOptions!==void 0?{initializationOptions:a.initializationOptions}:{},...a.timeoutMs!==void 0?{timeoutMs:V_(a.timeoutMs,`servers[${s}].timeoutMs`)}:{},...a.startupTimeoutMs!==void 0?{startupTimeoutMs:V_(a.startupTimeoutMs,`servers[${s}].startupTimeoutMs`)}:{}}})}}function V_(e,t){if(typeof e!="number"||!Number.isFinite(e)||e<=0)throw new Error(`lsp.json: ${t} must be a positive number of milliseconds, got ${JSON.stringify(e)}`);return e}function Ao(e,t={}){let{path:n}=Ys(e,t);if(!n||!Q(n))return;let r;try{r=JSON.parse(oe(n,"utf8"))}catch(o){throw new Error(`${n}: ${o instanceof Error?o.message:String(o)}`)}return J_(r)}function Af(e,t){return e.servers.find(n=>n.languages.includes(t))}function Ul(e){return X_("CODEINDEX_LSP_TIMEOUT_MS")??e.timeoutMs??sI}function K_(e){return X_("CODEINDEX_LSP_STARTUP_TIMEOUT_MS")??e.startupTimeoutMs??iI}function X_(e){let t=F.env[e];if(t===void 0)return;let n=Number(t);return Number.isFinite(n)&&n>0?n:void 0}var Mf,q_,Bl,sI,iI,zl=z(()=>{"use strict";$();Re();vi();ge();Mf="lsp.json",q_=".codeindex",Bl="a repository's lsp.json names commands to run, so it is read only with --trust-lsp-config or CODEINDEX_TRUST_LSP_CONFIG=1";sI=5e3,iI=15e3});function os(e,t){return{server:e,ok:!1,reason:t,refs:[],agreement:{both:[],lspOnly:[],staticOnly:[]}}}function Gl(e,t,n,r){try{let o=oe(j(e,t),"utf8").split(/\r?\n/)[n-1];return o===void 0?0:oI(o,r)}catch{return 0}}function oI(e,t){if(!t)return 0;let n=Hl.test(t[0]),r=Hl.test(t[t.length-1]),o=c=>(!n||c===0||!Hl.test(e[c-1]))&&(!r||c+t.length>=e.length||!Hl.test(e[c+t.length])),s=c=>{let d=[];for(let u=e.indexOf(t,c);u>=0;u=e.indexOf(t,u+1))o(u)&&d.push(u);return d},a=cI(e),l=s(a);if(l.length){if(!aI.has(t))return l[0];let c=lI(e,a),d=l.filter(u=>u0?s(0)[0]??0:0}function lI(e,t){for(let n=t;nl.file)),r=new Set([...t.callSites.map(l=>l.file),...t.referencingFiles,...t.defs.map(l=>l.file)]),o=[],s=[],a=[];for(let l of n)(r.has(l)?o:s).push(l);for(let l of r)n.has(l)||a.push(l);return{both:o.sort(T),lspOnly:s.sort(T),staticOnly:a.sort(T)}}async function Y_(e,t,n,r,o,s){if(!r.capabilities.references)return{...n,lsp:os(o,"server does not provide textDocument/references")};if(!n.defs.length)return{...n,lsp:os(o,`no declaration of ${t} to anchor a request on`)};let a=new Set,l=[];try{for(let c of n.defs){let d=dI(e.root,c.file);if(!d)continue;r.didOpen(c.file,d,s??c.lang);let u=Gl(e.root,c.file,c.line,t);for(let f of await r.references(c.file,c.line,u)){let m=`${f.file}:${f.line}:${f.character??""}`;a.has(m)||(a.add(m),l.push(f))}}}catch(c){return{...n,lsp:{server:o,ok:!1,reason:c instanceof Error?c.message:String(c),refs:l.sort(Z_),agreement:Io(l,n)}}}return l.sort(Z_),{...n,lsp:{server:o,ok:!0,refs:l,agreement:Io(l,n)}}}function Z_(e,t){return T(e.file,t.file)||e.line-t.line||(e.character??0)-(t.character??0)}function dI(e,t){try{return oe(j(e,t),"utf8")}catch{return""}}var Hl,aI,ql=z(()=>{"use strict";$();Re();ge();de();Hl=/[\p{L}\p{N}_$]/u;aI=new Set(["abstract","async","const","declare","def","default","export","final","fn","fun","func","function","get","internal","let","open","override","private","protected","pub","public","readonly","set","static","type","val","var","virtual"])});function eb(e,t){if(!Array.isArray(t))return[];let n=[];for(let r of t){let o=r?.from;if(!o||typeof o.uri!="string"||typeof o.name!="string"||typeof o.kind!="number")continue;let s=Qs(e,{uri:o.uri,range:o.selectionRange})[0];if(!(!s||!Array.isArray(r.fromRanges)))for(let a of r.fromRanges){let l=a?.start;if(!(!Number.isInteger(l?.line)||l.line<0||!Number.isInteger(l?.character)||l.character<0))for(let c of Qs(e,{uri:o.uri,range:a}))n.push({...c,caller:{...s,name:o.name,kind:o.kind}})}}return Hn(n)}function Hn(e){let t=new Set;return e.filter(n=>{let r=JSON.stringify([n.file,n.line,n.character,n.caller]);return t.has(r)?!1:(t.add(r),!0)}).sort((n,r)=>T(n.file,r.file)||n.line-r.line||(n.character??0)-(r.character??0)||T(n.caller.name,r.caller.name)||n.caller.line-r.caller.line)}function Vl(e){let t=JSON.stringify(e);return`Content-Length: ${fI(t)}${uI}${t}`}function fI(e){return new TextEncoder().encode(e).byteLength}function If(){let e=new TextEncoder,t=new TextDecoder,n=new Uint8Array(0),r=[],o=0,s=0,a=0,l=f=>{n=n.subarray(f),a=0},c=f=>{r.push(f),o+=f.length},d=()=>{if(!r.length)return;let f=new Uint8Array(n.length+o);f.set(n);let m=n.length;for(let p of r)f.set(p,m),m+=p.length;n=f,r.length=0,o=0},u=()=>{for(let f=a;f+3Q_&&l(n.length-Q_),m;let g=t.decode(n.subarray(0,p)),h=/content-length:\s*(\d+)/i.exec(g);if(!h){l(p+4);continue}let _=Number(h[1]);if(!Number.isSafeInteger(_)||_<0||_>tb){l(p+4);continue}let y=p+4;if(n.lengthc===0||c===1&&/^[A-Za-z]:$/.test(l)?l:encodeURIComponent(l)).join("/")}function $f(e,t){if(typeof e!="string"){for(let l of e){let c=$f(l,t);if(c!==void 0)return c}return}if(!t.startsWith("file://"))return;let n;try{let l=t.slice(7);n=decodeURIComponent(l.startsWith("/")?l:`//${l}`).replace(/\\/g,"/")}catch{return}/^\/[A-Za-z]:/.test(n)&&(n=n.slice(1));let r=e.replace(/\\/g,"/").replace(/\/+$/,""),o=/^[A-Za-z]:/.test(r)||r.startsWith("//"),s=o?n.toLowerCase():n,a=o?r.toLowerCase():r;if(s===a)return"";if(s.startsWith(`${a}/`))return n.slice(r.length+1)}function Qs(e,t){let n=Array.isArray(t)?t:t&&typeof t=="object"?[t]:[],r=new Set,o=[];for(let s of n){if(!s||typeof s!="object")continue;let a=s.uri??s.targetUri;if(!a)continue;let l=$f(e,a);if(l===void 0||l==="")continue;let c=(s.range??s.targetSelectionRange??s.targetRange)?.start,d=typeof c?.line=="number"?c.line+1:1,u=typeof c?.character=="number"?c.character:void 0,f=`${l}:${d}:${u??""}`;r.has(f)||(r.add(f),o.push(u===void 0?{file:l,line:d}:{file:l,line:d,character:u}))}return o.sort((s,a)=>T(s.file,a.file)||s.line-a.line||(s.character??0)-(a.character??0))}var tb,Q_,uI,$o=z(()=>{"use strict";$();de();tb=32*1024*1024,Q_=64*1024,uI=`\r \r -`});function vf(e,t){let n=t.lastError?.();return n&&!e.includes(n)?`${e}: ${n}`:e}async function Rf(e,t){let n=t.timeoutMs??tI,r=t.startupTimeoutMs??nI,o=kf(),s=new Map,a=new Set,l=[t.root,...(t.rootAliases??[]).filter(y=>y!==t.root)],c=1,d,u=y=>{d=y;for(let[,b]of s)clearTimeout(b.timer),b.reject(y);s.clear()};e.onData(y=>{for(let b of o.push(y)){if(typeof b.id!="number")continue;let S=s.get(b.id);S&&(s.delete(b.id),clearTimeout(S.timer),b.error?S.reject(new Error(`${b.error.message} (code ${b.error.code})`)):S.resolve(b.result))}}),e.onExit(y=>u(new Error(vf(`language server exited (code ${y??"unknown"})`,e))));let f=(y,b)=>{d||e.write(Wl({jsonrpc:"2.0",method:y,params:b}))},m=(y,b,S=n)=>{if(d)return Promise.reject(d);let k=c++;return new Promise((R,I)=>{let P=setTimeout(()=>{s.delete(k),I(new Bl(y,S))},S);P.unref?.(),s.set(k,{resolve:R,reject:I,timer:P}),e.write(Wl({jsonrpc:"2.0",id:k,method:y,params:b}))})},p=await m("initialize",{processId:typeof F<"u"&&typeof F.pid=="number"?F.pid:null,rootUri:ns(t.root,""),workspaceFolders:[{uri:ns(t.root,""),name:"repo"}],capabilities:{textDocument:{references:{dynamicRegistration:!1},definition:{dynamicRegistration:!1,linkSupport:!0},implementation:{dynamicRegistration:!1,linkSupport:!0},callHierarchy:{dynamicRegistration:!1}}},...t.initializationOptions!==void 0?{initializationOptions:t.initializationOptions}:{}},r);f("initialized",{});let g=y=>{let b=p?.capabilities?.[y];return b===!0||typeof b=="object"&&b!==null},h={references:g("referencesProvider"),definition:g("definitionProvider"),implementation:g("implementationProvider"),typeHierarchy:g("typeHierarchyProvider"),callHierarchy:g("callHierarchyProvider")},_=(y,b,S)=>({textDocument:{uri:ns(t.root,y)},position:{line:Math.max(0,b-1),character:S}});return{capabilities:h,didOpen(y,b,S){a.has(y)||(a.add(y),f("textDocument/didOpen",{textDocument:{uri:ns(t.root,y),languageId:S,version:1,text:b}}))},async references(y,b,S){if(!h.references)return[];let k=await m("textDocument/references",{..._(y,b,S),context:{includeDeclaration:!0}});return Vs(l,k)},async definition(y,b,S){return h.definition?Vs(l,await m("textDocument/definition",_(y,b,S))):[]},async incomingCalls(y,b,S){if(!h.callHierarchy)return[];let k=await m("textDocument/prepareCallHierarchy",_(y,b,S));if(!Array.isArray(k))return[];let R=[];try{for(let I of k)!I||typeof I!="object"||R.push(...G_(l,await m("callHierarchy/incomingCalls",{item:I})))}catch(I){throw new vo(I,Bn(R))}return Bn(R)},alive(){return d===void 0},async shutdown(){try{for(let y of a)f("textDocument/didClose",{textDocument:{uri:ns(t.root,y)}});a.clear(),await m("shutdown",null,Math.min(n,2e3)),f("exit",void 0)}catch{}finally{u(new Error("session closed")),e.close()}}}}var Bl,vo,tI,nI,Ul=H(()=>{"use strict";$();Eo();Bl=class extends Error{constructor(t,n){super(`${t} exceeded ${n}ms`),this.name="LspTimeout"}},vo=class extends Error{constructor(n,r){super(n instanceof Error?n.message:String(n),{cause:n});this.calls=r;this.name="LspIncomingCallsError"}calls},tI=5e3,nI=15e3});function V_(e,t){let n="callers"in t?t.callers:void 0,r=new Set;if(Array.isArray(n))for(let s of n)s&&typeof s.file=="string"&&r.add(s.file);let o=new Set(e.map(s=>s.file));return{both:[...o].filter(s=>r.has(s)).sort(T),lspOnly:[...o].filter(s=>!r.has(s)).sort(T),staticOnly:[...r].filter(s=>!o.has(s)).sort(T)}}function zl(e,t){return{server:e,ok:!1,reason:t,calls:[],agreement:{both:[],lspOnly:[],staticOnly:[]}}}async function J_(e,t,n,r){let o=[];if(!n.capabilities.callHierarchy)return{calls:o,reason:"server does not provide textDocument/prepareCallHierarchy"};try{for(let s of t){let a=ie(j(e.root,s.file),"utf8");n.didOpen(s.file,a,r??s.lang),o.push(...await n.incomingCalls(s.file,s.line,Dl(e.root,s.file,s.line,s.name)))}return{calls:Bn(o)}}catch(s){return s instanceof vo&&o.push(...s.calls),{calls:Bn(o),reason:s instanceof Error?s.message:String(s)}}}var K_=H(()=>{"use strict";$();ke();me();ce();Ul();Eo();jl()});function Cf(e,t){let n;try{n=_m(e.command,e.args??[],{cwd:t,stdio:["pipe","pipe","pipe"],...e.env?{env:{...F.env,...e.env}}:{}})}catch{return}let r=!1,o="",s=d=>{o=(o+d).slice(-rI)},a=[],l=[],c=d=>{if(!r){r=!0;for(let u of l)u(d)}};return n.on("error",d=>{s(d.message),c(null)}),n.on("close",d=>c(d)),n.stdin?.on("error",()=>c(null)),n.stdout?.on("error",()=>c(null)),n.stderr?.on("error",()=>c(null)),n.stdout?.on("data",d=>{for(let u of a)u(d)}),n.stderr?.setEncoding("utf8"),n.stderr?.on("data",d=>s(String(d))),{write(d){if(!r)try{n.stdin?.write(d)}catch{c(null)}},onData(d){a.push(d)},lastError(){let d=o.split(/\r?\n/).map(f=>f.trim()).filter(Boolean),u=d[d.length-1];return u&&u.length>300?`${u.slice(0,300)}\u2026`:u},onExit(d){r?d(null):l.push(d)},kill(){if(!r)try{n.kill("SIGKILL")}catch{}},close(){try{n.stdin?.end()}catch{}let d=setTimeout(()=>{try{n.kill("SIGKILL")}catch{}},2e3);d.unref?.(),n.on("close",()=>clearTimeout(d))}}}var rI,Mf=H(()=>{"use strict";$();Qo();rI=2048});function sI(e){try{let t=rt(e);return t===e?[]:[t]}catch{return[]}}async function Hl(e,t){if(!Qt(e.command))return{ok:!1,reason:`${e.command} is not on PATH`};let n=Cf(e,t);if(!n)return{ok:!1,reason:`could not start ${e.command}`};try{return{ok:!0,session:await Rf(n,{root:t,rootAliases:sI(t),timeoutMs:Nl(e),startupTimeoutMs:W_(e),...e.initializationOptions!==void 0?{initializationOptions:e.initializationOptions}:{}}),transport:n}}catch(r){return n.close(),{ok:!1,reason:vf(r instanceof Error?r.message:String(r),n)}}}function iI(e){return Re(e.files.filter(t=>t.kind!=="doc").map(t=>`${t.rel}:${t.hash}`).join(` -`))}async function Af(e,t,n,r){if(n)return n.use(e,t.root,iI(t),r);let o=await Hl(e,t.root);if(!o.ok)return o;let s=!1;try{return{ok:!0,value:await r({session:o.session,get warm(){return s},markWarm:()=>{s=!0}})}}finally{await o.session.shutdown()}}function aI(){let e=F.env.CODEINDEX_LSP_IDLE_MS;if(e===void 0)return;let t=Number(e);return Number.isFinite(t)&&t>0?t:void 0}var oI,X_,Js,If=H(()=>{"use strict";$();ke();et();St();Ul();Pl();Mf();oI=5*6e4,X_=["SIGINT","SIGTERM","SIGHUP"],Js=class{entries=new Map;idleMs;open;live=new Set;killAll=()=>{for(let t of this.live)t.kill?.()};hooked=!1;closed=!1;constructor(t={}){this.idleMs=t.idleMs??aI()??oI,this.open=t.open??Hl}get size(){return this.entries.size}async use(t,n,r,o,s=!1){let a=JSON.stringify([n,t.id]),l=JSON.stringify(t),c=this.entries.get(a);c&&(c.identity!==l||c.stamp!==r)&&(this.retire(a,c),c=void 0);let d=c?await c.opening:void 0;c&&d?.ok&&!d.session.alive()&&(this.retire(a,c),c=void 0);let u=c!==void 0;if(!c){this.hook();let p=this.open(t,n).then(g=>(g.ok&&(this.live.add(g.transport),g.transport.onExit(()=>{this.live.delete(g.transport),this.closed&&this.unhook()})),g));c={identity:l,stamp:r,opening:p,warm:!1,busy:0,retired:!1},this.entries.set(a,c),d=await c.opening}if(!d?.ok)return this.entries.get(a)===c&&this.entries.delete(a),{ok:!1,reason:d?.reason??"language server did not start"};let f=c;f.busy++,f.idle&&clearTimeout(f.idle),f.idle=void 0;let m;try{m=await o({session:d.session,get warm(){return f.warm},markWarm:()=>{f.warm=!0}})}finally{f.busy--,f.busy===0&&(f.retired?this.shutdown(f):(f.idle=setTimeout(()=>this.retire(a,f),this.idleMs),f.idle.unref?.()))}return u&&!s&&!d.session.alive()?(this.retire(a,f),this.use(t,n,r,o,!0)):{ok:!0,value:m}}async close(){let t=[...this.entries.values()];this.entries.clear(),this.closed=!0,await Promise.all(t.map(n=>this.shutdown(n))),this.unhook()}retire(t,n){this.entries.get(t)===n&&this.entries.delete(t),n.retired=!0,n.busy===0&&this.shutdown(n)}async shutdown(t){t.idle&&clearTimeout(t.idle),t.idle=void 0;let n=await t.opening;n.ok&&await n.session.shutdown()}onSignal=t=>{this.killAll(),this.unhook(!0),F.listenerCount(t)===0&&F.kill(F.pid,t)};hook(){if(this.closed=!1,!this.hooked){this.hooked=!0,F.on("exit",this.killAll);for(let t of X_)F.on(t,this.onSignal)}}unhook(t=!1){if(!(!this.hooked||this.live.size&&!t)){this.hooked=!1,F.removeListener("exit",this.killAll);for(let n of X_)F.removeListener(n,this.onSignal)}}}});async function Ro(e,t,n=!1,r={}){let{path:o,source:s,ignored:a}=qs(t,r),l=a?{ignoredConfig:{path:a,reason:Ol}}:{},c=So(t,r);if(!c)return{lspVersion:1,mode:"none",configPath:o??null,source:s,...l,servers:[],unmappedLanguages:[]};let d=new Map;for(let p of e.files)d.set(p.lang,(d.get(p.lang)??0)+1);let u=[];for(let p of c.servers){let g={id:p.id,languages:p.languages,command:p.command,onPath:Qt(p.command),filesInRepo:p.languages.reduce((h,_)=>h+(d.get(_)??0),0)};if(n){let h=await Hl(p,e.root);h.ok?(g.reachable=!0,g.capabilities=h.session.capabilities,await h.session.shutdown()):(g.reachable=!1,g.error=h.reason)}u.push(g)}let f=new Set(c.servers.flatMap(p=>p.languages)),m=[...d.keys()].filter(p=>!f.has(p)&&p!=="other").sort();return{lspVersion:1,mode:"configured",configPath:o??null,source:s,...l,servers:u,unmappedLanguages:m}}async function Co(e,t,n,r,o={}){let s;try{s=So(t,o)}catch(p){return{...r,lsp:ts("(config)",p instanceof Error?p.message:String(p))}}if(!s){let p=qs(t,o).ignored;return p?{...r,lsp:ts("(config)",`${p} ignored: ${Ol}`)}:r}if(!r.defs.length)return{...r,lsp:ts("(none)",`no declaration of ${n} to anchor a request on`)};let{groups:a,reasons:l}=tb(s,r.defs),c=[],d=[],u=r.callSites.some(p=>!Z_(p,r.defs));for(let[p,g]of a){let h=await Af(p,e,o.pool,b=>eb(b,p,()=>z_(e,n,{...r,defs:g},b.session,p.id,p.languageId),S=>S.lsp?.ok?S.lsp.refs.some(k=>!Z_(k,g))?"full":"thin":"failed",u));if(!h.ok){l.push(`${p.id}: ${h.reason}`);continue}let{answer:_,partial:y}=h.value;_.lsp&&(d.push(..._.lsp.refs),_.lsp.ok||l.push(`${p.id}: ${_.lsp.reason??"request failed"}`)),y&&c.push(`${p.id}: ${Y_}`)}let f=new Set,m=d.filter(p=>{let g=JSON.stringify([p.file,p.line,p.character]);return f.has(g)?!1:(f.add(g),!0)}).sort((p,g)=>p.fileg.file?1:p.line-g.line||(p.character??0)-(g.character??0));return{...r,lsp:{server:[...a.keys()].map(p=>p.id).sort().join(", ")||"(none)",ok:l.length===0,...Q_(l,c),refs:m,agreement:ko(m,r)}}}async function Ks(e,t,n,r,o={}){let s;try{s=So(t,o)}catch(y){return{...r,lsp:zl("(config)",y instanceof Error?y.message:String(y))}}if(!s){let y=qs(t,o).ignored;return{...r,lsp:zl("(none)",y?`${y} ignored: ${Ol}`:"no LSP server configured")}}let a=n.indexOf("@"),l=a<0?n:n.slice(0,a),c=a<0?void 0:n.slice(a+1),d=wn(e,l,{maxResults:1/0}).filter(y=>c===void 0||y.file===c);if(!d.length)return{...r,lsp:zl("(none)",`no declaration of ${n} to anchor a request on`)};let{groups:u,reasons:f}=tb(s,d),m=[],p=[],g="callers"in r?r.callers:void 0,h=Array.isArray(g)&&g.length>0;for(let[y,b]of u){let S=await Af(y,e,o.pool,I=>eb(I,y,()=>J_(e,b,I.session,y.languageId),P=>P.reason?"failed":P.calls.length?"full":"thin",h));if(!S.ok){f.push(`${y.id}: ${S.reason}`);continue}let{answer:k,partial:R}=S.value;p.push(...k.calls),k.reason&&f.push(`${y.id}: ${k.reason}`),R&&m.push(`${y.id}: ${Y_}`)}let _=Bn(p);return{...r,lsp:{server:[...u.keys()].map(y=>y.id).sort().join(", ")||"(none)",ok:f.length===0,...Q_(f,m),calls:_,agreement:V_(_,r)}}}function Q_(e,t){let n=[...new Set([...e,...t])].sort();return{...t.length?{partial:!0}:{},...n.length?{reason:n.join("; ")}:{}}}function Z_(e,t){return t.some(n=>n.file===e.file&&n.line===e.line)}async function eb(e,t,n,r,o){let s=await n(),a=Nl(t);for(let l of[...lI,1/0]){let c=r(s);if(c==="full"&&e.markWarm(),c!=="thin")return{answer:s,partial:!1};if(!o||e.warm)return{answer:s,partial:!1};if(l>a)break;a-=l,await new Promise(d=>setTimeout(d,l)),s=await n()}return{answer:s,partial:!0}}function tb(e,t){let n=new Map,r=[];for(let o of t){let s=Sf(e,o.lang);if(!s){r.push(`no server configured for ${o.lang}`);continue}let a=n.get(s)??[];a.push(o),n.set(s,a)}return{groups:n,reasons:r}}var Y_,lI,Gl=H(()=>{"use strict";$();js();et();Pl();jl();K_();Eo();If();If();Y_="answered with declarations only while the static tier found call sites; the server may still be indexing, or those sites are homonyms";lI=[100,250,500,1e3]});function hI(e){let t=new Map(e.files.map(s=>[s.rel,s.lang])),n=new Set;for(let s of e.fileEdges){if(s.dangling||s.kind==="contains"||s.kind==="doc-link"||s.kind==="mention")continue;let a=t.get(s.from),l=t.get(s.to);a!==void 0&&n.add(a),l!==void 0&&n.add(l)}let r=new Set;for(let s of e.files)sb.has(s.lang)&&(s.degIn>0||s.degOut>0&&!s.testFile)&&r.add(`${s.lang}\0${ib(s.rel)}`);let o=[];for(let s of e.files)s.fileKind!=="code"||s.degIn!==0||s.degOut!==0||s.testFile||!n.has(s.lang)||yI(s.rel)||sb.has(s.lang)&&r.has(`${s.lang}\0${ib(s.rel)}`)||o.push(s.rel);return o}function yI(e){let n=e.split("/").pop().split(".")[0].toLowerCase();return gI.has(n)}function $f(e){return Array.isArray(e)?e:[e]}function ql(e,t){let n;try{n=JSON.parse(e)}catch(r){let o=/position (\d+)/.exec(r instanceof Error?r.message:""),s="";if(o){let a=e.slice(0,Number(o[1]));s=` (line ${a.split(` +`});function Tf(e,t){let n=t.lastError?.();return n&&!e.includes(n)?`${e}: ${n}`:e}async function Ff(e,t){let n=t.timeoutMs??mI,r=t.startupTimeoutMs??pI,o=If(),s=new Map,a=new Set,l=[t.root,...(t.rootAliases??[]).filter(y=>y!==t.root)],c=1,d,u=y=>{d=y;for(let[,b]of s)clearTimeout(b.timer),b.reject(y);s.clear()};e.onData(y=>{for(let b of o.push(y)){if(typeof b.id!="number")continue;let S=s.get(b.id);S&&(s.delete(b.id),clearTimeout(S.timer),b.error?S.reject(new Error(`${b.error.message} (code ${b.error.code})`)):S.resolve(b.result))}}),e.onExit(y=>u(new Error(Tf(`language server exited (code ${y??"unknown"})`,e))));let f=(y,b)=>{d||e.write(Vl({jsonrpc:"2.0",method:y,params:b}))},m=(y,b,S=n)=>{if(d)return Promise.reject(d);let k=c++;return new Promise((C,I)=>{let P=setTimeout(()=>{s.delete(k),I(new Jl(y,S))},S);P.unref?.(),s.set(k,{resolve:C,reject:I,timer:P}),e.write(Vl({jsonrpc:"2.0",id:k,method:y,params:b}))})},p=await m("initialize",{processId:typeof F<"u"&&typeof F.pid=="number"?F.pid:null,rootUri:as(t.root,""),workspaceFolders:[{uri:as(t.root,""),name:"repo"}],capabilities:{textDocument:{references:{dynamicRegistration:!1},definition:{dynamicRegistration:!1,linkSupport:!0},implementation:{dynamicRegistration:!1,linkSupport:!0},callHierarchy:{dynamicRegistration:!1}}},...t.initializationOptions!==void 0?{initializationOptions:t.initializationOptions}:{}},r);f("initialized",{});let g=y=>{let b=p?.capabilities?.[y];return b===!0||typeof b=="object"&&b!==null},h={references:g("referencesProvider"),definition:g("definitionProvider"),implementation:g("implementationProvider"),typeHierarchy:g("typeHierarchyProvider"),callHierarchy:g("callHierarchyProvider")},_=(y,b,S)=>({textDocument:{uri:as(t.root,y)},position:{line:Math.max(0,b-1),character:S}});return{capabilities:h,didOpen(y,b,S){a.has(y)||(a.add(y),f("textDocument/didOpen",{textDocument:{uri:as(t.root,y),languageId:S,version:1,text:b}}))},async references(y,b,S){if(!h.references)return[];let k=await m("textDocument/references",{..._(y,b,S),context:{includeDeclaration:!0}});return Qs(l,k)},async definition(y,b,S){return h.definition?Qs(l,await m("textDocument/definition",_(y,b,S))):[]},async incomingCalls(y,b,S){if(!h.callHierarchy)return[];let k=await m("textDocument/prepareCallHierarchy",_(y,b,S));if(!Array.isArray(k))return[];let C=[];try{for(let I of k)!I||typeof I!="object"||C.push(...eb(l,await m("callHierarchy/incomingCalls",{item:I})))}catch(I){throw new To(I,Hn(C))}return Hn(C)},alive(){return d===void 0},async shutdown(){try{for(let y of a)f("textDocument/didClose",{textDocument:{uri:as(t.root,y)}});a.clear(),await m("shutdown",null,Math.min(n,2e3)),f("exit",void 0)}catch{}finally{u(new Error("session closed")),e.close()}}}}var Jl,To,mI,pI,Kl=z(()=>{"use strict";$();$o();Jl=class extends Error{constructor(t,n){super(`${t} exceeded ${n}ms`),this.name="LspTimeout"}},To=class extends Error{constructor(n,r){super(n instanceof Error?n.message:String(n),{cause:n});this.calls=r;this.name="LspIncomingCallsError"}calls},mI=5e3,pI=15e3});function nb(e,t){let n="callers"in t?t.callers:void 0,r=new Set;if(Array.isArray(n))for(let s of n)s&&typeof s.file=="string"&&r.add(s.file);let o=new Set(e.map(s=>s.file));return{both:[...o].filter(s=>r.has(s)).sort(T),lspOnly:[...o].filter(s=>!r.has(s)).sort(T),staticOnly:[...r].filter(s=>!o.has(s)).sort(T)}}function Xl(e,t){return{server:e,ok:!1,reason:t,calls:[],agreement:{both:[],lspOnly:[],staticOnly:[]}}}async function rb(e,t,n,r){let o=[];if(!n.capabilities.callHierarchy)return{calls:o,reason:"server does not provide textDocument/prepareCallHierarchy"};try{for(let s of t){let a=oe(j(e.root,s.file),"utf8");n.didOpen(s.file,a,r??s.lang),o.push(...await n.incomingCalls(s.file,s.line,Gl(e.root,s.file,s.line,s.name)))}return{calls:Hn(o)}}catch(s){return s instanceof To&&o.push(...s.calls),{calls:Hn(o),reason:s instanceof Error?s.message:String(s)}}}var sb=z(()=>{"use strict";$();Re();ge();de();Kl();$o();ql()});function Of(e,t){let n;try{n=Mm(e.command,e.args??[],{cwd:t,stdio:["pipe","pipe","pipe"],...e.env?{env:{...F.env,...e.env}}:{}})}catch{return}let r=!1,o="",s=d=>{o=(o+d).slice(-gI)},a=[],l=[],c=d=>{if(!r){r=!0;for(let u of l)u(d)}};return n.on("error",d=>{s(d.message),c(null)}),n.on("close",d=>c(d)),n.stdin?.on("error",()=>c(null)),n.stdout?.on("error",()=>c(null)),n.stderr?.on("error",()=>c(null)),n.stdout?.on("data",d=>{for(let u of a)u(d)}),n.stderr?.setEncoding("utf8"),n.stderr?.on("data",d=>s(String(d))),{write(d){if(!r)try{n.stdin?.write(d)}catch{c(null)}},onData(d){a.push(d)},lastError(){let d=o.split(/\r?\n/).map(f=>f.trim()).filter(Boolean),u=d[d.length-1];return u&&u.length>300?`${u.slice(0,300)}\u2026`:u},onExit(d){r?d(null):l.push(d)},kill(){if(!r)try{n.kill("SIGKILL")}catch{}},close(){try{n.stdin?.end()}catch{}let d=setTimeout(()=>{try{n.kill("SIGKILL")}catch{}},2e3);d.unref?.(),n.on("close",()=>clearTimeout(d))}}}var gI,Nf=z(()=>{"use strict";$();oa();gI=2048});function hI(e){try{let t=ct(e);return t===e?[]:[t]}catch{return[]}}async function Zl(e,t){if(!sn(e.command))return{ok:!1,reason:`${e.command} is not on PATH`};let n=Of(e,t);if(!n)return{ok:!1,reason:`could not start ${e.command}`};try{return{ok:!0,session:await Ff(n,{root:t,rootAliases:hI(t),timeoutMs:Ul(e),startupTimeoutMs:K_(e),...e.initializationOptions!==void 0?{initializationOptions:e.initializationOptions}:{}}),transport:n}}catch(r){return n.close(),{ok:!1,reason:Tf(r instanceof Error?r.message:String(r),n)}}}function yI(e){return Ae(e.files.filter(t=>t.kind!=="doc").map(t=>`${t.rel}:${t.hash}`).join(` +`))}async function Pf(e,t,n,r){if(n)return n.use(e,t.root,yI(t),r);let o=await Zl(e,t.root);if(!o.ok)return o;let s=!1;try{return{ok:!0,value:await r({session:o.session,get warm(){return s},markWarm:()=>{s=!0}})}}finally{await o.session.shutdown()}}function bI(){let e=F.env.CODEINDEX_LSP_IDLE_MS;if(e===void 0)return;let t=Number(e);return Number.isFinite(t)&&t>0?t:void 0}var _I,ib,ei,Lf=z(()=>{"use strict";$();Re();it();At();Kl();zl();Nf();_I=5*6e4,ib=["SIGINT","SIGTERM","SIGHUP"],ei=class{entries=new Map;idleMs;open;live=new Set;killAll=()=>{for(let t of this.live)t.kill?.()};hooked=!1;closed=!1;constructor(t={}){this.idleMs=t.idleMs??bI()??_I,this.open=t.open??Zl}get size(){return this.entries.size}async use(t,n,r,o,s=!1){let a=JSON.stringify([n,t.id]),l=JSON.stringify(t),c=this.entries.get(a);c&&(c.identity!==l||c.stamp!==r)&&(this.retire(a,c),c=void 0);let d=c?await c.opening:void 0;c&&d?.ok&&!d.session.alive()&&(this.retire(a,c),c=void 0);let u=c!==void 0;if(!c){this.hook();let p=this.open(t,n).then(g=>(g.ok&&(this.live.add(g.transport),g.transport.onExit(()=>{this.live.delete(g.transport),this.closed&&this.unhook()})),g));c={identity:l,stamp:r,opening:p,warm:!1,busy:0,retired:!1},this.entries.set(a,c),d=await c.opening}if(!d?.ok)return this.entries.get(a)===c&&this.entries.delete(a),{ok:!1,reason:d?.reason??"language server did not start"};let f=c;f.busy++,f.idle&&clearTimeout(f.idle),f.idle=void 0;let m;try{m=await o({session:d.session,get warm(){return f.warm},markWarm:()=>{f.warm=!0}})}finally{f.busy--,f.busy===0&&(f.retired?this.shutdown(f):(f.idle=setTimeout(()=>this.retire(a,f),this.idleMs),f.idle.unref?.()))}return u&&!s&&!d.session.alive()?(this.retire(a,f),this.use(t,n,r,o,!0)):{ok:!0,value:m}}async close(){let t=[...this.entries.values()];this.entries.clear(),this.closed=!0,await Promise.all(t.map(n=>this.shutdown(n))),this.unhook()}retire(t,n){this.entries.get(t)===n&&this.entries.delete(t),n.retired=!0,n.busy===0&&this.shutdown(n)}async shutdown(t){t.idle&&clearTimeout(t.idle),t.idle=void 0;let n=await t.opening;n.ok&&await n.session.shutdown()}onSignal=t=>{this.killAll(),this.unhook(!0),F.listenerCount(t)===0&&F.kill(F.pid,t)};hook(){if(this.closed=!1,!this.hooked){this.hooked=!0,F.on("exit",this.killAll);for(let t of ib)F.on(t,this.onSignal)}}unhook(t=!1){if(!(!this.hooked||this.live.size&&!t)){this.hooked=!1,F.removeListener("exit",this.killAll);for(let n of ib)F.removeListener(n,this.onSignal)}}}});async function Fo(e,t,n=!1,r={}){let{path:o,source:s,ignored:a}=Ys(t,r),l=a?{ignoredConfig:{path:a,reason:Bl}}:{},c=Ao(t,r);if(!c)return{lspVersion:1,mode:"none",configPath:o??null,source:s,...l,servers:[],unmappedLanguages:[]};let d=new Map;for(let p of e.files)d.set(p.lang,(d.get(p.lang)??0)+1);let u=[];for(let p of c.servers){let g={id:p.id,languages:p.languages,command:p.command,onPath:sn(p.command),filesInRepo:p.languages.reduce((h,_)=>h+(d.get(_)??0),0)};if(n){let h=await Zl(p,e.root);h.ok?(g.reachable=!0,g.capabilities=h.session.capabilities,await h.session.shutdown()):(g.reachable=!1,g.error=h.reason)}u.push(g)}let f=new Set(c.servers.flatMap(p=>p.languages)),m=[...d.keys()].filter(p=>!f.has(p)&&p!=="other").sort();return{lspVersion:1,mode:"configured",configPath:o??null,source:s,...l,servers:u,unmappedLanguages:m}}async function Oo(e,t,n,r,o={}){let s;try{s=Ao(t,o)}catch(p){return{...r,lsp:os("(config)",p instanceof Error?p.message:String(p))}}if(!s){let p=Ys(t,o).ignored;return p?{...r,lsp:os("(config)",`${p} ignored: ${Bl}`)}:r}if(!r.defs.length)return{...r,lsp:os("(none)",`no declaration of ${n} to anchor a request on`)};let{groups:a,reasons:l}=db(s,r.defs),c=[],d=[],u=r.callSites.some(p=>!ob(p,r.defs));for(let[p,g]of a){let h=await Pf(p,e,o.pool,b=>cb(b,p,()=>Y_(e,n,{...r,defs:g},b.session,p.id,p.languageId),S=>S.lsp?.ok?S.lsp.refs.some(k=>!ob(k,g))?"full":"thin":"failed",u));if(!h.ok){l.push(`${p.id}: ${h.reason}`);continue}let{answer:_,partial:y}=h.value;_.lsp&&(d.push(..._.lsp.refs),_.lsp.ok||l.push(`${p.id}: ${_.lsp.reason??"request failed"}`)),y&&c.push(`${p.id}: ${ab}`)}let f=new Set,m=d.filter(p=>{let g=JSON.stringify([p.file,p.line,p.character]);return f.has(g)?!1:(f.add(g),!0)}).sort((p,g)=>p.fileg.file?1:p.line-g.line||(p.character??0)-(g.character??0));return{...r,lsp:{server:[...a.keys()].map(p=>p.id).sort().join(", ")||"(none)",ok:l.length===0,...lb(l,c),refs:m,agreement:Io(m,r)}}}async function ti(e,t,n,r,o={}){let s;try{s=Ao(t,o)}catch(y){return{...r,lsp:Xl("(config)",y instanceof Error?y.message:String(y))}}if(!s){let y=Ys(t,o).ignored;return{...r,lsp:Xl("(none)",y?`${y} ignored: ${Bl}`:"no LSP server configured")}}let a=n.indexOf("@"),l=a<0?n:n.slice(0,a),c=a<0?void 0:n.slice(a+1),d=En(e,l,{maxResults:1/0}).filter(y=>c===void 0||y.file===c);if(!d.length)return{...r,lsp:Xl("(none)",`no declaration of ${n} to anchor a request on`)};let{groups:u,reasons:f}=db(s,d),m=[],p=[],g="callers"in r?r.callers:void 0,h=Array.isArray(g)&&g.length>0;for(let[y,b]of u){let S=await Pf(y,e,o.pool,I=>cb(I,y,()=>rb(e,b,I.session,y.languageId),P=>P.reason?"failed":P.calls.length?"full":"thin",h));if(!S.ok){f.push(`${y.id}: ${S.reason}`);continue}let{answer:k,partial:C}=S.value;p.push(...k.calls),k.reason&&f.push(`${y.id}: ${k.reason}`),C&&m.push(`${y.id}: ${ab}`)}let _=Hn(p);return{...r,lsp:{server:[...u.keys()].map(y=>y.id).sort().join(", ")||"(none)",ok:f.length===0,...lb(f,m),calls:_,agreement:nb(_,r)}}}function lb(e,t){let n=[...new Set([...e,...t])].sort();return{...t.length?{partial:!0}:{},...n.length?{reason:n.join("; ")}:{}}}function ob(e,t){return t.some(n=>n.file===e.file&&n.line===e.line)}async function cb(e,t,n,r,o){let s=await n(),a=Ul(t);for(let l of[...wI,1/0]){let c=r(s);if(c==="full"&&e.markWarm(),c!=="thin")return{answer:s,partial:!1};if(!o||e.warm)return{answer:s,partial:!1};if(l>a)break;a-=l,await new Promise(d=>setTimeout(d,l)),s=await n()}return{answer:s,partial:!0}}function db(e,t){let n=new Map,r=[];for(let o of t){let s=Af(e,o.lang);if(!s){r.push(`no server configured for ${o.lang}`);continue}let a=n.get(s)??[];a.push(o),n.set(s,a)}return{groups:n,reasons:r}}var ab,wI,Yl=z(()=>{"use strict";$();Gs();it();zl();ql();sb();$o();Lf();Lf();ab="answered with declarations only while the static tier found call sites; the server may still be indexing, or those sites are homonyms";wI=[100,250,500,1e3]});function MI(e){let t=new Map(e.files.map(s=>[s.rel,s.lang])),n=new Set;for(let s of e.fileEdges){if(s.dangling||s.kind==="contains"||s.kind==="doc-link"||s.kind==="mention")continue;let a=t.get(s.from),l=t.get(s.to);a!==void 0&&n.add(a),l!==void 0&&n.add(l)}let r=new Set;for(let s of e.files)mb.has(s.lang)&&(s.degIn>0||s.degOut>0&&!s.testFile)&&r.add(`${s.lang}\0${pb(s.rel)}`);let o=[];for(let s of e.files)s.fileKind!=="code"||s.degIn!==0||s.degOut!==0||s.testFile||!n.has(s.lang)||AI(s.rel)||mb.has(s.lang)&&r.has(`${s.lang}\0${pb(s.rel)}`)||o.push(s.rel);return o}function AI(e){let n=e.split("/").pop().split(".")[0].toLowerCase();return CI.has(n)}function Df(e){return Array.isArray(e)?e:[e]}function Ql(e,t){let n;try{n=JSON.parse(e)}catch(r){let o=/position (\d+)/.exec(r instanceof Error?r.message:""),s="";if(o){let a=e.slice(0,Number(o[1]));s=` (line ${a.split(` `).length}, column ${a.length-a.lastIndexOf(` -`)})`}throw new Error(`rules config ${t} is not valid JSON${s}`)}try{return Vl(n)}catch(r){throw new Error(`rules config ${t}: ${r instanceof Error?r.message:String(r)}`)}}function Vl(e){let t=Array.isArray(e)?e:e?.rules;if(!Array.isArray(t))throw new Error("rules config must be an array (or an object with a `rules` array)");return t.map((n,r)=>{let o=`rules[${r}]`;if(typeof n!="object"||n===null||Array.isArray(n))throw new Error(`${o}: must be an object`);let s=n;if(typeof s.name!="string"||!s.name)throw new Error(`${o}: \`name\` (non-empty string) is required`);let a=s.builtin===void 0?fI:s.builtin==="literals"?mI:ab,l=Object.keys(s).filter(f=>!a.has(f)).sort(T);if(l.length){let f=s.builtin===void 0?"a forbidden-edge rule":`builtin "${String(s.builtin)}"`;throw new Error(`${o} (${s.name}): unknown key${l.length>1?"s":""} ${l.map(m=>`\`${m}\``).join(", ")} \u2014 ${f} takes ${[...a].join(", ")}`)}if(s.severity!==void 0&&!dI.has(s.severity))throw new Error(`${o} (${s.name}): \`severity\` must be "error" or "warn"`);if(s.comment!==void 0&&typeof s.comment!="string")throw new Error(`${o} (${s.name}): \`comment\` must be a string`);if(s.builtin!==void 0){if(!uI.has(s.builtin))throw new Error(`${o} (${s.name}): \`builtin\` must be "cycles", "orphans" or "literals"`);if(s.tiers!==void 0&&!(Array.isArray(s.tiers)&&s.tiers.length>0&&s.tiers.every(m=>rb.has(m))))throw new Error(`${o} (${s.name}): \`tiers\` must be a non-empty array of ${[...rb].join(", ")}`);for(let f of["minFiles","minCount"]){let m=s[f];if(m!==void 0&&!(typeof m=="number"&&Number.isInteger(m)&&m>=1))throw new Error(`${o} (${s.name}): \`${f}\` must be a positive integer`)}if(s.includeTests!==void 0&&typeof s.includeTests!="boolean")throw new Error(`${o} (${s.name}): \`includeTests\` must be a boolean`);return{name:s.name,builtin:s.builtin,severity:s.severity,comment:s.comment,...s.tiers!==void 0?{tiers:s.tiers}:{},...s.minFiles!==void 0?{minFiles:s.minFiles}:{},...s.minCount!==void 0?{minCount:s.minCount}:{},...s.includeTests!==void 0?{includeTests:s.includeTests}:{}}}let c=f=>{let m=s[f];if(!(typeof m=="string"?m.length>0:Array.isArray(m)&&m.length>0&&m.every(g=>typeof g=="string"&&g)))throw new Error(`${o} (${s.name}): \`${f}\` must be a glob or a non-empty array of globs`);return m},d=c("from"),u=c("to");if(s.kind!==void 0&&!(Array.isArray(s.kind)&&s.kind.length>0&&s.kind.every(m=>nb.has(m))))throw new Error(`${o} (${s.name}): \`kind\` must be a non-empty array of edge kinds (${[...nb].join(", ")})`);return{name:s.name,from:d,to:u,kind:s.kind,severity:s.severity,comment:s.comment}})}function _I(e){let t=new Map;for(let u of e.moduleEdges){if(u.kind!=="import")continue;let f=t.get(u.from);f||t.set(u.from,f=[]),f.push(u.to)}for(let u of t.values())u.sort(T);let n=[...t.keys()].sort(T),r=new Map,o=new Map,s=new Set,a=[],l=[],c=0;for(let u of n){if(r.has(u))continue;let f=[{node:u,next:0}];for(;f.length;){let m=f[f.length-1],p=m.node;m.next===0&&(r.set(p,c),o.set(p,c),c++,a.push(p),s.add(p));let g=t.get(p)??[];if(m.next1&&l.push(_)}f.pop();let h=f[f.length-1];h&&o.set(h.node,Math.min(o.get(h.node),o.get(p)))}}}let d=[];for(let u of l){let f=new Set(u),m=[...u].sort(T)[0],p=new Map([[m,null]]),g=[m];for(let y=0;y(t.get(y)??[]).includes(m)&&y!==m)??m,_=[];for(let y=h;y!==null;y=p.get(y)??null)_.unshift(y);_.push(m),d.push({start:m,path:_})}return d}function Mo(e,t,n={}){let r=[],o=(c,d)=>{r.push({rule:c.name,...d,severity:c.severity??"error",...c.comment!==void 0?{comment:c.comment}:{}})},s=new Set(e.files.map(c=>c.rel)),a=new Map,l=c=>{if(!n.scan)return e.literalDuplications??[];let d=`${c.minFiles??""}\0${c.minCount??""}\0${c.includeTests===!0}`,u=a.get(d);return u||(u=Dn(n.scan,{minFiles:c.minFiles,minCount:c.minCount,includeTests:c.includeTests}).duplications,a.set(d,u)),u};for(let c of t){if("builtin"in c){if(c.builtin==="cycles")for(let p of _I(e))o(c,{from:p.start,to:p.path.join(" -> "),kind:"cycle"});else if(c.builtin==="literals"){let p=new Set(c.tiers?.length?c.tiers:pI);for(let g of l(c)){if(!p.has(g.tier))continue;let h=g.holders[0]??g.literals[0];o(c,{from:`${h.file}:${h.line}`,to:`${g.tier} ${JSON.stringify(g.value)} (${g.count} sites, ${g.files} files)`,kind:"literal"})}}else for(let p of hI(e))o(c,{from:p,to:p,kind:"orphan"});continue}let d=It($f(c.from)),u=It($f(c.to));if(!d||!u)continue;let f=!1;for(let[p,g]of[["from",d],["to",u]])e.files.some(h=>g(h.rel))||(f=!0,r.push({rule:c.name,from:$f(c[p]).join(", "),to:`\`${p}\` matches no indexed file`,kind:"unmatched",severity:"warn"}));if(f)continue;let m=c.kind?.length?new Set(c.kind):null;for(let p of e.fileEdges)p.dangling||!s.has(p.to)||m&&!m.has(p.kind)||!d(p.from)||!u(p.to)||o(c,{from:p.from,to:p.to,kind:p.kind})}return r.sort((c,d)=>T(c.rule,d.rule)||T(c.from,d.from)||T(c.to,d.to)||T(c.kind,d.kind)),r}function Jl(e){let t=e.filter(n=>n.severity==="error").length;return{errors:t,warnings:e.length-t,violations:e}}var cI,nb,dI,uI,rb,ob,fI,ab,mI,pI,gI,sb,ib,Kl=H(()=>{"use strict";$();_i();Us();ce();cI={contains:!0,"doc-link":!0,import:!0,call:!0,extends:!0,implements:!0,use:!0,mention:!0},nb=new Set(Object.keys(cI)),dI=new Set(["error","warn"]),uI=new Set(["cycles","orphans","literals"]),rb=new Set(["competing","bypassed","uncentralized"]),ob=["name","severity","comment"],fI=new Set([...ob,"from","to","kind"]),ab=new Set([...ob,"builtin"]),mI=new Set([...ab,"tiers","minFiles","minCount","includeTests"]),pI=["competing","bypassed"],gI=new Set(["index","main","app","application","cli","server","entry","entrypoint","setup","conftest","__init__","__main__","mod","lib","wsgi","asgi","manage"]),sb=new Set(["go","java","kotlin","scala"]),ib=e=>e.includes("/")?e.slice(0,e.lastIndexOf("/")):""});function RI(e){return Cs(Ao(e)||"(root)")===2||/(^|\/)testdata\//.test(e)}function lb(e){if(wI.has(e.kind))return!0;if(e.kind!=="const"||!e.signature)return!1;let t=Fe(e.lang);return t==="js"?xI.test(e.signature):t==="python"&&SI.test(e.signature)}function CI(e){switch(Fe(e.lang)){case"python":return/^__\w+__$/.test(e.name);case"go":return e.name==="init"||e.name==="main";case"js":return e.name==="constructor";default:return!1}}function Io(e,t={}){let n=t.kinds==="all",r=Ns(e),o=Ot(e),s=ir(e,o),a=II(e,o,s),l=m=>{let p=r.get(`${m.name}@${m.file}`)??r.get(m.name);return!!p&&p.def.file===m.file&&p.callers.length>0},c=MI(e,s,m=>l(m)||a.has(`${m.name}${_t}${m.file}`)),d=[];for(let m of e.files)if(!Ft(m.rel)&&!(!t.includeTail&&RI(m.rel)))for(let p of m.symbols)!p.exported||bI.has(p.kind)||CI(p)||!n&&!lb(p)||a.has(`${p.name}${_t}${p.file}`)||l(p)||c(p)||d.push(p);let u=AI(e,d,s),f=[];for(let m of d){let p=u(m);p&&!lb(m)||f.push({name:m.name,file:m.file,line:m.line,kind:m.kind,tier:p?"uncalled":"unreferenced"})}return f.sort((m,p)=>T(m.tier,p.tier)||T(m.file,p.file)||m.line-p.line)}function MI(e,t,n){let r=[...t];for(let d of Gi(e))r.push({...d,kind:"implements"});let o=new Map;for(let{sub:d,sup:u}of Su(e,r)){let f=o.get(d)??[];f.push(u),o.set(d,f)}let s=new Map;for(let d of t){let u=`${d.from}${_t}${d.fromFile}`;s.set(u,(s.get(u)??0)+1)}let a=new Set;for(let d of e.files){if(Fe(d.lang)==="go")continue;let u=new Map;for(let f of d.relations??[])u.set(f.from,(u.get(f.from)??0)+1);for(let[f,m]of u)m>(s.get(`${f}${_t}${d.rel}`)??0)&&a.add(`${f}${_t}${d.rel}`)}let l=new Map,c=(d,u)=>{let f=l.get(d);if(f!==void 0)return f;let m=o.get(d),p;return m?(u.add(d),p=m.some(g=>n(g)||!u.has(g)&&c(g,u))):p=!!d.parent&&a.has(`${d.parent}${_t}${d.file}`),l.set(d,p),p};return d=>!!d.parent&&c(d,new Set)}function AI(e,t,n){let r=new Map;for(let m of t){let p=Fe(m.lang),g=r.get(p);g||r.set(p,g=new Map),g.has(m.name)||g.set(m.name,[])}let o=(m,p,g)=>{if(p===void 0)return;let h=m?.get(p);h&&h.length<2&&h[h.length-1]!==g&&h.push(g)},s=new Map,a=new Set;for(let m of e.files){if(m.kind!=="code")continue;s.set(m.rel,m.lang);let p=Fe(m.lang),g=r.get(p);if(g){m.idents===void 0&&a.add(p);for(let h of m.idents??[])o(g,h,m.rel);for(let h of m.calls??[])o(g,h.name,m.rel),o(g,h.receiver,m.rel);for(let h of m.importedNames??[])o(g,h,m.rel);for(let h of m.importAliases??[])o(g,h.name,m.rel),o(g,h.local,m.rel);for(let h of m.relations??[])o(g,h.to,"")}}for(let m of n)o(r.get(Fe(s.get(m.toFile)??"")),m.to,"");let l=cl(e),c=m=>(r.get(Fe(m.lang))?.get(m.name)??[]).some(g=>g!==m.file)||[...l.get(m.name)??[]].some(g=>g!==m.file),d=new Map;for(let m of t){let p=Fe(m.lang);if(c(m)||vI.test(m.name)&&!a.has(p))continue;let g=d.get(p);g||d.set(p,g=new Set),g.add(m.name)}if(d.size)for(let m of e.files){if(m.kind!=="code")continue;let p=Fe(m.lang),g=d.get(p);if(!g)continue;let h=re(j(e.root,m.rel)),_=p==="js"?/[A-Za-z_$][\w$]*/g:/[A-Za-z_]\w*/g,y=new Set;for(let b of h.match(_)??[])g.has(b)&&y.add(b);for(let b of y)o(r.get(p),b,m.rel)}let u=new Set,f=new Map;for(let m of t){if(c(m))continue;let p=f.get(m.file)??[];p.push(m),f.set(m.file,p)}for(let[m,p]of f){let g=new Set(p.map(y=>y.name)),h=Fe(p[0].lang)==="js"?/[A-Za-z_$][\w$]*/g:/[A-Za-z_]\w*/g,_=new Map;al(re(j(e.root,m)),p[0].lang).split(` -`).forEach((y,b)=>{for(let S of y.match(h)??[])g.has(S)&&(_.get(S)??_.set(S,[]).get(S)).push(b+1)});for(let y of p){let b=y.endLine??y.line;(_.get(y.name)??[]).some(S=>Sb)&&u.add(y)}}return m=>u.has(m)||c(m)}function II(e,t,n){let r=cn(e),o=new Map(e.files.map(p=>[p.rel,p])),s=FI(e,r,o);if(!s.length)for(let p of e.files)p.kind==="code"&&EI.test(p.rel)&&s.push({rel:p.rel});for(let p of e.files)(p.rel==="__init__.py"||p.rel.endsWith("/__init__.py"))&&s.push({rel:p.rel});let a=Ds(t),l=new Set,c=new Set;for(let p=0;p<5&&s.length;p++){let g=[];for(let{rel:h,names:_}of s){let y=`${h}${_t}${_?[..._].sort(T).join(","):"*"}`;if(c.has(y))continue;c.add(y);let b=o.get(h);if(!b)continue;let S=new Set;for(let k of b.symbols)if(k.kind==="reexport")(!_||_.has(k.name))&&S.add(k.name);else if(k.kind==="reexport-all"){let R=/^\* \((.+)\)$/.exec(k.name)?.[1],I=R===void 0?void 0:ct(h,b.ext,R,r);I?.kind==="resolved"&&g.push({rel:I.target,..._?{names:_}:{}})}else k.exported&&k.kind!=="default"&&(!_||_.has(k.name))&&l.add(`${k.name}${_t}${k.file}`);if(S.size)for(let k of[...a.get(h)??[]].sort(T))g.push({rel:k,names:S})}s=g}for(let p of $I(e,r))l.add(p);let d=new Map;for(let p of n){let g=`${p.from}${_t}${p.fromFile}`,h=d.get(g)??[];h.push(`${p.to}${_t}${p.toFile}`),d.set(g,h)}let u=new Map;for(let p of e.files)for(let g of p.symbols){if(!g.parent)continue;let h=`${g.parent}${_t}${g.file}`,_=u.get(h)??[];_.push(`${g.name}${_t}${g.file}`),u.set(h,_)}let f=new Set;for(let p of e.files)for(let g of p.symbols)kI.has(g.kind)&&f.add(`${g.name}${_t}${g.file}`);let m=[...l].sort(T);for(;m.length;){let p=m.pop(),g=[...d.get(p)??[],...f.has(p)?u.get(p)??[]:[]];for(let h of g)l.has(h)||(l.add(h),m.push(h))}return l}function $I(e,t){let n=[],r=new Set;for(let a of e.files)a.lang==="go"&&!a.rel.endsWith("_test.go")&&a.symbols.some(l=>l.name==="main"&&!l.parent&&l.kind==="function")&&r.add(Ao(a.rel));let o=[];for(let a of e.files){let l=a.rel.slice(a.rel.lastIndexOf("/")+1);if(l!=="build.gradle"&&l!=="build.gradle.kts"&&l!=="pom.xml")continue;let c=re(j(e.root,a.rel));(l==="pom.xml"?/|maven-deploy-plugin|central-publishing-maven-plugin|nexus-staging-maven-plugin/.test(c):/\bjava-library\b|\bmaven-publish\b|com\.vanniktech\.maven\.publish/.test(c))&&o.push(Ao(a.rel))}let s=(a,l)=>!l||a.startsWith(l+"/");for(let a of e.files)if(!(a.kind!=="code"||Ft(a.rel))){if(a.lang==="go"){if(a.rel.endsWith("_test.go"))continue;let l=t.goModules.find(u=>s(a.rel,u.dir));if(!l)continue;let c=Ao(a.rel),d=l.dir?c.slice(l.dir.length+1):c;if(r.has(c)||/(^|\/)internal(\/|$)/.test(d))continue;for(let u of a.symbols)u.exported&&n.push(`${u.name}${_t}${u.file}`)}else if(TI.has(a.lang)&&o.some(l=>s(a.rel,l))&&!/(^|\/)src\/test\//.test(a.rel))for(let l of a.symbols)l.exported&&!l.parent&&n.push(`${l.name}${_t}${l.file}`)}return n}function FI(e,t,n){let r=new Set,o=new Map,s=l=>n.get(l)?.kind==="code";for(let l of e.files){let c=l.rel.slice(l.rel.lastIndexOf("/")+1),d=Ao(l.rel);if(c==="package.json"){let u=Nr(re(j(e.root,l.rel)));if(!u||typeof u!="object")continue;let f=[],m=h=>{typeof h=="string"?f.push(h):Array.isArray(h)?h.forEach(m):h&&typeof h=="object"&&Object.values(h).forEach(m)},p=u;for(let h of["source","main","module","types","typings","bin","exports"])m(p[h]);typeof p.browser=="string"&&m(p.browser);let g=d?`${d}/package.json`:"package.json";for(let h of f){let _=h.slice(h.lastIndexOf("/")+1);if(h.includes("*")||_.includes(".")&&!/\.[cm]?[jt]sx?$/.test(_))continue;let y=_.replace(/(\.d)?\.[cm]?[jt]sx?$/,"");for(let b of[h,...du(h),`src/${y}`]){let S=ct(g,".ts",b.startsWith(".")?b:`./${b}`,t);S.kind==="resolved"&&s(S.target)&&r.add(S.target)}}}else if(c==="pyproject.toml"){let u=re(j(e.root,l.rel)),f=/^\[(?:project\.(?:gui-)?scripts|tool\.poetry\.scripts)\]\s*$([\s\S]*?)(?=^\[|(?![\s\S]))/gm;for(let m of u.matchAll(f))for(let p of m[1].matchAll(/^\s*[\w.-]+\s*=\s*["']([\w.]+):(\w+)[\w.]*["']/gm)){let g=ct(d?`${d}/pyproject.py`:"pyproject.py",".py",p[1],t);if(g.kind!=="resolved"||!s(g.target))continue;let h=o.get(g.target)??new Set;o.set(g.target,h.add(p[2]))}}}for(let l of t.rustCrates)l.rootFile&&r.add(l.rootFile);let a=[...r].sort(T).map(l=>({rel:l}));for(let l of[...o.keys()].sort(T))r.has(l)||a.push({rel:l,names:o.get(l)});return a}function Xl(e,t){return t===void 0||e.length<=t?e:{total:e.length,shown:t,truncated:!0,candidates:e.slice(0,t)}}var bI,wI,xI,SI,kI,EI,vI,_t,Ao,TI,Zl=H(()=>{"use strict";$();me();gt();ar();Ms();Fn();Br();$n();dr();Ze();ce();Os();bI=new Set(["reexport","reexport-all","default"]),wI=new Set(["function","method","def","constructor","operator","class","macro"]),xI=/^[\w$]+\s*(?::[^=]*)?=\s*(?:async\s+)?(?:function\b|\(|[\w$]+\s*=>)/,SI=/^\w+\s*(?::[^=]*)?=\s*lambda\b/,kI=new Set(["class","interface","struct","trait","object","enum","record","protocol","module","type"]),EI=/(^|\/)(index|main|cli|mod|lib|__main__)\.[a-z]+$/,vI=/^[A-Za-z_]\w{4,}$/,_t="\0",Ao=e=>e.includes("/")?e.slice(0,e.lastIndexOf("/")):"";TI=new Set(["java","kotlin","scala"])});function db(e,t){let n=new Set(e.modules.map(c=>c.slug));for(let c of e.moduleEdges)n.add(c.from).add(c.to);let r=[...n].sort(T),o=new Map(r.map(c=>[c,t+c.replace(/[^A-Za-z0-9_]/g,"_")])),s=new Map;for(let c of o.values())s.set(c,(s.get(c)??0)+1);let a=new Set([...o.values()].filter(c=>s.get(c)===1)),l=new Map;for(let c of r){let d=o.get(c),u=d;if(s.get(d)>1){for(let f=2;a.has(u);f++)u=`${d}_${f}`;a.add(u)}l.set(c,u)}return l}function OI(e,t){if(e.modules.some(o=>o.slug===t))return t;let n=t.replace(/\/+$/,""),r=e.modules.find(o=>o.path===n);return r?r.slug:e.files.find(o=>o.rel===t)?.module}function ub(e){return e.replace(/#/g,"#35;").replace(/"/g,"#quot;").replace(/&/g,"#38;").replace(//g,"#gt;").replace(/`/g,"#96;").replace(/[\r\n]+/g," ")}function $o(e,t={}){let n=t.maxEdges??80,r=t.module?OI(e,t.module):void 0;if(t.module&&!r)throw new Error(`no such file or module in the index: ${t.module}`);let o=db(e,"m_"),s=[...e.moduleEdges].filter(d=>!d.dangling);r&&(s=s.filter(d=>d.from===r||d.to===r)),s.sort((d,u)=>u.weight-d.weight||T(d.from,u.from)||T(d.to,u.to));let a=Math.max(0,s.length-n);s=s.slice(0,n);let l=new Set;for(let d of s)l.add(d.from),l.add(d.to);r&&l.add(r);let c=["graph LR"];for(let d of[...e.modules].sort((u,f)=>T(u.slug,f.slug)))l.has(d.slug)&&c.push(` ${o.get(d.slug)}["${NI(d)}"]`);for(let d of s){let u=d.kind==="import"?"":`|${d.kind}|`;c.push(` ${o.get(d.from)} -->${u} ${o.get(d.to)}`)}return a&&c.push(` %% ${a} lighter edges omitted (maxEdges=${n})`),c.join(` +`)})`}throw new Error(`rules config ${t} is not valid JSON${s}`)}try{return ec(n)}catch(r){throw new Error(`rules config ${t}: ${r instanceof Error?r.message:String(r)}`)}}function ec(e){let t=Array.isArray(e)?e:e?.rules;if(!Array.isArray(t))throw new Error("rules config must be an array (or an object with a `rules` array)");return t.map((n,r)=>{let o=`rules[${r}]`;if(typeof n!="object"||n===null||Array.isArray(n))throw new Error(`${o}: must be an object`);let s=n;if(typeof s.name!="string"||!s.name)throw new Error(`${o}: \`name\` (non-empty string) is required`);let a=s.builtin===void 0?EI:s.builtin==="literals"?vI:hb,l=Object.keys(s).filter(f=>!a.has(f)).sort(T);if(l.length){let f=s.builtin===void 0?"a forbidden-edge rule":`builtin "${String(s.builtin)}"`;throw new Error(`${o} (${s.name}): unknown key${l.length>1?"s":""} ${l.map(m=>`\`${m}\``).join(", ")} \u2014 ${f} takes ${[...a].join(", ")}`)}if(s.severity!==void 0&&!SI.has(s.severity))throw new Error(`${o} (${s.name}): \`severity\` must be "error" or "warn"`);if(s.comment!==void 0&&typeof s.comment!="string")throw new Error(`${o} (${s.name}): \`comment\` must be a string`);if(s.builtin!==void 0){if(!kI.has(s.builtin))throw new Error(`${o} (${s.name}): \`builtin\` must be "cycles", "orphans" or "literals"`);if(s.tiers!==void 0&&!(Array.isArray(s.tiers)&&s.tiers.length>0&&s.tiers.every(m=>fb.has(m))))throw new Error(`${o} (${s.name}): \`tiers\` must be a non-empty array of ${[...fb].join(", ")}`);for(let f of["minFiles","minCount"]){let m=s[f];if(m!==void 0&&!(typeof m=="number"&&Number.isInteger(m)&&m>=1))throw new Error(`${o} (${s.name}): \`${f}\` must be a positive integer`)}if(s.includeTests!==void 0&&typeof s.includeTests!="boolean")throw new Error(`${o} (${s.name}): \`includeTests\` must be a boolean`);return{name:s.name,builtin:s.builtin,severity:s.severity,comment:s.comment,...s.tiers!==void 0?{tiers:s.tiers}:{},...s.minFiles!==void 0?{minFiles:s.minFiles}:{},...s.minCount!==void 0?{minCount:s.minCount}:{},...s.includeTests!==void 0?{includeTests:s.includeTests}:{}}}let c=f=>{let m=s[f];if(!(typeof m=="string"?m.length>0:Array.isArray(m)&&m.length>0&&m.every(g=>typeof g=="string"&&g)))throw new Error(`${o} (${s.name}): \`${f}\` must be a glob or a non-empty array of globs`);return m},d=c("from"),u=c("to");if(s.kind!==void 0&&!(Array.isArray(s.kind)&&s.kind.length>0&&s.kind.every(m=>ub.has(m))))throw new Error(`${o} (${s.name}): \`kind\` must be a non-empty array of edge kinds (${[...ub].join(", ")})`);return{name:s.name,from:d,to:u,kind:s.kind,severity:s.severity,comment:s.comment}})}function II(e){let t=new Map;for(let u of e.moduleEdges){if(u.kind!=="import")continue;let f=t.get(u.from);f||t.set(u.from,f=[]),f.push(u.to)}for(let u of t.values())u.sort(T);let n=[...t.keys()].sort(T),r=new Map,o=new Map,s=new Set,a=[],l=[],c=0;for(let u of n){if(r.has(u))continue;let f=[{node:u,next:0}];for(;f.length;){let m=f[f.length-1],p=m.node;m.next===0&&(r.set(p,c),o.set(p,c),c++,a.push(p),s.add(p));let g=t.get(p)??[];if(m.next1&&l.push(_)}f.pop();let h=f[f.length-1];h&&o.set(h.node,Math.min(o.get(h.node),o.get(p)))}}}let d=[];for(let u of l){let f=new Set(u),m=[...u].sort(T)[0],p=new Map([[m,null]]),g=[m];for(let y=0;y(t.get(y)??[]).includes(m)&&y!==m)??m,_=[];for(let y=h;y!==null;y=p.get(y)??null)_.unshift(y);_.push(m),d.push({start:m,path:_})}return d}function No(e,t,n={}){let r=[],o=(c,d)=>{r.push({rule:c.name,...d,severity:c.severity??"error",...c.comment!==void 0?{comment:c.comment}:{}})},s=new Set(e.files.map(c=>c.rel)),a=new Map,l=c=>{if(!n.scan)return e.literalDuplications??[];let d=`${c.minFiles??""}\0${c.minCount??""}\0${c.includeTests===!0}`,u=a.get(d);return u||(u=Bn(n.scan,{minFiles:c.minFiles,minCount:c.minCount,includeTests:c.includeTests}).duplications,a.set(d,u)),u};for(let c of t){if("builtin"in c){if(c.builtin==="cycles")for(let p of II(e))o(c,{from:p.start,to:p.path.join(" -> "),kind:"cycle"});else if(c.builtin==="literals"){let p=new Set(c.tiers?.length?c.tiers:RI);for(let g of l(c)){if(!p.has(g.tier))continue;let h=g.holders[0]??g.literals[0];o(c,{from:`${h.file}:${h.line}`,to:`${g.tier} ${JSON.stringify(g.value)} (${g.count} sites, ${g.files} files)`,kind:"literal"})}}else for(let p of MI(e))o(c,{from:p,to:p,kind:"orphan"});continue}let d=Lt(Df(c.from)),u=Lt(Df(c.to));if(!d||!u)continue;let f=!1;for(let[p,g]of[["from",d],["to",u]])e.files.some(h=>g(h.rel))||(f=!0,r.push({rule:c.name,from:Df(c[p]).join(", "),to:`\`${p}\` matches no indexed file`,kind:"unmatched",severity:"warn"}));if(f)continue;let m=c.kind?.length?new Set(c.kind):null;for(let p of e.fileEdges)p.dangling||!s.has(p.to)||m&&!m.has(p.kind)||!d(p.from)||!u(p.to)||o(c,{from:p.from,to:p.to,kind:p.kind})}return r.sort((c,d)=>T(c.rule,d.rule)||T(c.from,d.from)||T(c.to,d.to)||T(c.kind,d.kind)),r}function tc(e){let t=e.filter(n=>n.severity==="error").length;return{errors:t,warnings:e.length-t,violations:e}}var xI,ub,SI,kI,fb,gb,EI,hb,vI,RI,CI,mb,pb,nc=z(()=>{"use strict";$();Ei();Js();de();xI={contains:!0,"doc-link":!0,import:!0,call:!0,extends:!0,implements:!0,use:!0,mention:!0},ub=new Set(Object.keys(xI)),SI=new Set(["error","warn"]),kI=new Set(["cycles","orphans","literals"]),fb=new Set(["competing","bypassed","uncentralized"]),gb=["name","severity","comment"],EI=new Set([...gb,"from","to","kind"]),hb=new Set([...gb,"builtin"]),vI=new Set([...hb,"tiers","minFiles","minCount","includeTests"]),RI=["competing","bypassed"],CI=new Set(["index","main","app","application","cli","server","entry","entrypoint","setup","conftest","__init__","__main__","mod","lib","wsgi","asgi","manage"]),mb=new Set(["go","java","kotlin","scala"]),pb=e=>e.includes("/")?e.slice(0,e.lastIndexOf("/")):""});function DI(e){return Fs(Po(e)||"(root)")===2||/(^|\/)testdata\//.test(e)}function yb(e){if(TI.has(e.kind))return!0;if(e.kind!=="const"||!e.signature)return!1;let t=De(e.lang);return t==="js"?FI.test(e.signature):t==="python"&&OI.test(e.signature)}function jI(e){switch(De(e.lang)){case"python":return/^__\w+__$/.test(e.name);case"go":return e.name==="init"||e.name==="main";case"js":return e.name==="constructor";default:return!1}}function Lo(e,t={}){let n=t.kinds==="all",r=Bs(e),o=Bt(e),s=dr(e,o),a=UI(e,o,s),l=m=>{let p=r.get(`${m.name}@${m.file}`)??r.get(m.name);return!!p&&p.def.file===m.file&&p.callers.length>0},c=WI(e,s,m=>l(m)||a.has(`${m.name}${vt}${m.file}`)),d=[];for(let m of e.files)if(!Wt(m.rel)&&!(!t.includeTail&&DI(m.rel)))for(let p of m.symbols)!p.exported||$I.has(p.kind)||jI(p)||!n&&!yb(p)||a.has(`${p.name}${vt}${p.file}`)||l(p)||c(p)||d.push(p);let u=BI(e,d,s),f=[];for(let m of d){let p=u(m);p&&!yb(m)||f.push({name:m.name,file:m.file,line:m.line,kind:m.kind,tier:p?"uncalled":"unreferenced"})}return f.sort((m,p)=>T(m.tier,p.tier)||T(m.file,p.file)||m.line-p.line)}function WI(e,t,n){let r=[...t];for(let d of Zi(e))r.push({...d,kind:"implements"});let o=new Map;for(let{sub:d,sup:u}of Au(e,r)){let f=o.get(d)??[];f.push(u),o.set(d,f)}let s=new Map;for(let d of t){let u=`${d.from}${vt}${d.fromFile}`;s.set(u,(s.get(u)??0)+1)}let a=new Set;for(let d of e.files){if(De(d.lang)==="go")continue;let u=new Map;for(let f of d.relations??[])u.set(f.from,(u.get(f.from)??0)+1);for(let[f,m]of u)m>(s.get(`${f}${vt}${d.rel}`)??0)&&a.add(`${f}${vt}${d.rel}`)}let l=new Map,c=(d,u)=>{let f=l.get(d);if(f!==void 0)return f;let m=o.get(d),p;return m?(u.add(d),p=m.some(g=>n(g)||!u.has(g)&&c(g,u))):p=!!d.parent&&a.has(`${d.parent}${vt}${d.file}`),l.set(d,p),p};return d=>!!d.parent&&c(d,new Set)}function BI(e,t,n){let r=new Map;for(let m of t){let p=De(m.lang),g=r.get(p);g||r.set(p,g=new Map),g.has(m.name)||g.set(m.name,[])}let o=(m,p,g)=>{if(p===void 0)return;let h=m?.get(p);h&&h.length<2&&h[h.length-1]!==g&&h.push(g)},s=new Map,a=new Set;for(let m of e.files){if(m.kind!=="code")continue;s.set(m.rel,m.lang);let p=De(m.lang),g=r.get(p);if(g){m.idents===void 0&&a.add(p);for(let h of m.idents??[])o(g,h,m.rel);for(let h of m.calls??[])o(g,h.name,m.rel),o(g,h.receiver,m.rel);for(let h of m.importedNames??[])o(g,h,m.rel);for(let h of m.importAliases??[])o(g,h.name,m.rel),o(g,h.local,m.rel);for(let h of m.relations??[])o(g,h.to,"")}}for(let m of n)o(r.get(De(s.get(m.toFile)??"")),m.to,"");let l=hl(e),c=m=>(r.get(De(m.lang))?.get(m.name)??[]).some(g=>g!==m.file)||[...l.get(m.name)??[]].some(g=>g!==m.file),d=new Map;for(let m of t){let p=De(m.lang);if(c(m)||LI.test(m.name)&&!a.has(p))continue;let g=d.get(p);g||d.set(p,g=new Set),g.add(m.name)}if(d.size)for(let m of e.files){if(m.kind!=="code")continue;let p=De(m.lang),g=d.get(p);if(!g)continue;let h=se(j(e.root,m.rel)),_=p==="js"?/[A-Za-z_$][\w$]*/g:/[A-Za-z_]\w*/g,y=new Set;for(let b of h.match(_)??[])g.has(b)&&y.add(b);for(let b of y)o(r.get(p),b,m.rel)}let u=new Set,f=new Map;for(let m of t){if(c(m))continue;let p=f.get(m.file)??[];p.push(m),f.set(m.file,p)}for(let[m,p]of f){let g=new Set(p.map(y=>y.name)),h=De(p[0].lang)==="js"?/[A-Za-z_$][\w$]*/g:/[A-Za-z_]\w*/g,_=new Map;pl(se(j(e.root,m)),p[0].lang).split(` +`).forEach((y,b)=>{for(let S of y.match(h)??[])g.has(S)&&(_.get(S)??_.set(S,[]).get(S)).push(b+1)});for(let y of p){let b=y.endLine??y.line;(_.get(y.name)??[]).some(S=>Sb)&&u.add(y)}}return m=>u.has(m)||c(m)}function UI(e,t,n){let r=pn(e),o=new Map(e.files.map(p=>[p.rel,p])),s=GI(e,r,o);if(!s.length)for(let p of e.files)p.kind==="code"&&PI.test(p.rel)&&s.push({rel:p.rel});for(let p of e.files)(p.rel==="__init__.py"||p.rel.endsWith("/__init__.py"))&&s.push({rel:p.rel});let a=Hs(t),l=new Set,c=new Set;for(let p=0;p<5&&s.length;p++){let g=[];for(let{rel:h,names:_}of s){let y=`${h}${vt}${_?[..._].sort(T).join(","):"*"}`;if(c.has(y))continue;c.add(y);let b=o.get(h);if(!b)continue;let S=new Set;for(let k of b.symbols)if(k.kind==="reexport")(!_||_.has(k.name))&&S.add(k.name);else if(k.kind==="reexport-all"){let C=/^\* \((.+)\)$/.exec(k.name)?.[1],I=C===void 0?void 0:gt(h,b.ext,C,r);I?.kind==="resolved"&&g.push({rel:I.target,..._?{names:_}:{}})}else k.exported&&k.kind!=="default"&&(!_||_.has(k.name))&&l.add(`${k.name}${vt}${k.file}`);if(S.size)for(let k of[...a.get(h)??[]].sort(T))g.push({rel:k,names:S})}s=g}for(let p of zI(e,r))l.add(p);let d=new Map;for(let p of n){let g=`${p.from}${vt}${p.fromFile}`,h=d.get(g)??[];h.push(`${p.to}${vt}${p.toFile}`),d.set(g,h)}let u=new Map;for(let p of e.files)for(let g of p.symbols){if(!g.parent)continue;let h=`${g.parent}${vt}${g.file}`,_=u.get(h)??[];_.push(`${g.name}${vt}${g.file}`),u.set(h,_)}let f=new Set;for(let p of e.files)for(let g of p.symbols)NI.has(g.kind)&&f.add(`${g.name}${vt}${g.file}`);let m=[...l].sort(T);for(;m.length;){let p=m.pop(),g=[...d.get(p)??[],...f.has(p)?u.get(p)??[]:[]];for(let h of g)l.has(h)||(l.add(h),m.push(h))}return l}function zI(e,t){let n=[],r=new Set;for(let a of e.files)a.lang==="go"&&!a.rel.endsWith("_test.go")&&a.symbols.some(l=>l.name==="main"&&!l.parent&&l.kind==="function")&&r.add(Po(a.rel));let o=[];for(let a of e.files){let l=a.rel.slice(a.rel.lastIndexOf("/")+1);if(l!=="build.gradle"&&l!=="build.gradle.kts"&&l!=="pom.xml")continue;let c=se(j(e.root,a.rel));(l==="pom.xml"?/|maven-deploy-plugin|central-publishing-maven-plugin|nexus-staging-maven-plugin/.test(c):/\bjava-library\b|\bmaven-publish\b|com\.vanniktech\.maven\.publish/.test(c))&&o.push(Po(a.rel))}let s=(a,l)=>!l||a.startsWith(l+"/");for(let a of e.files)if(!(a.kind!=="code"||Wt(a.rel))){if(a.lang==="go"){if(a.rel.endsWith("_test.go"))continue;let l=t.goModules.find(u=>s(a.rel,u.dir));if(!l)continue;let c=Po(a.rel),d=l.dir?c.slice(l.dir.length+1):c;if(r.has(c)||/(^|\/)internal(\/|$)/.test(d))continue;for(let u of a.symbols)u.exported&&n.push(`${u.name}${vt}${u.file}`)}else if(HI.has(a.lang)&&o.some(l=>s(a.rel,l))&&!/(^|\/)src\/test\//.test(a.rel))for(let l of a.symbols)l.exported&&!l.parent&&n.push(`${l.name}${vt}${l.file}`)}return n}function GI(e,t,n){let r=new Set,o=new Map,s=l=>n.get(l)?.kind==="code";for(let l of e.files){let c=l.rel.slice(l.rel.lastIndexOf("/")+1),d=Po(l.rel);if(c==="package.json"){let u=Wr(se(j(e.root,l.rel)));if(!u||typeof u!="object")continue;let f=[],m=h=>{typeof h=="string"?f.push(h):Array.isArray(h)?h.forEach(m):h&&typeof h=="object"&&Object.values(h).forEach(m)},p=u;for(let h of["source","main","module","types","typings","bin","exports"])m(p[h]);typeof p.browser=="string"&&m(p.browser);let g=d?`${d}/package.json`:"package.json";for(let h of f){let _=h.slice(h.lastIndexOf("/")+1);if(h.includes("*")||_.includes(".")&&!/\.[cm]?[jt]sx?$/.test(_))continue;let y=_.replace(/(\.d)?\.[cm]?[jt]sx?$/,"");for(let b of[h,...yu(h),`src/${y}`]){let S=gt(g,".ts",b.startsWith(".")?b:`./${b}`,t);S.kind==="resolved"&&s(S.target)&&r.add(S.target)}}}else if(c==="pyproject.toml"){let u=se(j(e.root,l.rel)),f=/^\[(?:project\.(?:gui-)?scripts|tool\.poetry\.scripts)\]\s*$([\s\S]*?)(?=^\[|(?![\s\S]))/gm;for(let m of u.matchAll(f))for(let p of m[1].matchAll(/^\s*[\w.-]+\s*=\s*["']([\w.]+):(\w+)[\w.]*["']/gm)){let g=gt(d?`${d}/pyproject.py`:"pyproject.py",".py",p[1],t);if(g.kind!=="resolved"||!s(g.target))continue;let h=o.get(g.target)??new Set;o.set(g.target,h.add(p[2]))}}}for(let l of t.rustCrates)l.rootFile&&r.add(l.rootFile);let a=[...r].sort(T).map(l=>({rel:l}));for(let l of[...o.keys()].sort(T))r.has(l)||a.push({rel:l,names:o.get(l)});return a}function rc(e,t){return t===void 0||e.length<=t?e:{total:e.length,shown:t,truncated:!0,candidates:e.slice(0,t)}}var $I,TI,FI,OI,NI,PI,LI,vt,Po,HI,sc=z(()=>{"use strict";$();ge();St();fr();Os();Pn();qr();On();gr();nt();de();Ws();$I=new Set(["reexport","reexport-all","default"]),TI=new Set(["function","method","def","constructor","operator","class","macro"]),FI=/^[\w$]+\s*(?::[^=]*)?=\s*(?:async\s+)?(?:function\b|\(|[\w$]+\s*=>)/,OI=/^\w+\s*(?::[^=]*)?=\s*lambda\b/,NI=new Set(["class","interface","struct","trait","object","enum","record","protocol","module","type"]),PI=/(^|\/)(index|main|cli|mod|lib|__main__)\.[a-z]+$/,LI=/^[A-Za-z_]\w{4,}$/,vt="\0",Po=e=>e.includes("/")?e.slice(0,e.lastIndexOf("/")):"";HI=new Set(["java","kotlin","scala"])});function bb(e,t){let n=new Set(e.modules.map(c=>c.slug));for(let c of e.moduleEdges)n.add(c.from).add(c.to);let r=[...n].sort(T),o=new Map(r.map(c=>[c,t+c.replace(/[^A-Za-z0-9_]/g,"_")])),s=new Map;for(let c of o.values())s.set(c,(s.get(c)??0)+1);let a=new Set([...o.values()].filter(c=>s.get(c)===1)),l=new Map;for(let c of r){let d=o.get(c),u=d;if(s.get(d)>1){for(let f=2;a.has(u);f++)u=`${d}_${f}`;a.add(u)}l.set(c,u)}return l}function qI(e,t){if(e.modules.some(o=>o.slug===t))return t;let n=t.replace(/\/+$/,""),r=e.modules.find(o=>o.path===n);return r?r.slug:e.files.find(o=>o.rel===t)?.module}function wb(e){return e.replace(/#/g,"#35;").replace(/"/g,"#quot;").replace(/&/g,"#38;").replace(//g,"#gt;").replace(/`/g,"#96;").replace(/[\r\n]+/g," ")}function Do(e,t={}){let n=t.maxEdges??80,r=t.module?qI(e,t.module):void 0;if(t.module&&!r)throw new Error(`no such file or module in the index: ${t.module}`);let o=bb(e,"m_"),s=[...e.moduleEdges].filter(d=>!d.dangling);r&&(s=s.filter(d=>d.from===r||d.to===r)),s.sort((d,u)=>u.weight-d.weight||T(d.from,u.from)||T(d.to,u.to));let a=Math.max(0,s.length-n);s=s.slice(0,n);let l=new Set;for(let d of s)l.add(d.from),l.add(d.to);r&&l.add(r);let c=["graph LR"];for(let d of[...e.modules].sort((u,f)=>T(u.slug,f.slug)))l.has(d.slug)&&c.push(` ${o.get(d.slug)}["${VI(d)}"]`);for(let d of s){let u=d.kind==="import"?"":`|${d.kind}|`;c.push(` ${o.get(d.from)} -->${u} ${o.get(d.to)}`)}return a&&c.push(` %% ${a} lighter edges omitted (maxEdges=${n})`),c.join(` `)+` -`}function jI(e,t={}){let n=t.maxModules??LI,r=t.maxEdges??DI,o=db(e,"m_"),s=f=>o.get(f),l=e.modules.slice().sort((f,m)=>cb(m)-cb(f)||T(f.slug,m.slug)).slice(0,n),c=new Set(l.map(f=>f.slug)),d=e.moduleEdges.filter(f=>c.has(f.from)&&c.has(f.to)).sort((f,m)=>m.weight-f.weight||T(f.from,m.from)||T(f.to,m.to)).slice(0,r),u=[];u.push(`%% ${t.title??"module graph"} \u2014 ${l.length} of ${e.modules.length} modules, ${d.length} of ${e.moduleEdges.length} edges`),(l.lengthp.tier===f);if(m.length){u.push(` subgraph ${PI[f]}`);for(let p of m)u.push(` ${s(p.slug)}["${ub(p.path)}"]`);u.push(" end")}}for(let f of d){let m=f.weight>1?`|${f.weight}| `:"";u.push(` ${s(f.from)} -->${m?" "+m:" "}${s(f.to)}`)}return{content:"```mermaid\n"+u.join(` -`)+"\n```\n",shownModules:l.length,totalModules:e.modules.length,shownEdges:d.length,totalEdges:e.moduleEdges.length}}var NI,PI,LI,DI,cb,Yl=H(()=>{"use strict";$();ce();NI=e=>`${ub(e.path)}${e.tier===0?" (core)":""}`;PI={0:"Foundations",1:"Features",2:"Tail"},LI=40,DI=80,cb=e=>e.degIn+e.degOut});function fb(e,t){let n=[],r=new Set,o=(a,l)=>{let c=`${a.name}:${a.line}`;r.has(c)||(r.add(c),n.push({name:a.name,kind:a.kind,exported:a.exported,line:a.line,...a.endLine!==void 0?{endLine:a.endLine}:{},...a.parent!==void 0?{parent:a.parent}:{},...l?{approx:!0}:{}}))},s=a=>(a.endLine??a.line)-a.line;for(let a of t){let l=e.filter(c=>c.line<=a.end&&(c.endLine??c.line)>=a.start);if(l.length){l.sort((c,d)=>s(c)-s(d)||d.line-c.line||T(c.name,d.name));for(let c of l)o(c,!1)}else{let c=e.filter(u=>u.line<=a.start&&u.endLine===void 0),d=c[c.length-1];d&&o(d,!0)}}return n}function zI(e,t){if(e.length<=1)return 0;let n=0;for(let r of e)rc.dangling&&(c.kind==="import"||c.kind==="doc-link"));if(!r.length||!n.length)return[];let o=zi(e),s=new Map;for(let c of n){if(o.fileSet.has(c.path))continue;s.set(c.path,c.renamedTo),o.fileSet.add(c.path);let d=c.path.includes("/")?J.dirname(c.path):"",u=o.filesByDir.get(d);u?u.push(c.path):o.filesByDir.set(d,[c.path]);for(let f=d;f&&!o.dirSet.has(f);f=f.includes("/")?J.dirname(f):"")o.dirSet.add(f)}if(!s.size)return[];let a=new Map(e.files.map(c=>[c.rel,c.ext])),l=[];for(let c of r){let d=a.get(c.from);if(d===void 0)continue;let u=c.kind==="doc-link"?"doc-link":"import",f=u==="doc-link"?sr(c.from,c.to,o):ct(c.from,d,c.to,o);if(f.kind!=="resolved"||!s.has(f.target))continue;let m=s.get(f.target);l.push({from:c.from,spec:c.to,kind:u,target:f.target,...m!==void 0?{renamedTo:m}:{}})}return l.sort((c,d)=>T(c.target,d.target)||T(c.from,d.from)||T(c.spec,d.spec))}function pb(e,t,n,r=Ql){let o=[...n.notes??[]];t||o.push("symbol index missing \u2014 symbol-level attribution disabled");let s=n.broken??[],a=new Map(e.files.map(w=>[w.rel,w])),l=new Map(e.modules.map(w=>[w.slug,w])),c=new Map;for(let w of n.files)w.status!=="deleted"&&a.has(w.path)&&c.set(w.path,[]);if(t&&c.size){for(let w of Object.keys(t.defs))for(let E of t.defs[w])c.get(E.file)?.push({name:w,...E});for(let w of c.values())w.sort((E,N)=>E.line-N.line||T(E.name,N.name))}let d=[],u=[],f=[];for(let w of[...n.files].sort((E,N)=>T(E.path,N.path))){let E={...w.oldPath!==void 0?{oldPath:w.oldPath}:{},...w.binary?{binary:!0}:{},...w.linesAdded!==void 0?{linesAdded:w.linesAdded}:{},...w.linesDeleted!==void 0?{linesDeleted:w.linesDeleted}:{}};if(w.status==="deleted"){d.push(w.path),f.push({path:w.path,status:w.status,...E,hunks:[],symbols:[]});continue}let N=a.get(w.path);if(!N){u.push(w.path);continue}let O=n.hunks.get(w.path)??[];!O.length&&w.status==="added"&&!w.binary&&(O=[{start:1,end:Math.max(N.lines,1)}]);let L=w.binary?[]:fb(c.get(w.path)??[],O);f.push({path:w.path,status:w.status,...E,module:N.module,hunks:O.map(G=>({start:G.start,end:G.end})),symbols:L})}let m=new Set(f.filter(w=>w.status!=="deleted").map(w=>w.path)),p=new Set(s.map(w=>`${w.from}\0${w.spec}`)),g=e.fileEdges.filter(w=>w.dangling&&(w.kind==="import"||w.kind==="doc-link")&&m.has(w.from)&&!p.has(`${w.from}\0${w.to}`)).map(w=>({from:w.from,spec:w.to,reason:w.reason??"unknown"})).sort((w,E)=>T(w.from,E.from)||T(w.spec,E.spec)),h=(w,E)=>{if(!E.startsWith("."))return!1;let N=w.split("/").slice(0,-1);for(let O of E.split("/"))O==="."||O===""||(O===".."?N.pop():N.push(O));return N.some(O=>Cn.has(O))},_=new Map;for(let w of f){if(w.status==="deleted"||!w.module)continue;let E=_.get(w.module);E||_.set(w.module,E=[]),E.push(w)}let y=new Map(e.modules.map(w=>[w.path,w])),b=w=>{let E=w.includes("/")?J.dirname(w):"(root)",N=y.get(E);if(N)return N.slug;let O=E==="(root)"?"root":si(E);return O&&!l.has(O)?O:`${O||"module"}-${Re(E).slice(0,8)}`},S=new Map,k=new Map;for(let w of s){let E=b(w.target);l.has(E)||k.set(E,w.target.includes("/")?J.dirname(w.target):"(root)");let N=S.get(E);N||S.set(E,N=[]),N.push(w)}let R=new Set;for(let w of e.files)w.fileKind==="code"&&!w.testFile&&R.add(w.module);let I=e.modules.some(w=>w.pagerank!==void 0),P=w=>I?w.pagerank??0:w.degIn+w.degOut,v=e.modules.map(P),C=I?"pagerank":"degree",M=vu(e.fileEdges,{skipInferred:!0,goPackages:!0}),x=[];for(let w of[...new Set([..._.keys(),...S.keys()])].sort(T)){let E=l.get(w),N=k.get(w);if(!E&&N===void 0)continue;let O=_.get(w)??[],L=S.get(w)??[],G=[],X=0,oe=L.filter(B=>B.kind==="import");if(oe.length){X+=kn.brokenImport;let B=[...new Set(oe.map(vn=>vn.target))].sort(T),K=B[0],se=[...new Set(oe.filter(vn=>vn.target===K).map(vn=>vn.from))].sort(T),Ne=oe.find(vn=>vn.target===K),Se=Ne.renamedTo!==void 0?`renamed ${K} (now ${Ne.renamedTo})`:`removed ${K}`,Zt=se.slice(0,3).join(", ")+(se.length>3?", \u2026":""),un=B.length>1?` (+${B.length-1} more removed file${B.length>2?"s":""})`:"";G.push(`${Se} is still imported by ${se.length} file${se.length===1?"":"s"} (${Zt})${un}`)}let ue=[...new Set(O.flatMap(B=>B.symbols.filter(K=>K.exported).map(K=>K.name)))].sort(T);if(ue.length){X+=kn.exportedChange;let B=ue.slice(0,3).join(", ")+(ue.length>3?", \u2026":"");G.push(ue.length===1?`exported symbol ${B} changed`:`exported symbols ${B} changed`)}let ve=E?zI(v,P(E)):0;ve>=.9?(X+=kn.hubHigh,G.push(`${C} p${Math.round(ve*100)} hub`)):ve>=.75&&(X+=kn.hubMed,G.push(`${C} p${Math.round(ve*100)} hub`));let Oe=new Map,z=new Set,U=(B,K)=>{let se=Oe.get(B);(se===void 0||KB.from))].sort(T);if(q.length&&r>=1){let B=new Map(q.map(K=>[K,1]));for(let[K,se]of Ki(e.fileEdges,q,r-1))B.set(K,se+1);for(let[K,se]of B){U(K,se);let Ne=a.get(K)?.module??"root";Ne!==w&&z.add(Ne)}}let te=Oe.size,ge={directFiles:[...Oe.values()].filter(B=>B===1).length,transitiveFiles:te,modules:[...z].sort(T)};te>=20||ge.modules.length>=5?(X+=kn.blastHigh,G.push(`${te} dependent files across ${ge.modules.length} modules (depth ${r})`)):te>=5&&(X+=kn.blastMed,G.push(`${te} dependent files across ${ge.modules.length} modules (depth ${r})`));let st=E!==void 0&&E.tier<=1&&E.symbols>0&&R.has(w),Je=E?.testedBy??[],he=st?Je.length?{status:"covered",files:Je}:{status:"gap",files:[]}:{status:"n/a",files:[]};he.status==="gap"&&(X+=kn.testGap,G.push("no test covers this module"));let fe=(e.surprises??[]).find(B=>B.from===w||B.to===w);fe&&(X+=kn.surprise,G.push(`cross-community edge to ${fe.from===w?fe.to:fe.from} (surprising)`));let ye=g.filter(B=>O.some(K=>K.path===B.from)&&!h(B.from,B.spec));if(ye.length){X+=kn.dangling;let B=ye[0],K=ye.length>1?` (+${ye.length-1} more)`:"";G.push(`dangling import "${B.spec}" in ${B.from}${K}`)}X=Math.min(100,X);let at=[...new Set(L.map(B=>B.target))].filter(B=>d.includes(B)),ne=[...O.map(B=>B.path),...at].sort(T),V=O.flatMap(B=>B.symbols),Z=[...O.slice().sort((B,K)=>K.symbols.filter(se=>se.exported).length-B.symbols.filter(se=>se.exported).length||K.symbols.length-B.symbols.length||T(B.path,K.path)).map(B=>B.path),...q.filter(B=>!m.has(B))].slice(0,UI);x.push({slug:w,path:E?.path??N,score:X,bucket:X>=WI?"HIGH":X>=BI?"MEDIUM":"LOW",reasons:G,changedFiles:ne,changedSymbols:{total:new Set(V.map(B=>`${B.name}:${B.line}`)).size,exported:new Set(V.filter(B=>B.exported).map(B=>`${B.name}:${B.line}`)).size},impact:ge,tests:he,open:Z})}return x.sort((w,E)=>E.score-w.score||T(w.slug,E.slug)),{base:n.base,...e.commit!==void 0?{indexCommit:e.commit}:{},depth:r,changes:f,modules:x,dangling:g,broken:s,deleted:d.sort(T),unindexed:u.sort(T),notes:o}}function HI(e,t){let n=je(le(e),le(e,t??".codeindex")).split("/").join("/"),r=n&&!n.startsWith("..")&&!Pe(n)?o=>o===n||o.startsWith(`${n}/`):()=>!1;return(o,s)=>r(o)?!1:s?!0:!o.split("/").slice(0,-1).some(l=>Cn.has(l)||l.startsWith(".codeindex-edit-"))}function Xs(e,t={}){if(!Qt("git"))return{error:"git is required for delta and was not found on PATH"};if(!Pc(e))return{error:`delta needs a git worktree \u2014 ${e} is not inside one`};let n=[],r;if(t.staged){let l=$e("git",["-C",e,"rev-parse","--verify","--quiet","HEAD"]);if(l.ok)r={ref:"HEAD",mergeBase:l.stdout.trim(),staged:!0};else{let c=Nc(e);if(!c)return{error:"cannot resolve HEAD, nor the empty tree"};r={ref:sa,mergeBase:c,staged:!0},n.push("no commits yet \u2014 every staged file is reviewed as added")}}else{let l=Lc(e,t.base);if("error"in l)return{error:l.error};l.note&&n.push(l.note),r={ref:l.ref,mergeBase:l.mergeBase,staged:!1}}let o=HI(e,t.indexDir),s=t.staged?{staged:!0}:{mergeBase:r.mergeBase},a=Dc(e,s).filter(l=>o(l.path,!0));if(!t.staged){let l=new Set(a.map(c=>c.path));for(let c of ia(e))!l.has(c)&&o(c,!1)&&a.push({path:c,status:"added"})}return{base:r,files:a,hunks:a.length?jc(e,s):new Map,notes:n}}function To(e,t=Ql){return{base:e.base,depth:t,changes:[],modules:[],dangling:[],broken:[],deleted:[],unindexed:[],notes:e.notes}}function Zs(e,t,n,r={}){let o=[...e.notes],s=e.files.flatMap(l=>l.status==="deleted"?[{path:l.path}]:l.status==="renamed"&&l.oldPath!==void 0?[{path:l.oldPath,renamedTo:l.path}]:[]),a=[];return s.length&&r.scan?a=mb(r.scan,t,s):s.length&&o.push("no scan supplied \u2014 importers of removed files were not traced"),pb(t,n,{...e,notes:o,broken:a},r.depth??Ql)}function GI(e,t,n,r={}){let o=Xs(e,r);return"error"in o?o:Zs(o,t,n,r)}function Fo(e){let{ref:t,mergeBase:n,staged:r}=e.base,o=t===sa?"vs the empty tree (no commits yet)":`vs ${t} (${r?"":"merge-base "}${n.slice(0,7)})`,s=r?"staged changes":"changes";if(!e.changes.length&&!e.unindexed.length)return`codeindex: no ${s} ${o} +`}function ZI(e,t={}){let n=t.maxModules??KI,r=t.maxEdges??XI,o=bb(e,"m_"),s=f=>o.get(f),l=e.modules.slice().sort((f,m)=>_b(m)-_b(f)||T(f.slug,m.slug)).slice(0,n),c=new Set(l.map(f=>f.slug)),d=e.moduleEdges.filter(f=>c.has(f.from)&&c.has(f.to)).sort((f,m)=>m.weight-f.weight||T(f.from,m.from)||T(f.to,m.to)).slice(0,r),u=[];u.push(`%% ${t.title??"module graph"} \u2014 ${l.length} of ${e.modules.length} modules, ${d.length} of ${e.moduleEdges.length} edges`),(l.lengthp.tier===f);if(m.length){u.push(` subgraph ${JI[f]}`);for(let p of m)u.push(` ${s(p.slug)}["${wb(p.path)}"]`);u.push(" end")}}for(let f of d){let m=f.weight>1?`|${f.weight}| `:"";u.push(` ${s(f.from)} -->${m?" "+m:" "}${s(f.to)}`)}return{content:"```mermaid\n"+u.join(` +`)+"\n```\n",shownModules:l.length,totalModules:e.modules.length,shownEdges:d.length,totalEdges:e.moduleEdges.length}}var VI,JI,KI,XI,_b,ic=z(()=>{"use strict";$();de();VI=e=>`${wb(e.path)}${e.tier===0?" (core)":""}`;JI={0:"Foundations",1:"Features",2:"Tail"},KI=40,XI=80,_b=e=>e.degIn+e.degOut});function xb(e,t){let n=[],r=new Set,o=(a,l)=>{let c=`${a.name}:${a.line}`;r.has(c)||(r.add(c),n.push({name:a.name,kind:a.kind,exported:a.exported,line:a.line,...a.endLine!==void 0?{endLine:a.endLine}:{},...a.parent!==void 0?{parent:a.parent}:{},...l?{approx:!0}:{}}))},s=a=>(a.endLine??a.line)-a.line;for(let a of t){let l=e.filter(c=>c.line<=a.end&&(c.endLine??c.line)>=a.start);if(l.length){l.sort((c,d)=>s(c)-s(d)||d.line-c.line||T(c.name,d.name));for(let c of l)o(c,!1)}else{let c=e.filter(u=>u.line<=a.start&&u.endLine===void 0),d=c[c.length-1];d&&o(d,!0)}}return n}function t$(e,t){if(e.length<=1)return 0;let n=0;for(let r of e)rc.dangling&&(c.kind==="import"||c.kind==="doc-link"));if(!r.length||!n.length)return[];let o=Ki(e),s=new Map;for(let c of n){if(o.fileSet.has(c.path))continue;s.set(c.path,c.renamedTo),o.fileSet.add(c.path);let d=c.path.includes("/")?V.dirname(c.path):"",u=o.filesByDir.get(d);u?u.push(c.path):o.filesByDir.set(d,[c.path]);for(let f=d;f&&!o.dirSet.has(f);f=f.includes("/")?V.dirname(f):"")o.dirSet.add(f)}if(!s.size)return[];let a=new Map(e.files.map(c=>[c.rel,c.ext])),l=[];for(let c of r){let d=a.get(c.from);if(d===void 0)continue;let u=c.kind==="doc-link"?"doc-link":"import",f=u==="doc-link"?cr(c.from,c.to,o):gt(c.from,d,c.to,o);if(f.kind!=="resolved"||!s.has(f.target))continue;let m=s.get(f.target);l.push({from:c.from,spec:c.to,kind:u,target:f.target,...m!==void 0?{renamedTo:m}:{}})}return l.sort((c,d)=>T(c.target,d.target)||T(c.from,d.from)||T(c.spec,d.spec))}function kb(e,t,n,r=oc){let o=[...n.notes??[]];t||o.push("symbol index missing \u2014 symbol-level attribution disabled");let s=n.broken??[],a=new Map(e.files.map(w=>[w.rel,w])),l=new Map(e.modules.map(w=>[w.slug,w])),c=new Map;for(let w of n.files)w.status!=="deleted"&&a.has(w.path)&&c.set(w.path,[]);if(t&&c.size){for(let w of Object.keys(t.defs))for(let E of t.defs[w])c.get(E.file)?.push({name:w,...E});for(let w of c.values())w.sort((E,N)=>E.line-N.line||T(E.name,N.name))}let d=[],u=[],f=[];for(let w of[...n.files].sort((E,N)=>T(E.path,N.path))){let E={...w.oldPath!==void 0?{oldPath:w.oldPath}:{},...w.binary?{binary:!0}:{},...w.linesAdded!==void 0?{linesAdded:w.linesAdded}:{},...w.linesDeleted!==void 0?{linesDeleted:w.linesDeleted}:{}};if(w.status==="deleted"){d.push(w.path),f.push({path:w.path,status:w.status,...E,hunks:[],symbols:[]});continue}let N=a.get(w.path);if(!N){u.push(w.path);continue}let O=n.hunks.get(w.path)??[];!O.length&&w.status==="added"&&!w.binary&&(O=[{start:1,end:Math.max(N.lines,1)}]);let L=w.binary?[]:xb(c.get(w.path)??[],O);f.push({path:w.path,status:w.status,...E,module:N.module,hunks:O.map(H=>({start:H.start,end:H.end})),symbols:L})}let m=new Set(f.filter(w=>w.status!=="deleted").map(w=>w.path)),p=new Set(s.map(w=>`${w.from}\0${w.spec}`)),g=e.fileEdges.filter(w=>w.dangling&&(w.kind==="import"||w.kind==="doc-link")&&m.has(w.from)&&!p.has(`${w.from}\0${w.to}`)).map(w=>({from:w.from,spec:w.to,reason:w.reason??"unknown"})).sort((w,E)=>T(w.from,E.from)||T(w.spec,E.spec)),h=(w,E)=>{if(!E.startsWith("."))return!1;let N=w.split("/").slice(0,-1);for(let O of E.split("/"))O==="."||O===""||(O===".."?N.pop():N.push(O));return N.some(O=>In.has(O))},_=new Map;for(let w of f){if(w.status==="deleted"||!w.module)continue;let E=_.get(w.module);E||_.set(w.module,E=[]),E.push(w)}let y=new Map(e.modules.map(w=>[w.path,w])),b=w=>{let E=w.includes("/")?V.dirname(w):"(root)",N=y.get(E);if(N)return N.slug;let O=E==="(root)"?"root":di(E);return O&&!l.has(O)?O:`${O||"module"}-${Ae(E).slice(0,8)}`},S=new Map,k=new Map;for(let w of s){let E=b(w.target);l.has(E)||k.set(E,w.target.includes("/")?V.dirname(w.target):"(root)");let N=S.get(E);N||S.set(E,N=[]),N.push(w)}let C=new Set;for(let w of e.files)w.fileKind==="code"&&!w.testFile&&C.add(w.module);let I=e.modules.some(w=>w.pagerank!==void 0),P=w=>I?w.pagerank??0:w.degIn+w.degOut,v=e.modules.map(P),R=I?"pagerank":"degree",M=Tu(e.fileEdges,{skipInferred:!0,goPackages:!0}),x=[];for(let w of[...new Set([..._.keys(),...S.keys()])].sort(T)){let E=l.get(w),N=k.get(w);if(!E&&N===void 0)continue;let O=_.get(w)??[],L=S.get(w)??[],H=[],X=0,le=L.filter(K=>K.kind==="import");if(le.length){X+=Cn.brokenImport;let K=[...new Set(le.map(Oe=>Oe.target))].sort(T),ae=K[0],Fe=[...new Set(le.filter(Oe=>Oe.target===ae).map(Oe=>Oe.from))].sort(T),q=le.find(Oe=>Oe.target===ae),Y=q.renamedTo!==void 0?`renamed ${ae} (now ${q.renamedTo})`:`removed ${ae}`,J=Fe.slice(0,3).join(", ")+(Fe.length>3?", \u2026":""),ne=K.length>1?` (+${K.length-1} more removed file${K.length>2?"s":""})`:"";H.push(`${Y} is still imported by ${Fe.length} file${Fe.length===1?"":"s"} (${J})${ne}`)}let me=[...new Set(O.flatMap(K=>K.symbols.filter(ae=>ae.exported).map(ae=>ae.name)))].sort(T);if(me.length){X+=Cn.exportedChange;let K=me.slice(0,3).join(", ")+(me.length>3?", \u2026":"");H.push(me.length===1?`exported symbol ${K} changed`:`exported symbols ${K} changed`)}let Ee=E?t$(v,P(E)):0;Ee>=.9?(X+=Cn.hubHigh,H.push(`${R} p${Math.round(Ee*100)} hub`)):Ee>=.75&&(X+=Cn.hubMed,H.push(`${R} p${Math.round(Ee*100)} hub`));let je=new Map,U=new Set,B=(K,ae)=>{let Fe=je.get(K);(Fe===void 0||aeK.from))].sort(T);if(G.length&&r>=1){let K=new Map(G.map(ae=>[ae,1]));for(let[ae,Fe]of to(e.fileEdges,G,r-1))K.set(ae,Fe+1);for(let[ae,Fe]of K){B(ae,Fe);let q=a.get(ae)?.module??"root";q!==w&&U.add(q)}}let te=je.size,ve={directFiles:[...je.values()].filter(K=>K===1).length,transitiveFiles:te,modules:[...U].sort(T)};te>=20||ve.modules.length>=5?(X+=Cn.blastHigh,H.push(`${te} dependent files across ${ve.modules.length} modules (depth ${r})`)):te>=5&&(X+=Cn.blastMed,H.push(`${te} dependent files across ${ve.modules.length} modules (depth ${r})`));let Je=E!==void 0&&E.tier<=1&&E.symbols>0&&C.has(w),Qe=E?.testedBy??[],be=Je?Qe.length?{status:"covered",files:Qe}:{status:"gap",files:[]}:{status:"n/a",files:[]};be.status==="gap"&&(X+=Cn.testGap,H.push("no test covers this module"));let pe=(e.surprises??[]).find(K=>K.from===w||K.to===w);pe&&(X+=Cn.surprise,H.push(`cross-community edge to ${pe.from===w?pe.to:pe.from} (surprising)`));let ue=g.filter(K=>O.some(ae=>ae.path===K.from)&&!h(K.from,K.spec));if(ue.length){X+=Cn.dangling;let K=ue[0],ae=ue.length>1?` (+${ue.length-1} more)`:"";H.push(`dangling import "${K.spec}" in ${K.from}${ae}`)}X=Math.min(100,X);let mt=[...new Set(L.map(K=>K.target))].filter(K=>d.includes(K)),re=[...O.map(K=>K.path),...mt].sort(T),ye=O.flatMap(K=>K.symbols),we=[...O.slice().sort((K,ae)=>ae.symbols.filter(Fe=>Fe.exported).length-K.symbols.filter(Fe=>Fe.exported).length||ae.symbols.length-K.symbols.length||T(K.path,ae.path)).map(K=>K.path),...G.filter(K=>!m.has(K))].slice(0,e$);x.push({slug:w,path:E?.path??N,score:X,bucket:X>=YI?"HIGH":X>=QI?"MEDIUM":"LOW",reasons:H,changedFiles:re,changedSymbols:{total:new Set(ye.map(K=>`${K.name}:${K.line}`)).size,exported:new Set(ye.filter(K=>K.exported).map(K=>`${K.name}:${K.line}`)).size},impact:ve,tests:be,open:we})}return x.sort((w,E)=>E.score-w.score||T(w.slug,E.slug)),{base:n.base,...e.commit!==void 0?{indexCommit:e.commit}:{},depth:r,changes:f,modules:x,dangling:g,broken:s,deleted:d.sort(T),unindexed:u.sort(T),notes:o}}function n$(e,t){let n=ze(ce(e),ce(e,t??".codeindex")).split("/").join("/"),r=n&&!n.startsWith("..")&&!We(n)?o=>o===n||o.startsWith(`${n}/`):()=>!1;return(o,s)=>r(o)?!1:s?!0:!o.split("/").slice(0,-1).some(l=>In.has(l)||l.startsWith(".codeindex-edit-"))}function ni(e,t={}){if(!sn("git"))return{error:"git is required for delta and was not found on PATH"};if(!zc(e))return{error:`delta needs a git worktree \u2014 ${e} is not inside one`};let n=[],r;if(t.staged){let l=Pe("git",["-C",e,"rev-parse","--verify","--quiet","HEAD"]);if(l.ok)r={ref:"HEAD",mergeBase:l.stdout.trim(),staged:!0};else{let c=Uc(e);if(!c)return{error:"cannot resolve HEAD, nor the empty tree"};r={ref:ua,mergeBase:c,staged:!0},n.push("no commits yet \u2014 every staged file is reviewed as added")}}else{let l=Hc(e,t.base);if("error"in l)return{error:l.error};l.note&&n.push(l.note),r={ref:l.ref,mergeBase:l.mergeBase,staged:!1}}let o=n$(e,t.indexDir),s=t.staged?{staged:!0}:{mergeBase:r.mergeBase},a=Gc(e,s).filter(l=>o(l.path,!0));if(!t.staged){let l=new Set(a.map(c=>c.path));for(let c of fa(e))!l.has(c)&&o(c,!1)&&a.push({path:c,status:"added"})}return{base:r,files:a,hunks:a.length?qc(e,s):new Map,notes:n}}function jo(e,t=oc){return{base:e.base,depth:t,changes:[],modules:[],dangling:[],broken:[],deleted:[],unindexed:[],notes:e.notes}}function ri(e,t,n,r={}){let o=[...e.notes],s=e.files.flatMap(l=>l.status==="deleted"?[{path:l.path}]:l.status==="renamed"&&l.oldPath!==void 0?[{path:l.oldPath,renamedTo:l.path}]:[]),a=[];return s.length&&r.scan?a=Sb(r.scan,t,s):s.length&&o.push("no scan supplied \u2014 importers of removed files were not traced"),kb(t,n,{...e,notes:o,broken:a},r.depth??oc)}function r$(e,t,n,r={}){let o=ni(e,r);return"error"in o?o:ri(o,t,n,r)}function Wo(e){let{ref:t,mergeBase:n,staged:r}=e.base,o=t===ua?"vs the empty tree (no commits yet)":`vs ${t} (${r?"":"merge-base "}${n.slice(0,7)})`,s=r?"staged changes":"changes";if(!e.changes.length&&!e.unindexed.length)return`codeindex: no ${s} ${o} `;let a=e.changes.length+e.unindexed.length,l=[`codeindex: delta ${r?"of staged changes ":""}${o} \u2014 ${a} changed file(s), ${e.modules.length} module(s)${e.indexCommit?`, index @ ${e.indexCommit}`:""}`];for(let d of e.notes)l.push(` note: ${d}`);for(let d of e.modules){l.push(` ${d.bucket.padEnd(6)} ${d.slug} score ${d.score}${d.reasons.length?` \u2014 ${d.reasons.join("; ")}`:""}`);let u=d.tests.status==="gap"?"GAP":d.tests.status==="covered"?`covered (${d.tests.files.length})`:"n/a";l.push(` open: ${d.open.join(", ")||"\u2014"} \xB7 tests: ${u}`)}e.dangling.length&&l.push(` dangling: ${e.dangling.map(d=>`${d.spec} (from ${d.from})`).join(" \xB7 ")}`);let c=[...new Set(e.broken.map(d=>d.target))];for(let d of c){let u=e.broken.filter(p=>p.target===d),f=u[0].renamedTo!==void 0?` (renamed to ${u[0].renamedTo})`:"",m=[...new Set(u.map(p=>p.from))];l.push(` broken: ${d}${f} still imported by ${m.join(", ")}`)}return e.deleted.length&&l.push(` deleted: ${e.deleted.join(", ")}`),e.unindexed.length&&l.push(` unindexed: ${e.unindexed.join(", ")}`),l.join(` `)+` -`}var kn,WI,BI,UI,Ql,ec=H(()=>{"use strict";$();me();nn();$n();ce();Ze();et();St();Ur();kn={exportedChange:25,hubHigh:20,hubMed:10,blastHigh:20,blastMed:10,testGap:20,surprise:10,dangling:15,brokenImport:40},WI=60,BI=30,UI=3,Ql=2});function gb(){throw new Error("readline is not available in the browser build (the MCP stdio transport is Node-only)")}var hb=H(()=>{$()});function JI(e,t,n){if(t==="doc-link")return n;if(VI.has(e)){if(/^[./]/.test(n))return n;let r=n.split("/");return n.startsWith("@")&&r.length>1?`${r[0]}/${r[1]}`:r[0]}if(e==="python")return n.startsWith(".")?n:n.split(".")[0];if(e==="go"){let r=n.split("/");return r[0].includes(".")?r.slice(0,3).join("/"):r[0]}return e==="rust"?n.split("::")[0]:e==="java"||e==="csharp"?n.split(".").slice(0,2).join("."):e==="php"?n.replace(/^\\+/,"").split("\\")[0]:n.split("/")[0]}function tc(e,t={}){let n=t.limit??qI,r=cn(e),o=new Map;for(let c of e.files){if(t.lang!==void 0&&c.lang!==t.lang)continue;let d=o.get(c.lang);d||(d={files:0,withRefs:0,row:{refs:0,resolved:0,external:0,dangling:0,unsupported:0},reasons:new Map,dangling:new Map,external:new Map,code:!1},o.set(c.lang,d)),d.files++,c.kind==="code"&&(d.code=!0),c.refs.length&&d.withRefs++;for(let u of c.refs){if(d.row.refs++,u.kind==="import"&&!Dh(c.ext)){d.row.unsupported++;continue}let f=u.kind==="doc-link"?sr(c.rel,u.spec,r):ct(c.rel,c.ext,u.spec,r);if(f.kind==="resolved")d.row.resolved++;else if(f.kind==="external"){d.row.external++;let m=JI(c.lang,u.kind,u.spec);d.external.set(m,(d.external.get(m)??0)+1)}else{d.row.dangling++,d.reasons.set(f.reason,(d.reasons.get(f.reason)??0)+1);let m=`${u.spec}\0${f.reason}`,p=d.dangling.get(m);p?(p.count++,T(c.rel,p.example)<0&&(p.example=c.rel)):d.dangling.set(m,{reason:f.reason,count:1,example:c.rel})}}}if(t.lang!==void 0&&!o.size){let c=Object.keys(e.languages).sort(T).join(", ");throw new Error(`no indexed files in language "${t.lang}"${c?` \u2014 one of: ${c}`:""}`)}let s={refs:0,resolved:0,external:0,dangling:0,unsupported:0},a=[];for(let c of[...o.keys()].sort(T)){let d=o.get(c);if(!d.code&&d.row.refs===0&&t.lang===void 0)continue;for(let h of Object.keys(s))s[h]+=d.row[h];let u={};for(let h of[...d.reasons.keys()].sort(T))u[h]=d.reasons.get(h);let f=[...d.dangling.entries()].map(([h,_])=>({spec:h.slice(0,h.indexOf("\0")),reason:_.reason,count:_.count,example:_.example})).sort(yb(h=>h.count,h=>`${h.spec}\0${h.reason}`)).slice(0,n),m=[...d.external.entries()].map(([h,_])=>({name:h,count:_})).sort(yb(h=>h.count,h=>h.name)).slice(0,n),p={lang:c,files:d.files,filesWithRefs:d.withRefs,...d.row,danglingByReason:u,topDangling:f,topExternal:m},g=KI(p);g&&(p.note=g),a.push(p)}let l=[...new Set([...r.warnings,...Pn(e.root).warnings])].sort(T);return{totals:s,languages:a,warnings:l}}function KI(e){let t=e.lang==="markdown"?"link":"import",n=(r,o)=>`${r} ${o}${r===1?"":"s"}`;if(e.refs===0)return`no ${t}s extracted from ${n(e.files,"file")} \u2014 this language gets no ${t} edges`;if(e.unsupported===e.refs)return`no import resolver for this language \u2014 its ${n(e.refs,"import")} never become edges`;if(e.resolved===0&&e.dangling===0)return`every ${t} is external \u2014 no in-repo ${t} edges for this language`;if(e.dangling>e.resolved)return t==="link"?"more links dangle than resolve \u2014 broken relative links in the docs":"more imports dangle than resolve \u2014 check path aliases and `warnings` before trusting impact or dead-code answers"}var qI,VI,yb,Tf=H(()=>{"use strict";$();$n();gt();qr();ce();qI=10,VI=new Set(["typescript","javascript","vue","svelte","astro","html"]);yb=(e,t)=>(n,r)=>e(r)-e(n)||T(t(n),t(r))});function Un(e,t){let n=(Pe(t)?je(e,t):t).replace(/\\/g,"/");for(;n.startsWith("./");)n=n.slice(2);return n!==t&&n!==""&&n!==".."&&!n.startsWith("../")?[t,n]:[t]}function rs(e,t,n){return Un(e,t).find(n)}var nc=H(()=>{"use strict";$();me()});function rc(e,t){if(!e.oversized?.length||!/^[A-Za-z_$][\w$]*$/.test(t))return[];let n=_b.get(e);n||_b.set(e,n=new Map);let r=n.get(t);if(r)return r;let o=new RegExp(`(?XI||mt(a.rel,mn(a.rel).toLowerCase())!=="code")continue;let l;try{l=ie(j(e.root,a.rel),"utf8")}catch{continue}o.test(l)&&s.push({file:a.rel,size:a.size})}return n.set(t,s),s}function hr(e,t,n){let r=n.calls?e.files.filter(a=>a.callsCapped&&a.calls?.some(l=>l.name===t)).map(a=>a.rel):[],o=rc(e,t);if(!r.length&&!o.length)return;let s=[];return r.length&&s.push(`${r.length} file(s) reached the per-file call-site cap, so some of their calls are missing; re-index with a higher --max-calls`),o.length&&s.push(bb(o,`name "${t}"`)),{...r.length?{callCapped:r}:{},...o.length?{notIndexed:o}:{},hint:s.join("; ")}}function bb(e,t){let n=Math.max(...e.map(r=>r.size));return`${e.length} file(s) over --max-bytes ${t} but are not indexed (${e.map(r=>r.file).join(", ")}); re-index with --max-bytes ${n}`}function sc(e,t){let n=rc(e,t);return n.length?` \u2014 ${bb(n,`name "${t}"`)}`:""}function ss(e,t,n){let r=Un(t,n),o=e.oversized?.find(s=>r.includes(s.rel));return o?`not in the index: ${o.rel} is ${o.size} bytes, over --max-bytes (default 1 MiB); re-index with --max-bytes ${o.size} to include it`:void 0}var XI,_b,Ff=H(()=>{"use strict";$();ke();me();In();nc();XI=32*1024*1024,_b=new WeakMap});function yr(e,t){return{name:t,kind:e.kind,file:e.file,line:e.line,...e.parent?{parent:e.parent}:{}}}function Of(e){return{...e,def:yr(e.def,e.def.name)}}function ic(e){return{...e,defs:e.defs.map(t=>yr(t,t.name))}}function wb(e){return{...e,defs:Object.fromEntries(Object.entries(e.defs).map(([t,n])=>[t,n.map(r=>yr(r,t))]))}}function xb(e){return{...e,changes:e.changes.map(t=>({path:t.path,status:t.status,...t.oldPath!==void 0?{oldPath:t.oldPath}:{},...t.module!==void 0?{module:t.module}:{},symbols:t.symbols.map(n=>({name:n.name,kind:n.kind,line:n.line}))}))}}var Nf=H(()=>{"use strict";$()});function is(e){try{return yf(ie(e))}catch{return}}function Sb(e,t){let n=`${e}.${F.pid}.tmp`;try{return Yt(Ce(e),{recursive:!0}),it(n,t),Rn(n,e),!0}catch{return Ke(n,{force:!0}),!1}}var Pf=H(()=>{"use strict";$();ke();me();Yr()});function jf(e){return Re(e.files.map(t=>`${t.rel}:${t.hash}`).join(` -`))}async function Oo(e,t){let n=`${e.mode}:${e.identity}`,r=`${n}:${jf(e.scan)}`;if(Ys&&Ys.key===r)return Ys.index;let o=await t(Ys?.tier===n?Ys.index:void 0);return Ys={key:r,tier:n,index:o},o}function No(e){let t;try{t=Me(j(e,"model.json"))}catch{return}let n=`${e}:${t.mtimeMs}:${t.size}`;if(oc&&oc.key===n)return oc.model;let r=Hs(e);return r&&(oc={key:n,model:r}),r}function ac(e,t){e.scan.commit!==t&&(e.scan.commit=t,e.arts=void 0,e.loadArtifacts=void 0)}function Lf(e){let t=Kt.findIndex(r=>r.key===e);if(t<0)return;let[n]=Kt.splice(t,1);return Kt.unshift(n),n}function _r(e){let t=Kt.findIndex(n=>n.key===e.key);return t>=0&&Kt.splice(t,1),Kt.unshift(e),Kt.length=Math.min(Kt.length,ZI),e}function vb(e){let t=kb(e);for(let n of Kt){let r=new Set([Eb(n.scan.root,e),Eb(kb(n.scan.root),t)]);for(let o of r){let s=o===void 0?void 0:n.cacheMap.get(o);s&&(Df(n.cacheMap,o,s),n.walked=void 0)}}}function Df(e,t,n){e.set(t,{hash:n.hash,record:n.record})}function kb(e){try{return rt(e)}catch{return e}}function Eb(e,t){let n=je(e,t);if(!(!n||n===".."||n.startsWith("../")||Pe(n)))return n.split("/").join("/")}function Po(e,t){let n=e+"\0";for(let r of Kt)if(r.key.startsWith(n))if(r.walked=void 0,t===void 0)for(let[o,s]of r.cacheMap)Df(r.cacheMap,o,s);else{let o=r.cacheMap.get(t);o&&Df(r.cacheMap,t,o)}}function Rb(e,t){return e+"\0"+JSON.stringify({scope:t.scope,include:t.include,exclude:t.exclude,gitignore:t.gitignore,ignoreDirs:t.ignoreDirs,maxBytes:t.maxBytes,maxFiles:t.maxFiles,maxCallsPerFile:t.maxCallsPerFile,out:t.out,fullHash:t.fullHash})}function Lo(e,t={},n){let r=Rb(e,t),o=Lf(r);if(o){if(n&&o.walked===n)return ac(o,en(e)),o.scan;let l=Rt(e,{...t,cache:o.cacheMap,precomputedWalk:n});return l.contentUnchanged?(l.cacheDirty&&(o.cacheMap=Ct(l)),ac(o,l.commit),o.walked=n,o.scan):(_r({key:r,scan:l,cacheMap:Ct(l),walked:n}),l)}let s=Qd(e,{...t,precomputedWalk:n});if(s)return _r({key:r,scan:s.scan,cacheMap:s.cacheMap,arts:s.arts,walked:n}),s.scan;let a=Rt(e,{...t,precomputedWalk:n});return _r({key:r,scan:a,cacheMap:Ct(a),walked:n}),a}async function lc(e,t={},n,r=async()=>{}){let o=Rb(e,t),s=Kt.find(c=>c.key===o);if(s){if(n&&s.walked===n)return ac(s,en(e)),Lf(o),s.scan;let c=s.cacheMap,d=m=>(m.cacheDirty&&(s.cacheMap=Ct(m)),ac(s,m.commit),s.walked=n,Lf(o),s.scan);if(n&&Zd(n,c,t.fullHash)){await r();let m=await bn(e,{...t,cache:c,precomputedWalk:n});return m.contentUnchanged?d(m):(_r({key:o,scan:m,cacheMap:Ct(m),walked:n}),m)}let u=Rt(e,{...t,cache:c,precomputedWalk:n});if(u.contentUnchanged)return d(u);if(n)return _r({key:o,scan:u,cacheMap:Ct(u),walked:n}),u;await r();let f=await bn(e,{...t,cache:c,precomputedWalk:n});return _r({key:o,scan:f,cacheMap:Ct(f)}),f}let a=await Ga(e,{...t,precomputedWalk:n},r);if(a)return _r({key:o,scan:a.scan,cacheMap:a.cacheMap,arts:a.arts,loadArtifacts:a.loadArtifacts,walked:n}),a.scan;await r();let l=await bn(e,{...t,precomputedWalk:n});return _r({key:o,scan:l,cacheMap:Ct(l),walked:n}),l}function cc(e,t={},n){return Ti(e,{...t,precomputedWalk:n})}function dc(e,t={},n,r){let o=r??Lo(e,t,n),s=Kt.find(a=>a.scan===o);return s?s.arts??=s.loadArtifacts?.()??jn(o,t):jn(o,t)}async function Cb(e){await Do(Xe(e,{}))}async function Do(e){await an(Bt(e.files.map(t=>t.ext)))}var Ys,oc,ZI,Kt,uc=H(()=>{"use strict";$();ke();me();Rl();Ut();Li();rr();Ze();pt();Xr();Yr();St();nn();ZI=4,Kt=[]});function Mb(e,t,n=YI){return F.platform==="linux"?new Wf(e,t,n):e$(e,t)}function e$(e,t){let n;try{n=Zo(e,{recursive:!0},(r,o)=>{let s=o?.toString().replaceAll("\\","/")??"";s.split("/").some(l=>Cn.has(l)||l.startsWith(".codeindex-edit-"))||Po(e,s||void 0)}),n.on("error",r=>{t(`MCP watcher disabled (${r.message}); using freshness scans`),n?.close(),n=void 0,Po(e)})}catch(r){t(`MCP watcher unavailable (${r instanceof Error?r.message:String(r)}); using freshness scans`)}return{walk:async()=>({walked:Xe(e,{}),reused:!1}),close:()=>n?.close()}}var YI,QI,Wf,Ab=H(()=>{"use strict";$();ke();bi();me();Ze();uc();YI=8192,QI=2e3;Wf=class{constructor(t,n,r){this.repo=t;this.warn=n;this.maxDirs=r}repo;warn;maxDirs;dirs=new Map;events=0;proof;barrier;disabled=!1;async walk(){if(this.disabled)return{walked:Xe(this.repo,{}),reused:!1};let t=await this.sync();if(t!==void 0&&this.proof?.events===t)return{walked:this.proof.walked,reused:!0};this.proof=void 0;let n=this.walkAndWatch();return t!==void 0&&!this.disabled&&(this.proof={events:t,walked:n}),{walked:n,reused:!1}}close(){for(let t of this.dirs.values())t.close();this.dirs.clear(),this.proof=void 0,this.barrier&&(this.barrier.watcher.close(),Ke(this.barrier.dir,{recursive:!0,force:!0})),this.barrier=null}sync(){this.barrier===void 0&&(this.barrier=this.openBarrier());let t=this.barrier;if(!t)return Promise.resolve(void 0);let n=`barrier-${++t.seq}`,r=j(t.dir,n);return new Promise(o=>{let s=l=>{clearTimeout(a),t.waiting=void 0,Ke(r,{force:!0}),o(l)},a=setTimeout(()=>s(void 0),QI);t.waiting={name:n,done:()=>s(this.events)};try{it(r,"")}catch{s(void 0)}})}openBarrier(){let t;try{t=wr(j(Dp(),"codeindex-watch-"));let n={dir:t,seq:0,watcher:Zo(t,(r,o)=>{n.waiting&&o?.toString()===n.waiting.name&&n.waiting.done()})};return n.watcher.on("error",()=>{}),n}catch(n){return t&&Ke(t,{recursive:!0,force:!0}),this.disable(n instanceof Error?n.message:String(n)),null}}walkAndWatch(){let t=new Set([""]);this.add("");let n=Xe(this.repo,{filter:o=>(o.directory&&(t.add(o.rel),this.add(o.rel)),!0)}),r=".git/info";Q(j(this.repo,r))&&Me(j(this.repo,r)).isDirectory()&&(t.add(r),this.add(r));for(let[o,s]of this.dirs)t.has(o)||(s.close(),this.dirs.delete(o));return n}add(t){if(!(this.disabled||this.dirs.has(t))){if(this.dirs.size>=this.maxDirs){this.disable(`more than ${this.maxDirs} directories to watch`);return}try{let n=Zo(t?j(this.repo,t):this.repo,(r,o)=>this.onEvent(t,r,o));n.on("error",()=>{this.events++,this.forget(t)}),this.dirs.set(t,n)}catch(n){let r=n.code;if(r==="ENOENT"||r==="ENOTDIR"||r==="EACCES")return;this.disable(n instanceof Error?n.message:String(n))}}}onEvent(t,n,r){this.events++;let o=r?.toString();if(!o){Po(this.repo);return}let s=t?`${t}/${o}`:o;n==="rename"&&this.forget(s),Po(this.repo,s)}forget(t){let n=this.dirs.get(t);if(!n)return;n.close(),this.dirs.delete(t);let r=t?t+"/":"";for(let[o,s]of this.dirs)r&&!o.startsWith(r)||(s.close(),this.dirs.delete(o))}disable(t){this.disabled||(this.disabled=!0,this.warn(`MCP watcher disabled (${t}); using freshness scans`),this.close())}}});function fc(e,t){let n=e.properties??{};for(let r of e.required??[]){if(t[r]!==void 0&&t[r]!==null)continue;let o=n[r]?.description;return o?`\`${r}\` is required (${o})`:`\`${r}\` is required`}for(let[r,o]of Object.entries(t)){if(o==null)continue;let s=n[r];if(!s?.type)continue;let a=Array.isArray(o)?"array":typeof o;if(s.type==="number"||s.type==="integer"){let l=a==="number"?o:a==="string"&&o.trim()!==""?Number(o):NaN;if(!Number.isFinite(l))return`\`${r}\` must be a number, got ${a==="string"?JSON.stringify(o):a}`;if(s.type==="integer"&&!Number.isInteger(l))return`\`${r}\` must be a whole number, got ${l}`;if(s.minimum!==void 0&&ls.maximum)return`\`${r}\` must be at most ${s.maximum}`;continue}if(s.type==="array"){let l=s.items?.type==="string",c=l?"an array of strings":"an array";if(a!=="array")return`\`${r}\` must be ${c}, got ${a}`;if(l&&!o.every(d=>typeof d=="string"))return`\`${r}\` must be ${c}`;continue}if(a!==s.type)return`\`${r}\` must be a ${s.type}, got ${a}`;if(s.enum&&!s.enum.includes(o))return`\`${r}\` must be one of ${s.enum.map(l=>JSON.stringify(l)).join(", ")}, got ${JSON.stringify(o)}`}}function mc(e,t,n){if(t||!n)return;let r;try{r=JSON.parse(e)}catch{return}if(!(r===null||typeof r!="object"||Array.isArray(r)))return r}function pc(e){return typeof e=="string"&&zn.includes(e)?e:t$}function n$(e,t,n){let r;try{r=Me(e).size}catch{return"absent"}if(r!==n&&r!==n+1)return"stale";try{let o=ie(e,"utf8");return o===t||o===t+` -`?"identical":"stale"}catch{return"absent"}}function $b(e){return/^[A-Za-z0-9_\-./=@:]+$/.test(e)?e:"'"+e.replace(/'/g,"'\\''")+"'"}function Wo(e,t,n,r,o=!0,s){let a=W.byteLength(e,"utf8"),l=s??a;if(l<=r)return e;let c=o&&Object.hasOwn(Bf,t)?Bf[t]:void 0,d=c?j(n,Ve,c):void 0,u=d?n$(d,e,a):void 0,f=`codeindex index --repo ${$b(n)} --out ${$b(j(n,Ve))}`;return JSON.stringify({truncated:!0,tool:t,bytes:l,maxBytes:r,reason:"This response exceeds the configured limit and was withheld rather than sent as an unusable partial payload.",narrower:Object.hasOwn(Ib,t)?Ib[t]:"narrow the request with the arguments this tool's inputSchema offers",...u==="identical"?{artifact:d,artifactNote:"The full result is on disk here, byte-for-byte what this call would have returned \u2014 read it directly if you need all of it."}:u==="stale"?{artifactNote:`The artifact at ${d} does not match this answer (the repository changed since it was written, or it was indexed with other options). Run \`${f}\` to refresh it, then read it.`}:u==="absent"?{artifactNote:`Run \`${f}\` to get this as a file.`}:{}},null,2)+` -`}function hc(e,t){let n=Bf[t];if(!n)return;let r;try{r=JSON.parse(e)}catch{return}if(!(r.truncated!==!0||typeof r.artifact!="string"))return{type:"resource_link",uri:Mr(r.artifact).href,name:n,description:`The full ${t} result this call was too large to inline.`,mimeType:"application/json"}}var zn,t$,Tb,jo,Fb,gc,Ib,Bf,Ob,yc=H(()=>{"use strict";$();ke();me();wi();rr();zn=["2024-11-05","2025-03-26","2025-06-18","2025-11-25"],t$=zn[zn.length-1],Tb="2025-03-26",jo="2025-06-18",Fb="2025-03-26";gc=1e6,Ib={graph:"pass `scope` to a subdirectory (or `include`/`exclude` globs), or use repo_map / mermaid for an overview",symbols:"pass `name` to look up one symbol, or `concise` for locations only; find_symbol / symbols_overview answer narrower questions",callers:"pass `name` to look up one symbol's call sites, or `concise` for locations only",dead_code:"pass a `limit`, or `scope` to a subdirectory",duplicated_literals:"pass a `limit`, raise `minFiles`/`minCount`, or pass `scope` to a subdirectory",find_references:"the symbol is referenced very widely \u2014 pass `concise`, or ask callers for the call sites alone",find_symbol:"lower `maxResults`, or drop `includeBody`/pass `concise`",symbols_overview:"the file declares a great many symbols \u2014 pass `concise`",grep:"lower `maxHits`, or restrict with `globs` or `scope`",search:"lower `limit`, or pass `scope` to a subdirectory",explain_search:"lower `limit`, or pass `scope` to a subdirectory",complexity:"lower `top`, or pass one `file`",call_graph:"lower `depth`, or follow one `direction`",type_hierarchy:"pass `name` to look up one type",mermaid:"lower `maxEdges`, or focus on one `module`",repo_map:"lower `budgetTokens`",onboard:"lower `budgetTokens`",hotspots:"pass `since` to count recent history only",churn:"pass `since` to count recent history only",coupling:"pass `since` to mine recent history only",check_rules:"narrow the rule set, or pass `scope` to a subdirectory",delta:'pass `concise` (drops the hunks), a `limit` on modules, or `format` "text" for the panel'},Bf={graph:"graph.json",symbols:"symbols.json"};Ob=96});function Hf(e){let t=zo[e];if(t)return{readOnlyHint:!t.write,...t.write?{destructiveHint:t.destructive===!0,idempotentHint:t.idempotent===!0}:{},openWorldHint:t.openWorld===!0}}function ls(){return["all",...Object.keys(Ho).sort()]}function Go(e){let t=e.split(",").map(r=>r.trim()).filter(Boolean),n=new Set;for(let r of t){if(r==="all")return new Set(Uo.map(s=>s.name));let o=Object.hasOwn(Ho,r)?Ho[r]:void 0;if(!o)throw new Error(`unknown tool profile "${r}" \u2014 one of: ${ls().join(", ")}`);for(let s of o)n.add(s)}return n}function Qs(e,t=zn[0],n){let r=t>=Tb,o=t>=jo,s=n?Go(n):void 0,a=s?Uo.filter(l=>s.has(l.name)):Uo;return!e&&!r&&!o?a:a.map(l=>({...l,...o&&zo[l.name]?{title:zo[l.name].title}:{},...o&&as[l.name]?{outputSchema:as[l.name]}:{},...r?{annotations:Hf(l.name)}:{},inputSchema:e?{...l.inputSchema,properties:{...l.inputSchema.properties,repo:{type:"string",description:`Absolute path to the repository root (optional \u2014 defaults to ${e})`}},required:l.inputSchema.required.filter(c=>c!=="repo")}:l.inputSchema}))}var pe,os,_c,Bo,Uf,Hn,Uo,Pt,_e,zf,as,zo,Ho,bc=H(()=>{"use strict";$();yc();pe={repo:{type:"string",description:"Absolute path to the repository root"}},os="name, name@file, file#name, file#Parent/name (a call_graph id) or Parent/name",_c={type:"string",description:'Only count commits after this ref (tag, branch, sha) or since this date ("2024-01-01", "6 months ago"); anything else is an error'},Bo={concise:{type:"boolean",description:"Return declaration locations (name/kind/file/line, plus parent for a member) without full symbol metadata. Keeps every result, reference tier and confidence label (default false)."}},Uf={file:{type:"string",description:"Disambiguate: repo-relative file containing the symbol"},line:{type:"number",minimum:1,description:"Disambiguate same-file homonyms: the declaration's first line, or any line inside it"},strict:{type:"boolean",description:"Refuse the edit (nothing written) when the post-edit check reports warnings (default false)"}},Hn={scope:{type:"string",description:"Restrict to one directory or file (repo-relative); ANDed with include/exclude"},include:{type:"array",items:{type:"string"},description:"Include globs, rooted at the repo: '*.ts' is top-level only, '**/*.ts' any depth"},exclude:{type:"array",items:{type:"string"},description:"Exclude globs (rooted, like include)"}},Uo=[{name:"scan_summary",description:"Deterministically scan a repository: file count, per-language file histogram, HEAD commit, and whether the walk was capped. Fast first look at any codebase.",inputSchema:{type:"object",properties:{...pe,...Hn},required:["repo"]}},{name:"graph",description:"Build the full typed cross-file link-graph (import/call/use/doc-link/mention edges, module grouping, PageRank centrality, Louvain communities, tests-map). Returns graph.json. Large on big repos \u2014 prefer scan_summary/symbols/callers for targeted questions.",inputSchema:{type:"object",properties:{...pe,...Hn},required:["repo"]}},{name:"symbols",description:"Where is a symbol defined and which files reference it? Returns the definition sites (file, line, kind, exported) and referencing files. Omit `name` for the full symbol index.",inputSchema:{type:"object",properties:{...pe,...Bo,name:{type:"string",description:"Symbol name to look up"}},required:["repo"]}},{name:"callers",description:"Who calls a function? Per-symbol caller index: each defined symbol with the exact (file, line) call sites that bind to it. Omit `name` for the full index. An unknown symbol is an error; a known one no site binds to answers with its defs and how many call sites name it anyway (`unresolvedSites`, `sample`).",inputSchema:{type:"object",properties:{...pe,...Bo,name:{type:"string",description:os},lsp:{type:"boolean",description:"Append incoming calls from configured language servers and agreement with static callers. Requires name; name@file disambiguates. Unsupported servers and failures keep the static answer with a stated reason (default false)."},recall:{type:"boolean",description:"Recall-oriented binding: add the name-only matches precision mode rejects (a unique JS/TS name with no import, a same-file homonym whatever the receiver, a proximity guess in Go or into tests), labelling each site corroborated|unique-name (default false = precision)"},raw:{type:"boolean",description:"Every call site of `name` as written, before any binding: {name, sites:[{file, line, receiver?, enclosingSymbol?}]}. Requires name (default false)"},withCaller:{type:"boolean",description:"Add `caller` to each site: the symbol id of the declaration the call sits in (a call_graph node id), so the answer names functions, not just lines (default false)"}},required:["repo"]}},{name:"workspaces",description:"Detect monorepo packages (npm/pnpm/yarn/lerna/nx/cargo/go modules/maven/gradle/uv/composer) with the workspace dependency graph, one cycle if present, a topological build order, and warnings for malformed manifests. `check: true` also compares each package's declared sibling dependencies with the imports it really makes: `undeclared` (imported, not declared \u2014 breaks isolated installs and publishing) and `unusedDeclared` (declared, never imported).",inputSchema:{type:"object",properties:{...pe,check:{type:"boolean",description:"Compare declared workspace dependencies with resolved cross-package imports (builds the link-graph; default false)"}},required:["repo"]}},{name:"churn",description:"Per-file git commit counts (whole history, or a since window) \u2014 the churn half of hotspot analysis. Paths are relative to repo; `shallow: true` means a shallow clone (counts are lower bounds), `error` says why `ok` is false.",inputSchema:{type:"object",properties:{...pe,since:_c},required:["repo"]}},{name:"symbols_overview",description:"All symbols declared in ONE file (name, kind, line span, exported, parent), in declaration order \u2014 the fastest way to understand a file without reading it.",inputSchema:{type:"object",properties:{...pe,...Bo,file:{type:"string",description:"Repo-relative file path"}},required:["repo","file"]}},{name:"find_symbol",description:`Find symbol declarations by name or name path ('Class/method' matches a method inside Class). Each match carries its COMPLETE SIGNATURE (parameters and return type) by default, because "what shape is it" is the question that follows "where is it" almost every time and one round trip beats two. Options: substring matching, includeBody for the declaration's source, concise to drop everything but name/kind/file/line (and a member's parent) when you genuinely only want a location. Exact-name matches rank first.`,inputSchema:{type:"object",properties:{...pe,namePath:{type:"string",description:"Symbol name or Parent/child path"},substring:{type:"boolean"},includeBody:{type:"boolean"},concise:{type:"boolean",description:"Return only name/kind/file/line (plus parent for a member) \u2014 drop the signature, line span, visibility and language. Roughly 2.5x smaller; use it when you are resolving a path and nothing more (default false)."},maxResults:{type:"integer",minimum:1,description:"Cap matches (default 50)"}},required:["repo","namePath"]}},{name:"find_references",description:"Who references a symbol? Three labeled tiers: defs (declarations), callSites (line-precise, import-corroborated call bindings), referencingFiles (file-level identifier/doc mentions \u2014 may include homonyms). Confidence decreases across tiers; the labels let you decide what to trust.",inputSchema:{type:"object",properties:{...pe,name:{type:"string",description:`${os}; a bare name covers every homonym`},...Bo,lsp:{type:"boolean",description:"Also ask a configured language server (see lsp_status) and append an `lsp` block: its references plus an `agreement` matrix (both / lspOnly / staticOnly). The three static tiers are unchanged either way. `staticOnly` can indicate homonyms or an incomplete language-server answer; `partial: true` flags a declaration-only answer while static uses exist. Servers stay up for the session. No config, no binary, a crash or a timeout all degrade to the static answer with a stated reason (default false)."}},required:["repo","name"]}},{name:"symbol_at",description:"Which symbol is at file:line? The innermost declaration holding the line (full metadata plus its symbol `id`, the form callers/call_graph/call_path read) and the declarations around it, outermost first. Turns a grep hit, a stack frame or a diagnostic into something the navigation tools accept. `symbol` is null outside every declaration; `approximate: true` means the declaration has no recorded end line (regex tier), so it is only the nearest declaration above.",inputSchema:{type:"object",properties:{...pe,file:{type:"string",description:"Repo-relative file path"},line:{type:"number",minimum:1,description:"1-based line number"}},required:["repo","file","line"]}},{name:"lsp_status",description:"Is the optional LSP tier configured, and would it answer? Reports the config path and its source, each server with whether its command is on PATH and how many files in this repo it claims, and the languages no server covers. Opt-in by asset: the tier is active only when CODEINDEX_LSP_CONFIG points at a config or ~/.config/codeindex/lsp.json exists; the repo's own /.codeindex/lsp.json names commands to run, so it is read only when the server was started with --trust-lsp-config (or CODEINDEX_TRUST_LSP_CONFIG=1), and is reported as `ignoredConfig` otherwise. `probe: true` additionally starts each server to read the capabilities it really advertises. The tier never touches graph.json/symbols.json \u2014 it annotates query answers only.",inputSchema:{type:"object",properties:{...pe,probe:{type:"boolean",description:"Start each server and read its real capabilities (default false: no spawn)"}},required:["repo"]}},{name:"onboard",description:"One call that says what this repository IS: its own tagline, size and language mix, monorepo layout when there is one, a token-budgeted map of the highest-PageRank files with their key signatures, and where git says work concentrates. Composes scan_summary + workspaces + repo_map + hotspots so the first four round trips of a session become one, and persists the result as the `onboarding` memory (read_memory) so the next session does not repeat them. Set remember:false to skip the write.",inputSchema:{type:"object",properties:{...pe,budgetTokens:{type:"integer",minimum:1,description:"Token budget for the key-files section (default 900)"},remember:{type:"boolean",description:"Persist the brief as the `onboarding` memory (default true)"}},required:["repo"]}},{name:"repo_map",description:"Token-budgeted map of the repository: the most central production files (PageRank over the edges production code creates; tests left out) with their public types, functions and methods first, deterministically rendered to fit `budgetTokens` (default 1024). The densest single read to understand an unfamiliar codebase.",inputSchema:{type:"object",properties:{...pe,budgetTokens:{type:"integer",minimum:1,description:"Approximate token budget (default 1024)"}},required:["repo"]}},{name:"hotspots",description:"Where does work concentrate? Files changed in the window, ranked by git churn \xD7 size (commits \xD7 log2 lines); test files carry `test: true`. High-scoring files are where changes and defects cluster.",inputSchema:{type:"object",properties:{...pe,since:_c,limit:{type:"integer",minimum:1,description:"Max files (default 20)"}},required:["repo"]}},{name:"coupling",description:"Change coupling: pairs of indexed files that repeatedly change in the same commits. strength 1.0 = every change to one touched the other; ranked by `confidence` (the strength a pair's history supports); `linked: false` = no graph edge joins them \u2014 a hidden dependency.",inputSchema:{type:"object",properties:{...pe,since:_c,hidden:{type:"boolean",description:"Only pairs no graph edge links (default false)"},minTogether:{type:"integer",minimum:1,description:"Commits a pair must share (default 3)"},maxCommitFiles:{type:"integer",minimum:1,description:"Skip commits touching more files, as mass refactors (default 30)"},limit:{type:"integer",minimum:1,description:"Max pairs (default 100)"}},required:["repo"]}},{name:"replace_symbol_body",description:"WRITE: replace a symbol's whole declaration with `body` (verbatim, supply full indentation). The symbol is resolved by name path ('Class/method'); ambiguity errors list the candidates \u2014 qualify with `file`, and `line` for same-file homonyms (getter/setter, overloads). Line spans come from the AST index; a regex-tier symbol whose end cannot be proven is refused. The doc comment above the declaration is kept. The edited file is re-extracted before writing: `warnings` reports declarations changed outside the edit and new syntax errors, and `strict` refuses such an edit.",inputSchema:{type:"object",properties:{...pe,namePath:{type:"string"},body:{type:"string"},...Uf},required:["repo","namePath","body"]}},{name:"insert_after_symbol",description:"WRITE: insert `body` after a symbol's declaration (blank-line separation preserved for definition-like kinds). Resolved and verified like replace_symbol_body.",inputSchema:{type:"object",properties:{...pe,namePath:{type:"string"},body:{type:"string"},...Uf},required:["repo","namePath","body"]}},{name:"insert_before_symbol",description:"WRITE: insert `body` before a symbol, above its decorators/attributes and attached doc comment (blank-line separation preserved). Resolved and verified like replace_symbol_body.",inputSchema:{type:"object",properties:{...pe,namePath:{type:"string"},body:{type:"string"},...Uf},required:["repo","namePath","body"]}},{name:"write_memory",description:"Persist a named markdown note under /.codeindex/memories/ (names may use topic/name form). Write small, focused notes: project map, build commands, conventions.",inputSchema:{type:"object",properties:{...pe,name:{type:"string"},content:{type:"string"}},required:["repo","name","content"]}},{name:"read_memory",description:"Read one persisted memory by name.",inputSchema:{type:"object",properties:{...pe,name:{type:"string"}},required:["repo","name"]}},{name:"list_memories",description:"List persisted memory names \u2014 load this first, then read individual memories on relevance.",inputSchema:{type:"object",properties:{...pe},required:["repo"]}},{name:"delete_memory",description:"Delete one persisted memory by name.",inputSchema:{type:"object",properties:{...pe,name:{type:"string"}},required:["repo","name"]}},{name:"dead_code",description:"Dead-code candidates in two labeled tiers: 'unreferenced' (no call site binds AND no other file names it) and 'uncalled' (named elsewhere \u2014 import, type position, base-class list, a same-name call site \u2014 but no call binds). Exported callables only unless `kinds: \"all\"`; test and tail files (examples, docs, fixtures, scripts \u2014 `includeTail` to include them), the package's public API (manifest entry points and what they re-export), language protocol names and overrides of live methods are never candidates. On a large repo this list runs to thousands of entries \u2014 pass `limit`, or `scope` to one subdirectory.",inputSchema:{type:"object",properties:{...pe,...Hn,limit:{type:"integer",minimum:1,description:"Cap entries (default: all)"},kinds:{type:"string",enum:["callable","all"],description:"Candidate kinds (default callable; all adds types, properties and constants, unreferenced only)"},includeTail:{type:"boolean",description:"Also report examples, docs, fixtures and scripts"}},required:["repo"]}},{name:"duplicated_literals",description:"Values with no single source of truth: one literal written out across many files. Three labeled tiers \u2014 'competing' (two or more exported constants hold the same value), 'bypassed' (a constant holds it and other files rewrite it anyway), 'uncentralized' (nothing holds it). Path-like values are also grouped into namespace families, so a whole route space reports once instead of once per route. Covers config files (JSON/YAML/TOML) as well as code, which is where the dangerous cases live: a threshold declared in TypeScript and again in a rules JSON is checked by no compiler. Use it to answer 'what breaks if this value changes' and 'is there already a helper for this'.",inputSchema:{type:"object",properties:{...pe,...Hn,minFiles:{type:"integer",minimum:1,description:"Distinct files a value must span (default 2)"},minCount:{type:"integer",minimum:1,description:"Total occurrences required (default 3)"},includeTests:{type:"boolean",description:"Count test files too (default false)"},limit:{type:"integer",minimum:1,description:"Cap duplications (default: all)"}},required:["repo"]}},{name:"complexity",description:"Cyclomatic-complexity estimates (branch-token counting over AST line spans, comments and string literals aside), most-complex first; functions and methods only \u2014 containers are not ranked, and nested functions score on their own. Pass `file` for one file's symbols, omit for the repo-wide top. Combine with hotspots: the `risk` field of this tool's sibling ranks complexity \xD7 churn.",inputSchema:{type:"object",properties:{...pe,file:{type:"string"},risk:{type:"boolean",description:"Return complexity \xD7 git-churn risk ranking instead"},since:{..._c,description:"Only count risk churn after this ref (tag, branch, sha) or since this date"},top:{type:"integer",minimum:1,description:"Cap ranked symbols"}},required:["repo"]}},{name:"mermaid",description:"Mermaid diagram of the module graph (renders inline in Claude/GitHub \u2014 no graph database). Optionally scoped to one module's neighborhood.",inputSchema:{type:"object",properties:{...pe,module:{type:"string",description:"Module slug to focus on"},maxEdges:{type:"integer",minimum:1,description:"Cap rendered edges"}},required:["repo"]}},{name:"grep",description:"Search file contents with a JavaScript regular expression (ripgrep when available, a deterministic JS scan otherwise \u2014 same results either way). Returns hits sorted by (file, line): {file, line, col, text}, `col` being the 1-based UTF-16 column of the first match and `text` the line, cut to a window around the match when longer than 300 chars. Capped at maxHits (default 200): set `withMeta: true` to get `{ hits, truncated, filesMatched, notes? }` and know whether the list is complete. A pattern too slow for the JS engine is stopped at `timeoutMs` (default 10000) and the response is then always that envelope, with `timedOut: true`.",inputSchema:{type:"object",properties:{...pe,pattern:{type:"string",description:"JavaScript regular expression to search for"},scope:{type:"string",description:"Restrict to one directory or file (repo-relative). ANDed with `globs`"},globs:{type:"array",items:{type:"string"},description:"Restrict to matching paths. Rooted at the repo: '*.ts' matches root-level files only, '**/*.ts' any depth; a '!' prefix excludes (exclusion wins)"},ignoreCase:{type:"boolean"},maxHits:{type:"integer",minimum:1},filesWithMatches:{type:"boolean",description:"One hit per matching file (its first match); maxHits then caps files"},withMeta:{type:"boolean",description:"Return { hits, truncated, filesMatched, notes? } instead of the bare hit array"},timeoutMs:{type:"integer",minimum:1,description:"Wall-clock budget for the JS regex engine (default 10000)"}},required:["repo","pattern"]}},{name:"search",description:'Natural-language-ish lexical search: BM25F ranking over SIX weighted fields \u2014 symbol names (camelCase/snake_case subtokens), path segments, markdown headings, the file summary, per-symbol DOC COMMENTS, and the prose body (comment + short-literal words). The last two are why "where is rate limiting handled" works: the phrase lives in a comment, not in a name. Results carry `matchedFields`, a `line` anchor and `symbolHits` (name/kind/line). NOT embeddings by default \u2014 deterministic, diacritic-folded, zero API keys. Answers "where is auth handled?"-style queries with ranked files, matched terms and top symbols. Query terms with zero document frequency get a deterministic trigram-fuzzy fallback (typo-tolerant) unless `fuzzy: false`. Set `semantic: true` to RRF-fuse an embedding tier (HTTP endpoint, else a local static model) with lexical \u2014 the response then wraps the ranked list as `{ results, tier, degradedReason? }`, `tier` being "endpoint"/"static" when fusion happened or "lexical" (with `degradedReason`) when it did not (see embed_status). Without `semantic`, the response is the bare ranked array, unchanged.',inputSchema:{type:"object",properties:{...pe,...Hn,query:{type:"string",description:"Natural-language or identifier query"},limit:{type:"integer",minimum:1,description:"Max results, a whole number (default 20)"},fuzzy:{type:"boolean",description:'Fallback for query terms with zero document frequency: a morphological stem match first ("caching" finds "cache"), then trigram similarity for typos (default true)'},rank:{type:"string",enum:["lexical","graph"],description:`Structural prior: "graph" multiplies the lexical score by the file's PageRank over the resolved import graph relative to an average file (a leaf \xD70.95, a hub well above \xD71; Go files unchanged); "lexical" (default) scores on text alone. Measured a wash \u2014 it helps some queries and hurts as many \u2014 see SearchOptions.rank.`},exact:{type:"boolean",description:"Drop results that carry no verbatim query-term match \u2014 the ones the stem/trigram bridge produced (default false)."},explain:{type:"boolean",description:"Wrap the response as `{ results, explain }` with the query verdict (default false = bare array). See explain_search."},semantic:{type:"boolean",description:'RRF-fuse an embedding tier with lexical (default false). Precedence: the HTTP endpoint (CODEINDEX_EMBED_ENDPOINT) if set, else a local static model. The response reports the effective tier as a top-level `tier` field ("endpoint"/"static" on success, "lexical" plus `degradedReason` when neither is available/reachable) instead of degrading silently \u2014 see embed_status. `exact` and `rank` apply to the lexical side; `explain: true` adds an `explain` key to that object, restated for the fused rows (with `semanticOnlyResults`).'}},required:["repo","query"]}},{name:"explain_search",description:'Search, and say whether the query actually found anything. Returns `{ results, explain }` where explain.verdict is "match" (a verbatim term matched), "weak" (results exist but rest on a near match, or the identifier you asked for has document frequency 0) or "none". Use this instead of `search` whenever an empty-feeling or surprising result matters: a query for an identifier that is NOT in the indexed tree still returns confident-looking rows built from its subtokens \u2014 searching "nullGipStep7" in a repo that only has "nullGipStep2" ranks files matching "null" and "gip" \u2014 and only the verdict distinguishes that from a real hit. Also names the terms dropped as stopwords, the terms that exist nowhere, and what each near match bridged to.',inputSchema:{type:"object",properties:{...pe,...Hn,query:{type:"string",description:"Natural-language or identifier query"},limit:{type:"integer",minimum:1,description:"Max results, a whole number (default 20)"},fuzzy:{type:"boolean",description:"Stem/trigram fallback for zero-document-frequency terms (default true)"},exact:{type:"boolean",description:"Drop results carrying no verbatim term match (default false)"}},required:["repo","query"]}},{name:"embed_status",description:"Report the embedding tier: the effective mode (none/static/endpoint; endpoint > static model), the resolved model (opt-in, never shipped in the package) with its modelId/dim, EMBED_VERSION, and the configured HTTP endpoint with its reachability. A model.json that is present but fails to load is reported as `model: { present: true, error }` with mode none. Use to check whether `search` with semantic:true will fuse embeddings or degrade to lexical.",inputSchema:{type:"object",properties:{...pe},required:["repo"]}},{name:"type_hierarchy",description:"How do types relate? For one type: the base classes it extends, the interfaces/traits it implements, and \u2014 the reverse direction, which no other tool answers \u2014 what extends or implements IT, plus any declared supertype with no definition in this repo. Omit `name` for the whole hierarchy.",inputSchema:{type:"object",properties:{...pe,name:{type:"string",description:`Type to look up \u2014 ${os}`}},required:["repo"]}},{name:"implementations",description:"Who implements this interface (or extends this class)? Walks the hierarchy TRANSITIVELY, so a class implementing a sub-interface of the one asked about is included. Go states no implementations: a Go type counts when a `var _ I = (*T)(nil)` assertion says so, or when its methods (own and promoted by embedding) cover the interface's by name and parameter count \u2014 those are marked `structural: true`. The tool to reach for before changing an interface.",inputSchema:{type:"object",properties:{...pe,name:{type:"string",description:`Interface/trait/class \u2014 ${os}`}},required:["repo","name"]}},{name:"call_graph",description:"What does this symbol reach, and what reaches it? A bounded symbol-to-symbol neighborhood around `symbol` \u2014 `depth` hops (default 2) following `calls`/`extends`/`implements`/`overrides` edges, `direction` out (callees) | in (callers) | both. Dispatch is followed: walking out through a method also reaches the methods overriding it, and walking in to an override reaches the callers of the method it overrides. Answers impact questions the one-hop `callers` tool cannot.",inputSchema:{type:"object",properties:{...pe,symbol:{type:"string",description:`Symbol to centre on \u2014 ${os}`},depth:{type:"integer",minimum:1,maximum:5,description:"Hops to follow (default 2, max 5)"},direction:{type:"string",enum:["out","in","both"],description:"out | in | both (default both)"}},required:["repo","symbol"]}},{name:"call_path",description:'How does `from` reach `to`? The shortest chains of calls between two symbols (a call to a method may dispatch to an override: `via: "dispatch"`), listed in id order with the total count of equally short ones. No path within `depth` hops answers hops: null, plus `reverseHops` when `to` reaches `from` instead. With files: true, `from` and `to` are file paths and the steps are import/use/call edges of the link-graph \u2014 why does A depend on B (a path only name-inferred calls would open is reported as `inferredHops` unless includeInferred).',inputSchema:{type:"object",properties:{...pe,from:{type:"string",description:`Start \u2014 ${os}; a file path with files: true`},to:{type:"string",description:`End \u2014 ${os}; a file path with files: true`},depth:{type:"integer",minimum:1,description:"Longest path to look for, in hops (default 8, max 16)"},maxPaths:{type:"integer",minimum:1,description:"Shortest paths to list (default 5)"},files:{type:"boolean",description:"Walk the file link-graph instead of the symbol graph (default false)"},includeInferred:{type:"boolean",description:"files: true only \u2014 also step through calls inferred from a name alone (default false)"}},required:["repo","from","to"]}},{name:"impact",description:"What breaks if I change this file or module? The reverse dependency closure over the link-graph: every file that transitively imports, uses or calls `target`, nearest first, with the modules touched. A Go import reaches every non-test file of the package it names. A call inferred from a name alone is counted (`inferredDependents`) but not followed unless includeInferred. Answers from the persisted graph \u2014 no need to pull the whole `graph`.",inputSchema:{type:"object",properties:{...pe,target:{type:"string",description:"Repo-relative file path or module slug"},depth:{type:"integer",minimum:1,description:"Hops to follow (default: the full closure)"},includeInferred:{type:"boolean",description:"Also follow call edges inferred from a name alone (default false)"}},required:["repo","target"]}},{name:"neighbors",description:"What sits next to this file or module in the link-graph, both directions: every edge kind linking each neighbour (import, call, use, extends, implements, doc-link, mention, contains), strongest evidence first, out to `depth` hops. Hubs are listed but not expanded through, so depth 2 stays an answer rather than a dump.",inputSchema:{type:"object",properties:{...pe,target:{type:"string",description:"Repo-relative file path or module slug"},depth:{type:"integer",minimum:1,description:"Hops to follow (default 1)"},kinds:{type:"array",items:{type:"string"},description:"Edge kinds to traverse (default all)"}},required:["repo","target"]}},{name:"check_rules",description:'Validate dependency-cruiser-style architecture rules against the link-graph. Rules (inline JSON array): forbidden edges {name, from, to, kind?, severity?, comment?} with glob paths, plus builtins {name, builtin: "cycles"|"orphans"|"literals"} (module-level import cycles; code files nothing connects to; values with no single source of truth, narrowed by tiers?/minFiles?/minCount?/includeTests?). Unknown keys are rejected; a forbidden rule whose globs match no indexed file comes back as an `unmatched` warning. Returns `{ errors, warnings, violations }`, as the CLI does: deterministic violations with severity error|warn \u2014 a CI gate.',inputSchema:{type:"object",properties:{...pe,...Hn,rules:{type:"array",description:"Rules array (inline JSON \u2014 see description)"},configPath:{type:"string",description:"Read the rules from this JSON file instead \u2014 the CLI's --config. Repo-relative, or absolute; either way it must resolve inside the repository. Ignored when `rules` is given."}},required:["repo"]}},{name:"resolution_report",description:"Can the link-graph be trusted for a language? Per importer language: how many imports resolved to in-repo files, went external (third-party/stdlib), dangle (local target missing, by reason) or are unsupported (no resolver for that language), the top dangling specs with an example importer, the top external packages, and the config warnings (unparseable tsconfig/package.json, missing `extends`) that silently turn imports external. Check it before relying on impact, callers or dead_code for a language.",inputSchema:{type:"object",properties:{...pe,...Hn,lang:{type:"string",description:"Only this language (as scan_summary names it)"},limit:{type:"integer",minimum:1,description:"Entries per top list (default 10)"}},required:["repo"]}},{name:"index_status",description:"Is the persisted index (/.codeindex, written by `codeindex index`) fresh for this tree? Returns whether its cache.json is usable (or why not: absent/unreadable/corrupt/schema/extractor), the indexed vs HEAD commit, per-file drift counts (unchanged, touched, modified, added, deleted, reextract), artifactsFresh and the reasons it is not. Cheap: reads cache.json, walks and stats, hashes only stat-changed files, never extracts. A fresh index is what makes the first graph-shaped call on a large repo fast; a stale one is rebuilt in memory, so answers stay correct either way.",inputSchema:{type:"object",properties:{...pe,...Hn},required:["repo"]}},{name:"delta",description:"What does my change break? Maps the git diff (the branch against its merge-base with the default branch, uncommitted and untracked work included; or the staged changeset) onto the graph: each changed file with the symbols enclosing its hunks, and per module a 0-100 risk score (HIGH/MEDIUM/LOW) in which every point comes with its reason \u2014 exported API changed, hub, blast radius, test gap, a deleted or renamed file that is still imported (`broken`, with its importers), dangling imports. `open` names the files to read first. Call it after editing.",inputSchema:{type:"object",properties:{...pe,...Bo,base:{type:"string",description:"Branch or ref to review against (default: origin/HEAD, origin/main, origin/master, main, master; else HEAD)"},staged:{type:"boolean",description:"Review the staged changeset against HEAD instead (default false)"},depth:{type:"integer",minimum:1,description:"Blast-radius hops (default 2)"},limit:{type:"integer",minimum:1,description:"Max modules, highest score first (default: all)"},format:{type:"string",enum:["json","text"],description:'"text" returns the compact human panel instead of JSON (default "json")'}},required:["repo"]}}],Pt={type:"array",items:{type:"string"}},_e={type:"object"},zf={error:{type:"string"},shallow:{type:"boolean"},note:{type:"string"}},as={call_graph:{type:"object",properties:{root:{type:"array",items:_e},nodes:{type:"array",items:_e},edges:{type:"array",items:_e},truncated:{type:"boolean"},depthClamped:{type:"integer"}},required:["root","nodes","edges"]},call_path:{type:"object",properties:{from:{},to:{},hops:{type:["integer","null"]},paths:{type:"array",items:{type:"array",items:_e}},pathCount:{type:"integer"},truncated:{type:"boolean"},depthClamped:{type:"integer"},reverseHops:{type:"integer"},inferredHops:{type:"integer"}},required:["from","to","hops","paths","pathCount"]},impact:{type:"object",properties:{target:{type:"string"},scope:{type:"string",enum:["module","file"]},seeds:Pt,files:{type:"array",items:_e},modules:Pt,inferredDependents:{type:"integer"}},required:["target","scope","seeds","files","modules"]},neighbors:{type:"object",properties:{target:{type:"string"},scope:{type:"string",enum:["module","file"]},links:{type:"array",items:_e},members:Pt},required:["target","scope","links"]},scan_summary:{type:"object",properties:{engineVersion:{type:"string"},commit:{type:"string"},fileCount:{type:"integer"},languages:{type:"object",additionalProperties:{type:"integer"}},capped:{type:"boolean"}},required:["engineVersion","fileCount","languages","capped"]},graph:{type:"object",properties:{schemaVersion:{type:"integer"},version:{type:"string"},commit:{type:"string"},fileCount:{type:"integer"},languages:{type:"object",additionalProperties:{type:"integer"}},files:{type:"array",items:_e},modules:{type:"array",items:_e},fileEdges:{type:"array",items:_e},moduleEdges:{type:"array",items:_e}},required:["schemaVersion","files","fileEdges","modules","moduleEdges"]},symbols:{type:"object",oneOf:[{type:"object",properties:{schemaVersion:{type:"integer"},defs:_e,refs:_e},required:["schemaVersion","defs"]},{type:"object",properties:{name:{type:"string"},defs:{type:"array",items:_e},refs:Pt},required:["name","defs","refs"]}]},callers:{type:"object",oneOf:[{type:"object",additionalProperties:_e},{type:"object",properties:{def:_e,callers:{type:"array",items:_e},lsp:_e},required:["def","callers"]},{type:"object",properties:{error:{type:"string"},defs:{type:"array",items:_e},unresolvedSites:{type:"integer"},sample:{type:"array",items:_e}},required:["error"]},{type:"object",properties:{name:{type:"string"},sites:{type:"array",items:_e}},required:["name","sites"]}]},workspaces:{type:"object",properties:{packages:{type:"array",items:_e},cycle:{type:["array","null"],items:{type:"string"}},topoOrder:Pt,warnings:Pt,check:{type:"object",properties:{ok:{type:"boolean"},undeclared:{type:"array",items:_e},unusedDeclared:{type:"array",items:_e}},required:["ok","undeclared","unusedDeclared"]}},required:["packages","topoOrder"]},churn:{type:"object",properties:{ok:{type:"boolean"},...zf,churn:{type:"object",additionalProperties:{type:"integer"}}},required:["ok","churn"]},find_references:{type:"object",properties:{defs:{type:"array",items:_e},callSites:{type:"array",items:_e},referencingFiles:Pt},required:["defs","callSites","referencingFiles"]},symbol_at:{type:"object",properties:{file:{type:"string"},line:{type:"integer"},symbol:{type:["object","null"]},enclosing:Pt,approximate:{type:"boolean"}},required:["file","line","symbol","enclosing"]},lsp_status:{type:"object",properties:{lspVersion:{type:"number"},mode:{type:"string",enum:["none","configured"]},configPath:{type:["string","null"]},source:{type:"string",enum:["env","repo","cwd","user","none"]},ignoredConfig:{type:"object",properties:{path:{type:"string"},reason:{type:"string"}},required:["path","reason"]},servers:{type:"array",items:_e},unmappedLanguages:Pt},required:["lspVersion","mode","source","servers","unmappedLanguages"]},check_rules:{type:"object",properties:{errors:{type:"integer"},warnings:{type:"integer"},violations:{type:"array",items:_e}},required:["errors","warnings","violations"]},onboard:{type:"object",properties:{brief:{type:"string"},memory:{type:"string"},memoryError:{type:"string"}},required:["brief"]},explain_search:{type:"object",properties:{results:{type:"array",items:_e},explain:{type:"object",properties:{query:{type:"string"},terms:{type:"array",items:_e},droppedStopwords:Pt,unresolvedTerms:Pt,wholeIdentifier:_e,verdict:{type:"string",enum:["match","weak","none"]},note:{type:"string"},bridgedOnlyResults:{type:"number"},resultCount:{type:"number"}},required:["query","terms","droppedStopwords","unresolvedTerms","verdict","bridgedOnlyResults","resultCount"]}},required:["results","explain"]},hotspots:{type:"object",properties:{churnOk:{type:"boolean"},...zf,hotspots:{type:"array",items:_e}},required:["churnOk","hotspots"]},coupling:{type:"object",properties:{ok:{type:"boolean"},...zf,couplings:{type:"array",items:_e}},required:["ok","couplings"]},duplicated_literals:{type:"object",properties:{duplications:{type:"array",items:_e},families:{type:"array",items:_e}},required:["duplications","families"]},index_status:{type:"object",properties:{indexDir:{type:"string"},present:{type:"boolean"},usable:{type:"boolean"},reason:{type:"string",enum:["absent","unreadable","corrupt","schema","extractor"]},engineVersion:_e,commit:_e,files:{type:["object","null"]},artifactsFresh:{type:"boolean"},stale:Pt},required:["indexDir","present","usable","engineVersion","commit","files","artifactsFresh","stale"]},embed_status:{type:"object",properties:{embedVersion:{type:"integer"},mode:{type:"string",enum:["none","static","endpoint"]},model:{},endpoint:{},endpointReachable:{type:"boolean"}},required:["embedVersion","mode"]},resolution_report:{type:"object",properties:{totals:_e,languages:{type:"array",items:_e},warnings:Pt},required:["totals","languages","warnings"]},write_memory:{type:"object",properties:{written:{type:"string"}},required:["written"]},delete_memory:{type:"object",properties:{deleted:{type:"boolean"}},required:["deleted"]}};for(let e of["replace_symbol_body","insert_after_symbol","insert_before_symbol"])as[e]={type:"object",properties:{file:{type:"string"},symbol:{type:"string"},startLine:{type:"integer"},endLine:{type:"integer"},lines:{type:"integer"},warnings:{type:"array",items:{type:"string"}}},required:["file"]};zo={scan_summary:{title:"Scan summary"},graph:{title:"Link graph"},symbols:{title:"Symbol index"},callers:{title:"Caller index"},workspaces:{title:"Monorepo workspaces"},churn:{title:"Git churn"},symbols_overview:{title:"File symbol overview"},find_symbol:{title:"Find symbol"},find_references:{title:"Find references"},symbol_at:{title:"Symbol at a line"},repo_map:{title:"Repository map"},onboard:{title:"Project brief",write:!0,destructive:!1,idempotent:!0},hotspots:{title:"Hotspots"},coupling:{title:"Change coupling"},replace_symbol_body:{title:"Replace symbol body",write:!0,destructive:!0,idempotent:!0},insert_after_symbol:{title:"Insert after symbol",write:!0,destructive:!1,idempotent:!1},insert_before_symbol:{title:"Insert before symbol",write:!0,destructive:!1,idempotent:!1},write_memory:{title:"Write memory",write:!0,destructive:!1,idempotent:!0},read_memory:{title:"Read memory"},list_memories:{title:"List memories"},delete_memory:{title:"Delete memory",write:!0,destructive:!0,idempotent:!0},dead_code:{title:"Dead-code candidates"},duplicated_literals:{title:"Values with no single source of truth"},complexity:{title:"Complexity"},mermaid:{title:"Mermaid module diagram"},grep:{title:"Grep file contents"},search:{title:"Lexical search",openWorld:!0},explain_search:{title:"Search with a verdict",openWorld:!0},lsp_status:{title:"LSP tier status",openWorld:!0},embed_status:{title:"Embedding tier status",openWorld:!0},type_hierarchy:{title:"Type hierarchy"},implementations:{title:"Implementations"},call_graph:{title:"Call graph neighborhood"},call_path:{title:"Shortest call path"},impact:{title:"Reverse dependency closure"},neighbors:{title:"Link-graph neighbours"},check_rules:{title:"Check architecture rules"},resolution_report:{title:"Import resolution report"},index_status:{title:"Index freshness"},delta:{title:"Review the diff"}};Ho={orient:["scan_summary","index_status","repo_map","onboard","workspaces","mermaid","graph","read_memory","list_memories","write_memory"],find:["search","explain_search","grep","find_symbol","symbols","symbols_overview","symbol_at","embed_status"],impact:["find_references","callers","call_graph","call_path","impact","neighbors","dead_code","type_hierarchy","implementations","lsp_status","resolution_report","delta"],edit:["find_symbol","symbols_overview","symbol_at","replace_symbol_body","insert_after_symbol","insert_before_symbol"],risk:["hotspots","churn","coupling","complexity","check_rules","duplicated_literals","dead_code","delta"],memory:["write_memory","read_memory","list_memories","delete_memory"]}});var Pb={};Rc(Pb,{DEFAULT_MAX_RESPONSE_BYTES:()=>gc,OUTPUT_SCHEMAS:()=>as,PROTOCOL_VERSIONS:()=>zn,TOOLS:()=>Uo,TOOL_META:()=>zo,TOOL_PROFILES:()=>Ho,annotationsFor:()=>Hf,capResponse:()=>Wo,getArtifacts:()=>dc,getScan:()=>Lo,getScanParallel:()=>lc,getScanSummary:()=>cc,memoizedEmbedModel:()=>No,memoizedEmbeddingIndex:()=>Oo,negotiateProtocol:()=>pc,profileNames:()=>ls,resourceLinkFor:()=>hc,runMcpServer:()=>Nb,scanFingerprint:()=>jf,structuredContentFor:()=>mc,toCacheMap:()=>Ct,toolsFor:()=>Qs,toolsInProfiles:()=>Go,validateArgs:()=>fc,warmGrammarsForRepo:()=>Cb,warmGrammarsForWalk:()=>Do});function r$(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return t.jsonrpc!=="2.0"||typeof t.method!="string"?!1:t.id===void 0||t.id===null||typeof t.id=="number"||typeof t.id=="string"}function s$(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return t.jsonrpc==="2.0"&&typeof t.method!="string"&&("result"in t||"error"in t)}function be(e){return typeof e=="string"&&e?e:void 0}function ei(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")&&e.length?e:void 0}function Vf(e){let t=typeof e=="number"?e:typeof e=="string"&&e.trim()!==""?Number(e):NaN;return Number.isFinite(t)&&t>=0?t:void 0}function wc(e,t){let n=Vf(e);if(n!==void 0&&!Number.isInteger(n))throw new Error(`\`${t}\` must be a whole number, got ${n}`);return n}function ze(e){let t=Vf(e);return t!==void 0&&t>0?t:void 0}function qf(e){return e instanceof Error?e.message:String(e)}function xc(e,t){return t?{...e,coverage:t}:e}function Gf(e,t,n){let r=fr(e);if(r.has(n))return n;let o=je(t,le(t,n.replaceAll("\\","/"))).split("/").join("/");if(o===".."||o.startsWith("../")||Pe(o))throw new Error(`\`file\` is outside the repository: ${n}`);if(r.has(o))return o;let s=ss(e,t,n);if(s)throw new Error(s);let a=We(o),l=e.files.filter(c=>We(c.rel)===a).map(c=>c.rel).sort(T).slice(0,5);throw new Error(`file not in the index: ${n}`+(l.length?` \u2014 did you mean ${l.join(", ")}?`:" (paths are repo-relative, as symbols_overview and find_symbol report them)"))}function o$(e,t){let n=be(e.repo)??t;if(!n)throw new Error("`repo` is required (absolute path to the repository root)");let r=le(n);try{if(!Me(r).isDirectory())throw new Error("not a directory")}catch{throw new Error(`repository root is not a readable directory: ${n}`)}return r}async function a$(e,t,n,r,o=async a=>({walked:Xe(a,{}),reused:!1}),s={}){let a={scope:be(t.scope),include:ei(t.include),exclude:ei(t.exclude)},l=be(t.rank),c=l==="graph"||l==="lexical"?{rank:l}:{},d,u;if(!(i$.has(e)&&!(e==="workspaces"&&t.check===!0))){let g=await o(n);d=g.walked,r?.(g.reused?`unchanged since the last call: ${d.files.length} files`:`walked ${d.files.length} files`),u=await lc(n,a,d,()=>d?Do(d):Promise.resolve()),r?.(`scan ready: ${u.files.length} files`)}let m=()=>u??Lo(n,a,d),p=()=>dc(n,a,d,u);if(e==="scan_summary"){let g=cc(n,a,d);return JSON.stringify({engineVersion:Ie,commit:g.commit,fileCount:g.fileCount,languages:g.languages,capped:g.capped},null,2)}if(e==="index_status")return JSON.stringify(Wi(n,a),null,2);if(e==="graph")return Vr(p().graph);if(e==="symbols"){let{symbols:g}=p(),h=be(t.name);if(h){let _=Object.hasOwn(g.defs,h)?g.defs[h]:[],y=Object.hasOwn(g.refs,h)?g.refs[h]:[];return JSON.stringify({name:h,defs:t.concise===!0?_.map(b=>yr(b,h)):_,refs:y},null,2)}return JSON.stringify(t.concise===!0?wb(g):g,null,2)}if(e==="callers"){let g=be(t.name);if(t.lsp===!0&&!g)throw new Error("callers with lsp:true requires `name` (or name@file)");let h=m();if(t.raw===!0){if(!g)throw new Error("callers with raw:true requires `name`");if(t.lsp===!0||t.recall===!0)throw new Error("callers raw:true takes neither lsp nor recall");if(t.withCaller===!0)throw new Error("callers raw:true already names each site's enclosing symbol: it takes no withCaller");let S=hl(h,g);return JSON.stringify(xc(S,hr(h,S.name,{calls:!0})),null,2)}let _=t.recall===!0?Gr(h,void 0,{recall:!0}):Ns(h),y=S=>t.withCaller===!0?so(h,S):S;if(g){let S=Nt(h,g)?.reading,k=S?el(S):g,R=hr(h,S?.name??g,{calls:!0}),I=ul(_,g),P=I&&y(I);if(P){let C=t.lsp===!0?await Ks(h,n,k,P,s):P;return JSON.stringify(xc(t.concise===!0?Of(C):C,R),null,2)}let v=yl(h,g,_);if(!v){let C=mr(h,g).length;throw new Error(`no symbol named "${g}" in the index`+(C?` (${C} call site(s) use the name; raw:true lists them)`:"")+sc(h,g))}return JSON.stringify(xc(t.lsp===!0?await Ks(h,n,k,v,s):v,R),null,2)}let b={};for(let[S,k]of _)b[S]=t.concise===!0?Of(y(k)):y(k);return JSON.stringify(b,null,2)}if(e==="workspaces"){let g=Pn(n),h=t.check===!0?xl(g,p().graph):void 0;return JSON.stringify(Sl(g,h),null,2)}if(e==="churn"){let g=tn(n,{since:be(t.since)}),h={};for(let _ of[...g.churn.keys()].sort())h[_]=g.churn.get(_);return JSON.stringify({ok:g.ok,...hn(g),churn:h},null,2)}if(e==="symbols_overview"){let g=be(t.file);if(!g)throw new Error("`file` is required");let h=m(),_=ro(h,Gf(h,n,g));return JSON.stringify(t.concise===!0?_.map(y=>yr(y,y.name)):_,null,2)}if(e==="find_symbol"){let g=be(t.namePath);if(!g)throw new Error("`namePath` is required");let h=wn(m(),g,{substring:t.substring===!0,includeBody:t.includeBody===!0,concise:t.concise===!0,maxResults:ze(t.maxResults)});return JSON.stringify(h,null,2)}if(e==="find_references"){let g=be(t.name);if(!g)throw new Error("`name` is required");let h=m(),_=io(h,g),y=Nt(h,g)?.reading.name??g,b=t.lsp===!0?await Co(h,n,y,_,s):_;return JSON.stringify(xc(t.concise===!0?ic(b):b,hr(h,y,{calls:!0})),null,2)}if(e==="symbol_at"){let g=be(t.file),h=Vf(t.line);if(!g)throw new Error("`file` is required");if(h===void 0||!Number.isInteger(h)||h<1)throw new Error("`line` must be a positive integer");let _=m(),y=new Set(_.files.map(S=>S.rel)),b=rs(n,g,S=>y.has(S));if(b===void 0)throw new Error(ss(_,n,g)??`no such file in the index: ${g}`);return JSON.stringify(gl(_,b,h),null,2)}if(e==="lsp_status")return JSON.stringify(await Ro(m(),n,t.probe===!0,s),null,2);if(e==="replace_symbol_body"||e==="insert_after_symbol"||e==="insert_before_symbol"){let g=be(t.namePath),h=typeof t.body=="string"?t.body:void 0;if(!g||h===void 0)throw new Error("`namePath` and `body` are required");let _=ze(t.line);if(t.line!==void 0&&(_===void 0||!Number.isInteger(_)))throw new Error("`line` must be a 1-based line number");let y=m(),b=e==="replace_symbol_body"?Gu:e==="insert_after_symbol"?qu:Vu,S=be(t.file),k=b(y,g,h,S===void 0?void 0:Gf(y,n,S),{line:_,strict:t.strict===!0});return vb(j(y.root,k.file)),JSON.stringify(k,null,2)}if(e==="write_memory"){let g=be(t.name),h=typeof t.content=="string"?t.content:void 0;if(!g||h===void 0)throw new Error("`name` and `content` are required");return JSON.stringify({written:ao(n,g,h)},null,2)}if(e==="read_memory"){let g=be(t.name);if(!g)throw new Error("`name` is required");let h=Xu(n,g);if(h===void 0)throw new Error(`no memory named "${g}" \u2014 see list_memories`);return h}if(e==="list_memories")return JSON.stringify(Yu(n),null,2);if(e==="delete_memory"){let g=be(t.name);if(!g)throw new Error("`name` is required");return JSON.stringify({deleted:Zu(n,g)},null,2)}if(e==="dead_code"){let g=Io(m(),{kinds:t.kinds==="all"?"all":"callable",includeTail:t.includeTail===!0});return JSON.stringify(Xl(g,wc(t.limit,"limit")),null,2)}if(e==="duplicated_literals"){let g=Dn(m(),{minFiles:ze(t.minFiles),minCount:ze(t.minCount),includeTests:t.includeTests===!0}),h=wc(t.limit,"limit");return h===void 0||g.duplications.length<=h?JSON.stringify(g,null,2):JSON.stringify({total:g.duplications.length,shown:h,truncated:!0,duplications:g.duplications.slice(0,h),families:g.families},null,2)}if(e==="complexity"){let g=m();if(t.risk===!0){let y=tn(n,{since:be(t.since)}),b=to(g,y.churn,ze(t.top));return JSON.stringify({churnOk:y.ok,...hn(y),risks:b},null,2)}let h=be(t.file),_=h===void 0?void 0:Gf(g,n,h);return JSON.stringify(eo(g,_,ze(t.top)),null,2)}if(e==="mermaid"){let{graph:g}=p();return $o(g,{module:be(t.module),maxEdges:ze(t.maxEdges)})}if(e==="onboard"){let g=m(),{graph:h}=p();return JSON.stringify(bf(g,h,{...ze(t.budgetTokens)!==void 0?{budgetTokens:ze(t.budgetTokens)}:{},...t.remember===!1?{remember:!1}:{}}),null,2)}if(e==="repo_map"){let{scan:g,graph:h}=p();return Qr(g,h,{budgetTokens:ze(t.budgetTokens)})}if(e==="hotspots"){let g=m(),h=tn(n,{since:be(t.since)}),_=es(g,h.churn,ze(t.limit));return JSON.stringify({churnOk:h.ok,...hn(h),hotspots:_},null,2)}if(e==="coupling"){let{graph:g}=p(),h=wo(n,{since:be(t.since),graph:g,hidden:t.hidden===!0,minTogether:ze(t.minTogether),maxCommitFiles:ze(t.maxCommitFiles),maxPairs:ze(t.limit)});return JSON.stringify({ok:h.ok,...hn(h),couplings:h.couplings},null,2)}if(e==="grep"){let g=be(t.pattern);if(!g)throw new Error("`pattern` is required");let h=zs(n,g,{globs:ei(t.globs),scope:be(t.scope),ignoreCase:t.ignoreCase===!0,maxHits:ze(t.maxHits),filesWithMatches:t.filesWithMatches===!0,timeoutMs:ze(t.timeoutMs)});if(t.withMeta===!0||h.timedOut){let{hits:_,truncated:y,filesMatched:b,timedOut:S,notes:k}=h;return JSON.stringify({hits:_,truncated:y,filesMatched:b,...S?{timedOut:S}:{},...k.length?{notes:k}:{}},null,2)}return JSON.stringify(h.hits,null,2)}if(e==="search"){let g=be(t.query);if(!g)throw new Error("`query` is required");let h=wc(t.limit,"limit"),_=m(),y=typeof t.fuzzy=="boolean"?t.fuzzy:void 0,b=t.exact===!0?{exact:!0}:{},S={limit:h,fuzzy:y,...b,...c};if(t.semantic===!0){let I=({results:x,explain:w},E,N)=>JSON.stringify({results:x,tier:E,...N?{degradedReason:N}:{},...t.explain===!0?{explain:w}:{}},null,2),P=gr();if(P)try{let x=await Oo({mode:"endpoint",identity:P,scan:_},E=>_o(_,{previous:E})),w=await yo(g);return I(pr(_,g,x,{...S,queryVec:w}),"endpoint")}catch(x){return I(Gt(_,g,S),"lexical",`embedding endpoint failed: ${qf(x)}`)}let v=Wn(n),{model:C,error:M}=Kr(v,No);if(C){let x=await Oo({mode:"static",identity:`${v}#${C.modelId}`,scan:_},w=>Zr(_,C,{previous:w??is(j(n,Ve,"embeddings.bin"))}));return I(pr(_,g,x,{...S,model:C}),"static")}return I(Gt(_,g,S),"lexical",M?`static model unusable: ${M}`:"no embedding endpoint or static model configured \u2014 see embed_status")}let{results:k,explain:R}=Gt(_,g,S);return JSON.stringify(t.explain===!0?{results:k,explain:R}:k,null,2)}if(e==="explain_search"){let g=be(t.query);if(!g)throw new Error("`query` is required");let h=wc(t.limit,"limit"),_=m(),y=typeof t.fuzzy=="boolean"?t.fuzzy:void 0,{results:b,explain:S}=Gt(_,g,{limit:h,fuzzy:y,...t.exact===!0?{exact:!0}:{},...c});return JSON.stringify({results:b,explain:S},null,2)}if(e==="embed_status"){let g=Wn(n),{model:h,error:_}=Kr(g,No),y=gr(),S={embedVersion:Jt,mode:y?"endpoint":h?"static":"none",model:h?{present:!0,dir:g,modelId:h.modelId,dim:h.dim,vocabSize:h.vocabSize}:_?{present:!0,dir:g,error:_}:{present:!1},endpoint:y??null};return y&&(S.endpointReachable=await ho(y)),JSON.stringify(S,null,2)}if(e==="type_hierarchy"){let g=m(),h=Ps(g),_=be(t.name);if(!_){let b={};for(let[S,k]of h)b[S]=k;return JSON.stringify(b,null,2)}let y=or(h,_,Nt(g,_)?.defs);if(!y)throw new ti(`no type named ${_}`);return JSON.stringify(y,null,2)}if(e==="implementations"){let g=be(t.name);if(!g)throw new Error("`name` is required");let h=m(),_=Ps(h),y=Nt(h,g)?.defs;if(!or(_,g,y))throw new ti(`no type named ${g}`);return JSON.stringify({name:g,implementations:qi(_,g,y)},null,2)}if(e==="call_graph"){let g=be(t.symbol);if(!g)throw new Error("`symbol` is required");let h=be(t.direction),_=h==="out"||h==="in"?h:"both",y=Ji(Ls(m()),g,{...ze(t.depth)!==void 0?{depth:ze(t.depth)}:{},direction:_});if(!y.root.length)throw new ti(`no symbol named ${g}`);return JSON.stringify(y,null,2)}if(e==="call_path"){let g=be(t.from),h=be(t.to);if(!g||!h)throw new Error("`from` and `to` are required");let _={depth:ze(t.depth),maxPaths:ze(t.maxPaths)};if(t.files===!0){let{graph:b}=p(),S=new Set(b.files.map(I=>I.rel)),[k,R]=[g,h].map(I=>{let P=rs(n,I,v=>S.has(v));if(P===void 0)throw new Error(`no such file in the index: ${I}`);return P});return JSON.stringify(sl(b,k,R,{..._,includeInferred:t.includeInferred===!0}),null,2)}if(t.includeInferred===!0)throw new Error("includeInferred applies to files: true only");let y=tl(Ls(m()),g,h,_);if(!y.from.length)throw new Error(`no symbol named ${g}`);if(!y.to.length)throw new Error(`no symbol named ${h}`);return JSON.stringify(y,null,2)}if(e==="impact"||e==="neighbors"){let g=be(t.target);if(!g)throw new Error("`target` is required");let h=ze(t.depth),_;if(e==="neighbors"&&t.kinds!==void 0){let b=ei(t.kinds)??[],S=b.filter(k=>!Ts.includes(k));if(!b.length||S.length)throw new Error(`\`kinds\` expects edge kinds among ${Ts.join("|")}, got ${JSON.stringify(S.length?S:t.kinds)}`);_=new Set(b)}let{graph:y}=p();for(let b of Un(n,g)){let S=e==="impact"?Xi(y,b,h??1/0,{includeInferred:t.includeInferred===!0}):Zi(y,b,h??1,_);if(S)return JSON.stringify(S,null,2)}throw new Error(`no such file or module in the index: ${g}`)}if(e==="check_rules"){let g=be(t.configPath),h;if(t.rules!==void 0)h=Vl(t.rules);else if(g){let b=new Error(`cannot read rules config ${g}`),S;try{S=rt(Pe(g)?g:j(n,g))}catch{throw b}let k=rt(n);if(!S.startsWith(k.endsWith("/")?k:k+"/"))throw new Error(`rules config must be a file inside the repository: ${g}`);let R;try{R=ie(S,"utf8")}catch{throw b}h=ql(R,g)}else throw new Error("`rules` (or `configPath`) is required");let{scan:_,graph:y}=p();return JSON.stringify(Jl(Mo(y,h,{scan:_})),null,2)}if(e==="delta"){let g=Xs(n,{base:be(t.base),staged:t.staged===!0});if("error"in g)throw new Error(g.error);let h=ze(t.depth),_=To(g,h);if(g.files.length){let{scan:S,graph:k,symbols:R}=p();_=Zs(g,k,R,{depth:h,scan:S})}if(be(t.format)==="text")return Fo(_);let y=t.concise===!0?xb(_):_,b=ze(t.limit);return b===void 0||y.modules.length<=b?JSON.stringify(y,null,2):JSON.stringify({...y,modules:y.modules.slice(0,b),totalModules:y.modules.length,truncated:!0},null,2)}if(e==="resolution_report")return JSON.stringify(tc(m(),{lang:be(t.lang),limit:ze(t.limit)}),null,2);throw new Error(`unknown tool: ${e}`)}async function Nb(e={}){let t={name:e.serverInfo?.name??"codeindex",version:e.serverInfo?.version??Ie},n=zn[0],r=e.defaultRepo===void 0?void 0:le(e.defaultRepo),o=Qs(r,n,e.profile),s=new Map(Qs(r).map(k=>[k.name,k.inputSchema])),a=e.watch&&r?Mb(r,k=>F.stderr.write(`codeindex: ${k} -`)):void 0,l=async k=>a&&k===r?a.walk():{walked:Xe(k,{}),reused:!1},c=new Js,d=k=>{let R=Array.isArray(k)?k.map(I=>({jsonrpc:"2.0",...I})):{jsonrpc:"2.0",...k};F.stdout.write(JSON.stringify(R)+` -`)},u=Promise.resolve(),f=new Set,m=new Set,p=new Set,g=k=>{let R=k.finally(()=>p.delete(R));p.add(R)},h=gb({input:F.stdin,terminal:!1});try{for await(let k of h){let R=k.trim();if(!R)continue;let I;try{I=JSON.parse(R)}catch{d({id:null,error:{code:-32700,message:"parse error"}});continue}if(Array.isArray(I)&&I.length===0){d({id:null,error:{code:-32600,message:"invalid request"}});continue}if(Array.isArray(I)){let P=I.map(_),v=C=>{let M=C.filter(x=>x!==void 0);M.length>0&&d(M)};P.some(C=>C instanceof Promise)?g(Promise.all(P).then(v)):v(P)}else{let P=_(I);P instanceof Promise?g(P.then(v=>v?d(v):void 0)):P&&d(P)}}for(;p.size>0;)await Promise.all(p)}finally{a?.close(),await c.close()}function _(k){if(!s$(k))return r$(k)?y(k):{id:null,error:{code:-32600,message:"invalid request"}}}function y(k){let R=!("id"in k),I=P=>R?void 0:{id:k.id??null,...P};try{if(k.method==="initialize")return n=pc(k.params?.protocolVersion),o=Qs(r,n,e.profile),I({result:{protocolVersion:n,capabilities:{tools:{}},serverInfo:t,instructions:`Available tool profiles: ${ls().join(", ")}. Active profile: ${e.profile??"all"}. Configure profiles with --tools . Profiles select advertised tools; known tools remain callable.`}});if(k.method==="ping")return I({result:{}});if(k.method==="tools/list")return I({result:{tools:o}});if(k.method==="tools/call")return b(k,I);if(k.method==="notifications/cancelled"){let P=k.params?.requestId;(typeof P=="string"||typeof P=="number")&&f.has(P)&&m.add(P);return}else return I({error:{code:-32601,message:`method not found: ${k.method}`}})}catch(P){return I({error:{code:-32603,message:qf(P)}})}}function b(k,R){let I=k.params??{},P=I.arguments;if(typeof I.name!="string")return R({error:{code:-32602,message:"invalid params: tools/call requires a string `name`"}});if(P!=null&&(typeof P!="object"||Array.isArray(P)))return R({error:{code:-32602,message:"invalid params: tools/call `arguments` must be an object"}});let v=I.name,C=P??{},M=s.get(v),x=M?fc(M,C):`unknown tool: ${v}`;if(x)return R({result:{content:[{type:"text",text:x}],isError:!0}});let w=n,E=typeof k.id=="string"||typeof k.id=="number"?k.id:void 0;E!==void 0&&f.add(E);let N=I._meta?.progressToken,O=0,L=typeof N=="string"||typeof N=="number"?X=>{if(E!==void 0&&m.has(E))return;let oe=w>=Fb?{message:X}:{};d({method:"notifications/progress",params:{progressToken:N,progress:++O,...oe}})}:void 0,G=u.then(async()=>{if(!(E!==void 0&&m.has(E)))return R(await S(v,C,w,L))});return u=G.catch(()=>{}),G.then(X=>E===void 0?X:(f.delete(E),m.delete(E)?void 0:X))}async function S(k,R,I,P){try{let v=o$(R,r),C=await a$(k,R,v,P,l,{pool:c,trustRepoConfig:e.trustLspConfig}),M=be(R.scope)!==void 0||ei(R.include)!==void 0||ei(R.exclude)!==void 0||be(R.name)!==void 0||R.concise===!0,x=e.maxResponseBytes??gc,w=O=>{let L=O!==C,G=L&&I>=jo?hc(O,k):void 0,X=I>=jo?mc(O,L,as[k]!==void 0):void 0;return{content:G?[{type:"text",text:O},G]:[{type:"text",text:O}],...X?{structuredContent:X}:{},...L?{isError:!0}:{}}},E=Wo(C,k,v,x,!M),N=w(E);if(E===C){let O=W.byteLength(JSON.stringify(N),"utf8")+Ob;O>x&&(N=w(Wo(C,k,v,x,!M,O)))}return{result:N}}catch(v){return{result:{content:[{type:"text",text:v instanceof ti?JSON.stringify({error:v.message},null,2):qf(v)}],isError:!0}}}}}var ti,i$,Jf=H(()=>{"use strict";$();ke();me();hb();bt();El();lr();gt();ce();Fn();Br();qr();nn();uo();xo();bo();Zl();Us();Os();Yl();Tf();js();Ff();nc();Ur();Lr();Gl();Nf();wf();qa();Ju();bl();Fs();Kl();ec();Xr();Yr();Pf();rr();Il();Fl();Ze();Ab();bc();yc();uc();bc();yc();uc();ti=class extends Error{},i$=new Set(["workspaces","churn","grep","write_memory","read_memory","list_memories","delete_memory","embed_status","scan_summary","index_status"])});var Ub={};Rc(Ub,{rewriteCommand:()=>Bb,shellQuote:()=>cs,tokenize:()=>l$});function Db(e){let t=[],n="",r=!1,o=!1;for(let s=0;s{"use strict";$();ge();ln();On();de();nt();it();At();Vr();Cn={exportedChange:25,hubHigh:20,hubMed:10,blastHigh:20,blastMed:10,testGap:20,surprise:10,dangling:15,brokenImport:40},YI=60,QI=30,e$=3,oc=2});function Eb(){throw new Error("readline is not available in the browser build (the MCP stdio transport is Node-only)")}var vb=z(()=>{$()});function o$(e,t,n){if(t==="doc-link")return n;if(i$.has(e)){if(/^[./]/.test(n))return n;let r=n.split("/");return n.startsWith("@")&&r.length>1?`${r[0]}/${r[1]}`:r[0]}if(e==="python")return n.startsWith(".")?n:n.split(".")[0];if(e==="go"){let r=n.split("/");return r[0].includes(".")?r.slice(0,3).join("/"):r[0]}return e==="rust"?n.split("::")[0]:e==="java"||e==="csharp"?n.split(".").slice(0,2).join("."):e==="php"?n.replace(/^\\+/,"").split("\\")[0]:n.split("/")[0]}function lc(e,t={}){let n=t.limit??s$,r=pn(e),o=new Map;for(let c of e.files){if(t.lang!==void 0&&c.lang!==t.lang)continue;let d=o.get(c.lang);d||(d={files:0,withRefs:0,row:{refs:0,resolved:0,external:0,dangling:0,unsupported:0},reasons:new Map,dangling:new Map,external:new Map,code:!1},o.set(c.lang,d)),d.files++,c.kind==="code"&&(d.code=!0),c.refs.length&&d.withRefs++;for(let u of c.refs){if(d.row.refs++,u.kind==="import"&&!Jh(c.ext)){d.row.unsupported++;continue}let f=u.kind==="doc-link"?cr(c.rel,u.spec,r):gt(c.rel,c.ext,u.spec,r);if(f.kind==="resolved")d.row.resolved++;else if(f.kind==="external"){d.row.external++;let m=o$(c.lang,u.kind,u.spec);d.external.set(m,(d.external.get(m)??0)+1)}else{d.row.dangling++,d.reasons.set(f.reason,(d.reasons.get(f.reason)??0)+1);let m=`${u.spec}\0${f.reason}`,p=d.dangling.get(m);p?(p.count++,T(c.rel,p.example)<0&&(p.example=c.rel)):d.dangling.set(m,{reason:f.reason,count:1,example:c.rel})}}}if(t.lang!==void 0&&!o.size){let c=Object.keys(e.languages).sort(T).join(", ");throw new Error(`no indexed files in language "${t.lang}"${c?` \u2014 one of: ${c}`:""}`)}let s={refs:0,resolved:0,external:0,dangling:0,unsupported:0},a=[];for(let c of[...o.keys()].sort(T)){let d=o.get(c);if(!d.code&&d.row.refs===0&&t.lang===void 0)continue;for(let h of Object.keys(s))s[h]+=d.row[h];let u={};for(let h of[...d.reasons.keys()].sort(T))u[h]=d.reasons.get(h);let f=[...d.dangling.entries()].map(([h,_])=>({spec:h.slice(0,h.indexOf("\0")),reason:_.reason,count:_.count,example:_.example})).sort(Rb(h=>h.count,h=>`${h.spec}\0${h.reason}`)).slice(0,n),m=[...d.external.entries()].map(([h,_])=>({name:h,count:_})).sort(Rb(h=>h.count,h=>h.name)).slice(0,n),p={lang:c,files:d.files,filesWithRefs:d.withRefs,...d.row,danglingByReason:u,topDangling:f,topExternal:m},g=a$(p);g&&(p.note=g),a.push(p)}let l=[...new Set([...r.warnings,...jn(e.root).warnings])].sort(T);return{totals:s,languages:a,warnings:l}}function a$(e){let t=e.lang==="markdown"?"link":"import",n=(r,o)=>`${r} ${o}${r===1?"":"s"}`;if(e.refs===0)return`no ${t}s extracted from ${n(e.files,"file")} \u2014 this language gets no ${t} edges`;if(e.unsupported===e.refs)return`no import resolver for this language \u2014 its ${n(e.refs,"import")} never become edges`;if(e.resolved===0&&e.dangling===0)return`every ${t} is external \u2014 no in-repo ${t} edges for this language`;if(e.dangling>e.resolved)return t==="link"?"more links dangle than resolve \u2014 broken relative links in the docs":"more imports dangle than resolve \u2014 check path aliases and `warnings` before trusting impact or dead-code answers"}var s$,i$,Rb,jf=z(()=>{"use strict";$();On();St();Zr();de();s$=10,i$=new Set(["typescript","javascript","vue","svelte","astro","html"]);Rb=(e,t)=>(n,r)=>e(r)-e(n)||T(t(n),t(r))});function Gn(e,t){let n=(We(t)?ze(e,t):t).replace(/\\/g,"/");for(;n.startsWith("./");)n=n.slice(2);return n!==t&&n!==""&&n!==".."&&!n.startsWith("../")?[t,n]:[t]}function ls(e,t,n){return Gn(e,t).find(n)}var cc=z(()=>{"use strict";$();ge()});function dc(e,t){if(!e.oversized?.length||!/^[A-Za-z_$][\w$]*$/.test(t))return[];let n=Cb.get(e);n||Cb.set(e,n=new Map);let r=n.get(t);if(r)return r;let o=new RegExp(`(?l$||bt(a.rel,yn(a.rel).toLowerCase())!=="code")continue;let l;try{l=oe(j(e.root,a.rel),"utf8")}catch{continue}o.test(l)&&s.push({file:a.rel,size:a.size})}return n.set(t,s),s}function xr(e,t,n){let r=n.calls?e.files.filter(a=>a.callsCapped&&a.calls?.some(l=>l.name===t)).map(a=>a.rel):[],o=dc(e,t);if(!r.length&&!o.length)return;let s=[];return r.length&&s.push(`${r.length} file(s) reached the per-file call-site cap, so some of their calls are missing; re-index with a higher --max-calls`),o.length&&s.push(Mb(o,`name "${t}"`)),{...r.length?{callCapped:r}:{},...o.length?{notIndexed:o}:{},hint:s.join("; ")}}function Mb(e,t){let n=Math.max(...e.map(r=>r.size));return`${e.length} file(s) over --max-bytes ${t} but are not indexed (${e.map(r=>r.file).join(", ")}); re-index with --max-bytes ${n}`}function uc(e,t){let n=dc(e,t);return n.length?` \u2014 ${Mb(n,`name "${t}"`)}`:""}function cs(e,t,n){let r=Gn(t,n),o=e.oversized?.find(s=>r.includes(s.rel));return o?`not in the index: ${o.rel} is ${o.size} bytes, over --max-bytes (default 1 MiB); re-index with --max-bytes ${o.size} to include it`:void 0}var l$,Cb,Wf=z(()=>{"use strict";$();Re();ge();Fn();cc();l$=32*1024*1024,Cb=new WeakMap});function Sr(e,t){return{name:t,kind:e.kind,file:e.file,line:e.line,...e.parent?{parent:e.parent}:{}}}function Bf(e){return{...e,def:Sr(e.def,e.def.name)}}function fc(e){return{...e,defs:e.defs.map(t=>Sr(t,t.name))}}function Ab(e){return{...e,defs:Object.fromEntries(Object.entries(e.defs).map(([t,n])=>[t,n.map(r=>Sr(r,t))]))}}function Ib(e){return{...e,changes:e.changes.map(t=>({path:t.path,status:t.status,...t.oldPath!==void 0?{oldPath:t.oldPath}:{},...t.module!==void 0?{module:t.module}:{},symbols:t.symbols.map(n=>({name:n.name,kind:n.kind,line:n.line}))}))}}var Uf=z(()=>{"use strict";$()});function ds(e){try{return Ef(oe(e))}catch{return}}function $b(e,t){let n=`${e}.${F.pid}.tmp`;try{return rn(Ie(e),{recursive:!0}),ut(n,t),An(n,e),!0}catch{return et(n,{force:!0}),!1}}var zf=z(()=>{"use strict";$();Re();ge();rs()});function qf(e){return Ae(e.files.map(t=>`${t.rel}:${t.hash}`).join(` +`))}async function Bo(e,t){let n=`${e.mode}:${e.identity}`,r=`${n}:${qf(e.scan)}`;if(si&&si.key===r)return si.index;let o=await t(si?.tier===n?si.index:void 0);return si={key:r,tier:n,index:o},o}function Uo(e){let t;try{t=$e(j(e,"model.json"))}catch{return}let n=`${e}:${t.mtimeMs}:${t.size}`;if(mc&&mc.key===n)return mc.model;let r=Xs(e);return r&&(mc={key:n,model:r}),r}function pc(e,t){e.scan.commit!==t&&(e.scan.commit=t,e.arts=void 0,e.loadArtifacts=void 0)}function Hf(e){let t=tn.findIndex(r=>r.key===e);if(t<0)return;let[n]=tn.splice(t,1);return tn.unshift(n),n}function kr(e){let t=tn.findIndex(n=>n.key===e.key);return t>=0&&tn.splice(t,1),tn.unshift(e),tn.length=Math.min(tn.length,c$),e}function Ob(e){let t=Tb(e);for(let n of tn){let r=new Set([Fb(n.scan.root,e),Fb(Tb(n.scan.root),t)]);for(let o of r){let s=o===void 0?void 0:n.cacheMap.get(o);s&&(Gf(n.cacheMap,o,s),n.walked=void 0)}}}function Gf(e,t,n){e.set(t,{hash:n.hash,record:n.record})}function Tb(e){try{return ct(e)}catch{return e}}function Fb(e,t){let n=ze(e,t);if(!(!n||n===".."||n.startsWith("../")||We(n)))return n.split("/").join("/")}function zo(e,t){let n=e+"\0";for(let r of tn)if(r.key.startsWith(n))if(r.walked=void 0,t===void 0)for(let[o,s]of r.cacheMap)Gf(r.cacheMap,o,s);else{let o=r.cacheMap.get(t);o&&Gf(r.cacheMap,t,o)}}function Nb(e,t){return e+"\0"+JSON.stringify({scope:t.scope,include:t.include,exclude:t.exclude,gitignore:t.gitignore,ignoreDirs:t.ignoreDirs,maxBytes:t.maxBytes,maxFiles:t.maxFiles,maxCallsPerFile:t.maxCallsPerFile,out:t.out,fullHash:t.fullHash})}function Ho(e,t={},n){let r=Nb(e,t),o=Hf(r);if(o){if(n&&o.walked===n)return pc(o,on(e)),o.scan;let l=Tt(e,{...t,cache:o.cacheMap,precomputedWalk:n});return l.contentUnchanged?(l.cacheDirty&&(o.cacheMap=Ft(l)),pc(o,l.commit),o.walked=n,o.scan):(kr({key:r,scan:l,cacheMap:Ft(l),walked:n}),l)}let s=ou(e,{...t,precomputedWalk:n});if(s)return kr({key:r,scan:s.scan,cacheMap:s.cacheMap,arts:s.arts,walked:n}),s.scan;let a=Tt(e,{...t,precomputedWalk:n});return kr({key:r,scan:a,cacheMap:Ft(a),walked:n}),a}async function gc(e,t={},n,r=async()=>{}){let o=Nb(e,t),s=tn.find(c=>c.key===o);if(s){if(n&&s.walked===n)return pc(s,on(e)),Hf(o),s.scan;let c=s.cacheMap,d=m=>(m.cacheDirty&&(s.cacheMap=Ft(m)),pc(s,m.commit),s.walked=n,Hf(o),s.scan);if(n&&su(n,c,t.fullHash)){await r();let m=await kn(e,{...t,cache:c,precomputedWalk:n});return m.contentUnchanged?d(m):(kr({key:o,scan:m,cacheMap:Ft(m),walked:n}),m)}let u=Tt(e,{...t,cache:c,precomputedWalk:n});if(u.contentUnchanged)return d(u);if(n)return kr({key:o,scan:u,cacheMap:Ft(u),walked:n}),u;await r();let f=await kn(e,{...t,cache:c,precomputedWalk:n});return kr({key:o,scan:f,cacheMap:Ft(f)}),f}let a=await Ya(e,{...t,precomputedWalk:n},r);if(a)return kr({key:o,scan:a.scan,cacheMap:a.cacheMap,arts:a.arts,loadArtifacts:a.loadArtifacts,walked:n}),a.scan;await r();let l=await kn(e,{...t,precomputedWalk:n});return kr({key:o,scan:l,cacheMap:Ft(l),walked:n}),l}function hc(e,t={},n){return Di(e,{...t,precomputedWalk:n})}function yc(e,t={},n,r){let o=r??Ho(e,t,n),s=tn.find(a=>a.scan===o);return s?s.arts??=s.loadArtifacts?.()??Un(o,t):Un(o,t)}async function Pb(e){await Go(tt(e,{}))}async function Go(e){await fn(Vt(e.files.map(t=>t.ext)))}var si,mc,c$,tn,_c=z(()=>{"use strict";$();Re();ge();Fl();Jt();zi();lr();nt();wt();ts();rs();At();ln();c$=4,tn=[]});function Lb(e,t,n=d$){return F.platform==="linux"?new Vf(e,t,n):f$(e,t)}function f$(e,t){let n;try{n=sa(e,{recursive:!0},(r,o)=>{let s=o?.toString().replaceAll("\\","/")??"";s.split("/").some(l=>In.has(l)||l.startsWith(".codeindex-edit-"))||zo(e,s||void 0)}),n.on("error",r=>{t(`MCP watcher disabled (${r.message}); using freshness scans`),n?.close(),n=void 0,zo(e)})}catch(r){t(`MCP watcher unavailable (${r instanceof Error?r.message:String(r)}); using freshness scans`)}return{walk:async()=>({walked:tt(e,{}),reused:!1}),close:()=>n?.close()}}var d$,u$,Vf,Db=z(()=>{"use strict";$();Re();vi();ge();nt();_c();d$=8192,u$=2e3;Vf=class{constructor(t,n,r){this.repo=t;this.warn=n;this.maxDirs=r}repo;warn;maxDirs;dirs=new Map;events=0;proof;barrier;disabled=!1;async walk(){if(this.disabled)return{walked:tt(this.repo,{}),reused:!1};let t=await this.sync();if(t!==void 0&&this.proof?.events===t)return{walked:this.proof.walked,reused:!0};this.proof=void 0;let n=this.walkAndWatch();return t!==void 0&&!this.disabled&&(this.proof={events:t,walked:n}),{walked:n,reused:!1}}close(){for(let t of this.dirs.values())t.close();this.dirs.clear(),this.proof=void 0,this.barrier&&(this.barrier.watcher.close(),et(this.barrier.dir,{recursive:!0,force:!0})),this.barrier=null}sync(){this.barrier===void 0&&(this.barrier=this.openBarrier());let t=this.barrier;if(!t)return Promise.resolve(void 0);let n=`barrier-${++t.seq}`,r=j(t.dir,n);return new Promise(o=>{let s=l=>{clearTimeout(a),t.waiting=void 0,et(r,{force:!0}),o(l)},a=setTimeout(()=>s(void 0),u$);t.waiting={name:n,done:()=>s(this.events)};try{ut(r,"")}catch{s(void 0)}})}openBarrier(){let t;try{t=vr(j(Jp(),"codeindex-watch-"));let n={dir:t,seq:0,watcher:sa(t,(r,o)=>{n.waiting&&o?.toString()===n.waiting.name&&n.waiting.done()})};return n.watcher.on("error",()=>{}),n}catch(n){return t&&et(t,{recursive:!0,force:!0}),this.disable(n instanceof Error?n.message:String(n)),null}}walkAndWatch(){let t=new Set([""]);this.add("");let n=tt(this.repo,{filter:o=>(o.directory&&(t.add(o.rel),this.add(o.rel)),!0)}),r=".git/info";Q(j(this.repo,r))&&$e(j(this.repo,r)).isDirectory()&&(t.add(r),this.add(r));for(let[o,s]of this.dirs)t.has(o)||(s.close(),this.dirs.delete(o));return n}add(t){if(!(this.disabled||this.dirs.has(t))){if(this.dirs.size>=this.maxDirs){this.disable(`more than ${this.maxDirs} directories to watch`);return}try{let n=sa(t?j(this.repo,t):this.repo,(r,o)=>this.onEvent(t,r,o));n.on("error",()=>{this.events++,this.forget(t)}),this.dirs.set(t,n)}catch(n){let r=n.code;if(r==="ENOENT"||r==="ENOTDIR"||r==="EACCES")return;this.disable(n instanceof Error?n.message:String(n))}}}onEvent(t,n,r){this.events++;let o=r?.toString();if(!o){zo(this.repo);return}let s=t?`${t}/${o}`:o;n==="rename"&&this.forget(s),zo(this.repo,s)}forget(t){let n=this.dirs.get(t);if(!n)return;n.close(),this.dirs.delete(t);let r=t?t+"/":"";for(let[o,s]of this.dirs)r&&!o.startsWith(r)||(s.close(),this.dirs.delete(o))}disable(t){this.disabled||(this.disabled=!0,this.warn(`MCP watcher disabled (${t}); using freshness scans`),this.close())}}});function bc(e,t){let n=e.properties??{};for(let r of e.required??[]){if(t[r]!==void 0&&t[r]!==null)continue;let o=n[r]?.description;return o?`\`${r}\` is required (${o})`:`\`${r}\` is required`}for(let[r,o]of Object.entries(t)){if(o==null)continue;let s=n[r];if(!s?.type)continue;let a=Array.isArray(o)?"array":typeof o;if(s.type==="number"||s.type==="integer"){let l=a==="number"?o:a==="string"&&o.trim()!==""?Number(o):NaN;if(!Number.isFinite(l))return`\`${r}\` must be a number, got ${a==="string"?JSON.stringify(o):a}`;if(s.type==="integer"&&!Number.isInteger(l))return`\`${r}\` must be a whole number, got ${l}`;if(s.minimum!==void 0&&ls.maximum)return`\`${r}\` must be at most ${s.maximum}`;continue}if(s.type==="array"){let l=s.items?.type==="string",c=l?"an array of strings":"an array";if(a!=="array")return`\`${r}\` must be ${c}, got ${a}`;if(l&&!o.every(d=>typeof d=="string"))return`\`${r}\` must be ${c}`;continue}if(a!==s.type)return`\`${r}\` must be a ${s.type}, got ${a}`;if(s.enum&&!s.enum.includes(o))return`\`${r}\` must be one of ${s.enum.map(l=>JSON.stringify(l)).join(", ")}, got ${JSON.stringify(o)}`}}function wc(e,t,n){if(t||!n)return;let r;try{r=JSON.parse(e)}catch{return}if(!(r===null||typeof r!="object"||Array.isArray(r)))return r}function xc(e){return typeof e=="string"&&qn.includes(e)?e:m$}function p$(e,t,n){let r;try{r=$e(e).size}catch{return"absent"}if(r!==n&&r!==n+1)return"stale";try{let o=oe(e,"utf8");return o===t||o===t+` +`?"identical":"stale"}catch{return"absent"}}function Wb(e){return/^[A-Za-z0-9_\-./=@:]+$/.test(e)?e:"'"+e.replace(/'/g,"'\\''")+"'"}function Vo(e,t,n,r,o=!0,s){let a=W.byteLength(e,"utf8"),l=s??a;if(l<=r)return e;let c=o&&Object.hasOwn(Jf,t)?Jf[t]:void 0,d=c?j(n,Ye,c):void 0,u=d?p$(d,e,a):void 0,f=`codeindex index --repo ${Wb(n)} --out ${Wb(j(n,Ye))}`;return JSON.stringify({truncated:!0,tool:t,bytes:l,maxBytes:r,reason:"This response exceeds the configured limit and was withheld rather than sent as an unusable partial payload.",narrower:Object.hasOwn(jb,t)?jb[t]:"narrow the request with the arguments this tool's inputSchema offers",...u==="identical"?{artifact:d,artifactNote:"The full result is on disk here, byte-for-byte what this call would have returned \u2014 read it directly if you need all of it."}:u==="stale"?{artifactNote:`The artifact at ${d} does not match this answer (the repository changed since it was written, or it was indexed with other options). Run \`${f}\` to refresh it, then read it.`}:u==="absent"?{artifactNote:`Run \`${f}\` to get this as a file.`}:{}},null,2)+` +`}function kc(e,t){let n=Jf[t];if(!n)return;let r;try{r=JSON.parse(e)}catch{return}if(!(r.truncated!==!0||typeof r.artifact!="string"))return{type:"resource_link",uri:Fr(r.artifact).href,name:n,description:`The full ${t} result this call was too large to inline.`,mimeType:"application/json"}}var qn,m$,Bb,qo,Ub,Sc,jb,Jf,zb,Ec=z(()=>{"use strict";$();Re();ge();Ri();lr();qn=["2024-11-05","2025-03-26","2025-06-18","2025-11-25"],m$=qn[qn.length-1],Bb="2025-03-26",qo="2025-06-18",Ub="2025-03-26";Sc=1e6,jb={graph:"pass `scope` to a subdirectory (or `include`/`exclude` globs), or use repo_map / mermaid for an overview",symbols:"pass `name` to look up one symbol, or `concise` for locations only; find_symbol / symbols_overview answer narrower questions",callers:"pass `name` to look up one symbol's call sites, or `concise` for locations only",dead_code:"pass a `limit`, or `scope` to a subdirectory",duplicated_literals:"pass a `limit`, raise `minFiles`/`minCount`, or pass `scope` to a subdirectory",find_references:"the symbol is referenced very widely \u2014 pass `concise`, or ask callers for the call sites alone",find_symbol:"lower `maxResults`, or drop `includeBody`/pass `concise`",symbols_overview:"the file declares a great many symbols \u2014 pass `concise`",grep:"lower `maxHits`, or restrict with `globs` or `scope`",search:"lower `limit`, or pass `scope` to a subdirectory",explain_search:"lower `limit`, or pass `scope` to a subdirectory",complexity:"lower `top`, or pass one `file`",call_graph:"lower `depth`, or follow one `direction`",type_hierarchy:"pass `name` to look up one type",mermaid:"lower `maxEdges`, or focus on one `module`",repo_map:"lower `budgetTokens`",onboard:"lower `budgetTokens`",hotspots:"pass `since` to count recent history only",churn:"pass `since` to count recent history only",coupling:"pass `since` to mine recent history only",check_rules:"narrow the rule set, or pass `scope` to a subdirectory",delta:'pass `concise` (drops the hunks), a `limit` on modules, or `format` "text" for the panel'},Jf={graph:"graph.json",symbols:"symbols.json"};zb=96});function Zf(e){let t=Xo[e];if(t)return{readOnlyHint:!t.write,...t.write?{destructiveHint:t.destructive===!0,idempotentHint:t.idempotent===!0}:{},openWorldHint:t.openWorld===!0}}function ps(){return["all",...Object.keys(Zo).sort()]}function Yo(e){let t=e.split(",").map(r=>r.trim()).filter(Boolean),n=new Set;for(let r of t){if(r==="all")return new Set(Ko.map(s=>s.name));let o=Object.hasOwn(Zo,r)?Zo[r]:void 0;if(!o)throw new Error(`unknown tool profile "${r}" \u2014 one of: ${ps().join(", ")}`);for(let s of o)n.add(s)}return n}function ii(e,t=qn[0],n){let r=t>=Bb,o=t>=qo,s=n?Yo(n):void 0,a=s?Ko.filter(l=>s.has(l.name)):Ko;return!e&&!r&&!o?a:a.map(l=>({...l,...o&&Xo[l.name]?{title:Xo[l.name].title}:{},...o&&ms[l.name]?{outputSchema:ms[l.name]}:{},...r?{annotations:Zf(l.name)}:{},inputSchema:e?{...l.inputSchema,properties:{...l.inputSchema.properties,repo:{type:"string",description:`Absolute path to the repository root (optional \u2014 defaults to ${e})`}},required:l.inputSchema.required.filter(c=>c!=="repo")}:l.inputSchema}))}var he,us,vc,Jo,Kf,Vn,Ko,zt,_e,Xf,ms,Xo,Zo,Rc=z(()=>{"use strict";$();Ec();he={repo:{type:"string",description:"Absolute path to the repository root"}},us="name, name@file, file#name, file#Parent/name (a call_graph id) or Parent/name",vc={type:"string",description:'Only count commits after this ref (tag, branch, sha) or since this date ("2024-01-01", "6 months ago"); anything else is an error'},Jo={concise:{type:"boolean",description:"Return declaration locations (name/kind/file/line, plus parent for a member) without full symbol metadata. Keeps every result, reference tier and confidence label (default false)."}},Kf={file:{type:"string",description:"Disambiguate: repo-relative file containing the symbol"},line:{type:"number",minimum:1,description:"Disambiguate same-file homonyms: the declaration's first line, or any line inside it"},strict:{type:"boolean",description:"Refuse the edit (nothing written) when the post-edit check reports warnings (default false)"}},Vn={scope:{type:"string",description:"Restrict to one directory or file (repo-relative); ANDed with include/exclude"},include:{type:"array",items:{type:"string"},description:"Include globs, rooted at the repo: '*.ts' is top-level only, '**/*.ts' any depth"},exclude:{type:"array",items:{type:"string"},description:"Exclude globs (rooted, like include)"}},Ko=[{name:"scan_summary",description:"Deterministically scan a repository: file count, per-language file histogram, HEAD commit, and whether the walk was capped. Fast first look at any codebase.",inputSchema:{type:"object",properties:{...he,...Vn},required:["repo"]}},{name:"graph",description:"Build the full typed cross-file link-graph (import/call/use/doc-link/mention edges, module grouping, PageRank centrality, Louvain communities, tests-map). Returns graph.json. Large on big repos \u2014 prefer scan_summary/symbols/callers for targeted questions.",inputSchema:{type:"object",properties:{...he,...Vn},required:["repo"]}},{name:"symbols",description:"Where is a symbol defined and which files reference it? Returns the definition sites (file, line, kind, exported) and referencing files. Omit `name` for the full symbol index.",inputSchema:{type:"object",properties:{...he,...Jo,name:{type:"string",description:"Symbol name to look up"}},required:["repo"]}},{name:"callers",description:"Who calls a function? Per-symbol caller index: each defined symbol with the exact (file, line) call sites that bind to it. Omit `name` for the full index. An unknown symbol is an error; a known one no site binds to answers with its defs and how many call sites name it anyway (`unresolvedSites`, `sample`).",inputSchema:{type:"object",properties:{...he,...Jo,name:{type:"string",description:us},lsp:{type:"boolean",description:"Append incoming calls from configured language servers and agreement with static callers. Requires name; name@file disambiguates. Unsupported servers and failures keep the static answer with a stated reason (default false)."},recall:{type:"boolean",description:"Recall-oriented binding: add the name-only matches precision mode rejects (a unique JS/TS name with no import, a same-file homonym whatever the receiver, a proximity guess in Go or into tests), labelling each site corroborated|unique-name (default false = precision)"},raw:{type:"boolean",description:"Every call site of `name` as written, before any binding: {name, sites:[{file, line, receiver?, enclosingSymbol?}]}. Requires name (default false)"},withCaller:{type:"boolean",description:"Add `caller` to each site: the symbol id of the declaration the call sits in (a call_graph node id), so the answer names functions, not just lines (default false)"}},required:["repo"]}},{name:"workspaces",description:"Detect monorepo packages (npm/pnpm/yarn/lerna/nx/cargo/go modules/maven/gradle/uv/composer) with the workspace dependency graph, one cycle if present, a topological build order, and warnings for malformed manifests. `check: true` also compares each package's declared sibling dependencies with the imports it really makes: `undeclared` (imported, not declared \u2014 breaks isolated installs and publishing) and `unusedDeclared` (declared, never imported).",inputSchema:{type:"object",properties:{...he,check:{type:"boolean",description:"Compare declared workspace dependencies with resolved cross-package imports (builds the link-graph; default false)"}},required:["repo"]}},{name:"churn",description:"Per-file git commit counts (whole history, or a since window) \u2014 the churn half of hotspot analysis. Paths are relative to repo; `shallow: true` means a shallow clone (counts are lower bounds), `error` says why `ok` is false.",inputSchema:{type:"object",properties:{...he,since:vc},required:["repo"]}},{name:"symbols_overview",description:"All symbols declared in ONE file (name, kind, line span, exported, parent), in declaration order \u2014 the fastest way to understand a file without reading it.",inputSchema:{type:"object",properties:{...he,...Jo,file:{type:"string",description:"Repo-relative file path"}},required:["repo","file"]}},{name:"find_symbol",description:`Find symbol declarations by name or name path ('Class/method' matches a method inside Class). Each match carries its COMPLETE SIGNATURE (parameters and return type) by default, because "what shape is it" is the question that follows "where is it" almost every time and one round trip beats two. Options: substring matching, includeBody for the declaration's source, concise to drop everything but name/kind/file/line (and a member's parent) when you genuinely only want a location. Exact-name matches rank first.`,inputSchema:{type:"object",properties:{...he,namePath:{type:"string",description:"Symbol name or Parent/child path"},substring:{type:"boolean"},includeBody:{type:"boolean"},concise:{type:"boolean",description:"Return only name/kind/file/line (plus parent for a member) \u2014 drop the signature, line span, visibility and language. Roughly 2.5x smaller; use it when you are resolving a path and nothing more (default false)."},maxResults:{type:"integer",minimum:1,description:"Cap matches (default 50)"}},required:["repo","namePath"]}},{name:"find_references",description:"Who references a symbol? Three labeled tiers: defs (declarations), callSites (line-precise, import-corroborated call bindings), referencingFiles (file-level identifier/doc mentions \u2014 may include homonyms). Confidence decreases across tiers; the labels let you decide what to trust.",inputSchema:{type:"object",properties:{...he,name:{type:"string",description:`${us}; a bare name covers every homonym`},...Jo,lsp:{type:"boolean",description:"Also ask a configured language server (see lsp_status) and append an `lsp` block: its references plus an `agreement` matrix (both / lspOnly / staticOnly). The three static tiers are unchanged either way. `staticOnly` can indicate homonyms or an incomplete language-server answer; `partial: true` flags a declaration-only answer while static uses exist. Servers stay up for the session. No config, no binary, a crash or a timeout all degrade to the static answer with a stated reason (default false)."}},required:["repo","name"]}},{name:"symbol_at",description:"Which symbol is at file:line? The innermost declaration holding the line (full metadata plus its symbol `id`, the form callers/call_graph/call_path read) and the declarations around it, outermost first. Turns a grep hit, a stack frame or a diagnostic into something the navigation tools accept. `symbol` is null outside every declaration; `approximate: true` means the declaration has no recorded end line (regex tier), so it is only the nearest declaration above.",inputSchema:{type:"object",properties:{...he,file:{type:"string",description:"Repo-relative file path"},line:{type:"number",minimum:1,description:"1-based line number"}},required:["repo","file","line"]}},{name:"lsp_status",description:"Is the optional LSP tier configured, and would it answer? Reports the config path and its source, each server with whether its command is on PATH and how many files in this repo it claims, and the languages no server covers. Opt-in by asset: the tier is active only when CODEINDEX_LSP_CONFIG points at a config or ~/.config/codeindex/lsp.json exists; the repo's own /.codeindex/lsp.json names commands to run, so it is read only when the server was started with --trust-lsp-config (or CODEINDEX_TRUST_LSP_CONFIG=1), and is reported as `ignoredConfig` otherwise. `probe: true` additionally starts each server to read the capabilities it really advertises. The tier never touches graph.json/symbols.json \u2014 it annotates query answers only.",inputSchema:{type:"object",properties:{...he,probe:{type:"boolean",description:"Start each server and read its real capabilities (default false: no spawn)"}},required:["repo"]}},{name:"onboard",description:"One call that says what this repository IS: its own tagline, size and language mix, monorepo layout when there is one, a token-budgeted map of the highest-PageRank files with their key signatures, and where git says work concentrates. Composes scan_summary + workspaces + repo_map + hotspots so the first four round trips of a session become one, and persists the result as the `onboarding` memory (read_memory) so the next session does not repeat them. Set remember:false to skip the write.",inputSchema:{type:"object",properties:{...he,budgetTokens:{type:"integer",minimum:1,description:"Token budget for the key-files section (default 900)"},remember:{type:"boolean",description:"Persist the brief as the `onboarding` memory (default true)"}},required:["repo"]}},{name:"repo_map",description:"Token-budgeted map of the repository: the most central production files (PageRank over the edges production code creates; tests left out) with their public types, functions and methods first, deterministically rendered to fit `budgetTokens` (default 1024). The densest single read to understand an unfamiliar codebase.",inputSchema:{type:"object",properties:{...he,budgetTokens:{type:"integer",minimum:1,description:"Approximate token budget (default 1024)"}},required:["repo"]}},{name:"hotspots",description:"Where does work concentrate? Files changed in the window, ranked by git churn \xD7 size (commits \xD7 log2 lines); test files carry `test: true`. High-scoring files are where changes and defects cluster.",inputSchema:{type:"object",properties:{...he,since:vc,limit:{type:"integer",minimum:1,description:"Max files (default 20)"}},required:["repo"]}},{name:"coupling",description:"Change coupling: pairs of indexed files that repeatedly change in the same commits. strength 1.0 = every change to one touched the other; ranked by `confidence` (the strength a pair's history supports); `linked: false` = no graph edge joins them \u2014 a hidden dependency.",inputSchema:{type:"object",properties:{...he,since:vc,hidden:{type:"boolean",description:"Only pairs no graph edge links (default false)"},minTogether:{type:"integer",minimum:1,description:"Commits a pair must share (default 3)"},maxCommitFiles:{type:"integer",minimum:1,description:"Skip commits touching more files, as mass refactors (default 30)"},limit:{type:"integer",minimum:1,description:"Max pairs (default 100)"}},required:["repo"]}},{name:"replace_symbol_body",description:"WRITE: replace a symbol's whole declaration with `body` (verbatim, supply full indentation). The symbol is resolved by name path ('Class/method'); ambiguity errors list the candidates \u2014 qualify with `file`, and `line` for same-file homonyms (getter/setter, overloads). Line spans come from the AST index; a regex-tier symbol whose end cannot be proven is refused. The doc comment above the declaration is kept. The edited file is re-extracted before writing: `warnings` reports declarations changed outside the edit and new syntax errors, and `strict` refuses such an edit.",inputSchema:{type:"object",properties:{...he,namePath:{type:"string"},body:{type:"string"},...Kf},required:["repo","namePath","body"]}},{name:"insert_after_symbol",description:"WRITE: insert `body` after a symbol's declaration (blank-line separation preserved for definition-like kinds). Resolved and verified like replace_symbol_body.",inputSchema:{type:"object",properties:{...he,namePath:{type:"string"},body:{type:"string"},...Kf},required:["repo","namePath","body"]}},{name:"insert_before_symbol",description:"WRITE: insert `body` before a symbol, above its decorators/attributes and attached doc comment (blank-line separation preserved). Resolved and verified like replace_symbol_body.",inputSchema:{type:"object",properties:{...he,namePath:{type:"string"},body:{type:"string"},...Kf},required:["repo","namePath","body"]}},{name:"write_memory",description:"Persist a named markdown note under /.codeindex/memories/ (names may use topic/name form). Write small, focused notes: project map, build commands, conventions.",inputSchema:{type:"object",properties:{...he,name:{type:"string"},content:{type:"string"}},required:["repo","name","content"]}},{name:"read_memory",description:"Read one persisted memory by name.",inputSchema:{type:"object",properties:{...he,name:{type:"string"}},required:["repo","name"]}},{name:"list_memories",description:"List persisted memory names \u2014 load this first, then read individual memories on relevance.",inputSchema:{type:"object",properties:{...he},required:["repo"]}},{name:"delete_memory",description:"Delete one persisted memory by name.",inputSchema:{type:"object",properties:{...he,name:{type:"string"}},required:["repo","name"]}},{name:"dead_code",description:"Dead-code candidates in two labeled tiers: 'unreferenced' (no call site binds AND no other file names it) and 'uncalled' (named elsewhere \u2014 import, type position, base-class list, a same-name call site \u2014 but no call binds). Exported callables only unless `kinds: \"all\"`; test and tail files (examples, docs, fixtures, scripts \u2014 `includeTail` to include them), the package's public API (manifest entry points and what they re-export), language protocol names and overrides of live methods are never candidates. On a large repo this list runs to thousands of entries \u2014 pass `limit`, or `scope` to one subdirectory.",inputSchema:{type:"object",properties:{...he,...Vn,limit:{type:"integer",minimum:1,description:"Cap entries (default: all)"},kinds:{type:"string",enum:["callable","all"],description:"Candidate kinds (default callable; all adds types, properties and constants, unreferenced only)"},includeTail:{type:"boolean",description:"Also report examples, docs, fixtures and scripts"}},required:["repo"]}},{name:"duplicated_literals",description:"Values with no single source of truth: one literal written out across many files. Three labeled tiers \u2014 'competing' (two or more exported constants hold the same value), 'bypassed' (a constant holds it and other files rewrite it anyway), 'uncentralized' (nothing holds it). Path-like values are also grouped into namespace families, so a whole route space reports once instead of once per route. Covers config files (JSON/YAML/TOML) as well as code, which is where the dangerous cases live: a threshold declared in TypeScript and again in a rules JSON is checked by no compiler. Use it to answer 'what breaks if this value changes' and 'is there already a helper for this'.",inputSchema:{type:"object",properties:{...he,...Vn,minFiles:{type:"integer",minimum:1,description:"Distinct files a value must span (default 2)"},minCount:{type:"integer",minimum:1,description:"Total occurrences required (default 3)"},includeTests:{type:"boolean",description:"Count test files too (default false)"},limit:{type:"integer",minimum:1,description:"Cap duplications (default: all)"}},required:["repo"]}},{name:"complexity",description:"Cyclomatic-complexity estimates (branch-token counting over AST line spans, comments and string literals aside), most-complex first; functions and methods only \u2014 containers are not ranked, and nested functions score on their own. Pass `file` for one file's symbols, omit for the repo-wide top. Combine with hotspots: the `risk` field of this tool's sibling ranks complexity \xD7 churn.",inputSchema:{type:"object",properties:{...he,file:{type:"string"},risk:{type:"boolean",description:"Return complexity \xD7 git-churn risk ranking instead"},since:{...vc,description:"Only count risk churn after this ref (tag, branch, sha) or since this date"},top:{type:"integer",minimum:1,description:"Cap ranked symbols"}},required:["repo"]}},{name:"mermaid",description:"Mermaid diagram of the module graph (renders inline in Claude/GitHub \u2014 no graph database). Optionally scoped to one module's neighborhood.",inputSchema:{type:"object",properties:{...he,module:{type:"string",description:"Module slug to focus on"},maxEdges:{type:"integer",minimum:1,description:"Cap rendered edges"}},required:["repo"]}},{name:"grep",description:"Search file contents with a JavaScript regular expression (ripgrep when available, a deterministic JS scan otherwise \u2014 same results either way). Returns hits sorted by (file, line): {file, line, col, text}, `col` being the 1-based UTF-16 column of the first match and `text` the line, cut to a window around the match when longer than 300 chars. Capped at maxHits (default 200): set `withMeta: true` to get `{ hits, truncated, filesMatched, notes? }` and know whether the list is complete. A pattern too slow for the JS engine is stopped at `timeoutMs` (default 10000) and the response is then always that envelope, with `timedOut: true`.",inputSchema:{type:"object",properties:{...he,pattern:{type:"string",description:"JavaScript regular expression to search for"},scope:{type:"string",description:"Restrict to one directory or file (repo-relative). ANDed with `globs`"},globs:{type:"array",items:{type:"string"},description:"Restrict to matching paths. Rooted at the repo: '*.ts' matches root-level files only, '**/*.ts' any depth; a '!' prefix excludes (exclusion wins)"},ignoreCase:{type:"boolean"},maxHits:{type:"integer",minimum:1},filesWithMatches:{type:"boolean",description:"One hit per matching file (its first match); maxHits then caps files"},withMeta:{type:"boolean",description:"Return { hits, truncated, filesMatched, notes? } instead of the bare hit array"},timeoutMs:{type:"integer",minimum:1,description:"Wall-clock budget for the JS regex engine (default 10000)"}},required:["repo","pattern"]}},{name:"search",description:'Natural-language-ish lexical search: BM25F ranking over SIX weighted fields \u2014 symbol names (camelCase/snake_case subtokens), path segments, markdown headings, the file summary, per-symbol DOC COMMENTS, and the prose body (comment + short-literal words). The last two are why "where is rate limiting handled" works: the phrase lives in a comment, not in a name. Results carry `matchedFields`, a `line` anchor and `symbolHits` (name/kind/line). NOT embeddings by default \u2014 deterministic, diacritic-folded, zero API keys. Answers "where is auth handled?"-style queries with ranked files, matched terms and top symbols. Query terms with zero document frequency get a deterministic trigram-fuzzy fallback (typo-tolerant) unless `fuzzy: false`. Set `semantic: true` to RRF-fuse an embedding tier (HTTP endpoint, else a local static model) with lexical \u2014 the response then wraps the ranked list as `{ results, tier, degradedReason? }`, `tier` being "endpoint"/"static" when fusion happened or "lexical" (with `degradedReason`) when it did not (see embed_status). Without `semantic`, the response is the bare ranked array, unchanged.',inputSchema:{type:"object",properties:{...he,...Vn,query:{type:"string",description:"Natural-language or identifier query"},limit:{type:"integer",minimum:1,description:"Max results, a whole number (default 20)"},fuzzy:{type:"boolean",description:'Fallback for query terms with zero document frequency: a morphological stem match first ("caching" finds "cache"), then trigram similarity for typos (default true)'},rank:{type:"string",enum:["lexical","graph"],description:`Structural prior: "graph" multiplies the lexical score by the file's PageRank over the resolved import graph relative to an average file (a leaf \xD70.95, a hub well above \xD71; Go files unchanged); "lexical" (default) scores on text alone. Measured a wash \u2014 it helps some queries and hurts as many \u2014 see SearchOptions.rank.`},exact:{type:"boolean",description:"Drop results that carry no verbatim query-term match \u2014 the ones the stem/trigram bridge produced (default false)."},explain:{type:"boolean",description:"Wrap the response as `{ results, explain }` with the query verdict (default false = bare array). See explain_search."},semantic:{type:"boolean",description:'RRF-fuse an embedding tier with lexical (default false). Precedence: the HTTP endpoint (CODEINDEX_EMBED_ENDPOINT) if set, else a local static model. The response reports the effective tier as a top-level `tier` field ("endpoint"/"static" on success, "lexical" plus `degradedReason` when neither is available/reachable) instead of degrading silently \u2014 see embed_status. `exact` and `rank` apply to the lexical side; `explain: true` adds an `explain` key to that object, restated for the fused rows (with `semanticOnlyResults`).'}},required:["repo","query"]}},{name:"explain_search",description:'Search, and say whether the query actually found anything. Returns `{ results, explain }` where explain.verdict is "match" (a verbatim term matched), "weak" (results exist but rest on a near match, or the identifier you asked for has document frequency 0) or "none". Use this instead of `search` whenever an empty-feeling or surprising result matters: a query for an identifier that is NOT in the indexed tree still returns confident-looking rows built from its subtokens \u2014 searching "nullGipStep7" in a repo that only has "nullGipStep2" ranks files matching "null" and "gip" \u2014 and only the verdict distinguishes that from a real hit. Also names the terms dropped as stopwords, the terms that exist nowhere, and what each near match bridged to.',inputSchema:{type:"object",properties:{...he,...Vn,query:{type:"string",description:"Natural-language or identifier query"},limit:{type:"integer",minimum:1,description:"Max results, a whole number (default 20)"},fuzzy:{type:"boolean",description:"Stem/trigram fallback for zero-document-frequency terms (default true)"},exact:{type:"boolean",description:"Drop results carrying no verbatim term match (default false)"}},required:["repo","query"]}},{name:"embed_status",description:"Report the embedding tier: the effective mode (none/static/endpoint; endpoint > static model), the resolved model (opt-in, never shipped in the package) with its modelId/dim, EMBED_VERSION, and the configured HTTP endpoint with its reachability. A model.json that is present but fails to load is reported as `model: { present: true, error }` with mode none. Use to check whether `search` with semantic:true will fuse embeddings or degrade to lexical.",inputSchema:{type:"object",properties:{...he},required:["repo"]}},{name:"type_hierarchy",description:"How do types relate? For one type: the base classes it extends, the interfaces/traits it implements, and \u2014 the reverse direction, which no other tool answers \u2014 what extends or implements IT, plus any declared supertype with no definition in this repo. Omit `name` for the whole hierarchy.",inputSchema:{type:"object",properties:{...he,name:{type:"string",description:`Type to look up \u2014 ${us}`}},required:["repo"]}},{name:"implementations",description:"Who implements this interface (or extends this class)? Walks the hierarchy TRANSITIVELY, so a class implementing a sub-interface of the one asked about is included. Go states no implementations: a Go type counts when a `var _ I = (*T)(nil)` assertion says so, or when its methods (own and promoted by embedding) cover the interface's by name and parameter count \u2014 those are marked `structural: true`. The tool to reach for before changing an interface.",inputSchema:{type:"object",properties:{...he,name:{type:"string",description:`Interface/trait/class \u2014 ${us}`}},required:["repo","name"]}},{name:"call_graph",description:"What does this symbol reach, and what reaches it? A bounded symbol-to-symbol neighborhood around `symbol` \u2014 `depth` hops (default 2) following `calls`/`extends`/`implements`/`overrides` edges, `direction` out (callees) | in (callers) | both. Dispatch is followed: walking out through a method also reaches the methods overriding it, and walking in to an override reaches the callers of the method it overrides. Answers impact questions the one-hop `callers` tool cannot.",inputSchema:{type:"object",properties:{...he,symbol:{type:"string",description:`Symbol to centre on \u2014 ${us}`},depth:{type:"integer",minimum:1,maximum:5,description:"Hops to follow (default 2, max 5)"},direction:{type:"string",enum:["out","in","both"],description:"out | in | both (default both)"}},required:["repo","symbol"]}},{name:"call_path",description:'How does `from` reach `to`? The shortest chains of calls between two symbols (a call to a method may dispatch to an override: `via: "dispatch"`), listed in id order with the total count of equally short ones. No path within `depth` hops answers hops: null, plus `reverseHops` when `to` reaches `from` instead. With files: true, `from` and `to` are file paths and the steps are import/use/call edges of the link-graph \u2014 why does A depend on B (a path only name-inferred calls would open is reported as `inferredHops` unless includeInferred).',inputSchema:{type:"object",properties:{...he,from:{type:"string",description:`Start \u2014 ${us}; a file path with files: true`},to:{type:"string",description:`End \u2014 ${us}; a file path with files: true`},depth:{type:"integer",minimum:1,description:"Longest path to look for, in hops (default 8, max 16)"},maxPaths:{type:"integer",minimum:1,description:"Shortest paths to list (default 5)"},files:{type:"boolean",description:"Walk the file link-graph instead of the symbol graph (default false)"},includeInferred:{type:"boolean",description:"files: true only \u2014 also step through calls inferred from a name alone (default false)"}},required:["repo","from","to"]}},{name:"impact",description:"What breaks if I change this file or module? The reverse dependency closure over the link-graph: every file that transitively imports, uses or calls `target`, nearest first, with the modules touched. A Go import reaches every non-test file of the package it names. A call inferred from a name alone is counted (`inferredDependents`) but not followed unless includeInferred. Answers from the persisted graph \u2014 no need to pull the whole `graph`.",inputSchema:{type:"object",properties:{...he,target:{type:"string",description:"Repo-relative file path or module slug"},depth:{type:"integer",minimum:1,description:"Hops to follow (default: the full closure)"},includeInferred:{type:"boolean",description:"Also follow call edges inferred from a name alone (default false)"}},required:["repo","target"]}},{name:"neighbors",description:"What sits next to this file or module in the link-graph, both directions: every edge kind linking each neighbour (import, call, use, extends, implements, doc-link, mention, contains), strongest evidence first, out to `depth` hops. Hubs are listed but not expanded through, so depth 2 stays an answer rather than a dump.",inputSchema:{type:"object",properties:{...he,target:{type:"string",description:"Repo-relative file path or module slug"},depth:{type:"integer",minimum:1,description:"Hops to follow (default 1)"},kinds:{type:"array",items:{type:"string"},description:"Edge kinds to traverse (default all)"}},required:["repo","target"]}},{name:"check_rules",description:'Validate dependency-cruiser-style architecture rules against the link-graph. Rules (inline JSON array): forbidden edges {name, from, to, kind?, severity?, comment?} with glob paths, plus builtins {name, builtin: "cycles"|"orphans"|"literals"} (module-level import cycles; code files nothing connects to; values with no single source of truth, narrowed by tiers?/minFiles?/minCount?/includeTests?). Unknown keys are rejected; a forbidden rule whose globs match no indexed file comes back as an `unmatched` warning. Returns `{ errors, warnings, violations }`, as the CLI does: deterministic violations with severity error|warn \u2014 a CI gate.',inputSchema:{type:"object",properties:{...he,...Vn,rules:{type:"array",description:"Rules array (inline JSON \u2014 see description)"},configPath:{type:"string",description:"Read the rules from this JSON file instead \u2014 the CLI's --config. Repo-relative, or absolute; either way it must resolve inside the repository. Ignored when `rules` is given."}},required:["repo"]}},{name:"resolution_report",description:"Can the link-graph be trusted for a language? Per importer language: how many imports resolved to in-repo files, went external (third-party/stdlib), dangle (local target missing, by reason) or are unsupported (no resolver for that language), the top dangling specs with an example importer, the top external packages, and the config warnings (unparseable tsconfig/package.json, missing `extends`) that silently turn imports external. Check it before relying on impact, callers or dead_code for a language.",inputSchema:{type:"object",properties:{...he,...Vn,lang:{type:"string",description:"Only this language (as scan_summary names it)"},limit:{type:"integer",minimum:1,description:"Entries per top list (default 10)"}},required:["repo"]}},{name:"index_status",description:"Is the persisted index (/.codeindex, written by `codeindex index`) fresh for this tree? Returns whether its cache.json is usable (or why not: absent/unreadable/corrupt/schema/extractor), the indexed vs HEAD commit, per-file drift counts (unchanged, touched, modified, added, deleted, reextract), artifactsFresh and the reasons it is not. Cheap: reads cache.json, walks and stats, hashes only stat-changed files, never extracts. A fresh index is what makes the first graph-shaped call on a large repo fast; a stale one is rebuilt in memory, so answers stay correct either way.",inputSchema:{type:"object",properties:{...he,...Vn},required:["repo"]}},{name:"delta",description:"What does my change break? Maps the git diff (the branch against its merge-base with the default branch, uncommitted and untracked work included; or the staged changeset) onto the graph: each changed file with the symbols enclosing its hunks, and per module a 0-100 risk score (HIGH/MEDIUM/LOW) in which every point comes with its reason \u2014 exported API changed, hub, blast radius, test gap, a deleted or renamed file that is still imported (`broken`, with its importers), dangling imports. `open` names the files to read first. Call it after editing.",inputSchema:{type:"object",properties:{...he,...Jo,base:{type:"string",description:"Branch or ref to review against (default: origin/HEAD, origin/main, origin/master, main, master; else HEAD)"},staged:{type:"boolean",description:"Review the staged changeset against HEAD instead (default false)"},depth:{type:"integer",minimum:1,description:"Blast-radius hops (default 2)"},limit:{type:"integer",minimum:1,description:"Max modules, highest score first (default: all)"},format:{type:"string",enum:["json","text"],description:'"text" returns the compact human panel instead of JSON (default "json")'}},required:["repo"]}}],zt={type:"array",items:{type:"string"}},_e={type:"object"},Xf={error:{type:"string"},shallow:{type:"boolean"},note:{type:"string"}},ms={call_graph:{type:"object",properties:{root:{type:"array",items:_e},nodes:{type:"array",items:_e},edges:{type:"array",items:_e},truncated:{type:"boolean"},depthClamped:{type:"integer"}},required:["root","nodes","edges"]},call_path:{type:"object",properties:{from:{},to:{},hops:{type:["integer","null"]},paths:{type:"array",items:{type:"array",items:_e}},pathCount:{type:"integer"},truncated:{type:"boolean"},depthClamped:{type:"integer"},reverseHops:{type:"integer"},inferredHops:{type:"integer"}},required:["from","to","hops","paths","pathCount"]},impact:{type:"object",properties:{target:{type:"string"},scope:{type:"string",enum:["module","file"]},seeds:zt,files:{type:"array",items:_e},modules:zt,inferredDependents:{type:"integer"}},required:["target","scope","seeds","files","modules"]},neighbors:{type:"object",properties:{target:{type:"string"},scope:{type:"string",enum:["module","file"]},links:{type:"array",items:_e},members:zt},required:["target","scope","links"]},scan_summary:{type:"object",properties:{engineVersion:{type:"string"},commit:{type:"string"},fileCount:{type:"integer"},languages:{type:"object",additionalProperties:{type:"integer"}},capped:{type:"boolean"}},required:["engineVersion","fileCount","languages","capped"]},graph:{type:"object",properties:{schemaVersion:{type:"integer"},version:{type:"string"},commit:{type:"string"},fileCount:{type:"integer"},languages:{type:"object",additionalProperties:{type:"integer"}},files:{type:"array",items:_e},modules:{type:"array",items:_e},fileEdges:{type:"array",items:_e},moduleEdges:{type:"array",items:_e}},required:["schemaVersion","files","fileEdges","modules","moduleEdges"]},symbols:{type:"object",oneOf:[{type:"object",properties:{schemaVersion:{type:"integer"},defs:_e,refs:_e},required:["schemaVersion","defs"]},{type:"object",properties:{name:{type:"string"},defs:{type:"array",items:_e},refs:zt},required:["name","defs","refs"]}]},callers:{type:"object",oneOf:[{type:"object",additionalProperties:_e},{type:"object",properties:{def:_e,callers:{type:"array",items:_e},lsp:_e},required:["def","callers"]},{type:"object",properties:{error:{type:"string"},defs:{type:"array",items:_e},unresolvedSites:{type:"integer"},sample:{type:"array",items:_e}},required:["error"]},{type:"object",properties:{name:{type:"string"},sites:{type:"array",items:_e}},required:["name","sites"]}]},workspaces:{type:"object",properties:{packages:{type:"array",items:_e},cycle:{type:["array","null"],items:{type:"string"}},topoOrder:zt,warnings:zt,check:{type:"object",properties:{ok:{type:"boolean"},undeclared:{type:"array",items:_e},unusedDeclared:{type:"array",items:_e}},required:["ok","undeclared","unusedDeclared"]}},required:["packages","topoOrder"]},churn:{type:"object",properties:{ok:{type:"boolean"},...Xf,churn:{type:"object",additionalProperties:{type:"integer"}}},required:["ok","churn"]},find_references:{type:"object",properties:{defs:{type:"array",items:_e},callSites:{type:"array",items:_e},referencingFiles:zt},required:["defs","callSites","referencingFiles"]},symbol_at:{type:"object",properties:{file:{type:"string"},line:{type:"integer"},symbol:{type:["object","null"]},enclosing:zt,approximate:{type:"boolean"}},required:["file","line","symbol","enclosing"]},lsp_status:{type:"object",properties:{lspVersion:{type:"number"},mode:{type:"string",enum:["none","configured"]},configPath:{type:["string","null"]},source:{type:"string",enum:["env","repo","cwd","user","none"]},ignoredConfig:{type:"object",properties:{path:{type:"string"},reason:{type:"string"}},required:["path","reason"]},servers:{type:"array",items:_e},unmappedLanguages:zt},required:["lspVersion","mode","source","servers","unmappedLanguages"]},check_rules:{type:"object",properties:{errors:{type:"integer"},warnings:{type:"integer"},violations:{type:"array",items:_e}},required:["errors","warnings","violations"]},onboard:{type:"object",properties:{brief:{type:"string"},memory:{type:"string"},memoryError:{type:"string"}},required:["brief"]},explain_search:{type:"object",properties:{results:{type:"array",items:_e},explain:{type:"object",properties:{query:{type:"string"},terms:{type:"array",items:_e},droppedStopwords:zt,unresolvedTerms:zt,wholeIdentifier:_e,verdict:{type:"string",enum:["match","weak","none"]},note:{type:"string"},bridgedOnlyResults:{type:"number"},resultCount:{type:"number"}},required:["query","terms","droppedStopwords","unresolvedTerms","verdict","bridgedOnlyResults","resultCount"]}},required:["results","explain"]},hotspots:{type:"object",properties:{churnOk:{type:"boolean"},...Xf,hotspots:{type:"array",items:_e}},required:["churnOk","hotspots"]},coupling:{type:"object",properties:{ok:{type:"boolean"},...Xf,couplings:{type:"array",items:_e}},required:["ok","couplings"]},duplicated_literals:{type:"object",properties:{duplications:{type:"array",items:_e},families:{type:"array",items:_e}},required:["duplications","families"]},index_status:{type:"object",properties:{indexDir:{type:"string"},present:{type:"boolean"},usable:{type:"boolean"},reason:{type:"string",enum:["absent","unreadable","corrupt","schema","extractor"]},engineVersion:_e,commit:_e,files:{type:["object","null"]},artifactsFresh:{type:"boolean"},stale:zt},required:["indexDir","present","usable","engineVersion","commit","files","artifactsFresh","stale"]},embed_status:{type:"object",properties:{embedVersion:{type:"integer"},mode:{type:"string",enum:["none","static","endpoint"]},model:{},endpoint:{},endpointReachable:{type:"boolean"}},required:["embedVersion","mode"]},resolution_report:{type:"object",properties:{totals:_e,languages:{type:"array",items:_e},warnings:zt},required:["totals","languages","warnings"]},write_memory:{type:"object",properties:{written:{type:"string"}},required:["written"]},delete_memory:{type:"object",properties:{deleted:{type:"boolean"}},required:["deleted"]}};for(let e of["replace_symbol_body","insert_after_symbol","insert_before_symbol"])ms[e]={type:"object",properties:{file:{type:"string"},symbol:{type:"string"},startLine:{type:"integer"},endLine:{type:"integer"},lines:{type:"integer"},warnings:{type:"array",items:{type:"string"}}},required:["file"]};Xo={scan_summary:{title:"Scan summary"},graph:{title:"Link graph"},symbols:{title:"Symbol index"},callers:{title:"Caller index"},workspaces:{title:"Monorepo workspaces"},churn:{title:"Git churn"},symbols_overview:{title:"File symbol overview"},find_symbol:{title:"Find symbol"},find_references:{title:"Find references"},symbol_at:{title:"Symbol at a line"},repo_map:{title:"Repository map"},onboard:{title:"Project brief",write:!0,destructive:!1,idempotent:!0},hotspots:{title:"Hotspots"},coupling:{title:"Change coupling"},replace_symbol_body:{title:"Replace symbol body",write:!0,destructive:!0,idempotent:!0},insert_after_symbol:{title:"Insert after symbol",write:!0,destructive:!1,idempotent:!1},insert_before_symbol:{title:"Insert before symbol",write:!0,destructive:!1,idempotent:!1},write_memory:{title:"Write memory",write:!0,destructive:!1,idempotent:!0},read_memory:{title:"Read memory"},list_memories:{title:"List memories"},delete_memory:{title:"Delete memory",write:!0,destructive:!0,idempotent:!0},dead_code:{title:"Dead-code candidates"},duplicated_literals:{title:"Values with no single source of truth"},complexity:{title:"Complexity"},mermaid:{title:"Mermaid module diagram"},grep:{title:"Grep file contents"},search:{title:"Lexical search",openWorld:!0},explain_search:{title:"Search with a verdict",openWorld:!0},lsp_status:{title:"LSP tier status",openWorld:!0},embed_status:{title:"Embedding tier status",openWorld:!0},type_hierarchy:{title:"Type hierarchy"},implementations:{title:"Implementations"},call_graph:{title:"Call graph neighborhood"},call_path:{title:"Shortest call path"},impact:{title:"Reverse dependency closure"},neighbors:{title:"Link-graph neighbours"},check_rules:{title:"Check architecture rules"},resolution_report:{title:"Import resolution report"},index_status:{title:"Index freshness"},delta:{title:"Review the diff"}};Zo={orient:["scan_summary","index_status","repo_map","onboard","workspaces","mermaid","graph","read_memory","list_memories","write_memory"],find:["search","explain_search","grep","find_symbol","symbols","symbols_overview","symbol_at","embed_status"],impact:["find_references","callers","call_graph","call_path","impact","neighbors","dead_code","type_hierarchy","implementations","lsp_status","resolution_report","delta"],edit:["find_symbol","symbols_overview","symbol_at","replace_symbol_body","insert_after_symbol","insert_before_symbol"],risk:["hotspots","churn","coupling","complexity","check_rules","duplicated_literals","dead_code","delta"],memory:["write_memory","read_memory","list_memories","delete_memory"]}});var Gb={};Fc(Gb,{DEFAULT_MAX_RESPONSE_BYTES:()=>Sc,OUTPUT_SCHEMAS:()=>ms,PROTOCOL_VERSIONS:()=>qn,TOOLS:()=>Ko,TOOL_META:()=>Xo,TOOL_PROFILES:()=>Zo,annotationsFor:()=>Zf,capResponse:()=>Vo,getArtifacts:()=>yc,getScan:()=>Ho,getScanParallel:()=>gc,getScanSummary:()=>hc,memoizedEmbedModel:()=>Uo,memoizedEmbeddingIndex:()=>Bo,negotiateProtocol:()=>xc,profileNames:()=>ps,resourceLinkFor:()=>kc,runMcpServer:()=>Hb,scanFingerprint:()=>qf,structuredContentFor:()=>wc,toCacheMap:()=>Ft,toolsFor:()=>ii,toolsInProfiles:()=>Yo,validateArgs:()=>bc,warmGrammarsForRepo:()=>Pb,warmGrammarsForWalk:()=>Go});function g$(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return t.jsonrpc!=="2.0"||typeof t.method!="string"?!1:t.id===void 0||t.id===null||typeof t.id=="number"||typeof t.id=="string"}function h$(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return t.jsonrpc==="2.0"&&typeof t.method!="string"&&("result"in t||"error"in t)}function xe(e){return typeof e=="string"&&e?e:void 0}function oi(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")&&e.length?e:void 0}function em(e){let t=typeof e=="number"?e:typeof e=="string"&&e.trim()!==""?Number(e):NaN;return Number.isFinite(t)&&t>=0?t:void 0}function Cc(e,t){let n=em(e);if(n!==void 0&&!Number.isInteger(n))throw new Error(`\`${t}\` must be a whole number, got ${n}`);return n}function Ve(e){let t=em(e);return t!==void 0&&t>0?t:void 0}function Qf(e){return e instanceof Error?e.message:String(e)}function Mc(e,t){return t?{...e,coverage:t}:e}function Yf(e,t,n){let r=yr(e);if(r.has(n))return n;let o=ze(t,ce(t,n.replaceAll("\\","/"))).split("/").join("/");if(o===".."||o.startsWith("../")||We(o))throw new Error(`\`file\` is outside the repository: ${n}`);if(r.has(o))return o;let s=cs(e,t,n);if(s)throw new Error(s);let a=He(o),l=e.files.filter(c=>He(c.rel)===a).map(c=>c.rel).sort(T).slice(0,5);throw new Error(`file not in the index: ${n}`+(l.length?` \u2014 did you mean ${l.join(", ")}?`:" (paths are repo-relative, as symbols_overview and find_symbol report them)"))}function _$(e,t){let n=xe(e.repo)??t;if(!n)throw new Error("`repo` is required (absolute path to the repository root)");let r=ce(n);try{if(!$e(r).isDirectory())throw new Error("not a directory")}catch{throw new Error(`repository root is not a readable directory: ${n}`)}return r}async function b$(e,t,n,r,o=async a=>({walked:tt(a,{}),reused:!1}),s={}){let a={scope:xe(t.scope),include:oi(t.include),exclude:oi(t.exclude)},l=xe(t.rank),c=l==="graph"||l==="lexical"?{rank:l}:{},d,u;if(!(y$.has(e)&&!(e==="workspaces"&&t.check===!0))){let g=await o(n);d=g.walked,r?.(g.reused?`unchanged since the last call: ${d.files.length} files`:`walked ${d.files.length} files`),u=await gc(n,a,d,()=>d?Go(d):Promise.resolve()),r?.(`scan ready: ${u.files.length} files`)}let m=()=>u??Ho(n,a,d),p=()=>yc(n,a,d,u);if(e==="scan_summary"){let g=hc(n,a,d);return JSON.stringify({engineVersion:Ne,commit:g.commit,fileCount:g.fileCount,languages:g.languages,capped:g.capped},null,2)}if(e==="index_status")return JSON.stringify(qi(n,a),null,2);if(e==="graph")return Yr(p().graph);if(e==="symbols"){let{symbols:g}=p(),h=xe(t.name);if(h){let _=Object.hasOwn(g.defs,h)?g.defs[h]:[],y=Object.hasOwn(g.refs,h)?g.refs[h]:[];return JSON.stringify({name:h,defs:t.concise===!0?_.map(b=>Sr(b,h)):_,refs:y},null,2)}return JSON.stringify(t.concise===!0?Ab(g):g,null,2)}if(e==="callers"){let g=xe(t.name);if(t.lsp===!0&&!g)throw new Error("callers with lsp:true requires `name` (or name@file)");let h=m();if(t.raw===!0){if(!g)throw new Error("callers with raw:true requires `name`");if(t.lsp===!0||t.recall===!0)throw new Error("callers raw:true takes neither lsp nor recall");if(t.withCaller===!0)throw new Error("callers raw:true already names each site's enclosing symbol: it takes no withCaller");let S=kl(h,g);return JSON.stringify(Mc(S,xr(h,S.name,{calls:!0})),null,2)}let _=t.recall===!0?Xr(h,void 0,{recall:!0}):Bs(h),y=S=>t.withCaller===!0?fo(h,S):S;if(g){let S=Ut(h,g)?.reading,k=S?al(S):g,C=xr(h,S?.name??g,{calls:!0}),I=_l(_,g),P=I&&y(I);if(P){let R=t.lsp===!0?await ti(h,n,k,P,s):P;return JSON.stringify(Mc(t.concise===!0?Bf(R):R,C),null,2)}let v=El(h,g,_);if(!v){let R=_r(h,g).length;throw new Error(`no symbol named "${g}" in the index`+(R?` (${R} call site(s) use the name; raw:true lists them)`:"")+uc(h,g))}return JSON.stringify(Mc(t.lsp===!0?await ti(h,n,k,v,s):v,C),null,2)}let b={};for(let[S,k]of _)b[S]=t.concise===!0?Bf(y(k)):y(k);return JSON.stringify(b,null,2)}if(e==="workspaces"){let g=jn(n),h=t.check===!0?Ml(g,p().graph):void 0;return JSON.stringify(Al(g,h),null,2)}if(e==="churn"){let g=an(n,{since:xe(t.since)}),h={};for(let _ of[...g.churn.keys()].sort())h[_]=g.churn.get(_);return JSON.stringify({ok:g.ok,...wn(g),churn:h},null,2)}if(e==="symbols_overview"){let g=xe(t.file);if(!g)throw new Error("`file` is required");let h=m(),_=uo(h,Yf(h,n,g));return JSON.stringify(t.concise===!0?_.map(y=>Sr(y,y.name)):_,null,2)}if(e==="find_symbol"){let g=xe(t.namePath);if(!g)throw new Error("`namePath` is required");let h=En(m(),g,{substring:t.substring===!0,includeBody:t.includeBody===!0,concise:t.concise===!0,maxResults:Ve(t.maxResults)});return JSON.stringify(h,null,2)}if(e==="find_references"){let g=xe(t.name);if(!g)throw new Error("`name` is required");let h=m(),_=mo(h,g),y=Ut(h,g)?.reading.name??g,b=t.lsp===!0?await Oo(h,n,y,_,s):_;return JSON.stringify(Mc(t.concise===!0?fc(b):b,xr(h,y,{calls:!0})),null,2)}if(e==="symbol_at"){let g=xe(t.file),h=em(t.line);if(!g)throw new Error("`file` is required");if(h===void 0||!Number.isInteger(h)||h<1)throw new Error("`line` must be a positive integer");let _=m(),y=new Set(_.files.map(S=>S.rel)),b=ls(n,g,S=>y.has(S));if(b===void 0)throw new Error(cs(_,n,g)??`no such file in the index: ${g}`);return JSON.stringify(Sl(_,b,h),null,2)}if(e==="lsp_status")return JSON.stringify(await Fo(m(),n,t.probe===!0,s),null,2);if(e==="replace_symbol_body"||e==="insert_after_symbol"||e==="insert_before_symbol"){let g=xe(t.namePath),h=typeof t.body=="string"?t.body:void 0;if(!g||h===void 0)throw new Error("`namePath` and `body` are required");let _=Ve(t.line);if(t.line!==void 0&&(_===void 0||!Number.isInteger(_)))throw new Error("`line` must be a 1-based line number");let y=m(),b=e==="replace_symbol_body"?Yu:e==="insert_after_symbol"?Qu:ef,S=xe(t.file),k=b(y,g,h,S===void 0?void 0:Yf(y,n,S),{line:_,strict:t.strict===!0});return Ob(j(y.root,k.file)),JSON.stringify(k,null,2)}if(e==="write_memory"){let g=xe(t.name),h=typeof t.content=="string"?t.content:void 0;if(!g||h===void 0)throw new Error("`name` and `content` are required");return JSON.stringify({written:go(n,g,h)},null,2)}if(e==="read_memory"){let g=xe(t.name);if(!g)throw new Error("`name` is required");let h=rf(n,g);if(h===void 0)throw new Error(`no memory named "${g}" \u2014 see list_memories`);return h}if(e==="list_memories")return JSON.stringify(of(n),null,2);if(e==="delete_memory"){let g=xe(t.name);if(!g)throw new Error("`name` is required");return JSON.stringify({deleted:sf(n,g)},null,2)}if(e==="dead_code"){let g=Lo(m(),{kinds:t.kinds==="all"?"all":"callable",includeTail:t.includeTail===!0});return JSON.stringify(rc(g,Cc(t.limit,"limit")),null,2)}if(e==="duplicated_literals"){let g=Bn(m(),{minFiles:Ve(t.minFiles),minCount:Ve(t.minCount),includeTests:t.includeTests===!0}),h=Cc(t.limit,"limit");return h===void 0||g.duplications.length<=h?JSON.stringify(g,null,2):JSON.stringify({total:g.duplications.length,shown:h,truncated:!0,duplications:g.duplications.slice(0,h),families:g.families},null,2)}if(e==="complexity"){let g=m();if(t.risk===!0){let y=an(n,{since:xe(t.since)}),b=ao(g,y.churn,Ve(t.top));return JSON.stringify({churnOk:y.ok,...wn(y),risks:b},null,2)}let h=xe(t.file),_=h===void 0?void 0:Yf(g,n,h);return JSON.stringify(oo(g,_,Ve(t.top)),null,2)}if(e==="mermaid"){let{graph:g}=p();return Do(g,{module:xe(t.module),maxEdges:Ve(t.maxEdges)})}if(e==="onboard"){let g=m(),{graph:h}=p();return JSON.stringify(Rf(g,h,{...Ve(t.budgetTokens)!==void 0?{budgetTokens:Ve(t.budgetTokens)}:{},...t.remember===!1?{remember:!1}:{}}),null,2)}if(e==="repo_map"){let{scan:g,graph:h}=p();return ss(g,h,{budgetTokens:Ve(t.budgetTokens)})}if(e==="hotspots"){let g=m(),h=an(n,{since:xe(t.since)}),_=is(g,h.churn,Ve(t.limit));return JSON.stringify({churnOk:h.ok,...wn(h),hotspots:_},null,2)}if(e==="coupling"){let{graph:g}=p(),h=Co(n,{since:xe(t.since),graph:g,hidden:t.hidden===!0,minTogether:Ve(t.minTogether),maxCommitFiles:Ve(t.maxCommitFiles),maxPairs:Ve(t.limit)});return JSON.stringify({ok:h.ok,...wn(h),couplings:h.couplings},null,2)}if(e==="grep"){let g=xe(t.pattern);if(!g)throw new Error("`pattern` is required");let h=Ks(n,g,{globs:oi(t.globs),scope:xe(t.scope),ignoreCase:t.ignoreCase===!0,maxHits:Ve(t.maxHits),filesWithMatches:t.filesWithMatches===!0,timeoutMs:Ve(t.timeoutMs)});if(t.withMeta===!0||h.timedOut){let{hits:_,truncated:y,filesMatched:b,timedOut:S,notes:k}=h;return JSON.stringify({hits:_,truncated:y,filesMatched:b,...S?{timedOut:S}:{},...k.length?{notes:k}:{}},null,2)}return JSON.stringify(h.hits,null,2)}if(e==="search"){let g=xe(t.query);if(!g)throw new Error("`query` is required");let h=Cc(t.limit,"limit"),_=m(),y=typeof t.fuzzy=="boolean"?t.fuzzy:void 0,b=t.exact===!0?{exact:!0}:{},S={limit:h,fuzzy:y,...b,...c};if(t.semantic===!0){let I=({results:x,explain:w},E,N)=>JSON.stringify({results:x,tier:E,...N?{degradedReason:N}:{},...t.explain===!0?{explain:w}:{}},null,2),P=wr();if(P)try{let x=await Bo({mode:"endpoint",identity:P,scan:_},E=>vo(_,{previous:E})),w=await Eo(g);return I(br(_,g,x,{...S,queryVec:w}),"endpoint")}catch(x){return I(Zt(_,g,S),"lexical",`embedding endpoint failed: ${Qf(x)}`)}let v=zn(n),{model:R,error:M}=es(v,Uo);if(R){let x=await Bo({mode:"static",identity:`${v}#${R.modelId}`,scan:_},w=>ns(_,R,{previous:w??ds(j(n,Ye,"embeddings.bin"))}));return I(br(_,g,x,{...S,model:R}),"static")}return I(Zt(_,g,S),"lexical",M?`static model unusable: ${M}`:"no embedding endpoint or static model configured \u2014 see embed_status")}let{results:k,explain:C}=Zt(_,g,S);return JSON.stringify(t.explain===!0?{results:k,explain:C}:k,null,2)}if(e==="explain_search"){let g=xe(t.query);if(!g)throw new Error("`query` is required");let h=Cc(t.limit,"limit"),_=m(),y=typeof t.fuzzy=="boolean"?t.fuzzy:void 0,{results:b,explain:S}=Zt(_,g,{limit:h,fuzzy:y,...t.exact===!0?{exact:!0}:{},...c});return JSON.stringify({results:b,explain:S},null,2)}if(e==="embed_status"){let g=zn(n),{model:h,error:_}=es(g,Uo),y=wr(),S={embedVersion:en,mode:y?"endpoint":h?"static":"none",model:h?{present:!0,dir:g,modelId:h.modelId,dim:h.dim,vocabSize:h.vocabSize}:_?{present:!0,dir:g,error:_}:{present:!1},endpoint:y??null};return y&&(S.endpointReachable=await ko(y)),JSON.stringify(S,null,2)}if(e==="type_hierarchy"){let g=m(),h=Us(g),_=xe(t.name);if(!_){let b={};for(let[S,k]of h)b[S]=k;return JSON.stringify(b,null,2)}let y=ur(h,_,Ut(g,_)?.defs);if(!y)throw new ai(`no type named ${_}`);return JSON.stringify(y,null,2)}if(e==="implementations"){let g=xe(t.name);if(!g)throw new Error("`name` is required");let h=m(),_=Us(h),y=Ut(h,g)?.defs;if(!ur(_,g,y))throw new ai(`no type named ${g}`);return JSON.stringify({name:g,implementations:Yi(_,g,y)},null,2)}if(e==="call_graph"){let g=xe(t.symbol);if(!g)throw new Error("`symbol` is required");let h=xe(t.direction),_=h==="out"||h==="in"?h:"both",y=eo(zs(m()),g,{...Ve(t.depth)!==void 0?{depth:Ve(t.depth)}:{},direction:_});if(!y.root.length)throw new ai(`no symbol named ${g}`);return JSON.stringify(y,null,2)}if(e==="call_path"){let g=xe(t.from),h=xe(t.to);if(!g||!h)throw new Error("`from` and `to` are required");let _={depth:Ve(t.depth),maxPaths:Ve(t.maxPaths)};if(t.files===!0){let{graph:b}=p(),S=new Set(b.files.map(I=>I.rel)),[k,C]=[g,h].map(I=>{let P=ls(n,I,v=>S.has(v));if(P===void 0)throw new Error(`no such file in the index: ${I}`);return P});return JSON.stringify(ul(b,k,C,{..._,includeInferred:t.includeInferred===!0}),null,2)}if(t.includeInferred===!0)throw new Error("includeInferred applies to files: true only");let y=ll(zs(m()),g,h,_);if(!y.from.length)throw new Error(`no symbol named ${g}`);if(!y.to.length)throw new Error(`no symbol named ${h}`);return JSON.stringify(y,null,2)}if(e==="impact"||e==="neighbors"){let g=xe(t.target);if(!g)throw new Error("`target` is required");let h=Ve(t.depth),_;if(e==="neighbors"&&t.kinds!==void 0){let b=oi(t.kinds)??[],S=b.filter(k=>!Ds.includes(k));if(!b.length||S.length)throw new Error(`\`kinds\` expects edge kinds among ${Ds.join("|")}, got ${JSON.stringify(S.length?S:t.kinds)}`);_=new Set(b)}let{graph:y}=p();for(let b of Gn(n,g)){let S=e==="impact"?no(y,b,h??1/0,{includeInferred:t.includeInferred===!0}):ro(y,b,h??1,_);if(S)return JSON.stringify(S,null,2)}throw new Error(`no such file or module in the index: ${g}`)}if(e==="check_rules"){let g=xe(t.configPath),h;if(t.rules!==void 0)h=ec(t.rules);else if(g){let b=new Error(`cannot read rules config ${g}`),S;try{S=ct(We(g)?g:j(n,g))}catch{throw b}let k=ct(n);if(!S.startsWith(k.endsWith("/")?k:k+"/"))throw new Error(`rules config must be a file inside the repository: ${g}`);let C;try{C=oe(S,"utf8")}catch{throw b}h=Ql(C,g)}else throw new Error("`rules` (or `configPath`) is required");let{scan:_,graph:y}=p();return JSON.stringify(tc(No(y,h,{scan:_})),null,2)}if(e==="delta"){let g=ni(n,{base:xe(t.base),staged:t.staged===!0});if("error"in g)throw new Error(g.error);let h=Ve(t.depth),_=jo(g,h);if(g.files.length){let{scan:S,graph:k,symbols:C}=p();_=ri(g,k,C,{depth:h,scan:S})}if(xe(t.format)==="text")return Wo(_);let y=t.concise===!0?Ib(_):_,b=Ve(t.limit);return b===void 0||y.modules.length<=b?JSON.stringify(y,null,2):JSON.stringify({...y,modules:y.modules.slice(0,b),totalModules:y.modules.length,truncated:!0},null,2)}if(e==="resolution_report")return JSON.stringify(lc(m(),{lang:xe(t.lang),limit:Ve(t.limit)}),null,2);throw new Error(`unknown tool: ${e}`)}async function Hb(e={}){let t={name:e.serverInfo?.name??"codeindex",version:e.serverInfo?.version??Ne},n=qn[0],r=e.defaultRepo===void 0?void 0:ce(e.defaultRepo),o=ii(r,n,e.profile),s=new Map(ii(r).map(k=>[k.name,k.inputSchema])),a=e.watch&&r?Lb(r,k=>F.stderr.write(`codeindex: ${k} +`)):void 0,l=async k=>a&&k===r?a.walk():{walked:tt(k,{}),reused:!1},c=new ei,d=k=>{let C=Array.isArray(k)?k.map(I=>({jsonrpc:"2.0",...I})):{jsonrpc:"2.0",...k};F.stdout.write(JSON.stringify(C)+` +`)},u=Promise.resolve(),f=new Set,m=new Set,p=new Set,g=k=>{let C=k.finally(()=>p.delete(C));p.add(C)},h=Eb({input:F.stdin,terminal:!1});try{for await(let k of h){let C=k.trim();if(!C)continue;let I;try{I=JSON.parse(C)}catch{d({id:null,error:{code:-32700,message:"parse error"}});continue}if(Array.isArray(I)&&I.length===0){d({id:null,error:{code:-32600,message:"invalid request"}});continue}if(Array.isArray(I)){let P=I.map(_),v=R=>{let M=R.filter(x=>x!==void 0);M.length>0&&d(M)};P.some(R=>R instanceof Promise)?g(Promise.all(P).then(v)):v(P)}else{let P=_(I);P instanceof Promise?g(P.then(v=>v?d(v):void 0)):P&&d(P)}}for(;p.size>0;)await Promise.all(p)}finally{a?.close(),await c.close()}function _(k){if(!h$(k))return g$(k)?y(k):{id:null,error:{code:-32600,message:"invalid request"}}}function y(k){let C=!("id"in k),I=P=>C?void 0:{id:k.id??null,...P};try{if(k.method==="initialize")return n=xc(k.params?.protocolVersion),o=ii(r,n,e.profile),I({result:{protocolVersion:n,capabilities:{tools:{}},serverInfo:t,instructions:`Available tool profiles: ${ps().join(", ")}. Active profile: ${e.profile??"all"}. Configure profiles with --tools . Profiles select advertised tools; known tools remain callable.`}});if(k.method==="ping")return I({result:{}});if(k.method==="tools/list")return I({result:{tools:o}});if(k.method==="tools/call")return b(k,I);if(k.method==="notifications/cancelled"){let P=k.params?.requestId;(typeof P=="string"||typeof P=="number")&&f.has(P)&&m.add(P);return}else return I({error:{code:-32601,message:`method not found: ${k.method}`}})}catch(P){return I({error:{code:-32603,message:Qf(P)}})}}function b(k,C){let I=k.params??{},P=I.arguments;if(typeof I.name!="string")return C({error:{code:-32602,message:"invalid params: tools/call requires a string `name`"}});if(P!=null&&(typeof P!="object"||Array.isArray(P)))return C({error:{code:-32602,message:"invalid params: tools/call `arguments` must be an object"}});let v=I.name,R=P??{},M=s.get(v),x=M?bc(M,R):`unknown tool: ${v}`;if(x)return C({result:{content:[{type:"text",text:x}],isError:!0}});let w=n,E=typeof k.id=="string"||typeof k.id=="number"?k.id:void 0;E!==void 0&&f.add(E);let N=I._meta?.progressToken,O=0,L=typeof N=="string"||typeof N=="number"?X=>{if(E!==void 0&&m.has(E))return;let le=w>=Ub?{message:X}:{};d({method:"notifications/progress",params:{progressToken:N,progress:++O,...le}})}:void 0,H=u.then(async()=>{if(!(E!==void 0&&m.has(E)))return C(await S(v,R,w,L))});return u=H.catch(()=>{}),H.then(X=>E===void 0?X:(f.delete(E),m.delete(E)?void 0:X))}async function S(k,C,I,P){try{let v=_$(C,r),R=await b$(k,C,v,P,l,{pool:c,trustRepoConfig:e.trustLspConfig}),M=xe(C.scope)!==void 0||oi(C.include)!==void 0||oi(C.exclude)!==void 0||xe(C.name)!==void 0||C.concise===!0,x=e.maxResponseBytes??Sc,w=O=>{let L=O!==R,H=L&&I>=qo?kc(O,k):void 0,X=I>=qo?wc(O,L,ms[k]!==void 0):void 0;return{content:H?[{type:"text",text:O},H]:[{type:"text",text:O}],...X?{structuredContent:X}:{},...L?{isError:!0}:{}}},E=Vo(R,k,v,x,!M),N=w(E);if(E===R){let O=W.byteLength(JSON.stringify(N),"utf8")+zb;O>x&&(N=w(Vo(R,k,v,x,!M,O)))}return{result:N}}catch(v){return{result:{content:[{type:"text",text:v instanceof ai?JSON.stringify({error:v.message},null,2):Qf(v)}],isError:!0}}}}}var ai,y$,tm=z(()=>{"use strict";$();Re();ge();vb();Rt();$l();mr();St();de();Pn();qr();Zr();ln();_o();Mo();Ro();sc();Js();Ws();ic();jf();Gs();Wf();cc();Vr();Ur();Yl();Uf();Cf();Qa();tf();Rl();js();nc();ac();ts();rs();zf();lr();Ll();Wl();nt();Db();Rc();Ec();_c();Rc();Ec();_c();ai=class extends Error{},y$=new Set(["workspaces","churn","grep","write_memory","read_memory","list_memories","delete_memory","embed_status","scan_summary","index_status"])});var Zb={};Fc(Zb,{rewriteCommand:()=>Xb,shellQuote:()=>gs,tokenize:()=>w$});function Vb(e){let t=[],n="",r=!1,o=!1;for(let s=0;s()$`\n\r{}]/.test(a))return;if((a==="#"||a==="~")&&!r&&!n)return;(a==="*"||a==="?"||a==="[")&&(o=!0),n+=a}}return(r||n)&&t.push({value:n,globbed:o}),t}function l$(e){return Db(e)?.map(t=>t.value)}function cs(e){return e!==""&&!/[^A-Za-z0-9_\-./=@:]/.test(e)?e:"'"+e.replace(/'/g,"'\\''")+"'"}function Zf(e,t){let n=[],r=[],o=-1;for(let s=0;s2)return;n.noGitignore=!0,r===2&&(o=!0);break;case"--hidden":case"-.":o=!0;break;case"--sort":if(l!=="path")return;break;case"-n":case"--line-number":case"-N":case"--no-line-number":case"-H":case"--with-filename":case"-I":case"--no-filename":case"--no-heading":case"--heading":case"--column":case"-p":case"--pretty":case"--sort-files":case"-j":case"--threads":break;case"--color":if(l!==void 0&&!["never","auto","always","ansi"].includes(l))return;break;default:return}if(jb(n,t.positionals)&&!(n.types.length&&s.some(a=>!a.negated))){for(let{glob:a,negated:l}of s){let c=d$(a,n.paths.length===0);if(!(l?Xf(n,c):Sc(n,c)))return}return n.skipHidden=!o,n}}function m$(e){let t=Zf(e,new Set(["-e"]));if(!t)return;let n=Yf("bre",!0);for(let{name:d,value:u}of t.flags)switch(d){case"-i":case"-y":case"--ignore-case":n.ignoreCase=!0;break;case"-E":case"--extended-regexp":n.dialect="ere";break;case"-G":case"--basic-regexp":n.dialect="bre";break;case"-F":case"--fixed-strings":n.fixed=!0;break;case"-w":case"--word-regexp":n.word=!0;break;case"-e":n.patterns.push(u);break;case"-l":case"--files-with-matches":case"--name-only":n.filesOnly=!0;break;case"-n":case"--line-number":case"-I":case"-r":case"--recursive":case"--no-color":case"--full-name":break;default:return}let{positionals:r,afterDashDash:o}=t,s=o===-1?r.length:o;if(n.patterns.length===0){if(s===0||(n.patterns.push(r[0]),s>1))return}else if(s>0)return;let a=o===-1?[]:r.slice(o),l=a.filter(d=>!/[*?]/.test(d)),c=a.filter(d=>/[*?]/.test(d));if(!a.some(d=>d.startsWith(":")||Qf.test(d))&&!(l.length>1||l.length&&c.length)){for(let d of c)if(d.includes("/")||!Sc(n,`**/${d}`))return;return n.paths.push(...l),n}}function jb(e,t){let n=[...t];if(e.patterns.length===0){let r=n.shift();if(r===void 0)return!1;e.patterns.push(r)}return e.paths=n,!0}function Wb(e,t,n){let r=t+1,o="[";e[r]==="^"&&(o+="^",r++);for(let s=!0;r")n+="\\b";else if("wWsSbB".includes(l)||/[1-9]/.test(l))n+=`\\${l}`;else if(/[.*[\]^$\\/+?(){}|]/.test(l))n+=`\\${l}`;else return;continue}if(s==="["){let l=Wb(e,o,"bre");if(!l)return;n+=l[0],o=l[1]}else if(s==="*")n+=a?"\\*":"*";else if(s==="^")n+=t||a?"^":"\\^",r=a;else if(s==="$"){let l=e.slice(o+1);n+=t||l===""||l.startsWith("\\)")||l.startsWith("\\|")?"$":"\\$"}else if(!t&&"()|+?{}".includes(s))n+=`\\${s}`;else if(t&&s==="{"){let l=/^\{(\d*)(,?)(\d*)\}/.exec(e.slice(o));l&&(l[1]!==""||l[2]!=="")?(n+=`{${l[1]||"0"}${l[2]}${l[3]}}`,o+=l[0].length-1):n+="\\{"}else if(t&&s==="}")n+="\\}";else{if(t&&(s==="+"||s==="?"||s==="*")&&a)return;n+=s,r=t&&(s==="("||s==="|")}}return n}function y$(e){let t="";for(let n=0;n]/.test(o))return;t+=`\\${o}`}continue}if(r==="["){let o=Wb(e,n,"rust");if(!o)return;t+=o[0],n=o[1]}else if(r==="("&&e[n+1]==="?"){let o=/^\(\?(?::|P?<([A-Za-z_]\w*)>)/.exec(e.slice(n));if(!o)return;t+=o[1]?`(?<${o[1]}>`:"(?:",n+=o[0].length-1}else if(r==="{"){let o=/^\{\d+(?:,\d*)?\}/.exec(e.slice(n));if(!o)return;t+=o[0],n+=o[0].length-1}else t+=r}return t}function _$(e){let t=e.replace(/\\[pP]\{[^}]*\}|\\[pP][A-Za-z]|\\./g,"");return t!==t.toLowerCase()}function b$(e){let t=[];for(let r of e.patterns){if(r===""||r.includes(` -`))return;let o=e.fixed?wt(r):e.dialect==="rust"?y$(r):h$(r,e.dialect==="ere");if(o===void 0)return;t.push(o)}let n=t.length===1?t[0]:t.map(r=>`(?:${r})`).join("|");if(e.word){let r=e.patterns.every(s=>(e.fixed||!/[\\^$.*+?()[\]{}|]/.test(s))&&/^\w(?:.*\w)?$/.test(s)),o=t.length===1&&r?n:`(?:${n})`;n=r?`\\b${o}\\b`:`(?n===".."))return t===""||t==="."?"":t}function x$(e){for(let t=le(e);;t=Ce(t)){let n=j(t,".gitmodules");if(Q(n)){let r;try{r=ie(n,"utf8")}catch{return[]}return[...r.matchAll(/^\s*path\s*=\s*(.+?)\s*$/gm)].map(o=>le(t,o[1]))}if(Q(j(t,".git"))||Ce(t)===t)return[]}}function Bb(e,t="codeindex",n){let r=Db(e.trim());if(!r||r.length<2||r.some(p=>p.globbed&&!p.value.startsWith("-")))return;let o=r.map(p=>p.value),[s,...a]=o,l;if(s==="grep"||s==="egrep"?l=u$(s,a):s==="rg"?l=f$(a):s==="git"&&a[0]==="grep"&&(l=m$(a.slice(1))),!l||!l.recursive||l.paths.length>1)return;let c=l.paths.length?w$(l.paths[0]):"";if(c===void 0||l.orderSensitive||l.skipHidden&&c.split("/").some(p=>p.startsWith(".")))return;if(n!==void 0&&s!=="git"){let p=le(n,c||".");if(x$(n).some(g=>Lb(g,p)||Lb(p,g)))return}let d=p=>l.fixed?p!==p.toLowerCase():_$(p),u=l.smartCase?!l.patterns.some(d):l.ignoreCase,f=b$(l);if(f===void 0)return;try{df(f,u)}catch{return}let m=[t,"grep",...f.startsWith("-")?["--"]:[],cs(f)];c&&m.push("--scope",cs(c));for(let p of l.includes)m.push("--include",cs(p));for(let p of[...l.excludes,...l.excludeDirs])m.push("--exclude",cs(p));return l.skipHidden&&m.push("--exclude",cs("**/.*"),"--exclude",cs("**/.*/**")),u&&m.push("--ignore-case"),l.filesOnly&&m.push("--files-with-matches"),l.noGitignore&&m.push("--no-gitignore"),m.push("--ignore-dir",".codeindex"),m.join(" ")}var Qf,p$,g$,Lb,em=H(()=>{"use strict";$();ke();me();uo();et();Qf=/[[\]{}\\]/;p$={c:["*.c","*.h","*.H","*.c.in","*.h.in","*.H.in","*.cats"],cpp:["*.C","*.h","*.H","*.C.in","*.h.in","*.H.in","*.cpp","*.hpp","*.cpp.in","*.hpp.in","*.cxx","*.hxx","*.cxx.in","*.hxx.in","*.cc","*.cc.in","*.hh","*.hh.in","*.inl"],cs:["*.cs"],csharp:["*.cs"],css:["*.css","*.scss"],go:["*.go"],html:["*.ejs","*.htm","*.html"],java:["*.java","*.jsp","*.jspx","*.properties"],js:["*.cjs","*.js","*.jsx","*.mjs","*.vue"],json:["*.json","*.sarif","composer.lock"],kotlin:["*.kt","*.kts"],lua:["*.lua"],markdown:["*.markdown","*.md","*.mdown","*.mdwn","*.mdx","*.mkd","*.mkdn"],md:["*.markdown","*.md","*.mdown","*.mdwn","*.mdx","*.mkd","*.mkdn"],php:["*.php","*.php3","*.php4","*.php5","*.php7","*.php8","*.pht","*.phtml"],py:["*.py","*.pyi"],ruby:["*.gemspec","*.rb","*.rbw",".irbrc","Gemfile","Rakefile","config.ru"],rust:["*.rs"],scala:["*.sbt","*.scala"],sql:["*.psql","*.sql"],swift:["*.swift"],toml:["*.toml","Cargo.lock"],ts:["*.cts","*.mts","*.ts","*.tsx"],typescript:["*.cts","*.mts","*.ts","*.tsx"],txt:["*.txt"],yaml:["*.yaml","*.yml"]},g$={alpha:"A-Za-z",digit:"0-9",alnum:"A-Za-z0-9",upper:"A-Z",lower:"a-z",space:" \\t\\n\\r\\f\\v",blank:" \\t",xdigit:"0-9A-Fa-f",punct:"!-\\/:-@\\[-`{-~",word:"A-Za-z0-9_"};Lb=(e,t)=>{let n=je(t,e);return n===""||n!==".."&&!n.startsWith(`..${"/"}`)&&!n.startsWith("/")}});$();$();bt();Ze();Ut();Ut();$();ke();me();In();Cr();Ut();ce();var ZE=1024*1024;function ah(e,t={}){let n=[],{files:r,capped:o}=Es(e,{...t,precomputedWalk:void 0,onSkip:s=>n.push(s)});return{skips:n.sort(Sr(s=>s.rel)),files:r,capped:o}}function Wa(e){let t=new Map;for(let r of e)t.set(r.reason,(t.get(r.reason)??0)+1);let n={};for(let r of[...t.keys()].sort(T))n[r]=t.get(r);return n}function qd(e,t,n={}){let r=nr(e,t);if(r===".."||r.startsWith("../")||Pe(r))return{path:t,indexed:!1,reason:"outside-repo",detail:{}};let o=r||".",{skips:s,files:a,capped:l}=ah(e,n),c=a.find(f=>f.rel===r);if(c)return{path:o,indexed:!0,reason:null,detail:{kind:mt(c.rel,c.ext),lang:rn(c.ext),size:c.size}};let d;try{d=qn(j(e,r))}catch{return{path:o,indexed:!1,reason:"not-found",detail:{}}}let u=new Map(s.map(f=>[f.rel,f]));for(let f=r;f;f=f.slice(0,Math.max(0,f.lastIndexOf("/")))){let m=u.get(f);if(m){let p={...f===r?{}:{dir:f},...YE(e,n,r,m)};return{path:o,indexed:!1,reason:m.reason,detail:p}}}if(r===".git"||r.startsWith(".git/"))return{path:o,indexed:!1,reason:"ignore-dir",detail:{dir:".git"}};if(d.isDirectory()){let f=r?`${r}/`:"",m=a.filter(g=>g.rel.startsWith(f)).length,p=Wa(s.filter(g=>g.rel.startsWith(f)));return{path:o,indexed:m>0,reason:m>0?null:"no-indexed-files",detail:{directory:!0,files:m,skipped:p}}}return l?{path:o,indexed:!1,reason:"max-files",detail:{maxFiles:n.maxFiles}}:{path:o,indexed:!1,reason:"not-walked",detail:{}}}function YE(e,t,n,r){switch(r.reason){case"gitignored":return r.rule?{...r.rule}:{};case"over-max-bytes":return{size:r.size,maxBytes:t.maxBytes??ZE};case"filter":return oh(e,t,n)??{};case"binary-ext":return{ext:mn(r.rel).toLowerCase()};case"index-output":return{out:t.out};case"file-symlink":case"directory-symlink":case"symlink-outside-root":try{let o=rt(j(e,r.rel)),s=je(rt(e),o);return{target:s.startsWith("..")||Pe(s)?o:s.split("/").join("/")}}catch{return{}}default:return{}}}rr();qa();Li();_i();Ic();In();$();me();var Sv=new Set([".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".svelte",".astro",".py",".rb",".go",".rs",".java",".kt",".kts",".php",".c",".cc",".cpp",".h",".hpp",".cs",".swift",".scala",".clj",".ex",".exs",".dart",".lua",".sh",".bash",".zig",".elm",".hcl",".tf",".tfvars",".sol",".hh",".sc",".pyi",".rake",".cxx"]),kv=new Set([".css",".scss",".sass",".less",".styl",".pcss"]),Ev=new Set([".md",".mdx",".rst",".adoc",".txt"]),vv=new Set([".json",".yaml",".yml",".toml",".csv",".xml",".env"]),Rv=new Set([".png",".jpg",".jpeg",".gif",".webp",".avif",".ico",".bmp",".tiff",".svg",".pdf",".woff",".woff2",".ttf",".otf",".eot",".mp3",".mp4",".mov",".avi",".webm",".zip",".gz",".tar",".rar",".7z",".wasm",".so",".dylib",".dll",".exe",".bin",".class",".jar",".pyc",".node"]),Cv=["locales","locale","i18n","lang","langs","translations","messages"],Mv=new Set([".json",".yaml",".yml",".po",".properties"]),Av=["__tests__","test","tests","spec","e2e","__mocks__"],Iv=["migrations","entities","models"],$v=new Set(["package.json","tsconfig.json","dockerfile","makefile","pyproject.toml","cargo.toml","go.mod","requirements.txt","gemfile","composer.json","pubspec.yaml"]);function Tv(e,t){let n=e.toLowerCase(),r=We(n),o=n.split("/"),s=a=>a.some(l=>o.includes(l));return s(Cv)&&Mv.has(t)?"i18n":t===".prisma"||t===".sql"||t===".graphql"||t===".gql"||r.startsWith("schema.")||r==="models.py"||s(Iv)?"schema":n.includes(".test.")||n.includes(".spec.")||s(Av)?"test":$v.has(r)||r.endsWith(".config.js")||r.endsWith(".config.ts")||r.endsWith(".config.mjs")||r.startsWith(".eslintrc")||r.startsWith(".prettierrc")||r.startsWith(".env")||r.startsWith("docker-compose")?"config":Ev.has(t)?"doc":kv.has(t)?"style":Sv.has(t)?"code":Rv.has(t)?"asset":vv.has(t)?"data":"other"}Cr();La();id();cd();pt();Od();$();ke();me();Sd();pt();ce();var _h=new Map;function bh(e,t){let n=_h.get(e);if(n!==void 0)return n;let r=null;for(let o of Wt().dirs){let s=j(o,`${e}.tags.scm`);if(Q(s)){try{r=new cg(t,ie(s,"utf8"))}catch{r=null}break}}return _h.set(e,r),r}function Fv(e){if(!Wt().dirs.some(r=>Q(j(r,`${e}.tags.scm`))))return{present:!1,compiled:!1};let n=kd(e);return n?{present:!0,compiled:bh(e,n)!==null}:{present:!0,compiled:!1}}function Ov(e,t){let n=Ra(e,t);if(!n)return[];let r=kd(n),o=Ss(n);if(!r||!o)return[];let s=bh(n,r);if(!s)return[];let a=null;try{if(a=o.parse(t),!a)return[];let l=[],c=new Set;for(let d of s.matches(a.rootNode)){let u,f,m=0;for(let g of d.captures)g.name==="name"?(u=g.node.text,m=g.node.startPosition.row+1):g.name.startsWith("definition.")&&(f=g.name.slice(11));if(!u||!f)continue;let p=`${f} ${u} ${m}`;c.has(p)||(c.add(p),l.push({kind:f,name:u,line:m}))}return l.sort((d,u)=>d.line-u.line||T(d.name,u.name)||T(d.kind,u.kind))}catch{return[]}finally{a?.delete()}}pt();pt();$();oa();ke();me();$();function wh(){throw new Error("zlib.gunzipSync is not available in the browser build (use DecompressionStream at an async boundary)")}bt();var au=`https://github.com/maxgfr/codeindex/releases/download/v${Ie}/grammars-${Ie}.tar.gz`;function Va(){let e=F.env.CODEINDEX_GRAMMARS_URL;return e&&e.trim()?{url:e.trim()}:{url:au,sha256Url:`${au}.sha256`}}async function xh(e,t){let n=await fetch(e);if(!n.ok)throw new Error(`HTTP ${n.status} from ${e}`);let r=W.from(await n.arrayBuffer());if(t){let o=gs("sha256").update(r).digest("hex");if(o!==t)throw new Error(`sha256 mismatch: expected ${t}, got ${o}`)}return r}function Sh(e){return W.isBuffer(e)?e:W.from(e.buffer,e.byteOffset,e.byteLength)}async function kh(e){let t=await fetch(e);if(!t.ok)throw new Error(`HTTP ${t.status} from ${e}`);let r=((await t.text()).trim().split(/\s+/)[0]??"").toLowerCase();if(!/^[0-9a-f]{64}$/.test(r))throw new Error(`invalid sha256 sidecar at ${e}`);return r}function ou(e,t,n){let r=e.subarray(t,t+n),o=r.indexOf(0);return r.toString("utf8",0,o===-1?r.length:o)}function*Nv(e){let t=0;for(;t+512<=e.length;){let n=e.subarray(t,t+512),r=!0;for(let u=0;u<512;u++)if(n[u]!==0){r=!1;break}if(r)break;let o=ou(n,0,100),s=ou(n,345,155),a=ou(n,124,12).trim(),l=a?parseInt(a,8):0,c=String.fromCharCode(n[156]??0);t+=512;let d=e.subarray(t,t+l);if(d.length!==l)throw new Error(`truncated grammars archive: ${o} declares ${l} bytes, ${d.length} remain`);t+=Math.ceil(l/512)*512,yield{name:s?`${s}/${o}`:o,type:c,data:d}}}function Pv(e){if(!e||e.includes("\0")||e.startsWith("/")||e.startsWith("\\")||/^[A-Za-z]:/.test(e))return null;let t=[];for(let n of e.split(/[/\\]/))if(!(n===""||n===".")){if(n==="..")return null;t.push(n)}return t.length?t.join("/"):null}function Eh(e,t){let n=le(t),r=[];for(let o of Nv(Sh(e))){if(o.type!=="0"&&o.type!=="\0")continue;let s=Pv(o.name);if(s===null)throw new Error(`refusing unsafe tar entry: ${o.name}`);let a=le(t,s);if(a!==n&&!a.startsWith(n+"/"))throw new Error(`tar entry escapes destination: ${o.name}`);Yt(Ce(a),{recursive:!0}),it(a,o.data),r.push(s)}return r}function vh(e,t){let n=Sh(e),r=n.length>=2&&n[0]===31&&n[1]===139?wh(n):n;return Eh(r,t)}function Lv(e,t,n,r,o=Rn,s=Ke){let a=Ce(t),l=wr(j(a,".grammars-swap-")),c=j(l,"previous-cache"),d=j(l,"previous-marker"),u=j(l,"next-marker"),f=!1,m=!1,p=!1,g=!1;try{r&&it(u,r+` -`),Q(t)&&(o(t,c),f=!0),Q(n)&&(o(n,d),m=!0),o(e,t),p=!0,r&&(o(u,n),g=!0)}catch(h){let _=[],y=b=>{try{b()}catch(S){_.push(S)}};if(g&&Q(n)&&y(()=>Ke(n,{force:!0})),p&&Q(t)&&y(()=>Ke(t,{recursive:!0,force:!0})),m&&Q(d)&&y(()=>o(d,n)),f&&Q(c)&&y(()=>o(c,t)),_.length===0)try{Ke(l,{recursive:!0,force:!0})}catch{}if(_.length>0){let b=_[0];throw new Error(`${h instanceof Error?h.message:String(h)}; rollback failed: ${b instanceof Error?b.message:String(b)} (backup preserved at ${l})`)}throw h}try{s(l,{recursive:!0,force:!0})}catch{}}async function Bi(e,t={}){let n=t.onNote??(()=>{}),r=Va(),o;if(r.sha256Url)try{o=await kh(r.sha256Url)}catch(d){n(`codeindex: could not fetch checksum (${d instanceof Error?d.message:String(d)}) \u2014 proceeding unverified -`)}let s=j(e,"web-tree-sitter.wasm"),a=j(Ce(e),`${Ie}.sha256`);if(Q(s)&&o&&Q(a)){let d="";try{d=ie(a,"utf8").trim()}catch{}if(d===o)return{ok:!0,status:"up-to-date",cacheDir:e,message:`codeindex: grammars already present at ${e} (up to date) +`||l==="\r")return;n+=l,r=!0,s++}else if(a===" "||a===" ")(r||n)&&t.push({value:n,globbed:o}),n="",r=!1,o=!1;else{if(/[|&;<>()$`\n\r{}]/.test(a))return;if((a==="#"||a==="~")&&!r&&!n)return;(a==="*"||a==="?"||a==="[")&&(o=!0),n+=a}}return(r||n)&&t.push({value:n,globbed:o}),t}function w$(e){return Vb(e)?.map(t=>t.value)}function gs(e){return e!==""&&!/[^A-Za-z0-9_\-./=@:]/.test(e)?e:"'"+e.replace(/'/g,"'\\''")+"'"}function sm(e,t){let n=[],r=[],o=-1;for(let s=0;s2)return;n.noGitignore=!0,r===2&&(o=!0);break;case"--hidden":case"-.":o=!0;break;case"--sort":if(l!=="path")return;break;case"-n":case"--line-number":case"-N":case"--no-line-number":case"-H":case"--with-filename":case"-I":case"--no-filename":case"--no-heading":case"--heading":case"--column":case"-p":case"--pretty":case"--sort-files":case"-j":case"--threads":break;case"--color":if(l!==void 0&&!["never","auto","always","ansi"].includes(l))return;break;default:return}if(Jb(n,t.positionals)&&!(n.types.length&&s.some(a=>!a.negated))){for(let{glob:a,negated:l}of s){let c=S$(a,n.paths.length===0);if(!(l?rm(n,c):Ac(n,c)))return}return n.skipHidden=!o,n}}function v$(e){let t=sm(e,new Set(["-e"]));if(!t)return;let n=im("bre",!0);for(let{name:d,value:u}of t.flags)switch(d){case"-i":case"-y":case"--ignore-case":n.ignoreCase=!0;break;case"-E":case"--extended-regexp":n.dialect="ere";break;case"-G":case"--basic-regexp":n.dialect="bre";break;case"-F":case"--fixed-strings":n.fixed=!0;break;case"-w":case"--word-regexp":n.word=!0;break;case"-e":n.patterns.push(u);break;case"-l":case"--files-with-matches":case"--name-only":n.filesOnly=!0;break;case"-n":case"--line-number":case"-I":case"-r":case"--recursive":case"--no-color":case"--full-name":break;default:return}let{positionals:r,afterDashDash:o}=t,s=o===-1?r.length:o;if(n.patterns.length===0){if(s===0||(n.patterns.push(r[0]),s>1))return}else if(s>0)return;let a=o===-1?[]:r.slice(o),l=a.filter(d=>!/[*?]/.test(d)),c=a.filter(d=>/[*?]/.test(d));if(!a.some(d=>d.startsWith(":")||om.test(d))&&!(l.length>1||l.length&&c.length)){for(let d of c)if(d.includes("/")||!Ac(n,`**/${d}`))return;return n.paths.push(...l),n}}function Jb(e,t){let n=[...t];if(e.patterns.length===0){let r=n.shift();if(r===void 0)return!1;e.patterns.push(r)}return e.paths=n,!0}function Kb(e,t,n){let r=t+1,o="[";e[r]==="^"&&(o+="^",r++);for(let s=!0;r")n+="\\b";else if("wWsSbB".includes(l)||/[1-9]/.test(l))n+=`\\${l}`;else if(/[.*[\]^$\\/+?(){}|]/.test(l))n+=`\\${l}`;else return;continue}if(s==="["){let l=Kb(e,o,"bre");if(!l)return;n+=l[0],o=l[1]}else if(s==="*")n+=a?"\\*":"*";else if(s==="^")n+=t||a?"^":"\\^",r=a;else if(s==="$"){let l=e.slice(o+1);n+=t||l===""||l.startsWith("\\)")||l.startsWith("\\|")?"$":"\\$"}else if(!t&&"()|+?{}".includes(s))n+=`\\${s}`;else if(t&&s==="{"){let l=/^\{(\d*)(,?)(\d*)\}/.exec(e.slice(o));l&&(l[1]!==""||l[2]!=="")?(n+=`{${l[1]||"0"}${l[2]}${l[3]}}`,o+=l[0].length-1):n+="\\{"}else if(t&&s==="}")n+="\\}";else{if(t&&(s==="+"||s==="?"||s==="*")&&a)return;n+=s,r=t&&(s==="("||s==="|")}}return n}function A$(e){let t="";for(let n=0;n]/.test(o))return;t+=`\\${o}`}continue}if(r==="["){let o=Kb(e,n,"rust");if(!o)return;t+=o[0],n=o[1]}else if(r==="("&&e[n+1]==="?"){let o=/^\(\?(?::|P?<([A-Za-z_]\w*)>)/.exec(e.slice(n));if(!o)return;t+=o[1]?`(?<${o[1]}>`:"(?:",n+=o[0].length-1}else if(r==="{"){let o=/^\{\d+(?:,\d*)?\}/.exec(e.slice(n));if(!o)return;t+=o[0],n+=o[0].length-1}else t+=r}return t}function I$(e){let t=e.replace(/\\[pP]\{[^}]*\}|\\[pP][A-Za-z]|\\./g,"");return t!==t.toLowerCase()}function $$(e){let t=[];for(let r of e.patterns){if(r===""||r.includes(` +`))return;let o=e.fixed?Ct(r):e.dialect==="rust"?A$(r):M$(r,e.dialect==="ere");if(o===void 0)return;t.push(o)}let n=t.length===1?t[0]:t.map(r=>`(?:${r})`).join("|");if(e.word){let r=e.patterns.every(s=>(e.fixed||!/[\\^$.*+?()[\]{}|]/.test(s))&&/^\w(?:.*\w)?$/.test(s)),o=t.length===1&&r?n:`(?:${n})`;n=r?`\\b${o}\\b`:`(?n===".."))return t===""||t==="."?"":t}function F$(e){for(let t=ce(e);;t=Ie(t)){let n=j(t,".gitmodules");if(Q(n)){let r;try{r=oe(n,"utf8")}catch{return[]}return[...r.matchAll(/^\s*path\s*=\s*(.+?)\s*$/gm)].map(o=>ce(t,o[1]))}if(Q(j(t,".git"))||Ie(t)===t)return[]}}function Xb(e,t="codeindex",n){let r=Vb(e.trim());if(!r||r.length<2||r.some(p=>p.globbed&&!p.value.startsWith("-")))return;let o=r.map(p=>p.value),[s,...a]=o,l;if(s==="grep"||s==="egrep"?l=k$(s,a):s==="rg"?l=E$(a):s==="git"&&a[0]==="grep"&&(l=v$(a.slice(1))),!l||!l.recursive||l.paths.length>1)return;let c=l.paths.length?T$(l.paths[0]):"";if(c===void 0||l.orderSensitive||l.skipHidden&&c.split("/").some(p=>p.startsWith(".")))return;if(n!==void 0&&s!=="git"){let p=ce(n,c||".");if(F$(n).some(g=>qb(g,p)||qb(p,g)))return}let d=p=>l.fixed?p!==p.toLowerCase():I$(p),u=l.smartCase?!l.patterns.some(d):l.ignoreCase,f=$$(l);if(f===void 0)return;try{yf(f,u)}catch{return}let m=[t,"grep",...f.startsWith("-")?["--"]:[],gs(f)];c&&m.push("--scope",gs(c));for(let p of l.includes)m.push("--include",gs(p));for(let p of[...l.excludes,...l.excludeDirs])m.push("--exclude",gs(p));return l.skipHidden&&m.push("--exclude",gs("**/.*"),"--exclude",gs("**/.*/**")),u&&m.push("--ignore-case"),l.filesOnly&&m.push("--files-with-matches"),l.noGitignore&&m.push("--no-gitignore"),m.push("--ignore-dir",".codeindex"),m.join(" ")}var om,R$,C$,qb,am=z(()=>{"use strict";$();Re();ge();_o();it();om=/[[\]{}\\]/;R$={c:["*.c","*.h","*.H","*.c.in","*.h.in","*.H.in","*.cats"],cpp:["*.C","*.h","*.H","*.C.in","*.h.in","*.H.in","*.cpp","*.hpp","*.cpp.in","*.hpp.in","*.cxx","*.hxx","*.cxx.in","*.hxx.in","*.cc","*.cc.in","*.hh","*.hh.in","*.inl"],cs:["*.cs"],csharp:["*.cs"],css:["*.css","*.scss"],go:["*.go"],html:["*.ejs","*.htm","*.html"],java:["*.java","*.jsp","*.jspx","*.properties"],js:["*.cjs","*.js","*.jsx","*.mjs","*.vue"],json:["*.json","*.sarif","composer.lock"],kotlin:["*.kt","*.kts"],lua:["*.lua"],markdown:["*.markdown","*.md","*.mdown","*.mdwn","*.mdx","*.mkd","*.mkdn"],md:["*.markdown","*.md","*.mdown","*.mdwn","*.mdx","*.mkd","*.mkdn"],php:["*.php","*.php3","*.php4","*.php5","*.php7","*.php8","*.pht","*.phtml"],py:["*.py","*.pyi"],ruby:["*.gemspec","*.rb","*.rbw",".irbrc","Gemfile","Rakefile","config.ru"],rust:["*.rs"],scala:["*.sbt","*.scala"],sql:["*.psql","*.sql"],swift:["*.swift"],toml:["*.toml","Cargo.lock"],ts:["*.cts","*.mts","*.ts","*.tsx"],typescript:["*.cts","*.mts","*.ts","*.tsx"],txt:["*.txt"],yaml:["*.yaml","*.yml"]},C$={alpha:"A-Za-z",digit:"0-9",alnum:"A-Za-z0-9",upper:"A-Z",lower:"a-z",space:" \\t\\n\\r\\f\\v",blank:" \\t",xdigit:"0-9A-Fa-f",punct:"!-\\/:-@\\[-`{-~",word:"A-Za-z0-9_"};qb=(e,t)=>{let n=ze(t,e);return n===""||n!==".."&&!n.startsWith(`..${"/"}`)&&!n.startsWith("/")}});$();$();Rt();nt();Jt();Jt();$();Re();ge();Fn();Tr();Jt();de();var av=1024*1024;function yh(e,t={}){let n=[],{files:r,capped:o}=Is(e,{...t,precomputedWalk:void 0,onSkip:s=>n.push(s)});return{skips:n.sort(Cr(s=>s.rel)),files:r,capped:o}}function Va(e){let t=new Map;for(let r of e)t.set(r.reason,(t.get(r.reason)??0)+1);let n={};for(let r of[...t.keys()].sort(T))n[r]=t.get(r);return n}function Qd(e,t,n={}){let r=ar(e,t);if(r===".."||r.startsWith("../")||We(r))return{path:t,indexed:!1,reason:"outside-repo",detail:{}};let o=r||".",{skips:s,files:a,capped:l}=yh(e,n),c=a.find(f=>f.rel===r);if(c)return{path:o,indexed:!0,reason:null,detail:{kind:bt(c.rel,c.ext),lang:cn(c.ext),size:c.size}};let d;try{d=Zn(j(e,r))}catch{return{path:o,indexed:!1,reason:"not-found",detail:{}}}let u=new Map(s.map(f=>[f.rel,f]));for(let f=r;f;f=f.slice(0,Math.max(0,f.lastIndexOf("/")))){let m=u.get(f);if(m){let p={...f===r?{}:{dir:f},...lv(e,n,r,m)};return{path:o,indexed:!1,reason:m.reason,detail:p}}}if(r===".git"||r.startsWith(".git/"))return{path:o,indexed:!1,reason:"ignore-dir",detail:{dir:".git"}};if(d.isDirectory()){let f=r?`${r}/`:"",m=a.filter(g=>g.rel.startsWith(f)).length,p=Va(s.filter(g=>g.rel.startsWith(f)));return{path:o,indexed:m>0,reason:m>0?null:"no-indexed-files",detail:{directory:!0,files:m,skipped:p}}}return l?{path:o,indexed:!1,reason:"max-files",detail:{maxFiles:n.maxFiles}}:{path:o,indexed:!1,reason:"not-walked",detail:{}}}function lv(e,t,n,r){switch(r.reason){case"gitignored":return r.rule?{...r.rule}:{};case"over-max-bytes":return{size:r.size,maxBytes:t.maxBytes??av};case"filter":return hh(e,t,n)??{};case"binary-ext":return{ext:yn(r.rel).toLowerCase()};case"index-output":return{out:t.out};case"file-symlink":case"directory-symlink":case"symlink-outside-root":try{let o=ct(j(e,r.rel)),s=ze(ct(e),o);return{target:s.startsWith("..")||We(s)?o:s.split("/").join("/")}}catch{return{}}default:return{}}}lr();Qa();zi();Ei();Lc();Fn();$();ge();var Tv=new Set([".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".svelte",".astro",".py",".rb",".go",".rs",".java",".kt",".kts",".php",".c",".cc",".cpp",".h",".hpp",".cs",".swift",".scala",".clj",".ex",".exs",".dart",".lua",".sh",".bash",".zig",".elm",".hcl",".tf",".tfvars",".sol",".hh",".sc",".pyi",".rake",".cxx"]),Fv=new Set([".css",".scss",".sass",".less",".styl",".pcss"]),Ov=new Set([".md",".mdx",".rst",".adoc",".txt"]),Nv=new Set([".json",".yaml",".yml",".toml",".csv",".xml",".env"]),Pv=new Set([".png",".jpg",".jpeg",".gif",".webp",".avif",".ico",".bmp",".tiff",".svg",".pdf",".woff",".woff2",".ttf",".otf",".eot",".mp3",".mp4",".mov",".avi",".webm",".zip",".gz",".tar",".rar",".7z",".wasm",".so",".dylib",".dll",".exe",".bin",".class",".jar",".pyc",".node"]),Lv=["locales","locale","i18n","lang","langs","translations","messages"],Dv=new Set([".json",".yaml",".yml",".po",".properties"]),jv=["__tests__","test","tests","spec","e2e","__mocks__"],Wv=["migrations","entities","models"],Bv=new Set(["package.json","tsconfig.json","dockerfile","makefile","pyproject.toml","cargo.toml","go.mod","requirements.txt","gemfile","composer.json","pubspec.yaml"]);function Uv(e,t){let n=e.toLowerCase(),r=He(n),o=n.split("/"),s=a=>a.some(l=>o.includes(l));return s(Lv)&&Dv.has(t)?"i18n":t===".prisma"||t===".sql"||t===".graphql"||t===".gql"||r.startsWith("schema.")||r==="models.py"||s(Wv)?"schema":n.includes(".test.")||n.includes(".spec.")||s(jv)?"test":Bv.has(r)||r.endsWith(".config.js")||r.endsWith(".config.ts")||r.endsWith(".config.mjs")||r.startsWith(".eslintrc")||r.startsWith(".prettierrc")||r.startsWith(".env")||r.startsWith("docker-compose")?"config":Ov.has(t)?"doc":Fv.has(t)?"style":Tv.has(t)?"code":Pv.has(t)?"asset":Nv.has(t)?"data":"other"}Tr();Ha();fd();hd();wt();Bd();$();Re();ge();Ad();wt();de();var Mh=new Map;function Ah(e,t){let n=Mh.get(e);if(n!==void 0)return n;let r=null;for(let o of qt().dirs){let s=j(o,`${e}.tags.scm`);if(Q(s)){try{r=new bg(t,oe(s,"utf8"))}catch{r=null}break}}return Mh.set(e,r),r}function zv(e){if(!qt().dirs.some(r=>Q(j(r,`${e}.tags.scm`))))return{present:!1,compiled:!1};let n=Id(e);return n?{present:!0,compiled:Ah(e,n)!==null}:{present:!0,compiled:!1}}function Hv(e,t){let n=Fa(e,t);if(!n)return[];let r=Id(n),o=Ms(n);if(!r||!o)return[];let s=Ah(n,r);if(!s)return[];let a=null;try{if(a=o.parse(t),!a)return[];let l=[],c=new Set;for(let d of s.matches(a.rootNode)){let u,f,m=0;for(let g of d.captures)g.name==="name"?(u=g.node.text,m=g.node.startPosition.row+1):g.name.startsWith("definition.")&&(f=g.name.slice(11));if(!u||!f)continue;let p=`${f} ${u} ${m}`;c.has(p)||(c.add(p),l.push({kind:f,name:u,line:m}))}return l.sort((d,u)=>d.line-u.line||T(d.name,u.name)||T(d.kind,u.kind))}catch{return[]}finally{a?.delete()}}wt();wt();$();ma();Re();ge();$();function Ih(){throw new Error("zlib.gunzipSync is not available in the browser build (use DecompressionStream at an async boundary)")}Rt();var pu=`https://github.com/maxgfr/codeindex/releases/download/v${Ne}/grammars-${Ne}.tar.gz`;function el(){let e=F.env.CODEINDEX_GRAMMARS_URL;return e&&e.trim()?{url:e.trim()}:{url:pu,sha256Url:`${pu}.sha256`}}async function $h(e,t){let n=await fetch(e);if(!n.ok)throw new Error(`HTTP ${n.status} from ${e}`);let r=W.from(await n.arrayBuffer());if(t){let o=xs("sha256").update(r).digest("hex");if(o!==t)throw new Error(`sha256 mismatch: expected ${t}, got ${o}`)}return r}function Th(e){return W.isBuffer(e)?e:W.from(e.buffer,e.byteOffset,e.byteLength)}async function Fh(e){let t=await fetch(e);if(!t.ok)throw new Error(`HTTP ${t.status} from ${e}`);let r=((await t.text()).trim().split(/\s+/)[0]??"").toLowerCase();if(!/^[0-9a-f]{64}$/.test(r))throw new Error(`invalid sha256 sidecar at ${e}`);return r}function mu(e,t,n){let r=e.subarray(t,t+n),o=r.indexOf(0);return r.toString("utf8",0,o===-1?r.length:o)}function*Gv(e){let t=0;for(;t+512<=e.length;){let n=e.subarray(t,t+512),r=!0;for(let u=0;u<512;u++)if(n[u]!==0){r=!1;break}if(r)break;let o=mu(n,0,100),s=mu(n,345,155),a=mu(n,124,12).trim(),l=a?parseInt(a,8):0,c=String.fromCharCode(n[156]??0);t+=512;let d=e.subarray(t,t+l);if(d.length!==l)throw new Error(`truncated grammars archive: ${o} declares ${l} bytes, ${d.length} remain`);t+=Math.ceil(l/512)*512,yield{name:s?`${s}/${o}`:o,type:c,data:d}}}function qv(e){if(!e||e.includes("\0")||e.startsWith("/")||e.startsWith("\\")||/^[A-Za-z]:/.test(e))return null;let t=[];for(let n of e.split(/[/\\]/))if(!(n===""||n===".")){if(n==="..")return null;t.push(n)}return t.length?t.join("/"):null}function Oh(e,t){let n=ce(t),r=[];for(let o of Gv(Th(e))){if(o.type!=="0"&&o.type!=="\0")continue;let s=qv(o.name);if(s===null)throw new Error(`refusing unsafe tar entry: ${o.name}`);let a=ce(t,s);if(a!==n&&!a.startsWith(n+"/"))throw new Error(`tar entry escapes destination: ${o.name}`);rn(Ie(a),{recursive:!0}),ut(a,o.data),r.push(s)}return r}function Nh(e,t){let n=Th(e),r=n.length>=2&&n[0]===31&&n[1]===139?Ih(n):n;return Oh(r,t)}function Vv(e,t,n,r,o=An,s=et){let a=Ie(t),l=vr(j(a,".grammars-swap-")),c=j(l,"previous-cache"),d=j(l,"previous-marker"),u=j(l,"next-marker"),f=!1,m=!1,p=!1,g=!1;try{r&&ut(u,r+` +`),Q(t)&&(o(t,c),f=!0),Q(n)&&(o(n,d),m=!0),o(e,t),p=!0,r&&(o(u,n),g=!0)}catch(h){let _=[],y=b=>{try{b()}catch(S){_.push(S)}};if(g&&Q(n)&&y(()=>et(n,{force:!0})),p&&Q(t)&&y(()=>et(t,{recursive:!0,force:!0})),m&&Q(d)&&y(()=>o(d,n)),f&&Q(c)&&y(()=>o(c,t)),_.length===0)try{et(l,{recursive:!0,force:!0})}catch{}if(_.length>0){let b=_[0];throw new Error(`${h instanceof Error?h.message:String(h)}; rollback failed: ${b instanceof Error?b.message:String(b)} (backup preserved at ${l})`)}throw h}try{s(l,{recursive:!0,force:!0})}catch{}}async function Vi(e,t={}){let n=t.onNote??(()=>{}),r=el(),o;if(r.sha256Url)try{o=await Fh(r.sha256Url)}catch(d){n(`codeindex: could not fetch checksum (${d instanceof Error?d.message:String(d)}) \u2014 proceeding unverified +`)}let s=j(e,"web-tree-sitter.wasm"),a=j(Ie(e),`${Ne}.sha256`);if(Q(s)&&o&&Q(a)){let d="";try{d=oe(a,"utf8").trim()}catch{}if(d===o)return{ok:!0,status:"up-to-date",cacheDir:e,message:`codeindex: grammars already present at ${e} (up to date) `}}n(`codeindex: fetching grammars from ${r.url} \u2192 ${e} -`);let l;try{l=await xh(r.url,o)}catch(d){return{ok:!1,status:"failed",cacheDir:e,message:`codeindex: pull failed \u2014 ${d instanceof Error?d.message:String(d)} (nothing written) -`}}let c;try{if(Yt(Ce(e),{recursive:!0}),c=wr(j(Ce(e),".grammars-tmp-")),vh(l,c),!Q(j(c,"web-tree-sitter.wasm")))throw new Error("archive is missing web-tree-sitter.wasm");Lv(c,e,a,o),c=void 0}catch(d){if(c)try{Ke(c,{recursive:!0,force:!0})}catch{}return{ok:!1,status:"failed",cacheDir:e,message:`codeindex: pull failed \u2014 ${d instanceof Error?d.message:String(d)} (nothing written) +`);let l;try{l=await $h(r.url,o)}catch(d){return{ok:!1,status:"failed",cacheDir:e,message:`codeindex: pull failed \u2014 ${d instanceof Error?d.message:String(d)} (nothing written) +`}}let c;try{if(rn(Ie(e),{recursive:!0}),c=vr(j(Ie(e),".grammars-tmp-")),Nh(l,c),!Q(j(c,"web-tree-sitter.wasm")))throw new Error("archive is missing web-tree-sitter.wasm");Vv(c,e,a,o),c=void 0}catch(d){if(c)try{et(c,{recursive:!0,force:!0})}catch{}return{ok:!1,status:"failed",cacheDir:e,message:`codeindex: pull failed \u2014 ${d instanceof Error?d.message:String(d)} (nothing written) `}}return{ok:!0,status:"pulled",cacheDir:e,message:`codeindex: grammars extracted \u2192 ${e} -`}}$();pt();async function Dv(e={}){let t=e.label??"codeindex",n=[],r=u=>{n.push(u),e.onNote?e.onNote(u):F.stderr.write(u)},o=F.env.CODEINDEX_NO_GRAMMARS_PULL,s=(e.pull??!0)&&!(o&&o.trim()&&o!=="0"),a=[...e.keys??Ma()],l=!1;if(Wt().tier==="none"&&s){r(`${t}: tree-sitter grammars not found locally \u2014 pulling them into the shared cache (once per machine)\u2026 -`);let u=await Bi(xs(),{onNote:r});r(u.message),l=u.ok&&u.status==="pulled"}await an(a);let c=Wt().tier,d=a.some(u=>De(u));return d||r(`${t}: no tree-sitter grammars available (offline?) \u2014 extracting with the regex tier, so symbols and call sites are less precise. Run \`codeindex grammars pull\` once online to enable AST precision. -`),{tier:c,ready:d,pulled:l,notes:n}}$n();Ms();dl();ar();Fn();Br();lr();js();Ju();bl();qr();Qi();sf();dr();of();Hi();El();$();me();wi();bt();Ze();ce();Is();gt();Fn();qr();var Sn=class{buf;len=0;constructor(t=64){this.buf=new Uint8Array(t)}get length(){return this.len}grow(t){if(this.len+t<=this.buf.length)return;let n=this.buf.length*2||64;for(;n127;)e.push(t&127|128),t=Math.floor(t/128);e.push(t&127)}function o_(e,t,n){vl(e,t*8+n)}function Bs(e,t,n){o_(e,t,0),vl(e,n)}function a_(e,t,n){o_(e,t,2),vl(e,n.length),e.pushAll(n)}function Jr(e,t,n){a_(e,t,n.view())}function Ln(e,t,n){a_(e,t,iM.encode(n))}function oM(e,t,n){let r=new Sn(n.length*2);for(let o of n)vl(r,o);Jr(e,t,r)}var aM=1,lM=2,cM=2,dM=3,uM=4,fM=1,mM=2,pM=1,gM=2,hM=3,yM=4,_M=6,bM=1,wM=2,xM=3,SM=1,kM=4,EM=5,vM=6,RM=1,CM=2,MM=3,AM=1,IM=1,$M=2,TM="codeindex",e_=". . .",FM=new Map([["typescript","package.json"],["javascript","package.json"],["go","go.mod"],["rust","Cargo.toml"],["python","pyproject.toml"],["java","pom.xml"],["kotlin","pom.xml"],["scala","pom.xml"],["php","composer.json"]]);function af(e){return e?e.replace(/ /g," "):"."}var OM=/^[A-Za-z0-9_+\-$]+$/;function l_(e){return OM.test(e)?e:"`"+e.replace(/`/g,"``")+"`"}function NM(e){return"`"+e.replace(/`/g,"``")+"`/"}var c_=new Map([["class",[7,"#"]],["record",[7,"#"]],["interface",[21,"#"]],["annotation",[21,"#"]],["enum",[11,"#"]],["struct",[49,"#"]],["exception",[49,"#"]],["trait",[53,"#"]],["type",[54,"#"]],["opaque",[54,"#"]],["union",[59,"#"]],["protocol",[42,"#"]],["delegate",[73,"#"]],["contract",[62,"#"]],["library",[64,"#"]],["mixin",[85,"#"]],["extension",[84,"#"]],["concept",[86,"#"]],["error",[63,"#"]],["namespace",[30,"/"]],["package",[35,"/"]],["module",[29,"/"]],["mod",[29,"/"]],["impl",[29,"/"]],["function",[17,"()."]],["test",[17,"()."]],["method",[26,"()."]],["def",[26,"()."]],["destructor",[26,"()."]],["fallback",[26,"()."]],["receive",[26,"()."]],["call-signature",[26,"()."]],["constructor",[9,"()."]],["construct-signature",[9,"()."]],["getter",[18,"()."]],["setter",[45,"()."]],["operator",[34,"()."]],["modifier",[65,"()."]],["attr",[72,"()."]],["indexer",[47,"()."]],["index-signature",[47,"()."]],["macro",[25,"!"]],["guard",[25,"!"]],["const",[8,"."]],["val",[8,"."]],["var",[61,"."]],["variable",[61,"."]],["static",[82,"."]],["field",[15,"."]],["property",[41,"."]],["enum-member",[12,"."]],["event",[13,"."]],["object",[33,"."]]]),PM=e=>c_.get(e)?.[0],LM=e=>c_.get(e)?.[1]??".",DM=e=>e==="#"||e==="/";function jM(e,t,n,r,o){let s=l_(t),a=e+s+n;if(!o.has(a))return o.add(a),a;for(let l=0;;l++){let c=l===0?String(r):`${r}_${l}`,d=n==="()."?`${e}${s}(${c}).`:`${a}(${c})`;if(!o.has(d))return o.add(d),d}}function t_(e){return e==="typescript"||e==="javascript"||e==="vue"||e==="svelte"||e==="astro"?"js":e==="c"||e==="cpp"?"c":e}var n_=new Set(["reexport","reexport-all","default"]);function r_(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function s_(e,t){if(!t)return null;let n=/^[A-Za-z_$][\w$]*$/.test(t),r=0;for(;;){let o=e.indexOf(t,r);if(o<0)return null;if(!n)return[o,o+t.length];let s=o>0?e.charCodeAt(o-1):-1,a=o+t.length,l=ae.sym.endLine??e.sym.line,lf=e=>e.includes("/")?e.slice(0,e.lastIndexOf("/")):"";function i_(e){let t=e.symbols.find(n=>n.kind==="package")?.name??"";return`${lf(e.rel)}\0${t}`}function cf(e,t={}){let n=t.projectRoot??Mr(e.root).href,r=t.toolVersion??Ie,o=new Map,s=(M,x)=>{let w=`${M}\0${x}`,E=o.get(w);if(E===void 0){let N=Xy(e.root,M,x);E=N?`${af(N.manager)} ${af(N.name)} ${af(N.version)}`:M?s(lf(M),x):e_,o.set(w,E)}return E},a=M=>{let x=FM.get(M.lang);return`${TM} ${x?s(lf(M.rel),x):e_} ${NM(M.rel)}`},l=e.files.filter(M=>M.kind==="code"&&M.symbols.length>0),c=new Map,d=new Map,u=new Map;for(let M of l){let x=[],w=new Map;for(let E of M.symbols){if(!E.name||n_.has(E.kind))continue;let N={file:M,sym:E,suffix:LM(E.kind)};x.push(N);let O=w.get(E.name);if(O||w.set(E.name,O=[]),O.push(N),M.lang==="go"&&!E.parent&&N.suffix==="#"){let L=i_(M),G=u.get(L);G||u.set(L,G=new Map),G.has(E.name)||G.set(E.name,N)}}c.set(M.rel,{defs:x,byName:w}),d.set(M.rel,a(M))}let f=M=>{let x=M.sym.parent;if(!x)return;let w=c.get(M.file.rel).byName.get(x)??[],E;for(let L of w)L===M||L.sym.line>M.sym.line||co(L)E.sym.line||L.sym.line===E.sym.line&&co(L)L!==M&&DM(L.suffix)),O=N.find(L=>!L.sym.parent)??N[0];if(O)return O;if(M.file.lang==="go")return u.get(i_(M.file))?.get(x)},m=new Set,p=new Set,g=M=>{if(M.symbol!==void 0)return M.symbol;p.add(M);let x=f(M),w=x&&!p.has(x)?g(x):d.get(M.file.rel)+(M.sym.parent?l_(M.sym.parent)+"#":"");return p.delete(M),M.symbol=jM(w,M.sym.name,M.suffix,M.sym.line,m),x&&w===x.symbol&&(x.children??=[]).push(M),M.symbol},h=new Map,_=new Map;for(let M of l)for(let x of c.get(M.rel).defs){let w=g(x);if(_.set(x.sym,w),!x.sym.exported)continue;let E=h.get(x.sym.name);E||h.set(x.sym.name,E=[]),E.push({symbolString:w,family:t_(x.sym.lang)})}let y=new Map,b=(M,x,w)=>{if(M===x)return;let E=y.get(M);E||y.set(M,E=new Map),E.set(x.symbol,w||E.get(x.symbol)===!0)};for(let M of ir(e,Ot(e))){let x=(c.get(M.fromFile)?.byName.get(M.from)??[]).filter(O=>O.suffix!=="()."&&O.suffix!=="!"),w=x.find(O=>O.sym.line===M.fromLine)??x.filter(O=>O.sym.line<=M.fromLine&&co(O)>=M.fromLine).pop()??x[0],E=c.get(M.toFile)?.byName.get(M.to)?.find(O=>O.sym.kind===M.toKind);if(!w||!E)continue;b(w,E,!1);let N=new Map;for(let O of E.children??[])O.suffix==="()."&&!N.has(O.sym.name)&&N.set(O.sym.name,O);for(let O of w.children??[]){let L=O.suffix==="()."?N.get(O.sym.name):void 0;L&&b(O,L,!0)}}let S=(M,x)=>{let w=h.get(M);if(!w||w.length!==1)return;let E=w[0];return E.family===x?E.symbolString:void 0},k=cr(e,Ot(e)),R=[];for(let M of l){let w=re(j(e.root,M.rel)).split(` -`).map(U=>U.endsWith("\r")?U.slice(0,-1):U),E=(U,q)=>{let te=w[U-1];if(te===void 0)return[U-1,0,0];let ae=s_(te,q);return ae?[U-1,ae[0],ae[1]]:[U-1,0,te.length]},{defs:N}=c.get(M.rel),O=[];for(let U of N)O.push({range:E(U.sym.line,U.sym.name),symbol:U.symbol,roles:IM});let L=t_(M.lang),G=k.forFile(M);for(let U of M.calls??[]){let q=S(U.name,L);if(!q)continue;let te=G?.(U);!te||_.get(te.def)!==q||O.push({range:E(U.line,U.name),symbol:q,roles:0})}for(let U of M.symbols){if(!n_.has(U.kind)||!U.name)continue;let q=w[U.line-1],te=q===void 0?null:s_(q,U.name),ae=te&&S(U.name,L);!te||!ae||O.push({range:[U.line-1,te[0],te[1]],symbol:ae,roles:0})}if(!O.length)continue;O.sort((U,q)=>U.range[0]-q.range[0]||U.range[1]-q.range[1]||U.range[2]-q.range[2]||U.roles-q.roles||T(U.symbol,q.symbol));let X=new Set,oe=N.map(U=>({symbol:U.symbol,displayName:U.sym.name,kind:PM(U.sym.kind),relationships:[...y.get(U)??[]].sort((q,te)=>T(q[0],te[0]))})).sort((U,q)=>T(U.symbol,q.symbol)),ue=new Sn(1024);Ln(ue,pM,M.rel);let ve=new Sn(64);for(let U of O){let q=`${U.range.join(",")} ${U.roles} ${U.symbol}`;X.has(q)||(X.add(q),ve.reset(),oM(ve,bM,U.range),Ln(ve,wM,U.symbol),U.roles!==0&&Bs(ve,xM,U.roles),Jr(ue,gM,ve))}let Oe=new Sn(64),z=new Sn(64);for(let U of oe){Oe.reset(),Ln(Oe,SM,U.symbol);for(let[q,te]of U.relationships)z.reset(),Ln(z,RM,q),te&&Bs(z,CM,1),Bs(z,MM,1),Jr(Oe,kM,z);U.kind!==void 0&&Bs(Oe,EM,U.kind),Ln(Oe,vM,U.displayName),Jr(ue,hM,Oe)}Ln(ue,yM,M.lang),Bs(ue,_M,$M),R.push(ue)}let I=new Sn;Ln(I,fM,"codeindex"),Ln(I,mM,r);let P=new Sn;Jr(P,cM,I),Ln(P,dM,n),Bs(P,uM,AM);let v=0;for(let M of R)v+=M.length;let C=new Sn(v+P.length+16);Jr(C,aM,P);for(let M of R)Jr(C,lM,M);return C.toUint8Array()}Rl();nn();uo();Fs();Xr();po();Yr();Il();Fl();wf();Gl();Pl();Ul();Mf();Eo();jl();Kl();xo();bo();Zl();Us();Os();Yl();Ur();ec();Jf();em();St();ce();et();$();ke();me();nc();bt();bt();pt();Rl();St();El();Hi();Ut();ce();Li();rr();qa();iu();In();Pi();Ze();Fn();Br();lr();js();Ff();Nf();Lr();qr();nn();uo();xo();bo();Zl();Us();Os();Yl();Tf();gt();Ur();ec();Fs();Kl();Xr();Yr();Pf();Il();Fl();et();Gl();bc();var kc=`codeindex engine v${Ie} \u2014 deterministic repo indexing +`}}$();wt();async function Jv(e={}){let t=e.label??"codeindex",n=[],r=u=>{n.push(u),e.onNote?e.onNote(u):F.stderr.write(u)},o=F.env.CODEINDEX_NO_GRAMMARS_PULL,s=(e.pull??!0)&&!(o&&o.trim()&&o!=="0"),a=[...e.keys??Na()],l=!1;if(qt().tier==="none"&&s){r(`${t}: tree-sitter grammars not found locally \u2014 pulling them into the shared cache (once per machine)\u2026 +`);let u=await Vi(Cs(),{onNote:r});r(u.message),l=u.ok&&u.status==="pulled"}await fn(a);let c=qt().tier,d=a.some(u=>Ue(u));return d||r(`${t}: no tree-sitter grammars available (offline?) \u2014 extracting with the regex tier, so symbols and call sites are less precise. Run \`codeindex grammars pull\` once online to enable AST precision. +`),{tier:c,ready:d,pulled:l,notes:n}}On();Os();yl();fr();Pn();qr();mr();Gs();tf();Rl();Zr();io();ff();gr();mf();Xi();$l();$();ge();Ri();Rt();nt();de();Ps();St();Pn();Zr();var Rn=class{buf;len=0;constructor(t=64){this.buf=new Uint8Array(t)}get length(){return this.len}grow(t){if(this.len+t<=this.buf.length)return;let n=this.buf.length*2||64;for(;n127;)e.push(t&127|128),t=Math.floor(t/128);e.push(t&127)}function g_(e,t,n){Tl(e,t*8+n)}function Vs(e,t,n){g_(e,t,0),Tl(e,n)}function h_(e,t,n){g_(e,t,2),Tl(e,n.length),e.pushAll(n)}function Qr(e,t,n){h_(e,t,n.view())}function Wn(e,t,n){h_(e,t,yM.encode(n))}function _M(e,t,n){let r=new Rn(n.length*2);for(let o of n)Tl(r,o);Qr(e,t,r)}var bM=1,wM=2,xM=2,SM=3,kM=4,EM=1,vM=2,RM=1,CM=2,MM=3,AM=4,IM=6,$M=1,TM=2,FM=3,OM=1,NM=4,PM=5,LM=6,DM=1,jM=2,WM=3,BM=1,UM=1,zM=2,HM="codeindex",c_=". . .",GM=new Map([["typescript","package.json"],["javascript","package.json"],["go","go.mod"],["rust","Cargo.toml"],["python","pyproject.toml"],["java","pom.xml"],["kotlin","pom.xml"],["scala","pom.xml"],["php","composer.json"]]);function pf(e){return e?e.replace(/ /g," "):"."}var qM=/^[A-Za-z0-9_+\-$]+$/;function y_(e){return qM.test(e)?e:"`"+e.replace(/`/g,"``")+"`"}function VM(e){return"`"+e.replace(/`/g,"``")+"`/"}var __=new Map([["class",[7,"#"]],["record",[7,"#"]],["interface",[21,"#"]],["annotation",[21,"#"]],["enum",[11,"#"]],["struct",[49,"#"]],["exception",[49,"#"]],["trait",[53,"#"]],["type",[54,"#"]],["opaque",[54,"#"]],["union",[59,"#"]],["protocol",[42,"#"]],["delegate",[73,"#"]],["contract",[62,"#"]],["library",[64,"#"]],["mixin",[85,"#"]],["extension",[84,"#"]],["concept",[86,"#"]],["error",[63,"#"]],["namespace",[30,"/"]],["package",[35,"/"]],["module",[29,"/"]],["mod",[29,"/"]],["impl",[29,"/"]],["function",[17,"()."]],["test",[17,"()."]],["method",[26,"()."]],["def",[26,"()."]],["destructor",[26,"()."]],["fallback",[26,"()."]],["receive",[26,"()."]],["call-signature",[26,"()."]],["constructor",[9,"()."]],["construct-signature",[9,"()."]],["getter",[18,"()."]],["setter",[45,"()."]],["operator",[34,"()."]],["modifier",[65,"()."]],["attr",[72,"()."]],["indexer",[47,"()."]],["index-signature",[47,"()."]],["macro",[25,"!"]],["guard",[25,"!"]],["const",[8,"."]],["val",[8,"."]],["var",[61,"."]],["variable",[61,"."]],["static",[82,"."]],["field",[15,"."]],["property",[41,"."]],["enum-member",[12,"."]],["event",[13,"."]],["object",[33,"."]]]),JM=e=>__.get(e)?.[0],KM=e=>__.get(e)?.[1]??".",XM=e=>e==="#"||e==="/";function ZM(e,t,n,r,o){let s=y_(t),a=e+s+n;if(!o.has(a))return o.add(a),a;for(let l=0;;l++){let c=l===0?String(r):`${r}_${l}`,d=n==="()."?`${e}${s}(${c}).`:`${a}(${c})`;if(!o.has(d))return o.add(d),d}}function d_(e){return e==="typescript"||e==="javascript"||e==="vue"||e==="svelte"||e==="astro"?"js":e==="c"||e==="cpp"?"c":e}var u_=new Set(["reexport","reexport-all","default"]);function f_(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function m_(e,t){if(!t)return null;let n=/^[A-Za-z_$][\w$]*$/.test(t),r=0;for(;;){let o=e.indexOf(t,r);if(o<0)return null;if(!n)return[o,o+t.length];let s=o>0?e.charCodeAt(o-1):-1,a=o+t.length,l=ae.sym.endLine??e.sym.line,gf=e=>e.includes("/")?e.slice(0,e.lastIndexOf("/")):"";function p_(e){let t=e.symbols.find(n=>n.kind==="package")?.name??"";return`${gf(e.rel)}\0${t}`}function hf(e,t={}){let n=t.projectRoot??Fr(e.root).href,r=t.toolVersion??Ne,o=new Map,s=(M,x)=>{let w=`${M}\0${x}`,E=o.get(w);if(E===void 0){let N=i_(e.root,M,x);E=N?`${pf(N.manager)} ${pf(N.name)} ${pf(N.version)}`:M?s(gf(M),x):c_,o.set(w,E)}return E},a=M=>{let x=GM.get(M.lang);return`${HM} ${x?s(gf(M.rel),x):c_} ${VM(M.rel)}`},l=e.files.filter(M=>M.kind==="code"&&M.symbols.length>0),c=new Map,d=new Map,u=new Map;for(let M of l){let x=[],w=new Map;for(let E of M.symbols){if(!E.name||u_.has(E.kind))continue;let N={file:M,sym:E,suffix:KM(E.kind)};x.push(N);let O=w.get(E.name);if(O||w.set(E.name,O=[]),O.push(N),M.lang==="go"&&!E.parent&&N.suffix==="#"){let L=p_(M),H=u.get(L);H||u.set(L,H=new Map),H.has(E.name)||H.set(E.name,N)}}c.set(M.rel,{defs:x,byName:w}),d.set(M.rel,a(M))}let f=M=>{let x=M.sym.parent;if(!x)return;let w=c.get(M.file.rel).byName.get(x)??[],E;for(let L of w)L===M||L.sym.line>M.sym.line||yo(L)E.sym.line||L.sym.line===E.sym.line&&yo(L)L!==M&&XM(L.suffix)),O=N.find(L=>!L.sym.parent)??N[0];if(O)return O;if(M.file.lang==="go")return u.get(p_(M.file))?.get(x)},m=new Set,p=new Set,g=M=>{if(M.symbol!==void 0)return M.symbol;p.add(M);let x=f(M),w=x&&!p.has(x)?g(x):d.get(M.file.rel)+(M.sym.parent?y_(M.sym.parent)+"#":"");return p.delete(M),M.symbol=ZM(w,M.sym.name,M.suffix,M.sym.line,m),x&&w===x.symbol&&(x.children??=[]).push(M),M.symbol},h=new Map,_=new Map;for(let M of l)for(let x of c.get(M.rel).defs){let w=g(x);if(_.set(x.sym,w),!x.sym.exported)continue;let E=h.get(x.sym.name);E||h.set(x.sym.name,E=[]),E.push({symbolString:w,family:d_(x.sym.lang)})}let y=new Map,b=(M,x,w)=>{if(M===x)return;let E=y.get(M);E||y.set(M,E=new Map),E.set(x.symbol,w||E.get(x.symbol)===!0)};for(let M of dr(e,Bt(e))){let x=(c.get(M.fromFile)?.byName.get(M.from)??[]).filter(O=>O.suffix!=="()."&&O.suffix!=="!"),w=x.find(O=>O.sym.line===M.fromLine)??x.filter(O=>O.sym.line<=M.fromLine&&yo(O)>=M.fromLine).pop()??x[0],E=c.get(M.toFile)?.byName.get(M.to)?.find(O=>O.sym.kind===M.toKind);if(!w||!E)continue;b(w,E,!1);let N=new Map;for(let O of E.children??[])O.suffix==="()."&&!N.has(O.sym.name)&&N.set(O.sym.name,O);for(let O of w.children??[]){let L=O.suffix==="()."?N.get(O.sym.name):void 0;L&&b(O,L,!0)}}let S=(M,x)=>{let w=h.get(M);if(!w||w.length!==1)return;let E=w[0];return E.family===x?E.symbolString:void 0},k=pr(e,Bt(e)),C=[];for(let M of l){let w=se(j(e.root,M.rel)).split(` +`).map(B=>B.endsWith("\r")?B.slice(0,-1):B),E=(B,G)=>{let te=w[B-1];if(te===void 0)return[B-1,0,0];let ie=m_(te,G);return ie?[B-1,ie[0],ie[1]]:[B-1,0,te.length]},{defs:N}=c.get(M.rel),O=[];for(let B of N)O.push({range:E(B.sym.line,B.sym.name),symbol:B.symbol,roles:UM});let L=d_(M.lang),H=k.forFile(M);for(let B of M.calls??[]){let G=S(B.name,L);if(!G)continue;let te=H?.(B);!te||_.get(te.def)!==G||O.push({range:E(B.line,B.name),symbol:G,roles:0})}for(let B of M.symbols){if(!u_.has(B.kind)||!B.name)continue;let G=w[B.line-1],te=G===void 0?null:m_(G,B.name),ie=te&&S(B.name,L);!te||!ie||O.push({range:[B.line-1,te[0],te[1]],symbol:ie,roles:0})}if(!O.length)continue;O.sort((B,G)=>B.range[0]-G.range[0]||B.range[1]-G.range[1]||B.range[2]-G.range[2]||B.roles-G.roles||T(B.symbol,G.symbol));let X=new Set,le=N.map(B=>({symbol:B.symbol,displayName:B.sym.name,kind:JM(B.sym.kind),relationships:[...y.get(B)??[]].sort((G,te)=>T(G[0],te[0]))})).sort((B,G)=>T(B.symbol,G.symbol)),me=new Rn(1024);Wn(me,RM,M.rel);let Ee=new Rn(64);for(let B of O){let G=`${B.range.join(",")} ${B.roles} ${B.symbol}`;X.has(G)||(X.add(G),Ee.reset(),_M(Ee,$M,B.range),Wn(Ee,TM,B.symbol),B.roles!==0&&Vs(Ee,FM,B.roles),Qr(me,CM,Ee))}let je=new Rn(64),U=new Rn(64);for(let B of le){je.reset(),Wn(je,OM,B.symbol);for(let[G,te]of B.relationships)U.reset(),Wn(U,DM,G),te&&Vs(U,jM,1),Vs(U,WM,1),Qr(je,NM,U);B.kind!==void 0&&Vs(je,PM,B.kind),Wn(je,LM,B.displayName),Qr(me,MM,je)}Wn(me,AM,M.lang),Vs(me,IM,zM),C.push(me)}let I=new Rn;Wn(I,EM,"codeindex"),Wn(I,vM,r);let P=new Rn;Qr(P,xM,I),Wn(P,SM,n),Vs(P,kM,BM);let v=0;for(let M of C)v+=M.length;let R=new Rn(v+P.length+16);Qr(R,bM,P);for(let M of C)Qr(R,wM,M);return R.toUint8Array()}Fl();ln();_o();js();ts();xo();rs();Ll();Wl();Cf();Yl();zl();Kl();Nf();$o();ql();nc();Mo();Ro();sc();Js();Ws();ic();Vr();ac();tm();am();At();de();it();$();Re();ge();cc();Rt();Rt();wt();Fl();At();$l();Xi();Jt();de();zi();lr();Qa();fu();Fn();Ui();nt();Pn();qr();mr();Gs();Wf();Uf();Ur();Zr();ln();_o();Mo();Ro();sc();Js();Ws();ic();jf();St();Vr();ac();js();nc();ts();rs();zf();Ll();Wl();it();Yl();Rc();var Ic=`codeindex engine v${Ne} \u2014 deterministic repo indexing Usage: codeindex [flags] @@ -497,78 +497,78 @@ Flags (accepted before OR after the subcommand: '--repo X scan' and --json \`delta\`: the JSON result instead of the text panel --fail-on \`delta\`: exit 1 when a module scores HIGH, MEDIUM or LOW (or above) -`,tm=new Set(["--repo","--out","--include","--exclude","--scope","--no-gitignore","--ignore-dir","--max-files","--max-bytes","--max-calls","--no-ast","--workers","--index","--no-index-cache","--full-hash"]),Vo={index:{flags:[],positionals:0},scan:{flags:["--why","--skipped"],positionals:0},status:{flags:["--check"],positionals:0},graph:{flags:[],positionals:0},symbols:{flags:[],positionals:0},scip:{flags:["--project-root"],positionals:0},callers:{flags:["--lsp","--trust-lsp-config","--recall","--raw","--with-caller"],positionals:1},hierarchy:{flags:[],positionals:1},implementations:{flags:[],positionals:1},callgraph:{flags:["--depth","--direction"],positionals:1},callpath:{flags:["--depth","--limit","--files","--include-inferred"],positionals:2},find:{flags:["--substring","--include-body","--concise","--limit"],positionals:1},refs:{flags:["--lsp","--trust-lsp-config","--concise"],positionals:1},outline:{flags:["--concise"],positionals:1},"symbol-at":{flags:[],positionals:1},workspaces:{flags:["--check"],positionals:0},churn:{flags:["--since"],positionals:0},grep:{flags:["--ignore-case","--max-hits","--files-with-matches","--timeout-ms"],positionals:1},search:{flags:["--limit","--no-fuzzy","--exact","--explain","--rank","--semantic"],positionals:1},embed:{flags:["--run"],positionals:1},lsp:{flags:["--probe","--trust-lsp-config"],positionals:1},grammars:{flags:[],positionals:1},rules:{flags:["--config"],positionals:0},repomap:{flags:["--budget-tokens"],positionals:0},hotspots:{flags:["--since","--limit"],positionals:0},coupling:{flags:["--since","--limit","--min-together","--max-commit-files","--hidden"],positionals:0},literals:{flags:["--min-files","--min-count","--include-tests"],positionals:0},deadcode:{flags:["--kinds","--include-tail","--limit"],positionals:0},complexity:{flags:["--limit"],positionals:1},risk:{flags:["--since","--limit"],positionals:0},delta:{flags:["--base","--staged","--depth","--json","--fail-on"],positionals:0},impact:{flags:["--depth","--include-inferred"],positionals:1},neighbors:{flags:["--depth","--kind"],positionals:1},resolution:{flags:["--lang","--limit"],positionals:0},mermaid:{flags:[],positionals:1}},S$={"-i":"--ignore-case","-l":"--files-with-matches","-o":"--out","-h":"--help","-v":"--version"};function k$(e,t){let n=Array.from({length:t.length+1},(r,o)=>o);for(let r=1;r<=e.length;r++){let o=[r];for(let s=1;s<=t.length;s++)o[s]=Math.min(n[s]+1,o[s-1]+1,n[s-1]+(e[r-1]===t[s-1]?0:1));n=o}return n[t.length]}function nm(e,t){let n,r=1/0;for(let o of[...t].sort()){let s=k$(e,o);snew Set([...tm,...Object.values(Vo).flatMap(e=>e.flags)]);function zb(e){let t=S$[e]??nm(e,E$());return new Error(`unknown flag: ${e}${t?` (did you mean ${t}?)`:""}`)}function v$(e,t){let n=Vo[e];if(n){for(let r of t.given){if(tm.has(r)||n.flags.includes(r))continue;let o=nm(r,n.flags);throw new Error(`${r} does not apply to ${e}`+(o?` (did you mean ${o}?)`:n.flags.length?` (it takes ${n.flags.join(", ")})`:"")+` \u2014 codeindex ${e} --help`)}if(t.positionals.length>n.positionals){let r=t.positionals[n.positionals];throw new Error(n.positionals===0?`${e} takes no argument, got "${r}" \u2014 codeindex ${e} --help`:`unexpected argument "${r}": ${e} takes ${n.positionals===1?"one":n.positionals} \u2014 codeindex ${e} --help`)}}}function R$(e){let t=kc.split(` -`),n=l=>{let c=[t[l]];for(let d=l+1;dl.startsWith(` ${e} `)),o=Vo[e],s=[`codeindex ${e}`,"",...r===-1?[]:n(r)],a=(o?.flags??[]).flatMap(l=>{let c=t.findIndex(d=>d.startsWith(` ${l} `)||d===` ${l}`);return c===-1?[]:n(c)});return a.length&&s.push("","Flags:",...a),s.push("",`Global flags: ${[...tm].join(", ")} (codeindex --help)`,""),s.join(` -`)}function C$(e){let t={repo:F.cwd(),include:[],exclude:[],gitignore:!0,ignoreDirs:[],noAst:!1,fuzzy:!0,semantic:!1,positionals:[],given:[]};for(let n=0;n{let l=e[++n];if(l===void 0)throw new Error(`missing value for ${r}`);return l},s=()=>{let l=o(),c=l.trim()===""?NaN:Number(l);if(!Number.isInteger(c)||c<=0)throw new Error(`${r} expects a positive whole number, got "${l}"`);return c},a=()=>{let l=o(),c=l.trim()===""?NaN:Number(l);if(!Number.isInteger(c)||c<=0)throw new Error(`${r} expects a positive number, a whole one, got "${l}"`);return c};if(r.startsWith("--")&&r!=="--"&&t.given.push(r),r==="--repo")t.repo=le(o());else if(r==="--out"){let l=o();t.out=l==="-"?"-":le(l)}else if(r==="--project-root")t.projectRoot=o();else if(r==="--include")t.include.push(o());else if(r==="--exclude")t.exclude.push(o());else if(r==="--scope")t.scope=o();else if(r==="--no-gitignore")t.gitignore=!1;else if(r==="--ignore-dir")t.ignoreDirs.push(o().replace(/(.)[\\/]+$/,"$1"));else if(r==="--max-files")t.maxFiles=a();else if(r==="--max-bytes")t.maxBytes=a();else if(r==="--max-calls")t.maxCalls=a();else if(r==="--ignore-case")t.ignoreCase=!0;else if(r==="--max-hits")t.maxHits=s();else if(r==="--timeout-ms")t.timeoutMs=a();else if(r==="--files-with-matches")t.filesWithMatches=!0;else if(r==="--budget-tokens")t.budgetTokens=a();else if(r==="--min-files")t.minFiles=a();else if(r==="--min-count")t.minCount=a();else if(r==="--include-tests")t.includeTests=!0;else if(r==="--include-inferred")t.includeInferred=!0;else if(r==="--include-tail")t.includeTail=!0;else if(r==="--kinds"){let l=o();if(l!=="callable"&&l!=="all")throw new Error(`--kinds expects callable|all, got "${l}"`);t.kinds=l}else if(r==="--no-ast")t.noAst=!0;else if(r==="--index")t.indexDir=o();else if(r==="--no-index-cache")t.noIndexCache=!0;else if(r==="--full-hash")t.fullHash=!0;else if(r==="--check")t.check=!0;else if(r==="--why")t.why=o();else if(r==="--skipped")t.skipped=!0;else if(r==="--workers"){let l=o(),c=l.trim()===""?NaN:Number(l);if(!Number.isInteger(c)||c<0)throw new Error(`--workers expects a non-negative integer, got "${l}"`);t.workers=c}else if(r==="--since")t.since=o();else if(r==="--min-together")t.minTogether=a();else if(r==="--max-commit-files")t.maxCommitFiles=a();else if(r==="--hidden")t.hidden=!0;else if(r==="--config")t.config=o();else if(r==="--limit")t.limit=s();else if(r==="--no-fuzzy")t.fuzzy=!1;else if(r==="--exact")t.exact=!0;else if(r==="--explain")t.explain=!0;else if(r==="--semantic")t.semantic=!0;else if(r==="--lsp")t.lsp=!0;else if(r==="--trust-lsp-config")t.trustLspConfig=!0;else if(r==="--recall")t.recall=!0;else if(r==="--raw")t.raw=!0;else if(r==="--run")t.run=!0;else if(r==="--probe")t.probe=!0;else if(r==="--base")t.base=o();else if(r==="--staged")t.staged=!0;else if(r==="--depth")t.depth=a();else if(r==="--kind"){let l=o(),c=l.split(",").map(u=>u.trim()).filter(Boolean),d=c.filter(u=>!Ts.includes(u));if(!c.length||d.length)throw new Error(`--kind expects a comma-separated list of ${Ts.join("|")}, got "${d.join(",")||l}"`);t.kind=c.join(",")}else if(r==="--rank"){let l=o();if(l!=="graph"&&l!=="lexical")throw new Error(`--rank expects graph|lexical, got "${l}"`);t.rank=l}else if(r==="--direction"){let l=o();if(l!=="out"&&l!=="in"&&l!=="both")throw new Error(`--direction expects out|in|both, got "${l}"`);t.direction=l}else if(r==="--json")t.json=!0;else if(r==="--fail-on"){let l=o().toUpperCase();if(l!=="HIGH"&&l!=="MEDIUM"&&l!=="LOW")throw new Error(`--fail-on expects HIGH, MEDIUM or LOW, got "${l}"`);t.failOn=l}else if(r==="--lang")t.lang=o();else if(r==="--substring")t.substring=!0;else if(r==="--include-body")t.includeBody=!0;else if(r==="--concise")t.concise=!0;else if(r==="--files")t.files=!0;else if(r==="--with-caller")t.withCaller=!0;else if(r==="--"){if(t.positional!==void 0)throw new Error(`unexpected "--": the positional is already "${t.positional}"`);let l=o();t.positionals.push(l),t.positional=l}else{if(r.startsWith("-")&&r!=="-")throw zb(r);if(!r.startsWith("--"))t.positionals.push(r),t.positional??=r;else throw zb(r)}}return t}function we(e,t){t&&t!=="-"?En(t,e):F.stdout.write(e)}function En(e,t){try{if(!qn(e).isFile()){it(e,t);return}}catch{}let n=`${e}.tmp-${F.pid}`;try{it(n,t),Rn(n,e);return}catch{Ke(n,{force:!0})}it(e,t)}function M$(e){for(let n of e.ignoreDirs)/[\\/]/.test(n)&&F.stderr.write(`codeindex: warning: --ignore-dir takes a directory name, and "${n}" is a path that matches nothing \u2014 use --exclude '${n}/**' to leave that directory out -`);if(e.scope===void 0)return;let t=nr(e.repo,e.scope);t===".."||t.startsWith("../")||Pe(t)?F.stderr.write(`codeindex: warning: --scope ${e.scope} is outside --repo ${e.repo} \u2014 nothing matches +`,lm=new Set(["--repo","--out","--include","--exclude","--scope","--no-gitignore","--ignore-dir","--max-files","--max-bytes","--max-calls","--no-ast","--workers","--index","--no-index-cache","--full-hash"]),ea={index:{flags:[],positionals:0},scan:{flags:["--why","--skipped"],positionals:0},status:{flags:["--check"],positionals:0},graph:{flags:[],positionals:0},symbols:{flags:[],positionals:0},scip:{flags:["--project-root"],positionals:0},callers:{flags:["--lsp","--trust-lsp-config","--recall","--raw","--with-caller"],positionals:1},hierarchy:{flags:[],positionals:1},implementations:{flags:[],positionals:1},callgraph:{flags:["--depth","--direction"],positionals:1},callpath:{flags:["--depth","--limit","--files","--include-inferred"],positionals:2},find:{flags:["--substring","--include-body","--concise","--limit"],positionals:1},refs:{flags:["--lsp","--trust-lsp-config","--concise"],positionals:1},outline:{flags:["--concise"],positionals:1},"symbol-at":{flags:[],positionals:1},workspaces:{flags:["--check"],positionals:0},churn:{flags:["--since"],positionals:0},grep:{flags:["--ignore-case","--max-hits","--files-with-matches","--timeout-ms"],positionals:1},search:{flags:["--limit","--no-fuzzy","--exact","--explain","--rank","--semantic"],positionals:1},embed:{flags:["--run"],positionals:1},lsp:{flags:["--probe","--trust-lsp-config"],positionals:1},grammars:{flags:[],positionals:1},rules:{flags:["--config"],positionals:0},repomap:{flags:["--budget-tokens"],positionals:0},hotspots:{flags:["--since","--limit"],positionals:0},coupling:{flags:["--since","--limit","--min-together","--max-commit-files","--hidden"],positionals:0},literals:{flags:["--min-files","--min-count","--include-tests"],positionals:0},deadcode:{flags:["--kinds","--include-tail","--limit"],positionals:0},complexity:{flags:["--limit"],positionals:1},risk:{flags:["--since","--limit"],positionals:0},delta:{flags:["--base","--staged","--depth","--json","--fail-on"],positionals:0},impact:{flags:["--depth","--include-inferred"],positionals:1},neighbors:{flags:["--depth","--kind"],positionals:1},resolution:{flags:["--lang","--limit"],positionals:0},mermaid:{flags:[],positionals:1}},O$={"-i":"--ignore-case","-l":"--files-with-matches","-o":"--out","-h":"--help","-v":"--version"};function N$(e,t){let n=Array.from({length:t.length+1},(r,o)=>o);for(let r=1;r<=e.length;r++){let o=[r];for(let s=1;s<=t.length;s++)o[s]=Math.min(n[s]+1,o[s-1]+1,n[s-1]+(e[r-1]===t[s-1]?0:1));n=o}return n[t.length]}function cm(e,t){let n,r=1/0;for(let o of[...t].sort()){let s=N$(e,o);snew Set([...lm,...Object.values(ea).flatMap(e=>e.flags)]);function Yb(e){let t=O$[e]??cm(e,P$());return new Error(`unknown flag: ${e}${t?` (did you mean ${t}?)`:""}`)}function L$(e,t){let n=ea[e];if(n){for(let r of t.given){if(lm.has(r)||n.flags.includes(r))continue;let o=cm(r,n.flags);throw new Error(`${r} does not apply to ${e}`+(o?` (did you mean ${o}?)`:n.flags.length?` (it takes ${n.flags.join(", ")})`:"")+` \u2014 codeindex ${e} --help`)}if(t.positionals.length>n.positionals){let r=t.positionals[n.positionals];throw new Error(n.positionals===0?`${e} takes no argument, got "${r}" \u2014 codeindex ${e} --help`:`unexpected argument "${r}": ${e} takes ${n.positionals===1?"one":n.positionals} \u2014 codeindex ${e} --help`)}}}function D$(e){let t=Ic.split(` +`),n=l=>{let c=[t[l]];for(let d=l+1;dl.startsWith(` ${e} `)),o=ea[e],s=[`codeindex ${e}`,"",...r===-1?[]:n(r)],a=(o?.flags??[]).flatMap(l=>{let c=t.findIndex(d=>d.startsWith(` ${l} `)||d===` ${l}`);return c===-1?[]:n(c)});return a.length&&s.push("","Flags:",...a),s.push("",`Global flags: ${[...lm].join(", ")} (codeindex --help)`,""),s.join(` +`)}function j$(e){let t={repo:F.cwd(),include:[],exclude:[],gitignore:!0,ignoreDirs:[],noAst:!1,fuzzy:!0,semantic:!1,positionals:[],given:[]};for(let n=0;n{let l=e[++n];if(l===void 0)throw new Error(`missing value for ${r}`);return l},s=()=>{let l=o(),c=l.trim()===""?NaN:Number(l);if(!Number.isInteger(c)||c<=0)throw new Error(`${r} expects a positive whole number, got "${l}"`);return c},a=()=>{let l=o(),c=l.trim()===""?NaN:Number(l);if(!Number.isInteger(c)||c<=0)throw new Error(`${r} expects a positive number, a whole one, got "${l}"`);return c};if(r.startsWith("--")&&r!=="--"&&t.given.push(r),r==="--repo")t.repo=ce(o());else if(r==="--out"){let l=o();t.out=l==="-"?"-":ce(l)}else if(r==="--project-root")t.projectRoot=o();else if(r==="--include")t.include.push(o());else if(r==="--exclude")t.exclude.push(o());else if(r==="--scope")t.scope=o();else if(r==="--no-gitignore")t.gitignore=!1;else if(r==="--ignore-dir")t.ignoreDirs.push(o().replace(/(.)[\\/]+$/,"$1"));else if(r==="--max-files")t.maxFiles=a();else if(r==="--max-bytes")t.maxBytes=a();else if(r==="--max-calls")t.maxCalls=a();else if(r==="--ignore-case")t.ignoreCase=!0;else if(r==="--max-hits")t.maxHits=s();else if(r==="--timeout-ms")t.timeoutMs=a();else if(r==="--files-with-matches")t.filesWithMatches=!0;else if(r==="--budget-tokens")t.budgetTokens=a();else if(r==="--min-files")t.minFiles=a();else if(r==="--min-count")t.minCount=a();else if(r==="--include-tests")t.includeTests=!0;else if(r==="--include-inferred")t.includeInferred=!0;else if(r==="--include-tail")t.includeTail=!0;else if(r==="--kinds"){let l=o();if(l!=="callable"&&l!=="all")throw new Error(`--kinds expects callable|all, got "${l}"`);t.kinds=l}else if(r==="--no-ast")t.noAst=!0;else if(r==="--index")t.indexDir=o();else if(r==="--no-index-cache")t.noIndexCache=!0;else if(r==="--full-hash")t.fullHash=!0;else if(r==="--check")t.check=!0;else if(r==="--why")t.why=o();else if(r==="--skipped")t.skipped=!0;else if(r==="--workers"){let l=o(),c=l.trim()===""?NaN:Number(l);if(!Number.isInteger(c)||c<0)throw new Error(`--workers expects a non-negative integer, got "${l}"`);t.workers=c}else if(r==="--since")t.since=o();else if(r==="--min-together")t.minTogether=a();else if(r==="--max-commit-files")t.maxCommitFiles=a();else if(r==="--hidden")t.hidden=!0;else if(r==="--config")t.config=o();else if(r==="--limit")t.limit=s();else if(r==="--no-fuzzy")t.fuzzy=!1;else if(r==="--exact")t.exact=!0;else if(r==="--explain")t.explain=!0;else if(r==="--semantic")t.semantic=!0;else if(r==="--lsp")t.lsp=!0;else if(r==="--trust-lsp-config")t.trustLspConfig=!0;else if(r==="--recall")t.recall=!0;else if(r==="--raw")t.raw=!0;else if(r==="--run")t.run=!0;else if(r==="--probe")t.probe=!0;else if(r==="--base")t.base=o();else if(r==="--staged")t.staged=!0;else if(r==="--depth")t.depth=a();else if(r==="--kind"){let l=o(),c=l.split(",").map(u=>u.trim()).filter(Boolean),d=c.filter(u=>!Ds.includes(u));if(!c.length||d.length)throw new Error(`--kind expects a comma-separated list of ${Ds.join("|")}, got "${d.join(",")||l}"`);t.kind=c.join(",")}else if(r==="--rank"){let l=o();if(l!=="graph"&&l!=="lexical")throw new Error(`--rank expects graph|lexical, got "${l}"`);t.rank=l}else if(r==="--direction"){let l=o();if(l!=="out"&&l!=="in"&&l!=="both")throw new Error(`--direction expects out|in|both, got "${l}"`);t.direction=l}else if(r==="--json")t.json=!0;else if(r==="--fail-on"){let l=o().toUpperCase();if(l!=="HIGH"&&l!=="MEDIUM"&&l!=="LOW")throw new Error(`--fail-on expects HIGH, MEDIUM or LOW, got "${l}"`);t.failOn=l}else if(r==="--lang")t.lang=o();else if(r==="--substring")t.substring=!0;else if(r==="--include-body")t.includeBody=!0;else if(r==="--concise")t.concise=!0;else if(r==="--files")t.files=!0;else if(r==="--with-caller")t.withCaller=!0;else if(r==="--"){if(t.positional!==void 0)throw new Error(`unexpected "--": the positional is already "${t.positional}"`);let l=o();t.positionals.push(l),t.positional=l}else{if(r.startsWith("-")&&r!=="-")throw Yb(r);if(!r.startsWith("--"))t.positionals.push(r),t.positional??=r;else throw Yb(r)}}return t}function Se(e,t){t&&t!=="-"?Mn(t,e):F.stdout.write(e)}function Mn(e,t){try{if(!Zn(e).isFile()){ut(e,t);return}}catch{}let n=`${e}.tmp-${F.pid}`;try{ut(n,t),An(n,e);return}catch{et(n,{force:!0})}ut(e,t)}function W$(e){for(let n of e.ignoreDirs)/[\\/]/.test(n)&&F.stderr.write(`codeindex: warning: --ignore-dir takes a directory name, and "${n}" is a path that matches nothing \u2014 use --exclude '${n}/**' to leave that directory out +`);if(e.scope===void 0)return;let t=ar(e.repo,e.scope);t===".."||t.startsWith("../")||We(t)?F.stderr.write(`codeindex: warning: --scope ${e.scope} is outside --repo ${e.repo} \u2014 nothing matches `):t&&!/[*?[]/.test(t)&&!Q(j(e.repo,t))&&F.stderr.write(`codeindex: warning: --scope ${e.scope} does not exist under ${e.repo} \u2014 nothing matches -`)}function qo(e){let t=e.include.find(n=>!n.includes("/"));F.stderr.write(`codeindex: warning: no file of ${e.repo} was indexed \u2014 check --scope/--include/--exclude and the ignore rules`+(t?` (globs are rooted at the repo: '${t}' matches top-level paths only, '**/${t}' any depth)`:"")+` -`)}function Xt(e,t){return{include:e.include.length?e.include:void 0,exclude:e.exclude.length?e.exclude:void 0,scope:e.scope,gitignore:e.gitignore,ignoreDirs:e.ignoreDirs.length?e.ignoreDirs:void 0,maxFiles:e.maxFiles,maxBytes:e.maxBytes,maxCallsPerFile:e.maxCalls,fullHash:e.fullHash,out:zt(e.repo,e.indexDir),precomputedWalk:t}}var Hb=e=>e==="HIGH"?2:e==="MEDIUM"?1:0,A$=new Set(["grep","churn","workspaces","grammars"]),I$=new Set(["scan","status"]),$$={absent:"no cache.json there",unreadable:"cache.json cannot be read",corrupt:"cache.json is not a valid index",schema:"written for another schema version",extractor:"written by another extractor version"};function T$(e,t,n,r,o){let s=su(e,t,De,r);if(!s)return;let{fresh:a,walked:l,drift:c}=s,d=l.map(f=>({kind:mt(f.rel,f.ext),ext:f.ext}));if(c.unchanged!==l.length||c.indexed!==l.length||a.meta.commit!==s.commit||!Kd(a.meta.extraction,Jd(d,n,De))||!o(a.meta.embed))return;let u=Or(e,{contentUnchanged:!0,commit:s.commit},a.meta,r);if(!(!u?.bytes("symbols")||!u.bytes("graph")))return{files:l.length,capped:s.capped}}function F$(e){let t,n,r,o,s=!1,a=!1;for(let l=0;l");return{defaultRepo:t,serverInfo:n?{name:n}:void 0,maxResponseBytes:r,profile:o,watch:s,...a?{trustLspConfig:a}:{}}}var O$=new Set(["--repo","--out","--project-root","--include","--exclude","--scope","--ignore-dir","--max-files","--max-bytes","--max-calls","--max-hits","--timeout-ms","--budget-tokens","--min-files","--min-count","--since","--min-together","--max-commit-files","--config","--limit","--server-name","--tools","--workers","--index","--max-response-bytes","--base","--fail-on","--depth","--kind","--rank","--direction","--lang","--why","--kinds"]);function N$(e){let t=[],n=0;for(;n=e.length?e:[e[n],...t,...e.slice(n+1)]}async function P$(e){let t=N$(e),[n,...r]=t;if(!n||n==="help"||n==="--help"||n==="-h"){F.stdout.write(kc);return}if(n==="version"||n==="--version"){F.stdout.write(Ie+` +`)}function Qo(e){let t=e.include.find(n=>!n.includes("/"));F.stderr.write(`codeindex: warning: no file of ${e.repo} was indexed \u2014 check --scope/--include/--exclude and the ignore rules`+(t?` (globs are rooted at the repo: '${t}' matches top-level paths only, '**/${t}' any depth)`:"")+` +`)}function nn(e,t){return{include:e.include.length?e.include:void 0,exclude:e.exclude.length?e.exclude:void 0,scope:e.scope,gitignore:e.gitignore,ignoreDirs:e.ignoreDirs.length?e.ignoreDirs:void 0,maxFiles:e.maxFiles,maxBytes:e.maxBytes,maxCallsPerFile:e.maxCalls,fullHash:e.fullHash,out:Kt(e.repo,e.indexDir),precomputedWalk:t}}var Qb=e=>e==="HIGH"?2:e==="MEDIUM"?1:0,B$=new Set(["grep","churn","workspaces","grammars"]),U$=new Set(["scan","status"]),z$={absent:"no cache.json there",unreadable:"cache.json cannot be read",corrupt:"cache.json is not a valid index",schema:"written for another schema version",extractor:"written by another extractor version"};function H$(e,t,n,r,o){let s=uu(e,t,Ue,r);if(!s)return;let{fresh:a,walked:l,drift:c}=s,d=l.map(f=>({kind:bt(f.rel,f.ext),ext:f.ext}));if(c.unchanged!==l.length||c.indexed!==l.length||a.meta.commit!==s.commit||!nu(a.meta.extraction,tu(d,n,Ue))||!o(a.meta.embed))return;let u=jr(e,{contentUnchanged:!0,commit:s.commit},a.meta,r);if(!(!u?.bytes("symbols")||!u.bytes("graph")))return{files:l.length,capped:s.capped}}function G$(e){let t,n,r,o,s=!1,a=!1;for(let l=0;l");return{defaultRepo:t,serverInfo:n?{name:n}:void 0,maxResponseBytes:r,profile:o,watch:s,...a?{trustLspConfig:a}:{}}}var q$=new Set(["--repo","--out","--project-root","--include","--exclude","--scope","--ignore-dir","--max-files","--max-bytes","--max-calls","--max-hits","--timeout-ms","--budget-tokens","--min-files","--min-count","--since","--min-together","--max-commit-files","--config","--limit","--server-name","--tools","--workers","--index","--max-response-bytes","--base","--fail-on","--depth","--kind","--rank","--direction","--lang","--why","--kinds"]);function V$(e){let t=[],n=0;for(;n=e.length?e:[e[n],...t,...e.slice(n+1)]}async function J$(e){let t=V$(e),[n,...r]=t;if(!n||n==="help"||n==="--help"||n==="-h"){F.stdout.write(Ic);return}if(n==="version"||n==="--version"){F.stdout.write(Ne+` `);return}if(n==="rewrite"){let x=e.slice(e.indexOf("rewrite")+1);if(x.length!==1){F.stderr.write(`codeindex: rewrite takes the command line as ONE argument: codeindex rewrite '' -`),F.exitCode=1;return}let{rewriteCommand:w}=await Promise.resolve().then(()=>(em(),Ub)),E=w(x[0],"codeindex",F.cwd());if(!E){F.exitCode=1;return}F.stdout.write(E+` -`);return}if(n==="mcp"){let{runMcpServer:x}=await Promise.resolve().then(()=>(Jf(),Pb));await x(F$(r));return}if(!(n in Vo)){let x=nm(n,Object.keys(Vo));F.stderr.write(`unknown command: ${n}${x?` (did you mean ${x}?)`:""} +`),F.exitCode=1;return}let{rewriteCommand:w}=await Promise.resolve().then(()=>(am(),Zb)),E=w(x[0],"codeindex",F.cwd());if(!E){F.exitCode=1;return}F.stdout.write(E+` +`);return}if(n==="mcp"){let{runMcpServer:x}=await Promise.resolve().then(()=>(tm(),Gb));await x(G$(r));return}if(!(n in ea)){let x=cm(n,Object.keys(ea));F.stderr.write(`unknown command: ${n}${x?` (did you mean ${x}?)`:""} -${kc}`),F.exitCode=2;return}let o=r.indexOf("--");if((o===-1?r:r.slice(0,o)).some(x=>x==="--help"||x==="-h")){F.stdout.write(R$(n));return}let s=C$(r);if(v$(n,s),(n==="index"||n==="embed"&&s.positional==="build")&&s.out==="-")throw new Error(`${n==="index"?"index":"embed build"} writes files: --out needs a directory, not "-"`);if(!Q(s.repo))throw new Error(`--repo path does not exist: ${s.repo}`);if(!Me(s.repo).isDirectory())throw new Error(`--repo path is not a directory: ${s.repo}`);M$(s);let a=(!A$.has(n)||n==="workspaces"&&s.check===!0)&&!(n==="embed"&&s.positional!=="build"),l=()=>Xe(s.repo,Fr(s.repo,Xt(s))),c;a&&!s.noAst&&!I$.has(n)&&n!=="delta"&&(c=l());let d=!1,u=async()=>{d||s.noAst||!c||(await an(Bt(c.files.map(x=>x.ext))),d=!0)},f=s.indexDir??Ve,m=!1,p,g,h=!1,_=x=>(x.files.length===0&&!h&&(h=!0,qo(s)),x),y=async()=>{if(p)return p;if(m)return g;if(m=!0,!s.noIndexCache)return p=Ga(s.repo,{...Xt(s,c),workers:s.workers,ast:!s.noAst},u,f).then(x=>{if(x)g={scan:_(x.scan),arts:x.arts,loadArtifacts:x.loadArtifacts,artifacts:x.artifacts};else if(s.indexDir!==void 0){let w=ji(s.repo,f),E=$$["unusable"in w?w.unusable:"unreadable"];F.stderr.write(`codeindex: no usable index at ${zt(s.repo,f)} (${E}) \u2014 building from scratch -`)}return g}),p},b,S=async()=>{let x=(await y())?.scan;return x||(b??=u().then(()=>bn(s.repo,{...Xt(s,c),workers:s.workers}).then(_)))},k,R=async()=>{let x=await y();return x?.arts?x.arts:x?x.arts??=x.loadArtifacts?.()??jn(x.scan,Xt(s,c)):k??=S().then(w=>jn(w,Xt(s,c)))},I=!1,P,v=()=>{if(!I){I=!0;let x=s.noIndexCache?void 0:yh(s.repo,{...Xt(s,c),ast:!s.noAst},f);x?.fileCount===0&&!h&&(h=!0,qo(s)),P=x?.artifacts}return P},C=async()=>{let x=v()?.graph();if(x)return x;let w=await y();return w?.arts?.graph??w?.artifacts?.graph()??(await R()).graph},M=async x=>v()?.bytes(x)??(await y())?.artifacts?.bytes(x);if(n==="index"){if(!s.out)throw new Error("index needs --out ");let x=s.out;Yt(x,{recursive:!0});let w=j(x,"cache.json");await u();let E=Wn(s.repo),{model:N,error:O}=Kr(E);O&&F.stderr.write(`codeindex: ${O} \u2014 embeddings.bin skipped; re-run \`codeindex embed pull\` -`);let L=j(x,"graph.json"),G=j(x,"symbols.json"),X=j(x,"embeddings.bin"),oe=ne=>{try{return Re(ie(ne))}catch{return}},ue=ne=>!N||ne!==void 0&&ne.embedVersion===Jt&&ne.modelId===N.modelId&&ne.sha1!==void 0&&oe(X)===ne.sha1,ve=s.noIndexCache||s.fullHash?void 0:T$(s.repo,{...Xt(s,c),out:x},s.maxCalls,x,ue);if(ve){ve.files===0&&qo(s),F.stderr.write(`codeindex: ${ve.files} files \u2192 ${x}/graph.json + symbols.json${ve.capped?" (capped)":""} (unchanged \u2014 artifacts reused) -`);return}let Oe=s.noIndexCache?void 0:Di(s.repo,x),z=Oe?.meta??{},U=Oe&&Oi(Oe.cacheMap,Oe.meta.extraction,{maxCallsPerFile:s.maxCalls,ast:De}),q=await bn(s.repo,{...Xt(s,c),cache:U,out:x,workers:s.workers}),te=Jd(q.files,s.maxCalls,De);q.files.length===0&&qo(s);let ae=j(x,eu),ge=ne=>{let V;try{V=Me(w)}catch{return}let Z=hh(q,ne,te,{size:V.size,mtimeMs:V.mtimeMs}),B;try{B=ie(ae,"utf8")}catch{B=void 0}B!==Z&&En(ae,Z)},st=ne=>{let V=Object.create(null);for(let Z of q.files){let B={hash:Z.hash,record:Z,size:Z.size},K=q.mtimes.get(Z.rel);K!==void 0&&(B.mtimeMs=K),V[Z.rel]=B}En(w,JSON.stringify({schemaVersion:5,extractorVersion:17,engineVersion:Ie,commit:q.commit,graphSha1:ne.graphSha1,symbolsSha1:ne.symbolsSha1,embed:ne.embed,extraction:te,files:V})+` -`),ge(ne)},he=ue(z.embed)?Or(s.repo,q,z,x):void 0,fe=he?.bytes("symbols")!==void 0,ye=fe&&he.bytes("graph")!==void 0,at=fe&&!ye&&z.commit!==q.commit?he.graph():void 0;if(ye)q.cacheDirty||!Kd(Oe?.meta.extraction,te)?st(z):ge(z),F.stderr.write(`codeindex: ${q.files.length} files \u2192 ${x}/graph.json + symbols.json${q.capped?" (capped)":""} (unchanged \u2014 artifacts reused) -`);else if(at){let ne=Vr(at);En(L,ne),st({graphSha1:Re(ne),symbolsSha1:z.symbolsSha1,embed:z.embed}),F.stderr.write(`codeindex: ${q.files.length} files \u2192 ${x}/graph.json + symbols.json${q.capped?" (capped)":""} (unchanged at a new commit \u2014 graph.json restamped, symbols.json reused) -`)}else{let{graph:ne,symbols:V,notes:Z}=jn(q);for(let Se of Z??[])F.stderr.write(`codeindex: note: ${Se} -`);let B=Vr(ne),K=Ya(V);En(L,B),En(G,K);let se="",Ne;if(N){let Se=Zr(q,N,{previous:is(X)}),Zt=go(Se);En(X,Zt),Ne={embedVersion:Jt,modelId:N.modelId,sha1:Re(Zt)},se=` + embeddings.bin (${Se.records.length} records, model ${N.modelId})`}st({graphSha1:Re(B),symbolsSha1:Re(K),embed:Ne}),F.stderr.write(`codeindex: ${q.files.length} files \u2192 ${x}/graph.json + symbols.json${se}${q.capped?" (capped)":""} -`);for(let Se of[...new Set(cn(q).warnings)].sort())F.stderr.write(`codeindex: warning: ${Se} -`)}}else if(n==="scan"){if(s.why!==void 0&&s.skipped)throw new Error("scan takes --why or --skipped, not both");if(s.why!==void 0)we(JSON.stringify(qd(s.repo,s.why,Xt(s)),null,2)+` -`,s.out);else{let x=[],w=Ti(s.repo,{...Xt(s),onSkip:E=>x.push(E)});if(w.fileCount===0&&qo(s),s.skipped)we(JSON.stringify(x.sort(Sr(E=>E.rel)),null,2)+` -`,s.out);else{let E={engineVersion:Ie,commit:w.commit,fileCount:w.fileCount,languages:w.languages,capped:w.capped,excluded:w.excluded,skipped:Wa(x)};we(JSON.stringify(E,null,2)+` -`,s.out)}}}else if(n==="status"){let x=Wi(s.repo,{...Xt(s),ast:!s.noAst},f);we(JSON.stringify(x,null,2)+` -`,s.out),s.check&&!x.artifactsFresh&&(F.exitCode=1)}else if(n==="graph")we(await M("graph")??Vr(await C()),s.out);else if(n==="symbols")we(await M("symbols")??Ya((await R()).symbols),s.out);else if(n==="scip"){let x=await S(),w=cf(x,{projectRoot:s.projectRoot}),E=s.out??le("index.scip");E==="-"?F.stdout.write(W.from(w)):(En(E,w),F.stderr.write(`codeindex: SCIP index \u2192 ${E} (${w.length} bytes) -`))}else if(n==="callers"){if(s.lsp&&!s.positional)throw new Error("callers --lsp requires a symbol: callers --lsp");if(s.raw&&(s.lsp||s.recall))throw new Error("callers --raw lists call sites before any binding: it takes neither --lsp nor --recall");if(s.raw&&s.withCaller)throw new Error("callers --raw already names each site's enclosing symbol: it takes no --with-caller");let x=await S(),w=s.positional;if(s.raw)if(w){let E=hl(x,w),N=hr(x,E.name,{calls:!0});we(JSON.stringify(N?{...E,coverage:N}:E,null,2)+` -`,s.out)}else{let E={};for(let[N,O]of Ou(x))E[N]=O;we(JSON.stringify(E,null,2)+` -`,s.out)}else if(w){let E=py(x,gy(w),{recall:s.recall}),N=ul(E,w),L=(N&&s.withCaller?so(x,N):N)??yl(x,w,E);if(!L){let ue=mr(x,w).length;throw new Error(`no symbol named "${w}" in the index`+(ue?` (${ue} call site(s) use the name; \`callers --raw ${w}\` lists them)`:"")+sc(x,w))}let G=Nt(x,w)?.reading,X=s.lsp?await Ks(x,s.repo,G?el(G):w,L,{trustRepoConfig:s.trustLspConfig}):L,oe=hr(x,G?.name??w,{calls:!0});we(JSON.stringify(oe?{...X,coverage:oe}:X,null,2)+` -`,s.out)}else{let E=Gr(x,void 0,{recall:s.recall}),N={};for(let[O,L]of E)N[O]=s.withCaller?so(x,L):L;we(JSON.stringify(N,null,2)+` -`,s.out)}}else if(n==="hierarchy"){let x=await S(),w=Ps(x);if(s.positional){let E=or(w,s.positional,Nt(x,s.positional)?.defs);if(!E)throw new Error(`no type named ${s.positional}`);we(JSON.stringify(E,null,2)+` -`,s.out)}else{let E={};for(let[N,O]of w)E[N]=O;we(JSON.stringify(E,null,2)+` -`,s.out)}}else if(n==="implementations"){if(!s.positional)throw new Error("implementations needs a type name: cli.mjs implementations --repo ");let x=await S(),w=Ps(x),E=Nt(x,s.positional)?.defs;if(!or(w,s.positional,E))throw new Error(`no type named ${s.positional}`);we(JSON.stringify({name:s.positional,implementations:qi(w,s.positional,E)},null,2)+` -`,s.out)}else if(n==="callgraph"){if(!s.positional)throw new Error("callgraph needs a symbol: cli.mjs callgraph --repo ");let x=await S(),w=Ls(x),E=Ji(w,s.positional,{...s.depth!==void 0?{depth:s.depth}:{},...s.direction?{direction:s.direction}:{}});if(!E.root.length)throw new Error(`no symbol named ${s.positional}`);we(JSON.stringify(E,null,2)+` -`,s.out)}else if(n==="find"||n==="refs"||n==="outline"){if(!s.positional){let E={find:"find ",refs:"refs ",outline:"outline "}[n];throw new Error(`${n} needs an argument: cli.mjs ${E} --repo `)}if(s.lsp&&n!=="refs")throw new Error("--lsp applies to `callers ` and `refs ` only");let x=await S(),w;if(n==="find"){if(w=wn(x,s.positional,{substring:s.substring,includeBody:s.includeBody,concise:s.concise,maxResults:s.limit}),Array.isArray(w)&&!w.length){let E=rc(x,s.positional.replace(/@.*$/,"").replace(/^.*[#/]/,""));E.length&&F.stderr.write(`codeindex: not indexed for size but naming it: ${E.map(N=>`${N.file} (${N.size} bytes)`).join(", ")}; re-index with --max-bytes ${Math.max(...E.map(N=>N.size))} -`)}}else if(n==="refs"){let E=io(x,s.positional),N=Nt(x,s.positional)?.reading.name??s.positional,O=s.lsp?await Co(x,s.repo,N,E,{trustRepoConfig:s.trustLspConfig}):E,L=s.concise?ic(O):O,G=hr(x,N,{calls:!0});w=G?{...L,coverage:G}:L}else{let E=new Set(x.files.map(L=>L.rel)),N=rs(s.repo,s.positional,L=>E.has(L));if(N===void 0)throw new Error(ss(x,s.repo,s.positional)??`no such file in the index: ${s.positional}`);let O=ro(x,N);w=s.concise?O.map(L=>yr(L,L.name)):O}we(JSON.stringify(w,null,2)+` -`,s.out)}else if(n==="callpath"){let[x,w]=s.positionals;if(!x||!w)throw new Error("callpath needs two arguments: cli.mjs callpath --repo (--files: two file paths)");if(s.includeInferred&&!s.files)throw new Error("--include-inferred applies to `impact` and `callpath --files` only");let E={depth:s.depth,maxPaths:s.limit},N;if(s.files){let{graph:O}=await R(),L=new Set(O.files.map(oe=>oe.rel)),[G,X]=[x,w].map(oe=>{let ue=rs(s.repo,oe,ve=>L.has(ve));if(ue===void 0)throw new Error(`no such file in the index: ${oe}`);return ue});N=sl(O,G,X,{...E,includeInferred:s.includeInferred})}else{let O=tl(Ls(await S()),x,w,E);if(!O.from.length)throw new Error(`no symbol named ${x}`);if(!O.to.length)throw new Error(`no symbol named ${w}`);N=O}we(JSON.stringify(N,null,2)+` -`,s.out)}else if(n==="symbol-at"){let x=s.positional?/^(.+?):(\d+)(?::\d+)?$/.exec(s.positional):null;if(!x||Number(x[2])<1)throw new Error("symbol-at needs : cli.mjs symbol-at src/a.ts:42 --repo ");let w=await S(),E=new Set(w.files.map(O=>O.rel)),N=rs(s.repo,x[1],O=>E.has(O));if(N===void 0)throw new Error(ss(w,s.repo,x[1])??`no such file in the index: ${x[1]}`);we(JSON.stringify(gl(w,N,Number(x[2])),null,2)+` -`,s.out)}else if(n==="search"){if(!s.positional)throw new Error('search needs a query: cli.mjs search "" --repo ');let x=await S(),w={limit:s.limit,fuzzy:s.fuzzy,...s.exact?{exact:!0}:{},...s.rank?{rank:s.rank}:{}},E=({results:O,explain:L})=>{we(JSON.stringify(s.explain?{results:O,explain:L}:O,null,2)+` +${Ic}`),F.exitCode=2;return}let o=r.indexOf("--");if((o===-1?r:r.slice(0,o)).some(x=>x==="--help"||x==="-h")){F.stdout.write(D$(n));return}let s=j$(r);if(L$(n,s),(n==="index"||n==="embed"&&s.positional==="build")&&s.out==="-")throw new Error(`${n==="index"?"index":"embed build"} writes files: --out needs a directory, not "-"`);if(!Q(s.repo))throw new Error(`--repo path does not exist: ${s.repo}`);if(!$e(s.repo).isDirectory())throw new Error(`--repo path is not a directory: ${s.repo}`);W$(s);let a=(!B$.has(n)||n==="workspaces"&&s.check===!0)&&!(n==="embed"&&s.positional!=="build"),l=()=>tt(s.repo,Dr(s.repo,nn(s))),c;a&&!s.noAst&&!U$.has(n)&&n!=="delta"&&(c=l());let d=!1,u=async()=>{d||s.noAst||!c||(await fn(Vt(c.files.map(x=>x.ext))),d=!0)},f=s.indexDir??Ye,m=!1,p,g,h=!1,_=x=>(x.files.length===0&&!h&&(h=!0,Qo(s)),x),y=async()=>{if(p)return p;if(m)return g;if(m=!0,!s.noIndexCache)return p=Ya(s.repo,{...nn(s,c),workers:s.workers,ast:!s.noAst},u,f).then(x=>{if(x)g={scan:_(x.scan),arts:x.arts,loadArtifacts:x.loadArtifacts,artifacts:x.artifacts};else if(s.indexDir!==void 0){let w=Gi(s.repo,f),E=z$["unusable"in w?w.unusable:"unreadable"];F.stderr.write(`codeindex: no usable index at ${Kt(s.repo,f)} (${E}) \u2014 building from scratch +`)}return g}),p},b,S=async()=>{let x=(await y())?.scan;return x||(b??=u().then(()=>kn(s.repo,{...nn(s,c),workers:s.workers}).then(_)))},k,C=async()=>{let x=await y();return x?.arts?x.arts:x?x.arts??=x.loadArtifacts?.()??Un(x.scan,nn(s,c)):k??=S().then(w=>Un(w,nn(s,c)))},I=!1,P,v=()=>{if(!I){I=!0;let x=s.noIndexCache?void 0:Ch(s.repo,{...nn(s,c),ast:!s.noAst},f);x?.fileCount===0&&!h&&(h=!0,Qo(s)),P=x?.artifacts}return P},R=async()=>{let x=v()?.graph();if(x)return x;let w=await y();return w?.arts?.graph??w?.artifacts?.graph()??(await C()).graph},M=async x=>v()?.bytes(x)??(await y())?.artifacts?.bytes(x);if(n==="index"){if(!s.out)throw new Error("index needs --out ");let x=s.out;rn(x,{recursive:!0});let w=j(x,"cache.json");await u();let E=zn(s.repo),{model:N,error:O}=es(E);O&&F.stderr.write(`codeindex: ${O} \u2014 embeddings.bin skipped; re-run \`codeindex embed pull\` +`);let L=j(x,"graph.json"),H=j(x,"symbols.json"),X=j(x,"embeddings.bin"),le=re=>{try{return Ae(oe(re))}catch{return}},me=re=>!N||re!==void 0&&re.embedVersion===en&&re.modelId===N.modelId&&re.sha1!==void 0&&le(X)===re.sha1,Ee=s.noIndexCache||s.fullHash?void 0:H$(s.repo,{...nn(s,c),out:x},s.maxCalls,x,me);if(Ee){Ee.files===0&&Qo(s),F.stderr.write(`codeindex: ${Ee.files} files \u2192 ${x}/graph.json + symbols.json${Ee.capped?" (capped)":""} (unchanged \u2014 artifacts reused) +`);return}let je=s.noIndexCache?void 0:Hi(s.repo,x),U=je?.meta??{},B=je&&Wi(je.cacheMap,je.meta.extraction,{maxCallsPerFile:s.maxCalls,ast:Ue}),G=await kn(s.repo,{...nn(s,c),cache:B,out:x,workers:s.workers}),te=tu(G.files,s.maxCalls,Ue);G.files.length===0&&Qo(s);let ie=j(x,au),ve=re=>{let ye;try{ye=$e(w)}catch{return}let we=Rh(G,re,te,{size:ye.size,mtimeMs:ye.mtimeMs}),K;try{K=oe(ie,"utf8")}catch{K=void 0}K!==we&&Mn(ie,we)},Je=re=>{let ye=Object.create(null);for(let we of G.files){let K={hash:we.hash,record:we,size:we.size},ae=G.mtimes.get(we.rel);ae!==void 0&&(K.mtimeMs=ae),ye[we.rel]=K}Mn(w,JSON.stringify({schemaVersion:5,extractorVersion:18,engineVersion:Ne,commit:G.commit,graphSha1:re.graphSha1,symbolsSha1:re.symbolsSha1,embed:re.embed,extraction:te,files:ye})+` +`),ve(re)},be=me(U.embed)?jr(s.repo,G,U,x):void 0,pe=be?.bytes("symbols")!==void 0,ue=pe&&be.bytes("graph")!==void 0,mt=pe&&!ue&&U.commit!==G.commit?be.graph():void 0;if(ue)G.cacheDirty||!nu(je?.meta.extraction,te)?Je(U):ve(U),F.stderr.write(`codeindex: ${G.files.length} files \u2192 ${x}/graph.json + symbols.json${G.capped?" (capped)":""} (unchanged \u2014 artifacts reused) +`);else if(mt){let re=Yr(mt);Mn(L,re),Je({graphSha1:Ae(re),symbolsSha1:U.symbolsSha1,embed:U.embed}),F.stderr.write(`codeindex: ${G.files.length} files \u2192 ${x}/graph.json + symbols.json${G.capped?" (capped)":""} (unchanged at a new commit \u2014 graph.json restamped, symbols.json reused) +`)}else{let{graph:re,symbols:ye,notes:we}=Un(G);for(let Y of we??[])F.stderr.write(`codeindex: note: ${Y} +`);let K=Yr(re),ae=il(ye);Mn(L,K),Mn(H,ae);let Fe="",q;if(N){let Y=ns(G,N,{previous:ds(X)}),J=So(Y);Mn(X,J),q={embedVersion:en,modelId:N.modelId,sha1:Ae(J)},Fe=` + embeddings.bin (${Y.records.length} records, model ${N.modelId})`}Je({graphSha1:Ae(K),symbolsSha1:Ae(ae),embed:q}),F.stderr.write(`codeindex: ${G.files.length} files \u2192 ${x}/graph.json + symbols.json${Fe}${G.capped?" (capped)":""} +`);for(let Y of[...new Set(pn(G).warnings)].sort())F.stderr.write(`codeindex: warning: ${Y} +`)}}else if(n==="scan"){if(s.why!==void 0&&s.skipped)throw new Error("scan takes --why or --skipped, not both");if(s.why!==void 0)Se(JSON.stringify(Qd(s.repo,s.why,nn(s)),null,2)+` +`,s.out);else{let x=[],w=Di(s.repo,{...nn(s),onSkip:E=>x.push(E)});if(w.fileCount===0&&Qo(s),s.skipped)Se(JSON.stringify(x.sort(Cr(E=>E.rel)),null,2)+` +`,s.out);else{let E={engineVersion:Ne,commit:w.commit,fileCount:w.fileCount,languages:w.languages,capped:w.capped,excluded:w.excluded,skipped:Va(x)};Se(JSON.stringify(E,null,2)+` +`,s.out)}}}else if(n==="status"){let x=qi(s.repo,{...nn(s),ast:!s.noAst},f);Se(JSON.stringify(x,null,2)+` +`,s.out),s.check&&!x.artifactsFresh&&(F.exitCode=1)}else if(n==="graph")Se(await M("graph")??Yr(await R()),s.out);else if(n==="symbols")Se(await M("symbols")??il((await C()).symbols),s.out);else if(n==="scip"){let x=await S(),w=hf(x,{projectRoot:s.projectRoot}),E=s.out??ce("index.scip");E==="-"?F.stdout.write(W.from(w)):(Mn(E,w),F.stderr.write(`codeindex: SCIP index \u2192 ${E} (${w.length} bytes) +`))}else if(n==="callers"){if(s.lsp&&!s.positional)throw new Error("callers --lsp requires a symbol: callers --lsp");if(s.raw&&(s.lsp||s.recall))throw new Error("callers --raw lists call sites before any binding: it takes neither --lsp nor --recall");if(s.raw&&s.withCaller)throw new Error("callers --raw already names each site's enclosing symbol: it takes no --with-caller");let x=await S(),w=s.positional;if(s.raw)if(w){let E=kl(x,w),N=xr(x,E.name,{calls:!0});Se(JSON.stringify(N?{...E,coverage:N}:E,null,2)+` +`,s.out)}else{let E={};for(let[N,O]of Bu(x))E[N]=O;Se(JSON.stringify(E,null,2)+` +`,s.out)}else if(w){let E=Ey(x,vy(w),{recall:s.recall}),N=_l(E,w),L=(N&&s.withCaller?fo(x,N):N)??El(x,w,E);if(!L){let me=_r(x,w).length;throw new Error(`no symbol named "${w}" in the index`+(me?` (${me} call site(s) use the name; \`callers --raw ${w}\` lists them)`:"")+uc(x,w))}let H=Ut(x,w)?.reading,X=s.lsp?await ti(x,s.repo,H?al(H):w,L,{trustRepoConfig:s.trustLspConfig}):L,le=xr(x,H?.name??w,{calls:!0});Se(JSON.stringify(le?{...X,coverage:le}:X,null,2)+` +`,s.out)}else{let E=Xr(x,void 0,{recall:s.recall}),N={};for(let[O,L]of E)N[O]=s.withCaller?fo(x,L):L;Se(JSON.stringify(N,null,2)+` +`,s.out)}}else if(n==="hierarchy"){let x=await S(),w=Us(x);if(s.positional){let E=ur(w,s.positional,Ut(x,s.positional)?.defs);if(!E)throw new Error(`no type named ${s.positional}`);Se(JSON.stringify(E,null,2)+` +`,s.out)}else{let E={};for(let[N,O]of w)E[N]=O;Se(JSON.stringify(E,null,2)+` +`,s.out)}}else if(n==="implementations"){if(!s.positional)throw new Error("implementations needs a type name: cli.mjs implementations --repo ");let x=await S(),w=Us(x),E=Ut(x,s.positional)?.defs;if(!ur(w,s.positional,E))throw new Error(`no type named ${s.positional}`);Se(JSON.stringify({name:s.positional,implementations:Yi(w,s.positional,E)},null,2)+` +`,s.out)}else if(n==="callgraph"){if(!s.positional)throw new Error("callgraph needs a symbol: cli.mjs callgraph --repo ");let x=await S(),w=zs(x),E=eo(w,s.positional,{...s.depth!==void 0?{depth:s.depth}:{},...s.direction?{direction:s.direction}:{}});if(!E.root.length)throw new Error(`no symbol named ${s.positional}`);Se(JSON.stringify(E,null,2)+` +`,s.out)}else if(n==="find"||n==="refs"||n==="outline"){if(!s.positional){let E={find:"find ",refs:"refs ",outline:"outline "}[n];throw new Error(`${n} needs an argument: cli.mjs ${E} --repo `)}if(s.lsp&&n!=="refs")throw new Error("--lsp applies to `callers ` and `refs ` only");let x=await S(),w;if(n==="find"){if(w=En(x,s.positional,{substring:s.substring,includeBody:s.includeBody,concise:s.concise,maxResults:s.limit}),Array.isArray(w)&&!w.length){let E=dc(x,s.positional.replace(/@.*$/,"").replace(/^.*[#/]/,""));E.length&&F.stderr.write(`codeindex: not indexed for size but naming it: ${E.map(N=>`${N.file} (${N.size} bytes)`).join(", ")}; re-index with --max-bytes ${Math.max(...E.map(N=>N.size))} +`)}}else if(n==="refs"){let E=mo(x,s.positional),N=Ut(x,s.positional)?.reading.name??s.positional,O=s.lsp?await Oo(x,s.repo,N,E,{trustRepoConfig:s.trustLspConfig}):E,L=s.concise?fc(O):O,H=xr(x,N,{calls:!0});w=H?{...L,coverage:H}:L}else{let E=new Set(x.files.map(L=>L.rel)),N=ls(s.repo,s.positional,L=>E.has(L));if(N===void 0)throw new Error(cs(x,s.repo,s.positional)??`no such file in the index: ${s.positional}`);let O=uo(x,N);w=s.concise?O.map(L=>Sr(L,L.name)):O}Se(JSON.stringify(w,null,2)+` +`,s.out)}else if(n==="callpath"){let[x,w]=s.positionals;if(!x||!w)throw new Error("callpath needs two arguments: cli.mjs callpath --repo (--files: two file paths)");if(s.includeInferred&&!s.files)throw new Error("--include-inferred applies to `impact` and `callpath --files` only");let E={depth:s.depth,maxPaths:s.limit},N;if(s.files){let{graph:O}=await C(),L=new Set(O.files.map(le=>le.rel)),[H,X]=[x,w].map(le=>{let me=ls(s.repo,le,Ee=>L.has(Ee));if(me===void 0)throw new Error(`no such file in the index: ${le}`);return me});N=ul(O,H,X,{...E,includeInferred:s.includeInferred})}else{let O=ll(zs(await S()),x,w,E);if(!O.from.length)throw new Error(`no symbol named ${x}`);if(!O.to.length)throw new Error(`no symbol named ${w}`);N=O}Se(JSON.stringify(N,null,2)+` +`,s.out)}else if(n==="symbol-at"){let x=s.positional?/^(.+?):(\d+)(?::\d+)?$/.exec(s.positional):null;if(!x||Number(x[2])<1)throw new Error("symbol-at needs : cli.mjs symbol-at src/a.ts:42 --repo ");let w=await S(),E=new Set(w.files.map(O=>O.rel)),N=ls(s.repo,x[1],O=>E.has(O));if(N===void 0)throw new Error(cs(w,s.repo,x[1])??`no such file in the index: ${x[1]}`);Se(JSON.stringify(Sl(w,N,Number(x[2])),null,2)+` +`,s.out)}else if(n==="search"){if(!s.positional)throw new Error('search needs a query: cli.mjs search "" --repo ');let x=await S(),w={limit:s.limit,fuzzy:s.fuzzy,...s.exact?{exact:!0}:{},...s.rank?{rank:s.rank}:{}},E=({results:O,explain:L})=>{Se(JSON.stringify(s.explain?{results:O,explain:L}:O,null,2)+` `,s.out),L.note&&F.stderr.write(`codeindex: ${L.note} -`)},N=()=>E(Gt(x,s.positional,w));if(s.semantic){let O=gr();if(O){let L;try{let G=Q(j(zt(s.repo,f),"cache.json"))?j(zt(s.repo,f),"embed-cache",`endpoint-${Re($l(O)).slice(0,12)}.bin`):void 0,X=G?await _f():void 0,oe=G?is(G):void 0,ue=await _o(x,{previous:oe,modelId:X});G&&!A_(oe,ue)&&Sb(G,go(ue));let ve=await yo(s.positional);L=pr(x,s.positional,ue,{...w,queryVec:ve})}catch(G){F.stderr.write(`codeindex: embedding endpoint ${O} unavailable (${G instanceof Error?G.message:G}) \u2014 returning lexical results -`)}L?E(L):N()}else{let{model:L,error:G}=Kr(Wn(s.repo));if(!L)F.stderr.write(G?`codeindex: semantic search unavailable (${G}) \u2014 returning lexical results; re-run \`codeindex embed pull\` to replace the model -`:"codeindex: semantic search unavailable (no embedding model or endpoint) \u2014 returning lexical results; run `codeindex embed pull` or set CODEINDEX_EMBED_ENDPOINT to enable it\n"),N();else{let X=is(j(zt(s.repo,f),"embeddings.bin")),oe=Zr(x,L,{previous:X});E(pr(x,s.positional,oe,{...w,model:L}))}}}else N()}else if(n==="embed"){let x=s.positional,w=Wn(s.repo);if(x==="status"){let{model:E,error:N}=Kr(w),O=gr(),G={embedVersion:Jt,mode:O?"endpoint":E?"static":"none",model:E?{present:!0,dir:w,modelId:E.modelId,dim:E.dim,vocabSize:E.vocabSize}:N?{present:!0,dir:w,error:N}:{present:!1},endpoint:O??null};O&&(G.endpointReachable=await ho(O)),we(JSON.stringify(G,null,2)+` -`,s.out)}else if(x==="serve"){let E=["run","-d","-p","8756:8756","ghcr.io/maxgfr/codeindex-embed:latest"],N=`docker ${E.join(" ")}`;if(!Qt("docker")){F.stderr.write(`codeindex: docker not found on PATH. Install Docker, then run: +`)},N=()=>E(Zt(x,s.positional,w));if(s.semantic){let O=wr();if(O){let L;try{let H=Q(j(Kt(s.repo,f),"cache.json"))?j(Kt(s.repo,f),"embed-cache",`endpoint-${Ae(Dl(O)).slice(0,12)}.bin`):void 0,X=H?await vf():void 0,le=H?ds(H):void 0,me=await vo(x,{previous:le,modelId:X});H&&!D_(le,me)&&$b(H,So(me));let Ee=await Eo(s.positional);L=br(x,s.positional,me,{...w,queryVec:Ee})}catch(H){F.stderr.write(`codeindex: embedding endpoint ${O} unavailable (${H instanceof Error?H.message:H}) \u2014 returning lexical results +`)}L?E(L):N()}else{let{model:L,error:H}=es(zn(s.repo));if(!L)F.stderr.write(H?`codeindex: semantic search unavailable (${H}) \u2014 returning lexical results; re-run \`codeindex embed pull\` to replace the model +`:"codeindex: semantic search unavailable (no embedding model or endpoint) \u2014 returning lexical results; run `codeindex embed pull` or set CODEINDEX_EMBED_ENDPOINT to enable it\n"),N();else{let X=ds(j(Kt(s.repo,f),"embeddings.bin")),le=ns(x,L,{previous:X});E(br(x,s.positional,le,{...w,model:L}))}}}else N()}else if(n==="embed"){let x=s.positional,w=zn(s.repo);if(x==="status"){let{model:E,error:N}=es(w),O=wr(),H={embedVersion:en,mode:O?"endpoint":E?"static":"none",model:E?{present:!0,dir:w,modelId:E.modelId,dim:E.dim,vocabSize:E.vocabSize}:N?{present:!0,dir:w,error:N}:{present:!1},endpoint:O??null};O&&(H.endpointReachable=await ko(O)),Se(JSON.stringify(H,null,2)+` +`,s.out)}else if(x==="serve"){let E=["run","-d","-p","8756:8756","ghcr.io/maxgfr/codeindex-embed:latest"],N=`docker ${E.join(" ")}`;if(!sn("docker")){F.stderr.write(`codeindex: docker not found on PATH. Install Docker, then run: `+N+` `),F.exitCode=1;return}if(s.run){F.stderr.write(`codeindex: starting embedding server \u2192 ${N} -`);let O=$e("docker",E);if(O.stdout.trim()&&F.stdout.write(O.stdout.trim()+` +`);let O=Pe("docker",E);if(O.stdout.trim()&&F.stdout.write(O.stdout.trim()+` `),!O.ok){F.stderr.write(O.stderr||`codeindex: docker run failed `),F.exitCode=1;return}F.stderr.write(`codeindex: server starting on http://localhost:8756 \u2014 then: CODEINDEX_EMBED_ENDPOINT=http://localhost:8756 codeindex search "" --repo . --semantic `)}else F.stdout.write(N+` -`),F.stderr.write('codeindex: run the line above to start the embedding server (or `embed serve --run`), then:\n CODEINDEX_EMBED_ENDPOINT=http://localhost:8756 codeindex search "" --repo . --semantic\n')}else if(x==="build"){if(!s.out)throw new Error("embed build needs --out ");if(!w){F.stderr.write("codeindex: no embedding model present \u2014 run `codeindex embed pull` first (nothing written)\n"),F.exitCode=1;return}let E=Hs(w);Yt(s.out,{recursive:!0});let N=await S(),O=Zr(N,E,{previous:is(j(s.out,"embeddings.bin"))});En(j(s.out,"embeddings.bin"),go(O)),F.stderr.write(`codeindex: ${O.records.length} embedding records \u2192 ${s.out}/embeddings.bin (model ${E.modelId}) -`)}else if(x==="pull"){let{url:E,sha256:N}=mf(),O=F.env.CODEINDEX_EMBED_DIR??j(s.repo,".codeindex","models");Yt(O,{recursive:!0}),F.stderr.write(`codeindex: fetching model from ${E} \u2192 ${j(O,"model.json")} -`);let L;try{L=await k_(E,N)}catch(G){F.stderr.write(`codeindex: pull failed \u2014 ${G instanceof Error?G.message:String(G)} (nothing written) -`),F.exitCode=1;return}try{ff(JSON.parse(L),E)}catch(G){F.stderr.write(`codeindex: pull failed \u2014 response is not a valid model.json (${G instanceof Error?G.message:String(G)}) (nothing written) -`),F.exitCode=1;return}En(j(O,"model.json"),L),F.stderr.write(`codeindex: model written to ${j(O,"model.json")} -`)}else throw new Error("embed needs a subcommand: status | build | pull | serve")}else if(n==="lsp"){if(s.positional!=="status")throw new Error("lsp needs a subcommand: status");we(JSON.stringify(await Ro(await S(),s.repo,s.probe===!0,{trustRepoConfig:s.trustLspConfig}),null,2)+` -`,s.out)}else if(n==="grammars"){let x=s.positional,w=xs();if(x==="status"){let E=Wt(),N=ve=>E.dirs.some(Oe=>Q(j(Oe,ve))),O=N("web-tree-sitter.wasm"),L=Va(),G=ve=>[...ve].filter(Oe=>N(`${Oe}.wasm`)).sort(),X=G(vi),oe=G(ws),ue={engineVersion:Ie,tier:E.tier,dir:E.dir??null,dirs:E.dirs,cacheDir:w,runtimePresent:O,pullNeeded:!O,extendedPullNeeded:oe.length!X.includes(ve)).sort()},extended:{resolved:oe.length,of:ws.size,missing:[...ws].filter(ve=>!oe.includes(ve)).sort()},url:L.url};we(JSON.stringify(ue,null,2)+` -`,s.out)}else if(x==="pull"){let E=await Bi(w,{onNote:N=>F.stderr.write(N)});F.stderr.write(E.message),E.ok||(F.exitCode=1)}else throw new Error("grammars needs a subcommand: status | pull")}else if(n==="rules"){if(!s.config)throw new Error("rules needs --config ");let x=[le(s.config),le(s.repo,s.config)].find(L=>Q(L))??le(s.config),w=ql(ie(x,"utf8"),x),{scan:E,graph:N}=await R(),O=Jl(Mo(N,w,{scan:E}));we(JSON.stringify(O,null,2)+` -`,s.out),O.errors>0&&(F.exitCode=1)}else if(n==="workspaces"){let x=Pn(s.repo),w=s.check?xl(x,(await R()).graph):void 0;we(JSON.stringify(Sl(x,w),null,2)+` -`,s.out),w&&!w.ok&&(F.exitCode=1)}else if(n==="churn"){let x=tn(s.repo,{since:s.since}),w=Hd(s.repo,Xt(s)),E=w&&(O=>w({rel:O,abs:j(s.repo,O),directory:!1})),N={};for(let O of[...x.churn.keys()].sort())(!E||E(O))&&(N[O]=x.churn.get(O));we(JSON.stringify({ok:x.ok,...hn(x),churn:N},null,2)+` -`,s.out)}else if(n==="repomap"){let x=await C();we(Qr(await S(),x,{budgetTokens:s.budgetTokens}),s.out)}else if(n==="hotspots"){let x=await S(),w=tn(s.repo,{since:s.since}),E=es(x,w.churn,s.limit);we(JSON.stringify({churnOk:w.ok,...hn(w),hotspots:E},null,2)+` -`,s.out)}else if(n==="coupling"){let{graph:x}=await R(),w=wo(s.repo,{since:s.since,graph:x,hidden:s.hidden,minTogether:s.minTogether,maxCommitFiles:s.maxCommitFiles,maxPairs:s.limit});we(JSON.stringify({ok:w.ok,...hn(w),couplings:w.couplings},null,2)+` -`,s.out)}else if(n==="deadcode"){let x=Io(await S(),{kinds:s.kinds,includeTail:s.includeTail});we(JSON.stringify(Xl(x,s.limit),null,2)+` -`,s.out)}else if(n==="literals"){let x=Dn(await S(),{minFiles:s.minFiles,minCount:s.minCount,includeTests:s.includeTests});we(JSON.stringify(x,null,2)+` -`,s.out)}else if(n==="complexity"){let x=await S(),w=s.positional;if(w!==void 0){let E=new Set(x.files.map(O=>O.rel)),N=Un(s.repo,w).find(O=>E.has(O));if(N===void 0)throw new Error(ss(x,s.repo,w)??`no such file in the index: ${w}`);w=N}we(JSON.stringify(eo(x,w,s.limit),null,2)+` -`,s.out)}else if(n==="risk"){let x=await S(),w=tn(s.repo,{since:s.since}),E=to(x,w.churn,s.limit);we(JSON.stringify({churnOk:w.ok,...hn(w),risks:E},null,2)+` -`,s.out)}else if(n==="delta"){let x={base:s.base,staged:s.staged,depth:s.depth,indexDir:f},w=Xs(s.repo,x);if("error"in w)throw new Error(w.error);let E=To(w,s.depth);if(w.files.length){s.noAst||(c=l());let{scan:N,graph:O,symbols:L}=await R();E=Zs(w,O,L,{...x,scan:N})}we(s.json?JSON.stringify(E,null,2)+` -`:Fo(E),s.out),s.failOn&&E.modules.some(N=>Hb(N.bucket)>=Hb(s.failOn))&&(F.exitCode=1)}else if(n==="impact"){if(!s.positional)throw new Error("impact needs a target: cli.mjs impact --repo ");let x=await C(),w;for(let E of Un(s.repo,s.positional))if(w=Xi(x,E,s.depth??1/0,{includeInferred:s.includeInferred}),w)break;if(!w)throw new Error(`no such file or module in the index: ${s.positional}`);we(JSON.stringify(w,null,2)+` -`,s.out)}else if(n==="neighbors"){if(!s.positional)throw new Error("neighbors needs a target: cli.mjs neighbors --repo ");let x=await C(),w=s.kind?new Set(s.kind.split(",")):void 0,E;for(let N of Un(s.repo,s.positional))if(E=Zi(x,N,s.depth??1,w),E)break;if(!E)throw new Error(`no such file or module in the index: ${s.positional}`);we(JSON.stringify(E,null,2)+` -`,s.out)}else if(n==="resolution"){let x=tc(await S(),{lang:s.lang,limit:s.limit});we(JSON.stringify(x,null,2)+` -`,s.out)}else if(n==="mermaid")we($o(await C(),{module:s.positional}),s.out);else if(n==="grep"){if(!s.positional)throw new Error("grep needs a pattern: cli.mjs grep --repo ");let x=zs(s.repo,s.positional,{globs:s.include.length||s.exclude.length?[...s.include,...s.exclude.map(w=>`!${w}`)]:void 0,scope:s.scope,ignoreCase:s.ignoreCase,maxHits:s.maxHits,filesWithMatches:s.filesWithMatches,gitignore:s.gitignore,ignoreDirs:s.ignoreDirs.length?s.ignoreDirs:void 0,maxFileBytes:s.maxBytes,timeoutMs:s.timeoutMs});we(JSON.stringify(x.hits,null,2)+` +`),F.stderr.write('codeindex: run the line above to start the embedding server (or `embed serve --run`), then:\n CODEINDEX_EMBED_ENDPOINT=http://localhost:8756 codeindex search "" --repo . --semantic\n')}else if(x==="build"){if(!s.out)throw new Error("embed build needs --out ");if(!w){F.stderr.write("codeindex: no embedding model present \u2014 run `codeindex embed pull` first (nothing written)\n"),F.exitCode=1;return}let E=Xs(w);rn(s.out,{recursive:!0});let N=await S(),O=ns(N,E,{previous:ds(j(s.out,"embeddings.bin"))});Mn(j(s.out,"embeddings.bin"),So(O)),F.stderr.write(`codeindex: ${O.records.length} embedding records \u2192 ${s.out}/embeddings.bin (model ${E.modelId}) +`)}else if(x==="pull"){let{url:E,sha256:N}=wf(),O=F.env.CODEINDEX_EMBED_DIR??j(s.repo,".codeindex","models");rn(O,{recursive:!0}),F.stderr.write(`codeindex: fetching model from ${E} \u2192 ${j(O,"model.json")} +`);let L;try{L=await T_(E,N)}catch(H){F.stderr.write(`codeindex: pull failed \u2014 ${H instanceof Error?H.message:String(H)} (nothing written) +`),F.exitCode=1;return}try{bf(JSON.parse(L),E)}catch(H){F.stderr.write(`codeindex: pull failed \u2014 response is not a valid model.json (${H instanceof Error?H.message:String(H)}) (nothing written) +`),F.exitCode=1;return}Mn(j(O,"model.json"),L),F.stderr.write(`codeindex: model written to ${j(O,"model.json")} +`)}else throw new Error("embed needs a subcommand: status | build | pull | serve")}else if(n==="lsp"){if(s.positional!=="status")throw new Error("lsp needs a subcommand: status");Se(JSON.stringify(await Fo(await S(),s.repo,s.probe===!0,{trustRepoConfig:s.trustLspConfig}),null,2)+` +`,s.out)}else if(n==="grammars"){let x=s.positional,w=Cs();if(x==="status"){let E=qt(),N=Ee=>E.dirs.some(je=>Q(j(je,Ee))),O=N("web-tree-sitter.wasm"),L=el(),H=Ee=>[...Ee].filter(je=>N(`${je}.wasm`)).sort(),X=H($i),le=H(Rs),me={engineVersion:Ne,tier:E.tier,dir:E.dir??null,dirs:E.dirs,cacheDir:w,runtimePresent:O,pullNeeded:!O,extendedPullNeeded:le.length!X.includes(Ee)).sort()},extended:{resolved:le.length,of:Rs.size,missing:[...Rs].filter(Ee=>!le.includes(Ee)).sort()},url:L.url};Se(JSON.stringify(me,null,2)+` +`,s.out)}else if(x==="pull"){let E=await Vi(w,{onNote:N=>F.stderr.write(N)});F.stderr.write(E.message),E.ok||(F.exitCode=1)}else throw new Error("grammars needs a subcommand: status | pull")}else if(n==="rules"){if(!s.config)throw new Error("rules needs --config ");let x=[ce(s.config),ce(s.repo,s.config)].find(L=>Q(L))??ce(s.config),w=Ql(oe(x,"utf8"),x),{scan:E,graph:N}=await C(),O=tc(No(N,w,{scan:E}));Se(JSON.stringify(O,null,2)+` +`,s.out),O.errors>0&&(F.exitCode=1)}else if(n==="workspaces"){let x=jn(s.repo),w=s.check?Ml(x,(await C()).graph):void 0;Se(JSON.stringify(Al(x,w),null,2)+` +`,s.out),w&&!w.ok&&(F.exitCode=1)}else if(n==="churn"){let x=an(s.repo,{since:s.since}),w=Zd(s.repo,nn(s)),E=w&&(O=>w({rel:O,abs:j(s.repo,O),directory:!1})),N={};for(let O of[...x.churn.keys()].sort())(!E||E(O))&&(N[O]=x.churn.get(O));Se(JSON.stringify({ok:x.ok,...wn(x),churn:N},null,2)+` +`,s.out)}else if(n==="repomap"){let x=await R();Se(ss(await S(),x,{budgetTokens:s.budgetTokens}),s.out)}else if(n==="hotspots"){let x=await S(),w=an(s.repo,{since:s.since}),E=is(x,w.churn,s.limit);Se(JSON.stringify({churnOk:w.ok,...wn(w),hotspots:E},null,2)+` +`,s.out)}else if(n==="coupling"){let{graph:x}=await C(),w=Co(s.repo,{since:s.since,graph:x,hidden:s.hidden,minTogether:s.minTogether,maxCommitFiles:s.maxCommitFiles,maxPairs:s.limit});Se(JSON.stringify({ok:w.ok,...wn(w),couplings:w.couplings},null,2)+` +`,s.out)}else if(n==="deadcode"){let x=Lo(await S(),{kinds:s.kinds,includeTail:s.includeTail});Se(JSON.stringify(rc(x,s.limit),null,2)+` +`,s.out)}else if(n==="literals"){let x=Bn(await S(),{minFiles:s.minFiles,minCount:s.minCount,includeTests:s.includeTests});Se(JSON.stringify(x,null,2)+` +`,s.out)}else if(n==="complexity"){let x=await S(),w=s.positional;if(w!==void 0){let E=new Set(x.files.map(O=>O.rel)),N=Gn(s.repo,w).find(O=>E.has(O));if(N===void 0)throw new Error(cs(x,s.repo,w)??`no such file in the index: ${w}`);w=N}Se(JSON.stringify(oo(x,w,s.limit),null,2)+` +`,s.out)}else if(n==="risk"){let x=await S(),w=an(s.repo,{since:s.since}),E=ao(x,w.churn,s.limit);Se(JSON.stringify({churnOk:w.ok,...wn(w),risks:E},null,2)+` +`,s.out)}else if(n==="delta"){let x={base:s.base,staged:s.staged,depth:s.depth,indexDir:f},w=ni(s.repo,x);if("error"in w)throw new Error(w.error);let E=jo(w,s.depth);if(w.files.length){s.noAst||(c=l());let{scan:N,graph:O,symbols:L}=await C();E=ri(w,O,L,{...x,scan:N})}Se(s.json?JSON.stringify(E,null,2)+` +`:Wo(E),s.out),s.failOn&&E.modules.some(N=>Qb(N.bucket)>=Qb(s.failOn))&&(F.exitCode=1)}else if(n==="impact"){if(!s.positional)throw new Error("impact needs a target: cli.mjs impact --repo ");let x=await R(),w;for(let E of Gn(s.repo,s.positional))if(w=no(x,E,s.depth??1/0,{includeInferred:s.includeInferred}),w)break;if(!w)throw new Error(`no such file or module in the index: ${s.positional}`);Se(JSON.stringify(w,null,2)+` +`,s.out)}else if(n==="neighbors"){if(!s.positional)throw new Error("neighbors needs a target: cli.mjs neighbors --repo ");let x=await R(),w=s.kind?new Set(s.kind.split(",")):void 0,E;for(let N of Gn(s.repo,s.positional))if(E=ro(x,N,s.depth??1,w),E)break;if(!E)throw new Error(`no such file or module in the index: ${s.positional}`);Se(JSON.stringify(E,null,2)+` +`,s.out)}else if(n==="resolution"){let x=lc(await S(),{lang:s.lang,limit:s.limit});Se(JSON.stringify(x,null,2)+` +`,s.out)}else if(n==="mermaid")Se(Do(await R(),{module:s.positional}),s.out);else if(n==="grep"){if(!s.positional)throw new Error("grep needs a pattern: cli.mjs grep --repo ");let x=Ks(s.repo,s.positional,{globs:s.include.length||s.exclude.length?[...s.include,...s.exclude.map(w=>`!${w}`)]:void 0,scope:s.scope,ignoreCase:s.ignoreCase,maxHits:s.maxHits,filesWithMatches:s.filesWithMatches,gitignore:s.gitignore,ignoreDirs:s.ignoreDirs.length?s.ignoreDirs:void 0,maxFileBytes:s.maxBytes,timeoutMs:s.timeoutMs});Se(JSON.stringify(x.hits,null,2)+` `,s.out);for(let w of x.notes)F.stderr.write(`codeindex grep: ${w} `)}else F.stderr.write(`unknown command: ${n} -${kc}`),F.exitCode=2}ai();ke();$();ke();pt();var rm="/grammars",sm="web-tree-sitter.wasm";function Gb(e){Vb(sm,e)}function qb(e,t){Vb(`${e}.wasm`,t)}function Vb(e,t){Ko(`${rm}/${e}`,t),F.env.CODEINDEX_GRAMMAR_DIR=rm}function Jb(e){return`${e}.wasm`}async function L$(e,t){let n=Bt(e);if(!n.length)return{tier:"regex",loaded:[],failed:[],note:"no language here ships a tree-sitter grammar"};try{Gb(await t(sm))}catch(s){return{tier:"regex",loaded:[],failed:[...n],note:`tree-sitter runtime unavailable (${s.message})`}}await Promise.all(n.map(async s=>{try{qb(s,await t(Jb(s)))}catch{}})),await an(n);let r=n.filter(s=>De(s)).sort(),o=n.filter(s=>!De(s)).sort();return{tier:r.length?"ast":"regex",loaded:r,failed:o,note:o.length?`${o.join(", ")} could not load; those languages use the regex tier`:""}}export{ra as BINARY_EXT,vi as CORE_GRAMMARS,Ql as DEFAULT_DELTA_DEPTH,au as DEFAULT_GRAMMARS_URL,Fw as DEFAULT_MAX_FILES,Jt as EMBED_VERSION,Ie as ENGINE_VERSION,ws as EXTENDED_GRAMMARS,fn as EXTRACTOR_VERSION,Ri as EXT_GRAMMAR,rm as GRAMMARS_DIR,Cn as IGNORE_DIRS,Ve as INDEX_DIR,na as LOCKFILES,Js as LspSessionPool,Bl as LspTimeout,td as MARKDOWN_EXT,q_ as MAX_FRAME_BYTES,$c as OffsetMap,kn as RISK_WEIGHTS,sm as RUNTIME_WASM,ut as SCHEMA_VERSION,ko as agreementOf,Ma as allGrammarKeys,Iu as applyCentrality,v_ as basicTokenize,iy as betweennessOf,mb as brokenImports,jn as buildArtifactsFromScan,Gr as buildCallerIndex,Da as buildCodeRecord,Zr as buildEmbeddingIndex,_o as buildEndpointIndex,Bu as buildGraph,sA as buildIndexArtifacts,uu as buildModules,Ou as buildRawCallerIndex,zi as buildResolveContext,xu as buildSymbolGraph,mu as buildSymbolIndex,gu as buildTypeHierarchy,Sr as byKey,T as byStr,Ks as callersWithLsp,Tv as categorize,wo as changeCoupling,Hw as changedSince,Mo as checkRules,mt as classify,lw as clip,cw as clipInline,Dl as columnOfSymbol,BC as communityOf,It as compileGlobs,$u as complexityOfSource,pb as computeDelta,ER as computeImportPairs,kl as computeSurprises,fu as computeSymbolRefs,Yi as computeTestMap,kf as createFramer,ta as decidingRule,Zu as deleteMemory,GI as deltaFor,Zs as deltaOfDiff,yf as deserializeEmbeddings,rf as detectCommunities,Pn as detectWorkspaces,Dc as diffFiles,jc as diffHunks,$l as embedEndpointUrl,Tl as embedViaEndpoint,Ml as embeddingUnits,To as emptyDelta,vR as enclosingSymbol,mo as encode,Wl as encodeMessage,yo as encodeQueryViaEndpoint,_f as endpointModelId,an as ensureGrammars,wt as escapeRegExp,Gt as explainQuery,pr as explainSemantic,rn as extToLang,Fd as extractAst,$i as extractCode,vh as extractGrammarsTarball,fh as extractInParallel,sd as extractMarkdown,ld as extractRst,Qc as extractSymbols,Ov as extractTags,Eh as extractTarInto,kh as fetchExpectedSha256,xh as fetchGrammarsTarball,ns as fileUri,Io as findDeadCode,Dn as findLiteralDuplications,io as findReferences,wn as findSymbol,Jn as foldText,Fo as formatDeltaPanel,tn as gitChurn,Ir as grammarKeyForExt,Bt as grammarKeysForExts,De as grammarReady,Jb as grammarWasmName,_A as grepRepo,zs as grepRepoEx,xA as hasEmbedModel,rw as hasFileBytes,Qt as have,en as headCommit,$_ as healthzUrl,qh as hubThreshold,Xi as impactOf,qi as implementationsOf,Wi as indexStatus,qu as insertAfterSymbol,Vu as insertBeforeSymbol,pf as intDot,Tp as isCode,$p as isDoc,Pc as isGitWorktree,oi as isIgnored,rM as isSurprising,Za as isTestFile,Ft as isTestPath,Gd as keptCodeFiles,us as keywords,ed as languageOf,Yu as listMemories,Hs as loadEmbedModel,L$ as loadGrammars,So as loadLspConfig,Vs as locationsToRefs,Ro as lspStatus,ts as lspUnavailable,hm as mountFiles,qb as mountGrammar,Gb as mountRuntime,Ji as neighborhood,Zi as neighborsOf,bf as onboardBrief,Rf as openLspSession,Hr as pagerankOf,ms as parseGitignore,j_ as parseLspConfig,Vl as parseRules,ph as preloadArtifacts,Qd as preloadSession,ho as probeEndpoint,sw as pruneUnfetched,Bi as pullGrammars,Gs as quantize,es as rankHotspots,dw as rankedKeywords,Xs as readDeltaDiff,Xu as readMemory,Di as readPersistedIndex,re as readText,ps as readTextEx,Co as referencesWithLsp,Ef as relFromUri,Vr as renderGraphJson,$o as renderMermaid,jI as renderMermaidClustered,Qr as renderRepoMap,cf as renderScip,Ya as renderSymbolsJson,Gu as replaceSymbolBody,nw as resetVfs,iw as residentBytes,Lc as resolveBaseRef,ju as resolveCallEdges,sr as resolveDocLink,gr as resolveEmbedEndpoint,Wn as resolveEmbedModelDir,mf as resolveEmbedPullUrl,_k as resolveGrammarsDir,Va as resolveGrammarsPullTarget,Wt as resolveGrammarsTier,ct as resolveImport,qs as resolveLspConfigPath,pu as resolveRelationEdges,ir as resolveRelations,By as resolveUniqueSymbol,Ki as reverseClosure,Bb as rewriteCommand,to as riskHotspots,M_ as roundHalfToEven,Mc as rrf,P$ as runCli,pv as runExtractWorker,Nb as runMcpServer,Rt as scanRepo,bn as scanRepoParallel,ah as scanSkips,Ti as scanSummary,cR as searchIndex,IA as searchSemantic,go as serializeEmbeddings,Sf as serverForLang,Ko as setFileBytes,$e as sh,Re as sha1,xs as sharedGrammarsCacheDir,Yw as shortHash,Wa as skipHistogram,si as slugify,Cf as spawnLspTransport,gn as subtokens,eo as symbolComplexity,ht as symbolId,fb as symbolsInHunks,ro as symbolsOverview,Fv as tagsQueryStatus,B0 as testsForModule,Cs as tierForPath,Ct as toCacheMap,C_ as tokenize,or as typeEntry,Fu as uniqueSymbolDefs,Cl as unitHash,U0 as untestedModules,ia as untrackedFiles,Xe as walk,Dv as warmGrammars,qd as whyPath,R_ as wordpiece,uh as workerCount,ao as writeMemory}; +${Ic}`),F.exitCode=2}mi();Re();$();Re();wt();var dm="/grammars",um="web-tree-sitter.wasm";function ew(e){nw(um,e)}function tw(e,t){nw(`${e}.wasm`,t)}function nw(e,t){na(`${dm}/${e}`,t),F.env.CODEINDEX_GRAMMAR_DIR=dm}function rw(e){return`${e}.wasm`}async function K$(e,t){let n=Vt(e);if(!n.length)return{tier:"regex",loaded:[],failed:[],note:"no language here ships a tree-sitter grammar"};try{ew(await t(um))}catch(s){return{tier:"regex",loaded:[],failed:[...n],note:`tree-sitter runtime unavailable (${s.message})`}}await Promise.all(n.map(async s=>{try{tw(s,await t(rw(s)))}catch{}})),await fn(n);let r=n.filter(s=>Ue(s)).sort(),o=n.filter(s=>!Ue(s)).sort();return{tier:r.length?"ast":"regex",loaded:r,failed:o,note:o.length?`${o.join(", ")} could not load; those languages use the regex tier`:""}}export{da as BINARY_EXT,$i as CORE_GRAMMARS,oc as DEFAULT_DELTA_DEPTH,pu as DEFAULT_GRAMMARS_URL,zw as DEFAULT_MAX_FILES,en as EMBED_VERSION,Ne as ENGINE_VERSION,Rs as EXTENDED_GRAMMARS,hn as EXTRACTOR_VERSION,Ti as EXT_GRAMMAR,dm as GRAMMARS_DIR,In as IGNORE_DIRS,Ye as INDEX_DIR,ca as LOCKFILES,ei as LspSessionPool,Jl as LspTimeout,ld as MARKDOWN_EXT,tb as MAX_FRAME_BYTES,Dc as OffsetMap,Cn as RISK_WEIGHTS,um as RUNTIME_WASM,yt as SCHEMA_VERSION,Io as agreementOf,Na as allGrammarKeys,Lu as applyCentrality,O_ as basicTokenize,gy as betweennessOf,Sb as brokenImports,Un as buildArtifactsFromScan,Xr as buildCallerIndex,Ga as buildCodeRecord,ns as buildEmbeddingIndex,vo as buildEndpointIndex,Ju as buildGraph,hA as buildIndexArtifacts,_u as buildModules,Bu as buildRawCallerIndex,Ki as buildResolveContext,Mu as buildSymbolGraph,wu as buildSymbolIndex,Su as buildTypeHierarchy,Cr as byKey,T as byStr,ti as callersWithLsp,Uv as categorize,Co as changeCoupling,ex as changedSince,No as checkRules,bt as classify,_w as clip,bw as clipInline,Gl as columnOfSymbol,QC as communityOf,Lt as compileGlobs,Du as complexityOfSource,kb as computeDelta,OR as computeImportPairs,Il as computeSurprises,bu as computeSymbolRefs,so as computeTestMap,If as createFramer,la as decidingRule,sf as deleteMemory,r$ as deltaFor,ri as deltaOfDiff,Ef as deserializeEmbeddings,uf as detectCommunities,jn as detectWorkspaces,Gc as diffFiles,qc as diffHunks,Dl as embedEndpointUrl,jl as embedViaEndpoint,Nl as embeddingUnits,jo as emptyDelta,NR as enclosingSymbol,wo as encode,Vl as encodeMessage,Eo as encodeQueryViaEndpoint,vf as endpointModelId,fn as ensureGrammars,Ct as escapeRegExp,Zt as explainQuery,br as explainSemantic,cn as extToLang,Wd as extractAst,Li as extractCode,Nh as extractGrammarsTarball,Sh as extractInParallel,ud as extractMarkdown,gd as extractRst,od as extractSymbols,Hv as extractTags,Oh as extractTarInto,Fh as fetchExpectedSha256,$h as fetchGrammarsTarball,as as fileUri,Lo as findDeadCode,Bn as findLiteralDuplications,mo as findReferences,En as findSymbol,Qn as foldText,Wo as formatDeltaPanel,an as gitChurn,Nr as grammarKeyForExt,Vt as grammarKeysForExts,Ue as grammarReady,rw as grammarWasmName,IA as grepRepo,Ks as grepRepoEx,FA as hasEmbedModel,mw as hasFileBytes,sn as have,on as headCommit,W_ as healthzUrl,ny as hubThreshold,no as impactOf,Yi as implementationsOf,qi as indexStatus,Qu as insertAfterSymbol,ef as insertBeforeSymbol,xf as intDot,Up as isCode,Bp as isDoc,zc as isGitWorktree,fi as isIgnored,gM as isSurprising,sl as isTestFile,Wt as isTestPath,Yd as keptCodeFiles,_s as keywords,ad as languageOf,of as listMemories,Xs as loadEmbedModel,K$ as loadGrammars,Ao as loadLspConfig,Qs as locationsToRefs,Fo as lspStatus,os as lspUnavailable,Rm as mountFiles,tw as mountGrammar,ew as mountRuntime,eo as neighborhood,ro as neighborsOf,Rf as onboardBrief,Ff as openLspSession,Kr as pagerankOf,bs as parseGitignore,J_ as parseLspConfig,ec as parseRules,Eh as preloadArtifacts,ou as preloadSession,ko as probeEndpoint,pw as pruneUnfetched,Vi as pullGrammars,Zs as quantize,is as rankHotspots,ww as rankedKeywords,ni as readDeltaDiff,rf as readMemory,Hi as readPersistedIndex,se as readText,ws as readTextEx,Oo as referencesWithLsp,$f as relFromUri,Yr as renderGraphJson,Do as renderMermaid,ZI as renderMermaidClustered,ss as renderRepoMap,hf as renderScip,il as renderSymbolsJson,Yu as replaceSymbolBody,fw as resetVfs,gw as residentBytes,Hc as resolveBaseRef,qu as resolveCallEdges,cr as resolveDocLink,wr as resolveEmbedEndpoint,zn as resolveEmbedModelDir,wf as resolveEmbedPullUrl,Mk as resolveGrammarsDir,el as resolveGrammarsPullTarget,qt as resolveGrammarsTier,gt as resolveImport,Ys as resolveLspConfigPath,xu as resolveRelationEdges,dr as resolveRelations,Xy as resolveUniqueSymbol,to as reverseClosure,Xb as rewriteCommand,ao as riskHotspots,L_ as roundHalfToEven,Nc as rrf,J$ as runCli,Ev as runExtractWorker,Hb as runMcpServer,Tt as scanRepo,kn as scanRepoParallel,yh as scanSkips,Di as scanSummary,bR as searchIndex,UA as searchSemantic,So as serializeEmbeddings,Af as serverForLang,na as setFileBytes,Pe as sh,Ae as sha1,Cs as sharedGrammarsCacheDir,lx as shortHash,Va as skipHistogram,di as slugify,Of as spawnLspTransport,bn as subtokens,oo as symbolComplexity,kt as symbolId,xb as symbolsInHunks,uo as symbolsOverview,zv as tagsQueryStatus,Z0 as testsForModule,Fs as tierForPath,Ft as toCacheMap,P_ as tokenize,ur as typeEntry,Wu as uniqueSymbolDefs,Ol as unitHash,Y0 as untestedModules,fa as untrackedFiles,tt as walk,Jv as warmGrammars,Qd as whyPath,N_ as wordpiece,xh as workerCount,go as writeMemory}; diff --git a/scripts/engine.d.mts b/scripts/engine.d.mts index a1ec1af..d681b0c 100644 --- a/scripts/engine.d.mts +++ b/scripts/engine.d.mts @@ -1,6 +1,6 @@ declare const ENGINE_VERSION = "2.31.8"; declare const SCHEMA_VERSION = 5; -declare const EXTRACTOR_VERSION = 17; +declare const EXTRACTOR_VERSION = 18; type FileKind = "code" | "doc" | "config" | "asset" | "other"; type EdgeKind = "contains" | "doc-link" | "import" | "call" | "extends" | "implements" | "use" | "mention"; type Tier = 0 | 1 | 2; diff --git a/scripts/engine.mjs b/scripts/engine.mjs index 027bbd5..15f4ee9 100755 --- a/scripts/engine.mjs +++ b/scripts/engine.mjs @@ -21,7 +21,7 @@ var init_types = __esm({ "use strict"; ENGINE_VERSION = "2.31.8"; SCHEMA_VERSION = 5; - EXTRACTOR_VERSION = 17; + EXTRACTOR_VERSION = 18; } }); @@ -8119,7 +8119,12 @@ function readName(node) { function readReceiver(node) { if (!node || node.namedChildren.length === 0) return void 0; const obj = node.childForFieldName("object") ?? node.childForFieldName("operand") ?? node.childForFieldName("value") ?? node.childForFieldName("path") ?? node.childForFieldName("expression") ?? node.childForFieldName("argument") ?? node.childForFieldName("receiver") ?? node.childForFieldName("table"); - if (obj && (obj.type === "crate" || obj.type === "super")) return obj.type; + if (obj?.type === "super" || obj?.type === "crate" && node.type === "scoped_identifier") return obj.type; + if (obj?.type === "composite_literal") { + const type = obj.childForFieldName("type"); + const name3 = type ? readTypeName(type) : void 0; + return name3 && /^[A-Za-z_]\w*$/.test(name3) ? name3 : void 0; + } const name2 = obj ? readName(obj) : void 0; return name2 && /^[A-Za-z_]\w*$/.test(name2) ? name2 : void 0; } @@ -15543,8 +15548,38 @@ function createCallBinder(scan2, pairs, opts = {}) { if (files) (rustModules ??= /* @__PURE__ */ new Map()).set(q, files); } inlineMods = f.symbols.filter((s) => s.kind === "mod" && s.endLine !== void 0 && s.endLine > s.line); - if (inlineMods.length) (rustModules ??= /* @__PURE__ */ new Map()).set(INLINE_SUPER, [f.rel]); } + const modScope = (line2) => { + let best = 0; + for (const m of inlineMods ?? []) if (line2 > m.line && line2 <= m.endLine && m.line > best) best = m.line; + return best; + }; + const baseOf = (cls) => f.relations?.find((r) => r.kind === "extends" && r.from === cls)?.to; + const classAround = (e) => { + if (e === void 0) return void 0; + if (e.parent !== void 0 && baseOf(e.parent) !== void 0) return e.parent; + let best; + for (const s of f.symbols) { + if (s.endLine === void 0 || s.line > e.line || e.line > s.endLine || baseOf(s.name) === void 0) continue; + if (!best || s.line > best.line) best = s; + } + return best?.name ?? e.parent; + }; + let usedPaths; + const variantInScope = (d) => { + if (d.file !== f.rel || d.parent === void 0) return false; + if (!usedPaths) { + usedPaths = /* @__PURE__ */ new Set(); + for (const r of f.refs) { + if (r.kind !== "import") continue; + const segs = r.spec.split("::"); + usedPaths.add(segs[segs.length - 1]); + if (segs.length > 1) usedPaths.add(`${segs[segs.length - 2]}::${segs[segs.length - 1]}`); + } + } + if (PRELUDE_VARIANTS.has(d.name)) return usedPaths.has(`${d.parent}::${d.name}`); + return usedPaths.has(d.parent) || usedPaths.has(`${d.parent}::${d.name}`); + }; const corroborated = (name2, pool) => { const out2 = scope.reached(exportedGroup(name2, family, pool), f, name2); const priv = hiddenGroup(name2, family, pool); @@ -15571,11 +15606,17 @@ function createCallBinder(scan2, pairs, opts = {}) { const read = (c2, enclosing) => { let receiver = c2.receiver; if (receiver === void 0) return BARE; - if (receiver === "super" && inlineMods?.some((m) => c2.line > m.line && c2.line <= m.endLine)) receiver = INLINE_SUPER; + if (family === "rust" && receiver === "super") { + const block = modScope(c2.line); + if (block) { + receiver = `${INLINE_SUPER}${modScope(block)}`; + if (!rustModules?.has(receiver)) (rustModules ??= /* @__PURE__ */ new Map()).set(receiver, [f.rel]); + } + } let r = byReceiver.get(receiver); if (r) return r; const self = (t) => reading("self", receiver, t, t); - if (!SELF_NAMES.has(receiver)) { + if (!SELF_NAMES.has(receiver) && !(receiver === "super" && family !== "rust")) { if (rustModules?.has(receiver)) r = reading("module", receiver); else if (aliases.modules.has(receiver)) r = reading("module", receiver); else if (ownTypes.has(receiver)) r = self(receiver); @@ -15602,6 +15643,11 @@ function createCallBinder(scan2, pairs, opts = {}) { }; const readInScope = (receiver, e, self) => { if (SELF_NAMES.has(receiver)) return self(e?.parent); + if (receiver === "super") { + const cls = classAround(e); + const base = cls !== void 0 ? baseOf(cls) : void 0; + return base !== void 0 && ownTypes.has(base) ? self(base) : reading("foreign", receiver, void 0, base); + } if (family === "go" && goReceiverVar(e) === receiver) return self(e.parent); const d = e?.signature ? declaredType(e.signature, receiver) : void 0; if (d?.qualifier !== void 0 && !recall && aliases.modules.get(d.qualifier) === null) return OUTSIDE; @@ -15613,13 +15659,26 @@ function createCallBinder(scan2, pairs, opts = {}) { const resolve13 = (name2, how) => { const { shape, receiver, selfType, typeHint } = how; if (shape === "outside") return null; + const bareRust = family === "rust" && shape === "bare"; + const scopeLine = receiver?.startsWith(INLINE_SUPER) ? Number(receiver.slice(INLINE_SUPER.length)) : void 0; + const reachable = (d) => !(bareRust && d.kind === "enum-member" && !variantInScope(d)) && !(scopeLine !== void 0 && (d.file !== f.rel || modScope(d.line) !== scopeLine)); let local; if (recall) local = ownAny.get(name2); else if (shape === "bare") local = shaped ? ownFree.get(name2) : ownAny.get(name2); else if (shape === "self") { local = selfType !== void 0 ? memberOf(selfType, name2) : void 0; + if (receiver === "super") { + for (let t = selfType, hops = 0; !local && t !== void 0 && hops < MAX_BASE_HOPS; hops++) { + t = baseOf(t); + if (t !== void 0 && ownTypes.has(t)) local = memberOf(t, name2); + else break; + } + } if (!local && receiver !== void 0 && SELF_NAMES.has(receiver)) local = ownMember.get(name2); } + if (local && !reachable(local)) { + local = f.symbols.find((s) => s.name === name2 && !REFERENCE_KINDS3.has(s.kind) && !NOT_CALLABLE.has(s.kind) && reachable(s)); + } if (local) return only && !only.has(local.name) ? null : { hit: { def: local, corroborated: true }, local: true }; let restrict; let callee = name2; @@ -15635,24 +15694,27 @@ function createCallBinder(scan2, pairs, opts = {}) { if (restrict === null) { if (!recall) return null; } else { - const hits = scope.within(exportedGroup(callee, family, pool), restrict, callee); + let hits = scope.within(exportedGroup(callee, family, pool), restrict, callee); if (hiddenReach === "import" || viaPath) { for (const d of scope.within(hiddenGroup(callee, family, pool), restrict, callee)) if (!hits.includes(d)) hits.push(d); } + if (family === "rust") hits = hits.filter(reachable); const chosen2 = pickCandidate(f.rel, hits); if (chosen2) return { hit: { def: chosen2, corroborated: true }, local: false }; if (hits.length) return null; if (!recall && STRICT.has(family)) return null; } } - const stated = preferParent(corroborated(callee, pool), typeHint, receiver); + const reached = corroborated(callee, pool); + const stated = preferParent(family === "rust" ? reached.filter(reachable) : reached, typeHint, receiver); if (stated.length) { const chosen2 = pickCandidate(f.rel, stated); return chosen2 ? { hit: { def: chosen2, corroborated: true }, local: false } : null; } const group = exportedGroup(callee, family, recall ? "any" : guessPool); if (!group) return null; - const cands = defsOutside(group, f.rel); + const outside = defsOutside(group, f.rel); + const cands = family === "rust" ? outside.filter(reachable) : outside; if (!cands.length) return null; let guesses = [...cands]; if (recall) { @@ -15676,7 +15738,7 @@ function createCallBinder(scan2, pairs, opts = {}) { }; return { forFile }; } -var REFERENCE_KINDS3, STRICT, SHAPED, PACKAGE_DIR, PRIVATE_REACH, NOT_CALLABLE, INLINE_SUPER, SELF_NAMES, FUNCTION_KINDS2, MAX_HOPS, NO_ALIASES, dirOf3, isGoTest, declaredRe, aliasMemo, newTables; +var REFERENCE_KINDS3, STRICT, SHAPED, PACKAGE_DIR, PRIVATE_REACH, NOT_CALLABLE, INLINE_SUPER, MAX_BASE_HOPS, PRELUDE_VARIANTS, SELF_NAMES, FUNCTION_KINDS2, MAX_HOPS, NO_ALIASES, dirOf3, isGoTest, declaredRe, aliasMemo, newTables; var init_bind = __esm({ "src/bind.ts"() { "use strict"; @@ -15693,7 +15755,9 @@ var init_bind = __esm({ PACKAGE_DIR = /* @__PURE__ */ new Set(["go", "java"]); PRIVATE_REACH = { go: "package", java: "package", python: "import", rust: "path" }; NOT_CALLABLE = /* @__PURE__ */ new Set(["mod", "module", "package", "namespace"]); - INLINE_SUPER = "super\0inline"; + INLINE_SUPER = "super\0inline\0"; + MAX_BASE_HOPS = 8; + PRELUDE_VARIANTS = /* @__PURE__ */ new Set(["Ok", "Err", "Some", "None"]); SELF_NAMES = /* @__PURE__ */ new Set(["self", "cls", "this", "Self"]); FUNCTION_KINDS2 = /* @__PURE__ */ new Set(["function", "method", "def", "constructor", "operator"]); MAX_HOPS = 3; diff --git a/src/ast/node.ts b/src/ast/node.ts index a4087b0..9a1785e 100644 --- a/src/ast/node.ts +++ b/src/ast/node.ts @@ -181,9 +181,19 @@ export function readReceiver(node: TSNode | null): string | undefined { node.childForFieldName("argument") ?? node.childForFieldName("receiver") ?? node.childForFieldName("table"); - // Rust's `crate::f()` and `super::f()` name a module by keyword, a leaf - // readName does not take for a name; the binder resolves both to a file. - if (obj && (obj.type === "crate" || obj.type === "super")) return obj.type; + // `super` and Rust's `crate` are keywords, leaves readName does not take for + // a name. Rust's `crate::f()`/`super::f()` name a module the binder resolves + // to a file; JS/TS/Java's `super.f()` the enclosing class's base, which the + // binder reads off the file's `extends` relations. + if (obj?.type === "super" || (obj?.type === "crate" && node.type === "scoped_identifier")) return obj.type; + // A method called on a composite literal (Go's `addrs.Check{…}.Absolute()`) + // is called on the literal's type; the literal's last child is its body, + // whose last identifier is any field value at all. + if (obj?.type === "composite_literal") { + const type = obj.childForFieldName("type"); + const name = type ? readTypeName(type) : undefined; + return name && /^[A-Za-z_]\w*$/.test(name) ? name : undefined; + } const name = obj ? readName(obj) : undefined; return name && /^[A-Za-z_]\w*$/.test(name) ? name : undefined; } diff --git a/src/bind.ts b/src/bind.ts index c7ecc6d..68cb132 100644 --- a/src/bind.ts +++ b/src/bind.ts @@ -70,8 +70,16 @@ const PRIVATE_REACH: Record = { go: "pack const NOT_CALLABLE = new Set(["mod", "module", "package", "namespace"]); // The receiver a Rust `super::` takes inside an inline `mod { … }` block, where -// it names the enclosing file rather than its parent module. -const INLINE_SUPER = "super\u0000inline"; +// it names a scope of the enclosing file rather than its parent module; the +// scope's declaration line follows (0: the file's top level). +const INLINE_SUPER = "super\u0000inline\u0000"; + +// How far `super.f()` climbs the bases a file declares looking for `f`. +const MAX_BASE_HOPS = 8; + +// The Rust prelude's variant names: a bare call to one is std's unless the +// file imports a local enum's variant by name. +const PRELUDE_VARIANTS = new Set(["Ok", "Err", "Some", "None"]); // Receivers that name the enclosing object. JS/TS/Java `this` and Rust `self` // never get here (the extractor reads no receiver from them); PHP's `$this` @@ -645,8 +653,9 @@ export function createCallBinder(scan: RepoScan, pairs: Set, opts: CallB const aliases = scope.aliases(f); // `crate` and `super` as this Rust file's path qualifiers, where they name a file. let rustModules: Map | undefined; - // The file's inline `mod name { … }` blocks: inside one, `super::` is the - // file itself (`#[cfg(test)] mod tests` calling `super::parse`). + // The file's inline `mod name { … }` blocks: inside one, `super::` names + // the scope that block sits in — the file's top level for `#[cfg(test)] + // mod tests` calling `super::parse`, the outer block for a nested one. let inlineMods: CodeSymbol[] | undefined; if (family === "rust") { for (const q of ["crate", "super"]) { @@ -654,8 +663,49 @@ export function createCallBinder(scan: RepoScan, pairs: Set, opts: CallB if (files) (rustModules ??= new Map()).set(q, files); } inlineMods = f.symbols.filter((s) => s.kind === "mod" && s.endLine !== undefined && s.endLine > s.line); - if (inlineMods.length) (rustModules ??= new Map()).set(INLINE_SUPER, [f.rel]); } + // The innermost inline mod holding `line`, as its declaration line (0: the top level). + const modScope = (line: number): number => { + let best = 0; + for (const m of inlineMods ?? []) if (line > m.line && line <= m.endLine! && m.line > best) best = m.line; + return best; + }; + // A JS/TS/Java/Python class's base, as its `extends` relation names it. + const baseOf = (cls: string): string | undefined => f.relations?.find((r) => r.kind === "extends" && r.from === cls)?.to; + // The class a declaration sits in, for its `super`: its parent when that + // states a base, else the innermost class spanning it that does — a + // `var x = () => super.f()` in a constructor has the constructor for parent. + const classAround = (e: CodeSymbol | undefined): string | undefined => { + if (e === undefined) return undefined; + if (e.parent !== undefined && baseOf(e.parent) !== undefined) return e.parent; + let best: CodeSymbol | undefined; + for (const s of f.symbols) { + if (s.endLine === undefined || s.line > e.line || e.line > s.endLine || baseOf(s.name) === undefined) continue; + if (!best || s.line > best.line) best = s; + } + return best?.name ?? e.parent; + }; + // What this Rust file's `use` declarations name, as `E` and `E::V`: inside + // an enum's own file, `use self::E::*` (its spec reads "self::E") or + // `use self::E::V` brings the variants into scope for a bare call. + let usedPaths: Set | undefined; + const variantInScope = (d: CodeSymbol): boolean => { + if (d.file !== f.rel || d.parent === undefined) return false; + if (!usedPaths) { + usedPaths = new Set(); + for (const r of f.refs) { + if (r.kind !== "import") continue; + const segs = r.spec.split("::"); + usedPaths.add(segs[segs.length - 1]!); + if (segs.length > 1) usedPaths.add(`${segs[segs.length - 2]}::${segs[segs.length - 1]}`); + } + } + // A `use` carries no scope here, so the prelude's names are the variant + // only when imported by name: a glob in one fn must not turn the file's + // every std `Ok(…)` into `E::Ok`. + if (PRELUDE_VARIANTS.has(d.name)) return usedPaths.has(`${d.parent}::${d.name}`); + return usedPaths.has(d.parent) || usedPaths.has(`${d.parent}::${d.name}`); + }; // Cross-file defs of `name` this file reaches by stated evidence. const corroborated = (name: string, pool: Pool): CodeSymbol[] => { @@ -706,11 +756,19 @@ export function createCallBinder(scan: RepoScan, pairs: Set, opts: CallB const read = (c: CallSite, enclosing: CodeSymbol | undefined): Reading => { let receiver = c.receiver; if (receiver === undefined) return BARE; - if (receiver === "super" && inlineMods?.some((m) => c.line > m.line && c.line <= m.endLine!)) receiver = INLINE_SUPER; + if (family === "rust" && receiver === "super") { + const block = modScope(c.line); + if (block) { + // The scope the call's block sits in, one reading per such scope. + receiver = `${INLINE_SUPER}${modScope(block)}`; + if (!rustModules?.has(receiver)) (rustModules ??= new Map()).set(receiver, [f.rel]); + } + } let r = byReceiver.get(receiver); if (r) return r; const self = (t: string | undefined): Reading => reading("self", receiver, t, t); - if (!SELF_NAMES.has(receiver)) { + // Outside Rust, `super` depends on the enclosing class: read in scope. + if (!SELF_NAMES.has(receiver) && !(receiver === "super" && family !== "rust")) { if (rustModules?.has(receiver)) r = reading("module", receiver); else if (aliases.modules.has(receiver)) r = reading("module", receiver); else if (ownTypes.has(receiver)) r = self(receiver); // `Greeter.make()` next to Greeter @@ -739,6 +797,14 @@ export function createCallBinder(scan: RepoScan, pairs: Set, opts: CallB // The part of `read` that depends on the enclosing declaration `e`. const readInScope = (receiver: string, e: CodeSymbol | undefined, self: (t: string | undefined) => Reading): Reading => { if (SELF_NAMES.has(receiver)) return self(e?.parent); + // `super.f()` (Python's `super().f()`): a member of the enclosing class's + // base — never the override it is called from. A base this file declares + // is read like `self`; one declared elsewhere names the type to prefer. + if (receiver === "super") { + const cls = classAround(e); + const base = cls !== undefined ? baseOf(cls) : undefined; + return base !== undefined && ownTypes.has(base) ? self(base) : reading("foreign", receiver, undefined, base); + } // The enclosing header states the receiver's type: Go's method receiver // (`func (c *Context) …`), a parameter (`c *Context`, `app: Flask`). if (family === "go" && goReceiverVar(e) === receiver) return self(e!.parent); @@ -754,6 +820,17 @@ export function createCallBinder(scan: RepoScan, pairs: Set, opts: CallB const resolve = (name: string, how: Reading): Resolved | null => { const { shape, receiver, selfType, typeHint } = how; if (shape === "outside") return null; + // Rust: a tuple variant is reached through its enum (`ParseResult::Ok(…)`, + // whose receiver names the enum), bare only where its own file imports + // the variants (variantInScope) — elsewhere a bare `Ok(…)`/`Some(…)` is + // the prelude's. And `super::` inside an inline `mod tests { … }` names + // the file's own items, never those of the block it sits in (a test + // helper `fn check` calling `super::check`). + const bareRust = family === "rust" && shape === "bare"; + const scopeLine = receiver?.startsWith(INLINE_SUPER) ? Number(receiver.slice(INLINE_SUPER.length)) : undefined; + const reachable = (d: CodeSymbol): boolean => + !(bareRust && d.kind === "enum-member" && !variantInScope(d)) && + !(scopeLine !== undefined && (d.file !== f.rel || modScope(d.line) !== scopeLine)); // 1. The file's own declaration. A bare call reaches a top-level one // (any, where the shape proves nothing), a call on the enclosing // object a member of its type. A call on a module or on some other @@ -764,10 +841,23 @@ export function createCallBinder(scan: RepoScan, pairs: Set, opts: CallB else if (shape === "bare") local = shaped ? ownFree.get(name) : ownAny.get(name); else if (shape === "self") { local = selfType !== undefined ? memberOf(selfType, name) : undefined; + // `super.f()` goes on up the bases this file declares, as far as + // one declares `f` (vite's PluginContext → MinimalPluginContext → + // BasicMinimalPluginContext.warn). Bounded: a cycle is not code. + if (receiver === "super") { + for (let t = selfType, hops = 0; !local && t !== undefined && hops < MAX_BASE_HOPS; hops++) { + t = baseOf(t); + if (t !== undefined && ownTypes.has(t)) local = memberOf(t, name); + else break; + } + } // `self.f()` may reach a member a same-file base class declares; a // stated or named type is exact. if (!local && receiver !== undefined && SELF_NAMES.has(receiver)) local = ownMember.get(name); } + if (local && !reachable(local)) { + local = f.symbols.find((s) => s.name === name && !REFERENCE_KINDS.has(s.kind) && !NOT_CALLABLE.has(s.kind) && reachable(s)); + } if (local) return only && !only.has(local.name) ? null : { hit: { def: local, corroborated: true }, local: true }; // 2. What an import renames, and where it comes from. @@ -801,10 +891,11 @@ export function createCallBinder(scan: RepoScan, pairs: Set, opts: CallB if (restrict === null) { if (!recall) return null; } else { - const hits = scope.within(exportedGroup(callee, family, pool), restrict, callee); + let hits = scope.within(exportedGroup(callee, family, pool), restrict, callee); if (hiddenReach === "import" || viaPath) { for (const d of scope.within(hiddenGroup(callee, family, pool), restrict, callee)) if (!hits.includes(d)) hits.push(d); } + if (family === "rust") hits = hits.filter(reachable); const chosen = pickCandidate(f.rel, hits); if (chosen) return { hit: { def: chosen, corroborated: true }, local: false }; if (hits.length) return null; // a proximity tie @@ -817,7 +908,8 @@ export function createCallBinder(scan: RepoScan, pairs: Set, opts: CallB } // 3. Everything the file reaches by stated evidence. - const stated = preferParent(corroborated(callee, pool), typeHint, receiver); + const reached = corroborated(callee, pool); + const stated = preferParent(family === "rust" ? reached.filter(reachable) : reached, typeHint, receiver); if (stated.length) { const chosen = pickCandidate(f.rel, stated); return chosen ? { hit: { def: chosen, corroborated: true }, local: false } : null; @@ -826,7 +918,8 @@ export function createCallBinder(scan: RepoScan, pairs: Set, opts: CallB // 4. Inference by name, where the language permits it at all. const group = exportedGroup(callee, family, recall ? "any" : guessPool); if (!group) return null; - const cands = defsOutside(group, f.rel); + const outside = defsOutside(group, f.rel); + const cands = family === "rust" ? outside.filter(reachable) : outside; if (!cands.length) return null; let guesses: CodeSymbol[] = [...cands]; if (recall) { diff --git a/src/types.ts b/src/types.ts index d9b098b..01ee2f3 100644 --- a/src/types.ts +++ b/src/types.ts @@ -94,7 +94,9 @@ export const SCHEMA_VERSION = 5; // v17: the per-file call-site cap went from 512 to 8192 and a capped record // says so (callsCapped); a line calling one name on two receivers keeps both // sites; Rust `crate::`/`super::` calls carry their path as the receiver. -export const EXTRACTOR_VERSION = 17; +// v18: a method called on a Go composite literal (`T{…}.M()`) takes the +// literal's type as its receiver, where it read an identifier inside the body. +export const EXTRACTOR_VERSION = 18; // How a file is classified. `code` gets symbol/import extraction; `doc` gets // link/heading extraction; the rest are catalogued but not deeply parsed. diff --git a/tests/eval-findings.test.ts b/tests/eval-findings.test.ts index 70cf9f2..5febb5d 100644 --- a/tests/eval-findings.test.ts +++ b/tests/eval-findings.test.ts @@ -5,7 +5,8 @@ import { tmpdir } from "node:os"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; import { scanRepo, type ScanOptions } from "../src/scan.js"; -import { callerIndexForNames, lookupCallerEntry, rawCallerSitesFor } from "../src/callers.js"; +import { callerIndexForNames, computeImportPairs, lookupCallerEntry, rawCallerSitesFor } from "../src/callers.js"; +import { createCallBinder } from "../src/bind.js"; // What an evaluation on large real repositories (vite, TypeScript's Go port, // django, terraform, ripgrep) found an agent would be misled by: answers that @@ -211,3 +212,174 @@ describe("subtokens' ASCII fast path", () => { for (const s of samples) expect(subtokens(s), s).toEqual(reference(s)); }); }); + +// Found by re-running the evaluation on 2.31.8. +describe("binding regressions of 2.31.8", () => { + it("TS: super.method() is bound again (the Rust path receiver is Rust's only)", () => { + const ts = repo({ + "plugin.ts": [ + "export class Base {", + " addWatchFile(id: string): void {}", + "}", + "export class Child extends Base {", + " watch(id: string): void {", + " super.addWatchFile(id);", + " }", + "}", + "", + ].join("\n"), + }); + expect(lines(callersOf(ts, "addWatchFile"))).toEqual(["plugin.ts:6"]); + }); + + it("Rust: super:: from a test fn named like its target reaches the module's item", () => { + const crate = repo({ + "Cargo.toml": '[package]\nname = "w"\nversion = "0.1.0"\n', + "src/lib.rs": "mod ban;\n", + "src/ban.rs": [ + "pub(crate) fn check(x: u8) -> Result<(), u8> { if x == 0 { Err(x) } else { Ok(()) } }", + "", + "#[cfg(test)]", + "mod tests {", + " fn check(x: u8) -> bool {", + " super::check(x).is_err()", + " }", + "}", + "", + ].join("\n"), + }); + const entry = callersOf(crate, "check@src/ban.rs"); + expect(entry?.def.line).toBe(1); + expect(lines(entry)).toEqual(["src/ban.rs:6"]); + }); + + it("Rust: a bare Ok(...) never binds to a local enum's variant; ParseResult::Ok(...) does", () => { + const crate = repo({ + "Cargo.toml": '[package]\nname = "v"\nversion = "0.1.0"\n', + "src/lib.rs": "mod parse;\nmod other;\n", + "src/parse.rs": [ + "pub(crate) enum ParseResult {", + " Ok(T),", + " Err(String),", + " Special(T),", + "}", + "", + "pub(crate) fn parse(s: &str) -> ParseResult {", + " if s.is_empty() { return ParseResult::Err(String::new()); }", + " ParseResult::Ok(1)", + "}", + "", + "pub(crate) fn wrap() -> ParseResult {", + " use self::ParseResult::*;", + " Special(2)", + "}", + "", + "pub(crate) fn plain() -> Result {", + " Ok(3)", + "}", + "", + ].join("\n"), + "src/other.rs": "pub fn f() -> Result {\n Ok(1)\n}\n", + }); + // A `use` carries no scope in the index, so a prelude name never reads as + // the enum's variant bare, even in its own file: `Ok(3)` is std's. + expect(lines(callersOf(crate, "Ok"))).toEqual(["src/parse.rs:9"]); + // Any other variant: the glob import in its own file brings it into scope. + expect(lines(callersOf(crate, "Special"))).toEqual(["src/parse.rs:14"]); + }); + + it("TS: super.f() in an override reaches the base class's method, not the override", () => { + const ts = repo({ + "base.ts": "export class Base {\n render(): void {}\n}\n", + "child.ts": [ + 'import { Base } from "./base";', + "export class Child extends Base {", + " render(): void {", + " super.render();", + " }", + "}", + "", + ].join("\n"), + "same.ts": [ + "class A {", + " run(): void {}", + "}", + "class B extends A {", + " run(): void {", + " super.run();", + " }", + "}", + "class C extends B {", + " stop(): void {}", + "}", + "class D extends C {", + " run(): void {", + " super.run();", + " }", + "}", + "class E extends A {", + " go(): void {", + " var later = () => super.run();", + " }", + "}", + "", + ].join("\n"), + }); + expect(lines(callersOf(ts, "render@base.ts"))).toEqual(["child.ts:4"]); + expect(lines(callersOf(ts, "render@child.ts"))).toEqual([]); + // Same-file homonyms share one caller entry, so ask the binder: B's call + // reaches A.run (line 2), and D's — C declares no run() — B.run (line 5). + const scan = scanRepo(ts); + const same = scan.files.find((f) => f.rel === "same.ts")!; + const bind = createCallBinder(scan, computeImportPairs(scan)).forFile(same)!; + // A const inside E.go (its parent is the method, not E) still reaches A.run. + expect(same.calls!.filter((c) => c.name === "run").map((c) => `${c.line}->${bind(c)?.def.line}`)).toEqual(["6->2", "14->5", "19->2"]); + }); + + it("Rust: super:: in a nested inline mod reaches the enclosing mod's items", () => { + const crate = repo({ + "Cargo.toml": '[package]\nname = "u"\nversion = "0.1.0"\n', + "src/lib.rs": "mod m;\n", + "src/m.rs": [ + "pub fn helper() -> u8 { 1 }", + "", + "mod tests {", + " fn helper() -> u8 { 2 }", + "", + " mod inner {", + " fn t() -> u8 {", + " super::helper()", + " }", + " }", + "}", + "", + ].join("\n"), + }); + const entries = callerIndexForNames(scanRepo(crate), ["helper"]); + const byLine = (line: number) => [...entries.values()].find((e) => e.def.file === "src/m.rs" && e.def.line === line); + expect(byLine(4)?.callers.map((c) => c.line)).toEqual([8]); + expect(byLine(1)?.callers ?? []).toEqual([]); + }); + + it("Go: a method called on a struct literal binds to that type's method", () => { + const go = repo({ + "go.mod": "module example.com/m\n\ngo 1.22\n", + "addrs/check.go": "package addrs\n\ntype Check struct{ Name string }\n\nfunc (c Check) Absolute() string { return c.Name }\n", + "stackaddrs/in_stack.go": 'package stackaddrs\n\ntype InStack struct{}\n\nfunc (s InStack) Absolute() string { return "" }\n', + "stackaddrs/plan_test.go": [ + "package stackaddrs", + "", + 'import "example.com/m/addrs"', + "", + "func use() string {", + "\treturn addrs.Check{", + '\t\tName: "x",', + "\t}.Absolute()", + "}", + "", + ].join("\n"), + }); + expect(lines(callersOf(go, "Absolute@stackaddrs/in_stack.go"))).toEqual([]); + expect(lines(callersOf(go, "Absolute@addrs/check.go"))).toEqual(["stackaddrs/plan_test.go:6"]); + }); +});