diffray 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +866 -250
- package/dist/defaults/agents/api-design.md +31 -0
- package/dist/defaults/agents/bug-hunter.md +0 -1
- package/dist/defaults/agents/consistency-check.md +27 -0
- package/dist/defaults/agents/data-privacy.md +30 -0
- package/dist/defaults/agents/database.md +30 -0
- package/dist/defaults/agents/general.md +0 -1
- package/dist/defaults/agents/i18n.md +29 -0
- package/dist/defaults/agents/observability.md +30 -0
- package/dist/defaults/agents/performance-check.md +0 -1
- package/dist/defaults/agents/security-scan.md +0 -1
- package/dist/defaults/agents/validation.md +0 -1
- package/dist/defaults/prompts/INDEX.md +178 -0
- package/dist/defaults/prompts/README.md +173 -0
- package/dist/defaults/prompts/SUMMARY.md +276 -0
- package/dist/defaults/prompts/USAGE.md +277 -0
- package/dist/defaults/prompts/api-design.md +119 -0
- package/dist/defaults/prompts/data-privacy.md +144 -0
- package/dist/defaults/prompts/database.md +105 -0
- package/dist/defaults/prompts/i18n.md +89 -0
- package/dist/defaults/prompts/observability.md +142 -0
- package/dist/defaults/rules/code-consistency.md +74 -0
- package/dist/diffray.cjs +347 -0
- package/package.json +29 -13
- package/src/defaults/agents/bug-hunter.md +0 -1
- package/src/defaults/agents/consistency-check.md +27 -0
- package/src/defaults/agents/general.md +0 -1
- package/src/defaults/agents/performance-check.md +0 -1
- package/src/defaults/agents/security-scan.md +0 -1
- package/src/defaults/agents/validation.md +0 -1
- package/src/defaults/rules/code-consistency.md +74 -0
- package/dist/diffray.js +0 -338
package/dist/diffray.cjs
ADDED
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";var $m=Object.create;var So=Object.defineProperty;var Im=Object.getOwnPropertyDescriptor;var Nm=Object.getOwnPropertyNames;var Om=Object.getPrototypeOf,Rm=Object.prototype.hasOwnProperty;var W=(t,e)=>()=>(t&&(e=t(t=0)),e);var _=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Sn=(t,e)=>{for(var s in e)So(t,s,{get:e[s],enumerable:!0})},Pm=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Nm(e))!Rm.call(t,n)&&n!==s&&So(t,n,{get:()=>e[n],enumerable:!(i=Im(e,n))||i.enumerable});return t};var gt=(t,e,s)=>(s=t!=null?$m(Om(t)):{},Pm(e||!t||!t.__esModule?So(s,"default",{value:t,enumerable:!0}):s,t));var Ec={};Sn(Ec,{kCancel:()=>Fc,prompt:()=>Cc});function tg(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function sg(){if(ec)return Oo;ec=1;let t="\x1B",e=`${t}[`,s="\x07",i={to(o,a){return a?`${e}${a+1};${o+1}H`:`${e}${o+1}G`},move(o,a){let u="";return o<0?u+=`${e}${-o}D`:o>0&&(u+=`${e}${o}C`),a<0?u+=`${e}${-a}A`:a>0&&(u+=`${e}${a}B`),u},up:(o=1)=>`${e}${o}A`,down:(o=1)=>`${e}${o}B`,forward:(o=1)=>`${e}${o}C`,backward:(o=1)=>`${e}${o}D`,nextLine:(o=1)=>`${e}E`.repeat(o),prevLine:(o=1)=>`${e}F`.repeat(o),left:`${e}G`,hide:`${e}?25l`,show:`${e}?25h`,save:`${t}7`,restore:`${t}8`},n={up:(o=1)=>`${e}S`.repeat(o),down:(o=1)=>`${e}T`.repeat(o)},r={screen:`${e}2J`,up:(o=1)=>`${e}1J`.repeat(o),down:(o=1)=>`${e}J`.repeat(o),line:`${e}2K`,lineEnd:`${e}K`,lineStart:`${e}1K`,lines(o){let a="";for(let u=0;u<o;u++)a+=this.line+(u<o-1?i.up():"");return o&&(a+=i.left),a}};return Oo={cursor:i,scroll:n,erase:r,beep:s},Oo}function ig(){if(tc)return xn.exports;tc=1;let t=process||{},e=t.argv||[],s=t.env||{},i=!(s.NO_COLOR||e.includes("--no-color"))&&(!!s.FORCE_COLOR||e.includes("--color")||t.platform==="win32"||(t.stdout||{}).isTTY&&s.TERM!=="dumb"||!!s.CI),n=(a,u,l=a)=>c=>{let f=""+c,h=f.indexOf(u,a.length);return~h?a+r(f,u,l,h)+u:a+f+u},r=(a,u,l,c)=>{let f="",h=0;do f+=a.substring(h,c)+l,h=c+u.length,c=a.indexOf(u,h);while(~c);return f+a.substring(h)},o=(a=i)=>{let u=a?n:()=>String;return{isColorSupported:a,reset:u("\x1B[0m","\x1B[0m"),bold:u("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:u("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:u("\x1B[3m","\x1B[23m"),underline:u("\x1B[4m","\x1B[24m"),inverse:u("\x1B[7m","\x1B[27m"),hidden:u("\x1B[8m","\x1B[28m"),strikethrough:u("\x1B[9m","\x1B[29m"),black:u("\x1B[30m","\x1B[39m"),red:u("\x1B[31m","\x1B[39m"),green:u("\x1B[32m","\x1B[39m"),yellow:u("\x1B[33m","\x1B[39m"),blue:u("\x1B[34m","\x1B[39m"),magenta:u("\x1B[35m","\x1B[39m"),cyan:u("\x1B[36m","\x1B[39m"),white:u("\x1B[37m","\x1B[39m"),gray:u("\x1B[90m","\x1B[39m"),bgBlack:u("\x1B[40m","\x1B[49m"),bgRed:u("\x1B[41m","\x1B[49m"),bgGreen:u("\x1B[42m","\x1B[49m"),bgYellow:u("\x1B[43m","\x1B[49m"),bgBlue:u("\x1B[44m","\x1B[49m"),bgMagenta:u("\x1B[45m","\x1B[49m"),bgCyan:u("\x1B[46m","\x1B[49m"),bgWhite:u("\x1B[47m","\x1B[49m"),blackBright:u("\x1B[90m","\x1B[39m"),redBright:u("\x1B[91m","\x1B[39m"),greenBright:u("\x1B[92m","\x1B[39m"),yellowBright:u("\x1B[93m","\x1B[39m"),blueBright:u("\x1B[94m","\x1B[39m"),magentaBright:u("\x1B[95m","\x1B[39m"),cyanBright:u("\x1B[96m","\x1B[39m"),whiteBright:u("\x1B[97m","\x1B[39m"),bgBlackBright:u("\x1B[100m","\x1B[49m"),bgRedBright:u("\x1B[101m","\x1B[49m"),bgGreenBright:u("\x1B[102m","\x1B[49m"),bgYellowBright:u("\x1B[103m","\x1B[49m"),bgBlueBright:u("\x1B[104m","\x1B[49m"),bgMagentaBright:u("\x1B[105m","\x1B[49m"),bgCyanBright:u("\x1B[106m","\x1B[49m"),bgWhiteBright:u("\x1B[107m","\x1B[49m")}};return xn.exports=o(),xn.exports.createColors=o,xn.exports}function rg({onlyFirst:t=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}function dc(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(og,"")}function Dc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function ai(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=dc(t),t.length===0))return 0;t=t.replace(cg()," ");let s=e.ambiguousIsNarrow?1:2,i=0;for(let n of t){let r=n.codePointAt(0);if(!(r<=31||r>=127&&r<=159||r>=768&&r<=879))switch(ug.eastAsianWidth(n)){case"F":case"W":i+=2;break;case"A":i+=s;break;default:i+=1}}return i}function dg(){let t=new Map;for(let[e,s]of Object.entries(Z)){for(let[i,n]of Object.entries(s))Z[i]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},s[i]=Z[i],t.set(n[0],n[1]);Object.defineProperty(Z,e,{value:s,enumerable:!1})}return Object.defineProperty(Z,"codes",{value:t,enumerable:!1}),Z.color.close="\x1B[39m",Z.bgColor.close="\x1B[49m",Z.color.ansi=sc(),Z.color.ansi256=ic(),Z.color.ansi16m=nc(),Z.bgColor.ansi=sc(Ro),Z.bgColor.ansi256=ic(Ro),Z.bgColor.ansi16m=nc(Ro),Object.defineProperties(Z,{rgbToAnsi256:{value:(e,s,i)=>e===s&&s===i?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(s/255*5)+Math.round(i/255*5),enumerable:!1},hexToRgb:{value:e=>{let s=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!s)return[0,0,0];let[i]=s;i.length===3&&(i=[...i].map(r=>r+r).join(""));let n=Number.parseInt(i,16);return[n>>16&255,n>>8&255,n&255]},enumerable:!1},hexToAnsi256:{value:e=>Z.rgbToAnsi256(...Z.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let s,i,n;if(e>=232)s=((e-232)*10+8)/255,i=s,n=s;else{e-=16;let a=e%36;s=Math.floor(e/36)/5,i=Math.floor(a/6)/5,n=a%6/5}let r=Math.max(s,i,n)*2;if(r===0)return 30;let o=30+(Math.round(n)<<2|Math.round(i)<<1|Math.round(s));return r===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,s,i)=>Z.ansi256ToAnsi(Z.rgbToAnsi256(e,s,i)),enumerable:!1},hexToAnsi:{value:e=>Z.ansi256ToAnsi(Z.hexToAnsi256(e)),enumerable:!1}}),Z}function ac(t,e,s){return String(t).normalize().replace(/\r\n/g,`
|
|
3
|
+
`).split(`
|
|
4
|
+
`).map(i=>Fg(i,e,s)).join(`
|
|
5
|
+
`)}function yc(t,e){if(typeof t=="string")return Bn.aliases.get(t)===e;for(let s of t)if(s!==void 0&&yc(s,e))return!0;return!1}function Eg(t,e){if(t===e)return;let s=t.split(`
|
|
6
|
+
`),i=e.split(`
|
|
7
|
+
`),n=[];for(let r=0;r<Math.max(s.length,i.length);r++)s[r]!==i[r]&&n.push(r);return n}function _n(t,e){let s=t;s.isTTY&&s.setRawMode(e)}function Bg(){return fe.default.platform!=="win32"?fe.default.env.TERM!=="linux":!!fe.default.env.CI||!!fe.default.env.WT_SESSION||!!fe.default.env.TERMINUS_SUBLIME||fe.default.env.ConEmuTask==="{cmd::Cmder}"||fe.default.env.TERM_PROGRAM==="Terminus-Sublime"||fe.default.env.TERM_PROGRAM==="vscode"||fe.default.env.TERM==="xterm-256color"||fe.default.env.TERM==="alacritty"||fe.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}async function Cc(t,e={}){let s=i=>{if(typeof i!="symbol"||i.toString()!=="Symbol(clack:cancel)")return i;switch(e.cancel){case"reject":{let n=new Error("Prompt cancelled.");throw n.name="ConsolaPromptCancelledError",Error.captureStackTrace&&Error.captureStackTrace(n,Cc),n}case"undefined":return;case"null":return null;case"symbol":return Fc;default:case"default":return e.default??e.initial}};if(!e.type||e.type==="text")return await Pg({message:t,defaultValue:e.default,placeholder:e.placeholder,initialValue:e.initial}).then(s);if(e.type==="confirm")return await Lg({message:t,initialValue:e.initial}).then(s);if(e.type==="select")return await Mg({message:t,options:e.options.map(i=>typeof i=="string"?{value:i,label:i}:i),initialValue:e.initial}).then(s);if(e.type==="multiselect")return await jg({message:t,options:e.options.map(i=>typeof i=="string"?{value:i,label:i}:i),required:e.required,initialValues:e.initial}).then(s);throw new Error(`Unknown prompt type: ${e.type}`)}var dv,fe,Lo,hc,Oo,ec,Pe,xn,tc,ng,S,og,pc,ag,ug,lg,cg,Ro,sc,ic,nc,Z,fg,hg,Dg,kn,pg,zo,mc,mg,gc,Ko,rc,oc,gg,Po,yg,Fg,Cg,Bn,uc,bg,wg,Ee,ys,Mo,vg,Sg,lc,Ag,xg,_g,cc,jo,qo,kg,Le,Tg,$g,Ig,Ng,H,Fs,Uo,Wo,Og,fc,Rg,Tn,Vo,Pg,Lg,Mg,jg,Fc,bc=W(()=>{dv=require("node:util"),fe=gt(require("node:process"),1),Lo=gt(require("node:readline"),1),hc=require("node:tty");Pe=sg(),xn={exports:{}};ng=ig(),S=tg(ng);og=rg();pc={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(i){var n=i.charCodeAt(0),r=i.length==2?i.charCodeAt(1):0,o=n;return 55296<=n&&n<=56319&&56320<=r&&r<=57343&&(n&=1023,r&=1023,o=n<<10|r,o+=65536),o==12288||65281<=o&&o<=65376||65504<=o&&o<=65510?"F":o==8361||65377<=o&&o<=65470||65474<=o&&o<=65479||65482<=o&&o<=65487||65490<=o&&o<=65495||65498<=o&&o<=65500||65512<=o&&o<=65518?"H":4352<=o&&o<=4447||4515<=o&&o<=4519||4602<=o&&o<=4607||9001<=o&&o<=9002||11904<=o&&o<=11929||11931<=o&&o<=12019||12032<=o&&o<=12245||12272<=o&&o<=12283||12289<=o&&o<=12350||12353<=o&&o<=12438||12441<=o&&o<=12543||12549<=o&&o<=12589||12593<=o&&o<=12686||12688<=o&&o<=12730||12736<=o&&o<=12771||12784<=o&&o<=12830||12832<=o&&o<=12871||12880<=o&&o<=13054||13056<=o&&o<=19903||19968<=o&&o<=42124||42128<=o&&o<=42182||43360<=o&&o<=43388||44032<=o&&o<=55203||55216<=o&&o<=55238||55243<=o&&o<=55291||63744<=o&&o<=64255||65040<=o&&o<=65049||65072<=o&&o<=65106||65108<=o&&o<=65126||65128<=o&&o<=65131||110592<=o&&o<=110593||127488<=o&&o<=127490||127504<=o&&o<=127546||127552<=o&&o<=127560||127568<=o&&o<=127569||131072<=o&&o<=194367||177984<=o&&o<=196605||196608<=o&&o<=262141?"W":32<=o&&o<=126||162<=o&&o<=163||165<=o&&o<=166||o==172||o==175||10214<=o&&o<=10221||10629<=o&&o<=10630?"Na":o==161||o==164||167<=o&&o<=168||o==170||173<=o&&o<=174||176<=o&&o<=180||182<=o&&o<=186||188<=o&&o<=191||o==198||o==208||215<=o&&o<=216||222<=o&&o<=225||o==230||232<=o&&o<=234||236<=o&&o<=237||o==240||242<=o&&o<=243||247<=o&&o<=250||o==252||o==254||o==257||o==273||o==275||o==283||294<=o&&o<=295||o==299||305<=o&&o<=307||o==312||319<=o&&o<=322||o==324||328<=o&&o<=331||o==333||338<=o&&o<=339||358<=o&&o<=359||o==363||o==462||o==464||o==466||o==468||o==470||o==472||o==474||o==476||o==593||o==609||o==708||o==711||713<=o&&o<=715||o==717||o==720||728<=o&&o<=731||o==733||o==735||768<=o&&o<=879||913<=o&&o<=929||931<=o&&o<=937||945<=o&&o<=961||963<=o&&o<=969||o==1025||1040<=o&&o<=1103||o==1105||o==8208||8211<=o&&o<=8214||8216<=o&&o<=8217||8220<=o&&o<=8221||8224<=o&&o<=8226||8228<=o&&o<=8231||o==8240||8242<=o&&o<=8243||o==8245||o==8251||o==8254||o==8308||o==8319||8321<=o&&o<=8324||o==8364||o==8451||o==8453||o==8457||o==8467||o==8470||8481<=o&&o<=8482||o==8486||o==8491||8531<=o&&o<=8532||8539<=o&&o<=8542||8544<=o&&o<=8555||8560<=o&&o<=8569||o==8585||8592<=o&&o<=8601||8632<=o&&o<=8633||o==8658||o==8660||o==8679||o==8704||8706<=o&&o<=8707||8711<=o&&o<=8712||o==8715||o==8719||o==8721||o==8725||o==8730||8733<=o&&o<=8736||o==8739||o==8741||8743<=o&&o<=8748||o==8750||8756<=o&&o<=8759||8764<=o&&o<=8765||o==8776||o==8780||o==8786||8800<=o&&o<=8801||8804<=o&&o<=8807||8810<=o&&o<=8811||8814<=o&&o<=8815||8834<=o&&o<=8835||8838<=o&&o<=8839||o==8853||o==8857||o==8869||o==8895||o==8978||9312<=o&&o<=9449||9451<=o&&o<=9547||9552<=o&&o<=9587||9600<=o&&o<=9615||9618<=o&&o<=9621||9632<=o&&o<=9633||9635<=o&&o<=9641||9650<=o&&o<=9651||9654<=o&&o<=9655||9660<=o&&o<=9661||9664<=o&&o<=9665||9670<=o&&o<=9672||o==9675||9678<=o&&o<=9681||9698<=o&&o<=9701||o==9711||9733<=o&&o<=9734||o==9737||9742<=o&&o<=9743||9748<=o&&o<=9749||o==9756||o==9758||o==9792||o==9794||9824<=o&&o<=9825||9827<=o&&o<=9829||9831<=o&&o<=9834||9836<=o&&o<=9837||o==9839||9886<=o&&o<=9887||9918<=o&&o<=9919||9924<=o&&o<=9933||9935<=o&&o<=9953||o==9955||9960<=o&&o<=9983||o==10045||o==10071||10102<=o&&o<=10111||11093<=o&&o<=11097||12872<=o&&o<=12879||57344<=o&&o<=63743||65024<=o&&o<=65039||o==65533||127232<=o&&o<=127242||127248<=o&&o<=127277||127280<=o&&o<=127337||127344<=o&&o<=127386||917760<=o&&o<=917999||983040<=o&&o<=1048573||1048576<=o&&o<=1114109?"A":"N"},e.characterLength=function(i){var n=this.eastAsianWidth(i);return n=="F"||n=="W"||n=="A"?2:1};function s(i){return i.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(i){for(var n=s(i),r=0,o=0;o<n.length;o++)r=r+this.characterLength(n[o]);return r},e.slice=function(i,n,r){textLen=e.length(i),n=n||0,r=r||1,n<0&&(n=textLen+n),r<0&&(r=textLen+r);for(var o="",a=0,u=s(i),l=0;l<u.length;l++){var c=u[l],f=e.length(c);if(a>=n-(f==2?1:0))if(a+f<=r)o+=c;else break;a+=f}return o}})(pc);ag=pc.exports,ug=Dc(ag),lg=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},cg=Dc(lg);Ro=10,sc=(t=0)=>e=>`\x1B[${e+t}m`,ic=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,nc=(t=0)=>(e,s,i)=>`\x1B[${38+t};2;${e};${s};${i}m`,Z={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(Z.modifier);fg=Object.keys(Z.color),hg=Object.keys(Z.bgColor);[...fg,...hg];Dg=dg(),kn=new Set(["\x1B","\x9B"]),pg=39,zo="\x07",mc="[",mg="]",gc="m",Ko=`${mg}8;;`,rc=t=>`${kn.values().next().value}${mc}${t}${gc}`,oc=t=>`${kn.values().next().value}${Ko}${t}${zo}`,gg=t=>t.split(" ").map(e=>ai(e)),Po=(t,e,s)=>{let i=[...e],n=!1,r=!1,o=ai(dc(t[t.length-1]));for(let[a,u]of i.entries()){let l=ai(u);if(o+l<=s?t[t.length-1]+=u:(t.push(u),o=0),kn.has(u)&&(n=!0,r=i.slice(a+1).join("").startsWith(Ko)),n){r?u===zo&&(n=!1,r=!1):u===gc&&(n=!1);continue}o+=l,o===s&&a<i.length-1&&(t.push(""),o=0)}!o&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},yg=t=>{let e=t.split(" "),s=e.length;for(;s>0&&!(ai(e[s-1])>0);)s--;return s===e.length?t:e.slice(0,s).join(" ")+e.slice(s).join("")},Fg=(t,e,s={})=>{if(s.trim!==!1&&t.trim()==="")return"";let i="",n,r,o=gg(t),a=[""];for(let[l,c]of t.split(" ").entries()){s.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let f=ai(a[a.length-1]);if(l!==0&&(f>=e&&(s.wordWrap===!1||s.trim===!1)&&(a.push(""),f=0),(f>0||s.trim===!1)&&(a[a.length-1]+=" ",f++)),s.hard&&o[l]>e){let h=e-f,d=1+Math.floor((o[l]-h-1)/e);Math.floor((o[l]-1)/e)<d&&a.push(""),Po(a,c,e);continue}if(f+o[l]>e&&f>0&&o[l]>0){if(s.wordWrap===!1&&f<e){Po(a,c,e);continue}a.push("")}if(f+o[l]>e&&s.wordWrap===!1){Po(a,c,e);continue}a[a.length-1]+=c}s.trim!==!1&&(a=a.map(l=>yg(l)));let u=[...a.join(`
|
|
8
|
+
`)];for(let[l,c]of u.entries()){if(i+=c,kn.has(c)){let{groups:h}=new RegExp(`(?:\\${mc}(?<code>\\d+)m|\\${Ko}(?<uri>.*)${zo})`).exec(u.slice(l).join(""))||{groups:{}};if(h.code!==void 0){let d=Number.parseFloat(h.code);n=d===pg?void 0:d}else h.uri!==void 0&&(r=h.uri.length===0?void 0:h.uri)}let f=Dg.codes.get(Number(n));u[l+1]===`
|
|
9
|
+
`?(r&&(i+=oc("")),n&&f&&(i+=rc(f))):c===`
|
|
10
|
+
`&&(n&&f&&(i+=rc(n)),r&&(i+=oc(r)))}return i};Cg=["up","down","left","right","space","enter","cancel"],Bn={actions:new Set(Cg),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};globalThis.process.platform.startsWith("win");uc=Symbol("clack:cancel");bg=Object.defineProperty,wg=(t,e,s)=>e in t?bg(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,Ee=(t,e,s)=>(wg(t,typeof e!="symbol"?e+"":e,s),s),ys=class{constructor(e,s=!0){Ee(this,"input"),Ee(this,"output"),Ee(this,"_abortSignal"),Ee(this,"rl"),Ee(this,"opts"),Ee(this,"_render"),Ee(this,"_track",!1),Ee(this,"_prevFrame",""),Ee(this,"_subscribers",new Map),Ee(this,"_cursor",0),Ee(this,"state","initial"),Ee(this,"error",""),Ee(this,"value");let{input:i=fe.stdin,output:n=fe.stdout,render:r,signal:o,...a}=e;this.opts=a,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=r.bind(this),this._track=s,this._abortSignal=o,this.input=i,this.output=n}unsubscribe(){this._subscribers.clear()}setSubscriber(e,s){let i=this._subscribers.get(e)??[];i.push(s),this._subscribers.set(e,i)}on(e,s){this.setSubscriber(e,{cb:s})}once(e,s){this.setSubscriber(e,{cb:s,once:!0})}emit(e,...s){let i=this._subscribers.get(e)??[],n=[];for(let r of i)r.cb(...s),r.once&&n.push(()=>i.splice(i.indexOf(r),1));for(let r of n)r()}prompt(){return new Promise((e,s)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(uc);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let i=new hc.WriteStream(0);i._write=(n,r,o)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),o()},this.input.pipe(i),this.rl=Lo.default.createInterface({input:this.input,output:i,tabSize:2,prompt:"",escapeCodeTimeout:50}),Lo.default.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),_n(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(Pe.cursor.show),this.output.off("resize",this.render),_n(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(Pe.cursor.show),this.output.off("resize",this.render),_n(this.input,!1),e(uc)})})}onKeypress(e,s){if(this.state==="error"&&(this.state="active"),s?.name&&(!this._track&&Bn.aliases.has(s.name)&&this.emit("cursor",Bn.aliases.get(s.name)),Bn.actions.has(s.name)&&this.emit("cursor",s.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),e===" "&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),e&&this.emit("key",e.toLowerCase()),s?.name==="return"){if(this.opts.validate){let i=this.opts.validate(this.value);i&&(this.error=i instanceof Error?i.message:i,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}yc([e,s?.name,s?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
11
|
+
`),_n(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=ac(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
12
|
+
`).length-1;this.output.write(Pe.cursor.move(-999,e*-1))}render(){let e=ac(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(Pe.cursor.hide);else{let s=Eg(this._prevFrame,e);if(this.restoreCursor(),s&&s?.length===1){let i=s[0];this.output.write(Pe.cursor.move(0,i)),this.output.write(Pe.erase.lines(1));let n=e.split(`
|
|
13
|
+
`);this.output.write(n[i]),this._prevFrame=e,this.output.write(Pe.cursor.move(0,n.length-i-1));return}if(s&&s?.length>1){let i=s[0];this.output.write(Pe.cursor.move(0,i)),this.output.write(Pe.erase.down());let n=e.split(`
|
|
14
|
+
`).slice(i);this.output.write(n.join(`
|
|
15
|
+
`)),this._prevFrame=e;return}this.output.write(Pe.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},Mo=class extends ys{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",s=>{this.output.write(Pe.cursor.move(0,-1)),this.value=s,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}},vg=Object.defineProperty,Sg=(t,e,s)=>e in t?vg(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,lc=(t,e,s)=>(Sg(t,typeof e!="symbol"?e+"":e,s),s),Ag=class extends ys{constructor(t){super(t,!1),lc(this,"options"),lc(this,"cursor",0),this.options=t.options,this.value=[...t.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:e})=>e===t.cursorAt),0),this.on("key",e=>{e==="a"&&this.toggleAll()}),this.on("cursor",e=>{switch(e){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let t=this.value.length===this.options.length;this.value=t?[]:this.options.map(e=>e.value)}toggleValue(){let t=this.value.includes(this._value);this.value=t?this.value.filter(e=>e!==this._value):[...this.value,this._value]}},xg=Object.defineProperty,_g=(t,e,s)=>e in t?xg(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,cc=(t,e,s)=>(_g(t,typeof e!="symbol"?e+"":e,s),s),jo=class extends ys{constructor(e){super(e,!1),cc(this,"options"),cc(this,"cursor",0),this.options=e.options,this.cursor=this.options.findIndex(({value:s})=>s===e.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",s=>{switch(s){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}},qo=class extends ys{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let e=this.value.slice(0,this.cursor),[s,...i]=this.value.slice(this.cursor);return`${e}${S.inverse(s)}${i.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};kg=Bg(),Le=(t,e)=>kg?t:e,Tg=Le("\u276F",">"),$g=Le("\u25A0","x"),Ig=Le("\u25B2","x"),Ng=Le("\u2714","\u221A"),H=Le(""),Fs=Le(""),Uo=Le("\u25CF",">"),Wo=Le("\u25CB"," "),Og=Le("\u25FB","[\u2022]"),fc=Le("\u25FC","[+]"),Rg=Le("\u25FB","[ ]"),Tn=t=>{switch(t){case"initial":case"active":return S.cyan(Tg);case"cancel":return S.red($g);case"error":return S.yellow(Ig);case"submit":return S.green(Ng)}},Vo=t=>{let{cursor:e,options:s,style:i}=t,n=t.maxItems??Number.POSITIVE_INFINITY,r=Math.max(process.stdout.rows-4,0),o=Math.min(r,Math.max(n,5)),a=0;e>=a+o-3?a=Math.max(Math.min(e-o+3,s.length-o),0):e<a+2&&(a=Math.max(e-2,0));let u=o<s.length&&a>0,l=o<s.length&&a+o<s.length;return s.slice(a,a+o).map((c,f,h)=>{let d=f===0&&u,g=f===h.length-1&&l;return d||g?S.dim("..."):i(c,f+a===e)})},Pg=t=>new qo({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${S.gray(H)}
|
|
16
|
+
${Tn(this.state)} ${t.message}
|
|
17
|
+
`,s=t.placeholder?S.inverse(t.placeholder[0])+S.dim(t.placeholder.slice(1)):S.inverse(S.hidden("_")),i=this.value?this.valueWithCursor:s;switch(this.state){case"error":return`${e.trim()}
|
|
18
|
+
${S.yellow(H)} ${i}
|
|
19
|
+
${S.yellow(Fs)} ${S.yellow(this.error)}
|
|
20
|
+
`;case"submit":return`${e}${S.gray(H)} ${S.dim(this.value||t.placeholder)}`;case"cancel":return`${e}${S.gray(H)} ${S.strikethrough(S.dim(this.value??""))}${this.value?.trim()?`
|
|
21
|
+
${S.gray(H)}`:""}`;default:return`${e}${S.cyan(H)} ${i}
|
|
22
|
+
${S.cyan(Fs)}
|
|
23
|
+
`}}}).prompt(),Lg=t=>{let e=t.active??"Yes",s=t.inactive??"No";return new Mo({active:e,inactive:s,initialValue:t.initialValue??!0,render(){let i=`${S.gray(H)}
|
|
24
|
+
${Tn(this.state)} ${t.message}
|
|
25
|
+
`,n=this.value?e:s;switch(this.state){case"submit":return`${i}${S.gray(H)} ${S.dim(n)}`;case"cancel":return`${i}${S.gray(H)} ${S.strikethrough(S.dim(n))}
|
|
26
|
+
${S.gray(H)}`;default:return`${i}${S.cyan(H)} ${this.value?`${S.green(Uo)} ${e}`:`${S.dim(Wo)} ${S.dim(e)}`} ${S.dim("/")} ${this.value?`${S.dim(Wo)} ${S.dim(s)}`:`${S.green(Uo)} ${s}`}
|
|
27
|
+
${S.cyan(Fs)}
|
|
28
|
+
`}}}).prompt()},Mg=t=>{let e=(s,i)=>{let n=s.label??String(s.value);switch(i){case"selected":return`${S.dim(n)}`;case"active":return`${S.green(Uo)} ${n} ${s.hint?S.dim(`(${s.hint})`):""}`;case"cancelled":return`${S.strikethrough(S.dim(n))}`;default:return`${S.dim(Wo)} ${S.dim(n)}`}};return new jo({options:t.options,initialValue:t.initialValue,render(){let s=`${S.gray(H)}
|
|
29
|
+
${Tn(this.state)} ${t.message}
|
|
30
|
+
`;switch(this.state){case"submit":return`${s}${S.gray(H)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${s}${S.gray(H)} ${e(this.options[this.cursor],"cancelled")}
|
|
31
|
+
${S.gray(H)}`;default:return`${s}${S.cyan(H)} ${Vo({cursor:this.cursor,options:this.options,maxItems:t.maxItems,style:(i,n)=>e(i,n?"active":"inactive")}).join(`
|
|
32
|
+
${S.cyan(H)} `)}
|
|
33
|
+
${S.cyan(Fs)}
|
|
34
|
+
`}}}).prompt()},jg=t=>{let e=(s,i)=>{let n=s.label??String(s.value);return i==="active"?`${S.cyan(Og)} ${n} ${s.hint?S.dim(`(${s.hint})`):""}`:i==="selected"?`${S.green(fc)} ${S.dim(n)}`:i==="cancelled"?`${S.strikethrough(S.dim(n))}`:i==="active-selected"?`${S.green(fc)} ${n} ${s.hint?S.dim(`(${s.hint})`):""}`:i==="submitted"?`${S.dim(n)}`:`${S.dim(Rg)} ${S.dim(n)}`};return new Ag({options:t.options,initialValues:t.initialValues,required:t.required??!0,cursorAt:t.cursorAt,validate(s){if(this.required&&s.length===0)return`Please select at least one option.
|
|
35
|
+
${S.reset(S.dim(`Press ${S.gray(S.bgWhite(S.inverse(" space ")))} to select, ${S.gray(S.bgWhite(S.inverse(" enter ")))} to submit`))}`},render(){let s=`${S.gray(H)}
|
|
36
|
+
${Tn(this.state)} ${t.message}
|
|
37
|
+
`,i=(n,r)=>{let o=this.value.includes(n.value);return r&&o?e(n,"active-selected"):o?e(n,"selected"):e(n,r?"active":"inactive")};switch(this.state){case"submit":return`${s}${S.gray(H)} ${this.options.filter(({value:n})=>this.value.includes(n)).map(n=>e(n,"submitted")).join(S.dim(", "))||S.dim("none")}`;case"cancel":{let n=this.options.filter(({value:r})=>this.value.includes(r)).map(r=>e(r,"cancelled")).join(S.dim(", "));return`${s}${S.gray(H)} ${n.trim()?`${n}
|
|
38
|
+
${S.gray(H)}`:""}`}case"error":{let n=this.error.split(`
|
|
39
|
+
`).map((r,o)=>o===0?`${S.yellow(Fs)} ${S.yellow(r)}`:` ${r}`).join(`
|
|
40
|
+
`);return`${s+S.yellow(H)} ${Vo({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:i}).join(`
|
|
41
|
+
${S.yellow(H)} `)}
|
|
42
|
+
${n}
|
|
43
|
+
`}default:return`${s}${S.cyan(H)} ${Vo({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:i}).join(`
|
|
44
|
+
${S.cyan(H)} `)}
|
|
45
|
+
${S.cyan(Fs)}
|
|
46
|
+
`}}}).prompt()};`${S.gray(H)}`;Fc=Symbol.for("cancel")});async function rt(t,e){let s=ia.get(t);if(s!==void 0)return s.value;let i=await e();return ia.set(t,{value:i,timestamp:Date.now()}),i}function fi(t){ia.delete(t)}var ia,be,hi=W(()=>{"use strict";ia=new Map;be={CONFIG:"config",INSTRUCTIONS:"instructions",OUTPUT_FORMAT:"prompt:output-format",VALIDATION_PROMPT:"prompt:validation",GIT_STATUS:"git:status"}});function Nc(){process.stdout.write("\x1B[?25h")}function di(t){if(!t)return"-";if(t.startsWith("embedded:"))return t;let e=(0,Ic.homedir)(),s=process.cwd();return t.startsWith(e)?"~"+t.slice(e.length):t.startsWith(s)?"."+t.slice(s.length):t}var Ic,k,Rn,p,Pn,z0,Es,Q=W(()=>{"use strict";Ic=require("node:os"),k={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",gray:"\x1B[90m"},Rn=new Set;process.on("SIGINT",()=>{for(let t of Rn)t.stop();Nc(),console.log(`
|
|
47
|
+
${k.yellow}!${k.reset} Interrupted - shutting down gracefully`),process.exit(130)});process.on("SIGTERM",()=>{for(let t of Rn)t.stop();Nc(),console.log(`
|
|
48
|
+
${k.yellow}!${k.reset} Terminated - shutting down gracefully`),process.exit(143)});p={success:t=>{console.log(`${k.green}\u2713${k.reset} ${t}`)},error:(t,e)=>{let s=e?`${t} ${e}`:t;console.error(`${k.red}\u2717${k.reset} ${s}`)},warn:(t,e)=>{let s=e?`${t} ${e}`:t;console.warn(`${k.yellow}!${k.reset} ${s}`)},info:t=>{console.log(`${k.blue}\u25CB${k.reset} ${t}`)},debug:t=>{process.env.DEBUG&&console.log(`${k.gray}\xB7${k.reset} ${t}`)},plain:t=>{console.log(t)},load:t=>console.log(`${k.cyan}\u25B8${k.reset} ${t}`),match:t=>console.log(`${k.magenta}\u25C6${k.reset} ${t}`),execute:t=>console.log(`${k.blue}\u203A${k.reset} ${t}`),agent:t=>console.log(`${k.cyan}\u25C9${k.reset} ${t}`),done:t=>console.log(`${k.green}\u2713${k.reset} ${t}`),analyze:t=>console.log(`${k.blue}\u25CB${k.reset} ${t}`),run:t=>console.log(`${k.green}\u25B6${k.reset} ${t}`),stats:t=>console.log(` ${t}`),rocket:t=>console.log(`${k.magenta}\u25B2${k.reset} ${t}`),robot:t=>console.log(`${k.cyan}\u25C9${k.reset} ${t}`),chart:t=>console.log(`${k.blue}\u25A0${k.reset} ${t}`),file:t=>console.log(`${k.gray}\u25C7${k.reset} ${t}`),sync:t=>console.log(`${k.cyan}\u21BB${k.reset} ${t}`),lightning:t=>console.log(`${k.yellow}\u26A1${k.reset} ${t}`),sparkles:t=>console.log(`${k.magenta}\u2726${k.reset} ${t}`),logo:()=>{console.log(`
|
|
49
|
+
\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557
|
|
50
|
+
\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u255A\u2588\u2588\u2557 \u2588\u2588\u2554\u255D
|
|
51
|
+
\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2554\u255D ${k.bold}Multi-agent code review${k.reset}
|
|
52
|
+
\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551 \u255A\u2588\u2588\u2554\u255D
|
|
53
|
+
\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551
|
|
54
|
+
\u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D
|
|
55
|
+
`)},separator:(t="=",e=80)=>{console.log(t.repeat(e))},newline:()=>console.log()};Pn=class{frames=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];intervalId=null;frameIndex=0;message;isSpinning=!1;constructor(e){this.message=e}start(){this.isSpinning||(this.isSpinning=!0,Rn.add(this),this.frameIndex=0,process.stdout.write("\x1B[?25l"),this.intervalId=setInterval(()=>{let e=this.frames[this.frameIndex];process.stdout.write(`\r${k.cyan}${e}${k.reset} ${this.message}`),this.frameIndex=(this.frameIndex+1)%this.frames.length},80))}update(e){this.message=e}succeed(e){this.stop();let s=e||this.message;console.log(`${k.green}\u2713${k.reset} ${s}`)}fail(e){this.stop();let s=e||this.message;console.log(`${k.red}\u2717${k.reset} ${s}`)}warn(e){this.stop();let s=e||this.message;console.log(`${k.yellow}!${k.reset} ${s}`)}stop(){this.isSpinning&&(Rn.delete(this),this.isSpinning=!1,this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null),process.stdout.write("\r\x1B[K"),process.stdout.write("\x1B[?25h"))}},z0=10,Es=class{tasks=new Map;taskOrder=[];intervalId=null;frames=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];frameIndex=0;linesWritten=0;isActive=!1;isDirty=!0;exitHandler=null;addTask(e,s,i,n,r,o){let a={id:e,label:s,status:"pending",detail:o,totalBatches:i,completedBatches:0,fileCount:n,ruleCount:r};this.tasks.set(e,a),this.taskOrder.push(e)}start(){this.isActive||(this.isActive=!0,process.stdout.write("\x1B[?25l"),this.exitHandler=()=>{process.stdout.write("\x1B[?25h")},process.on("exit",this.exitHandler),this.render(),this.intervalId=setInterval(()=>{this.frameIndex=(this.frameIndex+1)%this.frames.length;let e=[...this.tasks.values()].some(s=>s.status==="running");(this.isDirty||e)&&(this.render(),this.isDirty=!1)},80))}startTask(e){let s=this.tasks.get(e);s&&s.status!=="running"&&(s.startTime=Date.now(),s.status="running",this.isDirty=!0)}completeBatch(e){let s=this.tasks.get(e);s&&(s.completedBatches++,this.isDirty=!0,s.completedBatches>=s.totalBatches&&(s.status="done",s.startTime&&(s.duration=Date.now()-s.startTime)))}failTask(e){let s=this.tasks.get(e);s&&(s.status="error",this.isDirty=!0,s.startTime&&(s.duration=Date.now()-s.startTime))}getEstimatedTotal(e){return e.fileCount*e.ruleCount*z0*1e3}calculateProgress(e){if(e.status==="done")return 1;if(e.status==="error")return e.completedBatches/Math.max(1,e.totalBatches);if(e.status!=="running"||!e.startTime)return 0;let s=Date.now()-e.startTime,i=this.getEstimatedTotal(e),n=s/i,r=e.completedBatches/Math.max(1,e.totalBatches);return Math.min(.95,Math.max(n,r))}calculateETA(e){if(e.status!=="running"||!e.startTime)return null;let s=Date.now()-e.startTime,i=this.getEstimatedTotal(e),n=Math.max(0,i-s);return n>1e3?n:null}formatProgressBar(e,s=12){let i=Math.round(e*s),n=s-i;return"\u2588".repeat(i)+"\u2591".repeat(n)}render(){this.linesWritten>0&&process.stdout.write(`\x1B[${this.linesWritten}A`);let e=[],s=this.taskOrder.length;for(let i=0;i<this.taskOrder.length;i++){let n=this.taskOrder[i],r=this.tasks.get(n);if(!r)continue;let o=this.formatTaskLine(r,i+1,s);e.push(o)}for(let i of e)process.stdout.write(`\x1B[K${i}
|
|
56
|
+
`);this.linesWritten=e.length}formatTaskLine(e,s,i){let n=`[${s}/${i}]`.padEnd(7),r=18,o=e.label.length>r?e.label.slice(0,r-1)+"\u2026":e.label.padEnd(r),a,u;switch(e.status){case"pending":a=k.gray,u="\u25CB";break;case"running":a=k.cyan,u=this.frames[this.frameIndex]??"\u280B";break;case"done":a=k.green,u="\u2713";break;case"error":a=k.red,u="\u2717";break}let l=this.calculateProgress(e),c=this.formatProgressBar(l),f=`${a}${c}${k.reset} ${u}`,h="";if(e.status==="running"){let g=this.calculateETA(e);g!==null&&(h=`~${Math.ceil(g/1e3)}s`)}else e.duration!==void 0&&(h=`${(e.duration/1e3).toFixed(1)}s`);let d=e.detail?`${k.dim}| ${e.detail}${k.reset}`:"";return` ${k.dim}${n}${k.reset} ${o} ${f} ${h.padEnd(6)} ${d}`}stop(){this.isActive&&(this.isActive=!1,this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null),this.exitHandler&&(process.removeListener("exit",this.exitHandler),this.exitHandler=null),this.render(),process.stdout.write("\x1B[?25h"))}}});var q,ra,B,Je,pi=W(()=>{(function(t){t.assertEqual=n=>{};function e(n){}t.assertIs=e;function s(n){throw new Error}t.assertNever=s,t.arrayToEnum=n=>{let r={};for(let o of n)r[o]=o;return r},t.getValidEnumValues=n=>{let r=t.objectKeys(n).filter(a=>typeof n[n[a]]!="number"),o={};for(let a of r)o[a]=n[a];return t.objectValues(o)},t.objectValues=n=>t.objectKeys(n).map(function(r){return n[r]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let r=[];for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&r.push(o);return r},t.find=(n,r)=>{for(let o of n)if(r(o))return o},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function i(n,r=" | "){return n.map(o=>typeof o=="string"?`'${o}'`:o).join(r)}t.joinValues=i,t.jsonStringifyReplacer=(n,r)=>typeof r=="bigint"?r.toString():r})(q||(q={}));(function(t){t.mergeShapes=(e,s)=>({...e,...s})})(ra||(ra={}));B=q.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Je=t=>{switch(typeof t){case"undefined":return B.undefined;case"string":return B.string;case"number":return Number.isNaN(t)?B.nan:B.number;case"boolean":return B.boolean;case"function":return B.function;case"bigint":return B.bigint;case"symbol":return B.symbol;case"object":return Array.isArray(t)?B.array:t===null?B.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?B.promise:typeof Map<"u"&&t instanceof Map?B.map:typeof Set<"u"&&t instanceof Set?B.set:typeof Date<"u"&&t instanceof Date?B.date:B.object;default:return B.unknown}}});var v,X0,ge,Ln=W(()=>{pi();v=q.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),X0=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),ge=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=e}format(e){let s=e||function(r){return r.message},i={_errors:[]},n=r=>{for(let o of r.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)i._errors.push(s(o));else{let a=i,u=0;for(;u<o.path.length;){let l=o.path[u];u===o.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(s(o))):a[l]=a[l]||{_errors:[]},a=a[l],u++}}};return n(this),i}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,q.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=s=>s.message){let s={},i=[];for(let n of this.issues)if(n.path.length>0){let r=n.path[0];s[r]=s[r]||[],s[r].push(e(n))}else i.push(e(n));return{formErrors:i,fieldErrors:s}}get formErrors(){return this.flatten()}};ge.create=t=>new ge(t)});var ey,ot,oa=W(()=>{Ln();pi();ey=(t,e)=>{let s;switch(t.code){case v.invalid_type:t.received===B.undefined?s="Required":s=`Expected ${t.expected}, received ${t.received}`;break;case v.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(t.expected,q.jsonStringifyReplacer)}`;break;case v.unrecognized_keys:s=`Unrecognized key(s) in object: ${q.joinValues(t.keys,", ")}`;break;case v.invalid_union:s="Invalid input";break;case v.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${q.joinValues(t.options)}`;break;case v.invalid_enum_value:s=`Invalid enum value. Expected ${q.joinValues(t.options)}, received '${t.received}'`;break;case v.invalid_arguments:s="Invalid function arguments";break;case v.invalid_return_type:s="Invalid function return type";break;case v.invalid_date:s="Invalid date";break;case v.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(s=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?s=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?s=`Invalid input: must end with "${t.validation.endsWith}"`:q.assertNever(t.validation):t.validation!=="regex"?s=`Invalid ${t.validation}`:s="Invalid";break;case v.too_small:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:s="Invalid input";break;case v.too_big:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?s=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:s="Invalid input";break;case v.custom:s="Invalid input";break;case v.invalid_intersection_types:s="Intersection results could not be merged";break;case v.not_multiple_of:s=`Number must be a multiple of ${t.multipleOf}`;break;case v.not_finite:s="Number must be finite";break;default:s=e.defaultError,q.assertNever(t)}return{message:s}},ot=ey});function ty(t){Yc=t}function bs(){return Yc}var Yc,Mn=W(()=>{oa();Yc=ot});function x(t,e){let s=bs(),i=mi({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,s,s===ot?void 0:ot].filter(n=>!!n)});t.common.issues.push(i)}var mi,sy,ae,I,Ut,he,jn,qn,Et,ws,aa=W(()=>{Mn();oa();mi=t=>{let{data:e,path:s,errorMaps:i,issueData:n}=t,r=[...s,...n.path||[]],o={...n,path:r};if(n.message!==void 0)return{...n,path:r,message:n.message};let a="",u=i.filter(l=>!!l).slice().reverse();for(let l of u)a=l(o,{data:e,defaultError:a}).message;return{...n,path:r,message:a}},sy=[];ae=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,s){let i=[];for(let n of s){if(n.status==="aborted")return I;n.status==="dirty"&&e.dirty(),i.push(n.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,s){let i=[];for(let n of s){let r=await n.key,o=await n.value;i.push({key:r,value:o})}return t.mergeObjectSync(e,i)}static mergeObjectSync(e,s){let i={};for(let n of s){let{key:r,value:o}=n;if(r.status==="aborted"||o.status==="aborted")return I;r.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),r.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet)&&(i[r.value]=o.value)}return{status:e.value,value:i}}},I=Object.freeze({status:"aborted"}),Ut=t=>({status:"dirty",value:t}),he=t=>({status:"valid",value:t}),jn=t=>t.status==="aborted",qn=t=>t.status==="dirty",Et=t=>t.status==="valid",ws=t=>typeof Promise<"u"&&t instanceof Promise});var Jc=W(()=>{});var T,Hc=W(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(T||(T={}))});function P(t){if(!t)return{};let{errorMap:e,invalid_type_error:s,required_error:i,description:n}=t;if(e&&(s||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(o,a)=>{let{message:u}=t;return o.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:u??i??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:u??s??a.defaultError}},description:n}}function ef(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let s=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${s}`}function Fy(t){return new RegExp(`^${ef(t)}$`)}function tf(t){let e=`${Xc}T${ef(t)}`,s=[];return s.push(t.local?"Z?":"Z"),t.offset&&s.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${s.join("|")})`,new RegExp(`^${e}$`)}function Cy(t,e){return!!((e==="v4"||!e)&&hy.test(t)||(e==="v6"||!e)&&Dy.test(t))}function Ey(t,e){if(!uy.test(t))return!1;try{let[s]=t.split(".");if(!s)return!1;let i=s.replace(/-/g,"+").replace(/_/g,"/").padEnd(s.length+(4-s.length%4)%4,"="),n=JSON.parse(atob(i));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function by(t,e){return!!((e==="v4"||!e)&&dy.test(t)||(e==="v6"||!e)&&py.test(t))}function wy(t,e){let s=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,n=s>i?s:i,r=Number.parseInt(t.toFixed(n).replace(".","")),o=Number.parseInt(e.toFixed(n).replace(".",""));return r%o/10**n}function vs(t){if(t instanceof ye){let e={};for(let s in t.shape){let i=t.shape[s];e[s]=_e.create(vs(i))}return new ye({...t._def,shape:()=>e})}else return t instanceof lt?new lt({...t._def,type:vs(t.element)}):t instanceof _e?_e.create(vs(t.unwrap())):t instanceof Ze?Ze.create(vs(t.unwrap())):t instanceof He?He.create(t.items.map(e=>vs(e))):t}function la(t,e){let s=Je(t),i=Je(e);if(t===e)return{valid:!0,data:t};if(s===B.object&&i===B.object){let n=q.objectKeys(e),r=q.objectKeys(t).filter(a=>n.indexOf(a)!==-1),o={...t,...e};for(let a of r){let u=la(t[a],e[a]);if(!u.valid)return{valid:!1};o[a]=u.data}return{valid:!0,data:o}}else if(s===B.array&&i===B.array){if(t.length!==e.length)return{valid:!1};let n=[];for(let r=0;r<t.length;r++){let o=t[r],a=e[r],u=la(o,a);if(!u.valid)return{valid:!1};n.push(u.data)}return{valid:!0,data:n}}else return s===B.date&&i===B.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function sf(t,e){return new Xt({values:t,typeName:N.ZodEnum,...P(e)})}function Qc(t,e){let s=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof s=="string"?{message:s}:s}function nf(t,e={},s){return t?wt.create().superRefine((i,n)=>{let r=t(i);if(r instanceof Promise)return r.then(o=>{if(!o){let a=Qc(e,i),u=a.fatal??s??!0;n.addIssue({code:"custom",...a,fatal:u})}});if(!r){let o=Qc(e,i),a=o.fatal??s??!0;n.addIssue({code:"custom",...o,fatal:a})}}):wt.create()}var Be,Zc,M,iy,ny,ry,oy,ay,uy,ly,cy,fy,ua,hy,dy,Dy,py,my,gy,Xc,yy,bt,Wt,Vt,zt,Kt,Ss,Gt,Yt,wt,ut,je,As,lt,ye,Jt,at,Un,Ht,He,Wn,xs,_s,Vn,Zt,Qt,Xt,es,vt,ke,_e,Ze,ts,ss,Bs,vy,gi,yi,is,Sy,N,Ay,rf,of,xy,_y,af,By,ky,Ty,$y,Iy,Ny,Oy,Ry,Py,Ly,My,jy,qy,Uy,Wy,Vy,zy,Ky,Gy,Yy,Jy,Hy,Zy,Qy,Xy,eF,tF,sF,iF,nF,rF,oF,aF,uF,uf=W(()=>{Ln();Mn();Hc();aa();pi();Be=class{constructor(e,s,i,n){this._cachedPath=[],this.parent=e,this.data=s,this._path=i,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Zc=(t,e)=>{if(Et(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let s=new ge(t.common.issues);return this._error=s,this._error}}};M=class{get description(){return this._def.description}_getType(e){return Je(e.data)}_getOrReturnCtx(e,s){return s||{common:e.parent.common,data:e.data,parsedType:Je(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ae,ctx:{common:e.parent.common,data:e.data,parsedType:Je(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let s=this._parse(e);if(ws(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(e){let s=this._parse(e);return Promise.resolve(s)}parse(e,s){let i=this.safeParse(e,s);if(i.success)return i.data;throw i.error}safeParse(e,s){let i={common:{issues:[],async:s?.async??!1,contextualErrorMap:s?.errorMap},path:s?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Je(e)},n=this._parseSync({data:e,path:i.path,parent:i});return Zc(i,n)}"~validate"(e){let s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Je(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:s});return Et(i)?{value:i.value}:{issues:s.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(i=>Et(i)?{value:i.value}:{issues:s.common.issues})}async parseAsync(e,s){let i=await this.safeParseAsync(e,s);if(i.success)return i.data;throw i.error}async safeParseAsync(e,s){let i={common:{issues:[],contextualErrorMap:s?.errorMap,async:!0},path:s?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Je(e)},n=this._parse({data:e,path:i.path,parent:i}),r=await(ws(n)?n:Promise.resolve(n));return Zc(i,r)}refine(e,s){let i=n=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(n):s;return this._refinement((n,r)=>{let o=e(n),a=()=>r.addIssue({code:v.custom,...i(n)});return typeof Promise<"u"&&o instanceof Promise?o.then(u=>u?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,s){return this._refinement((i,n)=>e(i)?!0:(n.addIssue(typeof s=="function"?s(i,n):s),!1))}_refinement(e){return new ke({schema:this,typeName:N.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:s=>this["~validate"](s)}}optional(){return _e.create(this,this._def)}nullable(){return Ze.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return lt.create(this)}promise(){return vt.create(this,this._def)}or(e){return Jt.create([this,e],this._def)}and(e){return Ht.create(this,e,this._def)}transform(e){return new ke({...P(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let s=typeof e=="function"?e:()=>e;return new ts({...P(this._def),innerType:this,defaultValue:s,typeName:N.ZodDefault})}brand(){return new gi({typeName:N.ZodBranded,type:this,...P(this._def)})}catch(e){let s=typeof e=="function"?e:()=>e;return new ss({...P(this._def),innerType:this,catchValue:s,typeName:N.ZodCatch})}describe(e){let s=this.constructor;return new s({...this._def,description:e})}pipe(e){return yi.create(this,e)}readonly(){return is.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},iy=/^c[^\s-]{8,}$/i,ny=/^[0-9a-z]+$/,ry=/^[0-9A-HJKMNP-TV-Z]{26}$/i,oy=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ay=/^[a-z0-9_-]{21}$/i,uy=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ly=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,cy=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,fy="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",hy=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,dy=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Dy=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,py=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,my=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,gy=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Xc="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",yy=new RegExp(`^${Xc}$`);bt=class t extends M{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==B.string){let r=this._getOrReturnCtx(e);return x(r,{code:v.invalid_type,expected:B.string,received:r.parsedType}),I}let i=new ae,n;for(let r of this._def.checks)if(r.kind==="min")e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:v.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),i.dirty());else if(r.kind==="max")e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:v.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),i.dirty());else if(r.kind==="length"){let o=e.data.length>r.value,a=e.data.length<r.value;(o||a)&&(n=this._getOrReturnCtx(e,n),o?x(n,{code:v.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):a&&x(n,{code:v.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),i.dirty())}else if(r.kind==="email")cy.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"email",code:v.invalid_string,message:r.message}),i.dirty());else if(r.kind==="emoji")ua||(ua=new RegExp(fy,"u")),ua.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"emoji",code:v.invalid_string,message:r.message}),i.dirty());else if(r.kind==="uuid")oy.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"uuid",code:v.invalid_string,message:r.message}),i.dirty());else if(r.kind==="nanoid")ay.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"nanoid",code:v.invalid_string,message:r.message}),i.dirty());else if(r.kind==="cuid")iy.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"cuid",code:v.invalid_string,message:r.message}),i.dirty());else if(r.kind==="cuid2")ny.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"cuid2",code:v.invalid_string,message:r.message}),i.dirty());else if(r.kind==="ulid")ry.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"ulid",code:v.invalid_string,message:r.message}),i.dirty());else if(r.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),x(n,{validation:"url",code:v.invalid_string,message:r.message}),i.dirty()}else r.kind==="regex"?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"regex",code:v.invalid_string,message:r.message}),i.dirty())):r.kind==="trim"?e.data=e.data.trim():r.kind==="includes"?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),x(n,{code:v.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),i.dirty()):r.kind==="toLowerCase"?e.data=e.data.toLowerCase():r.kind==="toUpperCase"?e.data=e.data.toUpperCase():r.kind==="startsWith"?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),x(n,{code:v.invalid_string,validation:{startsWith:r.value},message:r.message}),i.dirty()):r.kind==="endsWith"?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),x(n,{code:v.invalid_string,validation:{endsWith:r.value},message:r.message}),i.dirty()):r.kind==="datetime"?tf(r).test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:v.invalid_string,validation:"datetime",message:r.message}),i.dirty()):r.kind==="date"?yy.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:v.invalid_string,validation:"date",message:r.message}),i.dirty()):r.kind==="time"?Fy(r).test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:v.invalid_string,validation:"time",message:r.message}),i.dirty()):r.kind==="duration"?ly.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"duration",code:v.invalid_string,message:r.message}),i.dirty()):r.kind==="ip"?Cy(e.data,r.version)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"ip",code:v.invalid_string,message:r.message}),i.dirty()):r.kind==="jwt"?Ey(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"jwt",code:v.invalid_string,message:r.message}),i.dirty()):r.kind==="cidr"?by(e.data,r.version)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"cidr",code:v.invalid_string,message:r.message}),i.dirty()):r.kind==="base64"?my.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"base64",code:v.invalid_string,message:r.message}),i.dirty()):r.kind==="base64url"?gy.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"base64url",code:v.invalid_string,message:r.message}),i.dirty()):q.assertNever(r);return{status:i.value,value:e.data}}_regex(e,s,i){return this.refinement(n=>e.test(n),{validation:s,code:v.invalid_string,...T.errToObj(i)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...T.errToObj(e)})}url(e){return this._addCheck({kind:"url",...T.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...T.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...T.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...T.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...T.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...T.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...T.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...T.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...T.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...T.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...T.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...T.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...T.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...T.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...T.errToObj(e)})}regex(e,s){return this._addCheck({kind:"regex",regex:e,...T.errToObj(s)})}includes(e,s){return this._addCheck({kind:"includes",value:e,position:s?.position,...T.errToObj(s?.message)})}startsWith(e,s){return this._addCheck({kind:"startsWith",value:e,...T.errToObj(s)})}endsWith(e,s){return this._addCheck({kind:"endsWith",value:e,...T.errToObj(s)})}min(e,s){return this._addCheck({kind:"min",value:e,...T.errToObj(s)})}max(e,s){return this._addCheck({kind:"max",value:e,...T.errToObj(s)})}length(e,s){return this._addCheck({kind:"length",value:e,...T.errToObj(s)})}nonempty(e){return this.min(1,T.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxLength(){let e=null;for(let s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}};bt.create=t=>new bt({checks:[],typeName:N.ZodString,coerce:t?.coerce??!1,...P(t)});Wt=class t extends M{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==B.number){let r=this._getOrReturnCtx(e);return x(r,{code:v.invalid_type,expected:B.number,received:r.parsedType}),I}let i,n=new ae;for(let r of this._def.checks)r.kind==="int"?q.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),x(i,{code:v.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty()):r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(i=this._getOrReturnCtx(e,i),x(i,{code:v.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(i=this._getOrReturnCtx(e,i),x(i,{code:v.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind==="multipleOf"?wy(e.data,r.value)!==0&&(i=this._getOrReturnCtx(e,i),x(i,{code:v.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),x(i,{code:v.not_finite,message:r.message}),n.dirty()):q.assertNever(r);return{status:n.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,T.toString(s))}gt(e,s){return this.setLimit("min",e,!1,T.toString(s))}lte(e,s){return this.setLimit("max",e,!0,T.toString(s))}lt(e,s){return this.setLimit("max",e,!1,T.toString(s))}setLimit(e,s,i,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:i,message:T.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:T.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:T.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:T.toString(s)})}finite(e){return this._addCheck({kind:"finite",message:T.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:T.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:T.toString(e)})}get minValue(){let e=null;for(let s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(let s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&q.isInteger(e.value))}get isFinite(){let e=null,s=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(s===null||i.value>s)&&(s=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(s)&&Number.isFinite(e)}};Wt.create=t=>new Wt({checks:[],typeName:N.ZodNumber,coerce:t?.coerce||!1,...P(t)});Vt=class t extends M{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==B.bigint)return this._getInvalidInput(e);let i,n=new ae;for(let r of this._def.checks)r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(i=this._getOrReturnCtx(e,i),x(i,{code:v.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(i=this._getOrReturnCtx(e,i),x(i,{code:v.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind==="multipleOf"?e.data%r.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),x(i,{code:v.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):q.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let s=this._getOrReturnCtx(e);return x(s,{code:v.invalid_type,expected:B.bigint,received:s.parsedType}),I}gte(e,s){return this.setLimit("min",e,!0,T.toString(s))}gt(e,s){return this.setLimit("min",e,!1,T.toString(s))}lte(e,s){return this.setLimit("max",e,!0,T.toString(s))}lt(e,s){return this.setLimit("max",e,!1,T.toString(s))}setLimit(e,s,i,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:i,message:T.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:T.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:T.toString(s)})}get minValue(){let e=null;for(let s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(let s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}};Vt.create=t=>new Vt({checks:[],typeName:N.ZodBigInt,coerce:t?.coerce??!1,...P(t)});zt=class extends M{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==B.boolean){let i=this._getOrReturnCtx(e);return x(i,{code:v.invalid_type,expected:B.boolean,received:i.parsedType}),I}return he(e.data)}};zt.create=t=>new zt({typeName:N.ZodBoolean,coerce:t?.coerce||!1,...P(t)});Kt=class t extends M{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==B.date){let r=this._getOrReturnCtx(e);return x(r,{code:v.invalid_type,expected:B.date,received:r.parsedType}),I}if(Number.isNaN(e.data.getTime())){let r=this._getOrReturnCtx(e);return x(r,{code:v.invalid_date}),I}let i=new ae,n;for(let r of this._def.checks)r.kind==="min"?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:v.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),i.dirty()):r.kind==="max"?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:v.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),i.dirty()):q.assertNever(r);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,s){return this._addCheck({kind:"min",value:e.getTime(),message:T.toString(s)})}max(e,s){return this._addCheck({kind:"max",value:e.getTime(),message:T.toString(s)})}get minDate(){let e=null;for(let s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e!=null?new Date(e):null}};Kt.create=t=>new Kt({checks:[],coerce:t?.coerce||!1,typeName:N.ZodDate,...P(t)});Ss=class extends M{_parse(e){if(this._getType(e)!==B.symbol){let i=this._getOrReturnCtx(e);return x(i,{code:v.invalid_type,expected:B.symbol,received:i.parsedType}),I}return he(e.data)}};Ss.create=t=>new Ss({typeName:N.ZodSymbol,...P(t)});Gt=class extends M{_parse(e){if(this._getType(e)!==B.undefined){let i=this._getOrReturnCtx(e);return x(i,{code:v.invalid_type,expected:B.undefined,received:i.parsedType}),I}return he(e.data)}};Gt.create=t=>new Gt({typeName:N.ZodUndefined,...P(t)});Yt=class extends M{_parse(e){if(this._getType(e)!==B.null){let i=this._getOrReturnCtx(e);return x(i,{code:v.invalid_type,expected:B.null,received:i.parsedType}),I}return he(e.data)}};Yt.create=t=>new Yt({typeName:N.ZodNull,...P(t)});wt=class extends M{constructor(){super(...arguments),this._any=!0}_parse(e){return he(e.data)}};wt.create=t=>new wt({typeName:N.ZodAny,...P(t)});ut=class extends M{constructor(){super(...arguments),this._unknown=!0}_parse(e){return he(e.data)}};ut.create=t=>new ut({typeName:N.ZodUnknown,...P(t)});je=class extends M{_parse(e){let s=this._getOrReturnCtx(e);return x(s,{code:v.invalid_type,expected:B.never,received:s.parsedType}),I}};je.create=t=>new je({typeName:N.ZodNever,...P(t)});As=class extends M{_parse(e){if(this._getType(e)!==B.undefined){let i=this._getOrReturnCtx(e);return x(i,{code:v.invalid_type,expected:B.void,received:i.parsedType}),I}return he(e.data)}};As.create=t=>new As({typeName:N.ZodVoid,...P(t)});lt=class t extends M{_parse(e){let{ctx:s,status:i}=this._processInputParams(e),n=this._def;if(s.parsedType!==B.array)return x(s,{code:v.invalid_type,expected:B.array,received:s.parsedType}),I;if(n.exactLength!==null){let o=s.data.length>n.exactLength.value,a=s.data.length<n.exactLength.value;(o||a)&&(x(s,{code:o?v.too_big:v.too_small,minimum:a?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),i.dirty())}if(n.minLength!==null&&s.data.length<n.minLength.value&&(x(s,{code:v.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),i.dirty()),n.maxLength!==null&&s.data.length>n.maxLength.value&&(x(s,{code:v.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),i.dirty()),s.common.async)return Promise.all([...s.data].map((o,a)=>n.type._parseAsync(new Be(s,o,s.path,a)))).then(o=>ae.mergeArray(i,o));let r=[...s.data].map((o,a)=>n.type._parseSync(new Be(s,o,s.path,a)));return ae.mergeArray(i,r)}get element(){return this._def.type}min(e,s){return new t({...this._def,minLength:{value:e,message:T.toString(s)}})}max(e,s){return new t({...this._def,maxLength:{value:e,message:T.toString(s)}})}length(e,s){return new t({...this._def,exactLength:{value:e,message:T.toString(s)}})}nonempty(e){return this.min(1,e)}};lt.create=(t,e)=>new lt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...P(e)});ye=class t extends M{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),s=q.objectKeys(e);return this._cached={shape:e,keys:s},this._cached}_parse(e){if(this._getType(e)!==B.object){let l=this._getOrReturnCtx(e);return x(l,{code:v.invalid_type,expected:B.object,received:l.parsedType}),I}let{status:i,ctx:n}=this._processInputParams(e),{shape:r,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof je&&this._def.unknownKeys==="strip"))for(let l in n.data)o.includes(l)||a.push(l);let u=[];for(let l of o){let c=r[l],f=n.data[l];u.push({key:{status:"valid",value:l},value:c._parse(new Be(n,f,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof je){let l=this._def.unknownKeys;if(l==="passthrough")for(let c of a)u.push({key:{status:"valid",value:c},value:{status:"valid",value:n.data[c]}});else if(l==="strict")a.length>0&&(x(n,{code:v.unrecognized_keys,keys:a}),i.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let c of a){let f=n.data[c];u.push({key:{status:"valid",value:c},value:l._parse(new Be(n,f,n.path,c)),alwaysSet:c in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let c of u){let f=await c.key,h=await c.value;l.push({key:f,value:h,alwaysSet:c.alwaysSet})}return l}).then(l=>ae.mergeObjectSync(i,l)):ae.mergeObjectSync(i,u)}get shape(){return this._def.shape()}strict(e){return T.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(s,i)=>{let n=this._def.errorMap?.(s,i).message??i.defaultError;return s.code==="unrecognized_keys"?{message:T.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:N.ZodObject})}setKey(e,s){return this.augment({[e]:s})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let s={};for(let i of q.objectKeys(e))e[i]&&this.shape[i]&&(s[i]=this.shape[i]);return new t({...this._def,shape:()=>s})}omit(e){let s={};for(let i of q.objectKeys(this.shape))e[i]||(s[i]=this.shape[i]);return new t({...this._def,shape:()=>s})}deepPartial(){return vs(this)}partial(e){let s={};for(let i of q.objectKeys(this.shape)){let n=this.shape[i];e&&!e[i]?s[i]=n:s[i]=n.optional()}return new t({...this._def,shape:()=>s})}required(e){let s={};for(let i of q.objectKeys(this.shape))if(e&&!e[i])s[i]=this.shape[i];else{let r=this.shape[i];for(;r instanceof _e;)r=r._def.innerType;s[i]=r}return new t({...this._def,shape:()=>s})}keyof(){return sf(q.objectKeys(this.shape))}};ye.create=(t,e)=>new ye({shape:()=>t,unknownKeys:"strip",catchall:je.create(),typeName:N.ZodObject,...P(e)});ye.strictCreate=(t,e)=>new ye({shape:()=>t,unknownKeys:"strict",catchall:je.create(),typeName:N.ZodObject,...P(e)});ye.lazycreate=(t,e)=>new ye({shape:t,unknownKeys:"strip",catchall:je.create(),typeName:N.ZodObject,...P(e)});Jt=class extends M{_parse(e){let{ctx:s}=this._processInputParams(e),i=this._def.options;function n(r){for(let a of r)if(a.result.status==="valid")return a.result;for(let a of r)if(a.result.status==="dirty")return s.common.issues.push(...a.ctx.common.issues),a.result;let o=r.map(a=>new ge(a.ctx.common.issues));return x(s,{code:v.invalid_union,unionErrors:o}),I}if(s.common.async)return Promise.all(i.map(async r=>{let o={...s,common:{...s.common,issues:[]},parent:null};return{result:await r._parseAsync({data:s.data,path:s.path,parent:o}),ctx:o}})).then(n);{let r,o=[];for(let u of i){let l={...s,common:{...s.common,issues:[]},parent:null},c=u._parseSync({data:s.data,path:s.path,parent:l});if(c.status==="valid")return c;c.status==="dirty"&&!r&&(r={result:c,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(r)return s.common.issues.push(...r.ctx.common.issues),r.result;let a=o.map(u=>new ge(u));return x(s,{code:v.invalid_union,unionErrors:a}),I}}get options(){return this._def.options}};Jt.create=(t,e)=>new Jt({options:t,typeName:N.ZodUnion,...P(e)});at=t=>t instanceof Zt?at(t.schema):t instanceof ke?at(t.innerType()):t instanceof Qt?[t.value]:t instanceof Xt?t.options:t instanceof es?q.objectValues(t.enum):t instanceof ts?at(t._def.innerType):t instanceof Gt?[void 0]:t instanceof Yt?[null]:t instanceof _e?[void 0,...at(t.unwrap())]:t instanceof Ze?[null,...at(t.unwrap())]:t instanceof gi||t instanceof is?at(t.unwrap()):t instanceof ss?at(t._def.innerType):[],Un=class t extends M{_parse(e){let{ctx:s}=this._processInputParams(e);if(s.parsedType!==B.object)return x(s,{code:v.invalid_type,expected:B.object,received:s.parsedType}),I;let i=this.discriminator,n=s.data[i],r=this.optionsMap.get(n);return r?s.common.async?r._parseAsync({data:s.data,path:s.path,parent:s}):r._parseSync({data:s.data,path:s.path,parent:s}):(x(s,{code:v.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),I)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,s,i){let n=new Map;for(let r of s){let o=at(r.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of o){if(n.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);n.set(a,r)}}return new t({typeName:N.ZodDiscriminatedUnion,discriminator:e,options:s,optionsMap:n,...P(i)})}};Ht=class extends M{_parse(e){let{status:s,ctx:i}=this._processInputParams(e),n=(r,o)=>{if(jn(r)||jn(o))return I;let a=la(r.value,o.value);return a.valid?((qn(r)||qn(o))&&s.dirty(),{status:s.value,value:a.data}):(x(i,{code:v.invalid_intersection_types}),I)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([r,o])=>n(r,o)):n(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};Ht.create=(t,e,s)=>new Ht({left:t,right:e,typeName:N.ZodIntersection,...P(s)});He=class t extends M{_parse(e){let{status:s,ctx:i}=this._processInputParams(e);if(i.parsedType!==B.array)return x(i,{code:v.invalid_type,expected:B.array,received:i.parsedType}),I;if(i.data.length<this._def.items.length)return x(i,{code:v.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),I;!this._def.rest&&i.data.length>this._def.items.length&&(x(i,{code:v.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());let r=[...i.data].map((o,a)=>{let u=this._def.items[a]||this._def.rest;return u?u._parse(new Be(i,o,i.path,a)):null}).filter(o=>!!o);return i.common.async?Promise.all(r).then(o=>ae.mergeArray(s,o)):ae.mergeArray(s,r)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};He.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new He({items:t,typeName:N.ZodTuple,rest:null,...P(e)})};Wn=class t extends M{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:s,ctx:i}=this._processInputParams(e);if(i.parsedType!==B.object)return x(i,{code:v.invalid_type,expected:B.object,received:i.parsedType}),I;let n=[],r=this._def.keyType,o=this._def.valueType;for(let a in i.data)n.push({key:r._parse(new Be(i,a,i.path,a)),value:o._parse(new Be(i,i.data[a],i.path,a)),alwaysSet:a in i.data});return i.common.async?ae.mergeObjectAsync(s,n):ae.mergeObjectSync(s,n)}get element(){return this._def.valueType}static create(e,s,i){return s instanceof M?new t({keyType:e,valueType:s,typeName:N.ZodRecord,...P(i)}):new t({keyType:bt.create(),valueType:e,typeName:N.ZodRecord,...P(s)})}},xs=class extends M{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:s,ctx:i}=this._processInputParams(e);if(i.parsedType!==B.map)return x(i,{code:v.invalid_type,expected:B.map,received:i.parsedType}),I;let n=this._def.keyType,r=this._def.valueType,o=[...i.data.entries()].map(([a,u],l)=>({key:n._parse(new Be(i,a,i.path,[l,"key"])),value:r._parse(new Be(i,u,i.path,[l,"value"]))}));if(i.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let u of o){let l=await u.key,c=await u.value;if(l.status==="aborted"||c.status==="aborted")return I;(l.status==="dirty"||c.status==="dirty")&&s.dirty(),a.set(l.value,c.value)}return{status:s.value,value:a}})}else{let a=new Map;for(let u of o){let l=u.key,c=u.value;if(l.status==="aborted"||c.status==="aborted")return I;(l.status==="dirty"||c.status==="dirty")&&s.dirty(),a.set(l.value,c.value)}return{status:s.value,value:a}}}};xs.create=(t,e,s)=>new xs({valueType:e,keyType:t,typeName:N.ZodMap,...P(s)});_s=class t extends M{_parse(e){let{status:s,ctx:i}=this._processInputParams(e);if(i.parsedType!==B.set)return x(i,{code:v.invalid_type,expected:B.set,received:i.parsedType}),I;let n=this._def;n.minSize!==null&&i.data.size<n.minSize.value&&(x(i,{code:v.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),s.dirty()),n.maxSize!==null&&i.data.size>n.maxSize.value&&(x(i,{code:v.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),s.dirty());let r=this._def.valueType;function o(u){let l=new Set;for(let c of u){if(c.status==="aborted")return I;c.status==="dirty"&&s.dirty(),l.add(c.value)}return{status:s.value,value:l}}let a=[...i.data.values()].map((u,l)=>r._parse(new Be(i,u,i.path,l)));return i.common.async?Promise.all(a).then(u=>o(u)):o(a)}min(e,s){return new t({...this._def,minSize:{value:e,message:T.toString(s)}})}max(e,s){return new t({...this._def,maxSize:{value:e,message:T.toString(s)}})}size(e,s){return this.min(e,s).max(e,s)}nonempty(e){return this.min(1,e)}};_s.create=(t,e)=>new _s({valueType:t,minSize:null,maxSize:null,typeName:N.ZodSet,...P(e)});Vn=class t extends M{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:s}=this._processInputParams(e);if(s.parsedType!==B.function)return x(s,{code:v.invalid_type,expected:B.function,received:s.parsedType}),I;function i(a,u){return mi({data:a,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,bs(),ot].filter(l=>!!l),issueData:{code:v.invalid_arguments,argumentsError:u}})}function n(a,u){return mi({data:a,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,bs(),ot].filter(l=>!!l),issueData:{code:v.invalid_return_type,returnTypeError:u}})}let r={errorMap:s.common.contextualErrorMap},o=s.data;if(this._def.returns instanceof vt){let a=this;return he(async function(...u){let l=new ge([]),c=await a._def.args.parseAsync(u,r).catch(d=>{throw l.addIssue(i(u,d)),l}),f=await Reflect.apply(o,this,c);return await a._def.returns._def.type.parseAsync(f,r).catch(d=>{throw l.addIssue(n(f,d)),l})})}else{let a=this;return he(function(...u){let l=a._def.args.safeParse(u,r);if(!l.success)throw new ge([i(u,l.error)]);let c=Reflect.apply(o,this,l.data),f=a._def.returns.safeParse(c,r);if(!f.success)throw new ge([n(c,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:He.create(e).rest(ut.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,s,i){return new t({args:e||He.create([]).rest(ut.create()),returns:s||ut.create(),typeName:N.ZodFunction,...P(i)})}},Zt=class extends M{get schema(){return this._def.getter()}_parse(e){let{ctx:s}=this._processInputParams(e);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}};Zt.create=(t,e)=>new Zt({getter:t,typeName:N.ZodLazy,...P(e)});Qt=class extends M{_parse(e){if(e.data!==this._def.value){let s=this._getOrReturnCtx(e);return x(s,{received:s.data,code:v.invalid_literal,expected:this._def.value}),I}return{status:"valid",value:e.data}}get value(){return this._def.value}};Qt.create=(t,e)=>new Qt({value:t,typeName:N.ZodLiteral,...P(e)});Xt=class t extends M{_parse(e){if(typeof e.data!="string"){let s=this._getOrReturnCtx(e),i=this._def.values;return x(s,{expected:q.joinValues(i),received:s.parsedType,code:v.invalid_type}),I}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let s=this._getOrReturnCtx(e),i=this._def.values;return x(s,{received:s.data,code:v.invalid_enum_value,options:i}),I}return he(e.data)}get options(){return this._def.values}get enum(){let e={};for(let s of this._def.values)e[s]=s;return e}get Values(){let e={};for(let s of this._def.values)e[s]=s;return e}get Enum(){let e={};for(let s of this._def.values)e[s]=s;return e}extract(e,s=this._def){return t.create(e,{...this._def,...s})}exclude(e,s=this._def){return t.create(this.options.filter(i=>!e.includes(i)),{...this._def,...s})}};Xt.create=sf;es=class extends M{_parse(e){let s=q.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==B.string&&i.parsedType!==B.number){let n=q.objectValues(s);return x(i,{expected:q.joinValues(n),received:i.parsedType,code:v.invalid_type}),I}if(this._cache||(this._cache=new Set(q.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=q.objectValues(s);return x(i,{received:i.data,code:v.invalid_enum_value,options:n}),I}return he(e.data)}get enum(){return this._def.values}};es.create=(t,e)=>new es({values:t,typeName:N.ZodNativeEnum,...P(e)});vt=class extends M{unwrap(){return this._def.type}_parse(e){let{ctx:s}=this._processInputParams(e);if(s.parsedType!==B.promise&&s.common.async===!1)return x(s,{code:v.invalid_type,expected:B.promise,received:s.parsedType}),I;let i=s.parsedType===B.promise?s.data:Promise.resolve(s.data);return he(i.then(n=>this._def.type.parseAsync(n,{path:s.path,errorMap:s.common.contextualErrorMap})))}};vt.create=(t,e)=>new vt({type:t,typeName:N.ZodPromise,...P(e)});ke=class extends M{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:s,ctx:i}=this._processInputParams(e),n=this._def.effect||null,r={addIssue:o=>{x(i,o),o.fatal?s.abort():s.dirty()},get path(){return i.path}};if(r.addIssue=r.addIssue.bind(r),n.type==="preprocess"){let o=n.transform(i.data,r);if(i.common.async)return Promise.resolve(o).then(async a=>{if(s.value==="aborted")return I;let u=await this._def.schema._parseAsync({data:a,path:i.path,parent:i});return u.status==="aborted"?I:u.status==="dirty"?Ut(u.value):s.value==="dirty"?Ut(u.value):u});{if(s.value==="aborted")return I;let a=this._def.schema._parseSync({data:o,path:i.path,parent:i});return a.status==="aborted"?I:a.status==="dirty"?Ut(a.value):s.value==="dirty"?Ut(a.value):a}}if(n.type==="refinement"){let o=a=>{let u=n.refinement(a,r);if(i.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?I:(a.status==="dirty"&&s.dirty(),o(a.value),{status:s.value,value:a.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>a.status==="aborted"?I:(a.status==="dirty"&&s.dirty(),o(a.value).then(()=>({status:s.value,value:a.value}))))}if(n.type==="transform")if(i.common.async===!1){let o=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!Et(o))return I;let a=n.transform(o.value,r);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:a}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(o=>Et(o)?Promise.resolve(n.transform(o.value,r)).then(a=>({status:s.value,value:a})):I);q.assertNever(n)}};ke.create=(t,e,s)=>new ke({schema:t,typeName:N.ZodEffects,effect:e,...P(s)});ke.createWithPreprocess=(t,e,s)=>new ke({schema:e,effect:{type:"preprocess",transform:t},typeName:N.ZodEffects,...P(s)});_e=class extends M{_parse(e){return this._getType(e)===B.undefined?he(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};_e.create=(t,e)=>new _e({innerType:t,typeName:N.ZodOptional,...P(e)});Ze=class extends M{_parse(e){return this._getType(e)===B.null?he(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ze.create=(t,e)=>new Ze({innerType:t,typeName:N.ZodNullable,...P(e)});ts=class extends M{_parse(e){let{ctx:s}=this._processInputParams(e),i=s.data;return s.parsedType===B.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:s.path,parent:s})}removeDefault(){return this._def.innerType}};ts.create=(t,e)=>new ts({innerType:t,typeName:N.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...P(e)});ss=class extends M{_parse(e){let{ctx:s}=this._processInputParams(e),i={...s,common:{...s.common,issues:[]}},n=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return ws(n)?n.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new ge(i.common.issues)},input:i.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new ge(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};ss.create=(t,e)=>new ss({innerType:t,typeName:N.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...P(e)});Bs=class extends M{_parse(e){if(this._getType(e)!==B.nan){let i=this._getOrReturnCtx(e);return x(i,{code:v.invalid_type,expected:B.nan,received:i.parsedType}),I}return{status:"valid",value:e.data}}};Bs.create=t=>new Bs({typeName:N.ZodNaN,...P(t)});vy=Symbol("zod_brand"),gi=class extends M{_parse(e){let{ctx:s}=this._processInputParams(e),i=s.data;return this._def.type._parse({data:i,path:s.path,parent:s})}unwrap(){return this._def.type}},yi=class t extends M{_parse(e){let{status:s,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{let r=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?I:r.status==="dirty"?(s.dirty(),Ut(r.value)):this._def.out._parseAsync({data:r.value,path:i.path,parent:i})})();{let n=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return n.status==="aborted"?I:n.status==="dirty"?(s.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:i.path,parent:i})}}static create(e,s){return new t({in:e,out:s,typeName:N.ZodPipeline})}},is=class extends M{_parse(e){let s=this._def.innerType._parse(e),i=n=>(Et(n)&&(n.value=Object.freeze(n.value)),n);return ws(s)?s.then(n=>i(n)):i(s)}unwrap(){return this._def.innerType}};is.create=(t,e)=>new is({innerType:t,typeName:N.ZodReadonly,...P(e)});Sy={object:ye.lazycreate};(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(N||(N={}));Ay=(t,e={message:`Input not instance of ${t.name}`})=>nf(s=>s instanceof t,e),rf=bt.create,of=Wt.create,xy=Bs.create,_y=Vt.create,af=zt.create,By=Kt.create,ky=Ss.create,Ty=Gt.create,$y=Yt.create,Iy=wt.create,Ny=ut.create,Oy=je.create,Ry=As.create,Py=lt.create,Ly=ye.create,My=ye.strictCreate,jy=Jt.create,qy=Un.create,Uy=Ht.create,Wy=He.create,Vy=Wn.create,zy=xs.create,Ky=_s.create,Gy=Vn.create,Yy=Zt.create,Jy=Qt.create,Hy=Xt.create,Zy=es.create,Qy=vt.create,Xy=ke.create,eF=_e.create,tF=Ze.create,sF=ke.createWithPreprocess,iF=yi.create,nF=()=>rf().optional(),rF=()=>of().optional(),oF=()=>af().optional(),aF={string:(t=>bt.create({...t,coerce:!0})),number:(t=>Wt.create({...t,coerce:!0})),boolean:(t=>zt.create({...t,coerce:!0})),bigint:(t=>Vt.create({...t,coerce:!0})),date:(t=>Kt.create({...t,coerce:!0}))},uF=I});var j={};Sn(j,{BRAND:()=>vy,DIRTY:()=>Ut,EMPTY_PATH:()=>sy,INVALID:()=>I,NEVER:()=>uF,OK:()=>he,ParseStatus:()=>ae,Schema:()=>M,ZodAny:()=>wt,ZodArray:()=>lt,ZodBigInt:()=>Vt,ZodBoolean:()=>zt,ZodBranded:()=>gi,ZodCatch:()=>ss,ZodDate:()=>Kt,ZodDefault:()=>ts,ZodDiscriminatedUnion:()=>Un,ZodEffects:()=>ke,ZodEnum:()=>Xt,ZodError:()=>ge,ZodFirstPartyTypeKind:()=>N,ZodFunction:()=>Vn,ZodIntersection:()=>Ht,ZodIssueCode:()=>v,ZodLazy:()=>Zt,ZodLiteral:()=>Qt,ZodMap:()=>xs,ZodNaN:()=>Bs,ZodNativeEnum:()=>es,ZodNever:()=>je,ZodNull:()=>Yt,ZodNullable:()=>Ze,ZodNumber:()=>Wt,ZodObject:()=>ye,ZodOptional:()=>_e,ZodParsedType:()=>B,ZodPipeline:()=>yi,ZodPromise:()=>vt,ZodReadonly:()=>is,ZodRecord:()=>Wn,ZodSchema:()=>M,ZodSet:()=>_s,ZodString:()=>bt,ZodSymbol:()=>Ss,ZodTransformer:()=>ke,ZodTuple:()=>He,ZodType:()=>M,ZodUndefined:()=>Gt,ZodUnion:()=>Jt,ZodUnknown:()=>ut,ZodVoid:()=>As,addIssueToContext:()=>x,any:()=>Iy,array:()=>Py,bigint:()=>_y,boolean:()=>af,coerce:()=>aF,custom:()=>nf,date:()=>By,datetimeRegex:()=>tf,defaultErrorMap:()=>ot,discriminatedUnion:()=>qy,effect:()=>Xy,enum:()=>Hy,function:()=>Gy,getErrorMap:()=>bs,getParsedType:()=>Je,instanceof:()=>Ay,intersection:()=>Uy,isAborted:()=>jn,isAsync:()=>ws,isDirty:()=>qn,isValid:()=>Et,late:()=>Sy,lazy:()=>Yy,literal:()=>Jy,makeIssue:()=>mi,map:()=>zy,nan:()=>xy,nativeEnum:()=>Zy,never:()=>Oy,null:()=>$y,nullable:()=>tF,number:()=>of,object:()=>Ly,objectUtil:()=>ra,oboolean:()=>oF,onumber:()=>rF,optional:()=>eF,ostring:()=>nF,pipeline:()=>iF,preprocess:()=>sF,promise:()=>Qy,quotelessJson:()=>X0,record:()=>Vy,set:()=>Ky,setErrorMap:()=>ty,strictObject:()=>My,string:()=>rf,symbol:()=>ky,transformer:()=>Xy,tuple:()=>Wy,undefined:()=>Ty,union:()=>jy,unknown:()=>Ny,util:()=>q,void:()=>Ry});var ca=W(()=>{Mn();aa();Jc();pi();uf();Ln()});var zn=W(()=>{ca();ca()});function Da(){return fa.parse({})}async function Fi(t){try{return await(0,Qe.access)(t),!0}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return!1;throw e}}async function ff(t){if(!await Fi(t))return null;let s=await(0,Qe.readFile)(t,"utf-8");try{return JSON.parse(s)}catch(i){let n=i instanceof SyntaxError?i.message:String(i);throw new Error(`Invalid JSON in config file ${t}: ${n}`)}}function hf(t,e){return{...t,...e.excludePatterns!==void 0&&{excludePatterns:e.excludePatterns},...e.concurrency!==void 0&&{concurrency:e.concurrency},...e.executor!==void 0&&{executor:e.executor},executors:e.executors?hF(t.executors,e.executors):t.executors,agents:e.agents?df(t.agents,e.agents):t.agents,rules:e.rules?df(t.rules,e.rules):t.rules,output:e.output?{...t.output,...e.output}:t.output}}async function ve(t){let e=t?`${be.CONFIG}:${t}`:be.CONFIG;return rt(e,async()=>{let s=Da(),i=await ff(Kn);if(i&&(s=fa.parse(hf(s,i))),t){let n=(0,ns.join)(t,da),r=await ff(n);r&&(s=fa.parse(hf(s,r)))}return s})}async function pf(t){try{await(0,Qe.mkdir)(ha,{recursive:!0}),await(0,Qe.writeFile)(Kn,JSON.stringify(t,null,2)),fi(be.CONFIG)}catch(e){throw new Error(`Failed to save global config: ${e}`)}}async function mf(t){let e=(0,ns.join)(t,da);return await Fi(e)||(await(0,Qe.writeFile)(e,JSON.stringify({agents:{},rules:{}},null,2)),fi(be.CONFIG)),e}function hF(t,e){let s={...t};for(let[i,n]of Object.entries(e))s[i]={...s[i],...n,review:n.review?{...s[i]?.review,...n.review}:s[i]?.review,validation:n.validation?{...s[i]?.validation,...n.validation}:s[i]?.validation};return s}function df(t,e){let s={...t};for(let[i,n]of Object.entries(e))s[i]={...s[i],...n};return s}function pa(){return Kn}function Ci(t){return(0,ns.join)(t,da)}async function ma(){return Fi(Kn)}async function Gn(t){return Fi(Ci(t))}async function gf(){return rt(be.INSTRUCTIONS,async()=>{try{return await Fi(cf)?await(0,Qe.readFile)(cf,"utf-8"):""}catch{return""}})}var ns,Df,Qe,lf,lF,cF,fF,fa,ha,Kn,cf,da,ct=W(()=>{"use strict";zn();ns=require("path"),Df=require("os"),Qe=require("node:fs/promises");hi();lf=j.object({model:j.string().optional(),timeout:j.number().positive().optional(),concurrency:j.number().min(1).max(10).optional(),batchSize:j.number().min(1).max(50).optional()}),lF=j.object({review:lf.optional(),validation:lf.optional()}),cF=j.object({enabled:j.boolean().optional(),model:j.string().optional(),timeout:j.number().positive().optional()}),fF=j.object({enabled:j.boolean().optional(),agent:j.string().optional()}),fa=j.object({excludePatterns:j.array(j.string()).default(["*.min.js","*.min.css","*.map","*.d.ts","dist/**","build/**","out/**",".next/**","coverage/**","node_modules/**","vendor/**","*.generated.*","*.bundle.js"]),concurrency:j.number().min(1).max(10).default(6),executor:j.string().default("claude-cli"),executors:j.record(j.string(),lF).default({}),agents:j.record(j.string(),cF).default({}),rules:j.record(j.string(),fF).default({}),output:j.object({colorize:j.boolean().default(!0),verbose:j.boolean().default(!1),format:j.enum(["terminal","markdown","json"]).default("terminal")}).default({})}),ha=(0,ns.join)((0,Df.homedir)(),".diffray"),Kn=(0,ns.join)(ha,"config.json"),cf=(0,ns.join)(ha,"instructions.md"),da=".diffray.json"});var ga,yf,dF,Ff=W(()=>{ga=(t,e,s)=>{let i=t instanceof RegExp?yf(t,s):t,n=e instanceof RegExp?yf(e,s):e,r=i!==null&&n!=null&&dF(i,n,s);return r&&{start:r[0],end:r[1],pre:s.slice(0,r[0]),body:s.slice(r[0]+i.length,r[1]),post:s.slice(r[1]+n.length)}},yf=(t,e)=>{let s=e.match(t);return s?s[0]:null},dF=(t,e,s)=>{let i,n,r,o,a,u=s.indexOf(t),l=s.indexOf(e,u+1),c=u;if(u>=0&&l>0){if(t===e)return[u,l];for(i=[],r=s.length;c>=0&&!a;){if(c===u)i.push(c),u=s.indexOf(t,c+1);else if(i.length===1){let f=i.pop();f!==void 0&&(a=[f,l])}else n=i.pop(),n!==void 0&&n<r&&(r=n,o=l),l=s.indexOf(e,c+1);c=u<l&&u>=0?u:l}i.length&&o!==void 0&&(a=[r,o])}return a}});function ya(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function vF(t){return t.replace(FF,Cf).replace(CF,Ef).replace(EF,Fa).replace(bF,bf).replace(wF,wf)}function SF(t){return t.replace(DF,"\\").replace(pF,"{").replace(mF,"}").replace(gF,",").replace(yF,".")}function vf(t){if(!t)return[""];let e=[],s=ga("{","}",t);if(!s)return t.split(",");let{pre:i,body:n,post:r}=s,o=i.split(",");o[o.length-1]+="{"+n+"}";let a=vf(r);return r.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function Sf(t){return t?(t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),Ei(vF(t),!0).map(SF)):[]}function AF(t){return"{"+t+"}"}function xF(t){return/^-?0\d/.test(t)}function _F(t,e){return t<=e}function BF(t,e){return t>=e}function Ei(t,e){let s=[],i=ga("{","}",t);if(!i)return[t];let n=i.pre,r=i.post.length?Ei(i.post,!1):[""];if(/\$$/.test(i.pre))for(let o=0;o<r.length;o++){let a=n+"{"+i.body+"}"+r[o];s.push(a)}else{let o=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),a=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),u=o||a,l=i.body.indexOf(",")>=0;if(!u&&!l)return i.post.match(/,(?!,).*\}/)?(t=i.pre+"{"+i.body+Fa+i.post,Ei(t)):[t];let c;if(u)c=i.body.split(/\.\./);else if(c=vf(i.body),c.length===1&&c[0]!==void 0&&(c=Ei(c[0],!1).map(AF),c.length===1))return r.map(h=>i.pre+c[0]+h);let f;if(u&&c[0]!==void 0&&c[1]!==void 0){let h=ya(c[0]),d=ya(c[1]),g=Math.max(c[0].length,c[1].length),D=c.length===3&&c[2]!==void 0?Math.abs(ya(c[2])):1,m=_F;d<h&&(D*=-1,m=BF);let F=c.some(xF);f=[];for(let C=h;m(C,d);C+=D){let E;if(a)E=String.fromCharCode(C),E==="\\"&&(E="");else if(E=String(C),F){let w=g-E.length;if(w>0){let A=new Array(w+1).join("0");C<0?E="-"+A+E.slice(1):E=A+E}}f.push(E)}}else{f=[];for(let h=0;h<c.length;h++)f.push.apply(f,Ei(c[h],!1))}for(let h=0;h<f.length;h++)for(let d=0;d<r.length;d++){let g=n+f[h]+r[d];(!e||u||g)&&s.push(g)}}return s}var Cf,Ef,Fa,bf,wf,DF,pF,mF,gF,yF,FF,CF,EF,bF,wF,Af=W(()=>{Ff();Cf="\0SLASH"+Math.random()+"\0",Ef="\0OPEN"+Math.random()+"\0",Fa="\0CLOSE"+Math.random()+"\0",bf="\0COMMA"+Math.random()+"\0",wf="\0PERIOD"+Math.random()+"\0",DF=new RegExp(Cf,"g"),pF=new RegExp(Ef,"g"),mF=new RegExp(Fa,"g"),gF=new RegExp(bf,"g"),yF=new RegExp(wf,"g"),FF=/\\\\/g,CF=/\\{/g,EF=/\\}/g,bF=/\\,/g,wF=/\\./g});var bi,xf=W(()=>{bi=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")}});var kF,wi,TF,_f,Bf,kf=W(()=>{kF={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},wi=t=>t.replace(/[[\]\\-]/g,"\\$&"),TF=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),_f=t=>t.join(""),Bf=(t,e)=>{let s=e;if(t.charAt(s)!=="[")throw new Error("not in a brace expression");let i=[],n=[],r=s+1,o=!1,a=!1,u=!1,l=!1,c=s,f="";e:for(;r<t.length;){let D=t.charAt(r);if((D==="!"||D==="^")&&r===s+1){l=!0,r++;continue}if(D==="]"&&o&&!u){c=r+1;break}if(o=!0,D==="\\"&&!u){u=!0,r++;continue}if(D==="["&&!u){for(let[m,[y,F,C]]of Object.entries(kF))if(t.startsWith(m,r)){if(f)return["$.",!1,t.length-s,!0];r+=m.length,C?n.push(y):i.push(y),a=a||F;continue e}}if(u=!1,f){D>f?i.push(wi(f)+"-"+wi(D)):D===f&&i.push(wi(D)),f="",r++;continue}if(t.startsWith("-]",r+1)){i.push(wi(D+"-")),r+=2;continue}if(t.startsWith("-",r+1)){f=D,r+=2;continue}i.push(wi(D)),r++}if(c<r)return["",!1,0,!1];if(!i.length&&!n.length)return["$.",!1,t.length-s,!0];if(n.length===0&&i.length===1&&/^\\?.$/.test(i[0])&&!l){let D=i[0].length===2?i[0].slice(-1):i[0];return[TF(D),!1,c-s,!1]}let h="["+(l?"^":"")+_f(i)+"]",d="["+(l?"":"^")+_f(n)+"]";return[i.length&&n.length?"("+h+"|"+d+")":i.length?h:d,a,c-s,!0]}});var Te,Yn=W(()=>{Te=(t,{windowsPathsNoEscape:e=!1,magicalBraces:s=!0}={})=>s?e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):e?t.replace(/\[([^\/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1")});var $F,Tf,IF,Jn,NF,OF,RF,PF,Ca,$f,If,ks,Ea=W(()=>{kf();Yn();$F=new Set(["!","?","+","*","@"]),Tf=t=>$F.has(t),IF="(?!(?:^|/)\\.\\.?(?:$|/))",Jn="(?!\\.)",NF=new Set(["[","."]),OF=new Set(["..","."]),RF=new Set("().*{}+?[]^$\\!"),PF=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Ca="[^/]",$f=Ca+"*?",If=Ca+"+?",ks=class t{type;#e;#s;#r=!1;#n=[];#o;#C;#g;#c=!1;#a;#h;#f=!1;constructor(e,s,i={}){this.type=e,e&&(this.#s=!0),this.#o=s,this.#e=this.#o?this.#o.#e:this,this.#a=this.#e===this?i:this.#e.#a,this.#g=this.#e===this?[]:this.#e.#g,e==="!"&&!this.#e.#c&&this.#g.push(this),this.#C=this.#o?this.#o.#n.length:0}get hasMagic(){if(this.#s!==void 0)return this.#s;for(let e of this.#n)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#s=!0;return this.#s}toString(){return this.#h!==void 0?this.#h:this.type?this.#h=this.type+"("+this.#n.map(e=>String(e)).join("|")+")":this.#h=this.#n.map(e=>String(e)).join("")}#u(){if(this!==this.#e)throw new Error("should only call on root");if(this.#c)return this;this.toString(),this.#c=!0;let e;for(;e=this.#g.pop();){if(e.type!=="!")continue;let s=e,i=s.#o;for(;i;){for(let n=s.#C+1;!i.type&&n<i.#n.length;n++)for(let r of e.#n){if(typeof r=="string")throw new Error("string part in extglob AST??");r.copyIn(i.#n[n])}s=i,i=s.#o}}return this}push(...e){for(let s of e)if(s!==""){if(typeof s!="string"&&!(s instanceof t&&s.#o===this))throw new Error("invalid part: "+s);this.#n.push(s)}}toJSON(){let e=this.type===null?this.#n.slice().map(s=>typeof s=="string"?s:s.toJSON()):[this.type,...this.#n.map(s=>s.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#c&&this.#o?.type==="!")&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#o?.isStart())return!1;if(this.#C===0)return!0;let e=this.#o;for(let s=0;s<this.#C;s++){let i=e.#n[s];if(!(i instanceof t&&i.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let e=this.#o?this.#o.#n.length:0;return this.#C===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let s=new t(this.type,e);for(let i of this.#n)s.copyIn(i);return s}static#i(e,s,i,n){let r=!1,o=!1,a=-1,u=!1;if(s.type===null){let d=i,g="";for(;d<e.length;){let D=e.charAt(d++);if(r||D==="\\"){r=!r,g+=D;continue}if(o){d===a+1?(D==="^"||D==="!")&&(u=!0):D==="]"&&!(d===a+2&&u)&&(o=!1),g+=D;continue}else if(D==="["){o=!0,a=d,u=!1,g+=D;continue}if(!n.noext&&Tf(D)&&e.charAt(d)==="("){s.push(g),g="";let m=new t(D,s);d=t.#i(e,m,d,n),s.push(m);continue}g+=D}return s.push(g),d}let l=i+1,c=new t(null,s),f=[],h="";for(;l<e.length;){let d=e.charAt(l++);if(r||d==="\\"){r=!r,h+=d;continue}if(o){l===a+1?(d==="^"||d==="!")&&(u=!0):d==="]"&&!(l===a+2&&u)&&(o=!1),h+=d;continue}else if(d==="["){o=!0,a=l,u=!1,h+=d;continue}if(Tf(d)&&e.charAt(l)==="("){c.push(h),h="";let g=new t(d,c);c.push(g),l=t.#i(e,g,l,n);continue}if(d==="|"){c.push(h),h="",f.push(c),c=new t(null,s);continue}if(d===")")return h===""&&s.#n.length===0&&(s.#f=!0),c.push(h),h="",s.push(...f,c),l;h+=d}return s.type=null,s.#s=void 0,s.#n=[e.substring(i-1)],l}static fromGlob(e,s={}){let i=new t(null,void 0,s);return t.#i(e,i,0,s),i}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[s,i,n,r]=this.toRegExpSource();if(!(n||this.#s||this.#a.nocase&&!this.#a.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return i;let a=(this.#a.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${s}$`,a),{_src:s,_glob:e})}get options(){return this.#a}toRegExpSource(e){let s=e??!!this.#a.dot;if(this.#e===this&&this.#u(),!this.type){let u=this.isStart()&&this.isEnd()&&!this.#n.some(d=>typeof d!="string"),l=this.#n.map(d=>{let[g,D,m,y]=typeof d=="string"?t.#E(d,this.#s,u):d.toRegExpSource(e);return this.#s=this.#s||m,this.#r=this.#r||y,g}).join(""),c="";if(this.isStart()&&typeof this.#n[0]=="string"&&!(this.#n.length===1&&OF.has(this.#n[0]))){let g=NF,D=s&&g.has(l.charAt(0))||l.startsWith("\\.")&&g.has(l.charAt(2))||l.startsWith("\\.\\.")&&g.has(l.charAt(4)),m=!s&&!e&&g.has(l.charAt(0));c=D?IF:m?Jn:""}let f="";return this.isEnd()&&this.#e.#c&&this.#o?.type==="!"&&(f="(?:$|\\/)"),[c+l+f,Te(l),this.#s=!!this.#s,this.#r]}let i=this.type==="*"||this.type==="+",n=this.type==="!"?"(?:(?!(?:":"(?:",r=this.#d(s);if(this.isStart()&&this.isEnd()&&!r&&this.type!=="!"){let u=this.toString();return this.#n=[u],this.type=null,this.#s=void 0,[u,Te(this.toString()),!1,!1]}let o=!i||e||s||!Jn?"":this.#d(!0);o===r&&(o=""),o&&(r=`(?:${r})(?:${o})*?`);let a="";if(this.type==="!"&&this.#f)a=(this.isStart()&&!s?Jn:"")+If;else{let u=this.type==="!"?"))"+(this.isStart()&&!s&&!e?Jn:"")+$f+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=n+r+u}return[a,Te(r),this.#s=!!this.#s,this.#r]}#d(e){return this.#n.map(s=>{if(typeof s=="string")throw new Error("string type in extglob ast??");let[i,n,r,o]=s.toRegExpSource(e);return this.#r=this.#r||o,i}).filter(s=>!(this.isStart()&&this.isEnd())||!!s).join("|")}static#E(e,s,i=!1){let n=!1,r="",o=!1;for(let a=0;a<e.length;a++){let u=e.charAt(a);if(n){n=!1,r+=(RF.has(u)?"\\":"")+u;continue}if(u==="\\"){a===e.length-1?r+="\\\\":n=!0;continue}if(u==="["){let[l,c,f,h]=Bf(e,a);if(f){r+=l,o=o||c,a+=f-1,s=s||h;continue}}if(u==="*"){r+=i&&e==="*"?If:$f,s=!0;continue}if(u==="?"){r+=Ca,s=!0;continue}r+=PF(u)}return[r,Te(e),!!s,o]}}});var rs,ba=W(()=>{rs=(t,{windowsPathsNoEscape:e=!1,magicalBraces:s=!1}={})=>s?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&")});var pe,LF,MF,jF,qF,UF,WF,VF,zF,KF,GF,YF,JF,HF,ZF,QF,XF,eC,tC,Rf,Pf,Lf,Nf,sC,ue,iC,nC,rC,oC,aC,$e,uC,Mf,lC,cC,Of,fC,Se,St=W(()=>{Af();xf();Ea();ba();Yn();Ea();ba();Yn();pe=(t,e,s={})=>(bi(e),!s.nocomment&&e.charAt(0)==="#"?!1:new Se(e,s).match(t)),LF=/^\*+([^+@!?\*\[\(]*)$/,MF=t=>e=>!e.startsWith(".")&&e.endsWith(t),jF=t=>e=>e.endsWith(t),qF=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),UF=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),WF=/^\*+\.\*+$/,VF=t=>!t.startsWith(".")&&t.includes("."),zF=t=>t!=="."&&t!==".."&&t.includes("."),KF=/^\.\*+$/,GF=t=>t!=="."&&t!==".."&&t.startsWith("."),YF=/^\*+$/,JF=t=>t.length!==0&&!t.startsWith("."),HF=t=>t.length!==0&&t!=="."&&t!=="..",ZF=/^\?+([^+@!?\*\[\(]*)?$/,QF=([t,e=""])=>{let s=Rf([t]);return e?(e=e.toLowerCase(),i=>s(i)&&i.toLowerCase().endsWith(e)):s},XF=([t,e=""])=>{let s=Pf([t]);return e?(e=e.toLowerCase(),i=>s(i)&&i.toLowerCase().endsWith(e)):s},eC=([t,e=""])=>{let s=Pf([t]);return e?i=>s(i)&&i.endsWith(e):s},tC=([t,e=""])=>{let s=Rf([t]);return e?i=>s(i)&&i.endsWith(e):s},Rf=([t])=>{let e=t.length;return s=>s.length===e&&!s.startsWith(".")},Pf=([t])=>{let e=t.length;return s=>s.length===e&&s!=="."&&s!==".."},Lf=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Nf={win32:{sep:"\\"},posix:{sep:"/"}},sC=Lf==="win32"?Nf.win32.sep:Nf.posix.sep;pe.sep=sC;ue=Symbol("globstar **");pe.GLOBSTAR=ue;iC="[^/]",nC=iC+"*?",rC="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",oC="(?:(?!(?:\\/|^)\\.).)*?",aC=(t,e={})=>s=>pe(s,t,e);pe.filter=aC;$e=(t,e={})=>Object.assign({},t,e),uC=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return pe;let e=pe;return Object.assign((i,n,r={})=>e(i,n,$e(t,r)),{Minimatch:class extends e.Minimatch{constructor(n,r={}){super(n,$e(t,r))}static defaults(n){return e.defaults($e(t,n)).Minimatch}},AST:class extends e.AST{constructor(n,r,o={}){super(n,r,$e(t,o))}static fromGlob(n,r={}){return e.AST.fromGlob(n,$e(t,r))}},unescape:(i,n={})=>e.unescape(i,$e(t,n)),escape:(i,n={})=>e.escape(i,$e(t,n)),filter:(i,n={})=>e.filter(i,$e(t,n)),defaults:i=>e.defaults($e(t,i)),makeRe:(i,n={})=>e.makeRe(i,$e(t,n)),braceExpand:(i,n={})=>e.braceExpand(i,$e(t,n)),match:(i,n,r={})=>e.match(i,n,$e(t,r)),sep:e.sep,GLOBSTAR:ue})};pe.defaults=uC;Mf=(t,e={})=>(bi(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:Sf(t));pe.braceExpand=Mf;lC=(t,e={})=>new Se(t,e).makeRe();pe.makeRe=lC;cC=(t,e,s={})=>{let i=new Se(e,s);return t=t.filter(n=>i.match(n)),i.options.nonull&&!t.length&&t.push(e),t};pe.match=cC;Of=/[?*]|[+@!]\(.*?\)|\[|\]/,fC=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Se=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,s={}){bi(e),s=s||{},this.options=s,this.pattern=e,this.platform=s.platform||Lf,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!s.windowsPathsNoEscape||s.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!s.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!s.nonegate,this.comment=!1,this.empty=!1,this.partial=!!s.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=s.windowsNoMagicRoot!==void 0?s.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let s of e)if(typeof s!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,s=this.options;if(!s.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],s.debug&&(this.debug=(...r)=>console.error(...r)),this.debug(this.pattern,this.globSet);let i=this.globSet.map(r=>this.slashSplit(r));this.globParts=this.preprocess(i),this.debug(this.pattern,this.globParts);let n=this.globParts.map((r,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let u=r[0]===""&&r[1]===""&&(r[2]==="?"||!Of.test(r[2]))&&!Of.test(r[3]),l=/^[a-z]:/i.test(r[0]);if(u)return[...r.slice(0,4),...r.slice(4).map(c=>this.parse(c))];if(l)return[r[0],...r.slice(1).map(c=>this.parse(c))]}return r.map(u=>this.parse(u))});if(this.debug(this.pattern,n),this.set=n.filter(r=>r.indexOf(!1)===-1),this.isWindows)for(let r=0;r<this.set.length;r++){let o=this.set[r];o[0]===""&&o[1]===""&&this.globParts[r][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let i=0;i<e.length;i++)for(let n=0;n<e[i].length;n++)e[i][n]==="**"&&(e[i][n]="*");let{optimizationLevel:s=1}=this.options;return s>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):s>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(s=>{let i=-1;for(;(i=s.indexOf("**",i+1))!==-1;){let n=i;for(;s[n+1]==="**";)n++;n!==i&&s.splice(i,n-i)}return s})}levelOneOptimize(e){return e.map(s=>(s=s.reduce((i,n)=>{let r=i[i.length-1];return n==="**"&&r==="**"?i:n===".."&&r&&r!==".."&&r!=="."&&r!=="**"?(i.pop(),i):(i.push(n),i)},[]),s.length===0?[""]:s))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let s=!1;do{if(s=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];n===1&&r===""&&e[0]===""||(r==="."||r==="")&&(s=!0,e.splice(n,1),n--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(s=!0,e.pop())}let i=0;for(;(i=e.indexOf("..",i+1))!==-1;){let n=e[i-1];n&&n!=="."&&n!==".."&&n!=="**"&&(s=!0,e.splice(i-1,2),i-=2)}}while(s);return e.length===0?[""]:e}firstPhasePreProcess(e){let s=!1;do{s=!1;for(let i of e){let n=-1;for(;(n=i.indexOf("**",n+1))!==-1;){let o=n;for(;i[o+1]==="**";)o++;o>n&&i.splice(n+1,o-n);let a=i[n+1],u=i[n+2],l=i[n+3];if(a!==".."||!u||u==="."||u===".."||!l||l==="."||l==="..")continue;s=!0,i.splice(n,1);let c=i.slice(0);c[n]="**",e.push(c),n--}if(!this.preserveMultipleSlashes){for(let o=1;o<i.length-1;o++){let a=i[o];o===1&&a===""&&i[0]===""||(a==="."||a==="")&&(s=!0,i.splice(o,1),o--)}i[0]==="."&&i.length===2&&(i[1]==="."||i[1]==="")&&(s=!0,i.pop())}let r=0;for(;(r=i.indexOf("..",r+1))!==-1;){let o=i[r-1];if(o&&o!=="."&&o!==".."&&o!=="**"){s=!0;let u=r===1&&i[r+1]==="**"?["."]:[];i.splice(r-1,2,...u),i.length===0&&i.push(""),r-=2}}}}while(s);return e}secondPhasePreProcess(e){for(let s=0;s<e.length-1;s++)for(let i=s+1;i<e.length;i++){let n=this.partsMatch(e[s],e[i],!this.preserveMultipleSlashes);if(n){e[s]=[],e[i]=n;break}}return e.filter(s=>s.length)}partsMatch(e,s,i=!1){let n=0,r=0,o=[],a="";for(;n<e.length&&r<s.length;)if(e[n]===s[r])o.push(a==="b"?s[r]:e[n]),n++,r++;else if(i&&e[n]==="**"&&s[r]===e[n+1])o.push(e[n]),n++;else if(i&&s[r]==="**"&&e[n]===s[r+1])o.push(s[r]),r++;else if(e[n]==="*"&&s[r]&&(this.options.dot||!s[r].startsWith("."))&&s[r]!=="**"){if(a==="b")return!1;a="a",o.push(e[n]),n++,r++}else if(s[r]==="*"&&e[n]&&(this.options.dot||!e[n].startsWith("."))&&e[n]!=="**"){if(a==="a")return!1;a="b",o.push(s[r]),n++,r++}else return!1;return e.length===s.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,s=!1,i=0;for(let n=0;n<e.length&&e.charAt(n)==="!";n++)s=!s,i++;i&&(this.pattern=e.slice(i)),this.negate=s}matchOne(e,s,i=!1){let n=this.options;if(this.isWindows){let D=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),m=!D&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),y=typeof s[0]=="string"&&/^[a-z]:$/i.test(s[0]),F=!y&&s[0]===""&&s[1]===""&&s[2]==="?"&&typeof s[3]=="string"&&/^[a-z]:$/i.test(s[3]),C=m?3:D?0:void 0,E=F?3:y?0:void 0;if(typeof C=="number"&&typeof E=="number"){let[w,A]=[e[C],s[E]];w.toLowerCase()===A.toLowerCase()&&(s[E]=w,E>C?s=s.slice(E):C>E&&(e=e.slice(C)))}}let{optimizationLevel:r=1}=this.options;r>=2&&(e=this.levelTwoFileOptimize(e)),this.debug("matchOne",this,{file:e,pattern:s}),this.debug("matchOne",e.length,s.length);for(var o=0,a=0,u=e.length,l=s.length;o<u&&a<l;o++,a++){this.debug("matchOne loop");var c=s[a],f=e[o];if(this.debug(s,c,f),c===!1)return!1;if(c===ue){this.debug("GLOBSTAR",[s,c,f]);var h=o,d=a+1;if(d===l){for(this.debug("** at the end");o<u;o++)if(e[o]==="."||e[o]===".."||!n.dot&&e[o].charAt(0)===".")return!1;return!0}for(;h<u;){var g=e[h];if(this.debug(`
|
|
57
|
+
globstar while`,e,h,s,d,g),this.matchOne(e.slice(h),s.slice(d),i))return this.debug("globstar found match!",h,u,g),!0;if(g==="."||g===".."||!n.dot&&g.charAt(0)==="."){this.debug("dot detected!",e,h,s,d);break}this.debug("globstar swallow a segment, and continue"),h++}return!!(i&&(this.debug(`
|
|
58
|
+
>>> no match, partial?`,e,h,s,d),h===u))}let D;if(typeof c=="string"?(D=f===c,this.debug("string match",c,f,D)):(D=c.test(f),this.debug("pattern match",c,f,D)),!D)return!1}if(o===u&&a===l)return!0;if(o===u)return i;if(a===l)return o===u-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return Mf(this.pattern,this.options)}parse(e){bi(e);let s=this.options;if(e==="**")return ue;if(e==="")return"";let i,n=null;(i=e.match(YF))?n=s.dot?HF:JF:(i=e.match(LF))?n=(s.nocase?s.dot?UF:qF:s.dot?jF:MF)(i[1]):(i=e.match(ZF))?n=(s.nocase?s.dot?XF:QF:s.dot?eC:tC)(i):(i=e.match(WF))?n=s.dot?zF:VF:(i=e.match(KF))&&(n=GF);let r=ks.fromGlob(e,this.options).toMMPattern();return n&&typeof r=="object"&&Reflect.defineProperty(r,"test",{value:n}),r}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let s=this.options,i=s.noglobstar?nC:s.dot?rC:oC,n=new Set(s.nocase?["i"]:[]),r=e.map(u=>{let l=u.map(f=>{if(f instanceof RegExp)for(let h of f.flags.split(""))n.add(h);return typeof f=="string"?fC(f):f===ue?ue:f._src});l.forEach((f,h)=>{let d=l[h+1],g=l[h-1];f!==ue||g===ue||(g===void 0?d!==void 0&&d!==ue?l[h+1]="(?:\\/|"+i+"\\/)?"+d:l[h]=i:d===void 0?l[h-1]=g+"(?:\\/|\\/"+i+")?":d!==ue&&(l[h-1]=g+"(?:\\/|\\/"+i+"\\/)"+d,l[h+1]=ue))});let c=l.filter(f=>f!==ue);if(this.partial&&c.length>=1){let f=[];for(let h=1;h<=c.length;h++)f.push(c.slice(0,h).join("/"));return"(?:"+f.join("|")+")"}return c.join("/")}).join("|"),[o,a]=e.length>1?["(?:",")"]:["",""];r="^"+o+r+a+"$",this.partial&&(r="^(?:\\/|"+o+r.slice(1,-1)+a+")$"),this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...n].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,s=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&s)return!0;let i=this.options;this.isWindows&&(e=e.split("\\").join("/"));let n=this.slashSplit(e);this.debug(this.pattern,"split",n);let r=this.set;this.debug(this.pattern,"set",r);let o=n[n.length-1];if(!o)for(let a=n.length-2;!o&&a>=0;a--)o=n[a];for(let a=0;a<r.length;a++){let u=r[a],l=n;if(i.matchBase&&u.length===1&&(l=[o]),this.matchOne(l,u,s))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(e){return pe.defaults(e).Minimatch}};pe.AST=ks;pe.Minimatch=Se;pe.escape=rs;pe.unescape=Te});var hC,qf,wa,Uf,Hn,jf,dC,zS,At,Wf,Ts,va,os,Vf=W(()=>{hC=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,qf=new Set,wa=typeof process=="object"&&process?process:{},Uf=(t,e,s,i)=>{typeof wa.emitWarning=="function"?wa.emitWarning(t,e,s,i):console.error(`[${s}] ${e}: ${t}`)},Hn=globalThis.AbortController,jf=globalThis.AbortSignal;if(typeof Hn>"u"){jf=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(i,n){this._onabort.push(n)}},Hn=class{constructor(){e()}signal=new jf;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=!0;for(let n of this.signal._onabort)n(i);this.signal.onabort?.(i)}}};let t=wa.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,Uf("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}dC=t=>!qf.has(t),zS=Symbol("type"),At=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),Wf=t=>At(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?Ts:null:null,Ts=class extends Array{constructor(e){super(e),this.fill(0)}},va=class t{heap;length;static#e=!1;static create(e){let s=Wf(e);if(!s)return[];t.#e=!0;let i=new t(e,s);return t.#e=!1,i}constructor(e,s){if(!t.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new s(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},os=class t{#e;#s;#r;#n;#o;#C;#g;#c;get perf(){return this.#c}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#h;#f;#u;#i;#d;#E;#F;#D;#_;#p;#v;#S;#m;#y;#b;#A;#t;#N;static unsafeExposeInternals(e){return{starts:e.#S,ttls:e.#m,autopurgeTimers:e.#y,sizes:e.#v,keyMap:e.#f,keyList:e.#u,valList:e.#i,next:e.#d,prev:e.#E,get head(){return e.#F},get tail(){return e.#D},free:e.#_,isBackgroundFetch:s=>e.#l(s),backgroundFetch:(s,i,n,r)=>e.#U(s,i,n,r),moveToTail:s=>e.#R(s),indexes:s=>e.#k(s),rindexes:s=>e.#T(s),isStale:s=>e.#w(s)}}get max(){return this.#e}get maxSize(){return this.#s}get calculatedSize(){return this.#h}get size(){return this.#a}get fetchMethod(){return this.#C}get memoMethod(){return this.#g}get dispose(){return this.#r}get onInsert(){return this.#n}get disposeAfter(){return this.#o}constructor(e){let{max:s=0,ttl:i,ttlResolution:n=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:u,dispose:l,onInsert:c,disposeAfter:f,noDisposeOnSet:h,noUpdateTTL:d,maxSize:g=0,maxEntrySize:D=0,sizeCalculation:m,fetchMethod:y,memoMethod:F,noDeleteOnFetchRejection:C,noDeleteOnStaleGet:E,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:A,ignoreFetchAbort:$,perf:b}=e;if(b!==void 0&&typeof b?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#c=b??hC,s!==0&&!At(s))throw new TypeError("max option must be a nonnegative integer");let O=s?Wf(s):Array;if(!O)throw new Error("invalid max value: "+s);if(this.#e=s,this.#s=g,this.maxEntrySize=D||this.#s,this.sizeCalculation=m,this.sizeCalculation){if(!this.#s&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(F!==void 0&&typeof F!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#g=F,y!==void 0&&typeof y!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#C=y,this.#A=!!y,this.#f=new Map,this.#u=new Array(s).fill(void 0),this.#i=new Array(s).fill(void 0),this.#d=new O(s),this.#E=new O(s),this.#F=0,this.#D=0,this.#_=va.create(s),this.#a=0,this.#h=0,typeof l=="function"&&(this.#r=l),typeof c=="function"&&(this.#n=c),typeof f=="function"?(this.#o=f,this.#p=[]):(this.#o=void 0,this.#p=void 0),this.#b=!!this.#r,this.#N=!!this.#n,this.#t=!!this.#o,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!C,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!A,this.ignoreFetchAbort=!!$,this.maxEntrySize!==0){if(this.#s!==0&&!At(this.#s))throw new TypeError("maxSize must be a positive integer if specified");if(!At(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#V()}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!E,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=At(n)||n===0?n:1,this.ttlAutopurge=!!r,this.ttl=i||0,this.ttl){if(!At(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#$()}if(this.#e===0&&this.ttl===0&&this.#s===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#s){let Y="LRU_CACHE_UNBOUNDED";dC(Y)&&(qf.add(Y),Uf("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Y,t))}}getRemainingTTL(e){return this.#f.has(e)?1/0:0}#$(){let e=new Ts(this.#e),s=new Ts(this.#e);this.#m=e,this.#S=s;let i=this.ttlAutopurge?new Array(this.#e):void 0;this.#y=i,this.#L=(o,a,u=this.#c.now())=>{if(s[o]=a!==0?u:0,e[o]=a,i?.[o]&&(clearTimeout(i[o]),i[o]=void 0),a!==0&&i){let l=setTimeout(()=>{this.#w(o)&&this.#B(this.#u[o],"expire")},a+1);l.unref&&l.unref(),i[o]=l}},this.#x=o=>{s[o]=e[o]!==0?this.#c.now():0},this.#I=(o,a)=>{if(e[a]){let u=e[a],l=s[a];if(!u||!l)return;o.ttl=u,o.start=l,o.now=n||r();let c=o.now-l;o.remainingTTL=u-c}};let n=0,r=()=>{let o=this.#c.now();if(this.ttlResolution>0){n=o;let a=setTimeout(()=>n=0,this.ttlResolution);a.unref&&a.unref()}return o};this.getRemainingTTL=o=>{let a=this.#f.get(o);if(a===void 0)return 0;let u=e[a],l=s[a];if(!u||!l)return 1/0;let c=(n||r())-l;return u-c},this.#w=o=>{let a=s[o],u=e[o];return!!u&&!!a&&(n||r())-a>u}}#x=()=>{};#I=()=>{};#L=()=>{};#w=()=>!1;#V(){let e=new Ts(this.#e);this.#h=0,this.#v=e,this.#P=s=>{this.#h-=e[s],e[s]=0},this.#M=(s,i,n,r)=>{if(this.#l(i))return 0;if(!At(n))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(n=r(i,s),!At(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return n},this.#O=(s,i,n)=>{if(e[s]=i,this.#s){let r=this.#s-e[s];for(;this.#h>r;)this.#q(!0)}this.#h+=e[s],n&&(n.entrySize=i,n.totalCalculatedSize=this.#h)}}#P=e=>{};#O=(e,s,i)=>{};#M=(e,s,i,n)=>{if(i||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#k({allowStale:e=this.allowStale}={}){if(this.#a)for(let s=this.#D;!(!this.#j(s)||((e||!this.#w(s))&&(yield s),s===this.#F));)s=this.#E[s]}*#T({allowStale:e=this.allowStale}={}){if(this.#a)for(let s=this.#F;!(!this.#j(s)||((e||!this.#w(s))&&(yield s),s===this.#D));)s=this.#d[s]}#j(e){return e!==void 0&&this.#f.get(this.#u[e])===e}*entries(){for(let e of this.#k())this.#i[e]!==void 0&&this.#u[e]!==void 0&&!this.#l(this.#i[e])&&(yield[this.#u[e],this.#i[e]])}*rentries(){for(let e of this.#T())this.#i[e]!==void 0&&this.#u[e]!==void 0&&!this.#l(this.#i[e])&&(yield[this.#u[e],this.#i[e]])}*keys(){for(let e of this.#k()){let s=this.#u[e];s!==void 0&&!this.#l(this.#i[e])&&(yield s)}}*rkeys(){for(let e of this.#T()){let s=this.#u[e];s!==void 0&&!this.#l(this.#i[e])&&(yield s)}}*values(){for(let e of this.#k())this.#i[e]!==void 0&&!this.#l(this.#i[e])&&(yield this.#i[e])}*rvalues(){for(let e of this.#T())this.#i[e]!==void 0&&!this.#l(this.#i[e])&&(yield this.#i[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,s={}){for(let i of this.#k()){let n=this.#i[i],r=this.#l(n)?n.__staleWhileFetching:n;if(r!==void 0&&e(r,this.#u[i],this))return this.get(this.#u[i],s)}}forEach(e,s=this){for(let i of this.#k()){let n=this.#i[i],r=this.#l(n)?n.__staleWhileFetching:n;r!==void 0&&e.call(s,r,this.#u[i],this)}}rforEach(e,s=this){for(let i of this.#T()){let n=this.#i[i],r=this.#l(n)?n.__staleWhileFetching:n;r!==void 0&&e.call(s,r,this.#u[i],this)}}purgeStale(){let e=!1;for(let s of this.#T({allowStale:!0}))this.#w(s)&&(this.#B(this.#u[s],"expire"),e=!0);return e}info(e){let s=this.#f.get(e);if(s===void 0)return;let i=this.#i[s],n=this.#l(i)?i.__staleWhileFetching:i;if(n===void 0)return;let r={value:n};if(this.#m&&this.#S){let o=this.#m[s],a=this.#S[s];if(o&&a){let u=o-(this.#c.now()-a);r.ttl=u,r.start=Date.now()}}return this.#v&&(r.size=this.#v[s]),r}dump(){let e=[];for(let s of this.#k({allowStale:!0})){let i=this.#u[s],n=this.#i[s],r=this.#l(n)?n.__staleWhileFetching:n;if(r===void 0||i===void 0)continue;let o={value:r};if(this.#m&&this.#S){o.ttl=this.#m[s];let a=this.#c.now()-this.#S[s];o.start=Math.floor(Date.now()-a)}this.#v&&(o.size=this.#v[s]),e.unshift([i,o])}return e}load(e){this.clear();for(let[s,i]of e){if(i.start){let n=Date.now()-i.start;i.start=this.#c.now()-n}this.set(s,i.value,i)}}set(e,s,i={}){if(s===void 0)return this.delete(e),this;let{ttl:n=this.ttl,start:r,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:u}=i,{noUpdateTTL:l=this.noUpdateTTL}=i,c=this.#M(e,s,i.size||0,a);if(this.maxEntrySize&&c>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=!0),this.#B(e,"set"),this;let f=this.#a===0?void 0:this.#f.get(e);if(f===void 0)f=this.#a===0?this.#D:this.#_.length!==0?this.#_.pop():this.#a===this.#e?this.#q(!1):this.#a,this.#u[f]=e,this.#i[f]=s,this.#f.set(e,f),this.#d[this.#D]=f,this.#E[f]=this.#D,this.#D=f,this.#a++,this.#O(f,c,u),u&&(u.set="add"),l=!1,this.#N&&this.#n?.(s,e,"add");else{this.#R(f);let h=this.#i[f];if(s!==h){if(this.#A&&this.#l(h)){h.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=h;d!==void 0&&!o&&(this.#b&&this.#r?.(d,e,"set"),this.#t&&this.#p?.push([d,e,"set"]))}else o||(this.#b&&this.#r?.(h,e,"set"),this.#t&&this.#p?.push([h,e,"set"]));if(this.#P(f),this.#O(f,c,u),this.#i[f]=s,u){u.set="replace";let d=h&&this.#l(h)?h.__staleWhileFetching:h;d!==void 0&&(u.oldValue=d)}}else u&&(u.set="update");this.#N&&this.onInsert?.(s,e,s===h?"update":"replace")}if(n!==0&&!this.#m&&this.#$(),this.#m&&(l||this.#L(f,n,r),u&&this.#I(u,f)),!o&&this.#t&&this.#p){let h=this.#p,d;for(;d=h?.shift();)this.#o?.(...d)}return this}pop(){try{for(;this.#a;){let e=this.#i[this.#F];if(this.#q(!0),this.#l(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#t&&this.#p){let e=this.#p,s;for(;s=e?.shift();)this.#o?.(...s)}}}#q(e){let s=this.#F,i=this.#u[s],n=this.#i[s];return this.#A&&this.#l(n)?n.__abortController.abort(new Error("evicted")):(this.#b||this.#t)&&(this.#b&&this.#r?.(n,i,"evict"),this.#t&&this.#p?.push([n,i,"evict"])),this.#P(s),this.#y?.[s]&&(clearTimeout(this.#y[s]),this.#y[s]=void 0),e&&(this.#u[s]=void 0,this.#i[s]=void 0,this.#_.push(s)),this.#a===1?(this.#F=this.#D=0,this.#_.length=0):this.#F=this.#d[s],this.#f.delete(i),this.#a--,s}has(e,s={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:n}=s,r=this.#f.get(e);if(r!==void 0){let o=this.#i[r];if(this.#l(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#w(r))n&&(n.has="stale",this.#I(n,r));else return i&&this.#x(r),n&&(n.has="hit",this.#I(n,r)),!0}else n&&(n.has="miss");return!1}peek(e,s={}){let{allowStale:i=this.allowStale}=s,n=this.#f.get(e);if(n===void 0||!i&&this.#w(n))return;let r=this.#i[n];return this.#l(r)?r.__staleWhileFetching:r}#U(e,s,i,n){let r=s===void 0?void 0:this.#i[s];if(this.#l(r))return r;let o=new Hn,{signal:a}=i;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let u={signal:o.signal,options:i,context:n},l=(D,m=!1)=>{let{aborted:y}=o.signal,F=i.ignoreFetchAbort&&D!==void 0;if(i.status&&(y&&!m?(i.status.fetchAborted=!0,i.status.fetchError=o.signal.reason,F&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),y&&!F&&!m)return f(o.signal.reason);let C=d,E=this.#i[s];return(E===d||F&&m&&E===void 0)&&(D===void 0?C.__staleWhileFetching!==void 0?this.#i[s]=C.__staleWhileFetching:this.#B(e,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(e,D,u.options))),D},c=D=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=D),f(D)),f=D=>{let{aborted:m}=o.signal,y=m&&i.allowStaleOnFetchAbort,F=y||i.allowStaleOnFetchRejection,C=F||i.noDeleteOnFetchRejection,E=d;if(this.#i[s]===d&&(!C||E.__staleWhileFetching===void 0?this.#B(e,"fetch"):y||(this.#i[s]=E.__staleWhileFetching)),F)return i.status&&E.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),E.__staleWhileFetching;if(E.__returned===E)throw D},h=(D,m)=>{let y=this.#C?.(e,r,u);y&&y instanceof Promise&&y.then(F=>D(F===void 0?void 0:F),m),o.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(D(void 0),i.allowStaleOnFetchAbort&&(D=F=>l(F,!0)))})};i.status&&(i.status.fetchDispatched=!0);let d=new Promise(h).then(l,c),g=Object.assign(d,{__abortController:o,__staleWhileFetching:r,__returned:void 0});return s===void 0?(this.set(e,g,{...u.options,status:void 0}),s=this.#f.get(e)):this.#i[s]=g,g}#l(e){if(!this.#A)return!1;let s=e;return!!s&&s instanceof Promise&&s.hasOwnProperty("__staleWhileFetching")&&s.__abortController instanceof Hn}async fetch(e,s={}){let{allowStale:i=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:u=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:D,forceRefresh:m=!1,status:y,signal:F}=s;if(!this.#A)return y&&(y.fetch="get"),this.get(e,{allowStale:i,updateAgeOnGet:n,noDeleteOnStaleGet:r,status:y});let C={allowStale:i,updateAgeOnGet:n,noDeleteOnStaleGet:r,ttl:o,noDisposeOnSet:a,size:u,sizeCalculation:l,noUpdateTTL:c,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:g,ignoreFetchAbort:d,status:y,signal:F},E=this.#f.get(e);if(E===void 0){y&&(y.fetch="miss");let w=this.#U(e,E,C,D);return w.__returned=w}else{let w=this.#i[E];if(this.#l(w)){let Y=i&&w.__staleWhileFetching!==void 0;return y&&(y.fetch="inflight",Y&&(y.returnedStale=!0)),Y?w.__staleWhileFetching:w.__returned=w}let A=this.#w(E);if(!m&&!A)return y&&(y.fetch="hit"),this.#R(E),n&&this.#x(E),y&&this.#I(y,E),w;let $=this.#U(e,E,C,D),O=$.__staleWhileFetching!==void 0&&i;return y&&(y.fetch=A?"stale":"refresh",O&&A&&(y.returnedStale=!0)),O?$.__staleWhileFetching:$.__returned=$}}async forceFetch(e,s={}){let i=await this.fetch(e,s);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(e,s={}){let i=this.#g;if(!i)throw new Error("no memoMethod provided to constructor");let{context:n,forceRefresh:r,...o}=s,a=this.get(e,o);if(!r&&a!==void 0)return a;let u=i(e,a,{options:o,context:n});return this.set(e,u,o),u}get(e,s={}){let{allowStale:i=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:o}=s,a=this.#f.get(e);if(a!==void 0){let u=this.#i[a],l=this.#l(u);return o&&this.#I(o,a),this.#w(a)?(o&&(o.get="stale"),l?(o&&i&&u.__staleWhileFetching!==void 0&&(o.returnedStale=!0),i?u.__staleWhileFetching:void 0):(r||this.#B(e,"expire"),o&&i&&(o.returnedStale=!0),i?u:void 0)):(o&&(o.get="hit"),l?u.__staleWhileFetching:(this.#R(a),n&&this.#x(a),u))}else o&&(o.get="miss")}#W(e,s){this.#E[s]=e,this.#d[e]=s}#R(e){e!==this.#D&&(e===this.#F?this.#F=this.#d[e]:this.#W(this.#E[e],this.#d[e]),this.#W(this.#D,e),this.#D=e)}delete(e){return this.#B(e,"delete")}#B(e,s){let i=!1;if(this.#a!==0){let n=this.#f.get(e);if(n!==void 0)if(this.#y?.[n]&&(clearTimeout(this.#y?.[n]),this.#y[n]=void 0),i=!0,this.#a===1)this.#z(s);else{this.#P(n);let r=this.#i[n];if(this.#l(r)?r.__abortController.abort(new Error("deleted")):(this.#b||this.#t)&&(this.#b&&this.#r?.(r,e,s),this.#t&&this.#p?.push([r,e,s])),this.#f.delete(e),this.#u[n]=void 0,this.#i[n]=void 0,n===this.#D)this.#D=this.#E[n];else if(n===this.#F)this.#F=this.#d[n];else{let o=this.#E[n];this.#d[o]=this.#d[n];let a=this.#d[n];this.#E[a]=this.#E[n]}this.#a--,this.#_.push(n)}}if(this.#t&&this.#p?.length){let n=this.#p,r;for(;r=n?.shift();)this.#o?.(...r)}return i}clear(){return this.#z("delete")}#z(e){for(let s of this.#T({allowStale:!0})){let i=this.#i[s];if(this.#l(i))i.__abortController.abort(new Error("deleted"));else{let n=this.#u[s];this.#b&&this.#r?.(i,n,e),this.#t&&this.#p?.push([i,n,e])}}if(this.#f.clear(),this.#i.fill(void 0),this.#u.fill(void 0),this.#m&&this.#S){this.#m.fill(0),this.#S.fill(0);for(let s of this.#y??[])s!==void 0&&clearTimeout(s);this.#y?.fill(void 0)}if(this.#v&&this.#v.fill(0),this.#F=0,this.#D=0,this.#_.length=0,this.#h=0,this.#a=0,this.#t&&this.#p){let s=this.#p,i;for(;i=s?.shift();)this.#o?.(...i)}}}});var ir,Ta,Jf,zf,DC,pC,mC,ft,ht,xt,Zn,vi,Qn,Kf,Xn,Gf,qe,$s,ie,Si,Is,ne,me,re,Sa,er,de,X,Aa,xa,Yf,_a,Xe,Ba,tr,Ai,as,Ae,xi,gC,yC,FC,CC,sr,ka,EC,bC,_t,$a=W(()=>{ir=require("node:events"),Ta=gt(require("node:stream"),1),Jf=require("node:string_decoder"),zf=typeof process=="object"&&process?process:{stdout:null,stderr:null},DC=t=>!!t&&typeof t=="object"&&(t instanceof _t||t instanceof Ta.default||pC(t)||mC(t)),pC=t=>!!t&&typeof t=="object"&&t instanceof ir.EventEmitter&&typeof t.pipe=="function"&&t.pipe!==Ta.default.Writable.prototype.pipe,mC=t=>!!t&&typeof t=="object"&&t instanceof ir.EventEmitter&&typeof t.write=="function"&&typeof t.end=="function",ft=Symbol("EOF"),ht=Symbol("maybeEmitEnd"),xt=Symbol("emittedEnd"),Zn=Symbol("emittingEnd"),vi=Symbol("emittedError"),Qn=Symbol("closed"),Kf=Symbol("read"),Xn=Symbol("flush"),Gf=Symbol("flushChunk"),qe=Symbol("encoding"),$s=Symbol("decoder"),ie=Symbol("flowing"),Si=Symbol("paused"),Is=Symbol("resume"),ne=Symbol("buffer"),me=Symbol("pipes"),re=Symbol("bufferLength"),Sa=Symbol("bufferPush"),er=Symbol("bufferShift"),de=Symbol("objectMode"),X=Symbol("destroyed"),Aa=Symbol("error"),xa=Symbol("emitData"),Yf=Symbol("emitEnd"),_a=Symbol("emitEnd2"),Xe=Symbol("async"),Ba=Symbol("abort"),tr=Symbol("aborted"),Ai=Symbol("signal"),as=Symbol("dataListeners"),Ae=Symbol("discarded"),xi=t=>Promise.resolve().then(t),gC=t=>t(),yC=t=>t==="end"||t==="finish"||t==="prefinish",FC=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,CC=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),sr=class{src;dest;opts;ondrain;constructor(e,s,i){this.src=e,this.dest=s,this.opts=i,this.ondrain=()=>e[Is](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},ka=class extends sr{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,s,i){super(e,s,i),this.proxyErrors=n=>s.emit("error",n),e.on("error",this.proxyErrors)}},EC=t=>!!t.objectMode,bC=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",_t=class extends ir.EventEmitter{[ie]=!1;[Si]=!1;[me]=[];[ne]=[];[de];[qe];[Xe];[$s];[ft]=!1;[xt]=!1;[Zn]=!1;[Qn]=!1;[vi]=null;[re]=0;[X]=!1;[Ai];[tr]=!1;[as]=0;[Ae]=!1;writable=!0;readable=!0;constructor(...e){let s=e[0]||{};if(super(),s.objectMode&&typeof s.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");EC(s)?(this[de]=!0,this[qe]=null):bC(s)?(this[qe]=s.encoding,this[de]=!1):(this[de]=!1,this[qe]=null),this[Xe]=!!s.async,this[$s]=this[qe]?new Jf.StringDecoder(this[qe]):null,s&&s.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[ne]}),s&&s.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[me]});let{signal:i}=s;i&&(this[Ai]=i,i.aborted?this[Ba]():i.addEventListener("abort",()=>this[Ba]()))}get bufferLength(){return this[re]}get encoding(){return this[qe]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[de]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Xe]}set async(e){this[Xe]=this[Xe]||!!e}[Ba](){this[tr]=!0,this.emit("abort",this[Ai]?.reason),this.destroy(this[Ai]?.reason)}get aborted(){return this[tr]}set aborted(e){}write(e,s,i){if(this[tr])return!1;if(this[ft])throw new Error("write after end");if(this[X])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof s=="function"&&(i=s,s="utf8"),s||(s="utf8");let n=this[Xe]?xi:gC;if(!this[de]&&!Buffer.isBuffer(e)){if(CC(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(FC(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[de]?(this[ie]&&this[re]!==0&&this[Xn](!0),this[ie]?this.emit("data",e):this[Sa](e),this[re]!==0&&this.emit("readable"),i&&n(i),this[ie]):e.length?(typeof e=="string"&&!(s===this[qe]&&!this[$s]?.lastNeed)&&(e=Buffer.from(e,s)),Buffer.isBuffer(e)&&this[qe]&&(e=this[$s].write(e)),this[ie]&&this[re]!==0&&this[Xn](!0),this[ie]?this.emit("data",e):this[Sa](e),this[re]!==0&&this.emit("readable"),i&&n(i),this[ie]):(this[re]!==0&&this.emit("readable"),i&&n(i),this[ie])}read(e){if(this[X])return null;if(this[Ae]=!1,this[re]===0||e===0||e&&e>this[re])return this[ht](),null;this[de]&&(e=null),this[ne].length>1&&!this[de]&&(this[ne]=[this[qe]?this[ne].join(""):Buffer.concat(this[ne],this[re])]);let s=this[Kf](e||null,this[ne][0]);return this[ht](),s}[Kf](e,s){if(this[de])this[er]();else{let i=s;e===i.length||e===null?this[er]():typeof i=="string"?(this[ne][0]=i.slice(e),s=i.slice(0,e),this[re]-=e):(this[ne][0]=i.subarray(e),s=i.subarray(0,e),this[re]-=e)}return this.emit("data",s),!this[ne].length&&!this[ft]&&this.emit("drain"),s}end(e,s,i){return typeof e=="function"&&(i=e,e=void 0),typeof s=="function"&&(i=s,s="utf8"),e!==void 0&&this.write(e,s),i&&this.once("end",i),this[ft]=!0,this.writable=!1,(this[ie]||!this[Si])&&this[ht](),this}[Is](){this[X]||(!this[as]&&!this[me].length&&(this[Ae]=!0),this[Si]=!1,this[ie]=!0,this.emit("resume"),this[ne].length?this[Xn]():this[ft]?this[ht]():this.emit("drain"))}resume(){return this[Is]()}pause(){this[ie]=!1,this[Si]=!0,this[Ae]=!1}get destroyed(){return this[X]}get flowing(){return this[ie]}get paused(){return this[Si]}[Sa](e){this[de]?this[re]+=1:this[re]+=e.length,this[ne].push(e)}[er](){return this[de]?this[re]-=1:this[re]-=this[ne][0].length,this[ne].shift()}[Xn](e=!1){do;while(this[Gf](this[er]())&&this[ne].length);!e&&!this[ne].length&&!this[ft]&&this.emit("drain")}[Gf](e){return this.emit("data",e),this[ie]}pipe(e,s){if(this[X])return e;this[Ae]=!1;let i=this[xt];return s=s||{},e===zf.stdout||e===zf.stderr?s.end=!1:s.end=s.end!==!1,s.proxyErrors=!!s.proxyErrors,i?s.end&&e.end():(this[me].push(s.proxyErrors?new ka(this,e,s):new sr(this,e,s)),this[Xe]?xi(()=>this[Is]()):this[Is]()),e}unpipe(e){let s=this[me].find(i=>i.dest===e);s&&(this[me].length===1?(this[ie]&&this[as]===0&&(this[ie]=!1),this[me]=[]):this[me].splice(this[me].indexOf(s),1),s.unpipe())}addListener(e,s){return this.on(e,s)}on(e,s){let i=super.on(e,s);if(e==="data")this[Ae]=!1,this[as]++,!this[me].length&&!this[ie]&&this[Is]();else if(e==="readable"&&this[re]!==0)super.emit("readable");else if(yC(e)&&this[xt])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[vi]){let n=s;this[Xe]?xi(()=>n.call(this,this[vi])):n.call(this,this[vi])}return i}removeListener(e,s){return this.off(e,s)}off(e,s){let i=super.off(e,s);return e==="data"&&(this[as]=this.listeners("data").length,this[as]===0&&!this[Ae]&&!this[me].length&&(this[ie]=!1)),i}removeAllListeners(e){let s=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[as]=0,!this[Ae]&&!this[me].length&&(this[ie]=!1)),s}get emittedEnd(){return this[xt]}[ht](){!this[Zn]&&!this[xt]&&!this[X]&&this[ne].length===0&&this[ft]&&(this[Zn]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Qn]&&this.emit("close"),this[Zn]=!1)}emit(e,...s){let i=s[0];if(e!=="error"&&e!=="close"&&e!==X&&this[X])return!1;if(e==="data")return!this[de]&&!i?!1:this[Xe]?(xi(()=>this[xa](i)),!0):this[xa](i);if(e==="end")return this[Yf]();if(e==="close"){if(this[Qn]=!0,!this[xt]&&!this[X])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(e==="error"){this[vi]=i,super.emit(Aa,i);let r=!this[Ai]||this.listeners("error").length?super.emit("error",i):!1;return this[ht](),r}else if(e==="resume"){let r=super.emit("resume");return this[ht](),r}else if(e==="finish"||e==="prefinish"){let r=super.emit(e);return this.removeAllListeners(e),r}let n=super.emit(e,...s);return this[ht](),n}[xa](e){for(let i of this[me])i.dest.write(e)===!1&&this.pause();let s=this[Ae]?!1:super.emit("data",e);return this[ht](),s}[Yf](){return this[xt]?!1:(this[xt]=!0,this.readable=!1,this[Xe]?(xi(()=>this[_a]()),!0):this[_a]())}[_a](){if(this[$s]){let s=this[$s].end();if(s){for(let i of this[me])i.dest.write(s);this[Ae]||super.emit("data",s)}}for(let s of this[me])s.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[de]||(e.dataLength=0);let s=this.promise();return this.on("data",i=>{e.push(i),this[de]||(e.dataLength+=i.length)}),await s,e}async concat(){if(this[de])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[qe]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,s)=>{this.on(X,()=>s(new Error("stream destroyed"))),this.on("error",i=>s(i)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[Ae]=!1;let e=!1,s=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return s();let n=this.read();if(n!==null)return Promise.resolve({done:!1,value:n});if(this[ft])return s();let r,o,a=f=>{this.off("data",u),this.off("end",l),this.off(X,c),s(),o(f)},u=f=>{this.off("error",a),this.off("end",l),this.off(X,c),this.pause(),r({value:f,done:!!this[ft]})},l=()=>{this.off("error",a),this.off("data",u),this.off(X,c),s(),r({done:!0,value:void 0})},c=()=>a(new Error("stream destroyed"));return new Promise((f,h)=>{o=h,r=f,this.once(X,c),this.once("error",a),this.once("end",l),this.once("data",u)})},throw:s,return:s,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[Ae]=!1;let e=!1,s=()=>(this.pause(),this.off(Aa,s),this.off(X,s),this.off("end",s),e=!0,{done:!0,value:void 0}),i=()=>{if(e)return s();let n=this.read();return n===null?s():{done:!1,value:n}};return this.once("end",s),this.once(Aa,s),this.once(X,s),{next:i,throw:s,return:s,[Symbol.iterator](){return this}}}destroy(e){if(this[X])return e?this.emit("error",e):this.emit(X),this;this[X]=!0,this[Ae]=!0,this[ne].length=0,this[re]=0;let s=this;return typeof s.close=="function"&&!this[Qn]&&s.close(),e?this.emit("error",e):this.emit(X),this}static get isStream(){return DC}}});var Ns,eh,tt,wC,Bt,vC,Bi,th,sh,SC,AC,Ne,ih,nh,et,rh,oh,us,ah,Ie,_i,Ia,Hf,ki,Ue,nr,or,Zf,xC,Na,Qf,Ti,Xf,rr,ar,Oa,uh,De,ur,lr,cr,Os,Rs,$i,HS,lh,ch=W(()=>{Vf();Ns=require("node:path"),eh=require("node:url"),tt=require("fs"),wC=gt(require("node:fs"),1),Bt=require("node:fs/promises");$a();vC=tt.realpathSync.native,Bi={lstatSync:tt.lstatSync,readdir:tt.readdir,readdirSync:tt.readdirSync,readlinkSync:tt.readlinkSync,realpathSync:vC,promises:{lstat:Bt.lstat,readdir:Bt.readdir,readlink:Bt.readlink,realpath:Bt.realpath}},th=t=>!t||t===Bi||t===wC?Bi:{...Bi,...t,promises:{...Bi.promises,...t.promises||{}}},sh=/^\\\\\?\\([a-z]:)\\?$/i,SC=t=>t.replace(/\//g,"\\").replace(sh,"$1\\"),AC=/[\\\/]/,Ne=0,ih=1,nh=2,et=4,rh=6,oh=8,us=10,ah=12,Ie=15,_i=~Ie,Ia=16,Hf=32,ki=64,Ue=128,nr=256,or=512,Zf=ki|Ue|or,xC=1023,Na=t=>t.isFile()?oh:t.isDirectory()?et:t.isSymbolicLink()?us:t.isCharacterDevice()?nh:t.isBlockDevice()?rh:t.isSocket()?ah:t.isFIFO()?ih:Ne,Qf=new os({max:2**12}),Ti=t=>{let e=Qf.get(t);if(e)return e;let s=t.normalize("NFKD");return Qf.set(t,s),s},Xf=new os({max:2**12}),rr=t=>{let e=Xf.get(t);if(e)return e;let s=Ti(t.toLowerCase());return Xf.set(t,s),s},ar=class extends os{constructor(){super({max:256})}},Oa=class extends os{constructor(e=16*1024){super({maxSize:e,sizeCalculation:s=>s.length+1})}},uh=Symbol("PathScurry setAsCwd"),De=class{name;root;roots;parent;nocase;isCWD=!1;#e;#s;get dev(){return this.#s}#r;get mode(){return this.#r}#n;get nlink(){return this.#n}#o;get uid(){return this.#o}#C;get gid(){return this.#C}#g;get rdev(){return this.#g}#c;get blksize(){return this.#c}#a;get ino(){return this.#a}#h;get size(){return this.#h}#f;get blocks(){return this.#f}#u;get atimeMs(){return this.#u}#i;get mtimeMs(){return this.#i}#d;get ctimeMs(){return this.#d}#E;get birthtimeMs(){return this.#E}#F;get atime(){return this.#F}#D;get mtime(){return this.#D}#_;get ctime(){return this.#_}#p;get birthtime(){return this.#p}#v;#S;#m;#y;#b;#A;#t;#N;#$;#x;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,s=Ne,i,n,r,o,a){this.name=e,this.#v=r?rr(e):Ti(e),this.#t=s&xC,this.nocase=r,this.roots=n,this.root=i||this,this.#N=o,this.#m=a.fullpath,this.#b=a.relative,this.#A=a.relativePosix,this.parent=a.parent,this.parent?this.#e=this.parent.#e:this.#e=th(a.fs)}depth(){return this.#S!==void 0?this.#S:this.parent?this.#S=this.parent.depth()+1:this.#S=0}childrenCache(){return this.#N}resolve(e){if(!e)return this;let s=this.getRootString(e),n=e.substring(s.length).split(this.splitSep);return s?this.getRoot(s).#I(n):this.#I(n)}#I(e){let s=this;for(let i of e)s=s.child(i);return s}children(){let e=this.#N.get(this);if(e)return e;let s=Object.assign([],{provisional:0});return this.#N.set(this,s),this.#t&=~Ia,s}child(e,s){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let i=this.children(),n=this.nocase?rr(e):Ti(e);for(let u of i)if(u.#v===n)return u;let r=this.parent?this.sep:"",o=this.#m?this.#m+r+e:void 0,a=this.newChild(e,Ne,{...s,parent:this,fullpath:o});return this.canReaddir()||(a.#t|=Ue),i.push(a),a}relative(){if(this.isCWD)return"";if(this.#b!==void 0)return this.#b;let e=this.name,s=this.parent;if(!s)return this.#b=this.name;let i=s.relative();return i+(!i||!s.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#A!==void 0)return this.#A;let e=this.name,s=this.parent;if(!s)return this.#A=this.fullpathPosix();let i=s.relativePosix();return i+(!i||!s.parent?"":"/")+e}fullpath(){if(this.#m!==void 0)return this.#m;let e=this.name,s=this.parent;if(!s)return this.#m=this.name;let n=s.fullpath()+(s.parent?this.sep:"")+e;return this.#m=n}fullpathPosix(){if(this.#y!==void 0)return this.#y;if(this.sep==="/")return this.#y=this.fullpath();if(!this.parent){let n=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(n)?this.#y=`//?/${n}`:this.#y=n}let e=this.parent,s=e.fullpathPosix(),i=s+(!s||!e.parent?"":"/")+this.name;return this.#y=i}isUnknown(){return(this.#t&Ie)===Ne}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#t&Ie)===oh}isDirectory(){return(this.#t&Ie)===et}isCharacterDevice(){return(this.#t&Ie)===nh}isBlockDevice(){return(this.#t&Ie)===rh}isFIFO(){return(this.#t&Ie)===ih}isSocket(){return(this.#t&Ie)===ah}isSymbolicLink(){return(this.#t&us)===us}lstatCached(){return this.#t&Hf?this:void 0}readlinkCached(){return this.#$}realpathCached(){return this.#x}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#$)return!0;if(!this.parent)return!1;let e=this.#t&Ie;return!(e!==Ne&&e!==us||this.#t&nr||this.#t&Ue)}calledReaddir(){return!!(this.#t&Ia)}isENOENT(){return!!(this.#t&Ue)}isNamed(e){return this.nocase?this.#v===rr(e):this.#v===Ti(e)}async readlink(){let e=this.#$;if(e)return e;if(this.canReadlink()&&this.parent)try{let s=await this.#e.promises.readlink(this.fullpath()),i=(await this.parent.realpath())?.resolve(s);if(i)return this.#$=i}catch(s){this.#T(s.code);return}}readlinkSync(){let e=this.#$;if(e)return e;if(this.canReadlink()&&this.parent)try{let s=this.#e.readlinkSync(this.fullpath()),i=this.parent.realpathSync()?.resolve(s);if(i)return this.#$=i}catch(s){this.#T(s.code);return}}#L(e){this.#t|=Ia;for(let s=e.provisional;s<e.length;s++){let i=e[s];i&&i.#w()}}#w(){this.#t&Ue||(this.#t=(this.#t|Ue)&_i,this.#V())}#V(){let e=this.children();e.provisional=0;for(let s of e)s.#w()}#P(){this.#t|=or,this.#O()}#O(){if(this.#t&ki)return;let e=this.#t;(e&Ie)===et&&(e&=_i),this.#t=e|ki,this.#V()}#M(e=""){e==="ENOTDIR"||e==="EPERM"?this.#O():e==="ENOENT"?this.#w():this.children().provisional=0}#k(e=""){e==="ENOTDIR"?this.parent.#O():e==="ENOENT"&&this.#w()}#T(e=""){let s=this.#t;s|=nr,e==="ENOENT"&&(s|=Ue),(e==="EINVAL"||e==="UNKNOWN")&&(s&=_i),this.#t=s,e==="ENOTDIR"&&this.parent&&this.parent.#O()}#j(e,s){return this.#U(e,s)||this.#q(e,s)}#q(e,s){let i=Na(e),n=this.newChild(e.name,i,{parent:this}),r=n.#t&Ie;return r!==et&&r!==us&&r!==Ne&&(n.#t|=ki),s.unshift(n),s.provisional++,n}#U(e,s){for(let i=s.provisional;i<s.length;i++){let n=s[i];if((this.nocase?rr(e.name):Ti(e.name))===n.#v)return this.#l(e,n,i,s)}}#l(e,s,i,n){let r=s.name;return s.#t=s.#t&_i|Na(e),r!==e.name&&(s.name=e.name),i!==n.provisional&&(i===n.length-1?n.pop():n.splice(i,1),n.unshift(s)),n.provisional++,s}async lstat(){if((this.#t&Ue)===0)try{return this.#W(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#k(e.code)}}lstatSync(){if((this.#t&Ue)===0)try{return this.#W(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#k(e.code)}}#W(e){let{atime:s,atimeMs:i,birthtime:n,birthtimeMs:r,blksize:o,blocks:a,ctime:u,ctimeMs:l,dev:c,gid:f,ino:h,mode:d,mtime:g,mtimeMs:D,nlink:m,rdev:y,size:F,uid:C}=e;this.#F=s,this.#u=i,this.#p=n,this.#E=r,this.#c=o,this.#f=a,this.#_=u,this.#d=l,this.#s=c,this.#C=f,this.#a=h,this.#r=d,this.#D=g,this.#i=D,this.#n=m,this.#g=y,this.#h=F,this.#o=C;let E=Na(e);this.#t=this.#t&_i|E|Hf,E!==Ne&&E!==et&&E!==us&&(this.#t|=ki)}#R=[];#B=!1;#z(e){this.#B=!1;let s=this.#R.slice();this.#R.length=0,s.forEach(i=>i(null,e))}readdirCB(e,s=!1){if(!this.canReaddir()){s?e(null,[]):queueMicrotask(()=>e(null,[]));return}let i=this.children();if(this.calledReaddir()){let r=i.slice(0,i.provisional);s?e(null,r):queueMicrotask(()=>e(null,r));return}if(this.#R.push(e),this.#B)return;this.#B=!0;let n=this.fullpath();this.#e.readdir(n,{withFileTypes:!0},(r,o)=>{if(r)this.#M(r.code),i.provisional=0;else{for(let a of o)this.#j(a,i);this.#L(i)}this.#z(i.slice(0,i.provisional))})}#K;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let s=this.fullpath();if(this.#K)await this.#K;else{let i=()=>{};this.#K=new Promise(n=>i=n);try{for(let n of await this.#e.promises.readdir(s,{withFileTypes:!0}))this.#j(n,e);this.#L(e)}catch(n){this.#M(n.code),e.provisional=0}this.#K=void 0,i()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let s=this.fullpath();try{for(let i of this.#e.readdirSync(s,{withFileTypes:!0}))this.#j(i,e);this.#L(e)}catch(i){this.#M(i.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#t&Zf)return!1;let e=Ie&this.#t;return e===Ne||e===et||e===us}shouldWalk(e,s){return(this.#t&et)===et&&!(this.#t&Zf)&&!e.has(this)&&(!s||s(this))}async realpath(){if(this.#x)return this.#x;if(!((or|nr|Ue)&this.#t))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#x=this.resolve(e)}catch{this.#P()}}realpathSync(){if(this.#x)return this.#x;if(!((or|nr|Ue)&this.#t))try{let e=this.#e.realpathSync(this.fullpath());return this.#x=this.resolve(e)}catch{this.#P()}}[uh](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let s=new Set([]),i=[],n=this;for(;n&&n.parent;)s.add(n),n.#b=i.join(this.sep),n.#A=i.join("/"),n=n.parent,i.push("..");for(n=e;n&&n.parent&&!s.has(n);)n.#b=void 0,n.#A=void 0,n=n.parent}},ur=class t extends De{sep="\\";splitSep=AC;constructor(e,s=Ne,i,n,r,o,a){super(e,s,i,n,r,o,a)}newChild(e,s=Ne,i={}){return new t(e,s,this.root,this.roots,this.nocase,this.childrenCache(),i)}getRootString(e){return Ns.win32.parse(e).root}getRoot(e){if(e=SC(e.toUpperCase()),e===this.root.name)return this.root;for(let[s,i]of Object.entries(this.roots))if(this.sameRoot(e,s))return this.roots[e]=i;return this.roots[e]=new Os(e,this).root}sameRoot(e,s=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(sh,"$1\\"),e===s}},lr=class t extends De{splitSep="/";sep="/";constructor(e,s=Ne,i,n,r,o,a){super(e,s,i,n,r,o,a)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,s=Ne,i={}){return new t(e,s,this.root,this.roots,this.nocase,this.childrenCache(),i)}},cr=class{root;rootPath;roots;cwd;#e;#s;#r;nocase;#n;constructor(e=process.cwd(),s,i,{nocase:n,childrenCacheSize:r=16*1024,fs:o=Bi}={}){this.#n=th(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,eh.fileURLToPath)(e));let a=s.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#e=new ar,this.#s=new ar,this.#r=new Oa(r);let u=a.substring(this.rootPath.length).split(i);if(u.length===1&&!u[0]&&u.pop(),n===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=n,this.root=this.newRoot(this.#n),this.roots[this.rootPath]=this.root;let l=this.root,c=u.length-1,f=s.sep,h=this.rootPath,d=!1;for(let g of u){let D=c--;l=l.child(g,{relative:new Array(D).fill("..").join(f),relativePosix:new Array(D).fill("..").join("/"),fullpath:h+=(d?"":f)+g}),d=!0}this.cwd=l}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#r}resolve(...e){let s="";for(let r=e.length-1;r>=0;r--){let o=e[r];if(!(!o||o===".")&&(s=s?`${o}/${s}`:o,this.isAbsolute(o)))break}let i=this.#e.get(s);if(i!==void 0)return i;let n=this.cwd.resolve(s).fullpath();return this.#e.set(s,n),n}resolvePosix(...e){let s="";for(let r=e.length-1;r>=0;r--){let o=e[r];if(!(!o||o===".")&&(s=s?`${o}/${s}`:o,this.isAbsolute(o)))break}let i=this.#s.get(s);if(i!==void 0)return i;let n=this.cwd.resolve(s).fullpathPosix();return this.#s.set(s,n),n}relative(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,s={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof De||(s=e,e=this.cwd);let{withFileTypes:i}=s;if(e.canReaddir()){let n=await e.readdir();return i?n:n.map(r=>r.name)}else return[]}readdirSync(e=this.cwd,s={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof De||(s=e,e=this.cwd);let{withFileTypes:i=!0}=s;return e.canReaddir()?i?e.readdirSync():e.readdirSync().map(n=>n.name):[]}async lstat(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:s}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof De||(s=e.withFileTypes,e=this.cwd);let i=await e.readlink();return s?i:i?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:s}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof De||(s=e.withFileTypes,e=this.cwd);let i=e.readlinkSync();return s?i:i?.fullpath()}async realpath(e=this.cwd,{withFileTypes:s}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof De||(s=e.withFileTypes,e=this.cwd);let i=await e.realpath();return s?i:i?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:s}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof De||(s=e.withFileTypes,e=this.cwd);let i=e.realpathSync();return s?i:i?.fullpath()}async walk(e=this.cwd,s={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof De||(s=e,e=this.cwd);let{withFileTypes:i=!0,follow:n=!1,filter:r,walkFilter:o}=s,a=[];(!r||r(e))&&a.push(i?e:e.fullpath());let u=new Set,l=(f,h)=>{u.add(f),f.readdirCB((d,g)=>{if(d)return h(d);let D=g.length;if(!D)return h();let m=()=>{--D===0&&h()};for(let y of g)(!r||r(y))&&a.push(i?y:y.fullpath()),n&&y.isSymbolicLink()?y.realpath().then(F=>F?.isUnknown()?F.lstat():F).then(F=>F?.shouldWalk(u,o)?l(F,m):m()):y.shouldWalk(u,o)?l(y,m):m()},!0)},c=e;return new Promise((f,h)=>{l(c,d=>{if(d)return h(d);f(a)})})}walkSync(e=this.cwd,s={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof De||(s=e,e=this.cwd);let{withFileTypes:i=!0,follow:n=!1,filter:r,walkFilter:o}=s,a=[];(!r||r(e))&&a.push(i?e:e.fullpath());let u=new Set([e]);for(let l of u){let c=l.readdirSync();for(let f of c){(!r||r(f))&&a.push(i?f:f.fullpath());let h=f;if(f.isSymbolicLink()){if(!(n&&(h=f.realpathSync())))continue;h.isUnknown()&&h.lstatSync()}h.shouldWalk(u,o)&&u.add(h)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,s={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof De||(s=e,e=this.cwd),this.stream(e,s)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,s={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof De||(s=e,e=this.cwd);let{withFileTypes:i=!0,follow:n=!1,filter:r,walkFilter:o}=s;(!r||r(e))&&(yield i?e:e.fullpath());let a=new Set([e]);for(let u of a){let l=u.readdirSync();for(let c of l){(!r||r(c))&&(yield i?c:c.fullpath());let f=c;if(c.isSymbolicLink()){if(!(n&&(f=c.realpathSync())))continue;f.isUnknown()&&f.lstatSync()}f.shouldWalk(a,o)&&a.add(f)}}}stream(e=this.cwd,s={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof De||(s=e,e=this.cwd);let{withFileTypes:i=!0,follow:n=!1,filter:r,walkFilter:o}=s,a=new _t({objectMode:!0});(!r||r(e))&&a.write(i?e:e.fullpath());let u=new Set,l=[e],c=0,f=()=>{let h=!1;for(;!h;){let d=l.shift();if(!d){c===0&&a.end();return}c++,u.add(d);let g=(m,y,F=!1)=>{if(m)return a.emit("error",m);if(n&&!F){let C=[];for(let E of y)E.isSymbolicLink()&&C.push(E.realpath().then(w=>w?.isUnknown()?w.lstat():w));if(C.length){Promise.all(C).then(()=>g(null,y,!0));return}}for(let C of y)C&&(!r||r(C))&&(a.write(i?C:C.fullpath())||(h=!0));c--;for(let C of y){let E=C.realpathCached()||C;E.shouldWalk(u,o)&&l.push(E)}h&&!a.flowing?a.once("drain",f):D||f()},D=!0;d.readdirCB(g,!0),D=!1}};return f(),a}streamSync(e=this.cwd,s={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof De||(s=e,e=this.cwd);let{withFileTypes:i=!0,follow:n=!1,filter:r,walkFilter:o}=s,a=new _t({objectMode:!0}),u=new Set;(!r||r(e))&&a.write(i?e:e.fullpath());let l=[e],c=0,f=()=>{let h=!1;for(;!h;){let d=l.shift();if(!d){c===0&&a.end();return}c++,u.add(d);let g=d.readdirSync();for(let D of g)(!r||r(D))&&(a.write(i?D:D.fullpath())||(h=!0));c--;for(let D of g){let m=D;if(D.isSymbolicLink()){if(!(n&&(m=D.realpathSync())))continue;m.isUnknown()&&m.lstatSync()}m.shouldWalk(u,o)&&l.push(m)}}h&&!a.flowing&&a.once("drain",f)};return f(),a}chdir(e=this.cwd){let s=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[uh](s)}},Os=class extends cr{sep="\\";constructor(e=process.cwd(),s={}){let{nocase:i=!0}=s;super(e,Ns.win32,"\\",{...s,nocase:i}),this.nocase=i;for(let n=this.cwd;n;n=n.parent)n.nocase=this.nocase}parseRootPath(e){return Ns.win32.parse(e).root.toUpperCase()}newRoot(e){return new ur(this.rootPath,et,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},Rs=class extends cr{sep="/";constructor(e=process.cwd(),s={}){let{nocase:i=!1}=s;super(e,Ns.posix,"/",{...s,nocase:i}),this.nocase=i}parseRootPath(e){return"/"}newRoot(e){return new lr(this.rootPath,et,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},$i=class extends Rs{constructor(e=process.cwd(),s={}){let{nocase:i=!0}=s;super(e,{...s,nocase:i})}},HS=process.platform==="win32"?ur:lr,lh=process.platform==="win32"?Os:process.platform==="darwin"?$i:Rs});var _C,BC,Ps,Ra=W(()=>{St();_C=t=>t.length>=1,BC=t=>t.length>=1,Ps=class t{#e;#s;#r;length;#n;#o;#C;#g;#c;#a;#h=!0;constructor(e,s,i,n){if(!_C(e))throw new TypeError("empty pattern list");if(!BC(s))throw new TypeError("empty glob list");if(s.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,i<0||i>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#s=s,this.#r=i,this.#n=n,this.#r===0){if(this.isUNC()){let[r,o,a,u,...l]=this.#e,[c,f,h,d,...g]=this.#s;l[0]===""&&(l.shift(),g.shift());let D=[r,o,a,u,""].join("/"),m=[c,f,h,d,""].join("/");this.#e=[D,...l],this.#s=[m,...g],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[r,...o]=this.#e,[a,...u]=this.#s;o[0]===""&&(o.shift(),u.shift());let l=r+"/",c=a+"/";this.#e=[l,...o],this.#s=[c,...u],this.length=this.#e.length}}}pattern(){return this.#e[this.#r]}isString(){return typeof this.#e[this.#r]=="string"}isGlobstar(){return this.#e[this.#r]===ue}isRegExp(){return this.#e[this.#r]instanceof RegExp}globString(){return this.#C=this.#C||(this.#r===0?this.isAbsolute()?this.#s[0]+this.#s.slice(1).join("/"):this.#s.join("/"):this.#s.slice(this.#r).join("/"))}hasMore(){return this.length>this.#r+1}rest(){return this.#o!==void 0?this.#o:this.hasMore()?(this.#o=new t(this.#e,this.#s,this.#r+1,this.#n),this.#o.#a=this.#a,this.#o.#c=this.#c,this.#o.#g=this.#g,this.#o):this.#o=null}isUNC(){let e=this.#e;return this.#c!==void 0?this.#c:this.#c=this.#n==="win32"&&this.#r===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#e;return this.#g!==void 0?this.#g:this.#g=this.#n==="win32"&&this.#r===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#a!==void 0?this.#a:this.#a=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#e[0];return typeof e=="string"&&this.isAbsolute()&&this.#r===0?e:""}checkFollowGlobstar(){return!(this.#r===0||!this.isGlobstar()||!this.#h)}markFollowGlobstar(){return this.#r===0||!this.isGlobstar()||!this.#h?!1:(this.#h=!1,!0)}}});var kC,ls,Pa=W(()=>{St();Ra();kC=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",ls=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:s,nocase:i,noext:n,noglobstar:r,platform:o=kC}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:s,nocase:i,noext:n,noglobstar:r,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let a of e)this.add(a)}add(e){let s=new Se(e,this.mmopts);for(let i=0;i<s.set.length;i++){let n=s.set[i],r=s.globParts[i];if(!n||!r)throw new Error("invalid pattern object");for(;n[0]==="."&&r[0]===".";)n.shift(),r.shift();let o=new Ps(n,r,0,this.platform),a=new Se(o.globString(),this.mmopts),u=r[r.length-1]==="**",l=o.isAbsolute();l?this.absolute.push(a):this.relative.push(a),u&&(l?this.absoluteChildren.push(a):this.relativeChildren.push(a))}}ignored(e){let s=e.fullpath(),i=`${s}/`,n=e.relative()||".",r=`${n}/`;for(let o of this.relative)if(o.match(n)||o.match(r))return!0;for(let o of this.absolute)if(o.match(s)||o.match(i))return!0;return!1}childrenIgnored(e){let s=e.fullpath()+"/",i=(e.relative()||".")+"/";for(let n of this.relativeChildren)if(n.match(i))return!0;for(let n of this.absoluteChildren)if(n.match(s))return!0;return!1}}});var La,Ma,ja,Ii,fh=W(()=>{St();La=class t{store;constructor(e=new Map){this.store=e}copy(){return new t(new Map(this.store))}hasWalked(e,s){return this.store.get(e.fullpath())?.has(s.globString())}storeWalked(e,s){let i=e.fullpath(),n=this.store.get(i);n?n.add(s.globString()):this.store.set(i,new Set([s.globString()]))}},Ma=class{store=new Map;add(e,s,i){let n=(s?2:0)|(i?1:0),r=this.store.get(e);this.store.set(e,r===void 0?n:n&r)}entries(){return[...this.store.entries()].map(([e,s])=>[e,!!(s&2),!!(s&1)])}},ja=class{store=new Map;add(e,s){if(!e.canReaddir())return;let i=this.store.get(e);i?i.find(n=>n.globString()===s.globString())||i.push(s):this.store.set(e,[s])}get(e){let s=this.store.get(e);if(!s)throw new Error("attempting to walk unknown path");return s}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},Ii=class t{hasWalkedCache;matches=new Ma;subwalks=new ja;patterns;follow;dot;opts;constructor(e,s){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=s?s.copy():new La}processPatterns(e,s){this.patterns=s;let i=s.map(n=>[e,n]);for(let[n,r]of i){this.hasWalkedCache.storeWalked(n,r);let o=r.root(),a=r.isAbsolute()&&this.opts.absolute!==!1;if(o){n=n.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let f=r.rest();if(f)r=f;else{this.matches.add(n,!0,!1);continue}}if(n.isENOENT())continue;let u,l,c=!1;for(;typeof(u=r.pattern())=="string"&&(l=r.rest());)n=n.resolve(u),r=l,c=!0;if(u=r.pattern(),l=r.rest(),c){if(this.hasWalkedCache.hasWalked(n,r))continue;this.hasWalkedCache.storeWalked(n,r)}if(typeof u=="string"){let f=u===".."||u===""||u===".";this.matches.add(n.resolve(u),a,f);continue}else if(u===ue){(!n.isSymbolicLink()||this.follow||r.checkFollowGlobstar())&&this.subwalks.add(n,r);let f=l?.pattern(),h=l?.rest();if(!l||(f===""||f===".")&&!h)this.matches.add(n,a,f===""||f===".");else if(f===".."){let d=n.parent||n;h?this.hasWalkedCache.hasWalked(d,h)||this.subwalks.add(d,h):this.matches.add(d,a,!0)}}else u instanceof RegExp&&this.subwalks.add(n,r)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new t(this.opts,this.hasWalkedCache)}filterEntries(e,s){let i=this.subwalks.get(e),n=this.child();for(let r of s)for(let o of i){let a=o.isAbsolute(),u=o.pattern(),l=o.rest();u===ue?n.testGlobstar(r,o,l,a):u instanceof RegExp?n.testRegExp(r,u,l,a):n.testString(r,u,l,a)}return n}testGlobstar(e,s,i,n){if((this.dot||!e.name.startsWith("."))&&(s.hasMore()||this.matches.add(e,n,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,s):e.isSymbolicLink()&&(i&&s.checkFollowGlobstar()?this.subwalks.add(e,i):s.markFollowGlobstar()&&this.subwalks.add(e,s)))),i){let r=i.pattern();if(typeof r=="string"&&r!==".."&&r!==""&&r!==".")this.testString(e,r,i.rest(),n);else if(r===".."){let o=e.parent||e;this.subwalks.add(o,i)}else r instanceof RegExp&&this.testRegExp(e,r,i.rest(),n)}}testRegExp(e,s,i,n){s.test(e.name)&&(i?this.subwalks.add(e,i):this.matches.add(e,n,!1))}testString(e,s,i,n){e.isNamed(s)&&(i?this.subwalks.add(e,i):this.matches.add(e,n,!1))}}});var TC,fr,Ni,Oi,hh=W(()=>{$a();Pa();fh();TC=(t,e)=>typeof t=="string"?new ls([t],e):Array.isArray(t)?new ls(t,e):t,fr=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#s;#r;signal;maxDepth;includeChildMatches;constructor(e,s,i){if(this.patterns=e,this.path=s,this.opts=i,this.#r=!i.posix&&i.platform==="win32"?"\\":"/",this.includeChildMatches=i.includeChildMatches!==!1,(i.ignore||!this.includeChildMatches)&&(this.#s=TC(i.ignore??[],i),!this.includeChildMatches&&typeof this.#s.add!="function")){let n="cannot ignore child matches, ignore lacks add() method.";throw new Error(n)}this.maxDepth=i.maxDepth||1/0,i.signal&&(this.signal=i.signal,this.signal.addEventListener("abort",()=>{this.#e.length=0}))}#n(e){return this.seen.has(e)||!!this.#s?.ignored?.(e)}#o(e){return!!this.#s?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#e.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#e.push(e):e())}async matchCheck(e,s){if(s&&this.opts.nodir)return;let i;if(this.opts.realpath){if(i=e.realpathCached()||await e.realpath(),!i)return;e=i}let r=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let o=await r.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.lstat()}return this.matchCheckTest(r,s)}matchCheckTest(e,s){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!s||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#n(e)?e:void 0}matchCheckSync(e,s){if(s&&this.opts.nodir)return;let i;if(this.opts.realpath){if(i=e.realpathCached()||e.realpathSync(),!i)return;e=i}let r=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let o=r.realpathSync();o&&(o?.isUnknown()||this.opts.stat)&&o.lstatSync()}return this.matchCheckTest(r,s)}matchFinish(e,s){if(this.#n(e))return;if(!this.includeChildMatches&&this.#s?.add){let r=`${e.relativePosix()}/**`;this.#s.add(r)}let i=this.opts.absolute===void 0?s:this.opts.absolute;this.seen.add(e);let n=this.opts.mark&&e.isDirectory()?this.#r:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(i){let r=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(r+n)}else{let r=this.opts.posix?e.relativePosix():e.relative(),o=this.opts.dotRelative&&!r.startsWith(".."+this.#r)?"."+this.#r:"";this.matchEmit(r?o+r+n:"."+n)}}async match(e,s,i){let n=await this.matchCheck(e,i);n&&this.matchFinish(n,s)}matchSync(e,s,i){let n=this.matchCheckSync(e,i);n&&this.matchFinish(n,s)}walkCB(e,s,i){this.signal?.aborted&&i(),this.walkCB2(e,s,new Ii(this.opts),i)}walkCB2(e,s,i,n){if(this.#o(e))return n();if(this.signal?.aborted&&n(),this.paused){this.onResume(()=>this.walkCB2(e,s,i,n));return}i.processPatterns(e,s);let r=1,o=()=>{--r===0&&n()};for(let[a,u,l]of i.matches.entries())this.#n(a)||(r++,this.match(a,u,l).then(()=>o()));for(let a of i.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let u=a.readdirCached();a.calledReaddir()?this.walkCB3(a,u,i,o):a.readdirCB((l,c)=>this.walkCB3(a,c,i,o),!0)}o()}walkCB3(e,s,i,n){i=i.filterEntries(e,s);let r=1,o=()=>{--r===0&&n()};for(let[a,u,l]of i.matches.entries())this.#n(a)||(r++,this.match(a,u,l).then(()=>o()));for(let[a,u]of i.subwalks.entries())r++,this.walkCB2(a,u,i.child(),o);o()}walkCBSync(e,s,i){this.signal?.aborted&&i(),this.walkCB2Sync(e,s,new Ii(this.opts),i)}walkCB2Sync(e,s,i,n){if(this.#o(e))return n();if(this.signal?.aborted&&n(),this.paused){this.onResume(()=>this.walkCB2Sync(e,s,i,n));return}i.processPatterns(e,s);let r=1,o=()=>{--r===0&&n()};for(let[a,u,l]of i.matches.entries())this.#n(a)||this.matchSync(a,u,l);for(let a of i.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let u=a.readdirSync();this.walkCB3Sync(a,u,i,o)}o()}walkCB3Sync(e,s,i,n){i=i.filterEntries(e,s);let r=1,o=()=>{--r===0&&n()};for(let[a,u,l]of i.matches.entries())this.#n(a)||this.matchSync(a,u,l);for(let[a,u]of i.subwalks.entries())r++,this.walkCB2Sync(a,u,i.child(),o);o()}},Ni=class extends fr{matches=new Set;constructor(e,s,i){super(e,s,i)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,s)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?s(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},Oi=class extends fr{results;constructor(e,s,i){super(e,s,i),this.results=new _t({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}});var dh,$C,Oe,qa=W(()=>{St();dh=require("node:url");ch();Ra();hh();$C=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Oe=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,s){if(!s)throw new TypeError("glob options required");if(this.withFileTypes=!!s.withFileTypes,this.signal=s.signal,this.follow=!!s.follow,this.dot=!!s.dot,this.dotRelative=!!s.dotRelative,this.nodir=!!s.nodir,this.mark=!!s.mark,s.cwd?(s.cwd instanceof URL||s.cwd.startsWith("file://"))&&(s.cwd=(0,dh.fileURLToPath)(s.cwd)):this.cwd="",this.cwd=s.cwd||"",this.root=s.root,this.magicalBraces=!!s.magicalBraces,this.nobrace=!!s.nobrace,this.noext=!!s.noext,this.realpath=!!s.realpath,this.absolute=s.absolute,this.includeChildMatches=s.includeChildMatches!==!1,this.noglobstar=!!s.noglobstar,this.matchBase=!!s.matchBase,this.maxDepth=typeof s.maxDepth=="number"?s.maxDepth:1/0,this.stat=!!s.stat,this.ignore=s.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!s.windowsPathsNoEscape||s.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(u=>u.replace(/\\/g,"/"))),this.matchBase){if(s.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(u=>u.includes("/")?u:`./**/${u}`)}if(this.pattern=e,this.platform=s.platform||$C,this.opts={...s,platform:this.platform},s.scurry){if(this.scurry=s.scurry,s.nocase!==void 0&&s.nocase!==s.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let u=s.platform==="win32"?Os:s.platform==="darwin"?$i:s.platform?Rs:lh;this.scurry=new u(this.cwd,{nocase:s.nocase,fs:s.fs})}this.nocase=this.scurry.nocase;let i=this.platform==="darwin"||this.platform==="win32",n={...s,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:i,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},r=this.pattern.map(u=>new Se(u,n)),[o,a]=r.reduce((u,l)=>(u[0].push(...l.set),u[1].push(...l.globParts),u),[[],[]]);this.patterns=o.map((u,l)=>{let c=a[l];if(!c)throw new Error("invalid pattern object");return new Ps(u,c,0,this.platform)})}async walk(){return[...await new Ni(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new Ni(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new Oi(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new Oi(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}});var hr,Ua=W(()=>{St();hr=(t,e={})=>{Array.isArray(t)||(t=[t]);for(let s of t)if(new Se(s,e).hasMagic())return!0;return!1}});var Ch={};Sn(Ch,{Glob:()=>Oe,Ignore:()=>ls,escape:()=>rs,glob:()=>Ls,globIterate:()=>za,globIterateSync:()=>Pi,globStream:()=>Wa,globStreamSync:()=>Ri,globSync:()=>Va,hasMagic:()=>hr,iterate:()=>yh,iterateSync:()=>gh,stream:()=>mh,streamSync:()=>ph,sync:()=>Fh,unescape:()=>Te});function Ri(t,e={}){return new Oe(t,e).streamSync()}function Wa(t,e={}){return new Oe(t,e).stream()}function Va(t,e={}){return new Oe(t,e).walkSync()}async function Dh(t,e={}){return new Oe(t,e).walk()}function Pi(t,e={}){return new Oe(t,e).iterateSync()}function za(t,e={}){return new Oe(t,e).iterate()}var ph,mh,gh,yh,Fh,Ls,Ka=W(()=>{St();qa();Ua();St();qa();Ua();Pa();ph=Ri,mh=Object.assign(Wa,{sync:Ri}),gh=Pi,yh=Object.assign(za,{sync:Pi}),Fh=Object.assign(Va,{stream:Ri,iterate:Pi}),Ls=Object.assign(Dh,{glob:Dh,globSync:Va,sync:Fh,globStream:Wa,stream:mh,globStreamSync:Ri,streamSync:ph,globIterate:za,iterate:yh,globIterateSync:Pi,iterateSync:gh,Glob:Oe,hasMagic:hr,escape:rs,unescape:Te});Ls.glob=Ls});var V=_(le=>{"use strict";var Ga=Symbol.for("yaml.alias"),Eh=Symbol.for("yaml.document"),dr=Symbol.for("yaml.map"),bh=Symbol.for("yaml.pair"),Ya=Symbol.for("yaml.scalar"),Dr=Symbol.for("yaml.seq"),dt=Symbol.for("yaml.node.type"),IC=t=>!!t&&typeof t=="object"&&t[dt]===Ga,NC=t=>!!t&&typeof t=="object"&&t[dt]===Eh,OC=t=>!!t&&typeof t=="object"&&t[dt]===dr,RC=t=>!!t&&typeof t=="object"&&t[dt]===bh,wh=t=>!!t&&typeof t=="object"&&t[dt]===Ya,PC=t=>!!t&&typeof t=="object"&&t[dt]===Dr;function vh(t){if(t&&typeof t=="object")switch(t[dt]){case dr:case Dr:return!0}return!1}function LC(t){if(t&&typeof t=="object")switch(t[dt]){case Ga:case dr:case Ya:case Dr:return!0}return!1}var MC=t=>(wh(t)||vh(t))&&!!t.anchor;le.ALIAS=Ga;le.DOC=Eh;le.MAP=dr;le.NODE_TYPE=dt;le.PAIR=bh;le.SCALAR=Ya;le.SEQ=Dr;le.hasAnchor=MC;le.isAlias=IC;le.isCollection=vh;le.isDocument=NC;le.isMap=OC;le.isNode=LC;le.isPair=RC;le.isScalar=wh;le.isSeq=PC});var Li=_(Ja=>{"use strict";var te=V(),Fe=Symbol("break visit"),Sh=Symbol("skip children"),st=Symbol("remove node");function pr(t,e){let s=Ah(e);te.isDocument(t)?Ms(null,t.contents,s,Object.freeze([t]))===st&&(t.contents=null):Ms(null,t,s,Object.freeze([]))}pr.BREAK=Fe;pr.SKIP=Sh;pr.REMOVE=st;function Ms(t,e,s,i){let n=xh(t,e,s,i);if(te.isNode(n)||te.isPair(n))return _h(t,i,n),Ms(t,n,s,i);if(typeof n!="symbol"){if(te.isCollection(e)){i=Object.freeze(i.concat(e));for(let r=0;r<e.items.length;++r){let o=Ms(r,e.items[r],s,i);if(typeof o=="number")r=o-1;else{if(o===Fe)return Fe;o===st&&(e.items.splice(r,1),r-=1)}}}else if(te.isPair(e)){i=Object.freeze(i.concat(e));let r=Ms("key",e.key,s,i);if(r===Fe)return Fe;r===st&&(e.key=null);let o=Ms("value",e.value,s,i);if(o===Fe)return Fe;o===st&&(e.value=null)}}return n}async function mr(t,e){let s=Ah(e);te.isDocument(t)?await js(null,t.contents,s,Object.freeze([t]))===st&&(t.contents=null):await js(null,t,s,Object.freeze([]))}mr.BREAK=Fe;mr.SKIP=Sh;mr.REMOVE=st;async function js(t,e,s,i){let n=await xh(t,e,s,i);if(te.isNode(n)||te.isPair(n))return _h(t,i,n),js(t,n,s,i);if(typeof n!="symbol"){if(te.isCollection(e)){i=Object.freeze(i.concat(e));for(let r=0;r<e.items.length;++r){let o=await js(r,e.items[r],s,i);if(typeof o=="number")r=o-1;else{if(o===Fe)return Fe;o===st&&(e.items.splice(r,1),r-=1)}}}else if(te.isPair(e)){i=Object.freeze(i.concat(e));let r=await js("key",e.key,s,i);if(r===Fe)return Fe;r===st&&(e.key=null);let o=await js("value",e.value,s,i);if(o===Fe)return Fe;o===st&&(e.value=null)}}return n}function Ah(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function xh(t,e,s,i){if(typeof s=="function")return s(t,e,i);if(te.isMap(e))return s.Map?.(t,e,i);if(te.isSeq(e))return s.Seq?.(t,e,i);if(te.isPair(e))return s.Pair?.(t,e,i);if(te.isScalar(e))return s.Scalar?.(t,e,i);if(te.isAlias(e))return s.Alias?.(t,e,i)}function _h(t,e,s){let i=e[e.length-1];if(te.isCollection(i))i.items[t]=s;else if(te.isPair(i))t==="key"?i.key=s:i.value=s;else if(te.isDocument(i))i.contents=s;else{let n=te.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}Ja.visit=pr;Ja.visitAsync=mr});var Ha=_(kh=>{"use strict";var Bh=V(),jC=Li(),qC={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},UC=t=>t.replace(/[!,[\]{}]/g,e=>qC[e]),Mi=class t{constructor(e,s){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,s)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,s){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let i=e.trim().split(/[ \t]+/),n=i.shift();switch(n){case"%TAG":{if(i.length!==2&&(s(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[r,o]=i;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return s(0,"%YAML directive should contain exactly one part"),!1;let[r]=i;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let o=/^\d+\.\d+$/.test(r);return s(6,`Unsupported YAML version ${r}`,o),!1}}default:return s(0,`Unknown directive ${n}`,!0),!1}}tagName(e,s){if(e==="!")return"!";if(e[0]!=="!")return s(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(s(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&s("Verbatim tags must end with a >"),o)}let[,i,n]=e.match(/^(.*!)([^!]*)$/s);n||s(`The ${e} tag has no suffix`);let r=this.tags[i];if(r)try{return r+decodeURIComponent(n)}catch(o){return s(String(o)),null}return i==="!"?e:(s(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[s,i]of Object.entries(this.tags))if(e.startsWith(i))return s+UC(e.substring(i.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let s=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),n;if(e&&i.length>0&&Bh.isNode(e.contents)){let r={};jC.visit(e.contents,(o,a)=>{Bh.isNode(a)&&a.tag&&(r[a.tag]=!0)}),n=Object.keys(r)}else n=[];for(let[r,o]of i)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||n.some(a=>a.startsWith(o)))&&s.push(`%TAG ${r} ${o}`);return s.join(`
|
|
59
|
+
`)}};Mi.defaultYaml={explicit:!1,version:"1.2"};Mi.defaultTags={"!!":"tag:yaml.org,2002:"};kh.Directives=Mi});var gr=_(ji=>{"use strict";var Th=V(),WC=Li();function VC(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let s=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(s)}return!0}function $h(t){let e=new Set;return WC.visit(t,{Value(s,i){i.anchor&&e.add(i.anchor)}}),e}function Ih(t,e){for(let s=1;;++s){let i=`${t}${s}`;if(!e.has(i))return i}}function zC(t,e){let s=[],i=new Map,n=null;return{onAnchor:r=>{s.push(r),n??(n=$h(t));let o=Ih(e,n);return n.add(o),o},setAnchors:()=>{for(let r of s){let o=i.get(r);if(typeof o=="object"&&o.anchor&&(Th.isScalar(o.node)||Th.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:i}}ji.anchorIsValid=VC;ji.anchorNames=$h;ji.createNodeAnchors=zC;ji.findNewAnchor=Ih});var Za=_(Nh=>{"use strict";function qi(t,e,s,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let n=0,r=i.length;n<r;++n){let o=i[n],a=qi(t,i,String(n),o);a===void 0?delete i[n]:a!==o&&(i[n]=a)}else if(i instanceof Map)for(let n of Array.from(i.keys())){let r=i.get(n),o=qi(t,i,n,r);o===void 0?i.delete(n):o!==r&&i.set(n,o)}else if(i instanceof Set)for(let n of Array.from(i)){let r=qi(t,i,n,n);r===void 0?i.delete(n):r!==n&&(i.delete(n),i.add(r))}else for(let[n,r]of Object.entries(i)){let o=qi(t,i,n,r);o===void 0?delete i[n]:o!==r&&(i[n]=o)}return t.call(e,s,i)}Nh.applyReviver=qi});var kt=_(Rh=>{"use strict";var KC=V();function Oh(t,e,s){if(Array.isArray(t))return t.map((i,n)=>Oh(i,String(n),s));if(t&&typeof t.toJSON=="function"){if(!s||!KC.hasAnchor(t))return t.toJSON(e,s);let i={aliasCount:0,count:1,res:void 0};s.anchors.set(t,i),s.onCreate=r=>{i.res=r,delete s.onCreate};let n=t.toJSON(e,s);return s.onCreate&&s.onCreate(n),n}return typeof t=="bigint"&&!s?.keep?Number(t):t}Rh.toJS=Oh});var yr=_(Lh=>{"use strict";var GC=Za(),Ph=V(),YC=kt(),Qa=class{constructor(e){Object.defineProperty(this,Ph.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:s,maxAliasCount:i,onAnchor:n,reviver:r}={}){if(!Ph.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},a=YC.toJS(this,"",o);if(typeof n=="function")for(let{count:u,res:l}of o.anchors.values())n(l,u);return typeof r=="function"?GC.applyReviver(r,{"":a},"",a):a}};Lh.NodeBase=Qa});var Ui=_(Mh=>{"use strict";var JC=gr(),HC=Li(),qs=V(),ZC=yr(),QC=kt(),Xa=class extends ZC.NodeBase{constructor(e){super(qs.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,s){let i;s?.aliasResolveCache?i=s.aliasResolveCache:(i=[],HC.visit(e,{Node:(r,o)=>{(qs.isAlias(o)||qs.hasAnchor(o))&&i.push(o)}}),s&&(s.aliasResolveCache=i));let n;for(let r of i){if(r===this)break;r.anchor===this.source&&(n=r)}return n}toJSON(e,s){if(!s)return{source:this.source};let{anchors:i,doc:n,maxAliasCount:r}=s,o=this.resolve(n,s);if(!o){let u=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(u)}let a=i.get(o);if(a||(QC.toJS(o,null,s),a=i.get(o)),a?.res===void 0){let u="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(u)}if(r>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Fr(n,o,i)),a.count*a.aliasCount>r)){let u="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(u)}return a.res}toString(e,s,i){let n=`*${this.source}`;if(e){if(JC.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${n} `}return n}};function Fr(t,e,s){if(qs.isAlias(e)){let i=e.resolve(t),n=s&&i&&s.get(i);return n?n.count*n.aliasCount:0}else if(qs.isCollection(e)){let i=0;for(let n of e.items){let r=Fr(t,n,s);r>i&&(i=r)}return i}else if(qs.isPair(e)){let i=Fr(t,e.key,s),n=Fr(t,e.value,s);return Math.max(i,n)}return 1}Mh.Alias=Xa});var ee=_(eu=>{"use strict";var XC=V(),eE=yr(),tE=kt(),sE=t=>!t||typeof t!="function"&&typeof t!="object",Tt=class extends eE.NodeBase{constructor(e){super(XC.SCALAR),this.value=e}toJSON(e,s){return s?.keep?this.value:tE.toJS(this.value,e,s)}toString(){return String(this.value)}};Tt.BLOCK_FOLDED="BLOCK_FOLDED";Tt.BLOCK_LITERAL="BLOCK_LITERAL";Tt.PLAIN="PLAIN";Tt.QUOTE_DOUBLE="QUOTE_DOUBLE";Tt.QUOTE_SINGLE="QUOTE_SINGLE";eu.Scalar=Tt;eu.isScalarValue=sE});var Wi=_(qh=>{"use strict";var iE=Ui(),cs=V(),jh=ee(),nE="tag:yaml.org,2002:";function rE(t,e,s){if(e){let i=s.filter(r=>r.tag===e),n=i.find(r=>!r.format)??i[0];if(!n)throw new Error(`Tag ${e} not found`);return n}return s.find(i=>i.identify?.(t)&&!i.format)}function oE(t,e,s){if(cs.isDocument(t)&&(t=t.contents),cs.isNode(t))return t;if(cs.isPair(t)){let f=s.schema[cs.MAP].createNode?.(s.schema,null,s);return f.items.push(t),f}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:i,onAnchor:n,onTagObj:r,schema:o,sourceObjects:a}=s,u;if(i&&t&&typeof t=="object"){if(u=a.get(t),u)return u.anchor??(u.anchor=n(t)),new iE.Alias(u.anchor);u={anchor:null,node:null},a.set(t,u)}e?.startsWith("!!")&&(e=nE+e.slice(2));let l=rE(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let f=new jh.Scalar(t);return u&&(u.node=f),f}l=t instanceof Map?o[cs.MAP]:Symbol.iterator in Object(t)?o[cs.SEQ]:o[cs.MAP]}r&&(r(l),delete s.onTagObj);let c=l?.createNode?l.createNode(s.schema,t,s):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(s.schema,t,s):new jh.Scalar(t);return e?c.tag=e:l.default||(c.tag=l.tag),u&&(u.node=c),c}qh.createNode=oE});var Er=_(Cr=>{"use strict";var aE=Wi(),it=V(),uE=yr();function tu(t,e,s){let i=s;for(let n=e.length-1;n>=0;--n){let r=e[n];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=i,i=o}else i=new Map([[r,i]])}return aE.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Uh=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,su=class extends uE.NodeBase{constructor(e,s){super(e),Object.defineProperty(this,"schema",{value:s,configurable:!0,enumerable:!1,writable:!0})}clone(e){let s=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(s.schema=e),s.items=s.items.map(i=>it.isNode(i)||it.isPair(i)?i.clone(e):i),this.range&&(s.range=this.range.slice()),s}addIn(e,s){if(Uh(e))this.add(s);else{let[i,...n]=e,r=this.get(i,!0);if(it.isCollection(r))r.addIn(n,s);else if(r===void 0&&this.schema)this.set(i,tu(this.schema,n,s));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}deleteIn(e){let[s,...i]=e;if(i.length===0)return this.delete(s);let n=this.get(s,!0);if(it.isCollection(n))return n.deleteIn(i);throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}getIn(e,s){let[i,...n]=e,r=this.get(i,!0);return n.length===0?!s&&it.isScalar(r)?r.value:r:it.isCollection(r)?r.getIn(n,s):void 0}hasAllNullValues(e){return this.items.every(s=>{if(!it.isPair(s))return!1;let i=s.value;return i==null||e&&it.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(e){let[s,...i]=e;if(i.length===0)return this.has(s);let n=this.get(s,!0);return it.isCollection(n)?n.hasIn(i):!1}setIn(e,s){let[i,...n]=e;if(n.length===0)this.set(i,s);else{let r=this.get(i,!0);if(it.isCollection(r))r.setIn(n,s);else if(r===void 0&&this.schema)this.set(i,tu(this.schema,n,s));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}};Cr.Collection=su;Cr.collectionFromPath=tu;Cr.isEmptyPath=Uh});var Vi=_(br=>{"use strict";var lE=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function iu(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var cE=(t,e,s)=>t.endsWith(`
|
|
60
|
+
`)?iu(s,e):s.includes(`
|
|
61
|
+
`)?`
|
|
62
|
+
`+iu(s,e):(t.endsWith(" ")?"":" ")+s;br.indentComment=iu;br.lineComment=cE;br.stringifyComment=lE});var Vh=_(zi=>{"use strict";var fE="flow",nu="block",wr="quoted";function hE(t,e,s="flow",{indentAtStart:i,lineWidth:n=80,minContentWidth:r=20,onFold:o,onOverflow:a}={}){if(!n||n<0)return t;n<r&&(r=0);let u=Math.max(1+r,1+n-e.length);if(t.length<=u)return t;let l=[],c={},f=n-e.length;typeof i=="number"&&(i>n-Math.max(2,r)?l.push(0):f=n-i);let h,d,g=!1,D=-1,m=-1,y=-1;s===nu&&(D=Wh(t,D,e.length),D!==-1&&(f=D+u));for(let C;C=t[D+=1];){if(s===wr&&C==="\\"){switch(m=D,t[D+1]){case"x":D+=3;break;case"u":D+=5;break;case"U":D+=9;break;default:D+=1}y=D}if(C===`
|
|
63
|
+
`)s===nu&&(D=Wh(t,D,e.length)),f=D+e.length+u,h=void 0;else{if(C===" "&&d&&d!==" "&&d!==`
|
|
64
|
+
`&&d!==" "){let E=t[D+1];E&&E!==" "&&E!==`
|
|
65
|
+
`&&E!==" "&&(h=D)}if(D>=f)if(h)l.push(h),f=h+u,h=void 0;else if(s===wr){for(;d===" "||d===" ";)d=C,C=t[D+=1],g=!0;let E=D>y+1?D-2:m-1;if(c[E])return t;l.push(E),c[E]=!0,f=E+u,h=void 0}else g=!0}d=C}if(g&&a&&a(),l.length===0)return t;o&&o();let F=t.slice(0,l[0]);for(let C=0;C<l.length;++C){let E=l[C],w=l[C+1]||t.length;E===0?F=`
|
|
66
|
+
${e}${t.slice(0,w)}`:(s===wr&&c[E]&&(F+=`${t[E]}\\`),F+=`
|
|
67
|
+
${e}${t.slice(E+1,w)}`)}return F}function Wh(t,e,s){let i=e,n=e+1,r=t[n];for(;r===" "||r===" ";)if(e<n+s)r=t[++e];else{do r=t[++e];while(r&&r!==`
|
|
68
|
+
`);i=e,n=e+1,r=t[n]}return i}zi.FOLD_BLOCK=nu;zi.FOLD_FLOW=fE;zi.FOLD_QUOTED=wr;zi.foldFlowLines=hE});var Gi=_(zh=>{"use strict";var We=ee(),$t=Vh(),Sr=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Ar=t=>/^(%|---|\.\.\.)/m.test(t);function dE(t,e,s){if(!e||e<0)return!1;let i=e-s,n=t.length;if(n<=i)return!1;for(let r=0,o=0;r<n;++r)if(t[r]===`
|
|
69
|
+
`){if(r-o>i)return!0;if(o=r+1,n-o<=i)return!1}return!0}function Ki(t,e){let s=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return s;let{implicitKey:i}=e,n=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(Ar(t)?" ":""),o="",a=0;for(let u=0,l=s[u];l;l=s[++u])if(l===" "&&s[u+1]==="\\"&&s[u+2]==="n"&&(o+=s.slice(a,u)+"\\ ",u+=1,a=u,l="\\"),l==="\\")switch(s[u+1]){case"u":{o+=s.slice(a,u);let c=s.substr(u+2,4);switch(c){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:c.substr(0,2)==="00"?o+="\\x"+c.substr(2):o+=s.substr(u,6)}u+=5,a=u+1}break;case"n":if(i||s[u+2]==='"'||s.length<n)u+=1;else{for(o+=s.slice(a,u)+`
|
|
70
|
+
|
|
71
|
+
`;s[u+2]==="\\"&&s[u+3]==="n"&&s[u+4]!=='"';)o+=`
|
|
72
|
+
`,u+=2;o+=r,s[u+2]===" "&&(o+="\\"),u+=1,a=u+1}break;default:u+=1}return o=a?o+s.slice(a):s,i?o:$t.foldFlowLines(o,r,$t.FOLD_QUOTED,Sr(e,!1))}function ru(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
|
|
73
|
+
`)||/[ \t]\n|\n[ \t]/.test(t))return Ki(t,e);let s=e.indent||(Ar(t)?" ":""),i="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
74
|
+
${s}`)+"'";return e.implicitKey?i:$t.foldFlowLines(i,s,$t.FOLD_FLOW,Sr(e,!1))}function Us(t,e){let{singleQuote:s}=e.options,i;if(s===!1)i=Ki;else{let n=t.includes('"'),r=t.includes("'");n&&!r?i=ru:r&&!n?i=Ki:i=s?ru:Ki}return i(t,e)}var ou;try{ou=new RegExp(`(^|(?<!
|
|
75
|
+
))
|
|
76
|
+
+(?!
|
|
77
|
+
|$)`,"g")}catch{ou=/\n+(?!\n|$)/g}function vr({comment:t,type:e,value:s},i,n,r){let{blockQuote:o,commentString:a,lineWidth:u}=i.options;if(!o||/\n[\t ]+$/.test(s))return Us(s,i);let l=i.indent||(i.forceBlockIndent||Ar(s)?" ":""),c=o==="literal"?!0:o==="folded"||e===We.Scalar.BLOCK_FOLDED?!1:e===We.Scalar.BLOCK_LITERAL?!0:!dE(s,u,l.length);if(!s)return c?`|
|
|
78
|
+
`:`>
|
|
79
|
+
`;let f,h;for(h=s.length;h>0;--h){let w=s[h-1];if(w!==`
|
|
80
|
+
`&&w!==" "&&w!==" ")break}let d=s.substring(h),g=d.indexOf(`
|
|
81
|
+
`);g===-1?f="-":s===d||g!==d.length-1?(f="+",r&&r()):f="",d&&(s=s.slice(0,-d.length),d[d.length-1]===`
|
|
82
|
+
`&&(d=d.slice(0,-1)),d=d.replace(ou,`$&${l}`));let D=!1,m,y=-1;for(m=0;m<s.length;++m){let w=s[m];if(w===" ")D=!0;else if(w===`
|
|
83
|
+
`)y=m;else break}let F=s.substring(0,y<m?y+1:m);F&&(s=s.substring(F.length),F=F.replace(/\n+/g,`$&${l}`));let E=(D?l?"2":"1":"")+f;if(t&&(E+=" "+a(t.replace(/ ?[\r\n]+/g," ")),n&&n()),!c){let w=s.replace(/\n+/g,`
|
|
84
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),A=!1,$=Sr(i,!0);o!=="folded"&&e!==We.Scalar.BLOCK_FOLDED&&($.onOverflow=()=>{A=!0});let b=$t.foldFlowLines(`${F}${w}${d}`,l,$t.FOLD_BLOCK,$);if(!A)return`>${E}
|
|
85
|
+
${l}${b}`}return s=s.replace(/\n+/g,`$&${l}`),`|${E}
|
|
86
|
+
${l}${F}${s}${d}`}function DE(t,e,s,i){let{type:n,value:r}=t,{actualString:o,implicitKey:a,indent:u,indentStep:l,inFlow:c}=e;if(a&&r.includes(`
|
|
87
|
+
`)||c&&/[[\]{},]/.test(r))return Us(r,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||c||!r.includes(`
|
|
88
|
+
`)?Us(r,e):vr(t,e,s,i);if(!a&&!c&&n!==We.Scalar.PLAIN&&r.includes(`
|
|
89
|
+
`))return vr(t,e,s,i);if(Ar(r)){if(u==="")return e.forceBlockIndent=!0,vr(t,e,s,i);if(a&&u===l)return Us(r,e)}let f=r.replace(/\n+/g,`$&
|
|
90
|
+
${u}`);if(o){let h=D=>D.default&&D.tag!=="tag:yaml.org,2002:str"&&D.test?.test(f),{compat:d,tags:g}=e.doc.schema;if(g.some(h)||d?.some(h))return Us(r,e)}return a?f:$t.foldFlowLines(f,u,$t.FOLD_FLOW,Sr(e,!1))}function pE(t,e,s,i){let{implicitKey:n,inFlow:r}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==We.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=We.Scalar.QUOTE_DOUBLE);let u=c=>{switch(c){case We.Scalar.BLOCK_FOLDED:case We.Scalar.BLOCK_LITERAL:return n||r?Us(o.value,e):vr(o,e,s,i);case We.Scalar.QUOTE_DOUBLE:return Ki(o.value,e);case We.Scalar.QUOTE_SINGLE:return ru(o.value,e);case We.Scalar.PLAIN:return DE(o,e,s,i);default:return null}},l=u(a);if(l===null){let{defaultKeyType:c,defaultStringType:f}=e.options,h=n&&c||f;if(l=u(h),l===null)throw new Error(`Unsupported default string type ${h}`)}return l}zh.stringifyString=pE});var Yi=_(au=>{"use strict";var mE=gr(),It=V(),gE=Vi(),yE=Gi();function FE(t,e){let s=Object.assign({blockQuote:!0,commentString:gE.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),i;switch(s.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:t,flowCollectionPadding:s.flowCollectionPadding?" ":"",indent:"",indentStep:typeof s.indent=="number"?" ".repeat(s.indent):" ",inFlow:i,options:s}}function CE(t,e){if(e.tag){let n=t.filter(r=>r.tag===e.tag);if(n.length>0)return n.find(r=>r.format===e.format)??n[0]}let s,i;if(It.isScalar(e)){i=e.value;let n=t.filter(r=>r.identify?.(i));if(n.length>1){let r=n.filter(o=>o.test);r.length>0&&(n=r)}s=n.find(r=>r.format===e.format)??n.find(r=>!r.format)}else i=e,s=t.find(n=>n.nodeClass&&i instanceof n.nodeClass);if(!s){let n=i?.constructor?.name??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${n} value`)}return s}function EE(t,e,{anchors:s,doc:i}){if(!i.directives)return"";let n=[],r=(It.isScalar(t)||It.isCollection(t))&&t.anchor;r&&mE.anchorIsValid(r)&&(s.add(r),n.push(`&${r}`));let o=t.tag??(e.default?null:e.tag);return o&&n.push(i.directives.tagString(o)),n.join(" ")}function bE(t,e,s,i){if(It.isPair(t))return t.toString(e,s,i);if(It.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let n,r=It.isNode(t)?t:e.doc.createNode(t,{onTagObj:u=>n=u});n??(n=CE(e.doc.schema.tags,r));let o=EE(r,n,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof n.stringify=="function"?n.stringify(r,e,s,i):It.isScalar(r)?yE.stringifyString(r,e,s,i):r.toString(e,s,i);return o?It.isScalar(r)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
|
91
|
+
${e.indent}${a}`:a}au.createStringifyContext=FE;au.stringify=bE});var Jh=_(Yh=>{"use strict";var Dt=V(),Kh=ee(),Gh=Yi(),Ji=Vi();function wE({key:t,value:e},s,i,n){let{allNullValues:r,doc:o,indent:a,indentStep:u,options:{commentString:l,indentSeq:c,simpleKeys:f}}=s,h=Dt.isNode(t)&&t.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(Dt.isCollection(t)||!Dt.isNode(t)&&typeof t=="object"){let $="With simple keys, collection cannot be used as a key value";throw new Error($)}}let d=!f&&(!t||h&&e==null&&!s.inFlow||Dt.isCollection(t)||(Dt.isScalar(t)?t.type===Kh.Scalar.BLOCK_FOLDED||t.type===Kh.Scalar.BLOCK_LITERAL:typeof t=="object"));s=Object.assign({},s,{allNullValues:!1,implicitKey:!d&&(f||!r),indent:a+u});let g=!1,D=!1,m=Gh.stringify(t,s,()=>g=!0,()=>D=!0);if(!d&&!s.inFlow&&m.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");d=!0}if(s.inFlow){if(r||e==null)return g&&i&&i(),m===""?"?":d?`? ${m}`:m}else if(r&&!f||e==null&&d)return m=`? ${m}`,h&&!g?m+=Ji.lineComment(m,s.indent,l(h)):D&&n&&n(),m;g&&(h=null),d?(h&&(m+=Ji.lineComment(m,s.indent,l(h))),m=`? ${m}
|
|
92
|
+
${a}:`):(m=`${m}:`,h&&(m+=Ji.lineComment(m,s.indent,l(h))));let y,F,C;Dt.isNode(e)?(y=!!e.spaceBefore,F=e.commentBefore,C=e.comment):(y=!1,F=null,C=null,e&&typeof e=="object"&&(e=o.createNode(e))),s.implicitKey=!1,!d&&!h&&Dt.isScalar(e)&&(s.indentAtStart=m.length+1),D=!1,!c&&u.length>=2&&!s.inFlow&&!d&&Dt.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(s.indent=s.indent.substring(2));let E=!1,w=Gh.stringify(e,s,()=>E=!0,()=>D=!0),A=" ";if(h||y||F){if(A=y?`
|
|
93
|
+
`:"",F){let $=l(F);A+=`
|
|
94
|
+
${Ji.indentComment($,s.indent)}`}w===""&&!s.inFlow?A===`
|
|
95
|
+
`&&C&&(A=`
|
|
96
|
+
|
|
97
|
+
`):A+=`
|
|
98
|
+
${s.indent}`}else if(!d&&Dt.isCollection(e)){let $=w[0],b=w.indexOf(`
|
|
99
|
+
`),O=b!==-1,Y=s.inFlow??e.flow??e.items.length===0;if(O||!Y){let ce=!1;if(O&&($==="&"||$==="!")){let z=w.indexOf(" ");$==="&"&&z!==-1&&z<b&&w[z+1]==="!"&&(z=w.indexOf(" ",z+1)),(z===-1||b<z)&&(ce=!0)}ce||(A=`
|
|
100
|
+
${s.indent}`)}}else(w===""||w[0]===`
|
|
101
|
+
`)&&(A="");return m+=A+w,s.inFlow?E&&i&&i():C&&!E?m+=Ji.lineComment(m,s.indent,l(C)):D&&n&&n(),m}Yh.stringifyPair=wE});var lu=_(uu=>{"use strict";var Hh=require("process");function vE(t,...e){t==="debug"&&console.log(...e)}function SE(t,e){(t==="debug"||t==="warn")&&(typeof Hh.emitWarning=="function"?Hh.emitWarning(e):console.warn(e))}uu.debug=vE;uu.warn=SE});var kr=_(Br=>{"use strict";var Hi=V(),Zh=ee(),xr="<<",_r={identify:t=>t===xr||typeof t=="symbol"&&t.description===xr,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Zh.Scalar(Symbol(xr)),{addToJSMap:Qh}),stringify:()=>xr},AE=(t,e)=>(_r.identify(e)||Hi.isScalar(e)&&(!e.type||e.type===Zh.Scalar.PLAIN)&&_r.identify(e.value))&&t?.doc.schema.tags.some(s=>s.tag===_r.tag&&s.default);function Qh(t,e,s){if(s=t&&Hi.isAlias(s)?s.resolve(t.doc):s,Hi.isSeq(s))for(let i of s.items)cu(t,e,i);else if(Array.isArray(s))for(let i of s)cu(t,e,i);else cu(t,e,s)}function cu(t,e,s){let i=t&&Hi.isAlias(s)?s.resolve(t.doc):s;if(!Hi.isMap(i))throw new Error("Merge sources must be maps or map aliases");let n=i.toJSON(null,t,Map);for(let[r,o]of n)e instanceof Map?e.has(r)||e.set(r,o):e instanceof Set?e.add(r):Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}Br.addMergeToJSMap=Qh;Br.isMergeKey=AE;Br.merge=_r});var hu=_(td=>{"use strict";var xE=lu(),Xh=kr(),_E=Yi(),ed=V(),fu=kt();function BE(t,e,{key:s,value:i}){if(ed.isNode(s)&&s.addToJSMap)s.addToJSMap(t,e,i);else if(Xh.isMergeKey(t,s))Xh.addMergeToJSMap(t,e,i);else{let n=fu.toJS(s,"",t);if(e instanceof Map)e.set(n,fu.toJS(i,n,t));else if(e instanceof Set)e.add(n);else{let r=kE(s,n,t),o=fu.toJS(i,r,t);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}function kE(t,e,s){if(e===null)return"";if(typeof e!="object")return String(e);if(ed.isNode(t)&&s?.doc){let i=_E.createStringifyContext(s.doc,{});i.anchors=new Set;for(let r of s.anchors.keys())i.anchors.add(r.anchor);i.inFlow=!0,i.inStringifyKey=!0;let n=t.toString(i);if(!s.mapKeyWarned){let r=JSON.stringify(n);r.length>40&&(r=r.substring(0,36)+'..."'),xE.warn(s.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),s.mapKeyWarned=!0}return n}return JSON.stringify(e)}td.addPairToJSMap=BE});var Nt=_(du=>{"use strict";var sd=Wi(),TE=Jh(),$E=hu(),Tr=V();function IE(t,e,s){let i=sd.createNode(t,void 0,s),n=sd.createNode(e,void 0,s);return new $r(i,n)}var $r=class t{constructor(e,s=null){Object.defineProperty(this,Tr.NODE_TYPE,{value:Tr.PAIR}),this.key=e,this.value=s}clone(e){let{key:s,value:i}=this;return Tr.isNode(s)&&(s=s.clone(e)),Tr.isNode(i)&&(i=i.clone(e)),new t(s,i)}toJSON(e,s){let i=s?.mapAsMap?new Map:{};return $E.addPairToJSMap(s,i,this)}toString(e,s,i){return e?.doc?TE.stringifyPair(this,e,s,i):JSON.stringify(this)}};du.Pair=$r;du.createPair=IE});var Du=_(nd=>{"use strict";var fs=V(),id=Yi(),Ir=Vi();function NE(t,e,s){return(e.inFlow??t.flow?RE:OE)(t,e,s)}function OE({comment:t,items:e},s,{blockItemPrefix:i,flowChars:n,itemIndent:r,onChompKeep:o,onComment:a}){let{indent:u,options:{commentString:l}}=s,c=Object.assign({},s,{indent:r,type:null}),f=!1,h=[];for(let g=0;g<e.length;++g){let D=e[g],m=null;if(fs.isNode(D))!f&&D.spaceBefore&&h.push(""),Nr(s,h,D.commentBefore,f),D.comment&&(m=D.comment);else if(fs.isPair(D)){let F=fs.isNode(D.key)?D.key:null;F&&(!f&&F.spaceBefore&&h.push(""),Nr(s,h,F.commentBefore,f))}f=!1;let y=id.stringify(D,c,()=>m=null,()=>f=!0);m&&(y+=Ir.lineComment(y,r,l(m))),f&&m&&(f=!1),h.push(i+y)}let d;if(h.length===0)d=n.start+n.end;else{d=h[0];for(let g=1;g<h.length;++g){let D=h[g];d+=D?`
|
|
102
|
+
${u}${D}`:`
|
|
103
|
+
`}}return t?(d+=`
|
|
104
|
+
`+Ir.indentComment(l(t),u),a&&a()):f&&o&&o(),d}function RE({items:t},e,{flowChars:s,itemIndent:i}){let{indent:n,indentStep:r,flowCollectionPadding:o,options:{commentString:a}}=e;i+=r;let u=Object.assign({},e,{indent:i,inFlow:!0,type:null}),l=!1,c=0,f=[];for(let g=0;g<t.length;++g){let D=t[g],m=null;if(fs.isNode(D))D.spaceBefore&&f.push(""),Nr(e,f,D.commentBefore,!1),D.comment&&(m=D.comment);else if(fs.isPair(D)){let F=fs.isNode(D.key)?D.key:null;F&&(F.spaceBefore&&f.push(""),Nr(e,f,F.commentBefore,!1),F.comment&&(l=!0));let C=fs.isNode(D.value)?D.value:null;C?(C.comment&&(m=C.comment),C.commentBefore&&(l=!0)):D.value==null&&F?.comment&&(m=F.comment)}m&&(l=!0);let y=id.stringify(D,u,()=>m=null);g<t.length-1&&(y+=","),m&&(y+=Ir.lineComment(y,i,a(m))),!l&&(f.length>c||y.includes(`
|
|
105
|
+
`))&&(l=!0),f.push(y),c=f.length}let{start:h,end:d}=s;if(f.length===0)return h+d;if(!l){let g=f.reduce((D,m)=>D+m.length+2,2);l=e.options.lineWidth>0&&g>e.options.lineWidth}if(l){let g=h;for(let D of f)g+=D?`
|
|
106
|
+
${r}${n}${D}`:`
|
|
107
|
+
`;return`${g}
|
|
108
|
+
${n}${d}`}else return`${h}${o}${f.join(" ")}${o}${d}`}function Nr({indent:t,options:{commentString:e}},s,i,n){if(i&&n&&(i=i.replace(/^\n+/,"")),i){let r=Ir.indentComment(e(i),t);s.push(r.trimStart())}}nd.stringifyCollection=NE});var Rt=_(mu=>{"use strict";var PE=Du(),LE=hu(),ME=Er(),Ot=V(),Or=Nt(),jE=ee();function Zi(t,e){let s=Ot.isScalar(e)?e.value:e;for(let i of t)if(Ot.isPair(i)&&(i.key===e||i.key===s||Ot.isScalar(i.key)&&i.key.value===s))return i}var pu=class extends ME.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Ot.MAP,e),this.items=[]}static from(e,s,i){let{keepUndefined:n,replacer:r}=i,o=new this(e),a=(u,l)=>{if(typeof r=="function")l=r.call(s,u,l);else if(Array.isArray(r)&&!r.includes(u))return;(l!==void 0||n)&&o.items.push(Or.createPair(u,l,i))};if(s instanceof Map)for(let[u,l]of s)a(u,l);else if(s&&typeof s=="object")for(let u of Object.keys(s))a(u,s[u]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,s){let i;Ot.isPair(e)?i=e:!e||typeof e!="object"||!("key"in e)?i=new Or.Pair(e,e?.value):i=new Or.Pair(e.key,e.value);let n=Zi(this.items,i.key),r=this.schema?.sortMapEntries;if(n){if(!s)throw new Error(`Key ${i.key} already set`);Ot.isScalar(n.value)&&jE.isScalarValue(i.value)?n.value.value=i.value:n.value=i.value}else if(r){let o=this.items.findIndex(a=>r(i,a)<0);o===-1?this.items.push(i):this.items.splice(o,0,i)}else this.items.push(i)}delete(e){let s=Zi(this.items,e);return s?this.items.splice(this.items.indexOf(s),1).length>0:!1}get(e,s){let n=Zi(this.items,e)?.value;return(!s&&Ot.isScalar(n)?n.value:n)??void 0}has(e){return!!Zi(this.items,e)}set(e,s){this.add(new Or.Pair(e,s),!0)}toJSON(e,s,i){let n=i?new i:s?.mapAsMap?new Map:{};s?.onCreate&&s.onCreate(n);for(let r of this.items)LE.addPairToJSMap(s,n,r);return n}toString(e,s,i){if(!e)return JSON.stringify(this);for(let n of this.items)if(!Ot.isPair(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),PE.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:i,onComment:s})}};mu.YAMLMap=pu;mu.findPair=Zi});var Ws=_(od=>{"use strict";var qE=V(),rd=Rt(),UE={collection:"map",default:!0,nodeClass:rd.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return qE.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,s)=>rd.YAMLMap.from(t,e,s)};od.map=UE});var Pt=_(ad=>{"use strict";var WE=Wi(),VE=Du(),zE=Er(),Pr=V(),KE=ee(),GE=kt(),gu=class extends zE.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Pr.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let s=Rr(e);return typeof s!="number"?!1:this.items.splice(s,1).length>0}get(e,s){let i=Rr(e);if(typeof i!="number")return;let n=this.items[i];return!s&&Pr.isScalar(n)?n.value:n}has(e){let s=Rr(e);return typeof s=="number"&&s<this.items.length}set(e,s){let i=Rr(e);if(typeof i!="number")throw new Error(`Expected a valid index, not ${e}.`);let n=this.items[i];Pr.isScalar(n)&&KE.isScalarValue(s)?n.value=s:this.items[i]=s}toJSON(e,s){let i=[];s?.onCreate&&s.onCreate(i);let n=0;for(let r of this.items)i.push(GE.toJS(r,String(n++),s));return i}toString(e,s,i){return e?VE.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:i,onComment:s}):JSON.stringify(this)}static from(e,s,i){let{replacer:n}=i,r=new this(e);if(s&&Symbol.iterator in Object(s)){let o=0;for(let a of s){if(typeof n=="function"){let u=s instanceof Set?a:String(o++);a=n.call(s,u,a)}r.items.push(WE.createNode(a,void 0,i))}}return r}};function Rr(t){let e=Pr.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}ad.YAMLSeq=gu});var Vs=_(ld=>{"use strict";var YE=V(),ud=Pt(),JE={collection:"seq",default:!0,nodeClass:ud.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return YE.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,s)=>ud.YAMLSeq.from(t,e,s)};ld.seq=JE});var Qi=_(cd=>{"use strict";var HE=Gi(),ZE={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,s,i){return e=Object.assign({actualString:!0},e),HE.stringifyString(t,e,s,i)}};cd.string=ZE});var Lr=_(dd=>{"use strict";var fd=ee(),hd={identify:t=>t==null,createNode:()=>new fd.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new fd.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&hd.test.test(t)?t:e.options.nullStr};dd.nullTag=hd});var yu=_(pd=>{"use strict";var QE=ee(),Dd={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new QE.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},s){if(t&&Dd.test.test(t)){let i=t[0]==="t"||t[0]==="T";if(e===i)return t}return e?s.options.trueStr:s.options.falseStr}};pd.boolTag=Dd});var zs=_(md=>{"use strict";function XE({format:t,minFractionDigits:e,tag:s,value:i}){if(typeof i=="bigint")return String(i);let n=typeof i=="number"?i:Number(i);if(!isFinite(n))return isNaN(n)?".nan":n<0?"-.inf":".inf";let r=Object.is(i,-0)?"-0":JSON.stringify(i);if(!t&&e&&(!s||s==="tag:yaml.org,2002:float")&&/^\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let a=e-(r.length-o-1);for(;a-- >0;)r+="0"}return r}md.stringifyNumber=XE});var Cu=_(Mr=>{"use strict";var eb=ee(),Fu=zs(),tb={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Fu.stringifyNumber},sb={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Fu.stringifyNumber(t)}},ib={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new eb.Scalar(parseFloat(t)),s=t.indexOf(".");return s!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-s-1),e},stringify:Fu.stringifyNumber};Mr.float=ib;Mr.floatExp=sb;Mr.floatNaN=tb});var bu=_(qr=>{"use strict";var gd=zs(),jr=t=>typeof t=="bigint"||Number.isInteger(t),Eu=(t,e,s,{intAsBigInt:i})=>i?BigInt(t):parseInt(t.substring(e),s);function yd(t,e,s){let{value:i}=t;return jr(i)&&i>=0?s+i.toString(e):gd.stringifyNumber(t)}var nb={identify:t=>jr(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,s)=>Eu(t,2,8,s),stringify:t=>yd(t,8,"0o")},rb={identify:jr,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,s)=>Eu(t,0,10,s),stringify:gd.stringifyNumber},ob={identify:t=>jr(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,s)=>Eu(t,2,16,s),stringify:t=>yd(t,16,"0x")};qr.int=rb;qr.intHex=ob;qr.intOct=nb});var Cd=_(Fd=>{"use strict";var ab=Ws(),ub=Lr(),lb=Vs(),cb=Qi(),fb=yu(),wu=Cu(),vu=bu(),hb=[ab.map,lb.seq,cb.string,ub.nullTag,fb.boolTag,vu.intOct,vu.int,vu.intHex,wu.floatNaN,wu.floatExp,wu.float];Fd.schema=hb});var wd=_(bd=>{"use strict";var db=ee(),Db=Ws(),pb=Vs();function Ed(t){return typeof t=="bigint"||Number.isInteger(t)}var Ur=({value:t})=>JSON.stringify(t),mb=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Ur},{identify:t=>t==null,createNode:()=>new db.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Ur},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Ur},{identify:Ed,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:s})=>s?BigInt(t):parseInt(t,10),stringify:({value:t})=>Ed(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:Ur}],gb={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},yb=[Db.map,pb.seq].concat(mb,gb);bd.schema=yb});var Au=_(vd=>{"use strict";var Xi=require("buffer"),Su=ee(),Fb=Gi(),Cb={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Xi.Buffer=="function")return Xi.Buffer.from(t,"base64");if(typeof atob=="function"){let s=atob(t.replace(/[\n\r]/g,"")),i=new Uint8Array(s.length);for(let n=0;n<s.length;++n)i[n]=s.charCodeAt(n);return i}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:s},i,n,r){if(!s)return"";let o=s,a;if(typeof Xi.Buffer=="function")a=o instanceof Xi.Buffer?o.toString("base64"):Xi.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let u="";for(let l=0;l<o.length;++l)u+=String.fromCharCode(o[l]);a=btoa(u)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Su.Scalar.BLOCK_LITERAL),e!==Su.Scalar.QUOTE_DOUBLE){let u=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),l=Math.ceil(a.length/u),c=new Array(l);for(let f=0,h=0;f<l;++f,h+=u)c[f]=a.substr(h,u);a=c.join(e===Su.Scalar.BLOCK_LITERAL?`
|
|
109
|
+
`:" ")}return Fb.stringifyString({comment:t,type:e,value:a},i,n,r)}};vd.binary=Cb});var zr=_(Vr=>{"use strict";var Wr=V(),xu=Nt(),Eb=ee(),bb=Pt();function Sd(t,e){if(Wr.isSeq(t))for(let s=0;s<t.items.length;++s){let i=t.items[s];if(!Wr.isPair(i)){if(Wr.isMap(i)){i.items.length>1&&e("Each pair must have its own sequence indicator");let n=i.items[0]||new xu.Pair(new Eb.Scalar(null));if(i.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${i.commentBefore}
|
|
110
|
+
${n.key.commentBefore}`:i.commentBefore),i.comment){let r=n.value??n.key;r.comment=r.comment?`${i.comment}
|
|
111
|
+
${r.comment}`:i.comment}i=n}t.items[s]=Wr.isPair(i)?i:new xu.Pair(i)}}else e("Expected a sequence for this tag");return t}function Ad(t,e,s){let{replacer:i}=s,n=new bb.YAMLSeq(t);n.tag="tag:yaml.org,2002:pairs";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof i=="function"&&(o=i.call(e,String(r++),o));let a,u;if(Array.isArray(o))if(o.length===2)a=o[0],u=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)a=l[0],u=o[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=o;n.items.push(xu.createPair(a,u,s))}return n}var wb={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Sd,createNode:Ad};Vr.createPairs=Ad;Vr.pairs=wb;Vr.resolvePairs=Sd});var ku=_(Bu=>{"use strict";var xd=V(),_u=kt(),en=Rt(),vb=Pt(),_d=zr(),hs=class t extends vb.YAMLSeq{constructor(){super(),this.add=en.YAMLMap.prototype.add.bind(this),this.delete=en.YAMLMap.prototype.delete.bind(this),this.get=en.YAMLMap.prototype.get.bind(this),this.has=en.YAMLMap.prototype.has.bind(this),this.set=en.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,s){if(!s)return super.toJSON(e);let i=new Map;s?.onCreate&&s.onCreate(i);for(let n of this.items){let r,o;if(xd.isPair(n)?(r=_u.toJS(n.key,"",s),o=_u.toJS(n.value,r,s)):r=_u.toJS(n,"",s),i.has(r))throw new Error("Ordered maps must not include duplicate keys");i.set(r,o)}return i}static from(e,s,i){let n=_d.createPairs(e,s,i),r=new this;return r.items=n.items,r}};hs.tag="tag:yaml.org,2002:omap";var Sb={collection:"seq",identify:t=>t instanceof Map,nodeClass:hs,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let s=_d.resolvePairs(t,e),i=[];for(let{key:n}of s.items)xd.isScalar(n)&&(i.includes(n.value)?e(`Ordered maps must not include duplicate keys: ${n.value}`):i.push(n.value));return Object.assign(new hs,s)},createNode:(t,e,s)=>hs.from(t,e,s)};Bu.YAMLOMap=hs;Bu.omap=Sb});var Id=_(Tu=>{"use strict";var Bd=ee();function kd({value:t,source:e},s){return e&&(t?Td:$d).test.test(e)?e:t?s.options.trueStr:s.options.falseStr}var Td={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Bd.Scalar(!0),stringify:kd},$d={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Bd.Scalar(!1),stringify:kd};Tu.falseTag=$d;Tu.trueTag=Td});var Nd=_(Kr=>{"use strict";var Ab=ee(),$u=zs(),xb={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:$u.stringifyNumber},_b={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():$u.stringifyNumber(t)}},Bb={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new Ab.Scalar(parseFloat(t.replace(/_/g,""))),s=t.indexOf(".");if(s!==-1){let i=t.substring(s+1).replace(/_/g,"");i[i.length-1]==="0"&&(e.minFractionDigits=i.length)}return e},stringify:$u.stringifyNumber};Kr.float=Bb;Kr.floatExp=_b;Kr.floatNaN=xb});var Rd=_(sn=>{"use strict";var Od=zs(),tn=t=>typeof t=="bigint"||Number.isInteger(t);function Gr(t,e,s,{intAsBigInt:i}){let n=t[0];if((n==="-"||n==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),i){switch(s){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return n==="-"?BigInt(-1)*o:o}let r=parseInt(t,s);return n==="-"?-1*r:r}function Iu(t,e,s){let{value:i}=t;if(tn(i)){let n=i.toString(e);return i<0?"-"+s+n.substr(1):s+n}return Od.stringifyNumber(t)}var kb={identify:tn,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,s)=>Gr(t,2,2,s),stringify:t=>Iu(t,2,"0b")},Tb={identify:tn,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,s)=>Gr(t,1,8,s),stringify:t=>Iu(t,8,"0")},$b={identify:tn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,s)=>Gr(t,0,10,s),stringify:Od.stringifyNumber},Ib={identify:tn,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,s)=>Gr(t,2,16,s),stringify:t=>Iu(t,16,"0x")};sn.int=$b;sn.intBin=kb;sn.intHex=Ib;sn.intOct=Tb});var Ou=_(Nu=>{"use strict";var Hr=V(),Yr=Nt(),Jr=Rt(),ds=class t extends Jr.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let s;Hr.isPair(e)?s=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?s=new Yr.Pair(e.key,null):s=new Yr.Pair(e,null),Jr.findPair(this.items,s.key)||this.items.push(s)}get(e,s){let i=Jr.findPair(this.items,e);return!s&&Hr.isPair(i)?Hr.isScalar(i.key)?i.key.value:i.key:i}set(e,s){if(typeof s!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof s}`);let i=Jr.findPair(this.items,e);i&&!s?this.items.splice(this.items.indexOf(i),1):!i&&s&&this.items.push(new Yr.Pair(e))}toJSON(e,s){return super.toJSON(e,s,Set)}toString(e,s,i){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),s,i);throw new Error("Set items must all have null values")}static from(e,s,i){let{replacer:n}=i,r=new this(e);if(s&&Symbol.iterator in Object(s))for(let o of s)typeof n=="function"&&(o=n.call(s,o,o)),r.items.push(Yr.createPair(o,null,i));return r}};ds.tag="tag:yaml.org,2002:set";var Nb={collection:"map",identify:t=>t instanceof Set,nodeClass:ds,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,s)=>ds.from(t,e,s),resolve(t,e){if(Hr.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ds,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Nu.YAMLSet=ds;Nu.set=Nb});var Pu=_(Zr=>{"use strict";var Ob=zs();function Ru(t,e){let s=t[0],i=s==="-"||s==="+"?t.substring(1):t,n=o=>e?BigInt(o):Number(o),r=i.replace(/_/g,"").split(":").reduce((o,a)=>o*n(60)+n(a),n(0));return s==="-"?n(-1)*r:r}function Pd(t){let{value:e}=t,s=o=>o;if(typeof e=="bigint")s=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return Ob.stringifyNumber(t);let i="";e<0&&(i="-",e*=s(-1));let n=s(60),r=[e%n];return e<60?r.unshift(0):(e=(e-r[0])/n,r.unshift(e%n),e>=60&&(e=(e-r[0])/n,r.unshift(e))),i+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Rb={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:s})=>Ru(t,s),stringify:Pd},Pb={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Ru(t,!1),stringify:Pd},Ld={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(Ld.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,s,i,n,r,o,a]=e.map(Number),u=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(s,i-1,n,r||0,o||0,a||0,u),c=e[8];if(c&&c!=="Z"){let f=Ru(c,!1);Math.abs(f)<30&&(f*=60),l-=6e4*f}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Zr.floatTime=Pb;Zr.intTime=Rb;Zr.timestamp=Ld});var qd=_(jd=>{"use strict";var Lb=Ws(),Mb=Lr(),jb=Vs(),qb=Qi(),Ub=Au(),Md=Id(),Lu=Nd(),Qr=Rd(),Wb=kr(),Vb=ku(),zb=zr(),Kb=Ou(),Mu=Pu(),Gb=[Lb.map,jb.seq,qb.string,Mb.nullTag,Md.trueTag,Md.falseTag,Qr.intBin,Qr.intOct,Qr.int,Qr.intHex,Lu.floatNaN,Lu.floatExp,Lu.float,Ub.binary,Wb.merge,Vb.omap,zb.pairs,Kb.set,Mu.intTime,Mu.floatTime,Mu.timestamp];jd.schema=Gb});var Zd=_(Uu=>{"use strict";var zd=Ws(),Yb=Lr(),Kd=Vs(),Jb=Qi(),Hb=yu(),ju=Cu(),qu=bu(),Zb=Cd(),Qb=wd(),Gd=Au(),nn=kr(),Yd=ku(),Jd=zr(),Ud=qd(),Hd=Ou(),Xr=Pu(),Wd=new Map([["core",Zb.schema],["failsafe",[zd.map,Kd.seq,Jb.string]],["json",Qb.schema],["yaml11",Ud.schema],["yaml-1.1",Ud.schema]]),Vd={binary:Gd.binary,bool:Hb.boolTag,float:ju.float,floatExp:ju.floatExp,floatNaN:ju.floatNaN,floatTime:Xr.floatTime,int:qu.int,intHex:qu.intHex,intOct:qu.intOct,intTime:Xr.intTime,map:zd.map,merge:nn.merge,null:Yb.nullTag,omap:Yd.omap,pairs:Jd.pairs,seq:Kd.seq,set:Hd.set,timestamp:Xr.timestamp},Xb={"tag:yaml.org,2002:binary":Gd.binary,"tag:yaml.org,2002:merge":nn.merge,"tag:yaml.org,2002:omap":Yd.omap,"tag:yaml.org,2002:pairs":Jd.pairs,"tag:yaml.org,2002:set":Hd.set,"tag:yaml.org,2002:timestamp":Xr.timestamp};function e2(t,e,s){let i=Wd.get(e);if(i&&!t)return s&&!i.includes(nn.merge)?i.concat(nn.merge):i.slice();let n=i;if(!n)if(Array.isArray(t))n=[];else{let r=Array.from(Wd.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${r} or define customTags array`)}if(Array.isArray(t))for(let r of t)n=n.concat(r);else typeof t=="function"&&(n=t(n.slice()));return s&&(n=n.concat(nn.merge)),n.reduce((r,o)=>{let a=typeof o=="string"?Vd[o]:o;if(!a){let u=JSON.stringify(o),l=Object.keys(Vd).map(c=>JSON.stringify(c)).join(", ");throw new Error(`Unknown custom tag ${u}; use one of ${l}`)}return r.includes(a)||r.push(a),r},[])}Uu.coreKnownTags=Xb;Uu.getTags=e2});var zu=_(Qd=>{"use strict";var Wu=V(),t2=Ws(),s2=Vs(),i2=Qi(),eo=Zd(),n2=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Vu=class t{constructor({compat:e,customTags:s,merge:i,resolveKnownTags:n,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?eo.getTags(e,"compat"):e?eo.getTags(null,e):null,this.name=typeof r=="string"&&r||"core",this.knownTags=n?eo.coreKnownTags:{},this.tags=eo.getTags(s,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,Wu.MAP,{value:t2.map}),Object.defineProperty(this,Wu.SCALAR,{value:i2.string}),Object.defineProperty(this,Wu.SEQ,{value:s2.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?n2:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Qd.Schema=Vu});var eD=_(Xd=>{"use strict";var r2=V(),Ku=Yi(),rn=Vi();function o2(t,e){let s=[],i=e.directives===!0;if(e.directives!==!1&&t.directives){let u=t.directives.toString(t);u?(s.push(u),i=!0):t.directives.docStart&&(i=!0)}i&&s.push("---");let n=Ku.createStringifyContext(t,e),{commentString:r}=n.options;if(t.commentBefore){s.length!==1&&s.unshift("");let u=r(t.commentBefore);s.unshift(rn.indentComment(u,""))}let o=!1,a=null;if(t.contents){if(r2.isNode(t.contents)){if(t.contents.spaceBefore&&i&&s.push(""),t.contents.commentBefore){let c=r(t.contents.commentBefore);s.push(rn.indentComment(c,""))}n.forceBlockIndent=!!t.comment,a=t.contents.comment}let u=a?void 0:()=>o=!0,l=Ku.stringify(t.contents,n,()=>a=null,u);a&&(l+=rn.lineComment(l,"",r(a))),(l[0]==="|"||l[0]===">")&&s[s.length-1]==="---"?s[s.length-1]=`--- ${l}`:s.push(l)}else s.push(Ku.stringify(t.contents,n));if(t.directives?.docEnd)if(t.comment){let u=r(t.comment);u.includes(`
|
|
112
|
+
`)?(s.push("..."),s.push(rn.indentComment(u,""))):s.push(`... ${u}`)}else s.push("...");else{let u=t.comment;u&&o&&(u=u.replace(/^\n+/,"")),u&&((!o||a)&&s[s.length-1]!==""&&s.push(""),s.push(rn.indentComment(r(u),"")))}return s.join(`
|
|
113
|
+
`)+`
|
|
114
|
+
`}Xd.stringifyDocument=o2});var on=_(tD=>{"use strict";var a2=Ui(),Ks=Er(),Re=V(),u2=Nt(),l2=kt(),c2=zu(),f2=eD(),Gu=gr(),h2=Za(),d2=Wi(),Yu=Ha(),Ju=class t{constructor(e,s,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Re.NODE_TYPE,{value:Re.DOC});let n=null;typeof s=="function"||Array.isArray(s)?n=s:i===void 0&&s&&(i=s,s=void 0);let r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=r;let{version:o}=r;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new Yu.Directives({version:o}),this.setSchema(o,i),this.contents=e===void 0?null:this.createNode(e,n,i)}clone(){let e=Object.create(t.prototype,{[Re.NODE_TYPE]:{value:Re.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=Re.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Gs(this.contents)&&this.contents.add(e)}addIn(e,s){Gs(this.contents)&&this.contents.addIn(e,s)}createAlias(e,s){if(!e.anchor){let i=Gu.anchorNames(this);e.anchor=!s||i.has(s)?Gu.findNewAnchor(s||"a",i):s}return new a2.Alias(e.anchor)}createNode(e,s,i){let n;if(typeof s=="function")e=s.call({"":e},"",e),n=s;else if(Array.isArray(s)){let m=F=>typeof F=="number"||F instanceof String||F instanceof Number,y=s.filter(m).map(String);y.length>0&&(s=s.concat(y)),n=s}else i===void 0&&s&&(i=s,s=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:a,keepUndefined:u,onTagObj:l,tag:c}=i??{},{onAnchor:f,setAnchors:h,sourceObjects:d}=Gu.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:r??!0,keepUndefined:u??!1,onAnchor:f,onTagObj:l,replacer:n,schema:this.schema,sourceObjects:d},D=d2.createNode(e,c,g);return a&&Re.isCollection(D)&&(D.flow=!0),h(),D}createPair(e,s,i={}){let n=this.createNode(e,null,i),r=this.createNode(s,null,i);return new u2.Pair(n,r)}delete(e){return Gs(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Ks.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Gs(this.contents)?this.contents.deleteIn(e):!1}get(e,s){return Re.isCollection(this.contents)?this.contents.get(e,s):void 0}getIn(e,s){return Ks.isEmptyPath(e)?!s&&Re.isScalar(this.contents)?this.contents.value:this.contents:Re.isCollection(this.contents)?this.contents.getIn(e,s):void 0}has(e){return Re.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Ks.isEmptyPath(e)?this.contents!==void 0:Re.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,s){this.contents==null?this.contents=Ks.collectionFromPath(this.schema,[e],s):Gs(this.contents)&&this.contents.set(e,s)}setIn(e,s){Ks.isEmptyPath(e)?this.contents=s:this.contents==null?this.contents=Ks.collectionFromPath(this.schema,Array.from(e),s):Gs(this.contents)&&this.contents.setIn(e,s)}setSchema(e,s={}){typeof e=="number"&&(e=String(e));let i;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Yu.Directives({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new Yu.Directives({version:e}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{let n=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(s.schema instanceof Object)this.schema=s.schema;else if(i)this.schema=new c2.Schema(Object.assign(i,s));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:s,mapAsMap:i,maxAliasCount:n,onAnchor:r,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},u=l2.toJS(this.contents,s??"",a);if(typeof r=="function")for(let{count:l,res:c}of a.anchors.values())r(c,l);return typeof o=="function"?h2.applyReviver(o,{"":u},"",u):u}toJSON(e,s){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:s})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let s=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${s}`)}return f2.stringifyDocument(this,e)}};function Gs(t){if(Re.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}tD.Document=Ju});var ln=_(un=>{"use strict";var an=class extends Error{constructor(e,s,i,n){super(),this.name=e,this.code=i,this.message=n,this.pos=s}},Hu=class extends an{constructor(e,s,i){super("YAMLParseError",e,s,i)}},Zu=class extends an{constructor(e,s,i){super("YAMLWarning",e,s,i)}},D2=(t,e)=>s=>{if(s.pos[0]===-1)return;s.linePos=s.pos.map(a=>e.linePos(a));let{line:i,col:n}=s.linePos[0];s.message+=` at line ${i}, column ${n}`;let r=n-1,o=t.substring(e.lineStarts[i-1],e.lineStarts[i]).replace(/[\n\r]+$/,"");if(r>=60&&o.length>80){let a=Math.min(r-39,o.length-79);o="\u2026"+o.substring(a),r-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),i>1&&/^ *$/.test(o.substring(0,r))){let a=t.substring(e.lineStarts[i-2],e.lineStarts[i-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
115
|
+
`),o=a+o}if(/[^ ]/.test(o)){let a=1,u=s.linePos[1];u?.line===i&&u.col>n&&(a=Math.max(1,Math.min(u.col-n,80-r)));let l=" ".repeat(r)+"^".repeat(a);s.message+=`:
|
|
116
|
+
|
|
117
|
+
${o}
|
|
118
|
+
${l}
|
|
119
|
+
`}};un.YAMLError=an;un.YAMLParseError=Hu;un.YAMLWarning=Zu;un.prettifyError=D2});var cn=_(sD=>{"use strict";function p2(t,{flow:e,indicator:s,next:i,offset:n,onError:r,parentIndent:o,startOnNewline:a}){let u=!1,l=a,c=a,f="",h="",d=!1,g=!1,D=null,m=null,y=null,F=null,C=null,E=null,w=null;for(let b of t)switch(g&&(b.type!=="space"&&b.type!=="newline"&&b.type!=="comma"&&r(b.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),D&&(l&&b.type!=="comment"&&b.type!=="newline"&&r(D,"TAB_AS_INDENT","Tabs are not allowed as indentation"),D=null),b.type){case"space":!e&&(s!=="doc-start"||i?.type!=="flow-collection")&&b.source.includes(" ")&&(D=b),c=!0;break;case"comment":{c||r(b,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let O=b.source.substring(1)||" ";f?f+=h+O:f=O,h="",l=!1;break}case"newline":l?f?f+=b.source:(!E||s!=="seq-item-ind")&&(u=!0):h+=b.source,l=!0,d=!0,(m||y)&&(F=b),c=!0;break;case"anchor":m&&r(b,"MULTIPLE_ANCHORS","A node can have at most one anchor"),b.source.endsWith(":")&&r(b.offset+b.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=b,w??(w=b.offset),l=!1,c=!1,g=!0;break;case"tag":{y&&r(b,"MULTIPLE_TAGS","A node can have at most one tag"),y=b,w??(w=b.offset),l=!1,c=!1,g=!0;break}case s:(m||y)&&r(b,"BAD_PROP_ORDER",`Anchors and tags must be after the ${b.source} indicator`),E&&r(b,"UNEXPECTED_TOKEN",`Unexpected ${b.source} in ${e??"collection"}`),E=b,l=s==="seq-item-ind"||s==="explicit-key-ind",c=!1;break;case"comma":if(e){C&&r(b,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),C=b,l=!1,c=!1;break}default:r(b,"UNEXPECTED_TOKEN",`Unexpected ${b.type} token`),l=!1,c=!1}let A=t[t.length-1],$=A?A.offset+A.source.length:n;return g&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&r(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),D&&(l&&D.indent<=o||i?.type==="block-map"||i?.type==="block-seq")&&r(D,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:C,found:E,spaceBefore:u,comment:f,hasNewline:d,anchor:m,tag:y,newlineAfterProp:F,end:$,start:w??$}}sD.resolveProps=p2});var to=_(iD=>{"use strict";function Qu(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
|
|
120
|
+
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let s of e.start)if(s.type==="newline")return!0;if(e.sep){for(let s of e.sep)if(s.type==="newline")return!0}if(Qu(e.key)||Qu(e.value))return!0}return!1;default:return!0}}iD.containsNewline=Qu});var Xu=_(nD=>{"use strict";var m2=to();function g2(t,e,s){if(e?.type==="flow-collection"){let i=e.end[0];i.indent===t&&(i.source==="]"||i.source==="}")&&m2.containsNewline(e)&&s(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}nD.flowIndentCheck=g2});var el=_(oD=>{"use strict";var rD=V();function y2(t,e,s){let{uniqueKeys:i}=t.options;if(i===!1)return!1;let n=typeof i=="function"?i:(r,o)=>r===o||rD.isScalar(r)&&rD.isScalar(o)&&r.value===o.value;return e.some(r=>n(r.key,s))}oD.mapIncludes=y2});var hD=_(fD=>{"use strict";var aD=Nt(),F2=Rt(),uD=cn(),C2=to(),lD=Xu(),E2=el(),cD="All mapping items must start at the same column";function b2({composeNode:t,composeEmptyNode:e},s,i,n,r){let o=r?.nodeClass??F2.YAMLMap,a=new o(s.schema);s.atRoot&&(s.atRoot=!1);let u=i.offset,l=null;for(let c of i.items){let{start:f,key:h,sep:d,value:g}=c,D=uD.resolveProps(f,{indicator:"explicit-key-ind",next:h??d?.[0],offset:u,onError:n,parentIndent:i.indent,startOnNewline:!0}),m=!D.found;if(m){if(h&&(h.type==="block-seq"?n(u,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in h&&h.indent!==i.indent&&n(u,"BAD_INDENT",cD)),!D.anchor&&!D.tag&&!d){l=D.end,D.comment&&(a.comment?a.comment+=`
|
|
121
|
+
`+D.comment:a.comment=D.comment);continue}(D.newlineAfterProp||C2.containsNewline(h))&&n(h??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else D.found?.indent!==i.indent&&n(u,"BAD_INDENT",cD);s.atKey=!0;let y=D.end,F=h?t(s,h,D,n):e(s,y,f,null,D,n);s.schema.compat&&lD.flowIndentCheck(i.indent,h,n),s.atKey=!1,E2.mapIncludes(s,a.items,F)&&n(y,"DUPLICATE_KEY","Map keys must be unique");let C=uD.resolveProps(d??[],{indicator:"map-value-ind",next:g,offset:F.range[2],onError:n,parentIndent:i.indent,startOnNewline:!h||h.type==="block-scalar"});if(u=C.end,C.found){m&&(g?.type==="block-map"&&!C.hasNewline&&n(u,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),s.options.strict&&D.start<C.found.offset-1024&&n(F.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let E=g?t(s,g,C,n):e(s,u,d,null,C,n);s.schema.compat&&lD.flowIndentCheck(i.indent,g,n),u=E.range[2];let w=new aD.Pair(F,E);s.options.keepSourceTokens&&(w.srcToken=c),a.items.push(w)}else{m&&n(F.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),C.comment&&(F.comment?F.comment+=`
|
|
122
|
+
`+C.comment:F.comment=C.comment);let E=new aD.Pair(F);s.options.keepSourceTokens&&(E.srcToken=c),a.items.push(E)}}return l&&l<u&&n(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[i.offset,u,l??u],a}fD.resolveBlockMap=b2});var DD=_(dD=>{"use strict";var w2=Pt(),v2=cn(),S2=Xu();function A2({composeNode:t,composeEmptyNode:e},s,i,n,r){let o=r?.nodeClass??w2.YAMLSeq,a=new o(s.schema);s.atRoot&&(s.atRoot=!1),s.atKey&&(s.atKey=!1);let u=i.offset,l=null;for(let{start:c,value:f}of i.items){let h=v2.resolveProps(c,{indicator:"seq-item-ind",next:f,offset:u,onError:n,parentIndent:i.indent,startOnNewline:!0});if(!h.found)if(h.anchor||h.tag||f)f?.type==="block-seq"?n(h.end,"BAD_INDENT","All sequence items must start at the same column"):n(u,"MISSING_CHAR","Sequence item without - indicator");else{l=h.end,h.comment&&(a.comment=h.comment);continue}let d=f?t(s,f,h,n):e(s,h.end,c,null,h,n);s.schema.compat&&S2.flowIndentCheck(i.indent,f,n),u=d.range[2],a.items.push(d)}return a.range=[i.offset,u,l??u],a}dD.resolveBlockSeq=A2});var Ys=_(pD=>{"use strict";function x2(t,e,s,i){let n="";if(t){let r=!1,o="";for(let a of t){let{source:u,type:l}=a;switch(l){case"space":r=!0;break;case"comment":{s&&!r&&i(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let c=u.substring(1)||" ";n?n+=o+c:n=c,o="";break}case"newline":n&&(o+=u),r=!0;break;default:i(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=u.length}}return{comment:n,offset:e}}pD.resolveEnd=x2});var FD=_(yD=>{"use strict";var _2=V(),B2=Nt(),mD=Rt(),k2=Pt(),T2=Ys(),gD=cn(),$2=to(),I2=el(),tl="Block collections are not allowed within flow collections",sl=t=>t&&(t.type==="block-map"||t.type==="block-seq");function N2({composeNode:t,composeEmptyNode:e},s,i,n,r){let o=i.start.source==="{",a=o?"flow map":"flow sequence",u=r?.nodeClass??(o?mD.YAMLMap:k2.YAMLSeq),l=new u(s.schema);l.flow=!0;let c=s.atRoot;c&&(s.atRoot=!1),s.atKey&&(s.atKey=!1);let f=i.offset+i.start.source.length;for(let m=0;m<i.items.length;++m){let y=i.items[m],{start:F,key:C,sep:E,value:w}=y,A=gD.resolveProps(F,{flow:a,indicator:"explicit-key-ind",next:C??E?.[0],offset:f,onError:n,parentIndent:i.indent,startOnNewline:!1});if(!A.found){if(!A.anchor&&!A.tag&&!E&&!w){m===0&&A.comma?n(A.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):m<i.items.length-1&&n(A.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),A.comment&&(l.comment?l.comment+=`
|
|
123
|
+
`+A.comment:l.comment=A.comment),f=A.end;continue}!o&&s.options.strict&&$2.containsNewline(C)&&n(C,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)A.comma&&n(A.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(A.comma||n(A.start,"MISSING_CHAR",`Missing , between ${a} items`),A.comment){let $="";e:for(let b of F)switch(b.type){case"comma":case"space":break;case"comment":$=b.source.substring(1);break e;default:break e}if($){let b=l.items[l.items.length-1];_2.isPair(b)&&(b=b.value??b.key),b.comment?b.comment+=`
|
|
124
|
+
`+$:b.comment=$,A.comment=A.comment.substring($.length+1)}}if(!o&&!E&&!A.found){let $=w?t(s,w,A,n):e(s,A.end,E,null,A,n);l.items.push($),f=$.range[2],sl(w)&&n($.range,"BLOCK_IN_FLOW",tl)}else{s.atKey=!0;let $=A.end,b=C?t(s,C,A,n):e(s,$,F,null,A,n);sl(C)&&n(b.range,"BLOCK_IN_FLOW",tl),s.atKey=!1;let O=gD.resolveProps(E??[],{flow:a,indicator:"map-value-ind",next:w,offset:b.range[2],onError:n,parentIndent:i.indent,startOnNewline:!1});if(O.found){if(!o&&!A.found&&s.options.strict){if(E)for(let z of E){if(z===O.found)break;if(z.type==="newline"){n(z,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}A.start<O.found.offset-1024&&n(O.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else w&&("source"in w&&w.source?.[0]===":"?n(w,"MISSING_CHAR",`Missing space after : in ${a}`):n(O.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let Y=w?t(s,w,O,n):O.found?e(s,O.end,E,null,O,n):null;Y?sl(w)&&n(Y.range,"BLOCK_IN_FLOW",tl):O.comment&&(b.comment?b.comment+=`
|
|
125
|
+
`+O.comment:b.comment=O.comment);let ce=new B2.Pair(b,Y);if(s.options.keepSourceTokens&&(ce.srcToken=y),o){let z=l;I2.mapIncludes(s,z.items,b)&&n($,"DUPLICATE_KEY","Map keys must be unique"),z.items.push(ce)}else{let z=new mD.YAMLMap(s.schema);z.flow=!0,z.items.push(ce);let mt=(Y??b).range;z.range=[b.range[0],mt[1],mt[2]],l.items.push(z)}f=Y?Y.range[2]:O.end}}let h=o?"}":"]",[d,...g]=i.end,D=f;if(d?.source===h)D=d.offset+d.source.length;else{let m=a[0].toUpperCase()+a.substring(1),y=c?`${m} must end with a ${h}`:`${m} in block collection must be sufficiently indented and end with a ${h}`;n(f,c?"MISSING_CHAR":"BAD_INDENT",y),d&&d.source.length!==1&&g.unshift(d)}if(g.length>0){let m=T2.resolveEnd(g,D,s.options.strict,n);m.comment&&(l.comment?l.comment+=`
|
|
126
|
+
`+m.comment:l.comment=m.comment),l.range=[i.offset,D,m.offset]}else l.range=[i.offset,D,D];return l}yD.resolveFlowCollection=N2});var ED=_(CD=>{"use strict";var O2=V(),R2=ee(),P2=Rt(),L2=Pt(),M2=hD(),j2=DD(),q2=FD();function il(t,e,s,i,n,r){let o=s.type==="block-map"?M2.resolveBlockMap(t,e,s,i,r):s.type==="block-seq"?j2.resolveBlockSeq(t,e,s,i,r):q2.resolveFlowCollection(t,e,s,i,r),a=o.constructor;return n==="!"||n===a.tagName?(o.tag=a.tagName,o):(n&&(o.tag=n),o)}function U2(t,e,s,i,n){let r=i.tag,o=r?e.directives.tagName(r.source,h=>n(r,"TAG_RESOLVE_FAILED",h)):null;if(s.type==="block-seq"){let{anchor:h,newlineAfterProp:d}=i,g=h&&r?h.offset>r.offset?h:r:h??r;g&&(!d||d.offset<g.offset)&&n(g,"MISSING_CHAR","Missing newline after block sequence props")}let a=s.type==="block-map"?"map":s.type==="block-seq"?"seq":s.start.source==="{"?"map":"seq";if(!r||!o||o==="!"||o===P2.YAMLMap.tagName&&a==="map"||o===L2.YAMLSeq.tagName&&a==="seq")return il(t,e,s,n,o);let u=e.schema.tags.find(h=>h.tag===o&&h.collection===a);if(!u){let h=e.schema.knownTags[o];if(h?.collection===a)e.schema.tags.push(Object.assign({},h,{default:!1})),u=h;else return h?n(r,"BAD_COLLECTION_TYPE",`${h.tag} used for ${a} collection, but expects ${h.collection??"scalar"}`,!0):n(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),il(t,e,s,n,o)}let l=il(t,e,s,n,o,u),c=u.resolve?.(l,h=>n(r,"TAG_RESOLVE_FAILED",h),e.options)??l,f=O2.isNode(c)?c:new R2.Scalar(c);return f.range=l.range,f.tag=o,u?.format&&(f.format=u.format),f}CD.composeCollection=U2});var rl=_(bD=>{"use strict";var nl=ee();function W2(t,e,s){let i=e.offset,n=V2(e,t.options.strict,s);if(!n)return{value:"",type:null,comment:"",range:[i,i,i]};let r=n.mode===">"?nl.Scalar.BLOCK_FOLDED:nl.Scalar.BLOCK_LITERAL,o=e.source?z2(e.source):[],a=o.length;for(let D=o.length-1;D>=0;--D){let m=o[D][1];if(m===""||m==="\r")a=D;else break}if(a===0){let D=n.chomp==="+"&&o.length>0?`
|
|
127
|
+
`.repeat(Math.max(1,o.length-1)):"",m=i+n.length;return e.source&&(m+=e.source.length),{value:D,type:r,comment:n.comment,range:[i,m,m]}}let u=e.indent+n.indent,l=e.offset+n.length,c=0;for(let D=0;D<a;++D){let[m,y]=o[D];if(y===""||y==="\r")n.indent===0&&m.length>u&&(u=m.length);else{m.length<u&&s(l+m.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),n.indent===0&&(u=m.length),c=D,u===0&&!t.atRoot&&s(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=m.length+y.length+1}for(let D=o.length-1;D>=a;--D)o[D][0].length>u&&(a=D+1);let f="",h="",d=!1;for(let D=0;D<c;++D)f+=o[D][0].slice(u)+`
|
|
128
|
+
`;for(let D=c;D<a;++D){let[m,y]=o[D];l+=m.length+y.length+1;let F=y[y.length-1]==="\r";if(F&&(y=y.slice(0,-1)),y&&m.length<u){let E=`Block scalar lines must not be less indented than their ${n.indent?"explicit indentation indicator":"first line"}`;s(l-y.length-(F?2:1),"BAD_INDENT",E),m=""}r===nl.Scalar.BLOCK_LITERAL?(f+=h+m.slice(u)+y,h=`
|
|
129
|
+
`):m.length>u||y[0]===" "?(h===" "?h=`
|
|
130
|
+
`:!d&&h===`
|
|
131
|
+
`&&(h=`
|
|
132
|
+
|
|
133
|
+
`),f+=h+m.slice(u)+y,h=`
|
|
134
|
+
`,d=!0):y===""?h===`
|
|
135
|
+
`?f+=`
|
|
136
|
+
`:h=`
|
|
137
|
+
`:(f+=h+y,h=" ",d=!1)}switch(n.chomp){case"-":break;case"+":for(let D=a;D<o.length;++D)f+=`
|
|
138
|
+
`+o[D][0].slice(u);f[f.length-1]!==`
|
|
139
|
+
`&&(f+=`
|
|
140
|
+
`);break;default:f+=`
|
|
141
|
+
`}let g=i+n.length+e.source.length;return{value:f,type:r,comment:n.comment,range:[i,g,g]}}function V2({offset:t,props:e},s,i){if(e[0].type!=="block-scalar-header")return i(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:n}=e[0],r=n[0],o=0,a="",u=-1;for(let h=1;h<n.length;++h){let d=n[h];if(!a&&(d==="-"||d==="+"))a=d;else{let g=Number(d);!o&&g?o=g:u===-1&&(u=t+h)}}u!==-1&&i(u,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${n}`);let l=!1,c="",f=n.length;for(let h=1;h<e.length;++h){let d=e[h];switch(d.type){case"space":l=!0;case"newline":f+=d.source.length;break;case"comment":s&&!l&&i(d,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=d.source.length,c=d.source.substring(1);break;case"error":i(d,"UNEXPECTED_TOKEN",d.message),f+=d.source.length;break;default:{let g=`Unexpected token in block scalar header: ${d.type}`;i(d,"UNEXPECTED_TOKEN",g);let D=d.source;D&&typeof D=="string"&&(f+=D.length)}}}return{mode:r,indent:o,chomp:a,comment:c,length:f}}function z2(t){let e=t.split(/\n( *)/),s=e[0],i=s.match(/^( *)/),r=[i?.[1]?[i[1],s.slice(i[1].length)]:["",s]];for(let o=1;o<e.length;o+=2)r.push([e[o],e[o+1]]);return r}bD.resolveBlockScalar=W2});var al=_(vD=>{"use strict";var ol=ee(),K2=Ys();function G2(t,e,s){let{offset:i,type:n,source:r,end:o}=t,a,u,l=(h,d,g)=>s(i+h,d,g);switch(n){case"scalar":a=ol.Scalar.PLAIN,u=Y2(r,l);break;case"single-quoted-scalar":a=ol.Scalar.QUOTE_SINGLE,u=J2(r,l);break;case"double-quoted-scalar":a=ol.Scalar.QUOTE_DOUBLE,u=H2(r,l);break;default:return s(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[i,i+r.length,i+r.length]}}let c=i+r.length,f=K2.resolveEnd(o,c,e,s);return{value:u,type:a,comment:f.comment,range:[i,c,f.offset]}}function Y2(t,e){let s="";switch(t[0]){case" ":s="a tab character";break;case",":s="flow indicator character ,";break;case"%":s="directive indicator character %";break;case"|":case">":{s=`block scalar indicator ${t[0]}`;break}case"@":case"`":{s=`reserved character ${t[0]}`;break}}return s&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${s}`),wD(t)}function J2(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),wD(t.slice(1,-1)).replace(/''/g,"'")}function wD(t){let e,s;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
142
|
+
`,"sy"),s=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
143
|
+
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,s=/[ \t]*(.*?)[ \t]*\r?\n/sy}let i=e.exec(t);if(!i)return t;let n=i[1],r=" ",o=e.lastIndex;for(s.lastIndex=o;i=s.exec(t);)i[1]===""?r===`
|
|
144
|
+
`?n+=r:r=`
|
|
145
|
+
`:(n+=r+i[1],r=" "),o=s.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,i=a.exec(t),n+r+(i?.[1]??"")}function H2(t,e){let s="";for(let i=1;i<t.length-1;++i){let n=t[i];if(!(n==="\r"&&t[i+1]===`
|
|
146
|
+
`))if(n===`
|
|
147
|
+
`){let{fold:r,offset:o}=Z2(t,i);s+=r,i=o}else if(n==="\\"){let r=t[++i],o=Q2[r];if(o)s+=o;else if(r===`
|
|
148
|
+
`)for(r=t[i+1];r===" "||r===" ";)r=t[++i+1];else if(r==="\r"&&t[i+1]===`
|
|
149
|
+
`)for(r=t[++i+1];r===" "||r===" ";)r=t[++i+1];else if(r==="x"||r==="u"||r==="U"){let a={x:2,u:4,U:8}[r];s+=X2(t,i+1,a,e),i+=a}else{let a=t.substr(i-1,2);e(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),s+=a}}else if(n===" "||n===" "){let r=i,o=t[i+1];for(;o===" "||o===" ";)o=t[++i+1];o!==`
|
|
150
|
+
`&&!(o==="\r"&&t[i+2]===`
|
|
151
|
+
`)&&(s+=i>r?t.slice(r,i+1):n)}else s+=n}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),s}function Z2(t,e){let s="",i=t[e+1];for(;(i===" "||i===" "||i===`
|
|
152
|
+
`||i==="\r")&&!(i==="\r"&&t[e+2]!==`
|
|
153
|
+
`);)i===`
|
|
154
|
+
`&&(s+=`
|
|
155
|
+
`),e+=1,i=t[e+1];return s||(s=" "),{fold:s,offset:e}}var Q2={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
156
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function X2(t,e,s,i){let n=t.substr(e,s),o=n.length===s&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;if(isNaN(o)){let a=t.substr(e-2,s+2);return i(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}vD.resolveFlowScalar=G2});var xD=_(AD=>{"use strict";var Ds=V(),SD=ee(),ew=rl(),tw=al();function sw(t,e,s,i){let{value:n,type:r,comment:o,range:a}=e.type==="block-scalar"?ew.resolveBlockScalar(t,e,i):tw.resolveFlowScalar(e,t.options.strict,i),u=s?t.directives.tagName(s.source,f=>i(s,"TAG_RESOLVE_FAILED",f)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[Ds.SCALAR]:u?l=iw(t.schema,n,u,s,i):e.type==="scalar"?l=nw(t,n,e,i):l=t.schema[Ds.SCALAR];let c;try{let f=l.resolve(n,h=>i(s??e,"TAG_RESOLVE_FAILED",h),t.options);c=Ds.isScalar(f)?f:new SD.Scalar(f)}catch(f){let h=f instanceof Error?f.message:String(f);i(s??e,"TAG_RESOLVE_FAILED",h),c=new SD.Scalar(n)}return c.range=a,c.source=n,r&&(c.type=r),u&&(c.tag=u),l.format&&(c.format=l.format),o&&(c.comment=o),c}function iw(t,e,s,i,n){if(s==="!")return t[Ds.SCALAR];let r=[];for(let a of t.tags)if(!a.collection&&a.tag===s)if(a.default&&a.test)r.push(a);else return a;for(let a of r)if(a.test?.test(e))return a;let o=t.knownTags[s];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(n(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,s!=="tag:yaml.org,2002:str"),t[Ds.SCALAR])}function nw({atKey:t,directives:e,schema:s},i,n,r){let o=s.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(i))||s[Ds.SCALAR];if(s.compat){let a=s.compat.find(u=>u.default&&u.test?.test(i))??s[Ds.SCALAR];if(o.tag!==a.tag){let u=e.tagString(o.tag),l=e.tagString(a.tag),c=`Value may be parsed as either ${u} or ${l}`;r(n,"TAG_RESOLVE_FAILED",c,!0)}}return o}AD.composeScalar=sw});var BD=_(_D=>{"use strict";function rw(t,e,s){if(e){s??(s=e.length);for(let i=s-1;i>=0;--i){let n=e[i];switch(n.type){case"space":case"comment":case"newline":t-=n.source.length;continue}for(n=e[++i];n?.type==="space";)t+=n.source.length,n=e[++i];break}}return t}_D.emptyScalarPosition=rw});var $D=_(ll=>{"use strict";var ow=Ui(),aw=V(),uw=ED(),kD=xD(),lw=Ys(),cw=BD(),fw={composeNode:TD,composeEmptyNode:ul};function TD(t,e,s,i){let n=t.atKey,{spaceBefore:r,comment:o,anchor:a,tag:u}=s,l,c=!0;switch(e.type){case"alias":l=hw(t,e,i),(a||u)&&i(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=kD.composeScalar(t,e,u,i),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":l=uw.composeCollection(fw,t,e,s,i),a&&(l.anchor=a.source.substring(1));break;default:{let f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;i(e,"UNEXPECTED_TOKEN",f),l=ul(t,e.offset,void 0,null,s,i),c=!1}}return a&&l.anchor===""&&i(a,"BAD_ALIAS","Anchor cannot be an empty string"),n&&t.options.stringKeys&&(!aw.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&i(u??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),r&&(l.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?l.comment=o:l.commentBefore=o),t.options.keepSourceTokens&&c&&(l.srcToken=e),l}function ul(t,e,s,i,{spaceBefore:n,comment:r,anchor:o,tag:a,end:u},l){let c={type:"scalar",offset:cw.emptyScalarPosition(e,s,i),indent:-1,source:""},f=kD.composeScalar(t,c,a,l);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(f.spaceBefore=!0),r&&(f.comment=r,f.range[2]=u),f}function hw({options:t},{offset:e,source:s,end:i},n){let r=new ow.Alias(s.substring(1));r.source===""&&n(e,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&n(e+s.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+s.length,a=lw.resolveEnd(i,o,t.strict,n);return r.range=[e,o,a.offset],a.comment&&(r.comment=a.comment),r}ll.composeEmptyNode=ul;ll.composeNode=TD});var OD=_(ND=>{"use strict";var dw=on(),ID=$D(),Dw=Ys(),pw=cn();function mw(t,e,{offset:s,start:i,value:n,end:r},o){let a=Object.assign({_directives:e},t),u=new dw.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:u.directives,options:u.options,schema:u.schema},c=pw.resolveProps(i,{indicator:"doc-start",next:n??r?.[0],offset:s,onError:o,parentIndent:0,startOnNewline:!0});c.found&&(u.directives.docStart=!0,n&&(n.type==="block-map"||n.type==="block-seq")&&!c.hasNewline&&o(c.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),u.contents=n?ID.composeNode(l,n,c,o):ID.composeEmptyNode(l,c.end,i,null,c,o);let f=u.contents.range[2],h=Dw.resolveEnd(r,f,!1,o);return h.comment&&(u.comment=h.comment),u.range=[s,f,h.offset],u}ND.composeDoc=mw});var fl=_(LD=>{"use strict";var gw=require("process"),yw=Ha(),Fw=on(),fn=ln(),RD=V(),Cw=OD(),Ew=Ys();function hn(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:s}=t;return[e,e+(typeof s=="string"?s.length:1)]}function PD(t){let e="",s=!1,i=!1;for(let n=0;n<t.length;++n){let r=t[n];switch(r[0]){case"#":e+=(e===""?"":i?`
|
|
157
|
+
|
|
158
|
+
`:`
|
|
159
|
+
`)+(r.substring(1)||" "),s=!0,i=!1;break;case"%":t[n+1]?.[0]!=="#"&&(n+=1),s=!1;break;default:s||(i=!0),s=!1}}return{comment:e,afterEmptyLine:i}}var cl=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(s,i,n,r)=>{let o=hn(s);r?this.warnings.push(new fn.YAMLWarning(o,i,n)):this.errors.push(new fn.YAMLParseError(o,i,n))},this.directives=new yw.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,s){let{comment:i,afterEmptyLine:n}=PD(this.prelude);if(i){let r=e.contents;if(s)e.comment=e.comment?`${e.comment}
|
|
160
|
+
${i}`:i;else if(n||e.directives.docStart||!r)e.commentBefore=i;else if(RD.isCollection(r)&&!r.flow&&r.items.length>0){let o=r.items[0];RD.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${i}
|
|
161
|
+
${a}`:i}else{let o=r.commentBefore;r.commentBefore=o?`${i}
|
|
162
|
+
${o}`:i}}s?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:PD(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,s=!1,i=-1){for(let n of e)yield*this.next(n);yield*this.end(s,i)}*next(e){switch(gw.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(s,i,n)=>{let r=hn(e);r[0]+=s,this.onError(r,"BAD_DIRECTIVE",i,n)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let s=Cw.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!s.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(s,!1),this.doc&&(yield this.doc),this.doc=s,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let s=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,i=new fn.YAMLParseError(hn(e),"UNEXPECTED_TOKEN",s);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){let i="Unexpected doc-end without preceding document";this.errors.push(new fn.YAMLParseError(hn(e),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let s=Ew.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),s.comment){let i=this.doc.comment;this.doc.comment=i?`${i}
|
|
163
|
+
${s.comment}`:s.comment}this.doc.range[2]=s.offset;break}default:this.errors.push(new fn.YAMLParseError(hn(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,s=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let i=Object.assign({_directives:this.directives},this.options),n=new Fw.Document(void 0,i);this.atDirectives&&this.onError(s,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,s,s],this.decorate(n,!1),yield n}}};LD.Composer=cl});var qD=_(so=>{"use strict";var bw=rl(),ww=al(),vw=ln(),MD=Gi();function Sw(t,e=!0,s){if(t){let i=(n,r,o)=>{let a=typeof n=="number"?n:Array.isArray(n)?n[0]:n.offset;if(s)s(a,r,o);else throw new vw.YAMLParseError([a,a+1],r,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return ww.resolveFlowScalar(t,e,i);case"block-scalar":return bw.resolveBlockScalar({options:{strict:e}},t,i)}}return null}function Aw(t,e){let{implicitKey:s=!1,indent:i,inFlow:n=!1,offset:r=-1,type:o="PLAIN"}=e,a=MD.stringifyString({type:o,value:t},{implicitKey:s,indent:i>0?" ".repeat(i):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),u=e.end??[{type:"newline",offset:-1,indent:i,source:`
|
|
164
|
+
`}];switch(a[0]){case"|":case">":{let l=a.indexOf(`
|
|
165
|
+
`),c=a.substring(0,l),f=a.substring(l+1)+`
|
|
166
|
+
`,h=[{type:"block-scalar-header",offset:r,indent:i,source:c}];return jD(h,u)||h.push({type:"newline",offset:-1,indent:i,source:`
|
|
167
|
+
`}),{type:"block-scalar",offset:r,indent:i,props:h,source:f}}case'"':return{type:"double-quoted-scalar",offset:r,indent:i,source:a,end:u};case"'":return{type:"single-quoted-scalar",offset:r,indent:i,source:a,end:u};default:return{type:"scalar",offset:r,indent:i,source:a,end:u}}}function xw(t,e,s={}){let{afterKey:i=!1,implicitKey:n=!1,inFlow:r=!1,type:o}=s,a="indent"in t?t.indent:null;if(i&&typeof a=="number"&&(a+=2),!o)switch(t.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let u=MD.stringifyString({type:o,value:e},{implicitKey:n||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}});switch(u[0]){case"|":case">":_w(t,u);break;case'"':hl(t,u,"double-quoted-scalar");break;case"'":hl(t,u,"single-quoted-scalar");break;default:hl(t,u,"scalar")}}function _w(t,e){let s=e.indexOf(`
|
|
168
|
+
`),i=e.substring(0,s),n=e.substring(s+1)+`
|
|
169
|
+
`;if(t.type==="block-scalar"){let r=t.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=i,t.source=n}else{let{offset:r}=t,o="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:r,indent:o,source:i}];jD(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
|
|
170
|
+
`});for(let u of Object.keys(t))u!=="type"&&u!=="offset"&&delete t[u];Object.assign(t,{type:"block-scalar",indent:o,props:a,source:n})}}function jD(t,e){if(e)for(let s of e)switch(s.type){case"space":case"comment":t.push(s);break;case"newline":return t.push(s),!0}return!1}function hl(t,e,s){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=s,t.source=e;break;case"block-scalar":{let i=t.props.slice(1),n=e.length;t.props[0].type==="block-scalar-header"&&(n-=t.props[0].source.length);for(let r of i)r.offset+=n;delete t.props,Object.assign(t,{type:s,source:e,end:i});break}case"block-map":case"block-seq":{let n={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
|
|
171
|
+
`};delete t.items,Object.assign(t,{type:s,source:e,end:[n]});break}default:{let i="indent"in t?t.indent:-1,n="end"in t&&Array.isArray(t.end)?t.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(let r of Object.keys(t))r!=="type"&&r!=="offset"&&delete t[r];Object.assign(t,{type:s,indent:i,source:e,end:n})}}}so.createScalarToken=Aw;so.resolveAsScalar=Sw;so.setScalarValue=xw});var WD=_(UD=>{"use strict";var Bw=t=>"type"in t?no(t):io(t);function no(t){switch(t.type){case"block-scalar":{let e="";for(let s of t.props)e+=no(s);return e+t.source}case"block-map":case"block-seq":{let e="";for(let s of t.items)e+=io(s);return e}case"flow-collection":{let e=t.start.source;for(let s of t.items)e+=io(s);for(let s of t.end)e+=s.source;return e}case"document":{let e=io(t);if(t.end)for(let s of t.end)e+=s.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let s of t.end)e+=s.source;return e}}}function io({start:t,key:e,sep:s,value:i}){let n="";for(let r of t)n+=r.source;if(e&&(n+=no(e)),s)for(let r of s)n+=r.source;return i&&(n+=no(i)),n}UD.stringify=Bw});var GD=_(KD=>{"use strict";var dl=Symbol("break visit"),kw=Symbol("skip children"),VD=Symbol("remove item");function ps(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),zD(Object.freeze([]),t,e)}ps.BREAK=dl;ps.SKIP=kw;ps.REMOVE=VD;ps.itemAtPath=(t,e)=>{let s=t;for(let[i,n]of e){let r=s?.[i];if(r&&"items"in r)s=r.items[n];else return}return s};ps.parentCollection=(t,e)=>{let s=ps.itemAtPath(t,e.slice(0,-1)),i=e[e.length-1][0],n=s?.[i];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function zD(t,e,s){let i=s(e,t);if(typeof i=="symbol")return i;for(let n of["key","value"]){let r=e[n];if(r&&"items"in r){for(let o=0;o<r.items.length;++o){let a=zD(Object.freeze(t.concat([[n,o]])),r.items[o],s);if(typeof a=="number")o=a-1;else{if(a===dl)return dl;a===VD&&(r.items.splice(o,1),o-=1)}}typeof i=="function"&&n==="key"&&(i=i(e,t))}}return typeof i=="function"?i(e,t):i}KD.visit=ps});var ro=_(Ce=>{"use strict";var Dl=qD(),Tw=WD(),$w=GD(),pl="\uFEFF",ml="",gl="",yl="",Iw=t=>!!t&&"items"in t,Nw=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Ow(t){switch(t){case pl:return"<BOM>";case ml:return"<DOC>";case gl:return"<FLOW_END>";case yl:return"<SCALAR>";default:return JSON.stringify(t)}}function Rw(t){switch(t){case pl:return"byte-order-mark";case ml:return"doc-mode";case gl:return"flow-error-end";case yl:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
172
|
+
`:case`\r
|
|
173
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Ce.createScalarToken=Dl.createScalarToken;Ce.resolveAsScalar=Dl.resolveAsScalar;Ce.setScalarValue=Dl.setScalarValue;Ce.stringify=Tw.stringify;Ce.visit=$w.visit;Ce.BOM=pl;Ce.DOCUMENT=ml;Ce.FLOW_END=gl;Ce.SCALAR=yl;Ce.isCollection=Iw;Ce.isScalar=Nw;Ce.prettyToken=Ow;Ce.tokenType=Rw});var El=_(JD=>{"use strict";var dn=ro();function Ve(t){switch(t){case void 0:case" ":case`
|
|
174
|
+
`:case"\r":case" ":return!0;default:return!1}}var YD=new Set("0123456789ABCDEFabcdef"),Pw=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),oo=new Set(",[]{}"),Lw=new Set(` ,[]{}
|
|
175
|
+
\r `),Fl=t=>!t||Lw.has(t),Cl=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,s=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!s;let i=this.next??"stream";for(;i&&(s||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let e=this.pos,s=this.buffer[e];for(;s===" "||s===" ";)s=this.buffer[++e];return!s||s==="#"||s===`
|
|
176
|
+
`?!0:s==="\r"?this.buffer[e+1]===`
|
|
177
|
+
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let s=this.buffer[e];if(this.indentNext>0){let i=0;for(;s===" ";)s=this.buffer[++i+e];if(s==="\r"){let n=this.buffer[i+e+1];if(n===`
|
|
178
|
+
`||!n&&!this.atEnd)return e+i+1}return s===`
|
|
179
|
+
`||i>=this.indentNext||!s&&!this.atEnd?e+i:-1}if(s==="-"||s==="."){let i=this.buffer.substr(e,3);if((i==="---"||i==="...")&&Ve(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
180
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===dn.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let s=e.length,i=e.indexOf("#");for(;i!==-1;){let r=e[i-1];if(r===" "||r===" "){s=i-1;break}else i=e.indexOf("#",i+1)}for(;;){let r=e[s-1];if(r===" "||r===" ")s-=1;else break}let n=(yield*this.pushCount(s))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-n),this.pushNewline(),"stream"}if(this.atLineEnd()){let s=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-s),yield*this.pushNewline(),"stream"}return yield dn.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let s=this.peek(3);if((s==="---"||s==="...")&&Ve(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,s==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Ve(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,s]=this.peek(2);if(!s&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Ve(s)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let s=yield*this.pushIndicators();switch(e[s]){case"#":yield*this.pushCount(e.length-s);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Fl),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return s+=yield*this.parseBlockScalarHeader(),s+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-s),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,s,i=-1;do e=yield*this.pushNewline(),e>0?(s=yield*this.pushSpaces(!1),this.indentValue=i=s):s=0,s+=yield*this.pushSpaces(!0);while(e+s>0);let n=this.getLine();if(n===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&n[0]!=="#"||i===0&&(n.startsWith("---")||n.startsWith("..."))&&Ve(n[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield dn.FLOW_END,yield*this.parseLineStart();let r=0;for(;n[r]===",";)r+=yield*this.pushCount(1),r+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(r+=yield*this.pushIndicators(),n[r]){case void 0:return"flow";case"#":return yield*this.pushCount(n.length-r),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Fl),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||Ve(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),s=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;s!==-1&&this.buffer[s+1]==="'";)s=this.buffer.indexOf("'",s+2);else for(;s!==-1;){let r=0;for(;this.buffer[s-1-r]==="\\";)r+=1;if(r%2===0)break;s=this.buffer.indexOf('"',s+1)}let i=this.buffer.substring(0,s),n=i.indexOf(`
|
|
181
|
+
`,this.pos);if(n!==-1){for(;n!==-1;){let r=this.continueScalar(n+1);if(r===-1)break;n=i.indexOf(`
|
|
182
|
+
`,r)}n!==-1&&(s=n-(i[n-1]==="\r"?2:1))}if(s===-1){if(!this.atEnd)return this.setNext("quoted-scalar");s=this.buffer.length}return yield*this.pushToIndex(s+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let s=this.buffer[++e];if(s==="+")this.blockScalarKeep=!0;else if(s>"0"&&s<="9")this.blockScalarIndent=Number(s)-1;else if(s!=="-")break}return yield*this.pushUntil(s=>Ve(s)||s==="#")}*parseBlockScalar(){let e=this.pos-1,s=0,i;e:for(let r=this.pos;i=this.buffer[r];++r)switch(i){case" ":s+=1;break;case`
|
|
183
|
+
`:e=r,s=0;break;case"\r":{let o=this.buffer[r+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
|
|
184
|
+
`)break}default:break e}if(!i&&!this.atEnd)return this.setNext("block-scalar");if(s>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=s:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let r=this.continueScalar(e+1);if(r===-1)break;e=this.buffer.indexOf(`
|
|
185
|
+
`,r)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let n=e+1;for(i=this.buffer[n];i===" ";)i=this.buffer[++n];if(i===" "){for(;i===" "||i===" "||i==="\r"||i===`
|
|
186
|
+
`;)i=this.buffer[++n];e=n-1}else if(!this.blockScalarKeep)do{let r=e-1,o=this.buffer[r];o==="\r"&&(o=this.buffer[--r]);let a=r;for(;o===" ";)o=this.buffer[--r];if(o===`
|
|
187
|
+
`&&r>=this.pos&&r+1+s>a)e=r;else break}while(!0);return yield dn.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,s=this.pos-1,i=this.pos-1,n;for(;n=this.buffer[++i];)if(n===":"){let r=this.buffer[i+1];if(Ve(r)||e&&oo.has(r))break;s=i}else if(Ve(n)){let r=this.buffer[i+1];if(n==="\r"&&(r===`
|
|
188
|
+
`?(i+=1,n=`
|
|
189
|
+
`,r=this.buffer[i+1]):s=i),r==="#"||e&&oo.has(r))break;if(n===`
|
|
190
|
+
`){let o=this.continueScalar(i+1);if(o===-1)break;i=Math.max(i,o-2)}}else{if(e&&oo.has(n))break;s=i}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield dn.SCALAR,yield*this.pushToIndex(s+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,s){let i=this.buffer.slice(this.pos,e);return i?(yield i,this.pos+=i.length,i.length):(s&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Fl))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,s=this.charAt(1);if(Ve(s)||e&&oo.has(s))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,s=this.buffer[e];for(;!Ve(s)&&s!==">";)s=this.buffer[++e];return yield*this.pushToIndex(s===">"?e+1:e,!1)}else{let e=this.pos+1,s=this.buffer[e];for(;s;)if(Pw.has(s))s=this.buffer[++e];else if(s==="%"&&YD.has(this.buffer[e+1])&&YD.has(this.buffer[e+2]))s=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
191
|
+
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
192
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let s=this.pos-1,i;do i=this.buffer[++s];while(i===" "||e&&i===" ");let n=s-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=s),n}*pushUntil(e){let s=this.pos,i=this.buffer[s];for(;!e(i);)i=this.buffer[++s];return yield*this.pushToIndex(s,!1)}};JD.Lexer=Cl});var wl=_(HD=>{"use strict";var bl=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let s=0,i=this.lineStarts.length;for(;s<i;){let r=s+i>>1;this.lineStarts[r]<e?s=r+1:i=r}if(this.lineStarts[s]===e)return{line:s+1,col:1};if(s===0)return{line:0,col:e};let n=this.lineStarts[s-1];return{line:s,col:e-n+1}}}};HD.LineCounter=bl});var Sl=_(tp=>{"use strict";var Mw=require("process"),ZD=ro(),jw=El();function Lt(t,e){for(let s=0;s<t.length;++s)if(t[s].type===e)return!0;return!1}function QD(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function ep(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function ao(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function Js(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function XD(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!Lt(e.start,"explicit-key-ind")&&!Lt(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,ep(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var vl=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new jw.Lexer,this.onNewLine=e}*parse(e,s=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let i of this.lexer.lex(e,s))yield*this.next(i);s||(yield*this.end())}*next(e){if(this.source=e,Mw.env.LOG_TOKENS&&console.log("|",ZD.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let s=ZD.tokenType(e);if(s)if(s==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=s,yield*this.step(),s){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let i=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:i,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let s=e??this.stack.pop();if(!s)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield s;else{let i=this.peek(1);switch(s.type==="block-scalar"?s.indent="indent"in i?i.indent:0:s.type==="flow-collection"&&i.type==="document"&&(s.indent=0),s.type==="flow-collection"&&XD(s),i.type){case"document":i.value=s;break;case"block-scalar":i.props.push(s);break;case"block-map":{let n=i.items[i.items.length-1];if(n.value){i.items.push({start:[],key:s,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=s;else{Object.assign(n,{key:s,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=i.items[i.items.length-1];n.value?i.items.push({start:[],value:s}):n.value=s;break}case"flow-collection":{let n=i.items[i.items.length-1];!n||n.value?i.items.push({start:[],key:s,sep:[]}):n.sep?n.value=s:Object.assign(n,{key:s,sep:[]});return}default:yield*this.pop(),yield*this.pop(s)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(s.type==="block-map"||s.type==="block-seq")){let n=s.items[s.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&QD(n.start)===-1&&(s.indent===0||n.start.every(r=>r.type!=="comment"||r.indent<s.indent))&&(i.type==="document"?i.end=n.start:i.items.push({start:n.start}),s.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{QD(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let s=this.startBlockValue(e);s?this.stack.push(s):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let s=ao(this.peek(2)),i=Js(s),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let r={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let s=this.source.indexOf(`
|
|
193
|
+
`)+1;for(;s!==0;)this.onNewLine(this.offset+s),s=this.source.indexOf(`
|
|
194
|
+
`,s)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let s=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,s.value){let i="end"in s.value?s.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else s.sep?s.sep.push(this.sourceToken):s.start.push(this.sourceToken);return;case"space":case"comment":if(s.value)e.items.push({start:[this.sourceToken]});else if(s.sep)s.sep.push(this.sourceToken);else{if(this.atIndentedComment(s.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,s.start),n.push(this.sourceToken),e.items.pop();return}}s.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let i=!this.onKeyLine&&this.indent===e.indent,n=i&&(s.sep||s.explicitKey)&&this.type!=="seq-item-ind",r=[];if(n&&s.sep&&!s.value){let o=[];for(let a=0;a<s.sep.length;++a){let u=s.sep[a];switch(u.type){case"newline":o.push(a);break;case"space":break;case"comment":u.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(r=s.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":n||s.value?(r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0):s.sep?s.sep.push(this.sourceToken):s.start.push(this.sourceToken);return;case"explicit-key-ind":!s.sep&&!s.explicitKey?(s.start.push(this.sourceToken),s.explicitKey=!0):n||s.value?(r.push(this.sourceToken),e.items.push({start:r,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(s.explicitKey)if(s.sep)if(s.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Lt(s.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(ep(s.key)&&!Lt(s.sep,"newline")){let o=Js(s.start),a=s.key,u=s.sep;u.push(this.sourceToken),delete s.key,delete s.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:u}]})}else r.length>0?s.sep=s.sep.concat(r,this.sourceToken):s.sep.push(this.sourceToken);else if(Lt(s.start,"newline"))Object.assign(s,{key:null,sep:[this.sourceToken]});else{let o=Js(s.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else s.sep?s.value||n?e.items.push({start:r,key:null,sep:[this.sourceToken]}):Lt(s.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):s.sep.push(this.sourceToken):Object.assign(s,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);n||s.value?(e.items.push({start:r,key:o,sep:[]}),this.onKeyLine=!0):s.sep?this.stack.push(o):(Object.assign(s,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!s.explicitKey&&s.sep&&!Lt(s.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else i&&e.items.push({start:r});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let s=e.items[e.items.length-1];switch(this.type){case"newline":if(s.value){let i="end"in s.value?s.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else s.start.push(this.sourceToken);return;case"space":case"comment":if(s.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(s.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,s.start),n.push(this.sourceToken),e.items.pop();return}}s.start.push(this.sourceToken)}return;case"anchor":case"tag":if(s.value||this.indent<=e.indent)break;s.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;s.value||Lt(s.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):s.start.push(this.sourceToken);return}if(this.indent>e.indent){let i=this.startBlockValue(e);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let s=e.items[e.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!s||s.sep?e.items.push({start:[this.sourceToken]}):s.start.push(this.sourceToken);return;case"map-value-ind":!s||s.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):s.sep?s.sep.push(this.sourceToken):Object.assign(s,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!s||s.value?e.items.push({start:[this.sourceToken]}):s.sep?s.sep.push(this.sourceToken):s.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);!s||s.value?e.items.push({start:[],key:n,sep:[]}):s.sep?this.stack.push(n):Object.assign(s,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let i=this.startBlockValue(e);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===e.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let n=ao(i),r=Js(n);XD(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let s=this.source.indexOf(`
|
|
195
|
+
`)+1;for(;s!==0;)this.onNewLine(this.offset+s),s=this.source.indexOf(`
|
|
196
|
+
`,s)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let s=ao(e),i=Js(s);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let s=ao(e),i=Js(s);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,s){return this.type!=="comment"||this.indent<=s?!1:e.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};tp.Parser=vl});var op=_(pn=>{"use strict";var sp=fl(),qw=on(),Dn=ln(),Uw=lu(),Ww=V(),Vw=wl(),ip=Sl();function np(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Vw.LineCounter||null,prettyErrors:e}}function zw(t,e={}){let{lineCounter:s,prettyErrors:i}=np(e),n=new ip.Parser(s?.addNewLine),r=new sp.Composer(e),o=Array.from(r.compose(n.parse(t)));if(i&&s)for(let a of o)a.errors.forEach(Dn.prettifyError(t,s)),a.warnings.forEach(Dn.prettifyError(t,s));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function rp(t,e={}){let{lineCounter:s,prettyErrors:i}=np(e),n=new ip.Parser(s?.addNewLine),r=new sp.Composer(e),o=null;for(let a of r.compose(n.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new Dn.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&s&&(o.errors.forEach(Dn.prettifyError(t,s)),o.warnings.forEach(Dn.prettifyError(t,s))),o}function Kw(t,e,s){let i;typeof e=="function"?i=e:s===void 0&&e&&typeof e=="object"&&(s=e);let n=rp(t,s);if(!n)return null;if(n.warnings.forEach(r=>Uw.warn(n.options.logLevel,r)),n.errors.length>0){if(n.options.logLevel!=="silent")throw n.errors[0];n.errors=[]}return n.toJS(Object.assign({reviver:i},s))}function Gw(t,e,s){let i=null;if(typeof e=="function"||Array.isArray(e)?i=e:s===void 0&&e&&(s=e),typeof s=="string"&&(s=s.length),typeof s=="number"){let n=Math.round(s);s=n<1?void 0:n>8?{indent:8}:{indent:n}}if(t===void 0){let{keepUndefined:n}=s??e??{};if(!n)return}return Ww.isDocument(t)&&!i?t.toString(s):new qw.Document(t,i,s).toString(s)}pn.parse=Kw;pn.parseAllDocuments=zw;pn.parseDocument=rp;pn.stringify=Gw});var up=_(K=>{"use strict";var Yw=fl(),Jw=on(),Hw=zu(),Al=ln(),Zw=Ui(),Mt=V(),Qw=Nt(),Xw=ee(),e1=Rt(),t1=Pt(),s1=ro(),i1=El(),n1=wl(),r1=Sl(),uo=op(),ap=Li();K.Composer=Yw.Composer;K.Document=Jw.Document;K.Schema=Hw.Schema;K.YAMLError=Al.YAMLError;K.YAMLParseError=Al.YAMLParseError;K.YAMLWarning=Al.YAMLWarning;K.Alias=Zw.Alias;K.isAlias=Mt.isAlias;K.isCollection=Mt.isCollection;K.isDocument=Mt.isDocument;K.isMap=Mt.isMap;K.isNode=Mt.isNode;K.isPair=Mt.isPair;K.isScalar=Mt.isScalar;K.isSeq=Mt.isSeq;K.Pair=Qw.Pair;K.Scalar=Xw.Scalar;K.YAMLMap=e1.YAMLMap;K.YAMLSeq=t1.YAMLSeq;K.CST=s1;K.Lexer=i1.Lexer;K.LineCounter=n1.LineCounter;K.Parser=r1.Parser;K.parse=uo.parse;K.parseAllDocuments=uo.parseAllDocuments;K.parseDocument=uo.parseDocument;K.stringify=uo.stringify;K.visit=ap.visit;K.visitAsync=ap.visitAsync});function _l(){return(0,xl.join)(o1,"defaults")}function lp(...t){return(0,xl.join)(_l(),...t)}var xl,o1,Bl=W(()=>{"use strict";xl=require("node:path"),o1=__dirname});function mn(t){if(!t||t.trim()==="")return{frontmatter:{},body:""};if(!t.startsWith("---"))return{frontmatter:{},body:t};let e=t.indexOf("---",3);if(e===-1)throw new Error("Invalid frontmatter: missing closing delimiter ---");let s=t.slice(3,e).trim(),i=t.slice(e+3).trim();if(!s)return{frontmatter:{},body:i};let n;try{n=fp.default.parse(s)}catch(r){throw new Error(`Invalid YAML in frontmatter: ${r instanceof Error?r.message:String(r)}`)}return{frontmatter:n,body:i}}function lo(t,e){try{let{frontmatter:s,body:i}=mn(t),n=e(s,i);return n?[n]:[]}catch(s){return p.error("Failed to parse markdown:",s),[]}}async function gn(t,e){try{let s=await(0,Tl.readFile)(t,"utf-8");return e?lo(s,e):mn(s)}catch(s){throw s instanceof Error?new Error(`Failed to load markdown file "${t}": ${s.message}`):new Error(`Failed to load markdown file "${t}": Unknown error`)}}async function hp(t,e,s){try{let i=await Ls("**/*.md",{cwd:t});if(i.length===0)return[];let n=[];for(let o of i){let a=(0,ms.join)(t,o);try{let u=await gn(a,e);n.push(...u)}catch(u){p.error(`Error processing file ${o}:`,u)}}let r=s?s(n):n;return p.info(`Loaded ${r.length} items from ${i.length} files in ${t} (recursive)`),r}catch{return[]}}function a1(...t){let e=new Map;for(let s of t)for(let i of s)e.set(i.name,i);return Array.from(e.values())}function dp(t,e){return{defaults:(0,ms.join)(_l(),t),user:(0,ms.join)((0,cp.homedir)(),".diffray",t),project:(0,ms.join)(e,".diffray",t)}}async function Dp(t,e,s){let i=dp(t,s),[n,r,o]=await Promise.all([e(i.defaults),e(i.user),e(i.project)]);return a1(n,r,o)}async function kl(t,e){try{let s=await Ls("**/*.md",{cwd:t}),i=await Promise.all(s.map(async r=>{let o=(0,ms.join)(t,r);try{let a=await(0,Tl.readFile)(o,"utf-8");return{filePath:o,content:a}}catch{return null}})),n=[];for(let r of i)if(r)try{let{frontmatter:o}=mn(r.content),a=o.name,u=o.description,l=o.agent,c=o.patterns;typeof a=="string"&&typeof l=="string"&&Array.isArray(c)&&c.length>0&&n.push({name:a,description:typeof u=="string"?u:"",path:r.filePath,patterns:c.filter(f=>typeof f=="string"),agent:l,source:e})}catch{}return n}catch{return[]}}async function pp(t){let e=dp("rules",t),[s,i,n]=await Promise.all([kl(e.defaults,"defaults"),kl(e.user,"user"),kl(e.project,"project")]),r=new Map;for(let o of[...s,...i,...n])r.set(o.name,o);return Array.from(r.values())}var Tl,ms,cp,fp,co=W(()=>{"use strict";Q();Ka();Tl=require("node:fs/promises"),ms=require("node:path"),cp=require("node:os"),fp=gt(up(),1);Bl()});var bp={};Sn(bp,{expandBraces:()=>Ol,loadRuleFromRef:()=>Il,loadRuleMarkdown:()=>u1,loadRuleRefs:()=>jt,loadRules:()=>f1,loadRulesFromDirectoryRecursive:()=>l1,loadRulesFromRefs:()=>Fp,matchAndLoadRules:()=>Nl,matchPattern:()=>Hs,matchRuleRefs:()=>Ep,matchRules:()=>h1,parseRuleMarkdown:()=>yp,parseSingleRule:()=>c1});function $l(t,e){let s=t.name,i=t.agent,n=t.patterns,r=e.trim();return typeof s!="string"||typeof i!="string"||!Array.isArray(n)||n.length===0||!r?null:{name:s,description:typeof t.description=="string"?t.description:"",patterns:n.filter(a=>typeof a=="string"),agent:i,prompt:r}}function yp(t){return lo(t,$l)}async function u1(t){try{return await gn(t,$l)}catch(e){return p.error(`Error loading rule markdown from ${t}:`,e),[]}}async function l1(t){return hp(t,$l)}function c1(t){let e=yp(t);return e.length>0?e[0]??null:null}async function jt(t){let e=t||process.cwd(),s=await pp(e),i=await ve(e);return s.map(n=>{let r=i.rules[n.name]||{};return{...n,agent:r.agent??n.agent,_enabled:r.enabled??!0}}).filter(n=>n._enabled!==!1).map(({_enabled:n,...r})=>r)}async function Il(t){try{let e=await(0,gp.readFile)(t.path,"utf-8"),{body:s}=mn(e);return{name:t.name,description:t.description,patterns:t.patterns,agent:t.agent,prompt:s.trim(),source:t.source,path:t.path}}catch(e){return p.error(`Failed to load rule from ${t.path}:`,e),null}}async function Fp(t){return(await Promise.all(t.map(Il))).filter(s=>s!==null)}async function f1(t){let e=await jt(t);return Fp(e)}function Cp(t,e,s){let i=new Map(s.map(r=>[r.name,r])),n=[];for(let r of t){let o=i.get(r.agent);if(!o){p.warn(`Rule references unknown agent "${r.agent}"`);continue}let a=e.filter(u=>r.patterns.some(l=>Hs(u.file,l))).map(u=>u.file);a.length!==0&&n.push({item:r,files:a,agent:o})}return n}function Ep(t,e,s){return Cp(t,e,s).map(({item:i,...n})=>({ref:i,...n}))}async function Nl(t,e,s){let i=Ep(t,e,s);return(await Promise.all(i.map(async({ref:r,files:o,agent:a})=>{let u=await Il(r);return u?{rule:u,files:o,agent:a}:null}))).filter(r=>r!==null)}function h1(t,e,s){return Cp(t,e,s).map(({item:i,...n})=>({rule:i,...n}))}function Ol(t){let e=t.match(d1);if(!e||e.index===void 0||!e[1])return[t];let s=e[1].split(",").map(o=>o.trim()),i=t.substring(0,e.index),n=t.substring(e.index+e[0].length),r=[];for(let o of s){let a=i+o+n;r.push(...Ol(a))}return r}function Hs(t,e){return Ol(e).some(i=>D1(t,i))}function D1(t,e){let s=e.replace(/\*\*/g,"\0DOUBLESTAR\0").replace(/\*/g,"\0STAR\0").replace(/\?/g,"\0QUESTION\0");s=s.replace(/[.+^${}()|[\]\\]/g,"\\$&"),s=s.replace(/\x00DOUBLESTAR\x00\//g,"(?:.*\\/)?").replace(/\x00DOUBLESTAR\x00/g,".*").replace(/\x00STAR\x00/g,"[^/]*").replace(/\x00QUESTION\x00/g,".");let i=mp.get(s);return i||(i=new RegExp(`^${s}$`),mp.set(s,i)),i.test(t)}var gp,d1,mp,Zs=W(()=>{"use strict";co();gp=require("node:fs/promises");Q();ct();d1=/\{([^}]+)\}/;mp=new Map});var oe={silent:Number.NEGATIVE_INFINITY,fatal:0,error:0,warn:1,log:2,info:3,success:3,fail:3,ready:3,start:3,box:3,debug:4,trace:5,verbose:Number.POSITIVE_INFINITY},Bo={silent:{level:-1},fatal:{level:oe.fatal},error:{level:oe.error},warn:{level:oe.warn},log:{level:oe.log},info:{level:oe.info},success:{level:oe.success},fail:{level:oe.fail},ready:{level:oe.info},start:{level:oe.info},box:{level:oe.info},debug:{level:oe.debug},trace:{level:oe.trace},verbose:{level:oe.verbose}};function Ao(t){if(t===null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null||Symbol.iterator in t?!1:Symbol.toStringTag in t?Object.prototype.toString.call(t)==="[object Module]":!0}function ko(t,e,s=".",i){if(!Ao(e))return ko(t,{},s,i);let n=Object.assign({},e);for(let r in t){if(r==="__proto__"||r==="constructor")continue;let o=t[r];o!=null&&(i&&i(n,r,o,s)||(Array.isArray(o)&&Array.isArray(n[r])?n[r]=[...o,...n[r]]:Ao(o)&&Ao(n[r])?n[r]=ko(o,n[r],(s?`${s}.`:"")+r.toString(),i):n[r]=o))}return n}function Lm(t){return(...e)=>e.reduce((s,i)=>ko(s,i,"",t),{})}var Mm=Lm();function jm(t){return Object.prototype.toString.call(t)==="[object Object]"}function qm(t){return!(!jm(t)||!t.message&&!t.args||t.stack)}var xo=!1,zl=[],se=class t{options;_lastLog;_mockFn;constructor(e={}){let s=e.types||Bo;this.options=Mm({...e,defaults:{...e.defaults},level:_o(e.level,s),reporters:[...e.reporters||[]]},{types:Bo,throttle:1e3,throttleMin:5,formatOptions:{date:!0,colors:!1,compact:!0}});for(let i in s){let n={type:i,...this.options.defaults,...s[i]};this[i]=this._wrapLogFn(n),this[i].raw=this._wrapLogFn(n,!0)}this.options.mockFn&&this.mockTypes(),this._lastLog={}}get level(){return this.options.level}set level(e){this.options.level=_o(e,this.options.types,this.options.level)}prompt(e,s){if(!this.options.prompt)throw new Error("prompt is not supported!");return this.options.prompt(e,s)}create(e){let s=new t({...this.options,...e});return this._mockFn&&s.mockTypes(this._mockFn),s}withDefaults(e){return this.create({...this.options,defaults:{...this.options.defaults,...e}})}withTag(e){return this.withDefaults({tag:this.options.defaults.tag?this.options.defaults.tag+":"+e:e})}addReporter(e){return this.options.reporters.push(e),this}removeReporter(e){if(e){let s=this.options.reporters.indexOf(e);if(s!==-1)return this.options.reporters.splice(s,1)}else this.options.reporters.splice(0);return this}setReporters(e){return this.options.reporters=Array.isArray(e)?e:[e],this}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}wrapConsole(){for(let e in this.options.types)console["__"+e]||(console["__"+e]=console[e]),console[e]=this[e].raw}restoreConsole(){for(let e in this.options.types)console["__"+e]&&(console[e]=console["__"+e],delete console["__"+e])}wrapStd(){this._wrapStream(this.options.stdout,"log"),this._wrapStream(this.options.stderr,"log")}_wrapStream(e,s){e&&(e.__write||(e.__write=e.write),e.write=i=>{this[s].raw(String(i).trim())})}restoreStd(){this._restoreStream(this.options.stdout),this._restoreStream(this.options.stderr)}_restoreStream(e){e&&e.__write&&(e.write=e.__write,delete e.__write)}pauseLogs(){xo=!0}resumeLogs(){xo=!1;let e=zl.splice(0);for(let s of e)s[0]._logFn(s[1],s[2])}mockTypes(e){let s=e||this.options.mockFn;if(this._mockFn=s,typeof s=="function")for(let i in this.options.types)this[i]=s(i,this.options.types[i])||this[i],this[i].raw=this[i]}_wrapLogFn(e,s){return(...i)=>{if(xo){zl.push([this,e,i,s]);return}return this._logFn(e,i,s)}}_logFn(e,s,i){if((e.level||0)>this.level)return!1;let n={date:new Date,args:[],...e,level:_o(e.level,this.options.types)};!i&&s.length===1&&qm(s[0])?Object.assign(n,s[0]):n.args=[...s],n.message&&(n.args.unshift(n.message),delete n.message),n.additional&&(Array.isArray(n.additional)||(n.additional=n.additional.split(`
|
|
197
|
+
`)),n.args.push(`
|
|
198
|
+
`+n.additional.join(`
|
|
199
|
+
`)),delete n.additional),n.type=typeof n.type=="string"?n.type.toLowerCase():"log",n.tag=typeof n.tag=="string"?n.tag:"";let r=(a=!1)=>{let u=(this._lastLog.count||0)-this.options.throttleMin;if(this._lastLog.object&&u>0){let l=[...this._lastLog.object.args];u>1&&l.push(`(repeated ${u} times)`),this._log({...this._lastLog.object,args:l}),this._lastLog.count=1}a&&(this._lastLog.object=n,this._log(n))};clearTimeout(this._lastLog.timeout);let o=this._lastLog.time&&n.date?n.date.getTime()-this._lastLog.time.getTime():0;if(this._lastLog.time=n.date,o<this.options.throttle)try{let a=JSON.stringify([n.type,n.tag,n.args]),u=this._lastLog.serialized===a;if(this._lastLog.serialized=a,u&&(this._lastLog.count=(this._lastLog.count||0)+1,this._lastLog.count>this.options.throttleMin)){this._lastLog.timeout=setTimeout(r,this.options.throttle);return}}catch{}r(!0)}_log(e){for(let s of this.options.reporters)s.log(e,{options:this.options})}};function _o(t,e={},s=3){return t===void 0?s:typeof t=="number"?t:e[t]&&e[t].level!==void 0?e[t].level:s}se.prototype.add=se.prototype.addReporter;se.prototype.remove=se.prototype.removeReporter;se.prototype.clear=se.prototype.removeReporter;se.prototype.withScope=se.prototype.withTag;se.prototype.mock=se.prototype.mockTypes;se.prototype.pause=se.prototype.pauseLogs;se.prototype.resume=se.prototype.resumeLogs;function Kl(t={}){return new se(t)}var $o=require("node:util"),Gl=require("node:path");function Io(t,e){let s=process.cwd()+Gl.sep;return t.split(`
|
|
200
|
+
`).splice(e.split(`
|
|
201
|
+
`).length).map(n=>n.trim().replace("file://","").replace(s,""))}function Um(t,e){return(e.__write||e.write).call(e,t)}var To=t=>t?`[${t}]`:"",oi=class{formatStack(e,s,i){let n=" ".repeat((i?.errorLevel||0)+1);return n+Io(e,s).join(`
|
|
202
|
+
${n}`)}formatError(e,s){let i=e.message??(0,$o.formatWithOptions)(s,e),n=e.stack?this.formatStack(e.stack,i,s):"",r=s?.errorLevel||0,o=r>0?`${" ".repeat(r)}[cause]: `:"",a=e.cause?`
|
|
203
|
+
|
|
204
|
+
`+this.formatError(e.cause,{...s,errorLevel:r+1}):"";return o+i+`
|
|
205
|
+
`+n+a}formatArgs(e,s){let i=e.map(n=>n&&typeof n.stack=="string"?this.formatError(n,s):n);return(0,$o.formatWithOptions)(s,...i)}formatDate(e,s){return s.date?e.toLocaleTimeString():""}filterAndJoin(e){return e.filter(Boolean).join(" ")}formatLogObj(e,s){let i=this.formatArgs(e.args,s);return e.type==="box"?`
|
|
206
|
+
`+[To(e.tag),e.title&&e.title,...i.split(`
|
|
207
|
+
`)].filter(Boolean).map(n=>" > "+n).join(`
|
|
208
|
+
`)+`
|
|
209
|
+
`:this.filterAndJoin([To(e.type),To(e.tag),i])}log(e,s){let i=this.formatLogObj(e,{columns:s.options.stdout.columns||0,...s.options.formatOptions});return Um(i+`
|
|
210
|
+
`,e.level<2?s.options.stderr||process.stderr:s.options.stdout||process.stdout)}};var Go=gt(require("node:process"),1);var An=gt(require("node:tty"),1),{env:yt={},argv:Hl=[],platform:Wm=""}=typeof process>"u"?{}:process,Vm="NO_COLOR"in yt||Hl.includes("--no-color"),zm="FORCE_COLOR"in yt||Hl.includes("--color"),Km=Wm==="win32",Zl=yt.TERM==="dumb",Gm=An&&An.isatty&&An.isatty(1)&&yt.TERM&&!Zl,Ym="CI"in yt&&("GITHUB_ACTIONS"in yt||"GITLAB_CI"in yt||"CIRCLECI"in yt),Jm=!Vm&&(zm||Km&&!Zl||Gm||Ym);function Ql(t,e,s,i,n=e.slice(0,Math.max(0,t))+i,r=e.slice(Math.max(0,t+s.length)),o=r.indexOf(s)){return n+(o<0?r:Ql(o,r,s,i))}function Hm(t,e,s,i,n){return t<0?s+e+i:s+Ql(t,e,i,n)+i}function Zm(t,e,s=t,i=t.length+1){return n=>n||!(n===""||n===void 0)?Hm((""+n).indexOf(e,i),n,t,e,s):""}function L(t,e,s){return Zm(`\x1B[${t}m`,`\x1B[${e}m`,s)}var Yl={reset:L(0,0),bold:L(1,22,"\x1B[22m\x1B[1m"),dim:L(2,22,"\x1B[22m\x1B[2m"),italic:L(3,23),underline:L(4,24),inverse:L(7,27),hidden:L(8,28),strikethrough:L(9,29),black:L(30,39),red:L(31,39),green:L(32,39),yellow:L(33,39),blue:L(34,39),magenta:L(35,39),cyan:L(36,39),white:L(37,39),gray:L(90,39),bgBlack:L(40,49),bgRed:L(41,49),bgGreen:L(42,49),bgYellow:L(43,49),bgBlue:L(44,49),bgMagenta:L(45,49),bgCyan:L(46,49),bgWhite:L(47,49),blackBright:L(90,39),redBright:L(91,39),greenBright:L(92,39),yellowBright:L(93,39),blueBright:L(94,39),magentaBright:L(95,39),cyanBright:L(96,39),whiteBright:L(97,39),bgBlackBright:L(100,49),bgRedBright:L(101,49),bgGreenBright:L(102,49),bgYellowBright:L(103,49),bgBlueBright:L(104,49),bgMagentaBright:L(105,49),bgCyanBright:L(106,49),bgWhiteBright:L(107,49)};function Qm(t=Jm){return t?Yl:Object.fromEntries(Object.keys(Yl).map(e=>[e,String]))}var J=Qm();function Xl(t,e="reset"){return J[t]||J[e]}var Xm=[String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`,String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`].join("|");function nt(t){return t.replace(new RegExp(Xm,"g"),"")}var Jl={solid:{tl:"\u250C",tr:"\u2510",bl:"\u2514",br:"\u2518",h:"\u2500",v:"\u2502"},double:{tl:"\u2554",tr:"\u2557",bl:"\u255A",br:"\u255D",h:"\u2550",v:"\u2551"},doubleSingle:{tl:"\u2553",tr:"\u2556",bl:"\u2559",br:"\u255C",h:"\u2500",v:"\u2551"},doubleSingleRounded:{tl:"\u256D",tr:"\u256E",bl:"\u2570",br:"\u256F",h:"\u2500",v:"\u2551"},singleThick:{tl:"\u250F",tr:"\u2513",bl:"\u2517",br:"\u251B",h:"\u2501",v:"\u2503"},singleDouble:{tl:"\u2552",tr:"\u2555",bl:"\u2558",br:"\u255B",h:"\u2550",v:"\u2502"},singleDoubleRounded:{tl:"\u256D",tr:"\u256E",bl:"\u2570",br:"\u256F",h:"\u2550",v:"\u2502"},rounded:{tl:"\u256D",tr:"\u256E",bl:"\u2570",br:"\u256F",h:"\u2500",v:"\u2502"}},eg={borderColor:"white",borderStyle:"rounded",valign:"center",padding:2,marginLeft:1,marginTop:1,marginBottom:1};function No(t,e={}){let s={...e,style:{...eg,...e.style}},i=t.split(`
|
|
211
|
+
`),n=[],r=Xl(s.style.borderColor),o={...typeof s.style.borderStyle=="string"?Jl[s.style.borderStyle]||Jl.solid:s.style.borderStyle};if(r)for(let d in o)o[d]=r(o[d]);let a=s.style.padding%2===0?s.style.padding:s.style.padding+1,u=i.length+a,l=Math.max(...i.map(d=>nt(d).length),s.title?nt(s.title).length:0)+a,c=l+a,f=s.style.marginLeft>0?" ".repeat(s.style.marginLeft):"";if(s.style.marginTop>0&&n.push("".repeat(s.style.marginTop)),s.title){let d=r?r(s.title):s.title,g=o.h.repeat(Math.floor((l-nt(s.title).length)/2)),D=o.h.repeat(l-nt(s.title).length-nt(g).length+a);n.push(`${f}${o.tl}${g}${d}${D}${o.tr}`)}else n.push(`${f}${o.tl}${o.h.repeat(c)}${o.tr}`);let h=s.style.valign==="center"?Math.floor((u-i.length)/2):s.style.valign==="top"?u-i.length-a:u-i.length;for(let d=0;d<u;d++)if(d<h||d>=h+i.length)n.push(`${f}${o.v}${" ".repeat(c)}${o.v}`);else{let g=i[d-h],D=" ".repeat(a),m=" ".repeat(l-nt(g).length);n.push(`${f}${o.v}${D}${g}${m}${o.v}`)}return n.push(`${f}${o.bl}${o.h.repeat(c)}${o.br}`),s.style.marginBottom>0&&n.push("".repeat(s.style.marginBottom)),n.join(`
|
|
212
|
+
`)}var yv=require("node:util"),Fv=require("node:path"),Cv=require("node:tty"),S0={},In=Object.create(null),ui=t=>globalThis.process?.env||S0.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(t?In:globalThis),Ft=new Proxy(In,{get(t,e){return ui()[e]??In[e]},has(t,e){let s=ui();return e in s||e in In},set(t,e,s){let i=ui(!0);return i[e]=s,!0},deleteProperty(t,e){if(!e)return!1;let s=ui(!0);return delete s[e],!0},ownKeys(){let t=ui(!0);return Object.keys(t)}}),qg=typeof process<"u"&&process.env&&process.env.NODE_ENV||"",Ug=[["APPVEYOR"],["AWS_AMPLIFY","AWS_APP_ID",{ci:!0}],["AZURE_PIPELINES","SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],["AZURE_STATIC","INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],["APPCIRCLE","AC_APPCIRCLE"],["BAMBOO","bamboo_planKey"],["BITBUCKET","BITBUCKET_COMMIT"],["BITRISE","BITRISE_IO"],["BUDDY","BUDDY_WORKSPACE_ID"],["BUILDKITE"],["CIRCLE","CIRCLECI"],["CIRRUS","CIRRUS_CI"],["CLOUDFLARE_PAGES","CF_PAGES",{ci:!0}],["CODEBUILD","CODEBUILD_BUILD_ARN"],["CODEFRESH","CF_BUILD_ID"],["DRONE"],["DRONE","DRONE_BUILD_EVENT"],["DSARI"],["GITHUB_ACTIONS"],["GITLAB","GITLAB_CI"],["GITLAB","CI_MERGE_REQUEST_ID"],["GOCD","GO_PIPELINE_LABEL"],["LAYERCI"],["HUDSON","HUDSON_URL"],["JENKINS","JENKINS_URL"],["MAGNUM"],["NETLIFY"],["NETLIFY","NETLIFY_LOCAL",{ci:!1}],["NEVERCODE"],["RENDER"],["SAIL","SAILCI"],["SEMAPHORE"],["SCREWDRIVER"],["SHIPPABLE"],["SOLANO","TDDIUM"],["STRIDER"],["TEAMCITY","TEAMCITY_VERSION"],["TRAVIS"],["VERCEL","NOW_BUILDER"],["VERCEL","VERCEL",{ci:!1}],["VERCEL","VERCEL_ENV",{ci:!1}],["APPCENTER","APPCENTER_BUILD_ID"],["CODESANDBOX","CODESANDBOX_SSE",{ci:!1}],["CODESANDBOX","CODESANDBOX_HOST",{ci:!1}],["STACKBLITZ"],["STORMKIT"],["CLEAVR"],["ZEABUR"],["CODESPHERE","CODESPHERE_APP_ID",{ci:!0}],["RAILWAY","RAILWAY_PROJECT_ID"],["RAILWAY","RAILWAY_SERVICE_ID"],["DENO-DEPLOY","DENO_DEPLOYMENT_ID"],["FIREBASE_APP_HOSTING","FIREBASE_APP_HOSTING",{ci:!0}]];function Wg(){if(globalThis.process?.env)for(let t of Ug){let e=t[1]||t[0];if(globalThis.process?.env[e])return{name:t[0].toLowerCase(),...t[2]}}return globalThis.process?.env?.SHELL==="/bin/jsh"&&globalThis.process?.versions?.webcontainer?{name:"stackblitz",ci:!1}:{name:"",ci:!1}}var Ac=Wg();Ac.name;function qt(t){return t?t!=="false":!1}var Vg=globalThis.process?.platform||"",Jo=qt(Ft.CI)||Ac.ci!==!1,xc=qt(globalThis.process?.stdout&&globalThis.process?.stdout.isTTY),zg=qt(Ft.DEBUG),Ho=qg==="test"||qt(Ft.TEST);qt(Ft.MINIMAL);var Kg=/^win/i.test(Vg);!qt(Ft.NO_COLOR)&&(qt(Ft.FORCE_COLOR)||(xc||Kg)&&Ft.TERM);var Gg=(globalThis.process?.versions?.node||"").replace(/^v/,"")||null;Number(Gg?.split(".")[0]);var Yg=globalThis.process||Object.create(null),wc={versions:{}};new Proxy(Yg,{get(t,e){if(e==="env")return Ft;if(e in t)return t[e];if(e in wc)return wc[e]}});var Jg=globalThis.process?.release?.name==="node",Hg=!!globalThis.Bun||!!globalThis.process?.versions?.bun,Zg=!!globalThis.Deno,Qg=!!globalThis.fastly,Xg=!!globalThis.Netlify,e0=!!globalThis.EdgeRuntime,t0=globalThis.navigator?.userAgent==="Cloudflare-Workers",s0=[[Xg,"netlify"],[e0,"edge-light"],[t0,"workerd"],[Qg,"fastly"],[Zg,"deno"],[Hg,"bun"],[Jg,"node"]];function i0(){let t=s0.find(e=>e[0]);if(t)return{name:t[1]}}var n0=i0();n0?.name;function r0({onlyFirst:t=!1}={}){let s=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(s,t?void 0:"g")}var o0=r0();function a0(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(o0,"")}function u0(t){return t===161||t===164||t===167||t===168||t===170||t===173||t===174||t>=176&&t<=180||t>=182&&t<=186||t>=188&&t<=191||t===198||t===208||t===215||t===216||t>=222&&t<=225||t===230||t>=232&&t<=234||t===236||t===237||t===240||t===242||t===243||t>=247&&t<=250||t===252||t===254||t===257||t===273||t===275||t===283||t===294||t===295||t===299||t>=305&&t<=307||t===312||t>=319&&t<=322||t===324||t>=328&&t<=331||t===333||t===338||t===339||t===358||t===359||t===363||t===462||t===464||t===466||t===468||t===470||t===472||t===474||t===476||t===593||t===609||t===708||t===711||t>=713&&t<=715||t===717||t===720||t>=728&&t<=731||t===733||t===735||t>=768&&t<=879||t>=913&&t<=929||t>=931&&t<=937||t>=945&&t<=961||t>=963&&t<=969||t===1025||t>=1040&&t<=1103||t===1105||t===8208||t>=8211&&t<=8214||t===8216||t===8217||t===8220||t===8221||t>=8224&&t<=8226||t>=8228&&t<=8231||t===8240||t===8242||t===8243||t===8245||t===8251||t===8254||t===8308||t===8319||t>=8321&&t<=8324||t===8364||t===8451||t===8453||t===8457||t===8467||t===8470||t===8481||t===8482||t===8486||t===8491||t===8531||t===8532||t>=8539&&t<=8542||t>=8544&&t<=8555||t>=8560&&t<=8569||t===8585||t>=8592&&t<=8601||t===8632||t===8633||t===8658||t===8660||t===8679||t===8704||t===8706||t===8707||t===8711||t===8712||t===8715||t===8719||t===8721||t===8725||t===8730||t>=8733&&t<=8736||t===8739||t===8741||t>=8743&&t<=8748||t===8750||t>=8756&&t<=8759||t===8764||t===8765||t===8776||t===8780||t===8786||t===8800||t===8801||t>=8804&&t<=8807||t===8810||t===8811||t===8814||t===8815||t===8834||t===8835||t===8838||t===8839||t===8853||t===8857||t===8869||t===8895||t===8978||t>=9312&&t<=9449||t>=9451&&t<=9547||t>=9552&&t<=9587||t>=9600&&t<=9615||t>=9618&&t<=9621||t===9632||t===9633||t>=9635&&t<=9641||t===9650||t===9651||t===9654||t===9655||t===9660||t===9661||t===9664||t===9665||t>=9670&&t<=9672||t===9675||t>=9678&&t<=9681||t>=9698&&t<=9701||t===9711||t===9733||t===9734||t===9737||t===9742||t===9743||t===9756||t===9758||t===9792||t===9794||t===9824||t===9825||t>=9827&&t<=9829||t>=9831&&t<=9834||t===9836||t===9837||t===9839||t===9886||t===9887||t===9919||t>=9926&&t<=9933||t>=9935&&t<=9939||t>=9941&&t<=9953||t===9955||t===9960||t===9961||t>=9963&&t<=9969||t===9972||t>=9974&&t<=9977||t===9979||t===9980||t===9982||t===9983||t===10045||t>=10102&&t<=10111||t>=11094&&t<=11097||t>=12872&&t<=12879||t>=57344&&t<=63743||t>=65024&&t<=65039||t===65533||t>=127232&&t<=127242||t>=127248&&t<=127277||t>=127280&&t<=127337||t>=127344&&t<=127373||t===127375||t===127376||t>=127387&&t<=127404||t>=917760&&t<=917999||t>=983040&&t<=1048573||t>=1048576&&t<=1114109}function l0(t){return t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510}function c0(t){return t>=4352&&t<=4447||t===8986||t===8987||t===9001||t===9002||t>=9193&&t<=9196||t===9200||t===9203||t===9725||t===9726||t===9748||t===9749||t>=9776&&t<=9783||t>=9800&&t<=9811||t===9855||t>=9866&&t<=9871||t===9875||t===9889||t===9898||t===9899||t===9917||t===9918||t===9924||t===9925||t===9934||t===9940||t===9962||t===9970||t===9971||t===9973||t===9978||t===9981||t===9989||t===9994||t===9995||t===10024||t===10060||t===10062||t>=10067&&t<=10069||t===10071||t>=10133&&t<=10135||t===10160||t===10175||t===11035||t===11036||t===11088||t===11093||t>=11904&&t<=11929||t>=11931&&t<=12019||t>=12032&&t<=12245||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12353&&t<=12438||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12773||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=42124||t>=42128&&t<=42182||t>=43360&&t<=43388||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=94176&&t<=94180||t===94192||t===94193||t>=94208&&t<=100343||t>=100352&&t<=101589||t>=101631&&t<=101640||t>=110576&&t<=110579||t>=110581&&t<=110587||t===110589||t===110590||t>=110592&&t<=110882||t===110898||t>=110928&&t<=110930||t===110933||t>=110948&&t<=110951||t>=110960&&t<=111355||t>=119552&&t<=119638||t>=119648&&t<=119670||t===126980||t===127183||t===127374||t>=127377&&t<=127386||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t===127568||t===127569||t>=127584&&t<=127589||t>=127744&&t<=127776||t>=127789&&t<=127797||t>=127799&&t<=127868||t>=127870&&t<=127891||t>=127904&&t<=127946||t>=127951&&t<=127955||t>=127968&&t<=127984||t===127988||t>=127992&&t<=128062||t===128064||t>=128066&&t<=128252||t>=128255&&t<=128317||t>=128331&&t<=128334||t>=128336&&t<=128359||t===128378||t===128405||t===128406||t===128420||t>=128507&&t<=128591||t>=128640&&t<=128709||t===128716||t>=128720&&t<=128722||t>=128725&&t<=128727||t>=128732&&t<=128735||t===128747||t===128748||t>=128756&&t<=128764||t>=128992&&t<=129003||t===129008||t>=129292&&t<=129338||t>=129340&&t<=129349||t>=129351&&t<=129535||t>=129648&&t<=129660||t>=129664&&t<=129673||t>=129679&&t<=129734||t>=129742&&t<=129756||t>=129759&&t<=129769||t>=129776&&t<=129784||t>=131072&&t<=196605||t>=196608&&t<=262141}function f0(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function h0(t,{ambiguousAsWide:e=!1}={}){return f0(t),l0(t)||c0(t)||e&&u0(t)?2:1}var d0=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g,D0=globalThis.Intl?.Segmenter?new Intl.Segmenter:{segment:t=>t.split("")},p0=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function m0(t,e={}){if(typeof t!="string"||t.length===0)return 0;let{ambiguousIsNarrow:s=!0,countAnsiEscapeCodes:i=!1}=e;if(i||(t=a0(t)),t.length===0)return 0;let n=0,r={ambiguousAsWide:!s};for(let{segment:o}of D0.segment(t)){let a=o.codePointAt(0);if(!(a<=31||a>=127&&a<=159)&&!(a>=8203&&a<=8207||a===65279)&&!(a>=768&&a<=879||a>=6832&&a<=6911||a>=7616&&a<=7679||a>=8400&&a<=8447||a>=65056&&a<=65071)&&!(a>=55296&&a<=57343)&&!(a>=65024&&a<=65039)&&!p0.test(o)){if(d0().test(o)){n+=2;continue}n+=h0(a,r)}}return n}function g0(){let{env:t}=Go.default,{TERM:e,TERM_PROGRAM:s}=t;return Go.default.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||s==="Terminus-Sublime"||s==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var y0={info:"cyan",fail:"red",success:"green",ready:"green",start:"magenta"},F0={0:"red",1:"yellow"},C0=g0(),Ye=(t,e)=>C0?t:e,vc={error:Ye("\u2716","\xD7"),fatal:Ye("\u2716","\xD7"),ready:Ye("\u2714","\u221A"),warn:Ye("\u26A0","\u203C"),info:Ye("\u2139","i"),success:Ye("\u2714","\u221A"),debug:Ye("\u2699","D"),trace:Ye("\u2192","\u2192"),fail:Ye("\u2716","\xD7"),start:Ye("\u25D0","o"),log:""};function Sc(t){return!(typeof Intl=="object")||!Intl.Segmenter?nt(t).length:m0(t)}var Yo=class extends oi{formatStack(e,s,i){let n=" ".repeat((i?.errorLevel||0)+1);return`
|
|
213
|
+
${n}`+Io(e,s).map(r=>" "+r.replace(/^at +/,o=>J.gray(o)).replace(/\((.+)\)/,(o,a)=>`(${J.cyan(a)})`)).join(`
|
|
214
|
+
${n}`)}formatType(e,s,i){let n=y0[e.type]||F0[e.level]||"gray";if(s)return b0(n)(J.black(` ${e.type.toUpperCase()} `));let r=typeof vc[e.type]=="string"?vc[e.type]:e.icon||e.type;return r?E0(n)(r):""}formatLogObj(e,s){let[i,...n]=this.formatArgs(e.args,s).split(`
|
|
215
|
+
`);if(e.type==="box")return No($n(i+(n.length>0?`
|
|
216
|
+
`+n.join(`
|
|
217
|
+
`):"")),{title:e.title?$n(e.title):void 0,style:e.style});let r=this.formatDate(e.date,s),o=r&&J.gray(r),a=e.badge??e.level<2,u=this.formatType(e,a,s),l=e.tag?J.gray(e.tag):"",c,f=this.filterAndJoin([u,$n(i)]),h=this.filterAndJoin(s.columns?[l,o]:[l]),d=(s.columns||0)-Sc(f)-Sc(h)-2;if(c=d>0&&(s.columns||0)>=80?f+" ".repeat(d)+h:(h?`${J.gray(`[${h}]`)} `:"")+f,c+=$n(n.length>0?`
|
|
218
|
+
`+n.join(`
|
|
219
|
+
`):""),e.type==="trace"){let g=new Error("Trace: "+e.message);c+=this.formatStack(g.stack||"",g.message)}return a?`
|
|
220
|
+
`+c+`
|
|
221
|
+
`:c}};function $n(t){return t.replace(/`([^`]+)`/gm,(e,s)=>J.cyan(s)).replace(/\s+_([^_]+)_\s+/gm,(e,s)=>` ${J.underline(s)} `)}function E0(t="white"){return J[t]||J.white}function b0(t="bgWhite"){return J[`bg${t[0].toUpperCase()}${t.slice(1)}`]||J.bgWhite}function w0(t={}){let e=v0();return process.env.CONSOLA_LEVEL&&(e=Number.parseInt(process.env.CONSOLA_LEVEL)??e),Kl({level:e,defaults:{level:e},stdout:process.stdout,stderr:process.stderr,prompt:(...i)=>Promise.resolve().then(()=>(bc(),Ec)).then(n=>n.prompt(...i)),reporters:t.reporters||[t.fancy??!(Jo||Ho)?new Yo:new oi],...t})}function v0(){return zg?oe.debug:Ho?oe.warn:oe.info}var Cs=w0();var Bv=require("node:tty");function A0(t){return Array.isArray(t)?t:t===void 0?[]:[t]}function Zo(t,e=""){let s=[];for(let i of t)for(let[n,r]of i.entries())s[n]=Math.max(s[n]||0,r.length);return t.map(i=>i.map((n,r)=>e+n[r===0?"padStart":"padEnd"](s[r])).join(" ")).join(`
|
|
222
|
+
`)}function Me(t){return typeof t=="function"?t():t}var Ct=class extends Error{constructor(e,s){super(e),this.code=s,this.name="CLIError"}},x0=/\d/,_0=["-","_","/","."];function B0(t=""){if(!x0.test(t))return t!==t.toLowerCase()}function _c(t,e){let s=e??_0,i=[];if(!t||typeof t!="string")return i;let n="",r,o;for(let a of t){let u=s.includes(a);if(u===!0){i.push(n),n="",r=void 0;continue}let l=B0(a);if(o===!1){if(r===!1&&l===!0){i.push(n),n=a,r=l;continue}if(r===!0&&l===!1&&n.length>1){let c=n.at(-1);i.push(n.slice(0,Math.max(0,n.length-1))),n=c+a,r=l;continue}}n+=a,r=l,o=u}return i.push(n),i}function k0(t){return t?t[0].toUpperCase()+t.slice(1):""}function T0(t){return t?t[0].toLowerCase()+t.slice(1):""}function $0(t,e){return t?(Array.isArray(t)?t:_c(t)).map(s=>k0(e?.normalize?s.toLowerCase():s)).join(""):""}function I0(t,e){return T0($0(t||"",e))}function N0(t,e){return t?(Array.isArray(t)?t:_c(t)).map(s=>s.toLowerCase()).join(e??"-"):""}function Qo(t){return t==null?[]:Array.isArray(t)?t:[t]}function O0(t,e,s,i){let n,r=t[e],o=~i.string.indexOf(e)?s==null||s===!0?"":String(s):typeof s=="boolean"?s:~i.boolean.indexOf(e)?s==="false"?!1:s==="true"||(t._.push((n=+s,n*0===0?n:s)),!!s):(n=+s,n*0===0?n:s);t[e]=r==null?o:Array.isArray(r)?r.concat(o):[r,o]}function R0(t=[],e={}){let s,i,n,r,o,a={_:[]},u=0,l=0,c=0,f=t.length,h=e.alias!==void 0,d=e.unknown!==void 0,g=e.default!==void 0;if(e.alias=e.alias||{},e.string=Qo(e.string),e.boolean=Qo(e.boolean),h)for(s in e.alias)for(i=e.alias[s]=Qo(e.alias[s]),u=0;u<i.length;u++)(e.alias[i[u]]=i.concat(s)).splice(u,1);for(u=e.boolean.length;u-- >0;)for(i=e.alias[e.boolean[u]]||[],l=i.length;l-- >0;)e.boolean.push(i[l]);for(u=e.string.length;u-- >0;)for(i=e.alias[e.string[u]]||[],l=i.length;l-- >0;)e.string.push(i[l]);if(g){for(s in e.default)if(r=typeof e.default[s],i=e.alias[s]=e.alias[s]||[],e[r]!==void 0)for(e[r].push(s),u=0;u<i.length;u++)e[r].push(i[u])}let D=d?Object.keys(e.alias):[];for(u=0;u<f;u++){if(n=t[u],n==="--"){a._=a._.concat(t.slice(++u));break}for(l=0;l<n.length&&n.charCodeAt(l)===45;l++);if(l===0)a._.push(n);else if(n.substring(l,l+3)==="no-"){if(r=n.slice(Math.max(0,l+3)),d&&!~D.indexOf(r))return e.unknown(n);a[r]=!1}else{for(c=l+1;c<n.length&&n.charCodeAt(c)!==61;c++);for(r=n.substring(l,c),o=n.slice(Math.max(0,++c))||u+1===f||(""+t[u+1]).charCodeAt(0)===45||t[++u],i=l===2?[r]:r,c=0;c<i.length;c++){if(r=i[c],d&&!~D.indexOf(r))return e.unknown("-".repeat(l)+r);O0(a,r,c+1<i.length||o,e)}}}if(g)for(s in e.default)a[s]===void 0&&(a[s]=e.default[s]);if(h)for(s in a)for(i=e.alias[s]||[];i.length>0;)a[i.shift()]=a[s];return a}function P0(t,e){let s={boolean:[],string:[],mixed:[],alias:{},default:{}},i=Bc(e);for(let a of i)a.type!=="positional"&&(a.type==="string"?s.string.push(a.name):a.type==="boolean"&&s.boolean.push(a.name),a.default!==void 0&&(s.default[a.name]=a.default),a.alias&&(s.alias[a.name]=a.alias));let n=R0(t,s),[...r]=n._,o=new Proxy(n,{get(a,u){return a[u]??a[I0(u)]??a[N0(u)]}});for(let[,a]of i.entries())if(a.type==="positional"){let u=r.shift();if(u!==void 0)o[a.name]=u;else{if(a.default===void 0&&a.required!==!1)throw new Ct(`Missing required positional argument: ${a.name.toUpperCase()}`,"EARG");o[a.name]=a.default}}else if(a.required&&o[a.name]===void 0)throw new Ct(`Missing required argument: --${a.name}`,"EARG");return o}function Bc(t){let e=[];for(let[s,i]of Object.entries(t||{}))e.push({...i,name:s,alias:A0(i.alias)});return e}async function kc(t,e){let s=await Me(t.args||{}),i=P0(e.rawArgs,s),n={rawArgs:e.rawArgs,args:i,data:e.data,cmd:t};typeof t.setup=="function"&&await t.setup(n);let r;try{let o=await Me(t.subCommands);if(o&&Object.keys(o).length>0){let a=e.rawArgs.findIndex(l=>!l.startsWith("-")),u=e.rawArgs[a];if(u){if(!o[u])throw new Ct(`Unknown command \`${u}\``,"E_UNKNOWN_COMMAND");let l=await Me(o[u]);l&&await kc(l,{rawArgs:e.rawArgs.slice(a+1)})}else if(!t.run)throw new Ct("No command specified.","E_NO_COMMAND")}typeof t.run=="function"&&(r=await t.run(n))}finally{typeof t.cleanup=="function"&&await t.cleanup(n)}return{result:r}}async function Xo(t,e,s){let i=await Me(t.subCommands);if(i&&Object.keys(i).length>0){let n=e.findIndex(a=>!a.startsWith("-")),r=e[n],o=await Me(i[r]);if(o)return Xo(o,e.slice(n+1),t)}return[t,s]}async function L0(t,e){try{Cs.log(await M0(t,e)+`
|
|
223
|
+
`)}catch(s){Cs.error(s)}}async function M0(t,e){let s=await Me(t.meta||{}),i=Bc(await Me(t.args||{})),n=await Me(e?.meta||{}),r=`${n.name?`${n.name} `:""}`+(s.name||process.argv[1]),o=[],a=[],u=[],l=[];for(let d of i)if(d.type==="positional"){let g=d.name.toUpperCase(),D=d.required!==!1&&d.default===void 0,m=d.default?`="${d.default}"`:"";a.push(["`"+g+m+"`",d.description||"",d.valueHint?`<${d.valueHint}>`:""]),l.push(D?`<${g}>`:`[${g}]`)}else{let g=d.required===!0&&d.default===void 0,D=(d.type==="boolean"&&d.default===!0?[...(d.alias||[]).map(m=>`--no-${m}`),`--no-${d.name}`].join(", "):[...(d.alias||[]).map(m=>`-${m}`),`--${d.name}`].join(", "))+(d.type==="string"&&(d.valueHint||d.default)?`=${d.valueHint?`<${d.valueHint}>`:`"${d.default||""}"`}`:"");o.push(["`"+D+(g?" (required)":"")+"`",d.description||""]),g&&l.push(D)}if(t.subCommands){let d=[],g=await Me(t.subCommands);for(let[D,m]of Object.entries(g)){let y=await Me(m),F=await Me(y?.meta);u.push([`\`${D}\``,F?.description||""]),d.push(D)}l.push(d.join("|"))}let c=[],f=s.version||n.version;c.push(J.gray(`${s.description} (${r+(f?` v${f}`:"")})`),"");let h=o.length>0||a.length>0;return c.push(`${J.underline(J.bold("USAGE"))} \`${r}${h?" [OPTIONS]":""} ${l.join(" ")}\``,""),a.length>0&&(c.push(J.underline(J.bold("ARGUMENTS")),""),c.push(Zo(a," ")),c.push("")),o.length>0&&(c.push(J.underline(J.bold("OPTIONS")),""),c.push(Zo(o," ")),c.push("")),u.length>0&&(c.push(J.underline(J.bold("COMMANDS")),""),c.push(Zo(u," ")),c.push("",`Use \`${r} <command> --help\` for more information about a command.`)),c.filter(d=>typeof d=="string").join(`
|
|
224
|
+
`)}async function Tc(t,e={}){let s=e.rawArgs||process.argv.slice(2),i=e.showUsage||L0;try{if(s.includes("--help")||s.includes("-h"))await i(...await Xo(t,s)),process.exit(0);else if(s.length===1&&s[0]==="--version"){let n=typeof t.meta=="function"?await t.meta():await t.meta;if(!n?.version)throw new Ct("No version specified","E_NO_VERSION");Cs.log(n.version)}else await kc(t,{rawArgs:s})}catch(n){let r=n instanceof Ct;r||Cs.error(n,`
|
|
225
|
+
`),r&&await i(...await Xo(t,s)),Cs.error(n.message),process.exit(1)}}var Nn={name:"diffray",version:"0.2.0",description:"AI-powered code review CLI for git changes",author:"Ilya Strelov <strelov1@gmail.com>",license:"MIT",type:"module",bin:{diffray:"./dist/diffray.cjs"},files:["dist/diffray.cjs","dist/defaults","src/defaults"],scripts:{dev:"npx tsx ./bin/diffray.ts",build:"node build.mjs && cp -r src/defaults dist/","link:local":`node -e "const p=require('./package.json');p.bin.diffray='./bin/diffray.ts';require('fs').writeFileSync('package.json',JSON.stringify(p,null,2)+'\\n')" && npm link`,"link:publish":`node -e "const p=require('./package.json');p.bin.diffray='./dist/diffray.cjs';require('fs').writeFileSync('package.json',JSON.stringify(p,null,2)+'\\n')"`,link:"npm link",unlink:"npm unlink",test:"vitest run","test:watch":"vitest","ts-check":"tsc --noEmit",lint:"eslint .","lint:fix":"eslint . --fix",format:"prettier --write .","format:check":"prettier --check .",prepublishOnly:"npm run build && npm run link:publish",prepare:"husky"},repository:{type:"git",url:"git+https://github.com/diffray/diffray.git"},homepage:"https://github.com/diffray/diffray#readme",bugs:{url:"https://github.com/diffray/diffray/issues"},keywords:["code-review","ai","cli","git","diff","llm","claude","cerebras","pull-request"],engines:{node:">=18.0.0"},os:["darwin","linux","win32"],cpu:["x64","arm64"],devDependencies:{"@eslint/js":"^9.39.2","@types/node":"^22.15.21","@typescript-eslint/eslint-plugin":"^8.52.0","@typescript-eslint/parser":"^8.52.0",esbuild:"^0.25.0",eslint:"^9.39.2","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.4",husky:"^9.1.0","lint-staged":"^15.5.0",prettier:"^3.7.4",tsx:"^4.19.0",vitest:"^3.1.0"},"lint-staged":{"*.{ts,tsx,js,jsx}":["eslint --fix","prettier --write"],"*.{json,md,yml,yaml}":["prettier --write"]},peerDependencies:{typescript:"^5"},dependencies:{citty:"^0.1.6",diff:"^8.0.2",glob:"^13.0.0",yaml:"^2.8.2",zod:"^3.22.4"}};var li=class{diff(e,s,i={}){let n;typeof i=="function"?(n=i,i={}):"callback"in i&&(n=i.callback);let r=this.castInput(e,i),o=this.castInput(s,i),a=this.removeEmpty(this.tokenize(r,i)),u=this.removeEmpty(this.tokenize(o,i));return this.diffWithOptionsObj(a,u,i,n)}diffWithOptionsObj(e,s,i,n){var r;let o=F=>{if(F=this.postProcess(F,i),n){setTimeout(function(){n(F)},0);return}else return F},a=s.length,u=e.length,l=1,c=a+u;i.maxEditLength!=null&&(c=Math.min(c,i.maxEditLength));let f=(r=i.timeout)!==null&&r!==void 0?r:1/0,h=Date.now()+f,d=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(d[0],s,e,0,i);if(d[0].oldPos+1>=u&&g+1>=a)return o(this.buildValues(d[0].lastComponent,s,e));let D=-1/0,m=1/0,y=()=>{for(let F=Math.max(D,-l);F<=Math.min(m,l);F+=2){let C,E=d[F-1],w=d[F+1];E&&(d[F-1]=void 0);let A=!1;if(w){let b=w.oldPos-F;A=w&&0<=b&&b<a}let $=E&&E.oldPos+1<u;if(!A&&!$){d[F]=void 0;continue}if(!$||A&&E.oldPos<w.oldPos?C=this.addToPath(w,!0,!1,0,i):C=this.addToPath(E,!1,!0,1,i),g=this.extractCommon(C,s,e,F,i),C.oldPos+1>=u&&g+1>=a)return o(this.buildValues(C.lastComponent,s,e))||!0;d[F]=C,C.oldPos+1>=u&&(m=Math.min(m,F-1)),g+1>=a&&(D=Math.max(D,F+1))}l++};if(n)(function F(){setTimeout(function(){if(l>c||Date.now()>h)return n(void 0);y()||F()},0)})();else for(;l<=c&&Date.now()<=h;){let F=y();if(F)return F}}addToPath(e,s,i,n,r){let o=e.lastComponent;return o&&!r.oneChangePerToken&&o.added===s&&o.removed===i?{oldPos:e.oldPos+n,lastComponent:{count:o.count+1,added:s,removed:i,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+n,lastComponent:{count:1,added:s,removed:i,previousComponent:o}}}extractCommon(e,s,i,n,r){let o=s.length,a=i.length,u=e.oldPos,l=u-n,c=0;for(;l+1<o&&u+1<a&&this.equals(i[u+1],s[l+1],r);)l++,u++,c++,r.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return c&&!r.oneChangePerToken&&(e.lastComponent={count:c,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=u,l}equals(e,s,i){return i.comparator?i.comparator(e,s):e===s||!!i.ignoreCase&&e.toLowerCase()===s.toLowerCase()}removeEmpty(e){let s=[];for(let i=0;i<e.length;i++)e[i]&&s.push(e[i]);return s}castInput(e,s){return e}tokenize(e,s){return Array.from(e)}join(e){return e.join("")}postProcess(e,s){return e}get useLongestToken(){return!1}buildValues(e,s,i){let n=[],r;for(;e;)n.push(e),r=e.previousComponent,delete e.previousComponent,e=r;n.reverse();let o=n.length,a=0,u=0,l=0;for(;a<o;a++){let c=n[a];if(c.removed)c.value=this.join(i.slice(l,l+c.count)),l+=c.count;else{if(!c.added&&this.useLongestToken){let f=s.slice(u,u+c.count);f=f.map(function(h,d){let g=i[l+d];return g.length>h.length?g:h}),c.value=this.join(f)}else c.value=this.join(s.slice(u,u+c.count));u+=c.count,c.added||(l+=c.count)}}return n}};var ea=class extends li{constructor(){super(...arguments),this.tokenize=U0}equals(e,s,i){return i.ignoreWhitespace?((!i.newlineIsToken||!e.includes(`
|
|
226
|
+
`))&&(e=e.trim()),(!i.newlineIsToken||!s.includes(`
|
|
227
|
+
`))&&(s=s.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(e.endsWith(`
|
|
228
|
+
`)&&(e=e.slice(0,-1)),s.endsWith(`
|
|
229
|
+
`)&&(s=s.slice(0,-1))),super.equals(e,s,i)}},q0=new ea;function ta(t,e,s){return q0.diff(t,e,s)}function U0(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
|
|
230
|
+
`));let s=[],i=t.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let n=0;n<i.length;n++){let r=i[n];n%2&&!e.newlineIsToken?s[s.length-1]+=r:s.push(r)}return s}function sa(t,e,s,i,n,r,o){let a;o?typeof o=="function"?a={callback:o}:a=o:a={},typeof a.context>"u"&&(a.context=4);let u=a.context;if(a.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(a.callback){let{callback:c}=a;ta(s,i,Object.assign(Object.assign({},a),{callback:f=>{let h=l(f);c(h)}}))}else return l(ta(s,i,a));function l(c){if(!c)return;c.push({value:"",lines:[]});function f(F){return F.map(function(C){return" "+C})}let h=[],d=0,g=0,D=[],m=1,y=1;for(let F=0;F<c.length;F++){let C=c[F],E=C.lines||W0(C.value);if(C.lines=E,C.added||C.removed){if(!d){let w=c[F-1];d=m,g=y,w&&(D=u>0?f(w.lines.slice(-u)):[],d-=D.length,g-=D.length)}for(let w of E)D.push((C.added?"+":"-")+w);C.added?y+=E.length:m+=E.length}else{if(d)if(E.length<=u*2&&F<c.length-2)for(let w of f(E))D.push(w);else{let w=Math.min(E.length,u);for(let $ of f(E.slice(0,w)))D.push($);let A={oldStart:d,oldLines:m-d+w,newStart:g,newLines:y-g+w,lines:D};h.push(A),d=0,g=0,D=[]}m+=E.length,y+=E.length}}for(let F of h)for(let C=0;C<F.lines.length;C++)F.lines[C].endsWith(`
|
|
231
|
+
`)?F.lines[C]=F.lines[C].slice(0,-1):(F.lines.splice(C+1,0,"\"),C++);return{oldFileName:t,newFileName:e,oldHeader:n,newHeader:r,hunks:h}}}function On(t){if(Array.isArray(t))return t.map(On).join(`
|
|
232
|
+
`);let e=[];t.oldFileName==t.newFileName&&e.push("Index: "+t.oldFileName),e.push("==================================================================="),e.push("--- "+t.oldFileName+(typeof t.oldHeader>"u"?"":" "+t.oldHeader)),e.push("+++ "+t.newFileName+(typeof t.newHeader>"u"?"":" "+t.newHeader));for(let s=0;s<t.hunks.length;s++){let i=t.hunks[s];i.oldLines===0&&(i.oldStart-=1),i.newLines===0&&(i.newStart-=1),e.push("@@ -"+i.oldStart+","+i.oldLines+" +"+i.newStart+","+i.newLines+" @@");for(let n of i.lines)e.push(n)}return e.join(`
|
|
233
|
+
`)+`
|
|
234
|
+
`}function $c(t,e,s,i,n,r,o){if(typeof o=="function"&&(o={callback:o}),o?.callback){let{callback:a}=o;sa(t,e,s,i,n,r,Object.assign(Object.assign({},o),{callback:u=>{a(u?On(u):void 0)}}))}else{let a=sa(t,e,s,i,n,r,o);return a?On(a):void 0}}function ci(t,e,s,i,n,r){return $c(t,t,e,s,i,n,r)}function W0(t){let e=t.endsWith(`
|
|
235
|
+
`),s=t.split(`
|
|
236
|
+
`).map(i=>i+`
|
|
237
|
+
`);return e?s.pop():s.push(s.pop().slice(0,-1)),s}var Rc=require("node:child_process"),Pc=require("node:fs/promises");hi();Q();var Oc=3e4;async function we(t,e=process.cwd()){return new Promise((s,i)=>{let n=(0,Rc.spawn)("git",t,{cwd:e}),r=[],o=[];n.stdout.on("data",u=>r.push(u)),n.stderr.on("data",u=>o.push(u));let a=setTimeout(()=>{n.kill(),i(new Error(`git ${t[0]} timeout after ${Oc/1e3}s`))},Oc);n.on("close",u=>{if(clearTimeout(a),u===0)s(Buffer.concat(r).toString("utf-8"));else{let l=Buffer.concat(o).toString("utf-8");i(new Error(`git ${t[0]} failed: ${l||`exit code ${u}`}`))}}),n.on("error",u=>{clearTimeout(a),i(u)})})}async function K0(){try{let e=(await we(["rev-parse","--abbrev-ref","HEAD"])).trim();return e==="HEAD"?null:e}catch(t){return p.debug(`getCurrentBranch failed: ${t}`),null}}async function G0(){return(await we(["rev-parse","HEAD"])).trim()}async function Y0(t){return(await we(["rev-parse",t])).trim()}async function Di(t){await we(["checkout",t]),qc()}async function Lc(t){let e=await G0(),s=await Y0(t);if(e===s)return{checkoutNeeded:!1,originalRef:null};let n=await K0()||e;return await Di(t),{checkoutNeeded:!0,originalRef:n}}async function Mc(){try{return(await we(["status","--porcelain"])).trim().split(`
|
|
238
|
+
`).filter(s=>s&&!s.startsWith("??")).length>0}catch(t){return p.debug(`hasUncommittedChanges failed: ${t}`),!1}}function J0(t){return t.trim().split(`
|
|
239
|
+
`).filter(e=>e.length>=3).map(e=>({file:e.slice(3),index:e[0]??" ",worktree:e[1]??" "}))}async function jc(){return rt(be.GIT_STATUS,async()=>{let t=await we(["status","--porcelain"]);return J0(t)})}function qc(){fi(be.GIT_STATUS)}async function Uc(){try{return await we(["rev-parse","--git-dir"]),!0}catch(t){return p.debug(`isGitRepository: not a git repo: ${t}`),!1}}async function H0(){try{return(await jc()).map(e=>e.file)}catch(t){throw new Error(`Failed to get changed files: ${t}`)}}async function Z0(t){try{let e="",s="";try{e=await we(["show",`HEAD:${t}`])}catch{e=""}try{s=await(0,Pc.readFile)(t,"utf-8")}catch{s=""}return ci(t,e,s,"HEAD","Working Directory")}catch(e){throw new Error(`Failed to get diff for ${t}: ${e}`)}}async function Q0(t){try{let s=(await jc()).find(i=>i.file===t);return s?s.index==="A"||s.index==="?"||s.worktree==="?"?"added":s.index==="D"||s.worktree==="D"?"deleted":"modified":"modified"}catch(e){return p.debug(`getFileStatus failed for ${t}: ${e}`),"modified"}}function na(t){let e=t.split(`
|
|
240
|
+
`),s=0,i=0;for(let n of e)n.startsWith("+")&&!n.startsWith("+++")?s++:n.startsWith("-")&&!n.startsWith("---")&&i++;return{additions:s,deletions:i}}async function Wc(){qc();let t=await H0();return(await Promise.all(t.map(async s=>{try{let[i,n]=await Promise.all([Z0(s),Q0(s)]),{additions:r,deletions:o}=na(i);return{file:s,status:n,diff:i,additions:r,deletions:o}}catch(i){return p.debug(`getAllDiffs: skipping ${s}: ${i}`),null}}))).filter(s=>s!==null).filter(s=>s.diff.trim().length>0)}function Vc(t){return t.trim().split(`
|
|
241
|
+
`).filter(e=>e.length>0).map(e=>{let[s,...i]=e.split(" "),n=i.join(" "),r="modified";return s==="A"?r="added":s==="D"?r="deleted":s?.startsWith("R")&&(r="modified"),{file:n,status:r}}).filter(e=>e.file)}async function zc(){try{let t=await we(["diff","--name-status","HEAD~1","HEAD"]),e=Vc(t);return e.length===0?[]:(await Promise.all(e.map(async({file:i,status:n})=>{try{let r=await we(["diff","HEAD~1","HEAD","--",i]),{additions:o,deletions:a}=na(r),u=r.startsWith("diff --git")?r:ci(i,"","","HEAD~1","HEAD");return{file:i,status:n,diff:u,additions:o,deletions:a}}catch(r){return p.debug(`getLastCommitDiffs: skipping ${i}: ${r}`),null}}))).filter(i=>i!==null&&i.diff.trim().length>0)}catch(t){throw new Error(`Failed to get last commit diffs: ${t}`)}}async function Kc(t,e="HEAD"){try{return(await we(["log","--format=%B%n---COMMIT_SEPARATOR---",`${t}..${e}`])).split("---COMMIT_SEPARATOR---").map(i=>i.trim()).filter(i=>i.length>0)}catch(s){return p.debug(`getCommitMessages failed: ${s}`),[]}}async function Gc(t,e="HEAD"){try{let s=await we(["diff","--name-status",t,e]),i=Vc(s);return i.length===0?[]:(await Promise.all(i.map(async({file:r,status:o})=>{try{let a=await we(["diff",t,e,"--",r]),{additions:u,deletions:l}=na(a),c=a.startsWith("diff --git")?a:ci(r,"","",t,e);return{file:r,status:o,diff:c,additions:u,deletions:l}}catch(a){return p.debug(`getCommitDiffs: skipping ${r}: ${a}`),null}}))).filter(r=>r!==null&&r.diff.trim().length>0)}catch(s){throw new Error(`Failed to get diffs between ${t} and ${e}: ${s}`)}}ct();Q();Zs();co();Q();function p1(t,e){let s=t.name;if(typeof s!="string")return null;let i=e.trim();if(!i)return null;let n=t.executorSettings&&typeof t.executorSettings=="object"&&!Array.isArray(t.executorSettings)?t.executorSettings:void 0,r=t.stage==="validation"?"validation":"review";return{name:s,description:typeof t.description=="string"?t.description:"",systemPrompt:i,enabled:typeof t.enabled=="boolean"?t.enabled:!0,order:typeof t.order=="number"?t.order:0,...typeof t.executor=="string"&&{executor:t.executor},stage:r,...n&&{executorSettings:n}}}async function wp(t){let{glob:e}=await Promise.resolve().then(()=>(Ka(),Ch)),{join:s}=await import("node:path");try{let i=await e("*.md",{cwd:t}),n=[],r=[],o=await Promise.all(i.map(async a=>{let u=s(t,a);try{return{agents:(await gn(u,p1)).map(c=>({...c,path:u})),failed:null}}catch(l){return p.error(`Error loading agent from ${a}:`,l),{agents:[],failed:a}}}));return n.push(...o.flatMap(a=>a.agents)),r.push(...o.map(a=>a.failed).filter(a=>a!==null)),r.length>0&&p.warn(`Loaded ${n.length}/${i.length} agents, ${r.length} failed: ${r.join(", ")}`),n}catch(i){if(i.code==="ENOENT")return[];throw i}}co();ct();async function pt(t){let e=typeof t=="string"?{projectPath:t}:t||{},s=e.projectPath||process.cwd(),i=await Dp("agents",wp,s),n=await ve(s),r=e.executorOverride||n.executor,o=n.executors[r]||{};return i.map(a=>{let u=a.stage||"review",l=o[u]||{},c=n.agents[a.name]||{};return{...a,executor:a.executor||r,executorSettings:{...l,...a.executorSettings,...c.model&&{model:c.model},...c.timeout&&{timeout:c.timeout}},enabled:c.enabled??a.enabled}}).filter(a=>a.enabled!==!1)}Q();function vp(){return{id:"load-rules",name:"Load Rules",description:"Load matching rules and agents",enabled:!0,order:0,execute:async t=>{let e=Date.now(),[s,i]=await Promise.all([jt(),t.agents&&t.agents.length>0?Promise.resolve(t.agents):pt()]);if(t.ruleFilter&&t.ruleFilter.length>0){let n=new Set(t.ruleFilter);s=s.filter(r=>n.has(r.name))}if(t.excludeRules&&t.excludeRules.length>0){let n=new Set(t.excludeRules);s=s.filter(r=>!n.has(r.name))}if(t.agentFilter&&t.agentFilter.length>0){let n=new Set(t.agentFilter);i=i.filter(r=>n.has(r.name))}if(t.excludeAgents&&t.excludeAgents.length>0){let n=new Set(t.excludeAgents);i=i.filter(r=>!n.has(r.name))}return t.ruleRefs=s,t.agents=i,t.quiet||p.sync(`Loaded ${s.length} rule(s), ${i.length} agent(s)`),{stageId:"load-rules",stageName:"Load Rules",success:!0,duration:Date.now()-e}}}}Zs();Q();function Sp(){return{id:"match-rules",name:"Match Rules",description:"Match rules to files",enabled:!0,order:1,execute:async t=>{let e=Date.now(),s=t.ruleRefs??[],i=t.agents??[],n=await Nl(s,t.diffs,i);if(t.matchedRules=n,!t.quiet){p.sync(`Matched ${n.length} rule(s)`);for(let r of n)p.plain(` ${r.rule.name}: ${r.files.length} file(s) \u2192 ${r.agent.name}`)}return{stageId:"match-rules",stageName:"Match Rules",success:!0,duration:Date.now()-e}}}}var fo=class{items=new Map;register(e){this.items.set(e.name,e)}get(e){return this.items.get(e)}list(){return Array.from(this.items.values())}remove(e){this.items.delete(e)}clear(){this.items.clear()}count(){return this.items.size}};var Rl=class extends fo{listEnabled(){return this.list().filter(e=>e.enabled)}enable(e){let s=this.get(e);s&&(s.enabled=!0)}disable(e){let s=this.get(e);s&&(s.enabled=!1)}setExecutor(e,s){let i=this.get(e);i&&(i.executor=s)}countEnabled(){return this.list().filter(e=>e.enabled).length}},Qs=new Rl;ct();zn();Q();hi();Q();var _p=require("node:fs/promises");Bl();var m1=3,Ap=1e3;async function xp(t){return new Promise(e=>setTimeout(e,t))}async function Bp(t,e,s=m1){let i;for(let n=0;n<s;n++)try{let r=await fetch(t,e);if(r.ok||r.status>=400&&r.status<500&&r.status!==429)return r;if(i=new Error(`HTTP ${r.status}`),n<s-1){let o=Ap*Math.pow(2,n);process.env.DEBUG&&p.plain(`\u23F3 Retry ${n+1}/${s-1} after ${o}ms (${r.status})`),await xp(o)}}catch(r){if(i=r instanceof Error?r:new Error(String(r)),n<s-1){let o=Ap*Math.pow(2,n);process.env.DEBUG&&p.plain(`\u23F3 Retry ${n+1}/${s-1} after ${o}ms (${i.message})`),await xp(o)}}throw i||new Error("Max retries exceeded")}var g1=`# Output Format
|
|
242
|
+
|
|
243
|
+
Return your findings as a **JSON array** wrapped in \`<json>...</json>\` XML tags:
|
|
244
|
+
|
|
245
|
+
<json>
|
|
246
|
+
[
|
|
247
|
+
{
|
|
248
|
+
"file": "path/to/file.ts",
|
|
249
|
+
"lineStart": 10,
|
|
250
|
+
"lineEnd": 15,
|
|
251
|
+
"severity": "critical|high|medium|low",
|
|
252
|
+
"category": "security|performance|bug|quality|style|docs",
|
|
253
|
+
"shortDescription": "Brief one-line description",
|
|
254
|
+
"fullDescription": "Detailed description of the issue",
|
|
255
|
+
"suggestion": "How to fix this issue (optional)"
|
|
256
|
+
}
|
|
257
|
+
]
|
|
258
|
+
</json>
|
|
259
|
+
|
|
260
|
+
Return empty array if no issues found: \`<json>[]</json>\`
|
|
261
|
+
`;async function ho(){return rt(be.OUTPUT_FORMAT,async()=>{try{let t=lp("prompts","output-format.md");return await(0,_p.readFile)(t,"utf-8")}catch{return g1}})}function Do(t,e,s){return`${t}
|
|
262
|
+
|
|
263
|
+
# Input:
|
|
264
|
+
${e}
|
|
265
|
+
|
|
266
|
+
${s}`}function po(t,e){return`${t}
|
|
267
|
+
|
|
268
|
+
${e}`}function ze(t,e,s,i,n,r){return{agent:t.agent.name,executor:t.executor.name,success:e,output:s,error:i,duration:n,prompt:r}}var kp=j.object({model:j.string().optional(),temperature:j.number().min(0).max(2).optional(),maxTokens:j.number().positive().optional()});function y1(t,e){return{name:t.name,description:t.description,type:"llm-api",enabled:!!t.apiKey,async execute(s){let i=Date.now();try{let n=await ho(),r=po(s.input,n);s.verbose&&p.plain(`\u{1F527} API: ${t.name} (model: ${t.model})`);let o=await e(s.systemPrompt,r,t);return s.verbose&&(p.plain(`\u{1F4E5} API raw response (${o.length} chars):`),p.plain(` ${o.slice(0,500)}${o.length>500?"...":""}`)),ze(s,!0,o,void 0,Date.now()-i,r)}catch(n){return ze(s,!1,"",n instanceof Error?n.message:String(n),Date.now()-i)}},getInfo:()=>({name:t.name,description:t.description,type:"llm-api",provider:"custom",model:t.model,apiKey:t.apiKey,baseUrl:t.baseUrl,temperature:t.temperature,maxTokens:t.maxTokens,enabled:!!t.apiKey}),settingsSchema:kp,applySettings:s=>{let i=kp.safeParse(s),n=i.success?i.data:{};return{name:t.name,description:t.description,type:"llm-api",provider:"custom",model:n.model??t.model,apiKey:t.apiKey,baseUrl:t.baseUrl,temperature:n.temperature??t.temperature,maxTokens:n.maxTokens??t.maxTokens,enabled:!!t.apiKey}}}}var mo={model:"llama-3.3-70b",temperature:.7,maxTokens:8192,baseUrl:"https://api.cerebras.ai/v1"};async function F1(t,e,s){if(!s.apiKey)throw new Error("CEREBRAS_API_KEY not set");let i=await Bp(`${s.baseUrl}/chat/completions`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s.apiKey}`},body:JSON.stringify({model:s.model,messages:[{role:"system",content:t},{role:"user",content:e}],temperature:s.temperature||.7,max_tokens:s.maxTokens||8192})});if(!i.ok){let r=await i.text();throw new Error(`Cerebras API: ${i.status} - ${r}`)}return(await i.json()).choices?.[0]?.message?.content||""}var Tp=y1({name:"cerebras-api",description:"Execute via Cerebras AI API",model:mo.model,apiKey:process.env.CEREBRAS_API_KEY,baseUrl:mo.baseUrl,temperature:mo.temperature,maxTokens:mo.maxTokens},F1);zn();var zp=require("node:child_process");Q();var go=new Set,$p=!1;function Xs(t){go.add(t),t.once("exit",()=>{go.delete(t)})}function yo(t,e=3e3){return t.kill("SIGTERM"),setTimeout(()=>{t.killed||t.kill("SIGKILL")},e)}function C1(){let t=[...go];go.clear();for(let e of t)e.kill("SIGTERM");setTimeout(()=>{for(let e of t)e.killed||e.kill("SIGKILL")},2e3)}function ei(){$p||($p=!0,process.on("SIGINT",()=>{C1(),process.exit(130)}))}var Lp=require("node:child_process");Q();function Fo(t,e=1){if(t==null)return e;let s=typeof t=="number"?t:parseInt(String(t).trim(),10);return!isNaN(s)&&s>0?s:e}function E1(t){return t.lineStart!==void 0?Fo(t.lineStart,0):t.line!==void 0?Fo(t.line,0):t.lineNumber!==void 0?Fo(t.lineNumber,0):1}function b1(t,e){let s=t.file||t.path||"",i=E1(t),n=Fo(t.lineEnd,i),r=t.category||t.type||"quality",o=t.shortDescription||t.short||t.message||t.issue||t.title||t.problem||"",a=t.fullDescription||t.description||t.evidence||t.detail||t.details||t.explanation||o,u=t.suggestion||t.fix||t.recommendation||t.remediation||t.solution;return{file:s,lineStart:i,lineEnd:n,severity:t.severity||"medium",category:r,shortDescription:o,fullDescription:a,suggestion:u,agent:e??t.agent??"unknown"}}function w1(t){let e=t.match(/\[[\s\S]*\]/);if(!e)return null;try{let s=JSON.parse(e[0]);return Array.isArray(s)?s:null}catch{return null}}function Ip(t){return t.match(/<json>\s*([\s\S]*?)\s*<\/json>/)?.[1]?.trim()??null}function v1(t){try{let e=JSON.parse(t);if(e.type==="result"&&typeof e.result=="string"){let s=e.result,i=Ip(s);if(i)return i;let n=s.match(/```json\s*([\s\S]*?)```/);if(n)return n[1]?.trim()??s;let r=s.matchAll(/```(?:\w*)?\s*([\s\S]*?)```/g);for(let o of r){let a=o[1]?.trim();if(a?.startsWith("[")||a?.startsWith("{"))return a}return s}}catch(e){process.env.DEBUG&&console.warn("extractClaudeCliResult JSON parse failed:",e)}return null}function ti(t,e){try{let s=t,i=v1(t);if(i)s=i;else{let r=Ip(t);r&&(s=r)}let n=null;try{let r=JSON.parse(s);n=Array.isArray(r)?r:r.issues??null}catch{n=w1(s)}return Array.isArray(n)?n.map(r=>b1(r,e)).filter(r=>r.file&&(r.shortDescription||r.fullDescription)&&r.lineStart>0):[]}catch{return[]}}var U={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",green:"\x1B[32m",gray:"\x1B[90m"};function S1(t){switch(t){case"critical":return U.red;case"high":return U.yellow;case"medium":return U.blue;case"low":return U.cyan}}function A1(t){switch(t){case"critical":return"\u2717";case"high":return"\u26A0";case"medium":return"\u25CB";case"low":return"\u25C7"}}function x1(t){switch(t){case"security":return"\u{1F512}";case"performance":return"\u26A1";case"bug":return"\u{1F41B}";case"quality":return"\u2728";case"style":return"\u{1F3A8}";case"docs":return"\u{1F4DD}"}}function Pl(t){switch(t){case"critical":return 0;case"high":return 1;case"medium":return 2;case"low":return 3}}function Ll(t){return[...t].sort((e,s)=>{let i=Pl(e.severity),n=Pl(s.severity);return i-n})}function yn(t,e=!1){let s=S1(t.severity),i=A1(t.severity),n=x1(t.category),r=[];return e?r.push(`${i} ${U.bold}${t.file}:${t.lineStart}${U.reset} - ${s}${t.shortDescription}${U.reset}`):(r.push(""),r.push(`${i} ${s}${U.bold}${t.severity.toUpperCase()}${U.reset} ${n} ${U.dim}${t.category}${U.reset}`),r.push(`${U.bold}${t.file}${U.reset}:${U.cyan}${t.lineStart}${t.lineEnd!==t.lineStart?`-${t.lineEnd}`:""}${U.reset}`),r.push(""),r.push(`${U.bold}${t.shortDescription}${U.reset}`),t.fullDescription&&t.fullDescription!==t.shortDescription&&(r.push(""),r.push(`${U.dim}${t.fullDescription}${U.reset}`)),t.suggestion&&(r.push(""),r.push(`${U.green}\u2192 Suggestion:${U.reset}`),r.push(`${U.dim}${t.suggestion}${U.reset}`)),r.push(""),r.push(`${U.gray}From: ${t.agent}${U.reset}`),r.push(""),r.push(U.gray+"\u2500".repeat(80)+U.reset)),r.join(`
|
|
269
|
+
`)}function Op(t){let e=new Map;for(let s of t){let i=e.get(s.file)||[];i.push(s),e.set(s.file,i)}return e}function Np(t){return Math.min(...t.map(e=>Pl(e.severity)))}function Rp(t){if(t.length===0)return`${U.green}\u2713 No issues found \u{1F389}${U.reset}`;let e=Op(t),s=[];s.push(""),s.push(`${U.bold}Found ${t.length} issue(s) in ${e.size} file(s)${U.reset}`),s.push("");let i=Array.from(e.entries()).sort(([,n],[,r])=>Np(n)-Np(r));for(let[n,r]of i){s.push(`${U.bold}${U.cyan}${n}${U.reset} ${U.dim}(${r.length} issue(s))${U.reset}`),s.push("");let o=Ll(r);for(let a of o)s.push(yn(a,!1))}return s.join(`
|
|
270
|
+
`)}function Pp(t,e,s,i,n,r){let o=t.filter(g=>g.severity==="critical").length,a=t.filter(g=>g.severity==="high").length,u=t.filter(g=>g.severity==="medium").length,l=t.filter(g=>g.severity==="low").length,c=Ll(t),f=Op(c),h=Array.from(f.entries()).map(([g,D])=>({file:g,issueCount:D.length,issues:Ll(D)})),d={success:e,totalDuration:s,stats:{totalIssues:t.length,critical:o,high:a,medium:u,low:l,filesAnalyzed:r,agentsExecuted:i,agentsSucceeded:n,agentsFailed:i-n},issues:c,files:h};return JSON.stringify(d,null,2)}function _1(t,e){let s=ti(t,e);if(s.length!==0){p.plain(`
|
|
271
|
+
\x1B[33m\u26A0 Preliminary issues (may be filtered):\x1B[0m`);for(let i of s)p.plain(yn(i,!0));p.plain("")}}function B1(t,e,s){if(s.verbose&&p.plain(`\x1B[90m${e}\x1B[0m`),s.stream&&!s.verbose){if(t.type==="system"){let i=t.tools?.length||0,n=t.model||"unknown";p.plain(`\x1B[90m\u{1F4CB} ${n}, ${i} tools\x1B[0m`)}else if(t.type==="assistant"&&t.message?.content){for(let i of t.message.content)if(i.type==="tool_use")p.plain(`\x1B[36m\u{1F527} ${i.name}\x1B[0m`);else if(i.type==="text"&&i.text){let n=i.text.slice(0,200),r=i.text.length>200?"...":"";p.plain(`\x1B[90m\u{1F4AD} ${n}${r}\x1B[0m`)}}}if(t.type==="result"){if(s.stream&&!s.verbose){let i=t.total_cost_usd?`$${t.total_cost_usd.toFixed(4)}`:"",n=t.duration_ms?`${(t.duration_ms/1e3).toFixed(1)}s`:"";p.plain(`\x1B[90m\u{1F4CA} ${n} ${i}\x1B[0m`)}if(t.subtype==="success"&&t.result)return t.result;if(t.subtype==="error")throw new Error(t.error||"Claude CLI returned error")}return null}async function Mp(t,e,s,i){if(t.length===0)throw new Error("No command provided to streamClaudeCli");ei();let[n,...r]=t,o=(0,Lp.spawn)(n,r,{stdio:["ignore","pipe","pipe"],env:{...process.env,...e},cwd:i.cwd});Xs(o);let a=s*1e3,u=setTimeout(()=>yo(o,2e3),a);return new Promise((l,c)=>{let f="",h="",d=[];o.stderr?.on("data",g=>d.push(g)),o.stdout?.on("data",g=>{h+=g.toString("utf-8");let D=h.split(`
|
|
272
|
+
`);h=D.pop()||"";for(let m of D)if(m.trim())try{let y=JSON.parse(m),F=B1(y,m,i);F!==null&&(f=F,i.stream&&i.agentName&&_1(f,i.agentName))}catch{process.env.DEBUG&&p.plain(`\u{1F4E1} Stream parse error: ${m}`)}}),o.on("close",g=>{if(clearTimeout(u),h.trim())try{let m=JSON.parse(h);m.type==="result"&&m.subtype==="success"&&m.result&&(f=m.result)}catch{}let D=Buffer.concat(d).toString("utf-8");if(g===null){c(new Error(`Process killed (timeout after ${s}s or signal)${D?`: ${D}`:""}`));return}if(g!==0){c(new Error(`Exit code ${g}: ${D}`));return}l(f.trim())}),o.on("error",g=>{clearTimeout(u),c(g)})})}var jp=require("node:child_process");Q();function k1(t,e){let s=ti(t,e);if(s.length!==0){p.plain(`
|
|
273
|
+
\x1B[33m\u26A0 Preliminary issues (may be filtered):\x1B[0m`);for(let i of s)p.plain(yn(i,!0));p.plain("")}}function T1(t,e,s){if(s.verbose&&p.plain(`\x1B[90m${e}\x1B[0m`),s.stream&&!s.verbose){if(t.type==="system"){let i=t.tools?.length||0,n=t.model||"unknown";p.plain(`\x1B[90m\u{1F4CB} ${n}, ${i} tools\x1B[0m`)}else if(t.type==="assistant"&&t.message?.content){for(let i of t.message.content)if(i.type==="tool_use")p.plain(`\x1B[36m\u{1F527} ${i.name}\x1B[0m`);else if(i.type==="text"&&i.text){let n=i.text.slice(0,200),r=i.text.length>200?"...":"";p.plain(`\x1B[90m\u{1F4AD} ${n}${r}\x1B[0m`)}}}if(t.type==="result"){if(s.stream&&!s.verbose){let i=t.total_cost_usd?`$${t.total_cost_usd.toFixed(4)}`:"",n=t.duration_ms?`${(t.duration_ms/1e3).toFixed(1)}s`:"";p.plain(`\x1B[90m\u{1F4CA} ${n} ${i}\x1B[0m`)}if(t.subtype==="success"&&t.result)return t.result;if(t.subtype==="error")throw new Error(t.error||"Cursor Agent CLI returned error")}return null}async function qp(t,e,s,i){if(t.length===0)throw new Error("No command provided to streamCursorAgentCli");ei();let[n,...r]=t,o=(0,jp.spawn)(n,r,{stdio:["ignore","pipe","pipe"],env:{...process.env,...e},cwd:i.cwd});Xs(o);let a=s*1e3,u=setTimeout(()=>yo(o,2e3),a);return new Promise((l,c)=>{let f="",h="",d=[];o.stderr?.on("data",g=>d.push(g)),o.stdout?.on("data",g=>{h+=g.toString("utf-8");let D=h.split(`
|
|
274
|
+
`);h=D.pop()||"";for(let m of D)if(m.trim())try{let y=JSON.parse(m),F=T1(y,m,i);F!==null&&(f=F,i.stream&&i.agentName&&k1(f,i.agentName))}catch{i.verbose&&p.plain(`\u{1F4E1} ${m}`),f+=m+`
|
|
275
|
+
`}}),o.on("close",g=>{if(clearTimeout(u),h.trim())try{let m=JSON.parse(h);m.type==="result"&&m.subtype==="success"&&m.result&&(f=m.result)}catch{f+=h}let D=Buffer.concat(d).toString("utf-8");if(g===null){c(new Error(`Process killed (timeout after ${s}s or signal)${D?`: ${D}`:""}`));return}if(g!==0){c(new Error(`Exit code ${g}: ${D}`));return}l(f.trim())}),o.on("error",g=>{clearTimeout(u),c(g)})})}var Up=j.object({model:j.string().optional(),timeout:j.number().positive().optional()}),Wp={model:"opus",timeout:120},Vp={model:"opus-4.5",timeout:120};function Ml(t,e){return t.executor.type==="cli"&&t.executor.timeout!==void 0?t.executor.timeout:e||60}function jl(t,e){return t.executor.type==="cli"&&t.executor.model!==void 0?t.executor.model:e}async function $1(t,e,s){let i=Date.now(),n=`${e.systemPrompt}
|
|
276
|
+
|
|
277
|
+
${s}`,r=e.input,o=jl(e,t.model),a=Ml(e,t.timeout),u=t.args||[];o&&(u=[...u,"--model",o]);let l=u.map(d=>d==="--output-format"?"--output-format":d),c=l.indexOf("json");c!==-1&&(l[c]="stream-json"),l.push("--verbose");let f;if(t.systemPromptArg)f=[t.command,...l,t.systemPromptArg,n,r];else{let d=Do(n,e.input,s);f=t.useStdin?[t.command,...l]:[t.command,...l,d]}let h=await Mp(f,t.env||{},a,{stream:e.stream??!1,verbose:e.verbose??!1,agentName:e.agent.name,cwd:e.cwd});return ze(e,!0,h,void 0,Date.now()-i,r)}async function I1(t,e,s){let i=Date.now(),r=`<system>
|
|
278
|
+
${`${e.systemPrompt}
|
|
279
|
+
|
|
280
|
+
${s}`}
|
|
281
|
+
</system>
|
|
282
|
+
|
|
283
|
+
${e.input}`,o=jl(e,t.model),a=Ml(e,t.timeout),u=[t.command];u.push("-p","--output-format","stream-json"),o&&u.push("--model",o),u.push(r);let l=await qp(u,t.env||{},a,{stream:e.stream??!1,verbose:e.verbose??!1,agentName:e.agent.name,cwd:e.cwd});return ze(e,!0,l,void 0,Date.now()-i,e.input)}async function N1(t,e,s){let i=Date.now(),n=po(e.input,s),r=e.systemPrompt,o=jl(e,t.model),a=Ml(e,t.timeout),u=t.args||[];o&&(u=[...u,"--model",o]);let l;if(t.systemPromptArg)l=[...u,t.systemPromptArg,r,n];else{let c=Do(r,e.input,s);l=t.useStdin?[...u]:[...u,c]}return e.verbose&&p.plain(`\u{1F527} CLI: ${t.command} ${l.slice(0,-1).join(" ")} <prompt ${n.length} chars>`),ei(),new Promise(c=>{let f=(0,zp.spawn)(t.command,l,{stdio:[t.useStdin?"pipe":"ignore","pipe","pipe"],env:{...process.env,...t.env},cwd:e.cwd});Xs(f);let h=[],d=[];if(f.stdout?.on("data",m=>h.push(m)),f.stderr?.on("data",m=>d.push(m)),t.useStdin&&f.stdin){let m=t.systemPromptArg?n:Do(e.systemPrompt,e.input,s);f.stdin.write(m),f.stdin.end()}let g=a*1e3,D=setTimeout(()=>f.kill(),g);f.on("close",m=>{clearTimeout(D);let y=Buffer.concat(h).toString("utf-8"),F=Buffer.concat(d).toString("utf-8");if(e.verbose&&(p.plain(`\u{1F4E5} CLI raw response (${y.length} chars):`),p.plain(` ${y.slice(0,500)}${y.length>500?"...":""}`),F&&p.plain(` stderr: ${F.slice(0,200)}`)),m===null){c(ze(e,!1,"",`Process killed (timeout after ${a}s or signal)${F?`: ${F}`:""}`,Date.now()-i,n));return}if(m!==0){c(ze(e,!1,"",`Exit code ${m}: ${F}`,Date.now()-i,n));return}c(ze(e,!0,y,void 0,Date.now()-i,n))}),f.on("error",m=>{clearTimeout(D),c(ze(e,!1,"",`Process error: ${m.message}`,Date.now()-i,n))})})}function ql(t){return{name:t.name,description:t.description,type:"cli",enabled:!0,async execute(e){let s=Date.now();try{let i=await ho();return t.name==="claude-cli"?await $1(t,e,i):t.name==="cursor-agent-cli"?await I1(t,e,i):await N1(t,e,i)}catch(i){return ze(e,!1,"",i instanceof Error?i.message:String(i),Date.now()-s)}},getInfo:()=>({name:t.name,description:t.description,type:"cli",command:t.command,args:t.args,env:t.env,timeout:t.timeout,model:t.model,installCommand:t.installCommand,enabled:!0}),settingsSchema:Up,applySettings:e=>{let s=Up.safeParse(e),i=s.success?s.data:{};return{name:t.name,description:t.description,type:"cli",command:t.command,args:t.args,env:t.env,timeout:i.timeout??t.timeout,model:i.model??t.model,installCommand:t.installCommand,enabled:!0}}}}var Kp=ql({name:"claude-cli",description:"Execute via Claude Code CLI",command:"claude",args:["-p","--output-format","json","--no-session-persistence"],timeout:Wp.timeout,model:Wp.model,useStdin:!1,systemPromptArg:"--system-prompt",installCommand:"npm install -g @anthropic-ai/claude-code"}),Gp=ql({name:"test-cli",description:"Test stub executor - returns empty array (for testing only)",command:"bash",args:["-c","cat > /dev/null; sleep 1; echo '[]'"],timeout:10,useStdin:!0}),Yp=ql({name:"cursor-agent-cli",description:"Execute via Cursor Agent CLI",command:"cursor-agent",args:[],timeout:Vp.timeout,model:Vp.model,useStdin:!1,installCommand:"curl https://cursor.com/install -fsS | bash"});var Fn=new Map([["cerebras-api",Tp],["claude-cli",Kp],["cursor-agent-cli",Yp],["test-cli",Gp]]);function si(t){return Fn.get(t)}function Jp(){return[...Fn.values()]}function Hp(t){let e=Fn.get(t.name);e&&(e.enabled=t.enabled)}async function Zp(t){let e=Fn.get(t.executor.name);if((!e||!e.enabled)&&(process.env.DEBUG&&console.warn(`Executor "${t.executor.name}" not available, using test-cli`),e=Fn.get("test-cli")),!e)throw new Error(`No executor found: ${t.executor.name}`);return e.execute(t)}var Ke={async autoDiscover(){},get:si,listExecutors(){return Jp().map(t=>t.getInfo())},registerExecutor:Hp,executeAgent:Zp};async function Cn(){return await Ke.autoDiscover(),Ke.listExecutors()}Q();function En(t){return Math.ceil(t.length/4)}function Qp(){return"simple (1 token \u2248 4 chars)"}function O1(t){let e=`File: ${t.file}
|
|
284
|
+
${t.diff}`;return En(e)}var Xp=1e4;function R1(){let t=process.env.DIFFRAY_BATCH_TOKENS,e=t?parseInt(t,10):Xp;return{maxTokensPerBatch:isNaN(e)?Xp:e}}function em(t,e,s){let i=s||R1(),n=[],r=En(e),o=i.maxTokensPerBatch-r-1e3,a=[],u=0;for(let l of t){let c=O1(l);if(c>o){a.length>0&&(n.push({diffs:a,tokenCount:u+r,batchIndex:n.length}),a=[],u=0),n.push({diffs:[l],tokenCount:c+r,batchIndex:n.length});continue}u+c>o&&a.length>0&&(n.push({diffs:a,tokenCount:u+r,batchIndex:n.length}),a=[],u=0),a.push(l),u+=c}return a.length>0&&n.push({diffs:a,tokenCount:u+r,batchIndex:n.length}),n}function tm(t,e=!1){let s=t.diffs.length,i=t.tokenCount.toLocaleString();if(e){let n=t.diffs.map(r=>` ${r.file}`).join(`
|
|
285
|
+
`);return`Batch ${t.batchIndex+1}: ${s} file(s), ~${i} tokens
|
|
286
|
+
Files:
|
|
287
|
+
${n}`}return`Batch ${t.batchIndex+1}: ${s} file(s), ~${i} tokens`}function ii(t){if(t<1)throw new Error("Concurrency must be at least 1");let e=[],s=0,i=()=>{s--,e.length>0&&e.shift()?.()};return n=>new Promise((r,o)=>{let a=async()=>{s++;try{let u=await n();r(u)}catch(u){o(u)}finally{i()}};s<t?a():e.push(a)})}ct();Q();function sm(t,e){if(e<1)throw new Error("Chunk size must be at least 1");let s=[];for(let i=0;i<t.length;i+=e)s.push(t.slice(i,i+e));return s}function P1(t){let{label:e,batchIndex:s,totalBatches:i,itemCount:n,itemName:r="item"}=t;if(i===1)return n!==void 0?`${e} (${n} ${r}${n!==1?"s":""})...`:`${e}...`;let o=`batch ${s+1}/${i}`;return n!==void 0?`${e} (${o}, ${n} ${r}${n!==1?"s":""})...`:`${e} (${o})...`}function Co(t){let e=t.filter(i=>!!i);if(e.length===0)return;let s=[...new Set(e)];return s.length===1&&e.length>1?`${s[0]} (${e.length} batches)`:s.join("; ")}async function im(t,e,s){let i=ii(s.concurrency);return Promise.all(t.map((n,r)=>i(()=>e(n,r,t.length))))}async function Eo(t,e,s,i,n){let r=Date.now(),o=P1(t),a=e?null:new Pn(o);try{a?.start();let u=await s(),l=Date.now()-r;if(u.success){let c=i?i(u.data,l):`${t.label} (${l}ms)`;a?.succeed(c)}else{let c=n?n(u.error||"Unknown error"):`${t.label}: ${u.error}`;a?.fail(c)}return{success:u.success,data:u.data,error:u.error,duration:l}}catch(u){let l=Date.now()-r,c=u instanceof Error?u.message:String(u),f=n?n(c):`${t.label}: ${c}`;return a?.fail(f),{success:!1,data:void 0,error:c,duration:l}}finally{a?.stop()}}function nm(t){return t.every(e=>e.success)}function rm(t){return t.filter(e=>!e.success)}async function L1(t,e,s){let i=new Map;for(let n of t){let r=e.matchedRules?.filter(h=>h.agent.name===n.name)||[];if(r.length===0)continue;let o=new Set;for(let h of r)for(let d of h.files)o.add(d);let a=e.diffs.filter(h=>o.has(h.file)),u=n.systemPrompt,l=r.map(h=>h.rule.prompt).filter(Boolean).join(`
|
|
288
|
+
|
|
289
|
+
`);l&&(u=`${u}
|
|
290
|
+
|
|
291
|
+
${l}`),s&&(u=`${u}
|
|
292
|
+
|
|
293
|
+
${s}`);let c=em(a,u),f=r.map(h=>h.rule.name);i.set(n.name,{batches:c,files:a.length,rules:r.length,ruleNames:f,systemPrompt:u})}return i}async function M1(t,e,s,i,n,r,o,a,u){return a(async()=>{t.batchIndex===0&&u?.startTask(s.name);let f=`${["# Repository Context",`Base path: ${o.metadata.repository}`,"All file paths below are relative to this directory.","When using tools to read files, prepend this base path to get absolute paths.",o.metadata.baseRef?`Base ref: ${o.metadata.baseRef}`:null,o.metadata.headRef?`Head ref: ${o.metadata.headRef}`:null].filter(Boolean).join(`
|
|
294
|
+
`)}
|
|
295
|
+
|
|
296
|
+
${t.diffs.map(D=>`File: ${D.file}
|
|
297
|
+
${D.diff}`).join(`
|
|
298
|
+
|
|
299
|
+
`)}`;if(o.verbose&&!o.quiet){let D=t.tokenCount-r,m=t.diffs.map(F=>`File: ${F.file} <diff ${F.diff.length} chars>`).join(`
|
|
300
|
+
`),y=`${n}
|
|
301
|
+
|
|
302
|
+
# Input:
|
|
303
|
+
${m}`;p.newline(),p.plain(`Prompt for ${s.name} (batch ${t.batchIndex+1}/${e.length}):`),p.plain(` Tokens: ${t.tokenCount.toLocaleString()} (~${r.toLocaleString()} system + ~${D.toLocaleString()} input)`),p.plain("\u2500".repeat(80)),p.plain(y),p.plain("\u2500".repeat(80)),p.newline()}let h=s.executorSettings&&i.applySettings?i.applySettings(s.executorSettings):i.getInfo(),d={agent:s,executor:h,input:f,systemPrompt:n,verbose:o.verbose,quiet:o.quiet,stream:o.stream,cwd:o.metadata.repository},g=async()=>{let D=await Ke.executeAgent(d),m=ti(D.output,s.name);return{success:D.success,data:m,error:D.error}};if(u){let D=Date.now();try{let m=await g(),y=Date.now()-D;return m.success?u.completeBatch(s.name):u.failTask(s.name),{...m,duration:y}}catch(m){let y=Date.now()-D,F=m instanceof Error?m.message:String(m);return u.failTask(s.name),{success:!1,data:[],error:F,duration:y}}}return Eo({label:s.name,batchIndex:t.batchIndex,totalBatches:e.length},o.quiet??!1,g,(D,m)=>e.length>1?`${s.name} (batch ${t.batchIndex+1}/${e.length}, ${m}ms)`:`${s.name} (${m}ms)`,D=>e.length>1?`${s.name} (batch ${t.batchIndex+1}/${e.length}): ${D}`:`${s.name}: ${D}`)})}function j1(t,e,s){let i=[],n=0;for(let a of t)i.push(...a.data),n+=a.duration||0;let r=t.every(a=>a.success),o=Co(t.map(a=>a.error));return{agent:e.name,executor:e.executor||"unknown",success:r,output:`Processed ${s.length} batch(es), found ${i.length} issue(s)`,duration:n,issues:i,error:o}}function om(){return{id:"review",name:"Review",description:"Run code review agents",enabled:!0,order:2,execute:async t=>{let e=Date.now(),s=await gf(),i=t.config,o=((i.executors[i.executor]||{}).review||{}).concurrency??t.concurrency,a=ii(o);t.verbose&&!t.quiet&&p.plain(`Token counter: ${Qp()}`);let u=Qs.listEnabled();if(u.length===0)return t.quiet||p.warn("No enabled Agents found"),{stageId:"review",stageName:"Review",success:!0,duration:Date.now()-e};let l=await L1(u,t,s),c=0;for(let[,b]of l)c+=b.batches.length;let f=u.filter(b=>b.stage!=="validation"),h=f.filter(b=>l.has(b.name)),d=f.filter(b=>!l.has(b.name));if(!t.quiet){p.sync(`Code Review: ${h.length} agent${h.length!==1?"s":""} (${c} batch${c!==1?"es":""} total)...`);for(let b of d)p.plain(` \u2022 ${b.name}: skipped (no matching rules)`)}let D=!t.quiet&&!t.stream&&!t.verbose?new Es:void 0;if(D){for(let b of h){let O=l.get(b.name);if(O){let Y=O.ruleNames.slice(0,3).join(", "),ce=`${O.files} files | ${Y}${O.rules>3?"...":""}`;D.addTask(b.name,b.name,O.batches.length,O.files,O.rules,ce)}}D.start()}let m;try{m=await Promise.all(h.map(async b=>{try{let O=b.executor||i.executor,Y=Ke.get(O);if(!Y)return t.quiet||p.warn(`Executor not found: ${O}`),null;let ce=l.get(b.name),{batches:z,systemPrompt:mt}=ce,vo=En(mt);!t.quiet&&t.verbose&&z.forEach(vn=>{p.plain(` ${tm(vn,!0)}`)});let wn=await Promise.all(z.map(vn=>M1(vn,z,b,Y,mt,vo,t,a,D))),ni=j1(wn,b,z);return t.issues.push(...ni.issues),t.results.push(ni),ni}catch(O){let Y=O instanceof Error?O.message:String(O);t.quiet||p.error(`${b.name}: ${Y}`);let ce={agent:b.name,executor:b.executor||"unknown",success:!1,output:"",error:Y,duration:0,issues:[]};return t.results.push(ce),ce}}))}finally{D?.stop()}let y=m.filter(b=>b?.success).length,F=m.filter(b=>b&&!b.success),C=F.length,E=Date.now()-e,w=E>=1e3?`${(E/1e3).toFixed(1)}s`:`${E}ms`;if(t.quiet||p.done(`Review complete: ${y}/${h.length} agents (${w})`),C>0&&!t.quiet)for(let b of F)p.warn(`Agent "${b?.agent}" failed: ${b?.error||"execution failed"} - issues from this agent excluded`);let A=y>0,$;return C>0&&($=F.map(O=>`${O?.agent||"Unknown"}: ${O?.error||"execution failed"}`).filter(Boolean).join("; ")),{stageId:"review",stageName:"Review",success:A,duration:E,error:$}}}}Q();function am(){return{id:"aggregate-results",name:"Aggregate Results",description:"Collect results",enabled:!0,order:3,execute:async t=>{let e=Date.now(),s=t.results.filter(n=>n.success).length,i=t.results.filter(n=>!n.success).length;return t.quiet||p.sync(`Results: ${s} success, ${i} failed`),{stageId:"aggregate-results",stageName:"Aggregate Results",success:!0,duration:Date.now()-e}}}}Q();var q1=.6;function um(t){let e=t.toLowerCase().replace(/[^\w\s]/g," ").split(/\s+/).filter(s=>s.length>2);return new Set(e)}function U1(t,e){if(t.size===0&&e.size===0)return 1;if(t.size===0||e.size===0)return 0;let s=0;for(let n of t)e.has(n)&&s++;let i=t.size+e.size-s;return s/i}function W1(t,e){if(t.file!==e.file||Math.min(Math.abs(t.lineStart-e.lineStart),Math.abs(t.lineEnd-e.lineEnd))>10)return!1;let i=um(t.shortDescription),n=um(e.shortDescription);return U1(i,n)>=q1}function lm(){return{id:"deduplication",name:"Deduplication",description:"Remove duplicate results and issues",enabled:!0,order:4,execute:async t=>{let e=Date.now(),s=t.results.flatMap(c=>c.issues),i=s.length,n=new Set,r=s.filter(c=>{let f=`${c.file}:${c.lineStart}:${c.lineEnd}`;return n.has(f)?!1:(n.add(f),!0)}),o=[];for(let c of r)o.some(h=>W1(h,c))||o.push(c);t.issues=o;let a=i-r.length,u=r.length-o.length,l=a+u;if(l>0&&!t.quiet){let c=[];a>0&&c.push(`${a} by location`),u>0&&c.push(`${u} by similarity`),p.sync(`Removed ${l} duplicate issue(s) (${c.join(", ")})`)}return{stageId:"deduplication",stageName:"Deduplication",success:!0,duration:Date.now()-e}}}}Q();hi();var V1=10,bn={FILE_EXACT_MATCH:40,FILE_PARTIAL_MATCH:30,LINE_OVERLAP:30,LINE_NEARBY:15,DESCRIPTION:30},Ul={MINIMUM_SCORE:40,LINE_TOLERANCE:5,LINE_EXTENDED_TOLERANCE:20},cm={name:"validation",description:"Validates issues found by other agents",systemPrompt:`You are a code review validation agent. Your task is to validate issues found by other agents and filter out false positives.
|
|
304
|
+
|
|
305
|
+
You may include your analysis and reasoning, but MUST include a JSON array of valid issues somewhere in your response.
|
|
306
|
+
Be strict but fair. Only filter out clear false positives.`,enabled:!0,order:999,executor:"claude-cli",executorSettings:{model:"opus",timeout:180}};async function z1(t){return rt(be.VALIDATION_PROMPT,async()=>{try{return(await pt({projectPath:t})).find(i=>i.name==="validation"||i.stage==="validation")??cm}catch{return cm}})}function K1(t){return t.map(e=>{let s=[`<issue id="${e.id}">`,`**[${e.severity.toUpperCase()}] ${e.category}** in \`${e.file}:${e.lineStart}-${e.lineEnd}\``,`Agent: ${e.agent}`,"",`**Problem:** ${e.shortDescription}`,"",e.fullDescription];return e.suggestion&&s.push("",`**Suggestion:** ${e.suggestion}`),s.push("</issue>"),s.join(`
|
|
307
|
+
`)}).join(`
|
|
308
|
+
|
|
309
|
+
`)}function fm(t){return t.replace(/\\/g,"/").replace(/^\.\//,"").toLowerCase()}function G1(t,e,s,i,n=Ul.LINE_TOLERANCE){return t<=i&&s<=e?!0:Math.abs(t-s)<=n||Math.abs(e-i)<=n||Math.abs(t-i)<=n||Math.abs(e-s)<=n}function Y1(t,e){let s=0;if(!e.file)return 0;let i=fm(t.file),n=fm(e.file);if(i===n)s+=bn.FILE_EXACT_MATCH;else if(i.endsWith(n)||n.endsWith(i))s+=bn.FILE_PARTIAL_MATCH;else return 0;if(typeof e.lineStart=="number"){let r=e.lineEnd??e.lineStart;G1(t.lineStart,t.lineEnd,e.lineStart,r)?s+=bn.LINE_OVERLAP:Math.abs(t.lineStart-e.lineStart)<=Ul.LINE_EXTENDED_TOLERANCE&&(s+=bn.LINE_NEARBY)}if(e.shortDescription&&t.shortDescription){let o=new Set(t.shortDescription.toLowerCase().split(/\W+/).filter(c=>c.length>=3)),a=new Set(e.shortDescription.toLowerCase().split(/\W+/).filter(c=>c.length>=3)),l=[...o].filter(c=>a.has(c)).length/Math.max(o.size,a.size,1);s+=Math.round(l*bn.DESCRIPTION)}return s}function J1(t,e){let s=t.match(/<valid-ids>\s*(\[[\s\S]*?\])\s*<\/valid-ids>/);if(s?.[1])try{let n=JSON.parse(s[1]);if(Array.isArray(n)&&n.every(r=>typeof r=="number"))return n}catch{}let i=t.match(/\[\s*(\d+\s*(?:,\s*\d+\s*)*)\]/);if(i?.[1])try{let n=JSON.parse(`[${i[1]}]`);if(Array.isArray(n)){let r=n.filter(o=>typeof o=="number");if(r.length>0)return r}}catch{}if(e&&e.length>0){let n=t.match(/<json>\s*([\s\S]*?)\s*<\/json>/);if(n?.[1])try{let r=JSON.parse(n[1]);if(Array.isArray(r)&&r.length>0){let o=new Set;for(let a of r){let u=null,l=0;for(let c of e){if(o.has(c.id))continue;let f=Y1(c,a);f>l&&f>=Ul.MINIMUM_SCORE&&(l=f,u=c)}u&&o.add(u.id)}if(o.size>0)return Array.from(o)}}catch{}}return[]}function H1(t,e,s){t.forEach(i=>{i.issues=i.issues.filter(n=>{let r=s.get(n);return r!==void 0&&e.has(r)})})}function Z1(t,e,s){let i=t.executor||s,n=si(i);return!n||!n.enabled?(e.quiet||p.warn(`Validation executor '${i}' not found or disabled, skipping validation`),null):t.executorSettings&&n.applySettings?n.applySettings(t.executorSettings):n.getInfo()}async function hm(t,e,s,i,n,r,o){o&&e===0&&o.startTask("validation");let a=K1(t),u=r.metadata.repository,l=r.metadata.commitMessages?.length?["","## Commit Messages (IMPORTANT: Check these to understand change intent!)","These messages explain WHY the changes were made. Use them to identify INTENTIONAL trade-offs.","",...r.metadata.commitMessages.map((g,D)=>`### Commit ${D+1}:
|
|
310
|
+
${g}`)].join(`
|
|
311
|
+
`):null,f=`${["# Repository Context",`Base path: ${u}`,"All file paths below are relative to this directory.","When using tools to read files, prepend this base path to get absolute paths.",r.metadata.baseRef?`Base ref: ${r.metadata.baseRef}`:null,r.metadata.headRef?`Head ref: ${r.metadata.headRef}`:null,l].filter(Boolean).join(`
|
|
312
|
+
`)}
|
|
313
|
+
|
|
314
|
+
# Issues to validate (${t.length} total):
|
|
315
|
+
|
|
316
|
+
${a}`,h={agent:i,executor:n,input:f,systemPrompt:i.systemPrompt,verbose:r.verbose,quiet:r.quiet,cwd:u};if(r.verbose&&!r.quiet){let g=s>1;p.plain(`
|
|
317
|
+
Validation prompt${g?` (batch ${e+1}/${s})`:""}:`),p.plain(` Executor: ${n.name}`),p.plain(` Issues to validate: ${t.length}`),p.plain("\u2500".repeat(80)),p.plain(f.slice(0,2e3)+(f.length>2e3?"...":"")),p.plain("\u2500".repeat(80)),p.newline()}let d=async()=>{let g=await Ke.executeAgent(h);return g.success?{success:!0,data:J1(g.output,t)}:{success:!1,data:[],error:g.error}};if(o){let g=Date.now();try{let D=await d(),m=Date.now()-g;return D.success?o.completeBatch("validation"):o.failTask("validation"),{...D,duration:m}}catch(D){let m=Date.now()-g,y=D instanceof Error?D.message:String(D);return o.failTask("validation"),{success:!1,data:[],error:y,duration:m}}}return Eo({label:"Validating",batchIndex:e,totalBatches:s,itemCount:t.length,itemName:"issue"},r.quiet??!1,d,(g,D)=>s>1?`Validated batch ${e+1}/${s} (${g.length} valid, ${D}ms)`:`Validated ${g.length} issue(s) (${D}ms)`,g=>s>1?`Validation failed (batch ${e+1}): ${g}`:`Validation failed: ${g}`)}function dm(){return{id:"validation",name:"Validation",description:"Validate issues and filter out false positives",enabled:!0,order:5,execute:async t=>{let e=Date.now();if(t.skipValidation)return t.quiet||p.sync("Skipping validation (--skip-validation)"),{stageId:"validation",stageName:"Validation",success:!0,duration:Date.now()-e};let s=[],i=new Map;if(t.results.forEach(y=>{y.issues.forEach(F=>{let C=s.length+1;s.push(F),i.set(F,C)})}),s.length===0)return t.quiet||p.sync("No issues to validate"),{stageId:"validation",stageName:"Validation",success:!0,duration:Date.now()-e};let n=s.map((y,F)=>({...y,id:F+1})),r=await z1(t.metadata.repository),o=t.config,a=o.executor,l=(o.executors[a]||{}).validation||{},c=l.batchSize??V1,f=l.concurrency??t.concurrency,h=Z1(r,t,a);if(!h)return{stageId:"validation",stageName:"Validation",success:!0,duration:Date.now()-e};let d=sm(n,c),g=h.type==="llm-api"||h.type==="cli"?h.model:void 0;t.quiet||(p.sync(`Validating ${s.length} issue(s)...`),t.verbose&&p.plain(` Executor: ${h.name}${g?` (model: ${g})`:""}`));let m=!t.quiet&&!t.stream&&!t.verbose?new Es:void 0;m&&(m.addTask("validation","Validation",d.length,s.length,1,`${s.length} issues`),m.start());try{let y;if(m){let A=ii(f);y=await Promise.all(d.map(($,b)=>A(()=>hm($,b,d.length,r,h,t,m))))}else y=await im(d,(A,$,b)=>hm(A,$,b,r,h,t),{concurrency:f,quiet:t.quiet});if(m?.stop(),!nm(y)){let A=rm(y),$=Co(A.map(b=>b.error));return{stageId:"validation",stageName:"Validation",success:!1,duration:Date.now()-e,error:$}}let F=new Set(y.flatMap(A=>A.data));H1(t.results,F,i);let C=F.size,E=s.length-C,w=Date.now()-e;return t.quiet||p.done(`Validation complete: ${C} valid, ${E} filtered out (${w}ms)`),{stageId:"validation",stageName:"Validation",success:!0,duration:w}}catch(y){m?.stop();let F=y instanceof Error?y.message:String(y);return t.quiet||p.error(`Validation error: ${F}`),{stageId:"validation",stageName:"Validation",success:!1,duration:Date.now()-e,error:F}}}}}function Dm(){return[vp(),Sp(),om(),am(),lm(),dm()]}ct();var bo=class{agents=[];executors=new Map;stages=[];constructor(e=[],s=[],i){this.agents=[...e].sort((n,r)=>n.order-r.order);for(let n of s)this.executors.set(n.name,n),Ke.registerExecutor(n);for(let n of e)Qs.register(n);this.stages=i||Dm()}addAgent(e){this.agents.push(e),this.agents.sort((s,i)=>s.order-i.order),Qs.register(e)}removeAgent(e){this.agents=this.agents.filter(s=>s.name!==e),Qs.remove(e)}getAgents(){return this.agents}getEnabledAgents(){return this.agents.filter(e=>e.enabled)}addExecutor(e){this.executors.set(e.name,e),Ke.registerExecutor(e)}getExecutor(e){return this.executors.get(e)}async execute(e,s={}){let{verbose:i=!1,quiet:n=!1,concurrency:r=3,skipValidation:o=!1,stream:a=!1,baseRef:u,headRef:l,ruleFilter:c,excludeRules:f,agentFilter:h,excludeAgents:d}=s,g=Date.now(),D=process.cwd(),m=await ve(D),y=[];u&&l&&(y=await Kc(u,l),i&&y.length>0&&p.plain(`Fetched ${y.length} commit message(s) for context`));let F={diffs:e,results:[],issues:[],metadata:{timestamp:Date.now(),repository:D,baseRef:u,headRef:l,commitMessages:y.length>0?y:void 0},verbose:i,quiet:n,stream:a,concurrency:r,skipValidation:o,ruleFilter:c,excludeRules:f,agentFilter:h,excludeAgents:d,config:m,agents:this.agents},C=[];for(let w of this.stages)if(w.enabled)try{let A=await w.execute(F);if(C.push(A),!A.success){p.error(`Stage ${w.name} failed: ${A.error}`);break}}catch(A){let $=A instanceof Error?A.message:String(A);p.error(`Stage ${w.name} failed: ${$}`),C.push({stageId:w.id,stageName:w.name,success:!1,duration:0,error:$});break}let E=Date.now()-g;return{success:C.every(w=>w.success),context:F,totalDuration:E,stages:C}}};Q();Zs();var pm=require("node:child_process");ct();Q();async function mm(t){let e=t||process.cwd(),s=await ve(e),i=pa(),n=Ci(e),r=await ma(),o=await Gn(e);p.plain(`Configuration
|
|
318
|
+
`),p.plain(`Global: ${i}${r?"":" (not found)"}`),p.plain(`Project: ${n}${o?"":" (not found)"}`),p.plain(`
|
|
319
|
+
Merged config:
|
|
320
|
+
`),p.plain(JSON.stringify(s,null,2))}async function gm(t){let e=t||process.cwd();if(await Gn(e)){p.warn("Project config already exists"),p.plain(`Location: ${Ci(e)}`);return}let i=await mf(e);p.success("Project config created"),p.plain(`Location: ${i}`),p.plain(`
|
|
321
|
+
Edit the file to override global settings.`)}async function ym(t){let e=process.env.EDITOR||"nano",s;if(t.global)s=pa(),await ma()||(p.warn("Global config does not exist. Creating with defaults..."),await pf(Da()));else{let n=t.projectPath||process.cwd();if(!await Gn(n)){p.warn("Project config does not exist. Run `diffray config init` first.");return}s=Ci(n)}p.info(`Opening ${s} in ${e}...`);let i=(0,pm.spawnSync)(e,[s],{stdio:"inherit"});i.error&&(p.error(`Failed to open editor: ${i.error.message}`),process.exit(1))}var Fm={meta:{name:"config",description:"Manage configuration"},subCommands:{show:{meta:{description:"Show merged configuration (defaults + global + project)"},run:async()=>{await mm()}},init:{meta:{description:"Initialize project config (.diffray.json)"},run:async()=>{await gm()}},edit:{meta:{description:"Edit configuration in $EDITOR"},args:{global:{type:"boolean",description:"Edit global config (~/.diffray/config.json)",alias:"g"}},run:async({args:t})=>{await ym({global:t.global})}}}};Q();function Q1(t){return!t||Object.keys(t).length===0?"-":Object.entries(t).map(([e,s])=>`${e}=${s}`).join(", ")}async function Cm(){let t=await pt(process.cwd());if(p.robot("Available Agents"),p.newline(),t.length===0){p.plain("No Agents configured");return}for(let e of t){let s=e.enabled?"\u25CF":"\u25CB",i=e.stage||"review",n=di(e.path);p.plain(`${s} ${e.name} (${i})`),p.plain(` executor: ${e.executor}`),e.executorSettings&&Object.keys(e.executorSettings).length>0&&p.plain(` settings: ${Q1(e.executorSettings)}`),p.plain(` path: ${n}`),p.newline()}}async function Em(t){let s=(await pt(process.cwd())).find(i=>i.name===t);if(s||(p.error(`Agent not found: ${t}`),process.exit(1)),p.robot(`Agent: ${s.name}`),p.newline(),p.plain(`Description: ${s.description}`),p.plain(`Enabled: ${s.enabled?"Yes":"No"}`),p.plain(`Order: ${s.order}`),p.plain(`Stage: ${s.stage||"review"}`),p.plain(`Executor: ${s.executor}`),p.plain(`Path: ${di(s.path)}`),s.executorSettings&&Object.keys(s.executorSettings).length>0){p.newline(),p.plain("Executor Settings:");for(let[i,n]of Object.entries(s.executorSettings))p.plain(` ${i}: ${n}`)}p.newline(),p.plain("System Prompt:"),p.separator("\u2500"),p.plain(s.systemPrompt||"(no prompt)"),p.separator("\u2500")}var bm={meta:{name:"agents",description:`List agents or show agent details
|
|
322
|
+
|
|
323
|
+
Examples:
|
|
324
|
+
diffray agents # List all agents
|
|
325
|
+
diffray agents validation # Show validation agent details
|
|
326
|
+
diffray agents general # Show general agent details`},args:{name:{type:"positional",description:"Agent name (optional, shows details if provided)",required:!1}},run:async({args:t})=>{t.name?await Em(t.name):await Cm()}};var wm=require("node:child_process");ct();Q();function X1(t){return t.type==="cli"?t.installCommand:void 0}function ev(t){try{return(0,wm.execFileSync)("which",[t],{stdio:"ignore"}),!0}catch{return!1}}function tv(t){return t.type==="llm-api"||t.type==="cli"?t.model:void 0}function sv(t){let e=si(t);if(!e?.settingsSchema)return[];let s=e.settingsSchema;return"shape"in s&&typeof s.shape=="object"?Object.keys(s.shape):[]}async function vm(){let t=await ve(process.cwd()),e=t.executor,s=t.executors[e]||{};p.plain(`Executor: \x1B[36m${e}\x1B[0m`),p.newline(),p.plain("Stages:");let i=["review","validation"];for(let n of i){let r=s[n],o=[];r?.model&&o.push(`model=${r.model}`),r?.timeout&&o.push(`timeout=${r.timeout}`);let a=o.length>0?` (${o.join(", ")})`:"";p.plain(` ${n.padEnd(12)} \u2192 ${e}${a}`)}p.newline()}async function Sm(t){let e=await Cn(),s=e.find(n=>n.name===t);if(!s){p.error(`Executor not found: ${t}`),p.newline(),p.plain("Available executors:");for(let n of e)p.plain(` \u2022 ${n.name}`);process.exit(1)}if(p.robot(`Executor: ${s.name}`),p.newline(),p.plain(`Type: ${s.type}`),p.plain(`Description: ${s.description}`),s.type==="cli"&&s.command){let n=s.command,r=ev(n);if(p.plain(`Command: ${n} ${r?"\x1B[32m\u2713\x1B[0m":"\x1B[33m\u2717 not installed\x1B[0m"}`),!r){let a=X1(s);a&&p.plain(`Install: ${a}`)}p.plain(`Args: ${s.args?.join(" ")||"(none)"}`);let o=tv(s);o&&p.plain(`Model: ${o}`),p.plain(`Timeout: ${s.timeout||60}s`)}else s.type==="llm-api"&&(p.plain(`Provider: ${s.provider}`),p.plain(`Model: ${s.model}`),p.plain(`Temperature: ${s.temperature??.7}`),p.plain(`Max Tokens: ${s.maxTokens??4096}`));if(s.type==="cli"&&s.env){p.newline(),p.plain("Environment Variables:");for(let[n,r]of Object.entries(s.env)){let o=n.includes("KEY")||n.includes("TOKEN")?String(r).substring(0,8)+"...":r;p.plain(` ${n}: ${o}`)}}let i=sv(t);if(i.length>0){p.newline(),p.plain("Stage Settings (in config.executors.<executor>.<stage>):");for(let n of i)p.plain(` \u2022 ${n}`)}}var Am={meta:{name:"executors",description:`List executors or show executor details
|
|
327
|
+
|
|
328
|
+
Examples:
|
|
329
|
+
diffray executors # List all executors
|
|
330
|
+
diffray executors claude-cli # Show claude-cli executor details
|
|
331
|
+
diffray executors cerebras-api # Show cerebras-api executor details`},args:{name:{type:"positional",description:"Executor name (optional, shows details if provided)",required:!1}},run:async({args:t})=>{t.name?await Sm(t.name):await vm()}};Zs();Q();function iv(t){switch(t){case"defaults":return"\u25C6";case"user":return"\u25C7";case"project":return"\u25CF";default:return"\u25CB"}}async function xm(){let t=await jt();if(t.length===0){p.warn("No rules configured");return}p.robot("Rules"),p.newline();for(let e of t){let s=iv(e.source),i=di(e.path);p.plain(`${s} ${e.name}`),p.plain(` agent: ${e.agent}`),p.plain(` patterns: ${e.patterns.join(", ")}`),p.plain(` path: ${i}`),p.newline()}p.plain("\u25C6 defaults \u25C7 user \u25CF project")}async function _m(t){let{loadRuleFromRef:e}=await Promise.resolve().then(()=>(Zs(),bp)),i=(await jt()).find(r=>r.name===t);i||(p.error(`Rule not found: ${t}`),process.exit(1));let n=await e(i);n||(p.error(`Failed to load rule content from: ${i.path}`),process.exit(1)),p.robot(`Rule: ${n.name}`),p.newline(),p.plain(`Source: ${i.source}`),p.plain(`Path: ${i.path}`),p.plain(`Description: ${n.description}`),p.plain(`Patterns: ${n.patterns.join(", ")}`),p.plain(`Agent: ${n.agent}`),n.prompt&&(p.newline(),p.plain("Prompt:"),p.separator("\u2500"),p.plain(n.prompt),p.separator("\u2500"))}async function Bm(t,e){let i=(await jt()).find(o=>o.name===t);i||(p.error(`Rule not found: ${t}`),process.exit(1)),p.robot(`Testing rule: ${i.name}`),p.plain(`Patterns: ${i.patterns.join(", ")}`),p.newline();let n=[],r=[];for(let o of e)i.patterns.some(u=>Hs(o,u))?n.push(o):r.push(o);p.success(`Matched ${n.length} file(s):`);for(let o of n)p.plain(` \u25CF ${o}`);if(r.length>0){p.newline(),p.plain(`Not matched ${r.length} file(s):`);for(let o of r)p.plain(` \u25CB ${o}`)}}var km={meta:{name:"rules",description:`List rules or show rule details
|
|
332
|
+
|
|
333
|
+
Examples:
|
|
334
|
+
diffray rules # List all rules
|
|
335
|
+
diffray rules code-security # Show rule details
|
|
336
|
+
diffray rules test code-security src/*.ts # Test rule pattern matching`},args:{name:{type:"positional",description:'Rule name or "test" subcommand',required:!1},rest:{type:"positional",description:"For test: <rule-name> <files...>",required:!1}},run:async({args:t})=>{if(t.name==="test"){let e=t._||[],s=e[0],i=e.slice(1);(!s||i.length===0)&&(console.error("Usage: diffray rules test <rule-name> <files...>"),process.exit(1)),await Bm(s,i)}else t.name?await _m(t.name):await xm()}};function nv(t){switch(t){case"modified":return"~";case"added":return"+";case"deleted":return"-";case"renamed":return"\u2192";default:return"\xB7"}}async function rv(t){let{verbose:e=!1,json:s=!1,stream:i=!1,severity:n,base:r,head:o,skipValidation:a=!1,agent:u,excludeAgent:l,rule:c,excludeRule:f,executor:h}=t,d=u?u.split(",").map(R=>R.trim()):void 0,g=l?l.split(",").map(R=>R.trim()):void 0,D=c?c.split(",").map(R=>R.trim()):void 0,m=f?f.split(",").map(R=>R.trim()):void 0,y=n?n.split(",").map(R=>R.trim()):void 0;s||p.logo();let F=process.cwd(),C=await ve(F);await Uc()||(s||p.error("Not a git repository"),process.exit(1)),s||p.chart("Analyzing changes...");let w,A="",$=null;if(r){let R=o||"HEAD";if(s||p.info(`Comparing ${r}...${R}`),await Mc())s||(p.warn("Uncommitted changes detected - cannot checkout to head ref"),p.info("CLI tools will only see diff context, not full files"));else{let G=await Lc(R);G.checkoutNeeded&&($=G.originalRef,s||p.info(`Checked out to ${R} for full file access`))}if(w=await Gc(r,R),A=` (${r}...${R})`,w.length===0){p.success("No changes between commits"),$&&await Di($);return}}else if(w=await Wc(),w.length===0&&(s||p.info("No uncommitted changes, reviewing last commit..."),w=await zc(),A=" (last commit)",w.length===0)){p.success("No changes to review");return}let b=w.filter(R=>!C.excludePatterns.some(G=>Hs(R.file,G)));if(b.length===0){p.success("No changes (all excluded)"),$&&await Di($);return}let O=b.reduce((R,G)=>R+G.additions,0),Y=b.reduce((R,G)=>R+G.deletions,0),ce=O+Y,z=b.reduce((R,G)=>(R[G.status]=(R[G.status]||0)+1,R),{});if(!s){let R=[];if(z.modified&&R.push(`${z.modified} modified`),z.added&&R.push(`${z.added} added`),z.deleted&&R.push(`${z.deleted} deleted`),z.renamed&&R.push(`${z.renamed} renamed`),p.file(`${b.length} files${A}: ${R.join(", ")}`),p.plain(` ${ce} changes: +${O} -${Y}`),e||b.length<=5){p.newline();for(let xe of b){let ri=nv(xe.status);p.plain(` ${ri} ${xe.file}: +${xe.additions} -${xe.deletions}`)}}p.newline(),p.robot("Loading executors and Agents...")}let mt=await Cn(),vo=mt.filter(R=>R.enabled);s||p.success(`Loaded ${vo.length} executor(s)`);let wn=await pt({projectPath:F,executorOverride:h});h&&!s&&p.info(`Using executor: ${h}`),s||(d&&p.info(`Agent filter: ${d.join(", ")}`),g&&p.info(`Excluding agents: ${g.join(", ")}`),D&&p.info(`Rule filter: ${D.join(", ")}`),m&&p.info(`Excluding rules: ${m.join(", ")}`));let ni=wn.filter(R=>R.enabled);s||(p.success(`Loaded ${ni.length} Agent(s)`),p.newline());let Ge=await new bo(wn,mt).execute(b,{verbose:e,quiet:s,concurrency:C.concurrency,skipValidation:a,stream:i,baseRef:r,headRef:o,agentFilter:d,excludeAgents:g,ruleFilter:D,excludeRules:m}),Wl=Ge.context.results.flatMap(R=>R.issues),gs=Wl;if(y&&y.length>0&&(gs=Wl.filter(R=>y.includes(R.severity))),s){let R=Ge.context.results.filter(xe=>xe.success).length,G=Pp(gs,Ge.success,Ge.totalDuration,Ge.context.results.length,R,b.length);console.log(G)}else{p.separator(),Ge.success?p.success(`Pipeline completed successfully in ${Ge.totalDuration}ms`):p.warn(`Pipeline completed with errors in ${Ge.totalDuration}ms`);let R=Ge.context.results.filter(G=>G.success).length;if(p.chart(`${R}/${Ge.context.results.length} agents succeeded`),y&&y.length>0){let G=y.join(", ");p.info(`Filtering by severity: ${G}`)}if(gs.length>0){let G=gs.reduce((ri,Vl)=>(ri[Vl.severity]=(ri[Vl.severity]||0)+1,ri),{}),xe=[];G.critical&&xe.push(`${G.critical} critical`),G.high&&xe.push(`${G.high} high`),G.medium&&xe.push(`${G.medium} medium`),G.low&&xe.push(`${G.low} low`),p.chart(`${gs.length} issue(s): ${xe.join(", ")}`),p.newline(),console.log(Rp(gs))}else if(p.newline(),y&&y.length>0){let G=y.join(", ");p.success(`No ${G} issues found \u{1F389}`)}else p.success("No issues found \u{1F389}");p.newline()}$&&(await Di($),s||p.info(`Restored to ${$}`))}var ov={meta:{name:"review",description:`Run code review on current changes
|
|
337
|
+
|
|
338
|
+
Examples:
|
|
339
|
+
diffray review Review uncommitted changes
|
|
340
|
+
diffray review --base main Compare current branch to main
|
|
341
|
+
diffray review --agent general Run only general agent
|
|
342
|
+
diffray review --exclude-agent security-scan Exclude specific agent
|
|
343
|
+
diffray review --rule code-security Run only specific rule
|
|
344
|
+
diffray review --exclude-rule code-bugs Exclude specific rule
|
|
345
|
+
diffray review --severity critical,high
|
|
346
|
+
diffray review --executor cursor-agent-cli Use specific executor
|
|
347
|
+
diffray review --stream Show thinking and tool usage`},args:{stream:{type:"boolean",description:"Show streaming output (thinking, tools, preliminary issues)"},verbose:{type:"boolean",description:"Show raw JSON stream"},json:{type:"boolean",description:"Output results in JSON format"},severity:{type:"string",description:"Filter issues by severity (comma-separated: critical,high,medium,low)"},base:{type:"string",description:"Base commit/branch to compare from (e.g., main, HEAD~3)"},head:{type:"string",description:"Head commit/branch to compare to (default: HEAD)"},"skip-validation":{type:"boolean",description:"Skip validation stage (show all issues without filtering)"},agent:{type:"string",description:"Run only specific agents (comma-separated: bug-hunter,security-scan)"},"exclude-agent":{type:"string",description:"Exclude specific agents (comma-separated)"},rule:{type:"string",description:"Run only specific rules (comma-separated: code-security,code-bugs)"},"exclude-rule":{type:"string",description:"Exclude specific rules (comma-separated)"},executor:{type:"string",description:"Override executor for all agents (e.g., cursor-agent-cli, claude-cli)"}},run:async({args:t})=>{await rv({...t,skipValidation:t["skip-validation"],excludeAgent:t["exclude-agent"],excludeRule:t["exclude-rule"]})}},Tm={meta:{name:"diffray",version:Nn.version,description:"AI-powered code review CLI"},subCommands:{review:ov,config:Fm,agents:bm,executors:Am,rules:km}};Q();var wo=process.argv.slice(2),av=["-v","--version","-h","--help"],uv=wo.length===0||wo.some(t=>av.includes(t));uv&&(p.logo(),(wo.includes("-v")||wo.includes("--version"))&&(p.plain(`v${Nn.version}`),process.exit(0)));Tc(Tm);
|