fckgit 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +10 -10
- package/package.json +1 -1
package/dist/app.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as e}from"node:module";import{PassThrough as t,Stream as n}from"node:stream";import r,{cwd as i,env as a}from"node:process";import o from"node:os";import{execFileSync as s}from"node:child_process";import*as
|
|
2
|
+
import{createRequire as e}from"node:module";import{PassThrough as t,Stream as n}from"node:stream";import r,{cwd as i,env as a}from"node:process";import o from"node:os";import{execFileSync as s,spawnSync as c}from"node:child_process";import*as l from"node:fs";import u from"node:fs";import d from"node:tty";import{EventEmitter as f}from"node:events";import p from"node:path";var m=Object.create,h=Object.defineProperty,g=Object.getOwnPropertyDescriptor,_=Object.getOwnPropertyNames,v=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty,b=(e,t)=>()=>(e&&(t=e(e=0)),t),x=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),S=(e,t)=>{let n={};for(var r in e)h(n,r,{get:e[r],enumerable:!0});return t||h(n,Symbol.toStringTag,{value:`Module`}),n},C=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=_(t),a=0,o=i.length,s;a<o;a++)s=i[a],!y.call(e,s)&&s!==n&&h(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=g(t,s))||r.enumerable});return e},w=(e,t,n)=>(n=e==null?{}:m(v(e)),C(t||!e||!e.__esModule?h(n,`default`,{value:e,enumerable:!0}):n,e)),T=e(import.meta.url),E=x((e=>{
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
5
5
|
* react.production.js
|
|
@@ -59,7 +59,7 @@ process.env.NODE_ENV!==`production`&&(e.ConcurrentRoot=1,e.ContinuousEventPriori
|
|
|
59
59
|
`,`
|
|
60
60
|
`).split(`
|
|
61
61
|
`).map(e=>Qt(Zt(e),t,n)).join(`
|
|
62
|
-
`)}const en=(e,t,{shell:n,env:r}={})=>s(e,t,{encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`],timeout:500,shell:n,env:r}).trim(),tn=(e,t)=>({columns:Number.parseInt(e,10),rows:Number.parseInt(t,10)}),nn=(e,t)=>{let{columns:n,rows:r}=tn(e,t);if(!(Number.isNaN(n)||Number.isNaN(r))&&!(n===80&&r===24))return{columns:n,rows:r}},rn=()=>{if(r.platform!==`linux`)return!0;try{let e=
|
|
62
|
+
`)}const en=(e,t,{shell:n,env:r}={})=>s(e,t,{encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`],timeout:500,shell:n,env:r}).trim(),tn=(e,t)=>({columns:Number.parseInt(e,10),rows:Number.parseInt(t,10)}),nn=(e,t)=>{let{columns:n,rows:r}=tn(e,t);if(!(Number.isNaN(n)||Number.isNaN(r))&&!(n===80&&r===24))return{columns:n,rows:r}},rn=()=>{if(r.platform!==`linux`)return!0;try{let e=u.readFileSync(`/proc/self/stat`,`utf8`),t=e.lastIndexOf(`) `);if(t===-1)return!1;let n=e.slice(t+2).trim().split(/\s+/),r=Number.parseInt(n[2],10),i=Number.parseInt(n[5],10);return Number.isNaN(r)||Number.isNaN(i)||i<=0?!1:r===i}catch{return!1}};function an(){let{env:e,stdout:t,stderr:n}=r;if(t?.columns&&t?.rows)return tn(t.columns,t.rows);if(n?.columns&&n?.rows)return tn(n.columns,n.rows);if(e.COLUMNS&&e.LINES)return tn(e.COLUMNS,e.LINES);let i={columns:80,rows:24};return r.platform===`win32`?sn()??i:r.platform===`darwin`?on()??sn()??i:on()??sn()??cn()??i}const on=()=>{try{let e=r.platform===`darwin`?u.constants.O_EVTONLY|u.constants.O_NONBLOCK:u.constants.O_NONBLOCK,{columns:t,rows:n}=d.WriteStream(u.openSync(`/dev/tty`,e));return{columns:t,rows:n}}catch{}},sn=()=>{try{let e=en(`tput`,[`cols`],{env:{TERM:`dumb`,...r.env}}),t=en(`tput`,[`lines`],{env:{TERM:`dumb`,...r.env}});if(e&&t)return nn(e,t)}catch{}},cn=()=>{try{if(!rn())return;let e=en(`resize`,[`-u`]).match(/\d+/g);if(e.length===2)return nn(e[0],e[1])}catch{}},ln=e=>{let{columns:t,rows:n}=e;if(t&&n)return{columns:t,rows:n};let r=an();return{columns:t||r.columns||80,rows:n||r.rows||24}};
|
|
63
63
|
/**
|
|
64
64
|
* @license React
|
|
65
65
|
* scheduler.production.js
|
|
@@ -316,7 +316,7 @@ No matching component was found for:
|
|
|
316
316
|
`+n)}function v(e,t,n,r,i,a){if(e.listenerCount(`wsClientError`)){let r=Error(i);Error.captureStackTrace(r,v),e.emit(`wsClientError`,r,n,t)}else _(n,r,i,a)}})),Ti,Ei,Di=b((()=>{Si(),bi(),hi(),_i(),vi(),Ci(),Ti=w(xi(),1),wi(),Ei=Ti.default})),Oi,ki=b((()=>{Di(),Oi=globalThis,Oi.WebSocket||=Ei,Oi.window||=globalThis,Oi.self||=globalThis,Oi.window.__REACT_DEVTOOLS_COMPONENT_FILTERS__=[{type:1,value:7,isEnabled:!0},{type:2,value:`InternalApp`,isEnabled:!0,isValid:!0},{type:2,value:`InternalAppContext`,isEnabled:!0,isValid:!0},{type:2,value:`InternalStdoutContext`,isEnabled:!0,isValid:!0},{type:2,value:`InternalStderrContext`,isEnabled:!0,isValid:!0},{type:2,value:`InternalStdinContext`,isEnabled:!0,isValid:!0},{type:2,value:`InternalFocusContext`,isEnabled:!0,isValid:!0}]})),Ai,ji=b((()=>{Ai={initialize(){},connectToDevTools(){}}})),Mi=S({}),Ni,Pi=b((async()=>{ki(),Di(),ji(),Ni=async()=>new Promise(e=>{let t=new Ei(`ws://localhost:8097`),n=setTimeout(()=>{t.terminate(),e(!1)},2e3);n.unref(),t.on(`open`,()=>{clearTimeout(n),t.terminate(),e(!0)}),t.on(`error`,()=>{clearTimeout(n),t.terminate(),e(!1)})}),await Ni()?(Ai.initialize(),Ai.connectToDevTools()):console.warn(`DEV is set to true, but the React DevTools server is not running. Start it with:
|
|
317
317
|
|
|
318
318
|
$ npx react-devtools
|
|
319
|
-
`)}));if(r.env.DEV===`true`){let e=!1;try{import.meta.resolve(`react-devtools-core`),e=!0}catch{}e&&await Pi().then(()=>Mi)}const Fi=(e,t)=>{if(e===t)return;if(!e)return t;let n={},r=!1;for(let i of Object.keys(e))(!t||!Object.hasOwn(t,i))&&(n[i]=void 0,r=!0);if(t)for(let i of Object.keys(t))t[i]!==e[i]&&(n[i]=t[i],r=!0);return r?n:void 0},Ii=e=>{e?.unsetMeasureFunc(),e?.freeRecursive()};let Li=F.NoEventPriority,Ri;async function zi(){let e=(await import(`node:fs`)).readFileSync(new URL(`../package.json`,import.meta.url),`utf8`),t=JSON.parse(e);return{name:t?.name,version:t?.version}}let Bi={name:`ink`,version:N.version};if(r.env.DEV===`true`)try{let e=await zi();Bi={name:e.name||Bi.name,version:e.version||Bi.version}}catch(e){console.warn(`Failed to load package.json in development mode. Falling back to default renderer metadata.`,e)}var Vi=(0,_n.default)({getRootHostContext:()=>({isInsideText:!1}),prepareForCommit:()=>null,preparePortalMount:()=>null,clearContainer:()=>!1,resetAfterCommit(e){if(typeof e.onComputeLayout==`function`&&e.onComputeLayout(),ti(e),e.staticNode!==e.previousStaticNode&&(e.previousStaticNode=e.staticNode,typeof e.onStaticChange==`function`&&e.onStaticChange()),e.isStaticDirty){e.isStaticDirty=!1,typeof e.onImmediateRender==`function`&&e.onImmediateRender();return}typeof e.onRender==`function`&&e.onRender()},getChildHostContext(e,t){let n=e.isInsideText,r=t===`ink-text`||t===`ink-virtual-text`;return n===r?e:{isInsideText:r}},shouldSetTextContent:()=>!1,createInstance(e,t,n,r){if(r.isInsideText&&e===`ink-box`)throw Error(`<Box> can’t be nested inside <Text> component`);let i=Ur(e===`ink-text`&&r.isInsideText?`ink-virtual-text`:e);for(let[e,r]of Object.entries(t))if(e!==`children`){if(e===`style`){Jr(i,r),i.yogaNode&&di(i.yogaNode,r);continue}if(e===`internal_transform`){i.internal_transform=r;continue}if(e===`internal_static`){Ri=n,i.internal_static=!0,n.isStaticDirty=!0,n.staticNode=i;continue}qr(i,e,r)}return i},createTextInstance(e,t,n){if(!n.isInsideText)throw Error(`Text string "${e}" must be rendered inside <Text> component`);return Yr(e)},resetTextContent(){},hideTextInstance(e){$r(e,``)},unhideTextInstance(e,t){$r(e,t)},getPublicInstance:e=>e,hideInstance(e){e.yogaNode?.setDisplay(I.DISPLAY_NONE)},unhideInstance(e){e.yogaNode?.setDisplay(I.DISPLAY_FLEX)},appendInitialChild:Wr,appendChild:Wr,insertBefore:Gr,finalizeInitialChildren(){return!1},isPrimaryRenderer:!0,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,supportsMicrotasks:!0,scheduleMicrotask:queueMicrotask,scheduleCallback:gn.unstable_scheduleCallback,cancelCallback:gn.unstable_cancelCallback,shouldYield:gn.unstable_shouldYield,now:gn.unstable_now,scheduleTimeout:setTimeout,cancelTimeout:clearTimeout,noTimeout:-1,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},getInstanceFromNode:()=>null,prepareScopeUpdate(){},getInstanceFromScope:()=>null,appendChildToContainer:Wr,insertInContainerBefore:Gr,removeChildFromContainer(e,t){Kr(e,t),Ii(t.yogaNode),t.internal_static&&Ri?.staticNode===t&&(Ri.staticNode=void 0)},commitUpdate(e,t,n,r){Ri&&e.internal_static&&(Ri.isStaticDirty=!0);let i=Fi(n,r),a=Fi(n.style,r.style);if(!(!i&&!a)){if(i)for(let[t,n]of Object.entries(i)){if(t===`style`){Jr(e,n);continue}if(t===`internal_transform`){e.internal_transform=n;continue}if(t===`internal_static`){e.internal_static=!0;continue}qr(e,t,n)}a&&e.yogaNode&&di(e.yogaNode,a,r.style??{})}},commitTextUpdate(e,t,n){$r(e,n)},removeChild(e,t){Kr(e,t),Ii(t.yogaNode),t.internal_static&&Ri?.staticNode===t&&(Ri.staticNode=void 0)},setCurrentUpdatePriority(e){Li=e},getCurrentUpdatePriority:()=>Li,resolveUpdatePriority(){return Li===F.NoEventPriority?F.DefaultEventPriority:Li},maySuspendCommit(){return!0},NotPendingTransition:void 0,HostTransitionContext:(0,N.createContext)(null),resetFormInstance(){},requestPostPaintCallback(){},shouldAttemptEagerTransition(){return!1},trackSchedulerEvent(){},resolveEventType(){return null},resolveEventTimeStamp(){return-1.1},preloadInstance(){return!0},startSuspendingCommit(){},suspendInstance(){},waitForCommitToBeReady(){return null},rendererPackageName:Bi.name,rendererVersion:Bi.version});function Hi(e,t=1,n={}){let{indent:r=` `,includeEmptyLines:i=!1}=n;if(typeof e!=`string`)throw TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``);if(typeof t!=`number`)throw TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if(t<0)throw RangeError(`Expected \`count\` to be at least 0, got \`${t}\``);if(typeof r!=`string`)throw TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r}\``);if(t===0)return e;let a=i?/^/gm:/^(?!\s*$)/gm;return e.replace(a,r.repeat(t))}const Ui=e=>e.getComputedWidth()-e.getComputedPadding(I.EDGE_LEFT)-e.getComputedPadding(I.EDGE_RIGHT)-e.getComputedBorder(I.EDGE_LEFT)-e.getComputedBorder(I.EDGE_RIGHT);var Wi={single:{topLeft:`┌`,top:`─`,topRight:`┐`,right:`│`,bottomRight:`┘`,bottom:`─`,bottomLeft:`└`,left:`│`},double:{topLeft:`╔`,top:`═`,topRight:`╗`,right:`║`,bottomRight:`╝`,bottom:`═`,bottomLeft:`╚`,left:`║`},round:{topLeft:`╭`,top:`─`,topRight:`╮`,right:`│`,bottomRight:`╯`,bottom:`─`,bottomLeft:`╰`,left:`│`},bold:{topLeft:`┏`,top:`━`,topRight:`┓`,right:`┃`,bottomRight:`┛`,bottom:`━`,bottomLeft:`┗`,left:`┃`},singleDouble:{topLeft:`╓`,top:`─`,topRight:`╖`,right:`║`,bottomRight:`╜`,bottom:`─`,bottomLeft:`╙`,left:`║`},doubleSingle:{topLeft:`╒`,top:`═`,topRight:`╕`,right:`│`,bottomRight:`╛`,bottom:`═`,bottomLeft:`╘`,left:`│`},classic:{topLeft:`+`,top:`-`,topRight:`+`,right:`|`,bottomRight:`+`,bottom:`-`,bottomLeft:`+`,left:`|`},arrow:{topLeft:`↘`,top:`↓`,topRight:`↙`,right:`←`,bottomRight:`↖`,bottom:`↑`,bottomLeft:`↗`,left:`→`}};const Gi=(e=0)=>t=>`\u001B[${t+e}m`,Ki=(e=0)=>t=>`\u001B[${38+e};5;${t}m`,qi=(e=0)=>(t,n,r)=>`\u001B[${38+e};2;${t};${n};${r}m`,Ji={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(Ji.modifier);const Yi=Object.keys(Ji.color),Xi=Object.keys(Ji.bgColor);[...Yi,...Xi];function Zi(){let e=new Map;for(let[t,n]of Object.entries(Ji)){for(let[t,r]of Object.entries(n))Ji[t]={open:`\u001B[${r[0]}m`,close:`\u001B[${r[1]}m`},n[t]=Ji[t],e.set(r[0],r[1]);Object.defineProperty(Ji,t,{value:n,enumerable:!1})}return Object.defineProperty(Ji,"codes",{value:e,enumerable:!1}),Ji.color.close=`\x1B[39m`,Ji.bgColor.close=`\x1B[49m`,Ji.color.ansi=Gi(),Ji.color.ansi256=Ki(),Ji.color.ansi16m=qi(),Ji.bgColor.ansi=Gi(10),Ji.bgColor.ansi256=Ki(10),Ji.bgColor.ansi16m=qi(10),Object.defineProperties(Ji,{rgbToAnsi256:{value(e,t,n){return e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(e){let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(e=>e+e).join(``));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:e=>Ji.rgbToAnsi256(...Ji.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,r;if(e>=232)t=((e-232)*10+8)/255,n=t,r=t;else{e-=16;let i=e%36;t=Math.floor(e/36)/5,n=Math.floor(i/6)/5,r=i%6/5}let i=Math.max(t,n,r)*2;if(i===0)return 30;let a=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(t));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>Ji.ansi256ToAnsi(Ji.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>Ji.ansi256ToAnsi(Ji.hexToAnsi256(e)),enumerable:!1}}),Ji}const Qi=Zi();function $i(e,t=globalThis.Deno?globalThis.Deno.args:r.argv){let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,i=t.indexOf(n+e),a=t.indexOf(`--`);return i!==-1&&(a===-1||i<a)}const{env:ea}=r;let ta;$i(`no-color`)||$i(`no-colors`)||$i(`color=false`)||$i(`color=never`)?ta=0:($i(`color`)||$i(`colors`)||$i(`color=true`)||$i(`color=always`))&&(ta=1);function na(){if(`FORCE_COLOR`in ea)return ea.FORCE_COLOR===`true`?1:ea.FORCE_COLOR===`false`?0:ea.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(ea.FORCE_COLOR,10),3)}function ra(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function ia(e,{streamIsTTY:t,sniffFlags:n=!0}={}){let i=na();i!==void 0&&(ta=i);let a=n?ta:i;if(a===0)return 0;if(n){if($i(`color=16m`)||$i(`color=full`)||$i(`color=truecolor`))return 3;if($i(`color=256`))return 2}if(`TF_BUILD`in ea&&`AGENT_NAME`in ea)return 1;if(e&&!t&&a===void 0)return 0;let s=a||0;if(ea.TERM===`dumb`)return s;if(r.platform===`win32`){let e=o.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in ea)return[`GITHUB_ACTIONS`,`GITEA_ACTIONS`,`CIRCLECI`].some(e=>e in ea)?3:[`TRAVIS`,`APPVEYOR`,`GITLAB_CI`,`BUILDKITE`,`DRONE`].some(e=>e in ea)||ea.CI_NAME===`codeship`?1:s;if(`TEAMCITY_VERSION`in ea)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ea.TEAMCITY_VERSION);if(ea.COLORTERM===`truecolor`||ea.TERM===`xterm-kitty`||ea.TERM===`xterm-ghostty`||ea.TERM===`wezterm`)return 3;if(`TERM_PROGRAM`in ea){let e=Number.parseInt((ea.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(ea.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(ea.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(ea.TERM)||`COLORTERM`in ea?1:s}function aa(e,t={}){return ra(ia(e,{streamIsTTY:e&&e.isTTY,...t}))}const oa={stdout:aa({isTTY:u.isatty(1)}),stderr:aa({isTTY:u.isatty(2)})};function sa(e,t,n){let r=e.indexOf(t);if(r===-1)return e;let i=t.length,a=0,o=``;do o+=e.slice(a,r)+t+n,a=r+i,r=e.indexOf(t,a);while(r!==-1);return o+=e.slice(a),o}function ca(e,t,n,r){let i=0,a=``;do{let o=e[r-1]===`\r`;a+=e.slice(i,o?r-1:r)+t+(o?`\r
|
|
319
|
+
`)}));if(r.env.DEV===`true`){let e=!1;try{import.meta.resolve(`react-devtools-core`),e=!0}catch{}e&&await Pi().then(()=>Mi)}const Fi=(e,t)=>{if(e===t)return;if(!e)return t;let n={},r=!1;for(let i of Object.keys(e))(!t||!Object.hasOwn(t,i))&&(n[i]=void 0,r=!0);if(t)for(let i of Object.keys(t))t[i]!==e[i]&&(n[i]=t[i],r=!0);return r?n:void 0},Ii=e=>{e?.unsetMeasureFunc(),e?.freeRecursive()};let Li=F.NoEventPriority,Ri;async function zi(){let e=(await import(`node:fs`)).readFileSync(new URL(`../package.json`,import.meta.url),`utf8`),t=JSON.parse(e);return{name:t?.name,version:t?.version}}let Bi={name:`ink`,version:N.version};if(r.env.DEV===`true`)try{let e=await zi();Bi={name:e.name||Bi.name,version:e.version||Bi.version}}catch(e){console.warn(`Failed to load package.json in development mode. Falling back to default renderer metadata.`,e)}var Vi=(0,_n.default)({getRootHostContext:()=>({isInsideText:!1}),prepareForCommit:()=>null,preparePortalMount:()=>null,clearContainer:()=>!1,resetAfterCommit(e){if(typeof e.onComputeLayout==`function`&&e.onComputeLayout(),ti(e),e.staticNode!==e.previousStaticNode&&(e.previousStaticNode=e.staticNode,typeof e.onStaticChange==`function`&&e.onStaticChange()),e.isStaticDirty){e.isStaticDirty=!1,typeof e.onImmediateRender==`function`&&e.onImmediateRender();return}typeof e.onRender==`function`&&e.onRender()},getChildHostContext(e,t){let n=e.isInsideText,r=t===`ink-text`||t===`ink-virtual-text`;return n===r?e:{isInsideText:r}},shouldSetTextContent:()=>!1,createInstance(e,t,n,r){if(r.isInsideText&&e===`ink-box`)throw Error(`<Box> can’t be nested inside <Text> component`);let i=Ur(e===`ink-text`&&r.isInsideText?`ink-virtual-text`:e);for(let[e,r]of Object.entries(t))if(e!==`children`){if(e===`style`){Jr(i,r),i.yogaNode&&di(i.yogaNode,r);continue}if(e===`internal_transform`){i.internal_transform=r;continue}if(e===`internal_static`){Ri=n,i.internal_static=!0,n.isStaticDirty=!0,n.staticNode=i;continue}qr(i,e,r)}return i},createTextInstance(e,t,n){if(!n.isInsideText)throw Error(`Text string "${e}" must be rendered inside <Text> component`);return Yr(e)},resetTextContent(){},hideTextInstance(e){$r(e,``)},unhideTextInstance(e,t){$r(e,t)},getPublicInstance:e=>e,hideInstance(e){e.yogaNode?.setDisplay(I.DISPLAY_NONE)},unhideInstance(e){e.yogaNode?.setDisplay(I.DISPLAY_FLEX)},appendInitialChild:Wr,appendChild:Wr,insertBefore:Gr,finalizeInitialChildren(){return!1},isPrimaryRenderer:!0,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,supportsMicrotasks:!0,scheduleMicrotask:queueMicrotask,scheduleCallback:gn.unstable_scheduleCallback,cancelCallback:gn.unstable_cancelCallback,shouldYield:gn.unstable_shouldYield,now:gn.unstable_now,scheduleTimeout:setTimeout,cancelTimeout:clearTimeout,noTimeout:-1,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},getInstanceFromNode:()=>null,prepareScopeUpdate(){},getInstanceFromScope:()=>null,appendChildToContainer:Wr,insertInContainerBefore:Gr,removeChildFromContainer(e,t){Kr(e,t),Ii(t.yogaNode),t.internal_static&&Ri?.staticNode===t&&(Ri.staticNode=void 0)},commitUpdate(e,t,n,r){Ri&&e.internal_static&&(Ri.isStaticDirty=!0);let i=Fi(n,r),a=Fi(n.style,r.style);if(!(!i&&!a)){if(i)for(let[t,n]of Object.entries(i)){if(t===`style`){Jr(e,n);continue}if(t===`internal_transform`){e.internal_transform=n;continue}if(t===`internal_static`){e.internal_static=!0;continue}qr(e,t,n)}a&&e.yogaNode&&di(e.yogaNode,a,r.style??{})}},commitTextUpdate(e,t,n){$r(e,n)},removeChild(e,t){Kr(e,t),Ii(t.yogaNode),t.internal_static&&Ri?.staticNode===t&&(Ri.staticNode=void 0)},setCurrentUpdatePriority(e){Li=e},getCurrentUpdatePriority:()=>Li,resolveUpdatePriority(){return Li===F.NoEventPriority?F.DefaultEventPriority:Li},maySuspendCommit(){return!0},NotPendingTransition:void 0,HostTransitionContext:(0,N.createContext)(null),resetFormInstance(){},requestPostPaintCallback(){},shouldAttemptEagerTransition(){return!1},trackSchedulerEvent(){},resolveEventType(){return null},resolveEventTimeStamp(){return-1.1},preloadInstance(){return!0},startSuspendingCommit(){},suspendInstance(){},waitForCommitToBeReady(){return null},rendererPackageName:Bi.name,rendererVersion:Bi.version});function Hi(e,t=1,n={}){let{indent:r=` `,includeEmptyLines:i=!1}=n;if(typeof e!=`string`)throw TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``);if(typeof t!=`number`)throw TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if(t<0)throw RangeError(`Expected \`count\` to be at least 0, got \`${t}\``);if(typeof r!=`string`)throw TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r}\``);if(t===0)return e;let a=i?/^/gm:/^(?!\s*$)/gm;return e.replace(a,r.repeat(t))}const Ui=e=>e.getComputedWidth()-e.getComputedPadding(I.EDGE_LEFT)-e.getComputedPadding(I.EDGE_RIGHT)-e.getComputedBorder(I.EDGE_LEFT)-e.getComputedBorder(I.EDGE_RIGHT);var Wi={single:{topLeft:`┌`,top:`─`,topRight:`┐`,right:`│`,bottomRight:`┘`,bottom:`─`,bottomLeft:`└`,left:`│`},double:{topLeft:`╔`,top:`═`,topRight:`╗`,right:`║`,bottomRight:`╝`,bottom:`═`,bottomLeft:`╚`,left:`║`},round:{topLeft:`╭`,top:`─`,topRight:`╮`,right:`│`,bottomRight:`╯`,bottom:`─`,bottomLeft:`╰`,left:`│`},bold:{topLeft:`┏`,top:`━`,topRight:`┓`,right:`┃`,bottomRight:`┛`,bottom:`━`,bottomLeft:`┗`,left:`┃`},singleDouble:{topLeft:`╓`,top:`─`,topRight:`╖`,right:`║`,bottomRight:`╜`,bottom:`─`,bottomLeft:`╙`,left:`║`},doubleSingle:{topLeft:`╒`,top:`═`,topRight:`╕`,right:`│`,bottomRight:`╛`,bottom:`═`,bottomLeft:`╘`,left:`│`},classic:{topLeft:`+`,top:`-`,topRight:`+`,right:`|`,bottomRight:`+`,bottom:`-`,bottomLeft:`+`,left:`|`},arrow:{topLeft:`↘`,top:`↓`,topRight:`↙`,right:`←`,bottomRight:`↖`,bottom:`↑`,bottomLeft:`↗`,left:`→`}};const Gi=(e=0)=>t=>`\u001B[${t+e}m`,Ki=(e=0)=>t=>`\u001B[${38+e};5;${t}m`,qi=(e=0)=>(t,n,r)=>`\u001B[${38+e};2;${t};${n};${r}m`,Ji={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(Ji.modifier);const Yi=Object.keys(Ji.color),Xi=Object.keys(Ji.bgColor);[...Yi,...Xi];function Zi(){let e=new Map;for(let[t,n]of Object.entries(Ji)){for(let[t,r]of Object.entries(n))Ji[t]={open:`\u001B[${r[0]}m`,close:`\u001B[${r[1]}m`},n[t]=Ji[t],e.set(r[0],r[1]);Object.defineProperty(Ji,t,{value:n,enumerable:!1})}return Object.defineProperty(Ji,"codes",{value:e,enumerable:!1}),Ji.color.close=`\x1B[39m`,Ji.bgColor.close=`\x1B[49m`,Ji.color.ansi=Gi(),Ji.color.ansi256=Ki(),Ji.color.ansi16m=qi(),Ji.bgColor.ansi=Gi(10),Ji.bgColor.ansi256=Ki(10),Ji.bgColor.ansi16m=qi(10),Object.defineProperties(Ji,{rgbToAnsi256:{value(e,t,n){return e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(e){let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(e=>e+e).join(``));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:e=>Ji.rgbToAnsi256(...Ji.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,r;if(e>=232)t=((e-232)*10+8)/255,n=t,r=t;else{e-=16;let i=e%36;t=Math.floor(e/36)/5,n=Math.floor(i/6)/5,r=i%6/5}let i=Math.max(t,n,r)*2;if(i===0)return 30;let a=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(t));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>Ji.ansi256ToAnsi(Ji.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>Ji.ansi256ToAnsi(Ji.hexToAnsi256(e)),enumerable:!1}}),Ji}const Qi=Zi();function $i(e,t=globalThis.Deno?globalThis.Deno.args:r.argv){let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,i=t.indexOf(n+e),a=t.indexOf(`--`);return i!==-1&&(a===-1||i<a)}const{env:ea}=r;let ta;$i(`no-color`)||$i(`no-colors`)||$i(`color=false`)||$i(`color=never`)?ta=0:($i(`color`)||$i(`colors`)||$i(`color=true`)||$i(`color=always`))&&(ta=1);function na(){if(`FORCE_COLOR`in ea)return ea.FORCE_COLOR===`true`?1:ea.FORCE_COLOR===`false`?0:ea.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(ea.FORCE_COLOR,10),3)}function ra(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function ia(e,{streamIsTTY:t,sniffFlags:n=!0}={}){let i=na();i!==void 0&&(ta=i);let a=n?ta:i;if(a===0)return 0;if(n){if($i(`color=16m`)||$i(`color=full`)||$i(`color=truecolor`))return 3;if($i(`color=256`))return 2}if(`TF_BUILD`in ea&&`AGENT_NAME`in ea)return 1;if(e&&!t&&a===void 0)return 0;let s=a||0;if(ea.TERM===`dumb`)return s;if(r.platform===`win32`){let e=o.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in ea)return[`GITHUB_ACTIONS`,`GITEA_ACTIONS`,`CIRCLECI`].some(e=>e in ea)?3:[`TRAVIS`,`APPVEYOR`,`GITLAB_CI`,`BUILDKITE`,`DRONE`].some(e=>e in ea)||ea.CI_NAME===`codeship`?1:s;if(`TEAMCITY_VERSION`in ea)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ea.TEAMCITY_VERSION);if(ea.COLORTERM===`truecolor`||ea.TERM===`xterm-kitty`||ea.TERM===`xterm-ghostty`||ea.TERM===`wezterm`)return 3;if(`TERM_PROGRAM`in ea){let e=Number.parseInt((ea.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(ea.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(ea.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(ea.TERM)||`COLORTERM`in ea?1:s}function aa(e,t={}){return ra(ia(e,{streamIsTTY:e&&e.isTTY,...t}))}const oa={stdout:aa({isTTY:d.isatty(1)}),stderr:aa({isTTY:d.isatty(2)})};function sa(e,t,n){let r=e.indexOf(t);if(r===-1)return e;let i=t.length,a=0,o=``;do o+=e.slice(a,r)+t+n,a=r+i,r=e.indexOf(t,a);while(r!==-1);return o+=e.slice(a),o}function ca(e,t,n,r){let i=0,a=``;do{let o=e[r-1]===`\r`;a+=e.slice(i,o?r-1:r)+t+(o?`\r
|
|
320
320
|
`:`
|
|
321
321
|
`)+n,i=r+1,r=e.indexOf(`
|
|
322
322
|
`,i)}while(r!==-1);return a+=e.slice(i),a}const{stdout:la,stderr:ua}=oa,da=Symbol(`GENERATOR`),fa=Symbol(`STYLER`),pa=Symbol(`IS_EMPTY`),ma=[`ansi`,`ansi`,`ansi256`,`ansi16m`],ha=Object.create(null),ga=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let n=la?la.level:0;e.level=t.level===void 0?n:t.level},_a=e=>{let t=(...e)=>e.join(` `);return ga(t,e),Object.setPrototypeOf(t,va.prototype),t};function va(e){return _a(e)}Object.setPrototypeOf(va.prototype,Function.prototype);for(let[e,t]of Object.entries(Qi))ha[e]={get(){let n=Sa(this,xa(t.open,t.close,this[fa]),this[pa]);return Object.defineProperty(this,e,{value:n}),n}};ha.visible={get(){let e=Sa(this,this[fa],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const ya=(e,t,n,...r)=>e===`rgb`?t===`ansi16m`?Qi[n].ansi16m(...r):t===`ansi256`?Qi[n].ansi256(Qi.rgbToAnsi256(...r)):Qi[n].ansi(Qi.rgbToAnsi(...r)):e===`hex`?ya(`rgb`,t,n,...Qi.hexToRgb(...r)):Qi[n][e](...r);for(let e of[`rgb`,`hex`,`ansi256`]){ha[e]={get(){let{level:t}=this;return function(...n){let r=xa(ya(e,ma[t],`color`,...n),Qi.color.close,this[fa]);return Sa(this,r,this[pa])}}};let t=`bg`+e[0].toUpperCase()+e.slice(1);ha[t]={get(){let{level:t}=this;return function(...n){let r=xa(ya(e,ma[t],`bgColor`,...n),Qi.bgColor.close,this[fa]);return Sa(this,r,this[pa])}}}}const ba=Object.defineProperties(()=>{},{...ha,level:{enumerable:!0,get(){return this[da].level},set(e){this[da].level=e}}}),xa=(e,t,n)=>{let r,i;return n===void 0?(r=e,i=t):(r=n.openAll+e,i=t+n.closeAll),{open:e,close:t,openAll:r,closeAll:i,parent:n}},Sa=(e,t,n)=>{let r=(...e)=>Ca(r,e.length===1?``+e[0]:e.join(` `));return Object.setPrototypeOf(r,ba),r[da]=e,r[fa]=t,r[pa]=n,r},Ca=(e,t)=>{if(e.level<=0||!t)return e[pa]?``:t;let n=e[fa];if(n===void 0)return t;let{openAll:r,closeAll:i}=n;if(t.includes(`\x1B`))for(;n!==void 0;)t=sa(t,n.close,n.open),n=n.parent;let a=t.indexOf(`
|
|
@@ -337,12 +337,12 @@ $ npx react-devtools
|
|
|
337
337
|
`),v=[];if(v.push(g),m<h){let e=+!!r.endsWith(`
|
|
338
338
|
`);v.push(ae(h-m+e),re(m))}else v.push(re(n.length-1));for(let e=0;e<m;e++){let t=e===m-1;if(p[e]===n[e]){(!t||_)&&v.push(`\x1B[E`);continue}v.push(M(0)+p[e]+`\x1B[K`+(t&&!_?``:`
|
|
339
339
|
`))}let y=co(m,d);return v.push(y),e.write(v.join(``)),c=d!==void 0,s=d?{...d}:void 0,r=a,n=p,!0};return d.clear=()=>{let t=fo(c,n.length,s);e.write(t+ae(n.length)),r=``,n=[],s=void 0,c=!1},d.done=()=>{r=``,n=[],s=void 0,c=!1,t||(go.show(e),i=!1)},d.reset=()=>{r=``,n=[],s=void 0,c=!1},d.sync=t=>{let i=o?a:void 0;o=!1;let l=t.split(`
|
|
340
|
-
`);r=t,n=l,!i&&c&&e.write(oo),i&&e.write(co(_o(l,t),i)),s=i?{...i}:void 0,c=i!==void 0},d.setCursorPosition=e=>{a=e,o=!0},d.isCursorDirty=()=>o,d.willRender=e=>u(e,l()),d},bo={create:(e,{showCursor:t=!1,incremental:n=!1}={})=>n?yo(e,{showCursor:t}):vo(e,{showCursor:t})},xo=`\x1B[?2026h`,So=`\x1B[?2026l`;function Co(e,t){return`isTTY`in e&&e.isTTY&&(t??!fe)}const wo=new WeakMap,To=`\x1B[200~`,Eo=e=>e>=48&&e<=63,Do=e=>e>=32&&e<=47,Oo=e=>e>=64&&e<=126,ko=(e,t,n)=>{let r=t+n+1,i=r;for(;i<e.length;i++){let n=e.codePointAt(i);if(n===void 0)return`pending`;if(!(Eo(n)||Do(n))&&!(n===91&&i===r))return Oo(n)?{sequence:e.slice(t,i+1),nextIndex:i+1}:void 0}return`pending`},Ao=(e,t,n)=>{let r=t+n+2;if(r>e.length)return`pending`;let i=e.codePointAt(r-1);if(!(i===void 0||!Oo(i)))return{sequence:e.slice(t,r),nextIndex:r}},jo=(e,t,n)=>{let r=e[t+n];if(r===void 0)return`pending`;if(r===`[`)return ko(e,t,n);if(r===`O`)return Ao(e,t,n)},Mo=(e,t)=>{let n=e.codePointAt(t+1),r=n!==void 0&&n>65535?2:1,i=t+1+r;return{sequence:e.slice(t,i),nextIndex:i}},No=(e,t)=>{if(t===e.length-1)return`pending`;if(e[t+1]===`\x1B`){if(t+2>=e.length)return`pending`;let n=jo(e,t,2);return n===`pending`?`pending`:n||{sequence:e.slice(t,t+2),nextIndex:t+2}}let n=jo(e,t,1);return n===`pending`?`pending`:n||Mo(e,t)},Po=(e,t)=>{let n=0;for(let r=0;r<e.length;r++){let i=e[r];(i===``||i===`\b`)&&(r>n&&t.push(e.slice(n,r)),t.push(i),n=r+1)}n<e.length&&t.push(e.slice(n))},Fo=e=>{let t=[],n=0,r=n=>({events:t,pending:e.slice(n)});for(;n<e.length;){let i=e.indexOf(`\x1B`,n);if(i===-1)return Po(e.slice(n),t),{events:t,pending:``};i>n&&Po(e.slice(n,i),t);let a=No(e,i);if(a===`pending`)return r(i);if(a.sequence===To){let o=a.nextIndex,s=e.indexOf(`\x1B[201~`,o);if(s===-1)return r(i);t.push({paste:e.slice(o,s)}),n=s+6;continue}t.push(a.sequence),n=a.nextIndex}return{events:t,pending:``}},Io=()=>{let e=``;return{push(t){let n=Fo(e+t);return e=n.pending,n.events},hasPendingEscape(){return e.startsWith(`\x1B`)&&!e.startsWith(To)&&e!==`\x1B[200`},flushPendingEscape(){if(!e.startsWith(`\x1B`))return;let t=e;return e=``,t},reset(){e=``}}},Lo={async resume(){},async[Symbol.asyncDispose](){}},Ro=(0,N.createContext)({exit(e){},async waitUntilRenderFlush(){},suspendTerminal:(async e=>{if(e){await e();return}return Lo})});Ro.displayName=`InternalAppContext`;const zo=(0,N.createContext)({stdin:r.stdin,internal_eventEmitter:new
|
|
340
|
+
`);r=t,n=l,!i&&c&&e.write(oo),i&&e.write(co(_o(l,t),i)),s=i?{...i}:void 0,c=i!==void 0},d.setCursorPosition=e=>{a=e,o=!0},d.isCursorDirty=()=>o,d.willRender=e=>u(e,l()),d},bo={create:(e,{showCursor:t=!1,incremental:n=!1}={})=>n?yo(e,{showCursor:t}):vo(e,{showCursor:t})},xo=`\x1B[?2026h`,So=`\x1B[?2026l`;function Co(e,t){return`isTTY`in e&&e.isTTY&&(t??!fe)}const wo=new WeakMap,To=`\x1B[200~`,Eo=e=>e>=48&&e<=63,Do=e=>e>=32&&e<=47,Oo=e=>e>=64&&e<=126,ko=(e,t,n)=>{let r=t+n+1,i=r;for(;i<e.length;i++){let n=e.codePointAt(i);if(n===void 0)return`pending`;if(!(Eo(n)||Do(n))&&!(n===91&&i===r))return Oo(n)?{sequence:e.slice(t,i+1),nextIndex:i+1}:void 0}return`pending`},Ao=(e,t,n)=>{let r=t+n+2;if(r>e.length)return`pending`;let i=e.codePointAt(r-1);if(!(i===void 0||!Oo(i)))return{sequence:e.slice(t,r),nextIndex:r}},jo=(e,t,n)=>{let r=e[t+n];if(r===void 0)return`pending`;if(r===`[`)return ko(e,t,n);if(r===`O`)return Ao(e,t,n)},Mo=(e,t)=>{let n=e.codePointAt(t+1),r=n!==void 0&&n>65535?2:1,i=t+1+r;return{sequence:e.slice(t,i),nextIndex:i}},No=(e,t)=>{if(t===e.length-1)return`pending`;if(e[t+1]===`\x1B`){if(t+2>=e.length)return`pending`;let n=jo(e,t,2);return n===`pending`?`pending`:n||{sequence:e.slice(t,t+2),nextIndex:t+2}}let n=jo(e,t,1);return n===`pending`?`pending`:n||Mo(e,t)},Po=(e,t)=>{let n=0;for(let r=0;r<e.length;r++){let i=e[r];(i===``||i===`\b`)&&(r>n&&t.push(e.slice(n,r)),t.push(i),n=r+1)}n<e.length&&t.push(e.slice(n))},Fo=e=>{let t=[],n=0,r=n=>({events:t,pending:e.slice(n)});for(;n<e.length;){let i=e.indexOf(`\x1B`,n);if(i===-1)return Po(e.slice(n),t),{events:t,pending:``};i>n&&Po(e.slice(n,i),t);let a=No(e,i);if(a===`pending`)return r(i);if(a.sequence===To){let o=a.nextIndex,s=e.indexOf(`\x1B[201~`,o);if(s===-1)return r(i);t.push({paste:e.slice(o,s)}),n=s+6;continue}t.push(a.sequence),n=a.nextIndex}return{events:t,pending:``}},Io=()=>{let e=``;return{push(t){let n=Fo(e+t);return e=n.pending,n.events},hasPendingEscape(){return e.startsWith(`\x1B`)&&!e.startsWith(To)&&e!==`\x1B[200`},flushPendingEscape(){if(!e.startsWith(`\x1B`))return;let t=e;return e=``,t},reset(){e=``}}},Lo={async resume(){},async[Symbol.asyncDispose](){}},Ro=(0,N.createContext)({exit(e){},async waitUntilRenderFlush(){},suspendTerminal:(async e=>{if(e){await e();return}return Lo})});Ro.displayName=`InternalAppContext`;const zo=(0,N.createContext)({stdin:r.stdin,internal_eventEmitter:new f,setRawMode(){},setBracketedPasteMode(){},isRawModeSupported:!1,internal_exitOnCtrlC:!0});zo.displayName=`InternalStdinContext`;const Bo=(0,N.createContext)({stdout:r.stdout,write(){}});Bo.displayName=`InternalStdoutContext`;const Vo=(0,N.createContext)({stderr:r.stderr,write(){}});Vo.displayName=`InternalStderrContext`;const Ho=(0,N.createContext)({activeId:void 0,add(){},remove(){},activate(){},deactivate(){},enableFocus(){},disableFocus(){},focusNext(){},focusPrevious(){},focus(){}});Ho.displayName=`InternalFocusContext`;const Uo=(0,N.createContext)({renderThrottleMs:0,subscribe(){return{startTime:0,unsubscribe(){}}}});Uo.displayName=`InternalAnimationContext`;const Wo=(0,N.createContext)({setCursorPosition(){}});Wo.displayName=`InternalCursorContext`;var Go=x(((e,t)=>{let n=/[|\\{}()[\]^$+*?.-]/g;t.exports=e=>{if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(n,`\\$&`)}})),Ko=w(x(((e,t)=>{let n=Go(),r=typeof process==`object`&&process&&typeof process.cwd==`function`?process.cwd():`.`,i=[].concat(T(`module`).builtinModules,`bootstrap_node`,`node`).map(e=>RegExp(`(?:\\((?:node:)?${e}(?:\\.js)?:\\d+:\\d+\\)$|^\\s*at (?:node:)?${e}(?:\\.js)?:\\d+:\\d+$)`));i.push(/\((?:node:)?internal\/[^:]+:\d+:\d+\)$/,/\s*at (?:node:)?internal\/[^:]+:\d+:\d+$/,/\/\.node-spawn-wrap-\w+-\w+\/node:\d+:\d+\)?$/);var a=class e{constructor(t){t={ignoredPackages:[],...t},`internals`in t||(t.internals=e.nodeInternals()),`cwd`in t||(t.cwd=r),this._cwd=t.cwd.replace(/\\/g,`/`),this._internals=[].concat(t.internals,s(t.ignoredPackages)),this._wrapCallSite=t.wrapCallSite||!1}static nodeInternals(){return[...i]}clean(e,t=0){t=` `.repeat(t),Array.isArray(e)||(e=e.split(`
|
|
341
341
|
`)),!/^\s*at /.test(e[0])&&/^\s*at /.test(e[1])&&(e=e.slice(1));let n=!1,r=null,i=[];return e.forEach(e=>{if(e=e.replace(/\\/g,`/`),this._internals.some(t=>t.test(e)))return;let t=/^\s*at /.test(e);n?e=e.trimEnd().replace(/^(\s+)at /,`$1`):(e=e.trim(),t&&(e=e.slice(3))),e=e.replace(`${this._cwd}/`,``),e&&(t?(r&&=(i.push(r),null),i.push(e)):(n=!0,r=e))}),i.map(e=>`${t}${e}\n`).join(``)}captureString(e,t=this.captureString){typeof e==`function`&&(t=e,e=1/0);let{stackTraceLimit:n}=Error;e&&(Error.stackTraceLimit=e);let r={};Error.captureStackTrace(r,t);let{stack:i}=r;return Error.stackTraceLimit=n,this.clean(i)}capture(e,t=this.capture){typeof e==`function`&&(t=e,e=1/0);let{prepareStackTrace:n,stackTraceLimit:r}=Error;Error.prepareStackTrace=(e,t)=>this._wrapCallSite?t.map(this._wrapCallSite):t,e&&(Error.stackTraceLimit=e);let i={};Error.captureStackTrace(i,t);let{stack:a}=i;return Object.assign(Error,{prepareStackTrace:n,stackTraceLimit:r}),a}at(e=this.at){let[t]=this.capture(1,e);if(!t)return{};let n={line:t.getLineNumber(),column:t.getColumnNumber()};o(n,t.getFileName(),this._cwd),t.isConstructor()&&Object.defineProperty(n,"constructor",{value:!0,configurable:!0}),t.isEval()&&(n.evalOrigin=t.getEvalOrigin()),t.isNative()&&(n.native=!0);let r;try{r=t.getTypeName()}catch{}r&&r!==`Object`&&r!==`[object Object]`&&(n.type=r);let i=t.getFunctionName();i&&(n.function=i);let a=t.getMethodName();return a&&i!==a&&(n.method=a),n}parseLine(e){let t=e&&e.match(c);if(!t)return null;let n=t[1]===`new`,r=t[2],i=t[3],a=t[4],s=Number(t[5]),u=Number(t[6]),d=t[7],f=t[8],p=t[9],m=t[10]===`native`,h=t[11]===`)`,g,_={};if(f&&(_.line=Number(f)),p&&(_.column=Number(p)),h&&d){let e=0;for(let t=d.length-1;t>0;t--)if(d.charAt(t)===`)`)e++;else if(d.charAt(t)===`(`&&d.charAt(t-1)===` `&&(e--,e===-1&&d.charAt(t-1)===` `)){let e=d.slice(0,t-1);d=d.slice(t+1),r+=` (${e}`;break}}if(r){let e=r.match(l);e&&(r=e[1],g=e[2])}return o(_,d,this._cwd),n&&Object.defineProperty(_,"constructor",{value:!0,configurable:!0}),i&&(_.evalOrigin=i,_.evalLine=s,_.evalColumn=u,_.evalFile=a&&a.replace(/\\/g,`/`)),m&&(_.native=!0),r&&(_.function=r),g&&r!==g&&(_.method=g),_}};function o(e,t,n){t&&(t=t.replace(/\\/g,`/`),t.startsWith(`${n}/`)&&(t=t.slice(n.length+1)),e.file=t)}function s(e){if(e.length===0)return[];let t=e.map(e=>n(e));return RegExp(`[\/\\\\]node_modules[\/\\\\](?:${t.join(`|`)})[\/\\\\][^:]+:\\d+:\\d+`)}let c=RegExp(`^(?:\\s*at )?(?:(new) )?(?:(.*?) \\()?(?:eval at ([^ ]+) \\((.+?):(\\d+):(\\d+)\\), )?(?:(.+?):(\\d+):(\\d+)|(native))(\\)?)$`),l=/^(.*?) \[as (.*?)\]$/;t.exports=a}))(),1);const qo=(e,t=2)=>e.replace(/^\t+/gm,e=>` `.repeat(e.length*t)),Jo=(e,t)=>{let n=[],r=e-t,i=e+t;for(let e=r;e<=i;e++)n.push(e);return n},Yo=(e,t,n={})=>{if(typeof e!=`string`)throw TypeError(`Source code is missing.`);if(!t||t<1)throw TypeError("Line number must start from `1`.");let r=qo(e).split(/\r?\n/);if(!(t>r.length))return Jo(t,n.around??3).filter(e=>r[e-1]!==void 0).map(e=>({line:e,value:r[e-1]}))},Xo=(0,N.createContext)({isScreenReaderEnabled:!1}),Zo=(0,N.createContext)(void 0),Qo=(0,N.forwardRef)(({children:e,backgroundColor:t,"aria-label":n,"aria-hidden":r,"aria-role":i,"aria-state":a,...o},s)=>{let{isScreenReaderEnabled:c}=(0,N.useContext)(Xo),l=n?N.createElement(`ink-text`,null,n):void 0;if(c&&r)return null;let u=N.createElement(`ink-box`,{ref:s,style:{flexWrap:`nowrap`,flexDirection:`row`,flexGrow:0,flexShrink:1,...o,backgroundColor:t,overflowX:o.overflowX??o.overflow??`visible`,overflowY:o.overflowY??o.overflow??`visible`},internal_accessibility:{role:i,state:a}},c&&l?l:e);return t?N.createElement(Zo.Provider,{value:t},u):u});Qo.displayName=`Box`;function $o({color:e,backgroundColor:t,dimColor:n=!1,bold:r=!1,italic:i=!1,underline:a=!1,strikethrough:o=!1,inverse:s=!1,wrap:c=`wrap`,children:l,"aria-label":u,"aria-hidden":d=!1}){let{isScreenReaderEnabled:f}=(0,N.useContext)(Xo),p=(0,N.useContext)(Zo),m=f&&u?u:l;return m==null||f&&d?null:N.createElement(`ink-text`,{style:{flexGrow:0,flexShrink:1,flexDirection:`row`,textWrap:c},internal_transform:c=>{n&&(c=wa.dim(c)),e&&(c=Oa(c,e,`foreground`));let l=t??p;return l&&(c=Oa(c,l,`background`)),r&&(c=wa.bold(c)),i&&(c=wa.italic(c)),a&&(c=wa.underline(c)),o&&(c=wa.strikethrough(c)),s&&(c=wa.inverse(c)),c}},m)}const es=e=>e?.replace(`file://${i()}/`,``),ts=new Ko.default({cwd:i(),internals:Ko.default.nodeInternals()});function ns({error:e}){let t=e.stack?e.stack.split(`
|
|
342
|
-
`).slice(1):void 0,n=t?ts.parseLine(t[0]):void 0,r=es(n?.file),i,a=0,o=new Map;if(r&&n?.line&&
|
|
343
|
-
`).slice(1).map(e=>{let t=ts.parseLine(e),n=o.get(e)??0;o.set(e,n+1);let r=`${e}-${n}`;return!t?.file||!t.line||!t.column?N.createElement(Qo,{key:r},N.createElement($o,{dimColor:!0},`- `),N.createElement($o,{dimColor:!0,bold:!0},e,`\\t`,` `)):N.createElement(Qo,{key:r},N.createElement($o,{dimColor:!0},`- `),N.createElement($o,{dimColor:!0,bold:!0},t.function),N.createElement($o,{dimColor:!0,color:`gray`,"aria-label":`at ${es(t.file)??``} line ${t.line} column ${t.column}`},` `,`(`,es(t.file)??``,`:`,t.line,`:`,t.column,`)`))})):null)}var rs=class extends N.PureComponent{static displayName=`InternalErrorBoundary`;static getDerivedStateFromError(e){return{error:e}}state={error:void 0};componentDidCatch(e){this.props.onError(e)}render(){return this.state.error?N.createElement(ns,{error:this.state.error}):this.props.children}};function is({children:e,stdin:t,stdout:n,stderr:i,writeToStdout:a,writeToStderr:o,exitOnCtrlC:s,onExit:c,onWaitUntilRenderFlush:l,onSuspendTerminal:u,onRegisterInputControl:
|
|
342
|
+
`).slice(1):void 0,n=t?ts.parseLine(t[0]):void 0,r=es(n?.file),i,a=0,o=new Map;if(r&&n?.line&&l.existsSync(r)&&(i=Yo(l.readFileSync(r,`utf8`),n.line),i))for(let{line:e}of i)a=Math.max(a,String(e).length);return N.createElement(Qo,{flexDirection:`column`,padding:1},N.createElement(Qo,null,N.createElement($o,{backgroundColor:`red`,color:`white`},` `,`ERROR`,` `),N.createElement($o,null,` `,e.message)),n&&r?N.createElement(Qo,{marginTop:1},N.createElement($o,{dimColor:!0},r,`:`,n.line,`:`,n.column)):null,n&&i?N.createElement(Qo,{marginTop:1,flexDirection:`column`},i.map(({line:e,value:t})=>N.createElement(Qo,{key:e},N.createElement(Qo,{width:a+1},N.createElement($o,{dimColor:e!==n.line,backgroundColor:e===n.line?`red`:void 0,color:e===n.line?`white`:void 0,"aria-label":e===n.line?`Line ${e}, error`:`Line ${e}`},String(e).padStart(a,` `),`:`)),N.createElement($o,{key:e,backgroundColor:e===n.line?`red`:void 0,color:e===n.line?`white`:void 0},` `+t)))):null,e.stack?N.createElement(Qo,{marginTop:1,flexDirection:`column`},e.stack.split(`
|
|
343
|
+
`).slice(1).map(e=>{let t=ts.parseLine(e),n=o.get(e)??0;o.set(e,n+1);let r=`${e}-${n}`;return!t?.file||!t.line||!t.column?N.createElement(Qo,{key:r},N.createElement($o,{dimColor:!0},`- `),N.createElement($o,{dimColor:!0,bold:!0},e,`\\t`,` `)):N.createElement(Qo,{key:r},N.createElement($o,{dimColor:!0},`- `),N.createElement($o,{dimColor:!0,bold:!0},t.function),N.createElement($o,{dimColor:!0,color:`gray`,"aria-label":`at ${es(t.file)??``} line ${t.line} column ${t.column}`},` `,`(`,es(t.file)??``,`:`,t.line,`:`,t.column,`)`))})):null)}var rs=class extends N.PureComponent{static displayName=`InternalErrorBoundary`;static getDerivedStateFromError(e){return{error:e}}state={error:void 0};componentDidCatch(e){this.props.onError(e)}render(){return this.state.error?N.createElement(ns,{error:this.state.error}):this.props.children}};function is({children:e,stdin:t,stdout:n,stderr:i,writeToStdout:a,writeToStderr:o,exitOnCtrlC:s,onExit:c,onWaitUntilRenderFlush:l,onSuspendTerminal:u,onRegisterInputControl:d,setCursorPosition:p,interactive:m,renderThrottleMs:h}){let[g,_]=(0,N.useState)(!0),[v,y]=(0,N.useState)(void 0),[,b]=(0,N.useState)([]),x=(0,N.useRef)(0),S=(0,N.useRef)(new Map),C=(0,N.useRef)(void 0),w=(0,N.useRef)(0),T=(0,N.useRef)(!1),E=(0,N.useRef)(0),D=(0,N.useRef)(new f);D.current.setMaxListeners(1/0);let O=(0,N.useRef)(void 0),k=(0,N.useRef)(Io()),ee=(0,N.useRef)(void 0),A=(0,N.useCallback)(()=>{ee.current&&=(clearTimeout(ee.current),void 0)},[]),te=(0,N.useCallback)(()=>{C.current&&=(clearTimeout(C.current),void 0)},[]),j=(0,N.useCallback)(()=>{if(te(),S.current.size===0)return;let e=1/0;for(let t of S.current.values())e=Math.min(e,t.nextDueTime);let t=Math.max(0,e-performance.now());C.current=setTimeout(()=>{C.current=void 0;let e=performance.now();for(let t of S.current.values()){if(e<t.nextDueTime)continue;t.callback(e);let n=e-t.startTime,r=Math.floor(n/t.interval)+1;t.nextDueTime=t.startTime+r*t.interval}j()},t)},[te]),ne=(0,N.useCallback)((e,t)=>{let n=performance.now();return S.current.set(e,{callback:e,interval:t,startTime:n,nextDueTime:n+t}),j(),{startTime:n,unsubscribe(){if(S.current.delete(e),S.current.size===0){te();return}j()}}},[te,j]);(0,N.useEffect)(()=>()=>{te()},[te]);let M=t.isTTY,re=(0,N.useCallback)(()=>{O.current&&=(t.removeListener(`readable`,O.current),void 0)},[t]),ie=(0,N.useCallback)(()=>{k.current.reset(),A(),re()},[A,re]),ae=(0,N.useCallback)(()=>{T.current=!1,t.setRawMode(!1),t.unref(),w.current=0,ie()},[t,ie]),oe=(0,N.useCallback)(e=>{M&&(w.current>0||T.current)&&ae(),c(e)},[M,ae,c]),se=(0,N.useCallback)(e=>{if(e===``&&s){oe();return}e===`\x1B`&&g&&y(void 0)},[s,oe,g]),ce=(0,N.useCallback)(e=>{se(e),D.current.emit(`input`,e)},[se]),le=(0,N.useCallback)(()=>{A(),ee.current=setTimeout(()=>{ee.current=void 0;let e=k.current.flushPendingEscape();e&&ce(e)},20)},[A,ce]),ue=(0,N.useCallback)(()=>{A();let e;for(;(e=t.read())!==null;){let t=k.current.push(e);for(let e of t)if(typeof e==`string`)ce(e);else{if(D.current.listenerCount(`paste`)===0){ce(e.paste);continue}D.current.emit(`paste`,e.paste)}}k.current.hasPendingEscape()&&le()},[t,ce,A,le]),de=(0,N.useCallback)(()=>{O.current||(O.current=ue,t.addListener(`readable`,ue))},[t,ue]),fe=(0,N.useCallback)(e=>{if(!M)throw t===r.stdin?Error(`Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default.
|
|
344
344
|
Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`):Error(`Raw mode is not supported on the stdin provided to Ink.
|
|
345
|
-
Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`);if(t.setEncoding(`utf8`),e){if(w.current===0){let e=T.current;T.current=!1,e||(t.ref(),t.setRawMode(!0)),de()}w.current++;return}w.current!==0&&--w.current===0&&(ie(),T.current=!0,queueMicrotask(()=>{T.current&&ae()}))},[M,t,de,ie,ae]),pe=(0,N.useCallback)(e=>{if(n.isTTY){if(e){E.current===0&&n.write(`\x1B[?2004h`),E.current++;return}E.current!==0&&--E.current===0&&n.write(`\x1B[?2004l`)}},[n]),me=(0,N.useRef)({rawMode:!1,bracketedPaste:!1}),he=(0,N.useCallback)(()=>{let e=M&&w.current>0,r=E.current>0;if(me.current={rawMode:e,bracketedPaste:r},r&&n.isTTY)try{n.write(`\x1B[?2004l`)}catch{}e&&(t.setRawMode(!1),t.unref(),ie())},[M,t,n,ie]),ge=(0,N.useCallback)(()=>{let{rawMode:e,bracketedPaste:r}=me.current;if(e&&(t.setEncoding(`utf8`),t.ref(),t.setRawMode(!0),de()),r&&n.isTTY)try{n.write(`\x1B[?2004h`)}catch{}},[t,n,de]);(0,N.useInsertionEffect)(()=>{
|
|
345
|
+
Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`);if(t.setEncoding(`utf8`),e){if(w.current===0){let e=T.current;T.current=!1,e||(t.ref(),t.setRawMode(!0)),de()}w.current++;return}w.current!==0&&--w.current===0&&(ie(),T.current=!0,queueMicrotask(()=>{T.current&&ae()}))},[M,t,de,ie,ae]),pe=(0,N.useCallback)(e=>{if(n.isTTY){if(e){E.current===0&&n.write(`\x1B[?2004h`),E.current++;return}E.current!==0&&--E.current===0&&n.write(`\x1B[?2004l`)}},[n]),me=(0,N.useRef)({rawMode:!1,bracketedPaste:!1}),he=(0,N.useCallback)(()=>{let e=M&&w.current>0,r=E.current>0;if(me.current={rawMode:e,bracketedPaste:r},r&&n.isTTY)try{n.write(`\x1B[?2004l`)}catch{}e&&(t.setRawMode(!1),t.unref(),ie())},[M,t,n,ie]),ge=(0,N.useCallback)(()=>{let{rawMode:e,bracketedPaste:r}=me.current;if(e&&(t.setEncoding(`utf8`),t.ref(),t.setRawMode(!0),de()),r&&n.isTTY)try{n.write(`\x1B[?2004h`)}catch{}},[t,n,de]);(0,N.useInsertionEffect)(()=>{d(he,ge)},[d,he,ge]);let _e=(0,N.useCallback)((e,t)=>{let n=e.findIndex(e=>e.id===t);for(let t=n+1;t<e.length;t++){let n=e[t];if(n?.isActive)return n.id}},[]),ve=(0,N.useCallback)((e,t)=>{let n=e.findIndex(e=>e.id===t);for(let t=n-1;t>=0;t--){let n=e[t];if(n?.isActive)return n.id}},[]),P=(0,N.useCallback)(()=>{b(e=>(y(t=>{let n=e.find(e=>e.isActive)?.id;return _e(e,t)??n}),e))},[_e]),ye=(0,N.useCallback)(()=>{b(e=>(y(t=>{let n=e.findLast(e=>e.isActive)?.id;return ve(e,t)??n}),e))},[ve]);(0,N.useEffect)(()=>{let e=e=>{!g||x.current===0||(e===` `&&P(),e===`\x1B[Z`&&ye())};D.current.on(`input`,e);let t=D.current;return()=>{t.off(`input`,e)}},[g,P,ye]);let be=(0,N.useCallback)(()=>{_(!0)},[]),F=(0,N.useCallback)(()=>{_(!1)},[]),xe=(0,N.useCallback)(e=>{b(t=>(t.some(t=>t?.id===e)&&y(e),t))},[]),Se=(0,N.useCallback)((e,{autoFocus:t})=>{b(t=>(x.current=t.length+1,[...t,{id:e,isActive:!0}])),t&&y(t=>t||e)},[]),Ce=(0,N.useCallback)(e=>{y(t=>{if(t!==e)return t}),b(t=>{let n=t.filter(t=>t.id!==e);return x.current=n.length,n})},[]),we=(0,N.useCallback)(e=>{b(t=>t.map(t=>t.id===e?{id:e,isActive:!0}:t))},[]),Te=(0,N.useCallback)(e=>{y(t=>{if(t!==e)return t}),b(t=>t.map(t=>t.id===e?{id:e,isActive:!1}:t))},[]);(0,N.useEffect)(()=>()=>{let e=!n.destroyed&&!n.writableEnded;m&&e&&go.show(n),M&&(w.current>0||T.current)&&ae(),E.current>0&&(n.isTTY&&e&&n.write(`\x1B[?2004l`),E.current=0)},[n,M,ae,m]);let Ee=(0,N.useMemo)(()=>({exit:oe,waitUntilRenderFlush:l,suspendTerminal:u}),[oe,l,u]),De=(0,N.useMemo)(()=>({stdin:t,setRawMode:fe,setBracketedPasteMode:pe,isRawModeSupported:M,internal_exitOnCtrlC:s,internal_eventEmitter:D.current}),[t,fe,pe,M,s]),Oe=(0,N.useMemo)(()=>({stdout:n,write:a}),[n,a]),ke=(0,N.useMemo)(()=>({stderr:i,write:o}),[i,o]),Ae=(0,N.useMemo)(()=>({setCursorPosition:p}),[p]),je=(0,N.useMemo)(()=>({activeId:v,add:Se,remove:Ce,activate:we,deactivate:Te,enableFocus:be,disableFocus:F,focusNext:P,focusPrevious:ye,focus:xe}),[v,Se,Ce,we,Te,be,F,P,ye,xe]),Me=(0,N.useMemo)(()=>({renderThrottleMs:h,subscribe:ne}),[ne,h]);return N.createElement(Ro.Provider,{value:Ee},N.createElement(zo.Provider,{value:De},N.createElement(Bo.Provider,{value:Oe},N.createElement(Vo.Provider,{value:ke},N.createElement(Ho.Provider,{value:je},N.createElement(Uo.Provider,{value:Me},N.createElement(Wo.Provider,{value:Ae},N.createElement(rs,{onError:oe},e))))))))}is.displayName=`InternalApp`;const as={disambiguateEscapeCodes:1,reportEventTypes:2,reportAlternateKeys:4,reportAllKeysAsEscapeCodes:8,reportAssociatedText:16};function os(e){let t=0;for(let n of e)t|=as[n];return t}const ss={shift:1,alt:2,ctrl:4,super:8,hyper:16,meta:32,capsLock:64,numLock:128},cs=()=>{},ls=new TextEncoder,us=async()=>new Promise(e=>{setImmediate(e)}),ds=e=>e>=48&&e<=57,fs=(e,t)=>{if(e[t]!==27||e[t+1]!==91||e[t+2]!==63)return;let n=t+3,r=n;for(;n<e.length&&ds(e[n]);)n++;if(n!==r){if(n===e.length)return{state:`partial`};if(e[n]===117)return{state:`complete`,endIndex:n}}},ps=e=>{for(let t=0;t<e.length;t++)if(fs(e,t)?.state===`complete`)return!0;return!1},ms=e=>{let t=[],n=0;for(;n<e.length;){let r=fs(e,n);if(r?.state===`complete`){n=r.endIndex+1;continue}if(r?.state===`partial`)break;t.push(e[n]),n++}return t},hs=r.platform===`win32`,gs=({isTty:e,viewportRows:t,previousOutputHeight:n,nextOutputHeight:r,isUnmounting:i})=>{if(!e)return!1;let a=n>0,o=n>=t;return hs&&(o||r>=t)?!0:n>t||r>t&&a||o&&r<t||i&&o},_s=e=>e instanceof Error||Object.prototype.toString.call(e)===`[object Error]`,vs=e=>({canWriteToStdout:!e.destroyed&&!e.writableEnded&&(e.writable??!0),hasWritableState:e._writableState!==void 0||e.writableLength!==void 0}),ys=(e,t)=>{if(!e||typeof e.flush!=`function`)return;let n=e;t?n.flush():typeof n.cancel==`function`&&n.cancel()};var bs=class{isConcurrent;options;log;cursorPosition;throttledLog;isScreenReaderEnabled;interactive;renderThrottleMs;alternateScreen;isUnmounted;isUnmounting;lastOutput;lastOutputToRender;lastOutputHeight;lastTerminalWidth;container;rootNode;fullStaticOutput;exitPromise;exitResult;beforeExitHandler;restoreConsole;unsubscribeResize;throttledOnRender;hasPendingThrottledRender=!1;kittyProtocolEnabled=!1;kittyFlags;cancelKittyDetection;nextRenderCommit;isSuspended=!1;pauseInput;resumeInput;constructor(e){me(this),this.options=e,this.rootNode=Ur(`ink-root`),this.rootNode.onComputeLayout=this.calculateLayout,this.isScreenReaderEnabled=e.isScreenReaderEnabled??r.env.INK_SCREEN_READER===`true`,this.interactive=this.resolveInteractiveOption(e.interactive),this.alternateScreen=!1;let t=e.debug||this.isScreenReaderEnabled,n=e.maxFps??30,i=n>0?Math.max(1,Math.ceil(1e3/n)):0;if(this.renderThrottleMs=t?0:i,t)this.rootNode.onRender=this.onRender,this.throttledOnRender=void 0;else{let e=A(this.onRender,i,{leading:!0,trailing:!0});this.rootNode.onRender=()=>{this.hasPendingThrottledRender=!0,e()},this.throttledOnRender=e}this.rootNode.onImmediateRender=this.onRender,this.rootNode.onStaticChange=this.handleStaticChange,this.log=bo.create(e.stdout,{incremental:e.incrementalRendering}),this.cursorPosition=void 0,this.throttledLog=t?this.log:A(e=>{let t=this.log.willRender(e),n=this.shouldSync();n&&t&&this.options.stdout.write(xo),this.log(e),n&&t&&this.options.stdout.write(So)},void 0,{leading:!0,trailing:!0}),this.isUnmounted=!1,this.isUnmounting=!1,this.isConcurrent=e.concurrent??!1,this.lastOutput=``,this.lastOutputToRender=``,this.lastOutputHeight=0,this.lastTerminalWidth=ln(this.options.stdout).columns,this.fullStaticOutput=``;let a=e.concurrent?F.ConcurrentRoot:F.LegacyRoot;this.container=Vi.createContainer(this.rootNode,a,null,!1,null,`id`,()=>{},()=>{},()=>{},()=>{}),this.unsubscribeExit=(0,ge.default)(this.unmount,{alwaysLast:!1}),this.setAlternateScreen(!!e.alternateScreen),r.env.DEV===`true`&&Vi.injectIntoDevTools(),e.patchConsole&&this.patchConsole(),this.interactive&&(e.stdout.on(`resize`,this.resized),this.unsubscribeResize=()=>{e.stdout.off(`resize`,this.resized)}),this.initKittyKeyboard(),this.exitPromise=new Promise((e,t)=>{this.resolveExitPromise=e,this.rejectExitPromise=t}),this.exitPromise.catch(cs)}resized=()=>{let e=ln(this.options.stdout).columns;e<this.lastTerminalWidth&&(this.log.clear(),this.lastOutput=``,this.lastOutputToRender=``),this.calculateLayout(),ti(this.rootNode),this.onRender(),this.lastTerminalWidth=e};resolveExitPromise=()=>{};rejectExitPromise=()=>{};unsubscribeExit=()=>{};handleAppExit=e=>{if(!(this.isUnmounted||this.isUnmounting)){if(_s(e)){this.unmount(e);return}this.exitResult=e,this.unmount()}};setCursorPosition=e=>{this.cursorPosition=e,this.log.setCursorPosition(e)};restoreLastOutput=()=>{this.interactive&&(this.log.setCursorPosition(this.cursorPosition),this.log(this.lastOutputToRender||this.lastOutput+`
|
|
346
346
|
`))};calculateLayout=()=>{let e=ln(this.options.stdout).columns;this.rootNode.yogaNode.setWidth(e),this.rootNode.yogaNode.calculateLayout(void 0,void 0,I.DIRECTION_LTR)};handleStaticChange=()=>{this.fullStaticOutput=``};onRender=()=>{if(this.hasPendingThrottledRender=!1,this.isUnmounted)return;if(this.isSuspended){this.nextRenderCommit&&=(this.nextRenderCommit.resolve(),void 0);return}this.nextRenderCommit&&=(this.nextRenderCommit.resolve(),void 0);let e=performance.now(),{output:t,outputHeight:n,staticOutput:r}=io(this.rootNode,this.isScreenReaderEnabled);this.options.onRender?.({renderTime:performance.now()-e});let i=r&&r!==`
|
|
347
347
|
`;if(this.options.debug){i&&(this.fullStaticOutput+=r),this.lastOutput=t,this.lastOutputToRender=t,this.lastOutputHeight=n,this.options.stdout.write(this.fullStaticOutput+t);return}if(!this.interactive){i&&this.options.stdout.write(r),this.lastOutput=t,this.lastOutputToRender=t+`
|
|
348
348
|
`,this.lastOutputHeight=n;return}if(this.isScreenReaderEnabled){let e=this.shouldSync();if(e&&this.options.stdout.write(xo),i){let e=this.lastOutputHeight>0?ae(this.lastOutputHeight):``;this.options.stdout.write(e+r),this.lastOutputHeight=0}if(t===this.lastOutput&&!i){e&&this.options.stdout.write(So);return}let n=ln(this.options.stdout).columns,a=$t(t,n,{trim:!1,hard:!0});if(i)this.options.stdout.write(a);else{let e=this.lastOutputHeight>0?ae(this.lastOutputHeight):``;this.options.stdout.write(e+a)}this.lastOutput=t,this.lastOutputToRender=a,this.lastOutputHeight=a===``?0:a.split(`
|
|
@@ -377,6 +377,6 @@ process.env.NODE_ENV!==`production`&&(function(){function t(e){if(e==null)return
|
|
|
377
377
|
<%s {...props} />
|
|
378
378
|
React keys must be passed directly to JSX without using spread:
|
|
379
379
|
let props = %s;
|
|
380
|
-
<%s key={someKey} {...props} />`,o,p,m,p),ae[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=O(),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),k=Symbol.for(`react.client.reference`),ee=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,te=Array.isArray,j=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var ne,M={},re=m.react_stack_bottom_frame.bind(m,o)(),ie=j(i(o)),ae={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>ee.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):re,r?j(i(e)):ie)},e.jsxs=function(e,t,n){var r=1e4>ee.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):re,r?j(i(e)):ie)}})()})),H=x(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=Zs():t.exports=Qs()}))(),$s=({children:e,onMeasure:t,index:n,width:r,measureKey:i})=>{let a=(0,N.useRef)(null);return(0,N.useLayoutEffect)(()=>{if(a.current){let{height:e}=Xs(a.current);t(n,e)}},[n,t,r,i,e]),(0,H.jsx)(Qo,{ref:a,flexShrink:0,width:`100%`,flexDirection:`column`,children:e})};function ec(e){let[t,n]=(0,N.useState)(e),r=(0,N.useRef)(e);return[t,(0,N.useCallback)(e=>{let t=typeof e==`function`?e(r.current):e;r.current=t,n(t)},[]),(0,N.useCallback)(()=>r.current,[])]}var tc=(0,N.forwardRef)(({scrollOffset:e,onViewportSizeChange:t,onContentHeightChange:n,onItemHeightChange:r,debug:i=!1,children:a,...o},s)=>{let[c,l,u]=ec({height:0,width:0}),[d,f,p]=ec(0),[m,h]=(0,N.useState)({}),g=(0,N.useRef)(null),_=(0,N.useRef)(null),v=(0,N.useRef)(0);(0,N.useLayoutEffect)(()=>{d!==v.current&&(n?.(d,v.current),v.current=d)},[d,n]);let y=(0,N.useRef)({}),b=(0,N.useRef)([]),x=(0,N.useRef)([]),S=(0,N.useRef)(0),C=(0,N.useCallback)((e,t)=>{let n=b.current[e]||e;if(y.current[n]!==t){let i=y.current[n]||0;y.current={...y.current,[n]:t};let a=0;for(let e of b.current)a+=y.current[e]||0;let o=p();a!==o&&f(a),r?.(e,t,i),S.current=Math.min(S.current,e+1)}},[r,n,p,f]),w=(0,N.useCallback)(()=>{if(g.current){let{width:e,height:n}=Xs(g.current),r=u();(e!==r.width||n!==r.height)&&(t?.({width:e,height:n},r),l({width:e,height:n}))}},[g,t,u,l]);(0,N.useLayoutEffect)(()=>{w()});let T=(0,N.useRef)(null);if(T.current!==a){T.current=a;let e=[],t={};N.Children.forEach(a,(n,r)=>{if(!n)return;let i=(0,N.isValidElement)(n)?n.key:null,a=i===null?r:i;e[r]=a,t[a]=y.current[a]||0}),y.current=t,b.current=e,x.current=Array(e.length).fill(0),S.current=0;let n=0;e.forEach(e=>{n+=t[e]||0});let r=p();n!==r&&f(n)}return(0,N.useImperativeHandle)(s,()=>({getContentHeight:p,getViewportHeight:()=>u().height,getBottomOffset:()=>Math.max(0,p()-u().height),getItemHeight:e=>{let t=b.current[e]||e;return y.current[t]||0},remeasure:w,remeasureItem:e=>h(t=>({...t,[e]:(t[e]||0)+1})),getItemPosition:e=>{if(e<0||e>=b.current.length)return null;if(e>=S.current){let t=0,n=0;if(S.current>0){n=S.current;let e=n-1,r=b.current[e]||e,i=y.current[r]||0;t=(x.current[e]??0)+i}for(let r=n;r<=e;r++){x.current[r]=t;let e=b.current[r]||r,n=y.current[e]||0;t+=n}S.current=e+1}let t=x.current[e]??0,n=b.current[e]||e;return{top:t,height:y.current[n]||0}}}),[]),(0,H.jsx)(Qo,{...o,children:(0,H.jsx)(Qo,{ref:g,width:`100%`,children:(0,H.jsx)(Qo,{overflow:i?void 0:`hidden`,width:`100%`,children:(0,H.jsx)(Qo,{ref:_,width:`100%`,flexDirection:`column`,marginTop:-e,children:N.Children.map(a,(e,t)=>e?(0,H.jsx)($s,{index:t,width:c.width,onMeasure:C,measureKey:m[t],children:e},(0,N.isValidElement)(e)&&e.key||t):null)})})})})});function nc(e){let[t,n]=(0,N.useState)(e),r=(0,N.useRef)(e);return[t,(0,N.useCallback)(e=>{let t=typeof e==`function`?e(r.current):e;r.current=t,n(t)},[]),(0,N.useCallback)(()=>r.current,[])]}var rc=(0,N.forwardRef)(({onScroll:e,onViewportSizeChange:t,onContentHeightChange:n,onItemHeightChange:r,debug:i=!1,children:a,...o},s)=>{let[c,l,u]=nc(0),d=(0,N.useRef)(null),f=(0,N.useRef)(0),p=(0,N.useCallback)((t,r)=>{f.current=t,n?.(t,r),u()>t&&(l(t),e?.(t))},[n,e,u,l]),m=(0,N.useCallback)(()=>Math.max(0,f.current-(d.current?.getViewportHeight()||0)),[]);return(0,N.useImperativeHandle)(s,()=>({scrollTo:t=>{if(typeof t!=`number`||isNaN(t))return;let n=f.current,r=Math.max(0,Math.min(t,n));r!==u()&&(l(r),e?.(r))},scrollBy:t=>{if(typeof t!=`number`||isNaN(t))return;let n=f.current,r=Math.max(0,Math.min(u()+t,n));r!==u()&&(l(r),e?.(r))},scrollToTop:()=>{u()!==0&&(l(0),e?.(0))},scrollToBottom:()=>{let t=m();u()!==t&&(l(t),e?.(t))},getScrollOffset:u,getContentHeight:()=>f.current,getViewportHeight:()=>d.current?.getViewportHeight()||0,getBottomOffset:m,getItemHeight:e=>d.current?.getItemHeight(e)||0,getItemPosition:e=>d.current?.getItemPosition(e)||null,remeasure:()=>d.current?.remeasure(),remeasureItem:e=>d.current?.remeasureItem(e)}),[e,m,u,l]),(0,H.jsx)(tc,{ref:d,scrollOffset:c,onViewportSizeChange:t,onContentHeightChange:p,onItemHeightChange:r,debug:i,children:a,...o})});function ic(e){
|
|
381
|
-
`)
|
|
382
|
-
`).
|
|
380
|
+
<%s key={someKey} {...props} />`,o,p,m,p),ae[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=O(),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),k=Symbol.for(`react.client.reference`),ee=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,te=Array.isArray,j=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var ne,M={},re=m.react_stack_bottom_frame.bind(m,o)(),ie=j(i(o)),ae={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>ee.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):re,r?j(i(e)):ie)},e.jsxs=function(e,t,n){var r=1e4>ee.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):re,r?j(i(e)):ie)}})()})),H=x(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=Zs():t.exports=Qs()}))(),$s=({children:e,onMeasure:t,index:n,width:r,measureKey:i})=>{let a=(0,N.useRef)(null);return(0,N.useLayoutEffect)(()=>{if(a.current){let{height:e}=Xs(a.current);t(n,e)}},[n,t,r,i,e]),(0,H.jsx)(Qo,{ref:a,flexShrink:0,width:`100%`,flexDirection:`column`,children:e})};function ec(e){let[t,n]=(0,N.useState)(e),r=(0,N.useRef)(e);return[t,(0,N.useCallback)(e=>{let t=typeof e==`function`?e(r.current):e;r.current=t,n(t)},[]),(0,N.useCallback)(()=>r.current,[])]}var tc=(0,N.forwardRef)(({scrollOffset:e,onViewportSizeChange:t,onContentHeightChange:n,onItemHeightChange:r,debug:i=!1,children:a,...o},s)=>{let[c,l,u]=ec({height:0,width:0}),[d,f,p]=ec(0),[m,h]=(0,N.useState)({}),g=(0,N.useRef)(null),_=(0,N.useRef)(null),v=(0,N.useRef)(0);(0,N.useLayoutEffect)(()=>{d!==v.current&&(n?.(d,v.current),v.current=d)},[d,n]);let y=(0,N.useRef)({}),b=(0,N.useRef)([]),x=(0,N.useRef)([]),S=(0,N.useRef)(0),C=(0,N.useCallback)((e,t)=>{let n=b.current[e]||e;if(y.current[n]!==t){let i=y.current[n]||0;y.current={...y.current,[n]:t};let a=0;for(let e of b.current)a+=y.current[e]||0;let o=p();a!==o&&f(a),r?.(e,t,i),S.current=Math.min(S.current,e+1)}},[r,n,p,f]),w=(0,N.useCallback)(()=>{if(g.current){let{width:e,height:n}=Xs(g.current),r=u();(e!==r.width||n!==r.height)&&(t?.({width:e,height:n},r),l({width:e,height:n}))}},[g,t,u,l]);(0,N.useLayoutEffect)(()=>{w()});let T=(0,N.useRef)(null);if(T.current!==a){T.current=a;let e=[],t={};N.Children.forEach(a,(n,r)=>{if(!n)return;let i=(0,N.isValidElement)(n)?n.key:null,a=i===null?r:i;e[r]=a,t[a]=y.current[a]||0}),y.current=t,b.current=e,x.current=Array(e.length).fill(0),S.current=0;let n=0;e.forEach(e=>{n+=t[e]||0});let r=p();n!==r&&f(n)}return(0,N.useImperativeHandle)(s,()=>({getContentHeight:p,getViewportHeight:()=>u().height,getBottomOffset:()=>Math.max(0,p()-u().height),getItemHeight:e=>{let t=b.current[e]||e;return y.current[t]||0},remeasure:w,remeasureItem:e=>h(t=>({...t,[e]:(t[e]||0)+1})),getItemPosition:e=>{if(e<0||e>=b.current.length)return null;if(e>=S.current){let t=0,n=0;if(S.current>0){n=S.current;let e=n-1,r=b.current[e]||e,i=y.current[r]||0;t=(x.current[e]??0)+i}for(let r=n;r<=e;r++){x.current[r]=t;let e=b.current[r]||r,n=y.current[e]||0;t+=n}S.current=e+1}let t=x.current[e]??0,n=b.current[e]||e;return{top:t,height:y.current[n]||0}}}),[]),(0,H.jsx)(Qo,{...o,children:(0,H.jsx)(Qo,{ref:g,width:`100%`,children:(0,H.jsx)(Qo,{overflow:i?void 0:`hidden`,width:`100%`,children:(0,H.jsx)(Qo,{ref:_,width:`100%`,flexDirection:`column`,marginTop:-e,children:N.Children.map(a,(e,t)=>e?(0,H.jsx)($s,{index:t,width:c.width,onMeasure:C,measureKey:m[t],children:e},(0,N.isValidElement)(e)&&e.key||t):null)})})})})});function nc(e){let[t,n]=(0,N.useState)(e),r=(0,N.useRef)(e);return[t,(0,N.useCallback)(e=>{let t=typeof e==`function`?e(r.current):e;r.current=t,n(t)},[]),(0,N.useCallback)(()=>r.current,[])]}var rc=(0,N.forwardRef)(({onScroll:e,onViewportSizeChange:t,onContentHeightChange:n,onItemHeightChange:r,debug:i=!1,children:a,...o},s)=>{let[c,l,u]=nc(0),d=(0,N.useRef)(null),f=(0,N.useRef)(0),p=(0,N.useCallback)((t,r)=>{f.current=t,n?.(t,r),u()>t&&(l(t),e?.(t))},[n,e,u,l]),m=(0,N.useCallback)(()=>Math.max(0,f.current-(d.current?.getViewportHeight()||0)),[]);return(0,N.useImperativeHandle)(s,()=>({scrollTo:t=>{if(typeof t!=`number`||isNaN(t))return;let n=f.current,r=Math.max(0,Math.min(t,n));r!==u()&&(l(r),e?.(r))},scrollBy:t=>{if(typeof t!=`number`||isNaN(t))return;let n=f.current,r=Math.max(0,Math.min(u()+t,n));r!==u()&&(l(r),e?.(r))},scrollToTop:()=>{u()!==0&&(l(0),e?.(0))},scrollToBottom:()=>{let t=m();u()!==t&&(l(t),e?.(t))},getScrollOffset:u,getContentHeight:()=>f.current,getViewportHeight:()=>d.current?.getViewportHeight()||0,getBottomOffset:m,getItemHeight:e=>d.current?.getItemHeight(e)||0,getItemPosition:e=>d.current?.getItemPosition(e)||null,remeasure:()=>d.current?.remeasure(),remeasureItem:e=>d.current?.remeasureItem(e)}),[e,m,u,l]),(0,H.jsx)(tc,{ref:d,scrollOffset:c,onViewportSizeChange:t,onContentHeightChange:p,onItemHeightChange:r,debug:i,children:a,...o})});const ic=s(`git`,[`rev-parse`,`--show-toplevel`],{encoding:`utf8`,stdio:`pipe`}).trimEnd();function ac(...e){return s(`git`,e,{encoding:`utf8`,stdio:`pipe`,cwd:ic}).trimEnd()}function oc(...e){return c(`git`,e,{encoding:`utf8`,cwd:ic}).stdout?.trim()??``}function sc(){try{return ac(`branch`,`--show-current`)}catch{return null}}const cc={M:`MODIFIED`,A:`ADDED`,D:`DELETED`,R:`RENAMED`,"?":`UNTRACKED`};function lc(){try{let e=ac(`status`,`--porcelain`,`--untracked-files=all`);return e?e.split(`
|
|
381
|
+
`).map(e=>{let[t,n]=e,r=t!==` `&&t!==`?`,i=r?n!==` `&&n!==`?`?`PARTIAL`:`FULL`:`NONE`,a=n===`?`?`?`:r?t:n,o=e.slice(3);return{path:o,displayPath:p.relative(process.cwd(),p.join(ic,o)),status:cc[a??``]??`-`,stagedStatus:i}}):[]}catch{return[]}}function uc({path:e,mode:t}){return t===`untracked`?oc(`diff`,`--no-index`,`/dev/null`,e):t===`staged`?oc(`diff`,`--cached`,e):oc(`diff`,e)}function dc(e){ac(`add`,e)}function fc(e){try{ac(`restore`,`--staged`,e)}catch{ac(`rm`,`--cached`,`--force`,e)}}function pc({raw:e,staged:t}){if(!e)return[];let n=e.split(`
|
|
382
|
+
`),r=n.findIndex(e=>e.startsWith(`@@`));if(r===-1)return[];let i=!0;return n.slice(r).flatMap(e=>e.startsWith(`@@`)?i?(i=!1,[]):[{kind:`separator`,text:`···`,staged:t}]:e.startsWith(`+`)?[{kind:`add`,text:e.slice(1),staged:t}]:e.startsWith(`-`)?[{kind:`remove`,text:e.slice(1),staged:t}]:[{kind:`context`,text:e.slice(1),staged:t}])}function mc(e){if(e.stagedStatus===`PARTIAL`){let t=t=>pc({raw:uc({path:e.path,mode:t?`staged`:`unstaged`}),staged:t}),n=t(!0),r=t(!1),i={kind:`separator`,text:`unstaged`,staged:!1};return[...n,...n.length&&r.length?[i]:[],...r]}let t=e.stagedStatus!==`NONE`,n=e.status===`UNTRACKED`?`untracked`:t?`staged`:`unstaged`;return pc({raw:uc({path:e.path,mode:n}),staged:t})}function hc(e){if(e.kind===`add`)return`#052e16`;if(e.kind===`remove`)return`#450a0a`}function gc({file:e,focused:t,width:n}){let[r,i]=(0,N.useState)([]),[a,o]=(0,N.useState)(0),s=(0,N.useRef)(null),c=(0,N.useRef)(void 0),l=(0,N.useRef)(null),{width:u,height:d}=Ys(l);(0,N.useEffect)(()=>{if(!e){i([]),s.current?.scrollToTop();return}i(mc(e)),c.current!==e.path&&(s.current?.scrollToTop(),o(0)),c.current=e.path},[e]);let f=(0,N.useMemo)(()=>Math.max(0,...r.map(e=>e.text.length)),[r]);return Ws((e,t)=>{let n=Math.max(0,f-u);t.upArrow&&s.current?.scrollBy(-1),t.downArrow&&s.current?.scrollBy(1),t.leftArrow&&o(e=>Math.max(0,e-1)),t.rightArrow&&o(e=>Math.min(n,e+1))},{isActive:t}),(0,H.jsxs)(Qo,{flexDirection:`column`,width:n,ref:l,children:[(0,H.jsx)(Qo,{marginLeft:1,children:(0,H.jsx)($o,{bold:!0,color:t?`whiteBright`:`gray`,wrap:`truncate-middle`,children:e?e.displayPath:`no file selected`})}),(0,H.jsx)(rc,{borderColor:t?`white`:`gray`,borderStyle:`round`,flexGrow:1,height:d,ref:s,children:r.map((e,t)=>{if(e.kind===`separator`)return(0,H.jsx)(Qo,{width:`100%`,backgroundColor:`#222`,justifyContent:`center`,children:(0,H.jsx)($o,{color:`#555`,children:e.text})},t);let n=e.text.slice(a,a+u-2)||` `;return(0,H.jsx)(Qo,{width:`100%`,backgroundColor:hc(e),children:(0,H.jsx)($o,{wrap:`hard`,color:`white`,children:n})},t)})})]})}var _c=(0,N.forwardRef)((e,t)=>{let{children:n,selectedIndex:r,scrollAlignment:i=`auto`,onScroll:a,onViewportSizeChange:o,onContentHeightChange:s,onItemHeightChange:c,...l}=e,u=(0,N.useRef)(null),[d,f]=(0,N.useState)(0),p=(0,N.useRef)(0);(0,N.useEffect)(()=>{p.current=d},[d]);let m=(0,N.useCallback)(e=>{e!==p.current&&(f(e),a?.(e))},[a]),h=(0,N.useRef)(r);h.current=r;let g=(0,N.useCallback)(()=>{let e=h.current;if(e===void 0||e<0)return null;let t=u.current?.getItemPosition(e);if(!t)return null;let n=u.current?.getViewportHeight()??0,r=u.current?.getContentHeight()??0,i=t.top+t.height-n,a=t.top;i>a&&([i,a]=[a,i]);let o=Math.max(0,r-n);return{min:Math.max(0,i),max:Math.min(o,a)}},[]),_=(0,N.useCallback)(e=>{let t=u.current?.getContentHeight()??0,n=u.current?.getViewportHeight()??0,r=Math.max(0,t-n),i=Math.max(0,Math.min(e,r)),a=g();return a&&(i=Math.max(a.min,Math.min(i,a.max))),i},[g]),v=(0,N.useCallback)((e,t,n,r)=>{let i=u.current?.getItemPosition(e);if(!i)return t;let a=r??u.current?.getViewportHeight()??0,o=u.current?.getContentHeight()??0,s=t;if(n===`top`)s=i.top;else if(n===`bottom`)s=i.top+i.height-a;else if(n===`center`)s=i.top+i.height/2-a/2;else{let e=i.top+i.height;i.top<=t&&e>=t+a?s=t:i.top<t?s=i.top:e>t+a&&(s=e-a)}let c=Math.max(0,o-a);return Math.max(0,Math.min(s,c))},[]),y=d;r!==void 0&&r>=0&&(y=v(r,d,i)),(0,N.useEffect)(()=>{y!==d&&m(y)},[y,d,m]);let b=(0,N.useCallback)((e,t=i,n)=>{m(v(e,d,t,n))},[v,d,i,m]),x=(0,N.useCallback)((e,t)=>{h.current!==void 0&&h.current>=0&&m(v(h.current,d,i,e.height)),o?.(e,t)},[o,b]),S=(0,N.useCallback)((e,t,n)=>{let r=h.current;r!==void 0&&r>=0&&(e<r?m(_(d+(t-n))):e===r&&m(v(e,d,i))),c?.(e,t,n)},[c,c,v,i,d,_,m]),C=(0,N.useCallback)((e,t)=>{h.current!==void 0&&h.current>=0&&(b(h.current),m(v(h.current,d,i))),s?.(e,t)},[s,b]);return(0,N.useImperativeHandle)(t,()=>({scrollTo:e=>{m(_(e))},scrollBy:e=>{let t=p.current;m(_(t+e))},scrollToTop:()=>{m(_(0))},scrollToBottom:()=>{let e=u.current?.getContentHeight()??0,t=u.current?.getViewportHeight()??0;m(_(Math.max(0,e-t)))},getScrollOffset:()=>p.current,getContentHeight:()=>u.current?.getContentHeight()??0,getViewportHeight:()=>u.current?.getViewportHeight()??0,getBottomOffset:()=>u.current?.getBottomOffset()??0,getItemHeight:e=>u.current?.getItemHeight(e)??0,getItemPosition:e=>u.current?.getItemPosition(e)??null,remeasure:()=>u.current?.remeasure(),remeasureItem:e=>u.current?.remeasureItem(e)}),[]),(0,H.jsx)(tc,{ref:u,scrollOffset:y,onViewportSizeChange:x,onContentHeightChange:C,onItemHeightChange:S,...l,children:n})});function vc(e){return e.slice().sort((e,t)=>{let n=e.path.split(`/`).slice(0,-1).join(`/`),r=t.path.split(`/`).slice(0,-1).join(`/`);return n===r?e.path.localeCompare(t.path):n.localeCompare(r)})}function yc(){let[e,t]=(0,N.useState)(()=>vc(lc())),[n,r]=(0,N.useState)(()=>sc());function i(){t(vc(lc())),r(sc())}(0,N.useEffect)(()=>{let e=setInterval(i,2e3);return()=>clearInterval(e)},[]);function a(e){dc(e),i()}function o(e){fc(e),i()}return{files:e,branch:n,stage:a,unstage:o}}const bc={NONE:`gray`,PARTIAL:`yellow`,FULL:`green`},xc={MODIFIED:`ᵐ`,ADDED:`ᵃ`,DELETED:`ᵈ`,RENAMED:`ʳ`,UNTRACKED:`ᵘ`,"-":`⁻`};function Sc({width:e,focused:t,onSelectedFile:n}){let{files:r,branch:i,stage:a,unstage:o}=yc(),[s,c]=(0,N.useState)(0);return(0,N.useEffect)(()=>{n(r[s])},[s,r,n]),Ws((e,t)=>{if(t.upArrow&&c(e=>Math.max(0,e-1)),t.downArrow&&c(e=>Math.min(r.length-1,e+1)),e===` `){let e=r[s];if(!e)return;e.stagedStatus===`FULL`?o(e.path):a(e.path)}},{isActive:t}),(0,H.jsxs)(Qo,{flexDirection:`column`,width:e,children:[(0,H.jsx)(Qo,{marginLeft:1,children:(0,H.jsx)($o,{bold:!0,color:t?`whiteBright`:`gray`,children:i})}),(0,H.jsx)(Qo,{borderColor:t?`white`:`gray`,borderStyle:`round`,flexGrow:1,children:(0,H.jsx)(_c,{height:`100%`,selectedIndex:s,width:`100%`,children:r.map((e,t)=>{let n=p.basename(e.displayPath),r=p.dirname(e.displayPath)===`.`?``:p.dirname(e.displayPath);return(0,H.jsxs)(Qo,{backgroundColor:t===s?`#222`:void 0,paddingX:1,height:1,children:[(0,H.jsxs)($o,{color:bc[e.stagedStatus],children:[e.stagedStatus===`NONE`?`○`:`●`,` `]}),(0,H.jsx)(Qo,{flexGrow:1,overflow:`hidden`,children:(0,H.jsxs)($o,{wrap:`hard`,children:[(0,H.jsx)($o,{children:n}),r?(0,H.jsxs)($o,{color:`gray`,children:[` `,r]}):null]})}),(0,H.jsx)(Qo,{flexShrink:0,marginLeft:1,children:(0,H.jsx)($o,{color:`gray`,children:xc[e.status]})})]},e.path)})})})]})}function Cc(){let e=(0,N.useMemo)(()=>process.cwd().split(`/`).pop(),[]);return(0,H.jsxs)(Qo,{backgroundColor:`green`,paddingX:1,justifyContent:`space-between`,children:[(0,H.jsx)($o,{bold:!0,color:`black`,children:`f*ckgit`}),(0,H.jsx)($o,{color:`black`,children:e})]})}function wc(){let{exit:e}=Gs(),{stdout:t}=Ks(),[n,r]=(0,N.useState)(`files`),[i,a]=(0,N.useState)(void 0);return Ws((t,n)=>{(t===`q`||n.ctrl&&t===`c`)&&e(),n.tab&&r(e=>e===`files`?`diff`:`files`)}),(0,H.jsxs)(Qo,{flexDirection:`column`,gap:1,width:t.columns,height:t.rows,children:[(0,H.jsx)(Cc,{}),(0,H.jsxs)(Qo,{flexDirection:`row`,flexGrow:1,children:[(0,H.jsx)(Sc,{width:`30%`,focused:n===`files`,onSelectedFile:a}),(0,H.jsx)(gc,{file:i,focused:n===`diff`,width:`70%`})]})]})}xs((0,H.jsx)(wc,{}),{alternateScreen:!0});export{};
|