@visulima/tui 1.0.0-alpha.15 → 1.0.0-alpha.17
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/CHANGELOG.md +26 -0
- package/LICENSE.md +136 -6
- package/dist/components/box.d.ts +2 -2
- package/dist/components/controlled-scroll-view.d.ts +2 -2
- package/dist/components/controlled-scroll-view.js +1 -1
- package/dist/components/cursor.d.ts +3 -3
- package/dist/components/dialog.d.ts +3 -3
- package/dist/components/dialog.js +1 -1
- package/dist/components/progress-bar.d.ts +1 -1
- package/dist/components/scroll-bar-box.d.ts +2 -2
- package/dist/components/scroll-bar.d.ts +2 -2
- package/dist/components/scroll-list.d.ts +2 -2
- package/dist/components/scroll-list.js +1 -1
- package/dist/components/scroll-view.d.ts +2 -2
- package/dist/components/scroll-view.js +1 -1
- package/dist/components/static-render.d.ts +7 -3
- package/dist/components/static-render.js +1 -1
- package/dist/components/static.d.ts +1 -1
- package/dist/components/text.d.ts +1 -1
- package/dist/components/tree-view-entry.d.ts +2 -2
- package/dist/ink/hooks/use-app.d.ts +1 -1
- package/dist/ink/hooks/use-box-metrics.d.ts +6 -4
- package/dist/ink/hooks/use-box-metrics.js +1 -1
- package/dist/ink/hooks/use-focus-manager.d.ts +2 -1
- package/dist/ink/hooks/use-input.d.ts +1 -1
- package/dist/ink/hooks/use-input.js +1 -1
- package/dist/ink/hooks/use-linked-scroll.d.ts +2 -2
- package/dist/ink/hooks/use-paste.d.ts +2 -1
- package/dist/ink/hooks/use-paste.js +1 -1
- package/dist/ink/hooks/use-text-selection.d.ts +4 -4
- package/dist/ink/hooks/use-text-selection.js +1 -1
- package/dist/ink/index.d.ts +9 -7
- package/dist/ink/index.js +1 -1
- package/dist/packem_shared/ControlledScrollView-C8VKEcM3.js +1 -0
- package/dist/packem_shared/{DevTools-ClnTSU76.js → DevTools-DdB596Gm.js} +1 -1
- package/dist/packem_shared/{LayoutNode-Q7nU3hmO.js → LayoutNode-B0qeT8sl.js} +1 -1
- package/dist/packem_shared/{ScrollList-Dxgv-mhZ.js → ScrollList-TUuafnA1.js} +1 -1
- package/dist/packem_shared/{ScrollView-Dq2v5zJS.js → ScrollView-D9nrXw4U.js} +1 -1
- package/dist/packem_shared/{comparePoints-l0iqUoL_.js → comparePoints-Dhgn8lGv.js} +1 -1
- package/dist/packem_shared/{controlled-scroll-view-CikQ90_V.js → controlled-scroll-view-CFM7ZV9N.js} +1 -1
- package/dist/packem_shared/{dom-CMbdnYbk.js → dom-UWZI4lDM.js} +1 -1
- package/dist/packem_shared/{dom.d-BZZeZlyP.d.ts → dom.d-C-sqbtxD.d.ts} +10 -2
- package/dist/packem_shared/get-string-width-CbMPWEJO.js +1 -0
- package/dist/packem_shared/{getPathToRoot-Nb2eTx2o.js → getPathToRoot-CL45WosJ.js} +1 -1
- package/dist/packem_shared/getScrollHeight-ClEOyLHH.js +1 -0
- package/dist/packem_shared/{layout-P24eyWyL.js → layout-D5zRYQRE.js} +1 -1
- package/dist/packem_shared/{measure-text-CIs55Wao.js → measure-text-D-jVetsl.js} +2 -2
- package/dist/packem_shared/{measureElement-CRKlFSvD.js → measureElement-BP4fUMFg.js} +1 -1
- package/dist/packem_shared/processLayout-D2unRIYk.js +1 -0
- package/dist/packem_shared/{reconciler-BQvF1kRj.js → reconciler-C0e93MVj.js} +1 -1
- package/dist/packem_shared/{reconciler-tOH9yL_j.js → reconciler-ChRlmCI_.js} +1 -1
- package/dist/packem_shared/render-Cn56QShB.js +27 -0
- package/dist/packem_shared/{render-yGJFE4of.js → render-CqZntGO6.js} +1 -1
- package/dist/packem_shared/{render.d-BJmVQ_cd.d.ts → render.d-CZ__oorj.d.ts} +19 -1
- package/dist/packem_shared/{renderToString-GyN-Rw9F.js → renderToString-D3xqB85B.js} +1 -1
- package/dist/packem_shared/{renderToString-D4JqS-Zv.js → renderToString-DE1YWhbo.js} +1 -1
- package/dist/packem_shared/{renderTreeToBuffer-DWl5_yTW.js → renderTreeToBuffer-LnGZkEUX.js} +1 -1
- package/dist/packem_shared/{renderer-Cidd3s9K.js → renderer-DaPOmgCC.js} +6 -6
- package/dist/packem_shared/{selection.d-vfuEzv1p.d.ts → selection.d-t_tKgYYA.d.ts} +1 -1
- package/dist/packem_shared/{setEnableStyledLineCache-Aja0FbWo.js → setEnableStyledLineCache-Cke6_ZQt.js} +1 -1
- package/dist/packem_shared/{styles.d-i6Mejqz2.d.ts → styles.d-CLJdt-kg.d.ts} +35 -7
- package/dist/packem_shared/{text-width-DSx26OmB.js → text-width-CI9G0a-z.js} +1 -1
- package/dist/packem_shared/{wrapOrTruncateStyledLine-D29Fq7pW.js → wrapOrTruncateStyledLine-kyi6yijx.js} +1 -1
- package/dist/react/index.js +1 -1
- package/dist/testing/index.d.ts +4 -4
- package/dist/testing/index.js +1 -1
- package/index.js +539 -691
- package/package.json +17 -16
- package/dist/packem_shared/ControlledScrollView-X_OTc-Cw.js +0 -1
- package/dist/packem_shared/get-string-width-4oMZhv2Q.js +0 -1
- package/dist/packem_shared/getScrollHeight-BTEY8ewu.js +0 -1
- package/dist/packem_shared/processLayout-Dmgf0LO6.js +0 -1
- package/dist/packem_shared/render-D9bHMHrx.js +0 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/tui",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.17",
|
|
4
4
|
"description": "React-based TUI library powered by a native Rust diff engine, drop-in Ink-compatible API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -572,20 +572,21 @@
|
|
|
572
572
|
"dependencies": {
|
|
573
573
|
"code-excerpt": "^4.0.0",
|
|
574
574
|
"scheduler": "^0.27.0",
|
|
575
|
+
"type-fest": "5.6.0",
|
|
575
576
|
"yoga-layout": "~3.2.1"
|
|
576
577
|
},
|
|
577
578
|
"peerDependencies": {
|
|
578
579
|
"@shikijs/langs": "^4.0.2",
|
|
579
580
|
"@shikijs/themes": "^4.0.2",
|
|
580
581
|
"@visulima/tabular": "4.0.0-alpha.11",
|
|
581
|
-
"cfonts": "3.3.1",
|
|
582
|
+
"cfonts": "^3.3.1",
|
|
582
583
|
"diff": "^9.0.0",
|
|
583
|
-
"marked": "18.0.3",
|
|
584
|
-
"react": "
|
|
585
|
-
"react-devtools-core": "
|
|
586
|
-
"react-reconciler": "
|
|
587
|
-
"shiki": "4.0.2",
|
|
588
|
-
"ws": "^8.20.
|
|
584
|
+
"marked": "^18.0.3",
|
|
585
|
+
"react": "^19.2.6",
|
|
586
|
+
"react-devtools-core": "^7.0.1",
|
|
587
|
+
"react-reconciler": "^0.33.0",
|
|
588
|
+
"shiki": "^4.0.2",
|
|
589
|
+
"ws": "^8.20.1"
|
|
589
590
|
},
|
|
590
591
|
"peerDependenciesMeta": {
|
|
591
592
|
"@shikijs/langs": {
|
|
@@ -617,14 +618,14 @@
|
|
|
617
618
|
}
|
|
618
619
|
},
|
|
619
620
|
"optionalDependencies": {
|
|
620
|
-
"@visulima/tui-binding-
|
|
621
|
-
"@visulima/tui-binding-darwin-arm64": "1.0.0-alpha.
|
|
622
|
-
"@visulima/tui-binding-
|
|
623
|
-
"@visulima/tui-binding-linux-arm64-musl": "1.0.0-alpha.
|
|
624
|
-
"@visulima/tui-binding-linux-x64-gnu": "1.0.0-alpha.
|
|
625
|
-
"@visulima/tui-binding-linux-x64-musl": "1.0.0-alpha.
|
|
626
|
-
"@visulima/tui-binding-win32-
|
|
627
|
-
"@visulima/tui-binding-win32-
|
|
621
|
+
"@visulima/tui-binding-darwin-x64": "1.0.0-alpha.17",
|
|
622
|
+
"@visulima/tui-binding-darwin-arm64": "1.0.0-alpha.17",
|
|
623
|
+
"@visulima/tui-binding-linux-arm64-gnu": "1.0.0-alpha.17",
|
|
624
|
+
"@visulima/tui-binding-linux-arm64-musl": "1.0.0-alpha.17",
|
|
625
|
+
"@visulima/tui-binding-linux-x64-gnu": "1.0.0-alpha.17",
|
|
626
|
+
"@visulima/tui-binding-linux-x64-musl": "1.0.0-alpha.17",
|
|
627
|
+
"@visulima/tui-binding-win32-x64-msvc": "1.0.0-alpha.17",
|
|
628
|
+
"@visulima/tui-binding-win32-arm64-msvc": "1.0.0-alpha.17"
|
|
628
629
|
},
|
|
629
630
|
"engines": {
|
|
630
631
|
"node": "^22.14.0 || >=24.10.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"react/jsx-runtime";import"react";import"./layout-P24eyWyL.js";import"../components/box.js";import{C as l}from"./controlled-scroll-view-CikQ90_V.js";export{l as ControlledScrollView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var a1=Object.defineProperty;var h=(e,i)=>a1(e,"name",{value:i,configurable:!0});var n1=Object.defineProperty,T=h((e,i)=>n1(e,"name",{value:i,configurable:!0}),"s$2"),t1=Object.defineProperty,y=T((e,i)=>t1(e,"name",{value:i,configurable:!0}),"l");const S=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],R=[12288,12288,65281,65376,65504,65510],z=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],V=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],E=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141];var u1=Object.defineProperty,l1=y((e,i)=>u1(e,"name",{value:i,configurable:!0}),"r$1");const p=l1((e,i)=>{let r=0,t=Math.floor(e.length/2)-1;for(;r<=t;){const u=Math.floor((r+t)/2),l=u*2;if(i<e[l])t=u-1;else if(i>e[l+1])r=u+1;else return!0}return!1},"isInRange");var o1=Object.defineProperty,b=y((e,i)=>o1(e,"name",{value:i,configurable:!0}),"r");const d1=S[0],s1=S.at(-1),c1=R[0],h1=R.at(-1),f1=z[0],w1=z.at(-1),b1=V[0],g1=V.at(-1),m1=E[0],p1=E.at(-1),G=19968,[$1,W1]=O(E);function O(e){let i=e[0],r=e[1];for(let t=0;t<e.length;t+=2){const u=e[t],l=e[t+1];if(G>=u&&G<=l)return[u,l];l-u>r-i&&(i=u,r=l)}return[i,r]}h(O,"b$1");T(O,"b");y(O,"N");b(O,"findWideFastPathRange");const K=b(e=>e<d1||e>s1?!1:p(S,e),"isAmbiguous"),L=b(e=>e<c1||e>h1?!1:p(R,e),"isFullWidth"),v1=b(e=>e<f1||e>w1?!1:p(z,e),"isHalfWidth"),I1=b(e=>e<b1||e>g1?!1:p(V,e),"isNarrow"),Q=b(e=>e>=$1&&e<=W1?!0:e<m1||e>p1?!1:p(E,e),"isWide");function P(e){return K(e)?"ambiguous":L(e)?"fullwidth":v1(e)?"halfwidth":I1(e)?"narrow":Q(e)?"wide":"neutral"}h(P,"v$1");T(P,"q");y(P,"getCategory");b(P,"getCategory");var x1=Object.defineProperty,F=h((e,i)=>x1(e,"name",{value:i,configurable:!0}),"i$2"),j1=Object.defineProperty,k=F((e,i)=>j1(e,"name",{value:i,configurable:!0}),"a"),y1=Object.defineProperty,_=k((e,i)=>y1(e,"name",{value:i,configurable:!0}),"e");function $(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}h($,"s$1");F($,"s");k($,"r");_($,"validate");function W(e){return $(e),P(e)}h(W,"r$2");F(W,"p");k(W,"eastAsianWidthType");_(W,"eastAsianWidthType");function q(e,{ambiguousAsWide:i=!1}={}){return $(e),L(e)||Q(e)||i&&K(e)?2:1}h(q,"o$2");F(q,"W");k(q,"eastAsianWidth");_(q,"eastAsianWidth");var E1=Object.defineProperty,O1=h((e,i)=>E1(e,"name",{value:i,configurable:!0}),"p$1"),P1=Object.defineProperty,U=O1((e,i)=>P1(e,"name",{value:i,configurable:!0}),"e"),F1=Object.defineProperty,k1=U((e,i)=>F1(e,"name",{value:i,configurable:!0}),"E");const X=String.raw,Z=X`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,B1=k1(()=>new RegExp(X`\p{RI}{2}|(?)${Z}(?:\u200D${Z})*`,"gu"),"default");var M1=Object.defineProperty,N1=U((e,i)=>M1(e,"name",{value:i,configurable:!0}),"p");const Q1=new Set(["\x1B",""]),A1="\x07",C1="[",U1="m",T1="]8;;",X1=39,e2=/[\u200B\uFEFF\u2060-\u2064]/g,i2=new RegExp(`(?:\\${C1}(?<code>\\d+)m|\\${T1}(?<uri>.*)${A1})`),r2=Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]])),m=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,a2=/\u001B\[(\d+(?:;\d+)*)?m[^\u001B]*(?:\u001B\[(?:\d+(?:;\d+)*)?m|$)/g,n2=/\u001B\]8;[^\u0007\u001B]*(?:\u0007|\u001B\\)(.*?)\u001B\]8;;(?:\u0007|\u001B\\)/g,v=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,x=B1();N1(e=>e.replace(x,""),"stripEmoji");var S1=Object.defineProperty,R1=h((e,i)=>S1(e,"name",{value:i,configurable:!0}),"E"),z1=Object.defineProperty,V1=R1((e,i)=>z1(e,"name",{value:i,configurable:!0}),"A"),_1=Object.defineProperty,B=V1((e,i)=>_1(e,"name",{value:i,configurable:!0}),"d");const J=new Map,I=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,j=B(e=>e>=32&&e<=126?"latin":e===8203||e===8204||e===8205||e===8288?"zero":e<=31||e>=127&&e<=159?"control":e>=160&&e<=255||e>=9472&&e<=9599?"latin":e>=4352&&e<=4607||e>=11904&&e<=40959||e>=44032&&e<=55215||e>=63744&&e<=64255||e>=65280&&e<=65519&&!(e>=65377&&e<=65439)||e>=12352&&e<=12543?"wide":e===8230?"latin":"other","getCharType"),q1=B((e,i)=>{const r=Math.floor(e/65536),t=e%65536;let u=J.get(r);if(u||(u=new Map,J.set(r,u)),u.has(t))return u.get(t);let l;if(j(e)==="latin")l=i.width.regular;else if(j(e)==="control")l=i.width.control;else if(j(e)==="wide")l=i.width.wide;else switch(W(e)){case"ambiguous":{l=i.width.ambiguousIsNarrow?i.width.regular:i.width.wide;break}case"fullwidth":{l=i.width.fullWidth;break}case"wide":{l=i.width.wide;break}default:l=i.width.regular}return u.set(t,l),l},"getCachedCharWidth"),H1=B(e=>e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071||e>=917760&&e<=917999||e>=65024&&e<=65039||e>=3633&&e<=3642||e>=3655&&e<=3662||e>=3761&&e<=3769||e>=3771&&e<=3772||e>=3784&&e<=3789||e>=2304&&e<=2307||e>=2362&&e<=2383||e>=2385&&e<=2391||e>=2402&&e<=2403||e>=2433&&e<=2435||e>=2492&&e<=2500||e>=2509&&e<=2509||e>=2561&&e<=2563||e>=2620&&e<=2637||e>=1611&&e<=1631||e>=1648&&e<=1648||e>=1750&&e<=1773||e>=2276&&e<=2302||e>=1425&&e<=1469||e>=1471&&e<=1471||e>=1473&&e<=1474||e>=1476&&e<=1477||e>=1479&&e<=1479||e>=3893&&e<=3893||e>=3895&&e<=3895||e>=3897&&e<=3897||e>=3953&&e<=3966||e>=3968&&e<=3972||e>=3974&&e<=3975?!0:e>=768&&e<=777||e>=803&&e<=803,"isCombiningCharacter"),C=B((e,i={})=>{if(!e||e.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const r={truncation:{countAnsiEscapeCodes:i.countAnsiEscapeCodes??!1,ellipsis:i.ellipsis??"",ellipsisWidth:i.ellipsisWidth??(i.ellipsis?C(i.ellipsis,{...i,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:i.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:i.ambiguousIsNarrow??!1,ansi:i.ansiWidth??0,control:i.controlWidth??0,emoji:i.emojiWidth??2,fullWidth:i.fullWidth??2,halfWidth:i.halfWidth??1,regular:i.regularWidth??1,tab:i.tabWidth??8,wide:i.wideWidth??2}},t=Math.max(0,r.truncation.limit-r.truncation.ellipsisWidth),{length:u}=e,l=u>1e4;let a=0,n=0,o=u,d=!1;const e1=e.includes("\x1B")||e.includes("");for(;a<u;){if(e1&&(e[a]==="\x1B"||e[a]==="")){if(e.startsWith("\x1B]8;;",a)){const c="\x1B]8;;\x07",w=c.length,M=e.indexOf("\x07",a+5);if(M!==-1){const N=e.indexOf(c,M+1);if(N!==-1){const i1=N+w,r1=e.slice(M+1,N).replace(m,""),D=C(r1,{ambiguousIsNarrow:r.width.ambiguousIsNarrow,ansiWidth:r.width.ansi,controlWidth:r.width.control,countAnsiEscapeCodes:!1,ellipsis:r.truncation.ellipsis,ellipsisWidth:r.truncation.ellipsisWidth,emojiWidth:r.width.emoji,fullWidth:r.width.fullWidth,halfWidth:r.width.halfWidth,limit:Math.max(0,t-n),regularWidth:r.width.regular,tabWidth:r.width.tab,wideWidth:r.width.wide}),A=D.width;if(D.truncated)d=!0,o=Math.min(o,a);else if(n+A>t&&(o=Math.min(o,a),d=!0,n+A>r.truncation.limit))break;if(n+=A,a=i1,d&&n>=r.truncation.limit)break;continue}}}if(m.lastIndex=a,m.test(e)){const c=m.lastIndex-a,w=r.truncation.countAnsiEscapeCodes?c:r.width.ansi;if(n+w>t&&(o=Math.min(o,a),n+w>r.truncation.limit)){d=!0;break}n+=w,a=m.lastIndex;continue}}const f=e.codePointAt(a);if(f===8203||f===65279||f>=8288&&f<=8292){a+=1;continue}if(f===9){if(n+r.width.tab>t&&(o=Math.min(o,a),n+r.width.tab>r.truncation.limit)){d=!0;break}n+=r.width.tab,a+=1;continue}if(I.lastIndex=a,I.test(e)){const c=(I.lastIndex-a)*r.width.regular;if(n+c>t){const w=Math.floor((t-n)/r.width.regular);if(o=Math.min(o,a+w),n+c>r.truncation.limit){d=!0;break}}n+=c,a=I.lastIndex;continue}if((f<=31||f>=127&&f<=159)&&(v.lastIndex=a,v.test(e))){const c=(v.lastIndex-a)*r.width.control;if(n+c>t&&(o=Math.min(o,a+Math.floor((t-n)/r.width.control)),n+c>r.truncation.limit)){d=!0;break}n+=c,a=v.lastIndex;continue}if(x.lastIndex=a,x.test(e)){if(n+r.width.emoji>t&&(o=Math.min(o,a),n+r.width.emoji>r.truncation.limit)){d=!0;break}n+=r.width.emoji,a=x.lastIndex;continue}const g=e.codePointAt(a)??0;if(H1(g)){a+=g>65535?2:1;continue}let s;if(l)s=q1(g,r);else switch(j(g)){case"control":{s=r.width.control;break}case"latin":{s=r.width.regular;break}case"wide":{s=r.width.wide;break}case"zero":{s=0;break}default:switch(W(g)){case"ambiguous":{s=r.width.ambiguousIsNarrow?r.width.regular:r.width.wide;break}case"fullwidth":{s=r.width.fullWidth;break}case"wide":{s=r.width.wide;break}default:s=r.width.regular}}if(n+s>t&&(o=Math.min(o,a),n+s>r.truncation.limit)){d=!0;break}n+=s,a+=g>65535?2:1}let H=n,Y=!1;return d&&r.truncation.limit>=r.truncation.ellipsisWidth&&(H=r.truncation.limit,Y=!0),{ellipsed:Y,index:d?o:u,truncated:d,width:H}},"getStringTruncatedWidth");var Y1=Object.defineProperty,D1=h((e,i)=>Y1(e,"name",{value:i,configurable:!0}),"i"),G1=Object.defineProperty,Z1=D1((e,i)=>G1(e,"name",{value:i,configurable:!0}),"e"),J1=Object.defineProperty,K1=Z1((e,i)=>J1(e,"name",{value:i,configurable:!0}),"r");const t2=K1((e,i={})=>C(e,{...i,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,"getStringWidth");export{i2 as F,n2 as G,C as N,X1 as a,r2 as b,U1 as d,m as h,A1 as i,a2 as k,Q1 as l,e2 as m,t2 as o,Q as p,T1 as s,C1 as t,L as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var p=Object.defineProperty;var u=(t,e)=>p(t,"name",{value:e,configurable:!0});import l from"yoga-layout";var E=Object.defineProperty,n=u((t,e)=>E(t,"name",{value:e,configurable:!0}),"n");const T=n(t=>{const{yogaNode:e}=t;if(!e)return{scrollHeight:0,scrollWidth:0};const a=e.getComputedBorder(l.EDGE_TOP),d=e.getComputedBorder(l.EDGE_LEFT);let c=a,r=e.getComputedPadding(l.EDGE_LEFT);for(let i=0;i<e.getChildCount();i++){const o=e.getChild(i),h=o.getComputedTop()+o.getComputedHeight()+o.getComputedMargin(l.EDGE_BOTTOM);h>c&&(c=h);const m=o.getComputedLeft()+o.getComputedWidth()+o.getComputedMargin(l.EDGE_RIGHT);m>r&&(r=m)}const s=c-a+e.getComputedPadding(l.EDGE_BOTTOM),g=r-d+e.getComputedPadding(l.EDGE_RIGHT);return{scrollHeight:Math.round(s),scrollWidth:Math.round(g)}},"calculateScrollDimensions"),C=n(t=>Math.round(t.internal_scrollState?.scrollHeight??0),"getScrollHeight"),M=n(t=>Math.round(t.internal_scrollState?.scrollWidth??0),"getScrollWidth"),f=n(t=>{const{yogaNode:e}=t;if(!e)return;const{scrollHeight:a,scrollWidth:d}=T(t);let c=a;const r=Math.max(0,e.getComputedHeight()-e.getComputedBorder(l.EDGE_TOP)-e.getComputedBorder(l.EDGE_BOTTOM));if(t.style.stableScrollback&&t.style.overflowToBackbuffer){const o=Math.max(0,a-r);t.internal_isScrollbackDirty?(t.internal_maxScrollTop=o,t.internal_isScrollbackDirty=!1):t.internal_maxScrollTop=Math.max(t.internal_maxScrollTop??0,o),c=Math.max(a,(t.internal_maxScrollTop??0)+r)}const s=Math.max(0,Math.min(t.style.scrollTop??0,c-r)),g=Math.max(0,e.getComputedWidth()-e.getComputedBorder(l.EDGE_LEFT)-e.getComputedBorder(l.EDGE_RIGHT)),i=Math.max(0,Math.min(t.style.scrollLeft??0,d-g));t.internal_scrollState={actualScrollHeight:a,clientHeight:r,clientWidth:g,scrollHeight:c,scrollLeft:i,scrollTop:s,scrollWidth:d}},"calculateScroll"),D=n(t=>Math.round(t.internal_scrollState?.scrollTop??0),"getScrollTop"),G=n(t=>Math.round(t.internal_scrollState?.scrollLeft??0),"getScrollLeft");export{f as calculateScroll,C as getScrollHeight,G as getScrollLeft,D as getScrollTop,M as getScrollWidth};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"yoga-layout";import{m as e,n as i,p as n}from"./layout-P24eyWyL.js";export{e as getAbsoluteContentPosition,i as getAbsolutePosition,n as processLayout};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
var Xe=Object.defineProperty;var y=(e,t)=>Xe(e,"name",{value:t,configurable:!0});import{createRequire as Ze}from"node:module";import{jsxs as A,jsx as C}from"react/jsx-runtime";import{a as ot,x as si}from"./constants-D12jy2Zh-RSfxu1eM.js";import{r as ft,c as pt,F as Pt,a as ni,l as oi,b as ai,z as gt,N as Ut,h as ui,P as Y,d as z,e as li,f as ci}from"./erase-DeDffywz.js";import{c as di,e as hi,k as fi}from"./dom-CMbdnYbk.js";import{ConcurrentRoot as pi,LegacyRoot as mi}from"react-reconciler/constants.js";import ue from"yoga-layout";import{a as vi}from"./accessibility-context-DDyHTwmA.js";import{h as we,e as xe,g as Se,o as yi}from"./mode-BOIU4Roy.js";import{PureComponent as bi,useState as $t,useRef as D,useCallback as b,useEffect as kt,useMemo as G}from"react";import{e as wi}from"./animation-context-DW3p-vpk.js";import{t as xi}from"./app-context-BVpKlG1z.js";import{o as Si}from"./cursor-context-CFviBqPX.js";import Ti from"code-excerpt";import{Box as _}from"../components/box.js";import{Text as W}from"../components/text.js";import{o as Ri}from"./focus-context-CsT69klR.js";import{t as Oi}from"./stderr-context-BzEaUICS.js";import{e as Ei}from"./stdin-context-BTaaFagk.js";import{t as Pi}from"./stdout-context-BnblEPez.js";import{resolveFlags as Ni}from"./kittyFlags-C3rZLbcK.js";import{a as Ii}from"./measure-text-CIs55Wao.js";import{L as k,u as ki}from"./reconciler-tOH9yL_j.js";import{r as Li,R as Ai}from"./renderer-Cidd3s9K.js";import{measureAndExtractObservers as Di}from"./ResizeObserverEntry-Dq0dk8Kq.js";import{calculateScroll as Wi}from"./getScrollHeight-BTEY8ewu.js";import{g as tt}from"./utils-THUhYKG2.js";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
2
|
-
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
3
|
-
const ti=Ze(import.meta.url),it=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,vt=y(e=>{if(typeof it<"u"&&it.versions&&it.versions.node){const[t,i]=it.versions.node.split(".").map(Number);if(t>22||t===22&&i>=3||t===20&&i>=16)return it.getBuiltinModule(e)}return ti(e)},"__cjs_getBuiltinModule"),L=it,{env:It,cwd:ei}=L,{PassThrough:oe,Stream:ii}=vt("node:stream"),{Buffer:ae}=vt("node:buffer"),{Console:ri}=vt("node:console"),{EventEmitter:gi}=vt("node:events"),{existsSync:$i,readFileSync:Ci}=vt("node:fs");var Ui=Object.defineProperty,_i=y((e,t)=>Ui(e,"name",{value:t,configurable:!0}),"r$2"),Bi=Object.defineProperty,ji=_i((e,t)=>Bi(e,"name",{value:t,configurable:!0}),"t"),Mi=Object.defineProperty,$e=ji((e,t)=>Mi(e,"name",{value:t,configurable:!0}),"t");const Ce=`${ot}?1049h`,Te=`${ot}?1049l`;$e(()=>Ce,"alternativeScreenOn");$e(()=>Te,"alternativeScreenOff");Pt(0,0)+ft(pt.ToEnd);`${ni(oi.EntireLine)}${ot}`;const Hi=`${ot}H${ft(pt.EntireScreen)}`;ai?`${ft(pt.EntireScreen)}${ot}`:`${ft(pt.EntireScreen)}${ft(pt.EntireScreenAndScrollback)}${ot}${si}`;var Ki=Object.defineProperty,rt=y((e,t)=>Ki(e,"name",{value:t,configurable:!0}),"t$4");function _t(e,t=0,i={}){const r=i.leading??!0,s=i.trailing??!0;let u,n,a,o;const c=rt(()=>{if(n===void 0)return;const w=n;n=void 0,o=e(...w)},"invoke"),f=rt(()=>{u!==void 0&&(clearTimeout(u),u=void 0)},"clearTimer"),g=rt(()=>{u=void 0,s&&c(),n=void 0,a=void 0},"onTimerEnd"),d=rt(()=>{f(),u=setTimeout(g,t)},"scheduleTimer"),h=rt(function(...w){const $=Date.now();if(a===void 0&&(a=$),$-a>=t)return n=w,c(),a=$,d(),o;n=w;const x=u===void 0;return d(),r&&x&&c(),o},"throttled");return h.cancel=()=>{f(),n=void 0,a=void 0},h.flush=()=>(f(),c(),a=void 0,o),h}y(_t,"throttle");rt(_t,"throttle");var Fi=Object.defineProperty,Gi=y((e,t)=>Fi(e,"name",{value:t,configurable:!0}),"t$3");const le=Gi(e=>e in It&&It[e]!=="0"&&It[e]!=="false","check"),Re=le("CI")||le("CONTINUOUS_INTEGRATION");var qi=Object.defineProperty,zi=y((e,t)=>qi(e,"name",{value:t,configurable:!0}),"s");const ce=["assert","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"];let Lt={};const Yi=zi(e=>{const t=new oe,i=new oe;t.write=s=>{e("stdout",s)},i.write=s=>{e("stderr",s)};const r=new console.Console(t,i);for(const s of ce)Lt[s]=console[s],console[s]=r[s];return()=>{for(const s of ce)console[s]=Lt[s];Lt={}}},"patchConsole"),st=[];st.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&st.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&st.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Ji=Object.defineProperty,at=y((e,t)=>Ji(e,"name",{value:t,configurable:!0}),"r$1");const Tt=at(e=>!!e&&!0&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function","processOk"),At=Symbol.for("signal-exit emitter"),Dt=globalThis,Vi=Object.defineProperty.bind(Object);let Qi=class{static{y(this,"y")}static{at(this,"Emitter")}emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(Dt[At])return Dt[At];Vi(Dt,At,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,i){this.listeners[t].push(i)}removeListener(t,i){const r=this.listeners[t],s=r.indexOf(i);s!==-1&&(s===0&&r.length===1?r.length=0:r.splice(s,1))}emit(t,i,r){if(this.emitted[t])return!1;this.emitted[t]=!0;let s=!1;for(const u of this.listeners[t])s=u(i,r)===!0||s;return t==="exit"&&(s=this.emit("afterExit",i,r)||s),s}},Oe=class{static{y(this,"c")}static{at(this,"SignalExitBase")}};const Xi=at(e=>({onExit(t,i){return e.onExit(t,i)},load(){return e.load()},unload(){return e.unload()}}),"signalExitWrap");class Zi extends Oe{static{y(this,"_")}static{at(this,"SignalExitFallback")}onExit(){return()=>{}}load(){}unload(){}}let tr=class extends Oe{static{y(this,"p")}static{at(this,"SignalExit")}#o=Bt.platform==="win32"?"SIGINT":"SIGHUP";#e=new Qi;#t;#s;#n;#r={};#i=!1;constructor(t){super(),this.#t=t,this.#r={};for(const i of st)this.#r[i]=()=>{const r=this.#t.listeners(i);let{count:s}=this.#e;const u=t;if(typeof u.__signal_exit_emitter__=="object"&&typeof u.__signal_exit_emitter__.count=="number"&&(s+=u.__signal_exit_emitter__.count),r.length===s){this.unload();const n=this.#e.emit("exit",null,i),a=i==="SIGHUP"?this.#o:i;n||t.kill(t.pid,a)}};this.#n=t.reallyExit,this.#s=t.emit}onExit(t,i){if(!Tt(this.#t))return()=>{};this.#i===!1&&this.load();const r=i?.alwaysLast?"afterExit":"exit";return this.#e.on(r,t),()=>{this.#e.removeListener(r,t),this.#e.listeners.exit.length===0&&this.#e.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#i){this.#i=!0,this.#e.count+=1;for(const t of st)try{const i=this.#r[t];i&&this.#t.on(t,i)}catch{}this.#t.emit=(t,...i)=>this.#u(t,...i),this.#t.reallyExit=t=>this.#a(t)}}unload(){this.#i&&(this.#i=!1,st.forEach(t=>{const i=this.#r[t];if(!i)throw new Error("Listener not defined for signal: "+t);try{this.#t.removeListener(t,i)}catch{}}),this.#t.emit=this.#s,this.#t.reallyExit=this.#n,this.#e.count-=1)}#a(t){return Tt(this.#t)?(this.#t.exitCode=t||0,this.#e.emit("exit",this.#t.exitCode,null),this.#n.call(this.#t,this.#t.exitCode)):0}#u(t,...i){const r=this.#s;if(t==="exit"&&Tt(this.#t)){typeof i[0]=="number"&&(this.#t.exitCode=i[0]);const s=r.call(this.#t,t,...i);return this.#e.emit("exit",this.#t.exitCode,null),s}else return r.call(this.#t,t,...i)}};const Bt=globalThis.process,{onExit:er}=Xi(Tt(Bt)?new tr(Bt):new Zi);var ir=Object.defineProperty,P=y((e,t)=>ir(e,"name",{value:t,configurable:!0}),"i$2");const Ee="\x1B[200~",de="\x1B[201~",rr=P(e=>e>=48&&e<=63,"isCsiParameterByte"),sr=P(e=>e>=32&&e<=47,"isCsiIntermediateByte"),Pe=P(e=>e>=64&&e<=126,"isCsiFinalByte"),nr=P((e,t,i)=>{const r=t+i+1;let s=r;for(;s<e.length;s++){const u=e.codePointAt(s);if(u===void 0)return"pending";if(!(rr(u)||sr(u))&&!(u===91&&s===r))return Pe(u)?{nextIndex:s+1,sequence:e.slice(t,s+1)}:void 0}return"pending"},"parseCsiSequence"),or=P((e,t,i)=>{const r=t+i+2;if(r>e.length)return"pending";const s=e.codePointAt(r-1);if(!(s===void 0||!Pe(s)))return{nextIndex:r,sequence:e.slice(t,r)}},"parseSs3Sequence"),he=P((e,t,i)=>{const r=e[t+i];if(r===void 0)return"pending";if(r==="[")return nr(e,t,i);if(r==="O")return or(e,t,i)},"parseControlSequence"),ar=P((e,t)=>{const i=e.codePointAt(t+1),r=i!==void 0&&i>65535?2:1,s=t+1+r;return{nextIndex:s,sequence:e.slice(t,s)}},"parseEscapedCodePoint"),ur=P((e,t)=>{if(t===e.length-1)return"pending";if(e[t+1]==="\x1B"){if(t+2>=e.length)return"pending";const r=he(e,t,2);return r==="pending"?"pending":r||{nextIndex:t+2,sequence:e.slice(t,t+2)}}const i=he(e,t,1);return i==="pending"?"pending":i||ar(e,t)},"parseEscapeSequence"),fe=P((e,t)=>{let i=0;for(let r=0;r<e.length;r++){const s=e[r];(s===""||s==="\b")&&(r>i&&t.push(e.slice(i,r)),t.push(s),i=r+1)}i<e.length&&t.push(e.slice(i))},"splitDeleteAndBackspace"),lr=P(e=>{const t=[];let i=0;const r=P(s=>({events:t,pending:e.slice(s)}),"pendingFrom");for(;i<e.length;){const s=e.indexOf("\x1B",i);if(s===-1)return fe(e.slice(i),t),{events:t,pending:""};s>i&&fe(e.slice(i,s),t);const u=ur(e,s);if(u==="pending")return r(s);if(u.sequence===Ee){const n=u.nextIndex,a=e.indexOf(de,n);if(a===-1)return r(s);t.push({paste:e.slice(n,a)}),i=a+de.length;continue}t.push(u.sequence),i=u.nextIndex}return{events:t,pending:""}},"parseKeypresses"),cr=P(()=>{let e="";return{flushPendingEscape(){if(!e.startsWith("\x1B"))return;const t=e;return e="",t},hasPendingEscape(){return e.startsWith("\x1B")&&!e.startsWith(Ee)&&e!=="\x1B[200"},push(t){const i=lr(e+t);return e=i.pending,i.events},reset(){e=""}}},"createInputParser");var dr=Object.defineProperty,hr=y((e,t)=>dr(e,"name",{value:t,configurable:!0}),"x$2"),fr=Object.defineProperty,pr=hr((e,t)=>fr(e,"name",{value:t,configurable:!0}),"x"),mr=Object.defineProperty,B=pr((e,t)=>mr(e,"name",{value:t,configurable:!0}),"u");const J=B((e,...t)=>{process.env.DEBUG&&process.env.DEBUG==="true"&&console.debug(`error:parse-stacktrace: ${e}`,...t)},"debugLog"),V="<unknown>",vr=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,gr=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,yr=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,br=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,wr=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,xr=/in\s(.*)\s\(at\s(.+)\)\sat/,Sr=/^(?:.*@)?(.*):(\d+):(\d+)$/,$r=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Cr=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Tr=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,pe=/\(error: (.*)\)/,Rr=/at\s/,Or=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,Er=/^\s+|\s+$/g,Pr=/\S*(?:Error: |AggregateError:)/,Ne=/^Anonymous function$/,Nr=/^\s*in\s.*/,Ir=/^.*?\s*at\s.*/,kr=/^.*?\s*@.*|\[native code\]/,Ie=B((e,t)=>{const i=e.includes("safari-extension"),r=e.includes("safari-web-extension");return i||r?[e.includes("@")?e.split("@")[0]:V,i?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},"extractSafariExtensionDetails"),ke=B((e,t)=>{const i=yr.exec(t);i&&(e.file=i[1],e.line=+i[2],e.column=+i[3])},"parseMapped"),Lr=B(e=>{const t=xr.exec(e);if(t){J(`parse nested node error stack line: "${e}"`,`found: ${JSON.stringify(t)}`);const r=t[2].split(":");return{column:r[2]?+r[2]:void 0,file:r[0],line:r[1]?+r[1]:void 0,methodName:t[1]??V,raw:e,type:void 0}}const i=wr.exec(e);if(i){J(`parse node error stack line: "${e}"`,`found: ${JSON.stringify(i)}`);const r={column:i[4]?+i[4]:void 0,file:i[2]?i[2].replace(Rr,""):void 0,line:i[3]?+i[3]:void 0,methodName:i[1]??V,raw:e,type:e.startsWith("internal")?"internal":void 0};return ke(r,`${i[2]}:${i[3]}:${i[4]}`),r}},"parseNode"),Ar=B(e=>{const t=vr.exec(e);if(t){J(`parse chrome error stack line: "${e}"`,`found: ${JSON.stringify(t)}`);const i=t[2]?.startsWith("native"),r=t[2]?.startsWith("eval")||t[1]?.startsWith("eval");let s,u;if(r){const c=gr.exec(e);if(c){const f=Or.exec(c[1]);f?(t[2]=f[4]??f[1],t[3]=f[5]??f[2],t[4]=f[3]):c[2]&&(t[2]=c[1]),c[2]&&(s={column:c[4]?+c[4]:void 0,file:c[2],line:c[3]?+c[3]:void 0,methodName:"eval",raw:e,type:"eval"})}else{const f=br.exec(e);f&&(u={column:f[4]?+f[4]:void 0,file:f[2],line:f[3]?+f[3]:void 0},s={column:f[6]?+f[6]:void 0,file:f[1],line:f[5]?+f[5]:void 0,methodName:"eval",raw:f[0],type:"eval"})}}const[n,a]=Ie(t[1]?t[1].replace(Ne,"<anonymous>"):V,t[2]),o={column:t[4]?+t[4]:void 0,evalOrigin:s,file:a,line:t[3]?+t[3]:void 0,methodName:n,raw:e,type:r?"eval":i?"native":void 0};return u?(o.column=u.column,o.file=u.file,o.line=u.line):ke(o,`${a}:${t[3]}:${t[4]}`),o}},"parseChromium"),Dr=B((e,t)=>{const i=$r.exec(e);if(i){J(`parse gecko error stack line: "${e}"`,`found: ${JSON.stringify(i)}`);const r=i[3]?.includes(" > eval"),s=r&&i[3]&&Cr.exec(i[3]);let u;r&&s&&(i[3]=s[1],u={column:i[5]?+i[5]:void 0,file:i[3],line:i[4]?+i[4]:void 0,methodName:"eval",raw:e,type:"eval"},i[4]=s[2]);const[n,a]=Ie(i[1]?i[1].replace(Ne,"<anonymous>"):V,i[3]);let o;(t?.type==="safari"||!r&&t?.type==="firefox")&&t.column?o=t.column:!r&&i[5]&&(o=+i[5]);let c;return(t?.type==="safari"||!r&&t?.type==="firefox")&&t.line?c=t.line:i[4]&&(c=+i[4]),{column:o,evalOrigin:u,file:a,line:c,methodName:n,raw:e,type:r?"eval":a.includes("[native code]")?"native":void 0}}},"parseGecko"),Wr=B((e,t)=>{const i=Tr.exec(e);if(!(i&&i[2].includes(" > eval"))&&i)return J(`parse firefox error stack line: "${e}"`,`found: ${JSON.stringify(i)}`),{column:i[4]?+i[4]:t?.column??void 0,file:i[2],line:i[3]?+i[3]:t?.line??void 0,methodName:i[1]||V,raw:e,type:void 0}},"parseFirefox"),Ur=B(e=>{const t=Sr.exec(e);if(t)return J(`parse react android native error stack line: "${e}"`,`found: ${JSON.stringify(t)}`),{column:t[3]?+t[3]:void 0,file:t[1],line:t[2]?+t[2]:void 0,methodName:V,raw:e,type:void 0}},"parseReactAndroidNative"),_r=B((e,{filter:t,frameLimit:i=50}={})=>{const r=e;let s=(typeof r.stacktrace=="string"?r.stacktrace:e.stack??"").split(`
|
|
4
|
-
`).map(u=>(pe.test(u)?u.replace(pe,"$1"):u).replaceAll(Er,"")).filter(u=>!Pr.test(u)&&u!=="eval code");return t&&(s=s.filter(u=>t(u))),s=s.slice(0,i),s.reduce((u,n,a)=>{if(!n||n.length>1024)return u;let o;if(Nr.test(n))o=Lr(n);else if(Ir.test(n))o=Ar(n);else if(kr.test(n)){let c;if(a===0){const f=e,g=f.columnNumber,d=f.lineNumber,h=f.line,w=f.column;g||d?c={column:g,line:d,type:"firefox"}:(h||w)&&(c={column:w,line:h,type:"safari"})}o=Wr(n,c)??Dr(n,c)}else o=Ur(n);return o?u.push(o):J(`parse error stack line: "${n}"`,"not parser found"),u},[])},"parseStacktrace");var Br=Object.defineProperty,Le=y((e,t)=>Br(e,"name",{value:t,configurable:!0}),"x$1");const me=Le(e=>{if(!e)return e;const t=ei();return e.replace(`file://${t}/`,"").replace(`${t}/`,"")},"cleanupPath");function Ae({error:e}){const t=_r(e),i=t[0],r=me(i?.file);let s,u=0;if(r&&i?.line&&$i(r)){const n=Ci(r,"utf8");if(s=Ti(n,i.line),s)for(const{line:a}of s)u=Math.max(u,String(a).length)}return A(_,{flexDirection:"column",padding:1,children:[A(_,{children:[A(W,{backgroundColor:"red",color:"white",children:[" ","ERROR"," "]}),A(W,{children:[" ",e.message]})]}),i&&r?C(_,{marginTop:1,children:A(W,{dimColor:!0,children:[r,":",i.line,":",i.column]})}):null,i&&s?C(_,{flexDirection:"column",marginTop:1,children:s.map(({line:n,value:a})=>A(_,{children:[C(_,{width:u+1,children:A(W,{"aria-label":n===i.line?`Line ${n}, error`:`Line ${n}`,backgroundColor:n===i.line?"red":void 0,color:n===i.line?"white":void 0,dimColor:n!==i.line,children:[String(n).padStart(u," "),":"]})}),C(W,{backgroundColor:n===i.line?"red":void 0,color:n===i.line?"white":void 0,children:` ${a}`},n)]},n))}):null,t.length>0?C(_,{flexDirection:"column",marginTop:1,children:t.map(n=>{const a=me(n.file)??"";return!n.methodName&&!n.file?A(_,{children:[C(W,{dimColor:!0,children:"- "}),C(W,{bold:!0,dimColor:!0,children:n.raw})]},n.raw):A(_,{children:[C(W,{dimColor:!0,children:"- "}),C(W,{bold:!0,dimColor:!0,children:n.methodName??"<anonymous>"}),A(W,{"aria-label":`at ${a} line ${n.line} column ${n.column}`,color:"gray",dimColor:!0,children:[" ","(",a,":",n.line,":",n.column,")"]})]},n.raw)})}):null]})}y(Ae,"h");Le(Ae,"ErrorOverview");var jr=Object.defineProperty,Mr=y((e,t)=>jr(e,"name",{value:t,configurable:!0}),"o$1");let Hr=class extends bi{static{y(this,"i")}static{Mr(this,"ErrorBoundary")}static displayName="InternalErrorBoundary";static getDerivedStateFromError(t){return{error:t}}state={error:void 0};componentDidCatch(t){this.props.onError(t)}render(){return this.state.error?C(Ae,{error:this.state.error}):this.props.children}};var Kr=Object.defineProperty,ve=y((e,t)=>Kr(e,"name",{value:t,configurable:!0}),"J$1");const Fr=" ",Gr="\x1B[Z",qr="\x1B",zr=we(xe),ge=Se(xe),De=ve(({children:e,exitOnCtrlC:t,interactive:i,onExit:r,onWaitUntilRenderFlush:s,renderThrottleMs:u,setCursorPosition:n,stderr:a,stdin:o,stdout:c,writeToStderr:f,writeToStdout:g})=>{const[d,h]=$t(!0),[w,$]=$t(void 0),[,x]=$t([]),U=D(0),N=D(new Map),j=D(void 0),R=D(0),I=D(!1),M=D(0),[S]=$t(()=>{const l=new gi;return l.setMaxListeners(1/0),l}),H=D(void 0),ut=D(void 0);ut.current??=cr();const lt=D(void 0),Kt=D(!1),He=20,Q=b(()=>{lt.current&&(clearTimeout(lt.current),lt.current=void 0)},[]),X=b(()=>{j.current&&(clearTimeout(j.current),j.current=void 0)},[]),bt=b(()=>{if(X(),N.current.size===0)return;let l=Number.POSITIVE_INFINITY;for(const p of N.current.values())l=Math.min(l,p.nextDueTime);const m=Math.max(0,l-performance.now());j.current=setTimeout(()=>{j.current=void 0;const p=performance.now(),T=[...N.current.values()];for(const O of T){if(p<O.nextDueTime)continue;O.callback(p);const Ve=p-O.startTime,Qe=Math.floor(Ve/O.interval)+1;O.nextDueTime=O.startTime+Qe*O.interval}bt()},m)},[X]),Ft=b((l,m)=>{const p=performance.now();return N.current.set(l,{callback:l,interval:m,nextDueTime:p+m,startTime:p}),bt(),{startTime:p,unsubscribe(){if(N.current.delete(l),N.current.size===0){X();return}bt()}}},[X,bt]);kt(()=>()=>{X()},[X]);const K=o.isTTY,Gt=b(()=>{H.current&&(o.removeListener("readable",H.current),H.current=void 0)},[o]),wt=b(()=>{ut.current?.reset(),Q(),Gt()},[Q,Gt]),Z=b(()=>{I.current=!1,o.setRawMode(!1),o.unref(),R.current=0,wt()},[o,wt]),ct=b(l=>{K&&(R.current>0||I.current)&&Z(),r(l)},[K,Z,r]),qt=b(l=>{if(l.includes("")&&t){ct();return}l===qr&&d&&$(m=>{if(!m)return m})},[t,ct,d]),dt=b(l=>{qt(l),S.emit("input",l)},[qt,S]),zt=b(()=>{Q(),lt.current=setTimeout(()=>{lt.current=void 0;const l=ut.current.flushPendingEscape();l&&dt(l)},He)},[Q,dt]),Nt=b(()=>{Q();let l;for(;(l=o.read())!==null;){const m=ut.current.push(l);for(const p of m)if(typeof p=="string")dt(p);else{if(S.listenerCount("paste")===0){Kt.current||(Kt.current=!0,f(`Warning: useInput() received bracketed paste because no usePaste() handler is active. This fallback is deprecated and will be removed in the next major version. Migrate paste handling to usePaste().
|
|
5
|
-
`)),dt(p.paste);continue}S.emit("paste",p.paste)}}ut.current.hasPendingEscape()&&zt()},[o,dt,Q,zt,f,S]),Yt=b(()=>{H.current||(H.current=Nt,o.addListener("readable",Nt))},[o,Nt]),Jt=b(l=>{if(!K)throw o===L.stdin?new Error(`Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default.
|
|
6
|
-
Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`):new Error(`Raw mode is not supported on the stdin provided to Ink.
|
|
7
|
-
Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`);if(o.setEncoding("utf8"),l){if(R.current===0){const m=I.current;I.current=!1,m||(o.ref(),o.setRawMode(!0)),Yt()}R.current++;return}R.current!==0&&--R.current===0&&(wt(),I.current=!0,queueMicrotask(()=>{I.current&&Z()}))},[K,o,Yt,wt,Z]),Vt=b(l=>{if(c.isTTY){if(l){M.current===0&&c.write(zr),M.current++;return}M.current!==0&&--M.current===0&&c.write(ge)}},[c]),Qt=b((l,m)=>{const p=l.findIndex(T=>T.id===m);for(let T=p+1;T<l.length;T++){const O=l[T];if(O?.isActive)return O.id}},[]),Xt=b((l,m)=>{const p=l.findIndex(T=>T.id===m);for(let T=p-1;T>=0;T--){const O=l[T];if(O?.isActive)return O.id}},[]),xt=b(()=>{x(l=>($(m=>{const p=l.find(T=>T.isActive)?.id;return Qt(l,m)??p}),l))},[Qt]),St=b(()=>{x(l=>($(m=>{const p=l.findLast(T=>T.isActive)?.id;return Xt(l,m)??p}),l))},[Xt]);kt(()=>{const l=ve(p=>{!d||U.current===0||(p===Fr&&xt(),p===Gr&&St())},"handleTabNavigation");S.on("input",l);const m=S;return()=>{m.off("input",l)}},[d,xt,St,S]);const Zt=b(()=>{h(!0)},[]),te=b(()=>{h(!1)},[]),ee=b(l=>{x(m=>(m.some(p=>p?.id===l)&&$(l),m))},[]),ie=b((l,{autoFocus:m})=>{x(p=>(U.current=p.length+1,[...p,{id:l,isActive:!0}])),m&&$(p=>p||l)},[]),re=b(l=>{$(m=>{if(m!==l)return m}),x(m=>{const p=m.filter(T=>T.id!==l);return U.current=p.length,p})},[]),se=b(l=>{x(m=>m.map(p=>p.id!==l?p:{id:l,isActive:!0}))},[]),ne=b(l=>{$(m=>{if(m!==l)return m}),x(m=>m.map(p=>p.id!==l?p:{id:l,isActive:!1}))},[]);kt(()=>()=>{const l=!c.destroyed&&!c.writableEnded;i&&l&&c.write(gt),K&&(R.current>0||I.current)&&Z(),M.current>0&&(c.isTTY&&l&&c.write(ge),M.current=0)},[c,K,Z,i]);const Ke=G(()=>({exit:ct,waitUntilRenderFlush:s}),[ct,s]),Fe=G(()=>({internal_eventEmitter:S,internal_exitOnCtrlC:t,isRawModeSupported:K,setBracketedPasteMode:Vt,setRawMode:Jt,stdin:o}),[o,Jt,Vt,K,t,S]),Ge=G(()=>({stdout:c,write:g}),[c,g]),qe=G(()=>({stderr:a,write:f}),[a,f]),ze=G(()=>({setCursorPosition:n}),[n]),Ye=G(()=>({activate:se,activeId:w,add:ie,deactivate:ne,disableFocus:te,enableFocus:Zt,focus:ee,focusNext:xt,focusPrevious:St,remove:re}),[w,ie,re,se,ne,Zt,te,xt,St,ee]),Je=G(()=>({renderThrottleMs:u,subscribe:Ft}),[Ft,u]);return C(xi.Provider,{value:Ke,children:C(Ei.Provider,{value:Fe,children:C(Pi.Provider,{value:Ge,children:C(Oi.Provider,{value:qe,children:C(Ri.Provider,{value:Ye,children:C(wi.Provider,{value:Je,children:C(Si.Provider,{value:ze,children:C(Hr,{onError:ct,children:e})})})})})})})})},"App");De.displayName="InternalApp";const jt=new WeakMap;var Yr=Object.defineProperty,yt=y((e,t)=>Yr(e,"name",{value:t,configurable:!0}),"e");const Rt=yt((e,t)=>e?.x!==t?.x||e?.y!==t?.y,"cursorPositionChanged"),nt=yt((e,t)=>{if(!t)return"";const i=e-t.y;return(i>0?Ut(i):"")+Pt(t.x)+gt},"buildCursorSuffix"),We=yt((e,t)=>{if(!t)return"";const i=e-1-t.y;return(i>0?ui(i):"")+Pt(0)},"buildReturnToBottom"),Ue=yt(e=>{const t=e.cursorWasShown?Y:"",i=We(e.previousLineCount,e.previousCursorPosition),r=nt(e.visibleLineCount,e.cursorPosition);return t+i+r},"buildCursorOnlySequence"),Ot=yt((e,t,i)=>e?Y+We(t,i):"","buildReturnToBottomPrefix");var Jr=Object.defineProperty,E=y((e,t)=>Jr(e,"name",{value:t,configurable:!0}),"c$2");const mt=E((e,t)=>t.endsWith(`
|
|
8
|
-
`)?e.length-1:e.length,"visibleLineCount"),_e=E(e=>e.rows||1/0,"getViewportRows"),Et=E((e,t)=>Math.min(e,_e(t)),"clampToViewport"),Vr=E((e,{showCursor:t=!1}={})=>{let i=0,r="",s=!1,u,n=!1,a,o=!1;const c=E(()=>n?u:void 0,"getActiveCursor"),f=E((d,h)=>{const w=Rt(h,a);return d!==r||w},"hasChanges"),g=E(d=>{!t&&!s&&(e.write(Y),s=!0);const h=c();n=!1;const w=Rt(h,a);if(!f(d,h))return!1;const $=d.split(`
|
|
9
|
-
`),x=mt($,d),U=nt(x,h);if(d===r&&w)e.write(Ue({cursorPosition:h,cursorWasShown:o,previousCursorPosition:a,previousLineCount:i,visibleLineCount:x}));else{r=d;const N=Ot(o,i,a);e.write(N+z(Et(i,e))+d+U),i=$.length}return a=h?{...h}:void 0,o=h!==void 0,!0},"render");return g.clear=()=>{const d=Ot(o,i,a);e.write(d+z(Et(i,e))),r="",i=0,a=void 0,o=!1},g.done=()=>{r="",i=0,a=void 0,o=!1,t||(e.write(gt),s=!1)},g.reset=()=>{r="",i=0,a=void 0,o=!1},g.sync=d=>{const h=n?u:void 0;n=!1;const w=d.split(`
|
|
10
|
-
`);r=d,i=w.length,!h&&o&&e.write(Y),h&&e.write(nt(mt(w,d),h)),a=h?{...h}:void 0,o=h!==void 0},g.setCursorPosition=d=>{u=d,n=!0},g.isCursorDirty=()=>n,g.willRender=d=>f(d,c()),g},"createStandard"),Qr=E((e,{showCursor:t=!1}={})=>{let i=[],r="",s=!1,u,n=!1,a,o=!1;const c=E(()=>n?u:void 0,"getActiveCursor"),f=E((d,h)=>{const w=Rt(h,a);return d!==r||w},"hasChanges"),g=E(d=>{!t&&!s&&(e.write(Y),s=!0);const h=c();n=!1;const w=Rt(h,a);if(!f(d,h))return!1;const $=d.split(`
|
|
11
|
-
`),x=mt($,d),U=mt(i,r);if(d===r&&w)return e.write(Ue({cursorPosition:h,cursorWasShown:o,previousCursorPosition:a,previousLineCount:i.length,visibleLineCount:x})),a=h?{...h}:void 0,o=h!==void 0,!0;const N=Ot(o,i.length,a);if(d===`
|
|
12
|
-
`||r.length===0){const S=nt(x,h);return e.write(N+z(Et(i.length,e))+d+S),o=h!==void 0,a=h?{...h}:void 0,r=d,i=$,!0}const j=d.endsWith(`
|
|
13
|
-
`),R=[N],I=_e(e);if(x<U){const S=r.endsWith(`
|
|
14
|
-
`)?1:0;R.push(z(Math.min(U-x+S,I)),Ut(Math.min(x,I-1)))}else R.push(Ut(Math.min(U-1,I-1)));for(let S=0;S<x;S++){const H=S===x-1;if($[S]===i[S]){(!H||j)&&R.push(li());continue}R.push(Pt(0)+$[S]+ci+(H&&!j?"":`
|
|
15
|
-
`))}const M=nt(x,h);return R.push(M),e.write(R.join("")),o=h!==void 0,a=h?{...h}:void 0,r=d,i=$,!0},"render");return g.clear=()=>{const d=Ot(o,i.length,a);e.write(d+z(Et(i.length,e))),r="",i=[],a=void 0,o=!1},g.done=()=>{r="",i=[],a=void 0,o=!1,t||(e.write(gt),s=!1)},g.reset=()=>{r="",i=[],a=void 0,o=!1},g.sync=d=>{const h=n?u:void 0;n=!1;const w=d.split(`
|
|
16
|
-
`);r=d,i=w,!h&&o&&e.write(Y),h&&e.write(nt(mt(w,d),h)),a=h?{...h}:void 0,o=h!==void 0},g.setCursorPosition=d=>{u=d,n=!0},g.isCursorDirty=()=>n,g.willRender=d=>f(d,c()),g},"createIncremental"),Xr=E((e,{incremental:t=!1,showCursor:i=!1}={})=>t?Qr(e,{showCursor:i}):Vr(e,{showCursor:i}),"create"),Zr={create:Xr};var ts=Object.defineProperty,es=y((e,t)=>ts(e,"name",{value:t,configurable:!0}),"t");const Be=yi(2026),q=we(Be),F=Se(Be);function je(e,t){return"isTTY"in e&&e.isTTY&&(t??!Re)}y(je,"shouldSynchronize");es(je,"shouldSynchronize");var is=Object.defineProperty,Mt=y((e,t)=>is(e,"name",{value:t,configurable:!0}),"o");let et;const rs=Mt(()=>{if(et!==!1){if(et!==void 0)return et;try{return et=require("../../index.js").Renderer,et}catch{et=!1;return}}},"getRendererClass"),ss=Mt(e=>{const t=rs();if(!t)return;let i,r=0,s=0;const u=Mt((n,a)=>{(!i||r!==n||s!==a)&&(i?i.resize(n,a):i=new t(n,a),r=n,s=a)},"ensureRenderer");return{clear(){if(i){const n=new Uint32Array(r*s*2),a=65535;for(let o=0;o<n.length;o+=2)n[o]=32,n[o+1]=a;i.render(n)}},destroy(){i=void 0},render(n,a,o){if(u(a,o),!!i){e.isTTY&&i.writeRaw(q);try{i.render(n)}finally{e.isTTY&&i.writeRaw(F)}}},resize(n,a){u(n,a)}}},"createNative");var ns=Object.defineProperty,v=y((e,t)=>ns(e,"name",{value:t,configurable:!0}),"n");console.Console||(console.Console=ri);const ht=v(()=>{},"noop"),ye=v(async()=>new Promise(e=>{setImmediate(e)}),"yieldImmediate"),os=27,as=91,us=63,ls=117,cs=48,ds=57,hs=v(e=>e>=cs&&e<=ds,"isDigitByte"),Me=v((e,t)=>{if(e[t]!==os||e[t+1]!==as||e[t+2]!==us)return;let i=t+3;const r=i;for(;i<e.length&&hs(e[i]);)i++;if(i!==r){if(i===e.length)return{state:"partial"};if(e[i]===ls)return{endIndex:i,state:"complete"}}},"matchKittyQueryResponse"),fs=v(e=>{for(let t=0;t<e.length;t++)if(Me(e,t)?.state==="complete")return!0;return!1},"hasCompleteKittyQueryResponse"),ps=v(e=>{const t=[];let i=0;for(;i<e.length;){const r=Me(e,i);if(r?.state==="complete"){i=r.endIndex+1;continue}if(r?.state==="partial")break;t.push(e[i]),i++}return t},"stripKittyQueryResponsesAndTrailingPartial"),ms=v(({isTty:e,isUnmounting:t,nextOutputHeight:i,previousOutputHeight:r,viewportRows:s})=>{if(!e)return!1;const u=r>0,n=r>=s,a=r>s,o=i>s,c=n&&i<s;return a||o&&u||c||t&&n},"shouldClearTerminalForFrame"),Wt=v(e=>e instanceof Error||Object.prototype.toString.call(e)==="[object Error]","isErrorInput"),be=v(e=>{const t=!e.destroyed&&!e.writableEnded&&(e.writable??!0),i=e._writableState!==void 0||e.writableLength!==void 0;return{canWriteToStdout:t,hasWritableState:i}},"getWritableStreamState"),Ct=v((e,t)=>{if(!e||typeof e.flush!="function")return;const i=e;t?i.flush():typeof i.cancel=="function"&&i.cancel()},"settleThrottle");class vs{static{y(this,"ft")}static{v(this,"Ink")}isConcurrent;options;log;manualCursorPosition;renderedCursorPosition;renderedCursorRequested;throttledLog;isScreenReaderEnabled;interactive;renderThrottleMs;alternateScreen;isUnmounted;isUnmounting;lastOutput;lastOutputToRender;lastOutputHeight;lastTerminalWidth;nativeLog;useNativeRenderer;container;rootNode;fullStaticOutput;exitPromise;exitResult;beforeExitHandler;restoreConsole;unsubscribeResize;throttledOnRender;hasPendingThrottledRender=!1;kittyProtocolEnabled=!1;cancelKittyDetection;nextRenderCommit;deferredInitDone=!1;constructor(t){this.options=t,this.rootNode=di("ink-root"),this.rootNode.onComputeLayout=this.calculateLayout,this.isScreenReaderEnabled=t.isScreenReaderEnabled??L.env.INK_SCREEN_READER==="true",this.interactive=this.resolveInteractiveOption(t.interactive),this.alternateScreen=!1;const i=t.debug||this.isScreenReaderEnabled,r=t.maxFps??30,s=r>0?Math.max(1,Math.ceil(1e3/r)):0;this.renderThrottleMs=i?0:s;const u=i?this.onRender:(()=>{const a=_t(this.onRender,s,{leading:!0,trailing:!0});return this.throttledOnRender=a,()=>{this.hasPendingThrottledRender=!0,a()}})();if(i&&(this.throttledOnRender=void 0),t.standardReactLayoutTiming){let a=!1;const o=v(()=>{a||(a=!0,queueMicrotask(()=>{a=!1,this.onRender()}))},"deferredRender");this.rootNode.onRender=o,this.rootNode.onImmediateRender=o}else this.rootNode.onRender=u,this.rootNode.onImmediateRender=this.onRender;this.rootNode.onStaticChange=this.handleStaticChange,this.log=Zr.create(t.stdout,{incremental:t.incrementalRendering}),this.useNativeRenderer=t.useNativeRenderer??!1,this.useNativeRenderer&&(this.nativeLog=ss(t.stdout),this.nativeLog||(this.useNativeRenderer=!1)),this.manualCursorPosition=void 0,this.renderedCursorPosition=void 0,this.renderedCursorRequested=!1,this.throttledLog=i?this.log:_t(a=>{const o=this.log.willRender(a),c=this.shouldSync();c&&o&&this.options.stdout.write(q),this.log(a),c&&o&&this.options.stdout.write(F)},void 0,{leading:!0,trailing:!0}),this.isUnmounted=!1,this.isUnmounting=!1,this.isConcurrent=t.concurrent??!1,this.lastOutput="",this.lastOutputToRender="",this.lastOutputHeight=0,this.lastTerminalWidth=tt(this.options.stdout).columns,this.fullStaticOutput="";const n=t.concurrent?pi:mi;this.container=k.createContainer(this.rootNode,n,null,!1,null,"id",()=>{},()=>{},()=>{},()=>{}),this.unsubscribeExit=er(this.unmount,{alwaysLast:!1}),this.setAlternateScreen(!!t.alternateScreen),t.patchConsole&&this.patchConsole(),this.interactive&&(t.stdout.on("resize",this.resized),this.unsubscribeResize=()=>{t.stdout.off("resize",this.resized)}),this.initImmediateKittyKeyboard(),L.env.DEV==="true"&&k.injectIntoDevTools(),this.exitPromise=new Promise((a,o)=>{this.resolveExitPromise=a,this.rejectExitPromise=o}),this.exitPromise.catch(ht)}runDeferredInit(){this.deferredInitDone||(this.deferredInitDone=!0,this.initDeferredKittyKeyboard())}resized=v(()=>{const t=tt(this.options.stdout).columns;t<this.lastTerminalWidth&&(this.log.clear(),this.lastOutput="",this.lastOutputToRender=""),Ii(),this.calculateLayout(),hi(this.rootNode),this.onRender(),this.lastTerminalWidth=t},"resized");resolveExitPromise=v(()=>{},"resolveExitPromise");rejectExitPromise=v(()=>{},"rejectExitPromise");unsubscribeExit=v(()=>{},"unsubscribeExit");handleAppExit=v(t=>{if(!(this.isUnmounted||this.isUnmounting)){if(Wt(t)){this.unmount(t);return}this.exitResult=t,this.unmount()}},"handleAppExit");getActiveCursorPosition=v(()=>this.renderedCursorRequested?this.renderedCursorPosition:this.manualCursorPosition,"getActiveCursorPosition");setCursorPosition=v(t=>{this.manualCursorPosition=t,this.log.setCursorPosition(this.getActiveCursorPosition())},"setCursorPosition");restoreLastOutput=v(()=>{this.interactive&&(this.log.setCursorPosition(this.getActiveCursorPosition()),this.log(this.lastOutputToRender||`${this.lastOutput}
|
|
17
|
-
`))},"restoreLastOutput");calculateLayout=v(()=>{const t=v(r=>{const s=new Map;this.calculateScrollAndTriggerObservers(r,s);for(const[u,n]of s)u.internalTrigger(n)},"flushLayoutObservers");this.prepareYogaTree(this.rootNode,t);const i=tt(this.options.stdout).columns;this.rootNode.yogaNode.setWidth(i),this.rootNode.yogaNode.calculateLayout(void 0,void 0,ue.DIRECTION_LTR),t(this.rootNode)},"calculateLayout");calculateScrollAndTriggerObservers(t,i){if(t.nodeName==="ink-box"){const{style:r}=t,s=r.overflow??"visible",u=r.overflowX??s,n=r.overflowY??s;u==="scroll"||n==="scroll"?Wi(t):t.internal_scrollState&&delete t.internal_scrollState}if(Di(t,i),!t.internal_static)for(const r of t.childNodes)r.nodeName!=="#text"&&this.calculateScrollAndTriggerObservers(r,i)}recalculateLayout(){this.markAllTextNodesDirty(this.rootNode),this.calculateLayout(),this.onRender()}prepareYogaTree(t,i){if(t.isYogaTreeDetached&&!t.cachedRender&&t.yogaNode){for(t.yogaNode.setWidthAuto(),t.yogaNode.setHeightAuto(),ki(t.yogaNode,t.style);t.yogaNode.getChildCount()>0;)t.yogaNode.getChild(0).remove();let r=0;for(const s of t.childNodes){const u=s;s.nodeName!=="#text"&&u.yogaNode&&(t.yogaNode.insertChild(u.yogaNode,r),r++)}t.isYogaTreeDetached=!1,this.markAllTextNodesDirty(t)}for(const r of t.childNodes)r.nodeName!=="#text"&&this.prepareYogaTree(r,i);if(t.nodeName==="ink-static-render"&&!t.cachedRender){const r=tt(this.options.stdout).columns,{width:s}=t.style;t.yogaNode&&(t.yogaNode.setWidth(typeof s=="number"?s:r),t.yogaNode.calculateLayout(void 0,void 0,ue.DIRECTION_LTR)),i(t),Li(t,{skipStaticElements:!1,trackSelection:this.options.trackSelection}),t.internal_onRendered?.()}}markAllTextNodesDirty(t){if(!t.cachedRender){t.nodeName==="ink-text"&&t.yogaNode&&t.yogaNode.markDirty();for(const i of t.childNodes)i.nodeName!=="#text"&&this.markAllTextNodesDirty(i)}}handleStaticChange=v(()=>{this.fullStaticOutput=""},"handleStaticChange");onRender=v(()=>{if(this.hasPendingThrottledRender=!1,this.isUnmounted)return;this.deferredInitDone||this.runDeferredInit(),this.nextRenderCommit&&(this.nextRenderCommit.resolve(),this.nextRenderCommit=void 0);const t=Ai(this.rootNode,this.isScreenReaderEnabled,{useNativeRenderer:this.useNativeRenderer}),{cursorPosition:i,cursorRequested:r,output:s,outputBuffer:u,outputHeight:n,outputWidth:a,staticOutput:o}=t;if(this.renderedCursorRequested=r,this.renderedCursorPosition=i,this.useNativeRenderer&&this.nativeLog&&u&&a){o&&o!==`
|
|
18
|
-
`&&this.options.stdout.write(o),this.nativeLog.render(u,a,n),this.lastOutputHeight=n;return}r&&this.log.setCursorPosition(this.getActiveCursorPosition());const c=o&&o!==`
|
|
19
|
-
`;if(this.options.debug){c&&(this.fullStaticOutput+=o),this.lastOutput=s,this.lastOutputToRender=s,this.lastOutputHeight=n,this.options.stdout.write(this.fullStaticOutput+s);return}if(!this.interactive){c&&this.options.stdout.write(o),this.lastOutput=s,this.lastOutputToRender=`${s}
|
|
20
|
-
`,this.lastOutputHeight=n;return}if(this.isScreenReaderEnabled){const f=this.shouldSync();if(f&&this.options.stdout.write(q),c){const h=this.lastOutputHeight>0?z(this.lastOutputHeight):"";this.options.stdout.write(h+o),this.lastOutputHeight=0}if(s===this.lastOutput&&!c){f&&this.options.stdout.write(F);return}const g=tt(this.options.stdout).columns,d=fi(s,{trim:!1,width:g,wrapMode:"BREAK_WORDS"}).replace(/\n$/,"");if(c)this.options.stdout.write(d);else{const h=this.lastOutputHeight>0?z(this.lastOutputHeight):"";this.options.stdout.write(h+d)}this.lastOutput=s,this.lastOutputToRender=d,this.lastOutputHeight=d===""?0:d.split(`
|
|
21
|
-
`).length,f&&this.options.stdout.write(F);return}c&&(this.fullStaticOutput+=o),this.renderInteractiveFrame(s,n,c?o:"")},"onRender");accessibilityContextValue;render(t){this.accessibilityContextValue??={isScreenReaderEnabled:this.isScreenReaderEnabled};const i=C(vi.Provider,{value:this.accessibilityContextValue,children:C(De,{exitOnCtrlC:this.options.exitOnCtrlC,interactive:this.interactive,onExit:this.handleAppExit,onWaitUntilRenderFlush:this.waitUntilRenderFlush,renderThrottleMs:this.renderThrottleMs,setCursorPosition:this.setCursorPosition,stderr:this.options.stderr,stdin:this.options.stdin,stdout:this.options.stdout,writeToStderr:this.writeToStderr,writeToStdout:this.writeToStdout,children:t})});this.options.concurrent?k.updateContainer(i,this.container,null,ht):(k.updateContainerSync(i,this.container,null,ht),k.flushSyncWork())}writeToStdout=v(t=>{if(this.isUnmounted)return;if(this.options.debug){this.options.stdout.write(t+this.fullStaticOutput+this.lastOutput);return}if(!this.interactive){this.options.stdout.write(t);return}const i=this.shouldSync();i&&this.options.stdout.write(q),this.log.clear(),this.options.stdout.write(t),this.restoreLastOutput(),i&&this.options.stdout.write(F)},"writeToStdout");writeToStderr=v(t=>{if(this.isUnmounted)return;if(this.options.debug){this.options.stderr.write(t),this.options.stdout.write(this.fullStaticOutput+this.lastOutput);return}if(!this.interactive){this.options.stderr.write(t);return}const i=this.shouldSync();i&&this.options.stdout.write(q),this.log.clear(),this.options.stderr.write(t),this.restoreLastOutput(),i&&this.options.stdout.write(F)},"writeToStderr");unmount=v(t=>{if(this.isUnmounted||this.isUnmounting)return;this.isUnmounting=!0,this.beforeExitHandler&&(L.off("beforeExit",this.beforeExitHandler),this.beforeExitHandler=void 0);const i=this.options.stdout,{canWriteToStdout:r,hasWritableState:s}=be(i);Ct(this.throttledOnRender,r),r&&!this.alternateScreen&&(!this.throttledOnRender||!this.hasPendingThrottledRender&&this.fullStaticOutput==="")&&(this.calculateLayout(),this.onRender()),this.isUnmounted=!0,this.unsubscribeExit(),Ct(this.throttledLog,r),typeof this.restoreConsole=="function"&&this.restoreConsole();const u=v(()=>{typeof this.unsubscribeResize=="function"&&this.unsubscribeResize(),this.cancelKittyDetection&&this.cancelKittyDetection(),r&&(this.kittyProtocolEnabled&&this.writeBestEffort(this.options.stdout,"\x1B[<u"),this.alternateScreen?(this.log.clear(),this.log.done(),this.lastOutput="",this.lastOutputToRender="",this.lastOutputHeight=0,this.fullStaticOutput="",this.writeBestEffort(this.options.stdout,Te),this.writeBestEffort(this.options.stdout,gt),this.alternateScreen=!1):this.interactive?this.options.debug||this.log.done():this.options.stdout.write(this.options.debug?`
|
|
22
|
-
`:`${this.lastOutput}
|
|
23
|
-
`)),this.kittyProtocolEnabled=!1,jt.delete(this.options.stdout);const{exitResult:a}=this,o=v(()=>{Wt(t)?this.rejectExitPromise(t):this.resolveExitPromise(a)},"resolveOrReject");t!==void 0&&!Wt(t)?o():r&&s?this.options.stdout.write("",o):setImmediate(o)},"finishUnmount"),n=k;this.options.concurrent?(k.updateContainerSync(null,this.container,null,ht),k.flushSyncWork(),n.flushPassiveEffects?.(),u()):(k.updateContainerSync(null,this.container,null,ht),k.flushSyncWork(),u())},"unmount");async waitUntilExit(){return this.beforeExitHandler||(this.beforeExitHandler=()=>{this.unmount()},L.on("beforeExit",this.beforeExitHandler)),this.exitPromise}async waitUntilRenderFlush(){if(this.isUnmounted||this.isUnmounting){await this.awaitExit();return}if(await ye(),this.isUnmounted||this.isUnmounting){await this.awaitExit();return}if(this.isConcurrent&&this.hasPendingConcurrentWork()&&(await Promise.race([this.awaitNextRender(),this.awaitExit()]),this.isUnmounted||this.isUnmounting)){this.nextRenderCommit=void 0,await this.awaitExit();return}k.flushSyncWork();const t=this.options.stdout,{canWriteToStdout:i,hasWritableState:r}=be(t);if(Ct(this.throttledOnRender,i),Ct(this.throttledLog,i),i&&r){await new Promise(s=>{this.options.stdout.write("",()=>{s()})});return}await ye()}clear(){this.interactive&&!this.options.debug&&(this.log.clear(),this.log.sync(this.lastOutputToRender||`${this.lastOutput}
|
|
24
|
-
`))}patchConsole(){this.options.debug||(this.restoreConsole=Yi((t,i)=>{t==="stdout"&&this.writeToStdout(i),t==="stderr"&&(i.startsWith("The above error occurred")||this.writeToStderr(i))}))}setAlternateScreen(t){this.alternateScreen=this.resolveAlternateScreenOption(t,this.interactive),this.alternateScreen&&(this.writeBestEffort(this.options.stdout,Ce),this.writeBestEffort(this.options.stdout,Y))}resolveInteractiveOption(t){return t??(!Re&&!!this.options.stdout.isTTY)}resolveAlternateScreenOption(t,i){return!!t&&i&&!!this.options.stdout.isTTY}shouldSync(){return je(this.options.stdout,this.interactive)}writeBestEffort(t,i){try{t.write(i)}catch{}}async awaitExit(){try{await this.exitPromise}catch{}}hasPendingConcurrentWork(){const t=this.container;return(t.pendingLanes??0)!==0&&t.callbackNode!==void 0&&t.callbackNode!==null}async awaitNextRender(){if(!this.nextRenderCommit){let t;const i=new Promise(r=>{t=r});this.nextRenderCommit={promise:i,resolve:t}}return this.nextRenderCommit.promise}renderInteractiveFrame(t,i,r){const s=r!=="",u=this.options.stdout.isTTY,n=u?tt(this.options.stdout).rows:24,a=u&&i>=n?t:`${t}
|
|
25
|
-
`;if(ms({isTty:u,isUnmounting:this.isUnmounting,nextOutputHeight:i,previousOutputHeight:this.lastOutputHeight,viewportRows:n})){if(this.options.incrementalRendering){s&&(this.log.clear(),this.options.stdout.write(r)),(t!==this.lastOutput||this.log.isCursorDirty()||s)&&this.throttledLog(a),this.lastOutput=t,this.lastOutputToRender=a,this.lastOutputHeight=i;return}const o=this.shouldSync();o&&this.options.stdout.write(q),this.options.stdout.write(Hi+this.fullStaticOutput+t),this.lastOutput=t,this.lastOutputToRender=a,this.lastOutputHeight=i,this.log.sync(a),o&&this.options.stdout.write(F);return}if(s){const o=this.shouldSync();o&&this.options.stdout.write(q),this.log.clear(),this.options.stdout.write(r),this.log(a),o&&this.options.stdout.write(F)}else(t!==this.lastOutput||this.log.isCursorDirty())&&this.throttledLog(a);this.lastOutput=t,this.lastOutputToRender=a,this.lastOutputHeight=i}initImmediateKittyKeyboard(){if(!this.options.kittyKeyboard)return;const t=this.options.kittyKeyboard;if((t.mode??"auto")!=="enabled")return;const i=t.flags??["disambiguateEscapeCodes"];this.options.stdin.isTTY&&this.options.stdout.isTTY&&this.enableKittyProtocol(i)}initDeferredKittyKeyboard(){if(!this.options.kittyKeyboard)return;const t=this.options.kittyKeyboard;if((t.mode??"auto")!=="auto")return;const i=t.flags??["disambiguateEscapeCodes"];!this.interactive||!this.options.stdin.isTTY||!this.options.stdout.isTTY||this.confirmKittySupport(i)}confirmKittySupport(t){const{stdin:i,stdout:r}=this.options;let s=[];const u=v(()=>{this.cancelKittyDetection=void 0,clearTimeout(a),i.removeListener("data",n);const o=ps(s);s=[],o.length>0&&i.unshift(ae.from(o))},"cleanup"),n=v(o=>{const c=typeof o=="string"?ae.from(o):o;for(const f of c)s.push(f);fs(s)&&(u(),this.isUnmounted||this.enableKittyProtocol(t))},"onData");i.on("data",n);const a=setTimeout(u,200);this.cancelKittyDetection=u,r.write("\x1B[?u")}enableKittyProtocol(t){this.options.stdout.write(`\x1B[>${Ni(t)}u`),this.kittyProtocolEnabled=!0}}var gs=Object.defineProperty,Ht=y((e,t)=>gs(e,"name",{value:t,configurable:!0}),"i");const Xs=Ht((e,t)=>{const i={alternateScreen:!1,concurrent:!1,debug:!1,exitOnCtrlC:!0,incrementalRendering:!1,maxFps:30,patchConsole:!0,stderr:L.stderr,stdin:L.stdin,stdout:L.stdout,...ys(t)},r=bs(i.stdout,()=>new vs(i));return r.render(e),{cleanup(){r.unmount()},clear(){r.clear()},rerender(s){r.render(s)},rootNode:r.rootNode,unmount(){r.unmount()},waitUntilExit(){return r.waitUntilExit()},waitUntilRenderFlush(){return r.waitUntilRenderFlush()}}},"render"),ys=Ht((e={})=>e instanceof ii?{stdin:L.stdin,stdout:e}:e,"getOptions"),bs=Ht((e,t)=>{const i=jt.get(e);if(i===void 0){const r=t();return jt.set(e,r),r}return L.stderr.write(`Warning: render() was called again for the same stdout before the previous Ink instance was unmounted. Reusing stdout across multiple render() calls is unsupported. Call unmount() first.
|
|
26
|
-
`),i},"getInstance");export{Xs as default};
|