mmx-cli 1.0.10 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mmx.mjs +223 -211
- package/package.json +1 -1
package/dist/mmx.mjs
CHANGED
|
@@ -1,267 +1,279 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as
|
|
2
|
+
import{createRequire as Bi}from"node:module";var vi=Object.create;var{getPrototypeOf:li,defineProperty:Kt,getOwnPropertyNames:Ri}=Object;var ki=Object.prototype.hasOwnProperty;function Si(t){return this[t]}var Mi,Ai,lt=(t,e,i)=>{var r=t!=null&&typeof t==="object";if(r){var o=e?Mi??=new WeakMap:Ai??=new WeakMap,$=o.get(t);if($)return $}i=t!=null?vi(li(t)):{};let n=e||!t||!t.__esModule?Kt(i,"default",{value:t,enumerable:!0}):i;for(let m of Ri(t))if(!ki.call(n,m))Kt(n,m,{get:Si.bind(t,m),enumerable:!0});if(r)o.set(t,n);return n};var Ae=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ji=(t)=>t;function Gi(t,e){this[t]=ji.bind(null,e)}var je=(t,e)=>{for(var i in e)Kt(t,i,{get:e[i],enumerable:!0,configurable:!0,set:Gi.bind(e,i)})};var Ht=(t,e)=>()=>(t&&(e=t(t=0)),e);var $t=Bi(import.meta.url);var gt=Ae((em,De)=>{var Ft={to(t,e){if(!e)return`\x1B[${t+1}G`;return`\x1B[${e+1};${t+1}H`},move(t,e){let i="";if(t<0)i+=`\x1B[${-t}D`;else if(t>0)i+=`\x1B[${t}C`;if(e<0)i+=`\x1B[${-e}A`;else if(e>0)i+=`\x1B[${e}B`;return i},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},rr={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},or={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let e="";for(let i=0;i<t;i++)e+=this.line+(i<t-1?Ft.up():"");if(t)e+=Ft.left;return e}};De.exports={cursor:Ft,scroll:rr,erase:or,beep:"\x07"}});var te=Ae((nm,Dt)=>{var Nt=process||{},tn=Nt.argv||[],qt=Nt.env||{},$r=!(!!qt.NO_COLOR||tn.includes("--no-color"))&&(!!qt.FORCE_COLOR||tn.includes("--color")||Nt.platform==="win32"||(Nt.stdout||{}).isTTY&&qt.TERM!=="dumb"||!!qt.CI),mr=(t,e,i=t)=>(r)=>{let o=""+r,$=o.indexOf(e,t.length);return~$?t+pr(o,e,i,$)+e:t+o+e},pr=(t,e,i,r)=>{let o="",$=0;do o+=t.substring($,r)+i,$=r+e.length,r=t.indexOf(e,$);while(~r);return o+t.substring($)},en=(t=$r)=>{let e=t?mr:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};Dt.exports=en();Dt.exports.createColors=en});import{stdin as hn,stdout as bn}from"node:process";import*as F from"node:readline";import nn from"node:readline";import{WriteStream as sr}from"node:tty";function cr({onlyFirst:t=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}function vn(t){if(typeof t!="string")throw TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(ur,"")}function ln(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function _t(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=vn(t),t.length===0))return 0;t=t.replace(_r()," ");let i=e.ambiguousIsNarrow?1:2,r=0;for(let o of t){let $=o.codePointAt(0);if($<=31||$>=127&&$<=159||$>=768&&$<=879)continue;switch(xr.eastAsianWidth(o)){case"F":case"W":r+=2;break;case"A":r+=i;break;default:r+=1}}return r}function vr(){let t=new Map;for(let[e,i]of Object.entries(T)){for(let[r,o]of Object.entries(i))T[r]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},i[r]=T[r],t.set(o[0],o[1]);Object.defineProperty(T,e,{value:i,enumerable:!1})}return Object.defineProperty(T,"codes",{value:t,enumerable:!1}),T.color.close="\x1B[39m",T.bgColor.close="\x1B[49m",T.color.ansi=rn(),T.color.ansi256=on(),T.color.ansi16m=$n(),T.bgColor.ansi=rn(ee),T.bgColor.ansi256=on(ee),T.bgColor.ansi16m=$n(ee),Object.defineProperties(T,{rgbToAnsi256:{value:(e,i,r)=>e===i&&i===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(i/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value:(e)=>{let i=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!i)return[0,0,0];let[r]=i;r.length===3&&(r=[...r].map(($)=>$+$).join(""));let o=Number.parseInt(r,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:(e)=>T.rgbToAnsi256(...T.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:(e)=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let i,r,o;if(e>=232)i=((e-232)*10+8)/255,r=i,o=i;else{e-=16;let m=e%36;i=Math.floor(e/36)/5,r=Math.floor(m/6)/5,o=m%6/5}let $=Math.max(i,r,o)*2;if($===0)return 30;let n=30+(Math.round(o)<<2|Math.round(r)<<1|Math.round(i));return $===2&&(n+=60),n},enumerable:!1},rgbToAnsi:{value:(e,i,r)=>T.ansi256ToAnsi(T.rgbToAnsi256(e,i,r)),enumerable:!1},hexToAnsi:{value:(e)=>T.ansi256ToAnsi(T.hexToAnsi256(e)),enumerable:!1}}),T}function sn(t,e,i){return String(t).normalize().replace(/\r\n/g,`
|
|
3
3
|
`).split(`
|
|
4
|
-
`).map((r)=>
|
|
5
|
-
`)}function
|
|
6
|
-
`),r=
|
|
7
|
-
`),o=[];for(let
|
|
8
|
-
`),
|
|
9
|
-
`).length-1;this.output.write(
|
|
10
|
-
`);this.output.write(r[
|
|
11
|
-
`).slice(
|
|
12
|
-
`)),this._prevFrame=e;return}this.output.write(G.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}}function vi({input:e=li,output:t=$i,overwrite:n=!0,hideCursor:r=!0}={}){let o=P.createInterface({input:e,output:t,prompt:"",tabSize:1});P.emitKeypressEvents(e,o),e.isTTY&&e.setRawMode(!0);let s=(i,{name:m})=>{if(String(i)==="\x03"){r&&t.write(G.cursor.show),process.exit(0);return}if(!n)return;P.moveCursor(t,m==="return"?0:-1,m==="return"?-1:0,()=>{P.clearLine(t,1,()=>{e.once("keypress",s)})})};return r&&t.write(G.cursor.hide),e.once("keypress",s),()=>{e.off("keypress",s),r&&t.write(G.cursor.show),e.isTTY&&!Xr&&e.setRawMode(!1),o.terminal=!1,o.close()}}var G,te,pr,xi,ar,ur,cr=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},lr,tt=10,ei=(e=0)=>(t)=>`\x1B[${t+e}m`,ti=(e=0)=>(t)=>`\x1B[${38+e};5;${t}m`,ii=(e=0)=>(t,n,r)=>`\x1B[${38+e};2;${t};${n};${r}m`,A,$r,dr,xr,Oe,yr=39,nt="\x07",yi="[",wr="]",wi="m",rt,ni=(e)=>`${Oe.values().next().value}${yi}${e}${wi}`,ri=(e)=>`${Oe.values().next().value}${rt}${e}${nt}`,br=(e)=>e.split(" ").map((t)=>he(t)),it=(e,t,n)=>{let r=[...t],o=!1,s=!1,i=he(di(e[e.length-1]));for(let[m,u]of r.entries()){let a=he(u);if(i+a<=n?e[e.length-1]+=u:(e.push(u),i=0),Oe.has(u)&&(o=!0,s=r.slice(m+1).join("").startsWith(rt)),o){s?u===nt&&(o=!1,s=!1):u===wi&&(o=!1);continue}i+=a,i===n&&m<r.length-1&&(e.push(""),i=0)}!i&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},fr=(e)=>{let t=e.split(" "),n=t.length;for(;n>0&&!(he(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(" ")+t.slice(n).join("")},_r=(e,t,n={})=>{if(n.trim!==!1&&e.trim()==="")return"";let r="",o,s,i=br(e),m=[""];for(let[a,$]of e.split(" ").entries()){n.trim!==!1&&(m[m.length-1]=m[m.length-1].trimStart());let d=he(m[m.length-1]);if(a!==0&&(d>=t&&(n.wordWrap===!1||n.trim===!1)&&(m.push(""),d=0),(d>0||n.trim===!1)&&(m[m.length-1]+=" ",d++)),n.hard&&i[a]>t){let h=t-d,y=1+Math.floor((i[a]-h-1)/t);Math.floor((i[a]-1)/t)<y&&m.push(""),it(m,$,t);continue}if(d+i[a]>t&&d>0&&i[a]>0){if(n.wordWrap===!1&&d<t){it(m,$,t);continue}m.push("")}if(d+i[a]>t&&n.wordWrap===!1){it(m,$,t);continue}m[m.length-1]+=$}n.trim!==!1&&(m=m.map((a)=>fr(a)));let u=[...m.join(`
|
|
13
|
-
`)];for(let[
|
|
14
|
-
`?(
|
|
15
|
-
`&&(o&&d&&(r+=ni(o)),s&&(r+=ri(s)))}return r},vr,Sr=(e,t,n)=>(t in e)?vr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,g=(e,t,n)=>(Sr(e,typeof t!="symbol"?t+"":t,n),n),bi,si,kr,ot,Ar,Mr=(e,t,n)=>(t in e)?Ar(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mi=(e,t,n)=>(Mr(e,typeof t!="symbol"?t+"":t,n),n),st,qr,jr=(e,t,n)=>(t in e)?qr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pi=(e,t,n)=>(jr(e,typeof t!="symbol"?t+"":t,n),n),fi,Tr,Gr=(e,t,n)=>(t in e)?Tr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ai=(e,t,n)=>(Gr(e,typeof t!="symbol"?t+"":t,n),n),mt,Or,Br=(e,t,n)=>(t in e)?Or(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ui=(e,t,n)=>(Br(e,typeof t!="symbol"?t+"":t,n),n),_i,Nr,zr=(e,t,n)=>(t in e)?Nr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ci=(e,t,n)=>(zr(e,typeof t!="symbol"?t+"":t,n),n),pt,gr,Jr=(e,t,n)=>(t in e)?gr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ir=(e,t,n)=>(Jr(e,typeof t!="symbol"?t+"":t,n),n),at,Xr;var ut=Ve(()=>{G=be(Fe(),1),te=be(et(),1);pr=mr();xi={exports:{}};(function(e){var t={};e.exports=t,t.eastAsianWidth=function(r){var o=r.charCodeAt(0),s=r.length==2?r.charCodeAt(1):0,i=o;return 55296<=o&&o<=56319&&56320<=s&&s<=57343&&(o&=1023,s&=1023,i=o<<10|s,i+=65536),i==12288||65281<=i&&i<=65376||65504<=i&&i<=65510?"F":i==8361||65377<=i&&i<=65470||65474<=i&&i<=65479||65482<=i&&i<=65487||65490<=i&&i<=65495||65498<=i&&i<=65500||65512<=i&&i<=65518?"H":4352<=i&&i<=4447||4515<=i&&i<=4519||4602<=i&&i<=4607||9001<=i&&i<=9002||11904<=i&&i<=11929||11931<=i&&i<=12019||12032<=i&&i<=12245||12272<=i&&i<=12283||12289<=i&&i<=12350||12353<=i&&i<=12438||12441<=i&&i<=12543||12549<=i&&i<=12589||12593<=i&&i<=12686||12688<=i&&i<=12730||12736<=i&&i<=12771||12784<=i&&i<=12830||12832<=i&&i<=12871||12880<=i&&i<=13054||13056<=i&&i<=19903||19968<=i&&i<=42124||42128<=i&&i<=42182||43360<=i&&i<=43388||44032<=i&&i<=55203||55216<=i&&i<=55238||55243<=i&&i<=55291||63744<=i&&i<=64255||65040<=i&&i<=65049||65072<=i&&i<=65106||65108<=i&&i<=65126||65128<=i&&i<=65131||110592<=i&&i<=110593||127488<=i&&i<=127490||127504<=i&&i<=127546||127552<=i&&i<=127560||127568<=i&&i<=127569||131072<=i&&i<=194367||177984<=i&&i<=196605||196608<=i&&i<=262141?"W":32<=i&&i<=126||162<=i&&i<=163||165<=i&&i<=166||i==172||i==175||10214<=i&&i<=10221||10629<=i&&i<=10630?"Na":i==161||i==164||167<=i&&i<=168||i==170||173<=i&&i<=174||176<=i&&i<=180||182<=i&&i<=186||188<=i&&i<=191||i==198||i==208||215<=i&&i<=216||222<=i&&i<=225||i==230||232<=i&&i<=234||236<=i&&i<=237||i==240||242<=i&&i<=243||247<=i&&i<=250||i==252||i==254||i==257||i==273||i==275||i==283||294<=i&&i<=295||i==299||305<=i&&i<=307||i==312||319<=i&&i<=322||i==324||328<=i&&i<=331||i==333||338<=i&&i<=339||358<=i&&i<=359||i==363||i==462||i==464||i==466||i==468||i==470||i==472||i==474||i==476||i==593||i==609||i==708||i==711||713<=i&&i<=715||i==717||i==720||728<=i&&i<=731||i==733||i==735||768<=i&&i<=879||913<=i&&i<=929||931<=i&&i<=937||945<=i&&i<=961||963<=i&&i<=969||i==1025||1040<=i&&i<=1103||i==1105||i==8208||8211<=i&&i<=8214||8216<=i&&i<=8217||8220<=i&&i<=8221||8224<=i&&i<=8226||8228<=i&&i<=8231||i==8240||8242<=i&&i<=8243||i==8245||i==8251||i==8254||i==8308||i==8319||8321<=i&&i<=8324||i==8364||i==8451||i==8453||i==8457||i==8467||i==8470||8481<=i&&i<=8482||i==8486||i==8491||8531<=i&&i<=8532||8539<=i&&i<=8542||8544<=i&&i<=8555||8560<=i&&i<=8569||i==8585||8592<=i&&i<=8601||8632<=i&&i<=8633||i==8658||i==8660||i==8679||i==8704||8706<=i&&i<=8707||8711<=i&&i<=8712||i==8715||i==8719||i==8721||i==8725||i==8730||8733<=i&&i<=8736||i==8739||i==8741||8743<=i&&i<=8748||i==8750||8756<=i&&i<=8759||8764<=i&&i<=8765||i==8776||i==8780||i==8786||8800<=i&&i<=8801||8804<=i&&i<=8807||8810<=i&&i<=8811||8814<=i&&i<=8815||8834<=i&&i<=8835||8838<=i&&i<=8839||i==8853||i==8857||i==8869||i==8895||i==8978||9312<=i&&i<=9449||9451<=i&&i<=9547||9552<=i&&i<=9587||9600<=i&&i<=9615||9618<=i&&i<=9621||9632<=i&&i<=9633||9635<=i&&i<=9641||9650<=i&&i<=9651||9654<=i&&i<=9655||9660<=i&&i<=9661||9664<=i&&i<=9665||9670<=i&&i<=9672||i==9675||9678<=i&&i<=9681||9698<=i&&i<=9701||i==9711||9733<=i&&i<=9734||i==9737||9742<=i&&i<=9743||9748<=i&&i<=9749||i==9756||i==9758||i==9792||i==9794||9824<=i&&i<=9825||9827<=i&&i<=9829||9831<=i&&i<=9834||9836<=i&&i<=9837||i==9839||9886<=i&&i<=9887||9918<=i&&i<=9919||9924<=i&&i<=9933||9935<=i&&i<=9953||i==9955||9960<=i&&i<=9983||i==10045||i==10071||10102<=i&&i<=10111||11093<=i&&i<=11097||12872<=i&&i<=12879||57344<=i&&i<=63743||65024<=i&&i<=65039||i==65533||127232<=i&&i<=127242||127248<=i&&i<=127277||127280<=i&&i<=127337||127344<=i&&i<=127386||917760<=i&&i<=917999||983040<=i&&i<=1048573||1048576<=i&&i<=1114109?"A":"N"},t.characterLength=function(r){var o=this.eastAsianWidth(r);return o=="F"||o=="W"||o=="A"?2:1};function n(r){return r.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(r){for(var o=n(r),s=0,i=0;i<o.length;i++)s=s+this.characterLength(o[i]);return s},t.slice=function(r,o,s){textLen=t.length(r),o=o||0,s=s||1,o<0&&(o=textLen+o),s<0&&(s=textLen+s);for(var i="",m=0,u=n(r),a=0;a<u.length;a++){var $=u[a],d=t.length($);if(m>=o-(d==2?1:0))if(m+d<=s)i+=$;else break;m+=d}return i}})(xi);ar=xi.exports,ur=hi(ar),lr=hi(cr);A={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(A.modifier);$r=Object.keys(A.color),dr=Object.keys(A.bgColor);[...$r,...dr];xr=hr(),Oe=new Set(["\x1B",""]),rt=`${wr}8;;`;vr=Object.defineProperty;bi=Symbol("clack:cancel");si=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),kr=new Set(["up","down","left","right","space","enter"]);ot=class ot extends C{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(t)=>{this.output.write(G.cursor.move(0,-1)),this.value=t,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};Ar=Object.defineProperty;st=class st extends C{constructor(e){super(e,!1),mi(this,"options"),mi(this,"cursor",0);let{options:t}=e;this.options=Object.entries(t).flatMap(([n,r])=>[{value:n,group:!0,label:n},...r.map((o)=>({...o,group:n}))]),this.value=[...e.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:n})=>n===e.cursorAt),0),this.on("cursor",(n)=>{switch(n){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}getGroupItems(e){return this.options.filter((t)=>t.group===e)}isGroupSelected(e){return this.getGroupItems(e).every((t)=>this.value.includes(t.value))}toggleValue(){let e=this.options[this.cursor];if(e.group===!0){let t=e.value,n=this.getGroupItems(t);this.isGroupSelected(t)?this.value=this.value.filter((r)=>n.findIndex((o)=>o.value===r)===-1):this.value=[...this.value,...n.map((r)=>r.value)],this.value=Array.from(new Set(this.value))}else{let t=this.value.includes(e.value);this.value=t?this.value.filter((n)=>n!==e.value):[...this.value,e.value]}}};qr=Object.defineProperty,fi=class extends C{constructor(e){super(e,!1),pi(this,"options"),pi(this,"cursor",0),this.options=e.options,this.value=[...e.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:t})=>t===e.cursorAt),0),this.on("key",(t)=>{t==="a"&&this.toggleAll()}),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;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let e=this.value.length===this.options.length;this.value=e?[]:this.options.map((t)=>t.value)}toggleValue(){let e=this.value.includes(this._value);this.value=e?this.value.filter((t)=>t!==this._value):[...this.value,this._value]}},Tr=Object.defineProperty;mt=class mt extends C{constructor({mask:e,...t}){super(t),ai(this,"valueWithCursor",""),ai(this,"_mask","•"),this._mask=e??"•",this.on("finalize",()=>{this.valueWithCursor=this.masked}),this.on("value",()=>{if(this.cursor>=this.value.length)this.valueWithCursor=`${this.masked}${te.default.inverse(te.default.hidden("_"))}`;else{let n=this.masked.slice(0,this.cursor),r=this.masked.slice(this.cursor);this.valueWithCursor=`${n}${te.default.inverse(r[0])}${r.slice(1)}`}})}get cursor(){return this._cursor}get masked(){return this.value.replaceAll(/./g,this._mask)}};Or=Object.defineProperty,_i=class extends C{constructor(e){super(e,!1),ui(this,"options"),ui(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}},Nr=Object.defineProperty;pt=class pt extends C{constructor(e){super(e,!1),ci(this,"options"),ci(this,"cursor",0),this.options=e.options;let t=this.options.map(({value:[n]})=>n?.toLowerCase());this.cursor=Math.max(t.indexOf(e.initialValue),0),this.on("key",(n)=>{if(!t.includes(n))return;let r=this.options.find(({value:[o]})=>o?.toLowerCase()===n);r&&(this.value=r.value,this.state="submit",this.emit("submit"))})}};gr=Object.defineProperty;at=class at extends C{constructor(e){super(e),Ir(this,"valueWithCursor",""),this.on("finalize",()=>{this.value||(this.value=e.defaultValue),this.valueWithCursor=this.value}),this.on("value",()=>{if(this.cursor>=this.value.length)this.valueWithCursor=`${this.value}${te.default.inverse(te.default.hidden("_"))}`;else{let t=this.value.slice(0,this.cursor),n=this.value.slice(this.cursor);this.valueWithCursor=`${t}${te.default.inverse(n[0])}${n.slice(1)}`}})}get cursor(){return this._cursor}};Xr=globalThis.process.platform.startsWith("win")});var ze={};St(ze,{text:()=>Lr,spinner:()=>po,selectKey:()=>to,select:()=>eo,password:()=>Fr,outro:()=>mo,note:()=>ro,multiselect:()=>io,log:()=>ie,isCancel:()=>Be,intro:()=>so,groupMultiselect:()=>no,group:()=>uo,confirm:()=>Dr,cancel:()=>oo});import Y from"node:process";function Yr(){return Y.platform!=="win32"?Y.env.TERM!=="linux":Boolean(Y.env.CI)||Boolean(Y.env.WT_SESSION)||Boolean(Y.env.TERMINUS_SUBLIME)||Y.env.ConEmuTask==="{cmd::Cmder}"||Y.env.TERM_PROGRAM==="Terminus-Sublime"||Y.env.TERM_PROGRAM==="vscode"||Y.env.TERM==="xterm-256color"||Y.env.TERM==="alacritty"||Y.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}function ao(){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,"g")}var p,ae,lt,M=(e,t)=>lt?e:t,Qr,Ri,ki,Ne,Vr,x,N,$t,dt,ht,xe,Ai,Zr,Si,Wr,Ur,Hr,Kr,Pr,Cr,Er,ne=(e)=>{switch(e){case"initial":case"active":return p.default.cyan(Qr);case"cancel":return p.default.red(Ri);case"error":return p.default.yellow(ki);case"submit":return p.default.green(Ne)}},Lr=(e)=>new at({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,render(){let t=`${p.default.gray(x)}
|
|
16
|
-
${
|
|
17
|
-
`,
|
|
18
|
-
${p.default.yellow(
|
|
19
|
-
${p.default.yellow(
|
|
20
|
-
`;case"submit":return`${
|
|
21
|
-
`+p.default.gray(
|
|
22
|
-
${p.default.cyan(
|
|
23
|
-
`}}}).prompt(),
|
|
24
|
-
${
|
|
25
|
-
`,
|
|
26
|
-
${p.default.yellow(
|
|
27
|
-
${p.default.yellow(
|
|
28
|
-
`;case"submit":return`${
|
|
29
|
-
`+p.default.gray(
|
|
30
|
-
${p.default.cyan(
|
|
31
|
-
`}}}).prompt(),
|
|
32
|
-
${
|
|
33
|
-
`,o=this.value?
|
|
34
|
-
${p.default.gray(
|
|
35
|
-
${p.default.cyan(
|
|
36
|
-
`}}}).prompt()},
|
|
37
|
-
${
|
|
38
|
-
`;switch(this.state){case"submit":return`${r}${p.default.gray(
|
|
39
|
-
${p.default.gray(
|
|
40
|
-
${p.default.cyan(
|
|
41
|
-
${p.default.cyan(
|
|
42
|
-
`}}}}).prompt()},
|
|
43
|
-
${
|
|
44
|
-
`;switch(this.state){case"submit":return`${
|
|
45
|
-
${p.default.gray(
|
|
46
|
-
${p.default.cyan(
|
|
47
|
-
${p.default.cyan(
|
|
48
|
-
`}}}).prompt()},
|
|
49
|
-
${p.default.reset(p.default.dim(`Press ${p.default.gray(p.default.bgWhite(p.default.inverse(" space ")))} to select, ${p.default.gray(p.default.bgWhite(p.default.inverse(" enter ")))} to submit`))}`},render(){let
|
|
50
|
-
${
|
|
51
|
-
`;switch(this.state){case"submit":return`${
|
|
52
|
-
${p.default.gray(
|
|
53
|
-
`).map((o
|
|
54
|
-
`);return
|
|
55
|
-
${p.default.yellow(
|
|
4
|
+
`).map((r)=>Ar(r,e,i)).join(`
|
|
5
|
+
`)}function Br(t,e){if(t===e)return;let i=t.split(`
|
|
6
|
+
`),r=e.split(`
|
|
7
|
+
`),o=[];for(let $=0;$<Math.max(i.length,r.length);$++)i[$]!==r[$]&&o.push($);return o}function Qt(t){return t===Mn}function Jt(t,e){t.isTTY&&t.setRawMode(e)}class g{constructor({render:t,input:e=hn,output:i=bn,...r},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=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=e,this.output=i}prompt(){let t=new sr(0);return t._write=(e,i,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=nn.createInterface({input:this.input,output:t,tabSize:2,prompt:"",escapeCodeTimeout:50}),nn.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),Jt(this.input,!0),this.output.on("resize",this.render),this.render(),new Promise((e,i)=>{this.once("submit",()=>{this.output.write(X.cursor.show),this.output.off("resize",this.render),Jt(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(X.cursor.show),this.output.off("resize",this.render),Jt(this.input,!1),e(Mn)})})}on(t,e){let i=this.subscribers.get(t)??[];i.push({cb:e}),this.subscribers.set(t,i)}once(t,e){let i=this.subscribers.get(t)??[];i.push({cb:e,once:!0}),this.subscribers.set(t,i)}emit(t,...e){let i=this.subscribers.get(t)??[],r=[];for(let o of i)o.cb(...e),o.once&&r.push(()=>i.splice(i.indexOf(o),1));for(let o of r)o()}unsubscribe(){this.subscribers.clear()}onKeypress(t,e){if(this.state==="error"&&(this.state="active"),e?.name&&!this._track&&cn.has(e.name)&&this.emit("cursor",cn.get(e.name)),e?.name&&Tr.has(e.name)&&this.emit("cursor",e.name),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),t==="\t"&&this.opts.placeholder&&(this.value||(this.rl.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),t&&this.emit("key",t.toLowerCase()),e?.name==="return"){if(this.opts.validate){let i=this.opts.validate(this.value);i&&(this.error=i,this.state="error",this.rl.write(this.value))}this.state!=="error"&&(this.state="submit")}t==="\x03"&&(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(`
|
|
8
|
+
`),Jt(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let t=sn(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
9
|
+
`).length-1;this.output.write(X.cursor.move(-999,t*-1))}render(){let t=sn(this._render(this)??"",process.stdout.columns,{hard:!0});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(X.cursor.hide);else{let e=Br(this._prevFrame,t);if(this.restoreCursor(),e&&e?.length===1){let i=e[0];this.output.write(X.cursor.move(0,i)),this.output.write(X.erase.lines(1));let r=t.split(`
|
|
10
|
+
`);this.output.write(r[i]),this._prevFrame=t,this.output.write(X.cursor.move(0,r.length-i-1));return}else if(e&&e?.length>1){let i=e[0];this.output.write(X.cursor.move(0,i)),this.output.write(X.erase.down());let r=t.split(`
|
|
11
|
+
`).slice(i);this.output.write(r.join(`
|
|
12
|
+
`)),this._prevFrame=t;return}this.output.write(X.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}function Gn({input:t=hn,output:e=bn,overwrite:i=!0,hideCursor:r=!0}={}){let o=F.createInterface({input:t,output:e,prompt:"",tabSize:1});F.emitKeypressEvents(t,o),t.isTTY&&t.setRawMode(!0);let $=(n,{name:m})=>{if(String(n)==="\x03"){r&&e.write(X.cursor.show),process.exit(0);return}if(!i)return;F.moveCursor(e,m==="return"?0:-1,m==="return"?-1:0,()=>{F.clearLine(e,1,()=>{t.once("keypress",$)})})};return r&&e.write(X.cursor.hide),t.once("keypress",$),()=>{t.off("keypress",$),r&&e.write(X.cursor.show),t.isTTY&&!Hr&&t.setRawMode(!1),o.terminal=!1,o.close()}}var X,et,ur,Rn,yr,xr,wr=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},_r,ee=10,rn=(t=0)=>(e)=>`\x1B[${e+t}m`,on=(t=0)=>(e)=>`\x1B[${38+t};5;${e}m`,$n=(t=0)=>(e,i,r)=>`\x1B[${38+t};2;${e};${i};${r}m`,T,hr,br,lr,Xt,Rr=39,ie="\x07",kn="[",kr="]",Sn="m",re,mn=(t)=>`${Xt.values().next().value}${kn}${t}${Sn}`,pn=(t)=>`${Xt.values().next().value}${re}${t}${ie}`,Sr=(t)=>t.split(" ").map((e)=>_t(e)),ne=(t,e,i)=>{let r=[...e],o=!1,$=!1,n=_t(vn(t[t.length-1]));for(let[m,s]of r.entries()){let c=_t(s);if(n+c<=i?t[t.length-1]+=s:(t.push(s),n=0),Xt.has(s)&&(o=!0,$=r.slice(m+1).join("").startsWith(re)),o){$?s===ie&&(o=!1,$=!1):s===Sn&&(o=!1);continue}n+=c,n===i&&m<r.length-1&&(t.push(""),n=0)}!n&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},Mr=(t)=>{let e=t.split(" "),i=e.length;for(;i>0&&!(_t(e[i-1])>0);)i--;return i===e.length?t:e.slice(0,i).join(" ")+e.slice(i).join("")},Ar=(t,e,i={})=>{if(i.trim!==!1&&t.trim()==="")return"";let r="",o,$,n=Sr(t),m=[""];for(let[c,x]of t.split(" ").entries()){i.trim!==!1&&(m[m.length-1]=m[m.length-1].trimStart());let w=_t(m[m.length-1]);if(c!==0&&(w>=e&&(i.wordWrap===!1||i.trim===!1)&&(m.push(""),w=0),(w>0||i.trim===!1)&&(m[m.length-1]+=" ",w++)),i.hard&&n[c]>e){let h=e-w,_=1+Math.floor((n[c]-h-1)/e);Math.floor((n[c]-1)/e)<_&&m.push(""),ne(m,x,e);continue}if(w+n[c]>e&&w>0&&n[c]>0){if(i.wordWrap===!1&&w<e){ne(m,x,e);continue}m.push("")}if(w+n[c]>e&&i.wordWrap===!1){ne(m,x,e);continue}m[m.length-1]+=x}i.trim!==!1&&(m=m.map((c)=>Mr(c)));let s=[...m.join(`
|
|
13
|
+
`)];for(let[c,x]of s.entries()){if(r+=x,Xt.has(x)){let{groups:h}=new RegExp(`(?:\\${kn}(?<code>\\d+)m|\\${re}(?<uri>.*)${ie})`).exec(s.slice(c).join(""))||{groups:{}};if(h.code!==void 0){let _=Number.parseFloat(h.code);o=_===Rr?void 0:_}else h.uri!==void 0&&($=h.uri.length===0?void 0:h.uri)}let w=lr.codes.get(Number(o));s[c+1]===`
|
|
14
|
+
`?($&&(r+=pn("")),o&&w&&(r+=mn(w))):x===`
|
|
15
|
+
`&&(o&&w&&(r+=mn(o)),$&&(r+=pn($)))}return r},jr,Gr=(t,e,i)=>(e in t)?jr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,z=(t,e,i)=>(Gr(t,typeof e!="symbol"?e+"":e,i),i),Mn,cn,Tr,oe,qr,Nr=(t,e,i)=>(e in t)?qr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,un=(t,e,i)=>(Nr(t,typeof e!="symbol"?e+"":e,i),i),$e,Jr,Xr=(t,e,i)=>(e in t)?Jr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,yn=(t,e,i)=>(Xr(t,typeof e!="symbol"?e+"":e,i),i),An,Qr,Or=(t,e,i)=>(e in t)?Qr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,xn=(t,e,i)=>(Or(t,typeof e!="symbol"?e+"":e,i),i),me,Yr,Vr=(t,e,i)=>(e in t)?Yr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,wn=(t,e,i)=>(Vr(t,typeof e!="symbol"?e+"":e,i),i),jn,Zr,zr=(t,e,i)=>(e in t)?Zr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,_n=(t,e,i)=>(zr(t,typeof e!="symbol"?e+"":e,i),i),pe,dr,Wr=(t,e,i)=>(e in t)?dr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Kr=(t,e,i)=>(Wr(t,typeof e!="symbol"?e+"":e,i),i),se,Hr;var ce=Ht(()=>{X=lt(gt(),1),et=lt(te(),1);ur=cr();Rn={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(r){var o=r.charCodeAt(0),$=r.length==2?r.charCodeAt(1):0,n=o;return 55296<=o&&o<=56319&&56320<=$&&$<=57343&&(o&=1023,$&=1023,n=o<<10|$,n+=65536),n==12288||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":n==8361||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||n==172||n==175||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":n==161||n==164||167<=n&&n<=168||n==170||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||n==198||n==208||215<=n&&n<=216||222<=n&&n<=225||n==230||232<=n&&n<=234||236<=n&&n<=237||n==240||242<=n&&n<=243||247<=n&&n<=250||n==252||n==254||n==257||n==273||n==275||n==283||294<=n&&n<=295||n==299||305<=n&&n<=307||n==312||319<=n&&n<=322||n==324||328<=n&&n<=331||n==333||338<=n&&n<=339||358<=n&&n<=359||n==363||n==462||n==464||n==466||n==468||n==470||n==472||n==474||n==476||n==593||n==609||n==708||n==711||713<=n&&n<=715||n==717||n==720||728<=n&&n<=731||n==733||n==735||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||n==1025||1040<=n&&n<=1103||n==1105||n==8208||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||n==8240||8242<=n&&n<=8243||n==8245||n==8251||n==8254||n==8308||n==8319||8321<=n&&n<=8324||n==8364||n==8451||n==8453||n==8457||n==8467||n==8470||8481<=n&&n<=8482||n==8486||n==8491||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||n==8585||8592<=n&&n<=8601||8632<=n&&n<=8633||n==8658||n==8660||n==8679||n==8704||8706<=n&&n<=8707||8711<=n&&n<=8712||n==8715||n==8719||n==8721||n==8725||n==8730||8733<=n&&n<=8736||n==8739||n==8741||8743<=n&&n<=8748||n==8750||8756<=n&&n<=8759||8764<=n&&n<=8765||n==8776||n==8780||n==8786||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||n==8853||n==8857||n==8869||n==8895||n==8978||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||n==9675||9678<=n&&n<=9681||9698<=n&&n<=9701||n==9711||9733<=n&&n<=9734||n==9737||9742<=n&&n<=9743||9748<=n&&n<=9749||n==9756||n==9758||n==9792||n==9794||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||n==9839||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||n==9955||9960<=n&&n<=9983||n==10045||n==10071||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||n==65533||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"},e.characterLength=function(r){var o=this.eastAsianWidth(r);return o=="F"||o=="W"||o=="A"?2:1};function i(r){return r.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(r){for(var o=i(r),$=0,n=0;n<o.length;n++)$=$+this.characterLength(o[n]);return $},e.slice=function(r,o,$){textLen=e.length(r),o=o||0,$=$||1,o<0&&(o=textLen+o),$<0&&($=textLen+$);for(var n="",m=0,s=i(r),c=0;c<s.length;c++){var x=s[c],w=e.length(x);if(m>=o-(w==2?1:0))if(m+w<=$)n+=x;else break;m+=w}return n}})(Rn);yr=Rn.exports,xr=ln(yr),_r=ln(wr);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],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(T.modifier);hr=Object.keys(T.color),br=Object.keys(T.bgColor);[...hr,...br];lr=vr(),Xt=new Set(["\x1B",""]),re=`${kr}8;;`;jr=Object.defineProperty;Mn=Symbol("clack:cancel");cn=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),Tr=new Set(["up","down","left","right","space","enter"]);oe=class oe extends g{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",(e)=>{this.output.write(X.cursor.move(0,-1)),this.value=e,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};qr=Object.defineProperty;$e=class $e extends g{constructor(t){super(t,!1),un(this,"options"),un(this,"cursor",0);let{options:e}=t;this.options=Object.entries(e).flatMap(([i,r])=>[{value:i,group:!0,label:i},...r.map((o)=>({...o,group:i}))]),this.value=[...t.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:i})=>i===t.cursorAt),0),this.on("cursor",(i)=>{switch(i){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}getGroupItems(t){return this.options.filter((e)=>e.group===t)}isGroupSelected(t){return this.getGroupItems(t).every((e)=>this.value.includes(e.value))}toggleValue(){let t=this.options[this.cursor];if(t.group===!0){let e=t.value,i=this.getGroupItems(e);this.isGroupSelected(e)?this.value=this.value.filter((r)=>i.findIndex((o)=>o.value===r)===-1):this.value=[...this.value,...i.map((r)=>r.value)],this.value=Array.from(new Set(this.value))}else{let e=this.value.includes(t.value);this.value=e?this.value.filter((i)=>i!==t.value):[...this.value,t.value]}}};Jr=Object.defineProperty,An=class extends g{constructor(t){super(t,!1),yn(this,"options"),yn(this,"cursor",0),this.options=t.options,this.value=[...t.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:e})=>e===t.cursorAt),0),this.on("key",(e)=>{e==="a"&&this.toggleAll()}),this.on("cursor",(e)=>{switch(e){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let t=this.value.length===this.options.length;this.value=t?[]:this.options.map((e)=>e.value)}toggleValue(){let t=this.value.includes(this._value);this.value=t?this.value.filter((e)=>e!==this._value):[...this.value,this._value]}},Qr=Object.defineProperty;me=class me extends g{constructor({mask:t,...e}){super(e),xn(this,"valueWithCursor",""),xn(this,"_mask","•"),this._mask=t??"•",this.on("finalize",()=>{this.valueWithCursor=this.masked}),this.on("value",()=>{if(this.cursor>=this.value.length)this.valueWithCursor=`${this.masked}${et.default.inverse(et.default.hidden("_"))}`;else{let i=this.masked.slice(0,this.cursor),r=this.masked.slice(this.cursor);this.valueWithCursor=`${i}${et.default.inverse(r[0])}${r.slice(1)}`}})}get cursor(){return this._cursor}get masked(){return this.value.replaceAll(/./g,this._mask)}};Yr=Object.defineProperty,jn=class extends g{constructor(t){super(t,!1),wn(this,"options"),wn(this,"cursor",0),this.options=t.options,this.cursor=this.options.findIndex(({value:e})=>e===t.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(e)=>{switch(e){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}},Zr=Object.defineProperty;pe=class pe extends g{constructor(t){super(t,!1),_n(this,"options"),_n(this,"cursor",0),this.options=t.options;let e=this.options.map(({value:[i]})=>i?.toLowerCase());this.cursor=Math.max(e.indexOf(t.initialValue),0),this.on("key",(i)=>{if(!e.includes(i))return;let r=this.options.find(({value:[o]})=>o?.toLowerCase()===i);r&&(this.value=r.value,this.state="submit",this.emit("submit"))})}};dr=Object.defineProperty;se=class se extends g{constructor(t){super(t),Kr(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}${et.default.inverse(et.default.hidden("_"))}`;else{let e=this.value.slice(0,this.cursor),i=this.value.slice(this.cursor);this.valueWithCursor=`${e}${et.default.inverse(i[0])}${i.slice(1)}`}})}get cursor(){return this._cursor}};Hr=globalThis.process.platform.startsWith("win")});var Yt={};je(Yt,{text:()=>to,spinner:()=>uo,selectKey:()=>ro,select:()=>io,password:()=>eo,outro:()=>co,note:()=>mo,multiselect:()=>oo,log:()=>nt,isCancel:()=>Qt,intro:()=>so,groupMultiselect:()=>$o,group:()=>xo,confirm:()=>no,cancel:()=>po});import K from"node:process";function Ur(){return K.platform!=="win32"?K.env.TERM!=="linux":Boolean(K.env.CI)||Boolean(K.env.WT_SESSION)||Boolean(K.env.TERMINUS_SUBLIME)||K.env.ConEmuTask==="{cmd::Cmder}"||K.env.TERM_PROGRAM==="Terminus-Sublime"||K.env.TERM_PROGRAM==="vscode"||K.env.TERM==="xterm-256color"||K.env.TERM==="alacritty"||K.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}function yo(){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-nq-uy=><~]))"].join("|");return new RegExp(t,"g")}var p,st,ye,q=(t,e)=>ye?t:e,ar,Tn,qn,Ot,Ir,b,O,xe,we,_e,ht,Nn,Pr,Bn,Cr,Lr,Er,fr,Fr,gr,Dr,it=(t)=>{switch(t){case"initial":case"active":return p.default.cyan(ar);case"cancel":return p.default.red(Tn);case"error":return p.default.yellow(qn);case"submit":return p.default.green(Ot)}},to=(t)=>new se({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${p.default.gray(b)}
|
|
16
|
+
${it(this.state)} ${t.message}
|
|
17
|
+
`,i=t.placeholder?p.default.inverse(t.placeholder[0])+p.default.dim(t.placeholder.slice(1)):p.default.inverse(p.default.hidden("_")),r=this.value?this.valueWithCursor:i;switch(this.state){case"error":return`${e.trim()}
|
|
18
|
+
${p.default.yellow(b)} ${r}
|
|
19
|
+
${p.default.yellow(O)} ${p.default.yellow(this.error)}
|
|
20
|
+
`;case"submit":return`${e}${p.default.gray(b)} ${p.default.dim(this.value||t.placeholder)}`;case"cancel":return`${e}${p.default.gray(b)} ${p.default.strikethrough(p.default.dim(this.value??""))}${this.value?.trim()?`
|
|
21
|
+
`+p.default.gray(b):""}`;default:return`${e}${p.default.cyan(b)} ${r}
|
|
22
|
+
${p.default.cyan(O)}
|
|
23
|
+
`}}}).prompt(),eo=(t)=>new me({validate:t.validate,mask:t.mask??Pr,render(){let e=`${p.default.gray(b)}
|
|
24
|
+
${it(this.state)} ${t.message}
|
|
25
|
+
`,i=this.valueWithCursor,r=this.masked;switch(this.state){case"error":return`${e.trim()}
|
|
26
|
+
${p.default.yellow(b)} ${r}
|
|
27
|
+
${p.default.yellow(O)} ${p.default.yellow(this.error)}
|
|
28
|
+
`;case"submit":return`${e}${p.default.gray(b)} ${p.default.dim(r)}`;case"cancel":return`${e}${p.default.gray(b)} ${p.default.strikethrough(p.default.dim(r??""))}${r?`
|
|
29
|
+
`+p.default.gray(b):""}`;default:return`${e}${p.default.cyan(b)} ${i}
|
|
30
|
+
${p.default.cyan(O)}
|
|
31
|
+
`}}}).prompt(),no=(t)=>{let e=t.active??"Yes",i=t.inactive??"No";return new oe({active:e,inactive:i,initialValue:t.initialValue??!0,render(){let r=`${p.default.gray(b)}
|
|
32
|
+
${it(this.state)} ${t.message}
|
|
33
|
+
`,o=this.value?e:i;switch(this.state){case"submit":return`${r}${p.default.gray(b)} ${p.default.dim(o)}`;case"cancel":return`${r}${p.default.gray(b)} ${p.default.strikethrough(p.default.dim(o))}
|
|
34
|
+
${p.default.gray(b)}`;default:return`${r}${p.default.cyan(b)} ${this.value?`${p.default.green(xe)} ${e}`:`${p.default.dim(we)} ${p.default.dim(e)}`} ${p.default.dim("/")} ${this.value?`${p.default.dim(we)} ${p.default.dim(i)}`:`${p.default.green(xe)} ${i}`}
|
|
35
|
+
${p.default.cyan(O)}
|
|
36
|
+
`}}}).prompt()},io=(t)=>{let e=(r,o)=>{let $=r.label??String(r.value);return o==="active"?`${p.default.green(xe)} ${$} ${r.hint?p.default.dim(`(${r.hint})`):""}`:o==="selected"?`${p.default.dim($)}`:o==="cancelled"?`${p.default.strikethrough(p.default.dim($))}`:`${p.default.dim(we)} ${p.default.dim($)}`},i=0;return new jn({options:t.options,initialValue:t.initialValue,render(){let r=`${p.default.gray(b)}
|
|
37
|
+
${it(this.state)} ${t.message}
|
|
38
|
+
`;switch(this.state){case"submit":return`${r}${p.default.gray(b)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${r}${p.default.gray(b)} ${e(this.options[this.cursor],"cancelled")}
|
|
39
|
+
${p.default.gray(b)}`;default:{let o=t.maxItems===void 0?1/0:Math.max(t.maxItems,5);this.cursor>=i+o-3?i=Math.max(Math.min(this.cursor-o+3,this.options.length-o),0):this.cursor<i+2&&(i=Math.max(this.cursor-2,0));let $=o<this.options.length&&i>0,n=o<this.options.length&&i+o<this.options.length;return`${r}${p.default.cyan(b)} ${this.options.slice(i,i+o).map((m,s,c)=>s===0&&$?p.default.dim("..."):s===c.length-1&&n?p.default.dim("..."):e(m,s+i===this.cursor?"active":"inactive")).join(`
|
|
40
|
+
${p.default.cyan(b)} `)}
|
|
41
|
+
${p.default.cyan(O)}
|
|
42
|
+
`}}}}).prompt()},ro=(t)=>{let e=(i,r="inactive")=>{let o=i.label??String(i.value);return r==="selected"?`${p.default.dim(o)}`:r==="cancelled"?`${p.default.strikethrough(p.default.dim(o))}`:r==="active"?`${p.default.bgCyan(p.default.gray(` ${i.value} `))} ${o} ${i.hint?p.default.dim(`(${i.hint})`):""}`:`${p.default.gray(p.default.bgWhite(p.default.inverse(` ${i.value} `)))} ${o} ${i.hint?p.default.dim(`(${i.hint})`):""}`};return new pe({options:t.options,initialValue:t.initialValue,render(){let i=`${p.default.gray(b)}
|
|
43
|
+
${it(this.state)} ${t.message}
|
|
44
|
+
`;switch(this.state){case"submit":return`${i}${p.default.gray(b)} ${e(this.options.find((r)=>r.value===this.value),"selected")}`;case"cancel":return`${i}${p.default.gray(b)} ${e(this.options[0],"cancelled")}
|
|
45
|
+
${p.default.gray(b)}`;default:return`${i}${p.default.cyan(b)} ${this.options.map((r,o)=>e(r,o===this.cursor?"active":"inactive")).join(`
|
|
46
|
+
${p.default.cyan(b)} `)}
|
|
47
|
+
${p.default.cyan(O)}
|
|
48
|
+
`}}}).prompt()},oo=(t)=>{let e=(i,r)=>{let o=i.label??String(i.value);return r==="active"?`${p.default.cyan(_e)} ${o} ${i.hint?p.default.dim(`(${i.hint})`):""}`:r==="selected"?`${p.default.green(ht)} ${p.default.dim(o)}`:r==="cancelled"?`${p.default.strikethrough(p.default.dim(o))}`:r==="active-selected"?`${p.default.green(ht)} ${o} ${i.hint?p.default.dim(`(${i.hint})`):""}`:r==="submitted"?`${p.default.dim(o)}`:`${p.default.dim(Nn)} ${p.default.dim(o)}`};return new An({options:t.options,initialValues:t.initialValues,required:t.required??!0,cursorAt:t.cursorAt,validate(i){if(this.required&&i.length===0)return`Please select at least one option.
|
|
49
|
+
${p.default.reset(p.default.dim(`Press ${p.default.gray(p.default.bgWhite(p.default.inverse(" space ")))} to select, ${p.default.gray(p.default.bgWhite(p.default.inverse(" enter ")))} to submit`))}`},render(){let i=`${p.default.gray(b)}
|
|
50
|
+
${it(this.state)} ${t.message}
|
|
51
|
+
`;switch(this.state){case"submit":return`${i}${p.default.gray(b)} ${this.options.filter(({value:r})=>this.value.includes(r)).map((r)=>e(r,"submitted")).join(p.default.dim(", "))||p.default.dim("none")}`;case"cancel":{let r=this.options.filter(({value:o})=>this.value.includes(o)).map((o)=>e(o,"cancelled")).join(p.default.dim(", "));return`${i}${p.default.gray(b)} ${r.trim()?`${r}
|
|
52
|
+
${p.default.gray(b)}`:""}`}case"error":{let r=this.error.split(`
|
|
53
|
+
`).map((o,$)=>$===0?`${p.default.yellow(O)} ${p.default.yellow(o)}`:` ${o}`).join(`
|
|
54
|
+
`);return i+p.default.yellow(b)+" "+this.options.map((o,$)=>{let n=this.value.includes(o.value),m=$===this.cursor;return m&&n?e(o,"active-selected"):n?e(o,"selected"):e(o,m?"active":"inactive")}).join(`
|
|
55
|
+
${p.default.yellow(b)} `)+`
|
|
56
56
|
`+r+`
|
|
57
|
-
`}default:return`${
|
|
58
|
-
${p.default.cyan(
|
|
59
|
-
${p.default.cyan(
|
|
60
|
-
`}}}).prompt()}
|
|
61
|
-
${p.default.reset(p.default.dim(`Press ${p.default.gray(p.default.bgWhite(p.default.inverse(" space ")))} to select, ${p.default.gray(p.default.bgWhite(p.default.inverse(" enter ")))} to submit`))}`},render(){let
|
|
62
|
-
${
|
|
63
|
-
`;switch(this.state){case"submit":return`${
|
|
64
|
-
${p.default.gray(
|
|
65
|
-
`).map((o
|
|
66
|
-
`);return`${
|
|
67
|
-
${p.default.yellow(
|
|
57
|
+
`}default:return`${i}${p.default.cyan(b)} ${this.options.map((r,o)=>{let $=this.value.includes(r.value),n=o===this.cursor;return n&&$?e(r,"active-selected"):$?e(r,"selected"):e(r,n?"active":"inactive")}).join(`
|
|
58
|
+
${p.default.cyan(b)} `)}
|
|
59
|
+
${p.default.cyan(O)}
|
|
60
|
+
`}}}).prompt()},$o=(t)=>{let e=(i,r,o=[])=>{let $=i.label??String(i.value),n=typeof i.group=="string",m=n&&(o[o.indexOf(i)+1]??{group:!0}),s=n&&m.group===!0,c=n?`${s?O:b} `:"";return r==="active"?`${p.default.dim(c)}${p.default.cyan(_e)} ${$} ${i.hint?p.default.dim(`(${i.hint})`):""}`:r==="group-active"?`${c}${p.default.cyan(_e)} ${p.default.dim($)}`:r==="group-active-selected"?`${c}${p.default.green(ht)} ${p.default.dim($)}`:r==="selected"?`${p.default.dim(c)}${p.default.green(ht)} ${p.default.dim($)}`:r==="cancelled"?`${p.default.strikethrough(p.default.dim($))}`:r==="active-selected"?`${p.default.dim(c)}${p.default.green(ht)} ${$} ${i.hint?p.default.dim(`(${i.hint})`):""}`:r==="submitted"?`${p.default.dim($)}`:`${p.default.dim(c)}${p.default.dim(Nn)} ${p.default.dim($)}`};return new $e({options:t.options,initialValues:t.initialValues,required:t.required??!0,cursorAt:t.cursorAt,validate(i){if(this.required&&i.length===0)return`Please select at least one option.
|
|
61
|
+
${p.default.reset(p.default.dim(`Press ${p.default.gray(p.default.bgWhite(p.default.inverse(" space ")))} to select, ${p.default.gray(p.default.bgWhite(p.default.inverse(" enter ")))} to submit`))}`},render(){let i=`${p.default.gray(b)}
|
|
62
|
+
${it(this.state)} ${t.message}
|
|
63
|
+
`;switch(this.state){case"submit":return`${i}${p.default.gray(b)} ${this.options.filter(({value:r})=>this.value.includes(r)).map((r)=>e(r,"submitted")).join(p.default.dim(", "))}`;case"cancel":{let r=this.options.filter(({value:o})=>this.value.includes(o)).map((o)=>e(o,"cancelled")).join(p.default.dim(", "));return`${i}${p.default.gray(b)} ${r.trim()?`${r}
|
|
64
|
+
${p.default.gray(b)}`:""}`}case"error":{let r=this.error.split(`
|
|
65
|
+
`).map((o,$)=>$===0?`${p.default.yellow(O)} ${p.default.yellow(o)}`:` ${o}`).join(`
|
|
66
|
+
`);return`${i}${p.default.yellow(b)} ${this.options.map((o,$,n)=>{let m=this.value.includes(o.value)||o.group===!0&&this.isGroupSelected(`${o.value}`),s=$===this.cursor;return!s&&typeof o.group=="string"&&this.options[this.cursor].value===o.group?e(o,m?"group-active-selected":"group-active",n):s&&m?e(o,"active-selected",n):m?e(o,"selected",n):e(o,s?"active":"inactive",n)}).join(`
|
|
67
|
+
${p.default.yellow(b)} `)}
|
|
68
68
|
${r}
|
|
69
|
-
`}default:return`${
|
|
70
|
-
${p.default.cyan(
|
|
71
|
-
${p.default.cyan(
|
|
72
|
-
`}}}).prompt()},
|
|
73
|
-
${
|
|
69
|
+
`}default:return`${i}${p.default.cyan(b)} ${this.options.map((r,o,$)=>{let n=this.value.includes(r.value)||r.group===!0&&this.isGroupSelected(`${r.value}`),m=o===this.cursor;return!m&&typeof r.group=="string"&&this.options[this.cursor].value===r.group?e(r,n?"group-active-selected":"group-active",$):m&&n?e(r,"active-selected",$):n?e(r,"selected",$):e(r,m?"active":"inactive",$)}).join(`
|
|
70
|
+
${p.default.cyan(b)} `)}
|
|
71
|
+
${p.default.cyan(O)}
|
|
72
|
+
`}}}).prompt()},ue=(t)=>t.replace(yo(),""),mo=(t="",e="")=>{let i=`
|
|
73
|
+
${t}
|
|
74
74
|
`.split(`
|
|
75
|
-
`),r=
|
|
76
|
-
`);process.stdout.write(`${p.default.gray(
|
|
77
|
-
${p.default.green(
|
|
78
|
-
${
|
|
79
|
-
${p.default.gray(
|
|
80
|
-
`)},
|
|
75
|
+
`),r=ue(e).length,o=Math.max(i.reduce((n,m)=>(m=ue(m),m.length>n?m.length:n),0),r)+2,$=i.map((n)=>`${p.default.gray(b)} ${p.default.dim(n)}${" ".repeat(o-ue(n).length)}${p.default.gray(b)}`).join(`
|
|
76
|
+
`);process.stdout.write(`${p.default.gray(b)}
|
|
77
|
+
${p.default.green(Ot)} ${p.default.reset(e)} ${p.default.gray(Bn.repeat(Math.max(o-r-1,1))+Cr)}
|
|
78
|
+
${$}
|
|
79
|
+
${p.default.gray(Lr+Bn.repeat(o+2)+Er)}
|
|
80
|
+
`)},po=(t="")=>{process.stdout.write(`${p.default.gray(O)} ${p.default.red(t)}
|
|
81
81
|
|
|
82
|
-
`)},so=(
|
|
83
|
-
`)},
|
|
84
|
-
${p.default.gray(
|
|
82
|
+
`)},so=(t="")=>{process.stdout.write(`${p.default.gray(Ir)} ${t}
|
|
83
|
+
`)},co=(t="")=>{process.stdout.write(`${p.default.gray(b)}
|
|
84
|
+
${p.default.gray(O)} ${t}
|
|
85
85
|
|
|
86
|
-
`)},
|
|
87
|
-
`);let
|
|
88
|
-
`),
|
|
89
|
-
`);
|
|
86
|
+
`)},nt,uo=()=>{let t=ye?["◒","◐","◓","◑"]:["•","o","O","0"],e=ye?80:120,i,r,o=!1,$="",n=(x="")=>{o=!0,i=Gn(),$=x.replace(/\.+$/,""),process.stdout.write(`${p.default.gray(b)}
|
|
87
|
+
`);let w=0,h=0;r=setInterval(()=>{let _=p.default.magenta(t[w]),R=".".repeat(Math.floor(h)).slice(0,3);process.stdout.write(st.cursor.move(-999,0)),process.stdout.write(st.erase.down(1)),process.stdout.write(`${_} ${$}${R}`),w=w+1<t.length?w+1:0,h=h<t.length?h+0.125:0},e)},m=(x="",w=0)=>{$=x??$,o=!1,clearInterval(r);let h=w===0?p.default.green(Ot):w===1?p.default.red(Tn):p.default.red(qn);process.stdout.write(st.cursor.move(-999,0)),process.stdout.write(st.erase.down(1)),process.stdout.write(`${h} ${$}
|
|
88
|
+
`),i()},s=(x="")=>{$=x??$},c=(x)=>{let w=x>1?"Something went wrong":"Canceled";o&&m(w,x)};return process.on("uncaughtExceptionMonitor",()=>c(2)),process.on("unhandledRejection",()=>c(2)),process.on("SIGINT",()=>c(1)),process.on("SIGTERM",()=>c(1)),process.on("exit",c),{start:n,stop:m,message:s}},xo=async(t,e)=>{let i={},r=Object.keys(t);for(let o of r){let $=t[o],n=await $({results:i})?.catch((m)=>{throw m});if(typeof e?.onCancel=="function"&&Qt(n)){i[o]="canceled",e.onCancel({results:i});continue}i[o]=n}return i};var Vt=Ht(()=>{ce();ce();p=lt(te(),1),st=lt(gt(),1);ye=Ur(),ar=q("◆","*"),Tn=q("■","x"),qn=q("▲","x"),Ot=q("◇","o"),Ir=q("┌","T"),b=q("│","|"),O=q("└","—"),xe=q("●",">"),we=q("○"," "),_e=q("◻","[•]"),ht=q("◼","[+]"),Nn=q("◻","[ ]"),Pr=q("▪","•"),Bn=q("─","-"),Cr=q("╮","+"),Lr=q("├","+"),Er=q("╯","+"),fr=q("●","•"),Fr=q("◆","*"),gr=q("▲","!"),Dr=q("■","x"),nt={message:(t="",{symbol:e=p.default.gray(b)}={})=>{let i=[`${p.default.gray(b)}`];if(t){let[r,...o]=t.split(`
|
|
89
|
+
`);i.push(`${e} ${r}`,...o.map(($)=>`${p.default.gray(b)} ${$}`))}process.stdout.write(`${i.join(`
|
|
90
90
|
`)}
|
|
91
|
-
`)},info:(
|
|
92
|
-
`);return null}}async function
|
|
93
|
-
`,{mode:384}),
|
|
94
|
-
`)}catch{}}var
|
|
95
|
-
`);let
|
|
91
|
+
`)},info:(t)=>{nt.message(t,{symbol:p.default.blue(fr)})},success:(t)=>{nt.message(t,{symbol:p.default.green(Fr)})},step:(t)=>{nt.message(t,{symbol:p.default.green(Ot)})},warn:(t)=>{nt.message(t,{symbol:p.default.yellow(gr)})},warning:(t)=>{nt.warn(t)},error:(t)=>{nt.message(t,{symbol:p.default.red(Dr)})}}});var zn={};je(zn,{readTextFromPathOrStdin:()=>bt});import{readFileSync as bo}from"fs";function bt(t){return bo(t==="-"?"/dev/stdin":t,"utf-8")}var zt=()=>{};function Ut(t){return t.replace(/-([a-z])/g,(e,i)=>i.toUpperCase())}function Ti(t){let e=t.flag.match(/^--([a-z][a-z0-9-]*)/i);return e?Ut(e[1]):null}function qi(t){if(t.type==="boolean")return!0;if(t.type==="string"||t.type==="number"||t.type==="array")return!1;return!t.flag.includes("<")&&!t.flag.includes("[")}function Ge(t){let e=new Set,i=new Set,r=new Set;for(let o of t){let $=Ti(o);if(!$)continue;if(qi(o))e.add($);else if(o.type==="number")i.add($);else if(o.type==="array")r.add($)}return{booleans:e,numbers:i,arrays:r}}function Be(t,e=[]){let i=Ge(e),r=[],o=0;while(o<t.length){let $=t[o];if($==="--")break;if($.startsWith("--")){let n=$.indexOf("="),m=n!==-1?$.slice(2,n):$.slice(2),s=Ut(m);if(!i.booleans.has(s)&&n===-1)o+=2;else o+=1;continue}if($.startsWith("-")){o++;continue}r.push($),o++}return r}function at(t,e){let i=Ge(e),r={quiet:!1,verbose:!1,noColor:!1,yes:!1,dryRun:!1,help:!1,nonInteractive:!1,async:!1},o=0;while(o<t.length){let $=t[o];if($==="--help"||$==="-h"){r.help=!0,o++;continue}if($==="--")break;if($.startsWith("--")){let n=$.indexOf("="),m,s;if(n!==-1)m=$.slice(2,n),s=$.slice(n+1);else m=$.slice(2);let c=Ut(m);if(i.booleans.has(c)){r[c]=!0,o++;continue}if(s===void 0)o++,s=t[o];if(s===void 0)throw Error(`Flag --${m} requires a value.`);if(i.arrays.has(c)){let x=r[c];if(x)x.push(s);else r[c]=[s]}else if(i.numbers.has(c))r[c]=Number(s);else r[c]=s}o++}return r}var u={SUCCESS:0,GENERAL:1,USAGE:2,AUTH:3,QUOTA:4,TIMEOUT:5,NETWORK:6,CONTENT_FILTER:10};class y extends Error{exitCode;hint;constructor(t,e=u.GENERAL,i){super(t);this.name="CLIError",this.exitCode=e,this.hint=i}toJSON(){return{error:{code:this.exitCode,message:this.message,...this.hint?{hint:this.hint}:{}}}}}var C={global:"https://api.minimax.io",cn:"https://api.minimaxi.com"},xt={global:"https://platform.minimax.io",cn:"https://platform.minimaxi.com"},Ni=new Set(["global","cn"]),Ji=new Set(["text","json"]);function Te(t){if(!t||typeof t!=="object"||Array.isArray(t))return{};let e=t,i={};if(typeof e.api_key==="string")i.api_key=e.api_key;if(typeof e.region==="string"&&Ni.has(e.region))i.region=e.region;if(typeof e.base_url==="string"&&e.base_url.startsWith("http"))i.base_url=e.base_url;if(typeof e.output==="string"&&Ji.has(e.output))i.output=e.output;if(typeof e.timeout==="number"&&e.timeout>0)i.timeout=e.timeout;if(typeof e.default_text_model==="string"&&e.default_text_model.length>0)i.default_text_model=e.default_text_model;if(typeof e.default_speech_model==="string"&&e.default_speech_model.length>0)i.default_speech_model=e.default_speech_model;if(typeof e.default_video_model==="string"&&e.default_video_model.length>0)i.default_video_model=e.default_video_model;if(typeof e.default_music_model==="string"&&e.default_music_model.length>0)i.default_music_model=e.default_music_model;return i}function l(t){return{name:t.name,description:t.description,usage:t.usage,options:t.options,examples:t.examples,apiDocs:t.apiDocs,execute:t.run}}var Rt=[{flag:"--api-key <key>",description:"API key"},{flag:"--region <region>",description:"API region: global, cn"},{flag:"--base-url <url>",description:"API base URL"},{flag:"--output <format>",description:"Output format: text, json"},{flag:"--timeout <seconds>",description:"Request timeout",type:"number"},{flag:"--quiet",description:"Suppress non-essential output"},{flag:"--verbose",description:"Print HTTP request/response details"},{flag:"--no-color",description:"Disable ANSI colors"},{flag:"--dry-run",description:"Dry run mode"},{flag:"--non-interactive",description:"Disable interactive prompts"},{flag:"--help",description:"Show help"},{flag:"--version",description:"Print version"}];import{readFileSync as Oi,writeFileSync as Yi,renameSync as Vi,unlinkSync as Zi,existsSync as qe,statSync as zi}from"fs";import{homedir as Xi}from"os";import{join as It}from"path";var Qi=".mmx";function wt(){return It(Xi(),Qi)}function L(){return It(wt(),"config.json")}function kt(){return It(wt(),"credentials.json")}async function St(){let t=wt();await(await import("fs/promises")).mkdir(t,{recursive:!0,mode:448})}async function d(){let t=kt();if(!qe(t))return null;try{di(t);let e=Oi(t,"utf-8"),i=JSON.parse(e);if(!i.access_token||!i.refresh_token)return null;return i}catch(e){let i=e;if(i instanceof SyntaxError||i.message.includes("JSON"))process.stderr.write(`Warning: credentials file is corrupted. Run 'mmx auth logout' to reset.
|
|
92
|
+
`);return null}}async function mt(t){await St();let e=kt(),i=e+".tmp";Yi(i,JSON.stringify(t,null,2)+`
|
|
93
|
+
`,{mode:384}),Vi(i,e)}async function Ne(){let t=kt();if(qe(t))Zi(t)}function di(t){try{let i=zi(t).mode&511;if(i!==384)process.stderr.write(`Warning: ${t} has permissions ${i.toString(8)}, expected 600.
|
|
94
|
+
`)}catch{}}var Je={clientId:"mmx-cli",authorizationUrl:"https://platform.minimax.io/oauth/authorize",tokenUrl:"https://api.minimax.io/v1/oauth/token",deviceCodeUrl:"https://api.minimax.io/v1/oauth/device/code",scopes:["api"],callbackPort:18991};async function Xe(t=Je){let{randomBytes:e,createHash:i}=await import("crypto"),r=e(32).toString("base64url"),o=i("sha256").update(r).digest("base64url"),$=e(16).toString("hex"),n=new URLSearchParams({client_id:t.clientId,response_type:"code",redirect_uri:`http://localhost:${t.callbackPort}/callback`,scope:t.scopes.join(" "),state:$,code_challenge:o,code_challenge_method:"S256"}),m=`${t.authorizationUrl}?${n}`,{execFile:s,spawn:c}=await import("child_process"),x=process.platform;if(x==="darwin")s("open",[m]);else if(x==="win32")c("cmd.exe",["/c","start","",m],{shell:!1,detached:!0});else s("xdg-open",[m]);process.stderr.write(`Opening browser to authenticate with MiniMax...
|
|
95
|
+
`);let w=await Wi(t.callbackPort,$),h=await fetch(t.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",code:w,client_id:t.clientId,redirect_uri:`http://localhost:${t.callbackPort}/callback`,code_verifier:r})});if(!h.ok){let _=await h.text();throw new y(`OAuth token exchange failed: ${_}`,u.AUTH)}return await h.json()}async function Wi(t,e){return new Promise((i,r)=>{let o=setTimeout(()=>{$.stop(),r(new y("OAuth callback timed out.",u.TIMEOUT))},120000),$=Bun.serve({port:t,fetch(n){let m=new URL(n.url);if(m.pathname!=="/callback")return new Response("Not found",{status:404});let s=m.searchParams.get("code"),c=m.searchParams.get("state"),x=m.searchParams.get("error");if(x)return clearTimeout(o),$.stop(),r(new y(`OAuth error: ${x}`,u.AUTH)),new Response("<html><body><h1>Authentication Failed</h1><p>You can close this tab.</p></body></html>",{headers:{"Content-Type":"text/html"}});if(!s||c!==e)return clearTimeout(o),$.stop(),r(new y("Invalid OAuth callback.",u.AUTH)),new Response("Invalid callback",{status:400});return clearTimeout(o),$.stop(),i(s),new Response("<html><body><h1>Authentication Successful</h1><p>You can close this tab.</p></body></html>",{headers:{"Content-Type":"text/html"}})}})})}async function Qe(t=Je){let e=await fetch(t.deviceCodeUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:t.clientId,scope:t.scopes.join(" ")})});if(!e.ok)throw new y("Failed to start device code flow.",u.AUTH);let{device_code:i,user_code:r,verification_uri:o,interval:$,expires_in:n}=await e.json();process.stderr.write(`
|
|
96
96
|
Visit: ${o}
|
|
97
97
|
`),process.stderr.write(`Enter code: ${r}
|
|
98
98
|
`),process.stderr.write(`Waiting for authorization...
|
|
99
|
-
`);let m=Date.now()+
|
|
100
|
-
Re-authenticate: mmx auth login`)}
|
|
101
|
-
Pass directly: --api-key sk-xxxxx`)}function
|
|
99
|
+
`);let m=Date.now()+n*1000,s=($||5)*1000;while(Date.now()<m){await new Promise((w)=>setTimeout(w,s));let c=await fetch(t.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:i,client_id:t.clientId})});if(c.ok)return await c.json();let x=await c.json();if(x.error==="authorization_pending")continue;if(x.error==="slow_down"){await new Promise((w)=>setTimeout(w,5000));continue}throw new y(`Device code authorization failed: ${x.error}`,u.AUTH)}throw new y("Device code authorization timed out.",u.TIMEOUT)}var Ki="https://api.minimax.io/v1/oauth/token",Oe=2,Hi=500;async function Pt(t){let e=null;for(let i=0;i<=Oe;i++){if(i>0)await new Promise(($)=>setTimeout($,Hi*i));let r;try{r=await fetch(Ki,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:t}),signal:AbortSignal.timeout(1e4)})}catch($){let n=$ instanceof Error&&($.name==="AbortError"||$.name==="TimeoutError"||$.message.includes("timed out"));e=Error(n?"Token refresh timed out — auth server did not respond within 10 s.":`Token refresh failed: ${$ instanceof Error?$.message:String($)}`);continue}if(!r.ok){if(r.status>=400&&r.status<500)throw new y("OAuth session expired and could not be refreshed.",u.AUTH,"Re-authenticate: mmx auth login");e=Error(`Token refresh failed: HTTP ${r.status}`);continue}return await r.json()}throw new y(`Token refresh failed after ${Oe+1} attempts: ${e?.message}`,u.AUTH,`Check your network connection.
|
|
100
|
+
Re-authenticate: mmx auth login`)}async function Ye(t){let e=new Date(t.expires_at).getTime(),i=300000;if(Date.now()<e-300000)return t.access_token;let r=await Pt(t.refresh_token),o={access_token:r.access_token,refresh_token:r.refresh_token,expires_at:new Date(Date.now()+r.expires_in*1000).toISOString(),token_type:"Bearer",account:t.account};return await mt(o),o.access_token}async function Mt(t){if(t.apiKey)return{token:t.apiKey,method:"api-key",source:"flag"};let e=await d();if(e)return{token:await Ye(e),method:"oauth",source:"credentials.json"};if(t.fileApiKey)return{token:t.fileApiKey,method:"api-key",source:"config.json"};throw new y("No credentials found.",u.AUTH,`Log in: mmx auth login
|
|
101
|
+
Pass directly: --api-key sk-xxxxx`)}function Ve(t){if(!t)return"";if(t.includes("/t2a"))return`
|
|
102
102
|
|
|
103
|
-
Speech models require the Plus plan or above.`;if(
|
|
103
|
+
Speech models require the Plus plan or above.`;if(t.includes("/image_generation"))return`
|
|
104
104
|
|
|
105
|
-
image-01 requires the Plus plan or above.`;if(
|
|
105
|
+
image-01 requires the Plus plan or above.`;if(t.includes("/video_generation")||t.includes("/query/video_generation"))return`
|
|
106
106
|
|
|
107
|
-
Video models (Hailuo-2.3 / 2.3-Fast) require the Max plan or above.`;if(
|
|
107
|
+
Video models (Hailuo-2.3 / 2.3-Fast) require the Max plan or above.`;if(t.includes("/music_generation"))return`
|
|
108
108
|
|
|
109
|
-
Music-2.6 requires the Max plan or above.`;return""}function
|
|
110
|
-
Re-authenticate: mmx auth login`);if(
|
|
111
|
-
Upgrade plan: ${
|
|
112
|
-
Upgrade plan: ${
|
|
113
|
-
`)}async function
|
|
109
|
+
Music-2.6 requires the Max plan or above.`;return""}function Ze(t){return`${t?.includes("minimaxi.com")?"https://platform.minimaxi.com":"https://platform.minimax.io"}/subscribe/token-plan`}function Ct(t,e,i){let r=e.base_resp?.status_msg||e.error?.message||`HTTP ${t}`,o=e.base_resp?.status_code||e.error?.code;if(t===401||t===403)return new y(`API key rejected (HTTP ${t}).`,u.AUTH,`Check status: mmx auth status
|
|
110
|
+
Re-authenticate: mmx auth login`);if(t===429)return new y(`Rate limit or quota exceeded. ${r}`,u.QUOTA,"Check usage: mmx quota show");if(t===408||t===504)return new y(`Request timed out (HTTP ${t}).`,u.TIMEOUT,"Try increasing --timeout or retry later.");if(o===1002||o===1039){let $=e.base_resp?.status_msg||"content sensitivity";return new y(`Input content flagged by sensitivity filter (${$}).`,u.CONTENT_FILTER)}if(o===1028||o===1030){let $=Ve(i);return new y(`Quota exhausted. ${r}`,u.QUOTA,`Check usage: mmx quota show${$}
|
|
111
|
+
Upgrade plan: ${Ze(i)}`)}if(o===2061){let $=Ve(i);return new y(`This model is not available on your current Token Plan. ${r}`,u.QUOTA,`Check usage: mmx quota show${$}
|
|
112
|
+
Upgrade plan: ${Ze(i)}`)}return new y(`API error: ${r} (HTTP ${t})`,u.GENERAL)}import{homedir as ze}from"os";function W(t){return t.length>8?`${t.slice(0,4)}...${t.slice(-4)}`:"***"}var de=!1;var Z="\x1B[0m",E="\x1B[2m",Ui="\x1B[1m",ai="\x1B[38;2;43;82;255m",Ii="\x1B[38;2;147;51;234m",Pi="\x1B[38;2;6;184;212m",Ci="\x1B[38;2;236;72;153m";function Li(t){return t.startsWith(ze())?t.replace(ze(),"~"):t}function We(t,e,i){if(t.quiet||de||!process.stderr.isTTY)return;de=!0;let r=t.configPath?Li(t.configPath):"~/.mmx/config.json",o=t.fileRegion?`${t.fileRegion} (file)`:"global (default)",$=t.apiKey?"(flag)":"(file)",n=W(e),m=i?` ${E}|${Z} ${E}Model:${Z} ${Ii}${i}${Z}`:"";process.stderr.write(`${Ui}${ai}MINIMAX${Z} ${E}${r}${Z} ${E}|${Z} ${E}Region:${Z} ${Pi}${o}${Z} ${E}|${Z} ${E}Key:${Z} ${Ci}${n}${Z} ${E}${$}${Z}${m}
|
|
113
|
+
`)}async function P(t,e){let i=typeof FormData<"u"&&e.body instanceof FormData,r="1.0.11",o={"User-Agent":"mmx-cli/1.0.11",...e.headers};if(!i&&!o["Content-Type"])o["Content-Type"]="application/json";if(!e.noAuth){let m=await Mt(t);if(e.authStyle==="x-api-key")o["x-api-key"]=m.token;else o.Authorization=`Bearer ${m.token}`;if(t.verbose)process.stderr.write(`> ${e.method??"GET"} ${e.url}
|
|
114
114
|
`),process.stderr.write(`> Auth: ${m.token.slice(0,8)}...
|
|
115
|
-
`);let
|
|
116
|
-
`);if(!
|
|
115
|
+
`);let s=e.body&&typeof e.body==="object"&&"model"in e.body?String(e.body.model):void 0;We(t,m.token,s)}let $=(e.timeout??t.timeout)*1000,n=await fetch(e.url,{method:e.method??"GET",headers:o,body:e.body?i?e.body:JSON.stringify(e.body):void 0,signal:AbortSignal.timeout($)});if(t.verbose)process.stderr.write(`< ${n.status} ${n.statusText}
|
|
116
|
+
`);if(!n.ok){let m={};try{m=await n.json()}catch{}throw Ct(n.status,m,e.url)}return n}async function A(t,e){let i=await P(t,e),r;try{r=await i.json()}catch{let o=i.headers.get("content-type")||"";throw new y(`API returned non-JSON response (${o||"unknown type"}). Server may be experiencing issues.`,u.GENERAL)}if(r.base_resp?.status_code&&r.base_resp.status_code!==0)throw Ct(200,{base_resp:r.base_resp},e.url);return r}function Ke(t){return`${t}/anthropic/v1/messages`}function He(t){return`${t}/v1/t2a_v2`}function Ue(t){return`${t}/v1/get_voice`}function ae(t){return`${t}/v1/image_generation`}function Ie(t){return`${t}/v1/video_generation`}function At(t,e){return`${t}/v1/query/video_generation?task_id=${e}`}function jt(t,e){return`${t}/v1/files/retrieve?file_id=${e}`}function Gt(t){return`${t}/v1/music_generation`}function Pe(t){return`${t}/v1/coding_plan/search`}function Ce(t){return`${t}/v1/coding_plan/vlm`}function tt(t){return`${t.includes("minimaxi.com")?"https://api.minimaxi.com":"https://api.minimax.io"}/v1/token_plan/remains`}function fe(t){if(t<50)return["\x1B[38;2;74;222;128m","\x1B[48;2;22;163;74m"];if(t<=80)return["\x1B[38;2;250;204;21m","\x1B[48;2;202;138;4m"];return["\x1B[38;2;248;113;113m","\x1B[48;2;220;38;38m"]}var Ei={dashboard:"TokenPlan Quota",week:"Week",weekly:"Weekly",resetsIn:"Resets in",noData:"No quota data available.",now:"now"},fi={dashboard:"TokenPlan 配额面板",week:"周期",weekly:"每周",resetsIn:"重置于",noData:"暂无配额数据",now:"即将"};function Fi(t,e){if(t<=0)return e;let i=Math.floor(t/3600000),r=Math.floor(t%3600000/60000);return i>0?`${i}h ${r}m`:`${r}m`}function Le(t){return new Date(t).toISOString().slice(0,10)}function gi(t){return t>=11904&&t<=40959||t>=63744&&t<=64255||t>=65072&&t<=65103||t>=65281&&t<=65376||t>=131072&&t<=195103}function f(t){let e=t.replace(/\x1b\[[0-9;]*m/g,""),i=0;for(let r of e)i+=gi(r.codePointAt(0))?2:1;return i}var Tt=16;function Ee(t,e){let i=Math.max(0,Math.min(100,t))/100,r=Math.round(Tt*i),o=Tt-r,$=`${t}%`.padStart(4);if(!e)return`[${"█".repeat(r)}${".".repeat(o)}] ${$}`;let[n,m]=fe(t);return`${m}${" ".repeat(r)}\x1B[0m\x1B[48;2;55;65;81m${" ".repeat(o)}\x1B[0m ${n}\x1B[1m${$}\x1B[0m`}function Bt(t,e,i,r,o){return o?`\x1B[2m${e}${i.repeat(t)}${r}\x1B[0m`:`+${"-".repeat(t)}+`}function Lt(t,e,i,r){let o=Math.max(0,e-2-i);return r?`${"\x1B[2m"}│${"\x1B[0m"} ${t}${" ".repeat(o)} ${"\x1B[2m"}│${"\x1B[0m"}`:`| ${t}${" ".repeat(o)} |`}function pt(t,e){let i=!e.noColor&&process.stdout.isTTY===!0,r=e.region==="cn"?fi:Ei,o=t.length>0?Math.max(...t.map((_)=>_.model_name.length)):16,$=i?Tt+5:Tt+7,n=Math.max(68,o+2+15+2+$+2),m=t.length>0?`${Le(t[0].weekly_start_time)} — ${Le(t[0].weekly_end_time)}`:"",s=`MINIMAX ${r.dashboard}`,c=`${r.week}: ${m}`,x=Math.max(2,n-2-f(s)-f(c)),w=i?`\x1B[1m\x1B[38;2;43;82;255mMINIMAX\x1B[0m \x1B[2m${r.dashboard}\x1B[0m${" ".repeat(x)}\x1B[2m${r.week}:\x1B[0m \x1B[38;2;6;184;212m${m}\x1B[0m`:`${s}${" ".repeat(x)}${c}`,h=f(s)+x+f(c);if(console.log(""),console.log(Bt(n,"╭","─","╮",i)),console.log(Lt(w,n,h,i)),t.length===0){console.log(Bt(n,"╰","─","╯",i)),console.log(`
|
|
117
117
|
${r.noData}
|
|
118
|
-
`);return}for(let
|
|
119
|
-
`)}if(typeof
|
|
120
|
-
`)}function
|
|
121
|
-
`)}function
|
|
122
|
-
`);return{}}}async function
|
|
123
|
-
`,{mode:384}),
|
|
118
|
+
`);return}for(let _ of t){console.log(Bt(n,"├","─","┤",i));let{current_interval_usage_count:R,current_interval_total_count:k}=_,j=k>0?Math.round(R/k*100):0,G=_.current_weekly_usage_count,N=_.current_weekly_total_count,Y=Fi(_.remains_time,r.now),B=_.model_name.padEnd(o),M=`${R.toLocaleString()} / ${k.toLocaleString()}`,V=Ee(j,i),a=o+2+15+2+$,I=i?`\x1B[1m\x1B[38;2;255;255;255m${B}\x1B[0m ${fe(j)[0]}${M.padStart(15)}\x1B[0m ${V}`:`${B} ${M.padStart(15)} ${Ee(j,!1)}`;console.log(Lt(I,n,a,i));let yt=`└ ${r.weekly} ${G.toLocaleString()} / ${N.toLocaleString()}`,vt=`${r.resetsIn} ${Y}`,Wt=Math.max(2,n-2-2-f(yt)-f(vt)),hi=2+f(yt)+Wt+f(vt),bi=i?` \x1B[2m${yt}${" ".repeat(Wt)}${vt}\x1B[0m`:` ${yt}${" ".repeat(Wt)}${vt}`;console.log(Lt(bi,n,hi,i))}console.log(Bt(n,"╰","─","╯",i)),console.log("")}import{readFileSync as tr,writeFileSync as er,renameSync as nr,existsSync as ir}from"fs";function Fe(t){if(t===null||t===void 0)return"";if(typeof t==="string")return t;if(typeof t==="number"||typeof t==="boolean")return String(t);if(Array.isArray(t)){if(t.length===0)return"(empty)";if(typeof t[0]==="object"&&t[0]!==null)return Di(t);return t.map(String).join(`
|
|
119
|
+
`)}if(typeof t==="object")return Et(t);return String(t)}function Et(t,e=0){let i=" ".repeat(e),r=[];for(let[o,$]of Object.entries(t)){if($===null||$===void 0)continue;if(Array.isArray($)){r.push(`${i}${o}:`);for(let n of $)if(typeof n==="object"&&n!==null)r.push(`${i} - ${Et(n,e+4).trimStart()}`);else r.push(`${i} - ${String(n)}`)}else if(typeof $==="object")r.push(`${i}${o}:`),r.push(Et($,e+2));else r.push(`${i}${o}: ${String($)}`)}return r.join(`
|
|
120
|
+
`)}function Di(t){if(t.length===0)return"(empty)";let e=Object.keys(t[0]),i=e.map((n)=>Math.max(n.length,...t.map((m)=>String(m[n]??"").length))),r=e.map((n,m)=>n.toUpperCase().padEnd(i[m])).join(" "),o=i.map((n)=>"-".repeat(n)).join(" "),$=t.map((n)=>e.map((m,s)=>String(n[m]??"").padEnd(i[s])).join(" "));return[r,o,...$].join(`
|
|
121
|
+
`)}function ge(t){return JSON.stringify(t,null,2)}function S(t){if(t==="json"||t==="text")return t;if(!process.stdout.isTTY)return"json";return"text"}function v(t,e){switch(e){case"json":return ge(t);case"text":return Fe(t)}}function Q(){let t=L();if(!ir(t))return{};try{return Te(JSON.parse(tr(t,"utf-8")))}catch(e){let i=e;if(i instanceof SyntaxError||i.message.includes("JSON"))process.stderr.write(`Warning: config file is corrupted. Run 'mmx config set' to reset.
|
|
122
|
+
`);return{}}}async function H(t){await St();let e=L(),i=e+".tmp";er(i,JSON.stringify(t,null,2)+`
|
|
123
|
+
`,{mode:384}),nr(i,e)}function ft(t){let e=Q(),i=t.apiKey||void 0,r=e.api_key,o=t.region||process.env.MINIMAX_REGION||void 0,$=e.region,n=o||$||"global",m=i||r,s=!o&&(!$||m!==void 0&&m!==e.api_key),c=t.baseUrl||process.env.MINIMAX_BASE_URL||e.base_url||C[n]||C.global,x=S(t.output||process.env.MINIMAX_OUTPUT||e.output),w=process.env.MINIMAX_TIMEOUT?Number(process.env.MINIMAX_TIMEOUT):void 0,h=w!==void 0&&Number.isFinite(w)&&w>0?w:void 0,_=t.timeout??h??e.timeout??300;return{apiKey:i,fileApiKey:r,fileRegion:e.region,configPath:L(),region:n,baseUrl:c,output:x,timeout:_,defaultTextModel:e.default_text_model,defaultSpeechModel:e.default_speech_model,defaultVideoModel:e.default_video_model,defaultMusicModel:e.default_music_model,verbose:t.verbose||process.env.MINIMAX_VERBOSE==="1",quiet:t.quiet||!1,noColor:t.noColor||process.env.NO_COLOR!==void 0||!process.stdout.isTTY,yes:t.yes||!1,dryRun:t.dryRun||!1,nonInteractive:t.nonInteractive||!1,async:t.async||!1,needsRegionDetection:s}}function J(t){if(t?.nonInteractive===!0)return!1;if(process.env.CI)return!1;return process.stdout.isTTY===!0&&process.stdin.isTTY===!0}async function Jn(t){try{let e=tt(t.baseUrl),i=await A(t,{url:e});pt(i.model_remains||[],t)}catch{}}var Xn=l({name:"auth login",description:"Authenticate via OAuth or API key",usage:"mmx auth login [--method oauth|api-key] [--api-key <key>] [--no-browser]",options:[{flag:"--method <method>",description:"Auth method: oauth (default), api-key"},{flag:"--api-key <key>",description:"API key to store"},{flag:"--no-browser",description:"Use device-code flow instead of browser"}],examples:["mmx auth login","mmx auth login --no-browser","mmx auth login --api-key sk-xxxxx","mmx auth login --method api-key --api-key sk-xxxxx"],async run(t,e){let i=process.env.MINIMAX_API_KEY;if(i&&!e.apiKey){let n=W(i);if(J({nonInteractive:t.nonInteractive})){let{confirm:m}=await Promise.resolve().then(() => (Vt(),Yt));if(!await m({message:`Detected MINIMAX_API_KEY in environment (${n}).
|
|
124
124
|
You are already authenticated via env.
|
|
125
125
|
Do you still want to configure local persistent credentials?`,initialValue:!1}))process.stdout.write(`Login skipped. Using environment variables.
|
|
126
126
|
`),process.exit(0)}else process.stderr.write(`Warning: MINIMAX_API_KEY is already set in environment.
|
|
127
|
-
`)}if((
|
|
128
|
-
`)}catch{throw new
|
|
129
|
-
`),await
|
|
127
|
+
`)}if((e.apiKey?"api-key":e.method||"oauth")==="api-key"){let n=e.apiKey||t.apiKey;if(!n)throw new y("--api-key is required when using --method api-key.",u.USAGE,"mmx auth login --api-key sk-xxxxx");if(!t.dryRun){process.stderr.write("Testing key... ");try{let s={...t,apiKey:n};await A(s,{url:tt(s.baseUrl)}),process.stderr.write(`Valid
|
|
128
|
+
`)}catch{throw new y("API key validation failed.",u.AUTH,"Check that your key is valid and belongs to a Token Plan.")}let m=Q();m.api_key=n,await H(m),process.stderr.write(`API key saved to ${L()}
|
|
129
|
+
`),await Jn({...t,apiKey:n})}else console.log("Would validate and save API key.");return}if(t.dryRun){console.log("Would start OAuth login flow.");return}let o;if(e.noBrowser)o=await Qe();else o=await Xe();let $={access_token:o.access_token,refresh_token:o.refresh_token,expires_at:new Date(Date.now()+o.expires_in*1000).toISOString(),token_type:"Bearer"};await mt($),process.stderr.write(`Logged in successfully.
|
|
130
130
|
`),process.stderr.write(`Credentials saved to ~/.mmx/credentials.json
|
|
131
|
-
`),await
|
|
132
|
-
`);try{let
|
|
133
|
-
Or set $MINIMAX_API_KEY`},
|
|
134
|
-
`);if(o)try{let
|
|
135
|
-
`)}catch{}if(!
|
|
136
|
-
`)}});async function*
|
|
137
|
-
`);r=
|
|
138
|
-
${
|
|
131
|
+
`),await Jn({...t,apiKey:$.access_token})}});var Qn=l({name:"auth status",description:"Show current authentication state and quota snapshot",usage:"mmx auth status",examples:["mmx auth status","mmx auth status --output json"],async run(t,e){try{let i=await Mt(t),r=S(t.output);if(r!=="text"){let $={method:i.method,source:i.source};if(i.method==="oauth"){let n=await d();if(n){if($.token_expires=n.expires_at,n.account)$.account=n.account}}else $.key=W(i.token);console.log(v($,r));return}console.log("Authentication Status:"),console.log(` Method: ${i.method}`),console.log(` Source: ${i.source}`);let o=i.token;if(console.log(` Key: ${W(o)}`),i.method==="oauth"){let $=await d();if($){if($.account)console.log(` Account: ${$.account}`);let n=new Date($.expires_at),m=Math.round((n.getTime()-Date.now())/60000);console.log(` Expires in: ${m} minutes`)}}process.stderr.write(`Fetching quota snapshot...
|
|
132
|
+
`);try{let $=tt(t.baseUrl),n=await A(t,{url:$,method:"GET"});pt(n.model_remains||[],t)}catch($){console.log(` Quota fetch failed: ${$.message}`)}}catch{let i=S(t.output);console.log(v({authenticated:!1,message:"Not authenticated.",hint:`Run: mmx auth login
|
|
133
|
+
Or set $MINIMAX_API_KEY`},i))}}});var On=l({name:"auth refresh",description:"Manually refresh OAuth token",usage:"mmx auth refresh",examples:["mmx auth refresh"],async run(t,e){let i=await d();if(!i)throw new y("Not applicable: not authenticated via OAuth.",u.USAGE,"Run mmx auth login first.");if(t.dryRun){console.log("Would refresh OAuth token.");return}let r=await Pt(i.refresh_token),o={access_token:r.access_token,refresh_token:r.refresh_token,expires_at:new Date(Date.now()+r.expires_in*1000).toISOString(),token_type:"Bearer",account:i.account};await mt(o);let $=S(t.output);if(t.quiet){console.log(o.expires_at);return}console.log(v({status:"Token refreshed",expires:o.expires_at},$))}});var Yn=l({name:"auth logout",description:"Revoke tokens and clear stored credentials",usage:"mmx auth logout [--yes] [--dry-run]",options:[{flag:"--yes",description:"Skip confirmation prompt"}],examples:["mmx auth logout","mmx auth logout --dry-run","mmx auth logout --yes"],async run(t,e){let i=await d(),r=Q(),o=!!r.api_key;if(t.dryRun){if(i)console.log("Would remove ~/.mmx/credentials.json");if(o)console.log("Would clear api_key from ~/.mmx/config.json");if(!i&&!o)console.log("No credentials to clear.");console.log("No changes made.");return}if(i)await Ne(),process.stderr.write(`Removed ~/.mmx/credentials.json
|
|
134
|
+
`);if(o)try{let $=r;delete $.api_key,await H($),process.stderr.write(`Cleared api_key from ~/.mmx/config.json
|
|
135
|
+
`)}catch{}if(!i&&!o)process.stderr.write(`No credentials to clear.
|
|
136
|
+
`)}});async function*Zt(t){let e=t.body?.getReader();if(!e)return;let i=new TextDecoder,r="";try{while(!0){let{done:o,value:$}=await e.read();if(o)break;r+=i.decode($,{stream:!0});let n=r.split(`
|
|
137
|
+
`);r=n.pop()||"";let m={};for(let s of n){if(s===""){if(m.data!==void 0)yield{data:m.data,event:m.event,id:m.id};m={};continue}if(s.startsWith(":"))continue;let c=s.indexOf(":");if(c===-1)continue;let x=s.slice(0,c),w=s.slice(c+1).trimStart();switch(x){case"data":m.data=m.data!==void 0?`${m.data}
|
|
138
|
+
${w}`:w;break;case"event":m.event=w;break;case"id":m.id=w;break}}}if(r.trim()&&r.includes("data:")){let o=r.indexOf(":");if(o!==-1)yield{data:r.slice(o+1).trimStart()}}}finally{e.releaseLock()}}import{readFileSync as he}from"fs";async function U(t){if(!J())return;let{defaultValue:e,message:i}=t,o=await(await Promise.resolve().then(() => (Vt(),Yt))).text({message:i,default:e,placeholder:e});if(typeof o==="symbol")return;return o}async function Vn(t){if(!J())return;let{message:e}=t,r=await(await Promise.resolve().then(() => (Vt(),Yt))).confirm({message:e});if(typeof r==="symbol")return;return r}function ct(t,e){throw new y(`Missing required argument: --${t}
|
|
139
139
|
Hint: In non-interactive (CI / agent) environments all required flags must be provided.
|
|
140
|
-
In an interactive terminal, run without --${
|
|
141
|
-
`),process.exit(1);o=[{role:"user",content
|
|
142
|
-
`);else if(
|
|
140
|
+
In an interactive terminal, run without --${t} and the CLI will prompt for it.`,u.USAGE,e)}function wo(t){let e=[],i;if(t.system)i=t.system;if(t.messagesFile){let r=t.messagesFile,o=r==="-"?he("/dev/stdin","utf-8"):he(r,"utf-8"),$=JSON.parse(o);for(let n of $)if(n.role==="system")i=typeof n.content==="string"?n.content:"";else e.push(n)}if(!t.message&&t.prompt)t.message=Array.isArray(t.prompt)?t.prompt:[t.prompt];if(t.message){let r=new Set(["system","user","assistant"]),o=t.message;for(let $ of o){let n=$.indexOf(":"),m=n!==-1?$.slice(0,n):"";if(r.has(m)){let s=$.slice(n+1);if(m==="system")i=s;else e.push({role:m,content:s})}else e.push({role:"user",content:$})}}return{system:i,messages:e}}function _o(t){return t.filter((e)=>e.type==="text").map((e)=>e.text).join("")}var Zn=l({name:"text chat",description:"Send a chat completion (MiniMax Messages API)",apiDocs:"/docs/api-reference/text-post",usage:"mmx text chat --message <text> [flags]",options:[{flag:"--model <model>",description:"Model ID (default: MiniMax-M2.7)"},{flag:"--message <text>",description:"Message text (repeatable, prefix role: to set role)",required:!0,type:"array"},{flag:"--messages-file <path>",description:"JSON file with messages array (use - for stdin)"},{flag:"--system <text>",description:"System prompt"},{flag:"--max-tokens <n>",description:"Maximum tokens to generate (default: 4096)",type:"number"},{flag:"--temperature <n>",description:"Sampling temperature (0.0, 1.0]",type:"number"},{flag:"--top-p <n>",description:"Nucleus sampling threshold",type:"number"},{flag:"--stream",description:"Stream response tokens (default: on in TTY)"},{flag:"--tool <json-or-path>",description:"Tool definition as JSON or file path (repeatable)",type:"array"}],examples:['mmx text chat --message "What is MiniMax?"','mmx text chat --model MiniMax-M2.7-highspeed --system "You are a coding assistant." --message "Write fizzbuzz in Python"','mmx text chat --message "Hello" --message "assistant:Hi!" --message "How are you?"',"cat conversation.json | mmx text chat --messages-file - --stream",'mmx text chat --message "Hello" --output json'],async run(t,e){let{system:i,messages:r}=wo(e),o=r;if(o.length===0)if(J({nonInteractive:t.nonInteractive})){let x=await U({message:"Enter your message:"});if(!x)process.stderr.write(`Chat cancelled.
|
|
141
|
+
`),process.exit(1);o=[{role:"user",content:x}]}else ct("message","mmx text chat --message <text>");let $=e.model||t.defaultTextModel||"MiniMax-M2.7",n=e.stream===!0||e.stream===void 0&&process.stdout.isTTY,m=S(t.output),s={model:$,messages:o,max_tokens:e.maxTokens??4096,stream:n};if(i)s.system=i;if(e.temperature!==void 0)s.temperature=e.temperature;if(e.topP!==void 0)s.top_p=e.topP;if(e.tool){let x=e.tool.map((w)=>{try{return JSON.parse(w)}catch{try{let h=he(w,"utf-8");return JSON.parse(h)}catch{throw new y(`Invalid tool definition: "${w}" is neither valid JSON nor a readable file.`,u.USAGE)}}});s.tools=x}if(t.dryRun){console.log(v({request:s},m));return}let c=Ke(t.baseUrl);if(n){let x=await P(t,{url:c,method:"POST",body:s,stream:!0,authStyle:"x-api-key"}),w=x.headers.get("content-type")||"";if(!w.includes("text/event-stream")&&!w.includes("stream"))throw new y(`Expected SSE stream but got content-type "${w}". Server may be experiencing issues.`,u.GENERAL);let h="",_=!1,R=t.noColor?"":"\x1B[2m",k=t.noColor?"":"\x1B[0m",G=process.stdout.isTTY?process.stdout:process.stderr,N=process.stdout;for await(let Y of Zt(x)){if(Y.data==="[DONE]")break;try{let B=JSON.parse(Y.data);if(B.type==="content_block_start"){if(B.content_block.type==="thinking")_=!0,G.write(`${R}Thinking:
|
|
142
|
+
`);else if(B.content_block.type==="text"&&_)G.write(`${k}
|
|
143
143
|
|
|
144
144
|
Response:
|
|
145
|
-
`),
|
|
146
|
-
|
|
147
|
-
`)
|
|
148
|
-
`)}}}}function
|
|
149
|
-
`)
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
`)
|
|
154
|
-
`)
|
|
155
|
-
`);return}let
|
|
156
|
-
`)}}
|
|
157
|
-
`)
|
|
158
|
-
`)
|
|
159
|
-
`)
|
|
160
|
-
`);
|
|
161
|
-
`);return}process.
|
|
162
|
-
`)
|
|
163
|
-
`)
|
|
164
|
-
`)}
|
|
145
|
+
`),_=!1}else if(B.type==="content_block_delta"){if(B.delta.type==="text_delta")h+=B.delta.text,N.write(B.delta.text);else if(B.delta.type==="thinking_delta")G.write(B.delta.thinking)}}catch(B){process.stderr.write(`
|
|
146
|
+
${R}[warning] Failed to parse stream chunk: ${B instanceof Error?B.message:String(B)}${k}
|
|
147
|
+
`)}}if(_)G.write(k);if(N.write(`
|
|
148
|
+
`),m==="json")console.log(v({content:h},m))}else{let x=await A(t,{url:c,method:"POST",body:s,authStyle:"x-api-key"}),w=_o(x.content);if(t.quiet||m==="text")console.log(w);else console.log(v(x,m))}}});import{writeFileSync as ho}from"fs";function ut(t,e,i,r){if(e){let o=t.data.audio;if(!o)throw new y("API response missing audio data (audio field is empty).",u.GENERAL);if(!/^[0-9a-fA-F]*$/.test(o))throw new y("API returned invalid audio data (not valid hex).",u.GENERAL);if(o.length%2!==0)throw new y("API returned truncated audio data (odd-length hex string).",u.GENERAL);try{ho(e,Buffer.from(o,"hex"))}catch($){if($.code==="ENOSPC")throw new y("Disk full — cannot write audio file.",u.GENERAL,"Free up disk space and try again.");throw $}if(r)console.log(e);else console.log(v({saved:e,duration_ms:t.extra_info?.audio_length,size_bytes:t.extra_info?.audio_size,sample_rate:t.extra_info?.audio_sample_rate},i))}else{let o=t.data.audio_url??t.data.audio;if(r)console.log(o);else console.log(v({url:o,duration_ms:t.extra_info?.audio_length,size_bytes:t.extra_info?.audio_size},i))}}zt();import{writeFileSync as vo}from"fs";var be=l({name:"speech synthesize",description:"Synchronous TTS, up to 10k chars (speech-2.8-hd / 2.6 / 02)",apiDocs:"/docs/api-reference/speech-t2a-http",usage:"mmx speech synthesize --text <text> [--out <path>] [flags]",options:[{flag:"--model <model>",description:"Model ID (default: speech-2.8-hd)"},{flag:"--text <text>",description:"Text to synthesize"},{flag:"--text-file <path>",description:"Read text from file (use - for stdin)"},{flag:"--voice <id>",description:"Voice ID (default: English_expressive_narrator)"},{flag:"--speed <n>",description:"Speech speed multiplier",type:"number"},{flag:"--volume <n>",description:"Volume level",type:"number"},{flag:"--pitch <n>",description:"Pitch adjustment",type:"number"},{flag:"--format <fmt>",description:"Audio format (default: mp3)"},{flag:"--sample-rate <hz>",description:"Sample rate (default: 32000)",type:"number"},{flag:"--bitrate <bps>",description:"Bitrate (default: 128000)",type:"number"},{flag:"--channels <n>",description:"Audio channels (default: 1)",type:"number"},{flag:"--language <code>",description:"Language boost"},{flag:"--subtitles",description:"Include subtitle timing data"},{flag:"--pronunciation <from/to>",description:"Custom pronunciation (repeatable)",type:"array"},{flag:"--out <path>",description:"Save audio to file (uses hex decoding)"},{flag:"--stream",description:"Stream raw audio to stdout"}],examples:['mmx speech synthesize --text "Hello, world!"','mmx speech synthesize --text "Hello, world!" --out hello.mp3','mmx speech synthesize --text "Hello" --subtitles --out hello.mp3','echo "Breaking news." | mmx speech synthesize --text-file - --out news.mp3','mmx speech synthesize --text "Stream" --stream | mpv --no-terminal -'],async run(t,e){let i=e.text??e._positional?.[0];if(e.textFile)i=bt(e.textFile);if(!i)throw new y("--text or --text-file is required.",u.USAGE,'mmx speech synthesize --text "Hello" --out hello.mp3');let r=e.model||t.defaultSpeechModel||"speech-2.8-hd",o=e.voice||"English_expressive_narrator",$=new Date().toISOString().slice(0,19).replace(/[T:]/g,"-"),n=e.format||"mp3",m=e.out??`speech_${$}.${n}`,s="hex",c=S(t.output),x={model:r,text:i,voice_setting:{voice_id:o,speed:e.speed??void 0,vol:e.volume??void 0,pitch:e.pitch??void 0},audio_setting:{format:e.format||"mp3",sample_rate:e.sampleRate??32000,bitrate:e.bitrate??128000,channel:e.channels??1},output_format:s,stream:e.stream===!0};if(e.language)x.language_boost=e.language;if(e.subtitles)x.subtitle_enable=!0;if(e.pronunciation)x.pronunciation_dict=e.pronunciation.map((_)=>{let[R,k]=_.split("/");return{tone:k||R,text:R}});if(t.dryRun){console.log(v({request:x},c));return}let w=He(t.baseUrl);if(e.stream){let _=await P(t,{url:w,method:"POST",body:x,stream:!0});for await(let R of Zt(_)){if(!R.data||R.data==="[DONE]")break;let j=JSON.parse(R.data)?.data?.audio;if(j)process.stdout.write(Buffer.from(j,"hex"))}return}let h=await A(t,{url:w,method:"POST",body:x});if(!t.quiet)process.stderr.write(`[Model: ${r}]
|
|
149
|
+
`);if(ut(h,m,c,t.quiet),e.subtitles&&h.data.subtitle_file)try{let _=await fetch(h.data.subtitle_file);if(!_.ok)throw new y(`Failed to download subtitle file: ${_.status}`,u.GENERAL);let R=await _.json();if(R?.length){let k=m.replace(/\.[^.]+$/,"")+".srt",j=R.map((G,N)=>{let Y=(B)=>{let M=String(Math.floor(B/3600000)).padStart(2,"0"),V=String(Math.floor(B%3600000/60000)).padStart(2,"0"),a=String(Math.floor(B%60000/1000)).padStart(2,"0"),I=String(Math.round(B%1000)).padStart(3,"0");return`${M}:${V}:${a},${I}`};return`${N+1}
|
|
150
|
+
${Y(G.time_begin)} --> ${Y(G.time_end)}
|
|
151
|
+
${G.text}`}).join(`
|
|
152
|
+
|
|
153
|
+
`);if(vo(k,j,"utf-8"),!t.quiet)console.log(v({subtitles:k},c));else console.log(k)}}catch(_){if(!t.quiet)process.stderr.write(`Warning: failed to download subtitles: ${_.message}
|
|
154
|
+
`)}else if(e.subtitles&&!h.data.subtitle_file){if(!t.quiet)process.stderr.write(`Warning: subtitles requested but not returned by API
|
|
155
|
+
`)}}});function lo(t){let e=t.match(/^(.+?)_[A-Z]/);return e?e[1]:t}function Ro(t,e){let i=e.toLowerCase();return t.filter((r)=>{let o=lo(r.voice_id).toLowerCase();return o===i||o.startsWith(i+"_")||o.startsWith(i+" (")})}var dn=l({name:"speech voices",description:"List available system voices",usage:"mmx speech voices [--language <lang>]",options:[{flag:"--language <lang>",description:"Filter voices by language (e.g. english, korean, japanese)"}],examples:["mmx speech voices","mmx speech voices --language english","mmx speech voices --language korean","mmx speech voices --output json"],async run(t,e){let i=S(t.output);if(t.dryRun){console.log(v({request:{voice_type:"system"}},i));return}let o=(await A(t,{url:Ue(t.baseUrl),method:"POST",body:{voice_type:"system"}})).system_voice??[],$=e.language;if($){let n=Ro(o,$);if(i!=="text"){console.log(v(n,i));return}for(let m of n){let s=m.description?.join("; ")||"",c=m.voice_name?` (${m.voice_name})`:"";if(console.log(` ${m.voice_id}${c}`),s)console.log(` ${s}`)}}else{if(i!=="text"){console.log(v(o.map((n)=>n.voice_id),i));return}for(let n of o)console.log(n.voice_id)}}});import{createWriteStream as ko,unlinkSync as So}from"fs";var Wn=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function Kn(t){let e=process.stderr.isTTY,i=0,r=null,o=t;return{start(){if(!e)return;r=setInterval(()=>{process.stderr.write(`\r${Wn[i%Wn.length]} ${o}`),i++},80)},update($){o=$},stop($){if(r)clearInterval(r),r=null;if(e){if(process.stderr.write("\r\x1B[K"),$)process.stderr.write(`${$}
|
|
156
|
+
`)}}}}function Hn(t,e=""){let i=process.stderr.isTTY,r=30;return{update(o){if(!i)return;let $=Math.min(1,o/t),n=Math.round(30*$),m=30-n,s="█".repeat(n)+"░".repeat(m),c=`${Math.round($*100)}%`;process.stderr.write(`\r${e} ${s} ${c}`)},finish(){if(i)process.stderr.write(`
|
|
157
|
+
`)}}}async function rt(t,e,i){let r=await fetch(t);if(!r.ok)throw new y(`Download failed: HTTP ${r.status}`,u.GENERAL);let o=Number(r.headers.get("content-length")||0),$=r.body?.getReader();if(!$)throw new y("No response body",u.GENERAL);let n=ko(e),m=o>0&&!i?.quiet?Hn(o,"Downloading"):null,s=0,c=!1;try{let x=new Promise((w,h)=>{n.on("error",h)});while(!0){let{done:w,value:h}=await Promise.race([$.read(),x]);if(w)break;if(!n.write(h))await new Promise((R)=>n.once("drain",R));s+=h.byteLength,m?.update(s)}c=!0}finally{if($.releaseLock(),m?.finish(),await new Promise((x,w)=>{n.on("finish",x),n.on("error",w),n.end()}),!c)try{So(e)}catch{}}return{size:s}}function dt(t){if(t<1024)return`${t} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;if(t<1073741824)return`${(t/1048576).toFixed(1)} MB`;return`${(t/1073741824).toFixed(1)} GB`}import{mkdirSync as Mo,existsSync as Un,readFileSync as Ao}from"fs";import{join as jo,resolve as Go,extname as Bo}from"path";var To={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".webp":"image/webp"},an=l({name:"image generate",description:"Generate images (image-01 / image-01-live)",apiDocs:"/docs/api-reference/image-generation-t2i",usage:"mmx image generate --prompt <text> [flags]",options:[{flag:"--prompt <text>",description:"Image description",required:!0},{flag:"--aspect-ratio <ratio>",description:"Aspect ratio (e.g. 16:9, 1:1). Ignored if --width and --height are both specified."},{flag:"--n <count>",description:"Number of images to generate (default: 1)",type:"number"},{flag:"--seed <n>",description:"Random seed for reproducible generation (same seed + prompt = identical output)",type:"number"},{flag:"--width <px>",description:"Custom width in pixels. Range [512, 2048], must be multiple of 8. Only effective for image-01 model. Overrides --aspect-ratio if set.",type:"number"},{flag:"--height <px>",description:"Custom height in pixels. Range [512, 2048], must be multiple of 8. Only effective for image-01 model. Overrides --aspect-ratio if set.",type:"number"},{flag:"--prompt-optimizer",description:"Automatically optimize the prompt before generation for better results."},{flag:"--aigc-watermark",description:"Embed AI-generated content watermark in the output image."},{flag:"--subject-ref <params>",description:"Subject reference for character consistency. Format: type=character,image=path-or-url"},{flag:"--out-dir <dir>",description:"Download images to directory"},{flag:"--out-prefix <prefix>",description:"Filename prefix (default: image)"}],examples:['mmx image generate --prompt "A cat in a spacesuit on Mars" --aspect-ratio 16:9','mmx image generate --prompt "Logo design" --n 3 --out-dir ./generated/','mmx image generate --prompt "Mountain landscape" --quiet',"# Reproducible output with seed",'mmx image generate --prompt "A castle" --seed 42',"# Custom dimensions (must be 512–2048, multiple of 8)",'mmx image generate --prompt "Wide landscape" --width 1920 --height 1080',"# Optimized prompt with watermark",'mmx image generate --prompt "sunset" --prompt-optimizer --aigc-watermark'],async run(t,e){let i=e.prompt??e._positional?.[0];if(!i)if(J({nonInteractive:t.nonInteractive})){let _=await U({message:"Enter your image prompt:"});if(!_)process.stderr.write(`Image generation cancelled.
|
|
158
|
+
`),process.exit(1);i=_}else ct("prompt","mmx image generate --prompt <text>");let{width:r,height:o}=e;if(r!==void 0&&o===void 0)throw new y("--width requires --height. Both must be specified together.",u.USAGE);if(o!==void 0&&r===void 0)throw new y("--height requires --width. Both must be specified together.",u.USAGE);if(r!==void 0&&o!==void 0){let _=(R,k)=>{if(k<512||k>2048)throw new y(`--${R} must be between 512 and 2048, got ${k}.`,u.USAGE);if(k%8!==0)throw new y(`--${R} must be a multiple of 8, got ${k}.`,u.USAGE)};_("width",r),_("height",o)}let $={model:"image-01",prompt:i,aspect_ratio:r!==void 0&&o!==void 0?void 0:e.aspectRatio||void 0,n:e.n??1,seed:e.seed,width:r,height:o,prompt_optimizer:e.promptOptimizer===!0||void 0,aigc_watermark:e.aigcWatermark===!0||void 0};if(e.subjectRef){let _=e.subjectRef,R=Object.fromEntries(_.split(",").map((j)=>{let G=j.indexOf("=");if(G===-1)return[j,""];return[j.slice(0,G),j.slice(G+1)]})),k={type:R.type||"character"};if(R.image)if(R.image.startsWith("http"))k.image_url=R.image;else{let j=Go(R.image),G=Ao(j),N=Bo(j).toLowerCase(),Y=To[N]||"image/jpeg";k.image_file=`data:${Y};base64,${G.toString("base64")}`}$.subject_reference=[k]}let n=S(t.output);if(t.dryRun){console.log(v({request:$},n));return}let m=ae(t.baseUrl),s=await A(t,{url:m,method:"POST",body:$}),c=s.data.image_urls||[];if(!t.quiet)process.stderr.write(`[Model: image-01]
|
|
159
|
+
`);let x=e.outDir??".";if(!Un(x))Mo(x,{recursive:!0});let w=e.outPrefix||"image",h=[];for(let _=0;_<c.length;_++){let R=`${w}_${String(_+1).padStart(3,"0")}.jpg`,k=jo(x,R);if(Un(k))process.stderr.write(`Warning: overwriting existing file: ${k}
|
|
160
|
+
`);await rt(c[_],k,{quiet:t.quiet}),h.push(k)}if(n==="json")console.log(v({id:s.data.task_id,saved:h,success_count:s.data.success_count,failed_count:s.data.failed_count},n));else if(t.quiet)console.log(h.join(`
|
|
161
|
+
`));else console.log(v({id:s.data.task_id,saved:h,success_count:s.data.success_count,failed_count:s.data.failed_count},n))}});async function In(t,e){let i=Date.now()+e.timeoutSec*1000,r=Kn("Polling...");if(!t.quiet)r.start();try{while(Date.now()<i){let o=await A(t,{url:e.url});if(e.getStatus&&!t.quiet)r.update(`Status: ${e.getStatus(o)}`);if(e.isComplete(o))return r.stop("Done."),o;if(e.isFailed(o)){r.stop("Failed.");let $=e.getStatus?e.getStatus(o):"failed",n=o?.base_resp?` (${o.base_resp.status_msg})`:"";throw new y(`Task ${$}.${n}`,u.GENERAL,"Check the MiniMax dashboard or --verbose output for details.")}await new Promise(($)=>setTimeout($,e.intervalSec*1000))}}finally{r.stop()}throw new y("Polling timed out.",u.TIMEOUT,"Try increasing --timeout or check task status manually.")}import{readFileSync as ve}from"fs";import{extname as le}from"path";var Re={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".webp":"image/webp"},Pn=l({name:"video generate",description:"Generate a video (T2V: Hailuo-2.3 / 2.3-Fast / Hailuo-02 | I2V: I2V-01 / I2V-01-Director / I2V-01-live | S2V: S2V-01)",apiDocs:"/docs/api-reference/video-generation",usage:"mmx video generate --prompt <text> [flags]",options:[{flag:"--model <model>",description:"Model ID (default: MiniMax-Hailuo-2.3). Auto-switched to Hailuo-02 with --last-frame, or S2V-01 with --subject-image."},{flag:"--prompt <text>",description:"Video description",required:!0},{flag:"--first-frame <path-or-url>",description:"First frame image (local path or URL). Auto base64-encoded for local files."},{flag:"--last-frame <path-or-url>",description:"Last frame image (local path or URL). Enables SEF (start-end frame) interpolation mode with Hailuo-02 model. Requires --first-frame."},{flag:"--subject-image <path-or-url>",description:"Subject reference image for character consistency (local path or URL). Switches to S2V-01 model."},{flag:"--callback-url <url>",description:"Webhook URL for completion notification"},{flag:"--download <path>",description:"Save video to file on completion"},{flag:"--no-wait",description:"Return task ID immediately without waiting"},{flag:"--async",description:"Return task ID immediately (agent/CI mode, same as --no-wait but explicit)"},{flag:"--poll-interval <seconds>",description:"Polling interval when waiting (default: 5)",type:"number"}],examples:['mmx video generate --prompt "A man reads a book. Static shot."','mmx video generate --prompt "Ocean waves at sunset." --download sunset.mp4','mmx video generate --prompt "A robot painting." --async --quiet','mmx video generate --prompt "A robot painting." --no-wait --quiet',"# SEF: first + last frame interpolation (uses Hailuo-02 model)",'mmx video generate --prompt "Walk forward" --first-frame start.jpg --last-frame end.jpg',"# Subject reference: character consistency (uses S2V-01 model)",'mmx video generate --prompt "A detective walking" --subject-image character.jpg'],async run(t,e){let i=e.prompt;if(!i)if(J({nonInteractive:t.nonInteractive})){let M=await U({message:"Enter your video prompt:"});if(!M)process.stderr.write(`Video generation cancelled.
|
|
162
|
+
`),process.exit(1);i=M}else ct("prompt","mmx video generate --prompt <text>");if(e.lastFrame&&e.subjectImage)throw new y("--last-frame and --subject-image cannot be used together (SEF and S2V are different modes).",u.USAGE,"mmx video generate --prompt <text> --first-frame <path> --last-frame <path>");let r=e.model,o;if(r)o=r;else if(e.lastFrame)o="MiniMax-Hailuo-02";else if(e.subjectImage)o="S2V-01";else o=t.defaultVideoModel||"MiniMax-Hailuo-2.3";let $=S(t.output),n={model:o,prompt:i};if(e.firstFrame){let M=e.firstFrame;if(M.startsWith("http"))n.first_frame_image=M;else{let V=ve(M),a=le(M).toLowerCase(),I=Re[a]||"image/jpeg";n.first_frame_image=`data:${I};base64,${V.toString("base64")}`}}if(e.lastFrame){if(!e.firstFrame)throw new y("--last-frame requires --first-frame (SEF mode).",u.USAGE,"mmx video generate --prompt <text> --first-frame <path> --last-frame <path>");let M=e.lastFrame;if(M.startsWith("http"))n.last_frame_image=M;else{let V=ve(M),a=le(M).toLowerCase(),I=Re[a]||"image/jpeg";n.last_frame_image=`data:${I};base64,${V.toString("base64")}`}}if(e.subjectImage){let M=e.subjectImage,V;if(M.startsWith("http"))V=M;else{let a=ve(M),I=le(M).toLowerCase();V=`data:${Re[I]||"image/jpeg"};base64,${a.toString("base64")}`}n.subject_reference=[{type:"character",image:[V]}]}if(e.callbackUrl)n.callback_url=e.callbackUrl;if(t.dryRun){console.log(v({request:n},$));return}let m=Ie(t.baseUrl),c=(await A(t,{url:m,method:"POST",body:n})).task_id;if(!t.quiet)process.stderr.write(`[Model: ${o}]
|
|
163
|
+
`);if(e.noWait||t.async){process.stdout.write(JSON.stringify({taskId:c})),process.stdout.write(`
|
|
164
|
+
`);return}let x=e.pollInterval??5,w=At(t.baseUrl,c),h=await In(t,{url:w,intervalSec:x,timeoutSec:t.timeout,isComplete:(M)=>M.status==="Success",isFailed:(M)=>M.status==="Failed",getStatus:(M)=>M.status});if(!h.file_id)throw new y("Task completed but no file_id returned.",u.GENERAL);let R=(await A(t,{url:jt(t.baseUrl,h.file_id)})).file?.download_url;if(!R)throw new y("No download URL available for this file.",u.GENERAL);if(e.download){let M=e.download,{size:V}=await rt(R,M,{quiet:t.quiet});if(t.quiet)console.log(M);else console.log(v({task_id:c,status:"Success",file_id:h.file_id,saved:M,size:dt(V)},$));return}let k=await import("os"),{join:j}=await import("path"),G=j(k.tmpdir(),"mmx-video"),{existsSync:N,mkdirSync:Y}=await import("fs");if(!N(G))Y(G,{recursive:!0});let B=j(G,`${c}.mp4`);await rt(R,B,{quiet:t.quiet}),process.stdout.write(B),process.stdout.write(`
|
|
165
|
+
`)}});var Cn=l({name:"video task get",description:"Query video task status",usage:"mmx video task get --task-id <id>",options:[{flag:"--task-id <id>",description:"Video generation task ID"}],examples:["mmx video task get --task-id 106916112212032","mmx video task get --task-id 106916112212032 --output json"],async run(t,e){let i=e.taskId;if(!i)throw new y("--task-id is required.",u.USAGE,"mmx video task get --task-id <id>");if(t.dryRun){console.log(`Would query task: ${i}`);return}let r=At(t.baseUrl,i),o=await A(t,{url:r}),$=S(t.output);if(t.quiet){console.log(o.status);return}console.log(v({task_id:o.task_id,status:o.status,file_id:o.file_id,video_width:o.video_width,video_height:o.video_height},$))}});var Ln=l({name:"video download",description:"Download a completed video by file ID",usage:"mmx video download --file-id <id> --out <path>",options:[{flag:"--file-id <id>",description:"File ID to download"},{flag:"--out <path>",description:"Output file path"}],examples:["mmx video download --file-id 176844028768320 --out video.mp4","mmx video download --file-id 176844028768320 --out video.mp4 --quiet"],async run(t,e){let i=e.fileId;if(!i)throw new y("--file-id is required.",u.USAGE,"mmx video download --file-id <id> --out <path>");let r=e.out;if(!r)throw new y("--out is required.",u.USAGE,"mmx video download --file-id <id> --out video.mp4");if(t.dryRun){console.log(`Would download file ${i} to ${r}`);return}let o=jt(t.baseUrl,i),n=(await A(t,{url:o})).file?.download_url;if(!n)throw new y("No download URL available for this file.",u.GENERAL,"The file may still be processing. Check task status first.");let{size:m}=await rt(n,r,{quiet:t.quiet}),s=S(t.output);if(t.quiet){console.log(r);return}console.log(v({saved:r,size:dt(m)},s))}});zt();function En(t){return(t.apiKey??t.fileApiKey??"").startsWith("sk-cp-")}function fn(t){if(t.defaultMusicModel)return t.defaultMusicModel;return En(t)?"music-2.6":"music-2.6-free"}var qo=new Set(["music-cover","music-cover-free"]);function Fn(t){if(t.defaultMusicModel&&qo.has(t.defaultMusicModel))return t.defaultMusicModel;return En(t)?"music-cover":"music-cover-free"}var gn=l({name:"music generate",description:"Generate a song (music-2.6 / music-2.6-free / music-2.5+ / music-2.5)",apiDocs:"/docs/api-reference/music-generation",usage:"mmx music generate --prompt <text> (--lyrics <text> | --instrumental | --lyrics-optimizer) [--out <path>] [flags]",options:[{flag:"--prompt <text>",description:'Music style description (e.g. "cinematic orchestral, building tension"). Max 2000 chars when combined with structured flags.'},{flag:"--lyrics <text>",description:"Song lyrics with structure tags (newline separated). Supported: [Intro], [Verse], [Pre Chorus], [Chorus], [Interlude], [Bridge], [Outro], [Post Chorus], [Transition], [Break], [Hook], [Build Up], [Inst], [Solo]. Tags must be clean — no descriptions inside brackets (they will be sung). Max 3500 chars."},{flag:"--lyrics-file <path>",description:"Read lyrics from file (use - for stdin). Same tag rules as --lyrics."},{flag:"--lyrics-optimizer",description:"Auto-generate lyrics from prompt (cannot be used with --lyrics or --instrumental)"},{flag:"--instrumental",description:"Generate instrumental music (no vocals). music-2.6/music-2.5+: native is_instrumental flag; music-2.5: lyrics workaround. Cannot be used with --lyrics."},{flag:"--vocals <text>",description:'Vocal style, e.g. "warm male baritone", "bright female soprano", "duet with harmonies"'},{flag:"--genre <text>",description:"Music genre, e.g. folk, pop, jazz, electronic"},{flag:"--mood <text>",description:"Mood or emotion, e.g. warm, melancholic, uplifting"},{flag:"--instruments <text>",description:'Instruments to feature, e.g. "acoustic guitar, piano, strings"'},{flag:"--tempo <text>",description:"Tempo description, e.g. fast, slow, moderate"},{flag:"--bpm <number>",description:"Exact tempo in beats per minute",type:"number"},{flag:"--key <text>",description:"Musical key, e.g. C major, A minor, G sharp"},{flag:"--avoid <text>",description:"Elements to avoid in the generated music"},{flag:"--use-case <text>",description:'Use case context, e.g. "background music for video", "theme song"'},{flag:"--structure <text>",description:'Song structure, e.g. "verse-chorus-verse-bridge-chorus"'},{flag:"--references <text>",description:'Reference tracks or artists, e.g. "similar to Ed Sheeran"'},{flag:"--extra <text>",description:"Additional fine-grained requirements not covered above"},{flag:"--model <model>",description:"Model: music-2.6 (recommended), music-2.6-free (default, unlimited), music-2.5+, or music-2.5."},{flag:"--output-format <fmt>",description:"Return format: hex (default, saved to file) or url (24h expiry, download promptly). When --stream, only hex."},{flag:"--aigc-watermark",description:"Embed AI-generated content watermark in audio for content provenance"},{flag:"--format <fmt>",description:"Audio format (default: mp3)"},{flag:"--sample-rate <hz>",description:"Sample rate (default: 44100)",type:"number"},{flag:"--bitrate <bps>",description:"Bitrate (default: 256000)",type:"number"},{flag:"--stream",description:"Stream raw audio to stdout"},{flag:"--out <path>",description:"Save audio to file (uses hex decoding)"}],examples:['mmx music generate --prompt "Upbeat pop" --lyrics "La la la..." --out summer.mp3','mmx music generate --prompt "Indie folk, melancholic" --lyrics-file song.txt --out my_song.mp3',"# Auto-generate lyrics from prompt:",'mmx music generate --prompt "Upbeat pop about summer" --lyrics-optimizer --out summer.mp3',"# Instrumental:",'mmx music generate --prompt "Cinematic orchestral, building tension" --instrumental --out bgm.mp3',"# URL output (24h expiry — download promptly):",'mmx music generate --prompt "Upbeat pop" --lyrics "La la la..." --output-format url',"# Instrumental with music-2.5+:",'mmx music generate --prompt "Cinematic orchestral" --model "music-2.5+" --instrumental --out bgm.mp3',"# Detailed prompt with vocal characteristics:",'mmx music generate --prompt "Warm morning folk" --vocals "male and female duet, harmonies in chorus" --instruments "acoustic guitar, piano" --bpm 95 --lyrics-file song.txt --out duet.mp3'],async run(t,e){let{prompt:i,lyrics:r}=e,o=e.instrumental===!0,$=e.lyricsOptimizer===!0;if(e.lyricsFile)r=bt(e.lyricsFile);if(o&&(r||e.lyricsFile))throw new y("Cannot use --instrumental with --lyrics or --lyrics-file.",u.USAGE,"mmx music generate --prompt <style> --instrumental");if($&&(r||o))throw new y("Cannot use --lyrics-optimizer with --lyrics, --lyrics-file, or --instrumental.",u.USAGE,"mmx music generate --prompt <text> --lyrics-optimizer");if(!i&&!r&&!o&&!$)throw new y("At least one of --prompt or --lyrics is required.",u.USAGE,"mmx music generate --prompt <text> --lyrics <text>");if(!o&&!$&&!r?.trim())throw new y("Lyrics are required. Add --lyrics or --lyrics-file, or use --instrumental for pure music, or --lyrics-optimizer to auto-generate.",u.USAGE,"mmx music generate --prompt <text> --lyrics <text>");let n=[];if(e.vocals)n.push(`Vocals: ${e.vocals}`);if(e.genre)n.push(`Genre: ${e.genre}`);if(e.mood)n.push(`Mood: ${e.mood}`);if(e.instruments)n.push(`Instruments: ${e.instruments}`);if(e.tempo)n.push(`Tempo: ${e.tempo}`);if(e.bpm)n.push(`BPM: ${e.bpm}`);if(e.key)n.push(`Key: ${e.key}`);if(e.avoid)n.push(`Avoid: ${e.avoid}`);if(e.useCase)n.push(`Use case: ${e.useCase}`);if(e.structure)n.push(`Structure: ${e.structure}`);if(e.references)n.push(`References: ${e.references}`);if(e.extra)n.push(`Extra: ${e.extra}`);if(n.length>0){let G=n.join(". ");i=i?`${i}. ${G}`:G}let m=new Date().toISOString().slice(0,19).replace(/[T:]/g,"-"),s=e.format||"mp3",c=e.out??`music_${m}.${s}`,x=S(t.output),w=e.model||fn(t),h=["music-2.6","music-2.6-free","music-2.5+","music-2.5"];if(e.model&&!h.includes(w))throw new y(`Invalid model "${w}". Valid models: ${h.join(", ")}`,u.USAGE,"mmx music generate --model music-2.6");let _=e.outputFormat||"hex";if(_!=="hex"&&_!=="url")throw new y('--output-format must be "hex" or "url".',u.USAGE,"mmx music generate --output-format url");if(e.stream&&_==="url")throw new y("--stream and --output-format url cannot be used together. Streaming requires hex format.",u.USAGE,"mmx music generate --output-format url");let R={model:w,prompt:i,lyrics:r,is_instrumental:o||void 0,lyrics_optimizer:$||void 0,audio_setting:{format:e.format||"mp3",sample_rate:e.sampleRate??44100,bitrate:e.bitrate??256000},output_format:e.stream===!0?"hex":_,stream:e.stream===!0};if(e.aigcWatermark)R.aigc_watermark=!0;if(t.dryRun){console.log(v({request:R},x));return}let k=Gt(t.baseUrl);if(e.stream){let N=(await P(t,{url:k,method:"POST",body:R,stream:!0})).body?.getReader();if(!N)throw new y("No response body",u.GENERAL);while(!0){let{done:Y,value:B}=await N.read();if(Y)break;process.stdout.write(B)}N.releaseLock();return}let j=await A(t,{url:k,method:"POST",body:R});if(!t.quiet)process.stderr.write(`[Model: ${w}]
|
|
166
|
+
`);if(_==="url"){if(j.data?.audio_url)console.log(j.data.audio_url);else throw new y("Requested URL output but API did not return audio_url.",u.GENERAL);return}ut(j,c,x,t.quiet)}});import{readFileSync as No}from"fs";var Dn=l({name:"music cover",description:"Generate a cover version of a song based on reference audio (music-cover / music-cover-free)",apiDocs:"/docs/api-reference/music-generation",usage:"mmx music cover --prompt <text> (--audio <url> | --audio-file <path>) [--lyrics <text>] [--out <path>] [flags]",options:[{flag:"--model <model>",description:"Model: music-cover (Token Plan), music-cover-free (Pay-as-you-go, default). Override only if needed."},{flag:"--prompt <text>",description:'Target cover style, e.g. "Indie folk, acoustic guitar, warm male vocal"'},{flag:"--audio <url>",description:"URL of the reference audio (mp3, wav, flac, etc. — 6s to 6min, max 50MB)"},{flag:"--audio-file <path>",description:"Local reference audio file (auto base64-encoded)"},{flag:"--lyrics <text>",description:"Cover lyrics. If omitted, extracted from reference audio via ASR."},{flag:"--lyrics-file <path>",description:"Read lyrics from file (use - for stdin)"},{flag:"--seed <number>",description:"Random seed 0–1000000 for reproducible results",type:"number"},{flag:"--format <fmt>",description:"Audio format: mp3, wav, pcm (default: mp3)"},{flag:"--sample-rate <hz>",description:"Sample rate: 16000, 24000, 32000, 44100 (default: 44100)",type:"number"},{flag:"--bitrate <bps>",description:"Bitrate: 32000, 64000, 128000, 256000 (default: 256000)",type:"number"},{flag:"--channel <n>",description:"Channels: 1 (mono) or 2 (stereo, default)",type:"number"},{flag:"--stream",description:"Stream raw audio to stdout"},{flag:"--out <path>",description:"Save audio to file"}],examples:['mmx music cover --prompt "Indie folk, acoustic guitar, warm male vocal" --audio https://example.com/song.mp3 --out cover.mp3','mmx music cover --prompt "Jazz, piano, slow" --audio-file original.mp3 --lyrics-file lyrics.txt --out jazz_cover.mp3','mmx music cover --prompt "Pop, upbeat" --audio https://example.com/ref.mp3 --seed 42 --out reproducible.mp3'],async run(t,e){let{prompt:i,audio:r,audioFile:o}=e;if(!i)throw new y("--prompt is required.",u.USAGE,"mmx music cover --prompt <text> --audio <url>");if(!r&&!o)throw new y("One of --audio <url> or --audio-file <path> is required.",u.USAGE,"mmx music cover --prompt <text> --audio <url>");if(r&&o)throw new y("Use either --audio or --audio-file, not both.",u.USAGE);let $=e.lyrics;if(e.lyricsFile){let{readTextFromPathOrStdin:k}=await Promise.resolve().then(() => (zt(),zn));$=k(e.lyricsFile)}let n=new Date().toISOString().slice(0,19).replace(/[T:]/g,"-"),m=e.format||"mp3",s=e.out??`cover_${n}.${m}`,c=S(t.output),x=e.model||Fn(t),w=["music-cover","music-cover-free"];if(e.model&&!w.includes(x))throw new y(`Invalid model "${x}". Valid models: ${w.join(", ")}`,u.USAGE,"mmx music cover --model music-cover");let h={model:x,prompt:i,lyrics:$,seed:e.seed,audio_setting:{format:m,sample_rate:e.sampleRate??44100,bitrate:e.bitrate??256000,channel:e.channel??void 0},output_format:"hex",stream:e.stream===!0};if(r)h.audio_url=r;else h.audio_base64=No(o).toString("base64");if(t.dryRun){console.log(v({request:h},c));return}let _=Gt(t.baseUrl);if(e.stream){let j=(await P(t,{url:_,method:"POST",body:h,stream:!0})).body?.getReader();if(!j)throw new y("No response body",u.GENERAL);while(!0){let{done:G,value:N}=await j.read();if(G)break;process.stdout.write(N)}j.releaseLock();return}let R=await A(t,{url:_,method:"POST",body:h});if(!t.quiet)process.stderr.write(`[Model: ${x}]
|
|
167
|
+
`);ut(R,s,c,t.quiet)}});var ke=l({name:"search query",description:"Search the web via MiniMax",usage:"mmx search query --q <query>",options:[{flag:"--q <query>",description:"Search query string"}],examples:['mmx search query --q "MiniMax AI"','mmx search query --q "latest news" --output json'],async run(t,e){let i=e.q??e.query??e._positional?.[0];if(!i)throw new y("--q is required.",u.USAGE,'mmx search query --q "your search query"');let r=S(t.output);if(t.dryRun){console.log(v({request:{q:i}},r));return}let o=Pe(t.baseUrl),$=await A(t,{url:o,method:"POST",body:{q:i}}),n=$.organic||[];if(r!=="text"){console.log(v($,r));return}if(t.quiet){for(let m of n)console.log(`${m.title} ${m.link}`);return}if(n.length===0){console.log("No results found.");return}for(let m of n){if(console.log(`${m.title}`),console.log(` ${m.link}`),m.snippet)console.log(` ${m.snippet}`);if(m.date)console.log(` ${m.date}`);console.log("")}}});import{readFileSync as Jo,existsSync as Xo}from"fs";import{extname as Qo}from"path";var Oo={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".webp":"image/webp"},Yo=52428800;async function Vo(t){if(t.startsWith("data:"))return t;if(t.startsWith("http://")||t.startsWith("https://")){let o=await fetch(t);if(!o.ok)throw new y(`Failed to download image: HTTP ${o.status}`,u.GENERAL);let n=(o.headers.get("content-type")||"image/jpeg").split(";")[0].trim(),m=await o.arrayBuffer();if(m.byteLength>Yo)throw new y(`Image too large (${(m.byteLength/1024/1024).toFixed(1)} MB). Maximum is 50 MB.`,u.USAGE);let s=Buffer.from(m).toString("base64");return`data:${n};base64,${s}`}if(!Xo(t))throw new y(`File not found: ${t}`,u.USAGE);let e=Qo(t).toLowerCase(),i=Oo[e];if(!i)throw new y(`Unsupported image format "${e}". Supported: jpg, jpeg, png, webp`,u.USAGE);let r=Jo(t);return`data:${i};base64,${r.toString("base64")}`}var ti=l({name:"vision describe",description:"Describe an image using MiniMax VLM",usage:"mmx vision describe (--image <path-or-url> | --file-id <id>) [--prompt <text>]",options:[{flag:"--image <path-or-url>",description:"Local image path or URL (base64 encoded automatically)"},{flag:"--file-id <id>",description:"Pre-uploaded file ID (skips base64 conversion)"},{flag:"--prompt <text>",description:'Question about the image (default: "Describe the image.")'}],examples:["mmx vision describe --image photo.jpg",'mmx vision describe --image https://example.com/photo.jpg --prompt "What breed is this dog?"','mmx vision describe --file-id file-123456789 --prompt "Extract the text"'],async run(t,e){let i=e.image??e.file??e.path??e._positional?.[0],r=e.fileId,o=e.prompt||"Describe the image.";if(!i&&!r)if(J({nonInteractive:t.nonInteractive})){let c=await U({message:"Enter image path, URL, or File ID:"});if(!c)process.stderr.write(`Vision describe cancelled.
|
|
168
|
+
`),process.exit(1);if(!c.includes(".")&&!c.startsWith("http"))r=c;else i=c}else throw new y("Missing required argument. Must provide either --image or --file-id.",u.USAGE,"mmx vision describe --image <path> OR --file-id <id>");else if(i&&r)throw new y("Conflicting arguments: cannot provide both --image and --file-id.",u.USAGE);let $=S(t.output);if(t.dryRun){process.stdout.write(v({request:{prompt:o,image:i,fileId:r}},$)+`
|
|
169
|
+
`);return}let n=Ce(t.baseUrl),m={prompt:o};if(r)m.file_id=r;else if(i){let c=await Vo(i);m.image_url=c}let s=await A(t,{url:n,method:"POST",body:m});if($!=="text"){process.stdout.write(v(s,$)+`
|
|
170
|
+
`);return}process.stdout.write(s.content+`
|
|
171
|
+
`)}});var ei=l({name:"quota show",description:"Display Token Plan usage and remaining quotas",usage:"mmx quota show",examples:["mmx quota show","mmx quota show --output json"],async run(t,e){if(t.dryRun){console.log("Would fetch quota information.");return}let i=tt(t.baseUrl),r=await A(t,{url:i}),o=r.model_remains||[],$=S(e.output);if($!=="text"){console.log(v(r,$));return}if(t.quiet){for(let n of o){let m=n.current_interval_total_count-n.current_interval_usage_count;console.log(`${n.model_name} ${n.current_interval_usage_count} ${n.current_interval_total_count} ${m}`)}return}pt(o,t)}});var ni=l({name:"config show",description:"Display current configuration",usage:"mmx config show",examples:["mmx config show","mmx config show --output json"],async run(t,e){let i=Q(),r=S(t.output),o={region:t.region,base_url:t.baseUrl,output:t.output,timeout:t.timeout,config_file:L()};if(i.api_key)o.api_key=W(i.api_key);if(i.default_text_model)o.default_text_model=i.default_text_model;if(i.default_speech_model)o.default_speech_model=i.default_speech_model;if(i.default_video_model)o.default_video_model=i.default_video_model;if(i.default_music_model)o.default_music_model=i.default_music_model;console.log(v(o,r))}});var ii=["region","base_url","output","timeout","api_key","default_text_model","default_speech_model","default_video_model","default_music_model"],Zo={"default-text-model":"default_text_model","default-speech-model":"default_speech_model","default-video-model":"default_video_model","default-music-model":"default_music_model"},ri=l({name:"config set",description:"Set a config value",usage:"mmx config set --key <key> --value <value>",options:[{flag:"--key <key>",description:"Config key (region, base_url, output, timeout, api_key, default_text_model, default_speech_model, default_video_model, default_music_model)"},{flag:"--value <value>",description:"Value to set"}],examples:["mmx config set --key output --value json","mmx config set --key timeout --value 600","mmx config set --key base_url --value https://api-uw.minimax.io"],async run(t,e){let i=e._positional,r=e.key??i?.[0],o=e.value??i?.[1];if(!r||o===void 0)throw new y("--key and --value are required.",u.USAGE,"mmx config set --key <key> --value <value>");let $=Zo[r]||r;if(!ii.includes($))throw new y(`Invalid config key "${r}". Valid keys: ${ii.join(", ")}`,u.USAGE);if($==="region"&&!["global","cn"].includes(o))throw new y(`Invalid region "${o}". Valid values: global, cn`,u.USAGE);if($==="output"&&!["text","json"].includes(o))throw new y(`Invalid output format "${o}". Valid values: text, json`,u.USAGE);if($==="timeout"){let s=Number(o);if(isNaN(s)||s<=0)throw new y(`Invalid timeout "${o}". Must be a positive number.`,u.USAGE)}let n=S(t.output);if(t.dryRun){console.log(v({would_set:{[$]:o}},n));return}let m=Q();if(m[$]=$==="timeout"?Number(o):o,$==="api_key")delete m.region;if(await H(m),!t.quiet)console.log(v({[$]:m[$]},n))}});function zo(t){let e=t.match(/^--([a-zA-Z0-9-]+)/),i=e?e[1]:"",r=i.replace(/-([a-zA-Z0-9])/g,(n,m)=>m.toUpperCase()),o="string",$=!1;if(!t.includes("<")&&!t.includes("["))o="boolean";else if(t.includes("<n>")||t.includes("<hz>")||t.includes("<bps>")||t.includes("<count>"))o="number";if(t.toLowerCase().includes("repeatable"))$=!0;return{name:r,kebabName:i,inferredType:o,isArray:$}}function Se(t){let i={name:`mmx_${t.name.replace(/ /g,"_")}`,description:t.description,input_schema:{type:"object",properties:{},required:[]}};if(t.options)for(let r of t.options){let{name:o,inferredType:$,isArray:n}=zo(r.flag);if(!o)continue;let m=r.type,s=n?"array":m??$,c={description:r.description};if(s==="array")c.type="array",c.items={type:"string"};else c.type=s;let x=i.input_schema;if(x.properties[o]=c,r.required)x.required.push(o)}return i}var Wo=["auth ","config ","update"],oi=l({name:"config export-schema",description:"Export all (or one) CLI command(s) as Anthropic/OpenAI-compatible JSON tool schemas",usage:'mmx config export-schema [--command "<name>"]',options:[{flag:"--command <name>",description:'Export schema for a specific command only (e.g. "image generate")'}],examples:["mmx config export-schema",'mmx config export-schema --command "video generate"'],async run(t,e){let i=e.command;if(i){try{let{command:$}=D.resolve(i.split(" ")),n=Se($);process.stdout.write(JSON.stringify(n,null,2)+`
|
|
172
|
+
`)}catch{throw new y(`Command "${i}" not found.`,u.USAGE)}return}let o=D.getAllCommands().filter(($)=>!Wo.some((n)=>$.name.startsWith(n))).map(($)=>Se($));process.stdout.write(JSON.stringify(o,null,2)+`
|
|
173
|
+
`)}});var Ko="1.0.11",$i=l({name:"update",description:"Update mmx to the latest version",usage:"mmx update",examples:["mmx update"],async run(){process.stderr.write(`Current version: ${Ko}
|
|
165
174
|
|
|
166
175
|
`),process.stderr.write(`Run:
|
|
167
176
|
`),process.stderr.write(` npm update -g mmx-cli
|
|
168
177
|
|
|
169
|
-
`)}});var
|
|
178
|
+
`)}});var Ho=[{command:"mmx text chat",title:"Text Generation (Chat Completion)",path:"/docs/api-reference/text-post"},{command:"mmx speech synthesize",title:"Speech T2A (Text-to-Audio)",path:"/docs/api-reference/speech-t2a-http"},{command:"mmx image generate",title:"Image Generation (T2I / I2I)",path:"/docs/api-reference/image-generation-t2i"},{command:"mmx video generate",title:"Video Generation (T2V / I2V / S2V)",path:"/docs/api-reference/video-generation"},{command:"mmx music generate",title:"Music Generation",path:"/docs/api-reference/music-generation"},{command:"mmx music cover",title:"Music Cover (via Music Generation)",path:"/docs/api-reference/music-generation"},{command:"mmx search query",title:"Web Search",path:"/docs/api-reference/web-search"},{command:"mmx vision describe",title:"Vision (Image Understanding)",path:"/docs/api-reference/vision"}],mi=l({name:"help",description:"Show MiniMax API documentation links",usage:"mmx help",async run(t,e){let i=xt[t.region]||xt.global;process.stdout.write(`
|
|
170
179
|
MiniMax API Documentation Links
|
|
171
180
|
|
|
172
|
-
Official docs: ${
|
|
181
|
+
Official docs: ${i}/docs/api-reference
|
|
173
182
|
|
|
174
|
-
`);for(let r of
|
|
175
|
-
`),process.stdout.write(` ${" ".repeat(30)} ${
|
|
183
|
+
`);for(let r of Ho)process.stdout.write(` ${r.command.padEnd(30)} ${r.title}
|
|
184
|
+
`),process.stdout.write(` ${" ".repeat(30)} ${i}${r.path}
|
|
176
185
|
|
|
177
|
-
`)}});class
|
|
178
|
-
`);throw new
|
|
186
|
+
`)}});class pi{root={children:new Map};constructor(t){for(let[e,i]of Object.entries(t))this.register(e,i)}register(t,e){let i=t.split(" "),r=this.root;for(let o of i){if(!r.children.has(o))r.children.set(o,{children:new Map});r=r.children.get(o)}r.command=e}getAllCommands(){let t=[],e=(i)=>{if(i.command)t.push(i.command);for(let r of i.children.values())e(r)};return e(this.root),t}resolve(t){let e=this.root,i=[];for(let r of t){let o=e.children.get(r);if(!o)break;e=o,i.push(r)}if(e.command)return{command:e.command,extra:t.slice(i.length)};if(i.length>0&&e.children.size===1){let[,r]=e.children.entries().next().value;if(r.command)return{command:r.command,extra:t.slice(i.length)}}if(i.length>0&&e.children.size>0){let r=Array.from(e.children.entries()).map(([o,$])=>{if($.command)return` ${i.join(" ")} ${o} ${$.command.description}`;let n=Array.from($.children.keys()).join(", ");return` ${i.join(" ")} ${o} [${n}]`}).join(`
|
|
187
|
+
`);throw new y(`Unknown command: mmx ${t.join(" ")}
|
|
179
188
|
|
|
180
189
|
Available commands:
|
|
181
|
-
${r}`,
|
|
182
|
-
${this.bold("Usage:",
|
|
190
|
+
${r}`,u.USAGE,`mmx ${i.join(" ")} --help`)}throw new y(`Unknown command: mmx ${t.join(" ")}`,u.USAGE,"mmx --help")}bold=(t,e)=>e.isTTY?`\x1B[1m${t}\x1B[0m`:t;accent=(t,e)=>e.isTTY?`\x1B[38;2;248;103;58m${t}\x1B[0m`:t;dim=(t,e)=>e.isTTY?`\x1B[2m${t}\x1B[0m`:t;printHelp(t,e=process.stdout,i="global"){if(t.length===0){this.printRootHelp(e);return}let r=this.root;for(let $ of t){let n=r.children.get($);if(!n){this.printRootHelp(e);return}r=n}if(r.command){this.printCommandHelp(r.command,e,i);return}let o=t.join(" ");e.write(`
|
|
191
|
+
${this.bold("Usage:",e)} mmx ${o} <command> [flags]
|
|
183
192
|
|
|
184
|
-
`),
|
|
185
|
-
`),this.printChildren(r,o,
|
|
186
|
-
`)}printRootHelp(
|
|
187
|
-
`);for(let
|
|
188
|
-
`)}else
|
|
189
|
-
`);let r=(
|
|
193
|
+
`),e.write(`${this.bold("Commands:",e)}
|
|
194
|
+
`),this.printChildren(r,o,e),e.write(`
|
|
195
|
+
`)}printRootHelp(t){let e=["███╗ ███╗███╗ ███╗██╗ ██╗","████╗ ████║████╗ ████║╚██╗██╔╝","██╔████╔██║██╔████╔██║ ╚███╔╝ ","██║╚██╔╝██║██║╚██╔╝██║ ██╔██╗ ","██║ ╚═╝ ██║██║ ╚═╝ ██║██╔╝ ██╗","╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝"],i=[[240,23,122],[242,43,106],[244,63,90],[246,83,74],[248,103,58],[250,123,42]];t.write(`
|
|
196
|
+
`);for(let n=0;n<e.length;n++)if(t.isTTY){let[m,s,c]=i[n];t.write(`\x1B[1;38;2;${m};${s};${c}m${e[n]}\x1B[0m
|
|
197
|
+
`)}else t.write(e[n]+`
|
|
198
|
+
`);let r=(n)=>this.bold(n,t),o=(n)=>this.accent(n,t),$=(n)=>this.dim(n,t);t.write(`
|
|
190
199
|
${r("Usage:")} mmx <resource> <command> [flags]
|
|
191
200
|
|
|
192
201
|
${r("Resources:")}
|
|
193
|
-
${o("auth")} ${
|
|
194
|
-
${o("text")} ${
|
|
195
|
-
${o("speech")} ${
|
|
196
|
-
${o("image")} ${
|
|
197
|
-
${o("video")} ${
|
|
198
|
-
${o("music")} ${
|
|
199
|
-
${o("search")} ${
|
|
200
|
-
${o("vision")} ${
|
|
201
|
-
${o("quota")} ${
|
|
202
|
-
${o("config")} ${
|
|
203
|
-
${o("update")} ${
|
|
202
|
+
${o("auth")} ${$("Authentication (login, status, refresh, logout)")}
|
|
203
|
+
${o("text")} ${$("Text generation (chat)")}
|
|
204
|
+
${o("speech")} ${$("Speech synthesis (synthesize, voices)")}
|
|
205
|
+
${o("image")} ${$("Image generation (generate)")}
|
|
206
|
+
${o("video")} ${$("Video generation (generate, task get, download)")}
|
|
207
|
+
${o("music")} ${$("Music generation (generate, cover)")}
|
|
208
|
+
${o("search")} ${$("Web search (query)")}
|
|
209
|
+
${o("vision")} ${$("Image understanding (describe)")}
|
|
210
|
+
${o("quota")} ${$("Usage quotas (show)")}
|
|
211
|
+
${o("config")} ${$("CLI configuration (show, set, export-schema)")}
|
|
212
|
+
${o("update")} ${$("Update mmx to a newer version")}
|
|
204
213
|
|
|
205
214
|
${r("Global Flags:")}
|
|
206
|
-
${o("--api-key <key>")} ${
|
|
207
|
-
${o("--region <region>")} ${
|
|
208
|
-
${o("--base-url <url>")} ${
|
|
209
|
-
${o("--output <format>")} ${
|
|
210
|
-
${o("--quiet")} ${
|
|
211
|
-
${o("--verbose")} ${
|
|
212
|
-
${o("--timeout <seconds>")} ${
|
|
213
|
-
${o("--no-color")} ${
|
|
214
|
-
${o("--dry-run")} ${
|
|
215
|
-
${o("--non-interactive")} ${
|
|
216
|
-
${o("--version")} ${
|
|
217
|
-
${o("--help")} ${
|
|
215
|
+
${o("--api-key <key>")} ${$("API key (overrides all other auth)")}
|
|
216
|
+
${o("--region <region>")} ${$("API region: global (default), cn")}
|
|
217
|
+
${o("--base-url <url>")} ${$("API base URL (overrides region)")}
|
|
218
|
+
${o("--output <format>")} ${$("Output format: text, json")}
|
|
219
|
+
${o("--quiet")} ${$("Suppress non-essential output")}
|
|
220
|
+
${o("--verbose")} ${$("Print HTTP request/response details")}
|
|
221
|
+
${o("--timeout <seconds>")} ${$("Request timeout (default: 300)")}
|
|
222
|
+
${o("--no-color")} ${$("Disable ANSI colors and spinners")}
|
|
223
|
+
${o("--dry-run")} ${$("Show what would happen without executing")}
|
|
224
|
+
${o("--non-interactive")} ${$("Disable interactive prompts (CI/agent mode)")}
|
|
225
|
+
${o("--version")} ${$("Print version and exit")}
|
|
226
|
+
${o("--help")} ${$("Show help")}
|
|
218
227
|
|
|
219
228
|
${r("Getting Help:")}
|
|
220
|
-
${
|
|
221
|
-
${
|
|
222
|
-
`)}printCommandHelp(e,
|
|
223
|
-
${
|
|
224
|
-
`),
|
|
225
|
-
`);if(
|
|
229
|
+
${$("Add --help after any command to see its full list of options, defaults,")}
|
|
230
|
+
${$("and usage examples. For example:")} mmx text chat --help
|
|
231
|
+
`)}printCommandHelp(t,e,i="global"){let r=(n)=>this.bold(n,e),o=(n)=>this.accent(n,e),$=(n)=>this.dim(n,e);if(e.write(`
|
|
232
|
+
${t.description}
|
|
233
|
+
`),t.usage)e.write(`${r("Usage:")} ${t.usage}
|
|
234
|
+
`);if(t.options&&t.options.length>0){let n=Math.max(...t.options.map((m)=>m.flag.length));e.write(`
|
|
226
235
|
${r("Options:")}
|
|
227
|
-
`);for(let m of
|
|
228
|
-
`)}if(
|
|
236
|
+
`);for(let m of t.options)e.write(` ${o(m.flag.padEnd(n+2))} ${$(m.description)}
|
|
237
|
+
`)}if(t.examples&&t.examples.length>0){e.write(`
|
|
229
238
|
${r("Examples:")}
|
|
230
|
-
`);for(let
|
|
231
|
-
`)}if(
|
|
232
|
-
${r("API Reference:")} ${
|
|
233
|
-
`);
|
|
234
|
-
${
|
|
235
|
-
`),
|
|
236
|
-
`)}printChildren(e,
|
|
237
|
-
`)}}var
|
|
239
|
+
`);for(let n of t.examples)e.write(` ${$(n)}
|
|
240
|
+
`)}if(t.apiDocs)e.write(`
|
|
241
|
+
${r("API Reference:")} ${$(xt[i]+t.apiDocs)}
|
|
242
|
+
`);e.write(`
|
|
243
|
+
${$("Global flags (--api-key, --output, --quiet, etc.) are always available.")}
|
|
244
|
+
`),e.write(`${$("Run")} mmx --help ${$("for the full list.")}
|
|
245
|
+
`)}printChildren(t,e,i){let r=[],o=(n,m)=>{for(let[s,c]of n.children){if(c.command)r.push({fullName:`${m} ${s}`,description:c.command.description});if(c.children.size>0)o(c,`${m} ${s}`)}};o(t,e);let $=Math.max(...r.map((n)=>n.fullName.length));for(let{fullName:n,description:m}of r)i.write(` ${this.accent(n.padEnd($),i)} ${this.dim(m,i)}
|
|
246
|
+
`)}}var D=new pi({"auth login":Xn,"auth status":Qn,"auth refresh":On,"auth logout":Yn,"text chat":Zn,"speech synthesize":be,"speech generate":be,"speech voices":dn,"image generate":an,"video generate":Pn,"video task get":Cn,"video download":Ln,"music generate":gn,"music cover":Dn,"search query":ke,"search web":ke,"vision describe":ti,"quota show":ei,"config show":ni,"config set":ri,"config export-schema":oi,update:$i,help:mi});function ot(t){if(t instanceof y){if(S(process.env.MINIMAX_OUTPUT)==="json")process.stderr.write(JSON.stringify(t.toJSON(),null,2)+`
|
|
238
247
|
`);else{if(process.stderr.write(`
|
|
239
|
-
Error: ${
|
|
240
|
-
`),
|
|
241
|
-
${
|
|
248
|
+
Error: ${t.message}
|
|
249
|
+
`),t.hint)process.stderr.write(`
|
|
250
|
+
${t.hint.split(`
|
|
242
251
|
`).join(`
|
|
243
252
|
`)}
|
|
244
|
-
`);process.stderr.write(` (exit code ${
|
|
245
|
-
`)}process.exit(
|
|
253
|
+
`);process.stderr.write(` (exit code ${t.exitCode})
|
|
254
|
+
`)}process.exit(t.exitCode)}if(t instanceof Error){if(t.name==="AbortError"||t.name==="TimeoutError"||t.message.includes("timed out")){let o=new y("Request timed out.",u.TIMEOUT,`Try increasing --timeout (e.g. --timeout 60).
|
|
246
255
|
If this happens on every request with a valid API key, you may be hitting the wrong region.
|
|
247
256
|
`+`Run: mmx auth status — to check your credentials and region.
|
|
248
|
-
`+"Run: mmx config set region global (or cn) — to override the region.");return
|
|
249
|
-
Error: ${
|
|
250
|
-
`),process.env.MINIMAX_VERBOSE==="1")process.stderr.write(`${
|
|
257
|
+
`+"Run: mmx config set region global (or cn) — to override the region.");return ot(o)}if(t instanceof TypeError&&t.message==="fetch failed"){let o=new y("Network request failed.",u.NETWORK,"Check your network connection and proxy settings. Also verify MINIMAX_BASE_URL is a valid URL.");return ot(o)}let e=t.message.toLowerCase();if(e.includes("failed to fetch")||e.includes("connection refused")||e.includes("econnrefused")||e.includes("connection reset")||e.includes("econnreset")||e.includes("network error")||e.includes("enotfound")||e.includes("getaddrinfo")||e.includes("proxy")||e.includes("socket")||e.includes("etimedout")||e.includes("timeout")||e.includes("eai_AGAIN")){let o="Check your network connection and proxy settings.";if(e.includes("proxy"))o="Proxy error — check HTTP_PROXY / HTTPS_PROXY environment variables and proxy authentication.";let $=new y("Network request failed.",u.NETWORK,o);return ot($)}let r=t.code;if(r==="ENOENT"||r==="EACCES"||r==="ENOSPC"||r==="ENOTDIR"||r==="EISDIR"||r==="EPERM"||r==="EBUSY"){let o="Check the file path and permissions.";if(r==="ENOENT")o="File or directory not found.";if(r==="EACCES"||r==="EPERM")o="Permission denied — check file or directory permissions.";if(r==="ENOSPC")o="Disk full — free up space and try again.";let $=new y(`File system error: ${t.message}`,u.GENERAL,o);return ot($)}else if(typeof r==="string"&&r.startsWith("E")){let o=new y(`File system error: ${t.message}`,u.GENERAL,"Check the file path and permissions.");return ot(o)}if(process.stderr.write(`
|
|
258
|
+
Error: ${t.message}
|
|
259
|
+
`),process.env.MINIMAX_VERBOSE==="1")process.stderr.write(`${t.stack}
|
|
251
260
|
`)}else process.stderr.write(`
|
|
252
|
-
Error: ${String(
|
|
253
|
-
`);process.exit(
|
|
254
|
-
`),process.stderr.write(`Warning: API key failed validation against all regions
|
|
261
|
+
Error: ${String(t)}
|
|
262
|
+
`);process.exit(u.GENERAL)}var Uo="/v1/token_plan/remains";function ao(t){return C[t]+Uo}async function Io(t,e,i){let r=[{Authorization:`Bearer ${e}`},{"x-api-key":e}];for(let o of r)try{let $=await fetch(ao(t),{headers:{...o,"Content-Type":"application/json"},signal:AbortSignal.timeout(i)});if(!$.ok)continue;if((await $.json()).base_resp?.status_code===0)return!0}catch{}return!1}async function si(t){process.stderr.write("Detecting region...");let e=Object.keys(C),r=(await Promise.all(e.map(async($)=>({region:$,ok:await Io($,t,5000)})))).find(($)=>$.ok);if(!r)return process.stderr.write(` failed
|
|
263
|
+
`),process.stderr.write(`Warning: API key failed validation against all regions (global, cn).
|
|
264
|
+
This usually means the API key is invalid or the network is blocking requests.
|
|
265
|
+
Falling back to 'global'. Subsequent requests may fail.
|
|
266
|
+
Run 'mmx auth status' to verify your credentials.
|
|
255
267
|
`),"global";let o=r.region;return process.stderr.write(` ${o}
|
|
256
|
-
`),o}async function
|
|
257
|
-
Pass directly: --api-key sk-xxxxx`);let
|
|
258
|
-
`)}var
|
|
268
|
+
`),o}async function ci(t){let e=Q();e.region=t,await H(e)}import{join as Po}from"path";import{readFileSync as Co,writeFileSync as Lo}from"fs";var ui=()=>Po(wt(),"update-state.json"),Eo=86400000,fo=3000,Fo="MiniMax-AI-Dev/minimax-cli";function go(){try{let t=Co(ui(),"utf-8");return JSON.parse(t)}catch{return null}}function Do(t){try{Lo(ui(),JSON.stringify(t))}catch{}}async function t$(){try{let t=await fetch(`https://api.github.com/repos/${Fo}/releases/latest`,{headers:{Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"},signal:AbortSignal.timeout(fo)});if(!t.ok)return null;return(await t.json()).tag_name??null}catch{return null}}var Me=null;function yi(){return Me}async function xi(t){if(process.env.CI||!process.stderr.isTTY)return;let e=go(),i=Date.now();if(e&&i-e.lastChecked<Eo){if(e.latestVersion&&e.latestVersion!==`v${t}`)Me=e.latestVersion;return}let r=await t$();if(!r)return;if(Do({lastChecked:i,latestVersion:r}),r!==`v${t}`)Me=r}async function wi(t){if(t.apiKey||t.fileApiKey)return;let e=process.env.MINIMAX_API_KEY,i;if(e){if(!J({nonInteractive:t.nonInteractive}))i=e;else if(await Vn({message:`Found MINIMAX_API_KEY in environment (${W(e)}). Save it to config file?`}))i=e}if(!i){if(!J({nonInteractive:t.nonInteractive}))throw new y("No API key found.",u.AUTH,`Set env var: export MINIMAX_API_KEY=sk-xxxxx
|
|
269
|
+
Pass directly: --api-key sk-xxxxx`);let $=await U({message:"Enter your MiniMax API key:"});if(!$)throw new y("API key is required.",u.AUTH);i=$}let r={...Q(),api_key:i};await H(r),t.fileApiKey=i;let o=t.configPath??"~/.mmx/config.json";process.stderr.write(`API key saved to ${o}
|
|
270
|
+
`)}var _i="1.0.11";process.on("SIGINT",()=>{process.stderr.write(`
|
|
259
271
|
Interrupted. Exiting.
|
|
260
|
-
`),process.exit(130)});process.stdout.on("error",(
|
|
272
|
+
`),process.exit(130)});process.stdout.on("error",(t)=>{if(t.code==="EPIPE")process.exit(0);else throw t});var e$=[["auth","login"],["auth","logout"],["config","show"],["config","set"],["config","export-schema"],["update"]];async function n$(){let t=process.argv.slice(2);if(t.includes("--version")||t.includes("-v"))console.log(`mmx ${_i}`),process.exit(0);let e=Be(t,Rt);if(t.includes("--help")||t.includes("-h")){let c=t.indexOf("--region"),x=c>=0&&t[c+1]||process.env.MINIMAX_REGION||Q().region||"global";D.printHelp(e,process.stderr,x),process.exit(0)}if(e.length===0){D.printHelp([],process.stderr);let{command:c}=D.resolve(["quota","show"]),x=at(t,[...Rt,...c.options??[]]),w=ft(x),h=!!(w.apiKey||w.fileApiKey),_=!!await d();if(h||_)await c.execute(w,x);else process.stderr.write(` Not logged in.
|
|
261
273
|
`),process.stderr.write(` mmx auth login --api-key sk-xxxxx
|
|
262
274
|
|
|
263
|
-
`);process.exit(0)}let{command:
|
|
264
|
-
Update available: ${
|
|
275
|
+
`);process.exit(0)}let{command:i,extra:r}=D.resolve(e),o=at(t,[...Rt,...i.options??[]]);if(r.length>0)o._positional=r;let $=ft(o);if(!e$.some((c)=>c.every((x,w)=>e[w]===x)))await wi($);if($.needsRegionDetection){let c=$.apiKey||$.fileApiKey;if(c){let x=await si(c);$.region=x,$.baseUrl=C[x],$.needsRegionDetection=!1,await ci(x)}}let m=xi(_i).catch(()=>{});await i.execute($,o),await m;let s=yi();if(s&&!$.quiet)process.stderr.write(`
|
|
276
|
+
Update available: ${s}
|
|
265
277
|
`),process.stderr.write(` npm update -g mmx-cli
|
|
266
278
|
|
|
267
|
-
`)}
|
|
279
|
+
`)}n$().catch(ot);
|