@vibgrate/cli 2026.630.3 → 2026.701.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.
@@ -1,76 +0,0 @@
1
- import {a}from'./chunk-MKDRULJ6.js';import {p,o,j,n,a as a$1,i,k,d,e,q as q$1,r,s}from'./chunk-XTHPCEME.js';import {b}from'./chunk-EK7ODJWE.js';import*as I from'path';import {basename,dirname}from'path';import*as ve from'fs/promises';import {readFile,mkdtemp,rm,mkdir,writeFile}from'fs/promises';import O from'typescript';import*as Os from'crypto';import E from'chalk';import*as mn from'os';import {spawn,execFile}from'child_process';import*as Kt from'fs';import {mkdirSync,writeFileSync}from'fs';import {createRequire}from'module';import*as di from'zlib';import {promisify}from'util';function Ti(t){switch(t){case "node":return "nodejs";case "python":return "python";case "dotnet":return "dotnet";case "java":return "java";case "php":return "php";case "ruby":return "ruby";case "go":return "go";default:return null}}function Qe(t,e){if(!e)return null;switch(t){case "python":case "php":case "ruby":case "go":{let n=e.match(/(\d+)\.(\d+)/);return n?`${n[1]}.${n[2]}`:null}case "dotnet":{let n=e.match(/(\d+)\.(\d+)/)??e.match(/(\d+)/);return n?n[2]!==void 0?`${n[1]}.${n[2]}`:`${n[1]}.0`:null}case "node":{let n=e.match(/(\d+)/);return n?n[1]:null}case "java":{let n=e.match(/1\.(\d+)/);if(n)return n[1];let s=e.match(/(\d+)/);return s?s[1]:null}default:return null}}function Ci(t,e,n=Date.now()){let s=e.find(o=>String(o.cycle)===t);if(!s)return null;if(typeof s.eol=="boolean")return s.eol;let r=Date.parse(s.eol);return Number.isNaN(r)?null:r<=n}function or(t){let e=String(t).match(/^(\d+)(?:\.(\d+))?/);return e?{major:parseInt(e[1],10),minor:e[2]?parseInt(e[2],10):0}:null}function An(t){return t.major*1e3+t.minor}function ir(t,e){if(typeof t.releaseDate!="string")return true;let n=Date.parse(t.releaseDate);return Number.isNaN(n)?true:n<=e}function Ai(t,e){if(t.lts===true)return true;if(typeof t.lts=="string"){let n=Date.parse(t.lts);return !Number.isNaN(n)&&n<=e}return false}function Pn(t,e){return t.products[e]?.cycles??[]}function Zt(t,e,n=Date.now()){let s=null;for(let r of Pn(t,e)){if(!ir(r,n))continue;let o=or(r.cycle);o&&(!s||An(o)>An(s))&&(s=o);}return s}function ls(t,e,n=Date.now()){let s=null;for(let r of Pn(t,e)){if(!ir(r,n)||!Ai(r,n))continue;let o=or(r.cycle);o&&(!s||An(o)>An(s))&&(s=o);}return s}function at(t,e,n){let s=Pn(t,e).find(r=>String(r.cycle)===n);return s&&typeof s.eol=="string"?s.eol:void 0}function ct(t,e,n,s=Date.now()){let r=Ti(e);if(!r)return null;let o=Qe(e,n);return o?Ci(o,Pn(t,r),s):null}var je={generatedAt:"2026-06-01",source:"endoflife.date",products:{nodejs:{product:"nodejs",cycles:[{cycle:"24",releaseDate:"2025-05-06",lts:"2025-10-28",eol:"2028-04-30"},{cycle:"23",releaseDate:"2024-10-16",lts:false,eol:"2025-06-01"},{cycle:"22",releaseDate:"2024-04-24",lts:"2024-10-29",eol:"2027-04-30"},{cycle:"20",releaseDate:"2023-04-18",lts:"2023-10-24",eol:"2026-04-30"},{cycle:"18",releaseDate:"2022-04-19",lts:"2022-10-25",eol:"2025-04-30"}]},python:{product:"python",cycles:[{cycle:"3.14",releaseDate:"2025-10-07",eol:"2030-10-01"},{cycle:"3.13",releaseDate:"2024-10-07",eol:"2029-10-01"},{cycle:"3.12",releaseDate:"2023-10-02",eol:"2028-10-01"},{cycle:"3.11",releaseDate:"2022-10-24",eol:"2027-10-01"},{cycle:"3.10",releaseDate:"2021-10-04",eol:"2026-10-01"},{cycle:"3.9",releaseDate:"2020-10-05",eol:"2025-10-01"},{cycle:"3.8",releaseDate:"2019-10-14",eol:"2024-10-07"}]},dotnet:{product:"dotnet",cycles:[{cycle:"10.0",releaseDate:"2025-11-11",lts:true,eol:"2028-11-10"},{cycle:"9.0",releaseDate:"2024-11-12",lts:false,eol:"2026-05-12"},{cycle:"8.0",releaseDate:"2023-11-14",lts:true,eol:"2026-11-10"},{cycle:"7.0",releaseDate:"2022-11-08",lts:false,eol:"2024-05-14"},{cycle:"6.0",releaseDate:"2021-11-08",lts:true,eol:"2024-11-12"}]},java:{product:"java",cycles:[{cycle:"25",releaseDate:"2025-09-16",lts:true,eol:"2033-09-01"},{cycle:"21",releaseDate:"2023-09-19",lts:true,eol:"2031-09-01"},{cycle:"17",releaseDate:"2021-09-14",lts:true,eol:"2029-09-01"},{cycle:"11",releaseDate:"2018-09-25",lts:true,eol:"2026-09-01"},{cycle:"8",releaseDate:"2014-03-18",lts:true,eol:"2030-12-01"}]},php:{product:"php",cycles:[{cycle:"8.4",releaseDate:"2024-11-21",eol:"2028-12-31"},{cycle:"8.3",releaseDate:"2023-11-23",eol:"2027-12-31"},{cycle:"8.2",releaseDate:"2022-12-08",eol:"2026-12-31"},{cycle:"8.1",releaseDate:"2021-11-25",eol:"2025-12-31"},{cycle:"8.0",releaseDate:"2020-11-26",eol:"2023-11-26"}]},ruby:{product:"ruby",cycles:[{cycle:"3.5",releaseDate:"2025-12-25",eol:"2029-03-31"},{cycle:"3.4",releaseDate:"2024-12-25",eol:"2028-03-31"},{cycle:"3.3",releaseDate:"2023-12-25",eol:"2027-03-31"},{cycle:"3.2",releaseDate:"2022-12-25",eol:"2026-03-31"},{cycle:"3.1",releaseDate:"2021-12-25",eol:"2025-03-31"}]},go:{product:"go",cycles:[{cycle:"1.25",releaseDate:"2025-08-13",eol:false},{cycle:"1.24",releaseDate:"2025-02-11",eol:false},{cycle:"1.23",releaseDate:"2024-08-13",eol:true},{cycle:"1.22",releaseDate:"2024-02-06",eol:true}]}}};var we=b(a(),1),st=b(a(),1),vt=b(a(),1);var ar=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",Pi=ar+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Mi="["+ar+"]["+Pi+"]*",$i=new RegExp("^"+Mi+"$");function Mn(t,e){let n=[],s=e.exec(t);for(;s;){let r=[];r.startIndex=e.lastIndex-s[0].length;let o=s.length;for(let a=0;a<o;a++)r.push(s[a]);n.push(r),s=e.exec(t);}return n}var us=function(t){let e=$i.exec(t);return !(e===null||typeof e>"u")};function cr(t){return typeof t<"u"}var en=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],$n=["__proto__","constructor","prototype"];var Li={allowBooleanAttributes:false,unpairedTags:[]};function fr(t,e){e=Object.assign({},Li,e);let n=[],s=false,r=false;t[0]==="\uFEFF"&&(t=t.substr(1));for(let o=0;o<t.length;o++)if(t[o]==="<"&&t[o+1]==="?"){if(o+=2,o=ur(t,o),o.err)return o}else if(t[o]==="<"){let a=o;if(o++,t[o]==="!"){o=pr(t,o);continue}else {let i=false;t[o]==="/"&&(i=true,o++);let c="";for(;o<t.length&&t[o]!==">"&&t[o]!==" "&&t[o]!==" "&&t[o]!==`
2
- `&&t[o]!=="\r";o++)c+=t[o];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),o--),!Vi(c)){let p;return c.trim().length===0?p="Invalid space after '<'.":p="Tag '"+c+"' is an invalid name.",B("InvalidTag",p,K(t,o))}let l=Ii(t,o);if(l===false)return B("InvalidAttr","Attributes for '"+c+"' have open quote.",K(t,o));let u=l.value;if(o=l.index,u[u.length-1]==="/"){let p=o-u.length;u=u.substring(0,u.length-1);let d=dr(u,e);if(d===true)s=true;else return B(d.err.code,d.err.msg,K(t,p+d.err.line))}else if(i)if(l.tagClosed){if(u.trim().length>0)return B("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",K(t,a));if(n.length===0)return B("InvalidTag","Closing tag '"+c+"' has not been opened.",K(t,a));{let p=n.pop();if(c!==p.tagName){let d=K(t,p.tagStartPos);return B("InvalidTag","Expected closing tag '"+p.tagName+"' (opened in line "+d.line+", col "+d.col+") instead of closing tag '"+c+"'.",K(t,a))}n.length==0&&(r=true);}}else return B("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",K(t,o));else {let p=dr(u,e);if(p!==true)return B(p.err.code,p.err.msg,K(t,o-u.length+p.err.line));if(r===true)return B("InvalidXml","Multiple possible root nodes found.",K(t,o));e.unpairedTags.indexOf(c)!==-1||n.push({tagName:c,tagStartPos:a}),s=true;}for(o++;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="!"){o++,o=pr(t,o);continue}else if(t[o+1]==="?"){if(o=ur(t,++o),o.err)return o}else break;else if(t[o]==="&"){let p=Oi(t,o);if(p==-1)return B("InvalidChar","char '&' is not expected.",K(t,o));o=p;}else if(r===true&&!lr(t[o]))return B("InvalidXml","Extra text at the end",K(t,o));t[o]==="<"&&o--;}}else {if(lr(t[o]))continue;return B("InvalidChar","char '"+t[o]+"' is not expected.",K(t,o))}if(s){if(n.length==1)return B("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",K(t,n[0].tagStartPos));if(n.length>0)return B("InvalidXml","Invalid '"+JSON.stringify(n.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return B("InvalidXml","Start tag expected.",1);return true}function lr(t){return t===" "||t===" "||t===`
3
- `||t==="\r"}function ur(t,e){let n=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){let s=t.substr(n,e-n);if(e>5&&s==="xml")return B("InvalidXml","XML declaration allowed only at the start of the document.",K(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function pr(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let n=1;for(e+=8;e<t.length;e++)if(t[e]==="<")n++;else if(t[e]===">"&&(n--,n===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}var Ni='"',Ri="'";function Ii(t,e){let n="",s="",r=false;for(;e<t.length;e++){if(t[e]===Ni||t[e]===Ri)s===""?s=t[e]:s!==t[e]||(s="");else if(t[e]===">"&&s===""){r=true;break}n+=t[e];}return s!==""?false:{value:n,index:e,tagClosed:r}}var _i=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function dr(t,e){let n=Mn(t,_i),s={};for(let r=0;r<n.length;r++){if(n[r][1].length===0)return B("InvalidAttr","Attribute '"+n[r][2]+"' has no space in starting.",tn(n[r]));if(n[r][3]!==void 0&&n[r][4]===void 0)return B("InvalidAttr","Attribute '"+n[r][2]+"' is without value.",tn(n[r]));if(n[r][3]===void 0&&!e.allowBooleanAttributes)return B("InvalidAttr","boolean attribute '"+n[r][2]+"' is not allowed.",tn(n[r]));let o=n[r][2];if(!Bi(o))return B("InvalidAttr","Attribute '"+o+"' is an invalid name.",tn(n[r]));if(!Object.prototype.hasOwnProperty.call(s,o))s[o]=1;else return B("InvalidAttr","Attribute '"+o+"' is repeated.",tn(n[r]))}return true}function Fi(t,e){let n=/\d/;for(t[e]==="x"&&(e++,n=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(n))break}return -1}function Oi(t,e){if(e++,t[e]===";")return -1;if(t[e]==="#")return e++,Fi(t,e);let n=0;for(;e<t.length;e++,n++)if(!(t[e].match(/\w/)&&n<20)){if(t[e]===";")break;return -1}return e}function B(t,e,n){return {err:{code:t,msg:e,line:n.line||n,col:n.col}}}function Bi(t){return us(t)}function Vi(t){return us(t)}function K(t,e){let n=t.substring(0,e).split(/\r?\n/);return {line:n.length,col:n[n.length-1].length+1}}function tn(t){return t.startIndex+t[1].length}var Ln={cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",euro:"\u20AC",dollar:"$",fnof:"\u0192",inr:"\u20B9",af:"\u060B",birr:"\u1265\u122D",peso:"\u20B1",rub:"\u20BD",won:"\u20A9",yuan:"\xA5",cedil:"\xB8"},nn={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},ps={nbsp:"\xA0",copy:"\xA9",reg:"\xAE",trade:"\u2122",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",laquo:"\xAB",raquo:"\xBB",lsquo:"\u2018",rsquo:"\u2019",ldquo:"\u201C",rdquo:"\u201D",bull:"\u2022",para:"\xB6",sect:"\xA7",deg:"\xB0",frac12:"\xBD",frac14:"\xBC",frac34:"\xBE"};var It=Object.freeze({ALLOW:"allow",BLOCK:"block",THROW:"throw"}),Ui=new Set("!?\\\\/[]$%{}^&*()<>|+");function Tr(t){if(t[0]==="#")throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${t}"`);for(let e of t)if(Ui.has(e))throw new Error(`[EntityReplacer] Invalid character '${e}' in entity name: "${t}"`);return t}function sn(...t){let e=Object.create(null);for(let n of t)if(n)for(let s of Object.keys(n)){let r=n[s];if(typeof r=="string")e[s]=r;else if(r&&typeof r=="object"&&r.val!==void 0){let o=r.val;typeof o=="string"&&(e[s]=o);}}return e}var lt="external",Nn="base",ds="all";function Gi(t){return !t||t===lt?new Set([lt]):t===ds?new Set([ds]):t===Nn?new Set([Nn]):Array.isArray(t)?new Set(t):new Set([lt])}var Z=Object.freeze({allow:0,leave:1,remove:2,throw:3}),qi=new Set([9,10,13]);function Hi(t){if(!t)return {xmlVersion:1,onLevel:Z.allow,nullLevel:Z.remove};let e=t.xmlVersion===1.1?1.1:1,n=Z[t.onNCR]??Z.allow,s=Z[t.nullNCR]??Z.remove,r=Math.max(s,Z.remove);return {xmlVersion:e,onLevel:n,nullLevel:r}}var _t=class{constructor(e={}){this._limit=e.limit||{},this._maxTotalExpansions=this._limit.maxTotalExpansions||0,this._maxExpandedLength=this._limit.maxExpandedLength||0,this._postCheck=typeof e.postCheck=="function"?e.postCheck:s=>s,this._limitTiers=Gi(this._limit.applyLimitsTo??lt),this._numericAllowed=e.numericAllowed??true,this._baseMap=sn(nn,e.namedEntities||null),this._externalMap=Object.create(null),this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this._removeSet=new Set(e.remove&&Array.isArray(e.remove)?e.remove:[]),this._leaveSet=new Set(e.leave&&Array.isArray(e.leave)?e.leave:[]);let n=Hi(e.ncr);this._ncrXmlVersion=n.xmlVersion,this._ncrOnLevel=n.onLevel,this._ncrNullLevel=n.nullLevel,this._onExternalEntity=typeof e.onExternalEntity=="function"?e.onExternalEntity:null,this._onInputEntity=typeof e.onInputEntity=="function"?e.onInputEntity:null;}_applyRegistrationHook(e,n,s,r){if(!e)return true;let o=e(n,s);if(o===It.BLOCK)return false;if(o===It.THROW)throw new Error(`[EntityDecoder] Registration of ${r} entity "&${n};" was rejected by hook`);return true}setExternalEntities(e){if(e)for(let r of Object.keys(e))Tr(r);if(!this._onExternalEntity){this._externalMap=sn(e);return}let n=sn(e),s=Object.create(null);for(let[r,o]of Object.entries(n))this._applyRegistrationHook(this._onExternalEntity,r,o,"external")&&(s[r]=o);this._externalMap=s;}addExternalEntity(e,n){Tr(e),typeof n=="string"&&n.indexOf("&")===-1&&this._applyRegistrationHook(this._onExternalEntity,e,n,"external")&&(this._externalMap[e]=n);}addInputEntities(e){if(this._totalExpansions=0,this._expandedLength=0,!this._onInputEntity){this._inputMap=sn(e);return}let n=sn(e),s=Object.create(null);for(let[r,o]of Object.entries(n))this._applyRegistrationHook(this._onInputEntity,r,o,"input")&&(s[r]=o);this._inputMap=s;}reset(){return this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this}setXmlVersion(e){this._ncrXmlVersion=e===1.1?1.1:1;}decode(e){if(typeof e!="string"||e.length===0||e.indexOf("&")===-1)return e;let n=e,s=[],r=e.length,o=0,a=0,i=this._maxTotalExpansions>0,c=this._maxExpandedLength>0,l=i||c;for(;a<r;){if(e.charCodeAt(a)!==38){a++;continue}let p=a+1;for(;p<r&&e.charCodeAt(p)!==59&&p-a<=32;)p++;if(p>=r||e.charCodeAt(p)!==59){a++;continue}let d=e.slice(a+1,p);if(d.length===0){a++;continue}let f,h;if(this._removeSet.has(d))f="",h===void 0&&(h=lt);else if(this._leaveSet.has(d)){a++;continue}else if(d.charCodeAt(0)===35){let m=this._resolveNCR(d);if(m===void 0){a++;continue}f=m,h=Nn;}else {let m=this._resolveName(d);f=m?.value,h=m?.tier;}if(f===void 0){a++;continue}if(a>o&&s.push(e.slice(o,a)),s.push(f),o=p+1,a=o,l&&this._tierCounts(h)){if(i&&(this._totalExpansions++,this._totalExpansions>this._maxTotalExpansions))throw new Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);if(c){let m=f.length-(d.length+2);if(m>0&&(this._expandedLength+=m,this._expandedLength>this._maxExpandedLength))throw new Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`)}}}o<r&&s.push(e.slice(o));let u=s.length===0?e:s.join("");return this._postCheck(u,n)}_tierCounts(e){return this._limitTiers.has(ds)?true:this._limitTiers.has(e)}_resolveName(e){if(e in this._inputMap)return {value:this._inputMap[e],tier:lt};if(e in this._externalMap)return {value:this._externalMap[e],tier:lt};if(e in this._baseMap)return {value:this._baseMap[e],tier:Nn}}_classifyNCR(e){return e===0?this._ncrNullLevel:e>=55296&&e<=57343||this._ncrXmlVersion===1&&e>=1&&e<=31&&!qi.has(e)?Z.remove:-1}_applyNCRAction(e,n,s){switch(e){case Z.allow:return String.fromCodePoint(s);case Z.remove:return "";case Z.leave:return;case Z.throw:throw new Error(`[EntityDecoder] Prohibited numeric character reference &${n}; (U+${s.toString(16).toUpperCase().padStart(4,"0")})`);default:return String.fromCodePoint(s)}}_resolveNCR(e){let n=e.charCodeAt(1),s;if(n===120||n===88?s=parseInt(e.slice(2),16):s=parseInt(e.slice(1),10),Number.isNaN(s)||s<0||s>1114111)return;let r=this._classifyNCR(s);if(!this._numericAllowed&&r<Z.remove)return;let o=r===-1?this._ncrOnLevel:Math.max(this._ncrOnLevel,r);return this._applyNCRAction(o,e,s)}};var Cr=t=>en.includes(t)?"__"+t:t,Wi={preserveOrder:false,attributeNamePrefix:"@_",attributesGroupName:false,textNodeName:"#text",ignoreAttributes:true,removeNSPrefix:false,allowBooleanAttributes:false,parseTagValue:true,parseAttributeValue:false,trimValues:true,cdataPropName:false,numberParseOptions:{hex:true,leadingZeros:true,eNotation:true,unicode:false},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:false,isArray:()=>false,commentPropName:false,unpairedTags:[],processEntities:true,htmlEntities:false,entityDecoder:null,ignoreDeclaration:false,ignorePiTags:false,transformTagName:false,transformAttributeName:false,updateTag:function(t,e,n){return t},captureMetaData:false,maxNestedTags:100,strictReservedNames:true,jPath:true,onDangerousProperty:Cr};function zi(t,e){if(typeof t!="string")return;let n=t.toLowerCase();if(en.some(s=>n===s.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);if($n.some(s=>n===s.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`)}function Ar(t,e){return typeof t=="boolean"?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:1e4,maxTotalExpansions:1/0,maxExpandedLength:1e5,maxEntityCount:1e3,allowedTags:null,tagFilter:null,appliesTo:"all"}:typeof t=="object"&&t!==null?{enabled:t.enabled!==false,maxEntitySize:Math.max(1,t.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,t.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,t.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,t.maxExpandedLength??1e5),maxEntityCount:Math.max(1,t.maxEntityCount??1e3),allowedTags:t.allowedTags??null,tagFilter:t.tagFilter??null,appliesTo:t.appliesTo??"all"}:Ar(true)}var Pr=function(t){let e=Object.assign({},Wi,t),n=[{value:e.attributeNamePrefix,name:"attributeNamePrefix"},{value:e.attributesGroupName,name:"attributesGroupName"},{value:e.textNodeName,name:"textNodeName"},{value:e.cdataPropName,name:"cdataPropName"},{value:e.commentPropName,name:"commentPropName"}];for(let{value:s,name:r}of n)s&&zi(s,r);return e.onDangerousProperty===null&&(e.onDangerousProperty=Cr),e.processEntities=Ar(e.processEntities,e.htmlEntities),e.unpairedTagsSet=new Set(e.unpairedTags),e.stopNodes&&Array.isArray(e.stopNodes)&&(e.stopNodes=e.stopNodes.map(s=>typeof s=="string"&&s.startsWith("*.")?".."+s.substring(2):s)),e};var Rn;typeof Symbol!="function"?Rn="@@xmlMetadata":Rn=Symbol("XML Node Metadata");var ee=class{constructor(e){this.tagname=e,this.child=[],this[":@"]=Object.create(null);}add(e,n){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:n});}addChild(e,n){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child}),n!==void 0&&(this.child[this.child.length-1][Rn]={startIndex:n});}static getMetaDataSymbol(){return Rn}};var Mr=":A-Za-z_\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u0486\u0488-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD",Ji=Mr+"\\-\\.\\d\xB7\u0300-\u036F\u203F-\u2040",$r=":A-Za-z_\xC0-\u02FF\u0370-\u037D\u037F-\u0486\u0488-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}",Ki=$r+"\\-\\.\\d\xB7\u0300-\u036F\u0487\u203F-\u2040",Lr=(t,e,n="")=>{let s=t.replace(":",""),r=e.replace(":",""),o=`[${s}][${r}]*`;return {name:new RegExp(`^[${t}][${e}]*$`,n),ncName:new RegExp(`^${o}$`,n),qName:new RegExp(`^${o}(?::${o})?$`,n),nmToken:new RegExp(`^[${e}]+$`,n),nmTokens:new RegExp(`^[${e}]+(?:\\s+[${e}]+)*$`,n)}},Xi=Lr(Mr,Ji),Yi=Lr($r,Ki,"u"),Qi=(t="1.0")=>t==="1.1"?Yi:Xi;var fs=(t,{xmlVersion:e="1.0"}={})=>Qi(e).qName.test(t);var on=class{constructor(e,n){this.suppressValidationErr=!e,this.options=e,this.xmlVersion=n||1;}setXmlVersion(e=1){this.xmlVersion=e;}readDocType(e,n){let s=Object.create(null),r=0;if(e[n+3]==="O"&&e[n+4]==="C"&&e[n+5]==="T"&&e[n+6]==="Y"&&e[n+7]==="P"&&e[n+8]==="E"){n=n+9;let o=1,a=false,i=false,c="";for(;n<e.length;n++)if(e[n]==="<"&&!i){if(a&&ut(e,"!ENTITY",n)){n+=7;let l,u;if([l,u,n]=this.readEntityExp(e,n+1,this.suppressValidationErr),u.indexOf("&")===-1){if(this.options.enabled!==false&&this.options.maxEntityCount!=null&&r>=this.options.maxEntityCount)throw new Error(`Entity count (${r+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);s[l]=u,r++;}}else if(a&&ut(e,"!ELEMENT",n)){n+=8;let{index:l}=this.readElementExp(e,n+1);n=l;}else if(a&&ut(e,"!ATTLIST",n))n+=8;else if(a&&ut(e,"!NOTATION",n)){n+=9;let{index:l}=this.readNotationExp(e,n+1,this.suppressValidationErr);n=l;}else if(ut(e,"!--",n))i=true;else throw new Error("Invalid DOCTYPE");o++,c="";}else if(e[n]===">"){if(i?e[n-1]==="-"&&e[n-2]==="-"&&(i=false,o--):o--,o===0)break}else e[n]==="["?a=true:c+=e[n];if(o!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return {entities:s,i:n}}readEntityExp(e,n){n=te(e,n);let s=n;for(;n<e.length&&!/\s/.test(e[n])&&e[n]!=='"'&&e[n]!=="'";)n++;let r=e.substring(s,n);if(rn(r,{xmlVersion:this.xmlVersion}),n=te(e,n),!this.suppressValidationErr){if(e.substring(n,n+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(e[n]==="%")throw new Error("Parameter entities are not supported")}let o="";if([n,o]=this.readIdentifierVal(e,n,"entity"),this.options.enabled!==false&&this.options.maxEntitySize!=null&&o.length>this.options.maxEntitySize)throw new Error(`Entity "${r}" size (${o.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return n--,[r,o,n]}readNotationExp(e,n){n=te(e,n);let s=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;let r=e.substring(s,n);!this.suppressValidationErr&&rn(r,{xmlVersion:this.xmlVersion}),n=te(e,n);let o=e.substring(n,n+6).toUpperCase();if(!this.suppressValidationErr&&o!=="SYSTEM"&&o!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${o}"`);n+=o.length,n=te(e,n);let a=null,i=null;if(o==="PUBLIC")[n,a]=this.readIdentifierVal(e,n,"publicIdentifier"),n=te(e,n),(e[n]==='"'||e[n]==="'")&&([n,i]=this.readIdentifierVal(e,n,"systemIdentifier"));else if(o==="SYSTEM"&&([n,i]=this.readIdentifierVal(e,n,"systemIdentifier"),!this.suppressValidationErr&&!i))throw new Error("Missing mandatory system identifier for SYSTEM notation");return {notationName:r,publicIdentifier:a,systemIdentifier:i,index:--n}}readIdentifierVal(e,n,s){let r="",o=e[n];if(o!=='"'&&o!=="'")throw new Error(`Expected quoted string, found "${o}"`);n++;let a=n;for(;n<e.length&&e[n]!==o;)n++;if(r=e.substring(a,n),e[n]!==o)throw new Error(`Unterminated ${s} value`);return n++,[n,r]}readElementExp(e,n){n=te(e,n);let s=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;let r=e.substring(s,n);if(!this.suppressValidationErr&&!fs(r,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid element name: "${r}"`);n=te(e,n);let o="";if(e[n]==="E"&&ut(e,"MPTY",n))n+=4;else if(e[n]==="A"&&ut(e,"NY",n))n+=2;else if(e[n]==="("){n++;let a=n;for(;n<e.length&&e[n]!==")";)n++;if(o=e.substring(a,n),e[n]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${e[n]}"`);return {elementName:r,contentModel:o.trim(),index:n}}readAttlistExp(e,n){n=te(e,n);let s=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;let r=e.substring(s,n);for(rn(r,{xmlVersion:this.xmlVersion}),n=te(e,n),s=n;n<e.length&&!/\s/.test(e[n]);)n++;let o=e.substring(s,n);if(!rn(o,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid attribute name: "${o}"`);n=te(e,n);let a="";if(e.substring(n,n+8).toUpperCase()==="NOTATION"){if(a="NOTATION",n+=8,n=te(e,n),e[n]!=="(")throw new Error(`Expected '(', found "${e[n]}"`);n++;let c=[];for(;n<e.length&&e[n]!==")";){let l=n;for(;n<e.length&&e[n]!=="|"&&e[n]!==")";)n++;let u=e.substring(l,n);if(u=u.trim(),!rn(u,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid notation name: "${u}"`);c.push(u),e[n]==="|"&&(n++,n=te(e,n));}if(e[n]!==")")throw new Error("Unterminated list of notations");n++,a+=" ("+c.join("|")+")";}else {let c=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;a+=e.substring(c,n);let l=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!l.includes(a.toUpperCase()))throw new Error(`Invalid attribute type: "${a}"`)}n=te(e,n);let i="";return e.substring(n,n+8).toUpperCase()==="#REQUIRED"?(i="#REQUIRED",n+=8):e.substring(n,n+7).toUpperCase()==="#IMPLIED"?(i="#IMPLIED",n+=7):[n,i]=this.readIdentifierVal(e,n,"ATTLIST"),{elementName:r,attributeName:o,attributeType:a,defaultValue:i,index:n}}},te=(t,e)=>{for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function ut(t,e,n){for(let s=0;s<e.length;s++)if(e[s]!==t[n+s+1])return false;return true}function rn(t,e){if(fs(t,{xmlVersion:e}))return t;throw new Error(`Invalid entity name ${t}`)}var Zi=[48,1632,1776,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,65296,120782,120792,120802,120812,120822,66720,68912,69734,69872,69942,70096,70384,70736,70864,71248,71360,71472,71904,72016,72688,72784,73040,73120,73552,92768,92864,93008,123200,123632,124144,125264,130032],In=255,_n=new Map,Nr=65535,Rr=1632,Ft=Rr,ea=Nr-Rr+1,Fn=new Uint8Array(ea).fill(In);for(let t of Zi)for(let e=0;e<10;e++){let n=t+e;n<=Nr?Fn[n-Ft]=e:_n.set(n,e);}var Ir=48,_r=57,Fr=45,On=new Set([8722,65293,65123]);function ta(t){if(typeof t!="string")return t;let e=t.length;if(e===0)return t;let n=-1;for(let r=0;r<e;r++){let o=t.charCodeAt(r);if(!(o>=Ir&&o<=_r||o===Fr)){if(o<Ft){if(On.has(o)){n=r;break}continue}if(o>=55296&&o<=56319){if(r+1<e){let a=t.charCodeAt(r+1);if(a>=56320&&a<=57343){let i=65536+(o-55296<<10)+(a-56320);if(_n.has(i)){n=r;break}}}continue}if(Fn[o-Ft]!==In||On.has(o)){n=r;break}}}if(n===-1)return t;let s=[];n>0&&s.push(t.slice(0,n));for(let r=n;r<e;r++){let o=t.charCodeAt(r);if(o>=Ir&&o<=_r||o===Fr){s.push(t[r]);continue}if(o<Ft){s.push(On.has(o)?"-":t[r]);continue}if(o>=55296&&o<=56319){if(r+1<e){let i=t.charCodeAt(r+1);if(i>=56320&&i<=57343){let c=65536+(o-55296<<10)+(i-56320),l=_n.get(c);if(l!==void 0){s.push(String.fromCharCode(l+48)),r++;continue}}}s.push(t[r]);continue}if(On.has(o)){s.push("-");continue}let a=Fn[o-Ft];s.push(a!==In?String.fromCharCode(a+48):t[r]);}return s.join("")}var Or=ta;var na=/^[-+]?0x[a-fA-F0-9]+$/,sa=/^0b[01]+$/,ra=/^0o[0-7]+$/,oa=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,ia={hex:true,binary:false,octal:false,leadingZeros:true,decimalPoint:".",eNotation:true,infinity:"original",unicode:false};function hs(t,e={}){if(e=Object.assign({},ia,e),!t||typeof t!="string")return t;let n=t.trim();if(n.length===0)return t;if(e.skipLike!==void 0&&e.skipLike.test(n))return t;if(n==="0"||e.unicode&&(n=Or(n),n==="0"))return 0;if(e.hex&&na.test(n))return ms(n,16);if(e.binary&&sa.test(n))return ms(n,2);if(e.octal&&ra.test(n))return ms(n,8);if(isFinite(n)){if(n.includes("e")||n.includes("E"))return ca(t,n,e);{let s=oa.exec(n);if(s){let r=s[1]||"",o=s[2],a=la(s[3]),i=r?t[o.length+1]===".":t[o.length]===".";if(!e.leadingZeros&&(o.length>1||o.length===1&&!i))return t;{let c=Number(n),l=String(c);if(c===0)return c;if(l.search(/[eE]/)!==-1)return e.eNotation?c:t;if(n.indexOf(".")!==-1)return l==="0"||l===a||l===`${r}${a}`?c:t;let u=o?a:n;return o?u===l||r+u===l?c:t:u===l||u===r+l?c:t}}else return t}}else return ua(t,Number(n),e)}var aa=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function ca(t,e,n){if(!n.eNotation)return t;let s=e.match(aa);if(s){let r=s[1]||"",o=s[3].indexOf("e")===-1?"E":"e",a=s[2],i=r?t[a.length+1]===o:t[a.length]===o;return a.length>1&&i?t:a.length===1&&(s[3].startsWith(`.${o}`)||s[3][0]===o)?Number(e):a.length>0?n.leadingZeros&&!i?(e=(s[1]||"")+s[3],Number(e)):t:Number(e)}else return t}function la(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substring(0,t.length-1))),t}function ms(t,e){let n=t.trim();if((e===2||e===8)&&(t=n.substring(2)),parseInt)return parseInt(t,e);if(Number.parseInt)return Number.parseInt(t,e);if(window&&window.parseInt)return window.parseInt(t,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function ua(t,e,n){let s=e===1/0;switch(n.infinity.toLowerCase()){case "null":return null;case "infinity":return e;case "string":return s?"Infinity":"-Infinity";default:return t}}function gs(t){return typeof t=="function"?t:Array.isArray(t)?e=>{for(let n of t)if(typeof n=="string"&&e===n||n instanceof RegExp&&n.test(e))return true}:()=>false}var pt=class{constructor(e,n={},s){this.pattern=e,this.separator=n.separator||".",this.segments=this._parse(e),this.data=s,this._hasDeepWildcard=this.segments.some(r=>r.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(r=>r.attrName!==void 0),this._hasPositionSelector=this.segments.some(r=>r.position!==void 0);}_parse(e){let n=[],s=0,r="";for(;s<e.length;)e[s]===this.separator?s+1<e.length&&e[s+1]===this.separator?(r.trim()&&(n.push(this._parseSegment(r.trim())),r=""),n.push({type:"deep-wildcard"}),s+=2):(r.trim()&&n.push(this._parseSegment(r.trim())),r="",s++):(r+=e[s],s++);return r.trim()&&n.push(this._parseSegment(r.trim())),n}_parseSegment(e){let n={type:"tag"},s=null,r=e,o=e.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(o&&(r=o[1]+o[3],o[2])){let u=o[2].slice(1,-1);u&&(s=u);}let a,i=r;if(r.includes("::")){let u=r.indexOf("::");if(a=r.substring(0,u).trim(),i=r.substring(u+2).trim(),!a)throw new Error(`Invalid namespace in pattern: ${e}`)}let c,l=null;if(i.includes(":")){let u=i.lastIndexOf(":"),p=i.substring(0,u).trim(),d=i.substring(u+1).trim();["first","last","odd","even"].includes(d)||/^nth\(\d+\)$/.test(d)?(c=p,l=d):c=i;}else c=i;if(!c)throw new Error(`Invalid segment pattern: ${e}`);if(n.tag=c,a&&(n.namespace=a),s)if(s.includes("=")){let u=s.indexOf("=");n.attrName=s.substring(0,u).trim(),n.attrValue=s.substring(u+1).trim();}else n.attrName=s.trim();if(l){let u=l.match(/^nth\((\d+)\)$/);u?(n.position="nth",n.positionValue=parseInt(u[1],10)):n.position=l;}return n}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}};var Ot=class{constructor(){this._byDepthAndTag=new Map,this._wildcardByDepth=new Map,this._deepWildcards=[],this._deepByTerminalTag=new Map,this._patterns=new Set,this._sealed=false;}add(e){if(this._sealed)throw new TypeError("ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.");if(this._patterns.has(e.pattern))return this;if(this._patterns.add(e.pattern),e.hasDeepWildcard()){let o=e.segments[e.segments.length-1];if(o&&o.type!=="deep-wildcard"&&o.tag!=="*"){let a=o.tag;this._deepByTerminalTag.has(a)||this._deepByTerminalTag.set(a,[]),this._deepByTerminalTag.get(a).push(e);}else this._deepWildcards.push(e);return this}let n=e.length,r=e.segments[e.segments.length-1]?.tag;if(!r||r==="*")this._wildcardByDepth.has(n)||this._wildcardByDepth.set(n,[]),this._wildcardByDepth.get(n).push(e);else {let o=`${n}:${r}`;this._byDepthAndTag.has(o)||this._byDepthAndTag.set(o,[]),this._byDepthAndTag.get(o).push(e);}return this}addAll(e){for(let n of e)this.add(n);return this}has(e){return this._patterns.has(e.pattern)}get size(){return this._patterns.size}seal(){return this._sealed=true,this}get isSealed(){return this._sealed}matchesAny(e){return this.findMatch(e)!==null}findMatch(e){let n=e.getDepth(),s=e.getCurrentTag(),r=`${n}:${s}`,o=this._byDepthAndTag.get(r);if(o){for(let c=0;c<o.length;c++)if(e.matches(o[c]))return o[c]}let a=this._wildcardByDepth.get(n);if(a){for(let c=0;c<a.length;c++)if(e.matches(a[c]))return a[c]}let i=this._deepByTerminalTag.get(s);if(i){for(let c=0;c<i.length;c++)if(e.matches(i[c]))return i[c]}for(let c=0;c<this._deepWildcards.length;c++)if(e.matches(this._deepWildcards[c]))return this._deepWildcards[c];return null}};var ys=class{constructor(e){this._matcher=e;}get separator(){return this._matcher.separator}getCurrentTag(){let e=this._matcher.path;return e.length>0?e[e.length-1].tag:void 0}getCurrentNamespace(){let e=this._matcher.path;return e.length>0?e[e.length-1].namespace:void 0}getAttrValue(e){let n=this._matcher.path;if(n.length!==0)return n[n.length-1].values?.[e]}hasAttr(e){let n=this._matcher.path;if(n.length===0)return false;let s=n[n.length-1];return s.values!==void 0&&e in s.values}getAnyParentAttr(e){return this._matcher.getAnyParentAttr(e)}hasAnyParentAttr(e){return this._matcher.hasAnyParentAttr(e)}getPosition(){let e=this._matcher.path;return e.length===0?-1:e[e.length-1].position??0}getCounter(){let e=this._matcher.path;return e.length===0?-1:e[e.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(e,n=true){return this._matcher.toString(e,n)}toArray(){return this._matcher.path.map(e=>e.tag)}matches(e){return this._matcher.matches(e)}matchesAny(e){return e.matchesAny(this._matcher)}},Bt=class{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new ys(this),this._keptAttrs=[];}push(e,n=null,s=null,r=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);let o=this.path.length;this.siblingStacks[o]||(this.siblingStacks[o]=new Map);let a=this.siblingStacks[o],i=s?`${s}:${e}`:e,c=a.get(i)||0,l=0;for(let f of a.values())l+=f;a.set(i,c+1);let u={tag:e,position:l,counter:c};s!=null&&(u.namespace=s),n!=null&&(u.values=n),this.path.push(u);let p=this.path.length,d=r!==null?r.keep:null;if(d!=null&&d.length>0&&n)for(let f=0;f<d.length;f++){let h=d[f];n[h]!==void 0&&this._keptAttrs.push({depth:p,name:h,value:n[h]});}}pop(){if(this.path.length===0)return;this._pathStringCache=null;let e=this.path.pop();this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1);let n=this.path.length+1;for(;this._keptAttrs.length>0&&this._keptAttrs[this._keptAttrs.length-1].depth>=n;)this._keptAttrs.pop();return e}updateCurrent(e){if(this.path.length>0){let n=this.path[this.path.length-1];e!=null&&(n.values=e);}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(e){if(this.path.length!==0)return this.path[this.path.length-1].values?.[e]}hasAttr(e){if(this.path.length===0)return false;let n=this.path[this.path.length-1];return n.values!==void 0&&e in n.values}getAnyParentAttr(e){let n=this._keptAttrs;for(let s=n.length-1;s>=0;s--)if(n[s].name===e)return n[s].value}hasAnyParentAttr(e){let n=this._keptAttrs;for(let s=n.length-1;s>=0;s--)if(n[s].name===e)return true;return false}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(e,n=true){let s=e||this.separator;if(s===this.separator&&n===true){if(this._pathStringCache!==null)return this._pathStringCache;let o=this.path.map(a=>a.namespace?`${a.namespace}:${a.tag}`:a.tag).join(s);return this._pathStringCache=o,o}return this.path.map(o=>n&&o.namespace?`${o.namespace}:${o.tag}`:o.tag).join(s)}toArray(){return this.path.map(e=>e.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[],this._keptAttrs=[];}matches(e){let n=e.segments;return n.length===0?false:e.hasDeepWildcard()?this._matchWithDeepWildcard(n):this._matchSimple(n)}_matchSimple(e){if(this.path.length!==e.length)return false;for(let n=0;n<e.length;n++)if(!this._matchSegment(e[n],this.path[n],n===this.path.length-1))return false;return true}_matchWithDeepWildcard(e){let n=this.path.length-1,s=e.length-1;for(;s>=0&&n>=0;){let r=e[s];if(r.type==="deep-wildcard"){if(s--,s<0)return true;let o=e[s],a=false;for(let i=n;i>=0;i--)if(this._matchSegment(o,this.path[i],i===this.path.length-1)){n=i-1,s--,a=true;break}if(!a)return false}else {if(!this._matchSegment(r,this.path[n],n===this.path.length-1))return false;n--,s--;}}return s<0}_matchSegment(e,n,s){if(e.tag!=="*"&&e.tag!==n.tag||e.namespace!==void 0&&e.namespace!=="*"&&e.namespace!==n.namespace||e.attrName!==void 0&&(!s||!n.values||!(e.attrName in n.values)||e.attrValue!==void 0&&String(n.values[e.attrName])!==String(e.attrValue)))return false;if(e.position!==void 0){if(!s)return false;let r=n.counter??0;if(e.position==="first"&&r!==0)return false;if(e.position==="odd"&&r%2!==1)return false;if(e.position==="even"&&r%2!==0)return false;if(e.position==="nth"&&r!==e.positionValue)return false}return true}matchesAny(e){return e.matchesAny(this)}snapshot(){return {path:this.path.map(e=>({...e})),siblingStacks:this.siblingStacks.map(e=>new Map(e)),keptAttrs:this._keptAttrs.map(e=>({...e}))}}restore(e){this._pathStringCache=null,this.path=e.path.map(n=>({...n})),this.siblingStacks=e.siblingStacks.map(n=>new Map(n)),this._keptAttrs=(e.keptAttrs||[]).map(n=>({...n}));}readOnly(){return this._view}};var pa=[{id:"html-script-open",description:"<script opening tag",pattern:/<script[\s>/]/i},{id:"html-script-close",description:"</script closing tag",pattern:/<\/script[\s>]/i},{id:"html-javascript-protocol",description:"javascript: URI scheme (with optional whitespace/encoding)",pattern:/j[\t\n\r ]*a[\t\n\r ]*v[\t\n\r ]*a[\t\n\r ]*s[\t\n\r ]*c[\t\n\r ]*r[\t\n\r ]*i[\t\n\r ]*p[\t\n\r ]*t[\t\n\r ]*:/i},{id:"html-vbscript-protocol",description:"vbscript: URI scheme",pattern:/vbscript[\t\n\r ]*:/i},{id:"html-data-html",description:"data:text/html URI \u2014 can execute scripts in browsers",pattern:/data[\t\n\r ]*:[\t\n\r ]*text\/html/i},{id:"html-data-xhtml",description:"data:application/xhtml+xml URI",pattern:/data[\t\n\r ]*:[\t\n\r ]*application\/xhtml/i},{id:"html-data-svg",description:"data:image/svg+xml URI \u2014 can execute scripts",pattern:/data[\t\n\r ]*:[\t\n\r ]*image\/svg\+xml/i},{id:"html-inline-event-handler",description:"Inline event handler attributes: onclick=, onerror=, onload=, etc.",pattern:/\bon\w{1,30}\s*=/i},{id:"html-entity-obfuscated-script",description:"HTML-entity-encoded <script (e.g. &#x3C;script or &lt;script)",pattern:/(?:&#x0*3[Cc];?|&#0*60;?|&lt;)\s*script/i},{id:"html-entity-obfuscated-javascript",description:'HTML-entity-encoded javascript: (partial \u2014 catches common &#106; or &#x6a; for "j")',pattern:/(?:&#x0*6[Aa];?|&#0*106;?)\s*(?:&#x0*61;?|a)[\s\S]{0,80}script\s*:/i},{id:"html-style-expression",description:"CSS expression() \u2014 IE-era code execution in style attributes",pattern:/style[\s\S]{0,20}expression\s*\(/i},{id:"html-object-embed",description:"<object or <embed tags that can load active content",pattern:/<(?:object|embed)[\s>/]/i},{id:"html-base-tag",description:"<base href= \u2014 can hijack all relative URLs on a page",pattern:/<base[\s>]/i},{id:"html-meta-refresh",description:'<meta http-equiv="refresh" \u2014 can redirect users',pattern:/<meta[\s\S]{0,40}http-equiv[\s\S]{0,20}refresh/i},{id:"html-srcdoc",description:"srcdoc= attribute on iframes \u2014 embeds HTML that can run scripts",pattern:/srcdoc\s*=/i},{id:"html-iframe",description:"<iframe tag",pattern:/<iframe[\s>/]/i},{id:"html-form",description:"<form tag \u2014 can be used for phishing / credential harvesting injection",pattern:/<form[\s>/]/i}],Br=pa;var da=[{id:"xml-cdata-injection",description:"CDATA section injection: <![CDATA[ breaks out of text node context",pattern:/<!\[CDATA\[/i},{id:"xml-cdata-close",description:"CDATA close sequence: ]]> can terminate an enclosing CDATA section",pattern:/\]\]>/},{id:"xml-processing-instruction",description:"XML processing instruction: <?xml-stylesheet or <?php etc.",pattern:/<\?(?:xml[\- ]|php|asp)/i},{id:"xml-doctype-injection",description:"DOCTYPE declaration embedded in content \u2014 can define entities",pattern:/<!DOCTYPE(?:[\s[]|$)/i},{id:"xml-entity-system",description:"SYSTEM keyword \u2014 used in external entity declarations (XXE)",pattern:/\bSYSTEM\s+["']/i},{id:"xml-entity-public",description:"PUBLIC keyword \u2014 used in external entity declarations (XXE)",pattern:/\bPUBLIC\s+["']/i},{id:"xml-entity-declaration",description:"<!ENTITY declaration \u2014 defines entities, potential XXE or entity expansion",pattern:/<!ENTITY[\s%]/i},{id:"xml-billion-laughs",description:"Entity reference chaining / billion laughs: repeated &eX; style references",pattern:/(?:&\w{1,20};){3,}/},{id:"xml-namespace-confusion",description:"xmlns: attribute injection \u2014 can redefine namespaces to confuse parsers",pattern:/\bxmlns\s*(?::\w{1,40})?\s*=/i},{id:"xml-comment-injection",description:"<!-- comment injection \u2014 can hide content from some parsers",pattern:/<!--/},{id:"xml-comment-close",description:"--> closes an enclosing XML comment",pattern:/-->/},{id:"xml-pi-close",description:"?> closes an enclosing processing instruction",pattern:/\?>/}],Vr=da;var fa=[{id:"svg-script-element",description:"<script element inside SVG executes JavaScript",pattern:/<script[\s>/]/i},{id:"svg-xlink-href-javascript",description:"xlink:href with javascript: \u2014 classic SVG XSS via <a> or <use>",pattern:/xlink\s*:\s*href\s*=\s*["']?\s*javascript\s*:/i},{id:"svg-href-javascript",description:"href= with javascript: in SVG context (<a>, <animate>, etc.)",pattern:/href\s*=\s*["']?\s*javascript\s*:/i},{id:"svg-foreignobject",description:"<foreignObject embeds HTML inside SVG \u2014 can execute scripts",pattern:/<foreignObject[\s>/]/i},{id:"svg-use-external",description:"<use xlink:href or href pointing to external resource (non-fragment URL)",pattern:/<use[\s\S]{0,60}(?:xlink\s*:\s*)?href\s*=\s*(?:["'][^#]|[^"'#\s>])/i},{id:"svg-animate-href",description:'<animate attributeName="href" \u2014 can dynamically change href to javascript:',pattern:/<animate[\s\S]{0,80}attributeName\s*=\s*["'][\s]*href["']/i},{id:"svg-animate-xlinkhref",description:'<animate attributeName="xlink:href"',pattern:/<animate[\s\S]{0,80}attributeName\s*=\s*["'][\s]*xlink\s*:\s*href["']/i},{id:"svg-set-javascript",description:'<set to="javascript:..." \u2014 sets an attribute to a javascript: URI',pattern:/<set[\s\S]{0,80}to\s*=\s*["']?\s*javascript\s*:/i},{id:"svg-event-handler",description:"SVG-specific event handler attributes: onload=, onerror=, onactivate=, etc.",pattern:/\bon(?:load|error|activate|begin|end|repeat|focus|blur|click|mouse\w{1,20}|key\w{1,20})\s*=/i},{id:"svg-handler-generic",description:"Generic on* handler catch-all for SVG attributes",pattern:/\bon\w{1,30}\s*=/i},{id:"svg-filter-feimage",description:"<feImage href= \u2014 filter primitive that can load external resources",pattern:/<feImage[\s\S]{0,80}(?:xlink\s*:\s*)?href\s*=/i},{id:"svg-image-external",description:"<image xlink:href with http/https or javascript protocol",pattern:/<image[\s\S]{0,80}(?:xlink\s*:\s*)?href\s*=\s*["']?\s*(?:https?|javascript)\s*:/i},{id:"svg-style-javascript",description:"style= attribute containing javascript: (e.g. background:url(javascript:...))",pattern:/style\s*=[\s\S]{0,60}javascript\s*:/i}],Dr=fa;var ma=[{id:"sql-block-comment-open",description:"SQL block comment open: /* ... */ \u2014 unusual in legitimate user text",pattern:/\/\*/},{id:"sql-union-select",description:"UNION SELECT \u2014 most common SQL injection aggregation attack",pattern:/\bUNION\s{1,20}(?:ALL\s{1,20})?SELECT\b/i},{id:"sql-drop-table",description:"DROP TABLE \u2014 destructive DDL injection",pattern:/\bDROP\s{1,20}TABLE\b/i},{id:"sql-drop-database",description:"DROP DATABASE \u2014 destructive DDL injection",pattern:/\bDROP\s{1,20}DATABASE\b/i},{id:"sql-insert-into",description:"INSERT INTO \u2014 data injection",pattern:/\bINSERT\s{1,20}INTO\b/i},{id:"sql-delete-from",description:"DELETE FROM \u2014 data deletion injection",pattern:/\bDELETE\s{1,20}FROM\b/i},{id:"sql-update-set",description:"UPDATE ... SET \u2014 data modification injection",pattern:/\bUPDATE\b[\s\S]{1,60}\bSET\b/i},{id:"sql-exec-xp",description:"EXEC xp_ \u2014 MSSQL extended stored procedure execution",pattern:/\bEXEC(?:UTE)?\s{1,20}xp_/i},{id:"sql-tautology-string",description:`Classic string tautology: ' OR '1'='1 or " OR "1"="1"`,pattern:/'\s{0,10}OR\s{0,10}'[^']{0,20}'\s*=\s*'[^']{0,20}/i},{id:"sql-tautology-numeric",description:"Numeric tautology: OR 1=1",pattern:/\bOR\s{1,10}1\s*=\s*1\b/i},{id:"sql-always-true-zero",description:"Numeric tautology: OR 0=0",pattern:/\bOR\s{1,10}0\s*=\s*0\b/i},{id:"sql-sleep-benchmark",description:"Time-based blind injection: SLEEP() or BENCHMARK()",pattern:/\b(?:SLEEP|BENCHMARK)\s*\(/i},{id:"sql-waitfor-delay",description:"MSSQL time-based blind injection: WAITFOR DELAY",pattern:/\bWAITFOR\s{1,20}DELAY\b/i},{id:"sql-char-function",description:"CHAR() function \u2014 used to obfuscate injected strings",pattern:/\bCHAR\s*\(\s*\d{1,3}/i},{id:"sql-information-schema",description:"INFORMATION_SCHEMA \u2014 reconnaissance query for table/column enumeration",pattern:/\bINFORMATION_SCHEMA\b/i}],Bn=ma;var ha=[{id:"sql-line-comment",description:"SQL line comment: -- followed by whitespace or end of string",pattern:/--(?:\s|$)/},{id:"sql-stacked-query",description:"Stacked queries: semicolon immediately followed by a SQL keyword",pattern:/;\s{0,10}(?:SELECT|INSERT|UPDATE|DELETE|DROP|CREATE|ALTER|EXEC)\b/i},{id:"sql-hex-encoding",description:"Hex-encoded string injection: 0x41414141 style (MySQL)",pattern:/\b0x[0-9a-f]{4,}/i}],ga=[...Bn,...ha],Ur=ga;var ya=[{id:"shell-path-traversal-unix",description:"Unix path traversal: ../ \u2014 climbing the directory tree",pattern:/\.\.\//},{id:"shell-path-traversal-windows",description:"Windows path traversal: ..\\ \u2014 climbing the directory tree",pattern:/\.\.\\/},{id:"shell-path-traversal-encoded",description:"URL-encoded path traversal: %2e%2e or %2f variants",pattern:/%2e%2e|%2f\.\.|\.\.%2f/i},{id:"shell-null-byte",description:"Null byte injection: \\x00 or %00 \u2014 truncates strings in C-backed functions",pattern:/\x00|%00/},{id:"shell-semicolon",description:"Semicolon command separator: cmd1; cmd2",pattern:/;/},{id:"shell-pipe",description:"Pipe operator: cmd1 | cmd2",pattern:/\|/},{id:"shell-and-operator",description:"AND operator: cmd1 && cmd2",pattern:/&&/},{id:"shell-or-operator",description:"OR operator: cmd1 || cmd2",pattern:/\|\|/},{id:"shell-backtick",description:"Backtick command substitution: `cmd`",pattern:/`/},{id:"shell-dollar-paren",description:"Dollar-paren command substitution: $(cmd)",pattern:/\$\(/},{id:"shell-dollar-brace",description:"Dollar-brace variable expansion: ${var} \u2014 can be abused for injection",pattern:/\$\{/},{id:"shell-redirect-out",description:"Output redirection: cmd > file or cmd >> file",pattern:/>{1,2}/},{id:"shell-redirect-in",description:"Input redirection: cmd < file",pattern:/</},{id:"shell-newline-injection",description:"Newline injection: \\n or \\r \u2014 can inject new shell commands",pattern:/[\n\r]/},{id:"shell-glob-star",description:"Glob expansion: * or ? \u2014 can expand to unintended files",pattern:/[/\\][*?]/},{id:"shell-absolute-root",description:"Absolute root path injection: string starting with / or \\ (Windows UNC)",pattern:/^(?:\/|\\\\)/},{id:"shell-windows-drive",description:"Windows drive letter path injection: C:\\ or D:/",pattern:/^[a-zA-Z]:[/\\]/},{id:"shell-curl-wget",description:"curl/wget with URL or flags \u2014 can exfiltrate data or download payloads",pattern:/\b(?:curl|wget)\s+(?:https?:\/\/|ftp:\/\/|-)/i}],Gr=ya;var va=[{id:"redos-nested-quantifier-plus",description:"Nested + quantifier inside a group with outer quantifier: (a+)+, (.+b)*, etc.",pattern:/\([^)]*\+[^)]*\)[+*]/},{id:"redos-nested-quantifier-star",description:"Nested * quantifier: (a*)* or (a*)+ \u2014 catastrophic backtracking",pattern:/\([^)]*\*[^)]*\)[*+]/},{id:"redos-nested-groups",description:"Doubly nested quantified groups: ((a+)+) \u2014 guaranteed catastrophic",pattern:/\(\([^)]{0,40}\)[+*]\)[+*]/},{id:"redos-alternation-overlap",description:"Overlapping alternation under quantifier: (a|a)+ \u2014 ambiguous NFA paths",pattern:/\(([^|()]{1,20})\|(?:\1)(?:\|[^|()]{1,20}){0,5}\)[+*?]{1,2}/},{id:"redos-star-plus-concat",description:"(x*x)+ pattern \u2014 triggers super-linear backtracking",pattern:/\([^)]{0,10}\*[^)]{0,10}\)[+*]/},{id:"redos-dot-star-greedy",description:"(.*){n,} or (.+){n,} \u2014 repeated greedy dot quantifiers",pattern:/\(\.[*+]\)\{?\d/},{id:"redos-large-repetition",description:"Very large fixed or range repetition count {1000,} or {1000,n} \u2014 denial of service via backtracking",pattern:/\{\d{4,}(?:,\d*)?\}/},{id:"redos-catastrophic-alternation",description:"Long alternation with many similar branches \u2014 polynomial backtracking risk",pattern:/\([^)]{0,200}(?:\|[^|)]{0,50}){9,}\)/}],qr=va;var oe=`["'\\s]*:`,ba=[{id:"nosql-where-operator",description:"$where \u2014 executes arbitrary JavaScript server-side in MongoDB",pattern:new RegExp(`\\$where${oe}`,"i")},{id:"nosql-ne-operator",description:'$ne \u2014 "not equal" operator used to bypass equality checks',pattern:new RegExp(`\\$ne${oe}`,"i")},{id:"nosql-gt-operator",description:'$gt \u2014 "greater than" used to bypass password/value checks',pattern:new RegExp(`\\$gte?${oe}`,"i")},{id:"nosql-lt-operator",description:'$lt / $lte \u2014 "less than" bypass variants',pattern:new RegExp(`\\$lte?${oe}`,"i")},{id:"nosql-regex-operator",description:"$regex \u2014 can be used to extract data character by character (blind injection)",pattern:new RegExp(`\\$regex${oe}`,"i")},{id:"nosql-or-operator",description:"$or \u2014 logical OR; used to create always-true conditions",pattern:new RegExp(`\\$or${oe}\\s*\\[`,"i")},{id:"nosql-and-operator",description:"$and \u2014 logical AND operator injection",pattern:new RegExp(`\\$and${oe}\\s*\\[`,"i")},{id:"nosql-nor-operator",description:"$nor \u2014 logical NOR operator injection",pattern:new RegExp(`\\$nor${oe}\\s*\\[`,"i")},{id:"nosql-exists-operator",description:"$exists \u2014 can enumerate fields to determine schema",pattern:new RegExp(`\\$exists${oe}`,"i")},{id:"nosql-in-operator",description:"$in \u2014 matches any value in a list; can enumerate values",pattern:new RegExp(`\\$in${oe}\\s*\\[`,"i")},{id:"nosql-expr-operator",description:"$expr \u2014 allows aggregation expressions in queries (MongoDB 3.6+)",pattern:new RegExp(`\\$expr${oe}`,"i")},{id:"nosql-function-operator",description:"$function \u2014 executes arbitrary JavaScript in MongoDB 4.4+",pattern:new RegExp(`\\$function${oe}`,"i")},{id:"nosql-accumulator-operator",description:"$accumulator \u2014 custom aggregation with arbitrary JS execution",pattern:new RegExp(`\\$accumulator${oe}`,"i")},{id:"nosql-proto-pollution",description:"__proto__ \u2014 prototype pollution via object key injection",pattern:/__proto__/},{id:"nosql-constructor-prototype",description:"constructor.prototype \u2014 alternative prototype pollution vector (dot notation or JSON key)",pattern:/constructor[\s"':.,{\[]*prototype/i},{id:"nosql-proto-bracket",description:'["__proto__"] \u2014 bracket-notation prototype pollution',pattern:/\[["']__proto__["']\]/}],Hr=ba;var wa=[{id:"log-crlf-injection",description:"CRLF injection: literal \\r or \\n embeds fake log lines",pattern:/[\r\n]/},{id:"log-url-encoded-crlf",description:"URL-encoded CRLF: %0d, %0a, %0D, %0A \u2014 decoded by some log parsers",pattern:/%0[dDaA]/},{id:"log-unicode-newline",description:"Unicode newline variants: U+2028 (line separator), U+2029 (paragraph separator)",pattern:/[\u2028\u2029]/},{id:"log-log4shell-jndi",description:"Log4Shell: ${jndi:...} triggers remote code execution in Apache Log4j",pattern:/\$\{jndi\s*:/i},{id:"log-log4shell-obfuscated",description:"Obfuscated Log4Shell: ${::-j}... lookup-bypass prefix used to evade WAF detection",pattern:/\$\{::-/},{id:"log-log4j-lookup",description:"Log4j lookup syntax: ${env:...}, ${sys:...}, ${ctx:...} \u2014 data exfiltration",pattern:/\$\{(?:env|sys|ctx|main|map|sd|web|docker|k8s|spring)\s*:/i},{id:"log-ssti-double-brace",description:"SSTI double-brace: {{expression}} \u2014 Jinja2, Twig, Handlebars, etc.",pattern:/\{\{[\s\S]{0,80}\}\}/},{id:"log-ssti-hash-brace",description:"SSTI hash-brace: #{expression} \u2014 Thymeleaf, Velocity, Ruby ERB",pattern:/#\{[\s\S]{0,80}\}/},{id:"log-ssti-dollar-brace",description:"SSTI/EL injection: ${expression with operators or method calls} \u2014 JSP EL, Freemarker, SpEL",pattern:/\$\{[^}]*(?:\.|\(|\*|\+|\bclass\b|\bruntime\b|\bprocess\b|\bexec\b)[^}]{0,80}\}/i},{id:"log-ssti-percent-tag",description:"SSTI ERB/ASP tag: <%= expression %> \u2014 Ruby ERB, ASP",pattern:/<%=[\s\S]{0,80}%>/},{id:"log-null-byte",description:"Null byte: \\x00 or %00 \u2014 can truncate log entries in C-backed loggers",pattern:/\x00|%00/},{id:"log-ansi-escape",description:"ANSI escape sequence: ESC[ \u2014 can manipulate terminal output when logs are tailed",pattern:/\x1b\[/}],Wr=wa;var zr={HTML:Br,XML:Vr,SVG:Dr,SQL:Bn,"SQL-STRICT":Ur,SHELL:Gr,REDOS:qr,NOSQL:Hr,LOG:Wr},Vn=zr,Vt=Object.freeze(Object.fromEntries(Object.keys(zr).map(t=>[t,t])));function Sa(t){if(typeof t!="string")throw new TypeError(`is-unsafe: first argument must be a string, got ${typeof t}`)}function ka(t){if(!(t instanceof RegExp)){if(typeof t=="string"){if(!Vn[t])throw new TypeError(`is-unsafe: unknown context "${t}". Valid contexts: ${Object.keys(Vt).join(", ")}`);return}if(Array.isArray(t)){if(t.length===0)throw new TypeError("is-unsafe: context array must not be empty");for(let e of t)if(typeof e!="string"||!Vn[e])throw new TypeError(`is-unsafe: unknown context "${e}" in array. Valid contexts: ${Object.keys(Vt).join(", ")}`);return}throw new TypeError(`is-unsafe: second argument must be a context string, array of context strings, or RegExp. Got: ${typeof t}`)}}function Jr(t,e){let n=Vn[e];for(let s of n)if(s.pattern.test(t))return {context:e,id:s.id,description:s.description,pattern:s.pattern};return null}function Kr(t,e){if(Sa(t),ka(e),e instanceof RegExp)return e.test(t);if(typeof e=="string")return Jr(t,e)!==null;for(let n of e)if(Jr(t,n)!==null)return true;return false}function Ea(t,e){if(!t)return {};let n=e.attributesGroupName?t[e.attributesGroupName]:t;if(!n)return {};let s={};for(let r in n)if(r.startsWith(e.attributeNamePrefix)){let o=r.substring(e.attributeNamePrefix.length);s[o]=n[r];}else s[r]=n[r];return s}function xa(t){if(!t||typeof t!="string")return;let e=t.indexOf(":");if(e!==-1&&e>0){let n=t.substring(0,e);if(n!=="xmlns")return n}}var an=class{constructor(e,n){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.parseXml=Pa,this.parseTextData=ja,this.resolveNameSpace=Ta,this.buildAttributesMap=Aa,this.isItStopNode=Na,this.replaceEntitiesValue=$a,this.readStopNodeData=_a,this.saveTextToParentTag=La,this.addChild=Ma,this.ignoreAttributesFn=gs(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0;let s={...nn};this.options.entityDecoder?this.entityDecoder=this.options.entityDecoder:(typeof this.options.htmlEntities=="object"?s=this.options.htmlEntities:this.options.htmlEntities===true&&(s={...ps,...Ln}),this.entityDecoder=new _t({namedEntities:{...s,...n},numericAllowed:this.options.htmlEntities,limit:{maxTotalExpansions:this.options.processEntities.maxTotalExpansions,maxExpandedLength:this.options.processEntities.maxExpandedLength,applyLimitsTo:this.options.processEntities.appliesTo},onInputEntity:(o,a)=>Kr(a,[Vt.HTML,Vt.XML])?It.BLOCK:It.ALLOW})),this.matcher=new Bt,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=false,this.stopNodeExpressionsSet=new Ot;let r=this.options.stopNodes;if(r&&r.length>0){for(let o=0;o<r.length;o++){let a=r[o];typeof a=="string"?this.stopNodeExpressionsSet.add(new pt(a)):a instanceof pt&&this.stopNodeExpressionsSet.add(a);}this.stopNodeExpressionsSet.seal();}}};function ja(t,e,n,s,r,o,a){let i=this.options;if(t!==void 0&&(i.trimValues&&!s&&(t=t.trim()),t.length>0)){a||(t=this.replaceEntitiesValue(t,e,n));let c=i.jPath?n.toString():n,l=i.tagValueProcessor(e,t,c,r,o);return l==null?t:typeof l!=typeof t||l!==t?l:i.trimValues||t.trim()===t?ws(t,i.parseTagValue,i.numberParseOptions):t}}function Ta(t){if(this.options.removeNSPrefix){let e=t.split(":"),n=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return "";e.length===2&&(t=n+e[1]);}return t}var Ca=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Aa(t,e,n,s=false){let r=this.options;if(s===true||r.ignoreAttributes!==true&&typeof t=="string"){let o=Mn(t,Ca),a=o.length,i={},c=new Array(a),l=false,u={};for(let f=0;f<a;f++){let h=this.resolveNameSpace(o[f][1]),m=o[f][4];if(h.length&&m!==void 0){let y=m;r.trimValues&&(y=y.trim()),y=this.replaceEntitiesValue(y,n,this.readonlyMatcher),c[f]=y,u[h]=y,l=true;}}l&&typeof e=="object"&&e.updateCurrent&&e.updateCurrent(u);let p=r.jPath?e.toString():this.readonlyMatcher,d=false;for(let f=0;f<a;f++){let h=this.resolveNameSpace(o[f][1]);if(this.ignoreAttributesFn(h,p))continue;let m=r.attributeNamePrefix+h;if(h.length)if(r.transformAttributeName&&(m=r.transformAttributeName(m)),m=Xr(m,r),o[f][4]!==void 0){let y=c[f],x=r.attributeValueProcessor(h,y,p);x==null?i[m]=y:typeof x!=typeof y||x!==y?i[m]=x:i[m]=ws(y,r.parseAttributeValue,r.numberParseOptions),d=true;}else r.allowBooleanAttributes&&(i[m]=true,d=true);}if(!d)return;if(r.attributesGroupName&&!r.preserveOrder){let f={};return f[r.attributesGroupName]=i,f}return i}}var Pa=function(t){t=t.replace(/\r\n?/g,`
4
- `);let e=new ee("!xml"),n=e,s="";this.matcher.reset(),this.entityDecoder.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;let r=this.options,o=new on(r.processEntities),a=t.length;for(let i=0;i<a;i++)if(t[i]==="<"){let l=t.charCodeAt(i+1);if(l===47){let u=Dt(t,">",i,"Closing Tag is not closed."),p=t.substring(i+2,u).trim();if(r.removeNSPrefix){let f=p.indexOf(":");f!==-1&&(p=p.substr(f+1));}p=vs(r.transformTagName,p,"",r).tagName,n&&(s=this.saveTextToParentTag(s,n,this.readonlyMatcher));let d=this.matcher.getCurrentTag();if(p&&r.unpairedTagsSet.has(p))throw new Error(`Unpaired tag can not be used as closing tag: </${p}>`);d&&r.unpairedTagsSet.has(d)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=false,n=this.tagsNodeStack.pop(),s="",i=u;}else if(l===63){let u=bs(t,i,false,"?>");if(!u)throw new Error("Pi Tag is not closed.");s=this.saveTextToParentTag(s,n,this.readonlyMatcher);let p=this.buildAttributesMap(u.tagExp,this.matcher,u.tagName,true);if(p){let d=p[this.options.attributeNamePrefix+"version"];this.entityDecoder.setXmlVersion(Number(d)||1),o.setXmlVersion(Number(d)||1);}if(!(r.ignoreDeclaration&&u.tagName==="?xml"||r.ignorePiTags)){let d=new ee(u.tagName);d.add(r.textNodeName,""),u.tagName!==u.tagExp&&u.attrExpPresent&&r.ignoreAttributes!==true&&(d[":@"]=p),this.addChild(n,d,this.readonlyMatcher,i);}i=u.closeIndex+1;}else if(l===33&&t.charCodeAt(i+2)===45&&t.charCodeAt(i+3)===45){let u=Dt(t,"-->",i+4,"Comment is not closed.");if(r.commentPropName){let p=t.substring(i+4,u-2);s=this.saveTextToParentTag(s,n,this.readonlyMatcher),n.add(r.commentPropName,[{[r.textNodeName]:p}]);}i=u;}else if(l===33&&t.charCodeAt(i+2)===68){let u=o.readDocType(t,i);this.entityDecoder.addInputEntities(u.entities),i=u.i;}else if(l===33&&t.charCodeAt(i+2)===91){let u=Dt(t,"]]>",i,"CDATA is not closed.")-2,p=t.substring(i+9,u);s=this.saveTextToParentTag(s,n,this.readonlyMatcher);let d=this.parseTextData(p,n.tagname,this.readonlyMatcher,true,false,true,true);d==null&&(d=""),r.cdataPropName?n.add(r.cdataPropName,[{[r.textNodeName]:p}]):n.add(r.textNodeName,d),i=u+2;}else {let u=bs(t,i,r.removeNSPrefix);if(!u){let v=t.substring(Math.max(0,i-50),Math.min(a,i+50));throw new Error(`readTagExp returned undefined at position ${i}. Context: "${v}"`)}let p=u.tagName,d=u.rawTagName,f=u.tagExp,h=u.attrExpPresent,m=u.closeIndex;if({tagName:p,tagExp:f}=vs(r.transformTagName,p,f,r),r.strictReservedNames&&(p===r.commentPropName||p===r.cdataPropName||p===r.textNodeName||p===r.attributesGroupName))throw new Error(`Invalid tag name: ${p}`);n&&s&&n.tagname!=="!xml"&&(s=this.saveTextToParentTag(s,n,this.readonlyMatcher,false));let y=n;y&&r.unpairedTagsSet.has(y.tagname)&&(n=this.tagsNodeStack.pop(),this.matcher.pop());let x=false;f.length>0&&f.lastIndexOf("/")===f.length-1&&(x=true,p[p.length-1]==="/"?(p=p.substr(0,p.length-1),f=p):f=f.substr(0,f.length-1),h=p!==f);let C=null,T;T=xa(d),p!==e.tagname&&this.matcher.push(p,{},T),p!==f&&h&&(C=this.buildAttributesMap(f,this.matcher,p),C&&(Ea(C,r))),p!==e.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());let b=i;if(this.isCurrentNodeStopNode){let v="";if(x)i=u.closeIndex;else if(r.unpairedTagsSet.has(p))i=u.closeIndex;else {let w=this.readStopNodeData(t,d,m+1);if(!w)throw new Error(`Unexpected end of ${d}`);i=w.i,v=w.tagContent;}let S=new ee(p);C&&(S[":@"]=C),S.add(r.textNodeName,v),this.matcher.pop(),this.isCurrentNodeStopNode=false,this.addChild(n,S,this.readonlyMatcher,b);}else {if(x){({tagName:p,tagExp:f}=vs(r.transformTagName,p,f,r));let v=new ee(p);C&&(v[":@"]=C),this.addChild(n,v,this.readonlyMatcher,b),this.matcher.pop(),this.isCurrentNodeStopNode=false;}else if(r.unpairedTagsSet.has(p)){let v=new ee(p);C&&(v[":@"]=C),this.addChild(n,v,this.readonlyMatcher,b),this.matcher.pop(),this.isCurrentNodeStopNode=false,i=u.closeIndex;continue}else {let v=new ee(p);if(this.tagsNodeStack.length>r.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(n),C&&(v[":@"]=C),this.addChild(n,v,this.readonlyMatcher,b),n=v;}s="",i=m;}}}else s+=t[i];return e.child};function Ma(t,e,n,s){this.options.captureMetaData||(s=void 0);let r=this.options.jPath?n.toString():n,o=this.options.updateTag(e.tagname,r,e[":@"]);o===false||(typeof o=="string"&&(e.tagname=o),t.addChild(e,s));}function $a(t,e,n){let s=this.options.processEntities;if(!s||!s.enabled)return t;if(s.allowedTags){let r=this.options.jPath?n.toString():n;if(!(Array.isArray(s.allowedTags)?s.allowedTags.includes(e):s.allowedTags(e,r)))return t}if(s.tagFilter){let r=this.options.jPath?n.toString():n;if(!s.tagFilter(e,r))return t}return this.entityDecoder.decode(t)}function La(t,e,n,s){return t&&(s===void 0&&(s=e.child.length===0),t=this.parseTextData(t,e.tagname,n,false,e[":@"]?Object.keys(e[":@"]).length!==0:false,s),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function Na(){return this.stopNodeExpressionsSet.size===0?false:this.matcher.matchesAny(this.stopNodeExpressionsSet)}function Ra(t,e,n=">"){let s=0,r=t.length,o=n.charCodeAt(0),a=n.length>1?n.charCodeAt(1):-1,i="",c=e;for(let l=e;l<r;l++){let u=t.charCodeAt(l);if(s)u===s&&(s=0);else if(u===34||u===39)s=u;else if(u===o)if(a!==-1){if(t.charCodeAt(l+1)===a)return i+=t.substring(c,l),{data:i,index:l}}else return i+=t.substring(c,l),{data:i,index:l};else u===9&&!s&&(i+=t.substring(c,l)+" ",c=l+1);}}function Dt(t,e,n,s){let r=t.indexOf(e,n);if(r===-1)throw new Error(s);return r+e.length-1}function Ia(t,e,n,s){let r=t.indexOf(e,n);if(r===-1)throw new Error(s);return r}function bs(t,e,n,s=">"){let r=Ra(t,e+1,s);if(!r)return;let o=r.data,a=r.index,i=o.search(/\s/),c=o,l=true;i!==-1&&(c=o.substring(0,i),o=o.substring(i+1).trimStart());let u=c;if(n){let p=c.indexOf(":");p!==-1&&(c=c.substr(p+1),l=c!==r.data.substr(p+1));}return {tagName:c,tagExp:o,closeIndex:a,attrExpPresent:l,rawTagName:u}}function _a(t,e,n){let s=n,r=1,o=t.length;for(;n<o;n++)if(t[n]==="<"){let a=t.charCodeAt(n+1);if(a===47){let i=Ia(t,">",n,`${e} is not closed`);if(t.substring(n+2,i).trim()===e&&(r--,r===0))return {tagContent:t.substring(s,n),i};n=i;}else if(a===63)n=Dt(t,"?>",n+1,"StopNode is not closed.");else if(a===33&&t.charCodeAt(n+2)===45&&t.charCodeAt(n+3)===45)n=Dt(t,"-->",n+3,"StopNode is not closed.");else if(a===33&&t.charCodeAt(n+2)===91)n=Dt(t,"]]>",n,"StopNode is not closed.")-2;else {let i=bs(t,n,false);i&&((i&&i.tagName)===e&&i.tagExp[i.tagExp.length-1]!=="/"&&r++,n=i.closeIndex);}}}function ws(t,e,n){if(e&&typeof t=="string"){let s=t.trim();return s==="true"?true:s==="false"?false:hs(t,n)}else return cr(t)?t:""}function vs(t,e,n,s){if(t){let r=t(e);n===e&&(n=r),e=r;}return e=Xr(e,s),{tagName:e,tagExp:n}}function Xr(t,e){if($n.includes(t))throw new Error(`[SECURITY] Invalid name: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);return en.includes(t)?e.onDangerousProperty(t):t}var Ss=ee.getMetaDataSymbol();function Fa(t,e){if(!t||typeof t!="object")return {};if(!e)return t;let n={};for(let s in t)if(s.startsWith(e)){let r=s.substring(e.length);n[r]=t[s];}else n[s]=t[s];return n}function ks(t,e,n,s){return Yr(t,e,n,s)}function Yr(t,e,n,s){let r,o={};for(let a=0;a<t.length;a++){let i=t[a],c=Oa(i);if(c!==void 0&&c!==e.textNodeName){let l=Fa(i[":@"]||{},e.attributeNamePrefix);n.push(c,l);}if(c===e.textNodeName)r===void 0?r=i[c]:r+=""+i[c];else {if(c===void 0)continue;if(i[c]){let l=Yr(i[c],e,n,s),u=Va(l,e);if(Object.keys(l).length===0&&e.alwaysCreateTextNode&&(l[e.textNodeName]=""),i[":@"]?Ba(l,i[":@"],s,e):Object.keys(l).length===1&&l[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?l=l[e.textNodeName]:Object.keys(l).length===0&&(e.alwaysCreateTextNode?l[e.textNodeName]="":l=""),i[Ss]!==void 0&&typeof l=="object"&&l!==null&&(l[Ss]=i[Ss]),o[c]!==void 0&&Object.prototype.hasOwnProperty.call(o,c))Array.isArray(o[c])||(o[c]=[o[c]]),o[c].push(l);else {let p=e.jPath?s.toString():s;e.isArray(c,p,u)?o[c]=[l]:o[c]=l;}c!==void 0&&c!==e.textNodeName&&n.pop();}}}return typeof r=="string"?r.length>0&&(o[e.textNodeName]=r):r!==void 0&&(o[e.textNodeName]=r),o}function Oa(t){let e=Object.keys(t);for(let n=0;n<e.length;n++){let s=e[n];if(s!==":@")return s}}function Ba(t,e,n,s){if(e){let r=Object.keys(e),o=r.length;for(let a=0;a<o;a++){let i=r[a],c=i.startsWith(s.attributeNamePrefix)?i.substring(s.attributeNamePrefix.length):i,l=s.jPath?n.toString()+"."+c:n;s.isArray(i,l,true,true)?t[i]=[e[i]]:t[i]=e[i];}}}function Va(t,e){let{textNodeName:n}=e,s=Object.keys(t).length;return !!(s===0||s===1&&(t[n]||typeof t[n]=="boolean"||t[n]===0))}var Ze=class{constructor(e){this.externalEntities={},this.options=Pr(e);}parse(e,n){if(typeof e!="string"&&e.toString)e=e.toString();else if(typeof e!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===true&&(n={});let o=fr(e,n);if(o!==true)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}let s=new an(this.options,this.externalEntities),r=s.parseXml(e);return this.options.preserveOrder||r===void 0?r:ks(r,this.options,s.matcher,s.readonlyMatcher)}addEntity(e,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=n;}static getMetaDataSymbol(){return ee.getMetaDataSymbol()}};var bt=b(a(),1),wt=b(a(),1);var St=b(a(),1),Ce=b(a(),1),Ae=b(a(),1),Pe=b(a(),1),Me=b(a(),1),$e=b(a(),1),Xn=b(a(),1),ge=b(a(),1),Yn=b(a(),1),kt=b(a(),1),ye=b(a(),1),Jt=b(a(),1),Y=b(a(),1),ce=b(a(),1),Le=b(a(),1),Ee=b(a(),1),Ne=b(a(),1),hn=b(a(),1),gn=b(a(),1),yn=b(a(),1),ne=b(a(),1),de=b(a(),1),fe=b(a(),1),me=b(a(),1),he=b(a(),1),ui=b(a(),1);var Da=["vibgrate.config.ts","vibgrate.config.js","vibgrate.config.json"],Ua="VIBGRATE_TRUST_CONFIG";function Ga(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function ln(t,e){if(O.isParenthesizedExpression(t))return ln(t.expression,e);if(O.isStringLiteralLike(t))return t.text;if(O.isNumericLiteral(t))return Number(t.text);if(t.kind===O.SyntaxKind.TrueKeyword)return true;if(t.kind===O.SyntaxKind.FalseKeyword)return false;if(t.kind===O.SyntaxKind.NullKeyword)return null;if(O.isArrayLiteralExpression(t))return t.elements.map(n=>{if(O.isSpreadElement(n))throw new Error("Spread not supported in static config arrays");return ln(n,e)});if(O.isObjectLiteralExpression(t)){let n={};for(let s of t.properties){if(!O.isPropertyAssignment(s)||s.initializer===void 0)throw new Error("Only plain object properties are supported in static config");if(O.isComputedPropertyName(s.name))throw new Error("Computed property names are not supported in static config");let r=O.isIdentifier(s.name)||O.isStringLiteral(s.name)||O.isNumericLiteral(s.name)?s.name.text:null;if(r===null)throw new Error("Unsupported object key in static config");n[r]=ln(s.initializer,e);}return n}if(O.isIdentifier(t)){let n=e.get(t.text);if(!n)throw new Error(`Unknown identifier in static config: ${t.text}`);return ln(n,e)}throw new Error("Non-static expression in config")}function qa(t,e){let n=e.endsWith(".ts")?O.ScriptKind.TS:O.ScriptKind.JS,s=O.createSourceFile(e,t,O.ScriptTarget.ESNext,true,n),r=new Map;for(let o of s.statements)if(O.isVariableStatement(o)&&o.declarationList.flags&O.NodeFlags.Const)for(let a of o.declarationList.declarations)O.isIdentifier(a.name)&&a.initializer&&r.set(a.name.text,a.initializer);for(let o of s.statements){if(!O.isExportAssignment(o))continue;let a=ln(o.expression,r);return Ga(a)?{...Wn,...a}:null}return null}var Ha=5242880,Wa=180,Wn={exclude:[],maxFileSizeToScan:Ha,projectScanTimeout:Wa,thresholds:{failOnError:{eolDays:180,frameworkMajorLag:3,dependencyTwoPlusPercent:50},warn:{frameworkMajorLag:2,dependencyTwoPlusPercent:30}}};async function za(t){let e=Wn;for(let s of Da){let r=I.join(t,s);if(await p(r)){if(s.endsWith(".json")){let i=await o(r);e={...Wn,...JSON.parse(i)};break}let o$1=await o(r),a=null;try{a=qa(o$1,r);}catch{a=null;}if(a){e=a;break}if(process.env[Ua]==="1")try{let i=await import(r);e={...Wn,...i.default??i};break}catch{}}}let n=I.join(t,".vibgrate","auto-excludes.json");if(await p(n))try{let s=await o(n),r=JSON.parse(s);if(Array.isArray(r)&&r.length>0){let o=e.exclude??[];e={...e,exclude:[...new Set([...o,...r])]};}}catch{}return e}async function _m(t){let e=I.join(t,"vibgrate.config.ts");return await ve.writeFile(e,`import type { VibgrateConfig } from '@vibgrate/cli';
5
-
6
- const config: VibgrateConfig = {
7
- // exclude: ['legacy/**'],
8
- // maxFileSizeToScan: 5_242_880, // 5 MB (default)
9
- // projectScanTimeout: 180, // 3 min per project (default, in seconds)
10
- thresholds: {
11
- failOnError: {
12
- eolDays: 180,
13
- frameworkMajorLag: 3,
14
- dependencyTwoPlusPercent: 50,
15
- },
16
- warn: {
17
- frameworkMajorLag: 2,
18
- dependencyTwoPlusPercent: 30,
19
- },
20
- },
21
- };
22
-
23
- export default config;
24
- `,"utf8"),e}async function Ja(t,e){if(e.length===0)return false;let n=I.join(t,"vibgrate.config.json");if(await p(n))try{let i=await o(n),c=JSON.parse(i),l=Array.isArray(c.exclude)?c.exclude:[],u=[...new Set([...l,...e])];return c.exclude=u,await ve.writeFile(n,JSON.stringify(c,null,2)+`
25
- `,"utf8"),!0}catch{}let s=I.join(t,".vibgrate"),r=I.join(s,"auto-excludes.json"),o$1=[];if(await p(r))try{let i=await o(r),c=JSON.parse(i);Array.isArray(c)&&(o$1=c);}catch{}let a=[...new Set([...o$1,...e])];try{return await ve.mkdir(s,{recursive:!0}),await ve.writeFile(r,JSON.stringify(a,null,2)+`
26
- `,"utf8"),!0}catch{return false}}var Ka=864e5,Xa=365.25;function Ya(t,e,n){if(!t||!e||!n)return null;let s=n[t],r=n[e];if(!s||!r)return null;let o=Date.parse(s),a=Date.parse(r);if(Number.isNaN(o)||Number.isNaN(a))return null;let i=(a-o)/Ka;return i>0?i:0}function Qa(t){return t===null?null:t/Xa}function Za(t){let e=0,n=0,s=0;for(let r of t)r==null||Number.isNaN(r)||(e+=r,r>n&&(n=r),s++);return s===0?null:{total:e,max:n,measured:s}}function ec(t){if(!t||t.measured===0)return null;let e=t.total/t.measured,n=Math.min(e*20,100),s=Math.min(t.max*10,100),r=100-(n*.7+s*.3);return Math.max(0,Math.min(100,Math.round(r)))}var Qr="driftscore-2.0",Zr={failOnError:{eolDays:180,frameworkMajorLag:3,dependencyTwoPlusPercent:50},warn:{frameworkMajorLag:2,dependencyTwoPlusPercent:30}};function jo(t,e,n){return Math.min(n,Math.max(e,t))}function tc(t){if(t.length===0)return null;let e=t.map(s=>s.runtimeMajorsBehind).filter(s=>s!==void 0);if(e.length===0)return null;let n=Math.max(...e);return n===0?100:n===1?80:n===2?50:n===3?20:0}function nc(t){let e=t.flatMap(i=>i.frameworks);if(e.length===0)return null;let n=e.map(i=>i.majorsBehind).filter(i=>i!==null);if(n.length===0)return null;let s=Math.max(...n),r=n.reduce((i,c)=>i+c,0)/n.length,o=Math.min(s*20,100),a=Math.min(r*15,100);return jo(100-(o*.6+a*.4),0,100)}function sc(t){let e=0,n=0,s=0,r=0;for(let l of t)e+=l.dependencyAgeBuckets.current,n+=l.dependencyAgeBuckets.oneBehind,s+=l.dependencyAgeBuckets.twoPlusBehind,r+=l.dependencyAgeBuckets.unknown;let o=e+n+s;if(o===0)return null;let a=e/o,i=n/o,c=s/o;return jo(Math.round(a*100-i*10-c*40),0,100)}var eo=1e3*60*60*24*30;function rc(t){if(!t.some(r=>r.runtimeMajorsBehind!==void 0||r.runtimeEol!==void 0&&r.runtimeEol!==null))return null;let n=100,s=Date.now();for(let r of t){if(r.runtimeEol===true){n=Math.min(n,0);continue}if(r.runtimeEol===false){if(r.runtimeEolDate){let o=Date.parse(r.runtimeEolDate)-s;Number.isNaN(o)||(o<=6*eo?n=Math.min(n,40):o<=12*eo&&(n=Math.min(n,75)));}continue}r.type==="node"&&r.runtimeMajorsBehind!==void 0&&(r.runtimeMajorsBehind>=3?n=Math.min(n,0):r.runtimeMajorsBehind>=2?n=Math.min(n,30):r.runtimeMajorsBehind>=1&&(n=Math.min(n,70))),r.type==="dotnet"&&r.runtimeMajorsBehind!==void 0&&(r.runtimeMajorsBehind>=3?n=Math.min(n,0):r.runtimeMajorsBehind>=2?n=Math.min(n,20):r.runtimeMajorsBehind>=1&&(n=Math.min(n,60))),r.type==="python"&&r.runtimeMajorsBehind!==void 0&&(r.runtimeMajorsBehind>=6?n=Math.min(n,0):r.runtimeMajorsBehind>=4?n=Math.min(n,20):r.runtimeMajorsBehind>=2&&(n=Math.min(n,60))),r.type==="java"&&r.runtimeMajorsBehind!==void 0&&(r.runtimeMajorsBehind>=10?n=Math.min(n,0):r.runtimeMajorsBehind>=4?n=Math.min(n,30):r.runtimeMajorsBehind>=1&&(n=Math.min(n,70)));}return n}function oc(t){let e=t.map(o=>o.libyears).filter(o=>!!o);if(e.length===0)return null;let n=e.reduce((o,a)=>o+a.total,0),s=e.reduce((o,a)=>o+a.measured,0),r=e.reduce((o,a)=>Math.max(o,a.max),0);return s===0?null:ec({total:n,max:r,measured:s})}function ic(t){let e=0,n=0;for(let r of t)e+=r.dependencyAgeBuckets.current+r.dependencyAgeBuckets.oneBehind+r.dependencyAgeBuckets.twoPlusBehind,n+=r.dependencyAgeBuckets.unknown;let s=e+n;return s===0?null:Math.round(e/s*100)/100}function Es(t){let e=tc(t),n=nc(t),s=sc(t),r=rc(t),o=oc(t),a=[{score:e,weight:.25},{score:n,weight:.25},{score:s,weight:.3},{score:r,weight:.2},{score:o,weight:.15}],i=ic(t)??void 0,c=y=>100-y,l=()=>{let y={runtimeScore:c(Math.round(e??100)),frameworkScore:c(Math.round(n??100)),dependencyScore:c(Math.round(s??100)),eolScore:c(Math.round(r??100))};return o!==null&&(y.freshnessScore=c(Math.round(o))),y},u=a.filter(y=>y.score!==null);if(u.length===0)return {score:0,riskLevel:"low",components:l(),methodologyVersion:Qr,...i!==void 0?{confidence:i}:{}};let p=u.reduce((y,x)=>y+x.weight,0),d=0;for(let y of u)d+=y.score*(y.weight/p);let f=c(Math.round(d)),h;f<=30?h="low":f<=60?h="moderate":h="high";let m=[];return e!==null&&m.push("runtime"),n!==null&&m.push("framework"),s!==null&&m.push("dependency"),r!==null&&m.push("eol"),o!==null&&m.push("freshness"),{score:f,riskLevel:h,components:l(),measured:m,methodologyVersion:Qr,...i!==void 0?{confidence:i}:{}}}function ac(t,e){let n={failOnError:{...Zr.failOnError,...e?.thresholds?.failOnError},warn:{...Zr.warn,...e?.thresholds?.warn}},s=[];for(let r of t){let o=r.type==="node"?"Node.js":r.type==="dotnet"?".NET":r.type==="python"?"Python":r.type==="java"?"Java":r.type;if(r.runtimeEol===true){let i=r.runtimeEolDate?` on ${r.runtimeEolDate}`:"";s.push({ruleId:"vibgrate/runtime-eol",level:"error",message:`${o} runtime "${r.runtime}" reached end-of-life${i} (latest: ${r.runtimeLatest}).`,location:r.path});}else r.runtimeMajorsBehind!==void 0&&r.runtimeMajorsBehind>=3?s.push({ruleId:"vibgrate/runtime-eol",level:"error",message:`${o} runtime "${r.runtime}" is ${r.runtimeMajorsBehind} major versions behind (latest: ${r.runtimeLatest}). Likely at or past EOL.`,location:r.path}):r.runtimeMajorsBehind!==void 0&&r.runtimeMajorsBehind>=2&&s.push({ruleId:"vibgrate/runtime-lag",level:"warning",message:`${o} runtime "${r.runtime}" is ${r.runtimeMajorsBehind} major versions behind (latest: ${r.runtimeLatest}).`,location:r.path});for(let i of r.frameworks)i.majorsBehind!==null&&n.failOnError.frameworkMajorLag!==void 0&&i.majorsBehind>=n.failOnError.frameworkMajorLag?s.push({ruleId:"vibgrate/framework-major-lag",level:"error",message:`${i.name} is ${i.majorsBehind} major versions behind (current: ${i.currentVersion}, latest: ${i.latestVersion}).`,location:r.path}):i.majorsBehind!==null&&n.warn.frameworkMajorLag!==void 0&&i.majorsBehind>=n.warn.frameworkMajorLag&&s.push({ruleId:"vibgrate/framework-major-lag",level:"warning",message:`${i.name} is ${i.majorsBehind} major versions behind (current: ${i.currentVersion}, latest: ${i.latestVersion}).`,location:r.path});let a=r.dependencyAgeBuckets.current+r.dependencyAgeBuckets.oneBehind+r.dependencyAgeBuckets.twoPlusBehind;if(a>0){let i=r.dependencyAgeBuckets.twoPlusBehind/a*100;n.failOnError.dependencyTwoPlusPercent!==void 0&&i>=n.failOnError.dependencyTwoPlusPercent?s.push({ruleId:"vibgrate/dependency-rot",level:"error",message:`${Math.round(i)}% of dependencies are 2+ major versions behind in ${r.name}.`,location:r.path}):n.warn.dependencyTwoPlusPercent!==void 0&&i>=n.warn.dependencyTwoPlusPercent&&s.push({ruleId:"vibgrate/dependency-rot",level:"warning",message:`${Math.round(i)}% of dependencies are 2+ major versions behind in ${r.name}.`,location:r.path});}for(let i of r.dependencies)i.majorsBehind!==null&&i.majorsBehind>=3&&s.push({ruleId:"vibgrate/dependency-major-lag",level:"error",message:`${i.package} is ${i.majorsBehind} major versions behind (spec: ${i.currentSpec}, latest: ${i.latestStable}).`,location:r.path});}return s}function cc(t,e,n){let s=n?`${t}:${e}:${n}`:`${t}:${e}`;return Os.createHash("sha256").update(s).digest("hex").slice(0,16)}function lc(t,e,n){let s=n?`${t}:${e}:${n}`:`${t}:${e}`;return Os.createHash("sha256").update(s).digest("hex").slice(0,16)}var uc=20,pc=50,to={red:"#E5484D",amber:"#F5A524",green:"#30A46C",unknown:"#6B7280"},Fm="#24292F";function Om(t){if(t==null||!Number.isFinite(t))return "unknown";let e=Math.round(t);return e<=uc?"green":e<=pc?"amber":"red"}function Bm(t){if(t==null||!Number.isFinite(t))return "unknown";let e=Math.round(Math.min(100,Math.max(0,t)));return e===100?"100":String(e).padStart(2,"0")}function Vm(t){return to[t]??to.unknown}function dc(t){let e=[];e.push(""),e.push(E.bold.cyan("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),e.push(E.bold.cyan("\u2551 Vibgrate Drift Report \u2551")),e.push(E.bold.cyan("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),e.push("");for(let i of t.projects){if(e.push(E.bold(` \u2500\u2500 ${i.name} `)+E.dim(`(${i.type}) ${i.path}`)),i.runtime){let u=i.runtimeMajorsBehind!==void 0&&i.runtimeMajorsBehind>0?E.yellow(` (${i.runtimeMajorsBehind} major${i.runtimeMajorsBehind>1?"s":""} behind)`):E.green(" (current)");e.push(` Runtime: ${i.runtime}${u}`);}if(i.targetFramework&&e.push(` Target: ${i.targetFramework}`),i.frameworks.length>0){e.push(" Frameworks:");for(let u of i.frameworks){let p=u.majorsBehind!==null?u.majorsBehind===0?E.green("current"):E.yellow(`${u.majorsBehind} behind`):E.dim("unknown");e.push(` ${u.name}: ${u.currentVersion??"?"} \u2192 ${u.latestVersion??"?"} (${p})`);}}let c=i.dependencyAgeBuckets;c.current+c.oneBehind+c.twoPlusBehind+c.unknown>0&&(e.push(" Dependencies:"),e.push(` ${E.green(`${c.current} current`)} ${E.yellow(`${c.oneBehind} 1-behind`)} ${E.red(`${c.twoPlusBehind} 2+ behind`)} ${E.dim(`${c.unknown} unknown`)}`)),e.push("");}if(t.delta!==void 0){let i=t.delta<0?E.green(`${t.delta}`):t.delta>0?E.red(`+${t.delta}`):E.dim("0");e.push(E.bold(" Drift Delta: ")+i+" (vs baseline)"),e.push("");}if(t.extended&&e.push(...mc(t.extended)),t.findings.length>0){let i=t.findings.filter(p=>p.level==="error"),c=t.findings.filter(p=>p.level==="warning"),l=t.findings.filter(p=>p.level==="note"),u=[i.length>0?E.red(`${i.length} error${i.length!==1?"s":""}`):"",c.length>0?E.yellow(`${c.length} warning${c.length!==1?"s":""}`):"",l.length>0?E.blue(`${l.length} note${l.length!==1?"s":""}`):""].filter(Boolean).join(E.dim(", "));e.push(E.bold.underline(" Findings")+E.dim(` (${u})`));for(let p of t.findings){let d=p.level==="error"?E.red("\u2716"):p.level==="warning"?E.yellow("\u26A0"):E.blue("\u2139");e.push(` ${d} ${p.message}`),e.push(E.dim(` ${p.ruleId} in ${p.location}`));}e.push("");}let n=gc(t);if(n.length>0){e.push(E.bold.cyan("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),e.push(E.bold.cyan("\u2551 Top Priority Actions \u2551")),e.push(E.bold.cyan("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),e.push("");for(let i=0;i<n.length;i++){let c=n[i],l=E.bold.cyan(` ${i+1}.`);e.push(`${l} ${E.bold(c.title)}`),e.push(E.dim(` ${c.explanation}`)),c.impact&&e.push(` Impact: ${E.green(c.impact)}`),e.push("");}}if(t.extended?.architecture&&e.push(...hc(t.extended.architecture)),t.solutions&&t.solutions.length>0){e.push(E.bold.cyan("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),e.push(E.bold.cyan("\u2551 Solution Drift Summary \u2551")),e.push(E.bold.cyan("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),e.push("");for(let i of t.solutions){let c=i.drift?.score,l=typeof c=="number"?c<=30?E.green:c<=60?E.yellow:E.red:E.dim;e.push(` \u2022 ${i.name} (${i.projectPaths.length} projects) \u2014 ${typeof c=="number"?l(`${c}/100`):E.dim("n/a")}`);}e.push("");}let s=t.drift.score<=30?E.green:t.drift.score<=60?E.yellow:E.red;e.push(E.bold.cyan("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),e.push(E.bold.cyan("\u2551 Drift Score Summary \u2551")),e.push(E.bold.cyan("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),e.push(""),e.push(E.bold(" Drift Score: ")+s.bold(`${t.drift.score}/100`)),e.push(E.bold(" Risk Level: ")+fc(t.drift.riskLevel)),e.push(E.bold(" Projects: ")+`${t.projects.length}`);let r=t.billing;if(r&&(e.push(E.bold(" Classified: ")+`${E.cyan(r.nanoCount)} nano \xB7 ${E.cyan(r.microCount)} micro \xB7 ${E.cyan(r.smallCount)} small \xB7 ${E.cyan(r.standardCount)} standard`),e.push(E.bold(" Billable: ")+E.bold.white(`${r.billableProjects}`)+E.dim(` \xB7 ${r.totalScanned} detected \u2192 ${r.billableProjects} billable (micro-project pricing)`))),t.vcs){let i=[t.vcs.type];t.vcs.branch&&i.push(t.vcs.branch),t.vcs.shortSha&&i.push(E.dim(t.vcs.shortSha)),e.push(E.bold(" VCS: ")+i.join(" "));}e.push("");let o=new Set(t.drift.measured??["runtime","framework","dependency","eol"]);e.push(" "+E.bold.underline("Score Breakdown")),e.push(` Runtime: ${o.has("runtime")?un(t.drift.components.runtimeScore):E.dim("n/a")}`),e.push(` Frameworks: ${o.has("framework")?un(t.drift.components.frameworkScore):E.dim("n/a")}`),e.push(` Dependencies: ${o.has("dependency")?un(t.drift.components.dependencyScore):E.dim("n/a")}`),e.push(` EOL Risk: ${o.has("eol")?un(t.drift.components.eolScore):E.dim("n/a")}`),e.push("");let a=[`Scanned at ${t.timestamp}`];if(t.durationMs!==void 0){let i=(t.durationMs/1e3).toFixed(1);a.push(`${i}s`);}return t.filesScanned!==void 0&&a.push(`${t.filesScanned} file${t.filesScanned!==1?"s":""} scanned`),t.treeSummary&&(a.push(`${t.treeSummary.totalFiles.toLocaleString()} workspace files`),a.push(`${t.treeSummary.totalDirs.toLocaleString()} dirs`)),e.push(E.dim(` ${a.join(" \xB7 ")}`)),e.push(""),e.join(`
27
- `)}function fc(t){switch(t){case "low":return E.bgGreen.black(" LOW ");case "moderate":return E.bgYellow.black(" MODERATE ");case "high":return E.bgRed.white(" HIGH ");default:return t}}function un(t){let n=Math.round(t/100*20),s=20-n;return (t<=30?E.green:t<=60?E.yellow:E.red)("\u2588".repeat(n))+E.dim("\u2591".repeat(s))+` ${Math.round(t)}`}var no={frontend:"Frontend",metaFrameworks:"Meta-frameworks",bundlers:"Bundlers",css:"CSS / UI",backend:"Backend",orm:"ORM / Database",testing:"Testing",lintFormat:"Lint & Format",apiMessaging:"API & Messaging",observability:"Observability",payment:"Payment",auth:"Auth",email:"Email",cloud:"Cloud",databases:"Databases",messaging:"Messaging",crm:"CRM & Comms",storage:"Storage",search:"Search & AI"};function mc(t){let e=[];if(t.toolingInventory){let n=t.toolingInventory,s=Object.entries(n).filter(([,r])=>r.length>0);if(s.length>0){e.push(E.bold.underline(" Tech Stack"));for(let[r,o]of s){let a=no[r]??r,i=o.map(c=>E.white(c.name)).join(E.dim(", "));e.push(` ${E.cyan(a)}: ${i}`);}e.push("");}}if(t.serviceDependencies){let n=t.serviceDependencies,s=Object.entries(n).filter(([,r])=>r.length>0);if(s.length>0){e.push(E.bold.underline(" Services & Integrations"));for(let[r,o]of s){let a=no[r]??r,i=o.map(c=>{let l=c.version?E.dim(` ${c.version}`):"";return E.white(c.name)+l}).join(E.dim(", "));e.push(` ${E.cyan(a)}: ${i}`);}e.push("");}}if(t.breakingChangeExposure){let n=t.breakingChangeExposure;if(n.deprecatedPackages.length>0||n.legacyPolyfills.length>0){e.push(E.bold.underline(" Breaking Change Exposure"));let s=n.exposureScore>=40?E.red:n.exposureScore>=20?E.yellow:E.green;e.push(` Exposure Score: ${s.bold(`${n.exposureScore}/100`)}`),n.deprecatedPackages.length>0&&e.push(` ${E.red("Deprecated")}: ${n.deprecatedPackages.map(o=>E.dim(o)).join(", ")}`),n.legacyPolyfills.length>0&&e.push(` ${E.yellow("Polyfills")}: ${n.legacyPolyfills.map(o=>E.dim(o)).join(", ")}`),n.peerConflictsDetected&&e.push(` ${E.red("\u26A0")} Peer dependency conflicts detected`),e.push(` Recommendation: ${E.bold(n.overallRecommendation)}`);let r=n.projectIntelligence.filter(o=>o.packages.length>0).slice(0,3);if(r.length>0){e.push(" Major Upgrade Intelligence:");for(let o of r){e.push(` - ${o.project} (${o.recommendation})`);for(let a of o.packages.slice(0,2))e.push(` \xB7 ${a.package} ${a.currentVersion??"?"} \u2192 ${a.targetVersion??"?"} | touched ~${a.usage.touchedPercent}% | ${a.automatable}`);}}e.push("");}}if(t.tsModernity&&t.tsModernity.typescriptVersion){let n=t.tsModernity;e.push(E.bold.underline(" TypeScript"));let s=[];s.push(`v${n.typescriptVersion}`),n.strict===true?s.push(E.green("strict \u2714")):n.strict===false&&s.push(E.yellow("strict \u2716")),n.moduleType&&s.push(n.moduleType.toUpperCase()),n.target&&s.push(`target: ${n.target}`),e.push(` ${s.join(E.dim(" \xB7 "))}`),e.push("");}if(t.buildDeploy){let n=t.buildDeploy;(n.ci.length>0||n.docker.dockerfileCount>0||n.packageManagers.length>0)&&(e.push(E.bold.underline(" Build & Deploy")),n.ci.length>0&&e.push(` CI: ${n.ci.join(", ")}`),n.docker.dockerfileCount>0&&e.push(` Docker: ${n.docker.dockerfileCount} Dockerfile${n.docker.dockerfileCount!==1?"s":""} (${n.docker.baseImages.join(", ")})`),n.packageManagers.length>0&&e.push(` Package Managers: ${n.packageManagers.join(", ")}`),n.monorepoTools.length>0&&e.push(` Monorepo: ${n.monorepoTools.join(", ")}`),n.iac.length>0&&e.push(` IaC: ${n.iac.join(", ")}`),e.push(""));}if(t.uiPurpose){let n=t.uiPurpose;e.push(E.bold.underline(" Product Purpose Signals")),e.push(` Frameworks: ${n.detectedFrameworks.length>0?n.detectedFrameworks.join(", "):E.dim("unknown")}`),e.push(` Evidence: ${n.topEvidence.length}${n.capped?E.dim(` of ${n.evidenceCount} (capped)`):""}`);let s=n.topEvidence.slice(0,8);if(s.length>0){e.push(" Top Signals:");for(let r of s)e.push(` - [${r.kind}] ${r.value} ${E.dim(`(${r.file})`)}`);}if(n.unknownSignals.length>0){e.push(" Unknowns:");for(let r of n.unknownSignals.slice(0,4))e.push(` - ${E.yellow(r)}`);}e.push("");}if(t.securityPosture){let n=t.securityPosture;e.push(E.bold.underline(" Security Posture"));let s=[];s.push(n.lockfilePresent?E.green("Lockfile \u2714"):E.red("Lockfile \u2716")),s.push(n.gitignoreCoversEnv?E.green(".env \u2714"):E.red(".env \u2716")),s.push(n.gitignoreCoversNodeModules?E.green("node_modules \u2714"):E.yellow("node_modules \u2716")),n.multipleLockfileTypes&&s.push(E.yellow("Multiple lockfiles \u26A0")),n.envFilesTracked&&s.push(E.red("Env files tracked \u2716")),e.push(` ${s.join(E.dim(" \xB7 "))}`),e.push("");}if(t.platformMatrix){let n=t.platformMatrix;(n.nativeModules.length>0||n.dockerBaseImages.length>0)&&(e.push(E.bold.underline(" Platform")),n.nativeModules.length>0&&e.push(` Native modules: ${n.nativeModules.map(s=>E.dim(s)).join(", ")}`),n.osAssumptions.length>0&&e.push(` OS assumptions: ${n.osAssumptions.join(", ")}`),e.push(""));}if(t.codeQuality){let n=t.codeQuality;if(e.push(E.bold.underline(" Code Quality")),e.push(` Files: ${E.white(`${n.filesAnalyzed}`)} \xB7 Functions: ${E.white(`${n.functionsAnalyzed}`)} \xB7 Avg complexity: ${E.white(`${n.avgCyclomaticComplexity}`)} \xB7 Avg length: ${E.white(`${n.avgFunctionLength}`)} lines`),e.push(` Max nesting: ${n.maxNestingDepth} \xB7 Circular deps: ${n.circularDependencies} \xB7 Dead code: ${n.deadCodePercent}%`),n.godFiles.length>0){let s=n.godFiles.slice(0,3).map(r=>`${r.path} (${r.lines} lines)`).join(", ");e.push(` ${E.yellow("God files")}: ${s}`);}e.push("");}if(t.dependencyGraph){let n=t.dependencyGraph;n.lockfileType&&(e.push(E.bold.underline(" Dependency Graph")),e.push(` ${n.lockfileType}: ${E.white(`${n.totalUnique}`)} unique, ${E.white(`${n.totalInstalled}`)} installed`),n.duplicatedPackages.length>0&&e.push(` ${E.yellow(`${n.duplicatedPackages.length} duplicated`)} packages`),n.phantomDependencies.length>0&&e.push(` ${E.red(`${n.phantomDependencies.length} phantom`)} dependencies`),e.push(""));}return e}function hc(t){let e=[];if(e.push(E.bold.cyan("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),e.push(E.bold.cyan("\u2551 Architecture Layers \u2551")),e.push(E.bold.cyan("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),e.push(""),e.push(E.bold(" Archetype: ")+`${t.archetype}`+E.dim(` (${Math.round(t.archetypeConfidence*100)}% confidence)`)),e.push(` Files classified: ${t.totalClassified}`+(t.unclassified>0?E.dim(` (${t.unclassified} unclassified)`):"")),e.push(""),t.layers.length>0){for(let n of t.layers){let s=n.riskLevel==="none"?E.dim("none"):n.riskLevel==="low"?E.green("low"):n.riskLevel==="moderate"?E.yellow("moderate"):E.red("high");e.push(` ${E.bold(n.layer)} ${n.fileCount} file${n.fileCount!==1?"s":""} drift ${un(n.driftScore)} risk ${s}`);}e.push("");}return e}function gc(t){let e=[],n=t.projects.filter(a=>a.runtimeMajorsBehind!==void 0&&a.runtimeMajorsBehind>=3);if(n.length>0){let a=n.map(l=>l.name).join(", "),i="End-of-life runtimes no longer receive security patches and block ecosystem upgrades.",c=[];for(let l of n)c.push(`
28
- ./${l.path}`),c.push(`
29
- ${l.runtime} \u2192 ${l.runtimeLatest} (${l.runtimeMajorsBehind} major${l.runtimeMajorsBehind>1?"s":""} behind)`);i+=c.join(""),e.push({title:`Upgrade EOL runtime${n.length>1?"s":""} in ${a}`,explanation:i,impact:`\u2212${Math.min(n.length*10,30)} drift points (runtime & EOL)`,severity:100});}let s=[];for(let a of t.projects)for(let i of a.frameworks)i.majorsBehind!==null&&i.majorsBehind>=3&&s.push({name:i.name,fw:`${i.currentVersion} \u2192 ${i.latestVersion}`,behind:i.majorsBehind,project:a.name,projectPath:a.path});if(s.length>0){let a=s.sort((d,f)=>f.behind-d.behind)[0],i=s.length>1?` (+${s.length-1} more)`:"",c=`${a.behind} major versions behind. Major framework drift increases breaking change risk and blocks access to security fixes and performance improvements.`,l=[],u=0;for(let d of s){if(u>=8)break;l.push(`
30
- ./${d.projectPath}`),l.push(`
31
- ${d.name}: ${d.fw} (${d.behind} major${d.behind>1?"s":""} behind)`),u++;}let p=s.length-u;c+=l.join(""),p>0&&(c+=`
32
- ... and ${p} more`),e.push({title:`Upgrade ${a.name} ${a.fw} in ${a.project}${i}`,explanation:c,impact:"\u22125\u201315 drift points",severity:90});}for(let a of t.projects){let i=a.dependencyAgeBuckets,c=i.current+i.oneBehind+i.twoPlusBehind;if(c===0)continue;let l=Math.round(i.twoPlusBehind/c*100);if(l>=40){let u=`${i.twoPlusBehind} of ${c} dependencies are 2+ majors behind. Run \`npm outdated\` and prioritise packages with known CVEs or breaking API changes.`,p=a.dependencies.filter(d=>d.majorsBehind!==null&&d.majorsBehind>=2).sort((d,f)=>(f.majorsBehind??0)-(d.majorsBehind??0));if(p.length>0){let d=[],f=0;d.push(`
33
- ./${a.path}`);for(let m of p){if(f>=8)break;let y=m.resolvedVersion??m.currentSpec,x=m.latestStable??"?";d.push(`
34
- ${m.package}: ${y} \u2192 ${x} (${m.majorsBehind} major${m.majorsBehind>1?"s":""} behind)`),f++;}let h=p.length-f;u+=d.join(""),h>0&&(u+=`
35
- ... and ${h} more`);}e.push({title:`Reduce dependency rot in ${a.name} (${l}% severely outdated)`,explanation:u,impact:"\u22125\u201310 drift points",severity:80+l/10});}}let r=[];for(let a of t.projects)for(let i of a.frameworks)i.majorsBehind===2&&r.push({name:i.name,project:a.name,projectPath:a.path,fw:`${i.currentVersion} \u2192 ${i.latestVersion}`});let o=[...new Map(r.map(a=>[a.name,a])).values()];if(o.length>0){let a=o.slice(0,3).map(d=>`${d.name} (${d.fw})`).join(", "),i=o.length>3?` +${o.length-3} more`:"",c="These frameworks are 2 major versions behind. Create upgrade tickets and check migration guides \u2014 the gap will widen with each new release.",l=[],u=0;for(let d of r){if(u>=8)break;l.push(`
36
- ./${d.projectPath}`),l.push(`
37
- ${d.name}: ${d.fw}`),u++;}let p=r.length-u;c+=l.join(""),p>0&&(c+=`
38
- ... and ${p} more`),e.push({title:`Plan major framework upgrades: ${a}${i}`,explanation:c,impact:"\u22125\u201310 drift points",severity:60});}if(t.extended?.breakingChangeExposure){let a=t.extended.breakingChangeExposure,i=a.deprecatedPackages.length+a.legacyPolyfills.length;if(i>0){let c=[...a.deprecatedPackages,...a.legacyPolyfills].slice(0,5).join(", "),l=i>5?` +${i-5} more`:"",u=`${i} package${i!==1?"s":""} are deprecated or legacy polyfills. These receive no updates and may have known vulnerabilities.`,p=new Set([...a.deprecatedPackages,...a.legacyPolyfills]),d=[],f=0;for(let m of t.projects){let y=m.dependencies.filter(x=>p.has(x.package));if(y.length!==0){if(f>=10)break;d.push(`
39
- ./${m.path}`);for(let x of y){if(f>=10)break;let C=x.resolvedVersion??x.currentSpec,A=a.deprecatedPackages.includes(x.package)?"deprecated":"polyfill";d.push(`
40
- ${x.package}: ${C} (${A})`),f++;}}}let h=i-f;u+=d.join(""),h>0&&(u+=`
41
- ... and ${h} more`),e.push({title:`Replace deprecated/legacy packages: ${c}${l}`,explanation:u,severity:55});}}if(t.extended?.dependencyGraph){let a=t.extended.dependencyGraph,i=a.phantomDependencies.length;if(i>=10){let c="Packages used in code but not declared in package.json. These rely on transitive installs and can break unpredictably when other packages update.",l=a.phantomDependencyDetails;if(l&&l.length>0){let u=new Map;for(let h of l)u.has(h.sourcePath)||u.set(h.sourcePath,[]),u.get(h.sourcePath).push({package:h.package,spec:h.spec});let p=[],d=0;for(let[h,m]of u){if(d>=10)break;p.push(`
42
- ./${h}`);for(let y of m){if(d>=10)break;p.push(`
43
- ${y.package}: ${y.spec}`),d++;}}let f=i-d;c+=p.join(""),f>0&&(c+=`
44
- ... and ${f} more`);}e.push({title:`Fix ${i} phantom dependencies`,explanation:c,severity:45});}}if(t.extended?.securityPosture){let a=t.extended.securityPosture;if(a.envFilesTracked||!a.lockfilePresent){let i=[];a.envFilesTracked&&i.push(".env files are tracked in git"),a.lockfilePresent||i.push("no lockfile found");let c;a.envFilesTracked?(c="Environment files may contain secrets. Add them to .gitignore and rotate any exposed credentials immediately.",c+=`
45
- ./.gitignore`,c+=`
46
- Add: .env, .env.*, .env.local`):(c="Without a lockfile, installs are non-deterministic. Run the install command to generate one and commit it.",c+=`
47
- ./`,c+=`
48
- Missing: ${a.lockfileTypes.length>0?a.lockfileTypes.join(", ")+" (multiple types detected)":"package-lock.json, pnpm-lock.yaml, or yarn.lock"}`),e.push({title:`Fix security posture: ${i.join(", ")}`,explanation:c,severity:95});}}if(t.extended?.dependencyGraph){let i=t.extended.dependencyGraph.duplicatedPackages.filter(c=>c.versions.length>=3);if(i.length>=3){i.slice(0,4).map(f=>`${f.name} (${f.versions.length}v)`).join(", ");let l=`${i.length} packages have 3+ versions installed. Run \`npm dedupe\` to reduce bundle size and install time.`,u=[],p=0;for(let f of i){if(p>=8)break;u.push(`
49
- ${f.name}: ${f.versions.join(", ")} (${f.consumers} consumer${f.consumers!==1?"s":""})`),p++;}let d=i.length-p;l+=u.join(""),d>0&&(l+=`
50
- ... and ${d} more`),e.push({title:"Deduplicate heavily-versioned packages",explanation:l,severity:35});}}return e.sort((a,i)=>i.severity-a.severity),e.slice(0,5)}function yc(t){let e=vc(t.findings),n=t.findings.map(s=>bc(s));return {$schema:"https://raw.githubusercontent.com/oasis-tcs/sarif-spec/main/sarif-2.1/schema/sarif-schema-2.1.0.json",version:"2.1.0",runs:[{tool:{driver:{name:"vibgrate",version:t.vibgrateVersion,informationUri:"https://vibgrate.com",rules:e}},results:n,invocations:[{executionSuccessful:true,startTimeUtc:t.timestamp}]}]}}function vc(t){return [...new Set(t.map(n=>n.ruleId))].map(n=>({"vibgrate/runtime-eol":{id:"vibgrate/runtime-eol",shortDescription:{text:"Runtime at or past end-of-life"},helpUri:"https://vibgrate.com/rules/runtime-eol"},"vibgrate/runtime-lag":{id:"vibgrate/runtime-lag",shortDescription:{text:"Runtime major version lag"},helpUri:"https://vibgrate.com/rules/runtime-lag"},"vibgrate/framework-major-lag":{id:"vibgrate/framework-major-lag",shortDescription:{text:"Framework major version behind latest"},helpUri:"https://vibgrate.com/rules/framework-major-lag"},"vibgrate/dependency-rot":{id:"vibgrate/dependency-rot",shortDescription:{text:"High percentage of outdated dependencies"},helpUri:"https://vibgrate.com/rules/dependency-rot"},"vibgrate/dependency-major-lag":{id:"vibgrate/dependency-major-lag",shortDescription:{text:"Individual dependency severely behind"},helpUri:"https://vibgrate.com/rules/dependency-major-lag"},"vibgrate/vulnerability":{id:"vibgrate/vulnerability",shortDescription:{text:"Known vulnerability in an installed dependency"},helpUri:"https://vibgrate.com/rules/vulnerability"}})[n]??{id:n,shortDescription:{text:n},helpUri:"https://vibgrate.com"})}function bc(t){return {ruleId:t.ruleId,level:t.level==="error"?"error":t.level==="warning"?"warning":"note",message:{text:t.message},locations:[{physicalLocation:{artifactLocation:{uri:t.location}}}],...t.details&&Object.keys(t.details).length>0?{properties:t.details}:{}}}function wc(t){let e=[],n=t.billing;e.push("# Vibgrate Drift Report"),e.push(""),e.push("| Metric | Value |"),e.push("|--------|-------|"),e.push(`| **Drift Score** | ${t.drift.score}/100 |`),e.push(`| **Risk Level** | ${t.drift.riskLevel.toUpperCase()} |`),e.push(`| **Projects** | ${t.projects.length} |`),n&&(e.push(`| **Classification** | ${n.nanoCount} nano \xB7 ${n.microCount} micro \xB7 ${n.smallCount} small \xB7 ${n.standardCount} standard |`),e.push(`| **Billable Projects** | ${n.billableProjects} (${n.totalScanned} detected \u2192 ${n.billableProjects} billable) |`));let s=[t.timestamp];t.durationMs!==void 0&&s.push(`${(t.durationMs/1e3).toFixed(1)}s`),t.filesScanned!==void 0&&s.push(`${t.filesScanned} files`),t.treeSummary&&s.push(`${t.treeSummary.totalFiles.toLocaleString()} workspace files \xB7 ${t.treeSummary.totalDirs.toLocaleString()} dirs`),e.push(`| **Scanned** | ${s.join(" \xB7 ")} |`),t.vcs&&(e.push(`| **VCS** | ${t.vcs.type} |`),t.vcs.branch&&e.push(`| **Branch** | ${t.vcs.branch} |`),t.vcs.sha&&e.push(`| **Commit** | \`${t.vcs.shortSha}\` |`)),e.push(""),e.push("## Score Breakdown"),e.push(""),e.push("| Component | Score |"),e.push("|-----------|-------|"),e.push(`| Runtime | ${t.drift.components.runtimeScore} |`),e.push(`| Frameworks | ${t.drift.components.frameworkScore} |`),e.push(`| Dependencies | ${t.drift.components.dependencyScore} |`),e.push(`| EOL Risk | ${t.drift.components.eolScore} |`),e.push(""),e.push("## Projects"),e.push("");for(let r of t.projects){if(e.push(`### ${r.name} (${r.type})`),e.push(""),r.runtime){let i=r.runtimeMajorsBehind!==void 0&&r.runtimeMajorsBehind>0?` \u2014 ${r.runtimeMajorsBehind} major(s) behind`:" \u2014 current";e.push(`- **Runtime:** ${r.runtime}${i}`);}if(r.frameworks.length>0){e.push("- **Frameworks:**");for(let i of r.frameworks){let c=i.majorsBehind!==null?i.majorsBehind===0?"current":`${i.majorsBehind} behind`:"unknown";e.push(` - ${i.name}: ${i.currentVersion??"?"} \u2192 ${i.latestVersion??"?"} (${c})`);}}let o=r.dependencyAgeBuckets;o.current+o.oneBehind+o.twoPlusBehind+o.unknown>0&&e.push(`- **Dependencies:** ${o.current} current, ${o.oneBehind} 1-behind, ${o.twoPlusBehind} 2+ behind, ${o.unknown} unknown`),e.push("");}if(t.extended?.uiPurpose){let r=t.extended.uiPurpose;if(e.push("## Product Purpose Signals"),e.push(""),e.push(`- **Frameworks:** ${r.detectedFrameworks.length>0?r.detectedFrameworks.join(", "):"unknown"}`),e.push(`- **Evidence Items:** ${r.topEvidence.length}${r.capped?` (capped from ${r.evidenceCount})`:""}`),r.topEvidence.length>0){e.push("- **Top Evidence:**");for(let o of r.topEvidence.slice(0,10))e.push(` - [${o.kind}] ${o.value} (${o.file})`);}if(r.unknownSignals.length>0){e.push("- **Unknowns:**");for(let o of r.unknownSignals.slice(0,5))e.push(` - ${o}`);}e.push("");}if(t.extended?.standards&&t.extended.standards.recommended.length>0){let r=t.extended.standards;e.push("## Recommended Standards"),e.push("");let o=r.projectPurposes.map(a=>`${a.project} \u2192 ${a.category}`).join(", ");if(o&&e.push(`- **Detected purpose:** ${o}`),r.frameworks.length>0){e.push("- **Compliance framework coverage:**");for(let a of r.frameworks)e.push(` - ${a.name}: ${a.recommendedMembers}/${a.totalMembers} member standards apply`);}e.push("- **Top standards to consider:**");for(let a of r.recommended.slice(0,10)){let i=a.complianceRelevant?" _(compliance)_":"";e.push(` - **${a.name}** \u2014 ${a.reason}${i}`);}e.push("");}if(t.findings.length>0){e.push("## Findings"),e.push(""),e.push("| Level | Rule | Message | Location |"),e.push("|-------|------|---------|----------|");for(let r of t.findings){let o=r.level==="error"?"\u{1F534}":r.level==="warning"?"\u{1F7E1}":"\u{1F535}";e.push(`| ${o} ${r.level} | ${r.ruleId} | ${r.message} | ${r.location} |`);}e.push("");}if(t.delta!==void 0){let r=t.delta>0?"\u{1F4C8}":t.delta<0?"\u{1F4C9}":"\u27A1\uFE0F";e.push(`## Drift Delta: ${r} ${t.delta>0?"+":""}${t.delta} vs baseline`),e.push("");}return e.join(`
51
- `)}async function ke(t,e){let n,s=new Promise(r=>{n=setTimeout(()=>r({ok:false}),e);});try{return await Promise.race([t.then(o=>({ok:!0,value:o})),s])}finally{clearTimeout(n);}}function jc(t,e){return new Promise((n,s)=>{let r=spawn(t,e,{stdio:["ignore","pipe","pipe"]}),o="",a="";r.stdout.on("data",i=>o+=String(i)),r.stderr.on("data",i=>a+=String(i)),r.on("error",s),r.on("close",i=>{if(i!==0){s(new Error(`${t} ${e.join(" ")} failed (code=${i}): ${a.trim()}`));return}n(o);});})}async function Ao(t,e){try{return JSON.parse(t)}catch{throw new Error(`Invalid JSON in package version manifest: ${e}`)}}async function Tc(t){let e=await mkdtemp(I.join(mn.tmpdir(),"vibgrate-manifest-"));try{await jc("unzip",["-qq",t,"-d",e]);let n=[I.join(e,"package-versions.json"),I.join(e,"manifest.json"),I.join(e,"index.json")];for(let s of n)try{let r=await readFile(s,"utf8");return await Ao(r,s)}catch{}throw new Error("Zip must contain package-versions.json, manifest.json, or index.json")}finally{await rm(e,{recursive:true,force:true});}}async function Cc(t){let e=I.resolve(t);if(e.toLowerCase().endsWith(".zip"))return Tc(e);let n=await readFile(e,"utf8");return Ao(n,e)}function G(t,e,n){if(!t)return;let s=t[e];if(s)return e==="nuget"?s[n.toLowerCase()]??s[n]:s[n]}function dn(t){return t.filter(e=>st.valid(e)&&st.prerelease(e)===null)}function zn(t){let e=dn(t);return e.length===0?null:e.sort(st.rcompare)[0]??null}function Ac(t){if(!t||typeof t!="object")return;let e={};for(let[n,s]of Object.entries(t))n==="created"||n==="modified"||typeof s=="string"&&(e[n]=s);return Object.keys(e).length>0?e:void 0}function Dn(t){let e=null,n=[],s=null,r;if(t&&typeof t=="object"){let i=t,c=i["dist-tags.latest"];typeof c=="string"&&(e=c);let l=i["dist-tags"];!e&&l&&typeof l=="object"&&typeof l.latest=="string"&&(e=l.latest);let u=i.versions;Array.isArray(u)?n=u.map(String):typeof u=="string"&&(n=[u]),s=Po(i.license??i.licenses),r=Ac(i.time);}let o=dn(n),a=zn(o);return !e&&a&&(e=a),{latest:e,stableVersions:o,latestStableOverall:a,license:s,...r?{releaseDates:r}:{}}}function Po(t){if(!t)return null;if(typeof t=="string")return t.trim()||null;if(Array.isArray(t)){let e=t.map(Po).filter(n=>!!n);return e.length===0?null:e.length===1?e[0]:`(${e.join(" OR ")})`}if(typeof t=="object"){let e=t;if(typeof e.type=="string")return e.type.trim()||null;if(typeof e.spdx=="string")return e.spdx.trim()||null}return null}var Pc=24,Mc=7e3,$c=3e4,Lc=process.platform==="win32"?"npm.cmd":"npm";function Nc(t,e=process.platform){let n=e==="win32"?Mc:$c,s=[],r=[],o=0;for(let a of t){let i=a.length+1;(r.length>=Pc||r.length>0&&o+i>n)&&(s.push(r),r=[],o=0),r.push(a),o+=i;}return r.length>0&&s.push(r),s}async function pn(t,e){return new Promise((n,s)=>{let r=spawn(Lc,["view",...t,"--json"],{cwd:e,stdio:["ignore","pipe","pipe"]}),o="",a="";r.stdout.on("data",i=>o+=String(i)),r.stderr.on("data",i=>a+=String(i)),r.on("error",s),r.on("close",i=>{if(i!==0){s(new Error(`npm view ${t.join(" ")} failed (code=${i}): ${a.trim()}`));return}let c=o.trim();if(!c){n(null);return}try{n(JSON.parse(c));}catch{n(c.replace(/^"|"$/g,""));}});})}var Rc=class{constructor(t,e,n,s=false){this.cwd=t,this.sem=e,this.manifest=n,this.offline=s;}meta=new Map;async prefetch(t){let n=[...new Set(t.filter(Boolean))].filter(r=>!this.meta.has(r));if(n.length===0)return;let s=this.sem.run(()=>this.fetchBatch(n));for(let r of n){let o=s.then(a=>a.get(r)??{latest:null,stableVersions:[],latestStableOverall:null,license:null});this.meta.set(r,o);}await s;}get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(()=>this.fetchOne(t));return this.meta.set(t,n),n}async fetchBatch(t){let e=new Map,n=[];for(let s of t){let r=G(this.manifest,"npm",s);if(r){let o=dn(r.versions??[]),a=zn(o);e.set(s,{latest:r.latest??a,stableVersions:o,latestStableOverall:a,license:r.license??null,...r.releaseDates?{releaseDates:r.releaseDates}:{}});}else this.offline?e.set(s,{latest:null,stableVersions:[],latestStableOverall:null,license:null}):n.push(s);}if(n.length===0)return e;for(let s of Nc(n)){let r=await this.fetchRemoteChunk(s);for(let[o,a]of r)e.set(o,a);}return e}async fetchRemoteChunk(t){let e=new Map;if(t.length===1)return e.set(t[0],await this.fetchOneRemote(t[0])),e;try{let n=await pn([...t,"dist-tags.latest","versions","license","licenses","time"],this.cwd);if(Array.isArray(n))for(let s=0;s<n.length&&s<t.length;s++)e.set(t[s],Dn(n[s]));else if(n&&typeof n=="object"){let s=n,r=0;for(let o of t)o in s&&(e.set(o,Dn(s[o])),r++);r===0&&t.length===1&&e.set(t[0],Dn(s));}}catch{}for(let n of t)e.has(n)||e.set(n,await this.fetchOneRemote(n));return e}async fetchOne(t){let e=G(this.manifest,"npm",t);if(e){let n=dn(e.versions??[]),s=zn(n);return {latest:e.latest??s,stableVersions:n,latestStableOverall:s,license:e.license??null,...e.releaseDates?{releaseDates:e.releaseDates}:{}}}return this.offline?{latest:null,stableVersions:[],latestStableOverall:null,license:null}:this.fetchOneRemote(t)}async fetchOneRemote(t){try{let e=await pn([t,"dist-tags.latest","versions","license","licenses","time"],this.cwd);return Dn(e)}catch{let e=null,n=[];try{let o=await pn([t,"dist-tags"],this.cwd);o&&typeof o=="object"&&typeof o.latest=="string"&&(e=o.latest);}catch{}try{let o=await pn([t,"versions"],this.cwd);Array.isArray(o)?n=o.map(String):typeof o=="string"&&(n=[o]);}catch{}let s=dn(n),r=zn(s);return !e&&r&&(e=r),{latest:e,stableVersions:s,latestStableOverall:r,license:null}}}};async function Ic(t){try{let e=new AbortController,n=setTimeout(()=>e.abort(),5e3),s=await fetch("https://registry.npmjs.org/npm/latest",{method:"HEAD",signal:e.signal});return clearTimeout(n),s.ok}catch{try{let e=await pn(["npm","dist-tags.latest"],t);return typeof e=="string"&&e.length>0}catch{return false}}}function Mo(t){let e=t.trim();return !e||e.startsWith("workspace:")||e.startsWith("file:")||e.startsWith("link:")||e.startsWith("git+")||e.includes("://")||e.startsWith("github:")?false:e==="*"||e.toLowerCase()==="latest"?true:st.validRange(e)!==null}function $o(t){switch(t){case "public-domain":case "permissive":return "low";case "weak-copyleft":return "medium";case "copyleft":case "network-copyleft":case "proprietary":return "high";default:return "medium"}}var Lo={attribution:false,copyleft:false,networkCopyleft:false,discloseSource:false,patentGrant:false,commercialRestriction:false};function _c(t){return {spdxId:t.id,name:t.name,family:t.family,category:t.category,osiApproved:t.osi??false,fsfLibre:t.fsf??false,deprecated:t.deprecated??false,referenceUrl:t.url??`https://spdx.org/licenses/${t.id}.html`,riskLevel:$o(t.category),obligations:{...Lo,...t.obligations??{}}}}var q={attribution:true},Fc={attribution:true,patentGrant:true},ie={attribution:true,copyleft:true,discloseSource:true},et={attribution:true,copyleft:true,discloseSource:true},Un={attribution:true,copyleft:true,networkCopyleft:true,discloseSource:true},Oc=[{id:"CC0-1.0",name:"Creative Commons Zero v1.0 Universal",family:"CC",category:"public-domain",fsf:true},{id:"Unlicense",name:"The Unlicense",family:"Public Domain",category:"public-domain",osi:true,fsf:true},{id:"0BSD",name:"BSD Zero Clause License",family:"BSD",category:"permissive",osi:true},{id:"WTFPL",name:"Do What The F*ck You Want To Public License",family:"WTFPL",category:"permissive",fsf:true},{id:"MIT",name:"MIT License",family:"MIT",category:"permissive",osi:true,fsf:true,obligations:q},{id:"MIT-0",name:"MIT No Attribution",family:"MIT",category:"permissive",osi:true},{id:"ISC",name:"ISC License",family:"ISC",category:"permissive",osi:true,fsf:true,obligations:q},{id:"BSD-2-Clause",name:'BSD 2-Clause "Simplified" License',family:"BSD",category:"permissive",osi:true,fsf:true,obligations:q},{id:"BSD-3-Clause",name:'BSD 3-Clause "New" or "Revised" License',family:"BSD",category:"permissive",osi:true,fsf:true,obligations:q},{id:"BSD-3-Clause-Clear",name:"BSD 3-Clause Clear License",family:"BSD",category:"permissive",osi:true,obligations:q},{id:"Apache-2.0",name:"Apache License 2.0",family:"Apache",category:"permissive",osi:true,fsf:true,obligations:Fc},{id:"Apache-1.1",name:"Apache Software License 1.1",family:"Apache",category:"permissive",osi:true,obligations:q},{id:"Zlib",name:"zlib License",family:"Zlib",category:"permissive",osi:true,fsf:true},{id:"BSL-1.0",name:"Boost Software License 1.0",family:"Boost",category:"permissive",osi:true,fsf:true,obligations:q},{id:"PostgreSQL",name:"PostgreSQL License",family:"BSD",category:"permissive",osi:true,obligations:q},{id:"Python-2.0",name:"Python License 2.0",family:"Python",category:"permissive",osi:true,obligations:q},{id:"PSF-2.0",name:"Python Software Foundation License 2.0",family:"Python",category:"permissive",obligations:q},{id:"Artistic-2.0",name:"Artistic License 2.0",family:"Artistic",category:"permissive",osi:true,fsf:true,obligations:q},{id:"NCSA",name:"University of Illinois/NCSA Open Source License",family:"NCSA",category:"permissive",osi:true,fsf:true,obligations:q},{id:"Unicode-DFS-2016",name:"Unicode License Agreement - Data Files and Software (2016)",family:"Unicode",category:"permissive",osi:true,obligations:q},{id:"BlueOak-1.0.0",name:"Blue Oak Model License 1.0.0",family:"BlueOak",category:"permissive",obligations:q},{id:"LGPL-2.0-only",name:"GNU Library General Public License v2 only",family:"LGPL",category:"weak-copyleft",osi:true,fsf:true,obligations:ie},{id:"LGPL-2.1-only",name:"GNU Lesser General Public License v2.1 only",family:"LGPL",category:"weak-copyleft",osi:true,fsf:true,obligations:ie},{id:"LGPL-2.1-or-later",name:"GNU Lesser General Public License v2.1 or later",family:"LGPL",category:"weak-copyleft",osi:true,fsf:true,obligations:ie},{id:"LGPL-3.0-only",name:"GNU Lesser General Public License v3.0 only",family:"LGPL",category:"weak-copyleft",osi:true,fsf:true,obligations:{...ie,patentGrant:true}},{id:"LGPL-3.0-or-later",name:"GNU Lesser General Public License v3.0 or later",family:"LGPL",category:"weak-copyleft",osi:true,fsf:true,obligations:{...ie,patentGrant:true}},{id:"MPL-2.0",name:"Mozilla Public License 2.0",family:"MPL",category:"weak-copyleft",osi:true,fsf:true,obligations:{...ie,patentGrant:true}},{id:"MPL-1.1",name:"Mozilla Public License 1.1",family:"MPL",category:"weak-copyleft",osi:true,fsf:true,obligations:ie},{id:"EPL-1.0",name:"Eclipse Public License 1.0",family:"EPL",category:"weak-copyleft",osi:true,fsf:true,obligations:{...ie,patentGrant:true}},{id:"EPL-2.0",name:"Eclipse Public License 2.0",family:"EPL",category:"weak-copyleft",osi:true,fsf:true,obligations:{...ie,patentGrant:true}},{id:"CDDL-1.0",name:"Common Development and Distribution License 1.0",family:"CDDL",category:"weak-copyleft",osi:true,fsf:true,obligations:ie},{id:"CDDL-1.1",name:"Common Development and Distribution License 1.1",family:"CDDL",category:"weak-copyleft",obligations:ie},{id:"CPL-1.0",name:"Common Public License 1.0",family:"CPL",category:"weak-copyleft",osi:true,fsf:true,obligations:ie},{id:"MS-PL",name:"Microsoft Public License",family:"Microsoft",category:"weak-copyleft",osi:true,fsf:true,obligations:q},{id:"MS-RL",name:"Microsoft Reciprocal License",family:"Microsoft",category:"weak-copyleft",osi:true,fsf:true,obligations:ie},{id:"GPL-2.0-only",name:"GNU General Public License v2.0 only",family:"GPL",category:"copyleft",osi:true,fsf:true,obligations:et},{id:"GPL-2.0-or-later",name:"GNU General Public License v2.0 or later",family:"GPL",category:"copyleft",osi:true,fsf:true,obligations:et},{id:"GPL-3.0-only",name:"GNU General Public License v3.0 only",family:"GPL",category:"copyleft",osi:true,fsf:true,obligations:{...et,patentGrant:true}},{id:"GPL-3.0-or-later",name:"GNU General Public License v3.0 or later",family:"GPL",category:"copyleft",osi:true,fsf:true,obligations:{...et,patentGrant:true}},{id:"EUPL-1.1",name:"European Union Public License 1.1",family:"EUPL",category:"copyleft",osi:true,fsf:true,obligations:et},{id:"EUPL-1.2",name:"European Union Public License 1.2",family:"EUPL",category:"copyleft",osi:true,fsf:true,obligations:et},{id:"OSL-3.0",name:"Open Software License 3.0",family:"OSL",category:"copyleft",osi:true,fsf:true,obligations:{...et,patentGrant:true}},{id:"CECILL-2.1",name:"CeCILL Free Software License Agreement v2.1",family:"CeCILL",category:"copyleft",osi:true,fsf:true,obligations:et},{id:"CC-BY-SA-4.0",name:"Creative Commons Attribution Share Alike 4.0 International",family:"CC",category:"copyleft",obligations:{attribution:true,copyleft:true}},{id:"AGPL-3.0-only",name:"GNU Affero General Public License v3.0 only",family:"AGPL",category:"network-copyleft",osi:true,fsf:true,obligations:{...Un,patentGrant:true}},{id:"AGPL-3.0-or-later",name:"GNU Affero General Public License v3.0 or later",family:"AGPL",category:"network-copyleft",osi:true,fsf:true,obligations:{...Un,patentGrant:true}},{id:"SSPL-1.0",name:"Server Side Public License 1.0",family:"SSPL",category:"network-copyleft",obligations:Un},{id:"BUSL-1.1",name:"Business Source License 1.1",family:"BUSL",category:"proprietary",obligations:{commercialRestriction:true,discloseSource:true}},{id:"Elastic-2.0",name:"Elastic License 2.0",family:"Elastic",category:"proprietary",obligations:{commercialRestriction:true}},{id:"RPL-1.5",name:"Reciprocal Public License 1.5",family:"RPL",category:"network-copyleft",osi:true,obligations:Un},{id:"Commons-Clause",name:"Commons Clause License Condition v1.0",family:"Commons-Clause",category:"proprietary",obligations:{commercialRestriction:true}},{id:"LicenseRef-Proprietary",name:"Proprietary / Commercial",family:"Proprietary",category:"proprietary",obligations:{commercialRestriction:true}},{id:"CC-BY-NC-4.0",name:"Creative Commons Attribution Non Commercial 4.0 International",family:"CC",category:"proprietary",obligations:{attribution:true,commercialRestriction:true}},{id:"CC-BY-4.0",name:"Creative Commons Attribution 4.0 International",family:"CC",category:"permissive",obligations:q}],Bc=Oc.map(_c),No=new Map;for(let t of Bc)No.set(t.spdxId.toLowerCase(),t);function D(t){return No.get(t.trim().toLowerCase())}function Jn(t="Unknown"){return {spdxId:"NOASSERTION",name:t,family:"Unknown",category:"unknown",osiApproved:false,fsfLibre:false,deprecated:false,referenceUrl:"",riskLevel:"medium",obligations:{...Lo}}}function Ro(t){return t.trim().toLowerCase().replace(/^\(+|\)+$/g,"").replace(/[._]/g,"-").replace(/\s+/g," ").replace(/\s*-\s*/g,"-").replace(/\bversion\b/g,"v").replace(/\blicen[sc]e\b/g,"").replace(/\s+/g," ").trim()}var Vc={mit:"MIT","mit license":"MIT","the mit license":"MIT",expat:"MIT",isc:"ISC",apache:"Apache-2.0","apache 2":"Apache-2.0",apache2:"Apache-2.0","apache 2.0":"Apache-2.0","apache-2":"Apache-2.0","apache license 2.0":"Apache-2.0","apache license version 2.0":"Apache-2.0","asl 2.0":"Apache-2.0",al2:"Apache-2.0",bsd:"BSD-3-Clause","bsd license":"BSD-3-Clause","bsd-2":"BSD-2-Clause","bsd 2-clause":"BSD-2-Clause","simplified bsd":"BSD-2-Clause",freebsd:"BSD-2-Clause","bsd-3":"BSD-3-Clause","bsd 3-clause":"BSD-3-Clause","new bsd":"BSD-3-Clause","modified bsd":"BSD-3-Clause","revised bsd":"BSD-3-Clause",gpl:"GPL-3.0-or-later",gplv2:"GPL-2.0-only",gpl2:"GPL-2.0-only","gpl-2":"GPL-2.0-only","gpl 2.0":"GPL-2.0-only","gpl-2.0":"GPL-2.0-only","gpl-2.0+":"GPL-2.0-or-later","gnu gpl v2":"GPL-2.0-only",gplv3:"GPL-3.0-only",gpl3:"GPL-3.0-only","gpl-3":"GPL-3.0-only","gpl 3.0":"GPL-3.0-only","gpl-3.0":"GPL-3.0-only","gpl-3.0+":"GPL-3.0-or-later","gnu gpl v3":"GPL-3.0-only","gnu general public v3":"GPL-3.0-only",lgpl:"LGPL-3.0-or-later","lgplv2.1":"LGPL-2.1-only","lgpl-2.1":"LGPL-2.1-only","lgpl 2.1":"LGPL-2.1-only",lgplv3:"LGPL-3.0-only","lgpl-3":"LGPL-3.0-only","lgpl-3.0":"LGPL-3.0-only","lgpl 3.0":"LGPL-3.0-only",agpl:"AGPL-3.0-or-later",agplv3:"AGPL-3.0-only","agpl-3":"AGPL-3.0-only","agpl-3.0":"AGPL-3.0-only","agpl 3.0":"AGPL-3.0-only","gnu agpl v3":"AGPL-3.0-only",mpl:"MPL-2.0","mpl 2.0":"MPL-2.0","mpl-2":"MPL-2.0","mozilla public 2.0":"MPL-2.0",epl:"EPL-2.0","eclipse public 2.0":"EPL-2.0","epl-2":"EPL-2.0",sspl:"SSPL-1.0","server side public":"SSPL-1.0",busl:"BUSL-1.1","business source":"BUSL-1.1",elastic:"Elastic-2.0","elastic-2":"Elastic-2.0","commons clause":"Commons-Clause",proprietary:"LicenseRef-Proprietary",commercial:"LicenseRef-Proprietary","see license in license":"LicenseRef-Proprietary",unlicensed:"LicenseRef-Proprietary","all rights reserved":"LicenseRef-Proprietary",cc0:"CC0-1.0","cc0 1.0":"CC0-1.0","public domain":"CC0-1.0","the unlicense":"Unlicense",wtfpl:"WTFPL",boost:"BSL-1.0",bsl:"BSL-1.0","zlib/libpng":"Zlib",python:"Python-2.0",psf:"PSF-2.0",artistic:"Artistic-2.0"},Io=new Map;for(let[t,e]of Object.entries(Vc))Io.set(Ro(t),e);function _o(t){return Io.get(Ro(t))}var Dc=/\(|\)|\bWITH\b|\bAND\b|\bOR\b|[^\s()]+/gi;function Uc(t){let e=(t??"").trim(),n=[],s=[],r=false,o=false,a=false,i=false,c=e.match(Dc)??[];for(let u of c){let p=u.toUpperCase();if(u==="("||u===")")continue;if(p==="OR"){r=true,i=false;continue}if(p==="AND"){o=true,i=false;continue}if(p==="WITH"){i=true;continue}if(i){s.includes(u)||s.push(u),i=false;continue}let d=u;d.endsWith("+")&&(a=true,d=d.slice(0,-1)),d&&!n.includes(d)&&n.push(d);}let l=r?"OR":o?"AND":"SINGLE";return {licenseIds:n,exceptions:s,operator:l,orLater:a,normalized:Gc(n,s,l,a,e)}}function Gc(t,e,n,s,r){if(t.length===0)return r.trim();if(t.length===1){let a=t[0];return s&&!a.endsWith("+")&&(a+="+"),e.length>0&&(a+=` WITH ${e.join(" WITH ")}`),a}let o=n==="AND"?" AND ":" OR ";return t.join(o)}function qc(t){return /\b(?:AND|OR|WITH)\b|\+\s*$|\(/i.test(t)}var so={"public-domain":0,permissive:1,"weak-copyleft":2,copyleft:3,"network-copyleft":4,proprietary:5,unknown:2};function be(t,e,n,s,r){return {spdxId:t.spdxId,name:t.name,expression:s??t.spdxId,family:t.family,category:t.category,riskLevel:t.riskLevel,osiApproved:t.osiApproved,fsfLibre:t.fsfLibre,obligations:t.obligations,matchStatus:e,confidence:n,components:r??[t.spdxId]}}function Fo(t){let e=t.toLowerCase();if(/\bagpl/.test(e))return D("AGPL-3.0-or-later");if(/\bsspl/.test(e))return D("SSPL-1.0");if(/\bbusl|business source/.test(e))return D("BUSL-1.1");if(/\blgpl/.test(e))return D("LGPL-3.0-or-later");if(/\bgpl/.test(e))return D("GPL-3.0-or-later");if(/\bmpl|mozilla/.test(e))return D("MPL-2.0");if(/\bepl|eclipse/.test(e))return D("EPL-2.0");if(/\bapache/.test(e))return D("Apache-2.0");if(/\bbsd/.test(e))return D("BSD-3-Clause");if(/\bmit\b/.test(e))return D("MIT");if(/\bisc\b/.test(e))return D("ISC");if(/commons clause/.test(e))return D("Commons-Clause");if(/proprietary|commercial|all rights reserved/.test(e))return D("LicenseRef-Proprietary");if(/public domain|cc0/.test(e))return D("CC0-1.0")}function Hc(t){let e=(t??"").trim();if(!e||/^(unknown|noassertion|none|n\/a)$/i.test(e))return be(Jn(),"unknown",0);let n=D(e);if(n)return be(n,"exact",1);if(qc(e))return Wc(e);let s=_o(e);if(s){let o=D(s);if(o)return be(o,"alias",.95)}let r=Fo(e);return r?{...be(r,"fuzzy",.6),name:e.slice(0,120)}:be(Jn(e.slice(0,120)),"unknown",0)}function Wc(t){let e=Uc(t);if(e.licenseIds.length===0)return be(Jn(t.slice(0,120)),"unknown",0);let n=e.licenseIds.map(c=>{let l=D(c);if(l)return be(l,"exact",1);let u=_o(c);if(u){let d=D(u);if(d)return be(d,"alias",.95)}let p=Fo(c);return p?be(p,"fuzzy",.6):be(Jn(c),"unknown",0)}),s=e.operator!=="OR",r=n[0];for(let c of n){let l=so[c.category]>so[r.category];(s?l:!l)&&(r=c);}let o=zc(s?n:[r]),a=n.map(c=>c.spdxId),i=r.category;return {spdxId:r.spdxId,name:e.normalized,expression:e.normalized,family:r.family,category:i,riskLevel:$o(i),osiApproved:n.every(c=>c.osiApproved),fsfLibre:n.every(c=>c.fsfLibre),obligations:o,matchStatus:"expression",confidence:Math.min(...n.map(c=>c.confidence))||.5,components:a}}function zc(t){let e={attribution:false,copyleft:false,networkCopyleft:false,discloseSource:false,patentGrant:false,commercialRestriction:false};for(let n of t)e.attribution||=n.obligations.attribution,e.copyleft||=n.obligations.copyleft,e.networkCopyleft||=n.obligations.networkCopyleft,e.discloseSource||=n.obligations.discloseSource,e.patentGrant||=n.obligations.patentGrant,e.commercialRestriction||=n.obligations.commercialRestriction;return e}function Jc(t,e){let n=(t??"").trim();if(!n)return {raw:null,spdxId:null,source:"none",confidence:0};let s=Hc(n);return {raw:n.slice(0,200),spdxId:s.matchStatus==="unknown"?null:s.spdxId,source:e,confidence:s.confidence}}var ro={react:"React","react-dom":"React DOM",vue:"Vue","@angular/core":"Angular",svelte:"Svelte","solid-js":"Solid",preact:"Preact",lit:"Lit",qwik:"Qwik","htmx.org":"htmx",alpinejs:"Alpine.js",stimulus:"Stimulus",next:"Next.js",nuxt:"Nuxt","@remix-run/react":"Remix","@remix-run/node":"Remix (Node)",gatsby:"Gatsby",astro:"Astro","@sveltejs/kit":"SvelteKit","@analogjs/platform":"Analog","@tanstack/start":"TanStack Start",express:"Express",fastify:"Fastify","@nestjs/core":"NestJS",hono:"Hono",koa:"Koa","@hapi/hapi":"Hapi",restify:"Restify","@elysiajs/eden":"Elysia",elysia:"Elysia","@adonisjs/core":"AdonisJS",moleculer:"Moleculer","@feathersjs/feathers":"Feathers",sails:"Sails",typescript:"TypeScript",redux:"Redux","@reduxjs/toolkit":"Redux Toolkit",zustand:"Zustand",mobx:"MobX",jotai:"Jotai",recoil:"Recoil",pinia:"Pinia",vuex:"Vuex","@tanstack/react-query":"TanStack Query",swr:"SWR",xstate:"XState","@ngrx/store":"NgRx",prisma:"Prisma","drizzle-orm":"Drizzle",typeorm:"TypeORM",sequelize:"Sequelize","@mikro-orm/core":"MikroORM",mongoose:"Mongoose",knex:"Knex",kysely:"Kysely",objection:"Objection.js",vite:"Vite",webpack:"webpack",rollup:"Rollup",esbuild:"esbuild",parcel:"Parcel",turbo:"Turbo",tsup:"tsup","@swc/core":"SWC",bun:"Bun",vitest:"Vitest",jest:"Jest","@playwright/test":"Playwright",cypress:"Cypress",mocha:"Mocha",ava:"AVA",storybook:"Storybook","@storybook/react":"Storybook"};async function Kc(t,e,n$1,s,r=je){let o=n$1?await n$1.findPackageJsonFiles(t):await j(t),a=[],i=new Map,c;try{let m=n$1?x=>n$1.pathExists(x):p,y=I.join(t,"package.json");if(await m(y))try{let x=n$1?await n$1.readJsonFile(y):await n(y);if(x.packageManager){let C=x.packageManager.split("@")[0]?.toLowerCase();C&&["pnpm","yarn","npm","bun"].includes(C)&&(c=C);}}catch{}c||await m(I.join(t,"pnpm-workspace.yaml"))&&(c="pnpm"),c||(await m(I.join(t,"pnpm-lock.yaml"))?c="pnpm":await m(I.join(t,"yarn.lock"))?c="yarn":await m(I.join(t,"package-lock.json"))?c="npm":await m(I.join(t,"bun.lockb"))&&(c="bun"));}catch{}let l=s??n$1?.projectScanTimeout??18e4,u=typeof mn.availableParallelism=="function"?mn.availableParallelism():mn.cpus().length||4,p$1=Math.max(2,Math.min(16,u*2)),d=new a$1(p$1),f=new Set;if(await Promise.all(o.map(async m=>{try{let y=n$1?await n$1.readJsonFile(m):await n(m),x=[y.dependencies,y.devDependencies,y.peerDependencies,y.optionalDependencies];for(let C of x)if(C)for(let[A,T]of Object.entries(C))Mo(T)&&f.add(A);}catch{}})),f.size>0)try{await e.prefetch([...f]);}catch{}let h=await Promise.all(o.map(async m=>d.run(async()=>{try{let y=Xc(m,t,e,n$1,r),x=await ke(y,l);if(x.ok)return x.value;let C=I.relative(t,I.dirname(m));return n$1&&n$1.addStuckPath(C||"."),console.error(`Timeout scanning ${m} (>${l/1e3}s) \u2014 skipped`),n$1?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects"),null}catch(y){let x=y instanceof Error?y.message:String(y);return console.error(`Error scanning ${m}: ${x}`),null}})));for(let m of h)m&&(a.push(m),i.set(m.name,m.path));for(let m of a){let y=[];for(let x of m.dependencies){let C=i.get(x.package);C&&C!==m.path&&y.push({path:C,name:x.package,refType:"workspace"});}y.length>0&&(m.projectReferences=y),c&&(m.packageManager=c);}return a}async function Xc(t,e,n$1,s,r){let o=s?await s.readJsonFile(t):await n(t),a=I.dirname(t),i=I.relative(e,a)||".",c=o.engines?.node??void 0,l,u,p,d;if(c){let b=ls(r,"nodejs"),v=we.minVersion(c);if(b&&v){let w=we.major(v);l=`${b.major}.0.0`,u=Math.max(0,b.major-w);}p=ct(r,"node",c);let S=Qe("node",c);S&&(d=at(r,"nodejs",S));}let f=[{name:"dependencies",deps:o.dependencies},{name:"devDependencies",deps:o.devDependencies},{name:"peerDependencies",deps:o.peerDependencies},{name:"optionalDependencies",deps:o.optionalDependencies}],h=[],m=[],y={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},x=[];for(let b of f)if(b.deps)for(let[v,S]of Object.entries(b.deps))Mo(S)&&x.push({pkg:v,section:b.name,spec:S});await n$1.prefetch(x.map(b=>b.pkg));let C=x.map(async b=>{let v=await n$1.get(b.pkg);return {...b,meta:v}}),A=await Promise.all(C);for(let{pkg:b,section:v,spec:S,meta:w}of A){let j=w.stableVersions.length>0?we.maxSatisfying(w.stableVersions,S)??null:null,g=w.latestStableOverall,P=null,L="unknown";if(j&&g){let se=we.major(j);P=we.major(g)-se,P===0?L=we.eq(j,g)?"current":"minor-behind":L="major-behind",P===0?y.current++:P===1?y.oneBehind++:y.twoPlusBehind++;}else y.unknown++;let V=Ya(j,g,w.releaseDates),le=Qa(V);h.push({package:b,section:v,currentSpec:S,resolvedVersion:j,latestStable:g,majorsBehind:P,drift:L,license:Jc(w.license,"registry"),ageDays:V,libyears:le}),b in ro&&m.push({name:ro[b],currentVersion:j,latestVersion:g,majorsBehind:P});}for(let b of f)if(b.deps)for(let[v,S]of Object.entries(b.deps))S.trim().startsWith("workspace:")&&(h.push({package:v,section:b.name,currentSpec:S,resolvedVersion:null,latestStable:null,majorsBehind:null,drift:"unknown",license:{raw:null,spdxId:null,source:"none",confidence:0}}),y.unknown++);h.sort((b,v)=>{let S={"major-behind":0,"minor-behind":1,current:2,unknown:3},w=(S[b.drift]??9)-(S[v.drift]??9);return w!==0?w:b.package.localeCompare(v.package)});let T;try{T=s?await s.countFilesUnder(e,a):void 0;}catch{}return {type:"node",path:i,name:o.name??I.basename(a),runtime:c,runtimeLatest:l,runtimeMajorsBehind:u,runtimeEol:p,runtimeEolDate:d,frameworks:m,dependencies:h,dependencyAgeBuckets:y,libyears:Za(h.map(b=>b.libyears))??void 0,fileCount:T}}var Oo=new Ze({ignoreAttributes:false,attributeNamePrefix:"@_"}),oo={"Microsoft.AspNetCore.App":"ASP.NET Core","Microsoft.AspNetCore.Mvc":"ASP.NET Core MVC","Microsoft.AspNetCore.Components":"Blazor","Microsoft.AspNetCore.Components.WebAssembly":"Blazor WASM","Microsoft.AspNetCore.SignalR":"SignalR","Microsoft.AspNetCore.OData":"OData","Microsoft.AspNetCore.Identity":"ASP.NET Identity","Microsoft.AspNetCore.Authentication.JwtBearer":"JWT Bearer Auth","Microsoft.AspNetCore.Diagnostics.HealthChecks":"Health Checks","Swashbuckle.AspNetCore":"Swashbuckle","NSwag.AspNetCore":"NSwag","Microsoft.EntityFrameworkCore":"EF Core","Microsoft.EntityFrameworkCore.SqlServer":"EF Core SQL Server","Microsoft.EntityFrameworkCore.Sqlite":"EF Core SQLite","Microsoft.EntityFrameworkCore.Design":"EF Core Design","Microsoft.EntityFrameworkCore.Tools":"EF Core Tools","Npgsql.EntityFrameworkCore.PostgreSQL":"EF Core PostgreSQL","Pomelo.EntityFrameworkCore.MySql":"EF Core MySQL (Pomelo)","MongoDB.EntityFrameworkCore":"EF Core MongoDB",Dapper:"Dapper","Dapper.Contrib":"Dapper Contrib",NHibernate:"NHibernate",Npgsql:"Npgsql",MySqlConnector:"MySqlConnector","MongoDB.Driver":"MongoDB Driver","StackExchange.Redis":"StackExchange.Redis","Microsoft.Data.SqlClient":"SqlClient","Oracle.ManagedDataAccess.Core":"Oracle (Managed)",Cassandra:"Cassandra Driver","Neo4j.Driver":"Neo4j Driver",Marten:"Marten",LiteDB:"LiteDB","RavenDB.Client":"RavenDB","Microsoft.Extensions.Hosting":".NET Hosting","Microsoft.Extensions.Hosting.Abstractions":".NET Hosting Abstractions","Microsoft.Extensions.DependencyInjection":".NET DI","Microsoft.Extensions.DependencyInjection.Abstractions":".NET DI Abstractions","Microsoft.Extensions.Configuration":".NET Configuration","Microsoft.Extensions.Configuration.Abstractions":".NET Configuration Abstractions","Microsoft.Extensions.Configuration.Binder":".NET Configuration Binder","Microsoft.Extensions.Configuration.EnvironmentVariables":".NET Configuration EnvVars","Microsoft.Extensions.Configuration.Json":".NET Configuration JSON","Microsoft.Extensions.Configuration.UserSecrets":".NET Configuration UserSecrets","Microsoft.Extensions.Logging":".NET Logging","Microsoft.Extensions.Logging.Abstractions":".NET Logging Abstractions","Microsoft.Extensions.Logging.Console":".NET Logging Console","Microsoft.Extensions.Logging.Debug":".NET Logging Debug","Microsoft.Extensions.Logging.EventSource":".NET Logging EventSource","Microsoft.Extensions.Options":".NET Options","Microsoft.Extensions.Options.ConfigurationExtensions":".NET Options Configuration","Microsoft.Extensions.Options.DataAnnotations":".NET Options DataAnnotations","Microsoft.Extensions.Caching.Memory":".NET Memory Cache","Microsoft.Extensions.Caching.Abstractions":".NET Caching Abstractions","Microsoft.Extensions.Caching.StackExchangeRedis":".NET Redis Cache","Microsoft.Extensions.Http":".NET HttpClientFactory","Microsoft.Extensions.Http.Resilience":".NET HttpClient Resilience","Microsoft.Extensions.Resilience":".NET Resilience","Microsoft.Extensions.Diagnostics":".NET Diagnostics","Microsoft.Extensions.Diagnostics.HealthChecks":".NET Health Checks (Extensions)","Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions":".NET Health Checks Abstractions","Microsoft.Extensions.FileProviders.Abstractions":".NET File Providers","Microsoft.Extensions.FileProviders.Physical":".NET File Providers Physical","Microsoft.Extensions.Localization":".NET Localization","Microsoft.Extensions.Localization.Abstractions":".NET Localization Abstractions","Microsoft.Extensions.Primitives":".NET Primitives","System.Text.Json":".NET System.Text.Json","System.Text.Encodings.Web":".NET System.Text.Encodings.Web","System.Net.Http.Json":".NET System.Net.Http.Json","System.ComponentModel.Annotations":".NET ComponentModel Annotations",MediatR:"MediatR",Wolverine:"Wolverine",Brighter:"Brighter",AutoMapper:"AutoMapper",Mapster:"Mapster","Riok.Mapperly":"Mapperly",FluentValidation:"FluentValidation","FluentValidation.AspNetCore":"FluentValidation ASP.NET","Newtonsoft.Json":"Newtonsoft.Json",MessagePack:"MessagePack","protobuf-net":"protobuf-net",CsvHelper:"CsvHelper",Serilog:"Serilog","Serilog.AspNetCore":"Serilog ASP.NET","Serilog.Sinks.Console":"Serilog Console","Serilog.Sinks.Seq":"Serilog Seq","Serilog.Sinks.File":"Serilog File","Serilog.Sinks.Elasticsearch":"Serilog Elasticsearch",NLog:"NLog","NLog.Web.AspNetCore":"NLog ASP.NET",log4net:"log4net",OpenTelemetry:"OpenTelemetry","OpenTelemetry.Extensions.Hosting":"OpenTelemetry Hosting","OpenTelemetry.Instrumentation.AspNetCore":"OpenTelemetry ASP.NET","OpenTelemetry.Exporter.Prometheus":"OpenTelemetry Prometheus","OpenTelemetry.Exporter.Jaeger":"OpenTelemetry Jaeger","OpenTelemetry.Exporter.OpenTelemetryProtocol":"OpenTelemetry OTLP","App.Metrics":"App.Metrics","prometheus-net":"Prometheus.NET","Elastic.Apm":"Elastic APM",xunit:"xUnit","xunit.runner.visualstudio":"xUnit Runner",NUnit:"NUnit",NUnit3TestAdapter:"NUnit Adapter","MSTest.TestFramework":"MSTest","MSTest.TestAdapter":"MSTest Adapter",Moq:"Moq",NSubstitute:"NSubstitute",FakeItEasy:"FakeItEasy",FluentAssertions:"FluentAssertions",Shouldly:"Shouldly",Bogus:"Bogus",AutoFixture:"AutoFixture","WireMock.Net":"WireMock.Net",Testcontainers:"Testcontainers",Respawn:"Respawn",BenchmarkDotNet:"BenchmarkDotNet","coverlet.collector":"Coverlet",SpecFlow:"SpecFlow",TUnit:"TUnit","Verify.Xunit":"Verify",Snapshooter:"Snapshooter",MassTransit:"MassTransit","MassTransit.RabbitMQ":"MassTransit RabbitMQ","MassTransit.Azure.ServiceBus.Core":"MassTransit Azure SB",NServiceBus:"NServiceBus","RabbitMQ.Client":"RabbitMQ Client","Confluent.Kafka":"Confluent Kafka","Azure.Messaging.ServiceBus":"Azure Service Bus","Azure.Messaging.EventHubs":"Azure Event Hubs","Amazon.SQS":"AWS SQS","Amazon.SNS":"AWS SNS",Rebus:"Rebus",EasyNetQ:"EasyNetQ",SlimMessageBus:"SlimMessageBus",CAP:"DotNetCore.CAP","AWSSDK.Core":"AWS SDK Core","AWSSDK.S3":"AWS SDK S3","AWSSDK.SQS":"AWS SDK SQS","AWSSDK.DynamoDBv2":"AWS SDK DynamoDB","AWSSDK.Lambda":"AWS SDK Lambda","AWSSDK.SecretsManager":"AWS SDK Secrets Manager","AWSSDK.CloudWatch":"AWS SDK CloudWatch","Azure.Storage.Blobs":"Azure Blob Storage","Azure.Identity":"Azure Identity","Azure.Security.KeyVault.Secrets":"Azure Key Vault","Azure.Cosmos":"Azure Cosmos DB","Microsoft.Azure.Functions.Worker":"Azure Functions","Google.Cloud.Storage.V1":"GCP Storage","Google.Cloud.PubSub.V1":"GCP Pub/Sub","Google.Cloud.Firestore":"GCP Firestore","Microsoft.Identity.Web":"Microsoft Identity Web","Microsoft.Identity.Client":"MSAL",IdentityServer4:"IdentityServer4","Duende.IdentityServer":"Duende IdentityServer","Microsoft.AspNetCore.Authentication.OpenIdConnect":"OpenID Connect",IdentityModel:"IdentityModel",Refit:"Refit",RestSharp:"RestSharp","Flurl.Http":"Flurl",Polly:"Polly","Polly.Extensions.Http":"Polly HTTP","Microsoft.Extensions.Http.Polly":"HttpClient Polly","Grpc.AspNetCore":"gRPC ASP.NET","Grpc.Net.Client":"gRPC Client","GraphQL.Server.All":"GraphQL Server","HotChocolate.AspNetCore":"Hot Chocolate (GraphQL)",Hangfire:"Hangfire","Hangfire.Core":"Hangfire Core","Hangfire.AspNetCore":"Hangfire ASP.NET",Quartz:"Quartz.NET","Quartz.Extensions.Hosting":"Quartz.NET Hosting",Coravel:"Coravel",EPPlus:"EPPlus",ClosedXML:"ClosedXML",iTextSharp:"iTextSharp",QuestPDF:"QuestPDF",ImageSharp:"ImageSharp","SixLabors.ImageSharp":"ImageSharp","LaunchDarkly.ServerSdk":"LaunchDarkly","Microsoft.FeatureManagement":"Feature Management","Microsoft.FeatureManagement.AspNetCore":"Feature Management ASP.NET","Dapr.Client":"Dapr","Steeltoe.Discovery.ClientCore":"Steeltoe",Ocelot:"Ocelot (API Gateway)","Yarp.ReverseProxy":"YARP","Microsoft.AspNetCore.SignalR.Client":"SignalR Client"};function Ms(t){return t.replace(/\\/g,"/")}function Yc(t){let e=t.match(/^net(\d+)\.\d+$/);if(e?.[1])return parseInt(e[1],10);let n=t.match(/^netcoreapp(\d+)\.\d+$/);return n?.[1]?parseInt(n[1],10):(t.startsWith("netstandard")||t.match(/^net(\d)(\d+)?$/),null)}function io(t){return t.endsWith(".csproj")||t.endsWith(".vbproj")}function $s(t){return I.basename(t).replace(/\.(cs|vb)proj$/i,"")}function Qc(t,e){let s=Oo.parse(t)?.Project;if(!s)return {targetFrameworks:[],packageReferences:[],projectReferences:[],projectName:$s(e)};let r=Array.isArray(s.PropertyGroup)?s.PropertyGroup:s.PropertyGroup?[s.PropertyGroup]:[],o=[];for(let l of r)if(l.TargetFramework&&o.push(String(l.TargetFramework)),l.TargetFrameworks){let u=String(l.TargetFrameworks).split(";").map(p=>p.trim()).filter(Boolean);o.push(...u);}let a=Array.isArray(s.ItemGroup)?s.ItemGroup:s.ItemGroup?[s.ItemGroup]:[],i=[],c=[];for(let l of a){let u=Array.isArray(l.PackageReference)?l.PackageReference:l.PackageReference?[l.PackageReference]:[];for(let d of u){let f=d["@_Include"]??d["@_include"]??"",h=d["@_Version"]??d["@_version"]??d.Version??"";f&&h&&i.push({name:String(f),version:String(h)});}let p=Array.isArray(l.ProjectReference)?l.ProjectReference:l.ProjectReference?[l.ProjectReference]:[];for(let d of p){let f=d["@_Include"]??d["@_include"]??"";f&&c.push(String(f).replace(/\\/g,"/"));}}return {targetFrameworks:[...new Set(o)],packageReferences:i,projectReferences:c,projectName:$s(e)}}function Zc(t){let n=Oo.parse(t)?.packages;if(!n)return [];let s=Array.isArray(n.package)?n.package:n.package?[n.package]:[],r=[];for(let o of s){let a=o["@_id"]??o["@_Id"]??"",i=o["@_version"]??o["@_Version"]??"";a&&i&&r.push({name:String(a),version:String(i)});}return r}async function el(t,e,n,s,r=je){let o$1=n?await n.findFiles(t,io):await i(t,io),a=n?await n.findSolutionFiles(t):await k(t),i$1=new Set;for(let p of a)try{let d=n?await n.readTextFile(p):await o(p),f=I.dirname(p),h=/Project\("[^"]*"\)\s*=\s*"[^"]*",\s*"([^"]+\.(?:cs|vb)proj)"/g,m;for(;(m=h.exec(d))!==null;)if(m[1]){let y=I.resolve(f,m[1].replace(/\\/g,"/"));i$1.add(y);}}catch{}let c=new Set([...o$1,...i$1]),l=[],u=s??n?.projectScanTimeout??18e4;for(let p of c)try{let d=tl(p,t,e,n,r),f=await ke(d,u);if(f.ok)l.push(f.value);else {let h=Ms(I.relative(t,I.dirname(p)));n&&n.addStuckPath(h||"."),console.error(`Timeout scanning ${p} (>${u/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(d){let f=d instanceof Error?d.message:String(d);console.error(`Error scanning ${p}: ${f}`);}return l}async function tl(t,e,n,s,r){let o$1=s?await s.readTextFile(t):await o(t),a=Qc(o$1,t),i=I.dirname(t);{let b=I.join(i,"packages.config");try{let v=s?await s.readTextFile(b):await o(b),S=new Set(a.packageReferences.map(w=>w.name.toLowerCase()));for(let w of Zc(v))S.has(w.name.toLowerCase())||(a.packageReferences.push(w),S.add(w.name.toLowerCase()));}catch{}}let c=a.targetFrameworks[0],l=Zt(r,"dotnet")?.major,u,p,d,f=c;if(c){let b=Yc(c);b!==null&&l!==void 0&&(u=Math.max(0,l-b)),p=ct(r,"dotnet",c);let v=Qe("dotnet",c);v&&(d=at(r,"dotnet",v));}let h=[],m={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};if(n){let b=a.packageReferences.map(async S=>{let w=await n.get(S.name);return {ref:S,meta:w}}),v=await Promise.all(b);for(let{ref:S,meta:w}of v){let j=vt.valid(S.version)?S.version:null,g=w.latestStableOverall,P=null,L="unknown";if(j&&g){let V=vt.major(j);P=vt.major(g)-V,P===0?L=vt.eq(j,g)?"current":"minor-behind":P>0?L="major-behind":L="current",P<=0?m.current++:P===1?m.oneBehind++:m.twoPlusBehind++;}else m.unknown++;h.push({package:S.name,section:"dependencies",currentSpec:S.version,resolvedVersion:j,latestStable:g,majorsBehind:P,drift:L});}}else for(let b of a.packageReferences)h.push({package:b.name,section:"dependencies",currentSpec:b.version,resolvedVersion:b.version,latestStable:null,majorsBehind:null,drift:"unknown"}),m.unknown++;let y=[],x=new Map(h.map(b=>[b.package,b]));for(let b of a.packageReferences)if(b.name in oo){let v=x.get(b.name);y.push({name:oo[b.name],currentVersion:v?.resolvedVersion??b.version,latestVersion:v?.latestStable??null,majorsBehind:v?.majorsBehind??null});}let C=a.projectReferences.map(b=>{let v=I.resolve(i,b),S=Ms(I.relative(e,I.dirname(v))),w=$s(v);return {path:S||".",name:w,refType:"project"}}),A;try{A=s?await s.countFilesUnder(e,i):void 0;}catch{}h.sort((b,v)=>{let S={"major-behind":0,"minor-behind":1,current:2,unknown:3},w=(S[b.drift]??9)-(S[v.drift]??9);return w!==0?w:b.package.localeCompare(v.package)});let T=m;return {type:"dotnet",path:Ms(I.relative(e,i))||".",name:a.projectName,targetFramework:f,runtime:c,runtimeLatest:l!==void 0?`net${l}.0`:void 0,runtimeMajorsBehind:u,runtimeEol:p,runtimeEolDate:d,frameworks:y,dependencies:h,dependencyAgeBuckets:T,projectReferences:C.length>0?C:void 0,fileCount:A}}var ao={django:"Django",flask:"Flask",fastapi:"FastAPI",starlette:"Starlette",tornado:"Tornado",bottle:"Bottle",sanic:"Sanic",falcon:"Falcon",aiohttp:"aiohttp",quart:"Quart",litestar:"Litestar",robyn:"Robyn",sqlalchemy:"SQLAlchemy","django-rest-framework":"DRF",djangorestframework:"DRF",peewee:"Peewee","tortoise-orm":"Tortoise ORM",sqlmodel:"SQLModel",pony:"Pony ORM",alembic:"Alembic",psycopg2:"psycopg2","psycopg2-binary":"psycopg2",psycopg:"psycopg3",asyncpg:"asyncpg",pymongo:"PyMongo",motor:"Motor",redis:"redis-py",celery:"Celery",boto3:"AWS SDK (boto3)",botocore:"AWS SDK (botocore)",numpy:"NumPy",pandas:"pandas",scipy:"SciPy","scikit-learn":"scikit-learn",tensorflow:"TensorFlow",torch:"PyTorch",keras:"Keras",matplotlib:"Matplotlib",seaborn:"Seaborn",plotly:"Plotly",polars:"Polars",dask:"Dask",xgboost:"XGBoost",lightgbm:"LightGBM",transformers:"Transformers (HF)",langchain:"LangChain",openai:"OpenAI SDK",pytest:"pytest",unittest2:"unittest2",nose2:"nose2",tox:"tox",hypothesis:"Hypothesis","factory-boy":"factory_boy",faker:"Faker",coverage:"Coverage.py",responses:"responses",httpx:"HTTPX",uvicorn:"Uvicorn",gunicorn:"Gunicorn",hypercorn:"Hypercorn",dramatiq:"Dramatiq",rq:"RQ",huey:"Huey",pyjwt:"PyJWT",authlib:"Authlib","python-jose":"python-jose",passlib:"Passlib",cryptography:"cryptography",pydantic:"Pydantic",marshmallow:"Marshmallow",attrs:"attrs",cerberus:"Cerberus",msgpack:"msgpack",protobuf:"protobuf",requests:"Requests",urllib3:"urllib3",ansible:"Ansible",fabric:"Fabric",invoke:"Invoke",paramiko:"Paramiko",black:"Black",ruff:"Ruff",flake8:"Flake8",mypy:"mypy",pylint:"Pylint",isort:"isort",bandit:"Bandit",structlog:"structlog",loguru:"Loguru","sentry-sdk":"Sentry SDK","opentelemetry-api":"OpenTelemetry","prometheus-client":"prometheus-client"};function Bs(t){let e=t.trim();if(!e||e.startsWith("#")||e.startsWith("-"))return null;let s=e.split(";")[0].trim().match(/^([A-Za-z0-9][-A-Za-z0-9_.]*[A-Za-z0-9]?)(?:\[.*?\])?\s*(.*)?$/);if(!s)return null;let r=s[1],o=(s[2]??"").trim(),a=r.toLowerCase().replace(/[_.]+/g,"-");return {name:r,spec:o,normalisedName:a}}function nl(t){return t.match(/^==\s*([^\s,;]+)/)?.[1]??null}function sl(t){let e=t.replace(/^[vV]/,"").trim();if(/(?:a\d|b\d|rc\d|alpha|beta|dev|post)/i.test(e))return null;let n=e.split(".");for(;n.length<3;)n.push("0");return e=n.slice(0,3).join("."),bt.valid(e)}function rl(t){let e=[];for(let n of t.split(`
52
- `)){let s=Bs(n);s&&e.push(s);}return e}function ol(t){let e={dependencies:[]},n=t.match(/^\s*name\s*=\s*"([^"]+)"/m);n&&(e.projectName=n[1]);let s=t.match(/^\s*requires-python\s*=\s*"([^"]+)"/m);s&&(e.pythonVersion=s[1]);let r=t.match(/^\s*dependencies\s*=\s*\[([\s\S]*?)\]/m);if(r){let a=r[1],i=/"([^"]+)"/g,c;for(;(c=i.exec(a))!==null;){let l=Bs(c[1]);l&&e.dependencies.push(l);}}let o=t.match(/\[tool\.poetry\.dependencies\]([\s\S]*?)(?=\n\s*\[|\n*$)/);if(o){let a=o[1].split(`
53
- `);for(let i of a){let c=i.match(/^\s*([A-Za-z0-9][-A-Za-z0-9_.]*)\s*=\s*(?:"([^"]+)"|{.*?version\s*=\s*"([^"]+)".*?})/);if(c){let l=c[1];if(l.toLowerCase()==="python"){e.pythonVersion=c[2]??c[3]??void 0;continue}let u=c[2]??c[3]??"",p=l.toLowerCase().replace(/[_.]+/g,"-");e.dependencies.push({name:l,spec:u?`==${u}`:"",normalisedName:p});}}}return e}function il(t){let e=[],n=t.match(/\[packages\]([\s\S]*?)(?=\n\s*\[|\n*$)/);if(n){let r=n[1].split(`
54
- `);for(let o of r){let a=o.match(/^\s*([A-Za-z0-9][-A-Za-z0-9_.]*)\s*=\s*(?:"([^"]+)"|{.*?version\s*=\s*"([^"]+)".*?}|\*|"[*]")/);if(a){let i=a[1],c=a[2]??a[3]??"",l=i.toLowerCase().replace(/[_.]+/g,"-");e.push({name:i,spec:c||"*",normalisedName:l});}}}let s=t.match(/\[dev-packages\]([\s\S]*?)(?=\n\s*\[|\n*$)/);if(s){let r=s[1].split(`
55
- `);for(let o of r){let a=o.match(/^\s*([A-Za-z0-9][-A-Za-z0-9_.]*)\s*=\s*(?:"([^"]+)"|{.*?version\s*=\s*"([^"]+)".*?}|\*|"[*]")/);if(a){let i=a[1],c=a[2]??a[3]??"",l=i.toLowerCase().replace(/[_.]+/g,"-");e.push({name:i,spec:c||"*",normalisedName:l});}}}return e}function al(t){let e={deps:[]},n=t.match(/\[metadata\]([\s\S]*?)(?=\n\s*\[|\n*$)/);if(n){let r=n[1].match(/^\s*name\s*=\s*(.+)$/m);r&&(e.name=r[1].trim());}let s=t.match(/\[options\]([\s\S]*?)(?=\n\s*\[|\n*$)/);if(s){let r=s[1].match(/^\s*python_requires\s*=\s*(.+)$/m);r&&(e.pythonVersion=r[1].trim());let o=s[1].match(/install_requires\s*=\s*\n((?:\s+.*\n?)*)/);if(o){let a=o[1];for(let i of a.split(`
56
- `)){let c=Bs(i);c&&e.deps.push(c);}}}return e}var Bo=new Set(["requirements.txt","requirements-dev.txt","requirements_dev.txt","requirements-test.txt","dev-requirements.txt","pyproject.toml","setup.py","setup.cfg","Pipfile"]);async function cl(t,e,n,s,r=je){let o=n?await n.findFiles(t,l=>Bo.has(l)||/^requirements.*\.txt$/.test(l)):await ll(t),a=new Map;for(let l of o){let u=I.dirname(l);a.has(u)||a.set(u,[]),a.get(u).push(l);}let i=[],c=s??n?.projectScanTimeout??18e4;for(let[l,u]of a)try{let p=ul(l,u,t,e,n,r),d=await ke(p,c);if(d.ok)i.push(d.value);else {let f=I.relative(t,l);n&&n.addStuckPath(f||"."),console.error(`Timeout scanning Python project ${l} (>${c/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(p){let d=p instanceof Error?p.message:String(p);console.error(`Error scanning Python project ${l}: ${d}`);}return i}async function ll(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Bo.has(n)||/^requirements.*\.txt$/.test(n))}async function ul(t,e,n,s,r,o$1){let a=I.relative(n,t)||".",i=I.basename(t===n?n:t),c,l=new Map;for(let b of e){let v=I.basename(b),S=r?await r.readTextFile(b):await o(b);if(v==="pyproject.toml"){let w=ol(S);w.projectName&&(i=w.projectName),w.pythonVersion&&(c=w.pythonVersion);for(let j of w.dependencies)l.has(j.normalisedName)||l.set(j.normalisedName,j);}else if(v==="setup.cfg"){let w=al(S);w.name&&(i=w.name),w.pythonVersion&&!c&&(c=w.pythonVersion);for(let j of w.deps)l.has(j.normalisedName)||l.set(j.normalisedName,j);}else if(v==="Pipfile")for(let w of il(S))l.has(w.normalisedName)||l.set(w.normalisedName,w);else if(v.startsWith("requirements")&&v.endsWith(".txt"))for(let w of rl(S))l.has(w.normalisedName)||l.set(w.normalisedName,w);}let u,p,d,f;if(c){let b=c.match(/(\d+)\.(\d+)/);if(b){let S=parseInt(b[1],10),w=parseInt(b[2],10),j=Zt(o$1,"python");j&&(S===j.major?u=Math.max(0,j.minor-w):S<j.major&&(u=j.minor+(j.major-S)*10),p=`${j.major}.${j.minor}`);}d=ct(o$1,"python",c);let v=Qe("python",c);v&&(f=at(o$1,"python",v));}let h=[],m=[],y={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},C=[...l.values()].map(async b=>{let v=await s.get(b.normalisedName);return {dep:b,meta:v}}),A=await Promise.all(C);for(let{dep:b,meta:v}of A){let S=nl(b.spec),w=S?sl(S):null,j=v.latestStableOverall,g=null,P="unknown";if(w&&j){let L=bt.major(w);g=bt.major(j)-L,g===0?P=bt.eq(w,j)?"current":"minor-behind":g>0?P="major-behind":P="current",g<=0?y.current++:g===1?y.oneBehind++:y.twoPlusBehind++;}else y.unknown++;h.push({package:b.name,section:"dependencies",currentSpec:b.spec||"*",resolvedVersion:w,latestStable:j,majorsBehind:g,drift:P}),b.normalisedName in ao&&m.push({name:ao[b.normalisedName],currentVersion:w,latestVersion:j,majorsBehind:g});}h.sort((b,v)=>{let S={"major-behind":0,"minor-behind":1,current:2,unknown:3},w=(S[b.drift]??9)-(S[v.drift]??9);return w!==0?w:b.package.localeCompare(v.package)});let T;try{T=r?await r.countFilesUnder(n,t):void 0;}catch{}return {type:"python",path:a,name:i,runtime:c,runtimeLatest:p,runtimeMajorsBehind:u,runtimeEol:d,runtimeEolDate:f,frameworks:m,dependencies:h,dependencyAgeBuckets:y,fileCount:T}}var pl=new Ze({ignoreAttributes:false,attributeNamePrefix:"@_"}),co={"org.springframework.boot:spring-boot-starter-web":"Spring Boot Web","org.springframework.boot:spring-boot-starter":"Spring Boot","org.springframework.boot:spring-boot-starter-data-jpa":"Spring Data JPA","org.springframework.boot:spring-boot-starter-security":"Spring Security","org.springframework.boot:spring-boot-starter-webflux":"Spring WebFlux","org.springframework.boot:spring-boot-starter-actuator":"Spring Actuator","org.springframework.boot:spring-boot-starter-test":"Spring Boot Test","org.springframework:spring-core":"Spring Framework","org.springframework:spring-web":"Spring Web","org.springframework:spring-webmvc":"Spring MVC","org.springframework.cloud:spring-cloud-starter-netflix-eureka-client":"Spring Cloud Eureka","org.springframework.cloud:spring-cloud-starter-gateway":"Spring Cloud Gateway","org.springframework.kafka:spring-kafka":"Spring Kafka","jakarta.platform:jakarta.jakartaee-api":"Jakarta EE","jakarta.servlet:jakarta.servlet-api":"Jakarta Servlet","javax.servlet:javax.servlet-api":"Java Servlet (Legacy)","io.micronaut:micronaut-core":"Micronaut","io.micronaut:micronaut-http-server-netty":"Micronaut HTTP","io.quarkus:quarkus-core":"Quarkus","io.quarkus:quarkus-resteasy":"Quarkus RESTEasy","io.quarkus:quarkus-resteasy-reactive":"Quarkus RESTEasy Reactive","io.vertx:vertx-core":"Vert.x","io.vertx:vertx-web":"Vert.x Web","org.hibernate.orm:hibernate-core":"Hibernate","org.hibernate:hibernate-core":"Hibernate","org.mybatis:mybatis":"MyBatis","org.mybatis.spring.boot:mybatis-spring-boot-starter":"MyBatis Spring Boot","org.jooq:jooq":"jOOQ","org.flywaydb:flyway-core":"Flyway","org.liquibase:liquibase-core":"Liquibase","com.zaxxer:HikariCP":"HikariCP","org.postgresql:postgresql":"PostgreSQL JDBC","com.mysql:mysql-connector-j":"MySQL Connector","mysql:mysql-connector-java":"MySQL Connector (Legacy)","com.oracle.database.jdbc:ojdbc11":"Oracle JDBC","org.mongodb:mongodb-driver-sync":"MongoDB Driver","io.lettuce:lettuce-core":"Lettuce (Redis)","redis.clients:jedis":"Jedis (Redis)","org.apache.kafka:kafka-clients":"Apache Kafka","com.rabbitmq:amqp-client":"RabbitMQ Client","software.amazon.awssdk:sqs":"AWS SQS","software.amazon.awssdk:sns":"AWS SNS","com.squareup.okhttp3:okhttp":"OkHttp","com.squareup.retrofit2:retrofit":"Retrofit","org.apache.httpcomponents.client5:httpclient5":"Apache HttpClient 5","io.grpc:grpc-netty":"gRPC","com.graphql-java:graphql-java":"GraphQL Java","com.netflix.graphql.dgs:graphql-dgs-spring-boot-starter":"Netflix DGS","com.fasterxml.jackson.core:jackson-databind":"Jackson","com.google.code.gson:gson":"Gson","junit:junit":"JUnit 4","org.junit.jupiter:junit-jupiter":"JUnit 5","org.junit.jupiter:junit-jupiter-api":"JUnit 5","org.mockito:mockito-core":"Mockito","org.assertj:assertj-core":"AssertJ","org.testcontainers:testcontainers":"Testcontainers","io.rest-assured:rest-assured":"REST Assured","org.awaitility:awaitility":"Awaitility","com.tngtech.archunit:archunit-junit5":"ArchUnit","org.hamcrest:hamcrest":"Hamcrest","org.slf4j:slf4j-api":"SLF4J","ch.qos.logback:logback-classic":"Logback","org.apache.logging.log4j:log4j-core":"Log4j2","org.projectlombok:lombok":"Lombok","org.mapstruct:mapstruct":"MapStruct","software.amazon.awssdk:bom":"AWS SDK v2","com.google.cloud:google-cloud-bom":"Google Cloud SDK","com.azure:azure-sdk-bom":"Azure SDK","io.jsonwebtoken:jjwt-api":"JJWT","com.nimbusds:nimbus-jose-jwt":"Nimbus JOSE+JWT","io.micrometer:micrometer-core":"Micrometer","io.opentelemetry:opentelemetry-api":"OpenTelemetry","io.prometheus:simpleclient":"Prometheus Client","io.projectreactor:reactor-core":"Project Reactor","io.reactivex.rxjava3:rxjava":"RxJava 3"};function dl(t,e){let s=pl.parse(t)?.project;if(!s)return {artifactId:I.basename(I.dirname(e)),dependencies:[],modules:[],properties:{}};let r={};if(s.properties&&typeof s.properties=="object")for(let[m,y]of Object.entries(s.properties))(typeof y=="string"||typeof y=="number")&&(r[m]=String(y));let o,a=["java.version","maven.compiler.source","maven.compiler.target","maven.compiler.release","java.source.version"];for(let m of a)if(r[m]){o=String(r[m]);break}let i=s.dependencies,l=(i?.dependency?Array.isArray(i.dependency)?i.dependency:[i.dependency]:[]).filter(m=>m.groupId&&m.artifactId).map(m=>({groupId:Ut(String(m.groupId??""),r),artifactId:Ut(String(m.artifactId??""),r),version:Ut(String(m.version??""),r),scope:m.scope?String(m.scope):void 0})),u=s.dependencyManagement?.dependencies,p=u?.dependency?Array.isArray(u.dependency)?u.dependency:[u.dependency]:[];for(let m of p)m.groupId&&m.artifactId&&m.version&&l.push({groupId:Ut(String(m.groupId),r),artifactId:Ut(String(m.artifactId),r),version:Ut(String(m.version),r),scope:m.scope?String(m.scope):void 0});let f=(s.modules?.module?Array.isArray(s.modules.module)?s.modules.module:[s.modules.module]:[]).map(String),h;return s.parent?.groupId&&s.parent?.artifactId&&(h={groupId:String(s.parent.groupId),artifactId:String(s.parent.artifactId),version:String(s.parent.version??"")}),{groupId:s.groupId?String(s.groupId):h?.groupId,artifactId:String(s.artifactId??I.basename(I.dirname(e))),version:s.version?String(s.version):h?.version,packaging:s.packaging?String(s.packaging):void 0,javaVersion:o,dependencies:l,modules:f,parent:h,properties:r}}function Ut(t,e){return t.replace(/\$\{([^}]+)\}/g,(n,s)=>e[s]??`\${${s}}`)}function fl(t,e){let n=[],s=I.basename(I.dirname(e)),r,o=t.match(/(?:sourceCompatibility|targetCompatibility|javaVersion)\s*[=:]\s*['"]?(?:JavaVersion\.VERSION_)?(\d+)['"]?/);o&&(r=o[1]);let a=t.match(/JavaLanguageVersion\.of\((\d+)\)/);a&&(r=a[1]);let i=/(?:implementation|api|compileOnly|runtimeOnly|testImplementation|testRuntimeOnly|annotationProcessor|kapt)\s*(?:\(?\s*)?['"]([^'"]+)['"]/g,c;for(;(c=i.exec(t))!==null;){let p=c[1].split(":");p.length>=2&&n.push({groupId:p[0],artifactId:p[1],version:p[2]??"",configuration:c[0].split(/\s/)[0]});}let l=/(?:implementation|api|compileOnly|runtimeOnly|testImplementation|testRuntimeOnly|annotationProcessor|kapt)\s*\(\s*"([^"]+)"\s*\)/g;for(;(c=l.exec(t))!==null;){let p=c[1].split(":");if(p.length>=2){let d=`${p[0]}:${p[1]}`;n.some(f=>`${f.groupId}:${f.artifactId}`===d)||n.push({groupId:p[0],artifactId:p[1],version:p[2]??"",configuration:c[0].split(/\s/)[0]});}}let u=/(?:implementation|api)\s*(?:\(?\s*)?platform\s*\(\s*['"]([^'"]+)['"]\s*\)/g;for(;(c=u.exec(t))!==null;){let p=c[1].split(":");p.length>=2&&n.push({groupId:p[0],artifactId:p[1],version:p[2]??"",configuration:"platform"});}return {javaVersion:r,dependencies:n,projectName:s}}function ml(t){let e=t.trim();if(!e||e.includes("$")||/(?:[-.](?:SNAPSHOT|alpha|beta|rc|M\d+|CR\d+))/i.test(e))return null;e=e.replace(/\.(?:RELEASE|Final|GA)$/i,"");let n=e.split(".");for(;n.length<3;)n.push("0");return e=n.slice(0,3).join("."),wt.valid(e)}var Vo=new Set(["pom.xml","build.gradle","build.gradle.kts"]);async function hl(t,e,n,s,r=je){let o=n?await n.findFiles(t,u=>Vo.has(u)):await gl(t),a=new Map;for(let u of o){let p=I.dirname(u);a.has(p)||a.set(p,[]),a.get(p).push(u);}let i=[],c=s??n?.projectScanTimeout??18e4;for(let[u,p]of a)try{let d=yl(u,p,t,e,n,r),f=await ke(d,c);if(f.ok)i.push(f.value);else {let h=I.relative(t,u);n&&n.addStuckPath(h||"."),console.error(`Timeout scanning Java project ${u} (>${c/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(d){let f=d instanceof Error?d.message:String(d);console.error(`Error scanning Java project ${u}: ${f}`);}let l=new Map;for(let u of i)l.set(u.name,u.path);return i}async function gl(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Vo.has(n))}async function yl(t,e,n,s,r,o$1){let a=I.relative(n,t)||".",i=I.basename(t===n?n:t),c,l=new Map,u=[];for(let S of e){let w=I.basename(S),j=r?await r.readTextFile(S):await o(S);if(w==="pom.xml"){let g=dl(j,S);g.artifactId&&(i=g.artifactId),g.javaVersion&&(c=g.javaVersion);for(let P of g.dependencies){let L=`${P.groupId}:${P.artifactId}`;!l.has(L)&&P.version&&!P.version.includes("${")&&l.set(L,P);}for(let P of g.modules)u.push({path:I.join(a,P),name:P,refType:"project"});}else if(w==="build.gradle"||w==="build.gradle.kts"){let g=fl(j,S);g.projectName&&(i=g.projectName),g.javaVersion&&(c=g.javaVersion);for(let P of g.dependencies){let L=`${P.groupId}:${P.artifactId}`;!l.has(L)&&P.version&&l.set(L,P);}}}let p,d,f,h=ls(o$1,"java")?.major,m=h!==void 0?String(h):void 0;if(c){let S=c.match(/^(1\.)?(\d+)/);if(S){let j=(S[1],parseInt(S[2],10));h!==void 0&&(p=Math.max(0,h-j));}d=ct(o$1,"java",c);let w=Qe("java",c);w&&(f=at(o$1,"java",w));}let y=[],x=[],C={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},T=[...l.entries()].map(async([S,w])=>{let j=await s.get(w.groupId,w.artifactId);return {key:S,dep:w,meta:j}}),b=await Promise.all(T);for(let{key:S,dep:w,meta:j}of b){let g=ml(w.version),P=j.latestStableOverall,L=null,V="unknown";if(g&&P){let le=wt.major(g);L=wt.major(P)-le,L===0?V=wt.eq(g,P)?"current":"minor-behind":L>0?V="major-behind":V="current",L<=0?C.current++:L===1?C.oneBehind++:C.twoPlusBehind++;}else C.unknown++;y.push({package:S,section:"dependencies",currentSpec:w.version,resolvedVersion:g,latestStable:P,majorsBehind:L,drift:V}),S in co&&x.push({name:co[S],currentVersion:g,latestVersion:P,majorsBehind:L});}y.sort((S,w)=>{let j={"major-behind":0,"minor-behind":1,current:2,unknown:3},g=(j[S.drift]??9)-(j[w.drift]??9);return g!==0?g:S.package.localeCompare(w.package)});let v;try{v=r?await r.countFilesUnder(n,t):void 0;}catch{}return {type:"java",path:a,name:i,runtime:c?`Java ${c}`:void 0,runtimeLatest:m,runtimeMajorsBehind:p,runtimeEol:d,runtimeEolDate:f,targetFramework:c?`Java ${c}`:void 0,frameworks:x,dependencies:y,dependencyAgeBuckets:C,projectReferences:u.length>0?u:void 0,fileCount:v}}var lo={rails:"Ruby on Rails",sinatra:"Sinatra",hanami:"Hanami",padrino:"Padrino",roda:"Roda",grape:"Grape",cuba:"Cuba",camping:"Camping",ramaze:"Ramaze","jsonapi-resources":"JSONAPI::Resources",active_model_serializers:"AMS",blueprinter:"Blueprinter",alba:"Alba","grape-entity":"Grape Entity",jbuilder:"Jbuilder",graphql:"GraphQL Ruby",activerecord:"ActiveRecord",sequel:"Sequel","rom-rb":"ROM",mongoid:"Mongoid",redis:"redis-rb",pg:"pg (PostgreSQL)",mysql2:"mysql2",sqlite3:"sqlite3",sidekiq:"Sidekiq",resque:"Resque",delayed_job:"Delayed Job",good_job:"GoodJob",solid_queue:"Solid Queue",que:"Que",rspec:"RSpec","rspec-rails":"RSpec Rails",minitest:"Minitest",capybara:"Capybara",factory_bot:"FactoryBot",factory_bot_rails:"FactoryBot Rails",faker:"Faker","shoulda-matchers":"Shoulda Matchers",vcr:"VCR",webmock:"WebMock",simplecov:"SimpleCov",cucumber:"Cucumber",devise:"Devise",omniauth:"OmniAuth",pundit:"Pundit",cancancan:"CanCanCan",rodauth:"Rodauth",jwt:"JWT",doorkeeper:"Doorkeeper","turbo-rails":"Turbo","stimulus-rails":"Stimulus","importmap-rails":"Importmap Rails",sprockets:"Sprockets",webpacker:"Webpacker","cssbundling-rails":"CSS Bundling","jsbundling-rails":"JS Bundling","tailwindcss-rails":"Tailwind CSS Rails",propshaft:"Propshaft",faraday:"Faraday",httparty:"HTTParty","rest-client":"REST Client",typhoeus:"Typhoeus",httpx:"HTTPX",puma:"Puma",unicorn:"Unicorn",thin:"Thin",passenger:"Passenger",falcon:"Falcon",capistrano:"Capistrano",kamal:"Kamal",mina:"Mina","sentry-ruby":"Sentry","sentry-rails":"Sentry Rails",newrelic_rpm:"New Relic",datadog:"Datadog",lograge:"Lograge",rubocop:"RuboCop","rubocop-rails":"RuboCop Rails","rubocop-rspec":"RuboCop RSpec","rubocop-performance":"RuboCop Performance",brakeman:"Brakeman","bundler-audit":"Bundler Audit",standard:"Standard",kaminari:"Kaminari",pagy:"Pagy",ransack:"Ransack",searchkick:"Searchkick","elasticsearch-rails":"Elasticsearch Rails",carrierwave:"CarrierWave",shrine:"Shrine",active_storage:"Active Storage",activeadmin:"ActiveAdmin",administrate:"Administrate",avo:"Avo",aasm:"AASM",statesman:"Statesman",dotenv:"dotenv",figaro:"Figaro"};function vl(t){let e=t.trim();if(!e||e.startsWith("#"))return null;let n=e.match(/^\s*gem\s+['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"])?/);if(!n)return null;let s=n[1],r=n[2]??"*";return {name:s,spec:r}}function bl(t){if(t==="*")return null;let e=t.match(/(?:~>|>=|>|=|<=|<)?\s*(\d+(?:\.\d+)*)/);return e?e[1]:null}function wl(t){let e=t.trim();if(/(?:\.pre|\.rc|\.beta|\.alpha|\.dev)/i.test(e))return null;let n=e.split(".");if(n.length<2)return null;for(;n.length<3;)n.push("0");let s=n.slice(0,3).join(".");return St.valid(s)}function Sl(t){let e=[],n="default",s=[];for(let r of t.split(/\r?\n/)){let o=r.trim(),a=o.match(/^\s*group\s+:(\w+)/);if(a){s.push(n);let u=a[1].toLowerCase();u==="development"||u==="dev"?n="development":u==="test"&&(n="test");}if(o==="end"&&s.length>0){n=s.pop();continue}let i=vl(o);if(!i)continue;let c=n,l=o.match(/group:\s*(?::(\w+)|\[([^\]]+)\])/);if(l){let u=(l[1]??l[2]??"").toLowerCase();u.includes("development")||u.includes("dev")?c="development":u.includes("test")&&(c="test");}e.push({name:i.name,spec:i.spec,group:c});}return e}function kl(t){let e=[];for(let n of t.split(/\r?\n/)){let r=n.trim().match(/\.add_(runtime_|development_)?dependency\s+['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"])?/);if(!r)continue;let o=r[1]??"runtime_",a=r[2],i=r[3]??"*";e.push({name:a,spec:i,group:o.startsWith("development")?"development":"default"});}return e}function El(t){return t.match(/^\s*ruby\s+['"]([^'"]+)['"]/m)?.[1]}var Do=new Set(["Gemfile"]);function Vs(t){return t.endsWith(".gemspec")}async function xl(t,e,n,s,r=je){let o=n?await n.findFiles(t,l=>Do.has(l)||Vs(l)):await jl(t),a=new Map;for(let l of o){let u=I.dirname(l);a.has(u)||a.set(u,[]),a.get(u).push(l);}let i=[],c=s??n?.projectScanTimeout??18e4;for(let[l,u]of a)try{let p=Tl(l,u,t,e,n,r),d=await ke(p,c);if(d.ok)i.push(d.value);else {let f=I.relative(t,l);n&&n.addStuckPath(f||"."),console.error(`Timeout scanning Ruby project ${l} (>${c/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(p){let d=p instanceof Error?p.message:String(p);console.error(`Error scanning Ruby project ${l}: ${d}`);}return i}async function jl(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Do.has(n)||Vs(n))}async function Tl(t,e,n,s,r,o$1){let a=I.relative(n,t)||".",i=I.basename(t===n?n:t),c,l=new Map;for(let b of e){let v=I.basename(b),S=r?await r.readTextFile(b):await o(b);if(v==="Gemfile"){let w=El(S);w&&(c=w);for(let j of Sl(S))l.has(j.name)||l.set(j.name,j);}else if(Vs(v)){let w=v.replace(/\.gemspec$/,"");w&&(i=w);for(let j of kl(S))l.has(j.name)||l.set(j.name,j);}}let u,p,d,f;if(c){let b=c.match(/(\d+)\.(\d+)/);if(b){let S=parseInt(b[1],10),w=parseInt(b[2],10),j=Zt(o$1,"ruby");j&&(S===j.major?u=Math.max(0,j.minor-w):S<j.major&&(u=j.minor+(j.major-S)*10),p=`${j.major}.${j.minor}`);}d=ct(o$1,"ruby",c);let v=Qe("ruby",c);v&&(f=at(o$1,"ruby",v));}let h=[],m=[],y={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},C=[...l.values()].map(async b=>{let v=await s.get(b.name);return {dep:b,meta:v}}),A=await Promise.all(C);for(let{dep:b,meta:v}of A){let S=bl(b.spec),w=S?wl(S):null,j=v.latestStableOverall,g=null,P="unknown";if(w&&j){let V=St.major(w);g=St.major(j)-V,g===0?P=St.eq(w,j)?"current":"minor-behind":g>0?P="major-behind":P="current",g<=0?y.current++:g===1?y.oneBehind++:y.twoPlusBehind++;}else y.unknown++;let L=b.group==="development"||b.group==="test"?"devDependencies":"dependencies";h.push({package:b.name,section:L,currentSpec:b.spec,resolvedVersion:w,latestStable:j,majorsBehind:g,drift:P}),b.name in lo&&m.push({name:lo[b.name],currentVersion:w,latestVersion:j,majorsBehind:g});}h.sort((b,v)=>{let S={"major-behind":0,"minor-behind":1,current:2,unknown:3},w=(S[b.drift]??9)-(S[v.drift]??9);return w!==0?w:b.package.localeCompare(v.package)});let T;try{T=r?await r.countFilesUnder(n,t):void 0;}catch{}return {type:"ruby",path:a,name:i,runtime:c,runtimeLatest:p,runtimeMajorsBehind:u,runtimeEol:d,runtimeEolDate:f,frameworks:m,dependencies:h,dependencyAgeBuckets:y,fileCount:T}}var uo={vapor:"Vapor",hummingbird:"Hummingbird",perfect:"Perfect",kitura:"Kitura",alamofire:"Alamofire",moya:"Moya","apollo-ios":"Apollo iOS",fluent:"Fluent","sqlite.swift":"SQLite.swift","realm-swift":"Realm Swift","grdb.swift":"GRDB.swift",kingfisher:"Kingfisher",snapkit:"SnapKit",sdwebimage:"SDWebImage",rxswift:"RxSwift",combine:"Combine",reactiveswift:"ReactiveSwift",quick:"Quick",nimble:"Nimble",snapshotTesting:"SnapshotTesting",swiftlog:"SwiftLog",cocoalumberjack:"CocoaLumberjack",swinject:"Swinject",needle:"Needle",swiftyjson:"SwiftyJSON",promisekit:"PromiseKit",then:"Then"},dt={major:6,minor:0};function Cl(t){let e=[],n=/\.package\s*\(\s*url:\s*"([^"]+)"[^)]*?(from|exact|upToNextMajor|revision|branch):\s*"([^"]+)"/g,s;for(;(s=n.exec(t))!==null;){let r=s[1],o=s[2],a=s[3],c=r.match(/\/([^/]+?)(\.git)?$/)?.[1]??r,l="range",u=a;o==="exact"?l="exact":o==="branch"?l="branch":o==="revision"&&(l="revision"),e.push({name:c,url:r,version:u,type:l});}return e}function Al(t){let e=new Map;try{let n=JSON.parse(t);if(!n.pins)return e;for(let s of n.pins)!s.identity||!s.state?.version||e.set(s.identity.toLowerCase(),s.state.version);}catch{}return e}function Pl(t){return t.match(/\/\/\s*swift-tools-version:\s*(\d+\.\d+)/i)?.[1]}var Uo=new Set(["Package.swift"]);async function Ml(t,e,n,s){let r=n?await n.findFiles(t,i=>Uo.has(i)):await $l(t),o=[],a=s??n?.projectScanTimeout??18e4;for(let i of r){let c=I.dirname(i);try{let l=Ll(c,i,t,e,n),u=await ke(l,a);if(u.ok)o.push(u.value);else {let p=I.relative(t,c);n&&n.addStuckPath(p||"."),console.error(`Timeout scanning Swift project ${c} (>${a/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(l){let u=l instanceof Error?l.message:String(l);console.error(`Error scanning Swift project ${c}: ${u}`);}}return o}async function $l(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Uo.has(n))}async function Ll(t,e,n,s,r){let o$1=I.relative(n,t)||".",a=I.basename(t===n?n:t),i=r?await r.readTextFile(e):await o(e),c=Pl(i),l=Cl(i),u=I.join(t,"Package.resolved"),p=new Map;try{let T=r?await r.readTextFile(u):await o(u);p=Al(T);}catch{}let d,f;if(c){let T=c.match(/(\d+)\.(\d+)/);if(T){let b=parseInt(T[1],10),v=parseInt(T[2],10);b===dt.major?d=Math.max(0,dt.minor-v):b<dt.major&&(d=(dt.major-b)*10+dt.minor),f=`${dt.major}.${dt.minor}`;}}let h=[],m=[],y={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},x=l.map(async T=>{let b=await s.get(T.url);return {dep:T,meta:b}}),C=await Promise.all(x);for(let{dep:T,meta:b}of C){let v=p.get(T.name.toLowerCase())??(T.type==="exact"?T.version:null),S=v?Ce.valid(Ce.clean(v)):null,w=b.latestStableOverall,j=null,g="unknown";if(S&&w){let L=Ce.major(S);j=Ce.major(w)-L,j===0?g=Ce.eq(S,w)?"current":"minor-behind":j>0?g="major-behind":g="current",j<=0?y.current++:j===1?y.oneBehind++:y.twoPlusBehind++;}else y.unknown++;h.push({package:T.name,section:"dependencies",currentSpec:T.version,resolvedVersion:S,latestStable:w,majorsBehind:j,drift:g});let P=T.name.toLowerCase();P in uo&&m.push({name:uo[P],currentVersion:S,latestVersion:w,majorsBehind:j});}h.sort((T,b)=>{let v={"major-behind":0,"minor-behind":1,current:2,unknown:3},S=(v[T.drift]??9)-(v[b.drift]??9);return S!==0?S:T.package.localeCompare(b.package)});let A;try{A=r?await r.countFilesUnder(n,t):void 0;}catch{}return {type:"swift",path:o$1,name:a,runtime:c,runtimeLatest:f,runtimeMajorsBehind:d,frameworks:m,dependencies:h,dependencyAgeBuckets:y,fileCount:A}}var po={"github.com/gin-gonic/gin":"Gin","github.com/labstack/echo":"Echo","github.com/gofiber/fiber":"Fiber","github.com/gorilla/mux":"Gorilla Mux","github.com/go-chi/chi":"Chi","github.com/beego/beego":"Beego","github.com/revel/revel":"Revel","k8s.io/kubernetes":"Kubernetes","k8s.io/client-go":"Kubernetes Client","github.com/prometheus/prometheus":"Prometheus","github.com/prometheus/client_golang":"Prometheus Client","go.etcd.io/etcd":"etcd","github.com/hashicorp/consul":"Consul","github.com/hashicorp/vault":"Vault","github.com/traefik/traefik":"Traefik","github.com/istio/istio":"Istio","gorm.io/gorm":"GORM","github.com/jmoiron/sqlx":"sqlx","github.com/go-sql-driver/mysql":"MySQL Driver","github.com/lib/pq":"PostgreSQL Driver","go.mongodb.org/mongo-driver":"MongoDB Driver","github.com/redis/go-redis":"Redis Client","github.com/go-redis/redis":"go-redis","google.golang.org/grpc":"gRPC","google.golang.org/protobuf":"Protobuf","github.com/grpc-ecosystem/grpc-gateway":"gRPC Gateway","github.com/stretchr/testify":"Testify","github.com/onsi/ginkgo":"Ginkgo","github.com/onsi/gomega":"Gomega","github.com/golang/mock":"GoMock","go.uber.org/zap":"Zap","github.com/sirupsen/logrus":"Logrus","github.com/rs/zerolog":"Zerolog","github.com/spf13/viper":"Viper","github.com/spf13/cobra":"Cobra","github.com/urfave/cli":"urfave/cli","github.com/go-resty/resty":"Resty","github.com/json-iterator/go":"jsoniter","gopkg.in/yaml.v3":"YAML v3","github.com/segmentio/kafka-go":"kafka-go","github.com/rabbitmq/amqp091-go":"RabbitMQ","github.com/nats-io/nats.go":"NATS","github.com/google/uuid":"UUID","github.com/spf13/cast":"Cast","github.com/pkg/errors":"pkg/errors"};function Nl(t){let e=[],n,s=false;for(let r of t.split(/\r?\n/)){let o=r.trim();if(o.startsWith("go ")){let l=o.match(/^go\s+(\d+\.\d+)/);l&&(n=l[1]);continue}if(o.startsWith("require (")){s=true;continue}if(o===")"&&s){s=false;continue}let a=o;if(s)a=o;else if(o.startsWith("require "))a=o.substring(8);else continue;let i=a.includes("// indirect");a=a.replace(/\/\/.*$/,"").trim();let c=a.split(/\s+/);if(c.length>=2){let[l,u]=c;l&&u&&e.push({path:l,version:u,indirect:i});}}return {goVersion:n,deps:e}}var Go=new Set(["go.mod"]);async function Rl(t,e,n,s,r=je){let o=n?await n.findFiles(t,c=>Go.has(c)):await Il(t),a=[],i=s??n?.projectScanTimeout??18e4;for(let c of o){let l=I.dirname(c);try{let u=_l(l,c,t,e,n,r),p=await ke(u,i);if(p.ok)a.push(p.value);else {let d=I.relative(t,l);n&&n.addStuckPath(d||"."),console.error(`Timeout scanning Go project ${l} (>${i/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(u){let p=u instanceof Error?u.message:String(u);console.error(`Error scanning Go project ${l}: ${p}`);}}return a}async function Il(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Go.has(n))}async function _l(t,e,n,s,r,o$1){let a=I.relative(n,t)||".",i=I.basename(t===n?n:t),c=r?await r.readTextFile(e):await o(e),{goVersion:l,deps:u}=Nl(c),p=u.filter(v=>!v.indirect),d,f,h,m;if(l){let v=l.match(/(\d+)\.(\d+)/);if(v){let w=parseInt(v[1],10),j=parseInt(v[2],10),g=Zt(o$1,"go");g&&(w===g.major?d=Math.max(0,g.minor-j):w<g.major&&(d=g.minor+(g.major-w)*100),f=`${g.major}.${g.minor}`);}h=ct(o$1,"go",l);let S=Qe("go",l);S&&(m=at(o$1,"go",S));}let y=[],x=[],C={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},A=p.map(async v=>{let S=await s.get(v.path);return {dep:v,meta:S}}),T=await Promise.all(A);for(let{dep:v,meta:S}of T){let w=Ae.valid(Ae.clean(v.version)),j=S.latestStableOverall,g=null,P="unknown";if(w&&j){let L=Ae.major(w);g=Ae.major(j)-L,g===0?P=Ae.eq(w,j)?"current":"minor-behind":g>0?P="major-behind":P="current",g<=0?C.current++:g===1?C.oneBehind++:C.twoPlusBehind++;}else C.unknown++;y.push({package:v.path,section:"dependencies",currentSpec:v.version,resolvedVersion:w,latestStable:j,majorsBehind:g,drift:P}),v.path in po&&x.push({name:po[v.path],currentVersion:w,latestVersion:j,majorsBehind:g});}y.sort((v,S)=>{let w={"major-behind":0,"minor-behind":1,current:2,unknown:3},j=(w[v.drift]??9)-(w[S.drift]??9);return j!==0?j:v.package.localeCompare(S.package)});let b;try{b=r?await r.countFilesUnder(n,t):void 0;}catch{}return {type:"go",path:a,name:i,runtime:l,runtimeLatest:f,runtimeMajorsBehind:d,runtimeEol:h,runtimeEolDate:m,frameworks:x,dependencies:y,dependencyAgeBuckets:C,fileCount:b}}var fo={"actix-web":"Actix Web",rocket:"Rocket",axum:"Axum",warp:"Warp",tide:"Tide",poem:"Poem",tokio:"Tokio","async-std":"async-std",smol:"smol",serde:"Serde",serde_json:"Serde JSON",bincode:"Bincode",toml:"TOML",diesel:"Diesel",sqlx:"SQLx","sea-orm":"SeaORM",reqwest:"reqwest",hyper:"hyper",ureq:"ureq",clap:"clap",structopt:"structopt",log:"log",env_logger:"env_logger",tracing:"tracing","tracing-subscriber":"tracing-subscriber",anyhow:"anyhow",thiserror:"thiserror",eyre:"eyre",criterion:"Criterion",proptest:"proptest",mockall:"mockall",ring:"ring",rustls:"rustls",webpki:"webpki",bevy:"Bevy",wgpu:"wgpu",winit:"winit","wasm-bindgen":"wasm-bindgen","wasm-pack":"wasm-pack",substrate:"Substrate",ethers:"ethers-rs"};function Fl(t){let e=[],n=null;for(let s of t.split(/\r?\n/)){let r=s.trim();if(r==="[dependencies]"){n="dependencies";continue}else if(r==="[dev-dependencies]"){n="dev-dependencies";continue}else if(r.startsWith("[")&&r.endsWith("]")){n=null;continue}if(!n)continue;let o=r.match(/^([\w-]+)\s*=\s*"([^"]+)"/);if(o){e.push({name:o[1],version:o[2],optional:false,features:[],isDev:n==="dev-dependencies"});continue}let a=r.match(/^([\w-]+)\s*=\s*\{([^}]+)\}/);if(a){let i=a[1],c=a[2],u=c.match(/version\s*=\s*"([^"]+)"/)?.[1]??"*",d=!!c.match(/optional\s*=\s*true/),f=c.match(/features\s*=\s*\[([^\]]*)\]/),h=f?f[1].split(",").map(m=>m.trim().replace(/"/g,"")):[];e.push({name:i,version:u,optional:d,features:h,isDev:n==="dev-dependencies"});}}return e}function Ol(t){return t.match(/^\s*edition\s*=\s*"(\d+)"/m)?.[1]}var qo=new Set(["Cargo.toml"]);async function Bl(t,e,n,s){let r=n?await n.findFiles(t,i=>qo.has(i)):await Vl(t),o=[],a=s??n?.projectScanTimeout??18e4;for(let i of r){let c=I.dirname(i);try{let l=Dl(c,i,t,e,n),u=await ke(l,a);if(u.ok)o.push(u.value);else {let p=I.relative(t,c);n&&n.addStuckPath(p||"."),console.error(`Timeout scanning Rust project ${c} (>${a/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(l){let u=l instanceof Error?l.message:String(l);console.error(`Error scanning Rust project ${c}: ${u}`);}}return o}async function Vl(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>qo.has(n))}async function Dl(t,e,n,s,r){let o$1=I.relative(n,t)||".",a=I.basename(t===n?n:t),i=r?await r.readTextFile(e):await o(e),c=Ol(i),u=Fl(i).filter(A=>!A.isDev),p,d;if(c){let A=parseInt(c,10),T=2024;p=Math.max(0,Math.floor((T-A)/3)),d=T.toString();}let f=[],h=[],m={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},y=u.map(async A=>{let T=await s.get(A.name);return {dep:A,meta:T}}),x=await Promise.all(y);for(let{dep:A,meta:T}of x){let b=Pe.valid(Pe.coerce(A.version)),v=T.latestStableOverall,S=null,w="unknown";if(b&&v){let g=Pe.major(b);S=Pe.major(v)-g,S===0?w=Pe.eq(b,v)?"current":"minor-behind":S>0?w="major-behind":w="current",S<=0?m.current++:S===1?m.oneBehind++:m.twoPlusBehind++;}else m.unknown++;let j=A.isDev?"devDependencies":"dependencies";f.push({package:A.name,section:j,currentSpec:A.version,resolvedVersion:b,latestStable:v,majorsBehind:S,drift:w}),A.name in fo&&h.push({name:fo[A.name],currentVersion:b,latestVersion:v,majorsBehind:S});}f.sort((A,T)=>{let b={"major-behind":0,"minor-behind":1,current:2,unknown:3},v=(b[A.drift]??9)-(b[T.drift]??9);return v!==0?v:A.package.localeCompare(T.package)});let C;try{C=r?await r.countFilesUnder(n,t):void 0;}catch{}return {type:"rust",path:o$1,name:a,runtime:c,runtimeLatest:d,runtimeMajorsBehind:p,frameworks:h,dependencies:f,dependencyAgeBuckets:m,fileCount:C}}var mo={"laravel/framework":"Laravel","symfony/symfony":"Symfony","symfony/http-foundation":"Symfony HttpFoundation","cakephp/cakephp":"CakePHP","yiisoft/yii2":"Yii 2","codeigniter4/framework":"CodeIgniter","slim/slim":"Slim","laminas/laminas-mvc":"Laminas","roots/wordpress":"WordPress","johnpbloch/wordpress":"WordPress Core","doctrine/orm":"Doctrine ORM","doctrine/dbal":"Doctrine DBAL","illuminate/database":"Laravel Eloquent","propel/propel":"Propel","phpunit/phpunit":"PHPUnit","pestphp/pest":"Pest","behat/behat":"Behat","codeception/codeception":"Codeception","mockery/mockery":"Mockery","guzzlehttp/guzzle":"Guzzle","symfony/http-client":"Symfony HttpClient","twig/twig":"Twig","smarty/smarty":"Smarty","league/plates":"Plates","firebase/php-jwt":"PHP-JWT","lcobucci/jwt":"JWT","league/fractal":"Fractal","api-platform/core":"API Platform","symfony/console":"Symfony Console","monolog/monolog":"Monolog","nesbot/carbon":"Carbon","ramsey/uuid":"UUID","vlucas/phpdotenv":"PHP dotenv","phpstan/phpstan":"PHPStan","vimeo/psalm":"Psalm","friendsofphp/php-cs-fixer":"PHP CS Fixer","squizlabs/php_codesniffer":"PHP_CodeSniffer"},ft={major:8,minor:4};async function Ul(t,e){let n$1=e?await e.readJsonFile(t):await n(t),s=[],r;if(n$1.require?.php&&(r=n$1.require.php),n$1.require&&typeof n$1.require=="object")for(let[o,a]of Object.entries(n$1.require))o==="php"||o.startsWith("ext-")||s.push({name:o,version:String(a),isDev:false});if(n$1["require-dev"]&&typeof n$1["require-dev"]=="object")for(let[o,a]of Object.entries(n$1["require-dev"]))o==="php"||o.startsWith("ext-")||s.push({name:o,version:String(a),isDev:true});return {phpVersion:r,deps:s}}async function Gl(t,e){let n$1=new Map;try{let s=e?await e.readJsonFile(t):await n(t);for(let r of s.packages??[])r.name&&r.version&&n$1.set(r.name,r.version);for(let r of s["packages-dev"]??[])r.name&&r.version&&n$1.set(r.name,r.version);}catch{}return n$1}function ql(t){return t.match(/(\d+)\.(\d+)/)?.[0]}var Ho=new Set(["composer.json"]);async function Hl(t,e,n,s){let r=n?await n.findFiles(t,i=>Ho.has(i)):await Wl(t),o=[],a=s??n?.projectScanTimeout??18e4;for(let i of r){let c=I.dirname(i);try{let l=zl(c,i,t,e,n),u=await ke(l,a);if(u.ok)o.push(u.value);else {let p=I.relative(t,c);n&&n.addStuckPath(p||"."),console.error(`Timeout scanning PHP project ${c} (>${a/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(l){let u=l instanceof Error?l.message:String(l);console.error(`Error scanning PHP project ${c}: ${u}`);}}return o}async function Wl(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Ho.has(n))}async function zl(t,e,n,s,r){let o=I.relative(n,t)||".",a=I.basename(t===n?n:t),{phpVersion:i,deps:c}=await Ul(e,r),l=I.join(t,"composer.lock"),u=new Map;try{u=await Gl(l,r);}catch{}let p=c.filter(b=>!b.isDev),d,f,h;if(i&&(h=ql(i),h)){let b=h.match(/(\d+)\.(\d+)/);if(b){let v=parseInt(b[1],10),S=parseInt(b[2],10);v===ft.major?d=Math.max(0,ft.minor-S):v<ft.major&&(d=ft.minor+(ft.major-v)*10),f=`${ft.major}.${ft.minor}`;}}let m=[],y=[],x={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},C=p.map(async b=>{let v=await s.get(b.name);return {dep:b,meta:v}}),A=await Promise.all(C);for(let{dep:b,meta:v}of A){let S=u.get(b.name),w=S?Me.valid(Me.clean(S)):null,j=v.latestStableOverall,g=null,P="unknown";if(w&&j){let V=Me.major(w);g=Me.major(j)-V,g===0?P=Me.eq(w,j)?"current":"minor-behind":g>0?P="major-behind":P="current",g<=0?x.current++:g===1?x.oneBehind++:x.twoPlusBehind++;}else x.unknown++;let L=b.isDev?"devDependencies":"dependencies";m.push({package:b.name,section:L,currentSpec:b.version,resolvedVersion:w,latestStable:j,majorsBehind:g,drift:P}),b.name in mo&&y.push({name:mo[b.name],currentVersion:w,latestVersion:j,majorsBehind:g});}m.sort((b,v)=>{let S={"major-behind":0,"minor-behind":1,current:2,unknown:3},w=(S[b.drift]??9)-(S[v.drift]??9);return w!==0?w:b.package.localeCompare(v.package)});let T;try{T=r?await r.countFilesUnder(n,t):void 0;}catch{}return {type:"php",path:o,name:a,runtime:h,runtimeLatest:f,runtimeMajorsBehind:d,frameworks:y,dependencies:m,dependencyAgeBuckets:x,fileCount:T}}var ho={flutter:"Flutter SDK",flutter_test:"Flutter Test",provider:"Provider",riverpod:"Riverpod",flutter_riverpod:"Flutter Riverpod",bloc:"BLoC",flutter_bloc:"Flutter BLoC",get:"GetX",mobx:"MobX",redux:"Redux",go_router:"GoRouter",auto_route:"AutoRoute",http:"http",dio:"Dio",retrofit:"Retrofit",graphql_flutter:"GraphQL Flutter",sqflite:"SQFlite",hive:"Hive",isar:"Isar",drift:"Drift",firebase_core:"Firebase Core",cloud_firestore:"Cloud Firestore",flutter_svg:"Flutter SVG",cached_network_image:"Cached Network Image",shimmer:"Shimmer",lottie:"Lottie",flutter_staggered_grid_view:"Staggered Grid View",mockito:"Mockito",mocktail:"Mocktail",integration_test:"Integration Test",test:"Test",intl:"Intl",shared_preferences:"Shared Preferences",path_provider:"Path Provider",package_info_plus:"Package Info Plus",url_launcher:"URL Launcher",image_picker:"Image Picker",json_serializable:"JSON Serializable",freezed:"Freezed",built_value:"Built Value",logger:"Logger",sentry_flutter:"Sentry Flutter",firebase_crashlytics:"Firebase Crashlytics",build_runner:"Build Runner",injectable:"Injectable",flutter_lints:"Flutter Lints",lint:"Lint"},mt={major:3,minor:6};function Jl(t){let e=[],n,s=null;for(let r of t.split(/\r?\n/)){let o=r.trim();if(o.startsWith("sdk:")){let i=o.match(/sdk:\s*['"]?>?=?\s*(\d[^<'"]*)/);i&&(n=i[1].trim());continue}if(o==="dependencies:"){s="dependencies";continue}else if(o==="dev_dependencies:"){s="dev_dependencies";continue}else if(/^\w+:/.test(r)){s=null;continue}if(!s)continue;let a=o.match(/^([\w_]+):\s*([^\s{]+)/);if(a){let i=a[1],c=a[2];if(c==="sdk:"||o.includes("sdk: flutter"))continue;e.push({name:i,version:c,isDev:s==="dev_dependencies"});}}return {dartVersion:n,deps:e}}async function Kl(t,e){let n=new Map;try{let s=e?await e.readTextFile(t):await o(t),r=null;for(let o of s.split(/\r?\n/)){let a=o.trim(),i=o.match(/^ {2}(\w+):$/);if(i){r=i[1];continue}if(r&&a.startsWith("version:")){let c=a.match(/version:\s*"?([^"]+)"?/);c&&(n.set(r,c[1]),r=null);}}}catch{}return n}function Xl(t){return t.match(/(\d+\.\d+\.\d+)/)?.[0]}var Wo=new Set(["pubspec.yaml"]);async function Yl(t,e,n,s){let r=n?await n.findFiles(t,i=>Wo.has(i)):await Ql(t),o=[],a=s??n?.projectScanTimeout??18e4;for(let i of r){let c=I.dirname(i);try{let l=Zl(c,i,t,e,n),u=await ke(l,a);if(u.ok)o.push(u.value);else {let p=I.relative(t,c);n&&n.addStuckPath(p||"."),console.error(`Timeout scanning Dart project ${c} (>${a/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(l){let u=l instanceof Error?l.message:String(l);console.error(`Error scanning Dart project ${c}: ${u}`);}}return o}async function Ql(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Wo.has(n))}async function Zl(t,e,n,s,r){let o$1=I.relative(n,t)||".",a=I.basename(t===n?n:t),i=r?await r.readTextFile(e):await o(e),{dartVersion:c,deps:l}=Jl(i),u=I.join(t,"pubspec.lock"),p=new Map;try{p=await Kl(u,r);}catch{}let d=l.filter(v=>!v.isDev),f,h,m;if(c&&(m=Xl(c),m)){let v=m.match(/(\d+)\.(\d+)/);if(v){let S=parseInt(v[1],10),w=parseInt(v[2],10);S===mt.major?f=Math.max(0,mt.minor-w):S<mt.major&&(f=mt.minor+(mt.major-S)*10),h=`${mt.major}.${mt.minor}`;}}let y=[],x=[],C={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},A=d.map(async v=>{let S=await s.get(v.name);return {dep:v,meta:S}}),T=await Promise.all(A);for(let{dep:v,meta:S}of T){let w=p.get(v.name),j=w?$e.valid($e.clean(w)):null,g=S.latestStableOverall,P=null,L="unknown";if(j&&g){let le=$e.major(j);P=$e.major(g)-le,P===0?L=$e.eq(j,g)?"current":"minor-behind":P>0?L="major-behind":L="current",P<=0?C.current++:P===1?C.oneBehind++:C.twoPlusBehind++;}else C.unknown++;let V=v.isDev?"devDependencies":"dependencies";y.push({package:v.name,section:V,currentSpec:v.version,resolvedVersion:j,latestStable:g,majorsBehind:P,drift:L}),v.name in ho&&x.push({name:ho[v.name],currentVersion:j,latestVersion:g,majorsBehind:P});}y.sort((v,S)=>{let w={"major-behind":0,"minor-behind":1,current:2,unknown:3},j=(w[v.drift]??9)-(w[S.drift]??9);return j!==0?j:v.package.localeCompare(S.package)});let b;try{b=r?await r.countFilesUnder(n,t):void 0;}catch{}return {type:"dart",path:o$1,name:a,runtime:m,runtimeLatest:h,runtimeMajorsBehind:f,frameworks:x,dependencies:y,dependencyAgeBuckets:C,fileCount:b}}var eu="https://hex.pm/api",tu=1e4,nu=10;async function su(t,e,n,s=false){let r=G(e,"hex",t);if(r?.latest)return r.latest;if(s)return null;let o=async()=>{try{let a=new AbortController,i=setTimeout(()=>a.abort(),tu),c=`${eu}/packages/${t}`,l=await fetch(c,{signal:a.signal,headers:{"User-Agent":"vibgrate-cli"}});if(clearTimeout(i),!l.ok)return null;let p=(await l.json()).releases;if(!p||p.length===0)return null;let d=p.filter(f=>!f.retired).map(f=>f.version).filter(f=>{try{return new Xn.SemVer(f).prerelease.length===0}catch{return !1}});return d.length===0?null:(d.sort((f,h)=>{try{return (0,Xn.gt)(f,h)?-1:1}catch{return 0}}),d[0])}catch(a){return a?.name==="AbortError",null}};return n?n.run(o):o()}async function ru(t,e,n=false){let s=new Map,r=new a$1(nu),o=t.map(async a=>{let i=await su(a,e,r,n);i&&s.set(a,i);});return await Promise.all(o),s}var ou=new Set(["mix.exs"]),iu=new Set(["phoenix","phoenix_live_view","phoenix_html","phoenix_ecto","phoenix_pubsub","ecto","ecto_sql","plug","plug_cowboy","cowboy","ranch","absinthe","absinthe_plug","guardian","comeonin","bcrypt_elixir","argon2_elixir","pbkdf2_elixir","ex_machina","mock","mox","excoveralls","credo","dialyxir","ex_doc","jason","poison","httpoison","tesla","finch","mint","hackney","timex","quantum","oban","broadway","gen_stage","flow","bamboo","swoosh","ex_aws","ex_aws_s3","redix","cachex","nebulex","floki","wallaby","hound"]);async function au(t,e){let n=e?await e.readTextFile(t):await o(t),s=[],r,o$1=n.match(/elixir:\s*"([^"]+)"/);o$1&&(r=o$1[1]);let a=/\{\s*:(\w+)\s*,\s*"([^"]+)"(?:,\s*(?:only|optional|runtime):\s*:(\w+))?\s*\}/g,i;for(;(i=a.exec(n))!==null;){let l=i[1],u=i[2],p=i[3];s.push({name:l,version:u,isDev:p==="dev"||p==="test"});}let c=/\{\s*:(\w+)\s*,\s*git:\s*"[^"]+"/g;for(;(i=c.exec(n))!==null;){i[1];}return {elixirVersion:r,deps:s}}async function cu(t,e){let n=new Map;try{let s=e?await e.readTextFile(t):await o(t),r=/"(\w+)":\s*\{\s*:hex\s*,\s*:\w+\s*,\s*"([^"]+)"/g,o$1;for(;(o$1=r.exec(s))!==null;){let a=o$1[1],i=o$1[2];n.set(a,i);}}catch{}return n}function lu(t,e){try{let n=t.replace(/^[~><=\s]+/,""),s=(0,ge.minVersion)((0,ge.validRange)(n)||n);if(!s)return "unknown";if(!(0,ge.gt)(e,s.version))return "current";let r=(0,ge.minVersion)(e);return r?r.major>s.major?"major-behind":"minor-behind":"unknown"}catch{return "unknown"}}async function uu(t,e,n,s=false){let r=`${t}/mix.exs`;if(!(e?await e.pathExists(r):await p(r)))return null;let{elixirVersion:a,deps:i}=await au(r,e),c=`${t}/mix.lock`,l=await cu(c,e),u=i.filter(y=>!y.isDev),p$1=u.map(y=>y.name),d=await ru(p$1,n,s),f=[],h=[],m={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};for(let y of u){let x=l.get(y.name),C=x||y.version,A=d.get(y.name),T=A?lu(C,A):"unknown",b=null;if(x&&A)try{let v=(0,ge.minVersion)((0,ge.validRange)(C)||C),S=(0,ge.minVersion)((0,ge.validRange)(A)||A);v&&S&&(b=S.major-v.major);}catch{}f.push({package:y.name,section:y.isDev?"devDependencies":"dependencies",currentSpec:y.version,resolvedVersion:x||null,latestStable:A||null,majorsBehind:b,drift:T}),T==="current"?m.current++:b===1?m.oneBehind++:b&&b>1?m.twoPlusBehind++:m.unknown++,iu.has(y.name)&&h.push({name:y.name,currentVersion:x||null,latestVersion:A||null,majorsBehind:b});}return {type:"elixir",path:I.relative(t.includes("/")?t.split("/").slice(0,-1).join("/"):".",t)||".",name:I.basename(t),runtime:a,frameworks:h,dependencies:f,dependencyAgeBuckets:m}}async function pu(t,e,n,s,r=false){let o=n?await n.findFiles(t,c=>ou.has(c)):[],a=new Map;for(let c of o){let l=I.dirname(c);a.has(l)||a.set(l,[]),a.get(l).push(c);}let i=[];for(let[c]of a)try{let l=await uu(c,n,e,r);l&&(l.path=I.relative(t,c)||".",i.push(l));}catch(l){console.error(`Error scanning Elixir project at ${c}:`,l);}return i}var du="https://hub.docker.com/v2",fu=1e4,mu=10;function Ds(t){let e,n,s,r,[o,a]=t.split(":");r=a;let i=o.split("/");return i.length>1&&(i[0].includes(".")||i[0]==="localhost")?(e=i[0],i.length===3?(n=i[1],s=i[2]):s=i[1]):i.length===2?(n=i[0],s=i[1]):s=o,{registry:e,namespace:n,image:s,tag:r}}async function hu(t,e,n){let s=async()=>{try{let r=new AbortController,o=setTimeout(()=>r.abort(),fu),a=`${du}/repositories/${t}/${e}/tags?page_size=100`,i=await fetch(a,{signal:r.signal,headers:{"User-Agent":"vibgrate-cli"}});return clearTimeout(o),i.ok?((await i.json()).results||[]).map(u=>u.name):[]}catch(r){return r?.name==="AbortError"?[]:[]}};return n?n.run(s):s()}function gu(t){let e=[];for(let n of t){if(["latest","master","main","stable","edge","dev"].includes(n))continue;let s=n.replace(/^v/,""),r=s.indexOf("-");r>0&&(s=s.substring(0,r));try{let o=new Yn.SemVer(s);o.prerelease.length===0&&e.push(o);}catch{}}return e.length===0?null:(e.sort((n,s)=>(0, Yn.gt)(n.version,s.version)?-1:1),e[0].version)}async function yu(t,e,n,s=false){let r=Ds(t),o=`${r.namespace||"library"}/${r.image}`,a=G(e,"docker",o);if(a?.latest)return a.latest;if(s||r.registry&&r.registry!=="docker.io")return null;let i=r.namespace||"library",c=await hu(i,r.image,n);return gu(c)}async function vu(t,e,n=false){let s=new Map,r=new a$1(mu),o=t.map(async a=>{let i=await yu(a,e,r,n);i&&s.set(a,i);});return await Promise.all(o),s}var bu=new Set(["Dockerfile","docker-compose.yml","docker-compose.yaml","compose.yml","compose.yaml"]);async function wu(t,e){let n=e?await e.readTextFile(t):await o(t),s=[],r=/^FROM\s+(?:--platform=[^\s]+\s+)?([^\s]+)/gm,o$1;for(;(o$1=r.exec(n))!==null;){let a=o$1[1];if(a==="scratch")continue;let i=Ds(a);s.push({name:`${i.namespace||"library"}/${i.image}`,currentTag:i.tag||"latest"});}return s}async function Su(t,e){let n=e?await e.readTextFile(t):await o(t),s=[],r=/^\s*image:\s*([^\s#]+)/gm,o$1;for(;(o$1=r.exec(n))!==null;){let a=o$1[1].trim().replace(/["']/g,""),i=Ds(a);s.push({name:`${i.namespace||"library"}/${i.image}`,currentTag:i.tag||"latest"});}return s}function ku(t,e){try{if(t==="latest"||t==="stable")return "current";let n=t.replace(/^v/,""),s=n.indexOf("-");s>0&&(n=n.substring(0,s));let r=new kt.SemVer(n),o=new kt.SemVer(e);return (0,kt.gt)(o.version,r.version)?o.major>r.major?"major-behind":"minor-behind":"current"}catch{return "unknown"}}async function Eu(t,e,n,s=false){let r=[],o=`${t}/Dockerfile`;if(e?await e.pathExists(o):await p(o)){let f=await wu(o,e);r.push(...f);}let i=["docker-compose.yml","docker-compose.yaml","compose.yml","compose.yaml"];for(let f of i){let h=`${t}/${f}`;if(e?await e.pathExists(h):await p(h)){let y=await Su(h,e);r.push(...y);break}}if(r.length===0)return null;let c=new Map;for(let f of r)c.has(f.name)||c.set(f.name,f.currentTag);let l=Array.from(c.keys()),u=await vu(l,n,s),p$1=[],d={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};for(let f of l){let h=c.get(f),m=u.get(f),y=m?ku(h,m):"unknown",x=null;if(m)try{let C=h.replace(/^v/,"").split("-")[0],A=new kt.SemVer(C);x=new kt.SemVer(m).major-A.major;}catch{}p$1.push({package:f,section:"dependencies",currentSpec:h,resolvedVersion:h,latestStable:m||null,majorsBehind:x,drift:y}),y==="current"?d.current++:x===1?d.oneBehind++:x&&x>1?d.twoPlusBehind++:d.unknown++;}return {type:"docker",path:I.relative(t.includes("/")?t.split("/").slice(0,-1).join("/"):".",t)||".",name:I.basename(t),frameworks:[],dependencies:p$1,dependencyAgeBuckets:d}}async function xu(t,e,n,s,r=false){let o=n?await n.findFiles(t,c=>bu.has(c)):[],a=new Map;for(let c of o){let l=I.dirname(c);a.has(l)||a.set(l,[]),a.get(l).push(c);}let i=[];for(let[c]of a)try{let l=await Eu(c,n,e,r);l&&(l.path=I.relative(t,c)||".",i.push(l));}catch(l){console.error(`Error scanning Docker project at ${c}:`,l);}return i}var ju="https://artifacthub.io/api/v1",Tu=1e4,Cu=10;async function Au(t,e,n,s,r=false){let o=e?`${e}/${t}`:t,a=G(n,"helm",o);if(a?.latest)return a.latest;if(r)return null;let i=async()=>{try{let c=new AbortController,l=setTimeout(()=>c.abort(),Tu),u=`${ju}/packages/search?kind=0&ts_query_web=${encodeURIComponent(t)}&limit=10`,p=await fetch(u,{signal:c.signal,headers:{"User-Agent":"vibgrate-cli"}});if(clearTimeout(l),!p.ok)return null;let f=(await p.json()).packages||[],h=f.find(m=>m.name===t);return e&&f.length>1&&(h=f.find(m=>m.name===t&&m.repository?.name===e)||h),h?h.version:null}catch(c){return c?.name==="AbortError",null}};return s?s.run(i):i()}async function Pu(t,e,n=false){let s=new Map,r=new a$1(Cu),o=t.map(async a=>{let i=await Au(a.name,a.repo,e,r,n);if(i){let c=a.repo?`${a.repo}/${a.name}`:a.name;s.set(c,i);}});return await Promise.all(o),s}var Mu=new Set(["Chart.yaml","Chart.yml"]);async function $u(t,e){let n=e?await e.readTextFile(t):await o(t),s=[],r,o$1,a,i=n.match(/^name:\s*(.+)$/m);i&&(r=i[1].trim().replace(/["']/g,""));let c=n.match(/^version:\s*(.+)$/m);c&&(o$1=c[1].trim().replace(/["']/g,""));let l=n.match(/^appVersion:\s*(.+)$/m);l&&(a=l[1].trim().replace(/["']/g,""));let u=n.match(/^dependencies:\s*$/m);if(u){let p=u.index+u[0].length,d=n.substring(p),f=/^\s*-\s+name:\s*(.+)$/gm,h;for(;(h=f.exec(d))!==null;){let m=h[1].trim().replace(/["']/g,""),y=h.index,x=f.exec(d),C=x?x.index:d.length;f.lastIndex=y+1;let A=d.substring(y,C),T=A.match(/version:\s*(.+)$/m),b=T?T[1].trim().replace(/["']/g,""):"*",v=A.match(/repository:\s*(.+)$/m),S=v?v[1].trim().replace(/["']/g,""):void 0,w=A.match(/condition:\s*(.+)$/m),j=w?w[1].trim().replace(/["']/g,""):void 0;s.push({name:m,version:b,repository:S,condition:j});}}return {chartName:r,chartVersion:o$1,appVersion:a,dependencies:s}}async function Lu(t,e){let n=new Map;try{let s=e?await e.readTextFile(t):await o(t),r=/^\s*-\s+name:\s*(.+)$/gm,o$1;for(;(o$1=r.exec(s))!==null;){let a=o$1[1].trim().replace(/["']/g,""),i=o$1.index,c=r.exec(s),l=c?c.index:s.length;r.lastIndex=i+1;let p=s.substring(i,l).match(/version:\s*(.+)$/m);if(p){let d=p[1].trim().replace(/["']/g,"");n.set(a,d);}}}catch{}return n}function Nu(t,e){try{let n=t.replace(/^[~^><=\s]+/,""),s=(0,ye.minVersion)((0,ye.validRange)(n)||n);if(!s)return "unknown";if(!(0,ye.gt)(e,s.version))return "current";let r=(0,ye.minVersion)(e);return r?r.major>s.major?"major-behind":"minor-behind":"unknown"}catch{return "unknown"}}async function Ru(t,e,n,s=false){let r=null;for(let m of ["Chart.yaml","Chart.yml"]){let y=`${t}/${m}`;if(e?await e.pathExists(y):await p(y)){r=y;break}}if(!r)return null;let{chartName:o,chartVersion:a,appVersion:i,dependencies:c}=await $u(r,e),l=`${t}/Chart.lock`,u=await Lu(l,e),p$1=c.map(m=>({name:m.name,repo:m.repository})),d=await Pu(p$1,n,s),f=[],h={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};for(let m of c){let y=u.get(m.name),x=y||m.version,C=m.repository?`${m.repository}/${m.name}`:m.name,A=d.get(C),T=A?Nu(x,A):"unknown",b=null;if(A)try{let v=(0,ye.minVersion)((0,ye.validRange)(x)||x),S=(0,ye.minVersion)((0,ye.validRange)(A)||A);v&&S&&(b=S.major-v.major);}catch{}f.push({package:m.name,section:"dependencies",currentSpec:m.version,resolvedVersion:y||null,latestStable:A||null,majorsBehind:b,drift:T}),T==="current"?h.current++:b===1?h.oneBehind++:b&&b>1?h.twoPlusBehind++:h.unknown++;}return {type:"helm",path:I.relative(t.includes("/")?t.split("/").slice(0,-1).join("/"):".",t)||".",name:o||I.basename(t),runtime:i,frameworks:[],dependencies:f,dependencyAgeBuckets:h}}async function Iu(t,e,n,s,r=false){let o=n?await n.findFiles(t,c=>Mu.has(c)):[],a=new Map;for(let c of o){let l=I.dirname(c);a.has(l)||a.set(l,[]),a.get(l).push(c);}let i=[];for(let[c]of a)try{let l=await Ru(c,n,e,r);l&&(l.path=I.relative(t,c)||".",i.push(l));}catch(l){console.error(`Error scanning Helm chart at ${c}:`,l);}return i}var zo="https://registry.terraform.io/v1",Jo=1e4,_u=10;async function Fu(t,e,n,s,r=false){let o=`${t}/${e}`,a=G(n,"terraform",o);if(a?.latest)return a.latest;if(r)return null;let i=async()=>{try{let c=new AbortController,l=setTimeout(()=>c.abort(),Jo),u=`${zo}/providers/${t}/${e}/versions`,p=await fetch(u,{signal:c.signal,headers:{"User-Agent":"vibgrate-cli"}});if(clearTimeout(l),!p.ok)return null;let f=(await p.json()).versions||[];if(f.length===0)return null;let h=[];for(let m of f)try{let y=new Jt.SemVer(m.version);y.prerelease.length===0&&h.push(y);}catch{}return h.length===0?null:(h.sort((m,y)=>(0,Jt.gt)(m.version,y.version)?-1:1),h[0].version)}catch(c){return c?.name==="AbortError",null}};return s?s.run(i):i()}async function Ou(t,e,n,s,r,o=false){let a=`${t}/${e}/${n}`,i=G(s,"terraform",a);if(i?.latest)return i.latest;if(o)return null;let c=async()=>{try{let l=new AbortController,u=setTimeout(()=>l.abort(),Jo),p=`${zo}/modules/${t}/${e}/${n}/versions`,d=await fetch(p,{signal:l.signal,headers:{"User-Agent":"vibgrate-cli"}});if(clearTimeout(u),!d.ok)return null;let h=(await d.json()).modules||[];if(h.length===0||!h[0].versions)return null;let m=h[0].versions,y=[];for(let x of m)try{let C=new Jt.SemVer(x.version);C.prerelease.length===0&&y.push(C);}catch{}return y.length===0?null:(y.sort((x,C)=>(0,Jt.gt)(x.version,C.version)?-1:1),y[0].version)}catch(l){return l?.name==="AbortError",null}};return r?r.run(c):c()}async function Bu(t,e,n=false){let s=new Map,r=new a$1(_u),o=t.map(async a=>{let i=null,c;a.type==="provider"?(c=`${a.namespace}/${a.name}`,i=await Fu(a.namespace,a.name,e,r,n)):(c=`${a.namespace}/${a.name}/${a.provider}`,i=await Ou(a.namespace,a.name,a.provider,e,r,n)),i&&s.set(c,i);});return await Promise.all(o),s}async function Vu(t,e){let n=e?await e.readTextFile(t):await o(t),s=[],r=[],o$1,a=n.match(/terraform\s*\{[^}]*required_version\s*=\s*"([^"]+)"/s);a&&(o$1=a[1]);let i=n.match(/required_providers\s*\{([^}]+)\}/s);if(i){let d=i[1],f=/(\w+)\s*=\s*\{([^}]+)\}/g,h;for(;(h=f.exec(d))!==null;){let m=h[2],y=m.match(/source\s*=\s*"([^"]+)"/);if(!y)continue;let x=y[1],C=m.match(/version\s*=\s*"([^"]+)"/),A=C?C[1]:void 0;s.push({source:x,version:A});}}let c=/provider\s+"(\w+)"\s*\{([^}]+)\}/g,l;for(;(l=c.exec(n))!==null;){let d=l[1],h=l[2].match(/version\s*=\s*"([^"]+)"/);h&&(s.find(y=>y.source.endsWith(`/${d}`))||s.push({source:`hashicorp/${d}`,version:h[1]}));}let u=/module\s+"[^"]+"\s*\{([^}]+)\}/g,p;for(;(p=u.exec(n))!==null;){let d=p[1],f=d.match(/source\s*=\s*"([^"]+)"/);if(!f)continue;let h=f[1];if(h.startsWith("./")||h.startsWith("../")||h.startsWith("git::"))continue;let m=d.match(/version\s*=\s*"([^"]+)"/),y=m?m[1]:void 0;r.push({source:h,version:y});}return {terraformVersion:o$1,providers:s,modules:r}}async function Du(t,e){let n=new Map;try{let s=e?await e.readTextFile(t):await o(t),r=/provider\s+"[^"]*\/([^/"]+\/[^/"]+)"\s*\{([^}]+)\}/g,o$1;for(;(o$1=r.exec(s))!==null;){let a=o$1[1],c=o$1[2].match(/version\s*=\s*"([^"]+)"/);c&&n.set(a,c[1]);}}catch{}return n}function go(t,e){try{let n=t.replace(/^[~><=\s]+/,""),s=(0,Y.minVersion)((0,Y.validRange)(n)||n);if(!s)return "unknown";if(!(0,Y.gt)(e,s.version))return "current";let r=(0,Y.minVersion)(e);return r?r.major>s.major?"major-behind":"minor-behind":"unknown"}catch{return "unknown"}}async function Uu(t,e,n,s=false){let r=[];if(e){let y=await e.findFiles(t,x=>x.endsWith(".tf"));r.push(...y);}else {let y=["main.tf","variables.tf","outputs.tf","versions.tf","providers.tf"];for(let x of y){let C=`${t}/${x}`;await p(C)&&r.push(C);}}if(r.length===0)return null;let o,a=[],i=[];for(let y of r){let{terraformVersion:x,providers:C,modules:A}=await Vu(y,e);x&&!o&&(o=x),a.push(...C),i.push(...A);}let c=new Map;for(let y of a)c.has(y.source)||c.set(y.source,y.version);let l=new Map;for(let y of i)l.has(y.source)||l.set(y.source,y.version);let u=`${t}/.terraform.lock.hcl`,p$1=await Du(u,e),d=[];for(let[y]of c){let[x,C]=y.split("/");d.push({type:"provider",namespace:x,name:C});}for(let[y]of l){let x=y.split("/");if(x.length===3){let[C,A,T]=x;d.push({type:"module",namespace:C,name:A,provider:T});}}let f=await Bu(d,n,s),h=[],m={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};for(let[y,x]of c){let C=p$1.get(y),A=C||x||"unknown",T=f.get(y),b=T&&A!=="unknown"?go(A,T):"unknown",v=null;if(T&&A!=="unknown")try{let S=(0,Y.minVersion)((0,Y.validRange)(A)||A),w=(0,Y.minVersion)((0,Y.validRange)(T)||T);S&&w&&(v=w.major-S.major);}catch{}h.push({package:`provider:${y}`,section:"dependencies",currentSpec:x||"unknown",resolvedVersion:C||null,latestStable:T||null,majorsBehind:v,drift:b}),b==="current"?m.current++:v===1?m.oneBehind++:v&&v>1?m.twoPlusBehind++:m.unknown++;}for(let[y,x]of l){let C=x||"unknown",A=f.get(y),T=A&&C!=="unknown"?go(C,A):"unknown",b=null;if(A&&C!=="unknown")try{let v=(0,Y.minVersion)((0,Y.validRange)(C)||C),S=(0,Y.minVersion)((0,Y.validRange)(A)||A);v&&S&&(b=S.major-v.major);}catch{}h.push({package:`module:${y}`,section:"dependencies",currentSpec:x||"unknown",resolvedVersion:null,latestStable:A||null,majorsBehind:b,drift:T}),T==="current"?m.current++:b===1?m.oneBehind++:b&&b>1?m.twoPlusBehind++:m.unknown++;}return {type:"terraform",path:I.relative(t.includes("/")?t.split("/").slice(0,-1).join("/"):".",t)||".",name:I.basename(t),runtime:o,frameworks:[],dependencies:h,dependencyAgeBuckets:m}}async function Gu(t,e,n,s,r=false){let o=n?await n.findFiles(t,c=>c.endsWith(".tf")):[],a=new Map;for(let c of o){let l=I.dirname(c);a.has(l)||a.set(l,[]),a.get(l).push(c);}let i=[];for(let[c]of a)try{let l=await Uu(c,n,e,r);l&&(l.path=I.relative(t,c)||".",i.push(l));}catch(l){console.error(`Error scanning Terraform project at ${c}:`,l);}return i}var yo=[{name:"go.mod",type:"go"},{name:"Cargo.toml",type:"rust"},{name:"composer.json",type:"php"},{name:"Package.swift",type:"swift"},{name:"pubspec.yaml",type:"dart"},{name:"build.gradle.kts",type:"kotlin"},{name:"build.sbt",type:"scala"},{name:"DESCRIPTION",type:"r"},{name:"Podfile",type:"objective-c"},{name:"mix.exs",type:"elixir"},{name:"cpanfile",type:"perl"},{name:"Project.toml",type:"julia"},{name:"deps.edn",type:"clojure"},{name:"build.gradle",type:"groovy"},{name:"tsconfig.json",type:"typescript"},{name:"Makefile",type:"c"},{name:"CMakeLists.txt",type:"cpp"},{name:"*.vbp",type:"visual-basic"}],qu=[{extensions:[".m",".mm"],type:"objective-c"},{extensions:[".c",".h"],type:"c"},{extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx"],type:"cpp"},{extensions:[".cob",".cbl",".cpy"],type:"cobol"},{extensions:[".f",".for",".f90",".f95",".f03",".f08"],type:"fortran"},{extensions:[".pas",".pp",".lpr"],type:"pascal"},{extensions:[".adb",".ads",".ada"],type:"ada"},{extensions:[".asm",".s",".s43",".s65"],type:"assembly"},{extensions:[".rpg",".rpgle",".sqlrpgle"],type:"rpg"}];function ht(t,e="unknown"){return {package:t,section:"dependencies",currentSpec:e,resolvedVersion:null,latestStable:null,majorsBehind:null,drift:"unknown"}}function Gt(t,e,n=1){let s=new Set;for(let r of t.split(/\r?\n/)){let o=r.match(e);o?.[n]&&s.add(o[n]);}return [...s]}function Hu(t,e){return I.basename(t)||I.basename(e)}function Wu(t){return /^\s*(CC|CFLAGS|LDFLAGS)\s*[:?+]?=/m.test(t)||/\b(gcc|clang)\b/.test(t)||/\.(c|o)\b/.test(t)}function xs(t,e,n,s,r,o=[]){let a=s||".",i=`${n}:${a}`;e.has(i)||(e.add(i),t.push({type:n,path:a,name:Hu(a,r),frameworks:[],dependencies:o,dependencyAgeBuckets:{current:0,oneBehind:0,twoPlusBehind:0,unknown:o.length}}));}async function zu(t,e){let n$1=I.basename(t),s=async()=>e?e.readTextFile(t):o(t);if(n$1==="composer.json"){let o=e?await e.readJsonFile(t):await n(t);if(!o||typeof o!="object")return [];let a=new Set;for(let i of ["require","require-dev"]){let c=o[i];if(c&&typeof c=="object")for(let l of Object.keys(c))a.add(l);}return [...a].map(i=>ht(i))}let r=await s();return r?n$1==="go.mod"?Gt(r,/^\s*require\s+([^\s]+)\s+(.+)$/).map(o=>ht(o)):n$1==="Cargo.toml"?Gt(r,/^\s*([A-Za-z0-9_\-]+)\s*=\s*['"{]/).map(o=>ht(o)):n$1==="pubspec.yaml"?Gt(r,/^\s{2,}([A-Za-z0-9_\-]+):\s*.+$/).map(o=>ht(o)):n$1==="mix.exs"?Gt(r,/\{\s*:([a-zA-Z0-9_]+),/).map(o=>ht(o)):n$1==="cpanfile"?Gt(r,/^\s*requires\s+['"]([^'"]+)['"]/).map(o=>ht(o)):n$1==="build.sbt"?Gt(r,/"([A-Za-z0-9_.\-]+)"\s*%{1,2}\s*"([A-Za-z0-9_.\-]+)"/,2).map(o=>ht(o)):[]:[]}function Ju(t){let e=new Map;for(let n of t){if(!n.isFile)continue;let s=I.extname(n.name).toLowerCase();if(s)for(let r of qu){if(!r.extensions.includes(s))continue;let o=I.dirname(n.relPath)||".";e.has(o)||e.set(o,new Set),e.get(o)?.add(r.type);}}return e}async function Ku(t,e){let n=e?await e.walkDir(t):[],s=n.filter(c=>c.isFile&&yo.some(l=>l.name===c.name||l.name.startsWith("*.")&&c.name.endsWith(l.name.slice(1)))),r=new Set(n.filter(c=>c.isFile&&c.name.endsWith(".sh")).map(c=>I.dirname(c.relPath)||".")),o$1=[],a=new Set;for(let c of s){let l=yo.find(d=>d.name===c.name||d.name.startsWith("*.")&&c.name.endsWith(d.name.slice(1)));if(!l)continue;if(c.name==="Makefile"){let d=e?await e.readTextFile(c.absPath):await o(c.absPath);if(!Wu(d))continue}let u=I.dirname(c.relPath)||".",p=await zu(c.absPath,e);xs(o$1,a,l.type,u,t,p);}for(let c of r)xs(o$1,a,"shell",c,t);let i=Ju(n);for(let[c,l]of i)for(let u of l)xs(o$1,a,u,c,t);return o$1}var Xu=10,Yu=1048576,Qu=5,Zu=20,ep=2621440,tp=10,np=30,sp=5242880,rp=25,Ls=25,Ns=10,Rs=3,zm=1;function js(t,e,n,s){let r=0;return t.fileCount!==void 0&&t.fileCount>=1&&t.fileCount<e&&r++,t.sizeBytes!==void 0&&t.sizeBytes>0&&t.sizeBytes<n&&r++,t.dependencyCount!==void 0&&t.dependencyCount<s&&r++,r}function op(t){return js(t,Xu,Yu,Qu)>=2?"nano":js(t,Zu,ep,tp)>=2?"micro":js(t,np,sp,rp)>=2?"small":"standard"}function ip(t){switch(t){case "nano":return "nano";case "micro":case "function":return "micro";case "small":return "small";default:return "standard"}}function Jm(t){switch(t){case "nano":return 1/Ls;case "micro":return 1/Ns;case "small":return 1/Rs;default:return 1}}function ap(t){let e=0,n=0,s=0,r=0;for(let a of t)switch(ip(a.classification)){case "nano":e++;break;case "micro":n++;break;case "small":s++;break;default:r++;break}let o=r+s/Rs+n/Ns+e/Ls;return {nanoCount:e,microCount:n,smallCount:s,standardCount:r,totalScanned:e+n+s+r,nanoBillingRatio:Ls,microBillingRatio:Ns,smallBillingRatio:Rs,billableProjectsRaw:Math.round(o*100)/100,billableProjects:Math.floor(o)}}var cp={N:.85,A:.62,L:.55,P:.2},lp={L:.77,H:.44},up={N:.85,R:.62},pp={N:.85,L:.62,H:.27},dp={N:.85,L:.68,H:.5},Ts={H:.56,L:.22,N:0};function fp(t){let e=Math.round(t*1e5);return e%1e4===0?e/1e5:(Math.floor(e/1e4)+1)/10}function Ko(t){if(!t||typeof t!="string")return null;let e=t.trim().split("/");if(!e.length||!/^CVSS:3\.[01]$/i.test(e[0]))return null;let n={};for(let m of e.slice(1)){let[y,x]=m.split(":");y&&x&&(n[y.toUpperCase()]=x.toUpperCase());}let s=n.S==="C",r=cp[n.AV],o=lp[n.AC],a=up[n.UI],i=(s?dp:pp)[n.PR],c=Ts[n.C],l=Ts[n.I],u=Ts[n.A];if([r,o,a,i,c,l,u].some(m=>m===void 0))return null;let p=1-(1-c)*(1-l)*(1-u),d=s?7.52*(p-.029)-3.25*Math.pow(p-.02,15):6.42*p;if(d<=0)return 0;let f=8.22*r*o*i*a,h=Math.min(s?1.08*(d+f):d+f,10);return fp(h)}function Xo(t){return t>=9?"critical":t>=7?"high":t>=4?"moderate":t>0?"low":"unknown"}function Gn(t){switch(t){case "critical":return 4;case "high":return 3;case "moderate":return 2;case "low":return 1;default:return 0}}function Yo(t){switch((t??"").trim().toLowerCase()){case "critical":return "critical";case "high":return "high";case "moderate":case "medium":return "moderate";case "low":return "low";default:return "unknown"}}var mp="https://api.osv.dev/v1/querybatch",hp="https://api.osv.dev/v1/vulns/",gp=15e3,vo=500;function yp(t){switch(t){case "node":case "typescript":return "npm";case "python":return "pypi";case "java":return "maven";case "dotnet":return "nuget";case "go":return "go";case "rust":return "cargo";case "php":return "composer";case "ruby":return "rubygems";case "dart":return "pub";case "elixir":return "hex";default:return null}}function vp(t){switch(t){case "npm":return "npm";case "pypi":return "PyPI";case "maven":return "Maven";case "nuget":return "NuGet";case "go":return "Go";case "cargo":return "crates.io";case "composer":return "Packagist";case "rubygems":return "RubyGems";case "pub":return "Pub";case "hex":return "Hex"}}function bp(){return {low:0,moderate:0,high:0,critical:0,unknown:0}}function zt(t){return `${t.ecosystem}\0${t.package}\0${t.version}`}function wp(t){let e=new Set,n=[];for(let s of t){let r=yp(s.type);if(r)for(let o of s.dependencies){if(!o.resolvedVersion)continue;let a={ecosystem:r,package:o.package,version:o.resolvedVersion},i=zt(a);e.has(i)||(e.add(i),n.push(a));}}return n.sort((s,r)=>s.ecosystem.localeCompare(r.ecosystem)||s.package.localeCompare(r.package)||s.version.localeCompare(r.version)),n}function Qo(t,e,n){if(n&&n.includes(t))return true;let s=ce.valid(ce.coerce(t));if(!s)return false;for(let r of e??[]){let o=r.introduced&&r.introduced!=="0"?ce.valid(ce.coerce(r.introduced)):"0.0.0",a=r.fixed?ce.valid(ce.coerce(r.fixed)):null,i=o?ce.gte(s,o):true,c=a?ce.lt(s,a):true;if(i&&c)return true}return false}function Sp(t,e){let n=t.severity?.find(p=>(p.type??"").toUpperCase().startsWith("CVSS_V3"))?.score??null,s=Ko(n),r=e.toLowerCase(),o=(t.affected??[]).filter(p=>(p.package?.name??"").toLowerCase()===r),a=t.database_specific?.severity??o.map(p=>p.ecosystem_specific?.severity??p.database_specific?.severity).find(Boolean)??null,i=s!=null?Xo(s):Yo(a),c=[],l=[],u=[];for(let p of o){for(let d of p.ranges??[]){let f,h=false;for(let m of d.events??[])m.introduced!==void 0&&(f=m.introduced==="0"?void 0:m.introduced,h=true),m.fixed&&(c.includes(m.fixed)||c.push(m.fixed),l.push({introduced:f,fixed:m.fixed}),h=false,f=void 0);h&&l.push({introduced:f});}for(let d of p.versions??[])u.includes(d)||u.push(d);}return {id:t.id??"UNKNOWN",aliases:Array.isArray(t.aliases)?t.aliases:[],summary:t.summary??null,severity:i,cvss:s,cvssVector:n,fixedVersions:c,published:t.published??null,withdrawn:t.withdrawn??null,references:(t.references??[]).map(p=>p.url).filter(p=>!!p),...l.length?{affectedRanges:l}:{},...u.length?{affectedVersions:u}:{}}}function kp(t){let e=typeof t.cvss=="number"?t.cvss:Ko(t.cvssVector??null),n=t.severity?Yo(t.severity):e!=null?Xo(e):"unknown";return {id:t.id,aliases:t.aliases??[],summary:t.summary??null,severity:n,cvss:e,cvssVector:t.cvssVector??null,fixedVersions:(t.ranges??[]).map(s=>s.fixed).filter(s=>!!s),published:t.published??null,withdrawn:t.withdrawn??null,references:t.references??[],...t.ranges?.length?{affectedRanges:t.ranges}:{},...t.versions?.length?{affectedVersions:t.versions}:{}}}async function Zo(t,e,n){return n.run(async()=>{let s=new AbortController,r=setTimeout(()=>s.abort(),gp);try{let o=await fetch(t,{...e,signal:s.signal});return o.ok?await o.json():null}catch{return null}finally{clearTimeout(r);}})}async function Ep(t,e){let n=new Map;for(let s=0;s<t.length;s+=vo){let r=t.slice(s,s+vo),o=JSON.stringify({queries:r.map(i=>({version:i.version,package:{name:i.package,ecosystem:vp(i.ecosystem)}}))}),a=await Zo(mp,{method:"POST",body:o,headers:{"content-type":"application/json"}},e);if(a?.results)for(let i=0;i<r.length;i++){let c=(a.results[i]?.vulns??[]).map(l=>l.id).filter(l=>!!l);c.length&&n.set(zt(r[i]),c);}}return n}async function xp(t,e){let n=new Map;return await Promise.all([...t].map(async s=>{let r=await Zo(`${hp}${encodeURIComponent(s)}`,{method:"GET"},e);r&&n.set(s,r);})),n}function ei(t,e){e.sort((r,o)=>r.ecosystem.localeCompare(o.ecosystem)||r.package.localeCompare(o.package)||r.version.localeCompare(o.version));let n=bp(),s=0;for(let r of e){r.advisories.sort((a,i)=>Gn(i.severity)-Gn(a.severity)||a.id.localeCompare(i.id)),s+=r.advisories.length;let o=r.advisories.reduce((a,i)=>Gn(i.severity)>Gn(a)?i.severity:a,"unknown");n[o]++;}return {source:t,packages:e,totalAdvisories:s,severityCounts:n}}var Is={source:"none",packages:[],totalAdvisories:0,severityCounts:{low:0,moderate:0,high:0,critical:0,unknown:0}};async function jp(t,e){if(t.length===0)return Is;if(e.offline)return bo(t,e.manifest);let n=await Ep(t,e.sem);if(n.size===0){let i=bo(t,e.manifest);return i.packages.length?i:{...Is,source:"osv"}}let s=new Set;for(let i of n.values())for(let c of i)s.add(c);let r=await xp(s,e.sem),o=ti(t,e.manifest),a=[];for(let i of t){let c=n.get(zt(i))??[],l=[],u=new Set;for(let p of c){let d=r.get(p);!d||d.withdrawn||(l.push(Sp(d,i.package)),u.add(p));}for(let p of o.get(zt(i))??[])u.has(p.id)||l.push(p);l.length&&a.push({...i,advisories:l});}return ei("osv",a)}function ti(t,e){let n=new Map;if(!e)return n;for(let s of t){let o=(G(e,s.ecosystem,s.package)?.vulns??[]).filter(a=>!a.withdrawn&&Qo(s.version,a.ranges,a.versions));o.length&&n.set(zt(s),o.map(kp));}return n}function bo(t,e){let n=ti(t,e);if(n.size===0)return Is;let s=[];for(let r of t){let o=n.get(zt(r));o?.length&&s.push({...r,advisories:o});}return ei("manifest",s)}var Tp="vibgrate/vulnerability";function Cp(t){switch(t){case "critical":case "high":return "error";case "moderate":return "warning";default:return "note"}}function Ap(t){let e=[];for(let n of t.packages)for(let s of n.advisories){let r=s.aliases.find(l=>l.startsWith("CVE-")),o=r&&r!==s.id?`${s.id} (${r})`:s.id,a=s.fixedVersions.length?` \u2014 fixed in ${s.fixedVersions.join(", ")}`:" \u2014 no fix available",i=s.cvss!=null?` ${s.cvss}`:"",c=s.introduced!=null?` \u2014 introduced by ${s.introduced.authorName} in ${s.introduced.shortSha}${s.exposureDays!=null?` (${s.exposureDays}d exposed)`:""}`:"";e.push({ruleId:Tp,level:Cp(s.severity),message:`${n.package}@${n.version}: ${o} (${s.severity}${i})${a}${c}`,location:n.package,details:{ecosystem:n.ecosystem,package:n.package,installedVersion:n.version,advisoryId:s.id,aliases:s.aliases,severity:s.severity,cvss:s.cvss,fixedVersions:s.fixedVersions,...s.introduced?{introducedBy:s.introduced.authorName,introducedSha:s.introduced.shortSha,introducedDate:s.introduced.date,exposureDays:s.exposureDays}:{}}});}return e}var Pp=new Set(["node_modules",".git","dist","build","out",".vibgrate","vendor",".venv","venv","env","__pycache__","target",".next",".nuxt","coverage",".cache"]),wo=8e3,Mp=12,$p=1048576,Lp=5,Np={npm:new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts",".vue",".svelte"]),pypi:new Set([".py"])};function Rp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ip(t,e){let n=Rp(e);return t==="npm"?new RegExp(`(?:from\\s+|require\\(\\s*|import\\(\\s*)['"]${n}(?:/[^'"]*)?['"]`,"g"):t==="pypi"?new RegExp(`^\\s*(?:import\\s+${n}(?:[.\\s]|$)|from\\s+${n}(?:[.\\s]))`,"gm"):null}function _p(t,e,n){let s={importSites:0,filesTouched:0,sampleFiles:[]};if(n==="unknown")return s;let r=Np[n],o=Ip(n,e);if(!r||!o)return s;let a=0,i=0,c=[],l=0,u=(p,d)=>{if(d>Mp||l>=wo)return;let f;try{f=Kt.readdirSync(p,{withFileTypes:!0});}catch{return}f.sort((h,m)=>h.name.localeCompare(m.name));for(let h of f){if(l>=wo)return;if(h.isDirectory()){if(Pp.has(h.name)||h.name.startsWith("."))continue;u(I.join(p,h.name),d+1);}else if(h.isFile()&&r.has(I.extname(h.name))){l++;let m=I.join(p,h.name),y;try{if(Kt.statSync(m).size>$p)continue;y=Kt.readFileSync(m,"utf8");}catch{continue}o.lastIndex=0;let x=y.match(o);x&&x.length&&(a+=x.length,i++,c.length<Lp&&c.push(I.relative(t,m).replace(/\\/g,"/")));}}};return u(t,0),c.sort(),{importSites:a,filesTouched:i,sampleFiles:c}}function Fp(t,e,n){let s=t?Le.valid(Le.coerce(t)):null,r=e?Le.valid(Le.coerce(e)):null;if(!s||!r)return {majorsBehind:n??null,interimMajors:[]};let o=Le.major(s),a=Le.major(r),i=n??Math.max(0,a-o),c=[];for(let l=o+1;l<a;l++)c.push(`${l}.x`);return {majorsBehind:i,interimMajors:c}}function Op(t,e){let n=e.filesTouched;return !t||t<=0?n>0?"low":"none":n===0?"low":n>20||t>=2&&n>5?"high":n>5||t>=2?"moderate":"low"}function Bp(t,e,n){return t!=null&&t>=2?"multi-major-plan":t===1?"single-major":e&&n&&e!==n?"patch-minor":"current"}function Km(t,e,n={}){let{majorsBehind:s,interimMajors:r}=Fp(e.currentVersion,e.latestVersion,e.majorsBehind),o=_p(t,e.package,e.ecosystem),a=Op(s,o),i=Bp(s,e.currentVersion,e.latestVersion),c=n.fixesVulnerabilities??[],l=[];return r.length&&l.push(`Step through ${r.join(" \u2192 ")} before the latest major rather than jumping directly.`),o.filesTouched===0&&s&&s>0?l.push("No direct source usage found \u2014 likely a transitive or config-only dependency; upgrade risk is mostly indirect."):o.filesTouched>0&&l.push(`Used at ${o.importSites} import site(s) across ${o.filesTouched} file(s) \u2014 review these when upgrading.`),c.length&&l.push(`Upgrading also remediates ${c.length} open advisory(ies): ${c.join(", ")}.`),{package:e.package,ecosystem:e.ecosystem,currentVersion:e.currentVersion,latestVersion:e.latestVersion,majorsBehind:s,interimMajors:r,usage:o,blastRadius:a,recommendation:i,fixesVulnerabilities:c,notes:l}}var ni={critical:7,high:30,moderate:90,low:180,unknown:null};function Vp(t,e){let n=Date.parse(t),s=Date.parse(e);return !Number.isFinite(n)||!Number.isFinite(s)?null:Math.max(0,Math.round((s-n)/864e5))}function Dp(t){let e=t.fixedVersions.map(n=>Ee.valid(Ee.coerce(n))).filter(n=>!!n);return e.length?e.sort(Ee.compare)[0]??null:null}function Up(t,e){if(e.affectedRanges&&e.affectedRanges.length||e.affectedVersions&&e.affectedVersions.length)return Qo(t,e.affectedRanges,e.affectedVersions);let n=Dp(e);if(!n)return true;let s=Ee.valid(Ee.coerce(t));return s?Ee.lt(s,n):false}function Gp(t){return {sha:t.sha,shortSha:t.shortSha,authorName:t.authorName,authorEmail:t.authorEmail,date:t.date,subject:t.subject}}function qp(t,e){if(!t||!t.changes.length)return null;let n=null;for(let s=t.changes.length-1;s>=0;s--){let r=t.changes[s];if(Up(r.version,e))n=Gp(r.commit);else break}return n}function Hp(){return {low:0,moderate:0,high:0,critical:0,unknown:0}}function Wp(t,e,n=ni){let s=Hp(),r=0,o=0,a=0,i=null,c=0,l=0;for(let u of t.packages)for(let p of u.advisories){r++,s[p.severity]++;let d=p.exposureDays??null;if(d!=null){a++,c+=d,l++,(i==null||d>i)&&(i=d);let f=n[p.severity];f!=null&&d>f&&o++;}}return {openCount:r,openBySeverity:s,slaDays:n,slaBreaches:o,maxOpenExposureDays:i,meanOpenExposureDays:l>0?Math.round(c/l):null,attributedCount:a}}function zp(t,e,n,s=ni){let r=new Map;for(let o of e?.packages??[])r.set(o.name,o);for(let o of t.packages){let a=o.ecosystem==="npm"?r.get(o.package):void 0;for(let i of o.advisories){let c=qp(a,i);i.introduced=c,i.exposureDays=c?Vp(c.date,n):null;}}return t.cra=Wp(t,n,s),t}var Jp=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;baseUrl="https://api.nuget.org/v3-flatcontainer";get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let s=G(this.manifest,"nuget",t);if(s){let r=(s.versions??[]).filter(i=>Ne.valid(i)&&Ne.prerelease(i)===null),a=[...r].sort(Ne.rcompare)[0]??null;return {latest:s.latest??a,stableVersions:r,latestStableOverall:a}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let r=`${this.baseUrl}/${t.toLowerCase()}/index.json`,o=await fetch(r,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/json"}});if(!o.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let c=((await o.json()).versions??[]).filter(p=>Ne.valid(p)&&Ne.prerelease(p)===null),u=[...c].sort(Ne.rcompare)[0]??null;return {latest:u,stableVersions:c,latestStableOverall:u}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}};function qn(t){let e=t.replace(/^[vV]/,"").trim();if(/(?:a|b|rc|alpha|beta|dev|post)\d*/i.test(e))return null;let n=e.split(".");for(;n.length<3;)n.push("0");return e=n.slice(0,3).join("."),hn.valid(e)}var Kp=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let s=G(this.manifest,"pypi",t);if(s){let r=[];for(let i of s.versions??[]){let c=qn(i);c&&r.push(c);}let a=[...r].sort(hn.rcompare)[0]??null;return {latest:s.latest?qn(s.latest)??a:a,stableVersions:r,latestStableOverall:a}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let r=`https://pypi.org/pypi/${encodeURIComponent(t)}/json`,o=await fetch(r,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/json"}});if(!o.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let a=await o.json(),i=Object.keys(a.releases??{}),c=[];for(let f of i){let h=qn(f);h&&c.push(h);}let l=a.info?.version??null,u=l?qn(l):null,d=[...c].sort(hn.rcompare)[0]??u??null;return {latest:u??d,stableVersions:c,latestStableOverall:d}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}};function Cs(t){let e=t.trim();if(/(?:[-.](?:SNAPSHOT|alpha|beta|rc|M\d+|CR\d+))/i.test(e))return null;e=e.replace(/\.(?:RELEASE|Final|GA)$/i,"");let n=e.split(".");for(;n.length<3;)n.push("0");return e=n.slice(0,3).join("."),gn.valid(e)}var Xp=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t,e){let n=`${t}:${e}`,s=this.meta.get(n);if(s)return s;let r=this.sem.run(async()=>{let o=`${t}:${e}`,a=G(this.manifest,"maven",o);if(a){let i=[];for(let u of a.versions??[]){let p=Cs(u);p&&i.push(p);}let l=[...i].sort(gn.rcompare)[0]??null;return {latest:a.latest?Cs(a.latest)??l:l,stableVersions:i,latestStableOverall:l}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let i=`https://search.maven.org/solrsearch/select?q=g:%22${encodeURIComponent(t)}%22+AND+a:%22${encodeURIComponent(e)}%22&core=gav&rows=100&wt=json`,c=await fetch(i,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/json"}});if(!c.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let p=((await c.json()).response?.docs??[]).map(m=>m.v).filter(m=>typeof m=="string"),d=[];for(let m of p){let y=Cs(m);y&&d.push(y);}let h=[...d].sort(gn.rcompare)[0]??null;return {latest:h,stableVersions:d,latestStableOverall:h}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(n,r),r}};function As(t){let e=t.trim();if(/(?:\.pre|\.rc|\.beta|\.alpha|\.dev)/i.test(e))return null;let n=e.split(".");if(n.length<2)return null;for(;n.length<3;)n.push("0");let s=n.slice(0,3).join(".");return yn.valid(s)}var Yp=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let s=G(this.manifest,"rubygems",t);if(s){let r=[];for(let i of s.versions??[]){let c=As(i);c&&r.push(c);}let a=[...r].sort(yn.rcompare)[0]??null;return {latest:s.latest?As(s.latest)??a:a,stableVersions:r,latestStableOverall:a}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let r=`https://rubygems.org/api/v1/versions/${encodeURIComponent(t)}.json`,o=await fetch(r,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/json"}});if(!o.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let a=await o.json();if(!Array.isArray(a))return {latest:null,stableVersions:[],latestStableOverall:null};let i=[];for(let u of a){if(u.prerelease)continue;let p=u.number;if(!p)continue;let d=As(p);d&&i.push(d);}let l=[...i].sort(yn.rcompare)[0]??null;return {latest:l,stableVersions:i,latestStableOverall:l}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}},Qp=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let s=G(this.manifest,"swift",t);if(s){let r=[];for(let i of s.versions??[]){let c=ne.valid(ne.clean(i));c&&r.push(c);}let a=[...r].sort(ne.rcompare)[0]??null;return {latest:s.latest?ne.valid(ne.clean(s.latest))??a:a,stableVersions:r,latestStableOverall:a}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let r=t.match(/github\.com[/:]([^/]+\/[^/]+?)(\.git)?$/i);if(!r)return {latest:null,stableVersions:[],latestStableOverall:null};let o=r[1],a=`https://api.github.com/repos/${o}/releases`,i=await fetch(a,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/vnd.github+json","User-Agent":"vibgrate-cli"}});if(!i.ok)return this.fetchFromTags(o);let c=await i.json();if(!Array.isArray(c))return {latest:null,stableVersions:[],latestStableOverall:null};let l=[];for(let d of c){if(d.prerelease||d.draft)continue;let f=d.tag_name;if(!f)continue;let h=ne.valid(ne.clean(f));h&&l.push(h);}let p=[...l].sort(ne.rcompare)[0]??null;return {latest:p,stableVersions:l,latestStableOverall:p}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}async fetchFromTags(t){try{let e=`https://api.github.com/repos/${t}/tags`,n=await fetch(e,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/vnd.github+json","User-Agent":"vibgrate-cli"}});if(!n.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let s=await n.json();if(!Array.isArray(s))return {latest:null,stableVersions:[],latestStableOverall:null};let r=[];for(let i of s){let c=i.name;if(!c||/(?:alpha|beta|rc|pre|dev)/i.test(c))continue;let l=ne.valid(ne.clean(c));l&&r.push(l);}let a=[...r].sort(ne.rcompare)[0]??null;return {latest:a,stableVersions:r,latestStableOverall:a}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}}},Zp=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let s=G(this.manifest,"go",t);if(s){let r=[];for(let i of s.versions??[]){let c=de.valid(de.clean(i));c&&r.push(c);}let a=[...r].sort(de.rcompare)[0]??null;return {latest:s.latest?de.valid(de.clean(s.latest))??a:a,stableVersions:r,latestStableOverall:a}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let o=`https://proxy.golang.org/${encodeURIComponent(t)}/@v/list`,a=await fetch(o,{signal:AbortSignal.timeout(1e4),headers:{Accept:"text/plain"}});if(!a.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let c=(await a.text()).split(`
57
- `).filter(Boolean),l=[];for(let d of c){if(/[+-](?:alpha|beta|rc|pre|dev)/i.test(d)||/v\d+\.\d+\.\d+-\d{14}-[a-f0-9]+/.test(d))continue;let f=de.valid(de.clean(d));f&&l.push(f);}let p=[...l].sort(de.rcompare)[0]??null;return {latest:p,stableVersions:l,latestStableOverall:p}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}},ed=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let s=G(this.manifest,"cargo",t);if(s){let r=[];for(let i of s.versions??[]){let c=fe.valid(fe.clean(i));c&&r.push(c);}let a=[...r].sort(fe.rcompare)[0]??null;return {latest:s.latest?fe.valid(fe.clean(s.latest))??a:a,stableVersions:r,latestStableOverall:a}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let r=`https://crates.io/api/v1/crates/${encodeURIComponent(t)}`,o=await fetch(r,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/json","User-Agent":"vibgrate-cli (https://github.com/vibgrate/vibgrate-cli)"}});if(!o.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let a=await o.json();if(!a.versions)return {latest:null,stableVersions:[],latestStableOverall:null};let i=[];for(let u of a.versions){if(u.yanked||!u.num||/[+-](?:alpha|beta|rc|pre|dev)/i.test(u.num))continue;let p=fe.valid(fe.clean(u.num));p&&i.push(p);}let l=[...i].sort(fe.rcompare)[0]??null;return {latest:l,stableVersions:i,latestStableOverall:l}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}},td=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let s=G(this.manifest,"composer",t);if(s){let r=[];for(let i of s.versions??[]){let c=me.valid(me.clean(i));c&&r.push(c);}let a=[...r].sort(me.rcompare)[0]??null;return {latest:s.latest?me.valid(me.clean(s.latest))??a:a,stableVersions:r,latestStableOverall:a}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let r=`https://repo.packagist.org/p2/${encodeURIComponent(t)}.json`,o=await fetch(r,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/json"}});if(!o.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let a=await o.json();if(!a.packages)return {latest:null,stableVersions:[],latestStableOverall:null};let i=a.packages[t];if(!i||!Array.isArray(i))return {latest:null,stableVersions:[],latestStableOverall:null};let c=[];for(let p of i){let d=p.version??p.version_normalized;if(!d||d==="dev-master"||d.startsWith("dev-")||/[+-](?:alpha|beta|rc|pre|dev)/i.test(d))continue;let f=me.valid(me.clean(d));f&&c.push(f);}let u=[...c].sort(me.rcompare)[0]??null;return {latest:u,stableVersions:c,latestStableOverall:u}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}},nd=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let s=G(this.manifest,"pub",t);if(s){let r=[];for(let i of s.versions??[]){let c=he.valid(he.clean(i));c&&r.push(c);}let a=[...r].sort(he.rcompare)[0]??null;return {latest:s.latest?he.valid(he.clean(s.latest))??a:a,stableVersions:r,latestStableOverall:a}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let r=`https://pub.dev/api/packages/${encodeURIComponent(t)}`,o=await fetch(r,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/json"}});if(!o.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let a=await o.json();if(!a.versions)return {latest:null,stableVersions:[],latestStableOverall:null};let i=[];for(let u of a.versions){if(!u.version||/[+-](?:alpha|beta|rc|pre|dev)/i.test(u.version))continue;let p=he.valid(he.clean(u.version));p&&i.push(p);}let l=[...i].sort(he.rcompare)[0]??null;return {latest:l,stableVersions:i,latestStableOverall:l}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}};async function si(t){try{return await sd(t)}catch{return {type:"unknown"}}}async function sd(t){let e=await rd(t);if(!e)return {type:"unknown"};let n=I.join(e,"HEAD"),s;try{s=(await ve.readFile(n,"utf8")).trim();}catch{return {type:"unknown"}}let r,o;if(s.startsWith("ref: ")){let i=s.slice(5);o=i.startsWith("refs/heads/")?i.slice(11):i,r=await od(e,i);}else /^[0-9a-f]{40}$/i.test(s)&&(r=s);let a=await id(e);return {type:"git",sha:r??void 0,shortSha:r?r.slice(0,7):void 0,branch:o??void 0,remoteUrl:a}}async function rd(t){let e=I.resolve(t),n=I.parse(e).root;for(;e!==n;){let s=I.join(e,".git");try{let r=await ve.stat(s);if(r.isDirectory())return s;if(r.isFile()){let o=(await ve.readFile(s,"utf8")).trim();if(o.startsWith("gitdir: "))return I.resolve(e,o.slice(8))}}catch{}e=I.dirname(e);}return null}async function od(t,e){let n=I.join(t,e);try{let r=(await ve.readFile(n,"utf8")).trim();if(/^[0-9a-f]{40}$/i.test(r))return r}catch{}let s=I.join(t,"packed-refs");try{let r=await ve.readFile(s,"utf8");for(let o of r.split(`
58
- `)){if(o.startsWith("#")||o.startsWith("^"))continue;let a=o.trim().split(" ");if(a.length>=2&&a[1]===e)return a[0]}}catch{}}async function id(t){let e=await ad(t);if(e)try{let s=(await ve.readFile(e,"utf8")).match(/\[remote\s+"origin"\]([\s\S]*?)(?=\n\[|$)/);return s?s[1]?.match(/\n\s*url\s*=\s*(.+)\s*/)?.[1]?.trim():void 0}catch{return}}async function ad(t){let e=I.join(t,"config");try{if((await ve.stat(e)).isFile())return e}catch{}let n=I.join(t,"commondir");try{let s=(await ve.readFile(n,"utf8")).trim();if(!s)return;let r=I.resolve(t,s),o=I.join(r,"config");if((await ve.stat(o)).isFile())return o}catch{return}}var ld=15e3,ud=64*1024*1024,ri=500,pd="";function Zn(t,e){return new Promise(n=>{execFile("git",e,{cwd:t,timeout:ld,maxBuffer:ud,windowsHide:true,encoding:"utf8",env:{...process.env,GIT_TERMINAL_PROMPT:"0",GIT_OPTIONAL_LOCKS:"0",GIT_PAGER:"cat"}},(s,r)=>{n(s?{ok:false,stdout:""}:{ok:true,stdout:typeof r=="string"?r:String(r)});});})}var So=new Map;function oi(t){return t.split(I.sep).join("/")}async function bn(t){let e=I.resolve(t),n=So.get(e);if(n!==void 0)return n;let s=await Zn(e,["rev-parse","--show-toplevel"]),r=s.ok&&s.stdout.trim()||null;return So.set(e,r),r}async function dd(t){return await bn(t)!==null}async function fd(t){let e=await bn(t);if(!e)return null;let n=await Zn(e,["rev-parse","HEAD"]);return n.ok&&n.stdout.trim()||null}async function _s(t,e,n={}){let s=await bn(t);if(!s)return [];let r=Math.max(1,n.maxCommits??ri),o=["%H","%h","%an","%ae","%aI","%s"].join("%x1f"),a=await Zn(s,["log",`--max-count=${r}`,"--follow",`--format=${o}`,"--",oi(e)]);if(!a.ok)return [];let i=[];for(let c of a.stdout.split(`
59
- `)){if(!c)continue;let l=c.split(pd);l.length<6||i.push({sha:l[0],shortSha:l[1],authorName:l[2],authorEmail:l[3],date:l[4],subject:l[5]});}return i.reverse(),i}async function md(t,e,n){if(!/^[0-9a-f]{4,40}$/i.test(e))return null;let s=await bn(t);if(!s)return null;let r=await Zn(s,["show",`${e}:${oi(n)}`]);return r.ok?r.stdout:null}var hd=["package-lock.json","npm-shrinkwrap.json"],ii=1,ai="npm-version-timeline.json";function gd(t){let e=new Map,n;try{n=JSON.parse(t);}catch{return e}if(!n||typeof n!="object")return e;let s=n,r=s.packages;if(r&&typeof r=="object"){let a=new Map;for(let i of Object.keys(r).sort()){if(!i)continue;let c="node_modules/",l=i.lastIndexOf(c);if(l===-1)continue;let u=i.slice(l+c.length);if(!u)continue;let p=r[i],d=p&&typeof p=="object"?p.version:void 0;if(typeof d!="string")continue;let f=i.split(c).length-1,h=a.get(u);(h===void 0||f<h)&&(e.set(u,d),a.set(u,f));}return e}let o=s.dependencies;return o&&typeof o=="object"&&ci(o,e),e}function ci(t,e){for(let n of Object.keys(t).sort()){let s=t[n];if(!s||typeof s!="object")continue;let r=s;typeof r.version=="string"&&!e.has(n)&&e.set(n,r.version),r.dependencies&&typeof r.dependencies=="object"&&ci(r.dependencies,e);}}async function yd(t,e){if(e)return (await _s(t,e,{maxCommits:1})).length?e:null;for(let n of hd)if((await _s(t,n,{maxCommits:1})).length)return n;return null}async function vd(t){try{let e=await ve.readFile(I.join(t,ai),"utf8"),n=JSON.parse(e);if(n?.schema===ii&&n.timeline)return n.timeline}catch{}return null}async function bd(t,e){try{await ve.mkdir(t,{recursive:!0});let n={schema:ii,timeline:e};await ve.writeFile(I.join(t,ai),JSON.stringify(n,null,2));}catch{}}async function wd(t,e={}){if(!await bn(t))return null;let s=await yd(t,e.lockfile);if(!s)return null;let r=await fd(t);if(e.cacheDir&&r){let u=await vd(e.cacheDir);if(u&&u.head===r&&u.lockfile===s)return u}let o=await _s(t,s,{maxCommits:e.maxCommits??ri});if(!o.length)return null;let a=new Map,i=new Map;for(let u of o){let p=await md(t,u.sha,s);if(p==null)continue;let d=gd(p);for(let[f,h]of d){if(a.get(f)===h)continue;a.set(f,h);let m=i.get(f);m||(m=[],i.set(f,m)),m.push({version:h,commit:u});}}let c=[...i.keys()].sort().map(u=>({ecosystem:"npm",name:u,changes:i.get(u)})),l={ecosystem:"npm",lockfile:s,head:r,packages:c};return e.cacheDir&&r&&await bd(e.cacheDir,l),l}function Te(t){return t.replace(/[^a-zA-Z0-9_]/g,"_")}function qt(t){return t.replace(/"/g,'\\"')}function Ht(t){return t===void 0||Number.isNaN(t)?"scoreUnknown":t>=80?"scoreHigh":t>=50?"scoreModerate":"scoreLow"}function fn(t){let e=t.drift?.score;return typeof e=="number"?`${t.name} (${e})`:t.name}function Gs(){return ["classDef scoreHigh fill:#1e293b,stroke:#10b981,color:#f1f5f9,stroke-width:2px","classDef scoreModerate fill:#1e293b,stroke:#f59e0b,color:#f1f5f9,stroke-width:2px","classDef scoreLow fill:#1e293b,stroke:#ef4444,color:#f1f5f9,stroke-width:2px","classDef scoreUnknown fill:#1e293b,stroke:#64748b,color:#94a3b8,stroke-width:2px"]}function Sd(t){let e=["flowchart LR"],n=new Map(t.map(a=>[a.path,a])),s=[],r=new Set;for(let a of t){let i=Te(a.projectId||a.path||a.name);for(let c of a.projectReferences??[]){let l=n.get(c.path);if(!l)continue;let u=Te(l.projectId||l.path||l.name);s.push(`${i} --> ${u}`),r.add(i),r.add(u);}}let o=r.size===0;for(let a of t){let i=Te(a.projectId||a.path||a.name);!o&&!r.has(i)||(e.push(`${i}["${qt(fn(a))}"]`),e.push(`class ${i} ${Ht(a.drift?.score)}`));}return e.push(...s),e.push(...Gs()),{mermaid:e.join(`
60
- `)}}function kd(t,e){let n=["flowchart LR"],s=new Map(e.map(i=>[i.path,i])),r=e.filter(i=>i.projectReferences?.some(c=>c.path===t.path)),o=(t.projectReferences??[]).map(i=>s.get(i.path)).filter(i=>!!i),a=Te(t.projectId||t.path||t.name);n.push(`${a}["${qt(fn(t))}"]`),n.push(`class ${a} ${Ht(t.drift?.score)}`);for(let i of r){let c=Te(i.projectId||i.path||i.name);n.push(`${c}["${qt(fn(i))}"]`),n.push(`class ${c} ${Ht(i.drift?.score)}`),n.push(`${c} --> ${a}`);}for(let i of o){let c=Te(i.projectId||i.path||i.name);n.push(`${c}["${qt(fn(i))}"]`),n.push(`class ${c} ${Ht(i.drift?.score)}`),n.push(`${a} --> ${c}`);}return n.push(...Gs()),{mermaid:n.join(`
61
- `)}}function Ed(t,e){let n=["flowchart TB"],s=Te(t.solutionId||t.path||t.name),r=t.drift?.score,o=typeof r=="number"?` (${r})`:" (n/a)";n.push(`${s}["${qt(`${t.name}${o}`)}"]`),n.push(`class ${s} ${Ht(r)}`);let a=new Map(e.map(i=>[i.path,i]));for(let i of t.projectPaths){let c=a.get(i);if(!c)continue;let l=Te(c.projectId||c.path||c.name);n.push(`${l}["${qt(fn(c))}"]`),n.push(`class ${l} ${Ht(c.drift?.score)}`),n.push(`${s} --> ${l}`);for(let u of c.projectReferences??[]){let p=a.get(u.path);if(!p)continue;let d=Te(p.projectId||p.path||p.name);n.push(`${l} --> ${d}`);}}return n.push(...Gs()),{mermaid:n.join(`
62
- `)}}var jd=createRequire(import.meta.url),Td=jd("../package.json");Td.version;var Cd="https://registry.npmjs.org/@vibgrate%2fcli/latest",pi=I.join(mn.homedir(),".vibgrate"),Ad=I.join(pi,"update-check.json");async function eh(){try{let t=new AbortController,e=setTimeout(()=>t.abort(),1e4);e.unref?.();let n;try{n=await fetch(Cd,{headers:{Accept:"application/json"},signal:t.signal});}finally{clearTimeout(e);}if(!n.ok)return null;let r=(await n.json()).version;return !r||!ui.default.valid(r)?null:(await Pd({latest:r,checkedAt:Date.now()}),r)}catch{return null}}async function Pd(t){try{await ve.mkdir(pi,{recursive:!0}),await ve.writeFile(Ad,JSON.stringify(t),"utf-8");}catch{}}var Md=[{category:"pricing",pattern:/price|pricing|billing|subscri|trial|credit|plan|tier|upgrade|premium|pro|enterprise/i},{category:"auth",pattern:/sign[- ]?in|sign[- ]?up|log[- ]?in|log[- ]?out|auth|sso|oauth|password|register|invite|onboard/i},{category:"dashboard",pattern:/dashboard|overview|home|main|summary|stats/i},{category:"settings",pattern:/setting|config|preference|option|profile|account/i},{category:"users",pattern:/user|member|team|role|permission|access|admin|owner/i},{category:"integrations",pattern:/integrat|connect|webhook|api[- ]?key|sync|import|export/i},{category:"reports",pattern:/report|analy|metric|chart|graph|insight|track/i},{category:"workflows",pattern:/workflow|automat|schedule|trigger|action|job|task|pipeline/i},{category:"projects",pattern:/project|workspace|organization|folder|repo/i},{category:"navigation",pattern:/menu|nav|sidebar|header|footer|breadcrumb/i}];function $d(t,e=3){let n=t.topEvidence,s=n.filter(u=>u.kind==="dependency").map(u=>u.value).slice(0,10),r=Id(n.filter(u=>u.kind==="route").map(u=>u.value)).slice(0,15),o=n.filter(u=>u.kind!=="dependency"&&u.kind!=="route"&&u.kind!=="feature_flag"),a=new Map,i={};for(let u of o){let p=Ld(u.value);a.has(p)||a.set(p,new Set);let d=Nd(u.value);d.length>=3&&a.get(p).add(d);}let c=[];for(let[u,p]of a){let d=Rd([...p]);i[u]=d.length;for(let f of d.slice(0,e))c.push({kind:"text",value:f,category:u});}let l=n.filter(u=>u.kind==="feature_flag");return l.length>0&&(i.feature_flags=l.length,c.push({kind:"feature_flag",value:"feature flags detected",category:"feature_flags"})),{samples:c,categoryCounts:i,originalCount:n.length,dependencies:s,routes:r,detectedFrameworks:t.detectedFrameworks}}function Ld(t){for(let{category:e,pattern:n}of Md)if(n.test(t))return e;return "general"}function Nd(t){return t.toLowerCase().replace(/[^a-z0-9\s-]/g," ").replace(/\s+/g," ").trim().slice(0,60)}function Rd(t){let e=t.sort((s,r)=>r.length-s.length),n=[];for(let s of e)n.some(o=>{let a=s.slice(0,6);return o.startsWith(a)||o.includes(s)||s.includes(o)})||n.push(s);return n}function Id(t){let e=new Set,n=[];for(let s of t){let r=s.replace(/:[a-z_]+/gi,":param").replace(/\[\[*\.*\.*[a-z_]+\]*\]/gi,":param").replace(/\/+$/,"").toLowerCase();e.has(r)||(e.add(r),n.push(s));}return n}var Fd=promisify(di.gzip),pe=50;function cn(t){let e=t.match(/^(.+?)\s*\(/);return e?e[1].trim():t.trim()}function Od(t){return {databaseTechnologies:t.databaseTechnologies.slice(0,10),connectionStrings:[],connectionPoolSettings:t.connectionPoolSettings.slice(0,pe),replicationSettings:t.replicationSettings.slice(0,20),readReplicaSettings:t.readReplicaSettings.slice(0,20),failoverSettings:t.failoverSettings.slice(0,20),collationAndEncoding:t.collationAndEncoding.slice(0,20),queryTimeoutDefaults:t.queryTimeoutDefaults.slice(0,20),manualIndexes:t.manualIndexes.map(cn).slice(0,pe),tables:t.tables.map(cn).slice(0,pe),views:t.views.map(cn).slice(0,pe),storedProcedures:t.storedProcedures.map(cn).slice(0,pe),triggers:t.triggers.map(cn).slice(0,pe),rowLevelSecurityPolicies:t.rowLevelSecurityPolicies.slice(0,20),otherServices:t.otherServices.slice(0,20)}}function Bd(t){let e=new Set;return {integrations:t.integrations.filter(s=>{let r=s.provider.split(":")[0];return e.has(r)?false:(e.add(r),true)}).slice(0,pe).map(s=>({provider:s.provider,endpoint:"",version:s.version,parameters:[],configOptions:[],authHints:[],files:[]})),openApiSpecifications:t.openApiSpecifications.slice(0,10),webhookUrls:t.webhookUrls.slice(0,20),callbackEndpoints:t.callbackEndpoints.slice(0,20),apiVersionPins:t.apiVersionPins.slice(0,20),tokenExpirationPolicies:t.tokenExpirationPolicies.slice(0,20),rateLimitOverrides:t.rateLimitOverrides.slice(0,20),customHeaders:t.customHeaders.slice(0,20),corsPolicies:t.corsPolicies.slice(0,20),oauthScopes:t.oauthScopes.slice(0,20),apiTokens:[]}}function Vd(t){return {faviconFiles:t.faviconFiles.slice(0,1),productLogos:[]}}function Dd(t){let e={...t};if(e.extended){let n={...e.extended};if(n.dataStores&&(n.dataStores=Od(n.dataStores)),n.apiSurface&&(n.apiSurface=Bd(n.apiSurface)),n.assetBranding&&(n.assetBranding=Vd(n.assetBranding)),n.uiPurpose){let s=$d(n.uiPurpose);n.uiPurpose={enabled:n.uiPurpose.enabled,detectedFrameworks:s.detectedFrameworks,evidenceCount:s.originalCount,capped:n.uiPurpose.capped,topEvidence:[],unknownSignals:[],compacted:s};}if(n.runtimeConfiguration&&(n.runtimeConfiguration={...n.runtimeConfiguration,environmentVariables:n.runtimeConfiguration.environmentVariables.slice(0,100),hiddenConfigFiles:n.runtimeConfiguration.hiddenConfigFiles.slice(0,pe),startupArguments:n.runtimeConfiguration.startupArguments.slice(0,100)}),n.operationalResilience){let s=n.operationalResilience;n.operationalResilience={implicitTimeouts:s.implicitTimeouts.slice(0,30),defaultPaginationSize:s.defaultPaginationSize.slice(0,30),implicitRetryLogic:s.implicitRetryLogic.slice(0,30),defaultLocale:s.defaultLocale.slice(0,20),defaultCurrency:s.defaultCurrency.slice(0,20),implicitTimezone:s.implicitTimezone.slice(0,20),defaultCharacterEncoding:s.defaultCharacterEncoding.slice(0,20),sessionStores:s.sessionStores.slice(0,20),distributedLocks:s.distributedLocks.slice(0,20),jobSchedulers:s.jobSchedulers.slice(0,30),idempotencyKeys:s.idempotencyKeys.slice(0,20),rateLimitingCounters:s.rateLimitingCounters.slice(0,20),circuitBreakerState:s.circuitBreakerState.slice(0,20),abTestToggles:s.abTestToggles.slice(0,20),regionalEnablementRules:s.regionalEnablementRules.slice(0,20),betaAccessGroups:s.betaAccessGroups.slice(0,20),licensingEnforcementLogic:s.licensingEnforcementLogic.slice(0,20),killSwitches:s.killSwitches.slice(0,20),connectorRetryLogic:s.connectorRetryLogic.slice(0,20),apiPollingIntervals:s.apiPollingIntervals.slice(0,20),fieldMappings:s.fieldMappings.slice(0,20),schemaRegistryRules:s.schemaRegistryRules.slice(0,20),deadLetterQueueBehavior:s.deadLetterQueueBehavior.slice(0,20),dataMaskingRules:s.dataMaskingRules.slice(0,20),transformationLogic:s.transformationLogic.slice(0,20),timezoneHandling:s.timezoneHandling.slice(0,20),encryptionSettings:s.encryptionSettings.slice(0,30),hardcodedSecretSignals:s.hardcodedSecretSignals.slice(0,20)};}n.dependencyGraph&&(n.dependencyGraph={...n.dependencyGraph,phantomDependencies:n.dependencyGraph.phantomDependencies.slice(0,pe),phantomDependencyDetails:n.dependencyGraph.phantomDependencyDetails?.slice(0,pe),duplicatedPackages:n.dependencyGraph.duplicatedPackages.slice(0,pe)}),e.extended=n;}return e}async function Ud(t){let e=JSON.stringify(t);return Fd(e,{level:9})}async function nh(t){let e=Dd(t);return {body:await Ud(e),contentEncoding:"gzip"}}function Gd(t){let n=t.replace(/[\x00-\x1F\x7F\uFEFF\u200B-\u200D\u2060]/g,"").trim().match(/^vibgrate\+(https?):?\/\/([^:]+):([^@]+)@([^/]+)\/(.+)$/);return n?{scheme:n[1],keyId:n[2],secret:n[3],host:n[4],workspaceId:n[5]}:null}async function sh(t,e,n){let s=e,r=new URL(`${t.scheme}://${s}/v1/ingest/scan/preflight`);n?.repositoryName&&r.searchParams.set("repository",n.repositoryName),n?.vcsSha&&r.searchParams.set("vcsSha",n.vcsSha);let o=String(Date.now()),a=await fetch(r.toString(),{method:"GET",headers:{"X-Vibgrate-Timestamp":o,Authorization:`VibgrateDSN ${t.keyId}:${t.secret}`}}),i=await a.json();if(!a.ok&&i.status!=="error")throw new Error(`HTTP ${a.status}: ${JSON.stringify(i)}`);return i}async function qd(t){let e=I.join(t,"package.json"),n$1=I.basename(t);if(await p(e))try{let s=await n(e);typeof s.name=="string"&&s.name.trim()&&(n$1=s.name.trim());}catch{}return n$1}var Hd=new Set(["node_modules",".git",".vibgrate",".wrangler",".next","dist","build","out",".turbo",".cache","coverage","bin","obj",".vs","TestResults",".nuxt",".output",".svelte-kit"]);async function rh(t,e){let n=e??await si(t);if(n.type==="git"&&n.sha)return {vcsSha:n.sha,method:"git_sha"};let s=await Wd(t);return s?{treeHash:s,method:"tree_metadata"}:{method:"unknown"}}async function Wd(t,e){let n=e?.maxFilesPerDirectory??500,s=[];async function r(a,i){let c;try{c=await ve.readdir(a,{withFileTypes:!0});}catch{return}let l=c.filter(u=>u.isFile());if(l.length>n){s.push(`${i||"."}|dir_overflow|${l.length}`);return}for(let u of c){if(u.isDirectory()){if(Hd.has(u.name))continue;let f=i?`${i}/${u.name}`:u.name;await r(I.join(a,u.name),f);continue}if(!u.isFile())continue;let p=i?`${i}/${u.name}`:u.name,d=I.join(a,u.name);try{let f=await ve.stat(d);s.push(`${p}|${f.size}|${f.mtimeMs}`);}catch{}}}if(await r(I.resolve(t),""),s.length===0)return;s.sort();let o=Os.createHash("sha256");for(let a of s)o.update(a),o.update(`
63
- `);return o.digest("hex")}var Xd="https://api.vibgrate.com",Yd=1e3*60*60*24,Qd=5e3;function Ps(t){return !!t&&typeof t=="object"&&typeof t.generatedAt=="string"&&typeof t.products=="object"&&t.products!==null}var Zd=class{apiBase;offline;manifest;cacheDir;fetchImpl;resolution=null;constructor(t={}){this.apiBase=(t.apiBase??process.env.VIBGRATE_API_BASE??Xd).replace(/\/+$/,""),this.offline=t.offline??false,this.manifest=t.manifest,this.cacheDir=t.cacheDir??I.join(mn.homedir(),".vibgrate","cache"),this.fetchImpl=t.fetchImpl??globalThis.fetch;}resolve(){return this.resolution||(this.resolution=this.doResolve()),this.resolution}get cacheFile(){return I.join(this.cacheDir,"runtimes.json")}async doResolve(){let t;if(!this.offline){let n=await this.readCache();if(n){if(Date.now()-Date.parse(n.fetchedAt)<Yd)return {catalog:n.catalog,source:"cache"};t=n.catalog;}let s=await this.fetchFromApi();if(s)return await this.writeCache(s),{catalog:s,source:"api"}}let e=this.manifest?.runtimes;return Ps(e)?{catalog:e,source:"manifest"}:t&&Date.parse(t.generatedAt)>Date.parse(je.generatedAt)?{catalog:t,source:"cache"}:{catalog:je,source:"bundled"}}async fetchFromApi(){if(!this.fetchImpl)return null;let t=new AbortController,e=setTimeout(()=>t.abort(),Qd);try{let n=await this.fetchImpl(`${this.apiBase}/v1/reference/runtimes`,{signal:t.signal,headers:{Accept:"application/json"}});if(!n.ok)return null;let s=await n.json();return Ps(s)?s:null}catch{return null}finally{clearTimeout(e);}}async readCache(){try{let t=await readFile(this.cacheFile,"utf8"),e=JSON.parse(t);if(e&&typeof e.fetchedAt=="string"&&Ps(e.catalog))return e}catch{}return null}async writeCache(t){try{await mkdir(this.cacheDir,{recursive:!0});let e={fetchedAt:new Date().toISOString(),catalog:t};await writeFile(this.cacheFile,JSON.stringify(e),"utf8");}catch{}}},rf=class hi{constructor(e){this.outPath=e;}events=[];start=Date.now();lastThrottled=new Map;flushed=false;static fromEnv(){let e=process.env.VIBGRATE_TRACE_EVENTS;return e?new hi(e):null}record(e,n={}){this.flushed||this.events.push({t:Date.now()-this.start,op:e,...n});}recordThrottled(e,n,s={},r=120){if(this.flushed)return;let o=Date.now(),a=this.lastThrottled.get(e)??0;o-a<r||(this.lastThrottled.set(e,o),this.record(n,s));}flush(e){if(this.flushed)return;this.flushed=true;let n={traceVersion:1,cliVersion:e.cliVersion,workspace:basename(e.rootDir)||e.rootDir,recordedAt:new Date().toISOString(),durationMs:Date.now()-this.start,events:this.events};try{mkdirSync(dirname(this.outPath),{recursive:!0}),writeFileSync(this.outPath,JSON.stringify(n));}catch{}}},Hn=[E.cyan(" \u256D\u2500\u2500\u2500\u256E")+E.greenBright("\u279C"),E.cyan(" \u256D\u2524")+E.greenBright("\u25C9 \u25C9")+E.cyan("\u251C\u256E"),E.cyan(" \u2570\u2524")+E.dim("\u2500\u2500\u2500")+E.cyan("\u251C\u256F"),E.cyan(" \u2570\u2500\u2500\u2500\u256F")];function ko(t){return [E.bold.white(" V I B G R A T E"),E.dim(" Drift Intelligence Engine")+E.dim(` v${t}`)]}var Eo=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],of=class{steps=[];stats={projects:0,dependencies:0,frameworks:0,findings:{warnings:0,errors:0,notes:0}};spinnerFrame=0;timer=null;lastRowCount=0;startTime=Date.now();isTTY;useLiveUpdates;rootDir="";lastFrame="";cursorHidden=false;estimatedTotalMs=null;stepEstimates=new Map;stepStartTimes=new Map;stepTimings=[];lastLoggedStates=new Map;version;trace;constructor(t,e="unknown"){if(this.version=e,this.trace=rf.fromEnv(),this.isTTY=process.stderr.isTTY??false,this.useLiveUpdates=this.isTTY&&process.env.VIBGRATE_PROGRESS_MODE!=="plain",this.rootDir=t,this.isTTY){let n=()=>{this.cursorHidden&&(process.stderr.write("\x1B[?25h"),this.cursorHidden=false);};process.on("exit",n),process.on("SIGINT",()=>{n(),process.exit(130);}),process.on("SIGTERM",()=>{n(),process.exit(143);});}}setEstimatedTotal(t){this.estimatedTotalMs=t,this.trace?.record("setEstimatedTotal",{estimatedMs:t});}setStepEstimates(t){this.stepEstimates=t;}getStepTimings(){return [...this.stepTimings]}setSteps(t){if(this.steps=t.map(e=>({...e,status:"pending",weight:e.weight??1})),this.trace?.record("setSteps",{steps:t.map(e=>({id:e.id,label:e.label,weight:e.weight??1}))}),this.isTTY){let e=["",` ${Hn[0]} ${ko(this.version)[0]}`,` ${Hn[1]} ${ko(this.version)[1]}`,` ${Hn[2]}`,` ${Hn[3]} ${E.dim(this.rootDir)}`,""].join(`
64
- `)+`
65
- `;process.stderr.write(e),this.useLiveUpdates&&this.startSpinner();}this.render();}insertStepBefore(t,e){let n=this.steps.findIndex(r=>r.id===t),s={...e,status:"pending",weight:e.weight??1};n>=0?this.steps.splice(n,0,s):this.steps.push(s),this.trace?.record("insertStepBefore",{beforeId:t,step:{id:e.id,label:e.label,weight:e.weight??1}});}startStep(t,e){let n=this.steps.find(s=>s.id===t);n&&(n.status="active",n.detail=void 0,n.count=void 0,n.subProgress=0,n.subTotal=e),this.stepStartTimes.set(t,Date.now()),this.trace?.record("startStep",{id:t,subTotal:e}),this.render();}completeStep(t,e,n){let s=this.steps.find(o=>o.id===t);s&&(s.status="done",s.detail=e,s.count=n);let r=this.stepStartTimes.get(t);r&&this.stepTimings.push({id:t,durationMs:Date.now()-r}),this.trace?.record("completeStep",{id:t,detail:e,count:n}),this.render();}skipStep(t){let e=this.steps.find(n=>n.id===t);e&&(e.status="skipped",e.detail="disabled"),this.trace?.record("skipStep",{id:t}),this.render();}updateStepProgress(t,e,n,s){let r=this.steps.find(o=>o.id===t);r&&(r.subProgress=e,n!==void 0&&(r.subTotal=n),s!==void 0&&(r.subLabel=s)),this.trace?.recordThrottled(`sub:${t}`,"updateStepProgress",{id:t,current:e,total:n,label:s}),this.render();}updateStats(t){Object.assign(this.stats,t),this.traceStats(true),this.render();}addProjects(t){this.stats.projects+=t,this.traceStats(),this.render();}addDependencies(t){this.stats.dependencies+=t,this.traceStats(),this.render();}addFrameworks(t){this.stats.frameworks+=t,this.traceStats(),this.render();}addFindings(t,e,n){this.stats.findings.warnings+=t,this.stats.findings.errors+=e,this.stats.findings.notes+=n,this.traceStats(),this.render();}traceStats(t=false){if(!this.trace)return;let e={stats:{...this.stats,findings:{...this.stats.findings},treeSummary:this.stats.treeSummary?{...this.stats.treeSummary}:void 0}};t?this.trace.record("stats",e):this.trace.recordThrottled("stats","stats",e);}finish(){if(this.timer&&(clearInterval(this.timer),this.timer=null),this.isTTY){let n="";this.lastRowCount>0&&(n+=`\x1B[${this.lastRowCount}A`,n+="\x1B[J"),n+="\x1B[?25h",n&&process.stderr.write(n),this.cursorHidden=false,this.lastRowCount=0;}let t=this.formatElapsed(Date.now()-this.startTime),e=this.steps.filter(n=>n.status==="done").length;process.stderr.write(E.dim(` \u2714 ${e} scanners completed in ${t}
66
-
67
- `)),this.trace?.record("finish",{doneCount:e,elapsedMs:Date.now()-this.startTime,summary:`${e} scanners completed in ${t}`}),this.trace?.flush({cliVersion:this.version,rootDir:this.rootDir}),this.isTTY&&process.platform==="win32"&&process.stdout.write("\x1B[0G\x1B[K");}startSpinner(){this.cursorHidden||(process.stderr.write("\x1B[?25l"),this.cursorHidden=true),this.timer=setInterval(()=>{this.spinnerFrame=(this.spinnerFrame+1)%Eo.length,this.render();},120);}clearLines(){}render(){if(!this.useLiveUpdates){this.renderCI();return}let t=[];for(let h of this.steps)t.push(this.renderStep(h));t.push("");let e=this.steps.reduce((h,m)=>h+(m.weight??1),0),n=0;for(let h of this.steps){let m=h.weight??1;if(h.status==="done"||h.status==="skipped")n+=m;else if(h.status==="active"&&h.subTotal&&h.subTotal>0&&h.subProgress!==void 0)n+=m*Math.min(h.subProgress/h.subTotal,.99);else if(h.status==="active"){let y=this.stepStartTimes.get(h.id),x=this.stepEstimates.get(h.id);if(y&&x&&x>0){let C=Date.now()-y;n+=m*Math.min(C/x,.95);}}}let s=e>0?Math.min(Math.round(n/e*100),99):0,r=30,o=Math.round(n/Math.max(e,1)*r),a=E.greenBright("\u2501".repeat(Math.min(o,r)))+E.dim("\u254C".repeat(Math.max(r-o,0))),i=Date.now()-this.startTime,c=this.formatElapsed(i),l=this.computeEtaString(i,n,e),u=this.stats.treeSummary?E.dim(` \xB7 ${this.stats.treeSummary.totalFiles.toLocaleString()} files \xB7 ${this.stats.treeSummary.totalDirs.toLocaleString()} dirs`):"";t.push(` ${a} ${E.bold.white(`${s}%`)} ${E.dim(c)}${l}${u}`),t.push(""),t.push(this.renderStats()),t.push("");let p=t.join(`
68
- `)+`
69
- `,d=this.countRenderedRows(t);if(p===this.lastFrame&&this.lastRowCount===d)return;this.lastFrame=p;let f="";this.lastRowCount>0&&(f+=`\x1B[${this.lastRowCount}A`,f+="\x1B[J"),f+=p,process.stderr.write(f),this.lastRowCount=d;}countRenderedRows(t){let e=Math.max(process.stderr.columns??80,20);return t.reduce((n,s)=>n+this.countWrappedRows(s,e),0)}countWrappedRows(t,e){let n=Math.max(this.getDisplayWidth(t),1);return Math.max(1,Math.ceil(n/e))}getDisplayWidth(t){let e=this.stripAnsi(t).replace(/\r/g,""),n=0;for(let s of e){let r=s.codePointAt(0);r!==void 0&&(r>=0&&r<32||r>=127&&r<160||(n+=this.isWideCodePoint(r)?2:1));}return n}stripAnsi(t){return t.replace(/\x1b(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~]|\][^\x07\x1b]*(?:\x07|\x1b\\))/g,"")}isWideCodePoint(t){return t>=4352&&(t<=4447||t===9001||t===9002||t>=11904&&t<=42191&&t!==12351||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65135||t>=65280&&t<=65376||t>=65504&&t<=65510||t>=127744&&t<=128591||t>=129280&&t<=129535||t>=131072&&t<=262141)}renderStep(t){let e=Eo[this.spinnerFrame],n,s,r="";switch(t.status){case "done":n=E.green("\u2714"),s=E.white(t.label);break;case "active":if(n=E.cyan(e),s=E.bold.white(t.label),t.subTotal&&t.subTotal>0&&t.subProgress!==void 0&&t.subProgress>0&&(r=E.dim(` \xB7 ${t.subProgress.toLocaleString()} / ${t.subTotal.toLocaleString()}`)),t.subLabel){let a=t.subLabel.length>50?"\u2026"+t.subLabel.slice(-49):t.subLabel;r+=E.dim(` ${a}`);}break;case "skipped":n=E.dim("\u25CC"),s=E.dim.strikethrough(t.label);break;default:n=E.dim("\u25CB"),s=E.dim(t.label);break}return t.detail&&(r=E.dim(` \xB7 ${t.detail}`)),t.count!==void 0&&t.count>0&&(r+=E.cyan(` (${t.count})`)),` ${n} ${s}${r}`}renderStats(){let t=this.stats.projects,e=this.stats.dependencies,n=this.stats.frameworks,s=this.stats.findings.warnings,r=this.stats.findings.errors,o=this.stats.findings.notes,a=[E.bold.white(` ${t}`)+E.dim(` project${t!==1?"s":""}`),E.white(`${e}`)+E.dim(` dep${e!==1?"s":""}`),E.white(`${n}`)+E.dim(` framework${n!==1?"s":""}`)],i=[];return r>0&&i.push(E.red(`${r} \u2716`)),s>0&&i.push(E.yellow(`${s} \u26A0`)),o>0&&i.push(E.blue(`${o} \u2139`)),i.length>0&&a.push(i.join(E.dim(" \xB7 "))),` ${E.dim("\u2503")} ${a.join(E.dim(" \u2502 "))}`}renderCI(){for(let t of this.steps){let e=t.status==="done"?[t.status,t.detail??"",t.count?.toString()??""].join("|"):t.status;if(this.lastLoggedStates.get(t.id)!==e){if(this.lastLoggedStates.set(t.id,e),t.status==="active"){process.stderr.write(` \u25C9 ${t.label}...
70
- `);continue}if(t.status==="done"){let n=this.formatLoggedStepDetail(t);process.stderr.write(` \u2714 ${t.label}${n}
71
- `);continue}if(t.status==="skipped"){let n=t.detail?` \xB7 ${t.detail}`:"";process.stderr.write(` \u25CC ${t.label}${n}
72
- `);}}}}formatLoggedStepDetail(t){let e="";return t.detail&&(e+=` \xB7 ${t.detail}`),t.count!==void 0&&t.count>0&&(e+=` (${t.count})`),e}formatElapsed(t){let e=t/1e3;if(e<90)return `${e.toFixed(1)}s`;let n=Math.floor(e/60),s=Math.floor(e%60);return `${n}m ${s.toString().padStart(2,"0")}s`}computeEtaString(t,e,n){if(n===0||t<2e3)return "";let s=e/n;if(s<.03){if(this.estimatedTotalMs!==null&&this.estimatedTotalMs>0){let a=Math.max(0,this.estimatedTotalMs-t);if(a>1e3)return E.dim(` \xB7 ~${this.formatElapsed(a)} left`)}return ""}let r=t/s*(1-s),o;if(this.estimatedTotalMs!==null&&this.estimatedTotalMs>0){let a=Math.max(0,this.estimatedTotalMs-t),i=Math.max(.1,1-s),c=a*i+r*(1-i);o=Math.min(a,c);}else o=r;return o<1500?"":E.dim(` \xB7 ~${this.formatElapsed(o)} left`)}},gi="scan_history.json",xo=10;async function yi(t){let e=I.join(t,".vibgrate",gi);try{let n=await ve.readFile(e,"utf8"),s=JSON.parse(n);return s.version===1&&Array.isArray(s.records)?s:null}catch{return null}}async function af(t,e){let n=I.join(t,".vibgrate"),s=I.join(n,gi),r,o=await yi(t);o?(r=o,r.records.push(e),r.records.length>xo&&(r.records=r.records.slice(-xo))):r={version:1,records:[e]};try{await ve.mkdir(n,{recursive:!0}),await ve.writeFile(s,JSON.stringify(r,null,2)+`
73
- `,"utf8");}catch{}}function cf(t,e){if(!t||t.records.length===0)return null;let n=t.records.filter(r=>{if(r.totalFiles===0||e===0)return false;let o=e/r.totalFiles;return o>=.33&&o<=3});if(n.length>0){let r=0,o=0;for(let a=0;a<n.length;a++){let i=n[a],c=a+1,l=e/i.totalFiles;r+=i.totalDurationMs*l*c,o+=c;}return Math.round(r/o)}let s=t.records[t.records.length-1];if(s.totalFiles>0&&e>0){let r=e/s.totalFiles;return Math.round(s.totalDurationMs*r)}return s.totalDurationMs}function lf(t,e){let n=new Map;if(!t||t.records.length===0)return n;let s=null;for(let o=t.records.length-1;o>=0;o--){let a=t.records[o];if(a.steps.length>0){s=a;break}}if(!s)return n;let r=s.totalFiles>0&&e>0?e/s.totalFiles:1;for(let o of s.steps)n.set(o.id,Math.round(o.durationMs*r));return n}async function uf(t,e){let n=await e.findSolutionFiles(t),s=[];for(let r of n)try{let o=await e.readTextFile(r),a=I.dirname(r),c=[I.basename(t),I.relative(t,r).replace(/\\/g,"/")].join("/"),l=new Set,u=/Project\("[^"]*"\)\s*=\s*"([^"]*)",\s*"([^"]+\.(?:cs|vb)proj)"/g,p;for(;(p=u.exec(o))!==null;){let f=p[2],h=I.resolve(a,f.replace(/\\/g,"/"));l.add(I.relative(t,h).replace(/\\/g,"/"));}let d=I.basename(r,I.extname(r));s.push({path:c,name:d,type:"dotnet-sln",projectPaths:[...l]});}catch{}return s}async function uh(t,e$1,n$1){let s$1=e$1.vibgrateVersion??"unknown",r$1=Date.now(),o=await za(t),a=new a$1(e$1.concurrency),i=e$1.packageManifest?await Cc(e$1.packageManifest):void 0,c=e$1.offline===true,l=e$1.maxPrivacy===true,u=new Rc(t,a,i,c),p$1=new Jp(a,i,c),d$1=new Kp(a,i,c),f=new Xp(a,i,c),h=new Yp(a,i,c),m=new Qp(a,i,c),y=new Zp(a,i,c),x=new ed(a,i,c),C=new td(a,i,c),A=new nd(a,i,c),T=new d,b=[...new Set([...o.exclude??[],...e$1.exclude??[]])];T.setExcludePatterns(b);let v=(e$1.projectScanTimeout??o.projectScanTimeout??180)*1e3;T.setMaxFileSize(o.maxFileSizeToScan??5242880),T.setProjectScanTimeout(v);let S=o.scanners,w=0,j=k=>{w+=k;},g=new of(t,s$1),P=[{id:"config",label:"Loading configuration"},{id:"discovery",label:"Discovering workspace",weight:3},{id:"vcs",label:"Detecting version control"},{id:"walk",label:"Indexing files",weight:8},{id:"drift",label:"Computing drift score"},{id:"findings",label:"Generating findings"}];if(e$1.postScan&&P.push({id:"map",label:"Building code map"}),g.setSteps(P),g.completeStep("config","loaded"),!(c?true:await Ic(t))){g.finish();let k=["",E.red.bold(" \u2716 Vibgrate cannot connect to the npm registry to check package versions."),"",E.dim(" Possible causes:"),E.dim(" \u2022 No internet connection"),E.dim(" \u2022 Corporate proxy/firewall blocking registry.npmjs.org"),E.dim(" \u2022 npm is not installed or not in PATH"),"",E.dim(" Try running: ")+E.cyan("npm view npm dist-tags.latest"),""].join(`
74
- `);throw new Error(k)}let le=await new Zd({offline:c,manifest:i}).resolve(),se=le.catalog,Hs=e(t,b);g.startStep("discovery");let re=await Hs;g.updateStats({treeSummary:re}),g.completeStep("discovery",`${re.totalFiles.toLocaleString()} files \xB7 ${re.totalDirs.toLocaleString()} dirs`);let Ws=await yi(t),vi=cf(Ws,re.totalFiles);g.setEstimatedTotal(vi),g.setStepEstimates(lf(Ws,re.totalFiles)),g.startStep("vcs");let xe=await si(t),bi=xe.type!=="unknown"?`${xe.type}${xe.branch?` ${xe.branch}`:""}${xe.shortSha?` @ ${xe.shortSha}`:""}`:"none detected";g.completeStep("vcs",bi),g.startStep("walk",re.totalFiles),await T.walkDir(t,(k,M)=>{g.updateStepProgress("walk",k,re.totalFiles,M);});let wn=T.getWalkSummary(t);wn&&(wn.totalFiles!==re.totalFiles||wn.totalDirs!==re.totalDirs)&&g.updateStats({treeSummary:wn}),g.completeStep("walk",`${re.totalFiles.toLocaleString()} files indexed`);let Fe=await Kc(t,u,T,v,se);if(Fe.length>0){g.insertStepBefore("drift",{id:"node",label:"Found Node projects",weight:4}),g.startStep("node");for(let k of Fe)g.addDependencies(k.dependencies.length),g.addFrameworks(k.frameworks.length);w+=Fe.length,g.addProjects(Fe.length),g.completeStep("node",`${Fe.length} project${Fe.length!==1?"s":""}`,Fe.length);}let Oe=await el(t,p$1,T,v,se);if(Oe.length>0){g.insertStepBefore("drift",{id:"dotnet",label:"Found .NET projects",weight:2}),g.startStep("dotnet");for(let k of Oe)g.addDependencies(k.dependencies.length),g.addFrameworks(k.frameworks.length);w+=Oe.length,g.addProjects(Oe.length),g.completeStep("dotnet",`${Oe.length} project${Oe.length!==1?"s":""}`,Oe.length);}let Be=await cl(t,d$1,T,v,se);if(Be.length>0){g.insertStepBefore("drift",{id:"python",label:"Found Python projects",weight:3}),g.startStep("python");for(let k of Be)g.addDependencies(k.dependencies.length),g.addFrameworks(k.frameworks.length);w+=Be.length,g.addProjects(Be.length),g.completeStep("python",`${Be.length} project${Be.length!==1?"s":""}`,Be.length);}let Ve=await hl(t,f,T,v,se);if(Ve.length>0){g.insertStepBefore("drift",{id:"java",label:"Found Java projects",weight:3}),g.startStep("java");for(let k of Ve)g.addDependencies(k.dependencies.length),g.addFrameworks(k.frameworks.length);w+=Ve.length,g.addProjects(Ve.length),g.completeStep("java",`${Ve.length} project${Ve.length!==1?"s":""}`,Ve.length);}let De=await xl(t,h,T,v,se);if(De.length>0){g.insertStepBefore("drift",{id:"ruby",label:"Found Ruby projects",weight:2}),g.startStep("ruby");for(let k of De)g.addDependencies(k.dependencies.length),g.addFrameworks(k.frameworks.length);w+=De.length,g.addProjects(De.length),g.completeStep("ruby",`${De.length} project${De.length!==1?"s":""}`,De.length);}let Ue=await Ml(t,m,T,v);if(Ue.length>0){g.insertStepBefore("drift",{id:"swift",label:"Found Swift projects",weight:2}),g.startStep("swift");for(let k of Ue)g.addDependencies(k.dependencies.length),g.addFrameworks(k.frameworks.length);w+=Ue.length,g.addProjects(Ue.length),g.completeStep("swift",`${Ue.length} project${Ue.length!==1?"s":""}`,Ue.length);}let Ge=await Rl(t,y,T,v,se);if(Ge.length>0){g.insertStepBefore("drift",{id:"go",label:"Found Go projects",weight:2}),g.startStep("go");for(let k of Ge)g.addDependencies(k.dependencies.length),g.addFrameworks(k.frameworks.length);w+=Ge.length,g.addProjects(Ge.length),g.completeStep("go",`${Ge.length} project${Ge.length!==1?"s":""}`,Ge.length);}let qe=await Bl(t,x,T,v);if(qe.length>0){g.insertStepBefore("drift",{id:"rust",label:"Found Rust projects",weight:2}),g.startStep("rust");for(let k of qe)g.addDependencies(k.dependencies.length),g.addFrameworks(k.frameworks.length);w+=qe.length,g.addProjects(qe.length),g.completeStep("rust",`${qe.length} project${qe.length!==1?"s":""}`,qe.length);}let He=await Hl(t,C,T,v);if(He.length>0){g.insertStepBefore("drift",{id:"php",label:"Found PHP projects",weight:2}),g.startStep("php");for(let k of He)g.addDependencies(k.dependencies.length),g.addFrameworks(k.frameworks.length);w+=He.length,g.addProjects(He.length),g.completeStep("php",`${He.length} project${He.length!==1?"s":""}`,He.length);}let We=await Yl(t,A,T,v);if(We.length>0){g.insertStepBefore("drift",{id:"dart",label:"Found Dart projects",weight:2}),g.startStep("dart");for(let k of We)g.addDependencies(k.dependencies.length),g.addFrameworks(k.frameworks.length);w+=We.length,g.addProjects(We.length),g.completeStep("dart",`${We.length} project${We.length!==1?"s":""}`,We.length);}let ze=await pu(t,i,T,v,c);if(ze.length>0){g.insertStepBefore("drift",{id:"elixir",label:"Found Elixir projects",weight:2}),g.startStep("elixir");for(let k of ze)g.addDependencies(k.dependencies.length),k.frameworks&&g.addFrameworks(k.frameworks.length);w+=ze.length,g.addProjects(ze.length),g.completeStep("elixir",`${ze.length} project${ze.length!==1?"s":""}`,ze.length);}let Je=await xu(t,i,T,v,c);if(Je.length>0){g.insertStepBefore("drift",{id:"docker",label:"Found Docker images",weight:2}),g.startStep("docker");for(let k of Je)g.addDependencies(k.dependencies.length);w+=Je.length,g.addProjects(Je.length),g.completeStep("docker",`${Je.length} project${Je.length!==1?"s":""}`,Je.length);}let Ke=await Iu(t,i,T,v,c);if(Ke.length>0){g.insertStepBefore("drift",{id:"helm",label:"Found Helm charts",weight:2}),g.startStep("helm");for(let k of Ke)g.addDependencies(k.dependencies.length),k.frameworks&&g.addFrameworks(k.frameworks.length);w+=Ke.length,g.addProjects(Ke.length),g.completeStep("helm",`${Ke.length} project${Ke.length!==1?"s":""}`,Ke.length);}let Xe=await Gu(t,i,T,v,c);if(Xe.length>0){g.insertStepBefore("drift",{id:"terraform",label:"Found Terraform configs",weight:2}),g.startStep("terraform");for(let k of Xe)g.addDependencies(k.dependencies.length);w+=Xe.length,g.addProjects(Xe.length),g.completeStep("terraform",`${Xe.length} project${Xe.length!==1?"s":""}`,Xe.length);}let Ye=await Ku(t,T);if(Ye.length>0){g.insertStepBefore("drift",{id:"polyglot",label:"Found additional language projects",weight:2}),g.startStep("polyglot");for(let k of Ye)g.addDependencies(k.dependencies.length),g.addFrameworks(k.frameworks.length);w+=Ye.length,g.addProjects(Ye.length),g.completeStep("polyglot",`${Ye.length} project${Ye.length!==1?"s":""}`,Ye.length);}let wi=new Set(["docker","helm","terraform"]),ss=k=>wi.has(k.type)?`${k.type}:${k.path}`:k.path,Si=[...Fe,...Oe,...Be,...Ve,...De,...Ue,...Ge,...qe,...He,...We,...ze,...Je,...Ke,...Xe,...Ye],Sn=new Map;for(let k of Si){let M=Sn.get(ss(k));if(!M)Sn.set(ss(k),k);else {let F=as=>as.dependencies.filter(ot=>ot.resolvedVersion||ot.latestStable).length,Rt=F(k)>F(M)||F(k)===F(M)&&k.dependencies.length>M.dependencies.length,rt=Rt?k:M,is=Rt?M:k;if(is.projectReferences?.length)if(!rt.projectReferences)rt.projectReferences=is.projectReferences;else {let as=new Set(rt.projectReferences.map(ot=>ot.path));for(let ot of is.projectReferences)as.has(ot.path)||rt.projectReferences.push(ot);}Sn.set(ss(k),rt);}}let Q=[...Sn.values()],zs=e$1.dsn||process.env.VIBGRATE_DSN,Js=(zs?Gd(zs):null)?.workspaceId;for(let k of Q){k.drift=Es([k]),k.projectId=cc(k.path,k.name,Js);let M=I.resolve(t,k.path);try{let F=await T.sourceMetricsUnder(t,M);k.fileCount===void 0&&(k.fileCount=F.fileCount),k.sizeBytes=F.sizeBytes;}catch{}k.dependencyCount=k.dependencies.length,k.classification=op({fileCount:k.fileCount,sizeBytes:k.sizeBytes,dependencyCount:k.dependencyCount});}let Ks=I.join(t,".vibgrate","solutions.json"),Xs=new Map;if(await p(Ks))try{let k=await n(Ks);for(let M of k.solutions??[])M.path&&M.solutionId&&Xs.set(M.path,M.solutionId);}catch{}let Mt=(await uf(t,T)).map(k=>({solutionId:Xs.get(k.path)??lc(k.path,k.name,Js),path:k.path,name:k.name,type:k.type,projectPaths:k.projectPaths})),rs=new Map(Q.map(k=>[k.path,k]));for(let k of Mt){let M=k.projectPaths.map(F=>rs.get(F)??rs.get(I.dirname(F).replace(/\\/g,"/"))).filter(F=>!!F);k.drift=M.length>0?Es(M):void 0;for(let F of M)F.solutionId=k.solutionId,F.solutionName=k.name;}for(let k of Q)k.relationshipDiagram=kd(k,Q);for(let k of Mt)k.relationshipDiagram=Ed(k,Q);let ki=Sd(Q),$t={};n$1&&await n$1({rootDir:t,opts:e$1,config:o,scanners:S,maxPrivacyMode:l,allProjects:Q,solutions:Mt,projectsByPath:rs,fileCache:T,progress:g,runtimeCatalog:se,extended:$t,addFilesScanned:j});let Ys=(Date.now()-Date.parse(se.generatedAt))/(1e3*60*60*24),Ei=Number.isFinite(Ys)&&Ys>30;$t.runtimeCatalogInfo={generatedAt:se.generatedAt,source:le.source,stale:Ei};let Qs=[];if(e$1.vulns){g.insertStepBefore("drift",{id:"vulns",label:"Scanning for vulnerabilities",weight:3}),g.startStep("vulns");let k=wp(Q),M=await jp(k,{sem:a,offline:c,manifest:i});if(M.packages.length>0&&await dd(t)){let Rt=!e$1.noLocalArtifacts&&!l?I.join(t,".vibgrate"):void 0,rt=await wd(t,{cacheDir:Rt});zp(M,rt,new Date().toISOString());}(M.source!=="none"||M.packages.length>0)&&($t.vulnerabilities=M),Qs=Ap(M);let F=M.packages.length;g.completeStep("vulns",F>0?`${M.totalAdvisories} advisor${M.totalAdvisories===1?"y":"ies"} across ${F} package${F===1?"":"s"}`:"none found");}g.startStep("drift");let os=Es(Q);g.completeStep("drift",`${os.score}/100 \u2014 ${os.riskLevel} risk`),g.startStep("findings");let kn=[...ac(Q,o),...Qs],En=kn.filter(k=>k.level==="warning").length,xn=kn.filter(k=>k.level==="error").length,jn=kn.filter(k=>k.level==="note").length;g.addFindings(En,xn,jn);let Tn=[];if(xn>0&&Tn.push(`${xn} error${xn!==1?"s":""}`),En>0&&Tn.push(`${En} warning${En!==1?"s":""}`),jn>0&&Tn.push(`${jn} note${jn!==1?"s":""}`),g.completeStep("findings",Tn.join(", ")||"none"),e$1.postScan){g.startStep("map");try{let k=await e$1.postScan((M,F,Rt)=>g.updateStepProgress("map",M,F,Rt));g.completeStep("map",k||"done");}catch{g.completeStep("map","skipped (map build failed)");}}g.finish();let Lt=T.stuckPaths,Nt=T.skippedLargeFiles;if(Lt.length>0){console.log(E.yellow(`
75
- \u26A0 ${Lt.length} path${Lt.length===1?"":"s"} timed out (>${Math.round(v/1e3)}s) and ${Lt.length===1?"was":"were"} skipped:`));for(let F of Lt)console.log(E.dim(` \u2192 ${F}`));let k=Lt.map(F=>`${F}/**`);await Ja(t,k)&&console.log(E.green("\u2714")+` Added ${k.length} pattern${k.length!==1?"s":""} to exclude list in config`);}if(Nt.length>0){let M=((o.maxFileSizeToScan??5242880)/1048576).toFixed(0);console.log(E.yellow(`
76
- \u26A0 ${Nt.length} file${Nt.length===1?"":"s"} skipped (>${M} MB):`));for(let F of Nt.slice(0,10))console.log(E.dim(` \u2192 ${F}`));Nt.length>10&&console.log(E.dim(` \u2026 and ${Nt.length-10} more`));}T.clear(),Q.length===0&&console.log(E.yellow("No projects found."));let Zs=Date.now()-r$1,xi=await pf(t,xe.remoteUrl,$t.buildDeploy?.ci,e$1.repositoryName),ji=ap(Q),ae={schemaVersion:"1.0",timestamp:new Date().toISOString(),vibgrateVersion:s$1,rootPath:I.basename(t),...xe.type!=="unknown"?{vcs:xe}:{},repository:xi,projects:Q,...Mt.length>0?{solutions:Mt}:{},drift:os,findings:kn,...Object.keys($t).length>0?{extended:$t}:{},durationMs:Zs,filesScanned:w,treeSummary:re,relationshipDiagram:ki,billing:ji};if(e$1.baseline){let k=I.resolve(e$1.baseline);if(await p(k))try{let M=await n(k);ae.baseline=k,ae.delta=ae.drift.score-M.drift.score;}catch{console.error(E.yellow(`Warning: Could not read baseline file: ${k}`));}}if(!e$1.noLocalArtifacts&&!l){let k=I.join(t,".vibgrate");await q$1(k),await r(I.join(k,"scan_result.json"),ae),await r(I.join(k,"solutions.json"),{scannedAt:ae.timestamp,solutions:Mt.map(M=>({solutionId:M.solutionId,name:M.name,path:M.path,type:M.type,projectPaths:M.projectPaths}))});}if(!e$1.noLocalArtifacts&&!l&&await af(t,{timestamp:ae.timestamp,totalDurationMs:Zs,totalFiles:re.totalFiles,totalDirs:re.totalDirs,steps:g.getStepTimings()}),!e$1.noLocalArtifacts&&!l){let k={};for(let M of Q)M.drift&&M.path&&(k[M.path]={projectId:M.projectId,name:M.name,type:M.type,path:M.path,score:M.drift.score,riskLevel:M.drift.riskLevel,components:M.drift.components,measured:M.drift.measured,scannedAt:ae.timestamp,vibgrateVersion:s$1,solutionId:M.solutionId,solutionName:M.solutionName});if(Object.keys(k).length>0){let M=I.join(t,".vibgrate");await q$1(M),await r(I.join(M,"project_scores.json"),k);}}if(e$1.format==="json"){let k=JSON.stringify(ae,null,2);e$1.out?(await s(I.resolve(e$1.out),k),console.log(E.green("\u2714")+` JSON written to ${e$1.out}`)):console.log(k);}else if(e$1.format==="sarif"){let k=yc(ae),M=JSON.stringify(k,null,2);e$1.out?(await s(I.resolve(e$1.out),M),console.log(E.green("\u2714")+` SARIF written to ${e$1.out}`)):console.log(M);}else if(e$1.format==="md"){let k=wc(ae);console.log(k),e$1.out&&await s(I.resolve(e$1.out),k);}else {let k=dc(ae);console.log(k),e$1.out&&await s(I.resolve(e$1.out),k);}return ae}async function pf(t,e,n$1,s){let r=s?.trim()?s.trim():await qd(t),o,a=I.join(t,"package.json");if(await p(a))try{let i=await n(a);typeof i.version=="string"&&i.version.trim()&&(o=i.version.trim());}catch{}return {name:r,...o?{version:o}:{},...n$1&&n$1.length>0?{pipeline:n$1.join(",")}:{},...e?{remoteUrl:e}:{}}}export{op as $,el as A,Qp as Aa,cl as B,Zp as Ba,hl as C,ed as Ca,xl as D,td as Da,Ml as E,nd as Ea,Rl as F,si as Fa,Bl as G,ri as Ga,Hl as H,bn as Ha,Yl as I,dd as Ia,pu as J,fd as Ja,xu as K,_s as Ka,Iu as L,md as La,Gu as M,gd as Ma,Ku as N,wd as Na,Xu as O,Sd as Oa,Yu as P,kd as Pa,Qu as Q,Ed as Qa,Zu as R,eh as Ra,ep as S,$d as Sa,tp as T,nh as Ta,np as U,Gd as Ua,sp as V,sh as Va,rp as W,qd as Wa,Ls as X,rh as Xa,Ns as Y,Wd as Ya,Rs as Z,uh as Za,zm as _,za as a,ip as aa,_m as b,Jm as ba,Ja as c,ap as ca,Ya as d,Ko as da,Qa as e,Xo as ea,Za as f,Gn as fa,ec as g,Yo as ga,Qr as h,yp as ha,Es as i,wp as ia,ac as j,Qo as ja,cc as k,Sp as ka,lc as l,jp as la,uc as m,Tp as ma,pc as n,Ap as na,to as o,_p as oa,Fm as p,Fp as pa,Om as q,Km as qa,Bm as r,ni as ra,Vm as s,Up as sa,dc as t,qp as ta,yc as u,Wp as ua,wc as v,zp as va,Cc as w,Jp as wa,Rc as x,Kp as xa,Ic as y,Xp as ya,Kc as z,Yp as za};