@hanzlaa/rcode 4.10.6 → 4.11.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.
Files changed (52) hide show
  1. package/AGENTS.md +1 -1
  2. package/CLAUDE.md +1 -1
  3. package/CONTRIBUTING.md +3 -0
  4. package/cli/install.js +160 -0
  5. package/dist/rcode.js +254 -234
  6. package/package.json +1 -1
  7. package/rcode/agents/rcode-project-researcher.md +1 -1
  8. package/rcode/agents/rcode-ux-designer.md +1 -0
  9. package/rcode/agents/rcode-verifier.md +2 -2
  10. package/rcode/agents/rules/planner/common-patterns.md +2 -1
  11. package/rcode/agents/rules/planner/goal-backward-thinking.md +33 -0
  12. package/rcode/agents/rules/planner/sprint-verification.md +1 -0
  13. package/rcode/agents/rules/planner/task-templates.md +20 -1
  14. package/rcode/agents/rules/project-researcher/detailed-guide.md +10 -0
  15. package/rcode/agents/rules/sprint-checker/dimensions.md +74 -0
  16. package/rcode/agents/rules/sprint-checker/process.md +12 -0
  17. package/rcode/agents/rules/verifier/behavioral-spot-checks.md +5 -1
  18. package/rcode/agents/rules/verifier/gap-output.md +5 -0
  19. package/rcode/agents/rules/verifier/reachability-check.md +69 -0
  20. package/rcode/bin/rcode-tools.cjs +39 -3
  21. package/rcode/commands/ui-phase.md +1 -1
  22. package/rcode/references/design-library/LICENSE +21 -0
  23. package/rcode/references/design-library/README.md +37 -0
  24. package/rcode/references/design-library/charts.csv +26 -0
  25. package/rcode/references/design-library/colors.csv +97 -0
  26. package/rcode/references/design-library/icons.csv +101 -0
  27. package/rcode/references/design-library/styles.csv +68 -0
  28. package/rcode/references/design-library/typography.csv +58 -0
  29. package/rcode/references/design-library/ui-reasoning.csv +101 -0
  30. package/rcode/references/design-library/ux-guidelines.csv +100 -0
  31. package/rcode/references/design-library/web-interface.csv +31 -0
  32. package/rcode/references/domain-probes.md +8 -0
  33. package/rcode/references/project-types.yaml +29 -0
  34. package/rcode/references/questioning.md +3 -0
  35. package/rcode/references/roadmapper-playbook.md +90 -0
  36. package/rcode/references/sprint-checker-playbook.md +14 -0
  37. package/rcode/references/verifier-playbook.md +20 -7
  38. package/rcode/workflows/autonomous.md +26 -3
  39. package/rcode/workflows/complete-milestone.md +1 -1
  40. package/rcode/workflows/council.md +51 -6
  41. package/rcode/workflows/discuss-phase.md +9 -2
  42. package/rcode/workflows/execute-sprint.md +35 -7
  43. package/rcode/workflows/execute-waves.md +2 -2
  44. package/rcode/workflows/execute.md +21 -6
  45. package/rcode/workflows/help.md +1 -1
  46. package/rcode/workflows/plan-research-validation.md +1 -1
  47. package/rcode/workflows/plan.md +31 -0
  48. package/rcode/workflows/ship.md +22 -0
  49. package/rcode/workflows/ui-phase.md +104 -22
  50. package/rcode/workflows/ui-review.md +9 -1
  51. package/rcode/workflows/verify-work.md +1 -1
  52. package/server/lib/scanner.js +25 -4
package/dist/rcode.js CHANGED
@@ -1,126 +1,126 @@
1
1
  #!/usr/bin/env node
2
2
  /* rcode — built with esbuild. Source: github.com/hanzlahabib/rihal-code */
3
- var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Kt=v((UF,Oc)=>{var gy=require("crypto"),it=require("fs"),fn=require("path");function Pc(t,e,r={}){let{encoding:n="utf8",mode:s}=r,i=fn.dirname(t);it.mkdirSync(i,{recursive:!0});let o=fn.join(i,`.${fn.basename(t)}.tmp-${process.pid}-${gy.randomBytes(8).toString("hex")}`),a;try{a=it.openSync(o,"wx",s??420),it.writeSync(a,e,0,n),it.fsyncSync(a),it.closeSync(a),a=null,it.renameSync(o,t)}catch(u){if(a!=null)try{it.closeSync(a)}catch{}try{it.unlinkSync(o)}catch{}throw u}}function Dy(t,e,r={}){let n=JSON.stringify(e,null,2)+`
4
- `;Pc(t,n,r)}function yy(t,e){let r;try{r=it.lstatSync(t)}catch(o){return o.code==="ENOENT"?{ok:!0,reason:"missing"}:{ok:!1,reason:`lstat: ${o.message}`}}if(r.isSymbolicLink())try{return it.unlinkSync(t),{ok:!0,reason:"symlink-unlinked"}}catch(o){return{ok:!1,reason:`unlink: ${o.message}`}}let n;try{n=it.realpathSync(e)}catch{n=fn.resolve(e)}let s;try{s=it.realpathSync(t)}catch(o){return{ok:!1,reason:`realpath: ${o.message}`}}let i=fn.relative(n,s);if(i.startsWith("..")||fn.isAbsolute(i))return{ok:!1,reason:"outside-root"};try{return it.rmSync(s,{recursive:!0,force:!0}),{ok:!0}}catch(o){return{ok:!1,reason:`rmSync: ${o.message}`}}}Oc.exports={writeFileAtomic:Pc,writeJsonAtomic:Dy,safeRmSync:yy}});var dr=v((VF,Nc)=>{"use strict";var vy=require("os");function _y(){return process.env.HOME||vy.homedir()}Nc.exports={homedir:_y}});var Pn=v((GF,ti)=>{var Cs=process||{},Lc=Cs.argv||[],Es=Cs.env||{},by=!(Es.NO_COLOR||Lc.includes("--no-color"))&&(!!Es.FORCE_COLOR||Lc.includes("--color")||Cs.platform==="win32"||(Cs.stdout||{}).isTTY&&Es.TERM!=="dumb"||!!Es.CI),Sy=(t,e,r=t)=>n=>{let s=""+n,i=s.indexOf(e,t.length);return~i?t+Ey(s,e,r,i)+e:t+s+e},Ey=(t,e,r,n)=>{let s="",i=0;do s+=t.substring(i,n)+r,i=n+e.length,n=t.indexOf(e,i);while(~n);return s+t.substring(i)},Bc=(t=by)=>{let e=t?Sy:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};ti.exports=Bc();ti.exports.createColors=Bc});var Wc=v(fr=>{"use strict";var Mc=fr&&fr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(fr,"__esModule",{value:!0});fr.symbols=fr.isTTY=void 0;var Cy=Mc(require("node:tty")),Lt=Mc(require("node:process")),wy=Lt.default.env.CI||Lt.default.env.WT_SESSION||Lt.default.env.ConEmuTask==="{cmd::Cmder}"||Lt.default.env.TERM_PROGRAM==="vscode"||Lt.default.env.TERM==="xterm-256color"||Lt.default.env.TERM==="alacritty",qc=Cy.default.isatty(1)&&Lt.default.env.TERM!=="dumb"&&!("CI"in Lt.default.env);fr.isTTY=qc;var On=Lt.default.platform!=="win32"?Lt.default.env.TERM!=="linux":wy,xy={frames:qc?On?["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]:["-","\\","|","/"]:["-"],tick:On?"\u2714":"\u221A",cross:On?"\u2716":"\xD7",warn:On?"\u26A0":"!!",info:On?"\u2139":"i"};fr.symbols=xy});var Zc=v(Nn=>{"use strict";var ky=Nn&&Nn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Nn,"__esModule",{value:!0});Nn.createSpinner=Ay;var Hc=ky(Pn()),Bt=Wc();function $y(t="",e=80){return t.replace(/\u001b[^m]*?m/g,"").split(`
5
- `).reduce((r,n)=>r+=Math.max(1,Math.ceil(n.length/e)),0)}function Ay(t="",e={}){let r=0,n=e.interval||50,s=e.stream||process.stderr,i=e.frames&&e.frames.length?e.frames:Bt.symbols.frames,o=e.color||"yellow",a=!1,u=0,c,l=(C={})=>typeof C=="string"?C:C.text||t,d=(C={})=>typeof C=="string"?!1:!!C.update,f=(C={})=>typeof C=="string"||!C.color?o:C.color,g=(C={},A)=>typeof C=="string"||!C.mark?A:C.mark,m=()=>{process.on("SIGINT",w),process.on("SIGTERM",w)},y=()=>{process.off("SIGINT",w),process.off("SIGTERM",w)},h={reset(){return r=0,u=0,a=!1,clearTimeout(c),c=void 0,h},clear(){h.write("\x1B[1G");for(let C=0;C<u;C++)C>0&&h.write("\x1B[1A"),h.write("\x1B[2K\x1B[1G");return u=0,h},write(C,A=!1){return A&&Bt.isTTY&&h.clear(),s.write(C),h},render(){let C=`${Hc.default[o](i[r])} ${t}`;return Bt.isTTY?h.write("\x1B[?25l"):C+=`
6
- `,h.write(C,!0),Bt.isTTY&&(u=$y(C,s.columns)),h},spin(){return h.render(),r=++r%i.length,h},update(C){return typeof C=="string"?t=C:(t=C.text||t,i=C.frames&&C.frames.length?C.frames:i,n=C.interval||n,o=C.color||o),i.length-1<r&&(r=0),h},loop(){return Bt.isTTY&&(c=setTimeout(()=>h.loop(),n)),h.spin()},start(C={}){return c&&h.reset(),a=!0,m(),h.update({text:l(C),color:f(C)}).loop()},stop(C){a=!1,clearTimeout(c),c=void 0,y();let A=d(C),T=Hc.default[f(C)](g(C,i[r])),V=l(C);return h.write(C?`${T} ${V}${A?"":`
7
- `}`:"",!0),Bt.isTTY&&!A?h.write("\x1B[?25h"):h},success(C={}){return h.stop({text:l(C),mark:g(C,Bt.symbols.tick),color:"green",update:d(C)})},error(C={}){return h.stop({text:l(C),mark:g(C,Bt.symbols.cross),color:"red",update:d(C)})},warn(C={}){return h.stop({text:l(C),mark:g(C,Bt.symbols.warn),color:"yellow",update:d(C)})},info(C={}){return h.stop({text:l(C),mark:g(C,Bt.symbols.info),color:"blue",update:d(C)})},isSpinning(){return a}};function w(C){a&&h.stop(),process.exit(C==="SIGINT"?130:C==="SIGTERM"?143:1)}return h}});var Uc=v(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.splitWhen=hn.flatten=void 0;function Fy(t){return t.reduce((e,r)=>[].concat(e,r),[])}hn.flatten=Fy;function jy(t,e){let r=[[]],n=0;for(let s of t)e(s)?(n++,r[n]=[]):r[n].push(s);return r}hn.splitWhen=jy});var Vc=v(ws=>{"use strict";Object.defineProperty(ws,"__esModule",{value:!0});ws.isEnoentCodeError=void 0;function Iy(t){return t.code==="ENOENT"}ws.isEnoentCodeError=Iy});var Gc=v(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.createDirentFromStats=void 0;var ri=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function Ty(t,e){return new ri(t,e)}xs.createDirentFromStats=Ty});var Xc=v(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.convertPosixPathToPattern=je.convertWindowsPathToPattern=je.convertPathToPattern=je.escapePosixPath=je.escapeWindowsPath=je.escape=je.removeLeadingDotSegment=je.makeAbsolute=je.unixify=void 0;var Ry=require("os"),Py=require("path"),zc=Ry.platform()==="win32",Oy=2,Ny=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g,Ly=/(\\?)([()[\]{}]|^!|[!+@](?=\())/g,By=/^\\\\([.?])/,My=/\\(?![!()+@[\]{}])/g;function qy(t){return t.replace(/\\/g,"/")}je.unixify=qy;function Wy(t,e){return Py.resolve(t,e)}je.makeAbsolute=Wy;function Hy(t){if(t.charAt(0)==="."){let e=t.charAt(1);if(e==="/"||e==="\\")return t.slice(Oy)}return t}je.removeLeadingDotSegment=Hy;je.escape=zc?ni:si;function ni(t){return t.replace(Ly,"\\$2")}je.escapeWindowsPath=ni;function si(t){return t.replace(Ny,"\\$2")}je.escapePosixPath=si;je.convertPathToPattern=zc?Yc:Jc;function Yc(t){return ni(t).replace(By,"//$1").replace(My,"/")}je.convertWindowsPathToPattern=Yc;function Jc(t){return si(t)}je.convertPosixPathToPattern=Jc});var Qc=v((ej,Kc)=>{Kc.exports=function(e){if(typeof e!="string"||e==="")return!1;for(var r;r=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(r[2])return!0;e=e.slice(r.index+r[0].length)}return!1}});var rl=v((tj,tl)=>{var Zy=Qc(),el={"{":"}","(":")","[":"]"},Uy=function(t){if(t[0]==="!")return!0;for(var e=0,r=-2,n=-2,s=-2,i=-2,o=-2;e<t.length;){if(t[e]==="*"||t[e+1]==="?"&&/[\].+)]/.test(t[e])||n!==-1&&t[e]==="["&&t[e+1]!=="]"&&(n<e&&(n=t.indexOf("]",e)),n>e&&(o===-1||o>n||(o=t.indexOf("\\",e),o===-1||o>n)))||s!==-1&&t[e]==="{"&&t[e+1]!=="}"&&(s=t.indexOf("}",e),s>e&&(o=t.indexOf("\\",e),o===-1||o>s))||i!==-1&&t[e]==="("&&t[e+1]==="?"&&/[:!=]/.test(t[e+2])&&t[e+3]!==")"&&(i=t.indexOf(")",e),i>e&&(o=t.indexOf("\\",e),o===-1||o>i))||r!==-1&&t[e]==="("&&t[e+1]!=="|"&&(r<e&&(r=t.indexOf("|",e)),r!==-1&&t[r+1]!==")"&&(i=t.indexOf(")",r),i>r&&(o=t.indexOf("\\",r),o===-1||o>i))))return!0;if(t[e]==="\\"){var a=t[e+1];e+=2;var u=el[a];if(u){var c=t.indexOf(u,e);c!==-1&&(e=c+1)}if(t[e]==="!")return!0}else e++}return!1},Vy=function(t){if(t[0]==="!")return!0;for(var e=0;e<t.length;){if(/[*?{}()[\]]/.test(t[e]))return!0;if(t[e]==="\\"){var r=t[e+1];e+=2;var n=el[r];if(n){var s=t.indexOf(n,e);s!==-1&&(e=s+1)}if(t[e]==="!")return!0}else e++}return!1};tl.exports=function(e,r){if(typeof e!="string"||e==="")return!1;if(Zy(e))return!0;var n=Uy;return r&&r.strict===!1&&(n=Vy),n(e)}});var sl=v((rj,nl)=>{"use strict";var Gy=rl(),zy=require("path").posix.dirname,Yy=require("os").platform()==="win32",oi="/",Jy=/\\/g,Xy=/[\{\[].*[\}\]]$/,Ky=/(^|[^\\])([\{\[]|\([^\)]+$)/,Qy=/\\([\!\*\?\|\[\]\(\)\{\}])/g;nl.exports=function(e,r){var n=Object.assign({flipBackslashes:!0},r);n.flipBackslashes&&Yy&&e.indexOf(oi)<0&&(e=e.replace(Jy,oi)),Xy.test(e)&&(e+=oi),e+="a";do e=zy(e);while(Gy(e)||Ky.test(e));return e.replace(Qy,"$1")}});var ks=v(ft=>{"use strict";ft.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;ft.find=(t,e)=>t.nodes.find(r=>r.type===e);ft.exceedsLimit=(t,e,r=1,n)=>n===!1||!ft.isInteger(t)||!ft.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;ft.escapeNode=(t,e=0,r)=>{let n=t.nodes[e];n&&(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};ft.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;ft.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;ft.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;ft.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);ft.flatten=(...t)=>{let e=[],r=n=>{for(let s=0;s<n.length;s++){let i=n[s];if(Array.isArray(i)){r(i);continue}i!==void 0&&e.push(i)}return e};return r(t),e}});var $s=v((sj,il)=>{"use strict";var ol=ks();il.exports=(t,e={})=>{let r=(n,s={})=>{let i=e.escapeInvalid&&ol.isInvalidBrace(s),o=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(i||o)&&ol.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let u of n.nodes)a+=r(u);return a};return r(t)}});var ul=v((oj,al)=>{"use strict";al.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var Dl=v((ij,gl)=>{"use strict";var cl=ul(),Pr=(t,e,r)=>{if(cl(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(cl(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...r};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let s=String(n.relaxZeros),i=String(n.shorthand),o=String(n.capture),a=String(n.wrap),u=t+":"+e+"="+s+i+o+a;if(Pr.cache.hasOwnProperty(u))return Pr.cache[u].result;let c=Math.min(t,e),l=Math.max(t,e);if(Math.abs(c-l)===1){let y=t+"|"+e;return n.capture?`(${y})`:n.wrap===!1?y:`(?:${y})`}let d=ml(t)||ml(e),f={min:t,max:e,a:c,b:l},g=[],m=[];if(d&&(f.isPadded=d,f.maxLen=String(f.max).length),c<0){let y=l<0?Math.abs(l):1;m=ll(y,Math.abs(c),f,n),c=f.a=0}return l>=0&&(g=ll(c,l,f,n)),f.negatives=m,f.positives=g,f.result=ev(m,g,n),n.capture===!0?f.result=`(${f.result})`:n.wrap!==!1&&g.length+m.length>1&&(f.result=`(?:${f.result})`),Pr.cache[u]=f,f.result};function ev(t,e,r){let n=ii(t,e,"-",!1,r)||[],s=ii(e,t,"",!1,r)||[],i=ii(t,e,"-?",!0,r)||[];return n.concat(i).concat(s).join("|")}function tv(t,e){let r=1,n=1,s=fl(t,r),i=new Set([e]);for(;t<=s&&s<=e;)i.add(s),r+=1,s=fl(t,r);for(s=hl(e+1,n)-1;t<s&&s<=e;)i.add(s),n+=1,s=hl(e+1,n)-1;return i=[...i],i.sort(sv),i}function rv(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=nv(t,e),s=n.length,i="",o=0;for(let a=0;a<s;a++){let[u,c]=n[a];u===c?i+=u:u!=="0"||c!=="9"?i+=ov(u,c,r):o++}return o&&(i+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:i,count:[o],digits:s}}function ll(t,e,r,n){let s=tv(t,e),i=[],o=t,a;for(let u=0;u<s.length;u++){let c=s[u],l=rv(String(o),String(c),n),d="";if(!r.isPadded&&a&&a.pattern===l.pattern){a.count.length>1&&a.count.pop(),a.count.push(l.count[0]),a.string=a.pattern+pl(a.count),o=c+1;continue}r.isPadded&&(d=iv(c,r,n)),l.string=d+l.pattern+pl(l.count),i.push(l),o=c+1,a=l}return i}function ii(t,e,r,n,s){let i=[];for(let o of t){let{string:a}=o;!n&&!dl(e,"string",a)&&i.push(r+a),n&&dl(e,"string",a)&&i.push(r+a)}return i}function nv(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function sv(t,e){return t>e?1:e>t?-1:0}function dl(t,e,r){return t.some(n=>n[e]===r)}function fl(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function hl(t,e){return t-t%Math.pow(10,e)}function pl(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function ov(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function ml(t){return/^-?(0+)\d/.test(t)}function iv(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),s=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return s?"0?":"0";case 2:return s?"0{0,2}":"00";default:return s?`0{0,${n}}`:`0{${n}}`}}Pr.cache={};Pr.clearCache=()=>Pr.cache={};gl.exports=Pr});var ci=v((aj,Cl)=>{"use strict";var av=require("util"),vl=Dl(),yl=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),uv=t=>e=>t===!0?Number(e):String(e),ai=t=>typeof t=="number"||typeof t=="string"&&t!=="",Ln=t=>Number.isInteger(+t),ui=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},cv=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,lv=(t,e,r)=>{if(e>0){let n=t[0]==="-"?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return r===!1?String(t):t},Fs=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},dv=(t,e,r)=>{t.negatives.sort((a,u)=>a<u?-1:a>u?1:0),t.positives.sort((a,u)=>a<u?-1:a>u?1:0);let n=e.capture?"":"?:",s="",i="",o;return t.positives.length&&(s=t.positives.map(a=>Fs(String(a),r)).join("|")),t.negatives.length&&(i=`-(${n}${t.negatives.map(a=>Fs(String(a),r)).join("|")})`),s&&i?o=`${s}|${i}`:o=s||i,e.wrap?`(${n}${o})`:o},_l=(t,e,r,n)=>{if(r)return vl(t,e,{wrap:!1,...n});let s=String.fromCharCode(t);if(t===e)return s;let i=String.fromCharCode(e);return`[${s}-${i}]`},bl=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,s=r.capture?"":"?:";return n?`(${s}${t.join("|")})`:t.join("|")}return vl(t,e,r)},Sl=(...t)=>new RangeError("Invalid range arguments: "+av.inspect(...t)),El=(t,e,r)=>{if(r.strictRanges===!0)throw Sl([t,e]);return[]},fv=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},hv=(t,e,r=1,n={})=>{let s=Number(t),i=Number(e);if(!Number.isInteger(s)||!Number.isInteger(i)){if(n.strictRanges===!0)throw Sl([t,e]);return[]}s===0&&(s=0),i===0&&(i=0);let o=s>i,a=String(t),u=String(e),c=String(r);r=Math.max(Math.abs(r),1);let l=ui(a)||ui(u)||ui(c),d=l?Math.max(a.length,u.length,c.length):0,f=l===!1&&cv(t,e,n)===!1,g=n.transform||uv(f);if(n.toRegex&&r===1)return _l(Fs(t,d),Fs(e,d),!0,n);let m={negatives:[],positives:[]},y=C=>m[C<0?"negatives":"positives"].push(Math.abs(C)),h=[],w=0;for(;o?s>=i:s<=i;)n.toRegex===!0&&r>1?y(s):h.push(lv(g(s,w),d,f)),s=o?s-r:s+r,w++;return n.toRegex===!0?r>1?dv(m,n,d):bl(h,null,{wrap:!1,...n}):h},pv=(t,e,r=1,n={})=>{if(!Ln(t)&&t.length>1||!Ln(e)&&e.length>1)return El(t,e,n);let s=n.transform||(f=>String.fromCharCode(f)),i=`${t}`.charCodeAt(0),o=`${e}`.charCodeAt(0),a=i>o,u=Math.min(i,o),c=Math.max(i,o);if(n.toRegex&&r===1)return _l(u,c,!1,n);let l=[],d=0;for(;a?i>=o:i<=o;)l.push(s(i,d)),i=a?i-r:i+r,d++;return n.toRegex===!0?bl(l,null,{wrap:!1,options:n}):l},As=(t,e,r,n={})=>{if(e==null&&ai(t))return[t];if(!ai(t)||!ai(e))return El(t,e,n);if(typeof r=="function")return As(t,e,1,{transform:r});if(yl(r))return As(t,e,0,r);let s={...n};return s.capture===!0&&(s.wrap=!0),r=r||s.step||1,Ln(r)?Ln(t)&&Ln(e)?hv(t,e,r,s):pv(t,e,Math.max(Math.abs(r),1),s):r!=null&&!yl(r)?fv(r,s):As(t,e,1,r)};Cl.exports=As});var kl=v((uj,xl)=>{"use strict";var mv=ci(),wl=ks(),gv=(t,e={})=>{let r=(n,s={})=>{let i=wl.isInvalidBrace(s),o=n.invalid===!0&&e.escapeInvalid===!0,a=i===!0||o===!0,u=e.escapeInvalid===!0?"\\":"",c="";if(n.isOpen===!0)return u+n.value;if(n.isClose===!0)return console.log("node.isClose",u,n.value),u+n.value;if(n.type==="open")return a?u+n.value:"(";if(n.type==="close")return a?u+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let l=wl.reduce(n.nodes),d=mv(...l,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(d.length!==0)return l.length>1&&d.length>1?`(${d})`:d}if(n.nodes)for(let l of n.nodes)c+=r(l,n);return c};return r(t)};xl.exports=gv});var Fl=v((cj,Al)=>{"use strict";var Dv=ci(),$l=$s(),pn=ks(),Or=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?pn.flatten(e).map(s=>`{${s}}`):e;for(let s of t)if(Array.isArray(s))for(let i of s)n.push(Or(i,e,r));else for(let i of e)r===!0&&typeof i=="string"&&(i=`{${i}}`),n.push(Array.isArray(i)?Or(s,i,r):s+i);return pn.flatten(n)},yv=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(s,i={})=>{s.queue=[];let o=i,a=i.queue;for(;o.type!=="brace"&&o.type!=="root"&&o.parent;)o=o.parent,a=o.queue;if(s.invalid||s.dollar){a.push(Or(a.pop(),$l(s,e)));return}if(s.type==="brace"&&s.invalid!==!0&&s.nodes.length===2){a.push(Or(a.pop(),["{}"]));return}if(s.nodes&&s.ranges>0){let d=pn.reduce(s.nodes);if(pn.exceedsLimit(...d,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let f=Dv(...d,e);f.length===0&&(f=$l(s,e)),a.push(Or(a.pop(),f)),s.nodes=[];return}let u=pn.encloseBrace(s),c=s.queue,l=s;for(;l.type!=="brace"&&l.type!=="root"&&l.parent;)l=l.parent,c=l.queue;for(let d=0;d<s.nodes.length;d++){let f=s.nodes[d];if(f.type==="comma"&&s.type==="brace"){d===1&&c.push(""),c.push("");continue}if(f.type==="close"){a.push(Or(a.pop(),c,u));continue}if(f.value&&f.type!=="open"){c.push(Or(c.pop(),f.value));continue}f.nodes&&n(f,s)}return c};return pn.flatten(n(t))};Al.exports=yv});var Il=v((lj,jl)=>{"use strict";jl.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
8
- `,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var Nl=v((dj,Ol)=>{"use strict";var vv=$s(),{MAX_LENGTH:Tl,CHAR_BACKSLASH:li,CHAR_BACKTICK:_v,CHAR_COMMA:bv,CHAR_DOT:Sv,CHAR_LEFT_PARENTHESES:Ev,CHAR_RIGHT_PARENTHESES:Cv,CHAR_LEFT_CURLY_BRACE:wv,CHAR_RIGHT_CURLY_BRACE:xv,CHAR_LEFT_SQUARE_BRACKET:Rl,CHAR_RIGHT_SQUARE_BRACKET:Pl,CHAR_DOUBLE_QUOTE:kv,CHAR_SINGLE_QUOTE:$v,CHAR_NO_BREAK_SPACE:Av,CHAR_ZERO_WIDTH_NOBREAK_SPACE:Fv}=Il(),jv=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(Tl,r.maxLength):Tl;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let s={type:"root",input:t,nodes:[]},i=[s],o=s,a=s,u=0,c=t.length,l=0,d=0,f,g=()=>t[l++],m=y=>{if(y.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&y.type==="text"){a.value+=y.value;return}return o.nodes.push(y),y.parent=o,y.prev=a,a=y,y};for(m({type:"bos"});l<c;)if(o=i[i.length-1],f=g(),!(f===Fv||f===Av)){if(f===li){m({type:"text",value:(e.keepEscaping?f:"")+g()});continue}if(f===Pl){m({type:"text",value:"\\"+f});continue}if(f===Rl){u++;let y;for(;l<c&&(y=g());){if(f+=y,y===Rl){u++;continue}if(y===li){f+=g();continue}if(y===Pl&&(u--,u===0))break}m({type:"text",value:f});continue}if(f===Ev){o=m({type:"paren",nodes:[]}),i.push(o),m({type:"text",value:f});continue}if(f===Cv){if(o.type!=="paren"){m({type:"text",value:f});continue}o=i.pop(),m({type:"text",value:f}),o=i[i.length-1];continue}if(f===kv||f===$v||f===_v){let y=f,h;for(e.keepQuotes!==!0&&(f="");l<c&&(h=g());){if(h===li){f+=h+g();continue}if(h===y){e.keepQuotes===!0&&(f+=h);break}f+=h}m({type:"text",value:f});continue}if(f===wv){d++;let h={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||o.dollar===!0,depth:d,commas:0,ranges:0,nodes:[]};o=m(h),i.push(o),m({type:"open",value:f});continue}if(f===xv){if(o.type!=="brace"){m({type:"text",value:f});continue}let y="close";o=i.pop(),o.close=!0,m({type:y,value:f}),d--,o=i[i.length-1];continue}if(f===bv&&d>0){if(o.ranges>0){o.ranges=0;let y=o.nodes.shift();o.nodes=[y,{type:"text",value:vv(o)}]}m({type:"comma",value:f}),o.commas++;continue}if(f===Sv&&d>0&&o.commas===0){let y=o.nodes;if(d===0||y.length===0){m({type:"text",value:f});continue}if(a.type==="dot"){if(o.range=[],a.value+=f,a.type="range",o.nodes.length!==3&&o.nodes.length!==5){o.invalid=!0,o.ranges=0,a.type="text";continue}o.ranges++,o.args=[];continue}if(a.type==="range"){y.pop();let h=y[y.length-1];h.value+=a.value+f,a=h,o.ranges--;continue}m({type:"dot",value:f});continue}m({type:"text",value:f})}do if(o=i.pop(),o.type!=="root"){o.nodes.forEach(w=>{w.nodes||(w.type==="open"&&(w.isOpen=!0),w.type==="close"&&(w.isClose=!0),w.nodes||(w.type="text"),w.invalid=!0)});let y=i[i.length-1],h=y.nodes.indexOf(o);y.nodes.splice(h,1,...o.nodes)}while(i.length>0);return m({type:"eos"}),s};Ol.exports=jv});var Ml=v((fj,Bl)=>{"use strict";var Ll=$s(),Iv=kl(),Tv=Fl(),Rv=Nl(),at=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let s=at.create(n,e);Array.isArray(s)?r.push(...s):r.push(s)}else r=[].concat(at.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};at.parse=(t,e={})=>Rv(t,e);at.stringify=(t,e={})=>Ll(typeof t=="string"?at.parse(t,e):t,e);at.compile=(t,e={})=>(typeof t=="string"&&(t=at.parse(t,e)),Iv(t,e));at.expand=(t,e={})=>{typeof t=="string"&&(t=at.parse(t,e));let r=Tv(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};at.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?at.compile(t,e):at.expand(t,e);Bl.exports=at});var Bn=v((hj,Ul)=>{"use strict";var Pv=require("path"),Mt="\\\\/",ql=`[^${Mt}]`,Ov=0,Qt="\\.",Nv="\\+",Lv="\\?",js="\\/",Bv="(?=.)",Wl="[^/]",di=`(?:${js}|$)`,Hl=`(?:^|${js})`,fi=`${Qt}{1,2}${di}`,Mv=`(?!${Qt})`,qv=`(?!${Hl}${fi})`,Wv=`(?!${Qt}{0,1}${di})`,Hv=`(?!${fi})`,Zv=`[^.${js}]`,Uv=`${Wl}*?`,Zl={DOT_LITERAL:Qt,PLUS_LITERAL:Nv,QMARK_LITERAL:Lv,SLASH_LITERAL:js,ONE_CHAR:Bv,QMARK:Wl,END_ANCHOR:di,DOTS_SLASH:fi,NO_DOT:Mv,NO_DOTS:qv,NO_DOT_SLASH:Wv,NO_DOTS_SLASH:Hv,QMARK_NO_DOT:Zv,STAR:Uv,START_ANCHOR:Hl},Vv={...Zl,SLASH_LITERAL:`[${Mt}]`,QMARK:ql,STAR:`${ql}*?`,DOTS_SLASH:`${Qt}{1,2}(?:[${Mt}]|$)`,NO_DOT:`(?!${Qt})`,NO_DOTS:`(?!(?:^|[${Mt}])${Qt}{1,2}(?:[${Mt}]|$))`,NO_DOT_SLASH:`(?!${Qt}{0,1}(?:[${Mt}]|$))`,NO_DOTS_SLASH:`(?!${Qt}{1,2}(?:[${Mt}]|$))`,QMARK_NO_DOT:`[^.${Mt}]`,START_ANCHOR:`(?:^|[${Mt}])`,END_ANCHOR:`(?:[${Mt}]|$)`},Gv={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};Ul.exports={DEFAULT_MAX_EXTGLOB_RECURSION:Ov,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Gv,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:Pv.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?Vv:Zl}}});var Mn=v(Qe=>{"use strict";var zv=require("path"),Yv=process.platform==="win32",{REGEX_BACKSLASH:Jv,REGEX_REMOVE_BACKSLASH:Xv,REGEX_SPECIAL_CHARS:Kv,REGEX_SPECIAL_CHARS_GLOBAL:Qv}=Bn();Qe.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Qe.hasRegexChars=t=>Kv.test(t);Qe.isRegexChar=t=>t.length===1&&Qe.hasRegexChars(t);Qe.escapeRegex=t=>t.replace(Qv,"\\$1");Qe.toPosixSlashes=t=>t.replace(Jv,"/");Qe.removeBackslashes=t=>t.replace(Xv,e=>e==="\\"?"":e);Qe.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Qe.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:Yv===!0||zv.sep==="\\";Qe.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Qe.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Qe.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Qe.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",s=r.contains?"":"$",i=`${n}(?:${t})${s}`;return e.negated===!0&&(i=`(?:^(?!${i}).*$)`),i}});var Ql=v((mj,Kl)=>{"use strict";var Vl=Mn(),{CHAR_ASTERISK:hi,CHAR_AT:e0,CHAR_BACKWARD_SLASH:qn,CHAR_COMMA:t0,CHAR_DOT:pi,CHAR_EXCLAMATION_MARK:mi,CHAR_FORWARD_SLASH:Xl,CHAR_LEFT_CURLY_BRACE:gi,CHAR_LEFT_PARENTHESES:Di,CHAR_LEFT_SQUARE_BRACKET:r0,CHAR_PLUS:n0,CHAR_QUESTION_MARK:Gl,CHAR_RIGHT_CURLY_BRACE:s0,CHAR_RIGHT_PARENTHESES:zl,CHAR_RIGHT_SQUARE_BRACKET:o0}=Bn(),Yl=t=>t===Xl||t===qn,Jl=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},i0=(t,e)=>{let r=e||{},n=t.length-1,s=r.parts===!0||r.scanToEnd===!0,i=[],o=[],a=[],u=t,c=-1,l=0,d=0,f=!1,g=!1,m=!1,y=!1,h=!1,w=!1,C=!1,A=!1,T=!1,V=!1,I=0,H,F,q={value:"",depth:0,isGlob:!1},P=()=>c>=n,b=()=>u.charCodeAt(c+1),Q=()=>(H=F,u.charCodeAt(++c));for(;c<n;){F=Q();let he;if(F===qn){C=q.backslashes=!0,F=Q(),F===gi&&(w=!0);continue}if(w===!0||F===gi){for(I++;P()!==!0&&(F=Q());){if(F===qn){C=q.backslashes=!0,Q();continue}if(F===gi){I++;continue}if(w!==!0&&F===pi&&(F=Q())===pi){if(f=q.isBrace=!0,m=q.isGlob=!0,V=!0,s===!0)continue;break}if(w!==!0&&F===t0){if(f=q.isBrace=!0,m=q.isGlob=!0,V=!0,s===!0)continue;break}if(F===s0&&(I--,I===0)){w=!1,f=q.isBrace=!0,V=!0;break}}if(s===!0)continue;break}if(F===Xl){if(i.push(c),o.push(q),q={value:"",depth:0,isGlob:!1},V===!0)continue;if(H===pi&&c===l+1){l+=2;continue}d=c+1;continue}if(r.noext!==!0&&(F===n0||F===e0||F===hi||F===Gl||F===mi)===!0&&b()===Di){if(m=q.isGlob=!0,y=q.isExtglob=!0,V=!0,F===mi&&c===l&&(T=!0),s===!0){for(;P()!==!0&&(F=Q());){if(F===qn){C=q.backslashes=!0,F=Q();continue}if(F===zl){m=q.isGlob=!0,V=!0;break}}continue}break}if(F===hi){if(H===hi&&(h=q.isGlobstar=!0),m=q.isGlob=!0,V=!0,s===!0)continue;break}if(F===Gl){if(m=q.isGlob=!0,V=!0,s===!0)continue;break}if(F===r0){for(;P()!==!0&&(he=Q());){if(he===qn){C=q.backslashes=!0,Q();continue}if(he===o0){g=q.isBracket=!0,m=q.isGlob=!0,V=!0;break}}if(s===!0)continue;break}if(r.nonegate!==!0&&F===mi&&c===l){A=q.negated=!0,l++;continue}if(r.noparen!==!0&&F===Di){if(m=q.isGlob=!0,s===!0){for(;P()!==!0&&(F=Q());){if(F===Di){C=q.backslashes=!0,F=Q();continue}if(F===zl){V=!0;break}}continue}break}if(m===!0){if(V=!0,s===!0)continue;break}}r.noext===!0&&(y=!1,m=!1);let re=u,de="",x="";l>0&&(de=u.slice(0,l),u=u.slice(l),d-=l),re&&m===!0&&d>0?(re=u.slice(0,d),x=u.slice(d)):m===!0?(re="",x=u):re=u,re&&re!==""&&re!=="/"&&re!==u&&Yl(re.charCodeAt(re.length-1))&&(re=re.slice(0,-1)),r.unescape===!0&&(x&&(x=Vl.removeBackslashes(x)),re&&C===!0&&(re=Vl.removeBackslashes(re)));let k={prefix:de,input:t,start:l,base:re,glob:x,isBrace:f,isBracket:g,isGlob:m,isExtglob:y,isGlobstar:h,negated:A,negatedExtglob:T};if(r.tokens===!0&&(k.maxDepth=0,Yl(F)||o.push(q),k.tokens=o),r.parts===!0||r.tokens===!0){let he;for(let X=0;X<i.length;X++){let Ee=he?he+1:l,ot=i[X],Oe=t.slice(Ee,ot);r.tokens&&(X===0&&l!==0?(o[X].isPrefix=!0,o[X].value=de):o[X].value=Oe,Jl(o[X]),k.maxDepth+=o[X].depth),(X!==0||Oe!=="")&&a.push(Oe),he=ot}if(he&&he+1<t.length){let X=t.slice(he+1);a.push(X),r.tokens&&(o[o.length-1].value=X,Jl(o[o.length-1]),k.maxDepth+=o[o.length-1].depth)}k.slashes=i,k.parts=a}return k};Kl.exports=i0});var sd=v((gj,nd)=>{"use strict";var Wn=Bn(),Ne=Mn(),{MAX_LENGTH:Is,POSIX_REGEX_SOURCE:a0,REGEX_NON_SPECIAL_CHARS:u0,REGEX_SPECIAL_CHARS_BACKREF:c0,REPLACEMENTS:ed}=Wn,l0=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(s=>Ne.escapeRegex(s)).join("..")}return r},mn=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,td=t=>{let e=[],r=0,n=0,s=0,i="",o=!1;for(let a of t){if(o===!0){i+=a,o=!1;continue}if(a==="\\"){i+=a,o=!0;continue}if(a==='"'){s=s===1?0:1,i+=a;continue}if(s===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(i),i="";continue}}}i+=a}return e.push(i),e},d0=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},rd=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(d0(e))return e.replace(/\\(.)/g,"$1")},f0=t=>{let e=t.map(rd).filter(Boolean);for(let r=0;r<e.length;r++)for(let n=r+1;n<e.length;n++){let s=e[r],i=e[n],o=s[0];if(!(!o||s!==o.repeat(s.length)||i!==o.repeat(i.length))&&(s===i||s.startsWith(i)||i.startsWith(s)))return!0}return!1},yi=(t,e=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,s=0,i=!1;for(let o=1;o<t.length;o++){let a=t[o];if(i===!0){i=!1;continue}if(a==="\\"){i=!0;continue}if(a==='"'){s=s===1?0:1;continue}if(s!==1){if(a==="["){r++;continue}if(a==="]"&&r>0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&o!==t.length-1?void 0:{type:t[0],body:t.slice(2,o),end:o}}}}},h0=t=>{let e=0,r=[];for(;e<t.length;){let s=yi(t.slice(e),!1);if(!s||s.type!=="*")return;let i=td(s.body).map(a=>a.trim());if(i.length!==1)return;let o=rd(i[0]);if(!o||o.length!==1)return;r.push(o),e+=s.end+1}return r.length<1?void 0:`${r.length===1?Ne.escapeRegex(r[0]):`[${r.map(s=>Ne.escapeRegex(s)).join("")}]`}*`},p0=t=>{let e=0,r=t.trim(),n=yi(r);for(;n;)e++,r=n.body.trim(),n=yi(r);return e},m0=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Wn.DEFAULT_MAX_EXTGLOB_RECURSION,n=td(t).map(s=>s.trim());if(n.length>1&&(n.some(s=>s==="")||n.some(s=>/^[*?]+$/.test(s))||f0(n)))return{risky:!0};for(let s of n){let i=h0(s);if(i)return{risky:!0,safeOutput:i};if(p0(s)>r)return{risky:!0}}return{risky:!1}},vi=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=ed[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Is,r.maxLength):Is,s=t.length;if(s>n)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${n}`);let i={type:"bos",value:"",output:r.prepend||""},o=[i],a=r.capture?"":"?:",u=Ne.isWindows(e),c=Wn.globChars(u),l=Wn.extglobChars(c),{DOT_LITERAL:d,PLUS_LITERAL:f,SLASH_LITERAL:g,ONE_CHAR:m,DOTS_SLASH:y,NO_DOT:h,NO_DOT_SLASH:w,NO_DOTS_SLASH:C,QMARK:A,QMARK_NO_DOT:T,STAR:V,START_ANCHOR:I}=c,H=N=>`(${a}(?:(?!${I}${N.dot?y:d}).)*?)`,F=r.dot?"":h,q=r.dot?A:T,P=r.bash===!0?H(r):V;r.capture&&(P=`(${P})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let b={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:o};t=Ne.removePrefix(t,b),s=t.length;let Q=[],re=[],de=[],x=i,k,he=()=>b.index===s-1,X=b.peek=(N=1)=>t[b.index+N],Ee=b.advance=()=>t[++b.index]||"",ot=()=>t.slice(b.index+1),Oe=(N="",ve=0)=>{b.consumed+=N,b.index+=ve},Ct=N=>{b.output+=N.output!=null?N.output:N.value,Oe(N.value)},_s=()=>{let N=1;for(;X()==="!"&&(X(2)!=="("||X(3)==="?");)Ee(),b.start++,N++;return N%2===0?!1:(b.negated=!0,b.start++,!0)},Tr=N=>{b[N]++,de.push(N)},Ve=N=>{b[N]--,de.pop()},oe=N=>{if(x.type==="globstar"){let ve=b.braces>0&&(N.type==="comma"||N.type==="brace"),B=N.extglob===!0||Q.length&&(N.type==="pipe"||N.type==="paren");N.type!=="slash"&&N.type!=="paren"&&!ve&&!B&&(b.output=b.output.slice(0,-x.output.length),x.type="star",x.value="*",x.output=P,b.output+=x.output)}if(Q.length&&N.type!=="paren"&&(Q[Q.length-1].inner+=N.value),(N.value||N.output)&&Ct(N),x&&x.type==="text"&&N.type==="text"){x.value+=N.value,x.output=(x.output||"")+N.value;return}N.prev=x,o.push(N),x=N},Rr=(N,ve)=>{let B={...l[ve],conditions:1,inner:""};B.prev=x,B.parens=b.parens,B.output=b.output,B.startIndex=b.index,B.tokensIndex=o.length;let le=(r.capture?"(":"")+B.open;Tr("parens"),oe({type:N,value:ve,output:b.output?"":m}),oe({type:"paren",extglob:!0,value:Ee(),output:le}),Q.push(B)},bs=N=>{let ve=t.slice(N.startIndex,b.index+1),B=t.slice(N.startIndex+2,b.index),le=m0(B,r);if((N.type==="plus"||N.type==="star")&&le.risky){let j=le.safeOutput?(N.output?"":m)+(r.capture?`(${le.safeOutput})`:le.safeOutput):void 0,z=o[N.tokensIndex];z.type="text",z.value=ve,z.output=j||Ne.escapeRegex(ve);for(let ee=N.tokensIndex+1;ee<o.length;ee++)o[ee].value="",o[ee].output="",delete o[ee].suffix;b.output=N.output+z.output,b.backtrack=!0,oe({type:"paren",extglob:!0,value:k,output:""}),Ve("parens");return}let $=N.close+(r.capture?")":""),R;if(N.type==="negate"){let j=P;if(N.inner&&N.inner.length>1&&N.inner.includes("/")&&(j=H(r)),(j!==P||he()||/^\)+$/.test(ot()))&&($=N.close=`)$))${j}`),N.inner.includes("*")&&(R=ot())&&/^\.[^\\/.]+$/.test(R)){let z=vi(R,{...e,fastpaths:!1}).output;$=N.close=`)${z})${j})`}N.prev.type==="bos"&&(b.negatedExtglob=!0)}oe({type:"paren",extglob:!0,value:k,output:$}),Ve("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let N=!1,ve=t.replace(c0,(B,le,$,R,j,z)=>R==="\\"?(N=!0,B):R==="?"?le?le+R+(j?A.repeat(j.length):""):z===0?q+(j?A.repeat(j.length):""):A.repeat($.length):R==="."?d.repeat($.length):R==="*"?le?le+R+(j?P:""):P:le?B:`\\${B}`);return N===!0&&(r.unescape===!0?ve=ve.replace(/\\/g,""):ve=ve.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),ve===t&&r.contains===!0?(b.output=t,b):(b.output=Ne.wrapOutput(ve,b,e),b)}for(;!he();){if(k=Ee(),k==="\0")continue;if(k==="\\"){let B=X();if(B==="/"&&r.bash!==!0||B==="."||B===";")continue;if(!B){k+="\\",oe({type:"text",value:k});continue}let le=/^\\+/.exec(ot()),$=0;if(le&&le[0].length>2&&($=le[0].length,b.index+=$,$%2!==0&&(k+="\\")),r.unescape===!0?k=Ee():k+=Ee(),b.brackets===0){oe({type:"text",value:k});continue}}if(b.brackets>0&&(k!=="]"||x.value==="["||x.value==="[^")){if(r.posix!==!1&&k===":"){let B=x.value.slice(1);if(B.includes("[")&&(x.posix=!0,B.includes(":"))){let le=x.value.lastIndexOf("["),$=x.value.slice(0,le),R=x.value.slice(le+2),j=a0[R];if(j){x.value=$+j,b.backtrack=!0,Ee(),!i.output&&o.indexOf(x)===1&&(i.output=m);continue}}}(k==="["&&X()!==":"||k==="-"&&X()==="]")&&(k=`\\${k}`),k==="]"&&(x.value==="["||x.value==="[^")&&(k=`\\${k}`),r.posix===!0&&k==="!"&&x.value==="["&&(k="^"),x.value+=k,Ct({value:k});continue}if(b.quotes===1&&k!=='"'){k=Ne.escapeRegex(k),x.value+=k,Ct({value:k});continue}if(k==='"'){b.quotes=b.quotes===1?0:1,r.keepQuotes===!0&&oe({type:"text",value:k});continue}if(k==="("){Tr("parens"),oe({type:"paren",value:k});continue}if(k===")"){if(b.parens===0&&r.strictBrackets===!0)throw new SyntaxError(mn("opening","("));let B=Q[Q.length-1];if(B&&b.parens===B.parens+1){bs(Q.pop());continue}oe({type:"paren",value:k,output:b.parens?")":"\\)"}),Ve("parens");continue}if(k==="["){if(r.nobracket===!0||!ot().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(mn("closing","]"));k=`\\${k}`}else Tr("brackets");oe({type:"bracket",value:k});continue}if(k==="]"){if(r.nobracket===!0||x&&x.type==="bracket"&&x.value.length===1){oe({type:"text",value:k,output:`\\${k}`});continue}if(b.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(mn("opening","["));oe({type:"text",value:k,output:`\\${k}`});continue}Ve("brackets");let B=x.value.slice(1);if(x.posix!==!0&&B[0]==="^"&&!B.includes("/")&&(k=`/${k}`),x.value+=k,Ct({value:k}),r.literalBrackets===!1||Ne.hasRegexChars(B))continue;let le=Ne.escapeRegex(x.value);if(b.output=b.output.slice(0,-x.value.length),r.literalBrackets===!0){b.output+=le,x.value=le;continue}x.value=`(${a}${le}|${x.value})`,b.output+=x.value;continue}if(k==="{"&&r.nobrace!==!0){Tr("braces");let B={type:"brace",value:k,output:"(",outputIndex:b.output.length,tokensIndex:b.tokens.length};re.push(B),oe(B);continue}if(k==="}"){let B=re[re.length-1];if(r.nobrace===!0||!B){oe({type:"text",value:k,output:k});continue}let le=")";if(B.dots===!0){let $=o.slice(),R=[];for(let j=$.length-1;j>=0&&(o.pop(),$[j].type!=="brace");j--)$[j].type!=="dots"&&R.unshift($[j].value);le=l0(R,r),b.backtrack=!0}if(B.comma!==!0&&B.dots!==!0){let $=b.output.slice(0,B.outputIndex),R=b.tokens.slice(B.tokensIndex);B.value=B.output="\\{",k=le="\\}",b.output=$;for(let j of R)b.output+=j.output||j.value}oe({type:"brace",value:k,output:le}),Ve("braces"),re.pop();continue}if(k==="|"){Q.length>0&&Q[Q.length-1].conditions++,oe({type:"text",value:k});continue}if(k===","){let B=k,le=re[re.length-1];le&&de[de.length-1]==="braces"&&(le.comma=!0,B="|"),oe({type:"comma",value:k,output:B});continue}if(k==="/"){if(x.type==="dot"&&b.index===b.start+1){b.start=b.index+1,b.consumed="",b.output="",o.pop(),x=i;continue}oe({type:"slash",value:k,output:g});continue}if(k==="."){if(b.braces>0&&x.type==="dot"){x.value==="."&&(x.output=d);let B=re[re.length-1];x.type="dots",x.output+=k,x.value+=k,B.dots=!0;continue}if(b.braces+b.parens===0&&x.type!=="bos"&&x.type!=="slash"){oe({type:"text",value:k,output:d});continue}oe({type:"dot",value:k,output:d});continue}if(k==="?"){if(!(x&&x.value==="(")&&r.noextglob!==!0&&X()==="("&&X(2)!=="?"){Rr("qmark",k);continue}if(x&&x.type==="paren"){let le=X(),$=k;if(le==="<"&&!Ne.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(x.value==="("&&!/[!=<:]/.test(le)||le==="<"&&!/<([!=]|\w+>)/.test(ot()))&&($=`\\${k}`),oe({type:"text",value:k,output:$});continue}if(r.dot!==!0&&(x.type==="slash"||x.type==="bos")){oe({type:"qmark",value:k,output:T});continue}oe({type:"qmark",value:k,output:A});continue}if(k==="!"){if(r.noextglob!==!0&&X()==="("&&(X(2)!=="?"||!/[!=<:]/.test(X(3)))){Rr("negate",k);continue}if(r.nonegate!==!0&&b.index===0){_s();continue}}if(k==="+"){if(r.noextglob!==!0&&X()==="("&&X(2)!=="?"){Rr("plus",k);continue}if(x&&x.value==="("||r.regex===!1){oe({type:"plus",value:k,output:f});continue}if(x&&(x.type==="bracket"||x.type==="paren"||x.type==="brace")||b.parens>0){oe({type:"plus",value:k});continue}oe({type:"plus",value:f});continue}if(k==="@"){if(r.noextglob!==!0&&X()==="("&&X(2)!=="?"){oe({type:"at",extglob:!0,value:k,output:""});continue}oe({type:"text",value:k});continue}if(k!=="*"){(k==="$"||k==="^")&&(k=`\\${k}`);let B=u0.exec(ot());B&&(k+=B[0],b.index+=B[0].length),oe({type:"text",value:k});continue}if(x&&(x.type==="globstar"||x.star===!0)){x.type="star",x.star=!0,x.value+=k,x.output=P,b.backtrack=!0,b.globstar=!0,Oe(k);continue}let N=ot();if(r.noextglob!==!0&&/^\([^?]/.test(N)){Rr("star",k);continue}if(x.type==="star"){if(r.noglobstar===!0){Oe(k);continue}let B=x.prev,le=B.prev,$=B.type==="slash"||B.type==="bos",R=le&&(le.type==="star"||le.type==="globstar");if(r.bash===!0&&(!$||N[0]&&N[0]!=="/")){oe({type:"star",value:k,output:""});continue}let j=b.braces>0&&(B.type==="comma"||B.type==="brace"),z=Q.length&&(B.type==="pipe"||B.type==="paren");if(!$&&B.type!=="paren"&&!j&&!z){oe({type:"star",value:k,output:""});continue}for(;N.slice(0,3)==="/**";){let ee=t[b.index+4];if(ee&&ee!=="/")break;N=N.slice(3),Oe("/**",3)}if(B.type==="bos"&&he()){x.type="globstar",x.value+=k,x.output=H(r),b.output=x.output,b.globstar=!0,Oe(k);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&!R&&he()){b.output=b.output.slice(0,-(B.output+x.output).length),B.output=`(?:${B.output}`,x.type="globstar",x.output=H(r)+(r.strictSlashes?")":"|$)"),x.value+=k,b.globstar=!0,b.output+=B.output+x.output,Oe(k);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&N[0]==="/"){let ee=N[1]!==void 0?"|$":"";b.output=b.output.slice(0,-(B.output+x.output).length),B.output=`(?:${B.output}`,x.type="globstar",x.output=`${H(r)}${g}|${g}${ee})`,x.value+=k,b.output+=B.output+x.output,b.globstar=!0,Oe(k+Ee()),oe({type:"slash",value:"/",output:""});continue}if(B.type==="bos"&&N[0]==="/"){x.type="globstar",x.value+=k,x.output=`(?:^|${g}|${H(r)}${g})`,b.output=x.output,b.globstar=!0,Oe(k+Ee()),oe({type:"slash",value:"/",output:""});continue}b.output=b.output.slice(0,-x.output.length),x.type="globstar",x.output=H(r),x.value+=k,b.output+=x.output,b.globstar=!0,Oe(k);continue}let ve={type:"star",value:k,output:P};if(r.bash===!0){ve.output=".*?",(x.type==="bos"||x.type==="slash")&&(ve.output=F+ve.output),oe(ve);continue}if(x&&(x.type==="bracket"||x.type==="paren")&&r.regex===!0){ve.output=k,oe(ve);continue}(b.index===b.start||x.type==="slash"||x.type==="dot")&&(x.type==="dot"?(b.output+=w,x.output+=w):r.dot===!0?(b.output+=C,x.output+=C):(b.output+=F,x.output+=F),X()!=="*"&&(b.output+=m,x.output+=m)),oe(ve)}for(;b.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(mn("closing","]"));b.output=Ne.escapeLast(b.output,"["),Ve("brackets")}for(;b.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(mn("closing",")"));b.output=Ne.escapeLast(b.output,"("),Ve("parens")}for(;b.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(mn("closing","}"));b.output=Ne.escapeLast(b.output,"{"),Ve("braces")}if(r.strictSlashes!==!0&&(x.type==="star"||x.type==="bracket")&&oe({type:"maybe_slash",value:"",output:`${g}?`}),b.backtrack===!0){b.output="";for(let N of b.tokens)b.output+=N.output!=null?N.output:N.value,N.suffix&&(b.output+=N.suffix)}return b};vi.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Is,r.maxLength):Is,s=t.length;if(s>n)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${n}`);t=ed[t]||t;let i=Ne.isWindows(e),{DOT_LITERAL:o,SLASH_LITERAL:a,ONE_CHAR:u,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:d,NO_DOTS_SLASH:f,STAR:g,START_ANCHOR:m}=Wn.globChars(i),y=r.dot?d:l,h=r.dot?f:l,w=r.capture?"":"?:",C={negated:!1,prefix:""},A=r.bash===!0?".*?":g;r.capture&&(A=`(${A})`);let T=F=>F.noglobstar===!0?A:`(${w}(?:(?!${m}${F.dot?c:o}).)*?)`,V=F=>{switch(F){case"*":return`${y}${u}${A}`;case".*":return`${o}${u}${A}`;case"*.*":return`${y}${A}${o}${u}${A}`;case"*/*":return`${y}${A}${a}${u}${h}${A}`;case"**":return y+T(r);case"**/*":return`(?:${y}${T(r)}${a})?${h}${u}${A}`;case"**/*.*":return`(?:${y}${T(r)}${a})?${h}${A}${o}${u}${A}`;case"**/.*":return`(?:${y}${T(r)}${a})?${o}${u}${A}`;default:{let q=/^(.*?)\.(\w+)$/.exec(F);if(!q)return;let P=V(q[1]);return P?P+o+q[2]:void 0}}},I=Ne.removePrefix(t,C),H=V(I);return H&&r.strictSlashes!==!0&&(H+=`${a}?`),H};nd.exports=vi});var id=v((Dj,od)=>{"use strict";var g0=require("path"),D0=Ql(),_i=sd(),bi=Mn(),y0=Bn(),v0=t=>t&&typeof t=="object"&&!Array.isArray(t),Ae=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(f=>Ae(f,e,r));return f=>{for(let g of l){let m=g(f);if(m)return m}return!1}}let n=v0(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let s=e||{},i=bi.isWindows(e),o=n?Ae.compileRe(t,e):Ae.makeRe(t,e,!1,!0),a=o.state;delete o.state;let u=()=>!1;if(s.ignore){let l={...e,ignore:null,onMatch:null,onResult:null};u=Ae(s.ignore,l,r)}let c=(l,d=!1)=>{let{isMatch:f,match:g,output:m}=Ae.test(l,o,e,{glob:t,posix:i}),y={glob:t,state:a,regex:o,posix:i,input:l,output:m,match:g,isMatch:f};return typeof s.onResult=="function"&&s.onResult(y),f===!1?(y.isMatch=!1,d?y:!1):u(l)?(typeof s.onIgnore=="function"&&s.onIgnore(y),y.isMatch=!1,d?y:!1):(typeof s.onMatch=="function"&&s.onMatch(y),d?y:!0)};return r&&(c.state=a),c};Ae.test=(t,e,r,{glob:n,posix:s}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let i=r||{},o=i.format||(s?bi.toPosixSlashes:null),a=t===n,u=a&&o?o(t):t;return a===!1&&(u=o?o(t):t,a=u===n),(a===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?a=Ae.matchBase(t,e,r,s):a=e.exec(u)),{isMatch:!!a,match:a,output:u}};Ae.matchBase=(t,e,r,n=bi.isWindows(r))=>(e instanceof RegExp?e:Ae.makeRe(e,r)).test(g0.basename(t));Ae.isMatch=(t,e,r)=>Ae(e,r)(t);Ae.parse=(t,e)=>Array.isArray(t)?t.map(r=>Ae.parse(r,e)):_i(t,{...e,fastpaths:!1});Ae.scan=(t,e)=>D0(t,e);Ae.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let s=e||{},i=s.contains?"":"^",o=s.contains?"":"$",a=`${i}(?:${t.output})${o}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let u=Ae.toRegex(a,e);return n===!0&&(u.state=t),u};Ae.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let s={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(s.output=_i.fastpaths(t,e)),s.output||(s=_i(t,e)),Ae.compileRe(s,e,r,n)};Ae.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Ae.constants=y0;od.exports=Ae});var ud=v((yj,ad)=>{"use strict";ad.exports=id()});var pd=v((vj,hd)=>{"use strict";var ld=require("util"),dd=Ml(),qt=ud(),Si=Mn(),cd=t=>t===""||t==="./",fd=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},Ce=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,s=new Set,i=new Set,o=0,a=l=>{i.add(l.output),r&&r.onResult&&r.onResult(l)};for(let l=0;l<e.length;l++){let d=qt(String(e[l]),{...r,onResult:a},!0),f=d.state.negated||d.state.negatedExtglob;f&&o++;for(let g of t){let m=d(g,!0);(f?!m.isMatch:m.isMatch)&&(f?n.add(m.output):(n.delete(m.output),s.add(m.output)))}}let c=(o===e.length?[...i]:[...s]).filter(l=>!n.has(l));if(r&&c.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(l=>l.replace(/\\/g,"")):e}return c};Ce.match=Ce;Ce.matcher=(t,e)=>qt(t,e);Ce.isMatch=(t,e,r)=>qt(e,r)(t);Ce.any=Ce.isMatch;Ce.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,s=[],i=a=>{r.onResult&&r.onResult(a),s.push(a.output)},o=new Set(Ce(t,e,{...r,onResult:i}));for(let a of s)o.has(a)||n.add(a);return[...n]};Ce.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${ld.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>Ce.contains(t,n,r));if(typeof e=="string"){if(cd(t)||cd(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return Ce.isMatch(t,e,{...r,contains:!0})};Ce.matchKeys=(t,e,r)=>{if(!Si.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=Ce(Object.keys(t),e,r),s={};for(let i of n)s[i]=t[i];return s};Ce.some=(t,e,r)=>{let n=[].concat(t);for(let s of[].concat(e)){let i=qt(String(s),r);if(n.some(o=>i(o)))return!0}return!1};Ce.every=(t,e,r)=>{let n=[].concat(t);for(let s of[].concat(e)){let i=qt(String(s),r);if(!n.every(o=>i(o)))return!1}return!0};Ce.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${ld.inspect(t)}"`);return[].concat(e).every(n=>qt(n,r)(t))};Ce.capture=(t,e,r)=>{let n=Si.isWindows(r),i=qt.makeRe(String(t),{...r,capture:!0}).exec(n?Si.toPosixSlashes(e):e);if(i)return i.slice(1).map(o=>o===void 0?"":o)};Ce.makeRe=(...t)=>qt.makeRe(...t);Ce.scan=(...t)=>qt.scan(...t);Ce.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let s of dd(String(n),e))r.push(qt.parse(s,e));return r};Ce.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!fd(t)?[t]:dd(t,e)};Ce.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return Ce.braces(t,{...e,expand:!0})};Ce.hasBraces=fd;hd.exports=Ce});var Cd=v(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.isAbsolute=ne.partitionAbsoluteAndRelative=ne.removeDuplicateSlashes=ne.matchAny=ne.convertPatternsToRe=ne.makeRe=ne.getPatternParts=ne.expandBraceExpansion=ne.expandPatternsWithBraceExpansion=ne.isAffectDepthOfReadingPattern=ne.endsWithSlashGlobStar=ne.hasGlobStar=ne.getBaseDirectory=ne.isPatternRelatedToParentDirectory=ne.getPatternsOutsideCurrentDirectory=ne.getPatternsInsideCurrentDirectory=ne.getPositivePatterns=ne.getNegativePatterns=ne.isPositivePattern=ne.isNegativePattern=ne.convertToNegativePattern=ne.convertToPositivePattern=ne.isDynamicPattern=ne.isStaticPattern=void 0;var md=require("path"),_0=sl(),Ei=pd(),gd="**",b0="\\",S0=/[*?]|^!/,E0=/\[[^[]*]/,C0=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,w0=/[!*+?@]\([^(]*\)/,x0=/,|\.\./,k0=/(?!^)\/{2,}/g;function Dd(t,e={}){return!yd(t,e)}ne.isStaticPattern=Dd;function yd(t,e={}){return t===""?!1:!!(e.caseSensitiveMatch===!1||t.includes(b0)||S0.test(t)||E0.test(t)||C0.test(t)||e.extglob!==!1&&w0.test(t)||e.braceExpansion!==!1&&$0(t))}ne.isDynamicPattern=yd;function $0(t){let e=t.indexOf("{");if(e===-1)return!1;let r=t.indexOf("}",e+1);if(r===-1)return!1;let n=t.slice(e,r);return x0.test(n)}function A0(t){return Ts(t)?t.slice(1):t}ne.convertToPositivePattern=A0;function F0(t){return"!"+t}ne.convertToNegativePattern=F0;function Ts(t){return t.startsWith("!")&&t[1]!=="("}ne.isNegativePattern=Ts;function vd(t){return!Ts(t)}ne.isPositivePattern=vd;function j0(t){return t.filter(Ts)}ne.getNegativePatterns=j0;function I0(t){return t.filter(vd)}ne.getPositivePatterns=I0;function T0(t){return t.filter(e=>!Ci(e))}ne.getPatternsInsideCurrentDirectory=T0;function R0(t){return t.filter(Ci)}ne.getPatternsOutsideCurrentDirectory=R0;function Ci(t){return t.startsWith("..")||t.startsWith("./..")}ne.isPatternRelatedToParentDirectory=Ci;function P0(t){return _0(t,{flipBackslashes:!1})}ne.getBaseDirectory=P0;function O0(t){return t.includes(gd)}ne.hasGlobStar=O0;function _d(t){return t.endsWith("/"+gd)}ne.endsWithSlashGlobStar=_d;function N0(t){let e=md.basename(t);return _d(t)||Dd(e)}ne.isAffectDepthOfReadingPattern=N0;function L0(t){return t.reduce((e,r)=>e.concat(bd(r)),[])}ne.expandPatternsWithBraceExpansion=L0;function bd(t){let e=Ei.braces(t,{expand:!0,nodupes:!0,keepEscaping:!0});return e.sort((r,n)=>r.length-n.length),e.filter(r=>r!=="")}ne.expandBraceExpansion=bd;function B0(t,e){let{parts:r}=Ei.scan(t,Object.assign(Object.assign({},e),{parts:!0}));return r.length===0&&(r=[t]),r[0].startsWith("/")&&(r[0]=r[0].slice(1),r.unshift("")),r}ne.getPatternParts=B0;function Sd(t,e){return Ei.makeRe(t,e)}ne.makeRe=Sd;function M0(t,e){return t.map(r=>Sd(r,e))}ne.convertPatternsToRe=M0;function q0(t,e){return e.some(r=>r.test(t))}ne.matchAny=q0;function W0(t){return t.replace(k0,"/")}ne.removeDuplicateSlashes=W0;function H0(t){let e=[],r=[];for(let n of t)Ed(n)?e.push(n):r.push(n);return[e,r]}ne.partitionAbsoluteAndRelative=H0;function Ed(t){return md.isAbsolute(t)}ne.isAbsolute=Ed});var $d=v((bj,kd)=>{"use strict";var Z0=require("stream"),wd=Z0.PassThrough,U0=Array.prototype.slice;kd.exports=V0;function V0(){let t=[],e=U0.call(arguments),r=!1,n=e[e.length-1];n&&!Array.isArray(n)&&n.pipe==null?e.pop():n={};let s=n.end!==!1,i=n.pipeError===!0;n.objectMode==null&&(n.objectMode=!0),n.highWaterMark==null&&(n.highWaterMark=64*1024);let o=wd(n);function a(){for(let l=0,d=arguments.length;l<d;l++)t.push(xd(arguments[l],n));return u(),this}function u(){if(r)return;r=!0;let l=t.shift();if(!l){process.nextTick(c);return}Array.isArray(l)||(l=[l]);let d=l.length+1;function f(){--d>0||(r=!1,u())}function g(m){function y(){m.removeListener("merge2UnpipeEnd",y),m.removeListener("end",y),i&&m.removeListener("error",h),f()}function h(w){o.emit("error",w)}if(m._readableState.endEmitted)return f();m.on("merge2UnpipeEnd",y),m.on("end",y),i&&m.on("error",h),m.pipe(o,{end:!1}),m.resume()}for(let m=0;m<l.length;m++)g(l[m]);f()}function c(){r=!1,o.emit("queueDrain"),s&&o.end()}return o.setMaxListeners(0),o.add=a,o.on("unpipe",function(l){l.emit("merge2UnpipeEnd")}),e.length&&a.apply(null,e),o}function xd(t,e){if(Array.isArray(t))for(let r=0,n=t.length;r<n;r++)t[r]=xd(t[r],e);else{if(!t._readableState&&t.pipe&&(t=t.pipe(wd(e))),!t._readableState||!t.pause||!t.pipe)throw new Error("Only readable stream can be merged.");t.pause()}return t}});var Fd=v(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.merge=void 0;var G0=$d();function z0(t){let e=G0(t);return t.forEach(r=>{r.once("error",n=>e.emit("error",n))}),e.once("close",()=>Ad(t)),e.once("end",()=>Ad(t)),e}Rs.merge=z0;function Ad(t){t.forEach(e=>e.emit("close"))}});var jd=v(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.isEmpty=gn.isString=void 0;function Y0(t){return typeof t=="string"}gn.isString=Y0;function J0(t){return t===""}gn.isEmpty=J0});var er=v(Le=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0});Le.string=Le.stream=Le.pattern=Le.path=Le.fs=Le.errno=Le.array=void 0;var X0=Uc();Le.array=X0;var K0=Vc();Le.errno=K0;var Q0=Gc();Le.fs=Q0;var e_=Xc();Le.path=e_;var t_=Cd();Le.pattern=t_;var r_=Fd();Le.stream=r_;var n_=jd();Le.string=n_});var Pd=v(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.convertPatternGroupToTask=Be.convertPatternGroupsToTasks=Be.groupPatternsByBaseDirectory=Be.getNegativePatternsAsPositive=Be.getPositivePatterns=Be.convertPatternsToTasks=Be.generate=void 0;var xt=er();function s_(t,e){let r=Id(t,e),n=Id(e.ignore,e),s=Td(r),i=Rd(r,n),o=s.filter(l=>xt.pattern.isStaticPattern(l,e)),a=s.filter(l=>xt.pattern.isDynamicPattern(l,e)),u=wi(o,i,!1),c=wi(a,i,!0);return u.concat(c)}Be.generate=s_;function Id(t,e){let r=t;return e.braceExpansion&&(r=xt.pattern.expandPatternsWithBraceExpansion(r)),e.baseNameMatch&&(r=r.map(n=>n.includes("/")?n:`**/${n}`)),r.map(n=>xt.pattern.removeDuplicateSlashes(n))}function wi(t,e,r){let n=[],s=xt.pattern.getPatternsOutsideCurrentDirectory(t),i=xt.pattern.getPatternsInsideCurrentDirectory(t),o=xi(s),a=xi(i);return n.push(...ki(o,e,r)),"."in a?n.push($i(".",i,e,r)):n.push(...ki(a,e,r)),n}Be.convertPatternsToTasks=wi;function Td(t){return xt.pattern.getPositivePatterns(t)}Be.getPositivePatterns=Td;function Rd(t,e){return xt.pattern.getNegativePatterns(t).concat(e).map(xt.pattern.convertToPositivePattern)}Be.getNegativePatternsAsPositive=Rd;function xi(t){let e={};return t.reduce((r,n)=>{let s=xt.pattern.getBaseDirectory(n);return s in r?r[s].push(n):r[s]=[n],r},e)}Be.groupPatternsByBaseDirectory=xi;function ki(t,e,r){return Object.keys(t).map(n=>$i(n,t[n],e,r))}Be.convertPatternGroupsToTasks=ki;function $i(t,e,r,n){return{dynamic:n,positive:e,negative:r,base:t,patterns:[].concat(e,r.map(xt.pattern.convertToNegativePattern))}}Be.convertPatternGroupToTask=$i});var Nd=v(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.read=void 0;function o_(t,e,r){e.fs.lstat(t,(n,s)=>{if(n!==null){Od(r,n);return}if(!s.isSymbolicLink()||!e.followSymbolicLink){Ai(r,s);return}e.fs.stat(t,(i,o)=>{if(i!==null){if(e.throwErrorOnBrokenSymbolicLink){Od(r,i);return}Ai(r,s);return}e.markSymbolicLink&&(o.isSymbolicLink=()=>!0),Ai(r,o)})})}Ps.read=o_;function Od(t,e){t(e)}function Ai(t,e){t(null,e)}});var Ld=v(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.read=void 0;function i_(t,e){let r=e.fs.lstatSync(t);if(!r.isSymbolicLink()||!e.followSymbolicLink)return r;try{let n=e.fs.statSync(t);return e.markSymbolicLink&&(n.isSymbolicLink=()=>!0),n}catch(n){if(!e.throwErrorOnBrokenSymbolicLink)return r;throw n}}Os.read=i_});var Bd=v(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.createFileSystemAdapter=hr.FILE_SYSTEM_ADAPTER=void 0;var Ns=require("fs");hr.FILE_SYSTEM_ADAPTER={lstat:Ns.lstat,stat:Ns.stat,lstatSync:Ns.lstatSync,statSync:Ns.statSync};function a_(t){return t===void 0?hr.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},hr.FILE_SYSTEM_ADAPTER),t)}hr.createFileSystemAdapter=a_});var Md=v(ji=>{"use strict";Object.defineProperty(ji,"__esModule",{value:!0});var u_=Bd(),Fi=class{constructor(e={}){this._options=e,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=u_.createFileSystemAdapter(this._options.fs),this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0)}_getValue(e,r){return e??r}};ji.default=Fi});var Nr=v(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});pr.statSync=pr.stat=pr.Settings=void 0;var qd=Nd(),c_=Ld(),Ii=Md();pr.Settings=Ii.default;function l_(t,e,r){if(typeof e=="function"){qd.read(t,Ti(),e);return}qd.read(t,Ti(e),r)}pr.stat=l_;function d_(t,e){let r=Ti(e);return c_.read(t,r)}pr.statSync=d_;function Ti(t={}){return t instanceof Ii.default?t:new Ii.default(t)}});var Zd=v((jj,Hd)=>{var Wd;Hd.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:global):t=>(Wd||(Wd=Promise.resolve())).then(t).catch(e=>setTimeout(()=>{throw e},0))});var Vd=v((Ij,Ud)=>{Ud.exports=h_;var f_=Zd();function h_(t,e){let r,n,s,i=!0;Array.isArray(t)?(r=[],n=t.length):(s=Object.keys(t),r={},n=s.length);function o(u){function c(){e&&e(u,r),e=null}i?f_(c):c()}function a(u,c,l){r[u]=l,(--n===0||c)&&o(c)}n?s?s.forEach(function(u){t[u](function(c,l){a(u,c,l)})}):t.forEach(function(u,c){u(function(l,d){a(c,l,d)})}):o(null),i=!1}});var Ri=v(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});Bs.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;var Ls=process.versions.node.split(".");if(Ls[0]===void 0||Ls[1]===void 0)throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);var Gd=Number.parseInt(Ls[0],10),p_=Number.parseInt(Ls[1],10),zd=10,m_=10,g_=Gd>zd,D_=Gd===zd&&p_>=m_;Bs.IS_SUPPORT_READDIR_WITH_FILE_TYPES=g_||D_});var Yd=v(Ms=>{"use strict";Object.defineProperty(Ms,"__esModule",{value:!0});Ms.createDirentFromStats=void 0;var Pi=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function y_(t,e){return new Pi(t,e)}Ms.createDirentFromStats=y_});var Oi=v(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});qs.fs=void 0;var v_=Yd();qs.fs=v_});var Ni=v(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.joinPathSegments=void 0;function __(t,e,r){return t.endsWith(r)?t+e:t+r+e}Ws.joinPathSegments=__});var tf=v(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});mr.readdir=mr.readdirWithFileTypes=mr.read=void 0;var b_=Nr(),Jd=Vd(),S_=Ri(),Xd=Oi(),Kd=Ni();function E_(t,e,r){if(!e.stats&&S_.IS_SUPPORT_READDIR_WITH_FILE_TYPES){Qd(t,e,r);return}ef(t,e,r)}mr.read=E_;function Qd(t,e,r){e.fs.readdir(t,{withFileTypes:!0},(n,s)=>{if(n!==null){Hs(r,n);return}let i=s.map(a=>({dirent:a,name:a.name,path:Kd.joinPathSegments(t,a.name,e.pathSegmentSeparator)}));if(!e.followSymbolicLinks){Li(r,i);return}let o=i.map(a=>C_(a,e));Jd(o,(a,u)=>{if(a!==null){Hs(r,a);return}Li(r,u)})})}mr.readdirWithFileTypes=Qd;function C_(t,e){return r=>{if(!t.dirent.isSymbolicLink()){r(null,t);return}e.fs.stat(t.path,(n,s)=>{if(n!==null){if(e.throwErrorOnBrokenSymbolicLink){r(n);return}r(null,t);return}t.dirent=Xd.fs.createDirentFromStats(t.name,s),r(null,t)})}}function ef(t,e,r){e.fs.readdir(t,(n,s)=>{if(n!==null){Hs(r,n);return}let i=s.map(o=>{let a=Kd.joinPathSegments(t,o,e.pathSegmentSeparator);return u=>{b_.stat(a,e.fsStatSettings,(c,l)=>{if(c!==null){u(c);return}let d={name:o,path:a,dirent:Xd.fs.createDirentFromStats(o,l)};e.stats&&(d.stats=l),u(null,d)})}});Jd(i,(o,a)=>{if(o!==null){Hs(r,o);return}Li(r,a)})})}mr.readdir=ef;function Hs(t,e){t(e)}function Li(t,e){t(null,e)}});var af=v(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.readdir=gr.readdirWithFileTypes=gr.read=void 0;var w_=Nr(),x_=Ri(),rf=Oi(),nf=Ni();function k_(t,e){return!e.stats&&x_.IS_SUPPORT_READDIR_WITH_FILE_TYPES?sf(t,e):of(t,e)}gr.read=k_;function sf(t,e){return e.fs.readdirSync(t,{withFileTypes:!0}).map(n=>{let s={dirent:n,name:n.name,path:nf.joinPathSegments(t,n.name,e.pathSegmentSeparator)};if(s.dirent.isSymbolicLink()&&e.followSymbolicLinks)try{let i=e.fs.statSync(s.path);s.dirent=rf.fs.createDirentFromStats(s.name,i)}catch(i){if(e.throwErrorOnBrokenSymbolicLink)throw i}return s})}gr.readdirWithFileTypes=sf;function of(t,e){return e.fs.readdirSync(t).map(n=>{let s=nf.joinPathSegments(t,n,e.pathSegmentSeparator),i=w_.statSync(s,e.fsStatSettings),o={name:n,path:s,dirent:rf.fs.createDirentFromStats(n,i)};return e.stats&&(o.stats=i),o})}gr.readdir=of});var uf=v(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.createFileSystemAdapter=Dr.FILE_SYSTEM_ADAPTER=void 0;var Dn=require("fs");Dr.FILE_SYSTEM_ADAPTER={lstat:Dn.lstat,stat:Dn.stat,lstatSync:Dn.lstatSync,statSync:Dn.statSync,readdir:Dn.readdir,readdirSync:Dn.readdirSync};function $_(t){return t===void 0?Dr.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},Dr.FILE_SYSTEM_ADAPTER),t)}Dr.createFileSystemAdapter=$_});var cf=v(Mi=>{"use strict";Object.defineProperty(Mi,"__esModule",{value:!0});var A_=require("path"),F_=Nr(),j_=uf(),Bi=class{constructor(e={}){this._options=e,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=j_.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,A_.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new F_.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};Mi.default=Bi});var Zs=v(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.Settings=yr.scandirSync=yr.scandir=void 0;var lf=tf(),I_=af(),qi=cf();yr.Settings=qi.default;function T_(t,e,r){if(typeof e=="function"){lf.read(t,Wi(),e);return}lf.read(t,Wi(e),r)}yr.scandir=T_;function R_(t,e){let r=Wi(e);return I_.read(t,r)}yr.scandirSync=R_;function Wi(t={}){return t instanceof qi.default?t:new qi.default(t)}});var ff=v((Wj,df)=>{"use strict";function P_(t){var e=new t,r=e;function n(){var i=e;return i.next?e=i.next:(e=new t,r=e),i.next=null,i}function s(i){r.next=i,r=i}return{get:n,release:s}}df.exports=P_});var pf=v((Hj,Hi)=>{"use strict";var O_=ff();function hf(t,e,r){if(typeof t=="function"&&(r=e,e=t,t=null),!(r>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");var n=O_(N_),s=null,i=null,o=0,a=null,u={push:y,drain:et,saturated:et,pause:l,paused:!1,get concurrency(){return r},set concurrency(I){if(!(I>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");if(r=I,!u.paused)for(;s&&o<r;)o++,w()},running:c,resume:g,idle:m,length:d,getQueue:f,unshift:h,empty:et,kill:C,killAndDrain:A,error:V,abort:T};return u;function c(){return o}function l(){u.paused=!0}function d(){for(var I=s,H=0;I;)I=I.next,H++;return H}function f(){for(var I=s,H=[];I;)H.push(I.value),I=I.next;return H}function g(){if(u.paused){if(u.paused=!1,s===null){o++,w();return}for(;s&&o<r;)o++,w()}}function m(){return o===0&&u.length()===0}function y(I,H){var F=n.get();F.context=t,F.release=w,F.value=I,F.callback=H||et,F.errorHandler=a,o>=r||u.paused?i?(i.next=F,i=F):(s=F,i=F,u.saturated()):(o++,e.call(t,F.value,F.worked))}function h(I,H){var F=n.get();F.context=t,F.release=w,F.value=I,F.callback=H||et,F.errorHandler=a,o>=r||u.paused?s?(F.next=s,s=F):(s=F,i=F,u.saturated()):(o++,e.call(t,F.value,F.worked))}function w(I){I&&n.release(I);var H=s;H&&o<=r?u.paused?o--:(i===s&&(i=null),s=H.next,H.next=null,e.call(t,H.value,H.worked),i===null&&u.empty()):--o===0&&u.drain()}function C(){s=null,i=null,u.drain=et}function A(){s=null,i=null,u.drain(),u.drain=et}function T(){var I=s;for(s=null,i=null;I;){var H=I.next,F=I.callback,q=I.errorHandler,P=I.value,b=I.context;I.value=null,I.callback=et,I.errorHandler=null,q&&q(new Error("abort"),P),F.call(b,new Error("abort")),I.release(I),I=H}u.drain=et}function V(I){a=I}}function et(){}function N_(){this.value=null,this.callback=et,this.next=null,this.release=et,this.context=null,this.errorHandler=null;var t=this;this.worked=function(r,n){var s=t.callback,i=t.errorHandler,o=t.value;t.value=null,t.callback=et,t.errorHandler&&i(r,o),s.call(t.context,r,n),t.release(t)}}function L_(t,e,r){typeof t=="function"&&(r=e,e=t,t=null);function n(l,d){e.call(this,l).then(function(f){d(null,f)},d)}var s=hf(t,n,r),i=s.push,o=s.unshift;return s.push=a,s.unshift=u,s.drained=c,s;function a(l){var d=new Promise(function(f,g){i(l,function(m,y){if(m){g(m);return}f(y)})});return d.catch(et),d}function u(l){var d=new Promise(function(f,g){o(l,function(m,y){if(m){g(m);return}f(y)})});return d.catch(et),d}function c(){var l=new Promise(function(d){process.nextTick(function(){if(s.idle())d();else{var f=s.drain;s.drain=function(){typeof f=="function"&&f(),d(),s.drain=f}}})});return l}}Hi.exports=hf;Hi.exports.promise=L_});var Us=v(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.joinPathSegments=Wt.replacePathSegmentSeparator=Wt.isAppliedFilter=Wt.isFatalError=void 0;function B_(t,e){return t.errorFilter===null?!0:!t.errorFilter(e)}Wt.isFatalError=B_;function M_(t,e){return t===null||t(e)}Wt.isAppliedFilter=M_;function q_(t,e){return t.split(/[/\\]/).join(e)}Wt.replacePathSegmentSeparator=q_;function W_(t,e,r){return t===""?e:t.endsWith(r)?t+e:t+r+e}Wt.joinPathSegments=W_});var Vi=v(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});var H_=Us(),Zi=class{constructor(e,r){this._root=e,this._settings=r,this._root=H_.replacePathSegmentSeparator(e,r.pathSegmentSeparator)}};Ui.default=Zi});var Yi=v(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});var Z_=require("events"),U_=Zs(),V_=pf(),Vs=Us(),G_=Vi(),Gi=class extends G_.default{constructor(e,r){super(e,r),this._settings=r,this._scandir=U_.scandir,this._emitter=new Z_.EventEmitter,this._queue=V_(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{this._isFatalError||this._emitter.emit("end")}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate(()=>{this._pushToQueue(this._root,this._settings.basePath)}),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw new Error("The reader is already destroyed");this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(e){this._emitter.on("entry",e)}onError(e){this._emitter.once("error",e)}onEnd(e){this._emitter.once("end",e)}_pushToQueue(e,r){let n={directory:e,base:r};this._queue.push(n,s=>{s!==null&&this._handleError(s)})}_worker(e,r){this._scandir(e.directory,this._settings.fsScandirSettings,(n,s)=>{if(n!==null){r(n,void 0);return}for(let i of s)this._handleEntry(i,e.base);r(null,void 0)})}_handleError(e){this._isDestroyed||!Vs.isFatalError(this._settings,e)||(this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit("error",e))}_handleEntry(e,r){if(this._isDestroyed||this._isFatalError)return;let n=e.path;r!==void 0&&(e.path=Vs.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),Vs.isAppliedFilter(this._settings.entryFilter,e)&&this._emitEntry(e),e.dirent.isDirectory()&&Vs.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,r===void 0?void 0:e.path)}_emitEntry(e){this._emitter.emit("entry",e)}};zi.default=Gi});var mf=v(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});var z_=Yi(),Ji=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new z_.default(this._root,this._settings),this._storage=[]}read(e){this._reader.onError(r=>{Y_(e,r)}),this._reader.onEntry(r=>{this._storage.push(r)}),this._reader.onEnd(()=>{J_(e,this._storage)}),this._reader.read()}};Xi.default=Ji;function Y_(t,e){t(e)}function J_(t,e){t(null,e)}});var gf=v(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});var X_=require("stream"),K_=Yi(),Ki=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new K_.default(this._root,this._settings),this._stream=new X_.Readable({objectMode:!0,read:()=>{},destroy:()=>{this._reader.isDestroyed||this._reader.destroy()}})}read(){return this._reader.onError(e=>{this._stream.emit("error",e)}),this._reader.onEntry(e=>{this._stream.push(e)}),this._reader.onEnd(()=>{this._stream.push(null)}),this._reader.read(),this._stream}};Qi.default=Ki});var Df=v(ta=>{"use strict";Object.defineProperty(ta,"__esModule",{value:!0});var Q_=Zs(),Gs=Us(),eb=Vi(),ea=class extends eb.default{constructor(){super(...arguments),this._scandir=Q_.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(e,r){this._queue.add({directory:e,base:r})}_handleQueue(){for(let e of this._queue.values())this._handleDirectory(e.directory,e.base)}_handleDirectory(e,r){try{let n=this._scandir(e,this._settings.fsScandirSettings);for(let s of n)this._handleEntry(s,r)}catch(n){this._handleError(n)}}_handleError(e){if(Gs.isFatalError(this._settings,e))throw e}_handleEntry(e,r){let n=e.path;r!==void 0&&(e.path=Gs.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),Gs.isAppliedFilter(this._settings.entryFilter,e)&&this._pushToStorage(e),e.dirent.isDirectory()&&Gs.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,r===void 0?void 0:e.path)}_pushToStorage(e){this._storage.push(e)}};ta.default=ea});var yf=v(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});var tb=Df(),ra=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new tb.default(this._root,this._settings)}read(){return this._reader.read()}};na.default=ra});var vf=v(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});var rb=require("path"),nb=Zs(),sa=class{constructor(e={}){this._options=e,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,rb.sep),this.fsScandirSettings=new nb.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};oa.default=sa});var Ys=v(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.Settings=Ht.walkStream=Ht.walkSync=Ht.walk=void 0;var _f=mf(),sb=gf(),ob=yf(),ia=vf();Ht.Settings=ia.default;function ib(t,e,r){if(typeof e=="function"){new _f.default(t,zs()).read(e);return}new _f.default(t,zs(e)).read(r)}Ht.walk=ib;function ab(t,e){let r=zs(e);return new ob.default(t,r).read()}Ht.walkSync=ab;function ub(t,e){let r=zs(e);return new sb.default(t,r).read()}Ht.walkStream=ub;function zs(t={}){return t instanceof ia.default?t:new ia.default(t)}});var Js=v(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});var cb=require("path"),lb=Nr(),bf=er(),aa=class{constructor(e){this._settings=e,this._fsStatSettings=new lb.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(e){return cb.resolve(this._settings.cwd,e)}_makeEntry(e,r){let n={name:r,path:r,dirent:bf.fs.createDirentFromStats(r,e)};return this._settings.stats&&(n.stats=e),n}_isFatalError(e){return!bf.errno.isEnoentCodeError(e)&&!this._settings.suppressErrors}};ua.default=aa});var da=v(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});var db=require("stream"),fb=Nr(),hb=Ys(),pb=Js(),ca=class extends pb.default{constructor(){super(...arguments),this._walkStream=hb.walkStream,this._stat=fb.stat}dynamic(e,r){return this._walkStream(e,r)}static(e,r){let n=e.map(this._getFullEntryPath,this),s=new db.PassThrough({objectMode:!0});s._write=(i,o,a)=>this._getEntry(n[i],e[i],r).then(u=>{u!==null&&r.entryFilter(u)&&s.push(u),i===n.length-1&&s.end(),a()}).catch(a);for(let i=0;i<n.length;i++)s.write(i);return s}_getEntry(e,r,n){return this._getStat(e).then(s=>this._makeEntry(s,r)).catch(s=>{if(n.errorFilter(s))return null;throw s})}_getStat(e){return new Promise((r,n)=>{this._stat(e,this._fsStatSettings,(s,i)=>s===null?r(i):n(s))})}};la.default=ca});var Sf=v(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});var mb=Ys(),gb=Js(),Db=da(),fa=class extends gb.default{constructor(){super(...arguments),this._walkAsync=mb.walk,this._readerStream=new Db.default(this._settings)}dynamic(e,r){return new Promise((n,s)=>{this._walkAsync(e,r,(i,o)=>{i===null?n(o):s(i)})})}async static(e,r){let n=[],s=this._readerStream.static(e,r);return new Promise((i,o)=>{s.once("error",o),s.on("data",a=>n.push(a)),s.once("end",()=>i(n))})}};ha.default=fa});var Ef=v(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});var Hn=er(),pa=class{constructor(e,r,n){this._patterns=e,this._settings=r,this._micromatchOptions=n,this._storage=[],this._fillStorage()}_fillStorage(){for(let e of this._patterns){let r=this._getPatternSegments(e),n=this._splitSegmentsIntoSections(r);this._storage.push({complete:n.length<=1,pattern:e,segments:r,sections:n})}}_getPatternSegments(e){return Hn.pattern.getPatternParts(e,this._micromatchOptions).map(n=>Hn.pattern.isDynamicPattern(n,this._settings)?{dynamic:!0,pattern:n,patternRe:Hn.pattern.makeRe(n,this._micromatchOptions)}:{dynamic:!1,pattern:n})}_splitSegmentsIntoSections(e){return Hn.array.splitWhen(e,r=>r.dynamic&&Hn.pattern.hasGlobStar(r.pattern))}};ma.default=pa});var Cf=v(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});var yb=Ef(),ga=class extends yb.default{match(e){let r=e.split("/"),n=r.length,s=this._storage.filter(i=>!i.complete||i.segments.length>n);for(let i of s){let o=i.sections[0];if(!i.complete&&n>o.length||r.every((u,c)=>{let l=i.segments[c];return!!(l.dynamic&&l.patternRe.test(u)||!l.dynamic&&l.pattern===u)}))return!0}return!1}};Da.default=ga});var wf=v(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});var Xs=er(),vb=Cf(),ya=class{constructor(e,r){this._settings=e,this._micromatchOptions=r}getFilter(e,r,n){let s=this._getMatcher(r),i=this._getNegativePatternsRe(n);return o=>this._filter(e,o,s,i)}_getMatcher(e){return new vb.default(e,this._settings,this._micromatchOptions)}_getNegativePatternsRe(e){let r=e.filter(Xs.pattern.isAffectDepthOfReadingPattern);return Xs.pattern.convertPatternsToRe(r,this._micromatchOptions)}_filter(e,r,n,s){if(this._isSkippedByDeep(e,r.path)||this._isSkippedSymbolicLink(r))return!1;let i=Xs.path.removeLeadingDotSegment(r.path);return this._isSkippedByPositivePatterns(i,n)?!1:this._isSkippedByNegativePatterns(i,s)}_isSkippedByDeep(e,r){return this._settings.deep===1/0?!1:this._getEntryLevel(e,r)>=this._settings.deep}_getEntryLevel(e,r){let n=r.split("/").length;if(e==="")return n;let s=e.split("/").length;return n-s}_isSkippedSymbolicLink(e){return!this._settings.followSymbolicLinks&&e.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(e,r){return!this._settings.baseNameMatch&&!r.match(e)}_isSkippedByNegativePatterns(e,r){return!Xs.pattern.matchAny(e,r)}};va.default=ya});var xf=v(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});var vr=er(),_a=class{constructor(e,r){this._settings=e,this._micromatchOptions=r,this.index=new Map}getFilter(e,r){let[n,s]=vr.pattern.partitionAbsoluteAndRelative(r),i={positive:{all:vr.pattern.convertPatternsToRe(e,this._micromatchOptions)},negative:{absolute:vr.pattern.convertPatternsToRe(n,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0})),relative:vr.pattern.convertPatternsToRe(s,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}))}};return o=>this._filter(o,i)}_filter(e,r){let n=vr.path.removeLeadingDotSegment(e.path);if(this._settings.unique&&this._isDuplicateEntry(n)||this._onlyFileFilter(e)||this._onlyDirectoryFilter(e))return!1;let s=this._isMatchToPatternsSet(n,r,e.dirent.isDirectory());return this._settings.unique&&s&&this._createIndexRecord(n),s}_isDuplicateEntry(e){return this.index.has(e)}_createIndexRecord(e){this.index.set(e,void 0)}_onlyFileFilter(e){return this._settings.onlyFiles&&!e.dirent.isFile()}_onlyDirectoryFilter(e){return this._settings.onlyDirectories&&!e.dirent.isDirectory()}_isMatchToPatternsSet(e,r,n){return!(!this._isMatchToPatterns(e,r.positive.all,n)||this._isMatchToPatterns(e,r.negative.relative,n)||this._isMatchToAbsoluteNegative(e,r.negative.absolute,n))}_isMatchToAbsoluteNegative(e,r,n){if(r.length===0)return!1;let s=vr.path.makeAbsolute(this._settings.cwd,e);return this._isMatchToPatterns(s,r,n)}_isMatchToPatterns(e,r,n){if(r.length===0)return!1;let s=vr.pattern.matchAny(e,r);return!s&&n?vr.pattern.matchAny(e+"/",r):s}};ba.default=_a});var kf=v(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});var _b=er(),Sa=class{constructor(e){this._settings=e}getFilter(){return e=>this._isNonFatalError(e)}_isNonFatalError(e){return _b.errno.isEnoentCodeError(e)||this._settings.suppressErrors}};Ea.default=Sa});var Af=v(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});var $f=er(),Ca=class{constructor(e){this._settings=e}getTransformer(){return e=>this._transform(e)}_transform(e){let r=e.path;return this._settings.absolute&&(r=$f.path.makeAbsolute(this._settings.cwd,r),r=$f.path.unixify(r)),this._settings.markDirectories&&e.dirent.isDirectory()&&(r+="/"),this._settings.objectMode?Object.assign(Object.assign({},e),{path:r}):r}};wa.default=Ca});var Ks=v(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});var bb=require("path"),Sb=wf(),Eb=xf(),Cb=kf(),wb=Af(),xa=class{constructor(e){this._settings=e,this.errorFilter=new Cb.default(this._settings),this.entryFilter=new Eb.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new Sb.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new wb.default(this._settings)}_getRootDirectory(e){return bb.resolve(this._settings.cwd,e.base)}_getReaderOptions(e){let r=e.base==="."?"":e.base;return{basePath:r,pathSegmentSeparator:"/",concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(r,e.positive,e.negative),entryFilter:this.entryFilter.getFilter(e.positive,e.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}};ka.default=xa});var Ff=v(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});var xb=Sf(),kb=Ks(),$a=class extends kb.default{constructor(){super(...arguments),this._reader=new xb.default(this._settings)}async read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e);return(await this.api(r,e,n)).map(i=>n.transform(i))}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};Aa.default=$a});var jf=v(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});var $b=require("stream"),Ab=da(),Fb=Ks(),Fa=class extends Fb.default{constructor(){super(...arguments),this._reader=new Ab.default(this._settings)}read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e),s=this.api(r,e,n),i=new $b.Readable({objectMode:!0,read:()=>{}});return s.once("error",o=>i.emit("error",o)).on("data",o=>i.emit("data",n.transform(o))).once("end",()=>i.emit("end")),i.once("close",()=>s.destroy()),i}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};ja.default=Fa});var If=v(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});var jb=Nr(),Ib=Ys(),Tb=Js(),Ia=class extends Tb.default{constructor(){super(...arguments),this._walkSync=Ib.walkSync,this._statSync=jb.statSync}dynamic(e,r){return this._walkSync(e,r)}static(e,r){let n=[];for(let s of e){let i=this._getFullEntryPath(s),o=this._getEntry(i,s,r);o===null||!r.entryFilter(o)||n.push(o)}return n}_getEntry(e,r,n){try{let s=this._getStat(e);return this._makeEntry(s,r)}catch(s){if(n.errorFilter(s))return null;throw s}}_getStat(e){return this._statSync(e,this._fsStatSettings)}};Ta.default=Ia});var Tf=v(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});var Rb=If(),Pb=Ks(),Ra=class extends Pb.default{constructor(){super(...arguments),this._reader=new Rb.default(this._settings)}read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e);return this.api(r,e,n).map(n.transform)}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};Pa.default=Ra});var Rf=v(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;var yn=require("fs"),Ob=require("os"),Nb=Math.max(Ob.cpus().length,1);vn.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:yn.lstat,lstatSync:yn.lstatSync,stat:yn.stat,statSync:yn.statSync,readdir:yn.readdir,readdirSync:yn.readdirSync};var Oa=class{constructor(e={}){this._options=e,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,Nb),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories&&(this.onlyFiles=!1),this.stats&&(this.objectMode=!0),this.ignore=[].concat(this.ignore)}_getValue(e,r){return e===void 0?r:e}_getFileSystemMethods(e={}){return Object.assign(Object.assign({},vn.DEFAULT_FILE_SYSTEM_ADAPTER),e)}};vn.default=Oa});var Nf=v((p2,Of)=>{"use strict";var Pf=Pd(),Lb=Ff(),Bb=jf(),Mb=Tf(),Na=Rf(),ht=er();async function La(t,e){kt(t);let r=Ba(t,Lb.default,e),n=await Promise.all(r);return ht.array.flatten(n)}(function(t){t.glob=t,t.globSync=e,t.globStream=r,t.async=t;function e(c,l){kt(c);let d=Ba(c,Mb.default,l);return ht.array.flatten(d)}t.sync=e;function r(c,l){kt(c);let d=Ba(c,Bb.default,l);return ht.stream.merge(d)}t.stream=r;function n(c,l){kt(c);let d=[].concat(c),f=new Na.default(l);return Pf.generate(d,f)}t.generateTasks=n;function s(c,l){kt(c);let d=new Na.default(l);return ht.pattern.isDynamicPattern(c,d)}t.isDynamicPattern=s;function i(c){return kt(c),ht.path.escape(c)}t.escapePath=i;function o(c){return kt(c),ht.path.convertPathToPattern(c)}t.convertPathToPattern=o;let a;(function(c){function l(f){return kt(f),ht.path.escapePosixPath(f)}c.escapePath=l;function d(f){return kt(f),ht.path.convertPosixPathToPattern(f)}c.convertPathToPattern=d})(a=t.posix||(t.posix={}));let u;(function(c){function l(f){return kt(f),ht.path.escapeWindowsPath(f)}c.escapePath=l;function d(f){return kt(f),ht.path.convertWindowsPathToPattern(f)}c.convertPathToPattern=d})(u=t.win32||(t.win32={}))})(La||(La={}));function Ba(t,e,r){let n=[].concat(t),s=new Na.default(r),i=Pf.generate(n,s),o=new e(s);return i.map(o.read,o)}function kt(t){if(![].concat(t).every(n=>ht.string.isString(n)&&!ht.string.isEmpty(n)))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}Of.exports=La});var Zn=v(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.getParsedType=_e.ZodParsedType=_e.objectUtil=_e.util=void 0;var Ma;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function r(s){throw new Error}t.assertNever=r,t.arrayToEnum=s=>{let i={};for(let o of s)i[o]=o;return i},t.getValidEnumValues=s=>{let i=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(let a of i)o[a]=s[a];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let i=[];for(let o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(let o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(Ma||(_e.util=Ma={}));var Lf;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Lf||(_e.objectUtil=Lf={}));_e.ZodParsedType=Ma.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var qb=t=>{switch(typeof t){case"undefined":return _e.ZodParsedType.undefined;case"string":return _e.ZodParsedType.string;case"number":return Number.isNaN(t)?_e.ZodParsedType.nan:_e.ZodParsedType.number;case"boolean":return _e.ZodParsedType.boolean;case"function":return _e.ZodParsedType.function;case"bigint":return _e.ZodParsedType.bigint;case"symbol":return _e.ZodParsedType.symbol;case"object":return Array.isArray(t)?_e.ZodParsedType.array:t===null?_e.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?_e.ZodParsedType.promise:typeof Map<"u"&&t instanceof Map?_e.ZodParsedType.map:typeof Set<"u"&&t instanceof Set?_e.ZodParsedType.set:typeof Date<"u"&&t instanceof Date?_e.ZodParsedType.date:_e.ZodParsedType.object;default:return _e.ZodParsedType.unknown}};_e.getParsedType=qb});var Qs=v(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.ZodError=_r.quotelessJson=_r.ZodIssueCode=void 0;var Bf=Zn();_r.ZodIssueCode=Bf.util.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"]);var Wb=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");_r.quotelessJson=Wb;var Un=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},s=i=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let a=n,u=0;for(;u<o.path.length;){let c=o.path[u];u===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(r(o))):a[c]=a[c]||{_errors:[]},a=a[c],u++}}};return s(this),n}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,Bf.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let s of this.issues)if(s.path.length>0){let i=s.path[0];r[i]=r[i]||[],r[i].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};_r.ZodError=Un;Un.create=t=>new Un(t)});var Wa=v(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});var Me=Qs(),Lr=Zn(),Hb=(t,e)=>{let r;switch(t.code){case Me.ZodIssueCode.invalid_type:t.received===Lr.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Me.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Lr.util.jsonStringifyReplacer)}`;break;case Me.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${Lr.util.joinValues(t.keys,", ")}`;break;case Me.ZodIssueCode.invalid_union:r="Invalid input";break;case Me.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Lr.util.joinValues(t.options)}`;break;case Me.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${Lr.util.joinValues(t.options)}, received '${t.received}'`;break;case Me.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case Me.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case Me.ZodIssueCode.invalid_date:r="Invalid date";break;case Me.ZodIssueCode.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Lr.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Me.ZodIssueCode.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Me.ZodIssueCode.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Me.ZodIssueCode.custom:r="Invalid input";break;case Me.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case Me.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Me.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,Lr.util.assertNever(t)}return{message:r}};qa.default=Hb});var eo=v(br=>{"use strict";var Zb=br&&br.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(br,"__esModule",{value:!0});br.defaultErrorMap=void 0;br.setErrorMap=Ub;br.getErrorMap=Vb;var Mf=Zb(Wa());br.defaultErrorMap=Mf.default;var qf=Mf.default;function Ub(t){qf=t}function Vb(){return qf}});var Za=v(ge=>{"use strict";var Gb=ge&&ge.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ge,"__esModule",{value:!0});ge.isAsync=ge.isValid=ge.isDirty=ge.isAborted=ge.OK=ge.DIRTY=ge.INVALID=ge.ParseStatus=ge.EMPTY_PATH=ge.makeIssue=void 0;ge.addIssueToContext=Jb;var zb=eo(),Wf=Gb(Wa()),Yb=t=>{let{data:e,path:r,errorMaps:n,issueData:s}=t,i=[...r,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="",u=n.filter(c=>!!c).slice().reverse();for(let c of u)a=c(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}};ge.makeIssue=Yb;ge.EMPTY_PATH=[];function Jb(t,e){let r=(0,zb.getErrorMap)(),n=(0,ge.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Wf.default?void 0:Wf.default].filter(s=>!!s)});t.common.issues.push(n)}var Ha=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let s of r){if(s.status==="aborted")return ge.INVALID;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let s of r){let i=await s.key,o=await s.value;n.push({key:i,value:o})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let s of r){let{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return ge.INVALID;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(n[i.value]=o.value)}return{status:e.value,value:n}}};ge.ParseStatus=Ha;ge.INVALID=Object.freeze({status:"aborted"});var Xb=t=>({status:"dirty",value:t});ge.DIRTY=Xb;var Kb=t=>({status:"valid",value:t});ge.OK=Kb;var Qb=t=>t.status==="aborted";ge.isAborted=Qb;var eS=t=>t.status==="dirty";ge.isDirty=eS;var tS=t=>t.status==="valid";ge.isValid=tS;var rS=t=>typeof Promise<"u"&&t instanceof Promise;ge.isAsync=rS});var Zf=v(Hf=>{"use strict";Object.defineProperty(Hf,"__esModule",{value:!0})});var Vf=v(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});to.errorUtil=void 0;var Uf;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Uf||(to.errorUtil=Uf={}))});var sh=v(S=>{"use strict";Object.defineProperty(S,"__esModule",{value:!0});S.discriminatedUnion=S.date=S.boolean=S.bigint=S.array=S.any=S.coerce=S.ZodFirstPartyTypeKind=S.late=S.ZodSchema=S.Schema=S.ZodReadonly=S.ZodPipeline=S.ZodBranded=S.BRAND=S.ZodNaN=S.ZodCatch=S.ZodDefault=S.ZodNullable=S.ZodOptional=S.ZodTransformer=S.ZodEffects=S.ZodPromise=S.ZodNativeEnum=S.ZodEnum=S.ZodLiteral=S.ZodLazy=S.ZodFunction=S.ZodSet=S.ZodMap=S.ZodRecord=S.ZodTuple=S.ZodIntersection=S.ZodDiscriminatedUnion=S.ZodUnion=S.ZodObject=S.ZodArray=S.ZodVoid=S.ZodNever=S.ZodUnknown=S.ZodAny=S.ZodNull=S.ZodUndefined=S.ZodSymbol=S.ZodDate=S.ZodBoolean=S.ZodBigInt=S.ZodNumber=S.ZodString=S.ZodType=void 0;S.NEVER=S.void=S.unknown=S.union=S.undefined=S.tuple=S.transformer=S.symbol=S.string=S.strictObject=S.set=S.record=S.promise=S.preprocess=S.pipeline=S.ostring=S.optional=S.onumber=S.oboolean=S.object=S.number=S.nullable=S.null=S.never=S.nativeEnum=S.nan=S.map=S.literal=S.lazy=S.intersection=S.instanceof=S.function=S.enum=S.effect=void 0;S.datetimeRegex=Xf;S.custom=Qf;var O=Qs(),ro=eo(),K=Vf(),E=Za(),L=Zn(),mt=class{constructor(e,r,n,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=s}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}},Gf=(t,e)=>{if((0,E.isValid)(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 r=new O.ZodError(t.common.issues);return this._error=r,this._error}}};function ae(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:s}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>{let{message:u}=t;return o.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:u??n??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:u??r??a.defaultError}},description:s}}var ue=class{get description(){return this._def.description}_getType(e){return(0,L.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,L.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new E.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,L.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,E.isAsync)(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,L.getParsedType)(e)},s=this._parseSync({data:e,path:n.path,parent:n});return Gf(n,s)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,L.getParsedType)(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return(0,E.isValid)(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>(0,E.isValid)(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,L.getParsedType)(e)},s=this._parse({data:e,path:n.path,parent:n}),i=await((0,E.isAsync)(s)?s:Promise.resolve(s));return Gf(n,i)}refine(e,r){let n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,i)=>{let o=e(s),a=()=>i.addIssue({code:O.ZodIssueCode.custom,...n(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(u=>u?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(e){return new ut({schema:this,typeName:se.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:r=>this["~validate"](r)}}optional(){return pt.create(this,this._def)}nullable(){return Ut.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return nr.create(this)}promise(){return Cr.create(this,this._def)}or(e){return Ur.create([this,e],this._def)}and(e){return Vr.create(this,e,this._def)}transform(e){return new ut({...ae(this._def),schema:this,typeName:se.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Xr({...ae(this._def),innerType:this,defaultValue:r,typeName:se.ZodDefault})}brand(){return new Vn({typeName:se.ZodBranded,type:this,...ae(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Kr({...ae(this._def),innerType:this,catchValue:r,typeName:se.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Gn.create(this,e)}readonly(){return Qr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};S.ZodType=ue;S.Schema=ue;S.ZodSchema=ue;var nS=/^c[^\s-]{8,}$/i,sS=/^[0-9a-z]+$/,oS=/^[0-9A-HJKMNP-TV-Z]{26}$/i,iS=/^[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,aS=/^[a-z0-9_-]{21}$/i,uS=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,cS=/^[-+]?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)?)??$/,lS=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,dS="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ua,fS=/^(?:(?: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])$/,hS=/^(?:(?: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])$/,pS=/^(([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]))$/,mS=/^(([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])$/,gS=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,DS=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Yf="((\\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])))",yS=new RegExp(`^${Yf}$`);function Jf(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function vS(t){return new RegExp(`^${Jf(t)}$`)}function Xf(t){let e=`${Yf}T${Jf(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function _S(t,e){return!!((e==="v4"||!e)&&fS.test(t)||(e==="v6"||!e)&&pS.test(t))}function bS(t,e){if(!uS.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function SS(t,e){return!!((e==="v4"||!e)&&hS.test(t)||(e==="v6"||!e)&&mS.test(t))}var Sr=class t extends ue{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==L.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(i,{code:O.ZodIssueCode.invalid_type,expected:L.ZodParsedType.string,received:i.parsedType}),E.INVALID}let n=new E.ParseStatus,s;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:O.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:O.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?(0,E.addIssueToContext)(s,{code:O.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&(0,E.addIssueToContext)(s,{code:O.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")lS.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"email",code:O.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Ua||(Ua=new RegExp(dS,"u")),Ua.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"emoji",code:O.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")iS.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"uuid",code:O.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")aS.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"nanoid",code:O.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")nS.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"cuid",code:O.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")sS.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"cuid2",code:O.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")oS.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"ulid",code:O.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"url",code:O.ZodIssueCode.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"regex",code:O.ZodIssueCode.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:O.ZodIssueCode.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:O.ZodIssueCode.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:O.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Xf(i).test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:O.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?yS.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:O.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?vS(i).test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:O.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?cS.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"duration",code:O.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?_S(e.data,i.version)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"ip",code:O.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?bS(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"jwt",code:O.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?SS(e.data,i.version)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"cidr",code:O.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?gS.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"base64",code:O.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?DS.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"base64url",code:O.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):L.util.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(s=>e.test(s),{validation:r,code:O.ZodIssueCode.invalid_string,...K.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...K.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...K.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...K.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...K.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...K.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...K.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...K.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...K.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...K.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...K.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...K.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...K.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...K.errorUtil.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,...K.errorUtil.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,...K.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...K.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...K.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...K.errorUtil.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...K.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...K.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...K.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...K.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...K.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,K.errorUtil.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 r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};S.ZodString=Sr;Sr.create=t=>new Sr({checks:[],typeName:se.ZodString,coerce:t?.coerce??!1,...ae(t)});function ES(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}var Br=class t extends ue{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)!==L.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(i,{code:O.ZodIssueCode.invalid_type,expected:L.ZodParsedType.number,received:i.parsedType}),E.INVALID}let n,s=new E.ParseStatus;for(let i of this._def.checks)i.kind==="int"?L.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:O.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:O.ZodIssueCode.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:O.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?ES(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:O.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:O.ZodIssueCode.not_finite,message:i.message}),s.dirty()):L.util.assertNever(i);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,K.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,K.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,K.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,K.errorUtil.toString(r))}setLimit(e,r,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:K.errorUtil.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:K.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:K.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:K.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:K.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:K.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:K.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:K.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:K.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:K.errorUtil.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&L.util.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};S.ZodNumber=Br;Br.create=t=>new Br({checks:[],typeName:se.ZodNumber,coerce:t?.coerce||!1,...ae(t)});var Mr=class t extends ue{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)!==L.ZodParsedType.bigint)return this._getInvalidInput(e);let n,s=new E.ParseStatus;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:O.ZodIssueCode.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:O.ZodIssueCode.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:O.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):L.util.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(r,{code:O.ZodIssueCode.invalid_type,expected:L.ZodParsedType.bigint,received:r.parsedType}),E.INVALID}gte(e,r){return this.setLimit("min",e,!0,K.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,K.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,K.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,K.errorUtil.toString(r))}setLimit(e,r,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:K.errorUtil.toString(s)}]})}_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:K.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:K.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:K.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:K.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:K.errorUtil.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};S.ZodBigInt=Mr;Mr.create=t=>new Mr({checks:[],typeName:se.ZodBigInt,coerce:t?.coerce??!1,...ae(t)});var qr=class extends ue{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==L.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:O.ZodIssueCode.invalid_type,expected:L.ZodParsedType.boolean,received:n.parsedType}),E.INVALID}return(0,E.OK)(e.data)}};S.ZodBoolean=qr;qr.create=t=>new qr({typeName:se.ZodBoolean,coerce:t?.coerce||!1,...ae(t)});var Wr=class t extends ue{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==L.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(i,{code:O.ZodIssueCode.invalid_type,expected:L.ZodParsedType.date,received:i.parsedType}),E.INVALID}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(i,{code:O.ZodIssueCode.invalid_date}),E.INVALID}let n=new E.ParseStatus,s;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:O.ZodIssueCode.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:O.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):L.util.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:K.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:K.errorUtil.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};S.ZodDate=Wr;Wr.create=t=>new Wr({checks:[],coerce:t?.coerce||!1,typeName:se.ZodDate,...ae(t)});var bn=class extends ue{_parse(e){if(this._getType(e)!==L.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:O.ZodIssueCode.invalid_type,expected:L.ZodParsedType.symbol,received:n.parsedType}),E.INVALID}return(0,E.OK)(e.data)}};S.ZodSymbol=bn;bn.create=t=>new bn({typeName:se.ZodSymbol,...ae(t)});var Hr=class extends ue{_parse(e){if(this._getType(e)!==L.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:O.ZodIssueCode.invalid_type,expected:L.ZodParsedType.undefined,received:n.parsedType}),E.INVALID}return(0,E.OK)(e.data)}};S.ZodUndefined=Hr;Hr.create=t=>new Hr({typeName:se.ZodUndefined,...ae(t)});var Zr=class extends ue{_parse(e){if(this._getType(e)!==L.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:O.ZodIssueCode.invalid_type,expected:L.ZodParsedType.null,received:n.parsedType}),E.INVALID}return(0,E.OK)(e.data)}};S.ZodNull=Zr;Zr.create=t=>new Zr({typeName:se.ZodNull,...ae(t)});var Er=class extends ue{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,E.OK)(e.data)}};S.ZodAny=Er;Er.create=t=>new Er({typeName:se.ZodAny,...ae(t)});var rr=class extends ue{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,E.OK)(e.data)}};S.ZodUnknown=rr;rr.create=t=>new rr({typeName:se.ZodUnknown,...ae(t)});var $t=class extends ue{_parse(e){let r=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(r,{code:O.ZodIssueCode.invalid_type,expected:L.ZodParsedType.never,received:r.parsedType}),E.INVALID}};S.ZodNever=$t;$t.create=t=>new $t({typeName:se.ZodNever,...ae(t)});var Sn=class extends ue{_parse(e){if(this._getType(e)!==L.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:O.ZodIssueCode.invalid_type,expected:L.ZodParsedType.void,received:n.parsedType}),E.INVALID}return(0,E.OK)(e.data)}};S.ZodVoid=Sn;Sn.create=t=>new Sn({typeName:se.ZodVoid,...ae(t)});var nr=class t extends ue{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),s=this._def;if(r.parsedType!==L.ZodParsedType.array)return(0,E.addIssueToContext)(r,{code:O.ZodIssueCode.invalid_type,expected:L.ZodParsedType.array,received:r.parsedType}),E.INVALID;if(s.exactLength!==null){let o=r.data.length>s.exactLength.value,a=r.data.length<s.exactLength.value;(o||a)&&((0,E.addIssueToContext)(r,{code:o?O.ZodIssueCode.too_big:O.ZodIssueCode.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&((0,E.addIssueToContext)(r,{code:O.ZodIssueCode.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&((0,E.addIssueToContext)(r,{code:O.ZodIssueCode.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,a)=>s.type._parseAsync(new mt(r,o,r.path,a)))).then(o=>E.ParseStatus.mergeArray(n,o));let i=[...r.data].map((o,a)=>s.type._parseSync(new mt(r,o,r.path,a)));return E.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:K.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:K.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:K.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};S.ZodArray=nr;nr.create=(t,e)=>new nr({type:t,minLength:null,maxLength:null,exactLength:null,typeName:se.ZodArray,...ae(e)});function _n(t){if(t instanceof tt){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=pt.create(_n(n))}return new tt({...t._def,shape:()=>e})}else return t instanceof nr?new nr({...t._def,type:_n(t.element)}):t instanceof pt?pt.create(_n(t.unwrap())):t instanceof Ut?Ut.create(_n(t.unwrap())):t instanceof Zt?Zt.create(t.items.map(e=>_n(e))):t}var tt=class t extends ue{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(),r=L.util.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==L.ZodParsedType.object){let c=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(c,{code:O.ZodIssueCode.invalid_type,expected:L.ZodParsedType.object,received:c.parsedType}),E.INVALID}let{status:n,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof $t&&this._def.unknownKeys==="strip"))for(let c in s.data)o.includes(c)||a.push(c);let u=[];for(let c of o){let l=i[c],d=s.data[c];u.push({key:{status:"valid",value:c},value:l._parse(new mt(s,d,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof $t){let c=this._def.unknownKeys;if(c==="passthrough")for(let l of a)u.push({key:{status:"valid",value:l},value:{status:"valid",value:s.data[l]}});else if(c==="strict")a.length>0&&((0,E.addIssueToContext)(s,{code:O.ZodIssueCode.unrecognized_keys,keys:a}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let l of a){let d=s.data[l];u.push({key:{status:"valid",value:l},value:c._parse(new mt(s,d,s.path,l)),alwaysSet:l in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let c=[];for(let l of u){let d=await l.key,f=await l.value;c.push({key:d,value:f,alwaysSet:l.alwaysSet})}return c}).then(c=>E.ParseStatus.mergeObjectSync(n,c)):E.ParseStatus.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return K.errorUtil.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let s=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:K.errorUtil.errToObj(e).message??s}:{message:s}}}:{}})}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:se.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of L.util.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of L.util.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return _n(this)}partial(e){let r={};for(let n of L.util.objectKeys(this.shape)){let s=this.shape[n];e&&!e[n]?r[n]=s:r[n]=s.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of L.util.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof pt;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return Kf(L.util.objectKeys(this.shape))}};S.ZodObject=tt;tt.create=(t,e)=>new tt({shape:()=>t,unknownKeys:"strip",catchall:$t.create(),typeName:se.ZodObject,...ae(e)});tt.strictCreate=(t,e)=>new tt({shape:()=>t,unknownKeys:"strict",catchall:$t.create(),typeName:se.ZodObject,...ae(e)});tt.lazycreate=(t,e)=>new tt({shape:t,unknownKeys:"strip",catchall:$t.create(),typeName:se.ZodObject,...ae(e)});var Ur=class extends ue{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function s(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(a=>new O.ZodError(a.ctx.common.issues));return(0,E.addIssueToContext)(r,{code:O.ZodIssueCode.invalid_union,unionErrors:o}),E.INVALID}if(r.common.async)return Promise.all(n.map(async i=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(s);{let i,o=[];for(let u of n){let c={...r,common:{...r.common,issues:[]},parent:null},l=u._parseSync({data:r.data,path:r.path,parent:c});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=o.map(u=>new O.ZodError(u));return(0,E.addIssueToContext)(r,{code:O.ZodIssueCode.invalid_union,unionErrors:a}),E.INVALID}}get options(){return this._def.options}};S.ZodUnion=Ur;Ur.create=(t,e)=>new Ur({options:t,typeName:se.ZodUnion,...ae(e)});var tr=t=>t instanceof Gr?tr(t.schema):t instanceof ut?tr(t.innerType()):t instanceof zr?[t.value]:t instanceof Yr?t.options:t instanceof Jr?L.util.objectValues(t.enum):t instanceof Xr?tr(t._def.innerType):t instanceof Hr?[void 0]:t instanceof Zr?[null]:t instanceof pt?[void 0,...tr(t.unwrap())]:t instanceof Ut?[null,...tr(t.unwrap())]:t instanceof Vn||t instanceof Qr?tr(t.unwrap()):t instanceof Kr?tr(t._def.innerType):[],no=class t extends ue{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==L.ZodParsedType.object)return(0,E.addIssueToContext)(r,{code:O.ZodIssueCode.invalid_type,expected:L.ZodParsedType.object,received:r.parsedType}),E.INVALID;let n=this.discriminator,s=r.data[n],i=this.optionsMap.get(s);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):((0,E.addIssueToContext)(r,{code:O.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),E.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let s=new Map;for(let i of r){let o=tr(i.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(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,i)}}return new t({typeName:se.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,...ae(n)})}};S.ZodDiscriminatedUnion=no;function Va(t,e){let r=(0,L.getParsedType)(t),n=(0,L.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===L.ZodParsedType.object&&n===L.ZodParsedType.object){let s=L.util.objectKeys(e),i=L.util.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(let a of i){let u=Va(t[a],e[a]);if(!u.valid)return{valid:!1};o[a]=u.data}return{valid:!0,data:o}}else if(r===L.ZodParsedType.array&&n===L.ZodParsedType.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let i=0;i<t.length;i++){let o=t[i],a=e[i],u=Va(o,a);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return r===L.ZodParsedType.date&&n===L.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Vr=class extends ue{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=(i,o)=>{if((0,E.isAborted)(i)||(0,E.isAborted)(o))return E.INVALID;let a=Va(i.value,o.value);return a.valid?(((0,E.isDirty)(i)||(0,E.isDirty)(o))&&r.dirty(),{status:r.value,value:a.data}):((0,E.addIssueToContext)(n,{code:O.ZodIssueCode.invalid_intersection_types}),E.INVALID)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};S.ZodIntersection=Vr;Vr.create=(t,e,r)=>new Vr({left:t,right:e,typeName:se.ZodIntersection,...ae(r)});var Zt=class t extends ue{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==L.ZodParsedType.array)return(0,E.addIssueToContext)(n,{code:O.ZodIssueCode.invalid_type,expected:L.ZodParsedType.array,received:n.parsedType}),E.INVALID;if(n.data.length<this._def.items.length)return(0,E.addIssueToContext)(n,{code:O.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),E.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,E.addIssueToContext)(n,{code:O.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((o,a)=>{let u=this._def.items[a]||this._def.rest;return u?u._parse(new mt(n,o,n.path,a)):null}).filter(o=>!!o);return n.common.async?Promise.all(i).then(o=>E.ParseStatus.mergeArray(r,o)):E.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};S.ZodTuple=Zt;Zt.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Zt({items:t,typeName:se.ZodTuple,rest:null,...ae(e)})};var so=class t extends ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==L.ZodParsedType.object)return(0,E.addIssueToContext)(n,{code:O.ZodIssueCode.invalid_type,expected:L.ZodParsedType.object,received:n.parsedType}),E.INVALID;let s=[],i=this._def.keyType,o=this._def.valueType;for(let a in n.data)s.push({key:i._parse(new mt(n,a,n.path,a)),value:o._parse(new mt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?E.ParseStatus.mergeObjectAsync(r,s):E.ParseStatus.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof ue?new t({keyType:e,valueType:r,typeName:se.ZodRecord,...ae(n)}):new t({keyType:Sr.create(),valueType:e,typeName:se.ZodRecord,...ae(r)})}};S.ZodRecord=so;var En=class extends ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==L.ZodParsedType.map)return(0,E.addIssueToContext)(n,{code:O.ZodIssueCode.invalid_type,expected:L.ZodParsedType.map,received:n.parsedType}),E.INVALID;let s=this._def.keyType,i=this._def.valueType,o=[...n.data.entries()].map(([a,u],c)=>({key:s._parse(new mt(n,a,n.path,[c,"key"])),value:i._parse(new mt(n,u,n.path,[c,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let u of o){let c=await u.key,l=await u.value;if(c.status==="aborted"||l.status==="aborted")return E.INVALID;(c.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(c.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let u of o){let c=u.key,l=u.value;if(c.status==="aborted"||l.status==="aborted")return E.INVALID;(c.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(c.value,l.value)}return{status:r.value,value:a}}}};S.ZodMap=En;En.create=(t,e,r)=>new En({valueType:e,keyType:t,typeName:se.ZodMap,...ae(r)});var Cn=class t extends ue{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==L.ZodParsedType.set)return(0,E.addIssueToContext)(n,{code:O.ZodIssueCode.invalid_type,expected:L.ZodParsedType.set,received:n.parsedType}),E.INVALID;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&((0,E.addIssueToContext)(n,{code:O.ZodIssueCode.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&((0,E.addIssueToContext)(n,{code:O.ZodIssueCode.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let i=this._def.valueType;function o(u){let c=new Set;for(let l of u){if(l.status==="aborted")return E.INVALID;l.status==="dirty"&&r.dirty(),c.add(l.value)}return{status:r.value,value:c}}let a=[...n.data.values()].map((u,c)=>i._parse(new mt(n,u,n.path,c)));return n.common.async?Promise.all(a).then(u=>o(u)):o(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:K.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:K.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};S.ZodSet=Cn;Cn.create=(t,e)=>new Cn({valueType:t,minSize:null,maxSize:null,typeName:se.ZodSet,...ae(e)});var oo=class t extends ue{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==L.ZodParsedType.function)return(0,E.addIssueToContext)(r,{code:O.ZodIssueCode.invalid_type,expected:L.ZodParsedType.function,received:r.parsedType}),E.INVALID;function n(a,u){return(0,E.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,ro.getErrorMap)(),ro.defaultErrorMap].filter(c=>!!c),issueData:{code:O.ZodIssueCode.invalid_arguments,argumentsError:u}})}function s(a,u){return(0,E.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,ro.getErrorMap)(),ro.defaultErrorMap].filter(c=>!!c),issueData:{code:O.ZodIssueCode.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof Cr){let a=this;return(0,E.OK)(async function(...u){let c=new O.ZodError([]),l=await a._def.args.parseAsync(u,i).catch(g=>{throw c.addIssue(n(u,g)),c}),d=await Reflect.apply(o,this,l);return await a._def.returns._def.type.parseAsync(d,i).catch(g=>{throw c.addIssue(s(d,g)),c})})}else{let a=this;return(0,E.OK)(function(...u){let c=a._def.args.safeParse(u,i);if(!c.success)throw new O.ZodError([n(u,c.error)]);let l=Reflect.apply(o,this,c.data),d=a._def.returns.safeParse(l,i);if(!d.success)throw new O.ZodError([s(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Zt.create(e).rest(rr.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,r,n){return new t({args:e||Zt.create([]).rest(rr.create()),returns:r||rr.create(),typeName:se.ZodFunction,...ae(n)})}};S.ZodFunction=oo;var Gr=class extends ue{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};S.ZodLazy=Gr;Gr.create=(t,e)=>new Gr({getter:t,typeName:se.ZodLazy,...ae(e)});var zr=class extends ue{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(r,{received:r.data,code:O.ZodIssueCode.invalid_literal,expected:this._def.value}),E.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};S.ZodLiteral=zr;zr.create=(t,e)=>new zr({value:t,typeName:se.ZodLiteral,...ae(e)});function Kf(t,e){return new Yr({values:t,typeName:se.ZodEnum,...ae(e)})}var Yr=class t extends ue{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,E.addIssueToContext)(r,{expected:L.util.joinValues(n),received:r.parsedType,code:O.ZodIssueCode.invalid_type}),E.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,E.addIssueToContext)(r,{received:r.data,code:O.ZodIssueCode.invalid_enum_value,options:n}),E.INVALID}return(0,E.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};S.ZodEnum=Yr;Yr.create=Kf;var Jr=class extends ue{_parse(e){let r=L.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==L.ZodParsedType.string&&n.parsedType!==L.ZodParsedType.number){let s=L.util.objectValues(r);return(0,E.addIssueToContext)(n,{expected:L.util.joinValues(s),received:n.parsedType,code:O.ZodIssueCode.invalid_type}),E.INVALID}if(this._cache||(this._cache=new Set(L.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=L.util.objectValues(r);return(0,E.addIssueToContext)(n,{received:n.data,code:O.ZodIssueCode.invalid_enum_value,options:s}),E.INVALID}return(0,E.OK)(e.data)}get enum(){return this._def.values}};S.ZodNativeEnum=Jr;Jr.create=(t,e)=>new Jr({values:t,typeName:se.ZodNativeEnum,...ae(e)});var Cr=class extends ue{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==L.ZodParsedType.promise&&r.common.async===!1)return(0,E.addIssueToContext)(r,{code:O.ZodIssueCode.invalid_type,expected:L.ZodParsedType.promise,received:r.parsedType}),E.INVALID;let n=r.parsedType===L.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,E.OK)(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}};S.ZodPromise=Cr;Cr.create=(t,e)=>new Cr({type:t,typeName:se.ZodPromise,...ae(e)});var ut=class extends ue{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===se.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{(0,E.addIssueToContext)(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){let o=s.transform(n.data,i);if(n.common.async)return Promise.resolve(o).then(async a=>{if(r.value==="aborted")return E.INVALID;let u=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return u.status==="aborted"?E.INVALID:u.status==="dirty"||r.value==="dirty"?(0,E.DIRTY)(u.value):u});{if(r.value==="aborted")return E.INVALID;let a=this._def.schema._parseSync({data:o,path:n.path,parent:n});return a.status==="aborted"?E.INVALID:a.status==="dirty"||r.value==="dirty"?(0,E.DIRTY)(a.value):a}}if(s.type==="refinement"){let o=a=>{let u=s.refinement(a,i);if(n.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(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?E.INVALID:(a.status==="dirty"&&r.dirty(),o(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?E.INVALID:(a.status==="dirty"&&r.dirty(),o(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,E.isValid)(o))return E.INVALID;let a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>(0,E.isValid)(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:r.value,value:a})):E.INVALID);L.util.assertNever(s)}};S.ZodEffects=ut;S.ZodTransformer=ut;ut.create=(t,e,r)=>new ut({schema:t,typeName:se.ZodEffects,effect:e,...ae(r)});ut.createWithPreprocess=(t,e,r)=>new ut({schema:e,effect:{type:"preprocess",transform:t},typeName:se.ZodEffects,...ae(r)});var pt=class extends ue{_parse(e){return this._getType(e)===L.ZodParsedType.undefined?(0,E.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};S.ZodOptional=pt;pt.create=(t,e)=>new pt({innerType:t,typeName:se.ZodOptional,...ae(e)});var Ut=class extends ue{_parse(e){return this._getType(e)===L.ZodParsedType.null?(0,E.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};S.ZodNullable=Ut;Ut.create=(t,e)=>new Ut({innerType:t,typeName:se.ZodNullable,...ae(e)});var Xr=class extends ue{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===L.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};S.ZodDefault=Xr;Xr.create=(t,e)=>new Xr({innerType:t,typeName:se.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ae(e)});var Kr=class extends ue{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,E.isAsync)(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new O.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new O.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};S.ZodCatch=Kr;Kr.create=(t,e)=>new Kr({innerType:t,typeName:se.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ae(e)});var wn=class extends ue{_parse(e){if(this._getType(e)!==L.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:O.ZodIssueCode.invalid_type,expected:L.ZodParsedType.nan,received:n.parsedType}),E.INVALID}return{status:"valid",value:e.data}}};S.ZodNaN=wn;wn.create=t=>new wn({typeName:se.ZodNaN,...ae(t)});S.BRAND=Symbol("zod_brand");var Vn=class extends ue{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};S.ZodBranded=Vn;var Gn=class t extends ue{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?E.INVALID:i.status==="dirty"?(r.dirty(),(0,E.DIRTY)(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?E.INVALID:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:se.ZodPipeline})}};S.ZodPipeline=Gn;var Qr=class extends ue{_parse(e){let r=this._def.innerType._parse(e),n=s=>((0,E.isValid)(s)&&(s.value=Object.freeze(s.value)),s);return(0,E.isAsync)(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}};S.ZodReadonly=Qr;Qr.create=(t,e)=>new Qr({innerType:t,typeName:se.ZodReadonly,...ae(e)});function zf(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Qf(t,e={},r){return t?Er.create().superRefine((n,s)=>{let i=t(n);if(i instanceof Promise)return i.then(o=>{if(!o){let a=zf(e,n),u=a.fatal??r??!0;s.addIssue({code:"custom",...a,fatal:u})}});if(!i){let o=zf(e,n),a=o.fatal??r??!0;s.addIssue({code:"custom",...o,fatal:a})}}):Er.create()}S.late={object:tt.lazycreate};var se;(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"})(se||(S.ZodFirstPartyTypeKind=se={}));var CS=(t,e={message:`Input not instance of ${t.name}`})=>Qf(r=>r instanceof t,e);S.instanceof=CS;var eh=Sr.create;S.string=eh;var th=Br.create;S.number=th;var wS=wn.create;S.nan=wS;var xS=Mr.create;S.bigint=xS;var rh=qr.create;S.boolean=rh;var kS=Wr.create;S.date=kS;var $S=bn.create;S.symbol=$S;var AS=Hr.create;S.undefined=AS;var FS=Zr.create;S.null=FS;var jS=Er.create;S.any=jS;var IS=rr.create;S.unknown=IS;var TS=$t.create;S.never=TS;var RS=Sn.create;S.void=RS;var PS=nr.create;S.array=PS;var OS=tt.create;S.object=OS;var NS=tt.strictCreate;S.strictObject=NS;var LS=Ur.create;S.union=LS;var BS=no.create;S.discriminatedUnion=BS;var MS=Vr.create;S.intersection=MS;var qS=Zt.create;S.tuple=qS;var WS=so.create;S.record=WS;var HS=En.create;S.map=HS;var ZS=Cn.create;S.set=ZS;var US=oo.create;S.function=US;var VS=Gr.create;S.lazy=VS;var GS=zr.create;S.literal=GS;var zS=Yr.create;S.enum=zS;var YS=Jr.create;S.nativeEnum=YS;var JS=Cr.create;S.promise=JS;var nh=ut.create;S.effect=nh;S.transformer=nh;var XS=pt.create;S.optional=XS;var KS=Ut.create;S.nullable=KS;var QS=ut.createWithPreprocess;S.preprocess=QS;var eE=Gn.create;S.pipeline=eE;var tE=()=>eh().optional();S.ostring=tE;var rE=()=>th().optional();S.onumber=rE;var nE=()=>rh().optional();S.oboolean=nE;S.coerce={string:(t=>Sr.create({...t,coerce:!0})),number:(t=>Br.create({...t,coerce:!0})),boolean:(t=>qr.create({...t,coerce:!0})),bigint:(t=>Mr.create({...t,coerce:!0})),date:(t=>Wr.create({...t,coerce:!0}))};S.NEVER=E.INVALID});var Ga=v(gt=>{"use strict";var sE=gt&&gt.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(e,r);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,s)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),xn=gt&&gt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&sE(e,t,r)};Object.defineProperty(gt,"__esModule",{value:!0});xn(eo(),gt);xn(Za(),gt);xn(Zf(),gt);xn(Zn(),gt);xn(sh(),gt);xn(Qs(),gt)});var za=v(rt=>{"use strict";var oh=rt&&rt.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(e,r);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,s)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),oE=rt&&rt.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),iE=rt&&rt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oh(e,t,r);return oE(e,t),e},aE=rt&&rt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&oh(e,t,r)};Object.defineProperty(rt,"__esModule",{value:!0});rt.z=void 0;var ih=iE(Ga());rt.z=ih;aE(Ga(),rt);rt.default=ih});var zn=v((w2,ah)=>{"use strict";var uE="2.0.0",cE=Number.MAX_SAFE_INTEGER||9007199254740991,lE=16,dE=250,fE=["major","premajor","minor","preminor","patch","prepatch","prerelease"];ah.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:lE,MAX_SAFE_BUILD_LENGTH:dE,MAX_SAFE_INTEGER:cE,RELEASE_TYPES:fE,SEMVER_SPEC_VERSION:uE,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Yn=v((x2,uh)=>{"use strict";var hE=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};uh.exports=hE});var kn=v((Vt,ch)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Ya,MAX_SAFE_BUILD_LENGTH:pE,MAX_LENGTH:mE}=zn(),gE=Yn();Vt=ch.exports={};var DE=Vt.re=[],yE=Vt.safeRe=[],Z=Vt.src=[],vE=Vt.safeSrc=[],U=Vt.t={},_E=0,Ja="[a-zA-Z0-9-]",bE=[["\\s",1],["\\d",mE],[Ja,pE]],SE=t=>{for(let[e,r]of bE)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},ie=(t,e,r)=>{let n=SE(e),s=_E++;gE(t,s,e),U[t]=s,Z[s]=e,vE[s]=n,DE[s]=new RegExp(e,r?"g":void 0),yE[s]=new RegExp(n,r?"g":void 0)};ie("NUMERICIDENTIFIER","0|[1-9]\\d*");ie("NUMERICIDENTIFIERLOOSE","\\d+");ie("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Ja}*`);ie("MAINVERSION",`(${Z[U.NUMERICIDENTIFIER]})\\.(${Z[U.NUMERICIDENTIFIER]})\\.(${Z[U.NUMERICIDENTIFIER]})`);ie("MAINVERSIONLOOSE",`(${Z[U.NUMERICIDENTIFIERLOOSE]})\\.(${Z[U.NUMERICIDENTIFIERLOOSE]})\\.(${Z[U.NUMERICIDENTIFIERLOOSE]})`);ie("PRERELEASEIDENTIFIER",`(?:${Z[U.NONNUMERICIDENTIFIER]}|${Z[U.NUMERICIDENTIFIER]})`);ie("PRERELEASEIDENTIFIERLOOSE",`(?:${Z[U.NONNUMERICIDENTIFIER]}|${Z[U.NUMERICIDENTIFIERLOOSE]})`);ie("PRERELEASE",`(?:-(${Z[U.PRERELEASEIDENTIFIER]}(?:\\.${Z[U.PRERELEASEIDENTIFIER]})*))`);ie("PRERELEASELOOSE",`(?:-?(${Z[U.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${Z[U.PRERELEASEIDENTIFIERLOOSE]})*))`);ie("BUILDIDENTIFIER",`${Ja}+`);ie("BUILD",`(?:\\+(${Z[U.BUILDIDENTIFIER]}(?:\\.${Z[U.BUILDIDENTIFIER]})*))`);ie("FULLPLAIN",`v?${Z[U.MAINVERSION]}${Z[U.PRERELEASE]}?${Z[U.BUILD]}?`);ie("FULL",`^${Z[U.FULLPLAIN]}$`);ie("LOOSEPLAIN",`[v=\\s]*${Z[U.MAINVERSIONLOOSE]}${Z[U.PRERELEASELOOSE]}?${Z[U.BUILD]}?`);ie("LOOSE",`^${Z[U.LOOSEPLAIN]}$`);ie("GTLT","((?:<|>)?=?)");ie("XRANGEIDENTIFIERLOOSE",`${Z[U.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);ie("XRANGEIDENTIFIER",`${Z[U.NUMERICIDENTIFIER]}|x|X|\\*`);ie("XRANGEPLAIN",`[v=\\s]*(${Z[U.XRANGEIDENTIFIER]})(?:\\.(${Z[U.XRANGEIDENTIFIER]})(?:\\.(${Z[U.XRANGEIDENTIFIER]})(?:${Z[U.PRERELEASE]})?${Z[U.BUILD]}?)?)?`);ie("XRANGEPLAINLOOSE",`[v=\\s]*(${Z[U.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Z[U.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Z[U.XRANGEIDENTIFIERLOOSE]})(?:${Z[U.PRERELEASELOOSE]})?${Z[U.BUILD]}?)?)?`);ie("XRANGE",`^${Z[U.GTLT]}\\s*${Z[U.XRANGEPLAIN]}$`);ie("XRANGELOOSE",`^${Z[U.GTLT]}\\s*${Z[U.XRANGEPLAINLOOSE]}$`);ie("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Ya}})(?:\\.(\\d{1,${Ya}}))?(?:\\.(\\d{1,${Ya}}))?`);ie("COERCE",`${Z[U.COERCEPLAIN]}(?:$|[^\\d])`);ie("COERCEFULL",Z[U.COERCEPLAIN]+`(?:${Z[U.PRERELEASE]})?(?:${Z[U.BUILD]})?(?:$|[^\\d])`);ie("COERCERTL",Z[U.COERCE],!0);ie("COERCERTLFULL",Z[U.COERCEFULL],!0);ie("LONETILDE","(?:~>?)");ie("TILDETRIM",`(\\s*)${Z[U.LONETILDE]}\\s+`,!0);Vt.tildeTrimReplace="$1~";ie("TILDE",`^${Z[U.LONETILDE]}${Z[U.XRANGEPLAIN]}$`);ie("TILDELOOSE",`^${Z[U.LONETILDE]}${Z[U.XRANGEPLAINLOOSE]}$`);ie("LONECARET","(?:\\^)");ie("CARETTRIM",`(\\s*)${Z[U.LONECARET]}\\s+`,!0);Vt.caretTrimReplace="$1^";ie("CARET",`^${Z[U.LONECARET]}${Z[U.XRANGEPLAIN]}$`);ie("CARETLOOSE",`^${Z[U.LONECARET]}${Z[U.XRANGEPLAINLOOSE]}$`);ie("COMPARATORLOOSE",`^${Z[U.GTLT]}\\s*(${Z[U.LOOSEPLAIN]})$|^$`);ie("COMPARATOR",`^${Z[U.GTLT]}\\s*(${Z[U.FULLPLAIN]})$|^$`);ie("COMPARATORTRIM",`(\\s*)${Z[U.GTLT]}\\s*(${Z[U.LOOSEPLAIN]}|${Z[U.XRANGEPLAIN]})`,!0);Vt.comparatorTrimReplace="$1$2$3";ie("HYPHENRANGE",`^\\s*(${Z[U.XRANGEPLAIN]})\\s+-\\s+(${Z[U.XRANGEPLAIN]})\\s*$`);ie("HYPHENRANGELOOSE",`^\\s*(${Z[U.XRANGEPLAINLOOSE]})\\s+-\\s+(${Z[U.XRANGEPLAINLOOSE]})\\s*$`);ie("STAR","(<|>)?=?\\s*\\*");ie("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");ie("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var io=v((k2,lh)=>{"use strict";var EE=Object.freeze({loose:!0}),CE=Object.freeze({}),wE=t=>t?typeof t!="object"?EE:t:CE;lh.exports=wE});var Xa=v(($2,hh)=>{"use strict";var dh=/^[0-9]+$/,fh=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=dh.test(t),n=dh.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},xE=(t,e)=>fh(e,t);hh.exports={compareIdentifiers:fh,rcompareIdentifiers:xE}});var qe=v((A2,mh)=>{"use strict";var ao=Yn(),{MAX_LENGTH:ph,MAX_SAFE_INTEGER:uo}=zn(),{safeRe:co,t:lo}=kn(),kE=io(),{compareIdentifiers:Ka}=Xa(),Qa=class t{constructor(e,r){if(r=kE(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>ph)throw new TypeError(`version is longer than ${ph} characters`);ao("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?co[lo.LOOSE]:co[lo.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>uo||this.major<0)throw new TypeError("Invalid major version");if(this.minor>uo||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>uo||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let i=+s;if(i>=0&&i<uo)return i}return s}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(ao("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],s=e.prerelease[r];if(ao("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return Ka(n,s)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],s=e.build[r];if(ao("build compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return Ka(n,s)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let s=`-${r}`.match(this.options.loose?co[lo.PRERELEASELOOSE]:co[lo.PRERELEASE]);if(!s||s[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let i=[r,s];n===!1&&(i=[r]),Ka(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};mh.exports=Qa});var en=v((F2,Dh)=>{"use strict";var gh=qe(),$E=(t,e,r=!1)=>{if(t instanceof gh)return t;try{return new gh(t,e)}catch(n){if(!r)return null;throw n}};Dh.exports=$E});var vh=v((j2,yh)=>{"use strict";var AE=en(),FE=(t,e)=>{let r=AE(t,e);return r?r.version:null};yh.exports=FE});var bh=v((I2,_h)=>{"use strict";var jE=en(),IE=(t,e)=>{let r=jE(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};_h.exports=IE});var Ch=v((T2,Eh)=>{"use strict";var Sh=qe(),TE=(t,e,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new Sh(t instanceof Sh?t.version:t,r).inc(e,n,s).version}catch{return null}};Eh.exports=TE});var kh=v((R2,xh)=>{"use strict";var wh=en(),RE=(t,e)=>{let r=wh(t,null,!0),n=wh(e,null,!0),s=r.compare(n);if(s===0)return null;let i=s>0,o=i?r:n,a=i?n:r,u=!!o.prerelease.length;if(!!a.prerelease.length&&!u){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let l=u?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};xh.exports=RE});var Ah=v((P2,$h)=>{"use strict";var PE=qe(),OE=(t,e)=>new PE(t,e).major;$h.exports=OE});var jh=v((O2,Fh)=>{"use strict";var NE=qe(),LE=(t,e)=>new NE(t,e).minor;Fh.exports=LE});var Th=v((N2,Ih)=>{"use strict";var BE=qe(),ME=(t,e)=>new BE(t,e).patch;Ih.exports=ME});var Ph=v((L2,Rh)=>{"use strict";var qE=en(),WE=(t,e)=>{let r=qE(t,e);return r&&r.prerelease.length?r.prerelease:null};Rh.exports=WE});var Dt=v((B2,Nh)=>{"use strict";var Oh=qe(),HE=(t,e,r)=>new Oh(t,r).compare(new Oh(e,r));Nh.exports=HE});var Bh=v((M2,Lh)=>{"use strict";var ZE=Dt(),UE=(t,e,r)=>ZE(e,t,r);Lh.exports=UE});var qh=v((q2,Mh)=>{"use strict";var VE=Dt(),GE=(t,e)=>VE(t,e,!0);Mh.exports=GE});var fo=v((W2,Hh)=>{"use strict";var Wh=qe(),zE=(t,e,r)=>{let n=new Wh(t,r),s=new Wh(e,r);return n.compare(s)||n.compareBuild(s)};Hh.exports=zE});var Uh=v((H2,Zh)=>{"use strict";var YE=fo(),JE=(t,e)=>t.sort((r,n)=>YE(r,n,e));Zh.exports=JE});var Gh=v((Z2,Vh)=>{"use strict";var XE=fo(),KE=(t,e)=>t.sort((r,n)=>XE(n,r,e));Vh.exports=KE});var Jn=v((U2,zh)=>{"use strict";var QE=Dt(),eC=(t,e,r)=>QE(t,e,r)>0;zh.exports=eC});var ho=v((V2,Yh)=>{"use strict";var tC=Dt(),rC=(t,e,r)=>tC(t,e,r)<0;Yh.exports=rC});var eu=v((G2,Jh)=>{"use strict";var nC=Dt(),sC=(t,e,r)=>nC(t,e,r)===0;Jh.exports=sC});var tu=v((z2,Xh)=>{"use strict";var oC=Dt(),iC=(t,e,r)=>oC(t,e,r)!==0;Xh.exports=iC});var po=v((Y2,Kh)=>{"use strict";var aC=Dt(),uC=(t,e,r)=>aC(t,e,r)>=0;Kh.exports=uC});var mo=v((J2,Qh)=>{"use strict";var cC=Dt(),lC=(t,e,r)=>cC(t,e,r)<=0;Qh.exports=lC});var ru=v((X2,ep)=>{"use strict";var dC=eu(),fC=tu(),hC=Jn(),pC=po(),mC=ho(),gC=mo(),DC=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return dC(t,r,n);case"!=":return fC(t,r,n);case">":return hC(t,r,n);case">=":return pC(t,r,n);case"<":return mC(t,r,n);case"<=":return gC(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};ep.exports=DC});var rp=v((K2,tp)=>{"use strict";var yC=qe(),vC=en(),{safeRe:go,t:Do}=kn(),_C=(t,e)=>{if(t instanceof yC)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?go[Do.COERCEFULL]:go[Do.COERCE]);else{let u=e.includePrerelease?go[Do.COERCERTLFULL]:go[Do.COERCERTL],c;for(;(c=u.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||c.index+c[0].length!==r.index+r[0].length)&&(r=c),u.lastIndex=c.index+c[1].length+c[2].length;u.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",i=r[4]||"0",o=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return vC(`${n}.${s}.${i}${o}${a}`,e)};tp.exports=_C});var sp=v((Q2,np)=>{"use strict";var nu=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let s=this.map.keys().next().value;this.delete(s)}this.map.set(e,r)}return this}};np.exports=nu});var yt=v((eI,up)=>{"use strict";var bC=/\s+/g,su=class t{constructor(e,r){if(r=EC(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof ou)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(bC," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(s=>!ip(s[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&FC(s[0])){this.set=[s];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&$C)|(this.options.loose&&AC))+":"+e,s=op.get(n);if(s)return s;let i=this.options.loose,o=i?Ge[We.HYPHENRANGELOOSE]:Ge[We.HYPHENRANGE];e=e.replace(o,MC(this.options.includePrerelease)),we("hyphen replace",e),e=e.replace(Ge[We.COMPARATORTRIM],wC),we("comparator trim",e),e=e.replace(Ge[We.TILDETRIM],xC),we("tilde trim",e),e=e.replace(Ge[We.CARETTRIM],kC),we("caret trim",e);let a=e.split(" ").map(d=>jC(d,this.options)).join(" ").split(/\s+/).map(d=>BC(d,this.options));i&&(a=a.filter(d=>(we("loose invalid filter",d,this.options),!!d.match(Ge[We.COMPARATORLOOSE])))),we("range list",a);let u=new Map,c=a.map(d=>new ou(d,this.options));for(let d of c){if(ip(d))return[d];u.set(d.value,d)}u.size>1&&u.has("")&&u.delete("");let l=[...u.values()];return op.set(n,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>ap(n,r)&&e.set.some(s=>ap(s,r)&&n.every(i=>s.every(o=>i.intersects(o,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new CC(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(qC(this.set[r],e,this.options))return!0;return!1}};up.exports=su;var SC=sp(),op=new SC,EC=io(),ou=Xn(),we=Yn(),CC=qe(),{safeRe:Ge,t:We,comparatorTrimReplace:wC,tildeTrimReplace:xC,caretTrimReplace:kC}=kn(),{FLAG_INCLUDE_PRERELEASE:$C,FLAG_LOOSE:AC}=zn(),ip=t=>t.value==="<0.0.0-0",FC=t=>t.value==="",ap=(t,e)=>{let r=!0,n=t.slice(),s=n.pop();for(;r&&n.length;)r=n.every(i=>s.intersects(i,e)),s=n.pop();return r},jC=(t,e)=>(t=t.replace(Ge[We.BUILD],""),we("comp",t,e),t=RC(t,e),we("caret",t),t=IC(t,e),we("tildes",t),t=OC(t,e),we("xrange",t),t=LC(t,e),we("stars",t),t),ze=t=>!t||t.toLowerCase()==="x"||t==="*",IC=(t,e)=>t.trim().split(/\s+/).map(r=>TC(r,e)).join(" "),TC=(t,e)=>{let r=e.loose?Ge[We.TILDELOOSE]:Ge[We.TILDE];return t.replace(r,(n,s,i,o,a)=>{we("tilde",t,n,s,i,o,a);let u;return ze(s)?u="":ze(i)?u=`>=${s}.0.0 <${+s+1}.0.0-0`:ze(o)?u=`>=${s}.${i}.0 <${s}.${+i+1}.0-0`:a?(we("replaceTilde pr",a),u=`>=${s}.${i}.${o}-${a} <${s}.${+i+1}.0-0`):u=`>=${s}.${i}.${o} <${s}.${+i+1}.0-0`,we("tilde return",u),u})},RC=(t,e)=>t.trim().split(/\s+/).map(r=>PC(r,e)).join(" "),PC=(t,e)=>{we("caret",t,e);let r=e.loose?Ge[We.CARETLOOSE]:Ge[We.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(s,i,o,a,u)=>{we("caret",t,s,i,o,a,u);let c;return ze(i)?c="":ze(o)?c=`>=${i}.0.0${n} <${+i+1}.0.0-0`:ze(a)?i==="0"?c=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`:c=`>=${i}.${o}.0${n} <${+i+1}.0.0-0`:u?(we("replaceCaret pr",u),i==="0"?o==="0"?c=`>=${i}.${o}.${a}-${u} <${i}.${o}.${+a+1}-0`:c=`>=${i}.${o}.${a}-${u} <${i}.${+o+1}.0-0`:c=`>=${i}.${o}.${a}-${u} <${+i+1}.0.0-0`):(we("no pr"),i==="0"?o==="0"?c=`>=${i}.${o}.${a}${n} <${i}.${o}.${+a+1}-0`:c=`>=${i}.${o}.${a}${n} <${i}.${+o+1}.0-0`:c=`>=${i}.${o}.${a} <${+i+1}.0.0-0`),we("caret return",c),c})},OC=(t,e)=>(we("replaceXRanges",t,e),t.split(/\s+/).map(r=>NC(r,e)).join(" ")),NC=(t,e)=>{t=t.trim();let r=e.loose?Ge[We.XRANGELOOSE]:Ge[We.XRANGE];return t.replace(r,(n,s,i,o,a,u)=>{we("xRange",t,n,s,i,o,a,u);let c=ze(i),l=c||ze(o),d=l||ze(a),f=d;return s==="="&&f&&(s=""),u=e.includePrerelease?"-0":"",c?s===">"||s==="<"?n="<0.0.0-0":n="*":s&&f?(l&&(o=0),a=0,s===">"?(s=">=",l?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):s==="<="&&(s="<",l?i=+i+1:o=+o+1),s==="<"&&(u="-0"),n=`${s+i}.${o}.${a}${u}`):l?n=`>=${i}.0.0${u} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${o}.0${u} <${i}.${+o+1}.0-0`),we("xRange return",n),n})},LC=(t,e)=>(we("replaceStars",t,e),t.trim().replace(Ge[We.STAR],"")),BC=(t,e)=>(we("replaceGTE0",t,e),t.trim().replace(Ge[e.includePrerelease?We.GTE0PRE:We.GTE0],"")),MC=t=>(e,r,n,s,i,o,a,u,c,l,d,f)=>(ze(n)?r="":ze(s)?r=`>=${n}.0.0${t?"-0":""}`:ze(i)?r=`>=${n}.${s}.0${t?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,ze(c)?u="":ze(l)?u=`<${+c+1}.0.0-0`:ze(d)?u=`<${c}.${+l+1}.0-0`:f?u=`<=${c}.${l}.${d}-${f}`:t?u=`<${c}.${l}.${+d+1}-0`:u=`<=${u}`,`${r} ${u}`.trim()),qC=(t,e,r)=>{for(let n=0;n<t.length;n++)if(!t[n].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let n=0;n<t.length;n++)if(we(t[n].semver),t[n].semver!==ou.ANY&&t[n].semver.prerelease.length>0){let s=t[n].semver;if(s.major===e.major&&s.minor===e.minor&&s.patch===e.patch)return!0}return!1}return!0}});var Xn=v((tI,pp)=>{"use strict";var Kn=Symbol("SemVer ANY"),uu=class t{static get ANY(){return Kn}constructor(e,r){if(r=cp(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),au("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===Kn?this.value="":this.value=this.operator+this.semver.version,au("comp",this)}parse(e){let r=this.options.loose?lp[dp.COMPARATORLOOSE]:lp[dp.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new fp(n[2],this.options.loose):this.semver=Kn}toString(){return this.value}test(e){if(au("Comparator.test",e,this.options.loose),this.semver===Kn||e===Kn)return!0;if(typeof e=="string")try{e=new fp(e,this.options)}catch{return!1}return iu(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new hp(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new hp(this.value,r).test(e.semver):(r=cp(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||iu(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||iu(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};pp.exports=uu;var cp=io(),{safeRe:lp,t:dp}=kn(),iu=ru(),au=Yn(),fp=qe(),hp=yt()});var Qn=v((rI,mp)=>{"use strict";var WC=yt(),HC=(t,e,r)=>{try{e=new WC(e,r)}catch{return!1}return e.test(t)};mp.exports=HC});var Dp=v((nI,gp)=>{"use strict";var ZC=yt(),UC=(t,e)=>new ZC(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));gp.exports=UC});var vp=v((sI,yp)=>{"use strict";var VC=qe(),GC=yt(),zC=(t,e,r)=>{let n=null,s=null,i=null;try{i=new GC(e,r)}catch{return null}return t.forEach(o=>{i.test(o)&&(!n||s.compare(o)===-1)&&(n=o,s=new VC(n,r))}),n};yp.exports=zC});var bp=v((oI,_p)=>{"use strict";var YC=qe(),JC=yt(),XC=(t,e,r)=>{let n=null,s=null,i=null;try{i=new JC(e,r)}catch{return null}return t.forEach(o=>{i.test(o)&&(!n||s.compare(o)===1)&&(n=o,s=new YC(n,r))}),n};_p.exports=XC});var Cp=v((iI,Ep)=>{"use strict";var cu=qe(),KC=yt(),Sp=Jn(),QC=(t,e)=>{t=new KC(t,e);let r=new cu("0.0.0");if(t.test(r)||(r=new cu("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n<t.set.length;++n){let s=t.set[n],i=null;s.forEach(o=>{let a=new cu(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||Sp(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||Sp(r,i))&&(r=i)}return r&&t.test(r)?r:null};Ep.exports=QC});var xp=v((aI,wp)=>{"use strict";var ew=yt(),tw=(t,e)=>{try{return new ew(t,e).range||"*"}catch{return null}};wp.exports=tw});var yo=v((uI,Fp)=>{"use strict";var rw=qe(),Ap=Xn(),{ANY:nw}=Ap,sw=yt(),ow=Qn(),kp=Jn(),$p=ho(),iw=mo(),aw=po(),uw=(t,e,r,n)=>{t=new rw(t,n),e=new sw(e,n);let s,i,o,a,u;switch(r){case">":s=kp,i=iw,o=$p,a=">",u=">=";break;case"<":s=$p,i=aw,o=kp,a="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(ow(t,e,n))return!1;for(let c=0;c<e.set.length;++c){let l=e.set[c],d=null,f=null;if(l.forEach(g=>{g.semver===nw&&(g=new Ap(">=0.0.0")),d=d||g,f=f||g,s(g.semver,d.semver,n)?d=g:o(g.semver,f.semver,n)&&(f=g)}),d.operator===a||d.operator===u||(!f.operator||f.operator===a)&&i(t,f.semver))return!1;if(f.operator===u&&o(t,f.semver))return!1}return!0};Fp.exports=uw});var Ip=v((cI,jp)=>{"use strict";var cw=yo(),lw=(t,e,r)=>cw(t,e,">",r);jp.exports=lw});var Rp=v((lI,Tp)=>{"use strict";var dw=yo(),fw=(t,e,r)=>dw(t,e,"<",r);Tp.exports=fw});var Np=v((dI,Op)=>{"use strict";var Pp=yt(),hw=(t,e,r)=>(t=new Pp(t,r),e=new Pp(e,r),t.intersects(e,r));Op.exports=hw});var Bp=v((fI,Lp)=>{"use strict";var pw=Qn(),mw=Dt();Lp.exports=(t,e,r)=>{let n=[],s=null,i=null,o=t.sort((l,d)=>mw(l,d,r));for(let l of o)pw(l,e,r)?(i=l,s||(s=l)):(i&&n.push([s,i]),i=null,s=null);s&&n.push([s,null]);let a=[];for(let[l,d]of n)l===d?a.push(l):!d&&l===o[0]?a.push("*"):d?l===o[0]?a.push(`<=${d}`):a.push(`${l} - ${d}`):a.push(`>=${l}`);let u=a.join(" || "),c=typeof e.raw=="string"?e.raw:String(e);return u.length<c.length?u:e}});var Up=v((hI,Zp)=>{"use strict";var Mp=yt(),du=Xn(),{ANY:lu}=du,es=Qn(),fu=Dt(),gw=(t,e,r={})=>{if(t===e)return!0;t=new Mp(t,r),e=new Mp(e,r);let n=!1;e:for(let s of t.set){for(let i of e.set){let o=yw(s,i,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},Dw=[new du(">=0.0.0-0")],qp=[new du(">=0.0.0")],yw=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===lu){if(e.length===1&&e[0].semver===lu)return!0;r.includePrerelease?t=Dw:t=qp}if(e.length===1&&e[0].semver===lu){if(r.includePrerelease)return!0;e=qp}let n=new Set,s,i;for(let g of t)g.operator===">"||g.operator===">="?s=Wp(s,g,r):g.operator==="<"||g.operator==="<="?i=Hp(i,g,r):n.add(g.semver);if(n.size>1)return null;let o;if(s&&i){if(o=fu(s.semver,i.semver,r),o>0)return null;if(o===0&&(s.operator!==">="||i.operator!=="<="))return null}for(let g of n){if(s&&!es(g,String(s),r)||i&&!es(g,String(i),r))return null;for(let m of e)if(!es(g,String(m),r))return!1;return!0}let a,u,c,l,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,f=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;d&&d.prerelease.length===1&&i.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let g of e){if(l=l||g.operator===">"||g.operator===">=",c=c||g.operator==="<"||g.operator==="<=",s){if(f&&g.semver.prerelease&&g.semver.prerelease.length&&g.semver.major===f.major&&g.semver.minor===f.minor&&g.semver.patch===f.patch&&(f=!1),g.operator===">"||g.operator===">="){if(a=Wp(s,g,r),a===g&&a!==s)return!1}else if(s.operator===">="&&!es(s.semver,String(g),r))return!1}if(i){if(d&&g.semver.prerelease&&g.semver.prerelease.length&&g.semver.major===d.major&&g.semver.minor===d.minor&&g.semver.patch===d.patch&&(d=!1),g.operator==="<"||g.operator==="<="){if(u=Hp(i,g,r),u===g&&u!==i)return!1}else if(i.operator==="<="&&!es(i.semver,String(g),r))return!1}if(!g.operator&&(i||s)&&o!==0)return!1}return!(s&&c&&!i&&o!==0||i&&l&&!s&&o!==0||f||d)},Wp=(t,e,r)=>{if(!t)return e;let n=fu(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},Hp=(t,e,r)=>{if(!t)return e;let n=fu(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};Zp.exports=gw});var Yp=v((pI,zp)=>{"use strict";var hu=kn(),Vp=zn(),vw=qe(),Gp=Xa(),_w=en(),bw=vh(),Sw=bh(),Ew=Ch(),Cw=kh(),ww=Ah(),xw=jh(),kw=Th(),$w=Ph(),Aw=Dt(),Fw=Bh(),jw=qh(),Iw=fo(),Tw=Uh(),Rw=Gh(),Pw=Jn(),Ow=ho(),Nw=eu(),Lw=tu(),Bw=po(),Mw=mo(),qw=ru(),Ww=rp(),Hw=Xn(),Zw=yt(),Uw=Qn(),Vw=Dp(),Gw=vp(),zw=bp(),Yw=Cp(),Jw=xp(),Xw=yo(),Kw=Ip(),Qw=Rp(),ex=Np(),tx=Bp(),rx=Up();zp.exports={parse:_w,valid:bw,clean:Sw,inc:Ew,diff:Cw,major:ww,minor:xw,patch:kw,prerelease:$w,compare:Aw,rcompare:Fw,compareLoose:jw,compareBuild:Iw,sort:Tw,rsort:Rw,gt:Pw,lt:Ow,eq:Nw,neq:Lw,gte:Bw,lte:Mw,cmp:qw,coerce:Ww,Comparator:Hw,Range:Zw,satisfies:Uw,toComparators:Vw,maxSatisfying:Gw,minSatisfying:zw,minVersion:Yw,validRange:Jw,outside:Xw,gtr:Kw,ltr:Qw,intersects:ex,simplifyRange:tx,subset:rx,SemVer:vw,re:hu.re,src:hu.src,tokens:hu.t,SEMVER_SPEC_VERSION:Vp.SEMVER_SPEC_VERSION,RELEASE_TYPES:Vp.RELEASE_TYPES,compareIdentifiers:Gp.compareIdentifiers,rcompareIdentifiers:Gp.rcompareIdentifiers}});var sr=v(pu=>{"use strict";Object.defineProperty(pu,"__esModule",{value:!0});var nx=(function(){function t(){}return t.prototype.diff=function(e,r,n){n===void 0&&(n={});var s;typeof n=="function"?(s=n,n={}):"callback"in n&&(s=n.callback);var i=this.castInput(e,n),o=this.castInput(r,n),a=this.removeEmpty(this.tokenize(i,n)),u=this.removeEmpty(this.tokenize(o,n));return this.diffWithOptionsObj(a,u,n,s)},t.prototype.diffWithOptionsObj=function(e,r,n,s){var i=this,o,a=function(T){if(T=i.postProcess(T,n),s){setTimeout(function(){s(T)},0);return}else return T},u=r.length,c=e.length,l=1,d=u+c;n.maxEditLength!=null&&(d=Math.min(d,n.maxEditLength));var f=(o=n.timeout)!==null&&o!==void 0?o:1/0,g=Date.now()+f,m=[{oldPos:-1,lastComponent:void 0}],y=this.extractCommon(m[0],r,e,0,n);if(m[0].oldPos+1>=c&&y+1>=u)return a(this.buildValues(m[0].lastComponent,r,e));var h=-1/0,w=1/0,C=function(){for(var T=Math.max(h,-l);T<=Math.min(w,l);T+=2){var V=void 0,I=m[T-1],H=m[T+1];I&&(m[T-1]=void 0);var F=!1;if(H){var q=H.oldPos-T;F=H&&0<=q&&q<u}var P=I&&I.oldPos+1<c;if(!F&&!P){m[T]=void 0;continue}if(!P||F&&I.oldPos<H.oldPos?V=i.addToPath(H,!0,!1,0,n):V=i.addToPath(I,!1,!0,1,n),y=i.extractCommon(V,r,e,T,n),V.oldPos+1>=c&&y+1>=u)return a(i.buildValues(V.lastComponent,r,e))||!0;m[T]=V,V.oldPos+1>=c&&(w=Math.min(w,T-1)),y+1>=u&&(h=Math.max(h,T+1))}l++};if(s)(function T(){setTimeout(function(){if(l>d||Date.now()>g)return s(void 0);C()||T()},0)})();else for(;l<=d&&Date.now()<=g;){var A=C();if(A)return A}},t.prototype.addToPath=function(e,r,n,s,i){var o=e.lastComponent;return o&&!i.oneChangePerToken&&o.added===r&&o.removed===n?{oldPos:e.oldPos+s,lastComponent:{count:o.count+1,added:r,removed:n,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+s,lastComponent:{count:1,added:r,removed:n,previousComponent:o}}},t.prototype.extractCommon=function(e,r,n,s,i){for(var o=r.length,a=n.length,u=e.oldPos,c=u-s,l=0;c+1<o&&u+1<a&&this.equals(n[u+1],r[c+1],i);)c++,u++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=u,c},t.prototype.equals=function(e,r,n){return n.comparator?n.comparator(e,r):e===r||!!n.ignoreCase&&e.toLowerCase()===r.toLowerCase()},t.prototype.removeEmpty=function(e){for(var r=[],n=0;n<e.length;n++)e[n]&&r.push(e[n]);return r},t.prototype.castInput=function(e,r){return e},t.prototype.tokenize=function(e,r){return Array.from(e)},t.prototype.join=function(e){return e.join("")},t.prototype.postProcess=function(e,r){return e},Object.defineProperty(t.prototype,"useLongestToken",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.buildValues=function(e,r,n){for(var s=[],i;e;)s.push(e),i=e.previousComponent,delete e.previousComponent,e=i;s.reverse();for(var o=s.length,a=0,u=0,c=0;a<o;a++){var l=s[a];if(l.removed)l.value=this.join(n.slice(c,c+l.count)),c+=l.count;else{if(!l.added&&this.useLongestToken){var d=r.slice(u,u+l.count);d=d.map(function(f,g){var m=n[c+g];return m.length>f.length?m:f}),l.value=this.join(d)}else l.value=this.join(r.slice(u,u+l.count));u+=l.count,l.added||(c+=l.count)}}return s},t})();pu.default=nx});var Jp=v(wr=>{"use strict";var sx=wr&&wr.__extends||(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty(wr,"__esModule",{value:!0});wr.characterDiff=void 0;wr.diffChars=ax;var ox=sr(),ix=(function(t){sx(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(ox.default);wr.characterDiff=new ix;function ax(t,e,r){return wr.characterDiff.diff(t,e,r)}});var gu=v(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.longestCommonPrefix=ux;Ye.longestCommonSuffix=cx;Ye.replacePrefix=Xp;Ye.replaceSuffix=Kp;Ye.removePrefix=lx;Ye.removeSuffix=dx;Ye.maximumOverlap=fx;Ye.hasOnlyWinLineEndings=px;Ye.hasOnlyUnixLineEndings=mx;Ye.segment=Qp;Ye.trailingWs=em;Ye.leadingWs=tm;Ye.leadingAndTrailingWs=mu;function ux(t,e){var r;for(r=0;r<t.length&&r<e.length;r++)if(t[r]!=e[r])return t.slice(0,r);return t.slice(0,r)}function cx(t,e){var r;if(!t||!e||t[t.length-1]!=e[e.length-1])return"";for(r=0;r<t.length&&r<e.length;r++)if(t[t.length-(r+1)]!=e[e.length-(r+1)])return t.slice(-r);return t.slice(-r)}function Xp(t,e,r){if(t.slice(0,e.length)!=e)throw Error("string ".concat(JSON.stringify(t)," doesn't start with prefix ").concat(JSON.stringify(e),"; this is a bug"));return r+t.slice(e.length)}function Kp(t,e,r){if(!e)return t+r;if(t.slice(-e.length)!=e)throw Error("string ".concat(JSON.stringify(t)," doesn't end with suffix ").concat(JSON.stringify(e),"; this is a bug"));return t.slice(0,-e.length)+r}function lx(t,e){return Xp(t,e,"")}function dx(t,e){return Kp(t,e,"")}function fx(t,e){return e.slice(0,hx(t,e))}function hx(t,e){var r=0;t.length>e.length&&(r=t.length-e.length);var n=e.length;t.length<e.length&&(n=t.length);var s=Array(n),i=0;s[0]=0;for(var o=1;o<n;o++){for(e[o]==e[i]?s[o]=s[i]:s[o]=i;i>0&&e[o]!=e[i];)i=s[i];e[o]==e[i]&&i++}i=0;for(var a=r;a<t.length;a++){for(;i>0&&t[a]!=e[i];)i=s[i];t[a]==e[i]&&i++}return i}function px(t){return t.includes(`\r
3
+ var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Qt=v((zF,Nu)=>{var yy=require("crypto"),at=require("fs"),pn=require("path");function Ou(t,e,r={}){let{encoding:n="utf8",mode:s}=r,i=pn.dirname(t);at.mkdirSync(i,{recursive:!0});let o=pn.join(i,`.${pn.basename(t)}.tmp-${process.pid}-${yy.randomBytes(8).toString("hex")}`),a;try{a=at.openSync(o,"wx",s??420),at.writeSync(a,e,0,n),at.fsyncSync(a),at.closeSync(a),a=null,at.renameSync(o,t)}catch(c){if(a!=null)try{at.closeSync(a)}catch{}try{at.unlinkSync(o)}catch{}throw c}}function vy(t,e,r={}){let n=JSON.stringify(e,null,2)+`
4
+ `;Ou(t,n,r)}function _y(t,e){let r;try{r=at.lstatSync(t)}catch(o){return o.code==="ENOENT"?{ok:!0,reason:"missing"}:{ok:!1,reason:`lstat: ${o.message}`}}if(r.isSymbolicLink())try{return at.unlinkSync(t),{ok:!0,reason:"symlink-unlinked"}}catch(o){return{ok:!1,reason:`unlink: ${o.message}`}}let n;try{n=at.realpathSync(e)}catch{n=pn.resolve(e)}let s;try{s=at.realpathSync(t)}catch(o){return{ok:!1,reason:`realpath: ${o.message}`}}let i=pn.relative(n,s);if(i.startsWith("..")||pn.isAbsolute(i))return{ok:!1,reason:"outside-root"};try{return at.rmSync(s,{recursive:!0,force:!0}),{ok:!0}}catch(o){return{ok:!1,reason:`rmSync: ${o.message}`}}}Nu.exports={writeFileAtomic:Ou,writeJsonAtomic:vy,safeRmSync:_y}});var hr=v((YF,Lu)=>{"use strict";var by=require("os");function Sy(){return process.env.HOME||by.homedir()}Lu.exports={homedir:Sy}});var Nn=v((JF,ri)=>{var ws=process||{},Bu=ws.argv||[],Cs=ws.env||{},Ey=!(Cs.NO_COLOR||Bu.includes("--no-color"))&&(!!Cs.FORCE_COLOR||Bu.includes("--color")||ws.platform==="win32"||(ws.stdout||{}).isTTY&&Cs.TERM!=="dumb"||!!Cs.CI),Cy=(t,e,r=t)=>n=>{let s=""+n,i=s.indexOf(e,t.length);return~i?t+wy(s,e,r,i)+e:t+s+e},wy=(t,e,r,n)=>{let s="",i=0;do s+=t.substring(i,n)+r,i=n+e.length,n=t.indexOf(e,i);while(~n);return s+t.substring(i)},Mu=(t=Ey)=>{let e=t?Cy:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};ri.exports=Mu();ri.exports.createColors=Mu});var Hu=v(pr=>{"use strict";var qu=pr&&pr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(pr,"__esModule",{value:!0});pr.symbols=pr.isTTY=void 0;var xy=qu(require("node:tty")),Bt=qu(require("node:process")),ky=Bt.default.env.CI||Bt.default.env.WT_SESSION||Bt.default.env.ConEmuTask==="{cmd::Cmder}"||Bt.default.env.TERM_PROGRAM==="vscode"||Bt.default.env.TERM==="xterm-256color"||Bt.default.env.TERM==="alacritty",Wu=xy.default.isatty(1)&&Bt.default.env.TERM!=="dumb"&&!("CI"in Bt.default.env);pr.isTTY=Wu;var Ln=Bt.default.platform!=="win32"?Bt.default.env.TERM!=="linux":ky,$y={frames:Wu?Ln?["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]:["-","\\","|","/"]:["-"],tick:Ln?"\u2714":"\u221A",cross:Ln?"\u2716":"\xD7",warn:Ln?"\u26A0":"!!",info:Ln?"\u2139":"i"};pr.symbols=$y});var Uu=v(Bn=>{"use strict";var Ay=Bn&&Bn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Bn,"__esModule",{value:!0});Bn.createSpinner=jy;var Zu=Ay(Nn()),Mt=Hu();function Fy(t="",e=80){return t.replace(/\u001b[^m]*?m/g,"").split(`
5
+ `).reduce((r,n)=>r+=Math.max(1,Math.ceil(n.length/e)),0)}function jy(t="",e={}){let r=0,n=e.interval||50,s=e.stream||process.stderr,i=e.frames&&e.frames.length?e.frames:Mt.symbols.frames,o=e.color||"yellow",a=!1,c=0,u,l=(C={})=>typeof C=="string"?C:C.text||t,d=(C={})=>typeof C=="string"?!1:!!C.update,f=(C={})=>typeof C=="string"||!C.color?o:C.color,g=(C={},A)=>typeof C=="string"||!C.mark?A:C.mark,m=()=>{process.on("SIGINT",w),process.on("SIGTERM",w)},y=()=>{process.off("SIGINT",w),process.off("SIGTERM",w)},h={reset(){return r=0,c=0,a=!1,clearTimeout(u),u=void 0,h},clear(){h.write("\x1B[1G");for(let C=0;C<c;C++)C>0&&h.write("\x1B[1A"),h.write("\x1B[2K\x1B[1G");return c=0,h},write(C,A=!1){return A&&Mt.isTTY&&h.clear(),s.write(C),h},render(){let C=`${Zu.default[o](i[r])} ${t}`;return Mt.isTTY?h.write("\x1B[?25l"):C+=`
6
+ `,h.write(C,!0),Mt.isTTY&&(c=Fy(C,s.columns)),h},spin(){return h.render(),r=++r%i.length,h},update(C){return typeof C=="string"?t=C:(t=C.text||t,i=C.frames&&C.frames.length?C.frames:i,n=C.interval||n,o=C.color||o),i.length-1<r&&(r=0),h},loop(){return Mt.isTTY&&(u=setTimeout(()=>h.loop(),n)),h.spin()},start(C={}){return u&&h.reset(),a=!0,m(),h.update({text:l(C),color:f(C)}).loop()},stop(C){a=!1,clearTimeout(u),u=void 0,y();let A=d(C),T=Zu.default[f(C)](g(C,i[r])),G=l(C);return h.write(C?`${T} ${G}${A?"":`
7
+ `}`:"",!0),Mt.isTTY&&!A?h.write("\x1B[?25h"):h},success(C={}){return h.stop({text:l(C),mark:g(C,Mt.symbols.tick),color:"green",update:d(C)})},error(C={}){return h.stop({text:l(C),mark:g(C,Mt.symbols.cross),color:"red",update:d(C)})},warn(C={}){return h.stop({text:l(C),mark:g(C,Mt.symbols.warn),color:"yellow",update:d(C)})},info(C={}){return h.stop({text:l(C),mark:g(C,Mt.symbols.info),color:"blue",update:d(C)})},isSpinning(){return a}};function w(C){a&&h.stop(),process.exit(C==="SIGINT"?130:C==="SIGTERM"?143:1)}return h}});var Vu=v(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.splitWhen=mn.flatten=void 0;function Iy(t){return t.reduce((e,r)=>[].concat(e,r),[])}mn.flatten=Iy;function Ty(t,e){let r=[[]],n=0;for(let s of t)e(s)?(n++,r[n]=[]):r[n].push(s);return r}mn.splitWhen=Ty});var Gu=v(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.isEnoentCodeError=void 0;function Ry(t){return t.code==="ENOENT"}xs.isEnoentCodeError=Ry});var zu=v(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});ks.createDirentFromStats=void 0;var ni=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function Py(t,e){return new ni(t,e)}ks.createDirentFromStats=Py});var Ku=v(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.convertPosixPathToPattern=Ie.convertWindowsPathToPattern=Ie.convertPathToPattern=Ie.escapePosixPath=Ie.escapeWindowsPath=Ie.escape=Ie.removeLeadingDotSegment=Ie.makeAbsolute=Ie.unixify=void 0;var Oy=require("os"),Ny=require("path"),Yu=Oy.platform()==="win32",Ly=2,By=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g,My=/(\\?)([()[\]{}]|^!|[!+@](?=\())/g,qy=/^\\\\([.?])/,Wy=/\\(?![!()+@[\]{}])/g;function Hy(t){return t.replace(/\\/g,"/")}Ie.unixify=Hy;function Zy(t,e){return Ny.resolve(t,e)}Ie.makeAbsolute=Zy;function Uy(t){if(t.charAt(0)==="."){let e=t.charAt(1);if(e==="/"||e==="\\")return t.slice(Ly)}return t}Ie.removeLeadingDotSegment=Uy;Ie.escape=Yu?si:oi;function si(t){return t.replace(My,"\\$2")}Ie.escapeWindowsPath=si;function oi(t){return t.replace(By,"\\$2")}Ie.escapePosixPath=oi;Ie.convertPathToPattern=Yu?Ju:Xu;function Ju(t){return si(t).replace(qy,"//$1").replace(Wy,"/")}Ie.convertWindowsPathToPattern=Ju;function Xu(t){return oi(t)}Ie.convertPosixPathToPattern=Xu});var el=v((nj,Qu)=>{Qu.exports=function(e){if(typeof e!="string"||e==="")return!1;for(var r;r=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(r[2])return!0;e=e.slice(r.index+r[0].length)}return!1}});var nl=v((sj,rl)=>{var Vy=el(),tl={"{":"}","(":")","[":"]"},Gy=function(t){if(t[0]==="!")return!0;for(var e=0,r=-2,n=-2,s=-2,i=-2,o=-2;e<t.length;){if(t[e]==="*"||t[e+1]==="?"&&/[\].+)]/.test(t[e])||n!==-1&&t[e]==="["&&t[e+1]!=="]"&&(n<e&&(n=t.indexOf("]",e)),n>e&&(o===-1||o>n||(o=t.indexOf("\\",e),o===-1||o>n)))||s!==-1&&t[e]==="{"&&t[e+1]!=="}"&&(s=t.indexOf("}",e),s>e&&(o=t.indexOf("\\",e),o===-1||o>s))||i!==-1&&t[e]==="("&&t[e+1]==="?"&&/[:!=]/.test(t[e+2])&&t[e+3]!==")"&&(i=t.indexOf(")",e),i>e&&(o=t.indexOf("\\",e),o===-1||o>i))||r!==-1&&t[e]==="("&&t[e+1]!=="|"&&(r<e&&(r=t.indexOf("|",e)),r!==-1&&t[r+1]!==")"&&(i=t.indexOf(")",r),i>r&&(o=t.indexOf("\\",r),o===-1||o>i))))return!0;if(t[e]==="\\"){var a=t[e+1];e+=2;var c=tl[a];if(c){var u=t.indexOf(c,e);u!==-1&&(e=u+1)}if(t[e]==="!")return!0}else e++}return!1},zy=function(t){if(t[0]==="!")return!0;for(var e=0;e<t.length;){if(/[*?{}()[\]]/.test(t[e]))return!0;if(t[e]==="\\"){var r=t[e+1];e+=2;var n=tl[r];if(n){var s=t.indexOf(n,e);s!==-1&&(e=s+1)}if(t[e]==="!")return!0}else e++}return!1};rl.exports=function(e,r){if(typeof e!="string"||e==="")return!1;if(Vy(e))return!0;var n=Gy;return r&&r.strict===!1&&(n=zy),n(e)}});var ol=v((oj,sl)=>{"use strict";var Yy=nl(),Jy=require("path").posix.dirname,Xy=require("os").platform()==="win32",ii="/",Ky=/\\/g,Qy=/[\{\[].*[\}\]]$/,ev=/(^|[^\\])([\{\[]|\([^\)]+$)/,tv=/\\([\!\*\?\|\[\]\(\)\{\}])/g;sl.exports=function(e,r){var n=Object.assign({flipBackslashes:!0},r);n.flipBackslashes&&Xy&&e.indexOf(ii)<0&&(e=e.replace(Ky,ii)),Qy.test(e)&&(e+=ii),e+="a";do e=Jy(e);while(Yy(e)||ev.test(e));return e.replace(tv,"$1")}});var $s=v(ht=>{"use strict";ht.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;ht.find=(t,e)=>t.nodes.find(r=>r.type===e);ht.exceedsLimit=(t,e,r=1,n)=>n===!1||!ht.isInteger(t)||!ht.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;ht.escapeNode=(t,e=0,r)=>{let n=t.nodes[e];n&&(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};ht.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;ht.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;ht.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;ht.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);ht.flatten=(...t)=>{let e=[],r=n=>{for(let s=0;s<n.length;s++){let i=n[s];if(Array.isArray(i)){r(i);continue}i!==void 0&&e.push(i)}return e};return r(t),e}});var As=v((aj,al)=>{"use strict";var il=$s();al.exports=(t,e={})=>{let r=(n,s={})=>{let i=e.escapeInvalid&&il.isInvalidBrace(s),o=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(i||o)&&il.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let c of n.nodes)a+=r(c);return a};return r(t)}});var ul=v((cj,cl)=>{"use strict";cl.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var yl=v((uj,Dl)=>{"use strict";var ll=ul(),Nr=(t,e,r)=>{if(ll(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(ll(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...r};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let s=String(n.relaxZeros),i=String(n.shorthand),o=String(n.capture),a=String(n.wrap),c=t+":"+e+"="+s+i+o+a;if(Nr.cache.hasOwnProperty(c))return Nr.cache[c].result;let u=Math.min(t,e),l=Math.max(t,e);if(Math.abs(u-l)===1){let y=t+"|"+e;return n.capture?`(${y})`:n.wrap===!1?y:`(?:${y})`}let d=gl(t)||gl(e),f={min:t,max:e,a:u,b:l},g=[],m=[];if(d&&(f.isPadded=d,f.maxLen=String(f.max).length),u<0){let y=l<0?Math.abs(l):1;m=dl(y,Math.abs(u),f,n),u=f.a=0}return l>=0&&(g=dl(u,l,f,n)),f.negatives=m,f.positives=g,f.result=rv(m,g,n),n.capture===!0?f.result=`(${f.result})`:n.wrap!==!1&&g.length+m.length>1&&(f.result=`(?:${f.result})`),Nr.cache[c]=f,f.result};function rv(t,e,r){let n=ai(t,e,"-",!1,r)||[],s=ai(e,t,"",!1,r)||[],i=ai(t,e,"-?",!0,r)||[];return n.concat(i).concat(s).join("|")}function nv(t,e){let r=1,n=1,s=hl(t,r),i=new Set([e]);for(;t<=s&&s<=e;)i.add(s),r+=1,s=hl(t,r);for(s=pl(e+1,n)-1;t<s&&s<=e;)i.add(s),n+=1,s=pl(e+1,n)-1;return i=[...i],i.sort(iv),i}function sv(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=ov(t,e),s=n.length,i="",o=0;for(let a=0;a<s;a++){let[c,u]=n[a];c===u?i+=c:c!=="0"||u!=="9"?i+=av(c,u,r):o++}return o&&(i+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:i,count:[o],digits:s}}function dl(t,e,r,n){let s=nv(t,e),i=[],o=t,a;for(let c=0;c<s.length;c++){let u=s[c],l=sv(String(o),String(u),n),d="";if(!r.isPadded&&a&&a.pattern===l.pattern){a.count.length>1&&a.count.pop(),a.count.push(l.count[0]),a.string=a.pattern+ml(a.count),o=u+1;continue}r.isPadded&&(d=cv(u,r,n)),l.string=d+l.pattern+ml(l.count),i.push(l),o=u+1,a=l}return i}function ai(t,e,r,n,s){let i=[];for(let o of t){let{string:a}=o;!n&&!fl(e,"string",a)&&i.push(r+a),n&&fl(e,"string",a)&&i.push(r+a)}return i}function ov(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function iv(t,e){return t>e?1:e>t?-1:0}function fl(t,e,r){return t.some(n=>n[e]===r)}function hl(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function pl(t,e){return t-t%Math.pow(10,e)}function ml(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function av(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function gl(t){return/^-?(0+)\d/.test(t)}function cv(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),s=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return s?"0?":"0";case 2:return s?"0{0,2}":"00";default:return s?`0{0,${n}}`:`0{${n}}`}}Nr.cache={};Nr.clearCache=()=>Nr.cache={};Dl.exports=Nr});var li=v((lj,wl)=>{"use strict";var uv=require("util"),_l=yl(),vl=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),lv=t=>e=>t===!0?Number(e):String(e),ci=t=>typeof t=="number"||typeof t=="string"&&t!=="",Mn=t=>Number.isInteger(+t),ui=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},dv=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,fv=(t,e,r)=>{if(e>0){let n=t[0]==="-"?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return r===!1?String(t):t},js=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},hv=(t,e,r)=>{t.negatives.sort((a,c)=>a<c?-1:a>c?1:0),t.positives.sort((a,c)=>a<c?-1:a>c?1:0);let n=e.capture?"":"?:",s="",i="",o;return t.positives.length&&(s=t.positives.map(a=>js(String(a),r)).join("|")),t.negatives.length&&(i=`-(${n}${t.negatives.map(a=>js(String(a),r)).join("|")})`),s&&i?o=`${s}|${i}`:o=s||i,e.wrap?`(${n}${o})`:o},bl=(t,e,r,n)=>{if(r)return _l(t,e,{wrap:!1,...n});let s=String.fromCharCode(t);if(t===e)return s;let i=String.fromCharCode(e);return`[${s}-${i}]`},Sl=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,s=r.capture?"":"?:";return n?`(${s}${t.join("|")})`:t.join("|")}return _l(t,e,r)},El=(...t)=>new RangeError("Invalid range arguments: "+uv.inspect(...t)),Cl=(t,e,r)=>{if(r.strictRanges===!0)throw El([t,e]);return[]},pv=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},mv=(t,e,r=1,n={})=>{let s=Number(t),i=Number(e);if(!Number.isInteger(s)||!Number.isInteger(i)){if(n.strictRanges===!0)throw El([t,e]);return[]}s===0&&(s=0),i===0&&(i=0);let o=s>i,a=String(t),c=String(e),u=String(r);r=Math.max(Math.abs(r),1);let l=ui(a)||ui(c)||ui(u),d=l?Math.max(a.length,c.length,u.length):0,f=l===!1&&dv(t,e,n)===!1,g=n.transform||lv(f);if(n.toRegex&&r===1)return bl(js(t,d),js(e,d),!0,n);let m={negatives:[],positives:[]},y=C=>m[C<0?"negatives":"positives"].push(Math.abs(C)),h=[],w=0;for(;o?s>=i:s<=i;)n.toRegex===!0&&r>1?y(s):h.push(fv(g(s,w),d,f)),s=o?s-r:s+r,w++;return n.toRegex===!0?r>1?hv(m,n,d):Sl(h,null,{wrap:!1,...n}):h},gv=(t,e,r=1,n={})=>{if(!Mn(t)&&t.length>1||!Mn(e)&&e.length>1)return Cl(t,e,n);let s=n.transform||(f=>String.fromCharCode(f)),i=`${t}`.charCodeAt(0),o=`${e}`.charCodeAt(0),a=i>o,c=Math.min(i,o),u=Math.max(i,o);if(n.toRegex&&r===1)return bl(c,u,!1,n);let l=[],d=0;for(;a?i>=o:i<=o;)l.push(s(i,d)),i=a?i-r:i+r,d++;return n.toRegex===!0?Sl(l,null,{wrap:!1,options:n}):l},Fs=(t,e,r,n={})=>{if(e==null&&ci(t))return[t];if(!ci(t)||!ci(e))return Cl(t,e,n);if(typeof r=="function")return Fs(t,e,1,{transform:r});if(vl(r))return Fs(t,e,0,r);let s={...n};return s.capture===!0&&(s.wrap=!0),r=r||s.step||1,Mn(r)?Mn(t)&&Mn(e)?mv(t,e,r,s):gv(t,e,Math.max(Math.abs(r),1),s):r!=null&&!vl(r)?pv(r,s):Fs(t,e,1,r)};wl.exports=Fs});var $l=v((dj,kl)=>{"use strict";var Dv=li(),xl=$s(),yv=(t,e={})=>{let r=(n,s={})=>{let i=xl.isInvalidBrace(s),o=n.invalid===!0&&e.escapeInvalid===!0,a=i===!0||o===!0,c=e.escapeInvalid===!0?"\\":"",u="";if(n.isOpen===!0)return c+n.value;if(n.isClose===!0)return console.log("node.isClose",c,n.value),c+n.value;if(n.type==="open")return a?c+n.value:"(";if(n.type==="close")return a?c+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let l=xl.reduce(n.nodes),d=Dv(...l,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(d.length!==0)return l.length>1&&d.length>1?`(${d})`:d}if(n.nodes)for(let l of n.nodes)u+=r(l,n);return u};return r(t)};kl.exports=yv});var jl=v((fj,Fl)=>{"use strict";var vv=li(),Al=As(),gn=$s(),Lr=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?gn.flatten(e).map(s=>`{${s}}`):e;for(let s of t)if(Array.isArray(s))for(let i of s)n.push(Lr(i,e,r));else for(let i of e)r===!0&&typeof i=="string"&&(i=`{${i}}`),n.push(Array.isArray(i)?Lr(s,i,r):s+i);return gn.flatten(n)},_v=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(s,i={})=>{s.queue=[];let o=i,a=i.queue;for(;o.type!=="brace"&&o.type!=="root"&&o.parent;)o=o.parent,a=o.queue;if(s.invalid||s.dollar){a.push(Lr(a.pop(),Al(s,e)));return}if(s.type==="brace"&&s.invalid!==!0&&s.nodes.length===2){a.push(Lr(a.pop(),["{}"]));return}if(s.nodes&&s.ranges>0){let d=gn.reduce(s.nodes);if(gn.exceedsLimit(...d,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let f=vv(...d,e);f.length===0&&(f=Al(s,e)),a.push(Lr(a.pop(),f)),s.nodes=[];return}let c=gn.encloseBrace(s),u=s.queue,l=s;for(;l.type!=="brace"&&l.type!=="root"&&l.parent;)l=l.parent,u=l.queue;for(let d=0;d<s.nodes.length;d++){let f=s.nodes[d];if(f.type==="comma"&&s.type==="brace"){d===1&&u.push(""),u.push("");continue}if(f.type==="close"){a.push(Lr(a.pop(),u,c));continue}if(f.value&&f.type!=="open"){u.push(Lr(u.pop(),f.value));continue}f.nodes&&n(f,s)}return u};return gn.flatten(n(t))};Fl.exports=_v});var Tl=v((hj,Il)=>{"use strict";Il.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
8
+ `,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var Ll=v((pj,Nl)=>{"use strict";var bv=As(),{MAX_LENGTH:Rl,CHAR_BACKSLASH:di,CHAR_BACKTICK:Sv,CHAR_COMMA:Ev,CHAR_DOT:Cv,CHAR_LEFT_PARENTHESES:wv,CHAR_RIGHT_PARENTHESES:xv,CHAR_LEFT_CURLY_BRACE:kv,CHAR_RIGHT_CURLY_BRACE:$v,CHAR_LEFT_SQUARE_BRACKET:Pl,CHAR_RIGHT_SQUARE_BRACKET:Ol,CHAR_DOUBLE_QUOTE:Av,CHAR_SINGLE_QUOTE:Fv,CHAR_NO_BREAK_SPACE:jv,CHAR_ZERO_WIDTH_NOBREAK_SPACE:Iv}=Tl(),Tv=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(Rl,r.maxLength):Rl;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let s={type:"root",input:t,nodes:[]},i=[s],o=s,a=s,c=0,u=t.length,l=0,d=0,f,g=()=>t[l++],m=y=>{if(y.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&y.type==="text"){a.value+=y.value;return}return o.nodes.push(y),y.parent=o,y.prev=a,a=y,y};for(m({type:"bos"});l<u;)if(o=i[i.length-1],f=g(),!(f===Iv||f===jv)){if(f===di){m({type:"text",value:(e.keepEscaping?f:"")+g()});continue}if(f===Ol){m({type:"text",value:"\\"+f});continue}if(f===Pl){c++;let y;for(;l<u&&(y=g());){if(f+=y,y===Pl){c++;continue}if(y===di){f+=g();continue}if(y===Ol&&(c--,c===0))break}m({type:"text",value:f});continue}if(f===wv){o=m({type:"paren",nodes:[]}),i.push(o),m({type:"text",value:f});continue}if(f===xv){if(o.type!=="paren"){m({type:"text",value:f});continue}o=i.pop(),m({type:"text",value:f}),o=i[i.length-1];continue}if(f===Av||f===Fv||f===Sv){let y=f,h;for(e.keepQuotes!==!0&&(f="");l<u&&(h=g());){if(h===di){f+=h+g();continue}if(h===y){e.keepQuotes===!0&&(f+=h);break}f+=h}m({type:"text",value:f});continue}if(f===kv){d++;let h={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||o.dollar===!0,depth:d,commas:0,ranges:0,nodes:[]};o=m(h),i.push(o),m({type:"open",value:f});continue}if(f===$v){if(o.type!=="brace"){m({type:"text",value:f});continue}let y="close";o=i.pop(),o.close=!0,m({type:y,value:f}),d--,o=i[i.length-1];continue}if(f===Ev&&d>0){if(o.ranges>0){o.ranges=0;let y=o.nodes.shift();o.nodes=[y,{type:"text",value:bv(o)}]}m({type:"comma",value:f}),o.commas++;continue}if(f===Cv&&d>0&&o.commas===0){let y=o.nodes;if(d===0||y.length===0){m({type:"text",value:f});continue}if(a.type==="dot"){if(o.range=[],a.value+=f,a.type="range",o.nodes.length!==3&&o.nodes.length!==5){o.invalid=!0,o.ranges=0,a.type="text";continue}o.ranges++,o.args=[];continue}if(a.type==="range"){y.pop();let h=y[y.length-1];h.value+=a.value+f,a=h,o.ranges--;continue}m({type:"dot",value:f});continue}m({type:"text",value:f})}do if(o=i.pop(),o.type!=="root"){o.nodes.forEach(w=>{w.nodes||(w.type==="open"&&(w.isOpen=!0),w.type==="close"&&(w.isClose=!0),w.nodes||(w.type="text"),w.invalid=!0)});let y=i[i.length-1],h=y.nodes.indexOf(o);y.nodes.splice(h,1,...o.nodes)}while(i.length>0);return m({type:"eos"}),s};Nl.exports=Tv});var ql=v((mj,Ml)=>{"use strict";var Bl=As(),Rv=$l(),Pv=jl(),Ov=Ll(),ct=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let s=ct.create(n,e);Array.isArray(s)?r.push(...s):r.push(s)}else r=[].concat(ct.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};ct.parse=(t,e={})=>Ov(t,e);ct.stringify=(t,e={})=>Bl(typeof t=="string"?ct.parse(t,e):t,e);ct.compile=(t,e={})=>(typeof t=="string"&&(t=ct.parse(t,e)),Rv(t,e));ct.expand=(t,e={})=>{typeof t=="string"&&(t=ct.parse(t,e));let r=Pv(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};ct.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?ct.compile(t,e):ct.expand(t,e);Ml.exports=ct});var qn=v((gj,Vl)=>{"use strict";var Nv=require("path"),qt="\\\\/",Wl=`[^${qt}]`,Lv=0,er="\\.",Bv="\\+",Mv="\\?",Is="\\/",qv="(?=.)",Hl="[^/]",fi=`(?:${Is}|$)`,Zl=`(?:^|${Is})`,hi=`${er}{1,2}${fi}`,Wv=`(?!${er})`,Hv=`(?!${Zl}${hi})`,Zv=`(?!${er}{0,1}${fi})`,Uv=`(?!${hi})`,Vv=`[^.${Is}]`,Gv=`${Hl}*?`,Ul={DOT_LITERAL:er,PLUS_LITERAL:Bv,QMARK_LITERAL:Mv,SLASH_LITERAL:Is,ONE_CHAR:qv,QMARK:Hl,END_ANCHOR:fi,DOTS_SLASH:hi,NO_DOT:Wv,NO_DOTS:Hv,NO_DOT_SLASH:Zv,NO_DOTS_SLASH:Uv,QMARK_NO_DOT:Vv,STAR:Gv,START_ANCHOR:Zl},zv={...Ul,SLASH_LITERAL:`[${qt}]`,QMARK:Wl,STAR:`${Wl}*?`,DOTS_SLASH:`${er}{1,2}(?:[${qt}]|$)`,NO_DOT:`(?!${er})`,NO_DOTS:`(?!(?:^|[${qt}])${er}{1,2}(?:[${qt}]|$))`,NO_DOT_SLASH:`(?!${er}{0,1}(?:[${qt}]|$))`,NO_DOTS_SLASH:`(?!${er}{1,2}(?:[${qt}]|$))`,QMARK_NO_DOT:`[^.${qt}]`,START_ANCHOR:`(?:^|[${qt}])`,END_ANCHOR:`(?:[${qt}]|$)`},Yv={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};Vl.exports={DEFAULT_MAX_EXTGLOB_RECURSION:Lv,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Yv,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:Nv.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?zv:Ul}}});var Wn=v(tt=>{"use strict";var Jv=require("path"),Xv=process.platform==="win32",{REGEX_BACKSLASH:Kv,REGEX_REMOVE_BACKSLASH:Qv,REGEX_SPECIAL_CHARS:e0,REGEX_SPECIAL_CHARS_GLOBAL:t0}=qn();tt.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);tt.hasRegexChars=t=>e0.test(t);tt.isRegexChar=t=>t.length===1&&tt.hasRegexChars(t);tt.escapeRegex=t=>t.replace(t0,"\\$1");tt.toPosixSlashes=t=>t.replace(Kv,"/");tt.removeBackslashes=t=>t.replace(Qv,e=>e==="\\"?"":e);tt.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};tt.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:Xv===!0||Jv.sep==="\\";tt.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?tt.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};tt.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};tt.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",s=r.contains?"":"$",i=`${n}(?:${t})${s}`;return e.negated===!0&&(i=`(?:^(?!${i}).*$)`),i}});var ed=v((yj,Ql)=>{"use strict";var Gl=Wn(),{CHAR_ASTERISK:pi,CHAR_AT:r0,CHAR_BACKWARD_SLASH:Hn,CHAR_COMMA:n0,CHAR_DOT:mi,CHAR_EXCLAMATION_MARK:gi,CHAR_FORWARD_SLASH:Kl,CHAR_LEFT_CURLY_BRACE:Di,CHAR_LEFT_PARENTHESES:yi,CHAR_LEFT_SQUARE_BRACKET:s0,CHAR_PLUS:o0,CHAR_QUESTION_MARK:zl,CHAR_RIGHT_CURLY_BRACE:i0,CHAR_RIGHT_PARENTHESES:Yl,CHAR_RIGHT_SQUARE_BRACKET:a0}=qn(),Jl=t=>t===Kl||t===Hn,Xl=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},c0=(t,e)=>{let r=e||{},n=t.length-1,s=r.parts===!0||r.scanToEnd===!0,i=[],o=[],a=[],c=t,u=-1,l=0,d=0,f=!1,g=!1,m=!1,y=!1,h=!1,w=!1,C=!1,A=!1,T=!1,G=!1,I=0,Z,F,W={value:"",depth:0,isGlob:!1},R=()=>u>=n,b=()=>c.charCodeAt(u+1),Q=()=>(Z=F,c.charCodeAt(++u));for(;u<n;){F=Q();let he;if(F===Hn){C=W.backslashes=!0,F=Q(),F===Di&&(w=!0);continue}if(w===!0||F===Di){for(I++;R()!==!0&&(F=Q());){if(F===Hn){C=W.backslashes=!0,Q();continue}if(F===Di){I++;continue}if(w!==!0&&F===mi&&(F=Q())===mi){if(f=W.isBrace=!0,m=W.isGlob=!0,G=!0,s===!0)continue;break}if(w!==!0&&F===n0){if(f=W.isBrace=!0,m=W.isGlob=!0,G=!0,s===!0)continue;break}if(F===i0&&(I--,I===0)){w=!1,f=W.isBrace=!0,G=!0;break}}if(s===!0)continue;break}if(F===Kl){if(i.push(u),o.push(W),W={value:"",depth:0,isGlob:!1},G===!0)continue;if(Z===mi&&u===l+1){l+=2;continue}d=u+1;continue}if(r.noext!==!0&&(F===o0||F===r0||F===pi||F===zl||F===gi)===!0&&b()===yi){if(m=W.isGlob=!0,y=W.isExtglob=!0,G=!0,F===gi&&u===l&&(T=!0),s===!0){for(;R()!==!0&&(F=Q());){if(F===Hn){C=W.backslashes=!0,F=Q();continue}if(F===Yl){m=W.isGlob=!0,G=!0;break}}continue}break}if(F===pi){if(Z===pi&&(h=W.isGlobstar=!0),m=W.isGlob=!0,G=!0,s===!0)continue;break}if(F===zl){if(m=W.isGlob=!0,G=!0,s===!0)continue;break}if(F===s0){for(;R()!==!0&&(he=Q());){if(he===Hn){C=W.backslashes=!0,Q();continue}if(he===a0){g=W.isBracket=!0,m=W.isGlob=!0,G=!0;break}}if(s===!0)continue;break}if(r.nonegate!==!0&&F===gi&&u===l){A=W.negated=!0,l++;continue}if(r.noparen!==!0&&F===yi){if(m=W.isGlob=!0,s===!0){for(;R()!==!0&&(F=Q());){if(F===yi){C=W.backslashes=!0,F=Q();continue}if(F===Yl){G=!0;break}}continue}break}if(m===!0){if(G=!0,s===!0)continue;break}}r.noext===!0&&(y=!1,m=!1);let te=c,de="",x="";l>0&&(de=c.slice(0,l),c=c.slice(l),d-=l),te&&m===!0&&d>0?(te=c.slice(0,d),x=c.slice(d)):m===!0?(te="",x=c):te=c,te&&te!==""&&te!=="/"&&te!==c&&Jl(te.charCodeAt(te.length-1))&&(te=te.slice(0,-1)),r.unescape===!0&&(x&&(x=Gl.removeBackslashes(x)),te&&C===!0&&(te=Gl.removeBackslashes(te)));let k={prefix:de,input:t,start:l,base:te,glob:x,isBrace:f,isBracket:g,isGlob:m,isExtglob:y,isGlobstar:h,negated:A,negatedExtglob:T};if(r.tokens===!0&&(k.maxDepth=0,Jl(F)||o.push(W),k.tokens=o),r.parts===!0||r.tokens===!0){let he;for(let X=0;X<i.length;X++){let xe=he?he+1:l,ze=i[X],Le=t.slice(xe,ze);r.tokens&&(X===0&&l!==0?(o[X].isPrefix=!0,o[X].value=de):o[X].value=Le,Xl(o[X]),k.maxDepth+=o[X].depth),(X!==0||Le!=="")&&a.push(Le),he=ze}if(he&&he+1<t.length){let X=t.slice(he+1);a.push(X),r.tokens&&(o[o.length-1].value=X,Xl(o[o.length-1]),k.maxDepth+=o[o.length-1].depth)}k.slashes=i,k.parts=a}return k};Ql.exports=c0});var od=v((vj,sd)=>{"use strict";var Zn=qn(),Be=Wn(),{MAX_LENGTH:Ts,POSIX_REGEX_SOURCE:u0,REGEX_NON_SPECIAL_CHARS:l0,REGEX_SPECIAL_CHARS_BACKREF:d0,REPLACEMENTS:td}=Zn,f0=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(s=>Be.escapeRegex(s)).join("..")}return r},Dn=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,rd=t=>{let e=[],r=0,n=0,s=0,i="",o=!1;for(let a of t){if(o===!0){i+=a,o=!1;continue}if(a==="\\"){i+=a,o=!0;continue}if(a==='"'){s=s===1?0:1,i+=a;continue}if(s===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(i),i="";continue}}}i+=a}return e.push(i),e},h0=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},nd=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(h0(e))return e.replace(/\\(.)/g,"$1")},p0=t=>{let e=t.map(nd).filter(Boolean);for(let r=0;r<e.length;r++)for(let n=r+1;n<e.length;n++){let s=e[r],i=e[n],o=s[0];if(!(!o||s!==o.repeat(s.length)||i!==o.repeat(i.length))&&(s===i||s.startsWith(i)||i.startsWith(s)))return!0}return!1},vi=(t,e=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,s=0,i=!1;for(let o=1;o<t.length;o++){let a=t[o];if(i===!0){i=!1;continue}if(a==="\\"){i=!0;continue}if(a==='"'){s=s===1?0:1;continue}if(s!==1){if(a==="["){r++;continue}if(a==="]"&&r>0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&o!==t.length-1?void 0:{type:t[0],body:t.slice(2,o),end:o}}}}},m0=t=>{let e=0,r=[];for(;e<t.length;){let s=vi(t.slice(e),!1);if(!s||s.type!=="*")return;let i=rd(s.body).map(a=>a.trim());if(i.length!==1)return;let o=nd(i[0]);if(!o||o.length!==1)return;r.push(o),e+=s.end+1}return r.length<1?void 0:`${r.length===1?Be.escapeRegex(r[0]):`[${r.map(s=>Be.escapeRegex(s)).join("")}]`}*`},g0=t=>{let e=0,r=t.trim(),n=vi(r);for(;n;)e++,r=n.body.trim(),n=vi(r);return e},D0=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Zn.DEFAULT_MAX_EXTGLOB_RECURSION,n=rd(t).map(s=>s.trim());if(n.length>1&&(n.some(s=>s==="")||n.some(s=>/^[*?]+$/.test(s))||p0(n)))return{risky:!0};for(let s of n){let i=m0(s);if(i)return{risky:!0,safeOutput:i};if(g0(s)>r)return{risky:!0}}return{risky:!1}},_i=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=td[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Ts,r.maxLength):Ts,s=t.length;if(s>n)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${n}`);let i={type:"bos",value:"",output:r.prepend||""},o=[i],a=r.capture?"":"?:",c=Be.isWindows(e),u=Zn.globChars(c),l=Zn.extglobChars(u),{DOT_LITERAL:d,PLUS_LITERAL:f,SLASH_LITERAL:g,ONE_CHAR:m,DOTS_SLASH:y,NO_DOT:h,NO_DOT_SLASH:w,NO_DOTS_SLASH:C,QMARK:A,QMARK_NO_DOT:T,STAR:G,START_ANCHOR:I}=u,Z=B=>`(${a}(?:(?!${I}${B.dot?y:d}).)*?)`,F=r.dot?"":h,W=r.dot?A:T,R=r.bash===!0?Z(r):G;r.capture&&(R=`(${R})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let b={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:o};t=Be.removePrefix(t,b),s=t.length;let Q=[],te=[],de=[],x=i,k,he=()=>b.index===s-1,X=b.peek=(B=1)=>t[b.index+B],xe=b.advance=()=>t[++b.index]||"",ze=()=>t.slice(b.index+1),Le=(B="",me=0)=>{b.consumed+=B,b.index+=me},Pr=B=>{b.output+=B.output!=null?B.output:B.value,Le(B.value)},lr=()=>{let B=1;for(;X()==="!"&&(X(2)!=="("||X(3)==="?");)xe(),b.start++,B++;return B%2===0?!1:(b.negated=!0,b.start++,!0)},Or=B=>{b[B]++,de.push(B)},Ct=B=>{b[B]--,de.pop()},oe=B=>{if(x.type==="globstar"){let me=b.braces>0&&(B.type==="comma"||B.type==="brace"),L=B.extglob===!0||Q.length&&(B.type==="pipe"||B.type==="paren");B.type!=="slash"&&B.type!=="paren"&&!me&&!L&&(b.output=b.output.slice(0,-x.output.length),x.type="star",x.value="*",x.output=R,b.output+=x.output)}if(Q.length&&B.type!=="paren"&&(Q[Q.length-1].inner+=B.value),(B.value||B.output)&&Pr(B),x&&x.type==="text"&&B.type==="text"){x.value+=B.value,x.output=(x.output||"")+B.value;return}B.prev=x,o.push(B),x=B},wt=(B,me)=>{let L={...l[me],conditions:1,inner:""};L.prev=x,L.parens=b.parens,L.output=b.output,L.startIndex=b.index,L.tokensIndex=o.length;let le=(r.capture?"(":"")+L.open;Or("parens"),oe({type:B,value:me,output:b.output?"":m}),oe({type:"paren",extglob:!0,value:xe(),output:le}),Q.push(L)},Ss=B=>{let me=t.slice(B.startIndex,b.index+1),L=t.slice(B.startIndex+2,b.index),le=D0(L,r);if((B.type==="plus"||B.type==="star")&&le.risky){let j=le.safeOutput?(B.output?"":m)+(r.capture?`(${le.safeOutput})`:le.safeOutput):void 0,O=o[B.tokensIndex];O.type="text",O.value=me,O.output=j||Be.escapeRegex(me);for(let q=B.tokensIndex+1;q<o.length;q++)o[q].value="",o[q].output="",delete o[q].suffix;b.output=B.output+O.output,b.backtrack=!0,oe({type:"paren",extglob:!0,value:k,output:""}),Ct("parens");return}let _e=B.close+(r.capture?")":""),$;if(B.type==="negate"){let j=R;if(B.inner&&B.inner.length>1&&B.inner.includes("/")&&(j=Z(r)),(j!==R||he()||/^\)+$/.test(ze()))&&(_e=B.close=`)$))${j}`),B.inner.includes("*")&&($=ze())&&/^\.[^\\/.]+$/.test($)){let O=_i($,{...e,fastpaths:!1}).output;_e=B.close=`)${O})${j})`}B.prev.type==="bos"&&(b.negatedExtglob=!0)}oe({type:"paren",extglob:!0,value:k,output:_e}),Ct("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let B=!1,me=t.replace(d0,(L,le,_e,$,j,O)=>$==="\\"?(B=!0,L):$==="?"?le?le+$+(j?A.repeat(j.length):""):O===0?W+(j?A.repeat(j.length):""):A.repeat(_e.length):$==="."?d.repeat(_e.length):$==="*"?le?le+$+(j?R:""):R:le?L:`\\${L}`);return B===!0&&(r.unescape===!0?me=me.replace(/\\/g,""):me=me.replace(/\\+/g,L=>L.length%2===0?"\\\\":L?"\\":"")),me===t&&r.contains===!0?(b.output=t,b):(b.output=Be.wrapOutput(me,b,e),b)}for(;!he();){if(k=xe(),k==="\0")continue;if(k==="\\"){let L=X();if(L==="/"&&r.bash!==!0||L==="."||L===";")continue;if(!L){k+="\\",oe({type:"text",value:k});continue}let le=/^\\+/.exec(ze()),_e=0;if(le&&le[0].length>2&&(_e=le[0].length,b.index+=_e,_e%2!==0&&(k+="\\")),r.unescape===!0?k=xe():k+=xe(),b.brackets===0){oe({type:"text",value:k});continue}}if(b.brackets>0&&(k!=="]"||x.value==="["||x.value==="[^")){if(r.posix!==!1&&k===":"){let L=x.value.slice(1);if(L.includes("[")&&(x.posix=!0,L.includes(":"))){let le=x.value.lastIndexOf("["),_e=x.value.slice(0,le),$=x.value.slice(le+2),j=u0[$];if(j){x.value=_e+j,b.backtrack=!0,xe(),!i.output&&o.indexOf(x)===1&&(i.output=m);continue}}}(k==="["&&X()!==":"||k==="-"&&X()==="]")&&(k=`\\${k}`),k==="]"&&(x.value==="["||x.value==="[^")&&(k=`\\${k}`),r.posix===!0&&k==="!"&&x.value==="["&&(k="^"),x.value+=k,Pr({value:k});continue}if(b.quotes===1&&k!=='"'){k=Be.escapeRegex(k),x.value+=k,Pr({value:k});continue}if(k==='"'){b.quotes=b.quotes===1?0:1,r.keepQuotes===!0&&oe({type:"text",value:k});continue}if(k==="("){Or("parens"),oe({type:"paren",value:k});continue}if(k===")"){if(b.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Dn("opening","("));let L=Q[Q.length-1];if(L&&b.parens===L.parens+1){Ss(Q.pop());continue}oe({type:"paren",value:k,output:b.parens?")":"\\)"}),Ct("parens");continue}if(k==="["){if(r.nobracket===!0||!ze().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Dn("closing","]"));k=`\\${k}`}else Or("brackets");oe({type:"bracket",value:k});continue}if(k==="]"){if(r.nobracket===!0||x&&x.type==="bracket"&&x.value.length===1){oe({type:"text",value:k,output:`\\${k}`});continue}if(b.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Dn("opening","["));oe({type:"text",value:k,output:`\\${k}`});continue}Ct("brackets");let L=x.value.slice(1);if(x.posix!==!0&&L[0]==="^"&&!L.includes("/")&&(k=`/${k}`),x.value+=k,Pr({value:k}),r.literalBrackets===!1||Be.hasRegexChars(L))continue;let le=Be.escapeRegex(x.value);if(b.output=b.output.slice(0,-x.value.length),r.literalBrackets===!0){b.output+=le,x.value=le;continue}x.value=`(${a}${le}|${x.value})`,b.output+=x.value;continue}if(k==="{"&&r.nobrace!==!0){Or("braces");let L={type:"brace",value:k,output:"(",outputIndex:b.output.length,tokensIndex:b.tokens.length};te.push(L),oe(L);continue}if(k==="}"){let L=te[te.length-1];if(r.nobrace===!0||!L){oe({type:"text",value:k,output:k});continue}let le=")";if(L.dots===!0){let _e=o.slice(),$=[];for(let j=_e.length-1;j>=0&&(o.pop(),_e[j].type!=="brace");j--)_e[j].type!=="dots"&&$.unshift(_e[j].value);le=f0($,r),b.backtrack=!0}if(L.comma!==!0&&L.dots!==!0){let _e=b.output.slice(0,L.outputIndex),$=b.tokens.slice(L.tokensIndex);L.value=L.output="\\{",k=le="\\}",b.output=_e;for(let j of $)b.output+=j.output||j.value}oe({type:"brace",value:k,output:le}),Ct("braces"),te.pop();continue}if(k==="|"){Q.length>0&&Q[Q.length-1].conditions++,oe({type:"text",value:k});continue}if(k===","){let L=k,le=te[te.length-1];le&&de[de.length-1]==="braces"&&(le.comma=!0,L="|"),oe({type:"comma",value:k,output:L});continue}if(k==="/"){if(x.type==="dot"&&b.index===b.start+1){b.start=b.index+1,b.consumed="",b.output="",o.pop(),x=i;continue}oe({type:"slash",value:k,output:g});continue}if(k==="."){if(b.braces>0&&x.type==="dot"){x.value==="."&&(x.output=d);let L=te[te.length-1];x.type="dots",x.output+=k,x.value+=k,L.dots=!0;continue}if(b.braces+b.parens===0&&x.type!=="bos"&&x.type!=="slash"){oe({type:"text",value:k,output:d});continue}oe({type:"dot",value:k,output:d});continue}if(k==="?"){if(!(x&&x.value==="(")&&r.noextglob!==!0&&X()==="("&&X(2)!=="?"){wt("qmark",k);continue}if(x&&x.type==="paren"){let le=X(),_e=k;if(le==="<"&&!Be.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(x.value==="("&&!/[!=<:]/.test(le)||le==="<"&&!/<([!=]|\w+>)/.test(ze()))&&(_e=`\\${k}`),oe({type:"text",value:k,output:_e});continue}if(r.dot!==!0&&(x.type==="slash"||x.type==="bos")){oe({type:"qmark",value:k,output:T});continue}oe({type:"qmark",value:k,output:A});continue}if(k==="!"){if(r.noextglob!==!0&&X()==="("&&(X(2)!=="?"||!/[!=<:]/.test(X(3)))){wt("negate",k);continue}if(r.nonegate!==!0&&b.index===0){lr();continue}}if(k==="+"){if(r.noextglob!==!0&&X()==="("&&X(2)!=="?"){wt("plus",k);continue}if(x&&x.value==="("||r.regex===!1){oe({type:"plus",value:k,output:f});continue}if(x&&(x.type==="bracket"||x.type==="paren"||x.type==="brace")||b.parens>0){oe({type:"plus",value:k});continue}oe({type:"plus",value:f});continue}if(k==="@"){if(r.noextglob!==!0&&X()==="("&&X(2)!=="?"){oe({type:"at",extglob:!0,value:k,output:""});continue}oe({type:"text",value:k});continue}if(k!=="*"){(k==="$"||k==="^")&&(k=`\\${k}`);let L=l0.exec(ze());L&&(k+=L[0],b.index+=L[0].length),oe({type:"text",value:k});continue}if(x&&(x.type==="globstar"||x.star===!0)){x.type="star",x.star=!0,x.value+=k,x.output=R,b.backtrack=!0,b.globstar=!0,Le(k);continue}let B=ze();if(r.noextglob!==!0&&/^\([^?]/.test(B)){wt("star",k);continue}if(x.type==="star"){if(r.noglobstar===!0){Le(k);continue}let L=x.prev,le=L.prev,_e=L.type==="slash"||L.type==="bos",$=le&&(le.type==="star"||le.type==="globstar");if(r.bash===!0&&(!_e||B[0]&&B[0]!=="/")){oe({type:"star",value:k,output:""});continue}let j=b.braces>0&&(L.type==="comma"||L.type==="brace"),O=Q.length&&(L.type==="pipe"||L.type==="paren");if(!_e&&L.type!=="paren"&&!j&&!O){oe({type:"star",value:k,output:""});continue}for(;B.slice(0,3)==="/**";){let q=t[b.index+4];if(q&&q!=="/")break;B=B.slice(3),Le("/**",3)}if(L.type==="bos"&&he()){x.type="globstar",x.value+=k,x.output=Z(r),b.output=x.output,b.globstar=!0,Le(k);continue}if(L.type==="slash"&&L.prev.type!=="bos"&&!$&&he()){b.output=b.output.slice(0,-(L.output+x.output).length),L.output=`(?:${L.output}`,x.type="globstar",x.output=Z(r)+(r.strictSlashes?")":"|$)"),x.value+=k,b.globstar=!0,b.output+=L.output+x.output,Le(k);continue}if(L.type==="slash"&&L.prev.type!=="bos"&&B[0]==="/"){let q=B[1]!==void 0?"|$":"";b.output=b.output.slice(0,-(L.output+x.output).length),L.output=`(?:${L.output}`,x.type="globstar",x.output=`${Z(r)}${g}|${g}${q})`,x.value+=k,b.output+=L.output+x.output,b.globstar=!0,Le(k+xe()),oe({type:"slash",value:"/",output:""});continue}if(L.type==="bos"&&B[0]==="/"){x.type="globstar",x.value+=k,x.output=`(?:^|${g}|${Z(r)}${g})`,b.output=x.output,b.globstar=!0,Le(k+xe()),oe({type:"slash",value:"/",output:""});continue}b.output=b.output.slice(0,-x.output.length),x.type="globstar",x.output=Z(r),x.value+=k,b.output+=x.output,b.globstar=!0,Le(k);continue}let me={type:"star",value:k,output:R};if(r.bash===!0){me.output=".*?",(x.type==="bos"||x.type==="slash")&&(me.output=F+me.output),oe(me);continue}if(x&&(x.type==="bracket"||x.type==="paren")&&r.regex===!0){me.output=k,oe(me);continue}(b.index===b.start||x.type==="slash"||x.type==="dot")&&(x.type==="dot"?(b.output+=w,x.output+=w):r.dot===!0?(b.output+=C,x.output+=C):(b.output+=F,x.output+=F),X()!=="*"&&(b.output+=m,x.output+=m)),oe(me)}for(;b.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Dn("closing","]"));b.output=Be.escapeLast(b.output,"["),Ct("brackets")}for(;b.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Dn("closing",")"));b.output=Be.escapeLast(b.output,"("),Ct("parens")}for(;b.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Dn("closing","}"));b.output=Be.escapeLast(b.output,"{"),Ct("braces")}if(r.strictSlashes!==!0&&(x.type==="star"||x.type==="bracket")&&oe({type:"maybe_slash",value:"",output:`${g}?`}),b.backtrack===!0){b.output="";for(let B of b.tokens)b.output+=B.output!=null?B.output:B.value,B.suffix&&(b.output+=B.suffix)}return b};_i.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Ts,r.maxLength):Ts,s=t.length;if(s>n)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${n}`);t=td[t]||t;let i=Be.isWindows(e),{DOT_LITERAL:o,SLASH_LITERAL:a,ONE_CHAR:c,DOTS_SLASH:u,NO_DOT:l,NO_DOTS:d,NO_DOTS_SLASH:f,STAR:g,START_ANCHOR:m}=Zn.globChars(i),y=r.dot?d:l,h=r.dot?f:l,w=r.capture?"":"?:",C={negated:!1,prefix:""},A=r.bash===!0?".*?":g;r.capture&&(A=`(${A})`);let T=F=>F.noglobstar===!0?A:`(${w}(?:(?!${m}${F.dot?u:o}).)*?)`,G=F=>{switch(F){case"*":return`${y}${c}${A}`;case".*":return`${o}${c}${A}`;case"*.*":return`${y}${A}${o}${c}${A}`;case"*/*":return`${y}${A}${a}${c}${h}${A}`;case"**":return y+T(r);case"**/*":return`(?:${y}${T(r)}${a})?${h}${c}${A}`;case"**/*.*":return`(?:${y}${T(r)}${a})?${h}${A}${o}${c}${A}`;case"**/.*":return`(?:${y}${T(r)}${a})?${o}${c}${A}`;default:{let W=/^(.*?)\.(\w+)$/.exec(F);if(!W)return;let R=G(W[1]);return R?R+o+W[2]:void 0}}},I=Be.removePrefix(t,C),Z=G(I);return Z&&r.strictSlashes!==!0&&(Z+=`${a}?`),Z};sd.exports=_i});var ad=v((_j,id)=>{"use strict";var y0=require("path"),v0=ed(),bi=od(),Si=Wn(),_0=qn(),b0=t=>t&&typeof t=="object"&&!Array.isArray(t),Fe=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(f=>Fe(f,e,r));return f=>{for(let g of l){let m=g(f);if(m)return m}return!1}}let n=b0(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let s=e||{},i=Si.isWindows(e),o=n?Fe.compileRe(t,e):Fe.makeRe(t,e,!1,!0),a=o.state;delete o.state;let c=()=>!1;if(s.ignore){let l={...e,ignore:null,onMatch:null,onResult:null};c=Fe(s.ignore,l,r)}let u=(l,d=!1)=>{let{isMatch:f,match:g,output:m}=Fe.test(l,o,e,{glob:t,posix:i}),y={glob:t,state:a,regex:o,posix:i,input:l,output:m,match:g,isMatch:f};return typeof s.onResult=="function"&&s.onResult(y),f===!1?(y.isMatch=!1,d?y:!1):c(l)?(typeof s.onIgnore=="function"&&s.onIgnore(y),y.isMatch=!1,d?y:!1):(typeof s.onMatch=="function"&&s.onMatch(y),d?y:!0)};return r&&(u.state=a),u};Fe.test=(t,e,r,{glob:n,posix:s}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let i=r||{},o=i.format||(s?Si.toPosixSlashes:null),a=t===n,c=a&&o?o(t):t;return a===!1&&(c=o?o(t):t,a=c===n),(a===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?a=Fe.matchBase(t,e,r,s):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Fe.matchBase=(t,e,r,n=Si.isWindows(r))=>(e instanceof RegExp?e:Fe.makeRe(e,r)).test(y0.basename(t));Fe.isMatch=(t,e,r)=>Fe(e,r)(t);Fe.parse=(t,e)=>Array.isArray(t)?t.map(r=>Fe.parse(r,e)):bi(t,{...e,fastpaths:!1});Fe.scan=(t,e)=>v0(t,e);Fe.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let s=e||{},i=s.contains?"":"^",o=s.contains?"":"$",a=`${i}(?:${t.output})${o}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=Fe.toRegex(a,e);return n===!0&&(c.state=t),c};Fe.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let s={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(s.output=bi.fastpaths(t,e)),s.output||(s=bi(t,e)),Fe.compileRe(s,e,r,n)};Fe.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Fe.constants=_0;id.exports=Fe});var ud=v((bj,cd)=>{"use strict";cd.exports=ad()});var md=v((Sj,pd)=>{"use strict";var dd=require("util"),fd=ql(),Wt=ud(),Ei=Wn(),ld=t=>t===""||t==="./",hd=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},Ce=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,s=new Set,i=new Set,o=0,a=l=>{i.add(l.output),r&&r.onResult&&r.onResult(l)};for(let l=0;l<e.length;l++){let d=Wt(String(e[l]),{...r,onResult:a},!0),f=d.state.negated||d.state.negatedExtglob;f&&o++;for(let g of t){let m=d(g,!0);(f?!m.isMatch:m.isMatch)&&(f?n.add(m.output):(n.delete(m.output),s.add(m.output)))}}let u=(o===e.length?[...i]:[...s]).filter(l=>!n.has(l));if(r&&u.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(l=>l.replace(/\\/g,"")):e}return u};Ce.match=Ce;Ce.matcher=(t,e)=>Wt(t,e);Ce.isMatch=(t,e,r)=>Wt(e,r)(t);Ce.any=Ce.isMatch;Ce.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,s=[],i=a=>{r.onResult&&r.onResult(a),s.push(a.output)},o=new Set(Ce(t,e,{...r,onResult:i}));for(let a of s)o.has(a)||n.add(a);return[...n]};Ce.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${dd.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>Ce.contains(t,n,r));if(typeof e=="string"){if(ld(t)||ld(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return Ce.isMatch(t,e,{...r,contains:!0})};Ce.matchKeys=(t,e,r)=>{if(!Ei.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=Ce(Object.keys(t),e,r),s={};for(let i of n)s[i]=t[i];return s};Ce.some=(t,e,r)=>{let n=[].concat(t);for(let s of[].concat(e)){let i=Wt(String(s),r);if(n.some(o=>i(o)))return!0}return!1};Ce.every=(t,e,r)=>{let n=[].concat(t);for(let s of[].concat(e)){let i=Wt(String(s),r);if(!n.every(o=>i(o)))return!1}return!0};Ce.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${dd.inspect(t)}"`);return[].concat(e).every(n=>Wt(n,r)(t))};Ce.capture=(t,e,r)=>{let n=Ei.isWindows(r),i=Wt.makeRe(String(t),{...r,capture:!0}).exec(n?Ei.toPosixSlashes(e):e);if(i)return i.slice(1).map(o=>o===void 0?"":o)};Ce.makeRe=(...t)=>Wt.makeRe(...t);Ce.scan=(...t)=>Wt.scan(...t);Ce.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let s of fd(String(n),e))r.push(Wt.parse(s,e));return r};Ce.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!hd(t)?[t]:fd(t,e)};Ce.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return Ce.braces(t,{...e,expand:!0})};Ce.hasBraces=hd;pd.exports=Ce});var wd=v(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.isAbsolute=re.partitionAbsoluteAndRelative=re.removeDuplicateSlashes=re.matchAny=re.convertPatternsToRe=re.makeRe=re.getPatternParts=re.expandBraceExpansion=re.expandPatternsWithBraceExpansion=re.isAffectDepthOfReadingPattern=re.endsWithSlashGlobStar=re.hasGlobStar=re.getBaseDirectory=re.isPatternRelatedToParentDirectory=re.getPatternsOutsideCurrentDirectory=re.getPatternsInsideCurrentDirectory=re.getPositivePatterns=re.getNegativePatterns=re.isPositivePattern=re.isNegativePattern=re.convertToNegativePattern=re.convertToPositivePattern=re.isDynamicPattern=re.isStaticPattern=void 0;var gd=require("path"),S0=ol(),Ci=md(),Dd="**",E0="\\",C0=/[*?]|^!/,w0=/\[[^[]*]/,x0=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,k0=/[!*+?@]\([^(]*\)/,$0=/,|\.\./,A0=/(?!^)\/{2,}/g;function yd(t,e={}){return!vd(t,e)}re.isStaticPattern=yd;function vd(t,e={}){return t===""?!1:!!(e.caseSensitiveMatch===!1||t.includes(E0)||C0.test(t)||w0.test(t)||x0.test(t)||e.extglob!==!1&&k0.test(t)||e.braceExpansion!==!1&&F0(t))}re.isDynamicPattern=vd;function F0(t){let e=t.indexOf("{");if(e===-1)return!1;let r=t.indexOf("}",e+1);if(r===-1)return!1;let n=t.slice(e,r);return $0.test(n)}function j0(t){return Rs(t)?t.slice(1):t}re.convertToPositivePattern=j0;function I0(t){return"!"+t}re.convertToNegativePattern=I0;function Rs(t){return t.startsWith("!")&&t[1]!=="("}re.isNegativePattern=Rs;function _d(t){return!Rs(t)}re.isPositivePattern=_d;function T0(t){return t.filter(Rs)}re.getNegativePatterns=T0;function R0(t){return t.filter(_d)}re.getPositivePatterns=R0;function P0(t){return t.filter(e=>!wi(e))}re.getPatternsInsideCurrentDirectory=P0;function O0(t){return t.filter(wi)}re.getPatternsOutsideCurrentDirectory=O0;function wi(t){return t.startsWith("..")||t.startsWith("./..")}re.isPatternRelatedToParentDirectory=wi;function N0(t){return S0(t,{flipBackslashes:!1})}re.getBaseDirectory=N0;function L0(t){return t.includes(Dd)}re.hasGlobStar=L0;function bd(t){return t.endsWith("/"+Dd)}re.endsWithSlashGlobStar=bd;function B0(t){let e=gd.basename(t);return bd(t)||yd(e)}re.isAffectDepthOfReadingPattern=B0;function M0(t){return t.reduce((e,r)=>e.concat(Sd(r)),[])}re.expandPatternsWithBraceExpansion=M0;function Sd(t){let e=Ci.braces(t,{expand:!0,nodupes:!0,keepEscaping:!0});return e.sort((r,n)=>r.length-n.length),e.filter(r=>r!=="")}re.expandBraceExpansion=Sd;function q0(t,e){let{parts:r}=Ci.scan(t,Object.assign(Object.assign({},e),{parts:!0}));return r.length===0&&(r=[t]),r[0].startsWith("/")&&(r[0]=r[0].slice(1),r.unshift("")),r}re.getPatternParts=q0;function Ed(t,e){return Ci.makeRe(t,e)}re.makeRe=Ed;function W0(t,e){return t.map(r=>Ed(r,e))}re.convertPatternsToRe=W0;function H0(t,e){return e.some(r=>r.test(t))}re.matchAny=H0;function Z0(t){return t.replace(A0,"/")}re.removeDuplicateSlashes=Z0;function U0(t){let e=[],r=[];for(let n of t)Cd(n)?e.push(n):r.push(n);return[e,r]}re.partitionAbsoluteAndRelative=U0;function Cd(t){return gd.isAbsolute(t)}re.isAbsolute=Cd});var Ad=v((Cj,$d)=>{"use strict";var V0=require("stream"),xd=V0.PassThrough,G0=Array.prototype.slice;$d.exports=z0;function z0(){let t=[],e=G0.call(arguments),r=!1,n=e[e.length-1];n&&!Array.isArray(n)&&n.pipe==null?e.pop():n={};let s=n.end!==!1,i=n.pipeError===!0;n.objectMode==null&&(n.objectMode=!0),n.highWaterMark==null&&(n.highWaterMark=64*1024);let o=xd(n);function a(){for(let l=0,d=arguments.length;l<d;l++)t.push(kd(arguments[l],n));return c(),this}function c(){if(r)return;r=!0;let l=t.shift();if(!l){process.nextTick(u);return}Array.isArray(l)||(l=[l]);let d=l.length+1;function f(){--d>0||(r=!1,c())}function g(m){function y(){m.removeListener("merge2UnpipeEnd",y),m.removeListener("end",y),i&&m.removeListener("error",h),f()}function h(w){o.emit("error",w)}if(m._readableState.endEmitted)return f();m.on("merge2UnpipeEnd",y),m.on("end",y),i&&m.on("error",h),m.pipe(o,{end:!1}),m.resume()}for(let m=0;m<l.length;m++)g(l[m]);f()}function u(){r=!1,o.emit("queueDrain"),s&&o.end()}return o.setMaxListeners(0),o.add=a,o.on("unpipe",function(l){l.emit("merge2UnpipeEnd")}),e.length&&a.apply(null,e),o}function kd(t,e){if(Array.isArray(t))for(let r=0,n=t.length;r<n;r++)t[r]=kd(t[r],e);else{if(!t._readableState&&t.pipe&&(t=t.pipe(xd(e))),!t._readableState||!t.pause||!t.pipe)throw new Error("Only readable stream can be merged.");t.pause()}return t}});var jd=v(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.merge=void 0;var Y0=Ad();function J0(t){let e=Y0(t);return t.forEach(r=>{r.once("error",n=>e.emit("error",n))}),e.once("close",()=>Fd(t)),e.once("end",()=>Fd(t)),e}Ps.merge=J0;function Fd(t){t.forEach(e=>e.emit("close"))}});var Id=v(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.isEmpty=yn.isString=void 0;function X0(t){return typeof t=="string"}yn.isString=X0;function K0(t){return t===""}yn.isEmpty=K0});var tr=v(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.string=Me.stream=Me.pattern=Me.path=Me.fs=Me.errno=Me.array=void 0;var Q0=Vu();Me.array=Q0;var e_=Gu();Me.errno=e_;var t_=zu();Me.fs=t_;var r_=Ku();Me.path=r_;var n_=wd();Me.pattern=n_;var s_=jd();Me.stream=s_;var o_=Id();Me.string=o_});var Od=v(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.convertPatternGroupToTask=qe.convertPatternGroupsToTasks=qe.groupPatternsByBaseDirectory=qe.getNegativePatternsAsPositive=qe.getPositivePatterns=qe.convertPatternsToTasks=qe.generate=void 0;var kt=tr();function i_(t,e){let r=Td(t,e),n=Td(e.ignore,e),s=Rd(r),i=Pd(r,n),o=s.filter(l=>kt.pattern.isStaticPattern(l,e)),a=s.filter(l=>kt.pattern.isDynamicPattern(l,e)),c=xi(o,i,!1),u=xi(a,i,!0);return c.concat(u)}qe.generate=i_;function Td(t,e){let r=t;return e.braceExpansion&&(r=kt.pattern.expandPatternsWithBraceExpansion(r)),e.baseNameMatch&&(r=r.map(n=>n.includes("/")?n:`**/${n}`)),r.map(n=>kt.pattern.removeDuplicateSlashes(n))}function xi(t,e,r){let n=[],s=kt.pattern.getPatternsOutsideCurrentDirectory(t),i=kt.pattern.getPatternsInsideCurrentDirectory(t),o=ki(s),a=ki(i);return n.push(...$i(o,e,r)),"."in a?n.push(Ai(".",i,e,r)):n.push(...$i(a,e,r)),n}qe.convertPatternsToTasks=xi;function Rd(t){return kt.pattern.getPositivePatterns(t)}qe.getPositivePatterns=Rd;function Pd(t,e){return kt.pattern.getNegativePatterns(t).concat(e).map(kt.pattern.convertToPositivePattern)}qe.getNegativePatternsAsPositive=Pd;function ki(t){let e={};return t.reduce((r,n)=>{let s=kt.pattern.getBaseDirectory(n);return s in r?r[s].push(n):r[s]=[n],r},e)}qe.groupPatternsByBaseDirectory=ki;function $i(t,e,r){return Object.keys(t).map(n=>Ai(n,t[n],e,r))}qe.convertPatternGroupsToTasks=$i;function Ai(t,e,r,n){return{dynamic:n,positive:e,negative:r,base:t,patterns:[].concat(e,r.map(kt.pattern.convertToNegativePattern))}}qe.convertPatternGroupToTask=Ai});var Ld=v(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.read=void 0;function a_(t,e,r){e.fs.lstat(t,(n,s)=>{if(n!==null){Nd(r,n);return}if(!s.isSymbolicLink()||!e.followSymbolicLink){Fi(r,s);return}e.fs.stat(t,(i,o)=>{if(i!==null){if(e.throwErrorOnBrokenSymbolicLink){Nd(r,i);return}Fi(r,s);return}e.markSymbolicLink&&(o.isSymbolicLink=()=>!0),Fi(r,o)})})}Os.read=a_;function Nd(t,e){t(e)}function Fi(t,e){t(null,e)}});var Bd=v(Ns=>{"use strict";Object.defineProperty(Ns,"__esModule",{value:!0});Ns.read=void 0;function c_(t,e){let r=e.fs.lstatSync(t);if(!r.isSymbolicLink()||!e.followSymbolicLink)return r;try{let n=e.fs.statSync(t);return e.markSymbolicLink&&(n.isSymbolicLink=()=>!0),n}catch(n){if(!e.throwErrorOnBrokenSymbolicLink)return r;throw n}}Ns.read=c_});var Md=v(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});mr.createFileSystemAdapter=mr.FILE_SYSTEM_ADAPTER=void 0;var Ls=require("fs");mr.FILE_SYSTEM_ADAPTER={lstat:Ls.lstat,stat:Ls.stat,lstatSync:Ls.lstatSync,statSync:Ls.statSync};function u_(t){return t===void 0?mr.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},mr.FILE_SYSTEM_ADAPTER),t)}mr.createFileSystemAdapter=u_});var qd=v(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});var l_=Md(),ji=class{constructor(e={}){this._options=e,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=l_.createFileSystemAdapter(this._options.fs),this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0)}_getValue(e,r){return e??r}};Ii.default=ji});var Br=v(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.statSync=gr.stat=gr.Settings=void 0;var Wd=Ld(),d_=Bd(),Ti=qd();gr.Settings=Ti.default;function f_(t,e,r){if(typeof e=="function"){Wd.read(t,Ri(),e);return}Wd.read(t,Ri(e),r)}gr.stat=f_;function h_(t,e){let r=Ri(e);return d_.read(t,r)}gr.statSync=h_;function Ri(t={}){return t instanceof Ti.default?t:new Ti.default(t)}});var Ud=v((Rj,Zd)=>{var Hd;Zd.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:global):t=>(Hd||(Hd=Promise.resolve())).then(t).catch(e=>setTimeout(()=>{throw e},0))});var Gd=v((Pj,Vd)=>{Vd.exports=m_;var p_=Ud();function m_(t,e){let r,n,s,i=!0;Array.isArray(t)?(r=[],n=t.length):(s=Object.keys(t),r={},n=s.length);function o(c){function u(){e&&e(c,r),e=null}i?p_(u):u()}function a(c,u,l){r[c]=l,(--n===0||u)&&o(u)}n?s?s.forEach(function(c){t[c](function(u,l){a(c,u,l)})}):t.forEach(function(c,u){c(function(l,d){a(u,l,d)})}):o(null),i=!1}});var Pi=v(Ms=>{"use strict";Object.defineProperty(Ms,"__esModule",{value:!0});Ms.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;var Bs=process.versions.node.split(".");if(Bs[0]===void 0||Bs[1]===void 0)throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);var zd=Number.parseInt(Bs[0],10),g_=Number.parseInt(Bs[1],10),Yd=10,D_=10,y_=zd>Yd,v_=zd===Yd&&g_>=D_;Ms.IS_SUPPORT_READDIR_WITH_FILE_TYPES=y_||v_});var Jd=v(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});qs.createDirentFromStats=void 0;var Oi=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function __(t,e){return new Oi(t,e)}qs.createDirentFromStats=__});var Ni=v(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.fs=void 0;var b_=Jd();Ws.fs=b_});var Li=v(Hs=>{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});Hs.joinPathSegments=void 0;function S_(t,e,r){return t.endsWith(r)?t+e:t+r+e}Hs.joinPathSegments=S_});var rf=v(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.readdir=Dr.readdirWithFileTypes=Dr.read=void 0;var E_=Br(),Xd=Gd(),C_=Pi(),Kd=Ni(),Qd=Li();function w_(t,e,r){if(!e.stats&&C_.IS_SUPPORT_READDIR_WITH_FILE_TYPES){ef(t,e,r);return}tf(t,e,r)}Dr.read=w_;function ef(t,e,r){e.fs.readdir(t,{withFileTypes:!0},(n,s)=>{if(n!==null){Zs(r,n);return}let i=s.map(a=>({dirent:a,name:a.name,path:Qd.joinPathSegments(t,a.name,e.pathSegmentSeparator)}));if(!e.followSymbolicLinks){Bi(r,i);return}let o=i.map(a=>x_(a,e));Xd(o,(a,c)=>{if(a!==null){Zs(r,a);return}Bi(r,c)})})}Dr.readdirWithFileTypes=ef;function x_(t,e){return r=>{if(!t.dirent.isSymbolicLink()){r(null,t);return}e.fs.stat(t.path,(n,s)=>{if(n!==null){if(e.throwErrorOnBrokenSymbolicLink){r(n);return}r(null,t);return}t.dirent=Kd.fs.createDirentFromStats(t.name,s),r(null,t)})}}function tf(t,e,r){e.fs.readdir(t,(n,s)=>{if(n!==null){Zs(r,n);return}let i=s.map(o=>{let a=Qd.joinPathSegments(t,o,e.pathSegmentSeparator);return c=>{E_.stat(a,e.fsStatSettings,(u,l)=>{if(u!==null){c(u);return}let d={name:o,path:a,dirent:Kd.fs.createDirentFromStats(o,l)};e.stats&&(d.stats=l),c(null,d)})}});Xd(i,(o,a)=>{if(o!==null){Zs(r,o);return}Bi(r,a)})})}Dr.readdir=tf;function Zs(t,e){t(e)}function Bi(t,e){t(null,e)}});var cf=v(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.readdir=yr.readdirWithFileTypes=yr.read=void 0;var k_=Br(),$_=Pi(),nf=Ni(),sf=Li();function A_(t,e){return!e.stats&&$_.IS_SUPPORT_READDIR_WITH_FILE_TYPES?of(t,e):af(t,e)}yr.read=A_;function of(t,e){return e.fs.readdirSync(t,{withFileTypes:!0}).map(n=>{let s={dirent:n,name:n.name,path:sf.joinPathSegments(t,n.name,e.pathSegmentSeparator)};if(s.dirent.isSymbolicLink()&&e.followSymbolicLinks)try{let i=e.fs.statSync(s.path);s.dirent=nf.fs.createDirentFromStats(s.name,i)}catch(i){if(e.throwErrorOnBrokenSymbolicLink)throw i}return s})}yr.readdirWithFileTypes=of;function af(t,e){return e.fs.readdirSync(t).map(n=>{let s=sf.joinPathSegments(t,n,e.pathSegmentSeparator),i=k_.statSync(s,e.fsStatSettings),o={name:n,path:s,dirent:nf.fs.createDirentFromStats(n,i)};return e.stats&&(o.stats=i),o})}yr.readdir=af});var uf=v(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.createFileSystemAdapter=vr.FILE_SYSTEM_ADAPTER=void 0;var vn=require("fs");vr.FILE_SYSTEM_ADAPTER={lstat:vn.lstat,stat:vn.stat,lstatSync:vn.lstatSync,statSync:vn.statSync,readdir:vn.readdir,readdirSync:vn.readdirSync};function F_(t){return t===void 0?vr.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},vr.FILE_SYSTEM_ADAPTER),t)}vr.createFileSystemAdapter=F_});var lf=v(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});var j_=require("path"),I_=Br(),T_=uf(),Mi=class{constructor(e={}){this._options=e,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=T_.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,j_.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new I_.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};qi.default=Mi});var Us=v(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.Settings=_r.scandirSync=_r.scandir=void 0;var df=rf(),R_=cf(),Wi=lf();_r.Settings=Wi.default;function P_(t,e,r){if(typeof e=="function"){df.read(t,Hi(),e);return}df.read(t,Hi(e),r)}_r.scandir=P_;function O_(t,e){let r=Hi(e);return R_.read(t,r)}_r.scandirSync=O_;function Hi(t={}){return t instanceof Wi.default?t:new Wi.default(t)}});var hf=v((Uj,ff)=>{"use strict";function N_(t){var e=new t,r=e;function n(){var i=e;return i.next?e=i.next:(e=new t,r=e),i.next=null,i}function s(i){r.next=i,r=i}return{get:n,release:s}}ff.exports=N_});var mf=v((Vj,Zi)=>{"use strict";var L_=hf();function pf(t,e,r){if(typeof t=="function"&&(r=e,e=t,t=null),!(r>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");var n=L_(B_),s=null,i=null,o=0,a=null,c={push:y,drain:rt,saturated:rt,pause:l,paused:!1,get concurrency(){return r},set concurrency(I){if(!(I>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");if(r=I,!c.paused)for(;s&&o<r;)o++,w()},running:u,resume:g,idle:m,length:d,getQueue:f,unshift:h,empty:rt,kill:C,killAndDrain:A,error:G,abort:T};return c;function u(){return o}function l(){c.paused=!0}function d(){for(var I=s,Z=0;I;)I=I.next,Z++;return Z}function f(){for(var I=s,Z=[];I;)Z.push(I.value),I=I.next;return Z}function g(){if(c.paused){if(c.paused=!1,s===null){o++,w();return}for(;s&&o<r;)o++,w()}}function m(){return o===0&&c.length()===0}function y(I,Z){var F=n.get();F.context=t,F.release=w,F.value=I,F.callback=Z||rt,F.errorHandler=a,o>=r||c.paused?i?(i.next=F,i=F):(s=F,i=F,c.saturated()):(o++,e.call(t,F.value,F.worked))}function h(I,Z){var F=n.get();F.context=t,F.release=w,F.value=I,F.callback=Z||rt,F.errorHandler=a,o>=r||c.paused?s?(F.next=s,s=F):(s=F,i=F,c.saturated()):(o++,e.call(t,F.value,F.worked))}function w(I){I&&n.release(I);var Z=s;Z&&o<=r?c.paused?o--:(i===s&&(i=null),s=Z.next,Z.next=null,e.call(t,Z.value,Z.worked),i===null&&c.empty()):--o===0&&c.drain()}function C(){s=null,i=null,c.drain=rt}function A(){s=null,i=null,c.drain(),c.drain=rt}function T(){var I=s;for(s=null,i=null;I;){var Z=I.next,F=I.callback,W=I.errorHandler,R=I.value,b=I.context;I.value=null,I.callback=rt,I.errorHandler=null,W&&W(new Error("abort"),R),F.call(b,new Error("abort")),I.release(I),I=Z}c.drain=rt}function G(I){a=I}}function rt(){}function B_(){this.value=null,this.callback=rt,this.next=null,this.release=rt,this.context=null,this.errorHandler=null;var t=this;this.worked=function(r,n){var s=t.callback,i=t.errorHandler,o=t.value;t.value=null,t.callback=rt,t.errorHandler&&i(r,o),s.call(t.context,r,n),t.release(t)}}function M_(t,e,r){typeof t=="function"&&(r=e,e=t,t=null);function n(l,d){e.call(this,l).then(function(f){d(null,f)},d)}var s=pf(t,n,r),i=s.push,o=s.unshift;return s.push=a,s.unshift=c,s.drained=u,s;function a(l){var d=new Promise(function(f,g){i(l,function(m,y){if(m){g(m);return}f(y)})});return d.catch(rt),d}function c(l){var d=new Promise(function(f,g){o(l,function(m,y){if(m){g(m);return}f(y)})});return d.catch(rt),d}function u(){var l=new Promise(function(d){process.nextTick(function(){if(s.idle())d();else{var f=s.drain;s.drain=function(){typeof f=="function"&&f(),d(),s.drain=f}}})});return l}}Zi.exports=pf;Zi.exports.promise=M_});var Vs=v(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.joinPathSegments=Ht.replacePathSegmentSeparator=Ht.isAppliedFilter=Ht.isFatalError=void 0;function q_(t,e){return t.errorFilter===null?!0:!t.errorFilter(e)}Ht.isFatalError=q_;function W_(t,e){return t===null||t(e)}Ht.isAppliedFilter=W_;function H_(t,e){return t.split(/[/\\]/).join(e)}Ht.replacePathSegmentSeparator=H_;function Z_(t,e,r){return t===""?e:t.endsWith(r)?t+e:t+r+e}Ht.joinPathSegments=Z_});var Gi=v(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});var U_=Vs(),Ui=class{constructor(e,r){this._root=e,this._settings=r,this._root=U_.replacePathSegmentSeparator(e,r.pathSegmentSeparator)}};Vi.default=Ui});var Ji=v(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});var V_=require("events"),G_=Us(),z_=mf(),Gs=Vs(),Y_=Gi(),zi=class extends Y_.default{constructor(e,r){super(e,r),this._settings=r,this._scandir=G_.scandir,this._emitter=new V_.EventEmitter,this._queue=z_(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{this._isFatalError||this._emitter.emit("end")}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate(()=>{this._pushToQueue(this._root,this._settings.basePath)}),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw new Error("The reader is already destroyed");this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(e){this._emitter.on("entry",e)}onError(e){this._emitter.once("error",e)}onEnd(e){this._emitter.once("end",e)}_pushToQueue(e,r){let n={directory:e,base:r};this._queue.push(n,s=>{s!==null&&this._handleError(s)})}_worker(e,r){this._scandir(e.directory,this._settings.fsScandirSettings,(n,s)=>{if(n!==null){r(n,void 0);return}for(let i of s)this._handleEntry(i,e.base);r(null,void 0)})}_handleError(e){this._isDestroyed||!Gs.isFatalError(this._settings,e)||(this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit("error",e))}_handleEntry(e,r){if(this._isDestroyed||this._isFatalError)return;let n=e.path;r!==void 0&&(e.path=Gs.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),Gs.isAppliedFilter(this._settings.entryFilter,e)&&this._emitEntry(e),e.dirent.isDirectory()&&Gs.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,r===void 0?void 0:e.path)}_emitEntry(e){this._emitter.emit("entry",e)}};Yi.default=zi});var gf=v(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});var J_=Ji(),Xi=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new J_.default(this._root,this._settings),this._storage=[]}read(e){this._reader.onError(r=>{X_(e,r)}),this._reader.onEntry(r=>{this._storage.push(r)}),this._reader.onEnd(()=>{K_(e,this._storage)}),this._reader.read()}};Ki.default=Xi;function X_(t,e){t(e)}function K_(t,e){t(null,e)}});var Df=v(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});var Q_=require("stream"),eb=Ji(),Qi=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new eb.default(this._root,this._settings),this._stream=new Q_.Readable({objectMode:!0,read:()=>{},destroy:()=>{this._reader.isDestroyed||this._reader.destroy()}})}read(){return this._reader.onError(e=>{this._stream.emit("error",e)}),this._reader.onEntry(e=>{this._stream.push(e)}),this._reader.onEnd(()=>{this._stream.push(null)}),this._reader.read(),this._stream}};ea.default=Qi});var yf=v(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});var tb=Us(),zs=Vs(),rb=Gi(),ta=class extends rb.default{constructor(){super(...arguments),this._scandir=tb.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(e,r){this._queue.add({directory:e,base:r})}_handleQueue(){for(let e of this._queue.values())this._handleDirectory(e.directory,e.base)}_handleDirectory(e,r){try{let n=this._scandir(e,this._settings.fsScandirSettings);for(let s of n)this._handleEntry(s,r)}catch(n){this._handleError(n)}}_handleError(e){if(zs.isFatalError(this._settings,e))throw e}_handleEntry(e,r){let n=e.path;r!==void 0&&(e.path=zs.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),zs.isAppliedFilter(this._settings.entryFilter,e)&&this._pushToStorage(e),e.dirent.isDirectory()&&zs.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,r===void 0?void 0:e.path)}_pushToStorage(e){this._storage.push(e)}};ra.default=ta});var vf=v(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});var nb=yf(),na=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new nb.default(this._root,this._settings)}read(){return this._reader.read()}};sa.default=na});var _f=v(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});var sb=require("path"),ob=Us(),oa=class{constructor(e={}){this._options=e,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,sb.sep),this.fsScandirSettings=new ob.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};ia.default=oa});var Js=v(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.Settings=Zt.walkStream=Zt.walkSync=Zt.walk=void 0;var bf=gf(),ib=Df(),ab=vf(),aa=_f();Zt.Settings=aa.default;function cb(t,e,r){if(typeof e=="function"){new bf.default(t,Ys()).read(e);return}new bf.default(t,Ys(e)).read(r)}Zt.walk=cb;function ub(t,e){let r=Ys(e);return new ab.default(t,r).read()}Zt.walkSync=ub;function lb(t,e){let r=Ys(e);return new ib.default(t,r).read()}Zt.walkStream=lb;function Ys(t={}){return t instanceof aa.default?t:new aa.default(t)}});var Xs=v(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});var db=require("path"),fb=Br(),Sf=tr(),ca=class{constructor(e){this._settings=e,this._fsStatSettings=new fb.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(e){return db.resolve(this._settings.cwd,e)}_makeEntry(e,r){let n={name:r,path:r,dirent:Sf.fs.createDirentFromStats(r,e)};return this._settings.stats&&(n.stats=e),n}_isFatalError(e){return!Sf.errno.isEnoentCodeError(e)&&!this._settings.suppressErrors}};ua.default=ca});var fa=v(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});var hb=require("stream"),pb=Br(),mb=Js(),gb=Xs(),la=class extends gb.default{constructor(){super(...arguments),this._walkStream=mb.walkStream,this._stat=pb.stat}dynamic(e,r){return this._walkStream(e,r)}static(e,r){let n=e.map(this._getFullEntryPath,this),s=new hb.PassThrough({objectMode:!0});s._write=(i,o,a)=>this._getEntry(n[i],e[i],r).then(c=>{c!==null&&r.entryFilter(c)&&s.push(c),i===n.length-1&&s.end(),a()}).catch(a);for(let i=0;i<n.length;i++)s.write(i);return s}_getEntry(e,r,n){return this._getStat(e).then(s=>this._makeEntry(s,r)).catch(s=>{if(n.errorFilter(s))return null;throw s})}_getStat(e){return new Promise((r,n)=>{this._stat(e,this._fsStatSettings,(s,i)=>s===null?r(i):n(s))})}};da.default=la});var Ef=v(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});var Db=Js(),yb=Xs(),vb=fa(),ha=class extends yb.default{constructor(){super(...arguments),this._walkAsync=Db.walk,this._readerStream=new vb.default(this._settings)}dynamic(e,r){return new Promise((n,s)=>{this._walkAsync(e,r,(i,o)=>{i===null?n(o):s(i)})})}async static(e,r){let n=[],s=this._readerStream.static(e,r);return new Promise((i,o)=>{s.once("error",o),s.on("data",a=>n.push(a)),s.once("end",()=>i(n))})}};pa.default=ha});var Cf=v(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});var Un=tr(),ma=class{constructor(e,r,n){this._patterns=e,this._settings=r,this._micromatchOptions=n,this._storage=[],this._fillStorage()}_fillStorage(){for(let e of this._patterns){let r=this._getPatternSegments(e),n=this._splitSegmentsIntoSections(r);this._storage.push({complete:n.length<=1,pattern:e,segments:r,sections:n})}}_getPatternSegments(e){return Un.pattern.getPatternParts(e,this._micromatchOptions).map(n=>Un.pattern.isDynamicPattern(n,this._settings)?{dynamic:!0,pattern:n,patternRe:Un.pattern.makeRe(n,this._micromatchOptions)}:{dynamic:!1,pattern:n})}_splitSegmentsIntoSections(e){return Un.array.splitWhen(e,r=>r.dynamic&&Un.pattern.hasGlobStar(r.pattern))}};ga.default=ma});var wf=v(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});var _b=Cf(),Da=class extends _b.default{match(e){let r=e.split("/"),n=r.length,s=this._storage.filter(i=>!i.complete||i.segments.length>n);for(let i of s){let o=i.sections[0];if(!i.complete&&n>o.length||r.every((c,u)=>{let l=i.segments[u];return!!(l.dynamic&&l.patternRe.test(c)||!l.dynamic&&l.pattern===c)}))return!0}return!1}};ya.default=Da});var xf=v(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});var Ks=tr(),bb=wf(),va=class{constructor(e,r){this._settings=e,this._micromatchOptions=r}getFilter(e,r,n){let s=this._getMatcher(r),i=this._getNegativePatternsRe(n);return o=>this._filter(e,o,s,i)}_getMatcher(e){return new bb.default(e,this._settings,this._micromatchOptions)}_getNegativePatternsRe(e){let r=e.filter(Ks.pattern.isAffectDepthOfReadingPattern);return Ks.pattern.convertPatternsToRe(r,this._micromatchOptions)}_filter(e,r,n,s){if(this._isSkippedByDeep(e,r.path)||this._isSkippedSymbolicLink(r))return!1;let i=Ks.path.removeLeadingDotSegment(r.path);return this._isSkippedByPositivePatterns(i,n)?!1:this._isSkippedByNegativePatterns(i,s)}_isSkippedByDeep(e,r){return this._settings.deep===1/0?!1:this._getEntryLevel(e,r)>=this._settings.deep}_getEntryLevel(e,r){let n=r.split("/").length;if(e==="")return n;let s=e.split("/").length;return n-s}_isSkippedSymbolicLink(e){return!this._settings.followSymbolicLinks&&e.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(e,r){return!this._settings.baseNameMatch&&!r.match(e)}_isSkippedByNegativePatterns(e,r){return!Ks.pattern.matchAny(e,r)}};_a.default=va});var kf=v(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});var br=tr(),ba=class{constructor(e,r){this._settings=e,this._micromatchOptions=r,this.index=new Map}getFilter(e,r){let[n,s]=br.pattern.partitionAbsoluteAndRelative(r),i={positive:{all:br.pattern.convertPatternsToRe(e,this._micromatchOptions)},negative:{absolute:br.pattern.convertPatternsToRe(n,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0})),relative:br.pattern.convertPatternsToRe(s,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}))}};return o=>this._filter(o,i)}_filter(e,r){let n=br.path.removeLeadingDotSegment(e.path);if(this._settings.unique&&this._isDuplicateEntry(n)||this._onlyFileFilter(e)||this._onlyDirectoryFilter(e))return!1;let s=this._isMatchToPatternsSet(n,r,e.dirent.isDirectory());return this._settings.unique&&s&&this._createIndexRecord(n),s}_isDuplicateEntry(e){return this.index.has(e)}_createIndexRecord(e){this.index.set(e,void 0)}_onlyFileFilter(e){return this._settings.onlyFiles&&!e.dirent.isFile()}_onlyDirectoryFilter(e){return this._settings.onlyDirectories&&!e.dirent.isDirectory()}_isMatchToPatternsSet(e,r,n){return!(!this._isMatchToPatterns(e,r.positive.all,n)||this._isMatchToPatterns(e,r.negative.relative,n)||this._isMatchToAbsoluteNegative(e,r.negative.absolute,n))}_isMatchToAbsoluteNegative(e,r,n){if(r.length===0)return!1;let s=br.path.makeAbsolute(this._settings.cwd,e);return this._isMatchToPatterns(s,r,n)}_isMatchToPatterns(e,r,n){if(r.length===0)return!1;let s=br.pattern.matchAny(e,r);return!s&&n?br.pattern.matchAny(e+"/",r):s}};Sa.default=ba});var $f=v(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});var Sb=tr(),Ea=class{constructor(e){this._settings=e}getFilter(){return e=>this._isNonFatalError(e)}_isNonFatalError(e){return Sb.errno.isEnoentCodeError(e)||this._settings.suppressErrors}};Ca.default=Ea});var Ff=v(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});var Af=tr(),wa=class{constructor(e){this._settings=e}getTransformer(){return e=>this._transform(e)}_transform(e){let r=e.path;return this._settings.absolute&&(r=Af.path.makeAbsolute(this._settings.cwd,r),r=Af.path.unixify(r)),this._settings.markDirectories&&e.dirent.isDirectory()&&(r+="/"),this._settings.objectMode?Object.assign(Object.assign({},e),{path:r}):r}};xa.default=wa});var Qs=v($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});var Eb=require("path"),Cb=xf(),wb=kf(),xb=$f(),kb=Ff(),ka=class{constructor(e){this._settings=e,this.errorFilter=new xb.default(this._settings),this.entryFilter=new wb.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new Cb.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new kb.default(this._settings)}_getRootDirectory(e){return Eb.resolve(this._settings.cwd,e.base)}_getReaderOptions(e){let r=e.base==="."?"":e.base;return{basePath:r,pathSegmentSeparator:"/",concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(r,e.positive,e.negative),entryFilter:this.entryFilter.getFilter(e.positive,e.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}};$a.default=ka});var jf=v(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});var $b=Ef(),Ab=Qs(),Aa=class extends Ab.default{constructor(){super(...arguments),this._reader=new $b.default(this._settings)}async read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e);return(await this.api(r,e,n)).map(i=>n.transform(i))}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};Fa.default=Aa});var If=v(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});var Fb=require("stream"),jb=fa(),Ib=Qs(),ja=class extends Ib.default{constructor(){super(...arguments),this._reader=new jb.default(this._settings)}read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e),s=this.api(r,e,n),i=new Fb.Readable({objectMode:!0,read:()=>{}});return s.once("error",o=>i.emit("error",o)).on("data",o=>i.emit("data",n.transform(o))).once("end",()=>i.emit("end")),i.once("close",()=>s.destroy()),i}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};Ia.default=ja});var Tf=v(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});var Tb=Br(),Rb=Js(),Pb=Xs(),Ta=class extends Pb.default{constructor(){super(...arguments),this._walkSync=Rb.walkSync,this._statSync=Tb.statSync}dynamic(e,r){return this._walkSync(e,r)}static(e,r){let n=[];for(let s of e){let i=this._getFullEntryPath(s),o=this._getEntry(i,s,r);o===null||!r.entryFilter(o)||n.push(o)}return n}_getEntry(e,r,n){try{let s=this._getStat(e);return this._makeEntry(s,r)}catch(s){if(n.errorFilter(s))return null;throw s}}_getStat(e){return this._statSync(e,this._fsStatSettings)}};Ra.default=Ta});var Rf=v(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});var Ob=Tf(),Nb=Qs(),Pa=class extends Nb.default{constructor(){super(...arguments),this._reader=new Ob.default(this._settings)}read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e);return this.api(r,e,n).map(n.transform)}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};Oa.default=Pa});var Pf=v(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;var _n=require("fs"),Lb=require("os"),Bb=Math.max(Lb.cpus().length,1);bn.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:_n.lstat,lstatSync:_n.lstatSync,stat:_n.stat,statSync:_n.statSync,readdir:_n.readdir,readdirSync:_n.readdirSync};var Na=class{constructor(e={}){this._options=e,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,Bb),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories&&(this.onlyFiles=!1),this.stats&&(this.objectMode=!0),this.ignore=[].concat(this.ignore)}_getValue(e,r){return e===void 0?r:e}_getFileSystemMethods(e={}){return Object.assign(Object.assign({},bn.DEFAULT_FILE_SYSTEM_ADAPTER),e)}};bn.default=Na});var Lf=v((D2,Nf)=>{"use strict";var Of=Od(),Mb=jf(),qb=If(),Wb=Rf(),La=Pf(),pt=tr();async function Ba(t,e){$t(t);let r=Ma(t,Mb.default,e),n=await Promise.all(r);return pt.array.flatten(n)}(function(t){t.glob=t,t.globSync=e,t.globStream=r,t.async=t;function e(u,l){$t(u);let d=Ma(u,Wb.default,l);return pt.array.flatten(d)}t.sync=e;function r(u,l){$t(u);let d=Ma(u,qb.default,l);return pt.stream.merge(d)}t.stream=r;function n(u,l){$t(u);let d=[].concat(u),f=new La.default(l);return Of.generate(d,f)}t.generateTasks=n;function s(u,l){$t(u);let d=new La.default(l);return pt.pattern.isDynamicPattern(u,d)}t.isDynamicPattern=s;function i(u){return $t(u),pt.path.escape(u)}t.escapePath=i;function o(u){return $t(u),pt.path.convertPathToPattern(u)}t.convertPathToPattern=o;let a;(function(u){function l(f){return $t(f),pt.path.escapePosixPath(f)}u.escapePath=l;function d(f){return $t(f),pt.path.convertPosixPathToPattern(f)}u.convertPathToPattern=d})(a=t.posix||(t.posix={}));let c;(function(u){function l(f){return $t(f),pt.path.escapeWindowsPath(f)}u.escapePath=l;function d(f){return $t(f),pt.path.convertWindowsPathToPattern(f)}u.convertPathToPattern=d})(c=t.win32||(t.win32={}))})(Ba||(Ba={}));function Ma(t,e,r){let n=[].concat(t),s=new La.default(r),i=Of.generate(n,s),o=new e(s);return i.map(o.read,o)}function $t(t){if(![].concat(t).every(n=>pt.string.isString(n)&&!pt.string.isEmpty(n)))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}Nf.exports=Ba});var Vn=v(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.getParsedType=be.ZodParsedType=be.objectUtil=be.util=void 0;var qa;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function r(s){throw new Error}t.assertNever=r,t.arrayToEnum=s=>{let i={};for(let o of s)i[o]=o;return i},t.getValidEnumValues=s=>{let i=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(let a of i)o[a]=s[a];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let i=[];for(let o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(let o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(qa||(be.util=qa={}));var Bf;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Bf||(be.objectUtil=Bf={}));be.ZodParsedType=qa.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var Hb=t=>{switch(typeof t){case"undefined":return be.ZodParsedType.undefined;case"string":return be.ZodParsedType.string;case"number":return Number.isNaN(t)?be.ZodParsedType.nan:be.ZodParsedType.number;case"boolean":return be.ZodParsedType.boolean;case"function":return be.ZodParsedType.function;case"bigint":return be.ZodParsedType.bigint;case"symbol":return be.ZodParsedType.symbol;case"object":return Array.isArray(t)?be.ZodParsedType.array:t===null?be.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?be.ZodParsedType.promise:typeof Map<"u"&&t instanceof Map?be.ZodParsedType.map:typeof Set<"u"&&t instanceof Set?be.ZodParsedType.set:typeof Date<"u"&&t instanceof Date?be.ZodParsedType.date:be.ZodParsedType.object;default:return be.ZodParsedType.unknown}};be.getParsedType=Hb});var eo=v(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.ZodError=Sr.quotelessJson=Sr.ZodIssueCode=void 0;var Mf=Vn();Sr.ZodIssueCode=Mf.util.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"]);var Zb=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");Sr.quotelessJson=Zb;var Gn=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},s=i=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let a=n,c=0;for(;c<o.path.length;){let u=o.path[c];c===o.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(o))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return s(this),n}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,Mf.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let s of this.issues)if(s.path.length>0){let i=s.path[0];r[i]=r[i]||[],r[i].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Sr.ZodError=Gn;Gn.create=t=>new Gn(t)});var Ha=v(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});var We=eo(),Mr=Vn(),Ub=(t,e)=>{let r;switch(t.code){case We.ZodIssueCode.invalid_type:t.received===Mr.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case We.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Mr.util.jsonStringifyReplacer)}`;break;case We.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${Mr.util.joinValues(t.keys,", ")}`;break;case We.ZodIssueCode.invalid_union:r="Invalid input";break;case We.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Mr.util.joinValues(t.options)}`;break;case We.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${Mr.util.joinValues(t.options)}, received '${t.received}'`;break;case We.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case We.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case We.ZodIssueCode.invalid_date:r="Invalid date";break;case We.ZodIssueCode.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Mr.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case We.ZodIssueCode.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case We.ZodIssueCode.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case We.ZodIssueCode.custom:r="Invalid input";break;case We.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case We.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case We.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,Mr.util.assertNever(t)}return{message:r}};Wa.default=Ub});var to=v(Er=>{"use strict";var Vb=Er&&Er.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Er,"__esModule",{value:!0});Er.defaultErrorMap=void 0;Er.setErrorMap=Gb;Er.getErrorMap=zb;var qf=Vb(Ha());Er.defaultErrorMap=qf.default;var Wf=qf.default;function Gb(t){Wf=t}function zb(){return Wf}});var Ua=v(De=>{"use strict";var Yb=De&&De.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(De,"__esModule",{value:!0});De.isAsync=De.isValid=De.isDirty=De.isAborted=De.OK=De.DIRTY=De.INVALID=De.ParseStatus=De.EMPTY_PATH=De.makeIssue=void 0;De.addIssueToContext=Kb;var Jb=to(),Hf=Yb(Ha()),Xb=t=>{let{data:e,path:r,errorMaps:n,issueData:s}=t,i=[...r,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}};De.makeIssue=Xb;De.EMPTY_PATH=[];function Kb(t,e){let r=(0,Jb.getErrorMap)(),n=(0,De.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Hf.default?void 0:Hf.default].filter(s=>!!s)});t.common.issues.push(n)}var Za=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let s of r){if(s.status==="aborted")return De.INVALID;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let s of r){let i=await s.key,o=await s.value;n.push({key:i,value:o})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let s of r){let{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return De.INVALID;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(n[i.value]=o.value)}return{status:e.value,value:n}}};De.ParseStatus=Za;De.INVALID=Object.freeze({status:"aborted"});var Qb=t=>({status:"dirty",value:t});De.DIRTY=Qb;var eS=t=>({status:"valid",value:t});De.OK=eS;var tS=t=>t.status==="aborted";De.isAborted=tS;var rS=t=>t.status==="dirty";De.isDirty=rS;var nS=t=>t.status==="valid";De.isValid=nS;var sS=t=>typeof Promise<"u"&&t instanceof Promise;De.isAsync=sS});var Uf=v(Zf=>{"use strict";Object.defineProperty(Zf,"__esModule",{value:!0})});var Gf=v(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.errorUtil=void 0;var Vf;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Vf||(ro.errorUtil=Vf={}))});var oh=v(S=>{"use strict";Object.defineProperty(S,"__esModule",{value:!0});S.discriminatedUnion=S.date=S.boolean=S.bigint=S.array=S.any=S.coerce=S.ZodFirstPartyTypeKind=S.late=S.ZodSchema=S.Schema=S.ZodReadonly=S.ZodPipeline=S.ZodBranded=S.BRAND=S.ZodNaN=S.ZodCatch=S.ZodDefault=S.ZodNullable=S.ZodOptional=S.ZodTransformer=S.ZodEffects=S.ZodPromise=S.ZodNativeEnum=S.ZodEnum=S.ZodLiteral=S.ZodLazy=S.ZodFunction=S.ZodSet=S.ZodMap=S.ZodRecord=S.ZodTuple=S.ZodIntersection=S.ZodDiscriminatedUnion=S.ZodUnion=S.ZodObject=S.ZodArray=S.ZodVoid=S.ZodNever=S.ZodUnknown=S.ZodAny=S.ZodNull=S.ZodUndefined=S.ZodSymbol=S.ZodDate=S.ZodBoolean=S.ZodBigInt=S.ZodNumber=S.ZodString=S.ZodType=void 0;S.NEVER=S.void=S.unknown=S.union=S.undefined=S.tuple=S.transformer=S.symbol=S.string=S.strictObject=S.set=S.record=S.promise=S.preprocess=S.pipeline=S.ostring=S.optional=S.onumber=S.oboolean=S.object=S.number=S.nullable=S.null=S.never=S.nativeEnum=S.nan=S.map=S.literal=S.lazy=S.intersection=S.instanceof=S.function=S.enum=S.effect=void 0;S.datetimeRegex=Kf;S.custom=eh;var P=eo(),no=to(),K=Gf(),E=Ua(),N=Vn(),gt=class{constructor(e,r,n,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=s}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}},zf=(t,e)=>{if((0,E.isValid)(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 r=new P.ZodError(t.common.issues);return this._error=r,this._error}}};function ae(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:s}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>{let{message:c}=t;return o.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:s}}var ce=class{get description(){return this._def.description}_getType(e){return(0,N.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,N.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new E.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,N.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,E.isAsync)(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,N.getParsedType)(e)},s=this._parseSync({data:e,path:n.path,parent:n});return zf(n,s)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,N.getParsedType)(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return(0,E.isValid)(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>(0,E.isValid)(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,N.getParsedType)(e)},s=this._parse({data:e,path:n.path,parent:n}),i=await((0,E.isAsync)(s)?s:Promise.resolve(s));return zf(n,i)}refine(e,r){let n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,i)=>{let o=e(s),a=()=>i.addIssue({code:P.ZodIssueCode.custom,...n(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(e){return new ut({schema:this,typeName:ne.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:r=>this["~validate"](r)}}optional(){return mt.create(this,this._def)}nullable(){return Vt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return sr.create(this)}promise(){return xr.create(this,this._def)}or(e){return Gr.create([this,e],this._def)}and(e){return zr.create(this,e,this._def)}transform(e){return new ut({...ae(this._def),schema:this,typeName:ne.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Qr({...ae(this._def),innerType:this,defaultValue:r,typeName:ne.ZodDefault})}brand(){return new zn({typeName:ne.ZodBranded,type:this,...ae(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new en({...ae(this._def),innerType:this,catchValue:r,typeName:ne.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Yn.create(this,e)}readonly(){return tn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};S.ZodType=ce;S.Schema=ce;S.ZodSchema=ce;var oS=/^c[^\s-]{8,}$/i,iS=/^[0-9a-z]+$/,aS=/^[0-9A-HJKMNP-TV-Z]{26}$/i,cS=/^[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,uS=/^[a-z0-9_-]{21}$/i,lS=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,dS=/^[-+]?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)?)??$/,fS=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,hS="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Va,pS=/^(?:(?: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])$/,mS=/^(?:(?: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])$/,gS=/^(([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]))$/,DS=/^(([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])$/,yS=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,vS=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Jf="((\\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])))",_S=new RegExp(`^${Jf}$`);function Xf(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function bS(t){return new RegExp(`^${Xf(t)}$`)}function Kf(t){let e=`${Jf}T${Xf(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function SS(t,e){return!!((e==="v4"||!e)&&pS.test(t)||(e==="v6"||!e)&&gS.test(t))}function ES(t,e){if(!lS.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function CS(t,e){return!!((e==="v4"||!e)&&mS.test(t)||(e==="v6"||!e)&&DS.test(t))}var Cr=class t extends ce{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==N.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(i,{code:P.ZodIssueCode.invalid_type,expected:N.ZodParsedType.string,received:i.parsedType}),E.INVALID}let n=new E.ParseStatus,s;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:P.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:P.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?(0,E.addIssueToContext)(s,{code:P.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&(0,E.addIssueToContext)(s,{code:P.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")fS.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"email",code:P.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Va||(Va=new RegExp(hS,"u")),Va.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"emoji",code:P.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")cS.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"uuid",code:P.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")uS.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"nanoid",code:P.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")oS.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"cuid",code:P.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")iS.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"cuid2",code:P.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")aS.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"ulid",code:P.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"url",code:P.ZodIssueCode.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"regex",code:P.ZodIssueCode.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:P.ZodIssueCode.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:P.ZodIssueCode.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:P.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Kf(i).test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:P.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?_S.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:P.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?bS(i).test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:P.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?dS.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"duration",code:P.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?SS(e.data,i.version)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"ip",code:P.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?ES(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"jwt",code:P.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?CS(e.data,i.version)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"cidr",code:P.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?yS.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"base64",code:P.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?vS.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"base64url",code:P.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):N.util.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(s=>e.test(s),{validation:r,code:P.ZodIssueCode.invalid_string,...K.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...K.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...K.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...K.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...K.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...K.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...K.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...K.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...K.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...K.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...K.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...K.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...K.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...K.errorUtil.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,...K.errorUtil.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,...K.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...K.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...K.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...K.errorUtil.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...K.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...K.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...K.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...K.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...K.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,K.errorUtil.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 r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};S.ZodString=Cr;Cr.create=t=>new Cr({checks:[],typeName:ne.ZodString,coerce:t?.coerce??!1,...ae(t)});function wS(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}var qr=class t extends ce{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)!==N.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(i,{code:P.ZodIssueCode.invalid_type,expected:N.ZodParsedType.number,received:i.parsedType}),E.INVALID}let n,s=new E.ParseStatus;for(let i of this._def.checks)i.kind==="int"?N.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:P.ZodIssueCode.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:P.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?wS(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:P.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:P.ZodIssueCode.not_finite,message:i.message}),s.dirty()):N.util.assertNever(i);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,K.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,K.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,K.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,K.errorUtil.toString(r))}setLimit(e,r,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:K.errorUtil.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:K.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:K.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:K.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:K.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:K.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:K.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:K.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:K.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:K.errorUtil.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&N.util.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};S.ZodNumber=qr;qr.create=t=>new qr({checks:[],typeName:ne.ZodNumber,coerce:t?.coerce||!1,...ae(t)});var Wr=class t extends ce{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)!==N.ZodParsedType.bigint)return this._getInvalidInput(e);let n,s=new E.ParseStatus;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:P.ZodIssueCode.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:P.ZodIssueCode.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:P.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):N.util.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(r,{code:P.ZodIssueCode.invalid_type,expected:N.ZodParsedType.bigint,received:r.parsedType}),E.INVALID}gte(e,r){return this.setLimit("min",e,!0,K.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,K.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,K.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,K.errorUtil.toString(r))}setLimit(e,r,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:K.errorUtil.toString(s)}]})}_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:K.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:K.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:K.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:K.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:K.errorUtil.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};S.ZodBigInt=Wr;Wr.create=t=>new Wr({checks:[],typeName:ne.ZodBigInt,coerce:t?.coerce??!1,...ae(t)});var Hr=class extends ce{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==N.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_type,expected:N.ZodParsedType.boolean,received:n.parsedType}),E.INVALID}return(0,E.OK)(e.data)}};S.ZodBoolean=Hr;Hr.create=t=>new Hr({typeName:ne.ZodBoolean,coerce:t?.coerce||!1,...ae(t)});var Zr=class t extends ce{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==N.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(i,{code:P.ZodIssueCode.invalid_type,expected:N.ZodParsedType.date,received:i.parsedType}),E.INVALID}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(i,{code:P.ZodIssueCode.invalid_date}),E.INVALID}let n=new E.ParseStatus,s;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:P.ZodIssueCode.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:P.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):N.util.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:K.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:K.errorUtil.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};S.ZodDate=Zr;Zr.create=t=>new Zr({checks:[],coerce:t?.coerce||!1,typeName:ne.ZodDate,...ae(t)});var En=class extends ce{_parse(e){if(this._getType(e)!==N.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_type,expected:N.ZodParsedType.symbol,received:n.parsedType}),E.INVALID}return(0,E.OK)(e.data)}};S.ZodSymbol=En;En.create=t=>new En({typeName:ne.ZodSymbol,...ae(t)});var Ur=class extends ce{_parse(e){if(this._getType(e)!==N.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_type,expected:N.ZodParsedType.undefined,received:n.parsedType}),E.INVALID}return(0,E.OK)(e.data)}};S.ZodUndefined=Ur;Ur.create=t=>new Ur({typeName:ne.ZodUndefined,...ae(t)});var Vr=class extends ce{_parse(e){if(this._getType(e)!==N.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_type,expected:N.ZodParsedType.null,received:n.parsedType}),E.INVALID}return(0,E.OK)(e.data)}};S.ZodNull=Vr;Vr.create=t=>new Vr({typeName:ne.ZodNull,...ae(t)});var wr=class extends ce{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,E.OK)(e.data)}};S.ZodAny=wr;wr.create=t=>new wr({typeName:ne.ZodAny,...ae(t)});var nr=class extends ce{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,E.OK)(e.data)}};S.ZodUnknown=nr;nr.create=t=>new nr({typeName:ne.ZodUnknown,...ae(t)});var At=class extends ce{_parse(e){let r=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(r,{code:P.ZodIssueCode.invalid_type,expected:N.ZodParsedType.never,received:r.parsedType}),E.INVALID}};S.ZodNever=At;At.create=t=>new At({typeName:ne.ZodNever,...ae(t)});var Cn=class extends ce{_parse(e){if(this._getType(e)!==N.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_type,expected:N.ZodParsedType.void,received:n.parsedType}),E.INVALID}return(0,E.OK)(e.data)}};S.ZodVoid=Cn;Cn.create=t=>new Cn({typeName:ne.ZodVoid,...ae(t)});var sr=class t extends ce{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),s=this._def;if(r.parsedType!==N.ZodParsedType.array)return(0,E.addIssueToContext)(r,{code:P.ZodIssueCode.invalid_type,expected:N.ZodParsedType.array,received:r.parsedType}),E.INVALID;if(s.exactLength!==null){let o=r.data.length>s.exactLength.value,a=r.data.length<s.exactLength.value;(o||a)&&((0,E.addIssueToContext)(r,{code:o?P.ZodIssueCode.too_big:P.ZodIssueCode.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&((0,E.addIssueToContext)(r,{code:P.ZodIssueCode.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&((0,E.addIssueToContext)(r,{code:P.ZodIssueCode.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,a)=>s.type._parseAsync(new gt(r,o,r.path,a)))).then(o=>E.ParseStatus.mergeArray(n,o));let i=[...r.data].map((o,a)=>s.type._parseSync(new gt(r,o,r.path,a)));return E.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:K.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:K.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:K.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};S.ZodArray=sr;sr.create=(t,e)=>new sr({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ne.ZodArray,...ae(e)});function Sn(t){if(t instanceof nt){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=mt.create(Sn(n))}return new nt({...t._def,shape:()=>e})}else return t instanceof sr?new sr({...t._def,type:Sn(t.element)}):t instanceof mt?mt.create(Sn(t.unwrap())):t instanceof Vt?Vt.create(Sn(t.unwrap())):t instanceof Ut?Ut.create(t.items.map(e=>Sn(e))):t}var nt=class t extends ce{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(),r=N.util.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==N.ZodParsedType.object){let u=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(u,{code:P.ZodIssueCode.invalid_type,expected:N.ZodParsedType.object,received:u.parsedType}),E.INVALID}let{status:n,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof At&&this._def.unknownKeys==="strip"))for(let u in s.data)o.includes(u)||a.push(u);let c=[];for(let u of o){let l=i[u],d=s.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new gt(s,d,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof At){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:s.data[l]}});else if(u==="strict")a.length>0&&((0,E.addIssueToContext)(s,{code:P.ZodIssueCode.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let d=s.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new gt(s,d,s.path,l)),alwaysSet:l in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>E.ParseStatus.mergeObjectSync(n,u)):E.ParseStatus.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return K.errorUtil.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let s=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:K.errorUtil.errToObj(e).message??s}:{message:s}}}:{}})}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:ne.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of N.util.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of N.util.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Sn(this)}partial(e){let r={};for(let n of N.util.objectKeys(this.shape)){let s=this.shape[n];e&&!e[n]?r[n]=s:r[n]=s.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of N.util.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof mt;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return Qf(N.util.objectKeys(this.shape))}};S.ZodObject=nt;nt.create=(t,e)=>new nt({shape:()=>t,unknownKeys:"strip",catchall:At.create(),typeName:ne.ZodObject,...ae(e)});nt.strictCreate=(t,e)=>new nt({shape:()=>t,unknownKeys:"strict",catchall:At.create(),typeName:ne.ZodObject,...ae(e)});nt.lazycreate=(t,e)=>new nt({shape:t,unknownKeys:"strip",catchall:At.create(),typeName:ne.ZodObject,...ae(e)});var Gr=class extends ce{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function s(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(a=>new P.ZodError(a.ctx.common.issues));return(0,E.addIssueToContext)(r,{code:P.ZodIssueCode.invalid_union,unionErrors:o}),E.INVALID}if(r.common.async)return Promise.all(n.map(async i=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(s);{let i,o=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=o.map(c=>new P.ZodError(c));return(0,E.addIssueToContext)(r,{code:P.ZodIssueCode.invalid_union,unionErrors:a}),E.INVALID}}get options(){return this._def.options}};S.ZodUnion=Gr;Gr.create=(t,e)=>new Gr({options:t,typeName:ne.ZodUnion,...ae(e)});var rr=t=>t instanceof Yr?rr(t.schema):t instanceof ut?rr(t.innerType()):t instanceof Jr?[t.value]:t instanceof Xr?t.options:t instanceof Kr?N.util.objectValues(t.enum):t instanceof Qr?rr(t._def.innerType):t instanceof Ur?[void 0]:t instanceof Vr?[null]:t instanceof mt?[void 0,...rr(t.unwrap())]:t instanceof Vt?[null,...rr(t.unwrap())]:t instanceof zn||t instanceof tn?rr(t.unwrap()):t instanceof en?rr(t._def.innerType):[],so=class t extends ce{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==N.ZodParsedType.object)return(0,E.addIssueToContext)(r,{code:P.ZodIssueCode.invalid_type,expected:N.ZodParsedType.object,received:r.parsedType}),E.INVALID;let n=this.discriminator,s=r.data[n],i=this.optionsMap.get(s);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):((0,E.addIssueToContext)(r,{code:P.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),E.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let s=new Map;for(let i of r){let o=rr(i.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(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,i)}}return new t({typeName:ne.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,...ae(n)})}};S.ZodDiscriminatedUnion=so;function Ga(t,e){let r=(0,N.getParsedType)(t),n=(0,N.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===N.ZodParsedType.object&&n===N.ZodParsedType.object){let s=N.util.objectKeys(e),i=N.util.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(let a of i){let c=Ga(t[a],e[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(r===N.ZodParsedType.array&&n===N.ZodParsedType.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let i=0;i<t.length;i++){let o=t[i],a=e[i],c=Ga(o,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===N.ZodParsedType.date&&n===N.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var zr=class extends ce{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=(i,o)=>{if((0,E.isAborted)(i)||(0,E.isAborted)(o))return E.INVALID;let a=Ga(i.value,o.value);return a.valid?(((0,E.isDirty)(i)||(0,E.isDirty)(o))&&r.dirty(),{status:r.value,value:a.data}):((0,E.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_intersection_types}),E.INVALID)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};S.ZodIntersection=zr;zr.create=(t,e,r)=>new zr({left:t,right:e,typeName:ne.ZodIntersection,...ae(r)});var Ut=class t extends ce{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==N.ZodParsedType.array)return(0,E.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_type,expected:N.ZodParsedType.array,received:n.parsedType}),E.INVALID;if(n.data.length<this._def.items.length)return(0,E.addIssueToContext)(n,{code:P.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),E.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,E.addIssueToContext)(n,{code:P.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((o,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new gt(n,o,n.path,a)):null}).filter(o=>!!o);return n.common.async?Promise.all(i).then(o=>E.ParseStatus.mergeArray(r,o)):E.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};S.ZodTuple=Ut;Ut.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ut({items:t,typeName:ne.ZodTuple,rest:null,...ae(e)})};var oo=class t extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==N.ZodParsedType.object)return(0,E.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_type,expected:N.ZodParsedType.object,received:n.parsedType}),E.INVALID;let s=[],i=this._def.keyType,o=this._def.valueType;for(let a in n.data)s.push({key:i._parse(new gt(n,a,n.path,a)),value:o._parse(new gt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?E.ParseStatus.mergeObjectAsync(r,s):E.ParseStatus.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof ce?new t({keyType:e,valueType:r,typeName:ne.ZodRecord,...ae(n)}):new t({keyType:Cr.create(),valueType:e,typeName:ne.ZodRecord,...ae(r)})}};S.ZodRecord=oo;var wn=class extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==N.ZodParsedType.map)return(0,E.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_type,expected:N.ZodParsedType.map,received:n.parsedType}),E.INVALID;let s=this._def.keyType,i=this._def.valueType,o=[...n.data.entries()].map(([a,c],u)=>({key:s._parse(new gt(n,a,n.path,[u,"key"])),value:i._parse(new gt(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of o){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return E.INVALID;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of o){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return E.INVALID;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};S.ZodMap=wn;wn.create=(t,e,r)=>new wn({valueType:e,keyType:t,typeName:ne.ZodMap,...ae(r)});var xn=class t extends ce{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==N.ZodParsedType.set)return(0,E.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_type,expected:N.ZodParsedType.set,received:n.parsedType}),E.INVALID;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&((0,E.addIssueToContext)(n,{code:P.ZodIssueCode.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&((0,E.addIssueToContext)(n,{code:P.ZodIssueCode.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let i=this._def.valueType;function o(c){let u=new Set;for(let l of c){if(l.status==="aborted")return E.INVALID;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>i._parse(new gt(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:K.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:K.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};S.ZodSet=xn;xn.create=(t,e)=>new xn({valueType:t,minSize:null,maxSize:null,typeName:ne.ZodSet,...ae(e)});var io=class t extends ce{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==N.ZodParsedType.function)return(0,E.addIssueToContext)(r,{code:P.ZodIssueCode.invalid_type,expected:N.ZodParsedType.function,received:r.parsedType}),E.INVALID;function n(a,c){return(0,E.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,no.getErrorMap)(),no.defaultErrorMap].filter(u=>!!u),issueData:{code:P.ZodIssueCode.invalid_arguments,argumentsError:c}})}function s(a,c){return(0,E.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,no.getErrorMap)(),no.defaultErrorMap].filter(u=>!!u),issueData:{code:P.ZodIssueCode.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof xr){let a=this;return(0,E.OK)(async function(...c){let u=new P.ZodError([]),l=await a._def.args.parseAsync(c,i).catch(g=>{throw u.addIssue(n(c,g)),u}),d=await Reflect.apply(o,this,l);return await a._def.returns._def.type.parseAsync(d,i).catch(g=>{throw u.addIssue(s(d,g)),u})})}else{let a=this;return(0,E.OK)(function(...c){let u=a._def.args.safeParse(c,i);if(!u.success)throw new P.ZodError([n(c,u.error)]);let l=Reflect.apply(o,this,u.data),d=a._def.returns.safeParse(l,i);if(!d.success)throw new P.ZodError([s(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Ut.create(e).rest(nr.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,r,n){return new t({args:e||Ut.create([]).rest(nr.create()),returns:r||nr.create(),typeName:ne.ZodFunction,...ae(n)})}};S.ZodFunction=io;var Yr=class extends ce{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};S.ZodLazy=Yr;Yr.create=(t,e)=>new Yr({getter:t,typeName:ne.ZodLazy,...ae(e)});var Jr=class extends ce{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(r,{received:r.data,code:P.ZodIssueCode.invalid_literal,expected:this._def.value}),E.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};S.ZodLiteral=Jr;Jr.create=(t,e)=>new Jr({value:t,typeName:ne.ZodLiteral,...ae(e)});function Qf(t,e){return new Xr({values:t,typeName:ne.ZodEnum,...ae(e)})}var Xr=class t extends ce{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,E.addIssueToContext)(r,{expected:N.util.joinValues(n),received:r.parsedType,code:P.ZodIssueCode.invalid_type}),E.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,E.addIssueToContext)(r,{received:r.data,code:P.ZodIssueCode.invalid_enum_value,options:n}),E.INVALID}return(0,E.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};S.ZodEnum=Xr;Xr.create=Qf;var Kr=class extends ce{_parse(e){let r=N.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==N.ZodParsedType.string&&n.parsedType!==N.ZodParsedType.number){let s=N.util.objectValues(r);return(0,E.addIssueToContext)(n,{expected:N.util.joinValues(s),received:n.parsedType,code:P.ZodIssueCode.invalid_type}),E.INVALID}if(this._cache||(this._cache=new Set(N.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=N.util.objectValues(r);return(0,E.addIssueToContext)(n,{received:n.data,code:P.ZodIssueCode.invalid_enum_value,options:s}),E.INVALID}return(0,E.OK)(e.data)}get enum(){return this._def.values}};S.ZodNativeEnum=Kr;Kr.create=(t,e)=>new Kr({values:t,typeName:ne.ZodNativeEnum,...ae(e)});var xr=class extends ce{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==N.ZodParsedType.promise&&r.common.async===!1)return(0,E.addIssueToContext)(r,{code:P.ZodIssueCode.invalid_type,expected:N.ZodParsedType.promise,received:r.parsedType}),E.INVALID;let n=r.parsedType===N.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,E.OK)(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}};S.ZodPromise=xr;xr.create=(t,e)=>new xr({type:t,typeName:ne.ZodPromise,...ae(e)});var ut=class extends ce{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ne.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{(0,E.addIssueToContext)(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){let o=s.transform(n.data,i);if(n.common.async)return Promise.resolve(o).then(async a=>{if(r.value==="aborted")return E.INVALID;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?E.INVALID:c.status==="dirty"||r.value==="dirty"?(0,E.DIRTY)(c.value):c});{if(r.value==="aborted")return E.INVALID;let a=this._def.schema._parseSync({data:o,path:n.path,parent:n});return a.status==="aborted"?E.INVALID:a.status==="dirty"||r.value==="dirty"?(0,E.DIRTY)(a.value):a}}if(s.type==="refinement"){let o=a=>{let c=s.refinement(a,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?E.INVALID:(a.status==="dirty"&&r.dirty(),o(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?E.INVALID:(a.status==="dirty"&&r.dirty(),o(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,E.isValid)(o))return E.INVALID;let a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>(0,E.isValid)(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:r.value,value:a})):E.INVALID);N.util.assertNever(s)}};S.ZodEffects=ut;S.ZodTransformer=ut;ut.create=(t,e,r)=>new ut({schema:t,typeName:ne.ZodEffects,effect:e,...ae(r)});ut.createWithPreprocess=(t,e,r)=>new ut({schema:e,effect:{type:"preprocess",transform:t},typeName:ne.ZodEffects,...ae(r)});var mt=class extends ce{_parse(e){return this._getType(e)===N.ZodParsedType.undefined?(0,E.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};S.ZodOptional=mt;mt.create=(t,e)=>new mt({innerType:t,typeName:ne.ZodOptional,...ae(e)});var Vt=class extends ce{_parse(e){return this._getType(e)===N.ZodParsedType.null?(0,E.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};S.ZodNullable=Vt;Vt.create=(t,e)=>new Vt({innerType:t,typeName:ne.ZodNullable,...ae(e)});var Qr=class extends ce{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===N.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};S.ZodDefault=Qr;Qr.create=(t,e)=>new Qr({innerType:t,typeName:ne.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ae(e)});var en=class extends ce{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,E.isAsync)(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new P.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new P.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};S.ZodCatch=en;en.create=(t,e)=>new en({innerType:t,typeName:ne.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ae(e)});var kn=class extends ce{_parse(e){if(this._getType(e)!==N.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_type,expected:N.ZodParsedType.nan,received:n.parsedType}),E.INVALID}return{status:"valid",value:e.data}}};S.ZodNaN=kn;kn.create=t=>new kn({typeName:ne.ZodNaN,...ae(t)});S.BRAND=Symbol("zod_brand");var zn=class extends ce{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};S.ZodBranded=zn;var Yn=class t extends ce{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?E.INVALID:i.status==="dirty"?(r.dirty(),(0,E.DIRTY)(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?E.INVALID:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:ne.ZodPipeline})}};S.ZodPipeline=Yn;var tn=class extends ce{_parse(e){let r=this._def.innerType._parse(e),n=s=>((0,E.isValid)(s)&&(s.value=Object.freeze(s.value)),s);return(0,E.isAsync)(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}};S.ZodReadonly=tn;tn.create=(t,e)=>new tn({innerType:t,typeName:ne.ZodReadonly,...ae(e)});function Yf(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function eh(t,e={},r){return t?wr.create().superRefine((n,s)=>{let i=t(n);if(i instanceof Promise)return i.then(o=>{if(!o){let a=Yf(e,n),c=a.fatal??r??!0;s.addIssue({code:"custom",...a,fatal:c})}});if(!i){let o=Yf(e,n),a=o.fatal??r??!0;s.addIssue({code:"custom",...o,fatal:a})}}):wr.create()}S.late={object:nt.lazycreate};var ne;(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"})(ne||(S.ZodFirstPartyTypeKind=ne={}));var xS=(t,e={message:`Input not instance of ${t.name}`})=>eh(r=>r instanceof t,e);S.instanceof=xS;var th=Cr.create;S.string=th;var rh=qr.create;S.number=rh;var kS=kn.create;S.nan=kS;var $S=Wr.create;S.bigint=$S;var nh=Hr.create;S.boolean=nh;var AS=Zr.create;S.date=AS;var FS=En.create;S.symbol=FS;var jS=Ur.create;S.undefined=jS;var IS=Vr.create;S.null=IS;var TS=wr.create;S.any=TS;var RS=nr.create;S.unknown=RS;var PS=At.create;S.never=PS;var OS=Cn.create;S.void=OS;var NS=sr.create;S.array=NS;var LS=nt.create;S.object=LS;var BS=nt.strictCreate;S.strictObject=BS;var MS=Gr.create;S.union=MS;var qS=so.create;S.discriminatedUnion=qS;var WS=zr.create;S.intersection=WS;var HS=Ut.create;S.tuple=HS;var ZS=oo.create;S.record=ZS;var US=wn.create;S.map=US;var VS=xn.create;S.set=VS;var GS=io.create;S.function=GS;var zS=Yr.create;S.lazy=zS;var YS=Jr.create;S.literal=YS;var JS=Xr.create;S.enum=JS;var XS=Kr.create;S.nativeEnum=XS;var KS=xr.create;S.promise=KS;var sh=ut.create;S.effect=sh;S.transformer=sh;var QS=mt.create;S.optional=QS;var eE=Vt.create;S.nullable=eE;var tE=ut.createWithPreprocess;S.preprocess=tE;var rE=Yn.create;S.pipeline=rE;var nE=()=>th().optional();S.ostring=nE;var sE=()=>rh().optional();S.onumber=sE;var oE=()=>nh().optional();S.oboolean=oE;S.coerce={string:(t=>Cr.create({...t,coerce:!0})),number:(t=>qr.create({...t,coerce:!0})),boolean:(t=>Hr.create({...t,coerce:!0})),bigint:(t=>Wr.create({...t,coerce:!0})),date:(t=>Zr.create({...t,coerce:!0}))};S.NEVER=E.INVALID});var za=v(Dt=>{"use strict";var iE=Dt&&Dt.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(e,r);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,s)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),$n=Dt&&Dt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&iE(e,t,r)};Object.defineProperty(Dt,"__esModule",{value:!0});$n(to(),Dt);$n(Ua(),Dt);$n(Uf(),Dt);$n(Vn(),Dt);$n(oh(),Dt);$n(eo(),Dt)});var Ya=v(st=>{"use strict";var ih=st&&st.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(e,r);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,s)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),aE=st&&st.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),cE=st&&st.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ih(e,t,r);return aE(e,t),e},uE=st&&st.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ih(e,t,r)};Object.defineProperty(st,"__esModule",{value:!0});st.z=void 0;var ah=cE(za());st.z=ah;uE(za(),st);st.default=ah});var Jn=v(($2,ch)=>{"use strict";var lE="2.0.0",dE=Number.MAX_SAFE_INTEGER||9007199254740991,fE=16,hE=250,pE=["major","premajor","minor","preminor","patch","prepatch","prerelease"];ch.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:fE,MAX_SAFE_BUILD_LENGTH:hE,MAX_SAFE_INTEGER:dE,RELEASE_TYPES:pE,SEMVER_SPEC_VERSION:lE,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Xn=v((A2,uh)=>{"use strict";var mE=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};uh.exports=mE});var An=v((Gt,lh)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Ja,MAX_SAFE_BUILD_LENGTH:gE,MAX_LENGTH:DE}=Jn(),yE=Xn();Gt=lh.exports={};var vE=Gt.re=[],_E=Gt.safeRe=[],U=Gt.src=[],bE=Gt.safeSrc=[],V=Gt.t={},SE=0,Xa="[a-zA-Z0-9-]",EE=[["\\s",1],["\\d",DE],[Xa,gE]],CE=t=>{for(let[e,r]of EE)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},ie=(t,e,r)=>{let n=CE(e),s=SE++;yE(t,s,e),V[t]=s,U[s]=e,bE[s]=n,vE[s]=new RegExp(e,r?"g":void 0),_E[s]=new RegExp(n,r?"g":void 0)};ie("NUMERICIDENTIFIER","0|[1-9]\\d*");ie("NUMERICIDENTIFIERLOOSE","\\d+");ie("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Xa}*`);ie("MAINVERSION",`(${U[V.NUMERICIDENTIFIER]})\\.(${U[V.NUMERICIDENTIFIER]})\\.(${U[V.NUMERICIDENTIFIER]})`);ie("MAINVERSIONLOOSE",`(${U[V.NUMERICIDENTIFIERLOOSE]})\\.(${U[V.NUMERICIDENTIFIERLOOSE]})\\.(${U[V.NUMERICIDENTIFIERLOOSE]})`);ie("PRERELEASEIDENTIFIER",`(?:${U[V.NONNUMERICIDENTIFIER]}|${U[V.NUMERICIDENTIFIER]})`);ie("PRERELEASEIDENTIFIERLOOSE",`(?:${U[V.NONNUMERICIDENTIFIER]}|${U[V.NUMERICIDENTIFIERLOOSE]})`);ie("PRERELEASE",`(?:-(${U[V.PRERELEASEIDENTIFIER]}(?:\\.${U[V.PRERELEASEIDENTIFIER]})*))`);ie("PRERELEASELOOSE",`(?:-?(${U[V.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${U[V.PRERELEASEIDENTIFIERLOOSE]})*))`);ie("BUILDIDENTIFIER",`${Xa}+`);ie("BUILD",`(?:\\+(${U[V.BUILDIDENTIFIER]}(?:\\.${U[V.BUILDIDENTIFIER]})*))`);ie("FULLPLAIN",`v?${U[V.MAINVERSION]}${U[V.PRERELEASE]}?${U[V.BUILD]}?`);ie("FULL",`^${U[V.FULLPLAIN]}$`);ie("LOOSEPLAIN",`[v=\\s]*${U[V.MAINVERSIONLOOSE]}${U[V.PRERELEASELOOSE]}?${U[V.BUILD]}?`);ie("LOOSE",`^${U[V.LOOSEPLAIN]}$`);ie("GTLT","((?:<|>)?=?)");ie("XRANGEIDENTIFIERLOOSE",`${U[V.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);ie("XRANGEIDENTIFIER",`${U[V.NUMERICIDENTIFIER]}|x|X|\\*`);ie("XRANGEPLAIN",`[v=\\s]*(${U[V.XRANGEIDENTIFIER]})(?:\\.(${U[V.XRANGEIDENTIFIER]})(?:\\.(${U[V.XRANGEIDENTIFIER]})(?:${U[V.PRERELEASE]})?${U[V.BUILD]}?)?)?`);ie("XRANGEPLAINLOOSE",`[v=\\s]*(${U[V.XRANGEIDENTIFIERLOOSE]})(?:\\.(${U[V.XRANGEIDENTIFIERLOOSE]})(?:\\.(${U[V.XRANGEIDENTIFIERLOOSE]})(?:${U[V.PRERELEASELOOSE]})?${U[V.BUILD]}?)?)?`);ie("XRANGE",`^${U[V.GTLT]}\\s*${U[V.XRANGEPLAIN]}$`);ie("XRANGELOOSE",`^${U[V.GTLT]}\\s*${U[V.XRANGEPLAINLOOSE]}$`);ie("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Ja}})(?:\\.(\\d{1,${Ja}}))?(?:\\.(\\d{1,${Ja}}))?`);ie("COERCE",`${U[V.COERCEPLAIN]}(?:$|[^\\d])`);ie("COERCEFULL",U[V.COERCEPLAIN]+`(?:${U[V.PRERELEASE]})?(?:${U[V.BUILD]})?(?:$|[^\\d])`);ie("COERCERTL",U[V.COERCE],!0);ie("COERCERTLFULL",U[V.COERCEFULL],!0);ie("LONETILDE","(?:~>?)");ie("TILDETRIM",`(\\s*)${U[V.LONETILDE]}\\s+`,!0);Gt.tildeTrimReplace="$1~";ie("TILDE",`^${U[V.LONETILDE]}${U[V.XRANGEPLAIN]}$`);ie("TILDELOOSE",`^${U[V.LONETILDE]}${U[V.XRANGEPLAINLOOSE]}$`);ie("LONECARET","(?:\\^)");ie("CARETTRIM",`(\\s*)${U[V.LONECARET]}\\s+`,!0);Gt.caretTrimReplace="$1^";ie("CARET",`^${U[V.LONECARET]}${U[V.XRANGEPLAIN]}$`);ie("CARETLOOSE",`^${U[V.LONECARET]}${U[V.XRANGEPLAINLOOSE]}$`);ie("COMPARATORLOOSE",`^${U[V.GTLT]}\\s*(${U[V.LOOSEPLAIN]})$|^$`);ie("COMPARATOR",`^${U[V.GTLT]}\\s*(${U[V.FULLPLAIN]})$|^$`);ie("COMPARATORTRIM",`(\\s*)${U[V.GTLT]}\\s*(${U[V.LOOSEPLAIN]}|${U[V.XRANGEPLAIN]})`,!0);Gt.comparatorTrimReplace="$1$2$3";ie("HYPHENRANGE",`^\\s*(${U[V.XRANGEPLAIN]})\\s+-\\s+(${U[V.XRANGEPLAIN]})\\s*$`);ie("HYPHENRANGELOOSE",`^\\s*(${U[V.XRANGEPLAINLOOSE]})\\s+-\\s+(${U[V.XRANGEPLAINLOOSE]})\\s*$`);ie("STAR","(<|>)?=?\\s*\\*");ie("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");ie("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var ao=v((F2,dh)=>{"use strict";var wE=Object.freeze({loose:!0}),xE=Object.freeze({}),kE=t=>t?typeof t!="object"?wE:t:xE;dh.exports=kE});var Ka=v((j2,ph)=>{"use strict";var fh=/^[0-9]+$/,hh=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=fh.test(t),n=fh.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},$E=(t,e)=>hh(e,t);ph.exports={compareIdentifiers:hh,rcompareIdentifiers:$E}});var He=v((I2,gh)=>{"use strict";var co=Xn(),{MAX_LENGTH:mh,MAX_SAFE_INTEGER:uo}=Jn(),{safeRe:lo,t:fo}=An(),AE=ao(),{compareIdentifiers:Qa}=Ka(),ec=class t{constructor(e,r){if(r=AE(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>mh)throw new TypeError(`version is longer than ${mh} characters`);co("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?lo[fo.LOOSE]:lo[fo.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>uo||this.major<0)throw new TypeError("Invalid major version");if(this.minor>uo||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>uo||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let i=+s;if(i>=0&&i<uo)return i}return s}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(co("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],s=e.prerelease[r];if(co("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return Qa(n,s)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],s=e.build[r];if(co("build compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return Qa(n,s)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let s=`-${r}`.match(this.options.loose?lo[fo.PRERELEASELOOSE]:lo[fo.PRERELEASE]);if(!s||s[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let i=[r,s];n===!1&&(i=[r]),Qa(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};gh.exports=ec});var rn=v((T2,yh)=>{"use strict";var Dh=He(),FE=(t,e,r=!1)=>{if(t instanceof Dh)return t;try{return new Dh(t,e)}catch(n){if(!r)return null;throw n}};yh.exports=FE});var _h=v((R2,vh)=>{"use strict";var jE=rn(),IE=(t,e)=>{let r=jE(t,e);return r?r.version:null};vh.exports=IE});var Sh=v((P2,bh)=>{"use strict";var TE=rn(),RE=(t,e)=>{let r=TE(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};bh.exports=RE});var wh=v((O2,Ch)=>{"use strict";var Eh=He(),PE=(t,e,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new Eh(t instanceof Eh?t.version:t,r).inc(e,n,s).version}catch{return null}};Ch.exports=PE});var $h=v((N2,kh)=>{"use strict";var xh=rn(),OE=(t,e)=>{let r=xh(t,null,!0),n=xh(e,null,!0),s=r.compare(n);if(s===0)return null;let i=s>0,o=i?r:n,a=i?n:r,c=!!o.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let l=c?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};kh.exports=OE});var Fh=v((L2,Ah)=>{"use strict";var NE=He(),LE=(t,e)=>new NE(t,e).major;Ah.exports=LE});var Ih=v((B2,jh)=>{"use strict";var BE=He(),ME=(t,e)=>new BE(t,e).minor;jh.exports=ME});var Rh=v((M2,Th)=>{"use strict";var qE=He(),WE=(t,e)=>new qE(t,e).patch;Th.exports=WE});var Oh=v((q2,Ph)=>{"use strict";var HE=rn(),ZE=(t,e)=>{let r=HE(t,e);return r&&r.prerelease.length?r.prerelease:null};Ph.exports=ZE});var yt=v((W2,Lh)=>{"use strict";var Nh=He(),UE=(t,e,r)=>new Nh(t,r).compare(new Nh(e,r));Lh.exports=UE});var Mh=v((H2,Bh)=>{"use strict";var VE=yt(),GE=(t,e,r)=>VE(e,t,r);Bh.exports=GE});var Wh=v((Z2,qh)=>{"use strict";var zE=yt(),YE=(t,e)=>zE(t,e,!0);qh.exports=YE});var ho=v((U2,Zh)=>{"use strict";var Hh=He(),JE=(t,e,r)=>{let n=new Hh(t,r),s=new Hh(e,r);return n.compare(s)||n.compareBuild(s)};Zh.exports=JE});var Vh=v((V2,Uh)=>{"use strict";var XE=ho(),KE=(t,e)=>t.sort((r,n)=>XE(r,n,e));Uh.exports=KE});var zh=v((G2,Gh)=>{"use strict";var QE=ho(),eC=(t,e)=>t.sort((r,n)=>QE(n,r,e));Gh.exports=eC});var Kn=v((z2,Yh)=>{"use strict";var tC=yt(),rC=(t,e,r)=>tC(t,e,r)>0;Yh.exports=rC});var po=v((Y2,Jh)=>{"use strict";var nC=yt(),sC=(t,e,r)=>nC(t,e,r)<0;Jh.exports=sC});var tc=v((J2,Xh)=>{"use strict";var oC=yt(),iC=(t,e,r)=>oC(t,e,r)===0;Xh.exports=iC});var rc=v((X2,Kh)=>{"use strict";var aC=yt(),cC=(t,e,r)=>aC(t,e,r)!==0;Kh.exports=cC});var mo=v((K2,Qh)=>{"use strict";var uC=yt(),lC=(t,e,r)=>uC(t,e,r)>=0;Qh.exports=lC});var go=v((Q2,ep)=>{"use strict";var dC=yt(),fC=(t,e,r)=>dC(t,e,r)<=0;ep.exports=fC});var nc=v((eI,tp)=>{"use strict";var hC=tc(),pC=rc(),mC=Kn(),gC=mo(),DC=po(),yC=go(),vC=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return hC(t,r,n);case"!=":return pC(t,r,n);case">":return mC(t,r,n);case">=":return gC(t,r,n);case"<":return DC(t,r,n);case"<=":return yC(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};tp.exports=vC});var np=v((tI,rp)=>{"use strict";var _C=He(),bC=rn(),{safeRe:Do,t:yo}=An(),SC=(t,e)=>{if(t instanceof _C)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?Do[yo.COERCEFULL]:Do[yo.COERCE]);else{let c=e.includePrerelease?Do[yo.COERCERTLFULL]:Do[yo.COERCERTL],u;for(;(u=c.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||u.index+u[0].length!==r.index+r[0].length)&&(r=u),c.lastIndex=u.index+u[1].length+u[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",i=r[4]||"0",o=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return bC(`${n}.${s}.${i}${o}${a}`,e)};rp.exports=SC});var op=v((rI,sp)=>{"use strict";var sc=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let s=this.map.keys().next().value;this.delete(s)}this.map.set(e,r)}return this}};sp.exports=sc});var vt=v((nI,up)=>{"use strict";var EC=/\s+/g,oc=class t{constructor(e,r){if(r=wC(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof ic)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(EC," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(s=>!ap(s[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&IC(s[0])){this.set=[s];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&FC)|(this.options.loose&&jC))+":"+e,s=ip.get(n);if(s)return s;let i=this.options.loose,o=i?Ye[Ze.HYPHENRANGELOOSE]:Ye[Ze.HYPHENRANGE];e=e.replace(o,WC(this.options.includePrerelease)),we("hyphen replace",e),e=e.replace(Ye[Ze.COMPARATORTRIM],kC),we("comparator trim",e),e=e.replace(Ye[Ze.TILDETRIM],$C),we("tilde trim",e),e=e.replace(Ye[Ze.CARETTRIM],AC),we("caret trim",e);let a=e.split(" ").map(d=>TC(d,this.options)).join(" ").split(/\s+/).map(d=>qC(d,this.options));i&&(a=a.filter(d=>(we("loose invalid filter",d,this.options),!!d.match(Ye[Ze.COMPARATORLOOSE])))),we("range list",a);let c=new Map,u=a.map(d=>new ic(d,this.options));for(let d of u){if(ap(d))return[d];c.set(d.value,d)}c.size>1&&c.has("")&&c.delete("");let l=[...c.values()];return ip.set(n,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>cp(n,r)&&e.set.some(s=>cp(s,r)&&n.every(i=>s.every(o=>i.intersects(o,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new xC(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(HC(this.set[r],e,this.options))return!0;return!1}};up.exports=oc;var CC=op(),ip=new CC,wC=ao(),ic=Qn(),we=Xn(),xC=He(),{safeRe:Ye,t:Ze,comparatorTrimReplace:kC,tildeTrimReplace:$C,caretTrimReplace:AC}=An(),{FLAG_INCLUDE_PRERELEASE:FC,FLAG_LOOSE:jC}=Jn(),ap=t=>t.value==="<0.0.0-0",IC=t=>t.value==="",cp=(t,e)=>{let r=!0,n=t.slice(),s=n.pop();for(;r&&n.length;)r=n.every(i=>s.intersects(i,e)),s=n.pop();return r},TC=(t,e)=>(t=t.replace(Ye[Ze.BUILD],""),we("comp",t,e),t=OC(t,e),we("caret",t),t=RC(t,e),we("tildes",t),t=LC(t,e),we("xrange",t),t=MC(t,e),we("stars",t),t),Je=t=>!t||t.toLowerCase()==="x"||t==="*",RC=(t,e)=>t.trim().split(/\s+/).map(r=>PC(r,e)).join(" "),PC=(t,e)=>{let r=e.loose?Ye[Ze.TILDELOOSE]:Ye[Ze.TILDE];return t.replace(r,(n,s,i,o,a)=>{we("tilde",t,n,s,i,o,a);let c;return Je(s)?c="":Je(i)?c=`>=${s}.0.0 <${+s+1}.0.0-0`:Je(o)?c=`>=${s}.${i}.0 <${s}.${+i+1}.0-0`:a?(we("replaceTilde pr",a),c=`>=${s}.${i}.${o}-${a} <${s}.${+i+1}.0-0`):c=`>=${s}.${i}.${o} <${s}.${+i+1}.0-0`,we("tilde return",c),c})},OC=(t,e)=>t.trim().split(/\s+/).map(r=>NC(r,e)).join(" "),NC=(t,e)=>{we("caret",t,e);let r=e.loose?Ye[Ze.CARETLOOSE]:Ye[Ze.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(s,i,o,a,c)=>{we("caret",t,s,i,o,a,c);let u;return Je(i)?u="":Je(o)?u=`>=${i}.0.0${n} <${+i+1}.0.0-0`:Je(a)?i==="0"?u=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.0${n} <${+i+1}.0.0-0`:c?(we("replaceCaret pr",c),i==="0"?o==="0"?u=`>=${i}.${o}.${a}-${c} <${i}.${o}.${+a+1}-0`:u=`>=${i}.${o}.${a}-${c} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.${a}-${c} <${+i+1}.0.0-0`):(we("no pr"),i==="0"?o==="0"?u=`>=${i}.${o}.${a}${n} <${i}.${o}.${+a+1}-0`:u=`>=${i}.${o}.${a}${n} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.${a} <${+i+1}.0.0-0`),we("caret return",u),u})},LC=(t,e)=>(we("replaceXRanges",t,e),t.split(/\s+/).map(r=>BC(r,e)).join(" ")),BC=(t,e)=>{t=t.trim();let r=e.loose?Ye[Ze.XRANGELOOSE]:Ye[Ze.XRANGE];return t.replace(r,(n,s,i,o,a,c)=>{we("xRange",t,n,s,i,o,a,c);let u=Je(i),l=u||Je(o),d=l||Je(a),f=d;return s==="="&&f&&(s=""),c=e.includePrerelease?"-0":"",u?s===">"||s==="<"?n="<0.0.0-0":n="*":s&&f?(l&&(o=0),a=0,s===">"?(s=">=",l?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):s==="<="&&(s="<",l?i=+i+1:o=+o+1),s==="<"&&(c="-0"),n=`${s+i}.${o}.${a}${c}`):l?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),we("xRange return",n),n})},MC=(t,e)=>(we("replaceStars",t,e),t.trim().replace(Ye[Ze.STAR],"")),qC=(t,e)=>(we("replaceGTE0",t,e),t.trim().replace(Ye[e.includePrerelease?Ze.GTE0PRE:Ze.GTE0],"")),WC=t=>(e,r,n,s,i,o,a,c,u,l,d,f)=>(Je(n)?r="":Je(s)?r=`>=${n}.0.0${t?"-0":""}`:Je(i)?r=`>=${n}.${s}.0${t?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,Je(u)?c="":Je(l)?c=`<${+u+1}.0.0-0`:Je(d)?c=`<${u}.${+l+1}.0-0`:f?c=`<=${u}.${l}.${d}-${f}`:t?c=`<${u}.${l}.${+d+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),HC=(t,e,r)=>{for(let n=0;n<t.length;n++)if(!t[n].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let n=0;n<t.length;n++)if(we(t[n].semver),t[n].semver!==ic.ANY&&t[n].semver.prerelease.length>0){let s=t[n].semver;if(s.major===e.major&&s.minor===e.minor&&s.patch===e.patch)return!0}return!1}return!0}});var Qn=v((sI,mp)=>{"use strict";var es=Symbol("SemVer ANY"),uc=class t{static get ANY(){return es}constructor(e,r){if(r=lp(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),cc("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===es?this.value="":this.value=this.operator+this.semver.version,cc("comp",this)}parse(e){let r=this.options.loose?dp[fp.COMPARATORLOOSE]:dp[fp.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new hp(n[2],this.options.loose):this.semver=es}toString(){return this.value}test(e){if(cc("Comparator.test",e,this.options.loose),this.semver===es||e===es)return!0;if(typeof e=="string")try{e=new hp(e,this.options)}catch{return!1}return ac(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new pp(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new pp(this.value,r).test(e.semver):(r=lp(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||ac(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||ac(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};mp.exports=uc;var lp=ao(),{safeRe:dp,t:fp}=An(),ac=nc(),cc=Xn(),hp=He(),pp=vt()});var ts=v((oI,gp)=>{"use strict";var ZC=vt(),UC=(t,e,r)=>{try{e=new ZC(e,r)}catch{return!1}return e.test(t)};gp.exports=UC});var yp=v((iI,Dp)=>{"use strict";var VC=vt(),GC=(t,e)=>new VC(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));Dp.exports=GC});var _p=v((aI,vp)=>{"use strict";var zC=He(),YC=vt(),JC=(t,e,r)=>{let n=null,s=null,i=null;try{i=new YC(e,r)}catch{return null}return t.forEach(o=>{i.test(o)&&(!n||s.compare(o)===-1)&&(n=o,s=new zC(n,r))}),n};vp.exports=JC});var Sp=v((cI,bp)=>{"use strict";var XC=He(),KC=vt(),QC=(t,e,r)=>{let n=null,s=null,i=null;try{i=new KC(e,r)}catch{return null}return t.forEach(o=>{i.test(o)&&(!n||s.compare(o)===1)&&(n=o,s=new XC(n,r))}),n};bp.exports=QC});var wp=v((uI,Cp)=>{"use strict";var lc=He(),ew=vt(),Ep=Kn(),tw=(t,e)=>{t=new ew(t,e);let r=new lc("0.0.0");if(t.test(r)||(r=new lc("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n<t.set.length;++n){let s=t.set[n],i=null;s.forEach(o=>{let a=new lc(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||Ep(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||Ep(r,i))&&(r=i)}return r&&t.test(r)?r:null};Cp.exports=tw});var kp=v((lI,xp)=>{"use strict";var rw=vt(),nw=(t,e)=>{try{return new rw(t,e).range||"*"}catch{return null}};xp.exports=nw});var vo=v((dI,jp)=>{"use strict";var sw=He(),Fp=Qn(),{ANY:ow}=Fp,iw=vt(),aw=ts(),$p=Kn(),Ap=po(),cw=go(),uw=mo(),lw=(t,e,r,n)=>{t=new sw(t,n),e=new iw(e,n);let s,i,o,a,c;switch(r){case">":s=$p,i=cw,o=Ap,a=">",c=">=";break;case"<":s=Ap,i=uw,o=$p,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(aw(t,e,n))return!1;for(let u=0;u<e.set.length;++u){let l=e.set[u],d=null,f=null;if(l.forEach(g=>{g.semver===ow&&(g=new Fp(">=0.0.0")),d=d||g,f=f||g,s(g.semver,d.semver,n)?d=g:o(g.semver,f.semver,n)&&(f=g)}),d.operator===a||d.operator===c||(!f.operator||f.operator===a)&&i(t,f.semver))return!1;if(f.operator===c&&o(t,f.semver))return!1}return!0};jp.exports=lw});var Tp=v((fI,Ip)=>{"use strict";var dw=vo(),fw=(t,e,r)=>dw(t,e,">",r);Ip.exports=fw});var Pp=v((hI,Rp)=>{"use strict";var hw=vo(),pw=(t,e,r)=>hw(t,e,"<",r);Rp.exports=pw});var Lp=v((pI,Np)=>{"use strict";var Op=vt(),mw=(t,e,r)=>(t=new Op(t,r),e=new Op(e,r),t.intersects(e,r));Np.exports=mw});var Mp=v((mI,Bp)=>{"use strict";var gw=ts(),Dw=yt();Bp.exports=(t,e,r)=>{let n=[],s=null,i=null,o=t.sort((l,d)=>Dw(l,d,r));for(let l of o)gw(l,e,r)?(i=l,s||(s=l)):(i&&n.push([s,i]),i=null,s=null);s&&n.push([s,null]);let a=[];for(let[l,d]of n)l===d?a.push(l):!d&&l===o[0]?a.push("*"):d?l===o[0]?a.push(`<=${d}`):a.push(`${l} - ${d}`):a.push(`>=${l}`);let c=a.join(" || "),u=typeof e.raw=="string"?e.raw:String(e);return c.length<u.length?c:e}});var Vp=v((gI,Up)=>{"use strict";var qp=vt(),fc=Qn(),{ANY:dc}=fc,rs=ts(),hc=yt(),yw=(t,e,r={})=>{if(t===e)return!0;t=new qp(t,r),e=new qp(e,r);let n=!1;e:for(let s of t.set){for(let i of e.set){let o=_w(s,i,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},vw=[new fc(">=0.0.0-0")],Wp=[new fc(">=0.0.0")],_w=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===dc){if(e.length===1&&e[0].semver===dc)return!0;r.includePrerelease?t=vw:t=Wp}if(e.length===1&&e[0].semver===dc){if(r.includePrerelease)return!0;e=Wp}let n=new Set,s,i;for(let g of t)g.operator===">"||g.operator===">="?s=Hp(s,g,r):g.operator==="<"||g.operator==="<="?i=Zp(i,g,r):n.add(g.semver);if(n.size>1)return null;let o;if(s&&i){if(o=hc(s.semver,i.semver,r),o>0)return null;if(o===0&&(s.operator!==">="||i.operator!=="<="))return null}for(let g of n){if(s&&!rs(g,String(s),r)||i&&!rs(g,String(i),r))return null;for(let m of e)if(!rs(g,String(m),r))return!1;return!0}let a,c,u,l,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,f=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;d&&d.prerelease.length===1&&i.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let g of e){if(l=l||g.operator===">"||g.operator===">=",u=u||g.operator==="<"||g.operator==="<=",s){if(f&&g.semver.prerelease&&g.semver.prerelease.length&&g.semver.major===f.major&&g.semver.minor===f.minor&&g.semver.patch===f.patch&&(f=!1),g.operator===">"||g.operator===">="){if(a=Hp(s,g,r),a===g&&a!==s)return!1}else if(s.operator===">="&&!rs(s.semver,String(g),r))return!1}if(i){if(d&&g.semver.prerelease&&g.semver.prerelease.length&&g.semver.major===d.major&&g.semver.minor===d.minor&&g.semver.patch===d.patch&&(d=!1),g.operator==="<"||g.operator==="<="){if(c=Zp(i,g,r),c===g&&c!==i)return!1}else if(i.operator==="<="&&!rs(i.semver,String(g),r))return!1}if(!g.operator&&(i||s)&&o!==0)return!1}return!(s&&u&&!i&&o!==0||i&&l&&!s&&o!==0||f||d)},Hp=(t,e,r)=>{if(!t)return e;let n=hc(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},Zp=(t,e,r)=>{if(!t)return e;let n=hc(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};Up.exports=yw});var Jp=v((DI,Yp)=>{"use strict";var pc=An(),Gp=Jn(),bw=He(),zp=Ka(),Sw=rn(),Ew=_h(),Cw=Sh(),ww=wh(),xw=$h(),kw=Fh(),$w=Ih(),Aw=Rh(),Fw=Oh(),jw=yt(),Iw=Mh(),Tw=Wh(),Rw=ho(),Pw=Vh(),Ow=zh(),Nw=Kn(),Lw=po(),Bw=tc(),Mw=rc(),qw=mo(),Ww=go(),Hw=nc(),Zw=np(),Uw=Qn(),Vw=vt(),Gw=ts(),zw=yp(),Yw=_p(),Jw=Sp(),Xw=wp(),Kw=kp(),Qw=vo(),ex=Tp(),tx=Pp(),rx=Lp(),nx=Mp(),sx=Vp();Yp.exports={parse:Sw,valid:Ew,clean:Cw,inc:ww,diff:xw,major:kw,minor:$w,patch:Aw,prerelease:Fw,compare:jw,rcompare:Iw,compareLoose:Tw,compareBuild:Rw,sort:Pw,rsort:Ow,gt:Nw,lt:Lw,eq:Bw,neq:Mw,gte:qw,lte:Ww,cmp:Hw,coerce:Zw,Comparator:Uw,Range:Vw,satisfies:Gw,toComparators:zw,maxSatisfying:Yw,minSatisfying:Jw,minVersion:Xw,validRange:Kw,outside:Qw,gtr:ex,ltr:tx,intersects:rx,simplifyRange:nx,subset:sx,SemVer:bw,re:pc.re,src:pc.src,tokens:pc.t,SEMVER_SPEC_VERSION:Gp.SEMVER_SPEC_VERSION,RELEASE_TYPES:Gp.RELEASE_TYPES,compareIdentifiers:zp.compareIdentifiers,rcompareIdentifiers:zp.rcompareIdentifiers}});var or=v(mc=>{"use strict";Object.defineProperty(mc,"__esModule",{value:!0});var ox=(function(){function t(){}return t.prototype.diff=function(e,r,n){n===void 0&&(n={});var s;typeof n=="function"?(s=n,n={}):"callback"in n&&(s=n.callback);var i=this.castInput(e,n),o=this.castInput(r,n),a=this.removeEmpty(this.tokenize(i,n)),c=this.removeEmpty(this.tokenize(o,n));return this.diffWithOptionsObj(a,c,n,s)},t.prototype.diffWithOptionsObj=function(e,r,n,s){var i=this,o,a=function(T){if(T=i.postProcess(T,n),s){setTimeout(function(){s(T)},0);return}else return T},c=r.length,u=e.length,l=1,d=c+u;n.maxEditLength!=null&&(d=Math.min(d,n.maxEditLength));var f=(o=n.timeout)!==null&&o!==void 0?o:1/0,g=Date.now()+f,m=[{oldPos:-1,lastComponent:void 0}],y=this.extractCommon(m[0],r,e,0,n);if(m[0].oldPos+1>=u&&y+1>=c)return a(this.buildValues(m[0].lastComponent,r,e));var h=-1/0,w=1/0,C=function(){for(var T=Math.max(h,-l);T<=Math.min(w,l);T+=2){var G=void 0,I=m[T-1],Z=m[T+1];I&&(m[T-1]=void 0);var F=!1;if(Z){var W=Z.oldPos-T;F=Z&&0<=W&&W<c}var R=I&&I.oldPos+1<u;if(!F&&!R){m[T]=void 0;continue}if(!R||F&&I.oldPos<Z.oldPos?G=i.addToPath(Z,!0,!1,0,n):G=i.addToPath(I,!1,!0,1,n),y=i.extractCommon(G,r,e,T,n),G.oldPos+1>=u&&y+1>=c)return a(i.buildValues(G.lastComponent,r,e))||!0;m[T]=G,G.oldPos+1>=u&&(w=Math.min(w,T-1)),y+1>=c&&(h=Math.max(h,T+1))}l++};if(s)(function T(){setTimeout(function(){if(l>d||Date.now()>g)return s(void 0);C()||T()},0)})();else for(;l<=d&&Date.now()<=g;){var A=C();if(A)return A}},t.prototype.addToPath=function(e,r,n,s,i){var o=e.lastComponent;return o&&!i.oneChangePerToken&&o.added===r&&o.removed===n?{oldPos:e.oldPos+s,lastComponent:{count:o.count+1,added:r,removed:n,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+s,lastComponent:{count:1,added:r,removed:n,previousComponent:o}}},t.prototype.extractCommon=function(e,r,n,s,i){for(var o=r.length,a=n.length,c=e.oldPos,u=c-s,l=0;u+1<o&&c+1<a&&this.equals(n[c+1],r[u+1],i);)u++,c++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=c,u},t.prototype.equals=function(e,r,n){return n.comparator?n.comparator(e,r):e===r||!!n.ignoreCase&&e.toLowerCase()===r.toLowerCase()},t.prototype.removeEmpty=function(e){for(var r=[],n=0;n<e.length;n++)e[n]&&r.push(e[n]);return r},t.prototype.castInput=function(e,r){return e},t.prototype.tokenize=function(e,r){return Array.from(e)},t.prototype.join=function(e){return e.join("")},t.prototype.postProcess=function(e,r){return e},Object.defineProperty(t.prototype,"useLongestToken",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.buildValues=function(e,r,n){for(var s=[],i;e;)s.push(e),i=e.previousComponent,delete e.previousComponent,e=i;s.reverse();for(var o=s.length,a=0,c=0,u=0;a<o;a++){var l=s[a];if(l.removed)l.value=this.join(n.slice(u,u+l.count)),u+=l.count;else{if(!l.added&&this.useLongestToken){var d=r.slice(c,c+l.count);d=d.map(function(f,g){var m=n[u+g];return m.length>f.length?m:f}),l.value=this.join(d)}else l.value=this.join(r.slice(c,c+l.count));c+=l.count,l.added||(u+=l.count)}}return s},t})();mc.default=ox});var Xp=v(kr=>{"use strict";var ix=kr&&kr.__extends||(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty(kr,"__esModule",{value:!0});kr.characterDiff=void 0;kr.diffChars=ux;var ax=or(),cx=(function(t){ix(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(ax.default);kr.characterDiff=new cx;function ux(t,e,r){return kr.characterDiff.diff(t,e,r)}});var Dc=v(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.longestCommonPrefix=lx;Xe.longestCommonSuffix=dx;Xe.replacePrefix=Kp;Xe.replaceSuffix=Qp;Xe.removePrefix=fx;Xe.removeSuffix=hx;Xe.maximumOverlap=px;Xe.hasOnlyWinLineEndings=gx;Xe.hasOnlyUnixLineEndings=Dx;Xe.segment=em;Xe.trailingWs=tm;Xe.leadingWs=rm;Xe.leadingAndTrailingWs=gc;function lx(t,e){var r;for(r=0;r<t.length&&r<e.length;r++)if(t[r]!=e[r])return t.slice(0,r);return t.slice(0,r)}function dx(t,e){var r;if(!t||!e||t[t.length-1]!=e[e.length-1])return"";for(r=0;r<t.length&&r<e.length;r++)if(t[t.length-(r+1)]!=e[e.length-(r+1)])return t.slice(-r);return t.slice(-r)}function Kp(t,e,r){if(t.slice(0,e.length)!=e)throw Error("string ".concat(JSON.stringify(t)," doesn't start with prefix ").concat(JSON.stringify(e),"; this is a bug"));return r+t.slice(e.length)}function Qp(t,e,r){if(!e)return t+r;if(t.slice(-e.length)!=e)throw Error("string ".concat(JSON.stringify(t)," doesn't end with suffix ").concat(JSON.stringify(e),"; this is a bug"));return t.slice(0,-e.length)+r}function fx(t,e){return Kp(t,e,"")}function hx(t,e){return Qp(t,e,"")}function px(t,e){return e.slice(0,mx(t,e))}function mx(t,e){var r=0;t.length>e.length&&(r=t.length-e.length);var n=e.length;t.length<e.length&&(n=t.length);var s=Array(n),i=0;s[0]=0;for(var o=1;o<n;o++){for(e[o]==e[i]?s[o]=s[i]:s[o]=i;i>0&&e[o]!=e[i];)i=s[i];e[o]==e[i]&&i++}i=0;for(var a=r;a<t.length;a++){for(;i>0&&t[a]!=e[i];)i=s[i];t[a]==e[i]&&i++}return i}function gx(t){return t.includes(`\r
9
9
  `)&&!t.startsWith(`
10
- `)&&!t.match(/[^\r]\n/)}function mx(t){return!t.includes(`\r
10
+ `)&&!t.match(/[^\r]\n/)}function Dx(t){return!t.includes(`\r
11
11
  `)&&t.includes(`
12
- `)}function Qp(t,e){for(var r=[],n=0,s=Array.from(e.segment(t));n<s.length;n++){var i=s[n],o=i.segment;r.length&&/\s/.test(r[r.length-1])&&/\s/.test(o)?r[r.length-1]+=o:r.push(o)}return r}function em(t,e){if(e)return mu(t,e)[1];var r;for(r=t.length-1;r>=0&&t[r].match(/\s/);r--);return t.substring(r+1)}function tm(t,e){if(e)return mu(t,e)[0];var r=t.match(/^\s*/);return r?r[0]:""}function mu(t,e){if(!e)return[tm(t),em(t)];if(e.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');var r=Qp(t,e),n=r[0],s=r[r.length-1],i=/\s/.test(n)?n:"",o=/\s/.test(s)?s:"";return[i,o]}});var im=v(vt=>{"use strict";var nm=vt&&vt.__extends||(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty(vt,"__esModule",{value:!0});vt.wordsWithSpaceDiff=vt.wordDiff=void 0;vt.diffWords=yx;vt.diffWordsWithSpace=om;var sm=sr(),me=gu(),vo="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",gx=new RegExp("[".concat(vo,"]+|\\s+|[^").concat(vo,"]"),"ug"),Dx=(function(t){nm(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.equals=function(r,n,s){return s.ignoreCase&&(r=r.toLowerCase(),n=n.toLowerCase()),r.trim()===n.trim()},e.prototype.tokenize=function(r,n){n===void 0&&(n={});var s;if(n.intlSegmenter){var i=n.intlSegmenter;if(i.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');s=(0,me.segment)(r,i)}else s=r.match(gx)||[];var o=[],a=null;return s.forEach(function(u){/\s/.test(u)?a==null?o.push(u):o.push(o.pop()+u):a!=null&&/\s/.test(a)?o[o.length-1]==a?o.push(o.pop()+u):o.push(a+u):o.push(u),a=u}),o},e.prototype.join=function(r){return r.map(function(n,s){return s==0?n:n.replace(/^\s+/,"")}).join("")},e.prototype.postProcess=function(r,n){if(!r||n.oneChangePerToken)return r;var s=null,i=null,o=null;return r.forEach(function(a){a.added?i=a:a.removed?o=a:((i||o)&&rm(s,o,i,a,n.intlSegmenter),s=a,i=null,o=null)}),(i||o)&&rm(s,o,i,null,n.intlSegmenter),r},e})(sm.default);vt.wordDiff=new Dx;function yx(t,e,r){return r?.ignoreWhitespace!=null&&!r.ignoreWhitespace?om(t,e,r):vt.wordDiff.diff(t,e,r)}function rm(t,e,r,n,s){if(e&&r){var i=(0,me.leadingAndTrailingWs)(e.value,s),o=i[0],a=i[1],u=(0,me.leadingAndTrailingWs)(r.value,s),c=u[0],l=u[1];if(t){var d=(0,me.longestCommonPrefix)(o,c);t.value=(0,me.replaceSuffix)(t.value,c,d),e.value=(0,me.removePrefix)(e.value,d),r.value=(0,me.removePrefix)(r.value,d)}if(n){var f=(0,me.longestCommonSuffix)(a,l);n.value=(0,me.replacePrefix)(n.value,l,f),e.value=(0,me.removeSuffix)(e.value,f),r.value=(0,me.removeSuffix)(r.value,f)}}else if(r){if(t){var g=(0,me.leadingWs)(r.value,s);r.value=r.value.substring(g.length)}if(n){var g=(0,me.leadingWs)(n.value,s);n.value=n.value.substring(g.length)}}else if(t&&n){var m=(0,me.leadingWs)(n.value,s),y=(0,me.leadingAndTrailingWs)(e.value,s),h=y[0],w=y[1],C=(0,me.longestCommonPrefix)(m,h);e.value=(0,me.removePrefix)(e.value,C);var A=(0,me.longestCommonSuffix)((0,me.removePrefix)(m,C),w);e.value=(0,me.removeSuffix)(e.value,A),n.value=(0,me.replacePrefix)(n.value,m,A),t.value=(0,me.replaceSuffix)(t.value,m,m.slice(0,m.length-A.length))}else if(n){var T=(0,me.leadingWs)(n.value,s),V=(0,me.trailingWs)(e.value,s),I=(0,me.maximumOverlap)(V,T);e.value=(0,me.removeSuffix)(e.value,I)}else if(t){var H=(0,me.trailingWs)(t.value,s),F=(0,me.leadingWs)(e.value,s),I=(0,me.maximumOverlap)(H,F);e.value=(0,me.removePrefix)(e.value,I)}}var vx=(function(t){nm(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.tokenize=function(r){var n=new RegExp("(\\r?\\n)|[".concat(vo,"]+|[^\\S\\n\\r]+|[^").concat(vo,"]"),"ug");return r.match(n)||[]},e})(sm.default);vt.wordsWithSpaceDiff=new vx;function om(t,e,r){return vt.wordsWithSpaceDiff.diff(t,e,r)}});var am=v(Du=>{"use strict";Object.defineProperty(Du,"__esModule",{value:!0});Du.generateOptions=_x;function _x(t,e){if(typeof t=="function")e.callback=t;else if(t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}});var _o=v(At=>{"use strict";var bx=At&&At.__extends||(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty(At,"__esModule",{value:!0});At.lineDiff=void 0;At.diffLines=wx;At.diffTrimmedLines=xx;At.tokenize=um;var Sx=sr(),Ex=am(),Cx=(function(t){bx(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.tokenize=um,r}return e.prototype.equals=function(r,n,s){return s.ignoreWhitespace?((!s.newlineIsToken||!r.includes(`
12
+ `)}function em(t,e){for(var r=[],n=0,s=Array.from(e.segment(t));n<s.length;n++){var i=s[n],o=i.segment;r.length&&/\s/.test(r[r.length-1])&&/\s/.test(o)?r[r.length-1]+=o:r.push(o)}return r}function tm(t,e){if(e)return gc(t,e)[1];var r;for(r=t.length-1;r>=0&&t[r].match(/\s/);r--);return t.substring(r+1)}function rm(t,e){if(e)return gc(t,e)[0];var r=t.match(/^\s*/);return r?r[0]:""}function gc(t,e){if(!e)return[rm(t),tm(t)];if(e.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');var r=em(t,e),n=r[0],s=r[r.length-1],i=/\s/.test(n)?n:"",o=/\s/.test(s)?s:"";return[i,o]}});var am=v(_t=>{"use strict";var sm=_t&&_t.__extends||(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty(_t,"__esModule",{value:!0});_t.wordsWithSpaceDiff=_t.wordDiff=void 0;_t.diffWords=_x;_t.diffWordsWithSpace=im;var om=or(),ge=Dc(),_o="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",yx=new RegExp("[".concat(_o,"]+|\\s+|[^").concat(_o,"]"),"ug"),vx=(function(t){sm(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.equals=function(r,n,s){return s.ignoreCase&&(r=r.toLowerCase(),n=n.toLowerCase()),r.trim()===n.trim()},e.prototype.tokenize=function(r,n){n===void 0&&(n={});var s;if(n.intlSegmenter){var i=n.intlSegmenter;if(i.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');s=(0,ge.segment)(r,i)}else s=r.match(yx)||[];var o=[],a=null;return s.forEach(function(c){/\s/.test(c)?a==null?o.push(c):o.push(o.pop()+c):a!=null&&/\s/.test(a)?o[o.length-1]==a?o.push(o.pop()+c):o.push(a+c):o.push(c),a=c}),o},e.prototype.join=function(r){return r.map(function(n,s){return s==0?n:n.replace(/^\s+/,"")}).join("")},e.prototype.postProcess=function(r,n){if(!r||n.oneChangePerToken)return r;var s=null,i=null,o=null;return r.forEach(function(a){a.added?i=a:a.removed?o=a:((i||o)&&nm(s,o,i,a,n.intlSegmenter),s=a,i=null,o=null)}),(i||o)&&nm(s,o,i,null,n.intlSegmenter),r},e})(om.default);_t.wordDiff=new vx;function _x(t,e,r){return r?.ignoreWhitespace!=null&&!r.ignoreWhitespace?im(t,e,r):_t.wordDiff.diff(t,e,r)}function nm(t,e,r,n,s){if(e&&r){var i=(0,ge.leadingAndTrailingWs)(e.value,s),o=i[0],a=i[1],c=(0,ge.leadingAndTrailingWs)(r.value,s),u=c[0],l=c[1];if(t){var d=(0,ge.longestCommonPrefix)(o,u);t.value=(0,ge.replaceSuffix)(t.value,u,d),e.value=(0,ge.removePrefix)(e.value,d),r.value=(0,ge.removePrefix)(r.value,d)}if(n){var f=(0,ge.longestCommonSuffix)(a,l);n.value=(0,ge.replacePrefix)(n.value,l,f),e.value=(0,ge.removeSuffix)(e.value,f),r.value=(0,ge.removeSuffix)(r.value,f)}}else if(r){if(t){var g=(0,ge.leadingWs)(r.value,s);r.value=r.value.substring(g.length)}if(n){var g=(0,ge.leadingWs)(n.value,s);n.value=n.value.substring(g.length)}}else if(t&&n){var m=(0,ge.leadingWs)(n.value,s),y=(0,ge.leadingAndTrailingWs)(e.value,s),h=y[0],w=y[1],C=(0,ge.longestCommonPrefix)(m,h);e.value=(0,ge.removePrefix)(e.value,C);var A=(0,ge.longestCommonSuffix)((0,ge.removePrefix)(m,C),w);e.value=(0,ge.removeSuffix)(e.value,A),n.value=(0,ge.replacePrefix)(n.value,m,A),t.value=(0,ge.replaceSuffix)(t.value,m,m.slice(0,m.length-A.length))}else if(n){var T=(0,ge.leadingWs)(n.value,s),G=(0,ge.trailingWs)(e.value,s),I=(0,ge.maximumOverlap)(G,T);e.value=(0,ge.removeSuffix)(e.value,I)}else if(t){var Z=(0,ge.trailingWs)(t.value,s),F=(0,ge.leadingWs)(e.value,s),I=(0,ge.maximumOverlap)(Z,F);e.value=(0,ge.removePrefix)(e.value,I)}}var bx=(function(t){sm(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.tokenize=function(r){var n=new RegExp("(\\r?\\n)|[".concat(_o,"]+|[^\\S\\n\\r]+|[^").concat(_o,"]"),"ug");return r.match(n)||[]},e})(om.default);_t.wordsWithSpaceDiff=new bx;function im(t,e,r){return _t.wordsWithSpaceDiff.diff(t,e,r)}});var cm=v(yc=>{"use strict";Object.defineProperty(yc,"__esModule",{value:!0});yc.generateOptions=Sx;function Sx(t,e){if(typeof t=="function")e.callback=t;else if(t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}});var bo=v(Ft=>{"use strict";var Ex=Ft&&Ft.__extends||(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty(Ft,"__esModule",{value:!0});Ft.lineDiff=void 0;Ft.diffLines=kx;Ft.diffTrimmedLines=$x;Ft.tokenize=um;var Cx=or(),wx=cm(),xx=(function(t){Ex(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.tokenize=um,r}return e.prototype.equals=function(r,n,s){return s.ignoreWhitespace?((!s.newlineIsToken||!r.includes(`
13
13
  `))&&(r=r.trim()),(!s.newlineIsToken||!n.includes(`
14
14
  `))&&(n=n.trim())):s.ignoreNewlineAtEof&&!s.newlineIsToken&&(r.endsWith(`
15
15
  `)&&(r=r.slice(0,-1)),n.endsWith(`
16
- `)&&(n=n.slice(0,-1))),t.prototype.equals.call(this,r,n,s)},e})(Sx.default);At.lineDiff=new Cx;function wx(t,e,r){return At.lineDiff.diff(t,e,r)}function xx(t,e,r){return r=(0,Ex.generateOptions)(r,{ignoreWhitespace:!0}),At.lineDiff.diff(t,e,r)}function um(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
17
- `));var r=[],n=t.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var s=0;s<n.length;s++){var i=n[s];s%2&&!e.newlineIsToken?r[r.length-1]+=i:r.push(i)}return r}});var cm=v(xr=>{"use strict";var kx=xr&&xr.__extends||(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty(xr,"__esModule",{value:!0});xr.sentenceDiff=void 0;xr.diffSentences=jx;var $x=sr();function Ax(t){return t=="."||t=="!"||t=="?"}var Fx=(function(t){kx(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.tokenize=function(r){for(var n,s=[],i=0,o=0;o<r.length;o++){if(o==r.length-1){s.push(r.slice(i));break}if(Ax(r[o])&&r[o+1].match(/\s/)){for(s.push(r.slice(i,o+1)),o=i=o+1;!((n=r[o+1])===null||n===void 0)&&n.match(/\s/);)o++;s.push(r.slice(i,o+1)),i=o+1}}return s},e})($x.default);xr.sentenceDiff=new Fx;function jx(t,e,r){return xr.sentenceDiff.diff(t,e,r)}});var lm=v(kr=>{"use strict";var Ix=kr&&kr.__extends||(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty(kr,"__esModule",{value:!0});kr.cssDiff=void 0;kr.diffCss=Px;var Tx=sr(),Rx=(function(t){Ix(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.tokenize=function(r){return r.split(/([{}:;,]|\s+)/)},e})(Tx.default);kr.cssDiff=new Rx;function Px(t,e,r){return kr.cssDiff.diff(t,e,r)}});var dm=v(or=>{"use strict";var Ox=or&&or.__extends||(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty(or,"__esModule",{value:!0});or.jsonDiff=void 0;or.diffJson=Mx;or.canonicalize=bo;var Nx=sr(),Lx=_o(),Bx=(function(t){Ox(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.tokenize=Lx.tokenize,r}return Object.defineProperty(e.prototype,"useLongestToken",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.castInput=function(r,n){var s=n.undefinedReplacement,i=n.stringifyReplacer,o=i===void 0?function(a,u){return typeof u>"u"?s:u}:i;return typeof r=="string"?r:JSON.stringify(bo(r,null,null,o),null," ")},e.prototype.equals=function(r,n,s){return t.prototype.equals.call(this,r.replace(/,([\r\n])/g,"$1"),n.replace(/,([\r\n])/g,"$1"),s)},e})(Nx.default);or.jsonDiff=new Bx;function Mx(t,e,r){return or.jsonDiff.diff(t,e,r)}function bo(t,e,r,n,s){e=e||[],r=r||[],n&&(t=n(s===void 0?"":s,t));var i;for(i=0;i<e.length;i+=1)if(e[i]===t)return r[i];var o;if(Object.prototype.toString.call(t)==="[object Array]"){for(e.push(t),o=new Array(t.length),r.push(o),i=0;i<t.length;i+=1)o[i]=bo(t[i],e,r,n,String(i));return e.pop(),r.pop(),o}if(t&&t.toJSON&&(t=t.toJSON()),typeof t=="object"&&t!==null){e.push(t),o={},r.push(o);var a=[],u;for(u in t)Object.prototype.hasOwnProperty.call(t,u)&&a.push(u);for(a.sort(),i=0;i<a.length;i+=1)u=a[i],o[u]=bo(t[u],e,r,n,u);e.pop(),r.pop()}else o=t;return o}});var fm=v($r=>{"use strict";var qx=$r&&$r.__extends||(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty($r,"__esModule",{value:!0});$r.arrayDiff=void 0;$r.diffArrays=Zx;var Wx=sr(),Hx=(function(t){qx(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.tokenize=function(r){return r.slice()},e.prototype.join=function(r){return r},e.prototype.removeEmpty=function(r){return r},e})(Wx.default);$r.arrayDiff=new Hx;function Zx(t,e,r){return $r.arrayDiff.diff(t,e,r)}});var mm=v(Ar=>{"use strict";var Gt=Ar&&Ar.__assign||function(){return Gt=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t},Gt.apply(this,arguments)};Object.defineProperty(Ar,"__esModule",{value:!0});Ar.unixToWin=hm;Ar.winToUnix=pm;Ar.isUnix=Ux;Ar.isWin=Vx;function hm(t){return Array.isArray(t)?t.map(function(e){return hm(e)}):Gt(Gt({},t),{hunks:t.hunks.map(function(e){return Gt(Gt({},e),{lines:e.lines.map(function(r,n){var s;return r.startsWith("\\")||r.endsWith("\r")||!((s=e.lines[n+1])===null||s===void 0)&&s.startsWith("\\")?r:r+"\r"})})})})}function pm(t){return Array.isArray(t)?t.map(function(e){return pm(e)}):Gt(Gt({},t),{hunks:t.hunks.map(function(e){return Gt(Gt({},e),{lines:e.lines.map(function(r){return r.endsWith("\r")?r.substring(0,r.length-1):r})})})})}function Ux(t){return Array.isArray(t)||(t=[t]),!t.some(function(e){return e.hunks.some(function(r){return r.lines.some(function(n){return!n.startsWith("\\")&&n.endsWith("\r")})})})}function Vx(t){return Array.isArray(t)||(t=[t]),t.some(function(e){return e.hunks.some(function(r){return r.lines.some(function(n){return n.endsWith("\r")})})})&&t.every(function(e){return e.hunks.every(function(r){return r.lines.every(function(n,s){var i;return n.startsWith("\\")||n.endsWith("\r")||((i=r.lines[s+1])===null||i===void 0?void 0:i.startsWith("\\"))})})})}});var vu=v(yu=>{"use strict";Object.defineProperty(yu,"__esModule",{value:!0});yu.parsePatch=Gx;function Gx(t){var e=t.split(/\n/),r=[],n=0;function s(){var a={};for(r.push(a);n<e.length;){var u=e[n];if(/^(---|\+\+\+|@@)\s/.test(u))break;var c=/^(?:Index:|diff(?: -r \w+)+)\s+/.exec(u);c&&(a.index=u.substring(c[0].length).trim()),n++}for(i(a),i(a),a.hunks=[];n<e.length;){var u=e[n];if(/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/.test(u))break;if(/^@@/.test(u))a.hunks.push(o());else{if(u)throw new Error("Unknown line "+(n+1)+" "+JSON.stringify(u));n++}}}function i(a){var u=/^(---|\+\+\+)\s+/.exec(e[n]);if(u){var c=u[1],l=e[n].substring(3).trim().split(" ",2),d=(l[1]||"").trim(),f=l[0].replace(/\\\\/g,"\\");f.startsWith('"')&&f.endsWith('"')&&(f=f.substr(1,f.length-2)),c==="---"?(a.oldFileName=f,a.oldHeader=d):(a.newFileName=f,a.newHeader=d),n++}}function o(){var a,u=n,c=e[n++],l=c.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/),d={oldStart:+l[1],oldLines:typeof l[2]>"u"?1:+l[2],newStart:+l[3],newLines:typeof l[4]>"u"?1:+l[4],lines:[]};d.oldLines===0&&(d.oldStart+=1),d.newLines===0&&(d.newStart+=1);for(var f=0,g=0;n<e.length&&(g<d.oldLines||f<d.newLines||!((a=e[n])===null||a===void 0)&&a.startsWith("\\"));n++){var m=e[n].length==0&&n!=e.length-1?" ":e[n][0];if(m==="+"||m==="-"||m===" "||m==="\\")d.lines.push(e[n]),m==="+"?f++:m==="-"?g++:m===" "&&(f++,g++);else throw new Error("Hunk at line ".concat(u+1," contained invalid line ").concat(e[n]))}if(!f&&d.newLines===1&&(d.newLines=0),!g&&d.oldLines===1&&(d.oldLines=0),f!==d.newLines)throw new Error("Added line count did not match for hunk at line "+(u+1));if(g!==d.oldLines)throw new Error("Removed line count did not match for hunk at line "+(u+1));return d}for(;n<e.length;)s();return r}});var gm=v(_u=>{"use strict";Object.defineProperty(_u,"__esModule",{value:!0});_u.default=zx;function zx(t,e,r){var n=!0,s=!1,i=!1,o=1;return function a(){if(n&&!i){if(s?o++:n=!1,t+o<=r)return t+o;i=!0}if(!s)return i||(n=!0),e<=t-o?t-o++:(s=!0,a())}}});var _m=v(Eo=>{"use strict";Object.defineProperty(Eo,"__esModule",{value:!0});Eo.applyPatch=vm;Eo.applyPatches=Xx;var Dm=gu(),So=mm(),ym=vu(),Yx=gm();function vm(t,e,r){r===void 0&&(r={});var n;if(typeof e=="string"?n=(0,ym.parsePatch)(e):Array.isArray(e)?n=e:n=[e],n.length>1)throw new Error("applyPatch only works with a single input.");return Jx(t,n[0],r)}function Jx(t,e,r){r===void 0&&(r={}),(r.autoConvertLineEndings||r.autoConvertLineEndings==null)&&((0,Dm.hasOnlyWinLineEndings)(t)&&(0,So.isUnix)(e)?e=(0,So.unixToWin)(e):(0,Dm.hasOnlyUnixLineEndings)(t)&&(0,So.isWin)(e)&&(e=(0,So.winToUnix)(e)));var n=t.split(`
18
- `),s=e.hunks,i=r.compareLine||(function(F,q,P,b){return q===b}),o=r.fuzzFactor||0,a=0;if(o<0||!Number.isInteger(o))throw new Error("fuzzFactor must be a non-negative integer");if(!s.length)return t;for(var u="",c=!1,l=!1,d=0;d<s[s.length-1].lines.length;d++){var f=s[s.length-1].lines[d];f[0]=="\\"&&(u[0]=="+"?c=!0:u[0]=="-"&&(l=!0)),u=f}if(c){if(l){if(!o&&n[n.length-1]=="")return!1}else if(n[n.length-1]=="")n.pop();else if(!o)return!1}else if(l){if(n[n.length-1]!="")n.push("");else if(!o)return!1}function g(F,q,P,b,Q,re,de){b===void 0&&(b=0),Q===void 0&&(Q=!0),re===void 0&&(re=[]),de===void 0&&(de=0);for(var x=0,k=!1;b<F.length;b++){var he=F[b],X=he.length>0?he[0]:" ",Ee=he.length>0?he.substr(1):he;if(X==="-")if(i(q+1,n[q],X,Ee))q++,x=0;else return!P||n[q]==null?null:(re[de]=n[q],g(F,q+1,P-1,b,!1,re,de+1));if(X==="+"){if(!Q)return null;re[de]=Ee,de++,x=0,k=!0}if(X===" ")if(x++,re[de]=n[q],i(q+1,n[q],X,Ee))de++,Q=!0,k=!1,q++;else return k||!P?null:n[q]&&(g(F,q+1,P-1,b+1,!1,re,de+1)||g(F,q+1,P-1,b,!1,re,de+1))||g(F,q,P-1,b+1,!1,re,de)}return de-=x,q-=x,re.length=de,{patchedLines:re,oldLineLastI:q-1}}for(var m=[],y=0,d=0;d<s.length;d++){for(var h=s[d],w=void 0,C=n.length-h.oldLines+o,A=void 0,T=0;T<=o;T++){A=h.oldStart+y-1;for(var V=(0,Yx.default)(A,a,C);A!==void 0&&(w=g(h.lines,A,T),!w);A=V());if(w)break}if(!w)return!1;for(var I=a;I<A;I++)m.push(n[I]);for(var H=0;H<w.patchedLines.length;H++){var f=w.patchedLines[H];m.push(f)}a=w.oldLineLastI+1,y=A+1-h.oldStart}for(var d=a;d<n.length;d++)m.push(n[d]);return m.join(`
19
- `)}function Xx(t,e){var r=typeof t=="string"?(0,ym.parsePatch)(t):t,n=0;function s(){var i=r[n++];if(!i)return e.complete();e.loadFile(i,function(o,a){if(o)return e.complete(o);var u=vm(a,i,e);e.patched(i,u,function(c){if(c)return e.complete(c);s()})})}s()}});var Sm=v(ts=>{"use strict";var Co=ts&&ts.__assign||function(){return Co=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t},Co.apply(this,arguments)};Object.defineProperty(ts,"__esModule",{value:!0});ts.reversePatch=bm;function bm(t){return Array.isArray(t)?t.map(function(e){return bm(e)}).reverse():Co(Co({},t),{oldFileName:t.newFileName,oldHeader:t.newHeader,newFileName:t.oldFileName,newHeader:t.oldHeader,hunks:t.hunks.map(function(e){return{oldLines:e.newLines,oldStart:e.newStart,newLines:e.oldLines,newStart:e.oldStart,lines:e.lines.map(function(r){return r.startsWith("-")?"+".concat(r.slice(1)):r.startsWith("+")?"-".concat(r.slice(1)):r})}})})}});var wm=v(Je=>{"use strict";var $n=Je&&Je.__assign||function(){return $n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t},$n.apply(this,arguments)};Object.defineProperty(Je,"__esModule",{value:!0});Je.OMIT_HEADERS=Je.FILE_HEADERS_ONLY=Je.INCLUDE_HEADERS=void 0;Je.structuredPatch=bu;Je.formatPatch=wo;Je.createTwoFilesPatch=Cm;Je.createPatch=Kx;var Em=_o();Je.INCLUDE_HEADERS={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};Je.FILE_HEADERS_ONLY={includeIndex:!1,includeUnderline:!1,includeFileHeaders:!0};Je.OMIT_HEADERS={includeIndex:!1,includeUnderline:!1,includeFileHeaders:!1};function bu(t,e,r,n,s,i,o){var a;o?typeof o=="function"?a={callback:o}:a=o:a={},typeof a.context>"u"&&(a.context=4);var 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){var c=a.callback;(0,Em.diffLines)(r,n,$n($n({},a),{callback:function(d){var f=l(d);c(f)}}))}else return l((0,Em.diffLines)(r,n,a));function l(d){if(!d)return;d.push({value:"",lines:[]});function f(X){return X.map(function(Ee){return" "+Ee})}for(var g=[],m=0,y=0,h=[],w=1,C=1,A=0;A<d.length;A++){var T=d[A],V=T.lines||Qx(T.value);if(T.lines=V,T.added||T.removed){if(!m){var I=d[A-1];m=w,y=C,I&&(h=u>0?f(I.lines.slice(-u)):[],m-=h.length,y-=h.length)}for(var H=0,F=V;H<F.length;H++){var q=F[H];h.push((T.added?"+":"-")+q)}T.added?C+=V.length:w+=V.length}else{if(m)if(V.length<=u*2&&A<d.length-2)for(var P=0,b=f(V);P<b.length;P++){var q=b[P];h.push(q)}else{for(var Q=Math.min(V.length,u),re=0,de=f(V.slice(0,Q));re<de.length;re++){var q=de[re];h.push(q)}var x={oldStart:m,oldLines:w-m+Q,newStart:y,newLines:C-y+Q,lines:h};g.push(x),m=0,y=0,h=[]}w+=V.length,C+=V.length}}for(var k=0,he=g;k<he.length;k++)for(var x=he[k],A=0;A<x.lines.length;A++)x.lines[A].endsWith(`
20
- `)?x.lines[A]=x.lines[A].slice(0,-1):(x.lines.splice(A+1,0,"\"),A++);return{oldFileName:t,newFileName:e,oldHeader:s,newHeader:i,hunks:g}}}function wo(t,e){if(e||(e=Je.INCLUDE_HEADERS),Array.isArray(t)){if(t.length>1&&!e.includeFileHeaders)throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return t.map(function(u){return wo(u,e)}).join(`
16
+ `)&&(n=n.slice(0,-1))),t.prototype.equals.call(this,r,n,s)},e})(Cx.default);Ft.lineDiff=new xx;function kx(t,e,r){return Ft.lineDiff.diff(t,e,r)}function $x(t,e,r){return r=(0,wx.generateOptions)(r,{ignoreWhitespace:!0}),Ft.lineDiff.diff(t,e,r)}function um(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
17
+ `));var r=[],n=t.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var s=0;s<n.length;s++){var i=n[s];s%2&&!e.newlineIsToken?r[r.length-1]+=i:r.push(i)}return r}});var lm=v($r=>{"use strict";var Ax=$r&&$r.__extends||(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty($r,"__esModule",{value:!0});$r.sentenceDiff=void 0;$r.diffSentences=Tx;var Fx=or();function jx(t){return t=="."||t=="!"||t=="?"}var Ix=(function(t){Ax(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.tokenize=function(r){for(var n,s=[],i=0,o=0;o<r.length;o++){if(o==r.length-1){s.push(r.slice(i));break}if(jx(r[o])&&r[o+1].match(/\s/)){for(s.push(r.slice(i,o+1)),o=i=o+1;!((n=r[o+1])===null||n===void 0)&&n.match(/\s/);)o++;s.push(r.slice(i,o+1)),i=o+1}}return s},e})(Fx.default);$r.sentenceDiff=new Ix;function Tx(t,e,r){return $r.sentenceDiff.diff(t,e,r)}});var dm=v(Ar=>{"use strict";var Rx=Ar&&Ar.__extends||(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty(Ar,"__esModule",{value:!0});Ar.cssDiff=void 0;Ar.diffCss=Nx;var Px=or(),Ox=(function(t){Rx(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.tokenize=function(r){return r.split(/([{}:;,]|\s+)/)},e})(Px.default);Ar.cssDiff=new Ox;function Nx(t,e,r){return Ar.cssDiff.diff(t,e,r)}});var fm=v(ir=>{"use strict";var Lx=ir&&ir.__extends||(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty(ir,"__esModule",{value:!0});ir.jsonDiff=void 0;ir.diffJson=Wx;ir.canonicalize=So;var Bx=or(),Mx=bo(),qx=(function(t){Lx(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.tokenize=Mx.tokenize,r}return Object.defineProperty(e.prototype,"useLongestToken",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.castInput=function(r,n){var s=n.undefinedReplacement,i=n.stringifyReplacer,o=i===void 0?function(a,c){return typeof c>"u"?s:c}:i;return typeof r=="string"?r:JSON.stringify(So(r,null,null,o),null," ")},e.prototype.equals=function(r,n,s){return t.prototype.equals.call(this,r.replace(/,([\r\n])/g,"$1"),n.replace(/,([\r\n])/g,"$1"),s)},e})(Bx.default);ir.jsonDiff=new qx;function Wx(t,e,r){return ir.jsonDiff.diff(t,e,r)}function So(t,e,r,n,s){e=e||[],r=r||[],n&&(t=n(s===void 0?"":s,t));var i;for(i=0;i<e.length;i+=1)if(e[i]===t)return r[i];var o;if(Object.prototype.toString.call(t)==="[object Array]"){for(e.push(t),o=new Array(t.length),r.push(o),i=0;i<t.length;i+=1)o[i]=So(t[i],e,r,n,String(i));return e.pop(),r.pop(),o}if(t&&t.toJSON&&(t=t.toJSON()),typeof t=="object"&&t!==null){e.push(t),o={},r.push(o);var a=[],c;for(c in t)Object.prototype.hasOwnProperty.call(t,c)&&a.push(c);for(a.sort(),i=0;i<a.length;i+=1)c=a[i],o[c]=So(t[c],e,r,n,c);e.pop(),r.pop()}else o=t;return o}});var hm=v(Fr=>{"use strict";var Hx=Fr&&Fr.__extends||(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty(Fr,"__esModule",{value:!0});Fr.arrayDiff=void 0;Fr.diffArrays=Vx;var Zx=or(),Ux=(function(t){Hx(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.tokenize=function(r){return r.slice()},e.prototype.join=function(r){return r},e.prototype.removeEmpty=function(r){return r},e})(Zx.default);Fr.arrayDiff=new Ux;function Vx(t,e,r){return Fr.arrayDiff.diff(t,e,r)}});var gm=v(jr=>{"use strict";var zt=jr&&jr.__assign||function(){return zt=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t},zt.apply(this,arguments)};Object.defineProperty(jr,"__esModule",{value:!0});jr.unixToWin=pm;jr.winToUnix=mm;jr.isUnix=Gx;jr.isWin=zx;function pm(t){return Array.isArray(t)?t.map(function(e){return pm(e)}):zt(zt({},t),{hunks:t.hunks.map(function(e){return zt(zt({},e),{lines:e.lines.map(function(r,n){var s;return r.startsWith("\\")||r.endsWith("\r")||!((s=e.lines[n+1])===null||s===void 0)&&s.startsWith("\\")?r:r+"\r"})})})})}function mm(t){return Array.isArray(t)?t.map(function(e){return mm(e)}):zt(zt({},t),{hunks:t.hunks.map(function(e){return zt(zt({},e),{lines:e.lines.map(function(r){return r.endsWith("\r")?r.substring(0,r.length-1):r})})})})}function Gx(t){return Array.isArray(t)||(t=[t]),!t.some(function(e){return e.hunks.some(function(r){return r.lines.some(function(n){return!n.startsWith("\\")&&n.endsWith("\r")})})})}function zx(t){return Array.isArray(t)||(t=[t]),t.some(function(e){return e.hunks.some(function(r){return r.lines.some(function(n){return n.endsWith("\r")})})})&&t.every(function(e){return e.hunks.every(function(r){return r.lines.every(function(n,s){var i;return n.startsWith("\\")||n.endsWith("\r")||((i=r.lines[s+1])===null||i===void 0?void 0:i.startsWith("\\"))})})})}});var _c=v(vc=>{"use strict";Object.defineProperty(vc,"__esModule",{value:!0});vc.parsePatch=Yx;function Yx(t){var e=t.split(/\n/),r=[],n=0;function s(){var a={};for(r.push(a);n<e.length;){var c=e[n];if(/^(---|\+\+\+|@@)\s/.test(c))break;var u=/^(?:Index:|diff(?: -r \w+)+)\s+/.exec(c);u&&(a.index=c.substring(u[0].length).trim()),n++}for(i(a),i(a),a.hunks=[];n<e.length;){var c=e[n];if(/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/.test(c))break;if(/^@@/.test(c))a.hunks.push(o());else{if(c)throw new Error("Unknown line "+(n+1)+" "+JSON.stringify(c));n++}}}function i(a){var c=/^(---|\+\+\+)\s+/.exec(e[n]);if(c){var u=c[1],l=e[n].substring(3).trim().split(" ",2),d=(l[1]||"").trim(),f=l[0].replace(/\\\\/g,"\\");f.startsWith('"')&&f.endsWith('"')&&(f=f.substr(1,f.length-2)),u==="---"?(a.oldFileName=f,a.oldHeader=d):(a.newFileName=f,a.newHeader=d),n++}}function o(){var a,c=n,u=e[n++],l=u.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/),d={oldStart:+l[1],oldLines:typeof l[2]>"u"?1:+l[2],newStart:+l[3],newLines:typeof l[4]>"u"?1:+l[4],lines:[]};d.oldLines===0&&(d.oldStart+=1),d.newLines===0&&(d.newStart+=1);for(var f=0,g=0;n<e.length&&(g<d.oldLines||f<d.newLines||!((a=e[n])===null||a===void 0)&&a.startsWith("\\"));n++){var m=e[n].length==0&&n!=e.length-1?" ":e[n][0];if(m==="+"||m==="-"||m===" "||m==="\\")d.lines.push(e[n]),m==="+"?f++:m==="-"?g++:m===" "&&(f++,g++);else throw new Error("Hunk at line ".concat(c+1," contained invalid line ").concat(e[n]))}if(!f&&d.newLines===1&&(d.newLines=0),!g&&d.oldLines===1&&(d.oldLines=0),f!==d.newLines)throw new Error("Added line count did not match for hunk at line "+(c+1));if(g!==d.oldLines)throw new Error("Removed line count did not match for hunk at line "+(c+1));return d}for(;n<e.length;)s();return r}});var Dm=v(bc=>{"use strict";Object.defineProperty(bc,"__esModule",{value:!0});bc.default=Jx;function Jx(t,e,r){var n=!0,s=!1,i=!1,o=1;return function a(){if(n&&!i){if(s?o++:n=!1,t+o<=r)return t+o;i=!0}if(!s)return i||(n=!0),e<=t-o?t-o++:(s=!0,a())}}});var bm=v(Co=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});Co.applyPatch=_m;Co.applyPatches=Qx;var ym=Dc(),Eo=gm(),vm=_c(),Xx=Dm();function _m(t,e,r){r===void 0&&(r={});var n;if(typeof e=="string"?n=(0,vm.parsePatch)(e):Array.isArray(e)?n=e:n=[e],n.length>1)throw new Error("applyPatch only works with a single input.");return Kx(t,n[0],r)}function Kx(t,e,r){r===void 0&&(r={}),(r.autoConvertLineEndings||r.autoConvertLineEndings==null)&&((0,ym.hasOnlyWinLineEndings)(t)&&(0,Eo.isUnix)(e)?e=(0,Eo.unixToWin)(e):(0,ym.hasOnlyUnixLineEndings)(t)&&(0,Eo.isWin)(e)&&(e=(0,Eo.winToUnix)(e)));var n=t.split(`
18
+ `),s=e.hunks,i=r.compareLine||(function(F,W,R,b){return W===b}),o=r.fuzzFactor||0,a=0;if(o<0||!Number.isInteger(o))throw new Error("fuzzFactor must be a non-negative integer");if(!s.length)return t;for(var c="",u=!1,l=!1,d=0;d<s[s.length-1].lines.length;d++){var f=s[s.length-1].lines[d];f[0]=="\\"&&(c[0]=="+"?u=!0:c[0]=="-"&&(l=!0)),c=f}if(u){if(l){if(!o&&n[n.length-1]=="")return!1}else if(n[n.length-1]=="")n.pop();else if(!o)return!1}else if(l){if(n[n.length-1]!="")n.push("");else if(!o)return!1}function g(F,W,R,b,Q,te,de){b===void 0&&(b=0),Q===void 0&&(Q=!0),te===void 0&&(te=[]),de===void 0&&(de=0);for(var x=0,k=!1;b<F.length;b++){var he=F[b],X=he.length>0?he[0]:" ",xe=he.length>0?he.substr(1):he;if(X==="-")if(i(W+1,n[W],X,xe))W++,x=0;else return!R||n[W]==null?null:(te[de]=n[W],g(F,W+1,R-1,b,!1,te,de+1));if(X==="+"){if(!Q)return null;te[de]=xe,de++,x=0,k=!0}if(X===" ")if(x++,te[de]=n[W],i(W+1,n[W],X,xe))de++,Q=!0,k=!1,W++;else return k||!R?null:n[W]&&(g(F,W+1,R-1,b+1,!1,te,de+1)||g(F,W+1,R-1,b,!1,te,de+1))||g(F,W,R-1,b+1,!1,te,de)}return de-=x,W-=x,te.length=de,{patchedLines:te,oldLineLastI:W-1}}for(var m=[],y=0,d=0;d<s.length;d++){for(var h=s[d],w=void 0,C=n.length-h.oldLines+o,A=void 0,T=0;T<=o;T++){A=h.oldStart+y-1;for(var G=(0,Xx.default)(A,a,C);A!==void 0&&(w=g(h.lines,A,T),!w);A=G());if(w)break}if(!w)return!1;for(var I=a;I<A;I++)m.push(n[I]);for(var Z=0;Z<w.patchedLines.length;Z++){var f=w.patchedLines[Z];m.push(f)}a=w.oldLineLastI+1,y=A+1-h.oldStart}for(var d=a;d<n.length;d++)m.push(n[d]);return m.join(`
19
+ `)}function Qx(t,e){var r=typeof t=="string"?(0,vm.parsePatch)(t):t,n=0;function s(){var i=r[n++];if(!i)return e.complete();e.loadFile(i,function(o,a){if(o)return e.complete(o);var c=_m(a,i,e);e.patched(i,c,function(u){if(u)return e.complete(u);s()})})}s()}});var Em=v(ns=>{"use strict";var wo=ns&&ns.__assign||function(){return wo=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t},wo.apply(this,arguments)};Object.defineProperty(ns,"__esModule",{value:!0});ns.reversePatch=Sm;function Sm(t){return Array.isArray(t)?t.map(function(e){return Sm(e)}).reverse():wo(wo({},t),{oldFileName:t.newFileName,oldHeader:t.newHeader,newFileName:t.oldFileName,newHeader:t.oldHeader,hunks:t.hunks.map(function(e){return{oldLines:e.newLines,oldStart:e.newStart,newLines:e.oldLines,newStart:e.oldStart,lines:e.lines.map(function(r){return r.startsWith("-")?"+".concat(r.slice(1)):r.startsWith("+")?"-".concat(r.slice(1)):r})}})})}});var xm=v(Ke=>{"use strict";var Fn=Ke&&Ke.__assign||function(){return Fn=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t},Fn.apply(this,arguments)};Object.defineProperty(Ke,"__esModule",{value:!0});Ke.OMIT_HEADERS=Ke.FILE_HEADERS_ONLY=Ke.INCLUDE_HEADERS=void 0;Ke.structuredPatch=Sc;Ke.formatPatch=xo;Ke.createTwoFilesPatch=wm;Ke.createPatch=ek;var Cm=bo();Ke.INCLUDE_HEADERS={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};Ke.FILE_HEADERS_ONLY={includeIndex:!1,includeUnderline:!1,includeFileHeaders:!0};Ke.OMIT_HEADERS={includeIndex:!1,includeUnderline:!1,includeFileHeaders:!1};function Sc(t,e,r,n,s,i,o){var a;o?typeof o=="function"?a={callback:o}:a=o:a={},typeof a.context>"u"&&(a.context=4);var c=a.context;if(a.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(a.callback){var u=a.callback;(0,Cm.diffLines)(r,n,Fn(Fn({},a),{callback:function(d){var f=l(d);u(f)}}))}else return l((0,Cm.diffLines)(r,n,a));function l(d){if(!d)return;d.push({value:"",lines:[]});function f(X){return X.map(function(xe){return" "+xe})}for(var g=[],m=0,y=0,h=[],w=1,C=1,A=0;A<d.length;A++){var T=d[A],G=T.lines||tk(T.value);if(T.lines=G,T.added||T.removed){if(!m){var I=d[A-1];m=w,y=C,I&&(h=c>0?f(I.lines.slice(-c)):[],m-=h.length,y-=h.length)}for(var Z=0,F=G;Z<F.length;Z++){var W=F[Z];h.push((T.added?"+":"-")+W)}T.added?C+=G.length:w+=G.length}else{if(m)if(G.length<=c*2&&A<d.length-2)for(var R=0,b=f(G);R<b.length;R++){var W=b[R];h.push(W)}else{for(var Q=Math.min(G.length,c),te=0,de=f(G.slice(0,Q));te<de.length;te++){var W=de[te];h.push(W)}var x={oldStart:m,oldLines:w-m+Q,newStart:y,newLines:C-y+Q,lines:h};g.push(x),m=0,y=0,h=[]}w+=G.length,C+=G.length}}for(var k=0,he=g;k<he.length;k++)for(var x=he[k],A=0;A<x.lines.length;A++)x.lines[A].endsWith(`
20
+ `)?x.lines[A]=x.lines[A].slice(0,-1):(x.lines.splice(A+1,0,"\"),A++);return{oldFileName:t,newFileName:e,oldHeader:s,newHeader:i,hunks:g}}}function xo(t,e){if(e||(e=Ke.INCLUDE_HEADERS),Array.isArray(t)){if(t.length>1&&!e.includeFileHeaders)throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return t.map(function(c){return xo(c,e)}).join(`
21
21
  `)}var r=[];e.includeIndex&&t.oldFileName==t.newFileName&&r.push("Index: "+t.oldFileName),e.includeUnderline&&r.push("==================================================================="),e.includeFileHeaders&&(r.push("--- "+t.oldFileName+(typeof t.oldHeader>"u"?"":" "+t.oldHeader)),r.push("+++ "+t.newFileName+(typeof t.newHeader>"u"?"":" "+t.newHeader)));for(var n=0;n<t.hunks.length;n++){var s=t.hunks[n];s.oldLines===0&&(s.oldStart-=1),s.newLines===0&&(s.newStart-=1),r.push("@@ -"+s.oldStart+","+s.oldLines+" +"+s.newStart+","+s.newLines+" @@");for(var i=0,o=s.lines;i<o.length;i++){var a=o[i];r.push(a)}}return r.join(`
22
22
  `)+`
23
- `}function Cm(t,e,r,n,s,i,o){if(typeof o=="function"&&(o={callback:o}),o?.callback){var u=o.callback;bu(t,e,r,n,s,i,$n($n({},o),{callback:function(c){u(c?wo(c,o.headerOptions):void 0)}}))}else{var a=bu(t,e,r,n,s,i,o);return a?wo(a,o?.headerOptions):void 0}}function Kx(t,e,r,n,s,i){return Cm(t,t,e,r,n,s,i)}function Qx(t){var e=t.endsWith(`
23
+ `}function wm(t,e,r,n,s,i,o){if(typeof o=="function"&&(o={callback:o}),o?.callback){var c=o.callback;Sc(t,e,r,n,s,i,Fn(Fn({},o),{callback:function(u){c(u?xo(u,o.headerOptions):void 0)}}))}else{var a=Sc(t,e,r,n,s,i,o);return a?xo(a,o?.headerOptions):void 0}}function ek(t,e,r,n,s,i){return wm(t,t,e,r,n,s,i)}function tk(t){var e=t.endsWith(`
24
24
  `),r=t.split(`
25
25
  `).map(function(n){return n+`
26
- `});return e?r.pop():r.push(r.pop().slice(0,-1)),r}});var xm=v(Su=>{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});Su.convertChangesToDMP=ek;function ek(t){for(var e=[],r,n,s=0;s<t.length;s++)r=t[s],r.added?n=1:r.removed?n=-1:n=0,e.push([n,r.value]);return e}});var km=v(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});Eu.convertChangesToXML=tk;function tk(t){for(var e=[],r=0;r<t.length;r++){var n=t[r];n.added?e.push("<ins>"):n.removed&&e.push("<del>"),e.push(rk(n.value)),n.added?e.push("</ins>"):n.removed&&e.push("</del>")}return e.join("")}function rk(t){var e=t;return e=e.replace(/&/g,"&amp;"),e=e.replace(/</g,"&lt;"),e=e.replace(/>/g,"&gt;"),e=e.replace(/"/g,"&quot;"),e}});var Tm=v(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.canonicalize=G.convertChangesToXML=G.convertChangesToDMP=G.reversePatch=G.parsePatch=G.applyPatches=G.applyPatch=G.OMIT_HEADERS=G.FILE_HEADERS_ONLY=G.INCLUDE_HEADERS=G.formatPatch=G.createPatch=G.createTwoFilesPatch=G.structuredPatch=G.arrayDiff=G.diffArrays=G.jsonDiff=G.diffJson=G.cssDiff=G.diffCss=G.sentenceDiff=G.diffSentences=G.diffTrimmedLines=G.lineDiff=G.diffLines=G.wordsWithSpaceDiff=G.diffWordsWithSpace=G.wordDiff=G.diffWords=G.characterDiff=G.diffChars=G.Diff=void 0;var nk=sr();G.Diff=nk.default;var $m=Jp();Object.defineProperty(G,"diffChars",{enumerable:!0,get:function(){return $m.diffChars}});Object.defineProperty(G,"characterDiff",{enumerable:!0,get:function(){return $m.characterDiff}});var xo=im();Object.defineProperty(G,"diffWords",{enumerable:!0,get:function(){return xo.diffWords}});Object.defineProperty(G,"diffWordsWithSpace",{enumerable:!0,get:function(){return xo.diffWordsWithSpace}});Object.defineProperty(G,"wordDiff",{enumerable:!0,get:function(){return xo.wordDiff}});Object.defineProperty(G,"wordsWithSpaceDiff",{enumerable:!0,get:function(){return xo.wordsWithSpaceDiff}});var Cu=_o();Object.defineProperty(G,"diffLines",{enumerable:!0,get:function(){return Cu.diffLines}});Object.defineProperty(G,"diffTrimmedLines",{enumerable:!0,get:function(){return Cu.diffTrimmedLines}});Object.defineProperty(G,"lineDiff",{enumerable:!0,get:function(){return Cu.lineDiff}});var Am=cm();Object.defineProperty(G,"diffSentences",{enumerable:!0,get:function(){return Am.diffSentences}});Object.defineProperty(G,"sentenceDiff",{enumerable:!0,get:function(){return Am.sentenceDiff}});var Fm=lm();Object.defineProperty(G,"diffCss",{enumerable:!0,get:function(){return Fm.diffCss}});Object.defineProperty(G,"cssDiff",{enumerable:!0,get:function(){return Fm.cssDiff}});var wu=dm();Object.defineProperty(G,"diffJson",{enumerable:!0,get:function(){return wu.diffJson}});Object.defineProperty(G,"canonicalize",{enumerable:!0,get:function(){return wu.canonicalize}});Object.defineProperty(G,"jsonDiff",{enumerable:!0,get:function(){return wu.jsonDiff}});var jm=fm();Object.defineProperty(G,"diffArrays",{enumerable:!0,get:function(){return jm.diffArrays}});Object.defineProperty(G,"arrayDiff",{enumerable:!0,get:function(){return jm.arrayDiff}});var Im=_m();Object.defineProperty(G,"applyPatch",{enumerable:!0,get:function(){return Im.applyPatch}});Object.defineProperty(G,"applyPatches",{enumerable:!0,get:function(){return Im.applyPatches}});var sk=vu();Object.defineProperty(G,"parsePatch",{enumerable:!0,get:function(){return sk.parsePatch}});var ok=Sm();Object.defineProperty(G,"reversePatch",{enumerable:!0,get:function(){return ok.reversePatch}});var tn=wm();Object.defineProperty(G,"structuredPatch",{enumerable:!0,get:function(){return tn.structuredPatch}});Object.defineProperty(G,"createTwoFilesPatch",{enumerable:!0,get:function(){return tn.createTwoFilesPatch}});Object.defineProperty(G,"createPatch",{enumerable:!0,get:function(){return tn.createPatch}});Object.defineProperty(G,"formatPatch",{enumerable:!0,get:function(){return tn.formatPatch}});Object.defineProperty(G,"INCLUDE_HEADERS",{enumerable:!0,get:function(){return tn.INCLUDE_HEADERS}});Object.defineProperty(G,"FILE_HEADERS_ONLY",{enumerable:!0,get:function(){return tn.FILE_HEADERS_ONLY}});Object.defineProperty(G,"OMIT_HEADERS",{enumerable:!0,get:function(){return tn.OMIT_HEADERS}});var ik=xm();Object.defineProperty(G,"convertChangesToDMP",{enumerable:!0,get:function(){return ik.convertChangesToDMP}});var ak=km();Object.defineProperty(G,"convertChangesToXML",{enumerable:!0,get:function(){return ak.convertChangesToXML}})});var ku=v((RI,Rm)=>{"use strict";var xu={to(t,e){return e?`\x1B[${e+1};${t+1}H`:`\x1B[${t+1}G`},move(t,e){let r="";return t<0?r+=`\x1B[${-t}D`:t>0&&(r+=`\x1B[${t}C`),e<0?r+=`\x1B[${-e}A`:e>0&&(r+=`\x1B[${e}B`),r},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},uk={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},ck={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let e="";for(let r=0;r<t;r++)e+=this.line+(r<t-1?xu.up():"");return t&&(e+=xu.left),e}};Rm.exports={cursor:xu,scroll:uk,erase:ck,beep:"\x07"}});var eg=v(_t=>{"use strict";var nt=ku(),Fo=require("node:process"),Gm=require("node:readline"),lk=require("node:tty"),dk=Pn();function zm(t){return t&&typeof t=="object"&&"default"in t?t.default:t}function fk(t){if(t&&typeof t=="object"&&"default"in t)return t;let e=Object.create(null);if(t)for(let r in t)e[r]=t[r];return e.default=t,e}var ko=fk(Gm),Pm=zm(Gm),Ao=zm(dk);function hk({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")}var pk=hk();function Ym(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(pk,"")}function Jm(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Xm={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(n){var s=n.charCodeAt(0),i=n.length==2?n.charCodeAt(1):0,o=s;return 55296<=s&&s<=56319&&56320<=i&&i<=57343&&(s&=1023,i&=1023,o=s<<10|i,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(n){var s=this.eastAsianWidth(n);return s=="F"||s=="W"||s=="A"?2:1};function r(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(n){for(var s=r(n),i=0,o=0;o<s.length;o++)i=i+this.characterLength(s[o]);return i},e.slice=function(n,s,i){textLen=e.length(n),s=s||0,i=i||1,s<0&&(s=textLen+s),i<0&&(i=textLen+i);for(var o="",a=0,u=r(n),c=0;c<u.length;c++){var l=u[c],d=e.length(l);if(a>=s-(d==2?1:0))if(a+d<=i)o+=l;else break;a+=d}return o}})(Xm);var mk=Xm.exports,gk=Jm(mk),Dk=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},yk=Jm(Dk);function rs(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=Ym(t),t.length===0))return 0;t=t.replace(yk()," ");let r=e.ambiguousIsNarrow?1:2,n=0;for(let s of t){let i=s.codePointAt(0);if(!(i<=31||i>=127&&i<=159||i>=768&&i<=879))switch(gk.eastAsianWidth(s)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var $u=10,Om=(t=0)=>e=>`\x1B[${e+t}m`,Nm=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,Lm=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,ke={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(ke.modifier);var vk=Object.keys(ke.color),_k=Object.keys(ke.bgColor);[...vk,..._k];function bk(){let t=new Map;for(let[e,r]of Object.entries(ke)){for(let[n,s]of Object.entries(r))ke[n]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},r[n]=ke[n],t.set(s[0],s[1]);Object.defineProperty(ke,e,{value:r,enumerable:!1})}return Object.defineProperty(ke,"codes",{value:t,enumerable:!1}),ke.color.close="\x1B[39m",ke.bgColor.close="\x1B[49m",ke.color.ansi=Om(),ke.color.ansi256=Nm(),ke.color.ansi16m=Lm(),ke.bgColor.ansi=Om($u),ke.bgColor.ansi256=Nm($u),ke.bgColor.ansi16m=Lm($u),Object.defineProperties(ke,{rgbToAnsi256:{value:(e,r,n)=>e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:e=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(i=>i+i).join(""));let s=Number.parseInt(n,16);return[s>>16&255,s>>8&255,s&255]},enumerable:!1},hexToAnsi256:{value:e=>ke.rgbToAnsi256(...ke.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let r,n,s;if(e>=232)r=((e-232)*10+8)/255,n=r,s=r;else{e-=16;let a=e%36;r=Math.floor(e/36)/5,n=Math.floor(a/6)/5,s=a%6/5}let i=Math.max(r,n,s)*2;if(i===0)return 30;let o=30+(Math.round(s)<<2|Math.round(n)<<1|Math.round(r));return i===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>ke.ansi256ToAnsi(ke.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>ke.ansi256ToAnsi(ke.hexToAnsi256(e)),enumerable:!1}}),ke}var Sk=bk(),jo=new Set(["\x1B","\x9B"]),Ek=39,Ou="\x07",Km="[",Ck="]",Qm="m",Nu=`${Ck}8;;`,Bm=t=>`${jo.values().next().value}${Km}${t}${Qm}`,Mm=t=>`${jo.values().next().value}${Nu}${t}${Ou}`,wk=t=>t.split(" ").map(e=>rs(e)),Au=(t,e,r)=>{let n=[...e],s=!1,i=!1,o=rs(Ym(t[t.length-1]));for(let[a,u]of n.entries()){let c=rs(u);if(o+c<=r?t[t.length-1]+=u:(t.push(u),o=0),jo.has(u)&&(s=!0,i=n.slice(a+1).join("").startsWith(Nu)),s){i?u===Ou&&(s=!1,i=!1):u===Qm&&(s=!1);continue}o+=c,o===r&&a<n.length-1&&(t.push(""),o=0)}!o&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},xk=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(rs(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},kk=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",s,i,o=wk(t),a=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let d=rs(a[a.length-1]);if(c!==0&&(d>=e&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),d=0),(d>0||r.trim===!1)&&(a[a.length-1]+=" ",d++)),r.hard&&o[c]>e){let f=e-d,g=1+Math.floor((o[c]-f-1)/e);Math.floor((o[c]-1)/e)<g&&a.push(""),Au(a,l,e);continue}if(d+o[c]>e&&d>0&&o[c]>0){if(r.wordWrap===!1&&d<e){Au(a,l,e);continue}a.push("")}if(d+o[c]>e&&r.wordWrap===!1){Au(a,l,e);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(c=>xk(c)));let u=[...a.join(`
27
- `)];for(let[c,l]of u.entries()){if(n+=l,jo.has(l)){let{groups:f}=new RegExp(`(?:\\${Km}(?<code>\\d+)m|\\${Nu}(?<uri>.*)${Ou})`).exec(u.slice(c).join(""))||{groups:{}};if(f.code!==void 0){let g=Number.parseFloat(f.code);s=g===Ek?void 0:g}else f.uri!==void 0&&(i=f.uri.length===0?void 0:f.uri)}let d=Sk.codes.get(Number(s));u[c+1]===`
28
- `?(i&&(n+=Mm("")),s&&d&&(n+=Bm(d))):l===`
29
- `&&(s&&d&&(n+=Bm(s)),i&&(n+=Mm(i)))}return n};function qm(t,e,r){return String(t).normalize().replace(/\r\n/g,`
26
+ `});return e?r.pop():r.push(r.pop().slice(0,-1)),r}});var km=v(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});Ec.convertChangesToDMP=rk;function rk(t){for(var e=[],r,n,s=0;s<t.length;s++)r=t[s],r.added?n=1:r.removed?n=-1:n=0,e.push([n,r.value]);return e}});var $m=v(Cc=>{"use strict";Object.defineProperty(Cc,"__esModule",{value:!0});Cc.convertChangesToXML=nk;function nk(t){for(var e=[],r=0;r<t.length;r++){var n=t[r];n.added?e.push("<ins>"):n.removed&&e.push("<del>"),e.push(sk(n.value)),n.added?e.push("</ins>"):n.removed&&e.push("</del>")}return e.join("")}function sk(t){var e=t;return e=e.replace(/&/g,"&amp;"),e=e.replace(/</g,"&lt;"),e=e.replace(/>/g,"&gt;"),e=e.replace(/"/g,"&quot;"),e}});var Rm=v(z=>{"use strict";Object.defineProperty(z,"__esModule",{value:!0});z.canonicalize=z.convertChangesToXML=z.convertChangesToDMP=z.reversePatch=z.parsePatch=z.applyPatches=z.applyPatch=z.OMIT_HEADERS=z.FILE_HEADERS_ONLY=z.INCLUDE_HEADERS=z.formatPatch=z.createPatch=z.createTwoFilesPatch=z.structuredPatch=z.arrayDiff=z.diffArrays=z.jsonDiff=z.diffJson=z.cssDiff=z.diffCss=z.sentenceDiff=z.diffSentences=z.diffTrimmedLines=z.lineDiff=z.diffLines=z.wordsWithSpaceDiff=z.diffWordsWithSpace=z.wordDiff=z.diffWords=z.characterDiff=z.diffChars=z.Diff=void 0;var ok=or();z.Diff=ok.default;var Am=Xp();Object.defineProperty(z,"diffChars",{enumerable:!0,get:function(){return Am.diffChars}});Object.defineProperty(z,"characterDiff",{enumerable:!0,get:function(){return Am.characterDiff}});var ko=am();Object.defineProperty(z,"diffWords",{enumerable:!0,get:function(){return ko.diffWords}});Object.defineProperty(z,"diffWordsWithSpace",{enumerable:!0,get:function(){return ko.diffWordsWithSpace}});Object.defineProperty(z,"wordDiff",{enumerable:!0,get:function(){return ko.wordDiff}});Object.defineProperty(z,"wordsWithSpaceDiff",{enumerable:!0,get:function(){return ko.wordsWithSpaceDiff}});var wc=bo();Object.defineProperty(z,"diffLines",{enumerable:!0,get:function(){return wc.diffLines}});Object.defineProperty(z,"diffTrimmedLines",{enumerable:!0,get:function(){return wc.diffTrimmedLines}});Object.defineProperty(z,"lineDiff",{enumerable:!0,get:function(){return wc.lineDiff}});var Fm=lm();Object.defineProperty(z,"diffSentences",{enumerable:!0,get:function(){return Fm.diffSentences}});Object.defineProperty(z,"sentenceDiff",{enumerable:!0,get:function(){return Fm.sentenceDiff}});var jm=dm();Object.defineProperty(z,"diffCss",{enumerable:!0,get:function(){return jm.diffCss}});Object.defineProperty(z,"cssDiff",{enumerable:!0,get:function(){return jm.cssDiff}});var xc=fm();Object.defineProperty(z,"diffJson",{enumerable:!0,get:function(){return xc.diffJson}});Object.defineProperty(z,"canonicalize",{enumerable:!0,get:function(){return xc.canonicalize}});Object.defineProperty(z,"jsonDiff",{enumerable:!0,get:function(){return xc.jsonDiff}});var Im=hm();Object.defineProperty(z,"diffArrays",{enumerable:!0,get:function(){return Im.diffArrays}});Object.defineProperty(z,"arrayDiff",{enumerable:!0,get:function(){return Im.arrayDiff}});var Tm=bm();Object.defineProperty(z,"applyPatch",{enumerable:!0,get:function(){return Tm.applyPatch}});Object.defineProperty(z,"applyPatches",{enumerable:!0,get:function(){return Tm.applyPatches}});var ik=_c();Object.defineProperty(z,"parsePatch",{enumerable:!0,get:function(){return ik.parsePatch}});var ak=Em();Object.defineProperty(z,"reversePatch",{enumerable:!0,get:function(){return ak.reversePatch}});var nn=xm();Object.defineProperty(z,"structuredPatch",{enumerable:!0,get:function(){return nn.structuredPatch}});Object.defineProperty(z,"createTwoFilesPatch",{enumerable:!0,get:function(){return nn.createTwoFilesPatch}});Object.defineProperty(z,"createPatch",{enumerable:!0,get:function(){return nn.createPatch}});Object.defineProperty(z,"formatPatch",{enumerable:!0,get:function(){return nn.formatPatch}});Object.defineProperty(z,"INCLUDE_HEADERS",{enumerable:!0,get:function(){return nn.INCLUDE_HEADERS}});Object.defineProperty(z,"FILE_HEADERS_ONLY",{enumerable:!0,get:function(){return nn.FILE_HEADERS_ONLY}});Object.defineProperty(z,"OMIT_HEADERS",{enumerable:!0,get:function(){return nn.OMIT_HEADERS}});var ck=km();Object.defineProperty(z,"convertChangesToDMP",{enumerable:!0,get:function(){return ck.convertChangesToDMP}});var uk=$m();Object.defineProperty(z,"convertChangesToXML",{enumerable:!0,get:function(){return uk.convertChangesToXML}})});var $c=v((NI,Pm)=>{"use strict";var kc={to(t,e){return e?`\x1B[${e+1};${t+1}H`:`\x1B[${t+1}G`},move(t,e){let r="";return t<0?r+=`\x1B[${-t}D`:t>0&&(r+=`\x1B[${t}C`),e<0?r+=`\x1B[${-e}A`:e>0&&(r+=`\x1B[${e}B`),r},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},lk={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},dk={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let e="";for(let r=0;r<t;r++)e+=this.line+(r<t-1?kc.up():"");return t&&(e+=kc.left),e}};Pm.exports={cursor:kc,scroll:lk,erase:dk,beep:"\x07"}});var tg=v(bt=>{"use strict";var ot=$c(),jo=require("node:process"),zm=require("node:readline"),fk=require("node:tty"),hk=Nn();function Ym(t){return t&&typeof t=="object"&&"default"in t?t.default:t}function pk(t){if(t&&typeof t=="object"&&"default"in t)return t;let e=Object.create(null);if(t)for(let r in t)e[r]=t[r];return e.default=t,e}var $o=pk(zm),Om=Ym(zm),Fo=Ym(hk);function mk({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")}var gk=mk();function Jm(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(gk,"")}function Xm(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Km={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(n){var s=n.charCodeAt(0),i=n.length==2?n.charCodeAt(1):0,o=s;return 55296<=s&&s<=56319&&56320<=i&&i<=57343&&(s&=1023,i&=1023,o=s<<10|i,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(n){var s=this.eastAsianWidth(n);return s=="F"||s=="W"||s=="A"?2:1};function r(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(n){for(var s=r(n),i=0,o=0;o<s.length;o++)i=i+this.characterLength(s[o]);return i},e.slice=function(n,s,i){textLen=e.length(n),s=s||0,i=i||1,s<0&&(s=textLen+s),i<0&&(i=textLen+i);for(var o="",a=0,c=r(n),u=0;u<c.length;u++){var l=c[u],d=e.length(l);if(a>=s-(d==2?1:0))if(a+d<=i)o+=l;else break;a+=d}return o}})(Km);var Dk=Km.exports,yk=Xm(Dk),vk=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},_k=Xm(vk);function ss(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=Jm(t),t.length===0))return 0;t=t.replace(_k()," ");let r=e.ambiguousIsNarrow?1:2,n=0;for(let s of t){let i=s.codePointAt(0);if(!(i<=31||i>=127&&i<=159||i>=768&&i<=879))switch(yk.eastAsianWidth(s)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var Ac=10,Nm=(t=0)=>e=>`\x1B[${e+t}m`,Lm=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,Bm=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,$e={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($e.modifier);var bk=Object.keys($e.color),Sk=Object.keys($e.bgColor);[...bk,...Sk];function Ek(){let t=new Map;for(let[e,r]of Object.entries($e)){for(let[n,s]of Object.entries(r))$e[n]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},r[n]=$e[n],t.set(s[0],s[1]);Object.defineProperty($e,e,{value:r,enumerable:!1})}return Object.defineProperty($e,"codes",{value:t,enumerable:!1}),$e.color.close="\x1B[39m",$e.bgColor.close="\x1B[49m",$e.color.ansi=Nm(),$e.color.ansi256=Lm(),$e.color.ansi16m=Bm(),$e.bgColor.ansi=Nm(Ac),$e.bgColor.ansi256=Lm(Ac),$e.bgColor.ansi16m=Bm(Ac),Object.defineProperties($e,{rgbToAnsi256:{value:(e,r,n)=>e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:e=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(i=>i+i).join(""));let s=Number.parseInt(n,16);return[s>>16&255,s>>8&255,s&255]},enumerable:!1},hexToAnsi256:{value:e=>$e.rgbToAnsi256(...$e.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let r,n,s;if(e>=232)r=((e-232)*10+8)/255,n=r,s=r;else{e-=16;let a=e%36;r=Math.floor(e/36)/5,n=Math.floor(a/6)/5,s=a%6/5}let i=Math.max(r,n,s)*2;if(i===0)return 30;let o=30+(Math.round(s)<<2|Math.round(n)<<1|Math.round(r));return i===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>$e.ansi256ToAnsi($e.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>$e.ansi256ToAnsi($e.hexToAnsi256(e)),enumerable:!1}}),$e}var Ck=Ek(),Io=new Set(["\x1B","\x9B"]),wk=39,Nc="\x07",Qm="[",xk="]",eg="m",Lc=`${xk}8;;`,Mm=t=>`${Io.values().next().value}${Qm}${t}${eg}`,qm=t=>`${Io.values().next().value}${Lc}${t}${Nc}`,kk=t=>t.split(" ").map(e=>ss(e)),Fc=(t,e,r)=>{let n=[...e],s=!1,i=!1,o=ss(Jm(t[t.length-1]));for(let[a,c]of n.entries()){let u=ss(c);if(o+u<=r?t[t.length-1]+=c:(t.push(c),o=0),Io.has(c)&&(s=!0,i=n.slice(a+1).join("").startsWith(Lc)),s){i?c===Nc&&(s=!1,i=!1):c===eg&&(s=!1);continue}o+=u,o===r&&a<n.length-1&&(t.push(""),o=0)}!o&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},$k=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(ss(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},Ak=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",s,i,o=kk(t),a=[""];for(let[u,l]of t.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let d=ss(a[a.length-1]);if(u!==0&&(d>=e&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),d=0),(d>0||r.trim===!1)&&(a[a.length-1]+=" ",d++)),r.hard&&o[u]>e){let f=e-d,g=1+Math.floor((o[u]-f-1)/e);Math.floor((o[u]-1)/e)<g&&a.push(""),Fc(a,l,e);continue}if(d+o[u]>e&&d>0&&o[u]>0){if(r.wordWrap===!1&&d<e){Fc(a,l,e);continue}a.push("")}if(d+o[u]>e&&r.wordWrap===!1){Fc(a,l,e);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(u=>$k(u)));let c=[...a.join(`
27
+ `)];for(let[u,l]of c.entries()){if(n+=l,Io.has(l)){let{groups:f}=new RegExp(`(?:\\${Qm}(?<code>\\d+)m|\\${Lc}(?<uri>.*)${Nc})`).exec(c.slice(u).join(""))||{groups:{}};if(f.code!==void 0){let g=Number.parseFloat(f.code);s=g===wk?void 0:g}else f.uri!==void 0&&(i=f.uri.length===0?void 0:f.uri)}let d=Ck.codes.get(Number(s));c[u+1]===`
28
+ `?(i&&(n+=qm("")),s&&d&&(n+=Mm(d))):l===`
29
+ `&&(s&&d&&(n+=Mm(s)),i&&(n+=qm(i)))}return n};function Wm(t,e,r){return String(t).normalize().replace(/\r\n/g,`
30
30
  `).split(`
31
- `).map(n=>kk(n,e,r)).join(`
32
- `)}var $k=["up","down","left","right","space","enter","cancel"],An={actions:new Set($k),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function Ak(t){for(let e in t){let r=e;if(!Object.hasOwn(t,r))continue;let n=t[r];switch(r){case"aliases":{for(let s in n)Object.hasOwn(n,s)&&(An.aliases.has(s)||An.aliases.set(s,n[s]));break}}}}function Lu(t,e){if(typeof t=="string")return An.aliases.get(t)===e;for(let r of t)if(r!==void 0&&Lu(r,e))return!0;return!1}function Fk(t,e){if(t===e)return;let r=t.split(`
31
+ `).map(n=>Ak(n,e,r)).join(`
32
+ `)}var Fk=["up","down","left","right","space","enter","cancel"],jn={actions:new Set(Fk),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function jk(t){for(let e in t){let r=e;if(!Object.hasOwn(t,r))continue;let n=t[r];switch(r){case"aliases":{for(let s in n)Object.hasOwn(n,s)&&(jn.aliases.has(s)||jn.aliases.set(s,n[s]));break}}}}function Bc(t,e){if(typeof t=="string")return jn.aliases.get(t)===e;for(let r of t)if(r!==void 0&&Bc(r,e))return!0;return!1}function Ik(t,e){if(t===e)return;let r=t.split(`
33
33
  `),n=e.split(`
34
- `),s=[];for(let i=0;i<Math.max(r.length,n.length);i++)r[i]!==n[i]&&s.push(i);return s}var jk=globalThis.process.platform.startsWith("win"),Fu=Symbol("clack:cancel");function Ik(t){return t===Fu}function $o(t,e){let r=t;r.isTTY&&r.setRawMode(e)}function Tk({input:t=Fo.stdin,output:e=Fo.stdout,overwrite:r=!0,hideCursor:n=!0}={}){let s=ko.createInterface({input:t,output:e,prompt:"",tabSize:1});ko.emitKeypressEvents(t,s),t.isTTY&&t.setRawMode(!0);let i=(o,{name:a,sequence:u})=>{let c=String(o);if(Lu([c,a,u],"cancel")){n&&e.write(nt.cursor.show),process.exit(0);return}if(!r)return;let l=a==="return"?0:-1,d=a==="return"?-1:0;ko.moveCursor(e,l,d,()=>{ko.clearLine(e,1,()=>{t.once("keypress",i)})})};return n&&e.write(nt.cursor.hide),t.once("keypress",i),()=>{t.off("keypress",i),n&&e.write(nt.cursor.show),t.isTTY&&!jk&&t.setRawMode(!1),s.terminal=!1,s.close()}}var Rk=Object.defineProperty,Pk=(t,e,r)=>e in t?Rk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ct=(t,e,r)=>(Pk(t,typeof e!="symbol"?e+"":e,r),r),zt=class{constructor(e,r=!0){ct(this,"input"),ct(this,"output"),ct(this,"_abortSignal"),ct(this,"rl"),ct(this,"opts"),ct(this,"_render"),ct(this,"_track",!1),ct(this,"_prevFrame",""),ct(this,"_subscribers",new Map),ct(this,"_cursor",0),ct(this,"state","initial"),ct(this,"error",""),ct(this,"value");let{input:n=Fo.stdin,output:s=Fo.stdout,render:i,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=i.bind(this),this._track=r,this._abortSignal=o,this.input=n,this.output=s}unsubscribe(){this._subscribers.clear()}setSubscriber(e,r){let n=this._subscribers.get(e)??[];n.push(r),this._subscribers.set(e,n)}on(e,r){this.setSubscriber(e,{cb:r})}once(e,r){this.setSubscriber(e,{cb:r,once:!0})}emit(e,...r){let n=this._subscribers.get(e)??[],s=[];for(let i of n)i.cb(...r),i.once&&s.push(()=>n.splice(n.indexOf(i),1));for(let i of s)i()}prompt(){return new Promise((e,r)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(Fu);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let n=new lk.WriteStream(0);n._write=(s,i,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(n),this.rl=Pm.createInterface({input:this.input,output:n,tabSize:2,prompt:"",escapeCodeTimeout:50}),Pm.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),$o(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(nt.cursor.show),this.output.off("resize",this.render),$o(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(nt.cursor.show),this.output.off("resize",this.render),$o(this.input,!1),e(Fu)})})}onKeypress(e,r){if(this.state==="error"&&(this.state="active"),r?.name&&(!this._track&&An.aliases.has(r.name)&&this.emit("cursor",An.aliases.get(r.name)),An.actions.has(r.name)&&this.emit("cursor",r.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()),r?.name==="return"){if(this.opts.validate){let n=this.opts.validate(this.value);n&&(this.error=n instanceof Error?n.message:n,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}Lu([e,r?.name,r?.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(`
35
- `),$o(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=qm(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
36
- `).length-1;this.output.write(nt.cursor.move(-999,e*-1))}render(){let e=qm(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(nt.cursor.hide);else{let r=Fk(this._prevFrame,e);if(this.restoreCursor(),r&&r?.length===1){let n=r[0];this.output.write(nt.cursor.move(0,n)),this.output.write(nt.erase.lines(1));let s=e.split(`
37
- `);this.output.write(s[n]),this._prevFrame=e,this.output.write(nt.cursor.move(0,s.length-n-1));return}if(r&&r?.length>1){let n=r[0];this.output.write(nt.cursor.move(0,n)),this.output.write(nt.erase.down());let s=e.split(`
34
+ `),s=[];for(let i=0;i<Math.max(r.length,n.length);i++)r[i]!==n[i]&&s.push(i);return s}var Tk=globalThis.process.platform.startsWith("win"),jc=Symbol("clack:cancel");function Rk(t){return t===jc}function Ao(t,e){let r=t;r.isTTY&&r.setRawMode(e)}function Pk({input:t=jo.stdin,output:e=jo.stdout,overwrite:r=!0,hideCursor:n=!0}={}){let s=$o.createInterface({input:t,output:e,prompt:"",tabSize:1});$o.emitKeypressEvents(t,s),t.isTTY&&t.setRawMode(!0);let i=(o,{name:a,sequence:c})=>{let u=String(o);if(Bc([u,a,c],"cancel")){n&&e.write(ot.cursor.show),process.exit(0);return}if(!r)return;let l=a==="return"?0:-1,d=a==="return"?-1:0;$o.moveCursor(e,l,d,()=>{$o.clearLine(e,1,()=>{t.once("keypress",i)})})};return n&&e.write(ot.cursor.hide),t.once("keypress",i),()=>{t.off("keypress",i),n&&e.write(ot.cursor.show),t.isTTY&&!Tk&&t.setRawMode(!1),s.terminal=!1,s.close()}}var Ok=Object.defineProperty,Nk=(t,e,r)=>e in t?Ok(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,lt=(t,e,r)=>(Nk(t,typeof e!="symbol"?e+"":e,r),r),Yt=class{constructor(e,r=!0){lt(this,"input"),lt(this,"output"),lt(this,"_abortSignal"),lt(this,"rl"),lt(this,"opts"),lt(this,"_render"),lt(this,"_track",!1),lt(this,"_prevFrame",""),lt(this,"_subscribers",new Map),lt(this,"_cursor",0),lt(this,"state","initial"),lt(this,"error",""),lt(this,"value");let{input:n=jo.stdin,output:s=jo.stdout,render:i,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=i.bind(this),this._track=r,this._abortSignal=o,this.input=n,this.output=s}unsubscribe(){this._subscribers.clear()}setSubscriber(e,r){let n=this._subscribers.get(e)??[];n.push(r),this._subscribers.set(e,n)}on(e,r){this.setSubscriber(e,{cb:r})}once(e,r){this.setSubscriber(e,{cb:r,once:!0})}emit(e,...r){let n=this._subscribers.get(e)??[],s=[];for(let i of n)i.cb(...r),i.once&&s.push(()=>n.splice(n.indexOf(i),1));for(let i of s)i()}prompt(){return new Promise((e,r)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(jc);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let n=new fk.WriteStream(0);n._write=(s,i,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(n),this.rl=Om.createInterface({input:this.input,output:n,tabSize:2,prompt:"",escapeCodeTimeout:50}),Om.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),Ao(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(ot.cursor.show),this.output.off("resize",this.render),Ao(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(ot.cursor.show),this.output.off("resize",this.render),Ao(this.input,!1),e(jc)})})}onKeypress(e,r){if(this.state==="error"&&(this.state="active"),r?.name&&(!this._track&&jn.aliases.has(r.name)&&this.emit("cursor",jn.aliases.get(r.name)),jn.actions.has(r.name)&&this.emit("cursor",r.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()),r?.name==="return"){if(this.opts.validate){let n=this.opts.validate(this.value);n&&(this.error=n instanceof Error?n.message:n,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}Bc([e,r?.name,r?.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(`
35
+ `),Ao(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=Wm(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
36
+ `).length-1;this.output.write(ot.cursor.move(-999,e*-1))}render(){let e=Wm(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(ot.cursor.hide);else{let r=Ik(this._prevFrame,e);if(this.restoreCursor(),r&&r?.length===1){let n=r[0];this.output.write(ot.cursor.move(0,n)),this.output.write(ot.erase.lines(1));let s=e.split(`
37
+ `);this.output.write(s[n]),this._prevFrame=e,this.output.write(ot.cursor.move(0,s.length-n-1));return}if(r&&r?.length>1){let n=r[0];this.output.write(ot.cursor.move(0,n)),this.output.write(ot.erase.down());let s=e.split(`
38
38
  `).slice(n);this.output.write(s.join(`
39
- `)),this._prevFrame=e;return}this.output.write(nt.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},ju=class extends zt{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",r=>{this.output.write(nt.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}},Ok=Object.defineProperty,Nk=(t,e,r)=>e in t?Ok(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Wm=(t,e,r)=>(Nk(t,typeof e!="symbol"?e+"":e,r),r),Lk=class extends zt{constructor(t){super(t,!1),Wm(this,"options"),Wm(this,"cursor",0);let{options:e}=t;this.options=Object.entries(e).flatMap(([r,n])=>[{value:r,group:!0,label:r},...n.map(s=>({...s,group:r}))]),this.value=[...t.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:r})=>r===t.cursorAt),0),this.on("cursor",r=>{switch(r){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}})}getGroupItems(t){return this.options.filter(e=>e.group===t)}isGroupSelected(t){return this.getGroupItems(t).every(e=>this.value.includes(e.value))}toggleValue(){let t=this.options[this.cursor];if(t.group===!0){let e=t.value,r=this.getGroupItems(e);this.isGroupSelected(e)?this.value=this.value.filter(n=>r.findIndex(s=>s.value===n)===-1):this.value=[...this.value,...r.map(n=>n.value)],this.value=Array.from(new Set(this.value))}else{let e=this.value.includes(t.value);this.value=e?this.value.filter(r=>r!==t.value):[...this.value,t.value]}}},Bk=Object.defineProperty,Mk=(t,e,r)=>e in t?Bk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hm=(t,e,r)=>(Mk(t,typeof e!="symbol"?e+"":e,r),r),qk=class extends zt{constructor(t){super(t,!1),Hm(this,"options"),Hm(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]}},Wk=Object.defineProperty,Hk=(t,e,r)=>e in t?Wk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Zm=(t,e,r)=>(Hk(t,typeof e!="symbol"?e+"":e,r),r),Iu=class extends zt{constructor({mask:e,...r}){super(r),Zm(this,"valueWithCursor",""),Zm(this,"_mask","\u2022"),this._mask=e??"\u2022",this.on("finalize",()=>{this.valueWithCursor=this.masked}),this.on("value",()=>{if(this.cursor>=this.value.length)this.valueWithCursor=`${this.masked}${Ao.inverse(Ao.hidden("_"))}`;else{let n=this.masked.slice(0,this.cursor),s=this.masked.slice(this.cursor);this.valueWithCursor=`${n}${Ao.inverse(s[0])}${s.slice(1)}`}})}get cursor(){return this._cursor}get masked(){return this.value.replaceAll(/./g,this._mask)}},Zk=Object.defineProperty,Uk=(t,e,r)=>e in t?Zk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Um=(t,e,r)=>(Uk(t,typeof e!="symbol"?e+"":e,r),r),Tu=class extends zt{constructor(e){super(e,!1),Um(this,"options"),Um(this,"cursor",0),this.options=e.options,this.cursor=this.options.findIndex(({value:r})=>r===e.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",r=>{switch(r){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}},Vk=Object.defineProperty,Gk=(t,e,r)=>e in t?Vk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Vm=(t,e,r)=>(Gk(t,typeof e!="symbol"?e+"":e,r),r),Ru=class extends zt{constructor(e){super(e,!1),Vm(this,"options"),Vm(this,"cursor",0),this.options=e.options;let r=this.options.map(({value:[n]})=>n?.toLowerCase());this.cursor=Math.max(r.indexOf(e.initialValue),0),this.on("key",n=>{if(!r.includes(n))return;let s=this.options.find(({value:[i]})=>i?.toLowerCase()===n);s&&(this.value=s.value,this.state="submit",this.emit("submit"))})}},Pu=class extends zt{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),[r,...n]=this.value.slice(this.cursor);return`${e}${Ao.inverse(r)}${n.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};_t.ConfirmPrompt=ju,_t.GroupMultiSelectPrompt=Lk,_t.MultiSelectPrompt=qk,_t.PasswordPrompt=Iu,_t.Prompt=zt,_t.SelectKeyPrompt=Ru,_t.SelectPrompt=Tu,_t.TextPrompt=Pu,_t.block=Tk,_t.isCancel=Ik,_t.updateSettings=Ak});var Uu=v(Te=>{"use strict";var Bu=require("node:util"),jt=eg(),zk=require("node:process"),Yk=Pn(),tg=ku();function ng(t){return t&&typeof t=="object"&&"default"in t?t.default:t}var Ft=ng(zk),_=ng(Yk);function Jk(){return Ft.platform!=="win32"?Ft.env.TERM!=="linux":!!Ft.env.CI||!!Ft.env.WT_SESSION||!!Ft.env.TERMINUS_SUBLIME||Ft.env.ConEmuTask==="{cmd::Cmder}"||Ft.env.TERM_PROGRAM==="Terminus-Sublime"||Ft.env.TERM_PROGRAM==="vscode"||Ft.env.TERM==="xterm-256color"||Ft.env.TERM==="alacritty"||Ft.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Mu=Jk(),Fe=(t,e)=>Mu?t:e,Xk=Fe("\u25C6","*"),sg=Fe("\u25A0","x"),og=Fe("\u25B2","x"),Io=Fe("\u25C7","o"),Kk=Fe("\u250C","T"),te=Fe("\u2502","|"),st=Fe("\u2514","\u2014"),qu=Fe("\u25CF",">"),Wu=Fe("\u25CB"," "),Hu=Fe("\u25FB","[\u2022]"),ns=Fe("\u25FC","[+]"),ig=Fe("\u25FB","[ ]"),Qk=Fe("\u25AA","\u2022"),rg=Fe("\u2500","-"),e$=Fe("\u256E","+"),t$=Fe("\u251C","+"),r$=Fe("\u256F","+"),n$=Fe("\u25CF","\u2022"),s$=Fe("\u25C6","*"),o$=Fe("\u25B2","!"),i$=Fe("\u25A0","x"),nn=t=>{switch(t){case"initial":case"active":return _.cyan(Xk);case"cancel":return _.red(sg);case"error":return _.yellow(og);case"submit":return _.green(Io)}},Zu=t=>{let{cursor:e,options:r,style:n}=t,s=t.maxItems??Number.POSITIVE_INFINITY,i=Math.max(process.stdout.rows-4,0),o=Math.min(i,Math.max(s,5)),a=0;e>=a+o-3?a=Math.max(Math.min(e-o+3,r.length-o),0):e<a+2&&(a=Math.max(e-2,0));let u=o<r.length&&a>0,c=o<r.length&&a+o<r.length;return r.slice(a,a+o).map((l,d,f)=>{let g=d===0&&u,m=d===f.length-1&&c;return g||m?_.dim("..."):n(l,d+a===e)})},a$=t=>new jt.TextPrompt({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${_.gray(te)}
40
- ${nn(this.state)} ${t.message}
39
+ `)),this._prevFrame=e;return}this.output.write(ot.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},Ic=class extends Yt{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",r=>{this.output.write(ot.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}},Lk=Object.defineProperty,Bk=(t,e,r)=>e in t?Lk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hm=(t,e,r)=>(Bk(t,typeof e!="symbol"?e+"":e,r),r),Mk=class extends Yt{constructor(t){super(t,!1),Hm(this,"options"),Hm(this,"cursor",0);let{options:e}=t;this.options=Object.entries(e).flatMap(([r,n])=>[{value:r,group:!0,label:r},...n.map(s=>({...s,group:r}))]),this.value=[...t.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:r})=>r===t.cursorAt),0),this.on("cursor",r=>{switch(r){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}})}getGroupItems(t){return this.options.filter(e=>e.group===t)}isGroupSelected(t){return this.getGroupItems(t).every(e=>this.value.includes(e.value))}toggleValue(){let t=this.options[this.cursor];if(t.group===!0){let e=t.value,r=this.getGroupItems(e);this.isGroupSelected(e)?this.value=this.value.filter(n=>r.findIndex(s=>s.value===n)===-1):this.value=[...this.value,...r.map(n=>n.value)],this.value=Array.from(new Set(this.value))}else{let e=this.value.includes(t.value);this.value=e?this.value.filter(r=>r!==t.value):[...this.value,t.value]}}},qk=Object.defineProperty,Wk=(t,e,r)=>e in t?qk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Zm=(t,e,r)=>(Wk(t,typeof e!="symbol"?e+"":e,r),r),Hk=class extends Yt{constructor(t){super(t,!1),Zm(this,"options"),Zm(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]}},Zk=Object.defineProperty,Uk=(t,e,r)=>e in t?Zk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Um=(t,e,r)=>(Uk(t,typeof e!="symbol"?e+"":e,r),r),Tc=class extends Yt{constructor({mask:e,...r}){super(r),Um(this,"valueWithCursor",""),Um(this,"_mask","\u2022"),this._mask=e??"\u2022",this.on("finalize",()=>{this.valueWithCursor=this.masked}),this.on("value",()=>{if(this.cursor>=this.value.length)this.valueWithCursor=`${this.masked}${Fo.inverse(Fo.hidden("_"))}`;else{let n=this.masked.slice(0,this.cursor),s=this.masked.slice(this.cursor);this.valueWithCursor=`${n}${Fo.inverse(s[0])}${s.slice(1)}`}})}get cursor(){return this._cursor}get masked(){return this.value.replaceAll(/./g,this._mask)}},Vk=Object.defineProperty,Gk=(t,e,r)=>e in t?Vk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Vm=(t,e,r)=>(Gk(t,typeof e!="symbol"?e+"":e,r),r),Rc=class extends Yt{constructor(e){super(e,!1),Vm(this,"options"),Vm(this,"cursor",0),this.options=e.options,this.cursor=this.options.findIndex(({value:r})=>r===e.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",r=>{switch(r){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}},zk=Object.defineProperty,Yk=(t,e,r)=>e in t?zk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Gm=(t,e,r)=>(Yk(t,typeof e!="symbol"?e+"":e,r),r),Pc=class extends Yt{constructor(e){super(e,!1),Gm(this,"options"),Gm(this,"cursor",0),this.options=e.options;let r=this.options.map(({value:[n]})=>n?.toLowerCase());this.cursor=Math.max(r.indexOf(e.initialValue),0),this.on("key",n=>{if(!r.includes(n))return;let s=this.options.find(({value:[i]})=>i?.toLowerCase()===n);s&&(this.value=s.value,this.state="submit",this.emit("submit"))})}},Oc=class extends Yt{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),[r,...n]=this.value.slice(this.cursor);return`${e}${Fo.inverse(r)}${n.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};bt.ConfirmPrompt=Ic,bt.GroupMultiSelectPrompt=Mk,bt.MultiSelectPrompt=Hk,bt.PasswordPrompt=Tc,bt.Prompt=Yt,bt.SelectKeyPrompt=Pc,bt.SelectPrompt=Rc,bt.TextPrompt=Oc,bt.block=Pk,bt.isCancel=Rk,bt.updateSettings=jk});var Vc=v(Re=>{"use strict";var Mc=require("node:util"),It=tg(),Jk=require("node:process"),Xk=Nn(),rg=$c();function sg(t){return t&&typeof t=="object"&&"default"in t?t.default:t}var jt=sg(Jk),_=sg(Xk);function Kk(){return jt.platform!=="win32"?jt.env.TERM!=="linux":!!jt.env.CI||!!jt.env.WT_SESSION||!!jt.env.TERMINUS_SUBLIME||jt.env.ConEmuTask==="{cmd::Cmder}"||jt.env.TERM_PROGRAM==="Terminus-Sublime"||jt.env.TERM_PROGRAM==="vscode"||jt.env.TERM==="xterm-256color"||jt.env.TERM==="alacritty"||jt.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var qc=Kk(),je=(t,e)=>qc?t:e,Qk=je("\u25C6","*"),og=je("\u25A0","x"),ig=je("\u25B2","x"),To=je("\u25C7","o"),e$=je("\u250C","T"),ee=je("\u2502","|"),it=je("\u2514","\u2014"),Wc=je("\u25CF",">"),Hc=je("\u25CB"," "),Zc=je("\u25FB","[\u2022]"),os=je("\u25FC","[+]"),ag=je("\u25FB","[ ]"),t$=je("\u25AA","\u2022"),ng=je("\u2500","-"),r$=je("\u256E","+"),n$=je("\u251C","+"),s$=je("\u256F","+"),o$=je("\u25CF","\u2022"),i$=je("\u25C6","*"),a$=je("\u25B2","!"),c$=je("\u25A0","x"),on=t=>{switch(t){case"initial":case"active":return _.cyan(Qk);case"cancel":return _.red(og);case"error":return _.yellow(ig);case"submit":return _.green(To)}},Uc=t=>{let{cursor:e,options:r,style:n}=t,s=t.maxItems??Number.POSITIVE_INFINITY,i=Math.max(process.stdout.rows-4,0),o=Math.min(i,Math.max(s,5)),a=0;e>=a+o-3?a=Math.max(Math.min(e-o+3,r.length-o),0):e<a+2&&(a=Math.max(e-2,0));let c=o<r.length&&a>0,u=o<r.length&&a+o<r.length;return r.slice(a,a+o).map((l,d,f)=>{let g=d===0&&c,m=d===f.length-1&&u;return g||m?_.dim("..."):n(l,d+a===e)})},u$=t=>new It.TextPrompt({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${_.gray(ee)}
40
+ ${on(this.state)} ${t.message}
41
41
  `,r=t.placeholder?_.inverse(t.placeholder[0])+_.dim(t.placeholder.slice(1)):_.inverse(_.hidden("_")),n=this.value?this.valueWithCursor:r;switch(this.state){case"error":return`${e.trim()}
42
- ${_.yellow(te)} ${n}
43
- ${_.yellow(st)} ${_.yellow(this.error)}
44
- `;case"submit":return`${e}${_.gray(te)} ${_.dim(this.value||t.placeholder)}`;case"cancel":return`${e}${_.gray(te)} ${_.strikethrough(_.dim(this.value??""))}${this.value?.trim()?`
45
- ${_.gray(te)}`:""}`;default:return`${e}${_.cyan(te)} ${n}
46
- ${_.cyan(st)}
47
- `}}}).prompt(),u$=t=>new jt.PasswordPrompt({validate:t.validate,mask:t.mask??Qk,render(){let e=`${_.gray(te)}
48
- ${nn(this.state)} ${t.message}
42
+ ${_.yellow(ee)} ${n}
43
+ ${_.yellow(it)} ${_.yellow(this.error)}
44
+ `;case"submit":return`${e}${_.gray(ee)} ${_.dim(this.value||t.placeholder)}`;case"cancel":return`${e}${_.gray(ee)} ${_.strikethrough(_.dim(this.value??""))}${this.value?.trim()?`
45
+ ${_.gray(ee)}`:""}`;default:return`${e}${_.cyan(ee)} ${n}
46
+ ${_.cyan(it)}
47
+ `}}}).prompt(),l$=t=>new It.PasswordPrompt({validate:t.validate,mask:t.mask??t$,render(){let e=`${_.gray(ee)}
48
+ ${on(this.state)} ${t.message}
49
49
  `,r=this.valueWithCursor,n=this.masked;switch(this.state){case"error":return`${e.trim()}
50
- ${_.yellow(te)} ${n}
51
- ${_.yellow(st)} ${_.yellow(this.error)}
52
- `;case"submit":return`${e}${_.gray(te)} ${_.dim(n)}`;case"cancel":return`${e}${_.gray(te)} ${_.strikethrough(_.dim(n??""))}${n?`
53
- ${_.gray(te)}`:""}`;default:return`${e}${_.cyan(te)} ${r}
54
- ${_.cyan(st)}
55
- `}}}).prompt(),c$=t=>{let e=t.active??"Yes",r=t.inactive??"No";return new jt.ConfirmPrompt({active:e,inactive:r,initialValue:t.initialValue??!0,render(){let n=`${_.gray(te)}
56
- ${nn(this.state)} ${t.message}
57
- `,s=this.value?e:r;switch(this.state){case"submit":return`${n}${_.gray(te)} ${_.dim(s)}`;case"cancel":return`${n}${_.gray(te)} ${_.strikethrough(_.dim(s))}
58
- ${_.gray(te)}`;default:return`${n}${_.cyan(te)} ${this.value?`${_.green(qu)} ${e}`:`${_.dim(Wu)} ${_.dim(e)}`} ${_.dim("/")} ${this.value?`${_.dim(Wu)} ${_.dim(r)}`:`${_.green(qu)} ${r}`}
59
- ${_.cyan(st)}
60
- `}}}).prompt()},l$=t=>{let e=(r,n)=>{let s=r.label??String(r.value);switch(n){case"selected":return`${_.dim(s)}`;case"active":return`${_.green(qu)} ${s} ${r.hint?_.dim(`(${r.hint})`):""}`;case"cancelled":return`${_.strikethrough(_.dim(s))}`;default:return`${_.dim(Wu)} ${_.dim(s)}`}};return new jt.SelectPrompt({options:t.options,initialValue:t.initialValue,render(){let r=`${_.gray(te)}
61
- ${nn(this.state)} ${t.message}
62
- `;switch(this.state){case"submit":return`${r}${_.gray(te)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${r}${_.gray(te)} ${e(this.options[this.cursor],"cancelled")}
63
- ${_.gray(te)}`;default:return`${r}${_.cyan(te)} ${Zu({cursor:this.cursor,options:this.options,maxItems:t.maxItems,style:(n,s)=>e(n,s?"active":"inactive")}).join(`
64
- ${_.cyan(te)} `)}
65
- ${_.cyan(st)}
66
- `}}}).prompt()},d$=t=>{let e=(r,n="inactive")=>{let s=r.label??String(r.value);return n==="selected"?`${_.dim(s)}`:n==="cancelled"?`${_.strikethrough(_.dim(s))}`:n==="active"?`${_.bgCyan(_.gray(` ${r.value} `))} ${s} ${r.hint?_.dim(`(${r.hint})`):""}`:`${_.gray(_.bgWhite(_.inverse(` ${r.value} `)))} ${s} ${r.hint?_.dim(`(${r.hint})`):""}`};return new jt.SelectKeyPrompt({options:t.options,initialValue:t.initialValue,render(){let r=`${_.gray(te)}
67
- ${nn(this.state)} ${t.message}
68
- `;switch(this.state){case"submit":return`${r}${_.gray(te)} ${e(this.options.find(n=>n.value===this.value)??t.options[0],"selected")}`;case"cancel":return`${r}${_.gray(te)} ${e(this.options[0],"cancelled")}
69
- ${_.gray(te)}`;default:return`${r}${_.cyan(te)} ${this.options.map((n,s)=>e(n,s===this.cursor?"active":"inactive")).join(`
70
- ${_.cyan(te)} `)}
71
- ${_.cyan(st)}
72
- `}}}).prompt()},f$=t=>{let e=(r,n)=>{let s=r.label??String(r.value);return n==="active"?`${_.cyan(Hu)} ${s} ${r.hint?_.dim(`(${r.hint})`):""}`:n==="selected"?`${_.green(ns)} ${_.dim(s)}`:n==="cancelled"?`${_.strikethrough(_.dim(s))}`:n==="active-selected"?`${_.green(ns)} ${s} ${r.hint?_.dim(`(${r.hint})`):""}`:n==="submitted"?`${_.dim(s)}`:`${_.dim(ig)} ${_.dim(s)}`};return new jt.MultiSelectPrompt({options:t.options,initialValues:t.initialValues,required:t.required??!0,cursorAt:t.cursorAt,validate(r){if(this.required&&r.length===0)return`Please select at least one option.
73
- ${_.reset(_.dim(`Press ${_.gray(_.bgWhite(_.inverse(" space ")))} to select, ${_.gray(_.bgWhite(_.inverse(" enter ")))} to submit`))}`},render(){let r=`${_.gray(te)}
74
- ${nn(this.state)} ${t.message}
75
- `,n=(s,i)=>{let o=this.value.includes(s.value);return i&&o?e(s,"active-selected"):o?e(s,"selected"):e(s,i?"active":"inactive")};switch(this.state){case"submit":return`${r}${_.gray(te)} ${this.options.filter(({value:s})=>this.value.includes(s)).map(s=>e(s,"submitted")).join(_.dim(", "))||_.dim("none")}`;case"cancel":{let s=this.options.filter(({value:i})=>this.value.includes(i)).map(i=>e(i,"cancelled")).join(_.dim(", "));return`${r}${_.gray(te)} ${s.trim()?`${s}
76
- ${_.gray(te)}`:""}`}case"error":{let s=this.error.split(`
77
- `).map((i,o)=>o===0?`${_.yellow(st)} ${_.yellow(i)}`:` ${i}`).join(`
78
- `);return`${r+_.yellow(te)} ${Zu({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:n}).join(`
79
- ${_.yellow(te)} `)}
50
+ ${_.yellow(ee)} ${n}
51
+ ${_.yellow(it)} ${_.yellow(this.error)}
52
+ `;case"submit":return`${e}${_.gray(ee)} ${_.dim(n)}`;case"cancel":return`${e}${_.gray(ee)} ${_.strikethrough(_.dim(n??""))}${n?`
53
+ ${_.gray(ee)}`:""}`;default:return`${e}${_.cyan(ee)} ${r}
54
+ ${_.cyan(it)}
55
+ `}}}).prompt(),d$=t=>{let e=t.active??"Yes",r=t.inactive??"No";return new It.ConfirmPrompt({active:e,inactive:r,initialValue:t.initialValue??!0,render(){let n=`${_.gray(ee)}
56
+ ${on(this.state)} ${t.message}
57
+ `,s=this.value?e:r;switch(this.state){case"submit":return`${n}${_.gray(ee)} ${_.dim(s)}`;case"cancel":return`${n}${_.gray(ee)} ${_.strikethrough(_.dim(s))}
58
+ ${_.gray(ee)}`;default:return`${n}${_.cyan(ee)} ${this.value?`${_.green(Wc)} ${e}`:`${_.dim(Hc)} ${_.dim(e)}`} ${_.dim("/")} ${this.value?`${_.dim(Hc)} ${_.dim(r)}`:`${_.green(Wc)} ${r}`}
59
+ ${_.cyan(it)}
60
+ `}}}).prompt()},f$=t=>{let e=(r,n)=>{let s=r.label??String(r.value);switch(n){case"selected":return`${_.dim(s)}`;case"active":return`${_.green(Wc)} ${s} ${r.hint?_.dim(`(${r.hint})`):""}`;case"cancelled":return`${_.strikethrough(_.dim(s))}`;default:return`${_.dim(Hc)} ${_.dim(s)}`}};return new It.SelectPrompt({options:t.options,initialValue:t.initialValue,render(){let r=`${_.gray(ee)}
61
+ ${on(this.state)} ${t.message}
62
+ `;switch(this.state){case"submit":return`${r}${_.gray(ee)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${r}${_.gray(ee)} ${e(this.options[this.cursor],"cancelled")}
63
+ ${_.gray(ee)}`;default:return`${r}${_.cyan(ee)} ${Uc({cursor:this.cursor,options:this.options,maxItems:t.maxItems,style:(n,s)=>e(n,s?"active":"inactive")}).join(`
64
+ ${_.cyan(ee)} `)}
65
+ ${_.cyan(it)}
66
+ `}}}).prompt()},h$=t=>{let e=(r,n="inactive")=>{let s=r.label??String(r.value);return n==="selected"?`${_.dim(s)}`:n==="cancelled"?`${_.strikethrough(_.dim(s))}`:n==="active"?`${_.bgCyan(_.gray(` ${r.value} `))} ${s} ${r.hint?_.dim(`(${r.hint})`):""}`:`${_.gray(_.bgWhite(_.inverse(` ${r.value} `)))} ${s} ${r.hint?_.dim(`(${r.hint})`):""}`};return new It.SelectKeyPrompt({options:t.options,initialValue:t.initialValue,render(){let r=`${_.gray(ee)}
67
+ ${on(this.state)} ${t.message}
68
+ `;switch(this.state){case"submit":return`${r}${_.gray(ee)} ${e(this.options.find(n=>n.value===this.value)??t.options[0],"selected")}`;case"cancel":return`${r}${_.gray(ee)} ${e(this.options[0],"cancelled")}
69
+ ${_.gray(ee)}`;default:return`${r}${_.cyan(ee)} ${this.options.map((n,s)=>e(n,s===this.cursor?"active":"inactive")).join(`
70
+ ${_.cyan(ee)} `)}
71
+ ${_.cyan(it)}
72
+ `}}}).prompt()},p$=t=>{let e=(r,n)=>{let s=r.label??String(r.value);return n==="active"?`${_.cyan(Zc)} ${s} ${r.hint?_.dim(`(${r.hint})`):""}`:n==="selected"?`${_.green(os)} ${_.dim(s)}`:n==="cancelled"?`${_.strikethrough(_.dim(s))}`:n==="active-selected"?`${_.green(os)} ${s} ${r.hint?_.dim(`(${r.hint})`):""}`:n==="submitted"?`${_.dim(s)}`:`${_.dim(ag)} ${_.dim(s)}`};return new It.MultiSelectPrompt({options:t.options,initialValues:t.initialValues,required:t.required??!0,cursorAt:t.cursorAt,validate(r){if(this.required&&r.length===0)return`Please select at least one option.
73
+ ${_.reset(_.dim(`Press ${_.gray(_.bgWhite(_.inverse(" space ")))} to select, ${_.gray(_.bgWhite(_.inverse(" enter ")))} to submit`))}`},render(){let r=`${_.gray(ee)}
74
+ ${on(this.state)} ${t.message}
75
+ `,n=(s,i)=>{let o=this.value.includes(s.value);return i&&o?e(s,"active-selected"):o?e(s,"selected"):e(s,i?"active":"inactive")};switch(this.state){case"submit":return`${r}${_.gray(ee)} ${this.options.filter(({value:s})=>this.value.includes(s)).map(s=>e(s,"submitted")).join(_.dim(", "))||_.dim("none")}`;case"cancel":{let s=this.options.filter(({value:i})=>this.value.includes(i)).map(i=>e(i,"cancelled")).join(_.dim(", "));return`${r}${_.gray(ee)} ${s.trim()?`${s}
76
+ ${_.gray(ee)}`:""}`}case"error":{let s=this.error.split(`
77
+ `).map((i,o)=>o===0?`${_.yellow(it)} ${_.yellow(i)}`:` ${i}`).join(`
78
+ `);return`${r+_.yellow(ee)} ${Uc({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:n}).join(`
79
+ ${_.yellow(ee)} `)}
80
80
  ${s}
81
- `}default:return`${r}${_.cyan(te)} ${Zu({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:n}).join(`
82
- ${_.cyan(te)} `)}
83
- ${_.cyan(st)}
84
- `}}}).prompt()},h$=t=>{let e=(r,n,s=[])=>{let i=r.label??String(r.value),o=typeof r.group=="string",a=o&&(s[s.indexOf(r)+1]??{group:!0}),u=o&&a.group===!0,c=o?`${u?st:te} `:"";return n==="active"?`${_.dim(c)}${_.cyan(Hu)} ${i} ${r.hint?_.dim(`(${r.hint})`):""}`:n==="group-active"?`${c}${_.cyan(Hu)} ${_.dim(i)}`:n==="group-active-selected"?`${c}${_.green(ns)} ${_.dim(i)}`:n==="selected"?`${_.dim(c)}${_.green(ns)} ${_.dim(i)}`:n==="cancelled"?`${_.strikethrough(_.dim(i))}`:n==="active-selected"?`${_.dim(c)}${_.green(ns)} ${i} ${r.hint?_.dim(`(${r.hint})`):""}`:n==="submitted"?`${_.dim(i)}`:`${_.dim(c)}${_.dim(ig)} ${_.dim(i)}`};return new jt.GroupMultiSelectPrompt({options:t.options,initialValues:t.initialValues,required:t.required??!0,cursorAt:t.cursorAt,validate(r){if(this.required&&r.length===0)return`Please select at least one option.
85
- ${_.reset(_.dim(`Press ${_.gray(_.bgWhite(_.inverse(" space ")))} to select, ${_.gray(_.bgWhite(_.inverse(" enter ")))} to submit`))}`},render(){let r=`${_.gray(te)}
86
- ${nn(this.state)} ${t.message}
87
- `;switch(this.state){case"submit":return`${r}${_.gray(te)} ${this.options.filter(({value:n})=>this.value.includes(n)).map(n=>e(n,"submitted")).join(_.dim(", "))}`;case"cancel":{let n=this.options.filter(({value:s})=>this.value.includes(s)).map(s=>e(s,"cancelled")).join(_.dim(", "));return`${r}${_.gray(te)} ${n.trim()?`${n}
88
- ${_.gray(te)}`:""}`}case"error":{let n=this.error.split(`
89
- `).map((s,i)=>i===0?`${_.yellow(st)} ${_.yellow(s)}`:` ${s}`).join(`
90
- `);return`${r}${_.yellow(te)} ${this.options.map((s,i,o)=>{let a=this.value.includes(s.value)||s.group===!0&&this.isGroupSelected(`${s.value}`),u=i===this.cursor;return!u&&typeof s.group=="string"&&this.options[this.cursor].value===s.group?e(s,a?"group-active-selected":"group-active",o):u&&a?e(s,"active-selected",o):a?e(s,"selected",o):e(s,u?"active":"inactive",o)}).join(`
91
- ${_.yellow(te)} `)}
81
+ `}default:return`${r}${_.cyan(ee)} ${Uc({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:n}).join(`
82
+ ${_.cyan(ee)} `)}
83
+ ${_.cyan(it)}
84
+ `}}}).prompt()},m$=t=>{let e=(r,n,s=[])=>{let i=r.label??String(r.value),o=typeof r.group=="string",a=o&&(s[s.indexOf(r)+1]??{group:!0}),c=o&&a.group===!0,u=o?`${c?it:ee} `:"";return n==="active"?`${_.dim(u)}${_.cyan(Zc)} ${i} ${r.hint?_.dim(`(${r.hint})`):""}`:n==="group-active"?`${u}${_.cyan(Zc)} ${_.dim(i)}`:n==="group-active-selected"?`${u}${_.green(os)} ${_.dim(i)}`:n==="selected"?`${_.dim(u)}${_.green(os)} ${_.dim(i)}`:n==="cancelled"?`${_.strikethrough(_.dim(i))}`:n==="active-selected"?`${_.dim(u)}${_.green(os)} ${i} ${r.hint?_.dim(`(${r.hint})`):""}`:n==="submitted"?`${_.dim(i)}`:`${_.dim(u)}${_.dim(ag)} ${_.dim(i)}`};return new It.GroupMultiSelectPrompt({options:t.options,initialValues:t.initialValues,required:t.required??!0,cursorAt:t.cursorAt,validate(r){if(this.required&&r.length===0)return`Please select at least one option.
85
+ ${_.reset(_.dim(`Press ${_.gray(_.bgWhite(_.inverse(" space ")))} to select, ${_.gray(_.bgWhite(_.inverse(" enter ")))} to submit`))}`},render(){let r=`${_.gray(ee)}
86
+ ${on(this.state)} ${t.message}
87
+ `;switch(this.state){case"submit":return`${r}${_.gray(ee)} ${this.options.filter(({value:n})=>this.value.includes(n)).map(n=>e(n,"submitted")).join(_.dim(", "))}`;case"cancel":{let n=this.options.filter(({value:s})=>this.value.includes(s)).map(s=>e(s,"cancelled")).join(_.dim(", "));return`${r}${_.gray(ee)} ${n.trim()?`${n}
88
+ ${_.gray(ee)}`:""}`}case"error":{let n=this.error.split(`
89
+ `).map((s,i)=>i===0?`${_.yellow(it)} ${_.yellow(s)}`:` ${s}`).join(`
90
+ `);return`${r}${_.yellow(ee)} ${this.options.map((s,i,o)=>{let a=this.value.includes(s.value)||s.group===!0&&this.isGroupSelected(`${s.value}`),c=i===this.cursor;return!c&&typeof s.group=="string"&&this.options[this.cursor].value===s.group?e(s,a?"group-active-selected":"group-active",o):c&&a?e(s,"active-selected",o):a?e(s,"selected",o):e(s,c?"active":"inactive",o)}).join(`
91
+ ${_.yellow(ee)} `)}
92
92
  ${n}
93
- `}default:return`${r}${_.cyan(te)} ${this.options.map((n,s,i)=>{let o=this.value.includes(n.value)||n.group===!0&&this.isGroupSelected(`${n.value}`),a=s===this.cursor;return!a&&typeof n.group=="string"&&this.options[this.cursor].value===n.group?e(n,o?"group-active-selected":"group-active",i):a&&o?e(n,"active-selected",i):o?e(n,"selected",i):e(n,a?"active":"inactive",i)}).join(`
94
- ${_.cyan(te)} `)}
95
- ${_.cyan(st)}
96
- `}}}).prompt()},p$=(t="",e="")=>{let r=`
93
+ `}default:return`${r}${_.cyan(ee)} ${this.options.map((n,s,i)=>{let o=this.value.includes(n.value)||n.group===!0&&this.isGroupSelected(`${n.value}`),a=s===this.cursor;return!a&&typeof n.group=="string"&&this.options[this.cursor].value===n.group?e(n,o?"group-active-selected":"group-active",i):a&&o?e(n,"active-selected",i):o?e(n,"selected",i):e(n,a?"active":"inactive",i)}).join(`
94
+ ${_.cyan(ee)} `)}
95
+ ${_.cyan(it)}
96
+ `}}}).prompt()},g$=(t="",e="")=>{let r=`
97
97
  ${t}
98
98
  `.split(`
99
- `),n=Bu.stripVTControlCharacters(e).length,s=Math.max(r.reduce((o,a)=>{let u=Bu.stripVTControlCharacters(a);return u.length>o?u.length:o},0),n)+2,i=r.map(o=>`${_.gray(te)} ${_.dim(o)}${" ".repeat(s-Bu.stripVTControlCharacters(o).length)}${_.gray(te)}`).join(`
100
- `);process.stdout.write(`${_.gray(te)}
101
- ${_.green(Io)} ${_.reset(e)} ${_.gray(rg.repeat(Math.max(s-n-1,1))+e$)}
99
+ `),n=Mc.stripVTControlCharacters(e).length,s=Math.max(r.reduce((o,a)=>{let c=Mc.stripVTControlCharacters(a);return c.length>o?c.length:o},0),n)+2,i=r.map(o=>`${_.gray(ee)} ${_.dim(o)}${" ".repeat(s-Mc.stripVTControlCharacters(o).length)}${_.gray(ee)}`).join(`
100
+ `);process.stdout.write(`${_.gray(ee)}
101
+ ${_.green(To)} ${_.reset(e)} ${_.gray(ng.repeat(Math.max(s-n-1,1))+r$)}
102
102
  ${i}
103
- ${_.gray(t$+rg.repeat(s+2)+r$)}
104
- `)},m$=(t="")=>{process.stdout.write(`${_.gray(st)} ${_.red(t)}
103
+ ${_.gray(n$+ng.repeat(s+2)+s$)}
104
+ `)},D$=(t="")=>{process.stdout.write(`${_.gray(it)} ${_.red(t)}
105
105
 
106
- `)},g$=(t="")=>{process.stdout.write(`${_.gray(Kk)} ${t}
107
- `)},D$=(t="")=>{process.stdout.write(`${_.gray(te)}
108
- ${_.gray(st)} ${t}
106
+ `)},y$=(t="")=>{process.stdout.write(`${_.gray(e$)} ${t}
107
+ `)},v$=(t="")=>{process.stdout.write(`${_.gray(ee)}
108
+ ${_.gray(it)} ${t}
109
109
 
110
- `)},rn={message:(t="",{symbol:e=_.gray(te)}={})=>{let r=[`${_.gray(te)}`];if(t){let[n,...s]=t.split(`
111
- `);r.push(`${e} ${n}`,...s.map(i=>`${_.gray(te)} ${i}`))}process.stdout.write(`${r.join(`
110
+ `)},sn={message:(t="",{symbol:e=_.gray(ee)}={})=>{let r=[`${_.gray(ee)}`];if(t){let[n,...s]=t.split(`
111
+ `);r.push(`${e} ${n}`,...s.map(i=>`${_.gray(ee)} ${i}`))}process.stdout.write(`${r.join(`
112
112
  `)}
113
- `)},info:t=>{rn.message(t,{symbol:_.blue(n$)})},success:t=>{rn.message(t,{symbol:_.green(s$)})},step:t=>{rn.message(t,{symbol:_.green(Io)})},warn:t=>{rn.message(t,{symbol:_.yellow(o$)})},warning:t=>{rn.warn(t)},error:t=>{rn.message(t,{symbol:_.red(i$)})}},ag=()=>{let t=Mu?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],e=Mu?80:120,r=process.env.CI==="true",n,s,i=!1,o="",a,u=w=>{let C=w>1?"Something went wrong":"Canceled";i&&h(C,w)},c=()=>u(2),l=()=>u(1),d=()=>{process.on("uncaughtExceptionMonitor",c),process.on("unhandledRejection",c),process.on("SIGINT",l),process.on("SIGTERM",l),process.on("exit",u)},f=()=>{process.removeListener("uncaughtExceptionMonitor",c),process.removeListener("unhandledRejection",c),process.removeListener("SIGINT",l),process.removeListener("SIGTERM",l),process.removeListener("exit",u)},g=()=>{if(a===void 0)return;r&&process.stdout.write(`
113
+ `)},info:t=>{sn.message(t,{symbol:_.blue(o$)})},success:t=>{sn.message(t,{symbol:_.green(i$)})},step:t=>{sn.message(t,{symbol:_.green(To)})},warn:t=>{sn.message(t,{symbol:_.yellow(a$)})},warning:t=>{sn.warn(t)},error:t=>{sn.message(t,{symbol:_.red(c$)})}},cg=()=>{let t=qc?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],e=qc?80:120,r=process.env.CI==="true",n,s,i=!1,o="",a,c=w=>{let C=w>1?"Something went wrong":"Canceled";i&&h(C,w)},u=()=>c(2),l=()=>c(1),d=()=>{process.on("uncaughtExceptionMonitor",u),process.on("unhandledRejection",u),process.on("SIGINT",l),process.on("SIGTERM",l),process.on("exit",c)},f=()=>{process.removeListener("uncaughtExceptionMonitor",u),process.removeListener("unhandledRejection",u),process.removeListener("SIGINT",l),process.removeListener("SIGTERM",l),process.removeListener("exit",c)},g=()=>{if(a===void 0)return;r&&process.stdout.write(`
114
114
  `);let w=a.split(`
115
- `);process.stdout.write(tg.cursor.move(-999,w.length-1)),process.stdout.write(tg.erase.down(w.length))},m=w=>w.replace(/\.+$/,""),y=(w="")=>{i=!0,n=jt.block(),o=m(w),process.stdout.write(`${_.gray(te)}
116
- `);let C=0,A=0;d(),s=setInterval(()=>{if(r&&o===a)return;g(),a=o;let T=_.magenta(t[C]),V=r?"...":".".repeat(Math.floor(A)).slice(0,3);process.stdout.write(`${T} ${o}${V}`),C=C+1<t.length?C+1:0,A=A<t.length?A+.125:0},e)},h=(w="",C=0)=>{i=!1,clearInterval(s),g();let A=C===0?_.green(Io):C===1?_.red(sg):_.red(og);o=m(w??o),process.stdout.write(`${A} ${o}
117
- `),f(),n()};return{start:y,stop:h,message:(w="")=>{o=m(w??o)}}},y$=async(t,e)=>{let r={},n=Object.keys(t);for(let s of n){let i=t[s],o=await i({results:r})?.catch(a=>{throw a});if(typeof e?.onCancel=="function"&&jt.isCancel(o)){r[s]="canceled",e.onCancel({results:r});continue}r[s]=o}return r},v$=async t=>{for(let e of t){if(e.enabled===!1)continue;let r=ag();r.start(e.title);let n=await e.task(r.message);r.stop(n||e.title)}};Te.isCancel=jt.isCancel,Te.updateSettings=jt.updateSettings,Te.cancel=m$,Te.confirm=c$,Te.group=y$,Te.groupMultiselect=h$,Te.intro=g$,Te.log=rn,Te.multiselect=f$,Te.note=p$,Te.outro=D$,Te.password=u$,Te.select=l$,Te.selectKey=d$,Te.spinner=ag,Te.tasks=v$,Te.text=a$});var ss=v((BI,dg)=>{var He=require("fs"),bt=require("path");function Ro(t){let e=bt.join(t,"rcode/skills"),r={agents:new Set,actions:new Set},n=bt.join(t,"rcode/agents");if(He.existsSync(n))for(let o of He.readdirSync(n,{withFileTypes:!0}))o.isFile()&&(!o.name.startsWith("rcode-")||!o.name.endsWith(".md")||r.agents.add(o.name.replace(/^rcode-/,"").replace(/\.md$/,"")));function s(o){try{let a=He.readFileSync(bt.join(o,"SKILL.md"),"utf8");return/^internal:\s*true\s*$/m.test(a)}catch{return!1}}function i(o){if(He.existsSync(o))for(let a of He.readdirSync(o,{withFileTypes:!0})){if(!a.isDirectory())continue;let u=bt.join(o,a.name);if(He.existsSync(bt.join(u,"SKILL.md"))){if(s(u))continue;let c=a.name.startsWith("rcode-")?a.name:`rcode-${a.name}`;r.actions.add(c)}else i(u)}}return i(bt.join(e,"actions")),r}function ug(t,e=null){if(!He.existsSync(t))return new Set;let r=new Set;for(let n of He.readdirSync(t,{withFileTypes:!0}))n.isDirectory()&&(e&&!n.name.startsWith(e)||r.add(e?n.name.slice(e.length):n.name));return r}function To(t,e,r,n){let s=[...r].filter(o=>!n.has(o)).sort(),i=[...n].filter(o=>!r.has(o)).sort();return{editor:t,kind:e,expectedCount:r.size,installedCount:n.size,missing:s,extra:i}}function cg(t,e,r={}){let n=r.globalFallback!==!1,s=Ro(e),i=bt.join(t,".claude/agents"),o=bt.join(t,".claude/skills"),a=new Set;if(He.existsSync(i))for(let l of He.readdirSync(i))l.startsWith("rcode-")&&l.endsWith(".md")&&a.add(l.replace(/^rcode-/,"").replace(/\.md$/,""));if(a.size===0&&n)try{let l=require("os"),d=bt.join(l.homedir(),".claude/agents");if(He.existsSync(d))for(let f of He.readdirSync(d))f.startsWith("rcode-")&&f.endsWith(".md")&&a.add(f.replace(/^rcode-/,"").replace(/\.md$/,""))}catch{}let u=ug(o),c=new Set([...u].filter(l=>s.actions.has(l)));if(c.size===0&&n)try{let l=require("os"),d=bt.join(l.homedir(),".claude/skills"),f=ug(d);c=new Set([...f].filter(g=>s.actions.has(g)))}catch{}return[To("claude","agents",s.agents,a),To("claude","actions",s.actions,c)]}function Vu(t,e,r){let n=Ro(r),s=t==="cursor"?".cursor/rules":".windsurf/rules",i=bt.join(e,s,"rcode","agents"),o=new Set;if(He.existsSync(i))for(let a of He.readdirSync(i,{withFileTypes:!0}))a.isFile()&&(!a.name.startsWith("rcode-")||!a.name.endsWith(".mdc")||o.add(a.name.replace(/^rcode-/,"").replace(/\.mdc$/,"")));return[To(t,"agents",n.agents,o)]}function lg(t,e){let r=Ro(e),n=bt.join(t,".antigravity/rcode/agents"),s=new Set;if(He.existsSync(n))for(let i of He.readdirSync(n,{withFileTypes:!0}))i.isFile()&&(!i.name.startsWith("rcode-")||!i.name.endsWith(".md")||s.add(i.name.replace(/^rcode-/,"").replace(/\.md$/,"")));return[To("antigravity","agents",r.agents,s)]}function _$(t,e,r){let n=[];r.includes("claude")&&n.push(...cg(t,e)),r.includes("cursor")&&n.push(...Vu("cursor",t,e)),r.includes("windsurf")&&n.push(...Vu("windsurf",t,e)),r.includes("antigravity")&&n.push(...lg(t,e));let s=n.some(i=>i.missing.length>0||i.extra.length>0);return{reports:n,hasDrift:s}}function b$(t){let e=[];for(let r of t){let n=r.missing.length===0&&r.extra.length===0?"\u2713":"\u26A0";e.push(` ${n} ${r.editor.padEnd(12)} ${r.kind.padEnd(8)} ${r.installedCount}/${r.expectedCount}`),r.missing.length>0&&e.push(` missing: ${r.missing.join(", ")}`),r.extra.length>0&&e.push(` extra: ${r.extra.join(", ")}`)}return e.join(`
118
- `)}dg.exports={readPackageManifest:Ro,verifyInstall:_$,verifyClaudeInstall:cg,verifyRulesInstall:Vu,verifyAntigravityInstall:lg,formatReport:b$}});var is=v((MI,dt)=>{var D=require("fs"),p=require("path"),S$=require("crypto"),E$=require("os"),{writeFileAtomic:Et,safeRmSync:Yu}=Kt(),{homedir:Xe}=dr(),J=Pn(),{createSpinner:C$}=Zc(),w$=Nf(),{z:Ie}=za(),Fn=Yp(),{createTwoFilesPatch:fg}=Tm(),Re=Uu(),ir=t=>J.green("\u2713")+" "+t,hg=t=>J.red("\u2717")+" "+t,St=t=>J.yellow("\u26A0")+" "+t,Po=t=>J.cyan("\u2192")+" "+t,Y=t=>J.dim(t),It=t=>J.bold(t),lt=p.resolve(__dirname,".."),$e=p.join(lt,"rcode"),os=Object.freeze(["claude","cursor","gemini","vscode","antigravity","windsurf","codex","grok"]);function x$(t){let e=t;for(;;){if(D.existsSync(p.join(e,"pnpm-workspace.yaml")))return e;let r=p.dirname(e);if(r===e)return null;e=r}}var k$=Ie.object({user_name:Ie.string().min(1),project_name:Ie.string().min(1),communication_language:Ie.string().default("English"),mode:Ie.enum(["guided","yolo"],{errorMap:()=>({message:'expected "guided" or "yolo"'})}).default("guided"),model_profile:Ie.string().optional(),commit_planning:Ie.boolean().optional(),rcode_source_path:Ie.string().optional(),workflow:Ie.object({research_by_default:Ie.boolean().optional(),plan_checker:Ie.boolean().optional(),post_execute_gates:Ie.boolean().optional(),ui_safety_gate:Ie.boolean().optional(),nyquist_validation:Ie.boolean().optional()}).optional(),output:Ie.object({verbose:Ie.boolean().optional()}).optional(),git:Ie.object({branching_strategy:Ie.string().optional()}).optional(),prompt_nudge:Ie.enum(["every","once-per-intent","when-stale","off"]).optional()}).passthrough();function Ju(t){let e={target:process.cwd(),targetProvided:!1,force:!1,reset:!1,yes:!1,userName:E$.userInfo().username||"User",projectName:null,language:"English",mode:"guided",ide:"claude",ideProvided:!1,help:!1,modules:[],commitPlanning:null,nonDestructive:!1,forceOverwrite:!1,showDiff:!1,diffStat:!1,acceptAll:!1,noUpdateCheck:!1,noBackup:!1,gitHooks:null,enableHooks:null,global:!1,silent:!1,noPrompt:!1,localOnly:!1,dryRun:!1,listFiles:!1},r=[];for(let n=0;n<t.length;n++){let s=t[n];s==="--help"||s==="-h"?e.help=!0:s==="--force"?e.force=!0:s==="--reset"?e.reset=!0:s==="--yes"||s==="-y"?e.yes=!0:s==="--user"?e.userName=t[++n]:s==="--project"?e.projectName=t[++n]:s==="--language"?e.language=t[++n]:s==="--mode"?e.mode=t[++n]:s==="--ide"?(e.ide=t[++n],e.ide==="claude-code"&&(e.ide="claude"),e.ideProvided=!0):s==="--module"?e.modules.push(t[++n]):s==="--commit-planning"?e.commitPlanning=!0:s==="--no-commit-planning"||s==="--ignore-planning"?e.commitPlanning=!1:s==="--non-destructive"?e.nonDestructive=!0:s==="--force-overwrite"?e.forceOverwrite=!0:s==="--show-diff"?e.showDiff=!0:s==="--diff-stat"?e.diffStat=!0:s==="--accept-all"?e.acceptAll=!0:s==="--no-update-check"?e.noUpdateCheck=!0:s==="--no-backup"?e.noBackup=!0:s==="--no-git-hooks"?e.gitHooks=!1:s==="--git-hooks"?e.gitHooks=!0:s==="--no-hooks"?e.enableHooks=!1:s==="--enable-hooks"?e.enableHooks=!0:s==="--global"?e.global=!0:s==="--local-only"?e.localOnly=!0:s==="--silent"?e.silent=!0:s==="--no-prompt"?e.noPrompt=!0:s==="--dry-run"?e.dryRun=!0:s==="--list-files"?e.listFiles=!0:s.startsWith("--")||r.push(s)}if(r[0]&&(e.target=p.resolve(r[0]),e.targetProvided=!0),e.global&&!e.targetProvided&&(e.target=Xe()),!e.targetProvided&&!e.global){let n=process.cwd(),s=D.existsSync(p.join(n,"pnpm-workspace.yaml")),i=process.env.INIT_CWD;s&&i&&p.resolve(i)!==p.resolve(n)?e.target=p.resolve(i):x$(p.dirname(n))&&(e.target=n)}return e.projectName||(e.projectName=p.basename(e.target)),e}function $$(t,e){let{spawnSync:r}=require("child_process"),n=[];for(let c of e){let l=c.rel||c.dest;if(!l)continue;let d=p.join(t,l);D.existsSync(d)&&n.push(l)}for(let c of[".rcode/config.yaml",".rcode/state.json",".rcode/_config/manifest.yaml",".rcode/_config/files-manifest.csv"])D.existsSync(p.join(t,c))&&n.push(c);if(n.length===0)return{ok:!1,warning:"no existing files to back up \u2014 fresh install",fileCount:0};let s=p.join(t,".rcode/backups");try{D.mkdirSync(s,{recursive:!0})}catch(c){return{ok:!1,warning:`could not create .rcode/backups/: ${c.message}`,fileCount:0}}let i=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),o=p.join(s,`install-force-${i}.tgz`),a=p.relative(t,o),u=r("tar",["-czf",o,"-C",t,"--files-from=-"],{input:n.join(`
115
+ `);process.stdout.write(rg.cursor.move(-999,w.length-1)),process.stdout.write(rg.erase.down(w.length))},m=w=>w.replace(/\.+$/,""),y=(w="")=>{i=!0,n=It.block(),o=m(w),process.stdout.write(`${_.gray(ee)}
116
+ `);let C=0,A=0;d(),s=setInterval(()=>{if(r&&o===a)return;g(),a=o;let T=_.magenta(t[C]),G=r?"...":".".repeat(Math.floor(A)).slice(0,3);process.stdout.write(`${T} ${o}${G}`),C=C+1<t.length?C+1:0,A=A<t.length?A+.125:0},e)},h=(w="",C=0)=>{i=!1,clearInterval(s),g();let A=C===0?_.green(To):C===1?_.red(og):_.red(ig);o=m(w??o),process.stdout.write(`${A} ${o}
117
+ `),f(),n()};return{start:y,stop:h,message:(w="")=>{o=m(w??o)}}},_$=async(t,e)=>{let r={},n=Object.keys(t);for(let s of n){let i=t[s],o=await i({results:r})?.catch(a=>{throw a});if(typeof e?.onCancel=="function"&&It.isCancel(o)){r[s]="canceled",e.onCancel({results:r});continue}r[s]=o}return r},b$=async t=>{for(let e of t){if(e.enabled===!1)continue;let r=cg();r.start(e.title);let n=await e.task(r.message);r.stop(n||e.title)}};Re.isCancel=It.isCancel,Re.updateSettings=It.updateSettings,Re.cancel=D$,Re.confirm=d$,Re.group=_$,Re.groupMultiselect=m$,Re.intro=y$,Re.log=sn,Re.multiselect=p$,Re.note=g$,Re.outro=v$,Re.password=l$,Re.select=f$,Re.selectKey=h$,Re.spinner=cg,Re.tasks=b$,Re.text=u$});var is=v((WI,fg)=>{var Ue=require("fs"),St=require("path");function Po(t){let e=St.join(t,"rcode/skills"),r={agents:new Set,actions:new Set},n=St.join(t,"rcode/agents");if(Ue.existsSync(n))for(let o of Ue.readdirSync(n,{withFileTypes:!0}))o.isFile()&&(!o.name.startsWith("rcode-")||!o.name.endsWith(".md")||r.agents.add(o.name.replace(/^rcode-/,"").replace(/\.md$/,"")));function s(o){try{let a=Ue.readFileSync(St.join(o,"SKILL.md"),"utf8");return/^internal:\s*true\s*$/m.test(a)}catch{return!1}}function i(o){if(Ue.existsSync(o))for(let a of Ue.readdirSync(o,{withFileTypes:!0})){if(!a.isDirectory())continue;let c=St.join(o,a.name);if(Ue.existsSync(St.join(c,"SKILL.md"))){if(s(c))continue;let u=a.name.startsWith("rcode-")?a.name:`rcode-${a.name}`;r.actions.add(u)}else i(c)}}return i(St.join(e,"actions")),r}function ug(t,e=null){if(!Ue.existsSync(t))return new Set;let r=new Set;for(let n of Ue.readdirSync(t,{withFileTypes:!0}))n.isDirectory()&&(e&&!n.name.startsWith(e)||r.add(e?n.name.slice(e.length):n.name));return r}function Ro(t,e,r,n){let s=[...r].filter(o=>!n.has(o)).sort(),i=[...n].filter(o=>!r.has(o)).sort();return{editor:t,kind:e,expectedCount:r.size,installedCount:n.size,missing:s,extra:i}}function lg(t,e,r={}){let n=r.globalFallback!==!1,s=Po(e),i=St.join(t,".claude/agents"),o=St.join(t,".claude/skills"),a=new Set;if(Ue.existsSync(i))for(let l of Ue.readdirSync(i))l.startsWith("rcode-")&&l.endsWith(".md")&&a.add(l.replace(/^rcode-/,"").replace(/\.md$/,""));if(a.size===0&&n)try{let l=require("os"),d=St.join(l.homedir(),".claude/agents");if(Ue.existsSync(d))for(let f of Ue.readdirSync(d))f.startsWith("rcode-")&&f.endsWith(".md")&&a.add(f.replace(/^rcode-/,"").replace(/\.md$/,""))}catch{}let c=ug(o),u=new Set([...c].filter(l=>s.actions.has(l)));if(u.size===0&&n)try{let l=require("os"),d=St.join(l.homedir(),".claude/skills"),f=ug(d);u=new Set([...f].filter(g=>s.actions.has(g)))}catch{}return[Ro("claude","agents",s.agents,a),Ro("claude","actions",s.actions,u)]}function Gc(t,e,r){let n=Po(r),s=t==="cursor"?".cursor/rules":".windsurf/rules",i=St.join(e,s,"rcode","agents"),o=new Set;if(Ue.existsSync(i))for(let a of Ue.readdirSync(i,{withFileTypes:!0}))a.isFile()&&(!a.name.startsWith("rcode-")||!a.name.endsWith(".mdc")||o.add(a.name.replace(/^rcode-/,"").replace(/\.mdc$/,"")));return[Ro(t,"agents",n.agents,o)]}function dg(t,e){let r=Po(e),n=St.join(t,".antigravity/rcode/agents"),s=new Set;if(Ue.existsSync(n))for(let i of Ue.readdirSync(n,{withFileTypes:!0}))i.isFile()&&(!i.name.startsWith("rcode-")||!i.name.endsWith(".md")||s.add(i.name.replace(/^rcode-/,"").replace(/\.md$/,"")));return[Ro("antigravity","agents",r.agents,s)]}function S$(t,e,r){let n=[];r.includes("claude")&&n.push(...lg(t,e)),r.includes("cursor")&&n.push(...Gc("cursor",t,e)),r.includes("windsurf")&&n.push(...Gc("windsurf",t,e)),r.includes("antigravity")&&n.push(...dg(t,e));let s=n.some(i=>i.missing.length>0||i.extra.length>0);return{reports:n,hasDrift:s}}function E$(t){let e=[];for(let r of t){let n=r.missing.length===0&&r.extra.length===0?"\u2713":"\u26A0";e.push(` ${n} ${r.editor.padEnd(12)} ${r.kind.padEnd(8)} ${r.installedCount}/${r.expectedCount}`),r.missing.length>0&&e.push(` missing: ${r.missing.join(", ")}`),r.extra.length>0&&e.push(` extra: ${r.extra.join(", ")}`)}return e.join(`
118
+ `)}fg.exports={readPackageManifest:Po,verifyInstall:S$,verifyClaudeInstall:lg,verifyRulesInstall:Gc,verifyAntigravityInstall:dg,formatReport:E$}});var cs=v((HI,ft)=>{var D=require("fs"),p=require("path"),C$=require("crypto"),w$=require("os"),{writeFileAtomic:Oe,safeRmSync:Jc}=Qt(),{homedir:Qe}=hr(),J=Nn(),{createSpinner:x$}=Uu(),k$=Lf(),{z:Te}=Ya(),In=Jp(),{createTwoFilesPatch:hg}=Rm(),Pe=Vc(),ar=t=>J.green("\u2713")+" "+t,pg=t=>J.red("\u2717")+" "+t,Et=t=>J.yellow("\u26A0")+" "+t,Oo=t=>J.cyan("\u2192")+" "+t,Y=t=>J.dim(t),Tt=t=>J.bold(t),dt=p.resolve(__dirname,".."),Ae=p.join(dt,"rcode"),as=Object.freeze(["claude","cursor","gemini","vscode","antigravity","windsurf","codex","grok"]);function $$(t){let e=t;for(;;){if(D.existsSync(p.join(e,"pnpm-workspace.yaml")))return e;let r=p.dirname(e);if(r===e)return null;e=r}}var A$=Te.object({user_name:Te.string().min(1),project_name:Te.string().min(1),communication_language:Te.string().default("English"),mode:Te.enum(["guided","yolo"],{errorMap:()=>({message:'expected "guided" or "yolo"'})}).default("guided"),model_profile:Te.string().optional(),commit_planning:Te.boolean().optional(),rcode_source_path:Te.string().optional(),workflow:Te.object({research_by_default:Te.boolean().optional(),plan_checker:Te.boolean().optional(),post_execute_gates:Te.boolean().optional(),ui_safety_gate:Te.boolean().optional(),nyquist_validation:Te.boolean().optional()}).optional(),output:Te.object({verbose:Te.boolean().optional()}).optional(),git:Te.object({branching_strategy:Te.string().optional()}).optional(),prompt_nudge:Te.enum(["every","once-per-intent","when-stale","off"]).optional()}).passthrough();function Xc(t){let e={target:process.cwd(),targetProvided:!1,force:!1,reset:!1,yes:!1,userName:w$.userInfo().username||"User",projectName:null,language:"English",mode:"guided",ide:"claude",ideProvided:!1,help:!1,modules:[],commitPlanning:null,nonDestructive:!1,forceOverwrite:!1,showDiff:!1,diffStat:!1,acceptAll:!1,noUpdateCheck:!1,noBackup:!1,gitHooks:null,enableHooks:null,global:!1,silent:!1,noPrompt:!1,localOnly:!1,dryRun:!1,listFiles:!1},r=[];for(let n=0;n<t.length;n++){let s=t[n];s==="--help"||s==="-h"?e.help=!0:s==="--force"?e.force=!0:s==="--reset"?e.reset=!0:s==="--yes"||s==="-y"?e.yes=!0:s==="--user"?e.userName=t[++n]:s==="--project"?e.projectName=t[++n]:s==="--language"?e.language=t[++n]:s==="--mode"?e.mode=t[++n]:s==="--ide"?(e.ide=t[++n],e.ide==="claude-code"&&(e.ide="claude"),e.ideProvided=!0):s==="--module"?e.modules.push(t[++n]):s==="--commit-planning"?e.commitPlanning=!0:s==="--no-commit-planning"||s==="--ignore-planning"?e.commitPlanning=!1:s==="--non-destructive"?e.nonDestructive=!0:s==="--force-overwrite"?e.forceOverwrite=!0:s==="--show-diff"?e.showDiff=!0:s==="--diff-stat"?e.diffStat=!0:s==="--accept-all"?e.acceptAll=!0:s==="--no-update-check"?e.noUpdateCheck=!0:s==="--no-backup"?e.noBackup=!0:s==="--no-git-hooks"?e.gitHooks=!1:s==="--git-hooks"?e.gitHooks=!0:s==="--no-hooks"?e.enableHooks=!1:s==="--enable-hooks"?e.enableHooks=!0:s==="--global"?e.global=!0:s==="--local-only"?e.localOnly=!0:s==="--silent"?e.silent=!0:s==="--no-prompt"?e.noPrompt=!0:s==="--dry-run"?e.dryRun=!0:s==="--list-files"?e.listFiles=!0:s.startsWith("--")||r.push(s)}if(r[0]&&(e.target=p.resolve(r[0]),e.targetProvided=!0),e.global&&!e.targetProvided&&(e.target=Qe()),!e.targetProvided&&!e.global){let n=process.cwd(),s=D.existsSync(p.join(n,"pnpm-workspace.yaml")),i=process.env.INIT_CWD;s&&i&&p.resolve(i)!==p.resolve(n)?e.target=p.resolve(i):$$(p.dirname(n))&&(e.target=n)}return e.projectName||(e.projectName=p.basename(e.target)),e}function F$(t,e){let{spawnSync:r}=require("child_process"),n=[];for(let u of e){let l=u.rel||u.dest;if(!l)continue;let d=p.join(t,l);D.existsSync(d)&&n.push(l)}for(let u of[".rcode/config.yaml",".rcode/state.json",".rcode/_config/manifest.yaml",".rcode/_config/files-manifest.csv"])D.existsSync(p.join(t,u))&&n.push(u);if(n.length===0)return{ok:!1,warning:"no existing files to back up \u2014 fresh install",fileCount:0};let s=p.join(t,".rcode/backups");try{D.mkdirSync(s,{recursive:!0})}catch(u){return{ok:!1,warning:`could not create .rcode/backups/: ${u.message}`,fileCount:0}}let i=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),o=p.join(s,`install-force-${i}.tgz`),a=p.relative(t,o),c=r("tar",["-czf",o,"-C",t,"--files-from=-"],{input:n.join(`
119
119
  `)+`
120
- `,encoding:"utf8"});return u.status!==0?{ok:!1,warning:`tar failed: ${(u.stderr||"").trim().split(`
121
- `)[0]}`,fileCount:n.length}:{ok:!0,path:a,fileCount:n.length}}function A$(t){let e=t||Ze(),r=["",J.cyan("\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E"),J.cyan("\u2502")+" "+J.cyan("\u2502"),J.cyan("\u2502")+" "+J.bold(J.yellow("\u{1F54C} rcode Memory Bank"))+" "+Y("\u2014 installer")+" "+J.cyan("\u2502"),J.cyan("\u2502")+" "+Y("A persistent context-brain for your editor")+" "+J.cyan("\u2502"),J.cyan("\u2502")+" "+J.cyan("\u2502"),J.cyan("\u2502")+" "+Y("version ")+J.green("v"+e)+" "+J.cyan("\u2502"),J.cyan("\u2502")+" "+Y("docs ")+"github.com/hanzlahabib/rcode "+J.cyan("\u2502"),J.cyan("\u2502")+" "+Y("by ")+"Hanzla Habib "+J.cyan("\u2502"),J.cyan("\u2502")+" "+J.cyan("\u2502"),J.cyan("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F"),""];console.log(r.join(`
122
- `))}function pg(t){let e={claude:!1,cursor:!1,gemini:!1,vscode:!1,antigravity:!1,windsurf:!1,codex:!1};D.existsSync(p.join(t,".claude"))&&(e.claude=!0),D.existsSync(p.join(t,".cursor"))&&(e.cursor=!0),D.existsSync(p.join(t,".gemini"))&&(e.gemini=!0),D.existsSync(p.join(t,".vscode"))&&(e.vscode=!0),D.existsSync(p.join(t,".antigravity"))&&(e.antigravity=!0),D.existsSync(p.join(t,".windsurf"))&&(e.windsurf=!0);let r=Xe();return D.existsSync(p.join(r,".claude"))&&(e.claude=!0),D.existsSync(p.join(r,".cursor"))&&(e.cursor=!0),D.existsSync(p.join(r,".config","Cursor"))&&(e.cursor=!0),D.existsSync(p.join(r,".gemini"))&&(e.gemini=!0),D.existsSync(p.join(r,".vscode"))&&(e.vscode=!0),D.existsSync(p.join(r,".config","Code"))&&(e.vscode=!0),D.existsSync(p.join(r,".antigravity"))&&(e.antigravity=!0),D.existsSync(p.join(r,".windsurf"))&&(e.windsurf=!0),D.existsSync(p.join(r,".codeium","windsurf"))&&(e.windsurf=!0),(process.env.CURSOR_TRACE_ID||/cursor/i.test(process.env.TERM_PROGRAM||""))&&(e.cursor=!0),(process.env.CLAUDECODE==="1"||process.env.CLAUDE_CODE_ENTRYPOINT)&&(e.claude=!0),(process.env.VSCODE_PID||/vscode/i.test(process.env.TERM_PROGRAM||""))&&(e.vscode=!0),/windsurf/i.test(process.env.TERM_PROGRAM||"")&&(e.windsurf=!0),(process.env.CODEX_ENV||/codex/i.test(process.env.TERM_PROGRAM||""))&&(e.codex=!0),e}async function F$(t){if(Array.isArray(t.ides)&&t.ides.length>0)return t.ides;if(t.ideProvided)return[t.ide];if(t.noPrompt||t.global)return["claude"];if(t.yes||!process.stdin.isTTY){let i=pg(t.target),o=os.filter(a=>i[a]);return o.length>0?o:["claude"]}let e=pg(t.target),r=os.filter(i=>i!=="antigravity"&&e[i]),n=r.length>0?r:["claude"],s=await Re.multiselect({message:"\u{1F3AF} Which editor(s) will you use rcode with?",initialValues:n,options:[{value:"claude",label:"Claude Code",hint:e.claude?"(detected)":void 0},{value:"cursor",label:"Cursor",hint:e.cursor?"(detected)":void 0},{value:"codex",label:"Codex (OpenAI CLI)",hint:e.codex?"(detected)":"(uses AGENTS.md + workflow bridge)"},{value:"gemini",label:"Gemini CLI",hint:e.gemini?"(detected)":"(beta \u2014 limited)"},{value:"vscode",label:"VS Code",hint:e.vscode?"(detected)":"(via Continue / Copilot extensions)"},{value:"antigravity",label:"Antigravity",hint:"(experimental \u2014 installs to .antigravity/)"}],required:!0});return Re.isCancel(s)&&(Re.cancel("Install cancelled."),process.exit(0)),s}async function j$(t){if(t.commitPlanning!==null)return t.commitPlanning;if(t.global)return!1;if(t.noPrompt)return!0;let e=null;try{let s=p.join(t.target,".rcode","config.yaml");if(D.existsSync(s)){let o=D.readFileSync(s,"utf8").match(/^commit_planning:\s*(true|false)\s*$/m);o&&(e=o[1]==="true")}}catch{}if(t.yes||!process.stdin.isTTY)return e!==null?e:!0;let r=e===!1?"gitignore":"commit",n=await Re.select({message:e!==null?"\u{1F4CB} .planning/ tracking \u2014 current setting preserved unless you change it.":"\u{1F4CB} .planning/ holds PRDs, roadmaps, sprints, SUMMARY files. How should they be tracked?",initialValue:r,options:[{value:"commit",label:"Commit",hint:"collaborators see the same plans (recommended)"},{value:"gitignore",label:"Gitignore",hint:"planning stays local (good for sensitive PRDs)"}]});return Re.isCancel(n)&&(Re.cancel("Install cancelled."),process.exit(0)),n==="commit"}async function I$(t){if(t.enableHooks!==null)return t.enableHooks;if(t.global||!t.ides.includes("claude"))return!1;if(t.noPrompt||t.yes||!process.stdin.isTTY)return!0;let e=await Re.confirm({message:"\u{1F6E1}\uFE0F Enable rcode guardrail hooks in .claude/settings.json? (pre-edit checks, bash-guard, prompt-router, etc.)",initialValue:!0});return Re.isCancel(e)&&(Re.cancel("Install cancelled."),process.exit(0)),e}function T$(t,e={}){if(e.enableHooks!==!0)return{action:"skipped-flag"};let r=p.join(lt,"rcode","templates","settings-hooks.json");if(!D.existsSync(r))return{action:"skipped-template-missing"};let n;try{n=JSON.parse(D.readFileSync(r,"utf8"))}catch{return{action:"skipped-error"}}let s=p.join(t,".claude"),i=p.join(s,"settings.json"),o={};if(D.existsSync(i))try{o=JSON.parse(D.readFileSync(i,"utf8"))}catch{return{action:"skipped-error"}}o.hooks=o.hooks||{};for(let[a,u]of Object.entries(n.hooks||{})){o.hooks[a]=o.hooks[a]||[];for(let c of u){let l=o.hooks[a].find(d=>d.matcher===c.matcher);l||(l={matcher:c.matcher,hooks:[]},o.hooks[a].push(l));for(let d of c.hooks)l.hooks.some(g=>g.command===d.command&&g.type===d.type)||l.hooks.push(d)}}try{return D.mkdirSync(s,{recursive:!0}),Et(i,JSON.stringify(o,null,2)+`
123
- `),{action:"merged"}}catch{return{action:"skipped-error"}}}function Dg(){console.log(`
120
+ `,encoding:"utf8"});return c.status!==0?{ok:!1,warning:`tar failed: ${(c.stderr||"").trim().split(`
121
+ `)[0]}`,fileCount:n.length}:{ok:!0,path:a,fileCount:n.length}}function j$(t){let e=t||Ve(),r=["",J.cyan("\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E"),J.cyan("\u2502")+" "+J.cyan("\u2502"),J.cyan("\u2502")+" "+J.bold(J.yellow("\u{1F54C} rcode Memory Bank"))+" "+Y("\u2014 installer")+" "+J.cyan("\u2502"),J.cyan("\u2502")+" "+Y("A persistent context-brain for your editor")+" "+J.cyan("\u2502"),J.cyan("\u2502")+" "+J.cyan("\u2502"),J.cyan("\u2502")+" "+Y("version ")+J.green("v"+e)+" "+J.cyan("\u2502"),J.cyan("\u2502")+" "+Y("docs ")+"github.com/hanzlahabib/rcode "+J.cyan("\u2502"),J.cyan("\u2502")+" "+Y("by ")+"Hanzla Habib "+J.cyan("\u2502"),J.cyan("\u2502")+" "+J.cyan("\u2502"),J.cyan("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F"),""];console.log(r.join(`
122
+ `))}function mg(t){let e={claude:!1,cursor:!1,gemini:!1,vscode:!1,antigravity:!1,windsurf:!1,codex:!1};D.existsSync(p.join(t,".claude"))&&(e.claude=!0),D.existsSync(p.join(t,".cursor"))&&(e.cursor=!0),D.existsSync(p.join(t,".gemini"))&&(e.gemini=!0),D.existsSync(p.join(t,".vscode"))&&(e.vscode=!0),D.existsSync(p.join(t,".antigravity"))&&(e.antigravity=!0),D.existsSync(p.join(t,".windsurf"))&&(e.windsurf=!0);let r=Qe();return D.existsSync(p.join(r,".claude"))&&(e.claude=!0),D.existsSync(p.join(r,".cursor"))&&(e.cursor=!0),D.existsSync(p.join(r,".config","Cursor"))&&(e.cursor=!0),D.existsSync(p.join(r,".gemini"))&&(e.gemini=!0),D.existsSync(p.join(r,".vscode"))&&(e.vscode=!0),D.existsSync(p.join(r,".config","Code"))&&(e.vscode=!0),D.existsSync(p.join(r,".antigravity"))&&(e.antigravity=!0),D.existsSync(p.join(r,".windsurf"))&&(e.windsurf=!0),D.existsSync(p.join(r,".codeium","windsurf"))&&(e.windsurf=!0),(process.env.CURSOR_TRACE_ID||/cursor/i.test(process.env.TERM_PROGRAM||""))&&(e.cursor=!0),(process.env.CLAUDECODE==="1"||process.env.CLAUDE_CODE_ENTRYPOINT)&&(e.claude=!0),(process.env.VSCODE_PID||/vscode/i.test(process.env.TERM_PROGRAM||""))&&(e.vscode=!0),/windsurf/i.test(process.env.TERM_PROGRAM||"")&&(e.windsurf=!0),(process.env.CODEX_ENV||/codex/i.test(process.env.TERM_PROGRAM||""))&&(e.codex=!0),e}async function I$(t){if(Array.isArray(t.ides)&&t.ides.length>0)return t.ides;if(t.ideProvided)return[t.ide];if(t.noPrompt||t.global)return["claude"];if(t.yes||!process.stdin.isTTY){let i=mg(t.target),o=as.filter(a=>i[a]);return o.length>0?o:["claude"]}let e=mg(t.target),r=as.filter(i=>i!=="antigravity"&&e[i]),n=r.length>0?r:["claude"],s=await Pe.multiselect({message:"\u{1F3AF} Which editor(s) will you use rcode with?",initialValues:n,options:[{value:"claude",label:"Claude Code",hint:e.claude?"(detected)":void 0},{value:"cursor",label:"Cursor",hint:e.cursor?"(detected)":void 0},{value:"codex",label:"Codex (OpenAI CLI)",hint:e.codex?"(detected)":"(uses AGENTS.md + workflow bridge)"},{value:"gemini",label:"Gemini CLI",hint:e.gemini?"(detected)":"(beta \u2014 limited)"},{value:"vscode",label:"VS Code",hint:e.vscode?"(detected)":"(via Continue / Copilot extensions)"},{value:"antigravity",label:"Antigravity",hint:"(experimental \u2014 installs to .antigravity/)"}],required:!0});return Pe.isCancel(s)&&(Pe.cancel("Install cancelled."),process.exit(0)),s}async function T$(t){if(t.commitPlanning!==null)return t.commitPlanning;if(t.global)return!1;if(t.noPrompt)return!0;let e=null;try{let s=p.join(t.target,".rcode","config.yaml");if(D.existsSync(s)){let o=D.readFileSync(s,"utf8").match(/^commit_planning:\s*(true|false)\s*$/m);o&&(e=o[1]==="true")}}catch{}if(t.yes||!process.stdin.isTTY)return e!==null?e:!0;let r=e===!1?"gitignore":"commit",n=await Pe.select({message:e!==null?"\u{1F4CB} .planning/ tracking \u2014 current setting preserved unless you change it.":"\u{1F4CB} .planning/ holds PRDs, roadmaps, sprints, SUMMARY files. How should they be tracked?",initialValue:r,options:[{value:"commit",label:"Commit",hint:"collaborators see the same plans (recommended)"},{value:"gitignore",label:"Gitignore",hint:"planning stays local (good for sensitive PRDs)"}]});return Pe.isCancel(n)&&(Pe.cancel("Install cancelled."),process.exit(0)),n==="commit"}async function R$(t){if(t.enableHooks!==null)return t.enableHooks;if(t.global||!t.ides.includes("claude"))return!1;if(t.noPrompt||t.yes||!process.stdin.isTTY)return!0;let e=await Pe.confirm({message:"\u{1F6E1}\uFE0F Enable rcode guardrail hooks in .claude/settings.json? (pre-edit checks, bash-guard, prompt-router, etc.)",initialValue:!0});return Pe.isCancel(e)&&(Pe.cancel("Install cancelled."),process.exit(0)),e}function P$(t,e={}){if(e.enableHooks!==!0)return{action:"skipped-flag"};let r=p.join(dt,"rcode","templates","settings-hooks.json");if(!D.existsSync(r))return{action:"skipped-template-missing"};let n;try{n=JSON.parse(D.readFileSync(r,"utf8"))}catch{return{action:"skipped-error"}}let s=p.join(t,".claude"),i=p.join(s,"settings.json"),o={};if(D.existsSync(i))try{o=JSON.parse(D.readFileSync(i,"utf8"))}catch{return{action:"skipped-error"}}o.hooks=o.hooks||{};for(let[a,c]of Object.entries(n.hooks||{})){o.hooks[a]=o.hooks[a]||[];for(let u of c){let l=o.hooks[a].find(d=>d.matcher===u.matcher);l||(l={matcher:u.matcher,hooks:[]},o.hooks[a].push(l));for(let d of u.hooks)l.hooks.some(g=>g.command===d.command&&g.type===d.type)||l.hooks.push(d)}}try{return D.mkdirSync(s,{recursive:!0}),Oe(i,JSON.stringify(o,null,2)+`
123
+ `),{action:"merged"}}catch{return{action:"skipped-error"}}}function vg(){console.log(`
124
124
  rcode installer
125
125
 
126
126
  Usage:
@@ -148,10 +148,10 @@ Installs (IDE-specific):
148
148
  cursor: target/.cursor/rules/rcode/ Cursor-specific rules + agents
149
149
  gemini: target/.gemini/rcode/ Gemini CLI commands + agents
150
150
  target/.planning/ artifact output dir (all IDEs)
151
- `)}function Xu(t,e){switch(t){case"claude":return{agentsDir:p.join(e,".claude","agents"),commandsDir:p.join(e,".claude","commands"),workflowsDir:p.join(e,".rcode","workflows"),referencesDir:p.join(e,".rcode","references"),binDir:p.join(e,".rcode","bin")};case"cursor":return{agentsDir:p.join(e,".cursor","rules","rcode","agents"),commandsDir:p.join(e,".cursor","rules","rcode","commands"),workflowsDir:p.join(e,".rcode","workflows"),referencesDir:p.join(e,".rcode","references"),binDir:p.join(e,".rcode","bin")};case"gemini":return{agentsDir:p.join(e,".gemini","rcode","agents"),commandsDir:p.join(e,".gemini","rcode","commands"),workflowsDir:p.join(e,".rcode","workflows"),referencesDir:p.join(e,".rcode","references"),binDir:p.join(e,".rcode","bin")};case"vscode":return{agentsDir:p.join(e,".claude","agents"),commandsDir:p.join(e,".claude","commands"),workflowsDir:p.join(e,".rcode","workflows"),referencesDir:p.join(e,".rcode","references"),binDir:p.join(e,".rcode","bin"),markerDir:p.join(e,".vscode","rcode")};case"antigravity":return{agentsDir:p.join(e,".antigravity","rcode","agents"),commandsDir:p.join(e,".antigravity","rcode","commands"),workflowsDir:p.join(e,".rcode","workflows"),referencesDir:p.join(e,".rcode","references"),binDir:p.join(e,".rcode","bin")};case"windsurf":return{agentsDir:p.join(e,".windsurf","rules","rcode","agents"),commandsDir:p.join(e,".windsurf","rules","rcode","commands"),workflowsDir:p.join(e,".rcode","workflows"),referencesDir:p.join(e,".rcode","references"),binDir:p.join(e,".rcode","bin")};case"codex":return{agentsDir:p.join(e,".claude","agents"),commandsDir:p.join(e,".claude","commands"),workflowsDir:p.join(e,".rcode","workflows"),referencesDir:p.join(e,".rcode","references"),binDir:p.join(e,".rcode","bin")};case"grok":return{agentsDir:p.join(e,".claude","agents"),commandsDir:p.join(e,".claude","commands"),workflowsDir:p.join(e,".rcode","workflows"),referencesDir:p.join(e,".rcode","references"),binDir:p.join(e,".rcode","bin")};default:throw new Error(`Unknown IDE: ${t}. Supported: ${os.join(", ")}`)}}function Fr(t,e=[]){return D.existsSync(t)?w$.sync("**/*",{cwd:t,dot:!0,onlyFiles:!0,followSymbolicLinks:!1,ignore:e}).map(r=>p.join(t,r)):[]}function jn(t){return S$.createHash("sha256").update(t).digest("hex")}function Tt(t){D.mkdirSync(t,{recursive:!0})}function yg(t,e){if(D.existsSync(t)){D.existsSync(e)||D.mkdirSync(e,{recursive:!0});for(let r of D.readdirSync(t,{withFileTypes:!0})){let n=p.join(t,r.name),s=p.join(e,r.name);r.isDirectory()?yg(n,s):r.isFile()&&D.copyFileSync(n,s)}}}function R$(t,e){let r=p.join(t,".planning"),n=p.join(r,"ROADMAP.md"),s=p.join(r,"STATE.md"),i=p.join(r,"PROJECT.md");if(D.existsSync(n))return!1;D.mkdirSync(r,{recursive:!0});let o=new Date().toISOString().slice(0,10),a=e||p.basename(t),u=`<!-- INSTALL STUB \u2014 overwritten by /rcode-new-project. Delete this file or run
151
+ `)}function Kc(t,e){switch(t){case"claude":return{agentsDir:p.join(e,".claude","agents"),commandsDir:p.join(e,".claude","commands"),workflowsDir:p.join(e,".rcode","workflows"),referencesDir:p.join(e,".rcode","references"),binDir:p.join(e,".rcode","bin")};case"cursor":return{agentsDir:p.join(e,".cursor","rules","rcode","agents"),commandsDir:p.join(e,".cursor","rules","rcode","commands"),workflowsDir:p.join(e,".rcode","workflows"),referencesDir:p.join(e,".rcode","references"),binDir:p.join(e,".rcode","bin")};case"gemini":return{agentsDir:p.join(e,".gemini","rcode","agents"),commandsDir:p.join(e,".gemini","rcode","commands"),workflowsDir:p.join(e,".rcode","workflows"),referencesDir:p.join(e,".rcode","references"),binDir:p.join(e,".rcode","bin")};case"vscode":return{agentsDir:p.join(e,".claude","agents"),commandsDir:p.join(e,".claude","commands"),workflowsDir:p.join(e,".rcode","workflows"),referencesDir:p.join(e,".rcode","references"),binDir:p.join(e,".rcode","bin"),markerDir:p.join(e,".vscode","rcode")};case"antigravity":return{agentsDir:p.join(e,".antigravity","rcode","agents"),commandsDir:p.join(e,".antigravity","rcode","commands"),workflowsDir:p.join(e,".rcode","workflows"),referencesDir:p.join(e,".rcode","references"),binDir:p.join(e,".rcode","bin")};case"windsurf":return{agentsDir:p.join(e,".windsurf","rules","rcode","agents"),commandsDir:p.join(e,".windsurf","rules","rcode","commands"),workflowsDir:p.join(e,".rcode","workflows"),referencesDir:p.join(e,".rcode","references"),binDir:p.join(e,".rcode","bin")};case"codex":return{agentsDir:p.join(e,".claude","agents"),commandsDir:p.join(e,".claude","commands"),workflowsDir:p.join(e,".rcode","workflows"),referencesDir:p.join(e,".rcode","references"),binDir:p.join(e,".rcode","bin")};case"grok":return{agentsDir:p.join(e,".claude","agents"),commandsDir:p.join(e,".claude","commands"),workflowsDir:p.join(e,".rcode","workflows"),referencesDir:p.join(e,".rcode","references"),binDir:p.join(e,".rcode","bin")};default:throw new Error(`Unknown IDE: ${t}. Supported: ${as.join(", ")}`)}}function Ir(t,e=[]){return D.existsSync(t)?k$.sync("**/*",{cwd:t,dot:!0,onlyFiles:!0,followSymbolicLinks:!1,ignore:e}).map(r=>p.join(t,r)):[]}function Tn(t){return C$.createHash("sha256").update(t).digest("hex")}function Rt(t){D.mkdirSync(t,{recursive:!0})}function _g(t,e){if(D.existsSync(t)){D.existsSync(e)||D.mkdirSync(e,{recursive:!0});for(let r of D.readdirSync(t,{withFileTypes:!0})){let n=p.join(t,r.name),s=p.join(e,r.name);r.isDirectory()?_g(n,s):r.isFile()&&D.copyFileSync(n,s)}}}function O$(t,e){let r=p.join(t,".planning"),n=p.join(r,"ROADMAP.md"),s=p.join(r,"STATE.md"),i=p.join(r,"PROJECT.md");if(D.existsSync(n))return!1;D.mkdirSync(r,{recursive:!0});let o=new Date().toISOString().slice(0,10),a=e||p.basename(t),c=`<!-- INSTALL STUB \u2014 overwritten by /rcode-new-project. Delete this file or run
152
152
  /rcode-new-project before committing. See https://github.com/hanzlahabib/rcode/issues/670 -->
153
153
 
154
- `;D.writeFileSync(i,u+`# ${a}
154
+ `;D.writeFileSync(i,c+`# ${a}
155
155
 
156
156
  **One-line:** Describe what this project is in one sentence.
157
157
 
@@ -164,7 +164,7 @@ What this project delivers and who it serves.
164
164
  - Language/framework
165
165
  - Key dependencies
166
166
  - Deployment target
167
- `),D.writeFileSync(n,u+`# ${a} \u2014 Roadmap
167
+ `),D.writeFileSync(n,c+`# ${a} \u2014 Roadmap
168
168
 
169
169
  **Milestone: M1 \u2014 Initial Delivery** (v1.0)
170
170
  Started: ${o} \xB7 Current
@@ -179,7 +179,7 @@ Started: ${o} \xB7 Current
179
179
  ## Backlog
180
180
 
181
181
  Ideas and future phases go here.
182
- `),D.writeFileSync(s,u+`# ${a} \u2014 State
182
+ `),D.writeFileSync(s,c+`# ${a} \u2014 State
183
183
 
184
184
  **Last updated:** ${o}
185
185
  **Milestone:** M1 \u2014 Initial Delivery
@@ -199,171 +199,191 @@ _None._
199
199
  ## Next Action
200
200
 
201
201
  Run \`/rcode-new-project <description>\` to bootstrap, or \`/rcode-sprint-planning\` once a real phase exists.
202
- `);let c=p.join(t,".rcode","state.json");function l(){let d=p.join(t,".planning","ROADMAP.md");if(!D.existsSync(d))return!0;try{return D.readFileSync(d,"utf8").includes("<!-- INSTALL STUB")}catch{return!0}}if(!D.existsSync(c)){let d=new Date().toISOString(),f=l(),g=null,m=p.join(t,".rcode","config.yaml");if(D.existsSync(m))try{let A=D.readFileSync(m,"utf8").match(/^project_name:\s*"?([^"\n]+)"?/m);A&&(g=A[1].trim())}catch{}let y=null,h=p.join(t,".planning","ROADMAP.md");if(!f&&D.existsSync(h))try{let C=D.readFileSync(h,"utf8"),A=C.match(/^\|\s*(\d+(?:\.\d+)?)\s*\|/m);if(A)y=String(parseInt(A[1],10));else{let T=C.match(/^#{2,4}\s*Phase\s+(\d+(?:\.\d+)?)/im);T&&(y=String(parseInt(T[1],10)))}}catch{}let w={version:"1",schema_version:2,project:g||p.basename(t),...f?{_seeded_stub:!0}:{},created:d,updated:d,current_phase:y,current_plan:0,current_sprint:null,phases:[],milestones:[],executions:[],decisions:[],blockers:[],council_sessions:[],chains:[],workstreams:[],active_workstream:null,last_session:null,velocity_history:[]};D.mkdirSync(p.dirname(c),{recursive:!0}),Et(c,JSON.stringify(w,null,2)+`
203
- `)}return!0}function P$(t,e={}){let r=e.commitPlanning!==!1,n="# ===== rcode-managed gitignore block (npx @hanzlaa/rcode install) =====",s="# ===== end rcode-managed gitignore block =====",i=["",n,"# Added automatically on first rcode install. Idempotent \u2014 safe to re-run.","# Edit `commit_planning` in .rcode/config.yaml to flip planning-artifact tracking.","","# Installed methodology files (regenerate with: npx @hanzlaa/rcode install)",".claude/",".rcode/bin/",".rcode/data/",".rcode/workflows/",".rcode/references/",".rcode/commands/",".rcode/skills/","","# Pulled rcode brain content (refresh with: rcode brain pull)",".rcode/brain/rcode-github/",".rcode/brain/rcode-docs/",".rcode/brain/best-practices/","","# Runtime noise","node_modules/",".rcode/state.json.lock",".planning/debug/",".planning/_backup/"];r||i.push("","# Planning artifacts \u2014 kept local (commit_planning: false)",".planning/"),i.push("","# What you DO commit:","# .rcode/config.yaml - project mode/language/profile/commit_planning","# .rcode/state.json - decisions, roadmap pointer, blockers","# .rcode/brain/sources.yaml - brain source manifest",r?"# .planning/ - PRD, roadmap, sprints, SUMMARY.md files":"# (planning artifacts are NOT committed \u2014 see commit_planning in config)",s,"");let o=i.join(`
202
+ `);let u=p.join(t,".rcode","state.json");function l(){let d=p.join(t,".planning","ROADMAP.md");if(!D.existsSync(d))return!0;try{return D.readFileSync(d,"utf8").includes("<!-- INSTALL STUB")}catch{return!0}}if(!D.existsSync(u)){let d=new Date().toISOString(),f=l(),g=null,m=p.join(t,".rcode","config.yaml");if(D.existsSync(m))try{let A=D.readFileSync(m,"utf8").match(/^project_name:\s*"?([^"\n]+)"?/m);A&&(g=A[1].trim())}catch{}let y=null,h=p.join(t,".planning","ROADMAP.md");if(!f&&D.existsSync(h))try{let C=D.readFileSync(h,"utf8"),A=C.match(/^\|\s*(\d+(?:\.\d+)?)\s*\|/m);if(A)y=String(parseInt(A[1],10));else{let T=C.match(/^#{2,4}\s*Phase\s+(\d+(?:\.\d+)?)/im);T&&(y=String(parseInt(T[1],10)))}}catch{}let w={version:"1",schema_version:2,project:g||p.basename(t),...f?{_seeded_stub:!0}:{},created:d,updated:d,current_phase:y,current_plan:0,current_sprint:null,phases:[],milestones:[],executions:[],decisions:[],blockers:[],council_sessions:[],chains:[],workstreams:[],active_workstream:null,last_session:null,velocity_history:[]};D.mkdirSync(p.dirname(u),{recursive:!0}),Oe(u,JSON.stringify(w,null,2)+`
203
+ `)}return!0}function N$(t,e={}){let r=e.commitPlanning!==!1,n="# ===== rcode-managed gitignore block (npx @hanzlaa/rcode install) =====",s="# ===== end rcode-managed gitignore block =====",i=["",n,"# Added automatically on first rcode install. Idempotent \u2014 safe to re-run.","# Edit `commit_planning` in .rcode/config.yaml to flip planning-artifact tracking.","","# Installed methodology files (regenerate with: npx @hanzlaa/rcode install)",".claude/",".rcode/bin/",".rcode/data/",".rcode/workflows/",".rcode/references/",".rcode/commands/",".rcode/skills/","","# Pulled rcode brain content (refresh with: rcode brain pull)",".rcode/brain/rcode-github/",".rcode/brain/rcode-docs/",".rcode/brain/best-practices/","","# Runtime noise","node_modules/",".rcode/state.json.lock",".planning/debug/",".planning/_backup/"];r||i.push("","# Planning artifacts \u2014 kept local (commit_planning: false)",".planning/"),i.push("","# What you DO commit:","# .rcode/config.yaml - project mode/language/profile/commit_planning","# .rcode/state.json - decisions, roadmap pointer, blockers","# .rcode/brain/sources.yaml - brain source manifest",r?"# .planning/ - PRD, roadmap, sprints, SUMMARY.md files":"# (planning artifacts are NOT committed \u2014 see commit_planning in config)",s,"");let o=i.join(`
204
204
  `),a=p.join(t,".gitignore");try{let l=function(d,f){let g=d.indexOf(n);if(g<0)return null;let m=d.indexOf(s,g);if(m<0){let w=g;return w>0&&d[w-1]===`
205
205
  `&&(w-=1),d.slice(0,w)+f}let y=g;y>0&&d[y-1]===`
206
206
  `&&(y-=1);let h=m+s.length;return d[h]===`
207
- `&&(h+=1),d.slice(0,y)+f+d.slice(h)};var u=l;if(!D.existsSync(a))return Et(a,o),{action:"created"};let c=D.readFileSync(a,"utf8");if(c.includes(n)){let d=l(c,o);return d!==null&&d!==c?(Et(a,d),{action:"updated"}):{action:"already-present"}}return Et(a,c+o),{action:"appended"}}catch(c){return{action:"skipped-error",error:c.message}}}function O$(t,e={}){if(e.gitHooks===!1)return{action:"skipped-flag"};let r=p.join(t,".git");if(!D.existsSync(r)||!D.statSync(r).isDirectory())return{action:"skipped-no-git"};let n="# ===== rcode-managed pre-commit block =====",s="# ===== end rcode pre-commit block =====",i=["",n,"# Auto-syncs .rcode/state.json when planning files change.","# Added by rcode install \u2014 safe to re-run (idempotent).",'if git diff --cached --name-only | grep -qE "^\\.planning/|^\\.rcode/brain/sources\\.yaml$"; then'," if [ -x .rcode/bin/rcode-tools.cjs ]; then"," node .rcode/bin/rcode-tools.cjs state sync --from-disk > /dev/null 2>&1 || true"," git add .rcode/state.json 2>/dev/null || true"," fi","fi",s,""].join(`
207
+ `&&(h+=1),d.slice(0,y)+f+d.slice(h)};var c=l;if(!D.existsSync(a))return Oe(a,o),{action:"created"};let u=D.readFileSync(a,"utf8");if(u.includes(n)){let d=l(u,o);return d!==null&&d!==u?(Oe(a,d),{action:"updated"}):{action:"already-present"}}return Oe(a,u+o),{action:"appended"}}catch(u){return{action:"skipped-error",error:u.message}}}function gg(t,e,r,n){try{let o=function(c,u){let l=c.indexOf(e);if(l<0)return null;let d=c.indexOf(r,l);if(d<0){let m=l;return m>0&&c[m-1]===`
208
+ `&&(m-=1),c.slice(0,m)+u}let f=l;f>0&&c[f-1]===`
209
+ `&&(f-=1);let g=d+r.length;return c[g]===`
210
+ `&&(g+=1),c.slice(0,f)+u+c.slice(g)};var s=o;if(!D.existsSync(t))return D.mkdirSync(p.dirname(t),{recursive:!0}),Oe(t,n),{action:"created"};let i=D.readFileSync(t,"utf8");if(i.includes(e)){let c=o(i,n);return c!==null&&c!==i?(Oe(t,c),{action:"updated"}):{action:"already-present"}}let a=i.endsWith(`
211
+ `)?`
212
+ `:`
213
+
214
+ `;return Oe(t,i+a+n),{action:"appended"}}catch(i){return{action:"skipped-error",error:i.message}}}function L$(t,e){let r={},n=new Set(e||[]),s=i=>[`## ${i}`,"","This project has [rcode](https://www.npmjs.com/package/@hanzlaa/rcode) installed \u2014","persistent project memory, specialist agents, and structured workflows under `.rcode/`.","","For any non-trivial task (new feature, bug fix that needs investigation, multi-file","change, planning) prefer routing through **`/rcode-do <task description>`** \u2014 rcode's","command picker \u2014 instead of working ad hoc. It picks the right rcode command (plan,","execute, review, debug, etc.) for the task and keeps `.rcode/state.json` and the","Memory Bank in sync. Skip it only for trivial single-line/single-file edits that","don't need planning or memory."].join(`
215
+ `);if(n.has("claude")||n.has("vscode")){let i="<!-- ===== rcode-managed rule block (npx @hanzlaa/rcode install) ===== -->",o="<!-- ===== end rcode-managed rule block ===== -->",a=`${i}
216
+
217
+ ${s("Working with rcode")}
218
+
219
+ ${o}
220
+ `;r.claude=gg(p.join(t,"CLAUDE.md"),i,o,a)}if(n.has("codex")){let i="<!-- ===== rcode-managed rule block (npx @hanzlaa/rcode install) ===== -->",o="<!-- ===== end rcode-managed rule block ===== -->",a=`${i}
221
+
222
+ ${s("Working with rcode")}
223
+
224
+ ${o}
225
+ `;r.codex=gg(p.join(t,"AGENTS.md"),i,o,a)}if(n.has("cursor")){let i=["---","description: Prefer rcode's /rcode-do command for non-trivial work","alwaysApply: true","---","",s("Working with rcode"),""].join(`
226
+ `);try{let o=p.join(t,".cursor","rules","rcode-prefer-do.mdc");D.mkdirSync(p.dirname(o),{recursive:!0}),Oe(o,i),r.cursor={action:"written"}}catch(o){r.cursor={action:"skipped-error",error:o.message}}}if(n.has("windsurf")){let i=["---","description: Prefer rcode's /rcode-do command for non-trivial work","trigger: always_on","---","",s("Working with rcode"),""].join(`
227
+ `);try{let o=p.join(t,".windsurf","rules","rcode-prefer-do.mdc");D.mkdirSync(p.dirname(o),{recursive:!0}),Oe(o,i),r.windsurf={action:"written"}}catch(o){r.windsurf={action:"skipped-error",error:o.message}}}return r}function B$(t,e={}){if(e.gitHooks===!1)return{action:"skipped-flag"};let r=p.join(t,".git");if(!D.existsSync(r)||!D.statSync(r).isDirectory())return{action:"skipped-no-git"};let n="# ===== rcode-managed pre-commit block =====",s="# ===== end rcode pre-commit block =====",i=["",n,"# Auto-syncs .rcode/state.json when planning files change.","# Added by rcode install \u2014 safe to re-run (idempotent).",'if git diff --cached --name-only | grep -qE "^\\.planning/|^\\.rcode/brain/sources\\.yaml$"; then'," if [ -x .rcode/bin/rcode-tools.cjs ]; then"," node .rcode/bin/rcode-tools.cjs state sync --from-disk > /dev/null 2>&1 || true"," git add .rcode/state.json 2>/dev/null || true"," fi","fi",s,""].join(`
208
228
  `),o=p.join(r,"hooks"),a=p.join(o,"pre-commit");try{let l=function(d,f){let g=d.indexOf(n);if(g<0)return null;let m=d.indexOf(s,g);if(m<0){let w=g;return w>0&&d[w-1]===`
209
229
  `&&(w-=1),d.slice(0,w)+f}let y=g;y>0&&d[y-1]===`
210
230
  `&&(y-=1);let h=m+s.length;return d[h]===`
211
- `&&(h+=1),d.slice(0,y)+f+d.slice(h)};var u=l;if(D.mkdirSync(o,{recursive:!0}),!D.existsSync(a))return Et(a,`#!/bin/sh
212
- ${i}`,{mode:493}),{action:"created"};let c=D.readFileSync(a,"utf8");if(c.includes(n)){let d=l(c,i);return d!==null&&d!==c?(Et(a,d,{mode:493}),{action:"updated"}):{action:"already-present"}}return Et(a,c+i,{mode:493}),{action:"appended"}}catch(c){return{action:"skipped-error",error:c.message}}}function N$(t,e){let r=p.join(t,"rcode","brain"),n=p.join(e,".rcode","brain");D.mkdirSync(n,{recursive:!0});let s=0;for(let o of["sources.yaml","README.md"]){let a=p.join(r,o),u=p.join(n,o);D.existsSync(a)&&!D.existsSync(u)&&(D.copyFileSync(a,u),s++)}let i=p.join(t,"rcode","skills","_shared");if(D.existsSync(i)){let o=p.join(n,"best-practices");D.mkdirSync(o,{recursive:!0});for(let a of D.readdirSync(i,{withFileTypes:!0}))if(a.isFile()&&a.name.endsWith(".md")){let u=p.join(o,a.name);D.existsSync(u)||(D.copyFileSync(p.join(i,a.name),u),s++)}}return s}function mg(t,e,r={}){let n=p.join(t,"rcode/skills"),s=p.join(e,".claude/skills"),i=p.join(e,".rcode/skills");if(!D.existsSync(n))return{count:0,skippedGlobal:0};D.mkdirSync(s,{recursive:!0}),D.mkdirSync(i,{recursive:!0});let o=p.join(Xe(),".claude","skills"),a=r.skipGlobalDuplicates&&D.existsSync(o)?new Set(D.readdirSync(o).filter(m=>m.startsWith("rcode-"))):new Set,u=0,c=0,l=new Map;function d(m){if(l.has(m))return l.get(m);let y=p.join(m,"SKILL.md");if(!D.existsSync(y))return l.set(m,!1),!1;let h=D.readFileSync(y,"utf8"),w=/^internal:\s*true\s*$/m.test(h);return l.set(m,w),w}function f(m){if(!D.existsSync(m))return!1;try{return D.readdirSync(m).some(y=>y.endsWith(".local.md"))}catch{return!1}}function g(m){if(D.existsSync(m))for(let y of D.readdirSync(m,{withFileTypes:!0})){if(!y.isDirectory())continue;let h=p.join(m,y.name);if(D.existsSync(p.join(h,"SKILL.md"))){let C=y.name.startsWith("rcode-")?y.name:`rcode-${y.name}`,A=d(h),T=A?p.join(i,C):p.join(s,C);if(!A&&a.has(C)&&!f(T)){if(D.existsSync(T))try{Yu(T,e)}catch{}c++;continue}yg(h,T),u++}else g(h)}}for(let m of["agents","actions","core"])g(p.join(n,m));return{count:u,skippedGlobal:c}}function Gu(t){if(!t.startsWith(`---
231
+ `&&(h+=1),d.slice(0,y)+f+d.slice(h)};var c=l;if(D.mkdirSync(o,{recursive:!0}),!D.existsSync(a))return Oe(a,`#!/bin/sh
232
+ ${i}`,{mode:493}),{action:"created"};let u=D.readFileSync(a,"utf8");if(u.includes(n)){let d=l(u,i);return d!==null&&d!==u?(Oe(a,d,{mode:493}),{action:"updated"}):{action:"already-present"}}return Oe(a,u+i,{mode:493}),{action:"appended"}}catch(u){return{action:"skipped-error",error:u.message}}}function M$(t,e){let r=p.join(t,"rcode","brain"),n=p.join(e,".rcode","brain");D.mkdirSync(n,{recursive:!0});let s=0;for(let o of["sources.yaml","README.md"]){let a=p.join(r,o),c=p.join(n,o);D.existsSync(a)&&!D.existsSync(c)&&(D.copyFileSync(a,c),s++)}let i=p.join(t,"rcode","skills","_shared");if(D.existsSync(i)){let o=p.join(n,"best-practices");D.mkdirSync(o,{recursive:!0});for(let a of D.readdirSync(i,{withFileTypes:!0}))if(a.isFile()&&a.name.endsWith(".md")){let c=p.join(o,a.name);D.existsSync(c)||(D.copyFileSync(p.join(i,a.name),c),s++)}}return s}function Dg(t,e,r={}){let n=p.join(t,"rcode/skills"),s=p.join(e,".claude/skills"),i=p.join(e,".rcode/skills");if(!D.existsSync(n))return{count:0,skippedGlobal:0};D.mkdirSync(s,{recursive:!0}),D.mkdirSync(i,{recursive:!0});let o=p.join(Qe(),".claude","skills"),a=r.skipGlobalDuplicates&&D.existsSync(o)?new Set(D.readdirSync(o).filter(m=>m.startsWith("rcode-"))):new Set,c=0,u=0,l=new Map;function d(m){if(l.has(m))return l.get(m);let y=p.join(m,"SKILL.md");if(!D.existsSync(y))return l.set(m,!1),!1;let h=D.readFileSync(y,"utf8"),w=/^internal:\s*true\s*$/m.test(h);return l.set(m,w),w}function f(m){if(!D.existsSync(m))return!1;try{return D.readdirSync(m).some(y=>y.endsWith(".local.md"))}catch{return!1}}function g(m){if(D.existsSync(m))for(let y of D.readdirSync(m,{withFileTypes:!0})){if(!y.isDirectory())continue;let h=p.join(m,y.name);if(D.existsSync(p.join(h,"SKILL.md"))){let C=y.name.startsWith("rcode-")?y.name:`rcode-${y.name}`,A=d(h),T=A?p.join(i,C):p.join(s,C);if(!A&&a.has(C)&&!f(T)){if(D.existsSync(T))try{Jc(T,e)}catch{}u++;continue}_g(h,T),c++}else g(h)}}for(let m of["agents","actions","core"])g(p.join(n,m));return{count:c,skippedGlobal:u}}function zc(t){if(!t.startsWith(`---
213
233
  `))return{frontmatter:{},body:t};let e=t.indexOf(`
214
234
  ---
215
235
  `,4);if(e===-1)return{frontmatter:{},body:t};let r=t.slice(4,e),n=t.slice(e+5),s={};for(let i of r.split(`
216
- `)){let o=i.replace(/^#.*$/,"").trimEnd();if(!o)continue;let a=o.indexOf(":");if(a===-1)continue;let u=o.slice(0,a).trim(),c=o.slice(a+1).trim();!u||!c||(c.startsWith('"')&&c.endsWith('"')&&(c=c.slice(1,-1)),c.startsWith("'")&&c.endsWith("'")&&(c=c.slice(1,-1)),s[u]=c)}return{frontmatter:s,body:n}}function vg(t){let e=p.join(t,".claude","commands","rcode"),r=p.join(t,".claude","commands");if(!D.existsSync(e)||!D.statSync(e).isDirectory())return{moved:0,removed_dir:!1};let n=0;for(let i of D.readdirSync(e)){let o=p.join(e,i);if(!D.statSync(o).isFile()||!i.endsWith(".md"))continue;let u=p.basename(i,".md").startsWith("rcode-")?i:`rcode-${i}`,c=p.join(r,u);if(D.existsSync(c)){D.unlinkSync(o);continue}D.renameSync(o,c),n++}let s=!1;try{D.rmdirSync(e),s=!0}catch{}return{moved:n,removed_dir:s}}function Ku(t="claude",e=process.cwd()){if(Array.isArray(t)){let f=new Set,g=[];for(let m of t)for(let y of Ku(m,e)){let h=y.rel;f.has(h)||(f.add(h),g.push(y))}return g}let r=[],n=Xu(t,e),s=p.relative(e,n.workflowsDir),i=p.relative(e,n.referencesDir),o=p.relative(e,n.binDir),a=p.relative(e,n.agentsDir),u=p.relative(e,n.commandsDir);for(let f of Fr(p.join($e,"workflows"))){let g=p.relative(p.join($e,"workflows"),f);r.push({src:f,rel:p.join(s,g)})}for(let f of Fr(p.join($e,"references"))){let g=p.relative(p.join($e,"references"),f);r.push({src:f,rel:p.join(i,g)})}for(let f of Fr(p.join($e,"bin"))){let g=p.relative(p.join($e,"bin"),f);r.push({src:f,rel:p.join(o,g),executable:f.endsWith(".cjs")})}for(let f of Fr(p.join($e,"data"))){let g=p.relative(p.join($e,"data"),f);r.push({src:f,rel:p.join(".rcode","data",g)})}let c=p.join($e,"templates","projects"),l=p.relative(e,p.join(e,".rcode","templates","projects"));for(let f of Fr(c)){let g=p.relative(c,f);r.push({src:f,rel:p.join(l,g)})}for(let f of Fr(p.join($e,"agents"))){let g=p.relative(p.join($e,"agents"),f),m=t==="cursor"?".mdc":".md",y=p.basename(f,".md")+m;r.push({src:f,rel:p.join(a,p.dirname(g),y),ide:t,cursor:t==="cursor"})}for(let f of Fr(p.join($e,"commands"))){let g=p.relative(p.join($e,"commands"),f),m=t==="cursor"?".mdc":".md",y=p.basename(f,".md"),h=t==="claude"||t==="vscode"||t==="grok"?`rcode-${y}${m}`:y+m;r.push({src:f,rel:p.join(u,p.dirname(g),h),ide:t,cursor:t==="cursor"})}let d=p.join(e,".rcode","agents-rules");for(let f of Fr(p.join($e,"agents","rules"))){let g=p.relative(p.join($e,"agents","rules"),f);r.push({src:f,rel:p.join(".rcode","agents-rules",g)})}return r}function L$(t){let e=p.join($e,"modules",`${t}.yaml`);if(!D.existsSync(e))return null;let r=D.readFileSync(e,"utf8"),n={name:t,requires:[],agents:[],workflows:[],commands:[],references:[]},s=null;for(let i of r.split(`
217
- `)){let o=i.replace(/#.*$/,"").trimEnd();if(!o.trim())continue;let a=o.match(/^(\w+):/);if(a&&!o.startsWith(" ")&&!o.startsWith("-")){let u=a[1],c=o.slice(o.indexOf(":")+1).trim();["agents","workflows","commands","references","requires"].includes(u)?(s=u,c&&c!=="[]"&&(n[u]=c.replace(/^\[|\]$/g,"").split(",").map(l=>l.trim().replace(/^["']|["']$/g,"")).filter(Boolean))):(s=null,u==="name"&&(n.name=c.replace(/^["']|["']$/g,"")));continue}if(s&&o.trim().startsWith("-")){let u=o.trim().slice(1).trim().replace(/^["']|["']$/g,"");u&&n[s].push(u)}}return n}function _g(){let t=p.join($e,"modules");return D.existsSync(t)?D.readdirSync(t).filter(e=>e.endsWith(".yaml")).map(e=>e.replace(".yaml","")):[]}function B$(t,e){if(e.length===0)return t;let r=new Set;for(let n of e){let s=L$(n);if(!s){console.warn(` \u26A0 Unknown module: ${n}`);continue}for(let i of s.agents)r.add(p.join(".claude","agents",i));for(let i of s.workflows)r.add(p.join(".rcode","workflows",i));for(let i of s.commands)r.add(p.join(".claude","commands",`rcode-${i}`));for(let i of s.references)r.add(p.join(".rcode","references",i))}return t.filter(n=>n.rel.startsWith(p.join(".rcode","bin"))||n.rel.startsWith(p.join(".rcode","data"))?!0:r.has(n.rel))}function M$(t,e){let r=[["id","file","name","description","color"]],n=new Set,s=new Map,i=u=>(s.has(u)||s.set(u,D.readFileSync(u,"utf8")),s.get(u));for(let u of t){if(!u.rel.startsWith(p.join(".claude","agents"))||!u.rel.match(/^\.claude[\/\\]agents[\/\\][^\/\\]+\.md$/))continue;let c=p.join(e,u.rel),l=i(c),{frontmatter:d}=Gu(l),f=d.name||p.basename(u.rel,".md"),g=f.replace(/^rcode-/,"");if(n.has(g))continue;n.add(g);let m=(d.description||"").replace(/"/g,'""');r.push([g,u.rel,f,`"${m}"`,d.color||""])}let o=p.join(e,".claude","agents");if(D.existsSync(o)){let u=D.readdirSync(o).filter(l=>l.startsWith("rcode-")&&l.endsWith(".md")),c=new Set(t.filter(l=>l.rel.startsWith(p.join(".claude","agents"))).map(l=>p.basename(l.rel)));for(let l of u){if(c.has(l))continue;let d=p.join(o,l),f=i(d),{frontmatter:g}=Gu(f),m=g.name||p.basename(l,".md"),y=m.replace(/^rcode-/,"");if(n.has(y))continue;n.add(y);let h=(g.description||"").replace(/"/g,'""');r.push([y,p.join(".claude","agents",l),m,`"${h}"`,g.color||""])}}let a=[p.join(Xe(),".claude","agents"),p.join(Xe(),".rcode","agents")];try{let u=p.join($e,"agents");D.existsSync(u)&&a.push(u)}catch{}for(let u of a){if(!D.existsSync(u))continue;let c;try{c=D.readdirSync(u).filter(l=>l.startsWith("rcode-")&&l.endsWith(".md"))}catch{continue}for(let l of c){let d=p.join(u,l),f;try{f=i(d)}catch{continue}let{frontmatter:g}=Gu(f),m=g.name||p.basename(l,".md"),y=m.replace(/^rcode-/,"");if(n.has(y))continue;n.add(y);let h=(g.description||"").replace(/"/g,'""');r.push([y,p.join(".claude","agents",l),m,`"${h}"`,g.color||""])}}return r.map(u=>u.join(",")).join(`
236
+ `)){let o=i.replace(/^#.*$/,"").trimEnd();if(!o)continue;let a=o.indexOf(":");if(a===-1)continue;let c=o.slice(0,a).trim(),u=o.slice(a+1).trim();!c||!u||(u.startsWith('"')&&u.endsWith('"')&&(u=u.slice(1,-1)),u.startsWith("'")&&u.endsWith("'")&&(u=u.slice(1,-1)),s[c]=u)}return{frontmatter:s,body:n}}function bg(t){let e=p.join(t,".claude","commands","rcode"),r=p.join(t,".claude","commands");if(!D.existsSync(e)||!D.statSync(e).isDirectory())return{moved:0,removed_dir:!1};let n=0;for(let i of D.readdirSync(e)){let o=p.join(e,i);if(!D.statSync(o).isFile()||!i.endsWith(".md"))continue;let c=p.basename(i,".md").startsWith("rcode-")?i:`rcode-${i}`,u=p.join(r,c);if(D.existsSync(u)){D.unlinkSync(o);continue}D.renameSync(o,u),n++}let s=!1;try{D.rmdirSync(e),s=!0}catch{}return{moved:n,removed_dir:s}}function Qc(t="claude",e=process.cwd()){if(Array.isArray(t)){let f=new Set,g=[];for(let m of t)for(let y of Qc(m,e)){let h=y.rel;f.has(h)||(f.add(h),g.push(y))}return g}let r=[],n=Kc(t,e),s=p.relative(e,n.workflowsDir),i=p.relative(e,n.referencesDir),o=p.relative(e,n.binDir),a=p.relative(e,n.agentsDir),c=p.relative(e,n.commandsDir);for(let f of Ir(p.join(Ae,"workflows"))){let g=p.relative(p.join(Ae,"workflows"),f);r.push({src:f,rel:p.join(s,g)})}for(let f of Ir(p.join(Ae,"references"))){let g=p.relative(p.join(Ae,"references"),f);r.push({src:f,rel:p.join(i,g)})}for(let f of Ir(p.join(Ae,"bin"))){let g=p.relative(p.join(Ae,"bin"),f);r.push({src:f,rel:p.join(o,g),executable:f.endsWith(".cjs")})}for(let f of Ir(p.join(Ae,"data"))){let g=p.relative(p.join(Ae,"data"),f);r.push({src:f,rel:p.join(".rcode","data",g)})}let u=p.join(Ae,"templates","projects"),l=p.relative(e,p.join(e,".rcode","templates","projects"));for(let f of Ir(u)){let g=p.relative(u,f);r.push({src:f,rel:p.join(l,g)})}for(let f of Ir(p.join(Ae,"agents"))){let g=p.relative(p.join(Ae,"agents"),f),m=t==="cursor"?".mdc":".md",y=p.basename(f,".md")+m;r.push({src:f,rel:p.join(a,p.dirname(g),y),ide:t,cursor:t==="cursor"})}for(let f of Ir(p.join(Ae,"commands"))){let g=p.relative(p.join(Ae,"commands"),f),m=t==="cursor"?".mdc":".md",y=p.basename(f,".md"),h=t==="claude"||t==="vscode"||t==="grok"?`rcode-${y}${m}`:y+m;r.push({src:f,rel:p.join(c,p.dirname(g),h),ide:t,cursor:t==="cursor"})}let d=p.join(e,".rcode","agents-rules");for(let f of Ir(p.join(Ae,"agents","rules"))){let g=p.relative(p.join(Ae,"agents","rules"),f);r.push({src:f,rel:p.join(".rcode","agents-rules",g)})}return r}function q$(t){let e=p.join(Ae,"modules",`${t}.yaml`);if(!D.existsSync(e))return null;let r=D.readFileSync(e,"utf8"),n={name:t,requires:[],agents:[],workflows:[],commands:[],references:[]},s=null;for(let i of r.split(`
237
+ `)){let o=i.replace(/#.*$/,"").trimEnd();if(!o.trim())continue;let a=o.match(/^(\w+):/);if(a&&!o.startsWith(" ")&&!o.startsWith("-")){let c=a[1],u=o.slice(o.indexOf(":")+1).trim();["agents","workflows","commands","references","requires"].includes(c)?(s=c,u&&u!=="[]"&&(n[c]=u.replace(/^\[|\]$/g,"").split(",").map(l=>l.trim().replace(/^["']|["']$/g,"")).filter(Boolean))):(s=null,c==="name"&&(n.name=u.replace(/^["']|["']$/g,"")));continue}if(s&&o.trim().startsWith("-")){let c=o.trim().slice(1).trim().replace(/^["']|["']$/g,"");c&&n[s].push(c)}}return n}function Sg(){let t=p.join(Ae,"modules");return D.existsSync(t)?D.readdirSync(t).filter(e=>e.endsWith(".yaml")).map(e=>e.replace(".yaml","")):[]}function W$(t,e){if(e.length===0)return t;let r=new Set;for(let n of e){let s=q$(n);if(!s){console.warn(` \u26A0 Unknown module: ${n}`);continue}for(let i of s.agents)r.add(p.join(".claude","agents",i));for(let i of s.workflows)r.add(p.join(".rcode","workflows",i));for(let i of s.commands)r.add(p.join(".claude","commands",`rcode-${i}`));for(let i of s.references)r.add(p.join(".rcode","references",i))}return t.filter(n=>n.rel.startsWith(p.join(".rcode","bin"))||n.rel.startsWith(p.join(".rcode","data"))?!0:r.has(n.rel))}function H$(t,e){let r=[["id","file","name","description","color"]],n=new Set,s=new Map,i=c=>(s.has(c)||s.set(c,D.readFileSync(c,"utf8")),s.get(c));for(let c of t){if(!c.rel.startsWith(p.join(".claude","agents"))||!c.rel.match(/^\.claude[\/\\]agents[\/\\][^\/\\]+\.md$/))continue;let u=p.join(e,c.rel),l=i(u),{frontmatter:d}=zc(l),f=d.name||p.basename(c.rel,".md"),g=f.replace(/^rcode-/,"");if(n.has(g))continue;n.add(g);let m=(d.description||"").replace(/"/g,'""');r.push([g,c.rel,f,`"${m}"`,d.color||""])}let o=p.join(e,".claude","agents");if(D.existsSync(o)){let c=D.readdirSync(o).filter(l=>l.startsWith("rcode-")&&l.endsWith(".md")),u=new Set(t.filter(l=>l.rel.startsWith(p.join(".claude","agents"))).map(l=>p.basename(l.rel)));for(let l of c){if(u.has(l))continue;let d=p.join(o,l),f=i(d),{frontmatter:g}=zc(f),m=g.name||p.basename(l,".md"),y=m.replace(/^rcode-/,"");if(n.has(y))continue;n.add(y);let h=(g.description||"").replace(/"/g,'""');r.push([y,p.join(".claude","agents",l),m,`"${h}"`,g.color||""])}}let a=[p.join(Qe(),".claude","agents"),p.join(Qe(),".rcode","agents")];try{let c=p.join(Ae,"agents");D.existsSync(c)&&a.push(c)}catch{}for(let c of a){if(!D.existsSync(c))continue;let u;try{u=D.readdirSync(c).filter(l=>l.startsWith("rcode-")&&l.endsWith(".md"))}catch{continue}for(let l of u){let d=p.join(c,l),f;try{f=i(d)}catch{continue}let{frontmatter:g}=zc(f),m=g.name||p.basename(l,".md"),y=m.replace(/^rcode-/,"");if(n.has(y))continue;n.add(y);let h=(g.description||"").replace(/"/g,'""');r.push([y,p.join(".claude","agents",l),m,`"${h}"`,g.color||""])}}return r.map(c=>c.join(",")).join(`
218
238
  `)+`
219
- `}function q$(t,e,{mergeExistingManifest:r=!1,extraScanDirs:n=[]}={}){let s=[["rel","sha256","size"]],i=new Set,o=new Map,a=c=>(o.has(c)||o.set(c,D.readFileSync(c)),o.get(c));for(let c of t){let l=p.join(e,c.rel);if(!D.existsSync(l))continue;let d=a(l),f=c.rel.split(p.sep).join("/");s.push([f,jn(d),String(d.length)]),i.add(f)}function u(c){if(D.existsSync(c))for(let l of D.readdirSync(c,{withFileTypes:!0})){let d=p.join(c,l.name);if(l.isDirectory())u(d);else if(l.isFile()){let f=p.relative(e,d).split(p.sep).join("/");if(i.has(f)||f.startsWith("..")||p.isAbsolute(f))continue;try{let g=a(d);s.push([f,jn(g),String(g.length)]),i.add(f)}catch{}}}}for(let c of n)u(c);if(r){let c=p.join(e,".rcode","_config","files-manifest.csv");if(D.existsSync(c))try{let l=D.readFileSync(c,"utf8").split(`
220
- `).slice(1).filter(Boolean);for(let d of l){let[f]=d.split(",");if(!f||i.has(f))continue;let g=p.join(e,f);if(!D.existsSync(g))continue;let m=a(g);s.push([f,jn(m),String(m.length)]),i.add(f)}}catch{}}return s.map(c=>c.join(",")).join(`
239
+ `}function Z$(t,e,{mergeExistingManifest:r=!1,extraScanDirs:n=[]}={}){let s=[["rel","sha256","size"]],i=new Set,o=new Map,a=u=>(o.has(u)||o.set(u,D.readFileSync(u)),o.get(u));for(let u of t){let l=p.join(e,u.rel);if(!D.existsSync(l))continue;let d=a(l),f=u.rel.split(p.sep).join("/");s.push([f,Tn(d),String(d.length)]),i.add(f)}function c(u){if(D.existsSync(u))for(let l of D.readdirSync(u,{withFileTypes:!0})){let d=p.join(u,l.name);if(l.isDirectory())c(d);else if(l.isFile()){let f=p.relative(e,d).split(p.sep).join("/");if(i.has(f)||f.startsWith("..")||p.isAbsolute(f))continue;try{let g=a(d);s.push([f,Tn(g),String(g.length)]),i.add(f)}catch{}}}}for(let u of n)c(u);if(r){let u=p.join(e,".rcode","_config","files-manifest.csv");if(D.existsSync(u))try{let l=D.readFileSync(u,"utf8").split(`
240
+ `).slice(1).filter(Boolean);for(let d of l){let[f]=d.split(",");if(!f||i.has(f))continue;let g=p.join(e,f);if(!D.existsSync(g))continue;let m=a(g);s.push([f,Tn(m),String(m.length)]),i.add(f)}}catch{}}return s.map(u=>u.join(",")).join(`
221
241
  `)+`
222
- `}function W$(t,e){let r=p.join(t,".rcode","_config","files-manifest.csv");if(!D.existsSync(r))return 0;let n;try{n=D.readFileSync(r,"utf8").split(`
223
- `).slice(1).filter(Boolean).map(f=>f.split(",")[0]).filter(Boolean)}catch{return 0}let s=new Set(e.map(d=>d.rel.split(p.sep).join("/"))),i=/^(\.rcode\/config\.yaml|\.rcode\/state\.json|\.rcode\/state\.json\.lock|\.planning\/|\.rcode\/brain\/sources\.yaml)/,o=d=>/\.local\.(md|mdc|json|yaml|yml|toml|js|ts)$/.test(d),a=0,u=new Set,c=p.resolve(t);for(let d of n){if(s.has(d)||i.test(d)||o(d)||d.includes("..")||p.isAbsolute(d))continue;let f=p.join(t,d);if(!D.existsSync(f))continue;Yu(f,c).ok&&(u.add(p.dirname(f)),a+=1)}let l=Array.from(u).sort((d,f)=>f.length-d.length);for(let d of l)try{D.existsSync(d)&&D.readdirSync(d).length===0&&D.rmdirSync(d)}catch(f){console.error("[install] sweepStaleInstalledFiles: failed to remove empty dir",d+":",f?.message||f)}return a}function H$(t){let e=p.join(t,"package.json"),r=p.join(t,"pnpm-lock.yaml");if(!D.existsSync(e)||!D.existsSync(r))return{ok:!0};try{let n=JSON.parse(D.readFileSync(e,"utf8")),s=Object.prototype.hasOwnProperty.call(n.dependencies||{},"@hanzlaa/rcode"),i=Object.prototype.hasOwnProperty.call(n.devDependencies||{},"@hanzlaa/rcode");return!s&&!i?{ok:!1,message:"@hanzlaa/rcode not found in package.json \u2014 if you ran `pnpm add -D @hanzlaa/rcode` and it reported success, your lockfile may be corrupted.\n Fix: pnpm install --fix-lockfile && pnpm add -D @hanzlaa/rcode"}:{ok:!0}}catch{return{ok:!0}}}function Ze(){try{return JSON.parse(D.readFileSync(p.join(lt,"package.json"),"utf8")).version||"0.0.0"}catch{return"0.0.0"}}function gg(t){let e=Ze(),r=t.modules.length>0?t.modules:_g(),n=[],s=null,i=p.join(t.target,".rcode","_config","manifest.yaml");if(D.existsSync(i)){let c=D.readFileSync(i,"utf8"),l=!1;for(let d of c.split(`
224
- `)){if(d.startsWith("version:")){let f=d.replace("version:","").trim();Fn.valid(f)&&f!==e&&(s=f)}if(d.startsWith("modules:")){l=!0;continue}l&&d.trim().startsWith("-")?n.push(d.trim().slice(1).trim()):l&&!d.startsWith(" ")&&(l=!1)}}let a=[...new Set([...n,...r])].map(c=>` - ${c}`).join(`
225
- `),u=["# rcode v2 install manifest",`version: ${e}`,`installDate: ${new Date().toISOString()}`];return s&&u.push(`previous_version: ${s}`),u.push("modules:",a,"ides:"," - claude-code",""),u.join(`
226
- `)}function Oo(t){return(t||"").replace(/[\n\r]/g," ").replace(/"/g,'\\"')}function Z$(t){return["# rcode v2 project config","# Generated by install. Safe to edit.",`user_name: "${Oo(t.userName)}"`,`project_name: "${Oo(t.projectName)}"`,`communication_language: "${Oo(t.language)}"`,`mode: "${Oo(t.mode)}"`,'model_profile: "balanced"',`commit_planning: ${t.commitPlanning!==!1}`,"workflow:"," research_by_default: false"," plan_checker: true"," post_execute_gates: true"," ui_safety_gate: true","git:",' branching_strategy: "none"',""].join(`
227
- `)}function U$(t){let e=k$.safeParse(t);return e.success?{valid:!0}:{valid:!1,errors:e.error.issues.map(n=>` ${n.path.join(".")||"(root)"}: ${n.message}`)}}function V$(t){let e={},r=null;for(let n of t.split(`
228
- `)){let s=n.replace(/#.*$/,"");if(!s.trim())continue;let i=s.match(/^(\s*)/)[1].length;if(i===0){let o=s.indexOf(":");if(o===-1)continue;let a=s.slice(0,o).trim(),u=s.slice(o+1).trim();if(u===""){r=a,e[a]={};continue}r=null,u.startsWith('"')&&u.endsWith('"')&&(u=u.slice(1,-1)),u.startsWith("'")&&u.endsWith("'")&&(u=u.slice(1,-1)),u==="true"?u=!0:u==="false"&&(u=!1),e[a]=u}else if(r&&i>0){let o=s.indexOf(":");if(o===-1)continue;let a=s.slice(0,o).trim(),u=s.slice(o+1).trim();u.startsWith('"')&&u.endsWith('"')&&(u=u.slice(1,-1)),u==="true"?u=!0:u==="false"&&(u=!1),e[r][a]=u}}return e}async function Qu(t){if(t.help)return Dg(),0;if(t.reset&&!t.force)return console.log(""),console.log(" "+St("--reset has no effect without --force.")),console.log(" "+Y(" --reset wipes config.yaml and state.json. To prevent accidental data loss,")),console.log(" "+Y(" it must be paired with --force. Re-run as:")),console.log(" "+Y(" rcode install --reset --force")),console.log(""),2;let e=()=>{};if(!t.global){let r=G$(t.target);if(!r.ok)return console.log(""),console.log(" "+St(`Another install is already running here (PID ${r.pid}).`)),console.log(" "+Y(` Lock: ${r.lockPath}`)),console.log(" "+Y(" If the other process crashed, delete the lock file and retry:")),console.log(" "+Y(` rm ${r.lockPath}`)),console.log(""),3;e=r.release,process.on("exit",e)}try{return await z$(t)}finally{e(),process.removeListener("exit",e)}}function G$(t){let e=p.join(t,".rcode"),r=p.join(e,".install.lock");try{D.mkdirSync(e,{recursive:!0})}catch{}function n(s){try{return process.kill(s,0),!0}catch{return!1}}for(let s=0;s<2;s++)try{let i=D.openSync(r,"wx");return D.writeSync(i,String(process.pid)),D.closeSync(i),{ok:!0,release:()=>{try{D.unlinkSync(r)}catch(o){console.error("[install] acquireInstallLock: failed to release lock",r+":",o?.message||o)}}}}catch(i){if(i.code!=="EEXIST")throw i;let o=0;try{o=parseInt(D.readFileSync(r,"utf8"),10)}catch(a){console.error("[install] acquireInstallLock: failed to read lock pid from",r+":",a?.message||a)}if(o&&!n(o)){try{D.unlinkSync(r)}catch{}continue}return{ok:!1,pid:o,lockPath:r}}return{ok:!1,pid:0,lockPath:r}}function ec(t){let e=Xe(),r=p.join(e,".rcode","slash-commands"),n=p.join(e,".rcode","bin");Tt(r),Tt(n);let s=p.join($e,"commands"),i=0;for(let u of D.readdirSync(s))u.endsWith(".md")&&(D.copyFileSync(p.join(s,u),p.join(r,u)),i++);let o=p.join(lt,"cli","rcode-slash-router.cjs"),a=p.join(n,"rcode-slash-router.cjs");return D.copyFileSync(o,a),t&&t.global!=="silent"&&console.log(" "+ir(`Slash-router: ${i} command bodies \u2192 ~/.rcode/slash-commands/ + router \u2192 ~/.rcode/bin/`)),a}function bg(){return`node "${p.join(Xe(),".rcode","bin","rcode-slash-router.cjs")}"`}function Sg(t,e,r,n){let s={};if(D.existsSync(t))try{s=JSON.parse(D.readFileSync(t,"utf8"))||{}}catch{return console.log(" "+St(`${n}: ${t} is not valid JSON \u2014 skipped slash-router wiring.`)),!1}return(!s.hooks||typeof s.hooks!="object")&&(s.hooks={}),Array.isArray(s.hooks[e])||(s.hooks[e]=[]),s.hooks[e].some(o=>Array.isArray(o?.hooks)&&o.hooks.some(a=>typeof a?.command=="string"&&a.command.includes("rcode-slash-router.cjs")))?(console.log(" "+ir(`${n}: slash-router hook already present (idempotent).`)),!1):(s.hooks[e].push({hooks:[{type:"command",command:r,timeout:10}]}),Tt(p.dirname(t)),D.writeFileSync(t,JSON.stringify(s,null,2)+`
229
- `),console.log(" "+ir(`${n}: wired slash-router into ${e} hook (existing hooks preserved).`)),!0)}function Eg(t){ec(t);let e=p.join(Xe(),".codex","hooks.json");Sg(e,"UserPromptSubmit",bg(),"Codex")}function Cg(t){ec(t);let e=p.join(Xe(),".gemini","antigravity","settings.json");Sg(e,"UserPrompt",bg(),"Antigravity")}function zu(t){if(!t||!t.global)return;let e=Array.isArray(t.ides)?t.ides:[t.ide].filter(Boolean);for(let r of e)switch(r){case"codex":Eg(t);break;case"antigravity":Cg(t);break;default:break}}async function z$(t){let e=Ze();process.stdin.isTTY&&!t.yes&&A$(e),t.ides=await F$(t),t.commitPlanning=await j$(t),t.enableHooks=await I$(t),console.log(`
230
- \u{1F54C} ${It("rcode")} ${J.cyan("v"+e)} ${Y("\u2192")} ${t.target}`);let n=p.join(t.target,".rcode","_config","manifest.yaml");if(D.existsSync(n)){let $=D.readFileSync(n,"utf8").match(/^version:\s*(.+)$/m),R=$?$[1].trim():"unknown",j=Fn.valid(R)&&Fn.valid(e)?Fn.lt(R,e):R!==e;console.log(j?" "+Po(`Upgrading ${J.dim("v"+R)} \u2192 ${J.green("v"+e)} (config + state + .planning preserved)`):" "+Po(`Refreshing v${R} (config + state + .planning preserved)`)),t.force||console.log(Y(" Pass --force to also sweep orphaned files from the previous version."))}if(!D.existsSync($e))return console.error(`\u2716 Source tree not found at ${$e}. Running from wrong dir?`),1;t.ides=t.ides.map($=>$==="claude-code"?"claude":$);let s=t.ides.filter($=>!os.includes($));if(s.length>0)return console.error(`\u2716 --ide ${s.join(", ")} is not supported in v${Ze()}.`),console.error(""),console.error(" Currently supported:"),console.error(" claude \u2014 Claude Code native (recommended)"),console.error(" cursor \u2014 Cursor IDE"),console.error(" codex \u2014 Codex CLI"),console.error(" gemini \u2014 Gemini CLI (planned \u2014 not yet implemented)"),console.error(" vscode \u2014 VS Code (with Claude Code / Continue / Copilot extension)"),console.error(" windsurf \u2014 Windsurf (Codeium)"),console.error(" antigravity \u2014 Antigravity (experimental)"),console.error(" grok \u2014 Grok Build (xAI CLI, Claude-Code-compatible)"),console.error(""),console.error(" Tracked for future:"),console.error(" jetbrains \u2014 IntelliJ / PyCharm"),console.error(" zed \u2014 Zed editor"),console.error(""),1;if(t.ides.includes("vscode")&&console.log(" "+Y("VS Code \u2192 installing to .claude/ paths (read by Claude Code / Continue / Copilot extensions).")),t.ides.includes("codex")&&(console.log(" "+Y("Codex \u2192 installing to .claude/ paths + AGENTS.md. Use `rcode workflow show <name>` to feed workflows to Codex.")),t.global||console.log(" "+St("Codex /rcode-* slash commands need a GLOBAL install \u2014 re-run with `--global` to wire the ~/.codex/hooks.json router. This project-local install does NOT enable them."))),t.ides.includes("gemini")&&(console.log(`
242
+ `}function U$(t,e){let r=p.join(t,".rcode","_config","files-manifest.csv");if(!D.existsSync(r))return 0;let n;try{n=D.readFileSync(r,"utf8").split(`
243
+ `).slice(1).filter(Boolean).map(f=>f.split(",")[0]).filter(Boolean)}catch{return 0}let s=new Set(e.map(d=>d.rel.split(p.sep).join("/"))),i=/^(\.rcode\/config\.yaml|\.rcode\/state\.json|\.rcode\/state\.json\.lock|\.planning\/|\.rcode\/brain\/sources\.yaml)/,o=d=>/\.local\.(md|mdc|json|yaml|yml|toml|js|ts)$/.test(d),a=0,c=new Set,u=p.resolve(t);for(let d of n){if(s.has(d)||i.test(d)||o(d)||d.includes("..")||p.isAbsolute(d))continue;let f=p.join(t,d);if(!D.existsSync(f))continue;Jc(f,u).ok&&(c.add(p.dirname(f)),a+=1)}let l=Array.from(c).sort((d,f)=>f.length-d.length);for(let d of l)try{D.existsSync(d)&&D.readdirSync(d).length===0&&D.rmdirSync(d)}catch(f){console.error("[install] sweepStaleInstalledFiles: failed to remove empty dir",d+":",f?.message||f)}return a}function V$(t){let e=p.join(t,"package.json"),r=p.join(t,"pnpm-lock.yaml");if(!D.existsSync(e)||!D.existsSync(r))return{ok:!0};try{let n=JSON.parse(D.readFileSync(e,"utf8")),s=Object.prototype.hasOwnProperty.call(n.dependencies||{},"@hanzlaa/rcode"),i=Object.prototype.hasOwnProperty.call(n.devDependencies||{},"@hanzlaa/rcode");return!s&&!i?{ok:!1,message:"@hanzlaa/rcode not found in package.json \u2014 if you ran `pnpm add -D @hanzlaa/rcode` and it reported success, your lockfile may be corrupted.\n Fix: pnpm install --fix-lockfile && pnpm add -D @hanzlaa/rcode"}:{ok:!0}}catch{return{ok:!0}}}function Ve(){try{return JSON.parse(D.readFileSync(p.join(dt,"package.json"),"utf8")).version||"0.0.0"}catch{return"0.0.0"}}function yg(t){let e=Ve(),r=t.modules.length>0?t.modules:Sg(),n=[],s=null,i=p.join(t.target,".rcode","_config","manifest.yaml");if(D.existsSync(i)){let u=D.readFileSync(i,"utf8"),l=!1;for(let d of u.split(`
244
+ `)){if(d.startsWith("version:")){let f=d.replace("version:","").trim();In.valid(f)&&f!==e&&(s=f)}if(d.startsWith("modules:")){l=!0;continue}l&&d.trim().startsWith("-")?n.push(d.trim().slice(1).trim()):l&&!d.startsWith(" ")&&(l=!1)}}let a=[...new Set([...n,...r])].map(u=>` - ${u}`).join(`
245
+ `),c=["# rcode v2 install manifest",`version: ${e}`,`installDate: ${new Date().toISOString()}`];return s&&c.push(`previous_version: ${s}`),c.push("modules:",a,"ides:"," - claude-code",""),c.join(`
246
+ `)}function No(t){return(t||"").replace(/[\n\r]/g," ").replace(/"/g,'\\"')}function G$(t){return["# rcode v2 project config","# Generated by install. Safe to edit.",`user_name: "${No(t.userName)}"`,`project_name: "${No(t.projectName)}"`,`communication_language: "${No(t.language)}"`,`mode: "${No(t.mode)}"`,'model_profile: "balanced"',`commit_planning: ${t.commitPlanning!==!1}`,"workflow:"," research_by_default: false"," plan_checker: true"," post_execute_gates: true"," ui_safety_gate: true","git:",' branching_strategy: "none"',""].join(`
247
+ `)}function z$(t){let e=A$.safeParse(t);return e.success?{valid:!0}:{valid:!1,errors:e.error.issues.map(n=>` ${n.path.join(".")||"(root)"}: ${n.message}`)}}function Y$(t){let e={},r=null;for(let n of t.split(`
248
+ `)){let s=n.replace(/#.*$/,"");if(!s.trim())continue;let i=s.match(/^(\s*)/)[1].length;if(i===0){let o=s.indexOf(":");if(o===-1)continue;let a=s.slice(0,o).trim(),c=s.slice(o+1).trim();if(c===""){r=a,e[a]={};continue}r=null,c.startsWith('"')&&c.endsWith('"')&&(c=c.slice(1,-1)),c.startsWith("'")&&c.endsWith("'")&&(c=c.slice(1,-1)),c==="true"?c=!0:c==="false"&&(c=!1),e[a]=c}else if(r&&i>0){let o=s.indexOf(":");if(o===-1)continue;let a=s.slice(0,o).trim(),c=s.slice(o+1).trim();c.startsWith('"')&&c.endsWith('"')&&(c=c.slice(1,-1)),c==="true"?c=!0:c==="false"&&(c=!1),e[r][a]=c}}return e}async function eu(t){if(t.help)return vg(),0;if(t.reset&&!t.force)return console.log(""),console.log(" "+Et("--reset has no effect without --force.")),console.log(" "+Y(" --reset wipes config.yaml and state.json. To prevent accidental data loss,")),console.log(" "+Y(" it must be paired with --force. Re-run as:")),console.log(" "+Y(" rcode install --reset --force")),console.log(""),2;let e=()=>{};if(!t.global){let r=J$(t.target);if(!r.ok)return console.log(""),console.log(" "+Et(`Another install is already running here (PID ${r.pid}).`)),console.log(" "+Y(` Lock: ${r.lockPath}`)),console.log(" "+Y(" If the other process crashed, delete the lock file and retry:")),console.log(" "+Y(` rm ${r.lockPath}`)),console.log(""),3;e=r.release,process.on("exit",e)}try{return await X$(t)}finally{e(),process.removeListener("exit",e)}}function J$(t){let e=p.join(t,".rcode"),r=p.join(e,".install.lock");try{D.mkdirSync(e,{recursive:!0})}catch{}function n(s){try{return process.kill(s,0),!0}catch{return!1}}for(let s=0;s<2;s++)try{let i=D.openSync(r,"wx");return D.writeSync(i,String(process.pid)),D.closeSync(i),{ok:!0,release:()=>{try{D.unlinkSync(r)}catch(o){console.error("[install] acquireInstallLock: failed to release lock",r+":",o?.message||o)}}}}catch(i){if(i.code!=="EEXIST")throw i;let o=0;try{o=parseInt(D.readFileSync(r,"utf8"),10)}catch(a){console.error("[install] acquireInstallLock: failed to read lock pid from",r+":",a?.message||a)}if(o&&!n(o)){try{D.unlinkSync(r)}catch{}continue}return{ok:!1,pid:o,lockPath:r}}return{ok:!1,pid:0,lockPath:r}}function tu(t){let e=Qe(),r=p.join(e,".rcode","slash-commands"),n=p.join(e,".rcode","bin");Rt(r),Rt(n);let s=p.join(Ae,"commands"),i=0;for(let c of D.readdirSync(s))c.endsWith(".md")&&(D.copyFileSync(p.join(s,c),p.join(r,c)),i++);let o=p.join(dt,"cli","rcode-slash-router.cjs"),a=p.join(n,"rcode-slash-router.cjs");return D.copyFileSync(o,a),t&&t.global!=="silent"&&console.log(" "+ar(`Slash-router: ${i} command bodies \u2192 ~/.rcode/slash-commands/ + router \u2192 ~/.rcode/bin/`)),a}function Eg(){return`node "${p.join(Qe(),".rcode","bin","rcode-slash-router.cjs")}"`}function Cg(t,e,r,n){let s={};if(D.existsSync(t))try{s=JSON.parse(D.readFileSync(t,"utf8"))||{}}catch{return console.log(" "+Et(`${n}: ${t} is not valid JSON \u2014 skipped slash-router wiring.`)),!1}return(!s.hooks||typeof s.hooks!="object")&&(s.hooks={}),Array.isArray(s.hooks[e])||(s.hooks[e]=[]),s.hooks[e].some(o=>Array.isArray(o?.hooks)&&o.hooks.some(a=>typeof a?.command=="string"&&a.command.includes("rcode-slash-router.cjs")))?(console.log(" "+ar(`${n}: slash-router hook already present (idempotent).`)),!1):(s.hooks[e].push({hooks:[{type:"command",command:r,timeout:10}]}),Rt(p.dirname(t)),D.writeFileSync(t,JSON.stringify(s,null,2)+`
249
+ `),console.log(" "+ar(`${n}: wired slash-router into ${e} hook (existing hooks preserved).`)),!0)}function wg(t){tu(t);let e=p.join(Qe(),".codex","hooks.json");Cg(e,"UserPromptSubmit",Eg(),"Codex")}function xg(t){tu(t);let e=p.join(Qe(),".gemini","antigravity","settings.json");Cg(e,"UserPrompt",Eg(),"Antigravity")}function Yc(t){if(!t||!t.global)return;let e=Array.isArray(t.ides)?t.ides:[t.ide].filter(Boolean);for(let r of e)switch(r){case"codex":wg(t);break;case"antigravity":xg(t);break;default:break}}async function X$(t){let e=Ve();process.stdin.isTTY&&!t.yes&&j$(e),t.ides=await I$(t),t.commitPlanning=await T$(t),t.enableHooks=await R$(t),console.log(`
250
+ \u{1F54C} ${Tt("rcode")} ${J.cyan("v"+e)} ${Y("\u2192")} ${t.target}`);let n=p.join(t.target,".rcode","_config","manifest.yaml");if(D.existsSync(n)){let $=D.readFileSync(n,"utf8").match(/^version:\s*(.+)$/m),j=$?$[1].trim():"unknown",O=In.valid(j)&&In.valid(e)?In.lt(j,e):j!==e;console.log(O?" "+Oo(`Upgrading ${J.dim("v"+j)} \u2192 ${J.green("v"+e)} (config + state + .planning preserved)`):" "+Oo(`Refreshing v${j} (config + state + .planning preserved)`)),t.force||console.log(Y(" Pass --force to also sweep orphaned files from the previous version."))}if(!D.existsSync(Ae))return console.error(`\u2716 Source tree not found at ${Ae}. Running from wrong dir?`),1;t.ides=t.ides.map($=>$==="claude-code"?"claude":$);let s=t.ides.filter($=>!as.includes($));if(s.length>0)return console.error(`\u2716 --ide ${s.join(", ")} is not supported in v${Ve()}.`),console.error(""),console.error(" Currently supported:"),console.error(" claude \u2014 Claude Code native (recommended)"),console.error(" cursor \u2014 Cursor IDE"),console.error(" codex \u2014 Codex CLI"),console.error(" gemini \u2014 Gemini CLI (planned \u2014 not yet implemented)"),console.error(" vscode \u2014 VS Code (with Claude Code / Continue / Copilot extension)"),console.error(" windsurf \u2014 Windsurf (Codeium)"),console.error(" antigravity \u2014 Antigravity (experimental)"),console.error(" grok \u2014 Grok Build (xAI CLI, Claude-Code-compatible)"),console.error(""),console.error(" Tracked for future:"),console.error(" jetbrains \u2014 IntelliJ / PyCharm"),console.error(" zed \u2014 Zed editor"),console.error(""),1;if(t.ides.includes("vscode")&&console.log(" "+Y("VS Code \u2192 installing to .claude/ paths (read by Claude Code / Continue / Copilot extensions).")),t.ides.includes("codex")&&(console.log(" "+Y("Codex \u2192 installing to .claude/ paths + AGENTS.md. Use `rcode workflow show <name>` to feed workflows to Codex.")),t.global||console.log(" "+Et("Codex /rcode-* slash commands need a GLOBAL install \u2014 re-run with `--global` to wire the ~/.codex/hooks.json router. This project-local install does NOT enable them."))),t.ides.includes("gemini")&&(console.log(`
231
251
  \u26A0\uFE0F Gemini CLI install not yet implemented
232
252
  `),console.log("Gemini IDE requires aggregating all agents and commands into a single GEMINI.md file."),console.log(`This feature is planned but not yet available.
233
253
  `),console.log(`For now, use: --ide claude or --ide cursor
234
- `),t.ides=t.ides.filter($=>$!=="gemini"),t.ides.length===0))return 1;if(t.ides.includes("antigravity")&&(t.global?(console.log(" "+St("Antigravity install is experimental. Files land at .antigravity/rcode/{agents,commands}/.")),console.log(" "+Y("If Antigravity expects a different path, adjust .rcode/config.yaml and re-run."))):console.log(" "+St("Antigravity /rcode-* slash commands need a GLOBAL install \u2014 re-run with `--global`. Skipping .antigravity/ files on this project-local install (they would be inert)."))),t.modules.length>0){let $=_g(),R=t.modules.filter(j=>!$.includes(j));if(R.length>0)return console.error(`\u2716 Unknown module(s): ${R.join(", ")}`),console.error(` Available modules: ${$.join(", ")}`),1}if(Array.isArray(t.ides)&&t.ides.includes("vscode")||t.ide==="vscode"){let $=vg(t.target);$.moved>0&&console.log(` \u21BB Migrated ${$.moved} legacy vscode-layout command(s) to .claude/commands/rcode-{name}.md`)}let i=!t.global&&Array.isArray(t.ides)?t.ides.filter($=>$!=="antigravity"):t.ides,o=Ku(i,t.target),a=B$(o,t.modules);if(a.length===0)return Array.isArray(t.ides)&&t.ides.includes("antigravity")&&!t.global?(console.error("\u2716 Nothing to install \u2014 Antigravity was the only target IDE, and its files need a GLOBAL install."),console.error(" Re-run with --global, or pick another --ide."),1):(console.error("\u2716 Nothing to install \u2014 install plan is empty."),t.modules.length>0&&console.error(` Modules requested: ${t.modules.join(", ")}`),1);if(t.modules.length>0&&console.log(` Modules: ${t.modules.join(", ")}`),t.dryRun||t.listFiles){console.log("DRY RUN: the following paths would be written:");for(let $ of a)console.log(" + "+$.rel);return 0}if(t.forceOverwrite&&!t.noBackup){let $=$$(t.target,a);if($.ok)console.log(" "+Po(`${J.dim("--force-overwrite")} backup: ${J.cyan($.path)} ${J.dim("("+$.fileCount+" files \u2014 restore with: tar -xzf "+$.path+")")}`));else if($.fileCount>0)return console.error(""),console.error(`\u2716 Could not create backup: ${$.warning}`),console.error(" Refusing to --force-overwrite without a backup. Pass --no-backup to override."),console.error(""),1}let u=0;t.force&&(u=W$(t.target,a));let c=new Map;if(t.nonDestructive){let $=p.join(t.target,".rcode","_config","files-manifest.csv");if(D.existsSync($))try{let R=D.readFileSync($,"utf8").split(`
235
- `).slice(1).filter(Boolean);for(let j of R){let[z,ee]=j.split(",");z&&ee&&c.set(z,ee)}}catch{}}let l=0,d=0,f=0,g=0,m=[],y=[],h=[],w=C$(Y(`Installing ${a.length} files\u2026`),{color:"cyan"}).start();for(let $ of a){let R=p.join(t.target,$.rel),j=$.rel.split(p.sep).join("/");Tt(p.dirname(R));let z=null,ee=null,xe=()=>(z||(z=D.readFileSync(R)),z),wt=()=>(ee||(ee=D.readFileSync($.src)),ee);if(t.nonDestructive&&!t.forceOverwrite&&!t.acceptAll&&D.existsSync(R)){let Nt=c.get(j);if(Nt){let cr=xe().toString("utf8");if(jn(xe())!==Nt){let Xt=wt().toString("utf8"),Ic=fg(j,j,cr,Xt,"installed","source"),Tc=0,Rc=0;for(let Ss of Ic.split(`
236
- `))Ss.startsWith("+")&&!Ss.startsWith("+++")&&Tc++,Ss.startsWith("-")&&!Ss.startsWith("---")&&Rc++;f+=1,m.push(j),y.push({rel:j,insertions:Tc,deletions:Rc,patch:Ic}),d+=1;continue}}}if(D.existsSync(R)&&!t.force&&!t.forceOverwrite){let Nt=jn(xe()),cr=jn(wt());if(Nt===cr){d++;continue}if(!t.yes&&!t.nonDestructive){h.push({rel:j,src:$.src,destPath:R,existingContent:xe().toString("utf8"),sourceContent:wt().toString("utf8")}),d++;continue}}if(D.existsSync(R)&&t.forceOverwrite){let Nt=xe(),cr=wt();Nt.equals(cr)||w.update({text:Y(`overwriting ${$.rel}`)})}let Ot=wt().toString("utf8");$.cursor&&(Ot=Ot),D.writeFileSync(R,Ot,"utf8"),$.executable&&D.chmodSync(R,493),l++}if(w.success({text:ir(`${l} files installed`)}),h.length>0){let $={workflows:[],agents:[],commands:[],skills:[],references:[],other:[]};for(let R of h)R.rel.includes("/workflows/")?$.workflows.push(R):R.rel.includes("/agents/")?$.agents.push(R):R.rel.includes("/commands/")?$.commands.push(R):R.rel.includes("/skills/")?$.skills.push(R):R.rel.includes("/references/")?$.references.push(R):$.other.push(R);console.log(""),console.log(" "+St(`${h.length} file${h.length===1?"":"s"} have local edits AND v${Ze()} updates:`));for(let[R,j]of Object.entries($))j.length!==0&&console.log(" "+Y(`${j.length} ${R}`));if(console.log(""),!t.yes&&process.stdin.isTTY){let R=await Re.select({message:"How should we handle these?",initialValue:"review",options:[{value:"review",label:"Review each one",hint:"see the diff, decide per file"},{value:"upstream",label:"Take v"+Ze()+" for all",hint:"lose local edits, get all bug fixes"},{value:"keep",label:"Keep my local edits",hint:"skip v"+Ze()+" updates for these files (current behaviour)"}]});if(Re.isCancel(R))Re.note("Skipped \u2014 local edits preserved.");else if(R==="upstream"){let j=0;for(let z of h)D.writeFileSync(z.destPath,z.sourceContent,"utf8"),j++;g+=j,console.log(" "+ir(`Applied v${Ze()} to ${j} file${j===1?"":"s"}.`))}else if(R==="review"){let j=0,z=0;for(let ee of h){let xe=fg(ee.rel,ee.rel,ee.existingContent,ee.sourceContent,"local","v"+Ze()),wt=0,Ot=0;for(let lr of xe.split(`
237
- `))lr.startsWith("+")&&!lr.startsWith("+++")&&wt++,lr.startsWith("-")&&!lr.startsWith("---")&&Ot++;console.log(""),console.log(" "+J.bold(ee.rel)+Y(" ")+J.green(`+${wt}`)+" "+J.red(`-${Ot}`));let Nt=await Re.select({message:"Take upstream, keep local, or view diff?",initialValue:"view",options:[{value:"upstream",label:"Take v"+Ze()},{value:"keep",label:"Keep local"},{value:"view",label:"View diff first"}]}),cr=Nt;if(Re.isCancel(Nt)||Nt==="view"){for(let Xt of xe.split(`
238
- `).slice(4))Xt.startsWith("+")?process.stdout.write(J.green(Xt)+`
239
- `):Xt.startsWith("-")?process.stdout.write(J.red(Xt)+`
240
- `):Xt.startsWith("@")?process.stdout.write(J.cyan(Xt)+`
241
- `):process.stdout.write(Y(Xt)+`
242
- `);let lr=await Re.select({message:"Now: take upstream or keep local?",initialValue:"keep",options:[{value:"upstream",label:"Take v"+Ze()},{value:"keep",label:"Keep local"}]});cr=Re.isCancel(lr)?"keep":lr}cr==="upstream"?(D.writeFileSync(ee.destPath,ee.sourceContent,"utf8"),j++):z++}g+=j,console.log(" "+ir(`Review complete: ${j} applied, ${z} kept local.`))}else console.log(" "+Y(`${h.length} file${h.length===1?"":"s"} kept local. Re-run with --force-overwrite or 'rcode update' anytime.`))}else console.log(" "+Y(`Re-run with --force-overwrite to apply v${Ze()} updates, or pipe through an interactive shell to resolve per-file.`));console.log("")}if(g>0&&(console.log(" "+ir(`Total this run: ${l} installed \xB7 ${g} updated \xB7 ${f+d} unchanged.`)),console.log("")),t.global){let $=p.join(t.target,".rcode","_config");Tt($),D.writeFileSync(p.join($,"manifest.yaml"),gg(t));let j=mg(lt,t.target).count;try{let{main:z}=require(p.join(lt,"cli","generate-command-skills.cjs")),ee=p.join(t.target,".claude","skills"),xe=z(lt,ee,Ze(),{skipGlobalDuplicates:!0});j+=xe.generated}catch{}console.log(""),console.log(` ${Y(`${j} skills installed globally`)}`);try{zu(t)}catch(z){process.stderr.write(J.yellow(`WARNING: native slash-command install skipped: ${z?.message||z}`)+`
243
- `)}return 0}let C=p.join(Xe(),".claude","commands"),A=p.join(t.target,".claude","commands"),T=t.target!==Xe()&&!t.localOnly;if(T&&!t.forceOverwrite)try{let $=D.existsSync(C)&&(D.readdirSync(C).some(j=>j.startsWith("rcode-")&&j.endsWith(".md"))||D.existsSync(p.join(C,"rcode"))),R=D.existsSync(A)&&(D.readdirSync(A).some(j=>j.startsWith("rcode-")&&j.endsWith(".md"))||D.existsSync(p.join(A,"rcode")));if($&&!R){let j=a.length,z=a.filter(ee=>!ee.rel.split(p.sep).join("/").startsWith(".claude/commands/"));z.length<j&&(a.length=0,z.forEach(ee=>a.push(ee)),console.log(" "+Y("Global rcode commands detected in ~/.claude/ \u2014 skipping project-level command install to avoid duplicates.")),console.log(" "+Y("Use --force-overwrite to install locally anyway.")))}else if($&&R){try{let z=D.readdirSync(A).filter(xe=>xe.startsWith("rcode-")&&xe.endsWith(".md"));for(let xe of z)D.unlinkSync(p.join(A,xe));let ee=p.join(A,"rcode");D.existsSync(ee)&&Yu(ee,t.target),console.log(" "+Y("Removed duplicate project-level rcode commands (global ones in ~/.claude/ take precedence)."))}catch{}let j=a.filter(z=>!z.rel.split(p.sep).join("/").startsWith(".claude/commands/"));a.length=0,j.forEach(z=>a.push(z))}}catch{}let V=p.join(t.target,".rcode","_config");Tt(V),Tt(p.join(t.target,".planning")),D.writeFileSync(p.join(V,"manifest.yaml"),gg(t)),D.writeFileSync(p.join(V,"agent-manifest.csv"),M$(a,t.target));let I=p.join(t.target,".rcode","config.yaml"),H=p.join(t.target,".rcode","state.json"),F=!1;if(t.reset&&t.force?(D.existsSync(I)&&D.unlinkSync(I),D.existsSync(H)&&D.unlinkSync(H)):t.force&&(D.existsSync(I)||D.existsSync(H))&&(F=!0),!D.existsSync(I))Et(I,Z$(t));else try{let $=D.readFileSync(I,"utf8"),R=t.commitPlanning!==!1,j=/^commit_planning:\s*(true|false)\s*$/m,z=$.match(j),ee=z?z[1]==="true":null;if(z&&ee!==R){let xe=$.replace(j,`commit_planning: ${R}`);Et(I,xe),console.log(" "+Y(`Updated commit_planning in config.yaml (${ee} \u2192 ${R}) \u2014 closes #685.`))}else if(!z){let xe=$.replace(/\n*$/,"")+`
244
- commit_planning: ${R}
245
- `;Et(I,xe)}}catch{}try{let $=D.readFileSync(I,"utf8"),R=V$($),j=U$(R);if(!j.valid){console.log(""),console.log(" "+St("config.yaml has validation errors:"));for(let z of j.errors)console.log(J.yellow(z));console.log(Y(" \u2192 Edit .rcode/config.yaml to fix, then run /rcode-status"))}}catch{}if(!D.existsSync(H)){let $=p.join($e,"state.json");if(D.existsSync($)){let R=new Date().toISOString(),j=JSON.stringify(String(t.projectName||p.basename(t.target))).slice(1,-1),z=D.readFileSync($,"utf8").replace(/__PROJECT_NAME__/g,j).replace(/__INSTALL_DATE__/g,R),ee=p.join(t.target,".planning","ROADMAP.md");if(D.existsSync(ee))try{D.readFileSync(ee,"utf8").includes("<!-- INSTALL STUB")||(z=z.replace(/^\s*"_seeded_stub":\s*true,?\s*\n/m,""))}catch{}Tt(p.dirname(H)),Et(H,z)}}Tt(p.join(t.target,".planning","council-sessions"));let q=p.join(t.target,".rcode","context");Tt(q);let P=p.join(q,"active.md"),b=p.join(q,"project-brief.md");D.existsSync(P)||D.writeFileSync(P,`# Active Context
254
+ `),t.ides=t.ides.filter($=>$!=="gemini"),t.ides.length===0))return 1;if(t.ides.includes("antigravity")&&(t.global?(console.log(" "+Et("Antigravity install is experimental. Files land at .antigravity/rcode/{agents,commands}/.")),console.log(" "+Y("If Antigravity expects a different path, adjust .rcode/config.yaml and re-run."))):console.log(" "+Et("Antigravity /rcode-* slash commands need a GLOBAL install \u2014 re-run with `--global`. Skipping .antigravity/ files on this project-local install (they would be inert)."))),t.modules.length>0){let $=Sg(),j=t.modules.filter(O=>!$.includes(O));if(j.length>0)return console.error(`\u2716 Unknown module(s): ${j.join(", ")}`),console.error(` Available modules: ${$.join(", ")}`),1}if(Array.isArray(t.ides)&&t.ides.includes("vscode")||t.ide==="vscode"){let $=bg(t.target);$.moved>0&&console.log(` \u21BB Migrated ${$.moved} legacy vscode-layout command(s) to .claude/commands/rcode-{name}.md`)}let i=!t.global&&Array.isArray(t.ides)?t.ides.filter($=>$!=="antigravity"):t.ides,o=Qc(i,t.target),a=W$(o,t.modules);if(a.length===0)return Array.isArray(t.ides)&&t.ides.includes("antigravity")&&!t.global?(console.error("\u2716 Nothing to install \u2014 Antigravity was the only target IDE, and its files need a GLOBAL install."),console.error(" Re-run with --global, or pick another --ide."),1):(console.error("\u2716 Nothing to install \u2014 install plan is empty."),t.modules.length>0&&console.error(` Modules requested: ${t.modules.join(", ")}`),1);if(t.modules.length>0&&console.log(` Modules: ${t.modules.join(", ")}`),t.dryRun||t.listFiles){console.log("DRY RUN: the following paths would be written:");for(let $ of a)console.log(" + "+$.rel);return 0}if(t.forceOverwrite&&!t.noBackup){let $=F$(t.target,a);if($.ok)console.log(" "+Oo(`${J.dim("--force-overwrite")} backup: ${J.cyan($.path)} ${J.dim("("+$.fileCount+" files \u2014 restore with: tar -xzf "+$.path+")")}`));else if($.fileCount>0)return console.error(""),console.error(`\u2716 Could not create backup: ${$.warning}`),console.error(" Refusing to --force-overwrite without a backup. Pass --no-backup to override."),console.error(""),1}let c=0;t.force&&(c=U$(t.target,a));let u=new Map;if(t.nonDestructive){let $=p.join(t.target,".rcode","_config","files-manifest.csv");if(D.existsSync($))try{let j=D.readFileSync($,"utf8").split(`
255
+ `).slice(1).filter(Boolean);for(let O of j){let[q,se]=O.split(",");q&&se&&u.set(q,se)}}catch{}}let l=0,d=0,f=0,g=0,m=[],y=[],h=[],w=x$(Y(`Installing ${a.length} files\u2026`),{color:"cyan"}).start();for(let $ of a){let j=p.join(t.target,$.rel),O=$.rel.split(p.sep).join("/");Rt(p.dirname(j));let q=null,se=null,ke=()=>(q||(q=D.readFileSync(j)),q),xt=()=>(se||(se=D.readFileSync($.src)),se);if(t.nonDestructive&&!t.forceOverwrite&&!t.acceptAll&&D.existsSync(j)){let Lt=u.get(O);if(Lt){let dr=ke().toString("utf8");if(Tn(ke())!==Lt){let Kt=xt().toString("utf8"),Tu=hg(O,O,dr,Kt,"installed","source"),Ru=0,Pu=0;for(let Es of Tu.split(`
256
+ `))Es.startsWith("+")&&!Es.startsWith("+++")&&Ru++,Es.startsWith("-")&&!Es.startsWith("---")&&Pu++;f+=1,m.push(O),y.push({rel:O,insertions:Ru,deletions:Pu,patch:Tu}),d+=1;continue}}}if(D.existsSync(j)&&!t.force&&!t.forceOverwrite){let Lt=Tn(ke()),dr=Tn(xt());if(Lt===dr){d++;continue}if(!t.yes&&!t.nonDestructive){h.push({rel:O,src:$.src,destPath:j,existingContent:ke().toString("utf8"),sourceContent:xt().toString("utf8")}),d++;continue}}if(D.existsSync(j)&&t.forceOverwrite){let Lt=ke(),dr=xt();Lt.equals(dr)||w.update({text:Y(`overwriting ${$.rel}`)})}let Nt=xt().toString("utf8");$.cursor&&(Nt=Nt),D.writeFileSync(j,Nt,"utf8"),$.executable&&D.chmodSync(j,493),l++}if(w.success({text:ar(`${l} files installed`)}),h.length>0){let $={workflows:[],agents:[],commands:[],skills:[],references:[],other:[]};for(let j of h)j.rel.includes("/workflows/")?$.workflows.push(j):j.rel.includes("/agents/")?$.agents.push(j):j.rel.includes("/commands/")?$.commands.push(j):j.rel.includes("/skills/")?$.skills.push(j):j.rel.includes("/references/")?$.references.push(j):$.other.push(j);console.log(""),console.log(" "+Et(`${h.length} file${h.length===1?"":"s"} have local edits AND v${Ve()} updates:`));for(let[j,O]of Object.entries($))O.length!==0&&console.log(" "+Y(`${O.length} ${j}`));if(console.log(""),!t.yes&&process.stdin.isTTY){let j=await Pe.select({message:"How should we handle these?",initialValue:"review",options:[{value:"review",label:"Review each one",hint:"see the diff, decide per file"},{value:"upstream",label:"Take v"+Ve()+" for all",hint:"lose local edits, get all bug fixes"},{value:"keep",label:"Keep my local edits",hint:"skip v"+Ve()+" updates for these files (current behaviour)"}]});if(Pe.isCancel(j))Pe.note("Skipped \u2014 local edits preserved.");else if(j==="upstream"){let O=0;for(let q of h)D.writeFileSync(q.destPath,q.sourceContent,"utf8"),O++;g+=O,console.log(" "+ar(`Applied v${Ve()} to ${O} file${O===1?"":"s"}.`))}else if(j==="review"){let O=0,q=0;for(let se of h){let ke=hg(se.rel,se.rel,se.existingContent,se.sourceContent,"local","v"+Ve()),xt=0,Nt=0;for(let fr of ke.split(`
257
+ `))fr.startsWith("+")&&!fr.startsWith("+++")&&xt++,fr.startsWith("-")&&!fr.startsWith("---")&&Nt++;console.log(""),console.log(" "+J.bold(se.rel)+Y(" ")+J.green(`+${xt}`)+" "+J.red(`-${Nt}`));let Lt=await Pe.select({message:"Take upstream, keep local, or view diff?",initialValue:"view",options:[{value:"upstream",label:"Take v"+Ve()},{value:"keep",label:"Keep local"},{value:"view",label:"View diff first"}]}),dr=Lt;if(Pe.isCancel(Lt)||Lt==="view"){for(let Kt of ke.split(`
258
+ `).slice(4))Kt.startsWith("+")?process.stdout.write(J.green(Kt)+`
259
+ `):Kt.startsWith("-")?process.stdout.write(J.red(Kt)+`
260
+ `):Kt.startsWith("@")?process.stdout.write(J.cyan(Kt)+`
261
+ `):process.stdout.write(Y(Kt)+`
262
+ `);let fr=await Pe.select({message:"Now: take upstream or keep local?",initialValue:"keep",options:[{value:"upstream",label:"Take v"+Ve()},{value:"keep",label:"Keep local"}]});dr=Pe.isCancel(fr)?"keep":fr}dr==="upstream"?(D.writeFileSync(se.destPath,se.sourceContent,"utf8"),O++):q++}g+=O,console.log(" "+ar(`Review complete: ${O} applied, ${q} kept local.`))}else console.log(" "+Y(`${h.length} file${h.length===1?"":"s"} kept local. Re-run with --force-overwrite or 'rcode update' anytime.`))}else console.log(" "+Y(`Re-run with --force-overwrite to apply v${Ve()} updates, or pipe through an interactive shell to resolve per-file.`));console.log("")}if(g>0&&(console.log(" "+ar(`Total this run: ${l} installed \xB7 ${g} updated \xB7 ${f+d} unchanged.`)),console.log("")),t.global){let $=p.join(t.target,".rcode","_config");Rt($),D.writeFileSync(p.join($,"manifest.yaml"),yg(t));let O=Dg(dt,t.target).count;try{let{main:q}=require(p.join(dt,"cli","generate-command-skills.cjs")),se=p.join(t.target,".claude","skills"),ke=q(dt,se,Ve(),{skipGlobalDuplicates:!0});O+=ke.generated}catch{}console.log(""),console.log(` ${Y(`${O} skills installed globally`)}`);try{Yc(t)}catch(q){process.stderr.write(J.yellow(`WARNING: native slash-command install skipped: ${q?.message||q}`)+`
263
+ `)}return 0}let C=p.join(Qe(),".claude","commands"),A=p.join(t.target,".claude","commands"),T=t.target!==Qe()&&!t.localOnly;if(T&&!t.forceOverwrite)try{let $=D.existsSync(C)&&(D.readdirSync(C).some(O=>O.startsWith("rcode-")&&O.endsWith(".md"))||D.existsSync(p.join(C,"rcode"))),j=D.existsSync(A)&&(D.readdirSync(A).some(O=>O.startsWith("rcode-")&&O.endsWith(".md"))||D.existsSync(p.join(A,"rcode")));if($&&!j){let O=a.length,q=a.filter(se=>!se.rel.split(p.sep).join("/").startsWith(".claude/commands/"));q.length<O&&(a.length=0,q.forEach(se=>a.push(se)),console.log(" "+Y("Global rcode commands detected in ~/.claude/ \u2014 skipping project-level command install to avoid duplicates.")),console.log(" "+Y("Use --force-overwrite to install locally anyway.")))}else if($&&j){try{let q=D.readdirSync(A).filter(ke=>ke.startsWith("rcode-")&&ke.endsWith(".md"));for(let ke of q)D.unlinkSync(p.join(A,ke));let se=p.join(A,"rcode");D.existsSync(se)&&Jc(se,t.target),console.log(" "+Y("Removed duplicate project-level rcode commands (global ones in ~/.claude/ take precedence)."))}catch{}let O=a.filter(q=>!q.rel.split(p.sep).join("/").startsWith(".claude/commands/"));a.length=0,O.forEach(q=>a.push(q))}}catch{}let G=p.join(t.target,".rcode","_config");Rt(G),Rt(p.join(t.target,".planning")),D.writeFileSync(p.join(G,"manifest.yaml"),yg(t)),D.writeFileSync(p.join(G,"agent-manifest.csv"),H$(a,t.target));let I=p.join(t.target,".rcode","config.yaml"),Z=p.join(t.target,".rcode","state.json"),F=!1;if(t.reset&&t.force?(D.existsSync(I)&&D.unlinkSync(I),D.existsSync(Z)&&D.unlinkSync(Z)):t.force&&(D.existsSync(I)||D.existsSync(Z))&&(F=!0),!D.existsSync(I))Oe(I,G$(t));else try{let $=D.readFileSync(I,"utf8"),j=t.commitPlanning!==!1,O=/^commit_planning:\s*(true|false)\s*$/m,q=$.match(O),se=q?q[1]==="true":null;if(q&&se!==j){let ke=$.replace(O,`commit_planning: ${j}`);Oe(I,ke),console.log(" "+Y(`Updated commit_planning in config.yaml (${se} \u2192 ${j}) \u2014 closes #685.`))}else if(!q){let ke=$.replace(/\n*$/,"")+`
264
+ commit_planning: ${j}
265
+ `;Oe(I,ke)}}catch{}try{let $=D.readFileSync(I,"utf8"),j=Y$($),O=z$(j);if(!O.valid){console.log(""),console.log(" "+Et("config.yaml has validation errors:"));for(let q of O.errors)console.log(J.yellow(q));console.log(Y(" \u2192 Edit .rcode/config.yaml to fix, then run /rcode-status"))}}catch{}if(!D.existsSync(Z)){let $=p.join(Ae,"state.json");if(D.existsSync($)){let j=new Date().toISOString(),O=JSON.stringify(String(t.projectName||p.basename(t.target))).slice(1,-1),q=D.readFileSync($,"utf8").replace(/__PROJECT_NAME__/g,O).replace(/__INSTALL_DATE__/g,j),se=p.join(t.target,".planning","ROADMAP.md");if(D.existsSync(se))try{D.readFileSync(se,"utf8").includes("<!-- INSTALL STUB")||(q=q.replace(/^\s*"_seeded_stub":\s*true,?\s*\n/m,""))}catch{}Rt(p.dirname(Z)),Oe(Z,q)}}Rt(p.join(t.target,".planning","council-sessions"));let W=p.join(t.target,".rcode","context");Rt(W);let R=p.join(W,"active.md"),b=p.join(W,"project-brief.md");D.existsSync(R)||D.writeFileSync(R,`# Active Context
246
266
 
247
267
  _Run \`/rcode-init\` inside your AI editor to populate this file._
248
268
  `),D.existsSync(b)||D.writeFileSync(b,`# Project Brief
249
269
 
250
270
  _Run \`/rcode-init\` inside your AI editor to populate this file._
251
- `);let Q=p.join(Xe(),".rcode","agents");Tt(Q);let re=mg(lt,t.target,{skipGlobalDuplicates:T}),de=re.count;re.skippedGlobal>0&&(console.log(" "+Y(`Skipped ${re.skippedGlobal} project-level rcode skills (global ones in ~/.claude/skills/ take precedence) \u2014 closes #679.`)),console.log(" "+Y(" \u21B3 This project now depends on your GLOBAL rcode install for those skills.")),console.log(" "+Y(" For a self-contained project (e.g. for collaborators/CI), reinstall with --local-only.")));try{let{main:$}=require(p.join(lt,"cli","generate-command-skills.cjs")),R=p.join(t.target,".claude","skills"),j=$(lt,R,Ze(),{skipGlobalDuplicates:T});j.generated>0&&(console.log(" "+Y(`${j.generated} sidebar skill stub${j.generated===1?"":"s"} generated for command discoverability`)),de+=j.generated),j.skippedGlobal>0&&console.log(" "+Y(`Skipped ${j.skippedGlobal} sidebar stub${j.skippedGlobal===1?"":"s"} that duplicate global ~/.claude/skills/ \u2014 closes #679.`))}catch($){console.log(" "+Y(`(sidebar stub generation skipped: ${$.message})`))}D.writeFileSync(p.join(V,"files-manifest.csv"),q$(a,t.target,{mergeExistingManifest:!t.force,extraScanDirs:[p.join(t.target,".claude","skills"),p.join(t.target,".rcode","skills")]}));let x=R$(t.target,t.projectName);N$(lt,t.target);let k=P$(t.target,{commitPlanning:t.commitPlanning}),he=O$(t.target,{gitHooks:t.gitHooks}),X=T$(t.target,{enableHooks:t.enableHooks}),Ee=null,ot=!1;try{let{spawn:$}=require("child_process"),R=p.join(t.target,".rcode","bin","rcode-tools.cjs");D.existsSync(R)&&($("node",[R,"brain","pull"],{cwd:t.target,stdio:"ignore",detached:!0}).unref(),ot=!0)}catch($){Ee={ok:!1,error:String($.message||$).slice(0,200)}}if(console.log(""),t.force&&u>0&&console.log(" "+Po(`${u} stale files swept`)),t.force&&F&&console.log(" "+St("config.yaml and state.json preserved (pass --reset to wipe)")),ot?console.log(" "+Y("Brain: pulling in background (may take up to a minute on a cold cache; run `rcode brain status` to check)")):Ee&&Ee.error&&console.log(" "+Y(`Brain: skipped (${Ee.error})`)),k){let $={created:".gitignore created with rcode block",appended:".gitignore updated \u2014 rcode block appended","already-present":".gitignore rcode block already present",updated:".gitignore rcode block refreshed","skipped-error":`.gitignore skipped (${k.error})`}[k.action]||".gitignore unchanged";console.log(" "+Y($))}if(he){let $={created:"pre-commit hook installed (.git/hooks/pre-commit)",appended:"pre-commit hook updated \u2014 rcode block appended","already-present":"pre-commit hook rcode block already present",updated:"pre-commit hook rcode block refreshed","skipped-flag":"pre-commit hook skipped (--no-git-hooks)","skipped-no-git":"pre-commit hook skipped (no .git/ directory)","skipped-error":`pre-commit hook skipped (${he.error})`}[he.action]||"pre-commit hook unchanged";console.log(" "+Y($))}if(X){let $={merged:"guardrail hooks enabled (.claude/settings.json)","skipped-flag":"guardrail hooks skipped (--no-hooks or declined)","skipped-template-missing":"guardrail hooks skipped (settings-hooks.json template missing)","skipped-error":"guardrail hooks skipped (error merging .claude/settings.json)"}[X.action]||"guardrail hooks unchanged";console.log(" "+Y($))}if(d>0&&console.log(" "+Y(`${d} files skipped (unchanged)`)),f>0&&t.nonDestructive){console.log(""),console.log(" "+St(`${f} file${f===1?"":"s"} preserved (modified since install):`));for(let $ of y.slice(0,10)){let R=J.green(`+${$.insertions}`)+" "+J.red(`-${$.deletions}`);if(console.log(` ${Y($.rel)} ${R}`),t.showDiff&&$.patch)for(let j of $.patch.split(`
252
- `).slice(4))j.startsWith("+")?process.stdout.write(J.green(j)+`
253
- `):j.startsWith("-")?process.stdout.write(J.red(j)+`
254
- `):j.startsWith("@")?process.stdout.write(J.cyan(j)+`
255
- `):process.stdout.write(Y(j)+`
256
- `)}y.length>10&&console.log(Y(` \u2026 and ${y.length-10} more`)),console.log(Y(" To overwrite: re-run with --force-overwrite | To see full diffs: --show-diff")),console.log("")}let Oe=t.ides.includes("claude")?"claude":t.ides[0],Ct=Xu(Oe,t.target),_s=Ct.agentsDir,Tr=Ct.commandsDir,Ve=0,oe=0,Rr=!1,bs=!1;try{if(D.existsSync(_s)&&(Ve=D.readdirSync(_s).filter($=>($.startsWith("rcode-")||$.startsWith("rcode-"))&&($.endsWith(".md")||$.endsWith(".mdc"))).length),D.existsSync(Tr)){let $=Oe==="claude"?R=>R.startsWith("rcode-")&&(R.endsWith(".md")||R.endsWith(".mdc")):R=>R.endsWith(".md")||R.endsWith(".mdc");oe=D.readdirSync(Tr).filter($).length}if(Ve===0||oe===0||de<20){let $=p.join(Xe(),".claude/agents"),R=p.join(Xe(),".claude/commands"),j=p.join(Xe(),".claude/skills");if(Ve===0&&D.existsSync($)){let z=D.readdirSync($).filter(ee=>(ee.startsWith("rcode-")||ee.startsWith("rcode-"))&&ee.endsWith(".md")).length;z>0&&(Ve=z,Rr=!0)}if(oe===0&&D.existsSync(R)){let z=D.readdirSync(R).filter(ee=>(ee.startsWith("rcode-")||ee.startsWith("rcode-"))&&ee.endsWith(".md")).length;z>0&&(oe=z,bs=!0)}if(de<20&&D.existsSync(j))try{let z=D.readdirSync(j,{withFileTypes:!0}).filter(ee=>ee.isDirectory()&&ee.name.startsWith("rcode-")).length;z>de&&(de=z)}catch{}}}catch($){console.error("[install] installInner: failed to count installed agents/commands:",$?.message||$)}try{let $=p.join(t.target,".rcode","skills"),R=p.join(t.target,".claude","commands"),j=[$,R],z=!1,ee=!1;for(let xe of j){if(!D.existsSync(xe))continue;let wt=D.readdirSync(xe);wt.some(Ot=>Ot.startsWith("rcode-"))&&(z=!0),wt.some(Ot=>Ot.startsWith("rihal-"))&&(ee=!0)}z&&ee&&process.stderr.write(J.yellow("WARNING: rcode-* and rihal-* namespaces both detected \u2014 consider removing one to reduce roster size.")+`
257
- `)}catch{}try{zu(t)}catch($){process.stderr.write(J.yellow(`WARNING: native slash-command install skipped: ${$?.message||$}`)+`
258
- `)}let N=Ze();console.log(""),console.log(` ${It("Version:")} ${J.cyan("@hanzlaa/rcode@"+N)}`),console.log(` ${It("IDE:")} ${t.ides.join(", ")}`),console.log(` ${It("Language:")} ${t.language} ${Y("(change in .rcode/config.yaml)")}`),console.log(` ${It("Mode:")} ${t.mode} ${Y("(guided=confirm at gates, yolo=autonomous)")}`),console.log(` ${It("Planning:")} ${t.commitPlanning!==!1?"committed":"gitignored"} ${Y("(flip: rcode-tools gitignore refresh)")}`),console.log("");let ve=p.relative(t.target,Ct.agentsDir)||Ct.agentsDir,B=p.relative(t.target,Ct.commandsDir)||Ct.commandsDir;if(console.log(` ${It("Agents:")} ${J.green(String(Ve))} in ${Rr?"~/.claude/agents/ (global)":ve+"/"}`),console.log(` ${It("Commands:")} ${J.green(String(oe))} slash commands in ${bs?"~/.claude/commands/ (global)":B+"/"}`),de>0&&console.log(` ${It("Skills:")} ${J.green(String(de))} phrase-activated`),console.log(""),x&&(console.log(" "+ir("Starter planning scaffolded in .planning/ (ROADMAP, STATE, PROJECT)")),console.log("")),console.log(` ${It("Next:")}`),console.log(` cd ${t.target}`),console.log(" claude # start Claude Code (reload window if already open)"),console.log(" /rcode-progress # where you are, what's next"),console.log(" /rcode-do # interactive command picker"),console.log(" /rcode-council <q> # multi-agent strategic answer"),console.log(""),(t.global||t.noPrompt)&&(console.log(` ${Y("Configure interactively (one-time, per project):")}`),console.log(` ${Y("rcode install # pick IDE + planning policy for THIS project")}`),console.log(` ${Y("rcode config # adjust defaults later")}`),console.log("")),console.log(Y(" Refresh anytime:")),console.log(Y(" pnpm dlx @hanzlaa/rcode@latest install # recommended (avoids npm 11.x npx issues)")),console.log(Y(" npx @hanzlaa/rcode@latest install # npm / yarn")),console.log(Y(` /rcode-update v${N} # pin rcode to a specific version`)),console.log(""),console.log(Y(" Want the rcode CLI on your PATH? (optional \u2014 needed for rcode version / rcode update):")),console.log(Y(" npm install -g @hanzlaa/rcode # installs rcode, rcode, rcode commands")),console.log(Y(" rcode version # verify")),console.log(""),console.log(Y(" Customize without losing changes on update:")),console.log(Y(" Create <name>.local.md siblings (e.g. .claude/agents/rcode-waleed.local.md)")),console.log(Y(" *.local.md files are NEVER touched by install / --force-overwrite / uninstall.")),console.log(""),console.log(" "+St("If your IDE is already open, reload the window to refresh skills/commands.")),console.log(Y(" Claude Code / VS Code / Cursor: Cmd+Shift+P \u2192 Reload Window")),console.log(""),!t.noUpdateCheck&&process.stdout.isTTY&&!process.env.CI&&!process.env.RCODE_NO_UPDATE_NOTIFIER){let{execFile:$}=require("child_process");$("npm",["view","@hanzlaa/rcode","version","--json"],{timeout:4e3},(R,j)=>{if(!R)try{let z=JSON.parse(j.trim());Fn.valid(z)&&Fn.gt(z,N)&&(console.log(""),console.log(" \u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E"),console.log(` \u2502 ${J.yellow("Update available:")} ${J.dim(N)} \u2192 ${J.green(z)}${" ".repeat(Math.max(0,20-N.length-z.length))} \u2502`),console.log(" \u2502 Run: npx @hanzlaa/rcode@latest install . \u2502"),console.log(" \u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F"),console.log(""))}catch{}})}if(!t.global){let $=H$(t.target);$.ok||(console.log(" "+St($.message)),console.log(""))}return Y$(t.target,{agentCount:Ve,commandCount:oe,skillsInstalled:de})?0:1}function Y$(t,e){console.log(` ${It("Health check:")}`);let{execFileSync:r}=require("child_process"),n=0,s={agents:20,skills:20,commands:20};try{let{readPackageManifest:o}=ss(),a=o(lt);if(a&&a.agents instanceof Set&&a.actions instanceof Set){let u=l=>Math.max(1,Math.floor(l*.9));s.agents=u(a.agents.size),s.skills=u(a.actions.size);let c=p.join(lt,"rcode","commands");if(D.existsSync(c)){let l=D.readdirSync(c).filter(d=>d.endsWith(".md")&&!d.startsWith("_")).length;s.commands=u(l)}}}catch{}function i(o,a){try{let u=a();console.log(` ${ir(o)}${u?Y(" \u2014 "+u):""}`)}catch(u){n+=1,console.log(` ${hg(o)} ${J.red("\u2014")} ${String(u.message||u).slice(0,120)}`)}}return i("rcode-tools.cjs runs",()=>{let o=p.join(t,".rcode","bin","rcode-tools.cjs");if(!D.existsSync(o))throw new Error("bin/rcode-tools.cjs not installed");return r("node",["-c",o],{stdio:"pipe"}),"syntax ok"}),i(".rcode/config.yaml present",()=>{let o=p.join(t,".rcode","config.yaml");if(!D.existsSync(o))throw new Error("missing");let a=D.readFileSync(o,"utf8");if(!/user_name:|project_name:/.test(a))throw new Error("config.yaml incomplete");return`${D.statSync(o).size} bytes`}),i(".rcode/state.json parses",()=>{let o=p.join(t,".rcode","state.json");if(!D.existsSync(o))throw new Error("missing");return JSON.parse(D.readFileSync(o,"utf8")),"valid JSON"}),i("agents installed",()=>{if((e.agentCount||0)<s.agents)throw new Error(`only ${e.agentCount} agents (expected \u2265 ${s.agents})`);return`${e.agentCount}`}),i("skills + commands installed",()=>{let o=[];if((e.skillsInstalled||0)<s.skills&&o.push(`${e.skillsInstalled} skills (expected \u2265 ${s.skills})`),(e.commandCount||0)<s.commands&&o.push(`${e.commandCount} commands (expected \u2265 ${s.commands})`),o.length)throw new Error(`low count: ${o.join(", ")}`);return`${e.skillsInstalled} skills + ${e.commandCount} commands`}),n>0?(console.log(""),console.log(" "+hg(`${n} health check${n===1?"":"s"} failed \u2014 install may be broken.`)),console.log(Y(" Debug: node .rcode/bin/rcode-tools.cjs state read && ls -la .rcode/")),console.log(Y(" Reinstall: rcode install . --force")),console.log(""),!1):(console.log(""),!0)}async function J$(){let t=process.argv.slice(2),e=Ju(t);if(e.help){Dg();return}!e.yes&&process.stdin.isTTY&&!process.env.CI&&await X$(e);try{let n=await Qu(e);process.exit(n)}catch(n){(n.code==="EACCES"||n.code==="EPERM")&&(console.error(`\u2716 Permission denied: ${n.path||n.message}`),process.exit(1)),n.code==="ENOENT"&&(console.error(`\u2716 Path not found: ${n.path||n.message}`),process.exit(1)),console.error(`\u2716 Install failed: ${n.message}`),process.env.DEBUG&&console.error(n.stack),process.exit(1)}}async function X$(t){let{intro:e,outro:r,text:n,select:s,multiselect:i,confirm:o,isCancel:a,cancel:u,note:c}=Re,l=Ze();if(console.log(""),e(J.bold("\u{1F54C} rcode")+J.dim(` v${l}`)),!t.targetProvided){let h=await n({message:"Install directory?",placeholder:t.target,defaultValue:t.target,initialValue:t.target});a(h)&&(u("Installation cancelled."),process.exit(0));let w=p.resolve((h||t.target).trim());t.target=w,t.projectName=p.basename(w)}let d=await i({message:"Which editor(s) are you installing for?",options:[{value:"claude",label:"Claude Code",hint:"recommended"},{value:"cursor",label:"Cursor"},{value:"codex",label:"Codex (OpenAI CLI)",hint:"AGENTS.md + workflow bridge"},{value:"gemini",label:"Gemini CLI",hint:"coming soon"},{value:"vscode",label:"VS Code",hint:"via Continue / Copilot extensions"},{value:"antigravity",label:"Antigravity",hint:"experimental"}],initialValues:t.ide?[t.ide]:["claude"],required:!0});a(d)&&(u("Installation cancelled."),process.exit(0)),t.ides=d,t.ide=d[0],t.ideProvided=!0;let f=await s({message:"Communication language?",options:[{value:"English",label:"English"},{value:"Arabic",label:"Arabic (\u0627\u0644\u0639\u0631\u0628\u064A\u0629)"},{value:"French",label:"French (Fran\xE7ais)"},{value:"Spanish",label:"Spanish (Espa\xF1ol)"},{value:"Urdu",label:"Urdu (\u0627\u0631\u062F\u0648)"}],initialValue:t.language||"English"});a(f)&&(u("Installation cancelled."),process.exit(0)),t.language=f;let g=await s({message:"Agent mode?",options:[{value:"guided",label:"Guided",hint:"confirm at key decision gates"},{value:"yolo",label:"Yolo",hint:"fully autonomous \u2014 no confirmation"}],initialValue:t.mode||"guided"});a(g)&&(u("Installation cancelled."),process.exit(0)),t.mode=g;let m=await s({message:"Where should planning artifacts (.planning/) be saved?",options:[{value:!0,label:"Commit to git",hint:"recommended \u2014 team sees the same plans"},{value:!1,label:"Keep local",hint:"gitignore \u2014 good for sensitive PRDs"}],initialValue:!0});a(m)&&(u("Installation cancelled."),process.exit(0)),t.commitPlanning=m;let y=await n({message:"Your name? (used in agent responses)",placeholder:t.userName,defaultValue:t.userName,initialValue:t.userName});a(y)&&(u("Installation cancelled."),process.exit(0)),t.userName=(y||t.userName).trim(),c([`${J.dim("Directory:")} ${t.target}`,`${J.dim("Editor:")} ${t.ides.join(", ")}`,`${J.dim("Language:")} ${t.language}`,`${J.dim("Mode:")} ${t.mode}`,`${J.dim("Planning:")} ${t.commitPlanning?"committed to git":"kept local (gitignored)"}`,`${J.dim("User:")} ${t.userName}`].join(`
259
- `),"Installing with these settings"),console.log("")}require.main===dt&&J$();async function K$(t){let e=Array.isArray(t)?t:[],r=Ju(e),n=await Qu(r);n!==0&&process.exit(n)}dt.exports=K$;dt.exports.parseArgs=Ju;dt.exports.buildInstallPlan=Ku;dt.exports.install=Qu;dt.exports.SUPPORTED_IDES=os;dt.exports.migrateVscodeCommandsLayout=vg;dt.exports.getPathsForIde=Xu;dt.exports.installSlashRouterCommands=ec;dt.exports.installCodexSlashRouterHook=Eg;dt.exports.installAntigravitySlashRouterHook=Cg;dt.exports.installNativeHomeSlashCommands=zu});var as=v((qI,xg)=>{var Q$=require("readline"),Yt=class extends Error{constructor(e="Prompt aborted"){super(e),this.name="PromptAbortError"}},wg=!1;function eA(){wg||(wg=!0,process.on("SIGINT",()=>{process.stdout.write(`
271
+ `);let Q=p.join(Qe(),".rcode","agents");Rt(Q);let te=Dg(dt,t.target,{skipGlobalDuplicates:T}),de=te.count;te.skippedGlobal>0&&(console.log(" "+Y(`Skipped ${te.skippedGlobal} project-level rcode skills (global ones in ~/.claude/skills/ take precedence) \u2014 closes #679.`)),console.log(" "+Y(" \u21B3 This project now depends on your GLOBAL rcode install for those skills.")),console.log(" "+Y(" For a self-contained project (e.g. for collaborators/CI), reinstall with --local-only.")));try{let{main:$}=require(p.join(dt,"cli","generate-command-skills.cjs")),j=p.join(t.target,".claude","skills"),O=$(dt,j,Ve(),{skipGlobalDuplicates:T});O.generated>0&&(console.log(" "+Y(`${O.generated} sidebar skill stub${O.generated===1?"":"s"} generated for command discoverability`)),de+=O.generated),O.skippedGlobal>0&&console.log(" "+Y(`Skipped ${O.skippedGlobal} sidebar stub${O.skippedGlobal===1?"":"s"} that duplicate global ~/.claude/skills/ \u2014 closes #679.`))}catch($){console.log(" "+Y(`(sidebar stub generation skipped: ${$.message})`))}D.writeFileSync(p.join(G,"files-manifest.csv"),Z$(a,t.target,{mergeExistingManifest:!t.force,extraScanDirs:[p.join(t.target,".claude","skills"),p.join(t.target,".rcode","skills")]}));let x=O$(t.target,t.projectName);M$(dt,t.target);let k=N$(t.target,{commitPlanning:t.commitPlanning}),he=B$(t.target,{gitHooks:t.gitHooks}),X=P$(t.target,{enableHooks:t.enableHooks}),xe=L$(t.target,t.ides),ze=null,Le=!1;try{let{spawn:$}=require("child_process"),j=p.join(t.target,".rcode","bin","rcode-tools.cjs");D.existsSync(j)&&($("node",[j,"brain","pull"],{cwd:t.target,stdio:"ignore",detached:!0}).unref(),Le=!0)}catch($){ze={ok:!1,error:String($.message||$).slice(0,200)}}if(console.log(""),t.force&&c>0&&console.log(" "+Oo(`${c} stale files swept`)),t.force&&F&&console.log(" "+Et("config.yaml and state.json preserved (pass --reset to wipe)")),Le?console.log(" "+Y("Brain: pulling in background (may take up to a minute on a cold cache; run `rcode brain status` to check)")):ze&&ze.error&&console.log(" "+Y(`Brain: skipped (${ze.error})`)),k){let $={created:".gitignore created with rcode block",appended:".gitignore updated \u2014 rcode block appended","already-present":".gitignore rcode block already present",updated:".gitignore rcode block refreshed","skipped-error":`.gitignore skipped (${k.error})`}[k.action]||".gitignore unchanged";console.log(" "+Y($))}if(he){let $={created:"pre-commit hook installed (.git/hooks/pre-commit)",appended:"pre-commit hook updated \u2014 rcode block appended","already-present":"pre-commit hook rcode block already present",updated:"pre-commit hook rcode block refreshed","skipped-flag":"pre-commit hook skipped (--no-git-hooks)","skipped-no-git":"pre-commit hook skipped (no .git/ directory)","skipped-error":`pre-commit hook skipped (${he.error})`}[he.action]||"pre-commit hook unchanged";console.log(" "+Y($))}if(X){let $={merged:"guardrail hooks enabled (.claude/settings.json)","skipped-flag":"guardrail hooks skipped (--no-hooks or declined)","skipped-template-missing":"guardrail hooks skipped (settings-hooks.json template missing)","skipped-error":"guardrail hooks skipped (error merging .claude/settings.json)"}[X.action]||"guardrail hooks unchanged";console.log(" "+Y($))}if(xe&&Object.keys(xe).length>0){let $={claude:"CLAUDE.md",codex:"AGENTS.md",cursor:".cursor/rules/rcode-prefer-do.mdc",windsurf:".windsurf/rules/rcode-prefer-do.mdc"};for(let[j,O]of Object.entries(xe)){let q=$[j]||j,se={created:`${q}: /rcode-do rule added`,appended:`${q}: /rcode-do rule appended`,updated:`${q}: /rcode-do rule refreshed`,"already-present":`${q}: /rcode-do rule already present`,written:`${q}: /rcode-do rule written`,"skipped-error":`${q}: /rcode-do rule skipped (${O.error})`}[O.action]||`${q}: /rcode-do rule unchanged`;console.log(" "+Y(se))}}if(d>0&&console.log(" "+Y(`${d} files skipped (unchanged)`)),f>0&&t.nonDestructive){console.log(""),console.log(" "+Et(`${f} file${f===1?"":"s"} preserved (modified since install):`));for(let $ of y.slice(0,10)){let j=J.green(`+${$.insertions}`)+" "+J.red(`-${$.deletions}`);if(console.log(` ${Y($.rel)} ${j}`),t.showDiff&&$.patch)for(let O of $.patch.split(`
272
+ `).slice(4))O.startsWith("+")?process.stdout.write(J.green(O)+`
273
+ `):O.startsWith("-")?process.stdout.write(J.red(O)+`
274
+ `):O.startsWith("@")?process.stdout.write(J.cyan(O)+`
275
+ `):process.stdout.write(Y(O)+`
276
+ `)}y.length>10&&console.log(Y(` \u2026 and ${y.length-10} more`)),console.log(Y(" To overwrite: re-run with --force-overwrite | To see full diffs: --show-diff")),console.log("")}let Pr=t.ides.includes("claude")?"claude":t.ides[0],lr=Kc(Pr,t.target),Or=lr.agentsDir,Ct=lr.commandsDir,oe=0,wt=0,Ss=!1,B=!1;try{if(D.existsSync(Or)&&(oe=D.readdirSync(Or).filter($=>($.startsWith("rcode-")||$.startsWith("rcode-"))&&($.endsWith(".md")||$.endsWith(".mdc"))).length),D.existsSync(Ct)){let $=Pr==="claude"?j=>j.startsWith("rcode-")&&(j.endsWith(".md")||j.endsWith(".mdc")):j=>j.endsWith(".md")||j.endsWith(".mdc");wt=D.readdirSync(Ct).filter($).length}if(oe===0||wt===0||de<20){let $=p.join(Qe(),".claude/agents"),j=p.join(Qe(),".claude/commands"),O=p.join(Qe(),".claude/skills");if(oe===0&&D.existsSync($)){let q=D.readdirSync($).filter(se=>(se.startsWith("rcode-")||se.startsWith("rcode-"))&&se.endsWith(".md")).length;q>0&&(oe=q,Ss=!0)}if(wt===0&&D.existsSync(j)){let q=D.readdirSync(j).filter(se=>(se.startsWith("rcode-")||se.startsWith("rcode-"))&&se.endsWith(".md")).length;q>0&&(wt=q,B=!0)}if(de<20&&D.existsSync(O))try{let q=D.readdirSync(O,{withFileTypes:!0}).filter(se=>se.isDirectory()&&se.name.startsWith("rcode-")).length;q>de&&(de=q)}catch{}}}catch($){console.error("[install] installInner: failed to count installed agents/commands:",$?.message||$)}try{let $=p.join(t.target,".rcode","skills"),j=p.join(t.target,".claude","commands"),O=[$,j],q=!1,se=!1;for(let ke of O){if(!D.existsSync(ke))continue;let xt=D.readdirSync(ke);xt.some(Nt=>Nt.startsWith("rcode-"))&&(q=!0),xt.some(Nt=>Nt.startsWith("rihal-"))&&(se=!0)}q&&se&&process.stderr.write(J.yellow("WARNING: rcode-* and rihal-* namespaces both detected \u2014 consider removing one to reduce roster size.")+`
277
+ `)}catch{}try{Yc(t)}catch($){process.stderr.write(J.yellow(`WARNING: native slash-command install skipped: ${$?.message||$}`)+`
278
+ `)}let me=Ve();console.log(""),console.log(` ${Tt("Version:")} ${J.cyan("@hanzlaa/rcode@"+me)}`),console.log(` ${Tt("IDE:")} ${t.ides.join(", ")}`),console.log(` ${Tt("Language:")} ${t.language} ${Y("(change in .rcode/config.yaml)")}`),console.log(` ${Tt("Mode:")} ${t.mode} ${Y("(guided=confirm at gates, yolo=autonomous)")}`),console.log(` ${Tt("Planning:")} ${t.commitPlanning!==!1?"committed":"gitignored"} ${Y("(flip: rcode-tools gitignore refresh)")}`),console.log("");let L=p.relative(t.target,lr.agentsDir)||lr.agentsDir,le=p.relative(t.target,lr.commandsDir)||lr.commandsDir;if(console.log(` ${Tt("Agents:")} ${J.green(String(oe))} in ${Ss?"~/.claude/agents/ (global)":L+"/"}`),console.log(` ${Tt("Commands:")} ${J.green(String(wt))} slash commands in ${B?"~/.claude/commands/ (global)":le+"/"}`),de>0&&console.log(` ${Tt("Skills:")} ${J.green(String(de))} phrase-activated`),console.log(""),x&&(console.log(" "+ar("Starter planning scaffolded in .planning/ (ROADMAP, STATE, PROJECT)")),console.log("")),console.log(` ${Tt("Next:")}`),console.log(` cd ${t.target}`),console.log(" claude # start Claude Code (reload window if already open)"),console.log(" /rcode-progress # where you are, what's next"),console.log(" /rcode-do # interactive command picker"),console.log(" /rcode-council <q> # multi-agent strategic answer"),console.log(""),(t.global||t.noPrompt)&&(console.log(` ${Y("Configure interactively (one-time, per project):")}`),console.log(` ${Y("rcode install # pick IDE + planning policy for THIS project")}`),console.log(` ${Y("rcode config # adjust defaults later")}`),console.log("")),console.log(Y(" Refresh anytime:")),console.log(Y(" pnpm dlx @hanzlaa/rcode@latest install # recommended (avoids npm 11.x npx issues)")),console.log(Y(" npx @hanzlaa/rcode@latest install # npm / yarn")),console.log(Y(` /rcode-update v${me} # pin rcode to a specific version`)),console.log(""),console.log(Y(" Want the rcode CLI on your PATH? (optional \u2014 needed for rcode version / rcode update):")),console.log(Y(" npm install -g @hanzlaa/rcode # installs rcode, rcode, rcode commands")),console.log(Y(" rcode version # verify")),console.log(""),console.log(Y(" Customize without losing changes on update:")),console.log(Y(" Create <name>.local.md siblings (e.g. .claude/agents/rcode-waleed.local.md)")),console.log(Y(" *.local.md files are NEVER touched by install / --force-overwrite / uninstall.")),console.log(""),console.log(" "+Et("If your IDE is already open, reload the window to refresh skills/commands.")),console.log(Y(" Claude Code / VS Code / Cursor: Cmd+Shift+P \u2192 Reload Window")),console.log(""),!t.noUpdateCheck&&process.stdout.isTTY&&!process.env.CI&&!process.env.RCODE_NO_UPDATE_NOTIFIER){let{execFile:$}=require("child_process");$("npm",["view","@hanzlaa/rcode","version","--json"],{timeout:4e3},(j,O)=>{if(!j)try{let q=JSON.parse(O.trim());In.valid(q)&&In.gt(q,me)&&(console.log(""),console.log(" \u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E"),console.log(` \u2502 ${J.yellow("Update available:")} ${J.dim(me)} \u2192 ${J.green(q)}${" ".repeat(Math.max(0,20-me.length-q.length))} \u2502`),console.log(" \u2502 Run: npx @hanzlaa/rcode@latest install . \u2502"),console.log(" \u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F"),console.log(""))}catch{}})}if(!t.global){let $=V$(t.target);$.ok||(console.log(" "+Et($.message)),console.log(""))}return K$(t.target,{agentCount:oe,commandCount:wt,skillsInstalled:de})?0:1}function K$(t,e){console.log(` ${Tt("Health check:")}`);let{execFileSync:r}=require("child_process"),n=0,s={agents:20,skills:20,commands:20};try{let{readPackageManifest:o}=is(),a=o(dt);if(a&&a.agents instanceof Set&&a.actions instanceof Set){let c=l=>Math.max(1,Math.floor(l*.9));s.agents=c(a.agents.size),s.skills=c(a.actions.size);let u=p.join(dt,"rcode","commands");if(D.existsSync(u)){let l=D.readdirSync(u).filter(d=>d.endsWith(".md")&&!d.startsWith("_")).length;s.commands=c(l)}}}catch{}function i(o,a){try{let c=a();console.log(` ${ar(o)}${c?Y(" \u2014 "+c):""}`)}catch(c){n+=1,console.log(` ${pg(o)} ${J.red("\u2014")} ${String(c.message||c).slice(0,120)}`)}}return i("rcode-tools.cjs runs",()=>{let o=p.join(t,".rcode","bin","rcode-tools.cjs");if(!D.existsSync(o))throw new Error("bin/rcode-tools.cjs not installed");return r("node",["-c",o],{stdio:"pipe"}),"syntax ok"}),i(".rcode/config.yaml present",()=>{let o=p.join(t,".rcode","config.yaml");if(!D.existsSync(o))throw new Error("missing");let a=D.readFileSync(o,"utf8");if(!/user_name:|project_name:/.test(a))throw new Error("config.yaml incomplete");return`${D.statSync(o).size} bytes`}),i(".rcode/state.json parses",()=>{let o=p.join(t,".rcode","state.json");if(!D.existsSync(o))throw new Error("missing");return JSON.parse(D.readFileSync(o,"utf8")),"valid JSON"}),i("agents installed",()=>{if((e.agentCount||0)<s.agents)throw new Error(`only ${e.agentCount} agents (expected \u2265 ${s.agents})`);return`${e.agentCount}`}),i("skills + commands installed",()=>{let o=[];if((e.skillsInstalled||0)<s.skills&&o.push(`${e.skillsInstalled} skills (expected \u2265 ${s.skills})`),(e.commandCount||0)<s.commands&&o.push(`${e.commandCount} commands (expected \u2265 ${s.commands})`),o.length)throw new Error(`low count: ${o.join(", ")}`);return`${e.skillsInstalled} skills + ${e.commandCount} commands`}),n>0?(console.log(""),console.log(" "+pg(`${n} health check${n===1?"":"s"} failed \u2014 install may be broken.`)),console.log(Y(" Debug: node .rcode/bin/rcode-tools.cjs state read && ls -la .rcode/")),console.log(Y(" Reinstall: rcode install . --force")),console.log(""),!1):(console.log(""),!0)}async function Q$(){let t=process.argv.slice(2),e=Xc(t);if(e.help){vg();return}!e.yes&&process.stdin.isTTY&&!process.env.CI&&await eA(e);try{let n=await eu(e);process.exit(n)}catch(n){(n.code==="EACCES"||n.code==="EPERM")&&(console.error(`\u2716 Permission denied: ${n.path||n.message}`),process.exit(1)),n.code==="ENOENT"&&(console.error(`\u2716 Path not found: ${n.path||n.message}`),process.exit(1)),console.error(`\u2716 Install failed: ${n.message}`),process.env.DEBUG&&console.error(n.stack),process.exit(1)}}async function eA(t){let{intro:e,outro:r,text:n,select:s,multiselect:i,confirm:o,isCancel:a,cancel:c,note:u}=Pe,l=Ve();if(console.log(""),e(J.bold("\u{1F54C} rcode")+J.dim(` v${l}`)),!t.targetProvided){let h=await n({message:"Install directory?",placeholder:t.target,defaultValue:t.target,initialValue:t.target});a(h)&&(c("Installation cancelled."),process.exit(0));let w=p.resolve((h||t.target).trim());t.target=w,t.projectName=p.basename(w)}let d=await i({message:"Which editor(s) are you installing for?",options:[{value:"claude",label:"Claude Code",hint:"recommended"},{value:"cursor",label:"Cursor"},{value:"codex",label:"Codex (OpenAI CLI)",hint:"AGENTS.md + workflow bridge"},{value:"gemini",label:"Gemini CLI",hint:"coming soon"},{value:"vscode",label:"VS Code",hint:"via Continue / Copilot extensions"},{value:"antigravity",label:"Antigravity",hint:"experimental"}],initialValues:t.ide?[t.ide]:["claude"],required:!0});a(d)&&(c("Installation cancelled."),process.exit(0)),t.ides=d,t.ide=d[0],t.ideProvided=!0;let f=await s({message:"Communication language?",options:[{value:"English",label:"English"},{value:"Arabic",label:"Arabic (\u0627\u0644\u0639\u0631\u0628\u064A\u0629)"},{value:"French",label:"French (Fran\xE7ais)"},{value:"Spanish",label:"Spanish (Espa\xF1ol)"},{value:"Urdu",label:"Urdu (\u0627\u0631\u062F\u0648)"}],initialValue:t.language||"English"});a(f)&&(c("Installation cancelled."),process.exit(0)),t.language=f;let g=await s({message:"Agent mode?",options:[{value:"guided",label:"Guided",hint:"confirm at key decision gates"},{value:"yolo",label:"Yolo",hint:"fully autonomous \u2014 no confirmation"}],initialValue:t.mode||"guided"});a(g)&&(c("Installation cancelled."),process.exit(0)),t.mode=g;let m=await s({message:"Where should planning artifacts (.planning/) be saved?",options:[{value:!0,label:"Commit to git",hint:"recommended \u2014 team sees the same plans"},{value:!1,label:"Keep local",hint:"gitignore \u2014 good for sensitive PRDs"}],initialValue:!0});a(m)&&(c("Installation cancelled."),process.exit(0)),t.commitPlanning=m;let y=await n({message:"Your name? (used in agent responses)",placeholder:t.userName,defaultValue:t.userName,initialValue:t.userName});a(y)&&(c("Installation cancelled."),process.exit(0)),t.userName=(y||t.userName).trim(),u([`${J.dim("Directory:")} ${t.target}`,`${J.dim("Editor:")} ${t.ides.join(", ")}`,`${J.dim("Language:")} ${t.language}`,`${J.dim("Mode:")} ${t.mode}`,`${J.dim("Planning:")} ${t.commitPlanning?"committed to git":"kept local (gitignored)"}`,`${J.dim("User:")} ${t.userName}`].join(`
279
+ `),"Installing with these settings"),console.log("")}require.main===ft&&Q$();async function tA(t){let e=Array.isArray(t)?t:[],r=Xc(e),n=await eu(r);n!==0&&process.exit(n)}ft.exports=tA;ft.exports.parseArgs=Xc;ft.exports.buildInstallPlan=Qc;ft.exports.install=eu;ft.exports.SUPPORTED_IDES=as;ft.exports.migrateVscodeCommandsLayout=bg;ft.exports.getPathsForIde=Kc;ft.exports.installSlashRouterCommands=tu;ft.exports.installCodexSlashRouterHook=wg;ft.exports.installAntigravitySlashRouterHook=xg;ft.exports.installNativeHomeSlashCommands=Yc});var us=v((ZI,$g)=>{var rA=require("readline"),Jt=class extends Error{constructor(e="Prompt aborted"){super(e),this.name="PromptAbortError"}},kg=!1;function nA(){kg||(kg=!0,process.on("SIGINT",()=>{process.stdout.write(`
260
280
 
261
281
  Cancelled.
262
- `),process.exit(0)}))}var sn=null;function tc(){return sn||(sn=tA(),sn)}function tA(){eA();let t=!!process.stdin.isTTY,e=Q$.createInterface({input:process.stdin,output:process.stdout,terminal:t}),r=!1,n=!1;e.on("close",()=>{n=!0});let s=[],i=[];t||(e.on("line",u=>{if(i.length>0){let{resolve:c}=i.shift();c(u)}else s.push(u)}),e.on("close",()=>{for(;i.length>0;){let{reject:u}=i.shift();r||u(new Yt("Input stream closed"))}}));function o(u){return t?n?Promise.reject(new Yt("Input stream closed")):new Promise((c,l)=>{let d=!1,f=()=>{!d&&!r&&(d=!0,l(new Yt("Input stream closed")))};e.once("close",f),e.question(u,g=>{d||(d=!0,e.removeListener("close",f),c((g||"").trim()))})}):(process.stdout.write(u),s.length>0?Promise.resolve((s.shift()||"").trim()):n?Promise.reject(new Yt("Input stream closed")):new Promise((c,l)=>{i.push({resolve:d=>c((d||"").trim()),reject:l})}))}function a(){r=!0,e.close()}return{ask:o,close:a}}async function rA(t,{choices:e,default:r="",allowMulti:n=!0,expand:s=null,maxAttempts:i=3}={}){if(!Array.isArray(e)||e.length===0)throw new Error("askChoice: `choices` must be a non-empty array");let o=e.map(l=>l.key),a=e.map(l=>l.id),u=`Valid options: ${o.join(", ")} (or ${a.join(", ")})`,c=tc();for(let l=0;l<i;l++){let d=await c.ask(t),f=d===""?r:d;if(f===""){console.log(` \u26A0 No input and no default. ${u}`);continue}let g=f.split(",").map(h=>h.trim()).filter(Boolean);if(!n&&g.length>1){console.log(` \u26A0 Only one choice allowed, you typed ${g.length}.`);continue}let m=[],y=[];for(let h of g){let w=e.find(C=>C.key===h||C.id===h);if(!w)y.push(h);else if(s)for(let C of s(w.id))m.push(C);else m.push(w.id)}if(m.length===0){console.log(` \u26A0 Didn't recognize: ${y.map(h=>`"${h}"`).join(", ")}`),console.log(` ${u}`),console.log();continue}return y.length>0&&console.log(` \u26A0 Skipping unknown: ${y.map(h=>`"${h}"`).join(", ")}`),[...new Set(m)]}throw new Yt(`No valid selection after ${i} attempts`)}async function nA(t,{default:e="n",maxAttempts:r=3}={}){let n=e.toLowerCase()==="y"?"y":"n",s=tc();for(let i=0;i<r;i++){let o=(await s.ask(t)).toLowerCase(),a=o===""?n:o;if(a==="y"||a==="yes")return!0;if(a==="n"||a==="no")return!1;console.log(' \u26A0 Please answer "y" or "n".')}throw new Yt(`No valid yes/no answer after ${r} attempts`)}async function sA(t,{default:e="",validate:r=null,maxAttempts:n=3}={}){let s=tc();for(let i=0;i<n;i++){let o=await s.ask(t),a=o===""?e:o;if(r){let u=r(a);if(u!==!0){console.log(` \u26A0 ${typeof u=="string"?u:"Invalid input."}`);continue}}else if(a===""){console.log(" \u26A0 Please enter a value.");continue}return a}throw new Yt(`No valid text input after ${n} attempts`)}function oA(){sn&&(sn.close(),sn=null)}xg.exports={askChoice:rA,askConfirm:nA,askText:sA,closeSession:oA,PromptAbortError:Yt}});var No=v((WI,Fg)=>{"use strict";var Rt=require("fs"),ye=require("path");function on(t){if(!Rt.existsSync(t))return[];try{return Rt.readdirSync(t,{withFileTypes:!0})}catch{return[]}}function rc(t){let e=[],r=ye.join(t,"skills");for(let a of on(r)){if(!a.isDirectory()||!a.name.startsWith("rihal-"))continue;let u="rcode-"+a.name.slice(6);Rt.existsSync(ye.join(r,u))&&e.push({name:a.name,twin:u,srcPath:ye.join(r,a.name),kind:"skill"})}let n=[],s=ye.join(t,"commands");for(let a of on(s)){if(!a.isFile()||!a.name.startsWith("rihal-")||!a.name.endsWith(".md"))continue;let u="rcode-"+a.name.slice(6);Rt.existsSync(ye.join(s,u))&&n.push({name:a.name,twin:u,srcPath:ye.join(s,a.name),kind:"command"})}let i=[],o=ye.join(t,"agents");for(let a of on(o)){if(!a.isFile()||!a.name.startsWith("rihal-")||!a.name.endsWith(".md"))continue;let u="rcode-"+a.name.slice(6);Rt.existsSync(ye.join(o,u))&&i.push({name:a.name,twin:u,srcPath:ye.join(o,a.name),kind:"agent"})}return{skills:e,commands:n,agents:i}}function nc(t){let e=[],r=ye.join(t,"commands");for(let n of on(r)){if(!n.isFile()||!n.name.endsWith(".md")||n.name.startsWith("rcode-")||n.name.startsWith("rihal-"))continue;let s="rcode-"+n.name;Rt.existsSync(ye.join(r,s))&&e.push({name:n.name,twin:s,srcPath:ye.join(r,n.name),kind:"command"})}return e}function kg(t,e){let r=[];if(ye.resolve(t)===ye.resolve(e))return r;let n=ye.join(t,"commands"),s=ye.join(e,"commands"),i=new Set(on(n).filter(o=>o.isFile()&&o.name.endsWith(".md")).map(o=>o.name));for(let o of on(s))!o.isFile()||!o.name.endsWith(".md")||i.has(o.name)&&r.push({name:o.name,srcPath:ye.join(s,o.name),keptPath:ye.join(n,o.name),kind:"command"});return r}function $g(t){let e=[],r=ye.join(t,".rcode","slash-commands");for(let n of on(r)){if(!n.isFile()||!n.name.startsWith("rihal-")||!n.name.endsWith(".md"))continue;let s="rcode-"+n.name.slice(6);Rt.existsSync(ye.join(r,s))&&e.push({name:n.name,twin:s,srcPath:ye.join(r,n.name),kind:"command"})}return e}function Ag(t,e){let r=ye.join(t,".claude"),n=ye.join(e,".claude"),s=rc(r),i=rc(n),o=nc(r),a=nc(n),u=kg(r,n),c=$g(e),l=s.skills.length+i.skills.length,d=s.commands.length+i.commands.length,f=s.agents.length+i.agents.length,g=o.length+a.length,m=u.length,y=c.length;return{legacySkillCount:l,legacyCommandCount:d,legacyAgentCount:f,unprefixedCount:g,crossScopeCount:m,legacyCodexCommandCount:y,totalCount:l+d+f+g+m+y,detail:{projectLegacy:s,globalLegacy:i,projectUnprefixed:o,globalUnprefixed:a,crossScope:u,codexSlashCommands:c}}}function iA(t,e,r,n){if(!Rt.existsSync(t))return!1;let s=n==="skill"?"skills":n==="agent"?"agents":"commands",i=ye.join(e,r,s);Rt.mkdirSync(i,{recursive:!0});let o=ye.join(i,ye.basename(t));return Rt.cpSync(t,o,{recursive:!0}),Rt.rmSync(t,{recursive:!0,force:!0}),!0}function aA(t,e){let r=Ag(t,e),n=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),s=ye.join(e,".claude",".rcode-backup",n),i={backupDir:null,removed:{legacySkills:0,legacyCommands:0,legacyAgents:0,unprefixedDupes:0,crossScopeDupes:0,legacyCodexCommands:0}},o=(u,c,l)=>{let d=0;for(let f of u)iA(f.srcPath,s,c,l)&&d++;return d};return i.removed.legacySkills=o(r.detail.projectLegacy.skills,"project","skill")+o(r.detail.globalLegacy.skills,"global","skill"),i.removed.legacyCommands=o(r.detail.projectLegacy.commands,"project","command")+o(r.detail.globalLegacy.commands,"global","command"),i.removed.legacyAgents=o(r.detail.projectLegacy.agents,"project","agent")+o(r.detail.globalLegacy.agents,"global","agent"),i.removed.unprefixedDupes=o(r.detail.projectUnprefixed,"project","command")+o(r.detail.globalUnprefixed,"global","command"),i.removed.crossScopeDupes=o(r.detail.crossScope,"global","command"),i.removed.legacyCodexCommands=o(r.detail.codexSlashCommands,"global","command"),Object.values(i.removed).reduce((u,c)=>u+c,0)>0&&(i.backupDir=s),i}Fg.exports={findLegacyRihalArtifacts:rc,findUnprefixedTwinDupes:nc,findCrossScopeDupes:kg,findLegacyCodexSlashCommands:$g,scanNamespaceDuplication:Ag,migrateNamespace:aA}});var Rg=v((HI,Lo)=>{var ce=require("fs"),fe=require("path"),{spawnSync:jg}=require("child_process"),us=Uu(),{PromptAbortError:uA}=as(),{writeFileAtomic:cA}=Kt(),{homedir:lA}=dr(),{verifyInstall:dA,formatReport:fA}=ss(),hA=is();function pA(t){let e=ce.readFileSync(t,"utf8"),r={};for(let n of e.split(/\r?\n/)){let s=n.replace(/#.*$/,"").trimEnd();if(!s||s.startsWith(" "))continue;let i=s.indexOf(":");if(i===-1)continue;let o=s.slice(0,i).trim(),a=s.slice(i+1).trim();a.startsWith('"')&&a.endsWith('"')&&(a=a.slice(1,-1)),a==="true"?a=!0:a==="false"&&(a=!1),r[o]=a}return{obj:r,raw:e}}function mA(t,e,r){let n=new RegExp(`^${e}:[^\\S\\n]*[^\\r\\n]*$`,"m"),s=typeof r=="string"?`${e}: "${r.replace(/"/g,'\\"')}"`:`${e}: ${r}`;return n.test(t)?t.replace(n,s):t.replace(/(?:\r?\n)*$/,"")+`
282
+ `),process.exit(0)}))}var an=null;function ru(){return an||(an=sA(),an)}function sA(){nA();let t=!!process.stdin.isTTY,e=rA.createInterface({input:process.stdin,output:process.stdout,terminal:t}),r=!1,n=!1;e.on("close",()=>{n=!0});let s=[],i=[];t||(e.on("line",c=>{if(i.length>0){let{resolve:u}=i.shift();u(c)}else s.push(c)}),e.on("close",()=>{for(;i.length>0;){let{reject:c}=i.shift();r||c(new Jt("Input stream closed"))}}));function o(c){return t?n?Promise.reject(new Jt("Input stream closed")):new Promise((u,l)=>{let d=!1,f=()=>{!d&&!r&&(d=!0,l(new Jt("Input stream closed")))};e.once("close",f),e.question(c,g=>{d||(d=!0,e.removeListener("close",f),u((g||"").trim()))})}):(process.stdout.write(c),s.length>0?Promise.resolve((s.shift()||"").trim()):n?Promise.reject(new Jt("Input stream closed")):new Promise((u,l)=>{i.push({resolve:d=>u((d||"").trim()),reject:l})}))}function a(){r=!0,e.close()}return{ask:o,close:a}}async function oA(t,{choices:e,default:r="",allowMulti:n=!0,expand:s=null,maxAttempts:i=3}={}){if(!Array.isArray(e)||e.length===0)throw new Error("askChoice: `choices` must be a non-empty array");let o=e.map(l=>l.key),a=e.map(l=>l.id),c=`Valid options: ${o.join(", ")} (or ${a.join(", ")})`,u=ru();for(let l=0;l<i;l++){let d=await u.ask(t),f=d===""?r:d;if(f===""){console.log(` \u26A0 No input and no default. ${c}`);continue}let g=f.split(",").map(h=>h.trim()).filter(Boolean);if(!n&&g.length>1){console.log(` \u26A0 Only one choice allowed, you typed ${g.length}.`);continue}let m=[],y=[];for(let h of g){let w=e.find(C=>C.key===h||C.id===h);if(!w)y.push(h);else if(s)for(let C of s(w.id))m.push(C);else m.push(w.id)}if(m.length===0){console.log(` \u26A0 Didn't recognize: ${y.map(h=>`"${h}"`).join(", ")}`),console.log(` ${c}`),console.log();continue}return y.length>0&&console.log(` \u26A0 Skipping unknown: ${y.map(h=>`"${h}"`).join(", ")}`),[...new Set(m)]}throw new Jt(`No valid selection after ${i} attempts`)}async function iA(t,{default:e="n",maxAttempts:r=3}={}){let n=e.toLowerCase()==="y"?"y":"n",s=ru();for(let i=0;i<r;i++){let o=(await s.ask(t)).toLowerCase(),a=o===""?n:o;if(a==="y"||a==="yes")return!0;if(a==="n"||a==="no")return!1;console.log(' \u26A0 Please answer "y" or "n".')}throw new Jt(`No valid yes/no answer after ${r} attempts`)}async function aA(t,{default:e="",validate:r=null,maxAttempts:n=3}={}){let s=ru();for(let i=0;i<n;i++){let o=await s.ask(t),a=o===""?e:o;if(r){let c=r(a);if(c!==!0){console.log(` \u26A0 ${typeof c=="string"?c:"Invalid input."}`);continue}}else if(a===""){console.log(" \u26A0 Please enter a value.");continue}return a}throw new Jt(`No valid text input after ${n} attempts`)}function cA(){an&&(an.close(),an=null)}$g.exports={askChoice:oA,askConfirm:iA,askText:aA,closeSession:cA,PromptAbortError:Jt}});var Lo=v((UI,Ig)=>{"use strict";var Pt=require("fs"),ve=require("path");function cn(t){if(!Pt.existsSync(t))return[];try{return Pt.readdirSync(t,{withFileTypes:!0})}catch{return[]}}function nu(t){let e=[],r=ve.join(t,"skills");for(let a of cn(r)){if(!a.isDirectory()||!a.name.startsWith("rihal-"))continue;let c="rcode-"+a.name.slice(6);Pt.existsSync(ve.join(r,c))&&e.push({name:a.name,twin:c,srcPath:ve.join(r,a.name),kind:"skill"})}let n=[],s=ve.join(t,"commands");for(let a of cn(s)){if(!a.isFile()||!a.name.startsWith("rihal-")||!a.name.endsWith(".md"))continue;let c="rcode-"+a.name.slice(6);Pt.existsSync(ve.join(s,c))&&n.push({name:a.name,twin:c,srcPath:ve.join(s,a.name),kind:"command"})}let i=[],o=ve.join(t,"agents");for(let a of cn(o)){if(!a.isFile()||!a.name.startsWith("rihal-")||!a.name.endsWith(".md"))continue;let c="rcode-"+a.name.slice(6);Pt.existsSync(ve.join(o,c))&&i.push({name:a.name,twin:c,srcPath:ve.join(o,a.name),kind:"agent"})}return{skills:e,commands:n,agents:i}}function su(t){let e=[],r=ve.join(t,"commands");for(let n of cn(r)){if(!n.isFile()||!n.name.endsWith(".md")||n.name.startsWith("rcode-")||n.name.startsWith("rihal-"))continue;let s="rcode-"+n.name;Pt.existsSync(ve.join(r,s))&&e.push({name:n.name,twin:s,srcPath:ve.join(r,n.name),kind:"command"})}return e}function Ag(t,e){let r=[];if(ve.resolve(t)===ve.resolve(e))return r;let n=ve.join(t,"commands"),s=ve.join(e,"commands"),i=new Set(cn(n).filter(o=>o.isFile()&&o.name.endsWith(".md")).map(o=>o.name));for(let o of cn(s))!o.isFile()||!o.name.endsWith(".md")||i.has(o.name)&&r.push({name:o.name,srcPath:ve.join(s,o.name),keptPath:ve.join(n,o.name),kind:"command"});return r}function Fg(t){let e=[],r=ve.join(t,".rcode","slash-commands");for(let n of cn(r)){if(!n.isFile()||!n.name.startsWith("rihal-")||!n.name.endsWith(".md"))continue;let s="rcode-"+n.name.slice(6);Pt.existsSync(ve.join(r,s))&&e.push({name:n.name,twin:s,srcPath:ve.join(r,n.name),kind:"command"})}return e}function jg(t,e){let r=ve.join(t,".claude"),n=ve.join(e,".claude"),s=nu(r),i=nu(n),o=su(r),a=su(n),c=Ag(r,n),u=Fg(e),l=s.skills.length+i.skills.length,d=s.commands.length+i.commands.length,f=s.agents.length+i.agents.length,g=o.length+a.length,m=c.length,y=u.length;return{legacySkillCount:l,legacyCommandCount:d,legacyAgentCount:f,unprefixedCount:g,crossScopeCount:m,legacyCodexCommandCount:y,totalCount:l+d+f+g+m+y,detail:{projectLegacy:s,globalLegacy:i,projectUnprefixed:o,globalUnprefixed:a,crossScope:c,codexSlashCommands:u}}}function uA(t,e,r,n){if(!Pt.existsSync(t))return!1;let s=n==="skill"?"skills":n==="agent"?"agents":"commands",i=ve.join(e,r,s);Pt.mkdirSync(i,{recursive:!0});let o=ve.join(i,ve.basename(t));return Pt.cpSync(t,o,{recursive:!0}),Pt.rmSync(t,{recursive:!0,force:!0}),!0}function lA(t,e){let r=jg(t,e),n=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),s=ve.join(e,".claude",".rcode-backup",n),i={backupDir:null,removed:{legacySkills:0,legacyCommands:0,legacyAgents:0,unprefixedDupes:0,crossScopeDupes:0,legacyCodexCommands:0}},o=(c,u,l)=>{let d=0;for(let f of c)uA(f.srcPath,s,u,l)&&d++;return d};return i.removed.legacySkills=o(r.detail.projectLegacy.skills,"project","skill")+o(r.detail.globalLegacy.skills,"global","skill"),i.removed.legacyCommands=o(r.detail.projectLegacy.commands,"project","command")+o(r.detail.globalLegacy.commands,"global","command"),i.removed.legacyAgents=o(r.detail.projectLegacy.agents,"project","agent")+o(r.detail.globalLegacy.agents,"global","agent"),i.removed.unprefixedDupes=o(r.detail.projectUnprefixed,"project","command")+o(r.detail.globalUnprefixed,"global","command"),i.removed.crossScopeDupes=o(r.detail.crossScope,"global","command"),i.removed.legacyCodexCommands=o(r.detail.codexSlashCommands,"global","command"),Object.values(i.removed).reduce((c,u)=>c+u,0)>0&&(i.backupDir=s),i}Ig.exports={findLegacyRihalArtifacts:nu,findUnprefixedTwinDupes:su,findCrossScopeDupes:Ag,findLegacyCodexSlashCommands:Fg,scanNamespaceDuplication:jg,migrateNamespace:lA}});var Og=v((VI,Bo)=>{var ue=require("fs"),fe=require("path"),{spawnSync:Tg}=require("child_process"),ls=Vc(),{PromptAbortError:dA}=us(),{writeFileAtomic:fA}=Qt(),{homedir:hA}=hr(),{verifyInstall:pA,formatReport:mA}=is(),gA=cs();function DA(t){let e=ue.readFileSync(t,"utf8"),r={};for(let n of e.split(/\r?\n/)){let s=n.replace(/#.*$/,"").trimEnd();if(!s||s.startsWith(" "))continue;let i=s.indexOf(":");if(i===-1)continue;let o=s.slice(0,i).trim(),a=s.slice(i+1).trim();a.startsWith('"')&&a.endsWith('"')&&(a=a.slice(1,-1)),a==="true"?a=!0:a==="false"&&(a=!1),r[o]=a}return{obj:r,raw:e}}function yA(t,e,r){let n=new RegExp(`^${e}:[^\\S\\n]*[^\\r\\n]*$`,"m"),s=typeof r=="string"?`${e}: "${r.replace(/"/g,'\\"')}"`:`${e}: ${r}`;return n.test(t)?t.replace(n,s):t.replace(/(?:\r?\n)*$/,"")+`
263
283
  ${s}
264
- `}function Ig(t){let e={yes:!1};for(let r of t)(r==="--yes"||r==="-y")&&(e.yes=!0);return e}function Tg(t){let e=[],r=fe.join(lA(),".claude/skills"),n=ce.existsSync(fe.join(t,".claude/skills"))&&ce.readdirSync(fe.join(t,".claude/skills")).some(o=>o.startsWith("rcode-"))||ce.existsSync(fe.join(t,".claude/agents"))&&ce.readdirSync(fe.join(t,".claude/agents")).some(o=>o.startsWith("rcode-"))||ce.existsSync(fe.join(t,".claude/commands"))&&ce.readdirSync(fe.join(t,".claude/commands")).some(o=>o.startsWith("rcode-")),s=ce.existsSync(r)&&ce.readdirSync(r).some(o=>o.startsWith("rcode-")),i=ce.existsSync(fe.join(t,".rcode/config.yaml"));return(n||i&&s)&&e.push("claude"),ce.existsSync(fe.join(t,".cursor/rules"))&&ce.readdirSync(fe.join(t,".cursor/rules")).some(a=>a.startsWith("rcode-")&&a.endsWith(".mdc"))&&e.push("cursor"),ce.existsSync(fe.join(t,".windsurf/rules"))&&ce.readdirSync(fe.join(t,".windsurf/rules")).some(a=>a.startsWith("rcode-")&&a.endsWith(".mdc"))&&e.push("windsurf"),ce.existsSync(fe.join(t,".antigravity/agents"))&&ce.readdirSync(fe.join(t,".antigravity/agents")).some(a=>a.startsWith("rcode-"))&&e.push("antigravity"),e}function gA(t,e){let r=[];e.includes("claude")&&r.push(".claude/skills",".claude/commands/rcode"),e.includes("cursor")&&r.push(".cursor/rules"),e.includes("windsurf")&&r.push(".windsurf/rules"),e.includes("antigravity")&&r.push(".antigravity/agents"),ce.existsSync(fe.join(t,"AGENTS.md"))&&r.push("AGENTS.md");let n=r.filter(l=>ce.existsSync(fe.join(t,l)));if(n.length===0)return{ok:!1,warning:"nothing to back up"};if(jg("tar",["--version"],{stdio:"ignore"}).status!==0)return{ok:!1,warning:"tar not available"};let i=fe.join(t,".rcode/backups");try{ce.mkdirSync(i,{recursive:!0})}catch(l){return{ok:!1,warning:`could not create backups dir: ${l.message}`}}let o=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),a=fe.join(i,`update-${o}.tgz`),u=fe.relative(t,a),c=jg("tar",["-czf",a,"-C",t,"--files-from=-"],{input:n.join(`
284
+ `}function Rg(t){let e={yes:!1};for(let r of t)(r==="--yes"||r==="-y")&&(e.yes=!0);return e}function Pg(t){let e=[],r=fe.join(hA(),".claude/skills"),n=ue.existsSync(fe.join(t,".claude/skills"))&&ue.readdirSync(fe.join(t,".claude/skills")).some(o=>o.startsWith("rcode-"))||ue.existsSync(fe.join(t,".claude/agents"))&&ue.readdirSync(fe.join(t,".claude/agents")).some(o=>o.startsWith("rcode-"))||ue.existsSync(fe.join(t,".claude/commands"))&&ue.readdirSync(fe.join(t,".claude/commands")).some(o=>o.startsWith("rcode-")),s=ue.existsSync(r)&&ue.readdirSync(r).some(o=>o.startsWith("rcode-")),i=ue.existsSync(fe.join(t,".rcode/config.yaml"));return(n||i&&s)&&e.push("claude"),ue.existsSync(fe.join(t,".cursor/rules"))&&ue.readdirSync(fe.join(t,".cursor/rules")).some(a=>a.startsWith("rcode-")&&a.endsWith(".mdc"))&&e.push("cursor"),ue.existsSync(fe.join(t,".windsurf/rules"))&&ue.readdirSync(fe.join(t,".windsurf/rules")).some(a=>a.startsWith("rcode-")&&a.endsWith(".mdc"))&&e.push("windsurf"),ue.existsSync(fe.join(t,".antigravity/agents"))&&ue.readdirSync(fe.join(t,".antigravity/agents")).some(a=>a.startsWith("rcode-"))&&e.push("antigravity"),e}function vA(t,e){let r=[];e.includes("claude")&&r.push(".claude/skills",".claude/commands/rcode"),e.includes("cursor")&&r.push(".cursor/rules"),e.includes("windsurf")&&r.push(".windsurf/rules"),e.includes("antigravity")&&r.push(".antigravity/agents"),ue.existsSync(fe.join(t,"AGENTS.md"))&&r.push("AGENTS.md");let n=r.filter(l=>ue.existsSync(fe.join(t,l)));if(n.length===0)return{ok:!1,warning:"nothing to back up"};if(Tg("tar",["--version"],{stdio:"ignore"}).status!==0)return{ok:!1,warning:"tar not available"};let i=fe.join(t,".rcode/backups");try{ue.mkdirSync(i,{recursive:!0})}catch(l){return{ok:!1,warning:`could not create backups dir: ${l.message}`}}let o=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),a=fe.join(i,`update-${o}.tgz`),c=fe.relative(t,a),u=Tg("tar",["-czf",a,"-C",t,"--files-from=-"],{input:n.join(`
265
285
  `)+`
266
- `,encoding:"utf8"});return c.status!==0?{ok:!1,warning:`tar failed: ${(c.stderr||"").trim()}`}:{ok:!0,path:u}}function DA(t,e){let r={claude:0,cursor:0,windsurf:0,antigravity:0};if(e.includes("claude")){let n=fe.join(t,".claude/skills");if(ce.existsSync(n))for(let o of ce.readdirSync(n))o.startsWith("rcode-")&&(ce.rmSync(fe.join(n,o),{recursive:!0,force:!0}),r.claude++);let s=fe.join(t,".claude/commands/rcode");ce.existsSync(s)&&ce.rmSync(s,{recursive:!0,force:!0});let i=fe.join(t,".claude/commands");if(ce.existsSync(i))for(let o of ce.readdirSync(i))o.startsWith("rcode-")&&(o.endsWith(".md")||o.endsWith(".mdc"))&&ce.unlinkSync(fe.join(i,o))}if(e.includes("cursor")){let n=fe.join(t,".cursor/rules");if(ce.existsSync(n))for(let s of ce.readdirSync(n))s.startsWith("rcode-")&&s.endsWith(".mdc")&&(ce.rmSync(fe.join(n,s)),r.cursor++)}if(e.includes("windsurf")){let n=fe.join(t,".windsurf/rules");if(ce.existsSync(n))for(let s of ce.readdirSync(n))s.startsWith("rcode-")&&s.endsWith(".mdc")&&(ce.rmSync(fe.join(n,s)),r.windsurf++)}if(e.includes("antigravity")){let n=fe.join(t,".antigravity/agents");if(ce.existsSync(n))for(let s of ce.readdirSync(n))s.startsWith("rcode-")&&(ce.rmSync(fe.join(n,s)),r.antigravity++)}return r}function yA(t){let e=fe.join(t,"AGENTS.md");if(!ce.existsSync(e))return;let r=ce.readFileSync(e,"utf8"),n=[/\n*---\n+## rcode Agents \(installed\)[\s\S]*?(?=\n## |\n*$)/,/\n*## rcode Agents \(installed\)[\s\S]*?(?=\n## |\n*$)/],s=!1;for(let i of n)i.test(r)&&(r=r.replace(i,""),s=!0);if(s){r=r.replace(/\n---\n+$/,`
267
- `);let{writeFileAtomic:i}=Kt();i(e,r)}}Lo.exports=async function(e,{packageRoot:r,packageJson:n}){try{return await vA(e,{packageRoot:r,packageJson:n})}catch(s){throw s instanceof uA&&(console.log(`
268
- \u274C Update cancelled \u2014 ${s.message}.`),process.exit(0)),s}};async function vA(t,{packageRoot:e,packageJson:r}){let n=process.cwd(),s=Ig(t),i=r?.version||"0.0.0",o=fe.join(n,".rcode/config.yaml"),a=fe.join(n,".rcode/config.json"),u=ce.existsSync(o)?o:a;ce.existsSync(u)||(console.error(`
286
+ `,encoding:"utf8"});return u.status!==0?{ok:!1,warning:`tar failed: ${(u.stderr||"").trim()}`}:{ok:!0,path:c}}function _A(t,e){let r={claude:0,cursor:0,windsurf:0,antigravity:0};if(e.includes("claude")){let n=fe.join(t,".claude/skills");if(ue.existsSync(n))for(let o of ue.readdirSync(n))o.startsWith("rcode-")&&(ue.rmSync(fe.join(n,o),{recursive:!0,force:!0}),r.claude++);let s=fe.join(t,".claude/commands/rcode");ue.existsSync(s)&&ue.rmSync(s,{recursive:!0,force:!0});let i=fe.join(t,".claude/commands");if(ue.existsSync(i))for(let o of ue.readdirSync(i))o.startsWith("rcode-")&&(o.endsWith(".md")||o.endsWith(".mdc"))&&ue.unlinkSync(fe.join(i,o))}if(e.includes("cursor")){let n=fe.join(t,".cursor/rules");if(ue.existsSync(n))for(let s of ue.readdirSync(n))s.startsWith("rcode-")&&s.endsWith(".mdc")&&(ue.rmSync(fe.join(n,s)),r.cursor++)}if(e.includes("windsurf")){let n=fe.join(t,".windsurf/rules");if(ue.existsSync(n))for(let s of ue.readdirSync(n))s.startsWith("rcode-")&&s.endsWith(".mdc")&&(ue.rmSync(fe.join(n,s)),r.windsurf++)}if(e.includes("antigravity")){let n=fe.join(t,".antigravity/agents");if(ue.existsSync(n))for(let s of ue.readdirSync(n))s.startsWith("rcode-")&&(ue.rmSync(fe.join(n,s)),r.antigravity++)}return r}function bA(t){let e=fe.join(t,"AGENTS.md");if(!ue.existsSync(e))return;let r=ue.readFileSync(e,"utf8"),n=[/\n*---\n+## rcode Agents \(installed\)[\s\S]*?(?=\n## |\n*$)/,/\n*## rcode Agents \(installed\)[\s\S]*?(?=\n## |\n*$)/],s=!1;for(let i of n)i.test(r)&&(r=r.replace(i,""),s=!0);if(s){r=r.replace(/\n---\n+$/,`
287
+ `);let{writeFileAtomic:i}=Qt();i(e,r)}}Bo.exports=async function(e,{packageRoot:r,packageJson:n}){try{return await SA(e,{packageRoot:r,packageJson:n})}catch(s){throw s instanceof dA&&(console.log(`
288
+ \u274C Update cancelled \u2014 ${s.message}.`),process.exit(0)),s}};async function SA(t,{packageRoot:e,packageJson:r}){let n=process.cwd(),s=Rg(t),i=r?.version||"0.0.0",o=fe.join(n,".rcode/config.yaml"),a=fe.join(n,".rcode/config.json"),c=ue.existsSync(o)?o:a;ue.existsSync(c)||(console.error(`
269
289
  \u274C rcode is not installed in this directory.`),console.error(` To install: rcode install
270
- `),process.exit(1));let c,l="",d=u.endsWith(".yaml");try{if(d){let T=pA(u);c=T.obj,l=T.raw}else c=JSON.parse(ce.readFileSync(u,"utf8"))}catch(T){console.error(`
271
- \u274C ${fe.basename(u)} is not parseable: ${T.message}
272
- `),process.exit(1)}let f=c.installed_version||"(unknown, pre-tracking)",g=Tg(n);if(g.length===0&&(console.error(`
290
+ `),process.exit(1));let u,l="",d=c.endsWith(".yaml");try{if(d){let T=DA(c);u=T.obj,l=T.raw}else u=JSON.parse(ue.readFileSync(c,"utf8"))}catch(T){console.error(`
291
+ \u274C ${fe.basename(c)} is not parseable: ${T.message}
292
+ `),process.exit(1)}let f=u.installed_version||"(unknown, pre-tracking)",g=Pg(n);if(g.length===0&&(console.error(`
273
293
  \u274C No editor install detected.`),console.error(` Run 'rcode install' to set up at least one editor first.
274
294
  `),process.exit(1)),console.log(`
275
295
  \u{1F54C} rcode \u2014 Update
276
- `),console.log(` Installed: ${f}`),console.log(` Package: ${i}`),console.log(` Editors: ${g.join(", ")}`),console.log(),f===i&&(console.log(" \u2139 Already at the current package version."),console.log(" Refreshing files will overwrite any manual changes to"),console.log(" installed skill/command files with the package copies."),console.log()),!s.yes){let V=["claude","cursor","gemini"].filter(I=>!g.includes(I));if(V.length>0){let I={claude:"Claude Code",cursor:"Cursor",gemini:"Gemini CLI"},H=await us.multiselect({message:"Add support for additional editors?",options:V.map(F=>({value:F,label:I[F]||F})),required:!1});us.isCancel(H)&&(us.cancel("Update cancelled."),process.exit(0));for(let F of H)g.push(F);console.log(` Editors to update: ${g.join(", ")}`),console.log()}}if(!s.yes){let T=await us.confirm({message:"Proceed with update?",initialValue:!1});if(us.isCancel(T)||!T){console.log(`
277
- \u274C Update cancelled. Nothing changed.`);return}}console.log();let m=gA(n,g);m.ok?console.log(` \u{1F4BE} backup: ${m.path}`):console.log(` \u26A0 no backup created (${m.warning}) \u2014 continuing anyway`);let y=DA(n,g),h=y.claude+y.cursor+y.windsurf+y.antigravity;console.log(` \u{1F9F9} cleaned ${h} old skill files`),yA(n),console.log();let w=g.filter(T=>["claude","cursor","gemini"].includes(T));if(w.length>0){if(g.some(T=>!["claude","cursor","gemini"].includes(T))){let T=g.filter(V=>!["claude","cursor","gemini"].includes(V));console.log(` \u26A0 ${T.join(", ")} refresh not yet supported by installer \u2014 skipping`)}hA.install({target:n,force:!0,yes:!0,userName:c.user_name||require("os").userInfo().username,projectName:c.project_name||require("path").basename(n),language:c.language||"English",mode:c.mode||"guided",ides:w,modules:[],help:!1}),console.log(` \u2713 [${w.join(", ")}] \u2192 refreshed via install.js`)}if(d){let T=mA(l,"installed_version",i);cA(u,T)}else{c.installed_version=i;let{writeJsonAtomic:T}=Kt();T(u,c)}console.log(` \u2713 ${fe.relative(n,u)} \u2192 installed_version: ${i}`);try{let{migrateNamespace:T}=No(),{homedir:V}=dr(),I=T(n,V()),H=Object.values(I.removed).reduce((F,q)=>F+q,0);H>0&&(console.log(` \u{1F9F9} migrated ${H} legacy rihal-*/duplicate command registration(s)`),I.backupDir&&console.log(` backup: ${I.backupDir}`))}catch(T){console.log(` \u26A0 namespace migration skipped: ${T.message}`)}console.log();let{reports:C,hasDrift:A}=dA(n,e,g);A?(console.log("\u26A0 Post-update verification found drift:"),console.log(fA(C)),console.log(`
278
- Run 'rcode doctor' for details, or re-run update to retry.`)):console.log(" \u2713 Post-update verification passed."),console.log(),console.log(f===i?`\u2705 rcode ${i} refreshed.`:`\u2705 rcode updated: ${f} \u2192 ${i}`),m.ok&&console.log(` Rollback: tar -xzf ${m.path}`),console.log()}Lo.exports.parseArgs=Ig;Lo.exports.detectInstalledEditors=Tg});var ac=v((ZI,ar)=>{var W=require("fs"),sc=require("os"),M=require("path"),{spawnSync:Pg}=require("child_process"),{askConfirm:Og,PromptAbortError:Ng}=as(),{writeFileAtomic:ic,safeRmSync:jr}=Kt();function _A(t){let e={editor:null,keepState:!1,deleteState:!1,yes:!1,purge:!1};for(let r of t)r.startsWith("--editor=")?e.editor=r.slice(9):r==="--keep-state"?e.keepState=!0:r==="--delete-state"?e.deleteState=!0:r==="--yes"||r==="-y"?e.yes=!0:(r==="--purge"||r==="--all")&&(e.purge=!0,e.deleteState=!0);return e}function Lg(t){return/\.local\.(md|mdc|json|yaml|yml|toml|js|ts)$/.test(t)}function Bg(t){return t.replace(/\n?# ===== rcode-managed gitignore block[\s\S]*?# ===== end rcode-managed gitignore block =====\n?/g,`
296
+ `),console.log(` Installed: ${f}`),console.log(` Package: ${i}`),console.log(` Editors: ${g.join(", ")}`),console.log(),f===i&&(console.log(" \u2139 Already at the current package version."),console.log(" Refreshing files will overwrite any manual changes to"),console.log(" installed skill/command files with the package copies."),console.log()),!s.yes){let G=["claude","cursor","gemini"].filter(I=>!g.includes(I));if(G.length>0){let I={claude:"Claude Code",cursor:"Cursor",gemini:"Gemini CLI"},Z=await ls.multiselect({message:"Add support for additional editors?",options:G.map(F=>({value:F,label:I[F]||F})),required:!1});ls.isCancel(Z)&&(ls.cancel("Update cancelled."),process.exit(0));for(let F of Z)g.push(F);console.log(` Editors to update: ${g.join(", ")}`),console.log()}}if(!s.yes){let T=await ls.confirm({message:"Proceed with update?",initialValue:!1});if(ls.isCancel(T)||!T){console.log(`
297
+ \u274C Update cancelled. Nothing changed.`);return}}console.log();let m=vA(n,g);m.ok?console.log(` \u{1F4BE} backup: ${m.path}`):console.log(` \u26A0 no backup created (${m.warning}) \u2014 continuing anyway`);let y=_A(n,g),h=y.claude+y.cursor+y.windsurf+y.antigravity;console.log(` \u{1F9F9} cleaned ${h} old skill files`),bA(n),console.log();let w=g.filter(T=>["claude","cursor","gemini"].includes(T));if(w.length>0){if(g.some(T=>!["claude","cursor","gemini"].includes(T))){let T=g.filter(G=>!["claude","cursor","gemini"].includes(G));console.log(` \u26A0 ${T.join(", ")} refresh not yet supported by installer \u2014 skipping`)}gA.install({target:n,force:!0,yes:!0,userName:u.user_name||require("os").userInfo().username,projectName:u.project_name||require("path").basename(n),language:u.language||"English",mode:u.mode||"guided",ides:w,modules:[],help:!1}),console.log(` \u2713 [${w.join(", ")}] \u2192 refreshed via install.js`)}if(d){let T=yA(l,"installed_version",i);fA(c,T)}else{u.installed_version=i;let{writeJsonAtomic:T}=Qt();T(c,u)}console.log(` \u2713 ${fe.relative(n,c)} \u2192 installed_version: ${i}`);try{let{migrateNamespace:T}=Lo(),{homedir:G}=hr(),I=T(n,G()),Z=Object.values(I.removed).reduce((F,W)=>F+W,0);Z>0&&(console.log(` \u{1F9F9} migrated ${Z} legacy rihal-*/duplicate command registration(s)`),I.backupDir&&console.log(` backup: ${I.backupDir}`))}catch(T){console.log(` \u26A0 namespace migration skipped: ${T.message}`)}console.log();let{reports:C,hasDrift:A}=pA(n,e,g);A?(console.log("\u26A0 Post-update verification found drift:"),console.log(mA(C)),console.log(`
298
+ Run 'rcode doctor' for details, or re-run update to retry.`)):console.log(" \u2713 Post-update verification passed."),console.log(),console.log(f===i?`\u2705 rcode ${i} refreshed.`:`\u2705 rcode updated: ${f} \u2192 ${i}`),m.ok&&console.log(` Rollback: tar -xzf ${m.path}`),console.log()}Bo.exports.parseArgs=Rg;Bo.exports.detectInstalledEditors=Pg});var cu=v((GI,cr)=>{var H=require("fs"),ou=require("os"),M=require("path"),{spawnSync:Ng}=require("child_process"),{askConfirm:Lg,PromptAbortError:Bg}=us(),{writeFileAtomic:au,safeRmSync:Tr}=Qt();function EA(t){let e={editor:null,keepState:!1,deleteState:!1,yes:!1,purge:!1};for(let r of t)r.startsWith("--editor=")?e.editor=r.slice(9):r==="--keep-state"?e.keepState=!0:r==="--delete-state"?e.deleteState=!0:r==="--yes"||r==="-y"?e.yes=!0:(r==="--purge"||r==="--all")&&(e.purge=!0,e.deleteState=!0);return e}function Mg(t){return/\.local\.(md|mdc|json|yaml|yml|toml|js|ts)$/.test(t)}function qg(t){return t.replace(/\n?# ===== rcode-managed gitignore block[\s\S]*?# ===== end rcode-managed gitignore block =====\n?/g,`
279
299
  `).replace(/\n?# >>> rcode >>>[\s\S]*?# <<< rcode <<<\n?/g,`
280
300
  `).replace(/\n{3,}/g,`
281
301
 
282
- `)}function bA(t){let e=M.join(t,".git","hooks","pre-commit");if(!W.existsSync(e))return"skipped";let r="# ===== rcode-managed pre-commit block =====",n="# ===== end rcode pre-commit block =====",s;try{s=W.readFileSync(e,"utf8")}catch{return"skipped"}if(!s.includes(r))return"unchanged";let i=s.indexOf(r),o=s.indexOf(n,i);if(o<0)return"unchanged";let a=i;a>0&&s[a-1]===`
283
- `&&a--;let u=o+n.length;u<s.length&&s[u]===`
284
- `&&u++;let c=s.slice(0,a)+s.slice(u),l=c.trim();if(l===""||l==="#!/bin/sh"||l==="#!/bin/bash")try{return W.unlinkSync(e),"removed"}catch{return"skipped"}try{return ic(e,c,{mode:493}),"stripped"}catch{return"skipped"}}function oc(t,e){if(!W.existsSync(t))return"skipped";let r;try{r=JSON.parse(W.readFileSync(t,"utf8"))}catch{return"skipped"}if(!r||typeof r!="object"||!r.hooks||!Array.isArray(r.hooks[e]))return"unchanged";let n=r.hooks[e].length;if(r.hooks[e]=r.hooks[e].filter(s=>!(Array.isArray(s?.hooks)&&s.hooks.some(i=>typeof i?.command=="string"&&i.command.includes("rcode-slash-router.cjs")))),r.hooks[e].length===n)return"unchanged";r.hooks[e].length===0&&delete r.hooks[e];try{return ic(t,JSON.stringify(r,null,2)+`
285
- `),"removed"}catch{return"skipped"}}function In(t,e){if(!W.existsSync(t))return 0;let r=0,n=M.resolve(process.cwd());for(let s of W.readdirSync(t,{withFileTypes:!0})){if(Lg(s.name)||!e(s.name))continue;let i=M.join(t,s.name),o=jr(i,n);if(!o.ok&&o.reason==="outside-root"){console.log(` \u26A0 refused to remove ${i} \u2014 symlink resolves outside project root`);continue}r++}return r}function SA(t){if(!W.existsSync(t))return!1;try{if(W.readdirSync(t).length===0)return W.rmdirSync(t),!0}catch{}return!1}function EA(t,e){for(let r of e)SA(M.join(t,r))}function CA(t,e){let r={claude:{skills:[],commands:[],agents:[],agentsRulesDir:!1},cursor:[],windsurf:[],antigravity:[],gemini:[],vscode:[],agentsMd:null,stateDir:null,planningDir:null};if(e.includes("vscode")){e.includes("claude")||e.push("claude");let o=M.join(t,".vscode/rcode");W.existsSync(o)&&r.vscode.push(".vscode/rcode")}if(e.includes("claude")){let o=M.join(t,".claude/skills");W.existsSync(o)&&(r.claude.skills=W.readdirSync(o).filter(l=>l.startsWith("rcode-")||qg(l)));let a=M.join(t,".claude/commands/rcode");W.existsSync(a)&&(r.claude.commands=W.readdirSync(a));let u=M.join(t,".claude/commands");if(W.existsSync(u)){let l=W.readdirSync(u).filter(d=>d.startsWith("rcode-")&&(d.endsWith(".md")||d.endsWith(".mdc")));r.claude.commands=[...r.claude.commands,...l]}let c=M.join(t,".claude/agents");if(W.existsSync(c)){let l=W.readdirSync(c);r.claude.agents=l.filter(d=>d.startsWith("rcode-")&&d.endsWith(".md")),r.claude.agents=[...r.claude.agents,...l.filter(d=>d.startsWith("rihal-")&&d.endsWith(".md"))]}W.existsSync(M.join(t,".claude/agents/rules"))&&(r.claude.agentsRulesDir=!0)}if(e.includes("cursor")){let o=M.join(t,".cursor/rules");W.existsSync(o)&&(r.cursor=W.readdirSync(o).filter(a=>a.startsWith("rcode-")||a==="rcode.mdc"||a==="rcode-method.mdc"||a==="rcode"))}if(e.includes("windsurf")){let o=M.join(t,".windsurf/rules");W.existsSync(o)&&(r.windsurf=W.readdirSync(o).filter(a=>a.startsWith("rcode-")||a==="rcode.mdc"||a==="rcode-method.mdc"))}if(e.includes("antigravity")){let o=M.join(t,".antigravity/agents");W.existsSync(o)&&(r.antigravity=W.readdirSync(o).filter(a=>a.startsWith("rcode-")))}if(e.includes("gemini"))for(let o of["agents","commands"]){let a=M.join(t,".gemini","rcode",o);if(W.existsSync(a))for(let u of W.readdirSync(a))(u.startsWith("rcode-")||u.endsWith(".md"))&&r.gemini.push(M.join(".gemini/rcode",o,u))}let n=M.join(t,"AGENTS.md");if(W.existsSync(n)){let o=W.readFileSync(n,"utf8");(o.includes("## rcode Agents (installed)")||o.includes("## rcode Method Agents (installed)"))&&(r.agentsMd="present")}let s=M.join(t,".rcode");if(W.existsSync(s)){let a=function(u){for(let c of W.readdirSync(u,{withFileTypes:!0}))c.isDirectory()?a(M.join(u,c.name)):o++};var i=a;let o=0;try{a(s)}catch{}r.stateDir={files:o}}return r}function Mg(){try{let{readPackageManifest:t}=ss(),e=M.resolve(__dirname,".."),r=t(e);if(r&&r.actions instanceof Set&&r.actions.size>0)return Array.from(r.actions)}catch{}return[]}var wA=Mg();function qg(t){return wA.includes(t)}function Wg(t,e,r={}){let n=[];for(let i of t.claude.skills)n.push(M.join(".claude/skills",i));for(let i of t.claude.commands)i.startsWith("rcode-")&&i.endsWith(".md")&&n.push(M.join(".claude/commands",i));t.claude.commands.some(i=>!i.startsWith("rcode-"))&&n.push(".claude/commands/rcode");for(let i of t.claude.agents)n.push(M.join(".claude/agents",i));t.claude.agentsRulesDir&&n.push(".claude/agents/rules");for(let i of t.cursor)n.push(M.join(".cursor/rules",i));for(let i of t.windsurf)n.push(M.join(".windsurf/rules",i));for(let i of t.antigravity)n.push(M.join(".antigravity/agents",i));if(Array.isArray(t.gemini))for(let i of t.gemini)n.push(i);if(Array.isArray(t.vscode))for(let i of t.vscode)n.push(i);if(t.agentsMd&&W.existsSync(M.join(e,"AGENTS.md"))&&n.push("AGENTS.md"),r.purge){let i=M.join(e,".rcode");if(W.existsSync(i))try{for(let o of W.readdirSync(i))o!=="backups"&&n.push(M.join(".rcode",o))}catch{}W.existsSync(M.join(e,".planning"))&&n.push(".planning")}return n}function xA(t,e,r={}){let n=Wg(e,t,{purge:r.purge===!0}).map(l=>l.split(M.sep).join("/"));if(n.length===0)return{ok:!1,warning:"nothing to back up"};if(Pg("tar",["--version"],{stdio:"ignore"}).status!==0)return{ok:!1,warning:"tar not available on this system"};let i=r.purge?M.join(t,".rcode-backups"):M.join(t,".rcode/backups");try{W.mkdirSync(i,{recursive:!0})}catch(l){return{ok:!1,warning:`could not create ${M.relative(t,i)}/: ${l.message}`}}let o=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),a=M.join(i,`uninstall-${o}.tgz`),u=M.relative(t,a),c=Pg("tar",["-czf",a,"-C",t,"--files-from=-"],{input:n.join(`
302
+ `)}function CA(t){let e=M.join(t,".git","hooks","pre-commit");if(!H.existsSync(e))return"skipped";let r="# ===== rcode-managed pre-commit block =====",n="# ===== end rcode pre-commit block =====",s;try{s=H.readFileSync(e,"utf8")}catch{return"skipped"}if(!s.includes(r))return"unchanged";let i=s.indexOf(r),o=s.indexOf(n,i);if(o<0)return"unchanged";let a=i;a>0&&s[a-1]===`
303
+ `&&a--;let c=o+n.length;c<s.length&&s[c]===`
304
+ `&&c++;let u=s.slice(0,a)+s.slice(c),l=u.trim();if(l===""||l==="#!/bin/sh"||l==="#!/bin/bash")try{return H.unlinkSync(e),"removed"}catch{return"skipped"}try{return au(e,u,{mode:493}),"stripped"}catch{return"skipped"}}function iu(t,e){if(!H.existsSync(t))return"skipped";let r;try{r=JSON.parse(H.readFileSync(t,"utf8"))}catch{return"skipped"}if(!r||typeof r!="object"||!r.hooks||!Array.isArray(r.hooks[e]))return"unchanged";let n=r.hooks[e].length;if(r.hooks[e]=r.hooks[e].filter(s=>!(Array.isArray(s?.hooks)&&s.hooks.some(i=>typeof i?.command=="string"&&i.command.includes("rcode-slash-router.cjs")))),r.hooks[e].length===n)return"unchanged";r.hooks[e].length===0&&delete r.hooks[e];try{return au(t,JSON.stringify(r,null,2)+`
305
+ `),"removed"}catch{return"skipped"}}function Rn(t,e){if(!H.existsSync(t))return 0;let r=0,n=M.resolve(process.cwd());for(let s of H.readdirSync(t,{withFileTypes:!0})){if(Mg(s.name)||!e(s.name))continue;let i=M.join(t,s.name),o=Tr(i,n);if(!o.ok&&o.reason==="outside-root"){console.log(` \u26A0 refused to remove ${i} \u2014 symlink resolves outside project root`);continue}r++}return r}function wA(t){if(!H.existsSync(t))return!1;try{if(H.readdirSync(t).length===0)return H.rmdirSync(t),!0}catch{}return!1}function xA(t,e){for(let r of e)wA(M.join(t,r))}function kA(t,e){let r={claude:{skills:[],commands:[],agents:[],agentsRulesDir:!1},cursor:[],windsurf:[],antigravity:[],gemini:[],vscode:[],agentsMd:null,stateDir:null,planningDir:null};if(e.includes("vscode")){e.includes("claude")||e.push("claude");let o=M.join(t,".vscode/rcode");H.existsSync(o)&&r.vscode.push(".vscode/rcode")}if(e.includes("claude")){let o=M.join(t,".claude/skills");H.existsSync(o)&&(r.claude.skills=H.readdirSync(o).filter(l=>l.startsWith("rcode-")||Hg(l)));let a=M.join(t,".claude/commands/rcode");H.existsSync(a)&&(r.claude.commands=H.readdirSync(a));let c=M.join(t,".claude/commands");if(H.existsSync(c)){let l=H.readdirSync(c).filter(d=>d.startsWith("rcode-")&&(d.endsWith(".md")||d.endsWith(".mdc")));r.claude.commands=[...r.claude.commands,...l]}let u=M.join(t,".claude/agents");if(H.existsSync(u)){let l=H.readdirSync(u);r.claude.agents=l.filter(d=>d.startsWith("rcode-")&&d.endsWith(".md")),r.claude.agents=[...r.claude.agents,...l.filter(d=>d.startsWith("rihal-")&&d.endsWith(".md"))]}H.existsSync(M.join(t,".claude/agents/rules"))&&(r.claude.agentsRulesDir=!0)}if(e.includes("cursor")){let o=M.join(t,".cursor/rules");H.existsSync(o)&&(r.cursor=H.readdirSync(o).filter(a=>a.startsWith("rcode-")||a==="rcode.mdc"||a==="rcode-method.mdc"||a==="rcode"))}if(e.includes("windsurf")){let o=M.join(t,".windsurf/rules");H.existsSync(o)&&(r.windsurf=H.readdirSync(o).filter(a=>a.startsWith("rcode-")||a==="rcode.mdc"||a==="rcode-method.mdc"))}if(e.includes("antigravity")){let o=M.join(t,".antigravity/agents");H.existsSync(o)&&(r.antigravity=H.readdirSync(o).filter(a=>a.startsWith("rcode-")))}if(e.includes("gemini"))for(let o of["agents","commands"]){let a=M.join(t,".gemini","rcode",o);if(H.existsSync(a))for(let c of H.readdirSync(a))(c.startsWith("rcode-")||c.endsWith(".md"))&&r.gemini.push(M.join(".gemini/rcode",o,c))}let n=M.join(t,"AGENTS.md");if(H.existsSync(n)){let o=H.readFileSync(n,"utf8");(o.includes("## rcode Agents (installed)")||o.includes("## rcode Method Agents (installed)"))&&(r.agentsMd="present")}let s=M.join(t,".rcode");if(H.existsSync(s)){let a=function(c){for(let u of H.readdirSync(c,{withFileTypes:!0}))u.isDirectory()?a(M.join(c,u.name)):o++};var i=a;let o=0;try{a(s)}catch{}r.stateDir={files:o}}return r}function Wg(){try{let{readPackageManifest:t}=is(),e=M.resolve(__dirname,".."),r=t(e);if(r&&r.actions instanceof Set&&r.actions.size>0)return Array.from(r.actions)}catch{}return[]}var $A=Wg();function Hg(t){return $A.includes(t)}function Zg(t,e,r={}){let n=[];for(let i of t.claude.skills)n.push(M.join(".claude/skills",i));for(let i of t.claude.commands)i.startsWith("rcode-")&&i.endsWith(".md")&&n.push(M.join(".claude/commands",i));t.claude.commands.some(i=>!i.startsWith("rcode-"))&&n.push(".claude/commands/rcode");for(let i of t.claude.agents)n.push(M.join(".claude/agents",i));t.claude.agentsRulesDir&&n.push(".claude/agents/rules");for(let i of t.cursor)n.push(M.join(".cursor/rules",i));for(let i of t.windsurf)n.push(M.join(".windsurf/rules",i));for(let i of t.antigravity)n.push(M.join(".antigravity/agents",i));if(Array.isArray(t.gemini))for(let i of t.gemini)n.push(i);if(Array.isArray(t.vscode))for(let i of t.vscode)n.push(i);if(t.agentsMd&&H.existsSync(M.join(e,"AGENTS.md"))&&n.push("AGENTS.md"),r.purge){let i=M.join(e,".rcode");if(H.existsSync(i))try{for(let o of H.readdirSync(i))o!=="backups"&&n.push(M.join(".rcode",o))}catch{}H.existsSync(M.join(e,".planning"))&&n.push(".planning")}return n}function AA(t,e,r={}){let n=Zg(e,t,{purge:r.purge===!0}).map(l=>l.split(M.sep).join("/"));if(n.length===0)return{ok:!1,warning:"nothing to back up"};if(Ng("tar",["--version"],{stdio:"ignore"}).status!==0)return{ok:!1,warning:"tar not available on this system"};let i=r.purge?M.join(t,".rcode-backups"):M.join(t,".rcode/backups");try{H.mkdirSync(i,{recursive:!0})}catch(l){return{ok:!1,warning:`could not create ${M.relative(t,i)}/: ${l.message}`}}let o=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),a=M.join(i,`uninstall-${o}.tgz`),c=M.relative(t,a),u=Ng("tar",["-czf",a,"-C",t,"--files-from=-"],{input:n.join(`
286
306
  `)+`
287
- `,encoding:"utf8"});return c.status!==0?{ok:!1,warning:`tar exited ${c.status}: ${(c.stderr||"").trim()}`}:{ok:!0,path:u}}function kA(t){if(!W.existsSync(t))return!1;let e=W.readFileSync(t,"utf8"),r=!1,n=[/\n*---\n+## rcode Agents \(installed\)[\s\S]*?(?=\n## |\n*$)/,/\n*---\n+## rcode Method Agents \(installed\)[\s\S]*?(?=\n## |\n*$)/,/\n*## rcode Agents \(installed\)[\s\S]*?(?=\n## |\n*$)/,/\n*## rcode Method Agents \(installed\)[\s\S]*?(?=\n## |\n*$)/];for(let s of n)s.test(e)&&(e=e.replace(s,""),r=!0);return r&&(e=e.replace(/\n---\n+$/,`
288
- `),ic(t,e)),r}ar.exports=async function(e){try{return await $A(e)}catch(r){throw r instanceof Ng&&(console.log(`
289
- \u274C Uninstall cancelled \u2014 ${r.message}.`),process.exit(0)),r}};async function $A(t){let e=_A(t),r=process.cwd(),{SUPPORTED_IDES:n}=is(),s=e.editor?e.editor==="all"?Array.from(n):[e.editor]:Array.from(n);console.log(`
307
+ `,encoding:"utf8"});return u.status!==0?{ok:!1,warning:`tar exited ${u.status}: ${(u.stderr||"").trim()}`}:{ok:!0,path:c}}function FA(t){if(!H.existsSync(t))return!1;let e=H.readFileSync(t,"utf8"),r=!1,n=[/\n*---\n+## rcode Agents \(installed\)[\s\S]*?(?=\n## |\n*$)/,/\n*---\n+## rcode Method Agents \(installed\)[\s\S]*?(?=\n## |\n*$)/,/\n*## rcode Agents \(installed\)[\s\S]*?(?=\n## |\n*$)/,/\n*## rcode Method Agents \(installed\)[\s\S]*?(?=\n## |\n*$)/];for(let s of n)s.test(e)&&(e=e.replace(s,""),r=!0);return r&&(e=e.replace(/\n---\n+$/,`
308
+ `),au(t,e)),r}cr.exports=async function(e){try{return await jA(e)}catch(r){throw r instanceof Bg&&(console.log(`
309
+ \u274C Uninstall cancelled \u2014 ${r.message}.`),process.exit(0)),r}};async function jA(t){let e=EA(t),r=process.cwd(),{SUPPORTED_IDES:n}=cs(),s=e.editor?e.editor==="all"?Array.from(n):[e.editor]:Array.from(n);console.log(`
290
310
  \u{1F54C} rcode \u2014 Uninstall
291
- `),console.log(` Project: ${r}`),console.log(` Scope: ${s.join(", ")}`),console.log();let i=W.existsSync(M.join(r,".rcode/config.yaml"))||W.existsSync(M.join(r,".rcode/config.json")),o=W.existsSync(M.join(r,".claude/skills"))||W.existsSync(M.join(r,".cursor/rules"))||W.existsSync(M.join(r,".windsurf/rules"))||W.existsSync(M.join(r,".antigravity/agents"));if(!i&&!o){console.log(`
292
- \u274C rcode is not installed in this directory.`),console.log(" Nothing to uninstall."),console.log(),console.log(" To install: rcode install"),console.log();return}let a=CA(r,s),u=a.claude.skills.length,c=a.claude.commands.length,l=a.cursor.length,d=a.windsurf.length,f=a.antigravity.length,g=a.claude.agents.length,m=u+c+g+l+d+f;if(m===0&&!a.agentsMd&&!a.stateDir){console.log(`
311
+ `),console.log(` Project: ${r}`),console.log(` Scope: ${s.join(", ")}`),console.log();let i=H.existsSync(M.join(r,".rcode/config.yaml"))||H.existsSync(M.join(r,".rcode/config.json")),o=H.existsSync(M.join(r,".claude/skills"))||H.existsSync(M.join(r,".cursor/rules"))||H.existsSync(M.join(r,".windsurf/rules"))||H.existsSync(M.join(r,".antigravity/agents"));if(!i&&!o){console.log(`
312
+ \u274C rcode is not installed in this directory.`),console.log(" Nothing to uninstall."),console.log(),console.log(" To install: rcode install"),console.log();return}let a=kA(r,s),c=a.claude.skills.length,u=a.claude.commands.length,l=a.cursor.length,d=a.windsurf.length,f=a.antigravity.length,g=a.claude.agents.length,m=c+u+g+l+d+f;if(m===0&&!a.agentsMd&&!a.stateDir){console.log(`
293
313
  \u274C No rcode files found to remove.`),console.log(" The install markers are present but all files have already been deleted."),console.log();return}if(console.log(`What will be removed:
294
- `),s.includes("claude")&&(console.log(" Claude Code"),console.log(` .claude/skills/ (rcode-*): ${u} skills`),console.log(` .claude/commands/rcode/: ${c} slash commands`),console.log(` .claude/agents/rcode-*.md: ${g} agents`)),s.includes("cursor")&&(console.log(" Cursor"),console.log(` .cursor/rules/rcode-*.mdc: ${l} rules`)),s.includes("windsurf")&&(console.log(" Windsurf"),console.log(` .windsurf/rules/rcode-*.mdc: ${d} rules`)),s.includes("antigravity")&&(console.log(" Antigravity"),console.log(` .antigravity/agents/rcode-*: ${f} agents`)),a.agentsMd&&(console.log(" AGENTS.md"),console.log(" rcode section will be stripped (file preserved)")),a.stateDir&&(console.log(),console.log("\u26A0\uFE0F .rcode/ state directory detected"),console.log(` Contains ${a.stateDir.files} files (phases, decisions, progress, artifacts)`),console.log(" This is YOUR PROJECT DATA \u2014 not the skill files."),e.deleteState?console.log(" \u2192 Will be DELETED (--delete-state flag)"):e.keepState?console.log(" \u2192 Will be KEPT (--keep-state flag)"):console.log(" \u2192 Will ask separately after the main confirmation.")),console.log(),!e.yes&&!await Og(`Proceed with removing ${m} skill/command files${a.agentsMd?" + AGENTS.md section":""}? [y/N] `,{default:"n"})){console.log(`
295
- \u274C Aborted. Nothing was removed.`);return}console.log();let y=xA(r,a,{purge:e.purge===!0});y.ok?(console.log(` \u{1F4BE} backup created: ${y.path}`),e.purge&&console.log(" includes .rcode/ and .planning/ (state, decisions, planning artifacts)")):console.log(` \u26A0 no backup created (${y.warning}) \u2014 continuing anyway`),console.log();let h=0;if(s.includes("claude")){let P=M.join(r,".claude/skills"),b=In(P,X=>X.startsWith("rcode-")||qg(X));h+=b,b>0&&console.log(` \u2713 removed ${b} Claude skills`);let Q=M.join(r,".claude/commands/rcode");if(W.existsSync(Q)){let X=jr(Q,M.resolve(r));!X.ok&&X.reason==="outside-root"&&console.log(` \u26A0 refused to remove ${Q} \u2014 symlink resolves outside project root`)}let re=M.join(r,".claude/commands"),de=0;if(W.existsSync(re))for(let X of W.readdirSync(re))X.startsWith("rcode-")&&(X.endsWith(".md")||X.endsWith(".mdc"))&&(W.unlinkSync(M.join(re,X)),de++);let x=a.claude.commands.length;h+=x,x>0&&console.log(` \u2713 removed ${x} slash commands from .claude/commands/`);let k=M.join(r,".claude/agents"),he=In(k,X=>X.startsWith("rcode-")&&X.endsWith(".md"));if(h+=he,he>0&&console.log(` \u2713 removed ${he} Claude agents`),a.claude.agentsRulesDir){let X=M.join(r,".claude/agents/rules"),Ee=jr(X,M.resolve(r));Ee.ok&&Ee.reason!=="missing"?console.log(" \u2713 removed .claude/agents/rules/ (agent reference rules)"):Ee.reason==="outside-root"&&console.log(" \u26A0 refused to remove .claude/agents/rules/ \u2014 symlink resolves outside project root")}try{W.existsSync(M.join(r,".claude/commands"))&&W.readdirSync(M.join(r,".claude/commands")).length===0&&W.rmdirSync(M.join(r,".claude/commands")),W.existsSync(k)&&W.readdirSync(k).length===0&&W.rmdirSync(k)}catch{}}if(s.includes("cursor")){let P=M.join(r,".cursor/rules"),b=In(P,Q=>Q.startsWith("rcode-")||Q==="rcode.mdc"||Q==="rcode-method.mdc"||Q==="rcode");h+=b,b>0&&console.log(` \u2713 removed ${b} Cursor rules`)}if(s.includes("windsurf")){let P=M.join(r,".windsurf/rules"),b=In(P,Q=>Q.startsWith("rcode-")||Q==="rcode.mdc"||Q==="rcode-method.mdc");h+=b,b>0&&console.log(` \u2713 removed ${b} Windsurf rules`)}if(s.includes("antigravity")){let P=M.join(r,".antigravity/agents"),b=In(P,Q=>Q.startsWith("rcode-"));h+=b,b>0&&console.log(` \u2713 removed ${b} Antigravity agents`)}if(s.includes("codex")&&oc(M.join(sc.homedir(),".codex","hooks.json"),"UserPromptSubmit")==="removed"&&console.log(" \u2713 removed rcode slash-router hook from ~/.codex/hooks.json"),s.includes("antigravity")&&oc(M.join(sc.homedir(),".gemini","antigravity","settings.json"),"UserPrompt")==="removed"&&console.log(" \u2713 removed rcode slash-router hook from ~/.gemini/antigravity/settings.json"),s.includes("codex")||s.includes("antigravity")){let P=sc.homedir();for(let b of[M.join(P,".rcode","slash-commands"),M.join(P,".rcode","bin")])W.existsSync(b)&&jr(b,P).ok&&console.log(` \u2713 removed ${b}`)}if(s.includes("gemini")){let P=0;for(let b of["agents","commands"]){let Q=M.join(r,".gemini","rcode",b);P+=In(Q,re=>re.startsWith("rcode-")||re.endsWith(".md"))}h+=P,P>0&&console.log(` \u2713 removed ${P} Gemini files`)}if(s.includes("vscode")){let P=M.join(r,".vscode/rcode");W.existsSync(P)&&jr(P,M.resolve(r)).ok&&(h+=1,console.log(" \u2713 removed .vscode/rcode/ marker"))}if(a.agentsMd){let P=M.join(r,"AGENTS.md");kA(P)&&console.log(" \u2713 stripped rcode section from AGENTS.md")}let w=M.join(r,".gitignore");if(W.existsSync(w))try{let P=W.readFileSync(w,"utf8"),b=Bg(P);b!==P&&(W.writeFileSync(w,b),console.log(" \u2713 stripped rcode block from .gitignore"))}catch(P){console.log(` \u26A0 could not strip .gitignore block: ${P.message}`)}let C=bA(r);C==="removed"?console.log(" \u2713 removed .git/hooks/pre-commit (was rcode-only)"):C==="stripped"&&console.log(" \u2713 stripped rcode block from .git/hooks/pre-commit"),EA(r,[".claude/skills",".claude/commands",".claude",".cursor/rules",".cursor",".windsurf/rules",".windsurf",".antigravity/agents",".antigravity"]);let A=M.join(r,".rcode","brain");if(W.existsSync(A)){let P=jr(A,M.resolve(r));P.ok?console.log(" \u2713 removed .rcode/brain/ (pulled content, will refresh on reinstall)"):P.reason==="outside-root"&&console.log(" \u26A0 refused to remove .rcode/brain/ \u2014 symlink resolves outside project root")}if(a.stateDir){let P=M.join(r,".rcode"),b=e.deleteState;if(!e.deleteState&&!e.keepState&&!e.yes&&(console.log(),console.log("\u26A0\uFE0F The .rcode/ state directory contains your project data:"),console.log(" - config.yaml, state.json, JOURNEY.md"),console.log(" - phases, decisions, progress, artifacts, context"),console.log(` - ${a.stateDir.files} files total`),console.log(),console.log(' If you keep it: /rcode-init will report "already configured"'),console.log(" and reuse your existing config + history on next install."),console.log(" If you delete it: next install starts fresh \u2014 no carry-over."),console.log(),b=await Og("Also delete .rcode/ state? This is destructive and cannot be undone. [y/N] ",{default:"n"})),b){let Q=jr(P,M.resolve(r));Q.ok?console.log(" \u2713 removed .rcode/ state directory"):Q.reason==="outside-root"?console.log(" \u26A0 refused to remove .rcode/ \u2014 symlink resolves outside project root"):console.log(` \u26A0 could not remove .rcode/: ${Q.reason}`)}else console.log(" \u2139 kept .rcode/ state directory (your project data is preserved)")}if(e.purge){let P=M.join(r,".planning");if(W.existsSync(P)){let b=jr(P,M.resolve(r));b.ok?console.log(" \u2713 removed .planning/ (--purge)"):b.reason==="outside-root"?console.log(" \u26A0 refused to remove .planning/ \u2014 symlink resolves outside project root"):console.log(` \u26A0 could not remove .planning/: ${b.reason}`)}}console.log(`
296
- \u2705 Uninstall complete. Removed ${h} files.`),y.ok&&console.log(` Backup: ${y.path} (restore with: tar -xzf ${y.path})`);let T=a.stateDir&&W.existsSync(M.join(r,".rcode")),V=!e.purge&&W.existsSync(M.join(r,".planning")),I=!e.purge&&W.existsSync(M.join(r,".claude/agents/rules")),H=!e.purge&&(()=>{let P=M.join(r,".cursor/rules");if(!W.existsSync(P))return!1;try{return W.readdirSync(P).some(b=>b.startsWith("rcode-")||b==="rcode.mdc"||b==="rcode-method.mdc"||b==="rcode")}catch{return!1}})(),F=!e.purge&&(()=>{try{let P=M.join(r,".gitignore");if(!W.existsSync(P))return!1;let b=W.readFileSync(P,"utf8");return b.includes("# ===== rcode-managed gitignore block")||b.includes("# >>> rcode >>>")}catch{return!1}})(),q=!e.purge&&(()=>{let P=M.join(r,".git/hooks/pre-commit");if(!W.existsSync(P))return!1;try{return W.readFileSync(P,"utf8").includes("# ===== rcode-managed pre-commit block =====")}catch{return!1}})();(T||V||I||H||F||q)&&(console.log(),console.log("\u2139 Preserved (use --purge to remove all of these):"),T&&console.log(" .rcode/ project state, config, decisions"),V&&console.log(" .planning/ ROADMAP, STATE, PROJECT scaffolds"),I&&console.log(" .claude/agents/rules/ agent rule files"),H&&console.log(" .cursor/ Cursor IDE integration"),F&&console.log(" .gitignore rcode-managed block still present"),q&&console.log(" .git/hooks/ pre-commit hook still present"),console.log(),console.log(" Full cleanup: rcode uninstall --purge")),console.log(),console.log("\u{1F4A1} IDE reload required:"),console.log(' VS Code / Cursor: Cmd+Shift+P \u2192 "Developer: Reload Window"'),console.log(" If commands still appear after reload, check ~/.claude/commands/ for"),console.log(" any globally-installed rcode-* items (rcode does not touch global installs)."),console.log(`
297
- To reinstall later:`),console.log(" rcode install")}ar.exports.isLocalOverride=Lg;ar.exports.planToPathList=Wg;ar.exports.discoverKnownActionSkills=Mg;ar.exports.stripRcodeGitignoreBlock=Bg;ar.exports.removeSlashRouterHook=oc;require.main===ar&&ar.exports(process.argv.slice(2)).catch(t=>{t instanceof Ng&&(console.log(`
314
+ `),s.includes("claude")&&(console.log(" Claude Code"),console.log(` .claude/skills/ (rcode-*): ${c} skills`),console.log(` .claude/commands/rcode/: ${u} slash commands`),console.log(` .claude/agents/rcode-*.md: ${g} agents`)),s.includes("cursor")&&(console.log(" Cursor"),console.log(` .cursor/rules/rcode-*.mdc: ${l} rules`)),s.includes("windsurf")&&(console.log(" Windsurf"),console.log(` .windsurf/rules/rcode-*.mdc: ${d} rules`)),s.includes("antigravity")&&(console.log(" Antigravity"),console.log(` .antigravity/agents/rcode-*: ${f} agents`)),a.agentsMd&&(console.log(" AGENTS.md"),console.log(" rcode section will be stripped (file preserved)")),a.stateDir&&(console.log(),console.log("\u26A0\uFE0F .rcode/ state directory detected"),console.log(` Contains ${a.stateDir.files} files (phases, decisions, progress, artifacts)`),console.log(" This is YOUR PROJECT DATA \u2014 not the skill files."),e.deleteState?console.log(" \u2192 Will be DELETED (--delete-state flag)"):e.keepState?console.log(" \u2192 Will be KEPT (--keep-state flag)"):console.log(" \u2192 Will ask separately after the main confirmation.")),console.log(),!e.yes&&!await Lg(`Proceed with removing ${m} skill/command files${a.agentsMd?" + AGENTS.md section":""}? [y/N] `,{default:"n"})){console.log(`
315
+ \u274C Aborted. Nothing was removed.`);return}console.log();let y=AA(r,a,{purge:e.purge===!0});y.ok?(console.log(` \u{1F4BE} backup created: ${y.path}`),e.purge&&console.log(" includes .rcode/ and .planning/ (state, decisions, planning artifacts)")):console.log(` \u26A0 no backup created (${y.warning}) \u2014 continuing anyway`),console.log();let h=0;if(s.includes("claude")){let R=M.join(r,".claude/skills"),b=Rn(R,X=>X.startsWith("rcode-")||Hg(X));h+=b,b>0&&console.log(` \u2713 removed ${b} Claude skills`);let Q=M.join(r,".claude/commands/rcode");if(H.existsSync(Q)){let X=Tr(Q,M.resolve(r));!X.ok&&X.reason==="outside-root"&&console.log(` \u26A0 refused to remove ${Q} \u2014 symlink resolves outside project root`)}let te=M.join(r,".claude/commands"),de=0;if(H.existsSync(te))for(let X of H.readdirSync(te))X.startsWith("rcode-")&&(X.endsWith(".md")||X.endsWith(".mdc"))&&(H.unlinkSync(M.join(te,X)),de++);let x=a.claude.commands.length;h+=x,x>0&&console.log(` \u2713 removed ${x} slash commands from .claude/commands/`);let k=M.join(r,".claude/agents"),he=Rn(k,X=>X.startsWith("rcode-")&&X.endsWith(".md"));if(h+=he,he>0&&console.log(` \u2713 removed ${he} Claude agents`),a.claude.agentsRulesDir){let X=M.join(r,".claude/agents/rules"),xe=Tr(X,M.resolve(r));xe.ok&&xe.reason!=="missing"?console.log(" \u2713 removed .claude/agents/rules/ (agent reference rules)"):xe.reason==="outside-root"&&console.log(" \u26A0 refused to remove .claude/agents/rules/ \u2014 symlink resolves outside project root")}try{H.existsSync(M.join(r,".claude/commands"))&&H.readdirSync(M.join(r,".claude/commands")).length===0&&H.rmdirSync(M.join(r,".claude/commands")),H.existsSync(k)&&H.readdirSync(k).length===0&&H.rmdirSync(k)}catch{}}if(s.includes("cursor")){let R=M.join(r,".cursor/rules"),b=Rn(R,Q=>Q.startsWith("rcode-")||Q==="rcode.mdc"||Q==="rcode-method.mdc"||Q==="rcode");h+=b,b>0&&console.log(` \u2713 removed ${b} Cursor rules`)}if(s.includes("windsurf")){let R=M.join(r,".windsurf/rules"),b=Rn(R,Q=>Q.startsWith("rcode-")||Q==="rcode.mdc"||Q==="rcode-method.mdc");h+=b,b>0&&console.log(` \u2713 removed ${b} Windsurf rules`)}if(s.includes("antigravity")){let R=M.join(r,".antigravity/agents"),b=Rn(R,Q=>Q.startsWith("rcode-"));h+=b,b>0&&console.log(` \u2713 removed ${b} Antigravity agents`)}if(s.includes("codex")&&iu(M.join(ou.homedir(),".codex","hooks.json"),"UserPromptSubmit")==="removed"&&console.log(" \u2713 removed rcode slash-router hook from ~/.codex/hooks.json"),s.includes("antigravity")&&iu(M.join(ou.homedir(),".gemini","antigravity","settings.json"),"UserPrompt")==="removed"&&console.log(" \u2713 removed rcode slash-router hook from ~/.gemini/antigravity/settings.json"),s.includes("codex")||s.includes("antigravity")){let R=ou.homedir();for(let b of[M.join(R,".rcode","slash-commands"),M.join(R,".rcode","bin")])H.existsSync(b)&&Tr(b,R).ok&&console.log(` \u2713 removed ${b}`)}if(s.includes("gemini")){let R=0;for(let b of["agents","commands"]){let Q=M.join(r,".gemini","rcode",b);R+=Rn(Q,te=>te.startsWith("rcode-")||te.endsWith(".md"))}h+=R,R>0&&console.log(` \u2713 removed ${R} Gemini files`)}if(s.includes("vscode")){let R=M.join(r,".vscode/rcode");H.existsSync(R)&&Tr(R,M.resolve(r)).ok&&(h+=1,console.log(" \u2713 removed .vscode/rcode/ marker"))}if(a.agentsMd){let R=M.join(r,"AGENTS.md");FA(R)&&console.log(" \u2713 stripped rcode section from AGENTS.md")}let w=M.join(r,".gitignore");if(H.existsSync(w))try{let R=H.readFileSync(w,"utf8"),b=qg(R);b!==R&&(H.writeFileSync(w,b),console.log(" \u2713 stripped rcode block from .gitignore"))}catch(R){console.log(` \u26A0 could not strip .gitignore block: ${R.message}`)}let C=CA(r);C==="removed"?console.log(" \u2713 removed .git/hooks/pre-commit (was rcode-only)"):C==="stripped"&&console.log(" \u2713 stripped rcode block from .git/hooks/pre-commit"),xA(r,[".claude/skills",".claude/commands",".claude",".cursor/rules",".cursor",".windsurf/rules",".windsurf",".antigravity/agents",".antigravity"]);let A=M.join(r,".rcode","brain");if(H.existsSync(A)){let R=Tr(A,M.resolve(r));R.ok?console.log(" \u2713 removed .rcode/brain/ (pulled content, will refresh on reinstall)"):R.reason==="outside-root"&&console.log(" \u26A0 refused to remove .rcode/brain/ \u2014 symlink resolves outside project root")}if(a.stateDir){let R=M.join(r,".rcode"),b=e.deleteState;if(!e.deleteState&&!e.keepState&&!e.yes&&(console.log(),console.log("\u26A0\uFE0F The .rcode/ state directory contains your project data:"),console.log(" - config.yaml, state.json, JOURNEY.md"),console.log(" - phases, decisions, progress, artifacts, context"),console.log(` - ${a.stateDir.files} files total`),console.log(),console.log(' If you keep it: /rcode-init will report "already configured"'),console.log(" and reuse your existing config + history on next install."),console.log(" If you delete it: next install starts fresh \u2014 no carry-over."),console.log(),b=await Lg("Also delete .rcode/ state? This is destructive and cannot be undone. [y/N] ",{default:"n"})),b){let Q=Tr(R,M.resolve(r));Q.ok?console.log(" \u2713 removed .rcode/ state directory"):Q.reason==="outside-root"?console.log(" \u26A0 refused to remove .rcode/ \u2014 symlink resolves outside project root"):console.log(` \u26A0 could not remove .rcode/: ${Q.reason}`)}else console.log(" \u2139 kept .rcode/ state directory (your project data is preserved)")}if(e.purge){let R=M.join(r,".planning");if(H.existsSync(R)){let b=Tr(R,M.resolve(r));b.ok?console.log(" \u2713 removed .planning/ (--purge)"):b.reason==="outside-root"?console.log(" \u26A0 refused to remove .planning/ \u2014 symlink resolves outside project root"):console.log(` \u26A0 could not remove .planning/: ${b.reason}`)}}console.log(`
316
+ \u2705 Uninstall complete. Removed ${h} files.`),y.ok&&console.log(` Backup: ${y.path} (restore with: tar -xzf ${y.path})`);let T=a.stateDir&&H.existsSync(M.join(r,".rcode")),G=!e.purge&&H.existsSync(M.join(r,".planning")),I=!e.purge&&H.existsSync(M.join(r,".claude/agents/rules")),Z=!e.purge&&(()=>{let R=M.join(r,".cursor/rules");if(!H.existsSync(R))return!1;try{return H.readdirSync(R).some(b=>b.startsWith("rcode-")||b==="rcode.mdc"||b==="rcode-method.mdc"||b==="rcode")}catch{return!1}})(),F=!e.purge&&(()=>{try{let R=M.join(r,".gitignore");if(!H.existsSync(R))return!1;let b=H.readFileSync(R,"utf8");return b.includes("# ===== rcode-managed gitignore block")||b.includes("# >>> rcode >>>")}catch{return!1}})(),W=!e.purge&&(()=>{let R=M.join(r,".git/hooks/pre-commit");if(!H.existsSync(R))return!1;try{return H.readFileSync(R,"utf8").includes("# ===== rcode-managed pre-commit block =====")}catch{return!1}})();(T||G||I||Z||F||W)&&(console.log(),console.log("\u2139 Preserved (use --purge to remove all of these):"),T&&console.log(" .rcode/ project state, config, decisions"),G&&console.log(" .planning/ ROADMAP, STATE, PROJECT scaffolds"),I&&console.log(" .claude/agents/rules/ agent rule files"),Z&&console.log(" .cursor/ Cursor IDE integration"),F&&console.log(" .gitignore rcode-managed block still present"),W&&console.log(" .git/hooks/ pre-commit hook still present"),console.log(),console.log(" Full cleanup: rcode uninstall --purge")),console.log(),console.log("\u{1F4A1} IDE reload required:"),console.log(' VS Code / Cursor: Cmd+Shift+P \u2192 "Developer: Reload Window"'),console.log(" If commands still appear after reload, check ~/.claude/commands/ for"),console.log(" any globally-installed rcode-* items (rcode does not touch global installs)."),console.log(`
317
+ To reinstall later:`),console.log(" rcode install")}cr.exports.isLocalOverride=Mg;cr.exports.planToPathList=Zg;cr.exports.discoverKnownActionSkills=Wg;cr.exports.stripRcodeGitignoreBlock=qg;cr.exports.removeSlashRouterHook=iu;require.main===cr&&cr.exports(process.argv.slice(2)).catch(t=>{t instanceof Bg&&(console.log(`
298
318
  \u274C Aborted.`),process.exit(1)),console.error(`
299
- \u274C Uninstall failed: ${t.message}`),process.env.DEBUG&&console.error(t.stack),process.exit(1)})});var Ug=v((UI,Zg)=>{"use strict";var cs=require("fs"),be=require("path"),{spawnSync:ur}=require("child_process"),{homedir:uc}=dr();function Ue(t){try{return cs.accessSync(t),!0}catch{return!1}}function Tn(t){try{return cs.readdirSync(t)}catch{return[]}}function AA(){let t=uc(),e=[];try{let n=ur("npm",["root","-g"],{encoding:"utf8"});n.status===0&&n.stdout.trim()&&e.push({manager:"npm",dir:n.stdout.trim()})}catch{}try{let n=ur("pnpm",["root","-g"],{encoding:"utf8"});n.status===0&&n.stdout.trim()&&e.push({manager:"pnpm",dir:n.stdout.trim()})}catch{}try{let n=ur("yarn",["global","dir"],{encoding:"utf8"});n.status===0&&n.stdout.trim()&&e.push({manager:"yarn",dir:be.join(n.stdout.trim(),"node_modules")})}catch{}try{let n=ur("bun",["pm","bin","-g"],{encoding:"utf8"});n.status===0&&n.stdout.trim()&&e.push({manager:"bun",dir:be.join(t,".bun","install","global","node_modules")})}catch{}let r=be.join(t,".nvm","versions","node");if(Ue(r))for(let n of Tn(r)){let s=be.join(r,n,"lib","node_modules");Ue(s)&&!e.some(i=>i.dir===s)&&e.push({manager:`nvm/${n}`,dir:s})}return e}function FA(t){let e=[];for(let r of["@hanzlaa","@hanzlahabib"]){let n=be.join(t,r);if(Ue(n))for(let s of Tn(n))(s==="rcode"||s==="rcode"||s.startsWith("rcode"))&&e.push({scope:r,pkg:s,dir:be.join(n,s)})}return e}function jA(){let t=uc(),e=new Set;try{let n=ur("npm",["prefix","-g"],{encoding:"utf8"});n.status===0&&n.stdout.trim()&&e.add(be.join(n.stdout.trim(),"bin"))}catch{}try{let n=ur("pnpm",["bin","-g"],{encoding:"utf8"});n.status===0&&n.stdout.trim()&&e.add(n.stdout.trim())}catch{}try{let n=ur("yarn",["global","bin"],{encoding:"utf8"});n.status===0&&n.stdout.trim()&&e.add(n.stdout.trim())}catch{}try{let n=ur("bun",["pm","bin","-g"],{encoding:"utf8"});n.status===0&&n.stdout.trim()&&e.add(n.stdout.trim())}catch{}e.add(be.join(t,".local","share","pnpm")),e.add(be.join(t,".local","bin")),e.add(be.join(t,".bun","bin"));let r=be.join(t,".nvm","versions","node");if(Ue(r))for(let n of Tn(r))e.add(be.join(r,n,"bin"));return[...e].filter(Ue)}var IA=["rcode","rcode","rcode"];function TA(t){let e=[];for(let r of IA){let n=be.join(t,r);if(Ue(n)){let s=null;try{s=cs.readlinkSync(n)}catch{}(!s||/rcode|rcode|@hanzlaa|@hanzlahabib/.test(s))&&e.push({name:r,path:n,target:s})}}return e}function Hg(t){let e=[];if(!Ue(t))return e;let r=be.join(t,"commands");if(Ue(r)){for(let o of Tn(r))o.startsWith("rcode-")&&(o.endsWith(".md")||o.endsWith(".mdc"))&&e.push({kind:"command",path:be.join(r,o)});let i=be.join(r,"rcode");Ue(i)&&e.push({kind:"commands-dir",path:i})}let n=be.join(t,"agents");if(Ue(n))for(let i of Tn(n))i.startsWith("rcode-")&&(i.endsWith(".md")||i.endsWith(".mdc"))&&e.push({kind:"agent",path:be.join(n,i)});let s=be.join(t,"skills");if(Ue(s))for(let i of Tn(s))i.startsWith("rcode-")&&e.push({kind:"skill-dir",path:be.join(s,i)});return e}function RA({includePlanning:t}){let e=uc(),r=process.cwd(),n={packages:[],bins:[],globalClaude:[],globalrcode:null,projectClaude:[],projectrcode:null,projectPlanning:null};for(let{manager:o,dir:a}of AA())for(let u of FA(a))n.packages.push({manager:o,...u});for(let o of jA())for(let a of TA(o))n.bins.push({binDir:o,...a});n.globalClaude=Hg(be.join(e,".claude"));let s=be.join(e,".rcode");Ue(s)&&(n.globalrcode=s),n.projectClaude=Hg(be.join(r,".claude"));let i=be.join(r,".rcode");if(Ue(i)&&r!==e&&(n.projectrcode=i),t){let o=be.join(r,".planning");Ue(o)&&r!==e&&(n.projectPlanning=o)}return n}function PA(t,{dryRun:e}){console.log(`
319
+ \u274C Uninstall failed: ${t.message}`),process.env.DEBUG&&console.error(t.stack),process.exit(1)})});var Gg=v((zI,Vg)=>{"use strict";var ds=require("fs"),Se=require("path"),{spawnSync:ur}=require("child_process"),{homedir:uu}=hr();function Ge(t){try{return ds.accessSync(t),!0}catch{return!1}}function Pn(t){try{return ds.readdirSync(t)}catch{return[]}}function IA(){let t=uu(),e=[];try{let n=ur("npm",["root","-g"],{encoding:"utf8"});n.status===0&&n.stdout.trim()&&e.push({manager:"npm",dir:n.stdout.trim()})}catch{}try{let n=ur("pnpm",["root","-g"],{encoding:"utf8"});n.status===0&&n.stdout.trim()&&e.push({manager:"pnpm",dir:n.stdout.trim()})}catch{}try{let n=ur("yarn",["global","dir"],{encoding:"utf8"});n.status===0&&n.stdout.trim()&&e.push({manager:"yarn",dir:Se.join(n.stdout.trim(),"node_modules")})}catch{}try{let n=ur("bun",["pm","bin","-g"],{encoding:"utf8"});n.status===0&&n.stdout.trim()&&e.push({manager:"bun",dir:Se.join(t,".bun","install","global","node_modules")})}catch{}let r=Se.join(t,".nvm","versions","node");if(Ge(r))for(let n of Pn(r)){let s=Se.join(r,n,"lib","node_modules");Ge(s)&&!e.some(i=>i.dir===s)&&e.push({manager:`nvm/${n}`,dir:s})}return e}function TA(t){let e=[];for(let r of["@hanzlaa","@hanzlahabib"]){let n=Se.join(t,r);if(Ge(n))for(let s of Pn(n))(s==="rcode"||s==="rcode"||s.startsWith("rcode"))&&e.push({scope:r,pkg:s,dir:Se.join(n,s)})}return e}function RA(){let t=uu(),e=new Set;try{let n=ur("npm",["prefix","-g"],{encoding:"utf8"});n.status===0&&n.stdout.trim()&&e.add(Se.join(n.stdout.trim(),"bin"))}catch{}try{let n=ur("pnpm",["bin","-g"],{encoding:"utf8"});n.status===0&&n.stdout.trim()&&e.add(n.stdout.trim())}catch{}try{let n=ur("yarn",["global","bin"],{encoding:"utf8"});n.status===0&&n.stdout.trim()&&e.add(n.stdout.trim())}catch{}try{let n=ur("bun",["pm","bin","-g"],{encoding:"utf8"});n.status===0&&n.stdout.trim()&&e.add(n.stdout.trim())}catch{}e.add(Se.join(t,".local","share","pnpm")),e.add(Se.join(t,".local","bin")),e.add(Se.join(t,".bun","bin"));let r=Se.join(t,".nvm","versions","node");if(Ge(r))for(let n of Pn(r))e.add(Se.join(r,n,"bin"));return[...e].filter(Ge)}var PA=["rcode","rcode","rcode"];function OA(t){let e=[];for(let r of PA){let n=Se.join(t,r);if(Ge(n)){let s=null;try{s=ds.readlinkSync(n)}catch{}(!s||/rcode|rcode|@hanzlaa|@hanzlahabib/.test(s))&&e.push({name:r,path:n,target:s})}}return e}function Ug(t){let e=[];if(!Ge(t))return e;let r=Se.join(t,"commands");if(Ge(r)){for(let o of Pn(r))o.startsWith("rcode-")&&(o.endsWith(".md")||o.endsWith(".mdc"))&&e.push({kind:"command",path:Se.join(r,o)});let i=Se.join(r,"rcode");Ge(i)&&e.push({kind:"commands-dir",path:i})}let n=Se.join(t,"agents");if(Ge(n))for(let i of Pn(n))i.startsWith("rcode-")&&(i.endsWith(".md")||i.endsWith(".mdc"))&&e.push({kind:"agent",path:Se.join(n,i)});let s=Se.join(t,"skills");if(Ge(s))for(let i of Pn(s))i.startsWith("rcode-")&&e.push({kind:"skill-dir",path:Se.join(s,i)});return e}function NA({includePlanning:t}){let e=uu(),r=process.cwd(),n={packages:[],bins:[],globalClaude:[],globalrcode:null,projectClaude:[],projectrcode:null,projectPlanning:null};for(let{manager:o,dir:a}of IA())for(let c of TA(a))n.packages.push({manager:o,...c});for(let o of RA())for(let a of OA(o))n.bins.push({binDir:o,...a});n.globalClaude=Ug(Se.join(e,".claude"));let s=Se.join(e,".rcode");Ge(s)&&(n.globalrcode=s),n.projectClaude=Ug(Se.join(r,".claude"));let i=Se.join(r,".rcode");if(Ge(i)&&r!==e&&(n.projectrcode=i),t){let o=Se.join(r,".planning");Ge(o)&&r!==e&&(n.projectPlanning=o)}return n}function LA(t,{dryRun:e}){console.log(`
300
320
  \u{1F525} rcode nuke \xB7 by Hanzla Habib ${e?"[DRY RUN \u2014 pass --yes to remove]":"[REMOVING]"}
301
321
  `);let n=0,s=(i,o)=>{if(!(!o||Array.isArray(o)&&o.length===0)){if(console.log(`${i}`),Array.isArray(o))for(let a of o)console.log(` \u2022 ${a.description||a.path||a.dir||JSON.stringify(a)}`),n++;else console.log(` \u2022 ${o}`),n++;console.log("")}};return s("\u{1F4E6} Global packages (node_modules):",t.packages.map(i=>({description:`[${i.manager}] ${i.scope}/${i.pkg} \u2192 ${i.dir}`}))),s("\u{1F517} Global binaries:",t.bins.map(i=>({description:`${i.path}${i.target?` \u2192 ${i.target}`:""}`}))),s("\u{1F916} ~/.claude/ artifacts:",t.globalClaude.map(i=>({description:`[${i.kind}] ${i.path}`}))),t.globalrcode&&s("\u{1F5C2}\uFE0F ~/.rcode/ (global state):",t.globalrcode),s("\u{1F916} ./.claude/ artifacts (current project):",t.projectClaude.map(i=>({description:`[${i.kind}] ${i.path}`}))),t.projectrcode&&s("\u{1F5C2}\uFE0F ./.rcode/ (project state):",t.projectrcode),t.projectPlanning&&s("\u{1F4CB} ./.planning/ (your work \u2014 only with --include-planning):",t.projectPlanning),console.log(n===0?` \u2713 nothing to remove \u2014 system is clean.
302
322
  `:` Total: ${n} item(s).
303
- `),n}function an(t){try{return cs.rmSync(t,{recursive:!0,force:!0}),!0}catch(e){return console.warn(` \u26A0 failed to remove ${t}: ${e.message}`),!1}}function OA(t,e,r){let n=`${e}/${r}`,s=t==="pnpm"?["pnpm",["remove","-g",n]]:t==="yarn"?["yarn",["global","remove",n]]:t==="bun"?["bun",["remove","-g",n]]:["npm",["uninstall","-g",n]];try{return ur(s[0],s[1],{stdio:"pipe",encoding:"utf8"}).status===0}catch{return!1}}function NA(t){let e=0;for(let r of t.packages){let n=r.manager.startsWith("nvm/")?"npm":r.manager;process.stdout.write(` ${n} uninstall ${r.scope}/${r.pkg} ... `);let s=OA(n,r.scope,r.pkg);console.log(s?"\u2713":"\u26A0 failed via PM, falling back to rm"),s||an(r.dir),e++}for(let r of t.bins)Ue(r.path)&&an(r.path)&&(console.log(` \u2713 removed bin ${r.path}`),e++);for(let r of t.globalClaude)an(r.path)&&(console.log(` \u2713 removed ${r.path}`),e++);t.globalrcode&&an(t.globalrcode)&&(console.log(` \u2713 removed ${t.globalrcode}`),e++);for(let r of t.projectClaude)an(r.path)&&(console.log(` \u2713 removed ${r.path}`),e++);return t.projectrcode&&an(t.projectrcode)&&(console.log(` \u2713 removed ${t.projectrcode}`),e++),t.projectPlanning&&an(t.projectPlanning)&&(console.log(` \u2713 removed ${t.projectPlanning}`),e++),e}Zg.exports=function(e=[]){let r=!e.includes("--yes")&&!e.includes("-y"),n=e.includes("--include-planning"),s=be.join(process.cwd(),"package.json");if(Ue(s))try{let u=JSON.parse(cs.readFileSync(s,"utf8"));if((u.name==="@hanzlaa/rcode"||u.name==="@hanzlahabib/rihal-code")&&(console.log(`
323
+ `),n}function un(t){try{return ds.rmSync(t,{recursive:!0,force:!0}),!0}catch(e){return console.warn(` \u26A0 failed to remove ${t}: ${e.message}`),!1}}function BA(t,e,r){let n=`${e}/${r}`,s=t==="pnpm"?["pnpm",["remove","-g",n]]:t==="yarn"?["yarn",["global","remove",n]]:t==="bun"?["bun",["remove","-g",n]]:["npm",["uninstall","-g",n]];try{return ur(s[0],s[1],{stdio:"pipe",encoding:"utf8"}).status===0}catch{return!1}}function MA(t){let e=0;for(let r of t.packages){let n=r.manager.startsWith("nvm/")?"npm":r.manager;process.stdout.write(` ${n} uninstall ${r.scope}/${r.pkg} ... `);let s=BA(n,r.scope,r.pkg);console.log(s?"\u2713":"\u26A0 failed via PM, falling back to rm"),s||un(r.dir),e++}for(let r of t.bins)Ge(r.path)&&un(r.path)&&(console.log(` \u2713 removed bin ${r.path}`),e++);for(let r of t.globalClaude)un(r.path)&&(console.log(` \u2713 removed ${r.path}`),e++);t.globalrcode&&un(t.globalrcode)&&(console.log(` \u2713 removed ${t.globalrcode}`),e++);for(let r of t.projectClaude)un(r.path)&&(console.log(` \u2713 removed ${r.path}`),e++);return t.projectrcode&&un(t.projectrcode)&&(console.log(` \u2713 removed ${t.projectrcode}`),e++),t.projectPlanning&&un(t.projectPlanning)&&(console.log(` \u2713 removed ${t.projectPlanning}`),e++),e}Vg.exports=function(e=[]){let r=!e.includes("--yes")&&!e.includes("-y"),n=e.includes("--include-planning"),s=Se.join(process.cwd(),"package.json");if(Ge(s))try{let c=JSON.parse(ds.readFileSync(s,"utf8"));if((c.name==="@hanzlaa/rcode"||c.name==="@hanzlahabib/rihal-code")&&(console.log(`
304
324
  \u26A0 You are inside the rcode source repo.`),console.log(" Nuke would remove this repo's .claude/, .rcode/, and possibly .planning/."),console.log(" That is your source code \u2014 almost certainly not what you want."),console.log(` Run nuke from a different directory, or pass --i-know-what-im-doing to override.
305
- `),!e.includes("--i-know-what-im-doing")))return}catch{}let i=RA({includePlanning:n}),o=PA(i,{dryRun:r});if(o===0||r){r&&o>0&&(console.log("To actually remove these, re-run with: rcode nuke --yes"),console.log(`To also remove .planning/ (your work): rcode nuke --yes --include-planning
325
+ `),!e.includes("--i-know-what-im-doing")))return}catch{}let i=NA({includePlanning:n}),o=LA(i,{dryRun:r});if(o===0||r){r&&o>0&&(console.log("To actually remove these, re-run with: rcode nuke --yes"),console.log(`To also remove .planning/ (your work): rcode nuke --yes --include-planning
306
326
  `));return}console.log(`Executing...
307
- `);let a=NA(i);console.log(`
327
+ `);let a=MA(i);console.log(`
308
328
  \u2705 Done. Removed ${a} item(s). Reinstall: npm install -g @hanzlaa/rcode
309
- `)}});var Gg=v((VI,cc)=>{var LA=require("path"),{homedir:BA}=dr(),{scanNamespaceDuplication:MA,migrateNamespace:qA}=No();function Vg(t){return{yes:t.includes("--yes")||t.includes("-y")}}function WA(t){if(console.log(`
329
+ `)}});var Yg=v((YI,lu)=>{var qA=require("path"),{homedir:WA}=hr(),{scanNamespaceDuplication:HA,migrateNamespace:ZA}=Lo();function zg(t){return{yes:t.includes("--yes")||t.includes("-y")}}function UA(t){if(console.log(`
310
330
  \u{1F54C} rcode \u2014 Namespace Migration
311
331
  `),t.totalCount===0){console.log(` \u2713 No legacy rihal-* or duplicate command registrations found.
312
- `);return}console.log(` Found ${t.totalCount} artifact(s) to migrate:`),console.log(` legacy rihal-* skills: ${t.legacySkillCount}`),console.log(` legacy rihal-* commands: ${t.legacyCommandCount}`),console.log(` legacy rihal-* agents: ${t.legacyAgentCount}`),console.log(` unprefixed dupes: ${t.unprefixedCount}`),console.log(` cross-scope dupes: ${t.crossScopeCount} (global copy shadowed by project)`),console.log(` legacy Codex commands: ${t.legacyCodexCommandCount} (~/.rcode/slash-commands/)`),console.log()}cc.exports=function(e=[]){let r=Vg(e),n=process.cwd(),s=BA(),i=MA(n,s);if(WA(i),i.totalCount===0)return;if(!r.yes){console.log(` [DRY RUN] Nothing removed. Pass --yes to back up and remove these files.
313
- `);return}let o=qA(n,s),a=Object.values(o.removed).reduce((u,c)=>u+c,0);console.log(` \u2713 Removed ${a} artifact(s):`),console.log(` legacy skills: ${o.removed.legacySkills}`),console.log(` legacy commands: ${o.removed.legacyCommands}`),console.log(` legacy agents: ${o.removed.legacyAgents}`),console.log(` unprefixed: ${o.removed.unprefixedDupes}`),console.log(` cross-scope: ${o.removed.crossScopeDupes}`),console.log(` codex commands: ${o.removed.legacyCodexCommands}`),o.backupDir&&console.log(` \u{1F4BE} backup: ${LA.relative(s,o.backupDir)} (under ~/.claude/.rcode-backup/)`),console.log()};cc.exports.parseArgs=Vg});var lc=v((GI,Yg)=>{var zg=require("path"),{spawn:HA}=require("child_process");Yg.exports=function(e,{packageRoot:r}){let n=zg.join(r,"server/dashboard.js"),s=process.cwd(),i=zg.join(s,".rcode");console.log(`
314
- \u{1F54C} Starting Diwan dashboard...`),console.log(` Scanning: ${i}`);let o=HA("node",[n],{stdio:"inherit",env:{...process.env,RCODE_DIR:i}});o.on("error",u=>{console.error("Failed to start dashboard:",u.message),process.exit(1)});let a=()=>{console.log(`
315
- Stopping dashboard...`),o.kill("SIGTERM"),process.exit(0)};process.on("SIGINT",a),process.on("SIGTERM",a)}});var Qg=v((zI,Kg)=>{var Ir=require("fs"),Bo=require("path");function ZA(t){let e=t.replace(/^rcode-/,"");if(e.includes("..")||e.includes("/")||e.includes("\\"))throw new Error(`Invalid agent name: '${t}'`);return e}function Jg(t,e){let r=Ir.existsSync(t)?Ir.readdirSync(t).filter(s=>s.endsWith(".md")&&s!=="README.md").map(s=>s.replace(".md","")):[],n=Ir.existsSync(e)?Ir.readdirSync(e).filter(s=>s.endsWith(".md")&&s.startsWith("rcode-")).map(s=>s.replace(/^rcode-/,"").replace(".md","")):[];return Array.from(new Set([...r,...n])).sort()}function Xg(t,e,r){let n=Bo.join(e,`${t}.md`);if(Ir.existsSync(n))return{file:n,source:"digest"};let s=Bo.join(r,`rcode-${t}.md`);return Ir.existsSync(s)?{file:s,source:"agent"}:null}Kg.exports=function(e,{packageRoot:r}){let n=Bo.join(r,"rcode/digests"),s=Bo.join(r,"rcode/agents"),i=e[0];if(i){let a=ZA(i),u=Xg(a,n,s);u||(console.error(`No digest or agent found for: ${i}`),console.error(`Available: ${Jg(n,s).join(", ")}`),process.exit(1)),u.source==="agent"&&console.log(`# (fallback: full agent file \u2014 no curated digest exists)
316
- `),console.log(Ir.readFileSync(u.file,"utf8"));return}let o=Jg(n,s);console.log(`
332
+ `);return}console.log(` Found ${t.totalCount} artifact(s) to migrate:`),console.log(` legacy rihal-* skills: ${t.legacySkillCount}`),console.log(` legacy rihal-* commands: ${t.legacyCommandCount}`),console.log(` legacy rihal-* agents: ${t.legacyAgentCount}`),console.log(` unprefixed dupes: ${t.unprefixedCount}`),console.log(` cross-scope dupes: ${t.crossScopeCount} (global copy shadowed by project)`),console.log(` legacy Codex commands: ${t.legacyCodexCommandCount} (~/.rcode/slash-commands/)`),console.log()}lu.exports=function(e=[]){let r=zg(e),n=process.cwd(),s=WA(),i=HA(n,s);if(UA(i),i.totalCount===0)return;if(!r.yes){console.log(` [DRY RUN] Nothing removed. Pass --yes to back up and remove these files.
333
+ `);return}let o=ZA(n,s),a=Object.values(o.removed).reduce((c,u)=>c+u,0);console.log(` \u2713 Removed ${a} artifact(s):`),console.log(` legacy skills: ${o.removed.legacySkills}`),console.log(` legacy commands: ${o.removed.legacyCommands}`),console.log(` legacy agents: ${o.removed.legacyAgents}`),console.log(` unprefixed: ${o.removed.unprefixedDupes}`),console.log(` cross-scope: ${o.removed.crossScopeDupes}`),console.log(` codex commands: ${o.removed.legacyCodexCommands}`),o.backupDir&&console.log(` \u{1F4BE} backup: ${qA.relative(s,o.backupDir)} (under ~/.claude/.rcode-backup/)`),console.log()};lu.exports.parseArgs=zg});var du=v((JI,Xg)=>{var Jg=require("path"),{spawn:VA}=require("child_process");Xg.exports=function(e,{packageRoot:r}){let n=Jg.join(r,"server/dashboard.js"),s=process.cwd(),i=Jg.join(s,".rcode");console.log(`
334
+ \u{1F54C} Starting Diwan dashboard...`),console.log(` Scanning: ${i}`);let o=VA("node",[n],{stdio:"inherit",env:{...process.env,RCODE_DIR:i}});o.on("error",c=>{console.error("Failed to start dashboard:",c.message),process.exit(1)});let a=()=>{console.log(`
335
+ Stopping dashboard...`),o.kill("SIGTERM"),process.exit(0)};process.on("SIGINT",a),process.on("SIGTERM",a)}});var tD=v((XI,eD)=>{var Rr=require("fs"),Mo=require("path");function GA(t){let e=t.replace(/^rcode-/,"");if(e.includes("..")||e.includes("/")||e.includes("\\"))throw new Error(`Invalid agent name: '${t}'`);return e}function Kg(t,e){let r=Rr.existsSync(t)?Rr.readdirSync(t).filter(s=>s.endsWith(".md")&&s!=="README.md").map(s=>s.replace(".md","")):[],n=Rr.existsSync(e)?Rr.readdirSync(e).filter(s=>s.endsWith(".md")&&s.startsWith("rcode-")).map(s=>s.replace(/^rcode-/,"").replace(".md","")):[];return Array.from(new Set([...r,...n])).sort()}function Qg(t,e,r){let n=Mo.join(e,`${t}.md`);if(Rr.existsSync(n))return{file:n,source:"digest"};let s=Mo.join(r,`rcode-${t}.md`);return Rr.existsSync(s)?{file:s,source:"agent"}:null}eD.exports=function(e,{packageRoot:r}){let n=Mo.join(r,"rcode/digests"),s=Mo.join(r,"rcode/agents"),i=e[0];if(i){let a=GA(i),c=Qg(a,n,s);c||(console.error(`No digest or agent found for: ${i}`),console.error(`Available: ${Kg(n,s).join(", ")}`),process.exit(1)),c.source==="agent"&&console.log(`# (fallback: full agent file \u2014 no curated digest exists)
336
+ `),console.log(Rr.readFileSync(c.file,"utf8"));return}let o=Kg(n,s);console.log(`
317
337
  \u{1F54C} All rcode Agent Digests
318
- `);for(let a of o){let u=Xg(a,n,s);u&&(console.log(Ir.readFileSync(u.file,"utf8")),console.log(`
338
+ `);for(let a of o){let c=Qg(a,n,s);c&&(console.log(Rr.readFileSync(c.file,"utf8")),console.log(`
319
339
  `+"\u2550".repeat(80)+`
320
- `))}}});var rD=v((YI,tD)=>{var dc=require("fs"),eD=require("path");tD.exports=function(e,{packageRoot:r}){let n=eD.join(r,"rcode/digests");dc.existsSync(n)||(console.error("Agent digests not found. Is the package installed correctly?"),process.exit(1));let s=dc.readdirSync(n).filter(i=>i.endsWith(".md")&&i!=="README.md");console.log(`
340
+ `))}}});var sD=v((KI,nD)=>{var fu=require("fs"),rD=require("path");nD.exports=function(e,{packageRoot:r}){let n=rD.join(r,"rcode/digests");fu.existsSync(n)||(console.error("Agent digests not found. Is the package installed correctly?"),process.exit(1));let s=fu.readdirSync(n).filter(i=>i.endsWith(".md")&&i!=="README.md");console.log(`
321
341
  \u{1F54C} rcode Team Roster (${s.length} agents)
322
- `),console.log("\u2500".repeat(80));for(let i of s.sort()){let o=dc.readFileSync(eD.join(n,i),"utf8"),a=o.split(`
323
- `)[0].replace(/^#\s*/,""),u=(o.match(/\*\*Arabic:\*\*\s*(.+)/)||[])[1]||"",c=(o.match(/\*\*Authority:\*\*\s*(.+)/)||[])[1]||"";console.log(`${a.padEnd(45)} ${u.padEnd(15)}`),c&&console.log(` \u2192 ${c.slice(0,70)}`),console.log()}console.log("\u2500".repeat(80)),console.log(`
342
+ `),console.log("\u2500".repeat(80));for(let i of s.sort()){let o=fu.readFileSync(rD.join(n,i),"utf8"),a=o.split(`
343
+ `)[0].replace(/^#\s*/,""),c=(o.match(/\*\*Arabic:\*\*\s*(.+)/)||[])[1]||"",u=(o.match(/\*\*Authority:\*\*\s*(.+)/)||[])[1]||"";console.log(`${a.padEnd(45)} ${c.padEnd(15)}`),u&&console.log(` \u2192 ${u.slice(0,70)}`),console.log()}console.log("\u2500".repeat(80)),console.log(`
324
344
  For full agent details: cat rcode/digests/{agent}.md`),console.log(`For full skill: rcode/skills/agents/{agent-dir}/SKILL.md
325
- `)}});var iD=v((JI,oD)=>{var{spawnSync:nD}=require("child_process"),fc=require("fs"),sD=require("path");oD.exports=function(e,{packageRoot:r}){let n=sD.join(r,"rcode/agents");if(e.includes("--list")||e.length===0){let g=fc.readdirSync(n).filter(m=>m.startsWith("rcode-")&&m.endsWith(".md")).map(m=>m.replace(/^rcode-/,"").replace(/\.md$/,"")).sort();e.length===0&&console.log(`Usage: rcode agent <name> [-- extra args]
345
+ `)}});var cD=v((QI,aD)=>{var{spawnSync:oD}=require("child_process"),hu=require("fs"),iD=require("path");aD.exports=function(e,{packageRoot:r}){let n=iD.join(r,"rcode/agents");if(e.includes("--list")||e.length===0){let g=hu.readdirSync(n).filter(m=>m.startsWith("rcode-")&&m.endsWith(".md")).map(m=>m.replace(/^rcode-/,"").replace(/\.md$/,"")).sort();e.length===0&&console.log(`Usage: rcode agent <name> [-- extra args]
326
346
  `),console.log(`Available agents (${g.length}):
327
- `),g.forEach(m=>console.log(` rcode agent ${m}`));return}let s=e[0],o=`rcode-${s.startsWith("rcode-")?s.slice(6):s}`,a=sD.join(n,`${o}.md`);if(!fc.existsSync(a)){let g=fc.readdirSync(n).filter(m=>m.startsWith("rcode-")&&m.endsWith(".md")).map(m=>m.replace(/^rcode-/,"").replace(/\.md$/,"")).sort().join(", ");console.error(`Error: No agent named '${o}' found.`),console.error(`Available: ${g}`),process.exit(1)}let u=process.platform==="win32"?"where":"which";nD(u,["claude"],{encoding:"utf8"}).status!==0&&(console.error("Error: claude binary not found. Install Claude Code: https://claude.ai/code"),process.exit(1));let l=e.indexOf("--"),d=l!==-1?e.slice(l+1):[],f=nD("claude",["--agent",o,...d],{stdio:"inherit"});process.exit(f.status??0)}});var mc=v((XI,hD)=>{var un=require("fs"),Mo=require("path"),UA=require("crypto"),{spawnSync:hc}=require("child_process"),{writeJsonAtomic:VA}=Kt(),ls={commitsSinceInit:20,daysSinceInit:14},aD=["package-lock.json","pnpm-lock.yaml","yarn.lock","package.json","pyproject.toml","poetry.lock","requirements.txt","Pipfile.lock","Cargo.lock","Cargo.toml","go.sum","go.mod","Gemfile.lock","Gemfile","composer.lock","composer.json","pom.xml","build.gradle","build.gradle.kts"];function uD(t){return UA.createHash("sha256").update(t).digest("hex").slice(0,16)}function GA(t){if(!un.existsSync(t))return null;try{let e=un.readFileSync(t);return uD(e)}catch(e){return console.error("[memory-bank] hashFileIfExists: failed to read",t+":",e?.message||e),null}}function zA(t){for(let e of aD){let r=Mo.join(t,e),n=GA(r);if(n)return{name:e,hash:n}}return null}function YA(t){try{let e=un.readdirSync(t,{withFileTypes:!0}).filter(r=>r.isDirectory()).map(r=>r.name).filter(r=>!r.startsWith(".")&&r!=="node_modules"&&r!=="dist"&&r!=="build").sort();return{dirs:e,hash:uD(e.join("|"))}}catch(e){return console.error("[memory-bank] structureFingerprint: failed to read directory:",e?.message||e),{dirs:[],hash:null}}}function JA(t){try{let e=hc("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8"});if(e.status!==0)return null;let r=hc("git",["branch","--show-current"],{cwd:t,encoding:"utf8"});return{head:e.stdout.trim(),branch:r.status===0?r.stdout.trim():null}}catch(e){return console.error("[memory-bank] gitFingerprint: git command failed:",e?.message||e),null}}function cD(t,e,r){if(!e||!r)return null;try{let n=hc("git",["rev-list","--count",`${e}..${r}`],{cwd:t,encoding:"utf8"});return n.status!==0?null:parseInt(n.stdout.trim(),10)}catch(n){return console.error("[memory-bank] commitsBetween: git rev-list failed:",n?.message||n),null}}function pc(t){let e=JA(t),r=zA(t),n=YA(t);return{timestamp:new Date().toISOString(),git_head:e?e.head:null,git_branch:e?e.branch:null,manifest_name:r?r.name:null,manifest_hash:r?r.hash:null,structure_hash:n.hash,structure_dirs:n.dirs}}function lD(t){return Mo.join(t,".rcode","state.json")}function dD(t){let e=lD(t);if(!un.existsSync(e))return null;try{return JSON.parse(un.readFileSync(e,"utf8"))}catch(r){return console.error("[memory-bank] readState: failed to parse state.json at",e+":",r?.message||r),null}}function XA(t){let e=dD(t)||{},r=pc(t);return e.memory_bank={...e.memory_bank,last_init:r},VA(lD(t),e),r}function fD(t){return dD(t)?.memory_bank?.last_init||null}function KA(t){let e=pc(t),r=fD(t),n=Mo.join(t,".rcode/context/active.md"),s=Mo.join(t,".rcode/context/project-brief.md"),i={active:un.existsSync(n),brief:un.existsSync(s)};if(!i.active&&!i.brief)return{status:"never",reasons:["memory bank has never been initialized \u2014 run /rcode-init"],current:e,stored:r,context_files:i};if(!i.active||!i.brief){let a=[];return i.active||a.push(".rcode/context/active.md"),i.brief||a.push(".rcode/context/project-brief.md"),{status:"stale",reasons:[`incomplete memory bank \u2014 missing: ${a.join(", ")}`],current:e,stored:r,context_files:i}}if(!r)return{status:"stale",reasons:["run /rcode-init in your editor to populate project context"],current:e,stored:r,context_files:i};let o=[];if(e.manifest_hash&&r.manifest_hash&&e.manifest_hash!==r.manifest_hash&&o.push(`${e.manifest_name||"dependency manifest"} changed since last init`),e.structure_hash&&r.structure_hash&&e.structure_hash!==r.structure_hash){let a=new Set(r.structure_dirs||[]),u=new Set(e.structure_dirs||[]),c=[...u].filter(f=>!a.has(f)),l=[...a].filter(f=>!u.has(f)),d=[];c.length&&d.push(`added: ${c.join(", ")}`),l.length&&d.push(`removed: ${l.join(", ")}`),o.push(`top-level structure changed (${d.join("; ")||"reorganized"})`)}if(e.git_head&&r.git_head&&e.git_head!==r.git_head){let a=cD(t,r.git_head,e.git_head);a!==null&&a>=ls.commitsSinceInit&&o.push(`${a} commits since last init (threshold: ${ls.commitsSinceInit})`)}if(r.timestamp){let a=Date.parse(r.timestamp);if(!Number.isNaN(a)){let u=(Date.now()-a)/864e5;u>=ls.daysSinceInit&&o.push(`${Math.floor(u)} days since last init (threshold: ${ls.daysSinceInit})`)}}return{status:o.length>0?"stale":"fresh",reasons:o,current:e,stored:r,context_files:i}}hD.exports={computeFingerprint:pc,writeFingerprint:XA,readFingerprint:fD,checkStaleness:KA,commitsBetween:cD,STALE_THRESHOLDS:ls,MANIFEST_CANDIDATES:aD}});var vD=v((KI,yD)=>{var{z:De}=za();function QA(t){if(typeof t!="string")return{frontmatter:{},body:t||""};if(t=t.replace(/\r\n/g,`
347
+ `),g.forEach(m=>console.log(` rcode agent ${m}`));return}let s=e[0],o=`rcode-${s.startsWith("rcode-")?s.slice(6):s}`,a=iD.join(n,`${o}.md`);if(!hu.existsSync(a)){let g=hu.readdirSync(n).filter(m=>m.startsWith("rcode-")&&m.endsWith(".md")).map(m=>m.replace(/^rcode-/,"").replace(/\.md$/,"")).sort().join(", ");console.error(`Error: No agent named '${o}' found.`),console.error(`Available: ${g}`),process.exit(1)}let c=process.platform==="win32"?"where":"which";oD(c,["claude"],{encoding:"utf8"}).status!==0&&(console.error("Error: claude binary not found. Install Claude Code: https://claude.ai/code"),process.exit(1));let l=e.indexOf("--"),d=l!==-1?e.slice(l+1):[],f=oD("claude",["--agent",o,...d],{stdio:"inherit"});process.exit(f.status??0)}});var gu=v((eT,mD)=>{var ln=require("fs"),qo=require("path"),zA=require("crypto"),{spawnSync:pu}=require("child_process"),{writeJsonAtomic:YA}=Qt(),fs={commitsSinceInit:20,daysSinceInit:14},uD=["package-lock.json","pnpm-lock.yaml","yarn.lock","package.json","pyproject.toml","poetry.lock","requirements.txt","Pipfile.lock","Cargo.lock","Cargo.toml","go.sum","go.mod","Gemfile.lock","Gemfile","composer.lock","composer.json","pom.xml","build.gradle","build.gradle.kts"];function lD(t){return zA.createHash("sha256").update(t).digest("hex").slice(0,16)}function JA(t){if(!ln.existsSync(t))return null;try{let e=ln.readFileSync(t);return lD(e)}catch(e){return console.error("[memory-bank] hashFileIfExists: failed to read",t+":",e?.message||e),null}}function XA(t){for(let e of uD){let r=qo.join(t,e),n=JA(r);if(n)return{name:e,hash:n}}return null}function KA(t){try{let e=ln.readdirSync(t,{withFileTypes:!0}).filter(r=>r.isDirectory()).map(r=>r.name).filter(r=>!r.startsWith(".")&&r!=="node_modules"&&r!=="dist"&&r!=="build").sort();return{dirs:e,hash:lD(e.join("|"))}}catch(e){return console.error("[memory-bank] structureFingerprint: failed to read directory:",e?.message||e),{dirs:[],hash:null}}}function QA(t){try{let e=pu("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8"});if(e.status!==0)return null;let r=pu("git",["branch","--show-current"],{cwd:t,encoding:"utf8"});return{head:e.stdout.trim(),branch:r.status===0?r.stdout.trim():null}}catch(e){return console.error("[memory-bank] gitFingerprint: git command failed:",e?.message||e),null}}function dD(t,e,r){if(!e||!r)return null;try{let n=pu("git",["rev-list","--count",`${e}..${r}`],{cwd:t,encoding:"utf8"});return n.status!==0?null:parseInt(n.stdout.trim(),10)}catch(n){return console.error("[memory-bank] commitsBetween: git rev-list failed:",n?.message||n),null}}function mu(t){let e=QA(t),r=XA(t),n=KA(t);return{timestamp:new Date().toISOString(),git_head:e?e.head:null,git_branch:e?e.branch:null,manifest_name:r?r.name:null,manifest_hash:r?r.hash:null,structure_hash:n.hash,structure_dirs:n.dirs}}function fD(t){return qo.join(t,".rcode","state.json")}function hD(t){let e=fD(t);if(!ln.existsSync(e))return null;try{return JSON.parse(ln.readFileSync(e,"utf8"))}catch(r){return console.error("[memory-bank] readState: failed to parse state.json at",e+":",r?.message||r),null}}function e1(t){let e=hD(t)||{},r=mu(t);return e.memory_bank={...e.memory_bank,last_init:r},YA(fD(t),e),r}function pD(t){return hD(t)?.memory_bank?.last_init||null}function t1(t){let e=mu(t),r=pD(t),n=qo.join(t,".rcode/context/active.md"),s=qo.join(t,".rcode/context/project-brief.md"),i={active:ln.existsSync(n),brief:ln.existsSync(s)};if(!i.active&&!i.brief)return{status:"never",reasons:["memory bank has never been initialized \u2014 run /rcode-init"],current:e,stored:r,context_files:i};if(!i.active||!i.brief){let a=[];return i.active||a.push(".rcode/context/active.md"),i.brief||a.push(".rcode/context/project-brief.md"),{status:"stale",reasons:[`incomplete memory bank \u2014 missing: ${a.join(", ")}`],current:e,stored:r,context_files:i}}if(!r)return{status:"stale",reasons:["run /rcode-init in your editor to populate project context"],current:e,stored:r,context_files:i};let o=[];if(e.manifest_hash&&r.manifest_hash&&e.manifest_hash!==r.manifest_hash&&o.push(`${e.manifest_name||"dependency manifest"} changed since last init`),e.structure_hash&&r.structure_hash&&e.structure_hash!==r.structure_hash){let a=new Set(r.structure_dirs||[]),c=new Set(e.structure_dirs||[]),u=[...c].filter(f=>!a.has(f)),l=[...a].filter(f=>!c.has(f)),d=[];u.length&&d.push(`added: ${u.join(", ")}`),l.length&&d.push(`removed: ${l.join(", ")}`),o.push(`top-level structure changed (${d.join("; ")||"reorganized"})`)}if(e.git_head&&r.git_head&&e.git_head!==r.git_head){let a=dD(t,r.git_head,e.git_head);a!==null&&a>=fs.commitsSinceInit&&o.push(`${a} commits since last init (threshold: ${fs.commitsSinceInit})`)}if(r.timestamp){let a=Date.parse(r.timestamp);if(!Number.isNaN(a)){let c=(Date.now()-a)/864e5;c>=fs.daysSinceInit&&o.push(`${Math.floor(c)} days since last init (threshold: ${fs.daysSinceInit})`)}}return{status:o.length>0?"stale":"fresh",reasons:o,current:e,stored:r,context_files:i}}mD.exports={computeFingerprint:mu,writeFingerprint:e1,readFingerprint:pD,checkStaleness:t1,commitsBetween:dD,STALE_THRESHOLDS:fs,MANIFEST_CANDIDATES:uD}});var bD=v((tT,_D)=>{var{z:ye}=Ya();function r1(t){if(typeof t!="string")return{frontmatter:{},body:t||""};if(t=t.replace(/\r\n/g,`
328
348
  `),!t.startsWith(`---
329
349
  `))return{frontmatter:{},body:t};let e=t.indexOf(`
330
350
  ---
331
351
  `,4);if(e===-1)return{frontmatter:{},body:t};let r=t.slice(4,e),n=t.slice(e+5),s={},i=r.split(`
332
- `),o=0;for(;o<i.length;){let a=i[o];if(!a.trim()||a.trim().startsWith("#")){o++;continue}let u=a.match(/^([A-Za-z0-9_-]+):(.*)$/);if(!u){o++;continue}let c=u[1].trim(),l=u[2].trim();if(l=l.replace(/\s+#.*$/,"").trim(),l===">"||l==="|"||l===">-"||l==="|-"){let d=[];for(o++;o<i.length;){let f=i[o];if(f.trim()===""){d.push(""),o++;continue}if(/^\s/.test(f)){d.push(f.trim()),o++;continue}break}s[c]=d.join(" ").replace(/\s+/g," ").trim();continue}if(l===""){let d=[],f=o+1;for(;f<i.length;){let g=i[f];if(g.trim()===""||g.trim().startsWith("#")){f++;continue}let m=g.match(/^\s+-\s+(.*)$/);if(!m)break;let y=m[1].trim();y.startsWith('"')&&y.endsWith('"')&&(y=y.slice(1,-1)),y.startsWith("'")&&y.endsWith("'")&&(y=y.slice(1,-1)),d.push(y),f++}if(d.length){s[c]=d,o=f;continue}s[c]="",o++;continue}l.startsWith('"')&&l.endsWith('"')&&(l=l.slice(1,-1)),l.startsWith("'")&&l.endsWith("'")&&(l=l.slice(1,-1)),s[c]=l,o++}return{frontmatter:s,body:n}}function pD(t){let r=(typeof t.description=="string"?t.description:"").match(/"[^"]+"/g)||[];return r.length>0?r.length:Array.isArray(t.triggers)?t.triggers.filter(n=>typeof n=="string"&&n.trim()).length:typeof t.triggers=="string"&&t.triggers.trim()?t.triggers.split(",").map(n=>n.trim()).filter(Boolean).length:0}var mD=De.object({name:De.string().min(1,"name is required"),description:De.string().min(1,"description is required")}),e1=/not for|do not|does not|don't|never\b|audit-only|negative/i;function t1(t,e=""){let r=[],n=[],s=mD.safeParse(t||{});if(!s.success)for(let i of s.error.issues){let o=i.path.length?i.path.join("."):"(root)";r.push(`${o}: ${i.message}`)}if(t&&typeof t=="object"){let i=pD(t);i<5?r.push(`too few trigger phrases: found ${i}, need at least 5`):i>12&&n.push(`many trigger phrases: found ${i}, recommended max is 12`);let o=typeof t.description=="string"?t.description:"",a=typeof e=="string"?e:"";e1.test(o)||/##[^\n]*\bnot\b/i.test(a)||/\bdo not (use|include)\b/i.test(a)||/\bdon't touch\b/i.test(a)||r.push('missing negative-boundary clause (e.g. "Do NOT use for: ..." in the description or a "## Do NOT use" section)')}return{ok:r.length===0,errors:r,warnings:n}}var gD=De.object({name:De.string().min(1,"name is required").refine(t=>t.startsWith("rcode-"),'name must start with the "rcode-" prefix'),description:De.string().min(1,"description is required"),color:De.string().min(1,"color is required")});function r1(t){let e=[],r=gD.safeParse(t||{});if(!r.success)for(let n of r.error.issues){let s=n.path.length?n.path.join("."):"(root)";e.push(`${s}: ${n.message}`)}if(t&&typeof t=="object"){let n=t.tools;(Array.isArray(n)?n.length>0:typeof n=="string"&&n.trim().length>0)||e.push("tools is required (comma-separated string or array)")}else e.push("tools is required (comma-separated string or array)");return{ok:e.length===0,errors:e}}var DD=De.object({version:De.union([De.string(),De.number()]),project:De.string().min(1),phases:De.array(De.any()),schema_version:De.number(),current_phase:De.union([De.string(),De.number()]).optional(),current_plan:De.union([De.string(),De.number()]).optional(),current_sprint:De.union([De.string(),De.number()]).nullable().optional(),velocity_history:De.array(De.any()).optional(),milestones:De.array(De.any()).optional()}).passthrough();function n1(t){let e=[],r=DD.safeParse(t||{});if(!r.success)for(let n of r.error.issues){let s=n.path.length?n.path.join("."):"(root)";e.push(`${s}: ${n.message}`)}return{ok:e.length===0,errors:e}}yD.exports={parseFrontmatter:QA,countTriggerPhrases:pD,skillFrontmatterSchema:mD,agentFrontmatterSchema:gD,stateSchema:DD,validateSkillFrontmatter:t1,validateAgentFrontmatter:r1,validateState:n1}});var ED=v((QI,Wo)=>{var pe=require("fs"),Se=require("path"),{spawnSync:_D}=require("child_process"),{verifyInstall:s1,formatReport:o1}=ss(),{checkStaleness:i1}=mc(),{homedir:a1}=dr(),{scanNamespaceDuplication:u1}=No(),{parseFrontmatter:gc,validateSkillFrontmatter:c1,validateAgentFrontmatter:l1}=vD();function Dc(t){let e=[];if(!pe.existsSync(t))return e;for(let r of pe.readdirSync(t,{withFileTypes:!0})){let n=Se.join(t,r.name);r.isDirectory()?e.push(...Dc(n)):r.isFile()&&r.name==="SKILL.md"&&e.push(n)}return e}function d1(t){return pe.existsSync(t)?pe.readdirSync(t,{withFileTypes:!0}).filter(e=>e.isFile()&&e.name.endsWith(".md")).map(e=>Se.join(t,e.name)):[]}var f1=/not for|do not|does not|don't|never\b|audit-only|negative/i;function h1(t){let e=pe.readFileSync(t,"utf8"),{frontmatter:r,body:n}=gc(e),s=[];/^name:/m.test(e)||s.push("name"),/^description:/m.test(e)||s.push("description"),/^## Overview/m.test(e)||s.push("Overview section"),/^## Output Format/m.test(e)||s.push("Output Format"),/^## Examples/m.test(e)||s.push("Examples");let i=r["not-for"],o=Array.isArray(i)&&i.length>0,a=typeof r.description=="string"?r.description:"";return o||f1.test(a)||/##[^\n]*\bnot\b/i.test(n)||/\bdo not (use|include)\b/i.test(n)||s.push("negative-boundary clause"),s}function p1(t){try{return pe.accessSync(t,pe.constants.W_OK),!0}catch{return!1}}function qo(t){let e=process.platform==="win32"?"where":"which";return _D(e,[t],{stdio:"ignore"}).status===0}function bD(t){let e=Array.isArray(t?.phases)?t.phases:[],r=e.filter(s=>s&&s.status==="executing");if(r.length===0)return[];let n=e.filter(s=>s&&s.status==="complete").map(s=>parseFloat(s.number)).filter(s=>!Number.isNaN(s)).reduce((s,i)=>Math.max(s,i),-1/0);return n===-1/0?[]:r.filter(s=>{let i=parseFloat(s.number);return!Number.isNaN(i)&&i<n})}function SD(t,e){let r=[],n=process.versions.node,s=parseInt(n.split(".")[0],10);r.push({label:"Node.js \u2265 18",status:s>=18?"ok":"fail",message:`v${n}${s<18?" \u2014 upgrade to 18 LTS or newer":""}`});let i=Se.join(t,".rcode");pe.existsSync(i)?r.push({label:".rcode/ writable",status:p1(i)?"ok":"fail",message:i}):r.push({label:".rcode/ state",status:"warn",message:"not initialized in this directory (run `rcode install`)"});let o=Se.join(e,"rcode/config/model-profiles.json");if(pe.existsSync(o))try{let a=JSON.parse(pe.readFileSync(o,"utf8")),u=["quality","balanced","budget","inherit"],c=Object.keys(a.profiles||a),l=u.filter(d=>!c.includes(d));l.length===0?r.push({label:"model-profiles.json",status:"ok",message:`${c.length} profiles (${c.join(", ")})`}):r.push({label:"model-profiles.json",status:"fail",message:`missing expected profiles: ${l.join(", ")}`})}catch(a){r.push({label:"model-profiles.json",status:"fail",message:`invalid JSON: ${a.message}`})}else r.push({label:"model-profiles.json",status:"fail",message:"missing from package"});r.push({label:"git CLI",status:qo("git")?"ok":"warn",message:qo("git")?"available":"not found (some features disabled)"}),r.push({label:"gh CLI",status:qo("gh")?"ok":"warn",message:qo("gh")?"available (github-sync ready)":"not found (github-sync unavailable)"});try{let a=u1(t,a1());a.totalCount>0?r.push({label:"Namespace duplication",status:"warn",message:`${a.totalCount} duplicate registration(s) \u2014 legacy skills: ${a.legacySkillCount}, legacy commands: ${a.legacyCommandCount}, legacy agents: ${a.legacyAgentCount}, unprefixed: ${a.unprefixedCount}, cross-scope: ${a.crossScopeCount}, legacy Codex commands: ${a.legacyCodexCommandCount} (run \`rcode migrate-namespace --yes\` or \`rcode update\`)`}):r.push({label:"Namespace duplication",status:"ok",message:"no duplicate rihal-*/rcode-* registrations found"})}catch(a){r.push({label:"Namespace duplication",status:"warn",message:`could not scan: ${a.message}`})}if(pe.existsSync(i)){let a=[],u=Se.join(t,".claude/commands");if((pe.existsSync(u)&&pe.readdirSync(u).some(m=>m.startsWith("rcode-")&&m.endsWith(".md"))||pe.existsSync(Se.join(t,".claude/skills")))&&a.push("claude"),pe.existsSync(Se.join(t,".cursor/rules"))&&a.push("cursor"),pe.existsSync(Se.join(t,".windsurf/rules"))&&a.push("windsurf"),pe.existsSync(Se.join(t,".antigravity/agents"))&&a.push("antigravity"),a.length>0){let{reports:m,hasDrift:y}=s1(t,e,a);if(y)r.push({label:"Agent manifest",status:"fail",message:`drift detected across ${a.join(", ")}`,detail:o1(m)});else{let h=m.map(w=>`${w.editor}:${w.installedCount}`).join(" ");r.push({label:"Agent manifest",status:"ok",message:h})}}let l=i1(t);l.status==="fresh"?r.push({label:"Memory bank",status:"ok",message:"fresh"}):l.status==="never"?r.push({label:"Memory bank",status:"warn",message:"never initialized (run /rcode-init to populate)"}):r.push({label:"Memory bank",status:"warn",message:`STALE \u2014 ${l.reasons[0]}${l.reasons.length>1?` (+${l.reasons.length-1} more)`:""}`});let d=Se.join(i,"data","intent-table.json");r.push({label:"intent-table.json",status:pe.existsSync(d)?"ok":"warn",message:pe.existsSync(d)?Se.relative(t,d):"missing \u2014 run `npx @hanzlaa/rcode update` to sync .rcode/data/"});let f=Se.join(i,"state.json");if(pe.existsSync(f))try{let m=JSON.parse(pe.readFileSync(f,"utf8")),y=bD(m);r.push({label:"Phase state",status:y.length>0?"warn":"ok",message:y.length>0?`${y.length} phase(s) stuck 'executing' while a later phase is complete: ${y.map(h=>h.number).join(", ")}`:"no stuck phases"})}catch(m){r.push({label:"Phase state",status:"warn",message:`state.json unreadable: ${m.message}`})}let g=Se.join(i,"memory","INDEX.md");if(pe.existsSync(g)){let m=Math.floor((Date.now()-pe.statSync(g).mtimeMs)/864e5);r.push({label:"Memory INDEX.md",status:m>30?"warn":"ok",message:m>30?`STALE \u2014 last updated ${m}d ago (run /rcode-memory-update)`:`fresh \u2014 updated ${m}d ago`})}else r.push({label:"Memory INDEX.md",status:"warn",message:"missing (run /rcode-memory-init)"})}return r}function m1(t){let e=0;for(let r of t){let n=r.status==="ok"?"\u2713":r.status==="warn"?"\u26A0":"\u2717";console.log(` ${n} ${r.label.padEnd(22)} ${r.message}`),r.detail&&console.log(r.detail),r.status==="fail"&&e++}return e}function g1(t){let e=[Se.join(t,"rcode/skills/agents"),Se.join(t,"rcode/skills/actions")],r=0,n=0,s=[];for(let i of e){let o=Dc(i);for(let a of o){r++;let u=h1(a);if(u.length>0){n++;let c=Se.relative(t,a);s.push({file:c,missing:u})}}}if(s.length>0){console.log(` \u2717 ${n} / ${r} skills are non-compliant:
333
- `);for(let i of s)console.log(` ${i.file}`),console.log(` missing: ${i.missing.join(", ")}`)}else console.log(` \u2713 All ${r} skills compliant with 5-component standard`);return n}function D1(t){let e=[Se.join(t,"rcode/skills/agents"),Se.join(t,"rcode/skills/actions")],r=0,n=0,s=0,i=0;for(let o of e)for(let a of Dc(o)){r++;let{frontmatter:u,body:c}=gc(pe.readFileSync(a,"utf8")),l=c1(u,c),d=Se.relative(t,a);if(!l.ok){s++,console.log(` \u2717 ${d}`);for(let f of l.errors)console.log(` ${f}`)}if(l.warnings&&l.warnings.length>0){i++;for(let f of l.warnings)console.log(` \u26A0 ${d}: ${f}`)}}for(let o of d1(Se.join(t,"rcode/agents"))){n++;let{frontmatter:a}=gc(pe.readFileSync(o,"utf8")),u=l1(a);if(!u.ok){s++;let c=Se.relative(t,o);console.log(` \u2717 ${c}`);for(let l of u.errors)console.log(` ${l}`)}}return console.log(s===0?` \u2713 ${r} skill + ${n} agent frontmatter blocks pass schema validation`+(i>0?` (${i} with advisory warnings)`:""):` \u2717 ${s} artifact(s) failed schema validation`),s}function y1(){let e=require("os").homedir(),r=[],n=[];for(let i of[["npm",["root","-g"]],["pnpm",["root","-g"]]])try{let o=_D(i[0],i[1],{encoding:"utf8"});o.status===0&&o.stdout.trim()&&n.push({manager:i[0],dir:o.stdout.trim()})}catch{}let s=Se.join(e,".nvm","versions","node");if(pe.existsSync(s))for(let i of pe.readdirSync(s)){let o=Se.join(s,i,"lib","node_modules");pe.existsSync(o)&&!n.some(a=>a.dir===o)&&n.push({manager:`nvm/${i}`,dir:o})}for(let{manager:i,dir:o}of n)for(let a of["@hanzlaa","@hanzlahabib"]){let u=Se.join(o,a);if(pe.existsSync(u)){for(let c of pe.readdirSync(u))if(c==="rcode"||c==="rcode"||c.startsWith("rcode")){let l="unknown";try{l=JSON.parse(pe.readFileSync(Se.join(u,c,"package.json"),"utf8")).version}catch{}r.push({manager:i,scope:a,pkg:c,version:l,dir:Se.join(u,c)})}}}return{count:r.length,installs:r}}function v1(t){if(t.count===0)return console.log(" \u2713 No global rcode installs found"),0;if(t.count===1){let e=t.installs[0];return console.log(` \u2713 Single global install: [${e.manager}] ${e.scope}/${e.pkg}@${e.version}`),0}console.log(` \u2717 ${t.count} global installs detected \u2014 this causes duplicate slash commands!`);for(let e of t.installs)console.log(` [${e.manager}] ${e.scope}/${e.pkg}@${e.version}`),console.log(` ${e.dir}`);return console.log(`
334
- Fix: rcode nuke --yes && npm install -g @hanzlaa/rcode`),1}Wo.exports=function(e,{packageRoot:r}){let n=process.cwd();console.log(`
352
+ `),o=0;for(;o<i.length;){let a=i[o];if(!a.trim()||a.trim().startsWith("#")){o++;continue}let c=a.match(/^([A-Za-z0-9_-]+):(.*)$/);if(!c){o++;continue}let u=c[1].trim(),l=c[2].trim();if(l=l.replace(/\s+#.*$/,"").trim(),l===">"||l==="|"||l===">-"||l==="|-"){let d=[];for(o++;o<i.length;){let f=i[o];if(f.trim()===""){d.push(""),o++;continue}if(/^\s/.test(f)){d.push(f.trim()),o++;continue}break}s[u]=d.join(" ").replace(/\s+/g," ").trim();continue}if(l===""){let d=[],f=o+1;for(;f<i.length;){let g=i[f];if(g.trim()===""||g.trim().startsWith("#")){f++;continue}let m=g.match(/^\s+-\s+(.*)$/);if(!m)break;let y=m[1].trim();y.startsWith('"')&&y.endsWith('"')&&(y=y.slice(1,-1)),y.startsWith("'")&&y.endsWith("'")&&(y=y.slice(1,-1)),d.push(y),f++}if(d.length){s[u]=d,o=f;continue}s[u]="",o++;continue}l.startsWith('"')&&l.endsWith('"')&&(l=l.slice(1,-1)),l.startsWith("'")&&l.endsWith("'")&&(l=l.slice(1,-1)),s[u]=l,o++}return{frontmatter:s,body:n}}function gD(t){let r=(typeof t.description=="string"?t.description:"").match(/"[^"]+"/g)||[];return r.length>0?r.length:Array.isArray(t.triggers)?t.triggers.filter(n=>typeof n=="string"&&n.trim()).length:typeof t.triggers=="string"&&t.triggers.trim()?t.triggers.split(",").map(n=>n.trim()).filter(Boolean).length:0}var DD=ye.object({name:ye.string().min(1,"name is required"),description:ye.string().min(1,"description is required")}),n1=/not for|do not|does not|don't|never\b|audit-only|negative/i;function s1(t,e=""){let r=[],n=[],s=DD.safeParse(t||{});if(!s.success)for(let i of s.error.issues){let o=i.path.length?i.path.join("."):"(root)";r.push(`${o}: ${i.message}`)}if(t&&typeof t=="object"){let i=gD(t);i<5?r.push(`too few trigger phrases: found ${i}, need at least 5`):i>12&&n.push(`many trigger phrases: found ${i}, recommended max is 12`);let o=typeof t.description=="string"?t.description:"",a=typeof e=="string"?e:"";n1.test(o)||/##[^\n]*\bnot\b/i.test(a)||/\bdo not (use|include)\b/i.test(a)||/\bdon't touch\b/i.test(a)||r.push('missing negative-boundary clause (e.g. "Do NOT use for: ..." in the description or a "## Do NOT use" section)')}return{ok:r.length===0,errors:r,warnings:n}}var yD=ye.object({name:ye.string().min(1,"name is required").refine(t=>t.startsWith("rcode-"),'name must start with the "rcode-" prefix'),description:ye.string().min(1,"description is required"),color:ye.string().min(1,"color is required")});function o1(t){let e=[],r=yD.safeParse(t||{});if(!r.success)for(let n of r.error.issues){let s=n.path.length?n.path.join("."):"(root)";e.push(`${s}: ${n.message}`)}if(t&&typeof t=="object"){let n=t.tools;(Array.isArray(n)?n.length>0:typeof n=="string"&&n.trim().length>0)||e.push("tools is required (comma-separated string or array)")}else e.push("tools is required (comma-separated string or array)");return{ok:e.length===0,errors:e}}var vD=ye.object({version:ye.union([ye.string(),ye.number()]),project:ye.string().min(1),phases:ye.array(ye.any()),schema_version:ye.number(),current_phase:ye.union([ye.string(),ye.number()]).optional(),current_plan:ye.union([ye.string(),ye.number()]).optional(),current_sprint:ye.union([ye.string(),ye.number()]).nullable().optional(),velocity_history:ye.array(ye.any()).optional(),milestones:ye.array(ye.any()).optional()}).passthrough();function i1(t){let e=[],r=vD.safeParse(t||{});if(!r.success)for(let n of r.error.issues){let s=n.path.length?n.path.join("."):"(root)";e.push(`${s}: ${n.message}`)}return{ok:e.length===0,errors:e}}_D.exports={parseFrontmatter:r1,countTriggerPhrases:gD,skillFrontmatterSchema:DD,agentFrontmatterSchema:yD,stateSchema:vD,validateSkillFrontmatter:s1,validateAgentFrontmatter:o1,validateState:i1}});var wD=v((rT,Ho)=>{var pe=require("fs"),Ee=require("path"),{spawnSync:SD}=require("child_process"),{verifyInstall:a1,formatReport:c1}=is(),{checkStaleness:u1}=gu(),{homedir:l1}=hr(),{scanNamespaceDuplication:d1}=Lo(),{parseFrontmatter:Du,validateSkillFrontmatter:f1,validateAgentFrontmatter:h1}=bD();function yu(t){let e=[];if(!pe.existsSync(t))return e;for(let r of pe.readdirSync(t,{withFileTypes:!0})){let n=Ee.join(t,r.name);r.isDirectory()?e.push(...yu(n)):r.isFile()&&r.name==="SKILL.md"&&e.push(n)}return e}function p1(t){return pe.existsSync(t)?pe.readdirSync(t,{withFileTypes:!0}).filter(e=>e.isFile()&&e.name.endsWith(".md")).map(e=>Ee.join(t,e.name)):[]}var m1=/not for|do not|does not|don't|never\b|audit-only|negative/i;function g1(t){let e=pe.readFileSync(t,"utf8"),{frontmatter:r,body:n}=Du(e),s=[];/^name:/m.test(e)||s.push("name"),/^description:/m.test(e)||s.push("description"),/^## Overview/m.test(e)||s.push("Overview section"),/^## Output Format/m.test(e)||s.push("Output Format"),/^## Examples/m.test(e)||s.push("Examples");let i=r["not-for"],o=Array.isArray(i)&&i.length>0,a=typeof r.description=="string"?r.description:"";return o||m1.test(a)||/##[^\n]*\bnot\b/i.test(n)||/\bdo not (use|include)\b/i.test(n)||s.push("negative-boundary clause"),s}function D1(t){try{return pe.accessSync(t,pe.constants.W_OK),!0}catch{return!1}}function Wo(t){let e=process.platform==="win32"?"where":"which";return SD(e,[t],{stdio:"ignore"}).status===0}function ED(t){let e=Array.isArray(t?.phases)?t.phases:[],r=e.filter(s=>s&&s.status==="executing");if(r.length===0)return[];let n=e.filter(s=>s&&s.status==="complete").map(s=>parseFloat(s.number)).filter(s=>!Number.isNaN(s)).reduce((s,i)=>Math.max(s,i),-1/0);return n===-1/0?[]:r.filter(s=>{let i=parseFloat(s.number);return!Number.isNaN(i)&&i<n})}function CD(t,e){let r=[],n=process.versions.node,s=parseInt(n.split(".")[0],10);r.push({label:"Node.js \u2265 18",status:s>=18?"ok":"fail",message:`v${n}${s<18?" \u2014 upgrade to 18 LTS or newer":""}`});let i=Ee.join(t,".rcode");pe.existsSync(i)?r.push({label:".rcode/ writable",status:D1(i)?"ok":"fail",message:i}):r.push({label:".rcode/ state",status:"warn",message:"not initialized in this directory (run `rcode install`)"});let o=Ee.join(e,"rcode/config/model-profiles.json");if(pe.existsSync(o))try{let a=JSON.parse(pe.readFileSync(o,"utf8")),c=["quality","balanced","budget","inherit"],u=Object.keys(a.profiles||a),l=c.filter(d=>!u.includes(d));l.length===0?r.push({label:"model-profiles.json",status:"ok",message:`${u.length} profiles (${u.join(", ")})`}):r.push({label:"model-profiles.json",status:"fail",message:`missing expected profiles: ${l.join(", ")}`})}catch(a){r.push({label:"model-profiles.json",status:"fail",message:`invalid JSON: ${a.message}`})}else r.push({label:"model-profiles.json",status:"fail",message:"missing from package"});r.push({label:"git CLI",status:Wo("git")?"ok":"warn",message:Wo("git")?"available":"not found (some features disabled)"}),r.push({label:"gh CLI",status:Wo("gh")?"ok":"warn",message:Wo("gh")?"available (github-sync ready)":"not found (github-sync unavailable)"});try{let a=d1(t,l1());a.totalCount>0?r.push({label:"Namespace duplication",status:"warn",message:`${a.totalCount} duplicate registration(s) \u2014 legacy skills: ${a.legacySkillCount}, legacy commands: ${a.legacyCommandCount}, legacy agents: ${a.legacyAgentCount}, unprefixed: ${a.unprefixedCount}, cross-scope: ${a.crossScopeCount}, legacy Codex commands: ${a.legacyCodexCommandCount} (run \`rcode migrate-namespace --yes\` or \`rcode update\`)`}):r.push({label:"Namespace duplication",status:"ok",message:"no duplicate rihal-*/rcode-* registrations found"})}catch(a){r.push({label:"Namespace duplication",status:"warn",message:`could not scan: ${a.message}`})}if(pe.existsSync(i)){let a=[],c=Ee.join(t,".claude/commands");if((pe.existsSync(c)&&pe.readdirSync(c).some(m=>m.startsWith("rcode-")&&m.endsWith(".md"))||pe.existsSync(Ee.join(t,".claude/skills")))&&a.push("claude"),pe.existsSync(Ee.join(t,".cursor/rules"))&&a.push("cursor"),pe.existsSync(Ee.join(t,".windsurf/rules"))&&a.push("windsurf"),pe.existsSync(Ee.join(t,".antigravity/agents"))&&a.push("antigravity"),a.length>0){let{reports:m,hasDrift:y}=a1(t,e,a);if(y)r.push({label:"Agent manifest",status:"fail",message:`drift detected across ${a.join(", ")}`,detail:c1(m)});else{let h=m.map(w=>`${w.editor}:${w.installedCount}`).join(" ");r.push({label:"Agent manifest",status:"ok",message:h})}}let l=u1(t);l.status==="fresh"?r.push({label:"Memory bank",status:"ok",message:"fresh"}):l.status==="never"?r.push({label:"Memory bank",status:"warn",message:"never initialized (run /rcode-init to populate)"}):r.push({label:"Memory bank",status:"warn",message:`STALE \u2014 ${l.reasons[0]}${l.reasons.length>1?` (+${l.reasons.length-1} more)`:""}`});let d=Ee.join(i,"data","intent-table.json");r.push({label:"intent-table.json",status:pe.existsSync(d)?"ok":"warn",message:pe.existsSync(d)?Ee.relative(t,d):"missing \u2014 run `npx @hanzlaa/rcode update` to sync .rcode/data/"});let f=Ee.join(i,"state.json");if(pe.existsSync(f))try{let m=JSON.parse(pe.readFileSync(f,"utf8")),y=ED(m);r.push({label:"Phase state",status:y.length>0?"warn":"ok",message:y.length>0?`${y.length} phase(s) stuck 'executing' while a later phase is complete: ${y.map(h=>h.number).join(", ")}`:"no stuck phases"})}catch(m){r.push({label:"Phase state",status:"warn",message:`state.json unreadable: ${m.message}`})}let g=Ee.join(i,"memory","INDEX.md");if(pe.existsSync(g)){let m=Math.floor((Date.now()-pe.statSync(g).mtimeMs)/864e5);r.push({label:"Memory INDEX.md",status:m>30?"warn":"ok",message:m>30?`STALE \u2014 last updated ${m}d ago (run /rcode-memory-update)`:`fresh \u2014 updated ${m}d ago`})}else r.push({label:"Memory INDEX.md",status:"warn",message:"missing (run /rcode-memory-init)"})}return r}function y1(t){let e=0;for(let r of t){let n=r.status==="ok"?"\u2713":r.status==="warn"?"\u26A0":"\u2717";console.log(` ${n} ${r.label.padEnd(22)} ${r.message}`),r.detail&&console.log(r.detail),r.status==="fail"&&e++}return e}function v1(t){let e=[Ee.join(t,"rcode/skills/agents"),Ee.join(t,"rcode/skills/actions")],r=0,n=0,s=[];for(let i of e){let o=yu(i);for(let a of o){r++;let c=g1(a);if(c.length>0){n++;let u=Ee.relative(t,a);s.push({file:u,missing:c})}}}if(s.length>0){console.log(` \u2717 ${n} / ${r} skills are non-compliant:
353
+ `);for(let i of s)console.log(` ${i.file}`),console.log(` missing: ${i.missing.join(", ")}`)}else console.log(` \u2713 All ${r} skills compliant with 5-component standard`);return n}function _1(t){let e=[Ee.join(t,"rcode/skills/agents"),Ee.join(t,"rcode/skills/actions")],r=0,n=0,s=0,i=0;for(let o of e)for(let a of yu(o)){r++;let{frontmatter:c,body:u}=Du(pe.readFileSync(a,"utf8")),l=f1(c,u),d=Ee.relative(t,a);if(!l.ok){s++,console.log(` \u2717 ${d}`);for(let f of l.errors)console.log(` ${f}`)}if(l.warnings&&l.warnings.length>0){i++;for(let f of l.warnings)console.log(` \u26A0 ${d}: ${f}`)}}for(let o of p1(Ee.join(t,"rcode/agents"))){n++;let{frontmatter:a}=Du(pe.readFileSync(o,"utf8")),c=h1(a);if(!c.ok){s++;let u=Ee.relative(t,o);console.log(` \u2717 ${u}`);for(let l of c.errors)console.log(` ${l}`)}}return console.log(s===0?` \u2713 ${r} skill + ${n} agent frontmatter blocks pass schema validation`+(i>0?` (${i} with advisory warnings)`:""):` \u2717 ${s} artifact(s) failed schema validation`),s}function b1(){let e=require("os").homedir(),r=[],n=[];for(let i of[["npm",["root","-g"]],["pnpm",["root","-g"]]])try{let o=SD(i[0],i[1],{encoding:"utf8"});o.status===0&&o.stdout.trim()&&n.push({manager:i[0],dir:o.stdout.trim()})}catch{}let s=Ee.join(e,".nvm","versions","node");if(pe.existsSync(s))for(let i of pe.readdirSync(s)){let o=Ee.join(s,i,"lib","node_modules");pe.existsSync(o)&&!n.some(a=>a.dir===o)&&n.push({manager:`nvm/${i}`,dir:o})}for(let{manager:i,dir:o}of n)for(let a of["@hanzlaa","@hanzlahabib"]){let c=Ee.join(o,a);if(pe.existsSync(c)){for(let u of pe.readdirSync(c))if(u==="rcode"||u==="rcode"||u.startsWith("rcode")){let l="unknown";try{l=JSON.parse(pe.readFileSync(Ee.join(c,u,"package.json"),"utf8")).version}catch{}r.push({manager:i,scope:a,pkg:u,version:l,dir:Ee.join(c,u)})}}}return{count:r.length,installs:r}}function S1(t){if(t.count===0)return console.log(" \u2713 No global rcode installs found"),0;if(t.count===1){let e=t.installs[0];return console.log(` \u2713 Single global install: [${e.manager}] ${e.scope}/${e.pkg}@${e.version}`),0}console.log(` \u2717 ${t.count} global installs detected \u2014 this causes duplicate slash commands!`);for(let e of t.installs)console.log(` [${e.manager}] ${e.scope}/${e.pkg}@${e.version}`),console.log(` ${e.dir}`);return console.log(`
354
+ Fix: rcode nuke --yes && npm install -g @hanzlaa/rcode`),1}Ho.exports=function(e,{packageRoot:r}){let n=process.cwd();console.log(`
335
355
  \u{1F54C} rcode \u2014 Doctor
336
- `),console.log("Preflight:");let s=SD(n,r),i=m1(s);console.log(`
337
- Duplicate installations:`);let o=y1(),a=v1(o);console.log(`
338
- Package compliance:`);let u=g1(r);console.log(`
339
- Artifact schema validation:`);let c=D1(r),l=i+u+a+c;console.log(),console.log(l===0?"\u2705 All checks passed.":`\u274C ${l} check(s) failed \u2014 see above.`),console.log(),process.exit(l>0?1:0)};Wo.exports.findStuckExecutingPhases=bD;Wo.exports.runPreflight=SD});var vc=v((eT,xD)=>{var Ho=require("fs"),yc=require("path"),CD=["new-project","create-prd","discuss-phase","plan","execute-sprint","verify-phase","retrospective","ship"];xD.exports=function(e,{packageRoot:r}){let n=yc.join(r,"rcode","workflows"),s=e[0];if(!s||s==="list"||s==="--list")return _1(n);if(s==="show"||s==="get"||s==="run"){let i=e[1];return i||(console.error("Usage: rcode workflow show <name>"),console.error(" rcode workflow list"),process.exit(1)),wD(n,i)}return wD(n,s)};function _1(t){let e=Ho.readdirSync(t).filter(s=>s.endsWith(".md")).map(s=>s.replace(/\.md$/,"")).sort(),r=CD.filter(s=>e.includes(s)),n=e.filter(s=>!CD.includes(s));console.log(`\u{1F54C} rcode lifecycle workflows
356
+ `),console.log("Preflight:");let s=CD(n,r),i=y1(s);console.log(`
357
+ Duplicate installations:`);let o=b1(),a=S1(o);console.log(`
358
+ Package compliance:`);let c=v1(r);console.log(`
359
+ Artifact schema validation:`);let u=_1(r),l=i+c+a+u;console.log(),console.log(l===0?"\u2705 All checks passed.":`\u274C ${l} check(s) failed \u2014 see above.`),console.log(),process.exit(l>0?1:0)};Ho.exports.findStuckExecutingPhases=ED;Ho.exports.runPreflight=CD});var _u=v((nT,$D)=>{var Zo=require("fs"),vu=require("path"),xD=["new-project","create-prd","discuss-phase","plan","execute-sprint","verify-phase","retrospective","ship"];$D.exports=function(e,{packageRoot:r}){let n=vu.join(r,"rcode","workflows"),s=e[0];if(!s||s==="list"||s==="--list")return E1(n);if(s==="show"||s==="get"||s==="run"){let i=e[1];return i||(console.error("Usage: rcode workflow show <name>"),console.error(" rcode workflow list"),process.exit(1)),kD(n,i)}return kD(n,s)};function E1(t){let e=Zo.readdirSync(t).filter(s=>s.endsWith(".md")).map(s=>s.replace(/\.md$/,"")).sort(),r=xD.filter(s=>e.includes(s)),n=e.filter(s=>!xD.includes(s));console.log(`\u{1F54C} rcode lifecycle workflows
340
360
  `),console.log("Core lifecycle (in order):"),r.forEach(s=>console.log(` rcode workflow show ${s}`)),n.length&&(console.log(`
341
361
  Other workflows:`),n.forEach(s=>console.log(` rcode workflow show ${s}`))),console.log(`
342
- Usage: rcode workflow show <name> \u2014 print the full workflow instructions`)}function wD(t,e){let r=e.startsWith("rcode-")?e.slice(6):e,n=[yc.join(t,`${r}.md`),yc.join(t,`${e}.md`)];for(let i of n)if(Ho.existsSync(i)){process.stdout.write(Ho.readFileSync(i,"utf8"));return}let s=Ho.readdirSync(t).filter(i=>i.endsWith(".md")).map(i=>i.replace(/\.md$/,"")).sort().join(", ");console.error(`Error: workflow '${e}' not found.`),console.error(`Available: ${s}`),process.exit(1)}});var Sc=v((tT,jD)=>{var ds=require("fs"),Uo=require("path");function b1(t){for(;t!==require("path").parse(t).root;){if(ds.existsSync(Uo.join(t,"package.json")))return t;t=Uo.dirname(t)}throw new Error("Could not find package root")}var S1=b1(__dirname),_c=Uo.join(S1,"rcode/config/model-profiles.json"),Zo=null;function fs(){if(Zo)return Zo;if(!ds.existsSync(_c))throw new Error(`Model profiles not found at ${_c}`);return Zo=JSON.parse(ds.readFileSync(_c,"utf8")),Zo}function $D(){let t=fs();return Object.keys(t.profiles)}function bc(t){let r=fs().profiles[t];if(!r)throw new Error(`Unknown profile '${t}'. Valid: ${$D().join(", ")}`);return r}function Vo(){return fs().default_profile}function AD(){return fs().model_aliases}function FD(t,e={}){let{profile:r=Vo(),overrides:n={}}=e;if(n[t])return kD(n[t]);let i=bc(r).agents[t];if(!i)throw new Error(`Agent '${t}' not mapped in profile '${r}'. Check rcode/config/model-profiles.json.`);return kD(i)}function kD(t){if(t==="inherit")return null;let e=AD();return e[t]!==void 0?e[t]:t}function E1(t){let e=bc(t),r={};for(let n of Object.keys(e.agents))r[n]=FD(n,{profile:t});return r}function C1(t){let e=Object.keys(t);if(e.length===0)return"(empty)";let r=Math.max(5,...e.map(o=>o.length)),n=Math.max(5,...Object.values(t).map(o=>(o??"inherit").length)),s="\u2500".repeat(r+2)+"\u253C"+"\u2500".repeat(n+2),i=" "+"Agent".padEnd(r)+" \u2502 "+"Model".padEnd(n)+`
362
+ Usage: rcode workflow show <name> \u2014 print the full workflow instructions`)}function kD(t,e){let r=e.startsWith("rcode-")?e.slice(6):e,n=[vu.join(t,`${r}.md`),vu.join(t,`${e}.md`)];for(let i of n)if(Zo.existsSync(i)){process.stdout.write(Zo.readFileSync(i,"utf8"));return}let s=Zo.readdirSync(t).filter(i=>i.endsWith(".md")).map(i=>i.replace(/\.md$/,"")).sort().join(", ");console.error(`Error: workflow '${e}' not found.`),console.error(`Available: ${s}`),process.exit(1)}});var Eu=v((sT,TD)=>{var hs=require("fs"),Vo=require("path");function C1(t){for(;t!==require("path").parse(t).root;){if(hs.existsSync(Vo.join(t,"package.json")))return t;t=Vo.dirname(t)}throw new Error("Could not find package root")}var w1=C1(__dirname),bu=Vo.join(w1,"rcode/config/model-profiles.json"),Uo=null;function ps(){if(Uo)return Uo;if(!hs.existsSync(bu))throw new Error(`Model profiles not found at ${bu}`);return Uo=JSON.parse(hs.readFileSync(bu,"utf8")),Uo}function FD(){let t=ps();return Object.keys(t.profiles)}function Su(t){let r=ps().profiles[t];if(!r)throw new Error(`Unknown profile '${t}'. Valid: ${FD().join(", ")}`);return r}function Go(){return ps().default_profile}function jD(){return ps().model_aliases}function ID(t,e={}){let{profile:r=Go(),overrides:n={}}=e;if(n[t])return AD(n[t]);let i=Su(r).agents[t];if(!i)throw new Error(`Agent '${t}' not mapped in profile '${r}'. Check rcode/config/model-profiles.json.`);return AD(i)}function AD(t){if(t==="inherit")return null;let e=jD();return e[t]!==void 0?e[t]:t}function x1(t){let e=Su(t),r={};for(let n of Object.keys(e.agents))r[n]=ID(n,{profile:t});return r}function k1(t){let e=Object.keys(t);if(e.length===0)return"(empty)";let r=Math.max(5,...e.map(o=>o.length)),n=Math.max(5,...Object.values(t).map(o=>(o??"inherit").length)),s="\u2500".repeat(r+2)+"\u253C"+"\u2500".repeat(n+2),i=" "+"Agent".padEnd(r)+" \u2502 "+"Model".padEnd(n)+`
343
363
  `;i+=s+`
344
364
  `;for(let[o,a]of Object.entries(t))i+=" "+o.padEnd(r)+" \u2502 "+(a??"inherit").padEnd(n)+`
345
- `;return i}function w1(t=process.cwd()){let e=Uo.join(t,".rcode","config.json");if(ds.existsSync(e))try{let r=JSON.parse(ds.readFileSync(e,"utf8"));return{profile:r.model_profile||Vo(),overrides:r.model_overrides||{}}}catch{console.warn("Warning: .rcode/config.json is invalid JSON. Using defaults.")}return{profile:Vo(),overrides:{}}}jD.exports={loadProfiles:fs,listProfiles:$D,getProfile:bc,getDefaultProfile:Vo,getModelAliases:AD,resolveModelForAgent:FD,getResolvedMapForProfile:E1,formatMapAsTable:C1,getProjectProfile:w1}});var gs=v((rT,PD)=>{var hs=require("fs"),ps=require("path"),{writeJsonAtomic:Ec}=Kt(),{homedir:x1}=dr(),Cc=1,wc={schema_version:Cc,installed_version:null,project_name:null,user_name:"Team",communication_language:"English",document_output_language:"English",output_folder:".rcode",planning_artifacts:".planning/phases",project_knowledge:".rcode/context",model_profile:"balanced",communication_mode:"guided"},Jo=new Set(["schema_version","installed_version","project_name","user_name","communication_language","document_output_language","output_folder","planning_artifacts","project_knowledge","model_profile","communication_mode"]),k1={profile:"model_profile","model-profile":"model_profile",language:"communication_language",user:"user_name",project:"project_name",output:"output_folder",planning:"planning_artifacts",knowledge:"project_knowledge"},Go=new Set(["quality","balanced","budget","inherit"]),zo=new Set(["guided","yolo"]);function Xo(){return ps.join(x1(),".rcode","defaults.json")}function Ko(t){return ps.join(t,".rcode","config.json")}function ID(t){return ps.join(t,".rcode","config.yaml")}function TD(t){if(!hs.existsSync(t))return null;try{return JSON.parse(hs.readFileSync(t,"utf8"))}catch{return null}}function ms(){return TD(Xo())||{}}var $1={mode:"communication_mode"};function A1(t){if(!hs.existsSync(t))return null;try{let e={};for(let r of hs.readFileSync(t,"utf8").split(`
346
- `)){let n=r.match(/^([a-zA-Z_]+):\s*["']?([^"'\n#]+?)["']?\s*(?:#.*)?$/);if(!n)continue;let s=$1[n[1].trim()]||n[1].trim(),i=n[2].trim();e[s]=i==="true"?!0:i==="false"?!1:i}return Object.keys(e).length?e:null}catch{return null}}function xc(t){let e=TD(Ko(t));return e||A1(ID(t))||{}}function RD(t){let e={...wc};e.project_name===null&&(e.project_name=ps.basename(t));let r=ms(),n=xc(t);return{...e,...r,...n}}function F1(t,e){return Jo.has(e)?RD(t)[e]:void 0}function j1(t,e={}){let r=Ko(t);if(hs.existsSync(r))return!1;let n=ms(),s=o=>e[o]!==void 0?e[o]:n[o]!==void 0?n[o]:wc[o],i={schema_version:Cc,installed_version:e.installed_version||null,project_name:e.project_name||ps.basename(t),user_name:s("user_name"),communication_language:s("communication_language"),document_output_language:s("document_output_language"),output_folder:s("output_folder"),planning_artifacts:s("planning_artifacts"),project_knowledge:s("project_knowledge"),model_profile:s("model_profile")};return Ec(r,i),!0}function I1(t){let r={...ms(),...t};Ec(Xo(),r)}function T1(t,e,r,{scope:n="project"}={}){if(!Jo.has(e)){let a=k1[e.toLowerCase()]||Yo(e,[...Jo]);return{ok:!1,error:`Unknown config key '${e}'`,suggestion:a}}if(e==="model_profile"&&!Go.has(r))return{ok:!1,error:`Invalid model_profile '${r}' (valid: ${[...Go].join(", ")})`,suggestion:Yo(r,[...Go])};if(e==="communication_mode"&&!zo.has(r))return{ok:!1,error:`Invalid communication_mode '${r}' (valid: ${[...zo].join(", ")})`,suggestion:Yo(r,[...zo])};if(e==="schema_version"){let a=Number(r);if(Number.isNaN(a))return{ok:!1,error:"schema_version must be a number"};r=a}let s,i;n==="global"?(s=Xo(),i=ms()):(s=Ko(t),i=xc(t));let o={...i,[e]:r};return Ec(s,o),{ok:!0,scope:n,target:s}}function Yo(t,e){if(!t)return null;let r=t.toLowerCase(),n=null,s=1/0;for(let o of e){let a=R1(r,o.toLowerCase());a<s&&(s=a,n=o)}let i=Math.max(1,Math.floor(t.length/3));return s<=i?n:null}function R1(t,e){if(t===e)return 0;if(!t.length)return e.length;if(!e.length)return t.length;let r=new Array(e.length+1),n=new Array(e.length+1);for(let s=0;s<=e.length;s++)r[s]=s;for(let s=1;s<=t.length;s++){n[0]=s;for(let i=1;i<=e.length;i++){let o=t[s-1]===e[i-1]?0:1;n[i]=Math.min(n[i-1]+1,r[i]+1,r[i-1]+o)}for(let i=0;i<=e.length;i++)r[i]=n[i]}return r[e.length]}PD.exports={SCHEMA_VERSION:Cc,HARDCODED_DEFAULTS:wc,VALID_CONFIG_KEYS:Jo,VALID_MODEL_PROFILES:Go,VALID_COMMUNICATION_MODES:zo,loadConfig:RD,getConfigValue:F1,setConfigValue:T1,initProjectConfig:j1,writeUserDefaults:I1,loadUserDefaults:ms,loadProjectConfig:xc,userLevelPath:Xo,projectLevelPath:Ko,projectYamlPath:ID,suggestClosest:Yo}});var ND=v((nT,OD)=>{var P1=require("fs"),O1=require("path"),{listProfiles:N1,getProfile:L1,getResolvedMapForProfile:B1,formatMapAsTable:M1,getProjectProfile:q1}=Sc(),{setConfigValue:W1,getConfigValue:H1}=gs();OD.exports=function(e){let r=process.cwd(),n=O1.join(r,".rcode");P1.existsSync(n)||(console.error(`\u274C No .rcode/ directory found in ${r}`),console.error(" Run 'rcode install' first."),process.exit(1));let s=e[0],i=N1();if((s==="--help"||s==="-h")&&(console.log("Usage: rcode set-profile [<name>]"),console.log(),console.log(" rcode set-profile show current profile + available options"),console.log(" rcode set-profile <name> switch to profile <name>"),console.log(),console.log(`Available profiles: ${i.join(", ")}`),process.exit(0)),!s){let c=q1(r);if(console.log(`
347
- \u{1F54C} Current profile: ${c.profile}
348
- `),Object.keys(c.overrides).length>0){console.log(" Overrides:");for(let[l,d]of Object.entries(c.overrides))console.log(` ${l} \u2192 ${d}`);console.log()}console.log("Available profiles:");for(let l of i){let d=L1(l),f=l===c.profile?" \u2190 current":"";console.log(` \u2022 ${l}${f}`),console.log(` ${d.description}`)}console.log(`
349
- Usage: rcode set-profile <name>`);return}let o=H1(r,"model_profile")||"(default)",a=W1(r,"model_profile",s);a.ok||(console.error(`\u274C ${a.error}`),a.suggestion&&console.error(` Did you mean '${a.suggestion}'?`),console.error(` Available: ${i.join(", ")}`),process.exit(1)),console.log(`
365
+ `;return i}function $1(t=process.cwd()){let e=Vo.join(t,".rcode","config.json");if(hs.existsSync(e))try{let r=JSON.parse(hs.readFileSync(e,"utf8"));return{profile:r.model_profile||Go(),overrides:r.model_overrides||{}}}catch{console.warn("Warning: .rcode/config.json is invalid JSON. Using defaults.")}return{profile:Go(),overrides:{}}}TD.exports={loadProfiles:ps,listProfiles:FD,getProfile:Su,getDefaultProfile:Go,getModelAliases:jD,resolveModelForAgent:ID,getResolvedMapForProfile:x1,formatMapAsTable:k1,getProjectProfile:$1}});var ys=v((oT,ND)=>{var ms=require("fs"),gs=require("path"),{writeJsonAtomic:Cu}=Qt(),{homedir:A1}=hr(),wu=1,xu={schema_version:wu,installed_version:null,project_name:null,user_name:"Team",communication_language:"English",document_output_language:"English",output_folder:".rcode",planning_artifacts:".planning/phases",project_knowledge:".rcode/context",model_profile:"balanced",communication_mode:"guided"},Xo=new Set(["schema_version","installed_version","project_name","user_name","communication_language","document_output_language","output_folder","planning_artifacts","project_knowledge","model_profile","communication_mode"]),F1={profile:"model_profile","model-profile":"model_profile",language:"communication_language",user:"user_name",project:"project_name",output:"output_folder",planning:"planning_artifacts",knowledge:"project_knowledge"},zo=new Set(["quality","balanced","budget","inherit"]),Yo=new Set(["guided","yolo"]);function Ko(){return gs.join(A1(),".rcode","defaults.json")}function Qo(t){return gs.join(t,".rcode","config.json")}function RD(t){return gs.join(t,".rcode","config.yaml")}function PD(t){if(!ms.existsSync(t))return null;try{return JSON.parse(ms.readFileSync(t,"utf8"))}catch{return null}}function Ds(){return PD(Ko())||{}}var j1={mode:"communication_mode"};function I1(t){if(!ms.existsSync(t))return null;try{let e={};for(let r of ms.readFileSync(t,"utf8").split(`
366
+ `)){let n=r.match(/^([a-zA-Z_]+):\s*["']?([^"'\n#]+?)["']?\s*(?:#.*)?$/);if(!n)continue;let s=j1[n[1].trim()]||n[1].trim(),i=n[2].trim();e[s]=i==="true"?!0:i==="false"?!1:i}return Object.keys(e).length?e:null}catch{return null}}function ku(t){let e=PD(Qo(t));return e||I1(RD(t))||{}}function OD(t){let e={...xu};e.project_name===null&&(e.project_name=gs.basename(t));let r=Ds(),n=ku(t);return{...e,...r,...n}}function T1(t,e){return Xo.has(e)?OD(t)[e]:void 0}function R1(t,e={}){let r=Qo(t);if(ms.existsSync(r))return!1;let n=Ds(),s=o=>e[o]!==void 0?e[o]:n[o]!==void 0?n[o]:xu[o],i={schema_version:wu,installed_version:e.installed_version||null,project_name:e.project_name||gs.basename(t),user_name:s("user_name"),communication_language:s("communication_language"),document_output_language:s("document_output_language"),output_folder:s("output_folder"),planning_artifacts:s("planning_artifacts"),project_knowledge:s("project_knowledge"),model_profile:s("model_profile")};return Cu(r,i),!0}function P1(t){let r={...Ds(),...t};Cu(Ko(),r)}function O1(t,e,r,{scope:n="project"}={}){if(!Xo.has(e)){let a=F1[e.toLowerCase()]||Jo(e,[...Xo]);return{ok:!1,error:`Unknown config key '${e}'`,suggestion:a}}if(e==="model_profile"&&!zo.has(r))return{ok:!1,error:`Invalid model_profile '${r}' (valid: ${[...zo].join(", ")})`,suggestion:Jo(r,[...zo])};if(e==="communication_mode"&&!Yo.has(r))return{ok:!1,error:`Invalid communication_mode '${r}' (valid: ${[...Yo].join(", ")})`,suggestion:Jo(r,[...Yo])};if(e==="schema_version"){let a=Number(r);if(Number.isNaN(a))return{ok:!1,error:"schema_version must be a number"};r=a}let s,i;n==="global"?(s=Ko(),i=Ds()):(s=Qo(t),i=ku(t));let o={...i,[e]:r};return Cu(s,o),{ok:!0,scope:n,target:s}}function Jo(t,e){if(!t)return null;let r=t.toLowerCase(),n=null,s=1/0;for(let o of e){let a=N1(r,o.toLowerCase());a<s&&(s=a,n=o)}let i=Math.max(1,Math.floor(t.length/3));return s<=i?n:null}function N1(t,e){if(t===e)return 0;if(!t.length)return e.length;if(!e.length)return t.length;let r=new Array(e.length+1),n=new Array(e.length+1);for(let s=0;s<=e.length;s++)r[s]=s;for(let s=1;s<=t.length;s++){n[0]=s;for(let i=1;i<=e.length;i++){let o=t[s-1]===e[i-1]?0:1;n[i]=Math.min(n[i-1]+1,r[i]+1,r[i-1]+o)}for(let i=0;i<=e.length;i++)r[i]=n[i]}return r[e.length]}ND.exports={SCHEMA_VERSION:wu,HARDCODED_DEFAULTS:xu,VALID_CONFIG_KEYS:Xo,VALID_MODEL_PROFILES:zo,VALID_COMMUNICATION_MODES:Yo,loadConfig:OD,getConfigValue:T1,setConfigValue:O1,initProjectConfig:R1,writeUserDefaults:P1,loadUserDefaults:Ds,loadProjectConfig:ku,userLevelPath:Ko,projectLevelPath:Qo,projectYamlPath:RD,suggestClosest:Jo}});var BD=v((iT,LD)=>{var L1=require("fs"),B1=require("path"),{listProfiles:M1,getProfile:q1,getResolvedMapForProfile:W1,formatMapAsTable:H1,getProjectProfile:Z1}=Eu(),{setConfigValue:U1,getConfigValue:V1}=ys();LD.exports=function(e){let r=process.cwd(),n=B1.join(r,".rcode");L1.existsSync(n)||(console.error(`\u274C No .rcode/ directory found in ${r}`),console.error(" Run 'rcode install' first."),process.exit(1));let s=e[0],i=M1();if((s==="--help"||s==="-h")&&(console.log("Usage: rcode set-profile [<name>]"),console.log(),console.log(" rcode set-profile show current profile + available options"),console.log(" rcode set-profile <name> switch to profile <name>"),console.log(),console.log(`Available profiles: ${i.join(", ")}`),process.exit(0)),!s){let u=Z1(r);if(console.log(`
367
+ \u{1F54C} Current profile: ${u.profile}
368
+ `),Object.keys(u.overrides).length>0){console.log(" Overrides:");for(let[l,d]of Object.entries(u.overrides))console.log(` ${l} \u2192 ${d}`);console.log()}console.log("Available profiles:");for(let l of i){let d=q1(l),f=l===u.profile?" \u2190 current":"";console.log(` \u2022 ${l}${f}`),console.log(` ${d.description}`)}console.log(`
369
+ Usage: rcode set-profile <name>`);return}let o=V1(r,"model_profile")||"(default)",a=U1(r,"model_profile",s);a.ok||(console.error(`\u274C ${a.error}`),a.suggestion&&console.error(` Did you mean '${a.suggestion}'?`),console.error(` Available: ${i.join(", ")}`),process.exit(1)),console.log(`
350
370
  \u2705 Profile changed: ${o} \u2192 ${s}
351
- `);let u=B1(s);console.log(M1(u)),console.log()}});var qD=v((sT,MD)=>{var Z1=require("fs"),U1=require("path"),{loadConfig:LD,setConfigValue:V1,VALID_COMMUNICATION_MODES:kc}=gs(),BD={guided:`Ask questions, confirm at every major gate, halt at decision menus.
371
+ `);let c=W1(s);console.log(H1(c)),console.log()}});var HD=v((aT,WD)=>{var G1=require("fs"),z1=require("path"),{loadConfig:MD,setConfigValue:Y1,VALID_COMMUNICATION_MODES:$u}=ys(),qD={guided:`Ask questions, confirm at every major gate, halt at decision menus.
352
372
  Recommended for: first-time use, critical projects, new domains.`,yolo:`Skip menus, use sensible defaults, report decisions in the final summary.
353
373
  Destructive ops (github push, rm, force-push) STILL require
354
374
  explicit confirmation unless you also pass --force-yolo.
355
- Recommended for: experienced solo projects, prototypes, CI.`};MD.exports=function(e){let r=process.cwd(),n=U1.join(r,".rcode");Z1.existsSync(n)||(console.error(`\u274C No .rcode/ directory found in ${r}`),console.error(" Run 'rcode install' first."),process.exit(1));let s=e[0];if((s==="--help"||s==="-h")&&(console.log("Usage: rcode set-mode [<mode>]"),console.log(),console.log(" rcode set-mode show current mode + explanation"),console.log(" rcode set-mode <mode> switch to mode <mode>"),console.log(),console.log(`Available modes: ${[...kc].join(", ")}`),process.exit(0)),!s){let u=LD(r).communication_mode||"guided";console.log(`
356
- \u{1F54C} Communication mode: ${u}
357
- `);for(let c of kc)console.log(` \u2022 ${c}${c===u?" \u2190 current":""}`),console.log(` ${BD[c]}`),console.log();console.log(`Usage: rcode set-mode <${[...kc].join("|")}>`),console.log();return}let i=LD(r).communication_mode||"guided",o=V1(r,"communication_mode",s);o.ok||(console.error(`
375
+ Recommended for: experienced solo projects, prototypes, CI.`};WD.exports=function(e){let r=process.cwd(),n=z1.join(r,".rcode");G1.existsSync(n)||(console.error(`\u274C No .rcode/ directory found in ${r}`),console.error(" Run 'rcode install' first."),process.exit(1));let s=e[0];if((s==="--help"||s==="-h")&&(console.log("Usage: rcode set-mode [<mode>]"),console.log(),console.log(" rcode set-mode show current mode + explanation"),console.log(" rcode set-mode <mode> switch to mode <mode>"),console.log(),console.log(`Available modes: ${[...$u].join(", ")}`),process.exit(0)),!s){let c=MD(r).communication_mode||"guided";console.log(`
376
+ \u{1F54C} Communication mode: ${c}
377
+ `);for(let u of $u)console.log(` \u2022 ${u}${u===c?" \u2190 current":""}`),console.log(` ${qD[u]}`),console.log();console.log(`Usage: rcode set-mode <${[...$u].join("|")}>`),console.log();return}let i=MD(r).communication_mode||"guided",o=Y1(r,"communication_mode",s);o.ok||(console.error(`
358
378
  \u274C ${o.error}`),o.suggestion&&console.error(` Did you mean '${o.suggestion}'?`),console.error(),process.exit(1)),console.log(`
359
- \u2705 Communication mode: ${i} \u2192 ${s}`),console.log(),console.log(` ${BD[s]}`),console.log(),s==="yolo"&&(console.log(" \u26A0 Note: destructive operations (github-sync, uninstall,"),console.log(" force push) still require explicit confirmation unless"),console.log(" --force-yolo / --yes is passed."),console.log())}});var GD=v((iT,VD)=>{var WD=require("fs"),HD=require("path"),{loadConfig:G1,loadUserDefaults:z1,loadProjectConfig:Y1,setConfigValue:J1,getConfigValue:X1,VALID_CONFIG_KEYS:$c,HARDCODED_DEFAULTS:oT,userLevelPath:ZD,projectLevelPath:UD}=gs();function K1(t){let e={global:!1,list:!1,positional:[]};for(let r of t)r==="--global"||r==="-g"?e.global=!0:r==="--list"||r==="-l"?e.list=!0:e.positional.push(r);return e}function Q1(t,e){let r=Y1(t);if(e in r)return"project";let n=z1();return e in n?"user":"default"}function eF(t){let e=G1(t),r=[...$c],n=Math.max(...r.map(i=>i.length)),s=Math.max(...r.map(i=>String(e[i]??"").length),5);console.log(`
379
+ \u2705 Communication mode: ${i} \u2192 ${s}`),console.log(),console.log(` ${qD[s]}`),console.log(),s==="yolo"&&(console.log(" \u26A0 Note: destructive operations (github-sync, uninstall,"),console.log(" force push) still require explicit confirmation unless"),console.log(" --force-yolo / --yes is passed."),console.log())}});var YD=v((uT,zD)=>{var ZD=require("fs"),UD=require("path"),{loadConfig:J1,loadUserDefaults:X1,loadProjectConfig:K1,setConfigValue:Q1,getConfigValue:eF,VALID_CONFIG_KEYS:Au,HARDCODED_DEFAULTS:cT,userLevelPath:VD,projectLevelPath:GD}=ys();function tF(t){let e={global:!1,list:!1,positional:[]};for(let r of t)r==="--global"||r==="-g"?e.global=!0:r==="--list"||r==="-l"?e.list=!0:e.positional.push(r);return e}function rF(t,e){let r=K1(t);if(e in r)return"project";let n=X1();return e in n?"user":"default"}function nF(t){let e=J1(t),r=[...Au],n=Math.max(...r.map(i=>i.length)),s=Math.max(...r.map(i=>String(e[i]??"").length),5);console.log(`
360
380
  \u{1F54C} rcode \u2014 configuration
361
- `),console.log(` Project: ${UD(t)}`),console.log(` User: ${ZD()}
362
- `),console.log(` ${"key".padEnd(n)} ${"value".padEnd(s)} source`),console.log(` ${"-".repeat(n)} ${"-".repeat(s)} ------`);for(let i of r){let o=e[i],a=Q1(t,i);console.log(` ${i.padEnd(n)} ${String(o??"").padEnd(s)} ${a}`)}console.log()}VD.exports=function(e){let r=process.cwd(),n=K1(e);if(n.positional.length===0||n.list){let s=HD.join(r,".rcode");!WD.existsSync(s)&&!n.global&&(console.error(`\u274C No .rcode/ directory found in ${r}`),console.error(" Run 'rcode install' first, or use --global to manage user defaults."),process.exit(1)),eF(r);return}if(n.positional.length===1){let s=n.positional[0];$c.has(s)||(console.error(`\u274C Unknown config key '${s}'`),console.error(` Valid keys: ${[...$c].join(", ")}`),process.exit(1));let i=X1(r,s);console.log(i??"");return}if(n.positional.length===2){let[s,i]=n.positional,o=n.global?"global":"project";o==="project"&&!WD.existsSync(HD.join(r,".rcode"))&&(console.error(`\u274C No .rcode/ directory found in ${r}`),console.error(" Run 'rcode install' first, or use --global."),process.exit(1));let a=J1(r,s,i,{scope:o});a.ok||(console.error(`\u274C ${a.error}`),a.suggestion&&console.error(` Did you mean '${a.suggestion}'?`),process.exit(1));let u=o==="global"?ZD():UD(r);console.log(`\u2705 ${s} = ${i} (${o}: ${u})`);return}console.error("\u274C Too many arguments."),console.error(" Usage: rcode config [--global] [key] [value]"),process.exit(1)}});var XD=v((uT,JD)=>{var cn=require("fs"),Qo=require("path"),{computeFingerprint:aT,writeFingerprint:tF,checkStaleness:zD,commitsBetween:rF,STALE_THRESHOLDS:nF}=mc();function sF(t){let e={check:!1,refresh:!1,installHook:!1};for(let r of t)r==="--check"?e.check=!0:r==="--refresh"?e.refresh=!0:r==="--install-hook"?e.installHook=!0:(console.error(`Unknown flag: ${r}`),console.error("Usage: rcode context [--check|--refresh|--install-hook]"),process.exit(1));return e}function YD(t){cn.existsSync(Qo.join(t,".rcode"))||(console.error(`\u274C No .rcode/ directory found in ${t}`),console.error(" Run 'rcode install' first."),process.exit(1))}function oF(t){let e=zD(t),r=e.status==="fresh"?"\u2713":e.status==="stale"?"\u26A0":"\u2717",n=e.status.toUpperCase();if(console.log(`
381
+ `),console.log(` Project: ${GD(t)}`),console.log(` User: ${VD()}
382
+ `),console.log(` ${"key".padEnd(n)} ${"value".padEnd(s)} source`),console.log(` ${"-".repeat(n)} ${"-".repeat(s)} ------`);for(let i of r){let o=e[i],a=rF(t,i);console.log(` ${i.padEnd(n)} ${String(o??"").padEnd(s)} ${a}`)}console.log()}zD.exports=function(e){let r=process.cwd(),n=tF(e);if(n.positional.length===0||n.list){let s=UD.join(r,".rcode");!ZD.existsSync(s)&&!n.global&&(console.error(`\u274C No .rcode/ directory found in ${r}`),console.error(" Run 'rcode install' first, or use --global to manage user defaults."),process.exit(1)),nF(r);return}if(n.positional.length===1){let s=n.positional[0];Au.has(s)||(console.error(`\u274C Unknown config key '${s}'`),console.error(` Valid keys: ${[...Au].join(", ")}`),process.exit(1));let i=eF(r,s);console.log(i??"");return}if(n.positional.length===2){let[s,i]=n.positional,o=n.global?"global":"project";o==="project"&&!ZD.existsSync(UD.join(r,".rcode"))&&(console.error(`\u274C No .rcode/ directory found in ${r}`),console.error(" Run 'rcode install' first, or use --global."),process.exit(1));let a=Q1(r,s,i,{scope:o});a.ok||(console.error(`\u274C ${a.error}`),a.suggestion&&console.error(` Did you mean '${a.suggestion}'?`),process.exit(1));let c=o==="global"?VD():GD(r);console.log(`\u2705 ${s} = ${i} (${o}: ${c})`);return}console.error("\u274C Too many arguments."),console.error(" Usage: rcode config [--global] [key] [value]"),process.exit(1)}});var QD=v((dT,KD)=>{var dn=require("fs"),ei=require("path"),{computeFingerprint:lT,writeFingerprint:sF,checkStaleness:JD,commitsBetween:oF,STALE_THRESHOLDS:iF}=gu();function aF(t){let e={check:!1,refresh:!1,installHook:!1};for(let r of t)r==="--check"?e.check=!0:r==="--refresh"?e.refresh=!0:r==="--install-hook"?e.installHook=!0:(console.error(`Unknown flag: ${r}`),console.error("Usage: rcode context [--check|--refresh|--install-hook]"),process.exit(1));return e}function XD(t){dn.existsSync(ei.join(t,".rcode"))||(console.error(`\u274C No .rcode/ directory found in ${t}`),console.error(" Run 'rcode install' first."),process.exit(1))}function cF(t){let e=JD(t),r=e.status==="fresh"?"\u2713":e.status==="stale"?"\u26A0":"\u2717",n=e.status.toUpperCase();if(console.log(`
363
383
  \u{1F9E0} Memory bank status: ${r} ${n}
364
- `),e.reasons.length>0){console.log(" Reasons:");for(let o of e.reasons)console.log(` \u2022 ${o}`);console.log()}console.log(" Context files:");let s=e.context_files.active?"\u2713":"\u2717",i=e.context_files.brief?"\u2713":"\u2717";if(console.log(` ${s} .rcode/context/active.md`),console.log(` ${i} .rcode/context/project-brief.md`),console.log(),e.stored){if(console.log(` Last init: ${e.stored.timestamp||"unknown"}`),e.stored.git_head){let o=e.stored.git_head.slice(0,7),a=e.stored.git_branch||"detached";console.log(` ${o} on ${a}`)}e.stored.manifest_name&&console.log(` ${e.stored.manifest_name} (${e.stored.manifest_hash})`)}else console.log(" Last init: (never)");if(console.log(` Current: ${e.current.timestamp}`),e.current.git_head){let o=e.current.git_head.slice(0,7),a=e.current.git_branch||"detached";console.log(` ${o} on ${a}`)}if(e.current.manifest_name&&console.log(` ${e.current.manifest_name} (${e.current.manifest_hash})`),e.stored?.git_head&&e.current.git_head){let o=rF(t,e.stored.git_head,e.current.git_head);o!==null&&console.log(`
365
- Commits since init: ${o} (threshold: ${nF.commitsSinceInit})`)}console.log(),e.status!=="fresh"&&(console.log(" \u27A1 Refresh with: /rcode-init (in your editor)"),console.log())}function iF(t){YD(t);let e=tF(t);console.log(`
366
- \u2705 Fingerprint saved to .rcode/state.json`),console.log(` git: ${e.git_head?e.git_head.slice(0,7):"(no git)"}`),console.log(` manifest: ${e.manifest_name||"(none)"}`),console.log(` structure: ${e.structure_dirs.length} top-level dirs`),console.log()}function aF(t){let e=Qo.join(t,".git");cn.existsSync(e)||(console.error("\u274C Not a git repository (no .git/ found)."),console.error(" The post-commit hook requires git."),process.exit(1));let r=Qo.join(e,"hooks");cn.mkdirSync(r,{recursive:!0});let n=Qo.join(r,"post-commit"),s=`#!/bin/sh
384
+ `),e.reasons.length>0){console.log(" Reasons:");for(let o of e.reasons)console.log(` \u2022 ${o}`);console.log()}console.log(" Context files:");let s=e.context_files.active?"\u2713":"\u2717",i=e.context_files.brief?"\u2713":"\u2717";if(console.log(` ${s} .rcode/context/active.md`),console.log(` ${i} .rcode/context/project-brief.md`),console.log(),e.stored){if(console.log(` Last init: ${e.stored.timestamp||"unknown"}`),e.stored.git_head){let o=e.stored.git_head.slice(0,7),a=e.stored.git_branch||"detached";console.log(` ${o} on ${a}`)}e.stored.manifest_name&&console.log(` ${e.stored.manifest_name} (${e.stored.manifest_hash})`)}else console.log(" Last init: (never)");if(console.log(` Current: ${e.current.timestamp}`),e.current.git_head){let o=e.current.git_head.slice(0,7),a=e.current.git_branch||"detached";console.log(` ${o} on ${a}`)}if(e.current.manifest_name&&console.log(` ${e.current.manifest_name} (${e.current.manifest_hash})`),e.stored?.git_head&&e.current.git_head){let o=oF(t,e.stored.git_head,e.current.git_head);o!==null&&console.log(`
385
+ Commits since init: ${o} (threshold: ${iF.commitsSinceInit})`)}console.log(),e.status!=="fresh"&&(console.log(" \u27A1 Refresh with: /rcode-init (in your editor)"),console.log())}function uF(t){XD(t);let e=sF(t);console.log(`
386
+ \u2705 Fingerprint saved to .rcode/state.json`),console.log(` git: ${e.git_head?e.git_head.slice(0,7):"(no git)"}`),console.log(` manifest: ${e.manifest_name||"(none)"}`),console.log(` structure: ${e.structure_dirs.length} top-level dirs`),console.log()}function lF(t){let e=ei.join(t,".git");dn.existsSync(e)||(console.error("\u274C Not a git repository (no .git/ found)."),console.error(" The post-commit hook requires git."),process.exit(1));let r=ei.join(e,"hooks");dn.mkdirSync(r,{recursive:!0});let n=ei.join(r,"post-commit"),s=`#!/bin/sh
367
387
  # rcode \u2014 memory bank freshness check
368
388
  # Installed by: rcode context --install-hook
369
389
  # Non-blocking: prints a one-line warning if the memory bank is stale.
@@ -375,39 +395,39 @@ if command -v rcode >/dev/null 2>&1; then
375
395
  echo " $(echo "$output" | grep '\u2022' | head -1 | sed 's/^ *//')"
376
396
  fi
377
397
  fi
378
- `;if(cn.existsSync(n)){if(cn.readFileSync(n,"utf8").includes("rcode \u2014 memory bank freshness")){console.log(`\u2713 post-commit hook already installed at ${n}`);return}console.error(`\u274C A post-commit hook already exists at ${n}`),console.error(" Refusing to overwrite. Merge manually or remove the existing hook first."),process.exit(1)}cn.writeFileSync(n,s),cn.chmodSync(n,493),console.log(`\u2705 Installed post-commit hook at ${n}`),console.log(" After each commit, you'll see a warning if the memory bank goes stale."),console.log(` To remove: rm ${n}`)}JD.exports=function(e){let r=process.cwd(),n=sF(e);if(n.installHook){aF(r);return}if(n.refresh){iF(r);return}YD(r),oF(r),n.check&&zD(r).status!=="fresh"&&process.exit(1)}});var ty=v((cT,ey)=>{var{listProfiles:KD,getProfile:uF,resolveModelForAgent:QD,getResolvedMapForProfile:cF,formatMapAsTable:lF,getProjectProfile:dF}=Sc();function fF(t){let e={agent:null,profile:null};for(let r of t)r.startsWith("--profile=")?e.profile=r.slice(10):r.startsWith("--agent=")?e.agent=r.slice(8):r.startsWith("--")||(e.agent=r);return e}ey.exports=function(e){let r=fF(e),n=dF(),s=r.profile||n.profile;KD().includes(s)||(console.error(`\u274C Unknown profile '${s}'`),console.error(` Available: ${KD().join(", ")}`),process.exit(1));let i=uF(s);if(r.agent){try{let a=QD(r.agent,{profile:s,overrides:r.profile?{}:n.overrides});console.log(`${r.agent} (profile: ${s}) \u2192 ${a??"inherit (runtime picks)"}`)}catch(a){console.error(`\u274C ${a.message}`),process.exit(1)}return}console.log(`
398
+ `;if(dn.existsSync(n)){if(dn.readFileSync(n,"utf8").includes("rcode \u2014 memory bank freshness")){console.log(`\u2713 post-commit hook already installed at ${n}`);return}console.error(`\u274C A post-commit hook already exists at ${n}`),console.error(" Refusing to overwrite. Merge manually or remove the existing hook first."),process.exit(1)}dn.writeFileSync(n,s),dn.chmodSync(n,493),console.log(`\u2705 Installed post-commit hook at ${n}`),console.log(" After each commit, you'll see a warning if the memory bank goes stale."),console.log(` To remove: rm ${n}`)}KD.exports=function(e){let r=process.cwd(),n=aF(e);if(n.installHook){lF(r);return}if(n.refresh){uF(r);return}XD(r),cF(r),n.check&&JD(r).status!=="fresh"&&process.exit(1)}});var ny=v((fT,ry)=>{var{listProfiles:ey,getProfile:dF,resolveModelForAgent:ty,getResolvedMapForProfile:fF,formatMapAsTable:hF,getProjectProfile:pF}=Eu();function mF(t){let e={agent:null,profile:null};for(let r of t)r.startsWith("--profile=")?e.profile=r.slice(10):r.startsWith("--agent=")?e.agent=r.slice(8):r.startsWith("--")||(e.agent=r);return e}ry.exports=function(e){let r=mF(e),n=pF(),s=r.profile||n.profile;ey().includes(s)||(console.error(`\u274C Unknown profile '${s}'`),console.error(` Available: ${ey().join(", ")}`),process.exit(1));let i=dF(s);if(r.agent){try{let a=ty(r.agent,{profile:s,overrides:r.profile?{}:n.overrides});console.log(`${r.agent} (profile: ${s}) \u2192 ${a??"inherit (runtime picks)"}`)}catch(a){console.error(`\u274C ${a.message}`),process.exit(1)}return}console.log(`
379
399
  \u{1F54C} Profile: ${s}`),console.log(` ${i.description}
380
- `);let o=cF(s);if(!r.profile&&Object.keys(n.overrides).length>0){console.log(" Overrides applied:");for(let[a,u]of Object.entries(n.overrides)){let c=QD(a,{profile:s,overrides:n.overrides});o[a]=c,console.log(` ${a} \u2192 ${u} (resolved: ${c??"inherit"})`)}console.log()}console.log(lF(o))}});var sy=v((dT,ny)=>{var{execSync:lT,spawnSync:ry}=require("child_process");function hF(t){return t?t.replace(/\b(ghp_|ghs_|github_pat_)[A-Za-z0-9_]{10,}\b/g,"[REDACTED]").slice(0,2e3):""}function Ke(t,{input:e=null,allowFailure:r=!1}={}){let n=ry("gh",t,{encoding:"utf8",input:e,stdio:e?["pipe","pipe","pipe"]:["ignore","pipe","pipe"]});if(n.status!==0&&!r){let s=hF(n.stderr||n.stdout||"(no output)");throw new Error(`gh ${t.join(" ")} failed:
381
- ${s}`)}return{status:n.status,stdout:n.stdout||"",stderr:n.stderr||""}}function pF(){try{let t=Ke(["auth","status"],{allowFailure:!0});if(t.status!==0)return{authenticated:!1,error:t.stderr};let e=(t.stderr+t.stdout).match(/Logged in to github\.com account (\S+)/);return{authenticated:!0,account:e?e[1]:"unknown"}}catch(t){return{authenticated:!1,error:t.message}}}function mF(t=process.cwd()){try{let e=ry("gh",["repo","view","--json","owner,name,nameWithOwner,url"],{cwd:t,encoding:"utf8"});return e.status!==0?null:JSON.parse(e.stdout)}catch{return null}}function gF(t,e,r,{execute:n=!1,dryRun:s=!0}={}){if(s||!n)return console.log(` [dry-run] would ensure label: ${t} (${e})`),{dryRun:!0};let i=Ke(["label","list","--search",t,"--json","name"],{allowFailure:!0});if(i.status===0){let u;try{u=JSON.parse(i.stdout||"[]")}catch{u=[]}if(u.some(c=>c.name===t))return{existed:!0,name:t}}let o=["label","create",t,"--color",e];r&&o.push("--description",r);let a=Ke(o,{allowFailure:!0});return{created:a.status===0,name:t,error:a.status!==0?a.stderr:null}}function DF(t,e,r,{execute:n=!1,dryRun:s=!0,repo:i=null}={}){if(s||!n)return console.log(` [dry-run] would create milestone: "${t}"`),{dryRun:!0,title:t};let a=["api","--method","POST",`${i?`/repos/${i}`:"/repos/{owner}/{repo}"}/milestones`,"-f",`title=${t}`,"-f",`description=${e||""}`,"-f","state=open"];r&&a.push("-f",`due_on=${r}`);let u=Ke(a,{allowFailure:!0});if(u.status!==0)return{error:u.stderr};let c;try{c=JSON.parse(u.stdout)}catch{return{error:"failed to parse milestone response"}}return{created:!0,number:c.number,id:c.id,title:c.title,url:c.html_url}}function yF(t,{repo:e=null}={}){let r=["issue","view",String(t),"--json","number,title,body,labels,milestone,state,url"];e&&r.push("--repo",e);let n=Ke(r,{allowFailure:!0});if(n.status!==0)return{error:n.stderr};try{return JSON.parse(n.stdout)}catch{return{error:"failed to parse issue response"}}}function vF({title:t,body:e,labels:r=[],milestone:n=null,assignees:s=[]},{execute:i=!1,dryRun:o=!0,repo:a=null}={}){if(o||!i)return console.log(` [dry-run] would create issue: "${t}" (labels: ${r.join(",")})`),{dryRun:!0,title:t};let u=["issue","create","--title",t,"--body",e||""];for(let f of r)u.push("--label",f);n&&u.push("--milestone",String(n));for(let f of s)u.push("--assignee",f);a&&u.push("--repo",a);let c=Ke(u,{allowFailure:!0});if(c.status!==0)return{error:c.stderr};let l=c.stdout.trim(),d=l.match(/\/issues\/(\d+)/);return{created:!0,url:l,number:d?parseInt(d[1],10):null}}function _F(t,{title:e,body:r,addLabels:n,removeLabels:s,milestone:i,state:o},{execute:a=!1,dryRun:u=!0,repo:c=null}={}){if(u||!a){let f=[];return e!==void 0&&f.push("title"),r!==void 0&&f.push("body"),n&&n.length&&f.push(`+labels:${n.join(",")}`),s&&s.length&&f.push(`-labels:${s.join(",")}`),i!==void 0&&f.push("milestone"),o!==void 0&&f.push(`state:${o}`),console.log(` [dry-run] would update issue #${t} (${f.join(", ")})`),{dryRun:!0,number:t}}let l=[],d=["issue","edit",String(t)];if(c&&d.push("--repo",c),e!==void 0&&d.push("--title",e),r!==void 0&&d.push("--body",r),i!==void 0&&(i===null?d.push("--remove-milestone"):d.push("--milestone",String(i))),n&&n.length)for(let f of n)d.push("--add-label",f);if(s&&s.length)for(let f of s)d.push("--remove-label",f);if(d.length>3+(c?2:0)){let f=Ke(d,{allowFailure:!0});f.status!==0&&l.push(`edit: ${f.stderr}`)}if(o==="closed"){let f=["issue","close",String(t)];c&&f.push("--repo",c);let g=Ke(f,{allowFailure:!0});g.status!==0&&l.push(`close: ${g.stderr}`)}else if(o==="open"){let f=["issue","reopen",String(t)];c&&f.push("--repo",c);let g=Ke(f,{allowFailure:!0});g.status!==0&&l.push(`reopen: ${g.stderr}`)}return l.length>0?{error:l.join("; ")}:{updated:!0,number:t}}function bF(t,{title:e,description:r,state:n,dueDate:s},{execute:i=!1,dryRun:o=!0,repo:a=null}={}){if(o||!i)return console.log(` [dry-run] would update milestone #${t}`),{dryRun:!0,number:t};let c=["api","--method","PATCH",`${a?`/repos/${a}`:"/repos/{owner}/{repo}"}/milestones/${t}`];e!==void 0&&c.push("-f",`title=${e}`),r!==void 0&&c.push("-f",`description=${r}`),n!==void 0&&c.push("-f",`state=${n}`),s!==void 0&&(s===null?c.push("-f","due_on="):c.push("-f",`due_on=${s}`));let l=Ke(c,{allowFailure:!0});return l.status!==0?{error:l.stderr}:{updated:!0,number:t}}function SF(t,{execute:e=!0}={}){let r=Ke(["project","list","--owner",t,"--format","json"],{allowFailure:!0});if(r.status!==0)return null;try{return JSON.parse(r.stdout)}catch{return null}}function EF(t,e,{execute:r=!1,dryRun:n=!0}={}){if(n||!r)return console.log(` [dry-run] would create Project v2: "${e}" (owner: ${t})`),{dryRun:!0,title:e};let s=Ke(["project","create","--owner",t,"--title",e,"--format","json"],{allowFailure:!0});if(s.status!==0)return{error:s.stderr};try{return JSON.parse(s.stdout)}catch{return{error:"failed to parse project response"}}}function CF(t,e,r,{execute:n=!1,dryRun:s=!0}={}){if(s||!n)return console.log(` [dry-run] would add ${r} to project ${t}`),{dryRun:!0};let i=Ke(["project","item-add","--owner",e,String(t),"--url",r,"--format","json"],{allowFailure:!0});if(i.status!==0)return{error:i.stderr};try{return JSON.parse(i.stdout)}catch{return{error:"failed to parse project item response"}}}function wF(){try{let t=Ke(["api","rate_limit"],{allowFailure:!0});return t.status!==0?null:JSON.parse(t.stdout)}catch{return null}}ny.exports={runGh:Ke,checkAuth:pF,detectRepo:mF,ensureLabel:gF,createMilestone:DF,updateMilestone:bF,getIssue:yF,createIssue:vF,updateIssue:_F,listProjects:SF,createProject:EF,addIssueToProject:CF,getRateLimit:wF}});var cy=v((fT,uy)=>{var Jt=require("fs"),ln=require("path");function oy(t){let e=t.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!e)return{};let r={};for(let n of e[1].split(/\r?\n/)){let s=n.match(/^([\w_-]+)\s*:\s*(.*)$/);s&&(r[s[1].trim()]=s[2].trim().replace(/^["']|["']$/g,""))}return r}function Ac(t){let e=t.match(/^#\s+(.+)$/m);return e?e[1].trim():null}function xF(t,e,r,n){let s=[],i=/<task\b([^>]*)>([\s\S]*?)<\/task>/g,o,a=0;for(;o=i.exec(t);){a+=1;let u=o[1].match(/id="([^"]+)"/),c=o[1].match(/title="([^"]*)"/),l=o[2].match(/<title>([\s\S]*?)<\/title>/);s.push({id:u?u[1]:`${e}-task-${a}`,file:r,content:o[0],title:c&&c[1].trim()||l&&l[1].trim()||`Task ${a}`,parentEpic:null,sprintId:e,frontmatter:{},sourcePath:`${n}/${r}`})}if(s.length===0){let u=/^#{2,4}\s+(?:Story|Task)\s+([^\s—–-]+)\s*[—–-]\s*(.+?)\s*$/gm,c;for(;c=u.exec(t);)s.push({id:c[1].trim(),file:r,content:c[0],title:c[2].trim(),parentEpic:null,sprintId:e,frontmatter:{},sourcePath:`${n}/${r}`})}return s}function iy(t){let e=ln.join(t,".planning","phases");if(!Jt.existsSync(e))return[];let r=[];for(let n of Jt.readdirSync(e,{withFileTypes:!0})){if(!n.isDirectory())continue;let s=n.name.match(/^(\d+)-/),i=s?s[1]:null,o=ln.join(e,n.name),a=`.planning/phases/${n.name}`,u=Jt.readdirSync(o).filter(l=>/-SPRINT\.md$/i.test(l)).sort((l,d)=>{let f=parseInt((l.match(/-(\d+)-SPRINT\.md$/i)||[])[1]||"0",10),g=parseInt((d.match(/-(\d+)-SPRINT\.md$/i)||[])[1]||"0",10);return f-g}),c=[];for(let l of u){let d=Jt.readFileSync(ln.join(o,l),"utf8"),f=l.match(/^(\d+)-(\d+)-SPRINT\.md$/i),g;f?g=`${parseInt(f[1],10)}.${parseInt(f[2],10)}`:g=oy(d).sprint||l.replace(/-SPRINT\.md$/i,""),c.push(...xF(d,g,l,a))}r.push({id:n.name,numericId:i,brief:null,sprints:null,sprintMap:{},stories:c,epics:[],noMilestone:!1})}return r}function ay(t){let e=ln.join(t,".planning","epics");if(!Jt.existsSync(e))return null;let r=[],n=Jt.readdirSync(e).filter(o=>/^EPIC-\d+\.md$/i.test(o));for(let o of n){let a=Jt.readFileSync(ln.join(e,o),"utf8"),u=o.match(/(\d+)/),c=u?parseInt(u[1],10):null,l=o.replace(/\.md$/i,"");r.push({id:l,file:o,epicNumber:c,content:a,title:Ac(a)||l,frontmatter:{},sourcePath:`.planning/epics/${o}`})}let s=[],i=ln.join(e,"stories");if(Jt.existsSync(i)){let o=Jt.readdirSync(i).filter(a=>/^[\d.]+\.md$/.test(a));for(let a of o){let u=Jt.readFileSync(ln.join(i,a),"utf8"),c=a.replace(/\.md$/i,""),l=u.match(/\*\*Epic:\*\*\s*EPIC-(\d+)/i),d=null;if(l){let f=parseInt(l[1],10),g=r.find(m=>m.epicNumber===f);g&&(d=g.id)}s.push({id:c,file:a,content:u,title:Ac(u)||c,parentEpic:d,sprintId:null,frontmatter:{},sourcePath:`.planning/epics/stories/${a}`})}}return r.length===0&&s.length===0?null:{id:"epics",numericId:null,brief:null,sprints:null,sprintMap:{},stories:s,epics:r,noMilestone:!0}}function kF(t){let e=iy(t),r=ay(t);return r&&e.push(r),e}function $F(t,e){if(!e.sprint&&!e.epic&&!e.story)return t;let r=t.map(n=>({...n,epics:[...n.epics],stories:[...n.stories]}));if(e.sprint){let n=e.sprint.replace(/-/g,".");for(let s of r){s.stories=s.stories.filter(o=>o.sprintId===e.sprint||o.sprintId===n);let i=new Set(s.stories.map(o=>o.parentEpic).filter(Boolean));s.epics=s.epics.filter(o=>i.has(o.id))}}if(e.epic)for(let n of r)n.epics=n.epics.filter(s=>s.id===e.epic),n.stories=n.stories.filter(s=>s.parentEpic===e.epic);if(e.story)for(let n of r){n.stories=n.stories.filter(i=>i.id===e.story);let s=new Set(n.stories.map(i=>i.parentEpic).filter(Boolean));n.epics=n.epics.filter(i=>s.has(i.id))}return r.filter(n=>n.epics.length>0||n.stories.length>0)}uy.exports={extractFrontmatter:oy,extractTitle:Ac,discoverSprintTrackPhases:iy,discoverEpicTrackPhase:ay,discoverPhases:kF,applyGranularFilters:$F}});var dy=v((hT,ly)=>{var ei=require("fs"),Fc=require("path"),AF=require("crypto"),Pt=sy(),{askText:FF,PromptAbortError:jF}=as(),{writeJsonAtomic:IF}=Kt(),{loadConfig:TF}=gs(),{discoverPhases:RF,applyGranularFilters:PF}=cy();function Rn(t){return AF.createHash("sha256").update(t||"").digest("hex").slice(0,12)}function OF(t){let e={execute:!1,dryRun:!0,repo:null,only:null,phase:null,sprint:null,epic:null,story:null,withLabels:!1,createProject:!1,yes:!1,forceYolo:!1,updateBody:!0,updateLabels:!0,updateMilestone:!0,updateState:!0};for(let r of t)r==="--execute"||r==="-e"?(e.execute=!0,e.dryRun=!1):r==="--dry-run"?(e.dryRun=!0,e.execute=!1):r==="--yes"||r==="-y"?e.yes=!0:r==="--force-yolo"?e.forceYolo=!0:r==="--with-labels"?e.withLabels=!0:r==="--project"?e.createProject=!0:r==="--no-update"?(e.updateBody=!1,e.updateLabels=!1,e.updateMilestone=!1,e.updateState=!1):r==="--no-update-body"?e.updateBody=!1:r==="--no-update-labels"?e.updateLabels=!1:r==="--no-close"?e.updateState=!1:r.startsWith("--repo=")?e.repo=r.slice(7):r.startsWith("--only=")?e.only=r.slice(7):r.startsWith("--phase=")?e.phase=r.slice(8):r.startsWith("--sprint=")?e.sprint=r.slice(9):r.startsWith("--epic=")?e.epic=r.slice(7):r.startsWith("--story=")&&(e.story=r.slice(8));return e.updateEnabled=e.updateBody||e.updateLabels||e.updateMilestone||e.updateState,e}function NF(t){let e=Fc.join(t,".rcode/state.json");if(!ei.existsSync(e))return null;try{return JSON.parse(ei.readFileSync(e,"utf8"))}catch{return null}}function LF(t){let e=Fc.join(t,".rcode/integrations/github-map.json");if(!ei.existsSync(e))return{phases:{},epics:{},stories:{},project:null,labels:[]};try{return JSON.parse(ei.readFileSync(e,"utf8"))}catch{return{phases:{},epics:{},stories:{},project:null,labels:[]}}}function Ds(t,e){let r=Fc.join(t,".rcode/integrations/github-map.json");IF(r,e)}function Pe(t,e){return`${t}:${e}`}async function BF(t){let e=OF(t),r=process.cwd(),s=TF(r).communication_mode||"guided";console.log(`
382
- \u{1F54C} rcode \u2014 GitHub Sync`),console.log(` Mode: ${e.dryRun?"DRY-RUN (preview only, nothing is sent)":"EXECUTE"}`),console.log(` Comms mode: ${s}`),console.log(` Scope: ${e.only||"full (create + update existing)"}`),console.log(` Labels: ${e.withLabels?"will create/ensure taxonomy":"skipped (pass --with-labels to enable)"}`),e.updateEnabled||console.log(" Note: --no-update passed \u2192 create-only mode"),e.phase&&console.log(` Phase filter: ${e.phase}`),e.sprint&&console.log(` Sprint filter: ${e.sprint}`),e.epic&&console.log(` Epic filter: ${e.epic}`),e.story&&console.log(` Story filter: ${e.story}`),console.log();let i=Pt.checkAuth();i.authenticated||(console.error("\u274C gh CLI not authenticated."),console.error(" Run: gh auth login"),console.error(` Error: ${i.error||"unknown"}`),process.exit(1)),console.log(` \u2713 Authenticated as ${i.account}`);let o=e.repo;if(!o){let h=Pt.detectRepo(r);h||(console.error("\u274C Could not detect GitHub repo. Run from a git repo or pass --repo=owner/name"),process.exit(1)),o=h.nameWithOwner}console.log(` \u2713 Target repo: ${o}`);let a=NF(r);a||(console.error("\u274C No .rcode/state.json found. Run 'rcode install' first."),process.exit(1)),console.log(` \u2713 Project: ${a.project_name||"(unnamed)"}`);let u=RF(r);if(e.phase&&(u=u.filter(h=>h.id===e.phase||h.numericId===e.phase),u.length===0&&(console.error(`\u274C Phase '${e.phase}' not found.`),process.exit(1))),u=PF(u,e),u.length===0){if(e.sprint||e.epic||e.story){let h=e.sprint?`sprint '${e.sprint}'`:e.epic?`epic '${e.epic}'`:`story '${e.story}'`;console.error(`\u274C No items matched ${h}.`),console.error(" Check the filter value or run without filters to see available ids."),process.exit(1)}console.log("\u2139 No phases found in .planning/phases/ or epics in .planning/epics/ \u2014 nothing to sync."),console.log(" Run /rcode-plan or /rcode-create-epics-and-stories to get started."),process.exit(0)}console.log(` \u2713 Phases found: ${u.length}`);for(let h of u)console.log(` - ${h.id} (${h.epics.length} epics, ${h.stories.length} stories)`);let c=LF(r),l={phases:Object.keys(c.phases).length,epics:Object.keys(c.epics).length,stories:Object.keys(c.stories).length};l.phases+l.epics+l.stories>0&&console.log(` \u2139 Existing sync map: ${l.phases} phases, ${l.epics} epics, ${l.stories} stories`);let d={labels:e.withLabels?[{name:"epic",color:"6f42c1",description:"Strategic initiative spanning multiple sprints"},{name:"type:feature",color:"0e8a16",description:"New functionality"},{name:"type:task",color:"c5def5",description:"Development work"},{name:"type:bug",color:"d73a4a",description:"Something is broken"},{name:"type:docs",color:"0075ca",description:"Documentation"},{name:"priority:critical",color:"b60205",description:"Drop everything"},{name:"priority:high",color:"d93f0b",description:"Important for sprint"},{name:"priority:medium",color:"fbca04",description:"Standard priority"},{name:"priority:low",color:"0e8a16",description:"Nice to have"},{name:"status:backlog",color:"c5def5",description:"Not started"},{name:"status:todo",color:"0075ca",description:"Ready to start"},{name:"status:in-progress",color:"fbca04",description:"Currently working"},{name:"status:blocked",color:"d73a4a",description:"Cannot progress"},{name:"status:review",color:"6f42c1",description:"Code review needed"},{name:"status:done",color:"0e8a16",description:"Completed"},{name:"FE",color:"1e3a8a",description:"Frontend"},{name:"BE",color:"0e8a16",description:"Backend"},{name:"ML",color:"6f42c1",description:"Machine Learning"},{name:"API",color:"0075ca",description:"API / Backend services"},{name:"Design",color:"f59e0b",description:"UI/UX design work"},{name:"DevOps",color:"fbca04",description:"Infrastructure and deployment"},{name:"QA",color:"d73a4a",description:"Quality assurance"},{name:"Docs",color:"c5def5",description:"Documentation"}]:[],milestones:u.filter(h=>!h.noMilestone&&!c.phases[h.id]),epics:u.flatMap(h=>h.epics.filter(w=>!c.epics[Pe(h.id,w.id)]).map(w=>({...w,phase:h.id}))),stories:u.flatMap(h=>h.stories.filter(w=>!c.stories[Pe(h.id,w.id)]).map(w=>({...w,phase:h.id}))),updateEpics:e.updateEnabled?u.flatMap(h=>h.epics.filter(w=>c.epics[Pe(h.id,w.id)]).map(w=>({...w,phase:h.id,issueNumber:c.epics[Pe(h.id,w.id)].issue_number,lastSyncedAt:c.epics[Pe(h.id,w.id)].synced_at,lastSyncedContentHash:c.epics[Pe(h.id,w.id)].content_hash}))):[],updateStories:e.updateEnabled?u.flatMap(h=>h.stories.filter(w=>c.stories[Pe(h.id,w.id)]).map(w=>({...w,phase:h.id,issueNumber:c.stories[Pe(h.id,w.id)].issue_number,lastSyncedAt:c.stories[Pe(h.id,w.id)].synced_at,lastSyncedContentHash:c.stories[Pe(h.id,w.id)].content_hash}))):[]};console.log(`
383
- \u{1F4CB} Plan:`),e.withLabels&&(!e.only||e.only==="labels")&&console.log(` Labels to ensure: ${d.labels.length}`),(!e.only||e.only==="milestones")&&console.log(` Milestones to create: ${d.milestones.length}`),(!e.only||e.only==="epics")&&console.log(` Epics to create: ${d.epics.length}`),(!e.only||e.only==="stories")&&console.log(` Stories to create: ${d.stories.length}`),e.updateEnabled&&((!e.only||e.only==="epics")&&console.log(` Epics to check: ${d.updateEpics.length} (existing, will update if changed)`),(!e.only||e.only==="stories")&&console.log(` Stories to check: ${d.updateStories.length} (existing, will update if changed)`)),e.createProject&&console.log(` Project v2: will create "${a.project_name||o}"`),console.log();let f=s==="yolo"&&e.yes&&!e.forceYolo;if(e.execute&&(!e.yes||f)){f&&(console.log("\u26A0\uFE0F communication_mode=yolo does not auto-confirm GitHub mutations."),console.log(" Pass --force-yolo to skip this prompt, or answer interactively below."),console.log()),console.log(`\u26A0\uFE0F This will modify ${o} on GitHub.`);let h=d.labels.length+d.milestones.length+d.epics.length+d.stories.length;console.log(` Items to create: ${h}`),(e.sprint||e.epic||e.story)&&console.log(` Granular filter: ${e.sprint||e.epic||e.story}`),console.log();let w=await FF(" Proceed? Type 'yes' to continue: ",{default:"no",validate:C=>{let A=C.toLowerCase();return["yes","y","no","n"].includes(A)?!0:"Please type 'yes' to confirm, or 'no' to abort."}});["yes","y"].includes(w.toLowerCase())||(console.log(`
400
+ `);let o=fF(s);if(!r.profile&&Object.keys(n.overrides).length>0){console.log(" Overrides applied:");for(let[a,c]of Object.entries(n.overrides)){let u=ty(a,{profile:s,overrides:n.overrides});o[a]=u,console.log(` ${a} \u2192 ${c} (resolved: ${u??"inherit"})`)}console.log()}console.log(hF(o))}});var iy=v((pT,oy)=>{var{execSync:hT,spawnSync:sy}=require("child_process");function gF(t){return t?t.replace(/\b(ghp_|ghs_|github_pat_)[A-Za-z0-9_]{10,}\b/g,"[REDACTED]").slice(0,2e3):""}function et(t,{input:e=null,allowFailure:r=!1}={}){let n=sy("gh",t,{encoding:"utf8",input:e,stdio:e?["pipe","pipe","pipe"]:["ignore","pipe","pipe"]});if(n.status!==0&&!r){let s=gF(n.stderr||n.stdout||"(no output)");throw new Error(`gh ${t.join(" ")} failed:
401
+ ${s}`)}return{status:n.status,stdout:n.stdout||"",stderr:n.stderr||""}}function DF(){try{let t=et(["auth","status"],{allowFailure:!0});if(t.status!==0)return{authenticated:!1,error:t.stderr};let e=(t.stderr+t.stdout).match(/Logged in to github\.com account (\S+)/);return{authenticated:!0,account:e?e[1]:"unknown"}}catch(t){return{authenticated:!1,error:t.message}}}function yF(t=process.cwd()){try{let e=sy("gh",["repo","view","--json","owner,name,nameWithOwner,url"],{cwd:t,encoding:"utf8"});return e.status!==0?null:JSON.parse(e.stdout)}catch{return null}}function vF(t,e,r,{execute:n=!1,dryRun:s=!0}={}){if(s||!n)return console.log(` [dry-run] would ensure label: ${t} (${e})`),{dryRun:!0};let i=et(["label","list","--search",t,"--json","name"],{allowFailure:!0});if(i.status===0){let c;try{c=JSON.parse(i.stdout||"[]")}catch{c=[]}if(c.some(u=>u.name===t))return{existed:!0,name:t}}let o=["label","create",t,"--color",e];r&&o.push("--description",r);let a=et(o,{allowFailure:!0});return{created:a.status===0,name:t,error:a.status!==0?a.stderr:null}}function _F(t,e,r,{execute:n=!1,dryRun:s=!0,repo:i=null}={}){if(s||!n)return console.log(` [dry-run] would create milestone: "${t}"`),{dryRun:!0,title:t};let a=["api","--method","POST",`${i?`/repos/${i}`:"/repos/{owner}/{repo}"}/milestones`,"-f",`title=${t}`,"-f",`description=${e||""}`,"-f","state=open"];r&&a.push("-f",`due_on=${r}`);let c=et(a,{allowFailure:!0});if(c.status!==0)return{error:c.stderr};let u;try{u=JSON.parse(c.stdout)}catch{return{error:"failed to parse milestone response"}}return{created:!0,number:u.number,id:u.id,title:u.title,url:u.html_url}}function bF(t,{repo:e=null}={}){let r=["issue","view",String(t),"--json","number,title,body,labels,milestone,state,url"];e&&r.push("--repo",e);let n=et(r,{allowFailure:!0});if(n.status!==0)return{error:n.stderr};try{return JSON.parse(n.stdout)}catch{return{error:"failed to parse issue response"}}}function SF({title:t,body:e,labels:r=[],milestone:n=null,assignees:s=[]},{execute:i=!1,dryRun:o=!0,repo:a=null}={}){if(o||!i)return console.log(` [dry-run] would create issue: "${t}" (labels: ${r.join(",")})`),{dryRun:!0,title:t};let c=["issue","create","--title",t,"--body",e||""];for(let f of r)c.push("--label",f);n&&c.push("--milestone",String(n));for(let f of s)c.push("--assignee",f);a&&c.push("--repo",a);let u=et(c,{allowFailure:!0});if(u.status!==0)return{error:u.stderr};let l=u.stdout.trim(),d=l.match(/\/issues\/(\d+)/);return{created:!0,url:l,number:d?parseInt(d[1],10):null}}function EF(t,{title:e,body:r,addLabels:n,removeLabels:s,milestone:i,state:o},{execute:a=!1,dryRun:c=!0,repo:u=null}={}){if(c||!a){let f=[];return e!==void 0&&f.push("title"),r!==void 0&&f.push("body"),n&&n.length&&f.push(`+labels:${n.join(",")}`),s&&s.length&&f.push(`-labels:${s.join(",")}`),i!==void 0&&f.push("milestone"),o!==void 0&&f.push(`state:${o}`),console.log(` [dry-run] would update issue #${t} (${f.join(", ")})`),{dryRun:!0,number:t}}let l=[],d=["issue","edit",String(t)];if(u&&d.push("--repo",u),e!==void 0&&d.push("--title",e),r!==void 0&&d.push("--body",r),i!==void 0&&(i===null?d.push("--remove-milestone"):d.push("--milestone",String(i))),n&&n.length)for(let f of n)d.push("--add-label",f);if(s&&s.length)for(let f of s)d.push("--remove-label",f);if(d.length>3+(u?2:0)){let f=et(d,{allowFailure:!0});f.status!==0&&l.push(`edit: ${f.stderr}`)}if(o==="closed"){let f=["issue","close",String(t)];u&&f.push("--repo",u);let g=et(f,{allowFailure:!0});g.status!==0&&l.push(`close: ${g.stderr}`)}else if(o==="open"){let f=["issue","reopen",String(t)];u&&f.push("--repo",u);let g=et(f,{allowFailure:!0});g.status!==0&&l.push(`reopen: ${g.stderr}`)}return l.length>0?{error:l.join("; ")}:{updated:!0,number:t}}function CF(t,{title:e,description:r,state:n,dueDate:s},{execute:i=!1,dryRun:o=!0,repo:a=null}={}){if(o||!i)return console.log(` [dry-run] would update milestone #${t}`),{dryRun:!0,number:t};let u=["api","--method","PATCH",`${a?`/repos/${a}`:"/repos/{owner}/{repo}"}/milestones/${t}`];e!==void 0&&u.push("-f",`title=${e}`),r!==void 0&&u.push("-f",`description=${r}`),n!==void 0&&u.push("-f",`state=${n}`),s!==void 0&&(s===null?u.push("-f","due_on="):u.push("-f",`due_on=${s}`));let l=et(u,{allowFailure:!0});return l.status!==0?{error:l.stderr}:{updated:!0,number:t}}function wF(t,{execute:e=!0}={}){let r=et(["project","list","--owner",t,"--format","json"],{allowFailure:!0});if(r.status!==0)return null;try{return JSON.parse(r.stdout)}catch{return null}}function xF(t,e,{execute:r=!1,dryRun:n=!0}={}){if(n||!r)return console.log(` [dry-run] would create Project v2: "${e}" (owner: ${t})`),{dryRun:!0,title:e};let s=et(["project","create","--owner",t,"--title",e,"--format","json"],{allowFailure:!0});if(s.status!==0)return{error:s.stderr};try{return JSON.parse(s.stdout)}catch{return{error:"failed to parse project response"}}}function kF(t,e,r,{execute:n=!1,dryRun:s=!0}={}){if(s||!n)return console.log(` [dry-run] would add ${r} to project ${t}`),{dryRun:!0};let i=et(["project","item-add","--owner",e,String(t),"--url",r,"--format","json"],{allowFailure:!0});if(i.status!==0)return{error:i.stderr};try{return JSON.parse(i.stdout)}catch{return{error:"failed to parse project item response"}}}function $F(){try{let t=et(["api","rate_limit"],{allowFailure:!0});return t.status!==0?null:JSON.parse(t.stdout)}catch{return null}}oy.exports={runGh:et,checkAuth:DF,detectRepo:yF,ensureLabel:vF,createMilestone:_F,updateMilestone:CF,getIssue:bF,createIssue:SF,updateIssue:EF,listProjects:wF,createProject:xF,addIssueToProject:kF,getRateLimit:$F}});var dy=v((mT,ly)=>{var Xt=require("fs"),fn=require("path");function ay(t){let e=t.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!e)return{};let r={};for(let n of e[1].split(/\r?\n/)){let s=n.match(/^([\w_-]+)\s*:\s*(.*)$/);s&&(r[s[1].trim()]=s[2].trim().replace(/^["']|["']$/g,""))}return r}function Fu(t){let e=t.match(/^#\s+(.+)$/m);return e?e[1].trim():null}function AF(t,e,r,n){let s=[],i=/<task\b([^>]*)>([\s\S]*?)<\/task>/g,o,a=0;for(;o=i.exec(t);){a+=1;let c=o[1].match(/id="([^"]+)"/),u=o[1].match(/title="([^"]*)"/),l=o[2].match(/<title>([\s\S]*?)<\/title>/);s.push({id:c?c[1]:`${e}-task-${a}`,file:r,content:o[0],title:u&&u[1].trim()||l&&l[1].trim()||`Task ${a}`,parentEpic:null,sprintId:e,frontmatter:{},sourcePath:`${n}/${r}`})}if(s.length===0){let c=/^#{2,4}\s+(?:Story|Task)\s+([^\s—–-]+)\s*[—–-]\s*(.+?)\s*$/gm,u;for(;u=c.exec(t);)s.push({id:u[1].trim(),file:r,content:u[0],title:u[2].trim(),parentEpic:null,sprintId:e,frontmatter:{},sourcePath:`${n}/${r}`})}return s}function cy(t){let e=fn.join(t,".planning","phases");if(!Xt.existsSync(e))return[];let r=[];for(let n of Xt.readdirSync(e,{withFileTypes:!0})){if(!n.isDirectory())continue;let s=n.name.match(/^(\d+)-/),i=s?s[1]:null,o=fn.join(e,n.name),a=`.planning/phases/${n.name}`,c=Xt.readdirSync(o).filter(l=>/-SPRINT\.md$/i.test(l)).sort((l,d)=>{let f=parseInt((l.match(/-(\d+)-SPRINT\.md$/i)||[])[1]||"0",10),g=parseInt((d.match(/-(\d+)-SPRINT\.md$/i)||[])[1]||"0",10);return f-g}),u=[];for(let l of c){let d=Xt.readFileSync(fn.join(o,l),"utf8"),f=l.match(/^(\d+)-(\d+)-SPRINT\.md$/i),g;f?g=`${parseInt(f[1],10)}.${parseInt(f[2],10)}`:g=ay(d).sprint||l.replace(/-SPRINT\.md$/i,""),u.push(...AF(d,g,l,a))}r.push({id:n.name,numericId:i,brief:null,sprints:null,sprintMap:{},stories:u,epics:[],noMilestone:!1})}return r}function uy(t){let e=fn.join(t,".planning","epics");if(!Xt.existsSync(e))return null;let r=[],n=Xt.readdirSync(e).filter(o=>/^EPIC-\d+\.md$/i.test(o));for(let o of n){let a=Xt.readFileSync(fn.join(e,o),"utf8"),c=o.match(/(\d+)/),u=c?parseInt(c[1],10):null,l=o.replace(/\.md$/i,"");r.push({id:l,file:o,epicNumber:u,content:a,title:Fu(a)||l,frontmatter:{},sourcePath:`.planning/epics/${o}`})}let s=[],i=fn.join(e,"stories");if(Xt.existsSync(i)){let o=Xt.readdirSync(i).filter(a=>/^[\d.]+\.md$/.test(a));for(let a of o){let c=Xt.readFileSync(fn.join(i,a),"utf8"),u=a.replace(/\.md$/i,""),l=c.match(/\*\*Epic:\*\*\s*EPIC-(\d+)/i),d=null;if(l){let f=parseInt(l[1],10),g=r.find(m=>m.epicNumber===f);g&&(d=g.id)}s.push({id:u,file:a,content:c,title:Fu(c)||u,parentEpic:d,sprintId:null,frontmatter:{},sourcePath:`.planning/epics/stories/${a}`})}}return r.length===0&&s.length===0?null:{id:"epics",numericId:null,brief:null,sprints:null,sprintMap:{},stories:s,epics:r,noMilestone:!0}}function FF(t){let e=cy(t),r=uy(t);return r&&e.push(r),e}function jF(t,e){if(!e.sprint&&!e.epic&&!e.story)return t;let r=t.map(n=>({...n,epics:[...n.epics],stories:[...n.stories]}));if(e.sprint){let n=e.sprint.replace(/-/g,".");for(let s of r){s.stories=s.stories.filter(o=>o.sprintId===e.sprint||o.sprintId===n);let i=new Set(s.stories.map(o=>o.parentEpic).filter(Boolean));s.epics=s.epics.filter(o=>i.has(o.id))}}if(e.epic)for(let n of r)n.epics=n.epics.filter(s=>s.id===e.epic),n.stories=n.stories.filter(s=>s.parentEpic===e.epic);if(e.story)for(let n of r){n.stories=n.stories.filter(i=>i.id===e.story);let s=new Set(n.stories.map(i=>i.parentEpic).filter(Boolean));n.epics=n.epics.filter(i=>s.has(i.id))}return r.filter(n=>n.epics.length>0||n.stories.length>0)}ly.exports={extractFrontmatter:ay,extractTitle:Fu,discoverSprintTrackPhases:cy,discoverEpicTrackPhase:uy,discoverPhases:FF,applyGranularFilters:jF}});var hy=v((gT,fy)=>{var ti=require("fs"),ju=require("path"),IF=require("crypto"),Ot=iy(),{askText:TF,PromptAbortError:RF}=us(),{writeJsonAtomic:PF}=Qt(),{loadConfig:OF}=ys(),{discoverPhases:NF,applyGranularFilters:LF}=dy();function On(t){return IF.createHash("sha256").update(t||"").digest("hex").slice(0,12)}function BF(t){let e={execute:!1,dryRun:!0,repo:null,only:null,phase:null,sprint:null,epic:null,story:null,withLabels:!1,createProject:!1,yes:!1,forceYolo:!1,updateBody:!0,updateLabels:!0,updateMilestone:!0,updateState:!0};for(let r of t)r==="--execute"||r==="-e"?(e.execute=!0,e.dryRun=!1):r==="--dry-run"?(e.dryRun=!0,e.execute=!1):r==="--yes"||r==="-y"?e.yes=!0:r==="--force-yolo"?e.forceYolo=!0:r==="--with-labels"?e.withLabels=!0:r==="--project"?e.createProject=!0:r==="--no-update"?(e.updateBody=!1,e.updateLabels=!1,e.updateMilestone=!1,e.updateState=!1):r==="--no-update-body"?e.updateBody=!1:r==="--no-update-labels"?e.updateLabels=!1:r==="--no-close"?e.updateState=!1:r.startsWith("--repo=")?e.repo=r.slice(7):r.startsWith("--only=")?e.only=r.slice(7):r.startsWith("--phase=")?e.phase=r.slice(8):r.startsWith("--sprint=")?e.sprint=r.slice(9):r.startsWith("--epic=")?e.epic=r.slice(7):r.startsWith("--story=")&&(e.story=r.slice(8));return e.updateEnabled=e.updateBody||e.updateLabels||e.updateMilestone||e.updateState,e}function MF(t){let e=ju.join(t,".rcode/state.json");if(!ti.existsSync(e))return null;try{return JSON.parse(ti.readFileSync(e,"utf8"))}catch{return null}}function qF(t){let e=ju.join(t,".rcode/integrations/github-map.json");if(!ti.existsSync(e))return{phases:{},epics:{},stories:{},project:null,labels:[]};try{return JSON.parse(ti.readFileSync(e,"utf8"))}catch{return{phases:{},epics:{},stories:{},project:null,labels:[]}}}function vs(t,e){let r=ju.join(t,".rcode/integrations/github-map.json");PF(r,e)}function Ne(t,e){return`${t}:${e}`}async function WF(t){let e=BF(t),r=process.cwd(),s=OF(r).communication_mode||"guided";console.log(`
402
+ \u{1F54C} rcode \u2014 GitHub Sync`),console.log(` Mode: ${e.dryRun?"DRY-RUN (preview only, nothing is sent)":"EXECUTE"}`),console.log(` Comms mode: ${s}`),console.log(` Scope: ${e.only||"full (create + update existing)"}`),console.log(` Labels: ${e.withLabels?"will create/ensure taxonomy":"skipped (pass --with-labels to enable)"}`),e.updateEnabled||console.log(" Note: --no-update passed \u2192 create-only mode"),e.phase&&console.log(` Phase filter: ${e.phase}`),e.sprint&&console.log(` Sprint filter: ${e.sprint}`),e.epic&&console.log(` Epic filter: ${e.epic}`),e.story&&console.log(` Story filter: ${e.story}`),console.log();let i=Ot.checkAuth();i.authenticated||(console.error("\u274C gh CLI not authenticated."),console.error(" Run: gh auth login"),console.error(` Error: ${i.error||"unknown"}`),process.exit(1)),console.log(` \u2713 Authenticated as ${i.account}`);let o=e.repo;if(!o){let h=Ot.detectRepo(r);h||(console.error("\u274C Could not detect GitHub repo. Run from a git repo or pass --repo=owner/name"),process.exit(1)),o=h.nameWithOwner}console.log(` \u2713 Target repo: ${o}`);let a=MF(r);a||(console.error("\u274C No .rcode/state.json found. Run 'rcode install' first."),process.exit(1)),console.log(` \u2713 Project: ${a.project_name||"(unnamed)"}`);let c=NF(r);if(e.phase&&(c=c.filter(h=>h.id===e.phase||h.numericId===e.phase),c.length===0&&(console.error(`\u274C Phase '${e.phase}' not found.`),process.exit(1))),c=LF(c,e),c.length===0){if(e.sprint||e.epic||e.story){let h=e.sprint?`sprint '${e.sprint}'`:e.epic?`epic '${e.epic}'`:`story '${e.story}'`;console.error(`\u274C No items matched ${h}.`),console.error(" Check the filter value or run without filters to see available ids."),process.exit(1)}console.log("\u2139 No phases found in .planning/phases/ or epics in .planning/epics/ \u2014 nothing to sync."),console.log(" Run /rcode-plan or /rcode-create-epics-and-stories to get started."),process.exit(0)}console.log(` \u2713 Phases found: ${c.length}`);for(let h of c)console.log(` - ${h.id} (${h.epics.length} epics, ${h.stories.length} stories)`);let u=qF(r),l={phases:Object.keys(u.phases).length,epics:Object.keys(u.epics).length,stories:Object.keys(u.stories).length};l.phases+l.epics+l.stories>0&&console.log(` \u2139 Existing sync map: ${l.phases} phases, ${l.epics} epics, ${l.stories} stories`);let d={labels:e.withLabels?[{name:"epic",color:"6f42c1",description:"Strategic initiative spanning multiple sprints"},{name:"type:feature",color:"0e8a16",description:"New functionality"},{name:"type:task",color:"c5def5",description:"Development work"},{name:"type:bug",color:"d73a4a",description:"Something is broken"},{name:"type:docs",color:"0075ca",description:"Documentation"},{name:"priority:critical",color:"b60205",description:"Drop everything"},{name:"priority:high",color:"d93f0b",description:"Important for sprint"},{name:"priority:medium",color:"fbca04",description:"Standard priority"},{name:"priority:low",color:"0e8a16",description:"Nice to have"},{name:"status:backlog",color:"c5def5",description:"Not started"},{name:"status:todo",color:"0075ca",description:"Ready to start"},{name:"status:in-progress",color:"fbca04",description:"Currently working"},{name:"status:blocked",color:"d73a4a",description:"Cannot progress"},{name:"status:review",color:"6f42c1",description:"Code review needed"},{name:"status:done",color:"0e8a16",description:"Completed"},{name:"FE",color:"1e3a8a",description:"Frontend"},{name:"BE",color:"0e8a16",description:"Backend"},{name:"ML",color:"6f42c1",description:"Machine Learning"},{name:"API",color:"0075ca",description:"API / Backend services"},{name:"Design",color:"f59e0b",description:"UI/UX design work"},{name:"DevOps",color:"fbca04",description:"Infrastructure and deployment"},{name:"QA",color:"d73a4a",description:"Quality assurance"},{name:"Docs",color:"c5def5",description:"Documentation"}]:[],milestones:c.filter(h=>!h.noMilestone&&!u.phases[h.id]),epics:c.flatMap(h=>h.epics.filter(w=>!u.epics[Ne(h.id,w.id)]).map(w=>({...w,phase:h.id}))),stories:c.flatMap(h=>h.stories.filter(w=>!u.stories[Ne(h.id,w.id)]).map(w=>({...w,phase:h.id}))),updateEpics:e.updateEnabled?c.flatMap(h=>h.epics.filter(w=>u.epics[Ne(h.id,w.id)]).map(w=>({...w,phase:h.id,issueNumber:u.epics[Ne(h.id,w.id)].issue_number,lastSyncedAt:u.epics[Ne(h.id,w.id)].synced_at,lastSyncedContentHash:u.epics[Ne(h.id,w.id)].content_hash}))):[],updateStories:e.updateEnabled?c.flatMap(h=>h.stories.filter(w=>u.stories[Ne(h.id,w.id)]).map(w=>({...w,phase:h.id,issueNumber:u.stories[Ne(h.id,w.id)].issue_number,lastSyncedAt:u.stories[Ne(h.id,w.id)].synced_at,lastSyncedContentHash:u.stories[Ne(h.id,w.id)].content_hash}))):[]};console.log(`
403
+ \u{1F4CB} Plan:`),e.withLabels&&(!e.only||e.only==="labels")&&console.log(` Labels to ensure: ${d.labels.length}`),(!e.only||e.only==="milestones")&&console.log(` Milestones to create: ${d.milestones.length}`),(!e.only||e.only==="epics")&&console.log(` Epics to create: ${d.epics.length}`),(!e.only||e.only==="stories")&&console.log(` Stories to create: ${d.stories.length}`),e.updateEnabled&&((!e.only||e.only==="epics")&&console.log(` Epics to check: ${d.updateEpics.length} (existing, will update if changed)`),(!e.only||e.only==="stories")&&console.log(` Stories to check: ${d.updateStories.length} (existing, will update if changed)`)),e.createProject&&console.log(` Project v2: will create "${a.project_name||o}"`),console.log();let f=s==="yolo"&&e.yes&&!e.forceYolo;if(e.execute&&(!e.yes||f)){f&&(console.log("\u26A0\uFE0F communication_mode=yolo does not auto-confirm GitHub mutations."),console.log(" Pass --force-yolo to skip this prompt, or answer interactively below."),console.log()),console.log(`\u26A0\uFE0F This will modify ${o} on GitHub.`);let h=d.labels.length+d.milestones.length+d.epics.length+d.stories.length;console.log(` Items to create: ${h}`),(e.sprint||e.epic||e.story)&&console.log(` Granular filter: ${e.sprint||e.epic||e.story}`),console.log();let w=await TF(" Proceed? Type 'yes' to continue: ",{default:"no",validate:C=>{let A=C.toLowerCase();return["yes","y","no","n"].includes(A)?!0:"Please type 'yes' to confirm, or 'no' to abort."}});["yes","y"].includes(w.toLowerCase())||(console.log(`
384
404
  \u274C Aborted by user. No changes made.`),process.exit(0)),console.log()}let m={labels:[],milestones:[],epics:[],stories:[],errors:[]},y={execute:e.execute,dryRun:e.dryRun,repo:o};if(e.withLabels&&(!e.only||e.only==="labels")){console.log(`
385
- \u{1F3F7}\uFE0F Labels`);for(let h of d.labels){let w=Pt.ensureLabel(h.name,h.color,h.description,y);m.labels.push(w),w.error?m.errors.push(`label ${h.name}: ${w.error}`):w.dryRun||(c.labels.includes(h.name)||c.labels.push(h.name),e.execute&&Ds(r,c),console.log(` \u2713 ${w.existed?"exists":"created"}: ${h.name}`))}}if(!e.only||e.only==="milestones"){console.log(`
405
+ \u{1F3F7}\uFE0F Labels`);for(let h of d.labels){let w=Ot.ensureLabel(h.name,h.color,h.description,y);m.labels.push(w),w.error?m.errors.push(`label ${h.name}: ${w.error}`):w.dryRun||(u.labels.includes(h.name)||u.labels.push(h.name),e.execute&&vs(r,u),console.log(` \u2713 ${w.existed?"exists":"created"}: ${h.name}`))}}if(!e.only||e.only==="milestones"){console.log(`
386
406
  \u{1F3AF} Milestones (phases)`);for(let h of d.milestones){let w=h.brief?h.brief.split(`
387
407
  `).slice(0,5).join(`
388
- `):"rcode phase",C=Pt.createMilestone(h.id,w,null,y);m.milestones.push({phase:h.id,...C}),C.error?m.errors.push(`milestone ${h.id}: ${C.error}`):C.dryRun||(c.phases[h.id]={milestone_number:C.number,milestone_id:C.id,url:C.url,synced_at:new Date().toISOString()},e.execute&&Ds(r,c),console.log(` \u2713 created: ${h.id} \u2192 milestone #${C.number}`))}}if(!e.only||e.only==="epics"){console.log(`
408
+ `):"rcode phase",C=Ot.createMilestone(h.id,w,null,y);m.milestones.push({phase:h.id,...C}),C.error?m.errors.push(`milestone ${h.id}: ${C.error}`):C.dryRun||(u.phases[h.id]={milestone_number:C.number,milestone_id:C.id,url:C.url,synced_at:new Date().toISOString()},e.execute&&vs(r,u),console.log(` \u2713 created: ${h.id} \u2192 milestone #${C.number}`))}}if(!e.only||e.only==="epics"){console.log(`
389
409
  \u{1F4E6} Epics`);for(let h of d.epics){let w=["## \u{1F3AF} Epic Vision","","_Strategic goal this Epic contributes to._","","## \u{1F4CB} Source Content","",h.content.slice(0,6e4),"","---","","## \u{1F4CA} Meta","",`- **Phase:** \`${h.phase}\``,`- **Source:** \`${h.sourcePath}\``,"- **Synced by:** rcode github-sync","","## \u{1F4DD} Child Stories","","_Child story issues will be appended here after they are created._"].join(`
390
- `),C=c.phases[h.phase]&&c.phases[h.phase].milestone_number,A=Pt.createIssue({title:`[Epic] ${h.title}`,body:w,labels:e.withLabels?["epic","priority:medium","status:backlog"]:[],milestone:C},y);m.epics.push({epic:h.id,...A}),A.error?m.errors.push(`epic ${h.id}: ${A.error}`):A.dryRun||(c.epics[Pe(h.phase,h.id)]={issue_number:A.number,url:A.url,phase:h.phase,synced_at:new Date().toISOString(),content_hash:Rn(h.content),child_story_issues:[]},e.execute&&Ds(r,c),console.log(` \u2713 created: ${h.id} \u2192 #${A.number}`))}}if(!e.only||e.only==="stories"){console.log(`
391
- \u{1F4C4} Stories`);for(let h of d.stories){let w=h.parentEpic?c.epics[Pe(h.phase,h.parentEpic)]:null,C=w?`- **Parent Epic:** #${w.issue_number} (Part of this epic)`:h.parentEpic?`- **Parent Epic:** \`${h.parentEpic}\` (not yet synced to GitHub)`:"- **Parent Epic:** (standalone \u2014 no parent epic)",A=h.sprintId?`- **Sprint:** \`${h.sprintId}\``:"- **Sprint:** (not assigned to a sprint)",T=["## \u{1F3AF} Problem Statement","","_Clear explanation of what this story solves._","","## \u2705 Acceptance Criteria","","- [ ] Given/When/Then flows documented in source","- [ ] Tests written and passing","- [ ] Code review complete","","## \u{1F4CB} Source Content","",h.content.slice(0,6e4),"","---","","## \u{1F4CA} Meta","",C,A,`- **Phase:** \`${h.phase}\``,`- **Source:** \`${h.sourcePath}\``,"- **Synced by:** rcode github-sync","","> **Linking:** Reference this story in commits with `refs #{issue}`","> or close it via PR with `Closes #{issue}`."].join(`
392
- `),V=c.phases[h.phase]&&c.phases[h.phase].milestone_number,I=Pt.createIssue({title:h.title,body:T,labels:e.withLabels?["type:feature","priority:medium","status:backlog"]:[],milestone:V},y);m.stories.push({story:h.id,...I}),I.error?m.errors.push(`story ${h.id}: ${I.error}`):I.dryRun||(c.stories[Pe(h.phase,h.id)]={issue_number:I.number,url:I.url,phase:h.phase,parent_epic:h.parentEpic||null,sprint_id:h.sprintId||null,synced_at:new Date().toISOString(),content_hash:Rn(h.content)},e.execute&&Ds(r,c),w&&(w.child_story_issues=w.child_story_issues||[],w.child_story_issues.includes(I.number)||w.child_story_issues.push(I.number)),console.log(` \u2713 created: ${h.id} \u2192 #${I.number}`))}}if(e.execute&&(!e.only||e.only==="epics"||e.only==="stories")){let h=Object.entries(c.epics).filter(([,w])=>w.child_story_issues&&w.child_story_issues.length>0);if(h.length>0){console.log(`
393
- \u{1F517} Linking stories \u2192 epics (task lists)`);for(let[w,C]of h){let A=C.child_story_issues.sort((P,b)=>P-b).map(P=>`- [ ] #${P}`).join(`
394
- `),T=Pt.getIssue(C.issue_number,{repo:o});if(T.error){m.errors.push(`link epic #${C.issue_number}: ${T.error}`);continue}let V=T.body||"",I,H=/## 📝 Child Stories[\s\S]*?(?=\n## |$)/,F=`## \u{1F4DD} Child Stories
410
+ `),C=u.phases[h.phase]&&u.phases[h.phase].milestone_number,A=Ot.createIssue({title:`[Epic] ${h.title}`,body:w,labels:e.withLabels?["epic","priority:medium","status:backlog"]:[],milestone:C},y);m.epics.push({epic:h.id,...A}),A.error?m.errors.push(`epic ${h.id}: ${A.error}`):A.dryRun||(u.epics[Ne(h.phase,h.id)]={issue_number:A.number,url:A.url,phase:h.phase,synced_at:new Date().toISOString(),content_hash:On(h.content),child_story_issues:[]},e.execute&&vs(r,u),console.log(` \u2713 created: ${h.id} \u2192 #${A.number}`))}}if(!e.only||e.only==="stories"){console.log(`
411
+ \u{1F4C4} Stories`);for(let h of d.stories){let w=h.parentEpic?u.epics[Ne(h.phase,h.parentEpic)]:null,C=w?`- **Parent Epic:** #${w.issue_number} (Part of this epic)`:h.parentEpic?`- **Parent Epic:** \`${h.parentEpic}\` (not yet synced to GitHub)`:"- **Parent Epic:** (standalone \u2014 no parent epic)",A=h.sprintId?`- **Sprint:** \`${h.sprintId}\``:"- **Sprint:** (not assigned to a sprint)",T=["## \u{1F3AF} Problem Statement","","_Clear explanation of what this story solves._","","## \u2705 Acceptance Criteria","","- [ ] Given/When/Then flows documented in source","- [ ] Tests written and passing","- [ ] Code review complete","","## \u{1F4CB} Source Content","",h.content.slice(0,6e4),"","---","","## \u{1F4CA} Meta","",C,A,`- **Phase:** \`${h.phase}\``,`- **Source:** \`${h.sourcePath}\``,"- **Synced by:** rcode github-sync","","> **Linking:** Reference this story in commits with `refs #{issue}`","> or close it via PR with `Closes #{issue}`."].join(`
412
+ `),G=u.phases[h.phase]&&u.phases[h.phase].milestone_number,I=Ot.createIssue({title:h.title,body:T,labels:e.withLabels?["type:feature","priority:medium","status:backlog"]:[],milestone:G},y);m.stories.push({story:h.id,...I}),I.error?m.errors.push(`story ${h.id}: ${I.error}`):I.dryRun||(u.stories[Ne(h.phase,h.id)]={issue_number:I.number,url:I.url,phase:h.phase,parent_epic:h.parentEpic||null,sprint_id:h.sprintId||null,synced_at:new Date().toISOString(),content_hash:On(h.content)},e.execute&&vs(r,u),w&&(w.child_story_issues=w.child_story_issues||[],w.child_story_issues.includes(I.number)||w.child_story_issues.push(I.number)),console.log(` \u2713 created: ${h.id} \u2192 #${I.number}`))}}if(e.execute&&(!e.only||e.only==="epics"||e.only==="stories")){let h=Object.entries(u.epics).filter(([,w])=>w.child_story_issues&&w.child_story_issues.length>0);if(h.length>0){console.log(`
413
+ \u{1F517} Linking stories \u2192 epics (task lists)`);for(let[w,C]of h){let A=C.child_story_issues.sort((R,b)=>R-b).map(R=>`- [ ] #${R}`).join(`
414
+ `),T=Ot.getIssue(C.issue_number,{repo:o});if(T.error){m.errors.push(`link epic #${C.issue_number}: ${T.error}`);continue}let G=T.body||"",I,Z=/## 📝 Child Stories[\s\S]*?(?=\n## |$)/,F=`## \u{1F4DD} Child Stories
395
415
 
396
416
  ${A}
397
- `;H.test(V)?I=V.replace(H,F):I=V.trimEnd()+`
398
-
399
- `+F;let q=Pt.updateIssue(C.issue_number,{body:I},y);q.error?m.errors.push(`update epic #${C.issue_number}: ${q.error}`):console.log(` \u2713 linked ${C.child_story_issues.length} stories \u2192 epic #${C.issue_number}`)}}}if(e.updateEnabled&&(!e.only||e.only==="epics")&&d.updateEpics.length>0){console.log(`
400
- \u{1F504} Update existing epics`);for(let h of d.updateEpics){let w=Rn(h.content);if(w===h.lastSyncedContentHash)continue;let C=["## \u{1F3AF} Epic Vision","",`_Strategic goal this Epic contributes to. Fill in from \`${h.sourcePath}\`._`,"","## \u{1F4CB} Source Content","",h.content.slice(0,6e4),"","---","","## \u{1F4CA} Meta","",`- **Phase:** \`${h.phase}\``,`- **Source:** \`${h.sourcePath}\``,`- **Last synced:** ${new Date().toISOString()}`].join(`
401
- `),A=Pt.updateIssue(h.issueNumber,{title:e.updateBody?`[Epic] ${h.title}`:void 0,body:e.updateBody?C:void 0},y);A.error?m.errors.push(`update epic #${h.issueNumber}: ${A.error}`):A.dryRun||(c.epics[Pe(h.phase,h.id)].content_hash=w,c.epics[Pe(h.phase,h.id)].updated_at=new Date().toISOString(),console.log(` \u2713 updated: #${h.issueNumber} (${h.id})`))}}if(e.updateEnabled&&(!e.only||e.only==="stories")&&d.updateStories.length>0){console.log(`
402
- \u{1F504} Update existing stories`);for(let h of d.updateStories){let w=Rn(h.content);if(w===h.lastSyncedContentHash)continue;let C=["## \u{1F3AF} Problem Statement","",`_From \`${h.sourcePath}\`._`,"","## \u{1F4CB} Source Content","",h.content.slice(0,6e4),"","---","","## \u{1F4CA} Meta","",`- **Phase:** \`${h.phase}\``,`- **Source:** \`${h.sourcePath}\``,`- **Last synced:** ${new Date().toISOString()}`].join(`
403
- `),A=Pt.updateIssue(h.issueNumber,{title:e.updateBody?h.title:void 0,body:e.updateBody?C:void 0},y);A.error?m.errors.push(`update story #${h.issueNumber}: ${A.error}`):A.dryRun||(c.stories[Pe(h.phase,h.id)].content_hash=w,c.stories[Pe(h.phase,h.id)].updated_at=new Date().toISOString(),console.log(` \u2713 updated: #${h.issueNumber} (${h.id})`))}}if(e.createProject&&(!e.only||e.only==="project")){console.log(`
404
- \u{1F4CA} Project v2`);let h=o.split("/")[0],w=a.project_name||o.split("/")[1],C=Pt.createProject(h,w,y);C.error?m.errors.push(`project: ${C.error}`):C.dryRun||(c.project={number:C.number,url:C.url,synced_at:new Date().toISOString()},console.log(` \u2713 created: Project v2 "${w}" \u2192 ${C.url}`))}if(e.execute&&(Ds(r,c),console.log(`
417
+ `;Z.test(G)?I=G.replace(Z,F):I=G.trimEnd()+`
418
+
419
+ `+F;let W=Ot.updateIssue(C.issue_number,{body:I},y);W.error?m.errors.push(`update epic #${C.issue_number}: ${W.error}`):console.log(` \u2713 linked ${C.child_story_issues.length} stories \u2192 epic #${C.issue_number}`)}}}if(e.updateEnabled&&(!e.only||e.only==="epics")&&d.updateEpics.length>0){console.log(`
420
+ \u{1F504} Update existing epics`);for(let h of d.updateEpics){let w=On(h.content);if(w===h.lastSyncedContentHash)continue;let C=["## \u{1F3AF} Epic Vision","",`_Strategic goal this Epic contributes to. Fill in from \`${h.sourcePath}\`._`,"","## \u{1F4CB} Source Content","",h.content.slice(0,6e4),"","---","","## \u{1F4CA} Meta","",`- **Phase:** \`${h.phase}\``,`- **Source:** \`${h.sourcePath}\``,`- **Last synced:** ${new Date().toISOString()}`].join(`
421
+ `),A=Ot.updateIssue(h.issueNumber,{title:e.updateBody?`[Epic] ${h.title}`:void 0,body:e.updateBody?C:void 0},y);A.error?m.errors.push(`update epic #${h.issueNumber}: ${A.error}`):A.dryRun||(u.epics[Ne(h.phase,h.id)].content_hash=w,u.epics[Ne(h.phase,h.id)].updated_at=new Date().toISOString(),console.log(` \u2713 updated: #${h.issueNumber} (${h.id})`))}}if(e.updateEnabled&&(!e.only||e.only==="stories")&&d.updateStories.length>0){console.log(`
422
+ \u{1F504} Update existing stories`);for(let h of d.updateStories){let w=On(h.content);if(w===h.lastSyncedContentHash)continue;let C=["## \u{1F3AF} Problem Statement","",`_From \`${h.sourcePath}\`._`,"","## \u{1F4CB} Source Content","",h.content.slice(0,6e4),"","---","","## \u{1F4CA} Meta","",`- **Phase:** \`${h.phase}\``,`- **Source:** \`${h.sourcePath}\``,`- **Last synced:** ${new Date().toISOString()}`].join(`
423
+ `),A=Ot.updateIssue(h.issueNumber,{title:e.updateBody?h.title:void 0,body:e.updateBody?C:void 0},y);A.error?m.errors.push(`update story #${h.issueNumber}: ${A.error}`):A.dryRun||(u.stories[Ne(h.phase,h.id)].content_hash=w,u.stories[Ne(h.phase,h.id)].updated_at=new Date().toISOString(),console.log(` \u2713 updated: #${h.issueNumber} (${h.id})`))}}if(e.createProject&&(!e.only||e.only==="project")){console.log(`
424
+ \u{1F4CA} Project v2`);let h=o.split("/")[0],w=a.project_name||o.split("/")[1],C=Ot.createProject(h,w,y);C.error?m.errors.push(`project: ${C.error}`):C.dryRun||(u.project={number:C.number,url:C.url,synced_at:new Date().toISOString()},console.log(` \u2713 created: Project v2 "${w}" \u2192 ${C.url}`))}if(e.execute&&(vs(r,u),console.log(`
405
425
  \u{1F4BE} Sync map saved to .rcode/integrations/github-map.json`)),console.log(`
406
- \u{1F4CA} Summary`),console.log(` Labels: ${m.labels.length}`),console.log(` Milestones: ${m.milestones.length}`),console.log(` Epics: ${m.epics.length} created`),console.log(` Stories: ${m.stories.length} created`),e.updateEnabled){let h=d.updateEpics.filter(C=>Rn(C.content)!==C.lastSyncedContentHash).length,w=d.updateStories.filter(C=>Rn(C.content)!==C.lastSyncedContentHash).length;console.log(` Updated: ${h} epics, ${w} stories (content changed since last sync)`)}if(m.errors.length>0){console.log(` Errors: ${m.errors.length}`);for(let h of m.errors)console.log(` \u274C ${h}`)}e.dryRun?(console.log(`
426
+ \u{1F4CA} Summary`),console.log(` Labels: ${m.labels.length}`),console.log(` Milestones: ${m.milestones.length}`),console.log(` Epics: ${m.epics.length} created`),console.log(` Stories: ${m.stories.length} created`),e.updateEnabled){let h=d.updateEpics.filter(C=>On(C.content)!==C.lastSyncedContentHash).length,w=d.updateStories.filter(C=>On(C.content)!==C.lastSyncedContentHash).length;console.log(` Updated: ${h} epics, ${w} stories (content changed since last sync)`)}if(m.errors.length>0){console.log(` Errors: ${m.errors.length}`);for(let h of m.errors)console.log(` \u274C ${h}`)}e.dryRun?(console.log(`
407
427
  \u26A0\uFE0F This was a DRY-RUN. No changes were made to GitHub.`),console.log(" To actually apply these changes, run again with: --execute")):console.log(`
408
- \u2705 Sync complete. View on GitHub: https://github.com/${o}`)}ly.exports=function(e){BF(e).catch(r=>{r instanceof jF&&(console.log(`
428
+ \u2705 Sync complete. View on GitHub: https://github.com/${o}`)}fy.exports=function(e){WF(e).catch(r=>{r instanceof RF&&(console.log(`
409
429
  \u274C GitHub sync cancelled \u2014 ${r.message}.`),process.exit(0)),console.error(`
410
- \u274C GitHub sync failed:`,r.message),process.env.DEBUG&&console.error(r.stack),process.exit(1)})}});var hy=v((pT,fy)=>{fy.exports=function(e,{packageJson:r}){console.log(`
430
+ \u274C GitHub sync failed:`,r.message),process.env.DEBUG&&console.error(r.stack),process.exit(1)})}});var my=v((DT,py)=>{py.exports=function(e,{packageJson:r}){console.log(`
411
431
  \u{1F54C} rcode v${r.version} \u2014 Tiers
412
432
 
413
433
  Everything is organized into 4 tiers + a preview track. Start with \u{1F331} Starter.
@@ -446,8 +466,8 @@ Everything is organized into 4 tiers + a preview track. Start with \u{1F331} Sta
446
466
  See: docs/V2-PREVIEW.md
447
467
 
448
468
  Full detail: docs/TIERS.md
449
- `.trim())}});var ys=require("path"),dn=require("fs"),py=ys.resolve(__dirname,".."),vs=JSON.parse(dn.readFileSync(ys.join(py,"package.json"),"utf8")),MF={install:is(),init:is(),update:Rg(),uninstall:ac(),remove:ac(),nuke:Ug(),"migrate-namespace":Gg(),dashboard:lc(),serve:lc(),digest:Qg(),team:rD(),agent:iD(),doctor:ED(),workflow:vc(),plan:(t,e)=>jc("plan",t,e),execute:(t,e)=>jc("execute-sprint",t,e),ship:(t,e)=>jc("ship",t,e),"set-profile":ND(),"set-mode":qD(),config:GD(),context:XD(),"show-model":ty(),"github-sync":dy(),tiers:hy(),version:()=>console.log(vs.version),help:my};function my(){console.log(`
450
- \u{1F54C} rcode v${vs.version}
469
+ `.trim())}});var _s=require("path"),hn=require("fs"),gy=_s.resolve(__dirname,".."),bs=JSON.parse(hn.readFileSync(_s.join(gy,"package.json"),"utf8")),HF={install:cs(),init:cs(),update:Og(),uninstall:cu(),remove:cu(),nuke:Gg(),"migrate-namespace":Yg(),dashboard:du(),serve:du(),digest:tD(),team:sD(),agent:cD(),doctor:wD(),workflow:_u(),plan:(t,e)=>Iu("plan",t,e),execute:(t,e)=>Iu("execute-sprint",t,e),ship:(t,e)=>Iu("ship",t,e),"set-profile":BD(),"set-mode":HD(),config:YD(),context:QD(),"show-model":ny(),"github-sync":hy(),tiers:my(),version:()=>console.log(bs.version),help:Dy};function Dy(){console.log(`
470
+ \u{1F54C} rcode v${bs.version}
451
471
  Context-aware AI team methodology. See tiers: \`rcode tiers\`
452
472
 
453
473
  Usage:
@@ -520,14 +540,14 @@ Getting started:
520
540
  rcode set-profile # choose model profile (quality | balanced | budget)
521
541
 
522
542
  Documentation: https://github.com/hanzlahabib/rcode
523
- `.trim())}function jc(t,e,r){vc()(["show",t,...e],r);let n=e.includes("--auto")||e.includes("--run");console.log(`
543
+ `.trim())}function Iu(t,e,r){_u()(["show",t,...e],r);let n=e.includes("--auto")||e.includes("--run");console.log(`
524
544
  \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`),console.log(`\u25B6 To run: paste the above into Claude Code as /${t==="execute-sprint"?"rcode-execute-sprint":`rcode-${t}`}`),console.log(" or pipe it directly: rcode "+(t==="execute-sprint"?"execute":t)+" | cld --model sonnet"),n&&console.log(`
525
- AUTO mode detected \u2014 in Claude Code run: /rcode-`+(t==="execute-sprint"?"execute-sprint":t)+" --auto (applies yolo defaults, skips confirmation prompts)")}function qF(){let e=require("os").homedir(),r=ys.join(e,".rcode"),n=ys.join(r,".welcome-shown");if(dn.existsSync(n))return;let s=ys.join(e,".claude","commands"),i=!1;try{i=dn.existsSync(s)&&dn.readdirSync(s).some(o=>o.startsWith("rcode-")&&o.endsWith(".md"))}catch{}if(i){console.log(`
526
- \u{1F54C} rcode v${vs.version} \u2014 first run detected.
527
- `),console.log(` \u2713 ${WF(s)} slash commands installed \u2192 ~/.claude/commands/`),console.log(" \u2713 All /rcode-* commands available in every Claude Code project."),console.log(`
545
+ AUTO mode detected \u2014 in Claude Code run: /rcode-`+(t==="execute-sprint"?"execute-sprint":t)+" --auto (applies yolo defaults, skips confirmation prompts)")}function ZF(){let e=require("os").homedir(),r=_s.join(e,".rcode"),n=_s.join(r,".welcome-shown");if(hn.existsSync(n))return;let s=_s.join(e,".claude","commands"),i=!1;try{i=hn.existsSync(s)&&hn.readdirSync(s).some(o=>o.startsWith("rcode-")&&o.endsWith(".md"))}catch{}if(i){console.log(`
546
+ \u{1F54C} rcode v${bs.version} \u2014 first run detected.
547
+ `),console.log(` \u2713 ${UF(s)} slash commands installed \u2192 ~/.claude/commands/`),console.log(" \u2713 All /rcode-* commands available in every Claude Code project."),console.log(`
528
548
  To set up a project: cd my-project && rcode install`),console.log(" Show all commands: rcode help"),console.log(` Diagnose issues: rcode doctor
529
- `);try{dn.mkdirSync(r,{recursive:!0}),dn.writeFileSync(n,`installed ${vs.version} at ${new Date().toISOString()}
530
- `)}catch{}}}function WF(t){try{return dn.readdirSync(t).filter(e=>e.startsWith("rcode-")&&e.endsWith(".md")).length}catch{return 0}}async function HF(){let[,,t="help",...e]=process.argv;(t==="--help"||t==="-h")&&(t="help"),(t==="--version"||t==="-v")&&(t="version"),qF();let r=MF[t];r||(console.error(`Unknown command: ${t}`),my(),process.exit(1));try{await r(e,{packageRoot:py,packageJson:vs})}catch(n){console.error(`Error running '${t}':`,n.message),process.env.DEBUG&&console.error(n.stack),process.exit(1)}finally{try{as().closeSession()}catch{}}}HF();
549
+ `);try{hn.mkdirSync(r,{recursive:!0}),hn.writeFileSync(n,`installed ${bs.version} at ${new Date().toISOString()}
550
+ `)}catch{}}}function UF(t){try{return hn.readdirSync(t).filter(e=>e.startsWith("rcode-")&&e.endsWith(".md")).length}catch{return 0}}async function VF(){let[,,t="help",...e]=process.argv;(t==="--help"||t==="-h")&&(t="help"),(t==="--version"||t==="-v")&&(t="version"),ZF();let r=HF[t];r||(console.error(`Unknown command: ${t}`),Dy(),process.exit(1));try{await r(e,{packageRoot:gy,packageJson:bs})}catch(n){console.error(`Error running '${t}':`,n.message),process.env.DEBUG&&console.error(n.stack),process.exit(1)}finally{try{us().closeSession()}catch{}}}VF();
531
551
  /*! Bundled license information:
532
552
 
533
553
  is-extglob/index.js: