@sugarmo/aicommits 1.16.1 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.mjs +115 -108
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -1,140 +1,147 @@
1
1
  #!/usr/bin/env node
2
- import Qe from"tty";import{Buffer as PD}from"node:buffer";import ne from"node:path";import lu,{ChildProcess as RD}from"node:child_process";import M,{stdin as _D,stdout as jD}from"node:process";import ND from"child_process";import N from"path";import et from"fs";import{fileURLToPath as fu}from"node:url";import LD,{constants as du}from"node:os";import Fu from"assert";import pu from"events";import{createWriteStream as GD,createReadStream as zD}from"node:fs";import WD from"buffer";import tt from"stream";import Cu from"util";import{debuglog as UD}from"node:util";import mu from"node:readline";import{WriteStream as qD}from"node:tty";import $ from"fs/promises";import Oe from"os";import HD from"https";import KD from"net";import VD from"tls";import JD,{fileURLToPath as hu,pathToFileURL as YD}from"url";const ZD="known-flag",XD="unknown-flag",QD="argument",{stringify:de}=JSON,er=/\B([A-Z])/g,tr=e=>e.replace(er,"-$1").toLowerCase(),{hasOwnProperty:ur}=Object.prototype,Fe=(e,t)=>ur.call(e,t),nr=e=>Array.isArray(e),gu=e=>typeof e=="function"?[e,!1]:nr(e)?[e[0],!0]:gu(e.type),Dr=(e,t)=>e===Boolean?t!=="false":t,rr=(e,t)=>typeof t=="boolean"?t:e===Number&&t===""?Number.NaN:e(t),or=/[\s.:=]/,sr=e=>{const t=`Flag name ${de(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 u=e.match(or);if(u)throw new Error(`${t} cannot contain ${de(u?.[0])}`)},ir=e=>{const t={},u=(n,r)=>{if(Fe(t,n))throw new Error(`Duplicate flags named ${de(n)}`);t[n]=r};for(const n in e){if(!Fe(e,n))continue;sr(n);const r=e[n],o=[[],...gu(r),r];u(n,o);const D=tr(n);if(n!==D&&u(D,o),"alias"in r&&typeof r.alias=="string"){const{alias:i}=r,s=`Flag alias ${de(i)} for flag ${de(n)}`;if(i.length===0)throw new Error(`${s} cannot be empty`);if(i.length>1)throw new Error(`${s} must be a single character`);u(i,o)}}return t},ar=(e,t)=>{const u={};for(const n in e){if(!Fe(e,n))continue;const[r,,o,D]=t[n];if(r.length===0&&"default"in D){let{default:i}=D;typeof i=="function"&&(i=i()),u[n]=i}else u[n]=o?r:r.pop()}return u},Ie="--",cr=/[.:=]/,lr=/^-{1,2}\w/,fr=e=>{if(!lr.test(e))return;const t=!e.startsWith(Ie);let u=e.slice(t?1:2),n;const r=u.match(cr);if(r){const{index:o}=r;n=u.slice(o+1),u=u.slice(0,o)}return[u,n,t]},dr=(e,{onFlag:t,onArgument:u})=>{let n;const r=(o,D)=>{if(typeof n!="function")return!0;n(o,D),n=void 0};for(let o=0;o<e.length;o+=1){const D=e[o];if(D===Ie){r();const s=e.slice(o+1);u?.(s,[o],!0);break}const i=fr(D);if(i){if(r(),!t)continue;const[s,c,f]=i;if(f)for(let l=0;l<s.length;l+=1){r();const a=l===s.length-1;n=t(s[l],a?c:void 0,[o,l+1,a])}else n=t(s,c,[o])}else r(D,[o])&&u?.([D],[o])}r()},Fr=(e,t)=>{for(const[u,n,r]of t.reverse()){if(n){const o=e[u];let D=o.slice(0,n);if(r||(D+=o.slice(n+1)),D!=="-"){e[u]=D;continue}}e.splice(u,1)}},pr=(e,t=process.argv.slice(2),{ignore:u}={})=>{const n=[],r=ir(e),o={},D=[];return D[Ie]=[],dr(t,{onFlag(i,s,c){const f=Fe(r,i);if(!u?.(f?ZD:XD,i,s)){if(f){const[l,a]=r[i],d=Dr(a,s),F=(p,C)=>{n.push(c),C&&n.push(C),l.push(rr(a,p||""))};return d===void 0?F:F(d)}Fe(o,i)||(o[i]=[]),o[i].push(s===void 0?!0:s),n.push(c)}},onArgument(i,s,c){u?.(QD,t[s[0]])||(D.push(...i),c?(D[Ie]=i,t.splice(s[0])):n.push(s))}}),Fr(t,n),{flags:ar(e,r),unknownFlags:o,_:D}};var Cr=Object.create,Me=Object.defineProperty,mr=Object.defineProperties,hr=Object.getOwnPropertyDescriptor,gr=Object.getOwnPropertyDescriptors,Er=Object.getOwnPropertyNames,Eu=Object.getOwnPropertySymbols,yr=Object.getPrototypeOf,yu=Object.prototype.hasOwnProperty,Br=Object.prototype.propertyIsEnumerable,Bu=(e,t,u)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[t]=u,ke=(e,t)=>{for(var u in t||(t={}))yu.call(t,u)&&Bu(e,u,t[u]);if(Eu)for(var u of Eu(t))Br.call(t,u)&&Bu(e,u,t[u]);return e},ut=(e,t)=>mr(e,gr(t)),br=e=>Me(e,"__esModule",{value:!0}),wr=(e,t)=>()=>(e&&(t=e(e=0)),t),Ar=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),vr=(e,t,u,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Er(t))!yu.call(e,r)&&(u||r!=="default")&&Me(e,r,{get:()=>t[r],enumerable:!(n=hr(t,r))||n.enumerable});return e},$r=(e,t)=>vr(br(Me(e!=null?Cr(yr(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),L=wr(()=>{}),xr=Ar((e,t)=>{L(),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}});L(),L(),L();var Sr=e=>{var t,u,n;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:(u=e.columns)!=null?u:[],stdoutColumns:(n=e.stdoutColumns)!=null?n:r}};L(),L(),L(),L(),L();function Or({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 bu(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(Or(),"")}L();function Ir(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 Mr=$r(xr(),1);function Q(e){if(typeof e!="string"||e.length===0||(e=bu(e),e.length===0))return 0;e=e.replace((0,Mr.default)()," ");let t=0;for(let u=0;u<e.length;u++){let n=e.codePointAt(u);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&u++,t+=Ir(n)?2:1)}return t}var wu=e=>Math.max(...e.split(`
3
- `).map(Q)),kr=e=>{let t=[];for(let u of e){let{length:n}=u,r=n-t.length;for(let o=0;o<r;o+=1)t.push(0);for(let o=0;o<n;o+=1){let D=wu(u[o]);D>t[o]&&(t[o]=D)}}return t};L();var Au=/^\d+%$/,vu={width:"auto",align:"left",contentWidth:0,paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:0,horizontalPadding:0,paddingLeftString:"",paddingRightString:""},Tr=(e,t)=>{var u;let n=[];for(let r=0;r<e.length;r+=1){let o=(u=t[r])!=null?u:"auto";if(typeof o=="number"||o==="auto"||o==="content-width"||typeof o=="string"&&Au.test(o)){n.push(ut(ke({},vu),{width:o,contentWidth:e[r]}));continue}if(o&&typeof o=="object"){let D=ut(ke(ke({},vu),o),{contentWidth:e[r]});D.horizontalPadding=D.paddingLeft+D.paddingRight,n.push(D);continue}throw new Error(`Invalid column width: ${JSON.stringify(o)}`)}return n};function Pr(e,t){for(let u of e){let{width:n}=u;if(n==="content-width"&&(u.width=u.contentWidth),n==="auto"){let s=Math.min(20,u.contentWidth);u.width=s,u.autoOverflow=u.contentWidth-s}if(typeof n=="string"&&Au.test(n)){let s=Number.parseFloat(n.slice(0,-1))/100;u.width=Math.floor(t*s)-(u.paddingLeft+u.paddingRight)}let{horizontalPadding:r}=u,o=1,D=o+r;if(D>=t){let s=D-t,c=Math.ceil(u.paddingLeft/r*s),f=s-c;u.paddingLeft-=c,u.paddingRight-=f,u.horizontalPadding=u.paddingLeft+u.paddingRight}u.paddingLeftString=u.paddingLeft?" ".repeat(u.paddingLeft):"",u.paddingRightString=u.paddingRight?" ".repeat(u.paddingRight):"";let i=t-u.horizontalPadding;u.width=Math.max(Math.min(u.width,i),o)}}var $u=()=>Object.assign([],{columns:0});function Rr(e,t){let u=[$u()],[n]=u;for(let r of e){let o=r.width+r.horizontalPadding;n.columns+o>t&&(n=$u(),u.push(n)),n.push(r),n.columns+=o}for(let r of u){let o=r.reduce((a,d)=>a+d.width+d.horizontalPadding,0),D=t-o;if(D===0)continue;let i=r.filter(a=>"autoOverflow"in a),s=i.filter(a=>a.autoOverflow>0),c=s.reduce((a,d)=>a+d.autoOverflow,0),f=Math.min(c,D);for(let a of s){let d=Math.floor(a.autoOverflow/c*f);a.width+=d,D-=d}let l=Math.floor(D/i.length);for(let a=0;a<i.length;a+=1){let d=i[a];a===i.length-1?d.width+=D:d.width+=l,D-=l}}return u}function _r(e,t,u){let n=Tr(u,t);return Pr(n,e),Rr(n,e)}L(),L(),L();var nt=10,xu=(e=0)=>t=>`\x1B[${t+e}m`,Su=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Ou=(e=0)=>(t,u,n)=>`\x1B[${38+e};2;${t};${u};${n}m`;function jr(){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[u,n]of Object.entries(t)){for(let[r,o]of Object.entries(n))t[r]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},n[r]=t[r],e.set(o[0],o[1]);Object.defineProperty(t,u,{value:n,enumerable:!1})}return Object.defineProperty(t,"codes",{value:e,enumerable:!1}),t.color.close="\x1B[39m",t.bgColor.close="\x1B[49m",t.color.ansi=xu(),t.color.ansi256=Su(),t.color.ansi16m=Ou(),t.bgColor.ansi=xu(nt),t.bgColor.ansi256=Su(nt),t.bgColor.ansi16m=Ou(nt),Object.defineProperties(t,{rgbToAnsi256:{value:(u,n,r)=>u===n&&n===r?u<8?16:u>248?231:Math.round((u-8)/247*24)+232:16+36*Math.round(u/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value:u=>{let n=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(u.toString(16));if(!n)return[0,0,0];let{colorString:r}=n.groups;r.length===3&&(r=r.split("").map(D=>D+D).join(""));let o=Number.parseInt(r,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:u=>t.rgbToAnsi256(...t.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value:u=>{if(u<8)return 30+u;if(u<16)return 90+(u-8);let n,r,o;if(u>=232)n=((u-232)*10+8)/255,r=n,o=n;else{u-=16;let s=u%36;n=Math.floor(u/36)/5,r=Math.floor(s/6)/5,o=s%6/5}let D=Math.max(n,r,o)*2;if(D===0)return 30;let i=30+(Math.round(o)<<2|Math.round(r)<<1|Math.round(n));return D===2&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(u,n,r)=>t.ansi256ToAnsi(t.rgbToAnsi256(u,n,r)),enumerable:!1},hexToAnsi:{value:u=>t.ansi256ToAnsi(t.hexToAnsi256(u)),enumerable:!1}}),t}var Nr=jr(),Lr=Nr,Te=new Set(["\x1B","\x9B"]),Gr=39,Dt="\x07",Iu="[",zr="]",Mu="m",rt=`${zr}8;;`,ku=e=>`${Te.values().next().value}${Iu}${e}${Mu}`,Tu=e=>`${Te.values().next().value}${rt}${e}${Dt}`,Wr=e=>e.split(" ").map(t=>Q(t)),ot=(e,t,u)=>{let n=[...t],r=!1,o=!1,D=Q(bu(e[e.length-1]));for(let[i,s]of n.entries()){let c=Q(s);if(D+c<=u?e[e.length-1]+=s:(e.push(s),D=0),Te.has(s)&&(r=!0,o=n.slice(i+1).join("").startsWith(rt)),r){o?s===Dt&&(r=!1,o=!1):s===Mu&&(r=!1);continue}D+=c,D===u&&i<n.length-1&&(e.push(""),D=0)}!D&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},Ur=e=>{let t=e.split(" "),u=t.length;for(;u>0&&!(Q(t[u-1])>0);)u--;return u===t.length?e:t.slice(0,u).join(" ")+t.slice(u).join("")},qr=(e,t,u={})=>{if(u.trim!==!1&&e.trim()==="")return"";let n="",r,o,D=Wr(e),i=[""];for(let[c,f]of e.split(" ").entries()){u.trim!==!1&&(i[i.length-1]=i[i.length-1].trimStart());let l=Q(i[i.length-1]);if(c!==0&&(l>=t&&(u.wordWrap===!1||u.trim===!1)&&(i.push(""),l=0),(l>0||u.trim===!1)&&(i[i.length-1]+=" ",l++)),u.hard&&D[c]>t){let a=t-l,d=1+Math.floor((D[c]-a-1)/t);Math.floor((D[c]-1)/t)<d&&i.push(""),ot(i,f,t);continue}if(l+D[c]>t&&l>0&&D[c]>0){if(u.wordWrap===!1&&l<t){ot(i,f,t);continue}i.push("")}if(l+D[c]>t&&u.wordWrap===!1){ot(i,f,t);continue}i[i.length-1]+=f}u.trim!==!1&&(i=i.map(c=>Ur(c)));let s=[...i.join(`
4
- `)];for(let[c,f]of s.entries()){if(n+=f,Te.has(f)){let{groups:a}=new RegExp(`(?:\\${Iu}(?<code>\\d+)m|\\${rt}(?<uri>.*)${Dt})`).exec(s.slice(c).join(""))||{groups:{}};if(a.code!==void 0){let d=Number.parseFloat(a.code);r=d===Gr?void 0:d}else a.uri!==void 0&&(o=a.uri.length===0?void 0:a.uri)}let l=Lr.codes.get(Number(r));s[c+1]===`
5
- `?(o&&(n+=Tu("")),r&&l&&(n+=ku(l))):f===`
6
- `&&(r&&l&&(n+=ku(r)),o&&(n+=Tu(o)))}return n};function Hr(e,t,u){return String(e).normalize().replace(/\r\n/g,`
2
+ import rt from"tty";import{Buffer as qr}from"node:buffer";import oe from"node:path";import pu,{ChildProcess as Hr}from"node:child_process";import T,{stdin as Vr,stdout as Kr}from"node:process";import Jr from"child_process";import N from"path";import Dt from"fs";import{fileURLToPath as Cu}from"node:url";import Yr,{constants as mu}from"node:os";import hu from"assert";import gu from"events";import{createWriteStream as Zr,createReadStream as Xr}from"node:fs";import Qr from"buffer";import ot from"stream";import Eu from"util";import{debuglog as eD}from"node:util";import yu from"node:readline";import{WriteStream as tD}from"node:tty";import A from"fs/promises";import Oe from"os";import uD from"https";import nD from"net";import rD from"tls";import DD,{fileURLToPath as bu,pathToFileURL as oD}from"url";const sD="known-flag",iD="unknown-flag",aD="argument",{stringify:Fe}=JSON,cD=/\B([A-Z])/g,lD=e=>e.replace(cD,"-$1").toLowerCase(),{hasOwnProperty:fD}=Object.prototype,pe=(e,t)=>fD.call(e,t),dD=e=>Array.isArray(e),wu=e=>typeof e=="function"?[e,!1]:dD(e)?[e[0],!0]:wu(e.type),FD=(e,t)=>e===Boolean?t!=="false":t,pD=(e,t)=>typeof t=="boolean"?t:e===Number&&t===""?Number.NaN:e(t),CD=/[\s.:=]/,mD=e=>{const t=`Flag name ${Fe(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 u=e.match(CD);if(u)throw new Error(`${t} cannot contain ${Fe(u?.[0])}`)},hD=e=>{const t={},u=(n,D)=>{if(pe(t,n))throw new Error(`Duplicate flags named ${Fe(n)}`);t[n]=D};for(const n in e){if(!pe(e,n))continue;mD(n);const D=e[n],o=[[],...wu(D),D];u(n,o);const r=lD(n);if(n!==r&&u(r,o),"alias"in D&&typeof D.alias=="string"){const{alias:i}=D,s=`Flag alias ${Fe(i)} for flag ${Fe(n)}`;if(i.length===0)throw new Error(`${s} cannot be empty`);if(i.length>1)throw new Error(`${s} must be a single character`);u(i,o)}}return t},gD=(e,t)=>{const u={};for(const n in e){if(!pe(e,n))continue;const[D,,o,r]=t[n];if(D.length===0&&"default"in r){let{default:i}=r;typeof i=="function"&&(i=i()),u[n]=i}else u[n]=o?D:D.pop()}return u},Te="--",ED=/[.:=]/,yD=/^-{1,2}\w/,bD=e=>{if(!yD.test(e))return;const t=!e.startsWith(Te);let u=e.slice(t?1:2),n;const D=u.match(ED);if(D){const{index:o}=D;n=u.slice(o+1),u=u.slice(0,o)}return[u,n,t]},wD=(e,{onFlag:t,onArgument:u})=>{let n;const D=(o,r)=>{if(typeof n!="function")return!0;n(o,r),n=void 0};for(let o=0;o<e.length;o+=1){const r=e[o];if(r===Te){D();const s=e.slice(o+1);u?.(s,[o],!0);break}const i=bD(r);if(i){if(D(),!t)continue;const[s,c,f]=i;if(f)for(let l=0;l<s.length;l+=1){D();const a=l===s.length-1;n=t(s[l],a?c:void 0,[o,l+1,a])}else n=t(s,c,[o])}else D(r,[o])&&u?.([r],[o])}D()},BD=(e,t)=>{for(const[u,n,D]of t.reverse()){if(n){const o=e[u];let r=o.slice(0,n);if(D||(r+=o.slice(n+1)),r!=="-"){e[u]=r;continue}}e.splice(u,1)}},vD=(e,t=process.argv.slice(2),{ignore:u}={})=>{const n=[],D=hD(e),o={},r=[];return r[Te]=[],wD(t,{onFlag(i,s,c){const f=pe(D,i);if(!u?.(f?sD:iD,i,s)){if(f){const[l,a]=D[i],d=FD(a,s),F=(m,p)=>{n.push(c),p&&n.push(p),l.push(pD(a,m||""))};return d===void 0?F:F(d)}pe(o,i)||(o[i]=[]),o[i].push(s===void 0?!0:s),n.push(c)}},onArgument(i,s,c){u?.(aD,t[s[0]])||(r.push(...i),c?(r[Te]=i,t.splice(s[0])):n.push(s))}}),BD(t,n),{flags:gD(e,D),unknownFlags:o,_:r}};var AD=Object.create,Pe=Object.defineProperty,$D=Object.defineProperties,xD=Object.getOwnPropertyDescriptor,SD=Object.getOwnPropertyDescriptors,kD=Object.getOwnPropertyNames,Bu=Object.getOwnPropertySymbols,MD=Object.getPrototypeOf,vu=Object.prototype.hasOwnProperty,ID=Object.prototype.propertyIsEnumerable,Au=(e,t,u)=>t in e?Pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[t]=u,Re=(e,t)=>{for(var u in t||(t={}))vu.call(t,u)&&Au(e,u,t[u]);if(Bu)for(var u of Bu(t))ID.call(t,u)&&Au(e,u,t[u]);return e},st=(e,t)=>$D(e,SD(t)),OD=e=>Pe(e,"__esModule",{value:!0}),TD=(e,t)=>()=>(e&&(t=e(e=0)),t),PD=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),RD=(e,t,u,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let D of kD(t))!vu.call(e,D)&&(u||D!=="default")&&Pe(e,D,{get:()=>t[D],enumerable:!(n=xD(t,D))||n.enumerable});return e},_D=(e,t)=>RD(OD(Pe(e!=null?AD(MD(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),L=TD(()=>{}),jD=PD((e,t)=>{L(),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}});L(),L(),L();var ND=e=>{var t,u,n;let D=(t=process.stdout.columns)!=null?t:Number.POSITIVE_INFINITY;return typeof e=="function"&&(e=e(D)),e||(e={}),Array.isArray(e)?{columns:e,stdoutColumns:D}:{columns:(u=e.columns)!=null?u:[],stdoutColumns:(n=e.stdoutColumns)!=null?n:D}};L(),L(),L(),L(),L();function LD({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 $u(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(LD(),"")}L();function GD(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 WD=_D(jD(),1);function ue(e){if(typeof e!="string"||e.length===0||(e=$u(e),e.length===0))return 0;e=e.replace((0,WD.default)()," ");let t=0;for(let u=0;u<e.length;u++){let n=e.codePointAt(u);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&u++,t+=GD(n)?2:1)}return t}var xu=e=>Math.max(...e.split(`
3
+ `).map(ue)),zD=e=>{let t=[];for(let u of e){let{length:n}=u,D=n-t.length;for(let o=0;o<D;o+=1)t.push(0);for(let o=0;o<n;o+=1){let r=xu(u[o]);r>t[o]&&(t[o]=r)}}return t};L();var Su=/^\d+%$/,ku={width:"auto",align:"left",contentWidth:0,paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:0,horizontalPadding:0,paddingLeftString:"",paddingRightString:""},UD=(e,t)=>{var u;let n=[];for(let D=0;D<e.length;D+=1){let o=(u=t[D])!=null?u:"auto";if(typeof o=="number"||o==="auto"||o==="content-width"||typeof o=="string"&&Su.test(o)){n.push(st(Re({},ku),{width:o,contentWidth:e[D]}));continue}if(o&&typeof o=="object"){let r=st(Re(Re({},ku),o),{contentWidth:e[D]});r.horizontalPadding=r.paddingLeft+r.paddingRight,n.push(r);continue}throw new Error(`Invalid column width: ${JSON.stringify(o)}`)}return n};function qD(e,t){for(let u of e){let{width:n}=u;if(n==="content-width"&&(u.width=u.contentWidth),n==="auto"){let s=Math.min(20,u.contentWidth);u.width=s,u.autoOverflow=u.contentWidth-s}if(typeof n=="string"&&Su.test(n)){let s=Number.parseFloat(n.slice(0,-1))/100;u.width=Math.floor(t*s)-(u.paddingLeft+u.paddingRight)}let{horizontalPadding:D}=u,o=1,r=o+D;if(r>=t){let s=r-t,c=Math.ceil(u.paddingLeft/D*s),f=s-c;u.paddingLeft-=c,u.paddingRight-=f,u.horizontalPadding=u.paddingLeft+u.paddingRight}u.paddingLeftString=u.paddingLeft?" ".repeat(u.paddingLeft):"",u.paddingRightString=u.paddingRight?" ".repeat(u.paddingRight):"";let i=t-u.horizontalPadding;u.width=Math.max(Math.min(u.width,i),o)}}var Mu=()=>Object.assign([],{columns:0});function HD(e,t){let u=[Mu()],[n]=u;for(let D of e){let o=D.width+D.horizontalPadding;n.columns+o>t&&(n=Mu(),u.push(n)),n.push(D),n.columns+=o}for(let D of u){let o=D.reduce((a,d)=>a+d.width+d.horizontalPadding,0),r=t-o;if(r===0)continue;let i=D.filter(a=>"autoOverflow"in a),s=i.filter(a=>a.autoOverflow>0),c=s.reduce((a,d)=>a+d.autoOverflow,0),f=Math.min(c,r);for(let a of s){let d=Math.floor(a.autoOverflow/c*f);a.width+=d,r-=d}let l=Math.floor(r/i.length);for(let a=0;a<i.length;a+=1){let d=i[a];a===i.length-1?d.width+=r:d.width+=l,r-=l}}return u}function VD(e,t,u){let n=UD(u,t);return qD(n,e),HD(n,e)}L(),L(),L();var it=10,Iu=(e=0)=>t=>`\x1B[${t+e}m`,Ou=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Tu=(e=0)=>(t,u,n)=>`\x1B[${38+e};2;${t};${u};${n}m`;function KD(){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[u,n]of Object.entries(t)){for(let[D,o]of Object.entries(n))t[D]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},n[D]=t[D],e.set(o[0],o[1]);Object.defineProperty(t,u,{value:n,enumerable:!1})}return Object.defineProperty(t,"codes",{value:e,enumerable:!1}),t.color.close="\x1B[39m",t.bgColor.close="\x1B[49m",t.color.ansi=Iu(),t.color.ansi256=Ou(),t.color.ansi16m=Tu(),t.bgColor.ansi=Iu(it),t.bgColor.ansi256=Ou(it),t.bgColor.ansi16m=Tu(it),Object.defineProperties(t,{rgbToAnsi256:{value:(u,n,D)=>u===n&&n===D?u<8?16:u>248?231:Math.round((u-8)/247*24)+232:16+36*Math.round(u/255*5)+6*Math.round(n/255*5)+Math.round(D/255*5),enumerable:!1},hexToRgb:{value:u=>{let n=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(u.toString(16));if(!n)return[0,0,0];let{colorString:D}=n.groups;D.length===3&&(D=D.split("").map(r=>r+r).join(""));let o=Number.parseInt(D,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:u=>t.rgbToAnsi256(...t.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value:u=>{if(u<8)return 30+u;if(u<16)return 90+(u-8);let n,D,o;if(u>=232)n=((u-232)*10+8)/255,D=n,o=n;else{u-=16;let s=u%36;n=Math.floor(u/36)/5,D=Math.floor(s/6)/5,o=s%6/5}let r=Math.max(n,D,o)*2;if(r===0)return 30;let i=30+(Math.round(o)<<2|Math.round(D)<<1|Math.round(n));return r===2&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(u,n,D)=>t.ansi256ToAnsi(t.rgbToAnsi256(u,n,D)),enumerable:!1},hexToAnsi:{value:u=>t.ansi256ToAnsi(t.hexToAnsi256(u)),enumerable:!1}}),t}var JD=KD(),YD=JD,_e=new Set(["\x1B","\x9B"]),ZD=39,at="\x07",Pu="[",XD="]",Ru="m",ct=`${XD}8;;`,_u=e=>`${_e.values().next().value}${Pu}${e}${Ru}`,ju=e=>`${_e.values().next().value}${ct}${e}${at}`,QD=e=>e.split(" ").map(t=>ue(t)),lt=(e,t,u)=>{let n=[...t],D=!1,o=!1,r=ue($u(e[e.length-1]));for(let[i,s]of n.entries()){let c=ue(s);if(r+c<=u?e[e.length-1]+=s:(e.push(s),r=0),_e.has(s)&&(D=!0,o=n.slice(i+1).join("").startsWith(ct)),D){o?s===at&&(D=!1,o=!1):s===Ru&&(D=!1);continue}r+=c,r===u&&i<n.length-1&&(e.push(""),r=0)}!r&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},eo=e=>{let t=e.split(" "),u=t.length;for(;u>0&&!(ue(t[u-1])>0);)u--;return u===t.length?e:t.slice(0,u).join(" ")+t.slice(u).join("")},to=(e,t,u={})=>{if(u.trim!==!1&&e.trim()==="")return"";let n="",D,o,r=QD(e),i=[""];for(let[c,f]of e.split(" ").entries()){u.trim!==!1&&(i[i.length-1]=i[i.length-1].trimStart());let l=ue(i[i.length-1]);if(c!==0&&(l>=t&&(u.wordWrap===!1||u.trim===!1)&&(i.push(""),l=0),(l>0||u.trim===!1)&&(i[i.length-1]+=" ",l++)),u.hard&&r[c]>t){let a=t-l,d=1+Math.floor((r[c]-a-1)/t);Math.floor((r[c]-1)/t)<d&&i.push(""),lt(i,f,t);continue}if(l+r[c]>t&&l>0&&r[c]>0){if(u.wordWrap===!1&&l<t){lt(i,f,t);continue}i.push("")}if(l+r[c]>t&&u.wordWrap===!1){lt(i,f,t);continue}i[i.length-1]+=f}u.trim!==!1&&(i=i.map(c=>eo(c)));let s=[...i.join(`
4
+ `)];for(let[c,f]of s.entries()){if(n+=f,_e.has(f)){let{groups:a}=new RegExp(`(?:\\${Pu}(?<code>\\d+)m|\\${ct}(?<uri>.*)${at})`).exec(s.slice(c).join(""))||{groups:{}};if(a.code!==void 0){let d=Number.parseFloat(a.code);D=d===ZD?void 0:d}else a.uri!==void 0&&(o=a.uri.length===0?void 0:a.uri)}let l=YD.codes.get(Number(D));s[c+1]===`
5
+ `?(o&&(n+=ju("")),D&&l&&(n+=_u(l))):f===`
6
+ `&&(D&&l&&(n+=_u(D)),o&&(n+=ju(o)))}return n};function uo(e,t,u){return String(e).normalize().replace(/\r\n/g,`
7
7
  `).split(`
8
- `).map(n=>qr(n,t,u)).join(`
9
- `)}var Pu=e=>Array.from({length:e}).fill("");function Kr(e,t){let u=[],n=0;for(let r of e){let o=0,D=r.map(s=>{var c;let f=(c=t[n])!=null?c:"";n+=1,s.preprocess&&(f=s.preprocess(f)),wu(f)>s.width&&(f=Hr(f,s.width,{hard:!0}));let l=f.split(`
10
- `);if(s.postprocess){let{postprocess:a}=s;l=l.map((d,F)=>a.call(s,d,F))}return s.paddingTop&&l.unshift(...Pu(s.paddingTop)),s.paddingBottom&&l.push(...Pu(s.paddingBottom)),l.length>o&&(o=l.length),ut(ke({},s),{lines:l})}),i=[];for(let s=0;s<o;s+=1){let c=D.map(f=>{var l;let a=(l=f.lines[s])!=null?l:"",d=Number.isFinite(f.width)?" ".repeat(f.width-Q(a)):"",F=f.paddingLeftString;return f.align==="right"&&(F+=d),F+=a,f.align==="left"&&(F+=d),F+f.paddingRightString}).join("");i.push(c)}u.push(i.join(`
8
+ `).map(n=>to(n,t,u)).join(`
9
+ `)}var Nu=e=>Array.from({length:e}).fill("");function no(e,t){let u=[],n=0;for(let D of e){let o=0,r=D.map(s=>{var c;let f=(c=t[n])!=null?c:"";n+=1,s.preprocess&&(f=s.preprocess(f)),xu(f)>s.width&&(f=uo(f,s.width,{hard:!0}));let l=f.split(`
10
+ `);if(s.postprocess){let{postprocess:a}=s;l=l.map((d,F)=>a.call(s,d,F))}return s.paddingTop&&l.unshift(...Nu(s.paddingTop)),s.paddingBottom&&l.push(...Nu(s.paddingBottom)),l.length>o&&(o=l.length),st(Re({},s),{lines:l})}),i=[];for(let s=0;s<o;s+=1){let c=r.map(f=>{var l;let a=(l=f.lines[s])!=null?l:"",d=Number.isFinite(f.width)?" ".repeat(f.width-ue(a)):"",F=f.paddingLeftString;return f.align==="right"&&(F+=d),F+=a,f.align==="left"&&(F+=d),F+f.paddingRightString}).join("");i.push(c)}u.push(i.join(`
11
11
  `))}return u.join(`
12
- `)}function Vr(e,t){if(!e||e.length===0)return"";let u=kr(e),n=u.length;if(n===0)return"";let{stdoutColumns:r,columns:o}=Sr(t);if(o.length>n)throw new Error(`${o.length} columns defined, but only ${n} columns found`);let D=_r(r,o,u);return e.map(i=>Kr(D,i)).join(`
13
- `)}L();var Jr=["<",">","=",">=","<="];function Yr(e){if(!Jr.includes(e))throw new TypeError(`Invalid breakpoint operator: ${e}`)}function Zr(e){let t=Object.keys(e).map(u=>{let[n,r]=u.split(" ");Yr(n);let o=Number.parseInt(r,10);if(Number.isNaN(o))throw new TypeError(`Invalid breakpoint value: ${r}`);let D=e[u];return{operator:n,breakpoint:o,value:D}}).sort((u,n)=>n.breakpoint-u.breakpoint);return u=>{var n;return(n=t.find(({operator:r,breakpoint:o})=>r==="="&&u===o||r===">"&&u>o||r==="<"&&u<o||r===">="&&u>=o||r==="<="&&u<=o))==null?void 0:n.value}}const Xr=e=>e.replace(/[\W_]([a-z\d])?/gi,(t,u)=>u?u.toUpperCase():""),Qr=e=>e.replace(/\B([A-Z])/g,"-$1").toLowerCase(),eo={"> 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 to(e){let t=!1;return{type:"table",data:{tableData:Object.keys(e).sort((u,n)=>u.localeCompare(n)).map(u=>{const n=e[u],r="alias"in n;return r&&(t=!0),{name:u,flag:n,flagFormatted:`--${Qr(u)}`,aliasesEnabled:t,aliasFormatted:r?`-${n.alias}`:void 0}}).map(u=>(u.aliasesEnabled=t,[{type:"flagName",data:u},{type:"flagDescription",data:u}])),tableBreakpoints:eo}}}const Ru=e=>!e||(e.version??(e.help?e.help.version:void 0)),_u=e=>{const t="parent"in e&&e.parent?.name;return(t?`${t} `:"")+e.name};function uo(e){const t=[];e.name&&t.push(_u(e));const u=Ru(e)??("parent"in e&&Ru(e.parent));if(u&&t.push(`v${u}`),t.length!==0)return{id:"name",type:"text",data:`${t.join(" ")}
14
- `}}function no(e){const{help:t}=e;if(!(!t||!t.description))return{id:"description",type:"text",data:`${t.description}
15
- `}}function Do(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
- `):t.usage}}:void 0;if(e.name){const u=[],n=[_u(e)];if(e.flags&&Object.keys(e.flags).length>0&&n.push("[flags...]"),e.parameters&&e.parameters.length>0){const{parameters:r}=e,o=r.indexOf("--"),D=o>-1&&r.slice(o+1).some(i=>i.startsWith("<"));n.push(r.map(i=>i!=="--"?i:D?"--":"[--]").join(" "))}if(n.length>1&&u.push(n.join(" ")),"commands"in e&&e.commands?.length&&u.push(`${e.name} <command>`),u.length>0)return{id:"usage",type:"section",data:{title:"Usage:",body:u.join(`
17
- `)}}}}function ro(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 oo(e){if(!(!e.flags||Object.keys(e.flags).length===0))return{id:"flags",type:"section",data:{title:"Flags:",body:to(e.flags),indentBody:0}}}function so(e){const{help:t}=e;if(!t||!t.examples||t.examples.length===0)return;let{examples:u}=t;if(Array.isArray(u)&&(u=u.join(`
18
- `)),u)return{id:"examples",type:"section",data:{title:"Examples:",body:u}}}function io(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 ao=e=>[uo,no,Do,ro,oo,so,io].map(t=>t(e)).filter(Boolean),co=Qe.WriteStream.prototype.hasColors();class lo{text(t){return t}bold(t){return co?`\x1B[1m${t}\x1B[22m`:t.toLocaleUpperCase()}indentText({text:t,spaces:u}){return t.replace(/^/gm," ".repeat(u))}heading(t){return this.bold(t)}section({title:t,body:u,indentBody:n=2}){return`${(t?`${this.heading(t)}
12
+ `)}function ro(e,t){if(!e||e.length===0)return"";let u=zD(e),n=u.length;if(n===0)return"";let{stdoutColumns:D,columns:o}=ND(t);if(o.length>n)throw new Error(`${o.length} columns defined, but only ${n} columns found`);let r=VD(D,o,u);return e.map(i=>no(r,i)).join(`
13
+ `)}L();var Do=["<",">","=",">=","<="];function oo(e){if(!Do.includes(e))throw new TypeError(`Invalid breakpoint operator: ${e}`)}function so(e){let t=Object.keys(e).map(u=>{let[n,D]=u.split(" ");oo(n);let o=Number.parseInt(D,10);if(Number.isNaN(o))throw new TypeError(`Invalid breakpoint value: ${D}`);let r=e[u];return{operator:n,breakpoint:o,value:r}}).sort((u,n)=>n.breakpoint-u.breakpoint);return u=>{var n;return(n=t.find(({operator:D,breakpoint:o})=>D==="="&&u===o||D===">"&&u>o||D==="<"&&u<o||D===">="&&u>=o||D==="<="&&u<=o))==null?void 0:n.value}}const io=e=>e.replace(/[\W_]([a-z\d])?/gi,(t,u)=>u?u.toUpperCase():""),ao=e=>e.replace(/\B([A-Z])/g,"-$1").toLowerCase(),co={"> 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 lo(e){let t=!1;return{type:"table",data:{tableData:Object.keys(e).sort((u,n)=>u.localeCompare(n)).map(u=>{const n=e[u],D="alias"in n;return D&&(t=!0),{name:u,flag:n,flagFormatted:`--${ao(u)}`,aliasesEnabled:t,aliasFormatted:D?`-${n.alias}`:void 0}}).map(u=>(u.aliasesEnabled=t,[{type:"flagName",data:u},{type:"flagDescription",data:u}])),tableBreakpoints:co}}}const Lu=e=>!e||(e.version??(e.help?e.help.version:void 0)),Gu=e=>{const t="parent"in e&&e.parent?.name;return(t?`${t} `:"")+e.name};function fo(e){const t=[];e.name&&t.push(Gu(e));const u=Lu(e)??("parent"in e&&Lu(e.parent));if(u&&t.push(`v${u}`),t.length!==0)return{id:"name",type:"text",data:`${t.join(" ")}
14
+ `}}function Fo(e){const{help:t}=e;if(!(!t||!t.description))return{id:"description",type:"text",data:`${t.description}
15
+ `}}function po(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
+ `):t.usage}}:void 0;if(e.name){const u=[],n=[Gu(e)];if(e.flags&&Object.keys(e.flags).length>0&&n.push("[flags...]"),e.parameters&&e.parameters.length>0){const{parameters:D}=e,o=D.indexOf("--"),r=o>-1&&D.slice(o+1).some(i=>i.startsWith("<"));n.push(D.map(i=>i!=="--"?i:r?"--":"[--]").join(" "))}if(n.length>1&&u.push(n.join(" ")),"commands"in e&&e.commands?.length&&u.push(`${e.name} <command>`),u.length>0)return{id:"usage",type:"section",data:{title:"Usage:",body:u.join(`
17
+ `)}}}}function Co(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 mo(e){if(!(!e.flags||Object.keys(e.flags).length===0))return{id:"flags",type:"section",data:{title:"Flags:",body:lo(e.flags),indentBody:0}}}function ho(e){const{help:t}=e;if(!t||!t.examples||t.examples.length===0)return;let{examples:u}=t;if(Array.isArray(u)&&(u=u.join(`
18
+ `)),u)return{id:"examples",type:"section",data:{title:"Examples:",body:u}}}function go(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 Eo=e=>[fo,Fo,po,Co,mo,ho,go].map(t=>t(e)).filter(Boolean),yo=rt.WriteStream.prototype.hasColors();class bo{text(t){return t}bold(t){return yo?`\x1B[1m${t}\x1B[22m`:t.toLocaleUpperCase()}indentText({text:t,spaces:u}){return t.replace(/^/gm," ".repeat(u))}heading(t){return this.bold(t)}section({title:t,body:u,indentBody:n=2}){return`${(t?`${this.heading(t)}
19
19
  `:"")+(u?this.indentText({text:this.render(u),spaces:n}):"")}
20
- `}table({tableData:t,tableOptions:u,tableBreakpoints:n}){return Vr(t.map(r=>r.map(o=>this.render(o))),n?Zr(n):u)}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:u,flagFormatted:n,aliasesEnabled:r,aliasFormatted:o}=t;let D="";if(o?D+=`${o}, `:r&&(D+=" "),D+=n,"placeholder"in u&&typeof u.placeholder=="string")D+=`${this.flagOperator(t)}${u.placeholder}`;else{const i=this.flagParameter("type"in u?u.type:u);i&&(D+=`${this.flagOperator(t)}${i}`)}return D}flagDefault(t){return JSON.stringify(t)}flagDescription({flag:t}){let u="description"in t?t.description??"":"";if("default"in t){let{default:n}=t;typeof n=="function"&&(n=n()),n&&(u+=` (default: ${this.flagDefault(n)})`)}return u}render(t){if(typeof t=="string")return t;if(Array.isArray(t))return t.map(u=>this.render(u)).join(`
21
- `);if("type"in t&&this[t.type]){const u=this[t.type];if(typeof u=="function")return u.call(this,t.data)}throw new Error(`Invalid node type: ${JSON.stringify(t)}`)}}const st=e=>e.length>0&&!e.includes(" "),{stringify:K}=JSON,fo=/[|\\{}()[\]^$+*?.]/;function it(e){const t=[];let u,n;for(const r of e){if(n)throw new Error(`Invalid parameter: Spread parameter ${K(n)} must be last`);const o=r[0],D=r[r.length-1];let i;if(o==="<"&&D===">"&&(i=!0,u))throw new Error(`Invalid parameter: Required parameter ${K(r)} cannot come after optional parameter ${K(u)}`);if(o==="["&&D==="]"&&(i=!1,u=r),i===void 0)throw new Error(`Invalid parameter: ${K(r)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let s=r.slice(1,-1);const c=s.slice(-3)==="...";c&&(n=r,s=s.slice(0,-3));const f=s.match(fo);if(f)throw new Error(`Invalid parameter: ${K(r)}. Invalid character found ${K(f[0])}`);t.push({name:s,required:i,spread:c})}return t}function at(e,t,u,n){for(let r=0;r<t.length;r+=1){const{name:o,required:D,spread:i}=t[r],s=Xr(o);if(s in e)throw new Error(`Invalid parameter: ${K(o)} is used more than once.`);const c=i?u.slice(r):u[r];if(i&&(r=t.length),D&&(!c||i&&c.length===0))return console.error(`Error: Missing required parameter ${K(o)}
22
- `),n(),process.exit(1);e[s]=c}}function Fo(e){return e===void 0||e!==!1}function ju(e,t,u,n){const r={...t.flags},o=t.version;o&&(r.version={type:Boolean,description:"Show version"});const{help:D}=t,i=Fo(D);i&&!("help"in r)&&(r.help={type:Boolean,alias:"h",description:"Show help"});const s=pr(r,n,{ignore:t.ignoreArgv}),c=()=>{console.log(t.version)};if(o&&s.flags.version===!0)return c(),process.exit(0);const f=new lo,l=i&&D?.render?D.render:F=>f.render(F),a=F=>{const p=ao({...t,...F?{help:F}:{},flags:r});console.log(l(p,f))};if(i&&s.flags.help===!0)return a(),process.exit(0);if(t.parameters){let{parameters:F}=t,p=s._;const C=F.indexOf("--"),h=F.slice(C+1),y=Object.create(null);if(C>-1&&h.length>0){F=F.slice(0,C);const A=s._["--"];p=p.slice(0,-A.length||void 0),at(y,it(F),p,a),at(y,it(h),A,a)}else at(y,it(F),p,a);Object.assign(s._,y)}const d={...s,showVersion:c,showHelp:a};return typeof u=="function"&&u(d),{command:e,...d}}function po(e,t){const u=new Map;for(const n of t){const r=[n.options.name],{alias:o}=n.options;o&&(Array.isArray(o)?r.push(...o):r.push(o));for(const D of r){if(u.has(D))throw new Error(`Duplicate command name found: ${K(D)}`);u.set(D,n)}}return u.get(e)}function Co(e,t,u=process.argv.slice(2)){if(!e)throw new Error("Options is required");if("name"in e&&(!e.name||!st(e.name)))throw new Error(`Invalid script name: ${K(e.name)}`);const n=u[0];if(e.commands&&n&&st(n)){const r=po(n,e.commands);if(r)return ju(r.options.name,{...r.options,parent:e},r.callback,u.slice(1))}return ju(void 0,e,t,u)}function Nu(e,t){if(!e)throw new Error("Command options are required");const{name:u}=e;if(u===void 0)throw new Error("Command name is required");if(!st(u))throw new Error(`Invalid command name ${JSON.stringify(u)}. Command names must be one word.`);return{options:e,callback:t}}var mo="1.16.1",ho="Writes your git commit messages for you with AI",go="sugarmo/aicommits",T=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function De(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var re={exports:{}},ct,Lu;function Eo(){if(Lu)return ct;Lu=1,ct=n,n.sync=r;var e=et;function t(o,D){var i=D.pathExt!==void 0?D.pathExt:process.env.PATHEXT;if(!i||(i=i.split(";"),i.indexOf("")!==-1))return!0;for(var s=0;s<i.length;s++){var c=i[s].toLowerCase();if(c&&o.substr(-c.length).toLowerCase()===c)return!0}return!1}function u(o,D,i){return!o.isSymbolicLink()&&!o.isFile()?!1:t(D,i)}function n(o,D,i){e.stat(o,function(s,c){i(s,s?!1:u(c,o,D))})}function r(o,D){return u(e.statSync(o),o,D)}return ct}var lt,Gu;function yo(){if(Gu)return lt;Gu=1,lt=t,t.sync=u;var e=et;function t(o,D,i){e.stat(o,function(s,c){i(s,s?!1:n(c,D))})}function u(o,D){return n(e.statSync(o),D)}function n(o,D){return o.isFile()&&r(o,D)}function r(o,D){var i=o.mode,s=o.uid,c=o.gid,f=D.uid!==void 0?D.uid:process.getuid&&process.getuid(),l=D.gid!==void 0?D.gid:process.getgid&&process.getgid(),a=parseInt("100",8),d=parseInt("010",8),F=parseInt("001",8),p=a|d,C=i&F||i&d&&c===l||i&a&&s===f||i&p&&f===0;return C}return lt}var Pe;process.platform==="win32"||T.TESTING_WINDOWS?Pe=Eo():Pe=yo();var Bo=ft;ft.sync=bo;function ft(e,t,u){if(typeof t=="function"&&(u=t,t={}),!u){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,r){ft(e,t||{},function(o,D){o?r(o):n(D)})})}Pe(e,t||{},function(n,r){n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,r=!1),u(n,r)})}function bo(e,t){try{return Pe.sync(e,t||{})}catch(u){if(t&&t.ignoreErrors||u.code==="EACCES")return!1;throw u}}const oe=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",zu=N,wo=oe?";":":",Wu=Bo,Uu=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),qu=(e,t)=>{const u=t.colon||wo,n=e.match(/\//)||oe&&e.match(/\\/)?[""]:[...oe?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(u)],r=oe?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=oe?r.split(u):[""];return oe&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:r}},Hu=(e,t,u)=>{typeof t=="function"&&(u=t,t={}),t||(t={});const{pathEnv:n,pathExt:r,pathExtExe:o}=qu(e,t),D=[],i=c=>new Promise((f,l)=>{if(c===n.length)return t.all&&D.length?f(D):l(Uu(e));const a=n[c],d=/^".*"$/.test(a)?a.slice(1,-1):a,F=zu.join(d,e),p=!d&&/^\.[\\\/]/.test(e)?e.slice(0,2)+F:F;f(s(p,c,0))}),s=(c,f,l)=>new Promise((a,d)=>{if(l===r.length)return a(i(f+1));const F=r[l];Wu(c+F,{pathExt:o},(p,C)=>{if(!p&&C)if(t.all)D.push(c+F);else return a(c+F);return a(s(c,f,l+1))})});return u?i(0).then(c=>u(null,c),u):i(0)},Ao=(e,t)=>{t=t||{};const{pathEnv:u,pathExt:n,pathExtExe:r}=qu(e,t),o=[];for(let D=0;D<u.length;D++){const i=u[D],s=/^".*"$/.test(i)?i.slice(1,-1):i,c=zu.join(s,e),f=!s&&/^\.[\\\/]/.test(e)?e.slice(0,2)+c:c;for(let l=0;l<n.length;l++){const a=f+n[l];try{if(Wu.sync(a,{pathExt:r}))if(t.all)o.push(a);else return a}catch{}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw Uu(e)};var vo=Hu;Hu.sync=Ao;var dt={exports:{}};const Ku=(e={})=>{const t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};dt.exports=Ku,dt.exports.default=Ku;var $o=dt.exports;const Vu=N,xo=vo,So=$o;function Ju(e,t){const u=e.options.env||process.env,n=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 D;try{D=xo.sync(e.command,{path:u[So({env:u})],pathExt:t?Vu.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return D&&(D=Vu.resolve(r?e.options.cwd:"",D)),D}function Oo(e){return Ju(e)||Ju(e,!0)}var Io=Oo,Ft={};const pt=/([()\][%!^"`<>&|;, *?])/g;function Mo(e){return e=e.replace(pt,"^$1"),e}function ko(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(pt,"^$1"),t&&(e=e.replace(pt,"^$1")),e}Ft.command=Mo,Ft.argument=ko;var To=/^#!(.*)/;const Po=To;var Ro=(e="")=>{const t=e.match(Po);if(!t)return null;const[u,n]=t[0].replace(/#! ?/,"").split(" "),r=u.split("/").pop();return r==="env"?n:n?`${r} ${n}`:r};const Ct=et,_o=Ro;function jo(e){const u=Buffer.alloc(150);let n;try{n=Ct.openSync(e,"r"),Ct.readSync(n,u,0,150,0),Ct.closeSync(n)}catch{}return _o(u.toString())}var No=jo;const Lo=N,Yu=Io,Zu=Ft,Go=No,zo=process.platform==="win32",Wo=/\.(?:com|exe)$/i,Uo=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function qo(e){e.file=Yu(e);const t=e.file&&Go(e.file);return t?(e.args.unshift(e.file),e.command=t,Yu(e)):e.file}function Ho(e){if(!zo)return e;const t=qo(e),u=!Wo.test(t);if(e.options.forceShell||u){const n=Uo.test(t);e.command=Lo.normalize(e.command),e.command=Zu.command(e.command),e.args=e.args.map(o=>Zu.argument(o,n));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 Ko(e,t,u){t&&!Array.isArray(t)&&(u=t,t=null),t=t?t.slice(0):[],u=Object.assign({},u);const n={command:e,args:t,options:u,file:void 0,original:{command:e,args:t}};return u.shell?n:Ho(n)}var Vo=Ko;const mt=process.platform==="win32";function ht(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 Jo(e,t){if(!mt)return;const u=e.emit;e.emit=function(n,r){if(n==="exit"){const o=Xu(r,t);if(o)return u.call(e,"error",o)}return u.apply(e,arguments)}}function Xu(e,t){return mt&&e===1&&!t.file?ht(t.original,"spawn"):null}function Yo(e,t){return mt&&e===1&&!t.file?ht(t.original,"spawnSync"):null}var Zo={hookChildProcess:Jo,verifyENOENT:Xu,verifyENOENTSync:Yo,notFoundError:ht};const Qu=ND,gt=Vo,Et=Zo;function en(e,t,u){const n=gt(e,t,u),r=Qu.spawn(n.command,n.args,n.options);return Et.hookChildProcess(r,n),r}function Xo(e,t,u){const n=gt(e,t,u),r=Qu.spawnSync(n.command,n.args,n.options);return r.error=r.error||Et.verifyENOENTSync(r.status,n),r}re.exports=en,re.exports.spawn=en,re.exports.sync=Xo,re.exports._parse=gt,re.exports._enoent=Et;var Qo=re.exports,es=De(Qo);function ts(e){const t=typeof e=="string"?`
20
+ `}table({tableData:t,tableOptions:u,tableBreakpoints:n}){return ro(t.map(D=>D.map(o=>this.render(o))),n?so(n):u)}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:u,flagFormatted:n,aliasesEnabled:D,aliasFormatted:o}=t;let r="";if(o?r+=`${o}, `:D&&(r+=" "),r+=n,"placeholder"in u&&typeof u.placeholder=="string")r+=`${this.flagOperator(t)}${u.placeholder}`;else{const i=this.flagParameter("type"in u?u.type:u);i&&(r+=`${this.flagOperator(t)}${i}`)}return r}flagDefault(t){return JSON.stringify(t)}flagDescription({flag:t}){let u="description"in t?t.description??"":"";if("default"in t){let{default:n}=t;typeof n=="function"&&(n=n()),n&&(u+=` (default: ${this.flagDefault(n)})`)}return u}render(t){if(typeof t=="string")return t;if(Array.isArray(t))return t.map(u=>this.render(u)).join(`
21
+ `);if("type"in t&&this[t.type]){const u=this[t.type];if(typeof u=="function")return u.call(this,t.data)}throw new Error(`Invalid node type: ${JSON.stringify(t)}`)}}const ft=e=>e.length>0&&!e.includes(" "),{stringify:V}=JSON,wo=/[|\\{}()[\]^$+*?.]/;function dt(e){const t=[];let u,n;for(const D of e){if(n)throw new Error(`Invalid parameter: Spread parameter ${V(n)} must be last`);const o=D[0],r=D[D.length-1];let i;if(o==="<"&&r===">"&&(i=!0,u))throw new Error(`Invalid parameter: Required parameter ${V(D)} cannot come after optional parameter ${V(u)}`);if(o==="["&&r==="]"&&(i=!1,u=D),i===void 0)throw new Error(`Invalid parameter: ${V(D)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let s=D.slice(1,-1);const c=s.slice(-3)==="...";c&&(n=D,s=s.slice(0,-3));const f=s.match(wo);if(f)throw new Error(`Invalid parameter: ${V(D)}. Invalid character found ${V(f[0])}`);t.push({name:s,required:i,spread:c})}return t}function Ft(e,t,u,n){for(let D=0;D<t.length;D+=1){const{name:o,required:r,spread:i}=t[D],s=io(o);if(s in e)throw new Error(`Invalid parameter: ${V(o)} is used more than once.`);const c=i?u.slice(D):u[D];if(i&&(D=t.length),r&&(!c||i&&c.length===0))return console.error(`Error: Missing required parameter ${V(o)}
22
+ `),n(),process.exit(1);e[s]=c}}function Bo(e){return e===void 0||e!==!1}function Wu(e,t,u,n){const D={...t.flags},o=t.version;o&&(D.version={type:Boolean,description:"Show version"});const{help:r}=t,i=Bo(r);i&&!("help"in D)&&(D.help={type:Boolean,alias:"h",description:"Show help"});const s=vD(D,n,{ignore:t.ignoreArgv}),c=()=>{console.log(t.version)};if(o&&s.flags.version===!0)return c(),process.exit(0);const f=new bo,l=i&&r?.render?r.render:F=>f.render(F),a=F=>{const m=Eo({...t,...F?{help:F}:{},flags:D});console.log(l(m,f))};if(i&&s.flags.help===!0)return a(),process.exit(0);if(t.parameters){let{parameters:F}=t,m=s._;const p=F.indexOf("--"),C=F.slice(p+1),y=Object.create(null);if(p>-1&&C.length>0){F=F.slice(0,p);const v=s._["--"];m=m.slice(0,-v.length||void 0),Ft(y,dt(F),m,a),Ft(y,dt(C),v,a)}else Ft(y,dt(F),m,a);Object.assign(s._,y)}const d={...s,showVersion:c,showHelp:a};return typeof u=="function"&&u(d),{command:e,...d}}function vo(e,t){const u=new Map;for(const n of t){const D=[n.options.name],{alias:o}=n.options;o&&(Array.isArray(o)?D.push(...o):D.push(o));for(const r of D){if(u.has(r))throw new Error(`Duplicate command name found: ${V(r)}`);u.set(r,n)}}return u.get(e)}function Ao(e,t,u=process.argv.slice(2)){if(!e)throw new Error("Options is required");if("name"in e&&(!e.name||!ft(e.name)))throw new Error(`Invalid script name: ${V(e.name)}`);const n=u[0];if(e.commands&&n&&ft(n)){const D=vo(n,e.commands);if(D)return Wu(D.options.name,{...D.options,parent:e},D.callback,u.slice(1))}return Wu(void 0,e,t,u)}function zu(e,t){if(!e)throw new Error("Command options are required");const{name:u}=e;if(u===void 0)throw new Error("Command name is required");if(!ft(u))throw new Error(`Invalid command name ${JSON.stringify(u)}. Command names must be one word.`);return{options:e,callback:t}}var $o="1.17.0",xo="Writes your git commit messages for you with AI",So="sugarmo/aicommits",_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function se(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ie={exports:{}},pt,Uu;function ko(){if(Uu)return pt;Uu=1,pt=n,n.sync=D;var e=Dt;function t(o,r){var i=r.pathExt!==void 0?r.pathExt:process.env.PATHEXT;if(!i||(i=i.split(";"),i.indexOf("")!==-1))return!0;for(var s=0;s<i.length;s++){var c=i[s].toLowerCase();if(c&&o.substr(-c.length).toLowerCase()===c)return!0}return!1}function u(o,r,i){return!o.isSymbolicLink()&&!o.isFile()?!1:t(r,i)}function n(o,r,i){e.stat(o,function(s,c){i(s,s?!1:u(c,o,r))})}function D(o,r){return u(e.statSync(o),o,r)}return pt}var Ct,qu;function Mo(){if(qu)return Ct;qu=1,Ct=t,t.sync=u;var e=Dt;function t(o,r,i){e.stat(o,function(s,c){i(s,s?!1:n(c,r))})}function u(o,r){return n(e.statSync(o),r)}function n(o,r){return o.isFile()&&D(o,r)}function D(o,r){var i=o.mode,s=o.uid,c=o.gid,f=r.uid!==void 0?r.uid:process.getuid&&process.getuid(),l=r.gid!==void 0?r.gid:process.getgid&&process.getgid(),a=parseInt("100",8),d=parseInt("010",8),F=parseInt("001",8),m=a|d,p=i&F||i&d&&c===l||i&a&&s===f||i&m&&f===0;return p}return Ct}var je;process.platform==="win32"||_.TESTING_WINDOWS?je=ko():je=Mo();var Io=mt;mt.sync=Oo;function mt(e,t,u){if(typeof t=="function"&&(u=t,t={}),!u){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,D){mt(e,t||{},function(o,r){o?D(o):n(r)})})}je(e,t||{},function(n,D){n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,D=!1),u(n,D)})}function Oo(e,t){try{return je.sync(e,t||{})}catch(u){if(t&&t.ignoreErrors||u.code==="EACCES")return!1;throw u}}const ae=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Hu=N,To=ae?";":":",Vu=Io,Ku=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Ju=(e,t)=>{const u=t.colon||To,n=e.match(/\//)||ae&&e.match(/\\/)?[""]:[...ae?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(u)],D=ae?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=ae?D.split(u):[""];return ae&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:D}},Yu=(e,t,u)=>{typeof t=="function"&&(u=t,t={}),t||(t={});const{pathEnv:n,pathExt:D,pathExtExe:o}=Ju(e,t),r=[],i=c=>new Promise((f,l)=>{if(c===n.length)return t.all&&r.length?f(r):l(Ku(e));const a=n[c],d=/^".*"$/.test(a)?a.slice(1,-1):a,F=Hu.join(d,e),m=!d&&/^\.[\\\/]/.test(e)?e.slice(0,2)+F:F;f(s(m,c,0))}),s=(c,f,l)=>new Promise((a,d)=>{if(l===D.length)return a(i(f+1));const F=D[l];Vu(c+F,{pathExt:o},(m,p)=>{if(!m&&p)if(t.all)r.push(c+F);else return a(c+F);return a(s(c,f,l+1))})});return u?i(0).then(c=>u(null,c),u):i(0)},Po=(e,t)=>{t=t||{};const{pathEnv:u,pathExt:n,pathExtExe:D}=Ju(e,t),o=[];for(let r=0;r<u.length;r++){const i=u[r],s=/^".*"$/.test(i)?i.slice(1,-1):i,c=Hu.join(s,e),f=!s&&/^\.[\\\/]/.test(e)?e.slice(0,2)+c:c;for(let l=0;l<n.length;l++){const a=f+n[l];try{if(Vu.sync(a,{pathExt:D}))if(t.all)o.push(a);else return a}catch{}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw Ku(e)};var Ro=Yu;Yu.sync=Po;var ht={exports:{}};const Zu=(e={})=>{const t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};ht.exports=Zu,ht.exports.default=Zu;var _o=ht.exports;const Xu=N,jo=Ro,No=_o;function Qu(e,t){const u=e.options.env||process.env,n=process.cwd(),D=e.options.cwd!=null,o=D&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(e.options.cwd)}catch{}let r;try{r=jo.sync(e.command,{path:u[No({env:u})],pathExt:t?Xu.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return r&&(r=Xu.resolve(D?e.options.cwd:"",r)),r}function Lo(e){return Qu(e)||Qu(e,!0)}var Go=Lo,gt={};const Et=/([()\][%!^"`<>&|;, *?])/g;function Wo(e){return e=e.replace(Et,"^$1"),e}function zo(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(Et,"^$1"),t&&(e=e.replace(Et,"^$1")),e}gt.command=Wo,gt.argument=zo;var Uo=/^#!(.*)/;const qo=Uo;var Ho=(e="")=>{const t=e.match(qo);if(!t)return null;const[u,n]=t[0].replace(/#! ?/,"").split(" "),D=u.split("/").pop();return D==="env"?n:n?`${D} ${n}`:D};const yt=Dt,Vo=Ho;function Ko(e){const u=Buffer.alloc(150);let n;try{n=yt.openSync(e,"r"),yt.readSync(n,u,0,150,0),yt.closeSync(n)}catch{}return Vo(u.toString())}var Jo=Ko;const Yo=N,en=Go,tn=gt,Zo=Jo,Xo=process.platform==="win32",Qo=/\.(?:com|exe)$/i,es=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function ts(e){e.file=en(e);const t=e.file&&Zo(e.file);return t?(e.args.unshift(e.file),e.command=t,en(e)):e.file}function us(e){if(!Xo)return e;const t=ts(e),u=!Qo.test(t);if(e.options.forceShell||u){const n=es.test(t);e.command=Yo.normalize(e.command),e.command=tn.command(e.command),e.args=e.args.map(o=>tn.argument(o,n));const D=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${D}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function ns(e,t,u){t&&!Array.isArray(t)&&(u=t,t=null),t=t?t.slice(0):[],u=Object.assign({},u);const n={command:e,args:t,options:u,file:void 0,original:{command:e,args:t}};return u.shell?n:us(n)}var rs=ns;const bt=process.platform==="win32";function wt(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 Ds(e,t){if(!bt)return;const u=e.emit;e.emit=function(n,D){if(n==="exit"){const o=un(D,t);if(o)return u.call(e,"error",o)}return u.apply(e,arguments)}}function un(e,t){return bt&&e===1&&!t.file?wt(t.original,"spawn"):null}function os(e,t){return bt&&e===1&&!t.file?wt(t.original,"spawnSync"):null}var ss={hookChildProcess:Ds,verifyENOENT:un,verifyENOENTSync:os,notFoundError:wt};const nn=Jr,Bt=rs,vt=ss;function rn(e,t,u){const n=Bt(e,t,u),D=nn.spawn(n.command,n.args,n.options);return vt.hookChildProcess(D,n),D}function is(e,t,u){const n=Bt(e,t,u),D=nn.spawnSync(n.command,n.args,n.options);return D.error=D.error||vt.verifyENOENTSync(D.status,n),D}ie.exports=rn,ie.exports.spawn=rn,ie.exports.sync=is,ie.exports._parse=Bt,ie.exports._enoent=vt;var as=ie.exports,cs=se(as);function ls(e){const t=typeof e=="string"?`
23
23
  `:`
24
- `.charCodeAt(),u=typeof e=="string"?"\r":"\r".charCodeAt();return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===u&&(e=e.slice(0,-1)),e}function tn(e={}){const{env:t=process.env,platform:u=process.platform}=e;return u!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}const us=({cwd:e=M.cwd(),path:t=M.env[tn()],preferLocal:u=!0,execPath:n=M.execPath,addExecPath:r=!0}={})=>{const o=e instanceof URL?fu(e):e,D=ne.resolve(o),i=[];return u&&ns(i,D),r&&Ds(i,n,D),[...i,t].join(ne.delimiter)},ns=(e,t)=>{let u;for(;u!==t;)e.push(ne.join(t,"node_modules/.bin")),u=t,t=ne.resolve(t,"..")},Ds=(e,t,u)=>{const n=t instanceof URL?fu(t):t;e.push(ne.resolve(u,n,".."))},rs=({env:e=M.env,...t}={})=>{e={...e};const u=tn({env:e});return t.path=e[u],e[u]=us(t),e},os=(e,t,u,n)=>{if(u==="length"||u==="prototype"||u==="arguments"||u==="caller")return;const r=Object.getOwnPropertyDescriptor(e,u),o=Object.getOwnPropertyDescriptor(t,u);!ss(r,o)&&n||Object.defineProperty(e,u,o)},ss=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)},is=(e,t)=>{const u=Object.getPrototypeOf(t);u!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,u)},as=(e,t)=>`/* Wrapped ${e}*/
25
- ${t}`,cs=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),ls=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),fs=(e,t,u)=>{const n=u===""?"":`with ${u.trim()}() `,r=as.bind(null,n,t.toString());Object.defineProperty(r,"name",ls),Object.defineProperty(e,"toString",{...cs,value:r})};function ds(e,t,{ignoreNonConfigurable:u=!1}={}){const{name:n}=e;for(const r of Reflect.ownKeys(t))os(e,t,r,u);return is(e,t),fs(e,t,n),e}const Re=new WeakMap,un=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let u,n=0;const r=e.displayName||e.name||"<anonymous>",o=function(...D){if(Re.set(o,++n),n===1)u=e.apply(this,D),e=null;else if(t.throw===!0)throw new Error(`Function \`${r}\` can only be called once`);return u};return ds(o,e),Re.set(o,n),o};un.callCount=e=>{if(!Re.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Re.get(e)};const Fs=()=>{const e=Dn-nn+1;return Array.from({length:e},ps)},ps=(e,t)=>({name:`SIGRT${t+1}`,number:nn+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),nn=34,Dn=64,Cs=[{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"}],rn=()=>{const e=Fs();return[...Cs,...e].map(ms)},ms=({name:e,number:t,description:u,action:n,forced:r=!1,standard:o})=>{const{signals:{[e]:D}}=du,i=D!==void 0;return{name:e,number:i?D:t,description:u,supported:i,action:n,forced:r,standard:o}},hs=()=>{const e=rn();return Object.fromEntries(e.map(gs))},gs=({name:e,number:t,description:u,supported:n,action:r,forced:o,standard:D})=>[e,{name:e,number:t,description:u,supported:n,action:r,forced:o,standard:D}],Es=hs(),ys=()=>{const e=rn(),t=Dn+1,u=Array.from({length:t},(n,r)=>Bs(r,e));return Object.assign({},...u)},Bs=(e,t)=>{const u=bs(e,t);if(u===void 0)return{};const{name:n,description:r,supported:o,action:D,forced:i,standard:s}=u;return{[e]:{name:n,number:e,description:r,supported:o,action:D,forced:i,standard:s}}},bs=(e,t)=>{const u=t.find(({name:n})=>du.signals[n]===e);return u!==void 0?u:t.find(n=>n.number===e)};ys();const ws=({timedOut:e,timeout:t,errorCode:u,signal:n,signalDescription:r,exitCode:o,isCanceled:D})=>e?`timed out after ${t} milliseconds`:D?"was canceled":u!==void 0?`failed with ${u}`:n!==void 0?`was killed with ${n} (${r})`:o!==void 0?`failed with exit code ${o}`:"failed",on=({stdout:e,stderr:t,all:u,error:n,signal:r,exitCode:o,command:D,escapedCommand:i,timedOut:s,isCanceled:c,killed:f,parsed:{options:{timeout:l,cwd:a=M.cwd()}}})=>{o=o===null?void 0:o,r=r===null?void 0:r;const d=r===void 0?void 0:Es[r].description,F=n&&n.code,C=`Command ${ws({timedOut:s,timeout:l,errorCode:F,signal:r,signalDescription:d,exitCode:o,isCanceled:c})}: ${D}`,h=Object.prototype.toString.call(n)==="[object Error]",y=h?`${C}
26
- ${n.message}`:C,A=[y,t,e].filter(Boolean).join(`
27
- `);return h?(n.originalMessage=n.message,n.message=A):n=new Error(A),n.shortMessage=y,n.command=D,n.escapedCommand=i,n.exitCode=o,n.signal=r,n.signalDescription=d,n.stdout=e,n.stderr=t,n.cwd=a,u!==void 0&&(n.all=u),"bufferedData"in n&&delete n.bufferedData,n.failed=!0,n.timedOut=!!s,n.isCanceled=c,n.killed=f&&!s,n},_e=["stdin","stdout","stderr"],As=e=>_e.some(t=>e[t]!==void 0),vs=e=>{if(!e)return;const{stdio:t}=e;if(t===void 0)return _e.map(n=>e[n]);if(As(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${_e.map(n=>`\`${n}\``).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 u=Math.max(t.length,_e.length);return Array.from({length:u},(n,r)=>t[r])};var se={exports:{}},je={exports:{}};je.exports;var sn;function $s(){return sn||(sn=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")}(je)),je.exports}var S=T.process;const ee=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(!ee(S))se.exports=function(){return function(){}};else{var xs=Fu,pe=$s(),Ss=/^win/i.test(S.platform),Ne=pu;typeof Ne!="function"&&(Ne=Ne.EventEmitter);var R;S.__signal_exit_emitter__?R=S.__signal_exit_emitter__:(R=S.__signal_exit_emitter__=new Ne,R.count=0,R.emitted={}),R.infinite||(R.setMaxListeners(1/0),R.infinite=!0),se.exports=function(e,t){if(!ee(T.process))return function(){};xs.equal(typeof e,"function","a callback must be provided for exit handler"),Ce===!1&&an();var u="exit";t&&t.alwaysLast&&(u="afterexit");var n=function(){R.removeListener(u,e),R.listeners("exit").length===0&&R.listeners("afterexit").length===0&&yt()};return R.on(u,e),n};var yt=function(){!Ce||!ee(T.process)||(Ce=!1,pe.forEach(function(t){try{S.removeListener(t,Bt[t])}catch{}}),S.emit=bt,S.reallyExit=cn,R.count-=1)};se.exports.unload=yt;var ie=function(t,u,n){R.emitted[t]||(R.emitted[t]=!0,R.emit(t,u,n))},Bt={};pe.forEach(function(e){Bt[e]=function(){if(ee(T.process)){var u=S.listeners(e);u.length===R.count&&(yt(),ie("exit",null,e),ie("afterexit",null,e),Ss&&e==="SIGHUP"&&(e="SIGINT"),S.kill(S.pid,e))}}}),se.exports.signals=function(){return pe};var Ce=!1,an=function(){Ce||!ee(T.process)||(Ce=!0,R.count+=1,pe=pe.filter(function(t){try{return S.on(t,Bt[t]),!0}catch{return!1}}),S.emit=Is,S.reallyExit=Os)};se.exports.load=an;var cn=S.reallyExit,Os=function(t){ee(T.process)&&(S.exitCode=t||0,ie("exit",S.exitCode,null),ie("afterexit",S.exitCode,null),cn.call(S,S.exitCode))},bt=S.emit,Is=function(t,u){if(t==="exit"&&ee(T.process)){u!==void 0&&(S.exitCode=u);var n=bt.apply(this,arguments);return ie("exit",S.exitCode,null),ie("afterexit",S.exitCode,null),n}else return bt.apply(this,arguments)}}var Ms=se.exports,ks=De(Ms);const Ts=1e3*5,Ps=(e,t="SIGTERM",u={})=>{const n=e(t);return Rs(e,t,u,n),n},Rs=(e,t,u,n)=>{if(!_s(t,u,n))return;const r=Ns(u),o=setTimeout(()=>{e("SIGKILL")},r);o.unref&&o.unref()},_s=(e,{forceKillAfterTimeout:t},u)=>js(e)&&t!==!1&&u,js=e=>e===LD.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",Ns=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return Ts;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},Ls=(e,t)=>{e.kill()&&(t.isCanceled=!0)},Gs=(e,t,u)=>{e.kill(t),u(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},zs=(e,{timeout:t,killSignal:u="SIGTERM"},n)=>{if(t===0||t===void 0)return n;let r;const o=new Promise((i,s)=>{r=setTimeout(()=>{Gs(e,u,s)},t)}),D=n.finally(()=>{clearTimeout(r)});return Promise.race([o,D])},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})`)},Us=async(e,{cleanup:t,detached:u},n)=>{if(!t||u)return n;const r=ks(()=>{e.kill()});return n.finally(()=>{r()})};function ln(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"}function fn(e){return ln(e)&&e.writable!==!1&&typeof e._write=="function"&&typeof e._writableState=="object"}const qs=e=>e instanceof RD&&typeof e.then=="function",wt=(e,t,u)=>{if(typeof u=="string")return e[t].pipe(GD(u)),e;if(fn(u))return e[t].pipe(u),e;if(!qs(u))throw new TypeError("The second argument must be a string, a stream or an Execa child process.");if(!fn(u.stdin))throw new TypeError("The target child process's stdin must be available.");return e[t].pipe(u.stdin),u},Hs=e=>{e.stdout!==null&&(e.pipeStdout=wt.bind(void 0,e,"stdout")),e.stderr!==null&&(e.pipeStderr=wt.bind(void 0,e,"stderr")),e.all!==void 0&&(e.pipeAll=wt.bind(void 0,e,"all"))};var me={exports:{}};const{PassThrough:Ks}=tt;var Vs=e=>{e={...e};const{array:t}=e;let{encoding:u}=e;const n=u==="buffer";let r=!1;t?r=!(u||n):u=u||"utf8",n&&(u=null);const o=new Ks({objectMode:r});u&&o.setEncoding(u);let D=0;const i=[];return o.on("data",s=>{i.push(s),r?D=i.length:D+=s.length}),o.getBufferedValue=()=>t?i:n?Buffer.concat(i,D):i.join(""),o.getBufferedLength=()=>D,o};const{constants:Js}=WD,Ys=tt,{promisify:Zs}=Cu,Xs=Vs,Qs=Zs(Ys.pipeline);class dn extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}}async function At(e,t){if(!e)throw new Error("Expected a stream");t={maxBuffer:1/0,...t};const{maxBuffer:u}=t,n=Xs(t);return await new Promise((r,o)=>{const D=i=>{i&&n.getBufferedLength()<=Js.MAX_LENGTH&&(i.bufferedData=n.getBufferedValue()),o(i)};(async()=>{try{await Qs(e,n),r()}catch(i){D(i)}})(),n.on("data",()=>{n.getBufferedLength()>u&&D(new dn)})}),n.getBufferedValue()}me.exports=At,me.exports.buffer=(e,t)=>At(e,{...t,encoding:"buffer"}),me.exports.array=(e,t)=>At(e,{...t,array:!0}),me.exports.MaxBufferError=dn;var ei=me.exports,Fn=De(ei);const{PassThrough:ti}=tt;var ui=function(){var e=[],t=new ti({objectMode:!0});return t.setMaxListeners(0),t.add=u,t.isEmpty=n,t.on("unpipe",r),Array.prototype.slice.call(arguments).forEach(u),t;function u(o){return Array.isArray(o)?(o.forEach(u),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 n(){return e.length==0}function r(o){e=e.filter(function(D){return D!==o}),!e.length&&t.readable&&t.end()}},ni=De(ui);const Di=e=>{if(e!==void 0)throw new TypeError("The `input` and `inputFile` options cannot be both set.")},ri=({input:e,inputFile:t})=>typeof t!="string"?e:(Di(e),zD(t)),oi=(e,t)=>{const u=ri(t);u!==void 0&&(ln(u)?u.pipe(e.stdin):e.stdin.end(u))},si=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;const u=ni();return e.stdout&&u.add(e.stdout),e.stderr&&u.add(e.stderr),u},vt=async(e,t)=>{if(!(!e||t===void 0)){e.destroy();try{return await t}catch(u){return u.bufferedData}}},$t=(e,{encoding:t,buffer:u,maxBuffer:n})=>{if(!(!e||!u))return t?Fn(e,{encoding:t,maxBuffer:n}):Fn.buffer(e,{maxBuffer:n})},ii=async({stdout:e,stderr:t,all:u},{encoding:n,buffer:r,maxBuffer:o},D)=>{const i=$t(e,{encoding:n,buffer:r,maxBuffer:o}),s=$t(t,{encoding:n,buffer:r,maxBuffer:o}),c=$t(u,{encoding:n,buffer:r,maxBuffer:o*2});try{return await Promise.all([D,i,s,c])}catch(f){return Promise.all([{error:f,signal:f.signal,timedOut:f.timedOut},vt(e,i),vt(t,s),vt(u,c)])}},ai=(async()=>{})().constructor.prototype,ci=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(ai,e)]),pn=(e,t)=>{for(const[u,n]of ci){const r=typeof t=="function"?(...o)=>Reflect.apply(n.value,t(),o):n.value.bind(t);Reflect.defineProperty(e,u,{...n,value:r})}},li=e=>new Promise((t,u)=>{e.on("exit",(n,r)=>{t({exitCode:n,signal:r})}),e.on("error",n=>{u(n)}),e.stdin&&e.stdin.on("error",n=>{u(n)})}),Cn=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],fi=/^[\w.-]+$/,di=/"/g,Fi=e=>typeof e!="string"||fi.test(e)?e:`"${e.replace(di,'\\"')}"`,pi=(e,t)=>Cn(e,t).join(" "),Ci=(e,t)=>Cn(e,t).map(u=>Fi(u)).join(" "),mi=UD("execa").enabled,Le=(e,t)=>String(e).padStart(t,"0"),hi=()=>{const e=new Date;return`${Le(e.getHours(),2)}:${Le(e.getMinutes(),2)}:${Le(e.getSeconds(),2)}.${Le(e.getMilliseconds(),3)}`},gi=(e,{verbose:t})=>{t&&M.stderr.write(`[${hi()}] ${e}
28
- `)},Ei=1e3*1e3*100,yi=({env:e,extendEnv:t,preferLocal:u,localDir:n,execPath:r})=>{const o=t?{...M.env,...e}:e;return u?rs({env:o,cwd:n,execPath:r}):o},Bi=(e,t,u={})=>{const n=es._parse(e,t,u);return e=n.command,t=n.args,u=n.options,u={maxBuffer:Ei,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:u.cwd||M.cwd(),execPath:M.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,verbose:mi,...u},u.env=yi(u),u.stdio=vs(u),M.platform==="win32"&&ne.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:u,parsed:n}},xt=(e,t,u)=>typeof t!="string"&&!PD.isBuffer(t)?u===void 0?void 0:"":e.stripFinalNewline?ts(t):t;function U(e,t,u){const n=Bi(e,t,u),r=pi(e,t),o=Ci(e,t);gi(o,n.options),Ws(n.options);let D;try{D=lu.spawn(n.file,n.args,n.options)}catch(d){const F=new lu.ChildProcess,p=Promise.reject(on({error:d,stdout:"",stderr:"",all:"",command:r,escapedCommand:o,parsed:n,timedOut:!1,isCanceled:!1,killed:!1}));return pn(F,p),F}const i=li(D),s=zs(D,n.options,i),c=Us(D,n.options,s),f={isCanceled:!1};D.kill=Ps.bind(null,D.kill.bind(D)),D.cancel=Ls.bind(null,D,f);const a=un(async()=>{const[{error:d,exitCode:F,signal:p,timedOut:C},h,y,A]=await ii(D,n.options,c),_=xt(n.options,h),j=xt(n.options,y),E=xt(n.options,A);if(d||F!==0||p!==null){const v=on({error:d,exitCode:F,signal:p,stdout:_,stderr:j,all:E,command:r,escapedCommand:o,parsed:n,timedOut:C,isCanceled:f.isCanceled||(n.options.signal?n.options.signal.aborted:!1),killed:D.killed});if(!n.options.reject)return v;throw v}return{command:r,escapedCommand:o,exitCode:0,stdout:_,stderr:j,all:E,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return oi(D,n.options),D.all=si(D,n.options),Hs(D),pn(D,a),D}let te=!0;const ae=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let he=0;if(ae.process&&ae.process.env&&ae.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:u,TERM:n,COLORTERM:r}=ae.process.env;t||u||e==="0"?te=!1:e==="1"||e==="2"||e==="3"?te=!0:n==="dumb"?te=!1:"CI"in ae.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(o=>o in ae.process.env)?te=!0:te=process.stdout.isTTY,te&&(process.platform==="win32"||r&&(r==="truecolor"||r==="24bit")?he=3:n&&(n.endsWith("-256color")||n.endsWith("256"))?he=2:he=1)}let mn={enabled:te,supportLevel:he};function ue(e,t,u=1){const n=`\x1B[${e}m`,r=`\x1B[${t}m`,o=new RegExp(`\\x1b\\[${t}m`,"g");return D=>mn.enabled&&mn.supportLevel>=u?n+(""+D).replace(o,n)+r:""+D}const ge=ue(2,22),bi=ue(30,39),St=ue(31,39),Ge=ue(32,39),wi=ue(35,39),Ai=ue(90,39),vi=ue(46,49),Ot="\x1B",I=`${Ot}[`,$i="\x07",It={to(e,t){return t?`${I}${t+1};${e+1}H`:`${I}${e+1}G`},move(e,t){let u="";return e<0?u+=`${I}${-e}D`:e>0&&(u+=`${I}${e}C`),t<0?u+=`${I}${-t}A`:t>0&&(u+=`${I}${t}B`),u},up:(e=1)=>`${I}${e}A`,down:(e=1)=>`${I}${e}B`,forward:(e=1)=>`${I}${e}C`,backward:(e=1)=>`${I}${e}D`,nextLine:(e=1)=>`${I}E`.repeat(e),prevLine:(e=1)=>`${I}F`.repeat(e),left:`${I}G`,hide:`${I}?25l`,show:`${I}?25h`,save:`${Ot}7`,restore:`${Ot}8`},xi={up:(e=1)=>`${I}S`.repeat(e),down:(e=1)=>`${I}T`.repeat(e)},Si={screen:`${I}2J`,up:(e=1)=>`${I}1J`.repeat(e),down:(e=1)=>`${I}J`.repeat(e),line:`${I}2K`,lineEnd:`${I}K`,lineStart:`${I}1K`,lines(e){let t="";for(let u=0;u<e;u++)t+=this.line+(u<e-1?It.up():"");return e&&(t+=It.left),t}};var q={cursor:It,scroll:xi,erase:Si,beep:$i},Mt={exports:{}};let ze=process||{},hn=ze.argv||[],We=ze.env||{},Oi=!(We.NO_COLOR||hn.includes("--no-color"))&&(!!We.FORCE_COLOR||hn.includes("--color")||ze.platform==="win32"||(ze.stdout||{}).isTTY&&We.TERM!=="dumb"||!!We.CI),Ii=(e,t,u=e)=>n=>{let r=""+n,o=r.indexOf(t,e.length);return~o?e+Mi(r,t,u,o)+t:e+r+t},Mi=(e,t,u,n)=>{let r="",o=0;do r+=e.substring(o,n)+u,o=n+t.length,n=e.indexOf(t,o);while(~n);return r+e.substring(o)},gn=(e=Oi)=>{let t=e?Ii:()=>String;return{isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};Mt.exports=gn(),Mt.exports.createColors=gn;var ki=Mt.exports,b=De(ki);function Ti({onlyFirst:e=!1}={}){const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}const Pi=Ti();function En(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(Pi,"")}function yn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bn={exports:{}};(function(e){var t={};e.exports=t,t.eastAsianWidth=function(n){var r=n.charCodeAt(0),o=n.length==2?n.charCodeAt(1):0,D=r;return 55296<=r&&r<=56319&&56320<=o&&o<=57343&&(r&=1023,o&=1023,D=r<<10|o,D+=65536),D==12288||65281<=D&&D<=65376||65504<=D&&D<=65510?"F":D==8361||65377<=D&&D<=65470||65474<=D&&D<=65479||65482<=D&&D<=65487||65490<=D&&D<=65495||65498<=D&&D<=65500||65512<=D&&D<=65518?"H":4352<=D&&D<=4447||4515<=D&&D<=4519||4602<=D&&D<=4607||9001<=D&&D<=9002||11904<=D&&D<=11929||11931<=D&&D<=12019||12032<=D&&D<=12245||12272<=D&&D<=12283||12289<=D&&D<=12350||12353<=D&&D<=12438||12441<=D&&D<=12543||12549<=D&&D<=12589||12593<=D&&D<=12686||12688<=D&&D<=12730||12736<=D&&D<=12771||12784<=D&&D<=12830||12832<=D&&D<=12871||12880<=D&&D<=13054||13056<=D&&D<=19903||19968<=D&&D<=42124||42128<=D&&D<=42182||43360<=D&&D<=43388||44032<=D&&D<=55203||55216<=D&&D<=55238||55243<=D&&D<=55291||63744<=D&&D<=64255||65040<=D&&D<=65049||65072<=D&&D<=65106||65108<=D&&D<=65126||65128<=D&&D<=65131||110592<=D&&D<=110593||127488<=D&&D<=127490||127504<=D&&D<=127546||127552<=D&&D<=127560||127568<=D&&D<=127569||131072<=D&&D<=194367||177984<=D&&D<=196605||196608<=D&&D<=262141?"W":32<=D&&D<=126||162<=D&&D<=163||165<=D&&D<=166||D==172||D==175||10214<=D&&D<=10221||10629<=D&&D<=10630?"Na":D==161||D==164||167<=D&&D<=168||D==170||173<=D&&D<=174||176<=D&&D<=180||182<=D&&D<=186||188<=D&&D<=191||D==198||D==208||215<=D&&D<=216||222<=D&&D<=225||D==230||232<=D&&D<=234||236<=D&&D<=237||D==240||242<=D&&D<=243||247<=D&&D<=250||D==252||D==254||D==257||D==273||D==275||D==283||294<=D&&D<=295||D==299||305<=D&&D<=307||D==312||319<=D&&D<=322||D==324||328<=D&&D<=331||D==333||338<=D&&D<=339||358<=D&&D<=359||D==363||D==462||D==464||D==466||D==468||D==470||D==472||D==474||D==476||D==593||D==609||D==708||D==711||713<=D&&D<=715||D==717||D==720||728<=D&&D<=731||D==733||D==735||768<=D&&D<=879||913<=D&&D<=929||931<=D&&D<=937||945<=D&&D<=961||963<=D&&D<=969||D==1025||1040<=D&&D<=1103||D==1105||D==8208||8211<=D&&D<=8214||8216<=D&&D<=8217||8220<=D&&D<=8221||8224<=D&&D<=8226||8228<=D&&D<=8231||D==8240||8242<=D&&D<=8243||D==8245||D==8251||D==8254||D==8308||D==8319||8321<=D&&D<=8324||D==8364||D==8451||D==8453||D==8457||D==8467||D==8470||8481<=D&&D<=8482||D==8486||D==8491||8531<=D&&D<=8532||8539<=D&&D<=8542||8544<=D&&D<=8555||8560<=D&&D<=8569||D==8585||8592<=D&&D<=8601||8632<=D&&D<=8633||D==8658||D==8660||D==8679||D==8704||8706<=D&&D<=8707||8711<=D&&D<=8712||D==8715||D==8719||D==8721||D==8725||D==8730||8733<=D&&D<=8736||D==8739||D==8741||8743<=D&&D<=8748||D==8750||8756<=D&&D<=8759||8764<=D&&D<=8765||D==8776||D==8780||D==8786||8800<=D&&D<=8801||8804<=D&&D<=8807||8810<=D&&D<=8811||8814<=D&&D<=8815||8834<=D&&D<=8835||8838<=D&&D<=8839||D==8853||D==8857||D==8869||D==8895||D==8978||9312<=D&&D<=9449||9451<=D&&D<=9547||9552<=D&&D<=9587||9600<=D&&D<=9615||9618<=D&&D<=9621||9632<=D&&D<=9633||9635<=D&&D<=9641||9650<=D&&D<=9651||9654<=D&&D<=9655||9660<=D&&D<=9661||9664<=D&&D<=9665||9670<=D&&D<=9672||D==9675||9678<=D&&D<=9681||9698<=D&&D<=9701||D==9711||9733<=D&&D<=9734||D==9737||9742<=D&&D<=9743||9748<=D&&D<=9749||D==9756||D==9758||D==9792||D==9794||9824<=D&&D<=9825||9827<=D&&D<=9829||9831<=D&&D<=9834||9836<=D&&D<=9837||D==9839||9886<=D&&D<=9887||9918<=D&&D<=9919||9924<=D&&D<=9933||9935<=D&&D<=9953||D==9955||9960<=D&&D<=9983||D==10045||D==10071||10102<=D&&D<=10111||11093<=D&&D<=11097||12872<=D&&D<=12879||57344<=D&&D<=63743||65024<=D&&D<=65039||D==65533||127232<=D&&D<=127242||127248<=D&&D<=127277||127280<=D&&D<=127337||127344<=D&&D<=127386||917760<=D&&D<=917999||983040<=D&&D<=1048573||1048576<=D&&D<=1114109?"A":"N"},t.characterLength=function(n){var r=this.eastAsianWidth(n);return r=="F"||r=="W"||r=="A"?2:1};function u(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(n){for(var r=u(n),o=0,D=0;D<r.length;D++)o=o+this.characterLength(r[D]);return o},t.slice=function(n,r,o){textLen=t.length(n),r=r||0,o=o||1,r<0&&(r=textLen+r),o<0&&(o=textLen+o);for(var D="",i=0,s=u(n),c=0;c<s.length;c++){var f=s[c],l=t.length(f);if(i>=r-(l==2?1:0))if(i+l<=o)D+=f;else break;i+=l}return D}})(Bn);var Ri=Bn.exports;const _i=yn(Ri);var ji=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};const Ni=yn(ji);function Ee(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=En(e),e.length===0))return 0;e=e.replace(Ni()," ");const u=t.ambiguousIsNarrow?1:2;let n=0;for(const r of e){const o=r.codePointAt(0);if(!(o<=31||o>=127&&o<=159||o>=768&&o<=879))switch(_i.eastAsianWidth(r)){case"F":case"W":n+=2;break;case"A":n+=u;break;default:n+=1}}return n}const kt=10,bn=(e=0)=>t=>`\x1B[${t+e}m`,wn=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,An=(e=0)=>(t,u,n)=>`\x1B[${38+e};2;${t};${u};${n}m`,O={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(O.modifier);const Li=Object.keys(O.color),Gi=Object.keys(O.bgColor);[...Li,...Gi];function zi(){const e=new Map;for(const[t,u]of Object.entries(O)){for(const[n,r]of Object.entries(u))O[n]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},u[n]=O[n],e.set(r[0],r[1]);Object.defineProperty(O,t,{value:u,enumerable:!1})}return Object.defineProperty(O,"codes",{value:e,enumerable:!1}),O.color.close="\x1B[39m",O.bgColor.close="\x1B[49m",O.color.ansi=bn(),O.color.ansi256=wn(),O.color.ansi16m=An(),O.bgColor.ansi=bn(kt),O.bgColor.ansi256=wn(kt),O.bgColor.ansi16m=An(kt),Object.defineProperties(O,{rgbToAnsi256:{value:(t,u,n)=>t===u&&u===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(u/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:t=>{const u=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!u)return[0,0,0];let[n]=u;n.length===3&&(n=[...n].map(o=>o+o).join(""));const r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:t=>O.rgbToAnsi256(...O.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:t=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let u,n,r;if(t>=232)u=((t-232)*10+8)/255,n=u,r=u;else{t-=16;const i=t%36;u=Math.floor(t/36)/5,n=Math.floor(i/6)/5,r=i%6/5}const o=Math.max(u,n,r)*2;if(o===0)return 30;let D=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(u));return o===2&&(D+=60),D},enumerable:!1},rgbToAnsi:{value:(t,u,n)=>O.ansi256ToAnsi(O.rgbToAnsi256(t,u,n)),enumerable:!1},hexToAnsi:{value:t=>O.ansi256ToAnsi(O.hexToAnsi256(t)),enumerable:!1}}),O}const Wi=zi(),Ue=new Set(["\x1B","\x9B"]),Ui=39,Tt="\x07",vn="[",qi="]",$n="m",Pt=`${qi}8;;`,xn=e=>`${Ue.values().next().value}${vn}${e}${$n}`,Sn=e=>`${Ue.values().next().value}${Pt}${e}${Tt}`,Hi=e=>e.split(" ").map(t=>Ee(t)),Rt=(e,t,u)=>{const n=[...t];let r=!1,o=!1,D=Ee(En(e[e.length-1]));for(const[i,s]of n.entries()){const c=Ee(s);if(D+c<=u?e[e.length-1]+=s:(e.push(s),D=0),Ue.has(s)&&(r=!0,o=n.slice(i+1).join("").startsWith(Pt)),r){o?s===Tt&&(r=!1,o=!1):s===$n&&(r=!1);continue}D+=c,D===u&&i<n.length-1&&(e.push(""),D=0)}!D&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},Ki=e=>{const t=e.split(" ");let u=t.length;for(;u>0&&!(Ee(t[u-1])>0);)u--;return u===t.length?e:t.slice(0,u).join(" ")+t.slice(u).join("")},Vi=(e,t,u={})=>{if(u.trim!==!1&&e.trim()==="")return"";let n="",r,o;const D=Hi(e);let i=[""];for(const[c,f]of e.split(" ").entries()){u.trim!==!1&&(i[i.length-1]=i[i.length-1].trimStart());let l=Ee(i[i.length-1]);if(c!==0&&(l>=t&&(u.wordWrap===!1||u.trim===!1)&&(i.push(""),l=0),(l>0||u.trim===!1)&&(i[i.length-1]+=" ",l++)),u.hard&&D[c]>t){const a=t-l,d=1+Math.floor((D[c]-a-1)/t);Math.floor((D[c]-1)/t)<d&&i.push(""),Rt(i,f,t);continue}if(l+D[c]>t&&l>0&&D[c]>0){if(u.wordWrap===!1&&l<t){Rt(i,f,t);continue}i.push("")}if(l+D[c]>t&&u.wordWrap===!1){Rt(i,f,t);continue}i[i.length-1]+=f}u.trim!==!1&&(i=i.map(c=>Ki(c)));const s=[...i.join(`
29
- `)];for(const[c,f]of s.entries()){if(n+=f,Ue.has(f)){const{groups:a}=new RegExp(`(?:\\${vn}(?<code>\\d+)m|\\${Pt}(?<uri>.*)${Tt})`).exec(s.slice(c).join(""))||{groups:{}};if(a.code!==void 0){const d=Number.parseFloat(a.code);r=d===Ui?void 0:d}else a.uri!==void 0&&(o=a.uri.length===0?void 0:a.uri)}const l=Wi.codes.get(Number(r));s[c+1]===`
30
- `?(o&&(n+=Sn("")),r&&l&&(n+=xn(l))):f===`
31
- `&&(r&&l&&(n+=xn(r)),o&&(n+=Sn(o)))}return n};function On(e,t,u){return String(e).normalize().replace(/\r\n/g,`
24
+ `.charCodeAt(),u=typeof e=="string"?"\r":"\r".charCodeAt();return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===u&&(e=e.slice(0,-1)),e}function Dn(e={}){const{env:t=process.env,platform:u=process.platform}=e;return u!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}const fs=({cwd:e=T.cwd(),path:t=T.env[Dn()],preferLocal:u=!0,execPath:n=T.execPath,addExecPath:D=!0}={})=>{const o=e instanceof URL?Cu(e):e,r=oe.resolve(o),i=[];return u&&ds(i,r),D&&Fs(i,n,r),[...i,t].join(oe.delimiter)},ds=(e,t)=>{let u;for(;u!==t;)e.push(oe.join(t,"node_modules/.bin")),u=t,t=oe.resolve(t,"..")},Fs=(e,t,u)=>{const n=t instanceof URL?Cu(t):t;e.push(oe.resolve(u,n,".."))},ps=({env:e=T.env,...t}={})=>{e={...e};const u=Dn({env:e});return t.path=e[u],e[u]=fs(t),e},Cs=(e,t,u,n)=>{if(u==="length"||u==="prototype"||u==="arguments"||u==="caller")return;const D=Object.getOwnPropertyDescriptor(e,u),o=Object.getOwnPropertyDescriptor(t,u);!ms(D,o)&&n||Object.defineProperty(e,u,o)},ms=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)},hs=(e,t)=>{const u=Object.getPrototypeOf(t);u!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,u)},gs=(e,t)=>`/* Wrapped ${e}*/
25
+ ${t}`,Es=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),ys=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),bs=(e,t,u)=>{const n=u===""?"":`with ${u.trim()}() `,D=gs.bind(null,n,t.toString());Object.defineProperty(D,"name",ys),Object.defineProperty(e,"toString",{...Es,value:D})};function ws(e,t,{ignoreNonConfigurable:u=!1}={}){const{name:n}=e;for(const D of Reflect.ownKeys(t))Cs(e,t,D,u);return hs(e,t),bs(e,t,n),e}const Ne=new WeakMap,on=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let u,n=0;const D=e.displayName||e.name||"<anonymous>",o=function(...r){if(Ne.set(o,++n),n===1)u=e.apply(this,r),e=null;else if(t.throw===!0)throw new Error(`Function \`${D}\` can only be called once`);return u};return ws(o,e),Ne.set(o,n),o};on.callCount=e=>{if(!Ne.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Ne.get(e)};const Bs=()=>{const e=an-sn+1;return Array.from({length:e},vs)},vs=(e,t)=>({name:`SIGRT${t+1}`,number:sn+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),sn=34,an=64,As=[{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"}],cn=()=>{const e=Bs();return[...As,...e].map($s)},$s=({name:e,number:t,description:u,action:n,forced:D=!1,standard:o})=>{const{signals:{[e]:r}}=mu,i=r!==void 0;return{name:e,number:i?r:t,description:u,supported:i,action:n,forced:D,standard:o}},xs=()=>{const e=cn();return Object.fromEntries(e.map(Ss))},Ss=({name:e,number:t,description:u,supported:n,action:D,forced:o,standard:r})=>[e,{name:e,number:t,description:u,supported:n,action:D,forced:o,standard:r}],ks=xs(),Ms=()=>{const e=cn(),t=an+1,u=Array.from({length:t},(n,D)=>Is(D,e));return Object.assign({},...u)},Is=(e,t)=>{const u=Os(e,t);if(u===void 0)return{};const{name:n,description:D,supported:o,action:r,forced:i,standard:s}=u;return{[e]:{name:n,number:e,description:D,supported:o,action:r,forced:i,standard:s}}},Os=(e,t)=>{const u=t.find(({name:n})=>mu.signals[n]===e);return u!==void 0?u:t.find(n=>n.number===e)};Ms();const Ts=({timedOut:e,timeout:t,errorCode:u,signal:n,signalDescription:D,exitCode:o,isCanceled:r})=>e?`timed out after ${t} milliseconds`:r?"was canceled":u!==void 0?`failed with ${u}`:n!==void 0?`was killed with ${n} (${D})`:o!==void 0?`failed with exit code ${o}`:"failed",ln=({stdout:e,stderr:t,all:u,error:n,signal:D,exitCode:o,command:r,escapedCommand:i,timedOut:s,isCanceled:c,killed:f,parsed:{options:{timeout:l,cwd:a=T.cwd()}}})=>{o=o===null?void 0:o,D=D===null?void 0:D;const d=D===void 0?void 0:ks[D].description,F=n&&n.code,p=`Command ${Ts({timedOut:s,timeout:l,errorCode:F,signal:D,signalDescription:d,exitCode:o,isCanceled:c})}: ${r}`,C=Object.prototype.toString.call(n)==="[object Error]",y=C?`${p}
26
+ ${n.message}`:p,v=[y,t,e].filter(Boolean).join(`
27
+ `);return C?(n.originalMessage=n.message,n.message=v):n=new Error(v),n.shortMessage=y,n.command=r,n.escapedCommand=i,n.exitCode=o,n.signal=D,n.signalDescription=d,n.stdout=e,n.stderr=t,n.cwd=a,u!==void 0&&(n.all=u),"bufferedData"in n&&delete n.bufferedData,n.failed=!0,n.timedOut=!!s,n.isCanceled=c,n.killed=f&&!s,n},Le=["stdin","stdout","stderr"],Ps=e=>Le.some(t=>e[t]!==void 0),Rs=e=>{if(!e)return;const{stdio:t}=e;if(t===void 0)return Le.map(n=>e[n]);if(Ps(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Le.map(n=>`\`${n}\``).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 u=Math.max(t.length,Le.length);return Array.from({length:u},(n,D)=>t[D])};var ce={exports:{}},Ge={exports:{}};Ge.exports;var fn;function _s(){return fn||(fn=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")}(Ge)),Ge.exports}var S=_.process;const ne=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(!ne(S))ce.exports=function(){return function(){}};else{var js=hu,Ce=_s(),Ns=/^win/i.test(S.platform),We=gu;typeof We!="function"&&(We=We.EventEmitter);var j;S.__signal_exit_emitter__?j=S.__signal_exit_emitter__:(j=S.__signal_exit_emitter__=new We,j.count=0,j.emitted={}),j.infinite||(j.setMaxListeners(1/0),j.infinite=!0),ce.exports=function(e,t){if(!ne(_.process))return function(){};js.equal(typeof e,"function","a callback must be provided for exit handler"),me===!1&&dn();var u="exit";t&&t.alwaysLast&&(u="afterexit");var n=function(){j.removeListener(u,e),j.listeners("exit").length===0&&j.listeners("afterexit").length===0&&At()};return j.on(u,e),n};var At=function(){!me||!ne(_.process)||(me=!1,Ce.forEach(function(t){try{S.removeListener(t,$t[t])}catch{}}),S.emit=xt,S.reallyExit=Fn,j.count-=1)};ce.exports.unload=At;var le=function(t,u,n){j.emitted[t]||(j.emitted[t]=!0,j.emit(t,u,n))},$t={};Ce.forEach(function(e){$t[e]=function(){if(ne(_.process)){var u=S.listeners(e);u.length===j.count&&(At(),le("exit",null,e),le("afterexit",null,e),Ns&&e==="SIGHUP"&&(e="SIGINT"),S.kill(S.pid,e))}}}),ce.exports.signals=function(){return Ce};var me=!1,dn=function(){me||!ne(_.process)||(me=!0,j.count+=1,Ce=Ce.filter(function(t){try{return S.on(t,$t[t]),!0}catch{return!1}}),S.emit=Gs,S.reallyExit=Ls)};ce.exports.load=dn;var Fn=S.reallyExit,Ls=function(t){ne(_.process)&&(S.exitCode=t||0,le("exit",S.exitCode,null),le("afterexit",S.exitCode,null),Fn.call(S,S.exitCode))},xt=S.emit,Gs=function(t,u){if(t==="exit"&&ne(_.process)){u!==void 0&&(S.exitCode=u);var n=xt.apply(this,arguments);return le("exit",S.exitCode,null),le("afterexit",S.exitCode,null),n}else return xt.apply(this,arguments)}}var Ws=ce.exports,zs=se(Ws);const Us=1e3*5,qs=(e,t="SIGTERM",u={})=>{const n=e(t);return Hs(e,t,u,n),n},Hs=(e,t,u,n)=>{if(!Vs(t,u,n))return;const D=Js(u),o=setTimeout(()=>{e("SIGKILL")},D);o.unref&&o.unref()},Vs=(e,{forceKillAfterTimeout:t},u)=>Ks(e)&&t!==!1&&u,Ks=e=>e===Yr.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",Js=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return Us;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)},Zs=(e,t,u)=>{e.kill(t),u(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},Xs=(e,{timeout:t,killSignal:u="SIGTERM"},n)=>{if(t===0||t===void 0)return n;let D;const o=new Promise((i,s)=>{D=setTimeout(()=>{Zs(e,u,s)},t)}),r=n.finally(()=>{clearTimeout(D)});return Promise.race([o,r])},Qs=({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})`)},ei=async(e,{cleanup:t,detached:u},n)=>{if(!t||u)return n;const D=zs(()=>{e.kill()});return n.finally(()=>{D()})};function pn(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"}function Cn(e){return pn(e)&&e.writable!==!1&&typeof e._write=="function"&&typeof e._writableState=="object"}const ti=e=>e instanceof Hr&&typeof e.then=="function",St=(e,t,u)=>{if(typeof u=="string")return e[t].pipe(Zr(u)),e;if(Cn(u))return e[t].pipe(u),e;if(!ti(u))throw new TypeError("The second argument must be a string, a stream or an Execa child process.");if(!Cn(u.stdin))throw new TypeError("The target child process's stdin must be available.");return e[t].pipe(u.stdin),u},ui=e=>{e.stdout!==null&&(e.pipeStdout=St.bind(void 0,e,"stdout")),e.stderr!==null&&(e.pipeStderr=St.bind(void 0,e,"stderr")),e.all!==void 0&&(e.pipeAll=St.bind(void 0,e,"all"))};var he={exports:{}};const{PassThrough:ni}=ot;var ri=e=>{e={...e};const{array:t}=e;let{encoding:u}=e;const n=u==="buffer";let D=!1;t?D=!(u||n):u=u||"utf8",n&&(u=null);const o=new ni({objectMode:D});u&&o.setEncoding(u);let r=0;const i=[];return o.on("data",s=>{i.push(s),D?r=i.length:r+=s.length}),o.getBufferedValue=()=>t?i:n?Buffer.concat(i,r):i.join(""),o.getBufferedLength=()=>r,o};const{constants:Di}=Qr,oi=ot,{promisify:si}=Eu,ii=ri,ai=si(oi.pipeline);class mn extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}}async function kt(e,t){if(!e)throw new Error("Expected a stream");t={maxBuffer:1/0,...t};const{maxBuffer:u}=t,n=ii(t);return await new Promise((D,o)=>{const r=i=>{i&&n.getBufferedLength()<=Di.MAX_LENGTH&&(i.bufferedData=n.getBufferedValue()),o(i)};(async()=>{try{await ai(e,n),D()}catch(i){r(i)}})(),n.on("data",()=>{n.getBufferedLength()>u&&r(new mn)})}),n.getBufferedValue()}he.exports=kt,he.exports.buffer=(e,t)=>kt(e,{...t,encoding:"buffer"}),he.exports.array=(e,t)=>kt(e,{...t,array:!0}),he.exports.MaxBufferError=mn;var ci=he.exports,hn=se(ci);const{PassThrough:li}=ot;var fi=function(){var e=[],t=new li({objectMode:!0});return t.setMaxListeners(0),t.add=u,t.isEmpty=n,t.on("unpipe",D),Array.prototype.slice.call(arguments).forEach(u),t;function u(o){return Array.isArray(o)?(o.forEach(u),this):(e.push(o),o.once("end",D.bind(null,o)),o.once("error",t.emit.bind(t,"error")),o.pipe(t,{end:!1}),this)}function n(){return e.length==0}function D(o){e=e.filter(function(r){return r!==o}),!e.length&&t.readable&&t.end()}},di=se(fi);const Fi=e=>{if(e!==void 0)throw new TypeError("The `input` and `inputFile` options cannot be both set.")},pi=({input:e,inputFile:t})=>typeof t!="string"?e:(Fi(e),Xr(t)),Ci=(e,t)=>{const u=pi(t);u!==void 0&&(pn(u)?u.pipe(e.stdin):e.stdin.end(u))},mi=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;const u=di();return e.stdout&&u.add(e.stdout),e.stderr&&u.add(e.stderr),u},Mt=async(e,t)=>{if(!(!e||t===void 0)){e.destroy();try{return await t}catch(u){return u.bufferedData}}},It=(e,{encoding:t,buffer:u,maxBuffer:n})=>{if(!(!e||!u))return t?hn(e,{encoding:t,maxBuffer:n}):hn.buffer(e,{maxBuffer:n})},hi=async({stdout:e,stderr:t,all:u},{encoding:n,buffer:D,maxBuffer:o},r)=>{const i=It(e,{encoding:n,buffer:D,maxBuffer:o}),s=It(t,{encoding:n,buffer:D,maxBuffer:o}),c=It(u,{encoding:n,buffer:D,maxBuffer:o*2});try{return await Promise.all([r,i,s,c])}catch(f){return Promise.all([{error:f,signal:f.signal,timedOut:f.timedOut},Mt(e,i),Mt(t,s),Mt(u,c)])}},gi=(async()=>{})().constructor.prototype,Ei=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(gi,e)]),gn=(e,t)=>{for(const[u,n]of Ei){const D=typeof t=="function"?(...o)=>Reflect.apply(n.value,t(),o):n.value.bind(t);Reflect.defineProperty(e,u,{...n,value:D})}},yi=e=>new Promise((t,u)=>{e.on("exit",(n,D)=>{t({exitCode:n,signal:D})}),e.on("error",n=>{u(n)}),e.stdin&&e.stdin.on("error",n=>{u(n)})}),En=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],bi=/^[\w.-]+$/,wi=/"/g,Bi=e=>typeof e!="string"||bi.test(e)?e:`"${e.replace(wi,'\\"')}"`,vi=(e,t)=>En(e,t).join(" "),Ai=(e,t)=>En(e,t).map(u=>Bi(u)).join(" "),$i=eD("execa").enabled,ze=(e,t)=>String(e).padStart(t,"0"),xi=()=>{const e=new Date;return`${ze(e.getHours(),2)}:${ze(e.getMinutes(),2)}:${ze(e.getSeconds(),2)}.${ze(e.getMilliseconds(),3)}`},Si=(e,{verbose:t})=>{t&&T.stderr.write(`[${xi()}] ${e}
28
+ `)},ki=1e3*1e3*100,Mi=({env:e,extendEnv:t,preferLocal:u,localDir:n,execPath:D})=>{const o=t?{...T.env,...e}:e;return u?ps({env:o,cwd:n,execPath:D}):o},Ii=(e,t,u={})=>{const n=cs._parse(e,t,u);return e=n.command,t=n.args,u=n.options,u={maxBuffer:ki,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:u.cwd||T.cwd(),execPath:T.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,verbose:$i,...u},u.env=Mi(u),u.stdio=Rs(u),T.platform==="win32"&&oe.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:u,parsed:n}},Ot=(e,t,u)=>typeof t!="string"&&!qr.isBuffer(t)?u===void 0?void 0:"":e.stripFinalNewline?ls(t):t;function q(e,t,u){const n=Ii(e,t,u),D=vi(e,t),o=Ai(e,t);Si(o,n.options),Qs(n.options);let r;try{r=pu.spawn(n.file,n.args,n.options)}catch(d){const F=new pu.ChildProcess,m=Promise.reject(ln({error:d,stdout:"",stderr:"",all:"",command:D,escapedCommand:o,parsed:n,timedOut:!1,isCanceled:!1,killed:!1}));return gn(F,m),F}const i=yi(r),s=Xs(r,n.options,i),c=ei(r,n.options,s),f={isCanceled:!1};r.kill=qs.bind(null,r.kill.bind(r)),r.cancel=Ys.bind(null,r,f);const a=on(async()=>{const[{error:d,exitCode:F,signal:m,timedOut:p},C,y,v]=await hi(r,n.options,c),I=Ot(n.options,C),$=Ot(n.options,y),g=Ot(n.options,v);if(d||F!==0||m!==null){const b=ln({error:d,exitCode:F,signal:m,stdout:I,stderr:$,all:g,command:D,escapedCommand:o,parsed:n,timedOut:p,isCanceled:f.isCanceled||(n.options.signal?n.options.signal.aborted:!1),killed:r.killed});if(!n.options.reject)return b;throw b}return{command:D,escapedCommand:o,exitCode:0,stdout:I,stderr:$,all:g,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return Ci(r,n.options),r.all=mi(r,n.options),ui(r),gn(r,a),r}let re=!0;const fe=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let ge=0;if(fe.process&&fe.process.env&&fe.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:u,TERM:n,COLORTERM:D}=fe.process.env;t||u||e==="0"?re=!1:e==="1"||e==="2"||e==="3"?re=!0:n==="dumb"?re=!1:"CI"in fe.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(o=>o in fe.process.env)?re=!0:re=process.stdout.isTTY,re&&(process.platform==="win32"||D&&(D==="truecolor"||D==="24bit")?ge=3:n&&(n.endsWith("-256color")||n.endsWith("256"))?ge=2:ge=1)}let yn={enabled:re,supportLevel:ge};function De(e,t,u=1){const n=`\x1B[${e}m`,D=`\x1B[${t}m`,o=new RegExp(`\\x1b\\[${t}m`,"g");return r=>yn.enabled&&yn.supportLevel>=u?n+(""+r).replace(o,n)+D:""+r}const Ue=De(2,22),Oi=De(30,39),Tt=De(31,39),qe=De(32,39),Ti=De(35,39),Pi=De(90,39),Ri=De(46,49),Pt="\x1B",M=`${Pt}[`,_i="\x07",Rt={to(e,t){return t?`${M}${t+1};${e+1}H`:`${M}${e+1}G`},move(e,t){let u="";return e<0?u+=`${M}${-e}D`:e>0&&(u+=`${M}${e}C`),t<0?u+=`${M}${-t}A`:t>0&&(u+=`${M}${t}B`),u},up:(e=1)=>`${M}${e}A`,down:(e=1)=>`${M}${e}B`,forward:(e=1)=>`${M}${e}C`,backward:(e=1)=>`${M}${e}D`,nextLine:(e=1)=>`${M}E`.repeat(e),prevLine:(e=1)=>`${M}F`.repeat(e),left:`${M}G`,hide:`${M}?25l`,show:`${M}?25h`,save:`${Pt}7`,restore:`${Pt}8`},ji={up:(e=1)=>`${M}S`.repeat(e),down:(e=1)=>`${M}T`.repeat(e)},Ni={screen:`${M}2J`,up:(e=1)=>`${M}1J`.repeat(e),down:(e=1)=>`${M}J`.repeat(e),line:`${M}2K`,lineEnd:`${M}K`,lineStart:`${M}1K`,lines(e){let t="";for(let u=0;u<e;u++)t+=this.line+(u<e-1?Rt.up():"");return e&&(t+=Rt.left),t}};var K={cursor:Rt,scroll:ji,erase:Ni,beep:_i},_t={exports:{}};let He=process||{},bn=He.argv||[],Ve=He.env||{},Li=!(Ve.NO_COLOR||bn.includes("--no-color"))&&(!!Ve.FORCE_COLOR||bn.includes("--color")||He.platform==="win32"||(He.stdout||{}).isTTY&&Ve.TERM!=="dumb"||!!Ve.CI),Gi=(e,t,u=e)=>n=>{let D=""+n,o=D.indexOf(t,e.length);return~o?e+Wi(D,t,u,o)+t:e+D+t},Wi=(e,t,u,n)=>{let D="",o=0;do D+=e.substring(o,n)+u,o=n+t.length,n=e.indexOf(t,o);while(~n);return D+e.substring(o)},wn=(e=Li)=>{let t=e?Gi:()=>String;return{isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};_t.exports=wn(),_t.exports.createColors=wn;var zi=_t.exports,E=se(zi);function Ui({onlyFirst:e=!1}={}){const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}const qi=Ui();function Bn(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(qi,"")}function vn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var An={exports:{}};(function(e){var t={};e.exports=t,t.eastAsianWidth=function(n){var D=n.charCodeAt(0),o=n.length==2?n.charCodeAt(1):0,r=D;return 55296<=D&&D<=56319&&56320<=o&&o<=57343&&(D&=1023,o&=1023,r=D<<10|o,r+=65536),r==12288||65281<=r&&r<=65376||65504<=r&&r<=65510?"F":r==8361||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?"H":4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?"W":32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||r==172||r==175||10214<=r&&r<=10221||10629<=r&&r<=10630?"Na":r==161||r==164||167<=r&&r<=168||r==170||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||r==198||r==208||215<=r&&r<=216||222<=r&&r<=225||r==230||232<=r&&r<=234||236<=r&&r<=237||r==240||242<=r&&r<=243||247<=r&&r<=250||r==252||r==254||r==257||r==273||r==275||r==283||294<=r&&r<=295||r==299||305<=r&&r<=307||r==312||319<=r&&r<=322||r==324||328<=r&&r<=331||r==333||338<=r&&r<=339||358<=r&&r<=359||r==363||r==462||r==464||r==466||r==468||r==470||r==472||r==474||r==476||r==593||r==609||r==708||r==711||713<=r&&r<=715||r==717||r==720||728<=r&&r<=731||r==733||r==735||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||r==1025||1040<=r&&r<=1103||r==1105||r==8208||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||r==8240||8242<=r&&r<=8243||r==8245||r==8251||r==8254||r==8308||r==8319||8321<=r&&r<=8324||r==8364||r==8451||r==8453||r==8457||r==8467||r==8470||8481<=r&&r<=8482||r==8486||r==8491||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||r==8585||8592<=r&&r<=8601||8632<=r&&r<=8633||r==8658||r==8660||r==8679||r==8704||8706<=r&&r<=8707||8711<=r&&r<=8712||r==8715||r==8719||r==8721||r==8725||r==8730||8733<=r&&r<=8736||r==8739||r==8741||8743<=r&&r<=8748||r==8750||8756<=r&&r<=8759||8764<=r&&r<=8765||r==8776||r==8780||r==8786||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||r==8853||r==8857||r==8869||r==8895||r==8978||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||r==9675||9678<=r&&r<=9681||9698<=r&&r<=9701||r==9711||9733<=r&&r<=9734||r==9737||9742<=r&&r<=9743||9748<=r&&r<=9749||r==9756||r==9758||r==9792||r==9794||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||r==9839||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||r==9955||9960<=r&&r<=9983||r==10045||r==10071||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||r==65533||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?"A":"N"},t.characterLength=function(n){var D=this.eastAsianWidth(n);return D=="F"||D=="W"||D=="A"?2:1};function u(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(n){for(var D=u(n),o=0,r=0;r<D.length;r++)o=o+this.characterLength(D[r]);return o},t.slice=function(n,D,o){textLen=t.length(n),D=D||0,o=o||1,D<0&&(D=textLen+D),o<0&&(o=textLen+o);for(var r="",i=0,s=u(n),c=0;c<s.length;c++){var f=s[c],l=t.length(f);if(i>=D-(l==2?1:0))if(i+l<=o)r+=f;else break;i+=l}return r}})(An);var Hi=An.exports;const Vi=vn(Hi);var Ki=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};const Ji=vn(Ki);function Ee(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=Bn(e),e.length===0))return 0;e=e.replace(Ji()," ");const u=t.ambiguousIsNarrow?1:2;let n=0;for(const D of e){const o=D.codePointAt(0);if(!(o<=31||o>=127&&o<=159||o>=768&&o<=879))switch(Vi.eastAsianWidth(D)){case"F":case"W":n+=2;break;case"A":n+=u;break;default:n+=1}}return n}const jt=10,$n=(e=0)=>t=>`\x1B[${t+e}m`,xn=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Sn=(e=0)=>(t,u,n)=>`\x1B[${38+e};2;${t};${u};${n}m`,k={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(k.modifier);const Yi=Object.keys(k.color),Zi=Object.keys(k.bgColor);[...Yi,...Zi];function Xi(){const e=new Map;for(const[t,u]of Object.entries(k)){for(const[n,D]of Object.entries(u))k[n]={open:`\x1B[${D[0]}m`,close:`\x1B[${D[1]}m`},u[n]=k[n],e.set(D[0],D[1]);Object.defineProperty(k,t,{value:u,enumerable:!1})}return Object.defineProperty(k,"codes",{value:e,enumerable:!1}),k.color.close="\x1B[39m",k.bgColor.close="\x1B[49m",k.color.ansi=$n(),k.color.ansi256=xn(),k.color.ansi16m=Sn(),k.bgColor.ansi=$n(jt),k.bgColor.ansi256=xn(jt),k.bgColor.ansi16m=Sn(jt),Object.defineProperties(k,{rgbToAnsi256:{value:(t,u,n)=>t===u&&u===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(u/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:t=>{const u=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!u)return[0,0,0];let[n]=u;n.length===3&&(n=[...n].map(o=>o+o).join(""));const D=Number.parseInt(n,16);return[D>>16&255,D>>8&255,D&255]},enumerable:!1},hexToAnsi256:{value:t=>k.rgbToAnsi256(...k.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:t=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let u,n,D;if(t>=232)u=((t-232)*10+8)/255,n=u,D=u;else{t-=16;const i=t%36;u=Math.floor(t/36)/5,n=Math.floor(i/6)/5,D=i%6/5}const o=Math.max(u,n,D)*2;if(o===0)return 30;let r=30+(Math.round(D)<<2|Math.round(n)<<1|Math.round(u));return o===2&&(r+=60),r},enumerable:!1},rgbToAnsi:{value:(t,u,n)=>k.ansi256ToAnsi(k.rgbToAnsi256(t,u,n)),enumerable:!1},hexToAnsi:{value:t=>k.ansi256ToAnsi(k.hexToAnsi256(t)),enumerable:!1}}),k}const Qi=Xi(),Ke=new Set(["\x1B","\x9B"]),ea=39,Nt="\x07",kn="[",ta="]",Mn="m",Lt=`${ta}8;;`,In=e=>`${Ke.values().next().value}${kn}${e}${Mn}`,On=e=>`${Ke.values().next().value}${Lt}${e}${Nt}`,ua=e=>e.split(" ").map(t=>Ee(t)),Gt=(e,t,u)=>{const n=[...t];let D=!1,o=!1,r=Ee(Bn(e[e.length-1]));for(const[i,s]of n.entries()){const c=Ee(s);if(r+c<=u?e[e.length-1]+=s:(e.push(s),r=0),Ke.has(s)&&(D=!0,o=n.slice(i+1).join("").startsWith(Lt)),D){o?s===Nt&&(D=!1,o=!1):s===Mn&&(D=!1);continue}r+=c,r===u&&i<n.length-1&&(e.push(""),r=0)}!r&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},na=e=>{const t=e.split(" ");let u=t.length;for(;u>0&&!(Ee(t[u-1])>0);)u--;return u===t.length?e:t.slice(0,u).join(" ")+t.slice(u).join("")},ra=(e,t,u={})=>{if(u.trim!==!1&&e.trim()==="")return"";let n="",D,o;const r=ua(e);let i=[""];for(const[c,f]of e.split(" ").entries()){u.trim!==!1&&(i[i.length-1]=i[i.length-1].trimStart());let l=Ee(i[i.length-1]);if(c!==0&&(l>=t&&(u.wordWrap===!1||u.trim===!1)&&(i.push(""),l=0),(l>0||u.trim===!1)&&(i[i.length-1]+=" ",l++)),u.hard&&r[c]>t){const a=t-l,d=1+Math.floor((r[c]-a-1)/t);Math.floor((r[c]-1)/t)<d&&i.push(""),Gt(i,f,t);continue}if(l+r[c]>t&&l>0&&r[c]>0){if(u.wordWrap===!1&&l<t){Gt(i,f,t);continue}i.push("")}if(l+r[c]>t&&u.wordWrap===!1){Gt(i,f,t);continue}i[i.length-1]+=f}u.trim!==!1&&(i=i.map(c=>na(c)));const s=[...i.join(`
29
+ `)];for(const[c,f]of s.entries()){if(n+=f,Ke.has(f)){const{groups:a}=new RegExp(`(?:\\${kn}(?<code>\\d+)m|\\${Lt}(?<uri>.*)${Nt})`).exec(s.slice(c).join(""))||{groups:{}};if(a.code!==void 0){const d=Number.parseFloat(a.code);D=d===ea?void 0:d}else a.uri!==void 0&&(o=a.uri.length===0?void 0:a.uri)}const l=Qi.codes.get(Number(D));s[c+1]===`
30
+ `?(o&&(n+=On("")),D&&l&&(n+=In(l))):f===`
31
+ `&&(D&&l&&(n+=In(D)),o&&(n+=On(o)))}return n};function Tn(e,t,u){return String(e).normalize().replace(/\r\n/g,`
32
32
  `).split(`
33
- `).map(n=>Vi(n,t,u)).join(`
34
- `)}var Ji=Object.defineProperty,Yi=(e,t,u)=>t in e?Ji(e,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[t]=u,G=(e,t,u)=>(Yi(e,typeof t!="symbol"?t+"":t,u),u);function Zi(e,t){if(e===t)return;const u=e.split(`
33
+ `).map(n=>ra(n,t,u)).join(`
34
+ `)}var Da=Object.defineProperty,oa=(e,t,u)=>t in e?Da(e,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[t]=u,z=(e,t,u)=>(oa(e,typeof t!="symbol"?t+"":t,u),u);function sa(e,t){if(e===t)return;const u=e.split(`
35
35
  `),n=t.split(`
36
- `),r=[];for(let o=0;o<Math.max(u.length,n.length);o++)u[o]!==n[o]&&r.push(o);return r}const In=Symbol("clack:cancel");function Mn(e){return e===In}function qe(e,t){e.isTTY&&e.setRawMode(t)}const kn=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),Xi=new Set(["up","down","left","right","space","enter"]);class Tn{constructor({render:t,input:u=_D,output:n=jD,...r},o=!0){G(this,"input"),G(this,"output"),G(this,"rl"),G(this,"opts"),G(this,"_track",!1),G(this,"_render"),G(this,"_cursor",0),G(this,"state","initial"),G(this,"value"),G(this,"error",""),G(this,"subscribers",new Map),G(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=u,this.output=n}prompt(){const t=new qD(0);return t._write=(u,n,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=mu.createInterface({input:this.input,output:t,tabSize:2,prompt:"",escapeCodeTimeout:50}),mu.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),qe(this.input,!0),this.output.on("resize",this.render),this.render(),new Promise((u,n)=>{this.once("submit",()=>{this.output.write(q.cursor.show),this.output.off("resize",this.render),qe(this.input,!1),u(this.value)}),this.once("cancel",()=>{this.output.write(q.cursor.show),this.output.off("resize",this.render),qe(this.input,!1),u(In)})})}on(t,u){const n=this.subscribers.get(t)??[];n.push({cb:u}),this.subscribers.set(t,n)}once(t,u){const n=this.subscribers.get(t)??[];n.push({cb:u,once:!0}),this.subscribers.set(t,n)}emit(t,...u){const n=this.subscribers.get(t)??[],r=[];for(const o of n)o.cb(...u),o.once&&r.push(()=>n.splice(n.indexOf(o),1));for(const o of r)o()}unsubscribe(){this.subscribers.clear()}onKeypress(t,u){if(this.state==="error"&&(this.state="active"),u?.name&&!this._track&&kn.has(u.name)&&this.emit("cursor",kn.get(u.name)),u?.name&&Xi.has(u.name)&&this.emit("cursor",u.name),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),t===" "&&this.opts.placeholder&&(this.value||(this.rl.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),t&&this.emit("key",t.toLowerCase()),u?.name==="return"){if(this.opts.validate){const n=this.opts.validate(this.value);n&&(this.error=n,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(`
37
- `),qe(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const t=On(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
38
- `).length-1;this.output.write(q.cursor.move(-999,t*-1))}render(){const t=On(this._render(this)??"",process.stdout.columns,{hard:!0});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(q.cursor.hide);else{const u=Zi(this._prevFrame,t);if(this.restoreCursor(),u&&u?.length===1){const n=u[0];this.output.write(q.cursor.move(0,n)),this.output.write(q.erase.lines(1));const r=t.split(`
39
- `);this.output.write(r[n]),this._prevFrame=t,this.output.write(q.cursor.move(0,r.length-n-1));return}else if(u&&u?.length>1){const n=u[0];this.output.write(q.cursor.move(0,n)),this.output.write(q.erase.down());const r=t.split(`
40
- `).slice(n);this.output.write(r.join(`
41
- `)),this._prevFrame=t;return}this.output.write(q.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}class Qi extends Tn{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",u=>{this.output.write(q.cursor.move(0,-1)),this.value=u,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var ea=Object.defineProperty,ta=(e,t,u)=>t in e?ea(e,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[t]=u,Pn=(e,t,u)=>(ta(e,typeof t!="symbol"?t+"":t,u),u);let ua=class extends Tn{constructor(e){super(e,!1),Pn(this,"options"),Pn(this,"cursor",0),this.options=e.options,this.cursor=this.options.findIndex(({value:t})=>t===e.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",t=>{switch(t){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}};globalThis.process.platform.startsWith("win");function na(){return M.platform!=="win32"?M.env.TERM!=="linux":!!M.env.CI||!!M.env.WT_SESSION||!!M.env.TERMINUS_SUBLIME||M.env.ConEmuTask==="{cmd::Cmder}"||M.env.TERM_PROGRAM==="Terminus-Sublime"||M.env.TERM_PROGRAM==="vscode"||M.env.TERM==="xterm-256color"||M.env.TERM==="alacritty"||M.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const Da=na(),Z=(e,t)=>Da?e:t,ra=Z("\u25C6","*"),oa=Z("\u25A0","x"),sa=Z("\u25B2","x"),ia=Z("\u25C7","o"),aa=Z("\u250C","T"),z=Z("\u2502","|"),_t=Z("\u2514","\u2014"),jt=Z("\u25CF",">"),Nt=Z("\u25CB"," "),Rn=e=>{switch(e){case"initial":case"active":return b.cyan(ra);case"cancel":return b.red(oa);case"error":return b.yellow(sa);case"submit":return b.green(ia)}},ca=e=>{const t=e.active??"Yes",u=e.inactive??"No";return new Qi({active:t,inactive:u,initialValue:e.initialValue??!0,render(){const n=`${b.gray(z)}
42
- ${Rn(this.state)} ${e.message}
43
- `,r=this.value?t:u;switch(this.state){case"submit":return`${n}${b.gray(z)} ${b.dim(r)}`;case"cancel":return`${n}${b.gray(z)} ${b.strikethrough(b.dim(r))}
44
- ${b.gray(z)}`;default:return`${n}${b.cyan(z)} ${this.value?`${b.green(jt)} ${t}`:`${b.dim(Nt)} ${b.dim(t)}`} ${b.dim("/")} ${this.value?`${b.dim(Nt)} ${b.dim(u)}`:`${b.green(jt)} ${u}`}
45
- ${b.cyan(_t)}
46
- `}}}).prompt()},la=e=>{const t=(u,n)=>{const r=u.label??String(u.value);return n==="active"?`${b.green(jt)} ${r} ${u.hint?b.dim(`(${u.hint})`):""}`:n==="selected"?`${b.dim(r)}`:n==="cancelled"?`${b.strikethrough(b.dim(r))}`:`${b.dim(Nt)} ${b.dim(r)}`};return new ua({options:e.options,initialValue:e.initialValue,render(){const u=`${b.gray(z)}
47
- ${Rn(this.state)} ${e.message}
48
- `;switch(this.state){case"submit":return`${u}${b.gray(z)} ${t(this.options[this.cursor],"selected")}`;case"cancel":return`${u}${b.gray(z)} ${t(this.options[this.cursor],"cancelled")}
49
- ${b.gray(z)}`;default:return`${u}${b.cyan(z)} ${this.options.map((n,r)=>t(n,r===this.cursor?"active":"inactive")).join(`
50
- ${b.cyan(z)} `)}
51
- ${b.cyan(_t)}
52
- `}}}).prompt()},fa=(e="")=>{process.stdout.write(`${b.gray(aa)} ${e}
53
- `)},He=(e="")=>{process.stdout.write(`${b.gray(z)}
54
- ${b.gray(_t)} ${e}
55
-
56
- `)},_n=e=>mo,da=_n();class m extends Error{}const Lt=" ",Fa="https://github.com/sugarmo/aicommits/issues/new/choose",pa=e=>e.trim().replace(/^github:/,"").replace(/^git\+/,"").replace(/\.git$/,""),jn=e=>{if(typeof e=="string"){const t=pa(e);if(/^[^/\s]+\/[^/\s]+$/.test(t))return t;const u=t.match(/^git@github\.com:([^/\s]+\/[^/\s]+)$/);if(u?.[1])return u[1];const n=t.match(/^https?:\/\/github\.com\/([^/\s]+\/[^/\s]+)$/);if(n?.[1])return n[1]}if(e&&typeof e=="object"&&"url"in e)return jn(e.url)},Ca=(()=>{const e=jn(go);return e?`https://github.com/${e}/issues/new/choose`:Fa})(),Gt=e=>{e instanceof Error&&!(e instanceof m)&&(e.stack&&console.error(ge(e.stack.split(`
36
+ `),D=[];for(let o=0;o<Math.max(u.length,n.length);o++)u[o]!==n[o]&&D.push(o);return D}const Pn=Symbol("clack:cancel");function ia(e){return e===Pn}function Je(e,t){e.isTTY&&e.setRawMode(t)}const Rn=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),aa=new Set(["up","down","left","right","space","enter"]);class _n{constructor({render:t,input:u=Vr,output:n=Kr,...D},o=!0){z(this,"input"),z(this,"output"),z(this,"rl"),z(this,"opts"),z(this,"_track",!1),z(this,"_render"),z(this,"_cursor",0),z(this,"state","initial"),z(this,"value"),z(this,"error",""),z(this,"subscribers",new Map),z(this,"_prevFrame",""),this.opts=D,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=u,this.output=n}prompt(){const t=new tD(0);return t._write=(u,n,D)=>{this._track&&(this.value=this.rl.line.replace(/\t/g,""),this._cursor=this.rl.cursor,this.emit("value",this.value)),D()},this.input.pipe(t),this.rl=yu.createInterface({input:this.input,output:t,tabSize:2,prompt:"",escapeCodeTimeout:50}),yu.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),Je(this.input,!0),this.output.on("resize",this.render),this.render(),new Promise((u,n)=>{this.once("submit",()=>{this.output.write(K.cursor.show),this.output.off("resize",this.render),Je(this.input,!1),u(this.value)}),this.once("cancel",()=>{this.output.write(K.cursor.show),this.output.off("resize",this.render),Je(this.input,!1),u(Pn)})})}on(t,u){const n=this.subscribers.get(t)??[];n.push({cb:u}),this.subscribers.set(t,n)}once(t,u){const n=this.subscribers.get(t)??[];n.push({cb:u,once:!0}),this.subscribers.set(t,n)}emit(t,...u){const n=this.subscribers.get(t)??[],D=[];for(const o of n)o.cb(...u),o.once&&D.push(()=>n.splice(n.indexOf(o),1));for(const o of D)o()}unsubscribe(){this.subscribers.clear()}onKeypress(t,u){if(this.state==="error"&&(this.state="active"),u?.name&&!this._track&&Rn.has(u.name)&&this.emit("cursor",Rn.get(u.name)),u?.name&&aa.has(u.name)&&this.emit("cursor",u.name),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),t===" "&&this.opts.placeholder&&(this.value||(this.rl.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),t&&this.emit("key",t.toLowerCase()),u?.name==="return"){if(this.opts.validate){const n=this.opts.validate(this.value);n&&(this.error=n,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(`
37
+ `),Je(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const t=Tn(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
38
+ `).length-1;this.output.write(K.cursor.move(-999,t*-1))}render(){const t=Tn(this._render(this)??"",process.stdout.columns,{hard:!0});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(K.cursor.hide);else{const u=sa(this._prevFrame,t);if(this.restoreCursor(),u&&u?.length===1){const n=u[0];this.output.write(K.cursor.move(0,n)),this.output.write(K.erase.lines(1));const D=t.split(`
39
+ `);this.output.write(D[n]),this._prevFrame=t,this.output.write(K.cursor.move(0,D.length-n-1));return}else if(u&&u?.length>1){const n=u[0];this.output.write(K.cursor.move(0,n)),this.output.write(K.erase.down());const D=t.split(`
40
+ `).slice(n);this.output.write(D.join(`
41
+ `)),this._prevFrame=t;return}this.output.write(K.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}var ca=Object.defineProperty,la=(e,t,u)=>t in e?ca(e,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[t]=u,jn=(e,t,u)=>(la(e,typeof t!="symbol"?t+"":t,u),u);let fa=class extends _n{constructor(e){super(e,!1),jn(this,"options"),jn(this,"cursor",0),this.options=e.options,this.cursor=this.options.findIndex(({value:t})=>t===e.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",t=>{switch(t){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}};var da=Object.defineProperty,Fa=(e,t,u)=>t in e?da(e,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[t]=u,pa=(e,t,u)=>(Fa(e,typeof t!="symbol"?t+"":t,u),u);class Ca extends _n{constructor(t){super(t),pa(this,"valueWithCursor",""),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.valueWithCursor=this.value}),this.on("value",()=>{if(this.cursor>=this.value.length)this.valueWithCursor=`${this.value}${E.inverse(E.hidden("_"))}`;else{const u=this.value.slice(0,this.cursor),n=this.value.slice(this.cursor);this.valueWithCursor=`${u}${E.inverse(n[0])}${n.slice(1)}`}})}get cursor(){return this._cursor}}globalThis.process.platform.startsWith("win");function ma(){return T.platform!=="win32"?T.env.TERM!=="linux":!!T.env.CI||!!T.env.WT_SESSION||!!T.env.TERMINUS_SUBLIME||T.env.ConEmuTask==="{cmd::Cmder}"||T.env.TERM_PROGRAM==="Terminus-Sublime"||T.env.TERM_PROGRAM==="vscode"||T.env.TERM==="xterm-256color"||T.env.TERM==="alacritty"||T.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const ha=ma(),Z=(e,t)=>ha?e:t,ga=Z("\u25C6","*"),Ea=Z("\u25A0","x"),ya=Z("\u25B2","x"),ba=Z("\u25C7","o"),wa=Z("\u250C","T"),W=Z("\u2502","|"),Ye=Z("\u2514","\u2014"),Ba=Z("\u25CF",">"),va=Z("\u25CB"," "),Nn=e=>{switch(e){case"initial":case"active":return E.cyan(ga);case"cancel":return E.red(Ea);case"error":return E.yellow(ya);case"submit":return E.green(ba)}},Aa=e=>new Ca({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,render(){const t=`${E.gray(W)}
42
+ ${Nn(this.state)} ${e.message}
43
+ `,u=e.placeholder?E.inverse(e.placeholder[0])+E.dim(e.placeholder.slice(1)):E.inverse(E.hidden("_")),n=this.value?this.valueWithCursor:u;switch(this.state){case"error":return`${t.trim()}
44
+ ${E.yellow(W)} ${n}
45
+ ${E.yellow(Ye)} ${E.yellow(this.error)}
46
+ `;case"submit":return`${t}${E.gray(W)} ${E.dim(this.value||e.placeholder)}`;case"cancel":return`${t}${E.gray(W)} ${E.strikethrough(E.dim(this.value??""))}${this.value?.trim()?`
47
+ `+E.gray(W):""}`;default:return`${t}${E.cyan(W)} ${n}
48
+ ${E.cyan(Ye)}
49
+ `}}}).prompt(),$a=e=>{const t=(u,n)=>{const D=u.label??String(u.value);return n==="active"?`${E.green(Ba)} ${D} ${u.hint?E.dim(`(${u.hint})`):""}`:n==="selected"?`${E.dim(D)}`:n==="cancelled"?`${E.strikethrough(E.dim(D))}`:`${E.dim(va)} ${E.dim(D)}`};return new fa({options:e.options,initialValue:e.initialValue,render(){const u=`${E.gray(W)}
50
+ ${Nn(this.state)} ${e.message}
51
+ `;switch(this.state){case"submit":return`${u}${E.gray(W)} ${t(this.options[this.cursor],"selected")}`;case"cancel":return`${u}${E.gray(W)} ${t(this.options[this.cursor],"cancelled")}
52
+ ${E.gray(W)}`;default:return`${u}${E.cyan(W)} ${this.options.map((n,D)=>t(n,D===this.cursor?"active":"inactive")).join(`
53
+ ${E.cyan(W)} `)}
54
+ ${E.cyan(Ye)}
55
+ `}}}).prompt()},xa=(e="")=>{process.stdout.write(`${E.gray(wa)} ${e}
56
+ `)},Wt=(e="")=>{process.stdout.write(`${E.gray(W)}
57
+ ${E.gray(Ye)} ${e}
58
+
59
+ `)},Ln=e=>$o,Sa=Ln();class h extends Error{}const zt=" ",ka="https://github.com/sugarmo/aicommits/issues/new/choose",Ma=e=>e.trim().replace(/^github:/,"").replace(/^git\+/,"").replace(/\.git$/,""),Gn=e=>{if(typeof e=="string"){const t=Ma(e);if(/^[^/\s]+\/[^/\s]+$/.test(t))return t;const u=t.match(/^git@github\.com:([^/\s]+\/[^/\s]+)$/);if(u?.[1])return u[1];const n=t.match(/^https?:\/\/github\.com\/([^/\s]+\/[^/\s]+)$/);if(n?.[1])return n[1]}if(e&&typeof e=="object"&&"url"in e)return Gn(e.url)},Ia=(()=>{const e=Gn(So);return e?`https://github.com/${e}/issues/new/choose`:ka})(),Ut=e=>{e instanceof Error&&!(e instanceof h)&&(e.stack&&console.error(Ue(e.stack.split(`
57
60
  `).slice(1).join(`
58
61
  `))),console.error(`
59
- ${Lt}${ge(`aicommits v${da}`)}`),console.error(`
60
- ${Lt}Please open a Bug report with the information above:`),console.error(`${Lt}${Ca}`))},Nn=async(e,t)=>{const{stdout:u,failed:n}=await U("git",["rev-parse",...e],{reject:!1,cwd:t});if(n)throw new m("The current directory must be a Git repository!");return u.trim()},Ln=async()=>Nn(["--show-toplevel"]),ma=async(e,t)=>{const u=t||process.cwd(),n=await Nn(["--git-path",e],u);return N.isAbsolute(n)?n:N.resolve(u,n)},Gn=e=>`:(exclude)${e}`,ha=["package-lock.json","pnpm-lock.yaml","*.lock"].map(Gn),zn=e=>e.split(`
61
- `).filter(Boolean),Wn=e=>[...ha,...e?e.map(Gn):[]],Un=async(e,t,u)=>{const n=Wn(t),{stdout:r}=await U("git",[...e,"--name-only",...n],{cwd:u});if(!r)return;const{stdout:o}=await U("git",[...e,...n],{cwd:u});return{files:zn(r),diff:o}},ga=async(e,t)=>{const{stdout:u}=await U("git",["ls-files","--others","--exclude-standard","--",".",...Wn(e)],{cwd:t});return u?zn(u):[]},Ea=async(e,t)=>{if(e.length===0)return"";const u=[];for(const n of e){const{stdout:r}=await U("git",["diff","--no-index","--diff-algorithm=minimal","--","/dev/null",n],{reject:!1,cwd:t});r&&u.push(r)}return u.join(`
62
+ ${zt}${Ue(`aicommits v${Sa}`)}`),console.error(`
63
+ ${zt}Please open a Bug report with the information above:`),console.error(`${zt}${Ia}`))},Wn=async(e,t)=>{const{stdout:u,failed:n}=await q("git",["rev-parse",...e],{reject:!1,cwd:t});if(n)throw new h("The current directory must be a Git repository!");return u.trim()},zn=async()=>Wn(["--show-toplevel"]),Oa=async(e,t)=>{const u=t||process.cwd(),n=await Wn(["--git-path",e],u);return N.isAbsolute(n)?n:N.resolve(u,n)},Un=e=>`:(exclude)${e}`,Ta=["package-lock.json","pnpm-lock.yaml","*.lock"].map(Un),qn=e=>e.split(`
64
+ `).filter(Boolean),Hn=e=>[...Ta,...e?e.map(Un):[]],Vn=async(e,t,u)=>{const n=Hn(t),{stdout:D}=await q("git",[...e,"--name-only",...n],{cwd:u});if(!D)return;const{stdout:o}=await q("git",[...e,...n],{cwd:u});return{files:qn(D),diff:o}},Pa=async(e,t)=>{const{stdout:u}=await q("git",["ls-files","--others","--exclude-standard","--",".",...Hn(e)],{cwd:t});return u?qn(u):[]},Ra=async(e,t)=>{if(e.length===0)return"";const u=[];for(const n of e){const{stdout:D}=await q("git",["diff","--no-index","--diff-algorithm=minimal","--","/dev/null",n],{reject:!1,cwd:t});D&&u.push(D)}return u.join(`
62
65
 
63
- `)},ya=async e=>{const{stdout:t}=await U("git",["diff","--cached","--name-only"],{cwd:e});return t.trim().length>0},qn=async(e,t)=>{const n=await Un(["diff","--cached","--diff-algorithm=minimal"],e,t);if(n)return{...n,source:"staged"}},Ba=async(e,t)=>{const n=await Un(["diff","--diff-algorithm=minimal"],e,t),r=await ga(e,t);if(!n&&r.length===0)return;const o=await Ea(r,t),D=Array.from(new Set([...n?.files??[],...r])),i=[n?.diff,o].filter(Boolean).join(`
66
+ `)},_a=async e=>{const{stdout:t}=await q("git",["diff","--cached","--name-only"],{cwd:e});return t.trim().length>0},Kn=async(e,t)=>{const n=await Vn(["diff","--cached","--diff-algorithm=minimal"],e,t);if(n)return{...n,source:"staged"}},ja=async(e,t)=>{const n=await Vn(["diff","--diff-algorithm=minimal"],e,t),D=await Pa(e,t);if(!n&&D.length===0)return;const o=await Ra(D,t),r=Array.from(new Set([...n?.files??[],...D])),i=[n?.diff,o].filter(Boolean).join(`
64
67
 
65
- `);return{files:D,diff:i,source:"uncommitted"}},ba=async(e,t)=>{const u=await qn(e,t);if(u)return u;if(!await ya(t))return Ba(e,t)},wa=(e,t="staged")=>`Detected ${e.length.toLocaleString()} ${t} file${e.length>1?"s":""}`,Hn="message.md",Kn=["# Commit Message Instructions","","## Language","- Write the commit message in English.","","## Format","- Output a plain git commit title, not a conventional commit prefix.","- Return only a single title line with no body.","- Use concise imperative wording.","","## Focus","- Lead with the dominant user-facing, product-facing, or operational outcome.","- Prefer the end result over the implementation mechanism.","- Describe what the change enables, fixes, prevents, or improves.","- Mention a concrete file, module, class, or subsystem only when it helps disambiguate the change.","","## Constraints","- Keep the title around 50 characters when practical.",'- Avoid vague subjects like "update", "improve", "refactor", or "cleanup" unless the diff is genuinely dominated by maintenance work.'].join(`
66
- `),Ke=(e,t,u="")=>{const n=t?.trim()||u.trim();return n?N.isAbsolute(n)?n:N.join(e,n):""},Aa=async e=>{await $.mkdir(N.dirname(e),{recursive:!0})},va=async(e,t)=>{let u;try{u=await $.lstat(e)}catch(n){throw n.code==="ENOENT"?new m(`${t} was not created: ${e}`):n}if(!u.isFile())throw new m(`${t} must point to a file: ${e}`)},$a=async(e,t)=>{try{if(!(await $.lstat(e)).isFile())throw new m(`Message Markdown file must point to a file: ${e}`);return}catch(u){if(u.code!=="ENOENT")throw u}await Aa(e),await $.writeFile(e,`${t.trimEnd()}
67
- `,"utf8"),await va(e,"Message Markdown file")},Vn=async(e,t)=>{const u=Ke(e,t,Hn);await $a(u,Kn);const n=await $.readFile(u,"utf8");return{messageFilePath:u,messageInstructionsMarkdown:n}},zt=(e,t)=>Ke(e,t)||void 0,xa=async({configDirectoryPath:e,messagePathValue:t,postResponseScriptValue:u,suppressErrors:n=!1})=>{if(n)try{return{...await Vn(e,t),postResponseScriptPath:zt(e,u)}}catch{return{messageFilePath:Ke(e,t,Hn),messageInstructionsMarkdown:Kn,postResponseScriptPath:zt(e,u)}}return{...await Vn(e,t),postResponseScriptPath:zt(e,u)}},Wt=e=>`Flag "${e}" has been removed. Move commit message instructions into ~/.aicommits/message.md or point --message-file at another Markdown file.`,Sa={cn:"zh-CN","zh-cn":"zh-CN","zh-hans":"zh-CN",zh:"zh-CN","zh-tw":"zh-TW","zh-hant":"zh-TW"},Oa="message.md",Ut=["locale","type","details","details-style","instructions","conventional-format","conventional-types","conventional-scope","title-length-guide","detail-column-guide"],Jn={"title-length-guide":["max-length"]},Ia=new Set([...Ut,"max-length"]),W=(e,t,u)=>{if(!t)throw new m(`Invalid config property ${e}: ${u}`)},qt=e=>typeof e=="string"||typeof e=="number"||typeof e=="boolean"?e:void 0,Yn=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Zn=(e,t,u)=>{if(t==null||t==="")return u;if(typeof t=="boolean")return t;if(typeof t=="number"){if(t===1)return!0;if(t===0)return!1}if(typeof t=="string"){const n=t.trim().toLowerCase();if(["true","1","yes","on"].includes(n))return!0;if(["false","0","no","off"].includes(n))return!1}throw new m(`Invalid config property ${e}: Must be a boolean (true/false)`)},Ma=e=>{const t=e.trim().replace(/_/g,"-");return Sa[t.toLowerCase()]??t},ka=e=>e?(W("type",typeof e=="string","Must be a string"),W("type",["","conventional"].includes(e),"Invalid commit type"),e):"",Ta=e=>{if(e==null||e==="")return"paragraph";if(typeof e!="string")throw new m("Invalid config property details-style: Must be a string");const t=e.trim().toLowerCase();return W("details-style",["paragraph","list","markdown"].includes(t),"Must be one of: paragraph, list, markdown"),t},Pa=e=>{if(e==null)return"";if(typeof e!="string")throw new m("Invalid config property instructions: Must be a string");return e.trim()},Ra=e=>{if(e==null)return"";if(typeof e!="string")throw new m("Invalid config property conventional-format: Must be a string");return e.trim()},_a=e=>{if(!e)return"";if(typeof e!="string")throw new m("Invalid config property conventional-types: Must be valid JSON");let t;try{t=JSON.parse(e)}catch{throw new m("Invalid config property conventional-types: Must be valid JSON")}W("conventional-types",typeof t=="object"&&t!==null&&!Array.isArray(t),'Must be a JSON object with "type":"description" pairs');const u=Object.entries(t).map(([n,r])=>[n.trim(),String(r).trim()]).filter(([n,r])=>n.length>0&&r.length>0);return W("conventional-types",u.length>0,"Must contain at least one type"),JSON.stringify(Object.fromEntries(u))},ja=e=>{if(!e)return 50;W("title-length-guide",typeof e=="string"||typeof e=="number","Must be an integer");const t=Number(e);return W("title-length-guide",Number.isInteger(t),"Must be an integer"),W("title-length-guide",t>=20,"Must be greater than 20 characters"),t},Na=e=>{if(!e)return 72;W("detail-column-guide",typeof e=="string"||typeof e=="number","Must be an integer");const t=Number(e);return W("detail-column-guide",Number.isInteger(t),"Must be an integer"),W("detail-column-guide",t>=20,"Must be greater than 20 characters"),t},V={locale(e){if(!e)return"en";if(typeof e!="string")throw new m("Invalid config property locale: Must be a string");const t=Ma(e);return W("locale",/^[a-z]{2,3}(?:-[a-z\d]{2,8})*$/i.test(t),"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"),t},type:ka,details(e){return Zn("details",e,!1)},"details-style":Ta,instructions:Pa,"conventional-format":Ra,"conventional-types":_a,"conventional-scope"(e){return Zn("conventional-scope",e,!1)},"title-length-guide":ja,"detail-column-guide":Na},H=(e,t)=>{const u=qt(e[t]);if(u!==void 0)return u;const n=Jn[t]||[];for(const r of n){const o=qt(e[r]);if(o!==void 0)return o}},La=e=>Ut.some(t=>H(e,t)!==void 0),Ga=e=>e.trim().replace(/[^\w.-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")||"profile",za=e=>{if(e.type!=="conventional")return["## Commit Type","- Output a plain commit title, not a conventional commit prefix."].join(`
68
+ `);return{files:r,diff:i,source:"uncommitted"}},Na=async(e,t)=>{const u=await Kn(e,t);if(u)return u;if(!await _a(t))return ja(e,t)},La=(e,t="staged")=>`Detected ${e.length.toLocaleString()} ${t} file${e.length>1?"s":""}`,Jn="message.md",Yn=["# Commit Message Instructions","","## Language","- Write the commit message in English.","","## Format","- Output a plain git commit title, not a conventional commit prefix.","- Return only a single title line with no body.","- Use concise imperative wording.","","## Focus","- Lead with the dominant user-facing, product-facing, or operational outcome.","- Prefer the end result over the implementation mechanism.","- Describe what the change enables, fixes, prevents, or improves.","- Mention a concrete file, module, class, or subsystem only when it helps disambiguate the change.","","## Constraints","- Keep the title around 50 characters when practical.",'- Avoid vague subjects like "update", "improve", "refactor", or "cleanup" unless the diff is genuinely dominated by maintenance work.'].join(`
69
+ `),Ze=(e,t,u="")=>{const n=t?.trim()||u.trim();return n?N.isAbsolute(n)?n:N.join(e,n):""},Ga=async e=>{await A.mkdir(N.dirname(e),{recursive:!0})},Wa=async(e,t)=>{let u;try{u=await A.lstat(e)}catch(n){throw n.code==="ENOENT"?new h(`${t} was not created: ${e}`):n}if(!u.isFile())throw new h(`${t} must point to a file: ${e}`)},za=async(e,t)=>{try{if(!(await A.lstat(e)).isFile())throw new h(`Message Markdown file must point to a file: ${e}`);return}catch(u){if(u.code!=="ENOENT")throw u}await Ga(e),await A.writeFile(e,`${t.trimEnd()}
70
+ `,"utf8"),await Wa(e,"Message Markdown file")},Zn=async(e,t)=>{const u=Ze(e,t,Jn);await za(u,Yn);const n=await A.readFile(u,"utf8");return{messageFilePath:u,messageInstructionsMarkdown:n}},qt=(e,t)=>Ze(e,t)||void 0,Ua=async({configDirectoryPath:e,messagePathValue:t,postResponseScriptValue:u,suppressErrors:n=!1})=>{if(n)try{return{...await Zn(e,t),postResponseScriptPath:qt(e,u)}}catch{return{messageFilePath:Ze(e,t,Jn),messageInstructionsMarkdown:Yn,postResponseScriptPath:qt(e,u)}}return{...await Zn(e,t),postResponseScriptPath:qt(e,u)}},Ht=e=>`Flag "${e}" has been removed. Move commit message instructions into ~/.aicommits/message.md or point --message-file at another Markdown file.`,qa={cn:"zh-CN","zh-cn":"zh-CN","zh-hans":"zh-CN",zh:"zh-CN","zh-tw":"zh-TW","zh-hant":"zh-TW"},Ha="message.md",Vt=["locale","type","details","details-style","instructions","conventional-format","conventional-types","conventional-scope","title-length-guide","detail-column-guide"],Xn={"title-length-guide":["max-length"]},Va=new Set([...Vt,"max-length"]),U=(e,t,u)=>{if(!t)throw new h(`Invalid config property ${e}: ${u}`)},Kt=e=>typeof e=="string"||typeof e=="number"||typeof e=="boolean"?e:void 0,Qn=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),er=(e,t,u)=>{if(t==null||t==="")return u;if(typeof t=="boolean")return t;if(typeof t=="number"){if(t===1)return!0;if(t===0)return!1}if(typeof t=="string"){const n=t.trim().toLowerCase();if(["true","1","yes","on"].includes(n))return!0;if(["false","0","no","off"].includes(n))return!1}throw new h(`Invalid config property ${e}: Must be a boolean (true/false)`)},Ka=e=>{const t=e.trim().replace(/_/g,"-");return qa[t.toLowerCase()]??t},Ja=e=>e?(U("type",typeof e=="string","Must be a string"),U("type",["","conventional"].includes(e),"Invalid commit type"),e):"",Ya=e=>{if(e==null||e==="")return"paragraph";if(typeof e!="string")throw new h("Invalid config property details-style: Must be a string");const t=e.trim().toLowerCase();return U("details-style",["paragraph","list","markdown"].includes(t),"Must be one of: paragraph, list, markdown"),t},Za=e=>{if(e==null)return"";if(typeof e!="string")throw new h("Invalid config property instructions: Must be a string");return e.trim()},Xa=e=>{if(e==null)return"";if(typeof e!="string")throw new h("Invalid config property conventional-format: Must be a string");return e.trim()},Qa=e=>{if(!e)return"";if(typeof e!="string")throw new h("Invalid config property conventional-types: Must be valid JSON");let t;try{t=JSON.parse(e)}catch{throw new h("Invalid config property conventional-types: Must be valid JSON")}U("conventional-types",typeof t=="object"&&t!==null&&!Array.isArray(t),'Must be a JSON object with "type":"description" pairs');const u=Object.entries(t).map(([n,D])=>[n.trim(),String(D).trim()]).filter(([n,D])=>n.length>0&&D.length>0);return U("conventional-types",u.length>0,"Must contain at least one type"),JSON.stringify(Object.fromEntries(u))},ec=e=>{if(!e)return 50;U("title-length-guide",typeof e=="string"||typeof e=="number","Must be an integer");const t=Number(e);return U("title-length-guide",Number.isInteger(t),"Must be an integer"),U("title-length-guide",t>=20,"Must be greater than 20 characters"),t},tc=e=>{if(!e)return 72;U("detail-column-guide",typeof e=="string"||typeof e=="number","Must be an integer");const t=Number(e);return U("detail-column-guide",Number.isInteger(t),"Must be an integer"),U("detail-column-guide",t>=20,"Must be greater than 20 characters"),t},J={locale(e){if(!e)return"en";if(typeof e!="string")throw new h("Invalid config property locale: Must be a string");const t=Ka(e);return U("locale",/^[a-z]{2,3}(?:-[a-z\d]{2,8})*$/i.test(t),"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"),t},type:Ja,details(e){return er("details",e,!1)},"details-style":Ya,instructions:Za,"conventional-format":Xa,"conventional-types":Qa,"conventional-scope"(e){return er("conventional-scope",e,!1)},"title-length-guide":ec,"detail-column-guide":tc},H=(e,t)=>{const u=Kt(e[t]);if(u!==void 0)return u;const n=Xn[t]||[];for(const D of n){const o=Kt(e[D]);if(o!==void 0)return o}},uc=e=>Vt.some(t=>H(e,t)!==void 0),nc=e=>e.trim().replace(/[^\w.-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")||"profile",rc=e=>{if(e.type!=="conventional")return["## Commit Type","- Output a plain commit title, not a conventional commit prefix."].join(`
68
71
  `);const t=["## Commit Type","- Use conventional commit formatting."];return e["conventional-scope"]?t.push("- Prefer `type(scope): subject` and only omit scope when there is no clear dominant module, file, class, or subsystem."):t.push("- Prefer `type: subject` without a scope."),e["conventional-format"]&&t.push(`- Use this title format exactly: \`${e["conventional-format"]}\`.`),e["conventional-types"]&&t.push("- Use these conventional type definitions:","```json",e["conventional-types"],"```"),t.join(`
69
- `)},Wa=e=>{if(!e.details)return["## Body","- Return only the title line with no body."].join(`
72
+ `)},Dc=e=>{if(!e.details)return["## Body","- Return only the title line with no body."].join(`
70
73
  `);const t=["## Body","- Include a body only when the title alone is not sufficient."];return e["details-style"]==="list"?t.push("- When a body is needed, use concise bullet points.",`- Wrap bullet lines around column ${e["detail-column-guide"]} when practical.`):e["details-style"]==="markdown"?t.push("- When a body is needed, use concise markdown without fenced code blocks."):t.push("- When a body is needed, write concise prose paragraphs.",`- Wrap body text around column ${e["detail-column-guide"]} when practical.`),t.join(`
71
- `)},Ua=e=>["# Commit Message Instructions","","## Language",`- Write the commit message strictly in ${e.locale}.`,"",za(e),"","## Title","- Use concise imperative wording.","- Focus on the dominant user-facing, product-facing, or operational outcome first.","- Prefer the end result over the implementation mechanism.",`- Keep the title around ${e["title-length-guide"]} characters when practical.`,"",Wa(e),"","## Style","- Describe what the change enables, fixes, prevents, or improves.",'- Avoid vague subjects like "update", "improve", "refactor", or "cleanup" unless the diff is genuinely dominated by maintenance work.',...e.instructions?["","## Additional Instructions",e.instructions]:[]].join(`
72
- `),qa=async e=>{await $.mkdir(N.dirname(e),{recursive:!0})},Ha=async(e,t)=>{let u;try{u=await $.lstat(e)}catch(n){throw n.code==="ENOENT"?new m(`${t} was not created: ${e}`):n}if(!u.isFile())throw new m(`${t} must point to a file: ${e}`)},Ka=async(e,t)=>{try{if(!(await $.lstat(e)).isFile())throw new m(`Migrated message Markdown file must point to a file: ${e}`);return}catch(u){if(u.code!=="ENOENT")throw u}await qa(e),await $.writeFile(e,`${t.trimEnd()}
73
- `,"utf8"),await Ha(e,"Migrated message Markdown file")},Va=e=>({locale:V.locale(H(e,"locale")),type:V.type(H(e,"type")),details:V.details(H(e,"details")),"details-style":V["details-style"](H(e,"details-style")),instructions:V.instructions(H(e,"instructions")),"conventional-format":V["conventional-format"](H(e,"conventional-format")),"conventional-types":V["conventional-types"](H(e,"conventional-types")),"conventional-scope":V["conventional-scope"](H(e,"conventional-scope")),"title-length-guide":V["title-length-guide"](H(e,"title-length-guide")),"detail-column-guide":V["detail-column-guide"](H(e,"detail-column-guide"))}),Ja=e=>{for(const t of Ut){delete e[t];const u=Jn[t]||[];for(const n of u)delete e[n]}},Xn=async(e,t,u,n)=>{if(!La(e))return!1;const r=Va(e),o=qt(e["message-path"]),D=typeof o=="string"&&o.trim()?o.trim():u,i=Ke(t,D,u);return await Ka(i,Ua(r)),n&&(e["message-path"]=D),Ja(e),!0},Ht=async({backupConfig:e,config:t,configDirectoryPath:u,normalizeLegacyConfigKeys:n,writeConfig:r})=>{let o=!1;o=await Xn(t,u,Oa,!1)||o;const{profiles:D}=t;if(Yn(D))for(const[i,s]of Object.entries(D)){if(!Yn(s))continue;const c=`message.${Ga(i)}.md`;o=await Xn(s,u,c,!0)||o}o&&(n(t),await e?.(),await r(t))},Ya=e=>{const t=e.trim();if(Ia.has(t))return`Config property "${t}" has moved to your message Markdown file. Edit ~/.aicommits/message.md or set message-path instead.`},Za=["responses","chat"],Xa=["none","low","medium","high","xhigh"],{hasOwnProperty:Qa}=Object.prototype,Qn=(e,t)=>Qa.call(e,t),k=(e,t,u)=>{if(!t)throw new m(`Invalid config property ${e}: ${u}`)},ye=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),X=e=>typeof e=="string"||typeof e=="number"||typeof e=="boolean"?e:void 0,ec=(e,t,u)=>{if(t==null||t==="")return u;if(typeof t=="boolean")return t;if(typeof t=="number"){if(t===1)return!0;if(t===0)return!1}if(typeof t=="string"){const n=t.trim().toLowerCase();if(["true","1","yes","on"].includes(n))return!0;if(["false","0","no","off"].includes(n))return!1}throw new m(`Invalid config property ${e}: Must be a boolean (true/false)`)},tc=e=>{let t;try{t=JSON.parse(e)}catch{throw new m("Invalid config property request-options: Must be valid JSON")}return k("request-options",typeof t=="object"&&t!==null&&!Array.isArray(t),"Must be a JSON object"),JSON.stringify(t)},uc=e=>{if(typeof e=="number")return k("context-window",Number.isInteger(e),"Must be an integer or use K/M suffix"),e;const u=e.trim().match(/^([+-]?\d+)([kKmM])?$/);if(k("context-window",!!u,"Must be an integer or use K/M suffix"),!u?.[1])return Number.NaN;const n=Number(u[1]),r=u[2]?.toLowerCase();let o=1;return r==="k"?o=1024:r==="m"&&(o=1024*1024),n*o},eD=(e,t="")=>{if(e==null)return t;if(typeof e!="string")throw new m("Path values must be strings");return e.trim()||t},nc=/^[A-Za-z_]\w*$/,Dc=e=>{if(typeof e!="string")return;const t=e.trim();if(!t)return;if(t.startsWith("env:")){const n=t.slice(4).trim();return nc.test(n)?n:void 0}return t.match(/^\$\{([A-Za-z_]\w*)\}$/)?.[1]},rc=(e,t)=>{if(e!=="api-key")return t;const u=Dc(t);if(!u)return t;const n=process.env[u];if(n===void 0)throw new m(`Invalid config property api-key: Environment variable ${u} is not set`);return n},Be={"api-key"(e){if(!e)throw new m("Please set your API key via `aicommits config set api-key=<your token>`");if(typeof e!="string")throw new m("Invalid config property api-key: Must be a string");const t=e.trim();return k("api-key",t.length>0,"Cannot be empty"),t},"base-url"(e){if(e==null||e==="")throw new m("Please set your API base URL via `aicommits config set base-url=<https://...>`");if(typeof e!="string")throw new m("Invalid config property base-url: Must be a valid URL");const t=e.trim();let u;try{u=new URL(t)}catch{throw new m("Invalid config property base-url: Must be a valid URL")}k("base-url",u.protocol==="https:","Must be an HTTPS URL"),k("base-url",u.hash==="","Must not include URL fragments"),k("base-url",u.search==="","Must not include query parameters");const n=u.pathname.replace(/\/+$/,"");return`${u.origin}${n}`},profile(e){if(e==null)return"";if(typeof e!="string")throw new m("Invalid config property profile: Must be a string");return e.trim()},generate(e){if(!e)return 1;k("generate",typeof e=="string"||typeof e=="number","Must be an integer");const t=Number(e);return k("generate",Number.isInteger(t),"Must be an integer"),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==null||e==="")){if(typeof e!="string")throw new m("Invalid config property proxy: Must be a valid URL");return k("proxy",/^https?:\/\//.test(e),"Must be a valid URL"),e}},model(e){if(e==null||e==="")return"gpt-3.5-turbo";if(typeof e!="string")throw new m("Invalid config property model: Must be a string");return e},timeout(e){if(!e)return 1e4;k("timeout",typeof e=="string"||typeof e=="number","Must be an integer");const t=Number(e);return k("timeout",Number.isInteger(t),"Must be an integer"),k("timeout",t>=500,"Must be greater than 500ms"),t},"context-window"(e){if(!e)return 0;if(typeof e!="string"&&typeof e!="number")throw new m("Invalid config property context-window: Must be an integer or use K/M suffix");const t=uc(e);return k("context-window",Number.isInteger(t),"Must be an integer"),k("context-window",t===0||t>=1024,"Must be 0 (auto) or greater than or equal to 1024 tokens"),t},"show-reasoning"(e){return ec("show-reasoning",e,!1)},"reasoning-effort"(e){if(e==null||e==="")return"";if(typeof e!="string")throw new m("Invalid config property reasoning-effort: Must be one of: none, low, medium, high, xhigh");const t=e.trim().toLowerCase();return k("reasoning-effort",Xa.includes(t),"Must be one of: none, low, medium, high, xhigh"),t},"api-mode"(e){if(e==null||e==="")return"responses";if(typeof e!="string")throw new m('Invalid config property api-mode: Must be "responses" or "chat"');const t=e.trim().toLowerCase();return k("api-mode",Za.includes(t),"Must be one of: responses, chat"),t},"request-options"(e){if(e==null||e==="")return"";if(typeof e!="string")throw new m("Invalid config property request-options: Must be valid JSON");return tc(e)},"message-path"(e){try{return eD(e,"message.md")}catch{throw new m("Invalid config property message-path: Must be a string")}},"post-response-script"(e){try{return eD(e,"")}catch{throw new m("Invalid config property post-response-script: Must be a string")}}},oc={},Kt={"api-key":["openai-key","OPENAI_KEY","OPENAI_API_KEY"],"base-url":["openai-base-url","OPENAI_BASE_URL"],model:["OPENAI_MODEL"]},J=N.join(Oe.homedir(),".aicommits"),tD=N.join(J,"config.toml"),sc=[N.join(Oe.homedir(),"aicommits.toml"),N.join(Oe.homedir(),".aicommits")],ic=e=>{let t=!1,u=!1,n=!1;for(let r=0;r<e.length;r+=1){const o=e[r];if(o==="\\"&&u&&!n){n=!0;continue}if(o==='"'&&!t&&!n)u=!u;else if(o==="'"&&!u)t=!t;else if(o==="#"&&!t&&!u)return e.slice(0,r);n=!1}return e},uD=e=>{const t=e.trim();return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t},ac=e=>{const t=e.trim();if(t==="")return"";if(t.startsWith('"')&&t.endsWith('"'))try{return JSON.parse(t)}catch{return t.slice(1,-1)}return t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):/^(?:true|false)$/i.test(t)?t.toLowerCase()==="true":/^[+-]?\d+$/.test(t)||/^[+-]?\d+\.\d+$/.test(t)?Number(t):t},cc=(e,t)=>{let u=e;for(const n of t){const r=u[n];if(!ye(r)){const o=Object.create(null);u[n]=o,u=o;continue}u=r}return u},lc=e=>{const t=Object.create(null);let u=t;for(const n of e.split(/\r?\n/)){const r=ic(n).trim();if(!r)continue;if(r.startsWith("[")&&r.endsWith("]")){const s=r.slice(1,-1).trim();if(!s){u=t;continue}const c=s.split(".").map(uD).map(f=>f.trim()).filter(Boolean);if(c.length===0){u=t;continue}u=cc(t,c);continue}const o=r.indexOf("=");if(o<=0)continue;const D=uD(r.slice(0,o));if(!D)continue;const i=ac(r.slice(o+1));u[D]=i}return t},nD=e=>typeof e=="string"?JSON.stringify(e):String(e),fc=e=>{const t=[],u=[],n=(r,o)=>{const D=[],i=[];for(const[s,c]of Object.entries(o)){const f=X(c);if(f!==void 0){D.push(`${s} = ${nD(f)}`);continue}ye(c)&&i.push([s,c])}r.length>0&&D.length>0&&u.push(`[${r.join(".")}]`,...D,"");for(const[s,c]of i)n([...r,s],c)};for(const[r,o]of Object.entries(e)){const D=X(o);if(D!==void 0){t.push(`${r} = ${nD(D)}`);continue}ye(o)&&n([r],o)}for(;u[u.length-1]==="";)u.pop();return[...t,...t.length>0&&u.length>0?[""]:[],...u].join(`
74
- `)},be=async e=>{await $.mkdir(J,{recursive:!0});const t=fc(e);await $.writeFile(tD,`${t}
75
- `,"utf8")},dc=async(e,t)=>{try{if((await $.lstat(e)).isFile())return;throw new m(`Backup path must point to a file: ${e}`)}catch(u){if(u.code!=="ENOENT")throw u}await $.mkdir(N.dirname(e),{recursive:!0}),await $.writeFile(e,t,"utf8")},Vt=async(e,t)=>{!e||t===void 0||await dc(`${e}.bak`,t)},DD=async(e,t,u)=>{await Vt(t,u),await $.rm(t),await $.mkdir(J,{recursive:!0}),await Ht({config:e,configDirectoryPath:J,normalizeLegacyConfigKeys:we,writeConfig:be}),await be(e)},rD=async e=>{try{if(!(await $.lstat(e)).isFile())return;const u=await $.readFile(e,"utf8");return{config:lc(u),content:u,path:e}}catch{return}},oD=async()=>{const e=await rD(tD);if(e)return{config:e.config,sourceContent:e.content,sourcePath:e.path};for(const t of sc){const u=await rD(t);if(u)return{config:u.config,sourceContent:u.content,sourcePath:u.path}}return{config:Object.create(null)}},Fc=(e,t)=>{const u=Kt[e];if(!(!u||u.length===0))for(const n of u){const r=X(t[n]);if(r!==void 0)return r}},we=e=>{for(const[t,u]of Object.entries(Kt)){if(X(e[t])===void 0)for(const n of u){const r=X(e[n]);if(r!==void 0){e[t]=r;break}}for(const n of u)delete e[n]}},pc=(e,t,u)=>{if(!t)return;const{profiles:n}=e;if(!ye(n))return;const r=n[t];if(ye(r))return X(r[u])},sD=e=>{const t=e.trim();return Qn(Be,t)?t:oc[t]},Jt=async(e,t)=>{const{config:u,sourceContent:n,sourcePath:r}=await oD(),o=r===J;we(u),o&&r?await DD(u,r,n):await Ht({backupConfig:async()=>Vt(r,n),config:u,configDirectoryPath:J,normalizeLegacyConfigKeys:we,writeConfig:be});const D={},i=e?.profile??X(u.profile);let s="";try{s=Be.profile(i)}catch{if(!t)throw new m("Invalid config property profile: Must be a string")}for(const a of Object.keys(Be)){const d=Be[a],F=rc(a,e?.[a]??(a==="profile"?void 0:pc(u,s,a))??X(u[a])??Fc(a,u));if(t)try{D[a]=d(F)}catch{}else D[a]=d(F)}const c=D["message-path"]||"message.md",f=D["post-response-script"]||"",l=await xa({configDirectoryPath:J,messagePathValue:c,postResponseScriptValue:f,suppressErrors:t});return{...D,configDirectoryPath:J,...l}},Cc=async e=>{const{config:t,sourceContent:u,sourcePath:n}=await oD(),r=n===J;we(t),r&&n?await DD(t,n,u):await Ht({backupConfig:async()=>Vt(n,u),config:t,configDirectoryPath:J,normalizeLegacyConfigKeys:we,writeConfig:be});for(const[o,D]of e){const i=Ya(o);if(i)throw new m(i);const s=sD(o);if(!s)throw new m(`Invalid config property: ${o}`);const c=Be[s](D);t[s]=c;const f=Kt[s]||[];for(const l of f)delete t[l]}await be(t)};var Yt={},Zt={exports:{}},Ae={exports:{}},Xt,iD;function mc(){if(iD)return Xt;iD=1;var e=1e3,t=e*60,u=t*60,n=u*24,r=n*7,o=n*365.25;Xt=function(f,l){l=l||{};var a=typeof f;if(a==="string"&&f.length>0)return D(f);if(a==="number"&&isFinite(f))return l.long?s(f):i(f);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(f))};function D(f){if(f=String(f),!(f.length>100)){var l=/^(-?(?:\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(l){var a=parseFloat(l[1]),d=(l[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return a*o;case"weeks":case"week":case"w":return a*r;case"days":case"day":case"d":return a*n;case"hours":case"hour":case"hrs":case"hr":case"h":return a*u;case"minutes":case"minute":case"mins":case"min":case"m":return a*t;case"seconds":case"second":case"secs":case"sec":case"s":return a*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}function i(f){var l=Math.abs(f);return l>=n?Math.round(f/n)+"d":l>=u?Math.round(f/u)+"h":l>=t?Math.round(f/t)+"m":l>=e?Math.round(f/e)+"s":f+"ms"}function s(f){var l=Math.abs(f);return l>=n?c(f,l,n,"day"):l>=u?c(f,l,u,"hour"):l>=t?c(f,l,t,"minute"):l>=e?c(f,l,e,"second"):f+" ms"}function c(f,l,a,d){var F=l>=a*1.5;return Math.round(f/a)+" "+d+(F?"s":"")}return Xt}var Qt,aD;function cD(){if(aD)return Qt;aD=1;function e(t){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=s,n.humanize=mc(),n.destroy=f,Object.keys(t).forEach(l=>{n[l]=t[l]}),n.names=[],n.skips=[],n.formatters={};function u(l){let a=0;for(let d=0;d<l.length;d++)a=(a<<5)-a+l.charCodeAt(d),a|=0;return n.colors[Math.abs(a)%n.colors.length]}n.selectColor=u;function n(l){let a,d=null,F,p;function C(...h){if(!C.enabled)return;const y=C,A=Number(new Date),_=A-(a||A);y.diff=_,y.prev=a,y.curr=A,a=A,h[0]=n.coerce(h[0]),typeof h[0]!="string"&&h.unshift("%O");let j=0;h[0]=h[0].replace(/%([a-zA-Z%])/g,(v,B)=>{if(v==="%%")return"%";j++;const x=n.formatters[B];if(typeof x=="function"){const g=h[j];v=x.call(y,g),h.splice(j,1),j--}return v}),n.formatArgs.call(y,h),(y.log||n.log).apply(y,h)}return C.namespace=l,C.useColors=n.useColors(),C.color=n.selectColor(l),C.extend=r,C.destroy=n.destroy,Object.defineProperty(C,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(F!==n.namespaces&&(F=n.namespaces,p=n.enabled(l)),p),set:h=>{d=h}}),typeof n.init=="function"&&n.init(C),C}function r(l,a){const d=n(this.namespace+(typeof a>"u"?":":a)+l);return d.log=this.log,d}function o(l){n.save(l),n.namespaces=l,n.names=[],n.skips=[];const a=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const d of a)d[0]==="-"?n.skips.push(d.slice(1)):n.names.push(d)}function D(l,a){let d=0,F=0,p=-1,C=0;for(;d<l.length;)if(F<a.length&&(a[F]===l[d]||a[F]==="*"))a[F]==="*"?(p=F,C=d,F++):(d++,F++);else if(p!==-1)F=p+1,C++,d=C;else return!1;for(;F<a.length&&a[F]==="*";)F++;return F===a.length}function i(){const l=[...n.names,...n.skips.map(a=>"-"+a)].join(",");return n.enable(""),l}function s(l){for(const a of n.skips)if(D(l,a))return!1;for(const a of n.names)if(D(l,a))return!0;return!1}function c(l){return l instanceof Error?l.stack||l.message:l}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 n.enable(n.load()),n}return Qt=e,Qt}Ae.exports;var lD;function hc(){return lD||(lD=1,function(e,t){t.formatArgs=n,t.save=r,t.load=o,t.useColors=u,t.storage=D(),t.destroy=(()=>{let s=!1;return()=>{s||(s=!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 u(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let s;return 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&&(s=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(s[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(s){if(s[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+s[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const c="color: "+this.color;s.splice(1,0,c,"color: inherit");let f=0,l=0;s[0].replace(/%[a-zA-Z%]/g,a=>{a!=="%%"&&(f++,a==="%c"&&(l=f))}),s.splice(l,0,c)}t.log=console.debug||console.log||(()=>{});function r(s){try{s?t.storage.setItem("debug",s):t.storage.removeItem("debug")}catch{}}function o(){let s;try{s=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!s&&typeof process<"u"&&"env"in process&&(s=process.env.DEBUG),s}function D(){try{return localStorage}catch{}}e.exports=cD()(t);const{formatters:i}=e.exports;i.j=function(s){try{return JSON.stringify(s)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}}}(Ae,Ae.exports)),Ae.exports}var ve={exports:{}},eu,fD;function gc(){return fD||(fD=1,eu=(e,t=process.argv)=>{const u=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(u+e),r=t.indexOf("--");return n!==-1&&(r===-1||n<r)}),eu}var tu,dD;function Ec(){if(dD)return tu;dD=1;const e=Oe,t=Qe,u=gc(),{env:n}=process;let r;u("no-color")||u("no-colors")||u("color=false")||u("color=never")?r=0:(u("color")||u("colors")||u("color=true")||u("color=always"))&&(r=1),"FORCE_COLOR"in n&&(n.FORCE_COLOR==="true"?r=1:n.FORCE_COLOR==="false"?r=0:r=n.FORCE_COLOR.length===0?1:Math.min(parseInt(n.FORCE_COLOR,10),3));function o(s){return s===0?!1:{level:s,hasBasic:!0,has256:s>=2,has16m:s>=3}}function D(s,c){if(r===0)return 0;if(u("color=16m")||u("color=full")||u("color=truecolor"))return 3;if(u("color=256"))return 2;if(s&&!c&&r===void 0)return 0;const f=r||0;if(n.TERM==="dumb")return f;if(process.platform==="win32"){const l=e.release().split(".");return Number(l[0])>=10&&Number(l[2])>=10586?Number(l[2])>=14931?3:2:1}if("CI"in n)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(l=>l in n)||n.CI_NAME==="codeship"?1:f;if("TEAMCITY_VERSION"in n)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(n.TEAMCITY_VERSION)?1:0;if(n.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in n){const l=parseInt((n.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(n.TERM_PROGRAM){case"iTerm.app":return l>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(n.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(n.TERM)||"COLORTERM"in n?1:f}function i(s){const c=D(s,s&&s.isTTY);return o(c)}return tu={supportsColor:i,stdout:o(D(!0,t.isatty(1))),stderr:o(D(!0,t.isatty(2)))},tu}ve.exports;var FD;function yc(){return FD||(FD=1,function(e,t){const u=Qe,n=Cu;t.init=f,t.log=i,t.formatArgs=o,t.save=s,t.load=c,t.useColors=r,t.destroy=n.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 a=Ec();a&&(a.stderr||a).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(a=>/^debug_/i.test(a)).reduce((a,d)=>{const F=d.substring(6).toLowerCase().replace(/_([a-z])/g,(C,h)=>h.toUpperCase());let p=process.env[d];return/^(yes|on|true|enabled)$/i.test(p)?p=!0:/^(no|off|false|disabled)$/i.test(p)?p=!1:p==="null"?p=null:p=Number(p),a[F]=p,a},{});function r(){return"colors"in t.inspectOpts?!!t.inspectOpts.colors:u.isatty(process.stderr.fd)}function o(a){const{namespace:d,useColors:F}=this;if(F){const p=this.color,C="\x1B[3"+(p<8?p:"8;5;"+p),h=` ${C};1m${d} \x1B[0m`;a[0]=h+a[0].split(`
74
+ `)},oc=e=>["# Commit Message Instructions","","## Language",`- Write the commit message strictly in ${e.locale}.`,"",rc(e),"","## Title","- Use concise imperative wording.","- Focus on the dominant user-facing, product-facing, or operational outcome first.","- Prefer the end result over the implementation mechanism.",`- Keep the title around ${e["title-length-guide"]} characters when practical.`,"",Dc(e),"","## Style","- Describe what the change enables, fixes, prevents, or improves.",'- Avoid vague subjects like "update", "improve", "refactor", or "cleanup" unless the diff is genuinely dominated by maintenance work.',...e.instructions?["","## Additional Instructions",e.instructions]:[]].join(`
75
+ `),sc=async e=>{await A.mkdir(N.dirname(e),{recursive:!0})},ic=async(e,t)=>{let u;try{u=await A.lstat(e)}catch(n){throw n.code==="ENOENT"?new h(`${t} was not created: ${e}`):n}if(!u.isFile())throw new h(`${t} must point to a file: ${e}`)},ac=async(e,t)=>{try{if(!(await A.lstat(e)).isFile())throw new h(`Migrated message Markdown file must point to a file: ${e}`);return}catch(u){if(u.code!=="ENOENT")throw u}await sc(e),await A.writeFile(e,`${t.trimEnd()}
76
+ `,"utf8"),await ic(e,"Migrated message Markdown file")},cc=e=>({locale:J.locale(H(e,"locale")),type:J.type(H(e,"type")),details:J.details(H(e,"details")),"details-style":J["details-style"](H(e,"details-style")),instructions:J.instructions(H(e,"instructions")),"conventional-format":J["conventional-format"](H(e,"conventional-format")),"conventional-types":J["conventional-types"](H(e,"conventional-types")),"conventional-scope":J["conventional-scope"](H(e,"conventional-scope")),"title-length-guide":J["title-length-guide"](H(e,"title-length-guide")),"detail-column-guide":J["detail-column-guide"](H(e,"detail-column-guide"))}),lc=e=>{for(const t of Vt){delete e[t];const u=Xn[t]||[];for(const n of u)delete e[n]}},tr=async(e,t,u,n)=>{if(!uc(e))return!1;const D=cc(e),o=Kt(e["message-path"]),r=typeof o=="string"&&o.trim()?o.trim():u,i=Ze(t,r,u);return await ac(i,oc(D)),n&&(e["message-path"]=r),lc(e),!0},Jt=async({backupConfig:e,config:t,configDirectoryPath:u,normalizeLegacyConfigKeys:n,writeConfig:D})=>{let o=!1;o=await tr(t,u,Ha,!1)||o;const{profiles:r}=t;if(Qn(r))for(const[i,s]of Object.entries(r)){if(!Qn(s))continue;const c=`message.${nc(i)}.md`;o=await tr(s,u,c,!0)||o}o&&(n(t),await e?.(),await D(t))},fc=e=>{const t=e.trim();if(Va.has(t))return`Config property "${t}" has moved to your message Markdown file. Edit ~/.aicommits/message.md or set message-path instead.`},dc=["responses","chat"],Fc=["none","low","medium","high","xhigh"],{hasOwnProperty:pc}=Object.prototype,ur=(e,t)=>pc.call(e,t),R=(e,t,u)=>{if(!t)throw new h(`Invalid config property ${e}: ${u}`)},ye=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),te=e=>typeof e=="string"||typeof e=="number"||typeof e=="boolean"?e:void 0,Cc=(e,t,u)=>{if(t==null||t==="")return u;if(typeof t=="boolean")return t;if(typeof t=="number"){if(t===1)return!0;if(t===0)return!1}if(typeof t=="string"){const n=t.trim().toLowerCase();if(["true","1","yes","on"].includes(n))return!0;if(["false","0","no","off"].includes(n))return!1}throw new h(`Invalid config property ${e}: Must be a boolean (true/false)`)},mc=e=>{let t;try{t=JSON.parse(e)}catch{throw new h("Invalid config property request-options: Must be valid JSON")}return R("request-options",typeof t=="object"&&t!==null&&!Array.isArray(t),"Must be a JSON object"),JSON.stringify(t)},hc=e=>{if(typeof e=="number")return R("context-window",Number.isInteger(e),"Must be an integer or use K/M suffix"),e;const u=e.trim().match(/^([+-]?\d+)([kKmM])?$/);if(R("context-window",!!u,"Must be an integer or use K/M suffix"),!u?.[1])return Number.NaN;const n=Number(u[1]),D=u[2]?.toLowerCase();let o=1;return D==="k"?o=1024:D==="m"&&(o=1024*1024),n*o},nr=(e,t="")=>{if(e==null)return t;if(typeof e!="string")throw new h("Path values must be strings");return e.trim()||t},gc=/^[A-Za-z_]\w*$/,Ec=e=>{if(typeof e!="string")return;const t=e.trim();if(!t)return;if(t.startsWith("env:")){const n=t.slice(4).trim();return gc.test(n)?n:void 0}return t.match(/^\$\{([A-Za-z_]\w*)\}$/)?.[1]},yc=(e,t)=>{if(e!=="api-key")return t;const u=Ec(t);if(!u)return t;const n=process.env[u];if(n===void 0)throw new h(`Invalid config property api-key: Environment variable ${u} is not set`);return n},be={"api-key"(e){if(!e)throw new h("Please set your API key via `aicommits config set api-key=<your token>`");if(typeof e!="string")throw new h("Invalid config property api-key: Must be a string");const t=e.trim();return R("api-key",t.length>0,"Cannot be empty"),t},"base-url"(e){if(e==null||e==="")throw new h("Please set your API base URL via `aicommits config set base-url=<https://...>`");if(typeof e!="string")throw new h("Invalid config property base-url: Must be a valid URL");const t=e.trim();let u;try{u=new URL(t)}catch{throw new h("Invalid config property base-url: Must be a valid URL")}R("base-url",u.protocol==="https:","Must be an HTTPS URL"),R("base-url",u.hash==="","Must not include URL fragments"),R("base-url",u.search==="","Must not include query parameters");const n=u.pathname.replace(/\/+$/,"");return`${u.origin}${n}`},profile(e){if(e==null)return"";if(typeof e!="string")throw new h("Invalid config property profile: Must be a string");return e.trim()},generate(e){if(!e)return 1;R("generate",typeof e=="string"||typeof e=="number","Must be an integer");const t=Number(e);return R("generate",Number.isInteger(t),"Must be an integer"),R("generate",t>0,"Must be greater than 0"),R("generate",t<=5,"Must be less or equal to 5"),t},proxy(e){if(!(e==null||e==="")){if(typeof e!="string")throw new h("Invalid config property proxy: Must be a valid URL");return R("proxy",/^https?:\/\//.test(e),"Must be a valid URL"),e}},model(e){if(e==null||e==="")return"gpt-3.5-turbo";if(typeof e!="string")throw new h("Invalid config property model: Must be a string");return e},timeout(e){if(!e)return 1e4;R("timeout",typeof e=="string"||typeof e=="number","Must be an integer");const t=Number(e);return R("timeout",Number.isInteger(t),"Must be an integer"),R("timeout",t>=500,"Must be greater than 500ms"),t},"context-window"(e){if(!e)return 0;if(typeof e!="string"&&typeof e!="number")throw new h("Invalid config property context-window: Must be an integer or use K/M suffix");const t=hc(e);return R("context-window",Number.isInteger(t),"Must be an integer"),R("context-window",t===0||t>=1024,"Must be 0 (auto) or greater than or equal to 1024 tokens"),t},"show-reasoning"(e){return Cc("show-reasoning",e,!1)},"reasoning-effort"(e){if(e==null||e==="")return"";if(typeof e!="string")throw new h("Invalid config property reasoning-effort: Must be one of: none, low, medium, high, xhigh");const t=e.trim().toLowerCase();return R("reasoning-effort",Fc.includes(t),"Must be one of: none, low, medium, high, xhigh"),t},"api-mode"(e){if(e==null||e==="")return"responses";if(typeof e!="string")throw new h('Invalid config property api-mode: Must be "responses" or "chat"');const t=e.trim().toLowerCase();return R("api-mode",dc.includes(t),"Must be one of: responses, chat"),t},"request-options"(e){if(e==null||e==="")return"";if(typeof e!="string")throw new h("Invalid config property request-options: Must be valid JSON");return mc(e)},"message-path"(e){try{return nr(e,"message.md")}catch{throw new h("Invalid config property message-path: Must be a string")}},"post-response-script"(e){try{return nr(e,"")}catch{throw new h("Invalid config property post-response-script: Must be a string")}}},bc={},Yt={"api-key":["openai-key","OPENAI_KEY","OPENAI_API_KEY"],"base-url":["openai-base-url","OPENAI_BASE_URL"],model:["OPENAI_MODEL"]},Y=N.join(Oe.homedir(),".aicommits"),rr=N.join(Y,"config.toml"),wc=[N.join(Oe.homedir(),"aicommits.toml"),N.join(Oe.homedir(),".aicommits")],Bc=e=>{let t=!1,u=!1,n=!1;for(let D=0;D<e.length;D+=1){const o=e[D];if(o==="\\"&&u&&!n){n=!0;continue}if(o==='"'&&!t&&!n)u=!u;else if(o==="'"&&!u)t=!t;else if(o==="#"&&!t&&!u)return e.slice(0,D);n=!1}return e},Dr=e=>{const t=e.trim();return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t},vc=e=>{const t=e.trim();if(t==="")return"";if(t.startsWith('"')&&t.endsWith('"'))try{return JSON.parse(t)}catch{return t.slice(1,-1)}return t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):/^(?:true|false)$/i.test(t)?t.toLowerCase()==="true":/^[+-]?\d+$/.test(t)||/^[+-]?\d+\.\d+$/.test(t)?Number(t):t},Ac=(e,t)=>{let u=e;for(const n of t){const D=u[n];if(!ye(D)){const o=Object.create(null);u[n]=o,u=o;continue}u=D}return u},$c=e=>{const t=Object.create(null);let u=t;for(const n of e.split(/\r?\n/)){const D=Bc(n).trim();if(!D)continue;if(D.startsWith("[")&&D.endsWith("]")){const s=D.slice(1,-1).trim();if(!s){u=t;continue}const c=s.split(".").map(Dr).map(f=>f.trim()).filter(Boolean);if(c.length===0){u=t;continue}u=Ac(t,c);continue}const o=D.indexOf("=");if(o<=0)continue;const r=Dr(D.slice(0,o));if(!r)continue;const i=vc(D.slice(o+1));u[r]=i}return t},or=e=>typeof e=="string"?JSON.stringify(e):String(e),xc=e=>{const t=[],u=[],n=(D,o)=>{const r=[],i=[];for(const[s,c]of Object.entries(o)){const f=te(c);if(f!==void 0){r.push(`${s} = ${or(f)}`);continue}ye(c)&&i.push([s,c])}D.length>0&&r.length>0&&u.push(`[${D.join(".")}]`,...r,"");for(const[s,c]of i)n([...D,s],c)};for(const[D,o]of Object.entries(e)){const r=te(o);if(r!==void 0){t.push(`${D} = ${or(r)}`);continue}ye(o)&&n([D],o)}for(;u[u.length-1]==="";)u.pop();return[...t,...t.length>0&&u.length>0?[""]:[],...u].join(`
77
+ `)},we=async e=>{await A.mkdir(Y,{recursive:!0});const t=xc(e);await A.writeFile(rr,`${t}
78
+ `,"utf8")},Sc=async(e,t)=>{try{if((await A.lstat(e)).isFile())return;throw new h(`Backup path must point to a file: ${e}`)}catch(u){if(u.code!=="ENOENT")throw u}await A.mkdir(N.dirname(e),{recursive:!0}),await A.writeFile(e,t,"utf8")},Zt=async(e,t)=>{!e||t===void 0||await Sc(`${e}.bak`,t)},sr=async(e,t,u)=>{await Zt(t,u),await A.rm(t),await A.mkdir(Y,{recursive:!0}),await Jt({config:e,configDirectoryPath:Y,normalizeLegacyConfigKeys:Be,writeConfig:we}),await we(e)},ir=async e=>{try{if(!(await A.lstat(e)).isFile())return;const u=await A.readFile(e,"utf8");return{config:$c(u),content:u,path:e}}catch{return}},ar=async()=>{const e=await ir(rr);if(e)return{config:e.config,sourceContent:e.content,sourcePath:e.path};for(const t of wc){const u=await ir(t);if(u)return{config:u.config,sourceContent:u.content,sourcePath:u.path}}return{config:Object.create(null)}},kc=(e,t)=>{const u=Yt[e];if(!(!u||u.length===0))for(const n of u){const D=te(t[n]);if(D!==void 0)return D}},Be=e=>{for(const[t,u]of Object.entries(Yt)){if(te(e[t])===void 0)for(const n of u){const D=te(e[n]);if(D!==void 0){e[t]=D;break}}for(const n of u)delete e[n]}},Mc=(e,t,u)=>{if(!t)return;const{profiles:n}=e;if(!ye(n))return;const D=n[t];if(ye(D))return te(D[u])},cr=e=>{const t=e.trim();return ur(be,t)?t:bc[t]},Xt=async(e,t)=>{const{config:u,sourceContent:n,sourcePath:D}=await ar(),o=D===Y;Be(u),o&&D?await sr(u,D,n):await Jt({backupConfig:async()=>Zt(D,n),config:u,configDirectoryPath:Y,normalizeLegacyConfigKeys:Be,writeConfig:we});const r={},i=e?.profile??te(u.profile);let s="";try{s=be.profile(i)}catch{if(!t)throw new h("Invalid config property profile: Must be a string")}for(const a of Object.keys(be)){const d=be[a],F=yc(a,e?.[a]??(a==="profile"?void 0:Mc(u,s,a))??te(u[a])??kc(a,u));if(t)try{r[a]=d(F)}catch{}else r[a]=d(F)}const c=r["message-path"]||"message.md",f=r["post-response-script"]||"",l=await Ua({configDirectoryPath:Y,messagePathValue:c,postResponseScriptValue:f,suppressErrors:t});return{...r,configDirectoryPath:Y,...l}},Ic=async e=>{const{config:t,sourceContent:u,sourcePath:n}=await ar(),D=n===Y;Be(t),D&&n?await sr(t,n,u):await Jt({backupConfig:async()=>Zt(n,u),config:t,configDirectoryPath:Y,normalizeLegacyConfigKeys:Be,writeConfig:we});for(const[o,r]of e){const i=fc(o);if(i)throw new h(i);const s=cr(o);if(!s)throw new h(`Invalid config property: ${o}`);const c=be[s](r);t[s]=c;const f=Yt[s]||[];for(const l of f)delete t[l]}await we(t)};var Qt={},eu={exports:{}},ve={exports:{}},tu,lr;function Oc(){if(lr)return tu;lr=1;var e=1e3,t=e*60,u=t*60,n=u*24,D=n*7,o=n*365.25;tu=function(f,l){l=l||{};var a=typeof f;if(a==="string"&&f.length>0)return r(f);if(a==="number"&&isFinite(f))return l.long?s(f):i(f);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(f))};function r(f){if(f=String(f),!(f.length>100)){var l=/^(-?(?:\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(l){var a=parseFloat(l[1]),d=(l[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return a*o;case"weeks":case"week":case"w":return a*D;case"days":case"day":case"d":return a*n;case"hours":case"hour":case"hrs":case"hr":case"h":return a*u;case"minutes":case"minute":case"mins":case"min":case"m":return a*t;case"seconds":case"second":case"secs":case"sec":case"s":return a*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}function i(f){var l=Math.abs(f);return l>=n?Math.round(f/n)+"d":l>=u?Math.round(f/u)+"h":l>=t?Math.round(f/t)+"m":l>=e?Math.round(f/e)+"s":f+"ms"}function s(f){var l=Math.abs(f);return l>=n?c(f,l,n,"day"):l>=u?c(f,l,u,"hour"):l>=t?c(f,l,t,"minute"):l>=e?c(f,l,e,"second"):f+" ms"}function c(f,l,a,d){var F=l>=a*1.5;return Math.round(f/a)+" "+d+(F?"s":"")}return tu}var uu,fr;function dr(){if(fr)return uu;fr=1;function e(t){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=s,n.humanize=Oc(),n.destroy=f,Object.keys(t).forEach(l=>{n[l]=t[l]}),n.names=[],n.skips=[],n.formatters={};function u(l){let a=0;for(let d=0;d<l.length;d++)a=(a<<5)-a+l.charCodeAt(d),a|=0;return n.colors[Math.abs(a)%n.colors.length]}n.selectColor=u;function n(l){let a,d=null,F,m;function p(...C){if(!p.enabled)return;const y=p,v=Number(new Date),I=v-(a||v);y.diff=I,y.prev=a,y.curr=v,a=v,C[0]=n.coerce(C[0]),typeof C[0]!="string"&&C.unshift("%O");let $=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,(b,w)=>{if(b==="%%")return"%";$++;const O=n.formatters[w];if(typeof O=="function"){const B=C[$];b=O.call(y,B),C.splice($,1),$--}return b}),n.formatArgs.call(y,C),(y.log||n.log).apply(y,C)}return p.namespace=l,p.useColors=n.useColors(),p.color=n.selectColor(l),p.extend=D,p.destroy=n.destroy,Object.defineProperty(p,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(F!==n.namespaces&&(F=n.namespaces,m=n.enabled(l)),m),set:C=>{d=C}}),typeof n.init=="function"&&n.init(p),p}function D(l,a){const d=n(this.namespace+(typeof a>"u"?":":a)+l);return d.log=this.log,d}function o(l){n.save(l),n.namespaces=l,n.names=[],n.skips=[];const a=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const d of a)d[0]==="-"?n.skips.push(d.slice(1)):n.names.push(d)}function r(l,a){let d=0,F=0,m=-1,p=0;for(;d<l.length;)if(F<a.length&&(a[F]===l[d]||a[F]==="*"))a[F]==="*"?(m=F,p=d,F++):(d++,F++);else if(m!==-1)F=m+1,p++,d=p;else return!1;for(;F<a.length&&a[F]==="*";)F++;return F===a.length}function i(){const l=[...n.names,...n.skips.map(a=>"-"+a)].join(",");return n.enable(""),l}function s(l){for(const a of n.skips)if(r(l,a))return!1;for(const a of n.names)if(r(l,a))return!0;return!1}function c(l){return l instanceof Error?l.stack||l.message:l}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 n.enable(n.load()),n}return uu=e,uu}ve.exports;var Fr;function Tc(){return Fr||(Fr=1,function(e,t){t.formatArgs=n,t.save=D,t.load=o,t.useColors=u,t.storage=r(),t.destroy=(()=>{let s=!1;return()=>{s||(s=!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 u(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let s;return 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&&(s=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(s[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(s){if(s[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+s[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const c="color: "+this.color;s.splice(1,0,c,"color: inherit");let f=0,l=0;s[0].replace(/%[a-zA-Z%]/g,a=>{a!=="%%"&&(f++,a==="%c"&&(l=f))}),s.splice(l,0,c)}t.log=console.debug||console.log||(()=>{});function D(s){try{s?t.storage.setItem("debug",s):t.storage.removeItem("debug")}catch{}}function o(){let s;try{s=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!s&&typeof process<"u"&&"env"in process&&(s=process.env.DEBUG),s}function r(){try{return localStorage}catch{}}e.exports=dr()(t);const{formatters:i}=e.exports;i.j=function(s){try{return JSON.stringify(s)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}}}(ve,ve.exports)),ve.exports}var Ae={exports:{}},nu,pr;function Pc(){return pr||(pr=1,nu=(e,t=process.argv)=>{const u=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(u+e),D=t.indexOf("--");return n!==-1&&(D===-1||n<D)}),nu}var ru,Cr;function Rc(){if(Cr)return ru;Cr=1;const e=Oe,t=rt,u=Pc(),{env:n}=process;let D;u("no-color")||u("no-colors")||u("color=false")||u("color=never")?D=0:(u("color")||u("colors")||u("color=true")||u("color=always"))&&(D=1),"FORCE_COLOR"in n&&(n.FORCE_COLOR==="true"?D=1:n.FORCE_COLOR==="false"?D=0:D=n.FORCE_COLOR.length===0?1:Math.min(parseInt(n.FORCE_COLOR,10),3));function o(s){return s===0?!1:{level:s,hasBasic:!0,has256:s>=2,has16m:s>=3}}function r(s,c){if(D===0)return 0;if(u("color=16m")||u("color=full")||u("color=truecolor"))return 3;if(u("color=256"))return 2;if(s&&!c&&D===void 0)return 0;const f=D||0;if(n.TERM==="dumb")return f;if(process.platform==="win32"){const l=e.release().split(".");return Number(l[0])>=10&&Number(l[2])>=10586?Number(l[2])>=14931?3:2:1}if("CI"in n)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(l=>l in n)||n.CI_NAME==="codeship"?1:f;if("TEAMCITY_VERSION"in n)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(n.TEAMCITY_VERSION)?1:0;if(n.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in n){const l=parseInt((n.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(n.TERM_PROGRAM){case"iTerm.app":return l>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(n.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(n.TERM)||"COLORTERM"in n?1:f}function i(s){const c=r(s,s&&s.isTTY);return o(c)}return ru={supportsColor:i,stdout:o(r(!0,t.isatty(1))),stderr:o(r(!0,t.isatty(2)))},ru}Ae.exports;var mr;function _c(){return mr||(mr=1,function(e,t){const u=rt,n=Eu;t.init=f,t.log=i,t.formatArgs=o,t.save=s,t.load=c,t.useColors=D,t.destroy=n.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 a=Rc();a&&(a.stderr||a).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(a=>/^debug_/i.test(a)).reduce((a,d)=>{const F=d.substring(6).toLowerCase().replace(/_([a-z])/g,(p,C)=>C.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),a[F]=m,a},{});function D(){return"colors"in t.inspectOpts?!!t.inspectOpts.colors:u.isatty(process.stderr.fd)}function o(a){const{namespace:d,useColors:F}=this;if(F){const m=this.color,p="\x1B[3"+(m<8?m:"8;5;"+m),C=` ${p};1m${d} \x1B[0m`;a[0]=C+a[0].split(`
76
79
  `).join(`
77
- `+h),a.push(C+"m+"+e.exports.humanize(this.diff)+"\x1B[0m")}else a[0]=D()+d+" "+a[0]}function D(){return t.inspectOpts.hideDate?"":new Date().toISOString()+" "}function i(...a){return process.stderr.write(n.formatWithOptions(t.inspectOpts,...a)+`
78
- `)}function s(a){a?process.env.DEBUG=a:delete process.env.DEBUG}function c(){return process.env.DEBUG}function f(a){a.inspectOpts={};const d=Object.keys(t.inspectOpts);for(let F=0;F<d.length;F++)a.inspectOpts[d[F]]=t.inspectOpts[d[F]]}e.exports=cD()(t);const{formatters:l}=e.exports;l.o=function(a){return this.inspectOpts.colors=this.useColors,n.inspect(a,this.inspectOpts).split(`
79
- `).map(d=>d.trim()).join(" ")},l.O=function(a){return this.inspectOpts.colors=this.useColors,n.inspect(a,this.inspectOpts)}}(ve,ve.exports)),ve.exports}typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Zt.exports=hc():Zt.exports=yc();var uu=Zt.exports,nu={};Object.defineProperty(nu,"__esModule",{value:!0});function Bc(e){return function(t,u){return new Promise((n,r)=>{e.call(this,t,u,(o,D)=>{o?r(o):n(D)})})}}nu.default=Bc;var pD=T&&T.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const bc=pu,wc=pD(uu),Ac=pD(nu),$e=wc.default("agent-base");function vc(e){return!!e&&typeof e.addRequest=="function"}function Du(){const{stack:e}=new Error;return typeof e!="string"?!1:e.split(`
80
- `).some(t=>t.indexOf("(https.js:")!==-1||t.indexOf("node:https:")!==-1)}function Ve(e,t){return new Ve.Agent(e,t)}(function(e){class t extends bc.EventEmitter{constructor(n,r){super();let o=r;typeof n=="function"?this.callback=n:n&&(o=n),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:Du()?443:80}set defaultPort(n){this.explicitDefaultPort=n}get protocol(){return typeof this.explicitProtocol=="string"?this.explicitProtocol:Du()?"https:":"http:"}set protocol(n){this.explicitProtocol=n}callback(n,r,o){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(n,r){const o=Object.assign({},r);typeof o.secureEndpoint!="boolean"&&(o.secureEndpoint=Du()),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,n._last=!0,n.shouldKeepAlive=!1;let D=!1,i=null;const s=o.timeout||this.timeout,c=d=>{n._hadError||(n.emit("error",d),n._hadError=!0)},f=()=>{i=null,D=!0;const d=new Error(`A "socket" was not created for HTTP request before ${s}ms`);d.code="ETIMEOUT",c(d)},l=d=>{D||(i!==null&&(clearTimeout(i),i=null),c(d))},a=d=>{if(D)return;if(i!=null&&(clearTimeout(i),i=null),vc(d)){$e("Callback returned another Agent instance %o",d.constructor.name),d.addRequest(n,o);return}if(d){d.once("free",()=>{this.freeSocket(d,o)}),n.onSocket(d);return}const F=new Error(`no Duplex stream was returned to agent-base for \`${n.method} ${n.path}\``);c(F)};if(typeof this.callback!="function"){c(new Error("`callback` is not defined"));return}this.promisifiedCallback||(this.callback.length>=3?($e("Converting legacy callback function to promise"),this.promisifiedCallback=Ac.default(this.callback)):this.promisifiedCallback=this.callback),typeof s=="number"&&s>0&&(i=setTimeout(f,s)),"port"in o&&typeof o.port!="number"&&(o.port=Number(o.port));try{$e("Resolving socket for %o request: %o",o.protocol,`${n.method} ${n.path}`),Promise.resolve(this.promisifiedCallback(n,o)).then(a,l)}catch(d){Promise.reject(d).catch(l)}}freeSocket(n,r){$e("Freeing socket %o %o",n.constructor.name,r),n.destroy()}destroy(){$e("Destroying agent %o",this.constructor.name)}}e.Agent=t,e.prototype=e.Agent.prototype})(Ve||(Ve={}));var $c=Ve,ru={},xc=T&&T.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ru,"__esModule",{value:!0});const Sc=xc(uu),xe=Sc.default("https-proxy-agent:parse-proxy-response");function Oc(e){return new Promise((t,u)=>{let n=0;const r=[];function o(){const l=e.read();l?f(l):e.once("readable",o)}function D(){e.removeListener("end",s),e.removeListener("error",c),e.removeListener("close",i),e.removeListener("readable",o)}function i(l){xe("onclose had error %o",l)}function s(){xe("onend")}function c(l){D(),xe("onerror %o",l),u(l)}function f(l){r.push(l),n+=l.length;const a=Buffer.concat(r,n);if(a.indexOf(`\r
80
+ `+C),a.push(p+"m+"+e.exports.humanize(this.diff)+"\x1B[0m")}else a[0]=r()+d+" "+a[0]}function r(){return t.inspectOpts.hideDate?"":new Date().toISOString()+" "}function i(...a){return process.stderr.write(n.formatWithOptions(t.inspectOpts,...a)+`
81
+ `)}function s(a){a?process.env.DEBUG=a:delete process.env.DEBUG}function c(){return process.env.DEBUG}function f(a){a.inspectOpts={};const d=Object.keys(t.inspectOpts);for(let F=0;F<d.length;F++)a.inspectOpts[d[F]]=t.inspectOpts[d[F]]}e.exports=dr()(t);const{formatters:l}=e.exports;l.o=function(a){return this.inspectOpts.colors=this.useColors,n.inspect(a,this.inspectOpts).split(`
82
+ `).map(d=>d.trim()).join(" ")},l.O=function(a){return this.inspectOpts.colors=this.useColors,n.inspect(a,this.inspectOpts)}}(Ae,Ae.exports)),Ae.exports}typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?eu.exports=Tc():eu.exports=_c();var Du=eu.exports,ou={};Object.defineProperty(ou,"__esModule",{value:!0});function jc(e){return function(t,u){return new Promise((n,D)=>{e.call(this,t,u,(o,r)=>{o?D(o):n(r)})})}}ou.default=jc;var hr=_&&_.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const Nc=gu,Lc=hr(Du),Gc=hr(ou),$e=Lc.default("agent-base");function Wc(e){return!!e&&typeof e.addRequest=="function"}function su(){const{stack:e}=new Error;return typeof e!="string"?!1:e.split(`
83
+ `).some(t=>t.indexOf("(https.js:")!==-1||t.indexOf("node:https:")!==-1)}function Xe(e,t){return new Xe.Agent(e,t)}(function(e){class t extends Nc.EventEmitter{constructor(n,D){super();let o=D;typeof n=="function"?this.callback=n:n&&(o=n),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:su()?443:80}set defaultPort(n){this.explicitDefaultPort=n}get protocol(){return typeof this.explicitProtocol=="string"?this.explicitProtocol:su()?"https:":"http:"}set protocol(n){this.explicitProtocol=n}callback(n,D,o){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(n,D){const o=Object.assign({},D);typeof o.secureEndpoint!="boolean"&&(o.secureEndpoint=su()),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,n._last=!0,n.shouldKeepAlive=!1;let r=!1,i=null;const s=o.timeout||this.timeout,c=d=>{n._hadError||(n.emit("error",d),n._hadError=!0)},f=()=>{i=null,r=!0;const d=new Error(`A "socket" was not created for HTTP request before ${s}ms`);d.code="ETIMEOUT",c(d)},l=d=>{r||(i!==null&&(clearTimeout(i),i=null),c(d))},a=d=>{if(r)return;if(i!=null&&(clearTimeout(i),i=null),Wc(d)){$e("Callback returned another Agent instance %o",d.constructor.name),d.addRequest(n,o);return}if(d){d.once("free",()=>{this.freeSocket(d,o)}),n.onSocket(d);return}const F=new Error(`no Duplex stream was returned to agent-base for \`${n.method} ${n.path}\``);c(F)};if(typeof this.callback!="function"){c(new Error("`callback` is not defined"));return}this.promisifiedCallback||(this.callback.length>=3?($e("Converting legacy callback function to promise"),this.promisifiedCallback=Gc.default(this.callback)):this.promisifiedCallback=this.callback),typeof s=="number"&&s>0&&(i=setTimeout(f,s)),"port"in o&&typeof o.port!="number"&&(o.port=Number(o.port));try{$e("Resolving socket for %o request: %o",o.protocol,`${n.method} ${n.path}`),Promise.resolve(this.promisifiedCallback(n,o)).then(a,l)}catch(d){Promise.reject(d).catch(l)}}freeSocket(n,D){$e("Freeing socket %o %o",n.constructor.name,D),n.destroy()}destroy(){$e("Destroying agent %o",this.constructor.name)}}e.Agent=t,e.prototype=e.Agent.prototype})(Xe||(Xe={}));var zc=Xe,iu={},Uc=_&&_.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(iu,"__esModule",{value:!0});const qc=Uc(Du),xe=qc.default("https-proxy-agent:parse-proxy-response");function Hc(e){return new Promise((t,u)=>{let n=0;const D=[];function o(){const l=e.read();l?f(l):e.once("readable",o)}function r(){e.removeListener("end",s),e.removeListener("error",c),e.removeListener("close",i),e.removeListener("readable",o)}function i(l){xe("onclose had error %o",l)}function s(){xe("onend")}function c(l){r(),xe("onerror %o",l),u(l)}function f(l){D.push(l),n+=l.length;const a=Buffer.concat(D,n);if(a.indexOf(`\r
81
84
  \r
82
85
  `)===-1){xe("have not received end of HTTP headers yet..."),o();return}const F=a.toString("ascii",0,a.indexOf(`\r
83
- `)),p=+F.split(" ")[1];xe("got proxy server response: %o",F),t({statusCode:p,buffered:a})}e.on("error",c),e.on("close",i),e.on("end",s),o()})}ru.default=Oc;var Ic=T&&T.__awaiter||function(e,t,u,n){function r(o){return o instanceof u?o:new u(function(D){D(o)})}return new(u||(u=Promise))(function(o,D){function i(f){try{c(n.next(f))}catch(l){D(l)}}function s(f){try{c(n.throw(f))}catch(l){D(l)}}function c(f){f.done?o(f.value):r(f.value).then(i,s)}c((n=n.apply(e,t||[])).next())})},ce=T&&T.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Yt,"__esModule",{value:!0});const CD=ce(KD),mD=ce(VD),Mc=ce(JD),kc=ce(Fu),Tc=ce(uu),Pc=$c,Rc=ce(ru),Se=Tc.default("https-proxy-agent:agent");class _c extends Pc.Agent{constructor(t){let u;if(typeof t=="string"?u=Mc.default.parse(t):u=t,!u)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");Se("creating new HttpsProxyAgent instance: %o",u),super(u);const n=Object.assign({},u);this.secureProxy=u.secureProxy||Lc(n.protocol),n.host=n.hostname||n.host,typeof n.port=="string"&&(n.port=parseInt(n.port,10)),!n.port&&n.host&&(n.port=this.secureProxy?443:80),this.secureProxy&&!("ALPNProtocols"in n)&&(n.ALPNProtocols=["http 1.1"]),n.host&&n.path&&(delete n.path,delete n.pathname),this.proxy=n}callback(t,u){return Ic(this,void 0,void 0,function*(){const{proxy:n,secureProxy:r}=this;let o;r?(Se("Creating `tls.Socket`: %o",n),o=mD.default.connect(n)):(Se("Creating `net.Socket`: %o",n),o=CD.default.connect(n));const D=Object.assign({},n.headers);let s=`CONNECT ${`${u.host}:${u.port}`} HTTP/1.1\r
84
- `;n.auth&&(D["Proxy-Authorization"]=`Basic ${Buffer.from(n.auth).toString("base64")}`);let{host:c,port:f,secureEndpoint:l}=u;Nc(f,l)||(c+=`:${f}`),D.Host=c,D.Connection="close";for(const C of Object.keys(D))s+=`${C}: ${D[C]}\r
85
- `;const a=Rc.default(o);o.write(`${s}\r
86
- `);const{statusCode:d,buffered:F}=yield a;if(d===200){if(t.once("socket",jc),u.secureEndpoint){Se("Upgrading socket connection to TLS");const C=u.servername||u.host;return mD.default.connect(Object.assign(Object.assign({},Gc(u,"host","hostname","path","port")),{socket:o,servername:C}))}return o}o.destroy();const p=new CD.default.Socket({writable:!1});return p.readable=!0,t.once("socket",C=>{Se("replaying proxy buffer for failed request"),kc.default(C.listenerCount("data")>0),C.push(F),C.push(null)}),p})}}Yt.default=_c;function jc(e){e.resume()}function Nc(e,t){return!!(!t&&e===80||t&&e===443)}function Lc(e){return typeof e=="string"?/^https:?$/i.test(e):!1}function Gc(e,...t){const u={};let n;for(n in e)t.includes(n)||(u[n]=e[n]);return u}var zc=T&&T.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const ou=zc(Yt);function su(e){return new ou.default(e)}(function(e){e.HttpsProxyAgent=ou.default,e.prototype=ou.default.prototype})(su||(su={}));var Wc=su,Uc=De(Wc);const qc=e=>{if(!e||e.length===0)return"";const t=e.map(r=>r.trim()).filter(Boolean);if(t.length===0)return"";const u=t.slice(0,12),n=t.length-u.length;return["Changed files:",...u.map(r=>`- ${r}`),...n>0?[`- ...and ${n} more file(s)`]:[]].join(`
87
- `)},Hc=e=>["Generate a git commit message for the provided code diff.","The output will be passed directly into git commit.","Return ONLY the final commit message text.","Do not add explanations, quotes, markdown fences, or surrounding commentary.","You may use the changed file list as supporting context, but the diff is the source of truth.",...e.diffWasCompacted?["The diff may be compacted to fit the model context. Infer the dominant outcome from the available patches without pretending to have seen omitted content."]:[],qc(e.changedFiles),"Markdown instructions:",e.messageInstructionsMarkdown.trim()].filter(Boolean).join(`
86
+ `)),m=+F.split(" ")[1];xe("got proxy server response: %o",F),t({statusCode:m,buffered:a})}e.on("error",c),e.on("close",i),e.on("end",s),o()})}iu.default=Hc;var Vc=_&&_.__awaiter||function(e,t,u,n){function D(o){return o instanceof u?o:new u(function(r){r(o)})}return new(u||(u=Promise))(function(o,r){function i(f){try{c(n.next(f))}catch(l){r(l)}}function s(f){try{c(n.throw(f))}catch(l){r(l)}}function c(f){f.done?o(f.value):D(f.value).then(i,s)}c((n=n.apply(e,t||[])).next())})},de=_&&_.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Qt,"__esModule",{value:!0});const gr=de(nD),Er=de(rD),Kc=de(DD),Jc=de(hu),Yc=de(Du),Zc=zc,Xc=de(iu),Se=Yc.default("https-proxy-agent:agent");class Qc extends Zc.Agent{constructor(t){let u;if(typeof t=="string"?u=Kc.default.parse(t):u=t,!u)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");Se("creating new HttpsProxyAgent instance: %o",u),super(u);const n=Object.assign({},u);this.secureProxy=u.secureProxy||ul(n.protocol),n.host=n.hostname||n.host,typeof n.port=="string"&&(n.port=parseInt(n.port,10)),!n.port&&n.host&&(n.port=this.secureProxy?443:80),this.secureProxy&&!("ALPNProtocols"in n)&&(n.ALPNProtocols=["http 1.1"]),n.host&&n.path&&(delete n.path,delete n.pathname),this.proxy=n}callback(t,u){return Vc(this,void 0,void 0,function*(){const{proxy:n,secureProxy:D}=this;let o;D?(Se("Creating `tls.Socket`: %o",n),o=Er.default.connect(n)):(Se("Creating `net.Socket`: %o",n),o=gr.default.connect(n));const r=Object.assign({},n.headers);let s=`CONNECT ${`${u.host}:${u.port}`} HTTP/1.1\r
87
+ `;n.auth&&(r["Proxy-Authorization"]=`Basic ${Buffer.from(n.auth).toString("base64")}`);let{host:c,port:f,secureEndpoint:l}=u;tl(f,l)||(c+=`:${f}`),r.Host=c,r.Connection="close";for(const p of Object.keys(r))s+=`${p}: ${r[p]}\r
88
+ `;const a=Xc.default(o);o.write(`${s}\r
89
+ `);const{statusCode:d,buffered:F}=yield a;if(d===200){if(t.once("socket",el),u.secureEndpoint){Se("Upgrading socket connection to TLS");const p=u.servername||u.host;return Er.default.connect(Object.assign(Object.assign({},nl(u,"host","hostname","path","port")),{socket:o,servername:p}))}return o}o.destroy();const m=new gr.default.Socket({writable:!1});return m.readable=!0,t.once("socket",p=>{Se("replaying proxy buffer for failed request"),Jc.default(p.listenerCount("data")>0),p.push(F),p.push(null)}),m})}}Qt.default=Qc;function el(e){e.resume()}function tl(e,t){return!!(!t&&e===80||t&&e===443)}function ul(e){return typeof e=="string"?/^https:?$/i.test(e):!1}function nl(e,...t){const u={};let n;for(n in e)t.includes(n)||(u[n]=e[n]);return u}var rl=_&&_.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const au=rl(Qt);function cu(e){return new au.default(e)}(function(e){e.HttpsProxyAgent=au.default,e.prototype=au.default.prototype})(cu||(cu={}));var Dl=cu,ol=se(Dl);const sl=e=>{if(!e||e.length===0)return"";const t=e.map(D=>D.trim()).filter(Boolean);if(t.length===0)return"";const u=t.slice(0,12),n=t.length-u.length;return["Changed files:",...u.map(D=>`- ${D}`),...n>0?[`- ...and ${n} more file(s)`]:[]].join(`
90
+ `)},yr=e=>{const t=(e.rewriteFeedbackHistory??[]).map(n=>n.trim()).filter(Boolean);if(t.length>0)return t;const u=e.rewriteFeedback?.trim();return u?[u]:[]},il=e=>["Generate a git commit message for the provided code diff.","The output will be passed directly into git commit.","Return ONLY the final commit message text.","Do not add explanations, quotes, markdown fences, or surrounding commentary.","You may use the changed file list as supporting context, but the diff is the source of truth.",...e.diffWasCompacted?["The diff may be compacted to fit the model context. Infer the dominant outcome from the available patches without pretending to have seen omitted content."]:[],sl(e.changedFiles),...(e.rewriteConversation??[]).length>0?["This may be a revision request with prior assistant drafts and user feedback included in the conversation input.","Treat the conversation turns as the canonical rewrite history. Preserve prior accepted constraints unless a later user turn changes them.","Revise the latest assistant draft instead of drafting a completely new message from scratch."]:[],...e.rewriteFromMessage?.trim()&&yr(e).length>0?["You already suggested a commit message and now need to revise it.",["Current suggested commit message:",e.rewriteFromMessage.trim()].join(`
91
+ `),["User rewrite feedback history:",...yr(e).map((t,u)=>`${u+1}. ${t}`)].join(`
92
+ `),"For this revision, treat the user rewrite feedback as higher priority than the earlier style or formatting preferences.","Revise the existing commit message instead of drafting a completely new one from scratch. Preserve any parts that still fit the diff unless the feedback requires changing them.","Rewrite the commit message to address the feedback while staying faithful to the diff. If the feedback conflicts with the diff, prefer the diff and revise as closely as possible."]:[],"Markdown instructions:",e.messageInstructionsMarkdown.trim()].filter(Boolean).join(`
93
+
94
+ `),al="<think>",cl="</think>",Qe=()=>({carry:"",inReasoningBlock:!1}),ll=(e,t)=>{const u=Math.min(e.length,t.length-1);for(let n=u;n>0;n-=1)if(t.startsWith(e.slice(-n)))return n;return 0},lu=(e,t)=>{let u=`${t.carry}${e}`;const n={carry:"",inReasoningBlock:t.inReasoningBlock};let D="",o="";for(;u.length>0;){const r=n.inReasoningBlock?cl:al,i=u.indexOf(r);if(i===-1){const c=ll(u,r),f=u.slice(0,u.length-c);n.inReasoningBlock?o+=f:D+=f,n.carry=u.slice(u.length-c);break}const s=u.slice(0,i);n.inReasoningBlock?o+=s:D+=s,n.inReasoningBlock=!n.inReasoningBlock,u=u.slice(i+r.length)}return{content:D,reasoning:o,state:n}},br=e=>({content:e.inReasoningBlock?"":e.carry,reasoning:e.inReasoningBlock?e.carry:"",state:Qe()}),fl=e=>{let t=Qe(),u="",n="";for(const o of e){const r=lu(o,t);u+=r.content,n+=r.reasoning,t=r.state}const D=br(t);return u+=D.content,n+=D.reasoning,{content:u,reasoning:n}},dl=e=>fl([e]).content,wr=async(e,t,u,n,D,o,r,i)=>new Promise((s,c)=>{const f=JSON.stringify(n),l={port:r??443,hostname:e,path:t,method:"POST",headers:{...u,"Content-Type":"application/json","Content-Length":Buffer.byteLength(f)},timeout:D,agent:o?ol(o):void 0},a=uD.request(l,d=>{const F=[];d.on("data",m=>{F.push(m),i?.(m.toString())}),d.on("end",()=>{s({request:a,response:d,data:Buffer.concat(F).toString()})})});a.on("error",c),a.on("timeout",()=>{a.destroy(),c(new h(`Time out error: request took over ${D}ms. Try increasing the \`timeout\` config, or checking your API provider status.`))}),a.write(f),a.end()}),Br=(e,t)=>{if(!e?.trim())throw new h("Please set your API base URL via `aicommits config set base-url=<https://...>`");const u=e.trim(),n=new URL(u),D=n.pathname.replace(/\/+$/,"");return{hostname:n.hostname,port:n.port?Number(n.port):443,path:`${D}${t}`}},Fl=e=>Br(e,"/chat/completions"),pl=e=>Br(e,"/responses"),Cl=async(e,t,u,n,D,o,r)=>{const i={...t,...r,stream:!0};let s="";const c=new Map,f=g=>{if(!o)return;const b=Array.isArray(g.choices)?g.choices:[];for(const w of b){if(typeof w!="object"||w===null)continue;const{delta:O}=w;if(typeof O!="object"||O===null)continue;const B=O,x=typeof B.reasoning_content=="string"?B.reasoning_content:typeof B.reasoning=="string"?B.reasoning:"";if(x&&o({kind:"reasoning",text:x}),typeof B.content=="string"&&B.content.length>0){const G=typeof w.index=="number"?w.index:0;if(x){o({kind:"content",text:B.content});continue}const X=c.get(G)||Qe(),P=lu(B.content,X);c.set(G,P.state),P.reasoning&&o({kind:"reasoning",text:P.reasoning}),P.content&&o({kind:"content",text:P.content})}}},l=g=>{if(!o)return;s+=g.replace(/\r\n/g,`
95
+ `);let b=s.indexOf(`
88
96
 
89
- `),Kc="<think>",Vc="</think>",Je=()=>({carry:"",inReasoningBlock:!1}),Jc=(e,t)=>{const u=Math.min(e.length,t.length-1);for(let n=u;n>0;n-=1)if(t.startsWith(e.slice(-n)))return n;return 0},iu=(e,t)=>{let u=`${t.carry}${e}`;const n={carry:"",inReasoningBlock:t.inReasoningBlock};let r="",o="";for(;u.length>0;){const D=n.inReasoningBlock?Vc:Kc,i=u.indexOf(D);if(i===-1){const c=Jc(u,D),f=u.slice(0,u.length-c);n.inReasoningBlock?o+=f:r+=f,n.carry=u.slice(u.length-c);break}const s=u.slice(0,i);n.inReasoningBlock?o+=s:r+=s,n.inReasoningBlock=!n.inReasoningBlock,u=u.slice(i+D.length)}return{content:r,reasoning:o,state:n}},hD=e=>({content:e.inReasoningBlock?"":e.carry,reasoning:e.inReasoningBlock?e.carry:"",state:Je()}),Yc=e=>{let t=Je(),u="",n="";for(const o of e){const D=iu(o,t);u+=D.content,n+=D.reasoning,t=D.state}const r=hD(t);return u+=r.content,n+=r.reasoning,{content:u,reasoning:n}},Zc=e=>Yc([e]).content,gD=async(e,t,u,n,r,o,D,i)=>new Promise((s,c)=>{const f=JSON.stringify(n),l={port:D??443,hostname:e,path:t,method:"POST",headers:{...u,"Content-Type":"application/json","Content-Length":Buffer.byteLength(f)},timeout:r,agent:o?Uc(o):void 0},a=HD.request(l,d=>{const F=[];d.on("data",p=>{F.push(p),i?.(p.toString())}),d.on("end",()=>{s({request:a,response:d,data:Buffer.concat(F).toString()})})});a.on("error",c),a.on("timeout",()=>{a.destroy(),c(new m(`Time out error: request took over ${r}ms. Try increasing the \`timeout\` config, or checking your API provider status.`))}),a.write(f),a.end()}),ED=(e,t)=>{if(!e?.trim())throw new m("Please set your API base URL via `aicommits config set base-url=<https://...>`");const u=e.trim(),n=new URL(u),r=n.pathname.replace(/\/+$/,"");return{hostname:n.hostname,port:n.port?Number(n.port):443,path:`${r}${t}`}},Xc=e=>ED(e,"/chat/completions"),Qc=e=>ED(e,"/responses"),el=async(e,t,u,n,r,o,D)=>{const i={...t,...D,stream:!0};let s="";const c=new Map,f=E=>{if(!o)return;const v=Array.isArray(E.choices)?E.choices:[];for(const B of v){if(typeof B!="object"||B===null)continue;const{delta:x}=B;if(typeof x!="object"||x===null)continue;const g=x,w=typeof g.reasoning_content=="string"?g.reasoning_content:typeof g.reasoning=="string"?g.reasoning:"";if(w&&o({kind:"reasoning",text:w}),typeof g.content=="string"&&g.content.length>0){const Y=typeof B.index=="number"?B.index:0;if(w){o({kind:"content",text:g.content});continue}const le=c.get(Y)||Je(),P=iu(g.content,le);c.set(Y,P.state),P.reasoning&&o({kind:"reasoning",text:P.reasoning}),P.content&&o({kind:"content",text:P.content})}}},l=E=>{if(!o)return;s+=E.replace(/\r\n/g,`
90
- `);let v=s.indexOf(`
97
+ `);for(;b!==-1;){const w=s.slice(0,b);s=s.slice(b+2);for(const O of w.split(`
98
+ `)){const B=O.trim();if(!B.startsWith("data:"))continue;const x=B.slice(5).trim();if(!(!x||x==="[DONE]"))try{const G=JSON.parse(x);f(G)}catch{}}b=s.indexOf(`
91
99
 
92
- `);for(;v!==-1;){const B=s.slice(0,v);s=s.slice(v+2);for(const x of B.split(`
93
- `)){const g=x.trim();if(!g.startsWith("data:"))continue;const w=g.slice(5).trim();if(!(!w||w==="[DONE]"))try{const Y=JSON.parse(w);f(Y)}catch{}}v=s.indexOf(`
100
+ `)}},a=Fl(D),{response:d,data:F}=await wr(a.hostname,a.path,{Authorization:`Bearer ${e}`},i,u,n,a.port,l);if(!d.statusCode||d.statusCode<200||d.statusCode>299){let g=`API Error: ${d.statusCode} - ${d.statusMessage}`;throw F&&(g+=`
94
101
 
95
- `)}},a=Xc(r),{response:d,data:F}=await gD(a.hostname,a.path,{Authorization:`Bearer ${e}`},i,u,n,a.port,l);if(!d.statusCode||d.statusCode<200||d.statusCode>299){let E=`API Error: ${d.statusCode} - ${d.statusMessage}`;throw F&&(E+=`
102
+ ${F}`),new h(g)}const m=F.trim();if(!m)throw new h("API Error: Empty response body");if(m.startsWith("{")){const g=JSON.parse(m),b=Array.isArray(g.choices)?g.choices:[];return{model:typeof g.model=="string"?g.model:"",choices:b.map((w,O)=>{const B=typeof w=="object"&&w!==null?w:{},x=typeof B.message=="object"&&B.message!==null?B.message:{};return{index:typeof B.index=="number"?B.index:O,finish_reason:typeof B.finish_reason=="string"||B.finish_reason===null?B.finish_reason:void 0,message:{role:typeof x.role=="string"?x.role:"assistant",content:typeof x.content=="string"?x.content:"",...typeof x.reasoning_content=="string"?{reasoning_content:x.reasoning_content}:{}}}})}}const p=[];for(const g of m.split(/\r?\n/)){const b=g.trim();if(!b.startsWith("data:"))continue;const w=b.slice(5).trim();if(!(!w||w==="[DONE]"))try{p.push(JSON.parse(w))}catch{}}if(p.length===0)throw new h("API Error: Unable to parse streamed response");const C=p.find(g=>typeof g.error=="object"&&g.error!==null);if(C?.error&&typeof C.error=="object"&&C.error!==null){const g="message"in C.error&&typeof C.error.message=="string"?C.error.message:JSON.stringify(C.error);throw new h(`API Error: ${g}`)}const y=p.find(g=>typeof g.model=="string")||p[0],v=new Map,I=new Map;for(const g of p){const b=Array.isArray(g.choices)?g.choices:[];for(const w of b){if(typeof w!="object"||w===null)continue;const O=w,B=typeof O.index=="number"?O.index:0,x=v.get(B)||{index:B,contentParts:[],reasoningParts:[]},{delta:G}=O;if(typeof G=="object"&&G!==null){const P=G;if(typeof P.role=="string"&&(x.role=P.role),typeof P.content=="string")if(typeof P.reasoning_content=="string"||typeof P.reasoning=="string")x.contentParts.push(P.content);else{const Me=I.get(B)||Qe(),Q=lu(P.content,Me);I.set(B,Q.state),Q.content&&x.contentParts.push(Q.content),Q.reasoning&&x.reasoningParts.push(Q.reasoning)}typeof P.reasoning_content=="string"&&x.reasoningParts.push(P.reasoning_content),typeof P.reasoning=="string"&&x.reasoningParts.push(P.reasoning)}const X=O.finish_reason;(typeof X=="string"||X===null)&&(x.finishReason=X),v.set(B,x)}}for(const[g,b]of I.entries()){const w=v.get(g);if(!w)continue;const O=br(b);O.content&&w.contentParts.push(O.content),O.reasoning&&w.reasoningParts.push(O.reasoning)}const $=Array.from(v.values()).sort((g,b)=>g.index-b.index).map(g=>{const b={role:g.role||"assistant",content:g.contentParts.join("")},w=g.reasoningParts.join("");return w&&(b.reasoning_content=w),{index:g.index,finish_reason:g.finishReason??"stop",message:b}});if($.length===0)throw new h("API Error: Streamed response did not include any choices");return{model:typeof y.model=="string"?y.model:"",choices:$}},ml=(e,t)=>({model:e,messages:t}),vr=e=>{const t=(e.rewriteFeedbackHistory??[]).map(n=>n.trim()).filter(Boolean);if(t.length>0)return t;const u=e.rewriteFeedback?.trim();return u?[u]:[]},fu=e=>{const t=(e.rewriteConversation??[]).flatMap(D=>{if(!D||D.role!=="assistant"&&D.role!=="user")return[];const o=D.content.trim();return o?[{role:D.role,content:o}]:[]});if(t.length>0)return t;const u=e.rewriteFromMessage?.trim(),n=vr(e);return!u||n.length===0?[]:[{role:"assistant",content:u},{role:"user",content:hl(n)}]},hl=e=>["Revise your previous commit message instead of drafting a new one from scratch.","Keep the parts of your previous message that still fit the diff unless the feedback requires changing them.","Apply all of the following rewrite feedback, not just the latest item:",...e.map((t,u)=>`${u+1}. ${t}`),"Return only the revised final commit message text."].join(`
96
103
 
97
- ${F}`),new m(E)}const p=F.trim();if(!p)throw new m("API Error: Empty response body");if(p.startsWith("{")){const E=JSON.parse(p),v=Array.isArray(E.choices)?E.choices:[];return{model:typeof E.model=="string"?E.model:"",choices:v.map((B,x)=>{const g=typeof B=="object"&&B!==null?B:{},w=typeof g.message=="object"&&g.message!==null?g.message:{};return{index:typeof g.index=="number"?g.index:x,finish_reason:typeof g.finish_reason=="string"||g.finish_reason===null?g.finish_reason:void 0,message:{role:typeof w.role=="string"?w.role:"assistant",content:typeof w.content=="string"?w.content:"",...typeof w.reasoning_content=="string"?{reasoning_content:w.reasoning_content}:{}}}})}}const C=[];for(const E of p.split(/\r?\n/)){const v=E.trim();if(!v.startsWith("data:"))continue;const B=v.slice(5).trim();if(!(!B||B==="[DONE]"))try{C.push(JSON.parse(B))}catch{}}if(C.length===0)throw new m("API Error: Unable to parse streamed response");const h=C.find(E=>typeof E.error=="object"&&E.error!==null);if(h?.error&&typeof h.error=="object"&&h.error!==null){const E="message"in h.error&&typeof h.error.message=="string"?h.error.message:JSON.stringify(h.error);throw new m(`API Error: ${E}`)}const y=C.find(E=>typeof E.model=="string")||C[0],A=new Map,_=new Map;for(const E of C){const v=Array.isArray(E.choices)?E.choices:[];for(const B of v){if(typeof B!="object"||B===null)continue;const x=B,g=typeof x.index=="number"?x.index:0,w=A.get(g)||{index:g,contentParts:[],reasoningParts:[]},{delta:Y}=x;if(typeof Y=="object"&&Y!==null){const P=Y;if(typeof P.role=="string"&&(w.role=P.role),typeof P.content=="string")if(typeof P.reasoning_content=="string"||typeof P.reasoning=="string")w.contentParts.push(P.content);else{const TD=_.get(g)||Je(),fe=iu(P.content,TD);_.set(g,fe.state),fe.content&&w.contentParts.push(fe.content),fe.reasoning&&w.reasoningParts.push(fe.reasoning)}typeof P.reasoning_content=="string"&&w.reasoningParts.push(P.reasoning_content),typeof P.reasoning=="string"&&w.reasoningParts.push(P.reasoning)}const le=x.finish_reason;(typeof le=="string"||le===null)&&(w.finishReason=le),A.set(g,w)}}for(const[E,v]of _.entries()){const B=A.get(E);if(!B)continue;const x=hD(v);x.content&&B.contentParts.push(x.content),x.reasoning&&B.reasoningParts.push(x.reasoning)}const j=Array.from(A.values()).sort((E,v)=>E.index-v.index).map(E=>{const v={role:E.role||"assistant",content:E.contentParts.join("")},B=E.reasoningParts.join("");return B&&(v.reasoning_content=B),{index:E.index,finish_reason:E.finishReason??"stop",message:v}});if(j.length===0)throw new m("API Error: Streamed response did not include any choices");return{model:typeof y.model=="string"?y.model:"",choices:j}},tl=(e,t)=>({model:e,messages:t}),ul=(e,t,u)=>({model:e,instructions:t,input:u}),yD=e=>Array.isArray(e)?e.flatMap(t=>{if(typeof t!="object"||t===null)return[];const u="text"in t&&typeof t.text=="string"?t.text:"";return u?[u]:[]}).join(""):"",BD=e=>{const t=Array.isArray(e.output)?e.output:[],u=t.filter(r=>r?.type==="message"||r?.role==="assistant").map(r=>yD(r.content)).join(""),n=t.filter(r=>r?.type==="reasoning").map(r=>yD(r.summary)).join("");return{model:typeof e.model=="string"?e.model:"",choices:[{index:0,finish_reason:"stop",message:{role:"assistant",content:u,...n?{reasoning_content:n}:{}}}]}},nl=e=>{const t=e.find(r=>r.type==="response.completed");if(t&&typeof t.response=="object"&&t.response!==null)return BD(t.response);const u=e.filter(r=>typeof r.type=="string"&&r.type.includes("output_text")&&r.type.endsWith(".delta")&&typeof r.delta=="string").map(r=>r.delta).join(""),n=e.filter(r=>typeof r.type=="string"&&r.type.includes("reasoning")&&r.type.endsWith(".delta")&&typeof r.delta=="string").map(r=>r.delta).join("");return{model:"",choices:[{index:0,finish_reason:"stop",message:{role:"assistant",content:u,...n?{reasoning_content:n}:{}}}]}},Dl=async(e,t,u,n,r,o,D)=>{const i={...t,...D,stream:!0};let s="";const c=h=>{if(!(!o||typeof h.type!="string")){if(h.type.includes("reasoning")&&h.type.endsWith(".delta")&&typeof h.delta=="string"){o({kind:"reasoning",text:h.delta});return}h.type.includes("output_text")&&h.type.endsWith(".delta")&&typeof h.delta=="string"&&o({kind:"content",text:h.delta})}},f=h=>{if(!o)return;s+=h.replace(/\r\n/g,`
104
+ `),gl=(e,t,u)=>{const n=fu(u);return n.length===0?[{role:"system",content:e},{role:"user",content:t}]:[{role:"system",content:e},{role:"user",content:t},...n]},El=(e,t,u)=>({model:e,instructions:t,input:u}),yl=(e,t)=>{const u=fu(t);return u.length===0?e:[{role:"user",content:e},...u]},Ar=e=>Array.isArray(e)?e.flatMap(t=>{if(typeof t!="object"||t===null)return[];const u="text"in t&&typeof t.text=="string"?t.text:"";return u?[u]:[]}).join(""):"",$r=e=>{const t=Array.isArray(e.output)?e.output:[],u=t.filter(D=>D?.type==="message"||D?.role==="assistant").map(D=>Ar(D.content)).join(""),n=t.filter(D=>D?.type==="reasoning").map(D=>Ar(D.summary)).join("");return{model:typeof e.model=="string"?e.model:"",choices:[{index:0,finish_reason:"stop",message:{role:"assistant",content:u,...n?{reasoning_content:n}:{}}}]}},bl=e=>{const t=e.find(D=>D.type==="response.completed");if(t&&typeof t.response=="object"&&t.response!==null)return $r(t.response);const u=e.filter(D=>typeof D.type=="string"&&D.type.includes("output_text")&&D.type.endsWith(".delta")&&typeof D.delta=="string").map(D=>D.delta).join(""),n=e.filter(D=>typeof D.type=="string"&&D.type.includes("reasoning")&&D.type.endsWith(".delta")&&typeof D.delta=="string").map(D=>D.delta).join("");return{model:"",choices:[{index:0,finish_reason:"stop",message:{role:"assistant",content:u,...n?{reasoning_content:n}:{}}}]}},wl=async(e,t,u,n,D,o,r)=>{const i={...t,...r,stream:!0};let s="";const c=C=>{if(!(!o||typeof C.type!="string")){if(C.type.includes("reasoning")&&C.type.endsWith(".delta")&&typeof C.delta=="string"){o({kind:"reasoning",text:C.delta});return}C.type.includes("output_text")&&C.type.endsWith(".delta")&&typeof C.delta=="string"&&o({kind:"content",text:C.delta})}},f=C=>{if(!o)return;s+=C.replace(/\r\n/g,`
98
105
  `);let y=s.indexOf(`
99
106
 
100
- `);for(;y!==-1;){const A=s.slice(0,y);s=s.slice(y+2);for(const _ of A.split(`
101
- `)){const j=_.trim();if(!j.startsWith("data:"))continue;const E=j.slice(5).trim();if(!(!E||E==="[DONE]"))try{c(JSON.parse(E))}catch{}}y=s.indexOf(`
107
+ `);for(;y!==-1;){const v=s.slice(0,y);s=s.slice(y+2);for(const I of v.split(`
108
+ `)){const $=I.trim();if(!$.startsWith("data:"))continue;const g=$.slice(5).trim();if(!(!g||g==="[DONE]"))try{c(JSON.parse(g))}catch{}}y=s.indexOf(`
102
109
 
103
- `)}},l=Qc(r),{response:a,data:d}=await gD(l.hostname,l.path,{Authorization:`Bearer ${e}`},i,u,n,l.port,f);if(!a.statusCode||a.statusCode<200||a.statusCode>299){let h=`API Error: ${a.statusCode} - ${a.statusMessage}`;throw d&&(h+=`
110
+ `)}},l=pl(D),{response:a,data:d}=await wr(l.hostname,l.path,{Authorization:`Bearer ${e}`},i,u,n,l.port,f);if(!a.statusCode||a.statusCode<200||a.statusCode>299){let C=`API Error: ${a.statusCode} - ${a.statusMessage}`;throw d&&(C+=`
104
111
 
105
- ${d}`),new m(h)}const F=d.trim();if(!F)throw new m("API Error: Empty response body");if(F.startsWith("{"))return BD(JSON.parse(F));const p=[];for(const h of F.split(/\r?\n/)){const y=h.trim();if(!y.startsWith("data:"))continue;const A=y.slice(5).trim();if(!(!A||A==="[DONE]"))try{p.push(JSON.parse(A))}catch{}}if(p.length===0)throw new m("API Error: Unable to parse streamed response");const C=p.find(h=>h.type==="error"||typeof h.error=="object"&&h.error!==null);if(C){if(typeof C.error=="object"&&C.error!==null){const h="message"in C.error&&typeof C.error.message=="string"?C.error.message:JSON.stringify(C.error);throw new m(`API Error: ${h}`)}if(typeof C.message=="string")throw new m(`API Error: ${C.message}`)}return nl(p)},au=e=>e.replace(/\r\n?/g,`
106
- `),rl=e=>{const t=e.match(/```[\w-]*\n([\s\S]*?)```/);return t?.[1]?t[1].trim():e.replace(/```/g,"").trim()},ol=e=>e.trim().replace(/^title:\s*/i,"").replace(/(\w)\.$/,"$1").replace(/^["'`]|["'`]$/g,""),sl=e=>{const t=au(e).trim();if(!t)return{title:"",body:""};const u=t.split(`
107
- `).map(o=>o.replace(/\s+$/g,""));for(;u[0]?.trim()==="";)u.shift();const n=ol(u.shift()||"");for(;u[0]?.trim()==="";)u.shift();u[0]?.trim().toLowerCase().startsWith("body:")&&(u[0]=u[0].replace(/^body:\s*/i,""));const r=u.join(`
108
- `).trim();return{title:n,body:r}},il=(e,t)=>t?`${e}
112
+ ${d}`),new h(C)}const F=d.trim();if(!F)throw new h("API Error: Empty response body");if(F.startsWith("{"))return $r(JSON.parse(F));const m=[];for(const C of F.split(/\r?\n/)){const y=C.trim();if(!y.startsWith("data:"))continue;const v=y.slice(5).trim();if(!(!v||v==="[DONE]"))try{m.push(JSON.parse(v))}catch{}}if(m.length===0)throw new h("API Error: Unable to parse streamed response");const p=m.find(C=>C.type==="error"||typeof C.error=="object"&&C.error!==null);if(p){if(typeof p.error=="object"&&p.error!==null){const C="message"in p.error&&typeof p.error.message=="string"?p.error.message:JSON.stringify(p.error);throw new h(`API Error: ${C}`)}if(typeof p.message=="string")throw new h(`API Error: ${p.message}`)}return bl(m)},du=e=>e.replace(/\r\n?/g,`
113
+ `),Bl=e=>{const t=e.match(/```[\w-]*\n([\s\S]*?)```/);return t?.[1]?t[1].trim():e.replace(/```/g,"").trim()},vl=e=>e.trim().replace(/^title:\s*/i,"").replace(/(\w)\.$/,"$1").replace(/^["'`]|["'`]$/g,""),Al=e=>{const t=du(e).trim();if(!t)return{title:"",body:""};const u=t.split(`
114
+ `).map(o=>o.replace(/\s+$/g,""));for(;u[0]?.trim()==="";)u.shift();const n=vl(u.shift()||"");for(;u[0]?.trim()==="";)u.shift();u[0]?.trim().toLowerCase().startsWith("body:")&&(u[0]=u[0].replace(/^body:\s*/i,""));const D=u.join(`
115
+ `).trim();return{title:n,body:D}},$l=(e,t)=>t?`${e}
109
116
 
110
- ${t}`:e,al=(e,t,u,n)=>{const r=rl(e),{title:o,body:D}=sl(r);if(!o)return"";const i=au(D).split(`
117
+ ${t}`:e,xl=(e,t,u,n)=>{const D=Bl(e),{title:o,body:r}=Al(D);if(!o)return"";const i=du(r).split(`
111
118
  `).map(s=>s.replace(/\s+$/u,"")).join(`
112
- `).trim();return i?il(o,i):o},cl=["none","low","medium","high","xhigh"],Ye=e=>{if(typeof e!="string")return;const t=e.trim().toLowerCase();return cl.includes(t)?t:void 0},ll=(e,t)=>{if(!e?.trim())return{};let u;try{u=JSON.parse(e)}catch{throw new m("Invalid config property request-options: Must be valid JSON")}if(typeof u!="object"||u===null||Array.isArray(u))throw new m("Invalid config property request-options: Must be a JSON object");const n={...u};if(delete n.model,delete n.messages,delete n.input,delete n.instructions,delete n.stream,t==="responses"){const o=Ye(n.reasoning_effort);return o&&(typeof n.reasoning!="object"||n.reasoning===null||Array.isArray(n.reasoning))?n.reasoning={effort:o}:o&&typeof n.reasoning=="object"&&n.reasoning!==null&&!Array.isArray(n.reasoning)&&Ye(n.reasoning.effort)===void 0&&(n.reasoning={...n.reasoning,effort:o}),delete n.reasoning_effort,delete n.max_completion_tokens,n}const r=typeof n.reasoning=="object"&&n.reasoning!==null&&!Array.isArray(n.reasoning)?Ye(n.reasoning.effort):void 0;return r&&Ye(n.reasoning_effort)===void 0&&(n.reasoning_effort=r),delete n.reasoning,delete n.max_output_tokens,n},fl=(e,t,u)=>{const n=ll(e,t);if(!u)return n;if(t==="responses"){const r=typeof n.reasoning=="object"&&n.reasoning!==null&&!Array.isArray(n.reasoning)?n.reasoning:{};return{...n,reasoning:{...r,effort:u}}}return{...n,reasoning_effort:u}},dl=e=>Array.from(new Set(e)),bD=12e4,Fl=1024,pl=3,Cl=900,ml=700,hl=450,gl=.85,Ze="[Diff compacted to fit model context. Each file is represented with abbreviated hunks when needed.]",wD="@@ ... patch content truncated ... @@",El=(e=0)=>{if(!Number.isInteger(e)||e<=0)return bD;const t=Cl+ml+hl,u=Math.floor((e-t)*gl),n=Math.max(128,u);return Math.max(Fl,n*pl)},yl=e=>{const t=/^diff --git .+$/gm,u=Array.from(e.matchAll(t));if(u.length===0)return[e];const n=[],r=u[0]?.index??0;if(r>0){const o=e.slice(0,r).trim();o&&n.push(o)}for(const[o,D]of u.entries()){const i=D.index??0,s=u[o+1]?.index??e.length,c=e.slice(i,s).trim();c&&n.push(c)}return n},AD=(e,t)=>{if(t<=0)return"";if(e.length<=t)return e;const u=wD.length+2;if(t<=u)return e.slice(0,t);const n=t-u,r=Math.floor(n*.7),o=Math.min(60,n),D=Math.min(40,Math.max(0,n-o)),i=Math.max(o,Math.min(r,n-D)),s=n-i;if(s<=0)return e.slice(0,t);const c=e.slice(0,i).trimEnd(),f=e.slice(-s).trimStart();return f?`${c}
113
- ${wD}
114
- ${f}`.slice(0,t):e.slice(0,t)},Bl=(e,t=bD)=>{const u=au(e).trim();if(!u)return u;if(t<=0)return"";const n=Ze.length+2;if(u.length<=t)return u;if(t<=n)return u.slice(0,t);const r=t-n,o=yl(u);if(o.length<=1)return`${AD(u,r)}
119
+ `).trim();return i?$l(o,i):o},Sl=["none","low","medium","high","xhigh"],et=e=>{if(typeof e!="string")return;const t=e.trim().toLowerCase();return Sl.includes(t)?t:void 0},kl=(e,t)=>{if(!e?.trim())return{};let u;try{u=JSON.parse(e)}catch{throw new h("Invalid config property request-options: Must be valid JSON")}if(typeof u!="object"||u===null||Array.isArray(u))throw new h("Invalid config property request-options: Must be a JSON object");const n={...u};if(delete n.model,delete n.messages,delete n.input,delete n.instructions,delete n.stream,t==="responses"){const o=et(n.reasoning_effort);return o&&(typeof n.reasoning!="object"||n.reasoning===null||Array.isArray(n.reasoning))?n.reasoning={effort:o}:o&&typeof n.reasoning=="object"&&n.reasoning!==null&&!Array.isArray(n.reasoning)&&et(n.reasoning.effort)===void 0&&(n.reasoning={...n.reasoning,effort:o}),delete n.reasoning_effort,delete n.max_completion_tokens,n}const D=typeof n.reasoning=="object"&&n.reasoning!==null&&!Array.isArray(n.reasoning)?et(n.reasoning.effort):void 0;return D&&et(n.reasoning_effort)===void 0&&(n.reasoning_effort=D),delete n.reasoning,delete n.max_output_tokens,n},Ml=(e,t,u)=>{const n=kl(e,t);if(!u)return n;if(t==="responses"){const D=typeof n.reasoning=="object"&&n.reasoning!==null&&!Array.isArray(n.reasoning)?n.reasoning:{};return{...n,reasoning:{...D,effort:u}}}return{...n,reasoning_effort:u}},Il=e=>Array.from(new Set(e)),xr=12e4,Ol=1024,Tl=3,Pl=900,Rl=700,_l=450,jl=.85,tt="[Diff compacted to fit model context. Each file is represented with abbreviated hunks when needed.]",Sr="@@ ... patch content truncated ... @@",Nl=(e=0)=>{if(!Number.isInteger(e)||e<=0)return xr;const t=Pl+Rl+_l,u=Math.floor((e-t)*jl),n=Math.max(128,u);return Math.max(Ol,n*Tl)},Ll=e=>{const t=/^diff --git .+$/gm,u=Array.from(e.matchAll(t));if(u.length===0)return[e];const n=[],D=u[0]?.index??0;if(D>0){const o=e.slice(0,D).trim();o&&n.push(o)}for(const[o,r]of u.entries()){const i=r.index??0,s=u[o+1]?.index??e.length,c=e.slice(i,s).trim();c&&n.push(c)}return n},kr=(e,t)=>{if(t<=0)return"";if(e.length<=t)return e;const u=Sr.length+2;if(t<=u)return e.slice(0,t);const n=t-u,D=Math.floor(n*.7),o=Math.min(60,n),r=Math.min(40,Math.max(0,n-o)),i=Math.max(o,Math.min(D,n-r)),s=n-i;if(s<=0)return e.slice(0,t);const c=e.slice(0,i).trimEnd(),f=e.slice(-s).trimStart();return f?`${c}
120
+ ${Sr}
121
+ ${f}`.slice(0,t):e.slice(0,t)},Gl=(e,t=xr)=>{const u=du(e).trim();if(!u)return u;if(t<=0)return"";const n=tt.length+2;if(u.length<=t)return u;if(t<=n)return u.slice(0,t);const D=t-n,o=Ll(u);if(o.length<=1)return`${kr(u,D)}
115
122
 
116
- ${Ze}`;const D=`
123
+ ${tt}`;const r=`
117
124
 
118
- `,i=D.length*Math.max(0,o.length-1),s=Math.max(1,r-i),c=Math.max(1,Math.floor(s/o.length));return`${o.map(a=>AD(a,c)).filter(Boolean).join(D)}
125
+ `,i=r.length*Math.max(0,o.length-1),s=Math.max(1,D-i),c=Math.max(1,Math.floor(s/o.length));return`${o.map(a=>kr(a,c)).filter(Boolean).join(r)}
119
126
 
120
- ${Ze}`},vD=async(e,t,u,n,r,o,D,i)=>{const s=D??{messageInstructionsMarkdown:""},c=s.apiMode??"responses",f=fl(s.requestOptionsJson,c,s.reasoningEffort),l=El(s.contextWindowTokens),a=Bl(u,l),d=a.includes(Ze);try{const F=Hc({messageInstructionsMarkdown:s.messageInstructionsMarkdown||"",changedFiles:s.changedFiles,diffWasCompacted:d}),p=Math.max(1,n),h=(await Promise.all(Array.from({length:p},()=>c==="responses"?Dl(e,ul(t,F,a),r,o,i,y=>s.onStreamEvent?.({phase:"message",...y}),f):el(e,tl(t,[{role:"system",content:F},{role:"user",content:a}]),r,o,i,y=>s.onStreamEvent?.({phase:"message",...y}),f)))).flatMap(y=>y.choices).flatMap(y=>{const A=y.message?.content;if(typeof A!="string")return[];const _=al(Zc(A));return _?[_]:[]});return dl(h)}catch(F){const p=F;throw p.code==="ENOTFOUND"?new m(`Error connecting to ${p.hostname} (${p.syscall}). Are you connected to the internet?`):p}},$D=()=>{const e=["|","/","-","\\"],t=process.stdout.isTTY?120:1e4;let u=0,n="",r=!1,o;const D=Ai("\u2502"),i=c=>{if(!process.stdout.isTTY){process.stdout.write(`${c}
121
- `);return}process.stdout.write(`\r\x1B[2K${c}`)},s=()=>{const c=e[u];i(`${wi("\u25C6")} ${c} ${n}`),u=(u+1)%e.length};return{start(c){if(n=c,r){s();return}if(r=!0,process.stdout.isTTY){process.stdout.write(`${D}
122
- `),s(),o=setInterval(s,t);return}i(n)},update(c){n=c,!(!r||!process.stdout.isTTY)&&s()},stop(c){if(r){if(r=!1,o&&(clearInterval(o),o=void 0),process.stdout.isTTY){const f=c.split(/\r?\n/),l=f.shift()??"";process.stdout.write(`\r\x1B[2K${Ge("\u25C6")} ${l}
123
- `);for(const a of f)process.stdout.write(`${D} ${a}
127
+ ${tt}`},Mr=async(e,t,u,n,D,o,r,i)=>{const s=r??{messageInstructionsMarkdown:""},c=s.apiMode??"responses",f=Ml(s.requestOptionsJson,c,s.reasoningEffort),l=Nl(s.contextWindowTokens),a=Gl(u,l),d=a.includes(tt),F=vr(s),m=fu(s);try{const p=Wl({messageInstructionsMarkdown:s.messageInstructionsMarkdown||"",changedFiles:s.changedFiles,diffWasCompacted:d,rewriteFromMessage:s.rewriteFromMessage,rewriteFeedback:s.rewriteFeedback,rewriteFeedbackHistory:F,rewriteConversation:m}),C=Math.max(1,n),v=(await Promise.all(Array.from({length:C},()=>c==="responses"?wl(e,El(t,p,yl(a,{rewriteConversation:m,rewriteFromMessage:s.rewriteFromMessage,rewriteFeedback:s.rewriteFeedback,rewriteFeedbackHistory:F})),D,o,i,I=>s.onStreamEvent?.({phase:"message",...I}),f):Cl(e,ml(t,gl(p,a,{rewriteConversation:m,rewriteFromMessage:s.rewriteFromMessage,rewriteFeedback:s.rewriteFeedback,rewriteFeedbackHistory:F})),D,o,i,I=>s.onStreamEvent?.({phase:"message",...I}),f)))).flatMap(I=>I.choices).flatMap(I=>{const $=I.message?.content;if(typeof $!="string")return[];const g=xl(dl($));return g?[g]:[]});return Il(v)}catch(p){const C=p;throw C.code==="ENOTFOUND"?new h(`Error connecting to ${C.hostname} (${C.syscall}). Are you connected to the internet?`):C}},Wl=e=>il({messageInstructionsMarkdown:e.messageInstructionsMarkdown||"",changedFiles:e.changedFiles,diffWasCompacted:e.diffWasCompacted,rewriteFromMessage:e.rewriteFromMessage,rewriteFeedback:e.rewriteFeedback,rewriteFeedbackHistory:e.rewriteFeedbackHistory,rewriteConversation:e.rewriteConversation}),Ir=()=>{const e=["|","/","-","\\"],t=process.stdout.isTTY?120:1e4;let u=0,n="",D=!1,o;const r=Pi("\u2502"),i=c=>{if(!process.stdout.isTTY){process.stdout.write(`${c}
128
+ `);return}process.stdout.write(`\r\x1B[2K${c}`)},s=()=>{const c=e[u];i(`${Ti("\u25C6")} ${c} ${n}`),u=(u+1)%e.length};return{start(c){if(n=c,D){s();return}if(D=!0,process.stdout.isTTY){process.stdout.write(`${r}
129
+ `),s(),o=setInterval(s,t);return}i(n)},update(c){n=c,!(!D||!process.stdout.isTTY)&&s()},stop(c){if(D){if(D=!1,o&&(clearInterval(o),o=void 0),process.stdout.isTTY){const f=c.split(/\r?\n/),l=f.shift()??"";process.stdout.write(`\r\x1B[2K${qe("\u25C6")} ${l}
130
+ `);for(const a of f)process.stdout.write(`${r} ${a}
124
131
  `);return}process.stdout.write(`${c}
125
- `)}}}},bl=e=>e.replace(/\s+$/u,""),xD=async(e,t,u)=>{if(!t)return e;const n=await U(t,[],{cwd:u.cwd,input:e,reject:!1,env:{AICOMMITS_CWD:u.cwd,AICOMMITS_CONFIG_DIR:u.configDirectoryPath,AICOMMITS_MESSAGE_FILE:u.messageFilePath,AICOMMITS_CANDIDATE_INDEX:String(u.candidateIndex),AICOMMITS_CANDIDATE_COUNT:String(u.candidateCount),AICOMMITS_COMMIT_SOURCE:u.commitSource}});if(n.exitCode!==0){const o=n.stderr.trim();throw new m(o?`Post-response script failed: ${o}`:`Post-response script failed with exit code ${n.exitCode}.`)}const r=bl(n.stdout);if(!r)throw new m("Post-response script produced an empty commit message.");return r},wl=e=>{const t=Math.max(0,Math.floor(e/1e3)),u=Math.floor(t/3600),n=Math.floor(t%3600/60),r=t%60;return u>0?`${u}h ${n}m ${r}s`:n>0?`${n}m ${r}s`:`${r}s`},Al=(e,t)=>{const u=Date.now(),n=1e3,r=()=>e.update(`The AI (${t}) is thinking for ${wl(Date.now()-u)}`);r();const o=setInterval(r,n);return()=>clearInterval(o)};var vl=async(e,t,u,n,r,o,D,i,s,c,f)=>(async()=>{fa(vi(bi(" aicommits "))),await Ln();const l=$D();u&&await U("git",["add","--update"]),l.start("Detecting git changes");const a=await ba(t);if(!a)throw l.stop("Detecting git changes"),new m("No staged changes found. Stage your changes manually, or automatically stage all changes with the `--all` flag.");l.stop(`${wa(a.files,a.source)}:
126
- ${a.files.map(g=>` ${g}`).join(`
127
- `)}`);const d=await Jt({generate:e?.toString(),"show-reasoning":n===!0?"true":void 0,"reasoning-effort":r,"api-mode":o,"message-path":D,"post-response-script":i,"base-url":s}),F={messageInstructionsMarkdown:d.messageInstructionsMarkdown,reasoningEffort:d["reasoning-effort"],requestOptionsJson:d["request-options"],apiMode:d["api-mode"],contextWindowTokens:d["context-window"],changedFiles:a.files},p=d["show-reasoning"]===!0,C=$D();C.start(`The AI (${d.model}) is analyzing your changes`);let h,y=!1,A=!0,_=!1,j;const E={message:"Message Generation"},v=g=>{if(!(g.kind!=="reasoning"||!g.text)){if(!p){y||(h=Al(C,d.model),y=!0);return}A&&(C.stop(`The AI (${d.model}) is thinking`),A=!1),_||(process.stdout.write(`${ge(`
128
- The AI (${d.model}) is thinking`)}
129
- `),_=!0),g.phase!==j&&(j=g.phase,process.stdout.write(`${ge(`[${E[g.phase]}]
130
- `)}`)),process.stdout.write(g.text)}};let B;try{B=await vD(d["api-key"],d.model,a.diff,d.generate,d.timeout,d.proxy,{...F,onStreamEvent:v},d["base-url"])}finally{h?.(),A?C.stop("Changes analyzed"):p&&process.stdout.write(`
131
- `)}if(B.length===0)throw new m("No commit messages were generated. Try again.");B=await Promise.all(B.map((g,w)=>xD(g,d.postResponseScriptPath,{candidateCount:B.length,candidateIndex:w,commitSource:"cli",configDirectoryPath:d.configDirectoryPath,cwd:process.cwd(),messageFilePath:d.messageFilePath})));let x;if(c)[x]=B;else try{if(B.length===1){[x]=B;const g=await ca({message:`Use this commit message?
132
+ `)}}}},zl=e=>e.replace(/\s+$/u,""),Or=async(e,t,u)=>{if(!t)return e;const n=await q(t,[],{cwd:u.cwd,input:e,reject:!1,env:{AICOMMITS_CWD:u.cwd,AICOMMITS_CONFIG_DIR:u.configDirectoryPath,AICOMMITS_MESSAGE_FILE:u.messageFilePath,AICOMMITS_CANDIDATE_INDEX:String(u.candidateIndex),AICOMMITS_CANDIDATE_COUNT:String(u.candidateCount),AICOMMITS_COMMIT_SOURCE:u.commitSource}});if(n.exitCode!==0){const o=n.stderr.trim();throw new h(o?`Post-response script failed: ${o}`:`Post-response script failed with exit code ${n.exitCode}.`)}const D=zl(n.stdout);if(!D)throw new h("Post-response script produced an empty commit message.");return D},Tr="\0use-commit-message",Ul="\0rewrite-commit-message",ut="\0cancel",Pr="\0back",ql=async(e,t)=>{const u=await e.text({message:"Tell the AI how to rewrite this commit message:",placeholder:"Example: keep it shorter, mention the scope, and use feat instead of refactor",validate(n){if(n.trim().length===0)return"Rewrite feedback is required."}});return e.isCancel(u)?{status:"cancelled"}:{status:"rewrite",message:t,feedback:u.trim()}},Rr=async(e,t,u)=>{const n=await e.select({message:`Review this commit message:
132
133
 
133
- ${x}
134
- `});if(!g||Mn(g)){He("Commit cancelled");return}}else{const g=await la({message:`Pick a commit message to use: ${ge("(Ctrl+c to exit)")}`,options:B.map(w=>({label:w,value:w}))});if(Mn(g)){He("Commit cancelled");return}x=g}}catch(g){const w=g instanceof Error?g.message:"";throw w.includes("TTY initialization failed")||w.includes("uv_tty_init returned EINVAL")||w.includes("ERR_TTY_INIT_FAILED")?new m("Interactive terminal initialization failed in this environment. Re-run with `--confirm` or `--yes` to skip prompts."):g}a.source==="uncommitted"&&await U("git",["add","--all","--",...a.files]),await U("git",["commit","-m",x,...f]),He(`${Ge("\u2714")} Successfully committed!`)})().catch(l=>{He(`${St("\u2716")} ${l.message}`),Gt(l),process.exit(1)});const $l="prepare-commit-msg-hook",xl=()=>{const e=process.argv.slice(2);return e[0]===$l?e.slice(1):e},Sl=async()=>{const{stdout:e}=await U("git",["rev-parse","--git-path","COMMIT_EDITMSG"],{reject:!1}),t=e.trim();return t===""?void 0:t},Ol=async e=>$.readFile(e,"utf8").catch(t=>{if(t.code==="ENOENT")return"";throw t});var Il=()=>(async()=>{const[e,t]=xl(),u=e?.trim()||await Sl();if(!u)return;const n=await Ol(u);if(t==="message"&&n.trim()!=="")return;const o=await qn();if(!o)return;const D=await Jt({}),i={messageInstructionsMarkdown:D.messageInstructionsMarkdown,reasoningEffort:D["reasoning-effort"],requestOptionsJson:D["request-options"],apiMode:D["api-mode"],contextWindowTokens:D["context-window"],changedFiles:o.files},s=await vD(D["api-key"],D.model,o.diff,D.generate,D.timeout,D.proxy,i,D["base-url"]);if(s.length===0)return;const c=s[0]?.trim();if(!c)return;let f=c;try{f=await xD(c,D.postResponseScriptPath,{candidateCount:1,candidateIndex:0,commitSource:"hook",configDirectoryPath:D.configDirectoryPath,cwd:process.cwd(),messageFilePath:D.messageFilePath})}catch{}const l=`${f}
135
- `;await $.writeFile(u,l),process.stdout.write(l)})().catch(()=>{});const Ml=e=>{const t=e.indexOf("=");if(t<=0)throw new m(`Invalid config assignment: "${e}". Use <key>=<value>.`);return[e.slice(0,t),e.slice(t+1)]};var kl=Nu({name:"config",parameters:["<mode>","<key=value...>"]},e=>{(async()=>{const{mode:t,keyValue:u}=e._;if(t==="get"){const n=await Jt({},!0);for(const r of u){const o=sD(r);o&&Qn(n,o)&&console.log(`${o}=${n[o]}`)}return}if(t==="set"){await Cc(u.map(Ml));return}throw new m(`Invalid mode: ${t}`)})().catch(t=>{console.error(`${St("\u2716")} ${t.message}`),Gt(t),process.exit(1)})});const Tl=e=>$.lstat(e).then(()=>!0,()=>!1),cu="prepare-commit-msg",Pl="prepare-commit-msg-hook",Rl=`/hooks/${cu}`,SD=new URL(import.meta.url.endsWith(".ts")?"../cli.ts":"../cli.mjs",import.meta.url),OD=hu(SD),_l=import.meta.url.endsWith(".ts")?new URL("../../node_modules/tsx/dist/cli.mjs",import.meta.url):SD,jl=hu(_l),ID=`
134
+ ${t}
135
+ `,options:[{label:"Use this commit message",value:Tr},{label:"Ask AI to rewrite it",hint:"Give feedback and regenerate",value:Ul},...u?[{label:"Back to suggestions",value:Pr}]:[],{label:"Cancel",value:ut}]});return e.isCancel(n)||n===ut?{status:"cancelled"}:n===Pr?{status:"back"}:n===Tr?{status:"submitted",message:t}:ql(e,t)},Hl=async(e,t)=>{if(e.length===1){const[n]=e,D=await Rr(t,n,!1);return D.status==="back"?{status:"cancelled"}:D}let u=!0;for(;u;){const n=await t.select({message:"Pick a commit message to review:",options:[...e.map(o=>({label:o,value:o})),{label:"Cancel",value:ut}]});if(t.isCancel(n)||n===ut)return{status:"cancelled"};const D=await Rr(t,n,!0);if(D.status!=="back")return u=!1,D}return{status:"cancelled"}},Vl=e=>Hl(e,{select:$a,text:Aa,isCancel:ia}),Kl=e=>{const t=Math.max(0,Math.floor(e/1e3)),u=Math.floor(t/3600),n=Math.floor(t%3600/60),D=t%60;return u>0?`${u}h ${n}m ${D}s`:n>0?`${n}m ${D}s`:`${D}s`},Jl=(e,t)=>{const u=Date.now(),n=1e3,D=()=>e.update(`The AI (${t}) is thinking for ${Kl(Date.now()-u)}`);D();const o=setInterval(D,n);return()=>clearInterval(o)};var Yl=async(e,t,u,n,D,o,r,i,s,c,f)=>(async()=>{xa(Ri(Oi(" aicommits "))),await zn();const l=Ir();u&&await q("git",["add","--update"]),l.start("Detecting git changes");const a=await Na(t);if(!a)throw l.stop("Detecting git changes"),new h("No staged changes found. Stage your changes manually, or automatically stage all changes with the `--all` flag.");l.stop(`${La(a.files,a.source)}:
136
+ ${a.files.map($=>` ${$}`).join(`
137
+ `)}`);const d=await Xt({generate:e?.toString(),"show-reasoning":n===!0?"true":void 0,"reasoning-effort":D,"api-mode":o,"message-path":r,"post-response-script":i,"base-url":s}),F={messageInstructionsMarkdown:d.messageInstructionsMarkdown,reasoningEffort:d["reasoning-effort"],requestOptionsJson:d["request-options"],apiMode:d["api-mode"],contextWindowTokens:d["context-window"],changedFiles:a.files},m=d["show-reasoning"]===!0,p=async({completions:$=d.generate,rewriteFromMessage:g,rewriteFeedback:b,rewriteFeedbackHistory:w,rewriteConversation:O,statusMessage:B=`The AI (${d.model}) is analyzing your changes`,finishedMessage:x="Changes analyzed"}={})=>{const G=Ir();G.start(B);let X,P=!1,ke=!0,Me=!1,Q;const Wr={message:"Message Generation"},zr=ee=>{if(!(ee.kind!=="reasoning"||!ee.text)){if(!m){P||(X=Jl(G,d.model),P=!0);return}ke&&(G.stop(`The AI (${d.model}) is thinking`),ke=!1),Me||(process.stdout.write(`${Ue(`
138
+ The AI (${d.model}) is thinking`)}
139
+ `),Me=!0),ee.phase!==Q&&(Q=ee.phase,process.stdout.write(`${Ue(`[${Wr[ee.phase]}]
140
+ `)}`)),process.stdout.write(ee.text)}};let Ie;try{Ie=await Mr(d["api-key"],d.model,a.diff,$,d.timeout,d.proxy,{...F,rewriteFromMessage:g,rewriteFeedback:b,rewriteFeedbackHistory:w,rewriteConversation:O,onStreamEvent:zr},d["base-url"])}finally{X?.(),ke?G.stop(x):m&&process.stdout.write(`
141
+ `)}if(Ie.length===0)throw new h("No commit messages were generated. Try again.");return Promise.all(Ie.map((ee,Ur)=>Or(ee,d.postResponseScriptPath,{candidateCount:Ie.length,candidateIndex:Ur,commitSource:"cli",configDirectoryPath:d.configDirectoryPath,cwd:process.cwd(),messageFilePath:d.messageFilePath})))};let C=await p(),y=[],v=[],I="";if(c)[I]=C;else try{let $=!0;for(;$;){const g=await Vl(C);if(g.status==="cancelled"){Wt("Commit cancelled");return}if(g.status==="submitted"){I=g.message,$=!1;break}y=[...y,g.feedback],v=[...v,{role:"assistant",content:g.message},{role:"user",content:g.feedback}],C=await p({completions:1,rewriteFromMessage:g.message,rewriteFeedback:g.feedback,rewriteFeedbackHistory:y,rewriteConversation:v,statusMessage:`The AI (${d.model}) is revising your commit message`,finishedMessage:"Commit message revised"})}}catch($){const g=$ instanceof Error?$.message:"";throw g.includes("TTY initialization failed")||g.includes("uv_tty_init returned EINVAL")||g.includes("ERR_TTY_INIT_FAILED")?new h("Interactive terminal initialization failed in this environment. Re-run with `--confirm` or `--yes` to skip prompts."):$}a.source==="uncommitted"&&await q("git",["add","--all","--",...a.files]),await q("git",["commit","-m",I,...f]),Wt(`${qe("\u2714")} Successfully committed!`)})().catch(l=>{Wt(`${Tt("\u2716")} ${l.message}`),Ut(l),process.exit(1)});const Zl="prepare-commit-msg-hook",Xl=()=>{const e=process.argv.slice(2);return e[0]===Zl?e.slice(1):e},Ql=async()=>{const{stdout:e}=await q("git",["rev-parse","--git-path","COMMIT_EDITMSG"],{reject:!1}),t=e.trim();return t===""?void 0:t},ef=async e=>A.readFile(e,"utf8").catch(t=>{if(t.code==="ENOENT")return"";throw t});var tf=()=>(async()=>{const[e,t]=Xl(),u=e?.trim()||await Ql();if(!u)return;const n=await ef(u);if(t==="message"&&n.trim()!=="")return;const o=await Kn();if(!o)return;const r=await Xt({}),i={messageInstructionsMarkdown:r.messageInstructionsMarkdown,reasoningEffort:r["reasoning-effort"],requestOptionsJson:r["request-options"],apiMode:r["api-mode"],contextWindowTokens:r["context-window"],changedFiles:o.files},s=await Mr(r["api-key"],r.model,o.diff,r.generate,r.timeout,r.proxy,i,r["base-url"]);if(s.length===0)return;const c=s[0]?.trim();if(!c)return;let f=c;try{f=await Or(c,r.postResponseScriptPath,{candidateCount:1,candidateIndex:0,commitSource:"hook",configDirectoryPath:r.configDirectoryPath,cwd:process.cwd(),messageFilePath:r.messageFilePath})}catch{}const l=`${f}
142
+ `;await A.writeFile(u,l),process.stdout.write(l)})().catch(()=>{});const uf=e=>{const t=e.indexOf("=");if(t<=0)throw new h(`Invalid config assignment: "${e}". Use <key>=<value>.`);return[e.slice(0,t),e.slice(t+1)]};var nf=zu({name:"config",parameters:["<mode>","<key=value...>"]},e=>{(async()=>{const{mode:t,keyValue:u}=e._;if(t==="get"){const n=await Xt({},!0);for(const D of u){const o=cr(D);o&&ur(n,o)&&console.log(`${o}=${n[o]}`)}return}if(t==="set"){await Ic(u.map(uf));return}throw new h(`Invalid mode: ${t}`)})().catch(t=>{console.error(`${Tt("\u2716")} ${t.message}`),Ut(t),process.exit(1)})});const rf=e=>A.lstat(e).then(()=>!0,()=>!1),Fu="prepare-commit-msg",Df="prepare-commit-msg-hook",of=`/hooks/${Fu}`,_r=new URL(import.meta.url.endsWith(".ts")?"../cli.ts":"../cli.mjs",import.meta.url),jr=bu(_r),sf=import.meta.url.endsWith(".ts")?new URL("../../node_modules/tsx/dist/cli.mjs",import.meta.url):_r,af=bu(sf),Nr=`
136
143
  #!/usr/bin/env node
137
- process.argv.splice(2, 0, ${JSON.stringify(Pl)});
138
- ${import.meta.url.endsWith(".ts")?`process.argv.splice(2, 0, ${JSON.stringify(OD)});`:""}
139
- import(${JSON.stringify(YD(jl))})
140
- `.trim(),Nl=(process.argv[1]||"").replace(/\\/g,"/").endsWith(Rl),MD=async e=>await $.readFile(e,"utf8").catch(()=>{})===ID,kD=async e=>await $.realpath(e).catch(()=>{})===OD;var Ll=Nu({name:"hook",parameters:["<install/uninstall>"]},e=>{(async()=>{const t=await Ln(),{installUninstall:u}=e._,n=await ma("hooks",t),r=N.join(n,cu),o=await Tl(r);if(u==="install"){if(o){if(await MD(r)){console.warn("The hook is already installed");return}if(await kD(r))await $.rm(r);else throw new m(`A different ${cu} hook seems to be installed. Please remove it before installing aicommits.`)}await $.mkdir(N.dirname(r),{recursive:!0}),await $.writeFile(r,ID),await $.chmod(r,493),console.log(`${Ge("\u2714")} Hook installed`);return}if(u==="uninstall"){if(!o){console.warn("Hook is not installed");return}if(!(await MD(r)||await kD(r))){console.warn("Hook is not installed");return}await $.rm(r),console.log(`${Ge("\u2714")} Hook uninstalled`);return}throw new m(`Invalid mode: ${u}`)})().catch(t=>{console.error(`${St("\u2716")} ${t.message}`),Gt(t),process.exit(1)})});const Gl=_n(),Xe=process.argv.slice(2),zl=Xe[0]==="prepare-commit-msg-hook",Wl=[{flag:"--type",matches:["--type","-t"]},{flag:"--details",matches:["--details"]},{flag:"--details-style",matches:["--details-style"]},{flag:"--instructions",matches:["--instructions"]},{flag:"--conventional-format",matches:["--conventional-format"]},{flag:"--conventional-types",matches:["--conventional-types"]},{flag:"--conventional-scope",matches:["--conventional-scope"]}];Co({name:"aicommits",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},type:{type:String,description:"Git commit message format (default: plain). Supports conventional",alias:"t"},details:{type:Boolean,description:"Generate commit message details/body in addition to the title"},showReasoning:{type:Boolean,description:"Stream and print model reasoning while generating messages"},reasoningEffort:{type:String,description:"Reasoning effort to request: none, low, medium, high, or xhigh"},apiMode:{type:String,description:"API mode to use: responses (default) or chat"},messageFile:{type:String,description:"Markdown file used to guide commit message generation"},postResponseScript:{type:String,description:"Executable script that can rewrite the AI response via stdin/stdout"},baseUrl:{type:String,description:"API base URL for Responses API (default) or Chat Completions (for example https://api.openai.com/v1)"},confirm:{type:Boolean,description:"Skip interactive confirmation/selection prompts and use the first generated message",alias:"y",default:!1},yes:{type:Boolean,description:"Alias for --confirm",default:!1},version:{type:Boolean,description:"Show version number",alias:"v"}},commands:[kl,Ll],help:{description:ho},ignoreArgv:e=>e==="unknown-flag"||e==="argument"},e=>{if(e.flags.type!==void 0)throw new m(Wt("--type"));if(e.flags.details!==void 0)throw new m(Wt("--details"));for(const{flag:t,matches:u}of Wl)if(Xe.some(n=>u.some(r=>n===r||n.startsWith(`${r}=`))))throw new m(Wt(t));e.flags.version&&(console.log(Gl),process.exit(0)),Nl||zl?Il():vl(e.flags.generate,e.flags.exclude,e.flags.all,e.flags.showReasoning,e.flags.reasoningEffort,e.flags.apiMode,e.flags.messageFile,e.flags.postResponseScript,e.flags.baseUrl,e.flags.confirm||e.flags.yes,Xe)},Xe);
144
+ process.argv.splice(2, 0, ${JSON.stringify(Df)});
145
+ ${import.meta.url.endsWith(".ts")?`process.argv.splice(2, 0, ${JSON.stringify(jr)});`:""}
146
+ import(${JSON.stringify(oD(af))})
147
+ `.trim(),cf=(process.argv[1]||"").replace(/\\/g,"/").endsWith(of),Lr=async e=>await A.readFile(e,"utf8").catch(()=>{})===Nr,Gr=async e=>await A.realpath(e).catch(()=>{})===jr;var lf=zu({name:"hook",parameters:["<install/uninstall>"]},e=>{(async()=>{const t=await zn(),{installUninstall:u}=e._,n=await Oa("hooks",t),D=N.join(n,Fu),o=await rf(D);if(u==="install"){if(o){if(await Lr(D)){console.warn("The hook is already installed");return}if(await Gr(D))await A.rm(D);else throw new h(`A different ${Fu} hook seems to be installed. Please remove it before installing aicommits.`)}await A.mkdir(N.dirname(D),{recursive:!0}),await A.writeFile(D,Nr),await A.chmod(D,493),console.log(`${qe("\u2714")} Hook installed`);return}if(u==="uninstall"){if(!o){console.warn("Hook is not installed");return}if(!(await Lr(D)||await Gr(D))){console.warn("Hook is not installed");return}await A.rm(D),console.log(`${qe("\u2714")} Hook uninstalled`);return}throw new h(`Invalid mode: ${u}`)})().catch(t=>{console.error(`${Tt("\u2716")} ${t.message}`),Ut(t),process.exit(1)})});const ff=Ln(),nt=process.argv.slice(2),df=nt[0]==="prepare-commit-msg-hook",Ff=[{flag:"--type",matches:["--type","-t"]},{flag:"--details",matches:["--details"]},{flag:"--details-style",matches:["--details-style"]},{flag:"--instructions",matches:["--instructions"]},{flag:"--conventional-format",matches:["--conventional-format"]},{flag:"--conventional-types",matches:["--conventional-types"]},{flag:"--conventional-scope",matches:["--conventional-scope"]}];Ao({name:"aicommits",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},type:{type:String,description:"Git commit message format (default: plain). Supports conventional",alias:"t"},details:{type:Boolean,description:"Generate commit message details/body in addition to the title"},showReasoning:{type:Boolean,description:"Stream and print model reasoning while generating messages"},reasoningEffort:{type:String,description:"Reasoning effort to request: none, low, medium, high, or xhigh"},apiMode:{type:String,description:"API mode to use: responses (default) or chat"},messageFile:{type:String,description:"Markdown file used to guide commit message generation"},postResponseScript:{type:String,description:"Executable script that can rewrite the AI response via stdin/stdout"},baseUrl:{type:String,description:"API base URL for Responses API (default) or Chat Completions (for example https://api.openai.com/v1)"},confirm:{type:Boolean,description:"Skip interactive confirmation/selection prompts and use the first generated message",alias:"y",default:!1},yes:{type:Boolean,description:"Alias for --confirm",default:!1},version:{type:Boolean,description:"Show version number",alias:"v"}},commands:[nf,lf],help:{description:xo},ignoreArgv:e=>e==="unknown-flag"||e==="argument"},e=>{if(e.flags.type!==void 0)throw new h(Ht("--type"));if(e.flags.details!==void 0)throw new h(Ht("--details"));for(const{flag:t,matches:u}of Ff)if(nt.some(n=>u.some(D=>n===D||n.startsWith(`${D}=`))))throw new h(Ht(t));e.flags.version&&(console.log(ff),process.exit(0)),cf||df?tf():Yl(e.flags.generate,e.flags.exclude,e.flags.all,e.flags.showReasoning,e.flags.reasoningEffort,e.flags.apiMode,e.flags.messageFile,e.flags.postResponseScript,e.flags.baseUrl,e.flags.confirm||e.flags.yes,nt)},nt);