tako-cli 0.1.44 → 0.1.46

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 +23 -23
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,19 +1,19 @@
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 r5=Object.create;var{getPrototypeOf:s5,defineProperty:H1,getOwnPropertyNames:v2,getOwnPropertyDescriptor:d5}=Object,M2=Object.prototype.hasOwnProperty;var A=($,h,M)=>{M=$!=null?r5(s5($)):{};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,i5=($)=>{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=d5($,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 c5}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,_,U,B1,c,S1,G2;var w=m(()=>{p=g1(c5(),".tako"),b2=g1(p,"config.json"),v4=g1(p,"tools"),u=g1(p,"cli"),_=g1(p,"bun"),U=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(()=>{w();b4=new Map});var z4=K((G6,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"},h0={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},v0={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:h0,erase:v0,beep:"\x07"}});var x4=K((b6,Y4)=>{var I1=process||{},Y2=I1.argv||[],P1=I1.env||{},M0=!(!!P1.NO_COLOR||Y2.includes("--no-color"))&&(!!P1.FORCE_COLOR||Y2.includes("--color")||I1.platform==="win32"||(I1.stdout||{}).isTTY&&P1.TERM!=="dumb"||!!P1.CI),G0=($,h,M=$)=>(G)=>{let b=""+G,g=b.indexOf(h,$.length);return~g?$+b0(b,h,M,g)+h:$+b+h},b0=($,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=($=M0)=>{let h=$?G0:()=>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 g0}from"tty";function Z0({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(J0,"")}function w2($){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(x0()," ");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(z0.eastAsianWidth(b)){case"F":case"W":G+=2;break;case"A":G+=M;break;default:G+=1}}return G}function E0(){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,`
4
4
  `).split(`
5
- `).map((G)=>L0(G,h,M)).join(`
6
- `)}function f0($,h){if($===h)return;let M=$.split(`
5
+ `).map((G)=>T0(G,h,M)).join(`
6
+ `)}function A0($,h){if($===h)return;let M=$.split(`
7
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(`
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 g0(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&&w0.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
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(`
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=A0(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
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
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]===`
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&&!j0&&$.setRawMode(!1),b.terminal=!1,b.close()}}var O,C1,J0,U2,X0,z0,Y0=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},x0,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,W0,Q0,q0,p1,H0=39,E4="\x07",O2="[",B0="]",m2="m",q4,H2=($)=>`${p1.values().next().value}${O2}${$}${m2}`,B2=($)=>`${p1.values().next().value}${q4}${$}${E4}`,S0=($)=>$.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())},L0=($)=>{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("")},T0=($,h,M={})=>{if(M.trim!==!1&&$.trim()==="")return"";let G="",b,g,v=S0($),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)=>L0(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===H0?void 0:S}else q.uri!==void 0&&(g=q.uri.length===0?void 0:q.uri)}let x=q0.codes.get(Number(b));J[z+1]===`
15
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)}
16
+ `&&(b&&x&&(G+=H2(b)),g&&(G+=B2(g)))}return G},V0,f0=($,h,M)=>(h in $)?V0($,h,{enumerable:!0,configurable:!0,writable:!0,value:M}):$[h]=M,j=($,h,M)=>(f0($,typeof h!="symbol"?h+"":h,M),M),K2,L2,w0,U0,O0=($,h,M)=>(h in $)?U0($,h,{enumerable:!0,configurable:!0,writable:!0,value:M}):$[h]=M,T2=($,h,M)=>(O0($,typeof h!="symbol"?h+"":h,M),M),N2,m0,K0=($,h,M)=>(h in $)?m0($,h,{enumerable:!0,configurable:!0,writable:!0,value:M}):$[h]=M,N0=($,h,M)=>(K0($,typeof h!="symbol"?h+"":h,M),M),B4,j0;var S4=m(()=>{O=A(z4(),1),C1=A(x4(),1);J0=Z0();U2={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}})(U2);X0=U2.exports,z0=w2(X0),x0=w2(Y0);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);W0=Object.keys(H.color),Q0=Object.keys(H.bgColor);[...W0,...Q0];q0=E0(),p1=new Set(["\x1B","\x9B"]),q4=`${B0}8;;`;V0=Object.defineProperty;K2=Symbol("clack:cancel");L2=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),w0=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}},m0=Object.defineProperty;B4=class B4 extends H4{constructor($){super($),N0(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}};j0=globalThis.process.platform.startsWith("win")});import I from"process";function k0(){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,y0,k2,y2,T4,B6,V,u1,_0,R0,S6,L6,T6,V6,f6,A6,w6,U6,P0,I0,F0,C0,_2=($)=>{switch($){case"initial":case"active":return W.default.cyan(y0);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
17
  ${_2(this.state)} ${$.message}
18
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
19
  ${W.default.yellow(V)} ${G}
@@ -21,7 +21,7 @@ ${W.default.yellow(u1)} ${W.default.yellow(this.error)}
21
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
22
  `+W.default.gray(V):""}`;default:return`${h}${W.default.cyan(V)} ${G}
23
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)}
24
+ `}}}).prompt(),T1=($)=>{let h=(G,b)=>{let g=G.label??String(G.value);return b==="active"?`${W.default.green(_0)} ${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(R0)} ${W.default.dim(g)}`},M=0;return new N2({options:$.options,initialValue:$.initialValue,render(){let G=`${W.default.gray(V)}
25
25
  ${_2(this.state)} ${$.message}
26
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
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(`
@@ -32,16 +32,16 @@ ${W.default.gray(u1)} ${$}
32
32
 
33
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
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(`
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=k0(),y0=L("\u25C6","*"),k2=L("\u25A0","x"),y2=L("\u25B2","x"),T4=L("\u25C7","o"),B6=L("\u250C","T"),V=L("\u2502","|"),u1=L("\u2514","\u2014"),_0=L("\u25CF",">"),R0=L("\u25CB"," "),S6=L("\u25FB","[\u2022]"),L6=L("\u25FC","[+]"),T6=L("\u25FB","[ ]"),V6=L("\u25AA","\u2022"),f6=L("\u2500","-"),A6=L("\u256E","+"),w6=L("\u251C","+"),U6=L("\u256F","+"),P0=L("\u25CF","\u2022"),I0=L("\u25C6","*"),F0=L("\u25B2","!"),C0=L("\u25A0","x"),Q={message:($="",{symbol:h=W.default.gray(V)}={})=>{let M=[`${W.default.gray(V)}`];if($){let[G,...b]=$.split(`
36
36
  `);M.push(`${h} ${G}`,...b.map((g)=>`${W.default.gray(V)} ${g}`))}process.stdout.write(`${M.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:($)=>{Q.message($,{symbol:W.default.blue(P0)})},success:($)=>{Q.message($,{symbol:W.default.green(I0)})},step:($)=>{Q.message($,{symbol:W.default.green(T4)})},warn:($)=>{Q.message($,{symbol:W.default.yellow(F0)})},warning:($)=>{Q.warn($)},error:($)=>{Q.message($,{symbol:W.default.red(C0)})}}});function f4($,h){return{type:"register",sessionCode:$,apiKey:h}}function A4($){return{type:"output",data:$}}function w4($){return{type:"exit",code:$}}function u0(){return{type:"ping"}}function r0($){return{type:"input",data:$}}function s0($,h){return{type:"resize",cols:$,rows:h}}function U4($){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 d0($,h){return`${B1.replace("https://","wss://").replace("http://","ws://")}/web-api/ws/client?code=${encodeURIComponent($)}&key=${encodeURIComponent(h)}`}function i0($){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(()=>{w()});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"))},D0);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>l0){console.log("[WS] Heartbeat timeout, triggering reconnect..."),this.ws?.close();return}this.send({type:"ping"})},c0)}stopHeartbeat(){if(this.heartbeatTimer)clearInterval(this.heartbeatTimer),this.heartbeatTimer=null}async attemptReconnect(){if(this.reconnectAttempts>=p2){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),a0);console.log(`[WS] Reconnecting in ${$/1000}s (attempt ${this.reconnectAttempts}/${p2})...`),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=U4($);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(w4($))}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 w1(){return new j4}var c0=30000,l0=60000,p2=10,a0=30000,D0=1e4;var s1=m(()=>{A1()});var r2={};h4(r2,{tArray:()=>c1,t:()=>X,showUpdateAnnouncement:()=>o0,setLocale:()=>k4,getLocale:()=>y4,detectLocale:()=>i1,clearLocaleOverride:()=>n0});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"zh"}function k4($){d1=$}function n0(){d1=null}function X($,h){let M=i1(),G=$.split("."),b=u2;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=u2;for(let b of M)if(G=G?.[b],!G)return[];return G[h]||G.en||[]}function y4(){return i1()}function o0(){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,u2;var N=m(()=>{u2={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+`
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((P6,s2)=>{s2.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}});var c2=K((I6,i2)=>{var t0=_4();function d2($){this.mode=t0.MODE_8BIT_BYTE,this.data=$}d2.prototype={getLength:function(){return this.data.length},write:function($){for(var h=0;h<this.data.length;h++)$.put(this.data.charCodeAt(h),8)}};i2.exports=d2});var R4=K((F6,l2)=>{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;l2.exports=C});var P4=K((C6,a2)=>{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($)}};a2.exports=l1});var n2=K((p6,D2)=>{D2.exports={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7}});var e2=K((u6,t2)=>{var k=_4(),o2=P4(),e0=R4(),n=n2(),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 o2([1],0);for(var M=0;M<$;M++)h=h.multiply(new o2([1,e0.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}};t2.exports=f});var I4=K((r6,$5)=>{$5.exports={L:1,M:0,Q:3,H:2}});var v5=K((s6,h5)=>{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}};h5.exports=s});var b5=K((d6,G5)=>{function M5(){this.buffer=[],this.length=0}M5.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++}};G5.exports=M5});var X5=K((i6,J5)=>{var $$=c2(),o=e2(),h$=P4(),g5=v5(),Z5=b5();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 $$($);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=g5.getRSBlocks($,this.errorCorrectLevel),M=new Z5,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=g5.getRSBlocks($,h),b=new Z5;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 h$(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};J5.exports=d});var x5=K((c6,Y5)=>{var v$=X5(),z5=I4(),M$="\x1B[40m \x1B[0m",D1="\x1B[47m \x1B[0m",G$=function($){return $?M$:D1},F4=function($){return{times:function(h){return Array(h).join($)}}},b$=function($,h){var M=Array($);for(var G=0;G<$;G++)M[G]=h;return M};Y5.exports={error:z5.L,generate:function($,h,M){if(typeof h==="function")M=h,h={};var G=new v$(-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(b$(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
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
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"
43
+ `,G.modules.forEach(function(e){b+=D1,b+=e.map(G$).join(""),b+=D1+`
44
+ `}),b+=T}if(M)M(b);else console.log(b)},setErrorLevel:function($){this.error=z5[$]||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(E5){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 g$(){return!E5}var E5;var n1=m(()=>{E5=process.platform==="win32"});async function X1(){if(o1)return o1;let $=[Z$,J$,X$];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 Z$(){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 J$(){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 X$(){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 z$(){let $=await X1();return p4[$]}async function v1(){return(await z$()).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 q5(){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 Y$($){return $.startsWith(_)}function x$($,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(U).exists())return null;let h=Bun.spawn([U,"--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 S5(){return await d4()!==null}async function W$(){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 Q$(){let $=F();if(!await W$())return Q.error("\u8BF7\u5148\u624B\u52A8\u5B89\u88C5 unzip: apt install unzip / yum install unzip"),!1;await q5(),$.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=U,$.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 E$(){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=U,$.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 L5(){if(await S5())return t=U,!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 Q$()}async function T5(){if(!await L5())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(x$($,H5)>=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 ${H5} \u6216\u66F4\u9AD8\u7248\u672C...`),await E$()}async function M1(){if(t){if(!Y$(t))t=U;return t}if(await S5())return t=U,U;return U}async function V5($){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 q$($){return(await R()).installedClients[$.id]?.version||null}async function f5($){let h=$1($.id),M=s4(h,"package.json");try{return await Bun.file(M).exists()}catch{return!1}}async function A5($){let h=await q$($);if(!h)return!0;let M=await V5($.package);if(!M)return!1;return h!==M}async function B5($,h=!1){let M=F(),G=$1($.id);try{if(!await L5())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 f5($),g=h||await A5($);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 V5($.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 f5($))return await B5($);if(await A5($))return await B5($,!0);return{success:!0}}var t=null,H5="1.3.5";var K1=m(()=>{r();l();w();r4()});import{homedir as H$}from"os";function m5($,h=Date.now()){let M=h-new Date($.lastLaunchedAt).getTime(),G=Math.pow(0.5,M/O5),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:m5(J,v)})).sort((J,z)=>z.score-J.score).slice(0,B$).map(({score:J,...z})=>z);M.recentProjects=Z,await M4(M)}function S$($,h,M=Date.now()){let G=$.clientUsage?.[h];if(G){let b=M-new Date(G.lastAt).getTime(),g=Math.pow(0.5,b/O5),v=Math.log10(G.count+1);return g*0.6+v*0.4}else if($.lastClientId===h)return m5($,M);return 0}async function K5($,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:S$(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 N5(){let h=(await R()).recentProjects||[],M=process.cwd();return h.find((b)=>b.path===M)?.lastClientId||null}function j5($,h=25){let M=H$(),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 k5($){let{t:h}=(N(),i5(r2)),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 B$=50,i4=3,O5=604800000;var t1=m(()=>{w()});function L$($){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 y5($){if(!L$($))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(()=>{w();N()});var _5={};h4(_5,{startRemoteSession:()=>T$,serializeMessage:()=>O4,parseMessage:()=>U4,isValidSessionCode:()=>i0,isPTYSupported:()=>g$,generateSessionCode:()=>V1,createWSClient:()=>w1,createResizeMessage:()=>s0,createRegisterMessage:()=>f4,createPingMessage:()=>u0,createPTYHost:()=>O1,createOutputMessage:()=>A4,createInputMessage:()=>r0,createExitMessage:()=>w4,buildRemoteUrl:()=>f1,buildClientWebSocketUrl:()=>d0,buildCLIWebSocketUrl:()=>N4,RemoteWSClient:()=>j4,PTYHost:()=>C4});async function T$($,h={}){let M=await P();if(!M)throw Error("API key not configured");if(!S1){if(!await T5())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=w1(),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 R5=m(()=>{n1();s1();A1();w();l();K1();A1();n1();s1()});var P5={};h4(P5,{launchClientRemote:()=>f$,launchClient:()=>V$});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"};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 f$($,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(() => (R5(),_5));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 I5=m(()=>{l();w();K1();t1();l4();r()});l();w();var l5={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(l5);l();w();import{homedir as a5}from"os";import{join as Z4}from"path";var J4=Z4(a5(),".codex"),D5=Z4(J4,"config.toml"),n5=Z4(J4,"auth.json"),o5=`model_provider = "crs"
45
45
  model = "gpt-5-codex"
46
46
  model_reasoning_effort = "high"
47
47
  disable_response_storage = true
@@ -53,19 +53,19 @@ 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
+ `,t5=`{
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(`
59
+ `;async function e5($){let h=await import("fs/promises");try{await h.mkdir(J4,{recursive:!0})}catch{}await Bun.write(D5,o5),await Bun.write(n5,t5)}var $0={id:"codex",name:"Codex",package:"@openai/codex",command:"codex",runtime:"bun",continueArg:"--continue",getEnvVars($){return{CRS_OAI_KEY:$}},setupConfigFiles:e5};R1($0);l();r();w();var P2="\x1C",I2="\x03";class F2{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 C2(){return new F2}s1();A1();w();N();var U1=null;class W5{wsClient;ptyHost;sessionCode="";remoteUrl="";_isClientConnected=!1;events={};constructor($){this.ptyHost=$,this.wsClient=w1()}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(!U1)try{U1=await Promise.resolve().then(() => A(x5(),1))}catch{U1=null}if(console.log(),console.log(" \x1B[1;36m"+X("remote.modeTitle")+"\x1B[0m"),console.log(),U1)console.log(),await new Promise(($)=>{U1.generate(this.remoteUrl,{small:!0},(h)=>{let M=h.split(`
60
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
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 Q5($){return new W5($)}n1();l();K1();w();N();class w5{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=C2(),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==="remote"&&$.includes(I2)){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 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=Q5(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 w5($,h,M)}K1();w();t1();r();N();async function Y1($,h){if(process.platform==="win32"){Q.warn(X("launcher.windowsWarning"));let{launchClient:M}=await Promise.resolve().then(() => (I5(),P5));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();w();N();import{join as i}from"path";var a4="tako-cli",x1="0.1.46";function A$($,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 w$(){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 w$();if(!$)return{hasUpdate:!1,currentVersion:x1};return{hasUpdate:A$($,x1)>0,latestVersion:$,currentVersion:x1}}async function F5(){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
+ "${U}" "${G}" %*\r
64
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(`
65
+ exec "${U}" "${G}" "$@"
66
+ `;await $.writeFile(M,g,{mode:493})}}async function O$($){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([U,"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 F5(),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 m$(){let $=await import("fs/promises"),h=i(u,"bun.lock");try{await $.unlink(h)}catch{}}async function K$(){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 m$();let G=Bun.spawn([U,"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 N$(){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 K$())return v.stop(X("updater.migrationFailed")),!1;v.stop(X("updater.installComplete"))}return await F5(),!0}}catch{}return!1}async function e1(){try{if(await N$())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 O$(h.latestVersion))Q.info(X("updater.pleaseRestart")),process.exit(0)}}catch{}}N();r();t1();N();async function C5(){let $=X2(),h=await N5(),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 K5(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 ${j5(Z.path,35)}`,hint:k5(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 C5(),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 y5(h);if(G.success)return M.stop(X("prompts.keyConfigured")),!0;else return M.stop(X("prompts.keyValidationFailed",{error:G.error||""})),!1}r();w();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 j$($,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
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(`
68
+ `).length;process.stdout.write(`\x1B[${Z}A\x1B[0J`)}b=j$(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 k$(){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 p5($){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 p5(h);return!0}case"stats":return await e4(),!0;case"config":return await $4(!0),!0;case"language":return await y$(),!0;case"exit":return!1}}async function y$(){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 u5(){if(k$(),!await Z2()){if(!await $4()){V4("\u518D\u89C1\uFF01");return}}while(!0){let h=await D4();if(h===null)break;if(!await p5(h))break}V4("\u518D\u89C1\uFF01")}l();N();var $2="0.1.46";function _$(){console.log(`
69
69
  ${X("cli.version",{version:$2})}
70
70
 
71
71
  ${X("cli.usage")}
@@ -82,4 +82,4 @@ ${X("cli.examples")}
82
82
  ${X("cli.exampleInteractive")}
83
83
  ${X("cli.exampleClaude")}
84
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)});
85
+ `)}async function R$(){let $=process.argv.slice(2);if($.includes("-v")||$.includes("--version")){console.log(`Tako CLI v${$2}`);return}if($.includes("-h")||$.includes("--help")){_$();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 u5()}R$().catch(($)=>{console.error(X("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.46",
4
4
  "description": "Tako CLI - AI coding tools launcher",
5
5
  "type": "module",
6
6
  "bin": {