@vibgrate/cli 2026.630.2 → 2026.630.3

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,r,s}from'./chunk-XTHPCEME.js';import {b}from'./chunk-EK7ODJWE.js';import*as _ from'path';import {basename,dirname}from'path';import*as ye from'fs/promises';import {readFile,mkdtemp,rm,mkdir,writeFile}from'fs/promises';import F from'typescript';import*as As from'crypto';import E from'chalk';import*as an from'os';import {spawn,execFile}from'child_process';import {createRequire}from'module';import*as Ho from'zlib';import {promisify}from'util';import {mkdirSync,writeFileSync}from'fs';function oi(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 Ke(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 r=e.match(/(\d+)/);return r?r[1]:null}default:return null}}function ii(t,e,n=Date.now()){let r=e.find(o=>String(o.cycle)===t);if(!r)return null;if(typeof r.eol=="boolean")return r.eol;let s=Date.parse(r.eol);return Number.isNaN(s)?null:s<=n}function Ks(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 Sn(t){return t.major*1e3+t.minor}function Qs(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 kn(t,e){return t.products[e]?.cycles??[]}function Wt(t,e,n=Date.now()){let r=null;for(let s of kn(t,e)){if(!Qs(s,n))continue;let o=Ks(s.cycle);o&&(!r||Sn(o)>Sn(r))&&(r=o);}return r}function ts(t,e,n=Date.now()){let r=null;for(let s of kn(t,e)){if(!Qs(s,n)||!ai(s,n))continue;let o=Ks(s.cycle);o&&(!r||Sn(o)>Sn(r))&&(r=o);}return r}function st(t,e,n){let r=kn(t,e).find(s=>String(s.cycle)===n);return r&&typeof r.eol=="string"?r.eol:void 0}function rt(t,e,n,r=Date.now()){let s=oi(e);if(!s)return null;let o=Ke(e,n);return o?ii(o,kn(t,s),r):null}var Ee={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 ve=b(a(),1),et=b(a(),1),ht=b(a(),1);var Ys=":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",ci=Ys+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",li="["+Ys+"]["+ci+"]*",ui=new RegExp("^"+li+"$");function En(t,e){let n=[],r=e.exec(t);for(;r;){let s=[];s.startIndex=e.lastIndex-r[0].length;let o=r.length;for(let a=0;a<o;a++)s.push(r[a]);n.push(s),r=e.exec(t);}return n}var ns=function(t){let e=ui.exec(t);return !(e===null||typeof e>"u")};function Xs(t){return typeof t<"u"}var zt=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],jn=["__proto__","constructor","prototype"];var pi={allowBooleanAttributes:false,unpairedTags:[]};function sr(t,e){e=Object.assign({},pi,e);let n=[],r=false,s=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=er(t,o),o.err)return o}else if(t[o]==="<"){let a=o;if(o++,t[o]==="!"){o=tr(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=hi(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=nr(u,e);if(d===true)r=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&&(s=true);}}else return B("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",K(t,o));else {let p=nr(u,e);if(p!==true)return B(p.err.code,p.err.msg,K(t,o-u.length+p.err.line));if(s===true)return B("InvalidXml","Multiple possible root nodes found.",K(t,o));e.unpairedTags.indexOf(c)!==-1||n.push({tagName:c,tagStartPos:a}),r=true;}for(o++;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="!"){o++,o=tr(t,o);continue}else if(t[o+1]==="?"){if(o=er(t,++o),o.err)return o}else break;else if(t[o]==="&"){let p=yi(t,o);if(p==-1)return B("InvalidChar","char '&' is not expected.",K(t,o));o=p;}else if(s===true&&!Zs(t[o]))return B("InvalidXml","Extra text at the end",K(t,o));t[o]==="<"&&o--;}}else {if(Zs(t[o]))continue;return B("InvalidChar","char '"+t[o]+"' is not expected.",K(t,o))}if(r){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 Zs(t){return t===" "||t===" "||t===`
3
- `||t==="\r"}function er(t,e){let n=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){let r=t.substr(n,e-n);if(e>5&&r==="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 tr(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 di='"',fi="'";function hi(t,e){let n="",r="",s=false;for(;e<t.length;e++){if(t[e]===di||t[e]===fi)r===""?r=t[e]:r!==t[e]||(r="");else if(t[e]===">"&&r===""){s=true;break}n+=t[e];}return r!==""?false:{value:n,index:e,tagClosed:s}}var mi=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function nr(t,e){let n=En(t,mi),r={};for(let s=0;s<n.length;s++){if(n[s][1].length===0)return B("InvalidAttr","Attribute '"+n[s][2]+"' has no space in starting.",Jt(n[s]));if(n[s][3]!==void 0&&n[s][4]===void 0)return B("InvalidAttr","Attribute '"+n[s][2]+"' is without value.",Jt(n[s]));if(n[s][3]===void 0&&!e.allowBooleanAttributes)return B("InvalidAttr","boolean attribute '"+n[s][2]+"' is not allowed.",Jt(n[s]));let o=n[s][2];if(!bi(o))return B("InvalidAttr","Attribute '"+o+"' is an invalid name.",Jt(n[s]));if(!Object.prototype.hasOwnProperty.call(r,o))r[o]=1;else return B("InvalidAttr","Attribute '"+o+"' is repeated.",Jt(n[s]))}return true}function gi(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 yi(t,e){if(e++,t[e]===";")return -1;if(t[e]==="#")return e++,gi(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 ns(t)}function vi(t){return ns(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 Jt(t){return t.startIndex+t[1].length}var xn={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"},Kt={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},ss={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 At=Object.freeze({ALLOW:"allow",BLOCK:"block",THROW:"throw"}),Si=new Set("!?\\\\/[]$%{}^&*()<>|+");function gr(t){if(t[0]==="#")throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${t}"`);for(let e of t)if(Si.has(e))throw new Error(`[EntityReplacer] Invalid character '${e}' in entity name: "${t}"`);return t}function Qt(...t){let e=Object.create(null);for(let n of t)if(n)for(let r of Object.keys(n)){let s=n[r];if(typeof s=="string")e[r]=s;else if(s&&typeof s=="object"&&s.val!==void 0){let o=s.val;typeof o=="string"&&(e[r]=o);}}return e}var ot="external",Tn="base",rs="all";function ki(t){return !t||t===ot?new Set([ot]):t===rs?new Set([rs]):t===Tn?new Set([Tn]):Array.isArray(t)?new Set(t):new Set([ot])}var X=Object.freeze({allow:0,leave:1,remove:2,throw:3}),Ei=new Set([9,10,13]);function ji(t){if(!t)return {xmlVersion:1,onLevel:X.allow,nullLevel:X.remove};let e=t.xmlVersion===1.1?1.1:1,n=X[t.onNCR]??X.allow,r=X[t.nullNCR]??X.remove,s=Math.max(r,X.remove);return {xmlVersion:e,onLevel:n,nullLevel:s}}var Pt=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:r=>r,this._limitTiers=ki(this._limit.applyLimitsTo??ot),this._numericAllowed=e.numericAllowed??true,this._baseMap=Qt(Kt,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=ji(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,r,s){if(!e)return true;let o=e(n,r);if(o===At.BLOCK)return false;if(o===At.THROW)throw new Error(`[EntityDecoder] Registration of ${s} entity "&${n};" was rejected by hook`);return true}setExternalEntities(e){if(e)for(let s of Object.keys(e))gr(s);if(!this._onExternalEntity){this._externalMap=Qt(e);return}let n=Qt(e),r=Object.create(null);for(let[s,o]of Object.entries(n))this._applyRegistrationHook(this._onExternalEntity,s,o,"external")&&(r[s]=o);this._externalMap=r;}addExternalEntity(e,n){gr(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=Qt(e);return}let n=Qt(e),r=Object.create(null);for(let[s,o]of Object.entries(n))this._applyRegistrationHook(this._onInputEntity,s,o,"input")&&(r[s]=o);this._inputMap=r;}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,r=[],s=e.length,o=0,a=0,i=this._maxTotalExpansions>0,c=this._maxExpandedLength>0,l=i||c;for(;a<s;){if(e.charCodeAt(a)!==38){a++;continue}let p=a+1;for(;p<s&&e.charCodeAt(p)!==59&&p-a<=32;)p++;if(p>=s||e.charCodeAt(p)!==59){a++;continue}let d=e.slice(a+1,p);if(d.length===0){a++;continue}let f,g;if(this._removeSet.has(d))f="",g===void 0&&(g=ot);else if(this._leaveSet.has(d)){a++;continue}else if(d.charCodeAt(0)===35){let h=this._resolveNCR(d);if(h===void 0){a++;continue}f=h,g=Tn;}else {let h=this._resolveName(d);f=h?.value,g=h?.tier;}if(f===void 0){a++;continue}if(a>o&&r.push(e.slice(o,a)),r.push(f),o=p+1,a=o,l&&this._tierCounts(g)){if(i&&(this._totalExpansions++,this._totalExpansions>this._maxTotalExpansions))throw new Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);if(c){let h=f.length-(d.length+2);if(h>0&&(this._expandedLength+=h,this._expandedLength>this._maxExpandedLength))throw new Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`)}}}o<s&&r.push(e.slice(o));let u=r.length===0?e:r.join("");return this._postCheck(u,n)}_tierCounts(e){return this._limitTiers.has(rs)?true:this._limitTiers.has(e)}_resolveName(e){if(e in this._inputMap)return {value:this._inputMap[e],tier:ot};if(e in this._externalMap)return {value:this._externalMap[e],tier:ot};if(e in this._baseMap)return {value:this._baseMap[e],tier:Tn}}_classifyNCR(e){return e===0?this._ncrNullLevel:e>=55296&&e<=57343||this._ncrXmlVersion===1&&e>=1&&e<=31&&!Ei.has(e)?X.remove:-1}_applyNCRAction(e,n,r){switch(e){case X.allow:return String.fromCodePoint(r);case X.remove:return "";case X.leave:return;case X.throw:throw new Error(`[EntityDecoder] Prohibited numeric character reference &${n}; (U+${r.toString(16).toUpperCase().padStart(4,"0")})`);default:return String.fromCodePoint(r)}}_resolveNCR(e){let n=e.charCodeAt(1),r;if(n===120||n===88?r=parseInt(e.slice(2),16):r=parseInt(e.slice(1),10),Number.isNaN(r)||r<0||r>1114111)return;let s=this._classifyNCR(r);if(!this._numericAllowed&&s<X.remove)return;let o=s===-1?this._ncrOnLevel:Math.max(this._ncrOnLevel,s);return this._applyNCRAction(o,e,r)}};var yr=t=>zt.includes(t)?"__"+t:t,xi={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:yr};function Ti(t,e){if(typeof t!="string")return;let n=t.toLowerCase();if(zt.some(r=>n===r.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);if(jn.some(r=>n===r.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`)}function br(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"}:br(true)}var vr=function(t){let e=Object.assign({},xi,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:r,name:s}of n)r&&Ti(r,s);return e.onDangerousProperty===null&&(e.onDangerousProperty=yr),e.processEntities=br(e.processEntities,e.htmlEntities),e.unpairedTagsSet=new Set(e.unpairedTags),e.stopNodes&&Array.isArray(e.stopNodes)&&(e.stopNodes=e.stopNodes.map(r=>typeof r=="string"&&r.startsWith("*.")?".."+r.substring(2):r)),e};var Cn;typeof Symbol!="function"?Cn="@@xmlMetadata":Cn=Symbol("XML Node Metadata");var Z=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][Cn]={startIndex:n});}static getMetaDataSymbol(){return Cn}};var wr=":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",Ci=wr+"\\-\\.\\d\xB7\u0300-\u036F\u203F-\u2040",Sr=":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}",Ai=Sr+"\\-\\.\\d\xB7\u0300-\u036F\u0487\u203F-\u2040",kr=(t,e,n="")=>{let r=t.replace(":",""),s=e.replace(":",""),o=`[${r}][${s}]*`;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)}},Pi=kr(wr,Ci),Mi=kr(Sr,Ai,"u"),$i=(t="1.0")=>t==="1.1"?Mi:Pi;var os=(t,{xmlVersion:e="1.0"}={})=>$i(e).qName.test(t);var Xt=class{constructor(e,n){this.suppressValidationErr=!e,this.options=e,this.xmlVersion=n||1;}setXmlVersion(e=1){this.xmlVersion=e;}readDocType(e,n){let r=Object.create(null),s=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&&it(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&&s>=this.options.maxEntityCount)throw new Error(`Entity count (${s+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);r[l]=u,s++;}}else if(a&&it(e,"!ELEMENT",n)){n+=8;let{index:l}=this.readElementExp(e,n+1);n=l;}else if(a&&it(e,"!ATTLIST",n))n+=8;else if(a&&it(e,"!NOTATION",n)){n+=9;let{index:l}=this.readNotationExp(e,n+1,this.suppressValidationErr);n=l;}else if(it(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:r,i:n}}readEntityExp(e,n){n=ee(e,n);let r=n;for(;n<e.length&&!/\s/.test(e[n])&&e[n]!=='"'&&e[n]!=="'";)n++;let s=e.substring(r,n);if(Yt(s,{xmlVersion:this.xmlVersion}),n=ee(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 "${s}" size (${o.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return n--,[s,o,n]}readNotationExp(e,n){n=ee(e,n);let r=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;let s=e.substring(r,n);!this.suppressValidationErr&&Yt(s,{xmlVersion:this.xmlVersion}),n=ee(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=ee(e,n);let a=null,i=null;if(o==="PUBLIC")[n,a]=this.readIdentifierVal(e,n,"publicIdentifier"),n=ee(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:s,publicIdentifier:a,systemIdentifier:i,index:--n}}readIdentifierVal(e,n,r){let s="",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(s=e.substring(a,n),e[n]!==o)throw new Error(`Unterminated ${r} value`);return n++,[n,s]}readElementExp(e,n){n=ee(e,n);let r=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;let s=e.substring(r,n);if(!this.suppressValidationErr&&!os(s,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid element name: "${s}"`);n=ee(e,n);let o="";if(e[n]==="E"&&it(e,"MPTY",n))n+=4;else if(e[n]==="A"&&it(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:s,contentModel:o.trim(),index:n}}readAttlistExp(e,n){n=ee(e,n);let r=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;let s=e.substring(r,n);for(Yt(s,{xmlVersion:this.xmlVersion}),n=ee(e,n),r=n;n<e.length&&!/\s/.test(e[n]);)n++;let o=e.substring(r,n);if(!Yt(o,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid attribute name: "${o}"`);n=ee(e,n);let a="";if(e.substring(n,n+8).toUpperCase()==="NOTATION"){if(a="NOTATION",n+=8,n=ee(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(),!Yt(u,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid notation name: "${u}"`);c.push(u),e[n]==="|"&&(n++,n=ee(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=ee(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:s,attributeName:o,attributeType:a,defaultValue:i,index:n}}},ee=(t,e)=>{for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function it(t,e,n){for(let r=0;r<e.length;r++)if(e[r]!==t[n+r+1])return false;return true}function Yt(t,e){if(os(t,{xmlVersion:e}))return t;throw new Error(`Invalid entity name ${t}`)}var Li=[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],An=255,Pn=new Map,Er=65535,jr=1632,Mt=jr,Ni=Er-jr+1,Mn=new Uint8Array(Ni).fill(An);for(let t of Li)for(let e=0;e<10;e++){let n=t+e;n<=Er?Mn[n-Mt]=e:Pn.set(n,e);}var xr=48,Tr=57,Cr=45,$n=new Set([8722,65293,65123]);function Ri(t){if(typeof t!="string")return t;let e=t.length;if(e===0)return t;let n=-1;for(let s=0;s<e;s++){let o=t.charCodeAt(s);if(!(o>=xr&&o<=Tr||o===Cr)){if(o<Mt){if($n.has(o)){n=s;break}continue}if(o>=55296&&o<=56319){if(s+1<e){let a=t.charCodeAt(s+1);if(a>=56320&&a<=57343){let i=65536+(o-55296<<10)+(a-56320);if(Pn.has(i)){n=s;break}}}continue}if(Mn[o-Mt]!==An||$n.has(o)){n=s;break}}}if(n===-1)return t;let r=[];n>0&&r.push(t.slice(0,n));for(let s=n;s<e;s++){let o=t.charCodeAt(s);if(o>=xr&&o<=Tr||o===Cr){r.push(t[s]);continue}if(o<Mt){r.push($n.has(o)?"-":t[s]);continue}if(o>=55296&&o<=56319){if(s+1<e){let i=t.charCodeAt(s+1);if(i>=56320&&i<=57343){let c=65536+(o-55296<<10)+(i-56320),l=Pn.get(c);if(l!==void 0){r.push(String.fromCharCode(l+48)),s++;continue}}}r.push(t[s]);continue}if($n.has(o)){r.push("-");continue}let a=Mn[o-Mt];r.push(a!==An?String.fromCharCode(a+48):t[s]);}return r.join("")}var Ar=Ri;var Ii=/^[-+]?0x[a-fA-F0-9]+$/,_i=/^0b[01]+$/,Fi=/^0o[0-7]+$/,Oi=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,Bi={hex:true,binary:false,octal:false,leadingZeros:true,decimalPoint:".",eNotation:true,infinity:"original",unicode:false};function as(t,e={}){if(e=Object.assign({},Bi,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=Ar(n),n==="0"))return 0;if(e.hex&&Ii.test(n))return is(n,16);if(e.binary&&_i.test(n))return is(n,2);if(e.octal&&Fi.test(n))return is(n,8);if(isFinite(n)){if(n.includes("e")||n.includes("E"))return Vi(t,n,e);{let r=Oi.exec(n);if(r){let s=r[1]||"",o=r[2],a=Ui(r[3]),i=s?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===`${s}${a}`?c:t;let u=o?a:n;return o?u===l||s+u===l?c:t:u===l||u===s+l?c:t}}else return t}}else return Gi(t,Number(n),e)}var Di=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function Vi(t,e,n){if(!n.eNotation)return t;let r=e.match(Di);if(r){let s=r[1]||"",o=r[3].indexOf("e")===-1?"E":"e",a=r[2],i=s?t[a.length+1]===o:t[a.length]===o;return a.length>1&&i?t:a.length===1&&(r[3].startsWith(`.${o}`)||r[3][0]===o)?Number(e):a.length>0?n.leadingZeros&&!i?(e=(r[1]||"")+r[3],Number(e)):t:Number(e)}else return t}function Ui(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 is(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 Gi(t,e,n){let r=e===1/0;switch(n.infinity.toLowerCase()){case "null":return null;case "infinity":return e;case "string":return r?"Infinity":"-Infinity";default:return t}}function cs(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 at=class{constructor(e,n={},r){this.pattern=e,this.separator=n.separator||".",this.segments=this._parse(e),this.data=r,this._hasDeepWildcard=this.segments.some(s=>s.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(s=>s.attrName!==void 0),this._hasPositionSelector=this.segments.some(s=>s.position!==void 0);}_parse(e){let n=[],r=0,s="";for(;r<e.length;)e[r]===this.separator?r+1<e.length&&e[r+1]===this.separator?(s.trim()&&(n.push(this._parseSegment(s.trim())),s=""),n.push({type:"deep-wildcard"}),r+=2):(s.trim()&&n.push(this._parseSegment(s.trim())),s="",r++):(s+=e[r],r++);return s.trim()&&n.push(this._parseSegment(s.trim())),n}_parseSegment(e){let n={type:"tag"},r=null,s=e,o=e.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(o&&(s=o[1]+o[3],o[2])){let u=o[2].slice(1,-1);u&&(r=u);}let a,i=s;if(s.includes("::")){let u=s.indexOf("::");if(a=s.substring(0,u).trim(),i=s.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),r)if(r.includes("=")){let u=r.indexOf("=");n.attrName=r.substring(0,u).trim(),n.attrValue=r.substring(u+1).trim();}else n.attrName=r.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 $t=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,s=e.segments[e.segments.length-1]?.tag;if(!s||s==="*")this._wildcardByDepth.has(n)||this._wildcardByDepth.set(n,[]),this._wildcardByDepth.get(n).push(e);else {let o=`${n}:${s}`;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(),r=e.getCurrentTag(),s=`${n}:${r}`,o=this._byDepthAndTag.get(s);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(r);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 ls=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 r=n[n.length-1];return r.values!==void 0&&e in r.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)}},Lt=class{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new ls(this),this._keptAttrs=[];}push(e,n=null,r=null,s=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=r?`${r}:${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};r!=null&&(u.namespace=r),n!=null&&(u.values=n),this.path.push(u);let p=this.path.length,d=s!==null?s.keep:null;if(d!=null&&d.length>0&&n)for(let f=0;f<d.length;f++){let g=d[f];n[g]!==void 0&&this._keptAttrs.push({depth:p,name:g,value:n[g]});}}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 r=n.length-1;r>=0;r--)if(n[r].name===e)return n[r].value}hasAnyParentAttr(e){let n=this._keptAttrs;for(let r=n.length-1;r>=0;r--)if(n[r].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 r=e||this.separator;if(r===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(r);return this._pathStringCache=o,o}return this.path.map(o=>n&&o.namespace?`${o.namespace}:${o.tag}`:o.tag).join(r)}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,r=e.length-1;for(;r>=0&&n>=0;){let s=e[r];if(s.type==="deep-wildcard"){if(r--,r<0)return true;let o=e[r],a=false;for(let i=n;i>=0;i--)if(this._matchSegment(o,this.path[i],i===this.path.length-1)){n=i-1,r--,a=true;break}if(!a)return false}else {if(!this._matchSegment(s,this.path[n],n===this.path.length-1))return false;n--,r--;}}return r<0}_matchSegment(e,n,r){if(e.tag!=="*"&&e.tag!==n.tag||e.namespace!==void 0&&e.namespace!=="*"&&e.namespace!==n.namespace||e.attrName!==void 0&&(!r||!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(!r)return false;let s=n.counter??0;if(e.position==="first"&&s!==0)return false;if(e.position==="odd"&&s%2!==1)return false;if(e.position==="even"&&s%2!==0)return false;if(e.position==="nth"&&s!==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 qi=[{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}],Pr=qi;var Hi=[{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:/\?>/}],Mr=Hi;var Wi=[{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}],$r=Wi;var zi=[{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}],Ln=zi;var Ji=[{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}],Ki=[...Ln,...Ji],Lr=Ki;var Qi=[{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}],Nr=Qi;var Yi=[{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,}\)/}],Rr=Yi;var oe=`["'\\s]*:`,Xi=[{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__["']\]/}],Ir=Xi;var Zi=[{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\[/}],_r=Zi;var Fr={HTML:Pr,XML:Mr,SVG:$r,SQL:Ln,"SQL-STRICT":Lr,SHELL:Nr,REDOS:Rr,NOSQL:Ir,LOG:_r},Nn=Fr,Nt=Object.freeze(Object.fromEntries(Object.keys(Fr).map(t=>[t,t])));function ea(t){if(typeof t!="string")throw new TypeError(`is-unsafe: first argument must be a string, got ${typeof t}`)}function ta(t){if(!(t instanceof RegExp)){if(typeof t=="string"){if(!Nn[t])throw new TypeError(`is-unsafe: unknown context "${t}". Valid contexts: ${Object.keys(Nt).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"||!Nn[e])throw new TypeError(`is-unsafe: unknown context "${e}" in array. Valid contexts: ${Object.keys(Nt).join(", ")}`);return}throw new TypeError(`is-unsafe: second argument must be a context string, array of context strings, or RegExp. Got: ${typeof t}`)}}function Or(t,e){let n=Nn[e];for(let r of n)if(r.pattern.test(t))return {context:e,id:r.id,description:r.description,pattern:r.pattern};return null}function Br(t,e){if(ea(t),ta(e),e instanceof RegExp)return e.test(t);if(typeof e=="string")return Or(t,e)!==null;for(let n of e)if(Or(t,n)!==null)return true;return false}function na(t,e){if(!t)return {};let n=e.attributesGroupName?t[e.attributesGroupName]:t;if(!n)return {};let r={};for(let s in n)if(s.startsWith(e.attributeNamePrefix)){let o=s.substring(e.attributeNamePrefix.length);r[o]=n[s];}else r[s]=n[s];return r}function sa(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 Zt=class{constructor(e,n){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.parseXml=ca,this.parseTextData=ra,this.resolveNameSpace=oa,this.buildAttributesMap=aa,this.isItStopNode=da,this.replaceEntitiesValue=ua,this.readStopNodeData=ma,this.saveTextToParentTag=pa,this.addChild=la,this.ignoreAttributesFn=cs(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0;let r={...Kt};this.options.entityDecoder?this.entityDecoder=this.options.entityDecoder:(typeof this.options.htmlEntities=="object"?r=this.options.htmlEntities:this.options.htmlEntities===true&&(r={...ss,...xn}),this.entityDecoder=new Pt({namedEntities:{...r,...n},numericAllowed:this.options.htmlEntities,limit:{maxTotalExpansions:this.options.processEntities.maxTotalExpansions,maxExpandedLength:this.options.processEntities.maxExpandedLength,applyLimitsTo:this.options.processEntities.appliesTo},onInputEntity:(o,a)=>Br(a,[Nt.HTML,Nt.XML])?At.BLOCK:At.ALLOW})),this.matcher=new Lt,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=false,this.stopNodeExpressionsSet=new $t;let s=this.options.stopNodes;if(s&&s.length>0){for(let o=0;o<s.length;o++){let a=s[o];typeof a=="string"?this.stopNodeExpressionsSet.add(new at(a)):a instanceof at&&this.stopNodeExpressionsSet.add(a);}this.stopNodeExpressionsSet.seal();}}};function ra(t,e,n,r,s,o,a){let i=this.options;if(t!==void 0&&(i.trimValues&&!r&&(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,s,o);return l==null?t:typeof l!=typeof t||l!==t?l:i.trimValues||t.trim()===t?ds(t,i.parseTagValue,i.numberParseOptions):t}}function oa(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 ia=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function aa(t,e,n,r=false){let s=this.options;if(r===true||s.ignoreAttributes!==true&&typeof t=="string"){let o=En(t,ia),a=o.length,i={},c=new Array(a),l=false,u={};for(let f=0;f<a;f++){let g=this.resolveNameSpace(o[f][1]),h=o[f][4];if(g.length&&h!==void 0){let y=h;s.trimValues&&(y=y.trim()),y=this.replaceEntitiesValue(y,n,this.readonlyMatcher),c[f]=y,u[g]=y,l=true;}}l&&typeof e=="object"&&e.updateCurrent&&e.updateCurrent(u);let p=s.jPath?e.toString():this.readonlyMatcher,d=false;for(let f=0;f<a;f++){let g=this.resolveNameSpace(o[f][1]);if(this.ignoreAttributesFn(g,p))continue;let h=s.attributeNamePrefix+g;if(g.length)if(s.transformAttributeName&&(h=s.transformAttributeName(h)),h=Dr(h,s),o[f][4]!==void 0){let y=c[f],j=s.attributeValueProcessor(g,y,p);j==null?i[h]=y:typeof j!=typeof y||j!==y?i[h]=j:i[h]=ds(y,s.parseAttributeValue,s.numberParseOptions),d=true;}else s.allowBooleanAttributes&&(i[h]=true,d=true);}if(!d)return;if(s.attributesGroupName&&!s.preserveOrder){let f={};return f[s.attributesGroupName]=i,f}return i}}var ca=function(t){t=t.replace(/\r\n?/g,`
4
- `);let e=new Z("!xml"),n=e,r="";this.matcher.reset(),this.entityDecoder.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;let s=this.options,o=new Xt(s.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=Rt(t,">",i,"Closing Tag is not closed."),p=t.substring(i+2,u).trim();if(s.removeNSPrefix){let f=p.indexOf(":");f!==-1&&(p=p.substr(f+1));}p=us(s.transformTagName,p,"",s).tagName,n&&(r=this.saveTextToParentTag(r,n,this.readonlyMatcher));let d=this.matcher.getCurrentTag();if(p&&s.unpairedTagsSet.has(p))throw new Error(`Unpaired tag can not be used as closing tag: </${p}>`);d&&s.unpairedTagsSet.has(d)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=false,n=this.tagsNodeStack.pop(),r="",i=u;}else if(l===63){let u=ps(t,i,false,"?>");if(!u)throw new Error("Pi Tag is not closed.");r=this.saveTextToParentTag(r,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(!(s.ignoreDeclaration&&u.tagName==="?xml"||s.ignorePiTags)){let d=new Z(u.tagName);d.add(s.textNodeName,""),u.tagName!==u.tagExp&&u.attrExpPresent&&s.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=Rt(t,"-->",i+4,"Comment is not closed.");if(s.commentPropName){let p=t.substring(i+4,u-2);r=this.saveTextToParentTag(r,n,this.readonlyMatcher),n.add(s.commentPropName,[{[s.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=Rt(t,"]]>",i,"CDATA is not closed.")-2,p=t.substring(i+9,u);r=this.saveTextToParentTag(r,n,this.readonlyMatcher);let d=this.parseTextData(p,n.tagname,this.readonlyMatcher,true,false,true,true);d==null&&(d=""),s.cdataPropName?n.add(s.cdataPropName,[{[s.textNodeName]:p}]):n.add(s.textNodeName,d),i=u+2;}else {let u=ps(t,i,s.removeNSPrefix);if(!u){let b=t.substring(Math.max(0,i-50),Math.min(a,i+50));throw new Error(`readTagExp returned undefined at position ${i}. Context: "${b}"`)}let p=u.tagName,d=u.rawTagName,f=u.tagExp,g=u.attrExpPresent,h=u.closeIndex;if({tagName:p,tagExp:f}=us(s.transformTagName,p,f,s),s.strictReservedNames&&(p===s.commentPropName||p===s.cdataPropName||p===s.textNodeName||p===s.attributesGroupName))throw new Error(`Invalid tag name: ${p}`);n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,this.readonlyMatcher,false));let y=n;y&&s.unpairedTagsSet.has(y.tagname)&&(n=this.tagsNodeStack.pop(),this.matcher.pop());let j=false;f.length>0&&f.lastIndexOf("/")===f.length-1&&(j=true,p[p.length-1]==="/"?(p=p.substr(0,p.length-1),f=p):f=f.substr(0,f.length-1),g=p!==f);let C=null,T;T=sa(d),p!==e.tagname&&this.matcher.push(p,{},T),p!==f&&g&&(C=this.buildAttributesMap(f,this.matcher,p),C&&(na(C,s))),p!==e.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());let v=i;if(this.isCurrentNodeStopNode){let b="";if(j)i=u.closeIndex;else if(s.unpairedTagsSet.has(p))i=u.closeIndex;else {let w=this.readStopNodeData(t,d,h+1);if(!w)throw new Error(`Unexpected end of ${d}`);i=w.i,b=w.tagContent;}let S=new Z(p);C&&(S[":@"]=C),S.add(s.textNodeName,b),this.matcher.pop(),this.isCurrentNodeStopNode=false,this.addChild(n,S,this.readonlyMatcher,v);}else {if(j){({tagName:p,tagExp:f}=us(s.transformTagName,p,f,s));let b=new Z(p);C&&(b[":@"]=C),this.addChild(n,b,this.readonlyMatcher,v),this.matcher.pop(),this.isCurrentNodeStopNode=false;}else if(s.unpairedTagsSet.has(p)){let b=new Z(p);C&&(b[":@"]=C),this.addChild(n,b,this.readonlyMatcher,v),this.matcher.pop(),this.isCurrentNodeStopNode=false,i=u.closeIndex;continue}else {let b=new Z(p);if(this.tagsNodeStack.length>s.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(n),C&&(b[":@"]=C),this.addChild(n,b,this.readonlyMatcher,v),n=b;}r="",i=h;}}}else r+=t[i];return e.child};function la(t,e,n,r){this.options.captureMetaData||(r=void 0);let s=this.options.jPath?n.toString():n,o=this.options.updateTag(e.tagname,s,e[":@"]);o===false||(typeof o=="string"&&(e.tagname=o),t.addChild(e,r));}function ua(t,e,n){let r=this.options.processEntities;if(!r||!r.enabled)return t;if(r.allowedTags){let s=this.options.jPath?n.toString():n;if(!(Array.isArray(r.allowedTags)?r.allowedTags.includes(e):r.allowedTags(e,s)))return t}if(r.tagFilter){let s=this.options.jPath?n.toString():n;if(!r.tagFilter(e,s))return t}return this.entityDecoder.decode(t)}function pa(t,e,n,r){return t&&(r===void 0&&(r=e.child.length===0),t=this.parseTextData(t,e.tagname,n,false,e[":@"]?Object.keys(e[":@"]).length!==0:false,r),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function da(){return this.stopNodeExpressionsSet.size===0?false:this.matcher.matchesAny(this.stopNodeExpressionsSet)}function fa(t,e,n=">"){let r=0,s=t.length,o=n.charCodeAt(0),a=n.length>1?n.charCodeAt(1):-1,i="",c=e;for(let l=e;l<s;l++){let u=t.charCodeAt(l);if(r)u===r&&(r=0);else if(u===34||u===39)r=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&&!r&&(i+=t.substring(c,l)+" ",c=l+1);}}function Rt(t,e,n,r){let s=t.indexOf(e,n);if(s===-1)throw new Error(r);return s+e.length-1}function ha(t,e,n,r){let s=t.indexOf(e,n);if(s===-1)throw new Error(r);return s}function ps(t,e,n,r=">"){let s=fa(t,e+1,r);if(!s)return;let o=s.data,a=s.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!==s.data.substr(p+1));}return {tagName:c,tagExp:o,closeIndex:a,attrExpPresent:l,rawTagName:u}}function ma(t,e,n){let r=n,s=1,o=t.length;for(;n<o;n++)if(t[n]==="<"){let a=t.charCodeAt(n+1);if(a===47){let i=ha(t,">",n,`${e} is not closed`);if(t.substring(n+2,i).trim()===e&&(s--,s===0))return {tagContent:t.substring(r,n),i};n=i;}else if(a===63)n=Rt(t,"?>",n+1,"StopNode is not closed.");else if(a===33&&t.charCodeAt(n+2)===45&&t.charCodeAt(n+3)===45)n=Rt(t,"-->",n+3,"StopNode is not closed.");else if(a===33&&t.charCodeAt(n+2)===91)n=Rt(t,"]]>",n,"StopNode is not closed.")-2;else {let i=ps(t,n,false);i&&((i&&i.tagName)===e&&i.tagExp[i.tagExp.length-1]!=="/"&&s++,n=i.closeIndex);}}}function ds(t,e,n){if(e&&typeof t=="string"){let r=t.trim();return r==="true"?true:r==="false"?false:as(t,n)}else return Xs(t)?t:""}function us(t,e,n,r){if(t){let s=t(e);n===e&&(n=s),e=s;}return e=Dr(e,r),{tagName:e,tagExp:n}}function Dr(t,e){if(jn.includes(t))throw new Error(`[SECURITY] Invalid name: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);return zt.includes(t)?e.onDangerousProperty(t):t}var fs=Z.getMetaDataSymbol();function ga(t,e){if(!t||typeof t!="object")return {};if(!e)return t;let n={};for(let r in t)if(r.startsWith(e)){let s=r.substring(e.length);n[s]=t[r];}else n[r]=t[r];return n}function hs(t,e,n,r){return Vr(t,e,n,r)}function Vr(t,e,n,r){let s,o={};for(let a=0;a<t.length;a++){let i=t[a],c=ya(i);if(c!==void 0&&c!==e.textNodeName){let l=ga(i[":@"]||{},e.attributeNamePrefix);n.push(c,l);}if(c===e.textNodeName)s===void 0?s=i[c]:s+=""+i[c];else {if(c===void 0)continue;if(i[c]){let l=Vr(i[c],e,n,r),u=va(l,e);if(Object.keys(l).length===0&&e.alwaysCreateTextNode&&(l[e.textNodeName]=""),i[":@"]?ba(l,i[":@"],r,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[fs]!==void 0&&typeof l=="object"&&l!==null&&(l[fs]=i[fs]),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?r.toString():r;e.isArray(c,p,u)?o[c]=[l]:o[c]=l;}c!==void 0&&c!==e.textNodeName&&n.pop();}}}return typeof s=="string"?s.length>0&&(o[e.textNodeName]=s):s!==void 0&&(o[e.textNodeName]=s),o}function ya(t){let e=Object.keys(t);for(let n=0;n<e.length;n++){let r=e[n];if(r!==":@")return r}}function ba(t,e,n,r){if(e){let s=Object.keys(e),o=s.length;for(let a=0;a<o;a++){let i=s[a],c=i.startsWith(r.attributeNamePrefix)?i.substring(r.attributeNamePrefix.length):i,l=r.jPath?n.toString()+"."+c:n;r.isArray(i,l,true,true)?t[i]=[e[i]]:t[i]=e[i];}}}function va(t,e){let{textNodeName:n}=e,r=Object.keys(t).length;return !!(r===0||r===1&&(t[n]||typeof t[n]=="boolean"||t[n]===0))}var Qe=class{constructor(e){this.externalEntities={},this.options=vr(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=sr(e,n);if(o!==true)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}let r=new Zt(this.options,this.externalEntities),s=r.parseXml(e);return this.options.preserveOrder||s===void 0?s:hs(s,this.options,r.matcher,r.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 Z.getMetaDataSymbol()}};var mt=b(a(),1),gt=b(a(),1);var yt=b(a(),1),xe=b(a(),1),Te=b(a(),1),Ce=b(a(),1),Ae=b(a(),1),Pe=b(a(),1),Un=b(a(),1),me=b(a(),1),Gn=b(a(),1),bt=b(a(),1),ge=b(a(),1),Dt=b(a(),1),Y=b(a(),1),Me=b(a(),1),cn=b(a(),1),ln=b(a(),1),un=b(a(),1),te=b(a(),1),pe=b(a(),1),de=b(a(),1),fe=b(a(),1),he=b(a(),1),Go=b(a(),1);var wa=["vibgrate.config.ts","vibgrate.config.js","vibgrate.config.json"],Sa="VIBGRATE_TRUST_CONFIG";function ka(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function tn(t,e){if(F.isParenthesizedExpression(t))return tn(t.expression,e);if(F.isStringLiteralLike(t))return t.text;if(F.isNumericLiteral(t))return Number(t.text);if(t.kind===F.SyntaxKind.TrueKeyword)return true;if(t.kind===F.SyntaxKind.FalseKeyword)return false;if(t.kind===F.SyntaxKind.NullKeyword)return null;if(F.isArrayLiteralExpression(t))return t.elements.map(n=>{if(F.isSpreadElement(n))throw new Error("Spread not supported in static config arrays");return tn(n,e)});if(F.isObjectLiteralExpression(t)){let n={};for(let r of t.properties){if(!F.isPropertyAssignment(r)||r.initializer===void 0)throw new Error("Only plain object properties are supported in static config");if(F.isComputedPropertyName(r.name))throw new Error("Computed property names are not supported in static config");let s=F.isIdentifier(r.name)||F.isStringLiteral(r.name)||F.isNumericLiteral(r.name)?r.name.text:null;if(s===null)throw new Error("Unsupported object key in static config");n[s]=tn(r.initializer,e);}return n}if(F.isIdentifier(t)){let n=e.get(t.text);if(!n)throw new Error(`Unknown identifier in static config: ${t.text}`);return tn(n,e)}throw new Error("Non-static expression in config")}function Ea(t,e){let n=e.endsWith(".ts")?F.ScriptKind.TS:F.ScriptKind.JS,r=F.createSourceFile(e,t,F.ScriptTarget.ESNext,true,n),s=new Map;for(let o of r.statements)if(F.isVariableStatement(o)&&o.declarationList.flags&F.NodeFlags.Const)for(let a of o.declarationList.declarations)F.isIdentifier(a.name)&&a.initializer&&s.set(a.name.text,a.initializer);for(let o of r.statements){if(!F.isExportAssignment(o))continue;let a=tn(o.expression,s);return ka(a)?{...On,...a}:null}return null}var ja=5242880,xa=180,On={exclude:[],maxFileSizeToScan:ja,projectScanTimeout:xa,thresholds:{failOnError:{eolDays:180,frameworkMajorLag:3,dependencyTwoPlusPercent:50},warn:{frameworkMajorLag:2,dependencyTwoPlusPercent:30}}};async function Ta(t){let e=On;for(let r of wa){let s=_.join(t,r);if(await p(s)){if(r.endsWith(".json")){let i=await o(s);e={...On,...JSON.parse(i)};break}let o$1=await o(s),a=null;try{a=Ea(o$1,s);}catch{a=null;}if(a){e=a;break}if(process.env[Sa]==="1")try{let i=await import(s);e={...On,...i.default??i};break}catch{}}}let n=_.join(t,".vibgrate","auto-excludes.json");if(await p(n))try{let r=await o(n),s=JSON.parse(r);if(Array.isArray(s)&&s.length>0){let o=e.exclude??[];e={...e,exclude:[...new Set([...o,...s])]};}}catch{}return e}async function Cf(t){let e=_.join(t,"vibgrate.config.ts");return await ye.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 Ca(t,e){if(e.length===0)return false;let n=_.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 ye.writeFile(n,JSON.stringify(c,null,2)+`
25
- `,"utf8"),!0}catch{}let r=_.join(t,".vibgrate"),s=_.join(r,"auto-excludes.json"),o$1=[];if(await p(s))try{let i=await o(s),c=JSON.parse(i);Array.isArray(c)&&(o$1=c);}catch{}let a=[...new Set([...o$1,...e])];try{return await ye.mkdir(r,{recursive:!0}),await ye.writeFile(s,JSON.stringify(a,null,2)+`
26
- `,"utf8"),!0}catch{return false}}var Aa=864e5,Pa=365.25;function Ma(t,e,n){if(!t||!e||!n)return null;let r=n[t],s=n[e];if(!r||!s)return null;let o=Date.parse(r),a=Date.parse(s);if(Number.isNaN(o)||Number.isNaN(a))return null;let i=(a-o)/Aa;return i>0?i:0}function $a(t){return t===null?null:t/Pa}function La(t){let e=0,n=0,r=0;for(let s of t)s==null||Number.isNaN(s)||(e+=s,s>n&&(n=s),r++);return r===0?null:{total:e,max:n,measured:r}}function Na(t){if(!t||t.measured===0)return null;let e=t.total/t.measured,n=Math.min(e*20,100),r=Math.min(t.max*10,100),s=100-(n*.7+r*.3);return Math.max(0,Math.min(100,Math.round(s)))}var Ur="driftscore-2.0",Gr={failOnError:{eolDays:180,frameworkMajorLag:3,dependencyTwoPlusPercent:50},warn:{frameworkMajorLag:2,dependencyTwoPlusPercent:30}};function po(t,e,n){return Math.min(n,Math.max(e,t))}function Ra(t){if(t.length===0)return null;let e=t.map(r=>r.runtimeMajorsBehind).filter(r=>r!==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 Ia(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 r=Math.max(...n),s=n.reduce((i,c)=>i+c,0)/n.length,o=Math.min(r*20,100),a=Math.min(s*15,100);return po(100-(o*.6+a*.4),0,100)}function _a(t){let e=0,n=0,r=0,s=0;for(let l of t)e+=l.dependencyAgeBuckets.current,n+=l.dependencyAgeBuckets.oneBehind,r+=l.dependencyAgeBuckets.twoPlusBehind,s+=l.dependencyAgeBuckets.unknown;let o=e+n+r;if(o===0)return null;let a=e/o,i=n/o,c=r/o;return po(Math.round(a*100-i*10-c*40),0,100)}var qr=1e3*60*60*24*30;function Fa(t){if(!t.some(s=>s.runtimeMajorsBehind!==void 0||s.runtimeEol!==void 0&&s.runtimeEol!==null))return null;let n=100,r=Date.now();for(let s of t){if(s.runtimeEol===true){n=Math.min(n,0);continue}if(s.runtimeEol===false){if(s.runtimeEolDate){let o=Date.parse(s.runtimeEolDate)-r;Number.isNaN(o)||(o<=6*qr?n=Math.min(n,40):o<=12*qr&&(n=Math.min(n,75)));}continue}s.type==="node"&&s.runtimeMajorsBehind!==void 0&&(s.runtimeMajorsBehind>=3?n=Math.min(n,0):s.runtimeMajorsBehind>=2?n=Math.min(n,30):s.runtimeMajorsBehind>=1&&(n=Math.min(n,70))),s.type==="dotnet"&&s.runtimeMajorsBehind!==void 0&&(s.runtimeMajorsBehind>=3?n=Math.min(n,0):s.runtimeMajorsBehind>=2?n=Math.min(n,20):s.runtimeMajorsBehind>=1&&(n=Math.min(n,60))),s.type==="python"&&s.runtimeMajorsBehind!==void 0&&(s.runtimeMajorsBehind>=6?n=Math.min(n,0):s.runtimeMajorsBehind>=4?n=Math.min(n,20):s.runtimeMajorsBehind>=2&&(n=Math.min(n,60))),s.type==="java"&&s.runtimeMajorsBehind!==void 0&&(s.runtimeMajorsBehind>=10?n=Math.min(n,0):s.runtimeMajorsBehind>=4?n=Math.min(n,30):s.runtimeMajorsBehind>=1&&(n=Math.min(n,70)));}return n}function Oa(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),r=e.reduce((o,a)=>o+a.measured,0),s=e.reduce((o,a)=>Math.max(o,a.max),0);return r===0?null:Na({total:n,max:s,measured:r})}function Ba(t){let e=0,n=0;for(let s of t)e+=s.dependencyAgeBuckets.current+s.dependencyAgeBuckets.oneBehind+s.dependencyAgeBuckets.twoPlusBehind,n+=s.dependencyAgeBuckets.unknown;let r=e+n;return r===0?null:Math.round(e/r*100)/100}function ms(t){let e=Ra(t),n=Ia(t),r=_a(t),s=Fa(t),o=Oa(t),a=[{score:e,weight:.25},{score:n,weight:.25},{score:r,weight:.3},{score:s,weight:.2},{score:o,weight:.15}],i=Ba(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(r??100)),eolScore:c(Math.round(s??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:Ur,...i!==void 0?{confidence:i}:{}};let p=u.reduce((y,j)=>y+j.weight,0),d=0;for(let y of u)d+=y.score*(y.weight/p);let f=c(Math.round(d)),g;f<=30?g="low":f<=60?g="moderate":g="high";let h=[];return e!==null&&h.push("runtime"),n!==null&&h.push("framework"),r!==null&&h.push("dependency"),s!==null&&h.push("eol"),o!==null&&h.push("freshness"),{score:f,riskLevel:g,components:l(),measured:h,methodologyVersion:Ur,...i!==void 0?{confidence:i}:{}}}function Da(t,e){let n={failOnError:{...Gr.failOnError,...e?.thresholds?.failOnError},warn:{...Gr.warn,...e?.thresholds?.warn}},r=[];for(let s of t){let o=s.type==="node"?"Node.js":s.type==="dotnet"?".NET":s.type==="python"?"Python":s.type==="java"?"Java":s.type;if(s.runtimeEol===true){let i=s.runtimeEolDate?` on ${s.runtimeEolDate}`:"";r.push({ruleId:"vibgrate/runtime-eol",level:"error",message:`${o} runtime "${s.runtime}" reached end-of-life${i} (latest: ${s.runtimeLatest}).`,location:s.path});}else s.runtimeMajorsBehind!==void 0&&s.runtimeMajorsBehind>=3?r.push({ruleId:"vibgrate/runtime-eol",level:"error",message:`${o} runtime "${s.runtime}" is ${s.runtimeMajorsBehind} major versions behind (latest: ${s.runtimeLatest}). Likely at or past EOL.`,location:s.path}):s.runtimeMajorsBehind!==void 0&&s.runtimeMajorsBehind>=2&&r.push({ruleId:"vibgrate/runtime-lag",level:"warning",message:`${o} runtime "${s.runtime}" is ${s.runtimeMajorsBehind} major versions behind (latest: ${s.runtimeLatest}).`,location:s.path});for(let i of s.frameworks)i.majorsBehind!==null&&n.failOnError.frameworkMajorLag!==void 0&&i.majorsBehind>=n.failOnError.frameworkMajorLag?r.push({ruleId:"vibgrate/framework-major-lag",level:"error",message:`${i.name} is ${i.majorsBehind} major versions behind (current: ${i.currentVersion}, latest: ${i.latestVersion}).`,location:s.path}):i.majorsBehind!==null&&n.warn.frameworkMajorLag!==void 0&&i.majorsBehind>=n.warn.frameworkMajorLag&&r.push({ruleId:"vibgrate/framework-major-lag",level:"warning",message:`${i.name} is ${i.majorsBehind} major versions behind (current: ${i.currentVersion}, latest: ${i.latestVersion}).`,location:s.path});let a=s.dependencyAgeBuckets.current+s.dependencyAgeBuckets.oneBehind+s.dependencyAgeBuckets.twoPlusBehind;if(a>0){let i=s.dependencyAgeBuckets.twoPlusBehind/a*100;n.failOnError.dependencyTwoPlusPercent!==void 0&&i>=n.failOnError.dependencyTwoPlusPercent?r.push({ruleId:"vibgrate/dependency-rot",level:"error",message:`${Math.round(i)}% of dependencies are 2+ major versions behind in ${s.name}.`,location:s.path}):n.warn.dependencyTwoPlusPercent!==void 0&&i>=n.warn.dependencyTwoPlusPercent&&r.push({ruleId:"vibgrate/dependency-rot",level:"warning",message:`${Math.round(i)}% of dependencies are 2+ major versions behind in ${s.name}.`,location:s.path});}for(let i of s.dependencies)i.majorsBehind!==null&&i.majorsBehind>=3&&r.push({ruleId:"vibgrate/dependency-major-lag",level:"error",message:`${i.package} is ${i.majorsBehind} major versions behind (spec: ${i.currentSpec}, latest: ${i.latestStable}).`,location:s.path});}return r}function Va(t,e,n){let r=n?`${t}:${e}:${n}`:`${t}:${e}`;return As.createHash("sha256").update(r).digest("hex").slice(0,16)}function Ua(t,e,n){let r=n?`${t}:${e}:${n}`:`${t}:${e}`;return As.createHash("sha256").update(r).digest("hex").slice(0,16)}var Ga=20,qa=50,Hr={red:"#E5484D",amber:"#F5A524",green:"#30A46C",unknown:"#6B7280"},Af="#24292F";function Pf(t){if(t==null||!Number.isFinite(t))return "unknown";let e=Math.round(t);return e<=Ga?"green":e<=qa?"amber":"red"}function Mf(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 $f(t){return Hr[t]??Hr.unknown}function Ha(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(...za(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=Ka(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(...Ja(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 r=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: ")+r.bold(`${t.drift.score}/100`)),e.push(E.bold(" Risk Level: ")+Wa(t.drift.riskLevel)),e.push(E.bold(" Projects: ")+`${t.projects.length}`);let s=t.billing;if(s&&(e.push(E.bold(" Classified: ")+`${E.cyan(s.nanoCount)} nano \xB7 ${E.cyan(s.microCount)} micro \xB7 ${E.cyan(s.smallCount)} small \xB7 ${E.cyan(s.standardCount)} standard`),e.push(E.bold(" Billable: ")+E.bold.white(`${s.billableProjects}`)+E.dim(` \xB7 ${s.totalScanned} detected \u2192 ${s.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")?nn(t.drift.components.runtimeScore):E.dim("n/a")}`),e.push(` Frameworks: ${o.has("framework")?nn(t.drift.components.frameworkScore):E.dim("n/a")}`),e.push(` Dependencies: ${o.has("dependency")?nn(t.drift.components.dependencyScore):E.dim("n/a")}`),e.push(` EOL Risk: ${o.has("eol")?nn(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 Wa(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 nn(t){let n=Math.round(t/100*20),r=20-n;return (t<=30?E.green:t<=60?E.yellow:E.red)("\u2588".repeat(n))+E.dim("\u2591".repeat(r))+` ${Math.round(t)}`}var Wr={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 za(t){let e=[];if(t.toolingInventory){let n=t.toolingInventory,r=Object.entries(n).filter(([,s])=>s.length>0);if(r.length>0){e.push(E.bold.underline(" Tech Stack"));for(let[s,o]of r){let a=Wr[s]??s,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,r=Object.entries(n).filter(([,s])=>s.length>0);if(r.length>0){e.push(E.bold.underline(" Services & Integrations"));for(let[s,o]of r){let a=Wr[s]??s,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 r=n.exposureScore>=40?E.red:n.exposureScore>=20?E.yellow:E.green;e.push(` Exposure Score: ${r.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 s=n.projectIntelligence.filter(o=>o.packages.length>0).slice(0,3);if(s.length>0){e.push(" Major Upgrade Intelligence:");for(let o of s){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 r=[];r.push(`v${n.typescriptVersion}`),n.strict===true?r.push(E.green("strict \u2714")):n.strict===false&&r.push(E.yellow("strict \u2716")),n.moduleType&&r.push(n.moduleType.toUpperCase()),n.target&&r.push(`target: ${n.target}`),e.push(` ${r.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 r=n.topEvidence.slice(0,8);if(r.length>0){e.push(" Top Signals:");for(let s of r)e.push(` - [${s.kind}] ${s.value} ${E.dim(`(${s.file})`)}`);}if(n.unknownSignals.length>0){e.push(" Unknowns:");for(let s of n.unknownSignals.slice(0,4))e.push(` - ${E.yellow(s)}`);}e.push("");}if(t.securityPosture){let n=t.securityPosture;e.push(E.bold.underline(" Security Posture"));let r=[];r.push(n.lockfilePresent?E.green("Lockfile \u2714"):E.red("Lockfile \u2716")),r.push(n.gitignoreCoversEnv?E.green(".env \u2714"):E.red(".env \u2716")),r.push(n.gitignoreCoversNodeModules?E.green("node_modules \u2714"):E.yellow("node_modules \u2716")),n.multipleLockfileTypes&&r.push(E.yellow("Multiple lockfiles \u26A0")),n.envFilesTracked&&r.push(E.red("Env files tracked \u2716")),e.push(` ${r.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(r=>E.dim(r)).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 r=n.godFiles.slice(0,3).map(s=>`${s.path} (${s.lines} lines)`).join(", ");e.push(` ${E.yellow("God files")}: ${r}`);}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 Ja(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 r=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 ${nn(n.driftScore)} risk ${r}`);}e.push("");}return e}function Ka(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 r=[];for(let a of t.projects)for(let i of a.frameworks)i.majorsBehind!==null&&i.majorsBehind>=3&&r.push({name:i.name,fw:`${i.currentVersion} \u2192 ${i.latestVersion}`,behind:i.majorsBehind,project:a.name,projectPath:a.path});if(r.length>0){let a=r.sort((d,f)=>f.behind-d.behind)[0],i=r.length>1?` (+${r.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 r){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=r.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 h of p){if(f>=8)break;let y=h.resolvedVersion??h.currentSpec,j=h.latestStable??"?";d.push(`
34
- ${h.package}: ${y} \u2192 ${j} (${h.majorsBehind} major${h.majorsBehind>1?"s":""} behind)`),f++;}let g=p.length-f;u+=d.join(""),g>0&&(u+=`
35
- ... and ${g} 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 s=[];for(let a of t.projects)for(let i of a.frameworks)i.majorsBehind===2&&s.push({name:i.name,project:a.name,projectPath:a.path,fw:`${i.currentVersion} \u2192 ${i.latestVersion}`});let o=[...new Map(s.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 s){if(u>=8)break;l.push(`
36
- ./${d.projectPath}`),l.push(`
37
- ${d.name}: ${d.fw}`),u++;}let p=s.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 h of t.projects){let y=h.dependencies.filter(j=>p.has(j.package));if(y.length!==0){if(f>=10)break;d.push(`
39
- ./${h.path}`);for(let j of y){if(f>=10)break;let C=j.resolvedVersion??j.currentSpec,A=a.deprecatedPackages.includes(j.package)?"deprecated":"polyfill";d.push(`
40
- ${j.package}: ${C} (${A})`),f++;}}}let g=i-f;u+=d.join(""),g>0&&(u+=`
41
- ... and ${g} 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 g of l)u.has(g.sourcePath)||u.set(g.sourcePath,[]),u.get(g.sourcePath).push({package:g.package,spec:g.spec});let p=[],d=0;for(let[g,h]of u){if(d>=10)break;p.push(`
42
- ./${g}`);for(let y of h){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 Qa(t){let e=Ya(t.findings),n=t.findings.map(r=>Xa(r));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 Ya(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"}})[n]??{id:n,shortDescription:{text:n},helpUri:"https://vibgrate.com"})}function Xa(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}}}]}}function Za(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 r=[t.timestamp];t.durationMs!==void 0&&r.push(`${(t.durationMs/1e3).toFixed(1)}s`),t.filesScanned!==void 0&&r.push(`${t.filesScanned} files`),t.treeSummary&&r.push(`${t.treeSummary.totalFiles.toLocaleString()} workspace files \xB7 ${t.treeSummary.totalDirs.toLocaleString()} dirs`),e.push(`| **Scanned** | ${r.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 s of t.projects){if(e.push(`### ${s.name} (${s.type})`),e.push(""),s.runtime){let i=s.runtimeMajorsBehind!==void 0&&s.runtimeMajorsBehind>0?` \u2014 ${s.runtimeMajorsBehind} major(s) behind`:" \u2014 current";e.push(`- **Runtime:** ${s.runtime}${i}`);}if(s.frameworks.length>0){e.push("- **Frameworks:**");for(let i of s.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=s.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 s=t.extended.uiPurpose;if(e.push("## Product Purpose Signals"),e.push(""),e.push(`- **Frameworks:** ${s.detectedFrameworks.length>0?s.detectedFrameworks.join(", "):"unknown"}`),e.push(`- **Evidence Items:** ${s.topEvidence.length}${s.capped?` (capped from ${s.evidenceCount})`:""}`),s.topEvidence.length>0){e.push("- **Top Evidence:**");for(let o of s.topEvidence.slice(0,10))e.push(` - [${o.kind}] ${o.value} (${o.file})`);}if(s.unknownSignals.length>0){e.push("- **Unknowns:**");for(let o of s.unknownSignals.slice(0,5))e.push(` - ${o}`);}e.push("");}if(t.extended?.standards&&t.extended.standards.recommended.length>0){let s=t.extended.standards;e.push("## Recommended Standards"),e.push("");let o=s.projectPurposes.map(a=>`${a.project} \u2192 ${a.category}`).join(", ");if(o&&e.push(`- **Detected purpose:** ${o}`),s.frameworks.length>0){e.push("- **Compliance framework coverage:**");for(let a of s.frameworks)e.push(` - ${a.name}: ${a.recommendedMembers}/${a.totalMembers} member standards apply`);}e.push("- **Top standards to consider:**");for(let a of s.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 s of t.findings){let o=s.level==="error"?"\u{1F534}":s.level==="warning"?"\u{1F7E1}":"\u{1F535}";e.push(`| ${o} ${s.level} | ${s.ruleId} | ${s.message} | ${s.location} |`);}e.push("");}if(t.delta!==void 0){let s=t.delta>0?"\u{1F4C8}":t.delta<0?"\u{1F4C9}":"\u27A1\uFE0F";e.push(`## Drift Delta: ${s} ${t.delta>0?"+":""}${t.delta} vs baseline`),e.push("");}return e.join(`
51
- `)}async function Se(t,e){let n,r=new Promise(s=>{n=setTimeout(()=>s({ok:false}),e);});try{return await Promise.race([t.then(o=>({ok:!0,value:o})),r])}finally{clearTimeout(n);}}function rc(t,e){return new Promise((n,r)=>{let s=spawn(t,e,{stdio:["ignore","pipe","pipe"]}),o="",a="";s.stdout.on("data",i=>o+=String(i)),s.stderr.on("data",i=>a+=String(i)),s.on("error",r),s.on("close",i=>{if(i!==0){r(new Error(`${t} ${e.join(" ")} failed (code=${i}): ${a.trim()}`));return}n(o);});})}async function mo(t,e){try{return JSON.parse(t)}catch{throw new Error(`Invalid JSON in package version manifest: ${e}`)}}async function oc(t){let e=await mkdtemp(_.join(an.tmpdir(),"vibgrate-manifest-"));try{await rc("unzip",["-qq",t,"-d",e]);let n=[_.join(e,"package-versions.json"),_.join(e,"manifest.json"),_.join(e,"index.json")];for(let r of n)try{let s=await readFile(r,"utf8");return await mo(s,r)}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 ic(t){let e=_.resolve(t);if(e.toLowerCase().endsWith(".zip"))return oc(e);let n=await readFile(e,"utf8");return mo(n,e)}function H(t,e,n){if(!t)return;let r=t[e];if(r)return e==="nuget"?r[n.toLowerCase()]??r[n]:r[n]}function rn(t){return t.filter(e=>et.valid(e)&&et.prerelease(e)===null)}function Bn(t){let e=rn(t);return e.length===0?null:e.sort(et.rcompare)[0]??null}function ac(t){if(!t||typeof t!="object")return;let e={};for(let[n,r]of Object.entries(t))n==="created"||n==="modified"||typeof r=="string"&&(e[n]=r);return Object.keys(e).length>0?e:void 0}function Rn(t){let e=null,n=[],r=null,s;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]),r=go(i.license??i.licenses),s=ac(i.time);}let o=rn(n),a=Bn(o);return !e&&a&&(e=a),{latest:e,stableVersions:o,latestStableOverall:a,license:r,...s?{releaseDates:s}:{}}}function go(t){if(!t)return null;if(typeof t=="string")return t.trim()||null;if(Array.isArray(t)){let e=t.map(go).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 cc=24,lc=7e3,uc=3e4,pc=process.platform==="win32"?"npm.cmd":"npm";function dc(t,e=process.platform){let n=e==="win32"?lc:uc,r=[],s=[],o=0;for(let a of t){let i=a.length+1;(s.length>=cc||s.length>0&&o+i>n)&&(r.push(s),s=[],o=0),s.push(a),o+=i;}return s.length>0&&r.push(s),r}async function sn(t,e){return new Promise((n,r)=>{let s=spawn(pc,["view",...t,"--json"],{cwd:e,stdio:["ignore","pipe","pipe"]}),o="",a="";s.stdout.on("data",i=>o+=String(i)),s.stderr.on("data",i=>a+=String(i)),s.on("error",r),s.on("close",i=>{if(i!==0){r(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 fc=class{constructor(t,e,n,r=false){this.cwd=t,this.sem=e,this.manifest=n,this.offline=r;}meta=new Map;async prefetch(t){let n=[...new Set(t.filter(Boolean))].filter(s=>!this.meta.has(s));if(n.length===0)return;let r=this.sem.run(()=>this.fetchBatch(n));for(let s of n){let o=r.then(a=>a.get(s)??{latest:null,stableVersions:[],latestStableOverall:null,license:null});this.meta.set(s,o);}await r;}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 r of t){let s=H(this.manifest,"npm",r);if(s){let o=rn(s.versions??[]),a=Bn(o);e.set(r,{latest:s.latest??a,stableVersions:o,latestStableOverall:a,license:s.license??null,...s.releaseDates?{releaseDates:s.releaseDates}:{}});}else this.offline?e.set(r,{latest:null,stableVersions:[],latestStableOverall:null,license:null}):n.push(r);}if(n.length===0)return e;for(let r of dc(n)){let s=await this.fetchRemoteChunk(r);for(let[o,a]of s)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 sn([...t,"dist-tags.latest","versions","license","licenses","time"],this.cwd);if(Array.isArray(n))for(let r=0;r<n.length&&r<t.length;r++)e.set(t[r],Rn(n[r]));else if(n&&typeof n=="object"){let r=n,s=0;for(let o of t)o in r&&(e.set(o,Rn(r[o])),s++);s===0&&t.length===1&&e.set(t[0],Rn(r));}}catch{}for(let n of t)e.has(n)||e.set(n,await this.fetchOneRemote(n));return e}async fetchOne(t){let e=H(this.manifest,"npm",t);if(e){let n=rn(e.versions??[]),r=Bn(n);return {latest:e.latest??r,stableVersions:n,latestStableOverall:r,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 sn([t,"dist-tags.latest","versions","license","licenses","time"],this.cwd);return Rn(e)}catch{let e=null,n=[];try{let o=await sn([t,"dist-tags"],this.cwd);o&&typeof o=="object"&&typeof o.latest=="string"&&(e=o.latest);}catch{}try{let o=await sn([t,"versions"],this.cwd);Array.isArray(o)?n=o.map(String):typeof o=="string"&&(n=[o]);}catch{}let r=rn(n),s=Bn(r);return !e&&s&&(e=s),{latest:e,stableVersions:r,latestStableOverall:s,license:null}}}};async function hc(t){try{let e=new AbortController,n=setTimeout(()=>e.abort(),5e3),r=await fetch("https://registry.npmjs.org/npm/latest",{method:"HEAD",signal:e.signal});return clearTimeout(n),r.ok}catch{try{let e=await sn(["npm","dist-tags.latest"],t);return typeof e=="string"&&e.length>0}catch{return false}}}function yo(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:et.validRange(e)!==null}function bo(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 vo={attribution:false,copyleft:false,networkCopyleft:false,discloseSource:false,patentGrant:false,commercialRestriction:false};function mc(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:bo(t.category),obligations:{...vo,...t.obligations??{}}}}var G={attribution:true},gc={attribution:true,patentGrant:true},ie={attribution:true,copyleft:true,discloseSource:true},Ye={attribution:true,copyleft:true,discloseSource:true},In={attribution:true,copyleft:true,networkCopyleft:true,discloseSource:true},yc=[{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:G},{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:G},{id:"BSD-2-Clause",name:'BSD 2-Clause "Simplified" License',family:"BSD",category:"permissive",osi:true,fsf:true,obligations:G},{id:"BSD-3-Clause",name:'BSD 3-Clause "New" or "Revised" License',family:"BSD",category:"permissive",osi:true,fsf:true,obligations:G},{id:"BSD-3-Clause-Clear",name:"BSD 3-Clause Clear License",family:"BSD",category:"permissive",osi:true,obligations:G},{id:"Apache-2.0",name:"Apache License 2.0",family:"Apache",category:"permissive",osi:true,fsf:true,obligations:gc},{id:"Apache-1.1",name:"Apache Software License 1.1",family:"Apache",category:"permissive",osi:true,obligations:G},{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:G},{id:"PostgreSQL",name:"PostgreSQL License",family:"BSD",category:"permissive",osi:true,obligations:G},{id:"Python-2.0",name:"Python License 2.0",family:"Python",category:"permissive",osi:true,obligations:G},{id:"PSF-2.0",name:"Python Software Foundation License 2.0",family:"Python",category:"permissive",obligations:G},{id:"Artistic-2.0",name:"Artistic License 2.0",family:"Artistic",category:"permissive",osi:true,fsf:true,obligations:G},{id:"NCSA",name:"University of Illinois/NCSA Open Source License",family:"NCSA",category:"permissive",osi:true,fsf:true,obligations:G},{id:"Unicode-DFS-2016",name:"Unicode License Agreement - Data Files and Software (2016)",family:"Unicode",category:"permissive",osi:true,obligations:G},{id:"BlueOak-1.0.0",name:"Blue Oak Model License 1.0.0",family:"BlueOak",category:"permissive",obligations:G},{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:G},{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:Ye},{id:"GPL-2.0-or-later",name:"GNU General Public License v2.0 or later",family:"GPL",category:"copyleft",osi:true,fsf:true,obligations:Ye},{id:"GPL-3.0-only",name:"GNU General Public License v3.0 only",family:"GPL",category:"copyleft",osi:true,fsf:true,obligations:{...Ye,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:{...Ye,patentGrant:true}},{id:"EUPL-1.1",name:"European Union Public License 1.1",family:"EUPL",category:"copyleft",osi:true,fsf:true,obligations:Ye},{id:"EUPL-1.2",name:"European Union Public License 1.2",family:"EUPL",category:"copyleft",osi:true,fsf:true,obligations:Ye},{id:"OSL-3.0",name:"Open Software License 3.0",family:"OSL",category:"copyleft",osi:true,fsf:true,obligations:{...Ye,patentGrant:true}},{id:"CECILL-2.1",name:"CeCILL Free Software License Agreement v2.1",family:"CeCILL",category:"copyleft",osi:true,fsf:true,obligations:Ye},{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:{...In,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:{...In,patentGrant:true}},{id:"SSPL-1.0",name:"Server Side Public License 1.0",family:"SSPL",category:"network-copyleft",obligations:In},{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:In},{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:G}],bc=yc.map(mc),wo=new Map;for(let t of bc)wo.set(t.spdxId.toLowerCase(),t);function V(t){return wo.get(t.trim().toLowerCase())}function Dn(t="Unknown"){return {spdxId:"NOASSERTION",name:t,family:"Unknown",category:"unknown",osiApproved:false,fsfLibre:false,deprecated:false,referenceUrl:"",riskLevel:"medium",obligations:{...vo}}}function So(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"},ko=new Map;for(let[t,e]of Object.entries(vc))ko.set(So(t),e);function Eo(t){return ko.get(So(t))}var wc=/\(|\)|\bWITH\b|\bAND\b|\bOR\b|[^\s()]+/gi;function Sc(t){let e=(t??"").trim(),n=[],r=[],s=false,o=false,a=false,i=false,c=e.match(wc)??[];for(let u of c){let p=u.toUpperCase();if(u==="("||u===")")continue;if(p==="OR"){s=true,i=false;continue}if(p==="AND"){o=true,i=false;continue}if(p==="WITH"){i=true;continue}if(i){r.includes(u)||r.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=s?"OR":o?"AND":"SINGLE";return {licenseIds:n,exceptions:r,operator:l,orLater:a,normalized:kc(n,r,l,a,e)}}function kc(t,e,n,r,s){if(t.length===0)return s.trim();if(t.length===1){let a=t[0];return r&&!a.endsWith("+")&&(a+="+"),e.length>0&&(a+=` WITH ${e.join(" WITH ")}`),a}let o=n==="AND"?" AND ":" OR ";return t.join(o)}function Ec(t){return /\b(?:AND|OR|WITH)\b|\+\s*$|\(/i.test(t)}var zr={"public-domain":0,permissive:1,"weak-copyleft":2,copyleft:3,"network-copyleft":4,proprietary:5,unknown:2};function be(t,e,n,r,s){return {spdxId:t.spdxId,name:t.name,expression:r??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:s??[t.spdxId]}}function jo(t){let e=t.toLowerCase();if(/\bagpl/.test(e))return V("AGPL-3.0-or-later");if(/\bsspl/.test(e))return V("SSPL-1.0");if(/\bbusl|business source/.test(e))return V("BUSL-1.1");if(/\blgpl/.test(e))return V("LGPL-3.0-or-later");if(/\bgpl/.test(e))return V("GPL-3.0-or-later");if(/\bmpl|mozilla/.test(e))return V("MPL-2.0");if(/\bepl|eclipse/.test(e))return V("EPL-2.0");if(/\bapache/.test(e))return V("Apache-2.0");if(/\bbsd/.test(e))return V("BSD-3-Clause");if(/\bmit\b/.test(e))return V("MIT");if(/\bisc\b/.test(e))return V("ISC");if(/commons clause/.test(e))return V("Commons-Clause");if(/proprietary|commercial|all rights reserved/.test(e))return V("LicenseRef-Proprietary");if(/public domain|cc0/.test(e))return V("CC0-1.0")}function jc(t){let e=(t??"").trim();if(!e||/^(unknown|noassertion|none|n\/a)$/i.test(e))return be(Dn(),"unknown",0);let n=V(e);if(n)return be(n,"exact",1);if(Ec(e))return xc(e);let r=Eo(e);if(r){let o=V(r);if(o)return be(o,"alias",.95)}let s=jo(e);return s?{...be(s,"fuzzy",.6),name:e.slice(0,120)}:be(Dn(e.slice(0,120)),"unknown",0)}function xc(t){let e=Sc(t);if(e.licenseIds.length===0)return be(Dn(t.slice(0,120)),"unknown",0);let n=e.licenseIds.map(c=>{let l=V(c);if(l)return be(l,"exact",1);let u=Eo(c);if(u){let d=V(u);if(d)return be(d,"alias",.95)}let p=jo(c);return p?be(p,"fuzzy",.6):be(Dn(c),"unknown",0)}),r=e.operator!=="OR",s=n[0];for(let c of n){let l=zr[c.category]>zr[s.category];(r?l:!l)&&(s=c);}let o=Tc(r?n:[s]),a=n.map(c=>c.spdxId),i=s.category;return {spdxId:s.spdxId,name:e.normalized,expression:e.normalized,family:s.family,category:i,riskLevel:bo(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 Tc(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 Cc(t,e){let n=(t??"").trim();if(!n)return {raw:null,spdxId:null,source:"none",confidence:0};let r=jc(n);return {raw:n.slice(0,200),spdxId:r.matchStatus==="unknown"?null:r.spdxId,source:e,confidence:r.confidence}}var Jr={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 Ac(t,e,n$1,r,s=Ee){let o=n$1?await n$1.findPackageJsonFiles(t):await j(t),a=[],i=new Map,c;try{let h=n$1?j=>n$1.pathExists(j):p,y=_.join(t,"package.json");if(await h(y))try{let j=n$1?await n$1.readJsonFile(y):await n(y);if(j.packageManager){let C=j.packageManager.split("@")[0]?.toLowerCase();C&&["pnpm","yarn","npm","bun"].includes(C)&&(c=C);}}catch{}c||await h(_.join(t,"pnpm-workspace.yaml"))&&(c="pnpm"),c||(await h(_.join(t,"pnpm-lock.yaml"))?c="pnpm":await h(_.join(t,"yarn.lock"))?c="yarn":await h(_.join(t,"package-lock.json"))?c="npm":await h(_.join(t,"bun.lockb"))&&(c="bun"));}catch{}let l=r??n$1?.projectScanTimeout??18e4,u=typeof an.availableParallelism=="function"?an.availableParallelism():an.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 h=>{try{let y=n$1?await n$1.readJsonFile(h):await n(h),j=[y.dependencies,y.devDependencies,y.peerDependencies,y.optionalDependencies];for(let C of j)if(C)for(let[A,T]of Object.entries(C))yo(T)&&f.add(A);}catch{}})),f.size>0)try{await e.prefetch([...f]);}catch{}let g=await Promise.all(o.map(async h=>d.run(async()=>{try{let y=Pc(h,t,e,n$1,s),j=await Se(y,l);if(j.ok)return j.value;let C=_.relative(t,_.dirname(h));return n$1&&n$1.addStuckPath(C||"."),console.error(`Timeout scanning ${h} (>${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 j=y instanceof Error?y.message:String(y);return console.error(`Error scanning ${h}: ${j}`),null}})));for(let h of g)h&&(a.push(h),i.set(h.name,h.path));for(let h of a){let y=[];for(let j of h.dependencies){let C=i.get(j.package);C&&C!==h.path&&y.push({path:C,name:j.package,refType:"workspace"});}y.length>0&&(h.projectReferences=y),c&&(h.packageManager=c);}return a}async function Pc(t,e,n$1,r,s){let o=r?await r.readJsonFile(t):await n(t),a=_.dirname(t),i=_.relative(e,a)||".",c=o.engines?.node??void 0,l,u,p,d;if(c){let v=ts(s,"nodejs"),b=ve.minVersion(c);if(v&&b){let w=ve.major(b);l=`${v.major}.0.0`,u=Math.max(0,v.major-w);}p=rt(s,"node",c);let S=Ke("node",c);S&&(d=st(s,"nodejs",S));}let f=[{name:"dependencies",deps:o.dependencies},{name:"devDependencies",deps:o.devDependencies},{name:"peerDependencies",deps:o.peerDependencies},{name:"optionalDependencies",deps:o.optionalDependencies}],g=[],h=[],y={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},j=[];for(let v of f)if(v.deps)for(let[b,S]of Object.entries(v.deps))yo(S)&&j.push({pkg:b,section:v.name,spec:S});await n$1.prefetch(j.map(v=>v.pkg));let C=j.map(async v=>{let b=await n$1.get(v.pkg);return {...v,meta:b}}),A=await Promise.all(C);for(let{pkg:v,section:b,spec:S,meta:w}of A){let x=w.stableVersions.length>0?ve.maxSatisfying(w.stableVersions,S)??null:null,m=w.latestStableOverall,P=null,L="unknown";if(x&&m){let ne=ve.major(x);P=ve.major(m)-ne,P===0?L=ve.eq(x,m)?"current":"minor-behind":L="major-behind",P===0?y.current++:P===1?y.oneBehind++:y.twoPlusBehind++;}else y.unknown++;let D=Ma(x,m,w.releaseDates),ce=$a(D);g.push({package:v,section:b,currentSpec:S,resolvedVersion:x,latestStable:m,majorsBehind:P,drift:L,license:Cc(w.license,"registry"),ageDays:D,libyears:ce}),v in Jr&&h.push({name:Jr[v],currentVersion:x,latestVersion:m,majorsBehind:P});}for(let v of f)if(v.deps)for(let[b,S]of Object.entries(v.deps))S.trim().startsWith("workspace:")&&(g.push({package:b,section:v.name,currentSpec:S,resolvedVersion:null,latestStable:null,majorsBehind:null,drift:"unknown",license:{raw:null,spdxId:null,source:"none",confidence:0}}),y.unknown++);g.sort((v,b)=>{let S={"major-behind":0,"minor-behind":1,current:2,unknown:3},w=(S[v.drift]??9)-(S[b.drift]??9);return w!==0?w:v.package.localeCompare(b.package)});let T;try{T=r?await r.countFilesUnder(e,a):void 0;}catch{}return {type:"node",path:i,name:o.name??_.basename(a),runtime:c,runtimeLatest:l,runtimeMajorsBehind:u,runtimeEol:p,runtimeEolDate:d,frameworks:h,dependencies:g,dependencyAgeBuckets:y,libyears:La(g.map(v=>v.libyears))??void 0,fileCount:T}}var xo=new Qe({ignoreAttributes:false,attributeNamePrefix:"@_"}),Kr={"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 Ss(t){return t.replace(/\\/g,"/")}function Mc(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 Qr(t){return t.endsWith(".csproj")||t.endsWith(".vbproj")}function ks(t){return _.basename(t).replace(/\.(cs|vb)proj$/i,"")}function $c(t,e){let r=xo.parse(t)?.Project;if(!r)return {targetFrameworks:[],packageReferences:[],projectReferences:[],projectName:ks(e)};let s=Array.isArray(r.PropertyGroup)?r.PropertyGroup:r.PropertyGroup?[r.PropertyGroup]:[],o=[];for(let l of s)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(r.ItemGroup)?r.ItemGroup:r.ItemGroup?[r.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"]??"",g=d["@_Version"]??d["@_version"]??d.Version??"";f&&g&&i.push({name:String(f),version:String(g)});}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:ks(e)}}function Lc(t){let n=xo.parse(t)?.packages;if(!n)return [];let r=Array.isArray(n.package)?n.package:n.package?[n.package]:[],s=[];for(let o of r){let a=o["@_id"]??o["@_Id"]??"",i=o["@_version"]??o["@_Version"]??"";a&&i&&s.push({name:String(a),version:String(i)});}return s}async function Nc(t,e,n,r,s=Ee){let o$1=n?await n.findFiles(t,Qr):await i(t,Qr),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=_.dirname(p),g=/Project\("[^"]*"\)\s*=\s*"[^"]*",\s*"([^"]+\.(?:cs|vb)proj)"/g,h;for(;(h=g.exec(d))!==null;)if(h[1]){let y=_.resolve(f,h[1].replace(/\\/g,"/"));i$1.add(y);}}catch{}let c=new Set([...o$1,...i$1]),l=[],u=r??n?.projectScanTimeout??18e4;for(let p of c)try{let d=Rc(p,t,e,n,s),f=await Se(d,u);if(f.ok)l.push(f.value);else {let g=Ss(_.relative(t,_.dirname(p)));n&&n.addStuckPath(g||"."),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 Rc(t,e,n,r,s){let o$1=r?await r.readTextFile(t):await o(t),a=$c(o$1,t),i=_.dirname(t);{let v=_.join(i,"packages.config");try{let b=r?await r.readTextFile(v):await o(v),S=new Set(a.packageReferences.map(w=>w.name.toLowerCase()));for(let w of Lc(b))S.has(w.name.toLowerCase())||(a.packageReferences.push(w),S.add(w.name.toLowerCase()));}catch{}}let c=a.targetFrameworks[0],l=Wt(s,"dotnet")?.major,u,p,d,f=c;if(c){let v=Mc(c);v!==null&&l!==void 0&&(u=Math.max(0,l-v)),p=rt(s,"dotnet",c);let b=Ke("dotnet",c);b&&(d=st(s,"dotnet",b));}let g=[],h={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};if(n){let v=a.packageReferences.map(async S=>{let w=await n.get(S.name);return {ref:S,meta:w}}),b=await Promise.all(v);for(let{ref:S,meta:w}of b){let x=ht.valid(S.version)?S.version:null,m=w.latestStableOverall,P=null,L="unknown";if(x&&m){let D=ht.major(x);P=ht.major(m)-D,P===0?L=ht.eq(x,m)?"current":"minor-behind":P>0?L="major-behind":L="current",P<=0?h.current++:P===1?h.oneBehind++:h.twoPlusBehind++;}else h.unknown++;g.push({package:S.name,section:"dependencies",currentSpec:S.version,resolvedVersion:x,latestStable:m,majorsBehind:P,drift:L});}}else for(let v of a.packageReferences)g.push({package:v.name,section:"dependencies",currentSpec:v.version,resolvedVersion:v.version,latestStable:null,majorsBehind:null,drift:"unknown"}),h.unknown++;let y=[],j=new Map(g.map(v=>[v.package,v]));for(let v of a.packageReferences)if(v.name in Kr){let b=j.get(v.name);y.push({name:Kr[v.name],currentVersion:b?.resolvedVersion??v.version,latestVersion:b?.latestStable??null,majorsBehind:b?.majorsBehind??null});}let C=a.projectReferences.map(v=>{let b=_.resolve(i,v),S=Ss(_.relative(e,_.dirname(b))),w=ks(b);return {path:S||".",name:w,refType:"project"}}),A;try{A=r?await r.countFilesUnder(e,i):void 0;}catch{}g.sort((v,b)=>{let S={"major-behind":0,"minor-behind":1,current:2,unknown:3},w=(S[v.drift]??9)-(S[b.drift]??9);return w!==0?w:v.package.localeCompare(b.package)});let T=h;return {type:"dotnet",path:Ss(_.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:g,dependencyAgeBuckets:T,projectReferences:C.length>0?C:void 0,fileCount:A}}var Yr={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 Ps(t){let e=t.trim();if(!e||e.startsWith("#")||e.startsWith("-"))return null;let r=e.split(";")[0].trim().match(/^([A-Za-z0-9][-A-Za-z0-9_.]*[A-Za-z0-9]?)(?:\[.*?\])?\s*(.*)?$/);if(!r)return null;let s=r[1],o=(r[2]??"").trim(),a=s.toLowerCase().replace(/[_.]+/g,"-");return {name:s,spec:o,normalisedName:a}}function Ic(t){return t.match(/^==\s*([^\s,;]+)/)?.[1]??null}function _c(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("."),mt.valid(e)}function Fc(t){let e=[];for(let n of t.split(`
52
- `)){let r=Ps(n);r&&e.push(r);}return e}function Oc(t){let e={dependencies:[]},n=t.match(/^\s*name\s*=\s*"([^"]+)"/m);n&&(e.projectName=n[1]);let r=t.match(/^\s*requires-python\s*=\s*"([^"]+)"/m);r&&(e.pythonVersion=r[1]);let s=t.match(/^\s*dependencies\s*=\s*\[([\s\S]*?)\]/m);if(s){let a=s[1],i=/"([^"]+)"/g,c;for(;(c=i.exec(a))!==null;){let l=Ps(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 Bc(t){let e=[],n=t.match(/\[packages\]([\s\S]*?)(?=\n\s*\[|\n*$)/);if(n){let s=n[1].split(`
54
- `);for(let o of s){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 r=t.match(/\[dev-packages\]([\s\S]*?)(?=\n\s*\[|\n*$)/);if(r){let s=r[1].split(`
55
- `);for(let o of s){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 Dc(t){let e={deps:[]},n=t.match(/\[metadata\]([\s\S]*?)(?=\n\s*\[|\n*$)/);if(n){let s=n[1].match(/^\s*name\s*=\s*(.+)$/m);s&&(e.name=s[1].trim());}let r=t.match(/\[options\]([\s\S]*?)(?=\n\s*\[|\n*$)/);if(r){let s=r[1].match(/^\s*python_requires\s*=\s*(.+)$/m);s&&(e.pythonVersion=s[1].trim());let o=r[1].match(/install_requires\s*=\s*\n((?:\s+.*\n?)*)/);if(o){let a=o[1];for(let i of a.split(`
56
- `)){let c=Ps(i);c&&e.deps.push(c);}}}return e}var To=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 Vc(t,e,n,r,s=Ee){let o=n?await n.findFiles(t,l=>To.has(l)||/^requirements.*\.txt$/.test(l)):await Uc(t),a=new Map;for(let l of o){let u=_.dirname(l);a.has(u)||a.set(u,[]),a.get(u).push(l);}let i=[],c=r??n?.projectScanTimeout??18e4;for(let[l,u]of a)try{let p=Gc(l,u,t,e,n,s),d=await Se(p,c);if(d.ok)i.push(d.value);else {let f=_.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 Uc(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>To.has(n)||/^requirements.*\.txt$/.test(n))}async function Gc(t,e,n,r,s,o$1){let a=_.relative(n,t)||".",i=_.basename(t===n?n:t),c,l=new Map;for(let v of e){let b=_.basename(v),S=s?await s.readTextFile(v):await o(v);if(b==="pyproject.toml"){let w=Oc(S);w.projectName&&(i=w.projectName),w.pythonVersion&&(c=w.pythonVersion);for(let x of w.dependencies)l.has(x.normalisedName)||l.set(x.normalisedName,x);}else if(b==="setup.cfg"){let w=Dc(S);w.name&&(i=w.name),w.pythonVersion&&!c&&(c=w.pythonVersion);for(let x of w.deps)l.has(x.normalisedName)||l.set(x.normalisedName,x);}else if(b==="Pipfile")for(let w of Bc(S))l.has(w.normalisedName)||l.set(w.normalisedName,w);else if(b.startsWith("requirements")&&b.endsWith(".txt"))for(let w of Fc(S))l.has(w.normalisedName)||l.set(w.normalisedName,w);}let u,p,d,f;if(c){let v=c.match(/(\d+)\.(\d+)/);if(v){let S=parseInt(v[1],10),w=parseInt(v[2],10),x=Wt(o$1,"python");x&&(S===x.major?u=Math.max(0,x.minor-w):S<x.major&&(u=x.minor+(x.major-S)*10),p=`${x.major}.${x.minor}`);}d=rt(o$1,"python",c);let b=Ke("python",c);b&&(f=st(o$1,"python",b));}let g=[],h=[],y={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},C=[...l.values()].map(async v=>{let b=await r.get(v.normalisedName);return {dep:v,meta:b}}),A=await Promise.all(C);for(let{dep:v,meta:b}of A){let S=Ic(v.spec),w=S?_c(S):null,x=b.latestStableOverall,m=null,P="unknown";if(w&&x){let L=mt.major(w);m=mt.major(x)-L,m===0?P=mt.eq(w,x)?"current":"minor-behind":m>0?P="major-behind":P="current",m<=0?y.current++:m===1?y.oneBehind++:y.twoPlusBehind++;}else y.unknown++;g.push({package:v.name,section:"dependencies",currentSpec:v.spec||"*",resolvedVersion:w,latestStable:x,majorsBehind:m,drift:P}),v.normalisedName in Yr&&h.push({name:Yr[v.normalisedName],currentVersion:w,latestVersion:x,majorsBehind:m});}g.sort((v,b)=>{let S={"major-behind":0,"minor-behind":1,current:2,unknown:3},w=(S[v.drift]??9)-(S[b.drift]??9);return w!==0?w:v.package.localeCompare(b.package)});let T;try{T=s?await s.countFilesUnder(n,t):void 0;}catch{}return {type:"python",path:a,name:i,runtime:c,runtimeLatest:p,runtimeMajorsBehind:u,runtimeEol:d,runtimeEolDate:f,frameworks:h,dependencies:g,dependencyAgeBuckets:y,fileCount:T}}var qc=new Qe({ignoreAttributes:false,attributeNamePrefix:"@_"}),Xr={"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 Hc(t,e){let r=qc.parse(t)?.project;if(!r)return {artifactId:_.basename(_.dirname(e)),dependencies:[],modules:[],properties:{}};let s={};if(r.properties&&typeof r.properties=="object")for(let[h,y]of Object.entries(r.properties))(typeof y=="string"||typeof y=="number")&&(s[h]=String(y));let o,a=["java.version","maven.compiler.source","maven.compiler.target","maven.compiler.release","java.source.version"];for(let h of a)if(s[h]){o=String(s[h]);break}let i=r.dependencies,l=(i?.dependency?Array.isArray(i.dependency)?i.dependency:[i.dependency]:[]).filter(h=>h.groupId&&h.artifactId).map(h=>({groupId:It(String(h.groupId??""),s),artifactId:It(String(h.artifactId??""),s),version:It(String(h.version??""),s),scope:h.scope?String(h.scope):void 0})),u=r.dependencyManagement?.dependencies,p=u?.dependency?Array.isArray(u.dependency)?u.dependency:[u.dependency]:[];for(let h of p)h.groupId&&h.artifactId&&h.version&&l.push({groupId:It(String(h.groupId),s),artifactId:It(String(h.artifactId),s),version:It(String(h.version),s),scope:h.scope?String(h.scope):void 0});let f=(r.modules?.module?Array.isArray(r.modules.module)?r.modules.module:[r.modules.module]:[]).map(String),g;return r.parent?.groupId&&r.parent?.artifactId&&(g={groupId:String(r.parent.groupId),artifactId:String(r.parent.artifactId),version:String(r.parent.version??"")}),{groupId:r.groupId?String(r.groupId):g?.groupId,artifactId:String(r.artifactId??_.basename(_.dirname(e))),version:r.version?String(r.version):g?.version,packaging:r.packaging?String(r.packaging):void 0,javaVersion:o,dependencies:l,modules:f,parent:g,properties:s}}function It(t,e){return t.replace(/\$\{([^}]+)\}/g,(n,r)=>e[r]??`\${${r}}`)}function Wc(t,e){let n=[],r=_.basename(_.dirname(e)),s,o=t.match(/(?:sourceCompatibility|targetCompatibility|javaVersion)\s*[=:]\s*['"]?(?:JavaVersion\.VERSION_)?(\d+)['"]?/);o&&(s=o[1]);let a=t.match(/JavaLanguageVersion\.of\((\d+)\)/);a&&(s=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:s,dependencies:n,projectName:r}}function zc(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("."),gt.valid(e)}var Co=new Set(["pom.xml","build.gradle","build.gradle.kts"]);async function Jc(t,e,n,r,s=Ee){let o=n?await n.findFiles(t,u=>Co.has(u)):await Kc(t),a=new Map;for(let u of o){let p=_.dirname(u);a.has(p)||a.set(p,[]),a.get(p).push(u);}let i=[],c=r??n?.projectScanTimeout??18e4;for(let[u,p]of a)try{let d=Qc(u,p,t,e,n,s),f=await Se(d,c);if(f.ok)i.push(f.value);else {let g=_.relative(t,u);n&&n.addStuckPath(g||"."),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 Kc(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Co.has(n))}async function Qc(t,e,n,r,s,o$1){let a=_.relative(n,t)||".",i=_.basename(t===n?n:t),c,l=new Map,u=[];for(let S of e){let w=_.basename(S),x=s?await s.readTextFile(S):await o(S);if(w==="pom.xml"){let m=Hc(x,S);m.artifactId&&(i=m.artifactId),m.javaVersion&&(c=m.javaVersion);for(let P of m.dependencies){let L=`${P.groupId}:${P.artifactId}`;!l.has(L)&&P.version&&!P.version.includes("${")&&l.set(L,P);}for(let P of m.modules)u.push({path:_.join(a,P),name:P,refType:"project"});}else if(w==="build.gradle"||w==="build.gradle.kts"){let m=Wc(x,S);m.projectName&&(i=m.projectName),m.javaVersion&&(c=m.javaVersion);for(let P of m.dependencies){let L=`${P.groupId}:${P.artifactId}`;!l.has(L)&&P.version&&l.set(L,P);}}}let p,d,f,g=ts(o$1,"java")?.major,h=g!==void 0?String(g):void 0;if(c){let S=c.match(/^(1\.)?(\d+)/);if(S){let x=(S[1],parseInt(S[2],10));g!==void 0&&(p=Math.max(0,g-x));}d=rt(o$1,"java",c);let w=Ke("java",c);w&&(f=st(o$1,"java",w));}let y=[],j=[],C={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},T=[...l.entries()].map(async([S,w])=>{let x=await r.get(w.groupId,w.artifactId);return {key:S,dep:w,meta:x}}),v=await Promise.all(T);for(let{key:S,dep:w,meta:x}of v){let m=zc(w.version),P=x.latestStableOverall,L=null,D="unknown";if(m&&P){let ce=gt.major(m);L=gt.major(P)-ce,L===0?D=gt.eq(m,P)?"current":"minor-behind":L>0?D="major-behind":D="current",L<=0?C.current++:L===1?C.oneBehind++:C.twoPlusBehind++;}else C.unknown++;y.push({package:S,section:"dependencies",currentSpec:w.version,resolvedVersion:m,latestStable:P,majorsBehind:L,drift:D}),S in Xr&&j.push({name:Xr[S],currentVersion:m,latestVersion:P,majorsBehind:L});}y.sort((S,w)=>{let x={"major-behind":0,"minor-behind":1,current:2,unknown:3},m=(x[S.drift]??9)-(x[w.drift]??9);return m!==0?m:S.package.localeCompare(w.package)});let b;try{b=s?await s.countFilesUnder(n,t):void 0;}catch{}return {type:"java",path:a,name:i,runtime:c?`Java ${c}`:void 0,runtimeLatest:h,runtimeMajorsBehind:p,runtimeEol:d,runtimeEolDate:f,targetFramework:c?`Java ${c}`:void 0,frameworks:j,dependencies:y,dependencyAgeBuckets:C,projectReferences:u.length>0?u:void 0,fileCount:b}}var Zr={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 Yc(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 r=n[1],s=n[2]??"*";return {name:r,spec:s}}function Xc(t){if(t==="*")return null;let e=t.match(/(?:~>|>=|>|=|<=|<)?\s*(\d+(?:\.\d+)*)/);return e?e[1]:null}function Zc(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 r=n.slice(0,3).join(".");return yt.valid(r)}function el(t){let e=[],n="default",r=[];for(let s of t.split(/\r?\n/)){let o=s.trim(),a=o.match(/^\s*group\s+:(\w+)/);if(a){r.push(n);let u=a[1].toLowerCase();u==="development"||u==="dev"?n="development":u==="test"&&(n="test");}if(o==="end"&&r.length>0){n=r.pop();continue}let i=Yc(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 tl(t){let e=[];for(let n of t.split(/\r?\n/)){let s=n.trim().match(/\.add_(runtime_|development_)?dependency\s+['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"])?/);if(!s)continue;let o=s[1]??"runtime_",a=s[2],i=s[3]??"*";e.push({name:a,spec:i,group:o.startsWith("development")?"development":"default"});}return e}function nl(t){return t.match(/^\s*ruby\s+['"]([^'"]+)['"]/m)?.[1]}var Ao=new Set(["Gemfile"]);function Ms(t){return t.endsWith(".gemspec")}async function sl(t,e,n,r,s=Ee){let o=n?await n.findFiles(t,l=>Ao.has(l)||Ms(l)):await rl(t),a=new Map;for(let l of o){let u=_.dirname(l);a.has(u)||a.set(u,[]),a.get(u).push(l);}let i=[],c=r??n?.projectScanTimeout??18e4;for(let[l,u]of a)try{let p=ol(l,u,t,e,n,s),d=await Se(p,c);if(d.ok)i.push(d.value);else {let f=_.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 rl(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Ao.has(n)||Ms(n))}async function ol(t,e,n,r,s,o$1){let a=_.relative(n,t)||".",i=_.basename(t===n?n:t),c,l=new Map;for(let v of e){let b=_.basename(v),S=s?await s.readTextFile(v):await o(v);if(b==="Gemfile"){let w=nl(S);w&&(c=w);for(let x of el(S))l.has(x.name)||l.set(x.name,x);}else if(Ms(b)){let w=b.replace(/\.gemspec$/,"");w&&(i=w);for(let x of tl(S))l.has(x.name)||l.set(x.name,x);}}let u,p,d,f;if(c){let v=c.match(/(\d+)\.(\d+)/);if(v){let S=parseInt(v[1],10),w=parseInt(v[2],10),x=Wt(o$1,"ruby");x&&(S===x.major?u=Math.max(0,x.minor-w):S<x.major&&(u=x.minor+(x.major-S)*10),p=`${x.major}.${x.minor}`);}d=rt(o$1,"ruby",c);let b=Ke("ruby",c);b&&(f=st(o$1,"ruby",b));}let g=[],h=[],y={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},C=[...l.values()].map(async v=>{let b=await r.get(v.name);return {dep:v,meta:b}}),A=await Promise.all(C);for(let{dep:v,meta:b}of A){let S=Xc(v.spec),w=S?Zc(S):null,x=b.latestStableOverall,m=null,P="unknown";if(w&&x){let D=yt.major(w);m=yt.major(x)-D,m===0?P=yt.eq(w,x)?"current":"minor-behind":m>0?P="major-behind":P="current",m<=0?y.current++:m===1?y.oneBehind++:y.twoPlusBehind++;}else y.unknown++;let L=v.group==="development"||v.group==="test"?"devDependencies":"dependencies";g.push({package:v.name,section:L,currentSpec:v.spec,resolvedVersion:w,latestStable:x,majorsBehind:m,drift:P}),v.name in Zr&&h.push({name:Zr[v.name],currentVersion:w,latestVersion:x,majorsBehind:m});}g.sort((v,b)=>{let S={"major-behind":0,"minor-behind":1,current:2,unknown:3},w=(S[v.drift]??9)-(S[b.drift]??9);return w!==0?w:v.package.localeCompare(b.package)});let T;try{T=s?await s.countFilesUnder(n,t):void 0;}catch{}return {type:"ruby",path:a,name:i,runtime:c,runtimeLatest:p,runtimeMajorsBehind:u,runtimeEol:d,runtimeEolDate:f,frameworks:h,dependencies:g,dependencyAgeBuckets:y,fileCount:T}}var eo={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"},ct={major:6,minor:0};function il(t){let e=[],n=/\.package\s*\(\s*url:\s*"([^"]+)"[^)]*?(from|exact|upToNextMajor|revision|branch):\s*"([^"]+)"/g,r;for(;(r=n.exec(t))!==null;){let s=r[1],o=r[2],a=r[3],c=s.match(/\/([^/]+?)(\.git)?$/)?.[1]??s,l="range",u=a;o==="exact"?l="exact":o==="branch"?l="branch":o==="revision"&&(l="revision"),e.push({name:c,url:s,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 r of n.pins)!r.identity||!r.state?.version||e.set(r.identity.toLowerCase(),r.state.version);}catch{}return e}function cl(t){return t.match(/\/\/\s*swift-tools-version:\s*(\d+\.\d+)/i)?.[1]}var Po=new Set(["Package.swift"]);async function ll(t,e,n,r){let s=n?await n.findFiles(t,i=>Po.has(i)):await ul(t),o=[],a=r??n?.projectScanTimeout??18e4;for(let i of s){let c=_.dirname(i);try{let l=pl(c,i,t,e,n),u=await Se(l,a);if(u.ok)o.push(u.value);else {let p=_.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 ul(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Po.has(n))}async function pl(t,e,n,r,s){let o$1=_.relative(n,t)||".",a=_.basename(t===n?n:t),i=s?await s.readTextFile(e):await o(e),c=cl(i),l=il(i),u=_.join(t,"Package.resolved"),p=new Map;try{let T=s?await s.readTextFile(u):await o(u);p=al(T);}catch{}let d,f;if(c){let T=c.match(/(\d+)\.(\d+)/);if(T){let v=parseInt(T[1],10),b=parseInt(T[2],10);v===ct.major?d=Math.max(0,ct.minor-b):v<ct.major&&(d=(ct.major-v)*10+ct.minor),f=`${ct.major}.${ct.minor}`;}}let g=[],h=[],y={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},j=l.map(async T=>{let v=await r.get(T.url);return {dep:T,meta:v}}),C=await Promise.all(j);for(let{dep:T,meta:v}of C){let b=p.get(T.name.toLowerCase())??(T.type==="exact"?T.version:null),S=b?xe.valid(xe.clean(b)):null,w=v.latestStableOverall,x=null,m="unknown";if(S&&w){let L=xe.major(S);x=xe.major(w)-L,x===0?m=xe.eq(S,w)?"current":"minor-behind":x>0?m="major-behind":m="current",x<=0?y.current++:x===1?y.oneBehind++:y.twoPlusBehind++;}else y.unknown++;g.push({package:T.name,section:"dependencies",currentSpec:T.version,resolvedVersion:S,latestStable:w,majorsBehind:x,drift:m});let P=T.name.toLowerCase();P in eo&&h.push({name:eo[P],currentVersion:S,latestVersion:w,majorsBehind:x});}g.sort((T,v)=>{let b={"major-behind":0,"minor-behind":1,current:2,unknown:3},S=(b[T.drift]??9)-(b[v.drift]??9);return S!==0?S:T.package.localeCompare(v.package)});let A;try{A=s?await s.countFilesUnder(n,t):void 0;}catch{}return {type:"swift",path:o$1,name:a,runtime:c,runtimeLatest:f,runtimeMajorsBehind:d,frameworks:h,dependencies:g,dependencyAgeBuckets:y,fileCount:A}}var to={"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 dl(t){let e=[],n,r=false;for(let s of t.split(/\r?\n/)){let o=s.trim();if(o.startsWith("go ")){let l=o.match(/^go\s+(\d+\.\d+)/);l&&(n=l[1]);continue}if(o.startsWith("require (")){r=true;continue}if(o===")"&&r){r=false;continue}let a=o;if(r)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 Mo=new Set(["go.mod"]);async function fl(t,e,n,r,s=Ee){let o=n?await n.findFiles(t,c=>Mo.has(c)):await hl(t),a=[],i=r??n?.projectScanTimeout??18e4;for(let c of o){let l=_.dirname(c);try{let u=ml(l,c,t,e,n,s),p=await Se(u,i);if(p.ok)a.push(p.value);else {let d=_.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 hl(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Mo.has(n))}async function ml(t,e,n,r,s,o$1){let a=_.relative(n,t)||".",i=_.basename(t===n?n:t),c=s?await s.readTextFile(e):await o(e),{goVersion:l,deps:u}=dl(c),p=u.filter(b=>!b.indirect),d,f,g,h;if(l){let b=l.match(/(\d+)\.(\d+)/);if(b){let w=parseInt(b[1],10),x=parseInt(b[2],10),m=Wt(o$1,"go");m&&(w===m.major?d=Math.max(0,m.minor-x):w<m.major&&(d=m.minor+(m.major-w)*100),f=`${m.major}.${m.minor}`);}g=rt(o$1,"go",l);let S=Ke("go",l);S&&(h=st(o$1,"go",S));}let y=[],j=[],C={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},A=p.map(async b=>{let S=await r.get(b.path);return {dep:b,meta:S}}),T=await Promise.all(A);for(let{dep:b,meta:S}of T){let w=Te.valid(Te.clean(b.version)),x=S.latestStableOverall,m=null,P="unknown";if(w&&x){let L=Te.major(w);m=Te.major(x)-L,m===0?P=Te.eq(w,x)?"current":"minor-behind":m>0?P="major-behind":P="current",m<=0?C.current++:m===1?C.oneBehind++:C.twoPlusBehind++;}else C.unknown++;y.push({package:b.path,section:"dependencies",currentSpec:b.version,resolvedVersion:w,latestStable:x,majorsBehind:m,drift:P}),b.path in to&&j.push({name:to[b.path],currentVersion:w,latestVersion:x,majorsBehind:m});}y.sort((b,S)=>{let w={"major-behind":0,"minor-behind":1,current:2,unknown:3},x=(w[b.drift]??9)-(w[S.drift]??9);return x!==0?x:b.package.localeCompare(S.package)});let v;try{v=s?await s.countFilesUnder(n,t):void 0;}catch{}return {type:"go",path:a,name:i,runtime:l,runtimeLatest:f,runtimeMajorsBehind:d,runtimeEol:g,runtimeEolDate:h,frameworks:j,dependencies:y,dependencyAgeBuckets:C,fileCount:v}}var no={"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 gl(t){let e=[],n=null;for(let r of t.split(/\r?\n/)){let s=r.trim();if(s==="[dependencies]"){n="dependencies";continue}else if(s==="[dev-dependencies]"){n="dev-dependencies";continue}else if(s.startsWith("[")&&s.endsWith("]")){n=null;continue}if(!n)continue;let o=s.match(/^([\w-]+)\s*=\s*"([^"]+)"/);if(o){e.push({name:o[1],version:o[2],optional:false,features:[],isDev:n==="dev-dependencies"});continue}let a=s.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*\[([^\]]*)\]/),g=f?f[1].split(",").map(h=>h.trim().replace(/"/g,"")):[];e.push({name:i,version:u,optional:d,features:g,isDev:n==="dev-dependencies"});}}return e}function yl(t){return t.match(/^\s*edition\s*=\s*"(\d+)"/m)?.[1]}var $o=new Set(["Cargo.toml"]);async function bl(t,e,n,r){let s=n?await n.findFiles(t,i=>$o.has(i)):await vl(t),o=[],a=r??n?.projectScanTimeout??18e4;for(let i of s){let c=_.dirname(i);try{let l=wl(c,i,t,e,n),u=await Se(l,a);if(u.ok)o.push(u.value);else {let p=_.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=>$o.has(n))}async function wl(t,e,n,r,s){let o$1=_.relative(n,t)||".",a=_.basename(t===n?n:t),i=s?await s.readTextFile(e):await o(e),c=yl(i),u=gl(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=[],g=[],h={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},y=u.map(async A=>{let T=await r.get(A.name);return {dep:A,meta:T}}),j=await Promise.all(y);for(let{dep:A,meta:T}of j){let v=Ce.valid(Ce.coerce(A.version)),b=T.latestStableOverall,S=null,w="unknown";if(v&&b){let m=Ce.major(v);S=Ce.major(b)-m,S===0?w=Ce.eq(v,b)?"current":"minor-behind":S>0?w="major-behind":w="current",S<=0?h.current++:S===1?h.oneBehind++:h.twoPlusBehind++;}else h.unknown++;let x=A.isDev?"devDependencies":"dependencies";f.push({package:A.name,section:x,currentSpec:A.version,resolvedVersion:v,latestStable:b,majorsBehind:S,drift:w}),A.name in no&&g.push({name:no[A.name],currentVersion:v,latestVersion:b,majorsBehind:S});}f.sort((A,T)=>{let v={"major-behind":0,"minor-behind":1,current:2,unknown:3},b=(v[A.drift]??9)-(v[T.drift]??9);return b!==0?b:A.package.localeCompare(T.package)});let C;try{C=s?await s.countFilesUnder(n,t):void 0;}catch{}return {type:"rust",path:o$1,name:a,runtime:c,runtimeLatest:d,runtimeMajorsBehind:p,frameworks:g,dependencies:f,dependencyAgeBuckets:h,fileCount:C}}var so={"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"},lt={major:8,minor:4};async function Sl(t,e){let n$1=e?await e.readJsonFile(t):await n(t),r=[],s;if(n$1.require?.php&&(s=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-")||r.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-")||r.push({name:o,version:String(a),isDev:true});return {phpVersion:s,deps:r}}async function kl(t,e){let n$1=new Map;try{let r=e?await e.readJsonFile(t):await n(t);for(let s of r.packages??[])s.name&&s.version&&n$1.set(s.name,s.version);for(let s of r["packages-dev"]??[])s.name&&s.version&&n$1.set(s.name,s.version);}catch{}return n$1}function El(t){return t.match(/(\d+)\.(\d+)/)?.[0]}var Lo=new Set(["composer.json"]);async function jl(t,e,n,r){let s=n?await n.findFiles(t,i=>Lo.has(i)):await xl(t),o=[],a=r??n?.projectScanTimeout??18e4;for(let i of s){let c=_.dirname(i);try{let l=Tl(c,i,t,e,n),u=await Se(l,a);if(u.ok)o.push(u.value);else {let p=_.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 xl(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Lo.has(n))}async function Tl(t,e,n,r,s){let o=_.relative(n,t)||".",a=_.basename(t===n?n:t),{phpVersion:i,deps:c}=await Sl(e,s),l=_.join(t,"composer.lock"),u=new Map;try{u=await kl(l,s);}catch{}let p=c.filter(v=>!v.isDev),d,f,g;if(i&&(g=El(i),g)){let v=g.match(/(\d+)\.(\d+)/);if(v){let b=parseInt(v[1],10),S=parseInt(v[2],10);b===lt.major?d=Math.max(0,lt.minor-S):b<lt.major&&(d=lt.minor+(lt.major-b)*10),f=`${lt.major}.${lt.minor}`;}}let h=[],y=[],j={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},C=p.map(async v=>{let b=await r.get(v.name);return {dep:v,meta:b}}),A=await Promise.all(C);for(let{dep:v,meta:b}of A){let S=u.get(v.name),w=S?Ae.valid(Ae.clean(S)):null,x=b.latestStableOverall,m=null,P="unknown";if(w&&x){let D=Ae.major(w);m=Ae.major(x)-D,m===0?P=Ae.eq(w,x)?"current":"minor-behind":m>0?P="major-behind":P="current",m<=0?j.current++:m===1?j.oneBehind++:j.twoPlusBehind++;}else j.unknown++;let L=v.isDev?"devDependencies":"dependencies";h.push({package:v.name,section:L,currentSpec:v.version,resolvedVersion:w,latestStable:x,majorsBehind:m,drift:P}),v.name in so&&y.push({name:so[v.name],currentVersion:w,latestVersion:x,majorsBehind:m});}h.sort((v,b)=>{let S={"major-behind":0,"minor-behind":1,current:2,unknown:3},w=(S[v.drift]??9)-(S[b.drift]??9);return w!==0?w:v.package.localeCompare(b.package)});let T;try{T=s?await s.countFilesUnder(n,t):void 0;}catch{}return {type:"php",path:o,name:a,runtime:g,runtimeLatest:f,runtimeMajorsBehind:d,frameworks:y,dependencies:h,dependencyAgeBuckets:j,fileCount:T}}var ro={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"},ut={major:3,minor:6};function Cl(t){let e=[],n,r=null;for(let s of t.split(/\r?\n/)){let o=s.trim();if(o.startsWith("sdk:")){let i=o.match(/sdk:\s*['"]?>?=?\s*(\d[^<'"]*)/);i&&(n=i[1].trim());continue}if(o==="dependencies:"){r="dependencies";continue}else if(o==="dev_dependencies:"){r="dev_dependencies";continue}else if(/^\w+:/.test(s)){r=null;continue}if(!r)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:r==="dev_dependencies"});}}return {dartVersion:n,deps:e}}async function Al(t,e){let n=new Map;try{let r=e?await e.readTextFile(t):await o(t),s=null;for(let o of r.split(/\r?\n/)){let a=o.trim(),i=o.match(/^ {2}(\w+):$/);if(i){s=i[1];continue}if(s&&a.startsWith("version:")){let c=a.match(/version:\s*"?([^"]+)"?/);c&&(n.set(s,c[1]),s=null);}}}catch{}return n}function Pl(t){return t.match(/(\d+\.\d+\.\d+)/)?.[0]}var No=new Set(["pubspec.yaml"]);async function Ml(t,e,n,r){let s=n?await n.findFiles(t,i=>No.has(i)):await $l(t),o=[],a=r??n?.projectScanTimeout??18e4;for(let i of s){let c=_.dirname(i);try{let l=Ll(c,i,t,e,n),u=await Se(l,a);if(u.ok)o.push(u.value);else {let p=_.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 $l(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>No.has(n))}async function Ll(t,e,n,r,s){let o$1=_.relative(n,t)||".",a=_.basename(t===n?n:t),i=s?await s.readTextFile(e):await o(e),{dartVersion:c,deps:l}=Cl(i),u=_.join(t,"pubspec.lock"),p=new Map;try{p=await Al(u,s);}catch{}let d=l.filter(b=>!b.isDev),f,g,h;if(c&&(h=Pl(c),h)){let b=h.match(/(\d+)\.(\d+)/);if(b){let S=parseInt(b[1],10),w=parseInt(b[2],10);S===ut.major?f=Math.max(0,ut.minor-w):S<ut.major&&(f=ut.minor+(ut.major-S)*10),g=`${ut.major}.${ut.minor}`;}}let y=[],j=[],C={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},A=d.map(async b=>{let S=await r.get(b.name);return {dep:b,meta:S}}),T=await Promise.all(A);for(let{dep:b,meta:S}of T){let w=p.get(b.name),x=w?Pe.valid(Pe.clean(w)):null,m=S.latestStableOverall,P=null,L="unknown";if(x&&m){let ce=Pe.major(x);P=Pe.major(m)-ce,P===0?L=Pe.eq(x,m)?"current":"minor-behind":P>0?L="major-behind":L="current",P<=0?C.current++:P===1?C.oneBehind++:C.twoPlusBehind++;}else C.unknown++;let D=b.isDev?"devDependencies":"dependencies";y.push({package:b.name,section:D,currentSpec:b.version,resolvedVersion:x,latestStable:m,majorsBehind:P,drift:L}),b.name in ro&&j.push({name:ro[b.name],currentVersion:x,latestVersion:m,majorsBehind:P});}y.sort((b,S)=>{let w={"major-behind":0,"minor-behind":1,current:2,unknown:3},x=(w[b.drift]??9)-(w[S.drift]??9);return x!==0?x:b.package.localeCompare(S.package)});let v;try{v=s?await s.countFilesUnder(n,t):void 0;}catch{}return {type:"dart",path:o$1,name:a,runtime:h,runtimeLatest:g,runtimeMajorsBehind:f,frameworks:j,dependencies:y,dependencyAgeBuckets:C,fileCount:v}}var Nl="https://hex.pm/api",Rl=1e4,Il=10;async function _l(t,e,n,r=false){let s=H(e,"hex",t);if(s?.latest)return s.latest;if(r)return null;let o=async()=>{try{let a=new AbortController,i=setTimeout(()=>a.abort(),Rl),c=`${Nl}/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 Un.SemVer(f).prerelease.length===0}catch{return !1}});return d.length===0?null:(d.sort((f,g)=>{try{return (0,Un.gt)(f,g)?-1:1}catch{return 0}}),d[0])}catch(a){return a?.name==="AbortError",null}};return n?n.run(o):o()}async function Fl(t,e,n=false){let r=new Map,s=new a$1(Il),o=t.map(async a=>{let i=await _l(a,e,s,n);i&&r.set(a,i);});return await Promise.all(o),r}var Ol=new Set(["mix.exs"]),Bl=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 Dl(t,e){let n=e?await e.readTextFile(t):await o(t),r=[],s,o$1=n.match(/elixir:\s*"([^"]+)"/);o$1&&(s=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];r.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:s,deps:r}}async function Vl(t,e){let n=new Map;try{let r=e?await e.readTextFile(t):await o(t),s=/"(\w+)":\s*\{\s*:hex\s*,\s*:\w+\s*,\s*"([^"]+)"/g,o$1;for(;(o$1=s.exec(r))!==null;){let a=o$1[1],i=o$1[2];n.set(a,i);}}catch{}return n}function Ul(t,e){try{let n=t.replace(/^[~><=\s]+/,""),r=(0,me.minVersion)((0,me.validRange)(n)||n);if(!r)return "unknown";if(!(0,me.gt)(e,r.version))return "current";let s=(0,me.minVersion)(e);return s?s.major>r.major?"major-behind":"minor-behind":"unknown"}catch{return "unknown"}}async function Gl(t,e,n,r=false){let s=`${t}/mix.exs`;if(!(e?await e.pathExists(s):await p(s)))return null;let{elixirVersion:a,deps:i}=await Dl(s,e),c=`${t}/mix.lock`,l=await Vl(c,e),u=i.filter(y=>!y.isDev),p$1=u.map(y=>y.name),d=await Fl(p$1,n,r),f=[],g=[],h={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};for(let y of u){let j=l.get(y.name),C=j||y.version,A=d.get(y.name),T=A?Ul(C,A):"unknown",v=null;if(j&&A)try{let b=(0,me.minVersion)((0,me.validRange)(C)||C),S=(0,me.minVersion)((0,me.validRange)(A)||A);b&&S&&(v=S.major-b.major);}catch{}f.push({package:y.name,section:y.isDev?"devDependencies":"dependencies",currentSpec:y.version,resolvedVersion:j||null,latestStable:A||null,majorsBehind:v,drift:T}),T==="current"?h.current++:v===1?h.oneBehind++:v&&v>1?h.twoPlusBehind++:h.unknown++,Bl.has(y.name)&&g.push({name:y.name,currentVersion:j||null,latestVersion:A||null,majorsBehind:v});}return {type:"elixir",path:_.relative(t.includes("/")?t.split("/").slice(0,-1).join("/"):".",t)||".",name:_.basename(t),runtime:a,frameworks:g,dependencies:f,dependencyAgeBuckets:h}}async function ql(t,e,n,r,s=false){let o=n?await n.findFiles(t,c=>Ol.has(c)):[],a=new Map;for(let c of o){let l=_.dirname(c);a.has(l)||a.set(l,[]),a.get(l).push(c);}let i=[];for(let[c]of a)try{let l=await Gl(c,n,e,s);l&&(l.path=_.relative(t,c)||".",i.push(l));}catch(l){console.error(`Error scanning Elixir project at ${c}:`,l);}return i}var Hl="https://hub.docker.com/v2",Wl=1e4,zl=10;function $s(t){let e,n,r,s,[o,a]=t.split(":");s=a;let i=o.split("/");return i.length>1&&(i[0].includes(".")||i[0]==="localhost")?(e=i[0],i.length===3?(n=i[1],r=i[2]):r=i[1]):i.length===2?(n=i[0],r=i[1]):r=o,{registry:e,namespace:n,image:r,tag:s}}async function Jl(t,e,n){let r=async()=>{try{let s=new AbortController,o=setTimeout(()=>s.abort(),Wl),a=`${Hl}/repositories/${t}/${e}/tags?page_size=100`,i=await fetch(a,{signal:s.signal,headers:{"User-Agent":"vibgrate-cli"}});return clearTimeout(o),i.ok?((await i.json()).results||[]).map(u=>u.name):[]}catch(s){return s?.name==="AbortError"?[]:[]}};return n?n.run(r):r()}function Kl(t){let e=[];for(let n of t){if(["latest","master","main","stable","edge","dev"].includes(n))continue;let r=n.replace(/^v/,""),s=r.indexOf("-");s>0&&(r=r.substring(0,s));try{let o=new Gn.SemVer(r);o.prerelease.length===0&&e.push(o);}catch{}}return e.length===0?null:(e.sort((n,r)=>(0, Gn.gt)(n.version,r.version)?-1:1),e[0].version)}async function Ql(t,e,n,r=false){let s=$s(t),o=`${s.namespace||"library"}/${s.image}`,a=H(e,"docker",o);if(a?.latest)return a.latest;if(r||s.registry&&s.registry!=="docker.io")return null;let i=s.namespace||"library",c=await Jl(i,s.image,n);return Kl(c)}async function Yl(t,e,n=false){let r=new Map,s=new a$1(zl),o=t.map(async a=>{let i=await Ql(a,e,s,n);i&&r.set(a,i);});return await Promise.all(o),r}var Xl=new Set(["Dockerfile","docker-compose.yml","docker-compose.yaml","compose.yml","compose.yaml"]);async function Zl(t,e){let n=e?await e.readTextFile(t):await o(t),r=[],s=/^FROM\s+(?:--platform=[^\s]+\s+)?([^\s]+)/gm,o$1;for(;(o$1=s.exec(n))!==null;){let a=o$1[1];if(a==="scratch")continue;let i=$s(a);r.push({name:`${i.namespace||"library"}/${i.image}`,currentTag:i.tag||"latest"});}return r}async function eu(t,e){let n=e?await e.readTextFile(t):await o(t),r=[],s=/^\s*image:\s*([^\s#]+)/gm,o$1;for(;(o$1=s.exec(n))!==null;){let a=o$1[1].trim().replace(/["']/g,""),i=$s(a);r.push({name:`${i.namespace||"library"}/${i.image}`,currentTag:i.tag||"latest"});}return r}function tu(t,e){try{if(t==="latest"||t==="stable")return "current";let n=t.replace(/^v/,""),r=n.indexOf("-");r>0&&(n=n.substring(0,r));let s=new bt.SemVer(n),o=new bt.SemVer(e);return (0,bt.gt)(o.version,s.version)?o.major>s.major?"major-behind":"minor-behind":"current"}catch{return "unknown"}}async function nu(t,e,n,r=false){let s=[],o=`${t}/Dockerfile`;if(e?await e.pathExists(o):await p(o)){let f=await Zl(o,e);s.push(...f);}let i=["docker-compose.yml","docker-compose.yaml","compose.yml","compose.yaml"];for(let f of i){let g=`${t}/${f}`;if(e?await e.pathExists(g):await p(g)){let y=await eu(g,e);s.push(...y);break}}if(s.length===0)return null;let c=new Map;for(let f of s)c.has(f.name)||c.set(f.name,f.currentTag);let l=Array.from(c.keys()),u=await Yl(l,n,r),p$1=[],d={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};for(let f of l){let g=c.get(f),h=u.get(f),y=h?tu(g,h):"unknown",j=null;if(h)try{let C=g.replace(/^v/,"").split("-")[0],A=new bt.SemVer(C);j=new bt.SemVer(h).major-A.major;}catch{}p$1.push({package:f,section:"dependencies",currentSpec:g,resolvedVersion:g,latestStable:h||null,majorsBehind:j,drift:y}),y==="current"?d.current++:j===1?d.oneBehind++:j&&j>1?d.twoPlusBehind++:d.unknown++;}return {type:"docker",path:_.relative(t.includes("/")?t.split("/").slice(0,-1).join("/"):".",t)||".",name:_.basename(t),frameworks:[],dependencies:p$1,dependencyAgeBuckets:d}}async function su(t,e,n,r,s=false){let o=n?await n.findFiles(t,c=>Xl.has(c)):[],a=new Map;for(let c of o){let l=_.dirname(c);a.has(l)||a.set(l,[]),a.get(l).push(c);}let i=[];for(let[c]of a)try{let l=await nu(c,n,e,s);l&&(l.path=_.relative(t,c)||".",i.push(l));}catch(l){console.error(`Error scanning Docker project at ${c}:`,l);}return i}var ru="https://artifacthub.io/api/v1",ou=1e4,iu=10;async function au(t,e,n,r,s=false){let o=e?`${e}/${t}`:t,a=H(n,"helm",o);if(a?.latest)return a.latest;if(s)return null;let i=async()=>{try{let c=new AbortController,l=setTimeout(()=>c.abort(),ou),u=`${ru}/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||[],g=f.find(h=>h.name===t);return e&&f.length>1&&(g=f.find(h=>h.name===t&&h.repository?.name===e)||g),g?g.version:null}catch(c){return c?.name==="AbortError",null}};return r?r.run(i):i()}async function cu(t,e,n=false){let r=new Map,s=new a$1(iu),o=t.map(async a=>{let i=await au(a.name,a.repo,e,s,n);if(i){let c=a.repo?`${a.repo}/${a.name}`:a.name;r.set(c,i);}});return await Promise.all(o),r}var lu=new Set(["Chart.yaml","Chart.yml"]);async function uu(t,e){let n=e?await e.readTextFile(t):await o(t),r=[],s,o$1,a,i=n.match(/^name:\s*(.+)$/m);i&&(s=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,g;for(;(g=f.exec(d))!==null;){let h=g[1].trim().replace(/["']/g,""),y=g.index,j=f.exec(d),C=j?j.index:d.length;f.lastIndex=y+1;let A=d.substring(y,C),T=A.match(/version:\s*(.+)$/m),v=T?T[1].trim().replace(/["']/g,""):"*",b=A.match(/repository:\s*(.+)$/m),S=b?b[1].trim().replace(/["']/g,""):void 0,w=A.match(/condition:\s*(.+)$/m),x=w?w[1].trim().replace(/["']/g,""):void 0;r.push({name:h,version:v,repository:S,condition:x});}}return {chartName:s,chartVersion:o$1,appVersion:a,dependencies:r}}async function pu(t,e){let n=new Map;try{let r=e?await e.readTextFile(t):await o(t),s=/^\s*-\s+name:\s*(.+)$/gm,o$1;for(;(o$1=s.exec(r))!==null;){let a=o$1[1].trim().replace(/["']/g,""),i=o$1.index,c=s.exec(r),l=c?c.index:r.length;s.lastIndex=i+1;let p=r.substring(i,l).match(/version:\s*(.+)$/m);if(p){let d=p[1].trim().replace(/["']/g,"");n.set(a,d);}}}catch{}return n}function du(t,e){try{let n=t.replace(/^[~^><=\s]+/,""),r=(0,ge.minVersion)((0,ge.validRange)(n)||n);if(!r)return "unknown";if(!(0,ge.gt)(e,r.version))return "current";let s=(0,ge.minVersion)(e);return s?s.major>r.major?"major-behind":"minor-behind":"unknown"}catch{return "unknown"}}async function fu(t,e,n,r=false){let s=null;for(let h of ["Chart.yaml","Chart.yml"]){let y=`${t}/${h}`;if(e?await e.pathExists(y):await p(y)){s=y;break}}if(!s)return null;let{chartName:o,chartVersion:a,appVersion:i,dependencies:c}=await uu(s,e),l=`${t}/Chart.lock`,u=await pu(l,e),p$1=c.map(h=>({name:h.name,repo:h.repository})),d=await cu(p$1,n,r),f=[],g={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};for(let h of c){let y=u.get(h.name),j=y||h.version,C=h.repository?`${h.repository}/${h.name}`:h.name,A=d.get(C),T=A?du(j,A):"unknown",v=null;if(A)try{let b=(0,ge.minVersion)((0,ge.validRange)(j)||j),S=(0,ge.minVersion)((0,ge.validRange)(A)||A);b&&S&&(v=S.major-b.major);}catch{}f.push({package:h.name,section:"dependencies",currentSpec:h.version,resolvedVersion:y||null,latestStable:A||null,majorsBehind:v,drift:T}),T==="current"?g.current++:v===1?g.oneBehind++:v&&v>1?g.twoPlusBehind++:g.unknown++;}return {type:"helm",path:_.relative(t.includes("/")?t.split("/").slice(0,-1).join("/"):".",t)||".",name:o||_.basename(t),runtime:i,frameworks:[],dependencies:f,dependencyAgeBuckets:g}}async function hu(t,e,n,r,s=false){let o=n?await n.findFiles(t,c=>lu.has(c)):[],a=new Map;for(let c of o){let l=_.dirname(c);a.has(l)||a.set(l,[]),a.get(l).push(c);}let i=[];for(let[c]of a)try{let l=await fu(c,n,e,s);l&&(l.path=_.relative(t,c)||".",i.push(l));}catch(l){console.error(`Error scanning Helm chart at ${c}:`,l);}return i}var Ro="https://registry.terraform.io/v1",Io=1e4,mu=10;async function gu(t,e,n,r,s=false){let o=`${t}/${e}`,a=H(n,"terraform",o);if(a?.latest)return a.latest;if(s)return null;let i=async()=>{try{let c=new AbortController,l=setTimeout(()=>c.abort(),Io),u=`${Ro}/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 g=[];for(let h of f)try{let y=new Dt.SemVer(h.version);y.prerelease.length===0&&g.push(y);}catch{}return g.length===0?null:(g.sort((h,y)=>(0,Dt.gt)(h.version,y.version)?-1:1),g[0].version)}catch(c){return c?.name==="AbortError",null}};return r?r.run(i):i()}async function yu(t,e,n,r,s,o=false){let a=`${t}/${e}/${n}`,i=H(r,"terraform",a);if(i?.latest)return i.latest;if(o)return null;let c=async()=>{try{let l=new AbortController,u=setTimeout(()=>l.abort(),Io),p=`${Ro}/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 g=(await d.json()).modules||[];if(g.length===0||!g[0].versions)return null;let h=g[0].versions,y=[];for(let j of h)try{let C=new Dt.SemVer(j.version);C.prerelease.length===0&&y.push(C);}catch{}return y.length===0?null:(y.sort((j,C)=>(0,Dt.gt)(j.version,C.version)?-1:1),y[0].version)}catch(l){return l?.name==="AbortError",null}};return s?s.run(c):c()}async function bu(t,e,n=false){let r=new Map,s=new a$1(mu),o=t.map(async a=>{let i=null,c;a.type==="provider"?(c=`${a.namespace}/${a.name}`,i=await gu(a.namespace,a.name,e,s,n)):(c=`${a.namespace}/${a.name}/${a.provider}`,i=await yu(a.namespace,a.name,a.provider,e,s,n)),i&&r.set(c,i);});return await Promise.all(o),r}async function vu(t,e){let n=e?await e.readTextFile(t):await o(t),r=[],s=[],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,g;for(;(g=f.exec(d))!==null;){let h=g[2],y=h.match(/source\s*=\s*"([^"]+)"/);if(!y)continue;let j=y[1],C=h.match(/version\s*=\s*"([^"]+)"/),A=C?C[1]:void 0;r.push({source:j,version:A});}}let c=/provider\s+"(\w+)"\s*\{([^}]+)\}/g,l;for(;(l=c.exec(n))!==null;){let d=l[1],g=l[2].match(/version\s*=\s*"([^"]+)"/);g&&(r.find(y=>y.source.endsWith(`/${d}`))||r.push({source:`hashicorp/${d}`,version:g[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 g=f[1];if(g.startsWith("./")||g.startsWith("../")||g.startsWith("git::"))continue;let h=d.match(/version\s*=\s*"([^"]+)"/),y=h?h[1]:void 0;s.push({source:g,version:y});}return {terraformVersion:o$1,providers:r,modules:s}}async function wu(t,e){let n=new Map;try{let r=e?await e.readTextFile(t):await o(t),s=/provider\s+"[^"]*\/([^/"]+\/[^/"]+)"\s*\{([^}]+)\}/g,o$1;for(;(o$1=s.exec(r))!==null;){let a=o$1[1],c=o$1[2].match(/version\s*=\s*"([^"]+)"/);c&&n.set(a,c[1]);}}catch{}return n}function oo(t,e){try{let n=t.replace(/^[~><=\s]+/,""),r=(0,Y.minVersion)((0,Y.validRange)(n)||n);if(!r)return "unknown";if(!(0,Y.gt)(e,r.version))return "current";let s=(0,Y.minVersion)(e);return s?s.major>r.major?"major-behind":"minor-behind":"unknown"}catch{return "unknown"}}async function Su(t,e,n,r=false){let s=[];if(e){let y=await e.findFiles(t,j=>j.endsWith(".tf"));s.push(...y);}else {let y=["main.tf","variables.tf","outputs.tf","versions.tf","providers.tf"];for(let j of y){let C=`${t}/${j}`;await p(C)&&s.push(C);}}if(s.length===0)return null;let o,a=[],i=[];for(let y of s){let{terraformVersion:j,providers:C,modules:A}=await vu(y,e);j&&!o&&(o=j),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 wu(u,e),d=[];for(let[y]of c){let[j,C]=y.split("/");d.push({type:"provider",namespace:j,name:C});}for(let[y]of l){let j=y.split("/");if(j.length===3){let[C,A,T]=j;d.push({type:"module",namespace:C,name:A,provider:T});}}let f=await bu(d,n,r),g=[],h={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};for(let[y,j]of c){let C=p$1.get(y),A=C||j||"unknown",T=f.get(y),v=T&&A!=="unknown"?oo(A,T):"unknown",b=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&&(b=w.major-S.major);}catch{}g.push({package:`provider:${y}`,section:"dependencies",currentSpec:j||"unknown",resolvedVersion:C||null,latestStable:T||null,majorsBehind:b,drift:v}),v==="current"?h.current++:b===1?h.oneBehind++:b&&b>1?h.twoPlusBehind++:h.unknown++;}for(let[y,j]of l){let C=j||"unknown",A=f.get(y),T=A&&C!=="unknown"?oo(C,A):"unknown",v=null;if(A&&C!=="unknown")try{let b=(0,Y.minVersion)((0,Y.validRange)(C)||C),S=(0,Y.minVersion)((0,Y.validRange)(A)||A);b&&S&&(v=S.major-b.major);}catch{}g.push({package:`module:${y}`,section:"dependencies",currentSpec:j||"unknown",resolvedVersion:null,latestStable:A||null,majorsBehind:v,drift:T}),T==="current"?h.current++:v===1?h.oneBehind++:v&&v>1?h.twoPlusBehind++:h.unknown++;}return {type:"terraform",path:_.relative(t.includes("/")?t.split("/").slice(0,-1).join("/"):".",t)||".",name:_.basename(t),runtime:o,frameworks:[],dependencies:g,dependencyAgeBuckets:h}}async function ku(t,e,n,r,s=false){let o=n?await n.findFiles(t,c=>c.endsWith(".tf")):[],a=new Map;for(let c of o){let l=_.dirname(c);a.has(l)||a.set(l,[]),a.get(l).push(c);}let i=[];for(let[c]of a)try{let l=await Su(c,n,e,s);l&&(l.path=_.relative(t,c)||".",i.push(l));}catch(l){console.error(`Error scanning Terraform project at ${c}:`,l);}return i}var io=[{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"}],Eu=[{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 pt(t,e="unknown"){return {package:t,section:"dependencies",currentSpec:e,resolvedVersion:null,latestStable:null,majorsBehind:null,drift:"unknown"}}function _t(t,e,n=1){let r=new Set;for(let s of t.split(/\r?\n/)){let o=s.match(e);o?.[n]&&r.add(o[n]);}return [...r]}function ju(t,e){return _.basename(t)||_.basename(e)}function xu(t){return /^\s*(CC|CFLAGS|LDFLAGS)\s*[:?+]?=/m.test(t)||/\b(gcc|clang)\b/.test(t)||/\.(c|o)\b/.test(t)}function gs(t,e,n,r,s,o=[]){let a=r||".",i=`${n}:${a}`;e.has(i)||(e.add(i),t.push({type:n,path:a,name:ju(a,s),frameworks:[],dependencies:o,dependencyAgeBuckets:{current:0,oneBehind:0,twoPlusBehind:0,unknown:o.length}}));}async function Tu(t,e){let n$1=_.basename(t),r=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=>pt(i))}let s=await r();return s?n$1==="go.mod"?_t(s,/^\s*require\s+([^\s]+)\s+(.+)$/).map(o=>pt(o)):n$1==="Cargo.toml"?_t(s,/^\s*([A-Za-z0-9_\-]+)\s*=\s*['"{]/).map(o=>pt(o)):n$1==="pubspec.yaml"?_t(s,/^\s{2,}([A-Za-z0-9_\-]+):\s*.+$/).map(o=>pt(o)):n$1==="mix.exs"?_t(s,/\{\s*:([a-zA-Z0-9_]+),/).map(o=>pt(o)):n$1==="cpanfile"?_t(s,/^\s*requires\s+['"]([^'"]+)['"]/).map(o=>pt(o)):n$1==="build.sbt"?_t(s,/"([A-Za-z0-9_.\-]+)"\s*%{1,2}\s*"([A-Za-z0-9_.\-]+)"/,2).map(o=>pt(o)):[]:[]}function Cu(t){let e=new Map;for(let n of t){if(!n.isFile)continue;let r=_.extname(n.name).toLowerCase();if(r)for(let s of Eu){if(!s.extensions.includes(r))continue;let o=_.dirname(n.relPath)||".";e.has(o)||e.set(o,new Set),e.get(o)?.add(s.type);}}return e}async function Au(t,e){let n=e?await e.walkDir(t):[],r=n.filter(c=>c.isFile&&io.some(l=>l.name===c.name||l.name.startsWith("*.")&&c.name.endsWith(l.name.slice(1)))),s=new Set(n.filter(c=>c.isFile&&c.name.endsWith(".sh")).map(c=>_.dirname(c.relPath)||".")),o$1=[],a=new Set;for(let c of r){let l=io.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(!xu(d))continue}let u=_.dirname(c.relPath)||".",p=await Tu(c.absPath,e);gs(o$1,a,l.type,u,t,p);}for(let c of s)gs(o$1,a,"shell",c,t);let i=Cu(n);for(let[c,l]of i)for(let u of l)gs(o$1,a,u,c,t);return o$1}var Pu=10,Mu=1048576,$u=5,Lu=20,Nu=2621440,Ru=10,Iu=30,_u=5242880,Fu=25,Es=25,js=10,xs=3,Of=1;function ys(t,e,n,r){let s=0;return t.fileCount!==void 0&&t.fileCount>=1&&t.fileCount<e&&s++,t.sizeBytes!==void 0&&t.sizeBytes>0&&t.sizeBytes<n&&s++,t.dependencyCount!==void 0&&t.dependencyCount<r&&s++,s}function Ou(t){return ys(t,Pu,Mu,$u)>=2?"nano":ys(t,Lu,Nu,Ru)>=2?"micro":ys(t,Iu,_u,Fu)>=2?"small":"standard"}function Bu(t){switch(t){case "nano":return "nano";case "micro":case "function":return "micro";case "small":return "small";default:return "standard"}}function Bf(t){switch(t){case "nano":return 1/Es;case "micro":return 1/js;case "small":return 1/xs;default:return 1}}function Du(t){let e=0,n=0,r=0,s=0;for(let a of t)switch(Bu(a.classification)){case "nano":e++;break;case "micro":n++;break;case "small":r++;break;default:s++;break}let o=s+r/xs+n/js+e/Es;return {nanoCount:e,microCount:n,smallCount:r,standardCount:s,totalScanned:e+n+r+s,nanoBillingRatio:Es,microBillingRatio:js,smallBillingRatio:xs,billableProjectsRaw:Math.round(o*100)/100,billableProjects:Math.floor(o)}}var Vu=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 r=H(this.manifest,"nuget",t);if(r){let s=(r.versions??[]).filter(i=>Me.valid(i)&&Me.prerelease(i)===null),a=[...s].sort(Me.rcompare)[0]??null;return {latest:r.latest??a,stableVersions:s,latestStableOverall:a}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let s=`${this.baseUrl}/${t.toLowerCase()}/index.json`,o=await fetch(s,{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=>Me.valid(p)&&Me.prerelease(p)===null),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}};function _n(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("."),cn.valid(e)}var Uu=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 r=H(this.manifest,"pypi",t);if(r){let s=[];for(let i of r.versions??[]){let c=_n(i);c&&s.push(c);}let a=[...s].sort(cn.rcompare)[0]??null;return {latest:r.latest?_n(r.latest)??a:a,stableVersions:s,latestStableOverall:a}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let s=`https://pypi.org/pypi/${encodeURIComponent(t)}/json`,o=await fetch(s,{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 g=_n(f);g&&c.push(g);}let l=a.info?.version??null,u=l?_n(l):null,d=[...c].sort(cn.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 bs(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("."),ln.valid(e)}var Gu=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}`,r=this.meta.get(n);if(r)return r;let s=this.sem.run(async()=>{let o=`${t}:${e}`,a=H(this.manifest,"maven",o);if(a){let i=[];for(let u of a.versions??[]){let p=bs(u);p&&i.push(p);}let l=[...i].sort(ln.rcompare)[0]??null;return {latest:a.latest?bs(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(h=>h.v).filter(h=>typeof h=="string"),d=[];for(let h of p){let y=bs(h);y&&d.push(y);}let g=[...d].sort(ln.rcompare)[0]??null;return {latest:g,stableVersions:d,latestStableOverall:g}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(n,s),s}};function vs(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 r=n.slice(0,3).join(".");return un.valid(r)}var qu=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 r=H(this.manifest,"rubygems",t);if(r){let s=[];for(let i of r.versions??[]){let c=vs(i);c&&s.push(c);}let a=[...s].sort(un.rcompare)[0]??null;return {latest:r.latest?vs(r.latest)??a:a,stableVersions:s,latestStableOverall:a}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let s=`https://rubygems.org/api/v1/versions/${encodeURIComponent(t)}.json`,o=await fetch(s,{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=vs(p);d&&i.push(d);}let l=[...i].sort(un.rcompare)[0]??null;return {latest:l,stableVersions:i,latestStableOverall:l}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}},Hu=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 r=H(this.manifest,"swift",t);if(r){let s=[];for(let i of r.versions??[]){let c=te.valid(te.clean(i));c&&s.push(c);}let a=[...s].sort(te.rcompare)[0]??null;return {latest:r.latest?te.valid(te.clean(r.latest))??a:a,stableVersions:s,latestStableOverall:a}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let s=t.match(/github\.com[/:]([^/]+\/[^/]+?)(\.git)?$/i);if(!s)return {latest:null,stableVersions:[],latestStableOverall:null};let o=s[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 g=te.valid(te.clean(f));g&&l.push(g);}let p=[...l].sort(te.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 r=await n.json();if(!Array.isArray(r))return {latest:null,stableVersions:[],latestStableOverall:null};let s=[];for(let i of r){let c=i.name;if(!c||/(?:alpha|beta|rc|pre|dev)/i.test(c))continue;let l=te.valid(te.clean(c));l&&s.push(l);}let a=[...s].sort(te.rcompare)[0]??null;return {latest:a,stableVersions:s,latestStableOverall:a}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}}},Wu=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 r=H(this.manifest,"go",t);if(r){let s=[];for(let i of r.versions??[]){let c=pe.valid(pe.clean(i));c&&s.push(c);}let a=[...s].sort(pe.rcompare)[0]??null;return {latest:r.latest?pe.valid(pe.clean(r.latest))??a:a,stableVersions:s,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=pe.valid(pe.clean(d));f&&l.push(f);}let p=[...l].sort(pe.rcompare)[0]??null;return {latest:p,stableVersions:l,latestStableOverall:p}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}},zu=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 r=H(this.manifest,"cargo",t);if(r){let s=[];for(let i of r.versions??[]){let c=de.valid(de.clean(i));c&&s.push(c);}let a=[...s].sort(de.rcompare)[0]??null;return {latest:r.latest?de.valid(de.clean(r.latest))??a:a,stableVersions:s,latestStableOverall:a}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let s=`https://crates.io/api/v1/crates/${encodeURIComponent(t)}`,o=await fetch(s,{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=de.valid(de.clean(u.num));p&&i.push(p);}let l=[...i].sort(de.rcompare)[0]??null;return {latest:l,stableVersions:i,latestStableOverall:l}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}},Ju=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 r=H(this.manifest,"composer",t);if(r){let s=[];for(let i of r.versions??[]){let c=fe.valid(fe.clean(i));c&&s.push(c);}let a=[...s].sort(fe.rcompare)[0]??null;return {latest:r.latest?fe.valid(fe.clean(r.latest))??a:a,stableVersions:s,latestStableOverall:a}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let s=`https://repo.packagist.org/p2/${encodeURIComponent(t)}.json`,o=await fetch(s,{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=fe.valid(fe.clean(d));f&&c.push(f);}let u=[...c].sort(fe.rcompare)[0]??null;return {latest:u,stableVersions:c,latestStableOverall:u}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}},Ku=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 r=H(this.manifest,"pub",t);if(r){let s=[];for(let i of r.versions??[]){let c=he.valid(he.clean(i));c&&s.push(c);}let a=[...s].sort(he.rcompare)[0]??null;return {latest:r.latest?he.valid(he.clean(r.latest))??a:a,stableVersions:s,latestStableOverall:a}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let s=`https://pub.dev/api/packages/${encodeURIComponent(t)}`,o=await fetch(s,{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 _o(t){try{return await Qu(t)}catch{return {type:"unknown"}}}async function Qu(t){let e=await Yu(t);if(!e)return {type:"unknown"};let n=_.join(e,"HEAD"),r;try{r=(await ye.readFile(n,"utf8")).trim();}catch{return {type:"unknown"}}let s,o;if(r.startsWith("ref: ")){let i=r.slice(5);o=i.startsWith("refs/heads/")?i.slice(11):i,s=await Xu(e,i);}else /^[0-9a-f]{40}$/i.test(r)&&(s=r);let a=await Zu(e);return {type:"git",sha:s??void 0,shortSha:s?s.slice(0,7):void 0,branch:o??void 0,remoteUrl:a}}async function Yu(t){let e=_.resolve(t),n=_.parse(e).root;for(;e!==n;){let r=_.join(e,".git");try{let s=await ye.stat(r);if(s.isDirectory())return r;if(s.isFile()){let o=(await ye.readFile(r,"utf8")).trim();if(o.startsWith("gitdir: "))return _.resolve(e,o.slice(8))}}catch{}e=_.dirname(e);}return null}async function Xu(t,e){let n=_.join(t,e);try{let s=(await ye.readFile(n,"utf8")).trim();if(/^[0-9a-f]{40}$/i.test(s))return s}catch{}let r=_.join(t,"packed-refs");try{let s=await ye.readFile(r,"utf8");for(let o of s.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 Zu(t){let e=await ep(t);if(e)try{let r=(await ye.readFile(e,"utf8")).match(/\[remote\s+"origin"\]([\s\S]*?)(?=\n\[|$)/);return r?r[1]?.match(/\n\s*url\s*=\s*(.+)\s*/)?.[1]?.trim():void 0}catch{return}}async function ep(t){let e=_.join(t,"config");try{if((await ye.stat(e)).isFile())return e}catch{}let n=_.join(t,"commondir");try{let r=(await ye.readFile(n,"utf8")).trim();if(!r)return;let s=_.resolve(t,r),o=_.join(s,"config");if((await ye.stat(o)).isFile())return o}catch{return}}var np=15e3,sp=64*1024*1024,Fo=500,rp="";function Hn(t,e){return new Promise(n=>{execFile("git",e,{cwd:t,timeout:np,maxBuffer:sp,windowsHide:true,encoding:"utf8",env:{...process.env,GIT_TERMINAL_PROMPT:"0",GIT_OPTIONAL_LOCKS:"0",GIT_PAGER:"cat"}},(r,s)=>{n(r?{ok:false,stdout:""}:{ok:true,stdout:typeof s=="string"?s:String(s)});});})}var ao=new Map;function Oo(t){return t.split(_.sep).join("/")}async function dn(t){let e=_.resolve(t),n=ao.get(e);if(n!==void 0)return n;let r=await Hn(e,["rev-parse","--show-toplevel"]),s=r.ok&&r.stdout.trim()||null;return ao.set(e,s),s}async function Vf(t){return await dn(t)!==null}async function op(t){let e=await dn(t);if(!e)return null;let n=await Hn(e,["rev-parse","HEAD"]);return n.ok&&n.stdout.trim()||null}async function Ts(t,e,n={}){let r=await dn(t);if(!r)return [];let s=Math.max(1,n.maxCommits??Fo),o=["%H","%h","%an","%ae","%aI","%s"].join("%x1f"),a=await Hn(r,["log",`--max-count=${s}`,"--follow",`--format=${o}`,"--",Oo(e)]);if(!a.ok)return [];let i=[];for(let c of a.stdout.split(`
59
- `)){if(!c)continue;let l=c.split(rp);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 ip(t,e,n){if(!/^[0-9a-f]{4,40}$/i.test(e))return null;let r=await dn(t);if(!r)return null;let s=await Hn(r,["show",`${e}:${Oo(n)}`]);return s.ok?s.stdout:null}var ap=["package-lock.json","npm-shrinkwrap.json"],Bo=1,Do="npm-version-timeline.json";function cp(t){let e=new Map,n;try{n=JSON.parse(t);}catch{return e}if(!n||typeof n!="object")return e;let r=n,s=r.packages;if(s&&typeof s=="object"){let a=new Map;for(let i of Object.keys(s).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=s[i],d=p&&typeof p=="object"?p.version:void 0;if(typeof d!="string")continue;let f=i.split(c).length-1,g=a.get(u);(g===void 0||f<g)&&(e.set(u,d),a.set(u,f));}return e}let o=r.dependencies;return o&&typeof o=="object"&&Vo(o,e),e}function Vo(t,e){for(let n of Object.keys(t).sort()){let r=t[n];if(!r||typeof r!="object")continue;let s=r;typeof s.version=="string"&&!e.has(n)&&e.set(n,s.version),s.dependencies&&typeof s.dependencies=="object"&&Vo(s.dependencies,e);}}async function lp(t,e){if(e)return (await Ts(t,e,{maxCommits:1})).length?e:null;for(let n of ap)if((await Ts(t,n,{maxCommits:1})).length)return n;return null}async function up(t){try{let e=await ye.readFile(_.join(t,Do),"utf8"),n=JSON.parse(e);if(n?.schema===Bo&&n.timeline)return n.timeline}catch{}return null}async function pp(t,e){try{await ye.mkdir(t,{recursive:!0});let n={schema:Bo,timeline:e};await ye.writeFile(_.join(t,Do),JSON.stringify(n,null,2));}catch{}}async function Uf(t,e={}){if(!await dn(t))return null;let r=await lp(t,e.lockfile);if(!r)return null;let s=await op(t);if(e.cacheDir&&s){let u=await up(e.cacheDir);if(u&&u.head===s&&u.lockfile===r)return u}let o=await Ts(t,r,{maxCommits:e.maxCommits??Fo});if(!o.length)return null;let a=new Map,i=new Map;for(let u of o){let p=await ip(t,u.sha,r);if(p==null)continue;let d=cp(p);for(let[f,g]of d){if(a.get(f)===g)continue;a.set(f,g);let h=i.get(f);h||(h=[],i.set(f,h)),h.push({version:g,commit:u});}}let c=[...i.keys()].sort().map(u=>({ecosystem:"npm",name:u,changes:i.get(u)})),l={ecosystem:"npm",lockfile:r,head:s,packages:c};return e.cacheDir&&s&&await pp(e.cacheDir,l),l}function je(t){return t.replace(/[^a-zA-Z0-9_]/g,"_")}function Ft(t){return t.replace(/"/g,'\\"')}function Ot(t){return t===void 0||Number.isNaN(t)?"scoreUnknown":t>=80?"scoreHigh":t>=50?"scoreModerate":"scoreLow"}function on(t){let e=t.drift?.score;return typeof e=="number"?`${t.name} (${e})`:t.name}function Ns(){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 dp(t){let e=["flowchart LR"],n=new Map(t.map(a=>[a.path,a])),r=[],s=new Set;for(let a of t){let i=je(a.projectId||a.path||a.name);for(let c of a.projectReferences??[]){let l=n.get(c.path);if(!l)continue;let u=je(l.projectId||l.path||l.name);r.push(`${i} --> ${u}`),s.add(i),s.add(u);}}let o=s.size===0;for(let a of t){let i=je(a.projectId||a.path||a.name);!o&&!s.has(i)||(e.push(`${i}["${Ft(on(a))}"]`),e.push(`class ${i} ${Ot(a.drift?.score)}`));}return e.push(...r),e.push(...Ns()),{mermaid:e.join(`
60
- `)}}function fp(t,e){let n=["flowchart LR"],r=new Map(e.map(i=>[i.path,i])),s=e.filter(i=>i.projectReferences?.some(c=>c.path===t.path)),o=(t.projectReferences??[]).map(i=>r.get(i.path)).filter(i=>!!i),a=je(t.projectId||t.path||t.name);n.push(`${a}["${Ft(on(t))}"]`),n.push(`class ${a} ${Ot(t.drift?.score)}`);for(let i of s){let c=je(i.projectId||i.path||i.name);n.push(`${c}["${Ft(on(i))}"]`),n.push(`class ${c} ${Ot(i.drift?.score)}`),n.push(`${c} --> ${a}`);}for(let i of o){let c=je(i.projectId||i.path||i.name);n.push(`${c}["${Ft(on(i))}"]`),n.push(`class ${c} ${Ot(i.drift?.score)}`),n.push(`${a} --> ${c}`);}return n.push(...Ns()),{mermaid:n.join(`
61
- `)}}function hp(t,e){let n=["flowchart TB"],r=je(t.solutionId||t.path||t.name),s=t.drift?.score,o=typeof s=="number"?` (${s})`:" (n/a)";n.push(`${r}["${Ft(`${t.name}${o}`)}"]`),n.push(`class ${r} ${Ot(s)}`);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=je(c.projectId||c.path||c.name);n.push(`${l}["${Ft(on(c))}"]`),n.push(`class ${l} ${Ot(c.drift?.score)}`),n.push(`${r} --> ${l}`);for(let u of c.projectReferences??[]){let p=a.get(u.path);if(!p)continue;let d=je(p.projectId||p.path||p.name);n.push(`${l} --> ${d}`);}}return n.push(...Ns()),{mermaid:n.join(`
62
- `)}}var gp=createRequire(import.meta.url),yp=gp("../package.json");yp.version;var bp="https://registry.npmjs.org/@vibgrate%2fcli/latest",qo=_.join(an.homedir(),".vibgrate"),vp=_.join(qo,"update-check.json");async function Wf(){try{let t=new AbortController,e=setTimeout(()=>t.abort(),1e4);e.unref?.();let n;try{n=await fetch(bp,{headers:{Accept:"application/json"},signal:t.signal});}finally{clearTimeout(e);}if(!n.ok)return null;let s=(await n.json()).version;return !s||!Go.default.valid(s)?null:(await wp({latest:s,checkedAt:Date.now()}),s)}catch{return null}}async function wp(t){try{await ye.mkdir(qo,{recursive:!0}),await ye.writeFile(vp,JSON.stringify(t),"utf-8");}catch{}}var Sp=[{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 kp(t,e=3){let n=t.topEvidence,r=n.filter(u=>u.kind==="dependency").map(u=>u.value).slice(0,10),s=Tp(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=Ep(u.value);a.has(p)||a.set(p,new Set);let d=jp(u.value);d.length>=3&&a.get(p).add(d);}let c=[];for(let[u,p]of a){let d=xp([...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:r,routes:s,detectedFrameworks:t.detectedFrameworks}}function Ep(t){for(let{category:e,pattern:n}of Sp)if(n.test(t))return e;return "general"}function jp(t){return t.toLowerCase().replace(/[^a-z0-9\s-]/g," ").replace(/\s+/g," ").trim().slice(0,60)}function xp(t){let e=t.sort((r,s)=>s.length-r.length),n=[];for(let r of e)n.some(o=>{let a=r.slice(0,6);return o.startsWith(a)||o.includes(r)||r.includes(o)})||n.push(r);return n}function Tp(t){let e=new Set,n=[];for(let r of t){let s=r.replace(/:[a-z_]+/gi,":param").replace(/\[\[*\.*\.*[a-z_]+\]*\]/gi,":param").replace(/\/+$/,"").toLowerCase();e.has(s)||(e.add(s),n.push(r));}return n}var Ap=promisify(Ho.gzip),ue=50;function en(t){let e=t.match(/^(.+?)\s*\(/);return e?e[1].trim():t.trim()}function Pp(t){return {databaseTechnologies:t.databaseTechnologies.slice(0,10),connectionStrings:[],connectionPoolSettings:t.connectionPoolSettings.slice(0,ue),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(en).slice(0,ue),tables:t.tables.map(en).slice(0,ue),views:t.views.map(en).slice(0,ue),storedProcedures:t.storedProcedures.map(en).slice(0,ue),triggers:t.triggers.map(en).slice(0,ue),rowLevelSecurityPolicies:t.rowLevelSecurityPolicies.slice(0,20),otherServices:t.otherServices.slice(0,20)}}function Mp(t){let e=new Set;return {integrations:t.integrations.filter(r=>{let s=r.provider.split(":")[0];return e.has(s)?false:(e.add(s),true)}).slice(0,ue).map(r=>({provider:r.provider,endpoint:"",version:r.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 $p(t){return {faviconFiles:t.faviconFiles.slice(0,1),productLogos:[]}}function Lp(t){let e={...t};if(e.extended){let n={...e.extended};if(n.dataStores&&(n.dataStores=Pp(n.dataStores)),n.apiSurface&&(n.apiSurface=Mp(n.apiSurface)),n.assetBranding&&(n.assetBranding=$p(n.assetBranding)),n.uiPurpose){let r=kp(n.uiPurpose);n.uiPurpose={enabled:n.uiPurpose.enabled,detectedFrameworks:r.detectedFrameworks,evidenceCount:r.originalCount,capped:n.uiPurpose.capped,topEvidence:[],unknownSignals:[],compacted:r};}if(n.runtimeConfiguration&&(n.runtimeConfiguration={...n.runtimeConfiguration,environmentVariables:n.runtimeConfiguration.environmentVariables.slice(0,100),hiddenConfigFiles:n.runtimeConfiguration.hiddenConfigFiles.slice(0,ue),startupArguments:n.runtimeConfiguration.startupArguments.slice(0,100)}),n.operationalResilience){let r=n.operationalResilience;n.operationalResilience={implicitTimeouts:r.implicitTimeouts.slice(0,30),defaultPaginationSize:r.defaultPaginationSize.slice(0,30),implicitRetryLogic:r.implicitRetryLogic.slice(0,30),defaultLocale:r.defaultLocale.slice(0,20),defaultCurrency:r.defaultCurrency.slice(0,20),implicitTimezone:r.implicitTimezone.slice(0,20),defaultCharacterEncoding:r.defaultCharacterEncoding.slice(0,20),sessionStores:r.sessionStores.slice(0,20),distributedLocks:r.distributedLocks.slice(0,20),jobSchedulers:r.jobSchedulers.slice(0,30),idempotencyKeys:r.idempotencyKeys.slice(0,20),rateLimitingCounters:r.rateLimitingCounters.slice(0,20),circuitBreakerState:r.circuitBreakerState.slice(0,20),abTestToggles:r.abTestToggles.slice(0,20),regionalEnablementRules:r.regionalEnablementRules.slice(0,20),betaAccessGroups:r.betaAccessGroups.slice(0,20),licensingEnforcementLogic:r.licensingEnforcementLogic.slice(0,20),killSwitches:r.killSwitches.slice(0,20),connectorRetryLogic:r.connectorRetryLogic.slice(0,20),apiPollingIntervals:r.apiPollingIntervals.slice(0,20),fieldMappings:r.fieldMappings.slice(0,20),schemaRegistryRules:r.schemaRegistryRules.slice(0,20),deadLetterQueueBehavior:r.deadLetterQueueBehavior.slice(0,20),dataMaskingRules:r.dataMaskingRules.slice(0,20),transformationLogic:r.transformationLogic.slice(0,20),timezoneHandling:r.timezoneHandling.slice(0,20),encryptionSettings:r.encryptionSettings.slice(0,30),hardcodedSecretSignals:r.hardcodedSecretSignals.slice(0,20)};}n.dependencyGraph&&(n.dependencyGraph={...n.dependencyGraph,phantomDependencies:n.dependencyGraph.phantomDependencies.slice(0,ue),phantomDependencyDetails:n.dependencyGraph.phantomDependencyDetails?.slice(0,ue),duplicatedPackages:n.dependencyGraph.duplicatedPackages.slice(0,ue)}),e.extended=n;}return e}async function Np(t){let e=JSON.stringify(t);return Ap(e,{level:9})}async function Jf(t){let e=Lp(t);return {body:await Np(e),contentEncoding:"gzip"}}function Rp(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 Kf(t,e,n){let r=e,s=new URL(`${t.scheme}://${r}/v1/ingest/scan/preflight`);n?.repositoryName&&s.searchParams.set("repository",n.repositoryName),n?.vcsSha&&s.searchParams.set("vcsSha",n.vcsSha);let o=String(Date.now()),a=await fetch(s.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 Ip(t){let e=_.join(t,"package.json"),n$1=_.basename(t);if(await p(e))try{let r=await n(e);typeof r.name=="string"&&r.name.trim()&&(n$1=r.name.trim());}catch{}return n$1}var _p=new Set(["node_modules",".git",".vibgrate",".wrangler",".next","dist","build","out",".turbo",".cache","coverage","bin","obj",".vs","TestResults",".nuxt",".output",".svelte-kit"]);async function Qf(t,e){let n=e??await _o(t);if(n.type==="git"&&n.sha)return {vcsSha:n.sha,method:"git_sha"};let r=await Fp(t);return r?{treeHash:r,method:"tree_metadata"}:{method:"unknown"}}async function Fp(t,e){let n=e?.maxFilesPerDirectory??500,r=[];async function s(a,i){let c;try{c=await ye.readdir(a,{withFileTypes:!0});}catch{return}let l=c.filter(u=>u.isFile());if(l.length>n){r.push(`${i||"."}|dir_overflow|${l.length}`);return}for(let u of c){if(u.isDirectory()){if(_p.has(u.name))continue;let f=i?`${i}/${u.name}`:u.name;await s(_.join(a,u.name),f);continue}if(!u.isFile())continue;let p=i?`${i}/${u.name}`:u.name,d=_.join(a,u.name);try{let f=await ye.stat(d);r.push(`${p}|${f.size}|${f.mtimeMs}`);}catch{}}}if(await s(_.resolve(t),""),r.length===0)return;r.sort();let o=As.createHash("sha256");for(let a of r)o.update(a),o.update(`
63
- `);return o.digest("hex")}var Vp="https://api.vibgrate.com",Up=1e3*60*60*24,Gp=5e3;function ws(t){return !!t&&typeof t=="object"&&typeof t.generatedAt=="string"&&typeof t.products=="object"&&t.products!==null}var qp=class{apiBase;offline;manifest;cacheDir;fetchImpl;resolution=null;constructor(t={}){this.apiBase=(t.apiBase??process.env.VIBGRATE_API_BASE??Vp).replace(/\/+$/,""),this.offline=t.offline??false,this.manifest=t.manifest,this.cacheDir=t.cacheDir??_.join(an.homedir(),".vibgrate","cache"),this.fetchImpl=t.fetchImpl??globalThis.fetch;}resolve(){return this.resolution||(this.resolution=this.doResolve()),this.resolution}get cacheFile(){return _.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)<Up)return {catalog:n.catalog,source:"cache"};t=n.catalog;}let r=await this.fetchFromApi();if(r)return await this.writeCache(r),{catalog:r,source:"api"}}let e=this.manifest?.runtimes;return ws(e)?{catalog:e,source:"manifest"}:t&&Date.parse(t.generatedAt)>Date.parse(Ee.generatedAt)?{catalog:t,source:"cache"}:{catalog:Ee,source:"bundled"}}async fetchFromApi(){if(!this.fetchImpl)return null;let t=new AbortController,e=setTimeout(()=>t.abort(),Gp);try{let n=await this.fetchImpl(`${this.apiBase}/v1/reference/runtimes`,{signal:t.signal,headers:{Accept:"application/json"}});if(!n.ok)return null;let r=await n.json();return ws(r)?r: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"&&ws(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{}}},Kp=class Jo{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 Jo(e):null}record(e,n={}){this.flushed||this.events.push({t:Date.now()-this.start,op:e,...n});}recordThrottled(e,n,r={},s=120){if(this.flushed)return;let o=Date.now(),a=this.lastThrottled.get(e)??0;o-a<s||(this.lastThrottled.set(e,o),this.record(n,r));}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{}}},Fn=[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 co(t){return [E.bold.white(" V I B G R A T E"),E.dim(" Drift Intelligence Engine")+E.dim(` v${t}`)]}var lo=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],Qp=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=Kp.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=["",` ${Fn[0]} ${co(this.version)[0]}`,` ${Fn[1]} ${co(this.version)[1]}`,` ${Fn[2]}`,` ${Fn[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(s=>s.id===t),r={...e,status:"pending",weight:e.weight??1};n>=0?this.steps.splice(n,0,r):this.steps.push(r),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(r=>r.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 r=this.steps.find(o=>o.id===t);r&&(r.status="done",r.detail=e,r.count=n);let s=this.stepStartTimes.get(t);s&&this.stepTimings.push({id:t,durationMs:Date.now()-s}),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,r){let s=this.steps.find(o=>o.id===t);s&&(s.subProgress=e,n!==void 0&&(s.subTotal=n),r!==void 0&&(s.subLabel=r)),this.trace?.recordThrottled(`sub:${t}`,"updateStepProgress",{id:t,current:e,total:n,label:r}),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)%lo.length,this.render();},120);}clearLines(){}render(){if(!this.useLiveUpdates){this.renderCI();return}let t=[];for(let g of this.steps)t.push(this.renderStep(g));t.push("");let e=this.steps.reduce((g,h)=>g+(h.weight??1),0),n=0;for(let g of this.steps){let h=g.weight??1;if(g.status==="done"||g.status==="skipped")n+=h;else if(g.status==="active"&&g.subTotal&&g.subTotal>0&&g.subProgress!==void 0)n+=h*Math.min(g.subProgress/g.subTotal,.99);else if(g.status==="active"){let y=this.stepStartTimes.get(g.id),j=this.stepEstimates.get(g.id);if(y&&j&&j>0){let C=Date.now()-y;n+=h*Math.min(C/j,.95);}}}let r=e>0?Math.min(Math.round(n/e*100),99):0,s=30,o=Math.round(n/Math.max(e,1)*s),a=E.greenBright("\u2501".repeat(Math.min(o,s)))+E.dim("\u254C".repeat(Math.max(s-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(`${r}%`)} ${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,r)=>n+this.countWrappedRows(r,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 r of e){let s=r.codePointAt(0);s!==void 0&&(s>=0&&s<32||s>=127&&s<160||(n+=this.isWideCodePoint(s)?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=lo[this.spinnerFrame],n,r,s="";switch(t.status){case "done":n=E.green("\u2714"),r=E.white(t.label);break;case "active":if(n=E.cyan(e),r=E.bold.white(t.label),t.subTotal&&t.subTotal>0&&t.subProgress!==void 0&&t.subProgress>0&&(s=E.dim(` \xB7 ${t.subProgress.toLocaleString()} / ${t.subTotal.toLocaleString()}`)),t.subLabel){let a=t.subLabel.length>50?"\u2026"+t.subLabel.slice(-49):t.subLabel;s+=E.dim(` ${a}`);}break;case "skipped":n=E.dim("\u25CC"),r=E.dim.strikethrough(t.label);break;default:n=E.dim("\u25CB"),r=E.dim(t.label);break}return t.detail&&(s=E.dim(` \xB7 ${t.detail}`)),t.count!==void 0&&t.count>0&&(s+=E.cyan(` (${t.count})`)),` ${n} ${r}${s}`}renderStats(){let t=this.stats.projects,e=this.stats.dependencies,n=this.stats.frameworks,r=this.stats.findings.warnings,s=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 s>0&&i.push(E.red(`${s} \u2716`)),r>0&&i.push(E.yellow(`${r} \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),r=Math.floor(e%60);return `${n}m ${r.toString().padStart(2,"0")}s`}computeEtaString(t,e,n){if(n===0||t<2e3)return "";let r=e/n;if(r<.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 s=t/r*(1-r),o;if(this.estimatedTotalMs!==null&&this.estimatedTotalMs>0){let a=Math.max(0,this.estimatedTotalMs-t),i=Math.max(.1,1-r),c=a*i+s*(1-i);o=Math.min(a,c);}else o=s;return o<1500?"":E.dim(` \xB7 ~${this.formatElapsed(o)} left`)}},Ko="scan_history.json",uo=10;async function Qo(t){let e=_.join(t,".vibgrate",Ko);try{let n=await ye.readFile(e,"utf8"),r=JSON.parse(n);return r.version===1&&Array.isArray(r.records)?r:null}catch{return null}}async function Yp(t,e){let n=_.join(t,".vibgrate"),r=_.join(n,Ko),s,o=await Qo(t);o?(s=o,s.records.push(e),s.records.length>uo&&(s.records=s.records.slice(-uo))):s={version:1,records:[e]};try{await ye.mkdir(n,{recursive:!0}),await ye.writeFile(r,JSON.stringify(s,null,2)+`
73
- `,"utf8");}catch{}}function Xp(t,e){if(!t||t.records.length===0)return null;let n=t.records.filter(s=>{if(s.totalFiles===0||e===0)return false;let o=e/s.totalFiles;return o>=.33&&o<=3});if(n.length>0){let s=0,o=0;for(let a=0;a<n.length;a++){let i=n[a],c=a+1,l=e/i.totalFiles;s+=i.totalDurationMs*l*c,o+=c;}return Math.round(s/o)}let r=t.records[t.records.length-1];if(r.totalFiles>0&&e>0){let s=e/r.totalFiles;return Math.round(r.totalDurationMs*s)}return r.totalDurationMs}function Zp(t,e){let n=new Map;if(!t||t.records.length===0)return n;let r=null;for(let o=t.records.length-1;o>=0;o--){let a=t.records[o];if(a.steps.length>0){r=a;break}}if(!r)return n;let s=r.totalFiles>0&&e>0?e/r.totalFiles:1;for(let o of r.steps)n.set(o.id,Math.round(o.durationMs*s));return n}async function ed(t,e){let n=await e.findSolutionFiles(t),r=[];for(let s of n)try{let o=await e.readTextFile(s),a=_.dirname(s),c=[_.basename(t),_.relative(t,s).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],g=_.resolve(a,f.replace(/\\/g,"/"));l.add(_.relative(t,g).replace(/\\/g,"/"));}let d=_.basename(s,_.extname(s));r.push({path:c,name:d,type:"dotnet-sln",projectPaths:[...l]});}catch{}return r}async function nh(t,e$1,n$1){let r$1=e$1.vibgrateVersion??"unknown",s$1=Date.now(),o=await Ta(t),a=new a$1(e$1.concurrency),i=e$1.packageManifest?await ic(e$1.packageManifest):void 0,c=e$1.offline===true,l=e$1.maxPrivacy===true,u=new fc(t,a,i,c),p$1=new Vu(a,i,c),d$1=new Uu(a,i,c),f=new Gu(a,i,c),g=new qu(a,i,c),h=new Hu(a,i,c),y=new Wu(a,i,c),j=new zu(a,i,c),C=new Ju(a,i,c),A=new Ku(a,i,c),T=new d,v=[...new Set([...o.exclude??[],...e$1.exclude??[]])];T.setExcludePatterns(v);let b=(e$1.projectScanTimeout??o.projectScanTimeout??180)*1e3;T.setMaxFileSize(o.maxFileSizeToScan??5242880),T.setProjectScanTimeout(b);let S=o.scanners,w=0,x=k=>{w+=k;},m=new Qp(t,r$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(m.setSteps(P),m.completeStep("config","loaded"),!(c?true:await hc(t))){m.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 ce=await new qp({offline:c,manifest:i}).resolve(),ne=ce.catalog,Is=e(t,v);m.startStep("discovery");let se=await Is;m.updateStats({treeSummary:se}),m.completeStep("discovery",`${se.totalFiles.toLocaleString()} files \xB7 ${se.totalDirs.toLocaleString()} dirs`);let _s=await Qo(t),Yo=Xp(_s,se.totalFiles);m.setEstimatedTotal(Yo),m.setStepEstimates(Zp(_s,se.totalFiles)),m.startStep("vcs");let ke=await _o(t),Xo=ke.type!=="unknown"?`${ke.type}${ke.branch?` ${ke.branch}`:""}${ke.shortSha?` @ ${ke.shortSha}`:""}`:"none detected";m.completeStep("vcs",Xo),m.startStep("walk",se.totalFiles),await T.walkDir(t,(k,M)=>{m.updateStepProgress("walk",k,se.totalFiles,M);});let fn=T.getWalkSummary(t);fn&&(fn.totalFiles!==se.totalFiles||fn.totalDirs!==se.totalDirs)&&m.updateStats({treeSummary:fn}),m.completeStep("walk",`${se.totalFiles.toLocaleString()} files indexed`);let Re=await Ac(t,u,T,b,ne);if(Re.length>0){m.insertStepBefore("drift",{id:"node",label:"Found Node projects",weight:4}),m.startStep("node");for(let k of Re)m.addDependencies(k.dependencies.length),m.addFrameworks(k.frameworks.length);w+=Re.length,m.addProjects(Re.length),m.completeStep("node",`${Re.length} project${Re.length!==1?"s":""}`,Re.length);}let Ie=await Nc(t,p$1,T,b,ne);if(Ie.length>0){m.insertStepBefore("drift",{id:"dotnet",label:"Found .NET projects",weight:2}),m.startStep("dotnet");for(let k of Ie)m.addDependencies(k.dependencies.length),m.addFrameworks(k.frameworks.length);w+=Ie.length,m.addProjects(Ie.length),m.completeStep("dotnet",`${Ie.length} project${Ie.length!==1?"s":""}`,Ie.length);}let _e=await Vc(t,d$1,T,b,ne);if(_e.length>0){m.insertStepBefore("drift",{id:"python",label:"Found Python projects",weight:3}),m.startStep("python");for(let k of _e)m.addDependencies(k.dependencies.length),m.addFrameworks(k.frameworks.length);w+=_e.length,m.addProjects(_e.length),m.completeStep("python",`${_e.length} project${_e.length!==1?"s":""}`,_e.length);}let Fe=await Jc(t,f,T,b,ne);if(Fe.length>0){m.insertStepBefore("drift",{id:"java",label:"Found Java projects",weight:3}),m.startStep("java");for(let k of Fe)m.addDependencies(k.dependencies.length),m.addFrameworks(k.frameworks.length);w+=Fe.length,m.addProjects(Fe.length),m.completeStep("java",`${Fe.length} project${Fe.length!==1?"s":""}`,Fe.length);}let Oe=await sl(t,g,T,b,ne);if(Oe.length>0){m.insertStepBefore("drift",{id:"ruby",label:"Found Ruby projects",weight:2}),m.startStep("ruby");for(let k of Oe)m.addDependencies(k.dependencies.length),m.addFrameworks(k.frameworks.length);w+=Oe.length,m.addProjects(Oe.length),m.completeStep("ruby",`${Oe.length} project${Oe.length!==1?"s":""}`,Oe.length);}let Be=await ll(t,h,T,b);if(Be.length>0){m.insertStepBefore("drift",{id:"swift",label:"Found Swift projects",weight:2}),m.startStep("swift");for(let k of Be)m.addDependencies(k.dependencies.length),m.addFrameworks(k.frameworks.length);w+=Be.length,m.addProjects(Be.length),m.completeStep("swift",`${Be.length} project${Be.length!==1?"s":""}`,Be.length);}let De=await fl(t,y,T,b,ne);if(De.length>0){m.insertStepBefore("drift",{id:"go",label:"Found Go projects",weight:2}),m.startStep("go");for(let k of De)m.addDependencies(k.dependencies.length),m.addFrameworks(k.frameworks.length);w+=De.length,m.addProjects(De.length),m.completeStep("go",`${De.length} project${De.length!==1?"s":""}`,De.length);}let Ve=await bl(t,j,T,b);if(Ve.length>0){m.insertStepBefore("drift",{id:"rust",label:"Found Rust projects",weight:2}),m.startStep("rust");for(let k of Ve)m.addDependencies(k.dependencies.length),m.addFrameworks(k.frameworks.length);w+=Ve.length,m.addProjects(Ve.length),m.completeStep("rust",`${Ve.length} project${Ve.length!==1?"s":""}`,Ve.length);}let Ue=await jl(t,C,T,b);if(Ue.length>0){m.insertStepBefore("drift",{id:"php",label:"Found PHP projects",weight:2}),m.startStep("php");for(let k of Ue)m.addDependencies(k.dependencies.length),m.addFrameworks(k.frameworks.length);w+=Ue.length,m.addProjects(Ue.length),m.completeStep("php",`${Ue.length} project${Ue.length!==1?"s":""}`,Ue.length);}let Ge=await Ml(t,A,T,b);if(Ge.length>0){m.insertStepBefore("drift",{id:"dart",label:"Found Dart projects",weight:2}),m.startStep("dart");for(let k of Ge)m.addDependencies(k.dependencies.length),m.addFrameworks(k.frameworks.length);w+=Ge.length,m.addProjects(Ge.length),m.completeStep("dart",`${Ge.length} project${Ge.length!==1?"s":""}`,Ge.length);}let qe=await ql(t,i,T,b,c);if(qe.length>0){m.insertStepBefore("drift",{id:"elixir",label:"Found Elixir projects",weight:2}),m.startStep("elixir");for(let k of qe)m.addDependencies(k.dependencies.length),k.frameworks&&m.addFrameworks(k.frameworks.length);w+=qe.length,m.addProjects(qe.length),m.completeStep("elixir",`${qe.length} project${qe.length!==1?"s":""}`,qe.length);}let He=await su(t,i,T,b,c);if(He.length>0){m.insertStepBefore("drift",{id:"docker",label:"Found Docker images",weight:2}),m.startStep("docker");for(let k of He)m.addDependencies(k.dependencies.length);w+=He.length,m.addProjects(He.length),m.completeStep("docker",`${He.length} project${He.length!==1?"s":""}`,He.length);}let We=await hu(t,i,T,b,c);if(We.length>0){m.insertStepBefore("drift",{id:"helm",label:"Found Helm charts",weight:2}),m.startStep("helm");for(let k of We)m.addDependencies(k.dependencies.length),k.frameworks&&m.addFrameworks(k.frameworks.length);w+=We.length,m.addProjects(We.length),m.completeStep("helm",`${We.length} project${We.length!==1?"s":""}`,We.length);}let ze=await ku(t,i,T,b,c);if(ze.length>0){m.insertStepBefore("drift",{id:"terraform",label:"Found Terraform configs",weight:2}),m.startStep("terraform");for(let k of ze)m.addDependencies(k.dependencies.length);w+=ze.length,m.addProjects(ze.length),m.completeStep("terraform",`${ze.length} project${ze.length!==1?"s":""}`,ze.length);}let Je=await Au(t,T);if(Je.length>0){m.insertStepBefore("drift",{id:"polyglot",label:"Found additional language projects",weight:2}),m.startStep("polyglot");for(let k of Je)m.addDependencies(k.dependencies.length),m.addFrameworks(k.frameworks.length);w+=Je.length,m.addProjects(Je.length),m.completeStep("polyglot",`${Je.length} project${Je.length!==1?"s":""}`,Je.length);}let Zo=new Set(["docker","helm","terraform"]),Kn=k=>Zo.has(k.type)?`${k.type}:${k.path}`:k.path,ei=[...Re,...Ie,..._e,...Fe,...Oe,...Be,...De,...Ve,...Ue,...Ge,...qe,...He,...We,...ze,...Je],hn=new Map;for(let k of ei){let M=hn.get(Kn(k));if(!M)hn.set(Kn(k),k);else {let O=Zn=>Zn.dependencies.filter(tt=>tt.resolvedVersion||tt.latestStable).length,Gs=O(k)>O(M)||O(k)===O(M)&&k.dependencies.length>M.dependencies.length,qt=Gs?k:M,Xn=Gs?M:k;if(Xn.projectReferences?.length)if(!qt.projectReferences)qt.projectReferences=Xn.projectReferences;else {let Zn=new Set(qt.projectReferences.map(tt=>tt.path));for(let tt of Xn.projectReferences)Zn.has(tt.path)||qt.projectReferences.push(tt);}hn.set(Kn(k),qt);}}let re=[...hn.values()],Fs=e$1.dsn||process.env.VIBGRATE_DSN,Os=(Fs?Rp(Fs):null)?.workspaceId;for(let k of re){k.drift=ms([k]),k.projectId=Va(k.path,k.name,Os);let M=_.resolve(t,k.path);try{let O=await T.sourceMetricsUnder(t,M);k.fileCount===void 0&&(k.fileCount=O.fileCount),k.sizeBytes=O.sizeBytes;}catch{}k.dependencyCount=k.dependencies.length,k.classification=Ou({fileCount:k.fileCount,sizeBytes:k.sizeBytes,dependencyCount:k.dependencyCount});}let Bs=_.join(t,".vibgrate","solutions.json"),Ds=new Map;if(await p(Bs))try{let k=await n(Bs);for(let M of k.solutions??[])M.path&&M.solutionId&&Ds.set(M.path,M.solutionId);}catch{}let xt=(await ed(t,T)).map(k=>({solutionId:Ds.get(k.path)??Ua(k.path,k.name,Os),path:k.path,name:k.name,type:k.type,projectPaths:k.projectPaths})),Qn=new Map(re.map(k=>[k.path,k]));for(let k of xt){let M=k.projectPaths.map(O=>Qn.get(O)??Qn.get(_.dirname(O).replace(/\\/g,"/"))).filter(O=>!!O);k.drift=M.length>0?ms(M):void 0;for(let O of M)O.solutionId=k.solutionId,O.solutionName=k.name;}for(let k of re)k.relationshipDiagram=fp(k,re);for(let k of xt)k.relationshipDiagram=hp(k,re);let ti=dp(re),Gt={};n$1&&await n$1({rootDir:t,opts:e$1,config:o,scanners:S,maxPrivacyMode:l,allProjects:re,solutions:xt,projectsByPath:Qn,fileCache:T,progress:m,runtimeCatalog:ne,extended:Gt,addFilesScanned:x});let Vs=(Date.now()-Date.parse(ne.generatedAt))/(1e3*60*60*24),ni=Number.isFinite(Vs)&&Vs>30;Gt.runtimeCatalogInfo={generatedAt:ne.generatedAt,source:ce.source,stale:ni},m.startStep("drift");let Yn=ms(re);m.completeStep("drift",`${Yn.score}/100 \u2014 ${Yn.riskLevel} risk`),m.startStep("findings");let mn=Da(re,o),gn=mn.filter(k=>k.level==="warning").length,yn=mn.filter(k=>k.level==="error").length,bn=mn.filter(k=>k.level==="note").length;m.addFindings(gn,yn,bn);let vn=[];yn>0&&vn.push(`${yn} error${yn!==1?"s":""}`),gn>0&&vn.push(`${gn} warning${gn!==1?"s":""}`),bn>0&&vn.push(`${bn} note${bn!==1?"s":""}`),m.completeStep("findings",vn.join(", ")||"none"),m.finish();let Tt=T.stuckPaths,Ct=T.skippedLargeFiles;if(Tt.length>0){console.log(E.yellow(`
75
- \u26A0 ${Tt.length} path${Tt.length===1?"":"s"} timed out (>${Math.round(b/1e3)}s) and ${Tt.length===1?"was":"were"} skipped:`));for(let O of Tt)console.log(E.dim(` \u2192 ${O}`));let k=Tt.map(O=>`${O}/**`);await Ca(t,k)&&console.log(E.green("\u2714")+` Added ${k.length} pattern${k.length!==1?"s":""} to exclude list in config`);}if(Ct.length>0){let M=((o.maxFileSizeToScan??5242880)/1048576).toFixed(0);console.log(E.yellow(`
76
- \u26A0 ${Ct.length} file${Ct.length===1?"":"s"} skipped (>${M} MB):`));for(let O of Ct.slice(0,10))console.log(E.dim(` \u2192 ${O}`));Ct.length>10&&console.log(E.dim(` \u2026 and ${Ct.length-10} more`));}T.clear(),re.length===0&&console.log(E.yellow("No projects found."));let Us=Date.now()-s$1,si=await td(t,ke.remoteUrl,Gt.buildDeploy?.ci,e$1.repositoryName),ri=Du(re),ae={schemaVersion:"1.0",timestamp:new Date().toISOString(),vibgrateVersion:r$1,rootPath:_.basename(t),...ke.type!=="unknown"?{vcs:ke}:{},repository:si,projects:re,...xt.length>0?{solutions:xt}:{},drift:Yn,findings:mn,...Object.keys(Gt).length>0?{extended:Gt}:{},durationMs:Us,filesScanned:w,treeSummary:se,relationshipDiagram:ti,billing:ri};if(e$1.baseline){let k=_.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=_.join(t,".vibgrate");await q(k),await r(_.join(k,"scan_result.json"),ae),await r(_.join(k,"solutions.json"),{scannedAt:ae.timestamp,solutions:xt.map(M=>({solutionId:M.solutionId,name:M.name,path:M.path,type:M.type,projectPaths:M.projectPaths}))});}if(!e$1.noLocalArtifacts&&!l&&await Yp(t,{timestamp:ae.timestamp,totalDurationMs:Us,totalFiles:se.totalFiles,totalDirs:se.totalDirs,steps:m.getStepTimings()}),!e$1.noLocalArtifacts&&!l){let k={};for(let M of re)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:r$1,solutionId:M.solutionId,solutionName:M.solutionName});if(Object.keys(k).length>0){let M=_.join(t,".vibgrate");await q(M),await r(_.join(M,"project_scores.json"),k);}}if(e$1.format==="json"){let k=JSON.stringify(ae,null,2);e$1.out?(await s(_.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=Qa(ae),M=JSON.stringify(k,null,2);e$1.out?(await s(_.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=Za(ae);console.log(k),e$1.out&&await s(_.resolve(e$1.out),k);}else {let k=Ha(ae);console.log(k),e$1.out&&await s(_.resolve(e$1.out),k);}return ae}async function td(t,e,n$1,r){let s=r?.trim()?r.trim():await Ip(t),o,a=_.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:s,...o?{version:o}:{},...n$1&&n$1.length>0?{pipeline:n$1.join(",")}:{},...e?{remoteUrl:e}:{}}}export{Ou as $,Nc as A,Jf as Aa,Vc as B,Rp as Ba,Jc as C,Kf as Ca,sl as D,Ip as Da,ll as E,Qf as Ea,fl as F,Fp as Fa,bl as G,nh as Ga,jl as H,Ml as I,ql as J,su as K,hu as L,ku as M,Au as N,Pu as O,Mu as P,$u as Q,Lu as R,Nu as S,Ru as T,Iu as U,_u as V,Fu as W,Es as X,js as Y,xs as Z,Of as _,Ta as a,Bu as aa,Cf as b,Bf as ba,Ca as c,Du as ca,Ma as d,Vu as da,$a as e,Uu as ea,La as f,Gu as fa,Na as g,qu as ga,Ur as h,Hu as ha,ms as i,Wu as ia,Da as j,zu as ja,Va as k,Ju as ka,Ua as l,Ku as la,Ga as m,_o as ma,qa as n,Fo as na,Hr as o,dn as oa,Af as p,Vf as pa,Pf as q,op as qa,Mf as r,Ts as ra,$f as s,ip as sa,Ha as t,cp as ta,Qa as u,Uf as ua,Za as v,dp as va,ic as w,fp as wa,fc as x,hp as xa,hc as y,Wf as ya,Ac as z,kp as za};