tako-cli 0.2.8 → 0.2.10
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/index.js +92 -90
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var PS=Object.create;var{getPrototypeOf:jS,defineProperty:D,getOwnPropertyNames:M1,getOwnPropertyDescriptor:_S}=Object,L1=Object.prototype.hasOwnProperty;function q1($){return this[$]}var kS,uS,H$=($,S,O)=>{var I=$!=null&&typeof $==="object";if(I){var E=S?kS??=new WeakMap:uS??=new WeakMap,H=E.get($);if(H)return H}O=$!=null?PS(jS($)):{};let h=S||!$||!$.__esModule?D(O,"default",{value:$,enumerable:!0}):O;for(let b of M1($))if(!L1.call(h,b))D(h,b,{get:q1.bind($,b),enumerable:!0});if(I)E.set($,h);return h},cS=($)=>{var S=(N1??=new WeakMap).get($),O;if(S)return S;if(S=D({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var I of M1($))if(!L1.call(S,I))D(S,I,{get:q1.bind($,I),enumerable:!(O=_S($,I))||O.enumerable})}return N1.set($,S),S},N1,W1=($,S)=>()=>(S||$((S={exports:{}}).exports,S),S.exports);var FS=($)=>$;function oS($,S){this[$]=FS.bind(null,S)}var dS=($,S)=>{for(var O in S)D($,O,{get:S[O],enumerable:!0,configurable:!0,set:oS.bind(S,O)})};var iS=($,S)=>()=>($&&(S=$($=0)),S);var V=import.meta.require;var o$=W1((P2,u1)=>{var F$={to($,S){if(!S)return`\x1B[${$+1}G`;return`\x1B[${S+1};${$+1}H`},move($,S){let O="";if($<0)O+=`\x1B[${-$}D`;else if($>0)O+=`\x1B[${$}C`;if(S<0)O+=`\x1B[${-S}A`;else if(S>0)O+=`\x1B[${S}B`;return O},up:($=1)=>`\x1B[${$}A`,down:($=1)=>`\x1B[${$}B`,forward:($=1)=>`\x1B[${$}C`,backward:($=1)=>`\x1B[${$}D`,nextLine:($=1)=>"\x1B[E".repeat($),prevLine:($=1)=>"\x1B[F".repeat($),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},x0={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},Y0={screen:"\x1B[2J",up:($=1)=>"\x1B[1J".repeat($),down:($=1)=>"\x1B[J".repeat($),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines($){let S="";for(let O=0;O<$;O++)S+=this.line+(O<$-1?F$.up():"");if($)S+=F$.left;return S}};u1.exports={cursor:F$,scroll:x0,erase:Y0,beep:"\x07"}});var i$=W1((j2,d$)=>{var N$=process||{},c1=N$.argv||[],v$=N$.env||{},G0=!(!!v$.NO_COLOR||c1.includes("--no-color"))&&(!!v$.FORCE_COLOR||c1.includes("--color")||N$.platform==="win32"||(N$.stdout||{}).isTTY&&v$.TERM!=="dumb"||!!v$.CI),v0=($,S,O=$)=>(I)=>{let E=""+I,H=E.indexOf(S,$.length);return~H?$+N0(E,S,O,H)+S:$+E+S},N0=($,S,O,I)=>{let E="",H=0;do E+=$.substring(H,I)+O,H=I+S.length,I=$.indexOf(S,H);while(~I);return E+$.substring(H)},F1=($=G0)=>{let S=$?v0:()=>String;return{isColorSupported:$,reset:S("\x1B[0m","\x1B[0m"),bold:S("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:S("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:S("\x1B[3m","\x1B[23m"),underline:S("\x1B[4m","\x1B[24m"),inverse:S("\x1B[7m","\x1B[27m"),hidden:S("\x1B[8m","\x1B[28m"),strikethrough:S("\x1B[9m","\x1B[29m"),black:S("\x1B[30m","\x1B[39m"),red:S("\x1B[31m","\x1B[39m"),green:S("\x1B[32m","\x1B[39m"),yellow:S("\x1B[33m","\x1B[39m"),blue:S("\x1B[34m","\x1B[39m"),magenta:S("\x1B[35m","\x1B[39m"),cyan:S("\x1B[36m","\x1B[39m"),white:S("\x1B[37m","\x1B[39m"),gray:S("\x1B[90m","\x1B[39m"),bgBlack:S("\x1B[40m","\x1B[49m"),bgRed:S("\x1B[41m","\x1B[49m"),bgGreen:S("\x1B[42m","\x1B[49m"),bgYellow:S("\x1B[43m","\x1B[49m"),bgBlue:S("\x1B[44m","\x1B[49m"),bgMagenta:S("\x1B[45m","\x1B[49m"),bgCyan:S("\x1B[46m","\x1B[49m"),bgWhite:S("\x1B[47m","\x1B[49m"),blackBright:S("\x1B[90m","\x1B[39m"),redBright:S("\x1B[91m","\x1B[39m"),greenBright:S("\x1B[92m","\x1B[39m"),yellowBright:S("\x1B[93m","\x1B[39m"),blueBright:S("\x1B[94m","\x1B[39m"),magentaBright:S("\x1B[95m","\x1B[39m"),cyanBright:S("\x1B[96m","\x1B[39m"),whiteBright:S("\x1B[97m","\x1B[39m"),bgBlackBright:S("\x1B[100m","\x1B[49m"),bgRedBright:S("\x1B[101m","\x1B[49m"),bgGreenBright:S("\x1B[102m","\x1B[49m"),bgYellowBright:S("\x1B[103m","\x1B[49m"),bgBlueBright:S("\x1B[104m","\x1B[49m"),bgMagentaBright:S("\x1B[105m","\x1B[49m"),bgCyanBright:S("\x1B[106m","\x1B[49m"),bgWhiteBright:S("\x1B[107m","\x1B[49m")}};d$.exports=F1();d$.exports.createColors=F1});var wS={};dS(wS,{t:()=>m,setLocale:()=>$1,getLocale:()=>S1,detectLocale:()=>c,clearLocaleOverride:()=>s0});function c(){if(z$)return z$;let $=process.env.LANG||process.env.LANGUAGE||process.env.LC_ALL||"";if($.toLowerCase().includes("zh")||$.toLowerCase().includes("chinese"))return"zh";try{if(Intl.DateTimeFormat().resolvedOptions().locale.toLowerCase().startsWith("zh"))return"zh"}catch{}return"zh"}function $1($){z$=$}function s0(){z$=null}function m($,S){let O=c(),I=$.split("."),E=e0;for(let h of I)if(E=E?.[h],!E)return $;let H=E[O]||E.en||$;if(S)for(let[h,b]of Object.entries(S))H=H.replace(`{${h}}`,String(b));return H}function S1(){return c()}var z$=null,e0;var J=iS(()=>{e0={launcher:{starting:{en:"Starting {client}...",zh:"\u6B63\u5728\u542F\u52A8 {client}..."},directoryNotFound:{en:"Directory not found: {path}",zh:"\u76EE\u5F55\u4E0D\u5B58\u5728\uFF1A{path}"},apiKeyNotConfigured:{en:"API Key not configured",zh:"API Key \u672A\u914D\u7F6E"},error:{en:"Error: {message}",zh:"\u9519\u8BEF\uFF1A{message}"}},menu:{selectAction:{en:"Select an action:",zh:"\u8BF7\u9009\u62E9\u64CD\u4F5C\uFF1A"},launchClient:{en:"Launch {client}",zh:"\u542F\u52A8 {client}"},advanced:{en:"Advanced",zh:"\u9AD8\u7EA7"},advancedHint:{en:"Usage stats, configuration, etc.",zh:"\u7528\u91CF\u7EDF\u8BA1\u3001\u914D\u7F6E\u7B49"},exit:{en:"Exit",zh:"\u9000\u51FA"},advancedOptions:{en:"Advanced Options:",zh:"\u9AD8\u7EA7\u9009\u9879\uFF1A"},viewStats:{en:"View Usage Statistics",zh:"\u67E5\u770B\u7528\u91CF\u7EDF\u8BA1"},configApiKey:{en:"Configure API Key",zh:"\u914D\u7F6E API Key"},back:{en:"Back",zh:"\u8FD4\u56DE"},changeLanguage:{en:"Change Language",zh:"\u5207\u6362\u8BED\u8A00"},currentLanguage:{en:"Current Language: {lang}",zh:"\u5F53\u524D\u8BED\u8A00\uFF1A{lang}"},languageChanged:{en:"Language changed to {lang}",zh:"\u8BED\u8A00\u5DF2\u5207\u6362\u4E3A {lang}"}},language:{en:{en:"English",zh:"\u82F1\u8BED"},zh:{en:"Chinese",zh:"\u4E2D\u6587"}},banner:{welcome:{en:"Welcome!",zh:"\u6B22\u8FCE\u4F7F\u7528\uFF01"}},stats:{title:{en:"\uD83D\uDCCA Usage Statistics",zh:"\uD83D\uDCCA \u7528\u91CF\u7EDF\u8BA1"},totalRequests:{en:"Total Requests: {count} times",zh:"\u603B\u8C03\u7528\u6B21\u6570\uFF1A{count} \u6B21"},totalCost:{en:"Total Cost: {cost}",zh:"\u603B\u6D88\u8D39\uFF1A{cost}"},todayCost:{en:"Today's Cost: {cost}",zh:"\u4ECA\u65E5\u6D88\u8D39\uFF1A{cost}"},modelDistribution:{en:"Model Usage Distribution (Today):",zh:"\u6A21\u578B\u4F7F\u7528\u5206\u5E03\uFF08\u4ECA\u65E5\uFF09\uFF1A"},times:{en:"times",zh:"\u6B21"},refreshHint:{en:"{countdown}s until refresh | Press any key to return",zh:"{countdown}s \u540E\u5237\u65B0 | \u6309\u4EFB\u610F\u952E\u8FD4\u56DE"},fetching:{en:"Fetching usage statistics...",zh:"\u83B7\u53D6\u7528\u91CF\u7EDF\u8BA1..."},fetchFailed:{en:"Failed to fetch: {error}",zh:"\u83B7\u53D6\u5931\u8D25\uFF1A{error}"}},prompts:{enterApiKey:{en:"Please enter your API Key:",zh:"\u8BF7\u8F93\u5165\u60A8\u7684 API Key\uFF1A"},apiKeyPlaceholder:{en:"cr_xxxxxxxx",zh:"cr_xxxxxxxx"},validating:{en:"Validating API Key...",zh:"\u6B63\u5728\u9A8C\u8BC1 API Key..."},keyInvalidFormat:{en:"Invalid format, must start with cr_",zh:"\u683C\u5F0F\u4E0D\u6B63\u786E\uFF0C\u5FC5\u987B\u4EE5 cr_ \u5F00\u5934"},keyValidationFailed:{en:"Validation failed: {error}",zh:"\u9A8C\u8BC1\u5931\u8D25\uFF1A{error}"},keyConfigured:{en:"API Key configured successfully!",zh:"API Key \u914D\u7F6E\u6210\u529F\uFF01"}},cli:{version:{en:"Tako CLI v{version}",zh:"Tako CLI v{version}"},usage:{en:"Usage: tako [options] [command]",zh:"\u7528\u6CD5\uFF1Atako [\u9009\u9879] [\u547D\u4EE4]"},options:{en:"Options:",zh:"\u9009\u9879\uFF1A"},optionVersion:{en:" -v, --version Display version number",zh:" -v, --version \u663E\u793A\u7248\u672C\u53F7"},optionHelp:{en:" -h, --help Display help information",zh:" -h, --help \u663E\u793A\u5E2E\u52A9\u4FE1\u606F"},shortcuts:{en:"Shortcuts:",zh:"\u5FEB\u6377\u547D\u4EE4\uFF1A"},shortcutClaude:{en:" --claude Launch Claude Code directly",zh:" --claude \u76F4\u63A5\u542F\u52A8 Claude Code"},shortcutCodex:{en:" --codex Launch Codex directly",zh:" --codex \u76F4\u63A5\u542F\u52A8 Codex"},examples:{en:"Examples:",zh:"\u793A\u4F8B\uFF1A"},exampleInteractive:{en:" tako Interactive tool selection",zh:" tako \u4EA4\u4E92\u5F0F\u9009\u62E9\u5DE5\u5177"},exampleClaude:{en:" tako --claude Launch Claude Code directly",zh:" tako --claude \u76F4\u63A5\u542F\u52A8 Claude Code"},exampleCodex:{en:" tako --codex Launch Codex directly",zh:" tako --codex \u76F4\u63A5\u542F\u52A8 Codex"},clientNotFound:{en:"{client} client not found",zh:"{client} \u5BA2\u6237\u7AEF\u672A\u627E\u5230"},cliError:{en:"Tako CLI encountered an error:",zh:"Tako CLI \u53D1\u751F\u9519\u8BEF\uFF1A"},launchFailed:{en:"Launch failed",zh:"\u542F\u52A8\u5931\u8D25"}},auth:{invalidFormat:{en:"Invalid format, must start with cr_",zh:"\u683C\u5F0F\u4E0D\u6B63\u786E\uFF0C\u5FC5\u987B\u4EE5 cr_ \u5F00\u5934"},validationFailed:{en:"Validation failed",zh:"\u9A8C\u8BC1\u5931\u8D25"},networkError:{en:"Network request failed",zh:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25"}},updater:{migrating:{en:"Detected old installation, migrating...",zh:"\u68C0\u6D4B\u5230\u65E7\u7248\u5B89\u88C5\u65B9\u5F0F\uFF0C\u6B63\u5728\u8FC1\u79FB..."},installingLocally:{en:"Installing to local directory...",zh:"\u6B63\u5728\u5B89\u88C5\u5230\u672C\u5730\u76EE\u5F55..."},migrationFailed:{en:"Local installation failed, skipping migration",zh:"\u672C\u5730\u5B89\u88C5\u5931\u8D25\uFF0C\u8DF3\u8FC7\u8FC1\u79FB"},installComplete:{en:"Local installation complete",zh:"\u672C\u5730\u5B89\u88C5\u5B8C\u6210"},migrationComplete:{en:"Detected old installation, migration complete. Please restart Tako CLI",zh:"\u68C0\u6D4B\u5230\u65E7\u7248\u5B89\u88C5\uFF0C\u5DF2\u5B8C\u6210\u8FC1\u79FB\uFF0C\u8BF7\u91CD\u65B0\u542F\u52A8 Tako CLI"},newVersionAvailable:{en:"New version v{version} available (current v{current})",zh:"\u53D1\u73B0\u65B0\u7248\u672C v{version}\uFF08\u5F53\u524D v{current}\uFF09"},pleaseRestart:{en:"Please restart Tako CLI to use the new version",zh:"\u8BF7\u91CD\u65B0\u542F\u52A8 Tako CLI \u4EE5\u4F7F\u7528\u65B0\u7248\u672C"}},region:{usingChinaMirror:{en:"Detected China mainland network, using domestic mirror",zh:"\u68C0\u6D4B\u5230\u4E2D\u56FD\u5927\u9646\u7F51\u7EDC\uFF0C\u4F7F\u7528\u56FD\u5185\u955C\u50CF\u6E90"},usingGlobalMirror:{en:"Using global mirror",zh:"\u4F7F\u7528\u56FD\u9645\u6E90"}},telemetry:{toggle:{en:"Toggle Telemetry",zh:"\u5207\u6362\u9065\u6D4B"},enabled:{en:"Telemetry is enabled",zh:"\u9065\u6D4B\u5DF2\u5F00\u542F"},disabled:{en:"Telemetry is disabled",zh:"\u9065\u6D4B\u5DF2\u5173\u95ED"},description:{en:"Anonymous usage data helps us improve Tako CLI",zh:"\u533F\u540D\u4F7F\u7528\u6570\u636E\u5E2E\u52A9\u6211\u4EEC\u6539\u8FDB Tako CLI"}},time:{justNow:{en:"just now",zh:"\u521A\u521A"},minutesAgo:{en:"{n}m ago",zh:"{n}\u5206\u949F\u524D"},hoursAgo:{en:"{n}h ago",zh:"{n}\u5C0F\u65F6\u524D"},yesterday:{en:"yesterday",zh:"\u6628\u5929"},daysAgo:{en:"{n}d ago",zh:"{n}\u5929\u524D"},weeksAgo:{en:"{n}w ago",zh:"{n}\u5468\u524D"},monthsAgo:{en:"{n}mo ago",zh:"{n}\u6708\u524D"}},recentProjects:{title:{en:"Recent Projects",zh:"\u6700\u8FD1\u9879\u76EE"},launchInCurrent:{en:"Launch in current directory",zh:"\u5728\u5F53\u524D\u76EE\u5F55\u542F\u52A8"}}}});import{join as T$}from"path";import{homedir as lS}from"os";import{join as p}from"path";var f=p(lS(),".tako"),z1=p(f,"config.json"),V$=p(f,"tools"),C=p(f,"cli"),u=p(f,"bun"),Z=p(u,"bin",process.platform==="win32"?"bun.exe":"bun"),pS=process.env.TAKO_SERVER||"https://claude-proxy.shiroha.tech",P=process.env.PROXY_BASE_URL||"https://claude-proxy.shiroha.tech",uh=process.env.TAKO_DEV==="true"||pS.includes("localhost"),Q1={apiKey:"",apiId:"",installedClients:{}};async function Z1(){let $=await import("fs/promises");try{await $.mkdir(f,{recursive:!0}),await $.mkdir(V$,{recursive:!0})}catch{}}async function W(){await Z1();try{let $=Bun.file(z1);if(await $.exists()){let S=await $.json();return{...Q1,...S}}}catch{}return{...Q1}}async function f$($){await Z1(),await Bun.write(z1,JSON.stringify($,null,2))}async function b$($){let O={...await W(),...$};return await f$(O),O}async function U1(){return!!(await W()).apiKey}async function R$(){return(await W()).apiKey}async function J1(){return(await W()).apiId}function C$($,S){if(!$.startsWith(f))throw Error(`\u5B89\u5168\u68C0\u67E5\u5931\u8D25: ${S} \u8DEF\u5F84 "${$}" \u4E0D\u5728 Tako \u76EE\u5F55\u4E0B`)}function s($){let S=T$(V$,$);return C$(S,"\u5BA2\u6237\u7AEF\u5B89\u88C5\u76EE\u5F55"),S}async function X1($){let S=s($.id),O=T$(S,"node_modules",$.package,"package.json");try{let I=Bun.file(O);if(!await I.exists())return null;let H=(await I.json()).bin;if(!H)return null;let h=null;if(typeof H==="string")h=H;else if(typeof H==="object"&&H[$.command])h=H[$.command];if(!h)return null;let b=T$(S,"node_modules",$.package,h);return C$(b,"\u5BA2\u6237\u7AEF\u5165\u53E3\u6587\u4EF6"),b}catch{return null}}function A1($){let S=s($.id),O=T$(S,"node_modules",".bin",$.command);return C$(O,"\u5BA2\u6237\u7AEF\u53EF\u6267\u884C\u6587\u4EF6"),O}var y$=new Map;function m$($){y$.set($.id,$)}function B1(){return Array.from(y$.values())}function g$($){return y$.get($)}var nS={id:"claude-code",name:"Claude Code",package:"@anthropic-ai/claude-code",command:"claude",runtime:"bun",continueArg:"--continue",getEnvVars($){return{ANTHROPIC_BASE_URL:`${P}/api`,ANTHROPIC_AUTH_TOKEN:$}}};m$(nS);import{homedir as R0}from"os";import{join as u$}from"path";/*!
|
|
3
|
+
var $S=Object.create;var{getPrototypeOf:SS,defineProperty:R$,getOwnPropertyNames:y1,getOwnPropertyDescriptor:OS}=Object,j1=Object.prototype.hasOwnProperty;function _1($){return this[$]}var HS,ES,w$=($,S,H)=>{var E=$!=null&&typeof $==="object";if(E){var R=S?HS??=new WeakMap:ES??=new WeakMap,I=R.get($);if(I)return I}H=$!=null?$S(SS($)):{};let O=S||!$||!$.__esModule?R$(H,"default",{value:$,enumerable:!0}):H;for(let Y of y1($))if(!j1.call(O,Y))R$(O,Y,{get:_1.bind($,Y),enumerable:!0});if(E)R.set($,O);return O},RS=($)=>{var S=(m1??=new WeakMap).get($),H;if(S)return S;if(S=R$({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var E of y1($))if(!j1.call(S,E))R$(S,E,{get:_1.bind($,E),enumerable:!(H=OS($,E))||H.enumerable})}return m1.set($,S),S},m1,P1=($,S)=>()=>(S||$((S={exports:{}}).exports,S),S.exports);var IS=($)=>$;function YS($,S){this[$]=IS.bind(null,S)}var GS=($,S)=>{for(var H in S)R$($,H,{get:S[H],enumerable:!0,configurable:!0,set:YS.bind(S,H)})};var bS=($,S)=>()=>($&&(S=$($=0)),S);var j=import.meta.require;var O1=P1((WH,S0)=>{var S1={to($,S){if(!S)return`\x1B[${$+1}G`;return`\x1B[${S+1};${$+1}H`},move($,S){let H="";if($<0)H+=`\x1B[${-$}D`;else if($>0)H+=`\x1B[${$}C`;if(S<0)H+=`\x1B[${-S}A`;else if(S>0)H+=`\x1B[${S}B`;return H},up:($=1)=>`\x1B[${$}A`,down:($=1)=>`\x1B[${$}B`,forward:($=1)=>`\x1B[${$}C`,backward:($=1)=>`\x1B[${$}D`,nextLine:($=1)=>"\x1B[E".repeat($),prevLine:($=1)=>"\x1B[F".repeat($),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},CS={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},mS={screen:"\x1B[2J",up:($=1)=>"\x1B[1J".repeat($),down:($=1)=>"\x1B[J".repeat($),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines($){let S="";for(let H=0;H<$;H++)S+=this.line+(H<$-1?S1.up():"");if($)S+=S1.left;return S}};S0.exports={cursor:S1,scroll:CS,erase:mS,beep:"\x07"}});var E1=P1((JH,H1)=>{var A$=process||{},O0=A$.argv||[],h$=A$.env||{},yS=!(!!h$.NO_COLOR||O0.includes("--no-color"))&&(!!h$.FORCE_COLOR||O0.includes("--color")||A$.platform==="win32"||(A$.stdout||{}).isTTY&&h$.TERM!=="dumb"||!!h$.CI),jS=($,S,H=$)=>(E)=>{let R=""+E,I=R.indexOf(S,$.length);return~I?$+_S(R,S,H,I)+S:$+R+S},_S=($,S,H,E)=>{let R="",I=0;do R+=$.substring(I,E)+H,I=E+S.length,E=$.indexOf(S,I);while(~E);return R+$.substring(I)},H0=($=yS)=>{let S=$?jS:()=>String;return{isColorSupported:$,reset:S("\x1B[0m","\x1B[0m"),bold:S("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:S("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:S("\x1B[3m","\x1B[23m"),underline:S("\x1B[4m","\x1B[24m"),inverse:S("\x1B[7m","\x1B[27m"),hidden:S("\x1B[8m","\x1B[28m"),strikethrough:S("\x1B[9m","\x1B[29m"),black:S("\x1B[30m","\x1B[39m"),red:S("\x1B[31m","\x1B[39m"),green:S("\x1B[32m","\x1B[39m"),yellow:S("\x1B[33m","\x1B[39m"),blue:S("\x1B[34m","\x1B[39m"),magenta:S("\x1B[35m","\x1B[39m"),cyan:S("\x1B[36m","\x1B[39m"),white:S("\x1B[37m","\x1B[39m"),gray:S("\x1B[90m","\x1B[39m"),bgBlack:S("\x1B[40m","\x1B[49m"),bgRed:S("\x1B[41m","\x1B[49m"),bgGreen:S("\x1B[42m","\x1B[49m"),bgYellow:S("\x1B[43m","\x1B[49m"),bgBlue:S("\x1B[44m","\x1B[49m"),bgMagenta:S("\x1B[45m","\x1B[49m"),bgCyan:S("\x1B[46m","\x1B[49m"),bgWhite:S("\x1B[47m","\x1B[49m"),blackBright:S("\x1B[90m","\x1B[39m"),redBright:S("\x1B[91m","\x1B[39m"),greenBright:S("\x1B[92m","\x1B[39m"),yellowBright:S("\x1B[93m","\x1B[39m"),blueBright:S("\x1B[94m","\x1B[39m"),magentaBright:S("\x1B[95m","\x1B[39m"),cyanBright:S("\x1B[96m","\x1B[39m"),whiteBright:S("\x1B[97m","\x1B[39m"),bgBlackBright:S("\x1B[100m","\x1B[49m"),bgRedBright:S("\x1B[101m","\x1B[49m"),bgGreenBright:S("\x1B[102m","\x1B[49m"),bgYellowBright:S("\x1B[103m","\x1B[49m"),bgBlueBright:S("\x1B[104m","\x1B[49m"),bgMagentaBright:S("\x1B[105m","\x1B[49m"),bgCyanBright:S("\x1B[106m","\x1B[49m"),bgWhiteBright:S("\x1B[107m","\x1B[49m")}};H1.exports=H0();H1.exports.createColors=H0});var B0={};GS(B0,{t:()=>M,setLocale:()=>v1,getLocale:()=>N1,detectLocale:()=>a,clearLocaleOverride:()=>w2});function a(){if(m$)return m$;let $=process.env.LANG||process.env.LANGUAGE||process.env.LC_ALL||"";if($.toLowerCase().includes("zh")||$.toLowerCase().includes("chinese"))return"zh";try{if(Intl.DateTimeFormat().resolvedOptions().locale.toLowerCase().startsWith("zh"))return"zh"}catch{}return"zh"}function v1($){m$=$}function w2(){m$=null}function M($,S){let H=a(),E=$.split("."),R=L2;for(let O of E)if(R=R?.[O],!R)return $;let I=R[H]||R.en||$;if(S)for(let[O,Y]of Object.entries(S))I=I.replace(`{${O}}`,String(Y));return I}function N1(){return a()}var m$=null,L2;var V=bS(()=>{L2={launcher:{starting:{en:"Starting {client}...",zh:"\u6B63\u5728\u542F\u52A8 {client}..."},directoryNotFound:{en:"Directory not found: {path}",zh:"\u76EE\u5F55\u4E0D\u5B58\u5728\uFF1A{path}"},apiKeyNotConfigured:{en:"API Key not configured",zh:"API Key \u672A\u914D\u7F6E"},error:{en:"Error: {message}",zh:"\u9519\u8BEF\uFF1A{message}"}},menu:{selectAction:{en:"Select an action:",zh:"\u8BF7\u9009\u62E9\u64CD\u4F5C\uFF1A"},launchClient:{en:"Launch {client}",zh:"\u542F\u52A8 {client}"},advanced:{en:"Advanced",zh:"\u9AD8\u7EA7"},advancedHint:{en:"Usage stats, configuration, etc.",zh:"\u7528\u91CF\u7EDF\u8BA1\u3001\u914D\u7F6E\u7B49"},exit:{en:"Exit",zh:"\u9000\u51FA"},advancedOptions:{en:"Advanced Options:",zh:"\u9AD8\u7EA7\u9009\u9879\uFF1A"},viewStats:{en:"View Usage Statistics",zh:"\u67E5\u770B\u7528\u91CF\u7EDF\u8BA1"},configApiKey:{en:"Configure API Key",zh:"\u914D\u7F6E API Key"},back:{en:"Back",zh:"\u8FD4\u56DE"},changeLanguage:{en:"Change Language",zh:"\u5207\u6362\u8BED\u8A00"},currentLanguage:{en:"Current Language: {lang}",zh:"\u5F53\u524D\u8BED\u8A00\uFF1A{lang}"},languageChanged:{en:"Language changed to {lang}",zh:"\u8BED\u8A00\u5DF2\u5207\u6362\u4E3A {lang}"}},language:{en:{en:"English",zh:"\u82F1\u8BED"},zh:{en:"Chinese",zh:"\u4E2D\u6587"}},banner:{welcome:{en:"Welcome!",zh:"\u6B22\u8FCE\u4F7F\u7528\uFF01"}},stats:{title:{en:"\uD83D\uDCCA Usage Statistics",zh:"\uD83D\uDCCA \u7528\u91CF\u7EDF\u8BA1"},totalRequests:{en:"Total Requests: {count} times",zh:"\u603B\u8C03\u7528\u6B21\u6570\uFF1A{count} \u6B21"},totalCost:{en:"Total Cost: {cost}",zh:"\u603B\u6D88\u8D39\uFF1A{cost}"},todayCost:{en:"Today's Cost: {cost}",zh:"\u4ECA\u65E5\u6D88\u8D39\uFF1A{cost}"},modelDistribution:{en:"Model Usage Distribution (Today):",zh:"\u6A21\u578B\u4F7F\u7528\u5206\u5E03\uFF08\u4ECA\u65E5\uFF09\uFF1A"},times:{en:"times",zh:"\u6B21"},refreshHint:{en:"{countdown}s until refresh | Press any key to return",zh:"{countdown}s \u540E\u5237\u65B0 | \u6309\u4EFB\u610F\u952E\u8FD4\u56DE"},fetching:{en:"Fetching usage statistics...",zh:"\u83B7\u53D6\u7528\u91CF\u7EDF\u8BA1..."},fetchFailed:{en:"Failed to fetch: {error}",zh:"\u83B7\u53D6\u5931\u8D25\uFF1A{error}"}},prompts:{enterApiKey:{en:"Please enter your API Key:",zh:"\u8BF7\u8F93\u5165\u60A8\u7684 API Key\uFF1A"},apiKeyPlaceholder:{en:"cr_xxxxxxxx",zh:"cr_xxxxxxxx"},validating:{en:"Validating API Key...",zh:"\u6B63\u5728\u9A8C\u8BC1 API Key..."},keyInvalidFormat:{en:"Invalid format, must start with cr_",zh:"\u683C\u5F0F\u4E0D\u6B63\u786E\uFF0C\u5FC5\u987B\u4EE5 cr_ \u5F00\u5934"},keyValidationFailed:{en:"Validation failed: {error}",zh:"\u9A8C\u8BC1\u5931\u8D25\uFF1A{error}"},keyConfigured:{en:"API Key configured successfully!",zh:"API Key \u914D\u7F6E\u6210\u529F\uFF01"}},cli:{version:{en:"Tako CLI v{version}",zh:"Tako CLI v{version}"},usage:{en:"Usage: tako [options] [command]",zh:"\u7528\u6CD5\uFF1Atako [\u9009\u9879] [\u547D\u4EE4]"},options:{en:"Options:",zh:"\u9009\u9879\uFF1A"},optionVersion:{en:" -v, --version Display version number",zh:" -v, --version \u663E\u793A\u7248\u672C\u53F7"},optionHelp:{en:" -h, --help Display help information",zh:" -h, --help \u663E\u793A\u5E2E\u52A9\u4FE1\u606F"},shortcuts:{en:"Shortcuts:",zh:"\u5FEB\u6377\u547D\u4EE4\uFF1A"},shortcutClaude:{en:" --claude Launch Claude Code directly",zh:" --claude \u76F4\u63A5\u542F\u52A8 Claude Code"},shortcutCodex:{en:" --codex Launch Codex directly",zh:" --codex \u76F4\u63A5\u542F\u52A8 Codex"},examples:{en:"Examples:",zh:"\u793A\u4F8B\uFF1A"},exampleInteractive:{en:" tako Interactive tool selection",zh:" tako \u4EA4\u4E92\u5F0F\u9009\u62E9\u5DE5\u5177"},exampleClaude:{en:" tako --claude Launch Claude Code directly",zh:" tako --claude \u76F4\u63A5\u542F\u52A8 Claude Code"},exampleCodex:{en:" tako --codex Launch Codex directly",zh:" tako --codex \u76F4\u63A5\u542F\u52A8 Codex"},clientNotFound:{en:"{client} client not found",zh:"{client} \u5BA2\u6237\u7AEF\u672A\u627E\u5230"},cliError:{en:"Tako CLI encountered an error:",zh:"Tako CLI \u53D1\u751F\u9519\u8BEF\uFF1A"},launchFailed:{en:"Launch failed",zh:"\u542F\u52A8\u5931\u8D25"}},auth:{invalidFormat:{en:"Invalid format, must start with cr_",zh:"\u683C\u5F0F\u4E0D\u6B63\u786E\uFF0C\u5FC5\u987B\u4EE5 cr_ \u5F00\u5934"},validationFailed:{en:"Validation failed",zh:"\u9A8C\u8BC1\u5931\u8D25"},networkError:{en:"Network request failed",zh:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25"}},updater:{migrating:{en:"Detected old installation, migrating...",zh:"\u68C0\u6D4B\u5230\u65E7\u7248\u5B89\u88C5\u65B9\u5F0F\uFF0C\u6B63\u5728\u8FC1\u79FB..."},installingLocally:{en:"Installing to local directory...",zh:"\u6B63\u5728\u5B89\u88C5\u5230\u672C\u5730\u76EE\u5F55..."},migrationFailed:{en:"Local installation failed, skipping migration",zh:"\u672C\u5730\u5B89\u88C5\u5931\u8D25\uFF0C\u8DF3\u8FC7\u8FC1\u79FB"},installComplete:{en:"Local installation complete",zh:"\u672C\u5730\u5B89\u88C5\u5B8C\u6210"},migrationComplete:{en:"Detected old installation, migration complete. Please restart Tako CLI",zh:"\u68C0\u6D4B\u5230\u65E7\u7248\u5B89\u88C5\uFF0C\u5DF2\u5B8C\u6210\u8FC1\u79FB\uFF0C\u8BF7\u91CD\u65B0\u542F\u52A8 Tako CLI"},newVersionAvailable:{en:"New version v{version} available (current v{current})",zh:"\u53D1\u73B0\u65B0\u7248\u672C v{version}\uFF08\u5F53\u524D v{current}\uFF09"},pleaseRestart:{en:"Please restart Tako CLI to use the new version",zh:"\u8BF7\u91CD\u65B0\u542F\u52A8 Tako CLI \u4EE5\u4F7F\u7528\u65B0\u7248\u672C"}},region:{usingChinaMirror:{en:"Detected China mainland network, using domestic mirror",zh:"\u68C0\u6D4B\u5230\u4E2D\u56FD\u5927\u9646\u7F51\u7EDC\uFF0C\u4F7F\u7528\u56FD\u5185\u955C\u50CF\u6E90"},usingGlobalMirror:{en:"Using global mirror",zh:"\u4F7F\u7528\u56FD\u9645\u6E90"}},telemetry:{toggle:{en:"Toggle Telemetry",zh:"\u5207\u6362\u9065\u6D4B"},enabled:{en:"Telemetry is enabled",zh:"\u9065\u6D4B\u5DF2\u5F00\u542F"},disabled:{en:"Telemetry is disabled",zh:"\u9065\u6D4B\u5DF2\u5173\u95ED"},description:{en:"Anonymous usage data helps us improve Tako CLI",zh:"\u533F\u540D\u4F7F\u7528\u6570\u636E\u5E2E\u52A9\u6211\u4EEC\u6539\u8FDB Tako CLI"}},time:{justNow:{en:"just now",zh:"\u521A\u521A"},minutesAgo:{en:"{n}m ago",zh:"{n}\u5206\u949F\u524D"},hoursAgo:{en:"{n}h ago",zh:"{n}\u5C0F\u65F6\u524D"},yesterday:{en:"yesterday",zh:"\u6628\u5929"},daysAgo:{en:"{n}d ago",zh:"{n}\u5929\u524D"},weeksAgo:{en:"{n}w ago",zh:"{n}\u5468\u524D"},monthsAgo:{en:"{n}mo ago",zh:"{n}\u6708\u524D"}},recentProjects:{title:{en:"Recent Projects",zh:"\u6700\u8FD1\u9879\u76EE"},launchInCurrent:{en:"Launch in current directory",zh:"\u5728\u5F53\u524D\u76EE\u5F55\u542F\u52A8"}}}});import{join as z$}from"path";import{homedir as MS}from"os";import{join as S$}from"path";var _=S$(MS(),".tako"),F1=S$(_,"config.json"),l$=S$(_,"tools"),P=S$(_,"cli"),D=S$(_,"bun"),A=S$(D,"bin",process.platform==="win32"?"bun.exe":"bun"),TS=process.env.TAKO_SERVER||"https://claude-proxy.shiroha.tech",c=process.env.PROXY_BASE_URL||"https://claude-proxy.shiroha.tech",hO=process.env.TAKO_DEV==="true"||TS.includes("localhost"),k1={apiKey:"",apiId:"",installedClients:{}};async function g1(){let $=await import("fs/promises");try{await $.mkdir(_,{recursive:!0}),await $.mkdir(l$,{recursive:!0})}catch{}}async function X(){await g1();try{let $=Bun.file(F1);if(await $.exists()){let S=await $.json();return{...k1,...S}}}catch{}return{...k1}}async function o$($){await g1(),await Bun.write(F1,JSON.stringify($,null,2))}async function L$($){let H={...await X(),...$};return await o$(H),H}async function u1(){return!!(await X()).apiKey}async function Q$(){return(await X()).apiKey}async function c1(){return(await X()).apiId}function i$($,S){if(!$.startsWith(_))throw Error(`\u5B89\u5168\u68C0\u67E5\u5931\u8D25: ${S} \u8DEF\u5F84 "${$}" \u4E0D\u5728 Tako \u76EE\u5F55\u4E0B`)}function I$($){let S=z$(l$,$);return i$(S,"\u5BA2\u6237\u7AEF\u5B89\u88C5\u76EE\u5F55"),S}async function d1($){let S=I$($.id),H=z$(S,"node_modules",$.package,"package.json");try{let E=Bun.file(H);if(!await E.exists())return null;let I=(await E.json()).bin;if(!I)return null;let O=null;if(typeof I==="string")O=I;else if(typeof I==="object"&&I[$.command])O=I[$.command];if(!O)return null;let Y=z$(S,"node_modules",$.package,O);return i$(Y,"\u5BA2\u6237\u7AEF\u5165\u53E3\u6587\u4EF6"),Y}catch{return null}}function l1($){let S=I$($.id),H=z$(S,"node_modules",".bin",$.command);return i$(H,"\u5BA2\u6237\u7AEF\u53EF\u6267\u884C\u6587\u4EF6"),H}var p$=new Map;function Z$($){p$.set($.id,$)}function o1(){return Array.from(p$.values())}function D$($){return p$.get($)}var xS={id:"claude-code",name:"Claude Code",package:"@anthropic-ai/claude-code",command:"claude",runtime:"bun",continueArg:"--continue",getEnvVars($){return{ANTHROPIC_BASE_URL:`${c}/api`,ANTHROPIC_AUTH_TOKEN:$}}};Z$(xS);import{homedir as BS}from"os";import{join as t$}from"path";/*!
|
|
4
4
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
5
5
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
6
|
*
|
|
@@ -26,11 +26,11 @@ var PS=Object.create;var{getPrototypeOf:jS,defineProperty:D,getOwnPropertyNames:
|
|
|
26
26
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
27
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
28
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
29
|
-
*/function
|
|
30
|
-
`,
|
|
31
|
-
`}return
|
|
29
|
+
*/function qS($,S){let H=$.slice(0,S).split(/\r\n|\n|\r/g);return[H.length,H.pop().length+1]}function vS($,S,H){let E=$.split(/\r\n|\n|\r/g),R="",I=(Math.log10(S+1)|0)+1;for(let O=S-1;O<=S+1;O++){let Y=E[O-1];if(!Y)continue;if(R+=O.toString().padEnd(I," "),R+=": ",R+=Y,R+=`
|
|
30
|
+
`,O===S)R+=" ".repeat(I+H+2),R+=`^
|
|
31
|
+
`}return R}class v extends Error{line;column;codeblock;constructor($,S){let[H,E]=qS(S.toml,S.ptr),R=vS(S.toml,H,E);super(`Invalid TOML document: ${$}
|
|
32
32
|
|
|
33
|
-
${
|
|
33
|
+
${R}`,S);this.line=H,this.column=E,this.codeblock=R}}/*!
|
|
34
34
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
35
35
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
36
36
|
*
|
|
@@ -56,14 +56,14 @@ ${E}`,S);this.line=O,this.column=I,this.codeblock=E}}/*!
|
|
|
56
56
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
57
57
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
58
58
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
59
|
-
*/function
|
|
60
|
-
`,S);if($[
|
|
61
|
-
`)return
|
|
62
|
-
`)return
|
|
63
|
-
`||
|
|
64
|
-
`))S++;if(
|
|
65
|
-
`||
|
|
66
|
-
`))return
|
|
59
|
+
*/function NS($,S){let H=0;while($[S-++H]==="\\");return--H&&H%2}function W$($,S=0,H=$.length){let E=$.indexOf(`
|
|
60
|
+
`,S);if($[E-1]==="\r")E--;return E<=H?E:-1}function O$($,S){for(let H=S;H<$.length;H++){let E=$[H];if(E===`
|
|
61
|
+
`)return H;if(E==="\r"&&$[H+1]===`
|
|
62
|
+
`)return H+1;if(E<" "&&E!=="\t"||E==="\x7F")throw new v("control characters are not allowed in comments",{toml:$,ptr:S})}return $.length}function B($,S,H,E){let R;while(!0){while((R=$[S])===" "||R==="\t"||!H&&(R===`
|
|
63
|
+
`||R==="\r"&&$[S+1]===`
|
|
64
|
+
`))S++;if(E||R!=="#")break;S=O$($,S)}return S}function i1($,S,H,E,R=!1){if(!E)return S=W$($,S),S<0?$.length:S;for(let I=S;I<$.length;I++){let O=$[I];if(O==="#")I=W$($,I);else if(O===H)return I+1;else if(O===E||R&&(O===`
|
|
65
|
+
`||O==="\r"&&$[I+1]===`
|
|
66
|
+
`))return I}throw new v("cannot find end of structure",{toml:$,ptr:S})}function J$($,S){let H=$[S],E=H===$[S+1]&&$[S+1]===$[S+2]?$.slice(S,S+3):H;S+=E.length-1;do S=$.indexOf(E,++S);while(S>-1&&H!=="'"&&NS($,S));if(S>-1){if(S+=E.length,E.length>1){if($[S]===H)S++;if($[S]===H)S++}}return S}/*!
|
|
67
67
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
68
68
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
69
69
|
*
|
|
@@ -89,7 +89,7 @@ ${E}`,S);this.line=O,this.column=I,this.codeblock=E}}/*!
|
|
|
89
89
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
90
90
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
91
91
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
92
|
-
*/var
|
|
92
|
+
*/var wS=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;class i extends Date{#S=!1;#O=!1;#$=null;constructor($){let S=!0,H=!0,E="Z";if(typeof $==="string"){let R=$.match(wS);if(R){if(!R[1])S=!1,$=`0000-01-01T${$}`;if(H=!!R[2],H&&$[10]===" "&&($=$.replace(" ","T")),R[2]&&+R[2]>23)$="";else if(E=R[3]||null,$=$.toUpperCase(),!E&&H)$+="Z"}else $=""}super($);if(!isNaN(this.getTime()))this.#S=S,this.#O=H,this.#$=E}isDateTime(){return this.#S&&this.#O}isLocal(){return!this.#S||!this.#O||!this.#$}isDate(){return this.#S&&!this.#O}isTime(){return this.#O&&!this.#S}isValid(){return this.#S||this.#O}toISOString(){let $=super.toISOString();if(this.isDate())return $.slice(0,10);if(this.isTime())return $.slice(11,23);if(this.#$===null)return $.slice(0,-1);if(this.#$==="Z")return $;let S=+this.#$.slice(1,3)*60+ +this.#$.slice(4,6);return S=this.#$[0]==="-"?S:-S,new Date(this.getTime()-S*60000).toISOString().slice(0,-1)+this.#$}static wrapAsOffsetDateTime($,S="Z"){let H=new i($);return H.#$=S,H}static wrapAsLocalDateTime($){let S=new i($);return S.#$=null,S}static wrapAsLocalDate($){let S=new i($);return S.#O=!1,S.#$=null,S}static wrapAsLocalTime($){let S=new i($);return S.#S=!1,S.#$=null,S}}/*!
|
|
93
93
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
94
94
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
95
95
|
*
|
|
@@ -115,13 +115,13 @@ ${E}`,S);this.line=O,this.column=I,this.codeblock=E}}/*!
|
|
|
115
115
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
116
116
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
117
117
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
118
|
-
*/var
|
|
119
|
-
`,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"};function
|
|
120
|
-
`)S++}let
|
|
121
|
-
`||
|
|
122
|
-
`){if(!
|
|
123
|
-
`||
|
|
124
|
-
`&&$[S]!=="\r")throw new
|
|
118
|
+
*/var LS=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,QS=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,zS=/^[+-]?0[0-9_]/,ZS=/^[0-9a-f]{2,8}$/i,p1={b:"\b",t:"\t",n:`
|
|
119
|
+
`,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"};function X$($,S=0,H=$.length){let E=$[S]==="'",R=$[S++]===$[S]&&$[S]===$[S+1];if(R){if(H-=2,$[S+=2]==="\r")S++;if($[S]===`
|
|
120
|
+
`)S++}let I=0,O,Y="",b=S;while(S<H-1){let G=$[S++];if(G===`
|
|
121
|
+
`||G==="\r"&&$[S]===`
|
|
122
|
+
`){if(!R)throw new v("newlines are not allowed in strings",{toml:$,ptr:S-1})}else if(G<" "&&G!=="\t"||G==="\x7F")throw new v("control characters are not allowed in strings",{toml:$,ptr:S-1});if(O){if(O=!1,G==="x"||G==="u"||G==="U"){let T=$.slice(S,S+=G==="x"?2:G==="u"?4:8);if(!ZS.test(T))throw new v("invalid unicode escape",{toml:$,ptr:I});try{Y+=String.fromCodePoint(parseInt(T,16))}catch{throw new v("invalid unicode escape",{toml:$,ptr:I})}}else if(R&&(G===`
|
|
123
|
+
`||G===" "||G==="\t"||G==="\r")){if(S=B($,S-1,!0),$[S]!==`
|
|
124
|
+
`&&$[S]!=="\r")throw new v("invalid escape: only line-ending whitespace may be escaped",{toml:$,ptr:I});S=B($,S)}else if(G in p1)Y+=p1[G];else throw new v("unrecognized escape sequence",{toml:$,ptr:I});b=S}else if(!E&&G==="\\")I=S-1,O=!0,Y+=$.slice(b,I)}return Y+$.slice(b,H-1)}function D1($,S,H,E){if($==="true")return!0;if($==="false")return!1;if($==="-inf")return-1/0;if($==="inf"||$==="+inf")return 1/0;if($==="nan"||$==="+nan"||$==="-nan")return NaN;if($==="-0")return E?0n:0;let R=LS.test($);if(R||QS.test($)){if(zS.test($))throw new v("leading zeroes are not allowed",{toml:S,ptr:H});$=$.replace(/_/g,"");let O=+$;if(isNaN(O))throw new v("invalid number",{toml:S,ptr:H});if(R){if((R=!Number.isSafeInteger(O))&&!E)throw new v("integer value cannot be represented losslessly",{toml:S,ptr:H});if(R||E===!0)O=BigInt($)}return O}let I=new i($);if(!I.isValid())throw new v("invalid value",{toml:S,ptr:H});return I}/*!
|
|
125
125
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
126
126
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
127
127
|
*
|
|
@@ -147,8 +147,8 @@ ${E}`,S);this.line=O,this.column=I,this.codeblock=E}}/*!
|
|
|
147
147
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
148
148
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
149
149
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
150
|
-
*/function
|
|
151
|
-
`&&$[
|
|
150
|
+
*/function WS($,S,H){let E=$.slice(S,H),R=E.indexOf("#");if(R>-1)O$($,R),E=E.slice(0,R);return[E.trimEnd(),R]}function Y$($,S,H,E,R){if(E===0)throw new v("document contains excessively nested structures. aborting.",{toml:$,ptr:S});let I=$[S];if(I==="["||I==="{"){let[b,G]=I==="["?r1($,S,E,R):a1($,S,E,R);if(H){if(G=B($,G),$[G]===",")G++;else if($[G]!==H)throw new v("expected comma or end of structure",{toml:$,ptr:G})}return[b,G]}let O;if(I==='"'||I==="'"){O=J$($,S);let b=X$($,S,O);if(H){if(O=B($,O),$[O]&&$[O]!==","&&$[O]!==H&&$[O]!==`
|
|
151
|
+
`&&$[O]!=="\r")throw new v("unexpected character encountered",{toml:$,ptr:O});O+=+($[O]===",")}return[b,O]}O=i1($,S,",",H);let Y=WS($,S,O-+($[O-1]===","));if(!Y[0])throw new v("incomplete key-value declaration: no value specified",{toml:$,ptr:S});if(H&&Y[1]>-1)O=B($,S+Y[1]),O+=+($[O]===",");return[D1(Y[0],$,S,R),O]}/*!
|
|
152
152
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
153
153
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
154
154
|
*
|
|
@@ -174,9 +174,9 @@ ${E}`,S);this.line=O,this.column=I,this.codeblock=E}}/*!
|
|
|
174
174
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
175
175
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
176
176
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
177
|
-
*/var
|
|
178
|
-
`&&
|
|
179
|
-
`&&
|
|
177
|
+
*/var JS=/^[a-zA-Z0-9-_]+[ \t]*$/;function U$($,S,H="="){let E=S-1,R=[],I=$.indexOf(H,S);if(I<0)throw new v("incomplete key-value: cannot find end of key",{toml:$,ptr:S});do{let O=$[S=++E];if(O!==" "&&O!=="\t")if(O==='"'||O==="'"){if(O===$[S+1]&&O===$[S+2])throw new v("multiline strings are not allowed in keys",{toml:$,ptr:S});let Y=J$($,S);if(Y<0)throw new v("unfinished string encountered",{toml:$,ptr:S});E=$.indexOf(".",Y);let b=$.slice(Y,E<0||E>I?I:E),G=W$(b);if(G>-1)throw new v("newlines are not allowed in keys",{toml:$,ptr:S+E+G});if(b.trimStart())throw new v("found extra tokens after the string part",{toml:$,ptr:Y});if(I<Y){if(I=$.indexOf(H,Y),I<0)throw new v("incomplete key-value: cannot find end of key",{toml:$,ptr:S})}R.push(X$($,S,Y))}else{E=$.indexOf(".",S);let Y=$.slice(S,E<0||E>I?I:E);if(!JS.test(Y))throw new v("only letter, numbers, dashes and underscores are allowed in keys",{toml:$,ptr:S});R.push(Y.trimEnd())}}while(E+1&&E<I);return[R,B($,I+1,!0,!0)]}function a1($,S,H,E){let R={},I=new Set,O;S++;while((O=$[S++])!=="}"&&O)if(O===",")throw new v("expected value, found comma",{toml:$,ptr:S-1});else if(O==="#")S=O$($,S);else if(O!==" "&&O!=="\t"&&O!==`
|
|
178
|
+
`&&O!=="\r"){let Y,b=R,G=!1,[T,q]=U$($,S-1);for(let C=0;C<T.length;C++){if(C)b=G?b[Y]:b[Y]={};if(Y=T[C],(G=Object.hasOwn(b,Y))&&(typeof b[Y]!=="object"||I.has(b[Y])))throw new v("trying to redefine an already defined value",{toml:$,ptr:S});if(!G&&Y==="__proto__")Object.defineProperty(b,Y,{enumerable:!0,configurable:!0,writable:!0})}if(G)throw new v("trying to redefine an already defined value",{toml:$,ptr:S});let[Q,u]=Y$($,q,"}",H-1,E);I.add(Q),b[Y]=Q,S=u}if(!O)throw new v("unfinished table encountered",{toml:$,ptr:S});return[R,S]}function r1($,S,H,E){let R=[],I;S++;while((I=$[S++])!=="]"&&I)if(I===",")throw new v("expected value, found comma",{toml:$,ptr:S-1});else if(I==="#")S=O$($,S);else if(I!==" "&&I!=="\t"&&I!==`
|
|
179
|
+
`&&I!=="\r"){let O=Y$($,S-1,"]",H-1,E);R.push(O[0]),S=O[1]}if(!I)throw new v("unfinished array encountered",{toml:$,ptr:S});return[R,S]}/*!
|
|
180
180
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
181
181
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
182
182
|
*
|
|
@@ -202,8 +202,8 @@ ${E}`,S);this.line=O,this.column=I,this.codeblock=E}}/*!
|
|
|
202
202
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
203
203
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
204
204
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
205
|
-
*/function
|
|
206
|
-
`&&$[
|
|
205
|
+
*/function n1($,S,H,E){let R=S,I=H,O,Y=!1,b;for(let G=0;G<$.length;G++){if(G){if(R=Y?R[O]:R[O]={},I=(b=I[O]).c,E===0&&(b.t===1||b.t===2))return null;if(b.t===2){let T=R.length-1;R=R[T],I=I[T].c}}if(O=$[G],(Y=Object.hasOwn(R,O))&&I[O]?.t===0&&I[O]?.d)return null;if(!Y){if(O==="__proto__")Object.defineProperty(R,O,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(I,O,{enumerable:!0,configurable:!0,writable:!0});I[O]={t:G<$.length-1&&E===2?3:E,d:!1,i:0,c:{}}}}if(b=I[O],b.t!==E&&!(E===1&&b.t===3))return null;if(E===2){if(!b.d)b.d=!0,R[O]=[];R[O].push(R={}),b.c[b.i++]=b={t:1,d:!1,i:0,c:{}}}if(b.d)return null;if(b.d=!0,E===1)R=Y?R[O]:R[O]={};else if(E===0&&Y)return null;return[O,R,b.c]}function a$($,{maxDepth:S=1000,integersAsBigInt:H}={}){let E={},R={},I=E,O=R;for(let Y=B($,0);Y<$.length;){if($[Y]==="["){let b=$[++Y]==="[",G=U$($,Y+=+b,"]");if(b){if($[G[1]-1]!=="]")throw new v("expected end of table declaration",{toml:$,ptr:G[1]-1});G[1]++}let T=n1(G[0],E,R,b?2:1);if(!T)throw new v("trying to redefine an already defined table or value",{toml:$,ptr:Y});O=T[2],I=T[1],Y=G[1]}else{let b=U$($,Y),G=n1(b[0],I,O,0);if(!G)throw new v("trying to redefine an already defined table or value",{toml:$,ptr:Y});let T=Y$($,b[1],void 0,S,H);G[1][G[0]]=T[0],Y=T[1]}if(Y=B($,Y,!0),$[Y]&&$[Y]!==`
|
|
206
|
+
`&&$[Y]!=="\r")throw new v("each key-value declaration must be followed by an end-of-line",{toml:$,ptr:Y});Y=B($,Y)}return E}/*!
|
|
207
207
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
208
208
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
209
209
|
*
|
|
@@ -229,16 +229,16 @@ ${E}`,S);this.line=O,this.column=I,this.codeblock=E}}/*!
|
|
|
229
229
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
230
230
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
231
231
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
232
|
-
*/var
|
|
232
|
+
*/var s1=/^[a-z0-9-_]+$/i;function G$($){let S=typeof $;if(S==="object"){if(Array.isArray($))return"array";if($ instanceof Date)return"date"}return S}function XS($){for(let S=0;S<$.length;S++)if(G$($[S])!=="object")return!1;return $.length!=0}function r$($){return JSON.stringify($).replace(/\x7f/g,"\\u007f")}function n$($,S,H,E){if(H===0)throw Error("Could not stringify the object: maximum object depth exceeded");if(S==="number"){if(isNaN($))return"nan";if($===1/0)return"inf";if($===-1/0)return"-inf";if(E&&Number.isInteger($))return $.toFixed(1);return $.toString()}if(S==="bigint"||S==="boolean")return $.toString();if(S==="string")return r$($);if(S==="date"){if(isNaN($.getTime()))throw TypeError("cannot serialize invalid date");return $.toISOString()}if(S==="object")return US($,H,E);if(S==="array")return hS($,H,E)}function US($,S,H){let E=Object.keys($);if(E.length===0)return"{}";let R="{ ";for(let I=0;I<E.length;I++){let O=E[I];if(I)R+=", ";R+=s1.test(O)?O:r$(O),R+=" = ",R+=n$($[O],G$($[O]),S-1,H)}return R+" }"}function hS($,S,H){if($.length===0)return"[]";let E="[ ";for(let R=0;R<$.length;R++){if(R)E+=", ";if($[R]===null||$[R]===void 0)throw TypeError("arrays cannot contain null or undefined values");E+=n$($[R],G$($[R]),S-1,H)}return E+" ]"}function AS($,S,H,E){if(H===0)throw Error("Could not stringify the object: maximum object depth exceeded");let R="";for(let I=0;I<$.length;I++)R+=`${R&&`
|
|
233
233
|
`}[[${S}]]
|
|
234
|
-
`,
|
|
235
|
-
`)+
|
|
236
|
-
`)+
|
|
237
|
-
`}}if($&&(
|
|
238
|
-
${
|
|
239
|
-
${
|
|
240
|
-
`)return
|
|
241
|
-
`;return
|
|
234
|
+
`,R+=s$(0,$[I],S,H,E);return R}function s$($,S,H,E,R){if(E===0)throw Error("Could not stringify the object: maximum object depth exceeded");let I="",O="",Y=Object.keys(S);for(let b=0;b<Y.length;b++){let G=Y[b];if(S[G]!==null&&S[G]!==void 0){let T=G$(S[G]);if(T==="symbol"||T==="function")throw TypeError(`cannot serialize values of type '${T}'`);let q=s1.test(G)?G:r$(G);if(T==="array"&&XS(S[G]))O+=(O&&`
|
|
235
|
+
`)+AS(S[G],H?`${H}.${q}`:q,E-1,R);else if(T==="object"){let Q=H?`${H}.${q}`:q;O+=(O&&`
|
|
236
|
+
`)+s$(Q,S[G],Q,E-1,R)}else I+=q,I+=" = ",I+=n$(S[G],T,E,R),I+=`
|
|
237
|
+
`}}if($&&(I||!O))I=I?`[${$}]
|
|
238
|
+
${I}`:`[${$}]`;return I&&O?`${I}
|
|
239
|
+
${O}`:I||O}function e$($,{maxDepth:S=1000,numbersAsFloat:H=!1}={}){if(G$($)!=="object")throw TypeError("stringify can only be called with an object");let E=s$(0,$,"",S,H);if(E[E.length-1]!==`
|
|
240
|
+
`)return E+`
|
|
241
|
+
`;return E}/*!
|
|
242
242
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
243
243
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
244
244
|
*
|
|
@@ -264,65 +264,67 @@ ${h}`:H||h}function k$($,{maxDepth:S=1000,numbersAsFloat:O=!1}={}){if(t($)!=="ob
|
|
|
264
264
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
265
265
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
266
266
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
267
|
-
*/var
|
|
267
|
+
*/var $1=t$(BS(),".codex"),e1=t$($1,"config.toml"),t1=t$($1,"auth.json"),VS={model_provider:"crs",model:"gpt-5.3-codex",model_reasoning_effort:"high",disable_response_storage:!0,model_providers:{crs:{name:"crs",base_url:`${c}/openai`,wire_api:"responses",requires_openai_auth:!1,env_key:"CRS_OAI_KEY"}}};function $0($,S){let H={...$};for(let[E,R]of Object.entries(S))if(R&&typeof R==="object"&&!Array.isArray(R)&&H[E]&&typeof H[E]==="object"&&!Array.isArray(H[E]))H[E]=$0(H[E],R);else H[E]=R;return H}async function fS($){let S=await import("fs/promises");try{await S.mkdir($1,{recursive:!0})}catch{}let H={};try{H=a$(await S.readFile(e1,"utf-8"))}catch{}let E=$0(H,VS);await Bun.write(e1,e$(E));try{await S.access(t1)}catch{await Bun.write(t1,`{
|
|
268
268
|
"OPENAI_API_KEY": null
|
|
269
269
|
}
|
|
270
|
-
`)}}var w0={id:"codex",name:"Codex",package:"@openai/codex",command:"codex",runtime:"bun",continueArg:"--continue",getEnvVars($){return{CRS_OAI_KEY:$}},setupConfigFiles:m0};m$(w0);var z=H$(o$(),1),L$=H$(i$(),1);import{stdin as s1,stdout as e1}from"process";import*as k from"readline";import o1 from"readline";import{WriteStream as M0}from"tty";function L0({onlyFirst:$=!1}={}){let S=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(S,$?void 0:"g")}var q0=L0();function t1($){if(typeof $!="string")throw TypeError(`Expected a \`string\`, got \`${typeof $}\``);return $.replace(q0,"")}function $S($){return $&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")?$.default:$}var SS={exports:{}};(function($){var S={};$.exports=S,S.eastAsianWidth=function(I){var E=I.charCodeAt(0),H=I.length==2?I.charCodeAt(1):0,h=E;return 55296<=E&&E<=56319&&56320<=H&&H<=57343&&(E&=1023,H&=1023,h=E<<10|H,h+=65536),h==12288||65281<=h&&h<=65376||65504<=h&&h<=65510?"F":h==8361||65377<=h&&h<=65470||65474<=h&&h<=65479||65482<=h&&h<=65487||65490<=h&&h<=65495||65498<=h&&h<=65500||65512<=h&&h<=65518?"H":4352<=h&&h<=4447||4515<=h&&h<=4519||4602<=h&&h<=4607||9001<=h&&h<=9002||11904<=h&&h<=11929||11931<=h&&h<=12019||12032<=h&&h<=12245||12272<=h&&h<=12283||12289<=h&&h<=12350||12353<=h&&h<=12438||12441<=h&&h<=12543||12549<=h&&h<=12589||12593<=h&&h<=12686||12688<=h&&h<=12730||12736<=h&&h<=12771||12784<=h&&h<=12830||12832<=h&&h<=12871||12880<=h&&h<=13054||13056<=h&&h<=19903||19968<=h&&h<=42124||42128<=h&&h<=42182||43360<=h&&h<=43388||44032<=h&&h<=55203||55216<=h&&h<=55238||55243<=h&&h<=55291||63744<=h&&h<=64255||65040<=h&&h<=65049||65072<=h&&h<=65106||65108<=h&&h<=65126||65128<=h&&h<=65131||110592<=h&&h<=110593||127488<=h&&h<=127490||127504<=h&&h<=127546||127552<=h&&h<=127560||127568<=h&&h<=127569||131072<=h&&h<=194367||177984<=h&&h<=196605||196608<=h&&h<=262141?"W":32<=h&&h<=126||162<=h&&h<=163||165<=h&&h<=166||h==172||h==175||10214<=h&&h<=10221||10629<=h&&h<=10630?"Na":h==161||h==164||167<=h&&h<=168||h==170||173<=h&&h<=174||176<=h&&h<=180||182<=h&&h<=186||188<=h&&h<=191||h==198||h==208||215<=h&&h<=216||222<=h&&h<=225||h==230||232<=h&&h<=234||236<=h&&h<=237||h==240||242<=h&&h<=243||247<=h&&h<=250||h==252||h==254||h==257||h==273||h==275||h==283||294<=h&&h<=295||h==299||305<=h&&h<=307||h==312||319<=h&&h<=322||h==324||328<=h&&h<=331||h==333||338<=h&&h<=339||358<=h&&h<=359||h==363||h==462||h==464||h==466||h==468||h==470||h==472||h==474||h==476||h==593||h==609||h==708||h==711||713<=h&&h<=715||h==717||h==720||728<=h&&h<=731||h==733||h==735||768<=h&&h<=879||913<=h&&h<=929||931<=h&&h<=937||945<=h&&h<=961||963<=h&&h<=969||h==1025||1040<=h&&h<=1103||h==1105||h==8208||8211<=h&&h<=8214||8216<=h&&h<=8217||8220<=h&&h<=8221||8224<=h&&h<=8226||8228<=h&&h<=8231||h==8240||8242<=h&&h<=8243||h==8245||h==8251||h==8254||h==8308||h==8319||8321<=h&&h<=8324||h==8364||h==8451||h==8453||h==8457||h==8467||h==8470||8481<=h&&h<=8482||h==8486||h==8491||8531<=h&&h<=8532||8539<=h&&h<=8542||8544<=h&&h<=8555||8560<=h&&h<=8569||h==8585||8592<=h&&h<=8601||8632<=h&&h<=8633||h==8658||h==8660||h==8679||h==8704||8706<=h&&h<=8707||8711<=h&&h<=8712||h==8715||h==8719||h==8721||h==8725||h==8730||8733<=h&&h<=8736||h==8739||h==8741||8743<=h&&h<=8748||h==8750||8756<=h&&h<=8759||8764<=h&&h<=8765||h==8776||h==8780||h==8786||8800<=h&&h<=8801||8804<=h&&h<=8807||8810<=h&&h<=8811||8814<=h&&h<=8815||8834<=h&&h<=8835||8838<=h&&h<=8839||h==8853||h==8857||h==8869||h==8895||h==8978||9312<=h&&h<=9449||9451<=h&&h<=9547||9552<=h&&h<=9587||9600<=h&&h<=9615||9618<=h&&h<=9621||9632<=h&&h<=9633||9635<=h&&h<=9641||9650<=h&&h<=9651||9654<=h&&h<=9655||9660<=h&&h<=9661||9664<=h&&h<=9665||9670<=h&&h<=9672||h==9675||9678<=h&&h<=9681||9698<=h&&h<=9701||h==9711||9733<=h&&h<=9734||h==9737||9742<=h&&h<=9743||9748<=h&&h<=9749||h==9756||h==9758||h==9792||h==9794||9824<=h&&h<=9825||9827<=h&&h<=9829||9831<=h&&h<=9834||9836<=h&&h<=9837||h==9839||9886<=h&&h<=9887||9918<=h&&h<=9919||9924<=h&&h<=9933||9935<=h&&h<=9953||h==9955||9960<=h&&h<=9983||h==10045||h==10071||10102<=h&&h<=10111||11093<=h&&h<=11097||12872<=h&&h<=12879||57344<=h&&h<=63743||65024<=h&&h<=65039||h==65533||127232<=h&&h<=127242||127248<=h&&h<=127277||127280<=h&&h<=127337||127344<=h&&h<=127386||917760<=h&&h<=917999||983040<=h&&h<=1048573||1048576<=h&&h<=1114109?"A":"N"},S.characterLength=function(I){var E=this.eastAsianWidth(I);return E=="F"||E=="W"||E=="A"?2:1};function O(I){return I.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}S.length=function(I){for(var E=O(I),H=0,h=0;h<E.length;h++)H=H+this.characterLength(E[h]);return H},S.slice=function(I,E,H){textLen=S.length(I),E=E||0,H=H||1,E<0&&(E=textLen+E),H<0&&(H=textLen+H);for(var h="",b=0,T=O(I),R=0;R<T.length;R++){var w=T[R],Y=S.length(w);if(b>=E-(Y==2?1:0))if(b+Y<=H)h+=w;else break;b+=Y}return h}})(SS);var W0=SS.exports,Q0=$S(W0),z0=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},Z0=$S(z0);function $$($,S={}){if(typeof $!="string"||$.length===0||(S={ambiguousIsNarrow:!0,...S},$=t1($),$.length===0))return 0;$=$.replace(Z0()," ");let O=S.ambiguousIsNarrow?1:2,I=0;for(let E of $){let H=E.codePointAt(0);if(H<=31||H>=127&&H<=159||H>=768&&H<=879)continue;switch(Q0.eastAsianWidth(E)){case"F":case"W":I+=2;break;case"A":I+=O;break;default:I+=1}}return I}var l$=10,d1=($=0)=>(S)=>`\x1B[${S+$}m`,i1=($=0)=>(S)=>`\x1B[${38+$};5;${S}m`,l1=($=0)=>(S,O,I)=>`\x1B[${38+$};2;${S};${O};${I}m`,M={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(M.modifier);var U0=Object.keys(M.color),J0=Object.keys(M.bgColor);[...U0,...J0];function X0(){let $=new Map;for(let[S,O]of Object.entries(M)){for(let[I,E]of Object.entries(O))M[I]={open:`\x1B[${E[0]}m`,close:`\x1B[${E[1]}m`},O[I]=M[I],$.set(E[0],E[1]);Object.defineProperty(M,S,{value:O,enumerable:!1})}return Object.defineProperty(M,"codes",{value:$,enumerable:!1}),M.color.close="\x1B[39m",M.bgColor.close="\x1B[49m",M.color.ansi=d1(),M.color.ansi256=i1(),M.color.ansi16m=l1(),M.bgColor.ansi=d1(l$),M.bgColor.ansi256=i1(l$),M.bgColor.ansi16m=l1(l$),Object.defineProperties(M,{rgbToAnsi256:{value:(S,O,I)=>S===O&&O===I?S<8?16:S>248?231:Math.round((S-8)/247*24)+232:16+36*Math.round(S/255*5)+6*Math.round(O/255*5)+Math.round(I/255*5),enumerable:!1},hexToRgb:{value:(S)=>{let O=/[a-f\d]{6}|[a-f\d]{3}/i.exec(S.toString(16));if(!O)return[0,0,0];let[I]=O;I.length===3&&(I=[...I].map((H)=>H+H).join(""));let E=Number.parseInt(I,16);return[E>>16&255,E>>8&255,E&255]},enumerable:!1},hexToAnsi256:{value:(S)=>M.rgbToAnsi256(...M.hexToRgb(S)),enumerable:!1},ansi256ToAnsi:{value:(S)=>{if(S<8)return 30+S;if(S<16)return 90+(S-8);let O,I,E;if(S>=232)O=((S-232)*10+8)/255,I=O,E=O;else{S-=16;let b=S%36;O=Math.floor(S/36)/5,I=Math.floor(b/6)/5,E=b%6/5}let H=Math.max(O,I,E)*2;if(H===0)return 30;let h=30+(Math.round(E)<<2|Math.round(I)<<1|Math.round(O));return H===2&&(h+=60),h},enumerable:!1},rgbToAnsi:{value:(S,O,I)=>M.ansi256ToAnsi(M.rgbToAnsi256(S,O,I)),enumerable:!1},hexToAnsi:{value:(S)=>M.ansi256ToAnsi(M.hexToAnsi256(S)),enumerable:!1}}),M}var A0=X0(),q$=new Set(["\x1B","\x9B"]),B0=39,n$="\x07",hS="[",V0="]",OS="m",a$=`${V0}8;;`,p1=($)=>`${q$.values().next().value}${hS}${$}${OS}`,n1=($)=>`${q$.values().next().value}${a$}${$}${n$}`,f0=($)=>$.split(" ").map((S)=>$$(S)),p$=($,S,O)=>{let I=[...S],E=!1,H=!1,h=$$(t1($[$.length-1]));for(let[b,T]of I.entries()){let R=$$(T);if(h+R<=O?$[$.length-1]+=T:($.push(T),h=0),q$.has(T)&&(E=!0,H=I.slice(b+1).join("").startsWith(a$)),E){H?T===n$&&(E=!1,H=!1):T===OS&&(E=!1);continue}h+=R,h===O&&b<I.length-1&&($.push(""),h=0)}!h&&$[$.length-1].length>0&&$.length>1&&($[$.length-2]+=$.pop())},C0=($)=>{let S=$.split(" "),O=S.length;for(;O>0&&!($$(S[O-1])>0);)O--;return O===S.length?$:S.slice(0,O).join(" ")+S.slice(O).join("")},y0=($,S,O={})=>{if(O.trim!==!1&&$.trim()==="")return"";let I="",E,H,h=f0($),b=[""];for(let[R,w]of $.split(" ").entries()){O.trim!==!1&&(b[b.length-1]=b[b.length-1].trimStart());let Y=$$(b[b.length-1]);if(R!==0&&(Y>=S&&(O.wordWrap===!1||O.trim===!1)&&(b.push(""),Y=0),(Y>0||O.trim===!1)&&(b[b.length-1]+=" ",Y++)),O.hard&&h[R]>S){let N=S-Y,K=1+Math.floor((h[R]-N-1)/S);Math.floor((h[R]-1)/S)<K&&b.push(""),p$(b,w,S);continue}if(Y+h[R]>S&&Y>0&&h[R]>0){if(O.wordWrap===!1&&Y<S){p$(b,w,S);continue}b.push("")}if(Y+h[R]>S&&O.wordWrap===!1){p$(b,w,S);continue}b[b.length-1]+=w}O.trim!==!1&&(b=b.map((R)=>C0(R)));let T=[...b.join(`
|
|
271
|
-
`)];for(let[
|
|
272
|
-
`?(
|
|
273
|
-
`&&(
|
|
270
|
+
`)}}var KS={id:"codex",name:"Codex",package:"@openai/codex",command:"codex",runtime:"bun",continueArg:"--continue",getEnvVars($){return{CRS_OAI_KEY:$}},setupConfigFiles:fS};Z$(KS);var h=w$(O1(),1),V$=w$(E1(),1);import{stdin as q0,stdout as v0}from"process";import*as p from"readline";import E0 from"readline";import{WriteStream as PS}from"tty";function kS({onlyFirst:$=!1}={}){let S=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(S,$?void 0:"g")}var FS=kS();function N0($){if(typeof $!="string")throw TypeError(`Expected a \`string\`, got \`${typeof $}\``);return $.replace(FS,"")}function w0($){return $&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")?$.default:$}var L0={exports:{}};(function($){var S={};$.exports=S,S.eastAsianWidth=function(E){var R=E.charCodeAt(0),I=E.length==2?E.charCodeAt(1):0,O=R;return 55296<=R&&R<=56319&&56320<=I&&I<=57343&&(R&=1023,I&=1023,O=R<<10|I,O+=65536),O==12288||65281<=O&&O<=65376||65504<=O&&O<=65510?"F":O==8361||65377<=O&&O<=65470||65474<=O&&O<=65479||65482<=O&&O<=65487||65490<=O&&O<=65495||65498<=O&&O<=65500||65512<=O&&O<=65518?"H":4352<=O&&O<=4447||4515<=O&&O<=4519||4602<=O&&O<=4607||9001<=O&&O<=9002||11904<=O&&O<=11929||11931<=O&&O<=12019||12032<=O&&O<=12245||12272<=O&&O<=12283||12289<=O&&O<=12350||12353<=O&&O<=12438||12441<=O&&O<=12543||12549<=O&&O<=12589||12593<=O&&O<=12686||12688<=O&&O<=12730||12736<=O&&O<=12771||12784<=O&&O<=12830||12832<=O&&O<=12871||12880<=O&&O<=13054||13056<=O&&O<=19903||19968<=O&&O<=42124||42128<=O&&O<=42182||43360<=O&&O<=43388||44032<=O&&O<=55203||55216<=O&&O<=55238||55243<=O&&O<=55291||63744<=O&&O<=64255||65040<=O&&O<=65049||65072<=O&&O<=65106||65108<=O&&O<=65126||65128<=O&&O<=65131||110592<=O&&O<=110593||127488<=O&&O<=127490||127504<=O&&O<=127546||127552<=O&&O<=127560||127568<=O&&O<=127569||131072<=O&&O<=194367||177984<=O&&O<=196605||196608<=O&&O<=262141?"W":32<=O&&O<=126||162<=O&&O<=163||165<=O&&O<=166||O==172||O==175||10214<=O&&O<=10221||10629<=O&&O<=10630?"Na":O==161||O==164||167<=O&&O<=168||O==170||173<=O&&O<=174||176<=O&&O<=180||182<=O&&O<=186||188<=O&&O<=191||O==198||O==208||215<=O&&O<=216||222<=O&&O<=225||O==230||232<=O&&O<=234||236<=O&&O<=237||O==240||242<=O&&O<=243||247<=O&&O<=250||O==252||O==254||O==257||O==273||O==275||O==283||294<=O&&O<=295||O==299||305<=O&&O<=307||O==312||319<=O&&O<=322||O==324||328<=O&&O<=331||O==333||338<=O&&O<=339||358<=O&&O<=359||O==363||O==462||O==464||O==466||O==468||O==470||O==472||O==474||O==476||O==593||O==609||O==708||O==711||713<=O&&O<=715||O==717||O==720||728<=O&&O<=731||O==733||O==735||768<=O&&O<=879||913<=O&&O<=929||931<=O&&O<=937||945<=O&&O<=961||963<=O&&O<=969||O==1025||1040<=O&&O<=1103||O==1105||O==8208||8211<=O&&O<=8214||8216<=O&&O<=8217||8220<=O&&O<=8221||8224<=O&&O<=8226||8228<=O&&O<=8231||O==8240||8242<=O&&O<=8243||O==8245||O==8251||O==8254||O==8308||O==8319||8321<=O&&O<=8324||O==8364||O==8451||O==8453||O==8457||O==8467||O==8470||8481<=O&&O<=8482||O==8486||O==8491||8531<=O&&O<=8532||8539<=O&&O<=8542||8544<=O&&O<=8555||8560<=O&&O<=8569||O==8585||8592<=O&&O<=8601||8632<=O&&O<=8633||O==8658||O==8660||O==8679||O==8704||8706<=O&&O<=8707||8711<=O&&O<=8712||O==8715||O==8719||O==8721||O==8725||O==8730||8733<=O&&O<=8736||O==8739||O==8741||8743<=O&&O<=8748||O==8750||8756<=O&&O<=8759||8764<=O&&O<=8765||O==8776||O==8780||O==8786||8800<=O&&O<=8801||8804<=O&&O<=8807||8810<=O&&O<=8811||8814<=O&&O<=8815||8834<=O&&O<=8835||8838<=O&&O<=8839||O==8853||O==8857||O==8869||O==8895||O==8978||9312<=O&&O<=9449||9451<=O&&O<=9547||9552<=O&&O<=9587||9600<=O&&O<=9615||9618<=O&&O<=9621||9632<=O&&O<=9633||9635<=O&&O<=9641||9650<=O&&O<=9651||9654<=O&&O<=9655||9660<=O&&O<=9661||9664<=O&&O<=9665||9670<=O&&O<=9672||O==9675||9678<=O&&O<=9681||9698<=O&&O<=9701||O==9711||9733<=O&&O<=9734||O==9737||9742<=O&&O<=9743||9748<=O&&O<=9749||O==9756||O==9758||O==9792||O==9794||9824<=O&&O<=9825||9827<=O&&O<=9829||9831<=O&&O<=9834||9836<=O&&O<=9837||O==9839||9886<=O&&O<=9887||9918<=O&&O<=9919||9924<=O&&O<=9933||9935<=O&&O<=9953||O==9955||9960<=O&&O<=9983||O==10045||O==10071||10102<=O&&O<=10111||11093<=O&&O<=11097||12872<=O&&O<=12879||57344<=O&&O<=63743||65024<=O&&O<=65039||O==65533||127232<=O&&O<=127242||127248<=O&&O<=127277||127280<=O&&O<=127337||127344<=O&&O<=127386||917760<=O&&O<=917999||983040<=O&&O<=1048573||1048576<=O&&O<=1114109?"A":"N"},S.characterLength=function(E){var R=this.eastAsianWidth(E);return R=="F"||R=="W"||R=="A"?2:1};function H(E){return E.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}S.length=function(E){for(var R=H(E),I=0,O=0;O<R.length;O++)I=I+this.characterLength(R[O]);return I},S.slice=function(E,R,I){textLen=S.length(E),R=R||0,I=I||1,R<0&&(R=textLen+R),I<0&&(I=textLen+I);for(var O="",Y=0,b=H(E),G=0;G<b.length;G++){var T=b[G],q=S.length(T);if(Y>=R-(q==2?1:0))if(Y+q<=I)O+=T;else break;Y+=q}return O}})(L0);var gS=L0.exports,uS=w0(gS),cS=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},dS=w0(cS);function b$($,S={}){if(typeof $!="string"||$.length===0||(S={ambiguousIsNarrow:!0,...S},$=N0($),$.length===0))return 0;$=$.replace(dS()," ");let H=S.ambiguousIsNarrow?1:2,E=0;for(let R of $){let I=R.codePointAt(0);if(I<=31||I>=127&&I<=159||I>=768&&I<=879)continue;switch(uS.eastAsianWidth(R)){case"F":case"W":E+=2;break;case"A":E+=H;break;default:E+=1}}return E}var R1=10,R0=($=0)=>(S)=>`\x1B[${S+$}m`,I0=($=0)=>(S)=>`\x1B[${38+$};5;${S}m`,Y0=($=0)=>(S,H,E)=>`\x1B[${38+$};2;${S};${H};${E}m`,z={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(z.modifier);var lS=Object.keys(z.color),oS=Object.keys(z.bgColor);[...lS,...oS];function iS(){let $=new Map;for(let[S,H]of Object.entries(z)){for(let[E,R]of Object.entries(H))z[E]={open:`\x1B[${R[0]}m`,close:`\x1B[${R[1]}m`},H[E]=z[E],$.set(R[0],R[1]);Object.defineProperty(z,S,{value:H,enumerable:!1})}return Object.defineProperty(z,"codes",{value:$,enumerable:!1}),z.color.close="\x1B[39m",z.bgColor.close="\x1B[49m",z.color.ansi=R0(),z.color.ansi256=I0(),z.color.ansi16m=Y0(),z.bgColor.ansi=R0(R1),z.bgColor.ansi256=I0(R1),z.bgColor.ansi16m=Y0(R1),Object.defineProperties(z,{rgbToAnsi256:{value:(S,H,E)=>S===H&&H===E?S<8?16:S>248?231:Math.round((S-8)/247*24)+232:16+36*Math.round(S/255*5)+6*Math.round(H/255*5)+Math.round(E/255*5),enumerable:!1},hexToRgb:{value:(S)=>{let H=/[a-f\d]{6}|[a-f\d]{3}/i.exec(S.toString(16));if(!H)return[0,0,0];let[E]=H;E.length===3&&(E=[...E].map((I)=>I+I).join(""));let R=Number.parseInt(E,16);return[R>>16&255,R>>8&255,R&255]},enumerable:!1},hexToAnsi256:{value:(S)=>z.rgbToAnsi256(...z.hexToRgb(S)),enumerable:!1},ansi256ToAnsi:{value:(S)=>{if(S<8)return 30+S;if(S<16)return 90+(S-8);let H,E,R;if(S>=232)H=((S-232)*10+8)/255,E=H,R=H;else{S-=16;let Y=S%36;H=Math.floor(S/36)/5,E=Math.floor(Y/6)/5,R=Y%6/5}let I=Math.max(H,E,R)*2;if(I===0)return 30;let O=30+(Math.round(R)<<2|Math.round(E)<<1|Math.round(H));return I===2&&(O+=60),O},enumerable:!1},rgbToAnsi:{value:(S,H,E)=>z.ansi256ToAnsi(z.rgbToAnsi256(S,H,E)),enumerable:!1},hexToAnsi:{value:(S)=>z.ansi256ToAnsi(z.hexToAnsi256(S)),enumerable:!1}}),z}var pS=iS(),f$=new Set(["\x1B","\x9B"]),DS=39,Y1="\x07",Q0="[",aS="]",z0="m",G1=`${aS}8;;`,G0=($)=>`${f$.values().next().value}${Q0}${$}${z0}`,b0=($)=>`${f$.values().next().value}${G1}${$}${Y1}`,rS=($)=>$.split(" ").map((S)=>b$(S)),I1=($,S,H)=>{let E=[...S],R=!1,I=!1,O=b$(N0($[$.length-1]));for(let[Y,b]of E.entries()){let G=b$(b);if(O+G<=H?$[$.length-1]+=b:($.push(b),O=0),f$.has(b)&&(R=!0,I=E.slice(Y+1).join("").startsWith(G1)),R){I?b===Y1&&(R=!1,I=!1):b===z0&&(R=!1);continue}O+=G,O===H&&Y<E.length-1&&($.push(""),O=0)}!O&&$[$.length-1].length>0&&$.length>1&&($[$.length-2]+=$.pop())},nS=($)=>{let S=$.split(" "),H=S.length;for(;H>0&&!(b$(S[H-1])>0);)H--;return H===S.length?$:S.slice(0,H).join(" ")+S.slice(H).join("")},sS=($,S,H={})=>{if(H.trim!==!1&&$.trim()==="")return"";let E="",R,I,O=rS($),Y=[""];for(let[G,T]of $.split(" ").entries()){H.trim!==!1&&(Y[Y.length-1]=Y[Y.length-1].trimStart());let q=b$(Y[Y.length-1]);if(G!==0&&(q>=S&&(H.wordWrap===!1||H.trim===!1)&&(Y.push(""),q=0),(q>0||H.trim===!1)&&(Y[Y.length-1]+=" ",q++)),H.hard&&O[G]>S){let Q=S-q,u=1+Math.floor((O[G]-Q-1)/S);Math.floor((O[G]-1)/S)<u&&Y.push(""),I1(Y,T,S);continue}if(q+O[G]>S&&q>0&&O[G]>0){if(H.wordWrap===!1&&q<S){I1(Y,T,S);continue}Y.push("")}if(q+O[G]>S&&H.wordWrap===!1){I1(Y,T,S);continue}Y[Y.length-1]+=T}H.trim!==!1&&(Y=Y.map((G)=>nS(G)));let b=[...Y.join(`
|
|
271
|
+
`)];for(let[G,T]of b.entries()){if(E+=T,f$.has(T)){let{groups:Q}=new RegExp(`(?:\\${Q0}(?<code>\\d+)m|\\${G1}(?<uri>.*)${Y1})`).exec(b.slice(G).join(""))||{groups:{}};if(Q.code!==void 0){let u=Number.parseFloat(Q.code);R=u===DS?void 0:u}else Q.uri!==void 0&&(I=Q.uri.length===0?void 0:Q.uri)}let q=pS.codes.get(Number(R));b[G+1]===`
|
|
272
|
+
`?(I&&(E+=b0("")),R&&q&&(E+=G0(q))):T===`
|
|
273
|
+
`&&(R&&q&&(E+=G0(R)),I&&(E+=b0(I)))}return E};function M0($,S,H){return String($).normalize().replace(/\r\n/g,`
|
|
274
274
|
`).split(`
|
|
275
|
-
`).map((
|
|
276
|
-
`)}var
|
|
277
|
-
`),
|
|
278
|
-
`),
|
|
279
|
-
`),
|
|
280
|
-
`).length-1;this.output.write(
|
|
281
|
-
`);this.output.write(
|
|
282
|
-
`).slice(
|
|
283
|
-
`)),this._prevFrame=$;return}this.output.write(
|
|
284
|
-
${
|
|
285
|
-
`,
|
|
286
|
-
${x.default.yellow(
|
|
287
|
-
${x.default.yellow(
|
|
288
|
-
`;case"submit":return`${S}${x.default.gray(
|
|
289
|
-
`+x.default.gray(
|
|
290
|
-
${x.default.cyan(
|
|
291
|
-
`}}}).prompt();var
|
|
292
|
-
${
|
|
293
|
-
`;switch(this.state){case"submit":return`${
|
|
294
|
-
${x.default.gray(
|
|
295
|
-
${x.default.cyan(
|
|
296
|
-
${x.default.cyan(
|
|
297
|
-
`}}}}).prompt()};var
|
|
298
|
-
${x.default.gray(
|
|
275
|
+
`).map((E)=>sS(E,S,H)).join(`
|
|
276
|
+
`)}var eS=Object.defineProperty,tS=($,S,H)=>(S in $)?eS($,S,{enumerable:!0,configurable:!0,writable:!0,value:H}):$[S]=H,K=($,S,H)=>(tS($,typeof S!="symbol"?S+"":S,H),H);function $2($,S){if($===S)return;let H=$.split(`
|
|
277
|
+
`),E=S.split(`
|
|
278
|
+
`),R=[];for(let I=0;I<Math.max(H.length,E.length);I++)H[I]!==E[I]&&R.push(I);return R}var Z0=Symbol("clack:cancel");function d($){return $===Z0}function B$($,S){$.isTTY&&$.setRawMode(S)}var T0=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),S2=new Set(["up","down","left","right","space","enter"]);class b1{constructor({render:$,input:S=q0,output:H=v0,...E},R=!0){K(this,"input"),K(this,"output"),K(this,"rl"),K(this,"opts"),K(this,"_track",!1),K(this,"_render"),K(this,"_cursor",0),K(this,"state","initial"),K(this,"value"),K(this,"error",""),K(this,"subscribers",new Map),K(this,"_prevFrame",""),this.opts=E,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=$.bind(this),this._track=R,this.input=S,this.output=H}prompt(){let $=new PS(0);return $._write=(S,H,E)=>{this._track&&(this.value=this.rl.line.replace(/\t/g,""),this._cursor=this.rl.cursor,this.emit("value",this.value)),E()},this.input.pipe($),this.rl=E0.createInterface({input:this.input,output:$,tabSize:2,prompt:"",escapeCodeTimeout:50}),E0.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),B$(this.input,!0),this.output.on("resize",this.render),this.render(),new Promise((S,H)=>{this.once("submit",()=>{this.output.write(h.cursor.show),this.output.off("resize",this.render),B$(this.input,!1),S(this.value)}),this.once("cancel",()=>{this.output.write(h.cursor.show),this.output.off("resize",this.render),B$(this.input,!1),S(Z0)})})}on($,S){let H=this.subscribers.get($)??[];H.push({cb:S}),this.subscribers.set($,H)}once($,S){let H=this.subscribers.get($)??[];H.push({cb:S,once:!0}),this.subscribers.set($,H)}emit($,...S){let H=this.subscribers.get($)??[],E=[];for(let R of H)R.cb(...S),R.once&&E.push(()=>H.splice(H.indexOf(R),1));for(let R of E)R()}unsubscribe(){this.subscribers.clear()}onKeypress($,S){if(this.state==="error"&&(this.state="active"),S?.name&&!this._track&&T0.has(S.name)&&this.emit("cursor",T0.get(S.name)),S?.name&&S2.has(S.name)&&this.emit("cursor",S.name),$&&($.toLowerCase()==="y"||$.toLowerCase()==="n")&&this.emit("confirm",$.toLowerCase()==="y"),$==="\t"&&this.opts.placeholder&&(this.value||(this.rl.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),$&&this.emit("key",$.toLowerCase()),S?.name==="return"){if(this.opts.validate){let H=this.opts.validate(this.value);H&&(this.error=H,this.state="error",this.rl.write(this.value))}this.state!=="error"&&(this.state="submit")}$==="\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(`
|
|
279
|
+
`),B$(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let $=M0(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
280
|
+
`).length-1;this.output.write(h.cursor.move(-999,$*-1))}render(){let $=M0(this._render(this)??"",process.stdout.columns,{hard:!0});if($!==this._prevFrame){if(this.state==="initial")this.output.write(h.cursor.hide);else{let S=$2(this._prevFrame,$);if(this.restoreCursor(),S&&S?.length===1){let H=S[0];this.output.write(h.cursor.move(0,H)),this.output.write(h.erase.lines(1));let E=$.split(`
|
|
281
|
+
`);this.output.write(E[H]),this._prevFrame=$,this.output.write(h.cursor.move(0,E.length-H-1));return}else if(S&&S?.length>1){let H=S[0];this.output.write(h.cursor.move(0,H)),this.output.write(h.erase.down());let E=$.split(`
|
|
282
|
+
`).slice(H);this.output.write(E.join(`
|
|
283
|
+
`)),this._prevFrame=$;return}this.output.write(h.erase.down())}this.output.write($),this.state==="initial"&&(this.state="active"),this._prevFrame=$}}}var O2=Object.defineProperty,H2=($,S,H)=>(S in $)?O2($,S,{enumerable:!0,configurable:!0,writable:!0,value:H}):$[S]=H,x0=($,S,H)=>(H2($,typeof S!="symbol"?S+"":S,H),H),W0=class extends b1{constructor($){super($,!1),x0(this,"options"),x0(this,"cursor",0),this.options=$.options,this.cursor=this.options.findIndex(({value:S})=>S===$.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(S)=>{switch(S){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}};var E2=Object.defineProperty,R2=($,S,H)=>(S in $)?E2($,S,{enumerable:!0,configurable:!0,writable:!0,value:H}):$[S]=H,I2=($,S,H)=>(R2($,typeof S!="symbol"?S+"":S,H),H);class M1 extends b1{constructor($){super($),I2(this,"valueWithCursor",""),this.on("finalize",()=>{this.value||(this.value=$.defaultValue),this.valueWithCursor=this.value}),this.on("value",()=>{if(this.cursor>=this.value.length)this.valueWithCursor=`${this.value}${V$.default.inverse(V$.default.hidden("_"))}`;else{let S=this.value.slice(0,this.cursor),H=this.value.slice(this.cursor);this.valueWithCursor=`${S}${V$.default.inverse(H[0])}${H.slice(1)}`}})}get cursor(){return this._cursor}}var Y2=globalThis.process.platform.startsWith("win");function J0({input:$=q0,output:S=v0,overwrite:H=!0,hideCursor:E=!0}={}){let R=p.createInterface({input:$,output:S,prompt:"",tabSize:1});p.emitKeypressEvents($,R),$.isTTY&&$.setRawMode(!0);let I=(O,{name:Y})=>{if(String(O)==="\x03"){E&&S.write(h.cursor.show),process.exit(0);return}if(!H)return;p.moveCursor(S,Y==="return"?0:-1,Y==="return"?-1:0,()=>{p.clearLine(S,1,()=>{$.once("keypress",I)})})};return E&&S.write(h.cursor.hide),$.once("keypress",I),()=>{$.off("keypress",I),E&&S.write(h.cursor.show),$.isTTY&&!Y2&&$.setRawMode(!1),R.terminal=!1,R.close()}}var x=w$(E1(),1),H$=w$(O1(),1);import m from"process";function G2(){return m.platform!=="win32"?m.env.TERM!=="linux":Boolean(m.env.CI)||Boolean(m.env.WT_SESSION)||Boolean(m.env.TERMINUS_SUBLIME)||m.env.ConEmuTask==="{cmd::Cmder}"||m.env.TERM_PROGRAM==="Terminus-Sublime"||m.env.TERM_PROGRAM==="vscode"||m.env.TERM==="xterm-256color"||m.env.TERM==="alacritty"||m.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var T1=G2(),W=($,S)=>T1?$:S,b2=W("\u25C6","*"),X0=W("\u25A0","x"),U0=W("\u25B2","x"),x1=W("\u25C7","o"),_H=W("\u250C","T"),U=W("\u2502","|"),K$=W("\u2514","\u2014"),M2=W("\u25CF",">"),T2=W("\u25CB"," "),PH=W("\u25FB","[\u2022]"),kH=W("\u25FC","[+]"),FH=W("\u25FB","[ ]"),gH=W("\u25AA","\u2022"),uH=W("\u2500","-"),cH=W("\u256E","+"),dH=W("\u251C","+"),lH=W("\u256F","+"),x2=W("\u25CF","\u2022"),q2=W("\u25C6","*"),v2=W("\u25B2","!"),N2=W("\u25A0","x"),h0=($)=>{switch($){case"initial":case"active":return x.default.cyan(b2);case"cancel":return x.default.red(X0);case"error":return x.default.yellow(U0);case"submit":return x.default.green(x1)}},A0=($)=>new M1({validate:$.validate,placeholder:$.placeholder,defaultValue:$.defaultValue,initialValue:$.initialValue,render(){let S=`${x.default.gray(U)}
|
|
284
|
+
${h0(this.state)} ${$.message}
|
|
285
|
+
`,H=$.placeholder?x.default.inverse($.placeholder[0])+x.default.dim($.placeholder.slice(1)):x.default.inverse(x.default.hidden("_")),E=this.value?this.valueWithCursor:H;switch(this.state){case"error":return`${S.trim()}
|
|
286
|
+
${x.default.yellow(U)} ${E}
|
|
287
|
+
${x.default.yellow(K$)} ${x.default.yellow(this.error)}
|
|
288
|
+
`;case"submit":return`${S}${x.default.gray(U)} ${x.default.dim(this.value||$.placeholder)}`;case"cancel":return`${S}${x.default.gray(U)} ${x.default.strikethrough(x.default.dim(this.value??""))}${this.value?.trim()?`
|
|
289
|
+
`+x.default.gray(U):""}`;default:return`${S}${x.default.cyan(U)} ${E}
|
|
290
|
+
${x.default.cyan(K$)}
|
|
291
|
+
`}}}).prompt();var M$=($)=>{let S=(E,R)=>{let I=E.label??String(E.value);return R==="active"?`${x.default.green(M2)} ${I} ${E.hint?x.default.dim(`(${E.hint})`):""}`:R==="selected"?`${x.default.dim(I)}`:R==="cancelled"?`${x.default.strikethrough(x.default.dim(I))}`:`${x.default.dim(T2)} ${x.default.dim(I)}`},H=0;return new W0({options:$.options,initialValue:$.initialValue,render(){let E=`${x.default.gray(U)}
|
|
292
|
+
${h0(this.state)} ${$.message}
|
|
293
|
+
`;switch(this.state){case"submit":return`${E}${x.default.gray(U)} ${S(this.options[this.cursor],"selected")}`;case"cancel":return`${E}${x.default.gray(U)} ${S(this.options[this.cursor],"cancelled")}
|
|
294
|
+
${x.default.gray(U)}`;default:{let R=$.maxItems===void 0?1/0:Math.max($.maxItems,5);this.cursor>=H+R-3?H=Math.max(Math.min(this.cursor-R+3,this.options.length-R),0):this.cursor<H+2&&(H=Math.max(this.cursor-2,0));let I=R<this.options.length&&H>0,O=R<this.options.length&&H+R<this.options.length;return`${E}${x.default.cyan(U)} ${this.options.slice(H,H+R).map((Y,b,G)=>b===0&&I?x.default.dim("..."):b===G.length-1&&O?x.default.dim("..."):S(Y,b+H===this.cursor?"active":"inactive")).join(`
|
|
295
|
+
${x.default.cyan(U)} `)}
|
|
296
|
+
${x.default.cyan(K$)}
|
|
297
|
+
`}}}}).prompt()};var q1=($="")=>{process.stdout.write(`${x.default.gray(U)}
|
|
298
|
+
${x.default.gray(K$)} ${$}
|
|
299
299
|
|
|
300
|
-
`)},
|
|
301
|
-
`);
|
|
300
|
+
`)},N={message:($="",{symbol:S=x.default.gray(U)}={})=>{let H=[`${x.default.gray(U)}`];if($){let[E,...R]=$.split(`
|
|
301
|
+
`);H.push(`${S} ${E}`,...R.map((I)=>`${x.default.gray(U)} ${I}`))}process.stdout.write(`${H.join(`
|
|
302
302
|
`)}
|
|
303
|
-
`)},info:($)=>{
|
|
304
|
-
`);let
|
|
305
|
-
`),O()},T=(w="")=>{H=w??H},R=(w)=>{let Y=w>1?"Something went wrong":"Canceled";E&&b(Y,w)};return process.on("uncaughtExceptionMonitor",()=>R(2)),process.on("unhandledRejection",()=>R(2)),process.on("SIGINT",()=>R(1)),process.on("SIGTERM",()=>R(1)),process.on("exit",R),{start:h,stop:b,message:T}};import{join as I1}from"path";J();var Z$=null,h1={cn:{npm:"https://registry.npmmirror.com",bun:"https://bun.sh/install",bunMirror:"https://registry.npmmirror.com/-/binary/bun"},global:{npm:"https://registry.npmjs.org",bun:"https://bun.sh/install",bunMirror:null}};async function F(){if(Z$)return Z$;let $=[t0,$h,Sh];for(let S of $)try{let O=await Promise.race([S(),new Promise((I,E)=>setTimeout(()=>E(Error("timeout")),3000))]);if(O)return Z$=O,O}catch{}return Z$="cn","cn"}async function t0(){try{let $=await fetch("http://ip-api.com/json/?fields=countryCode",{signal:AbortSignal.timeout(2000)});if(!$.ok)return null;return(await $.json()).countryCode==="CN"?"cn":"global"}catch{return null}}async function $h(){try{let $=await fetch("https://ipinfo.io/json",{signal:AbortSignal.timeout(2000)});if(!$.ok)return null;return(await $.json()).country==="CN"?"cn":"global"}catch{return null}}async function Sh(){try{let $=await fetch("https://api.ip.sb/geoip",{signal:AbortSignal.timeout(2000)});if(!$.ok)return null;return(await $.json()).country_code==="CN"?"cn":"global"}catch{return null}}async function hh(){let $=await F();return h1[$]}async function o(){return(await hh()).npm}async function xS(){if(await F()==="cn")return`curl -fsSL https://bun.sh/install | BUN_INSTALL_MIRROR="${h1.cn.bunMirror}" bash`;return"curl -fsSL https://bun.sh/install | bash"}async function YS(){let $=await F(),S=h1[$];if($==="cn")v.info(m("region.usingChinaMirror")),v.message(` npm: ${S.npm}`);else v.info(m("region.usingGlobalMirror"))}var Oh=class{constructor($){this.baseUrl=$.baseUrl,this.headers={"Content-Type":"application/json",...$.defaultHeaders},this.maxRetries=$.maxRetries??3,this.initialRetryDelay=$.initialRetryDelay??500}async resolveHeaders(){let $={};for(let[S,O]of Object.entries(this.headers)){let I=await O;I!==null&&($[S]=I)}return $}addHeader($,S){this.headers[$]=S}async post($,S,O,I){try{let E=await fetch($,{method:"POST",headers:await this.resolveHeaders(),body:S?JSON.stringify(S??{}):void 0,keepalive:!0,...O});if(E.status===401)return null;if(E.status!==200&&E.status!==202)throw Error(`HTTP error! status: ${E.status}`);let H=await E.text();return H?JSON.parse(H):null}catch(E){if(I<this.maxRetries){let H=this.initialRetryDelay*2**I;return await new Promise((h)=>setTimeout(h,H)),this.post($,S,O,I+1)}return console.error("Max retries reached:",E),null}}async fetch($,S,O={}){let I=`${this.baseUrl}${$}`;return this.post(I,S,O,0)}},GS=class{constructor($){this.options=$,this.queue=[];let S={"openpanel-client-id":$.clientId};$.clientSecret&&(S["openpanel-client-secret"]=$.clientSecret),S["openpanel-sdk-name"]=$.sdk||"node",S["openpanel-sdk-version"]=$.sdkVersion||"1.0.4",this.api=new Oh({baseUrl:$.apiUrl||"https://api.openpanel.dev",defaultHeaders:S})}init(){}ready(){this.options.waitForProfile=!1,this.flush()}async send($){return this.options.disabled||this.options.filter&&!this.options.filter($)?Promise.resolve():this.options.waitForProfile&&!this.profileId?(this.queue.push($),Promise.resolve()):this.api.fetch("/track",$)}setGlobalProperties($){this.global={...this.global,...$}}async track($,S){return this.log("track event",$,S),this.send({type:"track",payload:{name:$,profileId:S?.profileId??this.profileId,properties:{...this.global??{},...S??{}}}})}async identify($){if(this.log("identify user",$),$.profileId&&(this.profileId=$.profileId,this.flush()),Object.keys($).length>1)return this.send({type:"identify",payload:{...$,properties:{...this.global,...$.properties}}})}async alias($){}async increment($){return this.send({type:"increment",payload:$})}async decrement($){return this.send({type:"decrement",payload:$})}async revenue($,S){let O=S?.deviceId;return delete S?.deviceId,this.track("revenue",{...S??{},...O?{__deviceId:O}:{},__revenue:$})}async fetchDeviceId(){return(await this.api.fetch("/track/device-id",void 0,{method:"GET",keepalive:!1}))?.deviceId??""}clear(){this.profileId=void 0}flush(){this.queue.forEach(($)=>{this.send({...$,payload:{...$.payload,profileId:$.payload.profileId??this.profileId}})}),this.queue=[]}log(...$){this.options.debug&&console.log("[OpenPanel.dev]",...$)}};var Ih="f8ec91ab-20e5-4c17-bece-f5f2fe647a71",Eh="sec_3038f0cb74f91312f374",Hh="https://op.shiroha.tech/api",h$=null;function O1(){if(!h$)h$=new GS({clientId:Ih,clientSecret:Eh,apiUrl:Hh});return h$}async function vS(){if(h$)try{h$=null}catch{}}J();J();var bh="0.2.8";function NS(){return{cli_version:bh,platform:process.platform,arch:process.arch,locale:c(),node_version:process.version}}function MS($){return Bun.hash($).toString(16).slice(0,8)}var Rh="0.2.8",LS=!1,O$=null;async function qS(){if(O$!==null)return O$;try{return O$=(await W()).telemetryEnabled!==!1,O$}catch{return O$=!1,!1}}async function Th(){try{return(await W()).apiId||"anonymous"}catch{return"anonymous"}}async function U$(){if(LS)return;try{if(!await qS())return;let $=await W();if(!$.apiId)return;let S=O1(),O=await F();await S.identify({profileId:$.apiId,properties:{region:O,locale:c(),first_seen_version:Rh,platform:process.platform,arch:process.arch}}),LS=!0}catch{}}function q($,S){mh($,S).catch(()=>{})}async function mh($,S){try{if(!await qS())return;let O=O1(),I=await Th();await O.track($,{profileId:I,properties:{...NS(),...S}})}catch{}}async function I$(){await vS()}var d=null;function wh($){return $.startsWith(u)}async function xh(){try{if(!await Bun.file(Z).exists())return null;let S=Bun.spawn([Z,"--version"],{stdout:"pipe",stderr:"pipe"});if(await S.exited,S.exitCode!==0)return null;return(await new Response(S.stdout).text()).trim()}catch{return null}}async function QS(){return await xh()!==null}async function Yh(){if(process.platform==="win32")return!0;try{let S=Bun.spawn(["which","unzip"],{stdout:"pipe",stderr:"pipe"});if(await S.exited,S.exitCode===0)return!0}catch{}v.warn("\u6B63\u5728\u5B89\u88C5\u7CFB\u7EDF\u4F9D\u8D56 (unzip)...");let $=["apt-get update -qq && apt-get install -y -qq unzip","yum install -y -q unzip","dnf install -y -q unzip","pacman -S --noconfirm unzip","apk add --quiet unzip"];for(let S of $)try{let O=Bun.spawn(["bash","-c",`sudo ${S} 2>/dev/null || ${S}`],{stdout:"pipe",stderr:"pipe"});if(await O.exited,O.exitCode===0)return!0}catch{}return!1}async function Gh(){let $=y();if(!await Yh())return v.error("\u8BF7\u5148\u624B\u52A8\u5B89\u88C5 unzip: apt install unzip / yum install unzip"),!1;await YS(),$.start("\u6B63\u5728\u5B89\u88C5 Tako \u4E13\u5C5E Bun \u8FD0\u884C\u65F6...");try{await(await import("fs/promises")).mkdir(u,{recursive:!0});let O;if(process.platform==="win32"){let E=await F()==="cn"?'$env:BUN_INSTALL_MIRROR="https://registry.npmmirror.com/-/binary/bun"; ':"",H=`$env:BUN_INSTALL="${u}"; ${E}irm bun.sh/install.ps1 | iex`;O=await Bun.spawn(["powershell","-Command",H],{stdout:"inherit",stderr:"inherit"}).exited}else{let I=await xS(),E=`BUN_INSTALL="${u}" ${I}`;O=await Bun.spawn(["bash","-c",E],{stdout:"inherit",stderr:"inherit"}).exited}if(O!==0)return $.stop("Bun \u5B89\u88C5\u5931\u8D25"),!1;return d=Z,$.stop("Tako \u4E13\u5C5E Bun \u5B89\u88C5\u5B8C\u6210"),v.info(`\u5B89\u88C5\u4F4D\u7F6E: ${u}`),!0}catch(S){return $.stop("Bun \u5B89\u88C5\u5931\u8D25"),!1}}async function vh(){if(await QS())return d=Z,!0;return v.warn("\u672A\u68C0\u6D4B\u5230 Tako \u4E13\u5C5E Bun\uFF0C\u6B63\u5728\u81EA\u52A8\u5B89\u88C5..."),v.info("\uFF08\u4E0D\u4F1A\u5F71\u54CD\u60A8\u7CFB\u7EDF\u4E2D\u5DF2\u5B89\u88C5\u7684 Node.js \u6216 Bun\uFF09"),await Gh()}async function E1(){if(d){if(!wh(d))d=Z;return d}if(await QS())return d=Z,Z;return Z}async function zS($){try{let S=await o(),O=await fetch(`${S}/${$}/latest`);if(!O.ok)return null;return(await O.json()).version}catch{return null}}async function Nh($){return(await W()).installedClients[$.id]?.version||null}async function ZS($){let S=s($.id),O=I1(S,"package.json");try{return await Bun.file(O).exists()}catch{return!1}}async function US($){let S=await Nh($);if(!S)return!0;let O=await zS($.package);if(!O)return!1;return S!==O}async function WS($,S=!1){let O=y(),I=s($.id);try{if(!await vh())return{success:!1,error:"Tako \u4E13\u5C5E Bun \u5B89\u88C5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u6216\u624B\u52A8\u5220\u9664 ~/.tako/bun \u76EE\u5F55\u540E\u91CD\u8BD5"};let E=await ZS($),H=S||await US($);if(E&&!H)return{success:!0};let h=E?"\u66F4\u65B0":"\u5B89\u88C5";O.start(`\u6B63\u5728${h} ${$.name}...`);let b=await import("fs/promises");await b.mkdir(I,{recursive:!0});let T=I1(I,"package.json");if(!await Bun.file(T).exists())await Bun.write(T,JSON.stringify({name:`tako-${$.id}`,private:!0,dependencies:{}},null,2));let w=await E1(),Y=await o();if(E){let l=I1(I,"bun.lock");try{await b.unlink(l)}catch{}}let N=Bun.spawn([w,"add",`${$.package}@latest`],{cwd:I,stdout:"pipe",stderr:"pipe",env:{...process.env,BUN_CONFIG_REGISTRY:Y}});if(await N.exited!==0){let l=await new Response(N.stderr).text();return O.stop(`${h} ${$.name} \u5931\u8D25`),{success:!1,error:l}}let A=await zS($.package),v1=(await W()).installedClients[$.id]?.version;if(A){let l=await W();if(l.installedClients[$.id]={version:A,installedAt:new Date().toISOString()},await b$(l),E&&v1)q("client_updated",{client_id:$.id,from_version:v1,to_version:A});else q("client_installed",{client_id:$.id,client_version:A})}return O.stop(`${$.name} ${h}\u5B8C\u6210`),{success:!0}}catch(E){return O.stop("\u64CD\u4F5C\u5931\u8D25"),{success:!1,error:E instanceof Error?E.message:"\u672A\u77E5\u9519\u8BEF"}}}async function J$($){if(!await ZS($))return await WS($);if(await US($))return await WS($,!0);return{success:!0}}import{homedir as Mh}from"os";var Lh=50,H1=3;async function E$($){try{return(await(await import("fs/promises")).stat($)).isDirectory()}catch{return!1}}async function X$($,S){let O=await W(),I=O.recentProjects||[],E=new Date().toISOString(),H=I.findIndex((b)=>b.path===$);if(H>=0){let b=I[H],T=b.clientUsage||{},R=T[S]||{count:0,lastAt:E};I[H]={...b,launchCount:b.launchCount+1,lastLaunchedAt:E,lastClientId:S,clientUsage:{...T,[S]:{count:R.count+1,lastAt:E}}}}else I.push({path:$,launchCount:1,lastLaunchedAt:E,lastClientId:S,clientUsage:{[S]:{count:1,lastAt:E}}});let h=I.sort((b,T)=>new Date(T.lastLaunchedAt).getTime()-new Date(b.lastLaunchedAt).getTime()).slice(0,Lh);O.recentProjects=h,await f$(O)}function qh($,S){let O=$.clientUsage?.[S];if(O)return new Date(O.lastAt).getTime();if($.lastClientId===S)return new Date($.lastLaunchedAt).getTime();return 0}async function JS($,S=H1,O=!0){let E=(await W()).recentProjects||[],H=process.cwd(),b=E.filter((R)=>{if(O&&R.path===H)return!1;return R.clientUsage?.[$]||R.lastClientId===$}).map((R)=>({...R,lastUsedTime:qh(R,$)})).sort((R,w)=>w.lastUsedTime-R.lastUsedTime),T=[];for(let{lastUsedTime:R,...w}of b){if(T.length>=S)break;if(await E$(w.path))T.push(w)}return T}async function XS(){let S=(await W()).recentProjects||[],O=process.cwd();return S.find((E)=>E.path===O)?.lastClientId||null}function AS($,S=25){let O=Mh(),I=$.startsWith(O)?"~"+$.slice(O.length):$;if(I.length>S){let H=I.split("/").pop()||"";if(H.length>S-4)I="..."+H.slice(-S+3);else I=`.../${H}`}return I}function BS($){let{t:S}=(J(),cS(wS)),O=Date.now(),I=new Date($).getTime(),E=O-I,H=Math.floor(E/60000),h=Math.floor(E/3600000),b=Math.floor(E/86400000),T=Math.floor(b/7),R=Math.floor(b/30);if(H<1)return S("time.justNow");if(H<60)return S("time.minutesAgo",{n:H});if(h<24)return S("time.hoursAgo",{n:h});if(b===1)return S("time.yesterday");if(b<7)return S("time.daysAgo",{n:b});if(b<30)return S("time.weeksAgo",{n:T});return S("time.monthsAgo",{n:R})}J();async function VS($,S){try{let O=S?.projectPath||process.cwd();if(S?.projectPath){if(!await E$(S.projectPath))return{success:!1,error:`\u76EE\u5F55\u4E0D\u5B58\u5728: ${S.projectPath}`}}let I=await J$($);if(!I.success)return I;let E=await R$();if(!E)return{success:!1,error:"\u672A\u914D\u7F6E API Key"};if($.setupConfigFiles)await $.setupConfigFiles(E);let H=await X1($);if(!H)H=A1($);if(!await Bun.file(H).exists())return{success:!1,error:`\u627E\u4E0D\u5230\u53EF\u6267\u884C\u6587\u4EF6: ${H}`};await X$(O,$.id);let b=$.getEnvVars(E),T={...process.env,...b};v.info(`\u542F\u52A8 ${$.name}...`);let R;if($.runtime==="native")R=[H];else R=[await E1(),H];if(S?.args&&S.args.length>0)R=[...R,...S.args];return await Bun.spawn(R,{env:T,stdio:["inherit","inherit","inherit"],cwd:O}).exited,{success:!0}}catch(O){return{success:!1,error:O instanceof Error?O.message:"\u542F\u52A8\u5931\u8D25"}}}async function r($,S){try{let O=S?.projectPath||process.cwd();if(S?.projectPath){if(!await E$(S.projectPath))return{success:!1,error:m("launcher.directoryNotFound",{path:S.projectPath})}}let I=await J$($);if(!I.success)return I;let E=await R$();if(!E)return{success:!1,error:m("launcher.apiKeyNotConfigured")};if($.setupConfigFiles)await $.setupConfigFiles(E);await X$(O,$.id);let h=(await W()).installedClients[$.id]?.version;return q("client_launched",{client_id:$.id,client_version:h,project_hash:MS(O),is_recent_project:!!S?.projectPath}),v.info(m("launcher.starting",{client:$.name})),await VS($,S)}catch(O){return{success:!1,error:O instanceof Error?O.message:"Launch failed"}}}J();import{join as g}from"path";var b1="tako-cli",i="0.2.8";function Wh($,S){let O=$.split(".").map(Number),I=S.split(".").map(Number);for(let E=0;E<3;E++){let H=O[E]||0,h=I[E]||0;if(H>h)return 1;if(H<h)return-1}return 0}async function Qh(){try{let $=await o(),S=await fetch(`${$}/${b1}/latest`,{signal:AbortSignal.timeout(5000)});if(!S.ok)return null;return(await S.json()).version||null}catch{return null}}async function zh(){let $=await Qh();if(!$)return{hasUpdate:!1,currentVersion:i};return{hasUpdate:Wh($,i)>0,latestVersion:$,currentVersion:i}}async function fS(){let $=await import("fs/promises"),S=g(f,"bin"),O=g(S,"tako"),I=g(C,"node_modules/tako-cli/dist/index.js");if(await $.mkdir(S,{recursive:!0}),process.platform==="win32"){let H=`@echo off\r
|
|
306
|
-
"${
|
|
307
|
-
`;await $.writeFile(
|
|
308
|
-
exec "${
|
|
309
|
-
`;await $.writeFile(
|
|
310
|
-
`)}async function
|
|
311
|
-
`).length;process.stdout.write(`\x1B[${b}A\x1B[0J`)}E=Ch(O.data,I),console.log(E)};H();let h=process.stdin.isRaw;if(process.stdin.isTTY)process.stdin.setRawMode(!0);return process.stdin.resume(),new Promise((b)=>{let T=!0,R=()=>{if(!T)return;T=!1,Y(),b()},w=setInterval(async()=>{if(!T)return;if(I--,I<=0){I=10;let N=await w1();if(N.success)O=N}H()},1000),Y=()=>{if(clearInterval(w),process.stdin.removeListener("data",R),process.stdin.isTTY)process.stdin.setRawMode(h??!1);process.stdin.pause()};process.stdin.on("data",R)})}function yh(){let S="\u2500".repeat(50);console.log(),console.log(` \u250C${S}\u2510`);let O=`\uD83D\uDC19 ${m("cli.version",{version:i})}`,I=R1(O),E=Math.floor((50-I)/2),H=50-E-I;console.log(` \u2502${" ".repeat(E)}${O}${" ".repeat(H)}\u2502`);let h=m("banner.welcome"),b=`\x1B[90m${h}\x1B[0m`,T=R1(h),R=Math.floor((50-T)/2),w=50-R-T;console.log(` \u2502${" ".repeat(R)}${b}${" ".repeat(w)}\u2502`),console.log(` \u2514${S}\u2518`),console.log()}async function gS($){switch($.type){case"launch":{q("menu_action",{action:"launch",client_id:$.client.id});let S=await r($.client);if(!S.success)v.error(S.error||m("cli.launchFailed"));return!0}case"launch-in-project":{q("menu_action",{action:"launch",client_id:$.client.id});let S=$.client.continueArg?[$.client.continueArg]:[],O=await r($.client,{projectPath:$.projectPath,args:S});if(!O.success)v.error(O.error||m("cli.launchFailed"));return!0}case"advanced":{q("menu_action",{action:"advanced"});let S=await m1();if(S)return await gS(S);return!0}case"stats":return q("menu_action",{action:"stats"}),await Y1(),!0;case"config":return q("menu_action",{action:"config"}),await B$(!0),!0;case"language":return q("menu_action",{action:"language"}),await gh(),!0;case"exit":return q("menu_action",{action:"exit"}),!1}}async function gh(){let $=S1(),S=m(`language.${$}`),O=await S$({message:m("menu.changeLanguage")+` (${m("menu.currentLanguage",{lang:S})})`,options:[{value:"en",label:m("language.en")},{value:"zh",label:m("language.zh")}]});if(j(O))return;$1(O);let I=m(`language.${O}`);v.success(m("menu.languageChanged",{lang:I}))}async function KS(){if(yh(),!await U1()){if(!await B$()){t$("\u518D\u89C1\uFF01");return}}while(!0){let S=await T1();if(S===null)break;if(!await gS(S))break}t$("\u518D\u89C1\uFF01")}J();var G1="0.2.8";function Kh(){console.log(`
|
|
312
|
-
|
|
303
|
+
`)},info:($)=>{N.message($,{symbol:x.default.blue(x2)})},success:($)=>{N.message($,{symbol:x.default.green(q2)})},step:($)=>{N.message($,{symbol:x.default.green(x1)})},warn:($)=>{N.message($,{symbol:x.default.yellow(v2)})},warning:($)=>{N.warn($)},error:($)=>{N.message($,{symbol:x.default.red(N2)})}},k=()=>{let $=T1?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],S=T1?80:120,H,E,R=!1,I="",O=(T="")=>{R=!0,H=J0(),I=T.replace(/\.+$/,""),process.stdout.write(`${x.default.gray(U)}
|
|
304
|
+
`);let q=0,Q=0;E=setInterval(()=>{let u=x.default.magenta($[q]),C=".".repeat(Math.floor(Q)).slice(0,3);process.stdout.write(H$.cursor.move(-999,0)),process.stdout.write(H$.erase.down(1)),process.stdout.write(`${u} ${I}${C}`),q=q+1<$.length?q+1:0,Q=Q<$.length?Q+0.125:0},S)},Y=(T="",q=0)=>{I=T??I,R=!1,clearInterval(E);let Q=q===0?x.default.green(x1):q===1?x.default.red(X0):x.default.red(U0);process.stdout.write(H$.cursor.move(-999,0)),process.stdout.write(H$.erase.down(1)),process.stdout.write(`${Q} ${I}
|
|
305
|
+
`),H()},b=(T="")=>{I=T??I},G=(T)=>{let q=T>1?"Something went wrong":"Canceled";R&&Y(q,T)};return process.on("uncaughtExceptionMonitor",()=>G(2)),process.on("unhandledRejection",()=>G(2)),process.on("SIGINT",()=>G(1)),process.on("SIGTERM",()=>G(1)),process.on("exit",G),{start:O,stop:Y,message:b}};import{join as Q1}from"path";V();var y$=null,w1={cn:{npm:"https://registry.npmmirror.com",bun:"https://bun.sh/install",bunMirror:"https://registry.npmmirror.com/-/binary/bun"},global:{npm:"https://registry.npmjs.org",bun:"https://bun.sh/install",bunMirror:null}};async function r(){if(y$)return y$;let $=[Q2,z2,Z2];for(let S of $)try{let H=await Promise.race([S(),new Promise((E,R)=>setTimeout(()=>R(Error("timeout")),3000))]);if(H)return y$=H,H}catch{}return y$="cn","cn"}async function Q2(){try{let $=await fetch("http://ip-api.com/json/?fields=countryCode",{signal:AbortSignal.timeout(2000)});if(!$.ok)return null;return(await $.json()).countryCode==="CN"?"cn":"global"}catch{return null}}async function z2(){try{let $=await fetch("https://ipinfo.io/json",{signal:AbortSignal.timeout(2000)});if(!$.ok)return null;return(await $.json()).country==="CN"?"cn":"global"}catch{return null}}async function Z2(){try{let $=await fetch("https://api.ip.sb/geoip",{signal:AbortSignal.timeout(2000)});if(!$.ok)return null;return(await $.json()).country_code==="CN"?"cn":"global"}catch{return null}}async function W2(){let $=await r();return w1[$]}async function n(){return(await W2()).npm}async function V0(){if(await r()==="cn")return`curl -fsSL https://bun.sh/install | BUN_INSTALL_MIRROR="${w1.cn.bunMirror}" bash`;return"curl -fsSL https://bun.sh/install | bash"}async function f0(){let $=await r(),S=w1[$];if($==="cn")N.info(M("region.usingChinaMirror")),N.message(` npm: ${S.npm}`);else N.info(M("region.usingGlobalMirror"))}var J2=class{constructor($){this.baseUrl=$.baseUrl,this.headers={"Content-Type":"application/json",...$.defaultHeaders},this.maxRetries=$.maxRetries??3,this.initialRetryDelay=$.initialRetryDelay??500}async resolveHeaders(){let $={};for(let[S,H]of Object.entries(this.headers)){let E=await H;E!==null&&($[S]=E)}return $}addHeader($,S){this.headers[$]=S}async post($,S,H,E){try{let R=await fetch($,{method:"POST",headers:await this.resolveHeaders(),body:S?JSON.stringify(S??{}):void 0,keepalive:!0,...H});if(R.status===401)return null;if(R.status!==200&&R.status!==202)throw Error(`HTTP error! status: ${R.status}`);let I=await R.text();return I?JSON.parse(I):null}catch(R){if(E<this.maxRetries){let I=this.initialRetryDelay*2**E;return await new Promise((O)=>setTimeout(O,I)),this.post($,S,H,E+1)}return console.error("Max retries reached:",R),null}}async fetch($,S,H={}){let E=`${this.baseUrl}${$}`;return this.post(E,S,H,0)}},K0=class{constructor($){this.options=$,this.queue=[];let S={"openpanel-client-id":$.clientId};$.clientSecret&&(S["openpanel-client-secret"]=$.clientSecret),S["openpanel-sdk-name"]=$.sdk||"node",S["openpanel-sdk-version"]=$.sdkVersion||"1.0.4",this.api=new J2({baseUrl:$.apiUrl||"https://api.openpanel.dev",defaultHeaders:S})}init(){}ready(){this.options.waitForProfile=!1,this.flush()}async send($){return this.options.disabled||this.options.filter&&!this.options.filter($)?Promise.resolve():this.options.waitForProfile&&!this.profileId?(this.queue.push($),Promise.resolve()):this.api.fetch("/track",$)}setGlobalProperties($){this.global={...this.global,...$}}async track($,S){return this.log("track event",$,S),this.send({type:"track",payload:{name:$,profileId:S?.profileId??this.profileId,properties:{...this.global??{},...S??{}}}})}async identify($){if(this.log("identify user",$),$.profileId&&(this.profileId=$.profileId,this.flush()),Object.keys($).length>1)return this.send({type:"identify",payload:{...$,properties:{...this.global,...$.properties}}})}async alias($){}async increment($){return this.send({type:"increment",payload:$})}async decrement($){return this.send({type:"decrement",payload:$})}async revenue($,S){let H=S?.deviceId;return delete S?.deviceId,this.track("revenue",{...S??{},...H?{__deviceId:H}:{},__revenue:$})}async fetchDeviceId(){return(await this.api.fetch("/track/device-id",void 0,{method:"GET",keepalive:!1}))?.deviceId??""}clear(){this.profileId=void 0}flush(){this.queue.forEach(($)=>{this.send({...$,payload:{...$.payload,profileId:$.payload.profileId??this.profileId}})}),this.queue=[]}log(...$){this.options.debug&&console.log("[OpenPanel.dev]",...$)}};var X2="f8ec91ab-20e5-4c17-bece-f5f2fe647a71",U2="sec_3038f0cb74f91312f374",h2="https://op.shiroha.tech/api",T$=null;function L1(){if(!T$)T$=new K0({clientId:X2,clientSecret:U2,apiUrl:h2});return T$}async function C0(){if(T$)try{T$=null}catch{}}V();V();var A2="0.2.10";function m0(){return{cli_version:A2,platform:process.platform,arch:process.arch,locale:a(),node_version:process.version}}function y0($){return Bun.hash($).toString(16).slice(0,8)}var B2="0.2.10",j0=!1,x$=null;async function _0(){if(x$!==null)return x$;try{return x$=(await X()).telemetryEnabled!==!1,x$}catch{return x$=!1,!1}}async function V2(){try{return(await X()).apiId||"anonymous"}catch{return"anonymous"}}async function j$(){if(j0)return;try{if(!await _0())return;let $=await X();if(!$.apiId)return;let S=L1(),H=await r();await S.identify({profileId:$.apiId,properties:{region:H,locale:a(),first_seen_version:B2,platform:process.platform,arch:process.arch}}),j0=!0}catch{}}function J($,S){f2($,S).catch(()=>{})}async function f2($,S){try{if(!await _0())return;let H=L1(),E=await V2();await H.track($,{profileId:E,properties:{...m0(),...S}})}catch{}}async function q$(){await C0()}var s=null;function K2($){return $.startsWith(D)}async function C2(){try{if(!await Bun.file(A).exists())return null;let S=Bun.spawn([A,"--version"],{stdout:"pipe",stderr:"pipe"});if(await S.exited,S.exitCode!==0)return null;return(await new Response(S.stdout).text()).trim()}catch{return null}}async function k0(){return await C2()!==null}async function m2(){if(process.platform==="win32")return!0;try{let S=Bun.spawn(["which","unzip"],{stdout:"pipe",stderr:"pipe"});if(await S.exited,S.exitCode===0)return!0}catch{}N.warn("\u6B63\u5728\u5B89\u88C5\u7CFB\u7EDF\u4F9D\u8D56 (unzip)...");let $=["apt-get update -qq && apt-get install -y -qq unzip","yum install -y -q unzip","dnf install -y -q unzip","pacman -S --noconfirm unzip","apk add --quiet unzip"];for(let S of $)try{let H=Bun.spawn(["bash","-c",`sudo ${S} 2>/dev/null || ${S}`],{stdout:"pipe",stderr:"pipe"});if(await H.exited,H.exitCode===0)return!0}catch{}return!1}async function y2(){let $=k();if(!await m2())return N.error("\u8BF7\u5148\u624B\u52A8\u5B89\u88C5 unzip: apt install unzip / yum install unzip"),!1;await f0(),$.start("\u6B63\u5728\u5B89\u88C5 Tako \u4E13\u5C5E Bun \u8FD0\u884C\u65F6...");try{await(await import("fs/promises")).mkdir(D,{recursive:!0});let H;if(process.platform==="win32"){let R=await r()==="cn"?'$env:BUN_INSTALL_MIRROR="https://registry.npmmirror.com/-/binary/bun"; ':"",I=`$env:BUN_INSTALL="${D}"; ${R}irm bun.sh/install.ps1 | iex`;H=await Bun.spawn(["powershell","-Command",I],{stdout:"inherit",stderr:"inherit"}).exited}else{let E=await V0(),R=`BUN_INSTALL="${D}" ${E}`;H=await Bun.spawn(["bash","-c",R],{stdout:"inherit",stderr:"inherit"}).exited}if(H!==0)return $.stop("Bun \u5B89\u88C5\u5931\u8D25"),!1;return s=A,$.stop("Tako \u4E13\u5C5E Bun \u5B89\u88C5\u5B8C\u6210"),N.info(`\u5B89\u88C5\u4F4D\u7F6E: ${D}`),!0}catch(S){return $.stop("Bun \u5B89\u88C5\u5931\u8D25"),!1}}async function j2(){if(await k0())return s=A,!0;return N.warn("\u672A\u68C0\u6D4B\u5230 Tako \u4E13\u5C5E Bun\uFF0C\u6B63\u5728\u81EA\u52A8\u5B89\u88C5..."),N.info("\uFF08\u4E0D\u4F1A\u5F71\u54CD\u60A8\u7CFB\u7EDF\u4E2D\u5DF2\u5B89\u88C5\u7684 Node.js \u6216 Bun\uFF09"),await y2()}async function z1(){if(s){if(!K2(s))s=A;return s}if(await k0())return s=A,A;return A}async function F0($){try{let S=await n(),H=await fetch(`${S}/${$}/latest`);if(!H.ok)return null;return(await H.json()).version}catch{return null}}async function _2($){return(await X()).installedClients[$.id]?.version||null}async function g0($){let S=I$($.id),H=Q1(S,"package.json");try{return await Bun.file(H).exists()}catch{return!1}}async function u0($){let S=await _2($);if(!S)return!0;let H=await F0($.package);if(!H)return!1;return S!==H}async function P0($,S=!1){let H=k(),E=I$($.id);try{if(!await j2())return{success:!1,error:"Tako \u4E13\u5C5E Bun \u5B89\u88C5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u6216\u624B\u52A8\u5220\u9664 ~/.tako/bun \u76EE\u5F55\u540E\u91CD\u8BD5"};let R=await g0($),I=S||await u0($);if(R&&!I)return{success:!0};let O=R?"\u66F4\u65B0":"\u5B89\u88C5";H.start(`\u6B63\u5728${O} ${$.name}...`);let Y=await import("fs/promises");await Y.mkdir(E,{recursive:!0});let b=Q1(E,"package.json");if(!await Bun.file(b).exists())await Bun.write(b,JSON.stringify({name:`tako-${$.id}`,private:!0,dependencies:{}},null,2));let T=await z1(),q=await n();if(R){let $$=Q1(E,"bun.lock");try{await Y.unlink($$)}catch{}}let Q=Bun.spawn([T,"add",`${$.package}@latest`],{cwd:E,stdout:"pipe",stderr:"pipe",env:{...process.env,BUN_CONFIG_REGISTRY:q}});if(await Q.exited!==0){let $$=await new Response(Q.stderr).text();return H.stop(`${O} ${$.name} \u5931\u8D25`),{success:!1,error:$$}}let C=await F0($.package),C1=(await X()).installedClients[$.id]?.version;if(C){let $$=await X();if($$.installedClients[$.id]={version:C,installedAt:new Date().toISOString()},await L$($$),R&&C1)J("client_updated",{client_id:$.id,from_version:C1,to_version:C});else J("client_installed",{client_id:$.id,client_version:C})}return H.stop(`${$.name} ${O}\u5B8C\u6210`),{success:!0}}catch(R){return H.stop("\u64CD\u4F5C\u5931\u8D25"),{success:!1,error:R instanceof Error?R.message:"\u672A\u77E5\u9519\u8BEF"}}}async function _$($){if(!await g0($))return await P0($);if(await u0($))return await P0($,!0);return{success:!0}}import{homedir as P2}from"os";var k2=50,Z1=3;async function v$($){try{return(await(await import("fs/promises")).stat($)).isDirectory()}catch{return!1}}async function P$($,S){let H=await X(),E=H.recentProjects||[],R=new Date().toISOString(),I=E.findIndex((Y)=>Y.path===$);if(I>=0){let Y=E[I],b=Y.clientUsage||{},G=b[S]||{count:0,lastAt:R};E[I]={...Y,launchCount:Y.launchCount+1,lastLaunchedAt:R,lastClientId:S,clientUsage:{...b,[S]:{count:G.count+1,lastAt:R}}}}else E.push({path:$,launchCount:1,lastLaunchedAt:R,lastClientId:S,clientUsage:{[S]:{count:1,lastAt:R}}});let O=E.sort((Y,b)=>new Date(b.lastLaunchedAt).getTime()-new Date(Y.lastLaunchedAt).getTime()).slice(0,k2);H.recentProjects=O,await o$(H)}function F2($,S){let H=$.clientUsage?.[S];if(H)return new Date(H.lastAt).getTime();if($.lastClientId===S)return new Date($.lastLaunchedAt).getTime();return 0}async function c0($,S=Z1,H=!0){let R=(await X()).recentProjects||[],I=process.cwd(),Y=R.filter((G)=>{if(H&&G.path===I)return!1;return G.clientUsage?.[$]||G.lastClientId===$}).map((G)=>({...G,lastUsedTime:F2(G,$)})).sort((G,T)=>T.lastUsedTime-G.lastUsedTime),b=[];for(let{lastUsedTime:G,...T}of Y){if(b.length>=S)break;if(await v$(T.path))b.push(T)}return b}async function d0(){let S=(await X()).recentProjects||[],H=process.cwd();return S.find((R)=>R.path===H)?.lastClientId||null}function l0($,S=25){let H=P2(),E=$.startsWith(H)?"~"+$.slice(H.length):$;if(E.length>S){let I=E.split("/").pop()||"";if(I.length>S-4)E="..."+I.slice(-S+3);else E=`.../${I}`}return E}function o0($){let{t:S}=(V(),RS(B0)),H=Date.now(),E=new Date($).getTime(),R=H-E,I=Math.floor(R/60000),O=Math.floor(R/3600000),Y=Math.floor(R/86400000),b=Math.floor(Y/7),G=Math.floor(Y/30);if(I<1)return S("time.justNow");if(I<60)return S("time.minutesAgo",{n:I});if(O<24)return S("time.hoursAgo",{n:O});if(Y===1)return S("time.yesterday");if(Y<7)return S("time.daysAgo",{n:Y});if(Y<30)return S("time.weeksAgo",{n:b});return S("time.monthsAgo",{n:G})}V();async function i0($,S){try{let H=S?.projectPath||process.cwd();if(S?.projectPath){if(!await v$(S.projectPath))return{success:!1,error:`\u76EE\u5F55\u4E0D\u5B58\u5728: ${S.projectPath}`}}let E=await _$($);if(!E.success)return E;let R=await Q$();if(!R)return{success:!1,error:"\u672A\u914D\u7F6E API Key"};if($.setupConfigFiles)await $.setupConfigFiles(R);let I=await d1($);if(!I)I=l1($);if(!await Bun.file(I).exists())return{success:!1,error:`\u627E\u4E0D\u5230\u53EF\u6267\u884C\u6587\u4EF6: ${I}`};await P$(H,$.id);let Y=$.getEnvVars(R),b={...process.env,...Y};N.info(`\u542F\u52A8 ${$.name}...`);let G;if($.runtime==="native")G=[I];else G=[await z1(),I];if(S?.args&&S.args.length>0)G=[...G,...S.args];return await Bun.spawn(G,{env:b,stdio:["inherit","inherit","inherit"],cwd:H}).exited,{success:!0}}catch(H){return{success:!1,error:H instanceof Error?H.message:"\u542F\u52A8\u5931\u8D25"}}}async function E$($,S){try{let H=S?.projectPath||process.cwd();if(S?.projectPath){if(!await v$(S.projectPath))return{success:!1,error:M("launcher.directoryNotFound",{path:S.projectPath})}}let E=await _$($);if(!E.success)return E;let R=await Q$();if(!R)return{success:!1,error:M("launcher.apiKeyNotConfigured")};if($.setupConfigFiles)await $.setupConfigFiles(R);await P$(H,$.id);let O=(await X()).installedClients[$.id]?.version;return J("client_launched",{client_id:$.id,client_version:O,project_hash:y0(H),is_recent_project:!!S?.projectPath}),N.info(M("launcher.starting",{client:$.name})),await i0($,S)}catch(H){return{success:!1,error:H instanceof Error?H.message:"Launch failed"}}}V();import{join as F}from"path";var W1="tako-cli",e="0.2.10";function g2($,S){let H=$.split(".").map(Number),E=S.split(".").map(Number);for(let R=0;R<3;R++){let I=H[R]||0,O=E[R]||0;if(I>O)return 1;if(I<O)return-1}return 0}async function u2(){try{let $=await n(),S=await fetch(`${$}/${W1}/latest`,{signal:AbortSignal.timeout(5000)});if(!S.ok)return null;return(await S.json()).version||null}catch{return null}}async function c2(){let $=await u2();if(!$)return{hasUpdate:!1,currentVersion:e};return{hasUpdate:g2($,e)>0,latestVersion:$,currentVersion:e}}async function p0(){let $=await import("fs/promises"),S=F(_,"bin"),H=F(S,"tako"),E=F(P,"node_modules/tako-cli/dist/index.js");if(await $.mkdir(S,{recursive:!0}),process.platform==="win32"){let I=`@echo off\r
|
|
306
|
+
"${A}" "${E}" %*\r
|
|
307
|
+
`;await $.writeFile(F(S,"tako.cmd"),I)}else{let I=`#!/bin/bash
|
|
308
|
+
exec "${A}" "${E}" "$@"
|
|
309
|
+
`;await $.writeFile(H,I,{mode:493})}}async function d2($){let S=k();S.start(`\u6B63\u5728\u66F4\u65B0\u5230 v${$}...`);try{let H=await n(),E=await import("fs/promises");await E.mkdir(P,{recursive:!0});let R=F(P,"package.json");try{await E.access(R)}catch{await E.writeFile(R,JSON.stringify({name:"tako-local",private:!0},null,2))}let I=Bun.spawn([A,"update",W1,"--latest"],{cwd:P,stdout:"pipe",stderr:"pipe",env:{...process.env,BUN_CONFIG_REGISTRY:H}});if(await I.exited,I.exitCode===0)return await p0(),J("cli_updated",{from_version:e,to_version:$}),S.stop(`\u66F4\u65B0\u6210\u529F\uFF01\u5DF2\u66F4\u65B0\u5230 v${$}`),!0;else{let O=await new Response(I.stderr).text();return S.stop(`\u66F4\u65B0\u5931\u8D25: ${O||"\u672A\u77E5\u9519\u8BEF"}`),!1}}catch(H){return S.stop(`\u66F4\u65B0\u5931\u8D25: ${H instanceof Error?H.message:"\u672A\u77E5\u9519\u8BEF"}`),!1}}async function l2(){let $=await import("fs/promises"),S=F(P,"bun.lock");try{await $.unlink(S)}catch{}}async function o2(){let $=await import("fs/promises");try{let S=await n();await $.mkdir(P,{recursive:!0});let H=F(P,"package.json");try{await $.access(H)}catch{await $.writeFile(H,JSON.stringify({name:"tako-local",private:!0},null,2))}await l2();let E=Bun.spawn([A,"add",`${W1}@latest`],{cwd:P,stdout:"pipe",stderr:"pipe",env:{...process.env,BUN_CONFIG_REGISTRY:S}});return await E.exited,E.exitCode===0}catch{return!1}}async function i2(){let $=await import("fs/promises"),S=F(_,"bin"),H=F(S,"tako"),E=F(P,"node_modules/tako-cli/dist/index.js");try{let R=await $.readFile(H,"utf-8");if(R.includes("bun run tako-cli")||R.includes("run tako-cli")){N.info(M("updater.migrating"));let I=!1;try{await $.access(E),I=!0}catch{I=!1}if(!I){let O=k();if(O.start(M("updater.installingLocally")),!await o2())return O.stop(M("updater.migrationFailed")),!1;O.stop(M("updater.installComplete"))}return await p0(),!0}}catch{}return!1}async function k$(){try{if(await i2())N.info(M("updater.migrationComplete")),process.exit(0);let S=await c2();if(S.hasUpdate&&S.latestVersion){if(N.warn(M("updater.newVersionAvailable",{version:S.latestVersion,current:e})),await d2(S.latestVersion))N.info(M("updater.pleaseRestart")),process.exit(0)}}catch{}}V();function p2($){let S=$.codePointAt(0);if(!S)return!1;return S>=19968&&S<=40959||S>=13312&&S<=19903||S>=131072&&S<=191471||S>=63744&&S<=64255||S>=194560&&S<=195103||S>=44032&&S<=55215||S>=12352&&S<=12447||S>=12448&&S<=12543||S>=65280&&S<=65519||S>=126976&&S<=131071||S>=9728&&S<=10175||S===11088}function D2($){return $.replace(/\x1b\[[0-9;]*m/g,"")}function J1($){let S=D2($),H=0;for(let E of S)H+=p2(E)?2:1;return H}V();async function D0(){let $=o1(),S=await d0(),H=process.cwd(),E=[],R=[...$].sort((I,O)=>{if(I.id===S)return-1;if(O.id===S)return 1;return 0});for(let I of R){let O=await c0(I.id,Z1,!0);E.push({value:{type:"launch",client:I},label:I.name,hint:M("recentProjects.launchInCurrent")});for(let Y of O)E.push({value:{type:"launch-in-project",client:I,projectPath:Y.path},label:` \u2514\u2500 ${l0(Y.path,35)}`,hint:o0(Y.lastLaunchedAt)})}return E.push({value:{type:"advanced"},label:M("menu.advanced"),hint:M("menu.advancedHint")},{value:{type:"exit"},label:M("menu.exit")}),E}async function X1(){let $=await D0(),S=await M$({message:M("menu.selectAction"),options:$});if(d(S))return null;return S}async function U1(){let $=await M$({message:M("menu.advancedOptions"),options:[{value:{type:"stats"},label:M("menu.viewStats")},{value:{type:"config"},label:M("menu.configApiKey")},{value:{type:"language"},label:M("menu.changeLanguage")},{value:null,label:M("menu.back")}]});if(d($)||$===null)return null;return $}V();function a2($){return $.startsWith("cr_")&&$.length>10}async function r2($){try{let H=await(await fetch(`${c}/apiStats/api/get-key-id`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:$})})).json();if(H.success&&H.data?.id)return{valid:!0,apiId:H.data.id};return{valid:!1,error:H.error||M("auth.validationFailed")}}catch(S){return{valid:!1,error:S instanceof Error?S.message:M("auth.networkError")}}}async function a0($){if(!a2($))return J("api_key_validated",{success:!1,error_type:"invalid_format"}),{success:!1,error:M("auth.invalidFormat")};let S=await r2($);if(!S.valid)return J("api_key_validated",{success:!1,error_type:"api_validation_failed"}),{success:!1,error:S.error};return await L$({apiKey:$,apiId:S.apiId}),J("api_key_validated",{success:!0}),j$(),{success:!0}}V();async function F$($=!1){if(!$)N.warn("API Key not detected"),console.log();let S=await A0({message:M("prompts.enterApiKey"),placeholder:M("prompts.apiKeyPlaceholder"),validate(R){if(!R)return M("prompts.enterApiKey");if(!R.startsWith("cr_"))return M("prompts.keyInvalidFormat");if(R.length<10)return M("prompts.keyInvalidFormat")}});if(d(S))return!1;let H=k();H.start(M("prompts.validating"));let E=await a0(S);if(E.success)return H.stop(M("prompts.keyConfigured")),!0;else return H.stop(M("prompts.keyValidationFailed",{error:E.error||""})),!1}async function N$(){try{let $=await c1();if(!$)return{success:!1,error:"\u672A\u627E\u5230 API ID\uFF0C\u8BF7\u91CD\u65B0\u914D\u7F6E Key"};let H=await(await fetch(`${c}/apiStats/api/user-stats`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiId:$})})).json(),R=await(await fetch(`${c}/apiStats/api/user-model-stats`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiId:$,period:"daily"})})).json();if(!H.success)return{success:!1,error:H.error||H.message||"\u83B7\u53D6\u7EDF\u8BA1\u5931\u8D25"};let I=(R.data||[]).map((O)=>({model:O.model,requests:O.requests,cost:O.formatted?.total||"$0.00"}));return{success:!0,data:{totalRequests:H.data?.usage?.total?.requests||0,totalCost:H.data?.usage?.total?.formattedCost||"$0.00",todayCost:`$${(H.data?.limits?.currentDailyCost||0).toFixed(2)}`,modelStats:I}}}catch($){return{success:!1,error:$ instanceof Error?$.message:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25"}}}function h1($){return $.toLocaleString("en-US")}V();function n2($,S){let H=[];if(H.push(""),H.push(` ${M("stats.title")}`),H.push(""),H.push(` ${M("stats.totalRequests",{count:h1($.totalRequests)})}`),H.push(` ${M("stats.totalCost",{cost:$.totalCost})}`),H.push(` ${M("stats.todayCost",{cost:$.todayCost})}`),$.modelStats.length>0)H.push(""),H.push(` ${M("stats.modelDistribution")}`),$.modelStats.forEach((E,R)=>{let I=R===$.modelStats.length-1?"\u2514\u2500":"\u251C\u2500",O=E.model.length>25?E.model.slice(0,22)+"...":E.model;H.push(` ${I} ${O.padEnd(25)} ${h1(E.requests).padStart(6)} ${M("stats.times")} ${E.cost.padStart(8)}`)});return H.push(""),H.push(` \x1B[90m${M("stats.refreshHint",{countdown:S})}\x1B[0m`),H.join(`
|
|
310
|
+
`)}async function A1(){let S=k();S.start(M("stats.fetching"));let H=await N$();if(!H.success){S.stop(M("stats.fetchFailed",{error:H.error||""}));return}S.stop("");let E=10,R="",I=()=>{if(R){let Y=R.split(`
|
|
311
|
+
`).length;process.stdout.write(`\x1B[${Y}A\x1B[0J`)}R=n2(H.data,E),console.log(R)};I();let O=process.stdin.isRaw;if(process.stdin.isTTY)process.stdin.setRawMode(!0);return process.stdin.resume(),new Promise((Y)=>{let b=!0,G=()=>{if(!b)return;b=!1,q(),Y()},T=setInterval(async()=>{if(!b)return;if(E--,E<=0){E=10;let Q=await N$();if(Q.success)H=Q}I()},1000),q=()=>{if(clearInterval(T),process.stdin.removeListener("data",G),process.stdin.isTTY)process.stdin.setRawMode(O??!1);process.stdin.pause()};process.stdin.on("data",G)})}function s2(){let S="\u2500".repeat(50);console.log(),console.log(` \u250C${S}\u2510`);let H=`\uD83D\uDC19 ${M("cli.version",{version:e})}`,E=J1(H),R=Math.floor((50-E)/2),I=50-R-E;console.log(` \u2502${" ".repeat(R)}${H}${" ".repeat(I)}\u2502`);let O=M("banner.welcome"),Y=`\x1B[90m${O}\x1B[0m`,b=J1(O),G=Math.floor((50-b)/2),T=50-G-b;console.log(` \u2502${" ".repeat(G)}${Y}${" ".repeat(T)}\u2502`),console.log(` \u2514${S}\u2518`),console.log()}async function r0($){switch($.type){case"launch":{J("menu_action",{action:"launch",client_id:$.client.id});let S=await E$($.client);if(!S.success)N.error(S.error||M("cli.launchFailed"));return!0}case"launch-in-project":{J("menu_action",{action:"launch",client_id:$.client.id});let S=$.client.continueArg?[$.client.continueArg]:[],H=await E$($.client,{projectPath:$.projectPath,args:S});if(!H.success)N.error(H.error||M("cli.launchFailed"));return!0}case"advanced":{J("menu_action",{action:"advanced"});let S=await U1();if(S)return await r0(S);return!0}case"stats":return J("menu_action",{action:"stats"}),await A1(),!0;case"config":return J("menu_action",{action:"config"}),await F$(!0),!0;case"language":return J("menu_action",{action:"language"}),await e2(),!0;case"exit":return J("menu_action",{action:"exit"}),!1}}async function e2(){let $=N1(),S=M(`language.${$}`),H=await M$({message:M("menu.changeLanguage")+` (${M("menu.currentLanguage",{lang:S})})`,options:[{value:"en",label:M("language.en")},{value:"zh",label:M("language.zh")}]});if(d(H))return;v1(H);let E=M(`language.${H}`);N.success(M("menu.languageChanged",{lang:E}))}async function n0(){if(s2(),!await u1()){if(!await F$()){q1("\u518D\u89C1\uFF01");return}}while(!0){let S=await X1();if(S===null)break;if(!await r0(S))break}q1("\u518D\u89C1\uFF01")}V();import{homedir as $O}from"os";var Z={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",brightBlack:"\x1B[90m",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m"};var L={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",reset:"\x1B[0m"};var w={directory:{icon:Z.brightYellow,text:Z.brightGreen},git:{icon:Z.brightBlue,text:Z.brightBlue,clean:Z.brightGreen,dirty:Z.brightYellow,conflict:Z.brightRed},model:{icon:Z.brightCyan,text:Z.brightCyan},version:{icon:Z.brightWhite,text:Z.brightBlack},outputStyle:{icon:Z.brightMagenta,text:Z.brightMagenta},context:{icon:Z.brightMagenta,low:Z.brightGreen,medium:Z.brightYellow,high:Z.brightRed},todayUsage:{icon:Z.brightGreen,text:Z.brightGreen},separator:Z.brightBlack},l={directory:{nerd:"\uF07B",plain:"\uD83D\uDCC1"},git:{nerd:"\uE725",plain:"\uD83C\uDF3F"},model:{nerd:"\uF11B",plain:"\uD83E\uDD16"},version:{nerd:"\uF412",plain:"\uD83D\uDCBE"},outputStyle:{nerd:"\uF12F5",plain:"\uD83C\uDFAF"},context:{nerd:"\uF0E7",plain:"\u26A1"},todayUsage:{nerd:"\uF155",plain:"\uD83D\uDCB0"},gitClean:"\u2713",gitDirty:"\u25CF",gitConflict:"\u26A0",gitAhead:"\u2191",gitBehind:"\u2193"};function t2(){return!1}function f($){let S=l[$];if(typeof S==="string")return S;return t2()?S.nerd:S.plain}class g${id="directory";render($){let S=this.formatPath($.workspace.current_dir),H=f("directory");return`${w.directory.icon}${H}${L.reset} ${w.directory.text}${S}${L.reset}`}formatPath($){let S=$O();if($===S)return"~";if($.startsWith(S+"/"))return"~"+$.slice(S.length);return $}}class u${id="git";async render($){let S=$.workspace.current_dir;if(!await this.isGitRepository(S))return null;let E=await this.getBranch(S);if(!E)return null;let{status:R,statusColor:I}=await this.getStatus(S),{ahead:O,behind:Y}=await this.getAheadBehind(S),b=f("git"),G=`${w.git.icon}${b}${L.reset} ${w.git.text}${E}${L.reset}`;if(G+=` ${I}${R}${L.reset}`,O>0)G+=` ${w.git.clean}${l.gitAhead}${O}${L.reset}`;if(Y>0)G+=` ${w.git.dirty}${l.gitBehind}${Y}${L.reset}`;return G}async isGitRepository($){try{return await Bun.spawn(["git","rev-parse","--git-dir"],{cwd:$,stdout:"pipe",stderr:"pipe"}).exited===0}catch{return!1}}async getBranch($){try{let S=Bun.spawn(["git","branch","--show-current"],{cwd:$,stdout:"pipe",stderr:"pipe"}),H=await new Response(S.stdout).text();if(await S.exited===0&&H.trim())return H.trim();let R=Bun.spawn(["git","rev-parse","--short","HEAD"],{cwd:$,stdout:"pipe",stderr:"pipe"}),I=await new Response(R.stdout).text();if(await R.exited===0&&I.trim())return`detached:${I.trim()}`;return null}catch{return null}}async getStatus($){try{let S=Bun.spawn(["git","status","--porcelain"],{cwd:$,stdout:"pipe",stderr:"pipe"}),H=await new Response(S.stdout).text();if(await S.exited!==0)return{status:l.gitClean,statusColor:w.git.clean};let R=H.trim();if(!R)return{status:l.gitClean,statusColor:w.git.clean};if(R.includes("UU")||R.includes("AA")||R.includes("DD"))return{status:l.gitConflict,statusColor:w.git.conflict};return{status:l.gitDirty,statusColor:w.git.dirty}}catch{return{status:l.gitClean,statusColor:w.git.clean}}}async getAheadBehind($){try{let S=Bun.spawn(["git","rev-list","--count","@{u}..HEAD"],{cwd:$,stdout:"pipe",stderr:"pipe"}),H=await new Response(S.stdout).text(),R=await S.exited===0?parseInt(H.trim(),10)||0:0,I=Bun.spawn(["git","rev-list","--count","HEAD..@{u}"],{cwd:$,stdout:"pipe",stderr:"pipe"}),O=await new Response(I.stdout).text(),b=await I.exited===0?parseInt(O.trim(),10)||0:0;return{ahead:R,behind:b}}catch{return{ahead:0,behind:0}}}}var SO={"claude-opus-4-5-20251101":"Opus 4.5","claude-opus-4-5":"Opus 4.5","claude-sonnet-4-5-20250514":"Sonnet 4.5","claude-sonnet-4-5":"Sonnet 4.5","claude-sonnet-4-20250514":"Sonnet 4","claude-sonnet-4":"Sonnet 4","claude-sonnet-3-5-20241022":"Sonnet 3.5","claude-3-5-sonnet-20241022":"Sonnet 3.5","claude-3-5-sonnet":"Sonnet 3.5","claude-haiku-3-5-20241022":"Haiku 3.5","claude-3-5-haiku-20241022":"Haiku 3.5","claude-3-5-haiku":"Haiku 3.5"};class c${id="model";render($){let S=$.model.id,H=SO[S]||this.simplifyModelName($.model.display_name),E=f("model");return`${w.model.icon}${E}${L.reset} ${w.model.text}${H}${L.reset}`}simplifyModelName($){let S=$.replace(/^Claude\s+/i,"");return S=S.replace(/-\d{8}$/,""),S}}import{homedir as OO}from"os";import{join as y}from"path";var{Glob:HO}=globalThis.Bun;var s0=process.platform==="win32";class d${id="version";async render($){let S=await this.getClaudeCodeVersion();if(!S)return null;let H=f("version");return`${w.version.icon}${H}${L.reset} ${w.version.text}v${S}${L.reset}`}async getClaudeCodeVersion(){let $=OO(),S=[];if(s0)S.push(y($,"AppData","Roaming","npm","node_modules","@anthropic-ai","claude-code","package.json"),y($,"AppData","Local","npm-cache","_npx","**","node_modules","@anthropic-ai","claude-code","package.json"),y($,".bun","install","global","node_modules","@anthropic-ai","claude-code","package.json"));else S.push(y($,".bun","install","global","node_modules","@anthropic-ai","claude-code","package.json"),y($,".npm-global","lib","node_modules","@anthropic-ai","claude-code","package.json"),"/usr/local/lib/node_modules/@anthropic-ai/claude-code/package.json","/usr/lib/node_modules/@anthropic-ai/claude-code/package.json");for(let E of S){let R=await this.readVersionFromPackage(E);if(R)return R}let H=[];if(s0)H.push({base:y($,"AppData","Roaming","nvm"),pattern:"*/node_modules/@anthropic-ai/claude-code/package.json"},{base:y($,".volta","tools","image","packages","@anthropic-ai","claude-code"),pattern:"*/package.json"});else H.push({base:y($,".local","share","fnm","node-versions"),pattern:"*/installation/lib/node_modules/@anthropic-ai/claude-code/package.json"},{base:y($,".nvm","versions","node"),pattern:"*/lib/node_modules/@anthropic-ai/claude-code/package.json"},{base:y($,".volta","tools","image","packages","@anthropic-ai","claude-code"),pattern:"*/package.json"},{base:y($,".local","share","pnpm","global"),pattern:"*/node_modules/@anthropic-ai/claude-code/package.json"});for(let{base:E,pattern:R}of H)try{let I=new HO(R);for await(let O of I.scan({cwd:E,absolute:!0})){let Y=await this.readVersionFromPackage(O);if(Y)return Y}}catch{continue}return null}async readVersionFromPackage($){try{let S=Bun.file($);if(!await S.exists())return null;return(await S.json()).version||null}catch{return null}}}var EO={"claude-opus-4-5-20251101":200000,"claude-opus-4-5":200000,"claude-sonnet-4-5-20250514":200000,"claude-sonnet-4-5":200000,"claude-sonnet-4-20250514":200000,"claude-sonnet-4":200000,"claude-sonnet-3-5-20241022":200000,"claude-3-5-sonnet-20241022":200000,"claude-3-5-sonnet":200000,"claude-haiku-3-5-20241022":200000,"claude-3-5-haiku-20241022":200000,"claude-3-5-haiku":200000},RO=200000;class g{id="context";static cache=null;static CACHE_TTL=5000;async render($){let S=await this.getTokensWithCache($.transcript_path),H=this.getContextLimit($.model.id),R=Math.round((S??0)/H*100),I=Math.max(0,100-R),O=f("context"),Y=this.getRemainingColor(I),b=this.renderProgressBar(I);return`${w.context.icon}${O}${L.reset} ${Y}Context Remaining: ${I}%${L.reset} ${b}`}renderProgressBar($){let H=Math.round($/100*10),E=10-H,R="=".repeat(H),I="-".repeat(E),O=this.getRemainingColor($);return`${Z.brightBlack}[${L.reset}${O}${R}${L.reset}${Z.brightBlack}${I}]${L.reset}`}getRemainingColor($){if($<=20)return w.context.high;if($<=50)return w.context.medium;return w.context.low}async getTokensWithCache($){let S=Date.now();if(g.cache&&g.cache.path===$&&S-g.cache.timestamp<g.CACHE_TTL)return g.cache.tokens;let H=await this.parseTranscriptTokens($);return g.cache={path:$,tokens:H,timestamp:S},H}async parseTranscriptTokens($){try{let S=Bun.file($);if(!await S.exists())return null;let H=await S.text();if(!H.trim())return null;let E=H.split(`
|
|
312
|
+
`).filter((R)=>R.trim());for(let R=E.length-1;R>=0;R--)try{let I=JSON.parse(E[R]);if(I.type==="assistant"&&I.message?.usage){let O=I.message.usage;return(O.input_tokens||0)+(O.output_tokens||0)+(O.cache_creation_input_tokens||0)+(O.cache_read_input_tokens||0)}}catch{continue}return null}catch{return null}}getContextLimit($){return EO[$]||RO}}class o{id="today-usage";static cache=null;static CACHE_TTL=30000;async render($){if(o.cache&&Date.now()-o.cache.timestamp<o.CACHE_TTL)return o.cache.data;try{let S=await N$();if(!S.success||!S.data)return null;let H=S.data.todayCost,E=f("todayUsage"),R=`${w.todayUsage.icon}${E}${L.reset} ${w.todayUsage.text}Today: ${H}${L.reset}`;return o.cache={data:R,timestamp:Date.now()},R}catch{return null}}}class B1{separator=`${w.separator} \u2502 ${L.reset}`;render($){let S=["directory","git","model","version","today-usage"],H=["context"],E=this.renderLine($,S),R=this.renderLine($,H);return[E,R].filter((I)=>I.length>0).join(`
|
|
313
|
+
`)}renderLine($,S){let H=[];for(let E of S){let R=$.get(E);if(R)H.push(R)}return H.join(this.separator)}}import{join as t,dirname as IO}from"path";import{homedir as V1}from"os";import{mkdir as YO}from"fs/promises";var e0=t(V1(),".tako"),GO=t(e0,"cli"),bO=t(e0,"bin",process.platform==="win32"?"tako.cmd":"tako");function MO(){if(process.platform==="win32")return t(process.env.APPDATA||t(V1(),"AppData","Roaming"),"claude","settings.json");return t(V1(),".claude","settings.json")}var TO=process.platform==="win32",xO="0.1.48";function qO($,S){let H=$.split(".").map(Number),E=S.split(".").map(Number),R=Math.max(H.length,E.length);for(let I=0;I<R;I++){let O=H[I]||0,Y=E[I]||0;if(O!==Y)return O-Y}return 0}async function vO(){let $=t(GO,"node_modules","tako-cli","package.json");try{let S=Bun.file($);if(!await S.exists())return null;return(await S.json()).version||null}catch{return null}}async function NO(){let $=await vO();if(!$)return!1;return qO($,xO)>=0}function wO(){return bO}function LO($){if(TO)return $.replace(/\\/g,"/");return $}async function f1(){if(!await NO())return;let S=MO(),H={};try{let O=Bun.file(S);if(await O.exists())H=await O.json()}catch{}let R={type:"command",command:`"${LO(wO())}" statusline`,padding:0},I=typeof H.statusLine==="object"&&H.statusLine!==null?H.statusLine.command:null;if(typeof I==="string"&&I.includes("tako statusline"))return;H.statusLine=R,await YO(IO(S),{recursive:!0}),await Bun.write(S,JSON.stringify(H,null,2))}var QO=[new g$,new u$,new c$,new d$,new g,new o];async function zO($){let S=await Promise.all(QO.map(async(R)=>{try{let I=await R.render($);return{id:R.id,content:I}}catch{return{id:R.id,content:null}}})),H=new Map;for(let{id:R,content:I}of S)H.set(R,I);return new B1().render(H)}async function t0(){try{let $=await Bun.stdin.json(),S=await zO($);console.log(S)}catch($){process.exit(0)}}var K1="0.2.10";function ZO(){console.log(`
|
|
314
|
+
${M("cli.version",{version:K1})}
|
|
313
315
|
|
|
314
|
-
${
|
|
316
|
+
${M("cli.usage")}
|
|
315
317
|
|
|
316
|
-
${
|
|
317
|
-
${
|
|
318
|
-
${
|
|
318
|
+
${M("cli.options")}
|
|
319
|
+
${M("cli.optionVersion")}
|
|
320
|
+
${M("cli.optionHelp")}
|
|
319
321
|
|
|
320
|
-
${
|
|
321
|
-
${
|
|
322
|
-
${
|
|
322
|
+
${M("cli.shortcuts")}
|
|
323
|
+
${M("cli.shortcutClaude")}
|
|
324
|
+
${M("cli.shortcutCodex")}
|
|
323
325
|
|
|
324
|
-
${
|
|
325
|
-
${
|
|
326
|
-
${
|
|
327
|
-
${
|
|
328
|
-
`)}async function
|
|
326
|
+
${M("cli.examples")}
|
|
327
|
+
${M("cli.exampleInteractive")}
|
|
328
|
+
${M("cli.exampleClaude")}
|
|
329
|
+
${M("cli.exampleCodex")}
|
|
330
|
+
`)}async function WO(){let $=process.argv.slice(2);if($[0]==="statusline"){await t0();return}if($.includes("-v")||$.includes("--version")){console.log(`Tako CLI v${K1}`);return}if($.includes("-h")||$.includes("--help")){ZO();return}let S=K1==="dev";if(j$(),J("cli_started"),$.includes("--claude")){let H=D$("claude-code");if(!H)console.error(M("cli.clientNotFound",{client:"Claude Code"})),process.exit(1);if(!S)await k$();let E=await E$(H);if(!E.success)console.error(E.error),process.exit(1);return}if($.includes("--codex")){let H=D$("codex");if(!H)console.error(M("cli.clientNotFound",{client:"Codex"})),process.exit(1);if(!S)await k$();let E=await E$(H);if(!E.success)console.error(E.error),process.exit(1);return}if(!S)await k$();f1().catch(()=>{}),await n0()}process.on("beforeExit",async()=>{await q$()});process.on("SIGINT",async()=>{await q$(),process.exit(0)});process.on("SIGTERM",async()=>{await q$(),process.exit(0)});WO().catch(async($)=>{console.error(M("cli.cliError"),$),await q$(),process.exit(1)});
|