@visulima/vis 1.0.0-alpha.18 → 1.0.0-alpha.19

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,18 +1,18 @@
1
- var Sr=Object.defineProperty;var C=(t,e)=>Sr(t,"name",{value:e,configurable:!0});import{createRequire as Ar}from"node:module";import{b3 as jr,j as Rr,b4 as Er,c as J,b5 as M,q as se,e as Ne}from"./bin.js";const Cr=Ar(import.meta.url),de=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Or=C(t=>{if(typeof de<"u"&&de.versions&&de.versions.node){const[e,r]=de.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return de.getBuiltinModule(t)}return Cr(t)},"__cjs_getBuiltinModule"),{createRequire:Kt}=Or("node:module");var Ir=Object.defineProperty,V=C((t,e)=>Ir(t,"name",{value:e,configurable:!0}),"O$4"),kr=Object.defineProperty,S=V((t,e)=>kr(t,"name",{value:e,configurable:!0}),"y");const Nr=Kt(import.meta.url),oe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,dt=S(t=>{if(typeof oe<"u"&&oe.versions&&oe.versions.node){const[e,r]=oe.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return oe.getBuiltinModule(t)}return Nr(t)},"__cjs_getBuiltinModule"),X=oe,{execFileSync:Mr}=dt("node:child_process"),me=dt("node:fs"),Pr=dt("node:tty");var Tr=Object.defineProperty,K=S((t,e)=>Tr(t,"name",{value:e,configurable:!0}),"n$5");const ut=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],ft=[12288,12288,65281,65376,65504,65510],pt=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],mt=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Le=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],be=K((t,e)=>{let r=0,i=Math.floor(t.length/2)-1;for(;r<=i;){const n=Math.floor((r+i)/2),s=n*2;if(e<t[s])i=n-1;else if(e>t[s+1])r=n+1;else return!0}return!1},"isInRange"),Fr=ut[0],Lr=ut.at(-1),_r=ft[0],Hr=ft.at(-1),Gr=pt[0],Jr=pt.at(-1),Vr=mt[0],qr=mt.at(-1),zr=Le[0],Dr=Le.at(-1),Wt=19968,[Ur,Yr]=_e(Le);function _e(t){let e=t[0],r=t[1];for(let i=0;i<t.length;i+=2){const n=t[i],s=t[i+1];if(Wt>=n&&Wt<=s)return[n,s];s-n>r-e&&(e=n,r=s)}return[e,r]}C(_e,"Nt");V(_e,"Kt");S(_e,"k$3");K(_e,"findWideFastPathRange");const Zt=K(t=>t<Fr||t>Lr?!1:be(ut,t),"isAmbiguous"),Qt=K(t=>t<_r||t>Hr?!1:be(ft,t),"isFullWidth"),Kr=K(t=>t<Gr||t>Jr?!1:be(pt,t),"isHalfWidth"),Zr=K(t=>t<Vr||t>qr?!1:be(mt,t),"isNarrow"),Xt=K(t=>t>=Ur&&t<=Yr?!0:t<zr||t>Dr?!1:be(Le,t),"isWide");function He(t){return Zt(t)?"ambiguous":Qt(t)?"fullwidth":Kr(t)?"halfwidth":Zr(t)?"narrow":Xt(t)?"wide":"neutral"}C(He,"Ot");V(He,"Qt");S(He,"I$2");K(He,"getCategory");var Qr=Object.defineProperty,gt=S((t,e)=>Qr(t,"name",{value:e,configurable:!0}),"e$2");function we(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}C(we,"mt");V(we,"Et");S(we,"r$4");gt(we,"validate");function ye(t){return we(t),He(t)}C(ye,"pt");V(ye,"Mt");S(ye,"p$6");gt(ye,"eastAsianWidthType");function bt(t,{ambiguousAsWide:e=!1}={}){return we(t),Qt(t)||Xt(t)||e&&Zt(t)?2:1}C(bt,"ie");V(bt,"je");S(bt,"g$3");gt(bt,"eastAsianWidth");var Xr=Object.defineProperty,er=S((t,e)=>Xr(t,"name",{value:e,configurable:!0}),"n$4");const tr=String.raw,Bt=tr`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,ei=er(()=>new RegExp(tr`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${Bt}(?:\u200D${Bt})*`,"gu"),"emojiRegex"),le=new Set(["\x1B","›"]),Ge="\x07",rr="[",wt="m",Me="]8;;",ti=39,ri=/[\u200B\uFEFF\u2060-\u2064]/g,ii=new RegExp(`(?:\\${rr}(?<code>\\d+)m|\\${Me}(?<uri>.*)${Ge})`),ni=Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]])),Q=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,St=/\u001B\[(\d+(?:;\d+)*)?m[^\u001B]*(?:\u001B\[(?:\d+(?:;\d+)*)?m|$)/g,At=/\u001B\]8;[^\u0007\u001B]*(?:\u0007|\u001B\\)(.*?)\u001B\]8;;(?:\u0007|\u001B\\)/g,ve=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,Oe=ei();er(t=>t.replace(Oe,""),"stripEmoji");var oi=Object.defineProperty,Je=S((t,e)=>oi(t,"name",{value:e,configurable:!0}),"b$5");const Ct=new Map,xe=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,je=Je(t=>t>=32&&t<=126?"latin":t===8203||t===8204||t===8205||t===8288?"zero":t<=31||t>=127&&t<=159?"control":t>=160&&t<=255||t>=9472&&t<=9599?"latin":t>=4352&&t<=4607||t>=11904&&t<=40959||t>=44032&&t<=55215||t>=63744&&t<=64255||t>=65280&&t<=65519&&!(t>=65377&&t<=65439)||t>=12352&&t<=12543?"wide":t===8230?"latin":"other","getCharType"),si=Je((t,e)=>{const r=Math.floor(t/65536),i=t%65536;let n=Ct.get(r);if(n||(n=new Map,Ct.set(r,n)),n.has(i))return n.get(i);let s;if(je(t)==="latin")s=e.width.regular;else if(je(t)==="control")s=e.width.control;else if(je(t)==="wide")s=e.width.wide;else switch(ye(t)){case"ambiguous":{s=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{s=e.width.fullWidth;break}case"wide":{s=e.width.wide;break}default:s=e.width.regular}return n.set(i,s),s},"getCachedCharWidth"),ai=Je(t=>t>=768&&t<=879||t>=6832&&t<=6911||t>=7616&&t<=7679||t>=8400&&t<=8447||t>=65056&&t<=65071||t>=917760&&t<=917999||t>=65024&&t<=65039||t>=3633&&t<=3642||t>=3655&&t<=3662||t>=3761&&t<=3769||t>=3771&&t<=3772||t>=3784&&t<=3789||t>=2304&&t<=2307||t>=2362&&t<=2383||t>=2385&&t<=2391||t>=2402&&t<=2403||t>=2433&&t<=2435||t>=2492&&t<=2500||t>=2509&&t<=2509||t>=2561&&t<=2563||t>=2620&&t<=2637||t>=1611&&t<=1631||t>=1648&&t<=1648||t>=1750&&t<=1773||t>=2276&&t<=2302||t>=1425&&t<=1469||t>=1471&&t<=1471||t>=1473&&t<=1474||t>=1476&&t<=1477||t>=1479&&t<=1479||t>=3893&&t<=3893||t>=3895&&t<=3895||t>=3897&&t<=3897||t>=3953&&t<=3966||t>=3968&&t<=3972||t>=3974&&t<=3975?!0:t>=768&&t<=777||t>=803&&t<=803,"isCombiningCharacter"),ae=Je((t,e={})=>{if(!t||t.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const r={truncation:{countAnsiEscapeCodes:e.countAnsiEscapeCodes??!1,ellipsis:e.ellipsis??"",ellipsisWidth:e.ellipsisWidth??(e.ellipsis?ae(e.ellipsis,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:e.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:e.ambiguousIsNarrow??!1,ansi:e.ansiWidth??0,control:e.controlWidth??0,emoji:e.emojiWidth??2,fullWidth:e.fullWidth??2,halfWidth:e.halfWidth??1,regular:e.regularWidth??1,tab:e.tabWidth??8,wide:e.wideWidth??2}},i=Math.max(0,r.truncation.limit-r.truncation.ellipsisWidth),{length:n}=t,s=n>1e4;let o=0,a=0,l=n,h=!1;const c=t.includes("\x1B")||t.includes("›");for(;o<n;){if(c&&(t[o]==="\x1B"||t[o]==="›")){if(t.startsWith("\x1B]8;;",o)){const m="\x1B]8;;\x07",u=m.length,x=t.indexOf("\x07",o+5);if(x!==-1){const w=t.indexOf(m,x+1);if(w!==-1){const v=w+u,$=t.slice(x+1,w).replace(Q,""),W=ae($,{ambiguousIsNarrow:r.width.ambiguousIsNarrow,ansiWidth:r.width.ansi,controlWidth:r.width.control,countAnsiEscapeCodes:!1,ellipsis:r.truncation.ellipsis,ellipsisWidth:r.truncation.ellipsisWidth,emojiWidth:r.width.emoji,fullWidth:r.width.fullWidth,halfWidth:r.width.halfWidth,limit:Math.max(0,i-a),regularWidth:r.width.regular,tabWidth:r.width.tab,wideWidth:r.width.wide}),A=W.width;if(W.truncated)h=!0,l=Math.min(l,o);else if(a+A>i&&(l=Math.min(l,o),h=!0,a+A>r.truncation.limit))break;if(a+=A,o=v,h&&a>=r.truncation.limit)break;continue}}}if(Q.lastIndex=o,Q.test(t)){const m=Q.lastIndex-o,u=r.truncation.countAnsiEscapeCodes?m:r.width.ansi;if(a+u>i&&(l=Math.min(l,o),a+u>r.truncation.limit)){h=!0;break}a+=u,o=Q.lastIndex;continue}}const b=t.codePointAt(o);if(b===8203||b===65279||b>=8288&&b<=8292){o+=1;continue}if(b===9){if(a+r.width.tab>i&&(l=Math.min(l,o),a+r.width.tab>r.truncation.limit)){h=!0;break}a+=r.width.tab,o+=1;continue}if(xe.lastIndex=o,xe.test(t)){const m=(xe.lastIndex-o)*r.width.regular;if(a+m>i){const u=Math.floor((i-a)/r.width.regular);if(l=Math.min(l,o+u),a+m>r.truncation.limit){h=!0;break}}a+=m,o=xe.lastIndex;continue}if((b<=31||b>=127&&b<=159)&&(ve.lastIndex=o,ve.test(t))){const m=(ve.lastIndex-o)*r.width.control;if(a+m>i&&(l=Math.min(l,o+Math.floor((i-a)/r.width.control)),a+m>r.truncation.limit)){h=!0;break}a+=m,o=ve.lastIndex;continue}if(Oe.lastIndex=o,Oe.test(t)){if(a+r.width.emoji>i&&(l=Math.min(l,o),a+r.width.emoji>r.truncation.limit)){h=!0;break}a+=r.width.emoji,o=Oe.lastIndex;continue}const f=t.codePointAt(o)??0;if(ai(f)){o+=f>65535?2:1;continue}let g;if(s)g=si(f,r);else switch(je(f)){case"control":{g=r.width.control;break}case"latin":{g=r.width.regular;break}case"wide":{g=r.width.wide;break}case"zero":{g=0;break}default:switch(ye(f)){case"ambiguous":{g=r.width.ambiguousIsNarrow?r.width.regular:r.width.wide;break}case"fullwidth":{g=r.width.fullWidth;break}case"wide":{g=r.width.wide;break}default:g=r.width.regular}}if(a+g>i&&(l=Math.min(l,o),a+g>r.truncation.limit)){h=!0;break}a+=g,o+=f>65535?2:1}let d=a,p=!1;return h&&r.truncation.limit>=r.truncation.ellipsisWidth&&(d=r.truncation.limit,p=!0),{ellipsed:p,index:h?l:n,truncated:h,width:d}},"getStringTruncatedWidth");var li=Object.defineProperty,hi=S((t,e)=>li(t,"name",{value:e,configurable:!0}),"e$1");const I=hi((t,e={})=>ae(t,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,"getStringWidth");var ci=Object.defineProperty,di=S((t,e)=>ci(t,"name",{value:e,configurable:!0}),"r$1");class ui{static{C(this,"Xe")}static{V(this,"Ue")}static{S(this,"c")}static{di(this,"LRUCache")}capacity;cache;keyOrder;constructor(e){this.capacity=e,this.cache=new Map,this.keyOrder=[]}get(e){if(this.cache.has(e))return this.keyOrder=this.keyOrder.filter(r=>r!==e),this.keyOrder.push(e),this.cache.get(e)}has(e){return this.cache.has(e)}set(e,r){if(this.cache.has(e))this.keyOrder=this.keyOrder.filter(i=>i!==e);else if(this.cache.size>=this.capacity){const i=this.keyOrder.shift();i!==void 0&&this.cache.delete(i)}this.cache.set(e,r),this.keyOrder.push(e)}delete(e){this.cache.delete(e),this.keyOrder=this.keyOrder.filter(r=>r!==e)}clear(){this.cache.clear(),this.keyOrder=[]}size(){return this.cache.size}}var fi=Object.defineProperty,he=S((t,e)=>fi(t,"name",{value:e,configurable:!0}),"p$3");const Ot=new ui(100),pi=new Intl.Segmenter("en",{granularity:"grapheme"}),mi=/^[\u0000-\u007F]*$/,gi=new Set(["0","22","23","24","27","28","29","39","49"]),bi=new Set(["1","3","4","7","8","9"]),jt=new Map([["22","1"],["23","3"],["24","4"],["27","7"],["28","8"],["29","9"]]),$e=he(t=>t>="30"&&t<="37"||t>="90"&&t<="97"||t.startsWith("38;"),"isForegroundColor"),We=he(t=>t>="40"&&t<="47"||t>="100"&&t<="107"||t.startsWith("48;"),"isBackgroundColor"),wi=[{close:"\x1B[22m",open:"\x1B[1m"},{close:"\x1B[23m",open:"\x1B[3m"},{close:"\x1B[24m",open:"\x1B[4m"},{close:"\x1B[27m",open:"\x1B[7m"},{close:"\x1B[28m",open:"\x1B[8m"},{close:"\x1B[29m",open:"\x1B[9m"}],Rt=he((t,e)=>{let r=-1;for(const i of e){const n=t.indexOf(i);n!==-1&&(r===-1||n<r)&&(r=n)}return r},"findFirstPositionOfAny"),yi=he((t,e)=>{if(!t.includes("\x1B"))return[{after:"",before:"",content:t,visibleLength:I(t,e.width)}];const r=Ot.get(t);if(r)return r;const i=[],n=[];let s=0,o;for(Q.lastIndex=0;(o=Q.exec(t))!==null;){const c=o[0];i.push(t.slice(s,o.index)),n.push(c),s=o.index+c.length}s<t.length&&i.push(t.slice(s));const a=[];for(const c of n){if(c==="\x1B[0m"||c==="\x1B]8;;\x07"){a.push(c);continue}if(c.startsWith("\x1B[")&&c.endsWith("m")){const d=c.slice(2,-1);if(gi.has(d)){a.push(c);continue}}}const l=new Set,h=[];for(const[c,d]of i.entries()){if(c>0&&n[c-1]){const f=n[c-1];if(f==="\x1B[0m")l.clear();else if(f==="\x1B]8;;\x07"){for(const g of l)if(g.startsWith("\x1B]8;;")&&!g.endsWith("\x1B]8;;\x07")){l.delete(g);break}}else if(f.startsWith("\x1B[")&&f.endsWith("m")){const g=f.slice(2,-1);if(g==="39"){for(const m of l)if(m.startsWith("\x1B[")&&m.endsWith("m")){const u=m.slice(2,-1);if($e(u)){l.delete(m);break}}}else if(g==="49"){for(const m of l)if(m.startsWith("\x1B[")&&m.endsWith("m")){const u=m.slice(2,-1);if(We(u)){l.delete(m);break}}}else if(jt.has(g)){const m=jt.get(g);for(const u of l)if(u===`\x1B[${m}m`){l.delete(u);break}}else{if($e(g)){for(const m of l)if(m.startsWith("\x1B[")&&m.endsWith("m")){const u=m.slice(2,-1);if($e(u)){l.delete(m);break}}}else if(We(g)){for(const m of l)if(m.startsWith("\x1B[")&&m.endsWith("m")){const u=m.slice(2,-1);if(We(u)){l.delete(m);break}}}else if(bi.has(g)){const m=`\x1B[${g}m`;l.has(m)&&l.delete(m)}l.add(f)}}else if(f.startsWith("\x1B]8;;")&&!f.endsWith("\x1B]8;;\x07")){for(const g of l)if(g.startsWith("\x1B]8;;")&&!g.endsWith("\x1B]8;;\x07")){l.delete(g);break}l.add(f)}}if(d==="")continue;let p="";if(l.size>0)if(a.includes("\x1B[0m"))p="\x1B[0m";else{const f=[];let g=!1;for(const w of l)if(w.startsWith("\x1B]8;;")&&!w.endsWith("\x1B]8;;\x07")){g=!0;break}g&&a.includes("\x1B]8;;\x07")&&f.push("\x1B]8;;\x07");let m=!1,u=!1;for(const w of l)if(w.startsWith("\x1B[")&&w.endsWith("m")){const v=w.slice(2,-1);$e(v)?m=!0:We(v)&&(u=!0)}if(m&&u){const w=Rt(t,["\x1B[3","\x1B[9","\x1B[38;"]),v=Rt(t,["\x1B[4","\x1B[10","\x1B[48;"]);w>=0&&v>=0?w>v?f.push("\x1B[39m","\x1B[49m"):f.push("\x1B[49m","\x1B[39m"):f.push("\x1B[39m","\x1B[49m")}else m&&f.push("\x1B[39m"),u&&f.push("\x1B[49m");m&&u&&t.includes("\x1B[39m")&&t.includes("\x1B[49m")&&(t.indexOf("\x1B[39m")<t.indexOf("\x1B[49m")?(f.length-=2,f.push("\x1B[39m","\x1B[49m")):t.indexOf("\x1B[49m")<t.indexOf("\x1B[39m")&&(f.length-=2,f.push("\x1B[49m","\x1B[39m")));const x=wi.filter(w=>l.has(w.open)).map(w=>({position:t.indexOf(w.open),style:w})).filter(w=>w.position>=0).toSorted((w,v)=>v.position-w.position);for(const w of x){const v=w;a.includes(v.style.close)&&f.push(v.style.close)}p=f.join("")}const b=[...l].join("");h.push({after:p,before:b,content:d,visibleLength:I(d,{fullWidth:1,wideWidth:1})})}return Ot.set(t,h),h},"processIntoStyledSegments"),vi=he((t,e,r,i)=>{const n=[...i.segmenter.segment(t)],s=[];let o=0,a=!1;for(const l of n){const h=I(l.segment,i.width),c=o,d=o+h;if(!a)if(c<e){o=d;continue}else a=!0;if(c>=r||d>r)break;s.push(l.segment),o=d}return s.join("")},"fastSlice"),D=he((t,e=0,r=Number.MAX_SAFE_INTEGER,i={})=>{const n={segmenter:pi,...i};if(e>=r||t==="")return"";const s=I(t,n.width);if(e===0&&r>=s)return t;if(e<0||r<0)throw new RangeError("Negative indices aren't supported");if(!t.includes("\x1B"))return mi.test(t)?t.slice(e,r):vi(t,e,r,n);if(St.lastIndex=0,At.lastIndex=0,!St.test(t)&&!At.test(t))return t;const o=yi(t,n);if(o.length===0)return"";let a=0;const l=[];for(const[d,p]of o.entries()){const b=a,f=a+p.visibleLength;if(f>e&&b<r){const g=Math.max(0,e-b),m=Math.min(p.visibleLength,r-b);l.push({end:m,index:d,segment:p,start:g})}a=f}if(l.length===0)return"";const h=[],c=l[0].segment;h.push(c.before);for(let d=0;d<l.length;d++){const{end:p,segment:b,start:f}=l[d];if(f===0&&p===b.visibleLength)h.push(b.content);else{const g=[...n.segmenter.segment(b.content)];h.push(g.slice(f,p).map(m=>m.segment).join(""))}if(d<l.length-1){const g=l[d+1].segment,m=b.after,u=g.before;m!==u&&(m||u)&&h.push(m,u)}}return h.push(l.at(-1).segment.after),h.join("")},"slice");var xi=Object.defineProperty,Ve=S((t,e)=>xi(t,"name",{value:e,configurable:!0}),"u$3");const Et="…",$i=3,Be=Ve((t,e,r=!1)=>{if(t.charAt(e)===" ")return e;const i=r?1:-1,n=Math.min($i,r?t.length-e:e);for(let s=1;s<=n;s++){const o=e+s*i;if(t.charAt(o)===" ")return o}return e},"findNearestSpace"),Se=Ve((t,e,r)=>ae(t,{...r,ellipsis:"",ellipsisWidth:0,limit:e}).index,"widthToIndex"),Ae=Ve((t,e,r)=>I(t.slice(0,e),r),"indexToWidth"),It=Ve((t,e,r={})=>{if(typeof t!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof t}`);if(typeof e!="number")throw new TypeError(`Expected \`limit\` to be a number, got ${typeof e}`);if(t===""||e<=0)return"";const i=t.normalize("NFC"),{ellipsis:n=Et,position:s="end",preferTruncationOnSpace:o=!1}=r;let a=r.ellipsisWidth??n===Et?1:void 0;a??=ae(n,{...r.width,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width;const{width:l}=ae(i,{...r.width,ellipsis:n,ellipsisWidth:a});if(l<=e)return i;switch(s){case"end":{if(o){const h=e-a,c=Se(i,h,r.width),d=Be(i,c),p=Ae(i,d,r.width);return D(i,0,p,{width:r.width})+n}return D(i,0,e-a,{width:r.width})+n}case"middle":{const h=Math.floor(e/2),c=Math.max(0,e-a),d=Math.min(h,c),p=Math.max(0,c-d);if(o){const b=Se(i,d,r.width),f=Be(i,b),g=Ae(i,f,r.width),m=l-p,u=Se(i,m,r.width),x=Be(i,u,!0),w=Ae(i,x,r.width);return D(i,0,g,{width:r.width})+n+D(i,w,l,{width:r.width}).trim()}return D(i,0,d,{width:r.width})+n+D(i,l-p,l,{width:r.width})}case"start":{if(o){const h=l-e+a,c=Se(i,h,r.width),d=Be(i,c,!0),p=Ae(i,d,r.width);return n+D(i,p,l,{width:r.width}).trim()}return n+D(i,l-e+a,l,{width:r.width})}default:throw new Error(`Invalid position: expected 'start', 'middle' or 'end', got '${s}'`)}},"truncate");var Wi=Object.defineProperty,T=S((t,e)=>Wi(t,"name",{value:e,configurable:!0}),"p$2");const Bi=/\x1B\[(\d+)m/;class ir{static{C(this,"se")}static{V(this,"re")}static{S(this,"C")}static{T(this,"AnsiStateTracker")}activeForeground=void 0;activeBackground=void 0;activeFormatting=[];processEscape(e){const r=Bi.exec(e);if(!r)return;const i=Number.parseInt(r[1],10);switch(i){case 0:{this.activeForeground=void 0,this.activeBackground=void 0,this.activeFormatting=[];break}case 39:{this.activeForeground=void 0;break}case 49:{this.activeBackground=void 0;break}default:if(i>=30&&i<=37||i>=90&&i<=97)this.activeForeground=e;else if(i>=40&&i<=47||i>=100&&i<=107)this.activeBackground=e;else if([1,2,3,4,7,8,9].includes(i))this.activeFormatting.push(e);else if([22,23,24,27,28,29].includes(i)){const n={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[i];n&&(this.activeFormatting=this.activeFormatting.filter(s=>!s.includes(n)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const e=[];if(this.activeFormatting.length>0){const r={"\x1B[1m":"\x1B[22m","\x1B[2m":"\x1B[22m","\x1B[3m":"\x1B[23m","\x1B[4m":"\x1B[24m","\x1B[7m":"\x1B[27m","\x1B[8m":"\x1B[28m","\x1B[9m":"\x1B[29m"};[...this.activeFormatting].toReversed().forEach(i=>{const n=r[i];n&&e.push(n)})}return this.activeForeground&&e.push("\x1B[39m"),this.activeBackground&&e.push("\x1B[49m"),e.join("")}}const nr=T((t,e)=>{if(!le.has(t[e]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const r=!0,i=t.slice(e+1,e+1+Me.length).join("")===Me;return{isInsideEscape:r,isInsideLinkEscape:i}},"checkEscapeSequence"),Si=T((t,e={})=>{const r=new ir;let i="",n=!1,s="",o="",a=!1;const l=[...t];for(let h=0;h<l.length;h++){const c=l[h];if(c&&le.has(c)){if(i){const g=e.getWidth?.(i)??0,m={isEscapeSequence:!1,isGrapheme:!0,text:i,width:g};if(a&&(m.isHyperlink=!0,m.hyperlinkUrl=o),e.onSegment?.(m,r)===!1)return;i=""}n=!0,s=c;const b=nr(l,h),{isInsideLinkEscape:f}=b;if(f){let g=h+1;for(o="";g<l.length;){const u=l[g];if(u===Ge)break;o+=u,g+=1}o=o.slice(4);const m={hyperlinkUrl:o,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(e.onSegment?.(m,r)===!1)return;h=g,a=!0,n=!1,s="";continue}if(h+1<l.length&&l[h+1]==="\\"&&a){const g={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(e.onSegment?.(g,r)===!1)return;a=!1,o="",h+=1,n=!1,s="";continue}}if(n){if(s!==c&&(s+=c),c===wt){n=!1,r.processEscape(s);const b={isEscapeSequence:!0,isGrapheme:!1,text:s,width:0};if(e.onSegment?.(b,r)===!1)return;s=""}continue}i+=c;const d=e.getWidth?.(i)??0,p={isEscapeSequence:!1,isGrapheme:!0,text:i,width:d};if(a&&(p.isHyperlink=!0,p.hyperlinkUrl=o),e.onSegment?.(p,r)===!1)return;i=""}if(i){const h=e.getWidth?.(i)??0,c={isEscapeSequence:!1,isGrapheme:!0,text:i,width:h};a&&(c.isHyperlink=!0,c.hyperlinkUrl=o),e.onSegment?.(c,r)}if(s){const h={isEscapeSequence:!0,isGrapheme:!1,text:s,width:0};e.onSegment?.(h,r)}},"processAnsiString"),kt=T(t=>`${le.values().next().value}${rr}${String(t)}${wt}`,"wrapAnsiCode"),Nt=T(t=>`${le.values().next().value}${Me}${t}${Ge}`,"wrapAnsiHyperlink"),Ai=T(t=>{if(t.length===0)return"";if(t.length===1)return t[0];let e="",r,i;const n=t.join(`
1
+ var Sr=Object.defineProperty;var C=(t,e)=>Sr(t,"name",{value:e,configurable:!0});import{createRequire as Ar}from"node:module";import{aT as jr,j as Rr,aU as Er,c as J,aV as M,q as se,e as Ne}from"./bin.js";const Cr=Ar(import.meta.url),de=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Or=C(t=>{if(typeof de<"u"&&de.versions&&de.versions.node){const[e,r]=de.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return de.getBuiltinModule(t)}return Cr(t)},"__cjs_getBuiltinModule"),{createRequire:Kt}=Or("node:module");var Ir=Object.defineProperty,V=C((t,e)=>Ir(t,"name",{value:e,configurable:!0}),"O$4"),kr=Object.defineProperty,S=V((t,e)=>kr(t,"name",{value:e,configurable:!0}),"y");const Nr=Kt(import.meta.url),oe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,dt=S(t=>{if(typeof oe<"u"&&oe.versions&&oe.versions.node){const[e,r]=oe.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return oe.getBuiltinModule(t)}return Nr(t)},"__cjs_getBuiltinModule"),X=oe,{execFileSync:Mr}=dt("node:child_process"),me=dt("node:fs"),Tr=dt("node:tty");var Pr=Object.defineProperty,K=S((t,e)=>Pr(t,"name",{value:e,configurable:!0}),"n$5");const ut=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],ft=[12288,12288,65281,65376,65504,65510],pt=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],mt=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Le=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],be=K((t,e)=>{let r=0,i=Math.floor(t.length/2)-1;for(;r<=i;){const n=Math.floor((r+i)/2),s=n*2;if(e<t[s])i=n-1;else if(e>t[s+1])r=n+1;else return!0}return!1},"isInRange"),Fr=ut[0],Lr=ut.at(-1),_r=ft[0],Hr=ft.at(-1),Gr=pt[0],Jr=pt.at(-1),Vr=mt[0],qr=mt.at(-1),zr=Le[0],Ur=Le.at(-1),Wt=19968,[Dr,Yr]=_e(Le);function _e(t){let e=t[0],r=t[1];for(let i=0;i<t.length;i+=2){const n=t[i],s=t[i+1];if(Wt>=n&&Wt<=s)return[n,s];s-n>r-e&&(e=n,r=s)}return[e,r]}C(_e,"Nt");V(_e,"Kt");S(_e,"k$3");K(_e,"findWideFastPathRange");const Zt=K(t=>t<Fr||t>Lr?!1:be(ut,t),"isAmbiguous"),Qt=K(t=>t<_r||t>Hr?!1:be(ft,t),"isFullWidth"),Kr=K(t=>t<Gr||t>Jr?!1:be(pt,t),"isHalfWidth"),Zr=K(t=>t<Vr||t>qr?!1:be(mt,t),"isNarrow"),Xt=K(t=>t>=Dr&&t<=Yr?!0:t<zr||t>Ur?!1:be(Le,t),"isWide");function He(t){return Zt(t)?"ambiguous":Qt(t)?"fullwidth":Kr(t)?"halfwidth":Zr(t)?"narrow":Xt(t)?"wide":"neutral"}C(He,"Ot");V(He,"Qt");S(He,"I$2");K(He,"getCategory");var Qr=Object.defineProperty,gt=S((t,e)=>Qr(t,"name",{value:e,configurable:!0}),"e$2");function we(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}C(we,"mt");V(we,"Et");S(we,"r$4");gt(we,"validate");function ye(t){return we(t),He(t)}C(ye,"pt");V(ye,"Mt");S(ye,"p$6");gt(ye,"eastAsianWidthType");function bt(t,{ambiguousAsWide:e=!1}={}){return we(t),Qt(t)||Xt(t)||e&&Zt(t)?2:1}C(bt,"ie");V(bt,"je");S(bt,"g$3");gt(bt,"eastAsianWidth");var Xr=Object.defineProperty,er=S((t,e)=>Xr(t,"name",{value:e,configurable:!0}),"n$4");const tr=String.raw,Bt=tr`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,ei=er(()=>new RegExp(tr`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${Bt}(?:\u200D${Bt})*`,"gu"),"emojiRegex"),le=new Set(["\x1B","›"]),Ge="\x07",rr="[",wt="m",Me="]8;;",ti=39,ri=/[\u200B\uFEFF\u2060-\u2064]/g,ii=new RegExp(`(?:\\${rr}(?<code>\\d+)m|\\${Me}(?<uri>.*)${Ge})`),ni=Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]])),Q=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,St=/\u001B\[(\d+(?:;\d+)*)?m[^\u001B]*(?:\u001B\[(?:\d+(?:;\d+)*)?m|$)/g,At=/\u001B\]8;[^\u0007\u001B]*(?:\u0007|\u001B\\)(.*?)\u001B\]8;;(?:\u0007|\u001B\\)/g,ve=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,Oe=ei();er(t=>t.replace(Oe,""),"stripEmoji");var oi=Object.defineProperty,Je=S((t,e)=>oi(t,"name",{value:e,configurable:!0}),"b$5");const Ct=new Map,xe=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,je=Je(t=>t>=32&&t<=126?"latin":t===8203||t===8204||t===8205||t===8288?"zero":t<=31||t>=127&&t<=159?"control":t>=160&&t<=255||t>=9472&&t<=9599?"latin":t>=4352&&t<=4607||t>=11904&&t<=40959||t>=44032&&t<=55215||t>=63744&&t<=64255||t>=65280&&t<=65519&&!(t>=65377&&t<=65439)||t>=12352&&t<=12543?"wide":t===8230?"latin":"other","getCharType"),si=Je((t,e)=>{const r=Math.floor(t/65536),i=t%65536;let n=Ct.get(r);if(n||(n=new Map,Ct.set(r,n)),n.has(i))return n.get(i);let s;if(je(t)==="latin")s=e.width.regular;else if(je(t)==="control")s=e.width.control;else if(je(t)==="wide")s=e.width.wide;else switch(ye(t)){case"ambiguous":{s=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{s=e.width.fullWidth;break}case"wide":{s=e.width.wide;break}default:s=e.width.regular}return n.set(i,s),s},"getCachedCharWidth"),ai=Je(t=>t>=768&&t<=879||t>=6832&&t<=6911||t>=7616&&t<=7679||t>=8400&&t<=8447||t>=65056&&t<=65071||t>=917760&&t<=917999||t>=65024&&t<=65039||t>=3633&&t<=3642||t>=3655&&t<=3662||t>=3761&&t<=3769||t>=3771&&t<=3772||t>=3784&&t<=3789||t>=2304&&t<=2307||t>=2362&&t<=2383||t>=2385&&t<=2391||t>=2402&&t<=2403||t>=2433&&t<=2435||t>=2492&&t<=2500||t>=2509&&t<=2509||t>=2561&&t<=2563||t>=2620&&t<=2637||t>=1611&&t<=1631||t>=1648&&t<=1648||t>=1750&&t<=1773||t>=2276&&t<=2302||t>=1425&&t<=1469||t>=1471&&t<=1471||t>=1473&&t<=1474||t>=1476&&t<=1477||t>=1479&&t<=1479||t>=3893&&t<=3893||t>=3895&&t<=3895||t>=3897&&t<=3897||t>=3953&&t<=3966||t>=3968&&t<=3972||t>=3974&&t<=3975?!0:t>=768&&t<=777||t>=803&&t<=803,"isCombiningCharacter"),ae=Je((t,e={})=>{if(!t||t.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const r={truncation:{countAnsiEscapeCodes:e.countAnsiEscapeCodes??!1,ellipsis:e.ellipsis??"",ellipsisWidth:e.ellipsisWidth??(e.ellipsis?ae(e.ellipsis,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:e.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:e.ambiguousIsNarrow??!1,ansi:e.ansiWidth??0,control:e.controlWidth??0,emoji:e.emojiWidth??2,fullWidth:e.fullWidth??2,halfWidth:e.halfWidth??1,regular:e.regularWidth??1,tab:e.tabWidth??8,wide:e.wideWidth??2}},i=Math.max(0,r.truncation.limit-r.truncation.ellipsisWidth),{length:n}=t,s=n>1e4;let o=0,a=0,l=n,h=!1;const c=t.includes("\x1B")||t.includes("›");for(;o<n;){if(c&&(t[o]==="\x1B"||t[o]==="›")){if(t.startsWith("\x1B]8;;",o)){const m="\x1B]8;;\x07",u=m.length,x=t.indexOf("\x07",o+5);if(x!==-1){const w=t.indexOf(m,x+1);if(w!==-1){const v=w+u,$=t.slice(x+1,w).replace(Q,""),W=ae($,{ambiguousIsNarrow:r.width.ambiguousIsNarrow,ansiWidth:r.width.ansi,controlWidth:r.width.control,countAnsiEscapeCodes:!1,ellipsis:r.truncation.ellipsis,ellipsisWidth:r.truncation.ellipsisWidth,emojiWidth:r.width.emoji,fullWidth:r.width.fullWidth,halfWidth:r.width.halfWidth,limit:Math.max(0,i-a),regularWidth:r.width.regular,tabWidth:r.width.tab,wideWidth:r.width.wide}),A=W.width;if(W.truncated)h=!0,l=Math.min(l,o);else if(a+A>i&&(l=Math.min(l,o),h=!0,a+A>r.truncation.limit))break;if(a+=A,o=v,h&&a>=r.truncation.limit)break;continue}}}if(Q.lastIndex=o,Q.test(t)){const m=Q.lastIndex-o,u=r.truncation.countAnsiEscapeCodes?m:r.width.ansi;if(a+u>i&&(l=Math.min(l,o),a+u>r.truncation.limit)){h=!0;break}a+=u,o=Q.lastIndex;continue}}const b=t.codePointAt(o);if(b===8203||b===65279||b>=8288&&b<=8292){o+=1;continue}if(b===9){if(a+r.width.tab>i&&(l=Math.min(l,o),a+r.width.tab>r.truncation.limit)){h=!0;break}a+=r.width.tab,o+=1;continue}if(xe.lastIndex=o,xe.test(t)){const m=(xe.lastIndex-o)*r.width.regular;if(a+m>i){const u=Math.floor((i-a)/r.width.regular);if(l=Math.min(l,o+u),a+m>r.truncation.limit){h=!0;break}}a+=m,o=xe.lastIndex;continue}if((b<=31||b>=127&&b<=159)&&(ve.lastIndex=o,ve.test(t))){const m=(ve.lastIndex-o)*r.width.control;if(a+m>i&&(l=Math.min(l,o+Math.floor((i-a)/r.width.control)),a+m>r.truncation.limit)){h=!0;break}a+=m,o=ve.lastIndex;continue}if(Oe.lastIndex=o,Oe.test(t)){if(a+r.width.emoji>i&&(l=Math.min(l,o),a+r.width.emoji>r.truncation.limit)){h=!0;break}a+=r.width.emoji,o=Oe.lastIndex;continue}const f=t.codePointAt(o)??0;if(ai(f)){o+=f>65535?2:1;continue}let g;if(s)g=si(f,r);else switch(je(f)){case"control":{g=r.width.control;break}case"latin":{g=r.width.regular;break}case"wide":{g=r.width.wide;break}case"zero":{g=0;break}default:switch(ye(f)){case"ambiguous":{g=r.width.ambiguousIsNarrow?r.width.regular:r.width.wide;break}case"fullwidth":{g=r.width.fullWidth;break}case"wide":{g=r.width.wide;break}default:g=r.width.regular}}if(a+g>i&&(l=Math.min(l,o),a+g>r.truncation.limit)){h=!0;break}a+=g,o+=f>65535?2:1}let d=a,p=!1;return h&&r.truncation.limit>=r.truncation.ellipsisWidth&&(d=r.truncation.limit,p=!0),{ellipsed:p,index:h?l:n,truncated:h,width:d}},"getStringTruncatedWidth");var li=Object.defineProperty,hi=S((t,e)=>li(t,"name",{value:e,configurable:!0}),"e$1");const I=hi((t,e={})=>ae(t,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,"getStringWidth");var ci=Object.defineProperty,di=S((t,e)=>ci(t,"name",{value:e,configurable:!0}),"r$1");class ui{static{C(this,"Xe")}static{V(this,"Ue")}static{S(this,"c")}static{di(this,"LRUCache")}capacity;cache;keyOrder;constructor(e){this.capacity=e,this.cache=new Map,this.keyOrder=[]}get(e){if(this.cache.has(e))return this.keyOrder=this.keyOrder.filter(r=>r!==e),this.keyOrder.push(e),this.cache.get(e)}has(e){return this.cache.has(e)}set(e,r){if(this.cache.has(e))this.keyOrder=this.keyOrder.filter(i=>i!==e);else if(this.cache.size>=this.capacity){const i=this.keyOrder.shift();i!==void 0&&this.cache.delete(i)}this.cache.set(e,r),this.keyOrder.push(e)}delete(e){this.cache.delete(e),this.keyOrder=this.keyOrder.filter(r=>r!==e)}clear(){this.cache.clear(),this.keyOrder=[]}size(){return this.cache.size}}var fi=Object.defineProperty,he=S((t,e)=>fi(t,"name",{value:e,configurable:!0}),"p$3");const Ot=new ui(100),pi=new Intl.Segmenter("en",{granularity:"grapheme"}),mi=/^[\u0000-\u007F]*$/,gi=new Set(["0","22","23","24","27","28","29","39","49"]),bi=new Set(["1","3","4","7","8","9"]),jt=new Map([["22","1"],["23","3"],["24","4"],["27","7"],["28","8"],["29","9"]]),$e=he(t=>t>="30"&&t<="37"||t>="90"&&t<="97"||t.startsWith("38;"),"isForegroundColor"),We=he(t=>t>="40"&&t<="47"||t>="100"&&t<="107"||t.startsWith("48;"),"isBackgroundColor"),wi=[{close:"\x1B[22m",open:"\x1B[1m"},{close:"\x1B[23m",open:"\x1B[3m"},{close:"\x1B[24m",open:"\x1B[4m"},{close:"\x1B[27m",open:"\x1B[7m"},{close:"\x1B[28m",open:"\x1B[8m"},{close:"\x1B[29m",open:"\x1B[9m"}],Rt=he((t,e)=>{let r=-1;for(const i of e){const n=t.indexOf(i);n!==-1&&(r===-1||n<r)&&(r=n)}return r},"findFirstPositionOfAny"),yi=he((t,e)=>{if(!t.includes("\x1B"))return[{after:"",before:"",content:t,visibleLength:I(t,e.width)}];const r=Ot.get(t);if(r)return r;const i=[],n=[];let s=0,o;for(Q.lastIndex=0;(o=Q.exec(t))!==null;){const c=o[0];i.push(t.slice(s,o.index)),n.push(c),s=o.index+c.length}s<t.length&&i.push(t.slice(s));const a=[];for(const c of n){if(c==="\x1B[0m"||c==="\x1B]8;;\x07"){a.push(c);continue}if(c.startsWith("\x1B[")&&c.endsWith("m")){const d=c.slice(2,-1);if(gi.has(d)){a.push(c);continue}}}const l=new Set,h=[];for(const[c,d]of i.entries()){if(c>0&&n[c-1]){const f=n[c-1];if(f==="\x1B[0m")l.clear();else if(f==="\x1B]8;;\x07"){for(const g of l)if(g.startsWith("\x1B]8;;")&&!g.endsWith("\x1B]8;;\x07")){l.delete(g);break}}else if(f.startsWith("\x1B[")&&f.endsWith("m")){const g=f.slice(2,-1);if(g==="39"){for(const m of l)if(m.startsWith("\x1B[")&&m.endsWith("m")){const u=m.slice(2,-1);if($e(u)){l.delete(m);break}}}else if(g==="49"){for(const m of l)if(m.startsWith("\x1B[")&&m.endsWith("m")){const u=m.slice(2,-1);if(We(u)){l.delete(m);break}}}else if(jt.has(g)){const m=jt.get(g);for(const u of l)if(u===`\x1B[${m}m`){l.delete(u);break}}else{if($e(g)){for(const m of l)if(m.startsWith("\x1B[")&&m.endsWith("m")){const u=m.slice(2,-1);if($e(u)){l.delete(m);break}}}else if(We(g)){for(const m of l)if(m.startsWith("\x1B[")&&m.endsWith("m")){const u=m.slice(2,-1);if(We(u)){l.delete(m);break}}}else if(bi.has(g)){const m=`\x1B[${g}m`;l.has(m)&&l.delete(m)}l.add(f)}}else if(f.startsWith("\x1B]8;;")&&!f.endsWith("\x1B]8;;\x07")){for(const g of l)if(g.startsWith("\x1B]8;;")&&!g.endsWith("\x1B]8;;\x07")){l.delete(g);break}l.add(f)}}if(d==="")continue;let p="";if(l.size>0)if(a.includes("\x1B[0m"))p="\x1B[0m";else{const f=[];let g=!1;for(const w of l)if(w.startsWith("\x1B]8;;")&&!w.endsWith("\x1B]8;;\x07")){g=!0;break}g&&a.includes("\x1B]8;;\x07")&&f.push("\x1B]8;;\x07");let m=!1,u=!1;for(const w of l)if(w.startsWith("\x1B[")&&w.endsWith("m")){const v=w.slice(2,-1);$e(v)?m=!0:We(v)&&(u=!0)}if(m&&u){const w=Rt(t,["\x1B[3","\x1B[9","\x1B[38;"]),v=Rt(t,["\x1B[4","\x1B[10","\x1B[48;"]);w>=0&&v>=0?w>v?f.push("\x1B[39m","\x1B[49m"):f.push("\x1B[49m","\x1B[39m"):f.push("\x1B[39m","\x1B[49m")}else m&&f.push("\x1B[39m"),u&&f.push("\x1B[49m");m&&u&&t.includes("\x1B[39m")&&t.includes("\x1B[49m")&&(t.indexOf("\x1B[39m")<t.indexOf("\x1B[49m")?(f.length-=2,f.push("\x1B[39m","\x1B[49m")):t.indexOf("\x1B[49m")<t.indexOf("\x1B[39m")&&(f.length-=2,f.push("\x1B[49m","\x1B[39m")));const x=wi.filter(w=>l.has(w.open)).map(w=>({position:t.indexOf(w.open),style:w})).filter(w=>w.position>=0).toSorted((w,v)=>v.position-w.position);for(const w of x){const v=w;a.includes(v.style.close)&&f.push(v.style.close)}p=f.join("")}const b=[...l].join("");h.push({after:p,before:b,content:d,visibleLength:I(d,{fullWidth:1,wideWidth:1})})}return Ot.set(t,h),h},"processIntoStyledSegments"),vi=he((t,e,r,i)=>{const n=[...i.segmenter.segment(t)],s=[];let o=0,a=!1;for(const l of n){const h=I(l.segment,i.width),c=o,d=o+h;if(!a)if(c<e){o=d;continue}else a=!0;if(c>=r||d>r)break;s.push(l.segment),o=d}return s.join("")},"fastSlice"),U=he((t,e=0,r=Number.MAX_SAFE_INTEGER,i={})=>{const n={segmenter:pi,...i};if(e>=r||t==="")return"";const s=I(t,n.width);if(e===0&&r>=s)return t;if(e<0||r<0)throw new RangeError("Negative indices aren't supported");if(!t.includes("\x1B"))return mi.test(t)?t.slice(e,r):vi(t,e,r,n);if(St.lastIndex=0,At.lastIndex=0,!St.test(t)&&!At.test(t))return t;const o=yi(t,n);if(o.length===0)return"";let a=0;const l=[];for(const[d,p]of o.entries()){const b=a,f=a+p.visibleLength;if(f>e&&b<r){const g=Math.max(0,e-b),m=Math.min(p.visibleLength,r-b);l.push({end:m,index:d,segment:p,start:g})}a=f}if(l.length===0)return"";const h=[],c=l[0].segment;h.push(c.before);for(let d=0;d<l.length;d++){const{end:p,segment:b,start:f}=l[d];if(f===0&&p===b.visibleLength)h.push(b.content);else{const g=[...n.segmenter.segment(b.content)];h.push(g.slice(f,p).map(m=>m.segment).join(""))}if(d<l.length-1){const g=l[d+1].segment,m=b.after,u=g.before;m!==u&&(m||u)&&h.push(m,u)}}return h.push(l.at(-1).segment.after),h.join("")},"slice");var xi=Object.defineProperty,Ve=S((t,e)=>xi(t,"name",{value:e,configurable:!0}),"u$3");const Et="…",$i=3,Be=Ve((t,e,r=!1)=>{if(t.charAt(e)===" ")return e;const i=r?1:-1,n=Math.min($i,r?t.length-e:e);for(let s=1;s<=n;s++){const o=e+s*i;if(t.charAt(o)===" ")return o}return e},"findNearestSpace"),Se=Ve((t,e,r)=>ae(t,{...r,ellipsis:"",ellipsisWidth:0,limit:e}).index,"widthToIndex"),Ae=Ve((t,e,r)=>I(t.slice(0,e),r),"indexToWidth"),It=Ve((t,e,r={})=>{if(typeof t!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof t}`);if(typeof e!="number")throw new TypeError(`Expected \`limit\` to be a number, got ${typeof e}`);if(t===""||e<=0)return"";const i=t.normalize("NFC"),{ellipsis:n=Et,position:s="end",preferTruncationOnSpace:o=!1}=r;let a=r.ellipsisWidth??n===Et?1:void 0;a??=ae(n,{...r.width,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width;const{width:l}=ae(i,{...r.width,ellipsis:n,ellipsisWidth:a});if(l<=e)return i;switch(s){case"end":{if(o){const h=e-a,c=Se(i,h,r.width),d=Be(i,c),p=Ae(i,d,r.width);return U(i,0,p,{width:r.width})+n}return U(i,0,e-a,{width:r.width})+n}case"middle":{const h=Math.floor(e/2),c=Math.max(0,e-a),d=Math.min(h,c),p=Math.max(0,c-d);if(o){const b=Se(i,d,r.width),f=Be(i,b),g=Ae(i,f,r.width),m=l-p,u=Se(i,m,r.width),x=Be(i,u,!0),w=Ae(i,x,r.width);return U(i,0,g,{width:r.width})+n+U(i,w,l,{width:r.width}).trim()}return U(i,0,d,{width:r.width})+n+U(i,l-p,l,{width:r.width})}case"start":{if(o){const h=l-e+a,c=Se(i,h,r.width),d=Be(i,c,!0),p=Ae(i,d,r.width);return n+U(i,p,l,{width:r.width}).trim()}return n+U(i,l-e+a,l,{width:r.width})}default:throw new Error(`Invalid position: expected 'start', 'middle' or 'end', got '${s}'`)}},"truncate");var Wi=Object.defineProperty,P=S((t,e)=>Wi(t,"name",{value:e,configurable:!0}),"p$2");const Bi=/\x1B\[(\d+)m/;class ir{static{C(this,"se")}static{V(this,"re")}static{S(this,"C")}static{P(this,"AnsiStateTracker")}activeForeground=void 0;activeBackground=void 0;activeFormatting=[];processEscape(e){const r=Bi.exec(e);if(!r)return;const i=Number.parseInt(r[1],10);switch(i){case 0:{this.activeForeground=void 0,this.activeBackground=void 0,this.activeFormatting=[];break}case 39:{this.activeForeground=void 0;break}case 49:{this.activeBackground=void 0;break}default:if(i>=30&&i<=37||i>=90&&i<=97)this.activeForeground=e;else if(i>=40&&i<=47||i>=100&&i<=107)this.activeBackground=e;else if([1,2,3,4,7,8,9].includes(i))this.activeFormatting.push(e);else if([22,23,24,27,28,29].includes(i)){const n={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[i];n&&(this.activeFormatting=this.activeFormatting.filter(s=>!s.includes(n)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const e=[];if(this.activeFormatting.length>0){const r={"\x1B[1m":"\x1B[22m","\x1B[2m":"\x1B[22m","\x1B[3m":"\x1B[23m","\x1B[4m":"\x1B[24m","\x1B[7m":"\x1B[27m","\x1B[8m":"\x1B[28m","\x1B[9m":"\x1B[29m"};[...this.activeFormatting].toReversed().forEach(i=>{const n=r[i];n&&e.push(n)})}return this.activeForeground&&e.push("\x1B[39m"),this.activeBackground&&e.push("\x1B[49m"),e.join("")}}const nr=P((t,e)=>{if(!le.has(t[e]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const r=!0,i=t.slice(e+1,e+1+Me.length).join("")===Me;return{isInsideEscape:r,isInsideLinkEscape:i}},"checkEscapeSequence"),Si=P((t,e={})=>{const r=new ir;let i="",n=!1,s="",o="",a=!1;const l=[...t];for(let h=0;h<l.length;h++){const c=l[h];if(c&&le.has(c)){if(i){const g=e.getWidth?.(i)??0,m={isEscapeSequence:!1,isGrapheme:!0,text:i,width:g};if(a&&(m.isHyperlink=!0,m.hyperlinkUrl=o),e.onSegment?.(m,r)===!1)return;i=""}n=!0,s=c;const b=nr(l,h),{isInsideLinkEscape:f}=b;if(f){let g=h+1;for(o="";g<l.length;){const u=l[g];if(u===Ge)break;o+=u,g+=1}o=o.slice(4);const m={hyperlinkUrl:o,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(e.onSegment?.(m,r)===!1)return;h=g,a=!0,n=!1,s="";continue}if(h+1<l.length&&l[h+1]==="\\"&&a){const g={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(e.onSegment?.(g,r)===!1)return;a=!1,o="",h+=1,n=!1,s="";continue}}if(n){if(s!==c&&(s+=c),c===wt){n=!1,r.processEscape(s);const b={isEscapeSequence:!0,isGrapheme:!1,text:s,width:0};if(e.onSegment?.(b,r)===!1)return;s=""}continue}i+=c;const d=e.getWidth?.(i)??0,p={isEscapeSequence:!1,isGrapheme:!0,text:i,width:d};if(a&&(p.isHyperlink=!0,p.hyperlinkUrl=o),e.onSegment?.(p,r)===!1)return;i=""}if(i){const h=e.getWidth?.(i)??0,c={isEscapeSequence:!1,isGrapheme:!0,text:i,width:h};a&&(c.isHyperlink=!0,c.hyperlinkUrl=o),e.onSegment?.(c,r)}if(s){const h={isEscapeSequence:!0,isGrapheme:!1,text:s,width:0};e.onSegment?.(h,r)}},"processAnsiString"),kt=P(t=>`${le.values().next().value}${rr}${String(t)}${wt}`,"wrapAnsiCode"),Nt=P(t=>`${le.values().next().value}${Me}${t}${Ge}`,"wrapAnsiHyperlink"),Ai=P(t=>{if(t.length===0)return"";if(t.length===1)return t[0];let e="",r,i;const n=t.join(`
2
2
  `),s=[...n];let o=0;for(const[a,l]of s.entries()){if(e+=l,le.has(l)){const c=ii.exec(n.slice(o))?.groups??{};if(c.code!==void 0){const d=Number.parseFloat(c.code);r=d===ti?void 0:d}else c.uri!==void 0&&(i=c.uri.length===0?void 0:c.uri)}const h=ni.get(Number(r));s[a+1]===`
3
3
  `?(i&&(e+=Nt("")),r&&h&&(e+=kt(h))):l===`
4
- `&&(r&&h&&(e+=kt(r)),i&&(e+=Nt(i))),o+=l.length}return e},"preserveAnsi"),or=/(?=\s)|(?<=\s)/,sr=/^\s+$/,Xe=T(t=>{if(!t.includes("\x1B"))return t;let e=t;return t.includes("\x1B[30m")&&(e+="\x1B[39m"),t.includes("\x1B[42m")&&(e+="\x1B[49m"),e},"resetAnsiAtLineBreak"),ee=T(t=>{const e=t.split(" ");let r=e.length;for(;r>0&&I(e[r-1])===0;)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},"stringVisibleTrimSpacesRight"),ar=T((t,e,r)=>{if(t.length===0)return[""];if(e<=0)return[t];const i=[],n=new ir;let s="",o=0,a=!1,l=!1,h="",c=0;for(;c<t.length;){const d=t[c];if(le.has(d)){a=!0,h=d,s+=d,l=nr([...t],c).isInsideLinkEscape,c+=1;continue}if(a){h+=d,s+=d,l?d===Ge&&(a=l=!1):d===wt&&(a=!1,n.processEscape(h)),c+=1;continue}const p=I(d),b=d===" ";if(p===0){s+=d,c+=1;continue}if(o+p>e&&(s&&i.push(s+n.getEndEscapesForAllActiveAttributes()),s=n.getStartEscapesForAllActiveAttributes(),o=I(s),b&&r)){for(;c<t.length&&t[c]===" ";)c+=1;continue}if(s+=d,o+=p,o===e&&c<t.length-1&&(i.push(s+n.getEndEscapesForAllActiveAttributes()),s=n.getStartEscapesForAllActiveAttributes(),o=I(s),c+1<t.length&&t[c+1]===" "&&r)){for(c+=1;c<t.length&&t[c]===" ";)c+=1;continue}c+=1}return s&&i.push(s+n.getEndEscapesForAllActiveAttributes()),r?i.map(d=>ee(d)):i},"wrapWithBreakAtWidth"),Ci=T((t,e,r)=>{if(t.length===0)return[];const i=r?t.trim():t;if(i.length===0)return[];const n=[];let s="",o=0;return Si(i,{getWidth:I,onSegment:T((a,l)=>{const h=a.text??"";if(a.isEscapeSequence)s+=h;else{const c=h===" ";if(a.width===0)return s+=h,!0;if(o+a.width>e&&(s&&n.push(s),s=l.getStartEscapesForAllActiveAttributes(),o=0,c))return r||n.push(l.getStartEscapesForAllActiveAttributes()+h),!0;s+=h,o+=a.width}return!0},"onSegment")}),s&&n.push(s),r?n.map(a=>ee(a)):n},"wrapCharByChar"),Oi=T((t,e,r)=>{if(t.length===0)return[];const i=r?t.trim():t;if(i.length===0)return[];const n=i.split(or),s=[];let o="",a=0,l=0;for(;l<n.length;){const h=n[l],c=sr.test(h),d=I(h);if(h.length===0){l+=1;continue}if(r&&c&&a===0){l+=1;continue}if(a+d>e&&a>0){r?s.push(ee(o)):s.push(o),o="",a=0;continue}o+=h,a+=d,l+=1}return o&&(r?s.push(ee(o)):s.push(o)),s},"wrapWithWordBoundaries"),ji=T((t,e,r)=>{if(t.length===0)return[];const i=r?t.trim():t;if(i.length===0)return[];const n=i.split(or),s=[];let o="",a=0,l=0;for(;l<n.length;){const h=n[l],c=sr.test(h),d=I(h);if(h.length===0){l+=1;continue}if(r&&c&&a===0){l+=1;continue}if(d>e){o&&s.push(Xe(r?ee(o):o));const p=ar(h,e,r);if(p.length>0){for(let b=0;b<p.length-1;b+=1)s.push(p[b]);o=p.at(-1),a=I(o)}else o="",a=0;l+=1;continue}if(a+d>e&&a>0&&(s.push(Xe(r?ee(o):o)),o="",a=0,r&&c)){l+=1;continue}o+=h,a+=d,l+=1}return o&&s.push(Xe(r?ee(o):o)),s},"wrapAndBreakWords"),Ce={BREAK_AT_CHARACTERS:"BREAK_AT_CHARACTERS",BREAK_WORDS:"BREAK_WORDS",PRESERVE_WORDS:"PRESERVE_WORDS",STRICT_WIDTH:"STRICT_WIDTH"},Ri=T((t,e={})=>{const{removeZeroWidthCharacters:r=!0,trim:i=!0,width:n=80,wrapMode:s=Ce.PRESERVE_WORDS}=e;if(i&&t.trim()==="")return"";let o=t.normalize("NFC").replaceAll(`\r
4
+ `&&(r&&h&&(e+=kt(r)),i&&(e+=Nt(i))),o+=l.length}return e},"preserveAnsi"),or=/(?=\s)|(?<=\s)/,sr=/^\s+$/,Xe=P(t=>{if(!t.includes("\x1B"))return t;let e=t;return t.includes("\x1B[30m")&&(e+="\x1B[39m"),t.includes("\x1B[42m")&&(e+="\x1B[49m"),e},"resetAnsiAtLineBreak"),ee=P(t=>{const e=t.split(" ");let r=e.length;for(;r>0&&I(e[r-1])===0;)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},"stringVisibleTrimSpacesRight"),ar=P((t,e,r)=>{if(t.length===0)return[""];if(e<=0)return[t];const i=[],n=new ir;let s="",o=0,a=!1,l=!1,h="",c=0;for(;c<t.length;){const d=t[c];if(le.has(d)){a=!0,h=d,s+=d,l=nr([...t],c).isInsideLinkEscape,c+=1;continue}if(a){h+=d,s+=d,l?d===Ge&&(a=l=!1):d===wt&&(a=!1,n.processEscape(h)),c+=1;continue}const p=I(d),b=d===" ";if(p===0){s+=d,c+=1;continue}if(o+p>e&&(s&&i.push(s+n.getEndEscapesForAllActiveAttributes()),s=n.getStartEscapesForAllActiveAttributes(),o=I(s),b&&r)){for(;c<t.length&&t[c]===" ";)c+=1;continue}if(s+=d,o+=p,o===e&&c<t.length-1&&(i.push(s+n.getEndEscapesForAllActiveAttributes()),s=n.getStartEscapesForAllActiveAttributes(),o=I(s),c+1<t.length&&t[c+1]===" "&&r)){for(c+=1;c<t.length&&t[c]===" ";)c+=1;continue}c+=1}return s&&i.push(s+n.getEndEscapesForAllActiveAttributes()),r?i.map(d=>ee(d)):i},"wrapWithBreakAtWidth"),Ci=P((t,e,r)=>{if(t.length===0)return[];const i=r?t.trim():t;if(i.length===0)return[];const n=[];let s="",o=0;return Si(i,{getWidth:I,onSegment:P((a,l)=>{const h=a.text??"";if(a.isEscapeSequence)s+=h;else{const c=h===" ";if(a.width===0)return s+=h,!0;if(o+a.width>e&&(s&&n.push(s),s=l.getStartEscapesForAllActiveAttributes(),o=0,c))return r||n.push(l.getStartEscapesForAllActiveAttributes()+h),!0;s+=h,o+=a.width}return!0},"onSegment")}),s&&n.push(s),r?n.map(a=>ee(a)):n},"wrapCharByChar"),Oi=P((t,e,r)=>{if(t.length===0)return[];const i=r?t.trim():t;if(i.length===0)return[];const n=i.split(or),s=[];let o="",a=0,l=0;for(;l<n.length;){const h=n[l],c=sr.test(h),d=I(h);if(h.length===0){l+=1;continue}if(r&&c&&a===0){l+=1;continue}if(a+d>e&&a>0){r?s.push(ee(o)):s.push(o),o="",a=0;continue}o+=h,a+=d,l+=1}return o&&(r?s.push(ee(o)):s.push(o)),s},"wrapWithWordBoundaries"),ji=P((t,e,r)=>{if(t.length===0)return[];const i=r?t.trim():t;if(i.length===0)return[];const n=i.split(or),s=[];let o="",a=0,l=0;for(;l<n.length;){const h=n[l],c=sr.test(h),d=I(h);if(h.length===0){l+=1;continue}if(r&&c&&a===0){l+=1;continue}if(d>e){o&&s.push(Xe(r?ee(o):o));const p=ar(h,e,r);if(p.length>0){for(let b=0;b<p.length-1;b+=1)s.push(p[b]);o=p.at(-1),a=I(o)}else o="",a=0;l+=1;continue}if(a+d>e&&a>0&&(s.push(Xe(r?ee(o):o)),o="",a=0,r&&c)){l+=1;continue}o+=h,a+=d,l+=1}return o&&s.push(Xe(r?ee(o):o)),s},"wrapAndBreakWords"),Ce={BREAK_AT_CHARACTERS:"BREAK_AT_CHARACTERS",BREAK_WORDS:"BREAK_WORDS",PRESERVE_WORDS:"PRESERVE_WORDS",STRICT_WIDTH:"STRICT_WIDTH"},Ri=P((t,e={})=>{const{removeZeroWidthCharacters:r=!0,trim:i=!0,width:n=80,wrapMode:s=Ce.PRESERVE_WORDS}=e;if(i&&t.trim()==="")return"";let o=t.normalize("NFC").replaceAll(`\r
5
5
  `,`
6
6
  `);return r&&(o=o.replaceAll(ri,"")),o.split(`
7
7
  `).map(a=>{if(i&&a.trim()==="")return"";let l;switch(s){case Ce.BREAK_AT_CHARACTERS:{l=Ci(a,n,i);break}case Ce.BREAK_WORDS:{l=ji(a,n,i);break}case Ce.STRICT_WIDTH:{l=ar(a,n,i);break}default:l=Oi(a,n,i)}return Ai(l)}).join(`
8
- `)},"wordWrap");var Ei=Object.defineProperty,Z=S((t,e)=>Ei(t,"name",{value:e,configurable:!0}),"n$3");const lr=80,hr=24,tt=Z((t,e,{shell:r,env:i}={})=>Mr(t,e,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:r,env:i}).trim(),"exec"),Re=Z((t,e)=>({columns:Number.parseInt(t,10),rows:Number.parseInt(e,10)}),"create"),cr=Z((t,e)=>{const{columns:r,rows:i}=Re(t,e);if(!(Number.isNaN(r)||Number.isNaN(i))&&!(r===lr&&i===hr))return{columns:r,rows:i}},"createIfNotDefault"),Ii=Z(()=>{if(X.platform!=="linux")return!0;try{const t=me.readFileSync("/proc/self/stat","utf8"),e=t.lastIndexOf(") ");if(e===-1)return!1;const r=t.slice(e+2).trim().split(/\s+/),i=Number.parseInt(r[2],10),n=Number.parseInt(r[5],10);return Number.isNaN(i)||Number.isNaN(n)||n<=0?!1:i===n}catch{return!1}},"isForegroundProcess");function qe(){const{env:t,stdout:e,stderr:r}=X;if(e?.columns&&e?.rows)return Re(e.columns,e.rows);if(r?.columns&&r?.rows)return Re(r.columns,r.rows);if(t.COLUMNS&&t.LINES)return Re(t.COLUMNS,t.LINES);const i={columns:lr,rows:hr};return X.platform==="win32"?et()??i:X.platform==="darwin"?Mt()??et()??i:Mt()??et()??ki()??i}C(qe,"Tt");V(qe,"de");S(qe,"O");Z(qe,"terminalSize");const Mt=Z(()=>{try{const t=X.platform==="darwin"?me.constants.O_EVTONLY|me.constants.O_NONBLOCK:me.constants.O_NONBLOCK,{columns:e,rows:r}=Pr.WriteStream(me.openSync("/dev/tty",t));return{columns:e,rows:r}}catch{}},"devTty"),et=Z(()=>{try{const t=tt("tput",["cols"],{env:{TERM:"dumb",...X.env}}),e=tt("tput",["lines"],{env:{TERM:"dumb",...X.env}});if(t&&e)return cr(t,e)}catch{}},"tput"),ki=Z(()=>{try{if(!Ii())return;const t=tt("resize",["-u"]).match(/\d+/g);if(t.length===2)return cr(t[0],t[1])}catch{}},"resize");var Ni=Object.defineProperty,dr=S((t,e)=>Ni(t,"name",{value:e,configurable:!0}),"e");const ie=dr((t,e)=>{switch(e){case"bottom":return{body:t.bottomBody,join:t.bottomJoin,left:t.bottomLeft,right:t.bottomRight};case"middle":return{body:t.joinBody,join:t.joinJoin,left:t.joinLeft,right:t.joinRight};case"top":return{body:t.topBody,join:t.topJoin,left:t.topLeft,right:t.topRight};default:throw new Error(`Invalid borderType: ${String(e)}`)}},"getHorizontalBorderChars"),Mi=dr(t=>({join:t.bodyJoin,left:t.bodyLeft,right:t.bodyRight}),"getVerticalBorderChars");var Pi=Object.defineProperty,Ti=S((t,e)=>Pi(t,"name",{value:e,configurable:!0}),"n$1");const Pe=Ti((t,e,r)=>{let i=0;for(let n=0;n<r;n+=1)i+=t[e+n]??0;return r>1&&(i+=r-1),i},"calculateCellTotalWidth");var Fi=Object.defineProperty,Li=S((t,e)=>Fi(t,"name",{value:e,configurable:!0}),"a");const rt=Li((t,e,r,i)=>{let n=e;for(;n>0&&t[n-1]?.[r]===i;)n-=1;let s=e;for(;s<t.length-1&&t[s+1]?.[r]===i;)s+=1;let o;const a=s-n+1;if(a===1)o=!0;else switch(i.vAlign){case"bottom":{o=e===s;break}case"middle":{const l=n+Math.floor(a/2);o=e===l;break}case"top":{o=e===n;break}default:o=e===n}return{firstRow:n,lastRow:s,showContent:o}},"determineCellVerticalPosition");var _i=Object.defineProperty,Hi=S((t,e)=>_i(t,"name",{value:e,configurable:!0}),"F");const Gi=Hi((t,e,r,i,n)=>{if(t.length===0)return[];let s=t.length-1;for(let l=0;l<t.length;l+=1){const h=t[l];if(h){for(const[c,d]of h.entries())if(d&&n(t,l,c,d)===l){const p=rt(t,l,c,d);s=Math.max(s,p.lastRow)}}}const o=Array.from({length:s+1}).fill(1);for(let l=0;l<t.length;l+=1){const h=t[l];if(h)for(let c=0;c<r.columns;c+=1){const d=h[c];if(d&&n(t,l,c,d)===l&&(d.rowSpan??1)===1){const p=d.colSpan??1,b=Pe(e,c,p),f=i(d,b).length;o[l]=Math.max(o[l]??1,f)}}}const a=Array.from({length:o.length}).fill(!1);if(r.fixedRowHeights)for(let l=0;l<o.length;l+=1){let h;r.fixedRowHeights[l]!==void 0?h=r.fixedRowHeights[l]:r.fixedRowHeights.length===1&&r.fixedRowHeights[0]!==void 0&&(h=r.fixedRowHeights[0]),h!==void 0&&(o[l]=Math.max(1,h),a[l]=!0)}for(let l=0;l<t.length;l+=1){const h=t[l];if(h)for(let c=0;c<r.columns;c+=1){const d=h[c];if(d&&n(t,l,c,d)===l&&(d.rowSpan??1)>1){const p=d.colSpan??1,b=Pe(e,c,p),f=i(d,b).length-1,g=rt(t,l,c,d),{firstRow:m,lastRow:u}=g;let x=0,w=0;for(let $=m;$<=u&&$<o.length;$+=1)x+=o[$]??1,a[$]||(w+=1);const v=f-x;if(v>0)if(w>0){const $=Math.ceil(v/w);let W=0;for(let A=m;A<=u&&A<o.length;A+=1)if(!a[A]){const O=Math.min($,v-W);if(o[A]=(o[A]??1)+O,W+=O,W>=v)break}}else console.warn(`[calculateRowHeights] Content of spanning cell exceeds fixed height allocated. Cell: ${JSON.stringify(d.content)}, Required: ${String(f)}, Allocated: ${String(x)} (fixed).`)}}}return o},"calculateRowHeights");var Ji=Object.defineProperty,Vi=S((t,e)=>Ji(t,"name",{value:e,configurable:!0}),"i");const ne=Vi((t,e,r,i)=>{let n=e;for(;n>0&&t[n-1]?.[r]===i;)n-=1;return n},"findFirstOccurrenceRow");var qi=Object.defineProperty,zi=S((t,e)=>qi(t,"name",{value:e,configurable:!0}),"n");const it="__EMPTY__",Pt=zi(t=>{if(typeof t=="string")return{content:t};if(typeof t=="number"||typeof t=="bigint"||typeof t=="boolean")return{content:String(t)};if(t==null)return{content:it};if(typeof t=="object"&&"content"in t){let{content:e}=t;if(typeof e=="number"||typeof e=="bigint"||typeof e=="boolean")e=String(e);else if(e==null)e=it;else if(typeof e!="string")throw new TypeError(`Invalid item type in grid cell: expected string, number, null, undefined, or GridItem object, but received ${JSON.stringify(t)} (type: ${typeof t})`);return{...t,content:e}}throw new TypeError(`Invalid item type in grid cell: expected string, number, null, undefined, or GridItem object, but received ${JSON.stringify(t)} (type: ${typeof t})`)},"normalizeGridCell");var Di=Object.defineProperty,Ui=S((t,e)=>Di(t,"name",{value:e,configurable:!0}),"p");const Yi=Ui((t,e,r,i,n)=>{const s=I(t),o=" ".repeat(Math.max(0,i)),a=" ".repeat(Math.max(0,n));if(s===0)return o+" ".repeat(Math.max(0,e))+a;const l=Math.max(0,e-s);switch(r){case"center":{const h=Math.floor(l/2),c=l-h;return o+" ".repeat(h)+t+" ".repeat(c)+a}case"right":return o+" ".repeat(l)+t+a;default:return o+t+" ".repeat(l)+a}},"padAndAlignContent");var Ki=Object.defineProperty,yt=S((t,e)=>Ki(t,"name",{value:e,configurable:!0}),"H");const ue=/\r?\n/,Tt=/\s+/,B=yt((t,e)=>!t||!e?t:typeof e=="function"?e(t):e.open+t+e.close,"applyColor");class ze{static{C(this,"xt")}static{V(this,"Nt")}static{S(this,"Grid")}static{yt(this,"Grid")}#e;#n=[];#t;#o=new WeakMap;#r=new WeakMap;static createGridLayout(){return[]}constructor(e){const r={autoColumns:1,autoFlow:"row",autoRows:1,balancedWidths:!1,gap:0,paddingLeft:1,paddingRight:1,rows:0,showBorders:e.border!==void 0,truncate:!1,truncateOverflow:!0,wordWrap:!1};let i;Array.isArray(e.fixedRowHeights)?i=e.fixedRowHeights:typeof e.fixedRowHeights=="number"&&(i=[e.fixedRowHeights]),this.#e={...r,...e,columns:e.columns,fixedRowHeights:i,showBorders:e.border!==void 0||(e.showBorders??!1)};let{terminalWidth:n}=this.#e;if(n===void 0){const{columns:s}=qe();n=s}this.#t=n,this.#e.maxWidth&&(this.#e.maxWidth=Math.min(this.#e.maxWidth,this.#t))}addItem(e){return this.#n.push(Pt(e)),this}addItems(e){return this.#n.push(...e.map(r=>Pt(r))),this}setColumns(e){return this.#e.columns=e,this}setRows(e){return this.#e.rows=e,this}setBorder(e){return this.#e.border=e,this}setShowBorders(e){return this.#e.showBorders=e,this}setMaxWidth(e){return this.#e.maxWidth=e,this}toString(){const e=ze.createGridLayout();if(this.placeItems(e),e.length===0||e[0]?.length===0)return"";let r=this.calculateColumnWidths(e);const i=this.calculateTotalGridWidth(r),n=typeof this.#e.maxWidth=="number"&&this.#e.maxWidth>0?Math.min(this.#e.maxWidth,this.#t):this.#t;return i>n&&(r=this.adjustColumnWidthsForTerminal(r,i)),this.renderGrid(e,r)}placeItems(e){let r=0,i=0;const n=this.#e.rows>0?this.#e.rows:Number.POSITIVE_INFINITY;for(let s=0;s<this.#n.length;s+=1){const o=this.#n[s];if(o.content===it&&!(o.rowSpan&&o.rowSpan>1)&&!(o.colSpan&&o.colSpan>1)){if(this.#e.autoFlow==="row")i+=1,i>=this.#e.columns&&(i=0,r+=1);else{r+=1;const f=e.length>0?e.length:n;r>=f&&f!==Number.POSITIVE_INFINITY?(r=0,i+=1):e.length===0&&f===Number.POSITIVE_INFINITY&&(i+=1)}continue}const a=o.colSpan??1,l=o.rowSpan??1;let h=!1,c=r,d=i,p=0;const b=(e.length+l+5)*this.#e.columns;for(;!h&&c<n&&p<b;){for(p+=1;c+l>e.length;)e.push(Array.from({length:this.#e.columns}).fill(void 0));if(this.canPlaceItem(e,c,d,a,l))if(this.placeItem(e,c,d,o),h=!0,this.#e.autoFlow==="row")i=d+a,r=c,i>=this.#e.columns&&(i=0,r+=1);else{r=c+l,i=d;const f=e.length>0?e.length:n;r>=f&&(r=0,i+=1)}else if(this.#e.autoFlow==="row")d+=1,d>=this.#e.columns&&(d=0,c+=1);else{for(c+=1;c+l>e.length;)e.push(Array.from({length:this.#e.columns}).fill(void 0));const f=e.length>0?e.length:n;if(c>=f&&(c=0,d+=1,d>=this.#e.columns))break}}if(!h)if(console.warn(`@visulima/tabular: Could not find position for item: ${JSON.stringify(o)} after ${String(p)} attempts. Grid might be too small or layout impossible.`),this.#e.autoFlow==="row")i+=1,i>=this.#e.columns&&(i=0,r+=1);else{r+=1;const f=e.length>0?e.length:n;r>=f&&(r=0,i+=1)}if(p>=b)break}if(this.#e.rows===0)for(;e.length>0&&e.at(-1)?.every(s=>s===void 0);)e.pop()}canPlaceItem(e,r,i,n,s,o=!1){if(i+n>this.#e.columns)return!1;for(let a=r;a<r+s;a+=1)if(a<e.length){if(!e[a])return console.warn(`Grid layout unexpectedly missing row ${String(a)} during canPlaceItem check.`),!1;for(let l=i;l<i+n;l+=1)if(e[a]?.[l]!==void 0)return!1}else if(!o)return!1;return!0}computeWrappedContentWidth(e,r,i,n){let s=e;if(n){if(s>20){let o=0;for(const a of r){const l=a.split(Tt);for(const h of l)o=Math.max(o,Math.min(I(h),i))}s=Math.min(s,Math.max(o+4,12))}}else{let o=0;for(const a of r){const l=a.split(Tt);for(const h of l)o=Math.max(o,Math.min(I(h),i))}s=Math.min(s,Math.max(o+12,20))}return s}placeItem(e,r,i,n){const s=n.rowSpan??1,o=n.colSpan??1;for(let a=r;a<r+s;a+=1){for(;a>=e.length;)e.push(Array.from({length:this.#e.columns}).fill(void 0));for(let l=i;l<i+o;l+=1)l<this.#e.columns&&(e[a]||(console.error(`Logic error: Row ${String(a)} not found in placeItem despite check.`),e[a]=Array.from({length:this.#e.columns}).fill(void 0)),e[a][l]=n)}}calculateTotalGridWidth(e){let r=0;const i=this.#e.showBorders?this.#e.border:void 0;i&&(r+=i.bodyLeft.width,r+=i.bodyRight.width);const n=e.length,s=this.#e.showBorders?i?.bodyJoin.width??0:0,o=this.#e.gap;for(let a=0;a<n;a+=1)r+=e[a]??0,a<n-1&&(r+=o,r+=s);return r}adjustColumnWidthsForTerminal(e,r){const i=typeof this.#e.maxWidth=="number"&&this.#e.maxWidth>0?Math.min(this.#e.maxWidth??0,this.#t):this.#t;if(r<=i)return e;let n=0;const s=e.length,o=this.#e.showBorders?this.#e.border:void 0;if(o&&(n+=o.bodyLeft.width,n+=o.bodyRight.width),s>1){n+=(s-1)*this.#e.gap;const d=o?.bodyJoin.width??0;n+=(s-1)*d}if(n>=i)return Array.from({length:s}).fill(1);const a=i-n,l=e.reduce((d,p)=>d+p,0);if(l===0){const d=Math.floor(a/s);return Array.from({length:s}).fill(d)}const h=e.map(d=>{const p=d/l;return Math.max(1,Math.floor(a*p))});let c=a-h.reduce((d,p)=>d+p,0);if(c>0){const d=h.map((p,b)=>{const f=l>0?(e[b]??0)/l:1/s;return{index:b,remainder:a*f%1}}).toSorted((p,b)=>b.remainder-p.remainder);for(const p of d){if(c<=0)break;const{index:b}=p;h[b]!==void 0&&(h[b]+=1,c-=1)}}return h}calculateBalancedColumnWidths(e){const r=this.calculateMinimumColumnWidthsWithGrowableInfo(e),i=r.widths,{growableColumns:n}=r,s=typeof this.#e.maxWidth=="number"&&this.#e.maxWidth>0?Math.min(this.#e.maxWidth,this.#t):this.#t,o=this.#e.showBorders?this.#e.border:void 0;let a=0;if(o&&(a+=o.bodyLeft.width,a+=o.bodyRight.width),this.#e.columns>1){a+=(this.#e.columns-1)*this.#e.gap;const c=o?.bodyJoin.width??0;a+=(this.#e.columns-1)*c}const l=Math.max(0,s-a);if(i.reduce((c,d)=>c+d,0)>0){const c=Math.floor(l/this.#e.columns),d=Array.from({length:this.#e.columns}).fill(c),p=c*this.#e.columns;let b=l-p;for(let u=0;u<d.length&&b>0;u+=1)d[u]=(d[u]??0)+1,b-=1;const f=[];let g=0;for(let u=0;u<this.#e.columns;u+=1){const x=d[u]??0,w=i[u]??0,v=Math.max(x,w);f.push(v),g+=v}if(g>l){const u=l/g,x=f.map($=>Math.max(3,Math.floor($*u))),w=x.reduce(($,W)=>$+W,0);let v=l-w;for(let $=0;$<x.length&&v>0;$+=1)x[$]=(x[$]??0)+1,v-=1;return x}let m=l-g;if(m>0){const u=n.length>0?n:f.map((x,w)=>w);for(;m>0&&u.length>0;)for(const x of u){if(m<=0)break;f[x]=(f[x]??0)+1,m-=1}}return f}const h=Math.floor(l/this.#e.columns);return Array.from({length:this.#e.columns}).fill(h)}calculateMinimumColumnWidthsWithGrowableInfo(e){const r=Array.from({length:this.#e.columns}).fill(0),i=[],n=this.#e.paddingLeft+this.#e.paddingRight,s=this.#e.gap+(this.#e.showBorders?this.#e.border?.bodyJoin.width??0:0);for(let o=0;o<this.#e.columns;o+=1)for(let a=0;a<e.length;a+=1){const l=e[a]?.[o];if(!l||ne(e,a,o,l)!==a||o>0&&e[a]?.[o-1]===l)continue;const h=l.colSpan??1,c=l.maxWidth??Number.POSITIVE_INFINITY,d=String(l.content??"").split(ue),p=this.#e.wordWrap&&l.wordWrap!==!1;let b=0;for(const f of d)b=Math.max(b,Math.min(I(f),c));b=this.computeWrappedContentWidth(b,d,c,p),h===1&&(r[o]=Math.max(r[o]??0,b+n),p&&!i.includes(o)&&i.push(o))}for(let o=0;o<e.length;o+=1)for(let a=0;a<this.#e.columns;a+=1){const l=e[o]?.[a];if(!l||ne(e,o,a,l)!==o||a>0&&e[o]?.[a-1]===l)continue;const h=l.colSpan??1;if(h>1){const c=l.maxWidth??Number.POSITIVE_INFINITY,d=String(l.content??"").split(ue),p=this.#e.wordWrap&&l.wordWrap!==!1;let b=0;for(const u of d)b=Math.max(b,Math.min(I(u),c));b=this.computeWrappedContentWidth(b,d,c,p);const f=(h-1)*s,g=b+n+f;let m=0;for(let u=a;u<a+h;u+=1)m+=r[u]??0;if(g>m){const u=g-m,x=Math.ceil(u/h);for(let w=0;w<h&&a+w<this.#e.columns;w+=1)r[a+w]=Math.max(r[a+w]??0,x)}}}return{growableColumns:i,widths:r}}calculateColumnWidths(e){if(this.#e.fixedColumnWidths&&this.#e.fixedColumnWidths.length===this.#e.columns){const s=this.#e.fixedColumnWidths;if(!s.some(o=>o===void 0||!Number.isFinite(o)))return[...s];if(this.#e.balancedWidths){const o=Array.from({length:s.length}).fill(0),a=typeof this.#e.maxWidth=="number"&&this.#e.maxWidth>0?Math.min(this.#e.maxWidth,this.#t):this.#t,l=this.calculateTotalGridWidth(Array.from({length:o.length}).fill(0)),h=Math.max(0,a-l);let c=0;const d=[];for(const[f,g]of s.entries())typeof g=="number"&&Number.isFinite(g)?(o[f]=g,c+=g):d.push(f);let p=Math.max(0,h-c);const b=d.length>0?Math.floor(p/d.length):0;for(const f of d)o[f]=b;p-=b*d.length;for(const f of d){if(p<=0)break;o[f]+=1,p-=1}return o}}if(this.#e.balancedWidths)return this.calculateBalancedColumnWidths(e);const r=Array.from({length:this.#e.columns}).fill(0),i=this.#e.paddingLeft+this.#e.paddingRight,n=this.#e.gap+(this.#e.showBorders?this.#e.border?.bodyJoin.width??0:0);for(let s=0;s<this.#e.columns;s+=1)for(let o=0;o<e.length;o+=1){const a=e[o]?.[s];if(!a||ne(e,o,s,a)!==o||s>0&&e[o]?.[s-1]===a)continue;const l=a.colSpan??1,h=a.maxWidth??Number.POSITIVE_INFINITY,c=String(a.content??"").split(ue);let d=0;for(const p of c)d=Math.max(d,Math.min(I(p),h));l===1&&(r[s]=Math.max(r[s]??0,d+i))}for(let s=0;s<e.length;s+=1)for(let o=0;o<this.#e.columns;o+=1){const a=e[s]?.[o];if(!a||ne(e,s,o,a)!==s||o>0&&e[s]?.[o-1]===a)continue;const l=a.colSpan??1;if(l>1){const h=a.maxWidth??Number.POSITIVE_INFINITY,c=String(a.content??"").split(ue),d=this.#e.wordWrap&&a.wordWrap!==!1;let p=0;for(const u of c)p=Math.max(p,Math.min(I(u),h));p=this.computeWrappedContentWidth(p,c,h,d);let b=0;for(let u=o;u<o+l;u+=1)b+=r[u]??0;const f=l>1?(l-1)*n:0,g=p+i+f,m=b+f;if(g>m){const u=g-m,x=Math.floor(u/l);let w=0;for(let v=0;v<l&&o+v<this.#e.columns;v+=1){const $=Math.min(x,u-w);if(r[o+v]=(r[o+v]??0)+$,w+=$,w>=u)break}}}}if(this.#e.maxWidth){const s=this.calculateTotalGridWidth(r);if(s>this.#e.maxWidth)return this.adjustColumnWidthsForTerminal(r,s)}return r}renderVisualRowContent(e,r,i,n,s){const o=e[r];if(!o)return"";const a=this.#e.borderColor??this.#e.foregroundColor??void 0,l=[],h=this.#e.showBorders&&this.#e.border?Mi(this.#e.border):void 0,c=h&&h.left.width>0?h.left.char:"",d=h&&h.right.width>0?h.right.char:"",p=h&&h.join.width>0?h.join.char:"",b=" ".repeat(this.#e.gap);c&&l.push(B(B(c,a),this.#e.backgroundColor));let f=0;for(;f<this.#e.columns;){const g=o[f]??void 0;let m=1,u;if(g){const x=g.colSpan??1;m=x;const w=ne(e,r,f,g),v=Pe(n,f,x),$=this.alignCellContent(g,v),W=$.length,A=this.getCachedCellVerticalPosition(e,r,f,g);A.firstRow!==w&&console.warn(`Mismatch between findFirstOccurrenceRow (${String(w)}) and determineCellVerticalPosition (${String(A.firstRow)})`);const O=s.slice(w,A.lastRow+1).reduce((j,_)=>j+_,0),k=A.lastRow-A.firstRow+1;let F=i,L=0;for(let j=w;j<r;j+=1)j<s.length&&(F+=s[j]??1),j<A.lastRow&&(L+=1);F+=L;const z=g.vAlign??"top";let G;switch(z){case"bottom":{let j=i;for(let H=w;H<r;H+=1)j+=s[H]??1;const _=O-W;G=j>=_?j-_:-1;break}case"middle":{const j=Math.round((O-W)/2);let _=i;for(let H=w;H<r;H+=1)_+=s[H]??1;G=_>=j&&_<j+W?_-j:-1;break}case"top":{G=F;break}default:G=F}const Ze=G>=0&&G<W;if(u=" ".repeat(Math.max(0,v)),Ze){let j=!1;z==="middle"&&k%2===0&&G===0&&(j=!0),j||(u=$[G]??u)}g.colSpan&&g.colSpan>1&&(u+=b.repeat(g.colSpan)),g.foregroundColor?u=B(u,g.foregroundColor):this.#e.foregroundColor&&(u=B(u,this.#e.foregroundColor)),g.backgroundColor?u=B(u,g.backgroundColor):this.#e.backgroundColor&&(u=B(u,this.#e.backgroundColor))}else{const x=this.#e.paddingLeft+this.#e.paddingRight,w=Math.max(0,(n[f]??0)-x),v=" ".repeat(this.#e.paddingLeft+w+this.#e.paddingRight);u=B(B(i===0?v:" ".repeat(v.length),this.#e.foregroundColor),this.#e.backgroundColor)}l.push(u),f+m<this.#e.columns&&(l.push(b),this.#e.showBorders&&p&&l.push(B(B(p,a),this.#e.backgroundColor)),this.#e.gap>0&&l.push(b)),f+=m}return d&&l.push(B(B(d,a),this.#e.backgroundColor)),l.join("")}alignCellContent(e,r){const i=this.#o.get(e);if(i?.has(r))return i.get(r);const{paddingLeft:n,paddingRight:s}=this.#e,o=n+s,a=r-o;if(a<=0){const d=[" ".repeat(o+this.#e.gap)];return i?i.set(r,d):this.#o.set(e,new Map([[r,d]])),d}let l;const h=String(e.content??"");if(l=h.includes(`
8
+ `)},"wordWrap");var Ei=Object.defineProperty,Z=S((t,e)=>Ei(t,"name",{value:e,configurable:!0}),"n$3");const lr=80,hr=24,tt=Z((t,e,{shell:r,env:i}={})=>Mr(t,e,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:r,env:i}).trim(),"exec"),Re=Z((t,e)=>({columns:Number.parseInt(t,10),rows:Number.parseInt(e,10)}),"create"),cr=Z((t,e)=>{const{columns:r,rows:i}=Re(t,e);if(!(Number.isNaN(r)||Number.isNaN(i))&&!(r===lr&&i===hr))return{columns:r,rows:i}},"createIfNotDefault"),Ii=Z(()=>{if(X.platform!=="linux")return!0;try{const t=me.readFileSync("/proc/self/stat","utf8"),e=t.lastIndexOf(") ");if(e===-1)return!1;const r=t.slice(e+2).trim().split(/\s+/),i=Number.parseInt(r[2],10),n=Number.parseInt(r[5],10);return Number.isNaN(i)||Number.isNaN(n)||n<=0?!1:i===n}catch{return!1}},"isForegroundProcess");function qe(){const{env:t,stdout:e,stderr:r}=X;if(e?.columns&&e?.rows)return Re(e.columns,e.rows);if(r?.columns&&r?.rows)return Re(r.columns,r.rows);if(t.COLUMNS&&t.LINES)return Re(t.COLUMNS,t.LINES);const i={columns:lr,rows:hr};return X.platform==="win32"?et()??i:X.platform==="darwin"?Mt()??et()??i:Mt()??et()??ki()??i}C(qe,"Tt");V(qe,"de");S(qe,"O");Z(qe,"terminalSize");const Mt=Z(()=>{try{const t=X.platform==="darwin"?me.constants.O_EVTONLY|me.constants.O_NONBLOCK:me.constants.O_NONBLOCK,{columns:e,rows:r}=Tr.WriteStream(me.openSync("/dev/tty",t));return{columns:e,rows:r}}catch{}},"devTty"),et=Z(()=>{try{const t=tt("tput",["cols"],{env:{TERM:"dumb",...X.env}}),e=tt("tput",["lines"],{env:{TERM:"dumb",...X.env}});if(t&&e)return cr(t,e)}catch{}},"tput"),ki=Z(()=>{try{if(!Ii())return;const t=tt("resize",["-u"]).match(/\d+/g);if(t.length===2)return cr(t[0],t[1])}catch{}},"resize");var Ni=Object.defineProperty,dr=S((t,e)=>Ni(t,"name",{value:e,configurable:!0}),"e");const ie=dr((t,e)=>{switch(e){case"bottom":return{body:t.bottomBody,join:t.bottomJoin,left:t.bottomLeft,right:t.bottomRight};case"middle":return{body:t.joinBody,join:t.joinJoin,left:t.joinLeft,right:t.joinRight};case"top":return{body:t.topBody,join:t.topJoin,left:t.topLeft,right:t.topRight};default:throw new Error(`Invalid borderType: ${String(e)}`)}},"getHorizontalBorderChars"),Mi=dr(t=>({join:t.bodyJoin,left:t.bodyLeft,right:t.bodyRight}),"getVerticalBorderChars");var Ti=Object.defineProperty,Pi=S((t,e)=>Ti(t,"name",{value:e,configurable:!0}),"n$1");const Te=Pi((t,e,r)=>{let i=0;for(let n=0;n<r;n+=1)i+=t[e+n]??0;return r>1&&(i+=r-1),i},"calculateCellTotalWidth");var Fi=Object.defineProperty,Li=S((t,e)=>Fi(t,"name",{value:e,configurable:!0}),"a");const rt=Li((t,e,r,i)=>{let n=e;for(;n>0&&t[n-1]?.[r]===i;)n-=1;let s=e;for(;s<t.length-1&&t[s+1]?.[r]===i;)s+=1;let o;const a=s-n+1;if(a===1)o=!0;else switch(i.vAlign){case"bottom":{o=e===s;break}case"middle":{const l=n+Math.floor(a/2);o=e===l;break}case"top":{o=e===n;break}default:o=e===n}return{firstRow:n,lastRow:s,showContent:o}},"determineCellVerticalPosition");var _i=Object.defineProperty,Hi=S((t,e)=>_i(t,"name",{value:e,configurable:!0}),"F");const Gi=Hi((t,e,r,i,n)=>{if(t.length===0)return[];let s=t.length-1;for(let l=0;l<t.length;l+=1){const h=t[l];if(h){for(const[c,d]of h.entries())if(d&&n(t,l,c,d)===l){const p=rt(t,l,c,d);s=Math.max(s,p.lastRow)}}}const o=Array.from({length:s+1}).fill(1);for(let l=0;l<t.length;l+=1){const h=t[l];if(h)for(let c=0;c<r.columns;c+=1){const d=h[c];if(d&&n(t,l,c,d)===l&&(d.rowSpan??1)===1){const p=d.colSpan??1,b=Te(e,c,p),f=i(d,b).length;o[l]=Math.max(o[l]??1,f)}}}const a=Array.from({length:o.length}).fill(!1);if(r.fixedRowHeights)for(let l=0;l<o.length;l+=1){let h;r.fixedRowHeights[l]!==void 0?h=r.fixedRowHeights[l]:r.fixedRowHeights.length===1&&r.fixedRowHeights[0]!==void 0&&(h=r.fixedRowHeights[0]),h!==void 0&&(o[l]=Math.max(1,h),a[l]=!0)}for(let l=0;l<t.length;l+=1){const h=t[l];if(h)for(let c=0;c<r.columns;c+=1){const d=h[c];if(d&&n(t,l,c,d)===l&&(d.rowSpan??1)>1){const p=d.colSpan??1,b=Te(e,c,p),f=i(d,b).length-1,g=rt(t,l,c,d),{firstRow:m,lastRow:u}=g;let x=0,w=0;for(let $=m;$<=u&&$<o.length;$+=1)x+=o[$]??1,a[$]||(w+=1);const v=f-x;if(v>0)if(w>0){const $=Math.ceil(v/w);let W=0;for(let A=m;A<=u&&A<o.length;A+=1)if(!a[A]){const O=Math.min($,v-W);if(o[A]=(o[A]??1)+O,W+=O,W>=v)break}}else console.warn(`[calculateRowHeights] Content of spanning cell exceeds fixed height allocated. Cell: ${JSON.stringify(d.content)}, Required: ${String(f)}, Allocated: ${String(x)} (fixed).`)}}}return o},"calculateRowHeights");var Ji=Object.defineProperty,Vi=S((t,e)=>Ji(t,"name",{value:e,configurable:!0}),"i");const ne=Vi((t,e,r,i)=>{let n=e;for(;n>0&&t[n-1]?.[r]===i;)n-=1;return n},"findFirstOccurrenceRow");var qi=Object.defineProperty,zi=S((t,e)=>qi(t,"name",{value:e,configurable:!0}),"n");const it="__EMPTY__",Tt=zi(t=>{if(typeof t=="string")return{content:t};if(typeof t=="number"||typeof t=="bigint"||typeof t=="boolean")return{content:String(t)};if(t==null)return{content:it};if(typeof t=="object"&&"content"in t){let{content:e}=t;if(typeof e=="number"||typeof e=="bigint"||typeof e=="boolean")e=String(e);else if(e==null)e=it;else if(typeof e!="string")throw new TypeError(`Invalid item type in grid cell: expected string, number, null, undefined, or GridItem object, but received ${JSON.stringify(t)} (type: ${typeof t})`);return{...t,content:e}}throw new TypeError(`Invalid item type in grid cell: expected string, number, null, undefined, or GridItem object, but received ${JSON.stringify(t)} (type: ${typeof t})`)},"normalizeGridCell");var Ui=Object.defineProperty,Di=S((t,e)=>Ui(t,"name",{value:e,configurable:!0}),"p");const Yi=Di((t,e,r,i,n)=>{const s=I(t),o=" ".repeat(Math.max(0,i)),a=" ".repeat(Math.max(0,n));if(s===0)return o+" ".repeat(Math.max(0,e))+a;const l=Math.max(0,e-s);switch(r){case"center":{const h=Math.floor(l/2),c=l-h;return o+" ".repeat(h)+t+" ".repeat(c)+a}case"right":return o+" ".repeat(l)+t+a;default:return o+t+" ".repeat(l)+a}},"padAndAlignContent");var Ki=Object.defineProperty,yt=S((t,e)=>Ki(t,"name",{value:e,configurable:!0}),"H");const ue=/\r?\n/,Pt=/\s+/,B=yt((t,e)=>!t||!e?t:typeof e=="function"?e(t):e.open+t+e.close,"applyColor");class ze{static{C(this,"xt")}static{V(this,"Nt")}static{S(this,"Grid")}static{yt(this,"Grid")}#e;#n=[];#t;#o=new WeakMap;#r=new WeakMap;static createGridLayout(){return[]}constructor(e){const r={autoColumns:1,autoFlow:"row",autoRows:1,balancedWidths:!1,gap:0,paddingLeft:1,paddingRight:1,rows:0,showBorders:e.border!==void 0,truncate:!1,truncateOverflow:!0,wordWrap:!1};let i;Array.isArray(e.fixedRowHeights)?i=e.fixedRowHeights:typeof e.fixedRowHeights=="number"&&(i=[e.fixedRowHeights]),this.#e={...r,...e,columns:e.columns,fixedRowHeights:i,showBorders:e.border!==void 0||(e.showBorders??!1)};let{terminalWidth:n}=this.#e;if(n===void 0){const{columns:s}=qe();n=s}this.#t=n,this.#e.maxWidth&&(this.#e.maxWidth=Math.min(this.#e.maxWidth,this.#t))}addItem(e){return this.#n.push(Tt(e)),this}addItems(e){return this.#n.push(...e.map(r=>Tt(r))),this}setColumns(e){return this.#e.columns=e,this}setRows(e){return this.#e.rows=e,this}setBorder(e){return this.#e.border=e,this}setShowBorders(e){return this.#e.showBorders=e,this}setMaxWidth(e){return this.#e.maxWidth=e,this}toString(){const e=ze.createGridLayout();if(this.placeItems(e),e.length===0||e[0]?.length===0)return"";let r=this.calculateColumnWidths(e);const i=this.calculateTotalGridWidth(r),n=typeof this.#e.maxWidth=="number"&&this.#e.maxWidth>0?Math.min(this.#e.maxWidth,this.#t):this.#t;return i>n&&(r=this.adjustColumnWidthsForTerminal(r,i)),this.renderGrid(e,r)}placeItems(e){let r=0,i=0;const n=this.#e.rows>0?this.#e.rows:Number.POSITIVE_INFINITY;for(let s=0;s<this.#n.length;s+=1){const o=this.#n[s];if(o.content===it&&!(o.rowSpan&&o.rowSpan>1)&&!(o.colSpan&&o.colSpan>1)){if(this.#e.autoFlow==="row")i+=1,i>=this.#e.columns&&(i=0,r+=1);else{r+=1;const f=e.length>0?e.length:n;r>=f&&f!==Number.POSITIVE_INFINITY?(r=0,i+=1):e.length===0&&f===Number.POSITIVE_INFINITY&&(i+=1)}continue}const a=o.colSpan??1,l=o.rowSpan??1;let h=!1,c=r,d=i,p=0;const b=(e.length+l+5)*this.#e.columns;for(;!h&&c<n&&p<b;){for(p+=1;c+l>e.length;)e.push(Array.from({length:this.#e.columns}).fill(void 0));if(this.canPlaceItem(e,c,d,a,l))if(this.placeItem(e,c,d,o),h=!0,this.#e.autoFlow==="row")i=d+a,r=c,i>=this.#e.columns&&(i=0,r+=1);else{r=c+l,i=d;const f=e.length>0?e.length:n;r>=f&&(r=0,i+=1)}else if(this.#e.autoFlow==="row")d+=1,d>=this.#e.columns&&(d=0,c+=1);else{for(c+=1;c+l>e.length;)e.push(Array.from({length:this.#e.columns}).fill(void 0));const f=e.length>0?e.length:n;if(c>=f&&(c=0,d+=1,d>=this.#e.columns))break}}if(!h)if(console.warn(`@visulima/tabular: Could not find position for item: ${JSON.stringify(o)} after ${String(p)} attempts. Grid might be too small or layout impossible.`),this.#e.autoFlow==="row")i+=1,i>=this.#e.columns&&(i=0,r+=1);else{r+=1;const f=e.length>0?e.length:n;r>=f&&(r=0,i+=1)}if(p>=b)break}if(this.#e.rows===0)for(;e.length>0&&e.at(-1)?.every(s=>s===void 0);)e.pop()}canPlaceItem(e,r,i,n,s,o=!1){if(i+n>this.#e.columns)return!1;for(let a=r;a<r+s;a+=1)if(a<e.length){if(!e[a])return console.warn(`Grid layout unexpectedly missing row ${String(a)} during canPlaceItem check.`),!1;for(let l=i;l<i+n;l+=1)if(e[a]?.[l]!==void 0)return!1}else if(!o)return!1;return!0}computeWrappedContentWidth(e,r,i,n){let s=e;if(n){if(s>20){let o=0;for(const a of r){const l=a.split(Pt);for(const h of l)o=Math.max(o,Math.min(I(h),i))}s=Math.min(s,Math.max(o+4,12))}}else{let o=0;for(const a of r){const l=a.split(Pt);for(const h of l)o=Math.max(o,Math.min(I(h),i))}s=Math.min(s,Math.max(o+12,20))}return s}placeItem(e,r,i,n){const s=n.rowSpan??1,o=n.colSpan??1;for(let a=r;a<r+s;a+=1){for(;a>=e.length;)e.push(Array.from({length:this.#e.columns}).fill(void 0));for(let l=i;l<i+o;l+=1)l<this.#e.columns&&(e[a]||(console.error(`Logic error: Row ${String(a)} not found in placeItem despite check.`),e[a]=Array.from({length:this.#e.columns}).fill(void 0)),e[a][l]=n)}}calculateTotalGridWidth(e){let r=0;const i=this.#e.showBorders?this.#e.border:void 0;i&&(r+=i.bodyLeft.width,r+=i.bodyRight.width);const n=e.length,s=this.#e.showBorders?i?.bodyJoin.width??0:0,o=this.#e.gap;for(let a=0;a<n;a+=1)r+=e[a]??0,a<n-1&&(r+=o,r+=s);return r}adjustColumnWidthsForTerminal(e,r){const i=typeof this.#e.maxWidth=="number"&&this.#e.maxWidth>0?Math.min(this.#e.maxWidth??0,this.#t):this.#t;if(r<=i)return e;let n=0;const s=e.length,o=this.#e.showBorders?this.#e.border:void 0;if(o&&(n+=o.bodyLeft.width,n+=o.bodyRight.width),s>1){n+=(s-1)*this.#e.gap;const d=o?.bodyJoin.width??0;n+=(s-1)*d}if(n>=i)return Array.from({length:s}).fill(1);const a=i-n,l=e.reduce((d,p)=>d+p,0);if(l===0){const d=Math.floor(a/s);return Array.from({length:s}).fill(d)}const h=e.map(d=>{const p=d/l;return Math.max(1,Math.floor(a*p))});let c=a-h.reduce((d,p)=>d+p,0);if(c>0){const d=h.map((p,b)=>{const f=l>0?(e[b]??0)/l:1/s;return{index:b,remainder:a*f%1}}).toSorted((p,b)=>b.remainder-p.remainder);for(const p of d){if(c<=0)break;const{index:b}=p;h[b]!==void 0&&(h[b]+=1,c-=1)}}return h}calculateBalancedColumnWidths(e){const r=this.calculateMinimumColumnWidthsWithGrowableInfo(e),i=r.widths,{growableColumns:n}=r,s=typeof this.#e.maxWidth=="number"&&this.#e.maxWidth>0?Math.min(this.#e.maxWidth,this.#t):this.#t,o=this.#e.showBorders?this.#e.border:void 0;let a=0;if(o&&(a+=o.bodyLeft.width,a+=o.bodyRight.width),this.#e.columns>1){a+=(this.#e.columns-1)*this.#e.gap;const c=o?.bodyJoin.width??0;a+=(this.#e.columns-1)*c}const l=Math.max(0,s-a);if(i.reduce((c,d)=>c+d,0)>0){const c=Math.floor(l/this.#e.columns),d=Array.from({length:this.#e.columns}).fill(c),p=c*this.#e.columns;let b=l-p;for(let u=0;u<d.length&&b>0;u+=1)d[u]=(d[u]??0)+1,b-=1;const f=[];let g=0;for(let u=0;u<this.#e.columns;u+=1){const x=d[u]??0,w=i[u]??0,v=Math.max(x,w);f.push(v),g+=v}if(g>l){const u=l/g,x=f.map($=>Math.max(3,Math.floor($*u))),w=x.reduce(($,W)=>$+W,0);let v=l-w;for(let $=0;$<x.length&&v>0;$+=1)x[$]=(x[$]??0)+1,v-=1;return x}let m=l-g;if(m>0){const u=n.length>0?n:f.map((x,w)=>w);for(;m>0&&u.length>0;)for(const x of u){if(m<=0)break;f[x]=(f[x]??0)+1,m-=1}}return f}const h=Math.floor(l/this.#e.columns);return Array.from({length:this.#e.columns}).fill(h)}calculateMinimumColumnWidthsWithGrowableInfo(e){const r=Array.from({length:this.#e.columns}).fill(0),i=[],n=this.#e.paddingLeft+this.#e.paddingRight,s=this.#e.gap+(this.#e.showBorders?this.#e.border?.bodyJoin.width??0:0);for(let o=0;o<this.#e.columns;o+=1)for(let a=0;a<e.length;a+=1){const l=e[a]?.[o];if(!l||ne(e,a,o,l)!==a||o>0&&e[a]?.[o-1]===l)continue;const h=l.colSpan??1,c=l.maxWidth??Number.POSITIVE_INFINITY,d=String(l.content??"").split(ue),p=this.#e.wordWrap&&l.wordWrap!==!1;let b=0;for(const f of d)b=Math.max(b,Math.min(I(f),c));b=this.computeWrappedContentWidth(b,d,c,p),h===1&&(r[o]=Math.max(r[o]??0,b+n),p&&!i.includes(o)&&i.push(o))}for(let o=0;o<e.length;o+=1)for(let a=0;a<this.#e.columns;a+=1){const l=e[o]?.[a];if(!l||ne(e,o,a,l)!==o||a>0&&e[o]?.[a-1]===l)continue;const h=l.colSpan??1;if(h>1){const c=l.maxWidth??Number.POSITIVE_INFINITY,d=String(l.content??"").split(ue),p=this.#e.wordWrap&&l.wordWrap!==!1;let b=0;for(const u of d)b=Math.max(b,Math.min(I(u),c));b=this.computeWrappedContentWidth(b,d,c,p);const f=(h-1)*s,g=b+n+f;let m=0;for(let u=a;u<a+h;u+=1)m+=r[u]??0;if(g>m){const u=g-m,x=Math.ceil(u/h);for(let w=0;w<h&&a+w<this.#e.columns;w+=1)r[a+w]=Math.max(r[a+w]??0,x)}}}return{growableColumns:i,widths:r}}calculateColumnWidths(e){if(this.#e.fixedColumnWidths&&this.#e.fixedColumnWidths.length===this.#e.columns){const s=this.#e.fixedColumnWidths;if(!s.some(o=>o===void 0||!Number.isFinite(o)))return[...s];if(this.#e.balancedWidths){const o=Array.from({length:s.length}).fill(0),a=typeof this.#e.maxWidth=="number"&&this.#e.maxWidth>0?Math.min(this.#e.maxWidth,this.#t):this.#t,l=this.calculateTotalGridWidth(Array.from({length:o.length}).fill(0)),h=Math.max(0,a-l);let c=0;const d=[];for(const[f,g]of s.entries())typeof g=="number"&&Number.isFinite(g)?(o[f]=g,c+=g):d.push(f);let p=Math.max(0,h-c);const b=d.length>0?Math.floor(p/d.length):0;for(const f of d)o[f]=b;p-=b*d.length;for(const f of d){if(p<=0)break;o[f]+=1,p-=1}return o}}if(this.#e.balancedWidths)return this.calculateBalancedColumnWidths(e);const r=Array.from({length:this.#e.columns}).fill(0),i=this.#e.paddingLeft+this.#e.paddingRight,n=this.#e.gap+(this.#e.showBorders?this.#e.border?.bodyJoin.width??0:0);for(let s=0;s<this.#e.columns;s+=1)for(let o=0;o<e.length;o+=1){const a=e[o]?.[s];if(!a||ne(e,o,s,a)!==o||s>0&&e[o]?.[s-1]===a)continue;const l=a.colSpan??1,h=a.maxWidth??Number.POSITIVE_INFINITY,c=String(a.content??"").split(ue);let d=0;for(const p of c)d=Math.max(d,Math.min(I(p),h));l===1&&(r[s]=Math.max(r[s]??0,d+i))}for(let s=0;s<e.length;s+=1)for(let o=0;o<this.#e.columns;o+=1){const a=e[s]?.[o];if(!a||ne(e,s,o,a)!==s||o>0&&e[s]?.[o-1]===a)continue;const l=a.colSpan??1;if(l>1){const h=a.maxWidth??Number.POSITIVE_INFINITY,c=String(a.content??"").split(ue),d=this.#e.wordWrap&&a.wordWrap!==!1;let p=0;for(const u of c)p=Math.max(p,Math.min(I(u),h));p=this.computeWrappedContentWidth(p,c,h,d);let b=0;for(let u=o;u<o+l;u+=1)b+=r[u]??0;const f=l>1?(l-1)*n:0,g=p+i+f,m=b+f;if(g>m){const u=g-m,x=Math.floor(u/l);let w=0;for(let v=0;v<l&&o+v<this.#e.columns;v+=1){const $=Math.min(x,u-w);if(r[o+v]=(r[o+v]??0)+$,w+=$,w>=u)break}}}}if(this.#e.maxWidth){const s=this.calculateTotalGridWidth(r);if(s>this.#e.maxWidth)return this.adjustColumnWidthsForTerminal(r,s)}return r}renderVisualRowContent(e,r,i,n,s){const o=e[r];if(!o)return"";const a=this.#e.borderColor??this.#e.foregroundColor??void 0,l=[],h=this.#e.showBorders&&this.#e.border?Mi(this.#e.border):void 0,c=h&&h.left.width>0?h.left.char:"",d=h&&h.right.width>0?h.right.char:"",p=h&&h.join.width>0?h.join.char:"",b=" ".repeat(this.#e.gap);c&&l.push(B(B(c,a),this.#e.backgroundColor));let f=0;for(;f<this.#e.columns;){const g=o[f]??void 0;let m=1,u;if(g){const x=g.colSpan??1;m=x;const w=ne(e,r,f,g),v=Te(n,f,x),$=this.alignCellContent(g,v),W=$.length,A=this.getCachedCellVerticalPosition(e,r,f,g);A.firstRow!==w&&console.warn(`Mismatch between findFirstOccurrenceRow (${String(w)}) and determineCellVerticalPosition (${String(A.firstRow)})`);const O=s.slice(w,A.lastRow+1).reduce((j,_)=>j+_,0),k=A.lastRow-A.firstRow+1;let F=i,L=0;for(let j=w;j<r;j+=1)j<s.length&&(F+=s[j]??1),j<A.lastRow&&(L+=1);F+=L;const z=g.vAlign??"top";let G;switch(z){case"bottom":{let j=i;for(let H=w;H<r;H+=1)j+=s[H]??1;const _=O-W;G=j>=_?j-_:-1;break}case"middle":{const j=Math.round((O-W)/2);let _=i;for(let H=w;H<r;H+=1)_+=s[H]??1;G=_>=j&&_<j+W?_-j:-1;break}case"top":{G=F;break}default:G=F}const Ze=G>=0&&G<W;if(u=" ".repeat(Math.max(0,v)),Ze){let j=!1;z==="middle"&&k%2===0&&G===0&&(j=!0),j||(u=$[G]??u)}g.colSpan&&g.colSpan>1&&(u+=b.repeat(g.colSpan)),g.foregroundColor?u=B(u,g.foregroundColor):this.#e.foregroundColor&&(u=B(u,this.#e.foregroundColor)),g.backgroundColor?u=B(u,g.backgroundColor):this.#e.backgroundColor&&(u=B(u,this.#e.backgroundColor))}else{const x=this.#e.paddingLeft+this.#e.paddingRight,w=Math.max(0,(n[f]??0)-x),v=" ".repeat(this.#e.paddingLeft+w+this.#e.paddingRight);u=B(B(i===0?v:" ".repeat(v.length),this.#e.foregroundColor),this.#e.backgroundColor)}l.push(u),f+m<this.#e.columns&&(l.push(b),this.#e.showBorders&&p&&l.push(B(B(p,a),this.#e.backgroundColor)),this.#e.gap>0&&l.push(b)),f+=m}return d&&l.push(B(B(d,a),this.#e.backgroundColor)),l.join("")}alignCellContent(e,r){const i=this.#o.get(e);if(i?.has(r))return i.get(r);const{paddingLeft:n,paddingRight:s}=this.#e,o=n+s,a=r-o;if(a<=0){const d=[" ".repeat(o+this.#e.gap)];return i?i.set(r,d):this.#o.set(e,new Map([[r,d]])),d}let l;const h=String(e.content??"");if(l=h.includes(`
9
9
  `)||h.includes("\r")?h.split(ue):[h],this.#e.wordWrap&&e.wordWrap!==!1){const d=typeof this.#e.wordWrap=="object"?this.#e.wordWrap:{},p=typeof e.wordWrap=="object"?e.wordWrap:d;l=Ri(h,{...p,width:a}).split(`
10
- `)}if(this.#e.truncate&&e.truncate!==!1){const d=typeof this.#e.truncate=="object"?this.#e.truncate:{},p=typeof e.truncate=="object"?e.truncate:d;l=l.map(b=>It(b,a,p))}else this.#e.truncateOverflow&&(l=l.map(d=>I(d)>a?It(d,a,{}):d));const c=l.map(d=>Yi(d,a,e.hAlign??"left",n,s));return i?i.set(r,c):this.#o.set(e,new Map([[r,c]])),c}renderHorizontalBorder(e,r,i,n,s,o=-1){if(!this.#e.showBorders||!this.#e.border)return"";const a=this.#e.border,l=ie(a,s),h=l.body.char,c=l.body.width,d=a.bodyJoin.char;if(s!=="middle"&&c===0)return"";let p=l.left.char,b=l.right.char;if(s==="middle"&&o!==-1){const u=e[i]?.[0]??void 0,x=e[o]?.[0]??void 0;u&&x&&u===x&&(p=d);const w=this.#e.columns-1,v=e[i]?.[w]??void 0,$=e[o]?.[w]??void 0;v&&$&&v===$&&(b=d)}const f=[],g=" ".repeat(this.#e.gap);p&&f.push(B(B(p,this.#e.borderColor),this.#e.backgroundColor));let m;for(let u=0;u<this.#e.columns;u+=1){const x=e[i]?.[u]??void 0,w=s==="middle"&&o!==-1?e[o]?.[u]??void 0:void 0;let v,$=!1;if(x&&(u===0||e[i]?.[u-1]!==x)&&(v=x,$=!0),x&&!$)continue;if(!x){const O=n[u]??0;if(m=c>0?h.repeat(O):" ".repeat(O),f.push(B(B(m,this.#e.borderColor),this.#e.backgroundColor)),u<this.#e.columns-1){const k=this.determineJoinChar(s,e,i,o,u,u+1);f.push(g),k.width>0&&f.push(B(B(k.char,this.#e.borderColor),this.#e.backgroundColor))}continue}const W=v?.colSpan??1;if(s==="middle"&&s==="middle"&&w&&x===w&&v){const O=v.vAlign==="middle",{firstRow:k,lastRow:F}=this.getCachedCellVerticalPosition(e,i,u,v),L=F-k+1,z=L%2===0,G=k+Math.ceil(L/2)-1,Ze=Pe(n,u,W),j=this.alignCellContent(v,Ze),_=j.length;if(O&&z&&i===G)m=B(j[0]??"",this.#e.borderColor);else{let H=0;for(let re=k;re<=i;re+=1)H+=r[re]??1,re<i&&(H+=1);const Qe=H;if(Qe>=0&&Qe<_)m=B(j[Qe]??"",this.#e.foregroundColor);else{const re=n.slice(u,u+W).reduce((Wr,Br)=>Wr+Br,0)+(W-1)*(this.#e.gap+this.#e.border.bodyJoin.width);m=B(" ".repeat(re),this.#e.borderColor)}}f.push(B(m,this.#e.backgroundColor))}else{const O=[];for(let k=u;k<u+W;k+=1){const F=n[k]??0,L=c>0?h:" ";if(O.push(L.repeat(F+this.#e.gap)),k<u+W-1){const z=this.determineJoinChar(s,e,i,o,k,k+1);z.width>0&&O.push(z.char)}}m=O.join(""),f.push(B(B(m,this.#e.borderColor),this.#e.backgroundColor))}const A=u+W-1;if(A<this.#e.columns-1){const O=this.determineJoinChar(s,e,i,o,A,A+1);O.width>0&&f.push(B(B(O.char,this.#e.borderColor),this.#e.backgroundColor))}u+=W-1}return b&&f.push(B(B(b,this.#e.borderColor),this.#e.backgroundColor)),f.join("")}determineJoinChar(e,r,i,n,s,o=-1){if(!this.#e.showBorders||!this.#e.border)return{char:" ",width:this.#e.gap};const a=this.#e.border;if(e!=="middle"){const $=ie(a,e),W=r[i]?.[s]??void 0,A=o===-1?s+1:o,O=r[i]?.[A]??void 0,k=W!==void 0&&O!==void 0&&W===O?$.body:$.join,{char:F,width:L}=k;return{char:F,width:L>0?L:this.#e.gap}}if(n===-1||o===-1)return{char:" ",width:this.#e.gap};const l=a.bodyJoin,h=r[i]?.[s]??void 0,c=r[n]?.[s]??void 0,d=r[i]?.[o]??void 0,p=r[n]?.[o]??void 0,b=h!==void 0&&c!==void 0&&h===c,f=d!==void 0&&p!==void 0&&d===p,g=h!==void 0&&d!==void 0&&h===d,m=c!==void 0&&p!==void 0&&c===p;let u;const x=ie(a,"middle");b&&f?u=g?{char:" ",width:l.width}:l:b?u=a.joinLeft:f?u=a.joinRight:g&&m?u=x.body:g?u=a.topJoin:m?u=a.bottomJoin:u=a.joinJoin;const{char:w,width:v}=u;return{char:w,width:v>0?v:this.#e.gap}}renderGrid(e,r){if(e.length===0)return"";const i=[],n=Gi(e,r,this.#e,this.alignCellContent.bind(this),ne),s=this.#e.showBorders&&this.#e.border?ie(this.#e.border,"top"):void 0;s&&s.body.width>0&&i.push(this.renderHorizontalBorder(e,n,0,r,"top"));for(let a=0;a<e.length;a+=1){const l=n[a]??1;for(let c=0;c<l;c+=1)i.push(this.renderVisualRowContent(e,a,c,r,n));const h=this.#e.showBorders&&this.#e.border?ie(this.#e.border,"middle"):void 0;if(a<e.length-1&&h&&h.body.width>0){const c=e[a],d=e[a+1];let p=!1;if(c&&d)for(let b=0;b<this.#e.columns;b+=1){const f=c[b],g=d[b];if(f!==g){p=!0;break}}p&&i.push(this.renderHorizontalBorder(e,n,a,r,"middle",a+1))}}const o=this.#e.showBorders&&this.#e.border?ie(this.#e.border,"bottom"):void 0;return o&&o.body.width>0&&i.push(this.renderHorizontalBorder(e,n,e.length-1,r,"bottom")),i.join(`
11
- `)}getCachedCellVerticalPosition(e,r,i,n){const s=this.#r.get(n);if(s)return s;const o=rt(e,r,i,n);return this.#r.set(n,o),o}}yt(t=>new ze(t),"createGrid");const Zi={bodyJoin:{char:"│",width:1},bodyLeft:{char:"│",width:1},bodyRight:{char:"│",width:1},bottomBody:{char:"─",width:1},bottomJoin:{char:"┴",width:1},bottomLeft:{char:"└",width:1},bottomRight:{char:"┘",width:1},joinBody:{char:"─",width:1},joinJoin:{char:"┼",width:1},joinLeft:{char:"├",width:1},joinRight:{char:"┤",width:1},topBody:{char:"─",width:1},topJoin:{char:"┬",width:1},topLeft:{char:"┌",width:1},topRight:{char:"┐",width:1}},Ee={bodyJoin:{char:"",width:0},bodyLeft:{char:"",width:0},bodyRight:{char:"",width:0},bottomBody:{char:"",width:0},bottomJoin:{char:"",width:0},bottomLeft:{char:"",width:0},bottomRight:{char:"",width:0},joinBody:{char:"",width:0},joinJoin:{char:"",width:0},joinLeft:{char:"",width:0},joinRight:{char:"",width:0},topBody:{char:"",width:0},topJoin:{char:"",width:0},topLeft:{char:"",width:0},topRight:{char:"",width:0}};var Qi=Object.defineProperty,ur=C((t,e)=>Qi(t,"name",{value:e,configurable:!0}),"p$2"),Xi=Object.defineProperty,vt=ur((t,e)=>Xi(t,"name",{value:e,configurable:!0}),"g"),en=Object.defineProperty,tn=vt((t,e)=>en(t,"name",{value:e,configurable:!0}),"u");const rn=tn(t=>t.reduce((e,r)=>r===null?e+1:typeof r=="object"&&!Array.isArray(r)?(r.colSpan??=1,r.colSpan<=0?e+1:e+r.colSpan):e+1,0),"computeRowLogicalWidth");var nn=Object.defineProperty,fr=vt((t,e)=>nn(t,"name",{value:e,configurable:!0}),"b");let on=class{static{C(this,"H")}static{ur(this,"$")}static{vt(this,"Table")}static{fr(this,"Table")}#e;#n=[];#t=[];#o=[];#r=!0;#i=void 0;constructor(e={}){this.#e={...e,showFooter:e.showFooter??!0,showHeader:e.showHeader??!0,style:{border:Zi,paddingLeft:1,paddingRight:1,...e.style}}}setHeaders(e){return e.length>0&&!Array.isArray(e[0])?this.#t=[e]:this.#t=e.map(r=>Array.isArray(r)?r:[r]),this.#r=!0,this.#i=void 0,this}setFooter(e){return e.length>0&&!Array.isArray(e[0])?this.#o=[e]:this.#o=e.map(r=>Array.isArray(r)?r:[r]),this.#r=!0,this.#i=void 0,this}addRow(e){if(!Array.isArray(e))throw new TypeError("Row must be an array");return this.#n.push(e),this.#r=!0,this.#i=void 0,this}addRows(...e){for(const r of e)this.addRow(r);return this.#r=!0,this.#i=void 0,this}toString(){if(!this.#r&&this.#i!==void 0)return this.#i;const e=this.#e.showHeader?this.#t:[],r=this.#e.showFooter?this.#o:[],i=[...e,...this.#n,...r];if(i.length===0)return this.#i="",this.#r=!1,"";let n=0;for(const d of i){const p=d;Array.isArray(p)?n=Math.max(n,rn(p)):console.error("Unexpected non-array element found while calculating columns:",p)}if(n===0)return this.#i="",this.#r=!1,"";let s;Array.isArray(this.#e.columnWidths)?s=this.#e.columnWidths.length>=n?this.#e.columnWidths.slice(0,n):[...this.#e.columnWidths,...Array.from({length:n-this.#e.columnWidths.length}).fill(void 0)]:typeof this.#e.columnWidths=="number"&&(s=Array.from({length:n}).fill(this.#e.columnWidths));let o;const a=i.length;if(Array.isArray(this.#e.rowHeights)?o=this.#e.rowHeights:typeof this.#e.rowHeights=="number"&&(o=Array.from({length:a}).fill(this.#e.rowHeights)),s&&Array.isArray(s)){const d=[...s];for(const p of i){const b=p;for(const[f,g]of b.entries()){let m={};if(typeof g=="object"&&g!==null&&!Array.isArray(g)){const{content:u,href:x,...w}=g;m=w}m.width!==void 0?d[f]=m.width:m.maxWidth!==void 0&&d[f]!==void 0&&(d[f]=Math.min(d[f],m.maxWidth))}}s=d}const l={autoFlow:"row",backgroundColor:this.#e.style?.backgroundColor,balancedWidths:this.#e.balancedWidths??!1,border:this.#e.style?.border,borderColor:this.#e.style?.borderColor,columns:n,fixedColumnWidths:s,fixedRowHeights:o,foregroundColor:this.#e.style?.foregroundColor,gap:this.#e.gap??0,maxWidth:this.#e.maxWidth,paddingLeft:this.#e.style?.paddingLeft,paddingRight:this.#e.style?.paddingRight,terminalWidth:this.#e.terminalWidth,truncate:this.#e.truncate??(s?.every(d=>typeof d=="number")||this.#e.maxWidth!==void 0&&!this.#e.balancedWidths),truncateOverflow:this.#e.truncateOverflow??!0,wordWrap:this.#e.wordWrap??!1},h=new ze(l),c=[];for(const[d,p]of i.entries()){const b=p;if(!Array.isArray(b)){console.error("Skipping non-array row while creating GridItems:",b);continue}const f=this.#e.showHeader?this.#t.length:0,g=this.#n.length,m=this.#e.showHeader&&d<f,u=this.#e.showFooter&&d>=f+g,x=m&&b.length===1&&n>1,w=u&&b.length===1&&n>1;for(const v of b){let $=v,W={};if(typeof $=="object"&&$!==null&&!Array.isArray($)){const{content:F,href:L,...z}=$;$=L?`\x1B]8;;${L}\x1B\\${String(F)}\x1B]8;;\x1B\\`:F,W=z}x&&(W.colSpan=n),w&&(W.colSpan=n);const A=this.#e.transformTabToSpace&&typeof $=="string"?$.replaceAll(" "," ".repeat(this.#e.transformTabToSpace)):$,{maxWidth:O,width:k}=W;c.push({backgroundColor:W.backgroundColor,colSpan:W.colSpan,content:A,foregroundColor:W.foregroundColor,hAlign:W.hAlign,maxWidth:O,rowSpan:W.rowSpan,truncate:W.truncate??(O===void 0?void 0:!0),vAlign:W.vAlign,width:k,wordWrap:W.wordWrap})}}return h.addItems(c),this.#i=h.toString(),this.#r=!1,this.#i}};const Ie=fr(t=>new on(t),"createTable");var sn=Object.defineProperty,an=C((t,e)=>sn(t,"name",{value:e,configurable:!0}),"b$3"),ln=Object.defineProperty,hn=an((t,e)=>ln(t,"name",{value:e,configurable:!0}),"s"),cn=Object.defineProperty,dn=hn((t,e)=>cn(t,"name",{value:e,configurable:!0}),"a");const un=/([a-f\d]{3,6})/i,nt=dn(t=>{let[,e]=un.exec(t)??[];const r=e?e.length:0;if(r===3){const n=e.charAt(0),s=e.charAt(1),o=e.charAt(2);e=n+n+s+s+o+o}else if(r!==6)return[0,0,0];const i=Number.parseInt(e,16);return[i>>16&255,i>>8&255,i&255]},"convertHexToRgb");var fn=Object.defineProperty,pn=C((t,e)=>fn(t,"name",{value:e,configurable:!0}),"o$1"),mn=Object.defineProperty,gn=pn((t,e)=>mn(t,"name",{value:e,configurable:!0}),"s"),bn=Object.defineProperty,xt=gn((t,e)=>bn(t,"name",{value:e,configurable:!0}),"e");const pr=xt((t,e,r)=>t===e&&e===r?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/51)+6*Math.round(e/51)+Math.round(r/51),"rgbToAnsi256"),ot=xt(t=>{let e,r,i;if(t<8)return 30+t;if(t<16)return 90+(t-8);if(t>=232)e=r=i=((t-232)*10+8)/255;else{t-=16;const o=t%36;e=Math.floor(t/36)/5,r=Math.floor(o/6)/5,i=o%6/5}const n=Math.max(e,r,i)*2;if(n===0)return 30;const s=30+(Math.round(i)<<2|Math.round(r)<<1|Math.round(e));return n===2?s+60:s},"ansi256To16"),Ft=xt((t,e,r)=>ot(pr(t,e,r)),"rgbToAnsi16");var wn=Object.defineProperty,mr=C((t,e)=>wn(t,"name",{value:e,configurable:!0}),"m$1"),yn=Object.defineProperty,ce=mr((t,e)=>yn(t,"name",{value:e,configurable:!0}),"u"),vn=Object.defineProperty,xn=ce((t,e)=>vn(t,"name",{value:e,configurable:!0}),"e");function De({onlyFirst:t=!1}={}){const e="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(e,t?void 0:"g")}C(De,"$$2");mr(De,"j");ce(De,"t$1");xn(De,"ansiRegex");var $n=Object.defineProperty,Wn=ce((t,e)=>$n(t,"name",{value:e,configurable:!0}),"n$1");const U=Wn((t,e,r)=>e>t?e:Math.min(t,r),"clamp");var Bn=Object.defineProperty,P=ce((t,e)=>Bn(t,"name",{value:e,configurable:!0}),"b");const R=39,E=49,Lt=10,st=jr(),gr={close:"",open:""},y=st>0?(t,e)=>({close:`\x1B[${String(e)}m`,open:`\x1B[${String(t)}m`}):()=>gr,_t=P(t=>(e,r,i)=>t(pr(Number(e),Number(r),Number(i))),"createRgbFunction"),Ht=P(t=>e=>{const[r,i,n]=nt(e);return t(r,i,n)},"createHexFunction");let at=P(t=>y(`38;5;${String(t)}`,R),"createAnsi256"),lt=P(t=>y(`48;5;${String(t)}`,E),"createBgAnsi256"),Te=P((t,e,r)=>y(`38;2;${String(t)};${String(e)};${String(r)}`,R),"createRgb"),Fe=P((t,e,r)=>y(`48;2;${String(t)};${String(e)};${String(r)}`,E),"createBgRgb");st===1?(at=P(t=>y(ot(Number(t)),R),"createAnsi256"),lt=P(t=>y(ot(Number(t))+Lt,E),"createBgAnsi256"),Te=P((t,e,r)=>y(Ft(Number(t),Number(e),Number(r)),R),"createRgb"),Fe=P((t,e,r)=>y(Ft(Number(t),Number(e),Number(r))+Lt,E),"createBgRgb")):st===2&&(Te=_t(at),Fe=_t(lt));const Gt={bold:y(1,22),dim:y(2,22),hidden:y(8,28),inverse:y(7,27),italic:y(3,23),overline:y(53,55),reset:y(0,0),strike:y(9,29),strikethrough:y(9,29),underline:y(4,24),visible:gr},Jt={bgBlack:y(40,E),bgBlackBright:y(100,E),bgBlue:y(44,E),bgBlueBright:y(104,E),bgCyan:y(46,E),bgCyanBright:y(106,E),bgGray:y(100,E),bgGreen:y(42,E),bgGreenBright:y(102,E),bgGrey:y(100,E),bgMagenta:y(45,E),bgMagentaBright:y(105,E),bgRed:y(41,E),bgRedBright:y(101,E),bgWhite:y(47,E),bgWhiteBright:y(107,E),bgYellow:y(43,E),bgYellowBright:y(103,E),black:y(30,R),blackBright:y(90,R),blue:y(34,R),blueBright:y(94,R),cyan:y(36,R),cyanBright:y(96,R),gray:y(90,R),green:y(32,R),greenBright:y(92,R),grey:y(90,R),magenta:y(35,R),magentaBright:y(95,R),red:y(31,R),redBright:y(91,R),white:y(37,R),whiteBright:y(97,R),yellow:y(33,R),yellowBright:y(93,R)},Vt={bg:P(t=>lt(U(t,0,255)),"bg"),bgHex:Ht(Fe),bgRgb:P((t,e,r)=>Fe(U(t,0,255),U(e,0,255),U(r,0,255)),"bgRgb"),fg:P(t=>at(U(t,0,255)),"fg"),hex:Ht(Te),rgb:P((t,e,r)=>Te(U(t,0,255),U(e,0,255),U(r,0,255)),"rgb")};var Sn=Object.defineProperty,An=ce((t,e)=>Sn(t,"name",{value:e,configurable:!0}),"s");const Cn=An((t,e,r)=>{if(e==="")return t;let i=t.indexOf(e);if(i<0)return t;const n=e.length;let s=0,o="";for(;~i;)o+=t.slice(s,i)+r,s=i+n,i=t.indexOf(e,s);return o+t.slice(s)},"stringReplaceAll");var On=Object.defineProperty,ge=ce((t,e)=>On(t,"name",{value:e,configurable:!0}),"a");const Y={};let ht=null;const jn=ge((t,e,r)=>{if(!t)return"";let i=t.raw===void 0?String(t):String.raw(t,...e);if(i.includes("\x1B"))for(let n=r;n;n=n.props)i=Cn(i,n.close,n.open);return i.includes(`
12
- `)&&(i=i.replace(/(\r*\n)/g,`${r.closeStack}$1${r.openStack}`)),r.openStack+i+r.closeStack},"wrapText"),ct=ge(({props:t},{close:e,open:r})=>{const i=(t?.openStack??"")+r,n=e+(t?.closeStack??""),s=ge((o,...a)=>jn(o,a,s.props),"style");return Object.setPrototypeOf(s,ht),s.props={close:e,closeStack:n,open:r,openStack:i,props:t},s.open=i,s.close=n,s},"createStyle"),Rn=ge(function(){const t=ge(e=>String(e),"self");t.strip=e=>e.replaceAll(De(),"");for(const e in Jt)Y[e]={get(){const r=ct(this,Jt[e]);return Object.defineProperty(this,e,{value:r}),r}};for(const e in Gt)Y[e]={get(){const r=ct(this,Gt[e]);return Object.defineProperty(this,e,{value:r}),r}};return ht=Object.defineProperties({},Y),Object.setPrototypeOf(t,ht),t},"Colorize");for(const t in Vt)Y[t]={get(){return(...e)=>ct(this,Vt[t](...e))}};Y.ansi256=Y.fg;Y.bgAnsi256=Y.bg;var En=Object.defineProperty,In=C((t,e)=>En(t,"name",{value:e,configurable:!0}),"g$1"),kn=Object.defineProperty,Ue=In((t,e)=>kn(t,"name",{value:e,configurable:!0}),"i"),Nn=Object.defineProperty,Mn=Ue((t,e)=>Nn(t,"name",{value:e,configurable:!0}),"n");const br=Mn(t=>(e,...r)=>{if(!Array.isArray(e)||!Array.isArray(e.raw))throw new TypeError("A tagged template literal must be provided");const i=[e.raw[0]];for(let n=1;n<e.raw.length;n+=1)i.push(String(r[n-1]).replaceAll(/[{}\\]/g,String.raw`\$&`),String(e.raw[n]));return t(i.join(""))},"makeColorizeTemplate");var Pn=Object.defineProperty,Tn=Ue((t,e)=>Pn(t,"name",{value:e,configurable:!0}),"e$1");const Fn=new Map([["0","\0"],["\\","\\"],["a","\x07"],["b","\b"],["e","\x1B"],["f","\f"],["n",`
13
- `],["r","\r"],["t"," "],["v","\v"]]),wr=Tn(t=>{const e=t.startsWith("u"),r=t[1]==="{";return e&&!r&&t.length===5||t.startsWith("x")&&t.length===3?String.fromCodePoint(Number.parseInt(t.slice(1),16)):e&&r?String.fromCodePoint(Number.parseInt(t.slice(2,-1),16)):Fn.get(t)??t},"unescape");var Ln=Object.defineProperty,Ye=Ue((t,e)=>Ln(t,"name",{value:e,configurable:!0}),"u");const _n=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|\{(~)?(#?[\w:]+(?:\([^)]*\))?(?:\.#?[\w:]+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n))|(\})|((?:.|[\r\n\f])+?)/gi,qt=/(?:^|\.)(?:(\w+)(?:\(([^)]*)\))?|#(?=[:a-f\d]{2,})([a-f\d]{6})?(?::([a-f\d]{6}))?)/gi,Hn=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,Gn=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi,Jn=/\s*,\s*/,Vn=Ye((t,e)=>{const r=[],i=e.trim().split(Jn);let n;for(const s of i){const o=Number(s);if(!Number.isNaN(o))r.push(o);else if(n=Hn.exec(s))r.push(n[2].replaceAll(Gn,(a,l,h)=>l?wr(l):h));else throw new Error(`Invalid template style argument: ${s} (in style '${t}')`)}return r},"parseArguments"),qn=Ye(t=>{qt.lastIndex=0;const e=[];let r;for(;(r=qt.exec(t))!==null;){const i=r[1];r[2]?e.push([i,...Vn(i,r[2])]):r[3]||r[4]?(r[3]&&e.push(["rgb",...nt(r[3])]),r[4]&&e.push(["bgRgb",...nt(r[4])])):e.push([i])}return e},"parseStyle"),zt=Ye((t,e)=>{const r={};for(const n of e)for(const s of n.styles)r[s[0]]=n.inverse?void 0:s.slice(1);let i=t;for(const[n,s]of Object.entries(r))if(Array.isArray(s)){if(!(n in i))throw new Error(`Unknown style: ${n}`);i=s.length>0?i[n](...s):i[n]}return i},"buildStyle"),yr=Ye(t=>e=>{const r=[],i=[];let n=[];if(e.replaceAll(_n,(s,o,a,l,h,c)=>{if(o)n.push(wr(o));else if(l){const d=n.join("");n=[],i.push(r.length===0?d:zt(t,r)(d)),r.push({inverse:a,styles:qn(l)})}else if(h){if(r.length===0)throw new Error("Found extraneous } in template literal");i.push(zt(t,r)(n.join(""))),n=[],r.pop()}else n.push(c)}),i.push(n.join("")),r.length>0)throw new Error(`template literal is missing ${String(r.length)} closing bracket${r.length===1?"":"s"} (\`}\`)`);return i.join("")},"makeTemplate");var zn=Object.defineProperty,Dn=Ue((t,e)=>zn(t,"name",{value:e,configurable:!0}),"e");const Un=new Rn;Dn(t=>br(yr(t)),"makeTaggedTemplate");const Yn=yr(Un),Kn=br(Yn);var Zn=Object.defineProperty,Ke=C((t,e)=>Zn(t,"name",{value:e,configurable:!0}),"c"),Qn=Object.defineProperty,q=Ke((t,e)=>Qn(t,"name",{value:e,configurable:!0}),"s");const Xn=Kt(import.meta.url),fe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,eo=q(t=>{if(typeof fe<"u"&&fe.versions&&fe.versions.node){const[e,r]=fe.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return fe.getBuiltinModule(t)}return Xn(t)},"__cjs_getBuiltinModule"),to=eo("node:os");var ro=Object.defineProperty,io=q((t,e)=>ro(t,"name",{value:e,configurable:!0}),"s");const pe=new Map,no=500,N=io(t=>{if(!t||t==="")return"";const e=pe.get(t);if(e!==void 0)return e;const r=Kn(Object.assign([],{raw:[t]}));if(pe.size>=no){const i=pe.keys().next().value;i!==void 0&&pe.delete(i)}return pe.set(t,r),r},"templateFormat");var oo=Object.defineProperty,so=q((t,e)=>oo(t,"name",{value:e,configurable:!0}),"t$1");const ke=so(()=>{const t=Er().CEREBRO_TERMINAL_WIDTH;if(t===void 0)return;const e=Number.parseInt(t,10);if(!(Number.isNaN(e)||e<=0))return e},"getTerminalWidth");var ao=Object.defineProperty,lo=q((t,e)=>ao(t,"name",{value:e,configurable:!0}),"t");class vr{static{C(this,"m")}static{Ke(this,"y")}static{q(this,"n")}static{lo(this,"BaseSection")}lines;constructor(){this.lines=[]}add(e){this.lines.push(e)}toString(){return this.lines.join(to.EOL)}header(e){this.add(Rr(e)),this.lines.push("")}}var ho=Object.defineProperty,co=q((t,e)=>ho(t,"name",{value:e,configurable:!0}),"f");class uo extends vr{static{C(this,"I")}static{Ke(this,"C")}static{q(this,"l")}static{co(this,"ContentSection")}constructor(e){if(super(),e.header&&this.header(N(e.header)),e.content){if(e.raw)if(Array.isArray(e.content)&&e.content.every(r=>typeof r=="string"))e.content.forEach(r=>{Array.isArray(r)?r.forEach(i=>{this.add(N(i))}):this.add(N(r))});else if(typeof e.content=="string")this.add(N(e.content));else throw new TypeError("Invalid raw content, must be a string or array of strings.");else this.add(this.getContentLines(e.content));this.add("")}}getContentLines(e){if(typeof e=="string"){const r=Ie({showHeader:!1,style:{border:Ee,paddingLeft:4,paddingRight:1},terminalWidth:ke(),truncateOverflow:!1,wordWrap:!0});return r.addRow([N(e)]),r.toString()}if(Array.isArray(e)&&e.every(r=>typeof r=="string"||Array.isArray(r)&&r.every(i=>typeof i=="string"))){const r=Ie({showHeader:!1,style:{border:Ee,paddingLeft:4,paddingRight:1},terminalWidth:ke(),truncateOverflow:!1,wordWrap:!0});return e.forEach(i=>{Array.isArray(i)?r.addRow(i.map(n=>N(n))):r.addRow([N(i)])}),r.toString()}if(typeof e=="object"){const r=e;if(!r.options||!r.data)throw new Error(`Must have an "options" or "data" property
10
+ `)}if(this.#e.truncate&&e.truncate!==!1){const d=typeof this.#e.truncate=="object"?this.#e.truncate:{},p=typeof e.truncate=="object"?e.truncate:d;l=l.map(b=>It(b,a,p))}else this.#e.truncateOverflow&&(l=l.map(d=>I(d)>a?It(d,a,{}):d));const c=l.map(d=>Yi(d,a,e.hAlign??"left",n,s));return i?i.set(r,c):this.#o.set(e,new Map([[r,c]])),c}renderHorizontalBorder(e,r,i,n,s,o=-1){if(!this.#e.showBorders||!this.#e.border)return"";const a=this.#e.border,l=ie(a,s),h=l.body.char,c=l.body.width,d=a.bodyJoin.char;if(s!=="middle"&&c===0)return"";let p=l.left.char,b=l.right.char;if(s==="middle"&&o!==-1){const u=e[i]?.[0]??void 0,x=e[o]?.[0]??void 0;u&&x&&u===x&&(p=d);const w=this.#e.columns-1,v=e[i]?.[w]??void 0,$=e[o]?.[w]??void 0;v&&$&&v===$&&(b=d)}const f=[],g=" ".repeat(this.#e.gap);p&&f.push(B(B(p,this.#e.borderColor),this.#e.backgroundColor));let m;for(let u=0;u<this.#e.columns;u+=1){const x=e[i]?.[u]??void 0,w=s==="middle"&&o!==-1?e[o]?.[u]??void 0:void 0;let v,$=!1;if(x&&(u===0||e[i]?.[u-1]!==x)&&(v=x,$=!0),x&&!$)continue;if(!x){const O=n[u]??0;if(m=c>0?h.repeat(O):" ".repeat(O),f.push(B(B(m,this.#e.borderColor),this.#e.backgroundColor)),u<this.#e.columns-1){const k=this.determineJoinChar(s,e,i,o,u,u+1);f.push(g),k.width>0&&f.push(B(B(k.char,this.#e.borderColor),this.#e.backgroundColor))}continue}const W=v?.colSpan??1;if(s==="middle"&&s==="middle"&&w&&x===w&&v){const O=v.vAlign==="middle",{firstRow:k,lastRow:F}=this.getCachedCellVerticalPosition(e,i,u,v),L=F-k+1,z=L%2===0,G=k+Math.ceil(L/2)-1,Ze=Te(n,u,W),j=this.alignCellContent(v,Ze),_=j.length;if(O&&z&&i===G)m=B(j[0]??"",this.#e.borderColor);else{let H=0;for(let re=k;re<=i;re+=1)H+=r[re]??1,re<i&&(H+=1);const Qe=H;if(Qe>=0&&Qe<_)m=B(j[Qe]??"",this.#e.foregroundColor);else{const re=n.slice(u,u+W).reduce((Wr,Br)=>Wr+Br,0)+(W-1)*(this.#e.gap+this.#e.border.bodyJoin.width);m=B(" ".repeat(re),this.#e.borderColor)}}f.push(B(m,this.#e.backgroundColor))}else{const O=[];for(let k=u;k<u+W;k+=1){const F=n[k]??0,L=c>0?h:" ";if(O.push(L.repeat(F+this.#e.gap)),k<u+W-1){const z=this.determineJoinChar(s,e,i,o,k,k+1);z.width>0&&O.push(z.char)}}m=O.join(""),f.push(B(B(m,this.#e.borderColor),this.#e.backgroundColor))}const A=u+W-1;if(A<this.#e.columns-1){const O=this.determineJoinChar(s,e,i,o,A,A+1);O.width>0&&f.push(B(B(O.char,this.#e.borderColor),this.#e.backgroundColor))}u+=W-1}return b&&f.push(B(B(b,this.#e.borderColor),this.#e.backgroundColor)),f.join("")}determineJoinChar(e,r,i,n,s,o=-1){if(!this.#e.showBorders||!this.#e.border)return{char:" ",width:this.#e.gap};const a=this.#e.border;if(e!=="middle"){const $=ie(a,e),W=r[i]?.[s]??void 0,A=o===-1?s+1:o,O=r[i]?.[A]??void 0,k=W!==void 0&&O!==void 0&&W===O?$.body:$.join,{char:F,width:L}=k;return{char:F,width:L>0?L:this.#e.gap}}if(n===-1||o===-1)return{char:" ",width:this.#e.gap};const l=a.bodyJoin,h=r[i]?.[s]??void 0,c=r[n]?.[s]??void 0,d=r[i]?.[o]??void 0,p=r[n]?.[o]??void 0,b=h!==void 0&&c!==void 0&&h===c,f=d!==void 0&&p!==void 0&&d===p,g=h!==void 0&&d!==void 0&&h===d,m=c!==void 0&&p!==void 0&&c===p;let u;const x=ie(a,"middle");b&&f?u=g?{char:" ",width:l.width}:l:b?u=a.joinLeft:f?u=a.joinRight:g&&m?u=x.body:g?u=a.topJoin:m?u=a.bottomJoin:u=a.joinJoin;const{char:w,width:v}=u;return{char:w,width:v>0?v:this.#e.gap}}renderGrid(e,r){if(e.length===0)return"";const i=[],n=Gi(e,r,this.#e,this.alignCellContent.bind(this),ne),s=this.#e.showBorders&&this.#e.border?ie(this.#e.border,"top"):void 0;s&&s.body.width>0&&i.push(this.renderHorizontalBorder(e,n,0,r,"top"));for(let a=0;a<e.length;a+=1){const l=n[a]??1;for(let c=0;c<l;c+=1)i.push(this.renderVisualRowContent(e,a,c,r,n));const h=this.#e.showBorders&&this.#e.border?ie(this.#e.border,"middle"):void 0;if(a<e.length-1&&h&&h.body.width>0){const c=e[a],d=e[a+1];let p=!1;if(c&&d)for(let b=0;b<this.#e.columns;b+=1){const f=c[b],g=d[b];if(f!==g){p=!0;break}}p&&i.push(this.renderHorizontalBorder(e,n,a,r,"middle",a+1))}}const o=this.#e.showBorders&&this.#e.border?ie(this.#e.border,"bottom"):void 0;return o&&o.body.width>0&&i.push(this.renderHorizontalBorder(e,n,e.length-1,r,"bottom")),i.join(`
11
+ `)}getCachedCellVerticalPosition(e,r,i,n){const s=this.#r.get(n);if(s)return s;const o=rt(e,r,i,n);return this.#r.set(n,o),o}}yt(t=>new ze(t),"createGrid");const Zi={bodyJoin:{char:"│",width:1},bodyLeft:{char:"│",width:1},bodyRight:{char:"│",width:1},bottomBody:{char:"─",width:1},bottomJoin:{char:"┴",width:1},bottomLeft:{char:"└",width:1},bottomRight:{char:"┘",width:1},joinBody:{char:"─",width:1},joinJoin:{char:"┼",width:1},joinLeft:{char:"├",width:1},joinRight:{char:"┤",width:1},topBody:{char:"─",width:1},topJoin:{char:"┬",width:1},topLeft:{char:"┌",width:1},topRight:{char:"┐",width:1}},Ee={bodyJoin:{char:"",width:0},bodyLeft:{char:"",width:0},bodyRight:{char:"",width:0},bottomBody:{char:"",width:0},bottomJoin:{char:"",width:0},bottomLeft:{char:"",width:0},bottomRight:{char:"",width:0},joinBody:{char:"",width:0},joinJoin:{char:"",width:0},joinLeft:{char:"",width:0},joinRight:{char:"",width:0},topBody:{char:"",width:0},topJoin:{char:"",width:0},topLeft:{char:"",width:0},topRight:{char:"",width:0}};var Qi=Object.defineProperty,ur=C((t,e)=>Qi(t,"name",{value:e,configurable:!0}),"p$2"),Xi=Object.defineProperty,vt=ur((t,e)=>Xi(t,"name",{value:e,configurable:!0}),"g"),en=Object.defineProperty,tn=vt((t,e)=>en(t,"name",{value:e,configurable:!0}),"u");const rn=tn(t=>t.reduce((e,r)=>r===null?e+1:typeof r=="object"&&!Array.isArray(r)?(r.colSpan??=1,r.colSpan<=0?e+1:e+r.colSpan):e+1,0),"computeRowLogicalWidth");var nn=Object.defineProperty,fr=vt((t,e)=>nn(t,"name",{value:e,configurable:!0}),"b");let on=class{static{C(this,"H")}static{ur(this,"$")}static{vt(this,"Table")}static{fr(this,"Table")}#e;#n=[];#t=[];#o=[];#r=!0;#i=void 0;constructor(e={}){this.#e={...e,showFooter:e.showFooter??!0,showHeader:e.showHeader??!0,style:{border:Zi,paddingLeft:1,paddingRight:1,...e.style}}}setHeaders(e){return e.length>0&&!Array.isArray(e[0])?this.#t=[e]:this.#t=e.map(r=>Array.isArray(r)?r:[r]),this.#r=!0,this.#i=void 0,this}setFooter(e){return e.length>0&&!Array.isArray(e[0])?this.#o=[e]:this.#o=e.map(r=>Array.isArray(r)?r:[r]),this.#r=!0,this.#i=void 0,this}addRow(e){if(!Array.isArray(e))throw new TypeError("Row must be an array");return this.#n.push(e),this.#r=!0,this.#i=void 0,this}addRows(...e){for(const r of e)this.addRow(r);return this.#r=!0,this.#i=void 0,this}toString(){if(!this.#r&&this.#i!==void 0)return this.#i;const e=this.#e.showHeader?this.#t:[],r=this.#e.showFooter?this.#o:[],i=[...e,...this.#n,...r];if(i.length===0)return this.#i="",this.#r=!1,"";let n=0;for(const d of i){const p=d;Array.isArray(p)?n=Math.max(n,rn(p)):console.error("Unexpected non-array element found while calculating columns:",p)}if(n===0)return this.#i="",this.#r=!1,"";let s;Array.isArray(this.#e.columnWidths)?s=this.#e.columnWidths.length>=n?this.#e.columnWidths.slice(0,n):[...this.#e.columnWidths,...Array.from({length:n-this.#e.columnWidths.length}).fill(void 0)]:typeof this.#e.columnWidths=="number"&&(s=Array.from({length:n}).fill(this.#e.columnWidths));let o;const a=i.length;if(Array.isArray(this.#e.rowHeights)?o=this.#e.rowHeights:typeof this.#e.rowHeights=="number"&&(o=Array.from({length:a}).fill(this.#e.rowHeights)),s&&Array.isArray(s)){const d=[...s];for(const p of i){const b=p;for(const[f,g]of b.entries()){let m={};if(typeof g=="object"&&g!==null&&!Array.isArray(g)){const{content:u,href:x,...w}=g;m=w}m.width!==void 0?d[f]=m.width:m.maxWidth!==void 0&&d[f]!==void 0&&(d[f]=Math.min(d[f],m.maxWidth))}}s=d}const l={autoFlow:"row",backgroundColor:this.#e.style?.backgroundColor,balancedWidths:this.#e.balancedWidths??!1,border:this.#e.style?.border,borderColor:this.#e.style?.borderColor,columns:n,fixedColumnWidths:s,fixedRowHeights:o,foregroundColor:this.#e.style?.foregroundColor,gap:this.#e.gap??0,maxWidth:this.#e.maxWidth,paddingLeft:this.#e.style?.paddingLeft,paddingRight:this.#e.style?.paddingRight,terminalWidth:this.#e.terminalWidth,truncate:this.#e.truncate??(s?.every(d=>typeof d=="number")||this.#e.maxWidth!==void 0&&!this.#e.balancedWidths),truncateOverflow:this.#e.truncateOverflow??!0,wordWrap:this.#e.wordWrap??!1},h=new ze(l),c=[];for(const[d,p]of i.entries()){const b=p;if(!Array.isArray(b)){console.error("Skipping non-array row while creating GridItems:",b);continue}const f=this.#e.showHeader?this.#t.length:0,g=this.#n.length,m=this.#e.showHeader&&d<f,u=this.#e.showFooter&&d>=f+g,x=m&&b.length===1&&n>1,w=u&&b.length===1&&n>1;for(const v of b){let $=v,W={};if(typeof $=="object"&&$!==null&&!Array.isArray($)){const{content:F,href:L,...z}=$;$=L?`\x1B]8;;${L}\x1B\\${String(F)}\x1B]8;;\x1B\\`:F,W=z}x&&(W.colSpan=n),w&&(W.colSpan=n);const A=this.#e.transformTabToSpace&&typeof $=="string"?$.replaceAll(" "," ".repeat(this.#e.transformTabToSpace)):$,{maxWidth:O,width:k}=W;c.push({backgroundColor:W.backgroundColor,colSpan:W.colSpan,content:A,foregroundColor:W.foregroundColor,hAlign:W.hAlign,maxWidth:O,rowSpan:W.rowSpan,truncate:W.truncate??(O===void 0?void 0:!0),vAlign:W.vAlign,width:k,wordWrap:W.wordWrap})}}return h.addItems(c),this.#i=h.toString(),this.#r=!1,this.#i}};const Ie=fr(t=>new on(t),"createTable");var sn=Object.defineProperty,an=C((t,e)=>sn(t,"name",{value:e,configurable:!0}),"b$3"),ln=Object.defineProperty,hn=an((t,e)=>ln(t,"name",{value:e,configurable:!0}),"s"),cn=Object.defineProperty,dn=hn((t,e)=>cn(t,"name",{value:e,configurable:!0}),"a");const un=/([a-f\d]{3,6})/i,nt=dn(t=>{let[,e]=un.exec(t)??[];const r=e?e.length:0;if(r===3){const n=e.charAt(0),s=e.charAt(1),o=e.charAt(2);e=n+n+s+s+o+o}else if(r!==6)return[0,0,0];const i=Number.parseInt(e,16);return[i>>16&255,i>>8&255,i&255]},"convertHexToRgb");var fn=Object.defineProperty,pn=C((t,e)=>fn(t,"name",{value:e,configurable:!0}),"o$1"),mn=Object.defineProperty,gn=pn((t,e)=>mn(t,"name",{value:e,configurable:!0}),"s"),bn=Object.defineProperty,xt=gn((t,e)=>bn(t,"name",{value:e,configurable:!0}),"e");const pr=xt((t,e,r)=>t===e&&e===r?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/51)+6*Math.round(e/51)+Math.round(r/51),"rgbToAnsi256"),ot=xt(t=>{let e,r,i;if(t<8)return 30+t;if(t<16)return 90+(t-8);if(t>=232)e=r=i=((t-232)*10+8)/255;else{t-=16;const o=t%36;e=Math.floor(t/36)/5,r=Math.floor(o/6)/5,i=o%6/5}const n=Math.max(e,r,i)*2;if(n===0)return 30;const s=30+(Math.round(i)<<2|Math.round(r)<<1|Math.round(e));return n===2?s+60:s},"ansi256To16"),Ft=xt((t,e,r)=>ot(pr(t,e,r)),"rgbToAnsi16");var wn=Object.defineProperty,mr=C((t,e)=>wn(t,"name",{value:e,configurable:!0}),"m$1"),yn=Object.defineProperty,ce=mr((t,e)=>yn(t,"name",{value:e,configurable:!0}),"u"),vn=Object.defineProperty,xn=ce((t,e)=>vn(t,"name",{value:e,configurable:!0}),"e");function Ue({onlyFirst:t=!1}={}){const e="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(e,t?void 0:"g")}C(Ue,"$$2");mr(Ue,"j");ce(Ue,"t$1");xn(Ue,"ansiRegex");var $n=Object.defineProperty,Wn=ce((t,e)=>$n(t,"name",{value:e,configurable:!0}),"n$1");const D=Wn((t,e,r)=>e>t?e:Math.min(t,r),"clamp");var Bn=Object.defineProperty,T=ce((t,e)=>Bn(t,"name",{value:e,configurable:!0}),"b");const R=39,E=49,Lt=10,st=jr(),gr={close:"",open:""},y=st>0?(t,e)=>({close:`\x1B[${String(e)}m`,open:`\x1B[${String(t)}m`}):()=>gr,_t=T(t=>(e,r,i)=>t(pr(Number(e),Number(r),Number(i))),"createRgbFunction"),Ht=T(t=>e=>{const[r,i,n]=nt(e);return t(r,i,n)},"createHexFunction");let at=T(t=>y(`38;5;${String(t)}`,R),"createAnsi256"),lt=T(t=>y(`48;5;${String(t)}`,E),"createBgAnsi256"),Pe=T((t,e,r)=>y(`38;2;${String(t)};${String(e)};${String(r)}`,R),"createRgb"),Fe=T((t,e,r)=>y(`48;2;${String(t)};${String(e)};${String(r)}`,E),"createBgRgb");st===1?(at=T(t=>y(ot(Number(t)),R),"createAnsi256"),lt=T(t=>y(ot(Number(t))+Lt,E),"createBgAnsi256"),Pe=T((t,e,r)=>y(Ft(Number(t),Number(e),Number(r)),R),"createRgb"),Fe=T((t,e,r)=>y(Ft(Number(t),Number(e),Number(r))+Lt,E),"createBgRgb")):st===2&&(Pe=_t(at),Fe=_t(lt));const Gt={bold:y(1,22),dim:y(2,22),hidden:y(8,28),inverse:y(7,27),italic:y(3,23),overline:y(53,55),reset:y(0,0),strike:y(9,29),strikethrough:y(9,29),underline:y(4,24),visible:gr},Jt={bgBlack:y(40,E),bgBlackBright:y(100,E),bgBlue:y(44,E),bgBlueBright:y(104,E),bgCyan:y(46,E),bgCyanBright:y(106,E),bgGray:y(100,E),bgGreen:y(42,E),bgGreenBright:y(102,E),bgGrey:y(100,E),bgMagenta:y(45,E),bgMagentaBright:y(105,E),bgRed:y(41,E),bgRedBright:y(101,E),bgWhite:y(47,E),bgWhiteBright:y(107,E),bgYellow:y(43,E),bgYellowBright:y(103,E),black:y(30,R),blackBright:y(90,R),blue:y(34,R),blueBright:y(94,R),cyan:y(36,R),cyanBright:y(96,R),gray:y(90,R),green:y(32,R),greenBright:y(92,R),grey:y(90,R),magenta:y(35,R),magentaBright:y(95,R),red:y(31,R),redBright:y(91,R),white:y(37,R),whiteBright:y(97,R),yellow:y(33,R),yellowBright:y(93,R)},Vt={bg:T(t=>lt(D(t,0,255)),"bg"),bgHex:Ht(Fe),bgRgb:T((t,e,r)=>Fe(D(t,0,255),D(e,0,255),D(r,0,255)),"bgRgb"),fg:T(t=>at(D(t,0,255)),"fg"),hex:Ht(Pe),rgb:T((t,e,r)=>Pe(D(t,0,255),D(e,0,255),D(r,0,255)),"rgb")};var Sn=Object.defineProperty,An=ce((t,e)=>Sn(t,"name",{value:e,configurable:!0}),"s");const Cn=An((t,e,r)=>{if(e==="")return t;let i=t.indexOf(e);if(i<0)return t;const n=e.length;let s=0,o="";for(;~i;)o+=t.slice(s,i)+r,s=i+n,i=t.indexOf(e,s);return o+t.slice(s)},"stringReplaceAll");var On=Object.defineProperty,ge=ce((t,e)=>On(t,"name",{value:e,configurable:!0}),"a");const Y={};let ht=null;const jn=ge((t,e,r)=>{if(!t)return"";let i=t.raw===void 0?String(t):String.raw(t,...e);if(i.includes("\x1B"))for(let n=r;n;n=n.props)i=Cn(i,n.close,n.open);return i.includes(`
12
+ `)&&(i=i.replace(/(\r*\n)/g,`${r.closeStack}$1${r.openStack}`)),r.openStack+i+r.closeStack},"wrapText"),ct=ge(({props:t},{close:e,open:r})=>{const i=(t?.openStack??"")+r,n=e+(t?.closeStack??""),s=ge((o,...a)=>jn(o,a,s.props),"style");return Object.setPrototypeOf(s,ht),s.props={close:e,closeStack:n,open:r,openStack:i,props:t},s.open=i,s.close=n,s},"createStyle"),Rn=ge(function(){const t=ge(e=>String(e),"self");t.strip=e=>e.replaceAll(Ue(),"");for(const e in Jt)Y[e]={get(){const r=ct(this,Jt[e]);return Object.defineProperty(this,e,{value:r}),r}};for(const e in Gt)Y[e]={get(){const r=ct(this,Gt[e]);return Object.defineProperty(this,e,{value:r}),r}};return ht=Object.defineProperties({},Y),Object.setPrototypeOf(t,ht),t},"Colorize");for(const t in Vt)Y[t]={get(){return(...e)=>ct(this,Vt[t](...e))}};Y.ansi256=Y.fg;Y.bgAnsi256=Y.bg;var En=Object.defineProperty,In=C((t,e)=>En(t,"name",{value:e,configurable:!0}),"g$1"),kn=Object.defineProperty,De=In((t,e)=>kn(t,"name",{value:e,configurable:!0}),"i"),Nn=Object.defineProperty,Mn=De((t,e)=>Nn(t,"name",{value:e,configurable:!0}),"n");const br=Mn(t=>(e,...r)=>{if(!Array.isArray(e)||!Array.isArray(e.raw))throw new TypeError("A tagged template literal must be provided");const i=[e.raw[0]];for(let n=1;n<e.raw.length;n+=1)i.push(String(r[n-1]).replaceAll(/[{}\\]/g,String.raw`\$&`),String(e.raw[n]));return t(i.join(""))},"makeColorizeTemplate");var Tn=Object.defineProperty,Pn=De((t,e)=>Tn(t,"name",{value:e,configurable:!0}),"e$1");const Fn=new Map([["0","\0"],["\\","\\"],["a","\x07"],["b","\b"],["e","\x1B"],["f","\f"],["n",`
13
+ `],["r","\r"],["t"," "],["v","\v"]]),wr=Pn(t=>{const e=t.startsWith("u"),r=t[1]==="{";return e&&!r&&t.length===5||t.startsWith("x")&&t.length===3?String.fromCodePoint(Number.parseInt(t.slice(1),16)):e&&r?String.fromCodePoint(Number.parseInt(t.slice(2,-1),16)):Fn.get(t)??t},"unescape");var Ln=Object.defineProperty,Ye=De((t,e)=>Ln(t,"name",{value:e,configurable:!0}),"u");const _n=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|\{(~)?(#?[\w:]+(?:\([^)]*\))?(?:\.#?[\w:]+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n))|(\})|((?:.|[\r\n\f])+?)/gi,qt=/(?:^|\.)(?:(\w+)(?:\(([^)]*)\))?|#(?=[:a-f\d]{2,})([a-f\d]{6})?(?::([a-f\d]{6}))?)/gi,Hn=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,Gn=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi,Jn=/\s*,\s*/,Vn=Ye((t,e)=>{const r=[],i=e.trim().split(Jn);let n;for(const s of i){const o=Number(s);if(!Number.isNaN(o))r.push(o);else if(n=Hn.exec(s))r.push(n[2].replaceAll(Gn,(a,l,h)=>l?wr(l):h));else throw new Error(`Invalid template style argument: ${s} (in style '${t}')`)}return r},"parseArguments"),qn=Ye(t=>{qt.lastIndex=0;const e=[];let r;for(;(r=qt.exec(t))!==null;){const i=r[1];r[2]?e.push([i,...Vn(i,r[2])]):r[3]||r[4]?(r[3]&&e.push(["rgb",...nt(r[3])]),r[4]&&e.push(["bgRgb",...nt(r[4])])):e.push([i])}return e},"parseStyle"),zt=Ye((t,e)=>{const r={};for(const n of e)for(const s of n.styles)r[s[0]]=n.inverse?void 0:s.slice(1);let i=t;for(const[n,s]of Object.entries(r))if(Array.isArray(s)){if(!(n in i))throw new Error(`Unknown style: ${n}`);i=s.length>0?i[n](...s):i[n]}return i},"buildStyle"),yr=Ye(t=>e=>{const r=[],i=[];let n=[];if(e.replaceAll(_n,(s,o,a,l,h,c)=>{if(o)n.push(wr(o));else if(l){const d=n.join("");n=[],i.push(r.length===0?d:zt(t,r)(d)),r.push({inverse:a,styles:qn(l)})}else if(h){if(r.length===0)throw new Error("Found extraneous } in template literal");i.push(zt(t,r)(n.join(""))),n=[],r.pop()}else n.push(c)}),i.push(n.join("")),r.length>0)throw new Error(`template literal is missing ${String(r.length)} closing bracket${r.length===1?"":"s"} (\`}\`)`);return i.join("")},"makeTemplate");var zn=Object.defineProperty,Un=De((t,e)=>zn(t,"name",{value:e,configurable:!0}),"e");const Dn=new Rn;Un(t=>br(yr(t)),"makeTaggedTemplate");const Yn=yr(Dn),Kn=br(Yn);var Zn=Object.defineProperty,Ke=C((t,e)=>Zn(t,"name",{value:e,configurable:!0}),"c"),Qn=Object.defineProperty,q=Ke((t,e)=>Qn(t,"name",{value:e,configurable:!0}),"s");const Xn=Kt(import.meta.url),fe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,eo=q(t=>{if(typeof fe<"u"&&fe.versions&&fe.versions.node){const[e,r]=fe.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return fe.getBuiltinModule(t)}return Xn(t)},"__cjs_getBuiltinModule"),to=eo("node:os");var ro=Object.defineProperty,io=q((t,e)=>ro(t,"name",{value:e,configurable:!0}),"s");const pe=new Map,no=500,N=io(t=>{if(!t||t==="")return"";const e=pe.get(t);if(e!==void 0)return e;const r=Kn(Object.assign([],{raw:[t]}));if(pe.size>=no){const i=pe.keys().next().value;i!==void 0&&pe.delete(i)}return pe.set(t,r),r},"templateFormat");var oo=Object.defineProperty,so=q((t,e)=>oo(t,"name",{value:e,configurable:!0}),"t$1");const ke=so(()=>{const t=Er().CEREBRO_TERMINAL_WIDTH;if(t===void 0)return;const e=Number.parseInt(t,10);if(!(Number.isNaN(e)||e<=0))return e},"getTerminalWidth");var ao=Object.defineProperty,lo=q((t,e)=>ao(t,"name",{value:e,configurable:!0}),"t");class vr{static{C(this,"m")}static{Ke(this,"y")}static{q(this,"n")}static{lo(this,"BaseSection")}lines;constructor(){this.lines=[]}add(e){this.lines.push(e)}toString(){return this.lines.join(to.EOL)}header(e){this.add(Rr(e)),this.lines.push("")}}var ho=Object.defineProperty,co=q((t,e)=>ho(t,"name",{value:e,configurable:!0}),"f");class uo extends vr{static{C(this,"I")}static{Ke(this,"C")}static{q(this,"l")}static{co(this,"ContentSection")}constructor(e){if(super(),e.header&&this.header(N(e.header)),e.content){if(e.raw)if(Array.isArray(e.content)&&e.content.every(r=>typeof r=="string"))e.content.forEach(r=>{Array.isArray(r)?r.forEach(i=>{this.add(N(i))}):this.add(N(r))});else if(typeof e.content=="string")this.add(N(e.content));else throw new TypeError("Invalid raw content, must be a string or array of strings.");else this.add(this.getContentLines(e.content));this.add("")}}getContentLines(e){if(typeof e=="string"){const r=Ie({showHeader:!1,style:{border:Ee,paddingLeft:4,paddingRight:1},terminalWidth:ke(),truncateOverflow:!1,wordWrap:!0});return r.addRow([N(e)]),r.toString()}if(Array.isArray(e)&&e.every(r=>typeof r=="string"||Array.isArray(r)&&r.every(i=>typeof i=="string"))){const r=Ie({showHeader:!1,style:{border:Ee,paddingLeft:4,paddingRight:1},terminalWidth:ke(),truncateOverflow:!1,wordWrap:!0});return e.forEach(i=>{Array.isArray(i)?r.addRow(i.map(n=>N(n))):r.addRow([N(i)])}),r.toString()}if(typeof e=="object"){const r=e;if(!r.options||!r.data)throw new Error(`Must have an "options" or "data" property
14
14
  ${JSON.stringify(e)}`);const i=Ie({showHeader:!1,style:{border:Ee,paddingLeft:4,paddingRight:1},terminalWidth:ke(),truncateOverflow:!1,wordWrap:!0});return r.data.forEach(n=>{Array.isArray(n)?i.addRow(n.map(s=>N(s))):i.addRow([N(n)])}),i.toString()}throw new Error(`invalid input - 'content' must be a string, array of strings or a object:
15
15
 
16
16
  ${JSON.stringify(e)}`)}}var fo=Object.defineProperty,po=q((t,e)=>fo(t,"name",{value:e,configurable:!0}),"m");class mo extends vr{static{C(this,"z")}static{Ke(this,"q")}static{q(this,"O")}static{po(this,"OptionListSection")}constructor(e){super();let r=e.optionList??[];const i=Array.isArray(e.hide)?e.hide:[e.hide].filter(o=>typeof o=="string"),n=Array.isArray(e.group)?e.group:[e.group].filter(o=>typeof o=="string");i.length>0&&(r=r.filter(o=>!i.includes(o.name))),e.header&&this.header(N(e.header)),n.length>0&&(r=r.filter(o=>{const a=o,l=n.includes("_none")&&!a.group,h=a.group,c=this.intersect(Array.isArray(h)?h:[h],n);return l||c?o:void 0}));const s=Ie({showHeader:!1,style:{border:Ee,paddingLeft:2,paddingRight:1,...e.tableOptions?.style},terminalWidth:ke()??e.tableOptions?.terminalWidth,truncateOverflow:!1,wordWrap:e.tableOptions?.wordWrap??!0,...e.tableOptions});r.forEach(o=>{const a=o;s.addRow([this.getOptionNames(a,e.reverseNameOrder??!1,e.isArgument??!1),N(a.description)])}),this.add(s.toString()),this.lines.push("")}getOptionNames(e,r,i){if(!e.name)throw new TypeError("Invalid option definition, name is required.");let n=e.type?e.type.name.toLowerCase():"string";const s=e.multiple||e.lazyMultiple?"[]":"";n=N(e.typeLabel??`{underline ${n}${s}}`);let o;if(e.alias)if(e.name){const a=i?e.name:`{yellow --${e.name}}`;o=N(r?`{bold ${a}}, {bold -${e.alias}} ${n}`:`{bold -${e.alias}}, {bold ${a}} ${n}`)}else r?o=N(`{bold -${e.alias}} ${n}`):o=N(`{bold -${e.alias}} ${n}`);else o=N(`{bold ${i?e.name:`{yellow --${e.name}}`}} ${n}`);return o}intersect(e,r){return e.some(i=>r.includes(i))}}var go=Object.defineProperty,bo=q((t,e)=>go(t,"name",{value:e,configurable:!0}),"o");const $t=bo(t=>(Array.isArray(t)?t:[t]).length===0?"":`
17
17
  ${t.map(e=>e.optionList?new mo(e).toString():new uo(e).toString()).join(`
18
- `)}`,"commandLineUsage");var wo=Object.defineProperty,xr=C((t,e)=>wo(t,"name",{value:e,configurable:!0}),"f"),yo=Object.defineProperty,$r=xr((t,e)=>yo(t,"name",{value:e,configurable:!0}),"f");const vo=[{defaultValue:"32",description:"Controls the verbosity level of output. Valid values: '16' (quiet), '32' (normal), '64' (verbose), '128' (debug)",name:"CEREBRO_OUTPUT_LEVEL",type:String},{description:"Sets the minimum required Node.js version. Overrides the default minimum version check",name:"CEREBRO_MIN_NODE_VERSION",type:Number},{defaultValue:!1,description:"When set, disables the update notifier check",name:"NO_UPDATE_NOTIFIER",type:Boolean},{description:"Standard Node.js environment variable. When set to 'test', disables update notifier",name:"NODE_ENV",type:String},{defaultValue:!1,description:"When set, enables debug output (same as --debug flag)",name:"DEBUG",type:Boolean},{description:"Sets the terminal width for table rendering. Useful for testing and consistent output",name:"CEREBRO_TERMINAL_WIDTH",type:Number}];var xo=Object.defineProperty,te=$r((t,e)=>xo(t,"name",{value:e,configurable:!0}),"h");const Dt="__Other",Ut=te(t=>t.charAt(0).toUpperCase()+t.slice(1),"upperFirstChar"),$o=te((t,e,r,i)=>{t.debug("no command given, printing general help...");let n=[...new Set(r.values())].filter(a=>!a.hidden);i&&(n=n.filter(a=>a.group===i));const s=n.reduce((a,l)=>{const h=l.group??Dt;return a[h]??=[],a[h].push(l),a},{}),o=te(a=>a.map(l=>{let h="";typeof l.alias=="string"?h=l.alias:Array.isArray(l.alias)&&(h=l.alias.join(", ")),h!==""&&(h=` [${h}]`);let c=l.name;return l.commandPath&&l.commandPath.length>0&&(c=`${l.commandPath.join(" ")} ${l.name}`),[`${J(c)}${h}`,l.description??""]}),"buildCommandList");(t.raw??t.log)($t([{content:`${se(e.getCliName())} ${J("<command>")} [positional arguments] ${Ne("[options]")}`,header:M.cyan(" Usage ")},...Object.keys(s).map(a=>{const l=i?` ${Ut(i)}`:"";return{content:o(s[a]),header:a===Dt||i?M.green(` Available${l} Commands `):` ${M.green(` ${Ut(a)} `)}`}}),r.has("help")?{header:M.yellow(" Command Options "),optionList:r.get("help").options?.filter(a=>!a.hidden)}:void 0,{header:M.yellow(" Global Options "),optionList:e.getGlobalOptions()},{content:vo.filter(a=>!a.hidden).map(a=>[a.name,a.description??""]),header:M.magenta(" Environment Variables ")},{content:`Run "${se(e.getCliName())} ${J("help <command>")}" or "${se(e.getCliName())} ${J("<command>")} ${Ne("--help")}" for help with a specific command.`,raw:!0}].filter(Boolean)))},"printGeneralHelp"),Yt=te((t,e)=>{const r=[];for(const i of t.values()){if(i.hidden)continue;const n=i.commandPath??[];if(n.length!==e.length)continue;let s=!0;for(const[o,a]of e.entries())if(n[o]!==a){s=!1;break}s&&r.push(i)}return r},"findChildren"),Wo=te((t,e,r,i)=>{const n=r.join(" "),s=[{content:`${se(e.getCliName())} ${J(n)} ${J("<subcommand>")} [positional arguments] ${Ne("[options]")}`,header:M.cyan(" Usage ")},{content:i.map(o=>{const a=[...o.commandPath??[],o.name].join(" ");return[J(a),o.description??""]}),header:M.green(" Subcommands ")},{header:M.yellow(" Global Options "),optionList:e.getGlobalOptions()},{content:`Run "${se(e.getCliName())} ${J(`${n} <subcommand>`)} ${Ne("--help")}" for help with a specific subcommand.`,raw:!0}];(t.raw??t.log)($t(s))},"printParentHelp"),Bo=te((t,e,r,i)=>{let n=r.get(i);if(!n)for(const h of r.values()){const c=h.commandPath?[...h.commandPath,h.name]:[h.name];if(c.at(-1)===i||c.join(" ")===i){n=h;break}}if(!n){const h=i.split(" ").filter(Boolean),c=h.length>0?Yt(r,h):[];if(c.length>0){Wo(t,e,h,c);return}t.error(`Command "${i}" not found`);return}const s=[],o=(n.commandPath?[...n.commandPath,n.name]:[n.name]).join(" ");if(s.push({content:`${se(e.getCliName())} ${J(o)}${n.argument?" [positional arguments]":""}${n.options?" [options]":""}`,header:M.cyan(" Usage ")}),n.description&&s.push({content:n.description,header:M.green(" Description ")}),n.argument&&s.push({header:"Command Positional Arguments",isArgument:!0,optionList:[n.argument]}),Array.isArray(n.options)&&n.options.length>0&&s.push({header:M.yellow(" Command Options "),optionList:n.options.filter(h=>!h.hidden)}),s.push({header:M.yellow(" Global Options "),optionList:e.getGlobalOptions()}),Array.isArray(n.env)&&n.env.length>0){const h=n.env.filter(c=>!c.hidden);h.length>0&&s.push({content:h.map(c=>[c.name,c.description??""]),header:M.magenta(" Environment Variables ")})}if(n.alias!==void 0&&n.alias.length>0){let h=n.alias;typeof n.alias=="string"&&(h=[n.alias]),s.splice(1,0,{content:h,header:"Alias(es)"})}Array.isArray(n.examples)&&n.examples.length>0&&s.push({content:n.examples,header:"Examples"});const a=[...n.commandPath??[],n.name],l=Yt(r,a);l.length>0&&s.push({content:l.map(h=>{const c=[...h.commandPath??[],h.name].join(" ");return[J(c),h.description??""]}),header:M.green(" Subcommands ")}),(t.raw??t.log)($t(s))},"printCommandHelp");class jo{static{C(this,"_")}static{xr(this,"S")}static{$r(this,"x")}static{te(this,"HelpCommand")}name="help";options=[{description:"Display only the specified group",name:"group",type:String}];commands;constructor(e){this.commands=e}execute(e){const{commandName:r,logger:i,options:n,runtime:s}=e,{footer:o,header:a}=s.getCommandSection();a&&(i.raw??i.log)(N(a)),r==="help"?$o(i,s,this.commands,typeof n?.group=="string"?n.group:void 0):Bo(i,s,this.commands,r),o&&(i.raw??i.log)(N(o))}}export{jo as default};
18
+ `)}`,"commandLineUsage");var wo=Object.defineProperty,xr=C((t,e)=>wo(t,"name",{value:e,configurable:!0}),"f"),yo=Object.defineProperty,$r=xr((t,e)=>yo(t,"name",{value:e,configurable:!0}),"f");const vo=[{defaultValue:"32",description:"Controls the verbosity level of output. Valid values: '16' (quiet), '32' (normal), '64' (verbose), '128' (debug)",name:"CEREBRO_OUTPUT_LEVEL",type:String},{description:"Sets the minimum required Node.js version. Overrides the default minimum version check",name:"CEREBRO_MIN_NODE_VERSION",type:Number},{defaultValue:!1,description:"When set, disables the update notifier check",name:"NO_UPDATE_NOTIFIER",type:Boolean},{description:"Standard Node.js environment variable. When set to 'test', disables update notifier",name:"NODE_ENV",type:String},{defaultValue:!1,description:"When set, enables debug output (same as --debug flag)",name:"DEBUG",type:Boolean},{description:"Sets the terminal width for table rendering. Useful for testing and consistent output",name:"CEREBRO_TERMINAL_WIDTH",type:Number}];var xo=Object.defineProperty,te=$r((t,e)=>xo(t,"name",{value:e,configurable:!0}),"h");const Ut="__Other",Dt=te(t=>t.charAt(0).toUpperCase()+t.slice(1),"upperFirstChar"),$o=te((t,e,r,i)=>{t.debug("no command given, printing general help...");let n=[...new Set(r.values())].filter(a=>!a.hidden);i&&(n=n.filter(a=>a.group===i));const s=n.reduce((a,l)=>{const h=l.group??Ut;return a[h]??=[],a[h].push(l),a},{}),o=te(a=>a.map(l=>{let h="";typeof l.alias=="string"?h=l.alias:Array.isArray(l.alias)&&(h=l.alias.join(", ")),h!==""&&(h=` [${h}]`);let c=l.name;return l.commandPath&&l.commandPath.length>0&&(c=`${l.commandPath.join(" ")} ${l.name}`),[`${J(c)}${h}`,l.description??""]}),"buildCommandList");(t.raw??t.log)($t([{content:`${se(e.getCliName())} ${J("<command>")} [positional arguments] ${Ne("[options]")}`,header:M.cyan(" Usage ")},...Object.keys(s).map(a=>{const l=i?` ${Dt(i)}`:"";return{content:o(s[a]),header:a===Ut||i?M.green(` Available${l} Commands `):` ${M.green(` ${Dt(a)} `)}`}}),r.has("help")?{header:M.yellow(" Command Options "),optionList:r.get("help").options?.filter(a=>!a.hidden)}:void 0,{header:M.yellow(" Global Options "),optionList:e.getGlobalOptions()},{content:vo.filter(a=>!a.hidden).map(a=>[a.name,a.description??""]),header:M.magenta(" Environment Variables ")},{content:`Run "${se(e.getCliName())} ${J("help <command>")}" or "${se(e.getCliName())} ${J("<command>")} ${Ne("--help")}" for help with a specific command.`,raw:!0}].filter(Boolean)))},"printGeneralHelp"),Yt=te((t,e)=>{const r=[];for(const i of t.values()){if(i.hidden)continue;const n=i.commandPath??[];if(n.length!==e.length)continue;let s=!0;for(const[o,a]of e.entries())if(n[o]!==a){s=!1;break}s&&r.push(i)}return r},"findChildren"),Wo=te((t,e,r,i)=>{const n=r.join(" "),s=[{content:`${se(e.getCliName())} ${J(n)} ${J("<subcommand>")} [positional arguments] ${Ne("[options]")}`,header:M.cyan(" Usage ")},{content:i.map(o=>{const a=[...o.commandPath??[],o.name].join(" ");return[J(a),o.description??""]}),header:M.green(" Subcommands ")},{header:M.yellow(" Global Options "),optionList:e.getGlobalOptions()},{content:`Run "${se(e.getCliName())} ${J(`${n} <subcommand>`)} ${Ne("--help")}" for help with a specific subcommand.`,raw:!0}];(t.raw??t.log)($t(s))},"printParentHelp"),Bo=te((t,e,r,i)=>{let n=r.get(i);if(!n)for(const h of r.values()){const c=h.commandPath?[...h.commandPath,h.name]:[h.name];if(c.at(-1)===i||c.join(" ")===i){n=h;break}}if(!n){const h=i.split(" ").filter(Boolean),c=h.length>0?Yt(r,h):[];if(c.length>0){Wo(t,e,h,c);return}t.error(`Command "${i}" not found`);return}const s=[],o=(n.commandPath?[...n.commandPath,n.name]:[n.name]).join(" ");if(s.push({content:`${se(e.getCliName())} ${J(o)}${n.argument?" [positional arguments]":""}${n.options?" [options]":""}`,header:M.cyan(" Usage ")}),n.description&&s.push({content:n.description,header:M.green(" Description ")}),n.argument&&s.push({header:"Command Positional Arguments",isArgument:!0,optionList:[n.argument]}),Array.isArray(n.options)&&n.options.length>0&&s.push({header:M.yellow(" Command Options "),optionList:n.options.filter(h=>!h.hidden)}),s.push({header:M.yellow(" Global Options "),optionList:e.getGlobalOptions()}),Array.isArray(n.env)&&n.env.length>0){const h=n.env.filter(c=>!c.hidden);h.length>0&&s.push({content:h.map(c=>[c.name,c.description??""]),header:M.magenta(" Environment Variables ")})}if(n.alias!==void 0&&n.alias.length>0){let h=n.alias;typeof n.alias=="string"&&(h=[n.alias]),s.splice(1,0,{content:h,header:"Alias(es)"})}Array.isArray(n.examples)&&n.examples.length>0&&s.push({content:n.examples,header:"Examples"});const a=[...n.commandPath??[],n.name],l=Yt(r,a);l.length>0&&s.push({content:l.map(h=>{const c=[...h.commandPath??[],h.name].join(" ");return[J(c),h.description??""]}),header:M.green(" Subcommands ")}),(t.raw??t.log)($t(s))},"printCommandHelp");class jo{static{C(this,"_")}static{xr(this,"S")}static{$r(this,"x")}static{te(this,"HelpCommand")}name="help";options=[{description:"Display only the specified group",name:"group",type:String}];commands;constructor(e){this.commands=e}execute(e){const{commandName:r,logger:i,options:n,runtime:s}=e,{footer:o,header:a}=s.getCommandSection();a&&(i.raw??i.log)(N(a)),r==="help"?$o(i,s,this.commands,typeof n?.group=="string"?n.group:void 0):Bo(i,s,this.commands,r),o&&(i.raw??i.log)(N(o))}}export{jo as default};
@@ -1,4 +1,4 @@
1
- var Te=Object.defineProperty;var w=(e,t)=>Te(e,"name",{value:t,configurable:!0});import{createRequire as ze}from"node:module";import{u as Be,aI as Ie,p as Ne,aW as qe}from"./bin.js";import{z as he,M as me,$ as I}from"./config.js";const Me=ze(import.meta.url),z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Fe=w(e=>{if(typeof z<"u"&&z.versions&&z.versions.node){const[t,r]=z.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return z.getBuiltinModule(e)}return Me(e)},"__cjs_getBuiltinModule"),{createRequire:Ge}=Fe("node:module");var De=Object.defineProperty,Ke=w((e,t)=>De(e,"name",{value:t,configurable:!0}),"p$6"),Qe=Object.defineProperty,de=Ke((e,t)=>Qe(e,"name",{value:t,configurable:!0}),"e"),Ve=Object.defineProperty,He=de((e,t)=>Ve(e,"name",{value:t,configurable:!0}),"E");const ge=String.raw,re=ge`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,Je=He(()=>new RegExp(ge`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${re}(?:\u200D${re})*`,"gu"),"default");var Ye=Object.defineProperty,Xe=de((e,t)=>Ye(e,"name",{value:t,configurable:!0}),"p");Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]]));const T=Je(),Ze=/[-_./\s]+/g,L=/(\u001B\[[0-9;]*[a-z])/i,ne=new RegExp("\\p{Script=Arabic}","u"),et=new RegExp("\\p{Script=Bengali}","u"),_=new RegExp("\\p{Script=Cyrillic}","u"),tt=new RegExp("\\p{Script=Devanagari}","u"),rt=new RegExp("\\p{Script=Ethiopic}","u"),Q=new RegExp("\\p{Script=Greek}","u"),ae=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),nt=new RegExp("\\p{Script=Gujarati}","u"),at=new RegExp("\\p{Script=Gurmukhi}","u"),ie=new RegExp("\\p{Script=Hangul}","u"),se=new RegExp("\\p{Script=Hebrew}","u"),it=new RegExp("\\p{Script=Hiragana}","u"),oe=new RegExp("\\p{Script=Han}","u"),st=new RegExp("\\p{Script=Kannada}","u"),ot=new RegExp("\\p{Script=Katakana}","u"),lt=new RegExp("\\p{Script=Khmer}","u"),ct=new RegExp("\\p{Script=Lao}","u"),O=new RegExp("\\p{Script=Latin}","u"),ut=new RegExp("\\p{Script=Malayalam}","u"),pt=new RegExp("\\p{Script=Myanmar}","u"),ft=new RegExp("\\p{Script=Oriya}","u"),ht=new RegExp("\\p{Script=Sinhala}","u"),mt=new RegExp("\\p{Script=Tamil}","u"),dt=new RegExp("\\p{Script=Telugu}","u"),gt=new RegExp("\\p{Script=Thai}","u"),yt=new RegExp("\\p{Script=Tibetan}","u"),le=/[\u02BB\u02BC\u0027]/u,bt=Xe(e=>e.replace(T,""),"stripEmoji");var $t=Object.defineProperty,ye=w((e,t)=>$t(e,"name",{value:t,configurable:!0}),"i$5"),vt=Object.defineProperty,be=ye((e,t)=>vt(e,"name",{value:t,configurable:!0}),"r"),wt=Object.defineProperty,jt=be((e,t)=>wt(e,"name",{value:t,configurable:!0}),"c");let W=class{static{w(this,"l")}static{ye(this,"y")}static{be(this,"s")}static{jt(this,"LRUCache")}capacity;cache;keyOrder;constructor(t){this.capacity=t,this.cache=new Map,this.keyOrder=[]}get(t){if(this.cache.has(t))return this.keyOrder=this.keyOrder.filter(r=>r!==t),this.keyOrder.push(t),this.cache.get(t)}has(t){return this.cache.has(t)}set(t,r){if(this.cache.has(t))this.keyOrder=this.keyOrder.filter(n=>n!==t);else if(this.cache.size>=this.capacity){const n=this.keyOrder.shift();n!==void 0&&this.cache.delete(n)}this.cache.set(t,r),this.keyOrder.push(t)}delete(t){this.cache.delete(t),this.keyOrder=this.keyOrder.filter(r=>r!==t)}clear(){this.cache.clear(),this.keyOrder=[]}size(){return this.cache.size}};var Et=Object.defineProperty,Ot=w((e,t)=>Et(e,"name",{value:t,configurable:!0}),"r$6"),kt=Object.defineProperty,xt=Ot((e,t)=>kt(e,"name",{value:t,configurable:!0}),"a"),Ct=Object.defineProperty,St=xt((e,t)=>Ct(e,"name",{value:t,configurable:!0}),"s");const Pt=St((e,t)=>typeof e!="string"||e===""?"":(t?.locale?e[0].toLocaleLowerCase(t.locale):e[0].toLowerCase())+e.slice(1),"lowerFirst");var At=Object.defineProperty,Lt=w((e,t)=>At(e,"name",{value:t,configurable:!0}),"I"),Wt=Object.defineProperty,q=Lt((e,t)=>Wt(e,"name",{value:t,configurable:!0}),"W");const Rt=Ge(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_t=q(e=>{if(typeof M<"u"&&M.versions&&M.versions.node){const[t,r]=M.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return M.getBuiltinModule(e)}return Rt(e)},"__cjs_getBuiltinModule"),{stripVTControlCharacters:Ut}=_t("node:util");var Tt=Object.defineProperty,zt=q((e,t)=>Tt(e,"name",{value:t,configurable:!0}),"g");const V=new W(1e3),Mt=/[.*+?^${}()|[\]\\]/g,Ft=zt(e=>{const t=e.join("");if(V.has(t))return V.get(t);const r=e.map(a=>a.replaceAll(Mt,String.raw`\$&`)).join("|"),n=new RegExp(r,"g");return V.set(t,n),n},"getSeparatorsRegex");var Bt=Object.defineProperty,It=q((e,t)=>Bt(e,"name",{value:t,configurable:!0}),"t");const Nt=It(e=>{const t=[];let r=0,n;for(T.lastIndex=0;(n=T.exec(e))!==null;)n.index>r&&t.push(e.slice(r,n.index)),t.push(n[0]),r=T.lastIndex;return r<e.length&&t.push(e.slice(r)),t.filter(Boolean)},"splitByEmoji");var qt=Object.defineProperty,$=q((e,t)=>qt(e,"name",{value:t,configurable:!0}),"u");const Gt=/[ČŠŽĐ]/i,$e=new Uint8Array(128),ve=new Uint8Array(128),we=new Uint8Array(128);for(let e=0;e<128;e++)$e[e]=e>=65&&e<=90?1:0,ve[e]=e>=97&&e<=122?1:0,we[e]=e>=48&&e<=57?1:0;const H=$(e=>$e[e],"isUpper"),ce=$(e=>ve[e],"isLower"),J=$(e=>we[e],"isDigit"),A=$((e,t,r,n,a)=>{if(e.length===0)return[];let i=!1;const l=Object.values(t);for(const u of l)if(u(e[0])){i=!0;break}if(!i&&!r)return[e];const o=[...e],h=[];let s=o[0],f="other";const m=Object.entries(t);for(const u of m){const[p,g]=u;if(g(o[0])){f=p;break}}let c=r&&n?o[0]===o[0].toLocaleUpperCase(n):!1;for(let u=1;u<o.length;u++){const p=o[u];let g="other";for(const b of m){const[v,E]=b;if(E(p)){g=v;break}}const y=r&&n?p===p.toLocaleUpperCase(n):!1;let d=!1;a?d=a(f,g,c,y,p,u,o):(f!==g&&f!=="other"&&g!=="other"&&(d=!0),r&&g!=="other"&&!c&&y&&(d=!0)),d?(h.push(s),s=p):s+=p,f=g,r&&(c=y)}return s&&s.length>0&&h.push(s),h.length>0?h:[e]},"handleScriptTransitions"),Dt=$((e,t,r,n)=>{if(r.size===0)return t;for(const a of r)if(e.startsWith(a,t))return n.push(a),t+a.length;return t},"detectAndProcessAcronym"),je=$((e,t=new Set)=>{if(e.length===0)return[];if(e.toUpperCase()===e)return[e];let r=0;const n=[],a=e.length;for(let i=1;i<a;i++){const l=Dt(e,r,t,n);if(l!==r){r=l,i=r-1;continue}const o=e.codePointAt(i-1),h=e.codePointAt(i),s=o&&o<128&&H(o),f=h&&h<128&&H(h),m=o&&o<128&&ce(o),c=o&&o<128&&J(o),u=h&&h<128&&J(h);if(m&&f){n.push(e.slice(r,i)),r=i;continue}if(c&&!u||!c&&u){n.push(e.slice(r,i)),r=i;continue}if(u&&!c){let p=!1,g=!1;if(i+1<a){const y=e.codePointAt(i+1);p=y&&y<128&&H(y),g=y&&y<128&&J(y)}if(!g&&p){n.push(e.slice(r,i),e.slice(i,i+1)),r=i+1;continue}}if(i+1<a){const p=e.codePointAt(i+1),g=p&&p<128&&ce(p);if(s&&f&&g){const y=e.slice(r,i+1);t.has(y)||(n.push(e.slice(r,i)),r=i)}}}return r<a&&n.push(e.slice(r)),n.filter(i=>i!=="")},"splitCamelCaseFast"),Ee=$((e,t,r)=>{if(e.length===0)return[];const n=e===e.toLocaleUpperCase(t);if(t.startsWith("de")){if(!n&&e.replaceAll("ß","SS")===e.toLocaleUpperCase(t))return[e];const s=[...e],f=s.length,m=[];let c=s[0],u=s[0]===s[0].toLocaleUpperCase(t),p=u,g=u?0:-1;for(let y=1;y<f;y++){const d=s[y],b=d===d.toLocaleUpperCase(t);if(b===u)c+=d;else if(b)c&&c.length>0&&(m.push(c),c=d),p=!0,g=y;else{if(p&&y-g>1){const v=s[y-1],E=c.slice(0,-1);E&&E.length>0&&m.push(E),c=v+d}else c+=d;p=!1,g=-1}u=b}return c&&c.length>0&&m.push(c),m}if(t.startsWith("uk")||t.startsWith("ru")||t.startsWith("bg")||t.startsWith("sr")||t.startsWith("mk")||t.startsWith("be")){if(!_.test(e)&&!O.test(e))return[e];const s=[...e],f=s.length,m=[];let c=s[0];const u=s[0];let p;_.test(u)?p=1:O.test(u)?p=2:p=0;let g=u===u.toLocaleUpperCase(t);for(let d=1;d<f;d++){const b=s[d];let v;_.test(b)?v=1:O.test(b)?v=2:v=0;const E=b===b.toLocaleUpperCase(t);p!==v&&(p===1||p===2)&&(v===1||v===2)||v===p&&!g&&E?(m.push(c),c=b):c+=b,p=v,g=E}c&&c.length>0&&m.push(c);const y=[];for(let d=0;d<m.length;d++)d<m.length-1&&m[d].length===1&&O.test(m[d])&&_.test(m[d+1][0])?(y.push(m[d]+m[d+1]),d+=1):y.push(m[d]);return y}if(t.startsWith("el")){if(!Q.test(e)&&!O.test(e))return[e];const s=[];ae.lastIndex=0;let f;for(;(f=ae.exec(e))!==null;)s.push(f[0]);s.length===0&&s.push(e);const m=[];if(s.length===1){const c=s[0];if(!c||!Q.test(c[0])||c.length===1)return[c??e]}for(const c of s){if(!c)continue;if(!Q.test(c[0])||c.length===1){m.push(c);continue}const u=c.length;let p=c[0],g=c[0]===c[0].toLocaleUpperCase(t);for(let y=1;y<u;y++){const d=c[y],b=d===d.toLocaleUpperCase(t);!g&&b?(m.push(p),p=d):p+=d,g=b}p&&m.push(p)}return m}if(t.startsWith("ja")||t.startsWith("ko")){const s=t.startsWith("ja"),f=s?{hiragana:$(c=>it.test(c),"hiragana"),kanji:$(c=>oe.test(c),"kanji"),katakana:$(c=>ot.test(c),"katakana"),latin:$(c=>O.test(c),"latin")}:{hangul:$(c=>ie.test(c),"hangul"),latin:$(c=>O.test(c),"latin")},m=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(s){const c=A(e,f,!1,t,(p,g)=>p==="hiragana"&&g==="katakana"||p==="katakana"&&g==="hiragana"||p==="hiragana"&&g==="latin"||p==="katakana"&&g==="latin"||p==="kanji"&&g==="latin"||p==="latin"&&(g==="hiragana"||g==="katakana"||g==="kanji")),u=[];for(const p of c){const g=p;g.length===1&&m.has(g)&&u.length>0?u[u.length-1]=u.at(-1)+g:u.push(g)}return u.length>0?u:[e]}return A(e,f,!1,t,(c,u)=>c==="hangul"&&u==="latin"||c==="latin"&&u==="hangul")}if(t.startsWith("sl")){const s=[...e],f=s.length,m=[];let c=s[0],u=s[0]===s[0].toLocaleUpperCase(t);for(let p=1;p<f;p++){const g=s[p],y=g===g.toLocaleUpperCase(t),d=Gt.test(g),b=p<f-1&&s[p+1]===s[p+1].toLocaleUpperCase(t);!u&&y||d&&b?(m.push(c),c=g,d&&b&&(m.push(c),c="")):c+=g,u=y}return c&&c.length>0&&m.push(c),m}if(t.startsWith("zh"))return A(e,{han:$(s=>oe.test(s),"han"),latin:$(s=>O.test(s),"latin")},!1,t);if(["ar","fa","he","ur"].includes(t.split("-")[0])){const s=$(f=>se.test(f)||ne.test(f),"isRtlChar");return A(e,{latin:$(f=>O.test(f),"latin"),rtl:$(f=>s(f),"rtl")},!1,t)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(t.split("-")[0])){const s=$(f=>tt.test(f)||et.test(f)||nt.test(f)||at.test(f)||st.test(f)||mt.test(f)||dt.test(f)||ut.test(f)||ht.test(f)||gt.test(f)||ct.test(f)||yt.test(f)||pt.test(f)||rt.test(f)||lt.test(f)||ft.test(f),"isIndicChar");return A(e,{indic:$(f=>s(f),"indic"),latin:$(f=>O.test(f),"latin")},!1,t)}if(["be","bg","ru","sr","uk"].includes(t))return A(e,{cyrillic:$(s=>_.test(s),"cyrillic"),latin:$(s=>O.test(s),"latin")},!0,t);if(["ar","fa","he"].includes(t))return A(e,{latin:$(s=>O.test(s),"latin"),rtl:$(s=>se.test(s)||ne.test(s),"rtl")},!1,t);if(t.startsWith("ko"))return A(e,{hangul:$(s=>ie.test(s),"hangul"),latin:$(s=>O.test(s),"latin")},!1,t);if(t.startsWith("uz")){if(!_.test(e)&&!O.test(e))return[e];const s=[...e],f=s.length,m=[];let c=s[0],u=s[0]===s[0].toLocaleUpperCase(t);for(let p=1;p<f;p++){const g=s[p],y=g===g.toLocaleUpperCase(t);if(le.test(g)||le.test(s[p-1])){c+=g;continue}!u&&y?(m.push(c),c=g):c+=g,u=y}return c&&c.length>0&&m.push(c),m}const a=[...e],i=a.length,l=[];let o=a[0],h=a[0]===a[0].toLocaleUpperCase(t);for(const s of r)if(e.startsWith(s)){l.push(s),o=a[s.length],h=o===o.toLocaleUpperCase(t);break}for(let s=1;s<i;s++){const f=a[s],m=f===f.toLocaleUpperCase(t);let c=0;for(const u of r)if(e.startsWith(u,s)){l.push(o,u),c=u.length,o="";const p=u.at(-1);p&&(h=p===p.toLocaleUpperCase(t));break}if(c>0){s+=c-1;continue}!h&&m?(l.push(o),o=f):o+=f,h=m}return o&&l.push(o),l},"splitCamelCaseLocale"),Kt=$((e,t,r)=>{const n=[],a=L.test(e)?e.split(L).filter(Boolean):[e];for(const i of a){const l=i;if(L.test(l))n.push(l);else{const o=T.test(l)?Nt(l).filter(Boolean):[l];for(const h of o)if(T.test(h))n.push(h);else if(t){const s=t.toLowerCase().split("-")[0];n.push(...Ee(h,s,r))}else n.push(...je(h,r))}}return n},"processTextWithAnsiEmoji"),G=$((e,t={})=>{if(!e||typeof e!="string")return[];const{handleAnsi:r=!1,handleEmoji:n=!1,knownAcronyms:a=[],locale:i,normalize:l=!1,separators:o,stripAnsi:h=!1,stripEmoji:s=!1}=t,f=new Set([...a].toSorted((d,b)=>b.length-d.length));let m=e;h&&(m=Ut(m)),s&&(m=bt(m));let c;Array.isArray(o)?c=Ft(o):o instanceof RegExp?c=o:c=Ze;const u=[];let p=m;const g=c.flags.includes("g")?c:new RegExp(c.source,`${c.flags}g`);for(;p.length>0;){const d=g.exec(p);if(!d){p===".."?u.push(".."):p==="."?u.push("."):p.length>0&&u.push(p);break}const b=d.index,v=d[0],E=v.length,B=p.slice(0,b),Ue=p.slice(b+E);if(v.startsWith("../"))u.push(".."),p=p.slice(b+3);else if(v.startsWith("./"))u.push("."),p=p.slice(b+2);else if(b===0&&v==="..")u.push(".."),p=p.slice(2);else if(b===0&&v===".")u.push("."),p=p.slice(1);else{B.length>0&&u.push(B);let S=0;for(;(S=v.indexOf("../",S))!==-1;)u.push(".."),S+=3;for(S=0;(S=v.indexOf("./",S))!==-1;)(S===0||v[S-1]!==".")&&u.push("."),S+=2;let P=Ue;for(;P.startsWith("../");)u.push(".."),P=P.slice(3);for(;P.startsWith("./");)u.push("."),P=P.slice(2);if(P===".."){u.push("..");break}else if(P==="."){u.push(".");break}else p=P}g.lastIndex=0}if(u.length===0){const d=m.split(c).filter(Boolean);u.push(...d)}let y=[];for(const d of u)r||n?y.push(...Kt(d,i,f)):i?y.push(...Ee(d,i,f)):y.push(...je(d,f));return l&&(y=y.map(d=>f.has(d)?d:i&&d===d.toLocaleUpperCase(i)?d[0]+d.slice(1).toLocaleLowerCase(i):d.toUpperCase()===d&&!f.has(d)?d.slice(0,1)+d.slice(1).toLowerCase():d)),y},"splitByCase");var Qt=Object.defineProperty,Vt=w((e,t)=>Qt(e,"name",{value:t,configurable:!0}),"r$5"),Ht=Object.defineProperty,Jt=Vt((e,t)=>Ht(e,"name",{value:t,configurable:!0}),"o"),Yt=Object.defineProperty,Xt=Jt((e,t)=>Yt(e,"name",{value:t,configurable:!0}),"s");const Z=Xt((e,t)=>typeof e!="string"||e===""?"":(t?.locale?e[0].toLocaleUpperCase(t.locale):e[0].toUpperCase())+e.slice(1),"upperFirst");var Zt=Object.defineProperty,er=w((e,t)=>Zt(e,"name",{value:t,configurable:!0}),"r$4"),tr=Object.defineProperty,rr=er((e,t)=>tr(e,"name",{value:t,configurable:!0}),"r"),nr=Object.defineProperty,ar=rr((e,t)=>nr(e,"name",{value:t,configurable:!0}),"n");const D=ar((e,t)=>`${e}::${t?.joiner??""}::${t?.locale??""}::${t?.knownAcronyms?.join(",")??""}::${t?.normalize?"true":"false"}`,"generateCacheKey");var ir=Object.defineProperty,sr=w((e,t)=>ir(e,"name",{value:t,configurable:!0}),"i$3"),or=Object.defineProperty,lr=sr((e,t)=>or(e,"name",{value:t,configurable:!0}),"f"),cr=Object.defineProperty,ur=lr((e,t)=>cr(e,"name",{value:t,configurable:!0}),"l");const K=ur((e,t)=>{const{length:r}=e;if(r===0)return"";if(r===1)return e[0];const n=[];let a="",i="";for(let l=0;l<r;l++){const o=e[l];if(L.test(o)){a?(n.push(a+i+o),a="",i=""):(n.length>0&&n.push(t),a=o);continue}a?(i&&(i+=t),i+=o):(n.length>0&&n.push(t),n.push(o))}return n.join("")},"joinSegments");var pr=Object.defineProperty,fr=w((e,t)=>pr(e,"name",{value:t,configurable:!0}),"r$3"),hr=Object.defineProperty,mr=fr((e,t)=>hr(e,"name",{value:t,configurable:!0}),"a"),dr=Object.defineProperty,gr=mr((e,t)=>dr(e,"name",{value:t,configurable:!0}),"e");const yr=/(?<![a-zß])SS(?![a-z])/g,ee=gr(e=>e.replaceAll(yr,"ß"),"normalizeGermanEszett");var br=Object.defineProperty,$r=w((e,t)=>br(e,"name",{value:t,configurable:!0}),"c$3"),vr=Object.defineProperty,wr=$r((e,t)=>vr(e,"name",{value:t,configurable:!0}),"c"),jr=Object.defineProperty,Er=wr((e,t)=>jr(e,"name",{value:t,configurable:!0}),"o");const Or=new W(1e3),kr=Er((e,t)=>{if(typeof e!="string"||!e)return"";const r=t?.cache??!1,n=t?.cacheStore??Or;let a;if(r&&(a=D(e,t)),r&&a&&n.has(a))return n.get(a);let i=!0;const l=K(G(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(o=>{if(t?.handleAnsi&&L.test(o))return o;const h=t?.locale?.startsWith("de")?ee(o):o,s=t?.locale?h.toLocaleLowerCase(t.locale):h.toLowerCase();return i?(i=!1,Pt(s,t)):Z(s,t)}),"");return r&&a&&n.set(a,l),l},"camelCase");var xr=Object.defineProperty,Cr=w((e,t)=>xr(e,"name",{value:t,configurable:!0}),"l$3"),Sr=Object.defineProperty,Pr=Cr((e,t)=>Sr(e,"name",{value:t,configurable:!0}),"l"),Ar=Object.defineProperty,Lr=Pr((e,t)=>Ar(e,"name",{value:t,configurable:!0}),"o");const Wr=new W(1e3),te=Lr((e,t)=>{if(typeof e!="string")return"";const r=t?.cache??!1,n=t?.cacheStore??Wr;let a;if(r&&(a=D(e,t)),r&&a&&n.has(a))return n.get(a);const i=G(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(o=>{if(t?.handleAnsi&&L.test(o))return o;if(t?.toUpperCase)return t.locale?o.toLocaleUpperCase(t.locale):o.toUpperCase();const h=t?.locale?.startsWith("de")?ee(o):o;return t?.locale?h.toLocaleLowerCase(t.locale):h.toLowerCase()}),l=K(i,t?.joiner??"-");return r&&a&&n.set(a,l),l},"kebabCase");var Rr=Object.defineProperty,_r=w((e,t)=>Rr(e,"name",{value:t,configurable:!0}),"r$2"),Ur=Object.defineProperty,Tr=_r((e,t)=>Ur(e,"name",{value:t,configurable:!0}),"a"),zr=Object.defineProperty,Mr=Tr((e,t)=>zr(e,"name",{value:t,configurable:!0}),"s");const Fr=new W(1e3),Br=Mr((e,t)=>te(e,{cacheStore:Fr,...t,joiner:"_",toUpperCase:!0}),"constantCase");var Ir=Object.defineProperty,Nr=w((e,t)=>Ir(e,"name",{value:t,configurable:!0}),"l$2"),qr=Object.defineProperty,Gr=Nr((e,t)=>qr(e,"name",{value:t,configurable:!0}),"l"),Dr=Object.defineProperty,Kr=Gr((e,t)=>Dr(e,"name",{value:t,configurable:!0}),"i");const Qr=new W(1e3),Vr=Kr((e,t)=>{if(typeof e!="string"||!e)return"";const r=t?.cache??!1,n=t?.cacheStore??Qr;let a;if(r&&(a=D(e,t)),r&&a&&n.has(a))return n.get(a);const i=K(G(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(l=>{if(t?.handleAnsi&&L.test(l))return l;const o=t?.locale?.startsWith("de")?ee(l):l;return Z(t?.locale?o.toLocaleLowerCase(t.locale):o.toLowerCase(),{locale:t?.locale})}),"");return r&&a&&n.set(a,i),i},"pascalCase");var Hr=Object.defineProperty,Jr=w((e,t)=>Hr(e,"name",{value:t,configurable:!0}),"r$1"),Yr=Object.defineProperty,Xr=Jr((e,t)=>Yr(e,"name",{value:t,configurable:!0}),"a"),Zr=Object.defineProperty,en=Xr((e,t)=>Zr(e,"name",{value:t,configurable:!0}),"s");const tn=new W(1e3),rn=en((e,t)=>te(e,{cacheStore:tn,...t,joiner:"_"}),"snakeCase");var nn=Object.defineProperty,an=w((e,t)=>nn(e,"name",{value:t,configurable:!0}),"r"),sn=Object.defineProperty,on=an((e,t)=>sn(e,"name",{value:t,configurable:!0}),"e"),ln=Object.defineProperty,cn=on((e,t)=>ln(e,"name",{value:t,configurable:!0}),"i");const un=new W(1e3),pn=cn((e,t)=>{if(typeof e!="string")return"";const r=t?.cache??!1,n=t?.cacheStore??un;let a;if(r&&(a=D(e,t)),r&&a&&n.has(a))return n.get(a);const i=K(G(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(l=>Z(l,{locale:t?.locale})),"-");return r&&a&&n.set(a,i),i},"trainCase");var fn=Object.defineProperty,k=w((e,t)=>fn(e,"name",{value:t,configurable:!0}),"e");const x=k(e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),"stringify"),Y={camel_case:k(e=>kr(x(e)),"camel_case"),kebab_case:k(e=>te(x(e)),"kebab_case"),lower_case:k(e=>x(e).toLowerCase(),"lower_case"),pascal_case:k(e=>Vr(x(e)),"pascal_case"),path_join:k((e,...t)=>{const r=[x(e),...t.map(n=>x(n))];return me(...r)},"path_join"),path_relative:k((e,t)=>he(x(t),x(e)),"path_relative"),snake_case:k(e=>rn(x(e)),"snake_case"),upper_case:k(e=>x(e).toUpperCase(),"upper_case"),upper_kebab_case:k(e=>pn(x(e)),"upper_kebab_case"),upper_snake_case:k(e=>Br(x(e)),"upper_snake_case")};k(e=>Object.hasOwn(Y,e),"isKnownFilter");const Oe=k((e,t,r=[])=>{const n=Y[e];if(!n)throw new Error(`Unknown filter "${e}". Known filters: ${Object.keys(Y).sort().join(", ")}.`);return n(t,...r)},"applyFilter");var hn=Object.defineProperty,ke=w((e,t)=>hn(e,"name",{value:t,configurable:!0}),"d$1");const xe=ke(e=>{const t=[];let r=0,n=0,a,i=-1;for(const l of e){if(i+=1,a){l===a&&(a=void 0);continue}if(l==='"'||l==="'"){a=l;continue}l==="("?r+=1:l===")"?r-=1:l===","&&r===0&&(t.push(e.slice(n,i)),n=i+1)}return t.push(e.slice(n)),t},"splitCommaOutsideQuotes"),mn=ke(e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},"stripQuotes");var dn=Object.defineProperty,R=w((e,t)=>dn(e,"name",{value:t,configurable:!0}),"s$1");const gn=/\[([^\]]+)\]/g,yn=R(e=>{const t=e.trim(),r=t.indexOf("(");if(r===-1)return{args:[],name:t};if(!t.endsWith(")"))throw new Error(`Filter call "${e}" missing closing ")"`);const n=t.slice(0,r).trim(),a=t.slice(r+1,-1).trim();return a===""?{args:[],name:n}:{args:xe(a).map(i=>{const l=i.trim();return mn(l)??l}),name:n}},"parseFilterCall"),bn=R(e=>{const t=e.split("|").map(n=>n.trim()),r=t[0]??"";if(!r)throw new Error(`Empty variable name in expression "${e}"`);return{filters:t.slice(1).map(n=>yn(n)),name:r}},"parsePipe"),$n=R(e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),"stringify"),vn=R((e,t)=>{const r=e.replaceAll(gn,(n,a)=>{const{filters:i,name:l}=bn(a);if(!Object.hasOwn(t,l))throw new Error(`Variable "${l}" used in filename "${e}" but not defined`);let o=t[l];for(const h of i)o=Oe(h.name,o,h.args);return $n(o)});return Ce(r)},"interpolateFilename"),Ce=R(e=>e.split("/").map(t=>t.endsWith(".tera")||t.endsWith(".twig")?t.slice(0,-5):t).join("/"),"stripTeraSuffix"),wn=R(e=>e.endsWith(".raw")?e.slice(0,-4):e,"stripRawSuffix"),jn=R(e=>{const t=e.split("/");return(t.at(-1)??"").startsWith("_")?!0:t.slice(0,-1).includes("partials")},"isPartialPath");var En=Object.defineProperty,On=w((e,t)=>En(e,"name",{value:t,configurable:!0}),"i");const kn=On((e,t)=>{if(!e.startsWith(`---
1
+ var Te=Object.defineProperty;var w=(e,t)=>Te(e,"name",{value:t,configurable:!0});import{createRequire as ze}from"node:module";import{u as Be,aI as Ie,p as Ne,b7 as qe}from"./bin.js";import{z as he,M as me,$ as I}from"./config.js";const Me=ze(import.meta.url),z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Fe=w(e=>{if(typeof z<"u"&&z.versions&&z.versions.node){const[t,r]=z.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return z.getBuiltinModule(e)}return Me(e)},"__cjs_getBuiltinModule"),{createRequire:Ge}=Fe("node:module");var De=Object.defineProperty,Ke=w((e,t)=>De(e,"name",{value:t,configurable:!0}),"p$6"),Qe=Object.defineProperty,de=Ke((e,t)=>Qe(e,"name",{value:t,configurable:!0}),"e"),Ve=Object.defineProperty,He=de((e,t)=>Ve(e,"name",{value:t,configurable:!0}),"E");const ge=String.raw,re=ge`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,Je=He(()=>new RegExp(ge`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${re}(?:\u200D${re})*`,"gu"),"default");var Ye=Object.defineProperty,Xe=de((e,t)=>Ye(e,"name",{value:t,configurable:!0}),"p");Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]]));const T=Je(),Ze=/[-_./\s]+/g,L=/(\u001B\[[0-9;]*[a-z])/i,ne=new RegExp("\\p{Script=Arabic}","u"),et=new RegExp("\\p{Script=Bengali}","u"),_=new RegExp("\\p{Script=Cyrillic}","u"),tt=new RegExp("\\p{Script=Devanagari}","u"),rt=new RegExp("\\p{Script=Ethiopic}","u"),Q=new RegExp("\\p{Script=Greek}","u"),ae=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),nt=new RegExp("\\p{Script=Gujarati}","u"),at=new RegExp("\\p{Script=Gurmukhi}","u"),ie=new RegExp("\\p{Script=Hangul}","u"),se=new RegExp("\\p{Script=Hebrew}","u"),it=new RegExp("\\p{Script=Hiragana}","u"),oe=new RegExp("\\p{Script=Han}","u"),st=new RegExp("\\p{Script=Kannada}","u"),ot=new RegExp("\\p{Script=Katakana}","u"),lt=new RegExp("\\p{Script=Khmer}","u"),ct=new RegExp("\\p{Script=Lao}","u"),O=new RegExp("\\p{Script=Latin}","u"),ut=new RegExp("\\p{Script=Malayalam}","u"),pt=new RegExp("\\p{Script=Myanmar}","u"),ft=new RegExp("\\p{Script=Oriya}","u"),ht=new RegExp("\\p{Script=Sinhala}","u"),mt=new RegExp("\\p{Script=Tamil}","u"),dt=new RegExp("\\p{Script=Telugu}","u"),gt=new RegExp("\\p{Script=Thai}","u"),yt=new RegExp("\\p{Script=Tibetan}","u"),le=/[\u02BB\u02BC\u0027]/u,bt=Xe(e=>e.replace(T,""),"stripEmoji");var $t=Object.defineProperty,ye=w((e,t)=>$t(e,"name",{value:t,configurable:!0}),"i$5"),vt=Object.defineProperty,be=ye((e,t)=>vt(e,"name",{value:t,configurable:!0}),"r"),wt=Object.defineProperty,jt=be((e,t)=>wt(e,"name",{value:t,configurable:!0}),"c");let W=class{static{w(this,"l")}static{ye(this,"y")}static{be(this,"s")}static{jt(this,"LRUCache")}capacity;cache;keyOrder;constructor(t){this.capacity=t,this.cache=new Map,this.keyOrder=[]}get(t){if(this.cache.has(t))return this.keyOrder=this.keyOrder.filter(r=>r!==t),this.keyOrder.push(t),this.cache.get(t)}has(t){return this.cache.has(t)}set(t,r){if(this.cache.has(t))this.keyOrder=this.keyOrder.filter(n=>n!==t);else if(this.cache.size>=this.capacity){const n=this.keyOrder.shift();n!==void 0&&this.cache.delete(n)}this.cache.set(t,r),this.keyOrder.push(t)}delete(t){this.cache.delete(t),this.keyOrder=this.keyOrder.filter(r=>r!==t)}clear(){this.cache.clear(),this.keyOrder=[]}size(){return this.cache.size}};var Et=Object.defineProperty,Ot=w((e,t)=>Et(e,"name",{value:t,configurable:!0}),"r$6"),kt=Object.defineProperty,xt=Ot((e,t)=>kt(e,"name",{value:t,configurable:!0}),"a"),Ct=Object.defineProperty,St=xt((e,t)=>Ct(e,"name",{value:t,configurable:!0}),"s");const Pt=St((e,t)=>typeof e!="string"||e===""?"":(t?.locale?e[0].toLocaleLowerCase(t.locale):e[0].toLowerCase())+e.slice(1),"lowerFirst");var At=Object.defineProperty,Lt=w((e,t)=>At(e,"name",{value:t,configurable:!0}),"I"),Wt=Object.defineProperty,q=Lt((e,t)=>Wt(e,"name",{value:t,configurable:!0}),"W");const Rt=Ge(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_t=q(e=>{if(typeof M<"u"&&M.versions&&M.versions.node){const[t,r]=M.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return M.getBuiltinModule(e)}return Rt(e)},"__cjs_getBuiltinModule"),{stripVTControlCharacters:Ut}=_t("node:util");var Tt=Object.defineProperty,zt=q((e,t)=>Tt(e,"name",{value:t,configurable:!0}),"g");const V=new W(1e3),Mt=/[.*+?^${}()|[\]\\]/g,Ft=zt(e=>{const t=e.join("");if(V.has(t))return V.get(t);const r=e.map(a=>a.replaceAll(Mt,String.raw`\$&`)).join("|"),n=new RegExp(r,"g");return V.set(t,n),n},"getSeparatorsRegex");var Bt=Object.defineProperty,It=q((e,t)=>Bt(e,"name",{value:t,configurable:!0}),"t");const Nt=It(e=>{const t=[];let r=0,n;for(T.lastIndex=0;(n=T.exec(e))!==null;)n.index>r&&t.push(e.slice(r,n.index)),t.push(n[0]),r=T.lastIndex;return r<e.length&&t.push(e.slice(r)),t.filter(Boolean)},"splitByEmoji");var qt=Object.defineProperty,$=q((e,t)=>qt(e,"name",{value:t,configurable:!0}),"u");const Gt=/[ČŠŽĐ]/i,$e=new Uint8Array(128),ve=new Uint8Array(128),we=new Uint8Array(128);for(let e=0;e<128;e++)$e[e]=e>=65&&e<=90?1:0,ve[e]=e>=97&&e<=122?1:0,we[e]=e>=48&&e<=57?1:0;const H=$(e=>$e[e],"isUpper"),ce=$(e=>ve[e],"isLower"),J=$(e=>we[e],"isDigit"),A=$((e,t,r,n,a)=>{if(e.length===0)return[];let i=!1;const l=Object.values(t);for(const u of l)if(u(e[0])){i=!0;break}if(!i&&!r)return[e];const o=[...e],h=[];let s=o[0],f="other";const m=Object.entries(t);for(const u of m){const[p,g]=u;if(g(o[0])){f=p;break}}let c=r&&n?o[0]===o[0].toLocaleUpperCase(n):!1;for(let u=1;u<o.length;u++){const p=o[u];let g="other";for(const b of m){const[v,E]=b;if(E(p)){g=v;break}}const y=r&&n?p===p.toLocaleUpperCase(n):!1;let d=!1;a?d=a(f,g,c,y,p,u,o):(f!==g&&f!=="other"&&g!=="other"&&(d=!0),r&&g!=="other"&&!c&&y&&(d=!0)),d?(h.push(s),s=p):s+=p,f=g,r&&(c=y)}return s&&s.length>0&&h.push(s),h.length>0?h:[e]},"handleScriptTransitions"),Dt=$((e,t,r,n)=>{if(r.size===0)return t;for(const a of r)if(e.startsWith(a,t))return n.push(a),t+a.length;return t},"detectAndProcessAcronym"),je=$((e,t=new Set)=>{if(e.length===0)return[];if(e.toUpperCase()===e)return[e];let r=0;const n=[],a=e.length;for(let i=1;i<a;i++){const l=Dt(e,r,t,n);if(l!==r){r=l,i=r-1;continue}const o=e.codePointAt(i-1),h=e.codePointAt(i),s=o&&o<128&&H(o),f=h&&h<128&&H(h),m=o&&o<128&&ce(o),c=o&&o<128&&J(o),u=h&&h<128&&J(h);if(m&&f){n.push(e.slice(r,i)),r=i;continue}if(c&&!u||!c&&u){n.push(e.slice(r,i)),r=i;continue}if(u&&!c){let p=!1,g=!1;if(i+1<a){const y=e.codePointAt(i+1);p=y&&y<128&&H(y),g=y&&y<128&&J(y)}if(!g&&p){n.push(e.slice(r,i),e.slice(i,i+1)),r=i+1;continue}}if(i+1<a){const p=e.codePointAt(i+1),g=p&&p<128&&ce(p);if(s&&f&&g){const y=e.slice(r,i+1);t.has(y)||(n.push(e.slice(r,i)),r=i)}}}return r<a&&n.push(e.slice(r)),n.filter(i=>i!=="")},"splitCamelCaseFast"),Ee=$((e,t,r)=>{if(e.length===0)return[];const n=e===e.toLocaleUpperCase(t);if(t.startsWith("de")){if(!n&&e.replaceAll("ß","SS")===e.toLocaleUpperCase(t))return[e];const s=[...e],f=s.length,m=[];let c=s[0],u=s[0]===s[0].toLocaleUpperCase(t),p=u,g=u?0:-1;for(let y=1;y<f;y++){const d=s[y],b=d===d.toLocaleUpperCase(t);if(b===u)c+=d;else if(b)c&&c.length>0&&(m.push(c),c=d),p=!0,g=y;else{if(p&&y-g>1){const v=s[y-1],E=c.slice(0,-1);E&&E.length>0&&m.push(E),c=v+d}else c+=d;p=!1,g=-1}u=b}return c&&c.length>0&&m.push(c),m}if(t.startsWith("uk")||t.startsWith("ru")||t.startsWith("bg")||t.startsWith("sr")||t.startsWith("mk")||t.startsWith("be")){if(!_.test(e)&&!O.test(e))return[e];const s=[...e],f=s.length,m=[];let c=s[0];const u=s[0];let p;_.test(u)?p=1:O.test(u)?p=2:p=0;let g=u===u.toLocaleUpperCase(t);for(let d=1;d<f;d++){const b=s[d];let v;_.test(b)?v=1:O.test(b)?v=2:v=0;const E=b===b.toLocaleUpperCase(t);p!==v&&(p===1||p===2)&&(v===1||v===2)||v===p&&!g&&E?(m.push(c),c=b):c+=b,p=v,g=E}c&&c.length>0&&m.push(c);const y=[];for(let d=0;d<m.length;d++)d<m.length-1&&m[d].length===1&&O.test(m[d])&&_.test(m[d+1][0])?(y.push(m[d]+m[d+1]),d+=1):y.push(m[d]);return y}if(t.startsWith("el")){if(!Q.test(e)&&!O.test(e))return[e];const s=[];ae.lastIndex=0;let f;for(;(f=ae.exec(e))!==null;)s.push(f[0]);s.length===0&&s.push(e);const m=[];if(s.length===1){const c=s[0];if(!c||!Q.test(c[0])||c.length===1)return[c??e]}for(const c of s){if(!c)continue;if(!Q.test(c[0])||c.length===1){m.push(c);continue}const u=c.length;let p=c[0],g=c[0]===c[0].toLocaleUpperCase(t);for(let y=1;y<u;y++){const d=c[y],b=d===d.toLocaleUpperCase(t);!g&&b?(m.push(p),p=d):p+=d,g=b}p&&m.push(p)}return m}if(t.startsWith("ja")||t.startsWith("ko")){const s=t.startsWith("ja"),f=s?{hiragana:$(c=>it.test(c),"hiragana"),kanji:$(c=>oe.test(c),"kanji"),katakana:$(c=>ot.test(c),"katakana"),latin:$(c=>O.test(c),"latin")}:{hangul:$(c=>ie.test(c),"hangul"),latin:$(c=>O.test(c),"latin")},m=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(s){const c=A(e,f,!1,t,(p,g)=>p==="hiragana"&&g==="katakana"||p==="katakana"&&g==="hiragana"||p==="hiragana"&&g==="latin"||p==="katakana"&&g==="latin"||p==="kanji"&&g==="latin"||p==="latin"&&(g==="hiragana"||g==="katakana"||g==="kanji")),u=[];for(const p of c){const g=p;g.length===1&&m.has(g)&&u.length>0?u[u.length-1]=u.at(-1)+g:u.push(g)}return u.length>0?u:[e]}return A(e,f,!1,t,(c,u)=>c==="hangul"&&u==="latin"||c==="latin"&&u==="hangul")}if(t.startsWith("sl")){const s=[...e],f=s.length,m=[];let c=s[0],u=s[0]===s[0].toLocaleUpperCase(t);for(let p=1;p<f;p++){const g=s[p],y=g===g.toLocaleUpperCase(t),d=Gt.test(g),b=p<f-1&&s[p+1]===s[p+1].toLocaleUpperCase(t);!u&&y||d&&b?(m.push(c),c=g,d&&b&&(m.push(c),c="")):c+=g,u=y}return c&&c.length>0&&m.push(c),m}if(t.startsWith("zh"))return A(e,{han:$(s=>oe.test(s),"han"),latin:$(s=>O.test(s),"latin")},!1,t);if(["ar","fa","he","ur"].includes(t.split("-")[0])){const s=$(f=>se.test(f)||ne.test(f),"isRtlChar");return A(e,{latin:$(f=>O.test(f),"latin"),rtl:$(f=>s(f),"rtl")},!1,t)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(t.split("-")[0])){const s=$(f=>tt.test(f)||et.test(f)||nt.test(f)||at.test(f)||st.test(f)||mt.test(f)||dt.test(f)||ut.test(f)||ht.test(f)||gt.test(f)||ct.test(f)||yt.test(f)||pt.test(f)||rt.test(f)||lt.test(f)||ft.test(f),"isIndicChar");return A(e,{indic:$(f=>s(f),"indic"),latin:$(f=>O.test(f),"latin")},!1,t)}if(["be","bg","ru","sr","uk"].includes(t))return A(e,{cyrillic:$(s=>_.test(s),"cyrillic"),latin:$(s=>O.test(s),"latin")},!0,t);if(["ar","fa","he"].includes(t))return A(e,{latin:$(s=>O.test(s),"latin"),rtl:$(s=>se.test(s)||ne.test(s),"rtl")},!1,t);if(t.startsWith("ko"))return A(e,{hangul:$(s=>ie.test(s),"hangul"),latin:$(s=>O.test(s),"latin")},!1,t);if(t.startsWith("uz")){if(!_.test(e)&&!O.test(e))return[e];const s=[...e],f=s.length,m=[];let c=s[0],u=s[0]===s[0].toLocaleUpperCase(t);for(let p=1;p<f;p++){const g=s[p],y=g===g.toLocaleUpperCase(t);if(le.test(g)||le.test(s[p-1])){c+=g;continue}!u&&y?(m.push(c),c=g):c+=g,u=y}return c&&c.length>0&&m.push(c),m}const a=[...e],i=a.length,l=[];let o=a[0],h=a[0]===a[0].toLocaleUpperCase(t);for(const s of r)if(e.startsWith(s)){l.push(s),o=a[s.length],h=o===o.toLocaleUpperCase(t);break}for(let s=1;s<i;s++){const f=a[s],m=f===f.toLocaleUpperCase(t);let c=0;for(const u of r)if(e.startsWith(u,s)){l.push(o,u),c=u.length,o="";const p=u.at(-1);p&&(h=p===p.toLocaleUpperCase(t));break}if(c>0){s+=c-1;continue}!h&&m?(l.push(o),o=f):o+=f,h=m}return o&&l.push(o),l},"splitCamelCaseLocale"),Kt=$((e,t,r)=>{const n=[],a=L.test(e)?e.split(L).filter(Boolean):[e];for(const i of a){const l=i;if(L.test(l))n.push(l);else{const o=T.test(l)?Nt(l).filter(Boolean):[l];for(const h of o)if(T.test(h))n.push(h);else if(t){const s=t.toLowerCase().split("-")[0];n.push(...Ee(h,s,r))}else n.push(...je(h,r))}}return n},"processTextWithAnsiEmoji"),G=$((e,t={})=>{if(!e||typeof e!="string")return[];const{handleAnsi:r=!1,handleEmoji:n=!1,knownAcronyms:a=[],locale:i,normalize:l=!1,separators:o,stripAnsi:h=!1,stripEmoji:s=!1}=t,f=new Set([...a].toSorted((d,b)=>b.length-d.length));let m=e;h&&(m=Ut(m)),s&&(m=bt(m));let c;Array.isArray(o)?c=Ft(o):o instanceof RegExp?c=o:c=Ze;const u=[];let p=m;const g=c.flags.includes("g")?c:new RegExp(c.source,`${c.flags}g`);for(;p.length>0;){const d=g.exec(p);if(!d){p===".."?u.push(".."):p==="."?u.push("."):p.length>0&&u.push(p);break}const b=d.index,v=d[0],E=v.length,B=p.slice(0,b),Ue=p.slice(b+E);if(v.startsWith("../"))u.push(".."),p=p.slice(b+3);else if(v.startsWith("./"))u.push("."),p=p.slice(b+2);else if(b===0&&v==="..")u.push(".."),p=p.slice(2);else if(b===0&&v===".")u.push("."),p=p.slice(1);else{B.length>0&&u.push(B);let S=0;for(;(S=v.indexOf("../",S))!==-1;)u.push(".."),S+=3;for(S=0;(S=v.indexOf("./",S))!==-1;)(S===0||v[S-1]!==".")&&u.push("."),S+=2;let P=Ue;for(;P.startsWith("../");)u.push(".."),P=P.slice(3);for(;P.startsWith("./");)u.push("."),P=P.slice(2);if(P===".."){u.push("..");break}else if(P==="."){u.push(".");break}else p=P}g.lastIndex=0}if(u.length===0){const d=m.split(c).filter(Boolean);u.push(...d)}let y=[];for(const d of u)r||n?y.push(...Kt(d,i,f)):i?y.push(...Ee(d,i,f)):y.push(...je(d,f));return l&&(y=y.map(d=>f.has(d)?d:i&&d===d.toLocaleUpperCase(i)?d[0]+d.slice(1).toLocaleLowerCase(i):d.toUpperCase()===d&&!f.has(d)?d.slice(0,1)+d.slice(1).toLowerCase():d)),y},"splitByCase");var Qt=Object.defineProperty,Vt=w((e,t)=>Qt(e,"name",{value:t,configurable:!0}),"r$5"),Ht=Object.defineProperty,Jt=Vt((e,t)=>Ht(e,"name",{value:t,configurable:!0}),"o"),Yt=Object.defineProperty,Xt=Jt((e,t)=>Yt(e,"name",{value:t,configurable:!0}),"s");const Z=Xt((e,t)=>typeof e!="string"||e===""?"":(t?.locale?e[0].toLocaleUpperCase(t.locale):e[0].toUpperCase())+e.slice(1),"upperFirst");var Zt=Object.defineProperty,er=w((e,t)=>Zt(e,"name",{value:t,configurable:!0}),"r$4"),tr=Object.defineProperty,rr=er((e,t)=>tr(e,"name",{value:t,configurable:!0}),"r"),nr=Object.defineProperty,ar=rr((e,t)=>nr(e,"name",{value:t,configurable:!0}),"n");const D=ar((e,t)=>`${e}::${t?.joiner??""}::${t?.locale??""}::${t?.knownAcronyms?.join(",")??""}::${t?.normalize?"true":"false"}`,"generateCacheKey");var ir=Object.defineProperty,sr=w((e,t)=>ir(e,"name",{value:t,configurable:!0}),"i$3"),or=Object.defineProperty,lr=sr((e,t)=>or(e,"name",{value:t,configurable:!0}),"f"),cr=Object.defineProperty,ur=lr((e,t)=>cr(e,"name",{value:t,configurable:!0}),"l");const K=ur((e,t)=>{const{length:r}=e;if(r===0)return"";if(r===1)return e[0];const n=[];let a="",i="";for(let l=0;l<r;l++){const o=e[l];if(L.test(o)){a?(n.push(a+i+o),a="",i=""):(n.length>0&&n.push(t),a=o);continue}a?(i&&(i+=t),i+=o):(n.length>0&&n.push(t),n.push(o))}return n.join("")},"joinSegments");var pr=Object.defineProperty,fr=w((e,t)=>pr(e,"name",{value:t,configurable:!0}),"r$3"),hr=Object.defineProperty,mr=fr((e,t)=>hr(e,"name",{value:t,configurable:!0}),"a"),dr=Object.defineProperty,gr=mr((e,t)=>dr(e,"name",{value:t,configurable:!0}),"e");const yr=/(?<![a-zß])SS(?![a-z])/g,ee=gr(e=>e.replaceAll(yr,"ß"),"normalizeGermanEszett");var br=Object.defineProperty,$r=w((e,t)=>br(e,"name",{value:t,configurable:!0}),"c$3"),vr=Object.defineProperty,wr=$r((e,t)=>vr(e,"name",{value:t,configurable:!0}),"c"),jr=Object.defineProperty,Er=wr((e,t)=>jr(e,"name",{value:t,configurable:!0}),"o");const Or=new W(1e3),kr=Er((e,t)=>{if(typeof e!="string"||!e)return"";const r=t?.cache??!1,n=t?.cacheStore??Or;let a;if(r&&(a=D(e,t)),r&&a&&n.has(a))return n.get(a);let i=!0;const l=K(G(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(o=>{if(t?.handleAnsi&&L.test(o))return o;const h=t?.locale?.startsWith("de")?ee(o):o,s=t?.locale?h.toLocaleLowerCase(t.locale):h.toLowerCase();return i?(i=!1,Pt(s,t)):Z(s,t)}),"");return r&&a&&n.set(a,l),l},"camelCase");var xr=Object.defineProperty,Cr=w((e,t)=>xr(e,"name",{value:t,configurable:!0}),"l$3"),Sr=Object.defineProperty,Pr=Cr((e,t)=>Sr(e,"name",{value:t,configurable:!0}),"l"),Ar=Object.defineProperty,Lr=Pr((e,t)=>Ar(e,"name",{value:t,configurable:!0}),"o");const Wr=new W(1e3),te=Lr((e,t)=>{if(typeof e!="string")return"";const r=t?.cache??!1,n=t?.cacheStore??Wr;let a;if(r&&(a=D(e,t)),r&&a&&n.has(a))return n.get(a);const i=G(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(o=>{if(t?.handleAnsi&&L.test(o))return o;if(t?.toUpperCase)return t.locale?o.toLocaleUpperCase(t.locale):o.toUpperCase();const h=t?.locale?.startsWith("de")?ee(o):o;return t?.locale?h.toLocaleLowerCase(t.locale):h.toLowerCase()}),l=K(i,t?.joiner??"-");return r&&a&&n.set(a,l),l},"kebabCase");var Rr=Object.defineProperty,_r=w((e,t)=>Rr(e,"name",{value:t,configurable:!0}),"r$2"),Ur=Object.defineProperty,Tr=_r((e,t)=>Ur(e,"name",{value:t,configurable:!0}),"a"),zr=Object.defineProperty,Mr=Tr((e,t)=>zr(e,"name",{value:t,configurable:!0}),"s");const Fr=new W(1e3),Br=Mr((e,t)=>te(e,{cacheStore:Fr,...t,joiner:"_",toUpperCase:!0}),"constantCase");var Ir=Object.defineProperty,Nr=w((e,t)=>Ir(e,"name",{value:t,configurable:!0}),"l$2"),qr=Object.defineProperty,Gr=Nr((e,t)=>qr(e,"name",{value:t,configurable:!0}),"l"),Dr=Object.defineProperty,Kr=Gr((e,t)=>Dr(e,"name",{value:t,configurable:!0}),"i");const Qr=new W(1e3),Vr=Kr((e,t)=>{if(typeof e!="string"||!e)return"";const r=t?.cache??!1,n=t?.cacheStore??Qr;let a;if(r&&(a=D(e,t)),r&&a&&n.has(a))return n.get(a);const i=K(G(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(l=>{if(t?.handleAnsi&&L.test(l))return l;const o=t?.locale?.startsWith("de")?ee(l):l;return Z(t?.locale?o.toLocaleLowerCase(t.locale):o.toLowerCase(),{locale:t?.locale})}),"");return r&&a&&n.set(a,i),i},"pascalCase");var Hr=Object.defineProperty,Jr=w((e,t)=>Hr(e,"name",{value:t,configurable:!0}),"r$1"),Yr=Object.defineProperty,Xr=Jr((e,t)=>Yr(e,"name",{value:t,configurable:!0}),"a"),Zr=Object.defineProperty,en=Xr((e,t)=>Zr(e,"name",{value:t,configurable:!0}),"s");const tn=new W(1e3),rn=en((e,t)=>te(e,{cacheStore:tn,...t,joiner:"_"}),"snakeCase");var nn=Object.defineProperty,an=w((e,t)=>nn(e,"name",{value:t,configurable:!0}),"r"),sn=Object.defineProperty,on=an((e,t)=>sn(e,"name",{value:t,configurable:!0}),"e"),ln=Object.defineProperty,cn=on((e,t)=>ln(e,"name",{value:t,configurable:!0}),"i");const un=new W(1e3),pn=cn((e,t)=>{if(typeof e!="string")return"";const r=t?.cache??!1,n=t?.cacheStore??un;let a;if(r&&(a=D(e,t)),r&&a&&n.has(a))return n.get(a);const i=K(G(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(l=>Z(l,{locale:t?.locale})),"-");return r&&a&&n.set(a,i),i},"trainCase");var fn=Object.defineProperty,k=w((e,t)=>fn(e,"name",{value:t,configurable:!0}),"e");const x=k(e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),"stringify"),Y={camel_case:k(e=>kr(x(e)),"camel_case"),kebab_case:k(e=>te(x(e)),"kebab_case"),lower_case:k(e=>x(e).toLowerCase(),"lower_case"),pascal_case:k(e=>Vr(x(e)),"pascal_case"),path_join:k((e,...t)=>{const r=[x(e),...t.map(n=>x(n))];return me(...r)},"path_join"),path_relative:k((e,t)=>he(x(t),x(e)),"path_relative"),snake_case:k(e=>rn(x(e)),"snake_case"),upper_case:k(e=>x(e).toUpperCase(),"upper_case"),upper_kebab_case:k(e=>pn(x(e)),"upper_kebab_case"),upper_snake_case:k(e=>Br(x(e)),"upper_snake_case")};k(e=>Object.hasOwn(Y,e),"isKnownFilter");const Oe=k((e,t,r=[])=>{const n=Y[e];if(!n)throw new Error(`Unknown filter "${e}". Known filters: ${Object.keys(Y).sort().join(", ")}.`);return n(t,...r)},"applyFilter");var hn=Object.defineProperty,ke=w((e,t)=>hn(e,"name",{value:t,configurable:!0}),"d$1");const xe=ke(e=>{const t=[];let r=0,n=0,a,i=-1;for(const l of e){if(i+=1,a){l===a&&(a=void 0);continue}if(l==='"'||l==="'"){a=l;continue}l==="("?r+=1:l===")"?r-=1:l===","&&r===0&&(t.push(e.slice(n,i)),n=i+1)}return t.push(e.slice(n)),t},"splitCommaOutsideQuotes"),mn=ke(e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},"stripQuotes");var dn=Object.defineProperty,R=w((e,t)=>dn(e,"name",{value:t,configurable:!0}),"s$1");const gn=/\[([^\]]+)\]/g,yn=R(e=>{const t=e.trim(),r=t.indexOf("(");if(r===-1)return{args:[],name:t};if(!t.endsWith(")"))throw new Error(`Filter call "${e}" missing closing ")"`);const n=t.slice(0,r).trim(),a=t.slice(r+1,-1).trim();return a===""?{args:[],name:n}:{args:xe(a).map(i=>{const l=i.trim();return mn(l)??l}),name:n}},"parseFilterCall"),bn=R(e=>{const t=e.split("|").map(n=>n.trim()),r=t[0]??"";if(!r)throw new Error(`Empty variable name in expression "${e}"`);return{filters:t.slice(1).map(n=>yn(n)),name:r}},"parsePipe"),$n=R(e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),"stringify"),vn=R((e,t)=>{const r=e.replaceAll(gn,(n,a)=>{const{filters:i,name:l}=bn(a);if(!Object.hasOwn(t,l))throw new Error(`Variable "${l}" used in filename "${e}" but not defined`);let o=t[l];for(const h of i)o=Oe(h.name,o,h.args);return $n(o)});return Ce(r)},"interpolateFilename"),Ce=R(e=>e.split("/").map(t=>t.endsWith(".tera")||t.endsWith(".twig")?t.slice(0,-5):t).join("/"),"stripTeraSuffix"),wn=R(e=>e.endsWith(".raw")?e.slice(0,-4):e,"stripRawSuffix"),jn=R(e=>{const t=e.split("/");return(t.at(-1)??"").startsWith("_")?!0:t.slice(0,-1).includes("partials")},"isPartialPath");var En=Object.defineProperty,On=w((e,t)=>En(e,"name",{value:t,configurable:!0}),"i");const kn=On((e,t)=>{if(!e.startsWith(`---
2
2
  `)&&!e.startsWith(`---\r
3
3
  `))return{body:e};const r=e.indexOf(`
4
4
  ---`,3);if(r===-1)return{body:e};let n=r+1+3;e[n]==="\r"&&(n+=1),e[n]===`
@@ -1,4 +1,4 @@
1
- var fa=Object.defineProperty;var c=(g,n)=>fa(g,"name",{value:n,configurable:!0});import{createRequire as pa}from"node:module";import{h as ya,K as ci,M as Be,n as Do,B as Ji,a as va,z as Aa}from"../packem_chunks/config.js";import{aW as ba,bh as Ca}from"../packem_chunks/bin.js";const da=pa(import.meta.url),vr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ha=c(g=>{if(typeof vr<"u"&&vr.versions&&vr.versions.node){const[n,h]=vr.versions.node.split(".").map(Number);if(n>22||n===22&&h>=3||n===20&&h>=16)return vr.getBuiltinModule(g)}return da(g)},"__cjs_getBuiltinModule"),{cpSync:No,lstatSync:ga,readdirSync:ma,existsSync:Mo,rmSync:si,readFileSync:Vi}=ha("node:fs");var $a=Object.defineProperty,Sa=c((g,n)=>$a(g,"name",{value:n,configurable:!0}),"t");class vt extends Error{static{c(this,"LockfilePruneError")}static{Sa(this,"LockfilePruneError")}constructor(n){super(n),this.name="LockfilePruneError"}}var Ea=Object.defineProperty,Sr=c((g,n)=>Ea(g,"name",{value:n,configurable:!0}),"p");const wa=Sr(g=>{let n="",h=!1,y=!1,S=!1;for(let a=0;a<g.length;a+=1){const m=g[a],e=g[a+1];if(y){m===`
1
+ var fa=Object.defineProperty;var c=(g,n)=>fa(g,"name",{value:n,configurable:!0});import{createRequire as pa}from"node:module";import{h as ya,K as ci,M as Be,n as Do,B as Ji,a as va,z as Aa}from"../packem_chunks/config.js";import{b7 as ba,bh as Ca}from"../packem_chunks/bin.js";const da=pa(import.meta.url),vr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ha=c(g=>{if(typeof vr<"u"&&vr.versions&&vr.versions.node){const[n,h]=vr.versions.node.split(".").map(Number);if(n>22||n===22&&h>=3||n===20&&h>=16)return vr.getBuiltinModule(g)}return da(g)},"__cjs_getBuiltinModule"),{cpSync:No,lstatSync:ga,readdirSync:ma,existsSync:Mo,rmSync:si,readFileSync:Vi}=ha("node:fs");var $a=Object.defineProperty,Sa=c((g,n)=>$a(g,"name",{value:n,configurable:!0}),"t");class vt extends Error{static{c(this,"LockfilePruneError")}static{Sa(this,"LockfilePruneError")}constructor(n){super(n),this.name="LockfilePruneError"}}var Ea=Object.defineProperty,Sr=c((g,n)=>Ea(g,"name",{value:n,configurable:!0}),"p");const wa=Sr(g=>{let n="",h=!1,y=!1,S=!1;for(let a=0;a<g.length;a+=1){const m=g[a],e=g[a+1];if(y){m===`
2
2
  `&&(y=!1,n+=m);continue}if(S){m==="*"&&e==="/"&&(S=!1,a+=1);continue}if(h){if(m==="\\"){n+=m,e!==void 0&&(n+=e,a+=1);continue}m==='"'&&(h=!1),n+=m;continue}if(m==='"'){h=!0,n+=m;continue}if(m==="/"&&e==="/"){y=!0,a+=1;continue}if(m==="/"&&e==="*"){S=!0,a+=1;continue}n+=m}return n},"stripJsonComments"),ka=Sr(g=>{const n=[];for(const h of[g.dependencies,g.devDependencies,g.optionalDependencies,g.peerDependencies])if(h)for(const[y,S]of Object.entries(h))typeof S=="string"&&n.push({name:y,spec:S});return n},"collectWorkspaceDeps"),xa=Sr(g=>{for(const n of g)if(typeof n=="object"&&!Array.isArray(n))return n},"extractMetadata"),Oa=Sr(g=>{if(!g)return[];const n=[];for(const h of["dependencies","optionalDependencies","peerDependencies"]){const y=g[h];y!==null&&typeof y=="object"&&!Array.isArray(y)&&n.push(...Object.keys(y))}return n},"collectMetadataDeps"),ja=Sr(g=>{if(Buffer.isBuffer(g.lockfileContent))return{message:"bun.lockb is binary; run `bun install --save-text-lockfile` to regenerate as bun.lock, then rerun `vis docker scaffold`.",status:"skipped"};const n=wa(g.lockfileContent);let h;try{h=JSON.parse(n)}catch(v){throw new vt(`bun.lock: parse failed — ${v.message}`)}if(!h||typeof h!="object")throw new vt("bun.lock: top-level value is not an object");const y=h.workspaces??{},S=h.packages??{},a=new Set([""]);for(const v of g.closure)a.add(v.relativeRoot===""?"":v.relativeRoot);const m={},e=[];for(const[v,C]of Object.entries(y))a.has(v)&&(m[v]=C,e.push(...ka(C)));const A=new Set;for(const{name:v}of e)A.add(v);const x=[...A];for(;x.length>0;){const v=x.shift();for(const C of Object.keys(S)){if(C.split("/")[0]!==v&&C!==v)continue;const z=xa(S[C]);for(const fe of Oa(z))A.has(fe)||(A.add(fe),x.push(fe))}}const b={};for(const[v,C]of Object.entries(S)){const z=v.split("/")[0];(A.has(z)||A.has(v))&&(b[v]=C)}const E={...h,packages:b,workspaces:m},O=Object.keys(S).length,F=Object.keys(b).length,$=O-F;return{content:`${JSON.stringify(E,null,2)}
3
3
  `,message:`bun.lock: kept ${F}/${O} packages (dropped ${$})`,status:"pruned"}},"pruneBunLockfile");var _a=Object.defineProperty,li=c((g,n)=>_a(g,"name",{value:n,configurable:!0}),"g");const _n="node_modules/",Ta=li((g,n,h)=>{let y=n;for(;;){const S=y===""?`${_n}${h}`:`${y}/${_n}${h}`;if(g[S]!==void 0)return S;if(y==="")return;const a=y.lastIndexOf(`/${_n.slice(0,-1)}/`);y=a===-1?"":y.slice(0,a)}},"resolveDep"),Ra=li(g=>{const n=[];for(const h of[g.dependencies,g.devDependencies,g.optionalDependencies,g.peerDependencies])if(h)for(const y of Object.keys(h))n.push(y);return n},"collectDepNames"),La=li(g=>{const n=typeof g.lockfileContent=="string"?g.lockfileContent:g.lockfileContent.toString("utf8");let h;try{h=JSON.parse(n)}catch(F){throw new vt(`package-lock.json: parse failed — ${F.message}`)}if(!h||typeof h!="object")throw new vt("package-lock.json: top-level value is not an object");const y=h.packages??{},S=new Set([""]);for(const F of g.closure)F.relativeRoot!==""&&S.add(F.relativeRoot);const a=new Set,m=[];for(const F of Object.keys(y))S.has(F)&&(a.add(F),m.push(F));for(const[F,$]of Object.entries(y))$.link===!0&&typeof $.resolved=="string"&&S.has($.resolved)&&a.add(F);for(;m.length>0;){const F=m.shift(),$=y[F];if($)for(const v of Ra($)){const C=Ta(y,F,v);if(!C||a.has(C))continue;a.add(C);const z=y[C];z.link===!0&&typeof z.resolved=="string"&&y[z.resolved]!==void 0&&!a.has(z.resolved)?(a.add(z.resolved),m.push(z.resolved)):m.push(C)}}const e={};for(const F of Object.keys(y))a.has(F)&&(e[F]=y[F]);const A=e[""];A&&Array.isArray(A.workspaces)&&(A.workspaces=A.workspaces.filter(F=>{if(typeof F!="string")return!1;const $=F.replace(/\/?\*+$/,"").replace(/\/$/,"");if($===""||$==="*")return!0;for(const v of S)if(v===F||v===$||v.startsWith(`${$}/`))return!0;return!1}));const x={...h,packages:e};delete x.dependencies;const b=Object.keys(y).length,E=Object.keys(e).length,O=b-E;return{content:`${JSON.stringify(x,null,2)}
4
4
  `,message:`package-lock.json: kept ${E}/${b} entries (dropped ${O})`,status:"pruned"}},"pruneNpmLockfile");var Fa=Object.defineProperty,Zt=c((g,n)=>Fa(g,"name",{value:n,configurable:!0}),"a");const qo=Zt(g=>{let n=g.startsWith("/")?g.slice(1):g;const h=n.indexOf("(");return h!==-1&&(n=n.slice(0,h)),n},"canonicalKey"),Pa=Zt((g,n)=>{if(!(n.startsWith("link:")||n.startsWith("file:")||n.startsWith("workspace:")))return`${g}@${n}`},"resolveDepKey"),Ia=Zt(g=>{const n=[];for(const h of[g.dependencies,g.devDependencies,g.optionalDependencies])if(h)for(const[y,S]of Object.entries(h))S?.version&&n.push({name:y,version:S.version});return n},"collectImporterDeps"),Ki=Zt(g=>{const n=[];for(const h of[g.dependencies,g.optionalDependencies])if(h)for(const[y,S]of Object.entries(h))typeof S=="string"&&n.push({name:y,version:S});return n},"collectPackageDeps"),Gi=Zt(g=>{const n=new Map;if(!g)return n;for(const h of Object.keys(g)){const y=qo(h),S=n.get(y);S?S.push(h):n.set(y,[h])}return n},"buildKeyIndex"),Na=Zt(g=>{const n=typeof g.lockfileContent=="string"?g.lockfileContent:g.lockfileContent.toString("utf8");let h;try{h=ba(n)}catch(C){throw new vt(`pnpm-lock.yaml: parse failed — ${C.message}`)}if(!h||typeof h!="object")throw new vt("pnpm-lock.yaml: top-level value is not an object");const y=h.importers??{},S=Gi(h.packages),a=Gi(h.snapshots),m=new Set(["."]);for(const C of g.closure)m.add(C.relativeRoot===""?".":C.relativeRoot);const e={};for(const[C,z]of Object.entries(y))m.has(C)&&(e[C]=z);const A=new Set,x=new Set,b=[];for(const C of Object.values(e))for(const z of Ia(C))b.push(z);for(;b.length>0;){const{name:C,version:z}=b.shift(),fe=Pa(C,z);if(!fe)continue;const ve=qo(fe),I=a.get(ve)??a.get(fe)??[];for(const pe of I){if(x.has(pe))continue;x.add(pe);const q=h.snapshots?.[pe];if(q)for(const se of Ki(q))b.push(se)}const oe=S.get(ve)??S.get(fe)??[];for(const pe of oe){if(A.has(pe))continue;A.add(pe);const q=h.packages?.[pe];if(q&&!h.snapshots)for(const se of Ki(q))b.push(se)}}const E={lockfileVersion:h.lockfileVersion};for(const C of["settings","overrides","patchedDependencies","catalogs"])h[C]!==void 0&&(E[C]=h[C]);if(E.importers=e,h.packages){const C={};for(const z of Object.keys(h.packages))A.has(z)&&(C[z]=h.packages[z]);E.packages=C}if(h.snapshots){const C={};for(const z of Object.keys(h.snapshots))x.has(z)&&(C[z]=h.snapshots[z]);E.snapshots=C}const O=Object.keys(h.packages??{}).length,F=Object.keys(E.packages??{}).length,$=O-F,v=Object.keys(y).length-Object.keys(e).length;return{content:Ca(E,{lineWidth:0}),message:`pnpm-lock.yaml: kept ${F}/${O} packages and ${Object.keys(e).length} importers (dropped ${$} packages, ${v} importers)`,status:"pruned"}},"prunePnpmLockfile");var Tn={},Le={},Rn,Qi;function Ma(){if(Qi)return Rn;Qi=1;var g=Object.defineProperty,n=c((a,m)=>g(a,"name",{value:m,configurable:!0}),"a");function h(a,m){function e(){this.constructor=a}c(e,"s"),n(e,"ctor"),e.prototype=m.prototype,a.prototype=new e}c(h,"peg$subclass"),n(h,"peg$subclass");function y(a,m,e,A){this.message=a,this.expected=m,this.found=e,this.location=A,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,y)}c(y,"peg$SyntaxError"),n(y,"peg$SyntaxError"),h(y,Error),y.buildMessage=function(a,m){var e={literal:n(function($){return'"'+x($.text)+'"'},"literal"),class:n(function($){var v="",C;for(C=0;C<$.parts.length;C++)v+=$.parts[C]instanceof Array?b($.parts[C][0])+"-"+b($.parts[C][1]):b($.parts[C]);return"["+($.inverted?"^":"")+v+"]"},"class"),any:n(function($){return"any character"},"any"),end:n(function($){return"end of input"},"end"),other:n(function($){return $.description},"other")};function A($){return $.charCodeAt(0).toString(16).toUpperCase()}c(A,"T"),n(A,"hex");function x($){return $.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(v){return"\\x0"+A(v)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(v){return"\\x"+A(v)})}c(x,"q"),n(x,"literalEscape");function b($){return $.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(v){return"\\x0"+A(v)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(v){return"\\x"+A(v)})}c(b,"_"),n(b,"classEscape");function E($){return e[$.type]($)}c(E,"re"),n(E,"describeExpectation");function O($){var v=new Array($.length),C,z;for(C=0;C<$.length;C++)v[C]=E($[C]);if(v.sort(),v.length>0){for(C=1,z=1;C<v.length;C++)v[C-1]!==v[C]&&(v[z]=v[C],z++);v.length=z}switch(v.length){case 1:return v[0];case 2:return v[0]+" or "+v[1];default:return v.slice(0,-1).join(", ")+", or "+v[v.length-1]}}c(O,"le"),n(O,"describeExpected");function F($){return $?'"'+x($)+'"':"end of input"}return c(F,"te"),n(F,"describeFound"),"Expected "+O(a)+" but "+F(m)+" found."};function S(a,m){m=m!==void 0?m:{};var e={},A={Start:pn},x=pn,b=n(function(t){return t||[]},"peg$c0"),E=n(function(t,o,u){return[{command:t,type:o}].concat(u||[])},"peg$c1"),O=n(function(t,o){return[{command:t,type:o||";"}]},"peg$c2"),F=n(function(t){return t},"peg$c3"),$=";",v=ue(";",!1),C="&",z=ue("&",!1),fe=n(function(t,o){return o?{chain:t,then:o}:{chain:t}},"peg$c8"),ve=n(function(t,o){return{type:t,line:o}},"peg$c9"),I="&&",oe=ue("&&",!1),pe="||",q=ue("||",!1),se=n(function(t,o){return o?{...t,then:o}:t},"peg$c14"),Oe=n(function(t,o){return{type:t,chain:o}},"peg$c15"),Ae="|&",Ne=ue("|&",!1),Me="|",De=ue("|",!1),qe="=",rt=ue("=",!1),Se=n(function(t,o){return{name:t,args:[o]}},"peg$c22"),He=n(function(t){return{name:t,args:[]}},"peg$c23"),Ge="(",Qe=ue("(",!1),re=")",Fe=ue(")",!1),We=n(function(t,o){return{type:"subshell",subshell:t,args:o}},"peg$c28"),we="{",ke=ue("{",!1),Ce="}",Re=ue("}",!1),ye=n(function(t,o){return{type:"group",group:t,args:o}},"peg$c33"),Ye=n(function(t,o){return{type:"command",args:o,envs:t}},"peg$c34"),Ue=n(function(t){return{type:"envs",envs:t}},"peg$c35"),Ve=n(function(t){return t},"peg$c36"),Je=n(function(t){return t},"peg$c37"),B=/^[0-9]/,W=Ze([["0","9"]],!1,!1),ae=n(function(t,o,u){return{type:"redirection",subtype:o,fd:t!==null?parseInt(t):null,args:[u]}},"peg$c40"),be=">>",nt=ue(">>",!1),at=">&",st=ue(">&",!1),At=">",Ke=ue(">",!1),ft="<<<",et=ue("<<<",!1),ze="<&",pt=ue("<&",!1),bt="<",dt=ue("<",!1),r=n(function(t){return{type:"argument",segments:[].concat(...t)}},"peg$c53"),_=n(function(t){return t},"peg$c54"),T="$'",Z=ue("$'",!1),H="'",l=ue("'",!1),w=n(function(t){return[{type:"text",text:t}]},"peg$c59"),R='""',L=ue('""',!1),Y=n(function(){return{type:"text",text:""}},"peg$c62"),V='"',P=ue('"',!1),X=n(function(t){return t},"peg$c65"),J=n(function(t){return{type:"arithmetic",arithmetic:t,quoted:!0}},"peg$c66"),ne=n(function(t){return{type:"shell",shell:t,quoted:!0}},"peg$c67"),me=n(function(t){return{type:"variable",...t,quoted:!0}},"peg$c68"),le=n(function(t){return{type:"text",text:t}},"peg$c69"),je=n(function(t){return{type:"arithmetic",arithmetic:t,quoted:!1}},"peg$c70"),Qr=n(function(t){return{type:"shell",shell:t,quoted:!1}},"peg$c71"),zr=n(function(t){return{type:"variable",...t,quoted:!1}},"peg$c72"),wr=n(function(t){return{type:"glob",pattern:t}},"peg$c73"),Ht=/^[^']/,Ut=Ze(["'"],!0,!1),wt=n(function(t){return t.join("")},"peg$c76"),kr=/^[^$"]/,xr=Ze(["$",'"'],!0,!1),tr=`\\