@visulima/tui 1.0.0-alpha.20 → 1.0.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/LICENSE.md +113 -287
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/approval-prompt.d.ts +1 -1
- package/dist/components/area-chart.d.ts +1 -1
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/bar-chart.d.ts +1 -1
- package/dist/components/blink-dot.d.ts +1 -1
- package/dist/components/box.d.ts +4 -3
- package/dist/components/breadcrumb.d.ts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/calendar.d.ts +1 -1
- package/dist/components/canvas.js +1 -1
- package/dist/components/card.d.ts +1 -1
- package/dist/components/checkbox.d.ts +1 -1
- package/dist/components/collapsible.d.ts +1 -1
- package/dist/components/command-palette.d.ts +1 -1
- package/dist/components/content-switcher.d.ts +1 -1
- package/dist/components/controlled-scroll-view.d.ts +4 -3
- package/dist/components/cursor.d.ts +4 -3
- package/dist/components/date-picker.d.ts +1 -1
- package/dist/components/definition-list.d.ts +1 -1
- package/dist/components/dialog.d.ts +4 -3
- package/dist/components/divider.d.ts +1 -1
- package/dist/components/form.d.ts +1 -1
- package/dist/components/gauge.d.ts +1 -1
- package/dist/components/gradient.d.ts +1 -18
- package/dist/components/gradient.js +1 -4
- package/dist/components/heading.d.ts +1 -1
- package/dist/components/heatmap.d.ts +1 -1
- package/dist/components/histogram.d.ts +1 -1
- package/dist/components/kbd.d.ts +1 -1
- package/dist/components/line-chart.d.ts +1 -1
- package/dist/components/link.js +1 -1
- package/dist/components/loading-indicator.d.ts +2 -2
- package/dist/components/menu.d.ts +1 -1
- package/dist/components/message-bubble.d.ts +1 -1
- package/dist/components/model-badge.d.ts +1 -1
- package/dist/components/multi-select.d.ts +1 -1
- package/dist/components/option-list.d.ts +1 -1
- package/dist/components/paragraph.d.ts +1 -1
- package/dist/components/placeholder.d.ts +1 -1
- package/dist/components/progress-bar.d.ts +3 -2
- package/dist/components/radio-group.d.ts +1 -1
- package/dist/components/scatter-plot.d.ts +1 -1
- package/dist/components/scroll-bar-box.d.ts +4 -3
- package/dist/components/scroll-bar.d.ts +4 -3
- package/dist/components/scroll-list.d.ts +4 -3
- package/dist/components/scroll-view.d.ts +4 -3
- 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 -3
- package/dist/components/static.d.ts +3 -2
- package/dist/components/status-line.d.ts +1 -1
- package/dist/components/stepper.d.ts +1 -1
- package/dist/components/streaming-text.d.ts +1 -1
- package/dist/components/switch.d.ts +1 -1
- package/dist/components/tabs.d.ts +1 -1
- package/dist/components/tag.d.ts +1 -1
- package/dist/components/text.d.ts +3 -2
- package/dist/components/text.js +1 -1
- package/dist/components/tooltip.d.ts +1 -1
- package/dist/components/tree-view-entry.d.ts +4 -3
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.js +1 -1
- package/dist/ink/hooks/use-box-metrics.d.ts +4 -3
- package/dist/ink/hooks/use-box-metrics.js +1 -1
- package/dist/ink/hooks/use-input.js +1 -1
- package/dist/ink/hooks/use-linked-scroll.d.ts +4 -3
- package/dist/ink/hooks/use-paste.js +1 -1
- package/dist/ink/hooks/use-text-selection.d.ts +5 -4
- package/dist/ink/hooks/use-text-selection.js +1 -1
- package/dist/ink/hooks/use-window-size.js +1 -1
- package/dist/ink/index.d.ts +7 -6
- package/dist/ink/index.js +1 -1
- package/dist/packem_shared/{DevTools-BR7K-5JX.js → DevTools-ClAYpMVI.js} +1 -1
- package/dist/packem_shared/InputParser-B_qZcN3r.js +2 -0
- package/dist/packem_shared/{LayoutNode-B0qeT8sl.js → LayoutNode-B8zej4dm.js} +1 -1
- package/dist/packem_shared/{MouseProvider-CHU5DuwC.js → MouseProvider-PnIUKURs.js} +1 -1
- package/dist/packem_shared/TuiApp-BVDXP0Cv.js +1 -0
- package/dist/packem_shared/ansi-parser-B6uXaq65.js +1 -0
- package/dist/packem_shared/colorize-DbTZMrJO.js +1 -0
- package/dist/packem_shared/{comparePoints-Dez5FkH9.js → comparePoints-YxQfR_zq.js} +1 -1
- package/dist/packem_shared/createInlineLoop-DRNZ7jqH.js +2 -0
- package/dist/packem_shared/createScreen-CrLrxA6t.js +3 -0
- package/dist/packem_shared/dom-BG-LS10p.js +1 -0
- package/dist/packem_shared/{dom.d-DgP_exKU.d.ts → dom.d-C1IxuLJ9.d.ts} +3 -1
- package/dist/packem_shared/{getPathToRoot-B3q6OlQy.js → getPathToRoot-D5Hns9Er.js} +1 -1
- package/dist/packem_shared/input.d-CgxV2e8U.d.ts +90 -0
- package/dist/packem_shared/measure-text-DDjHT1jD.js +3 -0
- package/dist/packem_shared/parseSgrMouse-Ccj70ijb.js +1 -0
- package/dist/packem_shared/reconciler-CUbhOvcr.js +1 -0
- package/dist/packem_shared/reconciler-DIfG72R9.js +1 -0
- package/dist/packem_shared/render-BFio00DS.js +26 -0
- package/dist/packem_shared/{render-BoukeuYD.js → render-Dh7HMhK1.js} +1 -1
- package/dist/packem_shared/{render.d-DarVJBG2.d.ts → render.d-DuyG0zip.d.ts} +1 -1
- package/dist/packem_shared/{renderToString-nZdqfdWT.js → renderToString-BbQiRHrd.js} +1 -1
- package/dist/packem_shared/{renderToString-Cx3DmmMR.js → renderToString-SDrrFvu8.js} +1 -1
- package/dist/packem_shared/renderTreeToBuffer-CZilzyhN.js +2 -0
- package/dist/packem_shared/renderer-DG986Pcr.js +17 -0
- package/dist/packem_shared/{selection.d-WuD_83yQ.d.ts → selection.d-Dbha5bMS.d.ts} +1 -1
- package/dist/packem_shared/setEnableStyledLineCache-D2gZbwFM.js +1 -0
- package/dist/packem_shared/{styles.d-CLJdt-kg.d.ts → styles.d-cMo36xQz.d.ts} +2 -98
- package/dist/packem_shared/text-width-BU2eeTWn.js +2 -0
- package/dist/packem_shared/utils-CoviI5Vm.js +1 -0
- package/dist/packem_shared/{wrapOrTruncateStyledLine-kyi6yijx.js → wrapOrTruncateStyledLine-BZ00SM8i.js} +1 -1
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.js +1 -1
- package/dist/testing/index.d.ts +5 -4
- package/dist/testing/index.js +1 -1
- package/index.js +26 -26
- package/package.json +22 -9
- package/dist/packem_shared/InputParser-BAqciKJ6.js +0 -2
- package/dist/packem_shared/TuiApp-CxBtziW8.js +0 -1
- package/dist/packem_shared/_commonjsHelpers-CHNfUHCT.js +0 -1
- package/dist/packem_shared/ansi-parser-C5JuL732.js +0 -1
- package/dist/packem_shared/boxes-DyY_LXCi.js +0 -1
- package/dist/packem_shared/colorize-gy_cY-wC.js +0 -2
- package/dist/packem_shared/constants-D12jy2Zh-RSfxu1eM.js +0 -1
- package/dist/packem_shared/createInlineLoop-D0JaKX9A.js +0 -2
- package/dist/packem_shared/createScreen-87XLHZq6.js +0 -3
- package/dist/packem_shared/dom-CW6KYzFK.js +0 -8
- package/dist/packem_shared/erase-DKKNxHZ_.js +0 -1
- package/dist/packem_shared/get-string-width-CbMPWEJO.js +0 -1
- package/dist/packem_shared/index-COPEEDn3.js +0 -9
- package/dist/packem_shared/index-CqsHHJkn.js +0 -75
- package/dist/packem_shared/index.d-Bk52cbgN.d.ts +0 -14
- package/dist/packem_shared/index.server.d-eZWyC2Ku.d.ts +0 -5
- package/dist/packem_shared/input.d-D-Yxqha8.d.ts +0 -172
- package/dist/packem_shared/measure-text-D-jVetsl.js +0 -3
- package/dist/packem_shared/mode-BOIU4Roy.js +0 -1
- package/dist/packem_shared/parseSgrMouse-DoBY7MKw.js +0 -1
- package/dist/packem_shared/reconciler-CGhHgXXG.js +0 -1
- package/dist/packem_shared/reconciler-ClRKkLS4.js +0 -1
- package/dist/packem_shared/render-CBFHzIKj.js +0 -27
- package/dist/packem_shared/renderTreeToBuffer-LnGZkEUX.js +0 -2
- package/dist/packem_shared/renderer-C2ycheBL.js +0 -17
- package/dist/packem_shared/setEnableStyledLineCache-Cke6_ZQt.js +0 -1
- package/dist/packem_shared/strip-C6HQYmlg.js +0 -1
- package/dist/packem_shared/text-width-CI9G0a-z.js +0 -2
- package/dist/packem_shared/utils-THUhYKG2.js +0 -1
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
var M=Object.defineProperty;var o=(p,r)=>M(p,"name",{value:r,configurable:!0});import"./_commonjsHelpers-CHNfUHCT.js";var lib={},types={},hasRequiredTypes;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,Object.defineProperty(types,"__esModule",{value:!0})),types}o(requireTypes,"requireTypes");var ee={},taskCollection$1={},taskCollection={},utils$1={},hasRequiredUtils$1;function requireUtils$1(){if(hasRequiredUtils$1)return utils$1;hasRequiredUtils$1=1;var p=Object.defineProperty,r=o((u,f)=>p(u,"name",{value:f,configurable:!0}),"s");Object.defineProperty(utils$1,"__esModule",{value:!0}),utils$1._fast_remove_single=void 0;function d(u,f){f!==-1&&(f===0?u.shift():f===u.length-1?u.length=u.length-1:u.splice(f,1))}return o(d,"_fast_remove_single"),r(d,"_fast_remove_single"),utils$1._fast_remove_single=d,utils$1}o(requireUtils$1,"requireUtils$1");var bakeCollection={},hasRequiredBakeCollection;function requireBakeCollection(){return hasRequiredBakeCollection||(hasRequiredBakeCollection=1,(function(exports$1){var i=Object.defineProperty,t=o((p,r)=>i(p,"name",{value:r,configurable:!0}),"t");Object.defineProperty(exports$1,"__esModule",{value:!0}),exports$1.bakeCollectionVariadic=exports$1.bakeCollectionAwait=exports$1.bakeCollection=exports$1.BAKED_EMPTY_FUNC=void 0,exports$1.BAKED_EMPTY_FUNC=(function(){});var FORLOOP_FALLBACK=1500;function generateArgsDefCode(p){var r="";if(p===0)return r;for(var d=0;d<p-1;++d)r+="arg"+String(d)+", ";return r+="arg"+String(p-1),r}o(generateArgsDefCode,"generateArgsDefCode"),t(generateArgsDefCode,"generateArgsDefCode");function generateBodyPartsCode(p,r){for(var d="",u="",f=0;f<r;++f)d+="var f".concat(f," = collection[").concat(f,`];
|
|
2
|
-
`),u+="f".concat(f,"(").concat(p,`)
|
|
3
|
-
`);return{funcDefCode:d,funcCallCode:u}}o(generateBodyPartsCode,"generateBodyPartsCode"),t(generateBodyPartsCode,"generateBodyPartsCode");function generateBodyPartsVariadicCode(p){for(var r="",d="",u=0;u<p;++u)r+="var f".concat(u," = collection[").concat(u,`];
|
|
4
|
-
`),d+="f".concat(u,`.apply(undefined, arguments)
|
|
5
|
-
`);return{funcDefCode:r,funcCallCode:d}}o(generateBodyPartsVariadicCode,"generateBodyPartsVariadicCode"),t(generateBodyPartsVariadicCode,"generateBodyPartsVariadicCode");function bakeCollection(collection,fixedArgsNum){if(collection.length===0)return exports$1.BAKED_EMPTY_FUNC;if(collection.length===1)return collection[0];var funcFactoryCode;if(collection.length<FORLOOP_FALLBACK){var argsDefCode=generateArgsDefCode(fixedArgsNum),_a=generateBodyPartsCode(argsDefCode,collection.length),funcDefCode=_a.funcDefCode,funcCallCode=_a.funcCallCode;funcFactoryCode=`(function(collection) {
|
|
6
|
-
`.concat(funcDefCode,`
|
|
7
|
-
collection = undefined;
|
|
8
|
-
return (function(`).concat(argsDefCode,`) {
|
|
9
|
-
`).concat(funcCallCode,`
|
|
10
|
-
});
|
|
11
|
-
})`)}else{var argsDefCode=generateArgsDefCode(fixedArgsNum);collection.length%10===0?funcFactoryCode=`(function(collection) {
|
|
12
|
-
return (function(`.concat(argsDefCode,`) {
|
|
13
|
-
for (var i = 0; i < collection.length; i += 10) {
|
|
14
|
-
collection[i](`).concat(argsDefCode,`);
|
|
15
|
-
collection[i+1](`).concat(argsDefCode,`);
|
|
16
|
-
collection[i+2](`).concat(argsDefCode,`);
|
|
17
|
-
collection[i+3](`).concat(argsDefCode,`);
|
|
18
|
-
collection[i+4](`).concat(argsDefCode,`);
|
|
19
|
-
collection[i+5](`).concat(argsDefCode,`);
|
|
20
|
-
collection[i+6](`).concat(argsDefCode,`);
|
|
21
|
-
collection[i+7](`).concat(argsDefCode,`);
|
|
22
|
-
collection[i+8](`).concat(argsDefCode,`);
|
|
23
|
-
collection[i+9](`).concat(argsDefCode,`);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
})`):collection.length%4===0?funcFactoryCode=`(function(collection) {
|
|
27
|
-
return (function(`.concat(argsDefCode,`) {
|
|
28
|
-
for (var i = 0; i < collection.length; i += 4) {
|
|
29
|
-
collection[i](`).concat(argsDefCode,`);
|
|
30
|
-
collection[i+1](`).concat(argsDefCode,`);
|
|
31
|
-
collection[i+2](`).concat(argsDefCode,`);
|
|
32
|
-
collection[i+3](`).concat(argsDefCode,`);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
})`):collection.length%3===0?funcFactoryCode=`(function(collection) {
|
|
36
|
-
return (function(`.concat(argsDefCode,`) {
|
|
37
|
-
for (var i = 0; i < collection.length; i += 3) {
|
|
38
|
-
collection[i](`).concat(argsDefCode,`);
|
|
39
|
-
collection[i+1](`).concat(argsDefCode,`);
|
|
40
|
-
collection[i+2](`).concat(argsDefCode,`);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
})`):funcFactoryCode=`(function(collection) {
|
|
44
|
-
return (function(`.concat(argsDefCode,`) {
|
|
45
|
-
for (var i = 0; i < collection.length; ++i) {
|
|
46
|
-
collection[i](`).concat(argsDefCode,`);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
})`)}{var funcFactory=eval(funcFactoryCode);return funcFactory(collection)}}o(bakeCollection,"bakeCollection"),t(bakeCollection,"bakeCollection"),exports$1.bakeCollection=bakeCollection;function bakeCollectionAwait(collection,fixedArgsNum){if(collection.length===0)return exports$1.BAKED_EMPTY_FUNC;if(collection.length===1)return collection[0];var funcFactoryCode;if(collection.length<FORLOOP_FALLBACK){var argsDefCode=generateArgsDefCode(fixedArgsNum),_a=generateBodyPartsCode(argsDefCode,collection.length),funcDefCode=_a.funcDefCode,funcCallCode=_a.funcCallCode;funcFactoryCode=`(function(collection) {
|
|
50
|
-
`.concat(funcDefCode,`
|
|
51
|
-
collection = undefined;
|
|
52
|
-
return (function(`).concat(argsDefCode,`) {
|
|
53
|
-
return Promise.all([ `).concat(funcCallCode,` ]);
|
|
54
|
-
});
|
|
55
|
-
})`)}else{var argsDefCode=generateArgsDefCode(fixedArgsNum);funcFactoryCode=`(function(collection) {
|
|
56
|
-
return (function(`.concat(argsDefCode,`) {
|
|
57
|
-
var promises = Array(collection.length);
|
|
58
|
-
for (var i = 0; i < collection.length; ++i) {
|
|
59
|
-
promises[i] = collection[i](`).concat(argsDefCode,`);
|
|
60
|
-
}
|
|
61
|
-
return Promise.all(promises);
|
|
62
|
-
});
|
|
63
|
-
})`)}{var funcFactory=eval(funcFactoryCode);return funcFactory(collection)}}o(bakeCollectionAwait,"bakeCollectionAwait"),t(bakeCollectionAwait,"bakeCollectionAwait"),exports$1.bakeCollectionAwait=bakeCollectionAwait;function bakeCollectionVariadic(collection){if(collection.length===0)return exports$1.BAKED_EMPTY_FUNC;if(collection.length===1)return collection[0];var funcFactoryCode;if(collection.length<FORLOOP_FALLBACK){var _a=generateBodyPartsVariadicCode(collection.length),funcDefCode=_a.funcDefCode,funcCallCode=_a.funcCallCode;funcFactoryCode=`(function(collection) {
|
|
64
|
-
`.concat(funcDefCode,`
|
|
65
|
-
collection = undefined;
|
|
66
|
-
return (function() {
|
|
67
|
-
`).concat(funcCallCode,`
|
|
68
|
-
});
|
|
69
|
-
})`)}else funcFactoryCode=`(function(collection) {
|
|
70
|
-
return (function() {
|
|
71
|
-
for (var i = 0; i < collection.length; ++i) {
|
|
72
|
-
collection[i].apply(undefined, arguments);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
})`;{var funcFactory=eval(funcFactoryCode);return funcFactory(collection)}}o(bakeCollectionVariadic,"bakeCollectionVariadic"),t(bakeCollectionVariadic,"bakeCollectionVariadic"),exports$1.bakeCollectionVariadic=bakeCollectionVariadic})(bakeCollection)),bakeCollection}o(requireBakeCollection,"requireBakeCollection");var hasRequiredTaskCollection$1;function requireTaskCollection$1(){if(hasRequiredTaskCollection$1)return taskCollection;hasRequiredTaskCollection$1=1;var p=Object.defineProperty,r=o((a,b)=>p(a,"name",{value:b,configurable:!0}),"l"),d=taskCollection&&taskCollection.__spreadArray||function(a,b,e){if(e||arguments.length===2)for(var n=0,s=b.length,l;n<s;n++)(l||!(n in b))&&(l||(l=Array.prototype.slice.call(b,0,n)),l[n]=b[n]);return a.concat(l||Array.prototype.slice.call(b))};Object.defineProperty(taskCollection,"__esModule",{value:!0}),taskCollection.TaskCollection=void 0;var u=requireUtils$1(),f=requireBakeCollection();function _(a,b){var e=this.length;if(e>1)if(b){var n;(n=this._tasks).push.apply(n,arguments),this.length+=arguments.length}else this._tasks.push(a),this.length++;else if(b){if(e===1){var s=Array(1+arguments.length);s.push(s),s.push.apply(s,arguments),this._tasks=s}else{var s=Array(arguments.length);s.push.apply(s,arguments),this._tasks=s}this.length+=arguments.length}else e===1?this._tasks=[this._tasks,a]:this._tasks=a,this.length++}o(_,"push_norebuild"),r(_,"push_norebuild");function h(a,b){var e=this.length;if(e>1)if(b){var n;(n=this._tasks).push.apply(n,arguments),this.length+=arguments.length}else this._tasks.push(a),this.length++;else if(b){if(e===1){var s=Array(1+arguments.length);s.push(s),s.push.apply(s,arguments),this._tasks=s}else{var s=Array(arguments.length);s.push.apply(s,arguments),this._tasks=s}this.length+=arguments.length}else e===1?this._tasks=[this._tasks,a]:this._tasks=a,this.length++;this.firstEmitBuildStrategy?this.call=L:this.rebuild()}o(h,"push_rebuild"),r(h,"push_rebuild");function g(a){this.length!==0&&(this.length===1?this._tasks===a&&(this.length=0):((0,u._fast_remove_single)(this._tasks,this._tasks.lastIndexOf(a)),this._tasks.length===1?(this._tasks=this._tasks[0],this.length=1):this.length=this._tasks.length))}o(g,"removeLast_norebuild"),r(g,"removeLast_norebuild");function c(a){if(this.length!==0){if(this.length===1)if(this._tasks===a&&(this.length=0),this.firstEmitBuildStrategy){this.call=f.BAKED_EMPTY_FUNC;return}else{this.rebuild();return}else(0,u._fast_remove_single)(this._tasks,this._tasks.lastIndexOf(a)),this._tasks.length===1?(this._tasks=this._tasks[0],this.length=1):this.length=this._tasks.length;this.firstEmitBuildStrategy?this.call=L:this.rebuild()}}o(c,"removeLast_rebuild"),r(c,"removeLast_rebuild");function C(a){for(var b,e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];this.length===0?(this._tasks=e,this.length=1):this.length===1?(e.unshift(this._tasks),this._tasks=e,this.length=this._tasks.length):((b=this._tasks).splice.apply(b,d([a,0],e,!1)),this.length=this._tasks.length)}o(C,"insert_norebuild"),r(C,"insert_norebuild");function P(a){for(var b,e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];this.length===0?(this._tasks=e,this.length=1):this.length===1?(e.unshift(this._tasks),this._tasks=e,this.length=this._tasks.length):((b=this._tasks).splice.apply(b,d([a,0],e,!1)),this.length=this._tasks.length),this.firstEmitBuildStrategy?this.call=L:this.rebuild()}o(P,"insert_rebuild"),r(P,"insert_rebuild");function B(){this.length===0?this.call=f.BAKED_EMPTY_FUNC:this.length===1?this.call=this._tasks:this.call=(0,f.bakeCollection)(this._tasks,this.argsNum)}o(B,"rebuild_noawait"),r(B,"rebuild_noawait");function F(){this.length===0?this.call=f.BAKED_EMPTY_FUNC:this.length===1?this.call=this._tasks:this.call=(0,f.bakeCollectionAwait)(this._tasks,this.argsNum)}o(F,"rebuild_await"),r(F,"rebuild_await");function L(){this.rebuild(),this.call.apply(void 0,arguments)}o(L,"rebuild_on_first_call"),r(L,"rebuild_on_first_call");var E=(function(){function a(b,e,n,s){e===void 0&&(e=!0),n===void 0&&(n=null),s===void 0&&(s=!1),this.awaitTasks=s,this.call=f.BAKED_EMPTY_FUNC,this.argsNum=b,this.firstEmitBuildStrategy=!0,s?this.rebuild=F.bind(this):this.rebuild=B.bind(this),this.setAutoRebuild(e),n?typeof n=="function"?(this._tasks=n,this.length=1):(this._tasks=n,this.length=n.length):(this._tasks=null,this.length=0),e&&this.rebuild()}return o(a,"t"),r(a,"TaskCollection"),a})();taskCollection.TaskCollection=E;function x(){this._tasks=null,this.length=0,this.call=f.BAKED_EMPTY_FUNC}o(x,"fastClear"),r(x,"fastClear");function T(){this._tasks=null,this.length=0,this.call=f.BAKED_EMPTY_FUNC}o(T,"clear"),r(T,"clear");function q(a){this.argsNum<a&&(this.argsNum=a,this.firstEmitBuildStrategy?this.call=L:this.rebuild())}o(q,"growArgsNum"),r(q,"growArgsNum");function w(a){a?(this.push=h.bind(this),this.insert=P.bind(this),this.removeLast=c.bind(this)):(this.push=_.bind(this),this.insert=C.bind(this),this.removeLast=g.bind(this))}o(w,"setAutoRebuild"),r(w,"setAutoRebuild");function D(){return this.length===0?[]:this.length===1?[this._tasks]:this._tasks}o(D,"tasksAsArray"),r(D,"tasksAsArray");function j(a){a.length===0?(this.length=0,this.call=f.BAKED_EMPTY_FUNC):a.length===1?(this.length=1,this.call=a[0],this._tasks=a[0]):(this.length=a.length,this._tasks=a,this.firstEmitBuildStrategy?this.call=L:this.rebuild())}return o(j,"setTasks"),r(j,"setTasks"),E.prototype.fastClear=x,E.prototype.clear=T,E.prototype.growArgsNum=q,E.prototype.setAutoRebuild=w,E.prototype.tasksAsArray=D,E.prototype.setTasks=j,taskCollection}o(requireTaskCollection$1,"requireTaskCollection$1");var hasRequiredTaskCollection;function requireTaskCollection(){return hasRequiredTaskCollection||(hasRequiredTaskCollection=1,(function(p){var r=Object.defineProperty,d=o((_,h)=>r(_,"name",{value:h,configurable:!0}),"o"),u=taskCollection$1&&taskCollection$1.__createBinding||(Object.create?(function(_,h,g,c){c===void 0&&(c=g);var C=Object.getOwnPropertyDescriptor(h,g);(!C||("get"in C?!h.__esModule:C.writable||C.configurable))&&(C={enumerable:!0,get:d(function(){return h[g]},"get")}),Object.defineProperty(_,c,C)}):(function(_,h,g,c){c===void 0&&(c=g),_[c]=h[g]})),f=taskCollection$1&&taskCollection$1.__exportStar||function(_,h){for(var g in _)g!=="default"&&!Object.prototype.hasOwnProperty.call(h,g)&&u(h,_,g)};Object.defineProperty(p,"__esModule",{value:!0}),f(requireTaskCollection$1(),p)})(taskCollection$1)),taskCollection$1}o(requireTaskCollection,"requireTaskCollection");var utils={},hasRequiredUtils;function requireUtils(){if(hasRequiredUtils)return utils;hasRequiredUtils=1;var p=Object.defineProperty,r=o((u,f)=>p(u,"name",{value:f,configurable:!0}),"r");Object.defineProperty(utils,"__esModule",{value:!0}),utils.nullObj=void 0;function d(){var u={};return u.__proto__=null,u}return o(d,"nullObj"),r(d,"nullObj"),utils.nullObj=d,utils}o(requireUtils,"requireUtils");var hasRequiredEe;function requireEe(){if(hasRequiredEe)return ee;hasRequiredEe=1;var p=Object.defineProperty,r=o((e,n)=>p(e,"name",{value:n,configurable:!0}),"o"),d=ee&&ee.__spreadArray||function(e,n,s){if(s||arguments.length===2)for(var l=0,y=n.length,A;l<y;l++)(A||!(l in n))&&(A||(A=Array.prototype.slice.call(n,0,l)),A[l]=n[l]);return e.concat(A||Array.prototype.slice.call(n))};Object.defineProperty(ee,"__esModule",{value:!0}),ee.EventEmitter=void 0;var u=requireTaskCollection(),f=requireUtils$1(),_=requireUtils();function h(e,n,s,l,y,A){var k=this.events[e];if(k){if(k.length===0)return!1;if(k.argsNum<6)k.call(n,s,l,y,A);else{for(var m=new Array(k.argsNum),v=0,O=m.length;v<O;++v)m[v]=arguments[v+1];k.call.apply(void 0,m)}return!0}return!1}o(h,"emit"),r(h,"emit");function g(e,n,s,l,y,A){var k=this.events[e],m;if(k!==void 0){if(k.length===0)return!1;if(k.argsNum<6)k.call(n,s,l,y,A);else{m=new Array(k.argsNum);for(var v=0,O=m.length;v<O;++v)m[v]=arguments[v+1];k.call.apply(void 0,m)}}var N=this.onceEvents[e];if(N){if(typeof N=="function")if(this.onceEvents[e]=void 0,arguments.length<6)N(n,s,l,y,A);else{if(m===void 0){m=new Array(arguments.length-1);for(var v=0,O=m.length;v<O;++v)m[v]=arguments[v+1]}N.apply(void 0,m)}else{var $=N;if(this.onceEvents[e]=void 0,arguments.length<6)for(var v=0;v<$.length;++v)$[v](n,s,l,y,A);else{if(m===void 0){m=new Array(arguments.length-1);for(var v=0,O=m.length;v<O;++v)m[v]=arguments[v+1]}for(var v=0;v<$.length;++v)$[v].apply(void 0,m)}}return!0}return k!==void 0}o(g,"emitHasOnce"),r(g,"emitHasOnce");var c=(function(){function e(){this.events=(0,_.nullObj)(),this.onceEvents=(0,_.nullObj)(),this._symbolKeys=new Set,this.maxListeners=1/0}return o(e,"e"),r(e,"EventEmitter"),Object.defineProperty(e.prototype,"_eventsCount",{get:r(function(){return this.eventNames().length},"get"),enumerable:!1,configurable:!0}),e})();ee.EventEmitter=c;function C(e,n){switch(this.emit===h&&(this.emit=g),typeof this.onceEvents[e]){case"undefined":this.onceEvents[e]=n,typeof e=="symbol"&&this._symbolKeys.add(e);break;case"function":this.onceEvents[e]=[this.onceEvents[e],n];break;case"object":this.onceEvents[e].push(n)}return this}o(C,"once"),r(C,"once");function P(e,n,s){if(s===void 0&&(s=n.length),typeof n!="function")throw new TypeError("The listener must be a function");var l=this.events[e];return l?(l.push(n),l.growArgsNum(s),this.maxListeners!==1/0&&this.maxListeners<=l.length&&console.warn('Maximum event listeners for "'.concat(String(e),'" event!'))):(this.events[e]=new u.TaskCollection(s,!0,n,!1),typeof e=="symbol"&&this._symbolKeys.add(e)),this}o(P,"addListener"),r(P,"addListener");function B(e,n){var s=this.events[e];s&&s.removeLast(n);var l=this.onceEvents[e];return l&&(typeof l=="function"?this.onceEvents[e]=void 0:typeof l=="object"&&(l.length===1&&l[0]===n?this.onceEvents[e]=void 0:(0,f._fast_remove_single)(l,l.lastIndexOf(n)))),this}o(B,"removeListener"),r(B,"removeListener");function F(e,n,s,l){s===void 0&&(s=this),l===void 0&&(l=n.length),this.boundFuncs||(this.boundFuncs=new Map);var y=n.bind(s);return this.boundFuncs.set(n,y),this.addListener(e,y,l)}o(F,"addListenerBound"),r(F,"addListenerBound");function L(e,n){var s,l,y=(s=this.boundFuncs)===null||s===void 0?void 0:s.get(n);return(l=this.boundFuncs)===null||l===void 0||l.delete(n),this.removeListener(e,y)}o(L,"removeListenerBound"),r(L,"removeListenerBound");function E(e){return this.events[e]&&!!this.events[e].length}o(E,"hasListeners"),r(E,"hasListeners");function x(e,n,s){if(s===void 0&&(s=n.length),typeof n!="function")throw new TypeError("The listener must be a function");var l=this.events[e];return!l||!(l instanceof u.TaskCollection)?(l=this.events[e]=new u.TaskCollection(s,!0,n,!1),typeof e=="symbol"&&this._symbolKeys.add(e)):(l.insert(0,n),l.growArgsNum(s),this.maxListeners!==1/0&&this.maxListeners<=l.length&&console.warn('Maximum event listeners for "'.concat(String(e),'" event!'))),this}o(x,"prependListener"),r(x,"prependListener");function T(e,n){this.emit===h&&(this.emit=g);var s=this.onceEvents[e];return s?typeof s!="object"?(this.onceEvents[e]=[n,s],typeof e=="symbol"&&this._symbolKeys.add(e)):(s.unshift(n),this.maxListeners!==1/0&&this.maxListeners<=s.length&&console.warn('Maximum event listeners for "'.concat(String(e),'" once event!'))):(this.onceEvents[e]=[n],typeof e=="symbol"&&this._symbolKeys.add(e)),this}o(T,"prependOnceListener"),r(T,"prependOnceListener");function q(e){return e===void 0?(this.events=(0,_.nullObj)(),this.onceEvents=(0,_.nullObj)(),this._symbolKeys=new Set):(this.events[e]=void 0,this.onceEvents[e]=void 0,typeof e=="symbol"&&this._symbolKeys.delete(e)),this}o(q,"removeAllListeners"),r(q,"removeAllListeners");function w(e){return this.maxListeners=e,this}o(w,"setMaxListeners"),r(w,"setMaxListeners");function D(){return this.maxListeners}o(D,"getMaxListeners"),r(D,"getMaxListeners");function j(e){return this.emit===h?this.events[e]?this.events[e].tasksAsArray().slice():[]:this.events[e]&&this.onceEvents[e]?d(d([],this.events[e].tasksAsArray(),!0),typeof this.onceEvents[e]=="function"?[this.onceEvents[e]]:this.onceEvents[e],!0):this.events[e]?this.events[e].tasksAsArray():this.onceEvents[e]?typeof this.onceEvents[e]=="function"?[this.onceEvents[e]]:this.onceEvents[e]:[]}o(j,"listeners"),r(j,"listeners");function a(){var e=this;if(this.emit===h){var n=Object.keys(this.events);return d(d([],n,!0),Array.from(this._symbolKeys),!0).filter(function(l){return l in e.events&&e.events[l]&&e.events[l].length})}else{var n=Object.keys(this.events).filter(function(y){return e.events[y]&&e.events[y].length}),s=Object.keys(this.onceEvents).filter(function(y){return e.onceEvents[y]&&e.onceEvents[y].length});return d(d(d([],n,!0),s,!0),Array.from(this._symbolKeys).filter(function(y){return y in e.events&&e.events[y]&&e.events[y].length||y in e.onceEvents&&e.onceEvents[y]&&e.onceEvents[y].length}),!0)}}o(a,"eventNames"),r(a,"eventNames");function b(e){return this.emit===h?this.events[e]&&this.events[e].length||0:(this.events[e]&&this.events[e].length||0)+(this.onceEvents[e]&&this.onceEvents[e].length||0)}return o(b,"listenerCount"),r(b,"listenerCount"),c.prototype.emit=h,c.prototype.on=P,c.prototype.once=C,c.prototype.addListener=P,c.prototype.removeListener=B,c.prototype.addListenerBound=F,c.prototype.removeListenerBound=L,c.prototype.hasListeners=E,c.prototype.prependListener=x,c.prototype.prependOnceListener=T,c.prototype.off=B,c.prototype.removeAllListeners=q,c.prototype.setMaxListeners=w,c.prototype.getMaxListeners=D,c.prototype.listeners=j,c.prototype.eventNames=a,c.prototype.listenerCount=b,ee}o(requireEe,"requireEe");var hasRequiredLib;function requireLib(){return hasRequiredLib||(hasRequiredLib=1,(function(p){var r=Object.defineProperty,d=o((_,h)=>r(_,"name",{value:h,configurable:!0}),"o"),u=lib&&lib.__createBinding||(Object.create?(function(_,h,g,c){c===void 0&&(c=g);var C=Object.getOwnPropertyDescriptor(h,g);(!C||("get"in C?!h.__esModule:C.writable||C.configurable))&&(C={enumerable:!0,get:d(function(){return h[g]},"get")}),Object.defineProperty(_,c,C)}):(function(_,h,g,c){c===void 0&&(c=g),_[c]=h[g]})),f=lib&&lib.__exportStar||function(_,h){for(var g in _)g!=="default"&&!Object.prototype.hasOwnProperty.call(h,g)&&u(h,_,g)};Object.defineProperty(p,"__esModule",{value:!0}),f(requireTypes(),p),f(requireEe(),p)})(lib)),lib}o(requireLib,"requireLib");var libExports=requireLib();export{libExports as l};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// TODO: Load the spinner names from the JSON file.
|
|
2
|
-
type SpinnerName$1 = 'dots' | 'dots2' | 'dots3' | 'dots4' | 'dots5' | 'dots6' | 'dots7' | 'dots8' | 'dots9' | 'dots10' | 'dots11' | 'dots12' | 'dots13' | 'dots14' | 'dots8Bit' | 'dotsCircle' | 'sand' | 'line' | 'line2' | 'rollingLine' | 'pipe' | 'simpleDots' | 'simpleDotsScrolling' | 'star' | 'star2' | 'flip' | 'hamburger' | 'growVertical' | 'growHorizontal' | 'balloon' | 'balloon2' | 'noise' | 'bounce' | 'boxBounce' | 'boxBounce2' | 'binary' | 'triangle' | 'arc' | 'circle' | 'squareCorners' | 'circleQuarters' | 'circleHalves' | 'squish' | 'toggle' | 'toggle2' | 'toggle3' | 'toggle4' | 'toggle5' | 'toggle6' | 'toggle7' | 'toggle8' | 'toggle9' | 'toggle10' | 'toggle11' | 'toggle12' | 'toggle13' | 'arrow' | 'arrow2' | 'arrow3' | 'bouncingBar' | 'bouncingBall' | 'smiley' | 'monkey' | 'hearts' | 'clock' | 'earth' | 'material' | 'moon' | 'runner' | 'pong' | 'shark' | 'dqpb' | 'weather' | 'christmas' | 'grenade' | 'point' | 'layer' | 'betaWave' | 'fingerDance' | 'fistBump' | 'soccerHeader' | 'mindblown' | 'speaker' | 'orangePulse' | 'bluePulse' | 'orangeBluePulse' | 'timeTravel' | 'aesthetic' | 'dwarfFortress';
|
|
3
|
-
/**
|
|
4
|
-
* Names of custom spinners from Rattles and unicode-animations.
|
|
5
|
-
*/
|
|
6
|
-
type CustomSpinnerName = "breathe" | "cascade" | "checkerboard" | "columns" | "diagSwipe" | "dna" | "doubleArrow" | "fillSweep" | "helix" | "infinity" | "orbit" | "pulse" | "rain" | "scan" | "scanline" | "snake" | "sparkle" | "wave" | "waveRows";
|
|
7
|
-
/**
|
|
8
|
-
* Union of all available spinner names.
|
|
9
|
-
*/
|
|
10
|
-
type SpinnerName = SpinnerName$1 | CustomSpinnerName;
|
|
11
|
-
/**
|
|
12
|
-
* Represents a single frame-based spinner animation.
|
|
13
|
-
*/
|
|
14
|
-
export { SpinnerName as S };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base ANSI Colors
|
|
3
|
-
*/
|
|
4
|
-
type AnsiColors = "bgBlack" | "bgBlackBright" | "bgBlue" | "bgBlueBright" | "bgCyan" | "bgCyanBright" | "bgGray" | "bgGreen" | "bgGreenBright" | "bgGrey" | "bgMagenta" | "bgMagentaBright" | "bgRed" | "bgRedBright" | "bgWhite" | "bgWhiteBright" | "bgYellow" | "bgYellowBright" | "black" | "blackBright" | "blue" | "blueBright" | "cyan" | "cyanBright" | "gray" | "green" | "greenBright" | "grey" | "magenta" | "magentaBright" | "red" | "redBright" | "white" | "whiteBright" | "yellow" | "yellowBright";
|
|
5
|
-
export { AnsiColors as A };
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
type Listener = (...args: any[]) => Promise<any> | void;
|
|
2
|
-
type DefaultEventMap = { [event in (string | symbol)]: Listener } & {
|
|
3
|
-
/**
|
|
4
|
-
* __proto__ key not allowed due to implementation
|
|
5
|
-
* add prefix, if you want to use this keyword
|
|
6
|
-
*/
|
|
7
|
-
__proto__?: never;
|
|
8
|
-
};
|
|
9
|
-
interface IEventEmitter<EventMap extends DefaultEventMap = DefaultEventMap> {
|
|
10
|
-
emit<EventKey extends keyof EventMap>(event: EventKey, ...args: Parameters<EventMap[EventKey]>): boolean;
|
|
11
|
-
on<EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]): this;
|
|
12
|
-
once<EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]): this;
|
|
13
|
-
addListener<EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]): this;
|
|
14
|
-
removeListener<EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]): this;
|
|
15
|
-
prependListener<EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]): this;
|
|
16
|
-
prependOnceListener<EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]): this;
|
|
17
|
-
off<EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]): this;
|
|
18
|
-
removeAllListeners<EventKey extends keyof EventMap = string>(event?: EventKey): this;
|
|
19
|
-
setMaxListeners(n: number): this;
|
|
20
|
-
getMaxListeners(): number;
|
|
21
|
-
listeners<EventKey extends keyof EventMap = string>(event: EventKey): EventMap[EventKey][];
|
|
22
|
-
rawListeners<EventKey extends keyof EventMap = string>(event: EventKey): EventMap[EventKey][];
|
|
23
|
-
eventNames(): Array<string | symbol>;
|
|
24
|
-
listenerCount<EventKey extends keyof EventMap = string>(type: EventKey): number;
|
|
25
|
-
}
|
|
26
|
-
type ArgsNum<T extends (...args: any[]) => any> = T extends ((...args: infer K) => any) ? K["length"] : never;
|
|
27
|
-
declare class TaskCollection<Func extends (...args: any) => void, AwaitTasks extends true | false = false> {
|
|
28
|
-
readonly awaitTasks: AwaitTasks;
|
|
29
|
-
constructor(argsNum: ArgsNum<Func>, autoRebuild?: boolean, initialTasks?: (Func[]) | Func | null, awaitTasks?: AwaitTasks);
|
|
30
|
-
/** DO NOT CHANGE DIRECTLY */
|
|
31
|
-
_tasks: (Func[]) | Func | null;
|
|
32
|
-
/** cached */
|
|
33
|
-
length: number;
|
|
34
|
-
/** auto rebuild on first emit call; otherwise autorebuild on every change */
|
|
35
|
-
firstEmitBuildStrategy: boolean;
|
|
36
|
-
readonly argsNum: ArgsNum<Func>;
|
|
37
|
-
autoRebuild: boolean;
|
|
38
|
-
readonly growArgsNum: typeof growArgsNum;
|
|
39
|
-
setAutoRebuild: typeof setAutoRebuild;
|
|
40
|
-
call: (...args: Parameters<Func>) => (AwaitTasks extends true ? Promise<void> : void);
|
|
41
|
-
rebuild: () => void;
|
|
42
|
-
push: (...func: Func[]) => void;
|
|
43
|
-
/** remove last matched task from tasks */
|
|
44
|
-
removeLast: (func: Func) => void;
|
|
45
|
-
insert: (index: number, ...func: Func[]) => void;
|
|
46
|
-
setTasks: (tasks: Func[]) => void;
|
|
47
|
-
tasksAsArray: () => Func[];
|
|
48
|
-
/** this autorebuilds */
|
|
49
|
-
readonly clear: typeof clear;
|
|
50
|
-
/** this autorebuilds */
|
|
51
|
-
readonly fastClear: typeof fastClear;
|
|
52
|
-
}
|
|
53
|
-
declare function fastClear<Func extends (...args: any) => void, AwaitTasks extends true | false = false>(this: TaskCollection<Func, AwaitTasks>): void;
|
|
54
|
-
declare function clear<Func extends (...args: any) => void, AwaitTasks extends true | false = false>(this: TaskCollection<Func, AwaitTasks>): void;
|
|
55
|
-
declare function growArgsNum<Func extends (...args: any) => void, AwaitTasks extends true | false = false>(this: TaskCollection<Func, AwaitTasks>, argsNum: number): void;
|
|
56
|
-
declare function setAutoRebuild<Func extends (...args: any) => void, AwaitTasks extends true | false = false>(this: TaskCollection<Func, AwaitTasks>, newVal: boolean): void;
|
|
57
|
-
/** Implemented event emitter */
|
|
58
|
-
declare class EventEmitter<EventMap extends DefaultEventMap = DefaultEventMap> implements IEventEmitter<EventMap> {
|
|
59
|
-
events: { [eventName in keyof EventMap]?: TaskCollection<EventMap[eventName]> };
|
|
60
|
-
onceEvents: { [eventName in keyof EventMap]?: (EventMap[eventName][]) | EventMap[eventName] };
|
|
61
|
-
boundFuncs: undefined | Map<Function, Function>;
|
|
62
|
-
_symbolKeys: Set<symbol>;
|
|
63
|
-
maxListeners: number;
|
|
64
|
-
get _eventsCount(): number;
|
|
65
|
-
emit: <EventKey extends keyof EventMap>(event: EventKey, ...args: Parameters<EventMap[EventKey]>) => boolean;
|
|
66
|
-
on: <EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]) => this;
|
|
67
|
-
once: <EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]) => this;
|
|
68
|
-
addListener: <EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey], argsNum?: ArgsNum<EventMap[EventKey]>) => this;
|
|
69
|
-
removeListener: <EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]) => this;
|
|
70
|
-
hasListeners: <EventKey extends keyof EventMap = string>(event: EventKey) => boolean;
|
|
71
|
-
prependListener: <EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]) => this;
|
|
72
|
-
prependOnceListener: <EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]) => this;
|
|
73
|
-
off: <EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]) => this;
|
|
74
|
-
removeAllListeners: <EventKey extends keyof EventMap = string>(event?: EventKey) => this;
|
|
75
|
-
setMaxListeners: (n: number) => this;
|
|
76
|
-
getMaxListeners: () => number;
|
|
77
|
-
listeners: <EventKey extends keyof EventMap = string>(event: EventKey) => EventMap[EventKey][];
|
|
78
|
-
rawListeners: <EventKey extends keyof EventMap = string>(event: EventKey) => EventMap[EventKey][];
|
|
79
|
-
eventNames: () => Array<string | symbol>;
|
|
80
|
-
listenerCount: <EventKey extends keyof EventMap = string>(type: EventKey) => number;
|
|
81
|
-
addListenerBound: <EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey], bindTo?: any, argsNum?: ArgsNum<EventMap[EventKey]>) => this;
|
|
82
|
-
removeListenerBound: <EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]) => this;
|
|
83
|
-
}
|
|
84
|
-
declare class TuiApp extends EventEmitter {
|
|
85
|
-
private renderer;
|
|
86
|
-
private terminal;
|
|
87
|
-
private backBuffer;
|
|
88
|
-
private width;
|
|
89
|
-
private height;
|
|
90
|
-
private isRunning;
|
|
91
|
-
private stdoutBuffer;
|
|
92
|
-
private stderrBuffer;
|
|
93
|
-
constructor();
|
|
94
|
-
/** Enters raw mode + alternate screen. Does NOT start any render loop. */
|
|
95
|
-
start(): void;
|
|
96
|
-
/** Request a clean exit — restores terminal, stops input, exits the process. */
|
|
97
|
-
quit(): void;
|
|
98
|
-
/** Exits raw mode + alternate screen, then flushes any buffered stdout/stderr. */
|
|
99
|
-
stop(): void;
|
|
100
|
-
/**
|
|
101
|
-
* Buffer a write to stdout. While the alternate screen is active, writing
|
|
102
|
-
* directly would corrupt the TUI. Buffered output is flushed on stop().
|
|
103
|
-
*/
|
|
104
|
-
writeStdout(text: string): void;
|
|
105
|
-
/**
|
|
106
|
-
* Buffer a write to stderr. While the alternate screen is active, writing
|
|
107
|
-
* directly would corrupt the TUI. Buffered output is flushed on stop().
|
|
108
|
-
*/
|
|
109
|
-
writeStderr(text: string): void;
|
|
110
|
-
/** Returns the shared Uint32Array back-buffer (width * height * 2 u32 cells). */
|
|
111
|
-
getBuffer(): Uint32Array;
|
|
112
|
-
/** Returns current terminal dimensions. */
|
|
113
|
-
getSize(): {
|
|
114
|
-
height: number;
|
|
115
|
-
width: number;
|
|
116
|
-
};
|
|
117
|
-
/** Update terminal dimensions (called on SIGWINCH). */
|
|
118
|
-
resize(width: number, height: number): void;
|
|
119
|
-
/**
|
|
120
|
-
* Callbacks fired on every frame after React paints the buffer but before
|
|
121
|
-
* the Rust diff engine flushes to stdout. Use for direct buffer painting
|
|
122
|
-
* that needs to overlay React output (animated graphs, overlays, FPS counters).
|
|
123
|
-
* Multiple listeners are supported — they fire in registration order.
|
|
124
|
-
*/
|
|
125
|
-
private beforeFlushListeners;
|
|
126
|
-
onBeforeFlush(function_: (buffer: Uint32Array, width: number, height: number) => void): () => void;
|
|
127
|
-
/**
|
|
128
|
-
* Layout + paint synchronously. Called from the render loop on every dirty frame,
|
|
129
|
-
* and directly on resize for immediate response.
|
|
130
|
-
*/
|
|
131
|
-
paintNow(calculateLayout: (w: number, h: number) => void, renderToBuffer: (buf: Uint32Array, w: number, h: number) => void): void;
|
|
132
|
-
}
|
|
133
|
-
interface InlineOptions {
|
|
134
|
-
/** Frames per second. Default: 60 */
|
|
135
|
-
fps?: number;
|
|
136
|
-
/**
|
|
137
|
-
* What to do with the rendered content when the loop stops.
|
|
138
|
-
* - 'preserve' (default) — content stays in terminal scrollback
|
|
139
|
-
* - 'destroy' — content is cleared, terminal looks untouched
|
|
140
|
-
*/
|
|
141
|
-
onExit?: "preserve" | "destroy";
|
|
142
|
-
/** Number of terminal rows to reserve. Default: 10 */
|
|
143
|
-
rows?: number;
|
|
144
|
-
}
|
|
145
|
-
type InlinePaintFn = (buf: Uint32Array, cols: number, rows: number, frame: number) => void;
|
|
146
|
-
interface InlineLoop {
|
|
147
|
-
start: () => void;
|
|
148
|
-
stop: () => void;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Create an inline render loop. Renders `rows` lines immediately below the
|
|
152
|
-
* current cursor position (no alternate screen).
|
|
153
|
-
*/
|
|
154
|
-
declare function createInlineLoop(paint: InlinePaintFn, options?: InlineOptions): InlineLoop;
|
|
155
|
-
interface MouseEvent {
|
|
156
|
-
button: "left" | "right" | "middle" | "scrollUp" | "scrollDown";
|
|
157
|
-
ctrl: boolean;
|
|
158
|
-
meta: boolean;
|
|
159
|
-
shift: boolean;
|
|
160
|
-
x: number;
|
|
161
|
-
y: number;
|
|
162
|
-
}
|
|
163
|
-
declare class InputParser extends EventEmitter {
|
|
164
|
-
private stdin;
|
|
165
|
-
private _boundHandleData;
|
|
166
|
-
private _pasteBuffer;
|
|
167
|
-
constructor(stdin: NodeJS.ReadStream);
|
|
168
|
-
start(): void;
|
|
169
|
-
stop(): void;
|
|
170
|
-
private handleData;
|
|
171
|
-
}
|
|
172
|
-
export { InlineLoop as I, MouseEvent as M, TuiApp as T, InlineOptions as a, InlinePaintFn as b, InputParser as c, createInlineLoop as d };
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var X=Object.defineProperty;var k=(n,t)=>X(n,"name",{value:t,configurable:!0});import{v as Y,c as Z,o as tt}from"./get-string-width-CbMPWEJO.js";import{t as et}from"./ansi-tokenizer-DqX9nJuk.js";var st=Object.defineProperty,at=k((n,t)=>st(n,"name",{value:t,configurable:!0}),"r$2"),nt=Object.defineProperty,rt=at((n,t)=>nt(n,"name",{value:t,configurable:!0}),"a"),it=Object.defineProperty,ht=rt((n,t)=>it(n,"name",{value:t,configurable:!0}),"i");const lt=ht(n=>Number.isInteger(n)?Y(n)||Z(n):!1,"isFullwidthCodePoint");var ot=Object.defineProperty,ct=k((n,t)=>ot(n,"name",{value:t,configurable:!0}),"r$1");let H=class{static{k(this,"h")}static{ct(this,"DataLimitedLruMap")}map;maxDataSize;maxKeys;currentDataSize=0;constructor(t,e){this.map=new Map,this.maxKeys=t,this.maxDataSize=e}get size(){return this.map.size}clear(){this.map.clear(),this.currentDataSize=0}get(t){if(!this.map.has(t))return;const e=this.map.get(t);return this.map.delete(t),this.map.set(t,e),e}set(t,e){const s=t.length;if(!(s>this.maxDataSize)){for(this.map.has(t)&&(this.map.delete(t),this.currentDataSize-=s);this.currentDataSize+s>this.maxDataSize&&this.map.size>0;){const a=this.map.keys().next().value;if(a===void 0)break;this.map.delete(a),this.currentDataSize-=a.length}for(;this.map.size>=this.maxKeys;){const a=this.map.keys().next().value;if(a===void 0)break;this.map.delete(a),this.currentDataSize-=a.length}this.map.set(t,e),this.currentDataSize+=s}}};const gt=1,ft=2,E=4,K=8,R=16,M=32,V=64,S=128;var ut=Object.defineProperty,dt=k((n,t)=>ut(n,"name",{value:t,configurable:!0}),"x");const p=1073741823,x=1073741824;class d{static{k(this,"StyledLine")}static{dt(this,"StyledLine")}length=0;static emptyCache=new Map;text;charData;spans;_cachedTrimmedLength;static empty(t){if(t<=0)return new d;const e=d.emptyCache.get(t);if(e)return e.clone();const s=new d;s.length=t,s.text=" ".repeat(t),s.charData=Array.from({length:t});for(let a=0;a<t;a++)s.charData[a]=a;return s.spans=[{formatFlags:0,length:t}],s._cachedTrimmedLength=0,Object.freeze(s.spans[0]),Object.freeze(s.spans),Object.freeze(s),d.emptyCache.set(t,s),s.clone()}getValue(t){if(this.text===void 0||t<0||t>=this.length)return"";const e=this.charData[t]&p,s=t+1<this.length?this.charData[t+1]&p:this.text.length;return this.text.slice(e,s)}getTextRange(t,e){if(this.text===void 0||t<0||e>this.length||t>=e)return"";const s=this.charData[t]&p,a=e<this.length?this.charData[e]&p:this.text.length;return this.text.slice(s,a)}getSpan(t){if(this.spans===void 0||t<0||t>=this.length)return;let e=0;for(const s of this.spans){if(t<e+s.length)return s;e+=s.length}}getFullWidth(t){return this.charData===void 0||t<0||t>=this.length?!1:(this.charData[t]&x)!==0}hasStyles(t){const e=this.getSpan(t);return e?(e.formatFlags&~S)!==0||e.fgColor!==void 0||e.bgColor!==void 0||e.link!==void 0:!1}getFormatFlags(t){let e=this.getSpan(t)?.formatFlags??0;return this.getFullWidth(t)&&(e|=S),e}getFgColor(t){return this.getSpan(t)?.fgColor}getBgColor(t){return this.getSpan(t)?.bgColor}getLink(t){return this.getSpan(t)?.link}setInverted(t,e){this._cachedTrimmedLength=void 0,this.updateSpanAt(t,s=>{e?s.formatFlags|=M:s.formatFlags&=~M})}setBackgroundColor(t,e){this._cachedTrimmedLength=void 0,this.updateSpanAt(t,s=>{s.bgColor=e})}setForegroundColor(t,e){this._cachedTrimmedLength=void 0,this.updateSpanAt(t,s=>{s.fgColor=e})}setChar(t,e,s,a,r,h){if(t<0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const i=(s&S)!==0,o=s&~S,l=this.charData[t]&p,c=t+1<this.length?this.charData[t+1]&p:this.text.length,m=c-l,b=e.length;if(this.text=this.text.slice(0,l)+e+this.text.slice(c),m!==b){const f=b-m;for(let v=t+1;v<this.length;v++){const T=this.charData[v],w=T&p,L=T&x;this.charData[v]=w+f|L}}if(this.charData[t]=l|(i?x:0),this.trySetStyleAtIndex(t,o,a,r,h))return;this.splitSpansAt(t),this.splitSpansAt(t+1);let u=0;for(let f=0;f<this.spans.length;f++){const v=this.spans[f];if(u===t&&v.length===1){this.spans[f]={bgColor:r,fgColor:a,formatFlags:o,length:1,link:h};break}u+=v.length}this.mergeSpans()}setCharFast(t,e,s,a,r,h){if(t<0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const i=(s&S)!==0,o=s&~S,l=this.charData[t]&p,c=t+1<this.length?this.charData[t+1]&p:this.text.length,m=c-l;if(e.length===m)e!==this.text.slice(l,c)&&(this.text=this.text.slice(0,l)+e+this.text.slice(c)),this.charData[t]=l|(i?x:0);else{if(this.text=this.text.slice(0,l)+e+this.text.slice(c),m!==e.length){const u=e.length-m;for(let f=t+1;f<this.length;f++){const v=this.charData[f];this.charData[f]=(v&p)+u|v&x}}this.charData[t]=l|(i?x:0)}if(this.trySetStyleAtIndex(t,o,a,r,h))return;this.splitSpansAt(t),this.splitSpansAt(t+1);let b=0;for(let u=0;u<this.spans.length;u++){const f=this.spans[u];if(b===t&&f.length===1){this.spans[u]={bgColor:r,fgColor:a,formatFlags:o,length:1,link:h};break}b+=f.length}this.mergeSpans()}writeFrom(t,e,s=0,a){const r=a??e.length-s;if(r<=0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const h=Math.min(r,this.length-t,e.length-s),i=this.charData[t]&p,o=t+h<this.length?this.charData[t+h]&p:this.text.length;let l="";for(let g=0;g<h;g++)l+=e.getValue(s+g);const c=o-i,m=l.length-c;this.text=this.text.slice(0,i)+l+this.text.slice(o);let b=i;for(let g=0;g<h;g++){const D=e.getFullWidth(s+g);this.charData[t+g]=b|(D?x:0),b+=e.getValue(s+g).length}if(m!==0)for(let g=t+h;g<this.length;g++){const D=this.charData[g];this.charData[g]=(D&p)+m|D&x}this.splitSpansAt(t),this.splitSpansAt(t+h);const u=[];let f=0;for(const g of e.getSpans()){const D=f+g.length,P=Math.max(s,f),j=Math.min(s+h,D);if(P<j&&u.push({...g,length:j-P}),f=D,f>=s+h)break}let v=0,T=0;for(let g=0;g<this.spans.length;g++){if(T===t){v=g;break}T+=this.spans[g].length}let w=0,L=0;for(let g=v;g<this.spans.length&&L<h;g++)L+=this.spans[g].length,w++;this.spans.splice(v,w,...u),this.mergeSpans()}pushChar(t,e,s,a,r){this._cachedTrimmedLength=void 0,this.ensureInitialized();const h=(e&S)!==0,i=e&~S,o=this.text.length;this.text=(this.text??"")+t,this.charData.push(o|(h?x:0));const l=this.spans.at(-1);l?.formatFlags===i&&l.fgColor===s&&l.bgColor===a&&l.link===r?l.length++:this.spans.push({bgColor:a,fgColor:s,formatFlags:i,length:1,link:r}),this.length++}clone(){if(this.charData===void 0)return new d;const t=new d;return t.length=this.length,t.text=this.text,t.charData=[...this.charData],t.spans=this.spans.map(e=>({...e})),t._cachedTrimmedLength=this._cachedTrimmedLength,t}slice(t,e){if(this.charData===void 0)return new d;const s=Math.max(0,t),a=e===void 0?this.length:Math.min(this.length,e);if(s>=a)return new d;if(s===0&&a===this.length)return this.clone();const r=new d;r.length=a-s,r.charData=Array.from({length:r.length});const h=this.charData[s]&p,i=a<this.length?this.charData[a]&p:this.text.length;r.text=this.text.slice(h,i);for(let c=0;c<r.length;c++){const m=this.charData[s+c],b=m&p,u=m&x;r.charData[c]=b-h|u}const o=[];let l=0;for(const c of this.spans){const m=l,b=l+c.length,u=Math.max(s,m),f=Math.min(a,b);if(u<f&&o.push({...c,length:f-u}),l+=c.length,l>=a)break}return r.spans=o,r.mergeSpans(),r}combine(...t){if(t.length===0)return this.clone();const e=[this,...t].filter(i=>i.length>0);if(e.length===0)return new d;if(e.length===1)return e[0].clone();let s=0;for(const i of e)s+=i.length;const a=new d;a.length=s,a.text=e.map(i=>i.getText()).join(""),a.charData=Array.from({length:s});let r=0,h=0;for(const i of e){const o=i.charData,l=i.getText();if(o)for(let c=0;c<i.length;c++){const m=o[c],b=m&p,u=m&x;a.charData[r+c]=h+b|u}else for(let c=0;c<i.length;c++)a.charData[r+c]=h+c;r+=i.length,h+=l.length}return a.spans=e.flatMap(i=>i.getSpans().map(o=>({...o}))),a.mergeSpans(),a}getTrimmedLength(){if(this._cachedTrimmedLength!==void 0)return this._cachedTrimmedLength;if(this.length===0)return this._cachedTrimmedLength=0,0;if(this.text===void 0||this.charData===void 0)return this._cachedTrimmedLength=0,0;let t=this.length-1;if(this.spans)for(let e=this.spans.length-1;e>=0;e--){const s=this.spans[e];if((s.formatFlags&~S)!==0||s.fgColor!==void 0||s.bgColor!==void 0||s.link!==void 0)return this._cachedTrimmedLength=t+1,this._cachedTrimmedLength;for(let a=0;a<s.length;a++){const r=this.charData[t]&p;if((t+1<this.length?this.charData[t+1]&p:this.text.length)-r!==1||this.text[r]!==" ")return this._cachedTrimmedLength=t+1,this._cachedTrimmedLength;t--}}return this._cachedTrimmedLength=0,0}trimEnd(){const t=this.getTrimmedLength();return t===this.length?this:t===0?new d:this.slice(0,t)}equals(t){if(this.length!==t.length)return!1;if(this.length===0)return!0;if(this.getText()!==t.getText())return!1;const e=this.getSpans(),s=t.getSpans();if(e.length!==s.length)return!1;for(const[h,i]of e.entries()){const o=i,l=s[h];if(o.length!==l.length||o.formatFlags!==l.formatFlags||o.fgColor!==l.fgColor||o.bgColor!==l.bgColor||o.link!==l.link)return!1}const a=this.charData,r=t.charData;if(a&&r){for(let h=0;h<this.length;h++)if(a[h]!==r[h])return!1}return!0}getText(){return this.text??""}getSpans(){return this.spans??[]}getValues(){return Array.from({length:this.length},(t,e)=>this.getValue(e))}*[Symbol.iterator](){if(this.length===0)return;let t=0,e=0;const s=this.getSpans();for(let a=0;a<this.length;a++){const r=s[t],h=r?r.formatFlags:0,i=this.getFullWidth(a);yield{bgColor:r?.bgColor,fgColor:r?.fgColor,formatFlags:h|(i?S:0),fullWidth:i,hasStyles:(h&~S)!==0||r?.fgColor!==void 0||r?.bgColor!==void 0||r?.link!==void 0,link:r?.link,value:this.getValue(a)},r&&(e++,e>=r.length&&(t++,e=0))}}updateSpanAt(t,e){if(t<0||t>=this.length)return;this.ensureInitialized(),this.splitSpansAt(t),this.splitSpansAt(t+1);let s=0;for(const a of this.spans){if(s===t&&a.length===1){e(a);break}s+=a.length}this.mergeSpans()}ensureWidth(t){if(t<=this.length)return;this.ensureInitialized();const e=this.length,s=t-e,a=this.text.length;for(let h=0;h<s;h++)this.charData.push(a);this.length=t;const r=this.spans.at(-1);r?.formatFlags===0&&r.fgColor===void 0&&r.bgColor===void 0&&r.link===void 0?r.length+=s:this.spans.push({formatFlags:0,length:s})}ensureInitialized(){if(this.charData===void 0&&(this.text="",this.charData=Array.from({length:this.length}),this.spans=this.length>0?[{formatFlags:0,length:this.length}]:[],this.length>0&&this.text.length===0)){this.text=" ".repeat(this.length);for(let t=0;t<this.length;t++)this.charData[t]=t}}splitSpansAt(t){if(this.spans===void 0||t<=0||t>=this.length)return;let e=0;for(let s=0;s<this.spans.length;s++){const a=this.spans[s];if(t>e&&t<e+a.length){const r=t-e,h=a.length-r;this.spans.splice(s,1,{...a,length:r},{...a,length:h});return}e+=a.length}}trySetStyleAtIndex(t,e,s,a,r){if(!this.spans)return!1;let h=0,i=-1,o;for(let l=0;l<this.spans.length;l++){const c=this.spans[l];if(h<=t&&h+c.length>t){i=l,o=c;break}h+=c.length}if(!o)return!1;if(o.formatFlags===e&&o.fgColor===s&&o.bgColor===a&&o.link===r)return!0;if(t===h&&i>0){const l=this.spans[i-1];if(l.formatFlags===e&&l.fgColor===s&&l.bgColor===a&&l.link===r)return l.length+=1,o.length===1?this.spans.splice(i,1):o.length-=1,!0}if(t===h+o.length-1&&i<this.spans.length-1){const l=this.spans[i+1];if(l.formatFlags===e&&l.fgColor===s&&l.bgColor===a&&l.link===r)return l.length+=1,o.length===1?this.spans.splice(i,1):o.length-=1,!0}return!1}mergeSpans(){if(this.spans===void 0)return;const t=[];for(const e of this.spans){if(e.length===0)continue;const s=t.at(-1);s?.formatFlags===e.formatFlags&&s.fgColor===e.fgColor&&s.bgColor===e.bgColor&&s.link===e.link?s.length+=e.length:t.push({...e})}this.spans=t}}var mt=Object.defineProperty,$=k((n,t)=>mt(n,"name",{value:t,configurable:!0}),"u$1");const G={black:0,blue:4,cyan:6,gray:8,green:2,grey:8,magenta:5,red:1,white:7,yellow:3},U={blackBright:8,blueBright:12,cyanBright:14,greenBright:10,magentaBright:13,redBright:9,whiteBright:15,yellowBright:11},q=/^ansi256\(\s?(\d+)\s?\)$/,J=/^rgb\(\s?(\d+),\s?(\d+),\s?(\d+)\s?\)$/,Et=$(n=>{const t=G[n];if(t!==void 0)return t;const e=U[n];if(e!==void 0)return e;const s=q.exec(n);if(s)return Number(s[1])&255;if(n.startsWith("#")&&n.length===7){const r=Number.parseInt(n.slice(1,3),16),h=Number.parseInt(n.slice(3,5),16),i=Number.parseInt(n.slice(5,7),16);return 16+36*Math.round(r/51)+6*Math.round(h/51)+Math.round(i/51)}const a=J.exec(n);return a?16+36*Math.round(Number(a[1])/51)+6*Math.round(Number(a[2])/51)+Math.round(Number(a[3])/51):255},"colorToAnsi256"),pt=$((n,t)=>{const e=t?30:40,s=G[n];if(s!==void 0)return[e+s];const a=U[n];if(a!==void 0)return[e+60+(a-8)];if(n.startsWith("#")&&n.length===7){const i=Number.parseInt(n.slice(1,3),16),o=Number.parseInt(n.slice(3,5),16),l=Number.parseInt(n.slice(5,7),16);return[t?38:48,2,i,o,l]}const r=q.exec(n);if(r)return[t?38:48,5,Number(r[1])];const h=J.exec(n);return h?[t?38:48,2,Number(h[1]),Number(h[2]),Number(h[3])]:[]},"colorToSgrParams");$((n,t)=>{const e=pt(n,t);if(e.length!==0)return`\x1B[${e.join(";")}m`},"colorToAnsiCode");const A=$(n=>{const t=["black","red","green","yellow","blue","magenta","cyan","white"];return n>=0&&n<=7?t[n]:`ansi256(${n})`},"ansi256ToColorName");var bt=Object.defineProperty,y=k((n,t)=>bt(n,"name",{value:t,configurable:!0}),"u");const O=y(()=>({bgColor:void 0,fgColor:void 0,formatFlags:0,link:void 0}),"createSgrState"),vt=y((n,t)=>{if(t.length===0)return O();const e=(t.includes(":")?t.replaceAll(":",";"):t).split(";").filter(o=>o.length>0).map(Number);let{bgColor:s,fgColor:a,formatFlags:r,link:h}=n,i=0;for(;i<e.length;){const o=e[i];switch(o){case 0:{r=0,a=void 0,s=void 0,h=void 0;break}case 1:{r|=gt;break}case 2:{r|=ft;break}case 3:{r|=E;break}case 4:{r|=K;break}case 7:{r|=M;break}case 8:{r|=V;break}case 9:{r|=R;break}case 22:{r&=-4;break}case 23:{r&=~E;break}case 24:{r&=~K;break}case 27:{r&=~M;break}case 28:{r&=~V;break}case 29:{r&=~R;break}case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:{a=A(o-30);break}case 38:{e[i+1]===5&&e[i+2]!==void 0?(a=A(e[i+2]),i+=2):e[i+1]===2&&i+4<e.length&&(a=`rgb(${e[i+2]}, ${e[i+3]}, ${e[i+4]})`,i+=4);break}case 39:{a=void 0;break}case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:{s=A(o-40);break}case 48:{e[i+1]===5&&e[i+2]!==void 0?(s=A(e[i+2]),i+=2):e[i+1]===2&&i+4<e.length&&(s=`rgb(${e[i+2]}, ${e[i+3]}, ${e[i+4]})`,i+=4);break}case 49:{s=void 0;break}case 90:case 91:case 92:case 93:case 94:case 95:case 96:case 97:{a=`ansi256(${o-90+8})`;break}case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:{s=`ansi256(${o-100+8})`;break}}i++}return{bgColor:s,fgColor:a,formatFlags:r,link:h}},"applySgrParams"),I=127462,z=127487,St=127995,xt=127999,Ct=8205,kt=917504,Dt=917631,yt=new RegExp("\\p{Mark}","u"),Tt=new Intl.Segmenter(void 0,{granularity:"grapheme"}),Ft=y((n,t)=>!!(lt(t)||n.includes("️")||t>=I&&t<=z),"isFullwidthGrapheme"),wt=/(?:\u001B\]|\u009D)8;([^;]*);(.*?)(?:\u001B\\|\u0007|\u009C)/,Lt=y(n=>{const t=wt.exec(n);return!t?.[2]||t[2].length===0?void 0:n.endsWith("\x1B\\")?`ST:${t[2]}`:t[2]},"parseOscHyperlink"),Q=y((n,t,e)=>{const s=Tt.segment(n),a=[];for(const{segment:r}of s)a.push(r);for(let r=0;r<a.length;r++){let h=a[r];if(h===" "){for(let l=0;l<4;l++)t.pushChar(" ",e.formatFlags,e.fgColor,e.bgColor,e.link);continue}if(h==="\b")continue;const i=h.codePointAt(0);if(!i)continue;if(i>=I&&i<=z&&r+1<a.length){const l=a[r+1],c=l.codePointAt(0);c&&c>=I&&c<=z&&(h+=l,r++)}else for(;r+1<a.length;){const l=a[r+1],c=l.codePointAt(0);if(!c)break;const m=yt.test(String.fromCodePoint(c)),b=c>=St&&c<=xt,u=c===Ct,f=c>=kt&&c<=Dt;if(!m&&!b&&!u&&!f)break;h+=l,r++,u&&r+1<a.length&&(h+=a[r+1],r++)}const o=Ft(h,i)?e.formatFlags|S:e.formatFlags;t.pushChar(h,o,e.fgColor,e.bgColor,e.link)}},"processTextToken"),At=y(n=>{if(n.length===0)return new d;const t=et(n),e=new d;let s=O();for(const a of t)switch(a.type){case"csi":{a.finalCharacter==="m"&&(s=vt(s,a.parameterString));break}case"osc":{const r=Lt(a.value);r!==void 0?s={...s,link:r}:a.value.includes("8;")&&(s={...s,link:void 0});break}case"text":{Q(a.value,e,s);break}}return e},"textToStyledLine"),Mt=/^[\u0020-\u007E]*$/,Kt=y(n=>{if(n.length===0)return new d;const t=new d;if(Mt.test(n)){for(const e of n)t.pushChar(e,0);return t}return Q(n,t,O()),t},"plainTextToStyledLine");var $t=Object.defineProperty,C=k((n,t)=>$t(n,"name",{value:t,configurable:!0}),"r");const N=new H(1e4,1e6),B=new Map,F=new H(1e4,1e6);let W=!0,_=tt;const Rt=C(n=>{W=n,n||F.clear()},"setEnableStyledLineCache"),Vt=C(()=>{F.clear()},"clearStyledLineCache"),Ht=C(n=>{_=n,It()},"setStringWidthFunction"),It=C(()=>{N.clear(),B.clear(),F.clear()},"clearStringWidthCache"),zt=C(n=>{if(n.length===1){const s=n.codePointAt(0);if(s!==void 0&&s>=32&&s<127)return 1}const t=B.get(n);if(t!==void 0)return t;let e;try{e=_(n)}catch{e=1}return B.set(n,e),e},"inkCharacterWidth"),Nt=C(n=>{try{return _(n)}catch{return 1}},"safeGetStringWidth"),Gt=C(n=>{if(n.length===0)return{height:0,width:0};const t=N.get(n);if(t)return t;const e=n.split(`
|
|
2
|
-
`),s=Math.max(...e.map(r=>Nt(r))),a={height:e.length,width:s};return N.set(n,a),a},"measureText"),Ut=C(n=>{if(W){const e=F.get(n);if(e!==void 0)return e}const t=At(n);return W&&F.set(n,t),t},"toStyledLine"),Bt=C(n=>{let t=0;for(let e=0;e<n.length;e++)t+=zt(n.getValue(e));return t},"styledLineWidth"),Wt=C(n=>{if(n.length===0)return[new d];const t=[];let e=0;for(let s=0;s<n.length;s++)n.getValue(s)===`
|
|
3
|
-
`&&(t.push(s>e?n.slice(e,s):new d),e=s+1);return t.push(e<n.length?n.slice(e):new d),t},"splitStyledLineByNewline"),qt=C(n=>{if(n.length===0)return{height:0,width:0};const t=Wt(n);let e=0;for(const s of t)e=Math.max(e,Bt(s));return{height:t.length,width:e}},"measureStyledLine");export{gt as B,ft as D,S as F,V as H,E as I,d as S,K as U,Vt as a,Ht as b,It as c,Bt as d,Gt as e,M as f,R as g,pt as h,zt as i,Et as j,At as k,lt as l,qt as m,Wt as n,Kt as p,Rt as s,Ut as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var $=Object.defineProperty;var d=(e,o)=>$(e,"name",{value:o,configurable:!0});import{a}from"./constants-D12jy2Zh-RSfxu1eM.js";var f=Object.defineProperty,u=d((e,o)=>f(e,"name",{value:o,configurable:!0}),"i"),p=Object.defineProperty,M=u((e,o)=>p(e,"name",{value:o,configurable:!0}),"u"),S=Object.defineProperty,r=M((e,o)=>S(e,"name",{value:o,configurable:!0}),"s");class y{static{d(this,"j")}static{u(this,"h")}static{M(this,"g")}static{r(this,"AnsiModeImpl")}code;isDecMode=!1;constructor(o){this.code=o}}class R{static{d(this,"X")}static{u(this,"g")}static{M(this,"u")}static{r(this,"DecModeImpl")}code;isDecMode=!0;constructor(o){this.code=o}}const m=r((e,...o)=>{if(o.length===0)return"";const i=e?"l":"h";if(o.length===1){const n=o[0];let h=a;return n.isDecMode&&(h+="?"),h+String(n.code)+i}const c=o.filter(n=>!n.isDecMode).map(n=>n.code),g=o.filter(n=>n.isDecMode).map(n=>n.code);let l="";return c.length>0&&(l+=`${a}${c.join(";")}${i}`),g.length>0&&(l+=`${a}?${g.join(";")}${i}`),l},"generateModeSequence");var D=(e=>(e[e.NotRecognized=0]="NotRecognized",e[e.Set=1]="Set",e[e.Reset=2]="Reset",e[e.PermanentlySet=3]="PermanentlySet",e[e.PermanentlyReset=4]="PermanentlyReset",e))(D||{});r(e=>e===0,"isModeNotRecognized");r(e=>e===1||e===3,"isModeSet");r(e=>e===2||e===4,"isModeReset");r(e=>e===3,"isModePermanentlySet");r(e=>e===4,"isModePermanentlyReset");const s=r(e=>new y(e),"createAnsiMode"),t=r(e=>new R(e),"createDecMode"),b=r((...e)=>m(!1,...e),"setMode"),j=r((...e)=>m(!0,...e),"resetMode");r(e=>{let o=a;return e.isDecMode&&(o+="?"),`${o}${String(e.code)}$p`},"requestMode");r((e,o)=>{let i=o;(o<0||o>4)&&(i=0);let c=a;return e.isDecMode&&(c+="?"),`${c}${String(e.code)};${String(i)}$y`},"reportMode");s(2);s(4);s(8);s(12);s(20);t(1);t(6);t(7);t(9);t(25);t(66);t(67);t(69);t(1e3);t(1001);t(1002);t(1003);t(1004);t(1005);t(1006);t(1015);t(1016);t(1035);t(1047);t(1048);t(1049);const z=t(2004);t(2026);t(2027);t(9001);t(2031);t(2048);export{z as e,j as g,b as h,t as o};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./ansi-parser-C5JuL732.js";export{e as parseSgrMouse};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
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};
|
|
@@ -1 +0,0 @@
|
|
|
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,27 +0,0 @@
|
|
|
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,2 +0,0 @@
|
|
|
1
|
-
var D=Object.defineProperty;var R=(t,o)=>D(t,"name",{value:o,configurable:!0});import{o as G}from"./boxes-DyY_LXCi.js";import{resolveColor as j}from"./NAMED_COLORS-B9fJsYdg.js";import{g as I}from"./text-width-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};
|