@visulima/tui 1.0.0-alpha.20 → 1.0.0-alpha.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/LICENSE.md +113 -287
  3. package/dist/components/accordion.d.ts +1 -1
  4. package/dist/components/approval-prompt.d.ts +1 -1
  5. package/dist/components/area-chart.d.ts +1 -1
  6. package/dist/components/badge.d.ts +1 -1
  7. package/dist/components/bar-chart.d.ts +1 -1
  8. package/dist/components/blink-dot.d.ts +1 -1
  9. package/dist/components/box.d.ts +4 -3
  10. package/dist/components/breadcrumb.d.ts +1 -1
  11. package/dist/components/button.d.ts +1 -1
  12. package/dist/components/calendar.d.ts +1 -1
  13. package/dist/components/canvas.js +1 -1
  14. package/dist/components/card.d.ts +1 -1
  15. package/dist/components/checkbox.d.ts +1 -1
  16. package/dist/components/collapsible.d.ts +1 -1
  17. package/dist/components/command-palette.d.ts +1 -1
  18. package/dist/components/content-switcher.d.ts +1 -1
  19. package/dist/components/controlled-scroll-view.d.ts +4 -3
  20. package/dist/components/cursor.d.ts +4 -3
  21. package/dist/components/date-picker.d.ts +1 -1
  22. package/dist/components/definition-list.d.ts +1 -1
  23. package/dist/components/dialog.d.ts +4 -3
  24. package/dist/components/divider.d.ts +1 -1
  25. package/dist/components/form.d.ts +1 -1
  26. package/dist/components/gauge.d.ts +1 -1
  27. package/dist/components/gradient.d.ts +1 -18
  28. package/dist/components/gradient.js +1 -4
  29. package/dist/components/heading.d.ts +1 -1
  30. package/dist/components/heatmap.d.ts +1 -1
  31. package/dist/components/histogram.d.ts +1 -1
  32. package/dist/components/kbd.d.ts +1 -1
  33. package/dist/components/line-chart.d.ts +1 -1
  34. package/dist/components/link.js +1 -1
  35. package/dist/components/loading-indicator.d.ts +2 -2
  36. package/dist/components/menu.d.ts +1 -1
  37. package/dist/components/message-bubble.d.ts +1 -1
  38. package/dist/components/model-badge.d.ts +1 -1
  39. package/dist/components/multi-select.d.ts +1 -1
  40. package/dist/components/option-list.d.ts +1 -1
  41. package/dist/components/paragraph.d.ts +1 -1
  42. package/dist/components/placeholder.d.ts +1 -1
  43. package/dist/components/progress-bar.d.ts +3 -2
  44. package/dist/components/radio-group.d.ts +1 -1
  45. package/dist/components/scatter-plot.d.ts +1 -1
  46. package/dist/components/scroll-bar-box.d.ts +4 -3
  47. package/dist/components/scroll-bar.d.ts +4 -3
  48. package/dist/components/scroll-list.d.ts +4 -3
  49. package/dist/components/scroll-view.d.ts +4 -3
  50. package/dist/components/search-input.d.ts +1 -1
  51. package/dist/components/select-input-indicator.d.ts +1 -1
  52. package/dist/components/select-input-item.d.ts +1 -1
  53. package/dist/components/select-input.d.ts +1 -1
  54. package/dist/components/shimmer-text.d.ts +1 -1
  55. package/dist/components/slider.d.ts +1 -1
  56. package/dist/components/sparkline.d.ts +1 -1
  57. package/dist/components/spinner.d.ts +1 -1
  58. package/dist/components/spinner.js +1 -1
  59. package/dist/components/static-render.d.ts +4 -3
  60. package/dist/components/static.d.ts +3 -2
  61. package/dist/components/status-line.d.ts +1 -1
  62. package/dist/components/stepper.d.ts +1 -1
  63. package/dist/components/streaming-text.d.ts +1 -1
  64. package/dist/components/switch.d.ts +1 -1
  65. package/dist/components/tabs.d.ts +1 -1
  66. package/dist/components/tag.d.ts +1 -1
  67. package/dist/components/text.d.ts +3 -2
  68. package/dist/components/text.js +1 -1
  69. package/dist/components/tooltip.d.ts +1 -1
  70. package/dist/components/tree-view-entry.d.ts +4 -3
  71. package/dist/core/index.d.ts +2 -1
  72. package/dist/core/index.js +1 -1
  73. package/dist/ink/hooks/use-box-metrics.d.ts +4 -3
  74. package/dist/ink/hooks/use-box-metrics.js +1 -1
  75. package/dist/ink/hooks/use-input.js +1 -1
  76. package/dist/ink/hooks/use-linked-scroll.d.ts +4 -3
  77. package/dist/ink/hooks/use-paste.js +1 -1
  78. package/dist/ink/hooks/use-text-selection.d.ts +5 -4
  79. package/dist/ink/hooks/use-text-selection.js +1 -1
  80. package/dist/ink/hooks/use-window-size.js +1 -1
  81. package/dist/ink/index.d.ts +7 -6
  82. package/dist/ink/index.js +1 -1
  83. package/dist/packem_shared/{DevTools-BR7K-5JX.js → DevTools-ClAYpMVI.js} +1 -1
  84. package/dist/packem_shared/InputParser-B_qZcN3r.js +2 -0
  85. package/dist/packem_shared/{LayoutNode-B0qeT8sl.js → LayoutNode-B8zej4dm.js} +1 -1
  86. package/dist/packem_shared/{MouseProvider-CHU5DuwC.js → MouseProvider-PnIUKURs.js} +1 -1
  87. package/dist/packem_shared/TuiApp-BVDXP0Cv.js +1 -0
  88. package/dist/packem_shared/ansi-parser-B6uXaq65.js +1 -0
  89. package/dist/packem_shared/colorize-DbTZMrJO.js +1 -0
  90. package/dist/packem_shared/{comparePoints-Dez5FkH9.js → comparePoints-YxQfR_zq.js} +1 -1
  91. package/dist/packem_shared/createInlineLoop-DRNZ7jqH.js +2 -0
  92. package/dist/packem_shared/createScreen-CrLrxA6t.js +3 -0
  93. package/dist/packem_shared/dom-BG-LS10p.js +1 -0
  94. package/dist/packem_shared/{dom.d-DgP_exKU.d.ts → dom.d-C1IxuLJ9.d.ts} +3 -1
  95. package/dist/packem_shared/{getPathToRoot-B3q6OlQy.js → getPathToRoot-D5Hns9Er.js} +1 -1
  96. package/dist/packem_shared/input.d-CgxV2e8U.d.ts +90 -0
  97. package/dist/packem_shared/measure-text-DDjHT1jD.js +3 -0
  98. package/dist/packem_shared/parseSgrMouse-Ccj70ijb.js +1 -0
  99. package/dist/packem_shared/reconciler-CUbhOvcr.js +1 -0
  100. package/dist/packem_shared/reconciler-DIfG72R9.js +1 -0
  101. package/dist/packem_shared/render-BFio00DS.js +26 -0
  102. package/dist/packem_shared/{render-BoukeuYD.js → render-Dh7HMhK1.js} +1 -1
  103. package/dist/packem_shared/{render.d-DarVJBG2.d.ts → render.d-DuyG0zip.d.ts} +1 -1
  104. package/dist/packem_shared/{renderToString-nZdqfdWT.js → renderToString-BbQiRHrd.js} +1 -1
  105. package/dist/packem_shared/{renderToString-Cx3DmmMR.js → renderToString-SDrrFvu8.js} +1 -1
  106. package/dist/packem_shared/renderTreeToBuffer-CZilzyhN.js +2 -0
  107. package/dist/packem_shared/renderer-DG986Pcr.js +17 -0
  108. package/dist/packem_shared/{selection.d-WuD_83yQ.d.ts → selection.d-Dbha5bMS.d.ts} +1 -1
  109. package/dist/packem_shared/setEnableStyledLineCache-D2gZbwFM.js +1 -0
  110. package/dist/packem_shared/{styles.d-CLJdt-kg.d.ts → styles.d-cMo36xQz.d.ts} +2 -98
  111. package/dist/packem_shared/text-width-BU2eeTWn.js +2 -0
  112. package/dist/packem_shared/utils-CoviI5Vm.js +1 -0
  113. package/dist/packem_shared/{wrapOrTruncateStyledLine-kyi6yijx.js → wrapOrTruncateStyledLine-BZ00SM8i.js} +1 -1
  114. package/dist/react/index.d.ts +2 -1
  115. package/dist/react/index.js +1 -1
  116. package/dist/testing/index.d.ts +5 -4
  117. package/dist/testing/index.js +1 -1
  118. package/index.js +26 -26
  119. package/package.json +22 -9
  120. package/dist/packem_shared/InputParser-BAqciKJ6.js +0 -2
  121. package/dist/packem_shared/TuiApp-CxBtziW8.js +0 -1
  122. package/dist/packem_shared/_commonjsHelpers-CHNfUHCT.js +0 -1
  123. package/dist/packem_shared/ansi-parser-C5JuL732.js +0 -1
  124. package/dist/packem_shared/boxes-DyY_LXCi.js +0 -1
  125. package/dist/packem_shared/colorize-gy_cY-wC.js +0 -2
  126. package/dist/packem_shared/constants-D12jy2Zh-RSfxu1eM.js +0 -1
  127. package/dist/packem_shared/createInlineLoop-D0JaKX9A.js +0 -2
  128. package/dist/packem_shared/createScreen-87XLHZq6.js +0 -3
  129. package/dist/packem_shared/dom-CW6KYzFK.js +0 -8
  130. package/dist/packem_shared/erase-DKKNxHZ_.js +0 -1
  131. package/dist/packem_shared/get-string-width-CbMPWEJO.js +0 -1
  132. package/dist/packem_shared/index-COPEEDn3.js +0 -9
  133. package/dist/packem_shared/index-CqsHHJkn.js +0 -75
  134. package/dist/packem_shared/index.d-Bk52cbgN.d.ts +0 -14
  135. package/dist/packem_shared/index.server.d-eZWyC2Ku.d.ts +0 -5
  136. package/dist/packem_shared/input.d-D-Yxqha8.d.ts +0 -172
  137. package/dist/packem_shared/measure-text-D-jVetsl.js +0 -3
  138. package/dist/packem_shared/mode-BOIU4Roy.js +0 -1
  139. package/dist/packem_shared/parseSgrMouse-DoBY7MKw.js +0 -1
  140. package/dist/packem_shared/reconciler-CGhHgXXG.js +0 -1
  141. package/dist/packem_shared/reconciler-ClRKkLS4.js +0 -1
  142. package/dist/packem_shared/render-CBFHzIKj.js +0 -27
  143. package/dist/packem_shared/renderTreeToBuffer-LnGZkEUX.js +0 -2
  144. package/dist/packem_shared/renderer-C2ycheBL.js +0 -17
  145. package/dist/packem_shared/setEnableStyledLineCache-Cke6_ZQt.js +0 -1
  146. package/dist/packem_shared/strip-C6HQYmlg.js +0 -1
  147. package/dist/packem_shared/text-width-CI9G0a-z.js +0 -2
  148. package/dist/packem_shared/utils-THUhYKG2.js +0 -1
@@ -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-CW6KYzFK.js";import{o as Z}from"./get-string-width-CbMPWEJO.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-D-jVetsl.js";import T from"yoga-layout";import{j as F,i as Ie,m as ce,c as he}from"./layout-BMo200nF.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-ClEOyLHH.js";import xe from"./squashTextNodesWithMap-DCdi3SZ2.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");const Ve=1114112;var Je=Object.defineProperty,Le=_((o,e)=>Je(o,"name",{value:e,configurable:!0}),"T$1");const Qe=1,Ze=2,et=3,tt=4,ot=7,rt=8,it=9,ge=22,fe=23,pe=24,me=27,ye=28,be=29,ve=39,Ce=49,nt="\x1B[",E=Le(o=>o.length===0?"":`${nt}${o.join(";")}m`,"sgr"),st=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+=E([ge])),u&H&&(!(t&H)||y)&&(e+=E([Qe])),u&A&&(!(t&A)||m)&&(e+=E([Ze]))}u&I&&!(t&I)?e+=E([et]):!(u&I)&&t&I&&(e+=E([fe])),u&j&&!(t&j)?e+=E([tt]):!(u&j)&&t&j&&(e+=E([pe])),u&z&&!(t&z)?e+=E([ot]):!(u&z)&&t&z&&(e+=E([me])),u&Y&&!(t&Y)?e+=E([rt]):!(u&Y)&&t&Y&&(e+=E([ye])),u&q&&!(t&q)?e+=E([it]):!(u&q)&&t&q&&(e+=E([be])),l!==r&&(e+=E(l?de(l,!0):[ve])),a!==i&&(e+=E(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+=E([ge])),t&I&&(e+=E([fe])),t&j&&(e+=E([pe])),t&z&&(e+=E([me])),t&Y&&(e+=E([ye])),t&q&&(e+=E([be])),r!==void 0&&(e+=E([ve])),i!==void 0&&(e+=E([Ce]))),s&&(e+=s.startsWith("ST:")?"\x1B]8;;\x1B\\":"\x1B]8;;\x07"),e},"styledLineToString");var lt=Object.defineProperty,Re=_((o,e)=>lt(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(at.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 at=new Set([27,144,152,155,157,158,159]),dt=.6,ut=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=st(c);s[d]=l,t&&(this.previousRenderedLines[d]=l,this.previousLines[d]=f.clone())}return t&&i&&e.length>0&&n/e.length>dt&&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]=Ve,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=ut,this.previousLines.length=0,this.previousRenderedLines.length=0}}var ct=Object.defineProperty,ht=_((o,e)=>ct(o,"name",{value:e,configurable:!0}),"d");const gt=ht(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");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 S="";B&&(S=`${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:[]}),S&&r.write(o,e+O,S,{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 Se=[],Ee=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:Se})}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:Se})}},"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"),St=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"),Et=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 S=w?.yogaNode?.getComputedBorder(T.EDGE_BOTTOM)??0,N=B+P-S;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 S=w?.yogaNode?.getComputedBorder(T.EDGE_TOP)??0;let N=g-a+B+S;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[S,N]of C.entries())N&&N.length>0&&t.write(k-(d+l),v-(g+c)+S,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(d.cursorShape=a.shape,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,S=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||S<=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=gt(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
- `),S=C.at(-1)??"";d.lastTextWriteEnd={x:u+Z(S),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,S=M==="hidden"||M==="scroll",N=C==="hidden"||C==="scroll";if(S||N){const x=Math.round(l.getComputedWidth()),O=Math.round(l.getComputedHeight()),L=S?u+l.getComputedBorder(T.EDGE_LEFT):u,$=S?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,S=M+C,N=St(v,o,M,S);N.length>0&&Et(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,S=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()-S-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+S,y:p+x});G&&Ee({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+S,y:p+x});G&&Ee({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,cursorShape:void 0,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,cursorShape:void 0};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,cursorShape:s.cursorShape,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,cursorShape:s.cursorShape,output:g,outputHeight:d,staticOutput:n?`${n.get().output}
17
- `:""}}return{cursorPosition:void 0,cursorRequested:!1,cursorShape:void 0,output:"",outputHeight:0,staticOutput:""}},"renderer");export{oe as A,X as B,Vt as R,Ut as r};
@@ -1 +0,0 @@
1
- import"./get-string-width-CbMPWEJO.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-D-jVetsl.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 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-CbMPWEJO.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};