blecsd 0.1.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/LICENSE +4 -2
  2. package/README.md +209 -66
  3. package/dist/3d/index.d.ts +2 -2
  4. package/dist/3d/index.js +1 -1
  5. package/dist/audio/index.d.ts +2 -2
  6. package/dist/{border-D_Jb4ZJV.d.ts → border-Jb7TrMob.d.ts} +20 -10
  7. package/dist/chunk-2IEMMRUO.js +1 -0
  8. package/dist/chunk-3AV52GY5.js +1 -0
  9. package/dist/chunk-3LHLSY3Y.js +1 -0
  10. package/dist/chunk-3O4TQHGK.js +4 -0
  11. package/dist/chunk-3UJWZ5ZN.js +1 -0
  12. package/dist/chunk-5N3O25O7.js +1 -0
  13. package/dist/chunk-6M2J5QUA.js +1 -0
  14. package/dist/chunk-7IQEUVGF.js +1 -0
  15. package/dist/chunk-A6M6TFBL.js +1 -0
  16. package/dist/chunk-CUEUJAHK.js +3 -0
  17. package/dist/chunk-D42Q2KKR.js +1 -0
  18. package/dist/chunk-DYEXOFUU.js +2 -0
  19. package/dist/chunk-DYU72XLL.js +1 -0
  20. package/dist/chunk-E4CJRSND.js +1 -0
  21. package/dist/chunk-EAY7B5GL.js +1 -0
  22. package/dist/chunk-FCMTWFSE.js +1 -0
  23. package/dist/chunk-FL56THSI.js +25 -0
  24. package/dist/{chunk-2UBBZFE4.js → chunk-G437VE43.js} +1 -1
  25. package/dist/chunk-GGXNWT36.js +8 -0
  26. package/dist/chunk-HLFORKXS.js +1 -0
  27. package/dist/chunk-J7MBKEBY.js +1 -0
  28. package/dist/{chunk-TYMY2TBR.js → chunk-JHCKPCUH.js} +3 -3
  29. package/dist/chunk-K3SX2LY5.js +1 -0
  30. package/dist/chunk-LDAFEXN5.js +1 -0
  31. package/dist/chunk-MKMFUXLB.js +33 -0
  32. package/dist/chunk-MQWPHPUM.js +1 -0
  33. package/dist/chunk-MTI376CU.js +5 -0
  34. package/dist/chunk-MTV2RJZD.js +1 -0
  35. package/dist/chunk-NPDPBAW6.js +4 -0
  36. package/dist/chunk-OB66FB4F.js +1 -0
  37. package/dist/chunk-OR3BZY7C.js +1 -0
  38. package/dist/{chunk-VNZ6CWJA.js → chunk-R7AICVRN.js} +2 -2
  39. package/dist/{chunk-3B7MIVW6.js → chunk-RZ7FGVI6.js} +1 -1
  40. package/dist/chunk-UMGTXSQB.js +11 -0
  41. package/dist/chunk-X3Q3T2SS.js +4 -0
  42. package/dist/{chunk-JKVHO4LH.js → chunk-XZJRWFOS.js} +1 -1
  43. package/dist/chunk-ZAHG7Y3X.js +1 -0
  44. package/dist/cli/init.d.ts +1 -1
  45. package/dist/componentStorage-CJTh-TPO.d.ts +246 -0
  46. package/dist/components/index.d.ts +1942 -514
  47. package/dist/components/index.js +1 -1
  48. package/dist/core/index.d.ts +857 -259
  49. package/dist/core/index.js +1 -1
  50. package/dist/debug/index.d.ts +491 -98
  51. package/dist/debug/index.js +1 -1
  52. package/dist/dirtyTracking-C4v8MmM9.d.ts +235 -0
  53. package/dist/errors/index.d.ts +12 -12
  54. package/dist/errors/index.js +1 -1
  55. package/dist/{events-BbbxkgvX.d.ts → events-9ForpTfM.d.ts} +75 -2
  56. package/dist/game/index.d.ts +7 -7
  57. package/dist/game/index.js +1 -1
  58. package/dist/{gameLoop-BIPW7-OY.d.ts → gameLoop-C-Ez_i54.d.ts} +2 -2
  59. package/dist/{index-zSGJ2eUk.d.ts → index-DBS5Uefn.d.ts} +2 -2
  60. package/dist/index.d.ts +283 -20
  61. package/dist/index.js +3 -1
  62. package/dist/input/index.d.ts +1 -1
  63. package/dist/input/index.js +1 -1
  64. package/dist/{inputActions-CefRUBuT.d.ts → inputActions-CRsUtTHM.d.ts} +10 -721
  65. package/dist/packedStore-BgvnEdE7.d.ts +191 -0
  66. package/dist/{renderable-jTMOA-GK.d.ts → renderable-CwqGwrEV.d.ts} +9 -9
  67. package/dist/{scheduler-DcfoFuum.d.ts → scheduler-CMcYew9Z.d.ts} +65 -3
  68. package/dist/systems/index.d.ts +356 -55
  69. package/dist/systems/index.js +1 -1
  70. package/dist/terminal/index.d.ts +2233 -2299
  71. package/dist/terminal/index.js +1 -1
  72. package/dist/{tilemap-D1HJvKy3.d.ts → tilemap-BirMJdbu.d.ts} +92 -3
  73. package/dist/{types-BcsvoKzf.d.ts → types-CPB4CpbH.d.ts} +2 -2
  74. package/dist/utils/index.d.ts +27 -180
  75. package/dist/utils/index.js +1 -1
  76. package/dist/{virtualScrollback-DvZTRU8a.d.ts → virtualScrollback-D9uLFe8l.d.ts} +4 -4
  77. package/dist/{virtualViewport-Dx2iJliO.d.ts → virtualViewport-Bpv6jlKt.d.ts} +283 -761
  78. package/dist/widgets/bigText.d.ts +1 -1
  79. package/dist/widgets/bigText.js +1 -1
  80. package/dist/widgets/index.d.ts +10519 -5463
  81. package/dist/widgets/index.js +1 -1
  82. package/package.json +102 -6
  83. package/dist/chunk-35I22JJO.js +0 -1
  84. package/dist/chunk-3EGGGI5J.js +0 -3
  85. package/dist/chunk-4X4N4HNQ.js +0 -2
  86. package/dist/chunk-AQ7LW75B.js +0 -1
  87. package/dist/chunk-AXZQAH4X.js +0 -1
  88. package/dist/chunk-BCADUCOZ.js +0 -1
  89. package/dist/chunk-EJ5WVDDZ.js +0 -6
  90. package/dist/chunk-FT7BMYSN.js +0 -1
  91. package/dist/chunk-FYEBZAWN.js +0 -1
  92. package/dist/chunk-GYHI26UE.js +0 -1
  93. package/dist/chunk-H2YAOJDW.js +0 -1
  94. package/dist/chunk-K2B2OXQ5.js +0 -5
  95. package/dist/chunk-K37L3G4Z.js +0 -4
  96. package/dist/chunk-KD55INV7.js +0 -1
  97. package/dist/chunk-KFAK4A3G.js +0 -1
  98. package/dist/chunk-LCN2ZITE.js +0 -1
  99. package/dist/chunk-OUXUPF3V.js +0 -33
  100. package/dist/chunk-P6CJO3BC.js +0 -1
  101. package/dist/chunk-PI5UOHOH.js +0 -1
  102. package/dist/chunk-PSXXMBVJ.js +0 -1
  103. package/dist/chunk-TRK4422V.js +0 -12
  104. package/dist/chunk-W5OU7Z6J.js +0 -1
  105. package/dist/chunk-WNG4A3K7.js +0 -4
  106. package/dist/chunk-XRJNAHNG.js +0 -19
  107. package/dist/chunk-XZA63ZPO.js +0 -1
  108. package/dist/chunk-YAMOSPWB.js +0 -4
  109. package/dist/chunk-YD6ULIUR.js +0 -1
  110. package/dist/{keyParser-Bwm8-l7v.d.ts → keyParser-BnHbg2iD.d.ts} +1 -1
package/LICENSE CHANGED
@@ -1,5 +1,7 @@
1
- Copyright (c) 2013-2015, Christopher Jeffrey and contributors
2
- https://github.com/chjj/
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jeremy Stover (Kadajett) and contributors
4
+ https://github.com/Kadajett/blECSd
3
5
 
4
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
7
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -3,16 +3,18 @@
3
3
  [![CI](https://github.com/Kadajett/blECSd/actions/workflows/ci.yml/badge.svg)](https://github.com/Kadajett/blECSd/actions/workflows/ci.yml)
4
4
  [![npm version](https://img.shields.io/npm/v/blecsd.svg)](https://www.npmjs.com/package/blecsd)
5
5
 
6
+ ![dvdBounce](https://github.com/user-attachments/assets/ba80c94a-4fe6-45d8-acb0-f147f25529d2)
7
+
6
8
  A high-performance terminal UI library built on TypeScript and bitECS.
7
9
 
8
10
  blECSd provides a complete toolkit for building terminal applications: dashboards, file managers, system monitors, CLI tools, and games. It combines the performance of an Entity Component System with production-ready widgets and form controls.
9
11
 
10
12
  ## Features
11
13
 
12
- - **18 Widgets**: Box, Panel, Tabs, List, Table, Tree, VirtualizedList, and more
13
- - **Form Controls**: TextInput, Checkbox, RadioButton, Slider, Select, ProgressBar
14
- - **32 Components**: Position, Renderable, Focusable, Interactive, Animation, Collision, etc.
15
- - **12 Systems**: Layout, Input, Render, Animation, Collision, Camera, Drag, Focus, etc.
14
+ - **43 Widgets**: Box, Panel, Tabs, List, Table, Tree, Terminal, Video, 3D Viewport, and more
15
+ - **Form Controls**: Textarea, Textbox, Checkbox, RadioButton, Switch, Select, ProgressBar, Form
16
+ - **41 Components**: Position, Renderable, Focusable, Interactive, Animation, Collision, Camera, and more
17
+ - **21 Systems**: Layout, Input, Render, Animation, Collision, SpatialHash, VisibilityCulling, and more
16
18
  - **Physics-based Animations**: Velocity, acceleration, friction for smooth transitions
17
19
  - **Virtualized Rendering**: Efficiently render 1000s of items
18
20
  - **State Machines**: Built-in FSM support for complex UI state
@@ -29,35 +31,33 @@ npm install blecsd
29
31
  import {
30
32
  createWorld,
31
33
  addEntity,
32
- setPosition,
33
- setDimensions,
34
- setBorder,
35
- setContent,
36
- createPanel,
34
+ Position,
35
+ Dimensions,
36
+ Border,
37
+ createBox,
37
38
  createList,
38
- createTextInput,
39
39
  createEventBus
40
40
  } from 'blecsd';
41
41
 
42
- // Create a world and entities
42
+ // Create a world and entity
43
43
  const world = createWorld();
44
-
45
- // Create a panel with a title
46
- const panel = createPanel(world, {
47
- x: 2,
48
- y: 1,
49
- width: 40,
50
- height: 10,
51
- title: 'My Application',
52
- border: { type: 'rounded' }
44
+ const entity = addEntity(world);
45
+
46
+ // Set position and dimensions using components
47
+ Position.x[entity] = 2;
48
+ Position.y[entity] = 1;
49
+ Dimensions.width[entity] = 40;
50
+ Dimensions.height[entity] = 10;
51
+
52
+ // Create a box widget
53
+ const box = createBox(world, entity, {
54
+ border: { type: 'rounded' },
55
+ title: 'My Application'
53
56
  });
54
57
 
55
- // Create an interactive list
56
- const list = createList(world, {
57
- x: 4,
58
- y: 3,
59
- width: 36,
60
- height: 6,
58
+ // Create a list in another entity
59
+ const listEntity = addEntity(world);
60
+ const list = createList(world, listEntity, {
61
61
  items: [
62
62
  { label: 'Option 1', value: 'opt1' },
63
63
  { label: 'Option 2', value: 'opt2' },
@@ -77,34 +77,63 @@ events.on('item:selected', (e) => console.log(`Selected: ${e.value}`));
77
77
 
78
78
  | Widget | Description |
79
79
  |--------|-------------|
80
+ | BarChart | Bar chart visualization |
81
+ | BigText | Large ASCII art text |
80
82
  | Box | Base container with borders, padding, content |
81
- | Panel | Box with title bar, collapsible, close button |
82
- | Tabs | Tabbed container with keyboard navigation |
83
- | Text | Text display with alignment, wrapping |
83
+ | Button | Clickable button with hover/focus states |
84
+ | Checkbox | Boolean toggle with customizable characters |
85
+ | FileManager | File browser with directory navigation |
86
+ | Form | Form field management, validation, submit |
87
+ | Gauge | Circular/radial gauge display |
88
+ | HoverText | Tooltip/hover text display |
89
+ | Image | Image rendering with various formats |
90
+ | Layout | Flex/grid layout container |
91
+ | Line | Horizontal/vertical separator |
92
+ | LineChart | Line chart visualization |
84
93
  | List | Selectable list with keyboard/mouse support |
85
- | Table | Data table with headers, columns, sorting |
86
- | Tree | Hierarchical tree view with expand/collapse |
87
- | VirtualizedList | Efficient list for large datasets |
88
- | ListTable | Table-style list display |
89
94
  | Listbar | Horizontal navigation bar |
90
- | Line | Horizontal/vertical separator |
95
+ | ListTable | Table-style list display |
91
96
  | Loading | Loading indicator with spinner |
97
+ | Log | Scrollable log viewer |
98
+ | Message | Message box with buttons |
99
+ | Modal | Modal dialog overlay |
100
+ | Panel | Box with title bar, collapsible, close button |
101
+ | ProgressBar | Progress indicator, horizontal/vertical |
102
+ | Prompt | Input prompt dialog |
103
+ | Question | Question dialog with yes/no buttons |
104
+ | RadioButton | Single selection from group |
92
105
  | ScrollableBox | Container with scroll support |
93
106
  | ScrollableText | Scrollable text area |
94
- | HoverText | Tooltip/hover text display |
95
- | Layout | Flex/grid layout container |
107
+ | Sparkline | Sparkline chart visualization |
108
+ | SplitPane | Split pane container with resize |
109
+ | StreamingText | Text display with typewriter effect |
110
+ | Switch | Toggle switch control |
111
+ | Table | Data table with headers, columns, sorting |
112
+ | Tabs | Tabbed container with keyboard navigation |
113
+ | Terminal | ANSI terminal emulator with PTY support |
114
+ | Text | Text display with alignment, wrapping |
115
+ | Textarea | Multi-line text editor |
116
+ | Textbox | Single-line text input |
117
+ | TextEditing | Text editing utilities |
118
+ | Toast | Toast notification popup |
119
+ | Tree | Hierarchical tree view with expand/collapse |
120
+ | Video | Video playback widget |
121
+ | Viewport3d | 3D scene renderer |
122
+ | VirtualizedList | Efficient list for large datasets |
96
123
 
97
124
  ## Form Controls
98
125
 
99
126
  | Control | Description |
100
127
  |---------|-------------|
101
- | TextInput | Single/multi-line text entry with cursor, selection |
128
+ | Textarea | Multi-line text editor with cursor, selection |
129
+ | Textbox | Single-line text input with cursor support |
102
130
  | Checkbox | Boolean toggle with customizable characters |
103
131
  | RadioButton | Single selection from group |
104
- | Slider | Range value selection, horizontal/vertical |
105
- | Select | Dropdown selection menu |
132
+ | Switch | Toggle switch control |
133
+ | Select | Dropdown selection menu (via List component) |
106
134
  | ProgressBar | Progress indicator, horizontal/vertical |
107
135
  | Form | Form field management, validation, submit |
136
+ | Button | Clickable button with hover/focus states |
108
137
 
109
138
  ## Components
110
139
 
@@ -112,24 +141,46 @@ blECSd provides ECS components that work with any bitECS world:
112
141
 
113
142
  | Component | Purpose |
114
143
  |-----------|---------|
115
- | Position | X/Y coordinates, z-index, absolute positioning |
116
- | Renderable | Colors, visibility, dirty tracking |
144
+ | Animation | Frame-based sprite animations |
145
+ | Behavior | Behavior tree execution |
146
+ | Border | Box borders (single, double, rounded, bold, ascii) |
147
+ | Button | Button state and configuration |
148
+ | Camera | Viewport, target following, bounds |
149
+ | Checkbox | Checkbox state |
150
+ | Collision | AABB/circle collision detection, layers, triggers |
151
+ | Content | Text content, alignment, wrapping, tag parsing |
117
152
  | Dimensions | Width, height, min/max constraints, percentages |
118
- | Hierarchy | Parent-child relationships, traversal |
119
153
  | Focusable | Keyboard focus, tab order |
154
+ | Form | Form field management |
155
+ | Health | Health/damage system |
156
+ | Hierarchy | Parent-child relationships, traversal |
157
+ | Input | Input capture state |
120
158
  | Interactive | Click, hover, drag states |
121
- | Scrollable | Scroll position, content size, scrollbars |
122
- | Border | Box borders (single, double, rounded, bold, ascii) |
123
- | Content | Text content, alignment, wrapping, tag parsing |
124
- | Padding | Inner spacing |
125
159
  | Label | Text labels with positioning |
126
- | Animation | Frame-based sprite animations |
127
- | Velocity | Movement with speed, friction, max speed |
128
- | Collision | AABB/circle collision detection, layers, triggers |
129
- | Camera | Viewport, target following, bounds |
130
- | StateMachine | Finite state machine with events, transitions |
131
- | Sprite | Sprite sheets, frames |
160
+ | List | List widget state |
161
+ | Padding | Inner spacing |
162
+ | Particle | Particle system data |
163
+ | Position | X/Y coordinates, z-index, absolute positioning |
164
+ | ProgressBar | Progress bar state |
165
+ | RadioButton | Radio button state |
166
+ | Renderable | Colors, visibility, dirty tracking |
167
+ | Screen | Screen buffer data |
168
+ | Scrollable | Scroll position, content size, scrollbars |
169
+ | Scrollbar | Scrollbar state |
170
+ | Select | Selection dropdown state |
132
171
  | Shadow | Drop shadows with opacity, blending |
172
+ | Slider | Slider state |
173
+ | Spinner | Loading spinner state |
174
+ | Sprite | Sprite sheets, frames |
175
+ | StateMachine | Finite state machine with events, transitions |
176
+ | Table | Table widget state |
177
+ | TerminalBuffer | Terminal emulator buffer |
178
+ | TextInput | Text input state |
179
+ | TextSelection | Text selection state |
180
+ | Tilemap | Tilemap rendering data |
181
+ | Timer | Timer/countdown state |
182
+ | UserData | Custom user data storage |
183
+ | Velocity | Movement with speed, friction, max speed |
133
184
  | VirtualViewport | Virtualized content rendering |
134
185
 
135
186
  See [API Reference](./docs/api/index.md) for the complete list.
@@ -138,18 +189,27 @@ See [API Reference](./docs/api/index.md) for the complete list.
138
189
 
139
190
  | System | Purpose |
140
191
  |--------|---------|
141
- | inputSystem | Process keyboard/mouse input |
142
- | focusSystem | Manage focus, tab navigation |
143
- | layoutSystem | Calculate positions, dimensions |
144
- | renderSystem | Render entities to screen buffer |
145
- | virtualizedRenderSystem | Efficient rendering for large datasets |
146
192
  | animationSystem | Update sprite animations |
147
- | movementSystem | Apply velocity to position |
148
- | collisionSystem | Detect and resolve collisions |
193
+ | behaviorSystem | Execute behavior trees |
149
194
  | cameraSystem | Update camera following target |
195
+ | collisionSystem | Detect and resolve collisions |
150
196
  | dragSystem | Handle drag and drop |
151
- | stateMachineSystem | Process state machine transitions |
197
+ | focusSystem | Manage focus, tab navigation |
198
+ | frameBudget | Frame time profiling and budget management |
199
+ | inputSystem | Process keyboard/mouse input |
200
+ | layoutSystem | Calculate positions, dimensions |
201
+ | movementSystem | Apply velocity to position |
152
202
  | outputSystem | Write buffer to terminal |
203
+ | panelMovement | Handle panel drag/resize |
204
+ | particleSystem | Update particle effects |
205
+ | renderSystem | Render entities to screen buffer |
206
+ | smoothScroll | Smooth scrolling animations |
207
+ | spatialHash | Spatial partitioning for collision |
208
+ | stateMachineSystem | Process state machine transitions |
209
+ | tilemapRenderer | Render tilemap layers |
210
+ | virtualizedRenderSystem | Efficient rendering for large datasets |
211
+ | visibilityCulling | Frustum/viewport culling |
212
+ | workerPool | Background task processing |
153
213
 
154
214
  ## Library Design
155
215
 
@@ -162,19 +222,66 @@ blECSd is a library, not a framework:
162
222
 
163
223
  ```typescript
164
224
  // Your world, your control
165
- import { createWorld, addEntity, setPosition, setRenderable, layoutSystem, renderSystem } from 'blecsd';
225
+ import {
226
+ createWorld,
227
+ addEntity,
228
+ Position,
229
+ Renderable,
230
+ layoutSystem,
231
+ renderSystem
232
+ } from 'blecsd';
166
233
 
167
234
  const world = createWorld();
168
235
  const eid = addEntity(world);
169
236
 
170
- // Use components without our update loop
171
- setPosition(world, eid, 10, 5);
237
+ // Use components directly - no setters needed
238
+ Position.x[eid] = 10;
239
+ Position.y[eid] = 5;
240
+ Renderable.visible[eid] = 1;
172
241
 
173
242
  // Call systems when you want
174
243
  layoutSystem(world);
175
244
  renderSystem(world);
176
245
  ```
177
246
 
247
+ ## PackedStore: Cache-Friendly Storage
248
+
249
+ blECSd includes a `PackedStore<T>` primitive for systems that iterate over entities in hot paths (rendering, animation, collision). It provides O(1) add/remove/get with dense, cache-friendly iteration.
250
+
251
+ ### The Three-Vector Pattern
252
+
253
+ PackedStore uses four parallel arrays to keep live data contiguous:
254
+
255
+ ```
256
+ data[] Dense values, packed into [0, size) with no gaps
257
+ dataIndex[] Maps handle.index -> position in data[]
258
+ id[] Maps data position -> handle.index (inverse of dataIndex)
259
+ generations[] Generation counter per slot for stale handle detection
260
+ ```
261
+
262
+ Removals use swap-and-pop: the last element fills the gap, so `data[]` is always contiguous. This means iterating `data[0..size]` hits sequential memory with no pointer chasing, which is 2-5x faster than `Map.forEach` for iteration-heavy workloads.
263
+
264
+ ### createComponentStore\<T\>()
265
+
266
+ For most code, use `createComponentStore<T>()` instead of PackedStore directly. It provides a Map-like API (`get`, `set`, `has`, `delete`, `forEach`) with two backing modes:
267
+
268
+ ```typescript
269
+ import { createComponentStore } from 'blecsd';
270
+
271
+ // Iterable mode: backed by PackedStore, dense iteration via forEach/data()
272
+ // Use for stores iterated in hot paths (widget rendering, layout, animation)
273
+ const renderData = createComponentStore<RenderInfo>({ iterable: true });
274
+
275
+ // Non-iterable mode (default): backed by a plain Map
276
+ // Use for point lookups like callback registries or config
277
+ const callbacks = createComponentStore<() => void>({ iterable: false });
278
+ ```
279
+
280
+ | Mode | Backing | Iteration | Best for |
281
+ |------|---------|-----------|----------|
282
+ | `iterable: true` | PackedStore | Dense, cache-friendly | Hot paths (render, animate, layout) |
283
+ | `iterable: false` | Map | Standard Map iteration | Callbacks, config, point lookups |
284
+
178
285
  ## Use Cases
179
286
 
180
287
  - **Dashboards**: System monitors, log viewers, status displays
@@ -187,9 +294,9 @@ renderSystem(world);
187
294
 
188
295
  | Feature | blECSd | Ink | blessed | Textual |
189
296
  |---------|--------|-----|---------|---------|
190
- | Architecture | ECS (data-oriented) | React (component) | Class-based | Widget classes |
297
+ | Architecture | ECS + PackedStore (data-oriented) | React (component) | Class-based | Widget classes |
191
298
  | Language | TypeScript | TypeScript/JSX | JavaScript | Python |
192
- | Widgets | 18 built-in | Few built-in | Many built-in | Many built-in |
299
+ | Widgets | 43 built-in | Few built-in | Many built-in | Many built-in |
193
300
  | Animation | Physics-based | Manual | Manual | CSS-like |
194
301
  | Virtualization | Built-in | Manual | Manual | Built-in |
195
302
  | Game support | First-class | Limited | Limited | Limited |
@@ -198,13 +305,26 @@ Choose blECSd if you want data-oriented design, physics-based animations, or gam
198
305
 
199
306
  ## Documentation
200
307
 
308
+ ### Getting Started
201
309
  - [Installation](./docs/getting-started/installation.md): Requirements, terminal compatibility, setup
202
310
  - [Core Concepts](./docs/getting-started/concepts.md): ECS, scheduler, events
203
311
  - [Hello World](./docs/getting-started/hello-world.md): Your first blECSd application
312
+
313
+ ### API Reference
204
314
  - [API Reference](./docs/api/index.md): Components, widgets, systems, terminal I/O
205
315
  - [Terminal Widget](./docs/api/widgets/terminal.md): ANSI rendering and PTY shell support
206
- - [Examples](./docs/examples/index.md): File manager, multiplexer, system monitor, ANSI viewer, telnet server
316
+
317
+ ### Guides
207
318
  - [Guides](./docs/guides/): Animations, forms, layouts, and more
319
+ - [Error Handling](./docs/guides/error-handling.md): Error boundaries and recovery
320
+ - [Testing Guide](./docs/guides/testing.md): Unit and integration testing
321
+ - [Performance Optimization](./docs/guides/performance.md): Profiling and optimization
322
+ - [Migration Guide](./docs/guides/migration.md): Migrating from other libraries
323
+ - [Keyboard Shortcuts](./docs/guides/keyboard-shortcuts.md): Custom keybindings
324
+
325
+ ### Examples
326
+ - [Examples](./docs/examples/index.md): File manager, multiplexer, system monitor, ANSI viewer, telnet server
327
+ - [Examples Repository](https://github.com/Kadajett/blECSd-Examples): Standalone runnable examples
208
328
 
209
329
  ## Development
210
330
 
@@ -215,6 +335,29 @@ pnpm lint
215
335
  pnpm build
216
336
  ```
217
337
 
338
+ ### Benchmarking
339
+
340
+ Run performance benchmarks to measure system performance:
341
+
342
+ ```bash
343
+ # Run all benchmarks
344
+ pnpm bench
345
+
346
+ # Run CI benchmarks (fast subset for regression detection)
347
+ pnpm bench:ci
348
+
349
+ # Run real-world scenario benchmarks
350
+ pnpm bench:scenarios
351
+
352
+ # Update performance baseline
353
+ pnpm bench:update-baseline
354
+
355
+ # Check for performance regressions (vs baseline)
356
+ pnpm bench:check-regression
357
+ ```
358
+
359
+ The CI automatically checks for performance regressions on pull requests. If any benchmark regresses by more than 20%, the build will fail.
360
+
218
361
  ## License
219
362
 
220
363
  MIT
@@ -1,5 +1,5 @@
1
- export { A as AmbientLight, a as AmbientLightSchema, b as Animation3D, c as Animation3DData, B as BackendCapabilities, d as BackendCapabilitiesSchema, e as BackendPreference, f as BackendPreferenceSchema, g as BackendSelection, h as BackendSelectionSchema, j as BackendType, k as BackendTypeSchema, l as BrailleConfig, m as BrailleConfigSchema, C as Camera3D, n as Camera3DData, o as ClipRect, p as ClipRectSchema, q as ClippedLine, r as CubeMeshOptions, s as CubeMeshOptionsSchema, t as CylinderMeshOptions, u as CylinderMeshOptionsSchema, D as DirectionalLight, v as DirectionalLightSchema, E as EncodedCell, w as EncodedCellSchema, x as EncodedOutput, y as EncodedOutputSchema, z as EulerAngles, F as EulerAnglesSchema, G as FrustumPlane, H as GraphicsCapabilities, I as HalfBlockConfig, J as HalfBlockConfigSchema, K as KittyConfig, L as KittyConfigSchema, M as LineEndpoint, N as LineEndpointSchema, O as Mat4, P as Mat4Schema, Q as Material3D, R as Material3DData, S as Mesh, T as MeshData, U as MeshProjection, V as MouseDragInput, W as MouseInteraction3D, X as MouseInteraction3DData, Y as ObjFace, Z as ObjGroup, _ as ObjLoadOptions, $ as ObjLoadOptionsSchema, a0 as ObjParseResult, a1 as ObjVertex, a2 as OrthographicConfig, a3 as OrthographicConfigSchema, a4 as PerspectiveConfig, a5 as PerspectiveConfigSchema, a6 as PixelBufferConfig, a7 as PixelBufferConfigSchema, a8 as PixelFramebuffer, a9 as PlaneMeshOptions, aa as PlaneMeshOptionsSchema, ab as ProjectedVertex, ac as RGBAColor, ad as RGBAColorSchema, ae as RendererBackend, af as ScreenCoord, ag as SextantConfig, ah as SextantConfigSchema, ai as SixelConfig, aj as SixelConfigSchema, ak as SphereMeshOptions, al as SphereMeshOptionsSchema, am as Transform3D, an as Transform3DData, ao as TriangleBBox, ap as TriangleVertex, aq as TriangleVertexSchema, ar as Vec3, as as Vec3Input, at as Vec3InputSchema, au as Vec3Schema, av as Viewport3D, aw as Viewport3DData, ax as ViewportConfig, ay as ViewportConfigSchema, az as ViewportOutput, aA as ViewportProjection, aB as animation3DSystem, aC as backendStore, aD as blendPixel, aE as buildMVP, aF as clearBackendStore, aG as clearFramebuffer, aH as clearFramebufferStore, aI as clearMeshStore, aJ as clearMouseInputStore, aK as clearOutputStore, aL as clearProjectionStore, aM as clipLine, aN as computeBoundingBox, aO as computeFaceNormal, aP as computeFlatShading, aQ as computeOutcode, aR as createBackendByType, aS as createBrailleBackend, aT as createCubeMesh, aU as createCylinderMesh, aV as createHalfBlockBackend, aW as createKittyBackend, aX as createMeshFromArrays, aY as createPixelFramebuffer, aZ as createPlaneMesh, a_ as createSextantBackend, a$ as createSixelBackend, b0 as createSphereMesh, b1 as detectBestBackend, b2 as disableMouseInteraction, b3 as drawLine, b4 as drawLineAA, b5 as drawLineColor, b6 as drawLineDepth, b7 as enableMouseInteraction, b8 as extractFrustumPlanes, b9 as feedMouseDrag, ba as feedMouseScroll, bb as fillRect, bc as fillTriangle, bd as fillTriangleFlat, be as framebufferStore, bf as getAnimation3D, bg as getCamera3D, bh as getDepth, bi as getMaterial3D, bj as getMesh, bk as getMeshCount, bl as getMeshData, bm as getMouseInteraction3D, bn as getPixel, bo as getProjMatrix, bp as getTransform3D, bq as getViewMatrix, br as getViewport3D, bs as getWorldMatrix, bt as isDirty, bu as isInBounds, bv as isPointInFrustum, bw as isSphereInFrustum, bx as loadObjAsMesh, by as lookAt, bz as markDirty, bA as mat4Determinant, bB as mat4Equals, bC as mat4FromTRS, bD as mat4Identity, bE as mat4Invert, bF as mat4IsIdentity, bG as mat4Multiply, bH as mat4RotateX, bI as mat4RotateY, bJ as mat4RotateZ, bK as mat4Scale, bL as mat4TransformDirection, bM as mat4TransformVec3, bN as mat4Translate, bO as mat4Transpose, bP as mouseInputStore, bQ as mouseInteraction3DSystem, bR as orthographicMatrix, bS as outputStore, bT as parseObj, bU as perspectiveMatrix, bV as projectVertex, bW as projectionStore, bX as projectionSystem, bY as rasterSystem, bZ as registerMesh, b_ as sceneGraphSystem, b$ as setAnimation3D, c0 as setCamera3D, c1 as setMaterial3D, c2 as setMesh, c3 as setPixel, c4 as setPixelUnsafe, c5 as setRotation, c6 as setScale, c7 as setTransform3D, c8 as setTranslation, c9 as setViewport3D, ca as shadeFace, cb as testAndSetDepth, cc as triangleArea2, cd as triangleBoundingBox, ce as unprojectVertex, cf as unregisterMesh, cg as vec3, ch as vec3Add, ci as vec3Cross, cj as vec3Distance, ck as vec3Dot, cl as vec3Equals, cm as vec3FromArray, cn as vec3Length, co as vec3LengthSq, cp as vec3Lerp, cq as vec3Negate, cr as vec3Normalize, cs as vec3Scale, ct as vec3Sub, cu as vec3Zero, cv as viewportOutputSystem, cw as viewportTransform } from '../index-zSGJ2eUk.js';
1
+ export { A as AmbientLight, a as AmbientLightSchema, b as Animation3D, c as Animation3DData, B as BackendCapabilities, d as BackendCapabilitiesSchema, e as BackendPreference, f as BackendPreferenceSchema, g as BackendSelection, h as BackendSelectionSchema, j as BackendType, k as BackendTypeSchema, l as BrailleConfig, m as BrailleConfigSchema, C as Camera3D, n as Camera3DData, o as ClipRect, p as ClipRectSchema, q as ClippedLine, r as CubeMeshOptions, s as CubeMeshOptionsSchema, t as CylinderMeshOptions, u as CylinderMeshOptionsSchema, D as DirectionalLight, v as DirectionalLightSchema, E as EncodedCell, w as EncodedCellSchema, x as EncodedOutput, y as EncodedOutputSchema, z as EulerAngles, F as EulerAnglesSchema, G as FrustumPlane, H as GraphicsCapabilities, I as HalfBlockConfig, J as HalfBlockConfigSchema, K as KittyConfig, L as KittyConfigSchema, M as LineEndpoint, N as LineEndpointSchema, O as Mat4, P as Mat4Schema, Q as Material3D, R as Material3DData, S as Mesh, T as MeshData, U as MeshProjection, V as MouseDragInput, W as MouseInteraction3D, X as MouseInteraction3DData, Y as ObjFace, Z as ObjGroup, _ as ObjLoadOptions, $ as ObjLoadOptionsSchema, a0 as ObjParseResult, a1 as ObjVertex, a2 as OrthographicConfig, a3 as OrthographicConfigSchema, a4 as PerspectiveConfig, a5 as PerspectiveConfigSchema, a6 as PixelBufferConfig, a7 as PixelBufferConfigSchema, a8 as PixelFramebuffer, a9 as PlaneMeshOptions, aa as PlaneMeshOptionsSchema, ab as ProjectedVertex, ac as RGBAColor, ad as RGBAColorSchema, ae as RendererBackend, af as ScreenCoord, ag as SextantConfig, ah as SextantConfigSchema, ai as SixelConfig, aj as SixelConfigSchema, ak as SphereMeshOptions, al as SphereMeshOptionsSchema, am as Transform3D, an as Transform3DData, ao as TriangleBBox, ap as TriangleVertex, aq as TriangleVertexSchema, ar as Vec3, as as Vec3Input, at as Vec3InputSchema, au as Vec3Schema, av as Viewport3D, aw as Viewport3DData, ax as ViewportConfig, ay as ViewportConfigSchema, az as ViewportOutput, aA as ViewportProjection, aB as animation3DSystem, aC as backendStore, aD as blendPixel, aE as buildMVP, aF as clearBackendStore, aG as clearFramebuffer, aH as clearFramebufferStore, aI as clearMeshStore, aJ as clearMouseInputStore, aK as clearOutputStore, aL as clearProjectionStore, aM as clipLine, aN as computeBoundingBox, aO as computeFaceNormal, aP as computeFlatShading, aQ as computeOutcode, aR as createBackendByType, aS as createBrailleBackend, aT as createCubeMesh, aU as createCylinderMesh, aV as createHalfBlockBackend, aW as createKittyBackend, aX as createMeshFromArrays, aY as createPixelFramebuffer, aZ as createPlaneMesh, a_ as createSextantBackend, a$ as createSixelBackend, b0 as createSphereMesh, b1 as detectBestBackend, b2 as disableMouseInteraction, b3 as drawLine, b4 as drawLineAA, b5 as drawLineColor, b6 as drawLineDepth, b7 as enableMouseInteraction, b8 as extractFrustumPlanes, b9 as feedMouseDrag, ba as feedMouseScroll, bb as fillRect, bc as fillTriangle, bd as fillTriangleFlat, be as framebufferStore, bf as getAnimation3D, bg as getCamera3D, bh as getDepth, bi as getMaterial3D, bj as getMesh, bk as getMeshCount, bl as getMeshData, bm as getMouseInteraction3D, bn as getPixel, bo as getProjMatrix, bp as getTransform3D, bq as getViewMatrix, br as getViewport3D, bs as getWorldMatrix, bt as isDirty, bu as isInBounds, bv as isPointInFrustum, bw as isSphereInFrustum, bx as loadObjAsMesh, by as lookAt, bz as markDirty, bA as mat4Determinant, bB as mat4Equals, bC as mat4FromTRS, bD as mat4Identity, bE as mat4Invert, bF as mat4IsIdentity, bG as mat4Multiply, bH as mat4RotateX, bI as mat4RotateY, bJ as mat4RotateZ, bK as mat4Scale, bL as mat4TransformDirection, bM as mat4TransformVec3, bN as mat4Translate, bO as mat4Transpose, bP as mouseInputStore, bQ as mouseInteraction3DSystem, bR as orthographicMatrix, bS as outputStore, bT as parseObj, bU as perspectiveMatrix, bV as projectVertex, bW as projectionStore, bX as projectionSystem, bY as rasterSystem, bZ as registerMesh, b_ as sceneGraphSystem, b$ as setAnimation3D, c0 as setCamera3D, c1 as setMaterial3D, c2 as setMesh, c3 as setPixel, c4 as setPixelUnsafe, c5 as setRotation, c6 as setScale, c7 as setTransform3D, c8 as setTranslation, c9 as setViewport3D, ca as shadeFace, cb as testAndSetDepth, cc as triangleArea2, cd as triangleBoundingBox, ce as unprojectVertex, cf as unregisterMesh, cg as vec3, ch as vec3Add, ci as vec3Cross, cj as vec3Distance, ck as vec3Dot, cl as vec3Equals, cm as vec3FromArray, cn as vec3Length, co as vec3LengthSq, cp as vec3Lerp, cq as vec3Negate, cr as vec3Normalize, cs as vec3Scale, ct as vec3Sub, cu as vec3Zero, cv as viewportOutputSystem, cw as viewportTransform } from '../index-DBS5Uefn.js';
2
2
  export { A as Animation3DConfig, b as Animation3DConfigSchema, C as Camera3DConfig, c as Camera3DConfigSchema, M as Material3DConfig, d as Material3DConfigSchema, a as MouseInteraction3DConfig, e as MouseInteraction3DConfigSchema, T as Transform3DConfig, f as Transform3DConfigSchema, V as Viewport3DConfig, g as Viewport3DConfigSchema, h as Viewport3DWidgetConfig, i as Viewport3DWidgetConfigSchema } from '../viewport3d-xI33-_wq.js';
3
3
  import 'zod';
4
- import '../types-BcsvoKzf.js';
4
+ import '../types-CPB4CpbH.js';
5
5
  import 'bitecs';
package/dist/3d/index.js CHANGED
@@ -1 +1 @@
1
- export{a as Animation3D,m as CubeMeshOptionsSchema,p as CylinderMeshOptionsSchema,d as MouseInteraction3D,l as ObjLoadOptionsSchema,o as PlaneMeshOptionsSchema,n as SphereMeshOptionsSchema,H as animation3DSystem,K as backendStore,y as blendPixel,M as clearBackendStore,f as clearMouseInputStore,N as clearOutputStore,u as clipLine,r as computeBoundingBox,A as computeFaceNormal,B as computeFlatShading,t as computeOutcode,D as createCubeMesh,G as createCylinderMesh,F as createPlaneMesh,E as createSphereMesh,j as disableMouseInteraction,z as drawLineAA,i as enableMouseInteraction,v as extractFrustumPlanes,g as feedMouseDrag,h as feedMouseScroll,c as getAnimation3D,k as getMouseInteraction3D,w as isPointInFrustum,x as isSphereInFrustum,s as loadObjAsMesh,e as mouseInputStore,I as mouseInteraction3DSystem,L as outputStore,q as parseObj,J as sceneGraphSystem,b as setAnimation3D,C as shadeFace,O as viewportOutputSystem}from'../chunk-VNZ6CWJA.js';export{Xa as AmbientLightSchema,w as Animation3DConfigSchema,b as BackendCapabilitiesSchema,k as BackendPreferenceSchema,e as BackendSelectionSchema,a as BackendTypeSchema,f as BrailleConfigSchema,y as Camera3D,t as Camera3DConfigSchema,ga as ClipRectSchema,Wa as DirectionalLightSchema,c as EncodedCellSchema,d as EncodedOutputSchema,ca as EulerAnglesSchema,g as HalfBlockConfigSchema,j as KittyConfigSchema,Ta as LineEndpointSchema,ba as Mat4Schema,D as Material3D,u as Material3DConfigSchema,G as Mesh,x as MouseInteraction3DConfigSchema,ea as OrthographicConfigSchema,da as PerspectiveConfigSchema,Sa as PixelBufferConfigSchema,Ua as RGBAColorSchema,h as SextantConfigSchema,i as SixelConfigSchema,P as Transform3D,s as Transform3DConfigSchema,Va as TriangleVertexSchema,aa as Vec3InputSchema,$ as Vec3Schema,Y as Viewport3D,v as Viewport3DConfigSchema,mb as Viewport3DWidgetConfigSchema,fa as ViewportConfigSchema,Ra as buildMVP,Za as clearFramebuffer,rb as clearFramebufferStore,O as clearMeshStore,ob as clearProjectionStore,q as createBackendByType,l as createBrailleBackend,m as createHalfBlockBackend,n as createKittyBackend,I as createMeshFromArrays,Ya as createPixelFramebuffer,o as createSextantBackend,p as createSixelBackend,r as detectBestBackend,fb as drawLine,hb as drawLineColor,gb as drawLineDepth,eb as fillRect,kb as fillTriangle,lb as fillTriangleFlat,qb as framebufferStore,A as getCamera3D,cb as getDepth,F as getMaterial3D,M as getMesh,N as getMeshCount,J as getMeshData,$a as getPixel,B as getProjMatrix,R as getTransform3D,C as getViewMatrix,_ as getViewport3D,V as getWorldMatrix,X as isDirty,_a as isInBounds,Na as lookAt,W as markDirty,Ea as mat4Determinant,Ka as mat4Equals,Ia as mat4FromTRS,wa as mat4Identity,Fa as mat4Invert,Ja as mat4IsIdentity,xa as mat4Multiply,za as mat4RotateX,Aa as mat4RotateY,Ba as mat4RotateZ,Ca as mat4Scale,Ha as mat4TransformDirection,Ga as mat4TransformVec3,ya as mat4Translate,Da as mat4Transpose,Ma as orthographicMatrix,La as perspectiveMatrix,Pa as projectVertex,nb as projectionStore,pb as projectionSystem,sb as rasterSystem,H as registerMesh,z as setCamera3D,E as setMaterial3D,L as setMesh,ab as setPixel,bb as setPixelUnsafe,T as setRotation,U as setScale,Q as setTransform3D,S as setTranslation,Z as setViewport3D,db as testAndSetDepth,ib as triangleArea2,jb as triangleBoundingBox,Qa as unprojectVertex,K as unregisterMesh,ha as vec3,ja as vec3Add,na as vec3Cross,ta as vec3Distance,ma as vec3Dot,ua as vec3Equals,ia as vec3FromArray,pa as vec3Length,oa as vec3LengthSq,ra as vec3Lerp,sa as vec3Negate,qa as vec3Normalize,la as vec3Scale,ka as vec3Sub,va as vec3Zero,Oa as viewportTransform}from'../chunk-LYSK5S63.js';import'../chunk-H2YAOJDW.js';import'../chunk-G7GIWWLE.js';import'../chunk-PXXGH3BV.js';import'../chunk-5PELJRUQ.js';
1
+ export{a as Animation3D,m as CubeMeshOptionsSchema,p as CylinderMeshOptionsSchema,d as MouseInteraction3D,l as ObjLoadOptionsSchema,o as PlaneMeshOptionsSchema,n as SphereMeshOptionsSchema,H as animation3DSystem,K as backendStore,y as blendPixel,M as clearBackendStore,f as clearMouseInputStore,N as clearOutputStore,u as clipLine,r as computeBoundingBox,A as computeFaceNormal,B as computeFlatShading,t as computeOutcode,D as createCubeMesh,G as createCylinderMesh,F as createPlaneMesh,E as createSphereMesh,j as disableMouseInteraction,z as drawLineAA,i as enableMouseInteraction,v as extractFrustumPlanes,g as feedMouseDrag,h as feedMouseScroll,c as getAnimation3D,k as getMouseInteraction3D,w as isPointInFrustum,x as isSphereInFrustum,s as loadObjAsMesh,e as mouseInputStore,I as mouseInteraction3DSystem,L as outputStore,q as parseObj,J as sceneGraphSystem,b as setAnimation3D,C as shadeFace,O as viewportOutputSystem}from'../chunk-R7AICVRN.js';export{Xa as AmbientLightSchema,w as Animation3DConfigSchema,b as BackendCapabilitiesSchema,k as BackendPreferenceSchema,e as BackendSelectionSchema,a as BackendTypeSchema,f as BrailleConfigSchema,y as Camera3D,t as Camera3DConfigSchema,ga as ClipRectSchema,Wa as DirectionalLightSchema,c as EncodedCellSchema,d as EncodedOutputSchema,ca as EulerAnglesSchema,g as HalfBlockConfigSchema,j as KittyConfigSchema,Ta as LineEndpointSchema,ba as Mat4Schema,D as Material3D,u as Material3DConfigSchema,G as Mesh,x as MouseInteraction3DConfigSchema,ea as OrthographicConfigSchema,da as PerspectiveConfigSchema,Sa as PixelBufferConfigSchema,Ua as RGBAColorSchema,h as SextantConfigSchema,i as SixelConfigSchema,P as Transform3D,s as Transform3DConfigSchema,Va as TriangleVertexSchema,aa as Vec3InputSchema,$ as Vec3Schema,Y as Viewport3D,v as Viewport3DConfigSchema,mb as Viewport3DWidgetConfigSchema,fa as ViewportConfigSchema,Ra as buildMVP,Za as clearFramebuffer,rb as clearFramebufferStore,O as clearMeshStore,ob as clearProjectionStore,q as createBackendByType,l as createBrailleBackend,m as createHalfBlockBackend,n as createKittyBackend,I as createMeshFromArrays,Ya as createPixelFramebuffer,o as createSextantBackend,p as createSixelBackend,r as detectBestBackend,fb as drawLine,hb as drawLineColor,gb as drawLineDepth,eb as fillRect,kb as fillTriangle,lb as fillTriangleFlat,qb as framebufferStore,A as getCamera3D,cb as getDepth,F as getMaterial3D,M as getMesh,N as getMeshCount,J as getMeshData,$a as getPixel,B as getProjMatrix,R as getTransform3D,C as getViewMatrix,_ as getViewport3D,V as getWorldMatrix,X as isDirty,_a as isInBounds,Na as lookAt,W as markDirty,Ea as mat4Determinant,Ka as mat4Equals,Ia as mat4FromTRS,wa as mat4Identity,Fa as mat4Invert,Ja as mat4IsIdentity,xa as mat4Multiply,za as mat4RotateX,Aa as mat4RotateY,Ba as mat4RotateZ,Ca as mat4Scale,Ha as mat4TransformDirection,Ga as mat4TransformVec3,ya as mat4Translate,Da as mat4Transpose,Ma as orthographicMatrix,La as perspectiveMatrix,Pa as projectVertex,nb as projectionStore,pb as projectionSystem,sb as rasterSystem,H as registerMesh,z as setCamera3D,E as setMaterial3D,L as setMesh,ab as setPixel,bb as setPixelUnsafe,T as setRotation,U as setScale,Q as setTransform3D,S as setTranslation,Z as setViewport3D,db as testAndSetDepth,ib as triangleArea2,jb as triangleBoundingBox,Qa as unprojectVertex,K as unregisterMesh,ha as vec3,ja as vec3Add,na as vec3Cross,ta as vec3Distance,ma as vec3Dot,ua as vec3Equals,ia as vec3FromArray,pa as vec3Length,oa as vec3LengthSq,ra as vec3Lerp,sa as vec3Negate,qa as vec3Normalize,la as vec3Scale,ka as vec3Sub,va as vec3Zero,Oa as viewportTransform}from'../chunk-LYSK5S63.js';import'../chunk-D42Q2KKR.js';import'../chunk-5N3O25O7.js';import'../chunk-G7GIWWLE.js';import'../chunk-PXXGH3BV.js';import'../chunk-5PELJRUQ.js';
@@ -1,5 +1,5 @@
1
- import { b as EventMap, E as EventBus } from '../events-BbbxkgvX.js';
2
- import { U as Unsubscribe } from '../types-BcsvoKzf.js';
1
+ import { c as EventMap, a as EventBus } from '../events-9ForpTfM.js';
2
+ import { U as Unsubscribe } from '../types-CPB4CpbH.js';
3
3
  import 'bitecs';
4
4
 
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { W as World, E as Entity } from './types-BcsvoKzf.js';
1
+ import { W as World, E as Entity } from './types-CPB4CpbH.js';
2
2
 
3
3
  /**
4
4
  * Border component for element borders.
@@ -49,6 +49,16 @@ declare const BORDER_BOLD: BorderCharset;
49
49
  * ASCII border characters (- | + + + +).
50
50
  */
51
51
  declare const BORDER_ASCII: BorderCharset;
52
+ /**
53
+ * Dashed border characters (┄ ┆ + + + +).
54
+ * Uses light dashed lines with simple corners.
55
+ */
56
+ declare const BORDER_DASHED: BorderCharset;
57
+ /**
58
+ * Heavy dashed border characters (┅ ┇ + + + +).
59
+ * Uses heavy dashed lines with simple corners.
60
+ */
61
+ declare const BORDER_DASHED_HEAVY: BorderCharset;
52
62
  /**
53
63
  * Default foreground color for borders (white).
54
64
  */
@@ -109,21 +119,21 @@ declare const Border: {
109
119
  */
110
120
  interface BorderOptions {
111
121
  /** Border type */
112
- type?: BorderType;
122
+ type?: BorderType | undefined;
113
123
  /** Enable left side */
114
- left?: boolean;
124
+ left?: boolean | undefined;
115
125
  /** Enable top side */
116
- top?: boolean;
126
+ top?: boolean | undefined;
117
127
  /** Enable right side */
118
- right?: boolean;
128
+ right?: boolean | undefined;
119
129
  /** Enable bottom side */
120
- bottom?: boolean;
130
+ bottom?: boolean | undefined;
121
131
  /** Foreground color (hex string or packed number) */
122
- fg?: string | number;
132
+ fg?: string | number | undefined;
123
133
  /** Background color (hex string or packed number) */
124
- bg?: string | number;
134
+ bg?: string | number | undefined;
125
135
  /** Preset border charset or custom characters */
126
- chars?: BorderCharset;
136
+ chars?: BorderCharset | undefined;
127
137
  }
128
138
  /**
129
139
  * Border data returned by getBorder.
@@ -254,4 +264,4 @@ declare function disableAllBorders(world: World, eid: Entity): Entity;
254
264
  */
255
265
  declare function getBorderChar(world: World, eid: Entity, position: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'horizontal' | 'vertical'): number | undefined;
256
266
 
257
- export { BORDER_ASCII as B, DEFAULT_BORDER_BG as D, BORDER_BOLD as a, BORDER_DOUBLE as b, BORDER_ROUNDED as c, BORDER_SINGLE as d, Border as e, type BorderCharset as f, type BorderData as g, type BorderOptions as h, BorderType as i, DEFAULT_BORDER_FG as j, disableAllBorders as k, enableAllBorders as l, getBorder as m, getBorderChar as n, hasBorder as o, hasBorderVisible as p, setBorderChars as q, setBorder as s };
267
+ export { BORDER_ASCII as B, DEFAULT_BORDER_BG as D, BORDER_BOLD as a, BORDER_DASHED as b, BORDER_DASHED_HEAVY as c, BORDER_DOUBLE as d, BORDER_ROUNDED as e, BORDER_SINGLE as f, Border as g, type BorderCharset as h, type BorderData as i, type BorderOptions as j, BorderType as k, DEFAULT_BORDER_FG as l, disableAllBorders as m, enableAllBorders as n, getBorder as o, getBorderChar as p, hasBorder as q, hasBorderVisible as r, setBorder as s, setBorderChars as t };
@@ -0,0 +1 @@
1
+ import {z as z$1}from'zod';var x=z$1.object({caseSensitive:z$1.boolean().default(false),threshold:z$1.number().min(0).max(1).default(0),limit:z$1.number().int().positive().optional(),consecutiveBonus:z$1.number().min(0).max(1).default(.3),wordBoundaryBonus:z$1.number().min(0).max(1).default(.2),prefixBonus:z$1.number().min(0).max(1).default(.5),gapPenalty:z$1.number().min(0).max(1).default(.1)}),p={caseSensitive:false,threshold:0,limit:void 0,consecutiveBonus:.3,wordBoundaryBonus:.2,prefixBonus:.5,gapPenalty:.1};function f(e={}){return {...p,...e}}function z(e,t){if(t===0)return true;let i=e[t-1],n=e[t];return !i||!n?false:i===" "||i==="_"||i==="-"||i==="/"||i===i.toLowerCase()&&n===n.toUpperCase()}function y(e,t,i,n,s,o){let r=e.length/Math.max(t.length,e.length),a=0,u=-2;for(let c=0;c<s.length;c++){let d=s[c];if(d!==void 0){if(d===u+1)a++,r+=o.consecutiveBonus*(a/e.length);else if(a=0,u>=0){let h=d-u-1;r-=o.gapPenalty*(h/t.length);}z(t,d)&&(r+=o.wordBoundaryBonus/e.length),u=d;}}return s[0]===0&&(r+=o.prefixBonus),i===n&&(r=1),Math.max(0,Math.min(1,r))}function g(e,t,i={}){let n=f(i);if(!e)return {item:t,text:t,score:1,indices:[]};let s=n.caseSensitive?e:e.toLowerCase(),o=n.caseSensitive?t:t.toLowerCase(),r=[],a=0,u=0;for(;a<s.length&&u<o.length;)s[a]===o[u]&&(r.push(u),a++),u++;if(a!==s.length)return null;let c=y(e,t,s,o,r,n);return {item:t,text:t,score:c,indices:r}}function S(e,t,i={}){let n=f(i),s=[];for(let o of t){let r=g(e,o,n);r&&r.score>=(n.threshold||0)&&s.push(r);}return s.sort((o,r)=>r.score-o.score),n.limit!==void 0&&s.length>n.limit?s.slice(0,n.limit):s}function O(e,t,i){let{getText:n=String,...s}=i,o=f(s),r=[];for(let a of t){let u=n(a),c=g(e,u,o);c&&c.score>=(o.threshold||0)&&r.push({item:a,text:u,score:c.score,indices:c.indices});}return r.sort((a,u)=>u.score-a.score),o.limit!==void 0&&r.length>o.limit?r.slice(0,o.limit):r}function M(e,t,i=n=>`[${n}]`){let n=new Set(t),s="";for(let o=0;o<e.length;o++){let r=e[o];r!==void 0&&(n.has(o)?s+=i(r):s+=r);}return s}function T(e,t,i={}){return S(e,t,i).map(s=>s.item)}function v(e,t,i={}){let n=g(e,t,i);return n!==null&&n.score>=(i.threshold??0)}var m={YYYY:e=>e.getFullYear().toString(),YY:e=>e.getFullYear().toString().slice(-2),MM:e=>(e.getMonth()+1).toString().padStart(2,"0"),DD:e=>e.getDate().toString().padStart(2,"0"),HH:e=>e.getHours().toString().padStart(2,"0"),hh:e=>{let t=e.getHours()%12;return (t===0?12:t).toString().padStart(2,"0")},mm:e=>e.getMinutes().toString().padStart(2,"0"),ss:e=>e.getSeconds().toString().padStart(2,"0"),SSS:e=>e.getMilliseconds().toString().padStart(3,"0"),SS:e=>Math.floor(e.getMilliseconds()/10).toString().padStart(2,"0"),AA:e=>e.getHours()<12?"AM":"PM",aa:e=>e.getHours()<12?"am":"pm"},b=new RegExp(Object.keys(m).sort((e,t)=>t.length-e.length).join("|"),"g");function w(e,t){return t.replace(b,i=>{let n=m[i];return n?n(e):i})}function D(e=new Date){return Math.floor(e.getTime()/1e3)}function R(e=new Date){return e.getTime()}export{x as a,g as b,S as c,O as d,M as e,T as f,v as g,w as h,D as i,R as j};
@@ -0,0 +1 @@
1
+ import {d,f}from'./chunk-6M2J5QUA.js';import {E,J as J$1,v,B,I as I$1,r,u,t}from'./chunk-ZAHG7Y3X.js';import {k as k$1,i as i$1,a,f as f$1}from'./chunk-G7GIWWLE.js';import {n,i,k,h}from'./chunk-PXXGH3BV.js';n();var p=1e4,o={x:new Float32Array(p),y:new Float32Array(p),width:new Float32Array(p),height:new Float32Array(p),valid:new Uint8Array(p)};function A(n,t){if(i(n,t,o)&&o.valid[t]===1)return {x:o.x[t],y:o.y[t],width:o.width[t],height:o.height[t]}}function et(n,t){return i(n,t,o)&&o.valid[t]===1}function ot(n,t){i(n,t,o)&&(o.valid[t]=0);}function G(n,t){i(n,t,o)||(h(n,t,o),o.x[t]=0,o.y[t]=0,o.width[t]=0,o.height[t]=0,o.valid[t]=0);}function x(n){if(!d(n))return {width:80,height:24};let t=f(n);return !t||!B(n,t)?{width:80,height:24}:{width:v.width[t],height:v.height[t]}}function I(n,t$1,e,i,s){let r$1;if(n===r)r$1=e;else if(u(n)){let u=t(n);r$1=u!==null?u/100*t$1:0;}else r$1=n;return r$1=Math.max(i,r$1),Number.isFinite(s)&&(r$1=Math.min(s,r$1)),Math.floor(r$1)}function U(n,t,e,i,s,r){G(n,t);let u=J$1(n,t)?E.x[t]:0,m=J$1(n,t)?E.y[t]:0,a=I$1(n,t),f,y;a?(f=u,y=m):(f=e+u,y=i+m);let l=0,g=0;if(B(n,t)){let _=v.width[t],k=v.height[t],O=v.minWidth[t],q=v.minHeight[t],B=v.maxWidth[t],R=v.maxHeight[t],S=v.shrink[t]===1,X=S?0:s,j=S?0:r;l=I(_,s,X,O,B),g=I(k,r,j,q,R);}a||(f+l>e+s&&(l=Math.max(0,e+s-f)),y+g>i+r&&(g=Math.max(0,i+r-y))),o.x[t]=f,o.y[t]=y,o.width[t]=l,o.height[t]=g,o.valid[t]=1;}function Y(n,t,e,i,s,r){U(n,t,e,i,s,r);let u=A(n,t);if(!u)return;let m=f$1(n,t);for(let a of m)Y(n,a,u.x,u.y,u.width,u.height);}function J(n){let t=k(n,[E]),e=[];for(let i of t)k$1(n,i)?i$1(n,i)===a&&e.push(i):e.push(i);return e}var K=n=>{let t=x(n),e=J(n);for(let i of e)Y(n,i,0,0,t.width,t.height);return n};function rt(){return K}function it(n){let t=k(n,[E]);for(let e of t)i(n,e,o)&&(o.valid[e]=0);}function Q(n,t){if(!J$1(n,t))return;let e=0,i=0,s,r;if(k$1(n,t)){let u=i$1(n,t);if(u!==a){let m=Q(n,u);if(m)e=m.x,i=m.y,s=m.width,r=m.height;else {let a=x(n);s=a.width,r=a.height;}}else {let m=x(n);s=m.width,r=m.height;}}else {let u=x(n);s=u.width,r=u.height;}return U(n,t,e,i,s,r),A(n,t)}function ut(n,t){let e=A(n,t);if(e)return {left:e.x,top:e.y,right:e.x+e.width-1,bottom:e.y+e.height-1}}export{o as a,A as b,et as c,ot as d,K as e,rt as f,it as g,Q as h,ut as i};
@@ -0,0 +1 @@
1
+ import {g as g$1,f,j as j$1}from'./chunk-Z4EZERNE.js';import {n as n$1,i as i$1,h}from'./chunk-PXXGH3BV.js';n$1();var g=1e4,e={left:new Uint8Array(g),top:new Uint8Array(g),right:new Uint8Array(g),bottom:new Uint8Array(g)};function S(r){e.left[r]=0,e.top[r]=0,e.right[r]=0,e.bottom[r]=0;}function w(r,t){i$1(r,t,e)||(h(r,t,e),S(t));}function U(r,t,l){return g$1.parse(l),w(r,t),l.left!==void 0&&(e.left[t]=l.left),l.top!==void 0&&(e.top[t]=l.top),l.right!==void 0&&(e.right[t]=l.right),l.bottom!==void 0&&(e.bottom[t]=l.bottom),t}function k(r,t,l){return f.parse(l),w(r,t),e.left[t]=l,e.top[t]=l,e.right[t]=l,e.bottom[t]=l,t}function C(r,t,l,o){return f.parse(l),f.parse(o),w(r,t),e.left[t]=l,e.right[t]=l,e.top[t]=o,e.bottom[t]=o,t}function F(r,t){if(i$1(r,t,e))return {left:e.left[t],top:e.top[t],right:e.right[t],bottom:e.bottom[t]}}function D(r,t){return i$1(r,t,e)}function B(r,t){return i$1(r,t,e)?e.left[t]+e.right[t]:0}function L(r,t){return i$1(r,t,e)?e.top[t]+e.bottom[t]:0}function I(r,t){return i$1(r,t,e)?e.left[t]>0||e.top[t]>0||e.right[t]>0||e.bottom[t]>0:false}n$1();var u=1e4,Y=(o=>(o[o.Hidden=0]="Hidden",o[o.Visible=1]="Visible",o[o.Auto=2]="Auto",o))(Y||{}),n={scrollX:new Float32Array(u),scrollY:new Float32Array(u),scrollWidth:new Float32Array(u),scrollHeight:new Float32Array(u),viewportWidth:new Float32Array(u),viewportHeight:new Float32Array(u),scrollbarVisible:new Uint8Array(u),trackVisible:new Uint8Array(u),alwaysScroll:new Uint8Array(u),clampEnabled:new Uint8Array(u)};function X(r){n.scrollX[r]=0,n.scrollY[r]=0,n.scrollWidth[r]=0,n.scrollHeight[r]=0,n.viewportWidth[r]=0,n.viewportHeight[r]=0,n.scrollbarVisible[r]=2,n.trackVisible[r]=1,n.alwaysScroll[r]=0,n.clampEnabled[r]=1;}function i(r,t){i$1(r,t,n)||(h(r,t,n),X(t));}function m(r){if(!(n.clampEnabled[r]===1))return;let l=n.viewportWidth[r],o=n.viewportHeight[r],c=n.scrollWidth[r],s=n.scrollHeight[r];if(l>0){let b=Math.max(0,c-l);n.scrollX[r]=Math.max(0,Math.min(b,n.scrollX[r]));}else n.scrollX[r]=Math.max(0,n.scrollX[r]);if(o>0){let b=Math.max(0,s-o);n.scrollY[r]=Math.max(0,Math.min(b,n.scrollY[r]));}else n.scrollY[r]=Math.max(0,n.scrollY[r]);}function A(r,t){t.scrollWidth!==void 0&&(n.scrollWidth[r]=t.scrollWidth),t.scrollHeight!==void 0&&(n.scrollHeight[r]=t.scrollHeight),t.viewportWidth!==void 0&&(n.viewportWidth[r]=t.viewportWidth),t.viewportHeight!==void 0&&(n.viewportHeight[r]=t.viewportHeight),t.scrollbarVisible!==void 0&&(n.scrollbarVisible[r]=t.scrollbarVisible);}function P(r,t){t.trackVisible!==void 0&&(n.trackVisible[r]=t.trackVisible?1:0),t.alwaysScroll!==void 0&&(n.alwaysScroll[r]=t.alwaysScroll?1:0),t.clampEnabled!==void 0&&(n.clampEnabled[r]=t.clampEnabled?1:0);}function V(r,t){A(r,t),P(r,t),t.scrollX!==void 0&&(n.scrollX[r]=t.scrollX),t.scrollY!==void 0&&(n.scrollY[r]=t.scrollY),m(r);}function j(r,t,l){return j$1.parse(l),i(r,t),V(t,l),t}function M(r,t,l,o){return i(r,t),n.scrollX[t]=l,n.scrollY[t]=o,m(t),t}function q(r,t){return i$1(r,t,n)?{x:n.scrollX[t],y:n.scrollY[t]}:{x:0,y:0}}function z(r,t,l,o){return i(r,t),n.scrollX[t]=n.scrollX[t]+l,n.scrollY[t]=n.scrollY[t]+o,m(t),t}function G(r,t,l,o){return M(r,t,l,o)}function J(r,t){if(!i$1(r,t,n))return {x:0,y:0};let l=n.scrollX[t],o=n.scrollY[t],c=n.scrollWidth[t],s=n.scrollHeight[t],b=n.viewportWidth[t],W=n.viewportHeight[t],h=c-b,p=s-W,E=h>0?l/h*100:0,x=p>0?o/p*100:0;return {x:Math.min(100,Math.max(0,E)),y:Math.min(100,Math.max(0,x))}}function K(r,t,l,o){i(r,t);let c=n.scrollWidth[t],s=n.scrollHeight[t],b=n.viewportWidth[t],W=n.viewportHeight[t],h=Math.min(100,Math.max(0,l)),p=Math.min(100,Math.max(0,o)),E=Math.max(0,c-b),x=Math.max(0,s-W);return n.scrollX[t]=h/100*E,n.scrollY[t]=p/100*x,t}function Q(r,t){if(i$1(r,t,n))return {scrollX:n.scrollX[t],scrollY:n.scrollY[t],scrollWidth:n.scrollWidth[t],scrollHeight:n.scrollHeight[t],viewportWidth:n.viewportWidth[t],viewportHeight:n.viewportHeight[t],scrollbarVisible:n.scrollbarVisible[t],trackVisible:n.trackVisible[t]===1,alwaysScroll:n.alwaysScroll[t]===1,clampEnabled:n.clampEnabled[t]===1}}function Z(r,t){return i$1(r,t,n)}function $(r,t,l,o){return i(r,t),n.scrollWidth[t]=l,n.scrollHeight[t]=o,m(t),t}function tt(r,t,l,o){return i(r,t),n.viewportWidth[t]=l,n.viewportHeight[t]=o,m(t),t}function rt(r,t,l){return i(r,t),n.scrollbarVisible[t]=l,t}function nt(r,t){return i(r,t),n.scrollY[t]=0,t}function lt(r,t){i(r,t);let l=n.scrollHeight[t],o=n.viewportHeight[t];return n.scrollY[t]=Math.max(0,l-o),t}function ot(r,t){return i(r,t),n.scrollX[t]=0,t}function et(r,t){i(r,t);let l=n.scrollWidth[t],o=n.viewportWidth[t];return n.scrollX[t]=Math.max(0,l-o),t}function at(r,t){if(!i$1(r,t,n))return false;let l=n.scrollWidth[t],o=n.scrollHeight[t],c=n.viewportWidth[t],s=n.viewportHeight[t];return c>0||s>0?l>c||o>s:l>0||o>0}function ct(r,t){if(!i$1(r,t,n))return false;let l=n.scrollWidth[t],o=n.viewportWidth[t];return l>o}function st(r,t){if(!i$1(r,t,n))return false;let l=n.scrollHeight[t],o=n.viewportHeight[t];return l>o}function it(r,t){return i$1(r,t,n)?n.scrollY[t]<=0:true}function ut(r,t){if(!i$1(r,t,n))return true;let l=n.scrollY[t],o=n.scrollHeight[t],c=n.viewportHeight[t],s=Math.max(0,o-c);return l>=s}function bt(r,t){return i$1(r,t,n)?n.scrollX[t]<=0:true}function mt(r,t){if(!i$1(r,t,n))return true;let l=n.scrollX[t],o=n.scrollWidth[t],c=n.viewportWidth[t],s=Math.max(0,o-c);return l>=s}export{et as A,at as B,ct as C,st as D,it as E,ut as F,bt as G,mt as H,e as a,U as b,k as c,C as d,F as e,D as f,B as g,L as h,I as i,Y as j,n as k,j as l,M as m,q as n,z as o,G as p,J as q,K as r,Q as s,Z as t,$ as u,tt as v,rt as w,nt as x,lt as y,ot as z};
@@ -0,0 +1,4 @@
1
+ import {f as f$2,e as e$1}from'./chunk-AEJIX2MW.js';import {e,f as f$4,k as k$2,c,b as b$1}from'./chunk-C5PCEQ6G.js';import {f as f$3,e as e$2,g as g$2,j as j$1}from'./chunk-JHCKPCUH.js';import {b,k as k$1,d as d$1,f as f$1}from'./chunk-A6M6TFBL.js';import {a as a$1}from'./chunk-EAY7B5GL.js';import {g as g$1}from'./chunk-ZAHG7Y3X.js';import {q,p as p$1}from'./chunk-Z4EZERNE.js';import {z as z$1}from'zod';var at="> ",ct=" ",ut=4294967295,ft=6750207,mt=3435973887,bt=255,pt=1717987071;var Xt="Loading...";var a={isList:new Uint8Array(1e4),selectedIndex:new Int32Array(1e4).fill(-1),itemCount:new Uint32Array(1e4),firstVisible:new Uint32Array(1e4),visibleCount:new Uint32Array(1e4),interactive:new Uint8Array(1e4),mouse:new Uint8Array(1e4),keys:new Uint8Array(1e4),searchEnabled:new Uint8Array(1e4),totalCount:new Uint32Array(1e4),isLoading:new Uint8Array(1e4)},d=a$1({iterable:true}),U=new Map,G=new Map,j=new Map,X=new Map,D=new Map,B=new Map,T=new Map,V=new Map,F=new Map,$=new Map,I=new Map,H=new Map,P=new Map;function _(e){return d.get(e)??[]}function oe(e,t,r){d.set(t,[...r]),a.itemCount[t]=r.length,(a.selectedIndex[t]??-1)>=r.length&&(a.selectedIndex[t]=r.length>0?r.length-1:-1),(a.firstVisible[t]??0)>=r.length&&(a.firstVisible[t]=Math.max(0,r.length-1)),g$1(e,t);}function le(e,t,r,n){let o=d.get(t)??[],l=n??o.length;o.splice(l,0,r),d.set(t,o),a.itemCount[t]=o.length;let s=a.selectedIndex[t]??-1;s>=0&&l<=s&&(a.selectedIndex[t]=s+1),g$1(e,t);}function se(e,t,r){let n=d.get(t)??[];if(r<0||r>=n.length)return;let o=n.splice(r,1)[0];a.itemCount[t]=n.length;let l=a.selectedIndex[t]??-1;return l>=0&&(r<l?a.selectedIndex[t]=l-1:r===l&&(a.selectedIndex[t]=n.length>0?Math.min(r,n.length-1):-1)),g$1(e,t),o}function A(e,t){return d.get(e)?.[t]}function ie(e,t,r,n){let o=d.get(t);return !o||r<0||r>=o.length?false:(o[r]=n,g$1(e,t),true)}function ae(e){return a.itemCount[e]??0}function ce(e,t){d.set(t,[]),a.itemCount[t]=0,a.selectedIndex[t]=-1,a.firstVisible[t]=0,g$1(e,t);}function ue(e){return a.firstVisible[e]??0}function fe(e,t){let r=G.get(e);if(!r||r.size===0)return;let n=a.firstVisible[e]??0,o=a.visibleCount[e]??0,l=a.itemCount[e]??0,s=a.totalCount[e]??l,c=o,m={firstVisible:n,visibleCount:o,loadedCount:l,totalCount:s,nearEnd:n+o>=l-c,nearStart:n<=c};for(let b of r)b(m);}function tt(e,t,r){let n=a.itemCount[t]??0,o=a.totalCount[t]??n,l=Math.max(0,Math.max(n,o)-1),s=Math.max(0,Math.min(r,l));a.firstVisible[t]=s,g$1(e,t),fe(t);}function me(e){return a.visibleCount[e]??0}function be(e,t,r){a.visibleCount[t]=Math.max(1,r),g$1(e,t);}function yt(e,t,r){if(r<0)return;let n=a.firstVisible[t]??0,o=a.visibleCount[t]??0,l=n+o-1;r<n?tt(e,t,r):r>l&&tt(e,t,r-o+1);}var dt=null;function Vt(e){dt=e;}function pe(e,t,r){let n=a.firstVisible[t]??0,o=a.visibleCount[t]??0,l=a.itemCount[t]??0,s=n+r*o;if(s<0||s>=l)return false;tt(e,t,s);let c=a.selectedIndex[t]??-1;if(c>=0&&dt){let m=c+r*o;dt(e,t,Math.max(0,Math.min(m,l-1)));}return true}function ht(e){let t=d.get(e)??[],r=a.firstVisible[e]??0,n=a.visibleCount[e]??t.length,o=[];for(let l=0;l<n&&r+l<t.length;l++){let s=r+l,c=t[s];c&&o.push({index:s,item:c});}return o}function de(e,t,r){a.totalCount[t]=r,g$1(e,t);}function Pt(e){let t=a.totalCount[e]??0;return t===0?a.itemCount[e]??0:t}function ge(e,t){U.set(e,t);}function ye(e){return U.get(e)}function he(e){U.delete(e);}function xe(e,t){let r=G.get(e);return r||(r=new Set,G.set(e,r)),r.add(t),()=>{r?.delete(t);}}function gt(e,t,r){a.isLoading[t]=r?1:0,g$1(e,t);}function Ee(e){return a.isLoading[e]===1}function Ce(e,t){j.set(e,t);}function Le(e){return j.get(e)??Xt}async function Se(e,t,r,n){let o=U.get(t);if(o&&a.isLoading[t]!==1){gt(e,t,true);try{let l=await o(r,n),s=d.get(t)??[];for(;s.length<r+l.length;)s.push({text:"",disabled:!0});for(let c=0;c<l.length;c++){let m=l[c];m&&(s[r+c]=m);}d.set(t,s),a.itemCount[t]=s.length,g$1(e,t);}finally{gt(e,t,false);}}}function ve(e){let t=a.firstVisible[e]??0,r=a.visibleCount[e]??0,n=a.totalCount[e]??0,o=d.get(e)??[],l=Math.min(t+r,n);for(let s=t;s<l;s++){let c=o[s];if(!c||c.text==="")return {needsLoad:true,startIndex:t,count:r}}return {needsLoad:false,startIndex:0,count:0}}function Te(e,t){let r=a.firstVisible[e]??0,n=a.visibleCount[e]??0,o=a.itemCount[e]??0,l=Pt(e),s=t??n;return {firstVisible:r,visibleCount:n,loadedCount:o,totalCount:l,nearEnd:r+n>=o-s,nearStart:r<=s}}function Ie(e,t,r){let n=d.get(t)??[];n.push(...r),d.set(t,n),a.itemCount[t]=n.length,g$1(e,t);}function Ae(e){return a.selectedIndex[e]??-1}function we(e){let t=a.selectedIndex[e]??-1;if(!(t<0))return A(e,t)}function We(e,t,r){return t<-1||t>=r?false:t<0?true:!A(e,t)?.disabled}function De(e,t){if(t<0)return;let r=A(e,t);if(!r)return;let n=D.get(e);if(n)for(let o of n)o(t,r);}function x(e,t,r){let n=a.itemCount[t]??0,o=a.selectedIndex[t]??-1;return !We(t,r,n)||o===r?false:(a.selectedIndex[t]=r,g$1(e,t),De(t,r),yt(e,t,r),true)}function Be(e,t,r=true){let n=a.itemCount[t]??0;if(n===0)return false;let o=a.selectedIndex[t]??-1,l=o;do{if(o--,o<0)if(r)o=n-1;else return false;if(!A(t,o)?.disabled)return x(e,t,o)}while(o!==l);return false}function Fe(e,t,r=true){let n=a.itemCount[t]??0;if(n===0)return false;let o=a.selectedIndex[t]??-1,l=o;do{if(o++,o>=n)if(r)o=0;else return false;if(!A(t,o)?.disabled)return x(e,t,o)}while(o!==l);return false}function _e(e,t){let r=a.itemCount[t]??0;for(let n=0;n<r;n++)if(!A(t,n)?.disabled)return x(e,t,n);return false}function ke(e,t){let r=a.itemCount[t]??0;for(let n=r-1;n>=0;n--)if(!A(t,n)?.disabled)return x(e,t,n);return false}function Me(e,t,r){let o=(d.get(t)??[]).findIndex(l=>l.value===r);return o>=0?x(e,t,o):false}function Re(e,t){x(e,t,-1);}function Ue(e,t){let r=a.selectedIndex[t]??-1;if(r<0)return false;let n=A(t,r);if(!n||n.disabled)return false;let o=B.get(t);if(o)for(let l of o)l(r,n);return true}function Xe(e,t){let r=D.get(e)??[];return r.push(t),D.set(e,r),()=>{let n=D.get(e);if(n){let o=n.indexOf(t);o!==-1&&n.splice(o,1);}}}function Ve(e,t){let r=B.get(e)??[];return r.push(t),B.set(e,r),()=>{let n=B.get(e);if(n){let o=n.indexOf(t);o!==-1&&n.splice(o,1);}}}function Pe(e,t){let r=F.get(e)??[];return r.push(t),F.set(e,r),()=>{let n=F.get(e);if(n){let o=n.indexOf(t);o!==-1&&n.splice(o,1);}}}function Ye(e){let t=F.get(e);if(t)for(let r of t)r();}function Ne(e){D.delete(e),B.delete(e),F.delete(e);}var xt={initial:"idle",states:{idle:{on:{focus:"focused",disable:"disabled"}},focused:{on:{blur:"idle",startSelect:"selecting",startSearch:"searching",disable:"disabled"}},selecting:{on:{endSelect:"focused",blur:"idle",disable:"disabled"}},searching:{on:{endSearch:"focused",blur:"idle",disable:"disabled"}},disabled:{on:{enable:"idle"}}}};function Ge(e,t,r=[],n={}){z$1.array(q).parse(r),p$1.parse(n),a.isList[t]=1,a.selectedIndex[t]=n.selectedIndex??-1,a.itemCount[t]=r.length,a.firstVisible[t]=0,a.visibleCount[t]=n.visibleCount??r.length,a.interactive[t]=n.interactive!==false?1:0,a.mouse[t]=n.mouse!==false?1:0,a.keys[t]=n.keys!==false?1:0,a.searchEnabled[t]=n.search===true?1:0,d.set(t,[...r]),b(e,t,xt);}function Y(e,t){return a.isList[t]===1&&k$1(e,t)}function Et(e,t){return d$1(e,t)??"idle"}function et(e,t,r){return Et(e,t)===r}function He(e,t){let r=Et(e,t);return r==="focused"||r==="selecting"}function Ct(e,t){return et(e,t,"disabled")}function k(e,t,r){if(!Y(e,t))return false;let n=f$1(e,t,r);return n&&g$1(e,t),n}function ze(e,t){return k(e,t,"focus")}function Qe(e,t){return k(e,t,"blur")}function Ke(e,t){return k(e,t,"disable")}function je(e,t){return k(e,t,"enable")}function $e(e,t){let r=X.get(e);X.set(e,{selectedPrefix:t.selectedPrefix??r?.selectedPrefix??"> ",unselectedPrefix:t.unselectedPrefix??r?.unselectedPrefix??" ",selectedFg:t.selectedFg??r?.selectedFg??4294967295,selectedBg:t.selectedBg??r?.selectedBg??6750207,itemFg:t.itemFg??r?.itemFg??3435973887,itemBg:t.itemBg??r?.itemBg??255,disabledFg:t.disabledFg??r?.disabledFg??1717987071});}function Lt(e){return X.get(e)??{selectedPrefix:"> ",unselectedPrefix:" ",selectedFg:4294967295,selectedBg:6750207,itemFg:3435973887,itemBg:255,disabledFg:1717987071}}function Ze(e){X.delete(e);}function Je(e,t,r){let n=r.toLowerCase();H.set(t,n);let o=_(t),l=n===""?[...o]:o.filter(s=>s.text.toLowerCase().includes(n));P.set(t,l),l.length>0?a.selectedIndex[t]=0:a.selectedIndex[t]=-1,a.firstVisible[t]=0,g$1(e,t);}function qe(e,t){H.delete(t),P.delete(t),a.firstVisible[t]=0,_(t).length>0&&(a.selectedIndex[t]=0),g$1(e,t);}function tr(e){let t=H.get(e);if(t===void 0||t==="")return _(e);let r=P.get(e);if(r)return r;let o=_(e).filter(l=>l.text.toLowerCase().includes(t.toLowerCase()));return P.set(e,o),o}function er(e,t){$.set(e,t),t&&!I.has(e)&&I.set(e,new Set);}function M(e){return $.get(e)??false}function rr(e,t){if(!M(e))throw new Error("Multi-select is not enabled for this list");let r=I.get(e);return r?r.has(t)?(r.delete(t),false):(r.add(t),true):false}function nr(e){if(!M(e))throw new Error("Multi-select is not enabled for this list");let t=I.get(e);return t?Array.from(t).sort((r,n)=>r-n):[]}function or(e){if(!M(e))return;let t=_(e),r=I.get(e);if(r){r.clear();for(let n=0;n<t.length;n++)r.add(n);}}function lr(e){if(!M(e))return;let t=I.get(e);t&&t.clear();}function sr(e,t){return M(e)?I.get(e)?.has(t)??false:false}function ir(e){return a.interactive[e]===1}function ar(e,t,r){a.interactive[t]=r?1:0,g$1(e,t);}function cr(e){return a.mouse[e]===1}function ur(e,t,r){a.mouse[t]=r?1:0,g$1(e,t);}function St(e){return a.keys[e]===1}function fr(e,t,r){a.keys[t]=r?1:0,g$1(e,t);}function Yt(e){return a.searchEnabled[e]===1}function mr(e,t,r){a.searchEnabled[t]=r?1:0,g$1(e,t);}function vt(e,t){return et(e,t,"searching")}function br(e,t){if(!Y(e,t)||!Yt(t))return false;let r=k(e,t,"startSearch");return r&&T.set(t,""),r}function pr(e,t){if(!Y(e,t))return false;let r=k(e,t,"endSearch");return r&&T.delete(t),r}function dr(e){return T.get(e)??""}function rt(e,t,r){T.set(t,r),g$1(e,t);let n=V.get(t);if(n)for(let o of n)o(r);return r.length>0?Nt(e,t,r):false}function gr(e,t,r){let n=T.get(t)??"";return rt(e,t,n+r)}function yr(e,t){let r=T.get(t)??"";return r.length===0?false:rt(e,t,r.slice(0,-1))}function hr(e,t){rt(e,t,"");}function Nt(e,t,r){let n=d.get(t)??[],o=r.toLowerCase();for(let l=0;l<n.length;l++){let s=n[l];if(s&&!s.disabled&&s.text.toLowerCase().startsWith(o))return x(e,t,l)}return false}function xr(e,t){let r=T.get(t);if(!r||r.length===0)return false;let n=d.get(t)??[],o=a.selectedIndex[t]??-1,l=r.toLowerCase();for(let s=o+1;s<n.length;s++){let c=n[s];if(c&&!c.disabled&&c.text.toLowerCase().startsWith(l))return x(e,t,s)}for(let s=0;s<=o;s++){let c=n[s];if(c&&!c.disabled&&c.text.toLowerCase().startsWith(l))return x(e,t,s)}return false}function Er(e,t){let r=V.get(e)??[];return r.push(t),V.set(e,r),()=>{let n=V.get(e);if(n){let o=n.indexOf(t);o!==-1&&n.splice(o,1);}}}function Cr(e,t,r){if(!Y(e,t)||Ct(e,t)||!St(t))return null;if(vt(e,t))return Lr(r);switch(r){case "up":case "k":return {type:"selectPrev"};case "down":case "j":return {type:"selectNext"};case "home":case "g":return {type:"selectFirst"};case "end":case "G":return {type:"selectLast"};case "pageup":return {type:"pageUp"};case "pagedown":return {type:"pageDown"};case "enter":return {type:"confirm"};case " ":case "space":return M(t)?{type:"toggleSelect"}:{type:"confirm"};case "escape":return {type:"cancel"};case "/":return {type:"startSearch"};default:return null}}function Lr(e){switch(e){case "escape":return {type:"endSearch"};case "enter":return {type:"endSearch"};case "backspace":return {type:"searchBackspace"};case "up":case "down":return {type:"endSearch"};case "tab":case "C-n":return {type:"searchNextMatch"};default:return e.length===1&&e>=" "?{type:"searchChar",char:e}:null}}function Sr(e,t){let r=Lt(e),n=ht(e),o=a.selectedIndex[e]??-1,l=[];for(let{index:s,item:c}of n){let b=s===o?r.selectedPrefix:r.unselectedPrefix,y=c.text,C=t-b.length,L=y.length>C?`${y.slice(0,C-1)}\u2026`:y;l.push(b+L);}return l}function vr(){a.isList.fill(0),a.selectedIndex.fill(-1),a.itemCount.fill(0),a.firstVisible.fill(0),a.visibleCount.fill(0),a.interactive.fill(0),a.mouse.fill(0),a.keys.fill(0),a.searchEnabled.fill(0),a.totalCount.fill(0),a.isLoading.fill(0),d.clear(),X.clear(),D.clear(),B.clear(),F.clear(),$.clear(),I.clear(),H.clear(),P.clear(),T.clear(),V.clear(),U.clear(),G.clear(),j.clear();}Vt(x);var Tr=["|","/","-","\\"],Oo=[". ",".. ","..."," .."," ."," "],Go=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],Ho=["\u2596","\u2598","\u259D","\u2597"],zo=100,p={frame:new Uint8Array(1e4),frameCount:new Uint8Array(1e4),interval:new Uint16Array(1e4),elapsed:new Float32Array(1e4)},z=new Map,Z=new Set;function Qo(e,t,r={}){let n=r.frames??Tr,o=r.interval??100;p.frame[t]=0,p.frameCount[t]=n.length,p.interval[t]=o,p.elapsed[t]=0,z.set(t,n),Z.add(t);}function Ko(e,t){Z.has(t)&&(p.frame[t]=0,p.frameCount[t]=0,p.interval[t]=0,p.elapsed[t]=0,z.delete(t),Z.delete(t));}function jo(e,t){return Z.has(t)}function $o(e){let t=z.get(e);if(!t)return "";let r=p.frame[e]??0;return t[r%t.length]??""}function Zo(e){let t=z.get(e);return t?{frame:p.frame[e]??0,frameCount:p.frameCount[e]??0,interval:p.interval[e]??100,elapsed:p.elapsed[e]??0,frames:t}:null}function Jo(e,t){p.interval[e]=t;}function qo(e,t){z.set(e,t),p.frameCount[e]=t.length,(p.frame[e]??0)>=t.length&&(p.frame[e]=0);}function Ir(e){let t=p.frameCount[e]??1,r=((p.frame[e]??0)+1)%t;return p.frame[e]=r,r}function tl(e,t){let r=(p.elapsed[e]??0)+t,n=p.interval[e]??100;return r>=n?(Ir(e),p.elapsed[e]=r%n,true):(p.elapsed[e]=r,false)}function el(e){p.frame[e]=0,p.elapsed[e]=0;}function rl(){z.clear(),Z.clear();}var Ot=4294967295,Gt=858993663,Ht=3435973887,zt=255,Qt=1717987071,Kt=255,S=1e4,w={rowCount:new Uint32Array(S),colCount:new Uint16Array(S),headerRows:new Uint8Array(S).fill(1),pad:new Uint8Array(S).fill(1),cellBorders:new Uint8Array(S)},f={isTable:new Uint8Array(S),rowCount:new Uint32Array(S),colCount:new Uint16Array(S),headerRows:new Uint8Array(S).fill(1),pad:new Uint8Array(S).fill(1),cellBorders:new Uint8Array(S)},g=new Map,K=new Map,Q=new Map;function ll(e,t,r={}){f.isTable[t]=1,f.rowCount[t]=0,f.colCount[t]=0,f.headerRows[t]=r.headerRows??1,f.pad[t]=r.pad??1,f.cellBorders[t]=r.cellBorders===true?1:0,w.rowCount[t]=0,w.colCount[t]=0,w.headerRows[t]=r.headerRows??1,w.pad[t]=r.pad??1,w.cellBorders[t]=r.cellBorders===true?1:0,g.set(t,[]),K.set(t,[]);}function sl(e,t){return f.isTable[t]===1}function il(e,t){f.isTable[t]=0,f.rowCount[t]=0,f.colCount[t]=0,f.headerRows[t]=1,f.pad[t]=1,f.cellBorders[t]=0,w.rowCount[t]=0,w.colCount[t]=0,w.headerRows[t]=1,w.pad[t]=1,w.cellBorders[t]=0,g.delete(t),K.delete(t),Q.delete(t);}function al(e,t,r){let n=r.map(o=>o.map(l=>typeof l=="string"?{value:l}:l));g.set(t,n),f.rowCount[t]=n.length,f.colCount[t]=n.reduce((o,l)=>Math.max(o,l.length),0),g$1(e,t);}function cl(e,t){return g.get(t)??[]}function ul(e,t){return (g.get(t)??[]).map(n=>n.map(o=>o.value))}function fl(e,t,r,n,o){let l=g.get(t);if(!l||r<0||n<0)return false;for(;l.length<=r;)l.push([]);let s=l[r];if(!s)return false;for(;s.length<=n;)s.push({value:""});s[n]=typeof o=="string"?{value:o}:o;let c=l.reduce((m,b)=>Math.max(m,b.length),0);return f.colCount[t]=c,f.rowCount[t]=l.length,g$1(e,t),true}function Ar(e,t,r,n){let o=g.get(t);if(!(!o||r<0||n<0))return o[r]?.[n]}function ml(e,t,r,n){return Ar(e,t,r,n)?.value}function bl(e,t,r){return g.get(t)?.[r]}function pl(e,t,r){return (g.get(t)??[]).map(o=>o[r]??{value:""})}function dl(e,t){return f.rowCount[t]??0}function gl(e,t){return f.colCount[t]??0}function yl(e,t,r){let n=g.get(t)??[],o=r.map(l=>typeof l=="string"?{value:l}:l);n.push(o),f.rowCount[t]=n.length,f.colCount[t]=Math.max(f.colCount[t]??0,o.length),g$1(e,t);}function hl(e,t,r,n){let o=g.get(t)??[],l=n.map(c=>typeof c=="string"?{value:c}:c),s=Math.max(0,Math.min(r,o.length));o.splice(s,0,l),f.rowCount[t]=o.length,f.colCount[t]=Math.max(f.colCount[t]??0,l.length),g$1(e,t);}function xl(e,t,r){let n=g.get(t);if(!n||r<0||r>=n.length)return;let o=n.splice(r,1)[0];return f.rowCount[t]=n.length,f.colCount[t]=n.reduce((l,s)=>Math.max(l,s.length),0),g$1(e,t),o}function El(e,t){g.set(t,[]),f.rowCount[t]=0,f.colCount[t]=0,g$1(e,t);}function Cl(e,t,r){K.set(t,[...r]);let n=g.get(t)??[];if((f.headerRows[t]??1)>0){let l=r.map(s=>({value:s.header,align:s.align??"left"}));n.length===0?n.unshift(l):n[0]=l,f.rowCount[t]=n.length,f.colCount[t]=r.length;}g$1(e,t);}function Ll(e,t){return K.get(t)??[]}function Sl(e,t){let r=g.get(t)??[],n=f.headerRows[t]??1;return r.slice(0,n)}function vl(e,t){let r=g.get(t)??[],n=f.headerRows[t]??1;return r.slice(n)}function Tl(e,t,r){f.headerRows[t]=Math.max(0,Math.min(255,r)),g$1(e,t);}function Il(e,t){return f.headerRows[t]??1}function Al(e,t,r){let n=Q.get(t),o=r.altRowBg??n?.altRowBg,l=r.selectedFg??n?.selectedFg,s=r.selectedBg??n?.selectedBg,c={headerFg:r.headerFg??n?.headerFg??Ot,headerBg:r.headerBg??n?.headerBg??Gt,cellFg:r.cellFg??n?.cellFg??Ht,cellBg:r.cellBg??n?.cellBg??zt,borderFg:r.borderFg??n?.borderFg??Qt,borderBg:r.borderBg??n?.borderBg??Kt,...o!==void 0&&{altRowBg:o},...l!==void 0&&{selectedFg:l},...s!==void 0&&{selectedBg:s}};Q.set(t,c);}function wl(e,t){return Q.get(t)??{headerFg:Ot,headerBg:Gt,cellFg:Ht,cellBg:zt,borderFg:Qt,borderBg:Kt}}function Wl(e,t){Q.delete(t);}function Dl(e,t){return f.pad[t]??1}function Bl(e,t,r){f.pad[t]=Math.max(0,Math.min(255,r)),g$1(e,t);}function Fl(e,t){return f.cellBorders[t]===1}function _l(e,t,r){f.cellBorders[t]=r?1:0,g$1(e,t);}function wr(e,t,r){let n=new Array(t).fill(0);for(let o of e)for(let l=0;l<o.length;l++){let s=o[l];s&&(n[l]=Math.max(n[l]??0,s.value.length+r*2));}return n}function Wr(e,t){for(let r=0;r<t.length;r++){let n=t[r];n&&(n.width!==void 0?e[r]=n.width:(n.minWidth!==void 0&&(e[r]=Math.max(e[r]??0,n.minWidth)),n.maxWidth!==void 0&&(e[r]=Math.min(e[r]??0,n.maxWidth))));}}function Dr(e,t){let r=e.reduce((n,o)=>n+o,0);if(r>t){let n=t/r;for(let o=0;o<e.length;o++)e[o]=Math.floor((e[o]??0)*n);}}function Br(e,t,r){let n=g.get(t)??[],o=K.get(t)??[],l=f.colCount[t]??0,s=f.pad[t]??1,c=wr(n,l,s);return Wr(c,o),r!==void 0&&Dr(c,r),c}function Fr(e,t,r){if(r==="right")return e.padStart(t);if(r==="center"){let n=Math.floor((t-e.length)/2);return e.padStart(n+e.length).padEnd(t)}return e.padEnd(t)}function _r(e,t,r,n){let o=t-r*2,l=e.value;l.length>o&&(l=`${l.slice(0,o-1)}\u2026`);let s=Fr(l,o,e.align??"left");return n+s+n}function kr(e,t,r,n){let o=" ".repeat(r),l=n?"\u2502":"",s="";for(let c=0;c<t.length;c++){let m=e[c]??{value:""};c>0&&n&&(s+=l),s+=_r(m,t[c]??0,r,o);}return s}function kl(e,t,r){let n=g.get(t)??[],o=Br(e,t,r),l=f.pad[t]??1,s=f.cellBorders[t]===1,c=f.headerRows[t]??1,m=[];for(let b=0;b<n.length;b++)m.push(kr(n[b]??[],o,l,s)),s&&b===c-1&&b<n.length-1&&m.push(o.map(y=>"\u2500".repeat(y)).join("\u253C"));return m}function Ml(){f.isTable.fill(0),f.rowCount.fill(0),f.colCount.fill(0),f.headerRows.fill(1),f.pad.fill(1),f.cellBorders.fill(0),g.clear(),K.clear(),Q.clear();}var R=1e4,Mr=80,Rr=24,Ur=1e3,i={isTerminal:new Uint8Array(R),width:new Uint16Array(R),height:new Uint16Array(R),cursorX:new Uint16Array(R),cursorY:new Uint16Array(R),cursorVisible:new Uint8Array(R),scrollOffset:new Uint32Array(R),altScreenActive:new Uint8Array(R)},E=new Map,Xr=z$1.object({width:z$1.number().int().positive().default(Mr),height:z$1.number().int().positive().default(Rr),scrollbackLines:z$1.number().int().nonnegative().default(Ur),cursorVisible:z$1.boolean().default(true),cursorShape:z$1.enum(["block","underline","bar"]).default("block"),cursorBlink:z$1.boolean().default(true)});function Vr(e,t,r,n,o){let l={maxLines:r,chunkSize:Math.min(r,1e3)};return {buffer:k$2(e,t),scrollback:e$2(l),currentAttr:e$1(),escapeBuffer:"",inEscape:false,savedCursorX:0,savedCursorY:0,savedAttr:e$1(),altBuffer:null,cursorShape:n,cursorBlink:o}}function Pr(e,t,r){return r*e+t}function Yr(e){let t=b$1,r=c,n=[255,2852126975,11141375,2863268095,43775,2852170495,11184895,2863311615,1431655935,4283782655,1442797055,4294923775,1431699455,4283826175,1442840575,4294967295];return e.fg.type===1?t=n[e.fg.value]??b$1:e.fg.type===3&&(t=e.fg.value<<8|255),e.bg.type===1?r=n[e.bg.value]??c:e.bg.type===3&&(r=e.bg.value<<8|255),{fg:t,bg:r,attrs:e.styles}}function It(e$1,t,r){let n=Nr(e$1.buffer,0,t);g$2(e$1.scrollback,n);for(let l=0;l<r-1;l++)for(let s=0;s<t;s++){let c=(l+1)*t+s,m=l*t+s,b=e$1.buffer.cells[c];b&&(e$1.buffer.cells[m]=f$4(b));}let o=e();for(let l=0;l<t;l++){let s=(r-1)*t+l;e$1.buffer.cells[s]=f$4(o);}}function Nr(e,t,r){let n="";for(let o=0;o<r;o++){let l=t*r+o,s=e.cells[l];n+=s?.char??" ";}return n.trimEnd()}function Nl(e,t,r={}){let n=Xr.parse(r);i.isTerminal[t]=1,i.width[t]=n.width,i.height[t]=n.height,i.cursorX[t]=0,i.cursorY[t]=0,i.cursorVisible[t]=n.cursorVisible?1:0,i.scrollOffset[t]=0,i.altScreenActive[t]=0;let o=Vr(n.width,n.height,n.scrollbackLines,n.cursorShape,n.cursorBlink);E.set(t,o),g$1(e,t);}function Or(e){return i.isTerminal[e]===1}function Ol(e){return E.get(e)}function Gl(e){if(Or(e))return {width:i.width[e]??0,height:i.height[e]??0,cursorX:i.cursorX[e]??0,cursorY:i.cursorY[e]??0,cursorVisible:i.cursorVisible[e]===1,scrollOffset:i.scrollOffset[e]??0}}function Gr(e,t,r,n,o){let l=(i.cursorY[t]??0)+1;l>=o&&(It(r,n,o),l=o-1),i.cursorX[t]=0,i.cursorY[t]=l,g$1(e,t);}function Hr(e,t,r){let n=i.cursorX[t]??0,o=Math.min((Math.floor(n/8)+1)*8,r-1);i.cursorX[t]=o,g$1(e,t);}function zr(e$1,t,r,n,o,l){let s=i.cursorX[t]??0,c=i.cursorY[t]??0,{fg:m,bg:b,attrs:y}=Yr(r.currentAttr),C=Pr(o,s,c);r.buffer.cells[C]=e(n,m,b,y);let L=s+1;L>=o&&(L=0,c++,c>=l&&(It(r,o,l),c=l-1)),i.cursorX[t]=L,i.cursorY[t]=c,g$1(e$1,t);}function Qr(e,t,r){let n=E.get(t);if(!n)return;let o=i.width[t]??0,l=i.height[t]??0;if(r===`
2
+ `){Gr(e,t,n,o,l);return}if(r==="\r"){i.cursorX[t]=0,g$1(e,t);return}if(r==="\b"){let s=i.cursorX[t]??0;s>0&&(i.cursorX[t]=s-1),g$1(e,t);return}if(r===" "){Hr(e,t,o);return}zr(e,t,n,r,o,l);}function Hl(e,t,r){let n=E.get(t);if(n)for(let o=0;o<r.length;o++){let l=r[o];if(l!==void 0){if(l==="\x1B"){n.inEscape=true,n.escapeBuffer=l;continue}if(n.inEscape){n.escapeBuffer+=l,Kr(n.escapeBuffer)&&(jr(e,t,n,n.escapeBuffer),n.inEscape=false,n.escapeBuffer="");continue}Qr(e,t,l);}}}function Kr(e){if(e.length<2)return false;if(e[1]==="["){let t=e[e.length-1];return t===void 0?false:/[A-Za-z@`~]/.test(t)}return e[1]==="]"?e.endsWith("\x07")||e.endsWith("\x1B\\"):e.length>=2}function jr(e,t,r,n){if(n.length<2)return;let o=n[1];if(o==="["){$r(e,t,r,n);return}switch(o){case "c":En(e,t);break;case "7":r.savedCursorX=i.cursorX[t]??0,r.savedCursorY=i.cursorY[t]??0,r.savedAttr=f$2(r.currentAttr);break;case "8":i.cursorX[t]=r.savedCursorX,i.cursorY[t]=r.savedCursorY,r.currentAttr=f$2(r.savedAttr),g$1(e,t);break;case "D":nt(e,t,r,1);break;case "M":Tt(e,t,1);break;case "E":i.cursorX[t]=0,nt(e,t,r,1);break}}function $r(e,t,r,n){let o=n.match(/^\x1b\[(\??[\d;]*)([A-Za-z@`~])$/);if(!o)return;let l=o[1]??"",s=o[2],c=l===""?[]:l.split(";").map(L=>parseInt(L,10)||0),m=c[0]??1,b=c[1]??1,y=i.width[t]??0,C=i.height[t]??0;switch(s){case "A":Tt(e,t,m);break;case "B":nt(e,t,r,m);break;case "C":tn(e,t,m,y);break;case "D":en(e,t,m);break;case "E":i.cursorX[t]=0,nt(e,t,r,m);break;case "F":i.cursorX[t]=0,Tt(e,t,m);break;case "G":i.cursorX[t]=Math.min(Math.max(m-1,0),y-1),g$1(e,t);break;case "H":case "f":i.cursorY[t]=Math.min(Math.max(m-1,0),C-1),i.cursorX[t]=Math.min(Math.max(b-1,0),y-1),g$1(e,t);break;case "J":on(e,t,r,c[0]??0);break;case "K":ln(e,t,r,c[0]??0);break;case "m":hn(r,c.length===0?[0]:c);break;case "h":jt(e,t,r,l,true);break;case "l":jt(e,t,r,l,false);break;case "s":r.savedCursorX=i.cursorX[t]??0,r.savedCursorY=i.cursorY[t]??0;break;case "u":i.cursorX[t]=r.savedCursorX,i.cursorY[t]=r.savedCursorY,g$1(e,t);break}}function Zr(e,t,r){i.cursorVisible[t]=r?1:0,g$1(e,t);}function Jr(e,t,r,n){n?(r.savedCursorX=i.cursorX[t]??0,r.savedCursorY=i.cursorY[t]??0,Zt(e,t,r)):(Jt(e,t,r),i.cursorX[t]=r.savedCursorX,i.cursorY[t]=r.savedCursorY),g$1(e,t);}function qr(e,t,r,n,o){o?(Zt(e,t,r),n==="1047"&&qt(r,0,r.buffer.cells.length)):Jt(e,t,r),g$1(e,t);}function jt(e,t,r,n,o){let l=n.startsWith("?")?n.slice(1):n;if(l==="25"){Zr(e,t,o);return}if(l==="1049"){Jr(e,t,r,o);return}if(l==="47"||l==="1047"){qr(e,t,r,l,o);return}}function Zt(e$1,t,r){if(i.altScreenActive[t]===1)return;let n=i.width[t]??0,o=i.height[t]??0;r.altBuffer||(r.altBuffer=k$2(n,o));for(let s=0;s<r.buffer.cells.length&&s<r.altBuffer.cells.length;s++){let c=r.buffer.cells[s];c&&(r.altBuffer.cells[s]=f$4(c));}let l=e();for(let s=0;s<r.buffer.cells.length;s++)r.buffer.cells[s]=f$4(l);i.cursorX[t]=0,i.cursorY[t]=0,i.altScreenActive[t]=1;}function Jt(e,t,r){if(i.altScreenActive[t]!==0){if(r.altBuffer)for(let n=0;n<r.altBuffer.cells.length&&n<r.buffer.cells.length;n++){let o=r.altBuffer.cells[n];o&&(r.buffer.cells[n]=f$4(o));}i.altScreenActive[t]=0;}}function Tt(e,t,r){let n=i.cursorY[t]??0;i.cursorY[t]=Math.max(0,n-r),g$1(e,t);}function nt(e,t,r,n){let o=i.width[t]??0,l=i.height[t]??0,s=i.cursorY[t]??0;for(s+=n;s>=l;)It(r,o,l),s--;i.cursorY[t]=s,g$1(e,t);}function tn(e,t,r,n){let o=i.cursorX[t]??0;i.cursorX[t]=Math.min(n-1,o+r),g$1(e,t);}function en(e,t,r){let n=i.cursorX[t]??0;i.cursorX[t]=Math.max(0,n-r),g$1(e,t);}function qt(e$1,t,r){let n=e();for(let o=t;o<r;o++)e$1.buffer.cells[o]=f$4(n);}function te(e$1,t,r,n,o){let l=e();for(let s=n;s<=o;s++){let c=r*t+s;e$1.buffer.cells[c]=f$4(l);}}function ee(e$1,t,r,n){let o=e();for(let l=r;l<n;l++)for(let s=0;s<t;s++){let c=l*t+s;e$1.buffer.cells[c]=f$4(o);}}function rn(e,t,r,n,o){te(e,t,o,n,t-1),ee(e,t,o+1,r);}function nn(e,t,r,n){ee(e,t,0,n),te(e,t,n,0,r);}function on(e,t,r,n){let o=i.width[t]??0,l=i.height[t]??0,s=i.cursorX[t]??0,c=i.cursorY[t]??0;n===0?rn(r,o,l,s,c):n===1?nn(r,o,s,c):(n===2||n===3)&&(qt(r,0,r.buffer.cells.length),n===3&&f$3(r.scrollback)),g$1(e,t);}function ln(e$1,t,r,n){let o=i.width[t]??0,l=i.cursorX[t]??0,s=i.cursorY[t]??0,c=e();switch(n){case 0:for(let m=l;m<o;m++){let b=s*o+m;r.buffer.cells[b]=f$4(c);}break;case 1:for(let m=0;m<=l;m++){let b=s*o+m;r.buffer.cells[b]=f$4(c);}break;case 2:for(let m=0;m<o;m++){let b=s*o+m;r.buffer.cells[b]=f$4(c);}break}g$1(e$1,t);}function sn(e){return e.currentAttr=e$1(),1}function an(e,t,r){let n=t[r]??0;return e.currentAttr.styles|=1<<n-1,1}function cn(e,t,r){let n=t[r]??0;return e.currentAttr.styles&=~(1<<n-22+1),1}function un(e,t,r){let n=t[r]??0;return e.currentAttr.fg={type:1,value:n-30},1}function fn(e){return e.currentAttr.fg={type:0,value:0},1}function mn(e,t,r){let n=t[r]??0;return e.currentAttr.bg={type:1,value:n-40},1}function bn(e){return e.currentAttr.bg={type:0,value:0},1}function pn(e,t,r){let n=t[r]??0;return e.currentAttr.fg={type:1,value:n-90+8},1}function dn(e,t,r){let n=t[r]??0;return e.currentAttr.bg={type:1,value:n-100+8},1}function gn(e){return e===0?sn:e>=1&&e<=9?an:e>=22&&e<=29?cn:e>=30&&e<=37?un:e===39?fn:e>=90&&e<=97?pn:e>=40&&e<=47?mn:e===49?bn:e>=100&&e<=107?dn:null}function yn(e,t,r){let n=t[r]??0;if(n===38){let l=$t(e,t,r,"fg");return l>0?l:1}if(n===48){let l=$t(e,t,r,"bg");return l>0?l:1}let o=gn(n);return o?o(e,t,r):1}function $t(e,t,r,n){if(r+1>=t.length)return 0;let o=t[r+1];if(o===5&&r+2<t.length){let l=t[r+2]??0;return e.currentAttr[n]={type:2,value:l},3}if(o===2&&r+4<t.length){let l=t[r+2]??0,s=t[r+3]??0,c=t[r+4]??0;return e.currentAttr[n]={type:3,value:l<<16|s<<8|c},5}return 0}function hn(e,t){let r=0;for(;r<t.length;){let n=yn(e,t,r);r+=n;}}function xn(e$2,t){let r=E.get(t);if(!r)return;let n=e();for(let o=0;o<r.buffer.cells.length;o++)r.buffer.cells[o]=f$4(n);i.cursorX[t]=0,i.cursorY[t]=0,r.currentAttr=e$1(),g$1(e$2,t);}function En(e,t){let r=E.get(t);r&&(xn(e,t),f$3(r.scrollback),r.escapeBuffer="",r.inEscape=false,r.savedCursorX=0,r.savedCursorY=0,r.savedAttr=e$1(),i.cursorVisible[t]=1,i.scrollOffset[t]=0,g$1(e,t));}function zl(e,t,r,n){let o=i.width[t]??0,l=i.height[t]??0;i.cursorX[t]=Math.min(Math.max(r,0),o-1),i.cursorY[t]=Math.min(Math.max(n,0),l-1),g$1(e,t);}function Ql(e,t,r){i.cursorVisible[t]=r?1:0,g$1(e,t);}function Kl(e,t,r){let n=E.get(t);if(!n)return;let o=i.scrollOffset[t]??0,l=n.scrollback.totalLines;i.scrollOffset[t]=Math.min(o+r,l),g$1(e,t);}function jl(e,t,r){let n=i.scrollOffset[t]??0;i.scrollOffset[t]=Math.max(0,n-r),g$1(e,t);}function $l(e,t){let r=E.get(t);r&&(i.scrollOffset[t]=r.scrollback.totalLines,g$1(e,t));}function Zl(e,t){i.scrollOffset[t]=0,g$1(e,t);}function Jl(e,t,r,n){let o=E.get(t);if(!o)return;let l=i.width[t]??0,s=i.height[t]??0,c=k$2(r,n),m=Math.min(l,r),b=Math.min(s,n);for(let L=0;L<b;L++)for(let J=0;J<m;J++){let re=L*l+J,ne=L*r+J,At=o.buffer.cells[re];At&&(c.cells[ne]=f$4(At));}o.buffer=c,i.width[t]=r,i.height[t]=n;let y=i.cursorX[t]??0,C=i.cursorY[t]??0;i.cursorX[t]=Math.min(y,r-1),i.cursorY[t]=Math.min(C,n-1),g$1(e,t);}function ql(e){i.isTerminal[e]=0,i.width[e]=0,i.height[e]=0,i.cursorX[e]=0,i.cursorY[e]=0,i.cursorVisible[e]=0,i.scrollOffset[e]=0,i.altScreenActive[e]=0,E.delete(e);}function Cn(e,t,r){let n=j$1(e.scrollback,e.scrollback.totalLines-r,e.scrollback.totalLines-r+t),o="";for(let l of n.lines)o+=l.ansi??l.text,o+=`
3
+ `;return o}function Ln(e,t){let r="";return (e.fg!==t.fg||e.bg!==t.bg)&&(r+="\x1B[0m",t.fg=e.fg,t.bg=e.bg),r+=e.char,{output:r,fg:t.fg,bg:t.bg}}function ts(e){let t=E.get(e);if(!t)return "";let r=i.width[e]??0,n=i.height[e]??0,o=i.scrollOffset[e]??0;if(o>0)return Cn(t,n,o);let l="",s={fg:-1,bg:-1};for(let c=0;c<n;c++){for(let m=0;m<r;m++){let b=c*r+m,y=t.buffer.cells[b];if(!y)continue;let C=Ln(y,s);l+=C.output,s.fg=C.fg,s.bg=C.bg;}c<n-1&&(l+=`
4
+ `);}return l}function es(e){return E.get(e)?.buffer.cells}function rs(){i.isTerminal.fill(0),i.width.fill(0),i.height.fill(0),i.cursorX.fill(0),i.cursorY.fill(0),i.cursorVisible.fill(0),i.scrollOffset.fill(0),i.altScreenActive.fill(0),E.clear();}export{Ge as $,jo as $a,Xr as $b,ye as A,ur as Aa,pl as Ab,he as B,St as Ba,dl as Bb,xe as C,fr as Ca,gl as Cb,gt as D,Yt as Da,yl as Db,Ee as E,mr as Ea,hl as Eb,Ce as F,vt as Fa,xl as Fb,Le as G,br as Ga,El as Gb,Se as H,pr as Ha,Cl as Hb,ve as I,dr as Ia,Ll as Ib,Te as J,rt as Ja,Sl as Jb,Ie as K,gr as Ka,vl as Kb,Ae as L,yr as La,Tl as Lb,we as M,hr as Ma,Il as Mb,x as N,Nt as Na,Al as Nb,Be as O,xr as Oa,wl as Ob,Fe as P,Er as Pa,Wl as Pb,_e as Q,Cr as Qa,Dl as Qb,ke as R,Sr as Ra,Bl as Rb,Me as S,vr as Sa,Fl as Sb,Re as T,Tr as Ta,_l as Tb,Ue as U,Oo as Ua,Br as Ub,Xe as V,Go as Va,kl as Vb,Ve as W,Ho as Wa,Ml as Wb,Pe as X,zo as Xa,Mr as Xb,Ye as Y,p as Ya,Rr as Yb,Ne as Z,Qo as Za,Ur as Zb,xt as _,Ko as _a,i as _b,at as a,Y as aa,$o as ab,Nl as ac,ct as b,Et as ba,Zo as bb,Or as bc,ut as c,et as ca,Jo as cb,Ol as cc,ft as d,He as da,qo as db,Gl as dc,mt as e,Ct as ea,Ir as eb,Qr as ec,bt as f,k as fa,tl as fb,Hl as fc,pt as g,ze as ga,el as gb,xn as gc,a as h,Qe as ha,rl as hb,En as hc,_ as i,Ke as ia,Ot as ib,zl as ic,oe as j,je as ja,Gt as jb,Ql as jc,le as k,$e as ka,Ht as kb,Kl as kc,se as l,Lt as la,zt as lb,jl as lc,A as m,Ze as ma,Qt as mb,$l as mc,ie as n,Je as na,Kt as nb,Zl as nc,ae as o,qe as oa,w as ob,Jl as oc,ce as p,tr as pa,f as pb,ql as pc,ue as q,er as qa,ll as qb,ts as qc,tt as r,M as ra,sl as rb,es as rc,me as s,rr as sa,il as sb,rs as sc,be as t,nr as ta,al as tb,yt as u,or as ua,cl as ub,pe as v,lr as va,ul as vb,ht as w,sr as wa,fl as wb,de as x,ir as xa,Ar as xb,Pt as y,ar as ya,ml as yb,ge as z,cr as za,bl as zb};