@visulima/tui 1.0.0-alpha.19 → 1.0.0-alpha.20
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 +30 -0
- package/LICENSE.md +370 -107
- 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 -4
- 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 -4
- package/dist/components/cursor.d.ts +13 -4
- package/dist/components/cursor.js +1 -1
- 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 -5
- 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 +18 -1
- package/dist/components/gradient.js +4 -1
- 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 +2 -3
- 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 -4
- package/dist/components/scroll-bar.d.ts +4 -4
- package/dist/components/scroll-list.d.ts +4 -4
- package/dist/components/scroll-view.d.ts +4 -4
- 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 +4 -4
- package/dist/components/static.d.ts +2 -3
- 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 +2 -3
- package/dist/components/text.js +1 -1
- package/dist/components/tooltip.d.ts +1 -1
- package/dist/components/tree-view-entry.d.ts +4 -4
- package/dist/core/index.d.ts +1 -2
- package/dist/core/index.js +1 -1
- package/dist/ink/hooks/use-box-metrics.d.ts +4 -4
- package/dist/ink/hooks/use-box-metrics.js +1 -1
- package/dist/ink/hooks/use-cursor.d.ts +1 -1
- package/dist/ink/hooks/use-input.js +1 -1
- package/dist/ink/hooks/use-linked-scroll.d.ts +4 -4
- package/dist/ink/hooks/use-paste.js +1 -1
- package/dist/ink/hooks/use-text-selection.d.ts +5 -5
- 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 +7 -8
- package/dist/ink/index.js +1 -1
- package/dist/packem_shared/{DevTools-ClAYpMVI.js → DevTools-BR7K-5JX.js} +1 -1
- package/dist/packem_shared/InputParser-BAqciKJ6.js +2 -0
- package/dist/packem_shared/{LayoutNode-B8zej4dm.js → LayoutNode-B0qeT8sl.js} +1 -1
- package/dist/packem_shared/{MouseProvider-PnIUKURs.js → MouseProvider-CHU5DuwC.js} +1 -1
- package/dist/packem_shared/TuiApp-CxBtziW8.js +1 -0
- package/dist/packem_shared/_commonjsHelpers-CHNfUHCT.js +1 -0
- package/dist/packem_shared/ansi-parser-C5JuL732.js +1 -0
- package/dist/packem_shared/boxes-DyY_LXCi.js +1 -0
- package/dist/packem_shared/colorize-gy_cY-wC.js +2 -0
- package/dist/packem_shared/{comparePoints-YxQfR_zq.js → comparePoints-Dez5FkH9.js} +1 -1
- package/dist/packem_shared/constants-D12jy2Zh-RSfxu1eM.js +1 -0
- package/dist/packem_shared/createInlineLoop-D0JaKX9A.js +2 -0
- package/dist/packem_shared/createScreen-87XLHZq6.js +3 -0
- package/dist/packem_shared/cursor-helpers.d-BONB9tky.d.ts +12 -0
- package/dist/packem_shared/dom-CW6KYzFK.js +8 -0
- package/dist/packem_shared/{dom.d-CcFuBd-k.d.ts → dom.d-DgP_exKU.d.ts} +4 -5
- package/dist/packem_shared/erase-DKKNxHZ_.js +1 -0
- package/dist/packem_shared/get-string-width-CbMPWEJO.js +1 -0
- package/dist/packem_shared/{getPathToRoot-D5Hns9Er.js → getPathToRoot-B3q6OlQy.js} +1 -1
- package/dist/packem_shared/index-COPEEDn3.js +9 -0
- package/dist/packem_shared/index-CqsHHJkn.js +75 -0
- package/dist/packem_shared/index.d-Bk52cbgN.d.ts +14 -0
- package/dist/packem_shared/index.server.d-eZWyC2Ku.d.ts +5 -0
- package/dist/packem_shared/input.d-D-Yxqha8.d.ts +172 -0
- package/dist/packem_shared/measure-text-D-jVetsl.js +3 -0
- package/dist/packem_shared/mode-BOIU4Roy.js +1 -0
- package/dist/packem_shared/parseSgrMouse-DoBY7MKw.js +1 -0
- package/dist/packem_shared/reconciler-CGhHgXXG.js +1 -0
- package/dist/packem_shared/reconciler-ClRKkLS4.js +1 -0
- package/dist/packem_shared/{render-Dh7HMhK1.js → render-BoukeuYD.js} +1 -1
- package/dist/packem_shared/render-CBFHzIKj.js +27 -0
- package/dist/packem_shared/{render.d-B1kiO3Ca.d.ts → render.d-DarVJBG2.d.ts} +2 -2
- package/dist/packem_shared/{renderToString-DVE0cEHt.js → renderToString-Cx3DmmMR.js} +1 -1
- package/dist/packem_shared/{renderToString-BbQiRHrd.js → renderToString-nZdqfdWT.js} +1 -1
- package/dist/packem_shared/renderTreeToBuffer-LnGZkEUX.js +2 -0
- package/dist/packem_shared/renderer-C2ycheBL.js +17 -0
- package/dist/packem_shared/{selection.d-DAh7REnW.d.ts → selection.d-WuD_83yQ.d.ts} +1 -1
- package/dist/packem_shared/setEnableStyledLineCache-Cke6_ZQt.js +1 -0
- package/dist/packem_shared/strip-C6HQYmlg.js +1 -0
- package/dist/packem_shared/{styles.d-cMo36xQz.d.ts → styles.d-CLJdt-kg.d.ts} +98 -2
- package/dist/packem_shared/text-width-CI9G0a-z.js +2 -0
- package/dist/packem_shared/utils-THUhYKG2.js +1 -0
- package/dist/packem_shared/{wrapOrTruncateStyledLine-BZ00SM8i.js → wrapOrTruncateStyledLine-kyi6yijx.js} +1 -1
- package/dist/react/index.d.ts +1 -2
- package/dist/react/index.js +1 -1
- package/dist/testing/index.d.ts +5 -6
- package/dist/testing/index.js +1 -1
- package/index.js +539 -691
- package/package.json +11 -27
- package/dist/packem_shared/InputParser-B_qZcN3r.js +0 -2
- package/dist/packem_shared/TuiApp-BVDXP0Cv.js +0 -1
- package/dist/packem_shared/ansi-parser-B6uXaq65.js +0 -1
- package/dist/packem_shared/colorize-DbTZMrJO.js +0 -1
- package/dist/packem_shared/createInlineLoop-DRNZ7jqH.js +0 -2
- package/dist/packem_shared/createScreen-CrLrxA6t.js +0 -3
- package/dist/packem_shared/cursor-helpers.d-BIvqz0TZ.d.ts +0 -5
- package/dist/packem_shared/dom-BG-LS10p.js +0 -1
- package/dist/packem_shared/input.d-CgxV2e8U.d.ts +0 -90
- package/dist/packem_shared/measure-text-DDjHT1jD.js +0 -3
- package/dist/packem_shared/parseSgrMouse-Ccj70ijb.js +0 -1
- package/dist/packem_shared/reconciler-CUbhOvcr.js +0 -1
- package/dist/packem_shared/reconciler-DIfG72R9.js +0 -1
- package/dist/packem_shared/render-bdbSzkJo.js +0 -26
- package/dist/packem_shared/renderTreeToBuffer-CZilzyhN.js +0 -2
- package/dist/packem_shared/renderer-Cfi6ZyHf.js +0 -17
- package/dist/packem_shared/setEnableStyledLineCache-D2gZbwFM.js +0 -1
- package/dist/packem_shared/text-width-BU2eeTWn.js +0 -2
- package/dist/packem_shared/utils-CoviI5Vm.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var b=Object.defineProperty;var p=(e,t)=>b(e,"name",{value:t,configurable:!0});import{createRequire as D}from"node:module";import{version as F,createContext as G}from"react";import v from"react-reconciler";import{NoEventPriority as R,DefaultEventPriority as w}from"react-reconciler/constants.js";import{s as m}from"./index-COPEEDn3.js";import n from"yoga-layout";import{b as I,d as E,s as _,m as T,e as k,r as C,f as B,c as W,h as N,j as S}from"./dom-CW6KYzFK.js";const ee=D(import.meta.url),O=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,L=O;var M=Object.defineProperty,u=p((e,t)=>M(e,"name",{value:t,configurable:!0}),"t");const H=[["top",n.EDGE_TOP],["right",n.EDGE_RIGHT],["bottom",n.EDGE_BOTTOM],["left",n.EDGE_LEFT]],U=u((e,t)=>{if("position"in t){let r=n.POSITION_TYPE_RELATIVE;t.position==="absolute"?r=n.POSITION_TYPE_ABSOLUTE:t.position==="static"&&(r=n.POSITION_TYPE_STATIC),e.setPositionType(r)}for(const[r,s]of H){if(!(r in t))continue;const l=t[r];if(typeof l=="string"){e.setPositionPercent(s,Number.parseFloat(l));continue}e.setPosition(s,l)}},"applyPositionStyles"),Y=u((e,t)=>{"margin"in t&&e.setMargin(n.EDGE_ALL,t.margin??0),"marginX"in t&&e.setMargin(n.EDGE_HORIZONTAL,t.marginX??0),"marginY"in t&&e.setMargin(n.EDGE_VERTICAL,t.marginY??0),"marginLeft"in t&&e.setMargin(n.EDGE_START,t.marginLeft||0),"marginRight"in t&&e.setMargin(n.EDGE_END,t.marginRight||0),"marginTop"in t&&e.setMargin(n.EDGE_TOP,t.marginTop||0),"marginBottom"in t&&e.setMargin(n.EDGE_BOTTOM,t.marginBottom||0)},"applyMarginStyles"),j=u((e,t)=>{"padding"in t&&e.setPadding(n.EDGE_ALL,t.padding??0),"paddingX"in t&&e.setPadding(n.EDGE_HORIZONTAL,t.paddingX??0),"paddingY"in t&&e.setPadding(n.EDGE_VERTICAL,t.paddingY??0),"paddingLeft"in t&&e.setPadding(n.EDGE_LEFT,t.paddingLeft||0),"paddingRight"in t&&e.setPadding(n.EDGE_RIGHT,t.paddingRight||0),"paddingTop"in t&&e.setPadding(n.EDGE_TOP,t.paddingTop||0),"paddingBottom"in t&&e.setPadding(n.EDGE_BOTTOM,t.paddingBottom||0)},"applyPaddingStyles"),X=u((e,t)=>{"flexGrow"in t&&e.setFlexGrow(t.flexGrow??0),"flexShrink"in t&&e.setFlexShrink(typeof t.flexShrink=="number"?t.flexShrink:1),"flexWrap"in t&&(t.flexWrap==="nowrap"&&e.setFlexWrap(n.WRAP_NO_WRAP),t.flexWrap==="wrap"&&e.setFlexWrap(n.WRAP_WRAP),t.flexWrap==="wrap-reverse"&&e.setFlexWrap(n.WRAP_WRAP_REVERSE)),"flexDirection"in t&&(t.flexDirection==="row"&&e.setFlexDirection(n.FLEX_DIRECTION_ROW),t.flexDirection==="row-reverse"&&e.setFlexDirection(n.FLEX_DIRECTION_ROW_REVERSE),t.flexDirection==="column"&&e.setFlexDirection(n.FLEX_DIRECTION_COLUMN),t.flexDirection==="column-reverse"&&e.setFlexDirection(n.FLEX_DIRECTION_COLUMN_REVERSE)),"flexBasis"in t&&(typeof t.flexBasis=="number"?e.setFlexBasis(t.flexBasis):typeof t.flexBasis=="string"?e.setFlexBasisPercent(Number.parseInt(t.flexBasis,10)):e.setFlexBasis(Number.NaN)),"alignItems"in t&&((t.alignItems==="stretch"||!t.alignItems)&&e.setAlignItems(n.ALIGN_STRETCH),t.alignItems==="flex-start"&&e.setAlignItems(n.ALIGN_FLEX_START),t.alignItems==="center"&&e.setAlignItems(n.ALIGN_CENTER),t.alignItems==="flex-end"&&e.setAlignItems(n.ALIGN_FLEX_END),t.alignItems==="baseline"&&e.setAlignItems(n.ALIGN_BASELINE)),"alignSelf"in t&&((t.alignSelf==="auto"||!t.alignSelf)&&e.setAlignSelf(n.ALIGN_AUTO),t.alignSelf==="flex-start"&&e.setAlignSelf(n.ALIGN_FLEX_START),t.alignSelf==="center"&&e.setAlignSelf(n.ALIGN_CENTER),t.alignSelf==="flex-end"&&e.setAlignSelf(n.ALIGN_FLEX_END),t.alignSelf==="stretch"&&e.setAlignSelf(n.ALIGN_STRETCH),t.alignSelf==="baseline"&&e.setAlignSelf(n.ALIGN_BASELINE)),"alignContent"in t&&((t.alignContent==="flex-start"||!t.alignContent)&&e.setAlignContent(n.ALIGN_FLEX_START),t.alignContent==="center"&&e.setAlignContent(n.ALIGN_CENTER),t.alignContent==="flex-end"&&e.setAlignContent(n.ALIGN_FLEX_END),t.alignContent==="space-between"&&e.setAlignContent(n.ALIGN_SPACE_BETWEEN),t.alignContent==="space-around"&&e.setAlignContent(n.ALIGN_SPACE_AROUND),t.alignContent==="space-evenly"&&e.setAlignContent(n.ALIGN_SPACE_EVENLY),t.alignContent==="stretch"&&e.setAlignContent(n.ALIGN_STRETCH)),"justifyContent"in t&&((t.justifyContent==="flex-start"||!t.justifyContent)&&e.setJustifyContent(n.JUSTIFY_FLEX_START),t.justifyContent==="center"&&e.setJustifyContent(n.JUSTIFY_CENTER),t.justifyContent==="flex-end"&&e.setJustifyContent(n.JUSTIFY_FLEX_END),t.justifyContent==="space-between"&&e.setJustifyContent(n.JUSTIFY_SPACE_BETWEEN),t.justifyContent==="space-around"&&e.setJustifyContent(n.JUSTIFY_SPACE_AROUND),t.justifyContent==="space-evenly"&&e.setJustifyContent(n.JUSTIFY_SPACE_EVENLY))},"applyFlexStyles"),V=u((e,t)=>{"width"in t&&(typeof t.width=="number"?e.setWidth(t.width):typeof t.width=="string"?e.setWidthPercent(Number.parseInt(t.width,10)):e.setWidthAuto()),"height"in t&&(typeof t.height=="number"?e.setHeight(t.height):typeof t.height=="string"?e.setHeightPercent(Number.parseInt(t.height,10)):e.setHeightAuto()),"minWidth"in t&&(typeof t.minWidth=="string"?e.setMinWidthPercent(Number.parseInt(t.minWidth,10)):e.setMinWidth(t.minWidth??0)),"minHeight"in t&&(typeof t.minHeight=="string"?e.setMinHeightPercent(Number.parseInt(t.minHeight,10)):e.setMinHeight(t.minHeight??0)),"maxWidth"in t&&(typeof t.maxWidth=="string"?e.setMaxWidthPercent(Number.parseInt(t.maxWidth,10)):e.setMaxWidth(t.maxWidth)),"maxHeight"in t&&(typeof t.maxHeight=="string"?e.setMaxHeightPercent(Number.parseInt(t.maxHeight,10)):e.setMaxHeight(t.maxHeight)),"aspectRatio"in t&&e.setAspectRatio(t.aspectRatio)},"applyDimensionStyles"),J=u((e,t)=>{"display"in t&&e.setDisplay(t.display==="flex"?n.DISPLAY_FLEX:n.DISPLAY_NONE)},"applyDisplayStyles"),q=u((e,t,r)=>{if(!("borderStyle"in t||"borderTop"in t||"borderBottom"in t||"borderLeft"in t||"borderRight"in t))return;const s=r.borderStyle?1:0;e.setBorder(n.EDGE_TOP,r.borderTop===!1?0:s),e.setBorder(n.EDGE_BOTTOM,r.borderBottom===!1?0:s),e.setBorder(n.EDGE_LEFT,r.borderLeft===!1?0:s),e.setBorder(n.EDGE_RIGHT,r.borderRight===!1?0:s)},"applyBorderStyles"),$=u((e,t)=>{"gap"in t&&e.setGap(n.GUTTER_ALL,t.gap??0),"columnGap"in t&&e.setGap(n.GUTTER_COLUMN,t.columnGap??0),"rowGap"in t&&e.setGap(n.GUTTER_ROW,t.rowGap??0)},"applyGapStyles"),z=u((e,t)=>{const r=t.overflow??"visible",s=t.overflowX??r,l=t.overflowY??r;s==="scroll"||l==="scroll"?e.setOverflow(n.OVERFLOW_SCROLL):s==="hidden"||l==="hidden"?e.setOverflow(n.OVERFLOW_HIDDEN):e.setOverflow(n.OVERFLOW_VISIBLE)},"applyOverflowStyles"),x=u((e,t={},r=t)=>{U(e,t),Y(e,t),j(e,t),X(e,t),V(e,t),J(e,t),q(e,t,r),$(e,t),z(e,r)},"styles");var Z=Object.defineProperty,c=p((e,t)=>Z(e,"name",{value:t,configurable:!0}),"c");if(L.env.DEV==="true"){let e=!1;try{import.meta.resolve("react-devtools-core"),e=!0}catch{}e&&await import("../packem_chunks/devtools.js")}const A=c((e,t)=>{if(e===t)return;if(!e)return t;const r={};let s=!1;for(const l of Object.keys(e))(!t||!Object.hasOwn(t,l))&&(r[l]=void 0,s=!0);if(t)for(const l of Object.keys(t))t[l]!==e[l]&&(r[l]=t[l],s=!0);return s?r:void 0},"diff"),y=c(e=>{if(e){if(e.yogaNode?.unsetMeasureFunc(),"resizeObservers"in e&&e.resizeObservers?.clear(),"childNodes"in e&&e.childNodes)for(const t of e.childNodes)y(t);e.yogaNode?.free(),"cachedRender"in e&&(e.cachedRender=void 0),"childNodes"in e&&(e.childNodes=[]),e.parentNode=void 0}},"cleanupNodeTree");let g=R,h;async function P(){const e=(await import("node:fs")).readFileSync(new URL("../package.json",import.meta.url),"utf8"),t=JSON.parse(e);return{name:t?.name,version:t?.version}}p(P,"B");c(P,"loadPackageJson");let f={name:"ink",version:F};if(L.env.DEV==="true")try{const e=await P();f={name:e.name||f.name,version:e.version||f.version}}catch(e){console.warn("Failed to load package.json in development mode. Falling back to default renderer metadata.",e)}const ae=v({afterActiveInstanceBlur(){},appendChild:E,appendChildToContainer:E,appendInitialChild:E,beforeActiveInstanceBlur(){},cancelCallback:m.unstable_cancelCallback,cancelTimeout:clearTimeout,clearContainer:c(()=>!1,"clearContainer"),commitTextUpdate(e,t,r){_(e,r)},commitUpdate(e,t,r,s){h&&e.internal_static&&(h.isStaticDirty=!0);const l=A(r,s),a=A(r.style,s.style);if(!l&&!a)return;let i=!!a;if(l){for(const[o,d]of Object.entries(l))if(o!=="children"){if(o==="style"){N(e,d);continue}if(o==="internal_transform"){e.internal_transform=d,i=!0;continue}if(o==="internal_cursor"){e.internal_cursor=d,i=!0;continue}if(o==="internal_static"){e.internal_static=!0,i=!0;continue}if(o==="sticky"){e.internal_sticky=d,i=!0;continue}if(o==="internalStickyAlternate"){e.internal_stickyAlternate=d,i=!0;continue}if(o==="opaque"){e.internal_opaque=d,i=!0;continue}if(o==="scrollbar"){e.internal_scrollbar=d,i=!0;continue}if(o==="internal_terminalCursorFocus"){e.internal_terminalCursorFocus=d,i=!0;continue}if(o==="internal_terminalCursorPosition"){e.internal_terminalCursorPosition=d,i=!0;continue}if(o==="cachedRender"){e.cachedRender=d,i=!0;continue}S(e,o,d),i=!0}}a&&e.yogaNode&&x(e.yogaNode,a,s.style??{}),i&&T(e)},createInstance(e,t,r,s){if(s.isInsideText&&e==="ink-box")throw new Error("<Box> can’t be nested inside <Text> component");if(s.isInsideText&&e==="ink-cursor")throw new Error("<Cursor> can’t be nested inside <Text> component");const l=e==="ink-text"&&s.isInsideText?"ink-virtual-text":e,a=W(l);for(const[i,o]of Object.entries(t))if(i!=="children"){if(i==="style"){N(a,o),a.yogaNode&&x(a.yogaNode,o);continue}if(i==="internal_transform"){a.internal_transform=o;continue}if(i==="internal_cursor"){a.internal_cursor=o;continue}if(i==="internal_static"){h=r,a.internal_static=!0,r.isStaticDirty=!0,r.staticNode=a;continue}if(i==="sticky"){a.internal_sticky=o;continue}if(i==="internalStickyAlternate"){a.internal_stickyAlternate=o;continue}if(i==="opaque"){a.internal_opaque=o;continue}if(i==="scrollbar"){a.internal_scrollbar=o;continue}if(i==="internal_terminalCursorFocus"){a.internal_terminalCursorFocus=o;continue}if(i==="internal_terminalCursorPosition"){a.internal_terminalCursorPosition=o;continue}if(i==="internal_static"){a.internal_static=!0;continue}if(i==="cachedRender"){a.cachedRender=o;continue}S(a,i,o)}return a},createTextInstance(e,t,r){if(!r.isInsideText)throw new Error(`Text string "${e}" must be rendered inside <Text> component`);return B(e)},detachDeletedInstance(){},finalizeInitialChildren(){return!1},getChildHostContext(e,t){const r=e.isInsideText,s=t==="ink-text"||t==="ink-virtual-text";return r===s?e:{isInsideText:s}},getCurrentUpdatePriority:c(()=>g,"getCurrentUpdatePriority"),getInstanceFromNode:c(()=>null,"getInstanceFromNode"),getInstanceFromScope:c(()=>null,"getInstanceFromScope"),getPublicInstance:c(e=>e,"getPublicInstance"),getRootHostContext:c(()=>({isInsideText:!1}),"getRootHostContext"),hideInstance(e){e.internal_hidden=!0,e.yogaNode?.setDisplay(n.DISPLAY_NONE),T(e)},hideTextInstance(e){_(e,"")},HostTransitionContext:G(null),insertBefore:I,insertInContainerBefore:I,isPrimaryRenderer:!0,maySuspendCommit(){return!0},noTimeout:-1,NotPendingTransition:void 0,now:m.unstable_now,preloadInstance(){return!0},prepareForCommit:c(()=>null,"prepareForCommit"),preparePortalMount:c(()=>null,"preparePortalMount"),prepareScopeUpdate(){},removeChild(e,t){C(e,t),y(t)},removeChildFromContainer(e,t){C(e,t),y(t)},rendererPackageName:f.name,rendererVersion:f.version,requestPostPaintCallback(){},resetAfterCommit(e){if(typeof e.onComputeLayout=="function"&&e.onComputeLayout(),k(e),e.staticNode!==e.previousStaticNode&&(e.previousStaticNode=e.staticNode,typeof e.onStaticChange=="function"&&e.onStaticChange()),e.isStaticDirty){e.isStaticDirty=!1,typeof e.onImmediateRender=="function"&&e.onImmediateRender();return}typeof e.onRender=="function"&&e.onRender()},resetFormInstance(){},resetTextContent(){},resolveEventTimeStamp(){return-1.1},resolveEventType(){return null},resolveUpdatePriority(){return g!==R?g:w},scheduleCallback:m.unstable_scheduleCallback,scheduleMicrotask:queueMicrotask,scheduleTimeout:setTimeout,setCurrentUpdatePriority(e){g=e},shouldAttemptEagerTransition(){return!1},shouldSetTextContent:c(()=>!1,"shouldSetTextContent"),shouldYield:m.unstable_shouldYield,startSuspendingCommit(){},supportsHydration:!1,supportsMicrotasks:!0,supportsMutation:!0,supportsPersistence:!1,suspendInstance(){},trackSchedulerEvent(){},unhideInstance(e){e.internal_hidden=!1,e.yogaNode?.setDisplay(n.DISPLAY_FLEX),T(e)},unhideTextInstance(e,t){_(e,t)},waitForCommitToBeReady(){return null}});export{ae as L,x as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var b=Object.defineProperty;var c=(e,t)=>b(e,"name",{value:t,configurable:!0});import{createContext as T}from"react";import I from"react-reconciler";import{NoEventPriority as v,DefaultEventPriority as x,DiscreteEventPriority as P}from"react-reconciler/constants.js";import{s as u}from"./index-COPEEDn3.js";import{LayoutNode as h}from"./LayoutNode-B0qeT8sl.js";import{applyStyles as g,resolveColor as C}from"./NAMED_COLORS-B9fJsYdg.js";import{a as k}from"./text-width-CI9G0a-z.js";var S=Object.defineProperty,n=c((e,t)=>S(e,"name",{value:t,configurable:!0}),"o");let p=null;function E(e){p=e}c(E,"setOnAfterCommit");n(E,"setOnAfterCommit");let m=v;function f(e){const t=C(e.fg===void 0?e.color===void 0?void 0:e.color:e.fg),o=C(e.bg===void 0?e.backgroundColor===void 0?void 0:e.backgroundColor:e.bg);let r;return e.styles===void 0?(r=0,e.bold&&(r|=1),(e.dim||e.dimColor)&&(r|=2),e.italic&&(r|=4),e.underline&&(r|=8),e.blink&&(r|=16),e.inverse&&(r|=32),e.hidden&&(r|=64),e.strikethrough&&(r|=128)):r=e.styles,{bg:o,fg:t,styles:r}}c(f,"m");n(f,"resolveNodeColors");const N={afterActiveInstanceBlur:n(()=>{},"afterActiveInstanceBlur"),appendChild(e,t){e.insertChild(t,e.children.length)},appendChildToContainer(e,t){e.insertChild(t,e.children.length)},appendInitialChild(e,t){e.insertChild(t,e.children.length)},beforeActiveInstanceBlur:n(()=>{},"beforeActiveInstanceBlur"),cancelCallback:u.unstable_cancelCallback,cancelTimeout:clearTimeout,clearContainer(e){},commitTextUpdate(e,t,o){e.text=o,e.yogaNode.markDirty()},commitUpdate(e,t,o,r,a){g(e.yogaNode,r);const{bg:i,fg:s,styles:d}=f(r);e.fg=s,e.bg=i,e.styles=d,e._style=r,e.transform=typeof r.transform=="function"?r.transform:void 0},createInstance(e,t,o,r,a){const i=new h,s={...t};s.flexDirection===void 0&&(s.flexDirection="row"),s.flexShrink===void 0&&(s.flexShrink=1),g(i.yogaNode,s);const{bg:d,fg:l,styles:y}=f(t);return i.fg=l,i.bg=d,i.styles=y,i._style=t,typeof t.transform=="function"&&(i.transform=t.transform),i},createTextInstance(e,t,o,r){const a=new h;return a.text=e,a.yogaNode.setWidth(k(e)),a.yogaNode.setHeight(1),a},detachDeletedInstance:n(e=>{e.destroy()},"detachDeletedInstance"),finalizeInitialChildren(e,t,o,r,a){return!1},getChildHostContext(e,t,o){return{isInsideText:t==="text"}},getCurrentEventPriority:n(()=>P,"getCurrentEventPriority"),getCurrentUpdatePriority:n(()=>m,"getCurrentUpdatePriority"),getInstanceFromNode:n(()=>null,"getInstanceFromNode"),getPublicInstance(e){return e},getRootHostContext(e){return{isInsideText:!1}},hideInstance(e){e._hidden=!0},hideTextInstance(e){e._hidden=!0},HostTransitionContext:T(null),insertBefore(e,t,o){t.parent&&t.remove();const r=e.children.indexOf(o);e.insertChild(t,r)},isPrimaryRenderer:!0,maySuspendCommit:n(()=>!0,"maySuspendCommit"),noTimeout:-1,NotPendingTransition:void 0,now:u.unstable_now,preloadInstance:n(()=>!0,"preloadInstance"),prepareForCommit(e){return null},preparePortalMount:n(()=>{},"preparePortalMount"),prepareScopeUpdate:n(()=>{},"prepareScopeUpdate"),prepareUpdate(e,t,o,r,a,i){const s=Object.keys(o).filter(l=>l!=="children"),d=Object.keys(r).filter(l=>l!=="children");if(s.length!==d.length)return!0;for(const l of d)if(o[l]!==r[l])return!0;return null},removeChild(e,t){t.remove()},removeChildFromContainer(e,t){t.remove()},requestPostPaintCallback:n(()=>{},"requestPostPaintCallback"),resetAfterCommit(e){typeof p=="function"&&p()},resolveEventTimeStamp:n(()=>-1.1,"resolveEventTimeStamp"),resolveEventType:n(()=>null,"resolveEventType"),resolveUpdatePriority(){return m!==v?m:x},scheduleCallback:u.unstable_scheduleCallback,scheduleMicrotask:queueMicrotask,scheduleTimeout:setTimeout,setCurrentUpdatePriority(e){m=e},shouldAttemptEagerTransition:n(()=>!1,"shouldAttemptEagerTransition"),shouldSetTextContent(e,t){return!1},shouldYield:u.unstable_shouldYield,startSuspendingCommit:n(()=>{},"startSuspendingCommit"),supportsHydration:!1,supportsMicrotasks:!0,supportsMutation:!0,supportsPersistence:!1,suspendInstance:n(()=>{},"suspendInstance"),trackSchedulerEvent:n(()=>{},"trackSchedulerEvent"),unhideInstance(e,t){e._hidden=!1},unhideTextInstance(e,t){e._hidden=!1},waitForCommitToBeReady:n(()=>null,"waitForCommitToBeReady"),warnsIfNotActing:!0},O=I(N);export{O as T,E as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var W=Object.defineProperty;var v=(r,s)=>W(r,"name",{value:s,configurable:!0});import l from"react";import{FocusProvider as C,useFocusManager as z}from"./FocusContext-Xy0cwJpO.js";import{TuiContext as T,useInput as B}from"./TuiContext-BoJvG3NN.js";import{LayoutNode as b}from"./LayoutNode-
|
|
1
|
+
var W=Object.defineProperty;var v=(r,s)=>W(r,"name",{value:s,configurable:!0});import l from"react";import{FocusProvider as C,useFocusManager as z}from"./FocusContext-Xy0cwJpO.js";import{TuiContext as T,useInput as B}from"./TuiContext-BoJvG3NN.js";import{LayoutNode as b}from"./LayoutNode-B0qeT8sl.js";import{T as f,s as P}from"./reconciler-ClRKkLS4.js";import{renderTreeToBuffer as F}from"./renderTreeToBuffer-LnGZkEUX.js";import{TuiApp as j}from"./TuiApp-CxBtziW8.js";import{InputParser as H}from"./InputParser-BAqciKJ6.js";import{terminalSize as q}from"./Renderer-DJXooAsp.js";import{createInlineLoop as G}from"./createInlineLoop-D0JaKX9A.js";var M=Object.defineProperty,e=v((r,s)=>M(r,"name",{value:s,configurable:!0}),"e");const R=e(r=>l.createElement("box",r,r.children),"_Box"),ee=e(r=>l.createElement("text",r,r.children),"_Text"),te=e(()=>l.createElement(R,{flexGrow:1}),"_Spacer"),L=e(({children:r})=>{const{disableFocus:s,enableFocus:t,focusNext:c,focusPrevious:i}=z();return B((h,a)=>{a.tab&&!a.shift&&c(),a.tab&&a.shift&&i(),a.escape&&(s(),t())}),l.createElement(l.Fragment,null,r)},"TabHandler");function A(r,s){const t=new j,c=new H(process.stdin),i=new b,{height:h,width:a}=t.getSize();i.yogaNode.setWidth(a),i.yogaNode.setHeight(h);const p=f.createContainer(i,0,null,!1,null,"",o=>console.error(o),null),d=e(o=>l.createElement(T.Provider,{value:{app:t,input:c,writeStderr:e(u=>t.writeStderr(u),"writeStderr"),writeStdout:e(u=>t.writeStdout(u),"writeStdout")}},l.createElement(C,null,l.createElement(L,null,o))),"wrap");f.updateContainer(d(r),p,null,()=>{});const x=e((o,u)=>i.calculateLayout(o,u),"calcLayout"),S=e((o,u,_)=>F(i,o,u,_),"renderBuf"),g=e(()=>t.paintNow(x,S),"paintNow");let E=!1;P(()=>{E=!0});const m=Math.round(1e3/(s?.maxFps??60)),y=setInterval(()=>{E&&(E=!1,g())},m);let N;const n=new Promise(o=>{N=o}),w=e(()=>{clearInterval(y),f.updateContainer(null,p,null,()=>{}),i.destroy(),t.stop(),c.stop(),process.off("SIGWINCH",I),N()},"cleanup");c.on("exit",()=>{w(),process.exit(0)}),t.on("quit",()=>{w(),process.exit(0)}),c.start(),t.start();const I=e(()=>{const o=process.stdout.columns||80,u=process.stdout.rows||24;t.resize(o,u),i.yogaNode.setWidth(o),i.yogaNode.setHeight(u),t.emit("resize"),g()},"onSigwinch");return process.on("SIGWINCH",I),g(),{app:t,input:c,rerender(o){f.updateContainer(d(o),p,null,()=>{})},unmount(){w()},waitUntilExit(){return n}}}v(A,"render");e(A,"render");function O(r,s){const t=q(),c=s?.rows??10,{cols:i}=t,h=Math.min(c,t.rows),a=new H(process.stdin),p=new b;p.yogaNode.setWidth(i),p.yogaNode.setHeight(h);const d=[],x=[],S={quit:e(()=>m.stop(),"quit"),writeStderr:e(n=>x.push(n),"writeStderr"),writeStdout:e(n=>d.push(n),"writeStdout")},g=f.createContainer(p,0,null,!1,null,"",n=>console.error(n),null),E=e(n=>l.createElement(T.Provider,{value:{app:S,input:a,writeStderr:S.writeStderr,writeStdout:S.writeStdout}},l.createElement(C,null,l.createElement(L,null,n))),"wrap");f.updateContainer(E(r),g,null,()=>{}),P(()=>{});const m=G((n,w,I)=>{p.calculateLayout(w,I),F(p,n,w,I)},{...s,fps:s?.maxFps??s?.fps??60,rows:h});a.on("exit",()=>m.stop());let y;const N=new Promise(n=>{y=n});return process.on("exit",()=>{d.length>0&&process.stdout.write(d.join("")),x.length>0&&process.stderr.write(x.join("")),y()}),m.start(),a.start(),{unmount(){m.stop()},waitUntilExit(){return N}}}v(O,"renderInline");e(O,"renderInline");export{R as _Box,te as _Spacer,ee as _Text,A as render,O as renderInline};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var ii=Object.defineProperty;var b=(e,t)=>ii(e,"name",{value:t,configurable:!0});import{createRequire as ri}from"node:module";import{jsxs as W,jsx as $}from"react/jsx-runtime";import{a as ct,x as ui}from"./constants-D12jy2Zh-RSfxu1eM.js";import{r as vt,c as gt,F as kt,a as li,l as ci,b as di,z as wt,V as hi,N as Mt,h as fi,P as Q,d as J,e as pi,f as mi}from"./erase-DKKNxHZ_.js";import{c as vi,e as gi,k as bi}from"./dom-CW6KYzFK.js";import{ConcurrentRoot as yi,LegacyRoot as wi}from"react-reconciler/constants.js";import H from"yoga-layout";import{a as xi}from"./accessibility-context-DDyHTwmA.js";import{h as Se,e as $e,g as Ce,o as $i}from"./mode-BOIU4Roy.js";import{PureComponent as Ci,useState as Tt,useRef as M,useCallback as x,useEffect as Dt,useMemo as z}from"react";import{e as Ti}from"./animation-context-DW3p-vpk.js";import{t as Ri}from"./app-context-BVpKlG1z.js";import{o as Oi}from"./cursor-context-CFviBqPX.js";import{Box as U}from"../components/box.js";import{Text as j}from"../components/text.js";import{o as Ni}from"./focus-context-CsT69klR.js";import{t as ki}from"./stderr-context-BzEaUICS.js";import{e as Ii}from"./stdin-context-BTaaFagk.js";import{t as Li}from"./stdout-context-BnblEPez.js";import{A as Di,B as _i,r as Bi,R as Ai}from"./renderer-C2ycheBL.js";import{resolveFlags as Wi}from"./kittyFlags-C3rZLbcK.js";import{a as Mi}from"./measure-text-D-jVetsl.js";import{L as _,u as ji}from"./reconciler-CGhHgXXG.js";import{measureAndExtractObservers as Ui}from"./ResizeObserverEntry-Dq0dk8Kq.js";import{calculateScroll as Hi}from"./getScrollHeight-ClEOyLHH.js";import{g as rt}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 si=ri(import.meta.url),ot=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,yt=b(e=>{if(typeof ot<"u"&&ot.versions&&ot.versions.node){const[t,i]=ot.versions.node.split(".").map(Number);if(t>22||t===22&&i>=3||t===20&&i>=16)return ot.getBuiltinModule(e)}return si(e)},"__cjs_getBuiltinModule"),B=ot,{env:Lt,cwd:ni}=B,{PassThrough:ue,Stream:oi}=yt("node:stream"),{Buffer:le}=yt("node:buffer"),{Console:ai}=yt("node:console"),{EventEmitter:Si}=yt("node:events"),{existsSync:Ei,readFileSync:Pi}=yt("node:fs");var Gi=Object.defineProperty,Ki=b((e,t)=>Gi(e,"name",{value:t,configurable:!0}),"r$3"),Fi=Object.defineProperty,qi=Ki((e,t)=>Fi(e,"name",{value:t,configurable:!0}),"t"),Yi=Object.defineProperty,Te=qi((e,t)=>Yi(e,"name",{value:t,configurable:!0}),"t");const Re=`${ct}?1049h`,Oe=`${ct}?1049l`;Te(()=>Re,"alternativeScreenOn");Te(()=>Oe,"alternativeScreenOff");kt(0,0)+vt(gt.ToEnd);`${li(ci.EntireLine)}${ct}`;const zi=`${ct}H${vt(gt.EntireScreen)}`;di?`${vt(gt.EntireScreen)}${ct}`:`${vt(gt.EntireScreen)}${vt(gt.EntireScreenAndScrollback)}${ct}${ui}`;var Vi=Object.defineProperty,Ji=b((e,t)=>Vi(e,"name",{value:t,configurable:!0}),"t$3");const ce=Ji(e=>e in Lt&&Lt[e]!=="0"&&Lt[e]!=="false","check"),Ee=ce("CI")||ce("CONTINUOUS_INTEGRATION");var Qi=Object.defineProperty,Xi=b((e,t)=>Qi(e,"name",{value:t,configurable:!0}),"s$1");const de=["assert","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"];let _t={};const Zi=Xi(e=>{const t=new ue,i=new ue;t.write=s=>{e("stdout",s)},i.write=s=>{e("stderr",s)};const r=new console.Console(t,i);for(const s of de)_t[s]=console[s],console[s]=r[s];return()=>{for(const s of de)console[s]=_t[s];_t={}}},"patchConsole"),ut=[];ut.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&ut.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&ut.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var tr=Object.defineProperty,dt=b((e,t)=>tr(e,"name",{value:t,configurable:!0}),"r$2");const Ot=dt(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"),Bt=Symbol.for("signal-exit emitter"),At=globalThis,er=Object.defineProperty.bind(Object);let ir=class{static{b(this,"y")}static{dt(this,"Emitter")}emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(At[Bt])return At[Bt];er(At,Bt,{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 n of this.listeners[t])s=n(i,r)===!0||s;return t==="exit"&&(s=this.emit("afterExit",i,r)||s),s}},Pe=class{static{b(this,"c")}static{dt(this,"SignalExitBase")}};const rr=dt(e=>({onExit(t,i){return e.onExit(t,i)},load(){return e.load()},unload(){return e.unload()}}),"signalExitWrap");class sr extends Pe{static{b(this,"_")}static{dt(this,"SignalExitFallback")}onExit(){return()=>{}}load(){}unload(){}}let nr=class extends Pe{static{b(this,"p")}static{dt(this,"SignalExit")}#o=jt.platform==="win32"?"SIGINT":"SIGHUP";#e=new ir;#t;#s;#n;#r={};#i=!1;constructor(t){super(),this.#t=t,this.#r={};for(const i of ut)this.#r[i]=()=>{const r=this.#t.listeners(i);let{count:s}=this.#e;const n=t;if(typeof n.__signal_exit_emitter__=="object"&&typeof n.__signal_exit_emitter__.count=="number"&&(s+=n.__signal_exit_emitter__.count),r.length===s){this.unload();const o=this.#e.emit("exit",null,i),u=i==="SIGHUP"?this.#o:i;o||t.kill(t.pid,u)}};this.#n=t.reallyExit,this.#s=t.emit}onExit(t,i){if(!Ot(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 ut)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,ut.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 Ot(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"&&Ot(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 jt=globalThis.process,{onExit:or}=rr(Ot(jt)?new nr(jt):new sr);var ar=Object.defineProperty,L=b((e,t)=>ar(e,"name",{value:t,configurable:!0}),"i$3");const Ne="\x1B[200~",he="\x1B[201~",ur=L(e=>e>=48&&e<=63,"isCsiParameterByte"),lr=L(e=>e>=32&&e<=47,"isCsiIntermediateByte"),ke=L(e=>e>=64&&e<=126,"isCsiFinalByte"),cr=L((e,t,i)=>{const r=t+i+1;let s=r;for(;s<e.length;s++){const n=e.codePointAt(s);if(n===void 0)return"pending";if(!(ur(n)||lr(n))&&!(n===91&&s===r))return ke(n)?{nextIndex:s+1,sequence:e.slice(t,s+1)}:void 0}return"pending"},"parseCsiSequence"),dr=L((e,t,i)=>{const r=t+i+2;if(r>e.length)return"pending";const s=e.codePointAt(r-1);if(!(s===void 0||!ke(s)))return{nextIndex:r,sequence:e.slice(t,r)}},"parseSs3Sequence"),fe=L((e,t,i)=>{const r=e[t+i];if(r===void 0)return"pending";if(r==="[")return cr(e,t,i);if(r==="O")return dr(e,t,i)},"parseControlSequence"),hr=L((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"),fr=L((e,t)=>{if(t===e.length-1)return"pending";if(e[t+1]==="\x1B"){if(t+2>=e.length)return"pending";const r=fe(e,t,2);return r==="pending"?"pending":r||{nextIndex:t+2,sequence:e.slice(t,t+2)}}const i=fe(e,t,1);return i==="pending"?"pending":i||hr(e,t)},"parseEscapeSequence"),pe=L((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"),pr=L(e=>{const t=[];let i=0;const r=L(s=>({events:t,pending:e.slice(s)}),"pendingFrom");for(;i<e.length;){const s=e.indexOf("\x1B",i);if(s===-1)return pe(e.slice(i),t),{events:t,pending:""};s>i&&pe(e.slice(i,s),t);const n=fr(e,s);if(n==="pending")return r(s);if(n.sequence===Ne){const o=n.nextIndex,u=e.indexOf(he,o);if(u===-1)return r(s);t.push({paste:e.slice(o,u)}),i=u+he.length;continue}t.push(n.sequence),i=n.nextIndex}return{events:t,pending:""}},"parseKeypresses"),mr=L(()=>{let e="";return{flushPendingEscape(){if(!e.startsWith("\x1B"))return;const t=e;return e="",t},hasPendingEscape(){return e.startsWith("\x1B")&&!e.startsWith(Ne)&&e!=="\x1B[200"},push(t){const i=pr(e+t);return e=i.pending,i.events},reset(){e=""}}},"createInputParser");var vr=Object.defineProperty,gr=b((e,t)=>vr(e,"name",{value:t,configurable:!0}),"x$1"),br=Object.defineProperty,yr=gr((e,t)=>br(e,"name",{value:t,configurable:!0}),"x"),wr=Object.defineProperty,G=yr((e,t)=>wr(e,"name",{value:t,configurable:!0}),"u");const X=G((e,...t)=>{process.env.DEBUG&&process.env.DEBUG==="true"&&console.debug(`error:parse-stacktrace: ${e}`,...t)},"debugLog"),Z="<unknown>",xr=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Sr=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,$r=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,Cr=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,Tr=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,Rr=/in\s(.*)\s\(at\s(.+)\)\sat/,Or=/^(?:.*@)?(.*):(\d+):(\d+)$/,Er=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Pr=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Nr=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,me=/\(error: (.*)\)/,kr=/at\s/,Ir=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,Lr=/\S*(?:Error: |AggregateError:)/,Ie=/^Anonymous function$/,Dr=/^\s*in\s.*/,_r=/^.*?\s*at\s.*/,Br=/^.*?\s*@.*|\[native code\]/,Le=G((e,t)=>{const i=e.includes("safari-extension"),r=e.includes("safari-web-extension");return i||r?[e.includes("@")?e.split("@")[0]:Z,i?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},"extractSafariExtensionDetails"),De=G((e,t)=>{const i=$r.exec(t);i&&(e.file=i[1],e.line=+i[2],e.column=+i[3])},"parseMapped"),Ar=G(e=>{const t=Rr.exec(e);if(t){X(`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]??Z,raw:e,type:void 0}}const i=Tr.exec(e);if(i){X(`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(kr,""):void 0,line:i[3]?+i[3]:void 0,methodName:i[1]??Z,raw:e,type:e.startsWith("internal")?"internal":void 0};return De(r,`${i[2]}:${i[3]}:${i[4]}`),r}},"parseNode"),Wr=G(e=>{const t=xr.exec(e);if(t){X(`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,n;if(r){const l=Sr.exec(e);if(l){const f=Ir.exec(l[1]);f?(t[2]=f[4]??f[1],t[3]=f[5]??f[2],t[4]=f[3]):l[2]&&(t[2]=l[1]),l[2]&&(s={column:l[4]?+l[4]:void 0,file:l[2],line:l[3]?+l[3]:void 0,methodName:"eval",raw:e,type:"eval"})}else{const f=Cr.exec(e);f&&(n={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[o,u]=Le(t[1]?t[1].replace(Ie,"<anonymous>"):Z,t[2]),a={column:t[4]?+t[4]:void 0,evalOrigin:s,file:u,line:t[3]?+t[3]:void 0,methodName:o,raw:e,type:r?"eval":i?"native":void 0};return n?(a.column=n.column,a.file=n.file,a.line=n.line):De(a,`${u}:${t[3]}:${t[4]}`),a}},"parseChromium"),Mr=G((e,t)=>{const i=Er.exec(e);if(i){X(`parse gecko error stack line: "${e}"`,`found: ${JSON.stringify(i)}`);const r=i[3]?.includes(" > eval"),s=r&&i[3]&&Pr.exec(i[3]);let n;r&&s&&(i[3]=s[1],n={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[o,u]=Le(i[1]?i[1].replace(Ie,"<anonymous>"):Z,i[3]);let a;(t?.type==="safari"||!r&&t?.type==="firefox")&&t.column?a=t.column:!r&&i[5]&&(a=+i[5]);let l;return(t?.type==="safari"||!r&&t?.type==="firefox")&&t.line?l=t.line:i[4]&&(l=+i[4]),{column:a,evalOrigin:n,file:u,line:l,methodName:o,raw:e,type:r?"eval":u.includes("[native code]")?"native":void 0}}},"parseGecko"),jr=G((e,t)=>{const i=Nr.exec(e);if(!(i&&i[2].includes(" > eval"))&&i)return X(`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]||Z,raw:e,type:void 0}},"parseFirefox"),Ur=G(e=>{const t=Or.exec(e);if(t)return X(`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:Z,raw:e,type:void 0}},"parseReactAndroidNative"),Hr=G((e,{filter:t,frameLimit:i=50}={})=>{const r=e;let s=(typeof r.stacktrace=="string"?r.stacktrace:e.stack??"").split(`
|
|
4
|
+
`).map(n=>(me.test(n)?n.replace(me,"$1"):n).trim()).filter(n=>!Lr.test(n)&&n!=="eval code");return t&&(s=s.filter(n=>t(n))),s=s.slice(0,i),s.reduce((n,o,u)=>{if(!o||o.length>1024)return n;let a;if(Dr.test(o))a=Ar(o);else if(_r.test(o))a=Wr(o);else if(Br.test(o)){let l;if(u===0){const f=e,S=f.columnNumber,v=f.lineNumber,d=f.line,h=f.column;S||v?l={column:S,line:v,type:"firefox"}:(d||h)&&(l={column:h,line:d,type:"safari"})}a=jr(o,l)??Mr(o,l)}else a=Ur(o);return a?n.push(a):X(`parse error stack line: "${o}"`,"not parser found"),n},[])},"parseStacktrace");var Gr=Object.defineProperty,Kr=b((e,t)=>Gr(e,"name",{value:t,configurable:!0}),"r$1");const Fr=Kr((e,t=2)=>e.replace(/^\t+/gm,i=>" ".repeat(i.length*t)),"convertToSpaces");var qr=Object.defineProperty,_e=b((e,t)=>qr(e,"name",{value:t,configurable:!0}),"i$2");const Yr=_e((e,t)=>{const i=[],r=e-t,s=e+t;for(let n=r;n<=s;n++)i.push(n);return i},"generateLineNumbers"),zr=_e((e,t,i={})=>{var r;if(typeof e!="string")throw new TypeError("Source code is missing.");if(!t||t<1)throw new TypeError("Line number must start from `1`.");const s=Fr(e).split(/\r?\n/);if(!(t>s.length))return Yr(t,(r=i.around)!==null&&r!==void 0?r:3).filter(n=>s[n-1]!==void 0).map(n=>({line:n,value:s[n-1]}))},"codeExcerpt");var Vr=Object.defineProperty,Be=b((e,t)=>Vr(e,"name",{value:t,configurable:!0}),"x");const ve=Be(e=>{if(!e)return e;const t=ni();return e.replace(`file://${t}/`,"").replace(`${t}/`,"")},"cleanupPath");function Ae({error:e}){const t=Hr(e),i=t[0],r=ve(i?.file);let s,n=0;if(r&&i?.line&&Ei(r)){const o=Pi(r,"utf8");if(s=zr(o,i.line),s)for(const{line:u}of s)n=Math.max(n,String(u).length)}return W(U,{flexDirection:"column",padding:1,children:[W(U,{children:[W(j,{backgroundColor:"red",color:"white",children:[" ","ERROR"," "]}),W(j,{children:[" ",e.message]})]}),i&&r?$(U,{marginTop:1,children:W(j,{dimColor:!0,children:[r,":",i.line,":",i.column]})}):null,i&&s?$(U,{flexDirection:"column",marginTop:1,children:s.map(({line:o,value:u},a)=>W(U,{children:[$(U,{width:n+1,children:W(j,{"aria-label":o===i.line?`Line ${o}, error`:`Line ${o}`,backgroundColor:o===i.line?"red":void 0,color:o===i.line?"white":void 0,dimColor:o!==i.line,children:[String(o).padStart(n," "),":"]})}),$(j,{backgroundColor:o===i.line?"red":void 0,color:o===i.line?"white":void 0,children:` ${u}`})]},a))}):null,t.length>0?$(U,{flexDirection:"column",marginTop:1,children:t.map((o,u)=>{const a=ve(o.file)??"";return!o.methodName&&!o.file?W(U,{children:[$(j,{dimColor:!0,children:"- "}),$(j,{bold:!0,dimColor:!0,children:o.raw})]},u):W(U,{children:[$(j,{dimColor:!0,children:"- "}),$(j,{bold:!0,dimColor:!0,children:o.methodName??"<anonymous>"}),W(j,{"aria-label":`at ${a} line ${o.line} column ${o.column}`,color:"gray",dimColor:!0,children:[" ","(",a,":",o.line,":",o.column,")"]})]},u)})}):null]})}b(Ae,"B$1");Be(Ae,"ErrorOverview");var Jr=Object.defineProperty,Qr=b((e,t)=>Jr(e,"name",{value:t,configurable:!0}),"o$1");let Xr=class extends Ci{static{b(this,"i")}static{Qr(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?$(Ae,{error:this.state.error}):this.props.children}};var Zr=Object.defineProperty,ge=b((e,t)=>Zr(e,"name",{value:t,configurable:!0}),"J");const ts=" ",es="\x1B[Z",is="\x1B",rs=Se($e),be=Ce($e),We=ge(({children:e,exitOnCtrlC:t,interactive:i,onExit:r,onWaitUntilRenderFlush:s,renderThrottleMs:n,setCursorPosition:o,stderr:u,stdin:a,stdout:l,writeToStderr:f,writeToStdout:S})=>{const[v,d]=Tt(!0),[h,y]=Tt(void 0),[,w]=Tt([]),k=M(0),T=M(new Map),D=M(void 0),I=M(0),A=M(!1),P=M(0),[E]=Tt(()=>{const c=new Si;return c.setMaxListeners(1/0),c}),Y=M(void 0),O=M(void 0);O.current??=mr();const K=M(void 0),Ft=M(!1),qe=20,tt=x(()=>{K.current&&(clearTimeout(K.current),K.current=void 0)},[]),et=x(()=>{D.current&&(clearTimeout(D.current),D.current=void 0)},[]),xt=x(()=>{if(et(),T.current.size===0)return;let c=Number.POSITIVE_INFINITY;for(const p of T.current.values())c=Math.min(c,p.nextDueTime);const m=Math.max(0,c-performance.now());D.current=setTimeout(()=>{D.current=void 0;const p=performance.now(),C=[...T.current.values()];for(const N of C){if(p<N.nextDueTime)continue;N.callback(p);const ti=p-N.startTime,ei=Math.floor(ti/N.interval)+1;N.nextDueTime=N.startTime+ei*N.interval}xt()},m)},[et]),qt=x((c,m)=>{const p=performance.now();return T.current.set(c,{callback:c,interval:m,nextDueTime:p+m,startTime:p}),xt(),{startTime:p,unsubscribe(){if(T.current.delete(c),T.current.size===0){et();return}xt()}}},[et,xt]);Dt(()=>()=>{et()},[et]);const F=a.isTTY,Yt=x(()=>{Y.current&&(a.removeListener("readable",Y.current),Y.current=void 0)},[a]),St=x(()=>{O.current?.reset(),tt(),Yt()},[tt,Yt]),it=x(()=>{A.current=!1,a.setRawMode(!1),a.unref(),I.current=0,St()},[a,St]),ft=x(c=>{F&&(I.current>0||A.current)&&it(),r(c)},[F,it,r]),zt=x(c=>{if(c.includes("")&&t){ft();return}c===is&&v&&y(m=>{if(!m)return m})},[t,ft,v]),pt=x(c=>{zt(c),E.emit("input",c)},[zt,E]),Vt=x(()=>{tt(),K.current=setTimeout(()=>{K.current=void 0;const c=O.current.flushPendingEscape();c&&pt(c)},qe)},[tt,pt]),It=x(()=>{tt();let c;for(;(c=a.read())!==null;){const m=O.current.push(c);for(const p of m)if(typeof p=="string")pt(p);else{if(E.listenerCount("paste")===0){Ft.current||(Ft.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
|
+
`)),pt(p.paste);continue}E.emit("paste",p.paste)}}O.current.hasPendingEscape()&&Vt()},[a,pt,tt,Vt,f,E]),Jt=x(()=>{Y.current||(Y.current=It,a.addListener("readable",It))},[a,It]),Qt=x(c=>{if(!F)throw a===B.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(a.setEncoding("utf8"),c){if(I.current===0){const m=A.current;A.current=!1,m||(a.ref(),a.setRawMode(!0)),Jt()}I.current++;return}I.current!==0&&--I.current===0&&(St(),A.current=!0,queueMicrotask(()=>{A.current&&it()}))},[F,a,Jt,St,it]),Xt=x(c=>{if(l.isTTY){if(c){P.current===0&&l.write(rs),P.current++;return}P.current!==0&&--P.current===0&&l.write(be)}},[l]),Zt=x((c,m)=>{const p=c.findIndex(C=>C.id===m);for(let C=p+1;C<c.length;C++){const N=c[C];if(N?.isActive)return N.id}},[]),te=x((c,m)=>{const p=c.findIndex(C=>C.id===m);for(let C=p-1;C>=0;C--){const N=c[C];if(N?.isActive)return N.id}},[]),$t=x(()=>{w(c=>(y(m=>{const p=c.find(C=>C.isActive)?.id;return Zt(c,m)??p}),c))},[Zt]),Ct=x(()=>{w(c=>(y(m=>{const p=c.findLast(C=>C.isActive)?.id;return te(c,m)??p}),c))},[te]);Dt(()=>{const c=ge(p=>{!v||k.current===0||(p===ts&&$t(),p===es&&Ct())},"handleTabNavigation");E.on("input",c);const m=E;return()=>{m.off("input",c)}},[v,$t,Ct,E]);const ee=x(()=>{d(!0)},[]),ie=x(()=>{d(!1)},[]),re=x(c=>{w(m=>(m.some(p=>p?.id===c)&&y(c),m))},[]),se=x((c,{autoFocus:m})=>{w(p=>(k.current=p.length+1,[...p,{id:c,isActive:!0}])),m&&y(p=>p||c)},[]),ne=x(c=>{y(m=>{if(m!==c)return m}),w(m=>{const p=m.filter(C=>C.id!==c);return k.current=p.length,p})},[]),oe=x(c=>{w(m=>m.map(p=>p.id!==c?p:{id:c,isActive:!0}))},[]),ae=x(c=>{y(m=>{if(m!==c)return m}),w(m=>m.map(p=>p.id!==c?p:{id:c,isActive:!1}))},[]);Dt(()=>()=>{const c=!l.destroyed&&!l.writableEnded;i&&c&&l.write(wt),F&&(I.current>0||A.current)&&it(),P.current>0&&(l.isTTY&&c&&l.write(be),P.current=0)},[l,F,it,i]);const Ye=z(()=>({exit:ft,waitUntilRenderFlush:s}),[ft,s]),ze=z(()=>({internal_eventEmitter:E,internal_exitOnCtrlC:t,isRawModeSupported:F,setBracketedPasteMode:Xt,setRawMode:Qt,stdin:a}),[a,Qt,Xt,F,t,E]),Ve=z(()=>({stdout:l,write:S}),[l,S]),Je=z(()=>({stderr:u,write:f}),[u,f]),Qe=z(()=>({setCursorPosition:o}),[o]),Xe=z(()=>({activate:oe,activeId:h,add:se,deactivate:ae,disableFocus:ie,enableFocus:ee,focus:re,focusNext:$t,focusPrevious:Ct,remove:ne}),[h,se,ne,oe,ae,ee,ie,$t,Ct,re]),Ze=z(()=>({renderThrottleMs:n,subscribe:qt}),[qt,n]);return $(Ri.Provider,{value:Ye,children:$(Ii.Provider,{value:ze,children:$(Li.Provider,{value:Ve,children:$(ki.Provider,{value:Je,children:$(Ni.Provider,{value:Xe,children:$(Ti.Provider,{value:Ze,children:$(Oi.Provider,{value:Qe,children:$(Xr,{onError:ft,children:e})})})})})})})})},"App");We.displayName="InternalApp";var ss=Object.defineProperty,ns=b((e,t)=>ss(e,"name",{value:t,configurable:!0}),"m$2");const os=ns((e,t,i)=>{if(i<=0||!e.yogaNode)return"";const{yogaNode:r}=e,s=r.getComputedBorder(H.EDGE_LEFT),n=r.getComputedBorder(H.EDGE_RIGHT),o=r.getComputedBorder(H.EDGE_TOP),u=r.getComputedPadding(H.EDGE_LEFT),a=r.getComputedPadding(H.EDGE_RIGHT),l=r.getComputedPadding(H.EDGE_TOP),f=Math.round(r.getComputedWidth()-s-n-u-a);if(f<=0)return"";const S=new Di({height:i,width:f}),v=-(e.internal_scrollState?.scrollLeft??0)-s-u,d=-t-o-l;for(const h of e.childNodes)_i(h,S,{absoluteOffsetX:v,absoluteOffsetY:d,offsetX:v,offsetY:d,skipStaticElements:!1});return S.get().output},"composeBackbufferSlice"),Ut=new WeakMap;var as=Object.defineProperty,ht=b((e,t)=>as(e,"name",{value:t,configurable:!0}),"e");const us={bar:6,"blinking-bar":5,"blinking-block":1,"blinking-underline":3,block:2,default:0,underline:4},ye=ht(e=>hi(us[e]),"buildCursorShapeSequence"),Et=ht((e,t)=>e?.x!==t?.x||e?.y!==t?.y,"cursorPositionChanged"),lt=ht((e,t)=>{if(!t)return"";const i=e-t.y;return(i>0?Mt(i):"")+kt(t.x)+wt},"buildCursorSuffix"),Me=ht((e,t)=>{if(!t)return"";const i=e-1-t.y;return(i>0?fi(i):"")+kt(0)},"buildReturnToBottom"),je=ht(e=>{const t=e.cursorWasShown?Q:"",i=Me(e.previousLineCount,e.previousCursorPosition),r=lt(e.visibleLineCount,e.cursorPosition);return t+i+r},"buildCursorOnlySequence"),Pt=ht((e,t,i)=>e?Q+Me(t,i):"","buildReturnToBottomPrefix");var ls=Object.defineProperty,R=b((e,t)=>ls(e,"name",{value:t,configurable:!0}),"l");const st=R(e=>e??"default","normalizeShape"),Ue=R(()=>{let e,t;return{consumeDelta:R(()=>{if(st(t)===st(e))return"";const i=st(t);return e=t,ye(i)},"consumeDelta"),consumeRestoreOnDone:R(()=>{const i=st(e)!=="default";return e=void 0,t=void 0,i?ye("default"):""},"consumeRestoreOnDone"),isDirty:R(()=>st(t)!==st(e),"isDirty"),setPending:R(i=>{t=i},"setPending")}},"createCursorShapeTracker"),bt=R((e,t)=>t.endsWith(`
|
|
8
|
+
`)?e.length-1:e.length,"visibleLineCount"),He=R(e=>e.rows||1/0,"getViewportRows"),Nt=R((e,t)=>Math.min(e,He(t)),"clampToViewport"),cs=R((e,{showCursor:t=!1}={})=>{let i=0,r="",s=!1,n,o=!1,u,a=!1;const l=Ue(),f=R(()=>o?n:void 0,"getActiveCursor"),S=R((d,h)=>{const y=Et(h,u);return d!==r||y||l.isDirty()},"hasChanges"),v=R(d=>{!t&&!s&&(e.write(Q),s=!0);const h=f();o=!1;const y=Et(h,u);if(!S(d,h))return!1;const w=l.consumeDelta(),k=d.split(`
|
|
9
|
+
`),T=bt(k,d),D=lt(T,h);if(d===r&&y)e.write(w+je({cursorPosition:h,cursorWasShown:a,previousCursorPosition:u,previousLineCount:i,visibleLineCount:T}));else if(d===r&&w!=="")e.write(w);else{r=d;const I=Pt(a,i,u);e.write(w+I+J(Nt(i,e))+d+D),i=k.length}return u=h?{...h}:void 0,a=h!==void 0,!0},"render");return v.clear=()=>{const d=Pt(a,i,u);e.write(d+J(Nt(i,e))),r="",i=0,u=void 0,a=!1},v.done=()=>{r="",i=0,u=void 0,a=!1;const d=l.consumeRestoreOnDone();d!==""&&e.write(d),t||(e.write(wt),s=!1)},v.reset=()=>{r="",i=0,u=void 0,a=!1},v.sync=d=>{const h=o?n:void 0;o=!1;const y=d.split(`
|
|
10
|
+
`);r=d,i=y.length;const w=l.consumeDelta();w!==""&&e.write(w),!h&&a&&e.write(Q),h&&e.write(lt(bt(y,d),h)),u=h?{...h}:void 0,a=h!==void 0},v.setCursorPosition=d=>{n=d,o=!0},v.setCursorShape=l.setPending,v.isCursorDirty=()=>o||l.isDirty(),v.willRender=d=>S(d,f()),v},"createStandard"),ds=R((e,{showCursor:t=!1}={})=>{let i=[],r="",s=!1,n,o=!1,u,a=!1;const l=Ue(),f=R(()=>o?n:void 0,"getActiveCursor"),S=R((d,h)=>{const y=Et(h,u);return d!==r||y||l.isDirty()},"hasChanges"),v=R(d=>{!t&&!s&&(e.write(Q),s=!0);const h=f();o=!1;const y=Et(h,u);if(!S(d,h))return!1;const w=l.consumeDelta(),k=d.split(`
|
|
11
|
+
`),T=bt(k,d),D=bt(i,r);if(d===r&&y)return e.write(w+je({cursorPosition:h,cursorWasShown:a,previousCursorPosition:u,previousLineCount:i.length,visibleLineCount:T})),u=h?{...h}:void 0,a=h!==void 0,!0;if(d===r&&w!=="")return e.write(w),!0;const I=Pt(a,i.length,u);if(d===`
|
|
12
|
+
`||r.length===0){const O=lt(T,h);return e.write(w+I+J(Nt(i.length,e))+d+O),a=h!==void 0,u=h?{...h}:void 0,r=d,i=k,!0}const A=d.endsWith(`
|
|
13
|
+
`),P=[w,I],E=He(e);if(T<D){const O=r.endsWith(`
|
|
14
|
+
`)?1:0;P.push(J(Math.min(D-T+O,E)),Mt(Math.min(T,E-1)))}else P.push(Mt(Math.min(D-1,E-1)));for(let O=0;O<T;O++){const K=O===T-1;if(k[O]===i[O]){(!K||A)&&P.push(pi());continue}P.push(kt(0)+k[O]+mi+(K&&!A?"":`
|
|
15
|
+
`))}const Y=lt(T,h);return P.push(Y),e.write(P.join("")),a=h!==void 0,u=h?{...h}:void 0,r=d,i=k,!0},"render");return v.clear=()=>{const d=Pt(a,i.length,u);e.write(d+J(Nt(i.length,e))),r="",i=[],u=void 0,a=!1},v.done=()=>{r="",i=[],u=void 0,a=!1;const d=l.consumeRestoreOnDone();d!==""&&e.write(d),t||(e.write(wt),s=!1)},v.reset=()=>{r="",i=[],u=void 0,a=!1},v.sync=d=>{const h=o?n:void 0;o=!1;const y=d.split(`
|
|
16
|
+
`);r=d,i=y;const w=l.consumeDelta();w!==""&&e.write(w),!h&&a&&e.write(Q),h&&e.write(lt(bt(y,d),h)),u=h?{...h}:void 0,a=h!==void 0},v.setCursorPosition=d=>{n=d,o=!0},v.setCursorShape=l.setPending,v.isCursorDirty=()=>o||l.isDirty(),v.willRender=d=>S(d,f()),v},"createIncremental"),hs=R((e,{incremental:t=!1,showCursor:i=!1}={})=>t?ds(e,{showCursor:i}):cs(e,{showCursor:i}),"create"),fs={create:hs};var ps=Object.defineProperty,ms=b((e,t)=>ps(e,"name",{value:t,configurable:!0}),"t");const Ge=$i(2026),V=Se(Ge),q=Ce(Ge);function Ke(e,t){return"isTTY"in e&&e.isTTY&&(t??!Ee)}b(Ke,"shouldSynchronize");ms(Ke,"shouldSynchronize");var vs=Object.defineProperty,Ht=b((e,t)=>vs(e,"name",{value:t,configurable:!0}),"o");let nt;const gs=Ht(()=>{if(nt!==!1){if(nt!==void 0)return nt;try{return nt=require("../../index.js").Renderer,nt}catch{nt=!1;return}}},"getRendererClass"),bs=Ht(e=>{const t=gs();if(!t)return;let i,r=0,s=0;const n=Ht((o,u)=>{(!i||r!==o||s!==u)&&(i?i.resize(o,u):i=new t(o,u),r=o,s=u)},"ensureRenderer");return{clear(){if(i){const o=new Uint32Array(r*s*2),u=65535;for(let a=0;a<o.length;a+=2)o[a]=32,o[a+1]=u;i.render(o)}},destroy(){i=void 0},render(o,u,a){if(n(u,a),!!i){e.isTTY&&i.writeRaw(V);try{i.render(o)}finally{e.isTTY&&i.writeRaw(q)}}},resize(o,u){n(o,u)}}},"createNative");var ys=Object.defineProperty,at=b((e,t)=>ys(e,"name",{value:t,configurable:!0}),"n$1");function Gt(e,t=0,i={}){const r=i.leading??!0,s=i.trailing??!0;let n,o,u,a;const l=at(()=>{if(o===void 0)return;const h=o;o=void 0,a=e(...h)},"invoke"),f=at(()=>{n!==void 0&&(clearTimeout(n),n=void 0)},"clearTimer"),S=at(()=>{n=void 0,s&&l(),o=void 0,u=void 0},"onTimerEnd"),v=at(()=>{f(),n=setTimeout(S,t)},"scheduleTimer"),d=at(function(...h){const y=Date.now();if(u??=y,y-u>=t)return o=h,l(),u=y,v(),a;o=h;const w=n===void 0;return v(),r&&w&&l(),a},"throttled");return d.cancel=()=>{f(),o=void 0,u=void 0},d.flush=()=>(f(),l(),u=void 0,a),d}b(Gt,"throttle");at(Gt,"throttle");var ws=Object.defineProperty,g=b((e,t)=>ws(e,"name",{value:t,configurable:!0}),"n");console.Console||(console.Console=ai);const mt=g(()=>{},"noop"),we=g(async()=>new Promise(e=>{setImmediate(e)}),"yieldImmediate"),xs=27,Ss=91,$s=63,Cs=117,Ts=48,Rs=57,Os=g(e=>e>=Ts&&e<=Rs,"isDigitByte"),Fe=g((e,t)=>{if(e[t]!==xs||e[t+1]!==Ss||e[t+2]!==$s)return;let i=t+3;const r=i;for(;i<e.length&&Os(e[i]);)i++;if(i!==r){if(i===e.length)return{state:"partial"};if(e[i]===Cs)return{endIndex:i,state:"complete"}}},"matchKittyQueryResponse"),Es=g(e=>{for(let t=0;t<e.length;t++)if(Fe(e,t)?.state==="complete")return!0;return!1},"hasCompleteKittyQueryResponse"),Ps=g(e=>{const t=[];let i=0;for(;i<e.length;){const r=Fe(e,i);if(r?.state==="complete"){i=r.endIndex+1;continue}if(r?.state==="partial")break;t.push(e[i]),i++}return t},"stripKittyQueryResponsesAndTrailingPartial"),Ns=g(({isTty:e,isUnmounting:t,nextOutputHeight:i,previousOutputHeight:r,viewportRows:s})=>{if(!e)return!1;const n=r>0,o=r>=s,u=r>s,a=i>s,l=o&&i<s;return u||a&&n||l||t&&o},"shouldClearTerminalForFrame"),Wt=g(e=>e instanceof Error||Object.prototype.toString.call(e)==="[object Error]","isErrorInput"),xe=g(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"),Rt=g((e,t)=>{if(!e||typeof e.flush!="function")return;const i=e;t?i.flush():typeof i.cancel=="function"&&i.cancel()},"settleThrottle");class ks{static{b(this,"yt")}static{g(this,"Ink")}isConcurrent;options;log;manualCursorPosition;renderedCursorPosition;renderedCursorRequested;throttledLog;isScreenReaderEnabled;interactive;renderThrottleMs;alternateScreen;isUnmounted;isUnmounting;lastOutput;lastOutputToRender;lastOutputHeight;lastTerminalWidth;nativeLog;useNativeRenderer;container;rootNode;fullStaticOutput;backbufferNode;backbufferMultiWarned=!1;exitPromise;exitResult;beforeExitHandler;restoreConsole;unsubscribeResize;throttledOnRender;hasPendingThrottledRender=!1;kittyProtocolEnabled=!1;cancelKittyDetection;nextRenderCommit;deferredInitDone=!1;constructor(t){this.options=t,this.rootNode=vi("ink-root"),this.rootNode.onComputeLayout=this.calculateLayout,this.isScreenReaderEnabled=t.isScreenReaderEnabled??B.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 n=i?this.onRender:(()=>{const u=Gt(this.onRender,s,{leading:!0,trailing:!0});return this.throttledOnRender=u,()=>{this.hasPendingThrottledRender=!0,u()}})();if(i&&(this.throttledOnRender=void 0),t.standardReactLayoutTiming){let u=!1;const a=g(()=>{u||(u=!0,queueMicrotask(()=>{u=!1,this.onRender()}))},"deferredRender");this.rootNode.onRender=a,this.rootNode.onImmediateRender=a}else this.rootNode.onRender=n,this.rootNode.onImmediateRender=this.onRender;this.rootNode.onStaticChange=this.handleStaticChange,this.log=fs.create(t.stdout,{incremental:t.incrementalRendering}),this.useNativeRenderer=t.useNativeRenderer??!1,this.useNativeRenderer&&(this.nativeLog=bs(t.stdout),this.nativeLog||(this.useNativeRenderer=!1)),this.manualCursorPosition=void 0,this.renderedCursorPosition=void 0,this.renderedCursorRequested=!1,this.throttledLog=i?this.log:Gt(u=>{const a=this.log.willRender(u),l=this.shouldSync();l&&a&&this.options.stdout.write(V),this.log(u),l&&a&&this.options.stdout.write(q)},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=rt(this.options.stdout).columns,this.fullStaticOutput="";const o=t.concurrent?yi:wi;this.container=_.createContainer(this.rootNode,o,null,!1,null,"id",()=>{},()=>{},()=>{},()=>{}),this.unsubscribeExit=or(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(),B.env.DEV==="true"&&_.injectIntoDevTools(),this.exitPromise=new Promise((u,a)=>{this.resolveExitPromise=u,this.rejectExitPromise=a}),this.exitPromise.catch(mt)}runDeferredInit(){this.deferredInitDone||(this.deferredInitDone=!0,this.initDeferredKittyKeyboard())}resized=g(()=>{const t=rt(this.options.stdout).columns;t<this.lastTerminalWidth&&(this.log.clear(),this.lastOutput="",this.lastOutputToRender=""),Mi(),this.calculateLayout(),gi(this.rootNode),this.onRender(),this.lastTerminalWidth=t},"resized");resolveExitPromise=g(()=>{},"resolveExitPromise");rejectExitPromise=g(()=>{},"rejectExitPromise");unsubscribeExit=g(()=>{},"unsubscribeExit");handleAppExit=g(t=>{if(!(this.isUnmounted||this.isUnmounting)){if(Wt(t)){this.unmount(t);return}this.exitResult=t,this.unmount()}},"handleAppExit");getActiveCursorPosition=g(()=>this.renderedCursorRequested?this.renderedCursorPosition:this.manualCursorPosition,"getActiveCursorPosition");setCursorPosition=g(t=>{this.manualCursorPosition=t,this.log.setCursorPosition(this.getActiveCursorPosition())},"setCursorPosition");restoreLastOutput=g(()=>{this.interactive&&(this.log.setCursorPosition(this.getActiveCursorPosition()),this.log(this.lastOutputToRender||`${this.lastOutput}
|
|
17
|
+
`))},"restoreLastOutput");calculateLayout=g(()=>{const t=g(r=>{const s=new Map;this.calculateScrollAndTriggerObservers(r,s);for(const[n,o]of s)n.internalTrigger(o)},"flushLayoutObservers");this.backbufferNode=void 0,this.prepareYogaTree(this.rootNode,t);const i=rt(this.options.stdout).columns;this.rootNode.yogaNode.setWidth(i),this.rootNode.yogaNode.calculateLayout(void 0,void 0,H.DIRECTION_LTR),t(this.rootNode)},"calculateLayout");calculateScrollAndTriggerObservers(t,i){if(t.nodeName==="ink-box"){const{style:r}=t,s=r.overflow??"visible",n=r.overflowX??s,o=r.overflowY??s;n==="scroll"||o==="scroll"?(Hi(t),r.overflowToBackbuffer&&(this.backbufferNode&&this.backbufferNode!==t&&!this.backbufferMultiWarned&&(this.backbufferMultiWarned=!0,console.warn("[@visulima/tui] Multiple scrollable regions have `overflowToBackbuffer` enabled; only one is supported. The last one in render order wins.")),this.backbufferNode=t)):t.internal_scrollState&&delete t.internal_scrollState}if(Ui(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(),ji(t.yogaNode,t.style);t.yogaNode.getChildCount()>0;)t.yogaNode.getChild(0).remove();let r=0;for(const s of t.childNodes){const n=s;s.nodeName!=="#text"&&n.yogaNode&&(t.yogaNode.insertChild(n.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=rt(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,H.DIRECTION_LTR)),i(t),Bi(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=g(()=>{this.fullStaticOutput=""},"handleStaticChange");computeBackbufferOutput(){const t=this.backbufferNode;if(!t?.internal_scrollState||!this.interactive||!this.options.stdout.isTTY||this.alternateScreen||this.isScreenReaderEnabled||this.options.debug)return"";const i=Math.round(t.internal_scrollState.scrollTop),r=t.yogaNode?.getComputedPadding(H.EDGE_TOP)??0,s=Math.max(0,i-Math.round(r)),n=t.internal_maxPushedScrollTop??0,{maxScrollbackLength:o}=t.style,u=o===void 0?n:Math.max(n,s-Math.max(0,o)),a=s-u;if(a<=0)return"";const l=os(t,u,a);return l===""?"":(t.internal_maxPushedScrollTop=s,`${l}\x1B[0m
|
|
18
|
+
`)}onRender=g(()=>{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,cursorShape:s,output:n,outputBuffer:o,outputHeight:u,outputWidth:a,staticOutput:l}=t;this.renderedCursorRequested=r,this.renderedCursorPosition=i,this.log.setCursorShape(r?s:void 0);const f=this.computeBackbufferOutput();if(this.useNativeRenderer&&this.nativeLog&&o&&a){l&&l!==`
|
|
19
|
+
`&&this.options.stdout.write(l),f&&this.options.stdout.write(f),this.nativeLog.render(o,a,u),this.lastOutputHeight=u;return}r&&this.log.setCursorPosition(this.getActiveCursorPosition());const S=l&&l!==`
|
|
20
|
+
`;if(this.options.debug){S&&(this.fullStaticOutput+=l),this.lastOutput=n,this.lastOutputToRender=n,this.lastOutputHeight=u,this.options.stdout.write(this.fullStaticOutput+n);return}if(!this.interactive){S&&this.options.stdout.write(l),this.lastOutput=n,this.lastOutputToRender=`${n}
|
|
21
|
+
`,this.lastOutputHeight=u;return}if(this.isScreenReaderEnabled){const v=this.shouldSync();if(v&&this.options.stdout.write(V),S){const y=this.lastOutputHeight>0?J(this.lastOutputHeight):"";this.options.stdout.write(y+l),this.lastOutputHeight=0}if(n===this.lastOutput&&!S){v&&this.options.stdout.write(q);return}const d=rt(this.options.stdout).columns,h=bi(n,{trim:!1,width:d,wrapMode:"BREAK_WORDS"}).replace(/\n$/,"");if(S)this.options.stdout.write(h);else{const y=this.lastOutputHeight>0?J(this.lastOutputHeight):"";this.options.stdout.write(y+h)}this.lastOutput=n,this.lastOutputToRender=h,this.lastOutputHeight=h===""?0:h.split(`
|
|
22
|
+
`).length,v&&this.options.stdout.write(q);return}S&&(this.fullStaticOutput+=l),this.renderInteractiveFrame(n,u,S?l:"",f)},"onRender");accessibilityContextValue;render(t){this.accessibilityContextValue??={isScreenReaderEnabled:this.isScreenReaderEnabled};const i=$(xi.Provider,{value:this.accessibilityContextValue,children:$(We,{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?_.updateContainer(i,this.container,null,mt):(_.updateContainerSync(i,this.container,null,mt),_.flushSyncWork())}writeToStdout=g(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(V),this.log.clear(),this.options.stdout.write(t),this.restoreLastOutput(),i&&this.options.stdout.write(q)},"writeToStdout");writeToStderr=g(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(V),this.log.clear(),this.options.stderr.write(t),this.restoreLastOutput(),i&&this.options.stdout.write(q)},"writeToStderr");unmount=g(t=>{if(this.isUnmounted||this.isUnmounting)return;this.isUnmounting=!0,this.beforeExitHandler&&(B.off("beforeExit",this.beforeExitHandler),this.beforeExitHandler=void 0);const i=this.options.stdout,{canWriteToStdout:r,hasWritableState:s}=xe(i);Rt(this.throttledOnRender,r),r&&!this.alternateScreen&&(!this.throttledOnRender||!this.hasPendingThrottledRender&&this.fullStaticOutput==="")&&(this.calculateLayout(),this.onRender()),this.isUnmounted=!0,this.unsubscribeExit(),Rt(this.throttledLog,r),typeof this.restoreConsole=="function"&&this.restoreConsole();const n=g(()=>{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,Oe),this.writeBestEffort(this.options.stdout,wt),this.alternateScreen=!1):this.interactive?this.options.debug||this.log.done():this.options.stdout.write(this.options.debug?`
|
|
23
|
+
`:`${this.lastOutput}
|
|
24
|
+
`)),this.kittyProtocolEnabled=!1,Ut.delete(this.options.stdout);const{exitResult:u}=this,a=g(()=>{Wt(t)?this.rejectExitPromise(t):this.resolveExitPromise(u)},"resolveOrReject");t!==void 0&&!Wt(t)?a():r&&s?this.options.stdout.write("",a):setImmediate(a)},"finishUnmount"),o=_;this.options.concurrent?(_.updateContainerSync(null,this.container,null,mt),_.flushSyncWork(),o.flushPassiveEffects?.(),n()):(_.updateContainerSync(null,this.container,null,mt),_.flushSyncWork(),n())},"unmount");async waitUntilExit(){return this.beforeExitHandler||(this.beforeExitHandler=()=>{this.unmount()},B.on("beforeExit",this.beforeExitHandler)),this.exitPromise}async waitUntilRenderFlush(){if(this.isUnmounted||this.isUnmounting){await this.awaitExit();return}if(await we(),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}_.flushSyncWork();const t=this.options.stdout,{canWriteToStdout:i,hasWritableState:r}=xe(t);if(Rt(this.throttledOnRender,i),Rt(this.throttledLog,i),i&&r){await new Promise(s=>{this.options.stdout.write("",()=>{s()})});return}await we()}clear(){this.interactive&&!this.options.debug&&(this.log.clear(),this.log.sync(this.lastOutputToRender||`${this.lastOutput}
|
|
25
|
+
`))}patchConsole(){this.options.debug||(this.restoreConsole=Zi((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,Re),this.writeBestEffort(this.options.stdout,Q))}resolveInteractiveOption(t){return t??(!Ee&&!!this.options.stdout.isTTY)}resolveAlternateScreenOption(t,i){return!!t&&i&&!!this.options.stdout.isTTY}shouldSync(){return Ke(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,s=""){const n=r+s,o=n!=="",u=this.options.stdout.isTTY,a=u?rt(this.options.stdout).rows:24,l=u&&i>=a?t:`${t}
|
|
26
|
+
`;if(Ns({isTty:u,isUnmounting:this.isUnmounting,nextOutputHeight:i,previousOutputHeight:this.lastOutputHeight,viewportRows:a})){if(this.options.incrementalRendering){o&&(this.log.clear(),this.options.stdout.write(n)),(t!==this.lastOutput||this.log.isCursorDirty()||o)&&this.throttledLog(l),this.lastOutput=t,this.lastOutputToRender=l,this.lastOutputHeight=i;return}const f=this.shouldSync();f&&this.options.stdout.write(V),this.options.stdout.write(zi+this.fullStaticOutput+s+t),this.lastOutput=t,this.lastOutputToRender=l,this.lastOutputHeight=i,this.log.sync(l),f&&this.options.stdout.write(q);return}if(o){const f=this.shouldSync();f&&this.options.stdout.write(V),this.log.clear(),this.options.stdout.write(n),this.log(l),f&&this.options.stdout.write(q)}else(t!==this.lastOutput||this.log.isCursorDirty())&&this.throttledLog(l);this.lastOutput=t,this.lastOutputToRender=l,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 n=g(()=>{this.cancelKittyDetection=void 0,clearTimeout(u),i.removeListener("data",o);const a=Ps(s);s=[],a.length>0&&i.unshift(le.from(a))},"cleanup"),o=g(a=>{const l=typeof a=="string"?le.from(a):a;for(const f of l)s.push(f);Es(s)&&(n(),this.isUnmounted||this.enableKittyProtocol(t))},"onData");i.on("data",o);const u=setTimeout(n,200);this.cancelKittyDetection=n,r.write("\x1B[?u")}enableKittyProtocol(t){this.options.stdout.write(`\x1B[>${Wi(t)}u`),this.kittyProtocolEnabled=!0}}var Is=Object.defineProperty,Kt=b((e,t)=>Is(e,"name",{value:t,configurable:!0}),"i");const fn=Kt((e,t)=>{const i={alternateScreen:!1,concurrent:!1,debug:!1,exitOnCtrlC:!0,incrementalRendering:!1,maxFps:30,patchConsole:!0,stderr:B.stderr,stdin:B.stdin,stdout:B.stdout,...Ls(t)},r=Ds(i.stdout,()=>new ks(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"),Ls=Kt((e={})=>e instanceof oi?{stdin:B.stdin,stdout:e}:e,"getOptions"),Ds=Kt((e,t)=>{const i=Ut.get(e);if(i===void 0){const r=t();return Ut.set(e,r),r}return B.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.
|
|
27
|
+
`),i},"getInstance");export{fn as default};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { D as DOMElement } from "./dom.d-DgP_exKU.js";
|
|
3
3
|
import 'node:stream';
|
|
4
|
-
import {
|
|
4
|
+
import { a as CursorPosition } from "./cursor-helpers.d-BONB9tky.js";
|
|
5
5
|
declare const kittyFlags: {
|
|
6
6
|
readonly disambiguateEscapeCodes: 1;
|
|
7
7
|
readonly reportAllKeysAsEscapeCodes: 8;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var g=Object.defineProperty;var u=(t,n)=>g(t,"name",{value:n,configurable:!0});import{LegacyRoot as N}from"react-reconciler/constants.js";import S from"yoga-layout";import{c as h}from"./dom-
|
|
1
|
+
var g=Object.defineProperty;var u=(t,n)=>g(t,"name",{value:n,configurable:!0});import{LegacyRoot as N}from"react-reconciler/constants.js";import S from"yoga-layout";import{c as h}from"./dom-CW6KYzFK.js";import{L as c}from"./reconciler-CGhHgXXG.js";import{R as d}from"./renderer-C2ycheBL.js";import{calculateScroll as w}from"./getScrollHeight-ClEOyLHH.js";var R=Object.defineProperty,m=u((t,n)=>R(t,"name",{value:n,configurable:!0}),"u");const I=m((t,n)=>{const y=n?.columns??80,e=h("ink-root");let i="";e.onComputeLayout=()=>{e.yogaNode.setWidth(y),e.yogaNode.calculateLayout(void 0,void 0,S.DIRECTION_LTR);const o=m(r=>{if(r.nodeName==="ink-box"){const a=r.style.overflow??"visible",p=r.style.overflowX??a,v=r.style.overflowY??a;(p==="scroll"||v==="scroll")&&w(r)}for(const a of r.childNodes)a.nodeName!=="#text"&&o(a)},"walkScroll");o(e)},e.onImmediateRender=()=>{const{staticOutput:o}=d(e,!1);o&&o!==`
|
|
2
2
|
`&&(i+=o)};let l;const s=c.createContainer(e,N,null,!1,null,"render-to-string",o=>{l??=o},()=>{},()=>{},()=>{});let f=!1;try{c.updateContainerSync(t,s,null,()=>{}),c.flushSyncWork();const{output:o}=d(e,!1);if(c.updateContainerSync(null,s,null,()=>{}),c.flushSyncWork(),f=!0,e.yogaNode.free(),l!==void 0)throw l instanceof Error?l:new Error(String(l));const r=i.endsWith(`
|
|
3
3
|
`)?i.slice(0,-1):i;return r&&o?`${r}
|
|
4
4
|
${o}`:r||o}finally{if(!f&&e.yogaNode)try{e.yogaNode.freeRecursive()}catch{}}},"renderToString");export{I as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var T=Object.defineProperty;var c=(o,r)=>T(o,"name",{value:r,configurable:!0});import y from"react";import{FocusProvider as w}from"./FocusContext-Xy0cwJpO.js";import{TuiContext as v}from"./TuiContext-BoJvG3NN.js";import{LayoutNode as C}from"./LayoutNode-
|
|
1
|
+
var T=Object.defineProperty;var c=(o,r)=>T(o,"name",{value:r,configurable:!0});import y from"react";import{FocusProvider as w}from"./FocusContext-Xy0cwJpO.js";import{TuiContext as v}from"./TuiContext-BoJvG3NN.js";import{LayoutNode as C}from"./LayoutNode-B0qeT8sl.js";import{T as i}from"./reconciler-ClRKkLS4.js";import{renderTreeToBuffer as E}from"./renderTreeToBuffer-LnGZkEUX.js";import{Cell as N}from"./Cell-BrXn3jxY.js";var P=Object.defineProperty,d=c((o,r)=>P(o,"name",{value:r,configurable:!0}),"a");function W(o,r){const e=r?.columns??80,n=r?.rows??24,t=new C;t.yogaNode.setWidth(e),t.yogaNode.setHeight(n);const S={app:null,input:null,writeStderr:d(u=>{},"writeStderr"),writeStdout:d(u=>{},"writeStdout")},g=y.createElement(v.Provider,{value:S},y.createElement(w,null,o)),m=i.createContainer(t,0,null,!1,null,"renderToString",()=>{},null);i.updateContainerSync(g,m,null,()=>{}),i.flushSyncWork(),t.calculateLayout(e,n);const f=new Uint32Array(e*n*2);E(t,f,e,n);const l=[];for(let u=0;u<n;u++){let p="";for(let a=0;a<e;a++){const h=f[(u*e+a)*2],s=N.getChar(h);p+=s===""?" ":s}l.push(p.trimEnd())}for(;l.length>0&&l.at(-1)==="";)l.pop();return i.updateContainerSync(null,m,null,()=>{}),i.flushSyncWork(),t.destroy(),l.join(`
|
|
2
2
|
`)}c(W,"renderToString");d(W,"renderToString");export{W as renderToString};
|
|
@@ -0,0 +1,2 @@
|
|
|
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-CI9G0a-z.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};
|
|
@@ -0,0 +1,17 @@
|
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as DOMNode, S as StyledLine } from "./dom.d-DgP_exKU.js";
|
|
2
2
|
/**
|
|
3
3
|
* Compare the document position of two points in the DOM tree.
|
|
4
4
|
* Returns -1 if A is before B, 0 if equal, 1 if A is after B.
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
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,7 +1,103 @@
|
|
|
1
|
-
import { AnsiColors } from
|
|
2
|
-
import { Boxes, BoxStyle } from 'cli-boxes';
|
|
1
|
+
import { A as AnsiColors } from "./index.server.d-eZWyC2Ku.js";
|
|
3
2
|
import { LiteralUnion } from 'type-fest';
|
|
4
3
|
import 'yoga-layout';
|
|
4
|
+
/**
|
|
5
|
+
Style of the box border.
|
|
6
|
+
*/
|
|
7
|
+
type BoxStyle = {
|
|
8
|
+
readonly topLeft: string;
|
|
9
|
+
readonly top: string;
|
|
10
|
+
readonly topRight: string;
|
|
11
|
+
readonly right: string;
|
|
12
|
+
readonly bottomRight: string;
|
|
13
|
+
readonly bottom: string;
|
|
14
|
+
readonly bottomLeft: string;
|
|
15
|
+
readonly left: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
All box styles.
|
|
19
|
+
*/
|
|
20
|
+
type Boxes = {
|
|
21
|
+
/**
|
|
22
|
+
@example
|
|
23
|
+
```
|
|
24
|
+
┌────┐
|
|
25
|
+
│ │
|
|
26
|
+
└────┘
|
|
27
|
+
```
|
|
28
|
+
*/
|
|
29
|
+
readonly single: BoxStyle;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
@example
|
|
33
|
+
```
|
|
34
|
+
╔════╗
|
|
35
|
+
║ ║
|
|
36
|
+
╚════╝
|
|
37
|
+
```
|
|
38
|
+
*/
|
|
39
|
+
readonly double: BoxStyle;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
@example
|
|
43
|
+
```
|
|
44
|
+
╭────╮
|
|
45
|
+
│ │
|
|
46
|
+
╰────╯
|
|
47
|
+
```
|
|
48
|
+
*/
|
|
49
|
+
readonly round: BoxStyle;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
@example
|
|
53
|
+
```
|
|
54
|
+
┏━━━━┓
|
|
55
|
+
┃ ┃
|
|
56
|
+
┗━━━━┛
|
|
57
|
+
```
|
|
58
|
+
*/
|
|
59
|
+
readonly bold: BoxStyle;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
@example
|
|
63
|
+
```
|
|
64
|
+
╓────╖
|
|
65
|
+
║ ║
|
|
66
|
+
╙────╜
|
|
67
|
+
```
|
|
68
|
+
*/
|
|
69
|
+
readonly singleDouble: BoxStyle;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
@example
|
|
73
|
+
```
|
|
74
|
+
╒════╕
|
|
75
|
+
│ │
|
|
76
|
+
╘════╛
|
|
77
|
+
```
|
|
78
|
+
*/
|
|
79
|
+
readonly doubleSingle: BoxStyle;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
@example
|
|
83
|
+
```
|
|
84
|
+
+----+
|
|
85
|
+
| |
|
|
86
|
+
+----+
|
|
87
|
+
```
|
|
88
|
+
*/
|
|
89
|
+
readonly classic: BoxStyle;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
@example
|
|
93
|
+
```
|
|
94
|
+
↘↓↓↓↓↙
|
|
95
|
+
→ ←
|
|
96
|
+
↗↑↑↑↑↖
|
|
97
|
+
```
|
|
98
|
+
*/
|
|
99
|
+
readonly arrow: BoxStyle;
|
|
100
|
+
};
|
|
5
101
|
type Styles = {
|
|
6
102
|
/**
|
|
7
103
|
* It defines the alignment along the cross axis when there are multiple lines of flex items (when using flex-wrap).
|
|
@@ -0,0 +1,2 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var y=Object.defineProperty;var p=(e,n)=>y(e,"name",{value:n,configurable:!0});import{S as V,d as m,i as h}from"./measure-text-
|
|
1
|
+
var y=Object.defineProperty;var p=(e,n)=>y(e,"name",{value:n,configurable:!0});import{S as V,d as m,i as h}from"./measure-text-D-jVetsl.js";var b=Object.defineProperty,g=p((e,n)=>b(e,"name",{value:n,configurable:!0}),"g");const S=g((e,n,u="end")=>{if(n<1)return new V;if(m(e)<=n)return e;const r=new V;if(r.pushChar("…",0),n===1)return r;if(u==="start"){let t=0,s=e.length;for(let l=e.length-1;l>=0&&(t+=h(e.getValue(l)),!(t>n-1));l--)s=l;return r.combine(e.slice(s))}if(u==="middle"){const t=Math.ceil(n/2),s=n-t;let l=0,c=0;for(let i=0;i<e.length;i++){const d=h(e.getValue(i));if(c+d>t-1)break;c+=d,l=i+1}let a=e.length;c=0;for(let i=e.length-1;i>=0&&(c+=h(e.getValue(i)),!(c>s));i--)a=i;return e.slice(0,l).combine(r,e.slice(a))}let f=0,o=0;for(let t=0;t<e.length;t++){const s=h(e.getValue(t));if(o+s>n-1)break;o+=s,f=t+1}return e.slice(0,f).combine(r)},"truncateStyledLine"),w=g((e,n)=>{const u=[];let r=0,f=0,o=!0,t=0;for(;t<e.length;){const s=e.getValue(t);if(s===`
|
|
2
2
|
`){u.push(e.slice(r,t)),r=t+1,f=0,o=!0,t++;continue}let l=t,c=0;if(s===" ")c=h(" "),l=t+1;else for(;l<e.length&&e.getValue(l)!==" "&&e.getValue(l)!==`
|
|
3
3
|
`;)c+=h(e.getValue(l)),l++;if(f+c>n&&f>0){if(s===" "&&!o&&!e.hasStyles(t)){t=l;continue}let a=t;for(;a>r&&e.getValue(a-1)===" "&&!e.hasStyles(a-1);)a--;u.push(e.slice(r,a)),r=t,f=0;continue}if(f===0&&c>n){let a=t,i=0;for(;a<l;){const d=h(e.getValue(a));i+d>n&&i>0&&(u.push(e.slice(r,a)),r=a,i=0),i+=d,a++}f=i,t=l,o=!1}else f+=c,t=l,s!==" "&&(o=!1)}return(r<e.length||u.length===0)&&u.push(e.slice(r)),u},"wrapStyledLine"),v=g((e,n,u="wrap")=>{if(u.startsWith("truncate")){let r="end";return u==="truncate-middle"?r="middle":u==="truncate-start"&&(r="start"),[S(e,n,r)]}return w(e,n)},"wrapOrTruncateStyledLine");export{v as wrapOrTruncateStyledLine};
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { Context, RefObject, ReactNode } from 'react';
|
|
2
|
-
import { M as MouseEvent, T as TuiApp, c as InputParser, a as InlineOptions } from "../packem_shared/input.d-
|
|
2
|
+
import { M as MouseEvent, T as TuiApp, c as InputParser, a as InlineOptions } from "../packem_shared/input.d-D-Yxqha8.js";
|
|
3
3
|
import Yoga from 'yoga-layout';
|
|
4
|
-
import 'tseep';
|
|
5
4
|
interface DevToolsProps {
|
|
6
5
|
children: React.ReactNode;
|
|
7
6
|
/** Show/hide the HUD without unmounting (default: true) */
|
package/dist/react/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DevTools as o}from"../packem_shared/DevTools-
|
|
1
|
+
import{DevTools as o}from"../packem_shared/DevTools-BR7K-5JX.js";import{FocusContext as u,FocusProvider as s,useFocus as n,useFocusManager as p}from"../packem_shared/FocusContext-Xy0cwJpO.js";import{TuiContext as d,measureElement as f,useApp as l,useBoxMetrics as m,useCursor as a,useInput as i,useIsScreenReaderEnabled as S,useMouse as c,usePaste as T,useScrollable as C,useStderr as F,useStdin as I,useStdout as M,useTextInput as v,useTuiContext as y,useWindowSize as E}from"../packem_shared/TuiContext-BoJvG3NN.js";import{render as g,renderInline as A}from"../packem_shared/render-BoukeuYD.js";import{renderToString as D}from"../packem_shared/renderToString-nZdqfdWT.js";import{Static as N}from"../packem_shared/Static-DLynr5pn.js";import{LayoutNode as P}from"../packem_shared/LayoutNode-B0qeT8sl.js";import{NAMED_COLORS as w,applyStyles as z,resolveColor as W}from"../packem_shared/NAMED_COLORS-B9fJsYdg.js";import{renderTreeToBuffer as h}from"../packem_shared/renderTreeToBuffer-LnGZkEUX.js";export{o as DevTools,u as FocusContext,s as FocusProvider,P as LayoutNode,w as NAMED_COLORS,N as Static,d as TuiContext,z as applyStyles,f as measureElement,g as render,A as renderInline,D as renderToString,h as renderTreeToBuffer,W as resolveColor,l as useApp,m as useBoxMetrics,a as useCursor,n as useFocus,p as useFocusManager,i as useInput,S as useIsScreenReaderEnabled,c as useMouse,T as usePaste,C as useScrollable,F as useStderr,I as useStdin,M as useStdout,v as useTextInput,y as useTuiContext,E as useWindowSize};
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
import { R as RenderOptions } from "../packem_shared/render.d-
|
|
3
|
-
import "../packem_shared/dom.d-
|
|
2
|
+
import { R as RenderOptions } from "../packem_shared/render.d-DarVJBG2.js";
|
|
3
|
+
import "../packem_shared/dom.d-DgP_exKU.js";
|
|
4
4
|
import 'yoga-layout';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import "../packem_shared/cursor-helpers.d-BONB9tky.js";
|
|
6
|
+
import "../packem_shared/styles.d-CLJdt-kg.js";
|
|
7
|
+
import "../packem_shared/index.server.d-eZWyC2Ku.js";
|
|
7
8
|
import 'type-fest';
|
|
8
|
-
import "../packem_shared/styles.d-cMo36xQz.js";
|
|
9
9
|
import 'node:stream';
|
|
10
|
-
import "../packem_shared/cursor-helpers.d-BIvqz0TZ.js";
|
|
11
10
|
declare const KEY: {
|
|
12
11
|
readonly backspace: "";
|
|
13
12
|
readonly ctrlC: "";
|
package/dist/testing/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var w=Object.defineProperty;var a=(t,e)=>w(t,"name",{value:e,configurable:!0});import{createRequire as F}from"node:module";import x from"../packem_shared/render-
|
|
1
|
+
var w=Object.defineProperty;var a=(t,e)=>w(t,"name",{value:e,configurable:!0});import{createRequire as F}from"node:module";import x from"../packem_shared/render-CBFHzIKj.js";import{createKeySender as y}from"../packem_shared/KEY-Bk8B-3h_.js";import{KEY as $}from"../packem_shared/KEY-Bk8B-3h_.js";import{createScreen as T}from"../packem_shared/createScreen-87XLHZq6.js";import{waitFor as j}from"../packem_shared/waitFor-Dj5zfL5s.js";const b=F(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=a(t=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[e,i]=o.versions.node.split(".").map(Number);if(e>22||e===22&&i>=3||e===20&&i>=16)return o.getBuiltinModule(t)}return b(t)},"__cjs_getBuiltinModule"),l=v("node:events");var R=Object.defineProperty,r=a((t,e)=>R(t,"name",{value:e,configurable:!0}),"t");class S extends l{static{a(this,"v")}static{r(this,"Stdout")}columns;_lastFrame;_frames=[];constructor(e=100){super(),this.columns=e}get frames(){return this._frames}lastFrame(){return this._lastFrame}write=r(e=>(this._frames.push(e),this._lastFrame=e,!0),"write")}class D extends l{static{a(this,"x")}static{r(this,"Stderr")}columns;_lastFrame;_frames=[];constructor(e=100){super(),this.columns=e}get frames(){return this._frames}lastFrame(){return this._lastFrame}write=r(e=>(this._frames.push(e),this._lastFrame=e,!0),"write")}class P extends l{static{a(this,"R")}static{r(this,"Stdin")}isTTY=!0;pendingData;write=r(e=>(this.pendingData=e,this.emit("readable"),this.emit("data",e),!0),"write");read(){const{pendingData:e}=this;return this.pendingData=void 0,e}setEncoding(){return this}setRawMode(){return this}resume(){return this}pause(){return this}ref(){return this}unref(){return this}}const c=[],O=r((t,e={})=>{const{columns:i,options:p}=e,n=new S(i),d=new D(i),m=new P,u=x(t,{debug:!0,exitOnCtrlC:!1,patchConsole:!1,stderr:d,stdin:m,stdout:n,...p});c.push(u);const f=T(()=>n.lastFrame(),n.frames),h=y(s=>m.write(s)),_=r(async()=>{await new Promise(s=>{setTimeout(s,0)}),await new Promise(s=>{setTimeout(s,0)})},"flush");return{cleanup:u.cleanup,flush:_,get frames(){return n.frames},keys:h,lastFrame:r(()=>n.lastFrame(),"lastFrame"),rerender:u.rerender,screen:f,stderr:d,stdin:m,stdout:n,unmount:u.unmount,async waitFor(s,g){await j(s,()=>f.text(),g)}}},"testRender"),Y=r(()=>{for(const t of c)t.cleanup();c.length=0},"cleanup");export{$ as KEY,Y as cleanup,y as createKeySender,T as createScreen,O as render,j as waitFor};
|