@visulima/tui 1.0.0-alpha.16 → 1.0.0-alpha.18
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 +32 -0
- package/LICENSE.md +218 -253
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/approval-prompt.d.ts +1 -1
- package/dist/components/area-chart.d.ts +1 -1
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/bar-chart.d.ts +1 -1
- package/dist/components/blink-dot.d.ts +1 -1
- package/dist/components/box.d.ts +4 -3
- package/dist/components/breadcrumb.d.ts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/calendar.d.ts +1 -1
- package/dist/components/canvas.js +1 -1
- package/dist/components/card.d.ts +1 -1
- package/dist/components/checkbox.d.ts +1 -1
- package/dist/components/collapsible.d.ts +1 -1
- package/dist/components/command-palette.d.ts +1 -1
- package/dist/components/content-switcher.d.ts +1 -1
- package/dist/components/controlled-scroll-view.d.ts +4 -3
- package/dist/components/controlled-scroll-view.js +1 -1
- package/dist/components/cursor.d.ts +4 -3
- package/dist/components/date-picker.d.ts +1 -1
- package/dist/components/definition-list.d.ts +1 -1
- package/dist/components/dialog.d.ts +5 -4
- package/dist/components/dialog.js +1 -1
- package/dist/components/divider.d.ts +1 -1
- package/dist/components/form.d.ts +1 -1
- package/dist/components/gauge.d.ts +1 -1
- package/dist/components/gradient.d.ts +1 -18
- package/dist/components/gradient.js +1 -4
- package/dist/components/heading.d.ts +1 -1
- package/dist/components/heatmap.d.ts +1 -1
- package/dist/components/histogram.d.ts +1 -1
- package/dist/components/kbd.d.ts +1 -1
- package/dist/components/line-chart.d.ts +1 -1
- package/dist/components/link.js +1 -1
- package/dist/components/loading-indicator.d.ts +2 -2
- package/dist/components/menu.d.ts +1 -1
- package/dist/components/message-bubble.d.ts +1 -1
- package/dist/components/model-badge.d.ts +1 -1
- package/dist/components/multi-select.d.ts +1 -1
- package/dist/components/option-list.d.ts +1 -1
- package/dist/components/paragraph.d.ts +1 -1
- package/dist/components/placeholder.d.ts +1 -1
- package/dist/components/progress-bar.d.ts +3 -2
- package/dist/components/radio-group.d.ts +1 -1
- package/dist/components/scatter-plot.d.ts +1 -1
- package/dist/components/scroll-bar-box.d.ts +4 -3
- package/dist/components/scroll-bar.d.ts +4 -3
- package/dist/components/scroll-list.d.ts +4 -3
- package/dist/components/scroll-list.js +1 -1
- package/dist/components/scroll-view.d.ts +4 -3
- package/dist/components/scroll-view.js +1 -1
- package/dist/components/search-input.d.ts +1 -1
- package/dist/components/select-input-indicator.d.ts +1 -1
- package/dist/components/select-input-item.d.ts +1 -1
- package/dist/components/select-input.d.ts +1 -1
- package/dist/components/shimmer-text.d.ts +1 -1
- package/dist/components/slider.d.ts +1 -1
- package/dist/components/sparkline.d.ts +1 -1
- package/dist/components/spinner.d.ts +1 -1
- package/dist/components/spinner.js +1 -1
- package/dist/components/static-render.d.ts +8 -3
- package/dist/components/static-render.js +1 -1
- package/dist/components/static.d.ts +3 -2
- package/dist/components/status-line.d.ts +1 -1
- package/dist/components/stepper.d.ts +1 -1
- package/dist/components/streaming-text.d.ts +1 -1
- package/dist/components/switch.d.ts +1 -1
- package/dist/components/tabs.d.ts +1 -1
- package/dist/components/tag.d.ts +1 -1
- package/dist/components/text.d.ts +3 -2
- package/dist/components/text.js +1 -1
- package/dist/components/tooltip.d.ts +1 -1
- package/dist/components/tree-view-entry.d.ts +4 -3
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.js +1 -1
- package/dist/ink/hooks/use-app.d.ts +1 -1
- package/dist/ink/hooks/use-box-metrics.d.ts +7 -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 +4 -3
- 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 +5 -4
- package/dist/ink/hooks/use-text-selection.js +1 -1
- package/dist/ink/hooks/use-window-size.js +1 -1
- package/dist/ink/index.d.ts +10 -7
- package/dist/ink/index.js +1 -1
- package/dist/packem_shared/ControlledScrollView-CIc-x1Cx.js +1 -0
- package/dist/packem_shared/{DevTools-ClnTSU76.js → DevTools-ClAYpMVI.js} +1 -1
- package/dist/packem_shared/InputParser-B_qZcN3r.js +2 -0
- package/dist/packem_shared/{LayoutNode-Q7nU3hmO.js → LayoutNode-B8zej4dm.js} +1 -1
- package/dist/packem_shared/{MouseProvider-CHU5DuwC.js → MouseProvider-PnIUKURs.js} +1 -1
- package/dist/packem_shared/{ScrollList-Dxgv-mhZ.js → ScrollList-C7nZ9ufK.js} +1 -1
- package/dist/packem_shared/{ScrollView-Dq2v5zJS.js → ScrollView-DKZ8OM-m.js} +1 -1
- package/dist/packem_shared/TuiApp-BVDXP0Cv.js +1 -0
- package/dist/packem_shared/ansi-parser-B6uXaq65.js +1 -0
- package/dist/packem_shared/colorize-DbTZMrJO.js +1 -0
- package/dist/packem_shared/{comparePoints-l0iqUoL_.js → comparePoints-YxQfR_zq.js} +1 -1
- package/dist/packem_shared/{controlled-scroll-view-CikQ90_V.js → controlled-scroll-view-CcUS50jx.js} +1 -1
- package/dist/packem_shared/createInlineLoop-DRNZ7jqH.js +2 -0
- package/dist/packem_shared/createScreen-CrLrxA6t.js +3 -0
- package/dist/packem_shared/dom-BG-LS10p.js +1 -0
- package/dist/packem_shared/{dom.d-BZZeZlyP.d.ts → dom.d-CcFuBd-k.d.ts} +11 -1
- package/dist/packem_shared/{getPathToRoot-Nb2eTx2o.js → getPathToRoot-D5Hns9Er.js} +1 -1
- package/dist/packem_shared/getScrollHeight-ClEOyLHH.js +1 -0
- package/dist/packem_shared/input.d-CgxV2e8U.d.ts +90 -0
- package/dist/packem_shared/{layout-P24eyWyL.js → layout-BMo200nF.js} +1 -1
- package/dist/packem_shared/measure-text-DDjHT1jD.js +3 -0
- package/dist/packem_shared/{measureElement-CRKlFSvD.js → measureElement-BTtTFZg4.js} +1 -1
- package/dist/packem_shared/parseSgrMouse-Ccj70ijb.js +1 -0
- package/dist/packem_shared/processLayout-FEKj_mWu.js +1 -0
- package/dist/packem_shared/{reconciler-tOH9yL_j.js → reconciler-CUbhOvcr.js} +1 -1
- package/dist/packem_shared/{reconciler-BQvF1kRj.js → reconciler-DIfG72R9.js} +1 -1
- package/dist/packem_shared/{render-yGJFE4of.js → render-Dh7HMhK1.js} +1 -1
- package/dist/packem_shared/render-bdbSzkJo.js +26 -0
- package/dist/packem_shared/{render.d-BJmVQ_cd.d.ts → render.d-B1kiO3Ca.d.ts} +19 -1
- package/dist/packem_shared/{renderToString-D4JqS-Zv.js → renderToString-BbQiRHrd.js} +1 -1
- package/dist/packem_shared/{renderToString-GyN-Rw9F.js → renderToString-DVE0cEHt.js} +1 -1
- package/dist/packem_shared/renderTreeToBuffer-CZilzyhN.js +2 -0
- package/dist/packem_shared/renderer-Cfi6ZyHf.js +17 -0
- package/dist/packem_shared/{selection.d-vfuEzv1p.d.ts → selection.d-DAh7REnW.d.ts} +1 -1
- package/dist/packem_shared/setEnableStyledLineCache-D2gZbwFM.js +1 -0
- package/dist/packem_shared/squashTextNodesWithMap-DCdi3SZ2.js +1 -0
- package/dist/packem_shared/{styles.d-i6Mejqz2.d.ts → styles.d-cMo36xQz.d.ts} +37 -105
- package/dist/packem_shared/text-width-BU2eeTWn.js +2 -0
- package/dist/packem_shared/utils-CoviI5Vm.js +1 -0
- package/dist/packem_shared/{wrapOrTruncateStyledLine-D29Fq7pW.js → wrapOrTruncateStyledLine-BZ00SM8i.js} +1 -1
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.js +1 -1
- package/dist/testing/index.d.ts +5 -4
- package/dist/testing/index.js +1 -1
- package/index.js +539 -691
- package/package.json +28 -16
- package/dist/packem_shared/ControlledScrollView-X_OTc-Cw.js +0 -1
- package/dist/packem_shared/InputParser-Cfi5GVKV.js +0 -2
- package/dist/packem_shared/TuiApp-BSWPFrDu.js +0 -1
- package/dist/packem_shared/ansi-parser-C5JuL732.js +0 -1
- package/dist/packem_shared/boxes-DyY_LXCi.js +0 -1
- package/dist/packem_shared/colorize-gy_cY-wC.js +0 -2
- package/dist/packem_shared/constants-D12jy2Zh-RSfxu1eM.js +0 -1
- package/dist/packem_shared/createInlineLoop-fhXU93QT.js +0 -2
- package/dist/packem_shared/createScreen-87XLHZq6.js +0 -3
- package/dist/packem_shared/dom-CMbdnYbk.js +0 -8
- package/dist/packem_shared/erase-DeDffywz.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/index-LwZN2xbk.js +0 -75
- package/dist/packem_shared/index.d-Bk52cbgN.d.ts +0 -14
- package/dist/packem_shared/index.server.d-eZWyC2Ku.d.ts +0 -5
- package/dist/packem_shared/input.d-D-Yxqha8.d.ts +0 -172
- package/dist/packem_shared/measure-text-CIs55Wao.js +0 -3
- package/dist/packem_shared/mode-BOIU4Roy.js +0 -1
- package/dist/packem_shared/parseSgrMouse-DoBY7MKw.js +0 -1
- package/dist/packem_shared/processLayout-Dmgf0LO6.js +0 -1
- package/dist/packem_shared/render-D9bHMHrx.js +0 -26
- package/dist/packem_shared/renderTreeToBuffer-DWl5_yTW.js +0 -2
- package/dist/packem_shared/renderer-Cidd3s9K.js +0 -17
- package/dist/packem_shared/setEnableStyledLineCache-Aja0FbWo.js +0 -1
- package/dist/packem_shared/squashTextNodesWithMap-Cpqmc45i.js +0 -1
- package/dist/packem_shared/strip-C6HQYmlg.js +0 -1
- package/dist/packem_shared/text-width-DSx26OmB.js +0 -2
- package/dist/packem_shared/utils-THUhYKG2.js +0 -1
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var X=Object.defineProperty;var k=(n,t)=>X(n,"name",{value:t,configurable:!0});import{y as Y,p as Z,o as tt}from"./get-string-width-4oMZhv2Q.js";import{t as et}from"./ansi-tokenizer-DqX9nJuk.js";var st=Object.defineProperty,at=k((n,t)=>st(n,"name",{value:t,configurable:!0}),"r$2"),nt=Object.defineProperty,rt=at((n,t)=>nt(n,"name",{value:t,configurable:!0}),"a"),it=Object.defineProperty,ht=rt((n,t)=>it(n,"name",{value:t,configurable:!0}),"i");const lt=ht(n=>Number.isInteger(n)?Y(n)||Z(n):!1,"isFullwidthCodePoint");var ot=Object.defineProperty,ct=k((n,t)=>ot(n,"name",{value:t,configurable:!0}),"r$1");let H=class{static{k(this,"h")}static{ct(this,"DataLimitedLruMap")}map;maxDataSize;maxKeys;currentDataSize=0;constructor(t,e){this.map=new Map,this.maxKeys=t,this.maxDataSize=e}get size(){return this.map.size}clear(){this.map.clear(),this.currentDataSize=0}get(t){if(!this.map.has(t))return;const e=this.map.get(t);return this.map.delete(t),this.map.set(t,e),e}set(t,e){const s=t.length;if(!(s>this.maxDataSize)){for(this.map.has(t)&&(this.map.delete(t),this.currentDataSize-=s);this.currentDataSize+s>this.maxDataSize&&this.map.size>0;){const a=this.map.keys().next().value;if(a===void 0)break;this.map.delete(a),this.currentDataSize-=a.length}for(;this.map.size>=this.maxKeys;){const a=this.map.keys().next().value;if(a===void 0)break;this.map.delete(a),this.currentDataSize-=a.length}this.map.set(t,e),this.currentDataSize+=s}}};const gt=1,ft=2,E=4,K=8,R=16,M=32,V=64,S=128;var ut=Object.defineProperty,dt=k((n,t)=>ut(n,"name",{value:t,configurable:!0}),"x");const p=1073741823,x=1073741824;class d{static{k(this,"StyledLine")}static{dt(this,"StyledLine")}length=0;static emptyCache=new Map;text;charData;spans;_cachedTrimmedLength;static empty(t){if(t<=0)return new d;const e=d.emptyCache.get(t);if(e)return e.clone();const s=new d;s.length=t,s.text=" ".repeat(t),s.charData=Array.from({length:t});for(let a=0;a<t;a++)s.charData[a]=a;return s.spans=[{formatFlags:0,length:t}],s._cachedTrimmedLength=0,Object.freeze(s.spans[0]),Object.freeze(s.spans),Object.freeze(s),d.emptyCache.set(t,s),s.clone()}getValue(t){if(this.text===void 0||t<0||t>=this.length)return"";const e=this.charData[t]&p,s=t+1<this.length?this.charData[t+1]&p:this.text.length;return this.text.slice(e,s)}getTextRange(t,e){if(this.text===void 0||t<0||e>this.length||t>=e)return"";const s=this.charData[t]&p,a=e<this.length?this.charData[e]&p:this.text.length;return this.text.slice(s,a)}getSpan(t){if(this.spans===void 0||t<0||t>=this.length)return;let e=0;for(const s of this.spans){if(t<e+s.length)return s;e+=s.length}}getFullWidth(t){return this.charData===void 0||t<0||t>=this.length?!1:(this.charData[t]&x)!==0}hasStyles(t){const e=this.getSpan(t);return e?(e.formatFlags&~S)!==0||e.fgColor!==void 0||e.bgColor!==void 0||e.link!==void 0:!1}getFormatFlags(t){let e=this.getSpan(t)?.formatFlags??0;return this.getFullWidth(t)&&(e|=S),e}getFgColor(t){return this.getSpan(t)?.fgColor}getBgColor(t){return this.getSpan(t)?.bgColor}getLink(t){return this.getSpan(t)?.link}setInverted(t,e){this._cachedTrimmedLength=void 0,this.updateSpanAt(t,s=>{e?s.formatFlags|=M:s.formatFlags&=~M})}setBackgroundColor(t,e){this._cachedTrimmedLength=void 0,this.updateSpanAt(t,s=>{s.bgColor=e})}setForegroundColor(t,e){this._cachedTrimmedLength=void 0,this.updateSpanAt(t,s=>{s.fgColor=e})}setChar(t,e,s,a,r,h){if(t<0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const i=(s&S)!==0,o=s&~S,l=this.charData[t]&p,c=t+1<this.length?this.charData[t+1]&p:this.text.length,m=c-l,b=e.length;if(this.text=this.text.slice(0,l)+e+this.text.slice(c),m!==b){const f=b-m;for(let v=t+1;v<this.length;v++){const T=this.charData[v],w=T&p,L=T&x;this.charData[v]=w+f|L}}if(this.charData[t]=l|(i?x:0),this.trySetStyleAtIndex(t,o,a,r,h))return;this.splitSpansAt(t),this.splitSpansAt(t+1);let u=0;for(let f=0;f<this.spans.length;f++){const v=this.spans[f];if(u===t&&v.length===1){this.spans[f]={bgColor:r,fgColor:a,formatFlags:o,length:1,link:h};break}u+=v.length}this.mergeSpans()}setCharFast(t,e,s,a,r,h){if(t<0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const i=(s&S)!==0,o=s&~S,l=this.charData[t]&p,c=t+1<this.length?this.charData[t+1]&p:this.text.length,m=c-l;if(e.length===m)e!==this.text.slice(l,c)&&(this.text=this.text.slice(0,l)+e+this.text.slice(c)),this.charData[t]=l|(i?x:0);else{if(this.text=this.text.slice(0,l)+e+this.text.slice(c),m!==e.length){const u=e.length-m;for(let f=t+1;f<this.length;f++){const v=this.charData[f];this.charData[f]=(v&p)+u|v&x}}this.charData[t]=l|(i?x:0)}if(this.trySetStyleAtIndex(t,o,a,r,h))return;this.splitSpansAt(t),this.splitSpansAt(t+1);let b=0;for(let u=0;u<this.spans.length;u++){const f=this.spans[u];if(b===t&&f.length===1){this.spans[u]={bgColor:r,fgColor:a,formatFlags:o,length:1,link:h};break}b+=f.length}this.mergeSpans()}writeFrom(t,e,s=0,a){const r=a??e.length-s;if(r<=0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const h=Math.min(r,this.length-t,e.length-s),i=this.charData[t]&p,o=t+h<this.length?this.charData[t+h]&p:this.text.length;let l="";for(let g=0;g<h;g++)l+=e.getValue(s+g);const c=o-i,m=l.length-c;this.text=this.text.slice(0,i)+l+this.text.slice(o);let b=i;for(let g=0;g<h;g++){const D=e.getFullWidth(s+g);this.charData[t+g]=b|(D?x:0),b+=e.getValue(s+g).length}if(m!==0)for(let g=t+h;g<this.length;g++){const D=this.charData[g];this.charData[g]=(D&p)+m|D&x}this.splitSpansAt(t),this.splitSpansAt(t+h);const u=[];let f=0;for(const g of e.getSpans()){const D=f+g.length,P=Math.max(s,f),j=Math.min(s+h,D);if(P<j&&u.push({...g,length:j-P}),f=D,f>=s+h)break}let v=0,T=0;for(let g=0;g<this.spans.length;g++){if(T===t){v=g;break}T+=this.spans[g].length}let w=0,L=0;for(let g=v;g<this.spans.length&&L<h;g++)L+=this.spans[g].length,w++;this.spans.splice(v,w,...u),this.mergeSpans()}pushChar(t,e,s,a,r){this._cachedTrimmedLength=void 0,this.ensureInitialized();const h=(e&S)!==0,i=e&~S,o=this.text.length;this.text=(this.text??"")+t,this.charData.push(o|(h?x:0));const l=this.spans.at(-1);l?.formatFlags===i&&l.fgColor===s&&l.bgColor===a&&l.link===r?l.length++:this.spans.push({bgColor:a,fgColor:s,formatFlags:i,length:1,link:r}),this.length++}clone(){if(this.charData===void 0)return new d;const t=new d;return t.length=this.length,t.text=this.text,t.charData=[...this.charData],t.spans=this.spans.map(e=>({...e})),t._cachedTrimmedLength=this._cachedTrimmedLength,t}slice(t,e){if(this.charData===void 0)return new d;const s=Math.max(0,t),a=e===void 0?this.length:Math.min(this.length,e);if(s>=a)return new d;if(s===0&&a===this.length)return this.clone();const r=new d;r.length=a-s,r.charData=Array.from({length:r.length});const h=this.charData[s]&p,i=a<this.length?this.charData[a]&p:this.text.length;r.text=this.text.slice(h,i);for(let c=0;c<r.length;c++){const m=this.charData[s+c],b=m&p,u=m&x;r.charData[c]=b-h|u}const o=[];let l=0;for(const c of this.spans){const m=l,b=l+c.length,u=Math.max(s,m),f=Math.min(a,b);if(u<f&&o.push({...c,length:f-u}),l+=c.length,l>=a)break}return r.spans=o,r.mergeSpans(),r}combine(...t){if(t.length===0)return this.clone();const e=[this,...t].filter(i=>i.length>0);if(e.length===0)return new d;if(e.length===1)return e[0].clone();let s=0;for(const i of e)s+=i.length;const a=new d;a.length=s,a.text=e.map(i=>i.getText()).join(""),a.charData=Array.from({length:s});let r=0,h=0;for(const i of e){const o=i.charData,l=i.getText();if(o)for(let c=0;c<i.length;c++){const m=o[c],b=m&p,u=m&x;a.charData[r+c]=h+b|u}else for(let c=0;c<i.length;c++)a.charData[r+c]=h+c;r+=i.length,h+=l.length}return a.spans=e.flatMap(i=>i.getSpans().map(o=>({...o}))),a.mergeSpans(),a}getTrimmedLength(){if(this._cachedTrimmedLength!==void 0)return this._cachedTrimmedLength;if(this.length===0)return this._cachedTrimmedLength=0,0;if(this.text===void 0||this.charData===void 0)return this._cachedTrimmedLength=0,0;let t=this.length-1;if(this.spans)for(let e=this.spans.length-1;e>=0;e--){const s=this.spans[e];if((s.formatFlags&~S)!==0||s.fgColor!==void 0||s.bgColor!==void 0||s.link!==void 0)return this._cachedTrimmedLength=t+1,this._cachedTrimmedLength;for(let a=0;a<s.length;a++){const r=this.charData[t]&p;if((t+1<this.length?this.charData[t+1]&p:this.text.length)-r!==1||this.text[r]!==" ")return this._cachedTrimmedLength=t+1,this._cachedTrimmedLength;t--}}return this._cachedTrimmedLength=0,0}trimEnd(){const t=this.getTrimmedLength();return t===this.length?this:t===0?new d:this.slice(0,t)}equals(t){if(this.length!==t.length)return!1;if(this.length===0)return!0;if(this.getText()!==t.getText())return!1;const e=this.getSpans(),s=t.getSpans();if(e.length!==s.length)return!1;for(const[h,i]of e.entries()){const o=i,l=s[h];if(o.length!==l.length||o.formatFlags!==l.formatFlags||o.fgColor!==l.fgColor||o.bgColor!==l.bgColor||o.link!==l.link)return!1}const a=this.charData,r=t.charData;if(a&&r){for(let h=0;h<this.length;h++)if(a[h]!==r[h])return!1}return!0}getText(){return this.text??""}getSpans(){return this.spans??[]}getValues(){return Array.from({length:this.length},(t,e)=>this.getValue(e))}*[Symbol.iterator](){if(this.length===0)return;let t=0,e=0;const s=this.getSpans();for(let a=0;a<this.length;a++){const r=s[t],h=r?r.formatFlags:0,i=this.getFullWidth(a);yield{bgColor:r?.bgColor,fgColor:r?.fgColor,formatFlags:h|(i?S:0),fullWidth:i,hasStyles:(h&~S)!==0||r?.fgColor!==void 0||r?.bgColor!==void 0||r?.link!==void 0,link:r?.link,value:this.getValue(a)},r&&(e++,e>=r.length&&(t++,e=0))}}updateSpanAt(t,e){if(t<0||t>=this.length)return;this.ensureInitialized(),this.splitSpansAt(t),this.splitSpansAt(t+1);let s=0;for(const a of this.spans){if(s===t&&a.length===1){e(a);break}s+=a.length}this.mergeSpans()}ensureWidth(t){if(t<=this.length)return;this.ensureInitialized();const e=this.length,s=t-e,a=this.text.length;for(let h=0;h<s;h++)this.charData.push(a);this.length=t;const r=this.spans.at(-1);r?.formatFlags===0&&r.fgColor===void 0&&r.bgColor===void 0&&r.link===void 0?r.length+=s:this.spans.push({formatFlags:0,length:s})}ensureInitialized(){if(this.charData===void 0&&(this.text="",this.charData=Array.from({length:this.length}),this.spans=this.length>0?[{formatFlags:0,length:this.length}]:[],this.length>0&&this.text.length===0)){this.text=" ".repeat(this.length);for(let t=0;t<this.length;t++)this.charData[t]=t}}splitSpansAt(t){if(this.spans===void 0||t<=0||t>=this.length)return;let e=0;for(let s=0;s<this.spans.length;s++){const a=this.spans[s];if(t>e&&t<e+a.length){const r=t-e,h=a.length-r;this.spans.splice(s,1,{...a,length:r},{...a,length:h});return}e+=a.length}}trySetStyleAtIndex(t,e,s,a,r){if(!this.spans)return!1;let h=0,i=-1,o;for(let l=0;l<this.spans.length;l++){const c=this.spans[l];if(h<=t&&h+c.length>t){i=l,o=c;break}h+=c.length}if(!o)return!1;if(o.formatFlags===e&&o.fgColor===s&&o.bgColor===a&&o.link===r)return!0;if(t===h&&i>0){const l=this.spans[i-1];if(l.formatFlags===e&&l.fgColor===s&&l.bgColor===a&&l.link===r)return l.length+=1,o.length===1?this.spans.splice(i,1):o.length-=1,!0}if(t===h+o.length-1&&i<this.spans.length-1){const l=this.spans[i+1];if(l.formatFlags===e&&l.fgColor===s&&l.bgColor===a&&l.link===r)return l.length+=1,o.length===1?this.spans.splice(i,1):o.length-=1,!0}return!1}mergeSpans(){if(this.spans===void 0)return;const t=[];for(const e of this.spans){if(e.length===0)continue;const s=t.at(-1);s?.formatFlags===e.formatFlags&&s.fgColor===e.fgColor&&s.bgColor===e.bgColor&&s.link===e.link?s.length+=e.length:t.push({...e})}this.spans=t}}var mt=Object.defineProperty,I=k((n,t)=>mt(n,"name",{value:t,configurable:!0}),"u$1");const G={black:0,blue:4,cyan:6,gray:8,green:2,grey:8,magenta:5,red:1,white:7,yellow:3},U={blackBright:8,blueBright:12,cyanBright:14,greenBright:10,magentaBright:13,redBright:9,whiteBright:15,yellowBright:11},q=/^ansi256\(\s?(\d+)\s?\)$/,J=/^rgb\(\s?(\d+),\s?(\d+),\s?(\d+)\s?\)$/,Et=I(n=>{const t=G[n];if(t!==void 0)return t;const e=U[n];if(e!==void 0)return e;const s=q.exec(n);if(s)return Number(s[1])&255;if(n.startsWith("#")&&n.length===7){const r=Number.parseInt(n.slice(1,3),16),h=Number.parseInt(n.slice(3,5),16),i=Number.parseInt(n.slice(5,7),16);return 16+36*Math.round(r/51)+6*Math.round(h/51)+Math.round(i/51)}const a=J.exec(n);return a?16+36*Math.round(Number(a[1])/51)+6*Math.round(Number(a[2])/51)+Math.round(Number(a[3])/51):255},"colorToAnsi256"),pt=I((n,t)=>{const e=t?30:40,s=G[n];if(s!==void 0)return[e+s];const a=U[n];if(a!==void 0)return[e+60+(a-8)];if(n.startsWith("#")&&n.length===7){const i=Number.parseInt(n.slice(1,3),16),o=Number.parseInt(n.slice(3,5),16),l=Number.parseInt(n.slice(5,7),16);return[t?38:48,2,i,o,l]}const r=q.exec(n);if(r)return[t?38:48,5,Number(r[1])];const h=J.exec(n);return h?[t?38:48,2,Number(h[1]),Number(h[2]),Number(h[3])]:[]},"colorToSgrParams");I((n,t)=>{const e=pt(n,t);if(e.length!==0)return`\x1B[${e.join(";")}m`},"colorToAnsiCode");const A=I(n=>{const t=["black","red","green","yellow","blue","magenta","cyan","white"];return n>=0&&n<=7?t[n]:`ansi256(${n})`},"ansi256ToColorName");var bt=Object.defineProperty,y=k((n,t)=>bt(n,"name",{value:t,configurable:!0}),"u");const O=y(()=>({bgColor:void 0,fgColor:void 0,formatFlags:0,link:void 0}),"createSgrState"),vt=y((n,t)=>{if(t.length===0)return O();const e=(t.includes(":")?t.replaceAll(":",";"):t).split(";").filter(o=>o.length>0).map(Number);let{bgColor:s,fgColor:a,formatFlags:r,link:h}=n,i=0;for(;i<e.length;){const o=e[i];switch(o){case 0:{r=0,a=void 0,s=void 0,h=void 0;break}case 1:{r|=gt;break}case 2:{r|=ft;break}case 3:{r|=E;break}case 4:{r|=K;break}case 7:{r|=M;break}case 8:{r|=V;break}case 9:{r|=R;break}case 22:{r&=-4;break}case 23:{r&=~E;break}case 24:{r&=~K;break}case 27:{r&=~M;break}case 28:{r&=~V;break}case 29:{r&=~R;break}case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:{a=A(o-30);break}case 38:{e[i+1]===5&&e[i+2]!==void 0?(a=A(e[i+2]),i+=2):e[i+1]===2&&i+4<e.length&&(a=`rgb(${e[i+2]}, ${e[i+3]}, ${e[i+4]})`,i+=4);break}case 39:{a=void 0;break}case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:{s=A(o-40);break}case 48:{e[i+1]===5&&e[i+2]!==void 0?(s=A(e[i+2]),i+=2):e[i+1]===2&&i+4<e.length&&(s=`rgb(${e[i+2]}, ${e[i+3]}, ${e[i+4]})`,i+=4);break}case 49:{s=void 0;break}case 90:case 91:case 92:case 93:case 94:case 95:case 96:case 97:{a=`ansi256(${o-90+8})`;break}case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:{s=`ansi256(${o-100+8})`;break}}i++}return{bgColor:s,fgColor:a,formatFlags:r,link:h}},"applySgrParams"),$=127462,z=127487,St=127995,xt=127999,Ct=8205,kt=917504,Dt=917631,yt=new RegExp("\\p{Mark}","u"),Tt=new Intl.Segmenter(void 0,{granularity:"grapheme"}),Ft=y((n,t)=>!!(lt(t)||n.includes("️")||t>=$&&t<=z),"isFullwidthGrapheme"),wt=/(?:\u001B\]|\u009D)8;([^;]*);(.*?)(?:\u001B\\|\u0007|\u009C)/,Lt=y(n=>{const t=wt.exec(n);return!t?.[2]||t[2].length===0?void 0:n.endsWith("\x1B\\")?`ST:${t[2]}`:t[2]},"parseOscHyperlink"),Q=y((n,t,e)=>{const s=Tt.segment(n),a=[];for(const{segment:r}of s)a.push(r);for(let r=0;r<a.length;r++){let h=a[r];if(h===" "){for(let l=0;l<4;l++)t.pushChar(" ",e.formatFlags,e.fgColor,e.bgColor,e.link);continue}if(h==="\b")continue;const i=h.codePointAt(0);if(!i)continue;if(i>=$&&i<=z&&r+1<a.length){const l=a[r+1],c=l.codePointAt(0);c&&c>=$&&c<=z&&(h+=l,r++)}else for(;r+1<a.length;){const l=a[r+1],c=l.codePointAt(0);if(!c)break;const m=yt.test(String.fromCodePoint(c)),b=c>=St&&c<=xt,u=c===Ct,f=c>=kt&&c<=Dt;if(!m&&!b&&!u&&!f)break;h+=l,r++,u&&r+1<a.length&&(h+=a[r+1],r++)}const o=Ft(h,i)?e.formatFlags|S:e.formatFlags;t.pushChar(h,o,e.fgColor,e.bgColor,e.link)}},"processTextToken"),At=y(n=>{if(n.length===0)return new d;const t=et(n),e=new d;let s=O();for(const a of t)switch(a.type){case"csi":{a.finalCharacter==="m"&&(s=vt(s,a.parameterString));break}case"osc":{const r=Lt(a.value);r!==void 0?s={...s,link:r}:a.value.includes("8;")&&(s={...s,link:void 0});break}case"text":{Q(a.value,e,s);break}}return e},"textToStyledLine"),Mt=/^[\u0020-\u007E]*$/,Kt=y(n=>{if(n.length===0)return new d;const t=new d;if(Mt.test(n)){for(const e of n)t.pushChar(e,0);return t}return Q(n,t,O()),t},"plainTextToStyledLine");var It=Object.defineProperty,C=k((n,t)=>It(n,"name",{value:t,configurable:!0}),"r");const N=new H(1e4,1e6),B=new Map,F=new H(1e4,1e6);let W=!0,_=tt;const Rt=C(n=>{W=n,n||F.clear()},"setEnableStyledLineCache"),Vt=C(()=>{F.clear()},"clearStyledLineCache"),Ht=C(n=>{_=n,$t()},"setStringWidthFunction"),$t=C(()=>{N.clear(),B.clear(),F.clear()},"clearStringWidthCache"),zt=C(n=>{if(n.length===1){const s=n.codePointAt(0);if(s!==void 0&&s>=32&&s<127)return 1}const t=B.get(n);if(t!==void 0)return t;let e;try{e=_(n)}catch{e=1}return B.set(n,e),e},"inkCharacterWidth"),Nt=C(n=>{try{return _(n)}catch{return 1}},"safeGetStringWidth"),Gt=C(n=>{if(n.length===0)return{height:0,width:0};const t=N.get(n);if(t)return t;const e=n.split(`
|
|
2
|
-
`),s=Math.max(...e.map(r=>Nt(r))),a={height:e.length,width:s};return N.set(n,a),a},"measureText"),Ut=C(n=>{if(W){const e=F.get(n);if(e!==void 0)return e}const t=At(n);return W&&F.set(n,t),t},"toStyledLine"),Bt=C(n=>{let t=0;for(let e=0;e<n.length;e++)t+=zt(n.getValue(e));return t},"styledLineWidth"),Wt=C(n=>{if(n.length===0)return[new d];const t=[];let e=0;for(let s=0;s<n.length;s++)n.getValue(s)===`
|
|
3
|
-
`&&(t.push(s>e?n.slice(e,s):new d),e=s+1);return t.push(e<n.length?n.slice(e):new d),t},"splitStyledLineByNewline"),qt=C(n=>{if(n.length===0)return{height:0,width:0};const t=Wt(n);let e=0;for(const s of t)e=Math.max(e,Bt(s));return{height:t.length,width:e}},"measureStyledLine");export{gt as B,ft as D,S as F,V as H,E as I,d as S,K as U,Vt as a,Ht as b,$t as c,Bt as d,Gt as e,M as f,R as g,pt as h,zt as i,Et as j,At as k,lt as l,qt as m,Wt as n,Kt as p,Rt as s,Ut as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var $=Object.defineProperty;var d=(e,o)=>$(e,"name",{value:o,configurable:!0});import{a}from"./constants-D12jy2Zh-RSfxu1eM.js";var f=Object.defineProperty,u=d((e,o)=>f(e,"name",{value:o,configurable:!0}),"i"),p=Object.defineProperty,M=u((e,o)=>p(e,"name",{value:o,configurable:!0}),"u"),S=Object.defineProperty,r=M((e,o)=>S(e,"name",{value:o,configurable:!0}),"s");class y{static{d(this,"j")}static{u(this,"h")}static{M(this,"g")}static{r(this,"AnsiModeImpl")}code;isDecMode=!1;constructor(o){this.code=o}}class R{static{d(this,"X")}static{u(this,"g")}static{M(this,"u")}static{r(this,"DecModeImpl")}code;isDecMode=!0;constructor(o){this.code=o}}const m=r((e,...o)=>{if(o.length===0)return"";const i=e?"l":"h";if(o.length===1){const n=o[0];let h=a;return n.isDecMode&&(h+="?"),h+String(n.code)+i}const c=o.filter(n=>!n.isDecMode).map(n=>n.code),g=o.filter(n=>n.isDecMode).map(n=>n.code);let l="";return c.length>0&&(l+=`${a}${c.join(";")}${i}`),g.length>0&&(l+=`${a}?${g.join(";")}${i}`),l},"generateModeSequence");var D=(e=>(e[e.NotRecognized=0]="NotRecognized",e[e.Set=1]="Set",e[e.Reset=2]="Reset",e[e.PermanentlySet=3]="PermanentlySet",e[e.PermanentlyReset=4]="PermanentlyReset",e))(D||{});r(e=>e===0,"isModeNotRecognized");r(e=>e===1||e===3,"isModeSet");r(e=>e===2||e===4,"isModeReset");r(e=>e===3,"isModePermanentlySet");r(e=>e===4,"isModePermanentlyReset");const s=r(e=>new y(e),"createAnsiMode"),t=r(e=>new R(e),"createDecMode"),b=r((...e)=>m(!1,...e),"setMode"),j=r((...e)=>m(!0,...e),"resetMode");r(e=>{let o=a;return e.isDecMode&&(o+="?"),`${o}${String(e.code)}$p`},"requestMode");r((e,o)=>{let i=o;(o<0||o>4)&&(i=0);let c=a;return e.isDecMode&&(c+="?"),`${c}${String(e.code)};${String(i)}$y`},"reportMode");s(2);s(4);s(8);s(12);s(20);t(1);t(6);t(7);t(9);t(25);t(66);t(67);t(69);t(1e3);t(1001);t(1002);t(1003);t(1004);t(1005);t(1006);t(1015);t(1016);t(1035);t(1047);t(1048);t(1049);const z=t(2004);t(2026);t(2027);t(9001);t(2031);t(2048);export{z as e,j as g,b as h,t as o};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./ansi-parser-C5JuL732.js";export{e as parseSgrMouse};
|
|
@@ -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};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var D=Object.defineProperty;var R=(t,o)=>D(t,"name",{value:o,configurable:!0});import{o as G}from"./boxes-DyY_LXCi.js";import{resolveColor as j}from"./NAMED_COLORS-B9fJsYdg.js";import{g as I}from"./text-width-DSx26OmB.js";var K=Object.defineProperty,B=R((t,o)=>K(t,"name",{value:o,configurable:!0}),"N");const V=1114112,F=9608,J=9600,Q=9604;function E(t){const o=t?.borderStyle?1:0;return{bottom:t?.borderBottom===!1?0:o,left:t?.borderLeft===!1?0:o,right:t?.borderRight===!1?0:o,top:t?.borderTop===!1?0:o}}R(E,"k");B(E,"getEffectiveBorderWidths");function H(t){let o=0;for(const i of t.children){const b=i.getLayout(),e=b.top+b.height;e>o&&(o=e)}const n=t._style,l=n?.paddingBottom??n?.paddingY??n?.padding??0;return o+l}R(H,"q");B(H,"getScrollContentHeight");function N(t,o,n,l,i,b,e,m,v,_,g,d){const r=E(d),a=m-r.top-r.bottom,u=d.scrollTop??0,h=H(t),M=a;if(h<=M||a<=0)return;const f=a*2,y=Math.max(2,Math.round(M/h*f)),s=h-M,x=f-y,T=s>0?Math.round(u/s*x):0,c=typeof d.scrollbarThumbColor=="string"?j(d.scrollbarThumbColor):v,p=i+e-1-r.right,S=_<<16|65280|c;for(let w=0;w<a;w++){const Y=w*2,X=Y+1,k=Y>=T&&Y<T+y,L=X>=T&&X<T+y;if(!k&&!L)continue;let C=F;k&&!L?C=J:!k&&L&&(C=Q),A(o,n,l,p,b+r.top+w,C,S,g)}}R(N,"z");B(N,"paintScrollbar");function q(t,o,n,l,i,b,e,m,v,_,g,d,r,a){const u=E(a),h=a.scrollTop??0,M=b+u.top;for(const f of t.children){if(!f._style?.sticky)continue;const y=f.getLayout();if(y.top>=h)continue;const s=f.parent;if(s&&s!==t){const S=s.getLayout();if(S.top+S.height<=h)continue}const x=M,T=f.fg===255?v:f.fg,c=f.bg===255?_:f.bg,p=f.styles===0?g:f.styles;O(f,o,n,l,i-y.left,x-y.top,T,c,p,d,r)}}R(q,"G");B(q,"paintStickyHeaders");function Z(t,o,n,l){for(let e=0;e<o.length;e+=2)o[e]=32,o[e+1]=65535;const i=[],b={x0:0,x1:n,y0:0,y1:l};try{O(t,o,n,l,0,0,t.fg,t.bg,t.styles,i,b);for(const e of i)z(e.node,o,n,l,e.absX,e.absY,e.w,e.h,e.fg,e.bg,e.styles,e.clip)}catch(e){console.error("Renderer Error:",e)}}R(Z,"renderTreeToBuffer");B(Z,"renderTreeToBuffer");function A(t,o,n,l,i,b,e,m){if(l<m.x0||l>=m.x1||i<m.y0||i>=m.y1||l<0||l>=o||i<0||i>=n)return;const v=(i*o+l)*2;t[v]=b,t[v+1]=e}R(A,"M");B(A,"writeCell");function z(t,o,n,l,i,b,e,m,v,_,g,d){if(!t._style?.borderStyle||e<=0||m<=0)return;const r=G[t._style.borderStyle],a=t._style.borderColor===void 0?v:j(t._style.borderColor),u=g<<16|_<<8|a,h=t._style.borderTop!==!1,M=t._style.borderBottom!==!1,f=t._style.borderLeft!==!1,y=t._style.borderRight!==!1,s=M&&(m>1||!h);if(h)for(let c=0;c<e;c++){let p;e===1?p=f&&y?r.left:f?r.topLeft:y?r.topRight:r.top:c===0&&f?p=r.topLeft:c===e-1&&y?p=r.topRight:p=r.top,A(o,n,l,i+c,b,p.codePointAt(0),u,d)}if(s)for(let c=0;c<e;c++){let p;e===1?p=f&&y?r.left:f?r.bottomLeft:y?r.bottomRight:r.bottom:c===0&&f?p=r.bottomLeft:c===e-1&&y?p=r.bottomRight:p=r.bottom,A(o,n,l,i+c,b+m-1,p.codePointAt(0),u,d)}const x=h?1:0,T=s?m-1:m;for(let c=x;c<T;c++)f&&A(o,n,l,i,b+c,r.left.codePointAt(0),u,d),y&&A(o,n,l,i+e-1,b+c,r.right.codePointAt(0),u,d)}R(z,"K");B(z,"paintBorder");function W(t){if(t._hidden)return"";if(t.text!==void 0)return t.text;const o=t.children.map(W).join("");return typeof t.transform=="function"?t.transform(o,0):o}R(W,"X");B(W,"collectText");function U(t,o,n,l,i,b,e,m,v,_){if(e<=0||m<=0)return;let g=0,d=0;for(const r of t){if(r===`
|
|
2
|
-
`){g=0,d++;continue}const a=r.codePointAt(0)??32,u=I(r);if(g+u>e&&(g=0,d++),d>=m)break;if(u>e){A(o,n,l,i+g,b+d,32,v,_),g+=1;continue}A(o,n,l,i+g,b+d,a,v,_),u===2&&g+1<e&&A(o,n,l,i+g+1,b+d,V,v,_),g+=u}}R(U,"E");B(U,"paintText");function O(t,o,n,l,i,b,e,m,v,_,g){if(t._hidden)return;const d=t.getLayout(),r=Math.round(i+d.left),a=Math.round(b+d.top),u=Math.round(d.width),h=Math.round(d.height),M=t.fg===255?e:t.fg,f=t.bg===255?m:t.bg,y=t.styles===0?v:t.styles,s={x0:Math.max(g.x0,r),x1:Math.min(g.x1,r+u),y0:Math.max(g.y0,a),y1:Math.min(g.y1,a+h)};if(s.x0>=s.x1||s.y0>=s.y1)return;if(typeof t.transform=="function"){const L=W(t),C=t.transform(L,0),P=y<<16|f<<8|M;U(C,o,n,l,r,a,u,h,P,s);return}if(t.text===void 0){if(f!==255||y!==0){const L=y<<16|f<<8|M;for(let C=0;C<h;C++)for(let P=0;P<u;P++)A(o,n,l,r+P,a+C,32,L,s)}t._style?.borderStyle&&_.push({absX:r,absY:a,bg:f,clip:s,fg:M,h,node:t,styles:y,w:u})}else{const L=y<<16|f<<8|M;if(t.bg!==255)for(let C=0;C<h;C++)for(let P=0;P<u;P++)A(o,n,l,r+P,a+C,32,L,s);U(t.text,o,n,l,r,a,u,h,L,s)}const x=t._style,T=x?.overflow??"visible",c=x?.overflowX??T,p=x?.overflowY??T,S=c==="hidden"||c==="scroll",w=p==="hidden"||p==="scroll";let Y=s,X=0,k=0;if(S||w){const L=E(x);Y={x0:S?Math.max(s.x0,r+L.left):s.x0,x1:S?Math.min(s.x1,r+u-L.right):s.x1,y0:w?Math.max(s.y0,a+L.top):s.y0,y1:w?Math.min(s.y1,a+h-L.bottom):s.y1},p==="scroll"&&typeof x?.scrollTop=="number"&&(k=-x.scrollTop),c==="scroll"&&typeof x?.scrollLeft=="number"&&(X=-x.scrollLeft)}for(const L of t.children)L._style?.internalStickyAlternate||O(L,o,n,l,r+X,a+k,M,f,y,_,Y);(p==="scroll"||c==="scroll")&&x?.scrollbar!==!1&&N(t,o,n,l,r,a,u,h,M,y,s,x),p==="scroll"&&typeof x?.scrollTop=="number"&&q(t,o,n,l,r,a,u,h,M,f,y,_,Y,x)}R(O,"S");B(O,"paintNode");export{Z as renderTreeToBuffer};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
var De=Object.defineProperty;var _=(o,e)=>De(o,"name",{value:e,configurable:!0});import{T as Pe,i as We}from"./dom-CMbdnYbk.js";import{o as Z}from"./get-string-width-4oMZhv2Q.js";import{B as H,D as A,I,U as j,f as z,H as Y,g as q,h as de,F as V,j as ue,S as He,k as Ae,p as Fe,l as Ge}from"./measure-text-CIs55Wao.js";import T from"yoga-layout";import{j as F,i as Ie,m as ce,c as he}from"./layout-P24eyWyL.js";import{a as je,d as J,g as ze}from"./colorize-gy_cY-wC.js";import{o as Ye}from"./boxes-DyY_LXCi.js";import{getScrollTop as Te}from"./getScrollHeight-BTEY8ewu.js";import xe from"./squashTextNodesWithMap-Cpqmc45i.js";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
2
|
-
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
3
|
-
var qe=Object.defineProperty,ke=_((o,e)=>qe(o,"name",{value:e,configurable:!0}),"n$1"),Ke=Object.defineProperty,we=ke((o,e)=>Ke(o,"name",{value:e,configurable:!0}),"n"),Xe=Object.defineProperty,Ue=we((o,e)=>Xe(o,"name",{value:e,configurable:!0}),"o");function Q(o,e=1,t={}){const{indent:r=" ",includeEmptyLines:i=!1}=t;if(typeof o!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof o}\``);if(typeof e!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof e}\``);if(e<0)throw new RangeError(`Expected \`count\` to be at least 0, got \`${e}\``);if(typeof r!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r}\``);if(e===0)return o;const s=i?/^/gm:/^(?!\s*$)/gm;return o.replace(s,r.repeat(e))}_(Q,"o");ke(Q,"g");we(Q,"a");Ue(Q,"indentString");var Ve=Object.defineProperty,Je=_((o,e)=>Ve(o,"name",{value:e,configurable:!0}),"d");const Qe=Je(o=>Math.round(o.getComputedWidth()-Math.max(0,o.getComputedLeft()+o.getComputedWidth()-(o.getParent()?.getComputedWidth()??o.getComputedWidth()))-o.getComputedPadding(T.EDGE_LEFT)-o.getComputedPadding(T.EDGE_RIGHT)-o.getComputedBorder(T.EDGE_LEFT)-o.getComputedBorder(T.EDGE_RIGHT)),"getMaxWidth"),Ze=1114112;var et=Object.defineProperty,Le=_((o,e)=>et(o,"name",{value:e,configurable:!0}),"T$1");const tt=1,ot=2,rt=3,it=4,nt=7,st=8,lt=9,ge=22,fe=23,pe=24,me=27,ye=28,be=29,ve=39,Ce=49,at="\x1B[",S=Le(o=>o.length===0?"":`${at}${o.join(";")}m`,"sgr"),dt=Le(o=>{if(o.length===0)return"";let e="",t=0,r,i,s,n=!1,d=0;const g=o.getSpans();for(const f of g){const c=f.formatFlags&127,{fgColor:l}=f,{bgColor:a}=f,{link:h}=f,u=c;if(u!==t||l!==r||a!==i||h!==s){if(h!==s&&(s&&(e+=s.startsWith("ST:")?"\x1B]8;;\x1B\\":"\x1B]8;;\x07"),h)){const m=h.startsWith("ST:");e+=`\x1B]8;;${m?h.slice(3):h}${m?"\x1B\\":"\x07"}`}const p=t&(H|A),b=u&(H|A);if(p!==b){const m=t&H&&!(u&H),y=t&A&&!(u&A);(m||y)&&(e+=S([ge])),u&H&&(!(t&H)||y)&&(e+=S([tt])),u&A&&(!(t&A)||m)&&(e+=S([ot]))}u&I&&!(t&I)?e+=S([rt]):!(u&I)&&t&I&&(e+=S([fe])),u&j&&!(t&j)?e+=S([it]):!(u&j)&&t&j&&(e+=S([pe])),u&z&&!(t&z)?e+=S([nt]):!(u&z)&&t&z&&(e+=S([me])),u&Y&&!(t&Y)?e+=S([st]):!(u&Y)&&t&Y&&(e+=S([ye])),u&q&&!(t&q)?e+=S([lt]):!(u&q)&&t&q&&(e+=S([be])),l!==r&&(e+=S(l?de(l,!0):[ve])),a!==i&&(e+=S(a?de(a,!1):[Ce])),n=u!==0||l!==void 0||a!==void 0,t=u,r=l,i=a,s=h}e+=o.getTextRange(d,d+f.length),d+=f.length}return n&&(t&(H|A)&&(e+=S([ge])),t&I&&(e+=S([fe])),t&j&&(e+=S([pe])),t&z&&(e+=S([me])),t&Y&&(e+=S([ye])),t&q&&(e+=S([be])),r!==void 0&&(e+=S([ve])),i!==void 0&&(e+=S([Ce]))),s&&(e+=s.startsWith("ST:")?"\x1B]8;;\x1B\\":"\x1B]8;;\x07"),e},"styledLineToString");var ut=Object.defineProperty,Re=_((o,e)=>ut(o,"name",{value:e,configurable:!0}),"v");class te{static{_(this,"OutputCaches")}static{Re(this,"OutputCaches")}widths=new Map;blockWidths=new Map;styledLines=new Map;lines=new Map;maxEntries;pruneToFactor;constructor(e={}){const{maxEntries:t=3e4,pruneToFactor:r=.8}=e;this.maxEntries=Math.max(1,t),this.pruneToFactor=Math.min(.99,Math.max(.1,r))}getStyledLine(e){let t=this.styledLines.get(e);return t===void 0&&(t=this.hasAnsiControlMarker(e)?Ae(e):Fe(e),this.setCacheEntry(this.styledLines,e,t)),t}getStringWidth(e){let t=this.widths.get(e);return t===void 0&&(t=Z(e),this.setCacheEntry(this.widths,e,t)),t}getWidestLine(e){let t=this.blockWidths.get(e);if(t===void 0){let r=0;for(const i of this.getLines(e))r=Math.max(r,this.getStringWidth(i));t=r,this.setCacheEntry(this.blockWidths,e,t)}return t}getLines(e){let t=this.lines.get(e);return t===void 0&&(t=e.split(`
|
|
4
|
-
`),this.setCacheEntry(this.lines,e,t)),t}hasAnsiControlMarker(e){for(const t of e){const r=t.codePointAt(0);if(ct.has(r))return!0}return!1}setCacheEntry(e,t,r){!e.has(t)&&e.size>=this.maxEntries&&this.pruneCache(e),e.set(t,r)}pruneCache(e){const t=Math.floor(this.maxEntries*this.pruneToFactor);for(const r of e.keys())if(e.delete(r),e.size<=t)break}}const ct=new Set([27,144,152,155,157,158,159]),ht=.6,gt=30;class oe{static{_(this,"A")}static{Re(this,"Output")}width;height;caches;grid;clipStack=[];previousLines=[];previousRenderedLines=[];lineMemoizationEnabled=!0;memoizationProbeCountdown=0;constructor(e){const{caches:t,height:r,width:i}=e;this.width=Math.round(i),this.height=Math.round(r),this.caches=t??new te,this.grid=this.createGrid(this.width,this.height)}reset(e,t){this.width=Math.round(e),this.height=Math.round(t),this.clipStack.length=0,this.grid=this.createGrid(this.width,this.height)}startChildRegion(e,t,r,i){const s=Math.round(e),n=Math.round(t);this.clipStack.push({x1:s,x2:s+Math.round(r),y1:n,y2:n+Math.round(i)})}endChildRegion(){this.clipStack.pop()}write(e,t,r,i){if(!r)return;const{transformers:s}=i,n=this.clipStack.at(-1),d=this.caches.getLines(r),g=s.length>0;for(const[f,c]of d.entries()){const l=t+f;if(l<0||l>=this.grid.length||n&&(l<n.y1||l>=n.y2))continue;let a=c;if(g)for(const m of s)a=m(a,f);if(a.length===0)continue;const h=this.grid[l],u=this.caches.getStyledLine(a);let p=e;const b=n?Math.min(n.x2,h.length):1/0;for(let m=0;m<u.length&&!(p>=b);m++){if(n&&(p<n.x1||p>=n.x2)){p++,u.getFullWidth(m)&&p++;continue}if(p>=0){p>=h.length&&h.ensureWidth(p+2);const y=u.getSpan(m),k=u.getFullWidth(m),w=(y?.formatFlags??0)|(k?V:0);h.setCharFast(p,u.getValue(m),w,y?.fgColor,y?.bgColor,y?.link),k&&(p++,p>=h.length&&h.ensureWidth(p+1),h.setCharFast(p,"",w&~V,y?.fgColor,y?.bgColor,y?.link))}p++}}}writeStyledLine(e,t,r){if(r.length===0||t<0||t>=this.grid.length)return;const i=this.clipStack.at(-1);i&&(t<i.y1||t>=i.y2)||this.writeStyledLineToRow(this.grid[t],e,r,this.width,i)}getRootLines(){return this.grid}getCurrentClip(){return this.clipStack.at(-1)}addRegionTree(e,t,r){for(let i=0;i<e.height;i++){const s=r+i;if(s<0||s>=this.grid.length)continue;const n=e.lines[i];if(!n)continue;const d=this.grid[s];for(let g=0;g<n.length;g++){const f=t+g;if(f<0||f>=d.length)continue;const c=n.getValue(g);(c!==" "||n.hasStyles(g))&&d.setCharFast(f,c,n.getFormatFlags(g),n.getFgColor(g),n.getBgColor(g),n.getLink(g))}}for(const i of e.children)this.addRegionTree(i,t+i.x,r+i.y)}writeStyledLineToRow(e,t,r,i,s){let n=t;const d=s?Math.min(s.x2,i):1/0;for(let g=0;g<r.length&&!(n>=d);g++){if(s&&(n<s.x1||n>=s.x2)){n++,r.getFullWidth(g)&&n++;continue}if(n>=0){n>=e.length&&e.ensureWidth(n+2);const f=r.getSpan(g),c=r.getFullWidth(g),l=(f?.formatFlags??0)|(c?V:0);e.setCharFast(n,r.getValue(g),l,f?.fgColor,f?.bgColor,f?.link),c&&(n++,n>=e.length&&e.ensureWidth(n+1),e.setCharFast(n,"",l&~V,f?.fgColor,f?.bgColor,f?.link))}n++}}get(){const e=this.grid;this.lineMemoizationEnabled||(this.memoizationProbeCountdown>0?this.memoizationProbeCountdown--:this.lineMemoizationEnabled=!0);const t=this.lineMemoizationEnabled,r=this.previousLines.length>0,i=t&&r&&this.previousLines.length===e.length&&this.previousRenderedLines.length===e.length;this.previousLines.length>e.length&&(this.previousLines.length=e.length),this.previousRenderedLines.length>e.length&&(this.previousRenderedLines.length=e.length);const s=Array.from({length:e.length});let n=0;for(const[d,g]of e.entries()){const f=g;if(i&&this.previousLines[d]?.equals(f)){s[d]=this.previousRenderedLines[d]??"";continue}n++;const c=f.trimEnd(),l=dt(c);s[d]=l,t&&(this.previousRenderedLines[d]=l,this.previousLines[d]=f.clone())}return t&&i&&e.length>0&&n/e.length>ht&&this.disableLineMemoization(),{height:e.length,output:s.join(`
|
|
5
|
-
`)}}getBuffer(){const e=this.grid,t=e.length,r=new Uint32Array(this.width*t*2),i=65535;for(let s=0;s<r.length;s+=2)r[s]=32,r[s+1]=i;for(let s=0;s<t;s++){const n=e[s];for(let d=0;d<n.length&&d<this.width;d++){const g=n.getValue(d);if(g.length===0)continue;const f=g.codePointAt(0)??32,c=(s*this.width+d)*2,l=n.getSpan(d),a=l?.formatFlags??0,h=l?.fgColor,u=l?.bgColor,p=h?ue(h):255,b=u?ue(u):255,m=(a&255)<<16|(b&255)<<8|p&255;if(r[c]=f,r[c+1]=m,n.getFullWidth(d)&&d+1<this.width){const y=c+2;r[y]=Ze,r[y+1]=m,d++}}}return{buffer:r,height:t}}createGrid(e,t){const r=[];for(let i=0;i<t;i++)r.push(He.empty(e));return r}disableLineMemoization(){this.lineMemoizationEnabled=!1,this.memoizationProbeCountdown=gt,this.previousLines.length=0,this.previousRenderedLines.length=0}}var ft=Object.defineProperty,pt=_((o,e)=>ft(o,"name",{value:e,configurable:!0}),"c");const mt=pt((o,e,t,r)=>{if(!t.style.backgroundColor)return;const i=Math.round(t.yogaNode.getComputedWidth()),s=Math.round(t.yogaNode.getComputedHeight()),n=t.style.borderStyle&&t.style.borderLeft!==!1?1:0,d=t.style.borderStyle&&t.style.borderRight!==!1?1:0,g=t.style.borderStyle&&t.style.borderTop!==!1?1:0,f=t.style.borderStyle&&t.style.borderBottom!==!1?1:0,c=i-n-d,l=s-g-f;if(!(c>0&&l>0))return;const a=je(t.style.backgroundColor);if(!a)return;const h=`${a}${" ".repeat(c)}\x1B[49m`;for(let u=0;u<l;u++)r.write(o+n,e+g+u,h,{transformers:[]})},"renderBackground");var yt=Object.defineProperty,re=_((o,e)=>yt(o,"name",{value:e,configurable:!0}),"T");const D=re((o,e,t,r)=>{let i=J(o,e,"foreground");return i=J(i,t,"background"),r&&(i=ze.dim(i)),i},"stylePiece"),Ne=re((o,e,t,r,i,s,n,d)=>{if(!t&&!i)return D(o.repeat(e),s,n,d);const g=t?` ${t} `:"",f=i?` ${i} `:"",c=g.length,l=f.length,a=r??"left";if(c+l>=e){if(c>=e)return`${g.slice(0,e-1)}…`;const b=e-c;return b>3?g+f.slice(0,b):g+D(o.repeat(e-c),s,n,d)}const h=e-c-l;if(a==="left"||i)return g+D(o.repeat(h),s,n,d)+f;if(a==="right"){const b=e-c;return D(o.repeat(b),s,n,d)+g}const u=Math.floor(h/2),p=h-u;return D(o.repeat(u),s,n,d)+g+D(o.repeat(p),s,n,d)},"buildBorderWithTitle"),bt=re((o,e,t,r)=>{if(t.style.borderStyle){const i=Math.round(t.yogaNode.getComputedWidth()),s=Math.round(t.yogaNode.getComputedHeight()),n=typeof t.style.borderStyle=="string"?Ye[t.style.borderStyle]:t.style.borderStyle,d=t.style.borderTopColor??t.style.borderColor,g=t.style.borderBottomColor??t.style.borderColor,f=t.style.borderLeftColor??t.style.borderColor,c=t.style.borderRightColor??t.style.borderColor,l=t.style.borderTopBackgroundColor??t.style.borderBackgroundColor,a=t.style.borderBottomBackgroundColor??t.style.borderBackgroundColor,h=t.style.borderLeftBackgroundColor??t.style.borderBackgroundColor,u=t.style.borderRightBackgroundColor??t.style.borderBackgroundColor,p=t.style.borderTopDimColor??t.style.borderDimColor,b=t.style.borderBottomDimColor??t.style.borderDimColor,m=t.style.borderLeftDimColor??t.style.borderDimColor,y=t.style.borderRightDimColor??t.style.borderDimColor,k=t.style.borderTop!==!1,w=t.style.borderBottom!==!1,B=t.style.borderLeft!==!1,P=t.style.borderRight!==!1,v=Math.max(0,i-(B?1:0)-(P?1:0));let M;if(k){const L=B?D(n.topLeft,d,l,p):"",$=P?D(n.topRight,d,l,p):"",R=Ne(n.top,v,t.style.borderTopTitle,t.style.borderTopTitleAlignment,t.style.borderTopRightTitle,d,l,p);M=L+R+$}let C=s;k&&(C-=1),w&&(C-=1),C=Math.max(0,C);let E="";B&&(E=`${D(n.left,f,h,m)}
|
|
6
|
-
`.repeat(C));let N="";P&&(N=`${D(n.right,c,u,y)}
|
|
7
|
-
`.repeat(C));let x;if(w){const L=B?D(n.bottomLeft,g,a,b):"",$=P?D(n.bottomRight,g,a,b):"",R=Ne(n.bottom,v,t.style.borderBottomTitle,t.style.borderBottomTitleAlignment,void 0,g,a,b);x=L+R+$}const O=k?1:0;M&&r.write(o,e,M,{transformers:[]}),E&&r.write(o,e+O,E,{transformers:[]}),N&&r.write(o+i-1,e+O,N,{transformers:[]}),x&&r.write(o,e+s-1,x,{transformers:[]})}},"renderBorder");var vt=Object.defineProperty,Ct=_((o,e)=>vt(o,"name",{value:e,configurable:!0}),"m");const Ee=[],Se=Ct(({axis:o,color:e,layout:t,output:r})=>{const{thumb:{end:i,endHalf:s,start:n,startHalf:d},x:g,y:f}=t;if(o==="vertical")for(let c=n;c<i;c++){let l="█";const a=2*c>=d&&2*c<s,h=2*c+1>=d&&2*c+1<s;a&&!h?l="▀":!a&&h&&(l="▄");const u=e?J(l,e,"foreground"):l;r.write(g,f+c,u,{transformers:Ee})}else for(let c=n;c<i;c++){let l="█";const a=2*c>=d&&2*c<s,h=2*c+1>=d&&2*c+1<s;a&&!h?l="▌":!a&&h&&(l="▐");const u=e?J(l,e,"foreground"):l;r.write(g+c,f,u,{transformers:Ee})}},"renderScrollbar");var Nt=Object.defineProperty,ie=_((o,e)=>Nt(o,"name",{value:e,configurable:!0}),"b");const _e=ie((o,e=[])=>{for(const t of o.childNodes){if(t.nodeName==="#text")continue;const r=t;if(!r.internal_stickyAlternate)if(r.internal_sticky)e.push({node:r,type:r.internal_sticky==="bottom"?"bottom":"top"});else{const i=r.style.overflow??"visible",s=r.style.overflowX??i,n=r.style.overflowY??i;!(s==="scroll"||n==="scroll")&&r.childNodes&&_e(r,e)}}return e},"getStickyDescendants"),Et=ie((o,e,t,r)=>{let i,s=-1,n,d=-1;for(const[f,c]of o.entries()){const{node:l,type:a}=c;if(!l.yogaNode)continue;const h=F(l,e)??0,u=Math.round(l.yogaNode.getComputedHeight()),p=h+u,b=l.parentNode;let m=0,y=Number.MAX_SAFE_INTEGER;b?.yogaNode&&(m=F(b,e)??0,y=Math.round(b.yogaNode.getComputedHeight())),a==="top"&&h<t&&m+y>t&&(i=c,s=f),a==="bottom"&&Math.floor(p)>Math.floor(r)&&m<r&&(n=c,d=f)}const g=[];if(i){let f;for(let c=s+1;c<o.length;c++){const l=o[c];if(l.type!=="bottom"){f=l;break}}g.push({nextStickyNodeInfo:f,stickyNode:i.node,type:"top"})}if(n){let f;for(let c=d-1;c>=0;c--){const l=o[c];if(l.type==="bottom"){f=l;break}}g.push({nextStickyNodeInfo:f,stickyNode:n.node,type:"bottom"})}return g},"identifyActiveStickyNodes"),St=ie((o,e,t,r,i)=>{const{newTransformers:s,skipStaticElements:n,x:d,y:g}=i,{yogaNode:f}=e;if(!f)return;const c=f.getComputedBorder(T.EDGE_TOP),l=f.getComputedBorder(T.EDGE_LEFT),a=Te(e),h=e.internal_scrollState?.clientHeight??0;for(const{nextStickyNodeInfo:u,stickyNode:p,type:b}of o){if(!p.yogaNode)continue;const m=F(p,e)??0,y=Math.round(p.yogaNode.getComputedHeight()),k=d+(Ie(p,e)??0),w=p.parentNode;let B=0,P=Number.MAX_SAFE_INTEGER;w?.yogaNode&&(B=F(w,e)??0,P=Math.round(w.yogaNode.getComputedHeight()));let v;if(b==="top"){const E=w?.yogaNode?.getComputedBorder(T.EDGE_BOTTOM)??0,N=B+P-E;let x=g-a+N-y;const O=g-a+m,L=g+c;if(u?.node?.yogaNode){const $=F(u.node,e)??0,R=g-a+$-y;R<x&&(x=R)}v=Math.min(Math.max(L,O),x)}else{const E=w?.yogaNode?.getComputedBorder(T.EDGE_TOP)??0;let N=g-a+B+E;const x=g-a+m,O=g+c+h-y;if(u?.node?.yogaNode){const L=Math.round(u.node.yogaNode.getComputedHeight()),$=F(u.node,e)??0,R=g-a+$+L;R>N&&(N=R)}v=Math.max(Math.min(O,x),N)}const M=r({height:y,width:Math.round(p.yogaNode.getComputedWidth())});X(p,M,{offsetX:-Math.round(p.yogaNode.getComputedLeft()),offsetY:-Math.round(p.yogaNode.getComputedTop()),skipStaticElements:n,transformers:s});const C=M.get().output.split(`
|
|
8
|
-
`);for(const[E,N]of C.entries())N&&N.length>0&&t.write(k-(d+l),v-(g+c)+E,N,{transformers:[]})}},"renderActiveStickyNodes");var Mt=Object.defineProperty,W=_((o,e)=>Mt(o,"name",{value:e,configurable:!0}),"x");const Tt=W((o,e)=>{const t=o.childNodes[0]?.yogaNode;if(t){const r=Math.round(t.getComputedLeft()),i=Math.round(t.getComputedTop());e=`
|
|
9
|
-
`.repeat(i)+Q(e,r)}return e},"applyPaddingToText"),xt=31,kt=127,wt=128,Lt=159,Rt=W((o,e)=>{if(!Number.isFinite(e))return!1;if(e<0)return!0;let t=0;for(const r of o){if(r===`
|
|
10
|
-
`){if(t>e)return!0;t=0;continue}const i=r.codePointAt(0);if(i<=xt||i===kt||i>=wt&&i<=Lt||Ge(i)||(t++,t>e))return!0}return!1},"mightExceedWidth"),_t=W(o=>(o.internal_hidden??!1)||o.yogaNode?.getDisplay()===T.DISPLAY_NONE,"isNodeHidden"),Ot=W(o=>{let e=o;for(;e;){if(_t(e))return!0;e=e.parentNode}return!1},"isNodeOrAncestorHidden"),ee=W((o,e={})=>{if(e.skipStaticElements&&o.internal_static||o.internal_hidden||o.internal_stickyAlternate||o.yogaNode?.getDisplay()===T.DISPLAY_NONE)return"";let t="";if(o.nodeName==="ink-text")t=xe(o);else if(o.nodeName==="ink-box"||o.nodeName==="ink-root"){const r=o.style.flexDirection==="row"||o.style.flexDirection==="row-reverse"?" ":`
|
|
11
|
-
`;t=(o.style.flexDirection==="row-reverse"||o.style.flexDirection==="column-reverse"?o.childNodes.toReversed():[...o.childNodes]).map(i=>ee(i,{parentRole:o.internal_accessibility?.role,skipStaticElements:e.skipStaticElements})).filter(Boolean).join(r)}if(o.internal_accessibility){const{role:r,state:i}=o.internal_accessibility;if(i){const s=Object.keys(i).filter(n=>i[n]).join(", ");s&&(t=`(${s}) ${t}`)}r&&r!==e.parentRole&&(t=`${r}: ${t}`)}return t},"renderNodeToScreenReaderOutput"),X=W((o,e,t)=>{const{absoluteOffsetX:r,absoluteOffsetY:i,offsetX:s=0,offsetY:n=0,renderState:d,selectionMap:g,skipStaticElements:f,transformers:c=[]}=t;if(f&&o.internal_static||o.internal_hidden)return;if(o.cachedRender){const a=Math.round(s+(o.yogaNode?.getComputedLeft()??0)),h=Math.round(n+(o.yogaNode?.getComputedTop()??0));e.addRegionTree(o.cachedRender,a,h);return}if(o.nodeName==="ink-cursor"){if(!d)return;d.cursorRequested=!0;const a=o.internal_cursor;if(!a){d.cursorPosition=void 0;return}if(a.inline){if(d.lastTextWriteEnd)d.cursorPosition={x:d.lastTextWriteEnd.x,y:d.lastTextWriteEnd.y};else{const p=o.parentNode?ce(o.parentNode):void 0;d.cursorPosition=p?{x:p.x,y:p.y}:void 0}return}const h=a.anchorRef?a.anchorRef.current:o.parentNode;if(!h){d.cursorPosition=void 0;return}if(a.anchorRef&&Ot(h)){d.cursorPosition=void 0;return}const u=ce(h);if(!u){d.cursorPosition=void 0;return}d.cursorPosition={x:u.x+a.x,y:u.y+a.y};return}const{yogaNode:l}=o;if(l){if(l.getDisplay()===T.DISPLAY_NONE)return;const a=l.getComputedLeft(),h=l.getComputedTop(),u=Math.round(s+a),p=Math.round(n+h),b=Math.round((r??s)+a),m=Math.round((i??n)+h),y=e.getCurrentClip();if(y){const v=Math.round(l.getComputedWidth()),M=Math.round(l.getComputedHeight()),C=b+v,E=m+M,N=y.x1??-1/0,x=y.x2??1/0,O=y.y1??-1/0,L=y.y2??1/0;if(C<=N||b>=x||E<=O||m>=L)return}let k=c;if(typeof o.internal_transform=="function"&&(k=[o.internal_transform,...c]),o.nodeName==="ink-text"){let v=xe(o);if(v.length>0){const M=Qe(l);if(Rt(v,M)&&Math.max(...v.split(`
|
|
12
|
-
`).map(C=>Z(C)))>M){const C=o.style.textWrap??"wrap";v=Pe(v,Math.floor(M),C)}if(v=Tt(o,v),e.write(u,p,v,{transformers:k}),d){const C=v.split(`
|
|
13
|
-
`),E=C.at(-1)??"";d.lastTextWriteEnd={x:u+Z(E),y:p+C.length-1}}}return}let w=!1,B=0,P=0;if(o.nodeName==="ink-box"){mt(u,p,o,e),bt(u,p,o,e);const v=o.style.overflow??"visible",M=o.style.overflowX??v,C=o.style.overflowY??v,E=M==="hidden"||M==="scroll",N=C==="hidden"||C==="scroll";if(E||N){const x=Math.round(l.getComputedWidth()),O=Math.round(l.getComputedHeight()),L=E?u+l.getComputedBorder(T.EDGE_LEFT):u,$=E?x-l.getComputedBorder(T.EDGE_LEFT)-l.getComputedBorder(T.EDGE_RIGHT):x,R=N?p+l.getComputedBorder(T.EDGE_TOP):p,U=N?O-l.getComputedBorder(T.EDGE_TOP)-l.getComputedBorder(T.EDGE_BOTTOM):O;e.startChildRegion(L,R,Math.max(0,$),Math.max(0,U)),w=!0,C==="scroll"&&o.internal_scrollState&&(P=-o.internal_scrollState.scrollTop),M==="scroll"&&o.internal_scrollState&&(B=-o.internal_scrollState.scrollLeft)}}if(o.nodeName==="ink-root"||o.nodeName==="ink-box"||o.nodeName==="ink-static-render"){for(const v of o.childNodes)X(v,e,{absoluteOffsetX:b+B,absoluteOffsetY:m+P,offsetX:u+B,offsetY:p+P,renderState:d,selectionMap:g,skipStaticElements:f,transformers:k});if(o.nodeName==="ink-box"&&o.internal_scrollState){const v=_e(o);if(v.length>0){const M=Te(o),C=o.internal_scrollState.clientHeight,E=M+C,N=Et(v,o,M,E);N.length>0&&St(N,o,e,W(x=>new oe(x),"createOutput"),{newTransformers:k,skipStaticElements:f,x:u,y:p})}}if(o.nodeName==="ink-box"&&o.internal_scrollState){const v=o.style.overflow??"visible",M=o.style.overflowX??v,C=o.style.overflowY??v,E=l.getComputedBorder(T.EDGE_LEFT),N=l.getComputedBorder(T.EDGE_RIGHT),x=l.getComputedBorder(T.EDGE_TOP),O=l.getComputedBorder(T.EDGE_BOTTOM),L=Math.round(l.getComputedWidth()-E-N),$=Math.round(l.getComputedHeight()-x-O),{clientHeight:R,clientWidth:U,scrollHeight:ne,scrollLeft:Oe,scrollTop:Be,scrollWidth:se}=o.internal_scrollState,le=C==="scroll"&&ne>R,$e=M==="scroll"&&se>U,ae=o.internal_scrollbar!==!1;if(le&&ae){const G=he({axis:"vertical",clientDimension:R,hasOppositeScrollbar:!1,height:$,marginBottom:0,marginRight:0,scrollDimension:ne,scrollPosition:Be,width:L,x:u+E,y:p+x});G&&Se({axis:"vertical",color:o.style.scrollbarThumbColor,layout:G,output:e})}if($e&&ae){const G=he({axis:"horizontal",clientDimension:U,hasOppositeScrollbar:le,height:$,marginBottom:0,marginRight:0,scrollDimension:se,scrollPosition:Oe,width:L,x:u+E,y:p+x});G&&Se({axis:"horizontal",color:o.style.scrollbarThumbColor,layout:G,output:e})}}w&&e.endChildRegion()}}},"renderNodeToOutput"),Ut=W((o,e)=>{if(!o.yogaNode)return;const t=Math.round(o.yogaNode.getComputedWidth()),r=Math.round(o.yogaNode.getComputedHeight());if(t<=0||r<=0)return;const{setCachedRender:i}=require("./dom"),s=new oe({height:r,width:t});for(const d of o.childNodes)X(d,s,{skipStaticElements:e?.skipStaticElements??!1});const n={children:[],cursorPosition:void 0,height:r,id:o.internalId??"static",isScrollable:!1,lines:[...s.getRootLines()],selectableSpans:[],stickyHeaders:[],styledOutput:[...s.getRootLines()],width:t,x:0,y:0};i(o,n)},"renderToStatic");var Bt=Object.defineProperty,K=_((o,e)=>Bt(o,"name",{value:e,configurable:!0}),"N");const $t=K((o,e)=>{const t=new Map;if(e.rangeCount===0)return t;const r=e.getRangeAt(0),{endContainer:i,endOffset:s,startContainer:n,startOffset:d}=r;if(!n||!i)return t;let g=!1,f=!1;const c=K((a,h,u,p,b,m)=>{if(a.nodeName==="#text"){const{length:y}=a.nodeValue;n===a&&(b.value=!0,u.value=h.value+d),i===a&&(m.value=!0,p.value=h.value+s),h.value+=y}else if("childNodes"in a){for(const y of a.childNodes)a===n&&(b.value=!0,u.value=h.value),a===i&&(m.value=!0,p.value=h.value),c(y,h,u,p,b,m);a===n&&d===a.childNodes.length&&(b.value=!0,u.value=h.value),a===i&&s===a.childNodes.length&&(m.value=!0,p.value=h.value)}},"visitChildren"),l=K(a=>{if(a.nodeName==="ink-text"){if(!We(a))return;const h={value:0},u={value:-1},p={value:-1},b={value:!1},m={value:!1};for(const y of a.childNodes)a===n&&(b.value=!0,u.value=h.value),a===i&&(m.value=!0,p.value=h.value),c(y,h,u,p,b,m);if(a===n&&d===a.childNodes.length&&(b.value=!0,u.value=h.value),a===i&&s===a.childNodes.length&&(m.value=!0,p.value=h.value),(g||b.value)&&(!f||m.value)){const y=b.value?u.value:0,k=m.value?p.value:h.value;y!==-1&&k!==-1&&y<k&&t.set(a,{end:k,start:y})}b.value&&(g=!0),m.value&&(f=!0)}else{const{childNodes:h}=a;if(h){for(const u of h)a===n&&(g=!0),a===i&&(f=!0),l(u);a===n&&d===h.length&&(g=!0),a===i&&s===h.length&&(f=!0)}}},"visit");return l(o),t},"calculateSelectionMap"),Dt=new te,Pt=new te,Wt=new WeakMap,Ht=new WeakMap,Me=K(({caches:o,height:e,node:t,outputs:r,width:i})=>{let s=r.get(t);return s||(s=new oe({caches:o,height:e,width:i}),r.set(t,s)),s.reset(i,e),s},"getReusableOutput"),Vt=K((o,e,t)=>{if(o.yogaNode){if(e){const f=ee(o,{skipStaticElements:!0}),c=f===""?0:f.split(`
|
|
14
|
-
`).length;let l="";return o.staticNode&&(l=ee(o.staticNode,{skipStaticElements:!1})),{cursorPosition:void 0,cursorRequested:!1,output:f,outputHeight:c,staticOutput:l?`${l}
|
|
15
|
-
`:""}}const r=t?.selection&&t.selection.rangeCount>0?$t(o,t.selection):void 0,i=Me({caches:Dt,height:o.yogaNode.getComputedHeight(),node:o,outputs:Wt,width:o.yogaNode.getComputedWidth()}),s={cursorPosition:void 0,cursorRequested:!1};X(o,i,{renderState:s,selectionMap:r,skipStaticElements:!0});let n;if(o.staticNode?.yogaNode&&(n=Me({caches:Pt,height:o.staticNode.yogaNode.getComputedHeight(),node:o,outputs:Ht,width:o.staticNode.yogaNode.getComputedWidth()}),X(o.staticNode,n,{skipStaticElements:!1})),t?.useNativeRenderer){const{buffer:f,height:c}=i.getBuffer();return{cursorPosition:s.cursorPosition,cursorRequested:s.cursorRequested,output:"",outputBuffer:f,outputHeight:c,outputWidth:i.width,staticOutput:n?`${n.get().output}
|
|
16
|
-
`:""}}const{height:d,output:g}=i.get();return{cursorPosition:s.cursorPosition,cursorRequested:s.cursorRequested,output:g,outputHeight:d,staticOutput:n?`${n.get().output}
|
|
17
|
-
`:""}}return{cursorPosition:void 0,cursorRequested:!1,output:"",outputHeight:0,staticOutput:""}},"renderer");export{Vt as R,Ut as r};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./get-string-width-4oMZhv2Q.js";import{c as i,a as s,e as n,i as d,m as l,s as r,b as c,n as h,d as y,t as S}from"./measure-text-CIs55Wao.js";export{i as clearStringWidthCache,s as clearStyledLineCache,n as default,d as inkCharacterWidth,l as measureStyledLine,r as setEnableStyledLineCache,c as setStringWidthFunction,h as splitStyledLineByNewline,y as styledLineWidth,S as toStyledLine};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var f=Object.defineProperty;var u=(e,r)=>f(e,"name",{value:r,configurable:!0});import{h,t as m}from"./ansi-tokenizer-DqX9nJuk.js";var x=Object.defineProperty,p=u((e,r)=>x(e,"name",{value:r,configurable:!0}),"n");const N=/^[\d:;]*$/,g=p(e=>{if(!h(e))return e;let r="";for(const t of m(e)){if(t.type==="text"||t.type==="osc"){r+=t.value;continue}t.type==="csi"&&t.finalCharacter==="m"&&t.intermediateString===""&&N.test(t.parameterString)&&(r+=t.value)}return r},"sanitizeAnsi");var v=Object.defineProperty,d=u((e,r)=>v(e,"name",{value:r,configurable:!0}),"d");const y=d(e=>{let r="";for(let t=0;t<e.childNodes.length;t++){const o=e.childNodes[t];if(o===void 0)continue;let a="";o.nodeName==="#text"?a=o.nodeValue:((o.nodeName==="ink-text"||o.nodeName==="ink-virtual-text")&&(a=y(o)),a.length>0&&typeof o.internal_transform=="function"&&(a=o.internal_transform(a,t))),r+=a}return g(r)},"squashTextNodes"),_=d((e,r,t)=>{if(e.internal_textCache){const{map:s,text:n}=e.internal_textCache;for(const[i,c]of s.entries())r.set(i,{end:c.end+t.current,start:c.start+t.current});return t.current+=n.length,n}let o="";const a=new Map,l={current:0};for(let s=0;s<e.childNodes.length;s++){const n=e.childNodes[s];if(n===void 0)continue;let i="";const c=l.current;n.nodeName==="#text"?(i=n.nodeValue,a.set(n,{end:c+i.length,start:c}),l.current+=i.length):((n.nodeName==="ink-text"||n.nodeName==="ink-virtual-text")&&(i=_(n,a,l),a.set(n,{end:l.current,start:c})),i.length>0&&typeof n.internal_transform=="function"&&(i=n.internal_transform(i,s))),o+=i}e.internal_textCache={map:a,text:o};for(const[s,n]of a.entries())r.set(s,{end:n.end+t.current,start:n.start+t.current});return t.current+=o.length,o},"squashTextNodesWithMap");export{y as default,_ as squashTextNodesWithMap};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var c=Object.defineProperty;var a=(e,r)=>c(e,"name",{value:r,configurable:!0});var o=Object.defineProperty,t=a((e,r)=>o(e,"name",{value:r,configurable:!0}),"u"),i=Object.defineProperty,n=t((e,r)=>i(e,"name",{value:r,configurable:!0}),"u"),l=Object.defineProperty,f=n((e,r)=>l(e,"name",{value:r,configurable:!0}),"e");function u({onlyFirst:e=!1}={}){const r="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(r,e?void 0:"g")}a(u,"n");t(u,"a");n(u,"t");f(u,"ansiRegex");var p=Object.defineProperty,d=n((e,r)=>p(e,"name",{value:r,configurable:!0}),"r");const v=u(),b=/\u001B\]0;.*\u0007/,g=d(e=>e.replace(b,"").replace(v,""),"strip");export{g as s};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var p=Object.defineProperty;var r=(t,e)=>p(t,"name",{value:e,configurable:!0});import{o as c}from"./get-string-width-4oMZhv2Q.js";var h=Object.defineProperty,u=r((t,e)=>h(t,"name",{value:e,configurable:!0}),"i");const f={ambiguousIsNarrow:!0,emojiWidth:1};function d(t){return Math.max(1,c(t,f))}r(d,"getCodePointWidth");u(d,"getCodePointWidth");function m(t){return c(t,f)}r(m,"getStringWidth");u(m,"getStringWidth");function g(t,e){if(e<=0)return 0;if(t.length===0)return 1;let i=1,o=0;for(const a of t){const n=Math.min(d(a),e);o+n>e&&(i++,o=0),o+=n}return i}r(g,"countWrappedRowsForLine");u(g,"countWrappedRowsForLine");function l(t,e){const i=t.split(`
|
|
2
|
-
`);let o=0,a=0;for(const n of i){const s=m(n);s>o&&(o=s),a+=e>0?g(n,e):0}return{maxLineWidth:o,wrappedRows:a}}r(l,"measureTextBlock");u(l,"measureTextBlock");export{m as a,d as g,l as m};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var g=Object.defineProperty;var u=(e,r)=>g(e,"name",{value:r,configurable:!0});import{createRequire as y}from"node:module";const _=y(import.meta.url),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,d=u(e=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[r,t]=c.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return c.getBuiltinModule(e)}return _(e)},"__cjs_getBuiltinModule"),o=c,{execFileSync:O}=d("node:child_process"),i=d("node:fs"),h=d("node:tty");var S=Object.defineProperty,n=u((e,r)=>S(e,"name",{value:r,configurable:!0}),"n");const N=80,b=24,f=n((e,r,{shell:t,env:s}={})=>O(e,r,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:t,env:s}).trim(),"exec"),a=n((e,r)=>({columns:Number.parseInt(e,10),rows:Number.parseInt(r,10)}),"create"),w=n((e,r)=>{const{columns:t,rows:s}=a(e,r);if(!(Number.isNaN(t)||Number.isNaN(s))&&!(t===N&&s===b))return{columns:t,rows:s}},"createIfNotDefault"),I=n(()=>{if(o.platform!=="linux")return!0;try{const e=i.readFileSync("/proc/self/stat","utf8"),r=e.lastIndexOf(") ");if(r===-1)return!1;const t=e.slice(r+2).trim().split(/\s+/),s=Number.parseInt(t[2],10),l=Number.parseInt(t[5],10);return Number.isNaN(s)||Number.isNaN(l)||l<=0?!1:s===l}catch{return!1}},"isForegroundProcess");function v(){const{env:e,stdout:r,stderr:t}=o;if(r?.columns&&r?.rows)return a(r.columns,r.rows);if(t?.columns&&t?.rows)return a(t.columns,t.rows);if(e.COLUMNS&&e.LINES)return a(e.COLUMNS,e.LINES);const s={columns:N,rows:b};return o.platform==="win32"?m()??s:o.platform==="darwin"?p()??m()??s:p()??m()??j()??s}u(v,"O");n(v,"terminalSize");const p=n(()=>{try{const e=o.platform==="darwin"?i.constants.O_EVTONLY|i.constants.O_NONBLOCK:i.constants.O_NONBLOCK,{columns:r,rows:t}=h.WriteStream(i.openSync("/dev/tty",e));return{columns:r,rows:t}}catch{}},"devTty"),m=n(()=>{try{const e=f("tput",["cols"],{env:{TERM:"dumb",...o.env}}),r=f("tput",["lines"],{env:{TERM:"dumb",...o.env}});if(e&&r)return w(e,r)}catch{}},"tput"),j=n(()=>{try{if(!I())return;const e=f("resize",["-u"]).match(/\d+/g);if(e.length===2)return w(e[0],e[1])}catch{}},"resize");var L=Object.defineProperty,T=u((e,r)=>L(e,"name",{value:r,configurable:!0}),"s");const z=T(e=>{const{columns:r,rows:t}=e;if(r&&t)return{columns:r,rows:t};const s=v();return{columns:r||s.columns||80,rows:t||s.rows||24}},"getWindowSize");export{z as g};
|