@omfalos/mokosh 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +55 -50
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +57 -52
- package/dist/cli.mjs.map +1 -1
- package/dist/duplication-worker.d.mts +1 -1
- package/dist/duplication-worker.d.ts +1 -1
- package/dist/duplication-worker.js +6 -4
- package/dist/duplication-worker.js.map +1 -1
- package/dist/duplication-worker.mjs +6 -4
- package/dist/duplication-worker.mjs.map +1 -1
- package/dist/index.d.mts +186 -18
- package/dist/index.d.ts +186 -18
- package/dist/index.js +37 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -34
- package/dist/index.mjs.map +1 -1
- package/dist/mcp.js +38 -34
- package/dist/mcp.js.map +1 -1
- package/dist/mcp.mjs +40 -36
- package/dist/mcp.mjs.map +1 -1
- package/dist/parse-worker.d.mts +1 -1
- package/dist/parse-worker.d.ts +1 -1
- package/dist/parse-worker.js +6 -6
- package/dist/parse-worker.js.map +1 -1
- package/dist/parse-worker.mjs +6 -6
- package/dist/parse-worker.mjs.map +1 -1
- package/dist/{tokenizer-DIbb0GLe.d.mts → tokenizer-D9P-y7lH.d.mts} +1 -1
- package/dist/{tokenizer-DIbb0GLe.d.ts → tokenizer-D9P-y7lH.d.ts} +1 -1
- package/dist/{types-C153Tz5u.d.mts → types-Ba-BjVQG.d.mts} +4 -0
- package/dist/{types-y90pqeDR.d.ts → types-DWARi8gF.d.ts} +4 -0
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,63 +1,65 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
`)}}});var
|
|
4
|
-
`)){if(o.startsWith("\0")){let[,c,p]=o.slice(1).split(" ");
|
|
5
|
-
`).map(a=>a.trim()).filter(a=>a!=="")}catch{return[]}});return Array.from(new Set(o))}catch(
|
|
6
|
-
`).filter(c=>c.trim().length>0&&!c.trim().startsWith("#"));if(
|
|
7
|
-
`&&
|
|
8
|
-
`)){let o=
|
|
9
|
-
`),s=[],i=new Set;for(let p of o){let f=p.match(
|
|
10
|
-
`),s=[],i=new Set;for(let p of o){let f=p.match(Wp);if(f?.[1]){s.push(Ee(t,f[1]));continue}let u=p.match(zp);if(u?.[2]){i.add(u[2]);continue}let y=p.match(Bp);if(y?.[1]){i.add(y[1]);continue}let x=p.match(Hp);x?.[1]&&i.add(x[1])}let a=j(e,!1);a&&s.push(X(t,a));let c=Array.from(i,p=>({name:p}));return{imports:s,exports:c,tags:Array.from(r).map(p=>({name:p,kind:"comment-marker"})),category:B(t,s.map(p=>p.rawSpecifier),{typeNames:[...i],annotations:we(e).annotations})}}var Wp,en,zp,Bp,Hp,Rs=g(()=>{"use strict";l();Te();Wp=/^\s*import\s+([\w.]+(?:\.\*)?)(?:\s+as\s+\w+)?\s*$/,en="(?:public\\s+|internal\\s+|private\\s+|protected\\s+|open\\s+|abstract\\s+|final\\s+|sealed\\s+|data\\s+|value\\s+|inline\\s+|noinline\\s+|crossinline\\s+|external\\s+|expect\\s+|actual\\s+|suspend\\s+|operator\\s+|infix\\s+|tailrec\\s+|const\\s+|lateinit\\s+)*",zp=new RegExp(`^(?:@[\\w.]+(?:\\([^)]*\\))?\\s+)*${en}(?:(?:enum|annotation)\\s+)?(class|interface|object|typealias)\\s+([A-Za-z_][A-Za-z0-9_]*)`),Bp=new RegExp(`^(?:@[\\w.]+(?:\\([^)]*\\))?\\s+)*${en}fun\\s+(?:<[^>]*>\\s*)?(?:[A-Za-z_][\\w.]*(?:<[^>]*>)?\\.)?([A-Za-z_][A-Za-z0-9_]*)\\s*[(<]`),Hp=new RegExp(`^(?:@[\\w.]+(?:\\([^)]*\\))?\\s+)*${en}(?:val|var)\\s+(?:<[^>]*>\\s*)?([A-Za-z_][A-Za-z0-9_]*)`)});import Up from"livescript";function se(t){if(t){if(typeof t.value=="string")return t.value;if(typeof t.base?.value=="string")return t.base.value}}function Jp(t){if(!t)return[];if(t.constructor?.name==="Class"){let r=se(t.title);return r?[{name:r}]:[]}if(t.constructor?.name==="Obj"&&Array.isArray(t.items))return t.items.map(r=>se(r.key)??se(r.val)).filter(r=>!!r).map(r=>({name:r}));let e=se(t);return e?[{name:e}]:[]}function Kp(t){let e=t.constructor?.name||t.type;if(e==="Assign"&&t.left?.constructor?.name==="Chain"){let r=t.left,n=se(r.head),s=r.tails?.[0]?.key?.name;if(n==="module"&&s==="exports")return Jp(t.right);if(n==="exports"&&typeof s=="string")return[{name:s}];if(r.head?.verb==="out"&&typeof s=="string")return[{name:s}]}if(e==="Import"&&t.left?.verb==="out"){let r=t.right;if(r?.constructor?.name==="Obj"&&Array.isArray(r.items))return r.items.map(n=>se(n.val)??se(n.key)).filter(n=>!!n).map(n=>({name:n}))}return[]}function qp(t,e){let r=t.constructor?.name||t.type;if(r==="Import"){let n=t.right?.value;if(typeof n=="string"){let o=Q(n);return{fromPath:e,toPath:"",rawSpecifier:o,isStyle:R(o),type:"static"}}}if(r==="Chain"&&t.head?.value==="require"){let n=t.tails?.[0];if(n?.constructor?.name==="Call"||n?.type==="Call"){let o=n.args?.[0]?.value;if(typeof o=="string"){let s=Q(o);return{fromPath:e,toPath:"",rawSpecifier:s,isStyle:R(s),type:"require"}}}}return null}function tn(t,e,r){if(!t||typeof t!="object")return[];let n=[],o=qp(t,e);o&&n.push(o),r.push(...Kp(t));for(let s in t){if(Vp.has(s))continue;let i=t[s];if(!(!i||typeof i!="object"))if(Array.isArray(i))for(let a of i)n.push(...tn(a,e,r));else n.push(...tn(i,e,r))}return n}function As(t,e){let r=be(e),n=Se(t,r),o=[],s=[];try{o=tn(Up.ast(e),t,s)}catch{}let i=new Set,a=s.filter(c=>i.has(c.name)?!1:(i.add(c.name),!0));return{imports:o,exports:a,tags:Array.from(r).map(c=>({name:c,kind:"comment-marker"})),category:n}}var Vp,Ms=g(()=>{"use strict";l();q();kt();Vp=new Set(["first_line","first_column","last_line","last_column","line","column"])});import Qp from"luaparse";function Yp(t,e){let r=[];function n(o){if(!(!o||typeof o!="object")){if((o.type==="CallExpression"||o.type==="StringCallExpression")&&o.base?.type==="Identifier"&&o.base?.name==="require"){let s;if(o.type==="CallExpression"){let i=o.arguments?.[0];i?.type==="StringLiteral"&&(s=Q(i.raw))}else if(o.type==="StringCallExpression"){let i=o.argument;i?.type==="StringLiteral"&&(s=Q(i.raw))}s&&r.push({fromPath:e,toPath:"",rawSpecifier:s,isStyle:R(s),type:"require"})}for(let s in o){if(s==="loc")continue;let i=o[s];if(i&&typeof i=="object")if(Array.isArray(i))for(let a of i)n(a);else n(i)}}}return n(t),r}function Xp(t){let e=new Set;for(let r of t)r.type==="LocalStatement"&&r.variables.forEach((n,o)=>{r.init[o]?.type==="TableConstructorExpression"&&e.add(n.name)});return e}function Zp(t){let e=t[t.length-1];if(e?.type!=="ReturnStatement")return[];let r=e.arguments[0];if(r?.type!=="TableConstructorExpression")return[];let n=[];for(let o of r.fields)o.type==="TableKeyString"&&n.push({name:o.key.name});return n}function ef(t){let e=t.body,r=Xp(e),n=Zp(e);for(let s of e)if(s.type==="FunctionDeclaration")s.identifier?.type==="MemberExpression"?s.identifier.base.type==="Identifier"&&r.has(s.identifier.base.name)&&n.push({name:s.identifier.identifier.name}):s.identifier?.type==="Identifier"&&!s.isLocal&&n.push({name:s.identifier.name});else if(s.type==="AssignmentStatement")for(let i of s.variables)i.type==="MemberExpression"&&i.base.type==="Identifier"&&r.has(i.base.name)&&n.push({name:i.identifier.name});let o=new Set;return n.filter(s=>o.has(s.name)?!1:(o.add(s.name),!0))}function Ls(t,e){let r=be(e),n=Se(t,r),o=[],s=[];try{let i=Qp.parse(e);o=Yp(i,t),s=ef(i)}catch{}return{imports:o,exports:s,tags:Array.from(r).map(i=>({name:i,kind:"comment-marker"})),category:n}}var Os=g(()=>{"use strict";l();q();kt()});async function of(){return _s??=(async()=>{let{unified:t}=await import("unified"),e=(await import("remark-parse")).default;return t().use(e)})(),_s}function sf(t){let e=t.trim();return e.length===0||e.startsWith("#")||tf.some(r=>e.startsWith(r))}function af(t,e){let r=t.match(nf);return r?r.map(n=>({fromPath:e,toPath:"",rawSpecifier:n,isStyle:!1,type:"static"})):[]}function Gs(t,e,r){if(t.type==="link"&&typeof t.url=="string"&&!sf(t.url)&&r.push({fromPath:e,toPath:"",rawSpecifier:t.url,isStyle:!1,type:"static"}),(t.type==="code"||t.type==="inlineCode")&&typeof t.value=="string"&&r.push(...af(t.value,e)),Array.isArray(t.children))for(let n of t.children)Gs(n,e,r)}async function js(t,e){let n=(await of()).parse(e),o=[];Gs(n,t,o);let s=new Set;return{imports:o.filter(a=>s.has(a.rawSpecifier)?!1:(s.add(a.rawSpecifier),!0)),exports:[],tags:[],category:"other"}}var tf,rf,nf,_s,$s=g(()=>{"use strict";l();tf=["http://","https://","mailto:","//"],rf="ts|tsx|js|jsx|mjs|cjs|py|go|lua|css|scss|less|styl|coffee|ls|feature|md|mdx|json",nf=new RegExp(`(?:\\.{1,2}/)?[\\w.-]+(?:/[\\w.-]+)*\\.(?:${rf})\\b`,"g")});function cf(t){let e=1;function r(n){switch(n.type.name){case"IfStatement":{e+=ne(n).filter(s=>s.type.name==="if"||s.type.name==="elif").length;break}case"TryStatement":{e+=ne(n).filter(s=>s.type.name==="except").length;break}case"ForStatement":case"WhileStatement":case"ConditionalExpression":e++;break;case"and":case"or":e++;break}let o=n.firstChild;for(;o;)r(o),o=o.nextSibling}return r(t),e}function lf(t,e){let r=0,n=ne(t),o=0,s=0;for(;s<n.length;){let i=n[s];if(i?.type.name==="if"||i?.type.name==="elif"){let a=o>0;r+=a?1:1+e;let c=a?e:e+1,p=n[s+1],f=n[s+2];p&&(r+=H(p,c)),f&&(r+=H(f,c)),o++,s+=3}else if(i?.type.name==="else"){r+=1;let a=n[s+1];a&&(r+=H(a,e+1)),s+=2}else s++}return r}function pf(t,e){let r=0,n=ne(t),o=0;for(;o<n.length;){let s=n[o];if(s?.type.name==="except"){for(r+=1+e,o++;o<n.length&&n[o]?.type.name!=="Body";)r+=H(n[o],e),o++;o<n.length&&(r+=H(n[o],e),o++)}else s?.type.name==="Body"&&(r+=H(s,e)),o++}return r}function Ws(t,e){let r=1+e,n=t.firstChild;for(;n;)r+=H(n,e+1),n=n.nextSibling;return r}function ff(t,e){let r=0,n=t.firstChild;for(;n;)r+=H(n,e),n=n.nextSibling;return r}function H(t,e){let r=t.type.name;switch(r){case"IfStatement":return lf(t,e);case"TryStatement":return pf(t,e);case"ForStatement":case"WhileStatement":return Ws(t,e);default:{let n=r==="ConditionalExpression"||r==="and"||r==="or"?1:0;return e>0&&(r==="FunctionDefinition"||r==="LambdaExpression")?n+Ws(t,e):n+ff(t,e)}}}function mf(t){return H(t,0)}function rn(t){return{complexity:cf(t),cognitiveComplexity:mf(t)}}function zs(t,e){let r=[];function n(i,a){let{complexity:c,cognitiveComplexity:p}=rn(i);r.push({name:a,line:oe(e,i.from),complexity:c,cognitiveComplexity:p})}function o(i){let a=i.firstChild;for(;a;)s(a),a=a.nextSibling}function s(i){if(i.type.name==="ClassDefinition"){let a=i.getChild("VariableName"),c=a?e.slice(a.from,a.to):void 0,p=i.getChild("Body");if(p){let f=p.firstChild;for(;f;){if(f.type.name==="FunctionDefinition"){let u=f.getChild("VariableName"),y=u?e.slice(u.from,u.to):void 0;y&&n(f,c?`${c}.${y}`:y),o(f)}else s(f);f=f.nextSibling}}return}if(i.type.name==="FunctionDefinition"){let a=i.getChild("VariableName");a&&n(i,e.slice(a.from,a.to)),o(i);return}o(i)}return s(t.topNode),r}var Bs=g(()=>{"use strict";l();vt()});import uf from"path";import{parser as gf}from"@lezer/python";function Hs(t,e){let r=[],n=[],o=new Set,s=uf.basename(t).toLowerCase(),i=gf.parse(e),a=i.cursor();do switch(a.name){case"Comment":{let x=e.slice(a.from,a.to).match(/#\s*@tag\s+([a-zA-Z0-9_-]+)/);x?.[1]&&o.add(x[1]);break}case"ImportStatement":{for(let x of hf(a.node,e,t))r.push(x);break}case"FunctionDefinition":case"ClassDefinition":{let x=a.node.parent;if(x?.name==="Script"||x?.name==="DecoratedStatement"&&x.parent?.name==="Script"){let w=a.node.getChild("VariableName");w&&n.push({name:e.slice(w.from,w.to)})}break}case"AssignStatement":{if(a.node.parent?.name==="Script"){let x=a.node.firstChild;x?.name==="VariableName"&&n.push({name:e.slice(x.from,x.to)})}break}}while(a.next());let c=kf(s,r,o);c==="test"&&o.add("test");let{complexity:p,cognitiveComplexity:f}=rn(i.topNode),u=zs(i,e),y=c==="test"?[]:Cf(i,e);return{imports:r,exports:n,tags:Array.from(o).map(x=>({name:x,kind:"comment-marker"})),category:c,rawCallEdges:y,complexity:p,cognitiveComplexity:f,...u.length>0?{functions:u}:{}}}function hf(t,e,r){let n=t.firstChild;return n?n.name==="from"?yf(t,e,r):xf(t,e,r):[]}function yf(t,e,r){let n=t.firstChild;if(!n)return[];let o=n.nextSibling;for(;o&&o.name!=="import";)o=o.nextSibling;if(!o)return[];let s=e.slice(n.to,o.from).trim(),i=bf(o.nextSibling,e);if(!i.length)return[];let a=0;for(;a<s.length&&s[a]===".";)a++;let c=s.slice(a);if(a===0)return[He(r,s,i,!0)];let p=a===1?"./":"../".repeat(a-1);return c?[He(r,p+c.replace(/\./g,"/"),i,!1)]:i[0]==="*"?[He(r,p.slice(0,-1),["*"],!1)]:i.map(f=>He(r,p+f,[f],!1))}function xf(t,e,r){let n=[],o=t.firstChild?.nextSibling??null;for(;o;){if(o.name==="VariableName"){let s=e.slice(o.from,o.to);for(;o.nextSibling?.name==="."&&o.nextSibling.nextSibling?.name==="VariableName";)o=o.nextSibling.nextSibling,s+=`.${e.slice(o.from,o.to)}`;o.nextSibling?.name==="as"&&(o=o.nextSibling.nextSibling??o.nextSibling),n.push(He(r,s,["*"],!0))}o=o.nextSibling}return n}function bf(t,e){let r=[],n=t;for(;n;)n.name==="*"?r.push("*"):n.name==="VariableName"&&(r.push(e.slice(n.from,n.to)),n.nextSibling?.name==="as"&&(n=n.nextSibling.nextSibling??n.nextSibling)),n=n.nextSibling;return r}function Sf(t,e){let r=new Map,n=t.cursor();do{if(n.name!=="ImportStatement")continue;let s=n.node.firstChild;if(s?.type.name!=="from")continue;let i=s.nextSibling;for(;i&&i.type.name!=="import";)i=i.nextSibling;if(!i)continue;let a=e.slice(s.to,i.from).trim(),c=0;for(;c<a.length&&a[c]===".";)c++;let p=a.slice(c),f=c<=1?"./":"../".repeat(c-1),u=i.nextSibling;for(;u;){if(u.type.name==="VariableName"){let y=e.slice(u.from,u.to),x=y;if(u.nextSibling?.type.name==="as"){let w=u.nextSibling.nextSibling;w?.type.name==="VariableName"&&(x=e.slice(w.from,w.to),u=w)}let b=c===0?a:p?f+p.replace(/\./g,"/"):f+y;r.set(x,b)}u=u.nextSibling}}while(n.next());return r}function Cf(t,e){let r=Sf(t,e),n=[];function o(a,c){if(a.type.name==="CallExpression"&&a.firstChild?.type.name==="VariableName"){let f=a.firstChild,u=e.slice(f.from,f.to),y=r.get(u);y&&n.push({from:c,to:u,toSpecifier:y})}let p=a.firstChild;for(;p;)o(p,c),p=p.nextSibling}function s(a){let c=a.firstChild;for(;c;)i(c),c=c.nextSibling}function i(a){if(a.type.name==="ClassDefinition"){let c=a.getChild("VariableName"),p=c?e.slice(c.from,c.to):void 0,f=a.getChild("Body");if(f){let u=f.firstChild;for(;u;){if(u.type.name==="FunctionDefinition"){let y=u.getChild("VariableName"),x=y?e.slice(y.from,y.to):void 0;x&&o(u,p?`${p}.${x}`:x)}else i(u);u=u.nextSibling}}return}if(a.type.name==="FunctionDefinition"){let c=a.getChild("VariableName");c&&o(a,e.slice(c.from,c.to));return}s(a)}return i(t.topNode),n}function He(t,e,r,n){return{fromPath:t,toPath:"",rawSpecifier:e,isStyle:!1,isExternal:n,type:"static",symbols:r.length>0?r:void 0}}function kf(t,e,r){return t.startsWith("test_")||t.endsWith("_test.py")?"test":t==="conftest.py"||t==="setup.py"?"config":r.has("test")||e.some(n=>df.has(n.rawSpecifier))?"test":"logic"}var df,Us=g(()=>{"use strict";l();Bs();df=new Set(["pytest","unittest","nose","hypothesis"])});function Ef(t,e){let r=e.split("=>")[0]?.trim();return r?r==="_"||r==="*"||r==="given"?`${t}.*`:`${t}.${r}`:null}function Tf(t){let e=t.indexOf("{");if(e!==-1){let n=t.indexOf("}",e),o=t.slice(0,e).trim().replace(/\.$/,""),s=t.slice(e+1,n===-1?void 0:n);return o?s.split(",").map(i=>Ef(o,i.trim())).filter(i=>i!=null):[]}let r=[];for(let n of t.split(",")){let o=n.trim().replace(/\s+as\s+\w+$/,"");if(o)if(o.endsWith("._")||o.endsWith(".*")||o.endsWith(".given")){let s=o.replace(/\.(_|\*|given)$/,"");s&&r.push(`${s}.*`)}else r.push(o)}return r}function Js(t,e){let r=ve(e),o=Y(e).split(`
|
|
11
|
-
`),s=[],i=new Set;for(let p of o){let f=p.match(vf);if(f?.[1]){for(let y of Tf(f[1]))s.push(Ee(t,y));continue}let u=p.match(wf);u?.[2]&&i.add(u[2])}let a=j(e,!0);a&&s.push(X(t,a));let c=Array.from(i,p=>({name:p}));return{imports:s,exports:c,tags:Array.from(r).map(p=>({name:p,kind:"comment-marker"})),category:B(t,s.map(p=>p.rawSpecifier),{typeNames:[...i],annotations:we(e).annotations})}}var vf,wf,Ks=g(()=>{"use strict";l();Te();vf=/^\s*import\s+(.+?)\s*$/,wf=/^(?:@\w+\s+)*(?:private\s+|protected\s+|final\s+|sealed\s+|abstract\s+|implicit\s+|case\s+)*(class|trait|object|type|enum)\s+([A-Za-z_$][A-Za-z0-9_$]*)/});import C from"typescript";function Ff(t){let e=1;function r(n){switch(n.kind){case C.SyntaxKind.IfStatement:case C.SyntaxKind.ConditionalExpression:case C.SyntaxKind.ForStatement:case C.SyntaxKind.ForInStatement:case C.SyntaxKind.ForOfStatement:case C.SyntaxKind.WhileStatement:case C.SyntaxKind.DoStatement:case C.SyntaxKind.CatchClause:case C.SyntaxKind.CaseClause:e++;break;case C.SyntaxKind.BinaryExpression:{let o=n.operatorToken.kind;(o===C.SyntaxKind.AmpersandAmpersandToken||o===C.SyntaxKind.BarBarToken||o===C.SyntaxKind.QuestionQuestionToken)&&e++;break}}C.forEachChild(n,r)}return r(t),e}function qs(t,e,r){let n=r?1:1+e,o=r?e:e+1;return n+=ie(t.expression,o,!1),n+=ie(t.thenStatement,o,!1),t.elseStatement&&(C.isIfStatement(t.elseStatement)?n+=qs(t.elseStatement,e,!0):n+=1+ie(t.elseStatement,e+1,!1)),n}function Vs(t,e){let r=1+e;return C.forEachChild(t,n=>{r+=ie(n,e+1,!1)}),r}function Nf(t,e){let r=1+e;return C.forEachChild(t,n=>{r+=ie(n,e,!1)}),r}function Pf(t,e){let r=0;return C.forEachChild(t,n=>{r+=ie(n,e,!1)}),r}function Df(t){let e=t.operatorToken.kind;return e===C.SyntaxKind.AmpersandAmpersandToken||e===C.SyntaxKind.BarBarToken||e===C.SyntaxKind.QuestionQuestionToken}function ie(t,e,r){if(C.isIfStatement(t))return qs(t,e,r);if(C.isForStatement(t)||C.isForInStatement(t)||C.isForOfStatement(t)||C.isWhileStatement(t)||C.isDoStatement(t)||C.isSwitchStatement(t))return Vs(t,e);if(C.isCatchClause(t))return Nf(t,e);let n=0;return C.isConditionalExpression(t)&&(n+=1),C.isBinaryExpression(t)&&Df(t)&&(n+=1),e>0&&(C.isFunctionDeclaration(t)||C.isFunctionExpression(t)||C.isArrowFunction(t))?n+Vs(t,e):n+Pf(t,e)}function If(t){return ie(t,0,!1)}function nn(t){return{complexity:Ff(t),cognitiveComplexity:If(t)}}var Qs=g(()=>{"use strict";l()});import E from"typescript";function Ys(t,e){Rf(t,e),Mf(t,e),Lf(t,e),Of(t,e)}function Rf(t,e){if((E.isFunctionDeclaration(t)||E.isVariableDeclaration(t))&&t.name&&E.isIdentifier(t.name)&&Af(t)){let r;if(E.isFunctionDeclaration(t))r="function";else{let n=t.initializer;r=n&&(E.isArrowFunction(n)||E.isFunctionExpression(n))?"function":"variable"}e.tags.add({name:t.name.text,kind:r})}}function Af(t){if(E.isFunctionDeclaration(t))return E.isSourceFile(t.parent);let e=t.parent?.parent;return!!e&&E.isSourceFile(e.parent)}function Mf(t,e){if(!E.isStringLiteral(t))return;let r=t.text.match(/@[\w-]+/g);if(r)for(let n of r)e.tags.add({name:n.substring(1),kind:"comment-marker"})}function Lf(t,e){if(!E.isSourceFile(t))return;let r=/@tag\s+([a-zA-Z0-9_-]+)/g,n=t.getFullText(),o=r.exec(n);for(;o!==null;)o[1]&&e.tags.add({name:o[1],kind:"comment-marker"}),o=r.exec(n)}function Of(t,e){if(E.isCallExpression(t)&&_f(t.expression))for(let r of t.arguments)E.isObjectLiteralExpression(r)&&Gf(r,e)}function _f(t){return E.isIdentifier(t)?on.has(t.text):!!(E.isPropertyAccessExpression(t)&&(on.has(t.name.text)||E.isIdentifier(t.expression)&&on.has(t.expression.text)))}function Gf(t,e){for(let r of t.properties){if(!E.isPropertyAssignment(r)||!E.isIdentifier(r.name)||r.name.text!=="tags"&&r.name.text!=="tag")continue;let{initializer:n}=r,o=E.isArrayLiteralExpression(n)?n.elements.filter(E.isStringLiteral):r.name.text==="tag"&&E.isStringLiteral(n)?[n]:[];for(let s of o)e.tags.add({name:s.text.replace(/^@/,""),kind:"comment-marker"})}}var on,Xs=g(()=>{"use strict";l();on=new Set(["test","describe","it"])});import Zs from"path";import h from"typescript";function sn(t,e,r){let n=[],o=new Map,s=new Set,i=h.createSourceFile(t,e,h.ScriptTarget.Latest,!0,r==="typescript"?h.ScriptKind.TSX:h.ScriptKind.JSX),a={filePath:t,imports:n,exports:o,tags:s,rawCallEdges:[],sourceFile:i,hasUI:!1,hasTypesOnly:!0,totalStatements:0,exportStatements:0},c=w=>{zf(w,a),h.forEachChild(w,c)};c(i);let p=Zf(t,a);(p==="test"||p==="barrel")&&s.add({name:p,kind:"comment-marker"}),p!=="test"&&em(a,i);let f=i.statements[0],u=f?ti(f):void 0,{complexity:y,cognitiveComplexity:x}=nn(i),b=jf(i);return{imports:n,exports:Array.from(o.values()),tags:Array.from(s),category:p,rawCallEdges:a.rawCallEdges??[],complexity:y,cognitiveComplexity:x,...b.length>0?{functions:b}:{},...u!==void 0?{description:u}:{}}}function jf(t){let e=[],r=(o,s)=>{let{complexity:i,cognitiveComplexity:a}=nn(s),c=t.getLineAndCharacterOfPosition(s.getStart(t)).line+1;e.push({name:o,line:c,complexity:i,cognitiveComplexity:a})},n=(o,s)=>{if(h.isFunctionDeclaration(o)&&o.name&&o.body?r(o.name.text,o):h.isVariableDeclaration(o)&&h.isIdentifier(o.name)&&o.initializer&&(h.isArrowFunction(o.initializer)||h.isFunctionExpression(o.initializer))?r(o.name.text,o.initializer):s&&h.isMethodDeclaration(o)&&h.isIdentifier(o.name)&&o.body?r(`${s}.${o.name.text}`,o):s&&h.isConstructorDeclaration(o)&&o.body?r(`${s}.constructor`,o):s&&h.isGetAccessorDeclaration(o)&&h.isIdentifier(o.name)&&o.body?r(`${s}.get ${o.name.text}`,o):s&&h.isSetAccessorDeclaration(o)&&h.isIdentifier(o.name)&&o.body&&r(`${s}.set ${o.name.text}`,o),h.isClassDeclaration(o)&&o.name){let i=o.name.text;h.forEachChild(o,a=>n(a,i));return}h.forEachChild(o,i=>n(i,s))};return n(t,void 0),e}function ei(t,e,r,n){let o={name:t},s=ti(r);s!==void 0&&(o.doc=s);let i=$f(e);i!==void 0&&(o.flags=i);let a=Wf(e,n);return a!==void 0&&(o.signature=a),o}function ti(t){let e=h.getJSDocCommentsAndTags(t);for(let r of e)if(h.isJSDoc(r)&&r.comment)return h.getTextOfJSDocComment(r.comment)||void 0}function $f(t){let e=new Set(["deprecated","internal","public","alpha","beta"]),r=h.getJSDocTags(t).map(n=>n.tagName.text).filter(n=>e.has(n));return r.length>0?r:void 0}function Wf(t,e){let r=h.createPrinter({removeComments:!0}),n=o=>r.printNode(h.EmitHint.Unspecified,o,e);if(h.isFunctionDeclaration(t)||h.isMethodDeclaration(t)){let o=t.parameters.map(n).join(", "),s=t.type?n(t.type):"void";return`${t.typeParameters?`<${t.typeParameters.map(a=>a.name.text).join(", ")}>`:""}(${o}) => ${s}`}if(h.isVariableDeclaration(t)){if(t.type)return n(t.type);if(t.initializer&&(h.isArrowFunction(t.initializer)||h.isFunctionExpression(t.initializer))){let o=t.initializer,s=o.parameters.map(n).join(", "),i=o.type?n(o.type):"unknown";return`(${s}) => ${i}`}return}if(h.isClassDeclaration(t)&&t.name)return`class ${t.name.text}`;if(h.isInterfaceDeclaration(t))return`interface ${t.name.text}`;if(h.isTypeAliasDeclaration(t))return n(t.type);if(h.isEnumDeclaration(t))return`enum ${t.name.text}`}function zf(t,e){Bf(t,e),Hf(t,e),Jf(t,e),Kf(t,e),Xf(t,e),Ys(t,e)}function Bf(t,e){if(!h.isSourceFile(t))return;let r=t.statements.filter(n=>!h.isEmptyStatement(n));e.totalStatements=r.length,e.exportStatements=r.filter(n=>h.isExportDeclaration(n)||h.isExportAssignment(n)||an(n)).length}function Hf(t,e){if(h.isJsxElement(t)||h.isJsxSelfClosingElement(t)||h.isJsxFragment(t)){e.hasUI=!0,e.hasTypesOnly=!1;return}if(h.isFunctionDeclaration(t)||h.isMethodDeclaration(t)||h.isArrowFunction(t)||h.isClassDeclaration(t)||h.isVariableStatement(t)||h.isEnumDeclaration(t)){e.hasTypesOnly=!1;return}h.isExportDeclaration(t)&&!Uf(t)&&(e.hasTypesOnly=!1)}function Uf(t){return t.isTypeOnly?!0:!t.exportClause||!h.isNamedExports(t.exportClause)?!1:t.exportClause.elements.every(e=>e.isTypeOnly)}function Jf(t,e){if(!h.isImportDeclaration(t)||!t.moduleSpecifier||!h.isStringLiteral(t.moduleSpecifier))return;let r=[];if(t.importClause&&(t.importClause.name&&r.push("default"),t.importClause.namedBindings))if(h.isNamedImports(t.importClause.namedBindings))for(let o of t.importClause.namedBindings.elements)r.push(o.name.text);else h.isNamespaceImport(t.importClause.namedBindings)&&r.push("*");let n=r.length>0?"static":"side-effect";e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:t.moduleSpecifier.text,isStyle:R(t.moduleSpecifier.text),type:n,symbols:r.length>0?r:void 0})}function Kf(t,e){h.isExportDeclaration(t)?Vf(t,e):h.isExportAssignment(t)?e.exports.set("default",{name:"default"}):an(t)&&Yf(t,e)}function Vf(t,e){if(t.moduleSpecifier&&h.isStringLiteral(t.moduleSpecifier))qf(t,t.moduleSpecifier.text,e);else if(t.exportClause&&h.isNamedExports(t.exportClause))for(let r of t.exportClause.elements){let n=r.name.text;e.exports.set(n,{name:n})}}function qf(t,e,r){let n=Qf(t),o={fromPath:r.filePath,toPath:"",rawSpecifier:e,isStyle:R(e),type:"re-export"};n.length>0&&(o.symbols=n),r.imports.push(o)}function Qf(t){return t.exportClause?h.isNamedExports(t.exportClause)?t.exportClause.elements.map(e=>e.name.text):[]:["*"]}function Yf(t,e){if((h.isFunctionDeclaration(t)||h.isClassDeclaration(t)||h.isInterfaceDeclaration(t)||h.isTypeAliasDeclaration(t)||h.isEnumDeclaration(t))&&t.name){let n=t.name.text;e.exports.set(n,ei(n,t,t,e.sourceFile));return}if(h.isVariableStatement(t)){for(let n of t.declarationList.declarations)if(h.isIdentifier(n.name)){let o=n.name.text;e.exports.set(o,ei(o,n,t,e.sourceFile))}}}function Xf(t,e){if(!h.isCallExpression(t))return;let r=t.arguments[0];!r||!h.isStringLiteral(r)||(t.expression.kind===h.SyntaxKind.ImportKeyword?e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:r.text,isStyle:R(r.text),type:"dynamic"}):h.isIdentifier(t.expression)&&t.expression.text==="require"&&e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:r.text,isStyle:R(r.text),type:"require"}))}function Zf(t,e){let r=Zs.basename(t).toLowerCase(),n=Zs.extname(t).toLowerCase();return _e().some(s=>r.includes(s))?"test":Mo(r)?"config":e.imports.some(s=>xr().some(i=>s.rawSpecifier.includes(i)))?"test":n===".tsx"||n===".jsx"||e.hasUI?"ui":e.hasTypesOnly&&e.totalStatements>0?"type-only":e.totalStatements>0&&e.exportStatements/e.totalStatements>Cr()?"barrel":"logic"}function an(t){return h.canHaveModifiers(t)&&h.getModifiers(t)?.some(e=>e.kind===h.SyntaxKind.ExportKeyword)===!0}function em(t,e){let r=t.rawCallEdges??[];t.rawCallEdges=r;let n=new Map;for(let o of e.statements){if(!h.isImportDeclaration(o)||!h.isStringLiteral(o.moduleSpecifier))continue;let s=o.moduleSpecifier.text,i=o.importClause;if(i&&(i.name&&n.set(i.name.text,s),i.namedBindings&&h.isNamedImports(i.namedBindings)))for(let a of i.namedBindings.elements)n.set(a.name.text,s)}if(n.size!==0)for(let o of e.statements){let s=rm(o);if(s){let i=nm(o);i&&Et(i,s,n,r);continue}h.isClassDeclaration(o)&&o.name&&tm(o,o.name.text,n,r)}}function tm(t,e,r,n){for(let o of t.members)h.isMethodDeclaration(o)&&o.body&&h.isIdentifier(o.name)?Et(o.body,`${e}.${o.name.text}`,r,n):h.isConstructorDeclaration(o)&&o.body&&Et(o.body,`${e}.constructor`,r,n)}function rm(t){if(an(t)){if(h.isFunctionDeclaration(t)&&t.name)return t.name.text;if(h.isVariableStatement(t)){for(let e of t.declarationList.declarations)if(h.isIdentifier(e.name)&&e.initializer&&(h.isArrowFunction(e.initializer)||h.isFunctionExpression(e.initializer)))return e.name.text}}}function nm(t){if(h.isFunctionDeclaration(t))return t.body;if(h.isVariableStatement(t)){for(let e of t.declarationList.declarations)if(e.initializer&&(h.isArrowFunction(e.initializer)||h.isFunctionExpression(e.initializer)))return e.initializer}}function Et(t,e,r,n){if(h.isCallExpression(t)&&h.isIdentifier(t.expression)){let o=t.expression.text,s=r.get(o);s&&!n.some(i=>i.from===e&&i.to===o&&i.toSpecifier===s)&&n.push({from:e,to:o,toSpecifier:s})}h.forEachChild(t,o=>Et(o,e,r,n))}var ri=g(()=>{"use strict";l();de();Qs();q();Xs()});function Tt(t,e){if(e.length===0)return"ui";let r=!1;return t.walk(n=>{if(n.type==="rule")return r=!0,!1}),r?"ui":"barrel"}var ni=g(()=>{"use strict";l()});import si from"postcss";import*as om from"postcss-less";function oi(t){return t.startsWith("~")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("data:")}function im(t){let e=t.trim();return e.length>0&&!e.startsWith("http://")&&!e.startsWith("https://")&&!e.startsWith("//")&&!e.startsWith("data:")&&!e.startsWith("#")}function am(t,e){let r=t.match(/^\(([^)]+)\)\s+['"]([^'"]+)['"]/);if(r){let s=r[1]?.trim()??"",i=r[2]??"";if(!i)return null;let a=ii.has(s)?"side-effect":"static";return{fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:a,...oi(i)?{isExternal:!0}:{}}}let n=t.match(/^url\(['"]?([^'")]+)['"]?\)/),o=n?n[1]?.trim()??"":t.match(/^['"]([^'"]+)['"]/)?.[1]??"";return o?{fromPath:e,toPath:"",rawSpecifier:o,isStyle:!0,type:"static",...oi(o)?{isExternal:!0}:{}}:null}function cm(t,e){let r=[],n=/url\(['"]?([^'")]+)['"]?\)/g,o=n.exec(t);for(;o!==null;){let s=o[1]?.trim()??"";im(s)&&r.push({fromPath:e,toPath:"",rawSpecifier:s,isStyle:!0,type:"static"}),o=n.exec(t)}return r}function ai(t,e){let r=[];return t.walk(n=>{if(n.type==="atrule"&&n.name==="import"){let o=am(n.params,e);o&&r.push(o)}n.type==="decl"&&r.push(...cm(n.value,e))}),r}function lm(t){return t.replace(/(?<!:)\/\/.*/g,"")}function pm(t,e){let r=[],n=/@import\s+(?:\(([^)]+)\)\s+)?['"]([^'"]+)['"]/g,o=n.exec(t);for(;o!==null;){let s=o[1]?.trim()??"",i=o[2]??"";if(i){let a=ii.has(s)?"side-effect":"static";r.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:a})}o=n.exec(t)}return r}function Ft(t,e){let r=si.parse(lm(t));return{imports:ai(r,e),root:r}}function fm(t){let e=[],r=[];for(let n of t.nodes??[]){if(n.type!=="atrule")continue;let{value:o}=n;if(o===void 0)continue;let s=n.name;s&&(e.push({name:s}),r.push({name:s,kind:"variable"}))}return{exports:e,tags:r}}function Nt(t,e){try{let r=sm.parse(t),{exports:n,tags:o}=fm(r);return{imports:ai(r,e),root:r,exports:n,tags:o}}catch{return{imports:pm(t,e),root:si.parse(""),exports:[],tags:[]}}}var sm,ii,cn=g(()=>{"use strict";l();sm=om,ii=new Set(["reference","inline"])});import{parse as mm}from"postcss-scss";function ci(t){return t.startsWith("_")||t.startsWith("-")}function um(t){return!!(t.startsWith("sass:")||t.startsWith("~")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||!t.startsWith(".")&&!t.startsWith("/")&&!t.startsWith("_"))}function gm(t){let e=t.match(/^['"]([^'"]+)['"]/);if(!e?.[1])return{specifier:""};let r=e[1],o=t.match(/\bas\s+(\S+)/)?.[1];return o!==void 0?{specifier:r,alias:o}:{specifier:r}}function dm(t){let e=[],r=[];for(let n of t.nodes??[]){if(n.type==="decl"&&n.prop.startsWith("$")){let o=n.prop.slice(1);if(!o||ci(o))continue;e.push({name:o}),r.push({name:o,kind:"variable"});continue}if(n.type==="atrule"&&(n.name==="mixin"||n.name==="function")){let s=n.params.match(/^([\w-]+)/)?.[1];if(!s||ci(s))continue;let i=n.params.trim();e.push(i.includes("(")?{name:s,signature:i}:{name:s}),r.push({name:s,kind:"function"})}}return{exports:e,tags:r}}function Pt(t,e){let r=mm(t),n=[];r.walk(i=>{if(i.type!=="atrule")return;let{name:a,params:c}=i;if(a!=="import"&&a!=="use"&&a!=="forward")return;let{specifier:p,alias:f}=gm(c);if(!p)return;let u={fromPath:e,toPath:"",rawSpecifier:p,isStyle:!0,type:a==="forward"?"re-export":"static",...um(p)?{isExternal:!0}:{}};f&&(u.symbols=[f]),n.push(u)});let{exports:o,tags:s}=dm(r);return{imports:n,root:r,exports:o,tags:s}}var ln=g(()=>{"use strict";l()});function li(t,e){let r=[],n=/@require\s+['"]([^'"]+)['"]/g,o=n.exec(t);for(;o!==null;){let i=o[1];i&&r.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:"require"}),o=n.exec(t)}let s=/(?<!@)(?:import|require)\s*\(?\s*['"]([^'"]+)['"]/g;for(o=s.exec(t);o!==null;){let i=o[1];i&&r.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:"static"}),o=s.exec(t)}return r}function pi(t,e){if(e.length===0)return"ui";try{let r=gr("stylus");return new r.Parser(t).parse().nodes.some(s=>s.constructor.name!=="Import")?"ui":"barrel"}catch{return t.replace(/^\s*@?(?:require|import)\b.*/gm,"").trim().length>0?"ui":"barrel"}}var fi=g(()=>{"use strict";l()});function Ue(t,e){let r=z(t);if(r==="stylus"){let s=li(e,t);return{imports:s,exports:[],tags:[],category:pi(e,s)}}if(r==="scss"){let{imports:s,root:i,exports:a,tags:c}=Pt(e,t);return{imports:s,exports:a,tags:c,category:Tt(i,s)}}if(r==="less"){let{imports:s,root:i,exports:a,tags:c}=Nt(e,t);return{imports:s,exports:a,tags:c,category:Tt(i,s)}}let{imports:n,root:o}=Ft(e,t);return{imports:n,exports:[],tags:[],category:Tt(o,n)}}var mi=g(()=>{"use strict";l();q();ni();cn();ln();fi()});async function ui(t,e){let r=z(t),n=gs(r);return n?n(t,e):{imports:[],exports:[],tags:[],category:"other"}}var gi=g(()=>{"use strict";l();q();ms();ds();ks();ws();Ds();Rs();Ms();Os();$s();Us();Ks();ri();Be();mi();de();q();Be();for(let[t,e]of[["javascript",(r,n)=>sn(r,n,"javascript")],["typescript",(r,n)=>sn(r,n,"typescript")],["css",Ue],["scss",Ue],["less",Ue],["stylus",Ue],["coffeescript",fs],["livescript",As],["lua",Ls],["python",Hs],["go",Cs],["java",Ps],["kotlin",Is],["scala",Js],["groovy",vs],["gherkin",qr],["markdown",js]])Ce(t,e)});import di from"path";function hm(t,e){let r=e.get(t.path);r!==void 0&&(t.coveragePct=r)}function yi(t,e){for(let r of t)if(r.isExternal){let n=r.rawSpecifier.startsWith("@")?r.rawSpecifier.split("/").slice(0,2).join("/"):r.rawSpecifier.split("/")[0];n&&!e.some(o=>o.name===n)&&e.push({name:n,kind:"library"})}}function ym(t,e,r){if(e.isExternal||!e.toPath)return;let n=r.get(e.toPath);n&&(n.category!=="logic"&&n.category!=="barrel"||(n.testedBy??=[],n.testedBy.includes(t.path)||n.testedBy.push(t.path)))}function xm(t,e){if(t.type==="markdown")for(let r of t.imports){if(r.isExternal||!r.toPath)continue;let n=e.get(r.toPath);!n||n===t||(n.documentedBy??=[],n.documentedBy.includes(t.path)||n.documentedBy.push(t.path),n.category==="logic"&&(n.lastCommitAt??0)>(t.lastCommitAt??0)&&(t.staleFor??=[],t.staleFor.includes(n.path)||t.staleFor.push(n.path)))}}function hi(t){return Math.round(t*1e4)/1e4}function bm(t,e){let r=[];for(let n of t.imports){if(n.isExternal||!n.toPath)continue;let o=e.get(n.toPath);if(!o||o.exports.length===0)continue;let s;if(n.symbols===void 0){if(n.type==="side-effect")continue;s=1}else n.symbols.includes("*")?s=1:s=n.symbols.length/o.exports.length;n.exportUsageRatio=hi(Math.min(1,s)),r.push(n.exportUsageRatio)}r.length>0&&(t.avgExportUsage=hi(r.reduce((n,o)=>n+o,0)/r.length),t.maxExportUsage=Math.max(...r))}function pn(t,e,r){e&&(t.some(n=>n.name===e&&n.kind===r)||t.push({name:e,kind:r}))}function Sm(t,e){let r=e.toPath,n=di.basename(r,di.extname(r)).replace(/\.(test|spec)$/,"");pn(t.tags,n,"import")}function Cm(t,e){if(!(!e.symbols||e.symbols.includes("*")))for(let r of e.symbols)pn(t.tags,r,"import")}function km(t,e,r){let n=r.get(e.toPath);if(!(!n||n.category==="test"))for(let o of n.tags)o.kind==="comment-marker"&&pn(t.tags,o.name,"comment-marker")}function vm(t,e,r){!e.toPath||e.isExternal||(Sm(t,e),Cm(t,e),km(t,e,r))}function xi(t,e){for(let r of t.values())delete r.testedBy,delete r.documentedBy,delete r.staleFor,r.category==="test"&&(r.tags=r.tags.filter(n=>n.kind!=="import"));for(let r of t.values()){if(bm(r,t),e.size>0&&hm(r,e),r.category==="test")for(let n of r.imports)ym(r,n,t),vm(r,n,t);xm(r,t)}}var bi=g(()=>{"use strict";l()});function fn(t){let e=new Map;for(let r of t.nodes.values())e.set(r.type,(e.get(r.type)??0)+1);return[...e.entries()].map(([r,n])=>({type:r,fileCount:n,exportsTracked:Ci.has(r),importSymbolsTracked:ki.has(r),callEdgesTracked:Dt.has(r)})).sort((r,n)=>n.fileCount-r.fileCount)}var Si,Ci,ki,Dt,It=g(()=>{"use strict";l();Si=new Set(["java","kotlin","scala","groovy"]),Ci=new Set(["typescript","javascript","python","go","java","kotlin","scala","groovy","scss","less","lua","coffeescript"]),ki=new Set(["typescript","javascript","python"]),Dt=new Set(["typescript","javascript","go","python","java"])});import Ei from"fs";import Ne from"path";function wm(t,e){let r=t.split(`
|
|
12
|
-
`),n=null,o=new Map,s=!1;for(let i of r){let a=i.trim();if(a.startsWith("module ")){n=a.slice(7).trim();continue}if(/^replace\s*\(/.test(a)){s=!0;continue}if(s&&a===")"){s=!1;continue}if(s&&a.includes("=>")){vi(a,e,o);continue}!s&&/^replace\s+/.test(a)&&a.includes("=>")&&vi(a.replace(/^replace\s+/,""),e,o)}return{mod:n,replaces:o}}function vi(t,e,r){let[n,o]=t.split("=>").map(a=>a.trim());if(!n||!o)return;let s=n.split(/\s+/)[0];if(!o.startsWith(".")&&!o.startsWith("/"))return;let i=Ne.isAbsolute(o)?o:Ne.resolve(e,o);r.set(s,i)}function wi(t){let e;try{e=Ei.readdirSync(t,{withFileTypes:!0})}catch{return null}let r=e.filter(n=>n.isFile()&&n.name.endsWith(".go")&&!n.name.endsWith("_test.go")).map(n=>({path:Ne.join(t,n.name),isExternal:!1})).sort((n,o)=>n.path.localeCompare(o.path));return r.length>0?r:null}var Je,Ti=g(()=>{"use strict";l();Je=class{extensions=[".go"];goModCache=new Map;resolve(e,r,n,o){let{mod:s,replaces:i}=this.readGoMod(n);if(!s)return null;let a=this.applyReplace(r,i,n);if(a!==void 0)return wi(a);if(r!==s&&!r.startsWith(`${s}/`))return null;let c=r.slice(s.length).replace(/^\//,"");return c?wi(Ne.join(n,c)):null}readGoMod(e){let r=this.goModCache.get(e);if(r!==void 0)return r;let n={mod:null,replaces:new Map};try{let o=Ei.readFileSync(Ne.join(e,"go.mod"),"utf-8"),s=wm(o,e);return this.goModCache.set(e,s),s}catch{return this.goModCache.set(e,n),n}}applyReplace(e,r,n){for(let[o,s]of r){if(e===o)return s;if(e.startsWith(`${o}/`)){let i=e.slice(o.length+1);return Ne.join(s,i)}}}}});import Rt from"fs";import At from"path";function Fm(t){let e=new Map,r=new Set(I),n=(o,s)=>{if(s>Tm)return;let i;try{i=Rt.readdirSync(o,{withFileTypes:!0})}catch{return}for(let a of i){let c=At.join(o,a.name);if(a.isDirectory()){!a.name.startsWith(".")&&!r.has(a.name)&&n(c,s+1);continue}if(!a.isFile())continue;let p=At.extname(a.name);if(!Em.has(p))continue;let f=Nm(c,p===".scala"||p===".sc");if(!f)continue;let u=e.get(f);u?u.push(c):e.set(f,[c])}};n(t,0);for(let o of e.values())o.sort();return e}function Nm(t,e){let r;try{let n=Rt.openSync(t,"r");try{let o=Buffer.alloc(Fi),s=Rt.readSync(n,o,0,Fi,0);r=o.toString("utf8",0,s)}finally{Rt.closeSync(n)}}catch{return null}return j(r,e)}function mn(t){return!t||t.length===0?null:t.map(e=>({path:e,isExternal:!1}))}function Pm(t){return At.basename(t,At.extname(t))}var Em,Tm,Fi,Ke,Ni=g(()=>{"use strict";l();G();Te();Em=new Set([".java",".kt",".kts",".scala",".sc",".groovy"]),Tm=12,Fi=4096,Ke=class{extensions=[".java",".kt",".kts",".scala",".sc",".groovy",".gradle"];indexCache=new Map;resolve(e,r,n,o){let s=this.getIndex(n);if(s.size===0)return null;let i=r.endsWith(".*"),a=(i?r.slice(0,-2):r).split(".").filter(Boolean);if(a.length===0)return null;if(i)return mn(s.get(a.join(".")));for(let c=a.length-1;c>=1;c--){let p=s.get(a.slice(0,c).join("."));if(!p)continue;let f=a[c],u=p.filter(y=>Pm(y)===f);if(u.length>0)return mn(u);if(c===a.length-1)return mn(p)}return null}getIndex(e){let r=this.indexCache.get(e);if(r)return r;let n=Fm(e);return this.indexCache.set(e,n),n}}});import Dm from"fs";import un from"path";var Ve,Pi=g(()=>{"use strict";l();Ve=class{extensions=[".lua"];resolve(e,r,n,o){let s=r.replace(/\./g,un.sep),i=[n,un.join(n,"lib")];for(let a of i){if(!Dm.existsSync(a))continue;let c=o(un.join(a,"_dummy.lua"),s);if(c)return[c]}return null}}});import Im from"path";var Rm,qe,Di=g(()=>{"use strict";l();G();Rm=new Set(I),qe=class{extensions=[".md",".mdx"];resolve(e,r,n,o){let s=r.replace(/^\.\//,"").split("/")[0];if(s&&Rm.has(s))return null;let i=o(Im.join(n,"_dummy"),`./${r}`);return i?[i]:null}}});import Am from"fs";import gn from"path";function Ii(t){try{return Am.statSync(t,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}var Qe,Ri=g(()=>{"use strict";l();Qe=class{extensions=[".py"];resolve(e,r,n,o){let s=r.replace(/\./g,gn.sep),i=gn.join(n,`${s}.py`);if(Ii(i))return[{path:i,isExternal:!1}];let a=gn.join(n,s,"__init__.py");return Ii(a)?[{path:a,isExternal:!1}]:null}}});import Ai from"path";var Mm,Ye,Mi=g(()=>{"use strict";l();Mm=["~","http://","https://","//","data:","sass:"],Ye=class{extensions=[".css",".scss",".sass",".less",".styl"];resolve(e,r,n,o){if(Mm.some(f=>r.startsWith(f)))return null;let s=o(e,r);if(s)return[s];let i=Ai.dirname(r),a=Ai.basename(r),c=i==="."?`_${a}`:`${i}/_${a}`,p=o(e,c);return p?[p]:null}}});var Li=g(()=>{"use strict";l();Ti();Ni();Pi();Di();Ri();Mi()});import Mt from"fs";import U from"path";var J,Lt=g(()=>{"use strict";l();Li();J=class{constructor(e,r={}){this.rootDir=e;this.workspaceMap=r.workspaceMap??new Map,this.tsconfigSearchPaths=r.tsconfigSearchPaths??[e],this.pathAliases=r.pathAliases,this.langResolvers=r.langResolvers??[new Qe,new Ve,new Je,new Ke,new Ye,new qe]}rootDir;workspaceMap;tsconfigSearchPaths;pathAliases;langResolvers;resolutionCache=new Map;langBucketFor(e){for(let r=0;r<this.langResolvers.length;r++)if(this.langResolvers[r]?.extensions.some(n=>e.endsWith(n)))return String(r);return"none"}cacheKey(e,r){return`${U.dirname(e)}\0${this.langBucketFor(e)}\0${r}`}resolveAll(e,r){let n=this.cacheKey(e,r),o=this.resolutionCache.get(n);if(o!==void 0)return o??[];let s=this.resolveAllUncached(e,r);return this.resolutionCache.set(n,s.length>0?s:null),s}resolveAllUncached(e,r){let n=this.resolvePathAlias(r);if(n)return[n];if(r.startsWith(".")||r.startsWith("/")){let i=this.resolveLocalPath(e,r);return i?[i]:[]}let o=(i,a)=>this.resolveLocalPath(i,a);for(let i of this.langResolvers)if(i.extensions.some(a=>e.endsWith(a))){let a=i.resolve(e,r,this.rootDir,o);if(a)return a}let s=this.resolveWorkspaceImport(r);return s?[s]:[{path:r,isExternal:!0}]}resolve(e,r){return this.resolveAll(e,r)[0]??null}resolveLocalPath(e,r){let n=U.dirname(e),o=r.startsWith("/")?r:U.resolve(n,r),s=!o.startsWith(this.rootDir),i=["",".ts",".tsx",".js",".jsx",".mjs",".cjs",".css",".scss",".sass",".less",".styl",".coffee",".ls",".lua",".py",".feature",".md",".mdx"],a=o.match(/\.(js|mjs|cjs)$/);if(a){let c=o.slice(0,-a[0].length);for(let p of[".ts",".tsx"]){let f=this.tryExtensions(c,p,s);if(f)return f}}for(let c of i){let p=this.tryExtensions(o,c,s);if(p)return p}return s?{path:o,isExternal:!0}:null}tryExtensions(e,r,n){let o=e+r;if(this.isFile(o))return{path:o,isExternal:n};let s=U.join(e,`index${r}`);if(this.isFile(s))return{path:s,isExternal:n};if(r===".py"){let i=U.join(e,"__init__.py");if(this.isFile(i))return{path:i,isExternal:n}}return null}isFile(e){try{return Mt.statSync(e,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}resolvePathAlias(e){if(this.pathAliases)for(let r in this.pathAliases){let n=this.matchAliasPattern(r,e),o=this.pathAliases[r];if(n&&o){let s=this.tryAliasSubstitutions(o,n[1]||"");if(s)return s}}for(let r of this.tsconfigSearchPaths){let n=U.join(r,"tsconfig.json");if(Mt.existsSync(n))try{let s=JSON.parse(Mt.readFileSync(n,"utf-8")).compilerOptions?.paths;if(!s)continue;for(let i in s){let a=this.matchAliasPattern(i,e);if(a){let c=this.tryAliasSubstitutions(s[i],a[1]||"",r);if(c)return c}}}catch{}}return null}aliasRegexCache=new Map;matchAliasPattern(e,r){let n=this.aliasRegexCache.get(e);if(!n){let o=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace("\\*","(.*)");n=new RegExp(`^${o}$`),this.aliasRegexCache.set(e,n)}return r.match(n)}tryAliasSubstitutions(e,r,n=this.rootDir){let o=["",".ts",".tsx",".js",".jsx",".coffee",".ls",".lua",".feature"];for(let s of e){let i=s.replace("*",r),a=U.resolve(n,i);for(let c of o){let p=this.tryExtensions(a,c,!1);if(p)return p}}return null}resolveWorkspaceImport(e){if(this.workspaceMap.size===0)return null;for(let[r,n]of this.workspaceMap){if(e!==r&&!e.startsWith(`${r}/`))continue;let o=e.slice(r.length),s={path:"",isExternal:!1,isWorkspace:!0,workspacePackage:r};if(!o){for(let a of["src/index.ts","src/index.tsx","index.ts","index.tsx","index.js"]){let c=U.join(n,a);try{if(Mt.statSync(c,{throwIfNoEntry:!1})?.isFile())return{...s,path:c}}catch{}}return{...s,path:n}}let i=this.resolveLocalPath(U.join(n,"_dummy"),o.slice(1));return i?{...s,path:i.path}:null}return null}}});import Xe from"fs";import P from"path";import Lm from"piscina";function jm(){return(process.env.MOKOSH_IGNORE_DIRS??"").split(",").map(t=>t.trim()).filter(Boolean)}function $m(t,e){if(t.length===0)return e;let r=t.map(i=>P.dirname(i).split(P.sep)),n=r[0]??[];for(let i of r.slice(1)){let a=0;for(;a<n.length&&a<i.length&&n[a]===i[a];)a++;n=n.slice(0,a)}let o=n.join(P.sep)||P.sep,s=P.relative(e,o);return s.startsWith("..")||P.isAbsolute(s)?e:o}var Om,_m,Gm,ae,dn=g(()=>{"use strict";l();Or();de();Kr();gi();bi();It();xe();Lt();Om=["tests","test","__tests__","specs","spec"],_m=["node_modules",".git","dist","build",".next",".cache","mokosh-cache","coverage",".pytest_cache","__pycache__"],Gm=600;ae=class{constructor(e,r=null,n,o,s=!1,i=new Map,a=!0,c=[]){this.rootDir=e;this.enableGitStats=s;this.coverageMap=i;this.parallelParsing=a;this.previousGraph=r,this.walkIgnoreDirs=new Set([..._m,...c,...jm()]),this.resolver=n||new J(e),this.lockFile=as(e),o&&(this.progressCallback=o)}rootDir;enableGitStats;coverageMap;parallelParsing;graph={nodes:new Map};visited=new Set;queue=[];previousGraph=null;resolver;lockFile=null;progressCallback;pool=null;gitStatsMap=null;walkIgnoreDirs;async build(e){let r=e.map(n=>P.isAbsolute(n)?n:P.resolve(this.rootDir,n));await this.initPool(),this.enableGitStats&&(this.gitStatsMap=es(this.rootDir));try{for(let n of r)this.enqueue(n);return await this.drain(),await this.processTestFiles($m(r,this.rootDir)),await this.processDocFiles(),this.progressCallback&&this.visited.size>=100&&process.stderr.write(`
|
|
2
|
+
var kn=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var d=(t,e)=>()=>(t&&(e=t(t=0)),e);var Kl=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);import Vl from"path";import{fileURLToPath as ql}from"url";var Yl,Ql,u,l=d(()=>{"use strict";Yl=()=>ql(import.meta.url),Ql=()=>Vl.dirname(Yl()),u=Ql()});function gt(t){vn.push(t)}function Zo(t){return[...Xl,...vn].some(e=>typeof e=="string"?t.includes(e):e instanceof RegExp?e.test(t):e(t))}function ht(t){wn.push(t)}function ze(){return[...Zl,...wn]}function yt(t){En.push(t)}function Tn(){return[...ep,...En]}function Nn(t){Fn=t}function Pn(){return Fn}function xt(){vn.length=0,wn.length=0,En.length=0,Fn=es}var Xl,vn,Zl,wn,ep,En,es,Fn,be=d(()=>{"use strict";l();Xl=[".config.","biome.json","tsconfig.json","package.json",".prettierrc",".eslintrc"],vn=[];Zl=[".test.",".spec.","-test.","-spec."],wn=[];ep=["jest","vitest","playwright","cypress","@testing-library/"],En=[];es=.8,Fn=es});import Dn from"fs";import ts from"path";function Se(t,{allowJs:e=!0,isExplicitPath:n=!1}={}){if(n){let r=ts.resolve(t);return Dn.existsSync(r)?r.endsWith(".json")?ns(r):e?rs(r):{}:{}}for(let r of tp){let o=ts.resolve(t,r);if(Dn.existsSync(o)){if(r.endsWith(".json"))return ns(o);if(e)return rs(o)}}return{}}function ns(t){return JSON.parse(Dn.readFileSync(t,"utf-8"))}function rs(t){let e=kn(t);return e&&typeof e=="object"&&"default"in e&&(e=e.default),typeof e=="function"?e({}):e}function Rn(t){xt();for(let e of t.configMatchers??[])gt(e);for(let e of t.testPatterns??[])ht(e);for(let e of t.testLibraries??[])yt(e);t.barrelThreshold!==void 0&&Nn(t.barrelThreshold)}function N(t){return{gitStats:t?.gitStats??!1,parallelParsing:t?.parallelParsing,pathAliases:t?.pathAliases,additionalIgnoreDirs:t?.ignoreDirs}}var tp,In=d(()=>{"use strict";l();be();tp=["mokosh.config.js","mokosh.config.cjs","mokosh.config.json"]});var Q,re,Ce,Be,A,An,j=d(()=>{"use strict";l();Q="mokosh-cache",re="duplication-tokens.json",Ce="graph.json",Be="branch-graphs",A=["node_modules",".git","dist","build",".next",".cache","mokosh-cache","coverage",".pytest_cache","__pycache__",".gradle","target"],An=[".ts",".tsx",".js",".jsx",".mjs",".cjs",".css",".scss",".sass",".less",".styl",".coffee",".ls",".lua",".py",".go",".java",".kt",".kts",".scala",".sc",".groovy",".gradle",".feature",".md",".mdx"]});import jh from"fs";import Wh from"path";var os=d(()=>{"use strict";l()});var bt,ss=d(()=>{"use strict";l();bt={serialize(t){let e=["graph TD"],n=new Set;for(let r of t.nodes.values()){let o=`"${r.path}"`;for(let s of r.imports){if(!s.toPath)continue;let i=`"${s.toPath}"`,a=`${r.path} -> ${s.toPath}`;if(!n.has(a)){let c=s.isStyle?"-- styles -->":"-->";e.push(` ${o} ${c} ${i}`),n.add(a)}}}return e.join(`
|
|
3
|
+
`)}}});var is=d(()=>{"use strict";l();ss()});var ke,St=d(()=>{"use strict";l();ke=class{constructor(e){this.nodes=e}nodes;findUnusedFiles(e){let n=new Set(this.nodes.keys());return e.filter(r=>!n.has(r))}findHighExportUsage(e){let n=[];for(let r of this.nodes.values()){if(r.maxExportUsage===void 0||r.maxExportUsage<e)continue;let o=r.imports.reduce((s,i)=>(i.exportUsageRatio??0)>(s?.exportUsageRatio??0)?i:s,null);n.push({path:r.path,maxExportUsage:r.maxExportUsage,tightestDep:o?.toPath??""})}return n.sort((r,o)=>o.maxExportUsage-r.maxExportUsage)}findCycles(e={}){let n=new Set(e.includeKinds??[]),r=[],o=new Set,s=new Set,i=[],a=c=>{o.add(c),s.add(c),i.push(c);let p=this.nodes.get(c);if(p){for(let f of p.imports)if(!(!f.toPath||f.isExternal)&&!(f.isSamePackage&&!n.has("samePackage"))&&!(f.isDocReference&&!n.has("docReference")))if(s.has(f.toPath)){let m=i.indexOf(f.toPath);r.push([...i.slice(m),f.toPath])}else o.has(f.toPath)||a(f.toPath)}s.delete(c),i.pop()};for(let c of this.nodes.keys())o.has(c)||a(c);return r}}});import as from"fs";import rp from"path";function Mn(t,e){let n=t.replace(/^\.\//,"");if(e.nodes.has(n))return n;let r=n.replace(/^dist\//,"src/").replace(/\.(js|mjs|cjs)$/,".ts");return e.nodes.has(r)?r:null}function cs(t,e){if(typeof t=="string")return Mn(t,e);if(t&&typeof t=="object"){let n=t;for(let r of["import","require","default"]){let o=cs(n[r],e);if(o)return o}}return null}function op(t){if(!t)return"unknown";let e=t.trimStart();return e.startsWith("interface ")?"interface":e.startsWith("class ")?"class":e.startsWith("enum ")?"enum":e.startsWith("type ")?"type":e.startsWith("namespace ")?"namespace":e.startsWith("const ")||e.startsWith("let ")||e.startsWith("var ")||e.startsWith("readonly ")?"const":e.startsWith("(")||e.startsWith("async ")||e.startsWith("function ")||e.includes("=>")?"function":"unknown"}function sp(t,e){let n=new Set,r=new Set,o=[...e];for(;o.length;){let s=o.shift();if(r.has(s))continue;r.add(s);let i=t.nodes.get(s);if(i){for(let a of i.exports)n.add(a.name);for(let a of i.imports){if(a.type!=="re-export"||a.isExternal||!a.toPath)continue;if(!a.symbols?.length||a.symbols.includes("*")){let p=t.nodes.get(a.toPath);if(p)for(let f of p.exports)n.add(f.name);o.push(a.toPath)}else for(let p of a.symbols)n.add(p)}}}return n}function Ln(t,e){let n=[],r=rp.join(e,"package.json");if(as.existsSync(r))try{let o=JSON.parse(as.readFileSync(r,"utf8"));if(o.exports&&typeof o.exports=="object"&&!Array.isArray(o.exports))for(let s of Object.values(o.exports)){let i=cs(s,t);i&&!n.includes(i)&&n.push(i)}else if(typeof o.exports=="string"){let s=Mn(o.exports,t);s&&n.push(s)}if(n.length===0)for(let s of[o.main,o.module].filter(Boolean)){let i=Mn(s,t);i&&!n.includes(i)&&n.push(i)}}catch{}if(n.length===0){for(let o of["src/index.ts","src/index.js","index.ts","index.js"])if(t.nodes.has(o)){n.push(o);break}}return n}function ip(t,e){let n=new Set(e);for(let r of e)t.traverse(r,o=>(n.add(o.path),!0),{direction:"outgoing"});return n}function ap(t,e,n){let r=new Map;for(let o of e){if(n.includes(o))continue;let s=t.nodes.get(o);if(!s)continue;let i=s.category==="barrel";for(let a of s.exports){let c=r.get(a.name),p=!!(a.signature||a.doc);(!c||p&&!i)&&r.set(a.name,{file:o,symbol:a})}}return r}function cp(t,e,n,r){let o=[];for(let s of t){let i=e.get(s),a=r.flatMap(m=>n.nodes.get(m)?.exports??[]).find(m=>m.name===s),c=i?.symbol??a,p=i?.file??r.find(m=>n.nodes.get(m)?.exports.some(h=>h.name===s))??r[0],f={name:s,definedIn:p,kind:op(c?.signature)};c?.doc&&(f.doc=c.doc),c?.signature&&(f.signature=c.signature),o.push(f)}return o.sort((s,i)=>s.name.localeCompare(i.name)),o}function lp(t,e,n){let r=c=>t.nodes.get(c)?.category==="test",o=[...e].filter(c=>!n.includes(c)&&!r(c)),s=[...t.nodes.keys()].filter(c=>!e.has(c)),i=s.filter(c=>!r(c)),a=s.filter(c=>r(c));return{internalFiles:o,unreachableFromEntry:i,testFiles:a}}function On(t,e){if(e.length===0)throw new Error("buildApiSurface requires at least one entry point");for(let p of e)if(!t.nodes.has(p))throw new Error(`Entry point not found in graph: ${p}`);let n=ip(t,e),r=ap(t,n,e),o=sp(t,e),s=cp(o,r,t,e),{internalFiles:i,unreachableFromEntry:a,testFiles:c}=lp(t,n,e);return{entryPoints:e,publicExports:s,internalFiles:i,unreachableFromEntry:a,testFiles:c}}var _n=d(()=>{"use strict";l()});function Gn(t,e){let n=null,r=[];for(let s of t.nodes.values()){s.exports.some(i=>i.name===e)&&(n=s.path);for(let i of s.callEdges??[])i.to===e&&r.push({file:s.path,callerFunction:i.from})}let o=[];if(n){let s=t.nodes.get(n);for(let i of s?.callEdges??[])i.from===e&&o.push({file:i.toFile,calleeFunction:i.to})}return{functionName:e,definedIn:n,callers:r,callees:o}}var jn=d(()=>{"use strict";l()});import oy from"fs";import iy from"path";function ls(t){let e=[...t.nodes.entries()].sort(([r],[o])=>r.localeCompare(o)).map(([r,o])=>`${r}:${o.mtime}:${o.size}`).join("|"),n=2166136261;for(let r=0;r<e.length;r++)n^=e.charCodeAt(r),n=Math.imul(n,16777619)>>>0;return n.toString(16).padStart(8,"0")}function $n(t){let e=new Map;for(let n of t.nodes.keys()){let r=[];t.traverse(n,o=>(o.path!==n&&r.push(o.path),!0),{direction:"incoming"}),e.set(n,r)}return{impact:e,graphHash:ls(t)}}function Wn(t,e){return t.impact.get(e)??[]}var zn=d(()=>{"use strict";l()});var I,ve=d(()=>{"use strict";l();St();I=class t{constructor(e){this.nodes=e}nodes;_incomingEdgesCache=null;_callIncomingCache=null;serialize(){return{nodes:Array.from(this.nodes.values())}}static deserialize(e){let n=new Map;for(let r of e.nodes)n.set(r.path,r);return new t(n)}getIncomingEdgesMap(){if(this._incomingEdgesCache)return this._incomingEdgesCache;let e=new Map;for(let n of this.nodes.values())for(let r of n.imports)if(r.toPath){let o=e.get(r.toPath)||[];o.push(n.path),e.set(r.toPath,o)}return this._incomingEdgesCache=e,e}dfs(e,n,r,o){let s=new Set,i=r.maxDepth??1/0,a=(c,p,f)=>{if(p>i||s.has(c))return;let m=this.nodes.get(c);if(m&&(s.add(c),n(m,p,f)!==!1))for(let h of o(c))a(h,p+1,c)};a(e,0,null)}traverse(e,n,r={}){let o=r.direction??"outgoing",s=o==="incoming"?this.getIncomingEdgesMap():null;this.dfs(e,n,r,i=>o==="outgoing"?this.nodes.get(i)?.imports.map(a=>a.toPath).filter(Boolean)??[]:s?.get(i)??[])}getCallIncomingCache(){if(this._callIncomingCache)return this._callIncomingCache;let e=new Map;for(let n of this.nodes.values())for(let r of n.callEdges??[]){let o=e.get(r.toFile)??[];o.push(n.path),e.set(r.toFile,o)}return this._callIncomingCache=e,e}traverseCalls(e,n,r={}){let o=r.direction??"outgoing",s=o==="incoming"?this.getCallIncomingCache():null;this.dfs(e,n,r,i=>o==="outgoing"?this.nodes.get(i)?.callEdges?.map(a=>a.toFile)??[]:s?.get(i)??[])}getCallers(e){let n=[];return this.traverseCalls(e,r=>(r.path!==e&&n.push(r.path),!0),{direction:"incoming",maxDepth:1}),n}getCallEdgesFor(e){return this.nodes.get(e)?.callEdges??[]}getNeighbors(e){let n=this.nodes.get(e);return n?n.imports.map(r=>this.nodes.get(r.toPath)).filter(r=>r!==void 0):[]}findUnusedFiles(e){return new ke(this.nodes).findUnusedFiles(e)}findCycles(e){return new ke(this.nodes).findCycles(e)}}});import He from"fs";import ps from"path";function Ct(t){return ps.join(t,Q,Be)}function fs(t,e){return ps.join(Ct(t),`${e}.json`)}function ms(t,e){let n=fs(t,e);if(!He.existsSync(n))return null;try{let r=He.readFileSync(n,"utf-8");return I.deserialize(JSON.parse(r))}catch{return null}}function us(t,e,n){let r=Ct(t);He.existsSync(r)||He.mkdirSync(r,{recursive:!0}),He.writeFileSync(fs(t,e),JSON.stringify(n.serialize()))}var ds=d(()=>{"use strict";l();j();ve()});import{execFileSync as Bn}from"child_process";function ys(t,e){let n="",r=0;for(let o of t.split(`
|
|
4
|
+
`)){if(o.startsWith("\0")){let[,c,p]=o.slice(1).split(" ");n=c??"",r=p?Number(p)*1e3:0;continue}if(o==="")continue;let s=o.split(" "),i=s[0];if(!i)continue;let a=i.startsWith("R")||i.startsWith("C")?s[2]:s[1];a&&e(a,n,r)}}function xs(t){let e=new Map;try{let n=Bn("git",["-C",t,"log","--since=90 days ago","--name-status","-M",`--format=${gs}`],{encoding:"utf-8",stdio:["ignore","pipe","ignore"],maxBuffer:hs});ys(n,(r,o,s)=>{let i=e.get(r);if(i){i.commitCount90d+=1;return}e.set(r,{commitCount90d:1,lastAuthor:o||void 0,lastCommitAt:s||void 0})})}catch{return e}try{let n=Bn("git",["-C",t,"log","--name-status","-M",`--format=${gs}`],{encoding:"utf-8",stdio:["ignore","pipe","ignore"],maxBuffer:hs});ys(n,(r,o,s)=>{e.has(r)||e.set(r,{commitCount90d:0,lastAuthor:void 0,lastCommitAt:s||void 0})})}catch{}return e}var kt,gs,hs,Hn=d(()=>{"use strict";l();kt=class{getChangedFiles(e,n){try{let o=[["diff","--name-only"],["diff","--cached","--name-only"],["ls-files","--others","--exclude-standard"],...n?[["diff","--name-only","--end-of-options",`${n}...HEAD`]]:[]].flatMap(s=>{try{return Bn("git",s,{cwd:e,encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).split(`
|
|
5
|
+
`).map(a=>a.trim()).filter(a=>a!=="")}catch{return[]}});return Array.from(new Set(o))}catch(r){return console.error("Error getting git diff:",r),[]}}},gs="%x00%H%x09%ae%x09%at",hs=256*1024*1024});var Ue,Un=d(()=>{"use strict";l();Ue=["package-lock.json","yarn.lock","pnpm-lock.yaml"]});import vt from"fs";import pp from"path";import{load as bs}from"js-yaml";function Ss(t){let e=t.lastIndexOf("@");return e>0?t.substring(0,e):t}function fp(t){return t.replace(/:$/,"").split(",").map(e=>{let n=e.trim();return n.startsWith('"')&&(n=n.slice(1)),n.endsWith('"')&&(n=n.slice(0,-1)),Ss(n)}).filter(Boolean)}function mp(t,e){let n=t.startsWith("/")?t.slice(1):t,r=n.lastIndexOf("@");return r>0?{name:n.substring(0,r),version:e||n.substring(r+1)}:{name:n,version:e}}function up(t){try{let e=bs(t),n={dependencies:{}};for(let[r,o]of Object.entries(e))if(!(r==="__metadata"||!o?.version))for(let s of r.split(", ")){let i=Ss(s);i&&(n.dependencies[i]={version:o.version,...o.dependencies!==void 0&&{dependencies:o.dependencies}})}return n}catch{return null}}function dp(t){let e={dependencies:{}};for(let n of t.split(/\n\n+/)){let r=n.split(`
|
|
6
|
+
`).filter(c=>c.trim().length>0&&!c.trim().startsWith("#"));if(r.length<2)continue;let o=r[0];if(!o||o.startsWith(" "))continue;let s=fp(o);if(s.length===0)continue;let a=r.find(c=>c.trim().startsWith('version "'))?.match(/version "(.*?)"/)?.[1]??"";for(let c of s)e.dependencies[c]={version:a}}return e}function Cs(t){let e=vt.readFileSync(t,"utf-8"),n=JSON.parse(e),r={dependencies:{}};if(n.packages)for(let[o,s]of Object.entries(n.packages)){if(!o.startsWith("node_modules/"))continue;let i=o.replace("node_modules/","");i.includes("node_modules/")||(r.dependencies[i]={version:s.version,...s.dependencies!==void 0&&{dependencies:s.dependencies}})}else if(n.dependencies)for(let[o,s]of Object.entries(n.dependencies))r.dependencies[o]={version:s.version,...s.dependencies!==void 0&&{dependencies:s.dependencies}};return r}function ks(t){let e=vt.readFileSync(t,"utf-8");if(e.includes("__metadata:")){let n=up(e);if(n!==null)return n}return dp(e)}function vs(t){let e=vt.readFileSync(t,"utf-8"),n={dependencies:{}};try{let r=bs(e);if(r.packages)for(let[o,s]of Object.entries(r.packages)){let{name:i,version:a}=mp(o,s.version);i&&(n.dependencies[i]={version:a,...s.dependencies!==void 0&&{dependencies:s.dependencies}})}if(r.dependencies)for(let[o,s]of Object.entries(r.dependencies)){if(n.dependencies[o])continue;let i=typeof s=="string"?s:s.version;n.dependencies[o]={version:i||""}}}catch{}return n}function Jn(t){for(let e of Ue){let n=pp.join(t,e);if(vt.existsSync(n))return gp[e](n)}return null}var gp,Kn=d(()=>{"use strict";l();Un();gp={"package-lock.json":Cs,"yarn.lock":ks,"pnpm-lock.yaml":vs}});function ws(t){let e=t.trim();return e.length>=2&&(e[0]==='"'||e[0]==="'")&&e[e.length-1]===e[0]?e.slice(1,-1):e}function hp(t){let e=t.trim();if(e.startsWith('"')||e.startsWith("'")){let a=ws(e).split(":");return a.length>=3&&a[0]&&a[2]?{group:a[0],version:a[2]}:null}if(!e.startsWith("{"))return null;let n=e.match(/module\s*=\s*["']([^"']+)["']/),r=e.match(/group\s*=\s*["']([^"']+)["']/),o=n?n[1].split(":")[0]:r?.[1];if(!o)return null;let s=e.match(/version\.ref\s*=\s*["']([^"']+)["']/)??e.match(/version\s*=\s*\{\s*ref\s*=\s*["']([^"']+)["']/),i=e.match(/version\s*=\s*["']([^"']+)["']/);return{group:o,...i?.[1]!==void 0&&{version:i[1]},...s?.[1]!==void 0&&{versionRef:s[1]}}}function Vn(t){let e=t.split(/\r?\n/).map(s=>s.replace(/#.*$/,"").trim()),n={},r="";for(let s of e){let i=s.match(/^\[([\w.-]+)\]$/);if(i){r=i[1];continue}if(r!=="versions"||!s)continue;let a=s.indexOf("=");if(a===-1)continue;let c=s.slice(0,a).trim(),p=ws(s.slice(a+1));c&&p&&(n[c]=p)}let o={};r="";for(let s of e){let i=s.match(/^\[([\w.-]+)\]$/);if(i){r=i[1];continue}if(r!=="libraries"||!s)continue;let a=s.indexOf("=");if(a===-1)continue;let c=hp(s.slice(a+1));if(!c)continue;let p=c.versionRef?n[c.versionRef]:c.version;p&&(o[c.group]=p)}return o}function qn(t){let e={};for(let n of t.split(/\r?\n/)){let r=n.trim();if(!r||r.startsWith("#")||r.startsWith("empty="))continue;let s=r.split("=")[0].split(":");s.length>=3&&s[0]&&s[2]&&(e[s[0]]=s[2])}return e}function Yn(t){let e={},n=/["']([\w.-]+):([\w.-]+):([\w.\-+]+)["']/g;for(let o=n.exec(t);o;o=n.exec(t)){let[,s,,i]=o;s&&i&&/\d/.test(i)&&(e[s]=i)}let r=/group:\s*["']([\w.-]+)["'][^\n)]*?version:\s*["']([\w.\-+]+)["']/g;for(let o=r.exec(t);o;o=r.exec(t))o[1]&&o[2]&&/\d/.test(o[2])&&(e[o[1]]=o[2]);return e}var Qn=d(()=>{"use strict";l()});function wt(t){let e={},n=/["']([\w.-]+)["']\s*%%?\s*["']([\w.-]+)["']\s*%\s*["']([\w.\-+]+)["']/g;for(let r=n.exec(t);r;r=n.exec(t)){let[,o,,s]=r;o&&s&&(e[o]=s)}return e}var Xn=d(()=>{"use strict";l()});import Tt from"fs";import Et from"path";function Je(t){try{return Tt.existsSync(t)?Tt.readFileSync(t,"utf-8"):null}catch{return null}}function Zn(t){let e={},n=f=>{for(let[m,h]of Object.entries(f))!e[m]&&h&&(e[m]=h)},r=Je(Et.join(t,"gradle","libs.versions.toml"));r&&n(Vn(r));let o=[],s=[],i=[],a=(f,m)=>{let h;try{h=Tt.readdirSync(f,{withFileTypes:!0})}catch{return}for(let y of h){let b=Et.join(f,y.name);if(y.isDirectory()){m<xp&&!y.name.startsWith(".")&&!yp.has(y.name)&&a(b,m+1);continue}y.isFile()&&(y.name==="gradle.lockfile"?o.push(b):y.name==="build.gradle"||y.name==="build.gradle.kts"?s.push(b):y.name==="build.sbt"&&i.push(b))}};a(t,0);for(let f of o){let m=Je(f);m&&n(qn(m))}for(let f of s){let m=Je(f);m&&n(Yn(m))}for(let f of i){let m=Je(f);m&&n(wt(m))}try{let f=Et.join(t,"project");for(let m of Tt.readdirSync(f,{withFileTypes:!0}))if(m.isFile()&&m.name.endsWith(".scala")){let h=Je(Et.join(f,m.name));h&&n(wt(h))}}catch{}let c=Object.keys(e);if(c.length===0)return null;let p={};for(let f of c)p[f]={version:e[f]};return p}var yp,xp,er=d(()=>{"use strict";l();Qn();Xn();yp=new Set(["node_modules","build",".gradle","target",".git","dist"]),xp=2});function Es(t){let e=Jn(t),n=Zn(t);return n?{...e??{dependencies:{}},jvmDependencies:n}:e}var tr=d(()=>{"use strict";l();Kn();er();Qn();Kn();er();Xn();Un()});import Ts from"path";function B(t){switch(Ts.extname(t).toLowerCase()){case".js":case".jsx":case".mjs":case".cjs":return"javascript";case".ts":case".tsx":return"typescript";case".css":return"css";case".scss":case".sass":return"scss";case".less":return"less";case".styl":return"stylus";case".coffee":return"coffeescript";case".ls":return"livescript";case".lua":return"lua";case".py":return"python";case".go":return"go";case".java":return"java";case".kt":case".kts":return"kotlin";case".scala":case".sc":return"scala";case".groovy":case".gradle":return"groovy";case".cpp":case".cc":case".cxx":case".c":return"unknown";case".feature":return"gherkin";case".md":case".mdx":return"markdown";default:return"unknown"}}function M(t){let e=Ts.extname(t).toLowerCase();return[".css",".scss",".sass",".less",".styl"].includes(e)}var X=d(()=>{"use strict";l()});function Z(t){return t.startsWith("'")||t.startsWith('"')?t.slice(1,-1):t}function we(t){let e=new Set,n=/@tag\s+([a-zA-Z0-9_-]+)/g,r=n.exec(t);for(;r!==null;)r[1]&&e.add(r[1]),r=n.exec(t);return e}function Ee(t,e){let n=t.toLowerCase();return n.includes(".test.")||n.includes(".spec.")||e.has("test")?"test":"logic"}var Ft=d(()=>{"use strict";l()});import bp from"coffeescript";function Ns(t){if(t){if(typeof t.originalValue=="string")return t.originalValue;if(typeof t.value=="string")return Z(t.value)}}function oe(t){if(t){if(typeof t.value=="string")return t.value;if(typeof t.base?.value=="string")return t.base.value}}function Sp(t,e){let n=Ns(e.source);return n?{fromPath:t,toPath:"",rawSpecifier:n,isStyle:M(n),type:"static"}:null}function Cp(t,e){let n=e.variable?.base?.value==="require",r=Ns(e.args?.[0]?.base);return!n||!r?null:{fromPath:t,toPath:"",rawSpecifier:r,isStyle:M(r),type:"require"}}function Fs(t,e){if(e)return[{name:e}];let n=t.value;if(n?.constructor?.name==="Class"){let o=oe(n.variable);return o?[{name:o}]:[]}if(n?.base?.constructor?.name==="Obj"&&Array.isArray(n.base.properties))return n.base.properties.map(o=>oe(o.variable)??oe(o)).filter(o=>!!o).map(o=>({name:o}));let r=oe(n);return r?[{name:r}]:[]}function kp(t){if(Array.isArray(t.specifiers))return t.specifiers.map(n=>n.identifier??n.original?.value).filter(n=>!!n).map(n=>({name:n}));let e=oe(t.variable)??oe(t.variable?.base);return e?[{name:e}]:[]}function vp(t,e,n,r){let o=e.constructor?.name;if(o==="ImportDeclaration"){let s=Sp(t,e);s&&n.push(s)}else if(o==="Call"){let s=Cp(t,e);s&&n.push(s)}else if(o==="Assign"){let s=oe(e.variable?.base),i=e.variable?.properties?.[0]?.name?.value;s==="module"&&i==="exports"?r.push(...Fs(e,void 0)):s==="exports"&&typeof i=="string"&&r.push(...Fs(e,i))}else o==="ExportNamedDeclaration"&&e.clause?r.push(...kp(e.clause)):o==="ExportDefaultDeclaration"&&r.push({name:"default"})}function nr(t,e,n,r){if(!(!e||typeof e!="object")){vp(t,e,n,r);for(let o in e){if(o==="locationData")continue;let s=e[o];if(!(!s||typeof s!="object"))if(Array.isArray(s))for(let i of s)nr(t,i,n,r);else nr(t,s,n,r)}}}function Ps(t,e){let n=we(e),r=Ee(t,n),o=[],s=[];try{nr(t,bp.nodes(e),o,s)}catch{}let i=new Set,a=s.filter(c=>i.has(c.name)?!1:(i.add(c.name),!0));return{imports:o,exports:a,tags:Array.from(n).map(c=>({name:c,kind:"comment-marker"})),category:r}}var Ds=d(()=>{"use strict";l();X();Ft()});function Te(t,e){Rs.set(t,e)}function Is(t){return Rs.get(t)}var Rs,Ke=d(()=>{"use strict";l();Rs=new Map});import{AstBuilder as wp,GherkinClassicTokenMatcher as Ep,Parser as Tp}from"@cucumber/gherkin";import{IdGenerator as Fp}from"@cucumber/messages";function rr(t,e){let n=new Set,r=o=>{for(let s of o)n.add(s.name.startsWith("@")?s.name.slice(1):s.name)};try{let o=new wp(Np),s=new Ep,a=new Tp(o,s).parse(e);if(a.feature){r(a.feature.tags);for(let c of a.feature.children){if(c.scenario){r(c.scenario.tags);for(let p of c.scenario.examples)r(p.tags)}if(c.rule)for(let p of c.rule.children)p.scenario&&r(p.scenario.tags)}}}catch(o){console.warn(`[GherkinParser] Failed to parse ${t}:`,o)}return{imports:[],exports:[],tags:Array.from(n).map(o=>({name:o,kind:"comment-marker"})),category:"test"}}var Np,As=d(()=>{"use strict";l();Ke();Np=Fp.uuid();Te("gherkin",rr)});function se(t){let e=[],n=t.firstChild;for(;n;)e.push(n),n=n.nextSibling;return e}function ie(t,e){let n=1;for(let r=0;r<e&&r<t.length;r++)t[r]===`
|
|
7
|
+
`&&n++;return n}var Nt=d(()=>{"use strict";l()});function Pp(t,e){let n=1;function r(o){switch(o.type.name){case"IfStatement":case"ForStatement":n++;break;case"Case":{o.firstChild?.type.name==="case"&&n++;break}case"LogicOp":{let i=e.slice(o.from,o.to);(i==="&&"||i==="||")&&n++;break}}let s=o.firstChild;for(;s;)r(s),s=s.nextSibling}return r(t),n}function Ls(t,e,n,r){let o=n?1:1+e,s=se(t),i=n?e:e+1,a=s[1];a&&a.type.name!=="Block"&&(o+=Fe(a,i,!1,r));let c=s.find(f=>f.type.name==="Block");c&&(o+=Fe(c,i,!1,r));let p=s.findIndex(f=>f.type.name==="else");if(p>=0){let f=s[p+1];f?.type.name==="IfStatement"?o+=Ls(f,e,!0,r):f&&(o+=1+Fe(f,e+1,!1,r))}return o}function Ms(t,e,n){let r=1+e,o=t.firstChild;for(;o;)r+=Fe(o,e+1,!1,n),o=o.nextSibling;return r}function Dp(t,e,n){let r=0,o=t.firstChild;for(;o;)r+=Fe(o,e,!1,n),o=o.nextSibling;return r}function Rp(t,e){let n=e.slice(t.from,t.to);return n==="&&"||n==="||"}function Fe(t,e,n,r){let o=t.type.name;if(o==="IfStatement")return Ls(t,e,n,r);if(o==="ForStatement"||o==="SwitchStatement"||o==="SelectStatement")return Ms(t,e,r);let s=o==="LogicOp"&&Rp(t,r)?1:0;return e>0&&o==="FunctionLiteral"?s+Ms(t,e,r):s+Dp(t,e,r)}function Ip(t,e){return Fe(t,0,!1,e)}function Pt(t,e){return{complexity:Pp(t,e),cognitiveComplexity:Ip(t,e)}}function or(t,e){let r=t.getChild("Parameters")?.getChild("Parameter"),o=r?.getChild("TypeName")??r?.getChild("PointerType")?.getChild("TypeName");return o?e.slice(o.from,o.to):void 0}function Os(t,e){let n=[],r=t.cursor();do if(r.name==="FunctionDecl"){let o=r.node.getChild("DefName");if(o){let s=e.slice(o.from,o.to),{complexity:i,cognitiveComplexity:a}=Pt(r.node,e);n.push({name:s,line:ie(e,r.from),complexity:i,cognitiveComplexity:a})}}else if(r.name==="MethodDecl"){let o=r.node.getChild("FieldName");if(o){let s=e.slice(o.from,o.to),i=or(r.node,e),a=i?`${i}.${s}`:s,{complexity:c,cognitiveComplexity:p}=Pt(r.node,e);n.push({name:a,line:ie(e,r.from),complexity:c,cognitiveComplexity:p})}}while(r.next());return n}var _s=d(()=>{"use strict";l();Nt()});import Ap from"path";import{parser as Mp}from"@lezer/go";function js(t,e){let n=[],r=new Map,o=new Set,s=new Set,i=new Map,a=Mp.parse(e),c=a.cursor();do switch(c.name){case"LineComment":{let C=e.slice(c.from,c.to),E=C.match(Lp);E?.[1]&&o.add(E[1]);let G=C.match(Op);G&&Gs(G[1],s);let S=C.match(_p);S&&Gs(S[1],s);break}case"ImportSpec":{let C=c.node.getChild("String");if(C){let G=e.slice(C.from,C.to).slice(1,-1);n.push({fromPath:t,toPath:"",rawSpecifier:G,isExternal:!0,isStyle:!1,type:"static"});let S=c.node.getChild("DefName"),F=S?e.slice(S.from,S.to):G.split("/").pop();F&&F!=="_"&&F!=="."&&i.set(F,G)}break}case"FunctionDecl":case"MethodDecl":case"TypeDecl":case"VarDecl":case"ConstDecl":{let C=c.node.getChild("DefName")??c.node.getChild("FieldName")??c.node.getChild("TypeSpec")?.getChild("DefName")??c.node.getChild("VarSpec")?.getChild("DefName")??c.node.getChild("ConstSpec")?.getChild("DefName");if(C){let E=e.slice(C.from,C.to);E!=="_"&&/^[A-Z]/.test(E)&&!r.has(E)&&r.set(E,{name:E})}break}}while(c.next());let p=n.some(C=>C.rawSpecifier==="testing"),f=Ap.basename(t).endsWith("_test.go")||o.has("test")||p?"test":"logic",m=new Set([...o,...s]),{complexity:h,cognitiveComplexity:y}=Pt(a.topNode,e),b=Os(a,e),v=f==="test"?[]:Gp(a,e,i);return{imports:n,exports:Array.from(r.values()),tags:Array.from(m).map(C=>({name:C,kind:"comment-marker"})),category:f,rawCallEdges:v,complexity:h,cognitiveComplexity:y,...b.length>0?{functions:b}:{}}}function Gp(t,e,n){let r=[];function o(i,a){if(i.type.name==="CallExpr"){let p=i.firstChild;if(p?.type.name==="SelectorExpr"){let f=p.firstChild,m=p.getChild("FieldName");if(f?.type.name==="VariableName"&&m){let h=e.slice(f.from,f.to),y=n.get(h);if(y){let b=e.slice(m.from,m.to);r.push({from:a,to:b,toSpecifier:y})}}}}let c=i.firstChild;for(;c;)o(c,a),c=c.nextSibling}let s=t.cursor();do if(s.name==="FunctionDecl"){let i=s.node.getChild("DefName"),a=s.node.getChild("Block");if(i&&a){let c=e.slice(i.from,i.to);/^[A-Z]/.test(c)&&o(a,c)}}else if(s.name==="MethodDecl"){let i=s.node.getChild("FieldName"),a=s.node.getChild("Block");if(i&&a){let c=e.slice(i.from,i.to),p=or(s.node,e);o(a,p?`${p}.${c}`:c)}}while(s.next());return r}function Gs(t,e){for(let n of t.split(/[\s,&|!()]+/)){let r=n.trim();r&&r!=="ignore"&&e.add(r)}}var Lp,Op,_p,$s=d(()=>{"use strict";l();_s();Lp=/\/\/\s*@tag\s+([a-zA-Z0-9_-]+)/,Op=/^\/\/go:build\s+(.+)$/,_p=/^\/\/\s*\+build\s+(.+)$/});function ir(t){let e=t.replace(/\.\w+$/,"");return zp.test(e)}function Ne(t){let e=new Set;for(let n of t.matchAll(jp))n[1]&&e.add(n[1]);return e}function ee(t){let e=t.replace(/\/\*[\s\S]*?\*\//g,n=>n.replace(/[^\n]/g," "));return e=e.replace(/\/\/[^\n]*/g,n=>" ".repeat(n.length)),e}function Pe(t){let e=ee(t),n=new Set;for(let o of e.matchAll(/@([A-Z]\w*)/g))o[1]&&n.add(o[1]);let r=new Set;for(let o of e.matchAll(/\b(?:class|object|interface|trait|enum)\s+([A-Za-z_]\w*)/g))o[1]&&r.add(o[1]);return{annotations:[...n],typeNames:[...r]}}function De(t,e){return{fromPath:t,toPath:"",rawSpecifier:e,isExternal:!0,isStyle:!1,type:"static"}}function te(t,e){return{fromPath:t,toPath:"",rawSpecifier:`${e}.*`,isExternal:!0,isStyle:!1,type:"side-effect",isSamePackage:!0}}function $(t,e){let n=[];for(let r of ee(t).split(`
|
|
8
|
+
`)){let o=r.trim();if(!o||o.startsWith("@")||o.startsWith("*"))continue;let s=o.match(/^package\s+(?:object\s+)?([\w.]+)/);if(s?.[1]){if(n.push(s[1]),!e)break;continue}if(!(e&&/^import\s/.test(o)))break}return n.length>0?n.join("."):null}function H(t,e,n={}){let r=t.replace(/\\/g,"/"),o=r.split("/").pop()??"";if(o.endsWith(".gradle")||o==="build.gradle.kts"||o==="settings.gradle.kts")return"config";if(Wp.test(r)||e.some(i=>$p.some(a=>i===a||i.startsWith(`${a}.`))))return"test";let s=n.annotations??[];return s.some(i=>Bp.has(i))?"config":s.some(i=>Hp.has(i))||(n.typeNames??[]).some(i=>Jp.some(a=>i.endsWith(a)))?"ui":s.some(i=>Up.has(i))?"logic":ir(o)?"test":"logic"}var jp,$p,sr,Wp,zp,Bp,Hp,Up,Jp,Re=d(()=>{"use strict";l();jp=/\/\/\s*@tag\s+([a-zA-Z0-9_-]+)/g,$p=["org.junit","androidx.test","org.robolectric","org.mockito","org.scalatest","munit","spock.lang","io.kotest","org.spekframework","org.testng","org.assertj","com.google.truth","org.hamcrest","io.mockk","com.nhaarman.mockitokotlin2"],sr=["test","androidTest","integrationTest","it"],Wp=new RegExp(`/src/(${sr.join("|")})/`),zp=/(?:Test|Tests|Spec|IT|ITCase)$/;Bp=new Set(["Configuration","SpringBootApplication","EnableAutoConfiguration"]),Hp=new Set(["Composable","Preview"]),Up=new Set(["RestController","Controller","Service","Repository","Component","Entity","MappedSuperclass","Embeddable"]),Jp=["Activity","Fragment","ViewModel","Screen","Composable"]});function qp(t,e){return t?e.endsWith(".*")?e.slice(0,-2)||null:e.split(".").slice(0,-1).join(".")||null:e||null}function Ws(t,e){let n=Ne(e),o=ee(e).split(`
|
|
9
|
+
`),s=[],i=new Set;for(let p of o){let f=p.match(Kp);if(f?.[2]){let h=qp(!!f[1],f[2]);h&&s.push(De(t,h));continue}let m=p.match(Vp);m?.[2]&&i.add(m[2])}let a=$(e,!1);a&&s.push(te(t,a));let c=Array.from(i,p=>({name:p}));return{imports:s,exports:c,tags:Array.from(n).map(p=>({name:p,kind:"comment-marker"})),category:H(t,s.map(p=>p.rawSpecifier),{typeNames:[...i],annotations:Pe(e).annotations})}}var Kp,Vp,zs=d(()=>{"use strict";l();Re();Kp=/^\s*import\s+(static\s+)?([\w.]+(?:\.\*)?)(?:\s+as\s+\w+)?\s*$/,Vp=/^(?:@\w+\s+)*(?:public\s+|private\s+|protected\s+|final\s+|abstract\s+|static\s+)*(class|interface|trait|enum|def)\s+([A-Za-z_][A-Za-z0-9_]*)/});function Qp(t,e){let n=1;function r(o){let s=o.type.name;if(s==="IfStatement"||s==="CatchClause"||s==="TernaryExpression")n++;else if(Bs.has(s))n++;else if(s==="SwitchLabel")o.firstChild?.type.name==="case"&&n++;else if(s==="LogicOp"){let a=e.slice(o.from,o.to);(a==="&&"||a==="||")&&n++}let i=o.firstChild;for(;i;)r(i),i=i.nextSibling}return r(t),n}function Hs(t,e,n,r){let o=n?1:1+e,s=[];for(let f=t.firstChild;f;f=f.nextSibling)s.push(f);let i=n?e:e+1,a=s[1];a&&a.type.name!=="Block"&&(o+=Ie(a,i,!1,r));let c=s.find(f=>f.type.name==="Block");c&&(o+=Ie(c,i,!1,r));let p=s.findIndex(f=>f.type.name==="else");if(p>=0){let f=s[p+1];f?.type.name==="IfStatement"?o+=Hs(f,e,!0,r):f&&(o+=1+Ie(f,e+1,!1,r))}return o}function ar(t,e,n){let r=1+e,o=t.firstChild;for(;o;)r+=Ie(o,e+1,!1,n),o=o.nextSibling;return r}function Xp(t,e,n){let r=0,o=t.firstChild;for(;o;)r+=Ie(o,e,!1,n),o=o.nextSibling;return r}function Zp(t,e){let n=e.slice(t.from,t.to);return n==="&&"||n==="||"}function Ie(t,e,n,r){let o=t.type.name;if(o==="IfStatement")return Hs(t,e,n,r);if(Bs.has(o)||o==="SwitchStatement"||o==="CatchClause"||o==="TernaryExpression")return ar(t,e,r);let s=o==="LogicOp"&&Zp(t,r)?1:0;return e>0&&o==="LambdaExpression"?s+ar(t,e,r):s+Xp(t,e,r)}function ef(t,e){return Ie(t,0,!1,e)}function cr(t,e){return{complexity:Qp(t,e),cognitiveComplexity:ef(t,e)}}function lr(t,e){for(let n=t.parent;n;n=n.parent)if(Yp.has(n.type.name)){let r=n.getChild("Definition");if(r)return e.slice(r.from,r.to)}}function Us(t,e){let n=[],r=t.cursor();do if(r.name==="MethodDeclaration"||r.name==="ConstructorDeclaration"){let o=r.node.getChild("Definition");if(o){let s=e.slice(o.from,o.to),i=lr(r.node,e),a=i&&r.name==="MethodDeclaration"?`${i}.${s}`:s,{complexity:c,cognitiveComplexity:p}=cr(r.node,e);n.push({name:a,line:ie(e,r.from),complexity:c,cognitiveComplexity:p})}}while(r.next());return n}var Bs,Yp,Js=d(()=>{"use strict";l();Nt();Bs=new Set(["ForStatement","EnhancedForStatement","WhileStatement","DoStatement"]),Yp=new Set(["ClassDeclaration","InterfaceDeclaration","EnumDeclaration","RecordDeclaration","AnnotationTypeDeclaration"])});import{parser as tf}from"@lezer/java";function rf(t,e){let n=t.getChild("ScopedIdentifier");if(!n)return null;let r=t.getChild("static")!=null,o=t.getChild("Asterisk")!=null,s=e.slice(n.from,n.to);return r?(o||(s=s.split(".").slice(0,-1).join(".")),s?{specifier:s,wildcard:!1}:null):o?{specifier:`${s}.*`,wildcard:!0}:{specifier:s,wildcard:!1}}function of(t){let e=new Map;for(let n of t){if(n.type==="side-effect")continue;let r=n.rawSpecifier;if(r.endsWith(".*"))continue;let o=r.split(".").pop();o&&e.set(o,r)}return e}function sf(t,e){let n=t;if(n.name==="GenericType"&&(n=n.firstChild),!n)return null;if(n.name==="TypeName")return e.slice(n.from,n.to);if(n.name==="ScopedTypeName"){let r=null;for(let o=n.firstChild;o;o=o.nextSibling)o.name==="TypeName"&&(r=o);return r?e.slice(r.from,r.to):null}return null}function af(t,e,n){let r=[];function o(i,a){let c=i.type.name;if(c==="MethodInvocation"){let f=i.firstChild;if(f?.type.name==="Identifier"){let m=n.get(e.slice(f.from,f.to)),h=i.getChild("MethodName");m&&h&&r.push({from:a,to:e.slice(h.from,h.to),toSpecifier:m})}}else if(c==="ObjectCreationExpression"){let f=i.getChild("TypeName")??i.getChild("GenericType")??i.getChild("ScopedTypeName"),m=f&&sf(f,e);if(m){let h=n.get(m);h&&r.push({from:a,to:"new",toSpecifier:h})}}let p=i.firstChild;for(;p;)o(p,a),p=p.nextSibling}let s=t.cursor();do if(s.name==="MethodDeclaration"||s.name==="ConstructorDeclaration"){let i=s.node.getChild("Definition"),a=s.node.getChild("Block")??s.node.getChild("ConstructorBody");if(i&&a){let c=e.slice(i.from,i.to),p=lr(s.node,e),f=p&&s.name==="MethodDeclaration"?`${p}.${c}`:c;o(a,f)}}while(s.next());return r}function Ks(t,e){let n=[],r=new Map,o=new Set,s=new Set,i;try{i=tf.parse(e)}catch{return{imports:[],exports:[],tags:[],category:H(t,[])}}let a=i.cursor();do switch(a.name){case"LineComment":{let b=e.slice(a.from,a.to).match(nf);b?.[1]&&o.add(b[1]);break}case"MarkerAnnotation":case"Annotation":{let b=a.node.getChild("Identifier");b&&s.add(e.slice(b.from,b.to));break}case"ImportDeclaration":{let b=rf(a.node,e);b&&n.push({fromPath:t,toPath:"",rawSpecifier:b.specifier,isExternal:!0,isStyle:!1,type:"static"});break}case"ClassDeclaration":case"InterfaceDeclaration":case"EnumDeclaration":case"AnnotationTypeDeclaration":{if(a.node.parent?.name==="Program"){let b=a.node.getChild("Definition");if(b){let v=e.slice(b.from,b.to);r.has(v)||r.set(v,{name:v})}}break}}while(a.next());let c=$(e,!1);c&&n.push(te(t,c));let p=H(t,n.map(b=>b.rawSpecifier),{typeNames:[...r.keys()],annotations:[...s]}),{complexity:f,cognitiveComplexity:m}=cr(i.topNode,e),h=Us(i,e),y=p==="test"?[]:af(i,e,of(n));return{imports:n,exports:Array.from(r.values()),tags:Array.from(o).map(b=>({name:b,kind:"comment-marker"})),category:p,rawCallEdges:y,complexity:f,cognitiveComplexity:m,...h.length>0?{functions:h}:{}}}var nf,Vs=d(()=>{"use strict";l();Js();Re();nf=/\/\/\s*@tag\s+([a-zA-Z0-9_-]+)/});function qs(t,e){let n=Ne(e),o=ee(e).split(`
|
|
10
|
+
`),s=[],i=new Set;for(let p of o){let f=p.match(cf);if(f?.[1]){s.push(De(t,f[1]));continue}let m=p.match(lf);if(m?.[2]){i.add(m[2]);continue}let h=p.match(pf);if(h?.[1]){i.add(h[1]);continue}let y=p.match(ff);y?.[1]&&i.add(y[1])}let a=$(e,!1);a&&s.push(te(t,a));let c=Array.from(i,p=>({name:p}));return{imports:s,exports:c,tags:Array.from(n).map(p=>({name:p,kind:"comment-marker"})),category:H(t,s.map(p=>p.rawSpecifier),{typeNames:[...i],annotations:Pe(e).annotations})}}var cf,pr,lf,pf,ff,Ys=d(()=>{"use strict";l();Re();cf=/^\s*import\s+([\w.]+(?:\.\*)?)(?:\s+as\s+\w+)?\s*$/,pr="(?:public\\s+|internal\\s+|private\\s+|protected\\s+|open\\s+|abstract\\s+|final\\s+|sealed\\s+|data\\s+|value\\s+|inline\\s+|noinline\\s+|crossinline\\s+|external\\s+|expect\\s+|actual\\s+|suspend\\s+|operator\\s+|infix\\s+|tailrec\\s+|const\\s+|lateinit\\s+)*",lf=new RegExp(`^(?:@[\\w.]+(?:\\([^)]*\\))?\\s+)*${pr}(?:(?:enum|annotation)\\s+)?(class|interface|object|typealias)\\s+([A-Za-z_][A-Za-z0-9_]*)`),pf=new RegExp(`^(?:@[\\w.]+(?:\\([^)]*\\))?\\s+)*${pr}fun\\s+(?:<[^>]*>\\s*)?(?:[A-Za-z_][\\w.]*(?:<[^>]*>)?\\.)?([A-Za-z_][A-Za-z0-9_]*)\\s*[(<]`),ff=new RegExp(`^(?:@[\\w.]+(?:\\([^)]*\\))?\\s+)*${pr}(?:val|var)\\s+(?:<[^>]*>\\s*)?([A-Za-z_][A-Za-z0-9_]*)`)});import mf from"livescript";function ae(t){if(t){if(typeof t.value=="string")return t.value;if(typeof t.base?.value=="string")return t.base.value}}function uf(t){if(!t)return[];if(t.constructor?.name==="Class"){let n=ae(t.title);return n?[{name:n}]:[]}if(t.constructor?.name==="Obj"&&Array.isArray(t.items))return t.items.map(n=>ae(n.key)??ae(n.val)).filter(n=>!!n).map(n=>({name:n}));let e=ae(t);return e?[{name:e}]:[]}function df(t){let e=t.constructor?.name||t.type;if(e==="Assign"&&t.left?.constructor?.name==="Chain"){let n=t.left,r=ae(n.head),s=n.tails?.[0]?.key?.name;if(r==="module"&&s==="exports")return uf(t.right);if(r==="exports"&&typeof s=="string")return[{name:s}];if(n.head?.verb==="out"&&typeof s=="string")return[{name:s}]}if(e==="Import"&&t.left?.verb==="out"){let n=t.right;if(n?.constructor?.name==="Obj"&&Array.isArray(n.items))return n.items.map(r=>ae(r.val)??ae(r.key)).filter(r=>!!r).map(r=>({name:r}))}return[]}function hf(t,e){let n=t.constructor?.name||t.type;if(n==="Import"){let r=t.right?.value;if(typeof r=="string"){let o=Z(r);return{fromPath:e,toPath:"",rawSpecifier:o,isStyle:M(o),type:"static"}}}if(n==="Chain"&&t.head?.value==="require"){let r=t.tails?.[0];if(r?.constructor?.name==="Call"||r?.type==="Call"){let o=r.args?.[0]?.value;if(typeof o=="string"){let s=Z(o);return{fromPath:e,toPath:"",rawSpecifier:s,isStyle:M(s),type:"require"}}}}return null}function fr(t,e,n){if(!t||typeof t!="object")return[];let r=[],o=hf(t,e);o&&r.push(o),n.push(...df(t));for(let s in t){if(gf.has(s))continue;let i=t[s];if(!(!i||typeof i!="object"))if(Array.isArray(i))for(let a of i)r.push(...fr(a,e,n));else r.push(...fr(i,e,n))}return r}function Qs(t,e){let n=we(e),r=Ee(t,n),o=[],s=[];try{o=fr(mf.ast(e),t,s)}catch{}let i=new Set,a=s.filter(c=>i.has(c.name)?!1:(i.add(c.name),!0));return{imports:o,exports:a,tags:Array.from(n).map(c=>({name:c,kind:"comment-marker"})),category:r}}var gf,Xs=d(()=>{"use strict";l();X();Ft();gf=new Set(["first_line","first_column","last_line","last_column","line","column"])});import yf from"luaparse";function xf(t,e){let n=[];function r(o){if(!(!o||typeof o!="object")){if((o.type==="CallExpression"||o.type==="StringCallExpression")&&o.base?.type==="Identifier"&&o.base?.name==="require"){let s;if(o.type==="CallExpression"){let i=o.arguments?.[0];i?.type==="StringLiteral"&&(s=Z(i.raw))}else if(o.type==="StringCallExpression"){let i=o.argument;i?.type==="StringLiteral"&&(s=Z(i.raw))}s&&n.push({fromPath:e,toPath:"",rawSpecifier:s,isStyle:M(s),type:"require"})}for(let s in o){if(s==="loc")continue;let i=o[s];if(i&&typeof i=="object")if(Array.isArray(i))for(let a of i)r(a);else r(i)}}}return r(t),n}function bf(t){let e=new Set;for(let n of t)n.type==="LocalStatement"&&n.variables.forEach((r,o)=>{n.init[o]?.type==="TableConstructorExpression"&&e.add(r.name)});return e}function Sf(t){let e=t[t.length-1];if(e?.type!=="ReturnStatement")return[];let n=e.arguments[0];if(n?.type!=="TableConstructorExpression")return[];let r=[];for(let o of n.fields)o.type==="TableKeyString"&&r.push({name:o.key.name});return r}function Cf(t){let e=t.body,n=bf(e),r=Sf(e);for(let s of e)if(s.type==="FunctionDeclaration")s.identifier?.type==="MemberExpression"?s.identifier.base.type==="Identifier"&&n.has(s.identifier.base.name)&&r.push({name:s.identifier.identifier.name}):s.identifier?.type==="Identifier"&&!s.isLocal&&r.push({name:s.identifier.name});else if(s.type==="AssignmentStatement")for(let i of s.variables)i.type==="MemberExpression"&&i.base.type==="Identifier"&&n.has(i.base.name)&&r.push({name:i.identifier.name});let o=new Set;return r.filter(s=>o.has(s.name)?!1:(o.add(s.name),!0))}function Zs(t,e){let n=we(e),r=Ee(t,n),o=[],s=[];try{let i=yf.parse(e);o=xf(i,t),s=Cf(i)}catch{}return{imports:o,exports:s,tags:Array.from(n).map(i=>({name:i,kind:"comment-marker"})),category:r}}var ei=d(()=>{"use strict";l();X();Ft()});async function Ef(){return ti??=(async()=>{let{unified:t}=await import("unified"),e=(await import("remark-parse")).default;return t().use(e)})(),ti}function Tf(t){let e=t.trim();return e.length===0||e.startsWith("#")||kf.some(n=>e.startsWith(n))}function Ff(t,e){let n=t.match(wf);return n?n.map(r=>({fromPath:e,toPath:"",rawSpecifier:r,isStyle:!1,type:"static",isDocReference:!0})):[]}function ni(t,e,n){if(t.type==="link"&&typeof t.url=="string"&&!Tf(t.url)&&n.push({fromPath:e,toPath:"",rawSpecifier:t.url,isStyle:!1,type:"static",isDocReference:!0}),(t.type==="code"||t.type==="inlineCode")&&typeof t.value=="string"&&n.push(...Ff(t.value,e)),Array.isArray(t.children))for(let r of t.children)ni(r,e,n)}async function ri(t,e){let r=(await Ef()).parse(e),o=[];ni(r,t,o);let s=new Set;return{imports:o.filter(a=>s.has(a.rawSpecifier)?!1:(s.add(a.rawSpecifier),!0)),exports:[],tags:[],category:"other"}}var kf,vf,wf,ti,oi=d(()=>{"use strict";l();kf=["http://","https://","mailto:","//"],vf="ts|tsx|js|jsx|mjs|cjs|py|go|lua|css|scss|less|styl|coffee|ls|feature|md|mdx|json",wf=new RegExp(`(?:\\.{1,2}/)?[\\w.-]+(?:/[\\w.-]+)*\\.(?:${vf})\\b`,"g")});function Nf(t){let e=1;function n(r){switch(r.type.name){case"IfStatement":{e+=se(r).filter(s=>s.type.name==="if"||s.type.name==="elif").length;break}case"TryStatement":{e+=se(r).filter(s=>s.type.name==="except").length;break}case"ForStatement":case"WhileStatement":case"ConditionalExpression":e++;break;case"and":case"or":e++;break}let o=r.firstChild;for(;o;)n(o),o=o.nextSibling}return n(t),e}function Pf(t,e){let n=0,r=se(t),o=0,s=0;for(;s<r.length;){let i=r[s];if(i?.type.name==="if"||i?.type.name==="elif"){let a=o>0;n+=a?1:1+e;let c=a?e:e+1,p=r[s+1],f=r[s+2];p&&(n+=U(p,c)),f&&(n+=U(f,c)),o++,s+=3}else if(i?.type.name==="else"){n+=1;let a=r[s+1];a&&(n+=U(a,e+1)),s+=2}else s++}return n}function Df(t,e){let n=0,r=se(t),o=0;for(;o<r.length;){let s=r[o];if(s?.type.name==="except"){for(n+=1+e,o++;o<r.length&&r[o]?.type.name!=="Body";)n+=U(r[o],e),o++;o<r.length&&(n+=U(r[o],e),o++)}else s?.type.name==="Body"&&(n+=U(s,e)),o++}return n}function si(t,e){let n=1+e,r=t.firstChild;for(;r;)n+=U(r,e+1),r=r.nextSibling;return n}function Rf(t,e){let n=0,r=t.firstChild;for(;r;)n+=U(r,e),r=r.nextSibling;return n}function U(t,e){let n=t.type.name;switch(n){case"IfStatement":return Pf(t,e);case"TryStatement":return Df(t,e);case"ForStatement":case"WhileStatement":return si(t,e);default:{let r=n==="ConditionalExpression"||n==="and"||n==="or"?1:0;return e>0&&(n==="FunctionDefinition"||n==="LambdaExpression")?r+si(t,e):r+Rf(t,e)}}}function If(t){return U(t,0)}function mr(t){return{complexity:Nf(t),cognitiveComplexity:If(t)}}function ii(t,e){let n=[];function r(i,a){let{complexity:c,cognitiveComplexity:p}=mr(i);n.push({name:a,line:ie(e,i.from),complexity:c,cognitiveComplexity:p})}function o(i){let a=i.firstChild;for(;a;)s(a),a=a.nextSibling}function s(i){if(i.type.name==="ClassDefinition"){let a=i.getChild("VariableName"),c=a?e.slice(a.from,a.to):void 0,p=i.getChild("Body");if(p){let f=p.firstChild;for(;f;){if(f.type.name==="FunctionDefinition"){let m=f.getChild("VariableName"),h=m?e.slice(m.from,m.to):void 0;h&&r(f,c?`${c}.${h}`:h),o(f)}else s(f);f=f.nextSibling}}return}if(i.type.name==="FunctionDefinition"){let a=i.getChild("VariableName");a&&r(i,e.slice(a.from,a.to)),o(i);return}o(i)}return s(t.topNode),n}var ai=d(()=>{"use strict";l();Nt()});import Af from"path";import{parser as Mf}from"@lezer/python";function ci(t,e){let n=[],r=[],o=new Set,s=Af.basename(t).toLowerCase(),i=Mf.parse(e),a=i.cursor();do switch(a.name){case"Comment":{let y=e.slice(a.from,a.to).match(/#\s*@tag\s+([a-zA-Z0-9_-]+)/);y?.[1]&&o.add(y[1]);break}case"ImportStatement":{for(let y of Of(a.node,e,t))n.push(y);break}case"FunctionDefinition":case"ClassDefinition":{let y=a.node.parent;if(y?.name==="Script"||y?.name==="DecoratedStatement"&&y.parent?.name==="Script"){let v=a.node.getChild("VariableName");v&&r.push({name:e.slice(v.from,v.to)})}break}case"AssignStatement":{if(a.node.parent?.name==="Script"){let y=a.node.firstChild;y?.name==="VariableName"&&r.push({name:e.slice(y.from,y.to)})}break}}while(a.next());let c=zf(s,n,o);c==="test"&&o.add("test");let{complexity:p,cognitiveComplexity:f}=mr(i.topNode),m=ii(i,e),h=c==="test"?[]:Wf(i,e);return{imports:n,exports:r,tags:Array.from(o).map(y=>({name:y,kind:"comment-marker"})),category:c,rawCallEdges:h,complexity:p,cognitiveComplexity:f,...m.length>0?{functions:m}:{}}}function Of(t,e,n){let r=t.firstChild;return r?r.name==="from"?_f(t,e,n):Gf(t,e,n):[]}function _f(t,e,n){let r=t.firstChild;if(!r)return[];let o=r.nextSibling;for(;o&&o.name!=="import";)o=o.nextSibling;if(!o)return[];let s=e.slice(r.to,o.from).trim(),i=jf(o.nextSibling,e);if(!i.length)return[];let a=0;for(;a<s.length&&s[a]===".";)a++;let c=s.slice(a);if(a===0)return[Ve(n,s,i,!0)];let p=a===1?"./":"../".repeat(a-1);return c?[Ve(n,p+c.replace(/\./g,"/"),i,!1)]:i[0]==="*"?[Ve(n,p.slice(0,-1),["*"],!1)]:i.map(f=>Ve(n,p+f,[f],!1))}function Gf(t,e,n){let r=[],o=t.firstChild?.nextSibling??null;for(;o;){if(o.name==="VariableName"){let s=e.slice(o.from,o.to);for(;o.nextSibling?.name==="."&&o.nextSibling.nextSibling?.name==="VariableName";)o=o.nextSibling.nextSibling,s+=`.${e.slice(o.from,o.to)}`;o.nextSibling?.name==="as"&&(o=o.nextSibling.nextSibling??o.nextSibling),r.push(Ve(n,s,["*"],!0))}o=o.nextSibling}return r}function jf(t,e){let n=[],r=t;for(;r;)r.name==="*"?n.push("*"):r.name==="VariableName"&&(n.push(e.slice(r.from,r.to)),r.nextSibling?.name==="as"&&(r=r.nextSibling.nextSibling??r.nextSibling)),r=r.nextSibling;return n}function $f(t,e){let n=new Map,r=t.cursor();do{if(r.name!=="ImportStatement")continue;let s=r.node.firstChild;if(s?.type.name!=="from")continue;let i=s.nextSibling;for(;i&&i.type.name!=="import";)i=i.nextSibling;if(!i)continue;let a=e.slice(s.to,i.from).trim(),c=0;for(;c<a.length&&a[c]===".";)c++;let p=a.slice(c),f=c<=1?"./":"../".repeat(c-1),m=i.nextSibling;for(;m;){if(m.type.name==="VariableName"){let h=e.slice(m.from,m.to),y=h;if(m.nextSibling?.type.name==="as"){let v=m.nextSibling.nextSibling;v?.type.name==="VariableName"&&(y=e.slice(v.from,v.to),m=v)}let b=c===0?a:p?f+p.replace(/\./g,"/"):f+h;n.set(y,b)}m=m.nextSibling}}while(r.next());return n}function Wf(t,e){let n=$f(t,e),r=[];function o(a,c){if(a.type.name==="CallExpression"&&a.firstChild?.type.name==="VariableName"){let f=a.firstChild,m=e.slice(f.from,f.to),h=n.get(m);h&&r.push({from:c,to:m,toSpecifier:h})}let p=a.firstChild;for(;p;)o(p,c),p=p.nextSibling}function s(a){let c=a.firstChild;for(;c;)i(c),c=c.nextSibling}function i(a){if(a.type.name==="ClassDefinition"){let c=a.getChild("VariableName"),p=c?e.slice(c.from,c.to):void 0,f=a.getChild("Body");if(f){let m=f.firstChild;for(;m;){if(m.type.name==="FunctionDefinition"){let h=m.getChild("VariableName"),y=h?e.slice(h.from,h.to):void 0;y&&o(m,p?`${p}.${y}`:y)}else i(m);m=m.nextSibling}}return}if(a.type.name==="FunctionDefinition"){let c=a.getChild("VariableName");c&&o(a,e.slice(c.from,c.to));return}s(a)}return i(t.topNode),r}function Ve(t,e,n,r){return{fromPath:t,toPath:"",rawSpecifier:e,isStyle:!1,isExternal:r,type:"static",symbols:n.length>0?n:void 0}}function zf(t,e,n){return t.startsWith("test_")||t.endsWith("_test.py")?"test":t==="conftest.py"||t==="setup.py"?"config":n.has("test")||e.some(r=>Lf.has(r.rawSpecifier))?"test":"logic"}var Lf,li=d(()=>{"use strict";l();ai();Lf=new Set(["pytest","unittest","nose","hypothesis"])});function Uf(t,e){let n=e.split("=>")[0]?.trim();return n?n==="_"||n==="*"||n==="given"?`${t}.*`:`${t}.${n}`:null}function Jf(t){let e=t.indexOf("{");if(e!==-1){let r=t.indexOf("}",e),o=t.slice(0,e).trim().replace(/\.$/,""),s=t.slice(e+1,r===-1?void 0:r);return o?s.split(",").map(i=>Uf(o,i.trim())).filter(i=>i!=null):[]}let n=[];for(let r of t.split(",")){let o=r.trim().replace(/\s+as\s+\w+$/,"");if(o)if(o.endsWith("._")||o.endsWith(".*")||o.endsWith(".given")){let s=o.replace(/\.(_|\*|given)$/,"");s&&n.push(`${s}.*`)}else n.push(o)}return n}function pi(t,e){let n=Ne(e),o=ee(e).split(`
|
|
11
|
+
`),s=[],i=new Set;for(let p of o){let f=p.match(Bf);if(f?.[1]){for(let h of Jf(f[1]))s.push(De(t,h));continue}let m=p.match(Hf);m?.[2]&&i.add(m[2])}let a=$(e,!0);a&&s.push(te(t,a));let c=Array.from(i,p=>({name:p}));return{imports:s,exports:c,tags:Array.from(n).map(p=>({name:p,kind:"comment-marker"})),category:H(t,s.map(p=>p.rawSpecifier),{typeNames:[...i],annotations:Pe(e).annotations})}}var Bf,Hf,fi=d(()=>{"use strict";l();Re();Bf=/^\s*import\s+(.+?)\s*$/,Hf=/^(?:@\w+\s+)*(?:private\s+|protected\s+|final\s+|sealed\s+|abstract\s+|implicit\s+|case\s+)*(class|trait|object|type|enum)\s+([A-Za-z_$][A-Za-z0-9_$]*)/});import k from"typescript";function Kf(t){let e=1;function n(r){switch(r.kind){case k.SyntaxKind.IfStatement:case k.SyntaxKind.ConditionalExpression:case k.SyntaxKind.ForStatement:case k.SyntaxKind.ForInStatement:case k.SyntaxKind.ForOfStatement:case k.SyntaxKind.WhileStatement:case k.SyntaxKind.DoStatement:case k.SyntaxKind.CatchClause:case k.SyntaxKind.CaseClause:e++;break;case k.SyntaxKind.BinaryExpression:{let o=r.operatorToken.kind;(o===k.SyntaxKind.AmpersandAmpersandToken||o===k.SyntaxKind.BarBarToken||o===k.SyntaxKind.QuestionQuestionToken)&&e++;break}}k.forEachChild(r,n)}return n(t),e}function ui(t,e,n){let r=n?1:1+e,o=n?e:e+1;return r+=ce(t.expression,o,!1),r+=ce(t.thenStatement,o,!1),t.elseStatement&&(k.isIfStatement(t.elseStatement)?r+=ui(t.elseStatement,e,!0):r+=1+ce(t.elseStatement,e+1,!1)),r}function mi(t,e){let n=1+e;return k.forEachChild(t,r=>{n+=ce(r,e+1,!1)}),n}function Vf(t,e){let n=1+e;return k.forEachChild(t,r=>{n+=ce(r,e,!1)}),n}function qf(t,e){let n=0;return k.forEachChild(t,r=>{n+=ce(r,e,!1)}),n}function Yf(t){let e=t.operatorToken.kind;return e===k.SyntaxKind.AmpersandAmpersandToken||e===k.SyntaxKind.BarBarToken||e===k.SyntaxKind.QuestionQuestionToken}function ce(t,e,n){if(k.isIfStatement(t))return ui(t,e,n);if(k.isForStatement(t)||k.isForInStatement(t)||k.isForOfStatement(t)||k.isWhileStatement(t)||k.isDoStatement(t)||k.isSwitchStatement(t))return mi(t,e);if(k.isCatchClause(t))return Vf(t,e);let r=0;return k.isConditionalExpression(t)&&(r+=1),k.isBinaryExpression(t)&&Yf(t)&&(r+=1),e>0&&(k.isFunctionDeclaration(t)||k.isFunctionExpression(t)||k.isArrowFunction(t))?r+mi(t,e):r+qf(t,e)}function Qf(t){return ce(t,0,!1)}function ur(t){return{complexity:Kf(t),cognitiveComplexity:Qf(t)}}var di=d(()=>{"use strict";l()});import T from"typescript";function gi(t,e){Xf(t,e),em(t,e),tm(t,e),nm(t,e)}function Xf(t,e){if((T.isFunctionDeclaration(t)||T.isVariableDeclaration(t))&&t.name&&T.isIdentifier(t.name)&&Zf(t)){let n;if(T.isFunctionDeclaration(t))n="function";else{let r=t.initializer;n=r&&(T.isArrowFunction(r)||T.isFunctionExpression(r))?"function":"variable"}e.tags.add({name:t.name.text,kind:n})}}function Zf(t){if(T.isFunctionDeclaration(t))return T.isSourceFile(t.parent);let e=t.parent?.parent;return!!e&&T.isSourceFile(e.parent)}function em(t,e){if(!T.isStringLiteral(t))return;let n=t.text.match(/@[\w-]+/g);if(n)for(let r of n)e.tags.add({name:r.substring(1),kind:"comment-marker"})}function tm(t,e){if(!T.isSourceFile(t))return;let n=/@tag\s+([a-zA-Z0-9_-]+)/g,r=t.getFullText(),o=n.exec(r);for(;o!==null;)o[1]&&e.tags.add({name:o[1],kind:"comment-marker"}),o=n.exec(r)}function nm(t,e){if(T.isCallExpression(t)&&rm(t.expression))for(let n of t.arguments)T.isObjectLiteralExpression(n)&&om(n,e)}function rm(t){return T.isIdentifier(t)?dr.has(t.text):!!(T.isPropertyAccessExpression(t)&&(dr.has(t.name.text)||T.isIdentifier(t.expression)&&dr.has(t.expression.text)))}function om(t,e){for(let n of t.properties){if(!T.isPropertyAssignment(n)||!T.isIdentifier(n.name)||n.name.text!=="tags"&&n.name.text!=="tag")continue;let{initializer:r}=n,o=T.isArrayLiteralExpression(r)?r.elements.filter(T.isStringLiteral):n.name.text==="tag"&&T.isStringLiteral(r)?[r]:[];for(let s of o)e.tags.add({name:s.text.replace(/^@/,""),kind:"comment-marker"})}}var dr,hi=d(()=>{"use strict";l();dr=new Set(["test","describe","it"])});import yi from"path";import x from"typescript";function gr(t,e,n){let r=[],o=new Map,s=new Set,i=x.createSourceFile(t,e,x.ScriptTarget.Latest,!0,n==="typescript"?x.ScriptKind.TSX:x.ScriptKind.JSX),a={filePath:t,imports:r,exports:o,tags:s,rawCallEdges:[],sourceFile:i,hasUI:!1,hasTypesOnly:!0,totalStatements:0,exportStatements:0},c=v=>{cm(v,a),x.forEachChild(v,c)};c(i);let p=bm(t,a);(p==="test"||p==="barrel")&&s.add({name:p,kind:"comment-marker"}),p!=="test"&&Sm(a,i);let f=i.statements[0],m=f?bi(f):void 0,{complexity:h,cognitiveComplexity:y}=ur(i),b=sm(i);return{imports:r,exports:Array.from(o.values()),tags:Array.from(s),category:p,rawCallEdges:a.rawCallEdges??[],complexity:h,cognitiveComplexity:y,...b.length>0?{functions:b}:{},...m!==void 0?{description:m}:{}}}function sm(t){let e=[],n=(o,s)=>{let{complexity:i,cognitiveComplexity:a}=ur(s),c=t.getLineAndCharacterOfPosition(s.getStart(t)).line+1;e.push({name:o,line:c,complexity:i,cognitiveComplexity:a})},r=(o,s)=>{if(x.isFunctionDeclaration(o)&&o.name&&o.body?n(o.name.text,o):x.isVariableDeclaration(o)&&x.isIdentifier(o.name)&&o.initializer&&(x.isArrowFunction(o.initializer)||x.isFunctionExpression(o.initializer))?n(o.name.text,o.initializer):s&&x.isMethodDeclaration(o)&&x.isIdentifier(o.name)&&o.body?n(`${s}.${o.name.text}`,o):s&&x.isConstructorDeclaration(o)&&o.body?n(`${s}.constructor`,o):s&&x.isGetAccessorDeclaration(o)&&x.isIdentifier(o.name)&&o.body?n(`${s}.get ${o.name.text}`,o):s&&x.isSetAccessorDeclaration(o)&&x.isIdentifier(o.name)&&o.body&&n(`${s}.set ${o.name.text}`,o),x.isClassDeclaration(o)&&o.name){let i=o.name.text;x.forEachChild(o,a=>r(a,i));return}x.forEachChild(o,i=>r(i,s))};return r(t,void 0),e}function xi(t,e,n,r){let o={name:t},s=bi(n);s!==void 0&&(o.doc=s);let i=im(e);i!==void 0&&(o.flags=i);let a=am(e,r);return a!==void 0&&(o.signature=a),o}function bi(t){let e=x.getJSDocCommentsAndTags(t);for(let n of e)if(x.isJSDoc(n)&&n.comment)return x.getTextOfJSDocComment(n.comment)||void 0}function im(t){let e=new Set(["deprecated","internal","public","alpha","beta"]),n=x.getJSDocTags(t).map(r=>r.tagName.text).filter(r=>e.has(r));return n.length>0?n:void 0}function am(t,e){let n=x.createPrinter({removeComments:!0}),r=o=>n.printNode(x.EmitHint.Unspecified,o,e);if(x.isFunctionDeclaration(t)||x.isMethodDeclaration(t)){let o=t.parameters.map(r).join(", "),s=t.type?r(t.type):"void";return`${t.typeParameters?`<${t.typeParameters.map(a=>a.name.text).join(", ")}>`:""}(${o}) => ${s}`}if(x.isVariableDeclaration(t)){if(t.type)return r(t.type);if(t.initializer&&(x.isArrowFunction(t.initializer)||x.isFunctionExpression(t.initializer))){let o=t.initializer,s=o.parameters.map(r).join(", "),i=o.type?r(o.type):"unknown";return`(${s}) => ${i}`}return}if(x.isClassDeclaration(t)&&t.name)return`class ${t.name.text}`;if(x.isInterfaceDeclaration(t))return`interface ${t.name.text}`;if(x.isTypeAliasDeclaration(t))return r(t.type);if(x.isEnumDeclaration(t))return`enum ${t.name.text}`}function cm(t,e){lm(t,e),pm(t,e),mm(t,e),um(t,e),xm(t,e),gi(t,e)}function lm(t,e){if(!x.isSourceFile(t))return;let n=t.statements.filter(r=>!x.isEmptyStatement(r));e.totalStatements=n.length,e.exportStatements=n.filter(r=>x.isExportDeclaration(r)||x.isExportAssignment(r)||hr(r)).length}function pm(t,e){if(x.isJsxElement(t)||x.isJsxSelfClosingElement(t)||x.isJsxFragment(t)){e.hasUI=!0,e.hasTypesOnly=!1;return}if(x.isFunctionDeclaration(t)||x.isMethodDeclaration(t)||x.isArrowFunction(t)||x.isClassDeclaration(t)||x.isVariableStatement(t)||x.isEnumDeclaration(t)){e.hasTypesOnly=!1;return}x.isExportDeclaration(t)&&!fm(t)&&(e.hasTypesOnly=!1)}function fm(t){return t.isTypeOnly?!0:!t.exportClause||!x.isNamedExports(t.exportClause)?!1:t.exportClause.elements.every(e=>e.isTypeOnly)}function mm(t,e){if(!x.isImportDeclaration(t)||!t.moduleSpecifier||!x.isStringLiteral(t.moduleSpecifier))return;let n=[];if(t.importClause&&(t.importClause.name&&n.push("default"),t.importClause.namedBindings))if(x.isNamedImports(t.importClause.namedBindings))for(let o of t.importClause.namedBindings.elements)n.push(o.name.text);else x.isNamespaceImport(t.importClause.namedBindings)&&n.push("*");let r=n.length>0?"static":"side-effect";e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:t.moduleSpecifier.text,isStyle:M(t.moduleSpecifier.text),type:r,symbols:n.length>0?n:void 0})}function um(t,e){x.isExportDeclaration(t)?dm(t,e):x.isExportAssignment(t)?e.exports.set("default",{name:"default"}):hr(t)&&ym(t,e)}function dm(t,e){if(t.moduleSpecifier&&x.isStringLiteral(t.moduleSpecifier))gm(t,t.moduleSpecifier.text,e);else if(t.exportClause&&x.isNamedExports(t.exportClause))for(let n of t.exportClause.elements){let r=n.name.text;e.exports.set(r,{name:r})}}function gm(t,e,n){let r=hm(t),o={fromPath:n.filePath,toPath:"",rawSpecifier:e,isStyle:M(e),type:"re-export"};r.length>0&&(o.symbols=r),n.imports.push(o)}function hm(t){return t.exportClause?x.isNamedExports(t.exportClause)?t.exportClause.elements.map(e=>e.name.text):[]:["*"]}function ym(t,e){if((x.isFunctionDeclaration(t)||x.isClassDeclaration(t)||x.isInterfaceDeclaration(t)||x.isTypeAliasDeclaration(t)||x.isEnumDeclaration(t))&&t.name){let r=t.name.text;e.exports.set(r,xi(r,t,t,e.sourceFile));return}if(x.isVariableStatement(t)){for(let r of t.declarationList.declarations)if(x.isIdentifier(r.name)){let o=r.name.text;e.exports.set(o,xi(o,r,t,e.sourceFile))}}}function xm(t,e){if(!x.isCallExpression(t))return;let n=t.arguments[0];!n||!x.isStringLiteral(n)||(t.expression.kind===x.SyntaxKind.ImportKeyword?e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:n.text,isStyle:M(n.text),type:"dynamic"}):x.isIdentifier(t.expression)&&t.expression.text==="require"&&e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:n.text,isStyle:M(n.text),type:"require"}))}function bm(t,e){let n=yi.basename(t).toLowerCase(),r=yi.extname(t).toLowerCase();return ze().some(s=>n.includes(s))?"test":Zo(n)?"config":e.imports.some(s=>Tn().some(i=>s.rawSpecifier.includes(i)))?"test":r===".tsx"||r===".jsx"||e.hasUI?"ui":e.hasTypesOnly&&e.totalStatements>0?"type-only":e.totalStatements>0&&e.exportStatements/e.totalStatements>Pn()?"barrel":"logic"}function hr(t){return x.canHaveModifiers(t)&&x.getModifiers(t)?.some(e=>e.kind===x.SyntaxKind.ExportKeyword)===!0}function Sm(t,e){let n=t.rawCallEdges??[];t.rawCallEdges=n;let r=new Map;for(let o of e.statements){if(!x.isImportDeclaration(o)||!x.isStringLiteral(o.moduleSpecifier))continue;let s=o.moduleSpecifier.text,i=o.importClause;if(i&&(i.name&&r.set(i.name.text,s),i.namedBindings&&x.isNamedImports(i.namedBindings)))for(let a of i.namedBindings.elements)r.set(a.name.text,s)}if(r.size!==0)for(let o of e.statements){let s=km(o);if(s){let i=vm(o);i&&Dt(i,s,r,n);continue}x.isClassDeclaration(o)&&o.name&&Cm(o,o.name.text,r,n)}}function Cm(t,e,n,r){for(let o of t.members)x.isMethodDeclaration(o)&&o.body&&x.isIdentifier(o.name)?Dt(o.body,`${e}.${o.name.text}`,n,r):x.isConstructorDeclaration(o)&&o.body&&Dt(o.body,`${e}.constructor`,n,r)}function km(t){if(hr(t)){if(x.isFunctionDeclaration(t)&&t.name)return t.name.text;if(x.isVariableStatement(t)){for(let e of t.declarationList.declarations)if(x.isIdentifier(e.name)&&e.initializer&&(x.isArrowFunction(e.initializer)||x.isFunctionExpression(e.initializer)))return e.name.text}}}function vm(t){if(x.isFunctionDeclaration(t))return t.body;if(x.isVariableStatement(t)){for(let e of t.declarationList.declarations)if(e.initializer&&(x.isArrowFunction(e.initializer)||x.isFunctionExpression(e.initializer)))return e.initializer}}function Dt(t,e,n,r){if(x.isCallExpression(t)&&x.isIdentifier(t.expression)){let o=t.expression.text,s=n.get(o);s&&!r.some(i=>i.from===e&&i.to===o&&i.toSpecifier===s)&&r.push({from:e,to:o,toSpecifier:s})}x.forEachChild(t,o=>Dt(o,e,n,r))}var Si=d(()=>{"use strict";l();be();di();X();hi()});function Rt(t,e){if(e.length===0)return"ui";let n=!1;return t.walk(r=>{if(r.type==="rule")return n=!0,!1}),n?"ui":"barrel"}var Ci=d(()=>{"use strict";l()});import vi from"postcss";import*as wm from"postcss-less";function ki(t){return t.startsWith("~")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("data:")}function Tm(t){let e=t.trim();return e.length>0&&!e.startsWith("http://")&&!e.startsWith("https://")&&!e.startsWith("//")&&!e.startsWith("data:")&&!e.startsWith("#")}function Fm(t,e){let n=t.match(/^\(([^)]+)\)\s+['"]([^'"]+)['"]/);if(n){let s=n[1]?.trim()??"",i=n[2]??"";if(!i)return null;let a=wi.has(s)?"side-effect":"static";return{fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:a,...ki(i)?{isExternal:!0}:{}}}let r=t.match(/^url\(['"]?([^'")]+)['"]?\)/),o=r?r[1]?.trim()??"":t.match(/^['"]([^'"]+)['"]/)?.[1]??"";return o?{fromPath:e,toPath:"",rawSpecifier:o,isStyle:!0,type:"static",...ki(o)?{isExternal:!0}:{}}:null}function Nm(t,e){let n=[],r=/url\(['"]?([^'")]+)['"]?\)/g,o=r.exec(t);for(;o!==null;){let s=o[1]?.trim()??"";Tm(s)&&n.push({fromPath:e,toPath:"",rawSpecifier:s,isStyle:!0,type:"static"}),o=r.exec(t)}return n}function Ei(t,e){let n=[];return t.walk(r=>{if(r.type==="atrule"&&r.name==="import"){let o=Fm(r.params,e);o&&n.push(o)}r.type==="decl"&&n.push(...Nm(r.value,e))}),n}function Pm(t){return t.replace(/(?<!:)\/\/.*/g,"")}function Dm(t,e){let n=[],r=/@import\s+(?:\(([^)]+)\)\s+)?['"]([^'"]+)['"]/g,o=r.exec(t);for(;o!==null;){let s=o[1]?.trim()??"",i=o[2]??"";if(i){let a=wi.has(s)?"side-effect":"static";n.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:a})}o=r.exec(t)}return n}function It(t,e){let n=vi.parse(Pm(t));return{imports:Ei(n,e),root:n}}function Rm(t){let e=[],n=[];for(let r of t.nodes??[]){if(r.type!=="atrule")continue;let{value:o}=r;if(o===void 0)continue;let s=r.name;s&&(e.push({name:s}),n.push({name:s,kind:"variable"}))}return{exports:e,tags:n}}function At(t,e){try{let n=Em.parse(t),{exports:r,tags:o}=Rm(n);return{imports:Ei(n,e),root:n,exports:r,tags:o}}catch{return{imports:Dm(t,e),root:vi.parse(""),exports:[],tags:[]}}}var Em,wi,yr=d(()=>{"use strict";l();Em=wm,wi=new Set(["reference","inline"])});import{parse as Im}from"postcss-scss";function Ti(t){return t.startsWith("_")||t.startsWith("-")}function Am(t){return!!(t.startsWith("sass:")||t.startsWith("~")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||!t.startsWith(".")&&!t.startsWith("/")&&!t.startsWith("_"))}function Mm(t){let e=t.match(/^['"]([^'"]+)['"]/);if(!e?.[1])return{specifier:""};let n=e[1],o=t.match(/\bas\s+(\S+)/)?.[1];return o!==void 0?{specifier:n,alias:o}:{specifier:n}}function Lm(t){let e=[],n=[];for(let r of t.nodes??[]){if(r.type==="decl"&&r.prop.startsWith("$")){let o=r.prop.slice(1);if(!o||Ti(o))continue;e.push({name:o}),n.push({name:o,kind:"variable"});continue}if(r.type==="atrule"&&(r.name==="mixin"||r.name==="function")){let s=r.params.match(/^([\w-]+)/)?.[1];if(!s||Ti(s))continue;let i=r.params.trim();e.push(i.includes("(")?{name:s,signature:i}:{name:s}),n.push({name:s,kind:"function"})}}return{exports:e,tags:n}}function Mt(t,e){let n=Im(t),r=[];n.walk(i=>{if(i.type!=="atrule")return;let{name:a,params:c}=i;if(a!=="import"&&a!=="use"&&a!=="forward")return;let{specifier:p,alias:f}=Mm(c);if(!p)return;let m={fromPath:e,toPath:"",rawSpecifier:p,isStyle:!0,type:a==="forward"?"re-export":"static",...Am(p)?{isExternal:!0}:{}};f&&(m.symbols=[f]),r.push(m)});let{exports:o,tags:s}=Lm(n);return{imports:r,root:n,exports:o,tags:s}}var xr=d(()=>{"use strict";l()});function Fi(t,e){let n=[],r=/@require\s+['"]([^'"]+)['"]/g,o=r.exec(t);for(;o!==null;){let i=o[1];i&&n.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:"require"}),o=r.exec(t)}let s=/(?<!@)(?:import|require)\s*\(?\s*['"]([^'"]+)['"]/g;for(o=s.exec(t);o!==null;){let i=o[1];i&&n.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:"static"}),o=s.exec(t)}return n}function Ni(t,e){if(e.length===0)return"ui";try{let n=kn("stylus");return new n.Parser(t).parse().nodes.some(s=>s.constructor.name!=="Import")?"ui":"barrel"}catch{return t.replace(/^\s*@?(?:require|import)\b.*/gm,"").trim().length>0?"ui":"barrel"}}var Pi=d(()=>{"use strict";l()});function qe(t,e){let n=B(t);if(n==="stylus"){let s=Fi(e,t);return{imports:s,exports:[],tags:[],category:Ni(e,s)}}if(n==="scss"){let{imports:s,root:i,exports:a,tags:c}=Mt(e,t);return{imports:s,exports:a,tags:c,category:Rt(i,s)}}if(n==="less"){let{imports:s,root:i,exports:a,tags:c}=At(e,t);return{imports:s,exports:a,tags:c,category:Rt(i,s)}}let{imports:r,root:o}=It(e,t);return{imports:r,exports:[],tags:[],category:Rt(o,r)}}var Di=d(()=>{"use strict";l();X();Ci();yr();xr();Pi()});async function Ri(t,e){let n=B(t),r=Is(n);return r?r(t,e):{imports:[],exports:[],tags:[],category:"other"}}var Ii=d(()=>{"use strict";l();X();Ds();As();$s();zs();Vs();Ys();Xs();ei();oi();li();fi();Si();Ke();Di();be();X();Ke();for(let[t,e]of[["javascript",(n,r)=>gr(n,r,"javascript")],["typescript",(n,r)=>gr(n,r,"typescript")],["css",qe],["scss",qe],["less",qe],["stylus",qe],["coffeescript",Ps],["livescript",Qs],["lua",Zs],["python",ci],["go",js],["java",Ks],["kotlin",qs],["scala",pi],["groovy",Ws],["gherkin",rr],["markdown",ri]])Te(t,e)});import Ai from"path";function Om(t,e){let n=e.get(t.path);n!==void 0&&(t.coveragePct=n)}function Li(t,e){for(let n of t)if(n.isExternal){let r=n.rawSpecifier.startsWith("@")?n.rawSpecifier.split("/").slice(0,2).join("/"):n.rawSpecifier.split("/")[0];r&&!e.some(o=>o.name===r)&&e.push({name:r,kind:"library"})}}function _m(t,e,n){if(e.isExternal||!e.toPath)return;let r=n.get(e.toPath);r&&(r.category!=="logic"&&r.category!=="barrel"||(r.testedBy??=[],r.testedBy.includes(t.path)||r.testedBy.push(t.path)))}function Gm(t,e){if(t.type==="markdown")for(let n of t.imports){if(n.isExternal||!n.toPath)continue;let r=e.get(n.toPath);!r||r===t||(r.documentedBy??=[],r.documentedBy.includes(t.path)||r.documentedBy.push(t.path),r.category==="logic"&&(r.lastCommitAt??0)>(t.lastCommitAt??0)&&(t.staleFor??=[],t.staleFor.includes(r.path)||t.staleFor.push(r.path)))}}function Mi(t){return Math.round(t*1e4)/1e4}function jm(t,e){let n=[];for(let r of t.imports){if(r.isExternal||!r.toPath)continue;let o=e.get(r.toPath);if(!o||o.exports.length===0)continue;let s;if(r.symbols===void 0){if(r.type==="side-effect")continue;s=1}else r.symbols.includes("*")?s=1:s=r.symbols.length/o.exports.length;r.exportUsageRatio=Mi(Math.min(1,s)),n.push(r.exportUsageRatio)}n.length>0&&(t.avgExportUsage=Mi(n.reduce((r,o)=>r+o,0)/n.length),t.maxExportUsage=Math.max(...n))}function br(t,e,n){e&&(t.some(r=>r.name===e&&r.kind===n)||t.push({name:e,kind:n}))}function $m(t,e){let n=e.toPath,r=Ai.basename(n,Ai.extname(n)).replace(/\.(test|spec)$/,"");br(t.tags,r,"import")}function Wm(t,e){if(!(!e.symbols||e.symbols.includes("*")))for(let n of e.symbols)br(t.tags,n,"import")}function zm(t,e,n){let r=n.get(e.toPath);if(!(!r||r.category==="test"))for(let o of r.tags)o.kind==="comment-marker"&&br(t.tags,o.name,"comment-marker")}function Bm(t,e,n){!e.toPath||e.isExternal||($m(t,e),Wm(t,e),zm(t,e,n))}function Oi(t,e){for(let n of t.values())delete n.testedBy,delete n.documentedBy,delete n.staleFor,n.category==="test"&&(n.tags=n.tags.filter(r=>r.kind!=="import"));for(let n of t.values()){if(jm(n,t),e.size>0&&Om(n,e),n.category==="test")for(let r of n.imports)_m(n,r,t),Bm(n,r,t);Gm(n,t)}}var _i=d(()=>{"use strict";l()});function Sr(t){let e=new Map;for(let n of t.nodes.values())e.set(n.type,(e.get(n.type)??0)+1);return[...e.entries()].map(([n,r])=>({type:n,fileCount:r,exportsTracked:ji.has(n),importSymbolsTracked:$i.has(n),callEdgesTracked:Lt.has(n)})).sort((n,r)=>r.fileCount-n.fileCount)}var Gi,ji,$i,Lt,Ot=d(()=>{"use strict";l();Gi=new Set(["java","kotlin","scala","groovy"]),ji=new Set(["typescript","javascript","python","go","java","kotlin","scala","groovy","scss","less","lua","coffeescript"]),$i=new Set(["typescript","javascript","python"]),Lt=new Set(["typescript","javascript","go","python","java"])});import Bi from"fs";import Ae from"path";function Hm(t,e){let n=t.split(`
|
|
12
|
+
`),r=null,o=new Map,s=!1;for(let i of n){let a=i.trim();if(a.startsWith("module ")){r=a.slice(7).trim();continue}if(/^replace\s*\(/.test(a)){s=!0;continue}if(s&&a===")"){s=!1;continue}if(s&&a.includes("=>")){Wi(a,e,o);continue}!s&&/^replace\s+/.test(a)&&a.includes("=>")&&Wi(a.replace(/^replace\s+/,""),e,o)}return{mod:r,replaces:o}}function Wi(t,e,n){let[r,o]=t.split("=>").map(a=>a.trim());if(!r||!o)return;let s=r.split(/\s+/)[0];if(!o.startsWith(".")&&!o.startsWith("/"))return;let i=Ae.isAbsolute(o)?o:Ae.resolve(e,o);n.set(s,i)}function zi(t){let e;try{e=Bi.readdirSync(t,{withFileTypes:!0})}catch{return null}let n=e.filter(r=>r.isFile()&&r.name.endsWith(".go")&&!r.name.endsWith("_test.go")).map(r=>({path:Ae.join(t,r.name),isExternal:!1})).sort((r,o)=>r.path.localeCompare(o.path));return n.length>0?n:null}var Ye,Cr=d(()=>{"use strict";l();Ye=class{extensions=[".go"];goModCache=new Map;resolve(e,n,r,o){let{mod:s,replaces:i}=this.readGoMod(r);if(!s)return null;let a=this.applyReplace(n,i,r);if(a!==void 0)return zi(a);if(n!==s&&!n.startsWith(`${s}/`))return null;let c=n.slice(s.length).replace(/^\//,"");return c?zi(Ae.join(r,c)):null}readGoMod(e){let n=this.goModCache.get(e);if(n!==void 0)return n;let r={mod:null,replaces:new Map};try{let o=Bi.readFileSync(Ae.join(e,"go.mod"),"utf-8"),s=Hm(o,e);return this.goModCache.set(e,s),s}catch{return this.goModCache.set(e,r),r}}applyReplace(e,n,r){for(let[o,s]of n){if(e===o)return s;if(e.startsWith(`${o}/`)){let i=e.slice(o.length+1);return Ae.join(s,i)}}}}});import _t from"fs";import Gt from"path";function Ji(t){let e=t.replace(/\\/g,"/"),n=e.match(/^(.*)\/src\/([^/]+)(?:\/|$)/);if(!n?.[1]||!n[2]){let s=e.lastIndexOf("/");return{module:s===-1?e:e.slice(0,s),rootSegment:"",sourceRoot:"unknown"}}let r=n[2],o=r==="main"?"main":Km.has(r)?r:"unknown";return{module:n[1],rootSegment:r,sourceRoot:o}}function Vm(t,e=[]){let n=new Map,r=(process.env.MOKOSH_IGNORE_DIRS??"").split(",").map(a=>a.trim()).filter(Boolean),o=new Set([...A,...r,...e]),s=(a,c)=>{let{module:p,rootSegment:f,sourceRoot:m}=Ji(c),h=n.get(a);if(!h){n.set(a,[{module:p,rootSegment:f,sourceRoot:m,files:[c]}]);return}let y=h.find(b=>b.module===p&&b.rootSegment===f);y?y.files.push(c):h.push({module:p,rootSegment:f,sourceRoot:m,files:[c]})},i=(a,c)=>{if(c>Jm)return;let p;try{p=_t.readdirSync(a,{withFileTypes:!0})}catch{return}for(let f of p){let m=Gt.join(a,f.name);if(f.isDirectory()){!f.name.startsWith(".")&&!o.has(f.name)&&i(m,c+1);continue}if(!f.isFile())continue;let h=Gt.extname(f.name);if(!Um.has(h))continue;let y=Ym(m,h===".scala"||h===".sc");y&&s(y,m)}};i(t,0);for(let a of n.values())for(let c of a)c.files.sort();return n}function qm(t,e){let n=t.get(e);if(!(!n||n.length===0))return n.length===1?n[0]?.files:n.flatMap(r=>r.files).sort()}function Ym(t,e){let n;try{let r=_t.openSync(t,"r");try{let o=Buffer.alloc(Hi),s=_t.readSync(r,o,0,Hi,0);n=o.toString("utf8",0,s)}finally{_t.closeSync(r)}}catch{return null}return $(n,e)}function kr(t){return!t||t.length===0?null:t.map(e=>({path:e,isExternal:!1}))}function Ui(t){return Gt.basename(t,Gt.extname(t))}var Um,Jm,Hi,Km,le,vr=d(()=>{"use strict";l();j();Re();Um=new Set([".java",".kt",".kts",".scala",".sc",".groovy"]),Jm=12,Hi=4096,Km=new Set(sr);le=class{constructor(e=[]){this.extraIgnoreDirs=e}extraIgnoreDirs;extensions=[".java",".kt",".kts",".scala",".sc",".groovy",".gradle"];indexCache=new Map;resolve(e,n,r,o){let s=this.getIndex(r);if(s.size===0)return null;let i=n.endsWith(".*"),a=(i?n.slice(0,-2):n).split(".").filter(Boolean);if(a.length===0)return null;if(i){let c=s.get(a.join("."));if(!c)return null;let p=Ji(e),f=c.filter(y=>y.module===p.module&&y.rootSegment===p.rootSegment),m=p.sourceRoot!=="main"&&p.sourceRoot!=="unknown",h=f.flatMap(y=>m?y.files:y.files.filter(b=>!ir(Ui(b))));return kr(h)}for(let c=a.length-1;c>=1;c--){let p=qm(s,a.slice(0,c).join("."));if(!p)continue;let f=a[c],m=p.filter(h=>Ui(h)===f);if(m.length>0)return kr(m);if(c===a.length-1)return kr(p)}return null}getIndex(e){let n=this.indexCache.get(e);if(n)return n;let r=Vm(e,this.extraIgnoreDirs);return this.indexCache.set(e,r),r}}});import Qm from"fs";import wr from"path";var Qe,Er=d(()=>{"use strict";l();Qe=class{extensions=[".lua"];resolve(e,n,r,o){let s=n.replace(/\./g,wr.sep),i=[r,wr.join(r,"lib")];for(let a of i){if(!Qm.existsSync(a))continue;let c=o(wr.join(a,"_dummy.lua"),s);if(c)return[c]}return null}}});import Xm from"path";var Zm,Xe,Tr=d(()=>{"use strict";l();j();Zm=new Set(A),Xe=class{extensions=[".md",".mdx"];resolve(e,n,r,o){let s=n.replace(/^\.\//,"").split("/")[0];if(s&&Zm.has(s))return null;let i=o(Xm.join(r,"_dummy"),`./${n}`);return i?[i]:null}}});import eu from"fs";import Fr from"path";function Ki(t){try{return eu.statSync(t,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}var Ze,Nr=d(()=>{"use strict";l();Ze=class{extensions=[".py"];resolve(e,n,r,o){let s=n.replace(/\./g,Fr.sep),i=Fr.join(r,`${s}.py`);if(Ki(i))return[{path:i,isExternal:!1}];let a=Fr.join(r,s,"__init__.py");return Ki(a)?[{path:a,isExternal:!1}]:null}}});import Vi from"path";var tu,et,Pr=d(()=>{"use strict";l();tu=["~","http://","https://","//","data:","sass:"],et=class{extensions=[".css",".scss",".sass",".less",".styl"];resolve(e,n,r,o){if(tu.some(f=>n.startsWith(f)))return null;let s=o(e,n);if(s)return[s];let i=Vi.dirname(n),a=Vi.basename(n),c=i==="."?`_${a}`:`${i}/_${a}`,p=o(e,c);return p?[p]:null}}});function jt(t={}){return[new Ze,new Qe,new Ye,t.jvm??new le,new et,new Xe]}var Dr=d(()=>{"use strict";l();Cr();vr();Er();Tr();Nr();Pr();Cr();vr();Er();Tr();Nr();Pr()});import $t from"fs";import J from"path";var K,Wt=d(()=>{"use strict";l();Dr();K=class{constructor(e,n={}){this.rootDir=e;this.workspaceMap=n.workspaceMap??new Map,this.tsconfigSearchPaths=n.tsconfigSearchPaths??[e],this.pathAliases=n.pathAliases,this.langResolvers=n.langResolvers??jt()}rootDir;workspaceMap;tsconfigSearchPaths;pathAliases;langResolvers;resolutionCache=new Map;langBucketFor(e){for(let n=0;n<this.langResolvers.length;n++)if(this.langResolvers[n]?.extensions.some(r=>e.endsWith(r)))return String(n);return"none"}cacheKey(e,n){return`${J.dirname(e)}\0${this.langBucketFor(e)}\0${n}`}resolveAll(e,n){let r=this.cacheKey(e,n),o=this.resolutionCache.get(r);if(o!==void 0)return o??[];let s=this.resolveAllUncached(e,n);return this.resolutionCache.set(r,s.length>0?s:null),s}resolveAllUncached(e,n){let r=this.resolvePathAlias(n);if(r)return[r];if(n.startsWith(".")||n.startsWith("/")){let i=this.resolveLocalPath(e,n);return i?[i]:[]}let o=(i,a)=>this.resolveLocalPath(i,a);for(let i of this.langResolvers)if(i.extensions.some(a=>e.endsWith(a))){let a=i.resolve(e,n,this.rootDir,o);if(a)return a}let s=this.resolveWorkspaceImport(n);return s?[s]:[{path:n,isExternal:!0}]}resolve(e,n){return this.resolveAll(e,n)[0]??null}resolveLocalPath(e,n){let r=J.dirname(e),o=n.startsWith("/")?n:J.resolve(r,n),s=!o.startsWith(this.rootDir),i=["",".ts",".tsx",".js",".jsx",".mjs",".cjs",".css",".scss",".sass",".less",".styl",".coffee",".ls",".lua",".py",".feature",".md",".mdx"],a=o.match(/\.(js|mjs|cjs)$/);if(a){let c=o.slice(0,-a[0].length);for(let p of[".ts",".tsx"]){let f=this.tryExtensions(c,p,s);if(f)return f}}for(let c of i){let p=this.tryExtensions(o,c,s);if(p)return p}return s?{path:o,isExternal:!0}:null}tryExtensions(e,n,r){let o=e+n;if(this.isFile(o))return{path:o,isExternal:r};let s=J.join(e,`index${n}`);if(this.isFile(s))return{path:s,isExternal:r};if(n===".py"){let i=J.join(e,"__init__.py");if(this.isFile(i))return{path:i,isExternal:r}}return null}isFile(e){try{return $t.statSync(e,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}resolvePathAlias(e){if(this.pathAliases)for(let n in this.pathAliases){let r=this.matchAliasPattern(n,e),o=this.pathAliases[n];if(r&&o){let s=this.tryAliasSubstitutions(o,r[1]||"");if(s)return s}}for(let n of this.tsconfigSearchPaths){let r=J.join(n,"tsconfig.json");if($t.existsSync(r))try{let s=JSON.parse($t.readFileSync(r,"utf-8")).compilerOptions?.paths;if(!s)continue;for(let i in s){let a=this.matchAliasPattern(i,e);if(a){let c=this.tryAliasSubstitutions(s[i],a[1]||"",n);if(c)return c}}}catch{}}return null}aliasRegexCache=new Map;matchAliasPattern(e,n){let r=this.aliasRegexCache.get(e);if(!r){let o=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace("\\*","(.*)");r=new RegExp(`^${o}$`),this.aliasRegexCache.set(e,r)}return n.match(r)}tryAliasSubstitutions(e,n,r=this.rootDir){let o=["",".ts",".tsx",".js",".jsx",".coffee",".ls",".lua",".feature"];for(let s of e){let i=s.replace("*",n),a=J.resolve(r,i);for(let c of o){let p=this.tryExtensions(a,c,!1);if(p)return p}}return null}resolveWorkspaceImport(e){if(this.workspaceMap.size===0)return null;for(let[n,r]of this.workspaceMap){if(e!==n&&!e.startsWith(`${n}/`))continue;let o=e.slice(n.length),s={path:"",isExternal:!1,isWorkspace:!0,workspacePackage:n};if(!o){for(let a of["src/index.ts","src/index.tsx","index.ts","index.tsx","index.js"]){let c=J.join(r,a);try{if($t.statSync(c,{throwIfNoEntry:!1})?.isFile())return{...s,path:c}}catch{}}return{...s,path:r}}let i=this.resolveLocalPath(J.join(r,"_dummy"),o.slice(1));return i?{...s,path:i.path}:null}return null}}});import tt from"fs";import R from"path";import nu from"piscina";function iu(){return(process.env.MOKOSH_IGNORE_DIRS??"").split(",").map(t=>t.trim()).filter(Boolean)}function au(t,e){if(t.length===0)return e;let n=t.map(i=>R.dirname(i).split(R.sep)),r=n[0]??[];for(let i of n.slice(1)){let a=0;for(;a<r.length&&a<i.length&&r[a]===i[a];)a++;r=r.slice(0,a)}let o=r.join(R.sep)||R.sep,s=R.relative(e,o);return s.startsWith("..")||R.isAbsolute(s)?e:o}var ru,ou,su,pe,Rr=d(()=>{"use strict";l();Hn();be();tr();Ii();_i();Ot();ve();Wt();ru=["tests","test","__tests__","specs","spec"],ou=["node_modules",".git","dist","build",".next",".cache","mokosh-cache","coverage",".pytest_cache","__pycache__"],su=600;pe=class{constructor(e,n=null,r,o,s=!1,i=new Map,a=!0,c=[],p=null){this.rootDir=e;this.enableGitStats=s;this.coverageMap=i;this.parallelParsing=a;this.docFiles=p;this.previousGraph=n,this.walkIgnoreDirs=new Set([...ou,...c,...iu()]),this.resolver=r||new K(e),this.lockFile=Es(e),o&&(this.progressCallback=o)}rootDir;enableGitStats;coverageMap;parallelParsing;docFiles;graph={nodes:new Map};visited=new Set;queue=[];previousGraph=null;resolver;lockFile=null;progressCallback;pool=null;gitStatsMap=null;walkIgnoreDirs;async build(e){let n=e.map(r=>R.isAbsolute(r)?r:R.resolve(this.rootDir,r));await this.initPool(),this.enableGitStats&&(this.gitStatsMap=xs(this.rootDir));try{for(let r of n)this.enqueue(r);return await this.drain(),await this.processTestFiles(au(n,this.rootDir)),await this.processDocFiles(),this.progressCallback&&this.visited.size>=100&&process.stderr.write(`
|
|
13
13
|
Done. Total processed: ${this.visited.size} nodes.
|
|
14
|
-
`),
|
|
14
|
+
`),Oi(this.graph.nodes,this.coverageMap),new I(this.graph.nodes)}finally{this.pool&&(await this.pool.destroy(),this.pool=null)}}async initPool(){if(this.parallelParsing===!1)return;let e=typeof this.parallelParsing=="object"?this.parallelParsing:{},n=e.minFiles??su;if(!(n>0&&!this.hasAtLeastFiles(this.rootDir,n))){e.maxThreads!==void 0&&e.maxThreads<1&&process.stderr.write(`
|
|
15
15
|
Warning: parallelParsing.maxThreads (${e.maxThreads}) must be at least 1; using 1.
|
|
16
|
-
`);try{let
|
|
17
|
-
Warning: failed to start parse worker pool, falling back to synchronous parsing: ${
|
|
18
|
-
`),this.pool=null}}}hasAtLeastFiles(e,
|
|
19
|
-
Warning: failed to parse ${
|
|
20
|
-
`),null}}parseContent(e,
|
|
21
|
-
`,s),a=i===-1?
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
`);try{let r=R.join(u,"parse-worker.js");this.pool=new nu({filename:r,...e.maxThreads!==void 0?{maxThreads:Math.max(1,e.maxThreads)}:{}})}catch(r){process.stderr.write(`
|
|
17
|
+
Warning: failed to start parse worker pool, falling back to synchronous parsing: ${r}
|
|
18
|
+
`),this.pool=null}}}hasAtLeastFiles(e,n){let r=0,o=[e];for(;o.length>0;){let s=o.pop();if(s===void 0)continue;let i;try{i=tt.readdirSync(s,{withFileTypes:!0})}catch{continue}for(let a of i)if(a.isDirectory())this.walkIgnoreDirs.has(a.name)||o.push(R.join(s,a.name));else if(a.isFile()&&(r++,r>=n))return!0}return r>=n}async processTestFiles(e){let n=ze(),r=s=>n.some(i=>s.name.includes(i));this.walkProject(e,r);let o=e;for(;o!==this.rootDir;){let s=R.dirname(o);if(s===o)break;for(let i of ru){let a=R.join(s,i);try{tt.statSync(a).isDirectory()&&this.walkProject(a,r)}catch{}}o=s}await this.drain()}async processDocFiles(){if(this.docFiles!==null){for(let e of this.docFiles)this.enqueue(e);await this.drain();return}this.walkProject(this.rootDir,e=>e.name.endsWith(".md")||e.name.endsWith(".mdx")),await this.drain()}walkProject(e,n){let r;try{r=tt.readdirSync(e,{withFileTypes:!0})}catch{return}for(let o of r){let s=R.join(e,o.name);o.isDirectory()?this.walkIgnoreDirs.has(o.name)||this.walkProject(s,n):o.isFile()&&n(o)&&this.enqueue(s)}}enqueue(e){this.visited.has(e)||(this.visited.add(e),this.showProgress(),this.queue.push(e))}async drain(){for(;this.queue.length>0;){let e=this.queue;this.queue=[],await Promise.all(e.map(n=>this.finishFile(n)))}}async finishFile(e){let n=tt.statSync(e,{throwIfNoEntry:!1});if(!n?.isFile())return;let r=R.relative(this.rootDir,e),o=await this.getNode(e,r,n);o.imports=await this.resolveImports(e,o.imports),Li(o.imports,o.tags),this.graph.nodes.set(o.path,o)}async getNode(e,n,r){let o=this.previousGraph?.nodes.get(n);if(o&&o.mtime===r.mtimeMs&&o.size===r.size)return{...o};let s=await this.tryParse(e,n);if(!s)return this.makeStubNode(e,n,r);let i=this.resolveCallEdges(e,s.rawCallEdges),a=this.buildNode(e,n,r,s,i);return this.attachGitStats(a,n),a}async tryParse(e,n){let r=tt.readFileSync(e,"utf-8");try{return await this.parseContent(e,r)}catch(o){return process.stderr.write(`
|
|
19
|
+
Warning: failed to parse ${n}: ${o}
|
|
20
|
+
`),null}}parseContent(e,n){return this.pool?this.pool.run({filePath:e,content:n}):Ri(e,n)}makeStubNode(e,n,r){return{path:n,type:B(e),category:"other",imports:[],exports:[],tags:[],mtime:r.mtimeMs,size:r.size}}resolveCallEdges(e,n){let r=[];for(let o of n??[])try{let s=this.resolver.resolve(e,o.toSpecifier);s&&!s.isExternal&&r.push({from:o.from,to:o.to,toFile:R.relative(this.rootDir,s.path)})}catch{}return r}buildNode(e,n,r,o,s){let{imports:i,exports:a,tags:c,category:p,description:f,complexity:m,cognitiveComplexity:h,functions:y}=o;return{path:n,type:B(e),category:p,imports:i,exports:a,tags:c,mtime:r.mtimeMs,size:r.size,...f!==void 0?{description:f}:{},...s.length>0?{callEdges:s}:{},...m!==void 0?{complexity:m}:{},...h!==void 0?{cognitiveComplexity:h}:{},...y!==void 0?{functions:y}:{}}}attachGitStats(e,n){let r=this.gitStatsMap?.get(n);r&&(e.commitCount90d=r.commitCount90d,r.lastAuthor!==void 0&&(e.lastAuthor=r.lastAuthor),r.lastCommitAt!==void 0&&(e.lastCommitAt=r.lastCommitAt))}async resolveImports(e,n){let r=[];for(let o of n){let s=this.resolver.resolveAll(e,o.rawSpecifier);if(!(s.length===0||o.type==="side-effect"&&o.rawSpecifier.endsWith(".*")&&s.every(a=>a.isExternal)))for(let a of s){if(!a.isExternal&&a.path===e)continue;let c={...o,toPath:a.isExternal?a.path:R.relative(this.rootDir,a.path),isExternal:a.isExternal};a.isWorkspace&&(c.isWorkspace=!0,c.workspacePackage=a.workspacePackage),a.isExternal?this.attachLockfileVersion(c):this.enqueue(a.path),r.push(c)}}return r}attachLockfileVersion(e){if(!this.lockFile)return;let n=this.lockFile.jvmDependencies;if(n&&Gi.has(B(e.fromPath))){let s=e.rawSpecifier.replace(/\.\*$/,""),i="";for(let a of Object.keys(n))(s===a||s.startsWith(`${a}.`))&&a.length>i.length&&(i=a);i&&(e.version=n[i]?.version);return}let r=e.rawSpecifier.startsWith("@")?e.rawSpecifier.split("/").slice(0,2).join("/"):e.rawSpecifier.split("/")[0],o=r?this.lockFile.dependencies[r]:void 0;o&&(e.version=o.version)}showProgress(){this.progressCallback&&this.visited.size%100===0&&this.progressCallback(this.visited.size)}}});function qi(t){return cu.has(t)?"style":"code"}var cu,Yi=d(()=>{"use strict";l();cu=new Set(["css","scss","less","stylus"])});import Qi from"path";function uu(t,e){let n=t.split(/[\\/]/),r=/^\*\*\/(.+?)\/\*\*$/.exec(e);return r?n.includes(r[1]):e.startsWith("*.")?Qi.basename(t).endsWith(e.slice(1)):n.includes(e)}function zt(t,e=[]){if(t.split(/[\\/]/).some(o=>lu.has(o)))return!0;let r=Qi.basename(t);return pu.some(o=>r.endsWith(o))?!0:e.some(o=>uu(t,o))}function nt(t){let e=t.slice(0,mu).toLowerCase();return fu.some(n=>e.includes(n))}var lu,pu,fu,mu,Ir=d(()=>{"use strict";l();lu=new Set(["generated","__generated__","__generated","gen","__snapshots__"]),pu=[".pb.go",".pb.ts",".pb.js","_pb2.py","_pb2.pyi","_pb.dart",".g.dart",".generated.ts",".generated.tsx",".generated.js",".generated.jsx","_generated.go",".gen.go",".gen.ts",".snap"],fu=["@generated","do not edit","code generated by","autogenerated","auto-generated","this file was automatically generated","this is a generated file","jest snapshot v1"],mu=500});function du(t){return t.trim().replace(/\s+/g," ")}function gu(t){try{return t.fileType==="scss"?Mt(t.source,t.file).root:t.fileType==="less"?At(t.source,t.file).root:t.fileType==="css"?It(t.source,t.file).root:void 0}catch{return}}function hu(t){let e=gu(t);if(!e)return[];let n=[];return e.walkRules(r=>{let o=r.nodes?.filter(f=>f.type==="decl")??[];if(o.length===0)return;let s=o[0],i=o[o.length-1],a=r.source?.start?.line??s?.source?.start?.line,c=i?.source?.end?.line??i?.source?.start?.line??a;if(a===void 0||c===void 0)return;let p=o.map(f=>`${f.prop.trim().toLowerCase()}:${du(f.value)}`).join(";");n.push({file:t.file,startLine:a,endLine:c,lines:c-a+1,signature:p,declCount:o.length})}),n}function Xi(t,e,n=2){let r=new Map;for(let s of t)for(let i of hu(s)){if(i.declCount<n||i.lines<e)continue;let a=r.get(i.signature);a?a.push(i):r.set(i.signature,[i])}let o=[];for(let s of r.values())for(let i=0;i<s.length;i++)for(let a=i+1;a<s.length;a++){let c=s[i],p=s[a];if(c.file===p.file&&c.startLine===p.startLine&&c.endLine===p.endLine)continue;let f={file:c.file,startLine:c.startLine,endLine:c.endLine},m={file:p.file,startLine:p.startLine,endLine:p.endLine};o.push({occurrences:[f,m],lines:Math.min(c.lines,p.lines),tokens:c.declCount,family:"style"})}return o.sort((s,i)=>i.lines-s.lines)}var Zi=d(()=>{"use strict";l();yr();xr()});function ea(t){let e=t.length,n=[],r=[{lcpLength:0,low:0}];for(let o=1;o<e;o++){let s=o-1;for(;t[o]<r[r.length-1].lcpLength;){let i=r.pop();n.push({lcpLength:i.lcpLength,low:i.low,high:o-1}),s=i.low}t[o]>r[r.length-1].lcpLength&&r.push({lcpLength:t[o],low:s})}for(;r.length>1;){let o=r.pop();n.push({lcpLength:o.lcpLength,low:o.low,high:e-1})}return n}var ta=d(()=>{"use strict";l()});function na(t,e,n){let r=0;for(let o=e;o<e+n;o++)yu.has(t[o].text)&&r++;return r/n}var yu,ra=d(()=>{"use strict";l();yu=new Set(["{","}",":",",","[","]"])});function oa(t){let e=t.length;if(e===0)return[];let n=Array.from({length:e},(s,i)=>i),r=new Array(e);{let s=[...new Set(t)].sort(),i=new Map(s.map((a,c)=>[a,c]));for(let a=0;a<e;a++)r[a]=i.get(t[a])}let o=new Array(e).fill(0);for(let s=1;s<e;s*=2){let i=a=>a+s<e?r[a+s]:-1;n.sort((a,c)=>{let p=r[a]-r[c];return p!==0?p:i(a)-i(c)}),o[n[0]]=0;for(let a=1;a<e;a++){let c=n[a-1],p=n[a],f=r[c]===r[p],m=i(c)===i(p);o[p]=o[c]+(f&&m?0:1)}if([r,o]=[o,r],r[n[e-1]]===e-1)break}return n}function sa(t,e){let n=t.length,r=new Array(n).fill(0);if(n===0)return r;let o=new Array(n);for(let i=0;i<n;i++)o[e[i]]=i;let s=0;for(let i=0;i<n;i++){let a=o[i];if(a>0){let c=e[a-1];for(;i+s<n&&c+s<n&&t[i+s]===t[c+s];)s++;r[a]=s,s>0&&s--}else s=0}return r}var ia=d(()=>{"use strict";l()});function aa(t,e,n,r=.5){let o=[],s=[],i=new Map;for(let{file:m,tokens:h}of t)if(h.length!==0){i.set(m,h);for(let y=0;y<h.length;y++)o.push(h[y].text),s.push({file:m,localIndex:y});o.push(` ${m}`),s.push({file:m,localIndex:-1})}if(o.length===0)return[];let a=oa(o),c=sa(o,a),p=ea(c),f=[];for(let m of p){let h=xu(m,a,s,i,e,n,r);h&&f.push(h)}return f.sort((m,h)=>h.lines-m.lines)}function xu(t,e,n,r,o,s,i){if(t.lcpLength<o)return;let a=[];for(let y=t.low;y<=t.high;y++){let b=n[e[y]];b.localIndex!==-1&&a.push(b)}if(a.length<2||!bu(a,r))return;let c=Su(a,t.lcpLength);if(c.length<2)return;let p=c[0],f=r.get(p.file);if(na(f,p.localIndex,t.lcpLength)>i)return;let m=c.map(({file:y,localIndex:b})=>{let v=r.get(y);return{file:y,startLine:v[b].line,endLine:v[b+t.lcpLength-1].line}}),h=Math.min(...m.map(y=>y.endLine-y.startLine+1));if(!(h<s))return{occurrences:m,lines:h,tokens:t.lcpLength}}function bu(t,e){let n=null;for(let{file:r,localIndex:o}of t){if(o===0)return!0;let i=e.get(r)[o-1].text;if(n===null)n=i;else if(n!==i)return!0}return!1}function Su(t,e){let n=new Map;for(let{file:o,localIndex:s}of t){let i=n.get(o);i?i.push(s):n.set(o,[s])}let r=[];for(let[o,s]of n){s.sort((a,c)=>a-c);let i=Number.NEGATIVE_INFINITY;for(let a of s)a>=i&&(r.push({file:o,localIndex:a}),i=a+e)}return r}var ca=d(()=>{"use strict";l();ta();ra();ia()});function la(t,e,n){let r=t.slice(e,n).replace(/[^\n]/g," ");return t.slice(0,e)+r+t.slice(n)}function ku(t,e){if(!e)return t;let n=t;for(let[r,o]of e.block??[]){let s=0;for(;;){let i=n.indexOf(r,s);if(i===-1)break;let a=n.indexOf(o,i+r.length),c=a===-1?n.length:a+o.length;n=la(n,i,c),s=c}}for(let r of e.line??[]){let o=0;for(;;){let s=n.indexOf(r,o);if(s===-1)break;let i=n.indexOf(`
|
|
21
|
+
`,s),a=i===-1?n.length:i;n=la(n,s,a),o=a}}return n}function wu(t,e){let n=vu[e];if(!n)return t;let r=t.split(`
|
|
22
|
+
`),o=e==="go",s=!1,i=!1;for(let a=0;a<r.length;a++){let c=r[a],p=()=>{r[a]=c.replace(/[^\r]/g," ")};if(s){p(),c.includes(")")&&(s=!1);continue}if(i){p(),(/}\s*from\s/.test(c)||c.includes("}"))&&(i=!1);continue}n.some(f=>f.test(c))&&(p(),o&&/^\s*import\s+\(/.test(c)&&!c.includes(")")?s=!0:(e==="typescript"||e==="javascript")&&/^\s*import\b/.test(c)&&c.includes("{")&&!c.includes("}")&&(i=!0))}return r.join(`
|
|
23
|
+
`)}function fa(t,e,n=!0){let r=wu(ku(t,Cu[e]),e),o=[],s=1,i=0;Ar.lastIndex=0;let a=Ar.exec(r);for(;a!==null;){for(let f=i;f<a.index;f++)r[f]===`
|
|
24
|
+
`&&s++;i=a.index;let c=a[0],p=c;Tu.test(c)&&!Nu.has(c)?p="ID":n&&(pa.test(c)||Fu.test(c))&&(p=pa.test(c)?"NUM":"STR"),o.push({text:p,line:s});for(let f=i;f<a.index+c.length;f++)r[f]===`
|
|
25
|
+
`&&s++;i=a.index+c.length,a=Ar.exec(r)}return o}var Cu,vu,Eu,Ar,Tu,pa,Fu,Nu,ma=d(()=>{"use strict";l();Cu={typescript:{line:["//"],block:[["/*","*/"]]},javascript:{line:["//"],block:[["/*","*/"]]},go:{line:["//"],block:[["/*","*/"]]},java:{line:["//"],block:[["/*","*/"]]},kotlin:{line:["//"],block:[["/*","*/"]]},scala:{line:["//"],block:[["/*","*/"]]},groovy:{line:["//"],block:[["/*","*/"]]},css:{block:[["/*","*/"]]},scss:{line:["//"],block:[["/*","*/"]]},less:{line:["//"],block:[["/*","*/"]]},stylus:{line:["//"],block:[["/*","*/"]]},python:{line:["#"]},gherkin:{line:["#"]},coffeescript:{line:["#"],block:[["###","###"]]},livescript:{line:["#"],block:[["###","###"]]},lua:{line:["--"],block:[["--[[","]]"]]},markdown:{block:[["<!--","-->"]]}};vu={typescript:[/^\s*import[\s{("*]/,/^\s*export\s.*\sfrom\s/],javascript:[/^\s*import[\s{("*]/,/^\s*export\s.*\sfrom\s/],python:[/^\s*import\s+\S/,/^\s*from\s+\S+\s+import[\s(]/],go:[/^\s*import\s+["(]/],java:[/^\s*import\s+/],kotlin:[/^\s*import\s+/],scala:[/^\s*import\s+/],groovy:[/^\s*import\s+/]};Eu=["===","!==","...","=>","==","!=","<=",">=","&&","||","::","->","..","+=","-=","*=","/="],Ar=new RegExp(`${Eu.map(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|")}|[A-Za-z_$][A-Za-z0-9_$]*|\\d+(?:\\.\\d+)?|"(?:\\\\.|[^"\\\\])*"|'(?:\\\\.|[^'\\\\])*'|\`(?:\\\\.|[^\`\\\\])*\`|\\S`,"g"),Tu=/^[A-Za-z_$][A-Za-z0-9_$]*$/,pa=/^\d+(?:\.\d+)?$/,Fu=/^(".*"|'.*'|`.*`)$/s,Nu=new Set(["if","else","elif","for","while","do","switch","case","default","break","continue","return","function","def","class","struct","interface","const","let","var","local","import","export","from","package","try","catch","except","finally","throw","raise","new","this","self","end","then","yield","async","await","nil","null","None","true","false","True","False","and","or","not","in","of","is"])});import rt from"fs";import Pu from"path";function Du(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.mtime=="number"&&typeof e.size=="number"&&typeof e.ignoreLiterals=="boolean"&&typeof e.generated=="boolean"&&Array.isArray(e.tokens)}function Me(t){try{if(!rt.existsSync(t))return new Map;let e=rt.readFileSync(t,"utf-8"),n=JSON.parse(e);if(!Array.isArray(n))return new Map;let r=n.filter(o=>Array.isArray(o)&&o.length===2&&typeof o[0]=="string"&&Du(o[1]));return new Map(r)}catch{return new Map}}function Le(t,e){let n=Pu.dirname(e);rt.existsSync(n)||rt.mkdirSync(n,{recursive:!0}),rt.writeFileSync(e,JSON.stringify([...t.entries()]))}var ua=d(()=>{"use strict";l()});import{readFile as da}from"fs/promises";import ot from"path";import Ru from"piscina";function Mu(t){return Ue.includes(ot.basename(t))}function Lu(t,e){if(e.length===0)return!1;let n=new Set(e);return t.split(ot.sep).some(r=>n.has(r))}function ga(t,e){let n=[];return new Set(t.occurrences.map(r=>r.file)).size===1&&n.push("same-file"),t.occurrences.some(r=>e.has(r.file))&&n.push("generated"),n.length>0?{...t,signals:n}:t}async function Oe(t,e,n={}){let{minLines:r=6,windowSize:o=15,ignoreLiterals:s=!0,maxPunctuationRatio:i=.5,limit:a=50,ignoreDirs:c=A,includeGenerated:p=!1,ignoreGlobs:f=[],parallelTokenizing:m=!0,tokenCache:h}=n,y=[...t.nodes.values()].filter(C=>!Mu(C.path)&&!Lu(C.path,c)),b=new Set,v=Ou(m,y.length);try{let C=[],E=new Map;if(await Promise.all(y.map(async S=>{let F=zt(S.path,f);if(F&&!p)return;if(Au.has(S.type)){let Y;try{Y=await da(ot.join(e,S.path),"utf8")}catch{return}let Xo=F||nt(Y);if(Xo&&!p)return;Xo&&b.add(S.path),C.push({file:S.path,source:Y,fileType:S.type});return}let q=h?.get(S.path),Jl=q&&q.mtime===S.mtime&&q.size===S.size&&q.ignoreLiterals===s,dt,xe;if(Jl)dt=q.tokens,xe=q.generated;else{let Y;try{Y=await da(ot.join(e,S.path),"utf8")}catch{return}if(xe=F||nt(Y),xe&&!p)return;dt=v?await v.run({source:Y,fileType:S.type,ignoreLiterals:s}):fa(Y,S.type,s),h?.set(S.path,{mtime:S.mtime,size:S.size,ignoreLiterals:s,generated:xe,tokens:dt})}if(xe&&!p)return;xe&&b.add(S.path);let qo=qi(S.type),Yo={file:S.path,tokens:dt},Qo=E.get(qo);Qo?Qo.push(Yo):E.set(qo,[Yo])})),h){let S=new Set(y.map(F=>F.path));for(let F of h.keys())S.has(F)||h.delete(F)}let G=Xi(C,r).map(S=>ga(S,b));for(let[S,F]of E)for(let q of aa(F,o,r,i))G.push(ga({...q,family:S},b));return{groups:G.sort((S,F)=>F.lines-S.lines).slice(0,a)}}finally{v&&await v.destroy()}}function Ou(t,e){if(t===!1)return null;let n=typeof t=="object"?t:{},r=n.minFiles??Iu;if(e<r)return null;n.maxThreads!==void 0&&n.maxThreads<1&&process.stderr.write(`
|
|
26
|
+
Warning: parallelTokenizing.maxThreads (${n.maxThreads}) must be at least 1; using 1.
|
|
27
|
+
`);try{return new Ru({filename:ot.join(u,"duplication-worker.js"),...n.maxThreads!==void 0?{maxThreads:Math.max(1,n.maxThreads)}:{}})}catch(o){return process.stderr.write(`
|
|
26
28
|
Warning: failed to start duplicate-detection worker pool, falling back to synchronous tokenizing: ${o}
|
|
27
|
-
`),null}}var ou,su,Ot=g(()=>{"use strict";l();G();Kr();_i();ji();Vi();Xi();Zi();ou=20,su=new Set(["css","scss","less"])});var ce,_t=g(()=>{"use strict";l();ce=class{affectedSymbols=new Map;constructor(e,r){this.affectedSymbols.set(e,new Set(["default",...r]))}updateAffectedSymbols(e,r){let n=this.affectedSymbols.get(r)||new Set,o=e.imports.find(c=>c.toPath===r);if(!o)return!1;let s=o.symbols||["*"],i=new Set;for(let c of s)(c==="*"||n.has("*")||n.has(c))&&i.add("*");if(i.size===0)return!1;let a=this.affectedSymbols.get(e.path)||new Set;for(let c of i)a.add(c);return this.affectedSymbols.set(e.path,a),!0}}});function le(t,e){let r=t.nodes.get(e);if(r)return{category:r.category,exports:r.exports.map(n=>n.name)}}function yn(t,e,r=1){let n=[];return t.traverse(e,(o,s,i)=>{if(o.path===e)return!0;let a=i?t.nodes.get(i)?.imports.find(c=>c.toPath===o.path):void 0;return n.push({path:o.path,...a?.symbols?{symbols:a.symbols}:{}}),!0},{direction:"outgoing",maxDepth:r}),n}function tt(t,e){let r=[];return t.traverse(e,n=>{if(n.path===e)return!0;let o=n.imports.find(s=>s.toPath===e);return r.push({path:n.path,...o?.symbols?{symbols:o.symbols}:{}}),!0},{direction:"incoming",maxDepth:1}),r}function xn(t,e,r={}){let{testsOnly:n=!1,changedSymbols:o}=r,s=o?new ce(e,o):null,i=[];return t.traverse(e,(a,c,p)=>{if(a.path===e)return!0;if(s&&p&&!s.updateAffectedSymbols(a,p))return!1;let f=a.category==="test"||a.tags.some(u=>u.name==="test");return(!n||f)&&i.push(a.path),!0},{direction:"incoming"}),i}function bn(t,e,r={}){let{depth:n=1,withEdgeDetail:o=!1}=r,s=[];return t.traverseCalls(e,i=>{if(i.path===e)return!0;let a={file:i.path};return o&&(a.edges=(i.callEdges??[]).filter(c=>c.toFile===e).map(c=>({from:c.from,to:c.to}))),s.push(a),!0},{direction:"incoming",maxDepth:n}),s}function Re(t,e={}){let{metric:r="cognitiveComplexity",threshold:n=10,limit:o=20}=e;return[...t.nodes.values()].flatMap(s=>(s.functions??[]).filter(i=>i[r]>=n).map(i=>({file:s.path,name:i.name,line:i.line,complexity:i.complexity,cognitiveComplexity:i.cognitiveComplexity}))).sort((s,i)=>i[r]-s[r]).slice(0,o)}function Sn(t){return{nodes:t.nodes.map(r=>({path:r.path,type:r.type,category:r.category,exports:r.exports.map(n=>n.name),tags:r.tags.filter(n=>n.kind==="comment-marker"||n.kind==="import").map(n=>n.name),importsFiles:r.imports.filter(n=>!n.isExternal&&n.toPath).map(n=>n.toPath),...r.description!==void 0&&{description:r.description},...r.testedBy!==void 0&&{testedBy:r.testedBy},...r.coveragePct!==void 0&&{coveragePct:r.coveragePct},...r.avgExportUsage!==void 0&&{avgExportUsage:r.avgExportUsage},...r.maxExportUsage!==void 0&&{maxExportUsage:r.maxExportUsage}})),cycles:t.cycles}}function Cn(t){let e=t.getPackageDependencies(),r=Array.from(t.packages.values()).map(({graph:n,pkg:o})=>({name:o.name,relativeRoot:o.relativeRoot,nodeCount:n.nodes.size,dependsOn:e.get(o.name)??[]}));return{monorepoType:t.type,packageCount:r.length,packages:r}}function Z(t){return[...t.nodes.values()].some(e=>e.coveragePct!==void 0)}function ta(t){return[...t.nodes.values()].some(e=>e.commitCount90d!==void 0)}function Ae(t,e={}){let{metric:r="cognitiveComplexity",minComplexity:n=10,maxCoveragePct:o=50,minChurn:s=0,limit:i=20}=e,a=ta(t),c=[...t.nodes.values()].filter(p=>p.coveragePct!==void 0&&p.coveragePct<=o&&(!a||(p.commitCount90d??0)>=s)).flatMap(p=>(p.functions??[]).filter(f=>f[r]>=n).map(f=>({file:p.path,name:f.name,line:f.line,complexity:f.complexity,cognitiveComplexity:f.cognitiveComplexity,coveragePct:p.coveragePct,...p.commitCount90d!==void 0&&{commitCount90d:p.commitCount90d}}))).sort((p,f)=>f[r]-p[r]).slice(0,i);return{hotspots:c,count:c.length,churnDataAvailable:a}}var Gt=g(()=>{"use strict";l();_t()});import{execFileSync as vn}from"child_process";import kn from"fs";import lu from"os";import pu from"path";function wn(t,e){try{return vn("git",["rev-parse","--verify",`${e}^{commit}`],{cwd:t,encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim()}catch{throw new Error(`Could not resolve git ref "${e}" in ${t}`)}}async function ra(t,e,r){let n=kn.mkdtempSync(pu.join(lu.tmpdir(),`mokosh-worktree-${e.slice(0,12)}-`));kn.rmdirSync(n);try{return vn("git",["worktree","add","--detach",n,e],{cwd:t,stdio:["ignore","pipe","pipe"]}),await r(n)}finally{try{vn("git",["worktree","remove","--force",n],{cwd:t,stdio:["ignore","pipe","pipe"]})}catch{kn.rmSync(n,{recursive:!0,force:!0})}}}var na=g(()=>{"use strict";l()});import fu from"path";async function la(t,e,r,n={}){let o=wn(t,e),s=Vo(t,o);if(s)return{sha:o,graph:s};let i=await ra(t,o,async a=>{let c=n.pathAliases?new J(a,{pathAliases:n.pathAliases}):void 0;return new ae(a,null,c,void 0,n.gitStats??!1,new Map,n.parallelParsing??!0,n.additionalIgnoreDirs??[]).build(r)});return qo(t,o,i),{sha:o,graph:i}}function mu(t,e){return`${t.file}:${t.line} ${t.name} (${t[e]})`}function uu(t,e){return`${t.file}:${t.line} ${t.name} (${t[e]}, cov ${t.coveragePct}%)`}function gu(t,e=4){let r=t.occurrences.slice(0,e).map(s=>`${s.file}:${s.startLine}-${s.endLine}`),n=t.occurrences.length-r.length,o=n>0?`, +${n} more`:"";return`${t.lines}L x${t.occurrences.length}: ${r.join(", ")}${o}`}function du(t,e){let{files:r,staleReferences:n,duplication:o,complexity:s,docDrift:i,coverage:a}=t,c=[],p=[r.added.length&&`${r.added.length} added`,r.changed.length&&`${r.changed.length} changed`,r.removed.length&&`${r.removed.length} removed`].filter(Boolean);c.push(p.length?`Files: ${p.join(", ")}`:"No file changes"),n.length>0&&c.push(`\u26A0 ${pe(n.length,"stale reference")} \u2014 removed export still imported`);let f=s.newHotspots[0];return f?c.push(`+${pe(s.newHotspots.length,"complexity hotspot")} (max ${e} ${f[e]} in ${f.file})`):s.resolvedHotspots.length>0&&c.push(`${pe(s.resolvedHotspots.length,"complexity hotspot")} resolved`),o.newGroups.length>0?c.push(`+${pe(o.newGroups.length,"duplication group")}`):o.resolvedGroups.length>0&&c.push(`${pe(o.resolvedGroups.length,"duplication group")} resolved`),i.newlyStale.length>0&&c.push(`${pe(i.newlyStale.length,"doc")} newly stale`),a&&a.newHotspots.length>0&&c.push(`+${pe(a.newHotspots.length,"risk hotspot")}`),c}function hu(t){let{staleReferences:e,duplication:r,complexity:n,docDrift:o,coverage:s}=t;return e.length>0||(s?.newHotspots.length??0)>0?"attention":n.newHotspots.length>0||r.newGroups.length>0||o.newlyStale.length>0?"review-worthy":"clean"}function En(t,e={}){let r=e.metric??"cognitiveComplexity",n=e.maxItems??8,o=e.maxPathList??100,{files:s,staleReferences:i,duplication:a,complexity:c,docDrift:p,coverage:f}=t,u=oa(c.head.avgCognitiveComplexity-c.base.avgCognitiveComplexity),y=s.added.length+s.changed.length+s.removed.length,x={base:`${t.base.ref}@${sa(t.base.sha)}`,head:`${t.head.ref}@${sa(t.head.sha)}`,verdict:hu(t),headline:du(t,r),files:{added:s.added.length,changed:s.changed.length,removed:s.removed.length,...y<=o?{paths:{added:s.added,changed:s.changed,removed:s.removed}}:{}}};return i.length>0&&(x.staleReferences=i),(c.newHotspots.length>0||c.resolvedHotspots.length>0)&&(x.complexity={avgDelta:u,newHotspots:c.newHotspots.slice(0,n).map(b=>mu(b,r)),newHotspotCount:c.newHotspots.length,resolvedCount:c.resolvedHotspots.length}),(a.newGroups.length>0||a.resolvedGroups.length>0)&&(x.duplication={newGroups:a.newGroups.slice(0,n).map(b=>gu(b)),newGroupCount:a.newGroups.length,resolvedCount:a.resolvedGroups.length,totalGroups:a.head.groups}),(p.newlyStale.length>0||p.resolved.length>0)&&(x.docDrift={newlyStale:p.newlyStale.slice(0,n).map(b=>b.replace("::"," \u2192 ")),newlyStaleCount:p.newlyStale.length,resolvedCount:p.resolved.length}),f&&(f.newHotspots.length>0||f.resolvedHotspots.length>0)&&(x.coverage={avgDelta:oa(f.head.avgCoveragePct-f.base.avgCoveragePct),newHotspots:f.newHotspots.slice(0,n).map(b=>uu(b,r)),newHotspotCount:f.newHotspots.length,resolvedCount:f.resolvedHotspots.length}),x}function yu(t,e){let r=[],n=[];for(let[s,i]of e.nodes){let a=t.nodes.get(s);if(!a){r.push(s);continue}let c=JSON.stringify({category:a.category,exports:a.exports.map(f=>f.name).sort(),imports:a.imports.map(f=>f.toPath).sort()}),p=JSON.stringify({category:i.category,exports:i.exports.map(f=>f.name).sort(),imports:i.imports.map(f=>f.toPath).sort()});c!==p&&n.push(s)}let o=[...t.nodes.keys()].filter(s=>!e.nodes.has(s));return{added:r,removed:o,changed:n}}function xu(t,e){let r=[];for(let[n,o]of t.nodes){let s=e.nodes.get(n);if(!s)continue;let i=new Set(s.exports.map(c=>c.name)),a=o.exports.map(c=>c.name).filter(c=>!i.has(c));if(a.length!==0)for(let c of a){let p=[...e.nodes.values()].filter(f=>f.imports.some(u=>u.toPath===n&&u.symbols?.includes(c))).map(f=>f.path);p.length>0&&r.push({file:n,symbol:c,stillReferencedBy:p})}}return r}function jt(t){return t.occurrences.map(e=>`${e.file}:${e.startLine}-${e.endLine}`).sort().join("|")}async function bu(t,e,r,n,o){let s=fu.join(ht(t),`${n}-${te}`),i=Pe(s),[{groups:a},{groups:c}]=await Promise.all([Ie(e,t,{minLines:o,tokenCache:i}),Ie(r,t,{minLines:o})]);De(i,s);let p=new Set(a.map(jt)),f=new Set(c.map(jt));return{base:{groups:a.length},head:{groups:c.length},newGroups:c.filter(u=>!p.has(jt(u))),resolvedGroups:a.filter(u=>!f.has(jt(u)))}}function ia(t){let e=[...t.nodes.values()].map(r=>r.cognitiveComplexity).filter(r=>r!==void 0);return e.length===0?0:e.reduce((r,n)=>r+n,0)/e.length}function Su(t,e,r,n){let o=Re(t,{metric:r,threshold:n,limit:1/0}),s=Re(e,{metric:r,threshold:n,limit:1/0}),i=p=>`${p.file}:${p.name}`,a=new Set(o.map(i)),c=new Set(s.map(i));return{base:{avgCognitiveComplexity:ia(t)},head:{avgCognitiveComplexity:ia(e)},newHotspots:s.filter(p=>!a.has(i(p))),resolvedHotspots:o.filter(p=>!c.has(i(p)))}}function aa(t){let e=new Set;for(let r of t.nodes.values())if(!(r.type!=="markdown"||!r.staleFor))for(let n of r.staleFor)e.add(`${r.path}::${n}`);return e}function Cu(t,e){let r=aa(t),n=aa(e);return{base:{staleCount:r.size},head:{staleCount:n.size},newlyStale:[...n].filter(o=>!r.has(o)),resolved:[...r].filter(o=>!n.has(o))}}function ca(t){let e=[...t.nodes.values()].map(r=>r.coveragePct).filter(r=>r!==void 0);return e.length===0?0:e.reduce((r,n)=>r+n,0)/e.length}function ku(t,e,r){if(!Z(t)||!Z(e))return null;let n=Ae(t,{maxCoveragePct:r,limit:1/0}).hotspots,o=Ae(e,{maxCoveragePct:r,limit:1/0}).hotspots,s=c=>`${c.file}:${c.name}`,i=new Set(n.map(s)),a=new Set(o.map(s));return{base:{avgCoveragePct:ca(t)},head:{avgCoveragePct:ca(e)},newHotspots:o.filter(c=>!i.has(s(c))),resolvedHotspots:n.filter(c=>!a.has(s(c)))}}async function Tn(t,e,r,n={}){let{sha:o,graph:s}=await la(t,e,n.entryPoints??[],n),i=wn(t,n.headRef??"HEAD"),[a,c]=await Promise.all([bu(t,s,r,o,n.minDuplicateLines),Promise.resolve(ku(s,r,n.maxCoveragePct))]);return{base:{ref:e,sha:o},head:{ref:n.headRef??"HEAD",sha:i},files:yu(s,r),staleReferences:xu(s,r),duplication:a,complexity:Su(s,r,n.complexityMetric,n.complexityThreshold),docDrift:Cu(s,r),coverage:c}}var oa,sa,pe,pa=g(()=>{"use strict";l();G();Qo();dn();Ot();Gt();Lt();na();oa=t=>Math.round(t*100)/100,sa=t=>t.length>8?t.slice(0,8):t;pe=(t,e)=>`${t} ${e}${t===1?"":"s"}`});import $t from"path";function vu(t){let e=new Map;for(let[r,n]of t){let o=n.imports.filter(s=>s.toPath&&!s.isExternal).length;o>0&&e.set(r,o)}return e}function wu(t,e,r){let n=new Map;for(let[o,s]of e){if(s<r)continue;let i=t.get(o);if(!i||i.category==="test"||i.category==="barrel")continue;let a=$t.extname(o),c=$t.basename(o,a),p=c==="index"?$t.basename($t.dirname(o)):c;n.set(o,{path:o,outDegree:s,tag:`feature:${p}`})}return n}function fe(t,e){let r=e?.minOutDegree??5;return wu(t,vu(t),r)}var Wt=g(()=>{"use strict";l()});function Tu(t,e){let r=new Map;for(let n of e.values()){let o=new Set;t.traverse(n.path,s=>(s.path!==n.path&&o.add(s.path),!0),{direction:"outgoing"}),r.set(n.path,o)}return r}function Fu(t,e,r,n){let o=new Map;for(let[s]of t){if(e.has(s))continue;let i=null;for(let a of e.values())r.get(a.path)?.has(s)&&(!i||n(a,i)<0)&&(i=a);i&&o.set(s,i.path)}return o}function Nu(t,e){let r=new Map;for(let n of t.values()){let o=n.tag.replace("feature:",""),s=[];for(let[i,a]of e)a===n.path&&s.push(i);r.set(o,{hub:n.path,outDegree:n.outDegree,files:s})}return r}function Pu(t,e,r){let n=[];for(let o of t.keys())!e.has(o)&&!r.has(o)&&n.push(o);return n}function rt(t,e){let r=e?.detectFn??fe,n=e?.hubComparator??Eu,o=r(t.nodes,e),s=Tu(t,o),i=Fu(t.nodes,o,s,n);return{features:Nu(o,i),unassigned:Pu(t.nodes,o,i)}}var Eu,zt=g(()=>{"use strict";l();Wt();Eu=(t,e)=>t.outDegree-e.outDegree});function fa(t){if(t.category==="test")return"test";if(t.category==="config")return"config";if(t.category==="type-only")return"types";let e=t.path,r=Ru(e);for(let n of Du)if(n.segments?.some(o=>Iu(e,o))||n.basenames?.includes(r))return n.role;return"other"}function Iu(t,e){return t.includes(`/${e}/`)||t.includes(`/${e}.`)}function Ru(t){let e=t.slice(t.lastIndexOf("/")+1);return e.slice(0,e.lastIndexOf("."))||e}var Du,ma=g(()=>{"use strict";l();Du=[{role:"component",segments:["component","components"]},{role:"controller",segments:["controller","controllers"]},{role:"middleware",segments:["middleware"]},{role:"router",segments:["router","routes","route"]},{role:"store",segments:["store","stores"]},{role:"service",segments:["service","services"]},{role:"handler",segments:["handler","handlers"]},{role:"adapter",segments:["adapter","adapters"]},{role:"plugin",segments:["plugin","plugins"]},{role:"api",segments:["api"]},{role:"cli",segments:["cli","commands"],basenames:["cli"]},{role:"util",segments:["util","utils","helper","helpers"]},{role:"model",segments:["model","models"],basenames:["model"]},{role:"parser",segments:["parser","parsers"],basenames:["parser"]},{role:"builder",basenames:["builder"]},{role:"resolver",basenames:["resolver"]}]});function Fn(t,e){let r=rt(t,e),n=new Map;for(let[s,i]of r.features){for(let a of i.files)n.set(a,s);n.set(i.hub,s)}let o=new Map;for(let s of t.nodes.values()){let i=n.get(s.path);o.set(s.path,{path:s.path,role:fa(s),...s.description?{description:s.description}:{},exports:s.exports.map(a=>a.name),...i?{featureHub:i}:{}})}return o}var Nn=g(()=>{"use strict";l();zt();ma()});function Pn(t,e){let r=[];for(let n of t.nodes.values())if(n.exports.some(o=>o.name===e))if(Dt.has(n.type)){let o=[];for(let s of t.nodes.values())for(let i of s.callEdges??[])i.to===e&&o.push({file:s.path,callerFunction:i.from});r.push({path:n.path,category:n.category,precision:"call",callers:o})}else{let o=tt(t,n.path).map(s=>({file:s.path,...s.symbols?{symbols:s.symbols}:{}}));r.push({path:n.path,category:n.category,precision:"file-level",importers:o})}return r}var ua=g(()=>{"use strict";l();It();Gt()});function Au(t){return t?t.startsWith("interface ")?"interface":t.startsWith("class ")?"class":t.startsWith("enum ")?"enum":"type":"type"}function Mu(t,e){if(e==="type-only")return!0;let r=t.signature??"";return r.startsWith("interface ")||r.startsWith("class ")||r.startsWith("enum ")}function Dn(t){let e=new Map;for(let n of t.nodes.values())if(!(n.type!=="typescript"&&n.type!=="javascript"))for(let o of n.exports){if(!Mu(o,n.category))continue;let s=`${n.path}::${o.name}`;e.set(s,{name:o.name,file:n.path,kind:Au(o.signature),...o.doc?{doc:o.doc}:{}})}let r=[];for(let n of t.nodes.values())if(!(n.type!=="typescript"&&n.type!=="javascript")){for(let o of n.imports)if(!(!o.toPath||o.isExternal||!o.symbols?.length))for(let s of o.symbols)e.has(`${o.toPath}::${s}`)&&r.push({fromFile:n.path,toType:s,toFile:o.toPath})}return{types:e,edges:r}}function In(t,e){let r=null;for(let s of t.types.values())if(s.name===e){r=s;break}if(!r)return{type:null,usedByFiles:[],uses:[]};let n=new Set,o=new Map;for(let s of t.edges)if(s.toType===e&&s.toFile===r.file&&n.add(s.fromFile),s.fromFile===r.file){let i=t.types.get(`${s.toFile}::${s.toType}`);i&&o.set(`${i.file}::${i.name}`,i)}return{type:r,usedByFiles:Array.from(n),uses:Array.from(o.values())}}var Rn=g(()=>{"use strict";l()});import ga from"fs";import qC from"path";function Bt(t){try{return ga.statSync(t,{throwIfNoEntry:!1})?.isDirectory()===!0}catch{return!1}}function Ht(t){try{return ga.statSync(t,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}var nt=g(()=>{"use strict";l()});import Lu from"fs";import An from"path";function da(t,e=[]){let r;try{r=Lu.readdirSync(t,{withFileTypes:!0})}catch{return e}for(let n of r){let o=An.join(t,n.name);n.isDirectory()?!_u.has(n.name)&&!n.name.startsWith(".")&&da(o,e):n.isFile()&&Ou.has(An.extname(n.name).toLowerCase())&&e.push(o)}return e}function Ut(t,e,r){if(!Bt(e))return null;let n=da(e);return n.length===0?null:{name:r,root:e,relativeRoot:An.relative(t,e),entryPoints:n}}var Ou,_u,Mn=g(()=>{"use strict";l();G();nt();Ou=new Set([".java",".kt",".kts",".scala",".sc",".groovy",".gradle"]),_u=new Set(I)});import ha from"fs";import ya from"path";function Gu(t){return t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/[^\n]*/g,"")}function ju(t){let e=Gu(t),r=new Set;for(let n of e.matchAll(/['"](:[A-Za-z0-9_\-.:]+)['"]/g)){let o=n[1].replace(/^:/,"").replace(/:$/,"");o&&r.add(o)}return[...r]}var xa,ba=g(()=>{"use strict";l();Mn();xa={type:"gradle",detect(t){let e=["settings.gradle.kts","settings.gradle"].map(s=>ya.join(t,s)).find(s=>ha.existsSync(s));if(!e)return null;let r;try{r=ha.readFileSync(e,"utf-8")}catch{return null}let n=ju(r);if(n.length===0)return null;let o=[];for(let s of n){let i=ya.join(t,...s.split(":")),a=Ut(t,i,s);a&&o.push(a)}return o.length>0?o:null}}});import ot from"fs";import A from"path";function Ln(t,e){let r=A.join(e,"package.json");if(!ot.existsSync(r))return null;let n={};try{n=JSON.parse(ot.readFileSync(r,"utf-8"))}catch{return null}let o=n.name;return o?{name:o,root:e,relativeRoot:A.relative(t,e),entryPoints:$u(e,n)}:null}function $u(t,e){let r=[];if(e.exports){let o=e.exports;if(typeof o=="string")r.push(A.join(t,o));else if(typeof o=="object"&&o!==null){let s=o["."];if(typeof s=="string")r.push(A.join(t,s));else if(typeof s=="object"&&s!==null){let i=s.import??s.require??s.default;typeof i=="string"&&r.push(A.join(t,i))}}}e.main&&r.push(A.join(t,e.main));for(let o of["src/index.ts","src/index.tsx","index.ts","index.tsx","index.js"])r.push(A.join(t,o));let n=r.filter(Ht);return n.length>0?n.slice(0,1):r.slice(0,1)}function Me(t,e){let r=[],n=new Set;for(let o of e){let s=o.replace(/\/$/,"").replace(/^\.\//,"");Wu(t,s,n,r)}return r}function Wu(t,e,r,n){if(!e.includes("*")){zu(t,e,r,n);return}let o=e.split("/");o.includes("**")?Bu(t,o,r,n):Hu(t,o,r,n)}function zu(t,e,r,n){let o=A.join(t,e);if(r.has(o)||!Bt(o))return;r.add(o);let s=Ln(t,o);s&&n.push(s)}function Bu(t,e,r,n){let o=A.join(t,e[0]==="**"?"":e[0]??"");Sa(t,o,r,n)}function Hu(t,e,r,n){let o=e.findIndex(a=>a.includes("*")),s=A.join(t,...e.slice(0,o)),i;try{i=ot.readdirSync(s,{withFileTypes:!0})}catch{return}for(let a of i){if(!a.isDirectory())continue;let c=A.join(s,a.name);if(r.has(c))continue;r.add(c);let p=Ln(t,c);p&&n.push(p)}}function Sa(t,e,r,n){let o;try{o=ot.readdirSync(e,{withFileTypes:!0})}catch{return}for(let s of o){if(!s.isDirectory()||s.name==="node_modules"||s.name.startsWith("."))continue;let i=A.join(e,s.name);if(ot.existsSync(A.join(i,"package.json"))&&!r.has(i)){r.add(i);let a=Ln(t,i);a&&n.push(a)}else Sa(t,i,r,n)}}var Jt=g(()=>{"use strict";l();nt();nt()});import On from"fs";import Ca from"path";var ka,va=g(()=>{"use strict";l();Jt();ka={type:"npm",detect(t){let e=Ca.join(t,"package.json");if(!On.existsSync(e))return null;let r;try{r=JSON.parse(On.readFileSync(e,"utf-8")).workspaces}catch{return null}if(!r||On.existsSync(Ca.join(t,"yarn.lock")))return null;let n=Array.isArray(r)?r:r.packages??[];return n.length===0?null:Me(t,n)}}});import Le from"fs";import N from"path";function Ea(t,e,r,n){if(n>4)return[];let o;try{o=Le.readdirSync(e,{withFileTypes:!0})}catch{return[]}let s=[];for(let i of o){if(!i.isDirectory())continue;let a=i.name;if(a.startsWith(".")||a==="node_modules"||a==="dist"||a===".nx")continue;let c=N.join(e,a);Le.existsSync(N.join(c,"project.json"))&&!r.has(c)?(r.add(c),s.push(c)):s.push(...Ea(t,c,r,n+1))}return s}function Uu(t,e,r){let n={};try{n=JSON.parse(Le.readFileSync(r,"utf-8"))}catch{return null}let o=n.name,s,i,a=N.join(e,"package.json");if(Le.existsSync(a))try{let c=JSON.parse(Le.readFileSync(a,"utf-8"));o=c.name??o,s=c.main,i=c.exports}catch{}return o?{name:o,root:e,relativeRoot:N.relative(t,e),entryPoints:Ju(e,n,s,i)}:null}function Ju(t,e,r,n){let o=[],s=e.targets?.build?.options?.main??e.targets?.build?.options?.entryFile;if(s){let a=N.resolve(t,"../..");o.push(N.resolve(a,s)),o.push(N.resolve(t,s))}if(n){let a=n;if(typeof a=="string")o.push(N.join(t,a));else if(typeof a=="object"&&a!==null){let c=a["."];typeof c=="string"&&o.push(N.join(t,c))}}if(r&&o.push(N.join(t,r)),e.sourceRoot){let a=N.resolve(t,"../.."),c=N.resolve(a,e.sourceRoot);o.push(N.join(c,"index.ts"),N.join(c,"index.tsx"))}for(let a of["src/index.ts","src/index.tsx","index.ts","index.tsx"])o.push(N.join(t,a));let i=o.filter(Ht);return i.length>0?i.slice(0,1):o.slice(0,1)}var wa,Ta=g(()=>{"use strict";l();nt();wa={type:"nx",detect(t){return Le.existsSync(N.join(t,"nx.json"))?Ea(t,t,new Set,0).map(r=>Uu(t,r,N.join(r,"project.json"))).filter(r=>r!==null):null}}});import Fa from"fs";import Ku from"path";import{load as Vu}from"js-yaml";var Na,Pa=g(()=>{"use strict";l();Jt();Na={type:"pnpm",detect(t){let e=Ku.join(t,"pnpm-workspace.yaml");if(!Fa.existsSync(e))return null;let r=[];try{r=Vu(Fa.readFileSync(e,"utf-8"))?.packages??[]}catch{return null}return Me(t,r)}}});import st from"fs";import Kt from"path";function qu(t){return t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/[^\n]*/g,"")}function Qu(t){let e=qu(t),r=new Map;for(let n of e.matchAll(/(?:lazy\s+)?val\s+([A-Za-z0-9_]+)\s*=\s*\(?\s*project\b([^\n]*)/g)){let o=n[1],i=n[2].match(/\bfile\s*\(\s*["']([^"']+)["']\s*\)/),a=i?i[1]:o;if(a==="."||a==="./")continue;let c=a.replace(/^\.\//,"").replace(/\/$/,"");r.has(c)||r.set(c,{name:o,dir:c})}return[...r.values()]}var Da,Ia=g(()=>{"use strict";l();Mn();Da={type:"sbt",detect(t){let e=Kt.join(t,"build.sbt"),r=Kt.join(t,"project");if(!st.existsSync(e)||!st.existsSync(r))return null;let n=[];try{n.push(st.readFileSync(e,"utf-8"))}catch{return null}try{for(let a of st.readdirSync(r))a.endsWith(".scala")&&n.push(st.readFileSync(Kt.join(r,a),"utf-8"))}catch{}let o=new Set,s=[];for(let a of n)for(let c of Qu(a))o.has(c.dir)||(o.add(c.dir),s.push(c));if(s.length===0)return null;let i=[];for(let a of s){let c=Kt.join(t,...a.dir.split("/")),p=Ut(t,c,a.name);p&&i.push(p)}return i.length>0?i:null}}});import Yu from"fs";import Xu from"path";var Ra,Aa=g(()=>{"use strict";l();Ra={type:"turborepo",detect(t){return Yu.existsSync(Xu.join(t,"turbo.json"))?[]:null}}});import _n from"fs";import Ma from"path";var La,Oa=g(()=>{"use strict";l();Jt();La={type:"yarn",detect(t){if(!_n.existsSync(Ma.join(t,"yarn.lock")))return null;let e=Ma.join(t,"package.json");if(!_n.existsSync(e))return null;let r;try{r=JSON.parse(_n.readFileSync(e,"utf-8")).workspaces}catch{return null}if(!r)return null;let n=Array.isArray(r)?r:r.packages??[];return n.length===0?null:Me(t,n)}}});function $(t){_a.push(t)}function Ga(){return _a}var _a,Vt=g(()=>{"use strict";l();_a=[]});import Zu from"path";function Gn(t,e=Ga()){let r=Zu.resolve(t),n=new Map,o=[];for(let i of e){let a=i.detect(r);if(a!==null){o.push(i.type);for(let c of a)n.has(c.name)||n.set(c.name,c)}}if(o.length===0)return{root:r,type:"none",types:[],packages:[],packageMap:new Map};let s=Array.from(n.values());return{root:r,type:o[0],types:o,packages:s,packageMap:new Map(s.map(i=>[i.name,i]))}}var jn=g(()=>{"use strict";l();ba();va();Ta();Pa();Ia();Aa();Oa();Vt();Vt();$(Ra);$(wa);$(Na);$(La);$(ka);$(xa);$(Da)});var it,$n=g(()=>{"use strict";l();xe();it=class t{constructor(e,r){this.monorepoRoot=e;this.type=r}monorepoRoot;type;packages=new Map;addPackage(e,r){this.packages.set(e.name,{graph:r,pkg:e})}annotateCrossPackageEdges(){for(let{graph:e}of this.packages.values())for(let r of e.nodes.values()){let n=this.getPackageForFile(r.path);if(n)for(let o of r.imports){if(o.isExternal||o.isWorkspace)continue;let s=this.getPackageForFile(o.toPath);s&&s.name!==n.name&&(o.isWorkspace=!0,o.workspacePackage=s.name)}}}getPackageForFile(e){for(let{pkg:r}of this.packages.values())if(e===r.relativeRoot||e.startsWith(`${r.relativeRoot}/`))return r}getPackageDependencies(){let e=new Map;for(let{graph:r,pkg:n}of this.packages.values()){let o=new Set;for(let s of r.nodes.values())for(let i of s.imports)i.isWorkspace&&i.workspacePackage&&o.add(i.workspacePackage);e.set(n.name,[...o])}return e}getAffectedAcrossPackages(e){let r=this.getPackageForFile(e);if(!r)return[];let n=this.packages.get(r.name);if(!n)return[];let o=[];n.graph.traverse(e,s=>(s.path!==e&&o.push({file:s.path,package:r.name}),!0),{direction:"incoming"});for(let{graph:s,pkg:i}of this.packages.values())if(i.name!==r.name)for(let a of s.nodes.values())a.imports.some(p=>p.isWorkspace&&p.workspacePackage===r.name)&&o.push({file:a.path,package:i.name});return o}serialize(){return{monorepoRoot:this.monorepoRoot,type:this.type,packages:Array.from(this.packages.values()).map(({graph:e,pkg:r})=>({pkg:{name:r.name,relativeRoot:r.relativeRoot,entryPoints:r.entryPoints},nodes:Array.from(e.nodes.values())}))}}static deserialize(e){let r=new t(e.monorepoRoot,e.type);for(let{pkg:n,nodes:o}of e.packages){let s=new Map(o.map(a=>[a.path,a])),i=new D(s);r.packages.set(n.name,{graph:i,pkg:{...n,root:""}})}return r}}});function ja(t,e){return e.startsWith("!")?t!==e.slice(1):t===e}function eg(t,e){return e.startsWith("!")?!t.includes(e.slice(1)):t.includes(e)}function at(t,e,r){return Ng.every(n=>n(t,e,r))}var tg,rg,ng,og,sg,ig,ag,cg,lg,pg,fg,mg,ug,gg,dg,hg,yg,xg,bg,Sg,Cg,kg,vg,wg,Eg,Tg,Fg,Ng,Wn=g(()=>{"use strict";l();tg=(t,e)=>!e.category||ja(t.category,e.category),rg=(t,e)=>!e.type||ja(t.type,e.type),ng=(t,e)=>e.lastAuthor?e.lastAuthor.startsWith("!")?t.lastAuthor!==e.lastAuthor.slice(1):t.lastAuthor!==void 0&&t.lastAuthor===e.lastAuthor:!0,og=(t,e)=>!e.path||eg(t.path,e.path),sg=(t,e)=>e.isExternal===void 0?!0:t.imports.some(n=>n.isExternal)===e.isExternal,ig=(t,e)=>{if(!e.tags||e.tags.length===0)return!0;let r=e.tags.filter(o=>!o.startsWith("!")),n=e.tags.filter(o=>o.startsWith("!")).map(o=>o.slice(1));return!(r.length>0&&!r.some(o=>t.tags.some(s=>s.name===o))||n.some(o=>t.tags.some(s=>s.name===o)))},ag=(t,e)=>!e.allTags?.length||e.allTags.every(r=>t.tags.some(n=>n.name===r)),cg=(t,e)=>!e.importsFile||t.imports.some(r=>r.toPath?.includes(e.importsFile)),lg=(t,e,r)=>e.importedBy===void 0?!0:(r?.get(t.path)??[]).some(o=>o.includes(e.importedBy)),pg=(t,e)=>e.minImports===void 0||t.imports.length>=e.minImports,fg=(t,e)=>e.maxImports===void 0||t.imports.length<=e.maxImports,mg=(t,e)=>e.minSize===void 0||t.size>=e.minSize,ug=(t,e)=>e.maxSize===void 0||t.size<=e.maxSize,gg=(t,e)=>e.hasDocstring===void 0||!!t.description===e.hasDocstring,dg=(t,e)=>e.isDocumented===void 0||!!t.documentedBy?.length===e.isDocumented,hg=(t,e)=>e.isStale===void 0||!!t.staleFor?.length===e.isStale,yg=(t,e)=>e.minCoverage===void 0||(t.coveragePct??101)>=e.minCoverage,xg=(t,e)=>e.maxCoverage===void 0||(t.coveragePct??0)<=e.maxCoverage,bg=(t,e)=>e.minExportUsage===void 0||(t.avgExportUsage??-1)>=e.minExportUsage,Sg=(t,e)=>e.maxExportUsage===void 0||(t.avgExportUsage??0)<=e.maxExportUsage,Cg=(t,e)=>e.minComplexity===void 0||(t.complexity??-1/0)>=e.minComplexity,kg=(t,e)=>e.maxComplexity===void 0||(t.complexity??0)<=e.maxComplexity,vg=(t,e)=>e.minCognitiveComplexity===void 0||(t.cognitiveComplexity??-1/0)>=e.minCognitiveComplexity,wg=(t,e)=>e.maxCognitiveComplexity===void 0||(t.cognitiveComplexity??0)<=e.maxCognitiveComplexity,Eg=(t,e)=>e.minCommits===void 0||(t.commitCount90d??-1/0)>=e.minCommits,Tg=(t,e)=>e.maxCommits===void 0||(t.commitCount90d??0)<=e.maxCommits,Fg=(t,e,r)=>!e.any?.length||e.any.some(n=>at(t,n,r)),Ng=[tg,rg,ng,og,sg,ig,ag,cg,lg,pg,fg,mg,ug,gg,dg,hg,yg,xg,bg,Sg,Cg,kg,vg,wg,Eg,Tg,Fg]});function qt(t,e){let r=new Map;if(e.importedBy!==void 0){for(let i of t.nodes)for(let a of i.imports)if(a.toPath){let c=r.get(a.toPath)??[];c.push(i.path),r.set(a.toPath,c)}}let n=t.nodes.filter(i=>at(i,e,r)),o=new Set(n.map(i=>i.path)),s=n.map(i=>({...i,imports:i.imports.filter(a=>!a.toPath||o.has(a.toPath))}));if(e.sort){let i=e.sortDir==="asc"?-1:1;s.sort((a,c)=>{let p=0;switch(e.sort){case"size":p=c.size-a.size;break;case"imports":p=c.imports.length-a.imports.length;break;case"commitCount90d":p=(c.commitCount90d??0)-(a.commitCount90d??0);break;case"exportUsage":p=(c.avgExportUsage??0)-(a.avgExportUsage??0);break;case"complexity":p=(c.complexity??0)-(a.complexity??0);break;case"cognitiveComplexity":p=(c.cognitiveComplexity??0)-(a.cognitiveComplexity??0);break}return p*i})}return e.limit!==void 0&&s.splice(e.limit),{nodes:s,cycles:t.cycles?.filter(i=>i.every(a=>o.has(a)))??void 0}}var $a=g(()=>{"use strict";l();Wn();Wn()});function Dg(t,e,r,n){let o=t;switch(r){case"string":o[e]=n;break;case"int":o[e]=parseInt(n,10);break;case"float":o[e]=parseFloat(n);break;case"boolNotFalse":o[e]=n.toLowerCase()!=="false";break;case"boolIsTrue":o[e]=n.toLowerCase()==="true";break}}function za(t,e){let r=e.indexOf(":");if(r===-1)return;let n=e.slice(0,r).trim().toLowerCase(),o=e.slice(r+1).trim();if(!n||!o)return;if(n==="tag"||n==="tags"){o.includes("+")?t.allTags=[...t.allTags??[],...o.split("+")]:t.tags=[...t.tags??[],o];return}if(n==="sort"){t.sort=o;return}if(n==="sortdir"){t.sortDir=o.toLowerCase()==="asc"?"asc":"desc";return}let s=Pg[n];s&&Dg(t,s.field,s.kind,o)}function Ig(t){let e=[];for(let r of t.split("|")){let n=r.trim();if(!n)continue;let o={};za(o,n),Object.keys(o).length>0&&e.push(o)}return e}function Qt(t){let e={},r=t.split(",");for(let n of r){let o=n.trim();if(o.toLowerCase().startsWith(Wa)&&o.endsWith(")")){let s=o.slice(Wa.length,-1),i=Ig(s);i.length>0&&(e.any=[...e.any??[],...i]);continue}za(e,n)}return e}var Pg,Wa,Ba=g(()=>{"use strict";l();Pg={category:{field:"category",kind:"string"},type:{field:"type",kind:"string"},path:{field:"path",kind:"string"},importsfile:{field:"importsFile",kind:"string"},importedby:{field:"importedBy",kind:"string"},lastauthor:{field:"lastAuthor",kind:"string"},external:{field:"isExternal",kind:"boolIsTrue"},hasdocstring:{field:"hasDocstring",kind:"boolNotFalse"},isdocumented:{field:"isDocumented",kind:"boolNotFalse"},isstale:{field:"isStale",kind:"boolNotFalse"},minimports:{field:"minImports",kind:"int"},maximports:{field:"maxImports",kind:"int"},minsize:{field:"minSize",kind:"int"},maxsize:{field:"maxSize",kind:"int"},limit:{field:"limit",kind:"int"},mincoverage:{field:"minCoverage",kind:"int"},maxcoverage:{field:"maxCoverage",kind:"int"},minexportusage:{field:"minExportUsage",kind:"float"},maxexportusage:{field:"maxExportUsage",kind:"float"},mincomplexity:{field:"minComplexity",kind:"int"},maxcomplexity:{field:"maxComplexity",kind:"int"},mincognitivecomplexity:{field:"minCognitiveComplexity",kind:"int"},maxcognitivecomplexity:{field:"maxCognitiveComplexity",kind:"int"},mincommits:{field:"minCommits",kind:"int"},maxcommits:{field:"maxCommits",kind:"int"}};Wa="any("});var Ha=g(()=>{"use strict";l();$a();Ba()});import Rg from"path";import F from"typescript";function me(t,e){let r=t[e];if(r===void 0)throw new Error(`Index ${e} out of bounds (length ${t.length})`);return r}function zn(t){let e=[];for(let r of t.statements){if(!F.isExpressionStatement(r))continue;let n=r.expression;if(!F.isCallExpression(n))continue;let o=n.expression;F.isIdentifier(o)&&Ua.has(o.text)&&e.push(n),F.isPropertyAccessExpression(o)&&F.isIdentifier(o.expression)&&Ua.has(o.expression.text)&&e.push(n)}return e}function Bn(t,e,r){for(let n of t.arguments){if(!F.isObjectLiteralExpression(n))continue;let o=n.properties.find(s=>F.isPropertyAssignment(s)&&F.isIdentifier(s.name)&&s.name.text===e);if(!(!o||!F.isArrayLiteralExpression(o.initializer)))return o.initializer.elements.filter(F.isStringLiteral).map(s=>s.text)}return null}function Hn(t,e,r,n){if(t.arguments.length===0)return null;for(let s=1;s<t.arguments.length;s++){let i=me(t.arguments,s);if(!F.isObjectLiteralExpression(i))continue;let a=i.properties.find(p=>F.isPropertyAssignment(p)&&F.isIdentifier(p.name)&&p.name.text===e);if(a)return{start:a.initializer.getStart(n),end:a.initializer.getEnd(),text:r};let c=i.getEnd()-1;return{start:c,end:c,text:`${i.properties.length>0?", ":""}${e}: ${r}`}}let o=me(t.arguments,t.arguments.length-1);return{start:o.getStart(n),end:o.getStart(n),text:`{ ${e}: ${r} }, `}}function Un(t,e,r){let n=t.arguments;for(let o=1;o<n.length;o++){let s=me(n,o);if(!F.isObjectLiteralExpression(s))continue;let i=s.properties.findIndex(c=>F.isPropertyAssignment(c)&&F.isIdentifier(c.name)&&c.name.text===e);if(i<0)continue;if(s.properties.length===1)return{start:me(n,o-1).getEnd(),end:s.getEnd(),text:""};let a=me(s.properties,i);return i===s.properties.length-1?{start:me(s.properties,i-1).getEnd(),end:a.getEnd(),text:""}:{start:a.getStart(r),end:me(s.properties,i+1).getStart(r),text:""}}return null}function Jn(t,e){let r=[...e].sort((o,s)=>s.start-o.start),n=t;for(let o of r)n=n.slice(0,o.start)+o.text+n.slice(o.end);return n}function Kn(t){return`[${t.map(e=>JSON.stringify(e)).join(", ")}]`}function Ag(t){return t.map(e=>e.startsWith("@")?e.slice(1):e)}function Yt(t,e,r,n){let o=F.createSourceFile(Rg.basename(t),e,F.ScriptTarget.Latest,!0),s=zn(o),[i]=s;if(!i)return e;let a=Bn(i,n,o),c=[...r].sort();if(a!==null&&JSON.stringify(Ag(a).sort())===JSON.stringify(c))return e;let p=Kn(c.map(u=>`@${u}`)),f=s.flatMap(u=>{let y=r.length===0?Un(u,n,o):Hn(u,n,p,o);return y?[y]:[]});return f.length>0?Jn(e,f):e}var Ua,W,Oe=g(()=>{"use strict";l();Ua=new Set(["describe","test","it"]);W=new Set([".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"])});import Mg from"path";var Xt,Ja=g(()=>{"use strict";l();Oe();Xt=class{name="cypress";canHandle(e){return W.has(Mg.extname(e).toLowerCase())}apply(e,r,n){return Yt(e,r,n,"tags")}}});import Lg from"path";function Og(t){return`${["# <mokosh-tags>",...t.map(e=>`@${e}`),"# </mokosh-tags>"].join(`
|
|
29
|
+
`),null}}var Iu,Au,Bt=d(()=>{"use strict";l();j();tr();Yi();Ir();Zi();ca();ma();Ir();ua();Iu=20,Au=new Set(["css","scss","less"])});var fe,Ht=d(()=>{"use strict";l();fe=class{affectedSymbols=new Map;constructor(e,n){this.affectedSymbols.set(e,new Set(["default",...n]))}updateAffectedSymbols(e,n){let r=this.affectedSymbols.get(n)||new Set,o=e.imports.find(c=>c.toPath===n);if(!o)return!1;let s=o.symbols||["*"],i=new Set;for(let c of s)(c==="*"||r.has("*")||r.has(c))&&i.add("*");if(i.size===0)return!1;let a=this.affectedSymbols.get(e.path)||new Set;for(let c of i)a.add(c);return this.affectedSymbols.set(e.path,a),!0}}});function me(t,e){let n=t.nodes.get(e);if(n)return{category:n.category,exports:n.exports.map(r=>r.name)}}function Mr(t,e,n=1){let r=[];return t.traverse(e,(o,s,i)=>{if(o.path===e)return!0;let a=i?t.nodes.get(i)?.imports.find(c=>c.toPath===o.path):void 0;return r.push({path:o.path,...a?.symbols?{symbols:a.symbols}:{}}),!0},{direction:"outgoing",maxDepth:n}),r}function st(t,e){let n=[];return t.traverse(e,r=>{if(r.path===e)return!0;let o=r.imports.find(s=>s.toPath===e);return n.push({path:r.path,...o?.symbols?{symbols:o.symbols}:{}}),!0},{direction:"incoming",maxDepth:1}),n}function Lr(t,e,n={}){let{testsOnly:r=!1,changedSymbols:o}=n,s=o?new fe(e,o):null,i=[];return t.traverse(e,(a,c,p)=>{if(a.path===e)return!0;if(s&&p&&!s.updateAffectedSymbols(a,p))return!1;let f=a.category==="test"||a.tags.some(m=>m.name==="test");return(!r||f)&&i.push(a.path),!0},{direction:"incoming"}),i}function Or(t,e,n={}){let{depth:r=1,withEdgeDetail:o=!1}=n,s=[];return t.traverseCalls(e,i=>{if(i.path===e)return!0;let a={file:i.path};return o&&(a.edges=(i.callEdges??[]).filter(c=>c.toFile===e).map(c=>({from:c.from,to:c.to}))),s.push(a),!0},{direction:"incoming",maxDepth:r}),s}function _e(t,e={}){let{metric:n="cognitiveComplexity",threshold:r=10,limit:o=20}=e;return[...t.nodes.values()].flatMap(s=>(s.functions??[]).filter(i=>i[n]>=r).map(i=>({file:s.path,name:i.name,line:i.line,complexity:i.complexity,cognitiveComplexity:i.cognitiveComplexity}))).sort((s,i)=>i[n]-s[n]).slice(0,o)}function _r(t){return{nodes:t.nodes.map(n=>({path:n.path,type:n.type,category:n.category,exports:n.exports.map(r=>r.name),tags:n.tags.filter(r=>r.kind==="comment-marker"||r.kind==="import").map(r=>r.name),importsFiles:n.imports.filter(r=>!r.isExternal&&r.toPath).map(r=>r.toPath),...n.description!==void 0&&{description:n.description},...n.testedBy!==void 0&&{testedBy:n.testedBy},...n.coveragePct!==void 0&&{coveragePct:n.coveragePct},...n.avgExportUsage!==void 0&&{avgExportUsage:n.avgExportUsage},...n.maxExportUsage!==void 0&&{maxExportUsage:n.maxExportUsage}})),cycles:t.cycles}}function Gr(t){let e=t.getPackageDependencies(),n=Array.from(t.packages.values()).map(({graph:r,pkg:o})=>({name:o.name,relativeRoot:o.relativeRoot,nodeCount:r.nodes.size,dependsOn:e.get(o.name)??[]}));return{monorepoType:t.type,packageCount:n.length,packages:n}}function ne(t){return[...t.nodes.values()].some(e=>e.coveragePct!==void 0)}function ha(t){return[...t.nodes.values()].some(e=>e.commitCount90d!==void 0)}function Ge(t,e={}){let{metric:n="cognitiveComplexity",minComplexity:r=10,maxCoveragePct:o=50,minChurn:s=0,limit:i=20}=e,a=ha(t),c=[...t.nodes.values()].filter(p=>p.coveragePct!==void 0&&p.coveragePct<=o&&(!a||(p.commitCount90d??0)>=s)).flatMap(p=>(p.functions??[]).filter(f=>f[n]>=r).map(f=>({file:p.path,name:f.name,line:f.line,complexity:f.complexity,cognitiveComplexity:f.cognitiveComplexity,coveragePct:p.coveragePct,...p.commitCount90d!==void 0&&{commitCount90d:p.commitCount90d}}))).sort((p,f)=>f[n]-p[n]).slice(0,i);return{hotspots:c,count:c.length,churnDataAvailable:a}}var Ut=d(()=>{"use strict";l();Ht()});import{execFileSync as $r}from"child_process";import jr from"fs";import _u from"os";import Gu from"path";function Wr(t,e){try{return $r("git",["rev-parse","--verify",`${e}^{commit}`],{cwd:t,encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim()}catch{throw new Error(`Could not resolve git ref "${e}" in ${t}`)}}async function ya(t,e,n){let r=jr.mkdtempSync(Gu.join(_u.tmpdir(),`mokosh-worktree-${e.slice(0,12)}-`));jr.rmdirSync(r);try{return $r("git",["worktree","add","--detach",r,e],{cwd:t,stdio:["ignore","pipe","pipe"]}),await n(r)}finally{try{$r("git",["worktree","remove","--force",r],{cwd:t,stdio:["ignore","pipe","pipe"]})}catch{jr.rmSync(r,{recursive:!0,force:!0})}}}var xa=d(()=>{"use strict";l()});import ju from"path";async function wa(t,e,n,r={}){let o=Wr(t,e),s=ms(t,o);if(s)return{sha:o,graph:s};let i=await ya(t,o,async a=>{let c=r.pathAliases?new K(a,{pathAliases:r.pathAliases}):void 0;return new pe(a,null,c,void 0,r.gitStats??!1,new Map,r.parallelParsing??!0,r.additionalIgnoreDirs??[]).build(n)});return us(t,o,i),{sha:o,graph:i}}function $u(t,e){return`${t.file}:${t.line} ${t.name} (${t[e]})`}function Wu(t,e){return`${t.file}:${t.line} ${t.name} (${t[e]}, cov ${t.coveragePct}%)`}function zu(t,e=4){let n=t.occurrences.slice(0,e).map(s=>`${s.file}:${s.startLine}-${s.endLine}`),r=t.occurrences.length-n.length,o=r>0?`, +${r} more`:"";return`${t.lines}L x${t.occurrences.length}: ${n.join(", ")}${o}`}function Bu(t,e){let{files:n,staleReferences:r,duplication:o,complexity:s,docDrift:i,coverage:a}=t,c=[],p=[n.added.length&&`${n.added.length} added`,n.changed.length&&`${n.changed.length} changed`,n.removed.length&&`${n.removed.length} removed`].filter(Boolean);c.push(p.length?`Files: ${p.join(", ")}`:"No file changes"),r.length>0&&c.push(`\u26A0 ${ue(r.length,"stale reference")} \u2014 removed export still imported`);let f=s.newHotspots[0];return f?c.push(`+${ue(s.newHotspots.length,"complexity hotspot")} (max ${e} ${f[e]} in ${f.file})`):s.resolvedHotspots.length>0&&c.push(`${ue(s.resolvedHotspots.length,"complexity hotspot")} resolved`),o.newGroups.length>0?c.push(`+${ue(o.newGroups.length,"duplication group")}`):o.resolvedGroups.length>0&&c.push(`${ue(o.resolvedGroups.length,"duplication group")} resolved`),i.newlyStale.length>0&&c.push(`${ue(i.newlyStale.length,"doc")} newly stale`),a&&a.newHotspots.length>0&&c.push(`+${ue(a.newHotspots.length,"risk hotspot")}`),c}function Hu(t){let{staleReferences:e,duplication:n,complexity:r,docDrift:o,coverage:s}=t;return e.length>0||(s?.newHotspots.length??0)>0?"attention":r.newHotspots.length>0||n.newGroups.length>0||o.newlyStale.length>0?"review-worthy":"clean"}function zr(t,e={}){let n=e.metric??"cognitiveComplexity",r=e.maxItems??8,o=e.maxPathList??100,{files:s,staleReferences:i,duplication:a,complexity:c,docDrift:p,coverage:f}=t,m=ba(c.head.avgCognitiveComplexity-c.base.avgCognitiveComplexity),h=s.added.length+s.changed.length+s.removed.length,y={base:`${t.base.ref}@${Sa(t.base.sha)}`,head:`${t.head.ref}@${Sa(t.head.sha)}`,verdict:Hu(t),headline:Bu(t,n),files:{added:s.added.length,changed:s.changed.length,removed:s.removed.length,...h<=o?{paths:{added:s.added,changed:s.changed,removed:s.removed}}:{}}};return i.length>0&&(y.staleReferences=i),(c.newHotspots.length>0||c.resolvedHotspots.length>0)&&(y.complexity={avgDelta:m,newHotspots:c.newHotspots.slice(0,r).map(b=>$u(b,n)),newHotspotCount:c.newHotspots.length,resolvedCount:c.resolvedHotspots.length}),(a.newGroups.length>0||a.resolvedGroups.length>0)&&(y.duplication={newGroups:a.newGroups.slice(0,r).map(b=>zu(b)),newGroupCount:a.newGroups.length,resolvedCount:a.resolvedGroups.length,totalGroups:a.head.groups}),(p.newlyStale.length>0||p.resolved.length>0)&&(y.docDrift={newlyStale:p.newlyStale.slice(0,r).map(b=>b.replace("::"," \u2192 ")),newlyStaleCount:p.newlyStale.length,resolvedCount:p.resolved.length}),f&&(f.newHotspots.length>0||f.resolvedHotspots.length>0)&&(y.coverage={avgDelta:ba(f.head.avgCoveragePct-f.base.avgCoveragePct),newHotspots:f.newHotspots.slice(0,r).map(b=>Wu(b,n)),newHotspotCount:f.newHotspots.length,resolvedCount:f.resolvedHotspots.length}),y}function Uu(t,e){let n=[],r=[];for(let[s,i]of e.nodes){let a=t.nodes.get(s);if(!a){n.push(s);continue}let c=JSON.stringify({category:a.category,exports:a.exports.map(f=>f.name).sort(),imports:a.imports.map(f=>f.toPath).sort()}),p=JSON.stringify({category:i.category,exports:i.exports.map(f=>f.name).sort(),imports:i.imports.map(f=>f.toPath).sort()});c!==p&&r.push(s)}let o=[...t.nodes.keys()].filter(s=>!e.nodes.has(s));return{added:n,removed:o,changed:r}}function Ju(t,e){let n=[];for(let[r,o]of t.nodes){let s=e.nodes.get(r);if(!s)continue;let i=new Set(s.exports.map(c=>c.name)),a=o.exports.map(c=>c.name).filter(c=>!i.has(c));if(a.length!==0)for(let c of a){let p=[...e.nodes.values()].filter(f=>f.imports.some(m=>m.toPath===r&&m.symbols?.includes(c))).map(f=>f.path);p.length>0&&n.push({file:r,symbol:c,stillReferencedBy:p})}}return n}function Jt(t){return t.occurrences.map(e=>`${e.file}:${e.startLine}-${e.endLine}`).sort().join("|")}async function Ku(t,e,n,r,o){let s=ju.join(Ct(t),`${r}-${re}`),i=Me(s),[{groups:a},{groups:c}]=await Promise.all([Oe(e,t,{minLines:o,tokenCache:i}),Oe(n,t,{minLines:o})]);Le(i,s);let p=new Set(a.map(Jt)),f=new Set(c.map(Jt));return{base:{groups:a.length},head:{groups:c.length},newGroups:c.filter(m=>!p.has(Jt(m))),resolvedGroups:a.filter(m=>!f.has(Jt(m)))}}function Ca(t){let e=[...t.nodes.values()].map(n=>n.cognitiveComplexity).filter(n=>n!==void 0);return e.length===0?0:e.reduce((n,r)=>n+r,0)/e.length}function Vu(t,e,n,r){let o=_e(t,{metric:n,threshold:r,limit:1/0}),s=_e(e,{metric:n,threshold:r,limit:1/0}),i=p=>`${p.file}:${p.name}`,a=new Set(o.map(i)),c=new Set(s.map(i));return{base:{avgCognitiveComplexity:Ca(t)},head:{avgCognitiveComplexity:Ca(e)},newHotspots:s.filter(p=>!a.has(i(p))),resolvedHotspots:o.filter(p=>!c.has(i(p)))}}function ka(t){let e=new Set;for(let n of t.nodes.values())if(!(n.type!=="markdown"||!n.staleFor))for(let r of n.staleFor)e.add(`${n.path}::${r}`);return e}function qu(t,e){let n=ka(t),r=ka(e);return{base:{staleCount:n.size},head:{staleCount:r.size},newlyStale:[...r].filter(o=>!n.has(o)),resolved:[...n].filter(o=>!r.has(o))}}function va(t){let e=[...t.nodes.values()].map(n=>n.coveragePct).filter(n=>n!==void 0);return e.length===0?0:e.reduce((n,r)=>n+r,0)/e.length}function Yu(t,e,n){if(!ne(t)||!ne(e))return null;let r=Ge(t,{maxCoveragePct:n,limit:1/0}).hotspots,o=Ge(e,{maxCoveragePct:n,limit:1/0}).hotspots,s=c=>`${c.file}:${c.name}`,i=new Set(r.map(s)),a=new Set(o.map(s));return{base:{avgCoveragePct:va(t)},head:{avgCoveragePct:va(e)},newHotspots:o.filter(c=>!i.has(s(c))),resolvedHotspots:r.filter(c=>!a.has(s(c)))}}async function Br(t,e,n,r={}){let{sha:o,graph:s}=await wa(t,e,r.entryPoints??[],r),i=Wr(t,r.headRef??"HEAD"),[a,c]=await Promise.all([Ku(t,s,n,o,r.minDuplicateLines),Promise.resolve(Yu(s,n,r.maxCoveragePct))]);return{base:{ref:e,sha:o},head:{ref:r.headRef??"HEAD",sha:i},files:Uu(s,n),staleReferences:Ju(s,n),duplication:a,complexity:Vu(s,n,r.complexityMetric,r.complexityThreshold),docDrift:qu(s,n),coverage:c}}var ba,Sa,ue,Ea=d(()=>{"use strict";l();j();ds();Rr();Bt();Ut();Wt();xa();ba=t=>Math.round(t*100)/100,Sa=t=>t.length>8?t.slice(0,8):t;ue=(t,e)=>`${t} ${e}${t===1?"":"s"}`});import Kt from"path";function Qu(t){let e=new Map;for(let[n,r]of t){let o=r.imports.filter(s=>s.toPath&&!s.isExternal).length;o>0&&e.set(n,o)}return e}function Xu(t,e,n){let r=new Map;for(let[o,s]of e){if(s<n)continue;let i=t.get(o);if(!i||i.category==="test"||i.category==="barrel")continue;let a=Kt.extname(o),c=Kt.basename(o,a),p=c==="index"?Kt.basename(Kt.dirname(o)):c;r.set(o,{path:o,outDegree:s,tag:`feature:${p}`})}return r}function de(t,e){let n=e?.minOutDegree??5;return Xu(t,Qu(t),n)}var Vt=d(()=>{"use strict";l()});function ed(t,e){let n=new Map;for(let r of e.values()){let o=new Set;t.traverse(r.path,s=>(s.path!==r.path&&o.add(s.path),!0),{direction:"outgoing"}),n.set(r.path,o)}return n}function td(t,e,n,r){let o=new Map;for(let[s]of t){if(e.has(s))continue;let i=null;for(let a of e.values())n.get(a.path)?.has(s)&&(!i||r(a,i)<0)&&(i=a);i&&o.set(s,i.path)}return o}function nd(t,e){let n=new Map;for(let r of t.values()){let o=r.tag.replace("feature:",""),s=[];for(let[i,a]of e)a===r.path&&s.push(i);n.set(o,{hub:r.path,outDegree:r.outDegree,files:s})}return n}function rd(t,e,n){let r=[];for(let o of t.keys())!e.has(o)&&!n.has(o)&&r.push(o);return r}function it(t,e){let n=e?.detectFn??de,r=e?.hubComparator??Zu,o=n(t.nodes,e),s=ed(t,o),i=td(t.nodes,o,s,r);return{features:nd(o,i),unassigned:rd(t.nodes,o,i)}}var Zu,qt=d(()=>{"use strict";l();Vt();Zu=(t,e)=>t.outDegree-e.outDegree});function Ta(t){if(t.category==="test")return"test";if(t.category==="config")return"config";if(t.category==="type-only")return"types";let e=t.path,n=id(e);for(let r of od)if(r.segments?.some(o=>sd(e,o))||r.basenames?.includes(n))return r.role;return"other"}function sd(t,e){return t.includes(`/${e}/`)||t.includes(`/${e}.`)}function id(t){let e=t.slice(t.lastIndexOf("/")+1);return e.slice(0,e.lastIndexOf("."))||e}var od,Fa=d(()=>{"use strict";l();od=[{role:"component",segments:["component","components"]},{role:"controller",segments:["controller","controllers"]},{role:"middleware",segments:["middleware"]},{role:"router",segments:["router","routes","route"]},{role:"store",segments:["store","stores"]},{role:"service",segments:["service","services"]},{role:"handler",segments:["handler","handlers"]},{role:"adapter",segments:["adapter","adapters"]},{role:"plugin",segments:["plugin","plugins"]},{role:"api",segments:["api"]},{role:"cli",segments:["cli","commands"],basenames:["cli"]},{role:"util",segments:["util","utils","helper","helpers"]},{role:"model",segments:["model","models"],basenames:["model"]},{role:"parser",segments:["parser","parsers"],basenames:["parser"]},{role:"builder",basenames:["builder"]},{role:"resolver",basenames:["resolver"]}]});function Hr(t,e){let n=it(t,e),r=new Map;for(let[s,i]of n.features){for(let a of i.files)r.set(a,s);r.set(i.hub,s)}let o=new Map;for(let s of t.nodes.values()){let i=r.get(s.path);o.set(s.path,{path:s.path,role:Ta(s),...s.description?{description:s.description}:{},exports:s.exports.map(a=>a.name),...i?{featureHub:i}:{}})}return o}var Ur=d(()=>{"use strict";l();qt();Fa()});function Jr(t,e){let n=[];for(let r of t.nodes.values())if(r.exports.some(o=>o.name===e))if(Lt.has(r.type)){let o=[];for(let s of t.nodes.values())for(let i of s.callEdges??[])i.to===e&&o.push({file:s.path,callerFunction:i.from});n.push({path:r.path,category:r.category,precision:"call",callers:o})}else{let o=st(t,r.path).map(s=>({file:s.path,...s.symbols?{symbols:s.symbols}:{}}));n.push({path:r.path,category:r.category,precision:"file-level",importers:o})}return n}var Na=d(()=>{"use strict";l();Ot();Ut()});function ad(t){return t?t.startsWith("interface ")?"interface":t.startsWith("class ")?"class":t.startsWith("enum ")?"enum":"type":"type"}function cd(t,e){if(e==="type-only")return!0;let n=t.signature??"";return n.startsWith("interface ")||n.startsWith("class ")||n.startsWith("enum ")}function Kr(t){let e=new Map;for(let r of t.nodes.values())if(!(r.type!=="typescript"&&r.type!=="javascript"))for(let o of r.exports){if(!cd(o,r.category))continue;let s=`${r.path}::${o.name}`;e.set(s,{name:o.name,file:r.path,kind:ad(o.signature),...o.doc?{doc:o.doc}:{}})}let n=[];for(let r of t.nodes.values())if(!(r.type!=="typescript"&&r.type!=="javascript")){for(let o of r.imports)if(!(!o.toPath||o.isExternal||!o.symbols?.length))for(let s of o.symbols)e.has(`${o.toPath}::${s}`)&&n.push({fromFile:r.path,toType:s,toFile:o.toPath})}return{types:e,edges:n}}function Vr(t,e){let n=null;for(let s of t.types.values())if(s.name===e){n=s;break}if(!n)return{type:null,usedByFiles:[],uses:[]};let r=new Set,o=new Map;for(let s of t.edges)if(s.toType===e&&s.toFile===n.file&&r.add(s.fromFile),s.fromFile===n.file){let i=t.types.get(`${s.toFile}::${s.toType}`);i&&o.set(`${i.file}::${i.name}`,i)}return{type:n,usedByFiles:Array.from(r),uses:Array.from(o.values())}}var qr=d(()=>{"use strict";l()});import Pa from"fs";import Gk from"path";function Yt(t){try{return Pa.statSync(t,{throwIfNoEntry:!1})?.isDirectory()===!0}catch{return!1}}function Qt(t){try{return Pa.statSync(t,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}var at=d(()=>{"use strict";l()});import ld from"fs";import Yr from"path";function Da(t,e=[]){let n;try{n=ld.readdirSync(t,{withFileTypes:!0})}catch{return e}for(let r of n){let o=Yr.join(t,r.name);r.isDirectory()?!fd.has(r.name)&&!r.name.startsWith(".")&&Da(o,e):r.isFile()&&pd.has(Yr.extname(r.name).toLowerCase())&&e.push(o)}return e}function Xt(t,e,n){if(!Yt(e))return null;let r=Da(e);return r.length===0?null:{name:n,root:e,relativeRoot:Yr.relative(t,e),entryPoints:r}}var pd,fd,Qr=d(()=>{"use strict";l();j();at();pd=new Set([".java",".kt",".kts",".scala",".sc",".groovy",".gradle"]),fd=new Set(A)});import Ra from"fs";import Ia from"path";function md(t){return t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/[^\n]*/g,"")}function ud(t){let e=md(t),n=new Set;for(let r of e.matchAll(/['"](:[A-Za-z0-9_\-.:]+)['"]/g)){let o=r[1].replace(/^:/,"").replace(/:$/,"");o&&n.add(o)}return[...n]}var Aa,Ma=d(()=>{"use strict";l();Qr();Aa={type:"gradle",detect(t){let e=["settings.gradle.kts","settings.gradle"].map(s=>Ia.join(t,s)).find(s=>Ra.existsSync(s));if(!e)return null;let n;try{n=Ra.readFileSync(e,"utf-8")}catch{return null}let r=ud(n);if(r.length===0)return null;let o=[];for(let s of r){let i=Ia.join(t,...s.split(":")),a=Xt(t,i,s);a&&o.push(a)}return o.length>0?o:null}}});import ct from"fs";import L from"path";function Xr(t,e){let n=L.join(e,"package.json");if(!ct.existsSync(n))return null;let r={};try{r=JSON.parse(ct.readFileSync(n,"utf-8"))}catch{return null}let o=r.name;return o?{name:o,root:e,relativeRoot:L.relative(t,e),entryPoints:dd(e,r)}:null}function dd(t,e){let n=[];if(e.exports){let o=e.exports;if(typeof o=="string")n.push(L.join(t,o));else if(typeof o=="object"&&o!==null){let s=o["."];if(typeof s=="string")n.push(L.join(t,s));else if(typeof s=="object"&&s!==null){let i=s.import??s.require??s.default;typeof i=="string"&&n.push(L.join(t,i))}}}e.main&&n.push(L.join(t,e.main));for(let o of["src/index.ts","src/index.tsx","index.ts","index.tsx","index.js"])n.push(L.join(t,o));let r=n.filter(Qt);return r.length>0?r.slice(0,1):n.slice(0,1)}function je(t,e){let n=[],r=new Set;for(let o of e){let s=o.replace(/\/$/,"").replace(/^\.\//,"");gd(t,s,r,n)}return n}function gd(t,e,n,r){if(!e.includes("*")){hd(t,e,n,r);return}let o=e.split("/");o.includes("**")?yd(t,o,n,r):xd(t,o,n,r)}function hd(t,e,n,r){let o=L.join(t,e);if(n.has(o)||!Yt(o))return;n.add(o);let s=Xr(t,o);s&&r.push(s)}function yd(t,e,n,r){let o=L.join(t,e[0]==="**"?"":e[0]??"");La(t,o,n,r)}function xd(t,e,n,r){let o=e.findIndex(a=>a.includes("*")),s=L.join(t,...e.slice(0,o)),i;try{i=ct.readdirSync(s,{withFileTypes:!0})}catch{return}for(let a of i){if(!a.isDirectory())continue;let c=L.join(s,a.name);if(n.has(c))continue;n.add(c);let p=Xr(t,c);p&&r.push(p)}}function La(t,e,n,r){let o;try{o=ct.readdirSync(e,{withFileTypes:!0})}catch{return}for(let s of o){if(!s.isDirectory()||s.name==="node_modules"||s.name.startsWith("."))continue;let i=L.join(e,s.name);if(ct.existsSync(L.join(i,"package.json"))&&!n.has(i)){n.add(i);let a=Xr(t,i);a&&r.push(a)}else La(t,i,n,r)}}var Zt=d(()=>{"use strict";l();at();at()});import Zr from"fs";import Oa from"path";var _a,Ga=d(()=>{"use strict";l();Zt();_a={type:"npm",detect(t){let e=Oa.join(t,"package.json");if(!Zr.existsSync(e))return null;let n;try{n=JSON.parse(Zr.readFileSync(e,"utf-8")).workspaces}catch{return null}if(!n||Zr.existsSync(Oa.join(t,"yarn.lock")))return null;let r=Array.isArray(n)?n:n.packages??[];return r.length===0?null:je(t,r)}}});import $e from"fs";import D from"path";function $a(t,e,n,r){if(r>4)return[];let o;try{o=$e.readdirSync(e,{withFileTypes:!0})}catch{return[]}let s=[];for(let i of o){if(!i.isDirectory())continue;let a=i.name;if(a.startsWith(".")||a==="node_modules"||a==="dist"||a===".nx")continue;let c=D.join(e,a);$e.existsSync(D.join(c,"project.json"))&&!n.has(c)?(n.add(c),s.push(c)):s.push(...$a(t,c,n,r+1))}return s}function bd(t,e,n){let r={};try{r=JSON.parse($e.readFileSync(n,"utf-8"))}catch{return null}let o=r.name,s,i,a=D.join(e,"package.json");if($e.existsSync(a))try{let c=JSON.parse($e.readFileSync(a,"utf-8"));o=c.name??o,s=c.main,i=c.exports}catch{}return o?{name:o,root:e,relativeRoot:D.relative(t,e),entryPoints:Sd(e,r,s,i)}:null}function Sd(t,e,n,r){let o=[],s=e.targets?.build?.options?.main??e.targets?.build?.options?.entryFile;if(s){let a=D.resolve(t,"../..");o.push(D.resolve(a,s)),o.push(D.resolve(t,s))}if(r){let a=r;if(typeof a=="string")o.push(D.join(t,a));else if(typeof a=="object"&&a!==null){let c=a["."];typeof c=="string"&&o.push(D.join(t,c))}}if(n&&o.push(D.join(t,n)),e.sourceRoot){let a=D.resolve(t,"../.."),c=D.resolve(a,e.sourceRoot);o.push(D.join(c,"index.ts"),D.join(c,"index.tsx"))}for(let a of["src/index.ts","src/index.tsx","index.ts","index.tsx"])o.push(D.join(t,a));let i=o.filter(Qt);return i.length>0?i.slice(0,1):o.slice(0,1)}var ja,Wa=d(()=>{"use strict";l();at();ja={type:"nx",detect(t){return $e.existsSync(D.join(t,"nx.json"))?$a(t,t,new Set,0).map(n=>bd(t,n,D.join(n,"project.json"))).filter(n=>n!==null):null}}});import za from"fs";import Cd from"path";import{load as kd}from"js-yaml";var Ba,Ha=d(()=>{"use strict";l();Zt();Ba={type:"pnpm",detect(t){let e=Cd.join(t,"pnpm-workspace.yaml");if(!za.existsSync(e))return null;let n=[];try{n=kd(za.readFileSync(e,"utf-8"))?.packages??[]}catch{return null}return je(t,n)}}});import lt from"fs";import en from"path";function vd(t){return t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/[^\n]*/g,"")}function wd(t){let e=vd(t),n=new Map;for(let r of e.matchAll(/(?:lazy\s+)?val\s+([A-Za-z0-9_]+)\s*=\s*\(?\s*project\b([^\n]*)/g)){let o=r[1],i=r[2].match(/\bfile\s*\(\s*["']([^"']+)["']\s*\)/),a=i?i[1]:o;if(a==="."||a==="./")continue;let c=a.replace(/^\.\//,"").replace(/\/$/,"");n.has(c)||n.set(c,{name:o,dir:c})}return[...n.values()]}var Ua,Ja=d(()=>{"use strict";l();Qr();Ua={type:"sbt",detect(t){let e=en.join(t,"build.sbt"),n=en.join(t,"project");if(!lt.existsSync(e)||!lt.existsSync(n))return null;let r=[];try{r.push(lt.readFileSync(e,"utf-8"))}catch{return null}try{for(let a of lt.readdirSync(n))a.endsWith(".scala")&&r.push(lt.readFileSync(en.join(n,a),"utf-8"))}catch{}let o=new Set,s=[];for(let a of r)for(let c of wd(a))o.has(c.dir)||(o.add(c.dir),s.push(c));if(s.length===0)return null;let i=[];for(let a of s){let c=en.join(t,...a.dir.split("/")),p=Xt(t,c,a.name);p&&i.push(p)}return i.length>0?i:null}}});import Ed from"fs";import Td from"path";var Ka,Va=d(()=>{"use strict";l();Ka={type:"turborepo",detect(t){return Ed.existsSync(Td.join(t,"turbo.json"))?[]:null}}});import eo from"fs";import qa from"path";var Ya,Qa=d(()=>{"use strict";l();Zt();Ya={type:"yarn",detect(t){if(!eo.existsSync(qa.join(t,"yarn.lock")))return null;let e=qa.join(t,"package.json");if(!eo.existsSync(e))return null;let n;try{n=JSON.parse(eo.readFileSync(e,"utf-8")).workspaces}catch{return null}if(!n)return null;let r=Array.isArray(n)?n:n.packages??[];return r.length===0?null:je(t,r)}}});function W(t){Xa.push(t)}function Za(){return Xa}var Xa,tn=d(()=>{"use strict";l();Xa=[]});import Gv from"fs";import $v from"path";var ec=d(()=>{"use strict";l()});import Nd from"path";function to(t,e=Za()){let n=Nd.resolve(t),r=new Map,o=[];for(let i of e){let a=i.detect(n);if(a!==null){o.push(i.type);for(let c of a)r.has(c.name)||r.set(c.name,c)}}if(o.length===0)return{root:n,type:"none",types:[],packages:[],packageMap:new Map};let s=Array.from(r.values());return{root:n,type:o[0],types:o,packages:s,packageMap:new Map(s.map(i=>[i.name,i]))}}var no=d(()=>{"use strict";l();Ma();Ga();Wa();Ha();Ja();Va();Qa();tn();ec();tn();W(Ka);W(ja);W(Ba);W(Ya);W(_a);W(Aa);W(Ua)});var pt,ro=d(()=>{"use strict";l();ve();pt=class t{constructor(e,n){this.monorepoRoot=e;this.type=n}monorepoRoot;type;packages=new Map;addPackage(e,n){this.packages.set(e.name,{graph:n,pkg:e})}annotateCrossPackageEdges(){for(let{graph:e}of this.packages.values())for(let n of e.nodes.values()){let r=this.getPackageForFile(n.path);if(r)for(let o of n.imports){if(o.isExternal||o.isWorkspace)continue;let s=this.getPackageForFile(o.toPath);s&&s.name!==r.name&&(o.isWorkspace=!0,o.workspacePackage=s.name)}}}getPackageForFile(e){for(let{pkg:n}of this.packages.values())if(e===n.relativeRoot||e.startsWith(`${n.relativeRoot}/`))return n}getPackageDependencies(){let e=new Map;for(let{graph:n,pkg:r}of this.packages.values()){let o=new Set;for(let s of n.nodes.values())for(let i of s.imports)i.isWorkspace&&i.workspacePackage&&o.add(i.workspacePackage);e.set(r.name,[...o])}return e}getAffectedAcrossPackages(e){let n=this.getPackageForFile(e);if(!n)return[];let r=this.packages.get(n.name);if(!r)return[];let o=[];r.graph.traverse(e,s=>(s.path!==e&&o.push({file:s.path,package:n.name}),!0),{direction:"incoming"});for(let{graph:s,pkg:i}of this.packages.values())if(i.name!==n.name)for(let a of s.nodes.values())a.imports.some(p=>p.isWorkspace&&p.workspacePackage===n.name)&&o.push({file:a.path,package:i.name});return o}serialize(){return{monorepoRoot:this.monorepoRoot,type:this.type,packages:Array.from(this.packages.values()).map(({graph:e,pkg:n})=>({pkg:{name:n.name,relativeRoot:n.relativeRoot,entryPoints:n.entryPoints},nodes:Array.from(e.nodes.values())}))}}static deserialize(e){let n=new t(e.monorepoRoot,e.type);for(let{pkg:r,nodes:o}of e.packages){let s=new Map(o.map(a=>[a.path,a])),i=new I(s);n.packages.set(r.name,{graph:i,pkg:{...r,root:""}})}return n}}});function tc(t,e){return e.startsWith("!")?t!==e.slice(1):t===e}function Pd(t,e){return e.startsWith("!")?!t.includes(e.slice(1)):t.includes(e)}function ft(t,e,n){return rg.every(r=>r(t,e,n))}var Dd,Rd,Id,Ad,Md,Ld,Od,_d,Gd,jd,$d,Wd,zd,Bd,Hd,Ud,Jd,Kd,Vd,qd,Yd,Qd,Xd,Zd,eg,tg,ng,rg,oo=d(()=>{"use strict";l();Dd=(t,e)=>!e.category||tc(t.category,e.category),Rd=(t,e)=>!e.type||tc(t.type,e.type),Id=(t,e)=>e.lastAuthor?e.lastAuthor.startsWith("!")?t.lastAuthor!==e.lastAuthor.slice(1):t.lastAuthor!==void 0&&t.lastAuthor===e.lastAuthor:!0,Ad=(t,e)=>!e.path||Pd(t.path,e.path),Md=(t,e)=>e.isExternal===void 0?!0:t.imports.some(r=>r.isExternal)===e.isExternal,Ld=(t,e)=>{if(!e.tags||e.tags.length===0)return!0;let n=e.tags.filter(o=>!o.startsWith("!")),r=e.tags.filter(o=>o.startsWith("!")).map(o=>o.slice(1));return!(n.length>0&&!n.some(o=>t.tags.some(s=>s.name===o))||r.some(o=>t.tags.some(s=>s.name===o)))},Od=(t,e)=>!e.allTags?.length||e.allTags.every(n=>t.tags.some(r=>r.name===n)),_d=(t,e)=>!e.importsFile||t.imports.some(n=>n.toPath?.includes(e.importsFile)),Gd=(t,e,n)=>e.importedBy===void 0?!0:(n?.get(t.path)??[]).some(o=>o.includes(e.importedBy)),jd=(t,e)=>e.minImports===void 0||t.imports.length>=e.minImports,$d=(t,e)=>e.maxImports===void 0||t.imports.length<=e.maxImports,Wd=(t,e)=>e.minSize===void 0||t.size>=e.minSize,zd=(t,e)=>e.maxSize===void 0||t.size<=e.maxSize,Bd=(t,e)=>e.hasDocstring===void 0||!!t.description===e.hasDocstring,Hd=(t,e)=>e.isDocumented===void 0||!!t.documentedBy?.length===e.isDocumented,Ud=(t,e)=>e.isStale===void 0||!!t.staleFor?.length===e.isStale,Jd=(t,e)=>e.minCoverage===void 0||(t.coveragePct??101)>=e.minCoverage,Kd=(t,e)=>e.maxCoverage===void 0||(t.coveragePct??0)<=e.maxCoverage,Vd=(t,e)=>e.minExportUsage===void 0||(t.avgExportUsage??-1)>=e.minExportUsage,qd=(t,e)=>e.maxExportUsage===void 0||(t.avgExportUsage??0)<=e.maxExportUsage,Yd=(t,e)=>e.minComplexity===void 0||(t.complexity??-1/0)>=e.minComplexity,Qd=(t,e)=>e.maxComplexity===void 0||(t.complexity??0)<=e.maxComplexity,Xd=(t,e)=>e.minCognitiveComplexity===void 0||(t.cognitiveComplexity??-1/0)>=e.minCognitiveComplexity,Zd=(t,e)=>e.maxCognitiveComplexity===void 0||(t.cognitiveComplexity??0)<=e.maxCognitiveComplexity,eg=(t,e)=>e.minCommits===void 0||(t.commitCount90d??-1/0)>=e.minCommits,tg=(t,e)=>e.maxCommits===void 0||(t.commitCount90d??0)<=e.maxCommits,ng=(t,e,n)=>!e.any?.length||e.any.some(r=>ft(t,r,n)),rg=[Dd,Rd,Id,Ad,Md,Ld,Od,_d,Gd,jd,$d,Wd,zd,Bd,Hd,Ud,Jd,Kd,Vd,qd,Yd,Qd,Xd,Zd,eg,tg,ng]});function nn(t,e){let n=new Map;if(e.importedBy!==void 0){for(let i of t.nodes)for(let a of i.imports)if(a.toPath){let c=n.get(a.toPath)??[];c.push(i.path),n.set(a.toPath,c)}}let r=t.nodes.filter(i=>ft(i,e,n)),o=new Set(r.map(i=>i.path)),s=r.map(i=>({...i,imports:i.imports.filter(a=>!a.toPath||o.has(a.toPath))}));if(e.sort){let i=e.sortDir==="asc"?-1:1;s.sort((a,c)=>{let p=0;switch(e.sort){case"size":p=c.size-a.size;break;case"imports":p=c.imports.length-a.imports.length;break;case"commitCount90d":p=(c.commitCount90d??0)-(a.commitCount90d??0);break;case"exportUsage":p=(c.avgExportUsage??0)-(a.avgExportUsage??0);break;case"complexity":p=(c.complexity??0)-(a.complexity??0);break;case"cognitiveComplexity":p=(c.cognitiveComplexity??0)-(a.cognitiveComplexity??0);break}return p*i})}return e.limit!==void 0&&s.splice(e.limit),{nodes:s,cycles:t.cycles?.filter(i=>i.every(a=>o.has(a)))??void 0}}var nc=d(()=>{"use strict";l();oo();oo()});function sg(t,e,n,r){let o=t;switch(n){case"string":o[e]=r;break;case"int":o[e]=parseInt(r,10);break;case"float":o[e]=parseFloat(r);break;case"boolNotFalse":o[e]=r.toLowerCase()!=="false";break;case"boolIsTrue":o[e]=r.toLowerCase()==="true";break}}function oc(t,e){let n=e.indexOf(":");if(n===-1)return;let r=e.slice(0,n).trim().toLowerCase(),o=e.slice(n+1).trim();if(!r||!o)return;if(r==="tag"||r==="tags"){o.includes("+")?t.allTags=[...t.allTags??[],...o.split("+")]:t.tags=[...t.tags??[],o];return}if(r==="sort"){t.sort=o;return}if(r==="sortdir"){t.sortDir=o.toLowerCase()==="asc"?"asc":"desc";return}let s=og[r];s&&sg(t,s.field,s.kind,o)}function ig(t){let e=[];for(let n of t.split("|")){let r=n.trim();if(!r)continue;let o={};oc(o,r),Object.keys(o).length>0&&e.push(o)}return e}function rn(t){let e={},n=t.split(",");for(let r of n){let o=r.trim();if(o.toLowerCase().startsWith(rc)&&o.endsWith(")")){let s=o.slice(rc.length,-1),i=ig(s);i.length>0&&(e.any=[...e.any??[],...i]);continue}oc(e,r)}return e}var og,rc,sc=d(()=>{"use strict";l();og={category:{field:"category",kind:"string"},type:{field:"type",kind:"string"},path:{field:"path",kind:"string"},importsfile:{field:"importsFile",kind:"string"},importedby:{field:"importedBy",kind:"string"},lastauthor:{field:"lastAuthor",kind:"string"},external:{field:"isExternal",kind:"boolIsTrue"},hasdocstring:{field:"hasDocstring",kind:"boolNotFalse"},isdocumented:{field:"isDocumented",kind:"boolNotFalse"},isstale:{field:"isStale",kind:"boolNotFalse"},minimports:{field:"minImports",kind:"int"},maximports:{field:"maxImports",kind:"int"},minsize:{field:"minSize",kind:"int"},maxsize:{field:"maxSize",kind:"int"},limit:{field:"limit",kind:"int"},mincoverage:{field:"minCoverage",kind:"int"},maxcoverage:{field:"maxCoverage",kind:"int"},minexportusage:{field:"minExportUsage",kind:"float"},maxexportusage:{field:"maxExportUsage",kind:"float"},mincomplexity:{field:"minComplexity",kind:"int"},maxcomplexity:{field:"maxComplexity",kind:"int"},mincognitivecomplexity:{field:"minCognitiveComplexity",kind:"int"},maxcognitivecomplexity:{field:"maxCognitiveComplexity",kind:"int"},mincommits:{field:"minCommits",kind:"int"},maxcommits:{field:"maxCommits",kind:"int"}};rc="any("});var ic=d(()=>{"use strict";l();nc();sc()});import ag from"path";import P from"typescript";function ge(t,e){let n=t[e];if(n===void 0)throw new Error(`Index ${e} out of bounds (length ${t.length})`);return n}function so(t){let e=[];for(let n of t.statements){if(!P.isExpressionStatement(n))continue;let r=n.expression;if(!P.isCallExpression(r))continue;let o=r.expression;P.isIdentifier(o)&&ac.has(o.text)&&e.push(r),P.isPropertyAccessExpression(o)&&P.isIdentifier(o.expression)&&ac.has(o.expression.text)&&e.push(r)}return e}function io(t,e,n){for(let r of t.arguments){if(!P.isObjectLiteralExpression(r))continue;let o=r.properties.find(s=>P.isPropertyAssignment(s)&&P.isIdentifier(s.name)&&s.name.text===e);if(!(!o||!P.isArrayLiteralExpression(o.initializer)))return o.initializer.elements.filter(P.isStringLiteral).map(s=>s.text)}return null}function ao(t,e,n,r){if(t.arguments.length===0)return null;for(let s=1;s<t.arguments.length;s++){let i=ge(t.arguments,s);if(!P.isObjectLiteralExpression(i))continue;let a=i.properties.find(p=>P.isPropertyAssignment(p)&&P.isIdentifier(p.name)&&p.name.text===e);if(a)return{start:a.initializer.getStart(r),end:a.initializer.getEnd(),text:n};let c=i.getEnd()-1;return{start:c,end:c,text:`${i.properties.length>0?", ":""}${e}: ${n}`}}let o=ge(t.arguments,t.arguments.length-1);return{start:o.getStart(r),end:o.getStart(r),text:`{ ${e}: ${n} }, `}}function co(t,e,n){let r=t.arguments;for(let o=1;o<r.length;o++){let s=ge(r,o);if(!P.isObjectLiteralExpression(s))continue;let i=s.properties.findIndex(c=>P.isPropertyAssignment(c)&&P.isIdentifier(c.name)&&c.name.text===e);if(i<0)continue;if(s.properties.length===1)return{start:ge(r,o-1).getEnd(),end:s.getEnd(),text:""};let a=ge(s.properties,i);return i===s.properties.length-1?{start:ge(s.properties,i-1).getEnd(),end:a.getEnd(),text:""}:{start:a.getStart(n),end:ge(s.properties,i+1).getStart(n),text:""}}return null}function lo(t,e){let n=[...e].sort((o,s)=>s.start-o.start),r=t;for(let o of n)r=r.slice(0,o.start)+o.text+r.slice(o.end);return r}function po(t){return`[${t.map(e=>JSON.stringify(e)).join(", ")}]`}function cg(t){return t.map(e=>e.startsWith("@")?e.slice(1):e)}function on(t,e,n,r){let o=P.createSourceFile(ag.basename(t),e,P.ScriptTarget.Latest,!0),s=so(o),[i]=s;if(!i)return e;let a=io(i,r,o),c=[...n].sort();if(a!==null&&JSON.stringify(cg(a).sort())===JSON.stringify(c))return e;let p=po(c.map(m=>`@${m}`)),f=s.flatMap(m=>{let h=n.length===0?co(m,r,o):ao(m,r,p,o);return h?[h]:[]});return f.length>0?lo(e,f):e}var ac,z,We=d(()=>{"use strict";l();ac=new Set(["describe","test","it"]);z=new Set([".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"])});import lg from"path";var sn,cc=d(()=>{"use strict";l();We();sn=class{name="cypress";canHandle(e){return z.has(lg.extname(e).toLowerCase())}apply(e,n,r){return on(e,n,r,"tags")}}});import pg from"path";function fg(t){return`${["# <mokosh-tags>",...t.map(e=>`@${e}`),"# </mokosh-tags>"].join(`
|
|
28
30
|
`)}
|
|
29
31
|
|
|
30
|
-
`}function
|
|
31
|
-
`}function
|
|
32
|
-
${
|
|
32
|
+
`}function mg(t){let e=new Set;mo.lastIndex=0;let n=mo.exec(t);for(;n!==null;)n[1]&&e.add(n[1]),n=mo.exec(t);return e}var fo,mo,an,lc=d(()=>{"use strict";l();fo=/# <mokosh-tags>[\s\S]*?# <\/mokosh-tags>\n*/,mo=/^@([a-zA-Z0-9_-]+)/gm;an=class{name="gherkin";canHandle(e){return pg.extname(e).toLowerCase()===".feature"}apply(e,n,r){let o=n.replace(fo,""),s=mg(o),i=r.filter(c=>!s.has(c)),a=i.length>0?fg(i):"";return fo.test(n)?n.replace(fo,a):a?n.replace(/^(Feature:)/m,`${a}$1`):n}}});function pc(t,e){let n=t.replace(/\\/g,"/"),r=e.replace(/\\/g,"/"),o="";for(let s=0;s<n.length;s++){let i=n[s];i==="*"?n[s+1]==="*"?(o+=".*",s++):o+="[^/]*":i==="?"?o+="[^/]":i!==void 0&&(o+=i.replace(/[.+^${}()|[\]\\]/g,"\\$&"))}return new RegExp(`^${o}$`).test(r)}var fc=d(()=>{"use strict";l()});import ug from"path";function gg(t){return`//go:build ${t.map(n=>`mokosh_${n}`).join(" || ")}
|
|
33
|
+
`}function hg(t){let e=uo.exec(t);if(!e)return null;let n=e[0]??"",r=/mokosh_([a-zA-Z0-9_-]+)/g,o=[],s=r.exec(n);for(;s!==null;)s[1]&&o.push(s[1]),s=r.exec(n);return o}var uo,dg,cn,mc=d(()=>{"use strict";l();uo=/^\/\/go:build mokosh_[^\n]+\n/m,dg=/^package\s+\S+/m;cn=class{name="go";canHandle(e){return ug.basename(e).endsWith("_test.go")}apply(e,n,r){let o=hg(n),s=[...r].sort();if(o!==null&&JSON.stringify([...o].sort())===JSON.stringify(s))return n;if(r.length===0)return n.replace(uo,"");let i=gg(s);if(o!==null)return n.replace(uo,i);let a=dg.exec(n);if(!a)return n;let c=a.index;return`${n.slice(0,c)+i}
|
|
34
|
+
${n.slice(c)}`}}});import yg from"path";function bg(t){return`${["/**",...t.map(e=>` * @group ${e}`)," */"].join(`
|
|
33
35
|
`)}
|
|
34
36
|
|
|
35
|
-
`}function
|
|
37
|
+
`}function Sg(t){let e=[];go.lastIndex=0;let n=go.exec(t);for(;n!==null;)n[1]&&e.push(n[1]),n=go.exec(t);return e}var xg,go,ln,uc=d(()=>{"use strict";l();We();xg=/^\/\*\*\n(?: \* @group .+\n)+ \*\/\n+/,go=/^ \* @group (.+)$/gm;ln=class{name="jest";canHandle(e){return z.has(yg.extname(e).toLowerCase())}apply(e,n,r){let o=xg.exec(n),s=o?Sg(o[0]):null,i=[...r].sort();if(s!==null&&JSON.stringify([...s].sort())===JSON.stringify(i))return n;let a=o?n.slice(o[0].length):n;return r.length===0?a:bg(i)+a}}});import Cg from"path";function Ng(t){let e=yo.exec(t);if(!e)return null;let n=[],r=/@Tag\("([^"]*)"\)/g,o=r.exec(e[0]);for(;o!==null;)o[1]&&n.push(o[1]),o=r.exec(e[0]);return n}function Pg(t){return`${kg}
|
|
36
38
|
${t.map(e=>`@Tag("${e}")`).join(`
|
|
37
39
|
`)}
|
|
38
|
-
`}function
|
|
39
|
-
`+t.slice(
|
|
40
|
-
`+
|
|
41
|
-
`+t.slice(
|
|
42
|
-
`+t}function
|
|
43
|
-
`),
|
|
40
|
+
`}function dc(t){if(gc.test(t))return t;let e=wg.exec(t);if(e){let r=e.index+e[0].length;return t.slice(0,r)+ho+`
|
|
41
|
+
`+t.slice(r)}let n=Eg.exec(t);if(n){let r=n.index+n[0].length;return t.slice(0,r)+`
|
|
42
|
+
`+ho+`
|
|
43
|
+
`+t.slice(r)}return ho+`
|
|
44
|
+
`+t}function Dg(t){return/@Tag\b/.test(t)?t:t.replace(gc,"")}var kg,yo,ho,gc,vg,wg,Eg,Tg,Fg,pn,hc=d(()=>{"use strict";l();kg="// mokosh:tags",yo=/^\/\/ mokosh:tags\n(?:[ \t]*@Tag\("[^"]*"\)\n)*/m,ho="import org.junit.jupiter.api.Tag;",gc=/^import org\.junit\.jupiter\.api\.Tag;\n/m,vg=/^(?:public\s+|final\s+|abstract\s+|sealed\s+|non-sealed\s+|strictfp\s+)*(?:class|interface|enum|record|@interface)\s+\w+/m,wg=/^import\s+[^\n]+;\n(?![\s\S]*^import\s)/m,Eg=/^package\s+[^\n]+;\n/m,Tg=/\/src\/(test|androidTest|integrationTest|it)\//,Fg=/(Test|Tests|Spec|IT)\.(java|groovy)$/;pn=class{name="junit";canHandle(e){let n=e.replace(/\\/g,"/"),r=Cg.extname(n).toLowerCase();return r!==".java"&&r!==".groovy"?!1:Tg.test(n)||Fg.test(n)}apply(e,n,r){let o=Ng(n),s=[...r].sort();if(o!==null&&JSON.stringify([...o].sort())===JSON.stringify(s))return n;if(r.length===0)return o===null?n:Dg(n.replace(yo,""));let i=Pg(s);if(o!==null)return dc(n.replace(yo,i));let a=vg.exec(n);if(!a)return n;let c=n.slice(0,a.index)+i+n.slice(a.index);return dc(c)}}});import Rg from"path";var fn,yc=d(()=>{"use strict";l();We();fn=class{name="playwright";canHandle(e){return z.has(Rg.extname(e).toLowerCase())}apply(e,n,r){return on(e,n,r,"tag")}}});import Ig from"path";function Mg(t){let e=t.map(n=>`pytest.mark.${n}`).join(", ");return t.length===1?`pytestmark = pytest.mark.${t[0]}`:`pytestmark = [${e}]`}function Lg(t){let e=xo.exec(t);if(!e)return null;let n=e[0],r=[],o=/pytest\.mark\.([a-zA-Z0-9_-]+)/g,s=o.exec(n);for(;s!==null;)s[1]&&r.push(s[1]),s=o.exec(n);return r}function Og(t){let e=t.split(`
|
|
45
|
+
`),n=-1;return e.forEach((o,s)=>{(o.trimStart().startsWith("import ")||o.trimStart().startsWith("from "))&&(n=s)}),n<0?0:e.slice(0,n+1).reduce((o,s)=>o+s.length+1,0)}var xo,Ag,mn,xc=d(()=>{"use strict";l();xo=/^pytestmark\s*=\s*.+$/m,Ag=/^import pytest\s*$/m;mn=class{name="pytest";canHandle(e){return Ig.extname(e).toLowerCase()===".py"}apply(e,n,r){let o=Lg(n),s=[...r].sort();if(o!==null&&JSON.stringify([...o].sort())===JSON.stringify(s))return n;if(r.length===0)return n.replace(xo,"").replace(/\n{3,}/g,`
|
|
44
46
|
|
|
45
|
-
`);let i=
|
|
46
|
-
`,
|
|
47
|
+
`);let i=Mg(s);if(o!==null)return n.replace(xo,i);let a=Ag.test(n),c=Og(n),p=n.slice(0,c),f=n.slice(c),m=a?"":`import pytest
|
|
48
|
+
`,h=p.endsWith(`
|
|
47
49
|
|
|
48
50
|
`)?"":`
|
|
49
|
-
`;return`${p+
|
|
50
|
-
${f}`}}});import
|
|
51
|
-
`;if(o!==null)return r.replace(to,i);let a=ld.exec(r);return a?r.slice(0,a.index)+i+r.slice(a.index):r}}});import oc from"path";import sc from"typescript";var ud,ir,ic=g(()=>{"use strict";l();Oe();ud=/\/\/ <mokosh-tags>[\s\S]*?\/\/ <\/mokosh-tags>\n*/,ir=class{name="vitest";canHandle(e){return W.has(oc.extname(e).toLowerCase())}apply(e,r,n){let o=r.replace(ud,""),s=sc.createSourceFile(oc.basename(e),o,sc.ScriptTarget.Latest,!0),i=zn(s),[a]=i;if(!a)return o;let c=Bn(a,"tags",s),p=[...n].sort();if(c!==null&&JSON.stringify([...c].sort())===JSON.stringify(p))return o;let f=i.flatMap(u=>{let y=n.length===0?Un(u,"tags",s):Hn(u,"tags",Kn(p),s);return y?[y]:[]});return f.length>0?Jn(o,f):o}}});import ro from"path";import ar from"typescript";function dd(t){let e=ar.createSourceFile("detect.ts",t,ar.ScriptTarget.Latest,!0);for(let r of e.statements){if(!ar.isImportDeclaration(r)||!ar.isStringLiteral(r.moduleSpecifier))continue;let n=gd[r.moduleSpecifier.text];if(n)return n}return null}function cc(t="vitest",e={},r=process.cwd()){return[new Zt,new or,new er,new rr,new sr,new no(r,t,Object.entries(e))]}function lc(t,e){return e.find(r=>r.canHandle(t))??null}var ac,gd,no,pc=g(()=>{"use strict";l();Ja();Ka();qa();Qa();Ya();ec();tc();rc();nc();Oe();ic();ac={vitest:()=>new ir,playwright:()=>new nr,cypress:()=>new Xt,jest:()=>new tr},gd={"@playwright/test":"playwright",cypress:"cypress","@jest/globals":"jest",vitest:"vitest"};no=class{constructor(e,r,n){this.rootDir=e;this.defaultFramework=r;this.frameworkOverrides=n}rootDir;defaultFramework;frameworkOverrides;name="auto";canHandle(e){return W.has(ro.extname(e).toLowerCase())}apply(e,r,n){let o=dd(r)??this.matchOverride(e)??this.defaultFramework;return(ac[o]??ac.vitest)().apply(e,r,n)}matchOverride(e){let r=ro.relative(this.rootDir,e).split(ro.sep).join("/");for(let[n,o]of this.frameworkOverrides)if(Va(n,r))return o;return null}}});import fc from"fs/promises";import hd from"path";async function Sd(t,e,r,n){let o;try{o=await fc.readFile(t,"utf8")}catch(a){return{path:t,status:"error",error:String(a)}}let s=lc(t,n);if(!s)return{path:t,status:"unchanged"};let i=s.apply(t,o,e);return i===o?{path:t,status:"unchanged"}:(r||await fc.writeFile(t,i,"utf8"),{path:t,status:"updated"})}async function oo(t,e,r){let n=he(e),o=n.tagApplier?.framework??"vitest",s=n.tagApplier?.frameworkOverrides??{},i=cc(o,s,e),a={updated:0,unchanged:0,errors:0,files:[]};for(let c of t.nodes.values()){if(c.category!=="test")continue;let p=new Set,f=[];for(let x of c.tags)xd.has(x.kind)&&yd.test(x.name)&&(bd.has(x.name.toLowerCase())||p.has(x.name)||(p.add(x.name),f.push(x.name)));f.sort();let u=hd.resolve(e,c.path),y=await Sd(u,f,r.dryRun,i);y.path=c.path,a.files.push(y),y.status==="updated"?a.updated++:y.status==="unchanged"?a.unchanged++:a.errors++}return a}var yd,xd,bd,mc=g(()=>{"use strict";l();wr();pc();yd=/^[a-zA-Z][a-zA-Z0-9_-]{1,}$/,xd=new Set(["import"]),bd=new Set(["common","fixture","fixtures","helper","helpers","index","main","mock","mocks","setup","shared","spec","test","tests","types","util","utils"])});var cr,so=g(()=>{"use strict";l();cr=class{isTestNode(e){return e.category==="test"||e.tags.some(r=>r.name==="test")}}});var uc=g(()=>{"use strict";l();Pr();dn();Ir();Mr();Ot();Wt();zt();xe();Lt();Nn();_t();Rn();jn();$n()});var io=g(()=>{"use strict";l();uc()});function gc(t,e){return{identifier:e?.identifier??new cr,featureMap:e?.featureDetection===!1?new Map:fe(t.nodes,e?.featureDetection??void 0)}}function dc(t,e,r,n,o){for(let s of e){let i=t.nodes.get(s);if(!i)continue;let a=new ce(s,["*",...i.exports.map(c=>c.name)]);t.traverse(s,(c,p,f)=>{if(!f)return!0;if(!a.updateAffectedSymbols(c,f))return!1;if(p>0){let u=r.get(c.path);if(u)return n(u),!1}return o(c),!0},{direction:"incoming"})}}function ao(t,e,r){let{identifier:n,featureMap:o}=gc(t,r),s=new Set;for(let i of e){let a=o.get(i);a&&s.add(a.tag)}return dc(t,e,o,i=>s.add(i.tag),i=>{if(n.isTestNode(i))for(let a of i.tags)s.add(a.name)}),Array.from(s)}function co(t,e,r){let{identifier:n,featureMap:o}=gc(t,r),s=new Set;return dc(t,e,o,()=>{},i=>{n.isTestNode(i)&&s.add(i.path)}),Array.from(s)}var hc=g(()=>{"use strict";l();io();so()});var yc=g(()=>{"use strict";l();mc();so();hc()});import Cd from"fs";import ct from"path";async function M(t,e,r=null,n={}){let o=n.silent?void 0:a=>{process.stderr.write(`Processed ${a} files...\r`)},s=ct.resolve(t);return await new ae(s,r,n.pathAliases?new J(s,{pathAliases:n.pathAliases}):void 0,o,n.gitStats??!1,n.coverageMap??new Map,n.parallelParsing??!0,n.additionalIgnoreDirs??[]).build(e)}async function xc(t,e={}){let r=ct.resolve(t),n=Gn(r),o=e.packages?n.packages.filter(a=>e.packages?.includes(a.name)||e.packages?.includes(a.relativeRoot)):n.packages,s=new Map(n.packages.map(a=>[a.name,a.root])),i=new it(r,n.type);for(let a of o){let c=e.silent?void 0:u=>{process.stderr.write(`[${a.name}] Processed ${u} files...\r`)},f=await new ae(r,null,new J(r,{workspaceMap:s,tsconfigSearchPaths:[a.root,r],pathAliases:e.pathAliases}),c,e.gitStats??!1,new Map,e.parallelParsing??!0).build(a.entryPoints);i.addPackage(a,f)}return i.annotateCrossPackageEdges(),i}function L(t,e={}){let r=[],n=new Set([...e.ignoreDirs??I,...e.additionalIgnoreDirs??[]]),o=new Set([...e.extensions??Er,...e.additionalExtensions??[]]);function s(i){try{let a=Cd.readdirSync(i,{withFileTypes:!0});for(let c of a){let p=ct.join(i,c.name);c.isDirectory()?n.has(c.name)||s(p):c.isFile()&&o.has(ct.extname(c.name).toLowerCase())&&r.push(ct.relative(t,p))}}catch{}}return s(t),r}var k=g(()=>{"use strict";l();wr();G();jo();Wo();Pr();Ir();Mr();pa();Ot();Wt();zt();It();xe();Gt();Nn();ua();_t();Rn();jn();Vt();$n();de();Be();Ha();yc();G();io()});var lo=g(()=>{"use strict";l();G()});import lt from"path";import{parseArgs as kd}from"util";function vd(t){for(let e=0;e<t.length;e++)if(t[e]==="--root"&&t[e+1])return lt.resolve(t[e+1]);return process.cwd()}function K(t){return t?parseInt(t,10):void 0}function bc(t){return t?t.split(",").map(e=>e.trim()):void 0}function Ed(t){let e=[];for(let r=0;r<t.length;r++){let n=t[r];if(n!==void 0)if(!n.startsWith("--"))e.push(n);else if(wd.has(n)){let o=t[r+1];o!==void 0&&!o.startsWith("--")&&(e.push(n,o),r++)}else n.slice(2)in po&&e.push(n)}return e}function Td(t){return{mermaid:t.mermaid??!1,proposeTags:t["propose-tags"]??!1,plain:t.plain??!1,affectedTests:t["affected-tests"]??!1,detectFeatures:t["detect-features"]??!1,findUnused:t["find-unused"]??!1,excludeTests:t["exclude-tests"]??!1,checkCycles:t["check-cycles"]??!1,checkDocDrift:t["check-doc-drift"]??!1,findUncovered:t["find-uncovered"]??!1}}function Fd(t){return{listTags:t["list-tags"]??!1,callers:t.callers??!1,silent:t.silent??!1,queryHelp:t["query-help"]??!1,typeGraph:t["type-graph"]??!1,moduleResponsibility:t["module-responsibility"]??!1,featureGraph:t["feature-graph"]??!1,callGraph:t["call-graph"]??!1,findSymbol:t["find-symbol"]??!1,apiSurface:t["api-surface"]??!1}}function Nd(t){return{applyTags:t["apply-tags"]??!1,dryRun:t["dry-run"]??!1,initSkill:t["init-skill"]??!1,initConfig:t["init-config"]??!1,force:t.force??!1,dependencies:t.dependencies??!1,dependents:t.dependents??!1,affected:t.affected??!1,testsOnly:t["tests-only"]??!1,cached:t.cached??!1}}function Pd(t){return{withMeta:t["with-meta"]??!1,withEdgeDetail:t["with-edge-detail"]??!1,findComplexFunctions:t["find-complex-functions"]??!1,findDuplicates:t["find-duplicates"]??!1,findRiskHotspots:t["find-risk-hotspots"]??!1,workspacePackages:t["workspace-packages"]??!1,workspaceAffected:t["workspace-affected"]??!1,clearCache:t["clear-cache"]??!1,slim:t.slim??!1,watch:t.watch??!1}}function Sc(t){let e=vd(t),r=lt.join(lt.resolve(e,V),ye),{values:n,positionals:o}=kd({args:Ed(t),allowPositionals:!0,options:po}),s=n.cache,i=n.config,a=n.metric,c=n;return{rootDir:e,cachePath:s?lt.resolve(e,s):r,configPath:i?lt.resolve(e,i):void 0,query:n.query,file:n.file,typeFilter:n.type,functionName:n.function,filterPaths:bc(n.paths),featureThreshold:K(n["feature-threshold"]),minOutDegree:K(n["min-out-degree"]),...Td(c),...Fd(c),help:t.length===0||(n.help??!1),...Nd(c),changedSymbols:bc(n["changed-symbols"]),depth:K(n.depth),...Pd(c),metric:a==="complexity"||a==="cognitiveComplexity"?a:void 0,complexityThreshold:K(n["complexity-threshold"]),limit:K(n.limit),minDuplicateLines:K(n["min-duplicate-lines"]),maxCoveragePct:K(n["max-coverage-pct"]),minChurn:K(n["min-churn"]),base:n.base,compareBranches:n["compare-branches"],compareFull:n["compare-full"]??!1,compareMaxItems:K(n["compare-max-items"]),entryPoints:o}}var po,wd,Cc=g(()=>{"use strict";l();lo();po={root:{type:"string"},cache:{type:"string"},config:{type:"string"},query:{type:"string"},file:{type:"string"},type:{type:"string"},paths:{type:"string"},function:{type:"string"},"feature-threshold":{type:"string"},"min-out-degree":{type:"string"},mermaid:{type:"boolean"},"propose-tags":{type:"boolean"},plain:{type:"boolean"},"affected-tests":{type:"boolean"},"detect-features":{type:"boolean"},"find-unused":{type:"boolean"},"exclude-tests":{type:"boolean"},"check-cycles":{type:"boolean"},"check-doc-drift":{type:"boolean"},"find-uncovered":{type:"boolean"},"list-tags":{type:"boolean"},callers:{type:"boolean"},silent:{type:"boolean"},"query-help":{type:"boolean"},help:{type:"boolean"},"type-graph":{type:"boolean"},"module-responsibility":{type:"boolean"},"feature-graph":{type:"boolean"},"call-graph":{type:"boolean"},"find-symbol":{type:"boolean"},"api-surface":{type:"boolean"},"apply-tags":{type:"boolean"},"dry-run":{type:"boolean"},"init-skill":{type:"boolean"},"init-config":{type:"boolean"},force:{type:"boolean"},dependencies:{type:"boolean"},dependents:{type:"boolean"},affected:{type:"boolean"},"tests-only":{type:"boolean"},"changed-symbols":{type:"string"},cached:{type:"boolean"},depth:{type:"string"},"with-meta":{type:"boolean"},"with-edge-detail":{type:"boolean"},"find-complex-functions":{type:"boolean"},metric:{type:"string"},"complexity-threshold":{type:"string"},limit:{type:"string"},"find-duplicates":{type:"boolean"},"min-duplicate-lines":{type:"string"},"find-risk-hotspots":{type:"boolean"},"max-coverage-pct":{type:"string"},"min-churn":{type:"string"},"workspace-packages":{type:"boolean"},"workspace-affected":{type:"boolean"},"clear-cache":{type:"boolean"},slim:{type:"boolean"},watch:{type:"boolean"},base:{type:"string"},"compare-branches":{type:"string"},"compare-full":{type:"boolean"},"compare-max-items":{type:"string"}},wd=new Set(Object.entries(po).filter(([,t])=>t.type==="string").map(([t])=>`--${t}`))});async function fo(t){let{graph:e,file:r,testsOnly:n,changedSymbols:o,cached:s,withMeta:i}=t;r||(console.error("Error: --affected requires --file <path>"),process.exit(1));let a=f=>i?f.map(u=>({path:u,...le(e,u)})):f;if(s){let f=Rr(e),u=Ar(f,r),y=n?u.filter(b=>e.nodes.get(b)?.category==="test"):u,x=a(y);console.log(JSON.stringify({file:r,affected:x,count:x.length},null,2));return}let c=xn(e,r,{testsOnly:n,changedSymbols:o}),p=a(c);console.log(JSON.stringify({file:r,affected:p,count:p.length},null,2))}var kc=g(()=>{"use strict";l();k()});import mo from"path";function ue(t){return t.filter(e=>{let r=mo.basename(e).toLowerCase();return Dd.some(n=>r.includes(n))})}function lr(t,e){return new yt().getChangedFiles(t,e).map(r=>mo.relative(t,mo.resolve(t,r)))}var Dd,pr=g(()=>{"use strict";l();Or();Dd=[".test.",".spec.","-test.","-spec."]});async function vc(t){let{graph:e}=t,{rootDir:r,scanOptions:n,featureThreshold:o,rawConfig:s,base:i}=t,a=lr(r,i);if(![...e.nodes.values()].some(f=>ue([f.path]).length>0)){let f=L(r,n);e=await M(r,ue(f),e,T(s))}let p=co(e,a,{...o!==void 0&&{featureDetection:{minOutDegree:o}}});console.log(p.join(`
|
|
52
|
-
`))}var
|
|
53
|
-
`):JSON.stringify({file:
|
|
54
|
-
`);for(let
|
|
55
|
-
`);process.exit(1)}console.log("No cycles detected.")}var
|
|
56
|
-
`);for(let{doc:
|
|
57
|
-
`);process.exit(1)}console.log("No doc drift detected.")}var
|
|
58
|
-
`):JSON.stringify({name:
|
|
59
|
-
`):JSON.stringify({threshold:s,uncovered:i,count:i.length},null,2))}var
|
|
60
|
-
`):JSON.stringify({tags:o,count:o.length},null,2))}var
|
|
51
|
+
`;return`${p+h+m+i}
|
|
52
|
+
${f}`}}});import _g from"path";function Wg(t){let e=bo.exec(t);return e?e[0].replace(/^\/\/ mokosh:tags /,"").trim().split(/\s*,\s*/).filter(Boolean):null}var bo,Gg,jg,$g,un,bc=d(()=>{"use strict";l();bo=/^\/\/ mokosh:tags .*\n/m,Gg=/^(?:sealed\s+|abstract\s+|final\s+|private\s+|implicit\s+|case\s+)*(?:class|object|trait)\s+\w+/m,jg=/\/src\/(test|it)\//,$g=/(Spec|Suite|Test|Props)\.scala$/;un=class{name="scalatest";canHandle(e){let n=e.replace(/\\/g,"/");return _g.extname(n).toLowerCase()!==".scala"?!1:jg.test(n)||$g.test(n)}apply(e,n,r){let o=Wg(n),s=[...r].sort();if(o!==null&&JSON.stringify([...o].sort())===JSON.stringify(s))return n;if(r.length===0)return o===null?n:n.replace(bo,"");let i=`// mokosh:tags ${s.join(", ")}
|
|
53
|
+
`;if(o!==null)return n.replace(bo,i);let a=Gg.exec(n);return a?n.slice(0,a.index)+i+n.slice(a.index):n}}});import Sc from"path";import Cc from"typescript";var zg,dn,kc=d(()=>{"use strict";l();We();zg=/\/\/ <mokosh-tags>[\s\S]*?\/\/ <\/mokosh-tags>\n*/,dn=class{name="vitest";canHandle(e){return z.has(Sc.extname(e).toLowerCase())}apply(e,n,r){let o=n.replace(zg,""),s=Cc.createSourceFile(Sc.basename(e),o,Cc.ScriptTarget.Latest,!0),i=so(s),[a]=i;if(!a)return o;let c=io(a,"tags",s),p=[...r].sort();if(c!==null&&JSON.stringify([...c].sort())===JSON.stringify(p))return o;let f=i.flatMap(m=>{let h=r.length===0?co(m,"tags",s):ao(m,"tags",po(p),s);return h?[h]:[]});return f.length>0?lo(o,f):o}}});import So from"path";import gn from"typescript";function Hg(t){let e=gn.createSourceFile("detect.ts",t,gn.ScriptTarget.Latest,!0);for(let n of e.statements){if(!gn.isImportDeclaration(n)||!gn.isStringLiteral(n.moduleSpecifier))continue;let r=Bg[n.moduleSpecifier.text];if(r)return r}return null}function wc(t="vitest",e={},n=process.cwd()){return[new an,new mn,new cn,new pn,new un,new Co(n,t,Object.entries(e))]}function Ec(t,e){return e.find(n=>n.canHandle(t))??null}var vc,Bg,Co,Tc=d(()=>{"use strict";l();cc();lc();fc();mc();uc();hc();yc();xc();bc();We();kc();vc={vitest:()=>new dn,playwright:()=>new fn,cypress:()=>new sn,jest:()=>new ln},Bg={"@playwright/test":"playwright",cypress:"cypress","@jest/globals":"jest",vitest:"vitest"};Co=class{constructor(e,n,r){this.rootDir=e;this.defaultFramework=n;this.frameworkOverrides=r}rootDir;defaultFramework;frameworkOverrides;name="auto";canHandle(e){return z.has(So.extname(e).toLowerCase())}apply(e,n,r){let o=Hg(n)??this.matchOverride(e)??this.defaultFramework;return(vc[o]??vc.vitest)().apply(e,n,r)}matchOverride(e){let n=So.relative(this.rootDir,e).split(So.sep).join("/");for(let[r,o]of this.frameworkOverrides)if(pc(r,n))return o;return null}}});import Fc from"fs/promises";import Ug from"path";async function qg(t,e,n,r){let o;try{o=await Fc.readFile(t,"utf8")}catch(a){return{path:t,status:"error",error:String(a)}}let s=Ec(t,r);if(!s)return{path:t,status:"unchanged"};let i=s.apply(t,o,e);return i===o?{path:t,status:"unchanged"}:(n||await Fc.writeFile(t,i,"utf8"),{path:t,status:"updated"})}async function ko(t,e,n){let r=Se(e),o=r.tagApplier?.framework??"vitest",s=r.tagApplier?.frameworkOverrides??{},i=wc(o,s,e),a={updated:0,unchanged:0,errors:0,files:[]};for(let c of t.nodes.values()){if(c.category!=="test")continue;let p=new Set,f=[];for(let y of c.tags)Kg.has(y.kind)&&Jg.test(y.name)&&(Vg.has(y.name.toLowerCase())||p.has(y.name)||(p.add(y.name),f.push(y.name)));f.sort();let m=Ug.resolve(e,c.path),h=await qg(m,f,n.dryRun,i);h.path=c.path,a.files.push(h),h.status==="updated"?a.updated++:h.status==="unchanged"?a.unchanged++:a.errors++}return a}var Jg,Kg,Vg,Nc=d(()=>{"use strict";l();In();Tc();Jg=/^[a-zA-Z][a-zA-Z0-9_-]{1,}$/,Kg=new Set(["import"]),Vg=new Set(["common","fixture","fixtures","helper","helpers","index","main","mock","mocks","setup","shared","spec","test","tests","types","util","utils"])});var hn,vo=d(()=>{"use strict";l();hn=class{isTestNode(e){return e.category==="test"||e.tags.some(n=>n.name==="test")}}});var Pc=d(()=>{"use strict";l();St();_n();Rr();jn();zn();Bt();Vt();qt();ve();Wt();Ur();Ht();qr();no();ro()});var wo=d(()=>{"use strict";l();Pc()});function Dc(t,e){return{identifier:e?.identifier??new hn,featureMap:e?.featureDetection===!1?new Map:de(t.nodes,e?.featureDetection??void 0)}}function Rc(t,e,n,r,o){for(let s of e){let i=t.nodes.get(s);if(!i)continue;let a=new fe(s,["*",...i.exports.map(c=>c.name)]);t.traverse(s,(c,p,f)=>{if(!f)return!0;if(!a.updateAffectedSymbols(c,f))return!1;if(p>0){let m=n.get(c.path);if(m)return r(m),!1}return o(c),!0},{direction:"incoming"})}}function Eo(t,e,n){let{identifier:r,featureMap:o}=Dc(t,n),s=new Set;for(let i of e){let a=o.get(i);a&&s.add(a.tag)}return Rc(t,e,o,i=>s.add(i.tag),i=>{if(r.isTestNode(i))for(let a of i.tags)s.add(a.name)}),Array.from(s)}function To(t,e,n){let{identifier:r,featureMap:o}=Dc(t,n),s=new Set;return Rc(t,e,o,()=>{},i=>{r.isTestNode(i)&&s.add(i.path)}),Array.from(s)}var Ic=d(()=>{"use strict";l();wo();vo()});var Ac=d(()=>{"use strict";l();Nc();vo();Ic()});import iT from"crypto";import Yg from"fs";import Qg from"os";import he from"path";async function _(t,e,n=null,r={}){let o=r.silent?void 0:a=>{process.stderr.write(`Processed ${a} files...\r`)},s=he.resolve(t);return await new pe(s,n,r.pathAliases?new K(s,{pathAliases:r.pathAliases}):void 0,o,r.gitStats??!1,r.coverageMap??new Map,r.parallelParsing??!0,r.additionalIgnoreDirs??[],r.docFiles??null).build(e)}function Xg(t){let e=Number.parseInt(process.env.MOKOSH_WORKSPACE_CONCURRENCY??"",10),n=Number.isFinite(e)&&e>0?e:Qg.cpus().length||1;return Math.max(1,Math.min(n,Math.max(1,t)))}function Zg(t,e,n){let r=new Map(e.map(s=>[s.name,[]])),o=[...e].sort((s,i)=>i.root.length-s.root.length);for(let s of n){if(!s.endsWith(".md")&&!s.endsWith(".mdx"))continue;let i=he.join(t,s),a=o.find(c=>i===c.root||i.startsWith(`${c.root}${he.sep}`));a&&r.get(a.name)?.push(i)}return r}async function Mc(t,e={}){let n=he.resolve(t),r=e.layout??to(n),o=e.projectFiles??O(n),s=e.additionalIgnoreDirs??[],i=e.packages?r.packages.filter(C=>e.packages?.includes(C.name)||e.packages?.includes(C.relativeRoot)):r.packages,a=new Map(r.packages.map(C=>[C.name,C.root])),c=new pt(n,r.type),p=new le(s),f=Zg(n,i,o),m=Xg(i.length),h=m>1?!1:e.parallelParsing??!0,y=new Array(i.length),b=0,v=async()=>{for(let C=b++;C<i.length;C=b++){let E=i[C],G=e.silent?void 0:F=>{process.stderr.write(`[${E.name}] Processed ${F} files...\r`)},S=new pe(n,e.previousWorkspace?.packages.get(E.name)?.graph??null,new K(n,{workspaceMap:a,tsconfigSearchPaths:[E.root,n],pathAliases:e.pathAliases,langResolvers:jt({jvm:p})}),G,e.gitStats??!1,new Map,h,s,f.get(E.name)??[]);y[C]=await S.build(E.entryPoints)}};return await Promise.all(Array.from({length:m},v)),i.forEach((C,E)=>{c.addPackage(C,y[E])}),c.annotateCrossPackageEdges(),c}function O(t,e={}){let n=[],r=new Set([...e.ignoreDirs??A,...e.additionalIgnoreDirs??[]]),o=new Set([...e.extensions??An,...e.additionalExtensions??[]]);function s(i){try{let a=Yg.readdirSync(i,{withFileTypes:!0});for(let c of a){let p=he.join(i,c.name);c.isDirectory()?r.has(c.name)||s(p):c.isFile()&&o.has(he.extname(c.name).toLowerCase())&&n.push(he.relative(t,p))}}catch{}}return s(t),n}var w=d(()=>{"use strict";l();In();j();os();is();St();_n();jn();zn();Ea();Bt();Vt();qt();Ot();ve();Ut();Ur();Na();Ht();qr();no();tn();ro();be();Ke();ic();Ac();j();wo();Dr()});var Fo=d(()=>{"use strict";l();j()});import mt from"path";import{parseArgs as eh}from"util";function th(t){for(let e=0;e<t.length;e++)if(t[e]==="--root"&&t[e+1])return mt.resolve(t[e+1]);return process.cwd()}function V(t){return t?parseInt(t,10):void 0}function Lc(t){return t?t.split(",").map(e=>e.trim()):void 0}function rh(t){let e=[];for(let n=0;n<t.length;n++){let r=t[n];if(r!==void 0)if(!r.startsWith("--"))e.push(r);else if(nh.has(r)){let o=t[n+1];o!==void 0&&!o.startsWith("--")&&(e.push(r,o),n++)}else r.slice(2)in No&&e.push(r)}return e}function oh(t){return{mermaid:t.mermaid??!1,proposeTags:t["propose-tags"]??!1,plain:t.plain??!1,affectedTests:t["affected-tests"]??!1,detectFeatures:t["detect-features"]??!1,findUnused:t["find-unused"]??!1,excludeTests:t["exclude-tests"]??!1,checkCycles:t["check-cycles"]??!1,checkDocDrift:t["check-doc-drift"]??!1,findUncovered:t["find-uncovered"]??!1}}function sh(t){return{listTags:t["list-tags"]??!1,callers:t.callers??!1,silent:t.silent??!1,queryHelp:t["query-help"]??!1,typeGraph:t["type-graph"]??!1,moduleResponsibility:t["module-responsibility"]??!1,featureGraph:t["feature-graph"]??!1,callGraph:t["call-graph"]??!1,findSymbol:t["find-symbol"]??!1,apiSurface:t["api-surface"]??!1}}function ih(t){return{applyTags:t["apply-tags"]??!1,dryRun:t["dry-run"]??!1,initSkill:t["init-skill"]??!1,initConfig:t["init-config"]??!1,force:t.force??!1,dependencies:t.dependencies??!1,dependents:t.dependents??!1,affected:t.affected??!1,testsOnly:t["tests-only"]??!1,cached:t.cached??!1}}function ah(t){return{withMeta:t["with-meta"]??!1,withEdgeDetail:t["with-edge-detail"]??!1,findComplexFunctions:t["find-complex-functions"]??!1,findDuplicates:t["find-duplicates"]??!1,findRiskHotspots:t["find-risk-hotspots"]??!1,workspacePackages:t["workspace-packages"]??!1,workspaceAffected:t["workspace-affected"]??!1,clearCache:t["clear-cache"]??!1,slim:t.slim??!1,watch:t.watch??!1}}function Oc(t){let e=th(t),n=mt.join(mt.resolve(e,Q),Ce),{values:r,positionals:o}=eh({args:rh(t),allowPositionals:!0,options:No}),s=r.cache,i=r.config,a=r.metric,c=r;return{rootDir:e,cachePath:s?mt.resolve(e,s):n,configPath:i?mt.resolve(e,i):void 0,query:r.query,file:r.file,typeFilter:r.type,functionName:r.function,filterPaths:Lc(r.paths),featureThreshold:V(r["feature-threshold"]),minOutDegree:V(r["min-out-degree"]),...oh(c),...sh(c),help:t.length===0||(r.help??!1),...ih(c),changedSymbols:Lc(r["changed-symbols"]),depth:V(r.depth),...ah(c),metric:a==="complexity"||a==="cognitiveComplexity"?a:void 0,complexityThreshold:V(r["complexity-threshold"]),limit:V(r.limit),minDuplicateLines:V(r["min-duplicate-lines"]),includeGenerated:r["include-generated"]??!1,maxCoveragePct:V(r["max-coverage-pct"]),minChurn:V(r["min-churn"]),base:r.base,compareBranches:r["compare-branches"],compareFull:r["compare-full"]??!1,compareMaxItems:V(r["compare-max-items"]),entryPoints:o}}var No,nh,_c=d(()=>{"use strict";l();Fo();No={root:{type:"string"},cache:{type:"string"},config:{type:"string"},query:{type:"string"},file:{type:"string"},type:{type:"string"},paths:{type:"string"},function:{type:"string"},"feature-threshold":{type:"string"},"min-out-degree":{type:"string"},mermaid:{type:"boolean"},"propose-tags":{type:"boolean"},plain:{type:"boolean"},"affected-tests":{type:"boolean"},"detect-features":{type:"boolean"},"find-unused":{type:"boolean"},"exclude-tests":{type:"boolean"},"check-cycles":{type:"boolean"},"check-doc-drift":{type:"boolean"},"find-uncovered":{type:"boolean"},"list-tags":{type:"boolean"},callers:{type:"boolean"},silent:{type:"boolean"},"query-help":{type:"boolean"},help:{type:"boolean"},"type-graph":{type:"boolean"},"module-responsibility":{type:"boolean"},"feature-graph":{type:"boolean"},"call-graph":{type:"boolean"},"find-symbol":{type:"boolean"},"api-surface":{type:"boolean"},"apply-tags":{type:"boolean"},"dry-run":{type:"boolean"},"init-skill":{type:"boolean"},"init-config":{type:"boolean"},force:{type:"boolean"},dependencies:{type:"boolean"},dependents:{type:"boolean"},affected:{type:"boolean"},"tests-only":{type:"boolean"},"changed-symbols":{type:"string"},cached:{type:"boolean"},depth:{type:"string"},"with-meta":{type:"boolean"},"with-edge-detail":{type:"boolean"},"find-complex-functions":{type:"boolean"},metric:{type:"string"},"complexity-threshold":{type:"string"},limit:{type:"string"},"find-duplicates":{type:"boolean"},"min-duplicate-lines":{type:"string"},"include-generated":{type:"boolean"},"find-risk-hotspots":{type:"boolean"},"max-coverage-pct":{type:"string"},"min-churn":{type:"string"},"workspace-packages":{type:"boolean"},"workspace-affected":{type:"boolean"},"clear-cache":{type:"boolean"},slim:{type:"boolean"},watch:{type:"boolean"},base:{type:"string"},"compare-branches":{type:"string"},"compare-full":{type:"boolean"},"compare-max-items":{type:"string"}},nh=new Set(Object.entries(No).filter(([,t])=>t.type==="string").map(([t])=>`--${t}`))});async function Po(t){let{graph:e,file:n,testsOnly:r,changedSymbols:o,cached:s,withMeta:i}=t;n||(console.error("Error: --affected requires --file <path>"),process.exit(1));let a=f=>i?f.map(m=>({path:m,...me(e,m)})):f;if(s){let f=$n(e),m=Wn(f,n),h=r?m.filter(b=>e.nodes.get(b)?.category==="test"):m,y=a(h);console.log(JSON.stringify({file:n,affected:y,count:y.length},null,2));return}let c=Lr(e,n,{testsOnly:r,changedSymbols:o}),p=a(c);console.log(JSON.stringify({file:n,affected:p,count:p.length},null,2))}var Gc=d(()=>{"use strict";l();w()});import Do from"path";function ye(t){return t.filter(e=>{let n=Do.basename(e).toLowerCase();return ch.some(r=>n.includes(r))})}function yn(t,e){return new kt().getChangedFiles(t,e).map(n=>Do.relative(t,Do.resolve(t,n)))}var ch,xn=d(()=>{"use strict";l();Hn();ch=[".test.",".spec.","-test.","-spec."]});async function jc(t){let{graph:e}=t,{rootDir:n,scanOptions:r,featureThreshold:o,rawConfig:s,base:i}=t,a=yn(n,i);if(![...e.nodes.values()].some(f=>ye([f.path]).length>0)){let f=O(n,r);e=await _(n,ye(f),e,N(s))}let p=To(e,a,{...o!==void 0&&{featureDetection:{minOutDegree:o}}});console.log(p.join(`
|
|
54
|
+
`))}var $c=d(()=>{"use strict";l();w();xn()});async function Wc(t){let{graph:e,rootDir:n,entryPoints:r}=t,o=r.length?r:Ln(e,n);o.length===0&&(console.error("Error: No entry points found. Pass entry points as positional args or ensure package.json has a main/exports field."),process.exit(1));let s=On(e,o);console.log(JSON.stringify(s,null,2))}var zc=d(()=>{"use strict";l();w()});async function Bc(t){let{graph:e}=t,{rootDir:n,scanOptions:r,dryRun:o,plain:s,rawConfig:i}=t;if(s||console.log(o?"Dry run: computing tag changes...":"Applying tags to test files..."),e.nodes.size===0){let c=O(n,r);e=await _(n,ye(c),e,N(i))}let a=await ko(e,n,{dryRun:o});console.log(JSON.stringify(a,null,2))}var Hc=d(()=>{"use strict";l();w();xn()});async function Uc(t){let{graph:e,functionName:n}=t;n||(console.error("Error: --call-graph requires --function <name>"),process.exit(1));let r=Gn(e,n);console.log(JSON.stringify(r,null,2))}var Jc=d(()=>{"use strict";l();w()});async function Ro(t){let{graph:e,file:n,plain:r,depth:o,withEdgeDetail:s}=t;n||(console.error("Error: --callers requires --file <path>"),process.exit(1));let i=Or(e,n,{depth:o??1,withEdgeDetail:s});console.log(r?i.map(a=>a.file).join(`
|
|
55
|
+
`):JSON.stringify({file:n,callers:i,count:i.length},null,2))}var Kc=d(()=>{"use strict";l();w()});async function Io(t){let{graph:e}=t,n=e.findCycles();if(n.length>0){process.stderr.write(`Found ${n.length} cycle(s):
|
|
56
|
+
`);for(let r of n)process.stderr.write(` ${r.join(" \u2192 ")}
|
|
57
|
+
`);process.exit(1)}console.log("No cycles detected.")}var Vc=d(()=>{"use strict";l()});async function Ao(t){let{graph:e}=t,n=[...e.nodes.values()].filter(r=>r.type==="markdown"&&r.staleFor&&r.staleFor.length>0).map(r=>({doc:r.path,staleFor:r.staleFor}));if(n.length>0){process.stderr.write(`Found ${n.length} doc(s) that may be out of date:
|
|
58
|
+
`);for(let{doc:r,staleFor:o}of n)process.stderr.write(` ${r} \u2014 references changed more recently: ${o.join(", ")}
|
|
59
|
+
`);process.exit(1)}console.log("No doc drift detected.")}var qc=d(()=>{"use strict";l()});import bn from"fs";import Mo from"path";function Yc(t){let e=Mo.dirname(t),n=Mo.join(e,re),r=Mo.join(e,Be),o=!1;for(let s of[t,n])bn.existsSync(s)&&(bn.unlinkSync(s),console.log(`Cache cleared: ${s}`),o=!0);bn.existsSync(r)&&(bn.rmSync(r,{recursive:!0,force:!0}),console.log(`Cache cleared: ${r}`),o=!0),o||console.log(`No cache file present at ${t}`)}var Qc=d(()=>{"use strict";l();w()});async function Xc(t){let{graph:e,rootDir:n,compareBranches:r,rawConfig:o}=t;if(!r){console.error("Error: --compare-branches requires a base ref, e.g. --compare-branches main"),process.exit(1);return}let s=await Br(n,r,e,{entryPoints:t.entryPoints,minDuplicateLines:t.minDuplicateLines,complexityMetric:t.metric,complexityThreshold:t.complexityThreshold,maxCoveragePct:t.maxCoveragePct,...N(o)}),i=t.compareFull?s:zr(s,{metric:t.metric,maxItems:t.compareMaxItems});console.log(JSON.stringify(i,null,2))}var Zc=d(()=>{"use strict";l();w()});async function Lo(t){let{graph:e,file:n,depth:r,withMeta:o}=t;n||(console.error("Error: --dependencies requires --file <path>"),process.exit(1));let s=Mr(e,n,r??1),i=o?s.map(a=>({...a,...me(e,a.path)})):s;console.log(JSON.stringify({file:n,dependencies:i},null,2))}var el=d(()=>{"use strict";l();w()});async function Oo(t){let{graph:e,file:n,withMeta:r}=t;n||(console.error("Error: --dependents requires --file <path>"),process.exit(1));let o=st(e,n),s=r?o.map(i=>({...i,...me(e,i.path)})):o;console.log(JSON.stringify({file:n,dependents:s},null,2))}var tl=d(()=>{"use strict";l();w()});async function nl(t){let{graph:e}=t,{rootDir:n,scanOptions:r,featureThreshold:o,rawConfig:s}=t;if(e.nodes.size===0){let c=O(n,r);e=await _(n,c,e,N(s))}let i=de(e.nodes,o!==void 0?{minOutDegree:o}:void 0),a=Array.from(i.values()).sort((c,p)=>p.outDegree-c.outDegree);console.log(JSON.stringify({features:a},null,2))}var rl=d(()=>{"use strict";l();w()});async function ol(t){let{graph:e}=t,{rootDir:n,scanOptions:r,minOutDegree:o,rawConfig:s}=t;if(e.nodes.size===0){let c=O(n,r);e=await _(n,c,e,N(s))}let i=it(e,o!==void 0?{minOutDegree:o}:void 0),a=Object.fromEntries(i.features);console.log(JSON.stringify({features:a,unassigned:i.unassigned},null,2))}var sl=d(()=>{"use strict";l();w()});async function _o(t){let{graph:e,metric:n,complexityThreshold:r,limit:o}=t,s=r??10,i=_e(e,{metric:n,threshold:s,limit:o});console.log(JSON.stringify({metric:n??"cognitiveComplexity",threshold:s,functions:i,count:i.length},null,2))}var il=d(()=>{"use strict";l();w()});import al from"path";async function Go(t){let{graph:e,rootDir:n,scanOptions:r,minDuplicateLines:o,includeGenerated:s,limit:i,cachePath:a}=t,c=o??6,p=[...r.ignoreDirs??A,...r.additionalIgnoreDirs??[]],f=al.join(al.dirname(a),re),m=Me(f),{groups:h}=await Oe(e,n,{minLines:c,limit:i,ignoreDirs:p,includeGenerated:s||t.rawConfig.duplication?.includeGenerated||!1,ignoreGlobs:t.rawConfig.duplication?.ignoreGlobs??[],tokenCache:m});Le(m,f),console.log(JSON.stringify({minLines:c,groups:h,count:h.length},null,2))}var cl=d(()=>{"use strict";l();w()});async function jo(t){let{graph:e,metric:n,complexityThreshold:r,maxCoveragePct:o,minChurn:s,limit:i}=t;if(!ne(e)){console.log(JSON.stringify({error:"No coverage data available. Set coverageReportPath in mokosh.config and rebuild the graph."},null,2));return}let a=r??10,c=o??50,p=s??0,{hotspots:f,count:m,churnDataAvailable:h}=Ge(e,{metric:n,minComplexity:a,maxCoveragePct:c,minChurn:p,limit:i});console.log(JSON.stringify({metric:n??"cognitiveComplexity",minComplexity:a,maxCoveragePct:c,minChurn:p,churnDataAvailable:h,hotspots:f,count:m},null,2))}var ll=d(()=>{"use strict";l();w()});async function pl(t){let{graph:e,functionName:n,plain:r}=t;n||(console.error("Error: --find-symbol requires --function <name>"),process.exit(1));let o=Jr(e,n);console.log(r?o.map(s=>s.path).join(`
|
|
60
|
+
`):JSON.stringify({name:n,matches:o,count:o.length},null,2))}var fl=d(()=>{"use strict";l();w()});async function $o(t){let{graph:e,featureThreshold:n,rawConfig:r,plain:o}=t,s=n??r.coverageThreshold??80;if(!ne(e)){console.log(JSON.stringify({error:"No coverage data available. Set coverageReportPath in mokosh.config and rebuild the graph."},null,2));return}let i=[...e.nodes.values()].filter(a=>a.category!=="test"&&a.category!=="config").filter(a=>a.coveragePct!==void 0&&a.coveragePct<s).map(a=>({file:a.path,coveragePct:a.coveragePct}));console.log(o?i.map(a=>a.file).join(`
|
|
61
|
+
`):JSON.stringify({threshold:s,uncovered:i,count:i.length},null,2))}var ml=d(()=>{"use strict";l();w()});import lh from"path";function fh(t){let e=lh.basename(t).toLowerCase();return ph.some(n=>e.includes(n))}async function ul(t){let{graph:e,rootDir:n,scanOptions:r,excludeTests:o}=t,s=O(n,r),i=e.findUnusedFiles(s);o&&(i=i.filter(a=>!fh(a))),console.log(JSON.stringify({unusedFiles:i},null,2))}var ph,dl=d(()=>{"use strict";l();w();ph=[".test.",".spec.","-test.","-spec.",".stories."]});async function Wo(t){let{graph:e,queryStr:n,mermaidOutput:r,slim:o}=t,s=e.serialize();if(n){let c=rn(n);s=nn(s,c)}if(r){let c=I.deserialize(s);console.log(bt.serialize(c));return}let i=e.findCycles();i.length>0&&(s.cycles=i);let a=Sr(e);console.log(JSON.stringify(o?{..._r(s),languageCoverage:a}:{...s,languageCoverage:a},null,2))}var gl=d(()=>{"use strict";l();w()});import mh from"fs";import zo from"path";function Sn(t,e,n){let r=t;for(let o=0;o<6;o++){let s=zo.join(r,"templates",...e);if(mh.existsSync(zo.join(s,n)))return s;let i=zo.dirname(r);if(i===r)break;r=i}throw new Error(`Could not locate mokosh templates/${e.join("/")}`)}var Bo=d(()=>{"use strict";l()});import hl from"fs";import yl from"path";function xl(t,e=process.cwd()){let n=Sn(u,["config"],"mokosh.config.js"),r=yl.join(n,"mokosh.config.js"),o=yl.join(e,"mokosh.config.js");if(hl.existsSync(o)&&!t){console.log("skipped mokosh.config.js (already exists, use --force to overwrite)");return}hl.copyFileSync(r,o),console.log("wrote mokosh.config.js")}var bl=d(()=>{"use strict";l();Bo()});import Ho from"fs";import Cn from"path";function Sl(t,e=process.cwd()){let n=Sn(u,["skill"],"SKILL.md");for(let r of uh){let o=Cn.join(n,r.templateFile),s=Cn.join(e,...r.destPath),i=Cn.join(...r.destPath);if(Ho.existsSync(s)&&!t){console.log(`skipped ${i} (already exists, use --force to overwrite)`);continue}Ho.mkdirSync(Cn.dirname(s),{recursive:!0}),Ho.copyFileSync(o,s),console.log(`wrote ${i}`)}}var uh,Cl=d(()=>{"use strict";l();Bo();uh=[{templateFile:"SKILL.md",destPath:[".claude","skills","mokosh","SKILL.md"]},{templateFile:"mokosh.md",destPath:[".claude","commands","mokosh.md"]}]});async function Uo(t){let{graph:e,plain:n}=t,r=new Map;for(let s of e.nodes.values())for(let i of s.tags)r.set(i.name,(r.get(i.name)??0)+1);let o=[...r.entries()].map(([s,i])=>({name:s,count:i})).sort((s,i)=>i.count-s.count);console.log(n?o.map(s=>s.name).join(`
|
|
62
|
+
`):JSON.stringify({tags:o,count:o.length},null,2))}var kl=d(()=>{"use strict";l()});async function vl(t){let{graph:e,filterPaths:n,minOutDegree:r}=t,o=Hr(e,r!==void 0?{minOutDegree:r}:void 0);if(n?.length){let s=n.map(i=>o.get(i)).filter(Boolean);console.log(JSON.stringify({count:s.length,modules:s},null,2))}else{let s=Array.from(o.values());console.log(JSON.stringify({count:s.length,modules:s},null,2))}}var wl=d(()=>{"use strict";l();w()});async function El(t){let{graph:e}=t,{rootDir:n,scanOptions:r,featureThreshold:o,plain:s,rawConfig:i,base:a}=t;s||console.log("Proposing test tags based on git diff...");let c=yn(n,a);if(e.nodes.size===0){let f=O(n,r);e=await _(n,ye(f),e,N(i))}let p=Eo(e,c,{...o!==void 0&&{featureDetection:{minOutDegree:o}}});console.log(s?p.join(" "):JSON.stringify({proposedTags:p},null,2))}var Tl=d(()=>{"use strict";l();w();xn()});async function Fl(t){let{graph:e,typeFilter:n}=t,r=Kr(e);if(n){let o=Vr(r,n);console.log(JSON.stringify(o,null,2))}else{let o=Array.from(r.types.values());console.log(JSON.stringify({count:o.length,types:o},null,2))}}var Nl=d(()=>{"use strict";l();w()});function Pl(t,e){let n=t.getAffectedAcrossPackages(e);console.log(JSON.stringify({file:e,affected:n,count:n.length},null,2))}var Dl=d(()=>{"use strict";l()});function Rl(t){console.log(JSON.stringify(Gr(t),null,2))}var Il=d(()=>{"use strict";l();w()});import Jo from"path";function dh(t,e,n,r){return t!==e?t:n?Jo.resolve(r,n):e}function Al(t){let{rootDir:e,entryPoints:n,cachePath:r,configPath:o}=t,s=o?Se(o,{isExplicitPath:!0}):Se(e),i=Jo.join(Jo.resolve(e,Q),Ce),a=n.length>0?n:s.entryPoints??[],c=dh(r,i,s.cachePath,e),p={...s.ignoreDirs!==void 0&&{additionalIgnoreDirs:s.ignoreDirs},...s.extensions!==void 0&&{additionalExtensions:s.extensions}};return{rootDir:e,resolvedEntryPoints:a,resolvedCachePath:c,scanOptions:p,rawConfig:s}}var Ml=d(()=>{"use strict";l();w();Fo()});import ut from"fs";import gh from"path";function Ll(t){if(!ut.existsSync(t))return null;let e=ut.readFileSync(t,"utf-8");return I.deserialize(JSON.parse(e))}function Ko(t,e){let n=gh.dirname(e);ut.existsSync(n)||ut.mkdirSync(n,{recursive:!0}),ut.writeFileSync(e,JSON.stringify(t.serialize(),null,2))}async function Vo(t,e,n,r={silent:!1,...N(void 0)}){return _(t,e,n,r)}var Ol=d(()=>{"use strict";l();w()});var _l,Gl,jl=d(()=>{"use strict";l();_l=`
|
|
61
63
|
Usage: mokosh [options] <entry-point1> <entry-point2> ...
|
|
62
64
|
|
|
63
65
|
Options:
|
|
@@ -122,11 +124,14 @@ MCP parity (mirrors the MCP server's tools for use when MCP is unavailable):
|
|
|
122
124
|
--complexity-threshold <N> Minimum score to include (default: 10, use with --find-complex-functions)
|
|
123
125
|
--limit <N> Max results for --find-complex-functions/--find-duplicates
|
|
124
126
|
--find-duplicates Find duplicated code blocks (token-based, works for every parsed
|
|
125
|
-
language), largest-first. Lock files
|
|
126
|
-
directory (--config's ignoreDirs, merged with the defaults)
|
|
127
|
-
always excluded
|
|
127
|
+
language), largest-first. Lock files, files under an ignored
|
|
128
|
+
directory (--config's ignoreDirs, merged with the defaults), and
|
|
129
|
+
generated / vendored files are always excluded
|
|
128
130
|
--min-duplicate-lines <N> Minimum duplicated block size in lines to report (default: 6,
|
|
129
131
|
use with --find-duplicates)
|
|
132
|
+
--include-generated Scan generated / vendored files too (protobuf output, *.generated.*,
|
|
133
|
+
generated/ & __snapshots__/ dirs, *.snap, @generated-marked
|
|
134
|
+
files); use with --find-duplicates
|
|
130
135
|
--find-risk-hotspots List functions that are complex, undertested, and (if gitStats is
|
|
131
136
|
enabled) frequently changed \u2014 requires coverageReportPath in config
|
|
132
137
|
--max-coverage-pct <N> Max file coverage % to include (default: 50, use with --find-risk-hotspots)
|
|
@@ -159,7 +164,7 @@ Notes:
|
|
|
159
164
|
server only loads JSON config (allowJs: false) for security. This is intentional.
|
|
160
165
|
--workspace-packages/--workspace-affected require explicit opt-in (unlike MCP's analyze tool,
|
|
161
166
|
which auto-detects a monorepo when entryPoints is empty); other commands remain single-package.
|
|
162
|
-
`,
|
|
167
|
+
`,Gl=`
|
|
163
168
|
Query filter reference (--query "key:value,key:value,...")
|
|
164
169
|
All keys are case-insensitive. Multiple keys are AND'd together.
|
|
165
170
|
|
|
@@ -282,5 +287,5 @@ COMMON PATTERNS
|
|
|
282
287
|
|
|
283
288
|
Large TypeScript logic files:
|
|
284
289
|
--query "type:typescript,category:logic,sort:size,limit:5"
|
|
285
|
-
`});var
|
|
290
|
+
`});var $l,Wl=d(()=>{"use strict";l();$l=/(?:^|[/\\])(?:node_modules|\.git|dist|build|coverage)(?:[/\\]|$)/});import hh from"fs";function zl(t,e,n){let r=null,o=!1,s=!1,i=async()=>{if(o){s=!0;return}o=!0;try{await n()}finally{o=!1,s&&(s=!1,i())}};i();let a=null;try{a=hh.watch(t,{recursive:!0},(c,p)=>{!p||$l.test(p)||(r&&clearTimeout(r),r=setTimeout(()=>{i()},e))})}catch(c){console.error(`Warning: unable to watch ${t}: ${c.message}`)}process.on("SIGINT",()=>{r&&clearTimeout(r),a?.close(),process.exit(0)})}var Bl=d(()=>{"use strict";l();Wl()});function xh(t){t.help&&(console.log(_l),process.exit(0)),t.queryHelp&&(console.log(Gl),process.exit(0)),t.initSkill&&(Sl(t.force),process.exit(0)),t.initConfig&&(xl(t.force),process.exit(0)),t.clearCache&&(Yc(t.cachePath),process.exit(0))}async function bh(t,e,n){if(!t.workspacePackages&&!t.workspaceAffected)return!1;t.watch&&(console.error("Error: --watch is not supported with --workspace-packages/--workspace-affected"),process.exit(1));let r=await Mc(n,N(e.rawConfig));return t.workspacePackages?Rl(r):(t.file||(console.error("Error: --workspace-affected requires --file <path>"),process.exit(1)),Pl(r,t.file)),!0}function Sh(t){return t.proposeTags||t.affectedTests||t.applyTags||t.callers||t.dependencies||t.dependents||t.affected||t.findUncovered||t.listTags||t.findComplexFunctions||t.findDuplicates||t.findRiskHotspots||t.typeGraph||t.moduleResponsibility||t.callGraph||t.findSymbol||t.apiSurface||!!t.compareBranches}function Ch(t){let n=[{name:"--propose-tags",flag:t.proposeTags,handler:El},{name:"--apply-tags",flag:t.applyTags,handler:Bc},{name:"--affected-tests",flag:t.affectedTests,handler:jc},{name:"--detect-features",flag:t.detectFeatures,handler:nl},{name:"--find-unused",flag:t.findUnused,handler:ul},{name:"--check-cycles",flag:t.checkCycles,handler:Io},{name:"--check-doc-drift",flag:t.checkDocDrift,handler:Ao},{name:"--find-uncovered",flag:t.findUncovered,handler:$o},{name:"--list-tags",flag:t.listTags,handler:Uo},{name:"--callers",flag:t.callers,handler:Ro},{name:"--dependencies",flag:t.dependencies,handler:Lo},{name:"--dependents",flag:t.dependents,handler:Oo},{name:"--affected",flag:t.affected,handler:Po},{name:"--find-complex-functions",flag:t.findComplexFunctions,handler:_o},{name:"--find-duplicates",flag:t.findDuplicates,handler:Go},{name:"--find-risk-hotspots",flag:t.findRiskHotspots,handler:jo},{name:"--type-graph",flag:t.typeGraph,handler:Fl},{name:"--module-responsibility",flag:t.moduleResponsibility,handler:vl},{name:"--feature-graph",flag:t.featureGraph,handler:ol},{name:"--call-graph",flag:t.callGraph,handler:Uc},{name:"--find-symbol",flag:t.findSymbol,handler:pl},{name:"--api-surface",flag:t.apiSurface,handler:Wc},{name:"--compare-branches",flag:!!t.compareBranches,handler:Xc}].filter(r=>r.flag);return n.length>1&&(console.error(`Error: conflicting flags: ${n.map(r=>r.name).join(", ")} (pass only one command flag)`),process.exit(1)),n[0]?.handler??Wo}async function kh(t,e,n,r,o,s,i){yh.has(t)||(console.error("Error: --watch is only supported with the default output, --query, --callers, --dependencies, --dependents, --affected, --find-uncovered, --find-complex-functions, --find-duplicates, --find-risk-hotspots, --check-cycles, --check-doc-drift, and --list-tags"),process.exit(1)),zl(n,300,async()=>{let a=await Vo(n,r,e.graph,{silent:s,...N(i)});Ko(a,o),console.log(`--- rebuilt at ${new Date().toISOString()} ---`),await t({...e,graph:a})})}async function Hl(){let t=process.argv.slice(2),e=Oc(t);xh(e);let n=Al(e);Rn(n.rawConfig);let{rootDir:r,resolvedEntryPoints:o,resolvedCachePath:s,scanOptions:i}=n;if(await bh(e,n,r))return;let a=Sh(e),c=Ll(s)??new I(new Map);(o.length>0||!a)&&(o.length===0&&!a&&!e.findUnused&&!e.detectFeatures&&!e.checkCycles&&!e.checkDocDrift&&(console.error("Error: No entry points provided"),process.exit(1)),c=await Vo(r,o,c,{silent:e.silent,...N(n.rawConfig)}),Ko(c,s));let p={graph:c,rootDir:r,cachePath:s,entryPoints:o.map(m=>m.replace(`${r}/`,"")),scanOptions:i,rawConfig:n.rawConfig,featureThreshold:e.featureThreshold,queryStr:e.query,mermaidOutput:e.mermaid,plain:e.plain,excludeTests:e.excludeTests,file:e.file,typeFilter:e.typeFilter,filterPaths:e.filterPaths,minOutDegree:e.minOutDegree,functionName:e.functionName,dryRun:e.dryRun,depth:e.depth,cached:e.cached,changedSymbols:e.changedSymbols,withMeta:e.withMeta,withEdgeDetail:e.withEdgeDetail,metric:e.metric,complexityThreshold:e.complexityThreshold,limit:e.limit,slim:e.slim,testsOnly:e.testsOnly,minDuplicateLines:e.minDuplicateLines,includeGenerated:e.includeGenerated,maxCoveragePct:e.maxCoveragePct,minChurn:e.minChurn,base:e.base,compareBranches:e.compareBranches,compareFull:e.compareFull,compareMaxItems:e.compareMaxItems},f=Ch(e);if(e.watch){await kh(f,p,r,o,s,e.silent,n.rawConfig);return}await f(p)}var yh,Ul=d(()=>{"use strict";l();w();_c();Gc();$c();zc();Hc();Jc();Kc();Vc();qc();Qc();Zc();el();tl();rl();sl();il();cl();ll();fl();ml();dl();gl();bl();Cl();kl();wl();Tl();Nl();Dl();Il();Ml();Ol();jl();Bl();yh=new Set([Wo,Ro,Lo,Oo,Po,$o,_o,Go,jo,Io,Ao,Uo])});var vh=Kl(()=>{l();Ul();Hl().catch(t=>{console.error(t),process.exit(1)})});export default vh();
|
|
286
291
|
//# sourceMappingURL=cli.mjs.map
|