tako-cli 0.1.44 → 0.1.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +62 -62
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,47 +1,47 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var u5=Object.create;var{getPrototypeOf:r5,defineProperty:H1,getOwnPropertyNames:v2,getOwnPropertyDescriptor:s5}=Object,M2=Object.prototype.hasOwnProperty;var A=($,h,M)=>{M=$!=null?u5(r5($)):{};let G=h||!$||!$.__esModule?H1(M,"default",{value:$,enumerable:!0}):M;for(let b of v2($))if(!M2.call(G,b))H1(G,b,{get:()=>$[b],enumerable:!0});return G},h2=new WeakMap,d5=($)=>{var h=h2.get($),M;if(h)return h;if(h=H1({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function")v2($).map((G)=>!M2.call(h,G)&&H1(h,G,{get:()=>$[G],enumerable:!(M=s5($,G))||M.enumerable}));return h2.set($,h),h},K=($,h)=>()=>(h||$((h={exports:{}}).exports,h),h.exports);var h4=($,h)=>{for(var M in h)H1($,M,{get:h[M],enumerable:!0,configurable:!0,set:(G)=>h[M]=()=>G})};var m=($,h)=>()=>($&&(h=$($=0)),h);var y=import.meta.require;import{homedir as i5}from"os";import{join as g1}from"path";async function g2(){let $=await import("fs/promises");try{await $.mkdir(p,{recursive:!0}),await $.mkdir(v4,{recursive:!0})}catch{}}async function R(){await g2();try{let $=Bun.file(b2);if(await $.exists()){let h=await $.json();return{...G2,...h}}}catch{}return{...G2}}async function M4($){await g2(),await Bun.write(b2,JSON.stringify($,null,2))}async function k1($){let M={...await R(),...$};return await M4(M),M}async function Z2(){return!!(await R()).apiKey}async function P(){return(await R()).apiKey}async function J2(){return(await R()).apiId}var p,b2,v4,u,_,w,B1,c,S1,G2;var U=m(()=>{p=g1(i5(),".tako"),b2=g1(p,"config.json"),v4=g1(p,"tools"),u=g1(p,"cli"),_=g1(p,"bun"),w=g1(_,"bin",process.platform==="win32"?"bun.exe":"bun"),B1=process.env.TAKO_SERVER||"https://claude-proxy.shiroha.tech",c=process.env.PROXY_BASE_URL||"https://claude-proxy.shiroha.tech",S1=process.env.TAKO_DEV==="true"||B1.includes("localhost"),G2={apiKey:"",apiId:"",installedClients:{}}});import{join as y1}from"path";function G4($,h){if(!$.startsWith(p))throw Error(`\u5B89\u5168\u68C0\u67E5\u5931\u8D25: ${h} \u8DEF\u5F84 "${$}" \u4E0D\u5728 Tako \u76EE\u5F55\u4E0B`)}function $1($){let h=y1(v4,$);return G4(h,"\u5BA2\u6237\u7AEF\u5B89\u88C5\u76EE\u5F55"),h}async function Z1($){let h=$1($.id),M=y1(h,"node_modules",$.package,"package.json");try{let G=Bun.file(M);if(!await G.exists())return null;let g=(await G.json()).bin;if(!g)return null;let v=null;if(typeof g==="string")v=g;else if(typeof g==="object"&&g[$.command])v=g[$.command];if(!v)return null;let Z=y1(h,"node_modules",$.package,v);return G4(Z,"\u5BA2\u6237\u7AEF\u5165\u53E3\u6587\u4EF6"),Z}catch{return null}}function _1($){let h=$1($.id),M=y1(h,"node_modules",".bin",$.command);return G4(M,"\u5BA2\u6237\u7AEF\u53EF\u6267\u884C\u6587\u4EF6"),M}function R1($){b4.set($.id,$)}function X2(){return Array.from(b4.values())}function g4($){return b4.get($)}var b4;var l=m(()=>{U();b4=new Map});var z4=K((M6,z2)=>{var X4={to($,h){if(!h)return`\x1B[${$+1}G`;return`\x1B[${h+1};${$+1}H`},move($,h){let M="";if($<0)M+=`\x1B[${-$}D`;else if($>0)M+=`\x1B[${$}C`;if(h<0)M+=`\x1B[${-h}A`;else if(h>0)M+=`\x1B[${h}B`;return M},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"},$0={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},h0={screen:"\x1B[2J",up:($=1)=>"\x1B[1J".repeat($),down:($=1)=>"\x1B[J".repeat($),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines($){let h="";for(let M=0;M<$;M++)h+=this.line+(M<$-1?X4.up():"");if($)h+=X4.left;return h}};z2.exports={cursor:X4,scroll:$0,erase:h0,beep:"\x07"}});var x4=K((G6,Y4)=>{var I1=process||{},Y2=I1.argv||[],P1=I1.env||{},v0=!(!!P1.NO_COLOR||Y2.includes("--no-color"))&&(!!P1.FORCE_COLOR||Y2.includes("--color")||I1.platform==="win32"||(I1.stdout||{}).isTTY&&P1.TERM!=="dumb"||!!P1.CI),M0=($,h,M=$)=>(G)=>{let b=""+G,g=b.indexOf(h,$.length);return~g?$+G0(b,h,M,g)+h:$+b+h},G0=($,h,M,G)=>{let b="",g=0;do b+=$.substring(g,G)+M,g=G+h.length,G=$.indexOf(h,g);while(~G);return b+$.substring(g)},x2=($=v0)=>{let h=$?M0:()=>String;return{isColorSupported:$,reset:h("\x1B[0m","\x1B[0m"),bold:h("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:h("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:h("\x1B[3m","\x1B[23m"),underline:h("\x1B[4m","\x1B[24m"),inverse:h("\x1B[7m","\x1B[27m"),hidden:h("\x1B[8m","\x1B[28m"),strikethrough:h("\x1B[9m","\x1B[29m"),black:h("\x1B[30m","\x1B[39m"),red:h("\x1B[31m","\x1B[39m"),green:h("\x1B[32m","\x1B[39m"),yellow:h("\x1B[33m","\x1B[39m"),blue:h("\x1B[34m","\x1B[39m"),magenta:h("\x1B[35m","\x1B[39m"),cyan:h("\x1B[36m","\x1B[39m"),white:h("\x1B[37m","\x1B[39m"),gray:h("\x1B[90m","\x1B[39m"),bgBlack:h("\x1B[40m","\x1B[49m"),bgRed:h("\x1B[41m","\x1B[49m"),bgGreen:h("\x1B[42m","\x1B[49m"),bgYellow:h("\x1B[43m","\x1B[49m"),bgBlue:h("\x1B[44m","\x1B[49m"),bgMagenta:h("\x1B[45m","\x1B[49m"),bgCyan:h("\x1B[46m","\x1B[49m"),bgWhite:h("\x1B[47m","\x1B[49m"),blackBright:h("\x1B[90m","\x1B[39m"),redBright:h("\x1B[91m","\x1B[39m"),greenBright:h("\x1B[92m","\x1B[39m"),yellowBright:h("\x1B[93m","\x1B[39m"),blueBright:h("\x1B[94m","\x1B[39m"),magentaBright:h("\x1B[95m","\x1B[39m"),cyanBright:h("\x1B[96m","\x1B[39m"),whiteBright:h("\x1B[97m","\x1B[39m"),bgBlackBright:h("\x1B[100m","\x1B[49m"),bgRedBright:h("\x1B[101m","\x1B[49m"),bgGreenBright:h("\x1B[102m","\x1B[49m"),bgYellowBright:h("\x1B[103m","\x1B[49m"),bgBlueBright:h("\x1B[104m","\x1B[49m"),bgMagentaBright:h("\x1B[105m","\x1B[49m"),bgCyanBright:h("\x1B[106m","\x1B[49m"),bgWhiteBright:h("\x1B[107m","\x1B[49m")}};Y4.exports=x2();Y4.exports.createColors=x2});import{stdin as V2,stdout as f2}from"process";import*as D from"readline";import W2 from"readline";import{WriteStream as b0}from"tty";function g0({onlyFirst:$=!1}={}){let h=["[\\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(h,$?void 0:"g")}function A2($){if(typeof $!="string")throw TypeError(`Expected a \`string\`, got \`${typeof $}\``);return $.replace(Z0,"")}function U2($){return $&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")?$.default:$}function L1($,h={}){if(typeof $!="string"||$.length===0||(h={ambiguousIsNarrow:!0,...h},$=A2($),$.length===0))return 0;$=$.replace(Y0()," ");let M=h.ambiguousIsNarrow?1:2,G=0;for(let b of $){let g=b.codePointAt(0);if(g<=31||g>=127&&g<=159||g>=768&&g<=879)continue;switch(X0.eastAsianWidth(b)){case"F":case"W":G+=2;break;case"A":G+=M;break;default:G+=1}}return G}function Q0(){let $=new Map;for(let[h,M]of Object.entries(H)){for(let[G,b]of Object.entries(M))H[G]={open:`\x1B[${b[0]}m`,close:`\x1B[${b[1]}m`},M[G]=H[G],$.set(b[0],b[1]);Object.defineProperty(H,h,{value:M,enumerable:!1})}return Object.defineProperty(H,"codes",{value:$,enumerable:!1}),H.color.close="\x1B[39m",H.bgColor.close="\x1B[49m",H.color.ansi=Q2(),H.color.ansi256=E2(),H.color.ansi16m=q2(),H.bgColor.ansi=Q2(W4),H.bgColor.ansi256=E2(W4),H.bgColor.ansi16m=q2(W4),Object.defineProperties(H,{rgbToAnsi256:{value:(h,M,G)=>h===M&&M===G?h<8?16:h>248?231:Math.round((h-8)/247*24)+232:16+36*Math.round(h/255*5)+6*Math.round(M/255*5)+Math.round(G/255*5),enumerable:!1},hexToRgb:{value:(h)=>{let M=/[a-f\d]{6}|[a-f\d]{3}/i.exec(h.toString(16));if(!M)return[0,0,0];let[G]=M;G.length===3&&(G=[...G].map((g)=>g+g).join(""));let b=Number.parseInt(G,16);return[b>>16&255,b>>8&255,b&255]},enumerable:!1},hexToAnsi256:{value:(h)=>H.rgbToAnsi256(...H.hexToRgb(h)),enumerable:!1},ansi256ToAnsi:{value:(h)=>{if(h<8)return 30+h;if(h<16)return 90+(h-8);let M,G,b;if(h>=232)M=((h-232)*10+8)/255,G=M,b=M;else{h-=16;let Z=h%36;M=Math.floor(h/36)/5,G=Math.floor(Z/6)/5,b=Z%6/5}let g=Math.max(M,G,b)*2;if(g===0)return 30;let v=30+(Math.round(b)<<2|Math.round(G)<<1|Math.round(M));return g===2&&(v+=60),v},enumerable:!1},rgbToAnsi:{value:(h,M,G)=>H.ansi256ToAnsi(H.rgbToAnsi256(h,M,G)),enumerable:!1},hexToAnsi:{value:(h)=>H.ansi256ToAnsi(H.hexToAnsi256(h)),enumerable:!1}}),H}function S2($,h,M){return String($).normalize().replace(/\r\n/g,`
3
+ var i5=Object.create;var{getPrototypeOf:o5,defineProperty:S1,getOwnPropertyNames:Y2,getOwnPropertyDescriptor:e5}=Object,x2=Object.prototype.hasOwnProperty;var O=($,v,G)=>{G=$!=null?i5(o5($)):{};let b=v||!$||!$.__esModule?S1(G,"default",{value:$,enumerable:!0}):G;for(let Z of Y2($))if(!x2.call(b,Z))S1(b,Z,{get:()=>$[Z],enumerable:!0});return b},z2=new WeakMap,t5=($)=>{var v=z2.get($),G;if(v)return v;if(v=S1({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function")Y2($).map((b)=>!x2.call(v,b)&&S1(v,b,{get:()=>$[b],enumerable:!(G=e5($,b))||G.enumerable}));return z2.set($,v),v},j=($,v)=>()=>(v||$((v={exports:{}}).exports,v),v.exports);var G4=($,v)=>{for(var G in v)S1($,G,{get:v[G],enumerable:!0,configurable:!0,set:(b)=>v[G]=()=>b})};var W=($,v)=>()=>($&&(v=$($=0)),v);var y=import.meta.require;import{homedir as $0}from"os";import{join as Y1}from"path";async function E2(){let $=await import("fs/promises");try{await $.mkdir(p,{recursive:!0}),await $.mkdir(b4,{recursive:!0})}catch{}}async function P(){await E2();try{let $=Bun.file(g2);if(await $.exists()){let v=await $.json();return{...Q2,...v}}}catch{}return{...Q2}}async function Z4($){await E2(),await Bun.write(g2,JSON.stringify($,null,2))}async function y1($){let G={...await P(),...$};return await Z4(G),G}async function L2(){return!!(await P()).apiKey}async function I(){return(await P()).apiKey}async function h2(){return(await P()).apiId}var p,g2,b4,r,R,m,T1,c,V1,Q2;var w=W(()=>{p=Y1($0(),".tako"),g2=Y1(p,"config.json"),b4=Y1(p,"tools"),r=Y1(p,"cli"),R=Y1(p,"bun"),m=Y1(R,"bin",process.platform==="win32"?"bun.exe":"bun"),T1=process.env.TAKO_SERVER||"https://claude-proxy.shiroha.tech",c=process.env.PROXY_BASE_URL||"https://claude-proxy.shiroha.tech",V1=process.env.TAKO_DEV==="true"||T1.includes("localhost"),Q2={apiKey:"",apiId:"",installedClients:{}}});import{join as R1}from"path";function J4($,v){if(!$.startsWith(p))throw Error(`\u5B89\u5168\u68C0\u67E5\u5931\u8D25: ${v} \u8DEF\u5F84 "${$}" \u4E0D\u5728 Tako \u76EE\u5F55\u4E0B`)}function v1($){let v=R1(b4,$);return J4(v,"\u5BA2\u6237\u7AEF\u5B89\u88C5\u76EE\u5F55"),v}async function x1($){let v=v1($.id),G=R1(v,"node_modules",$.package,"package.json");try{let b=Bun.file(G);if(!await b.exists())return null;let J=(await b.json()).bin;if(!J)return null;let M=null;if(typeof J==="string")M=J;else if(typeof J==="object"&&J[$.command])M=J[$.command];if(!M)return null;let X=R1(v,"node_modules",$.package,M);return J4(X,"\u5BA2\u6237\u7AEF\u5165\u53E3\u6587\u4EF6"),X}catch{return null}}function P1($){let v=v1($.id),G=R1(v,"node_modules",".bin",$.command);return J4(G,"\u5BA2\u6237\u7AEF\u53EF\u6267\u884C\u6587\u4EF6"),G}function I1($){X4.set($.id,$)}function q2(){return Array.from(X4.values())}function z4($){return X4.get($)}var X4;var d=W(()=>{w();X4=new Map});var g4=j((E6,H2)=>{var Q4={to($,v){if(!v)return`\x1B[${$+1}G`;return`\x1B[${v+1};${$+1}H`},move($,v){let G="";if($<0)G+=`\x1B[${-$}D`;else if($>0)G+=`\x1B[${$}C`;if(v<0)G+=`\x1B[${-v}A`;else if(v>0)G+=`\x1B[${v}B`;return G},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"},Y0={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},x0={screen:"\x1B[2J",up:($=1)=>"\x1B[1J".repeat($),down:($=1)=>"\x1B[J".repeat($),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines($){let v="";for(let G=0;G<$;G++)v+=this.line+(G<$-1?Q4.up():"");if($)v+=Q4.left;return v}};H2.exports={cursor:Q4,scroll:Y0,erase:x0,beep:"\x07"}});var L4=j((L6,E4)=>{var C1=process||{},B2=C1.argv||[],F1=C1.env||{},Q0=!(!!F1.NO_COLOR||B2.includes("--no-color"))&&(!!F1.FORCE_COLOR||B2.includes("--color")||C1.platform==="win32"||(C1.stdout||{}).isTTY&&F1.TERM!=="dumb"||!!F1.CI),g0=($,v,G=$)=>(b)=>{let Z=""+b,J=Z.indexOf(v,$.length);return~J?$+E0(Z,v,G,J)+v:$+Z+v},E0=($,v,G,b)=>{let Z="",J=0;do Z+=$.substring(J,b)+G,J=b+v.length,b=$.indexOf(v,J);while(~b);return Z+$.substring(J)},S2=($=Q0)=>{let v=$?g0:()=>String;return{isColorSupported:$,reset:v("\x1B[0m","\x1B[0m"),bold:v("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:v("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:v("\x1B[3m","\x1B[23m"),underline:v("\x1B[4m","\x1B[24m"),inverse:v("\x1B[7m","\x1B[27m"),hidden:v("\x1B[8m","\x1B[28m"),strikethrough:v("\x1B[9m","\x1B[29m"),black:v("\x1B[30m","\x1B[39m"),red:v("\x1B[31m","\x1B[39m"),green:v("\x1B[32m","\x1B[39m"),yellow:v("\x1B[33m","\x1B[39m"),blue:v("\x1B[34m","\x1B[39m"),magenta:v("\x1B[35m","\x1B[39m"),cyan:v("\x1B[36m","\x1B[39m"),white:v("\x1B[37m","\x1B[39m"),gray:v("\x1B[90m","\x1B[39m"),bgBlack:v("\x1B[40m","\x1B[49m"),bgRed:v("\x1B[41m","\x1B[49m"),bgGreen:v("\x1B[42m","\x1B[49m"),bgYellow:v("\x1B[43m","\x1B[49m"),bgBlue:v("\x1B[44m","\x1B[49m"),bgMagenta:v("\x1B[45m","\x1B[49m"),bgCyan:v("\x1B[46m","\x1B[49m"),bgWhite:v("\x1B[47m","\x1B[49m"),blackBright:v("\x1B[90m","\x1B[39m"),redBright:v("\x1B[91m","\x1B[39m"),greenBright:v("\x1B[92m","\x1B[39m"),yellowBright:v("\x1B[93m","\x1B[39m"),blueBright:v("\x1B[94m","\x1B[39m"),magentaBright:v("\x1B[95m","\x1B[39m"),cyanBright:v("\x1B[96m","\x1B[39m"),whiteBright:v("\x1B[97m","\x1B[39m"),bgBlackBright:v("\x1B[100m","\x1B[49m"),bgRedBright:v("\x1B[101m","\x1B[49m"),bgGreenBright:v("\x1B[102m","\x1B[49m"),bgYellowBright:v("\x1B[103m","\x1B[49m"),bgBlueBright:v("\x1B[104m","\x1B[49m"),bgMagentaBright:v("\x1B[105m","\x1B[49m"),bgCyanBright:v("\x1B[106m","\x1B[49m"),bgWhiteBright:v("\x1B[107m","\x1B[49m")}};E4.exports=S2();E4.exports.createColors=S2});import{stdin as W2,stdout as j2}from"process";import*as o from"readline";import T2 from"readline";import{WriteStream as L0}from"tty";function h0({onlyFirst:$=!1}={}){let v=["[\\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(v,$?void 0:"g")}function k2($){if(typeof $!="string")throw TypeError(`Expected a \`string\`, got \`${typeof $}\``);return $.replace(q0,"")}function N2($){return $&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")?$.default:$}function A1($,v={}){if(typeof $!="string"||$.length===0||(v={ambiguousIsNarrow:!0,...v},$=k2($),$.length===0))return 0;$=$.replace(T0()," ");let G=v.ambiguousIsNarrow?1:2,b=0;for(let Z of $){let J=Z.codePointAt(0);if(J<=31||J>=127&&J<=159||J>=768&&J<=879)continue;switch(B0.eastAsianWidth(Z)){case"F":case"W":b+=2;break;case"A":b+=G;break;default:b+=1}}return b}function f0(){let $=new Map;for(let[v,G]of Object.entries(B)){for(let[b,Z]of Object.entries(G))B[b]={open:`\x1B[${Z[0]}m`,close:`\x1B[${Z[1]}m`},G[b]=B[b],$.set(Z[0],Z[1]);Object.defineProperty(B,v,{value:G,enumerable:!1})}return Object.defineProperty(B,"codes",{value:$,enumerable:!1}),B.color.close="\x1B[39m",B.bgColor.close="\x1B[49m",B.color.ansi=V2(),B.color.ansi256=A2(),B.color.ansi16m=f2(),B.bgColor.ansi=V2(h4),B.bgColor.ansi256=A2(h4),B.bgColor.ansi16m=f2(h4),Object.defineProperties(B,{rgbToAnsi256:{value:(v,G,b)=>v===G&&G===b?v<8?16:v>248?231:Math.round((v-8)/247*24)+232:16+36*Math.round(v/255*5)+6*Math.round(G/255*5)+Math.round(b/255*5),enumerable:!1},hexToRgb:{value:(v)=>{let G=/[a-f\d]{6}|[a-f\d]{3}/i.exec(v.toString(16));if(!G)return[0,0,0];let[b]=G;b.length===3&&(b=[...b].map((J)=>J+J).join(""));let Z=Number.parseInt(b,16);return[Z>>16&255,Z>>8&255,Z&255]},enumerable:!1},hexToAnsi256:{value:(v)=>B.rgbToAnsi256(...B.hexToRgb(v)),enumerable:!1},ansi256ToAnsi:{value:(v)=>{if(v<8)return 30+v;if(v<16)return 90+(v-8);let G,b,Z;if(v>=232)G=((v-232)*10+8)/255,b=G,Z=G;else{v-=16;let X=v%36;G=Math.floor(v/36)/5,b=Math.floor(X/6)/5,Z=X%6/5}let J=Math.max(G,b,Z)*2;if(J===0)return 30;let M=30+(Math.round(Z)<<2|Math.round(b)<<1|Math.round(G));return J===2&&(M+=60),M},enumerable:!1},rgbToAnsi:{value:(v,G,b)=>B.ansi256ToAnsi(B.rgbToAnsi256(v,G,b)),enumerable:!1},hexToAnsi:{value:(v)=>B.ansi256ToAnsi(B.hexToAnsi256(v)),enumerable:!1}}),B}function w2($,v,G){return String($).normalize().replace(/\r\n/g,`
4
4
  `).split(`
5
- `).map((G)=>L0(G,h,M)).join(`
6
- `)}function f0($,h){if($===h)return;let M=$.split(`
7
- `),G=h.split(`
8
- `),b=[];for(let g=0;g<Math.max(M.length,G.length);g++)M[g]!==G[g]&&b.push(g);return b}function a($){return $===K2}function F1($,h){$.isTTY&&$.setRawMode(h)}class H4{constructor({render:$,input:h=V2,output:M=f2,...G},b=!0){j(this,"input"),j(this,"output"),j(this,"rl"),j(this,"opts"),j(this,"_track",!1),j(this,"_render"),j(this,"_cursor",0),j(this,"state","initial"),j(this,"value"),j(this,"error",""),j(this,"subscribers",new Map),j(this,"_prevFrame",""),this.opts=G,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=$.bind(this),this._track=b,this.input=h,this.output=M}prompt(){let $=new b0(0);return $._write=(h,M,G)=>{this._track&&(this.value=this.rl.line.replace(/\t/g,""),this._cursor=this.rl.cursor,this.emit("value",this.value)),G()},this.input.pipe($),this.rl=W2.createInterface({input:this.input,output:$,tabSize:2,prompt:"",escapeCodeTimeout:50}),W2.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),F1(this.input,!0),this.output.on("resize",this.render),this.render(),new Promise((h,M)=>{this.once("submit",()=>{this.output.write(O.cursor.show),this.output.off("resize",this.render),F1(this.input,!1),h(this.value)}),this.once("cancel",()=>{this.output.write(O.cursor.show),this.output.off("resize",this.render),F1(this.input,!1),h(K2)})})}on($,h){let M=this.subscribers.get($)??[];M.push({cb:h}),this.subscribers.set($,M)}once($,h){let M=this.subscribers.get($)??[];M.push({cb:h,once:!0}),this.subscribers.set($,M)}emit($,...h){let M=this.subscribers.get($)??[],G=[];for(let b of M)b.cb(...h),b.once&&G.push(()=>M.splice(M.indexOf(b),1));for(let b of G)b()}unsubscribe(){this.subscribers.clear()}onKeypress($,h){if(this.state==="error"&&(this.state="active"),h?.name&&!this._track&&L2.has(h.name)&&this.emit("cursor",L2.get(h.name)),h?.name&&A0.has(h.name)&&this.emit("cursor",h.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()),h?.name==="return"){if(this.opts.validate){let M=this.opts.validate(this.value);M&&(this.error=M,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(`
9
- `),F1(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let $=S2(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
10
- `).length-1;this.output.write(O.cursor.move(-999,$*-1))}render(){let $=S2(this._render(this)??"",process.stdout.columns,{hard:!0});if($!==this._prevFrame){if(this.state==="initial")this.output.write(O.cursor.hide);else{let h=f0(this._prevFrame,$);if(this.restoreCursor(),h&&h?.length===1){let M=h[0];this.output.write(O.cursor.move(0,M)),this.output.write(O.erase.lines(1));let G=$.split(`
11
- `);this.output.write(G[M]),this._prevFrame=$,this.output.write(O.cursor.move(0,G.length-M-1));return}else if(h&&h?.length>1){let M=h[0];this.output.write(O.cursor.move(0,M)),this.output.write(O.erase.down());let G=$.split(`
12
- `).slice(M);this.output.write(G.join(`
13
- `)),this._prevFrame=$;return}this.output.write(O.erase.down())}this.output.write($),this.state==="initial"&&(this.state="active"),this._prevFrame=$}}}function j2({input:$=V2,output:h=f2,overwrite:M=!0,hideCursor:G=!0}={}){let b=D.createInterface({input:$,output:h,prompt:"",tabSize:1});D.emitKeypressEvents($,b),$.isTTY&&$.setRawMode(!0);let g=(v,{name:Z})=>{if(String(v)==="\x03"){G&&h.write(O.cursor.show),process.exit(0);return}if(!M)return;D.moveCursor(h,Z==="return"?0:-1,Z==="return"?-1:0,()=>{D.clearLine(h,1,()=>{$.once("keypress",g)})})};return G&&h.write(O.cursor.hide),$.once("keypress",g),()=>{$.off("keypress",g),G&&h.write(O.cursor.show),$.isTTY&&!N0&&$.setRawMode(!1),b.terminal=!1,b.close()}}var O,C1,Z0,w2,J0,X0,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},Y0,W4=10,Q2=($=0)=>(h)=>`\x1B[${h+$}m`,E2=($=0)=>(h)=>`\x1B[${38+$};5;${h}m`,q2=($=0)=>(h,M,G)=>`\x1B[${38+$};2;${h};${M};${G}m`,H,x0,W0,E0,p1,q0=39,E4="\x07",O2="[",H0="]",m2="m",q4,H2=($)=>`${p1.values().next().value}${O2}${$}${m2}`,B2=($)=>`${p1.values().next().value}${q4}${$}${E4}`,B0=($)=>$.split(" ").map((h)=>L1(h)),Q4=($,h,M)=>{let G=[...h],b=!1,g=!1,v=L1(A2($[$.length-1]));for(let[Z,J]of G.entries()){let z=L1(J);if(v+z<=M?$[$.length-1]+=J:($.push(J),v=0),p1.has(J)&&(b=!0,g=G.slice(Z+1).join("").startsWith(q4)),b){g?J===E4&&(b=!1,g=!1):J===m2&&(b=!1);continue}v+=z,v===M&&Z<G.length-1&&($.push(""),v=0)}!v&&$[$.length-1].length>0&&$.length>1&&($[$.length-2]+=$.pop())},S0=($)=>{let h=$.split(" "),M=h.length;for(;M>0&&!(L1(h[M-1])>0);)M--;return M===h.length?$:h.slice(0,M).join(" ")+h.slice(M).join("")},L0=($,h,M={})=>{if(M.trim!==!1&&$.trim()==="")return"";let G="",b,g,v=B0($),Z=[""];for(let[z,Y]of $.split(" ").entries()){M.trim!==!1&&(Z[Z.length-1]=Z[Z.length-1].trimStart());let x=L1(Z[Z.length-1]);if(z!==0&&(x>=h&&(M.wordWrap===!1||M.trim===!1)&&(Z.push(""),x=0),(x>0||M.trim===!1)&&(Z[Z.length-1]+=" ",x++)),M.hard&&v[z]>h){let q=h-x,S=1+Math.floor((v[z]-q-1)/h);Math.floor((v[z]-1)/h)<S&&Z.push(""),Q4(Z,Y,h);continue}if(x+v[z]>h&&x>0&&v[z]>0){if(M.wordWrap===!1&&x<h){Q4(Z,Y,h);continue}Z.push("")}if(x+v[z]>h&&M.wordWrap===!1){Q4(Z,Y,h);continue}Z[Z.length-1]+=Y}M.trim!==!1&&(Z=Z.map((z)=>S0(z)));let J=[...Z.join(`
14
- `)];for(let[z,Y]of J.entries()){if(G+=Y,p1.has(Y)){let{groups:q}=new RegExp(`(?:\\${O2}(?<code>\\d+)m|\\${q4}(?<uri>.*)${E4})`).exec(J.slice(z).join(""))||{groups:{}};if(q.code!==void 0){let S=Number.parseFloat(q.code);b=S===q0?void 0:S}else q.uri!==void 0&&(g=q.uri.length===0?void 0:q.uri)}let x=E0.codes.get(Number(b));J[z+1]===`
15
- `?(g&&(G+=B2("")),b&&x&&(G+=H2(x))):Y===`
16
- `&&(b&&x&&(G+=H2(b)),g&&(G+=B2(g)))}return G},T0,V0=($,h,M)=>(h in $)?T0($,h,{enumerable:!0,configurable:!0,writable:!0,value:M}):$[h]=M,j=($,h,M)=>(V0($,typeof h!="symbol"?h+"":h,M),M),K2,L2,A0,U0,w0=($,h,M)=>(h in $)?U0($,h,{enumerable:!0,configurable:!0,writable:!0,value:M}):$[h]=M,T2=($,h,M)=>(w0($,typeof h!="symbol"?h+"":h,M),M),N2,O0,m0=($,h,M)=>(h in $)?O0($,h,{enumerable:!0,configurable:!0,writable:!0,value:M}):$[h]=M,K0=($,h,M)=>(m0($,typeof h!="symbol"?h+"":h,M),M),B4,N0;var S4=m(()=>{O=A(z4(),1),C1=A(x4(),1);Z0=g0();w2={exports:{}};(function($){var h={};$.exports=h,h.eastAsianWidth=function(G){var b=G.charCodeAt(0),g=G.length==2?G.charCodeAt(1):0,v=b;return 55296<=b&&b<=56319&&56320<=g&&g<=57343&&(b&=1023,g&=1023,v=b<<10|g,v+=65536),v==12288||65281<=v&&v<=65376||65504<=v&&v<=65510?"F":v==8361||65377<=v&&v<=65470||65474<=v&&v<=65479||65482<=v&&v<=65487||65490<=v&&v<=65495||65498<=v&&v<=65500||65512<=v&&v<=65518?"H":4352<=v&&v<=4447||4515<=v&&v<=4519||4602<=v&&v<=4607||9001<=v&&v<=9002||11904<=v&&v<=11929||11931<=v&&v<=12019||12032<=v&&v<=12245||12272<=v&&v<=12283||12289<=v&&v<=12350||12353<=v&&v<=12438||12441<=v&&v<=12543||12549<=v&&v<=12589||12593<=v&&v<=12686||12688<=v&&v<=12730||12736<=v&&v<=12771||12784<=v&&v<=12830||12832<=v&&v<=12871||12880<=v&&v<=13054||13056<=v&&v<=19903||19968<=v&&v<=42124||42128<=v&&v<=42182||43360<=v&&v<=43388||44032<=v&&v<=55203||55216<=v&&v<=55238||55243<=v&&v<=55291||63744<=v&&v<=64255||65040<=v&&v<=65049||65072<=v&&v<=65106||65108<=v&&v<=65126||65128<=v&&v<=65131||110592<=v&&v<=110593||127488<=v&&v<=127490||127504<=v&&v<=127546||127552<=v&&v<=127560||127568<=v&&v<=127569||131072<=v&&v<=194367||177984<=v&&v<=196605||196608<=v&&v<=262141?"W":32<=v&&v<=126||162<=v&&v<=163||165<=v&&v<=166||v==172||v==175||10214<=v&&v<=10221||10629<=v&&v<=10630?"Na":v==161||v==164||167<=v&&v<=168||v==170||173<=v&&v<=174||176<=v&&v<=180||182<=v&&v<=186||188<=v&&v<=191||v==198||v==208||215<=v&&v<=216||222<=v&&v<=225||v==230||232<=v&&v<=234||236<=v&&v<=237||v==240||242<=v&&v<=243||247<=v&&v<=250||v==252||v==254||v==257||v==273||v==275||v==283||294<=v&&v<=295||v==299||305<=v&&v<=307||v==312||319<=v&&v<=322||v==324||328<=v&&v<=331||v==333||338<=v&&v<=339||358<=v&&v<=359||v==363||v==462||v==464||v==466||v==468||v==470||v==472||v==474||v==476||v==593||v==609||v==708||v==711||713<=v&&v<=715||v==717||v==720||728<=v&&v<=731||v==733||v==735||768<=v&&v<=879||913<=v&&v<=929||931<=v&&v<=937||945<=v&&v<=961||963<=v&&v<=969||v==1025||1040<=v&&v<=1103||v==1105||v==8208||8211<=v&&v<=8214||8216<=v&&v<=8217||8220<=v&&v<=8221||8224<=v&&v<=8226||8228<=v&&v<=8231||v==8240||8242<=v&&v<=8243||v==8245||v==8251||v==8254||v==8308||v==8319||8321<=v&&v<=8324||v==8364||v==8451||v==8453||v==8457||v==8467||v==8470||8481<=v&&v<=8482||v==8486||v==8491||8531<=v&&v<=8532||8539<=v&&v<=8542||8544<=v&&v<=8555||8560<=v&&v<=8569||v==8585||8592<=v&&v<=8601||8632<=v&&v<=8633||v==8658||v==8660||v==8679||v==8704||8706<=v&&v<=8707||8711<=v&&v<=8712||v==8715||v==8719||v==8721||v==8725||v==8730||8733<=v&&v<=8736||v==8739||v==8741||8743<=v&&v<=8748||v==8750||8756<=v&&v<=8759||8764<=v&&v<=8765||v==8776||v==8780||v==8786||8800<=v&&v<=8801||8804<=v&&v<=8807||8810<=v&&v<=8811||8814<=v&&v<=8815||8834<=v&&v<=8835||8838<=v&&v<=8839||v==8853||v==8857||v==8869||v==8895||v==8978||9312<=v&&v<=9449||9451<=v&&v<=9547||9552<=v&&v<=9587||9600<=v&&v<=9615||9618<=v&&v<=9621||9632<=v&&v<=9633||9635<=v&&v<=9641||9650<=v&&v<=9651||9654<=v&&v<=9655||9660<=v&&v<=9661||9664<=v&&v<=9665||9670<=v&&v<=9672||v==9675||9678<=v&&v<=9681||9698<=v&&v<=9701||v==9711||9733<=v&&v<=9734||v==9737||9742<=v&&v<=9743||9748<=v&&v<=9749||v==9756||v==9758||v==9792||v==9794||9824<=v&&v<=9825||9827<=v&&v<=9829||9831<=v&&v<=9834||9836<=v&&v<=9837||v==9839||9886<=v&&v<=9887||9918<=v&&v<=9919||9924<=v&&v<=9933||9935<=v&&v<=9953||v==9955||9960<=v&&v<=9983||v==10045||v==10071||10102<=v&&v<=10111||11093<=v&&v<=11097||12872<=v&&v<=12879||57344<=v&&v<=63743||65024<=v&&v<=65039||v==65533||127232<=v&&v<=127242||127248<=v&&v<=127277||127280<=v&&v<=127337||127344<=v&&v<=127386||917760<=v&&v<=917999||983040<=v&&v<=1048573||1048576<=v&&v<=1114109?"A":"N"},h.characterLength=function(G){var b=this.eastAsianWidth(G);return b=="F"||b=="W"||b=="A"?2:1};function M(G){return G.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}h.length=function(G){for(var b=M(G),g=0,v=0;v<b.length;v++)g=g+this.characterLength(b[v]);return g},h.slice=function(G,b,g){textLen=h.length(G),b=b||0,g=g||1,b<0&&(b=textLen+b),g<0&&(g=textLen+g);for(var v="",Z=0,J=M(G),z=0;z<J.length;z++){var Y=J[z],x=h.length(Y);if(Z>=b-(x==2?1:0))if(Z+x<=g)v+=Y;else break;Z+=x}return v}})(w2);J0=w2.exports,X0=U2(J0),Y0=U2(z0);H={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(H.modifier);x0=Object.keys(H.color),W0=Object.keys(H.bgColor);[...x0,...W0];E0=Q0(),p1=new Set(["\x1B","\x9B"]),q4=`${H0}8;;`;T0=Object.defineProperty;K2=Symbol("clack:cancel");L2=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),A0=new Set(["up","down","left","right","space","enter"]);U0=Object.defineProperty,N2=class extends H4{constructor($){super($,!1),T2(this,"options"),T2(this,"cursor",0),this.options=$.options,this.cursor=this.options.findIndex(({value:h})=>h===$.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(h)=>{switch(h){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}},O0=Object.defineProperty;B4=class B4 extends H4{constructor($){super($),K0(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}${C1.default.inverse(C1.default.hidden("_"))}`;else{let h=this.value.slice(0,this.cursor),M=this.value.slice(this.cursor);this.valueWithCursor=`${h}${C1.default.inverse(M[0])}${M.slice(1)}`}})}get cursor(){return this._cursor}};N0=globalThis.process.platform.startsWith("win")});import I from"process";function j0(){return I.platform!=="win32"?I.env.TERM!=="linux":Boolean(I.env.CI)||Boolean(I.env.WT_SESSION)||Boolean(I.env.TERMINUS_SUBLIME)||I.env.ConEmuTask==="{cmd::Cmder}"||I.env.TERM_PROGRAM==="Terminus-Sublime"||I.env.TERM_PROGRAM==="vscode"||I.env.TERM==="xterm-256color"||I.env.TERM==="alacritty"||I.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var W,J1,L4,L=($,h)=>L4?$:h,k0,k2,y2,T4,H6,V,u1,y0,_0,B6,S6,L6,T6,V6,f6,A6,U6,R0,P0,I0,F0,_2=($)=>{switch($){case"initial":case"active":return W.default.cyan(k0);case"cancel":return W.default.red(k2);case"error":return W.default.yellow(y2);case"submit":return W.default.green(T4)}},R2=($)=>new B4({validate:$.validate,placeholder:$.placeholder,defaultValue:$.defaultValue,initialValue:$.initialValue,render(){let h=`${W.default.gray(V)}
17
- ${_2(this.state)} ${$.message}
18
- `,M=$.placeholder?W.default.inverse($.placeholder[0])+W.default.dim($.placeholder.slice(1)):W.default.inverse(W.default.hidden("_")),G=this.value?this.valueWithCursor:M;switch(this.state){case"error":return`${h.trim()}
19
- ${W.default.yellow(V)} ${G}
20
- ${W.default.yellow(u1)} ${W.default.yellow(this.error)}
21
- `;case"submit":return`${h}${W.default.gray(V)} ${W.default.dim(this.value||$.placeholder)}`;case"cancel":return`${h}${W.default.gray(V)} ${W.default.strikethrough(W.default.dim(this.value??""))}${this.value?.trim()?`
22
- `+W.default.gray(V):""}`;default:return`${h}${W.default.cyan(V)} ${G}
23
- ${W.default.cyan(u1)}
24
- `}}}).prompt(),T1=($)=>{let h=(G,b)=>{let g=G.label??String(G.value);return b==="active"?`${W.default.green(y0)} ${g} ${G.hint?W.default.dim(`(${G.hint})`):""}`:b==="selected"?`${W.default.dim(g)}`:b==="cancelled"?`${W.default.strikethrough(W.default.dim(g))}`:`${W.default.dim(_0)} ${W.default.dim(g)}`},M=0;return new N2({options:$.options,initialValue:$.initialValue,render(){let G=`${W.default.gray(V)}
25
- ${_2(this.state)} ${$.message}
26
- `;switch(this.state){case"submit":return`${G}${W.default.gray(V)} ${h(this.options[this.cursor],"selected")}`;case"cancel":return`${G}${W.default.gray(V)} ${h(this.options[this.cursor],"cancelled")}
27
- ${W.default.gray(V)}`;default:{let b=$.maxItems===void 0?1/0:Math.max($.maxItems,5);this.cursor>=M+b-3?M=Math.max(Math.min(this.cursor-b+3,this.options.length-b),0):this.cursor<M+2&&(M=Math.max(this.cursor-2,0));let g=b<this.options.length&&M>0,v=b<this.options.length&&M+b<this.options.length;return`${G}${W.default.cyan(V)} ${this.options.slice(M,M+b).map((Z,J,z)=>J===0&&g?W.default.dim("..."):J===z.length-1&&v?W.default.dim("..."):h(Z,J+M===this.cursor?"active":"inactive")).join(`
28
- ${W.default.cyan(V)} `)}
29
- ${W.default.cyan(u1)}
30
- `}}}}).prompt()},V4=($="")=>{process.stdout.write(`${W.default.gray(V)}
31
- ${W.default.gray(u1)} ${$}
5
+ `).map((b)=>W0(b,v,G)).join(`
6
+ `)}function N0($,v){if($===v)return;let G=$.split(`
7
+ `),b=v.split(`
8
+ `),Z=[];for(let J=0;J<Math.max(G.length,b.length);J++)G[J]!==b[J]&&Z.push(J);return Z}function a($){return $===P2}function u1($,v){$.isTTY&&$.setRawMode(v)}class S4{constructor({render:$,input:v=W2,output:G=j2,...b},Z=!0){N(this,"input"),N(this,"output"),N(this,"rl"),N(this,"opts"),N(this,"_track",!1),N(this,"_render"),N(this,"_cursor",0),N(this,"state","initial"),N(this,"value"),N(this,"error",""),N(this,"subscribers",new Map),N(this,"_prevFrame",""),this.opts=b,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=$.bind(this),this._track=Z,this.input=v,this.output=G}prompt(){let $=new L0(0);return $._write=(v,G,b)=>{this._track&&(this.value=this.rl.line.replace(/\t/g,""),this._cursor=this.rl.cursor,this.emit("value",this.value)),b()},this.input.pipe($),this.rl=T2.createInterface({input:this.input,output:$,tabSize:2,prompt:"",escapeCodeTimeout:50}),T2.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),u1(this.input,!0),this.output.on("resize",this.render),this.render(),new Promise((v,G)=>{this.once("submit",()=>{this.output.write(K.cursor.show),this.output.off("resize",this.render),u1(this.input,!1),v(this.value)}),this.once("cancel",()=>{this.output.write(K.cursor.show),this.output.off("resize",this.render),u1(this.input,!1),v(P2)})})}on($,v){let G=this.subscribers.get($)??[];G.push({cb:v}),this.subscribers.set($,G)}once($,v){let G=this.subscribers.get($)??[];G.push({cb:v,once:!0}),this.subscribers.set($,G)}emit($,...v){let G=this.subscribers.get($)??[],b=[];for(let Z of G)Z.cb(...v),Z.once&&b.push(()=>G.splice(G.indexOf(Z),1));for(let Z of b)Z()}unsubscribe(){this.subscribers.clear()}onKeypress($,v){if(this.state==="error"&&(this.state="active"),v?.name&&!this._track&&m2.has(v.name)&&this.emit("cursor",m2.get(v.name)),v?.name&&_0.has(v.name)&&this.emit("cursor",v.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()),v?.name==="return"){if(this.opts.validate){let G=this.opts.validate(this.value);G&&(this.error=G,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(`
9
+ `),u1(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let $=w2(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
10
+ `).length-1;this.output.write(K.cursor.move(-999,$*-1))}render(){let $=w2(this._render(this)??"",process.stdout.columns,{hard:!0});if($!==this._prevFrame){if(this.state==="initial")this.output.write(K.cursor.hide);else{let v=N0(this._prevFrame,$);if(this.restoreCursor(),v&&v?.length===1){let G=v[0];this.output.write(K.cursor.move(0,G)),this.output.write(K.erase.lines(1));let b=$.split(`
11
+ `);this.output.write(b[G]),this._prevFrame=$,this.output.write(K.cursor.move(0,b.length-G-1));return}else if(v&&v?.length>1){let G=v[0];this.output.write(K.cursor.move(0,G)),this.output.write(K.erase.down());let b=$.split(`
12
+ `).slice(G);this.output.write(b.join(`
13
+ `)),this._prevFrame=$;return}this.output.write(K.erase.down())}this.output.write($),this.state==="initial"&&(this.state="active"),this._prevFrame=$}}}function F2({input:$=W2,output:v=j2,overwrite:G=!0,hideCursor:b=!0}={}){let Z=o.createInterface({input:$,output:v,prompt:"",tabSize:1});o.emitKeypressEvents($,Z),$.isTTY&&$.setRawMode(!0);let J=(M,{name:X})=>{if(String(M)==="\x03"){b&&v.write(K.cursor.show),process.exit(0);return}if(!G)return;o.moveCursor(v,X==="return"?0:-1,X==="return"?-1:0,()=>{o.clearLine(v,1,()=>{$.once("keypress",J)})})};return b&&v.write(K.cursor.hide),$.once("keypress",J),()=>{$.off("keypress",J),b&&v.write(K.cursor.show),$.isTTY&&!C0&&$.setRawMode(!1),Z.terminal=!1,Z.close()}}var K,p1,q0,_2,H0,B0,S0=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},T0,h4=10,V2=($=0)=>(v)=>`\x1B[${v+$}m`,A2=($=0)=>(v)=>`\x1B[${38+$};5;${v}m`,f2=($=0)=>(v,G,b)=>`\x1B[${38+$};2;${v};${G};${b}m`,B,V0,A0,U0,r1,O0=39,H4="\x07",y2="[",w0="]",R2="m",B4,U2=($)=>`${r1.values().next().value}${y2}${$}${R2}`,O2=($)=>`${r1.values().next().value}${B4}${$}${H4}`,m0=($)=>$.split(" ").map((v)=>A1(v)),q4=($,v,G)=>{let b=[...v],Z=!1,J=!1,M=A1(k2($[$.length-1]));for(let[X,z]of b.entries()){let x=A1(z);if(M+x<=G?$[$.length-1]+=z:($.push(z),M=0),r1.has(z)&&(Z=!0,J=b.slice(X+1).join("").startsWith(B4)),Z){J?z===H4&&(Z=!1,J=!1):z===R2&&(Z=!1);continue}M+=x,M===G&&X<b.length-1&&($.push(""),M=0)}!M&&$[$.length-1].length>0&&$.length>1&&($[$.length-2]+=$.pop())},K0=($)=>{let v=$.split(" "),G=v.length;for(;G>0&&!(A1(v[G-1])>0);)G--;return G===v.length?$:v.slice(0,G).join(" ")+v.slice(G).join("")},W0=($,v,G={})=>{if(G.trim!==!1&&$.trim()==="")return"";let b="",Z,J,M=m0($),X=[""];for(let[x,Q]of $.split(" ").entries()){G.trim!==!1&&(X[X.length-1]=X[X.length-1].trimStart());let g=A1(X[X.length-1]);if(x!==0&&(g>=v&&(G.wordWrap===!1||G.trim===!1)&&(X.push(""),g=0),(g>0||G.trim===!1)&&(X[X.length-1]+=" ",g++)),G.hard&&M[x]>v){let q=v-g,H=1+Math.floor((M[x]-q-1)/v);Math.floor((M[x]-1)/v)<H&&X.push(""),q4(X,Q,v);continue}if(g+M[x]>v&&g>0&&M[x]>0){if(G.wordWrap===!1&&g<v){q4(X,Q,v);continue}X.push("")}if(g+M[x]>v&&G.wordWrap===!1){q4(X,Q,v);continue}X[X.length-1]+=Q}G.trim!==!1&&(X=X.map((x)=>K0(x)));let z=[...X.join(`
14
+ `)];for(let[x,Q]of z.entries()){if(b+=Q,r1.has(Q)){let{groups:q}=new RegExp(`(?:\\${y2}(?<code>\\d+)m|\\${B4}(?<uri>.*)${H4})`).exec(z.slice(x).join(""))||{groups:{}};if(q.code!==void 0){let H=Number.parseFloat(q.code);Z=H===O0?void 0:H}else q.uri!==void 0&&(J=q.uri.length===0?void 0:q.uri)}let g=U0.codes.get(Number(Z));z[x+1]===`
15
+ `?(J&&(b+=O2("")),Z&&g&&(b+=U2(g))):Q===`
16
+ `&&(Z&&g&&(b+=U2(Z)),J&&(b+=O2(J)))}return b},j0,k0=($,v,G)=>(v in $)?j0($,v,{enumerable:!0,configurable:!0,writable:!0,value:G}):$[v]=G,N=($,v,G)=>(k0($,typeof v!="symbol"?v+"":v,G),G),P2,m2,_0,y0,R0=($,v,G)=>(v in $)?y0($,v,{enumerable:!0,configurable:!0,writable:!0,value:G}):$[v]=G,K2=($,v,G)=>(R0($,typeof v!="symbol"?v+"":v,G),G),I2,P0,I0=($,v,G)=>(v in $)?P0($,v,{enumerable:!0,configurable:!0,writable:!0,value:G}):$[v]=G,F0=($,v,G)=>(I0($,typeof v!="symbol"?v+"":v,G),G),T4,C0;var V4=W(()=>{K=O(g4(),1),p1=O(L4(),1);q0=h0();_2={exports:{}};(function($){var v={};$.exports=v,v.eastAsianWidth=function(b){var Z=b.charCodeAt(0),J=b.length==2?b.charCodeAt(1):0,M=Z;return 55296<=Z&&Z<=56319&&56320<=J&&J<=57343&&(Z&=1023,J&=1023,M=Z<<10|J,M+=65536),M==12288||65281<=M&&M<=65376||65504<=M&&M<=65510?"F":M==8361||65377<=M&&M<=65470||65474<=M&&M<=65479||65482<=M&&M<=65487||65490<=M&&M<=65495||65498<=M&&M<=65500||65512<=M&&M<=65518?"H":4352<=M&&M<=4447||4515<=M&&M<=4519||4602<=M&&M<=4607||9001<=M&&M<=9002||11904<=M&&M<=11929||11931<=M&&M<=12019||12032<=M&&M<=12245||12272<=M&&M<=12283||12289<=M&&M<=12350||12353<=M&&M<=12438||12441<=M&&M<=12543||12549<=M&&M<=12589||12593<=M&&M<=12686||12688<=M&&M<=12730||12736<=M&&M<=12771||12784<=M&&M<=12830||12832<=M&&M<=12871||12880<=M&&M<=13054||13056<=M&&M<=19903||19968<=M&&M<=42124||42128<=M&&M<=42182||43360<=M&&M<=43388||44032<=M&&M<=55203||55216<=M&&M<=55238||55243<=M&&M<=55291||63744<=M&&M<=64255||65040<=M&&M<=65049||65072<=M&&M<=65106||65108<=M&&M<=65126||65128<=M&&M<=65131||110592<=M&&M<=110593||127488<=M&&M<=127490||127504<=M&&M<=127546||127552<=M&&M<=127560||127568<=M&&M<=127569||131072<=M&&M<=194367||177984<=M&&M<=196605||196608<=M&&M<=262141?"W":32<=M&&M<=126||162<=M&&M<=163||165<=M&&M<=166||M==172||M==175||10214<=M&&M<=10221||10629<=M&&M<=10630?"Na":M==161||M==164||167<=M&&M<=168||M==170||173<=M&&M<=174||176<=M&&M<=180||182<=M&&M<=186||188<=M&&M<=191||M==198||M==208||215<=M&&M<=216||222<=M&&M<=225||M==230||232<=M&&M<=234||236<=M&&M<=237||M==240||242<=M&&M<=243||247<=M&&M<=250||M==252||M==254||M==257||M==273||M==275||M==283||294<=M&&M<=295||M==299||305<=M&&M<=307||M==312||319<=M&&M<=322||M==324||328<=M&&M<=331||M==333||338<=M&&M<=339||358<=M&&M<=359||M==363||M==462||M==464||M==466||M==468||M==470||M==472||M==474||M==476||M==593||M==609||M==708||M==711||713<=M&&M<=715||M==717||M==720||728<=M&&M<=731||M==733||M==735||768<=M&&M<=879||913<=M&&M<=929||931<=M&&M<=937||945<=M&&M<=961||963<=M&&M<=969||M==1025||1040<=M&&M<=1103||M==1105||M==8208||8211<=M&&M<=8214||8216<=M&&M<=8217||8220<=M&&M<=8221||8224<=M&&M<=8226||8228<=M&&M<=8231||M==8240||8242<=M&&M<=8243||M==8245||M==8251||M==8254||M==8308||M==8319||8321<=M&&M<=8324||M==8364||M==8451||M==8453||M==8457||M==8467||M==8470||8481<=M&&M<=8482||M==8486||M==8491||8531<=M&&M<=8532||8539<=M&&M<=8542||8544<=M&&M<=8555||8560<=M&&M<=8569||M==8585||8592<=M&&M<=8601||8632<=M&&M<=8633||M==8658||M==8660||M==8679||M==8704||8706<=M&&M<=8707||8711<=M&&M<=8712||M==8715||M==8719||M==8721||M==8725||M==8730||8733<=M&&M<=8736||M==8739||M==8741||8743<=M&&M<=8748||M==8750||8756<=M&&M<=8759||8764<=M&&M<=8765||M==8776||M==8780||M==8786||8800<=M&&M<=8801||8804<=M&&M<=8807||8810<=M&&M<=8811||8814<=M&&M<=8815||8834<=M&&M<=8835||8838<=M&&M<=8839||M==8853||M==8857||M==8869||M==8895||M==8978||9312<=M&&M<=9449||9451<=M&&M<=9547||9552<=M&&M<=9587||9600<=M&&M<=9615||9618<=M&&M<=9621||9632<=M&&M<=9633||9635<=M&&M<=9641||9650<=M&&M<=9651||9654<=M&&M<=9655||9660<=M&&M<=9661||9664<=M&&M<=9665||9670<=M&&M<=9672||M==9675||9678<=M&&M<=9681||9698<=M&&M<=9701||M==9711||9733<=M&&M<=9734||M==9737||9742<=M&&M<=9743||9748<=M&&M<=9749||M==9756||M==9758||M==9792||M==9794||9824<=M&&M<=9825||9827<=M&&M<=9829||9831<=M&&M<=9834||9836<=M&&M<=9837||M==9839||9886<=M&&M<=9887||9918<=M&&M<=9919||9924<=M&&M<=9933||9935<=M&&M<=9953||M==9955||9960<=M&&M<=9983||M==10045||M==10071||10102<=M&&M<=10111||11093<=M&&M<=11097||12872<=M&&M<=12879||57344<=M&&M<=63743||65024<=M&&M<=65039||M==65533||127232<=M&&M<=127242||127248<=M&&M<=127277||127280<=M&&M<=127337||127344<=M&&M<=127386||917760<=M&&M<=917999||983040<=M&&M<=1048573||1048576<=M&&M<=1114109?"A":"N"},v.characterLength=function(b){var Z=this.eastAsianWidth(b);return Z=="F"||Z=="W"||Z=="A"?2:1};function G(b){return b.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}v.length=function(b){for(var Z=G(b),J=0,M=0;M<Z.length;M++)J=J+this.characterLength(Z[M]);return J},v.slice=function(b,Z,J){textLen=v.length(b),Z=Z||0,J=J||1,Z<0&&(Z=textLen+Z),J<0&&(J=textLen+J);for(var M="",X=0,z=G(b),x=0;x<z.length;x++){var Q=z[x],g=v.length(Q);if(X>=Z-(g==2?1:0))if(X+g<=J)M+=Q;else break;X+=g}return M}})(_2);H0=_2.exports,B0=N2(H0),T0=N2(S0);B={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(B.modifier);V0=Object.keys(B.color),A0=Object.keys(B.bgColor);[...V0,...A0];U0=f0(),r1=new Set(["\x1B","\x9B"]),B4=`${w0}8;;`;j0=Object.defineProperty;P2=Symbol("clack:cancel");m2=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),_0=new Set(["up","down","left","right","space","enter"]);y0=Object.defineProperty,I2=class extends S4{constructor($){super($,!1),K2(this,"options"),K2(this,"cursor",0),this.options=$.options,this.cursor=this.options.findIndex(({value:v})=>v===$.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(v)=>{switch(v){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}},P0=Object.defineProperty;T4=class T4 extends S4{constructor($){super($),F0(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}${p1.default.inverse(p1.default.hidden("_"))}`;else{let v=this.value.slice(0,this.cursor),G=this.value.slice(this.cursor);this.valueWithCursor=`${v}${p1.default.inverse(G[0])}${G.slice(1)}`}})}get cursor(){return this._cursor}};C0=globalThis.process.platform.startsWith("win")});import F from"process";function u0(){return F.platform!=="win32"?F.env.TERM!=="linux":Boolean(F.env.CI)||Boolean(F.env.WT_SESSION)||Boolean(F.env.TERMINUS_SUBLIME)||F.env.ConEmuTask==="{cmd::Cmder}"||F.env.TERM_PROGRAM==="Terminus-Sublime"||F.env.TERM_PROGRAM==="vscode"||F.env.TERM==="xterm-256color"||F.env.TERM==="alacritty"||F.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var E,Q1,A4,T=($,v)=>A4?$:v,p0,C2,u2,f4,m6,f,s1,r0,s0,K6,W6,j6,k6,N6,_6,y6,R6,D0,n0,l0,c0,p2=($)=>{switch($){case"initial":case"active":return E.default.cyan(p0);case"cancel":return E.default.red(C2);case"error":return E.default.yellow(u2);case"submit":return E.default.green(f4)}},r2=($)=>new T4({validate:$.validate,placeholder:$.placeholder,defaultValue:$.defaultValue,initialValue:$.initialValue,render(){let v=`${E.default.gray(f)}
17
+ ${p2(this.state)} ${$.message}
18
+ `,G=$.placeholder?E.default.inverse($.placeholder[0])+E.default.dim($.placeholder.slice(1)):E.default.inverse(E.default.hidden("_")),b=this.value?this.valueWithCursor:G;switch(this.state){case"error":return`${v.trim()}
19
+ ${E.default.yellow(f)} ${b}
20
+ ${E.default.yellow(s1)} ${E.default.yellow(this.error)}
21
+ `;case"submit":return`${v}${E.default.gray(f)} ${E.default.dim(this.value||$.placeholder)}`;case"cancel":return`${v}${E.default.gray(f)} ${E.default.strikethrough(E.default.dim(this.value??""))}${this.value?.trim()?`
22
+ `+E.default.gray(f):""}`;default:return`${v}${E.default.cyan(f)} ${b}
23
+ ${E.default.cyan(s1)}
24
+ `}}}).prompt(),f1=($)=>{let v=(b,Z)=>{let J=b.label??String(b.value);return Z==="active"?`${E.default.green(r0)} ${J} ${b.hint?E.default.dim(`(${b.hint})`):""}`:Z==="selected"?`${E.default.dim(J)}`:Z==="cancelled"?`${E.default.strikethrough(E.default.dim(J))}`:`${E.default.dim(s0)} ${E.default.dim(J)}`},G=0;return new I2({options:$.options,initialValue:$.initialValue,render(){let b=`${E.default.gray(f)}
25
+ ${p2(this.state)} ${$.message}
26
+ `;switch(this.state){case"submit":return`${b}${E.default.gray(f)} ${v(this.options[this.cursor],"selected")}`;case"cancel":return`${b}${E.default.gray(f)} ${v(this.options[this.cursor],"cancelled")}
27
+ ${E.default.gray(f)}`;default:{let Z=$.maxItems===void 0?1/0:Math.max($.maxItems,5);this.cursor>=G+Z-3?G=Math.max(Math.min(this.cursor-Z+3,this.options.length-Z),0):this.cursor<G+2&&(G=Math.max(this.cursor-2,0));let J=Z<this.options.length&&G>0,M=Z<this.options.length&&G+Z<this.options.length;return`${b}${E.default.cyan(f)} ${this.options.slice(G,G+Z).map((X,z,x)=>z===0&&J?E.default.dim("..."):z===x.length-1&&M?E.default.dim("..."):v(X,z+G===this.cursor?"active":"inactive")).join(`
28
+ ${E.default.cyan(f)} `)}
29
+ ${E.default.cyan(s1)}
30
+ `}}}}).prompt()},U4=($="")=>{process.stdout.write(`${E.default.gray(f)}
31
+ ${E.default.gray(s1)} ${$}
32
32
 
33
- `)},Q,F=()=>{let $=L4?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],h=L4?80:120,M,G,b=!1,g="",v=(Y="")=>{b=!0,M=j2(),g=Y.replace(/\.+$/,""),process.stdout.write(`${W.default.gray(V)}
34
- `);let x=0,q=0;G=setInterval(()=>{let S=W.default.magenta($[x]),E=".".repeat(Math.floor(q)).slice(0,3);process.stdout.write(J1.cursor.move(-999,0)),process.stdout.write(J1.erase.down(1)),process.stdout.write(`${S} ${g}${E}`),x=x+1<$.length?x+1:0,q=q<$.length?q+0.125:0},h)},Z=(Y="",x=0)=>{g=Y??g,b=!1,clearInterval(G);let q=x===0?W.default.green(T4):x===1?W.default.red(k2):W.default.red(y2);process.stdout.write(J1.cursor.move(-999,0)),process.stdout.write(J1.erase.down(1)),process.stdout.write(`${q} ${g}
35
- `),M()},J=(Y="")=>{g=Y??g},z=(Y)=>{let x=Y>1?"Something went wrong":"Canceled";b&&Z(x,Y)};return process.on("uncaughtExceptionMonitor",()=>z(2)),process.on("unhandledRejection",()=>z(2)),process.on("SIGINT",()=>z(1)),process.on("SIGTERM",()=>z(1)),process.on("exit",z),{start:v,stop:Z,message:J}};var r=m(()=>{S4();S4();W=A(x4(),1),J1=A(z4(),1);L4=j0(),k0=L("\u25C6","*"),k2=L("\u25A0","x"),y2=L("\u25B2","x"),T4=L("\u25C7","o"),H6=L("\u250C","T"),V=L("\u2502","|"),u1=L("\u2514","\u2014"),y0=L("\u25CF",">"),_0=L("\u25CB"," "),B6=L("\u25FB","[\u2022]"),S6=L("\u25FC","[+]"),L6=L("\u25FB","[ ]"),T6=L("\u25AA","\u2022"),V6=L("\u2500","-"),f6=L("\u256E","+"),A6=L("\u251C","+"),U6=L("\u256F","+"),R0=L("\u25CF","\u2022"),P0=L("\u25C6","*"),I0=L("\u25B2","!"),F0=L("\u25A0","x"),Q={message:($="",{symbol:h=W.default.gray(V)}={})=>{let M=[`${W.default.gray(V)}`];if($){let[G,...b]=$.split(`
36
- `);M.push(`${h} ${G}`,...b.map((g)=>`${W.default.gray(V)} ${g}`))}process.stdout.write(`${M.join(`
33
+ `)},L,C=()=>{let $=A4?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],v=A4?80:120,G,b,Z=!1,J="",M=(Q="")=>{Z=!0,G=F2(),J=Q.replace(/\.+$/,""),process.stdout.write(`${E.default.gray(f)}
34
+ `);let g=0,q=0;b=setInterval(()=>{let H=E.default.magenta($[g]),h=".".repeat(Math.floor(q)).slice(0,3);process.stdout.write(Q1.cursor.move(-999,0)),process.stdout.write(Q1.erase.down(1)),process.stdout.write(`${H} ${J}${h}`),g=g+1<$.length?g+1:0,q=q<$.length?q+0.125:0},v)},X=(Q="",g=0)=>{J=Q??J,Z=!1,clearInterval(b);let q=g===0?E.default.green(f4):g===1?E.default.red(C2):E.default.red(u2);process.stdout.write(Q1.cursor.move(-999,0)),process.stdout.write(Q1.erase.down(1)),process.stdout.write(`${q} ${J}
35
+ `),G()},z=(Q="")=>{J=Q??J},x=(Q)=>{let g=Q>1?"Something went wrong":"Canceled";Z&&X(g,Q)};return process.on("uncaughtExceptionMonitor",()=>x(2)),process.on("unhandledRejection",()=>x(2)),process.on("SIGINT",()=>x(1)),process.on("SIGTERM",()=>x(1)),process.on("exit",x),{start:M,stop:X,message:z}};var s=W(()=>{V4();V4();E=O(L4(),1),Q1=O(g4(),1);A4=u0(),p0=T("\u25C6","*"),C2=T("\u25A0","x"),u2=T("\u25B2","x"),f4=T("\u25C7","o"),m6=T("\u250C","T"),f=T("\u2502","|"),s1=T("\u2514","\u2014"),r0=T("\u25CF",">"),s0=T("\u25CB"," "),K6=T("\u25FB","[\u2022]"),W6=T("\u25FC","[+]"),j6=T("\u25FB","[ ]"),k6=T("\u25AA","\u2022"),N6=T("\u2500","-"),_6=T("\u256E","+"),y6=T("\u251C","+"),R6=T("\u256F","+"),D0=T("\u25CF","\u2022"),n0=T("\u25C6","*"),l0=T("\u25B2","!"),c0=T("\u25A0","x"),L={message:($="",{symbol:v=E.default.gray(f)}={})=>{let G=[`${E.default.gray(f)}`];if($){let[b,...Z]=$.split(`
36
+ `);G.push(`${v} ${b}`,...Z.map((J)=>`${E.default.gray(f)} ${J}`))}process.stdout.write(`${G.join(`
37
37
  `)}
38
- `)},info:($)=>{Q.message($,{symbol:W.default.blue(R0)})},success:($)=>{Q.message($,{symbol:W.default.green(P0)})},step:($)=>{Q.message($,{symbol:W.default.green(T4)})},warn:($)=>{Q.message($,{symbol:W.default.yellow(I0)})},warning:($)=>{Q.warn($)},error:($)=>{Q.message($,{symbol:W.default.red(F0)})}}});function f4($,h){return{type:"register",sessionCode:$,apiKey:h}}function A4($){return{type:"output",data:$}}function U4($){return{type:"exit",code:$}}function p0(){return{type:"ping"}}function u0($){return{type:"input",data:$}}function r0($,h){return{type:"resize",cols:$,rows:h}}function w4($){try{return JSON.parse($)}catch{throw Error(`Invalid message format: ${$}`)}}function O4($){return JSON.stringify($)}function V1(){let $=new Uint8Array(K4);crypto.getRandomValues($);let h="";for(let M=0;M<K4;M++)h+=m4[$[M]%m4.length];return h}function f1($){return`${B1}/web/remote?code=${$}`}function N4($,h){return`${B1.replace("https://","wss://").replace("http://","ws://")}/web-api/ws/cli?code=${encodeURIComponent($)}&key=${encodeURIComponent(h)}`}function s0($,h){return`${B1.replace("https://","wss://").replace("http://","ws://")}/web-api/ws/client?code=${encodeURIComponent($)}&key=${encodeURIComponent(h)}`}function d0($){if($.length!==K4)return!1;for(let h of $)if(!m4.includes(h))return!1;return!0}var m4="ABCDEFGHJKMNPQRSTUVWXYZ23456789",K4=6;var A1=m(()=>{U()});class j4{ws=null;sessionCode="";apiKey="";events={};reconnectAttempts=0;_state="disconnected";heartbeatTimer=null;lastPongTime=0;isIntentionalClose=!1;get state(){return this._state}setState($){this._state=$,this.events.onStateChange?.($)}async connect($,h,M={}){if(this.ws)throw Error("Already connected");this.sessionCode=$,this.apiKey=h,this.events=M,this.reconnectAttempts=0,this.isIntentionalClose=!1,await this.doConnect()}async doConnect(){return new Promise(($,h)=>{this.setState("connecting");let M=N4(this.sessionCode,this.apiKey);this.ws=new WebSocket(M);let G=setTimeout(()=>{if(this.ws?.readyState!==WebSocket.OPEN)this.ws?.close(),h(Error("Connection timeout"))},a0);this.ws.onopen=()=>{clearTimeout(G),this.setState("connected"),this.reconnectAttempts=0,this.send(f4(this.sessionCode,this.apiKey)),this.startHeartbeat(),$()},this.ws.onmessage=(b)=>{this.handleMessage(b.data)},this.ws.onerror=(b)=>{clearTimeout(G);let g=Error("WebSocket error");this.events.onError?.(g)},this.ws.onclose=()=>{if(clearTimeout(G),this.stopHeartbeat(),this.ws=null,this.isIntentionalClose)this.setState("disconnected"),this.events.onDisconnect?.();else this.attemptReconnect()}})}startHeartbeat(){this.stopHeartbeat(),this.lastPongTime=Date.now(),this.heartbeatTimer=setInterval(()=>{if(Date.now()-this.lastPongTime>c0){console.log("[WS] Heartbeat timeout, triggering reconnect..."),this.ws?.close();return}this.send({type:"ping"})},i0)}stopHeartbeat(){if(this.heartbeatTimer)clearInterval(this.heartbeatTimer),this.heartbeatTimer=null}async attemptReconnect(){if(this.reconnectAttempts>=C2){console.log("[WS] Max reconnect attempts reached, giving up"),this.setState("disconnected"),this.events.onError?.(Error("Max reconnect attempts reached")),this.events.onDisconnect?.();return}this.reconnectAttempts++;let $=Math.min(1000*Math.pow(2,this.reconnectAttempts-1),l0);console.log(`[WS] Reconnecting in ${$/1000}s (attempt ${this.reconnectAttempts}/${C2})...`),this.setState("reconnecting"),this.events.onReconnecting?.(this.reconnectAttempts),await new Promise((h)=>setTimeout(h,$));try{await this.doConnect(),console.log("[WS] Reconnected successfully"),this.events.onReconnected?.()}catch(h){console.log(`[WS] Reconnect failed: ${h.message}`),this.attemptReconnect()}}handleMessage($){try{let h=w4($);switch(h.type){case"input":this.events.onInput?.(h.data);break;case"resize":this.events.onResize?.(h.cols,h.rows);break;case"client_connected":this.events.onClientConnected?.();break;case"client_disconnected":this.events.onClientDisconnected?.();break;case"error":this.events.onError?.(Error(h.message));break;case"pong":this.lastPongTime=Date.now();break}}catch(h){this.events.onError?.(h)}}send($){if(this.ws?.readyState===WebSocket.OPEN)this.ws.send(O4($))}sendOutput($){this.send(A4($))}sendExit($){this.send(U4($))}disconnect(){if(this.isIntentionalClose=!0,this.stopHeartbeat(),this.ws)this.ws.close(),this.ws=null,this.setState("disconnected")}get isConnected(){return this.ws?.readyState===WebSocket.OPEN}}function U1(){return new j4}var i0=30000,c0=60000,C2=10,l0=30000,a0=1e4;var s1=m(()=>{A1()});var u2={};h4(u2,{tArray:()=>c1,t:()=>X,showUpdateAnnouncement:()=>n0,setLocale:()=>k4,getLocale:()=>y4,detectLocale:()=>i1,clearLocaleOverride:()=>D0});function i1(){if(d1)return d1;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"en"}function k4($){d1=$}function D0(){d1=null}function X($,h){let M=i1(),G=$.split("."),b=p2;for(let v of G)if(b=b?.[v],!b)return $;let g=b[M]||b.en||$;if(h)for(let[v,Z]of Object.entries(h))g=g.replace(`{${v}}`,String(Z));return g}function c1($){let h=i1(),M=$.split("."),G=p2;for(let b of M)if(G=G?.[b],!G)return[];return G[h]||G.en||[]}function y4(){return i1()}function n0(){let h="\u2500".repeat(70);console.log(),console.log(` \u250C${h}\u2510`),console.log(` \u2502${" ".repeat(70)}\u2502`);let M=X("updateAnnouncement.title"),G=M.length;if(G<=70){let Z=Math.floor((70-G)/2),J=70-Z-G;console.log(` \u2502${" ".repeat(Z)}${M}${" ".repeat(J)}\u2502`)}else console.log(` \u2502 ${M.slice(0,68)} \u2502`);let b=X("updateAnnouncement.description"),g=b.length;if(g<=70){let Z=Math.floor((70-g)/2),J=70-Z-g;console.log(` \u2502${" ".repeat(Z)}${b}${" ".repeat(J)}\u2502`)}else console.log(` \u2502 ${b.slice(0,68)} \u2502`);console.log(` \u2502${" ".repeat(70)}\u2502`);let v=c1("updateAnnouncement.features");for(let Z of v)if(Z.length<=66){let Y=Z.padEnd(66);console.log(` \u2502${" ".repeat(2)}${Y}${" ".repeat(2)}\u2502`)}else console.log(` \u2502${" ".repeat(2)}${Z.slice(0,66)}${" ".repeat(2)}\u2502`);console.log(` \u2502${" ".repeat(70)}\u2502`),console.log(` \u2514${h}\u2518`),console.log()}var d1=null,p2;var N=m(()=>{p2={updateAnnouncement:{title:{en:"\uD83C\uDF89 New Feature: Remote Control Mode",zh:"\uD83C\uDF89 \u65B0\u529F\u80FD\uFF1A\u8FDC\u7A0B\u63A7\u5236\u6A21\u5F0F"},description:{en:"Press Ctrl+\\ anytime to toggle between local and remote control!",zh:"\u968F\u65F6\u6309 Ctrl+\\ \u5728\u672C\u5730\u548C\u8FDC\u7A0B\u63A7\u5236\u4E4B\u95F4\u5207\u6362\uFF01"},features:{en:["\u2022 Switch to remote mode instantly with QR code","\u2022 Control from your mobile device or browser","\u2022 Return to local mode anytime"],zh:["\u2022 \u5373\u523B\u5207\u6362\u5230\u8FDC\u7A0B\u6A21\u5F0F\u5E76\u663E\u793A\u4E8C\u7EF4\u7801","\u2022 \u4ECE\u624B\u673A\u6216\u6D4F\u89C8\u5668\u8FDC\u7A0B\u63A7\u5236","\u2022 \u968F\u65F6\u5207\u6362\u56DE\u672C\u5730\u6A21\u5F0F"]}},launcher:{starting:{en:"Starting {client}...",zh:"\u6B63\u5728\u542F\u52A8 {client}..."},ctrlHint:{en:"Press Ctrl+\\ to toggle remote mode",zh:"\u6309 Ctrl+\\ \u5207\u6362\u8FDC\u7A0B\u6A21\u5F0F"},windowsWarning:{en:"Remote mode not supported on Windows. Using legacy launcher.",zh:"Windows \u6682\u4E0D\u652F\u6301\u8FDC\u7A0B\u6A21\u5F0F\u3002\u4F7F\u7528\u4F20\u7EDF\u542F\u52A8\u5668\u3002"},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}"}},remote:{connecting:{en:"Connecting to remote server...",zh:"\u6B63\u5728\u8FDE\u63A5\u5230\u8FDC\u7A0B\u670D\u52A1\u5668..."},failedToConnect:{en:`Failed to connect: {error}
38
+ `)},info:($)=>{L.message($,{symbol:E.default.blue(D0)})},success:($)=>{L.message($,{symbol:E.default.green(n0)})},step:($)=>{L.message($,{symbol:E.default.green(f4)})},warn:($)=>{L.message($,{symbol:E.default.yellow(l0)})},warning:($)=>{L.warn($)},error:($)=>{L.message($,{symbol:E.default.red(c0)})}}});function w4($,v){return{type:"register",sessionCode:$,apiKey:v}}function m4($){return{type:"output",data:$}}function K4($){return{type:"exit",code:$}}function d0(){return{type:"ping"}}function a0($){return{type:"input",data:$}}function i0($,v){return{type:"resize",cols:$,rows:v}}function W4($){try{return JSON.parse($)}catch{throw Error(`Invalid message format: ${$}`)}}function j4($){return JSON.stringify($)}function U1(){let $=new Uint8Array(N4);crypto.getRandomValues($);let v="";for(let G=0;G<N4;G++)v+=k4[$[G]%k4.length];return v}function O1($){return`${T1}/web/remote?code=${$}`}function _4($,v){return`${T1.replace("https://","wss://").replace("http://","ws://")}/web-api/ws/cli?code=${encodeURIComponent($)}&key=${encodeURIComponent(v)}`}function o0($,v){return`${T1.replace("https://","wss://").replace("http://","ws://")}/web-api/ws/client?code=${encodeURIComponent($)}&key=${encodeURIComponent(v)}`}function e0($){if($.length!==N4)return!1;for(let v of $)if(!k4.includes(v))return!1;return!0}var k4="ABCDEFGHJKMNPQRSTUVWXYZ23456789",N4=6;var w1=W(()=>{w()});class y4{ws=null;sessionCode="";apiKey="";events={};reconnectAttempts=0;_state="disconnected";heartbeatTimer=null;lastPongTime=0;isIntentionalClose=!1;get state(){return this._state}setState($){this._state=$,this.events.onStateChange?.($)}async connect($,v,G={}){if(this.ws)throw Error("Already connected");this.sessionCode=$,this.apiKey=v,this.events=G,this.reconnectAttempts=0,this.isIntentionalClose=!1,await this.doConnect()}async doConnect(){return new Promise(($,v)=>{this.setState("connecting");let G=_4(this.sessionCode,this.apiKey);this.ws=new WebSocket(G);let b=setTimeout(()=>{if(this.ws?.readyState!==WebSocket.OPEN)this.ws?.close(),v(Error("Connection timeout"))},M$);this.ws.onopen=()=>{clearTimeout(b),this.setState("connected"),this.reconnectAttempts=0,this.send(w4(this.sessionCode,this.apiKey)),this.startHeartbeat(),$()},this.ws.onmessage=(Z)=>{this.handleMessage(Z.data)},this.ws.onerror=(Z)=>{clearTimeout(b);let J=Error("WebSocket error");this.events.onError?.(J)},this.ws.onclose=()=>{if(clearTimeout(b),this.stopHeartbeat(),this.ws=null,this.isIntentionalClose)this.setState("disconnected"),this.events.onDisconnect?.();else this.attemptReconnect()}})}startHeartbeat(){this.stopHeartbeat(),this.lastPongTime=Date.now(),this.heartbeatTimer=setInterval(()=>{if(Date.now()-this.lastPongTime>$$){console.log("[WS] Heartbeat timeout, triggering reconnect..."),this.ws?.close();return}this.send({type:"ping"})},t0)}stopHeartbeat(){if(this.heartbeatTimer)clearInterval(this.heartbeatTimer),this.heartbeatTimer=null}async attemptReconnect(){if(this.reconnectAttempts>=c2){console.log("[WS] Max reconnect attempts reached, giving up"),this.setState("disconnected"),this.events.onError?.(Error("Max reconnect attempts reached")),this.events.onDisconnect?.();return}this.reconnectAttempts++;let $=Math.min(1000*Math.pow(2,this.reconnectAttempts-1),v$);console.log(`[WS] Reconnecting in ${$/1000}s (attempt ${this.reconnectAttempts}/${c2})...`),this.setState("reconnecting"),this.events.onReconnecting?.(this.reconnectAttempts),await new Promise((v)=>setTimeout(v,$));try{await this.doConnect(),console.log("[WS] Reconnected successfully"),this.events.onReconnected?.()}catch(v){console.log(`[WS] Reconnect failed: ${v.message}`),this.attemptReconnect()}}handleMessage($){try{let v=W4($);switch(v.type){case"input":this.events.onInput?.(v.data);break;case"resize":this.events.onResize?.(v.cols,v.rows);break;case"client_connected":this.events.onClientConnected?.();break;case"client_disconnected":this.events.onClientDisconnected?.();break;case"error":this.events.onError?.(Error(v.message));break;case"pong":this.lastPongTime=Date.now();break}}catch(v){this.events.onError?.(v)}}send($){if(this.ws?.readyState===WebSocket.OPEN)this.ws.send(j4($))}sendOutput($){this.send(m4($))}sendExit($){this.send(K4($))}disconnect(){if(this.isIntentionalClose=!0,this.stopHeartbeat(),this.ws)this.ws.close(),this.ws=null,this.setState("disconnected")}get isConnected(){return this.ws?.readyState===WebSocket.OPEN}}function m1(){return new y4}var t0=30000,$$=60000,c2=10,v$=30000,M$=1e4;var n1=W(()=>{w1()});function G$($){let v=$.codePointAt(0);if(!v)return!1;return v>=19968&&v<=40959||v>=13312&&v<=19903||v>=131072&&v<=191471||v>=63744&&v<=64255||v>=194560&&v<=195103||v>=44032&&v<=55215||v>=12352&&v<=12447||v>=12448&&v<=12543||v>=65280&&v<=65519||v>=126976&&v<=131071||v>=9728&&v<=10175||v===11088}function b$($){return $.replace(/\x1b\[[0-9;]*m/g,"")}function A($){let v=b$($),G=0;for(let b of v)G+=G$(b)?2:1;return G}var a2={};G4(a2,{tArray:()=>d1,t:()=>Y,showUpdateAnnouncement:()=>J$,setLocale:()=>R4,getLocale:()=>P4,detectLocale:()=>c1,clearLocaleOverride:()=>Z$});function c1(){if(l1)return l1;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 R4($){l1=$}function Z$(){l1=null}function Y($,v){let G=c1(),b=$.split("."),Z=d2;for(let M of b)if(Z=Z?.[M],!Z)return $;let J=Z[G]||Z.en||$;if(v)for(let[M,X]of Object.entries(v))J=J.replace(`{${M}}`,String(X));return J}function d1($){let v=c1(),G=$.split("."),b=d2;for(let Z of G)if(b=b?.[Z],!b)return[];return b[v]||b.en||[]}function P4(){return c1()}function J$(){let v="\u2500".repeat(70);console.log(),console.log(` \u250C${v}\u2510`),console.log(` \u2502${" ".repeat(70)}\u2502`);let G=Y("updateAnnouncement.title"),b=A(G);if(b<=70){let X=Math.floor((70-b)/2),z=70-X-b;console.log(` \u2502${" ".repeat(X)}${G}${" ".repeat(z)}\u2502`)}else{let X="",z=0;for(let Q of G){let g=A(Q);if(z+g>68)break;X+=Q,z+=g}let x=68-A(X);console.log(` \u2502 ${X}${" ".repeat(x)} \u2502`)}let Z=Y("updateAnnouncement.description"),J=A(Z);if(J<=70){let X=Math.floor((70-J)/2),z=70-X-J;console.log(` \u2502${" ".repeat(X)}${Z}${" ".repeat(z)}\u2502`)}else{let X="",z=0;for(let Q of Z){let g=A(Q);if(z+g>68)break;X+=Q,z+=g}let x=68-A(X);console.log(` \u2502 ${X}${" ".repeat(x)} \u2502`)}console.log(` \u2502${" ".repeat(70)}\u2502`);let M=d1("updateAnnouncement.features");for(let X of M){let Q=A(X);if(Q<=66){let g=66-Q;console.log(` \u2502${" ".repeat(2)}${X}${" ".repeat(g+2)}\u2502`)}else{let g="",q=0;for(let h of X){let V=A(h);if(q+V>66)break;g+=h,q+=V}let H=66-A(g);console.log(` \u2502${" ".repeat(2)}${g}${" ".repeat(H+2)}\u2502`)}}console.log(` \u2502${" ".repeat(70)}\u2502`),console.log(` \u2514${v}\u2518`),console.log()}var l1=null,d2;var k=W(()=>{d2={updateAnnouncement:{title:{en:"\uD83C\uDF89 New Feature: Remote Control Mode",zh:"\uD83C\uDF89 \u65B0\u529F\u80FD\uFF1A\u8FDC\u7A0B\u63A7\u5236\u6A21\u5F0F"},description:{en:"Press Ctrl+\\ anytime to toggle between local and remote control!",zh:"\u968F\u65F6\u6309 Ctrl+\\ \u5728\u672C\u5730\u548C\u8FDC\u7A0B\u63A7\u5236\u4E4B\u95F4\u5207\u6362\uFF01"},features:{en:["\u2022 Switch to remote mode instantly with QR code","\u2022 Control from your mobile device or browser","\u2022 Return to local mode anytime"],zh:["\u2022 \u5373\u523B\u5207\u6362\u5230\u8FDC\u7A0B\u6A21\u5F0F\u5E76\u663E\u793A\u4E8C\u7EF4\u7801","\u2022 \u4ECE\u624B\u673A\u6216\u6D4F\u89C8\u5668\u8FDC\u7A0B\u63A7\u5236","\u2022 \u968F\u65F6\u5207\u6362\u56DE\u672C\u5730\u6A21\u5F0F"]}},launcher:{starting:{en:"Starting {client}...",zh:"\u6B63\u5728\u542F\u52A8 {client}..."},ctrlHint:{en:"Press Ctrl+\\ to toggle remote mode",zh:"\u6309 Ctrl+\\ \u5207\u6362\u8FDC\u7A0B\u6A21\u5F0F"},windowsWarning:{en:"Remote mode not supported on Windows. Using legacy launcher.",zh:"Windows \u6682\u4E0D\u652F\u6301\u8FDC\u7A0B\u6A21\u5F0F\u3002\u4F7F\u7528\u4F20\u7EDF\u542F\u52A8\u5668\u3002"},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}"}},remote:{connecting:{en:"Connecting to remote server...",zh:"\u6B63\u5728\u8FDE\u63A5\u5230\u8FDC\u7A0B\u670D\u52A1\u5668..."},failedToConnect:{en:`Failed to connect: {error}
39
39
  Returning to local mode...`,zh:`\u8FDE\u63A5\u5931\u8D25\uFF1A{error}
40
- \u6B63\u5728\u8FD4\u56DE\u672C\u5730\u6A21\u5F0F...`},connectionLost:{en:"Remote connection lost, returning to local mode...",zh:"\u8FDC\u7A0B\u8FDE\u63A5\u65AD\u5F00\uFF0C\u6B63\u5728\u8FD4\u56DE\u672C\u5730\u6A21\u5F0F..."},modeTitle:{en:"========== Remote Control Mode ==========",zh:"========== \u8FDC\u7A0B\u63A7\u5236\u6A21\u5F0F =========="},sessionCode:{en:"Session Code:",zh:"\u4F1A\u8BDD\u4EE3\u7801\uFF1A"},remoteUrl:{en:"Remote URL:",zh:"\u8FDC\u7A0B\u5730\u5740\uFF1A"},status:{en:"Status:",zh:"\u72B6\u6001\uFF1A"},waitingForConnection:{en:"Waiting for connection...",zh:"\u7B49\u5F85\u8FDE\u63A5..."},clientConnected:{en:"{count} client(s) connected",zh:"{count} \u4E2A\u5BA2\u6237\u7AEF\u5DF2\u8FDE\u63A5"},returnHint:{en:"Press Ctrl+\\ to return to local mode",zh:"\u6309 Ctrl+\\ \u8FD4\u56DE\u672C\u5730\u6A21\u5F0F"},devMode:{en:"[DEV MODE]",zh:"[\u5F00\u53D1\u6A21\u5F0F]"}},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"}},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"}}}});var _4=K((R6,r2)=>{r2.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}});var i2=K((P6,d2)=>{var o0=_4();function s2($){this.mode=o0.MODE_8BIT_BYTE,this.data=$}s2.prototype={getLength:function(){return this.data.length},write:function($){for(var h=0;h<this.data.length;h++)$.put(this.data.charCodeAt(h),8)}};d2.exports=s2});var R4=K((I6,c2)=>{var C={glog:function($){if($<1)throw Error("glog("+$+")");return C.LOG_TABLE[$]},gexp:function($){while($<0)$+=255;while($>=256)$-=255;return C.EXP_TABLE[$]},EXP_TABLE:Array(256),LOG_TABLE:Array(256)};for(B=0;B<8;B++)C.EXP_TABLE[B]=1<<B;var B;for(B=8;B<256;B++)C.EXP_TABLE[B]=C.EXP_TABLE[B-4]^C.EXP_TABLE[B-5]^C.EXP_TABLE[B-6]^C.EXP_TABLE[B-8];var B;for(B=0;B<255;B++)C.LOG_TABLE[C.EXP_TABLE[B]]=B;var B;c2.exports=C});var P4=K((F6,l2)=>{var h1=R4();function l1($,h){if($.length===void 0)throw Error($.length+"/"+h);var M=0;while(M<$.length&&$[M]===0)M++;this.num=Array($.length-M+h);for(var G=0;G<$.length-M;G++)this.num[G]=$[G+M]}l1.prototype={get:function($){return this.num[$]},getLength:function(){return this.num.length},multiply:function($){var h=Array(this.getLength()+$.getLength()-1);for(var M=0;M<this.getLength();M++)for(var G=0;G<$.getLength();G++)h[M+G]^=h1.gexp(h1.glog(this.get(M))+h1.glog($.get(G)));return new l1(h,0)},mod:function($){if(this.getLength()-$.getLength()<0)return this;var h=h1.glog(this.get(0))-h1.glog($.get(0)),M=Array(this.getLength());for(var G=0;G<this.getLength();G++)M[G]=this.get(G);for(var b=0;b<$.getLength();b++)M[b]^=h1.gexp(h1.glog($.get(b))+h);return new l1(M,0).mod($)}};l2.exports=l1});var D2=K((C6,a2)=>{a2.exports={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7}});var t2=K((p6,o2)=>{var k=_4(),n2=P4(),t0=R4(),n=D2(),f={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function($){var h=$<<10;while(f.getBCHDigit(h)-f.getBCHDigit(f.G15)>=0)h^=f.G15<<f.getBCHDigit(h)-f.getBCHDigit(f.G15);return($<<10|h)^f.G15_MASK},getBCHTypeNumber:function($){var h=$<<12;while(f.getBCHDigit(h)-f.getBCHDigit(f.G18)>=0)h^=f.G18<<f.getBCHDigit(h)-f.getBCHDigit(f.G18);return $<<12|h},getBCHDigit:function($){var h=0;while($!==0)h++,$>>>=1;return h},getPatternPosition:function($){return f.PATTERN_POSITION_TABLE[$-1]},getMask:function($,h,M){switch($){case n.PATTERN000:return(h+M)%2===0;case n.PATTERN001:return h%2===0;case n.PATTERN010:return M%3===0;case n.PATTERN011:return(h+M)%3===0;case n.PATTERN100:return(Math.floor(h/2)+Math.floor(M/3))%2===0;case n.PATTERN101:return h*M%2+h*M%3===0;case n.PATTERN110:return(h*M%2+h*M%3)%2===0;case n.PATTERN111:return(h*M%3+(h+M)%2)%2===0;default:throw Error("bad maskPattern:"+$)}},getErrorCorrectPolynomial:function($){var h=new n2([1],0);for(var M=0;M<$;M++)h=h.multiply(new n2([1,t0.gexp(M)],0));return h},getLengthInBits:function($,h){if(1<=h&&h<10)switch($){case k.MODE_NUMBER:return 10;case k.MODE_ALPHA_NUM:return 9;case k.MODE_8BIT_BYTE:return 8;case k.MODE_KANJI:return 8;default:throw Error("mode:"+$)}else if(h<27)switch($){case k.MODE_NUMBER:return 12;case k.MODE_ALPHA_NUM:return 11;case k.MODE_8BIT_BYTE:return 16;case k.MODE_KANJI:return 10;default:throw Error("mode:"+$)}else if(h<41)switch($){case k.MODE_NUMBER:return 14;case k.MODE_ALPHA_NUM:return 13;case k.MODE_8BIT_BYTE:return 16;case k.MODE_KANJI:return 12;default:throw Error("mode:"+$)}else throw Error("type:"+h)},getLostPoint:function($){var h=$.getModuleCount(),M=0,G=0,b=0;for(G=0;G<h;G++)for(b=0;b<h;b++){var g=0,v=$.isDark(G,b);for(var Z=-1;Z<=1;Z++){if(G+Z<0||h<=G+Z)continue;for(var J=-1;J<=1;J++){if(b+J<0||h<=b+J)continue;if(Z===0&&J===0)continue;if(v===$.isDark(G+Z,b+J))g++}}if(g>5)M+=3+g-5}for(G=0;G<h-1;G++)for(b=0;b<h-1;b++){var z=0;if($.isDark(G,b))z++;if($.isDark(G+1,b))z++;if($.isDark(G,b+1))z++;if($.isDark(G+1,b+1))z++;if(z===0||z===4)M+=3}for(G=0;G<h;G++)for(b=0;b<h-6;b++)if($.isDark(G,b)&&!$.isDark(G,b+1)&&$.isDark(G,b+2)&&$.isDark(G,b+3)&&$.isDark(G,b+4)&&!$.isDark(G,b+5)&&$.isDark(G,b+6))M+=40;for(b=0;b<h;b++)for(G=0;G<h-6;G++)if($.isDark(G,b)&&!$.isDark(G+1,b)&&$.isDark(G+2,b)&&$.isDark(G+3,b)&&$.isDark(G+4,b)&&!$.isDark(G+5,b)&&$.isDark(G+6,b))M+=40;var Y=0;for(b=0;b<h;b++)for(G=0;G<h;G++)if($.isDark(G,b))Y++;var x=Math.abs(100*Y/h/h-50)/5;return M+=x*10,M}};o2.exports=f});var I4=K((u6,e2)=>{e2.exports={L:1,M:0,Q:3,H:2}});var h5=K((r6,$5)=>{var a1=I4();function s($,h){this.totalCount=$,this.dataCount=h}s.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];s.getRSBlocks=function($,h){var M=s.getRsBlockTable($,h);if(M===void 0)throw Error("bad rs block @ typeNumber:"+$+"/errorCorrectLevel:"+h);var G=M.length/3,b=[];for(var g=0;g<G;g++){var v=M[g*3+0],Z=M[g*3+1],J=M[g*3+2];for(var z=0;z<v;z++)b.push(new s(Z,J))}return b};s.getRsBlockTable=function($,h){switch(h){case a1.L:return s.RS_BLOCK_TABLE[($-1)*4+0];case a1.M:return s.RS_BLOCK_TABLE[($-1)*4+1];case a1.Q:return s.RS_BLOCK_TABLE[($-1)*4+2];case a1.H:return s.RS_BLOCK_TABLE[($-1)*4+3];default:return}};$5.exports=s});var G5=K((s6,M5)=>{function v5(){this.buffer=[],this.length=0}v5.prototype={get:function($){var h=Math.floor($/8);return(this.buffer[h]>>>7-$%8&1)==1},put:function($,h){for(var M=0;M<h;M++)this.putBit(($>>>h-M-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function($){var h=Math.floor(this.length/8);if(this.buffer.length<=h)this.buffer.push(0);if($)this.buffer[h]|=128>>>this.length%8;this.length++}};M5.exports=v5});var J5=K((d6,Z5)=>{var e0=i2(),o=t2(),$$=P4(),b5=h5(),g5=G5();function d($,h){this.typeNumber=$,this.errorCorrectLevel=h,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}d.prototype={addData:function($){var h=new e0($);this.dataList.push(h),this.dataCache=null},isDark:function($,h){if($<0||this.moduleCount<=$||h<0||this.moduleCount<=h)throw Error($+","+h);return this.modules[$][h]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var $=1;for($=1;$<40;$++){var h=b5.getRSBlocks($,this.errorCorrectLevel),M=new g5,G=0;for(var b=0;b<h.length;b++)G+=h[b].dataCount;for(var g=0;g<this.dataList.length;g++){var v=this.dataList[g];M.put(v.mode,4),M.put(v.getLength(),o.getLengthInBits(v.mode,$)),v.write(M)}if(M.getLengthInBits()<=G*8)break}this.typeNumber=$}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function($,h){this.moduleCount=this.typeNumber*4+17,this.modules=Array(this.moduleCount);for(var M=0;M<this.moduleCount;M++){this.modules[M]=Array(this.moduleCount);for(var G=0;G<this.moduleCount;G++)this.modules[M][G]=null}if(this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo($,h),this.typeNumber>=7)this.setupTypeNumber($);if(this.dataCache===null)this.dataCache=d.createData(this.typeNumber,this.errorCorrectLevel,this.dataList);this.mapData(this.dataCache,h)},setupPositionProbePattern:function($,h){for(var M=-1;M<=7;M++){if($+M<=-1||this.moduleCount<=$+M)continue;for(var G=-1;G<=7;G++){if(h+G<=-1||this.moduleCount<=h+G)continue;if(0<=M&&M<=6&&(G===0||G===6)||0<=G&&G<=6&&(M===0||M===6)||2<=M&&M<=4&&2<=G&&G<=4)this.modules[$+M][h+G]=!0;else this.modules[$+M][h+G]=!1}}},getBestMaskPattern:function(){var $=0,h=0;for(var M=0;M<8;M++){this.makeImpl(!0,M);var G=o.getLostPoint(this);if(M===0||$>G)$=G,h=M}return h},createMovieClip:function($,h,M){var G=$.createEmptyMovieClip(h,M),b=1;this.make();for(var g=0;g<this.modules.length;g++){var v=g*b;for(var Z=0;Z<this.modules[g].length;Z++){var J=Z*b,z=this.modules[g][Z];if(z)G.beginFill(0,100),G.moveTo(J,v),G.lineTo(J+b,v),G.lineTo(J+b,v+b),G.lineTo(J,v+b),G.endFill()}}return G},setupTimingPattern:function(){for(var $=8;$<this.moduleCount-8;$++){if(this.modules[$][6]!==null)continue;this.modules[$][6]=$%2===0}for(var h=8;h<this.moduleCount-8;h++){if(this.modules[6][h]!==null)continue;this.modules[6][h]=h%2===0}},setupPositionAdjustPattern:function(){var $=o.getPatternPosition(this.typeNumber);for(var h=0;h<$.length;h++)for(var M=0;M<$.length;M++){var G=$[h],b=$[M];if(this.modules[G][b]!==null)continue;for(var g=-2;g<=2;g++)for(var v=-2;v<=2;v++)if(Math.abs(g)===2||Math.abs(v)===2||g===0&&v===0)this.modules[G+g][b+v]=!0;else this.modules[G+g][b+v]=!1}},setupTypeNumber:function($){var h=o.getBCHTypeNumber(this.typeNumber),M;for(var G=0;G<18;G++)M=!$&&(h>>G&1)===1,this.modules[Math.floor(G/3)][G%3+this.moduleCount-8-3]=M;for(var b=0;b<18;b++)M=!$&&(h>>b&1)===1,this.modules[b%3+this.moduleCount-8-3][Math.floor(b/3)]=M},setupTypeInfo:function($,h){var M=this.errorCorrectLevel<<3|h,G=o.getBCHTypeInfo(M),b;for(var g=0;g<15;g++)if(b=!$&&(G>>g&1)===1,g<6)this.modules[g][8]=b;else if(g<8)this.modules[g+1][8]=b;else this.modules[this.moduleCount-15+g][8]=b;for(var v=0;v<15;v++)if(b=!$&&(G>>v&1)===1,v<8)this.modules[8][this.moduleCount-v-1]=b;else if(v<9)this.modules[8][15-v-1+1]=b;else this.modules[8][15-v-1]=b;this.modules[this.moduleCount-8][8]=!$},mapData:function($,h){var M=-1,G=this.moduleCount-1,b=7,g=0;for(var v=this.moduleCount-1;v>0;v-=2){if(v===6)v--;while(!0){for(var Z=0;Z<2;Z++)if(this.modules[G][v-Z]===null){var J=!1;if(g<$.length)J=($[g]>>>b&1)===1;var z=o.getMask(h,G,v-Z);if(z)J=!J;if(this.modules[G][v-Z]=J,b--,b===-1)g++,b=7}if(G+=M,G<0||this.moduleCount<=G){G-=M,M=-M;break}}}}};d.PAD0=236;d.PAD1=17;d.createData=function($,h,M){var G=b5.getRSBlocks($,h),b=new g5;for(var g=0;g<M.length;g++){var v=M[g];b.put(v.mode,4),b.put(v.getLength(),o.getLengthInBits(v.mode,$)),v.write(b)}var Z=0;for(var J=0;J<G.length;J++)Z+=G[J].dataCount;if(b.getLengthInBits()>Z*8)throw Error("code length overflow. ("+b.getLengthInBits()+">"+Z*8+")");if(b.getLengthInBits()+4<=Z*8)b.put(0,4);while(b.getLengthInBits()%8!==0)b.putBit(!1);while(!0){if(b.getLengthInBits()>=Z*8)break;if(b.put(d.PAD0,8),b.getLengthInBits()>=Z*8)break;b.put(d.PAD1,8)}return d.createBytes(b,G)};d.createBytes=function($,h){var M=0,G=0,b=0,g=Array(h.length),v=Array(h.length);for(var Z=0;Z<h.length;Z++){var J=h[Z].dataCount,z=h[Z].totalCount-J;G=Math.max(G,J),b=Math.max(b,z),g[Z]=Array(J);for(var Y=0;Y<g[Z].length;Y++)g[Z][Y]=255&$.buffer[Y+M];M+=J;var x=o.getErrorCorrectPolynomial(z),q=new $$(g[Z],x.getLength()-1),S=q.mod(x);v[Z]=Array(x.getLength()-1);for(var E=0;E<v[Z].length;E++){var T=E+S.getLength()-v[Z].length;v[Z][E]=T>=0?S.get(T):0}}var e=0;for(var W1=0;W1<h.length;W1++)e+=h[W1].totalCount;var Q1=Array(e),G1=0;for(var E1=0;E1<G;E1++)for(var q1=0;q1<h.length;q1++)if(E1<g[q1].length)Q1[G1++]=g[q1][E1];for(var b1=0;b1<b;b1++)for(var j1=0;j1<h.length;j1++)if(b1<v[j1].length)Q1[G1++]=v[j1][b1];return Q1};Z5.exports=d});var Y5=K((i6,z5)=>{var h$=J5(),X5=I4(),v$="\x1B[40m \x1B[0m",D1="\x1B[47m \x1B[0m",M$=function($){return $?v$:D1},F4=function($){return{times:function(h){return Array(h).join($)}}},G$=function($,h){var M=Array($);for(var G=0;G<$;G++)M[G]=h;return M};z5.exports={error:X5.L,generate:function($,h,M){if(typeof h==="function")M=h,h={};var G=new h$(-1,this.error);G.addData($),G.make();var b="";if(h&&h.small){var g=!0,v=!1,Z=G.getModuleCount(),J=G.modules.slice(),z=Z%2===1;if(z)J.push(G$(Z,v));var Y={WHITE_ALL:"\u2588",WHITE_BLACK:"\u2580",BLACK_WHITE:"\u2584",BLACK_ALL:" "},x=F4(Y.BLACK_WHITE).times(Z+3),q=F4(Y.WHITE_BLACK).times(Z+3);b+=x+`
41
- `;for(var S=0;S<Z;S+=2){b+=Y.WHITE_ALL;for(var E=0;E<Z;E++)if(J[S][E]===v&&J[S+1][E]===v)b+=Y.WHITE_ALL;else if(J[S][E]===v&&J[S+1][E]===g)b+=Y.WHITE_BLACK;else if(J[S][E]===g&&J[S+1][E]===v)b+=Y.BLACK_WHITE;else b+=Y.BLACK_ALL;b+=Y.WHITE_ALL+`
42
- `}if(!z)b+=q}else{var T=F4(D1).times(G.getModuleCount()+3);b+=T+`
43
- `,G.modules.forEach(function(e){b+=D1,b+=e.map(M$).join(""),b+=D1+`
44
- `}),b+=T}if(M)M(b);else console.log(b)},setErrorLevel:function($){this.error=X5[$]||this.error}}});class C4{process=null;dataCallback=null;exitCallback=null;_cols=80;_rows=24;_isPTY=!1;get cols(){return this._cols}get rows(){return this._rows}get isRunning(){return this.process!==null}get isPTY(){return this._isPTY}async spawn($,h=[],M={}){if(this.process)throw Error("Process already running");this._cols=M.cols??80,this._rows=M.rows??24;let G={...process.env,...M.env,TERM:"xterm-256color",COLORTERM:"truecolor",FORCE_COLOR:"3",COLUMNS:String(this._cols),LINES:String(this._rows),PAGER:"",GIT_PAGER:""},b=new TextDecoder;if(Q5){this._isPTY=!1;let g=Bun.spawn([$,...h],{cwd:M.cwd??process.cwd(),env:G,stdin:"pipe",stdout:"pipe",stderr:"pipe"});this.process=g,this.readStream(g.stdout,b),this.readStream(g.stderr,b),g.exited.then((v)=>{this.exitCallback?.(v,void 0),this.process=null})}else{this._isPTY=!0;let g=Bun.spawn([$,...h],{cwd:M.cwd??process.cwd(),env:G,terminal:{cols:this._cols,rows:this._rows,data:(v,Z)=>{let J=b.decode(Z,{stream:!0});this.dataCallback?.(J)}}});this.process=g,g.exited.then((v)=>{if(this.exitCallback?.(v,void 0),this.process?.terminal)this.process.terminal.close();this.process=null})}}async readStream($,h){let M=$.getReader();try{while(!0){let{done:G,value:b}=await M.read();if(G)break;if(b){let g=h.decode(b,{stream:!0});this.dataCallback?.(g)}}}catch{}}write($){if(!this.process)throw Error("No process running");if(this._isPTY)this.process.terminal.write($);else{let h=new TextEncoder;this.process.stdin.write(h.encode($))}}resize($,h){if(this._cols=$,this._rows=h,this._isPTY&&this.process?.terminal)this.process.terminal.resize($,h)}onData($){this.dataCallback=$}onExit($){this.exitCallback=$}kill($){if(this.process){if(this._isPTY&&this.process.terminal)this.process.terminal.close();this.process.kill(),this.process=null}}get pid(){return this.process?.pid}}function O1(){return new C4}function b$(){return!Q5}var Q5;var n1=m(()=>{Q5=process.platform==="win32"});async function X1(){if(o1)return o1;let $=[g$,Z$,J$];for(let h of $)try{let M=await Promise.race([h(),new Promise((G,b)=>setTimeout(()=>b(Error("timeout")),3000))]);if(M)return o1=M,M}catch{}return o1="cn","cn"}async function g$(){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 Z$(){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 J$(){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 X$(){let $=await X1();return p4[$]}async function v1(){return(await X$()).npm}async function u4(){if(await X1()==="cn")return`curl -fsSL https://bun.sh/install | BUN_INSTALL_MIRROR="${p4.cn.bunMirror}" bash`;return"curl -fsSL https://bun.sh/install | bash"}async function E5(){let $=await X1(),h=p4[$];if($==="cn")Q.info(X("region.usingChinaMirror")),Q.message(` npm: ${h.npm}`);else Q.info(X("region.usingGlobalMirror"))}var o1=null,p4;var r4=m(()=>{r();N();p4={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}}});import{join as s4}from"path";function z$($){return $.startsWith(_)}function Y$($,h){let M=$.split(".").map(Number),G=h.split(".").map(Number),b=Math.max(M.length,G.length);for(let g=0;g<b;g++){let v=M[g]||0,Z=G[g]||0;if(v<Z)return-1;if(v>Z)return 1}return 0}async function d4(){try{if(!await Bun.file(w).exists())return null;let h=Bun.spawn([w,"--version"],{stdout:"pipe",stderr:"pipe"});if(await h.exited,h.exitCode!==0)return null;return(await new Response(h.stdout).text()).trim()}catch{return null}}async function B5(){return await d4()!==null}async function x$(){if(process.platform==="win32")return!0;try{let h=Bun.spawn(["which","unzip"],{stdout:"pipe",stderr:"pipe"});if(await h.exited,h.exitCode===0)return!0}catch{}Q.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 h of $)try{let M=Bun.spawn(["bash","-c",`sudo ${h} 2>/dev/null || ${h}`],{stdout:"pipe",stderr:"pipe"});if(await M.exited,M.exitCode===0)return!0}catch{}return!1}async function W$(){let $=F();if(!await x$())return Q.error("\u8BF7\u5148\u624B\u52A8\u5B89\u88C5 unzip: apt install unzip / yum install unzip"),!1;await E5(),$.start("\u6B63\u5728\u5B89\u88C5 Tako \u4E13\u5C5E Bun \u8FD0\u884C\u65F6...");try{await(await import("fs/promises")).mkdir(_,{recursive:!0});let M;if(process.platform==="win32"){let b=await X1()==="cn"?'$env:BUN_INSTALL_MIRROR="https://registry.npmmirror.com/-/binary/bun"; ':"",g=`$env:BUN_INSTALL="${_}"; ${b}irm bun.sh/install.ps1 | iex`;M=await Bun.spawn(["powershell","-Command",g],{stdout:"inherit",stderr:"inherit"}).exited}else{let G=await u4(),b=`BUN_INSTALL="${_}" ${G}`;M=await Bun.spawn(["bash","-c",b],{stdout:"inherit",stderr:"inherit"}).exited}if(M!==0)return $.stop("Bun \u5B89\u88C5\u5931\u8D25"),!1;return t=w,$.stop("Tako \u4E13\u5C5E Bun \u5B89\u88C5\u5B8C\u6210"),Q.info(`\u5B89\u88C5\u4F4D\u7F6E: ${_}`),!0}catch(h){return $.stop("Bun \u5B89\u88C5\u5931\u8D25"),!1}}async function Q$(){let $=F();$.start("\u6B63\u5728\u5347\u7EA7 Tako \u4E13\u5C5E Bun \u8FD0\u884C\u65F6...");try{let h=await import("fs/promises");try{await h.rm(_,{recursive:!0,force:!0})}catch{}await h.mkdir(_,{recursive:!0});let M;if(process.platform==="win32"){let g=await X1()==="cn"?'$env:BUN_INSTALL_MIRROR="https://registry.npmmirror.com/-/binary/bun"; ':"",v=`$env:BUN_INSTALL="${_}"; ${g}irm bun.sh/install.ps1 | iex`;M=await Bun.spawn(["powershell","-Command",v],{stdout:"inherit",stderr:"inherit"}).exited}else{let b=await u4(),g=`BUN_INSTALL="${_}" ${b}`;M=await Bun.spawn(["bash","-c",g],{stdout:"inherit",stderr:"inherit"}).exited}if(M!==0)return $.stop("Bun \u5347\u7EA7\u5931\u8D25"),!1;t=w,$.stop("Tako \u4E13\u5C5E Bun \u5347\u7EA7\u5B8C\u6210");let G=await d4();if(G)Q.info(`\u65B0\u7248\u672C: ${G}`);return!0}catch(h){return $.stop("Bun \u5347\u7EA7\u5931\u8D25"),!1}}async function S5(){if(await B5())return t=w,!0;return Q.warn("\u672A\u68C0\u6D4B\u5230 Tako \u4E13\u5C5E Bun\uFF0C\u6B63\u5728\u81EA\u52A8\u5B89\u88C5..."),Q.info("\uFF08\u4E0D\u4F1A\u5F71\u54CD\u60A8\u7CFB\u7EDF\u4E2D\u5DF2\u5B89\u88C5\u7684 Node.js \u6216 Bun\uFF09"),await W$()}async function L5(){if(!await S5())return!1;if(process.platform==="win32")return!0;let $=await d4();if(!$)return Q.error("\u65E0\u6CD5\u83B7\u53D6 Tako Bun \u7248\u672C"),!1;if(Y$($,q5)>=0)return!0;return Q.warn(`\u5F53\u524D Tako Bun \u7248\u672C (${$}) \u4E0D\u652F\u6301\u8FDC\u7A0B\u6A21\u5F0F`),Q.info(`\u9700\u8981\u5347\u7EA7\u5230 ${q5} \u6216\u66F4\u9AD8\u7248\u672C...`),await Q$()}async function M1(){if(t){if(!z$(t))t=w;return t}if(await B5())return t=w,w;return w}async function T5($){try{let h=await v1(),M=await fetch(`${h}/${$}/latest`);if(!M.ok)return null;return(await M.json()).version}catch{return null}}async function E$($){return(await R()).installedClients[$.id]?.version||null}async function V5($){let h=$1($.id),M=s4(h,"package.json");try{return await Bun.file(M).exists()}catch{return!1}}async function f5($){let h=await E$($);if(!h)return!0;let M=await T5($.package);if(!M)return!1;return h!==M}async function H5($,h=!1){let M=F(),G=$1($.id);try{if(!await S5())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 b=await V5($),g=h||await f5($);if(b&&!g)return{success:!0};let v=b?"\u66F4\u65B0":"\u5B89\u88C5";M.start(`\u6B63\u5728${v} ${$.name}...`);let Z=await import("fs/promises");await Z.mkdir(G,{recursive:!0});let J=s4(G,"package.json");if(!await Bun.file(J).exists())await Bun.write(J,JSON.stringify({name:`tako-${$.id}`,private:!0,dependencies:{}},null,2));let Y=await M1(),x=await v1();if(b){let T=s4(G,"bun.lock");try{await Z.unlink(T)}catch{}}let q=Bun.spawn([Y,"add",`${$.package}@latest`],{cwd:G,stdout:"pipe",stderr:"pipe",env:{...process.env,BUN_CONFIG_REGISTRY:x}});if(await q.exited!==0){let T=await new Response(q.stderr).text();return M.stop(`${v} ${$.name} \u5931\u8D25`),{success:!1,error:T}}let E=await T5($.package);if(E){let T=await R();T.installedClients[$.id]={version:E,installedAt:new Date().toISOString()},await k1(T)}return M.stop(`${$.name} ${v}\u5B8C\u6210`),{success:!0}}catch(b){return M.stop("\u64CD\u4F5C\u5931\u8D25"),{success:!1,error:b instanceof Error?b.message:"\u672A\u77E5\u9519\u8BEF"}}}async function m1($){if(!await V5($))return await H5($);if(await f5($))return await H5($,!0);return{success:!0}}var t=null,q5="1.3.5";var K1=m(()=>{r();l();U();r4()});import{homedir as q$}from"os";function O5($,h=Date.now()){let M=h-new Date($.lastLaunchedAt).getTime(),G=Math.pow(0.5,M/w5),b=Math.log10($.launchCount+1);return G*0.6+b*0.4}async function z1($){try{return(await(await import("fs/promises")).stat($)).isDirectory()}catch{return!1}}async function N1($,h){let M=await R(),G=M.recentProjects||[],b=new Date().toISOString(),g=G.findIndex((J)=>J.path===$);if(g>=0){let J=G[g],z=J.clientUsage||{},Y=z[h]||{count:0,lastAt:b};G[g]={...J,launchCount:J.launchCount+1,lastLaunchedAt:b,lastClientId:h,clientUsage:{...z,[h]:{count:Y.count+1,lastAt:b}}}}else G.push({path:$,launchCount:1,lastLaunchedAt:b,lastClientId:h,clientUsage:{[h]:{count:1,lastAt:b}}});let v=Date.now(),Z=G.map((J)=>({...J,score:O5(J,v)})).sort((J,z)=>z.score-J.score).slice(0,H$).map(({score:J,...z})=>z);M.recentProjects=Z,await M4(M)}function B$($,h,M=Date.now()){let G=$.clientUsage?.[h];if(G){let b=M-new Date(G.lastAt).getTime(),g=Math.pow(0.5,b/w5),v=Math.log10(G.count+1);return g*0.6+v*0.4}else if($.lastClientId===h)return O5($,M);return 0}async function m5($,h=i4,M=!0){let b=(await R()).recentProjects||[],g=process.cwd(),v=b.filter((Y)=>{if(M&&Y.path===g)return!1;return Y.clientUsage?.[$]||Y.lastClientId===$}),Z=Date.now(),J=v.map((Y)=>({...Y,score:B$(Y,$,Z)})).sort((Y,x)=>x.score-Y.score),z=[];for(let{score:Y,...x}of J){if(z.length>=h)break;if(await z1(x.path))z.push(x)}return z}async function K5(){let h=(await R()).recentProjects||[],M=process.cwd();return h.find((b)=>b.path===M)?.lastClientId||null}function N5($,h=25){let M=q$(),G=$.startsWith(M)?"~"+$.slice(M.length):$;if(G.length>h){let g=G.split("/").pop()||"";if(g.length>h-4)G="..."+g.slice(-h+3);else G=`.../${g}`}return G}function j5($){let{t:h}=(N(),d5(u2)),M=Date.now(),G=new Date($).getTime(),b=M-G,g=Math.floor(b/60000),v=Math.floor(b/3600000),Z=Math.floor(b/86400000),J=Math.floor(Z/7),z=Math.floor(Z/30);if(g<1)return h("time.justNow");if(g<60)return h("time.minutesAgo",{n:g});if(v<24)return h("time.hoursAgo",{n:v});if(Z===1)return h("time.yesterday");if(Z<7)return h("time.daysAgo",{n:Z});if(Z<30)return h("time.weeksAgo",{n:J});return h("time.monthsAgo",{n:z})}var H$=50,i4=3,w5=604800000;var t1=m(()=>{U()});function S$($){return $.startsWith("cr_")&&$.length>10}async function c4($){try{let M=await(await fetch(`${c}/apiStats/api/get-key-id`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:$})})).json();if(M.success&&M.data?.id)return{valid:!0,apiId:M.data.id};return{valid:!1,error:M.error||X("auth.validationFailed")}}catch(h){return{valid:!1,error:h instanceof Error?h.message:X("auth.networkError")}}}async function k5($){if(!S$($))return{success:!1,error:X("auth.invalidFormat")};let h=await c4($);if(!h.valid)return{success:!1,error:h.error};return await k1({apiKey:$,apiId:h.apiId}),{success:!0}}var l4=m(()=>{U();N()});var y5={};h4(y5,{startRemoteSession:()=>L$,serializeMessage:()=>O4,parseMessage:()=>w4,isValidSessionCode:()=>d0,isPTYSupported:()=>b$,generateSessionCode:()=>V1,createWSClient:()=>U1,createResizeMessage:()=>r0,createRegisterMessage:()=>f4,createPingMessage:()=>p0,createPTYHost:()=>O1,createOutputMessage:()=>A4,createInputMessage:()=>u0,createExitMessage:()=>U4,buildRemoteUrl:()=>f1,buildClientWebSocketUrl:()=>s0,buildCLIWebSocketUrl:()=>N4,RemoteWSClient:()=>j4,PTYHost:()=>C4});async function L$($,h={}){let M=await P();if(!M)throw Error("API key not configured");if(!S1){if(!await L5())throw Error("Tako Bun \u7248\u672C\u4E0D\u652F\u6301\u8FDC\u7A0B\u6A21\u5F0F\uFF0C\u5347\u7EA7\u5931\u8D25")}let G=V1(),b=f1(G),g=O1(),v=U1(),Z=!1;await v.connect(G,M,{onInput:(E)=>{if(g.isRunning)g.write(E)},onResize:(E,T)=>{g.resize(E,T)},onClientConnected:()=>{Z=!0},onClientDisconnected:()=>{Z=!1},onError:(E)=>{console.error("[Remote] WebSocket error:",E.message)},onDisconnect:()=>{if(console.log("[Remote] Connection lost permanently, terminating PTY..."),g.isRunning)g.kill()},onReconnecting:(E)=>{console.log(`[Remote] Reconnecting to server (attempt ${E})...`)},onReconnected:()=>{console.log("[Remote] Reconnected to server successfully")}}),g.onData((E)=>{v.sendOutput(E)}),g.onExit((E)=>{v.sendExit(E),v.disconnect()});let J=await Z1($),z=$1($.id),Y;if(S1)Y="bun";else Y=await M1();let x=[J];if(h.projectPath)x.push(h.projectPath);if(h.additionalArgs)x.push(...h.additionalArgs);let q=$.getEnvVars(M);return await g.spawn(Y,x,{cols:h.cols??80,rows:h.rows??24,cwd:h.projectPath??process.cwd(),env:{...process.env,...q,TERM:"xterm-256color",COLORTERM:"truecolor",FORCE_COLOR:"1"}}),{sessionCode:G,remoteUrl:b,ptyHost:g,wsClient:v,stop:()=>{g.kill(),v.disconnect()}}}var _5=m(()=>{n1();s1();A1();U();l();K1();A1();n1();s1()});var R5={};h4(R5,{launchClientRemote:()=>V$,launchClient:()=>T$});async function T$($,h){try{let M=h?.projectPath||process.cwd();if(h?.projectPath){if(!await z1(h.projectPath))return{success:!1,error:`\u76EE\u5F55\u4E0D\u5B58\u5728: ${h.projectPath}`}}let G=await m1($);if(!G.success)return G;let b=await P();if(!b)return{success:!1,error:"\u672A\u914D\u7F6E API Key"};if($.setupConfigFiles)await $.setupConfigFiles(b);let g=await Z1($);if(!g)g=_1($);if(!await Bun.file(g).exists())return{success:!1,error:`\u627E\u4E0D\u5230\u53EF\u6267\u884C\u6587\u4EF6: ${g}`};await N1(M,$.id);let Z=$.getEnvVars(b),J={...process.env,...Z};Q.info(`\u542F\u52A8 ${$.name}...`);let z;if($.runtime==="native")z=[g];else z=[await M1(),g];if(h?.args&&h.args.length>0)z=[...z,...h.args];return await Bun.spawn(z,{env:J,stdio:["inherit","inherit","inherit"],cwd:M}).exited,{success:!0}}catch(M){return{success:!1,error:M instanceof Error?M.message:"\u542F\u52A8\u5931\u8D25"}}}async function V$($,h){try{let M=h?.projectPath||process.cwd();if(h?.projectPath){if(!await z1(h.projectPath))return{success:!1,error:`\u76EE\u5F55\u4E0D\u5B58\u5728: ${h.projectPath}`}}let G=await m1($);if(!G.success)return G;let b=await P();if(!b)return{success:!1,error:"\u672A\u914D\u7F6E API Key"};let g=await c4(b);if(!g.valid)return{success:!1,error:`API Key \u65E0\u6548: ${g.error}`};if($.setupConfigFiles)await $.setupConfigFiles(b);await N1(M,$.id);let{startRemoteSession:v}=await Promise.resolve().then(() => (_5(),y5));return{success:!0,session:await v($,{projectPath:M,additionalArgs:h?.args,cols:h?.cols??80,rows:h?.rows??24})}}catch(M){return{success:!1,error:M instanceof Error?M.message:"\u8FDC\u7A0B\u542F\u52A8\u5931\u8D25"}}}var P5=m(()=>{l();U();K1();t1();l4();r()});l();U();var c5={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:$}}};R1(c5);l();U();import{homedir as l5}from"os";import{join as Z4}from"path";var J4=Z4(l5(),".codex"),a5=Z4(J4,"config.toml"),D5=Z4(J4,"auth.json"),n5=`model_provider = "crs"
40
+ \u6B63\u5728\u8FD4\u56DE\u672C\u5730\u6A21\u5F0F...`},connectionLost:{en:"Remote connection lost, returning to local mode...",zh:"\u8FDC\u7A0B\u8FDE\u63A5\u65AD\u5F00\uFF0C\u6B63\u5728\u8FD4\u56DE\u672C\u5730\u6A21\u5F0F..."},modeTitle:{en:"========== Remote Control Mode ==========",zh:"========== \u8FDC\u7A0B\u63A7\u5236\u6A21\u5F0F =========="},sessionCode:{en:"Session Code:",zh:"\u4F1A\u8BDD\u4EE3\u7801\uFF1A"},remoteUrl:{en:"Remote URL:",zh:"\u8FDC\u7A0B\u5730\u5740\uFF1A"},status:{en:"Status:",zh:"\u72B6\u6001\uFF1A"},waitingForConnection:{en:"Waiting for connection...",zh:"\u7B49\u5F85\u8FDE\u63A5..."},clientConnected:{en:"{count} client(s) connected",zh:"{count} \u4E2A\u5BA2\u6237\u7AEF\u5DF2\u8FDE\u63A5"},returnHint:{en:"Press Ctrl+\\ to return to local mode",zh:"\u6309 Ctrl+\\ \u8FD4\u56DE\u672C\u5730\u6A21\u5F0F"},devMode:{en:"[DEV MODE]",zh:"[\u5F00\u53D1\u6A21\u5F0F]"}},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"}},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"}}}});var I4=j((c6,i2)=>{i2.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}});var t2=j((d6,e2)=>{var X$=I4();function o2($){this.mode=X$.MODE_8BIT_BYTE,this.data=$}o2.prototype={getLength:function(){return this.data.length},write:function($){for(var v=0;v<this.data.length;v++)$.put(this.data.charCodeAt(v),8)}};e2.exports=o2});var F4=j((a6,$5)=>{var u={glog:function($){if($<1)throw Error("glog("+$+")");return u.LOG_TABLE[$]},gexp:function($){while($<0)$+=255;while($>=256)$-=255;return u.EXP_TABLE[$]},EXP_TABLE:Array(256),LOG_TABLE:Array(256)};for(S=0;S<8;S++)u.EXP_TABLE[S]=1<<S;var S;for(S=8;S<256;S++)u.EXP_TABLE[S]=u.EXP_TABLE[S-4]^u.EXP_TABLE[S-5]^u.EXP_TABLE[S-6]^u.EXP_TABLE[S-8];var S;for(S=0;S<255;S++)u.LOG_TABLE[u.EXP_TABLE[S]]=S;var S;$5.exports=u});var C4=j((i6,v5)=>{var M1=F4();function a1($,v){if($.length===void 0)throw Error($.length+"/"+v);var G=0;while(G<$.length&&$[G]===0)G++;this.num=Array($.length-G+v);for(var b=0;b<$.length-G;b++)this.num[b]=$[b+G]}a1.prototype={get:function($){return this.num[$]},getLength:function(){return this.num.length},multiply:function($){var v=Array(this.getLength()+$.getLength()-1);for(var G=0;G<this.getLength();G++)for(var b=0;b<$.getLength();b++)v[G+b]^=M1.gexp(M1.glog(this.get(G))+M1.glog($.get(b)));return new a1(v,0)},mod:function($){if(this.getLength()-$.getLength()<0)return this;var v=M1.glog(this.get(0))-M1.glog($.get(0)),G=Array(this.getLength());for(var b=0;b<this.getLength();b++)G[b]=this.get(b);for(var Z=0;Z<$.getLength();Z++)G[Z]^=M1.gexp(M1.glog($.get(Z))+v);return new a1(G,0).mod($)}};v5.exports=a1});var G5=j((o6,M5)=>{M5.exports={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7}});var J5=j((e6,Z5)=>{var _=I4(),b5=C4(),z$=F4(),e=G5(),U={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function($){var v=$<<10;while(U.getBCHDigit(v)-U.getBCHDigit(U.G15)>=0)v^=U.G15<<U.getBCHDigit(v)-U.getBCHDigit(U.G15);return($<<10|v)^U.G15_MASK},getBCHTypeNumber:function($){var v=$<<12;while(U.getBCHDigit(v)-U.getBCHDigit(U.G18)>=0)v^=U.G18<<U.getBCHDigit(v)-U.getBCHDigit(U.G18);return $<<12|v},getBCHDigit:function($){var v=0;while($!==0)v++,$>>>=1;return v},getPatternPosition:function($){return U.PATTERN_POSITION_TABLE[$-1]},getMask:function($,v,G){switch($){case e.PATTERN000:return(v+G)%2===0;case e.PATTERN001:return v%2===0;case e.PATTERN010:return G%3===0;case e.PATTERN011:return(v+G)%3===0;case e.PATTERN100:return(Math.floor(v/2)+Math.floor(G/3))%2===0;case e.PATTERN101:return v*G%2+v*G%3===0;case e.PATTERN110:return(v*G%2+v*G%3)%2===0;case e.PATTERN111:return(v*G%3+(v+G)%2)%2===0;default:throw Error("bad maskPattern:"+$)}},getErrorCorrectPolynomial:function($){var v=new b5([1],0);for(var G=0;G<$;G++)v=v.multiply(new b5([1,z$.gexp(G)],0));return v},getLengthInBits:function($,v){if(1<=v&&v<10)switch($){case _.MODE_NUMBER:return 10;case _.MODE_ALPHA_NUM:return 9;case _.MODE_8BIT_BYTE:return 8;case _.MODE_KANJI:return 8;default:throw Error("mode:"+$)}else if(v<27)switch($){case _.MODE_NUMBER:return 12;case _.MODE_ALPHA_NUM:return 11;case _.MODE_8BIT_BYTE:return 16;case _.MODE_KANJI:return 10;default:throw Error("mode:"+$)}else if(v<41)switch($){case _.MODE_NUMBER:return 14;case _.MODE_ALPHA_NUM:return 13;case _.MODE_8BIT_BYTE:return 16;case _.MODE_KANJI:return 12;default:throw Error("mode:"+$)}else throw Error("type:"+v)},getLostPoint:function($){var v=$.getModuleCount(),G=0,b=0,Z=0;for(b=0;b<v;b++)for(Z=0;Z<v;Z++){var J=0,M=$.isDark(b,Z);for(var X=-1;X<=1;X++){if(b+X<0||v<=b+X)continue;for(var z=-1;z<=1;z++){if(Z+z<0||v<=Z+z)continue;if(X===0&&z===0)continue;if(M===$.isDark(b+X,Z+z))J++}}if(J>5)G+=3+J-5}for(b=0;b<v-1;b++)for(Z=0;Z<v-1;Z++){var x=0;if($.isDark(b,Z))x++;if($.isDark(b+1,Z))x++;if($.isDark(b,Z+1))x++;if($.isDark(b+1,Z+1))x++;if(x===0||x===4)G+=3}for(b=0;b<v;b++)for(Z=0;Z<v-6;Z++)if($.isDark(b,Z)&&!$.isDark(b,Z+1)&&$.isDark(b,Z+2)&&$.isDark(b,Z+3)&&$.isDark(b,Z+4)&&!$.isDark(b,Z+5)&&$.isDark(b,Z+6))G+=40;for(Z=0;Z<v;Z++)for(b=0;b<v-6;b++)if($.isDark(b,Z)&&!$.isDark(b+1,Z)&&$.isDark(b+2,Z)&&$.isDark(b+3,Z)&&$.isDark(b+4,Z)&&!$.isDark(b+5,Z)&&$.isDark(b+6,Z))G+=40;var Q=0;for(Z=0;Z<v;Z++)for(b=0;b<v;b++)if($.isDark(b,Z))Q++;var g=Math.abs(100*Q/v/v-50)/5;return G+=g*10,G}};Z5.exports=U});var u4=j((t6,X5)=>{X5.exports={L:1,M:0,Q:3,H:2}});var Y5=j(($3,z5)=>{var i1=u4();function D($,v){this.totalCount=$,this.dataCount=v}D.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];D.getRSBlocks=function($,v){var G=D.getRsBlockTable($,v);if(G===void 0)throw Error("bad rs block @ typeNumber:"+$+"/errorCorrectLevel:"+v);var b=G.length/3,Z=[];for(var J=0;J<b;J++){var M=G[J*3+0],X=G[J*3+1],z=G[J*3+2];for(var x=0;x<M;x++)Z.push(new D(X,z))}return Z};D.getRsBlockTable=function($,v){switch(v){case i1.L:return D.RS_BLOCK_TABLE[($-1)*4+0];case i1.M:return D.RS_BLOCK_TABLE[($-1)*4+1];case i1.Q:return D.RS_BLOCK_TABLE[($-1)*4+2];case i1.H:return D.RS_BLOCK_TABLE[($-1)*4+3];default:return}};z5.exports=D});var g5=j((v3,Q5)=>{function x5(){this.buffer=[],this.length=0}x5.prototype={get:function($){var v=Math.floor($/8);return(this.buffer[v]>>>7-$%8&1)==1},put:function($,v){for(var G=0;G<v;G++)this.putBit(($>>>v-G-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function($){var v=Math.floor(this.length/8);if(this.buffer.length<=v)this.buffer.push(0);if($)this.buffer[v]|=128>>>this.length%8;this.length++}};Q5.exports=x5});var q5=j((M3,h5)=>{var Y$=t2(),t=J5(),x$=C4(),E5=Y5(),L5=g5();function n($,v){this.typeNumber=$,this.errorCorrectLevel=v,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}n.prototype={addData:function($){var v=new Y$($);this.dataList.push(v),this.dataCache=null},isDark:function($,v){if($<0||this.moduleCount<=$||v<0||this.moduleCount<=v)throw Error($+","+v);return this.modules[$][v]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var $=1;for($=1;$<40;$++){var v=E5.getRSBlocks($,this.errorCorrectLevel),G=new L5,b=0;for(var Z=0;Z<v.length;Z++)b+=v[Z].dataCount;for(var J=0;J<this.dataList.length;J++){var M=this.dataList[J];G.put(M.mode,4),G.put(M.getLength(),t.getLengthInBits(M.mode,$)),M.write(G)}if(G.getLengthInBits()<=b*8)break}this.typeNumber=$}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function($,v){this.moduleCount=this.typeNumber*4+17,this.modules=Array(this.moduleCount);for(var G=0;G<this.moduleCount;G++){this.modules[G]=Array(this.moduleCount);for(var b=0;b<this.moduleCount;b++)this.modules[G][b]=null}if(this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo($,v),this.typeNumber>=7)this.setupTypeNumber($);if(this.dataCache===null)this.dataCache=n.createData(this.typeNumber,this.errorCorrectLevel,this.dataList);this.mapData(this.dataCache,v)},setupPositionProbePattern:function($,v){for(var G=-1;G<=7;G++){if($+G<=-1||this.moduleCount<=$+G)continue;for(var b=-1;b<=7;b++){if(v+b<=-1||this.moduleCount<=v+b)continue;if(0<=G&&G<=6&&(b===0||b===6)||0<=b&&b<=6&&(G===0||G===6)||2<=G&&G<=4&&2<=b&&b<=4)this.modules[$+G][v+b]=!0;else this.modules[$+G][v+b]=!1}}},getBestMaskPattern:function(){var $=0,v=0;for(var G=0;G<8;G++){this.makeImpl(!0,G);var b=t.getLostPoint(this);if(G===0||$>b)$=b,v=G}return v},createMovieClip:function($,v,G){var b=$.createEmptyMovieClip(v,G),Z=1;this.make();for(var J=0;J<this.modules.length;J++){var M=J*Z;for(var X=0;X<this.modules[J].length;X++){var z=X*Z,x=this.modules[J][X];if(x)b.beginFill(0,100),b.moveTo(z,M),b.lineTo(z+Z,M),b.lineTo(z+Z,M+Z),b.lineTo(z,M+Z),b.endFill()}}return b},setupTimingPattern:function(){for(var $=8;$<this.moduleCount-8;$++){if(this.modules[$][6]!==null)continue;this.modules[$][6]=$%2===0}for(var v=8;v<this.moduleCount-8;v++){if(this.modules[6][v]!==null)continue;this.modules[6][v]=v%2===0}},setupPositionAdjustPattern:function(){var $=t.getPatternPosition(this.typeNumber);for(var v=0;v<$.length;v++)for(var G=0;G<$.length;G++){var b=$[v],Z=$[G];if(this.modules[b][Z]!==null)continue;for(var J=-2;J<=2;J++)for(var M=-2;M<=2;M++)if(Math.abs(J)===2||Math.abs(M)===2||J===0&&M===0)this.modules[b+J][Z+M]=!0;else this.modules[b+J][Z+M]=!1}},setupTypeNumber:function($){var v=t.getBCHTypeNumber(this.typeNumber),G;for(var b=0;b<18;b++)G=!$&&(v>>b&1)===1,this.modules[Math.floor(b/3)][b%3+this.moduleCount-8-3]=G;for(var Z=0;Z<18;Z++)G=!$&&(v>>Z&1)===1,this.modules[Z%3+this.moduleCount-8-3][Math.floor(Z/3)]=G},setupTypeInfo:function($,v){var G=this.errorCorrectLevel<<3|v,b=t.getBCHTypeInfo(G),Z;for(var J=0;J<15;J++)if(Z=!$&&(b>>J&1)===1,J<6)this.modules[J][8]=Z;else if(J<8)this.modules[J+1][8]=Z;else this.modules[this.moduleCount-15+J][8]=Z;for(var M=0;M<15;M++)if(Z=!$&&(b>>M&1)===1,M<8)this.modules[8][this.moduleCount-M-1]=Z;else if(M<9)this.modules[8][15-M-1+1]=Z;else this.modules[8][15-M-1]=Z;this.modules[this.moduleCount-8][8]=!$},mapData:function($,v){var G=-1,b=this.moduleCount-1,Z=7,J=0;for(var M=this.moduleCount-1;M>0;M-=2){if(M===6)M--;while(!0){for(var X=0;X<2;X++)if(this.modules[b][M-X]===null){var z=!1;if(J<$.length)z=($[J]>>>Z&1)===1;var x=t.getMask(v,b,M-X);if(x)z=!z;if(this.modules[b][M-X]=z,Z--,Z===-1)J++,Z=7}if(b+=G,b<0||this.moduleCount<=b){b-=G,G=-G;break}}}}};n.PAD0=236;n.PAD1=17;n.createData=function($,v,G){var b=E5.getRSBlocks($,v),Z=new L5;for(var J=0;J<G.length;J++){var M=G[J];Z.put(M.mode,4),Z.put(M.getLength(),t.getLengthInBits(M.mode,$)),M.write(Z)}var X=0;for(var z=0;z<b.length;z++)X+=b[z].dataCount;if(Z.getLengthInBits()>X*8)throw Error("code length overflow. ("+Z.getLengthInBits()+">"+X*8+")");if(Z.getLengthInBits()+4<=X*8)Z.put(0,4);while(Z.getLengthInBits()%8!==0)Z.putBit(!1);while(!0){if(Z.getLengthInBits()>=X*8)break;if(Z.put(n.PAD0,8),Z.getLengthInBits()>=X*8)break;Z.put(n.PAD1,8)}return n.createBytes(Z,b)};n.createBytes=function($,v){var G=0,b=0,Z=0,J=Array(v.length),M=Array(v.length);for(var X=0;X<v.length;X++){var z=v[X].dataCount,x=v[X].totalCount-z;b=Math.max(b,z),Z=Math.max(Z,x),J[X]=Array(z);for(var Q=0;Q<J[X].length;Q++)J[X][Q]=255&$.buffer[Q+G];G+=z;var g=t.getErrorCorrectPolynomial(x),q=new x$(J[X],g.getLength()-1),H=q.mod(g);M[X]=Array(g.getLength()-1);for(var h=0;h<M[X].length;h++){var V=h+H.getLength()-M[X].length;M[X][h]=V>=0?H.get(V):0}}var Z1=0;for(var J1=0;J1<v.length;J1++)Z1+=v[J1].totalCount;var X1=Array(Z1),_1=0;for(var z1=0;z1<b;z1++)for(var i=0;i<v.length;i++)if(z1<J[i].length)X1[_1++]=J[i][z1];for(var q1=0;q1<Z;q1++)for(var H1=0;H1<v.length;H1++)if(q1<M[H1].length)X1[_1++]=M[H1][q1];return X1};h5.exports=n});var S5=j((G3,B5)=>{var Q$=q5(),H5=u4(),g$="\x1B[40m \x1B[0m",o1="\x1B[47m \x1B[0m",E$=function($){return $?g$:o1},p4=function($){return{times:function(v){return Array(v).join($)}}},L$=function($,v){var G=Array($);for(var b=0;b<$;b++)G[b]=v;return G};B5.exports={error:H5.L,generate:function($,v,G){if(typeof v==="function")G=v,v={};var b=new Q$(-1,this.error);b.addData($),b.make();var Z="";if(v&&v.small){var J=!0,M=!1,X=b.getModuleCount(),z=b.modules.slice(),x=X%2===1;if(x)z.push(L$(X,M));var Q={WHITE_ALL:"\u2588",WHITE_BLACK:"\u2580",BLACK_WHITE:"\u2584",BLACK_ALL:" "},g=p4(Q.BLACK_WHITE).times(X+3),q=p4(Q.WHITE_BLACK).times(X+3);Z+=g+`
41
+ `;for(var H=0;H<X;H+=2){Z+=Q.WHITE_ALL;for(var h=0;h<X;h++)if(z[H][h]===M&&z[H+1][h]===M)Z+=Q.WHITE_ALL;else if(z[H][h]===M&&z[H+1][h]===J)Z+=Q.WHITE_BLACK;else if(z[H][h]===J&&z[H+1][h]===M)Z+=Q.BLACK_WHITE;else Z+=Q.BLACK_ALL;Z+=Q.WHITE_ALL+`
42
+ `}if(!x)Z+=q}else{var V=p4(o1).times(b.getModuleCount()+3);Z+=V+`
43
+ `,b.modules.forEach(function(Z1){Z+=o1,Z+=Z1.map(E$).join(""),Z+=o1+`
44
+ `}),Z+=V}if(G)G(Z);else console.log(Z)},setErrorLevel:function($){this.error=H5[$]||this.error}}});class r4{process=null;dataCallback=null;exitCallback=null;_cols=80;_rows=24;_isPTY=!1;get cols(){return this._cols}get rows(){return this._rows}get isRunning(){return this.process!==null}get isPTY(){return this._isPTY}async spawn($,v=[],G={}){if(this.process)throw Error("Process already running");this._cols=G.cols??80,this._rows=G.rows??24;let b={...process.env,...G.env,TERM:"xterm-256color",COLORTERM:"truecolor",FORCE_COLOR:"3",COLUMNS:String(this._cols),LINES:String(this._rows),PAGER:"",GIT_PAGER:""},Z=new TextDecoder;if(A5){this._isPTY=!1;let J=Bun.spawn([$,...v],{cwd:G.cwd??process.cwd(),env:b,stdin:"pipe",stdout:"pipe",stderr:"pipe"});this.process=J,this.readStream(J.stdout,Z),this.readStream(J.stderr,Z),J.exited.then((M)=>{this.exitCallback?.(M,void 0),this.process=null})}else{this._isPTY=!0;let J=Bun.spawn([$,...v],{cwd:G.cwd??process.cwd(),env:b,terminal:{cols:this._cols,rows:this._rows,data:(M,X)=>{let z=Z.decode(X,{stream:!0});this.dataCallback?.(z)}}});this.process=J,J.exited.then((M)=>{if(this.exitCallback?.(M,void 0),this.process?.terminal)this.process.terminal.close();this.process=null})}}async readStream($,v){let G=$.getReader();try{while(!0){let{done:b,value:Z}=await G.read();if(b)break;if(Z){let J=v.decode(Z,{stream:!0});this.dataCallback?.(J)}}}catch{}}write($){if(!this.process)throw Error("No process running");if(this._isPTY)this.process.terminal.write($);else{let v=new TextEncoder;this.process.stdin.write(v.encode($))}}resize($,v){if(this._cols=$,this._rows=v,this._isPTY&&this.process?.terminal)this.process.terminal.resize($,v)}onData($){this.dataCallback=$}onExit($){this.exitCallback=$}kill($){if(this.process){if(this._isPTY&&this.process.terminal)this.process.terminal.close();this.process.kill(),this.process=null}}get pid(){return this.process?.pid}}function W1(){return new r4}function h$(){return!A5}var A5;var e1=W(()=>{A5=process.platform==="win32"});async function g1(){if(t1)return t1;let $=[q$,H$,B$];for(let v of $)try{let G=await Promise.race([v(),new Promise((b,Z)=>setTimeout(()=>Z(Error("timeout")),3000))]);if(G)return t1=G,G}catch{}return t1="cn","cn"}async function q$(){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 B$(){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 S$(){let $=await g1();return s4[$]}async function G1(){return(await S$()).npm}async function D4(){if(await g1()==="cn")return`curl -fsSL https://bun.sh/install | BUN_INSTALL_MIRROR="${s4.cn.bunMirror}" bash`;return"curl -fsSL https://bun.sh/install | bash"}async function f5(){let $=await g1(),v=s4[$];if($==="cn")L.info(Y("region.usingChinaMirror")),L.message(` npm: ${v.npm}`);else L.info(Y("region.usingGlobalMirror"))}var t1=null,s4;var n4=W(()=>{s();k();s4={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}}});import{join as l4}from"path";function T$($){return $.startsWith(R)}function V$($,v){let G=$.split(".").map(Number),b=v.split(".").map(Number),Z=Math.max(G.length,b.length);for(let J=0;J<Z;J++){let M=G[J]||0,X=b[J]||0;if(M<X)return-1;if(M>X)return 1}return 0}async function c4(){try{if(!await Bun.file(m).exists())return null;let v=Bun.spawn([m,"--version"],{stdout:"pipe",stderr:"pipe"});if(await v.exited,v.exitCode!==0)return null;return(await new Response(v.stdout).text()).trim()}catch{return null}}async function w5(){return await c4()!==null}async function A$(){if(process.platform==="win32")return!0;try{let v=Bun.spawn(["which","unzip"],{stdout:"pipe",stderr:"pipe"});if(await v.exited,v.exitCode===0)return!0}catch{}L.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 v of $)try{let G=Bun.spawn(["bash","-c",`sudo ${v} 2>/dev/null || ${v}`],{stdout:"pipe",stderr:"pipe"});if(await G.exited,G.exitCode===0)return!0}catch{}return!1}async function f$(){let $=C();if(!await A$())return L.error("\u8BF7\u5148\u624B\u52A8\u5B89\u88C5 unzip: apt install unzip / yum install unzip"),!1;await f5(),$.start("\u6B63\u5728\u5B89\u88C5 Tako \u4E13\u5C5E Bun \u8FD0\u884C\u65F6...");try{await(await import("fs/promises")).mkdir(R,{recursive:!0});let G;if(process.platform==="win32"){let Z=await g1()==="cn"?'$env:BUN_INSTALL_MIRROR="https://registry.npmmirror.com/-/binary/bun"; ':"",J=`$env:BUN_INSTALL="${R}"; ${Z}irm bun.sh/install.ps1 | iex`;G=await Bun.spawn(["powershell","-Command",J],{stdout:"inherit",stderr:"inherit"}).exited}else{let b=await D4(),Z=`BUN_INSTALL="${R}" ${b}`;G=await Bun.spawn(["bash","-c",Z],{stdout:"inherit",stderr:"inherit"}).exited}if(G!==0)return $.stop("Bun \u5B89\u88C5\u5931\u8D25"),!1;return $1=m,$.stop("Tako \u4E13\u5C5E Bun \u5B89\u88C5\u5B8C\u6210"),L.info(`\u5B89\u88C5\u4F4D\u7F6E: ${R}`),!0}catch(v){return $.stop("Bun \u5B89\u88C5\u5931\u8D25"),!1}}async function U$(){let $=C();$.start("\u6B63\u5728\u5347\u7EA7 Tako \u4E13\u5C5E Bun \u8FD0\u884C\u65F6...");try{let v=await import("fs/promises");try{await v.rm(R,{recursive:!0,force:!0})}catch{}await v.mkdir(R,{recursive:!0});let G;if(process.platform==="win32"){let J=await g1()==="cn"?'$env:BUN_INSTALL_MIRROR="https://registry.npmmirror.com/-/binary/bun"; ':"",M=`$env:BUN_INSTALL="${R}"; ${J}irm bun.sh/install.ps1 | iex`;G=await Bun.spawn(["powershell","-Command",M],{stdout:"inherit",stderr:"inherit"}).exited}else{let Z=await D4(),J=`BUN_INSTALL="${R}" ${Z}`;G=await Bun.spawn(["bash","-c",J],{stdout:"inherit",stderr:"inherit"}).exited}if(G!==0)return $.stop("Bun \u5347\u7EA7\u5931\u8D25"),!1;$1=m,$.stop("Tako \u4E13\u5C5E Bun \u5347\u7EA7\u5B8C\u6210");let b=await c4();if(b)L.info(`\u65B0\u7248\u672C: ${b}`);return!0}catch(v){return $.stop("Bun \u5347\u7EA7\u5931\u8D25"),!1}}async function m5(){if(await w5())return $1=m,!0;return L.warn("\u672A\u68C0\u6D4B\u5230 Tako \u4E13\u5C5E Bun\uFF0C\u6B63\u5728\u81EA\u52A8\u5B89\u88C5..."),L.info("\uFF08\u4E0D\u4F1A\u5F71\u54CD\u60A8\u7CFB\u7EDF\u4E2D\u5DF2\u5B89\u88C5\u7684 Node.js \u6216 Bun\uFF09"),await f$()}async function K5(){if(!await m5())return!1;if(process.platform==="win32")return!0;let $=await c4();if(!$)return L.error("\u65E0\u6CD5\u83B7\u53D6 Tako Bun \u7248\u672C"),!1;if(V$($,U5)>=0)return!0;return L.warn(`\u5F53\u524D Tako Bun \u7248\u672C (${$}) \u4E0D\u652F\u6301\u8FDC\u7A0B\u6A21\u5F0F`),L.info(`\u9700\u8981\u5347\u7EA7\u5230 ${U5} \u6216\u66F4\u9AD8\u7248\u672C...`),await U$()}async function b1(){if($1){if(!T$($1))$1=m;return $1}if(await w5())return $1=m,m;return m}async function W5($){try{let v=await G1(),G=await fetch(`${v}/${$}/latest`);if(!G.ok)return null;return(await G.json()).version}catch{return null}}async function O$($){return(await P()).installedClients[$.id]?.version||null}async function j5($){let v=v1($.id),G=l4(v,"package.json");try{return await Bun.file(G).exists()}catch{return!1}}async function k5($){let v=await O$($);if(!v)return!0;let G=await W5($.package);if(!G)return!1;return v!==G}async function O5($,v=!1){let G=C(),b=v1($.id);try{if(!await m5())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 Z=await j5($),J=v||await k5($);if(Z&&!J)return{success:!0};let M=Z?"\u66F4\u65B0":"\u5B89\u88C5";G.start(`\u6B63\u5728${M} ${$.name}...`);let X=await import("fs/promises");await X.mkdir(b,{recursive:!0});let z=l4(b,"package.json");if(!await Bun.file(z).exists())await Bun.write(z,JSON.stringify({name:`tako-${$.id}`,private:!0,dependencies:{}},null,2));let Q=await b1(),g=await G1();if(Z){let V=l4(b,"bun.lock");try{await X.unlink(V)}catch{}}let q=Bun.spawn([Q,"add",`${$.package}@latest`],{cwd:b,stdout:"pipe",stderr:"pipe",env:{...process.env,BUN_CONFIG_REGISTRY:g}});if(await q.exited!==0){let V=await new Response(q.stderr).text();return G.stop(`${M} ${$.name} \u5931\u8D25`),{success:!1,error:V}}let h=await W5($.package);if(h){let V=await P();V.installedClients[$.id]={version:h,installedAt:new Date().toISOString()},await y1(V)}return G.stop(`${$.name} ${M}\u5B8C\u6210`),{success:!0}}catch(Z){return G.stop("\u64CD\u4F5C\u5931\u8D25"),{success:!1,error:Z instanceof Error?Z.message:"\u672A\u77E5\u9519\u8BEF"}}}async function j1($){if(!await j5($))return await O5($);if(await k5($))return await O5($,!0);return{success:!0}}var $1=null,U5="1.3.5";var k1=W(()=>{s();d();w();n4()});import{homedir as w$}from"os";function R5($,v=Date.now()){let G=v-new Date($.lastLaunchedAt).getTime(),b=Math.pow(0.5,G/y5),Z=Math.log10($.launchCount+1);return b*0.6+Z*0.4}async function E1($){try{return(await(await import("fs/promises")).stat($)).isDirectory()}catch{return!1}}async function N1($,v){let G=await P(),b=G.recentProjects||[],Z=new Date().toISOString(),J=b.findIndex((z)=>z.path===$);if(J>=0){let z=b[J],x=z.clientUsage||{},Q=x[v]||{count:0,lastAt:Z};b[J]={...z,launchCount:z.launchCount+1,lastLaunchedAt:Z,lastClientId:v,clientUsage:{...x,[v]:{count:Q.count+1,lastAt:Z}}}}else b.push({path:$,launchCount:1,lastLaunchedAt:Z,lastClientId:v,clientUsage:{[v]:{count:1,lastAt:Z}}});let M=Date.now(),X=b.map((z)=>({...z,score:R5(z,M)})).sort((z,x)=>x.score-z.score).slice(0,m$).map(({score:z,...x})=>x);G.recentProjects=X,await Z4(G)}function K$($,v,G=Date.now()){let b=$.clientUsage?.[v];if(b){let Z=G-new Date(b.lastAt).getTime(),J=Math.pow(0.5,Z/y5),M=Math.log10(b.count+1);return J*0.6+M*0.4}else if($.lastClientId===v)return R5($,G);return 0}async function P5($,v=d4,G=!0){let Z=(await P()).recentProjects||[],J=process.cwd(),M=Z.filter((Q)=>{if(G&&Q.path===J)return!1;return Q.clientUsage?.[$]||Q.lastClientId===$}),X=Date.now(),z=M.map((Q)=>({...Q,score:K$(Q,$,X)})).sort((Q,g)=>g.score-Q.score),x=[];for(let{score:Q,...g}of z){if(x.length>=v)break;if(await E1(g.path))x.push(g)}return x}async function I5(){let v=(await P()).recentProjects||[],G=process.cwd();return v.find((Z)=>Z.path===G)?.lastClientId||null}function F5($,v=25){let G=w$(),b=$.startsWith(G)?"~"+$.slice(G.length):$;if(b.length>v){let J=b.split("/").pop()||"";if(J.length>v-4)b="..."+J.slice(-v+3);else b=`.../${J}`}return b}function C5($){let{t:v}=(k(),t5(a2)),G=Date.now(),b=new Date($).getTime(),Z=G-b,J=Math.floor(Z/60000),M=Math.floor(Z/3600000),X=Math.floor(Z/86400000),z=Math.floor(X/7),x=Math.floor(X/30);if(J<1)return v("time.justNow");if(J<60)return v("time.minutesAgo",{n:J});if(M<24)return v("time.hoursAgo",{n:M});if(X===1)return v("time.yesterday");if(X<7)return v("time.daysAgo",{n:X});if(X<30)return v("time.weeksAgo",{n:z});return v("time.monthsAgo",{n:x})}var m$=50,d4=3,y5=604800000;var $4=W(()=>{w()});function W$($){return $.startsWith("cr_")&&$.length>10}async function a4($){try{let G=await(await fetch(`${c}/apiStats/api/get-key-id`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:$})})).json();if(G.success&&G.data?.id)return{valid:!0,apiId:G.data.id};return{valid:!1,error:G.error||Y("auth.validationFailed")}}catch(v){return{valid:!1,error:v instanceof Error?v.message:Y("auth.networkError")}}}async function u5($){if(!W$($))return{success:!1,error:Y("auth.invalidFormat")};let v=await a4($);if(!v.valid)return{success:!1,error:v.error};return await y1({apiKey:$,apiId:v.apiId}),{success:!0}}var i4=W(()=>{w();k()});var p5={};G4(p5,{startRemoteSession:()=>j$,serializeMessage:()=>j4,parseMessage:()=>W4,isValidSessionCode:()=>e0,isPTYSupported:()=>h$,generateSessionCode:()=>U1,createWSClient:()=>m1,createResizeMessage:()=>i0,createRegisterMessage:()=>w4,createPingMessage:()=>d0,createPTYHost:()=>W1,createOutputMessage:()=>m4,createInputMessage:()=>a0,createExitMessage:()=>K4,buildRemoteUrl:()=>O1,buildClientWebSocketUrl:()=>o0,buildCLIWebSocketUrl:()=>_4,RemoteWSClient:()=>y4,PTYHost:()=>r4});async function j$($,v={}){let G=await I();if(!G)throw Error("API key not configured");if(!V1){if(!await K5())throw Error("Tako Bun \u7248\u672C\u4E0D\u652F\u6301\u8FDC\u7A0B\u6A21\u5F0F\uFF0C\u5347\u7EA7\u5931\u8D25")}let b=U1(),Z=O1(b),J=W1(),M=m1(),X=!1;await M.connect(b,G,{onInput:(h)=>{if(J.isRunning)J.write(h)},onResize:(h,V)=>{J.resize(h,V)},onClientConnected:()=>{X=!0},onClientDisconnected:()=>{X=!1},onError:(h)=>{console.error("[Remote] WebSocket error:",h.message)},onDisconnect:()=>{if(console.log("[Remote] Connection lost permanently, terminating PTY..."),J.isRunning)J.kill()},onReconnecting:(h)=>{console.log(`[Remote] Reconnecting to server (attempt ${h})...`)},onReconnected:()=>{console.log("[Remote] Reconnected to server successfully")}}),J.onData((h)=>{M.sendOutput(h)}),J.onExit((h)=>{M.sendExit(h),M.disconnect()});let z=await x1($),x=v1($.id),Q;if(V1)Q="bun";else Q=await b1();let g=[z];if(v.projectPath)g.push(v.projectPath);if(v.additionalArgs)g.push(...v.additionalArgs);let q=$.getEnvVars(G);return await J.spawn(Q,g,{cols:v.cols??80,rows:v.rows??24,cwd:v.projectPath??process.cwd(),env:{...process.env,...q,TERM:"xterm-256color",COLORTERM:"truecolor",FORCE_COLOR:"1"}}),{sessionCode:b,remoteUrl:Z,ptyHost:J,wsClient:M,stop:()=>{J.kill(),M.disconnect()}}}var r5=W(()=>{e1();n1();w1();w();d();k1();w1();e1();n1()});var s5={};G4(s5,{launchClientRemote:()=>N$,launchClient:()=>k$});async function k$($,v){try{let G=v?.projectPath||process.cwd();if(v?.projectPath){if(!await E1(v.projectPath))return{success:!1,error:`\u76EE\u5F55\u4E0D\u5B58\u5728: ${v.projectPath}`}}let b=await j1($);if(!b.success)return b;let Z=await I();if(!Z)return{success:!1,error:"\u672A\u914D\u7F6E API Key"};if($.setupConfigFiles)await $.setupConfigFiles(Z);let J=await x1($);if(!J)J=P1($);if(!await Bun.file(J).exists())return{success:!1,error:`\u627E\u4E0D\u5230\u53EF\u6267\u884C\u6587\u4EF6: ${J}`};await N1(G,$.id);let X=$.getEnvVars(Z),z={...process.env,...X};L.info(`\u542F\u52A8 ${$.name}...`);let x;if($.runtime==="native")x=[J];else x=[await b1(),J];if(v?.args&&v.args.length>0)x=[...x,...v.args];return await Bun.spawn(x,{env:z,stdio:["inherit","inherit","inherit"],cwd:G}).exited,{success:!0}}catch(G){return{success:!1,error:G instanceof Error?G.message:"\u542F\u52A8\u5931\u8D25"}}}async function N$($,v){try{let G=v?.projectPath||process.cwd();if(v?.projectPath){if(!await E1(v.projectPath))return{success:!1,error:`\u76EE\u5F55\u4E0D\u5B58\u5728: ${v.projectPath}`}}let b=await j1($);if(!b.success)return b;let Z=await I();if(!Z)return{success:!1,error:"\u672A\u914D\u7F6E API Key"};let J=await a4(Z);if(!J.valid)return{success:!1,error:`API Key \u65E0\u6548: ${J.error}`};if($.setupConfigFiles)await $.setupConfigFiles(Z);await N1(G,$.id);let{startRemoteSession:M}=await Promise.resolve().then(() => (r5(),p5));return{success:!0,session:await M($,{projectPath:G,additionalArgs:v?.args,cols:v?.cols??80,rows:v?.rows??24})}}catch(G){return{success:!1,error:G instanceof Error?G.message:"\u8FDC\u7A0B\u542F\u52A8\u5931\u8D25"}}}var D5=W(()=>{d();w();k1();$4();i4();s()});d();w();var v0={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:$}}};I1(v0);d();w();import{homedir as M0}from"os";import{join as Y4}from"path";var x4=Y4(M0(),".codex"),G0=Y4(x4,"config.toml"),b0=Y4(x4,"auth.json"),Z0=`model_provider = "crs"
45
45
  model = "gpt-5-codex"
46
46
  model_reasoning_effort = "high"
47
47
  disable_response_storage = true
@@ -53,33 +53,33 @@ base_url = "${c}/openai"
53
53
  wire_api = "responses"
54
54
  requires_openai_auth = true
55
55
  env_key = "CRS_OAI_KEY"
56
- `,o5=`{
56
+ `,J0=`{
57
57
  "OPENAI_API_KEY": null
58
58
  }
59
- `;async function t5($){let h=await import("fs/promises");try{await h.mkdir(J4,{recursive:!0})}catch{}await Bun.write(a5,n5),await Bun.write(D5,o5)}var e5={id:"codex",name:"Codex",package:"@openai/codex",command:"codex",runtime:"bun",continueArg:"--continue",getEnvVars($){return{CRS_OAI_KEY:$}},setupConfigFiles:t5};R1(e5);l();r();U();var P2="\x1C";class I2{dataCallback=null;wasRawMode=!1;isRunning=!1;boundOnData=this.handleData.bind(this);onData($){this.dataCallback=$}start(){if(this.isRunning)return;if(this.isRunning=!0,process.stdin.isTTY)this.wasRawMode=process.stdin.isRaw??!1,process.stdin.setRawMode(!0);process.stdin.resume(),process.stdin.on("data",this.boundOnData)}stop(){if(!this.isRunning)return;if(this.isRunning=!1,process.stdin.removeListener("data",this.boundOnData),process.stdin.isTTY)process.stdin.setRawMode(this.wasRawMode);process.stdin.pause()}handleData($){let h=$.toString("utf-8");this.dataCallback?.(h)}get running(){return this.isRunning}}function F2(){return new I2}s1();A1();U();N();var w1=null;class x5{wsClient;ptyHost;sessionCode="";remoteUrl="";_isClientConnected=!1;events={};constructor($){this.ptyHost=$,this.wsClient=U1()}async connect($={}){this.events=$;let h=await P();if(!h)throw Error("API Key not configured");this.sessionCode=V1(),this.remoteUrl=f1(this.sessionCode),await this.wsClient.connect(this.sessionCode,h,{onInput:(M)=>{if(this.ptyHost.isRunning)this.ptyHost.write(M)},onResize:(M,G)=>{this.ptyHost.resize(M,G)},onClientConnected:()=>{this._isClientConnected=!0,this.events.onClientConnected?.()},onClientDisconnected:()=>{this._isClientConnected=!1,this.events.onClientDisconnected?.()},onError:(M)=>{this.events.onError?.(M)},onDisconnect:()=>{this.events.onDisconnect?.()}})}sendOutput($){this.wsClient.sendOutput($)}sendExit($){this.wsClient.sendExit($)}disconnect(){this.wsClient.disconnect()}async displayRemoteUI(){if(!w1)try{w1=await Promise.resolve().then(() => A(Y5(),1))}catch{w1=null}if(console.log(),console.log(" \x1B[1;36m"+X("remote.modeTitle")+"\x1B[0m"),console.log(),w1)console.log(),await new Promise(($)=>{w1.generate(this.remoteUrl,{small:!0},(h)=>{let M=h.split(`
60
- `).map((G)=>" "+G).join(`
61
- `);console.log(M),$()})});console.log(),console.log(` ${X("remote.sessionCode")} \x1B[1;33m${this.sessionCode}\x1B[0m`),console.log(` ${X("remote.remoteUrl")} \x1B[4;36m${this.remoteUrl}\x1B[0m`),console.log(),this.printStatus(),console.log(),console.log(" \x1B[90m"+X("remote.returnHint")+"\x1B[0m"),console.log()}printStatus(){if(this._isClientConnected)console.log(` ${X("remote.status")} \x1B[32m${X("remote.clientConnected",{count:1})}\x1B[0m`);else console.log(` ${X("remote.status")} \x1B[33m${X("remote.waitingForConnection")}\x1B[0m`)}updateStatusDisplay(){process.stdout.write("\x1B[4A"),this.printStatus(),process.stdout.write(" "),process.stdout.write("\x1B[3B")}get sessionInfo(){return{sessionCode:this.sessionCode,remoteUrl:this.remoteUrl}}get isClientConnected(){return this._isClientConnected}get isConnected(){return this.wsClient.isConnected}}function W5($){return new x5($)}n1();l();K1();U();N();class A5{ptyHost;inputHandler;remoteHandler=null;_mode="local";client;options;events;isSwitching=!1;constructor($,h,M={}){this.client=$,this.options=h,this.events=M,this.ptyHost=O1(),this.inputHandler=F2(),this.setupInputHandler(),this.setupPTYCallbacks(),this.setupResizeHandler()}get mode(){return this._mode}setMode($){this._mode=$,this.events.onModeChange?.($)}async start(){let{command:$,args:h,env:M,cwd:G}=await this.buildLaunchConfig(),b=this.options.cols??process.stdout.columns??80,g=this.options.rows??process.stdout.rows??24;await this.ptyHost.spawn($,h,{cols:b,rows:g,cwd:G,env:M}),this.inputHandler.start(),this.setMode("local")}setupInputHandler(){this.inputHandler.onData(($)=>{if($.includes(P2)){this.handleModeSwitch();let h=$.replace(/\x1c/g,"");if(h&&this._mode==="local"&&this.ptyHost.isRunning)this.ptyHost.write(h);return}if(this._mode==="local"&&this.ptyHost.isRunning)this.ptyHost.write($)})}setupPTYCallbacks(){this.ptyHost.onData(($)=>{if(this._mode==="local")process.stdout.write($);else if(this._mode==="remote"&&this.remoteHandler)this.remoteHandler.sendOutput($)}),this.ptyHost.onExit(($)=>{this.cleanup(),this.events.onExit?.($)})}setupResizeHandler(){let $=()=>{let h=process.stdout.columns??80,M=process.stdout.rows??24;this.ptyHost.resize(h,M)};process.stdout.on("resize",$)}async handleModeSwitch(){if(this.isSwitching)return;if(this._mode==="local")await this.transitionToRemote();else if(this._mode==="remote")await this.transitionToLocal()}async transitionToRemote(){this.isSwitching=!0,this.setMode("transitioning_to_remote"),this.clearScreenAndShowMessage(X("remote.connecting"));try{this.remoteHandler=W5(this.ptyHost),await this.remoteHandler.connect({onClientConnected:()=>{if(this._mode==="remote")this.remoteHandler?.updateStatusDisplay()},onClientDisconnected:()=>{if(this._mode==="remote")this.remoteHandler?.updateStatusDisplay()},onError:($)=>{this.events.onError?.($)},onDisconnect:()=>{if(this._mode==="remote")console.log(`
62
- \x1B[33m`+X("remote.connectionLost")+"\x1B[0m"),this.transitionToLocal()}}),this.clearScreen(),await this.remoteHandler.displayRemoteUI(),this.setMode("remote")}catch($){this.events.onError?.($),this.clearScreenAndShowMessage(X("remote.failedToConnect",{error:$.message})),await this.sleep(2000),await this.transitionToLocal()}finally{this.isSwitching=!1}}async transitionToLocal(){if(this.isSwitching=!0,this.setMode("transitioning_to_local"),this.remoteHandler)this.remoteHandler.disconnect(),this.remoteHandler=null;process.stdout.write("\x1B[3J\x1B[2J\x1B[H");let $=process.stdout.columns??80,h=process.stdout.rows??24;this.ptyHost.resize($,h),this.setMode("local"),this.isSwitching=!1}async buildLaunchConfig(){let $=this.options.projectPath||process.cwd(),h=await P();if(!h)throw Error("API Key not configured");let M=await Z1(this.client);if(!M)M=_1(this.client);if(!await Bun.file(M).exists())throw Error(`Executable not found: ${M}`);let b,g;if(this.client.runtime==="native")b=M,g=[];else{if(S1)b="bun";else b=await M1();g=[M]}if(this.options.args&&this.options.args.length>0)g.push(...this.options.args);let v=this.client.getEnvVars(h),Z={...process.env,...v};return{command:b,args:g,env:Z,cwd:$}}clearScreen(){process.stdout.write("\x1B[3J\x1B[2J\x1B[H")}clearScreenAndShowMessage($){this.clearScreen(),console.log(),console.log(` ${$}`),console.log()}sleep($){return new Promise((h)=>setTimeout(h,$))}cleanup(){if(this.inputHandler.stop(),this.remoteHandler)this.remoteHandler.disconnect(),this.remoteHandler=null}stop(){this.ptyHost.kill(),this.cleanup()}}function U5($,h,M={}){return new A5($,h,M)}K1();U();t1();r();N();async function Y1($,h){if(process.platform==="win32"){Q.warn(X("launcher.windowsWarning"));let{launchClient:M}=await Promise.resolve().then(() => (P5(),R5));return await M($,h)}try{let M=h?.projectPath||process.cwd();if(h?.projectPath){if(!await z1(h.projectPath))return{success:!1,error:X("launcher.directoryNotFound",{path:h.projectPath})}}let G=await m1($);if(!G.success)return G;let b=await P();if(!b)return{success:!1,error:X("launcher.apiKeyNotConfigured")};if($.setupConfigFiles)await $.setupConfigFiles(b);await N1(M,$.id),Q.info(X("launcher.starting",{client:$.name})),Q.info("\x1B[90m"+X("launcher.ctrlHint")+"\x1B[0m");let g=U5($,{projectPath:M,args:h?.args,cols:process.stdout.columns,rows:process.stdout.rows});return new Promise((v)=>{let Z=g.events.onExit;g.events.onExit=(J)=>{Z?.(J),v({success:!0,exitCode:J})},g.events.onError=(J)=>{console.error(`\x1B[31m${X("launcher.error",{message:J.message})}\x1B[0m`)},g.start().catch((J)=>{v({success:!1,error:J.message})})})}catch(M){return{success:!1,error:M instanceof Error?M.message:"Launch failed"}}}r();r4();U();N();import{join as i}from"path";var a4="tako-cli",x1="0.1.44";function f$($,h){let M=$.split(".").map(Number),G=h.split(".").map(Number);for(let b=0;b<3;b++){let g=M[b]||0,v=G[b]||0;if(g>v)return 1;if(g<v)return-1}return 0}async function A$(){try{let $=await v1(),h=await fetch(`${$}/${a4}/latest`,{signal:AbortSignal.timeout(5000)});if(!h.ok)return null;return(await h.json()).version||null}catch{return null}}async function U$(){let $=await A$();if(!$)return{hasUpdate:!1,currentVersion:x1};return{hasUpdate:f$($,x1)>0,latestVersion:$,currentVersion:x1}}async function I5(){let $=await import("fs/promises"),h=i(p,"bin"),M=i(h,"tako"),G=i(u,"node_modules/tako-cli/dist/index.js");if(await $.mkdir(h,{recursive:!0}),process.platform==="win32"){let g=`@echo off\r
63
- "${w}" "${G}" %*\r
64
- `;await $.writeFile(i(h,"tako.cmd"),g)}else{let g=`#!/bin/bash
65
- exec "${w}" "${G}" "$@"
66
- `;await $.writeFile(M,g,{mode:493})}}async function w$($){let h=F();h.start(`\u6B63\u5728\u66F4\u65B0\u5230 v${$}...`);try{let M=await v1(),G=await import("fs/promises");await G.mkdir(u,{recursive:!0});let b=i(u,"package.json");try{await G.access(b)}catch{await G.writeFile(b,JSON.stringify({name:"tako-local",private:!0},null,2))}let g=Bun.spawn([w,"update",a4,"--latest"],{cwd:u,stdout:"pipe",stderr:"pipe",env:{...process.env,BUN_CONFIG_REGISTRY:M}});if(await g.exited,g.exitCode===0)return await I5(),h.stop(`\u66F4\u65B0\u6210\u529F\uFF01\u5DF2\u66F4\u65B0\u5230 v${$}`),!0;else{let v=await new Response(g.stderr).text();return h.stop(`\u66F4\u65B0\u5931\u8D25: ${v||"\u672A\u77E5\u9519\u8BEF"}`),!1}}catch(M){return h.stop(`\u66F4\u65B0\u5931\u8D25: ${M instanceof Error?M.message:"\u672A\u77E5\u9519\u8BEF"}`),!1}}async function O$(){let $=await import("fs/promises"),h=i(u,"bun.lock");try{await $.unlink(h)}catch{}}async function m$(){let $=await import("fs/promises");try{let h=await v1();await $.mkdir(u,{recursive:!0});let M=i(u,"package.json");try{await $.access(M)}catch{await $.writeFile(M,JSON.stringify({name:"tako-local",private:!0},null,2))}await O$();let G=Bun.spawn([w,"add",`${a4}@latest`],{cwd:u,stdout:"pipe",stderr:"pipe",env:{...process.env,BUN_CONFIG_REGISTRY:h}});return await G.exited,G.exitCode===0}catch{return!1}}async function K$(){let $=await import("fs/promises"),h=i(p,"bin"),M=i(h,"tako"),G=i(u,"node_modules/tako-cli/dist/index.js");try{let b=await $.readFile(M,"utf-8");if(b.includes("bun run tako-cli")||b.includes("run tako-cli")){Q.info(X("updater.migrating"));let g=!1;try{await $.access(G),g=!0}catch{g=!1}if(!g){let v=F();if(v.start(X("updater.installingLocally")),!await m$())return v.stop(X("updater.migrationFailed")),!1;v.stop(X("updater.installComplete"))}return await I5(),!0}}catch{}return!1}async function e1(){try{if(await K$())Q.info(X("updater.migrationComplete")),process.exit(0);let h=await U$();if(h.hasUpdate&&h.latestVersion){if(Q.warn(X("updater.newVersionAvailable",{version:h.latestVersion,current:x1})),await w$(h.latestVersion))Q.info(X("updater.pleaseRestart")),process.exit(0)}}catch{}}N();r();t1();N();async function F5(){let $=X2(),h=await K5(),M=process.cwd(),G=[],b=[...$].sort((g,v)=>{if(g.id===h)return-1;if(v.id===h)return 1;return 0});for(let g of b){let v=await m5(g.id,i4,!0);G.push({value:{type:"launch",client:g},label:g.name,hint:X("recentProjects.launchInCurrent")});for(let Z of v)G.push({value:{type:"launch-in-project",client:g,projectPath:Z.path},label:` \u2514\u2500 ${N5(Z.path,35)}`,hint:j5(Z.lastLaunchedAt)})}return G.push({value:{type:"exit"},label:"\u2500".repeat(50),hint:""}),G.push({value:{type:"advanced"},label:X("menu.advanced"),hint:X("menu.advancedHint")},{value:{type:"exit"},label:X("menu.exit")}),G}async function D4(){let $=await F5(),h=await T1({message:X("menu.selectAction"),options:$});if(a(h))return null;return h}async function n4(){let $=await T1({message:X("menu.advancedOptions"),options:[{value:{type:"stats"},label:X("menu.viewStats")},{value:{type:"config"},label:X("menu.configApiKey")},{value:{type:"language"},label:X("menu.changeLanguage")},{value:null,label:X("menu.back")}]});if(a($)||$===null)return null;return $}r();l4();N();async function $4($=!1){if(!$)Q.warn("API Key not detected"),console.log();let h=await R2({message:X("prompts.enterApiKey"),placeholder:X("prompts.apiKeyPlaceholder"),validate(b){if(!b)return X("prompts.enterApiKey");if(!b.startsWith("cr_"))return X("prompts.keyInvalidFormat");if(b.length<10)return X("prompts.keyInvalidFormat")}});if(a(h))return!1;let M=F();M.start(X("prompts.validating"));let G=await k5(h);if(G.success)return M.stop(X("prompts.keyConfigured")),!0;else return M.stop(X("prompts.keyValidationFailed",{error:G.error||""})),!1}r();U();async function o4(){try{let $=await J2();if(!$)return{success:!1,error:"\u672A\u627E\u5230 API ID\uFF0C\u8BF7\u91CD\u65B0\u914D\u7F6E Key"};let M=await(await fetch(`${c}/apiStats/api/user-stats`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiId:$})})).json(),b=await(await fetch(`${c}/apiStats/api/user-model-stats`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiId:$,period:"daily"})})).json();if(!M.success)return{success:!1,error:M.error||M.message||"\u83B7\u53D6\u7EDF\u8BA1\u5931\u8D25"};let g=(b.data||[]).map((v)=>({model:v.model,requests:v.requests,cost:v.formatted?.total||"$0.00"}));return{success:!0,data:{totalRequests:M.data?.usage?.total?.requests||0,totalCost:M.data?.usage?.total?.formattedCost||"$0.00",todayCost:`$${(M.data?.limits?.currentDailyCost||0).toFixed(2)}`,modelStats:g}}}catch($){return{success:!1,error:$ instanceof Error?$.message:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25"}}}function t4($){return $.toLocaleString("en-US")}N();function N$($,h){let M=[];if(M.push(""),M.push(` ${X("stats.title")}`),M.push(""),M.push(` ${X("stats.totalRequests",{count:t4($.totalRequests)})}`),M.push(` ${X("stats.totalCost",{cost:$.totalCost})}`),M.push(` ${X("stats.todayCost",{cost:$.todayCost})}`),$.modelStats.length>0)M.push(""),M.push(` ${X("stats.modelDistribution")}`),$.modelStats.forEach((G,b)=>{let g=b===$.modelStats.length-1?"\u2514\u2500":"\u251C\u2500",v=G.model.length>25?G.model.slice(0,22)+"...":G.model;M.push(` ${g} ${v.padEnd(25)} ${t4(G.requests).padStart(6)} ${X("stats.times")} ${G.cost.padStart(8)}`)});return M.push(""),M.push(` \x1B[90m${X("stats.refreshHint",{countdown:h})}\x1B[0m`),M.join(`
67
- `)}async function e4(){let h=F();h.start(X("stats.fetching"));let M=await o4();if(!M.success){h.stop(X("stats.fetchFailed",{error:M.error||""}));return}h.stop("");let G=10,b="",g=()=>{if(b){let Z=b.split(`
68
- `).length;process.stdout.write(`\x1B[${Z}A\x1B[0J`)}b=N$(M.data,G),console.log(b)};g();let v=process.stdin.isRaw;if(process.stdin.isTTY)process.stdin.setRawMode(!0);return process.stdin.resume(),new Promise((Z)=>{let J=!0,z=()=>{if(!J)return;J=!1,x(),Z()},Y=setInterval(async()=>{if(!J)return;if(G--,G<=0){G=10;let q=await o4();if(q.success)M=q}g()},1000),x=()=>{if(clearInterval(Y),process.stdin.removeListener("data",z),process.stdin.isTTY)process.stdin.setRawMode(v??!1);process.stdin.pause()};process.stdin.on("data",z)})}function j$(){let h="\u2500".repeat(70);console.log(),console.log(` \u250C${h}\u2510`);let M=`\uD83D\uDC19 ${X("cli.version",{version:x1})}`,G=M.length,b=Math.floor((70-G)/2),g=70-b-G;console.log(` \u2502${" ".repeat(b)}${M}${" ".repeat(g)}\u2502`);let v=X("banner.welcome"),Z=v.length,J=Math.floor((70-Z)/2),z=70-J-Z;console.log(` \u2502${" ".repeat(J)}\x1B[90m${v}\x1B[0m${" ".repeat(z)}\u2502`),console.log(` \u251C${h}\u2524`);let Y=X("updateAnnouncement.title"),x=Y.length,q=Math.floor((70-x)/2),S=70-q-x;console.log(` \u2502${" ".repeat(q)}${Y}${" ".repeat(S)}\u2502`);let E=X("updateAnnouncement.description"),T=E.length,e=Math.floor((70-T)/2),W1=70-e-T;console.log(` \u2502${" ".repeat(e)}\x1B[90m${E}\x1B[0m${" ".repeat(W1)}\u2502`),console.log(` \u2502${" ".repeat(70)}\u2502`);let Q1=c1("updateAnnouncement.features");for(let G1 of Q1)if(G1.length<=66){let b1=G1.padEnd(66);console.log(` \u2502${" ".repeat(2)}\x1B[90m${b1}\x1B[0m${" ".repeat(2)}\u2502`)}else console.log(` \u2502${" ".repeat(2)}\x1B[90m${G1.slice(0,66)}\x1B[0m${" ".repeat(2)}\u2502`);console.log(` \u2502${" ".repeat(70)}\u2502`),console.log(` \u2514${h}\u2518`),console.log()}async function C5($){switch($.type){case"launch":{let h=await Y1($.client);if(!h.success)Q.error(h.error||X("cli.launchFailed"));return!0}case"launch-in-project":{let h=$.client.continueArg?[$.client.continueArg]:[],M=await Y1($.client,{projectPath:$.projectPath,args:h});if(!M.success)Q.error(M.error||X("cli.launchFailed"));return!0}case"advanced":{let h=await n4();if(h)return await C5(h);return!0}case"stats":return await e4(),!0;case"config":return await $4(!0),!0;case"language":return await k$(),!0;case"exit":return!1}}async function k$(){let $=y4(),h=X(`language.${$}`),M=await T1({message:X("menu.changeLanguage")+` (${X("menu.currentLanguage",{lang:h})})`,options:[{value:"en",label:X("language.en")},{value:"zh",label:X("language.zh")}]});if(a(M))return;k4(M);let G=X(`language.${M}`);Q.success(X("menu.languageChanged",{lang:G}))}async function p5(){if(j$(),!await Z2()){if(!await $4()){V4("\u518D\u89C1\uFF01");return}}while(!0){let h=await D4();if(h===null)break;if(!await C5(h))break}V4("\u518D\u89C1\uFF01")}l();N();var $2="0.1.44";function y$(){console.log(`
69
- ${X("cli.version",{version:$2})}
59
+ `;async function X0($){let v=await import("fs/promises");try{await v.mkdir(x4,{recursive:!0})}catch{}await Bun.write(G0,Z0),await Bun.write(b0,J0)}var z0={id:"codex",name:"Codex",package:"@openai/codex",command:"codex",runtime:"bun",continueArg:"--continue",getEnvVars($){return{CRS_OAI_KEY:$}},setupConfigFiles:X0};I1(z0);d();s();w();var s2="\x1C",D2="\x03";class n2{dataCallback=null;wasRawMode=!1;isRunning=!1;boundOnData=this.handleData.bind(this);onData($){this.dataCallback=$}start(){if(this.isRunning)return;if(this.isRunning=!0,process.stdin.isTTY)this.wasRawMode=process.stdin.isRaw??!1,process.stdin.setRawMode(!0);process.stdin.resume(),process.stdin.on("data",this.boundOnData)}stop(){if(!this.isRunning)return;if(this.isRunning=!1,process.stdin.removeListener("data",this.boundOnData),process.stdin.isTTY)process.stdin.setRawMode(this.wasRawMode);process.stdin.pause()}handleData($){let v=$.toString("utf-8");this.dataCallback?.(v)}get running(){return this.isRunning}}function l2(){return new n2}n1();w1();w();k();var K1=null;class T5{wsClient;ptyHost;sessionCode="";remoteUrl="";_isClientConnected=!1;events={};constructor($){this.ptyHost=$,this.wsClient=m1()}async connect($={}){this.events=$;let v=await I();if(!v)throw Error("API Key not configured");this.sessionCode=U1(),this.remoteUrl=O1(this.sessionCode),await this.wsClient.connect(this.sessionCode,v,{onInput:(G)=>{if(this.ptyHost.isRunning)this.ptyHost.write(G)},onResize:(G,b)=>{this.ptyHost.resize(G,b)},onClientConnected:()=>{this._isClientConnected=!0,this.events.onClientConnected?.()},onClientDisconnected:()=>{this._isClientConnected=!1,this.events.onClientDisconnected?.()},onError:(G)=>{this.events.onError?.(G)},onDisconnect:()=>{this.events.onDisconnect?.()}})}sendOutput($){this.wsClient.sendOutput($)}sendExit($){this.wsClient.sendExit($)}disconnect(){this.wsClient.disconnect()}async displayRemoteUI(){if(!K1)try{K1=await Promise.resolve().then(() => O(S5(),1))}catch{K1=null}if(console.log(),console.log(" \x1B[1;36m"+Y("remote.modeTitle")+"\x1B[0m"),console.log(),K1)console.log(),await new Promise(($)=>{K1.generate(this.remoteUrl,{small:!0},(v)=>{let G=v.split(`
60
+ `).map((b)=>" "+b).join(`
61
+ `);console.log(G),$()})});console.log(),console.log(` ${Y("remote.sessionCode")} \x1B[1;33m${this.sessionCode}\x1B[0m`),console.log(` ${Y("remote.remoteUrl")} \x1B[4;36m${this.remoteUrl}\x1B[0m`),console.log(),this.printStatus(),console.log(),console.log(" \x1B[90m"+Y("remote.returnHint")+"\x1B[0m"),console.log()}printStatus(){if(this._isClientConnected)console.log(` ${Y("remote.status")} \x1B[32m${Y("remote.clientConnected",{count:1})}\x1B[0m`);else console.log(` ${Y("remote.status")} \x1B[33m${Y("remote.waitingForConnection")}\x1B[0m`)}updateStatusDisplay(){process.stdout.write("\x1B[4A"),this.printStatus(),process.stdout.write(" "),process.stdout.write("\x1B[3B")}get sessionInfo(){return{sessionCode:this.sessionCode,remoteUrl:this.remoteUrl}}get isClientConnected(){return this._isClientConnected}get isConnected(){return this.wsClient.isConnected}}function V5($){return new T5($)}e1();d();k1();w();k();class N5{ptyHost;inputHandler;remoteHandler=null;_mode="local";client;options;events;isSwitching=!1;constructor($,v,G={}){this.client=$,this.options=v,this.events=G,this.ptyHost=W1(),this.inputHandler=l2(),this.setupInputHandler(),this.setupPTYCallbacks(),this.setupResizeHandler()}get mode(){return this._mode}setMode($){this._mode=$,this.events.onModeChange?.($)}async start(){let{command:$,args:v,env:G,cwd:b}=await this.buildLaunchConfig(),Z=this.options.cols??process.stdout.columns??80,J=this.options.rows??process.stdout.rows??24;await this.ptyHost.spawn($,v,{cols:Z,rows:J,cwd:b,env:G}),this.inputHandler.start(),this.setMode("local")}setupInputHandler(){this.inputHandler.onData(($)=>{if($.includes(s2)){this.handleModeSwitch();let v=$.replace(/\x1c/g,"");if(v&&this._mode==="local"&&this.ptyHost.isRunning)this.ptyHost.write(v);return}if(this._mode==="remote"&&$.includes(D2)){this.transitionToLocal();return}if(this._mode==="local"&&this.ptyHost.isRunning)this.ptyHost.write($)})}setupPTYCallbacks(){this.ptyHost.onData(($)=>{if(this._mode==="local")process.stdout.write($);else if(this._mode==="remote"&&this.remoteHandler)this.remoteHandler.sendOutput($)}),this.ptyHost.onExit(($)=>{if(this._mode==="remote"&&this.remoteHandler)this.remoteHandler.sendExit($);this.cleanup(),this.events.onExit?.($)})}setupResizeHandler(){let $=()=>{let v=process.stdout.columns??80,G=process.stdout.rows??24;this.ptyHost.resize(v,G)};process.stdout.on("resize",$)}async handleModeSwitch(){if(this.isSwitching)return;if(this._mode==="local")await this.transitionToRemote();else if(this._mode==="remote")await this.transitionToLocal()}async transitionToRemote(){this.isSwitching=!0,this.setMode("transitioning_to_remote"),this.clearScreenAndShowMessage(Y("remote.connecting"));try{this.remoteHandler=V5(this.ptyHost),await this.remoteHandler.connect({onClientConnected:()=>{if(this._mode==="remote")this.remoteHandler?.updateStatusDisplay()},onClientDisconnected:()=>{if(this._mode==="remote")this.remoteHandler?.updateStatusDisplay()},onError:($)=>{this.events.onError?.($)},onDisconnect:()=>{if(this._mode==="remote")console.log(`
62
+ \x1B[33m`+Y("remote.connectionLost")+"\x1B[0m"),this.transitionToLocal()}}),this.clearScreen(),await this.remoteHandler.displayRemoteUI(),this.setMode("remote")}catch($){this.events.onError?.($),this.clearScreenAndShowMessage(Y("remote.failedToConnect",{error:$.message})),await this.sleep(2000),await this.transitionToLocal()}finally{this.isSwitching=!1}}async transitionToLocal(){if(this.isSwitching=!0,this.setMode("transitioning_to_local"),this.remoteHandler)this.remoteHandler.disconnect(),this.remoteHandler=null;process.stdout.write("\x1B[3J\x1B[2J\x1B[H");let $=process.stdout.columns??80,v=process.stdout.rows??24;this.ptyHost.resize($,v),this.setMode("local"),this.isSwitching=!1}async buildLaunchConfig(){let $=this.options.projectPath||process.cwd(),v=await I();if(!v)throw Error("API Key not configured");let G=await x1(this.client);if(!G)G=P1(this.client);if(!await Bun.file(G).exists())throw Error(`Executable not found: ${G}`);let Z,J;if(this.client.runtime==="native")Z=G,J=[];else{if(V1)Z="bun";else Z=await b1();J=[G]}if(this.options.args&&this.options.args.length>0)J.push(...this.options.args);let M=this.client.getEnvVars(v),X={...process.env,...M};return{command:Z,args:J,env:X,cwd:$}}clearScreen(){process.stdout.write("\x1B[3J\x1B[2J\x1B[H")}clearScreenAndShowMessage($){this.clearScreen(),console.log(),console.log(` ${$}`),console.log()}sleep($){return new Promise((v)=>setTimeout(v,$))}cleanup(){if(this.inputHandler.stop(),this.remoteHandler)this.remoteHandler.disconnect(),this.remoteHandler=null}stop(){this.ptyHost.kill(),this.cleanup()}}function _5($,v,G={}){return new N5($,v,G)}k1();w();$4();s();k();async function L1($,v){if(process.platform==="win32"){L.warn(Y("launcher.windowsWarning"));let{launchClient:G}=await Promise.resolve().then(() => (D5(),s5));return await G($,v)}try{let G=v?.projectPath||process.cwd();if(v?.projectPath){if(!await E1(v.projectPath))return{success:!1,error:Y("launcher.directoryNotFound",{path:v.projectPath})}}let b=await j1($);if(!b.success)return b;let Z=await I();if(!Z)return{success:!1,error:Y("launcher.apiKeyNotConfigured")};if($.setupConfigFiles)await $.setupConfigFiles(Z);await N1(G,$.id),L.info(Y("launcher.starting",{client:$.name})),L.info("\x1B[90m"+Y("launcher.ctrlHint")+"\x1B[0m");let J=_5($,{projectPath:G,args:v?.args,cols:process.stdout.columns,rows:process.stdout.rows});return new Promise((M)=>{let X=J.events.onExit;J.events.onExit=(z)=>{X?.(z),M({success:!0,exitCode:z})},J.events.onError=(z)=>{console.error(`\x1B[31m${Y("launcher.error",{message:z.message})}\x1B[0m`)},J.start().catch((z)=>{M({success:!1,error:z.message})})})}catch(G){return{success:!1,error:G instanceof Error?G.message:"Launch failed"}}}s();n4();w();k();import{join as l}from"path";var o4="tako-cli",h1="0.1.47";function _$($,v){let G=$.split(".").map(Number),b=v.split(".").map(Number);for(let Z=0;Z<3;Z++){let J=G[Z]||0,M=b[Z]||0;if(J>M)return 1;if(J<M)return-1}return 0}async function y$(){try{let $=await G1(),v=await fetch(`${$}/${o4}/latest`,{signal:AbortSignal.timeout(5000)});if(!v.ok)return null;return(await v.json()).version||null}catch{return null}}async function R$(){let $=await y$();if(!$)return{hasUpdate:!1,currentVersion:h1};return{hasUpdate:_$($,h1)>0,latestVersion:$,currentVersion:h1}}async function n5(){let $=await import("fs/promises"),v=l(p,"bin"),G=l(v,"tako"),b=l(r,"node_modules/tako-cli/dist/index.js");if(await $.mkdir(v,{recursive:!0}),process.platform==="win32"){let J=`@echo off\r
63
+ "${m}" "${b}" %*\r
64
+ `;await $.writeFile(l(v,"tako.cmd"),J)}else{let J=`#!/bin/bash
65
+ exec "${m}" "${b}" "$@"
66
+ `;await $.writeFile(G,J,{mode:493})}}async function P$($){let v=C();v.start(`\u6B63\u5728\u66F4\u65B0\u5230 v${$}...`);try{let G=await G1(),b=await import("fs/promises");await b.mkdir(r,{recursive:!0});let Z=l(r,"package.json");try{await b.access(Z)}catch{await b.writeFile(Z,JSON.stringify({name:"tako-local",private:!0},null,2))}let J=Bun.spawn([m,"update",o4,"--latest"],{cwd:r,stdout:"pipe",stderr:"pipe",env:{...process.env,BUN_CONFIG_REGISTRY:G}});if(await J.exited,J.exitCode===0)return await n5(),v.stop(`\u66F4\u65B0\u6210\u529F\uFF01\u5DF2\u66F4\u65B0\u5230 v${$}`),!0;else{let M=await new Response(J.stderr).text();return v.stop(`\u66F4\u65B0\u5931\u8D25: ${M||"\u672A\u77E5\u9519\u8BEF"}`),!1}}catch(G){return v.stop(`\u66F4\u65B0\u5931\u8D25: ${G instanceof Error?G.message:"\u672A\u77E5\u9519\u8BEF"}`),!1}}async function I$(){let $=await import("fs/promises"),v=l(r,"bun.lock");try{await $.unlink(v)}catch{}}async function F$(){let $=await import("fs/promises");try{let v=await G1();await $.mkdir(r,{recursive:!0});let G=l(r,"package.json");try{await $.access(G)}catch{await $.writeFile(G,JSON.stringify({name:"tako-local",private:!0},null,2))}await I$();let b=Bun.spawn([m,"add",`${o4}@latest`],{cwd:r,stdout:"pipe",stderr:"pipe",env:{...process.env,BUN_CONFIG_REGISTRY:v}});return await b.exited,b.exitCode===0}catch{return!1}}async function C$(){let $=await import("fs/promises"),v=l(p,"bin"),G=l(v,"tako"),b=l(r,"node_modules/tako-cli/dist/index.js");try{let Z=await $.readFile(G,"utf-8");if(Z.includes("bun run tako-cli")||Z.includes("run tako-cli")){L.info(Y("updater.migrating"));let J=!1;try{await $.access(b),J=!0}catch{J=!1}if(!J){let M=C();if(M.start(Y("updater.installingLocally")),!await F$())return M.stop(Y("updater.migrationFailed")),!1;M.stop(Y("updater.installComplete"))}return await n5(),!0}}catch{}return!1}async function v4(){try{if(await C$())L.info(Y("updater.migrationComplete")),process.exit(0);let v=await R$();if(v.hasUpdate&&v.latestVersion){if(L.warn(Y("updater.newVersionAvailable",{version:v.latestVersion,current:h1})),await P$(v.latestVersion))L.info(Y("updater.pleaseRestart")),process.exit(0)}}catch{}}k();s();$4();k();async function l5(){let $=q2(),v=await I5(),G=process.cwd(),b=[],Z=[...$].sort((J,M)=>{if(J.id===v)return-1;if(M.id===v)return 1;return 0});for(let J of Z){let M=await P5(J.id,d4,!0);b.push({value:{type:"launch",client:J},label:J.name,hint:Y("recentProjects.launchInCurrent")});for(let X of M)b.push({value:{type:"launch-in-project",client:J,projectPath:X.path},label:` \u2514\u2500 ${F5(X.path,35)}`,hint:C5(X.lastLaunchedAt)})}return b.push({value:{type:"exit"},label:"\u2500".repeat(50),hint:""}),b.push({value:{type:"advanced"},label:Y("menu.advanced"),hint:Y("menu.advancedHint")},{value:{type:"exit"},label:Y("menu.exit")}),b}async function e4(){let $=await l5(),v=await f1({message:Y("menu.selectAction"),options:$});if(a(v))return null;return v}async function t4(){let $=await f1({message:Y("menu.advancedOptions"),options:[{value:{type:"stats"},label:Y("menu.viewStats")},{value:{type:"config"},label:Y("menu.configApiKey")},{value:{type:"language"},label:Y("menu.changeLanguage")},{value:null,label:Y("menu.back")}]});if(a($)||$===null)return null;return $}s();i4();k();async function M4($=!1){if(!$)L.warn("API Key not detected"),console.log();let v=await r2({message:Y("prompts.enterApiKey"),placeholder:Y("prompts.apiKeyPlaceholder"),validate(Z){if(!Z)return Y("prompts.enterApiKey");if(!Z.startsWith("cr_"))return Y("prompts.keyInvalidFormat");if(Z.length<10)return Y("prompts.keyInvalidFormat")}});if(a(v))return!1;let G=C();G.start(Y("prompts.validating"));let b=await u5(v);if(b.success)return G.stop(Y("prompts.keyConfigured")),!0;else return G.stop(Y("prompts.keyValidationFailed",{error:b.error||""})),!1}s();w();async function $2(){try{let $=await h2();if(!$)return{success:!1,error:"\u672A\u627E\u5230 API ID\uFF0C\u8BF7\u91CD\u65B0\u914D\u7F6E Key"};let G=await(await fetch(`${c}/apiStats/api/user-stats`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiId:$})})).json(),Z=await(await fetch(`${c}/apiStats/api/user-model-stats`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiId:$,period:"daily"})})).json();if(!G.success)return{success:!1,error:G.error||G.message||"\u83B7\u53D6\u7EDF\u8BA1\u5931\u8D25"};let J=(Z.data||[]).map((M)=>({model:M.model,requests:M.requests,cost:M.formatted?.total||"$0.00"}));return{success:!0,data:{totalRequests:G.data?.usage?.total?.requests||0,totalCost:G.data?.usage?.total?.formattedCost||"$0.00",todayCost:`$${(G.data?.limits?.currentDailyCost||0).toFixed(2)}`,modelStats:J}}}catch($){return{success:!1,error:$ instanceof Error?$.message:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25"}}}function v2($){return $.toLocaleString("en-US")}k();function u$($,v){let G=[];if(G.push(""),G.push(` ${Y("stats.title")}`),G.push(""),G.push(` ${Y("stats.totalRequests",{count:v2($.totalRequests)})}`),G.push(` ${Y("stats.totalCost",{cost:$.totalCost})}`),G.push(` ${Y("stats.todayCost",{cost:$.todayCost})}`),$.modelStats.length>0)G.push(""),G.push(` ${Y("stats.modelDistribution")}`),$.modelStats.forEach((b,Z)=>{let J=Z===$.modelStats.length-1?"\u2514\u2500":"\u251C\u2500",M=b.model.length>25?b.model.slice(0,22)+"...":b.model;G.push(` ${J} ${M.padEnd(25)} ${v2(b.requests).padStart(6)} ${Y("stats.times")} ${b.cost.padStart(8)}`)});return G.push(""),G.push(` \x1B[90m${Y("stats.refreshHint",{countdown:v})}\x1B[0m`),G.join(`
67
+ `)}async function M2(){let v=C();v.start(Y("stats.fetching"));let G=await $2();if(!G.success){v.stop(Y("stats.fetchFailed",{error:G.error||""}));return}v.stop("");let b=10,Z="",J=()=>{if(Z){let X=Z.split(`
68
+ `).length;process.stdout.write(`\x1B[${X}A\x1B[0J`)}Z=u$(G.data,b),console.log(Z)};J();let M=process.stdin.isRaw;if(process.stdin.isTTY)process.stdin.setRawMode(!0);return process.stdin.resume(),new Promise((X)=>{let z=!0,x=()=>{if(!z)return;z=!1,g(),X()},Q=setInterval(async()=>{if(!z)return;if(b--,b<=0){b=10;let q=await $2();if(q.success)G=q}J()},1000),g=()=>{if(clearInterval(Q),process.stdin.removeListener("data",x),process.stdin.isTTY)process.stdin.setRawMode(M??!1);process.stdin.pause()};process.stdin.on("data",x)})}function p$(){let v="\u2500".repeat(70);console.log(),console.log(` \u250C${v}\u2510`);let G=`\uD83D\uDC19 ${Y("cli.version",{version:h1})}`,b=A(G),Z=Math.floor((70-b)/2),J=70-Z-b;console.log(` \u2502${" ".repeat(Z)}${G}${" ".repeat(J)}\u2502`);let M=Y("banner.welcome"),X=`\x1B[90m${M}\x1B[0m`,z=A(M),x=Math.floor((70-z)/2),Q=70-x-z;console.log(` \u2502${" ".repeat(x)}${X}${" ".repeat(Q)}\u2502`),console.log(` \u251C${v}\u2524`);let g=Y("updateAnnouncement.title"),q=A(g),H=Math.floor((70-q)/2),h=70-H-q;console.log(` \u2502${" ".repeat(H)}${g}${" ".repeat(h)}\u2502`);let V=Y("updateAnnouncement.description"),Z1=`\x1B[90m${V}\x1B[0m`,J1=A(V),X1=Math.floor((70-J1)/2),_1=70-X1-J1;console.log(` \u2502${" ".repeat(X1)}${Z1}${" ".repeat(_1)}\u2502`),console.log(` \u2502${" ".repeat(70)}\u2502`);let z1=d1("updateAnnouncement.features");for(let i of z1){let b2=A(i);if(b2<=66){let B1=66-b2;console.log(` \u2502${" ".repeat(2)}\x1B[90m${i}\x1B[0m${" ".repeat(B1+2)}\u2502`)}else{let B1="",Z2=0;for(let J2 of i){let X2=A(J2);if(Z2+X2>66)break;B1+=J2,Z2+=X2}let a5=66-A(B1);console.log(` \u2502${" ".repeat(2)}\x1B[90m${B1}\x1B[0m${" ".repeat(a5+2)}\u2502`)}}console.log(` \u2502${" ".repeat(70)}\u2502`),console.log(` \u2514${v}\u2518`),console.log()}async function c5($){switch($.type){case"launch":{let v=await L1($.client);if(!v.success)L.error(v.error||Y("cli.launchFailed"));return!0}case"launch-in-project":{let v=$.client.continueArg?[$.client.continueArg]:[],G=await L1($.client,{projectPath:$.projectPath,args:v});if(!G.success)L.error(G.error||Y("cli.launchFailed"));return!0}case"advanced":{let v=await t4();if(v)return await c5(v);return!0}case"stats":return await M2(),!0;case"config":return await M4(!0),!0;case"language":return await r$(),!0;case"exit":return!1}}async function r$(){let $=P4(),v=Y(`language.${$}`),G=await f1({message:Y("menu.changeLanguage")+` (${Y("menu.currentLanguage",{lang:v})})`,options:[{value:"en",label:Y("language.en")},{value:"zh",label:Y("language.zh")}]});if(a(G))return;R4(G);let b=Y(`language.${G}`);L.success(Y("menu.languageChanged",{lang:b}))}async function d5(){if(p$(),!await L2()){if(!await M4()){U4("\u518D\u89C1\uFF01");return}}while(!0){let v=await e4();if(v===null)break;if(!await c5(v))break}U4("\u518D\u89C1\uFF01")}d();k();var G2="0.1.47";function s$(){console.log(`
69
+ ${Y("cli.version",{version:G2})}
70
70
 
71
- ${X("cli.usage")}
71
+ ${Y("cli.usage")}
72
72
 
73
- ${X("cli.options")}
74
- ${X("cli.optionVersion")}
75
- ${X("cli.optionHelp")}
73
+ ${Y("cli.options")}
74
+ ${Y("cli.optionVersion")}
75
+ ${Y("cli.optionHelp")}
76
76
 
77
- ${X("cli.shortcuts")}
78
- ${X("cli.shortcutClaude")}
79
- ${X("cli.shortcutCodex")}
77
+ ${Y("cli.shortcuts")}
78
+ ${Y("cli.shortcutClaude")}
79
+ ${Y("cli.shortcutCodex")}
80
80
 
81
- ${X("cli.examples")}
82
- ${X("cli.exampleInteractive")}
83
- ${X("cli.exampleClaude")}
84
- ${X("cli.exampleCodex")}
85
- `)}async function _$(){let $=process.argv.slice(2);if($.includes("-v")||$.includes("--version")){console.log(`Tako CLI v${$2}`);return}if($.includes("-h")||$.includes("--help")){y$();return}let h=$2==="dev";if($.includes("--claude")){let M=g4("claude-code");if(!M)console.error(X("cli.clientNotFound",{client:"Claude Code"})),process.exit(1);if(!h)await e1();let G=await Y1(M);if(!G.success)console.error(G.error),process.exit(1);return}if($.includes("--codex")){let M=g4("codex");if(!M)console.error(X("cli.clientNotFound",{client:"Codex"})),process.exit(1);if(!h)await e1();let G=await Y1(M);if(!G.success)console.error(G.error),process.exit(1);return}if(!h)await e1();await p5()}_$().catch(($)=>{console.error(X("cli.cliError"),$),process.exit(1)});
81
+ ${Y("cli.examples")}
82
+ ${Y("cli.exampleInteractive")}
83
+ ${Y("cli.exampleClaude")}
84
+ ${Y("cli.exampleCodex")}
85
+ `)}async function D$(){let $=process.argv.slice(2);if($.includes("-v")||$.includes("--version")){console.log(`Tako CLI v${G2}`);return}if($.includes("-h")||$.includes("--help")){s$();return}let v=G2==="dev";if($.includes("--claude")){let G=z4("claude-code");if(!G)console.error(Y("cli.clientNotFound",{client:"Claude Code"})),process.exit(1);if(!v)await v4();let b=await L1(G);if(!b.success)console.error(b.error),process.exit(1);return}if($.includes("--codex")){let G=z4("codex");if(!G)console.error(Y("cli.clientNotFound",{client:"Codex"})),process.exit(1);if(!v)await v4();let b=await L1(G);if(!b.success)console.error(b.error),process.exit(1);return}if(!v)await v4();await d5()}D$().catch(($)=>{console.error(Y("cli.cliError"),$),process.exit(1)});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tako-cli",
3
- "version": "0.1.44",
3
+ "version": "0.1.47",
4
4
  "description": "Tako CLI - AI coding tools launcher",
5
5
  "type": "module",
6
6
  "bin": {