aicommits 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/cli.mjs +58 -56
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -194,6 +194,15 @@ Default: `10000` (10 seconds)
|
|
|
194
194
|
aicommits config set timeout=20000 # 20s
|
|
195
195
|
```
|
|
196
196
|
|
|
197
|
+
#### max-length
|
|
198
|
+
The maximum character length of the generated commit message.
|
|
199
|
+
|
|
200
|
+
Default: `50`
|
|
201
|
+
|
|
202
|
+
```sh
|
|
203
|
+
aicommits config set max-length=100
|
|
204
|
+
```
|
|
205
|
+
|
|
197
206
|
## How it works
|
|
198
207
|
|
|
199
208
|
This CLI tool runs `git diff` to grab all your latest code changes, sends them to OpenAI's GPT-3, then returns the AI generated commit message.
|
package/dist/cli.mjs
CHANGED
|
@@ -1,92 +1,94 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import le from"tty";import{Buffer as $n}from"node:buffer";import W from"node:path";import Pt from"node:child_process";import b,{stdin as _t,stdout as kt}from"node:process";import vn from"child_process";import X from"path";import Pe from"fs";import An from"node:url";import xn,{constants as Rt}from"node:os";import Mt from"assert";import jt from"events";import Sn from"buffer";import _e from"stream";import Lt from"util";import*as fe from"node:readline";import Nt from"node:readline";import{WriteStream as On}from"node:tty";import O from"fs/promises";import Gt from"os";import In from"https";import Tn from"net";import Pn from"tls";import _n,{fileURLToPath as kn,pathToFileURL as Rn}from"url";const Mn="known-flag",jn="unknown-flag",Ln="argument",{stringify:Z}=JSON,Nn=/\B([A-Z])/g,Gn=e=>e.replace(Nn,"-$1").toLowerCase(),{hasOwnProperty:Un}=Object.prototype,Q=(e,t)=>Un.call(e,t),Wn=e=>Array.isArray(e),Ut=e=>typeof e=="function"?[e,!1]:Wn(e)?[e[0],!0]:Ut(e.type),Hn=(e,t)=>e===Boolean?t!=="false":t,qn=(e,t)=>typeof t=="boolean"?t:e===Number&&t===""?Number.NaN:e(t),zn=/[\s.:=]/,Kn=e=>{const t=`Flag name ${Z(e)}`;if(e.length===0)throw new Error(`${t} cannot be empty`);if(e.length===1)throw new Error(`${t} must be longer than a character`);const n=e.match(zn);if(n)throw new Error(`${t} cannot contain ${Z(n?.[0])}`)},Vn=e=>{const t={},n=(u,r)=>{if(Q(t,u))throw new Error(`Duplicate flags named ${Z(u)}`);t[u]=r};for(const u in e){if(!Q(e,u))continue;Kn(u);const r=e[u],o=[[],...Ut(r),r];n(u,o);const s=Gn(u);if(u!==s&&n(s,o),"alias"in r&&typeof r.alias=="string"){const{alias:i}=r,D=`Flag alias ${Z(i)} for flag ${Z(u)}`;if(i.length===0)throw new Error(`${D} cannot be empty`);if(i.length>1)throw new Error(`${D} must be a single character`);n(i,o)}}return t},Yn=(e,t)=>{const n={};for(const u in e){if(!Q(e,u))continue;const[r,,o,s]=t[u];if(r.length===0&&"default"in s){let{default:i}=s;typeof i=="function"&&(i=i()),n[u]=i}else n[u]=o?r:r.pop()}return n},de="--",Jn=/[.:=]/,Xn=/^-{1,2}\w/,Zn=e=>{if(!Xn.test(e))return;const t=!e.startsWith(de);let n=e.slice(t?1:2),u;const r=n.match(Jn);if(r){const{index:o}=r;u=n.slice(o+1),n=n.slice(0,o)}return[n,u,t]},Qn=(e,{onFlag:t,onArgument:n})=>{let u;const r=(o,s)=>{if(typeof u!="function")return!0;u(o,s),u=void 0};for(let o=0;o<e.length;o+=1){const s=e[o];if(s===de){r();const D=e.slice(o+1);n?.(D,[o],!0);break}const i=Zn(s);if(i){if(r(),!t)continue;const[D,l,f]=i;if(f)for(let a=0;a<D.length;a+=1){r();const c=a===D.length-1;u=t(D[a],c?l:void 0,[o,a+1,c])}else u=t(D,l,[o])}else r(s,[o])&&n?.([s],[o])}r()},er=(e,t)=>{for(const[n,u,r]of t.reverse()){if(u){const o=e[n];let s=o.slice(0,u);if(r||(s+=o.slice(u+1)),s!=="-"){e[n]=s;continue}}e.splice(n,1)}},tr=(e,t=process.argv.slice(2),{ignore:n}={})=>{const u=[],r=Vn(e),o={},s=[];return s[de]=[],Qn(t,{onFlag(i,D,l){const f=Q(r,i);if(!n?.(f?Mn:jn,i,D)){if(f){const[a,c]=r[i],d=Hn(c,D),p=(m,h)=>{u.push(l),h&&u.push(h),a.push(qn(c,m||""))};return d===void 0?p:p(d)}Q(o,i)||(o[i]=[]),o[i].push(D===void 0?!0:D),u.push(l)}},onArgument(i,D,l){n?.(Ln,t[D[0]])||(s.push(...i),l?(s[de]=i,t.splice(D[0])):u.push(D))}}),er(t,u),{flags:Yn(e,r),unknownFlags:o,_:s}};var ur=Object.create,pe=Object.defineProperty,nr=Object.defineProperties,rr=Object.getOwnPropertyDescriptor,or=Object.getOwnPropertyDescriptors,sr=Object.getOwnPropertyNames,Wt=Object.getOwnPropertySymbols,ir=Object.getPrototypeOf,Ht=Object.prototype.hasOwnProperty,Dr=Object.prototype.propertyIsEnumerable,qt=(e,t,n)=>t in e?pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ce=(e,t)=>{for(var n in t||(t={}))Ht.call(t,n)&&qt(e,n,t[n]);if(Wt)for(var n of Wt(t))Dr.call(t,n)&&qt(e,n,t[n]);return e},ke=(e,t)=>nr(e,or(t)),ar=e=>pe(e,"__esModule",{value:!0}),cr=(e,t)=>()=>(e&&(t=e(e=0)),t),lr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),fr=(e,t,n,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of sr(t))!Ht.call(e,r)&&(n||r!=="default")&&pe(e,r,{get:()=>t[r],enumerable:!(u=rr(t,r))||u.enumerable});return e},dr=(e,t)=>fr(ar(pe(e!=null?ur(ir(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),A=cr(()=>{}),pr=lr((e,t)=>{A(),t.exports=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}});A(),A(),A();var Cr=e=>{var t,n,u;let r=(t=process.stdout.columns)!=null?t:Number.POSITIVE_INFINITY;return typeof e=="function"&&(e=e(r)),e||(e={}),Array.isArray(e)?{columns:e,stdoutColumns:r}:{columns:(n=e.columns)!=null?n:[],stdoutColumns:(u=e.stdoutColumns)!=null?u:r}};A(),A(),A(),A(),A();function mr({onlyFirst:e=!1}={}){let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}function zt(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(mr(),"")}A();function hr(e){return Number.isInteger(e)?e>=4352&&(e<=4447||e===9001||e===9002||11904<=e&&e<=12871&&e!==12351||12880<=e&&e<=19903||19968<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65131||65281<=e&&e<=65376||65504<=e&&e<=65510||110592<=e&&e<=110593||127488<=e&&e<=127569||131072<=e&&e<=262141):!1}var Fr=dr(pr(),1);function M(e){if(typeof e!="string"||e.length===0||(e=zt(e),e.length===0))return 0;e=e.replace((0,Fr.default)()," ");let t=0;for(let n=0;n<e.length;n++){let u=e.codePointAt(n);u<=31||u>=127&&u<=159||u>=768&&u<=879||(u>65535&&n++,t+=hr(u)?2:1)}return t}var Kt=e=>Math.max(...e.split(`
|
|
3
|
-
`).map(M)),
|
|
4
|
-
`)];for(let[l,f]of D.entries()){if(u+=f,
|
|
2
|
+
import le from"tty";import{Buffer as $n}from"node:buffer";import W from"node:path";import Pt from"node:child_process";import b,{stdin as _t,stdout as kt}from"node:process";import vn from"child_process";import X from"path";import Pe from"fs";import An from"node:url";import xn,{constants as Rt}from"node:os";import Mt from"assert";import jt from"events";import Sn from"buffer";import _e from"stream";import Lt from"util";import*as fe from"node:readline";import Nt from"node:readline";import{WriteStream as On}from"node:tty";import O from"fs/promises";import Gt from"os";import Tn from"https";import{encoding_for_model as In}from"@dqbd/tiktoken";import Pn from"net";import _n from"tls";import kn,{fileURLToPath as Rn,pathToFileURL as Mn}from"url";const jn="known-flag",Ln="unknown-flag",Nn="argument",{stringify:Z}=JSON,Gn=/\B([A-Z])/g,Un=e=>e.replace(Gn,"-$1").toLowerCase(),{hasOwnProperty:Wn}=Object.prototype,Q=(e,t)=>Wn.call(e,t),Hn=e=>Array.isArray(e),Ut=e=>typeof e=="function"?[e,!1]:Hn(e)?[e[0],!0]:Ut(e.type),qn=(e,t)=>e===Boolean?t!=="false":t,zn=(e,t)=>typeof t=="boolean"?t:e===Number&&t===""?Number.NaN:e(t),Kn=/[\s.:=]/,Vn=e=>{const t=`Flag name ${Z(e)}`;if(e.length===0)throw new Error(`${t} cannot be empty`);if(e.length===1)throw new Error(`${t} must be longer than a character`);const n=e.match(Kn);if(n)throw new Error(`${t} cannot contain ${Z(n?.[0])}`)},Yn=e=>{const t={},n=(u,r)=>{if(Q(t,u))throw new Error(`Duplicate flags named ${Z(u)}`);t[u]=r};for(const u in e){if(!Q(e,u))continue;Vn(u);const r=e[u],o=[[],...Ut(r),r];n(u,o);const s=Un(u);if(u!==s&&n(s,o),"alias"in r&&typeof r.alias=="string"){const{alias:i}=r,D=`Flag alias ${Z(i)} for flag ${Z(u)}`;if(i.length===0)throw new Error(`${D} cannot be empty`);if(i.length>1)throw new Error(`${D} must be a single character`);n(i,o)}}return t},Jn=(e,t)=>{const n={};for(const u in e){if(!Q(e,u))continue;const[r,,o,s]=t[u];if(r.length===0&&"default"in s){let{default:i}=s;typeof i=="function"&&(i=i()),n[u]=i}else n[u]=o?r:r.pop()}return n},de="--",Xn=/[.:=]/,Zn=/^-{1,2}\w/,Qn=e=>{if(!Zn.test(e))return;const t=!e.startsWith(de);let n=e.slice(t?1:2),u;const r=n.match(Xn);if(r){const{index:o}=r;u=n.slice(o+1),n=n.slice(0,o)}return[n,u,t]},er=(e,{onFlag:t,onArgument:n})=>{let u;const r=(o,s)=>{if(typeof u!="function")return!0;u(o,s),u=void 0};for(let o=0;o<e.length;o+=1){const s=e[o];if(s===de){r();const D=e.slice(o+1);n?.(D,[o],!0);break}const i=Qn(s);if(i){if(r(),!t)continue;const[D,l,f]=i;if(f)for(let a=0;a<D.length;a+=1){r();const c=a===D.length-1;u=t(D[a],c?l:void 0,[o,a+1,c])}else u=t(D,l,[o])}else r(s,[o])&&n?.([s],[o])}r()},tr=(e,t)=>{for(const[n,u,r]of t.reverse()){if(u){const o=e[n];let s=o.slice(0,u);if(r||(s+=o.slice(u+1)),s!=="-"){e[n]=s;continue}}e.splice(n,1)}},ur=(e,t=process.argv.slice(2),{ignore:n}={})=>{const u=[],r=Yn(e),o={},s=[];return s[de]=[],er(t,{onFlag(i,D,l){const f=Q(r,i);if(!n?.(f?jn:Ln,i,D)){if(f){const[a,c]=r[i],d=qn(c,D),p=(C,h)=>{u.push(l),h&&u.push(h),a.push(zn(c,C||""))};return d===void 0?p:p(d)}Q(o,i)||(o[i]=[]),o[i].push(D===void 0?!0:D),u.push(l)}},onArgument(i,D,l){n?.(Nn,t[D[0]])||(s.push(...i),l?(s[de]=i,t.splice(D[0])):u.push(D))}}),tr(t,u),{flags:Jn(e,r),unknownFlags:o,_:s}};var nr=Object.create,pe=Object.defineProperty,rr=Object.defineProperties,or=Object.getOwnPropertyDescriptor,sr=Object.getOwnPropertyDescriptors,ir=Object.getOwnPropertyNames,Wt=Object.getOwnPropertySymbols,Dr=Object.getPrototypeOf,Ht=Object.prototype.hasOwnProperty,ar=Object.prototype.propertyIsEnumerable,qt=(e,t,n)=>t in e?pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,me=(e,t)=>{for(var n in t||(t={}))Ht.call(t,n)&&qt(e,n,t[n]);if(Wt)for(var n of Wt(t))ar.call(t,n)&&qt(e,n,t[n]);return e},ke=(e,t)=>rr(e,sr(t)),cr=e=>pe(e,"__esModule",{value:!0}),lr=(e,t)=>()=>(e&&(t=e(e=0)),t),fr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),dr=(e,t,n,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ir(t))!Ht.call(e,r)&&(n||r!=="default")&&pe(e,r,{get:()=>t[r],enumerable:!(u=or(t,r))||u.enumerable});return e},pr=(e,t)=>dr(cr(pe(e!=null?nr(Dr(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),A=lr(()=>{}),mr=fr((e,t)=>{A(),t.exports=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}});A(),A(),A();var Cr=e=>{var t,n,u;let r=(t=process.stdout.columns)!=null?t:Number.POSITIVE_INFINITY;return typeof e=="function"&&(e=e(r)),e||(e={}),Array.isArray(e)?{columns:e,stdoutColumns:r}:{columns:(n=e.columns)!=null?n:[],stdoutColumns:(u=e.stdoutColumns)!=null?u:r}};A(),A(),A(),A(),A();function hr({onlyFirst:e=!1}={}){let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}function zt(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(hr(),"")}A();function Fr(e){return Number.isInteger(e)?e>=4352&&(e<=4447||e===9001||e===9002||11904<=e&&e<=12871&&e!==12351||12880<=e&&e<=19903||19968<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65131||65281<=e&&e<=65376||65504<=e&&e<=65510||110592<=e&&e<=110593||127488<=e&&e<=127569||131072<=e&&e<=262141):!1}var gr=pr(mr(),1);function M(e){if(typeof e!="string"||e.length===0||(e=zt(e),e.length===0))return 0;e=e.replace((0,gr.default)()," ");let t=0;for(let n=0;n<e.length;n++){let u=e.codePointAt(n);u<=31||u>=127&&u<=159||u>=768&&u<=879||(u>65535&&n++,t+=Fr(u)?2:1)}return t}var Kt=e=>Math.max(...e.split(`
|
|
3
|
+
`).map(M)),Er=e=>{let t=[];for(let n of e){let{length:u}=n,r=u-t.length;for(let o=0;o<r;o+=1)t.push(0);for(let o=0;o<u;o+=1){let s=Kt(n[o]);s>t[o]&&(t[o]=s)}}return t};A();var Vt=/^\d+%$/,Yt={width:"auto",align:"left",contentWidth:0,paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:0,horizontalPadding:0,paddingLeftString:"",paddingRightString:""},yr=(e,t)=>{var n;let u=[];for(let r=0;r<e.length;r+=1){let o=(n=t[r])!=null?n:"auto";if(typeof o=="number"||o==="auto"||o==="content-width"||typeof o=="string"&&Vt.test(o)){u.push(ke(me({},Yt),{width:o,contentWidth:e[r]}));continue}if(o&&typeof o=="object"){let s=ke(me(me({},Yt),o),{contentWidth:e[r]});s.horizontalPadding=s.paddingLeft+s.paddingRight,u.push(s);continue}throw new Error(`Invalid column width: ${JSON.stringify(o)}`)}return u};function br(e,t){for(let n of e){let{width:u}=n;if(u==="content-width"&&(n.width=n.contentWidth),u==="auto"){let D=Math.min(20,n.contentWidth);n.width=D,n.autoOverflow=n.contentWidth-D}if(typeof u=="string"&&Vt.test(u)){let D=Number.parseFloat(u.slice(0,-1))/100;n.width=Math.floor(t*D)-(n.paddingLeft+n.paddingRight)}let{horizontalPadding:r}=n,o=1,s=o+r;if(s>=t){let D=s-t,l=Math.ceil(n.paddingLeft/r*D),f=D-l;n.paddingLeft-=l,n.paddingRight-=f,n.horizontalPadding=n.paddingLeft+n.paddingRight}n.paddingLeftString=n.paddingLeft?" ".repeat(n.paddingLeft):"",n.paddingRightString=n.paddingRight?" ".repeat(n.paddingRight):"";let i=t-n.horizontalPadding;n.width=Math.max(Math.min(n.width,i),o)}}var Jt=()=>Object.assign([],{columns:0});function wr(e,t){let n=[Jt()],[u]=n;for(let r of e){let o=r.width+r.horizontalPadding;u.columns+o>t&&(u=Jt(),n.push(u)),u.push(r),u.columns+=o}for(let r of n){let o=r.reduce((c,d)=>c+d.width+d.horizontalPadding,0),s=t-o;if(s===0)continue;let i=r.filter(c=>"autoOverflow"in c),D=i.filter(c=>c.autoOverflow>0),l=D.reduce((c,d)=>c+d.autoOverflow,0),f=Math.min(l,s);for(let c of D){let d=Math.floor(c.autoOverflow/l*f);c.width+=d,s-=d}let a=Math.floor(s/i.length);for(let c=0;c<i.length;c+=1){let d=i[c];c===i.length-1?d.width+=s:d.width+=a,s-=a}}return n}function Br(e,t,n){let u=yr(n,t);return br(u,e),wr(u,e)}A(),A(),A();var Re=10,Xt=(e=0)=>t=>`\x1B[${t+e}m`,Zt=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Qt=(e=0)=>(t,n,u)=>`\x1B[${38+e};2;${t};${n};${u}m`;function $r(){let e=new Map,t={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],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],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};t.color.gray=t.color.blackBright,t.bgColor.bgGray=t.bgColor.bgBlackBright,t.color.grey=t.color.blackBright,t.bgColor.bgGrey=t.bgColor.bgBlackBright;for(let[n,u]of Object.entries(t)){for(let[r,o]of Object.entries(u))t[r]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},u[r]=t[r],e.set(o[0],o[1]);Object.defineProperty(t,n,{value:u,enumerable:!1})}return Object.defineProperty(t,"codes",{value:e,enumerable:!1}),t.color.close="\x1B[39m",t.bgColor.close="\x1B[49m",t.color.ansi=Xt(),t.color.ansi256=Zt(),t.color.ansi16m=Qt(),t.bgColor.ansi=Xt(Re),t.bgColor.ansi256=Zt(Re),t.bgColor.ansi16m=Qt(Re),Object.defineProperties(t,{rgbToAnsi256:{value:(n,u,r)=>n===u&&u===r?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/255*5)+6*Math.round(u/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value:n=>{let u=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(n.toString(16));if(!u)return[0,0,0];let{colorString:r}=u.groups;r.length===3&&(r=r.split("").map(s=>s+s).join(""));let o=Number.parseInt(r,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:n=>t.rgbToAnsi256(...t.hexToRgb(n)),enumerable:!1},ansi256ToAnsi:{value:n=>{if(n<8)return 30+n;if(n<16)return 90+(n-8);let u,r,o;if(n>=232)u=((n-232)*10+8)/255,r=u,o=u;else{n-=16;let D=n%36;u=Math.floor(n/36)/5,r=Math.floor(D/6)/5,o=D%6/5}let s=Math.max(u,r,o)*2;if(s===0)return 30;let i=30+(Math.round(o)<<2|Math.round(r)<<1|Math.round(u));return s===2&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(n,u,r)=>t.ansi256ToAnsi(t.rgbToAnsi256(n,u,r)),enumerable:!1},hexToAnsi:{value:n=>t.ansi256ToAnsi(t.hexToAnsi256(n)),enumerable:!1}}),t}var vr=$r(),Ar=vr,Ce=new Set(["\x1B","\x9B"]),xr=39,Me="\x07",eu="[",Sr="]",tu="m",je=`${Sr}8;;`,uu=e=>`${Ce.values().next().value}${eu}${e}${tu}`,nu=e=>`${Ce.values().next().value}${je}${e}${Me}`,Or=e=>e.split(" ").map(t=>M(t)),Le=(e,t,n)=>{let u=[...t],r=!1,o=!1,s=M(zt(e[e.length-1]));for(let[i,D]of u.entries()){let l=M(D);if(s+l<=n?e[e.length-1]+=D:(e.push(D),s=0),Ce.has(D)&&(r=!0,o=u.slice(i+1).join("").startsWith(je)),r){o?D===Me&&(r=!1,o=!1):D===tu&&(r=!1);continue}s+=l,s===n&&i<u.length-1&&(e.push(""),s=0)}!s&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},Tr=e=>{let t=e.split(" "),n=t.length;for(;n>0&&!(M(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(" ")+t.slice(n).join("")},Ir=(e,t,n={})=>{if(n.trim!==!1&&e.trim()==="")return"";let u="",r,o,s=Or(e),i=[""];for(let[l,f]of e.split(" ").entries()){n.trim!==!1&&(i[i.length-1]=i[i.length-1].trimStart());let a=M(i[i.length-1]);if(l!==0&&(a>=t&&(n.wordWrap===!1||n.trim===!1)&&(i.push(""),a=0),(a>0||n.trim===!1)&&(i[i.length-1]+=" ",a++)),n.hard&&s[l]>t){let c=t-a,d=1+Math.floor((s[l]-c-1)/t);Math.floor((s[l]-1)/t)<d&&i.push(""),Le(i,f,t);continue}if(a+s[l]>t&&a>0&&s[l]>0){if(n.wordWrap===!1&&a<t){Le(i,f,t);continue}i.push("")}if(a+s[l]>t&&n.wordWrap===!1){Le(i,f,t);continue}i[i.length-1]+=f}n.trim!==!1&&(i=i.map(l=>Tr(l)));let D=[...i.join(`
|
|
4
|
+
`)];for(let[l,f]of D.entries()){if(u+=f,Ce.has(f)){let{groups:c}=new RegExp(`(?:\\${eu}(?<code>\\d+)m|\\${je}(?<uri>.*)${Me})`).exec(D.slice(l).join(""))||{groups:{}};if(c.code!==void 0){let d=Number.parseFloat(c.code);r=d===xr?void 0:d}else c.uri!==void 0&&(o=c.uri.length===0?void 0:c.uri)}let a=Ar.codes.get(Number(r));D[l+1]===`
|
|
5
5
|
`?(o&&(u+=nu("")),r&&a&&(u+=uu(a))):f===`
|
|
6
|
-
`&&(r&&a&&(u+=uu(r)),o&&(u+=nu(o)))}return u};function
|
|
6
|
+
`&&(r&&a&&(u+=uu(r)),o&&(u+=nu(o)))}return u};function Pr(e,t,n){return String(e).normalize().replace(/\r\n/g,`
|
|
7
7
|
`).split(`
|
|
8
8
|
`).map(u=>Ir(u,t,n)).join(`
|
|
9
|
-
`)}var ru=e=>Array.from({length:e}).fill("");function
|
|
10
|
-
`);if(D.postprocess){let{postprocess:c}=D;a=a.map((d,p)=>c.call(D,d,p))}return D.paddingTop&&a.unshift(...ru(D.paddingTop)),D.paddingBottom&&a.push(...ru(D.paddingBottom)),a.length>o&&(o=a.length),ke(
|
|
9
|
+
`)}var ru=e=>Array.from({length:e}).fill("");function _r(e,t){let n=[],u=0;for(let r of e){let o=0,s=r.map(D=>{var l;let f=(l=t[u])!=null?l:"";u+=1,D.preprocess&&(f=D.preprocess(f)),Kt(f)>D.width&&(f=Pr(f,D.width,{hard:!0}));let a=f.split(`
|
|
10
|
+
`);if(D.postprocess){let{postprocess:c}=D;a=a.map((d,p)=>c.call(D,d,p))}return D.paddingTop&&a.unshift(...ru(D.paddingTop)),D.paddingBottom&&a.push(...ru(D.paddingBottom)),a.length>o&&(o=a.length),ke(me({},D),{lines:a})}),i=[];for(let D=0;D<o;D+=1){let l=s.map(f=>{var a;let c=(a=f.lines[D])!=null?a:"",d=Number.isFinite(f.width)?" ".repeat(f.width-M(c)):"",p=f.paddingLeftString;return f.align==="right"&&(p+=d),p+=c,f.align==="left"&&(p+=d),p+f.paddingRightString}).join("");i.push(l)}n.push(i.join(`
|
|
11
11
|
`))}return n.join(`
|
|
12
|
-
`)}function
|
|
13
|
-
`)}A();var
|
|
14
|
-
`}}function
|
|
15
|
-
`}}function
|
|
12
|
+
`)}function kr(e,t){if(!e||e.length===0)return"";let n=Er(e),u=n.length;if(u===0)return"";let{stdoutColumns:r,columns:o}=Cr(t);if(o.length>u)throw new Error(`${o.length} columns defined, but only ${u} columns found`);let s=Br(r,o,n);return e.map(i=>_r(s,i)).join(`
|
|
13
|
+
`)}A();var Rr=["<",">","=",">=","<="];function Mr(e){if(!Rr.includes(e))throw new TypeError(`Invalid breakpoint operator: ${e}`)}function jr(e){let t=Object.keys(e).map(n=>{let[u,r]=n.split(" ");Mr(u);let o=Number.parseInt(r,10);if(Number.isNaN(o))throw new TypeError(`Invalid breakpoint value: ${r}`);let s=e[n];return{operator:u,breakpoint:o,value:s}}).sort((n,u)=>u.breakpoint-n.breakpoint);return n=>{var u;return(u=t.find(({operator:r,breakpoint:o})=>r==="="&&n===o||r===">"&&n>o||r==="<"&&n<o||r===">="&&n>=o||r==="<="&&n<=o))==null?void 0:u.value}}const Lr=e=>e.replace(/[\W_]([a-z\d])?/gi,(t,n)=>n?n.toUpperCase():""),Nr=e=>e.replace(/\B([A-Z])/g,"-$1").toLowerCase(),Gr={"> 80":[{width:"content-width",paddingLeft:2,paddingRight:8},{width:"auto"}],"> 40":[{width:"auto",paddingLeft:2,paddingRight:8,preprocess:e=>e.trim()},{width:"100%",paddingLeft:2,paddingBottom:1}],"> 0":{stdoutColumns:1e3,columns:[{width:"content-width",paddingLeft:2,paddingRight:8},{width:"content-width"}]}};function Ur(e){let t=!1;return{type:"table",data:{tableData:Object.keys(e).sort((n,u)=>n.localeCompare(u)).map(n=>{const u=e[n],r="alias"in u;return r&&(t=!0),{name:n,flag:u,flagFormatted:`--${Nr(n)}`,aliasesEnabled:t,aliasFormatted:r?`-${u.alias}`:void 0}}).map(n=>(n.aliasesEnabled=t,[{type:"flagName",data:n},{type:"flagDescription",data:n}])),tableBreakpoints:Gr}}}const ou=e=>!e||(e.version??(e.help?e.help.version:void 0)),su=e=>{const t="parent"in e&&e.parent?.name;return(t?`${t} `:"")+e.name};function Wr(e){const t=[];e.name&&t.push(su(e));const n=ou(e)??("parent"in e&&ou(e.parent));if(n&&t.push(`v${n}`),t.length!==0)return{id:"name",type:"text",data:`${t.join(" ")}
|
|
14
|
+
`}}function Hr(e){const{help:t}=e;if(!(!t||!t.description))return{id:"description",type:"text",data:`${t.description}
|
|
15
|
+
`}}function qr(e){const t=e.help||{};if("usage"in t)return t.usage?{id:"usage",type:"section",data:{title:"Usage:",body:Array.isArray(t.usage)?t.usage.join(`
|
|
16
16
|
`):t.usage}}:void 0;if(e.name){const n=[],u=[su(e)];if(e.flags&&Object.keys(e.flags).length>0&&u.push("[flags...]"),e.parameters&&e.parameters.length>0){const{parameters:r}=e,o=r.indexOf("--"),s=o>-1&&r.slice(o+1).some(i=>i.startsWith("<"));u.push(r.map(i=>i!=="--"?i:s?"--":"[--]").join(" "))}if(u.length>1&&n.push(u.join(" ")),"commands"in e&&e.commands?.length&&n.push(`${e.name} <command>`),n.length>0)return{id:"usage",type:"section",data:{title:"Usage:",body:n.join(`
|
|
17
|
-
`)}}}}function
|
|
18
|
-
`)),n)return{id:"examples",type:"section",data:{title:"Examples:",body:n}}}function
|
|
17
|
+
`)}}}}function zr(e){return!("commands"in e)||!e.commands?.length?void 0:{id:"commands",type:"section",data:{title:"Commands:",body:{type:"table",data:{tableData:e.commands.map(t=>[t.options.name,t.options.help?t.options.help.description:""]),tableOptions:[{width:"content-width",paddingLeft:2,paddingRight:8}]}},indentBody:0}}}function Kr(e){if(!(!e.flags||Object.keys(e.flags).length===0))return{id:"flags",type:"section",data:{title:"Flags:",body:Ur(e.flags),indentBody:0}}}function Vr(e){const{help:t}=e;if(!t||!t.examples||t.examples.length===0)return;let{examples:n}=t;if(Array.isArray(n)&&(n=n.join(`
|
|
18
|
+
`)),n)return{id:"examples",type:"section",data:{title:"Examples:",body:n}}}function Yr(e){if(!("alias"in e)||!e.alias)return;const{alias:t}=e;return{id:"aliases",type:"section",data:{title:"Aliases:",body:Array.isArray(t)?t.join(", "):t}}}const Jr=e=>[Wr,Hr,qr,zr,Kr,Vr,Yr].map(t=>t(e)).filter(Boolean),Xr=le.WriteStream.prototype.hasColors();class Zr{text(t){return t}bold(t){return Xr?`\x1B[1m${t}\x1B[22m`:t.toLocaleUpperCase()}indentText({text:t,spaces:n}){return t.replace(/^/gm," ".repeat(n))}heading(t){return this.bold(t)}section({title:t,body:n,indentBody:u=2}){return`${(t?`${this.heading(t)}
|
|
19
19
|
`:"")+(n?this.indentText({text:this.render(n),spaces:u}):"")}
|
|
20
|
-
`}table({tableData:t,tableOptions:n,tableBreakpoints:u}){return
|
|
21
|
-
`);if("type"in t&&this[t.type]){const n=this[t.type];if(typeof n=="function")return n.call(this,t.data)}throw new Error(`Invalid node type: ${JSON.stringify(t)}`)}}const Ne=/^[\w.-]+$/,{stringify:I}=JSON,
|
|
22
|
-
`),u(),process.exit(1);e[D]=l}}function
|
|
20
|
+
`}table({tableData:t,tableOptions:n,tableBreakpoints:u}){return kr(t.map(r=>r.map(o=>this.render(o))),u?jr(u):n)}flagParameter(t){return t===Boolean?"":t===String?"<string>":t===Number?"<number>":Array.isArray(t)?this.flagParameter(t[0]):"<value>"}flagOperator(t){return" "}flagName(t){const{flag:n,flagFormatted:u,aliasesEnabled:r,aliasFormatted:o}=t;let s="";if(o?s+=`${o}, `:r&&(s+=" "),s+=u,"placeholder"in n&&typeof n.placeholder=="string")s+=`${this.flagOperator(t)}${n.placeholder}`;else{const i=this.flagParameter("type"in n?n.type:n);i&&(s+=`${this.flagOperator(t)}${i}`)}return s}flagDefault(t){return JSON.stringify(t)}flagDescription({flag:t}){let n="description"in t?t.description??"":"";if("default"in t){let{default:u}=t;typeof u=="function"&&(u=u()),u&&(n+=` (default: ${this.flagDefault(u)})`)}return n}render(t){if(typeof t=="string")return t;if(Array.isArray(t))return t.map(n=>this.render(n)).join(`
|
|
21
|
+
`);if("type"in t&&this[t.type]){const n=this[t.type];if(typeof n=="function")return n.call(this,t.data)}throw new Error(`Invalid node type: ${JSON.stringify(t)}`)}}const Ne=/^[\w.-]+$/,{stringify:I}=JSON,Qr=/[|\\{}()[\]^$+*?.]/;function Ge(e){const t=[];let n,u;for(const r of e){if(u)throw new Error(`Invalid parameter: Spread parameter ${I(u)} must be last`);const o=r[0],s=r[r.length-1];let i;if(o==="<"&&s===">"&&(i=!0,n))throw new Error(`Invalid parameter: Required parameter ${I(r)} cannot come after optional parameter ${I(n)}`);if(o==="["&&s==="]"&&(i=!1,n=r),i===void 0)throw new Error(`Invalid parameter: ${I(r)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let D=r.slice(1,-1);const l=D.slice(-3)==="...";l&&(u=r,D=D.slice(0,-3));const f=D.match(Qr);if(f)throw new Error(`Invalid parameter: ${I(r)}. Invalid character found ${I(f[0])}`);t.push({name:D,required:i,spread:l})}return t}function Ue(e,t,n,u){for(let r=0;r<t.length;r+=1){const{name:o,required:s,spread:i}=t[r],D=Lr(o);if(D in e)throw new Error(`Invalid parameter: ${I(o)} is used more than once.`);const l=i?n.slice(r):n[r];if(i&&(r=t.length),s&&(!l||i&&l.length===0))return console.error(`Error: Missing required parameter ${I(o)}
|
|
22
|
+
`),u(),process.exit(1);e[D]=l}}function eo(e){return e===void 0||e!==!1}function iu(e,t,n,u){const r={...t.flags},o=t.version;o&&(r.version={type:Boolean,description:"Show version"});const{help:s}=t,i=eo(s);i&&!("help"in r)&&(r.help={type:Boolean,alias:"h",description:"Show help"});const D=ur(r,u,{ignore:t.ignoreArgv}),l=()=>{console.log(t.version)};if(o&&D.flags.version===!0)return l(),process.exit(0);const f=new Zr,a=i&&s?.render?s.render:p=>f.render(p),c=p=>{const C=Jr({...t,...p?{help:p}:{},flags:r});console.log(a(C,f))};if(i&&D.flags.help===!0)return c(),process.exit(0);if(t.parameters){let{parameters:p}=t,C=D._;const h=p.indexOf("--"),F=p.slice(h+1),B=Object.create(null);if(h>-1&&F.length>0){p=p.slice(0,h);const _=D._["--"];C=C.slice(0,-_.length||void 0),Ue(B,Ge(p),C,c),Ue(B,Ge(F),_,c)}else Ue(B,Ge(p),C,c);Object.assign(D._,B)}const d={...D,showVersion:l,showHelp:c};return typeof n=="function"&&n(d),{command:e,...d}}function to(e,t){const n=new Map;for(const u of t){const r=[u.options.name],{alias:o}=u.options;o&&(Array.isArray(o)?r.push(...o):r.push(o));for(const s of r){if(n.has(s))throw new Error(`Duplicate command name found: ${I(s)}`);n.set(s,u)}}return n.get(e)}function uo(e,t,n=process.argv.slice(2)){if(!e)throw new Error("Options is required");if("name"in e&&(!e.name||!Ne.test(e.name)))throw new Error(`Invalid script name: ${I(e.name)}`);const u=n[0];if(e.commands&&Ne.test(u)){const r=to(u,e.commands);if(r)return iu(r.options.name,{...r.options,parent:e},r.callback,n.slice(1))}return iu(void 0,e,t,n)}function Du(e,t){if(!e)throw new Error("Command options are required");const{name:n}=e;if(e.name===void 0)throw new Error("Command name is required");if(!Ne.test(n))throw new Error(`Invalid command name ${JSON.stringify(n)}. Command names must be one word.`);return{options:e,callback:t}}var au="1.10.0",no="Writes your git commit messages for you with AI",w=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},j={},ro={get exports(){return j},set exports(e){j=e}},We,cu;function oo(){if(cu)return We;cu=1,We=u,u.sync=r;var e=Pe;function t(o,s){var i=s.pathExt!==void 0?s.pathExt:process.env.PATHEXT;if(!i||(i=i.split(";"),i.indexOf("")!==-1))return!0;for(var D=0;D<i.length;D++){var l=i[D].toLowerCase();if(l&&o.substr(-l.length).toLowerCase()===l)return!0}return!1}function n(o,s,i){return!o.isSymbolicLink()&&!o.isFile()?!1:t(s,i)}function u(o,s,i){e.stat(o,function(D,l){i(D,D?!1:n(l,o,s))})}function r(o,s){return n(e.statSync(o),o,s)}return We}var He,lu;function so(){if(lu)return He;lu=1,He=t,t.sync=n;var e=Pe;function t(o,s,i){e.stat(o,function(D,l){i(D,D?!1:u(l,s))})}function n(o,s){return u(e.statSync(o),s)}function u(o,s){return o.isFile()&&r(o,s)}function r(o,s){var i=o.mode,D=o.uid,l=o.gid,f=s.uid!==void 0?s.uid:process.getuid&&process.getuid(),a=s.gid!==void 0?s.gid:process.getgid&&process.getgid(),c=parseInt("100",8),d=parseInt("010",8),p=parseInt("001",8),C=c|d,h=i&p||i&d&&l===a||i&c&&D===f||i&C&&f===0;return h}return He}var he;process.platform==="win32"||w.TESTING_WINDOWS?he=oo():he=so();var io=qe;qe.sync=Do;function qe(e,t,n){if(typeof t=="function"&&(n=t,t={}),!n){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(u,r){qe(e,t||{},function(o,s){o?r(o):u(s)})})}he(e,t||{},function(u,r){u&&(u.code==="EACCES"||t&&t.ignoreErrors)&&(u=null,r=!1),n(u,r)})}function Do(e,t){try{return he.sync(e,t||{})}catch(n){if(t&&t.ignoreErrors||n.code==="EACCES")return!1;throw n}}const H=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",fu=X,ao=H?";":":",du=io,pu=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),mu=(e,t)=>{const n=t.colon||ao,u=e.match(/\//)||H&&e.match(/\\/)?[""]:[...H?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(n)],r=H?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=H?r.split(n):[""];return H&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:u,pathExt:o,pathExtExe:r}},Cu=(e,t,n)=>{typeof t=="function"&&(n=t,t={}),t||(t={});const{pathEnv:u,pathExt:r,pathExtExe:o}=mu(e,t),s=[],i=l=>new Promise((f,a)=>{if(l===u.length)return t.all&&s.length?f(s):a(pu(e));const c=u[l],d=/^".*"$/.test(c)?c.slice(1,-1):c,p=fu.join(d,e),C=!d&&/^\.[\\\/]/.test(e)?e.slice(0,2)+p:p;f(D(C,l,0))}),D=(l,f,a)=>new Promise((c,d)=>{if(a===r.length)return c(i(f+1));const p=r[a];du(l+p,{pathExt:o},(C,h)=>{if(!C&&h)if(t.all)s.push(l+p);else return c(l+p);return c(D(l,f,a+1))})});return n?i(0).then(l=>n(null,l),n):i(0)},co=(e,t)=>{t=t||{};const{pathEnv:n,pathExt:u,pathExtExe:r}=mu(e,t),o=[];for(let s=0;s<n.length;s++){const i=n[s],D=/^".*"$/.test(i)?i.slice(1,-1):i,l=fu.join(D,e),f=!D&&/^\.[\\\/]/.test(e)?e.slice(0,2)+l:l;for(let a=0;a<u.length;a++){const c=f+u[a];try{if(du.sync(c,{pathExt:r}))if(t.all)o.push(c);else return c}catch{}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw pu(e)};var lo=Cu;Cu.sync=co;var Fe={},fo={get exports(){return Fe},set exports(e){Fe=e}};const hu=(e={})=>{const t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(u=>u.toUpperCase()==="PATH")||"Path"};fo.exports=hu,Fe.default=hu;const Fu=X,po=lo,mo=Fe;function gu(e,t){const n=e.options.env||process.env,u=process.cwd(),r=e.options.cwd!=null,o=r&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(e.options.cwd)}catch{}let s;try{s=po.sync(e.command,{path:n[mo({env:n})],pathExt:t?Fu.delimiter:void 0})}catch{}finally{o&&process.chdir(u)}return s&&(s=Fu.resolve(r?e.options.cwd:"",s)),s}function Co(e){return gu(e)||gu(e,!0)}var ho=Co,ze={};const Ke=/([()\][%!^"`<>&|;, *?])/g;function Fo(e){return e=e.replace(Ke,"^$1"),e}function go(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(Ke,"^$1"),t&&(e=e.replace(Ke,"^$1")),e}ze.command=Fo,ze.argument=go;var Eo=/^#!(.*)/;const yo=Eo;var bo=(e="")=>{const t=e.match(yo);if(!t)return null;const[n,u]=t[0].replace(/#! ?/,"").split(" "),r=n.split("/").pop();return r==="env"?u:u?`${r} ${u}`:r};const Ve=Pe,wo=bo;function Bo(e){const n=Buffer.alloc(150);let u;try{u=Ve.openSync(e,"r"),Ve.readSync(u,n,0,150,0),Ve.closeSync(u)}catch{}return wo(n.toString())}var $o=Bo;const vo=X,Eu=ho,yu=ze,Ao=$o,xo=process.platform==="win32",So=/\.(?:com|exe)$/i,Oo=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function To(e){e.file=Eu(e);const t=e.file&&Ao(e.file);return t?(e.args.unshift(e.file),e.command=t,Eu(e)):e.file}function Io(e){if(!xo)return e;const t=To(e),n=!So.test(t);if(e.options.forceShell||n){const u=Oo.test(t);e.command=vo.normalize(e.command),e.command=yu.command(e.command),e.args=e.args.map(o=>yu.argument(o,u));const r=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${r}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function Po(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);const u={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?u:Io(u)}var _o=Po;const Ye=process.platform==="win32";function Je(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function ko(e,t){if(!Ye)return;const n=e.emit;e.emit=function(u,r){if(u==="exit"){const o=bu(r,t);if(o)return n.call(e,"error",o)}return n.apply(e,arguments)}}function bu(e,t){return Ye&&e===1&&!t.file?Je(t.original,"spawn"):null}function Ro(e,t){return Ye&&e===1&&!t.file?Je(t.original,"spawnSync"):null}var Mo={hookChildProcess:ko,verifyENOENT:bu,verifyENOENTSync:Ro,notFoundError:Je};const wu=vn,Xe=_o,Ze=Mo;function Bu(e,t,n){const u=Xe(e,t,n),r=wu.spawn(u.command,u.args,u.options);return Ze.hookChildProcess(r,u),r}function jo(e,t,n){const u=Xe(e,t,n),r=wu.spawnSync(u.command,u.args,u.options);return r.error=r.error||Ze.verifyENOENTSync(r.status,u),r}ro.exports=Bu,j.spawn=Bu,j.sync=jo,j._parse=Xe,j._enoent=Ze;function Lo(e){const t=typeof e=="string"?`
|
|
23
23
|
`:`
|
|
24
|
-
`.charCodeAt(),n=typeof e=="string"?"\r":"\r".charCodeAt();return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===n&&(e=e.slice(0,-1)),e}function $u(e={}){const{env:t=process.env,platform:n=process.platform}=e;return n!=="win32"?"PATH":Object.keys(t).reverse().find(u=>u.toUpperCase()==="PATH")||"Path"}function
|
|
25
|
-
${t}`,
|
|
26
|
-
${u.message}`:
|
|
27
|
-
`);return h?(u.originalMessage=u.message,u.message=B):u=new Error(B),u.shortMessage=F,u.command=s,u.escapedCommand=i,u.exitCode=o,u.signal=r,u.signalDescription=c,u.stdout=e,u.stderr=t,n!==void 0&&(u.all=n),"bufferedData"in u&&delete u.bufferedData,u.failed=!0,u.timedOut=Boolean(D),u.isCanceled=l,u.killed=f&&!D,u},Ee=["stdin","stdout","stderr"],ss=e=>Ee.some(t=>e[t]!==void 0),is=e=>{if(!e)return;const{stdio:t}=e;if(t===void 0)return Ee.map(u=>e[u]);if(ss(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Ee.map(u=>`\`${u}\``).join(", ")}`);if(typeof t=="string")return t;if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);const n=Math.max(t.length,Ee.length);return Array.from({length:n},(u,r)=>t[r])};var q={},Iu={get exports(){return q},set exports(e){q=e}},ye={},Ds={get exports(){return ye},set exports(e){ye=e}},Tu;function as(){return Tu||(Tu=1,function(e){e.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"],process.platform!=="win32"&&e.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),process.platform==="linux"&&e.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")}(Ds)),ye}var g=w.process;const L=function(e){return e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function"};if(!L(g))Iu.exports=function(){return function(){}};else{var cs=Mt,ee=as(),ls=/^win/i.test(g.platform),be=jt;typeof be!="function"&&(be=be.EventEmitter);var $;g.__signal_exit_emitter__?$=g.__signal_exit_emitter__:($=g.__signal_exit_emitter__=new be,$.count=0,$.emitted={}),$.infinite||($.setMaxListeners(1/0),$.infinite=!0),Iu.exports=function(e,t){if(!L(w.process))return function(){};cs.equal(typeof e,"function","a callback must be provided for exit handler"),te===!1&&Pu();var n="exit";t&&t.alwaysLast&&(n="afterexit");var u=function(){$.removeListener(n,e),$.listeners("exit").length===0&&$.listeners("afterexit").length===0&&Qe()};return $.on(n,e),u};var Qe=function(){!te||!L(w.process)||(te=!1,ee.forEach(function(t){try{g.removeListener(t,et[t])}catch{}}),g.emit=tt,g.reallyExit=_u,$.count-=1)};q.unload=Qe;var z=function(t,n,u){$.emitted[t]||($.emitted[t]=!0,$.emit(t,n,u))},et={};ee.forEach(function(e){et[e]=function(){if(L(w.process)){var n=g.listeners(e);n.length===$.count&&(Qe(),z("exit",null,e),z("afterexit",null,e),ls&&e==="SIGHUP"&&(e="SIGINT"),g.kill(g.pid,e))}}}),q.signals=function(){return ee};var te=!1,Pu=function(){te||!L(w.process)||(te=!0,$.count+=1,ee=ee.filter(function(t){try{return g.on(t,et[t]),!0}catch{return!1}}),g.emit=ds,g.reallyExit=fs)};q.load=Pu;var _u=g.reallyExit,fs=function(t){L(w.process)&&(g.exitCode=t||0,z("exit",g.exitCode,null),z("afterexit",g.exitCode,null),_u.call(g,g.exitCode))},tt=g.emit,ds=function(t,n){if(t==="exit"&&L(w.process)){n!==void 0&&(g.exitCode=n);var u=tt.apply(this,arguments);return z("exit",g.exitCode,null),z("afterexit",g.exitCode,null),u}else return tt.apply(this,arguments)}}const ps=1e3*5,Cs=(e,t="SIGTERM",n={})=>{const u=e(t);return ms(e,t,n,u),u},ms=(e,t,n,u)=>{if(!hs(t,n,u))return;const r=gs(n),o=setTimeout(()=>{e("SIGKILL")},r);o.unref&&o.unref()},hs=(e,{forceKillAfterTimeout:t},n)=>Fs(e)&&t!==!1&&n,Fs=e=>e===xn.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",gs=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return ps;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Es=(e,t)=>{e.kill()&&(t.isCanceled=!0)},ys=(e,t,n)=>{e.kill(t),n(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},bs=(e,{timeout:t,killSignal:n="SIGTERM"},u)=>{if(t===0||t===void 0)return u;let r;const o=new Promise((i,D)=>{r=setTimeout(()=>{ys(e,n,D)},t)}),s=u.finally(()=>{clearTimeout(r)});return Promise.race([o,s])},ws=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},Bs=async(e,{cleanup:t,detached:n},u)=>{if(!t||n)return u;const r=q(()=>{e.kill()});return u.finally(()=>{r()})};function $s(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"}var N={},vs={get exports(){return N},set exports(e){N=e}};const{PassThrough:As}=_e;var xs=e=>{e={...e};const{array:t}=e;let{encoding:n}=e;const u=n==="buffer";let r=!1;t?r=!(n||u):n=n||"utf8",u&&(n=null);const o=new As({objectMode:r});n&&o.setEncoding(n);let s=0;const i=[];return o.on("data",D=>{i.push(D),r?s=i.length:s+=D.length}),o.getBufferedValue=()=>t?i:u?Buffer.concat(i,s):i.join(""),o.getBufferedLength=()=>s,o};const{constants:Ss}=Sn,Os=_e,{promisify:Is}=Lt,Ts=xs,Ps=Is(Os.pipeline);class ku extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}}async function ut(e,t){if(!e)throw new Error("Expected a stream");t={maxBuffer:1/0,...t};const{maxBuffer:n}=t,u=Ts(t);return await new Promise((r,o)=>{const s=i=>{i&&u.getBufferedLength()<=Ss.MAX_LENGTH&&(i.bufferedData=u.getBufferedValue()),o(i)};(async()=>{try{await Ps(e,u),r()}catch(i){s(i)}})(),u.on("data",()=>{u.getBufferedLength()>n&&s(new ku)})}),u.getBufferedValue()}vs.exports=ut,N.buffer=(e,t)=>ut(e,{...t,encoding:"buffer"}),N.array=(e,t)=>ut(e,{...t,array:!0}),N.MaxBufferError=ku;const{PassThrough:_s}=_e;var ks=function(){var e=[],t=new _s({objectMode:!0});return t.setMaxListeners(0),t.add=n,t.isEmpty=u,t.on("unpipe",r),Array.prototype.slice.call(arguments).forEach(n),t;function n(o){return Array.isArray(o)?(o.forEach(n),this):(e.push(o),o.once("end",r.bind(null,o)),o.once("error",t.emit.bind(t,"error")),o.pipe(t,{end:!1}),this)}function u(){return e.length==0}function r(o){e=e.filter(function(s){return s!==o}),!e.length&&t.readable&&t.end()}};const Rs=(e,t)=>{t!==void 0&&($s(t)?t.pipe(e.stdin):e.stdin.end(t))},Ms=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;const n=ks();return e.stdout&&n.add(e.stdout),e.stderr&&n.add(e.stderr),n},nt=async(e,t)=>{if(!(!e||t===void 0)){e.destroy();try{return await t}catch(n){return n.bufferedData}}},rt=(e,{encoding:t,buffer:n,maxBuffer:u})=>{if(!(!e||!n))return t?N(e,{encoding:t,maxBuffer:u}):N.buffer(e,{maxBuffer:u})},js=async({stdout:e,stderr:t,all:n},{encoding:u,buffer:r,maxBuffer:o},s)=>{const i=rt(e,{encoding:u,buffer:r,maxBuffer:o}),D=rt(t,{encoding:u,buffer:r,maxBuffer:o}),l=rt(n,{encoding:u,buffer:r,maxBuffer:o*2});try{return await Promise.all([s,i,D,l])}catch(f){return Promise.all([{error:f,signal:f.signal,timedOut:f.timedOut},nt(e,i),nt(t,D),nt(n,l)])}},Ls=(async()=>{})().constructor.prototype,Ns=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(Ls,e)]),Ru=(e,t)=>{for(const[n,u]of Ns){const r=typeof t=="function"?(...o)=>Reflect.apply(u.value,t(),o):u.value.bind(t);Reflect.defineProperty(e,n,{...u,value:r})}return e},Gs=e=>new Promise((t,n)=>{e.on("exit",(u,r)=>{t({exitCode:u,signal:r})}),e.on("error",u=>{n(u)}),e.stdin&&e.stdin.on("error",u=>{n(u)})}),Mu=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],Us=/^[\w.-]+$/,Ws=/"/g,Hs=e=>typeof e!="string"||Us.test(e)?e:`"${e.replace(Ws,'\\"')}"`,qs=(e,t)=>Mu(e,t).join(" "),zs=(e,t)=>Mu(e,t).map(n=>Hs(n)).join(" "),Ks=1e3*1e3*100,Vs=({env:e,extendEnv:t,preferLocal:n,localDir:u,execPath:r})=>{const o=t?{...b.env,...e}:e;return n?No({env:o,cwd:u,execPath:r}):o},Ys=(e,t,n={})=>{const u=j._parse(e,t,n);return e=u.command,t=u.args,n=u.options,n={maxBuffer:Ks,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:n.cwd||b.cwd(),execPath:b.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,...n},n.env=Vs(n),n.stdio=is(n),b.platform==="win32"&&W.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:n,parsed:u}},ot=(e,t,n)=>typeof t!="string"&&!$n.isBuffer(t)?n===void 0?void 0:"":e.stripFinalNewline?jo(t):t;function ue(e,t,n){const u=Ys(e,t,n),r=qs(e,t),o=zs(e,t);ws(u.options);let s;try{s=Pt.spawn(u.file,u.args,u.options)}catch(d){const p=new Pt.ChildProcess,m=Promise.reject(Ou({error:d,stdout:"",stderr:"",all:"",command:r,escapedCommand:o,parsed:u,timedOut:!1,isCanceled:!1,killed:!1}));return Ru(p,m)}const i=Gs(s),D=bs(s,u.options,i),l=Bs(s,u.options,D),f={isCanceled:!1};s.kill=Cs.bind(null,s.kill.bind(s)),s.cancel=Es.bind(null,s,f);const c=vu(async()=>{const[{error:d,exitCode:p,signal:m,timedOut:h},F,B,P]=await js(s,u.options,l),ce=ot(u.options,F),R=ot(u.options,B),Te=ot(u.options,P);if(d||p!==0||m!==null){const U=Ou({error:d,exitCode:p,signal:m,stdout:ce,stderr:R,all:Te,command:r,escapedCommand:o,parsed:u,timedOut:h,isCanceled:f.isCanceled||(u.options.signal?u.options.signal.aborted:!1),killed:s.killed});if(!u.options.reject)return U;throw U}return{command:r,escapedCommand:o,exitCode:0,stdout:ce,stderr:R,all:Te,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return Rs(s,u.options.input),s.all=Ms(s,u.options),Ru(s,c)}let G=!0;const K=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let ju=0;if(K.process&&K.process.env&&K.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:n,TERM:u}=K.process.env;t||n||e==="0"?G=!1:e==="1"||e==="2"||e==="3"?G=!0:u==="dumb"?G=!1:"CI"in K.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(r=>r in K.process.env)?G=!0:G=process.stdout.isTTY,G&&(ju=u&&u.endsWith("-256color")?2:1)}let Lu={enabled:G,supportLevel:ju};function ne(e,t,n=1){const u=`\x1B[${e}m`,r=`\x1B[${t}m`,o=new RegExp(`\\x1b\\[${t}m`,"g");return s=>Lu.enabled&&Lu.supportLevel>=n?u+(""+s).replace(o,u)+r:""+s}const st=ne(2,22),Nu=ne(30,39),we=ne(31,39),Be=ne(32,39),Gu=ne(46,49),it="\x1B",y=`${it}[`,Js="\x07",Dt={to(e,t){return t?`${y}${t+1};${e+1}H`:`${y}${e+1}G`},move(e,t){let n="";return e<0?n+=`${y}${-e}D`:e>0&&(n+=`${y}${e}C`),t<0?n+=`${y}${-t}A`:t>0&&(n+=`${y}${t}B`),n},up:(e=1)=>`${y}${e}A`,down:(e=1)=>`${y}${e}B`,forward:(e=1)=>`${y}${e}C`,backward:(e=1)=>`${y}${e}D`,nextLine:(e=1)=>`${y}E`.repeat(e),prevLine:(e=1)=>`${y}F`.repeat(e),left:`${y}G`,hide:`${y}?25l`,show:`${y}?25h`,save:`${it}7`,restore:`${it}8`},Xs={up:(e=1)=>`${y}S`.repeat(e),down:(e=1)=>`${y}T`.repeat(e)},Zs={screen:`${y}2J`,up:(e=1)=>`${y}1J`.repeat(e),down:(e=1)=>`${y}J`.repeat(e),line:`${y}2K`,lineEnd:`${y}K`,lineStart:`${y}1K`,lines(e){let t="";for(let n=0;n<e;n++)t+=this.line+(n<e-1?Dt.up():"");return e&&(t+=Dt.left),t}};var v={cursor:Dt,scroll:Xs,erase:Zs,beep:Js},C={},Qs={get exports(){return C},set exports(e){C=e}};let ei=le,ti=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||ei.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),E=(e,t,n=e)=>u=>{let r=""+u,o=r.indexOf(t,e.length);return~o?e+Uu(r,t,n,o)+t:e+r+t},Uu=(e,t,n,u)=>{let r=e.substring(0,u)+n,o=e.substring(u+t.length),s=o.indexOf(t);return~s?r+Uu(o,t,n,s):r+o},Wu=(e=ti)=>({isColorSupported:e,reset:e?t=>`\x1B[0m${t}\x1B[0m`:String,bold:e?E("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:e?E("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:e?E("\x1B[3m","\x1B[23m"):String,underline:e?E("\x1B[4m","\x1B[24m"):String,inverse:e?E("\x1B[7m","\x1B[27m"):String,hidden:e?E("\x1B[8m","\x1B[28m"):String,strikethrough:e?E("\x1B[9m","\x1B[29m"):String,black:e?E("\x1B[30m","\x1B[39m"):String,red:e?E("\x1B[31m","\x1B[39m"):String,green:e?E("\x1B[32m","\x1B[39m"):String,yellow:e?E("\x1B[33m","\x1B[39m"):String,blue:e?E("\x1B[34m","\x1B[39m"):String,magenta:e?E("\x1B[35m","\x1B[39m"):String,cyan:e?E("\x1B[36m","\x1B[39m"):String,white:e?E("\x1B[37m","\x1B[39m"):String,gray:e?E("\x1B[90m","\x1B[39m"):String,bgBlack:e?E("\x1B[40m","\x1B[49m"):String,bgRed:e?E("\x1B[41m","\x1B[49m"):String,bgGreen:e?E("\x1B[42m","\x1B[49m"):String,bgYellow:e?E("\x1B[43m","\x1B[49m"):String,bgBlue:e?E("\x1B[44m","\x1B[49m"):String,bgMagenta:e?E("\x1B[45m","\x1B[49m"):String,bgCyan:e?E("\x1B[46m","\x1B[49m"):String,bgWhite:e?E("\x1B[47m","\x1B[49m"):String});Qs.exports=Wu(),C.createColors=Wu;function ui(e,t){if(e===t)return;const n=e.split(`
|
|
24
|
+
`.charCodeAt(),n=typeof e=="string"?"\r":"\r".charCodeAt();return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===n&&(e=e.slice(0,-1)),e}function $u(e={}){const{env:t=process.env,platform:n=process.platform}=e;return n!=="win32"?"PATH":Object.keys(t).reverse().find(u=>u.toUpperCase()==="PATH")||"Path"}function No(e={}){const{cwd:t=b.cwd(),path:n=b.env[$u()],execPath:u=b.execPath}=e;let r;const o=t instanceof URL?An.fileURLToPath(t):t;let s=W.resolve(o);const i=[];for(;r!==s;)i.push(W.join(s,"node_modules/.bin")),r=s,s=W.resolve(s,"..");return i.push(W.resolve(o,u,"..")),[...i,n].join(W.delimiter)}function Go({env:e=b.env,...t}={}){e={...e};const n=$u({env:e});return t.path=e[n],e[n]=No(t),e}const Uo=(e,t,n,u)=>{if(n==="length"||n==="prototype"||n==="arguments"||n==="caller")return;const r=Object.getOwnPropertyDescriptor(e,n),o=Object.getOwnPropertyDescriptor(t,n);!Wo(r,o)&&u||Object.defineProperty(e,n,o)},Wo=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},Ho=(e,t)=>{const n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},qo=(e,t)=>`/* Wrapped ${e}*/
|
|
25
|
+
${t}`,zo=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Ko=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Vo=(e,t,n)=>{const u=n===""?"":`with ${n.trim()}() `,r=qo.bind(null,u,t.toString());Object.defineProperty(r,"name",Ko),Object.defineProperty(e,"toString",{...zo,value:r})};function Yo(e,t,{ignoreNonConfigurable:n=!1}={}){const{name:u}=e;for(const r of Reflect.ownKeys(t))Uo(e,t,r,n);return Ho(e,t),Vo(e,t,u),e}const ge=new WeakMap,vu=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let n,u=0;const r=e.displayName||e.name||"<anonymous>",o=function(...s){if(ge.set(o,++u),u===1)n=e.apply(this,s),e=null;else if(t.throw===!0)throw new Error(`Function \`${r}\` can only be called once`);return n};return Yo(o,e),ge.set(o,u),o};vu.callCount=e=>{if(!ge.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return ge.get(e)};const Jo=function(){const e=xu-Au+1;return Array.from({length:e},Xo)},Xo=function(e,t){return{name:`SIGRT${t+1}`,number:Au+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}},Au=34,xu=64,Zo=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}],Su=function(){const e=Jo();return[...Zo,...e].map(Qo)},Qo=function({name:e,number:t,description:n,action:u,forced:r=!1,standard:o}){const{signals:{[e]:s}}=Rt,i=s!==void 0;return{name:e,number:i?s:t,description:n,supported:i,action:u,forced:r,standard:o}},es=function(){const e=Su();return Object.fromEntries(e.map(ts))},ts=function({name:e,number:t,description:n,supported:u,action:r,forced:o,standard:s}){return[e,{name:e,number:t,description:n,supported:u,action:r,forced:o,standard:s}]},us=es(),ns=function(){const e=Su(),t=xu+1,n=Array.from({length:t},(u,r)=>rs(r,e));return Object.assign({},...n)},rs=function(e,t){const n=os(e,t);if(n===void 0)return{};const{name:u,description:r,supported:o,action:s,forced:i,standard:D}=n;return{[e]:{name:u,number:e,description:r,supported:o,action:s,forced:i,standard:D}}},os=function(e,t){const n=t.find(({name:u})=>Rt.signals[u]===e);return n!==void 0?n:t.find(u=>u.number===e)};ns();const ss=({timedOut:e,timeout:t,errorCode:n,signal:u,signalDescription:r,exitCode:o,isCanceled:s})=>e?`timed out after ${t} milliseconds`:s?"was canceled":n!==void 0?`failed with ${n}`:u!==void 0?`was killed with ${u} (${r})`:o!==void 0?`failed with exit code ${o}`:"failed",Ou=({stdout:e,stderr:t,all:n,error:u,signal:r,exitCode:o,command:s,escapedCommand:i,timedOut:D,isCanceled:l,killed:f,parsed:{options:{timeout:a}}})=>{o=o===null?void 0:o,r=r===null?void 0:r;const c=r===void 0?void 0:us[r].description,d=u&&u.code,C=`Command ${ss({timedOut:D,timeout:a,errorCode:d,signal:r,signalDescription:c,exitCode:o,isCanceled:l})}: ${s}`,h=Object.prototype.toString.call(u)==="[object Error]",F=h?`${C}
|
|
26
|
+
${u.message}`:C,B=[F,t,e].filter(Boolean).join(`
|
|
27
|
+
`);return h?(u.originalMessage=u.message,u.message=B):u=new Error(B),u.shortMessage=F,u.command=s,u.escapedCommand=i,u.exitCode=o,u.signal=r,u.signalDescription=c,u.stdout=e,u.stderr=t,n!==void 0&&(u.all=n),"bufferedData"in u&&delete u.bufferedData,u.failed=!0,u.timedOut=Boolean(D),u.isCanceled=l,u.killed=f&&!D,u},Ee=["stdin","stdout","stderr"],is=e=>Ee.some(t=>e[t]!==void 0),Ds=e=>{if(!e)return;const{stdio:t}=e;if(t===void 0)return Ee.map(u=>e[u]);if(is(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Ee.map(u=>`\`${u}\``).join(", ")}`);if(typeof t=="string")return t;if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);const n=Math.max(t.length,Ee.length);return Array.from({length:n},(u,r)=>t[r])};var q={},Tu={get exports(){return q},set exports(e){q=e}},ye={},as={get exports(){return ye},set exports(e){ye=e}},Iu;function cs(){return Iu||(Iu=1,function(e){e.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"],process.platform!=="win32"&&e.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),process.platform==="linux"&&e.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")}(as)),ye}var g=w.process;const L=function(e){return e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function"};if(!L(g))Tu.exports=function(){return function(){}};else{var ls=Mt,ee=cs(),fs=/^win/i.test(g.platform),be=jt;typeof be!="function"&&(be=be.EventEmitter);var $;g.__signal_exit_emitter__?$=g.__signal_exit_emitter__:($=g.__signal_exit_emitter__=new be,$.count=0,$.emitted={}),$.infinite||($.setMaxListeners(1/0),$.infinite=!0),Tu.exports=function(e,t){if(!L(w.process))return function(){};ls.equal(typeof e,"function","a callback must be provided for exit handler"),te===!1&&Pu();var n="exit";t&&t.alwaysLast&&(n="afterexit");var u=function(){$.removeListener(n,e),$.listeners("exit").length===0&&$.listeners("afterexit").length===0&&Qe()};return $.on(n,e),u};var Qe=function(){!te||!L(w.process)||(te=!1,ee.forEach(function(t){try{g.removeListener(t,et[t])}catch{}}),g.emit=tt,g.reallyExit=_u,$.count-=1)};q.unload=Qe;var z=function(t,n,u){$.emitted[t]||($.emitted[t]=!0,$.emit(t,n,u))},et={};ee.forEach(function(e){et[e]=function(){if(L(w.process)){var n=g.listeners(e);n.length===$.count&&(Qe(),z("exit",null,e),z("afterexit",null,e),fs&&e==="SIGHUP"&&(e="SIGINT"),g.kill(g.pid,e))}}}),q.signals=function(){return ee};var te=!1,Pu=function(){te||!L(w.process)||(te=!0,$.count+=1,ee=ee.filter(function(t){try{return g.on(t,et[t]),!0}catch{return!1}}),g.emit=ps,g.reallyExit=ds)};q.load=Pu;var _u=g.reallyExit,ds=function(t){L(w.process)&&(g.exitCode=t||0,z("exit",g.exitCode,null),z("afterexit",g.exitCode,null),_u.call(g,g.exitCode))},tt=g.emit,ps=function(t,n){if(t==="exit"&&L(w.process)){n!==void 0&&(g.exitCode=n);var u=tt.apply(this,arguments);return z("exit",g.exitCode,null),z("afterexit",g.exitCode,null),u}else return tt.apply(this,arguments)}}const ms=1e3*5,Cs=(e,t="SIGTERM",n={})=>{const u=e(t);return hs(e,t,n,u),u},hs=(e,t,n,u)=>{if(!Fs(t,n,u))return;const r=Es(n),o=setTimeout(()=>{e("SIGKILL")},r);o.unref&&o.unref()},Fs=(e,{forceKillAfterTimeout:t},n)=>gs(e)&&t!==!1&&n,gs=e=>e===xn.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",Es=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return ms;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},ys=(e,t)=>{e.kill()&&(t.isCanceled=!0)},bs=(e,t,n)=>{e.kill(t),n(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},ws=(e,{timeout:t,killSignal:n="SIGTERM"},u)=>{if(t===0||t===void 0)return u;let r;const o=new Promise((i,D)=>{r=setTimeout(()=>{bs(e,n,D)},t)}),s=u.finally(()=>{clearTimeout(r)});return Promise.race([o,s])},Bs=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},$s=async(e,{cleanup:t,detached:n},u)=>{if(!t||n)return u;const r=q(()=>{e.kill()});return u.finally(()=>{r()})};function vs(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"}var N={},As={get exports(){return N},set exports(e){N=e}};const{PassThrough:xs}=_e;var Ss=e=>{e={...e};const{array:t}=e;let{encoding:n}=e;const u=n==="buffer";let r=!1;t?r=!(n||u):n=n||"utf8",u&&(n=null);const o=new xs({objectMode:r});n&&o.setEncoding(n);let s=0;const i=[];return o.on("data",D=>{i.push(D),r?s=i.length:s+=D.length}),o.getBufferedValue=()=>t?i:u?Buffer.concat(i,s):i.join(""),o.getBufferedLength=()=>s,o};const{constants:Os}=Sn,Ts=_e,{promisify:Is}=Lt,Ps=Ss,_s=Is(Ts.pipeline);class ku extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}}async function ut(e,t){if(!e)throw new Error("Expected a stream");t={maxBuffer:1/0,...t};const{maxBuffer:n}=t,u=Ps(t);return await new Promise((r,o)=>{const s=i=>{i&&u.getBufferedLength()<=Os.MAX_LENGTH&&(i.bufferedData=u.getBufferedValue()),o(i)};(async()=>{try{await _s(e,u),r()}catch(i){s(i)}})(),u.on("data",()=>{u.getBufferedLength()>n&&s(new ku)})}),u.getBufferedValue()}As.exports=ut,N.buffer=(e,t)=>ut(e,{...t,encoding:"buffer"}),N.array=(e,t)=>ut(e,{...t,array:!0}),N.MaxBufferError=ku;const{PassThrough:ks}=_e;var Rs=function(){var e=[],t=new ks({objectMode:!0});return t.setMaxListeners(0),t.add=n,t.isEmpty=u,t.on("unpipe",r),Array.prototype.slice.call(arguments).forEach(n),t;function n(o){return Array.isArray(o)?(o.forEach(n),this):(e.push(o),o.once("end",r.bind(null,o)),o.once("error",t.emit.bind(t,"error")),o.pipe(t,{end:!1}),this)}function u(){return e.length==0}function r(o){e=e.filter(function(s){return s!==o}),!e.length&&t.readable&&t.end()}};const Ms=(e,t)=>{t!==void 0&&(vs(t)?t.pipe(e.stdin):e.stdin.end(t))},js=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;const n=Rs();return e.stdout&&n.add(e.stdout),e.stderr&&n.add(e.stderr),n},nt=async(e,t)=>{if(!(!e||t===void 0)){e.destroy();try{return await t}catch(n){return n.bufferedData}}},rt=(e,{encoding:t,buffer:n,maxBuffer:u})=>{if(!(!e||!n))return t?N(e,{encoding:t,maxBuffer:u}):N.buffer(e,{maxBuffer:u})},Ls=async({stdout:e,stderr:t,all:n},{encoding:u,buffer:r,maxBuffer:o},s)=>{const i=rt(e,{encoding:u,buffer:r,maxBuffer:o}),D=rt(t,{encoding:u,buffer:r,maxBuffer:o}),l=rt(n,{encoding:u,buffer:r,maxBuffer:o*2});try{return await Promise.all([s,i,D,l])}catch(f){return Promise.all([{error:f,signal:f.signal,timedOut:f.timedOut},nt(e,i),nt(t,D),nt(n,l)])}},Ns=(async()=>{})().constructor.prototype,Gs=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(Ns,e)]),Ru=(e,t)=>{for(const[n,u]of Gs){const r=typeof t=="function"?(...o)=>Reflect.apply(u.value,t(),o):u.value.bind(t);Reflect.defineProperty(e,n,{...u,value:r})}return e},Us=e=>new Promise((t,n)=>{e.on("exit",(u,r)=>{t({exitCode:u,signal:r})}),e.on("error",u=>{n(u)}),e.stdin&&e.stdin.on("error",u=>{n(u)})}),Mu=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],Ws=/^[\w.-]+$/,Hs=/"/g,qs=e=>typeof e!="string"||Ws.test(e)?e:`"${e.replace(Hs,'\\"')}"`,zs=(e,t)=>Mu(e,t).join(" "),Ks=(e,t)=>Mu(e,t).map(n=>qs(n)).join(" "),Vs=1e3*1e3*100,Ys=({env:e,extendEnv:t,preferLocal:n,localDir:u,execPath:r})=>{const o=t?{...b.env,...e}:e;return n?Go({env:o,cwd:u,execPath:r}):o},Js=(e,t,n={})=>{const u=j._parse(e,t,n);return e=u.command,t=u.args,n=u.options,n={maxBuffer:Vs,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:n.cwd||b.cwd(),execPath:b.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,...n},n.env=Ys(n),n.stdio=Ds(n),b.platform==="win32"&&W.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:n,parsed:u}},ot=(e,t,n)=>typeof t!="string"&&!$n.isBuffer(t)?n===void 0?void 0:"":e.stripFinalNewline?Lo(t):t;function ue(e,t,n){const u=Js(e,t,n),r=zs(e,t),o=Ks(e,t);Bs(u.options);let s;try{s=Pt.spawn(u.file,u.args,u.options)}catch(d){const p=new Pt.ChildProcess,C=Promise.reject(Ou({error:d,stdout:"",stderr:"",all:"",command:r,escapedCommand:o,parsed:u,timedOut:!1,isCanceled:!1,killed:!1}));return Ru(p,C)}const i=Us(s),D=ws(s,u.options,i),l=$s(s,u.options,D),f={isCanceled:!1};s.kill=Cs.bind(null,s.kill.bind(s)),s.cancel=ys.bind(null,s,f);const c=vu(async()=>{const[{error:d,exitCode:p,signal:C,timedOut:h},F,B,_]=await Ls(s,u.options,l),ce=ot(u.options,F),R=ot(u.options,B),Ie=ot(u.options,_);if(d||p!==0||C!==null){const U=Ou({error:d,exitCode:p,signal:C,stdout:ce,stderr:R,all:Ie,command:r,escapedCommand:o,parsed:u,timedOut:h,isCanceled:f.isCanceled||(u.options.signal?u.options.signal.aborted:!1),killed:s.killed});if(!u.options.reject)return U;throw U}return{command:r,escapedCommand:o,exitCode:0,stdout:ce,stderr:R,all:Ie,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return Ms(s,u.options.input),s.all=js(s,u.options),Ru(s,c)}let G=!0;const K=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let ju=0;if(K.process&&K.process.env&&K.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:n,TERM:u}=K.process.env;t||n||e==="0"?G=!1:e==="1"||e==="2"||e==="3"?G=!0:u==="dumb"?G=!1:"CI"in K.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(r=>r in K.process.env)?G=!0:G=process.stdout.isTTY,G&&(ju=u&&u.endsWith("-256color")?2:1)}let Lu={enabled:G,supportLevel:ju};function ne(e,t,n=1){const u=`\x1B[${e}m`,r=`\x1B[${t}m`,o=new RegExp(`\\x1b\\[${t}m`,"g");return s=>Lu.enabled&&Lu.supportLevel>=n?u+(""+s).replace(o,u)+r:""+s}const st=ne(2,22),Nu=ne(30,39),we=ne(31,39),Be=ne(32,39),Gu=ne(46,49),it="\x1B",y=`${it}[`,Xs="\x07",Dt={to(e,t){return t?`${y}${t+1};${e+1}H`:`${y}${e+1}G`},move(e,t){let n="";return e<0?n+=`${y}${-e}D`:e>0&&(n+=`${y}${e}C`),t<0?n+=`${y}${-t}A`:t>0&&(n+=`${y}${t}B`),n},up:(e=1)=>`${y}${e}A`,down:(e=1)=>`${y}${e}B`,forward:(e=1)=>`${y}${e}C`,backward:(e=1)=>`${y}${e}D`,nextLine:(e=1)=>`${y}E`.repeat(e),prevLine:(e=1)=>`${y}F`.repeat(e),left:`${y}G`,hide:`${y}?25l`,show:`${y}?25h`,save:`${it}7`,restore:`${it}8`},Zs={up:(e=1)=>`${y}S`.repeat(e),down:(e=1)=>`${y}T`.repeat(e)},Qs={screen:`${y}2J`,up:(e=1)=>`${y}1J`.repeat(e),down:(e=1)=>`${y}J`.repeat(e),line:`${y}2K`,lineEnd:`${y}K`,lineStart:`${y}1K`,lines(e){let t="";for(let n=0;n<e;n++)t+=this.line+(n<e-1?Dt.up():"");return e&&(t+=Dt.left),t}};var v={cursor:Dt,scroll:Zs,erase:Qs,beep:Xs},m={},ei={get exports(){return m},set exports(e){m=e}};let ti=le,ui=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||ti.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),E=(e,t,n=e)=>u=>{let r=""+u,o=r.indexOf(t,e.length);return~o?e+Uu(r,t,n,o)+t:e+r+t},Uu=(e,t,n,u)=>{let r=e.substring(0,u)+n,o=e.substring(u+t.length),s=o.indexOf(t);return~s?r+Uu(o,t,n,s):r+o},Wu=(e=ui)=>({isColorSupported:e,reset:e?t=>`\x1B[0m${t}\x1B[0m`:String,bold:e?E("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:e?E("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:e?E("\x1B[3m","\x1B[23m"):String,underline:e?E("\x1B[4m","\x1B[24m"):String,inverse:e?E("\x1B[7m","\x1B[27m"):String,hidden:e?E("\x1B[8m","\x1B[28m"):String,strikethrough:e?E("\x1B[9m","\x1B[29m"):String,black:e?E("\x1B[30m","\x1B[39m"):String,red:e?E("\x1B[31m","\x1B[39m"):String,green:e?E("\x1B[32m","\x1B[39m"):String,yellow:e?E("\x1B[33m","\x1B[39m"):String,blue:e?E("\x1B[34m","\x1B[39m"):String,magenta:e?E("\x1B[35m","\x1B[39m"):String,cyan:e?E("\x1B[36m","\x1B[39m"):String,white:e?E("\x1B[37m","\x1B[39m"):String,gray:e?E("\x1B[90m","\x1B[39m"):String,bgBlack:e?E("\x1B[40m","\x1B[49m"):String,bgRed:e?E("\x1B[41m","\x1B[49m"):String,bgGreen:e?E("\x1B[42m","\x1B[49m"):String,bgYellow:e?E("\x1B[43m","\x1B[49m"):String,bgBlue:e?E("\x1B[44m","\x1B[49m"):String,bgMagenta:e?E("\x1B[45m","\x1B[49m"):String,bgCyan:e?E("\x1B[46m","\x1B[49m"):String,bgWhite:e?E("\x1B[47m","\x1B[49m"):String});ei.exports=Wu(),m.createColors=Wu;function ni(e,t){if(e===t)return;const n=e.split(`
|
|
28
28
|
`),u=t.split(`
|
|
29
|
-
`),r=[];for(let o=0;o<Math.max(n.length,u.length);o++)n[o]!==u[o]&&r.push(o);return r}const Hu=Symbol("clack:cancel");function qu(e){return e===Hu}function $e(e,t){e.isTTY&&e.setRawMode(t)}const zu=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),
|
|
29
|
+
`),r=[];for(let o=0;o<Math.max(n.length,u.length);o++)n[o]!==u[o]&&r.push(o);return r}const Hu=Symbol("clack:cancel");function qu(e){return e===Hu}function $e(e,t){e.isTTY&&e.setRawMode(t)}const zu=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),ri=new Set(["up","down","left","right","space","enter"]);class Ku{constructor({render:t,input:n=_t,output:u=kt,...r},o=!0){this._track=!1,this._cursor=0,this.state="initial",this.error="",this.subscribers=new Map,this._prevFrame="",this.opts=r,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=t.bind(this),this._track=o,this.input=n,this.output=u}prompt(){const t=new On(0);return t._write=(n,u,r)=>{this._track&&(this.value=this.rl.line.replace(/\t/g,""),this._cursor=this.rl.cursor,this.emit("value",this.value)),r()},this.input.pipe(t),this.rl=Nt.createInterface({input:this.input,output:t,tabSize:2,prompt:"",escapeCodeTimeout:50}),Nt.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),$e(this.input,!0),this.render(),new Promise((n,u)=>{this.once("submit",()=>{this.output.write(v.cursor.show),$e(this.input,!1),n(this.value)}),this.once("cancel",()=>{this.output.write(v.cursor.show),$e(this.input,!1),n(Hu)})})}on(t,n){const u=this.subscribers.get(t)??[];u.push({cb:n}),this.subscribers.set(t,u)}once(t,n){const u=this.subscribers.get(t)??[];u.push({cb:n,once:!0}),this.subscribers.set(t,u)}emit(t,...n){const u=this.subscribers.get(t)??[],r=[];for(const o of u)o.cb(...n),o.once&&r.push(()=>u.splice(u.indexOf(o),1));for(const o of r)o()}unsubscribe(){this.subscribers.clear()}onKeypress(t,n){if(this.state==="error"&&(this.state="active"),n?.name&&!this._track&&zu.has(n.name)&&this.emit("cursor",zu.get(n.name)),n?.name&&ri.has(n.name)&&this.emit("cursor",n.name),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),t&&this.emit("key",t.toLowerCase()),n?.name==="return"){if(this.opts.validate){const u=this.opts.validate(this.value);u&&(this.error=u,this.state="error",this.rl.write(this.value))}this.state!=="error"&&(this.state="submit")}t===""&&(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(`
|
|
30
30
|
`),$e(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const t=this._prevFrame.split(`
|
|
31
|
-
`).length-1;this.output.write(v.cursor.move(-999,t*-1))}render(){const t=this._render(this)??"";if(t!==this._prevFrame){if(this.state==="initial")this.output.write(v.cursor.hide);else{const n=
|
|
31
|
+
`).length-1;this.output.write(v.cursor.move(-999,t*-1))}render(){const t=this._render(this)??"";if(t!==this._prevFrame){if(this.state==="initial")this.output.write(v.cursor.hide);else{const n=ni(this._prevFrame,t);if(this.restoreCursor(),n&&n?.length===1){const u=n[0];this.output.write(v.cursor.move(0,u)),this.output.write(v.erase.lines(1));const r=t.split(`
|
|
32
32
|
`);this.output.write(r[u]),this._prevFrame=t,this.output.write(v.cursor.move(0,r.length-u-1));return}else if(n&&n?.length>1){const u=n[0];this.output.write(v.cursor.move(0,u)),this.output.write(v.erase.down());const r=t.split(`
|
|
33
33
|
`).slice(u);this.output.write(r.join(`
|
|
34
|
-
`)),this._prevFrame=t;return}this.output.write(v.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}class
|
|
34
|
+
`)),this._prevFrame=t;return}this.output.write(v.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}class oi extends Ku{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",n=>{this.output.write(v.cursor.move(0,-1)),this.value=n,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}class si extends Ku{constructor(t){super(t,!1),this.cursor=0,this.options=t.options,this.cursor=this.options.findIndex(({value:n})=>n===t.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",n=>{switch(n){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}}function ii({input:e=_t,output:t=kt,overwrite:n=!0,hideCursor:u=!0}={}){const r=fe.createInterface({input:e,output:t,prompt:"",tabSize:1});fe.emitKeypressEvents(e,r),e.isTTY&&e.setRawMode(!0);const o=(s,{name:i})=>{if(String(s)===""&&process.exit(0),!n)return;let D=i==="return"?0:-1,l=i==="return"?-1:0;fe.moveCursor(t,D,l,()=>{fe.clearLine(t,1,()=>{e.once("keypress",o)})})};return u&&process.stdout.write(v.cursor.hide),e.once("keypress",o),()=>{e.off("keypress",o),u&&process.stdout.write(v.cursor.show),r.terminal=!1,r.close()}}function Di(){return b.platform!=="win32"?b.env.TERM!=="linux":Boolean(b.env.CI)||Boolean(b.env.WT_SESSION)||Boolean(b.env.TERMINUS_SUBLIME)||b.env.ConEmuTask==="{cmd::Cmder}"||b.env.TERM_PROGRAM==="Terminus-Sublime"||b.env.TERM_PROGRAM==="vscode"||b.env.TERM==="xterm-256color"||b.env.TERM==="alacritty"||b.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const at=Di(),k=(e,t)=>at?e:t,ai=k("\u25C6","*"),ci=k("\u25A0","x"),li=k("\u25B2","x"),Vu=k("\u25C7","o"),fi=k("\u250C","T"),x=k("\u2502","|"),ct=k("\u2514","\u2014"),lt=k("\u25CF",">"),ft=k("\u25CB"," "),Yu=e=>{switch(e){case"initial":case"active":return m.cyan(ai);case"cancel":return m.red(ci);case"error":return m.yellow(li);case"submit":return m.green(Vu)}},di=e=>{const t=e.active??"Yes",n=e.inactive??"No";return new oi({active:t,inactive:n,initialValue:e.initialValue??!0,render(){const u=`${m.gray(x)}
|
|
35
35
|
${Yu(this.state)} ${e.message}
|
|
36
|
-
`,r=this.value?t:n;switch(this.state){case"submit":return`${u}${
|
|
37
|
-
${
|
|
38
|
-
${
|
|
39
|
-
`}}}).prompt()},
|
|
36
|
+
`,r=this.value?t:n;switch(this.state){case"submit":return`${u}${m.gray(x)} ${m.dim(r)}`;case"cancel":return`${u}${m.gray(x)} ${m.strikethrough(m.dim(r))}
|
|
37
|
+
${m.gray(x)}`;default:return`${u}${m.cyan(x)} ${this.value?`${m.green(lt)} ${t}`:`${m.dim(ft)} ${m.dim(t)}`} ${m.dim("/")} ${this.value?`${m.dim(ft)} ${m.dim(n)}`:`${m.green(lt)} ${n}`}
|
|
38
|
+
${m.cyan(ct)}
|
|
39
|
+
`}}}).prompt()},pi=e=>{const t=(n,u)=>{const r=n.label??String(n.value);return u==="active"?`${m.green(lt)} ${r} ${n.hint?m.dim(`(${n.hint})`):""}`:u==="selected"?`${m.dim(r)}`:u==="cancelled"?`${m.strikethrough(m.dim(r))}`:`${m.dim(ft)} ${m.dim(r)}`};return new si({options:e.options,initialValue:e.initialValue,render(){const n=`${m.gray(x)}
|
|
40
40
|
${Yu(this.state)} ${e.message}
|
|
41
|
-
`;switch(this.state){case"submit":return`${n}${
|
|
42
|
-
${
|
|
43
|
-
${
|
|
44
|
-
${
|
|
45
|
-
`}}}).prompt()},Ju=(e="")=>{process.stdout.write(`${
|
|
46
|
-
`)},V=(e="")=>{process.stdout.write(`${
|
|
47
|
-
${
|
|
41
|
+
`;switch(this.state){case"submit":return`${n}${m.gray(x)} ${t(this.options[this.cursor],"selected")}`;case"cancel":return`${n}${m.gray(x)} ${t(this.options[this.cursor],"cancelled")}
|
|
42
|
+
${m.gray(x)}`;default:return`${n}${m.cyan(x)} ${this.options.map((u,r)=>t(u,r===this.cursor?"active":"inactive")).join(`
|
|
43
|
+
${m.cyan(x)} `)}
|
|
44
|
+
${m.cyan(ct)}
|
|
45
|
+
`}}}).prompt()},Ju=(e="")=>{process.stdout.write(`${m.gray(fi)} ${e}
|
|
46
|
+
`)},V=(e="")=>{process.stdout.write(`${m.gray(x)}
|
|
47
|
+
${m.gray(ct)} ${e}
|
|
48
48
|
|
|
49
|
-
`)},dt=at?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],pt=()=>{let e,t;const n=at?80:120;return{start(u=""){u=u.replace(/\.?\.?\.$/,""),e=
|
|
50
|
-
${
|
|
51
|
-
`);let r=0,o=0;t=setInterval(()=>{let s=dt[r];process.stdout.write(v.cursor.move(-999,-1)),process.stdout.write(`${
|
|
52
|
-
`),r=r===dt.length-1?0:r+1,o=o===dt.length?0:o+.125},n)},stop(u=""){process.stdout.write(v.cursor.move(-999,-2)),process.stdout.write(v.erase.down(2)),clearInterval(t),process.stdout.write(`${
|
|
53
|
-
${
|
|
54
|
-
`),e()}}};class S extends Error{}const
|
|
49
|
+
`)},dt=at?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],pt=()=>{let e,t;const n=at?80:120;return{start(u=""){u=u.replace(/\.?\.?\.$/,""),e=ii(),process.stdout.write(`${m.gray(x)}
|
|
50
|
+
${m.magenta("\u25CB")} ${u}
|
|
51
|
+
`);let r=0,o=0;t=setInterval(()=>{let s=dt[r];process.stdout.write(v.cursor.move(-999,-1)),process.stdout.write(`${m.magenta(s)} ${u}${Math.floor(o)>=1?".".repeat(Math.floor(o)).slice(0,3):""}
|
|
52
|
+
`),r=r===dt.length-1?0:r+1,o=o===dt.length?0:o+.125},n)},stop(u=""){process.stdout.write(v.cursor.move(-999,-2)),process.stdout.write(v.erase.down(2)),clearInterval(t),process.stdout.write(`${m.gray(x)}
|
|
53
|
+
${m.green(Vu)} ${u}
|
|
54
|
+
`),e()}}};class S extends Error{}const mt=" ",ve=e=>{e instanceof Error&&!(e instanceof S)&&(e.stack&&console.error(st(e.stack.split(`
|
|
55
55
|
`).slice(1).join(`
|
|
56
56
|
`))),console.error(`
|
|
57
|
-
${
|
|
58
|
-
${
|
|
59
|
-
`),diff:u}},
|
|
57
|
+
${mt}${st(`aicommits v${au}`)}`),console.error(`
|
|
58
|
+
${mt}Please open a Bug report with the information above:`),console.error(`${mt}https://github.com/Nutlope/aicommits/issues/new/choose`))},Xu=async()=>{const{stdout:e}=await ue("git",["rev-parse","--is-inside-work-tree"],{reject:!1});if(e!=="true")throw new S("The current directory must be a Git repository!")},Ct=e=>`:(exclude)${e}`,Zu=["package-lock.json","pnpm-lock.yaml","*.lock"].map(Ct),Qu=async e=>{const t=["diff","--cached","--diff-algorithm=minimal"],{stdout:n}=await ue("git",[...t,"--name-only",...Zu,...e?e.map(Ct):[]]);if(!n)return;const{stdout:u}=await ue("git",[...t,...Zu,...e?e.map(Ct):[]]);return{files:n.split(`
|
|
59
|
+
`),diff:u}},mi=e=>`Detected ${e.length.toLocaleString()} staged file${e.length>1?"s":""}`,{hasOwnProperty:ht}=Object.prototype,Ae=typeof process<"u"&&process.platform==="win32"?`\r
|
|
60
60
|
`:`
|
|
61
|
-
`,Ft=(e,t)=>{const n=[];let u="";typeof t=="string"?t={section:t,whitespace:!1}:(t=t||Object.create(null),t.whitespace=t.whitespace===!0);const r=t.whitespace?" = ":"=";for(const o of Object.keys(e)){const s=e[o];if(s&&Array.isArray(s))for(const i of s)u+=Y(o+"[]")+r+Y(i)+Ae;else s&&typeof s=="object"?n.push(o):u+=Y(o)+r+Y(s)+Ae}t.section&&u.length&&(u="["+Y(t.section)+"]"+Ae+u);for(const o of n){const s=en(o).join("\\."),i=(t.section?t.section+".":"")+s,{whitespace:D}=t,l=Ft(e[o],{section:i,whitespace:D});u.length&&l.length&&(u+=Ae),u+=l}return u},en=e=>e.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(t=>t.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")),tn=e=>{const t=Object.create(null);let n=t,u=null;const r=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,o=e.split(/[\r\n]+/g);for(const i of o){if(!i||i.match(/^\s*[;#]/))continue;const D=i.match(r);if(!D)continue;if(D[1]!==void 0){if(u=xe(D[1]),u==="__proto__"){n=Object.create(null);continue}n=t[u]=t[u]||Object.create(null);continue}const l=xe(D[2]),f=l.length>2&&l.slice(-2)==="[]",a=f?l.slice(0,-2):l;if(a==="__proto__")continue;const c=D[3]?xe(D[4]):!0,d=c==="true"||c==="false"||c==="null"?JSON.parse(c):c;f&&(ht.call(n,a)?Array.isArray(n[a])||(n[a]=[n[a]]):n[a]=[]),Array.isArray(n[a])?n[a].push(d):n[a]=d}const s=[];for(const i of Object.keys(t)){if(!ht.call(t,i)||typeof t[i]!="object"||Array.isArray(t[i]))continue;const D=en(i);n=t;const l=D.pop(),f=l.replace(/\\\./g,".");for(const a of D)a!=="__proto__"&&((!ht.call(n,a)||typeof n[a]!="object")&&(n[a]=Object.create(null)),n=n[a]);n===t&&f===l||(n[f]=t[i],s.push(i))}for(const i of s)delete t[i];return t},un=e=>e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"),Y=e=>typeof e!="string"||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&un(e)||e!==e.trim()?JSON.stringify(e):e.split(";").join("\\;").split("#").join("\\#"),xe=(e,t)=>{if(e=(e||"").trim(),un(e)){e.charAt(0)==="'"&&(e=e.slice(1,-1));try{e=JSON.parse(e)}catch{}}else{let n=!1,u="";for(let r=0,o=e.length;r<o;r++){const s=e.charAt(r);if(n)"\\;#".indexOf(s)!==-1?u+=s:u+="\\"+s,n=!1;else{if(";#".indexOf(s)!==-1)break;s==="\\"?n=!0:u+=s}}return n&&(u+="\\"),u.trim()}return e};var nn={parse:tn,decode:tn,stringify:Ft,encode:Ft,safe:Y,unsafe:xe};const rn=e=>O.lstat(e).then(()=>!0,()=>!1),{hasOwnProperty:Ci}=Object.prototype,on=(e,t)=>Ci.call(e,t),k=(e,t,n)=>{if(!t)throw new S(`Invalid config property ${e}: ${n}`)},Se={OPENAI_KEY(e){if(!e)throw new S("Please set your OpenAI API key via `aicommits config set OPENAI_KEY=<your token>`");return k("OPENAI_KEY",e.startsWith("sk-"),'Must start with "sk-"'),e},locale(e){return e?(k("locale",e,"Cannot be empty"),k("locale",/^[a-z-]+$/i.test(e),"Must be a valid locale (letters and dashes/underscores). You can consult the list of codes in: https://wikipedia.org/wiki/List_of_ISO_639-1_codes"),e):"en"},generate(e){if(!e)return 1;k("generate",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return k("generate",t>0,"Must be greater than 0"),k("generate",t<=5,"Must be less or equal to 5"),t},proxy(e){if(!(!e||e.length===0))return k("proxy",/^https?:\/\//.test(e),"Must be a valid URL"),e},model(e){return!e||e.length===0?"gpt-3.5-turbo":e},timeout(e){if(!e)return 1e4;k("timeout",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return k("timeout",t>=500,"Must be greater than 500ms"),t}},gt=X.join(Gt.homedir(),".aicommits"),sn=async()=>{if(!await rn(gt))return Object.create(null);const t=await O.readFile(gt,"utf8");return nn.parse(t)},Et=async e=>{const t=await sn(),n={};for(const u of Object.keys(Se)){const r=Se[u],o=e?.[u]??t[u];n[u]=r(o)}return n},mi=async e=>{const t=await sn();for(const[n,u]of e){if(!on(Se,n))throw new S(`Invalid config property: ${n}`);const r=Se[n](u);t[n]=r}await O.writeFile(gt,nn.stringify(t),"utf8")};var yt={},re={},hi={get exports(){return re},set exports(e){re=e}},oe={},Fi={get exports(){return oe},set exports(e){oe=e}},bt,Dn;function gi(){if(Dn)return bt;Dn=1;var e=1e3,t=e*60,n=t*60,u=n*24,r=u*7,o=u*365.25;bt=function(f,a){a=a||{};var c=typeof f;if(c==="string"&&f.length>0)return s(f);if(c==="number"&&isFinite(f))return a.long?D(f):i(f);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(f))};function s(f){if(f=String(f),!(f.length>100)){var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(f);if(a){var c=parseFloat(a[1]),d=(a[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*r;case"days":case"day":case"d":return c*u;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}}}function i(f){var a=Math.abs(f);return a>=u?Math.round(f/u)+"d":a>=n?Math.round(f/n)+"h":a>=t?Math.round(f/t)+"m":a>=e?Math.round(f/e)+"s":f+"ms"}function D(f){var a=Math.abs(f);return a>=u?l(f,a,u,"day"):a>=n?l(f,a,n,"hour"):a>=t?l(f,a,t,"minute"):a>=e?l(f,a,e,"second"):f+" ms"}function l(f,a,c,d){var p=a>=c*1.5;return Math.round(f/c)+" "+d+(p?"s":"")}return bt}var wt,an;function cn(){if(an)return wt;an=1;function e(t){u.debug=u,u.default=u,u.coerce=l,u.disable=s,u.enable=o,u.enabled=i,u.humanize=gi(),u.destroy=f,Object.keys(t).forEach(a=>{u[a]=t[a]}),u.names=[],u.skips=[],u.formatters={};function n(a){let c=0;for(let d=0;d<a.length;d++)c=(c<<5)-c+a.charCodeAt(d),c|=0;return u.colors[Math.abs(c)%u.colors.length]}u.selectColor=n;function u(a){let c,d=null,p,m;function h(...F){if(!h.enabled)return;const B=h,P=Number(new Date),ce=P-(c||P);B.diff=ce,B.prev=c,B.curr=P,c=P,F[0]=u.coerce(F[0]),typeof F[0]!="string"&&F.unshift("%O");let R=0;F[0]=F[0].replace(/%([a-zA-Z%])/g,(U,wn)=>{if(U==="%%")return"%";R++;const Tt=u.formatters[wn];if(typeof Tt=="function"){const Bn=F[R];U=Tt.call(B,Bn),F.splice(R,1),R--}return U}),u.formatArgs.call(B,F),(B.log||u.log).apply(B,F)}return h.namespace=a,h.useColors=u.useColors(),h.color=u.selectColor(a),h.extend=r,h.destroy=u.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(p!==u.namespaces&&(p=u.namespaces,m=u.enabled(a)),m),set:F=>{d=F}}),typeof u.init=="function"&&u.init(h),h}function r(a,c){const d=u(this.namespace+(typeof c>"u"?":":c)+a);return d.log=this.log,d}function o(a){u.save(a),u.namespaces=a,u.names=[],u.skips=[];let c;const d=(typeof a=="string"?a:"").split(/[\s,]+/),p=d.length;for(c=0;c<p;c++)d[c]&&(a=d[c].replace(/\*/g,".*?"),a[0]==="-"?u.skips.push(new RegExp("^"+a.slice(1)+"$")):u.names.push(new RegExp("^"+a+"$")))}function s(){const a=[...u.names.map(D),...u.skips.map(D).map(c=>"-"+c)].join(",");return u.enable(""),a}function i(a){if(a[a.length-1]==="*")return!0;let c,d;for(c=0,d=u.skips.length;c<d;c++)if(u.skips[c].test(a))return!1;for(c=0,d=u.names.length;c<d;c++)if(u.names[c].test(a))return!0;return!1}function D(a){return a.toString().substring(2,a.toString().length-2).replace(/\.\*\?$/,"*")}function l(a){return a instanceof Error?a.stack||a.message:a}function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return u.enable(u.load()),u}return wt=e,wt}var ln;function Ei(){return ln||(ln=1,function(e,t){t.formatArgs=u,t.save=r,t.load=o,t.useColors=n,t.storage=s(),t.destroy=(()=>{let D=!1;return()=>{D||(D=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function n(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function u(D){if(D[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+D[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const l="color: "+this.color;D.splice(1,0,l,"color: inherit");let f=0,a=0;D[0].replace(/%[a-zA-Z%]/g,c=>{c!=="%%"&&(f++,c==="%c"&&(a=f))}),D.splice(a,0,l)}t.log=console.debug||console.log||(()=>{});function r(D){try{D?t.storage.setItem("debug",D):t.storage.removeItem("debug")}catch{}}function o(){let D;try{D=t.storage.getItem("debug")}catch{}return!D&&typeof process<"u"&&"env"in process&&(D=process.env.DEBUG),D}function s(){try{return localStorage}catch{}}e.exports=cn()(t);const{formatters:i}=e.exports;i.j=function(D){try{return JSON.stringify(D)}catch(l){return"[UnexpectedJSONParseError]: "+l.message}}}(Fi,oe)),oe}var se={},yi={get exports(){return se},set exports(e){se=e}},Bt,fn;function bi(){return fn||(fn=1,Bt=(e,t=process.argv)=>{const n=e.startsWith("-")?"":e.length===1?"-":"--",u=t.indexOf(n+e),r=t.indexOf("--");return u!==-1&&(r===-1||u<r)}),Bt}var $t,dn;function wi(){if(dn)return $t;dn=1;const e=Gt,t=le,n=bi(),{env:u}=process;let r;n("no-color")||n("no-colors")||n("color=false")||n("color=never")?r=0:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(r=1),"FORCE_COLOR"in u&&(u.FORCE_COLOR==="true"?r=1:u.FORCE_COLOR==="false"?r=0:r=u.FORCE_COLOR.length===0?1:Math.min(parseInt(u.FORCE_COLOR,10),3));function o(D){return D===0?!1:{level:D,hasBasic:!0,has256:D>=2,has16m:D>=3}}function s(D,l){if(r===0)return 0;if(n("color=16m")||n("color=full")||n("color=truecolor"))return 3;if(n("color=256"))return 2;if(D&&!l&&r===void 0)return 0;const f=r||0;if(u.TERM==="dumb")return f;if(process.platform==="win32"){const a=e.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in u)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(a=>a in u)||u.CI_NAME==="codeship"?1:f;if("TEAMCITY_VERSION"in u)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(u.TEAMCITY_VERSION)?1:0;if(u.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in u){const a=parseInt((u.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(u.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(u.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(u.TERM)||"COLORTERM"in u?1:f}function i(D){const l=s(D,D&&D.isTTY);return o(l)}return $t={supportsColor:i,stdout:o(s(!0,t.isatty(1))),stderr:o(s(!0,t.isatty(2)))},$t}var pn;function Bi(){return pn||(pn=1,function(e,t){const n=le,u=Lt;t.init=f,t.log=i,t.formatArgs=o,t.save=D,t.load=l,t.useColors=r,t.destroy=u.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const c=wi();c&&(c.stderr||c).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}t.inspectOpts=Object.keys(process.env).filter(c=>/^debug_/i.test(c)).reduce((c,d)=>{const p=d.substring(6).toLowerCase().replace(/_([a-z])/g,(h,F)=>F.toUpperCase());let m=process.env[d];return/^(yes|on|true|enabled)$/i.test(m)?m=!0:/^(no|off|false|disabled)$/i.test(m)?m=!1:m==="null"?m=null:m=Number(m),c[p]=m,c},{});function r(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):n.isatty(process.stderr.fd)}function o(c){const{namespace:d,useColors:p}=this;if(p){const m=this.color,h="\x1B[3"+(m<8?m:"8;5;"+m),F=` ${h};1m${d} \x1B[0m`;c[0]=F+c[0].split(`
|
|
61
|
+
`,Ft=(e,t)=>{const n=[];let u="";typeof t=="string"?t={section:t,whitespace:!1}:(t=t||Object.create(null),t.whitespace=t.whitespace===!0);const r=t.whitespace?" = ":"=";for(const o of Object.keys(e)){const s=e[o];if(s&&Array.isArray(s))for(const i of s)u+=Y(o+"[]")+r+Y(i)+Ae;else s&&typeof s=="object"?n.push(o):u+=Y(o)+r+Y(s)+Ae}t.section&&u.length&&(u="["+Y(t.section)+"]"+Ae+u);for(const o of n){const s=en(o).join("\\."),i=(t.section?t.section+".":"")+s,{whitespace:D}=t,l=Ft(e[o],{section:i,whitespace:D});u.length&&l.length&&(u+=Ae),u+=l}return u},en=e=>e.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(t=>t.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")),tn=e=>{const t=Object.create(null);let n=t,u=null;const r=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,o=e.split(/[\r\n]+/g);for(const i of o){if(!i||i.match(/^\s*[;#]/))continue;const D=i.match(r);if(!D)continue;if(D[1]!==void 0){if(u=xe(D[1]),u==="__proto__"){n=Object.create(null);continue}n=t[u]=t[u]||Object.create(null);continue}const l=xe(D[2]),f=l.length>2&&l.slice(-2)==="[]",a=f?l.slice(0,-2):l;if(a==="__proto__")continue;const c=D[3]?xe(D[4]):!0,d=c==="true"||c==="false"||c==="null"?JSON.parse(c):c;f&&(ht.call(n,a)?Array.isArray(n[a])||(n[a]=[n[a]]):n[a]=[]),Array.isArray(n[a])?n[a].push(d):n[a]=d}const s=[];for(const i of Object.keys(t)){if(!ht.call(t,i)||typeof t[i]!="object"||Array.isArray(t[i]))continue;const D=en(i);n=t;const l=D.pop(),f=l.replace(/\\\./g,".");for(const a of D)a!=="__proto__"&&((!ht.call(n,a)||typeof n[a]!="object")&&(n[a]=Object.create(null)),n=n[a]);n===t&&f===l||(n[f]=t[i],s.push(i))}for(const i of s)delete t[i];return t},un=e=>e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"),Y=e=>typeof e!="string"||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&un(e)||e!==e.trim()?JSON.stringify(e):e.split(";").join("\\;").split("#").join("\\#"),xe=(e,t)=>{if(e=(e||"").trim(),un(e)){e.charAt(0)==="'"&&(e=e.slice(1,-1));try{e=JSON.parse(e)}catch{}}else{let n=!1,u="";for(let r=0,o=e.length;r<o;r++){const s=e.charAt(r);if(n)"\\;#".indexOf(s)!==-1?u+=s:u+="\\"+s,n=!1;else{if(";#".indexOf(s)!==-1)break;s==="\\"?n=!0:u+=s}}return n&&(u+="\\"),u.trim()}return e};var nn={parse:tn,decode:tn,stringify:Ft,encode:Ft,safe:Y,unsafe:xe};const rn=e=>O.lstat(e).then(()=>!0,()=>!1),{hasOwnProperty:Ci}=Object.prototype,on=(e,t)=>Ci.call(e,t),T=(e,t,n)=>{if(!t)throw new S(`Invalid config property ${e}: ${n}`)},Se={OPENAI_KEY(e){if(!e)throw new S("Please set your OpenAI API key via `aicommits config set OPENAI_KEY=<your token>`");return T("OPENAI_KEY",e.startsWith("sk-"),'Must start with "sk-"'),e},locale(e){return e?(T("locale",e,"Cannot be empty"),T("locale",/^[a-z-]+$/i.test(e),"Must be a valid locale (letters and dashes/underscores). You can consult the list of codes in: https://wikipedia.org/wiki/List_of_ISO_639-1_codes"),e):"en"},generate(e){if(!e)return 1;T("generate",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return T("generate",t>0,"Must be greater than 0"),T("generate",t<=5,"Must be less or equal to 5"),t},proxy(e){if(!(!e||e.length===0))return T("proxy",/^https?:\/\//.test(e),"Must be a valid URL"),e},model(e){return!e||e.length===0?"gpt-3.5-turbo":e},timeout(e){if(!e)return 1e4;T("timeout",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return T("timeout",t>=500,"Must be greater than 500ms"),t},"max-length"(e){if(!e)return 50;T("max-length",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return T("max-length",t>=20,"Must be greater than 20 characters"),t}},gt=X.join(Gt.homedir(),".aicommits"),sn=async()=>{if(!await rn(gt))return Object.create(null);const t=await O.readFile(gt,"utf8");return nn.parse(t)},Et=async(e,t)=>{const n=await sn(),u={};for(const r of Object.keys(Se)){const o=Se[r],s=e?.[r]??n[r];if(t)try{u[r]=o(s)}catch{}else u[r]=o(s)}return u},hi=async e=>{const t=await sn();for(const[n,u]of e){if(!on(Se,n))throw new S(`Invalid config property: ${n}`);const r=Se[n](u);t[n]=r}await O.writeFile(gt,nn.stringify(t),"utf8")};var yt={},re={},Fi={get exports(){return re},set exports(e){re=e}},oe={},gi={get exports(){return oe},set exports(e){oe=e}},bt,Dn;function Ei(){if(Dn)return bt;Dn=1;var e=1e3,t=e*60,n=t*60,u=n*24,r=u*7,o=u*365.25;bt=function(f,a){a=a||{};var c=typeof f;if(c==="string"&&f.length>0)return s(f);if(c==="number"&&isFinite(f))return a.long?D(f):i(f);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(f))};function s(f){if(f=String(f),!(f.length>100)){var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(f);if(a){var c=parseFloat(a[1]),d=(a[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*r;case"days":case"day":case"d":return c*u;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}}}function i(f){var a=Math.abs(f);return a>=u?Math.round(f/u)+"d":a>=n?Math.round(f/n)+"h":a>=t?Math.round(f/t)+"m":a>=e?Math.round(f/e)+"s":f+"ms"}function D(f){var a=Math.abs(f);return a>=u?l(f,a,u,"day"):a>=n?l(f,a,n,"hour"):a>=t?l(f,a,t,"minute"):a>=e?l(f,a,e,"second"):f+" ms"}function l(f,a,c,d){var p=a>=c*1.5;return Math.round(f/c)+" "+d+(p?"s":"")}return bt}var wt,an;function cn(){if(an)return wt;an=1;function e(t){u.debug=u,u.default=u,u.coerce=l,u.disable=s,u.enable=o,u.enabled=i,u.humanize=Ei(),u.destroy=f,Object.keys(t).forEach(a=>{u[a]=t[a]}),u.names=[],u.skips=[],u.formatters={};function n(a){let c=0;for(let d=0;d<a.length;d++)c=(c<<5)-c+a.charCodeAt(d),c|=0;return u.colors[Math.abs(c)%u.colors.length]}u.selectColor=n;function u(a){let c,d=null,p,C;function h(...F){if(!h.enabled)return;const B=h,_=Number(new Date),ce=_-(c||_);B.diff=ce,B.prev=c,B.curr=_,c=_,F[0]=u.coerce(F[0]),typeof F[0]!="string"&&F.unshift("%O");let R=0;F[0]=F[0].replace(/%([a-zA-Z%])/g,(U,wn)=>{if(U==="%%")return"%";R++;const It=u.formatters[wn];if(typeof It=="function"){const Bn=F[R];U=It.call(B,Bn),F.splice(R,1),R--}return U}),u.formatArgs.call(B,F),(B.log||u.log).apply(B,F)}return h.namespace=a,h.useColors=u.useColors(),h.color=u.selectColor(a),h.extend=r,h.destroy=u.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(p!==u.namespaces&&(p=u.namespaces,C=u.enabled(a)),C),set:F=>{d=F}}),typeof u.init=="function"&&u.init(h),h}function r(a,c){const d=u(this.namespace+(typeof c>"u"?":":c)+a);return d.log=this.log,d}function o(a){u.save(a),u.namespaces=a,u.names=[],u.skips=[];let c;const d=(typeof a=="string"?a:"").split(/[\s,]+/),p=d.length;for(c=0;c<p;c++)d[c]&&(a=d[c].replace(/\*/g,".*?"),a[0]==="-"?u.skips.push(new RegExp("^"+a.slice(1)+"$")):u.names.push(new RegExp("^"+a+"$")))}function s(){const a=[...u.names.map(D),...u.skips.map(D).map(c=>"-"+c)].join(",");return u.enable(""),a}function i(a){if(a[a.length-1]==="*")return!0;let c,d;for(c=0,d=u.skips.length;c<d;c++)if(u.skips[c].test(a))return!1;for(c=0,d=u.names.length;c<d;c++)if(u.names[c].test(a))return!0;return!1}function D(a){return a.toString().substring(2,a.toString().length-2).replace(/\.\*\?$/,"*")}function l(a){return a instanceof Error?a.stack||a.message:a}function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return u.enable(u.load()),u}return wt=e,wt}var ln;function yi(){return ln||(ln=1,function(e,t){t.formatArgs=u,t.save=r,t.load=o,t.useColors=n,t.storage=s(),t.destroy=(()=>{let D=!1;return()=>{D||(D=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function n(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function u(D){if(D[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+D[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const l="color: "+this.color;D.splice(1,0,l,"color: inherit");let f=0,a=0;D[0].replace(/%[a-zA-Z%]/g,c=>{c!=="%%"&&(f++,c==="%c"&&(a=f))}),D.splice(a,0,l)}t.log=console.debug||console.log||(()=>{});function r(D){try{D?t.storage.setItem("debug",D):t.storage.removeItem("debug")}catch{}}function o(){let D;try{D=t.storage.getItem("debug")}catch{}return!D&&typeof process<"u"&&"env"in process&&(D=process.env.DEBUG),D}function s(){try{return localStorage}catch{}}e.exports=cn()(t);const{formatters:i}=e.exports;i.j=function(D){try{return JSON.stringify(D)}catch(l){return"[UnexpectedJSONParseError]: "+l.message}}}(gi,oe)),oe}var se={},bi={get exports(){return se},set exports(e){se=e}},Bt,fn;function wi(){return fn||(fn=1,Bt=(e,t=process.argv)=>{const n=e.startsWith("-")?"":e.length===1?"-":"--",u=t.indexOf(n+e),r=t.indexOf("--");return u!==-1&&(r===-1||u<r)}),Bt}var $t,dn;function Bi(){if(dn)return $t;dn=1;const e=Gt,t=le,n=wi(),{env:u}=process;let r;n("no-color")||n("no-colors")||n("color=false")||n("color=never")?r=0:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(r=1),"FORCE_COLOR"in u&&(u.FORCE_COLOR==="true"?r=1:u.FORCE_COLOR==="false"?r=0:r=u.FORCE_COLOR.length===0?1:Math.min(parseInt(u.FORCE_COLOR,10),3));function o(D){return D===0?!1:{level:D,hasBasic:!0,has256:D>=2,has16m:D>=3}}function s(D,l){if(r===0)return 0;if(n("color=16m")||n("color=full")||n("color=truecolor"))return 3;if(n("color=256"))return 2;if(D&&!l&&r===void 0)return 0;const f=r||0;if(u.TERM==="dumb")return f;if(process.platform==="win32"){const a=e.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in u)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(a=>a in u)||u.CI_NAME==="codeship"?1:f;if("TEAMCITY_VERSION"in u)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(u.TEAMCITY_VERSION)?1:0;if(u.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in u){const a=parseInt((u.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(u.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(u.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(u.TERM)||"COLORTERM"in u?1:f}function i(D){const l=s(D,D&&D.isTTY);return o(l)}return $t={supportsColor:i,stdout:o(s(!0,t.isatty(1))),stderr:o(s(!0,t.isatty(2)))},$t}var pn;function $i(){return pn||(pn=1,function(e,t){const n=le,u=Lt;t.init=f,t.log=i,t.formatArgs=o,t.save=D,t.load=l,t.useColors=r,t.destroy=u.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const c=Bi();c&&(c.stderr||c).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}t.inspectOpts=Object.keys(process.env).filter(c=>/^debug_/i.test(c)).reduce((c,d)=>{const p=d.substring(6).toLowerCase().replace(/_([a-z])/g,(h,F)=>F.toUpperCase());let C=process.env[d];return/^(yes|on|true|enabled)$/i.test(C)?C=!0:/^(no|off|false|disabled)$/i.test(C)?C=!1:C==="null"?C=null:C=Number(C),c[p]=C,c},{});function r(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):n.isatty(process.stderr.fd)}function o(c){const{namespace:d,useColors:p}=this;if(p){const C=this.color,h="\x1B[3"+(C<8?C:"8;5;"+C),F=` ${h};1m${d} \x1B[0m`;c[0]=F+c[0].split(`
|
|
62
62
|
`).join(`
|
|
63
63
|
`+F),c.push(h+"m+"+e.exports.humanize(this.diff)+"\x1B[0m")}else c[0]=s()+d+" "+c[0]}function s(){return t.inspectOpts.hideDate?"":new Date().toISOString()+" "}function i(...c){return process.stderr.write(u.format(...c)+`
|
|
64
64
|
`)}function D(c){c?process.env.DEBUG=c:delete process.env.DEBUG}function l(){return process.env.DEBUG}function f(c){c.inspectOpts={};const d=Object.keys(t.inspectOpts);for(let p=0;p<d.length;p++)c.inspectOpts[d[p]]=t.inspectOpts[d[p]]}e.exports=cn()(t);const{formatters:a}=e.exports;a.o=function(c){return this.inspectOpts.colors=this.useColors,u.inspect(c,this.inspectOpts).split(`
|
|
65
|
-
`).map(d=>d.trim()).join(" ")},a.O=function(c){return this.inspectOpts.colors=this.useColors,u.inspect(c,this.inspectOpts)}}(
|
|
66
|
-
`).some(t=>t.indexOf("(https.js:")!==-1||t.indexOf("node:https:")!==-1)}function Oe(e,t){return new Oe.Agent(e,t)}(function(e){class t extends
|
|
65
|
+
`).map(d=>d.trim()).join(" ")},a.O=function(c){return this.inspectOpts.colors=this.useColors,u.inspect(c,this.inspectOpts)}}(bi,se)),se}(function(e){typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?e.exports=yi():e.exports=$i()})(Fi);var vt={};Object.defineProperty(vt,"__esModule",{value:!0});function vi(e){return function(t,n){return new Promise((u,r)=>{e.call(this,t,n,(o,s)=>{o?r(o):u(s)})})}}vt.default=vi;var mn=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const Ai=jt,xi=mn(re),Si=mn(vt),ie=xi.default("agent-base");function Oi(e){return Boolean(e)&&typeof e.addRequest=="function"}function At(){const{stack:e}=new Error;return typeof e!="string"?!1:e.split(`
|
|
66
|
+
`).some(t=>t.indexOf("(https.js:")!==-1||t.indexOf("node:https:")!==-1)}function Oe(e,t){return new Oe.Agent(e,t)}(function(e){class t extends Ai.EventEmitter{constructor(u,r){super();let o=r;typeof u=="function"?this.callback=u:u&&(o=u),this.timeout=null,o&&typeof o.timeout=="number"&&(this.timeout=o.timeout),this.maxFreeSockets=1,this.maxSockets=1,this.maxTotalSockets=1/0,this.sockets={},this.freeSockets={},this.requests={},this.options={}}get defaultPort(){return typeof this.explicitDefaultPort=="number"?this.explicitDefaultPort:At()?443:80}set defaultPort(u){this.explicitDefaultPort=u}get protocol(){return typeof this.explicitProtocol=="string"?this.explicitProtocol:At()?"https:":"http:"}set protocol(u){this.explicitProtocol=u}callback(u,r,o){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(u,r){const o=Object.assign({},r);typeof o.secureEndpoint!="boolean"&&(o.secureEndpoint=At()),o.host==null&&(o.host="localhost"),o.port==null&&(o.port=o.secureEndpoint?443:80),o.protocol==null&&(o.protocol=o.secureEndpoint?"https:":"http:"),o.host&&o.path&&delete o.path,delete o.agent,delete o.hostname,delete o._defaultAgent,delete o.defaultPort,delete o.createConnection,u._last=!0,u.shouldKeepAlive=!1;let s=!1,i=null;const D=o.timeout||this.timeout,l=d=>{u._hadError||(u.emit("error",d),u._hadError=!0)},f=()=>{i=null,s=!0;const d=new Error(`A "socket" was not created for HTTP request before ${D}ms`);d.code="ETIMEOUT",l(d)},a=d=>{s||(i!==null&&(clearTimeout(i),i=null),l(d))},c=d=>{if(s)return;if(i!=null&&(clearTimeout(i),i=null),Oi(d)){ie("Callback returned another Agent instance %o",d.constructor.name),d.addRequest(u,o);return}if(d){d.once("free",()=>{this.freeSocket(d,o)}),u.onSocket(d);return}const p=new Error(`no Duplex stream was returned to agent-base for \`${u.method} ${u.path}\``);l(p)};if(typeof this.callback!="function"){l(new Error("`callback` is not defined"));return}this.promisifiedCallback||(this.callback.length>=3?(ie("Converting legacy callback function to promise"),this.promisifiedCallback=Si.default(this.callback)):this.promisifiedCallback=this.callback),typeof D=="number"&&D>0&&(i=setTimeout(f,D)),"port"in o&&typeof o.port!="number"&&(o.port=Number(o.port));try{ie("Resolving socket for %o request: %o",o.protocol,`${u.method} ${u.path}`),Promise.resolve(this.promisifiedCallback(u,o)).then(c,a)}catch(d){Promise.reject(d).catch(a)}}freeSocket(u,r){ie("Freeing socket %o %o",u.constructor.name,r),u.destroy()}destroy(){ie("Destroying agent %o",this.constructor.name)}}e.Agent=t,e.prototype=e.Agent.prototype})(Oe||(Oe={}));var Ti=Oe,xt={},Ii=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(xt,"__esModule",{value:!0});const Pi=Ii(re),De=Pi.default("https-proxy-agent:parse-proxy-response");function _i(e){return new Promise((t,n)=>{let u=0;const r=[];function o(){const a=e.read();a?f(a):e.once("readable",o)}function s(){e.removeListener("end",D),e.removeListener("error",l),e.removeListener("close",i),e.removeListener("readable",o)}function i(a){De("onclose had error %o",a)}function D(){De("onend")}function l(a){s(),De("onerror %o",a),n(a)}function f(a){r.push(a),u+=a.length;const c=Buffer.concat(r,u);if(c.indexOf(`\r
|
|
67
67
|
\r
|
|
68
68
|
`)===-1){De("have not received end of HTTP headers yet..."),o();return}const p=c.toString("ascii",0,c.indexOf(`\r
|
|
69
|
-
`)),
|
|
70
|
-
`;u.auth&&(s["Proxy-Authorization"]=`Basic ${Buffer.from(u.auth).toString("base64")}`);let{host:l,port:f,secureEndpoint:a}=n;
|
|
71
|
-
`;const c=
|
|
72
|
-
`);const{statusCode:d,buffered:p}=yield c;if(d===200){if(t.once("socket",
|
|
69
|
+
`)),C=+p.split(" ")[1];De("got proxy server response: %o",p),t({statusCode:C,buffered:c})}e.on("error",l),e.on("close",i),e.on("end",D),o()})}xt.default=_i;var ki=w&&w.__awaiter||function(e,t,n,u){function r(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function i(f){try{l(u.next(f))}catch(a){s(a)}}function D(f){try{l(u.throw(f))}catch(a){s(a)}}function l(f){f.done?o(f.value):r(f.value).then(i,D)}l((u=u.apply(e,t||[])).next())})},J=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(yt,"__esModule",{value:!0});const Cn=J(Pn),hn=J(_n),Ri=J(kn),Mi=J(Mt),ji=J(re),Li=Ti,Ni=J(xt),ae=ji.default("https-proxy-agent:agent");class Gi extends Li.Agent{constructor(t){let n;if(typeof t=="string"?n=Ri.default.parse(t):n=t,!n)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");ae("creating new HttpsProxyAgent instance: %o",n),super(n);const u=Object.assign({},n);this.secureProxy=n.secureProxy||Hi(u.protocol),u.host=u.hostname||u.host,typeof u.port=="string"&&(u.port=parseInt(u.port,10)),!u.port&&u.host&&(u.port=this.secureProxy?443:80),this.secureProxy&&!("ALPNProtocols"in u)&&(u.ALPNProtocols=["http 1.1"]),u.host&&u.path&&(delete u.path,delete u.pathname),this.proxy=u}callback(t,n){return ki(this,void 0,void 0,function*(){const{proxy:u,secureProxy:r}=this;let o;r?(ae("Creating `tls.Socket`: %o",u),o=hn.default.connect(u)):(ae("Creating `net.Socket`: %o",u),o=Cn.default.connect(u));const s=Object.assign({},u.headers);let D=`CONNECT ${`${n.host}:${n.port}`} HTTP/1.1\r
|
|
70
|
+
`;u.auth&&(s["Proxy-Authorization"]=`Basic ${Buffer.from(u.auth).toString("base64")}`);let{host:l,port:f,secureEndpoint:a}=n;Wi(f,a)||(l+=`:${f}`),s.Host=l,s.Connection="close";for(const h of Object.keys(s))D+=`${h}: ${s[h]}\r
|
|
71
|
+
`;const c=Ni.default(o);o.write(`${D}\r
|
|
72
|
+
`);const{statusCode:d,buffered:p}=yield c;if(d===200){if(t.once("socket",Ui),n.secureEndpoint){ae("Upgrading socket connection to TLS");const h=n.servername||n.host;return hn.default.connect(Object.assign(Object.assign({},qi(n,"host","hostname","path","port")),{socket:o,servername:h}))}return o}o.destroy();const C=new Cn.default.Socket({writable:!1});return C.readable=!0,t.once("socket",h=>{ae("replaying proxy buffer for failed request"),Mi.default(h.listenerCount("data")>0),h.push(p),h.push(null)}),C})}}yt.default=Gi;function Ui(e){e.resume()}function Wi(e,t){return Boolean(!t&&e===80||t&&e===443)}function Hi(e){return typeof e=="string"?/^https:?$/i.test(e):!1}function qi(e,...t){const n={};let u;for(u in e)t.includes(u)||(n[u]=e[u]);return n}var zi=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const St=zi(yt);function Ot(e){return new St.default(e)}(function(e){e.HttpsProxyAgent=St.default,e.prototype=St.default.prototype})(Ot||(Ot={}));var Ki=Ot;const Vi=async(e,t,n,u,r,o)=>new Promise((s,i)=>{const D=JSON.stringify(u),l=Tn.request({port:443,hostname:e,path:t,method:"POST",headers:{...n,"Content-Type":"application/json","Content-Length":Buffer.byteLength(D)},timeout:r,agent:o?Ki(o):void 0},f=>{const a=[];f.on("data",c=>a.push(c)),f.on("end",()=>{s({request:l,response:f,data:Buffer.concat(a).toString()})})});l.on("error",i),l.on("timeout",()=>{l.destroy(),i(new S(`Time out error: request took over ${r}ms. Try increasing the \`timeout\` config, or checking the OpenAI API status https://status.openai.com`))}),l.write(D),l.end()}),Yi=async(e,t,n,u)=>{const{response:r,data:o}=await Vi("api.openai.com","/v1/chat/completions",{Authorization:`Bearer ${e}`},t,n,u);if(!r.statusCode||r.statusCode<200||r.statusCode>299){let s=`OpenAI API Error: ${r.statusCode} - ${r.statusMessage}`;throw o&&(s+=`
|
|
73
73
|
|
|
74
74
|
${o}`),r.statusCode===500&&(s+=`
|
|
75
75
|
|
|
76
|
-
Check the API status: https://status.openai.com`),new S(s)}return JSON.parse(o)},
|
|
77
|
-
|
|
76
|
+
Check the API status: https://status.openai.com`),new S(s)}return JSON.parse(o)},Ji=e=>e.trim().replace(/[\n\r]/g,"").replace(/(\w)\.$/,"$1"),Xi=e=>Array.from(new Set(e)),Zi=(e,t,n)=>`${["Generate a concise git commit message written in present tense for the following code diff with the given specifications.",`Message language: ${e}`,`Max message character length: ${n}`,"Exclude anything unnecessary such as the original translation\u2014your entire response will be passed directly into git commit."].join(`
|
|
77
|
+
`)}
|
|
78
|
+
|
|
79
|
+
${t}`,Qi=e=>{let t="";const n="z";for(let u=0;u<e;u+=1)t+=n;return t},eD=(e,t)=>{const n=In(t),u=n.encode(e).length;return n.free(),u},Fn=async(e,t,n,u,r,o,s,i)=>{const D=Zi(n,u,o),l=Qi(o+5),f=eD(l+D,t);try{const a=await Yi(e,{model:t,messages:[{role:"user",content:D}],temperature:.7,top_p:1,frequency_penalty:0,presence_penalty:0,max_tokens:f,stream:!1,n:r},s,i);return Xi(a.choices.filter(c=>c.message?.content).map(c=>Ji(c.message.content)))}catch(a){const c=a;throw c.code==="ENOTFOUND"?new S(`Error connecting to ${c.hostname} (${c.syscall}). Are you connected to the internet?`):c}};var tD=async(e,t,n,u)=>(async()=>{Ju(Gu(Nu(" aicommits "))),await Xu();const r=pt();n&&await ue("git",["add","--all"]),r.start("Detecting staged files");const o=await Qu(t);if(!o)throw r.stop("Detecting staged files"),new S("No staged changes found. Stage your changes manually, or automatically stage all changes with the `--all` flag.");r.stop(`${mi(o.files)}:
|
|
78
80
|
${o.files.map(a=>` ${a}`).join(`
|
|
79
|
-
`)}`);const{env:s}=process,i=await Et({OPENAI_KEY:s.OPENAI_KEY||s.OPENAI_API_KEY,proxy:s.https_proxy||s.HTTPS_PROXY||s.http_proxy||s.HTTP_PROXY,generate:e?.toString()}),D=pt();D.start("The AI is analyzing your changes");let l;try{l=await Fn(i.OPENAI_KEY,i.model,i.locale,o.diff,i.generate,i.timeout,i.proxy)}finally{D.stop("Changes analyzed")}if(l.length===0)throw new S("No commit messages were generated. Try again.");let f;if(l.length===1){[f]=l;const a=await
|
|
81
|
+
`)}`);const{env:s}=process,i=await Et({OPENAI_KEY:s.OPENAI_KEY||s.OPENAI_API_KEY,proxy:s.https_proxy||s.HTTPS_PROXY||s.http_proxy||s.HTTP_PROXY,generate:e?.toString()}),D=pt();D.start("The AI is analyzing your changes");let l;try{l=await Fn(i.OPENAI_KEY,i.model,i.locale,o.diff,i.generate,i["max-length"],i.timeout,i.proxy)}finally{D.stop("Changes analyzed")}if(l.length===0)throw new S("No commit messages were generated. Try again.");let f;if(l.length===1){[f]=l;const a=await di({message:`Use this commit message?
|
|
80
82
|
|
|
81
83
|
${f}
|
|
82
|
-
`});if(!a||qu(a)){V("Commit cancelled");return}}else{const a=await
|
|
84
|
+
`});if(!a||qu(a)){V("Commit cancelled");return}}else{const a=await pi({message:`Pick a commit message to use: ${st("(Ctrl+c to exit)")}`,options:l.map(c=>({label:c,value:c}))});if(qu(a)){V("Commit cancelled");return}f=a}await ue("git",["commit","-m",f,...u]),V(`${Be("\u2714")} Successfully committed!`)})().catch(r=>{V(`${we("\u2716")} ${r.message}`),ve(r),process.exit(1)});const[Tt,uD]=process.argv.slice(2);var nD=()=>(async()=>{if(!Tt)throw new S('Commit message file path is missing. This file should be called from the "prepare-commit-msg" git hook');if(uD)return;const e=await Qu();if(!e)return;Ju(Gu(Nu(" aicommits ")));const{env:t}=process,n=await Et({proxy:t.https_proxy||t.HTTPS_PROXY||t.http_proxy||t.HTTP_PROXY}),u=pt();u.start("The AI is analyzing your changes");let r;try{r=await Fn(n.OPENAI_KEY,n.model,n.locale,e.diff,n.generate,n["max-length"],n.timeout,n.proxy)}finally{u.stop("Changes analyzed")}const s=await O.readFile(Tt,"utf8")!=="",i=r.length>1;let D="";s&&(D=`# \u{1F916} AI generated commit${i?"s":""}
|
|
83
85
|
`),i?(s&&(D+=`# Select one of the following messages by uncommeting:
|
|
84
86
|
`),D+=`
|
|
85
87
|
${r.map(l=>`# ${l}`).join(`
|
|
86
88
|
`)}`):(s&&(D+=`# Edit the message below and commit:
|
|
87
89
|
`),D+=`
|
|
88
90
|
${r[0]}
|
|
89
|
-
`),await O.appendFile(
|
|
91
|
+
`),await O.appendFile(Tt,D),V(`${Be("\u2714")} Saved commit message!`)})().catch(e=>{V(`${we("\u2716")} ${e.message}`),ve(e),process.exit(1)}),rD=Du({name:"config",parameters:["<mode>","<key=value...>"]},e=>{(async()=>{const{mode:t,keyValue:n}=e._;if(t==="get"){const u=await Et({},!0);for(const r of n)on(u,r)&&console.log(`${r}=${u[r]}`);return}if(t==="set"){await hi(n.map(u=>u.split("=")));return}throw new S(`Invalid mode: ${t}`)})().catch(t=>{console.error(`${we("\u2716")} ${t.message}`),ve(t),process.exit(1)})});const gn="prepare-commit-msg",P=`.git/hooks/${gn}`,Te=Rn(new URL("cli.mjs",import.meta.url)),oD=process.argv[1].replace(/\\/g,"/").endsWith(`/${P}`),En=process.platform==="win32",yn=`
|
|
90
92
|
#!/usr/bin/env node
|
|
91
|
-
import(${JSON.stringify(
|
|
92
|
-
`.trim();var
|
|
93
|
+
import(${JSON.stringify(Mn(Te))})
|
|
94
|
+
`.trim();var sD=Du({name:"hook",parameters:["<install/uninstall>"]},e=>{(async()=>{await Xu();const{installUninstall:t}=e._,n=await rn(P);if(t==="install"){if(n){if(await O.realpath(P).catch(()=>{})===Te){console.warn("The hook is already installed");return}throw new S(`A different ${gn} hook seems to be installed. Please remove it before installing aicommits.`)}await O.mkdir(X.dirname(P),{recursive:!0}),En?await O.writeFile(P,yn):(await O.symlink(Te,P,"file"),await O.chmod(P,493)),console.log(`${Be("\u2714")} Hook installed`);return}if(t==="uninstall"){if(!n){console.warn("Hook is not installed");return}if(En){if(await O.readFile(P,"utf8")!==yn){console.warn("Hook is not installed");return}}else if(await O.realpath(P)!==Te){console.warn("Hook is not installed");return}await O.rm(P),console.log(`${Be("\u2714")} Hook uninstalled`);return}throw new S(`Invalid mode: ${t}`)})().catch(t=>{console.error(`${we("\u2716")} ${t.message}`),ve(t),process.exit(1)})});const bn=process.argv.slice(2);uo({name:"aicommits",version:au,flags:{generate:{type:Number,description:"Number of messages to generate (Warning: generating multiple costs more) (default: 1)",alias:"g"},exclude:{type:[String],description:"Files to exclude from AI analysis",alias:"x"},all:{type:Boolean,description:"Automatically stage changes in tracked files for the commit",alias:"a",default:!1}},commands:[rD,sD],help:{description:no},ignoreArgv:e=>e==="unknown-flag"||e==="argument"},e=>{oD?nD():tD(e.flags.generate,e.flags.exclude,e.flags.all,bn)},bn);
|