blecsd 0.1.1 → 0.2.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.
- package/README.md +41 -1
- package/dist/chunk-3APDF6RW.js +1 -0
- package/dist/{chunk-OUXUPF3V.js → chunk-4GISPPOH.js} +27 -27
- package/dist/chunk-6N6BRCEM.js +4 -0
- package/dist/chunk-EAY7B5GL.js +1 -0
- package/dist/{chunk-FT7BMYSN.js → chunk-FMFEOAML.js} +1 -1
- package/dist/chunk-JUWDTH25.js +1 -0
- package/dist/chunk-K3SX2LY5.js +1 -0
- package/dist/chunk-LB3JA744.js +19 -0
- package/dist/chunk-OB66FB4F.js +1 -0
- package/dist/{chunk-TRK4422V.js → chunk-VCW7EOZ4.js} +1 -1
- package/dist/chunk-WHF27JF3.js +4 -0
- package/dist/chunk-WY3KY2TR.js +1 -0
- package/dist/componentStorage-DTkj1Qyj.d.ts +246 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.js +1 -1
- package/dist/core/index.d.ts +226 -193
- package/dist/core/index.js +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.js +1 -1
- package/dist/packedStore-480t2X74.d.ts +191 -0
- package/dist/systems/index.d.ts +235 -23
- package/dist/systems/index.js +1 -1
- package/dist/terminal/index.js +1 -1
- package/dist/{tilemap-D1HJvKy3.d.ts → tilemap-j0twN9-y.d.ts} +91 -2
- package/dist/utils/index.d.ts +3 -157
- package/dist/utils/index.js +1 -1
- package/dist/widgets/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-AQ7LW75B.js +0 -1
- package/dist/chunk-K37L3G4Z.js +0 -4
- package/dist/chunk-PI5UOHOH.js +0 -1
- package/dist/chunk-XRJNAHNG.js +0 -19
- package/dist/chunk-YAMOSPWB.js +0 -4
- package/dist/chunk-YD6ULIUR.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {c as c$1,d,z as z$2,y,Z}from'./chunk-
|
|
1
|
+
import {c as c$1,d,z as z$2,y,Z}from'./chunk-FMFEOAML.js';import {g}from'./chunk-4LWWONFK.js';import {e,c,b as b$1,a}from'./chunk-C5PCEQ6G.js';import {t}from'./chunk-XQIGERNI.js';import {a as a$2}from'./chunk-WY3KY2TR.js';import {g as g$1}from'./chunk-XZA63ZPO.js';import {f,r,s}from'./chunk-BCADUCOZ.js';import {a as a$1}from'./chunk-5PELJRUQ.js';import {z as z$1}from'zod';import {writeFileSync,appendFileSync,existsSync,mkdirSync,unlinkSync,readFileSync,statSync,renameSync}from'fs';import {dirname,join}from'path';import {inspect}from'util';import {spawn,spawnSync}from'child_process';import {tmpdir}from'os';import {EventEmitter}from'events';var Jn="\x1B[",Qn="\x1B]",eo="\x1BP",to="\x1B\\",ro="\x07",no="\x1B",b={RESET:0,BOLD:1,DIM:2,ITALIC:3,UNDERLINE:4,BLINK:5,RAPID_BLINK:6,INVERSE:7,HIDDEN:8,STRIKETHROUGH:9,RESET_BOLD:22,RESET_DIM:22,RESET_ITALIC:23,RESET_UNDERLINE:24,RESET_BLINK:25,RESET_INVERSE:27,RESET_HIDDEN:28,RESET_STRIKETHROUGH:29,FG_BLACK:30,FG_RED:31,FG_GREEN:32,FG_YELLOW:33,FG_BLUE:34,FG_MAGENTA:35,FG_CYAN:36,FG_WHITE:37,FG_DEFAULT:39,FG_BRIGHT_BLACK:90,FG_BRIGHT_RED:91,FG_BRIGHT_GREEN:92,FG_BRIGHT_YELLOW:93,FG_BRIGHT_BLUE:94,FG_BRIGHT_MAGENTA:95,FG_BRIGHT_CYAN:96,FG_BRIGHT_WHITE:97,BG_BLACK:40,BG_RED:41,BG_GREEN:42,BG_YELLOW:43,BG_BLUE:44,BG_MAGENTA:45,BG_CYAN:46,BG_WHITE:47,BG_DEFAULT:49,BG_BRIGHT_BLACK:100,BG_BRIGHT_RED:101,BG_BRIGHT_GREEN:102,BG_BRIGHT_YELLOW:103,BG_BRIGHT_BLUE:104,BG_BRIGHT_MAGENTA:105,BG_BRIGHT_CYAN:106,BG_BRIGHT_WHITE:107,FG_256:38,BG_256:48},oo={black:b.FG_BLACK,red:b.FG_RED,green:b.FG_GREEN,yellow:b.FG_YELLOW,blue:b.FG_BLUE,magenta:b.FG_MAGENTA,cyan:b.FG_CYAN,white:b.FG_WHITE,brightBlack:b.FG_BRIGHT_BLACK,brightRed:b.FG_BRIGHT_RED,brightGreen:b.FG_BRIGHT_GREEN,brightYellow:b.FG_BRIGHT_YELLOW,brightBlue:b.FG_BRIGHT_BLUE,brightMagenta:b.FG_BRIGHT_MAGENTA,brightCyan:b.FG_BRIGHT_CYAN,brightWhite:b.FG_BRIGHT_WHITE,default:b.FG_DEFAULT},so={black:b.BG_BLACK,red:b.BG_RED,green:b.BG_GREEN,yellow:b.BG_YELLOW,blue:b.BG_BLUE,magenta:b.BG_MAGENTA,cyan:b.BG_CYAN,white:b.BG_WHITE,brightBlack:b.BG_BRIGHT_BLACK,brightRed:b.BG_BRIGHT_RED,brightGreen:b.BG_BRIGHT_GREEN,brightYellow:b.BG_BRIGHT_YELLOW,brightBlue:b.BG_BRIGHT_BLUE,brightMagenta:b.BG_BRIGHT_MAGENTA,brightCyan:b.BG_BRIGHT_CYAN,brightWhite:b.BG_BRIGHT_WHITE,default:b.BG_DEFAULT};function tr(e){return typeof e=="object"&&"r"in e&&"g"in e&&"b"in e}function rr(e){return typeof e=="string"}function M(...e){return `\x1B[${e.join(";")}m`}var E={move(e,t){return `\x1B[${t};${e}H`},column(e){return `\x1B[${e}G`},up(e=1){return `\x1B[${e}A`},down(e=1){return `\x1B[${e}B`},forward(e=1){return `\x1B[${e}C`},back(e=1){return `\x1B[${e}D`},nextLine(e=1){return `\x1B[${e}E`},prevLine(e=1){return `\x1B[${e}F`},save(){return "\x1B[s"},restore(){return "\x1B[u"},show(){return "\x1B[?25h"},hide(){return "\x1B[?25l"},requestPosition(){return "\x1B[6n"},home(){return "\x1B[H"},setShape(e){return `\x1B[${e} q`},blinkingBlock(){return "\x1B[1 q"},steadyBlock(){return "\x1B[2 q"},blinkingUnderline(){return "\x1B[3 q"},steadyUnderline(){return "\x1B[4 q"},blinkingBar(){return "\x1B[5 q"},steadyBar(){return "\x1B[6 q"},resetShape(){return "\x1B[0 q"},setColor(e){return `\x1B]12;${e}\x07`},resetColor(){return "\x1B]112\x07"},saveStyle(){return "\x1B[s"},restoreStyle(){return "\x1B[u"}},io={DEFAULT:0,BLINKING_BLOCK:1,STEADY_BLOCK:2,BLINKING_UNDERLINE:3,STEADY_UNDERLINE:4,BLINKING_BAR:5,STEADY_BAR:6},G={reset(){return M(b.RESET)},bold(){return M(b.BOLD)},dim(){return M(b.DIM)},italic(){return M(b.ITALIC)},underline(){return M(b.UNDERLINE)},blink(){return M(b.BLINK)},inverse(){return M(b.INVERSE)},hidden(){return M(b.HIDDEN)},strikethrough(){return M(b.STRIKETHROUGH)},fg(e){return rr(e)?M(oo[e]):tr(e)?M(b.FG_256,2,e.r,e.g,e.b):M(b.FG_256,5,e)},bg(e){return rr(e)?M(so[e]):tr(e)?M(b.BG_256,2,e.r,e.g,e.b):M(b.BG_256,5,e)},combine(...e){return M(...e)}},A={clear(){return "\x1B[2J"},clearDown(){return "\x1B[J"},clearUp(){return "\x1B[1J"},clearLine(){return "\x1B[2K"},clearLineRight(){return "\x1B[K"},clearLineLeft(){return "\x1B[1K"},eraseChars(e=1){return `\x1B[${e}X`},alternateOn(){return "\x1B[?1049h"},enterAlt(){return "\x1B[?1049h"},alternateOff(){return "\x1B[?1049l"},exitAlt(){return "\x1B[?1049l"},scrollUp(e=1){return `\x1B[${e}S`},scrollDown(e=1){return `\x1B[${e}T`},setScrollRegion(e,t){return `\x1B[${e};${t}r`},resetScrollRegion(){return "\x1B[r"}},ao={set(e){return `\x1B]2;${e}\x07`},setIcon(e){return `\x1B]1;${e}\x07`},setBoth(e){return `\x1B]0;${e}\x07`}},R={X10:9,NORMAL:1e3,HIGHLIGHT:1001,BUTTON_EVENT:1002,ANY_EVENT:1003,FOCUS:1004,UTF8:1005,SGR:1006,URXVT:1015,SGR_PIXELS:1016},P={enableX10(){return `\x1B[?${R.X10}h`},disableX10(){return `\x1B[?${R.X10}l`},enableNormal(){return `\x1B[?${R.NORMAL}h`},disableNormal(){return `\x1B[?${R.NORMAL}l`},enableButtonEvent(){return `\x1B[?${R.BUTTON_EVENT}h`},disableButtonEvent(){return `\x1B[?${R.BUTTON_EVENT}l`},enableAnyEvent(){return `\x1B[?${R.ANY_EVENT}h`},disableAnyEvent(){return `\x1B[?${R.ANY_EVENT}l`},enableFocus(){return `\x1B[?${R.FOCUS}h`},disableFocus(){return `\x1B[?${R.FOCUS}l`},enableSGR(){return `\x1B[?${R.SGR}h`},disableSGR(){return `\x1B[?${R.SGR}l`},enableURXVT(){return `\x1B[?${R.URXVT}h`},disableURXVT(){return `\x1B[?${R.URXVT}l`},enableUTF8(){return `\x1B[?${R.UTF8}h`},disableUTF8(){return `\x1B[?${R.UTF8}l`},disableAll(){return [`\x1B[?${R.X10}l`,`\x1B[?${R.NORMAL}l`,`\x1B[?${R.BUTTON_EVENT}l`,`\x1B[?${R.ANY_EVENT}l`,`\x1B[?${R.FOCUS}l`,`\x1B[?${R.UTF8}l`,`\x1B[?${R.SGR}l`,`\x1B[?${R.URXVT}l`].join("")},enableRecommended(){return `\x1B[?${R.SGR}h\x1B[?${R.ANY_EVENT}h`}},K={begin(){return "\x1B[?2026h"},end(){return "\x1B[?2026l"},wrap(e){return `\x1B[?2026h${e}\x1B[?2026l`}},ke={enable(){return "\x1B[?2004h"},disable(){return "\x1B[?2004l"},START_MARKER:"\x1B[200~",END_MARKER:"\x1B[201~"},Q={CLIPBOARD:"c",PRIMARY:"p",SECONDARY:"s",SELECT:"s",CUT0:"0",CUT1:"1",CUT2:"2",CUT3:"3",CUT4:"4",CUT5:"5",CUT6:"6",CUT7:"7"},nr=1024*1024,ie={write(e,t=Q.CLIPBOARD,r=nr){if(Buffer.byteLength(e,"utf8")>r)return "";let o=Buffer.from(e,"utf8").toString("base64");return `\x1B]52;${t};${o}\x1B\\`},requestRead(e=Q.CLIPBOARD){return `\x1B]52;${e};?\x1B\\`},clear(e=Q.CLIPBOARD){return `\x1B]52;${e};\x1B\\`},decodeResponse(e){let t=e.match(/\x1b\]52;([^;]+);([A-Za-z0-9+/=]*)\x1b\\/);if(!t)return null;let r=t[2];if(!r)return "";try{return Buffer.from(r,"base64").toString("utf8")}catch{return null}},isClipboardResponse(e){return e.startsWith("\x1B]52;")}},uo={PT_START:"\x1BPtmux;",wrap(e){return `\x1BPtmux;${e.replace(/\x1b/g,"\x1B\x1B")}\x1B\\`},unwrap(e){let t=e.match(/^\x1bPtmux;([\s\S]*)\x1b\\$/);return t?(t[1]??"").replace(/\x1b\x1b/g,"\x1B"):null},isWrapped(e){return e.startsWith("\x1BPtmux;")&&e.endsWith("\x1B\\")},wrapIf(e,t){return !t||this.isWrapped(e)?e:this.wrap(e)},begin(){return "\x1BPtmux;"},end(){return "\x1B\\"}},lo={"dec-graphics":"0","us-ascii":"B",uk:"A",dutch:"4",finnish:"C",french:"R","french-canadian":"Q",german:"K",italian:"Y","norwegian-danish":"E",spanish:"Z",swedish:"H",swiss:"=","iso-latin":"/A"},co={0:"(",1:")",2:"*",3:"+"},po={j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",q:"\u2500",x:"\u2502",n:"\u253C",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",o:"\u23BA",p:"\u23BB",r:"\u23BC",s:"\u23BD","`":"\u25C6",a:"\u2592",f:"\xB0",g:"\xB1",h:"\u2424",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7",b:" ",c:"\f",d:"\r",e:`
|
|
2
2
|
`,i:"\v"},fo={"\u25C6":"*","\u2592":" ","\xB0":"*","\xB1":"+","\u2424":`
|
|
3
3
|
`,"\u2518":"+","\u2510":"+","\u250C":"+","\u2514":"+","\u253C":"+","\u23BA":"-","\u23BB":"-","\u2500":"-","\u23BC":"-","\u23BD":"_","\u251C":"+","\u2524":"+","\u2534":"+","\u252C":"+","\u2502":"|","\u2264":"<","\u2265":">",\u03C0:"*","\u2260":"!","\xA3":"#","\xB7":"."},mo={designate(e,t=0){let r=lo[e];return `\x1B${co[t]}${r}`},invokeG0(){return ""},invokeG1(){return ""},invokeG2(){return "\x1Bn"},invokeG3(){return "\x1Bo"},invokeG1R(){return "\x1B~"},invokeG2R(){return "\x1B}"},invokeG3R(){return "\x1B|"},singleShiftG2(){return "\x1BN"},singleShiftG3(){return "\x1BO"},enterAcs(){return "\x1B(0"},exitAcs(){return "\x1B(B"},smacs(){return this.enterAcs()},rmacs(){return this.exitAcs()}},go={unicode:{topLeft:"\u250C",topRight:"\u2510",bottomLeft:"\u2514",bottomRight:"\u2518",horizontal:"\u2500",vertical:"\u2502",cross:"\u253C",teeRight:"\u251C",teeLeft:"\u2524",teeUp:"\u2534",teeDown:"\u252C"},unicodeDouble:{topLeft:"\u2554",topRight:"\u2557",bottomLeft:"\u255A",bottomRight:"\u255D",horizontal:"\u2550",vertical:"\u2551",cross:"\u256C",teeRight:"\u2560",teeLeft:"\u2563",teeUp:"\u2569",teeDown:"\u2566"},unicodeRounded:{topLeft:"\u256D",topRight:"\u256E",bottomLeft:"\u2570",bottomRight:"\u256F",horizontal:"\u2500",vertical:"\u2502",cross:"\u253C",teeRight:"\u251C",teeLeft:"\u2524",teeUp:"\u2534",teeDown:"\u252C"},ascii:{topLeft:"+",topRight:"+",bottomLeft:"+",bottomRight:"+",horizontal:"-",vertical:"|",cross:"+",teeRight:"+",teeLeft:"+",teeUp:"+",teeDown:"+"},decGraphics:{topLeft:"l",topRight:"k",bottomLeft:"m",bottomRight:"j",horizontal:"q",vertical:"x",cross:"n",teeRight:"t",teeLeft:"u",teeUp:"v",teeDown:"w"}},bo={deiconify(){return "\x1B[1t"},iconify(){return "\x1B[2t"},move(e,t){return `\x1B[3;${e};${t}t`},resizePixels(e,t){return `\x1B[4;${t};${e}t`},raise(){return "\x1B[5t"},lower(){return "\x1B[6t"},refresh(){return "\x1B[7t"},resizeChars(e,t){return `\x1B[8;${t};${e}t`},restoreMaximized(){return "\x1B[9;0t"},maximize(){return "\x1B[9;1t"},maximizeVertical(){return "\x1B[9;2t"},maximizeHorizontal(){return "\x1B[9;3t"},exitFullScreen(){return "\x1B[10;0t"},enterFullScreen(){return "\x1B[10;1t"},toggleFullScreen(){return "\x1B[10;2t"},pushTitle(e="both"){return `\x1B[22;${e==="both"?0:e==="icon"?1:2}t`},popTitle(e="both"){return `\x1B[23;${e==="both"?0:e==="icon"?1:2}t`},setLines(e){return `\x1B[${Math.max(24,Math.floor(e))}t`}},or=["http:","https:","mailto:","file:","tel:"];function sr(e){try{let t=new URL(e);return or.includes(t.protocol)}catch{return false}}var yo={link(e,t,r){return `${this.start(e,r)}${t}${this.end()}`},start(e,t){return `\x1B]8;${t?.id?`id=${t.id}`:""};${e}\x1B\\`},end(){return "\x1B]8;;\x1B\\"},safeLink(e,t,r){return sr(e)?this.link(e,t,r):t},mailto(e,t,r){return this.link(`mailto:${e}`,t??e,r)},file(e,t,r){return this.link(`file://${e}`,t??e,r)}},xo={PRINT_SCREEN:0,PRINTER_OFF:4,PRINTER_ON:5,PRINT_LINE:1,PRINT_DISPLAY:10,PRINT_ALL_PAGES:11},Co={mc(e){return `\x1B[${e}i`},printScreen(){return "\x1B[0i"},printLine(){return "\x1B[1i"},printerOn(){return "\x1B[5i"},printerOff(){return "\x1B[4i"},printerForBytes(e){return `\x1B[5;${e}i`},printDisplay(){return "\x1B[10i"},printAllPages(){return "\x1B[11i"},autoPrintOn(){return "\x1B[?5i"},autoPrintOff(){return "\x1B[?4i"},printCursorPosition(){return "\x1B[?1i"}},So={setAttrs(e,t,r,n,o){let s=o.length>0?`;${o.join(";")}`:"";return `\x1B[${e};${t};${r};${n}${s}$r`},reverseAttrs(e,t,r,n,o){let s=o.length>0?`;${o.join(";")}`:"";return `\x1B[${e};${t};${r};${n}${s}$t`},copy(e,t,r,n,o,s,i=1,u=1){return `\x1B[${e};${t};${r};${n};${i};${o};${s};${u}$v`},fill(e,t,r,n,o){return `\x1B[${typeof o=="string"?o.charCodeAt(0):o};${e};${t};${r};${n}$x`},erase(e,t,r,n){return `\x1B[${e};${t};${r};${n}$z`},selectiveErase(e,t,r,n){return `\x1B[${e};${t};${r};${n}\${`},setProtection(e){return `\x1B[${e?1:0}"q`},requestChecksum(e,t,r,n,o,s){return `\x1B[${e};${t};${r};${n};${o};${s}*y`}},ho={NONE:0,BUTTON_DOWN:1,BUTTON_UP:2,BUTTON_DOWN_UP:3},Ro={NONE:0,RIGHT:1,MIDDLE:2,LEFT:3,M4:4},Eo={enable(e=2,t=2){return `\x1B[${e};${t}'z`},disable(){return "\x1B[0'z"},setFilterRectangle(e,t,r,n){return `\x1B[${e};${t};${r};${n}'w`},clearFilterRectangle(){return "\x1B['w"},setEvents(e){return `\x1B[${e.join(";")}'{`},requestPosition(e){return e===void 0?"\x1B['|":`\x1B[${e}'|`},enableKeyMode(){return "\x1B[?99h"},disableKeyMode(){return "\x1B[?99l"},enableExtended(){return "\x1B[?1003h"},disableExtended(){return "\x1B[?1003l"},enableHighlight(){return "\x1B[?1001h"},disableHighlight(){return "\x1B[?1001l"}};var To=z$1.object({type:z$1.literal("paste"),text:z$1.string(),timestamp:z$1.number(),sanitized:z$1.boolean(),originalLength:z$1.number().int().nonnegative()}),vo=z$1.object({sanitize:z$1.boolean().default(true),maxLength:z$1.number().int().nonnegative().default(1024*1024),enabled:z$1.boolean().default(true)}),ir={sanitize:true,maxLength:1024*1024,enabled:true},z="\x1B[200~",ee="\x1B[201~";function Be(e){return e.replace(/\x1b(?:\[[0-9;?]*[a-zA-Z~]|\][^\x07\x1b]*(?:\x07|\x1b\\)?|[^[\]])/g,"")}function Ne(e,t){return t<=0||e.length<=t?e:e.slice(0,t)}function ar(e){return e.length<z.length?false:new TextDecoder().decode(e.subarray(0,z.length))===z}function _o(e){if(e.length===0)return false;if(e.length>=z.length)return ar(e);let t=new TextDecoder().decode(e);return z.startsWith(t)}function Io(e){return new TextDecoder().decode(e).indexOf(ee)}function Ao(e,t){let r={...ir,...t},n=new TextDecoder().decode(e);if(!n.startsWith(z))return {pasteStarted:false,pasteEnded:false,text:null,consumed:0};let o=n.indexOf(ee);if(o===-1)return {pasteStarted:true,pasteEnded:false,text:null,consumed:0};let s=z.length,i=n.slice(s,o);r.sanitize&&(i=Be(i)),i=Ne(i,r.maxLength);let u=o+ee.length;return {pasteStarted:true,pasteEnded:true,text:i,consumed:u}}function wo(e){return {isPasting:false,buffer:"",config:{...ir,...e}}}function Mo(e,t){let r=new TextDecoder().decode(t);if(!e.isPasting){if(!r.startsWith(z))return {state:e,event:null,consumed:0,remaining:t};let a=z.length,d=r.indexOf(ee,a);if(d===-1){let y=r.slice(a);return {state:{...e,isPasting:true,buffer:y},event:null,consumed:t.length,remaining:new Uint8Array(0)}}let c=r.slice(a,d),l=c.length;e.config.sanitize&&(c=Be(c)),c=Ne(c,e.config.maxLength);let f=d+ee.length,S=new TextEncoder().encode(r.slice(f));return {state:{...e,isPasting:false,buffer:""},event:{type:"paste",text:c,timestamp:Date.now(),sanitized:e.config.sanitize,originalLength:l},consumed:f,remaining:S}}let n=r.indexOf(ee);if(n===-1)return {state:{...e,buffer:e.buffer+r},event:null,consumed:t.length,remaining:new Uint8Array(0)};let o=e.buffer+r.slice(0,n),s=o.length;e.config.sanitize&&(o=Be(o)),o=Ne(o,e.config.maxLength);let i=n+ee.length,u=new TextEncoder().encode(r.slice(i));return {state:{...e,isPasting:false,buffer:""},event:{type:"paste",text:o,timestamp:Date.now(),sanitized:e.config.sanitize,originalLength:s},consumed:i,remaining:u}}function Oo(){return ke.enable()}function Po(){return ke.disable()}var h={PRIMARY_DA:"primary_da",SECONDARY_DA:"secondary_da",TERTIARY_DA:"tertiary_da",CURSOR_POSITION:"cursor_position",DEVICE_STATUS:"device_status",OPERATING_STATUS:"operating_status",WINDOW_TITLE:"window_title",ICON_LABEL:"icon_label",WINDOW_STATE:"window_state",WINDOW_POSITION:"window_position",WINDOW_SIZE_PIXELS:"window_size_pixels",TEXT_AREA_SIZE:"text_area_size",SCREEN_SIZE:"screen_size",CHAR_CELL_SIZE:"char_cell_size",LOCATOR_POSITION:"locator_position",UNKNOWN:"unknown"},ko=z$1.object({type:z$1.literal(h.CURSOR_POSITION),raw:z$1.string(),row:z$1.number().int().positive(),column:z$1.number().int().positive()}),k="\x1B[",Bo=/^\x1b\[\?([0-9;]+)c$/,No=/^\x1b\[>([0-9;]+)c$/,Lo=/^\x1b\[(\d+);(\d+)R$/,Do=/^\x1b\[(\d+)n$/,$o=/^\x1b\[(\d+)(?:;(\d+))?(?:;(\d+))?t$/,Uo=/^\x1b\](\d+);([^\x07\x1b]*)(?:\x07|\x1b\\)$/,Go=/^\x1b\[(\d+);(\d+);(\d+);(\d+);(\d+)&w$/;function ut(e){let t=[Ko,Fo,zo,Wo,Ho,Vo,Yo];for(let r of t){let n=r(e);if(n)return n}return {type:h.UNKNOWN,raw:e}}function Ko(e){let t=e.match(Bo);if(!t?.[1])return null;let r=t[1].split(";").map(Number),n=r[0]??0,o=r.slice(1);return {type:h.PRIMARY_DA,raw:e,deviceClass:n,attributes:o}}function Fo(e){let t=e.match(No);if(!t?.[1])return null;let r=t[1].split(";").map(Number);return {type:h.SECONDARY_DA,raw:e,terminalType:r[0]??0,firmwareVersion:r[1]??0,romCartridge:r[2]??0}}function zo(e){let t=e.match(Lo);return !t?.[1]||!t[2]?null:{type:h.CURSOR_POSITION,raw:e,row:Number.parseInt(t[1],10),column:Number.parseInt(t[2],10)}}function Wo(e){let t=e.match(Do);if(!t?.[1])return null;let r=Number.parseInt(t[1],10);return {type:h.DEVICE_STATUS,raw:e,status:r,ok:r===0}}function Ho(e){let t=e.match($o);if(!t?.[1])return null;let r=Number.parseInt(t[1],10),n=t[2]?Number.parseInt(t[2],10):0,o=t[3]?Number.parseInt(t[3],10):0;switch(r){case 1:case 2:return {type:h.WINDOW_STATE,raw:e,state:r,iconified:r===2};case 3:return {type:h.WINDOW_POSITION,raw:e,x:n,y:o};case 4:return {type:h.WINDOW_SIZE_PIXELS,raw:e,height:n,width:o};case 8:return {type:h.TEXT_AREA_SIZE,raw:e,rows:n,columns:o};case 9:return {type:h.SCREEN_SIZE,raw:e,rows:n,columns:o};case 6:return {type:h.CHAR_CELL_SIZE,raw:e,height:n,width:o};default:return null}}function Vo(e){let t=e.match(Uo);if(!t?.[1])return null;let r=Number.parseInt(t[1],10),n=t[2]??"";return r===76||e.startsWith("\x1B]L;")?{type:h.WINDOW_TITLE,raw:e,title:n}:r===108||e.startsWith("\x1B]l;")?{type:h.ICON_LABEL,raw:e,label:n}:null}function Yo(e){let t=e.match(Go);return !t?.[1]||!t[2]||!t[3]||!t[4]||!t[5]?null:{type:h.LOCATOR_POSITION,raw:e,status:Number.parseInt(t[1],10),button:Number.parseInt(t[2],10),row:Number.parseInt(t[3],10),column:Number.parseInt(t[4],10),page:Number.parseInt(t[5],10)}}function lt(e){return e.type===h.PRIMARY_DA}function ct(e){return e.type===h.SECONDARY_DA}function qo(e){return e.type===h.CURSOR_POSITION}function Xo(e){return e.type===h.DEVICE_STATUS}function jo(e){return e.type===h.WINDOW_TITLE}function Zo(e){return e.type===h.ICON_LABEL}function Jo(e){return e.type===h.WINDOW_STATE}function Qo(e){return e.type===h.WINDOW_POSITION}function es(e){return e.type===h.WINDOW_SIZE_PIXELS}function ts(e){return e.type===h.TEXT_AREA_SIZE}function rs(e){return e.type===h.SCREEN_SIZE}function ns(e){return e.type===h.CHAR_CELL_SIZE}function os(e){return e.type===h.LOCATOR_POSITION}function ss(e){return e.type===h.UNKNOWN}var ae={primaryDA(){return `${k}c`},secondaryDA(){return `${k}>c`},tertiaryDA(){return `${k}=c`},cursorPosition(){return `${k}6n`},deviceStatus(){return `${k}5n`},windowState(){return `${k}11t`},windowPosition(){return `${k}13t`},windowSizePixels(){return `${k}14t`},textAreaSize(){return `${k}18t`},screenSize(){return `${k}19t`},charCellSize(){return `${k}16t`},windowTitle(){return `${k}21t`},iconLabel(){return `${k}20t`},enableLocator(e=1){return `${k}${e}'z`},locatorPosition(){return `${k}'|`}};var pt=100,Ee=10,Te=5e3,lr="\x1B[",he={DISABLED:0,DISAMBIGUATE:1,REPORT_EVENTS:2,REPORT_ALTERNATES:4,REPORT_ALL:8,REPORT_TEXT:16},le={NONE:"none",KITTY:"kitty",ITERM2:"iterm2",SIXEL:"sixel"},Re={EAGER:"eager",LAZY:"lazy",SKIP:"skip"},cr=z$1.object({timeout:z$1.number().int().min(Ee).max(Te).optional(),timing:z$1.enum(["eager","lazy","skip"]).optional(),forceCapabilities:z$1.record(z$1.string(),z$1.unknown()).optional()});function ur(){let e=process.env.COLORTERM;if(e==="truecolor"||e==="24bit")return true;let t=process.env.TERM??"";if(t.includes("truecolor")||t.includes("24bit")||t.includes("direct"))return true;let r=process.env.TERM_PROGRAM??"";if(["iTerm.app","Apple_Terminal","Hyper","vscode"].includes(r)||process.env.KITTY_WINDOW_ID!==void 0||t==="alacritty"||process.env.WT_SESSION!==void 0)return true;let o=process.env.VTE_VERSION;if(o!==void 0){let s=Number.parseInt(o,10);if(!Number.isNaN(s)&&s>=3600)return true}return false}function is(){return process.env.KITTY_WINDOW_ID!==void 0||process.env.TERM_PROGRAM==="WezTerm"||process.env.TERM==="foot"||process.env.TERM==="foot-extra"?he.REPORT_ALL:false}function as(){return process.env.KITTY_WINDOW_ID!==void 0?le.KITTY:process.env.TERM_PROGRAM==="iTerm.app"?le.ITERM2:(process.env.TERM??"").includes("sixel")?le.SIXEL:false}function us(){let e=process.env.TERM_PROGRAM??"";return !!(["iTerm.app","WezTerm","vscode","Hyper"].includes(e)||process.env.KITTY_WINDOW_ID!==void 0||process.env.WT_SESSION!==void 0)}function ls(){let e=process.env.TERM_PROGRAM??"";if(["iTerm.app","WezTerm","vscode","Hyper"].includes(e)||process.env.KITTY_WINDOW_ID!==void 0||process.env.WT_SESSION!==void 0)return true;let r=process.env.VTE_VERSION;if(r!==void 0){let n=Number.parseInt(r,10);if(!Number.isNaN(n)&&n>=5e3)return true}return false}function cs(){return {truecolor:ur(),kittyKeyboard:is(),graphics:as(),focusEvents:true,bracketedPaste:true,synchronizedOutput:us(),hyperlinks:ls(),styledUnderlines:ur(),primaryDA:null,secondaryDA:null,terminalType:null,firmwareVersion:null}}function ps(){return `${lr}>q`}function ds(){return `${lr}?u`}function fs(e){return e.attributes.includes(4)}function ms(e){return {terminalType:e.terminalType,firmwareVersion:e.firmwareVersion}}async function gs(e,t,r,n){return new Promise(o=>{let s={buffer:"",timeout:setTimeout(()=>{u(),o(s.responses);},t),responses:[]},i=a=>{s.buffer+=a.toString(),bs(s);},u=()=>{clearTimeout(s.timeout),r.removeListener("data",i);};r.on("data",i);for(let a of e)n.write(a);})}function bs(e){let t=e.buffer,r=/\x1b\[[^a-zA-Z]*[a-zA-Z]/g,n;for(n=r.exec(t);n!==null;)e.responses.push(n[0]),n=r.exec(t);let o=/\x1bP[^\x1b]*\x1b\\/g;for(n=o.exec(t);n!==null;)e.responses.push(n[0]),n=o.exec(t);let s=/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g;for(n=s.exec(t);n!==null;)e.responses.push(n[0]),n=s.exec(t);}function dt(e={}){let t=Math.max(Ee,Math.min(Te,e.timeout??pt)),r=e.timing??Re.EAGER,n=e.input??process.stdin,o=e.output??process.stdout,s=e.forceCapabilities,i=null,u=null,a=false;async function d(){let x=cs();if(s)return {...x,...s};if(r===Re.SKIP||!c())return x;let C=[ae.primaryDA(),ae.secondaryDA()],g=await l(C,t,n,o);return g?f(x,g):x}function c(){return !!(process.stdin.isTTY&&process.stdout.isTTY)}async function l(x,C,g,p){let m=g.isRaw;try{return !m&&g.setRawMode&&g.setRawMode(!0),await gs(x,C,g,p)}catch{return null}finally{!m&&g.setRawMode&&g.setRawMode(false);}}function f(x,C){let{primaryDA:g,secondaryDA:p}=S(C),{terminalType:m,firmwareVersion:I}=p?ms(p):{terminalType:null,firmwareVersion:null},$=g&&fs(g)&&!x.graphics?le.SIXEL:x.graphics;return {...x,primaryDA:g,secondaryDA:p,terminalType:m,firmwareVersion:I,graphics:$}}function S(x){let C=null,g=null;for(let p of x){let m=ut(p);lt(m)?C=m:ct(m)&&(g=m);}return {primaryDA:C,secondaryDA:g}}let y={async getCapabilities(){if(a)throw new Error("Negotiator has been destroyed");return i||(u||(u=d().then(x=>(i=x,x))),u)},getCachedCapabilities(){return i},async renegotiate(){if(a)throw new Error("Negotiator has been destroyed");return i=null,u=null,y.getCapabilities()},isNegotiated(){return i!==null},getTimeout(){return t},setTimeout(x){t=Math.max(Ee,Math.min(Te,x));},destroy(){a=true,i=null,u=null;}};return r===Re.EAGER&&(u=d().then(x=>(i=x,x))),y}var ce=null;function ft(){return ce||(ce=dt()),ce}function pr(){ce&&(ce.destroy(),ce=null);}async function mt(){return ft().getCapabilities()}async function dr(e){let r=(await mt())[e];return typeof r=="boolean"?r:r!=null}var fr={primaryDA:ae.primaryDA,secondaryDA:ae.secondaryDA,xtversion:ps,kittyKeyboard:ds};var Le=null;function mr(e){try{e.write(A.alternateOff()),e.write(E.show()),e.write(G.reset()),e.write(`
|
|
4
4
|
`);}catch{}}function ys(){let e=new Map,t=new Set,r=false,n=false;function o(y,x){if(n)return;n=true;let C=x!==void 0?{reason:y,error:x}:{reason:y};for(let g of t)try{g(C);}catch{}for(let g of e.values())try{mr(g.output),g.cleanup();}catch{}}let s=()=>{o("SIGINT"),process.exit(130);},i=()=>{o("SIGTERM"),process.exit(143);},u=()=>{o("SIGQUIT"),process.exit(131);},a=()=>{o("SIGHUP"),process.exit(129);},d=()=>{o("exit");},c=y=>{throw o("uncaughtException",y),y},l=y=>{let x=y instanceof Error?y:new Error(String(y));o("unhandledRejection",x);};function f(){r||(process.on("SIGINT",s),process.on("SIGTERM",i),process.on("SIGQUIT",u),process.on("SIGHUP",a),process.on("exit",d),process.on("uncaughtException",c),process.on("unhandledRejection",l),r=true);}function S(){r&&(process.off("SIGINT",s),process.off("SIGTERM",i),process.off("SIGQUIT",u),process.off("SIGHUP",a),process.off("exit",d),process.off("uncaughtException",c),process.off("unhandledRejection",l),r=false);}return {get instanceCount(){return e.size},get hasCleanedUp(){return n},register(y,x,C){e.set(y,{id:y,output:x,cleanup:C}),r||f();},unregister(y){e.delete(y),e.size===0&&S();},onExit(y){return t.add(y),()=>{t.delete(y);}},async runCleanup(y,x){if(n)return;n=true;let C=x!==void 0?{reason:y,error:x}:{reason:y};for(let g of t)try{await g(C);}catch{}for(let g of e.values())try{mr(g.output),await g.cleanup();}catch{}},runCleanupSync:o}}var De={get instance(){return Le||(Le=ys()),Le},reset(){Le=null;}};function xs(e,t,r){De.instance.register(e,t,r);}function Cs(e){De.instance.unregister(e);}function Ss(e){return De.instance.onExit(e)}var hs={chunkSize:64*1024,maxSize:10*1024*1024,useOSC52:true};function Rs(e){let t={...hs,...e},r="",n=false;function o(a,d){return a.length<=t.maxSize?null:{success:false,error:`Content too large (${a.length} bytes, max ${t.maxSize})`,bytesProcessed:0,elapsedMs:performance.now()-d}}function s(a){if(!t.useOSC52)return;let d=ie.write(a,Q.CLIPBOARD,t.maxSize);d&&process.stdout.write(d);}function i(a,d,c){return s(a),c?.({processed:a.length,total:a.length,percentage:100,complete:true}),{success:true,bytesProcessed:a.length,elapsedMs:performance.now()-d}}async function u(a,d,c){let l=0,f=a.length;for(;l<f&&!n;)l=Math.min(l+t.chunkSize,f),c?.({processed:l,total:f,percentage:Math.round(l/f*100),complete:l>=f}),await new Promise(y=>setTimeout(y,0));return n?{success:false,error:"Operation cancelled",bytesProcessed:l,elapsedMs:performance.now()-d}:(s(a),{success:true,bytesProcessed:f,elapsedMs:performance.now()-d})}return {async copy(a,d){let c=performance.now();n=false;let l=o(a,c);return l||(r=a,a.length<=t.chunkSize?i(a,c,d):u(a,c,d))},writeToTerminal(a){let d=performance.now();if(a.length>t.maxSize)return {success:false,error:`Content too large (${a.length} bytes, max ${t.maxSize})`,bytesProcessed:0,elapsedMs:performance.now()-d};r=a;let c=ie.write(a,Q.CLIPBOARD,t.maxSize);return c&&process.stdout.write(c),{success:true,bytesProcessed:a.length,elapsedMs:performance.now()-d}},requestRead(){let a=ie.requestRead();process.stdout.write(a);},clear(){r="";let a=ie.clear();process.stdout.write(a);},getBuffer(){return r},cancel(){n=true;}}}function gr(e,t){if(e.length<=t)return [e];let r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}async function Es(e,t,r=64*1024){let n=e.length,o=0,s=gr(e,r);for(let i of s)o+=i.length,t(i,{processed:o,total:n,percentage:Math.round(o/n*100),complete:o>=n}),o<n&&await new Promise(u=>setTimeout(u,0));}var Ts=0;function vs(){return `cursor_${++Ts}`}function gt(e={}){return {x:e.x??0,y:e.y??0,visible:e.visible??true,shape:e.shape??"block",blink:e.blink??true,blinkRate:e.blinkRate??530,fgColor:e.fgColor,bgColor:e.bgColor,lastBlinkTime:0,blinkOn:true,id:e.id??vs()}}function br(e,t,r){return {...e,x:t,y:r}}function yr(e,t,r){return {...e,x:e.x+t,y:e.y+r}}function xr(e,t){return {...e,visible:t}}function Cr(e,t){return {...e,shape:t}}function Sr(e,t,r){return {...e,blink:t,blinkRate:r??e.blinkRate,blinkOn:t?e.blinkOn:true}}function hr(e,t,r){return {...e,fgColor:t,bgColor:r}}function bt(e,t){if(!e.blink)return e;let r=e.blinkRate/2;return t-e.lastBlinkTime>=r?{...e,blinkOn:!e.blinkOn,lastBlinkTime:t}:e}function Rr(e,t){return {...e,blinkOn:true,lastBlinkTime:t}}function yt(e){return e.visible?e.blink?e.blinkOn:true:false}var xt="\u2588",$e="\u2581",Ue="\u258F";function Er(e$1,t){let r=t??e(),n=r.char||" ",o,s;switch(e$1.fgColor!==void 0&&e$1.bgColor!==void 0?(o=e$1.fgColor,s=e$1.bgColor):(o=r.bg||c,s=r.fg||b$1),e$1.shape){case "block":return {cell:{char:n,fg:o,bg:s,attrs:r.attrs},fullCell:true};case "underline":return {cell:{char:$e,fg:e$1.fgColor??(r.fg||b$1),bg:r.bg,attrs:r.attrs},fullCell:false};case "bar":return {cell:{char:Ue,fg:e$1.fgColor??(r.fg||b$1),bg:r.bg,attrs:r.attrs},fullCell:false}}}function Tr(e){let t=e.fgColor??b$1,r=e.bgColor??c;switch(e.shape){case "block":return {char:xt,fg:t,bg:r,attrs:a.NONE};case "underline":return {char:$e,fg:t,bg:r,attrs:a.NONE};case "bar":return {char:Ue,fg:t,bg:r,attrs:a.NONE}}}function vr(e){let t=e??gt(),r=new Map;return r.set(t.id,t),{cursors:r,primaryId:t.id}}function _r(e){let t=e.cursors.get(e.primaryId);if(!t)throw new Error(`Primary cursor ${e.primaryId} not found`);return t}function Ir(e,t){let r=new Map(e.cursors);return r.set(t.id,t),{...e,cursors:r}}function Ar(e,t){if(t===e.primaryId)throw new Error("Cannot remove primary cursor");let r=new Map(e.cursors);return r.delete(t),{...e,cursors:r}}function wr(e,t){let r=new Map(e.cursors);return r.set(t.id,t),{...e,cursors:r}}function Mr(e){return Array.from(e.cursors.values()).filter(yt)}function Or(e,t){let r=new Map;for(let[n,o]of e.cursors)r.set(n,bt(o,t));return {...e,cursors:r}}function Pr(e,t,r){for(let n of e.cursors.values())if(n.x===t&&n.y===r&&n.visible)return n}var Ct="\x1B[?25l",St="\x1B[?25h";function kr(){return Ct}function Br(){return St}var _={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},Bs="blecsd-debug.log",Ns=10*1024*1024,Ls={[_.TRACE]:"TRACE",[_.DEBUG]:"DEBUG",[_.INFO]:"INFO",[_.WARN]:"WARN",[_.ERROR]:"ERROR",[_.SILENT]:"SILENT"};function Ds(){let e=process.env.DEBUG??"",t=process.env.BLECSD_DEBUG??"";if(t==="1"||t.toLowerCase()==="true")return true;let r=e.split(",").map(n=>n.trim());for(let n of r)if(n==="blecsd"||n==="blecsd:*"||n==="*"||n.startsWith("blecsd:"))return true;return false}function Nr(e){let t=e??process.env.DEBUG??"";return t?t.split(",").map(r=>r.trim()).filter(r=>r.length>0):["*"]}function Lr(e,t){return !!(t===e||t==="*"||t.endsWith("*")&&e.startsWith(t.slice(0,-1)))}function $s(e,t){if(!t.startsWith("-"))return false;let r=t.slice(1);return Lr(e,r)}function Us(e,t){for(let r of t){if($s(e,r))return false;if(Lr(e,r))return true}return false}var v={enabled:Ds(),logFile:Bs,level:_.DEBUG,timestamps:true,includeLevel:true,maxFileSize:Ns,namespaceFilter:Nr(),initialized:false};function Dr(){return new Date().toISOString().replace("T"," ").replace("Z","")}function $r(e){return e===void 0?"undefined":e===null?"null":typeof e=="string"?e:e instanceof Error?`${e.name}: ${e.message}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import {a as a$3}from'./chunk-WY3KY2TR.js';import {c as c$1,a as a$2}from'./chunk-XZA63ZPO.js';import {f as f$1,v as v$1}from'./chunk-BCADUCOZ.js';import {a as a$1}from'./chunk-EAY7B5GL.js';import {v as v$2,c as c$2,i as i$3}from'./chunk-KD55INV7.js';import {e,k as k$1,a as a$4,f as f$5,g as g$3,h as h$1}from'./chunk-PSXXMBVJ.js';import {s,m,i,n as n$1}from'./chunk-LCN2ZITE.js';import {d,l,f as f$3}from'./chunk-FYEBZAWN.js';import {w as w$1,t,Q as Q$1,M as M$1,r,ba as ba$1,V as V$1,g,Y,c as c$3,K,P,l as l$1,a as a$6}from'./chunk-W5OU7Z6J.js';import {b as b$2,f as f$4}from'./chunk-WNG4A3K7.js';import {a,i as i$2,b as b$1,f as f$2,e as e$1,k as k$2,g as g$2}from'./chunk-G7GIWWLE.js';import {n,c,i as i$1,e as e$2,k,g as g$1,a as a$5,d as d$1,h}from'./chunk-PXXGH3BV.js';import {z as z$1}from'zod';s();function Gt(e){let t=f$1(e);return t?v$1(e,t):false}function je(e,t){let n={left:0,top:0,right:0,bottom:0};return !Gt(e)||!m(e,t)||i.type[t]===0?n:{left:i.left[t]===1?1:0,top:i.top[t]===1?1:0,right:i.right[t]===1?1:0,bottom:i.bottom[t]===1?1:0}}function Xt(e$1,t){let n=e(e$1,t),r=n?.left??0,o=n?.top??0,i=n?.right??0,a=n?.bottom??0,s=je(e$1,t),l=r+s.left,c=o+s.top,g=i+s.right,A=a+s.bottom;return {left:l,top:c,right:g,bottom:A,horizontal:l+g,vertical:c+A}}function Zn(e,t){let n=Xt(e,t);return n.left+n.top+n.right+n.bottom}function Jn(e,t){let n=je(e,t);return n.left>0||n.top>0||n.right>0||n.bottom>0}var et={teeRight:9500,teeLeft:9508,teeDown:9516,teeUp:9524,cross:9532,horizontal:9472,vertical:9474},qt={teeRight:9568,teeLeft:9571,teeDown:9574,teeUp:9577,cross:9580,horizontal:9552,vertical:9553},$t={teeRight:9507,teeLeft:9515,teeDown:9523,teeUp:9531,cross:9547,horizontal:9473,vertical:9475},Qt={teeRight:43,teeLeft:43,teeDown:43,teeUp:43,cross:43,horizontal:45,vertical:124};function Yn(e,t,n={}){return {width:e,height:t,edges:new Map,enabled:n.enabled??true}}function Gn(e){e.edges.clear();}function Xn(e,t,n){return {...e,width:t,height:n}}function G(e,t){return `${e},${t}`}function jt(e){let[t,n]=e.split(",");return {x:Number.parseInt(t??"0",10),y:Number.parseInt(n??"0",10)}}function tt(e){return e===9472||e===9474||e===9484||e===9488||e===9492||e===9496||e===9500||e===9508||e===9516||e===9524||e===9532?"single":e===9552||e===9553||e===9556||e===9559||e===9562||e===9565||e===9568||e===9571||e===9574||e===9577||e===9580?"double":e===9473||e===9475||e===9487||e===9491||e===9495||e===9499||e===9507||e===9515||e===9523||e===9531||e===9547?"bold":e===45||e===124||e===43?"ascii":"unknown"}function nt(e){switch(e){case "single":return et;case "double":return qt;case "bold":return $t;case "ascii":return Qt;default:return et}}function W(e,t,n,r,o,i,a){let s=G(t,n),l={x:t,y:n,type:r,char:o,fg:i,bg:a,style:tt(o)},c=e.edges.get(s);c?c.push(l):e.edges.set(s,[l]);}function qn(e,t,n,r,o,i,a,s,l){for(let c=1;c<r-1;c++)W(e,t+c,n,"h",i,s,l);for(let c=1;c<r-1;c++)W(e,t+c,n+o-1,"h",i,s,l);for(let c=1;c<o-1;c++)W(e,t,n+c,"v",a,s,l);for(let c=1;c<o-1;c++)W(e,t+r-1,n+c,"v",a,s,l);W(e,t,n,"c",0,s,l),W(e,t+r-1,n,"c",0,s,l),W(e,t,n+o-1,"c",0,s,l),W(e,t+r-1,n+o-1,"c",0,s,l);}function rt(e,t,n){let r=e.edges.get(G(t-1,n)),o=e.edges.get(G(t+1,n)),i=e.edges.get(G(t,n-1)),a=e.edges.get(G(t,n+1));return {left:r?.some(s=>s.type==="h"||s.type==="c")??false,right:o?.some(s=>s.type==="h"||s.type==="c")??false,top:i?.some(s=>s.type==="v"||s.type==="c")??false,bottom:a?.some(s=>s.type==="v"||s.type==="c")??false}}function ot(e,t){let{left:n,top:r,right:o,bottom:i}=e;return (n?1:0)+(r?1:0)+(o?1:0)+(i?1:0)<3?null:n&&r&&o&&i?t.cross:n&&r&&i?t.teeLeft:o&&r&&i?t.teeRight:n&&o&&i?t.teeDown:n&&o&&r?t.teeUp:null}function $n(e){if(!e.enabled)return [];let t=[],n=new Set;for(let[r,o]of e.edges){if(n.has(r)||(n.add(r),o.length<2))continue;let{x:i,y:a}=jt(r),s=rt(e,i,a),l=o[0];if(!l)continue;let c=nt(l.style),g=ot(s,c);g!==null&&t.push({x:i,y:a,char:g,fg:l.fg,bg:l.bg});}return t}function Qn(e,t){let n=t.some(o=>o.type==="h"),r=t.some(o=>o.type==="v");return {left:e.left||n,right:e.right||n,top:e.top||r,bottom:e.bottom||r}}function jn(e,t,n,r){if(!e.some(l=>l.type==="c")||e.length<=1)return null;let i=e[0];if(!i)return null;let a=nt(i.style),s=ot(t,a);return s===null?null:{x:n,y:r,char:s,fg:i.fg,bg:i.bg}}function er(e){if(!e.enabled)return [];let t=[],n=new Set;for(let[r,o]of e.edges){if(n.has(r))continue;n.add(r);let{x:i,y:a}=jt(r),s=rt(e,i,a),l=Qn(s,o),c=jn(o,l,i,a);c&&t.push(c);}return t}function tr(e,t){for(let n of t)n.x>=0&&n.x<e.width&&n.y>=0&&n.y<e.height&&e.setCell(n.x,n.y,{char:String.fromCodePoint(n.char),fg:n.fg,bg:n.bg});}function nr(e){return e.map(t=>({x:t.x,y:t.y,char:String.fromCodePoint(t.char),fg:t.fg,bg:t.bg}))}function rr(e){return tt(e)!=="unknown"}function or(e){return e>=9500&&e<=9532||e>=9568&&e<=9580||e>=9507&&e<=9547||e===43}function ir(e){return e.edges.size}function ar(e,t,n){return e.edges.get(G(t,n))??[]}s();n();var Se=1e4,L={HIDDEN:0,VISIBLE:1,SCROLL:2},p={overflow:new Uint8Array(Se),overflowX:new Uint8Array(Se),overflowY:new Uint8Array(Se),hasIndependentOverflow:new Uint8Array(Se)};function sr(e,t){i$1(e,t,p)||(h(e,t,p),p.overflow[t]=L.HIDDEN,p.overflowX[t]=L.HIDDEN,p.overflowY[t]=L.HIDDEN,p.hasIndependentOverflow[t]=0);}function lr(e,t){return i$1(e,t,p)}function cr(e,t,n){return sr(e,t),typeof n=="number"?(p.overflow[t]=n,p.overflowX[t]=n,p.overflowY[t]=n,p.hasIndependentOverflow[t]=0):(n.overflow!==void 0&&(p.overflow[t]=n.overflow,p.overflowX[t]=n.overflow,p.overflowY[t]=n.overflow),n.overflowX!==void 0&&(p.overflowX[t]=n.overflowX,p.hasIndependentOverflow[t]=1),n.overflowY!==void 0&&(p.overflowY[t]=n.overflowY,p.hasIndependentOverflow[t]=1)),t}function De(e,t){return i$1(e,t,p)?p.overflow[t]:L.HIDDEN}function ur(e,t){if(i$1(e,t,p))return {overflow:p.overflow[t],overflowX:p.overflowX[t],overflowY:p.overflowY[t]}}function fr(e,t,n,r){return {x1:e,y1:t,x2:e+n,y2:t+r}}function fe(){return {x1:-1/0,y1:-1/0,x2:1/0,y2:1/0}}function dr(e){return e.x1>=e.x2||e.y1>=e.y2}function yr(e,t,n){return t>=e.x1&&t<e.x2&&n>=e.y1&&n<e.y2}function pr(e,t,n,r,o){return t<e.x2&&t+r>e.x1&&n<e.y2&&n+o>e.y1}function Pe(e,t){return {x1:Math.max(e.x1,t.x1),y1:Math.max(e.y1,t.y1),x2:Math.min(e.x2,t.x2),y2:Math.min(e.y2,t.y2)}}function mr(e,t,n){return {x:Math.max(e.x1,Math.min(e.x2-1,t)),y:Math.max(e.y1,Math.min(e.y2-1,n))}}function gr(e){return e.x2-e.x1}function br(e){return e.y2-e.y1}function hr(e,t){return n$1(e,t)?{top:i.top[t]===1?1:0,right:i.right[t]===1?1:0,bottom:i.bottom[t]===1?1:0,left:i.left[t]===1?1:0}:{top:0,right:0,bottom:0,left:0}}function en(e,t){if(!c$1(e,t))return null;let n=a$2.x[t],r=a$2.y[t],o=a$2.width[t],i=a$2.height[t],a=hr(e,t);return {x1:n+a.left,y1:r+a.top,x2:n+o-a.right,y2:r+i-a.bottom}}function Er(e,t){let n=fe(),r=t;for(;r!==a;){if(De(e,r)!==L.VISIBLE){let a=en(e,r);a&&(n=Pe(n,a));}r=i$2(e,r)??a;}return n}function xr(e,t,n){let r=fe(),o=t;for(;o!==a&&o!==n;){if(De(e,o)!==L.VISIBLE){let s=en(e,o);s&&(r=Pe(r,s));}o=i$2(e,o)??a;}return r}function vr(e,t){return De(e,t)!==L.VISIBLE}function Cr(){return {stack:[],current:fe()}}function Sr(e,t){let n=[...e.stack,e.current],r=Pe(e.current,t);return {stack:n,current:r}}function Dr(e){if(e.stack.length===0)return e;let t=e.stack.slice(0,-1),n=e.stack[e.stack.length-1];return {stack:t,current:n??fe()}}function Pr(e){return e.current}s();n();function it(e,t){return m(e,t)?i.type[t]===0?0:1:0}function at(e,t){if(!Q$1(e,t))return {width:0,height:0};let n=M$1(e,t);return {width:n?.width??0,height:n?.height??0}}function Ir(e$1,t){let n=it(e$1,t),r=n,o=e(e$1,t);return o&&(n+=o.left,r+=o.top),{x:n,y:r}}function tn(e,t$1){let n=0,r=0;if(!i$1(e,t$1,b$1))return {x:n,y:r};let o=i$2(e,t$1);for(;o!==a;){if(!w$1(e,o)){o=i$2(e,o);continue}let i=t(e,o);if(!i){o=i$2(e,o);continue}n+=i.x,r+=i.y;let a=Ir(e,o);if(n+=a.x,r+=a.y,i.absolute)break;o=i$2(e,o);}return {x:n,y:r}}function Ie(e,t$1){if(!w$1(e,t$1))return;let n=t(e,t$1);if(!n)return;let r=at(e,t$1);if(n.absolute)return {left:n.x,top:n.y,right:n.x+r.width-1,bottom:n.y+r.height-1};let o=tn(e,t$1),i=n.x+o.x,a=n.y+o.y;return {left:i,top:a,right:i+r.width-1,bottom:a+r.height-1}}function nn(e,t$1){if(!w$1(e,t$1))return;let n=t(e,t$1);if(!n)return;let r=at(e,t$1),o=0,i=0;if(i$1(e,t$1,b$1)){let a$1=i$2(e,t$1);if(a$1!==a){let s=Ae(e,a$1);s&&(o=s.width,i=s.height);}}return {left:n.x,top:n.y,right:Math.max(0,o-n.x-r.width),bottom:Math.max(0,i-n.y-r.height)}}function st(e$1,t){let n=Ie(e$1,t);if(!n)return;let r=it(e$1,t),o=e(e$1,t),i=o?.left??0,a=o?.top??0,s=o?.right??0,l=o?.bottom??0;return {left:n.left+r+i,top:n.top+r+a,right:n.right-r-s,bottom:n.bottom-r-l}}function Ae(e$1,t){if(!Q$1(e$1,t))return;let n=M$1(e$1,t);if(!n)return;let r=it(e$1,t),o=e(e$1,t),i=(o?.left??0)+(o?.right??0),a=(o?.top??0)+(o?.bottom??0);return {width:Math.max(0,n.width-r*2-i),height:Math.max(0,n.height-r*2-a)}}function rn(e$1,t){let n=e(e$1,t),r=n?.left??0,o=n?.right??0,i=n?.top??0,a=n?.bottom??0;return {horizontal:r+o,vertical:i+a,total:r+o+i+a}}function Ar(e,t,n,r$1){let o=tn(e,t),i=n-o.x,a=r$1-o.y;return r.x[t]=i,r.y[t]=a,t}function kr(e,t,n){let r$1=at(e,t),o=0,i=0;if(i$1(e,t,b$1)){let l=i$2(e,t);if(l!==a){let c=Ae(e,l);c&&(o=c.width,i=c.height);}}let a$1;n.left!==void 0?a$1=n.left:n.right!==void 0?a$1=o-r$1.width-n.right:a$1=r.x[t];let s;return n.top!==void 0?s=n.top:n.bottom!==void 0?s=i-r$1.height-n.bottom:s=r.y[t],r.x[t]=a$1,r.y[t]=s,t}function Tr(e,t){let n=Ie(e,t);if(!n)return;let r=nn(e,t);if(!r)return;let o=st(e,t);if(!o)return;let i=Ae(e,t)??{width:0,height:0},a=rn(e,t);return {absolute:n,relative:r,inner:o,innerDimensions:i,totalPadding:a}}function lt(e,t,n,r){let o=Ie(e,t);return o?n>=o.left&&n<=o.right&&r>=o.top&&r<=o.bottom:false}function Br(e,t,n,r){let o=st(e,t);return o?n>=o.left&&n<=o.right&&r>=o.top&&r<=o.bottom:false}function an(e,t){let n=e*t,r=Math.ceil(n/8);return {width:e,height:t,dirtyCells:new Uint8Array(r),dirtyEntities:new Set,entityBounds:a$1({iterable:true}),dirtyRegions:[],regionsStale:true,forceFullRedraw:true,frameCount:0}}function Rr(e,t,n){let r=an(t,n);return e.entityBounds.forEach((o,i)=>{o.prevX<t&&o.prevY<n&&r.entityBounds.set(i,{...o});}),r.forceFullRedraw=true,r}function Wr(e,t,n){if(t<0||t>=e.width||n<0||n>=e.height)return;let r=n*e.width+t,o=r>>3,i=r&7,a=e.dirtyCells[o];a!==void 0&&(e.dirtyCells[o]=a|1<<i),e.regionsStale=true;}function Mr(e,t,n){if(t<0||t>=e.width||n<0||n>=e.height)return false;let r=n*e.width+t,o=r>>3,i=r&7,a=e.dirtyCells[o];return a===void 0?false:(a&1<<i)!==0}function ke(e,t,n,r,o){let i=Math.max(0,Math.floor(t)),a=Math.max(0,Math.floor(n)),s=Math.min(e.width,Math.floor(t+r)),l=Math.min(e.height,Math.floor(n+o));if(!(s<=i||l<=a)){for(let c=a;c<l;c++)for(let g=i;g<s;g++){let A=c*e.width+g,be=A>>3,Hn=A&7,Rt=e.dirtyCells[be];Rt!==void 0&&(e.dirtyCells[be]=Rt|1<<Hn);}e.regionsStale=true;}}function sn(e,t,n){if(e.dirtyEntities.add(n),!c$1(t,n))return;let r=a$2.x[n],o=a$2.y[n],i=a$2.width[n],a=a$2.height[n],s=e.entityBounds.get(n);s&&(s.prevX!==r||s.prevY!==o||s.prevWidth!==i||s.prevHeight!==a)&&ke(e,s.prevX,s.prevY,s.prevWidth,s.prevHeight),ke(e,r,o,i,a),e.regionsStale=true;}function Or(e,t,n,r){if(!c$1(t,n)){e.entityBounds.delete(n);return}let o={prevX:a$2.x[n],prevY:a$2.y[n],prevWidth:a$2.width[n],prevHeight:a$2.height[n],wasVisible:r};e.entityBounds.set(n,o);}function wr(e,t){let n=e.entityBounds.get(t);n?.wasVisible&&ke(e,n.prevX,n.prevY,n.prevWidth,n.prevHeight),e.dirtyEntities.delete(t),e.entityBounds.delete(t);}function Lr(e,t){return e.dirtyEntities.has(t)}function Te(e,t,n){let r=t*n+e;return {byteIndex:r>>3,bitIndex:r&7}}function on(e,t,n){let r=e[t];if(r!==void 0)return (r&1<<n)!==0}function zr(e,t,n){let r=e[t];r!==void 0&&(e[t]=r|1<<n);}function ct(e,t,n,r){let o=on(e,n,r),i=on(t,n,r);return o===void 0||i===void 0?false:o&&!i}function Nr(e){if(e.forceFullRedraw)return [{x:0,y:0,width:e.width,height:e.height}];let t=[],n=new Uint8Array(e.dirtyCells.length);for(let r=0;r<e.height;r++)for(let o=0;o<e.width;o++){let{byteIndex:i,bitIndex:a}=Te(o,r,e.width);if(ct(e.dirtyCells,n,i,a)){let s=Ur(e,n,o,r);s.width>0&&s.height>0&&t.push(s);}}return Vr(t)}function Fr(e,t,n,r,o,i){let a=n;for(;a<i;){let{byteIndex:s,bitIndex:l}=Te(a,r,o);if(!ct(e,t,s,l))break;a++;}return a}function Kr(e,t,n,r,o,i){for(let a=n;a<r;a++){let{byteIndex:s,bitIndex:l}=Te(a,o,i);if(!ct(e,t,s,l))return false}return true}function _r(e,t,n,r,o,i){for(let a=n;a<o;a++)for(let s=t;s<r;s++){let{byteIndex:l,bitIndex:c}=Te(s,a,i);zr(e,l,c);}}function Ur(e,t,n,r){let o=Fr(e.dirtyCells,t,n,r,e.width,e.width),i=o-n;if(i===0)return {x:n,y:r,width:0,height:0};let a=r;for(;a<e.height&&Kr(e.dirtyCells,t,n,o,a,e.width);)a++;return _r(t,n,r,o,a,e.width),{x:n,y:r,width:i,height:a-r}}function Hr(e,t,n,r){let o=e,i=false;for(let a=r;a<t.length;a++){if(n.has(a))continue;let s=t[a];s&&Zr(o,s)&&(o=Jr(o,s),n.add(a),i=true);}return {merged:o,didMerge:i}}function Vr(e){if(e.length<2)return e;let t=[...e].sort((o,i)=>i.width*i.height-o.width*o.height),n=[],r=new Set;for(let o=0;o<t.length;o++){if(r.has(o))continue;let i=t[o];if(!i)continue;r.add(o);let a=true;for(;a;){let s=Hr(i,t,r,o+1);i=s.merged,a=s.didMerge;}n.push(i);}return n}function Zr(e,t){let n=e.x+e.width,r=e.y+e.height,o=t.x+t.width,i=t.y+t.height;return !(t.x>n+1||o<e.x-1||t.y>r+1||i<e.y-1)}function Jr(e,t){let n=Math.min(e.x,t.x),r=Math.min(e.y,t.y),o=Math.max(e.x+e.width,t.x+t.width),i=Math.max(e.y+e.height,t.y+t.height);return {x:n,y:r,width:o-n,height:i-r}}function Be(e){return e.regionsStale&&(e.dirtyRegions.length=0,e.dirtyRegions.push(...Nr(e)),e.regionsStale=false),e.dirtyRegions}function Yr(e){return e.forceFullRedraw?true:e.dirtyEntities.size>0}function Gr(e){return e.forceFullRedraw}function Xr(e){return e.dirtyEntities}function qr(e){let t=Be(e),n=e.width*e.height,r=0;for(let o of t)r+=o.width*o.height;return {dirtyEntityCount:e.dirtyEntities.size,dirtyRegionCount:t.length,dirtyArea:r,dirtyPercent:n>0?r/n*100:0,fullRedraw:e.forceFullRedraw,trackedEntityCount:e.entityBounds.size}}function $r(e){e.dirtyCells.fill(0),e.dirtyEntities.clear(),e.dirtyRegions.length=0,e.regionsStale=true,e.forceFullRedraw=false,e.frameCount++;}function Qr(e){e.forceFullRedraw=true,e.regionsStale=true;}function jr(e,t){e.entityBounds.forEach((n,r)=>{sn(e,t,r);});}function eo(e,t,n,r,o){if(e.forceFullRedraw)return true;let i=Be(e);for(let a of i)if(t<a.x+a.width&&t+r>a.x&&n<a.y+a.height&&n+o>a.y)return true;return false}function to(e,t,n,r,o){let i=Be(e),a=[];for(let s of i){let l=Math.max(s.x,t),c=Math.max(s.y,n),g=Math.min(s.x+s.width,t+r),A=Math.min(s.y+s.height,n+o);g>l&&A>c&&a.push({x:l,y:c,width:g-l,height:A-c});}return a}n();var Re=new Map;function M(e,t){let n=Re.get(e);return n||(n=t(),Re.set(e,n)),n}function ut(e){Re.delete(e);}function no(){Re.clear();}function ro(e,t,n,r){e.emit("reparent",{entity:t,oldParent:n,newParent:r});}function oo(e,t,n){e.emit("adopt",{parent:t,child:n});}function io(e,t,n){e.emit("attach",{entity:t,screen:n});}function ao(e,t,n){e.emit("detach",{entity:t,screen:n});}function so(e,t,n){e.emit("remove",{parent:t,child:n});}function ft(e,t){e.emit("destroy",{entity:t});}function lo(e,t,n){return M(e,n).on("reparent",t)}function co(e,t,n){return M(e,n).on("adopt",t)}function uo(e,t,n){return M(e,n).on("attach",t)}function fo(e,t,n){return M(e,n).on("detach",t)}function yo(e,t,n){return M(e,n).on("remove",t)}function po(e,t,n){return M(e,n).on("destroy",t)}var O=new Set,dt=new WeakMap,X=[];function We(e){let t=dt.get(e);return t||(t=new Set,dt.set(e,t)),t}function mo(e){return X.push(e),()=>{let t=X.indexOf(e);t!==-1&&X.splice(t,1);}}function ln(){X.length=0;}function cn(e,t,n={}){let{immediate:r=false,destroyChildren:o=true,emitEvent:i=true}=n;if(r)yt(e,t,o,i);else {let a=We(e);if(a.add(t),O.add(t),o&&i$1(e,t,b$1)){let s=f$2(e,t);for(let l of s)a.add(l),O.add(l);}}}function go(e,t,n={}){if(!i$1(e,t,b$1))return;let r=f$2(e,t);for(let o of r)cn(e,o,n);}function bo(e){return O.has(e)}function ho(e){let t=We(e),n=t.size;if(n===0)return 0;let r=Array.from(t);r.sort((o,i)=>{let a=i$1(e,o,b$1)?b$1.depth[o]??0:0;return (i$1(e,i,b$1)?b$1.depth[i]??0:0)-a});for(let o of r)O.has(o)&&yt(e,o,false,true);return t.clear(),n}function yt(e,t,n,r){if(O.delete(t),r)try{let o=M(t,()=>a$3());ft(o,t);}catch{}if(n&&i$1(e,t,b$1)){let o=f$2(e,t);for(let i of o)yt(e,i,true,r);}if(i$1(e,t,b$1)){let o=i$2(e,t);o!==a&&e$1(e,o,t);}for(let o of X)try{o(e,t);}catch{}ut(t);try{e$2(e,t);}catch{}}function Eo(e){We(e).clear(),O.clear(),ln();}function xo(e){return e?dt.get(e)?.size??0:O.size}function vo(e){let t=We(e);for(let n of t)O.delete(n);t.clear();}function Co(){O.clear(),X.length=0;}n();var v=new Map;function q(e,t,n){return typeof n=="function"?n(e,t):n}function $(e,t,n){let r={};return n.fg!==void 0&&(r.fg=q(e,t,n.fg)),n.bg!==void 0&&(r.bg=q(e,t,n.bg)),n.bold!==void 0&&(r.bold=q(e,t,n.bold)),n.underline!==void 0&&(r.underline=q(e,t,n.underline)),n.blink!==void 0&&(r.blink=q(e,t,n.blink)),n.inverse!==void 0&&(r.inverse=q(e,t,n.inverse)),r}function So(e,t){return l$1(e,t)?{fg:c$3.fg[t],bg:c$3.bg[t],bold:c$3.bold[t]===1,underline:c$3.underline[t]===1,blink:c$3.blink[t]===1,inverse:c$3.inverse[t]===1,transparent:c$3.transparent[t]===1,opacity:c$3.opacity[t]??1}:{fg:c$3.fg[t],bg:c$3.bg[t],bold:false,underline:false,blink:false,inverse:false,transparent:false,opacity:1}}function de(e,t){let n=v.get(t);return n||(n={original:So(e,t),focusApplied:false,hoverApplied:false},v.set(t,n)),n}function Do(e){return v.get(e)}function Po(e){return v.has(e)}function Io(e){v.delete(e);}function Ao(){v.clear();}function U(e,t){t.fg!==void 0&&(c$3.fg[e]=t.fg),t.bg!==void 0&&(c$3.bg[e]=t.bg),t.bold!==void 0&&(c$3.bold[e]=t.bold?1:0),t.underline!==void 0&&(c$3.underline[e]=t.underline?1:0),t.blink!==void 0&&(c$3.blink[e]=t.blink?1:0),t.inverse!==void 0&&(c$3.inverse[e]=t.inverse?1:0);}function ye(e,t){c$3.fg[e]=t.fg,c$3.bg[e]=t.bg,c$3.bold[e]=t.bold?1:0,c$3.underline[e]=t.underline?1:0,c$3.blink[e]=t.blink?1:0,c$3.inverse[e]=t.inverse?1:0,c$3.transparent[e]=t.transparent?1:0;}function un(e,t){if(!ba$1(e,t))return;let n=de(e,t);if(n.focusApplied)return;let r={},o=V$1.focusEffectFg[t],i=V$1.focusEffectBg[t];(o&4278190080)!==0&&(r.fg=o),(i&4278190080)!==0&&(r.bg=i),U(t,r),n.focusApplied=true,g(e,t);}function fn(e,t){let n=v.get(t);!n||!n.focusApplied||(n.focusApplied=false,n.hoverApplied?ko(e,t,n):(ye(t,n.original),v.delete(t)),g(e,t));}function Me(e){return v.get(e)?.focusApplied??false}function ko(e,t,n){if(!v$2(e,t))return;ye(t,n.original);let r={},o=c$2.hoverEffectFg[t],i=c$2.hoverEffectBg[t];(o&4278190080)!==0&&(r.fg=o),(i&4278190080)!==0&&(r.bg=i),U(t,r);}function dn(e,t){if(!v$2(e,t))return;let n=de(e,t);if(n.hoverApplied)return;let r={},o=c$2.hoverEffectFg[t],i=c$2.hoverEffectBg[t];(o&4278190080)!==0&&(r.fg=o),(i&4278190080)!==0&&(r.bg=i),U(t,r),n.hoverApplied=true,g(e,t);}function yn(e,t){let n=v.get(t);!n||!n.hoverApplied||(n.hoverApplied=false,n.focusApplied?To(e,t,n):(ye(t,n.original),v.delete(t)),g(e,t));}function To(e,t,n){if(!ba$1(e,t))return;ye(t,n.original);let r={},o=V$1.focusEffectFg[t],i=V$1.focusEffectBg[t];(o&4278190080)!==0&&(r.fg=o),(i&4278190080)!==0&&(r.bg=i),U(t,r);}function Oe(e){return v.get(e)?.hoverApplied??false}function Bo(e,t,n){de(e,t);let r=$(e,t,n);U(t,r),g(e,t);}function pn(e,t){let n=v.get(t);n&&(ye(t,n.original),v.delete(t),g(e,t));}function we(e,t){let n=ba$1(e,t)&&Y(e,t),r=v$2(e,t)&&i$3(e,t),o=Me(t),i=Oe(t);n&&!o?un(e,t):!n&&o&&fn(e,t),r&&!i?dn(e,t):!r&&i&&yn(e,t);}function mn(e,t){return {fg:c$3.fg[t],bg:c$3.bg[t],bold:c$3.bold[t]===1,underline:c$3.underline[t]===1,blink:c$3.blink[t]===1,inverse:c$3.inverse[t]===1,transparent:c$3.transparent[t]===1,opacity:c$3.opacity[t]??1}}function Ro(e,t){let n=v.get(t);return n?n.original:mn(e,t)}var H=new Map,w=new Map;function Wo(e,t,n){if(H.set(t,n),n.focus&&ba$1(e,t)){let r=$(e,t,n.focus);r.fg!==void 0&&(V$1.focusEffectFg[t]=r.fg),r.bg!==void 0&&(V$1.focusEffectBg[t]=r.bg);}if(n.hover&&v$2(e,t)){let r=$(e,t,n.hover);r.fg!==void 0&&(c$2.hoverEffectFg[t]=r.fg),r.bg!==void 0&&(c$2.hoverEffectBg[t]=r.bg);}we(e,t);}function Mo(e){return H.get(e)}function Oo(e,t){H.delete(t),w.delete(t),pn(e,t);}function gn(e){let t=w.get(e);return t||(t={pressApplied:false,disabledApplied:false},w.set(e,t)),t}function wo(e,t){let n=H.get(t);if(!n?.press)return;let r=gn(t);if(r.pressApplied)return;de(e,t);let o=$(e,t,n.press);U(t,o),r.pressApplied=true,g(e,t);}function Lo(e,t){let n=w.get(t);n?.pressApplied&&(n.pressApplied=false,we(e,t));}function zo(e,t){let n=H.get(t);if(!n?.disabled)return;let r=gn(t);if(r.disabledApplied)return;de(e,t);let o=$(e,t,n.disabled);U(t,o),r.disabledApplied=true,g(e,t);}function No(e,t){let n=w.get(t);n?.disabledApplied&&(n.disabledApplied=false,we(e,t));}function pt(e){return w.get(e)?.pressApplied??false}function mt(e){return w.get(e)?.disabledApplied??false}function Fo(e){return Me(e)||Oe(e)||pt(e)||mt(e)}function Ko(e){return {focus:Me(e),hover:Oe(e),press:pt(e),disabled:mt(e)}}function _o(e){v.delete(e),H.delete(e),w.delete(e);}function Uo(){H.clear(),w.clear();}n();function Ho(e){let{type:t,target:n,payload:r,bubbles:o=true}=e;return {type:t,target:n,currentTarget:n,bubbles:o,defaultPrevented:false,propagationStopped:false,immediatePropagationStopped:false,payload:r,stopPropagation(){this.propagationStopped=true;},stopImmediatePropagation(){this.propagationStopped=true,this.immediatePropagationStopped=true;},preventDefault(){this.defaultPrevented=true;}}}function Vo(e,t,n){let r=0,o=t.target;for(;o!==a;){t.currentTarget=o;let i=n(e,o);if(i&&(i.emit(t.type,t),r++,t.immediatePropagationStopped)||t.propagationStopped||!t.bubbles||!i$1(e,o,b$1))break;o=i$2(e,o);}return {defaultPrevented:t.defaultPrevented,propagationStopped:t.propagationStopped,dispatchCount:r}}function Zo(){let e=new Map;return {get:(t,n)=>e.get(n),getOrCreate:(t,n)=>{let r=e.get(t);return r||(r=n(),e.set(t,r)),r},set:(t,n)=>{e.set(t,n);},delete:t=>e.delete(t),has:t=>e.has(t),clear:()=>e.clear()}}n();var y={xi:new Float32Array(1e4),xl:new Float32Array(1e4),yi:new Float32Array(1e4),yl:new Float32Array(1e4),base:new Float32Array(1e4),valid:new Uint8Array(1e4)};function Jo(e,t,n){y.xi[t]=n.xi,y.xl[t]=n.xl,y.yi[t]=n.yi,y.yl[t]=n.yl,y.base[t]=n.base,y.valid[t]=1;}function Yo(e,t){if(y.valid[t]===1)return {xi:y.xi[t],xl:y.xl[t],yi:y.yi[t],yl:y.yl[t],base:y.base[t]}}function Go(e,t){return y.valid[t]===1}function Xo(e,t){y.valid[t]=0;}function qo(e,t,n){y.valid[t]=0;let r=n(e,t);for(let o of r)y.valid[o]=0;}function $o(e){y.valid.fill(0);}function Qo(e,t){return y.valid[t]!==1?0:y.xl[t]-y.xi[t]}function jo(e,t){return y.valid[t]!==1?0:y.yl[t]-y.yi[t]}function ei(e,t,n){y.valid[t]===1&&(y.base[t]=n);}function gt(e,t,n,r){if(y.valid[t]!==1)return false;let o=y.xi[t],i=y.xl[t],a=y.yi[t],s=y.yl[t];return n>=o&&n<i&&r>=a&&r<s}s();n();function ti(e){return k(e,[r,K,c$3])}function ni(e){return k(e,[V$1])}function Q(e){return k(e,[c$2])}function ri(e){return k(e,[k$1])}function oi(e){return k(e,[r,K,c$3,d])}function ii(e){return k(e,[r,K,c$3,i])}function ai(e){return k(e,[r,K,c$3,a$4])}function bn(e){return k(e,[b$1])}function si(e,t){return t.filter(n=>c$3.visible[n]===1)}function li(e,t){return t.filter(n=>c$3.dirty[n]===1)}function ci(e,t){return t.filter(n=>c$3.visible[n]===1&&c$3.dirty[n]===1)}function hn(e,t){let n=[],r=b$1.firstChild[t];for(;r!==0;)n.push(r),r=b$1.nextSibling[r];return n}function ui(e,t){let n=[],r=[t];for(;r.length>0;){let o=r.pop(),i=hn(e,o);for(let a of i)n.push(a),r.push(a);}return n}function fi(e){return bn(e).filter(n=>b$1.parent[n]===0)}function di(e,t){return t.filter(n=>V$1.focusable[n]===1)}function yi(e,t){return t.filter(n=>c$2.clickable[n]===1)}function pi(e,t){return [...t].sort((n,r)=>{let o=V$1.tabIndex[n]??0,i=V$1.tabIndex[r]??0;return o===0&&i!==0?1:i===0&&o!==0?-1:o-i})}function mi(e,t){return [...t].sort((n,r)=>(b$1.depth[n]??0)-(b$1.depth[r]??0))}n();var b=0,Le=2147483647,ze=-2147483648,En=1e4,f={zIndex:new Int32Array(En),localZ:new Int32Array(En)};function gi(e){f.zIndex[e]=b,f.localZ[e]=b;}function V(e,t){i$1(e,t,f)||(h(e,t,f),gi(t));}function j(e,t){return i$1(e,t,f)?f.zIndex[t]??b:b}function bi(e,t){return i$1(e,t,f)?f.localZ[t]??b:b}function Ne(e,t){return i$1(e,t,f)}function hi(e,t,n){V(e,t),f.zIndex[t]=Math.max(ze,Math.min(Le,Math.floor(n)));}function Ei(e,t,n){V(e,t),f.localZ[t]=Math.max(ze,Math.min(Le,Math.floor(n)));}function xi(e,t){V(e,t);let n=Fe(e,t);if(n.length===0)return;let r=f.zIndex[t]??b;for(let o of n)if(i$1(e,o,f)){let i=f.zIndex[o]??b;i>=r&&(r=i+1);}f.zIndex[t]=r;}function vi(e,t){V(e,t);let n=Fe(e,t);if(n.length===0)return;let r=f.zIndex[t]??b;for(let o of n)if(i$1(e,o,f)){let i=f.zIndex[o]??b;i<=r&&(r=i-1);}f.zIndex[t]=r;}function Ci(e,t){V(e,t);let n=Fe(e,t),r=f.zIndex[t]??b,o=null,i=Le;for(let a of n)if(i$1(e,a,f)){let s=f.zIndex[a]??b;s>r&&s<i&&(o=a,i=s);}return o!==null?(f.zIndex[t]=i,f.zIndex[o]=r,true):false}function Si(e,t){V(e,t);let n=Fe(e,t),r=f.zIndex[t]??b,o=null,i=ze;for(let a of n)if(i$1(e,a,f)){let s=f.zIndex[a]??b;s<r&&s>i&&(o=a,i=s);}return o!==null?(f.zIndex[t]=i,f.zIndex[o]=r,true):false}function xn(e,t){return [...t].sort((n,r)=>{let o=i$1(e,n,f)?f.zIndex[n]??b:b,i=i$1(e,r,f)?f.zIndex[r]??b:b;return o-i})}function vn(e,t){let n=f$2(e,t);return xn(e,n)}function Fe(e,t){if(!i$1(e,t,b$1))return [];let n=i$2(e,t);return n===a?[]:f$2(e,n).filter(o=>o!==t)}function Di(e,t){let n=vn(e,t);for(let r=0;r<n.length;r++){let o=n[r];o!==void 0&&(V(e,o),f.zIndex[o]=r);}}function Pi(e){f.zIndex[e]=b,f.localZ[e]=b;}function Ii(){return {entities:[],dirty:true,lastCount:0}}function Ai(e){e.dirty=true;}function ki(e){return e.dirty}function ne(e,t){if(!t.dirty)return;let r=Q(e).filter(o=>c$2.clickable[o]===1||c$2.hoverable[o]===1);r.sort((o,i)=>{let a=Ne(e,o)?f.zIndex[o]??0:0;return (Ne(e,i)?f.zIndex[i]??0:0)-a}),t.entities=r,t.lastCount=r.length,t.dirty=false;}function Ti(e,t){return ne(e,t),t.entities}function Bi(e,t){return ne(e,t),t.entities.length}var bt={useCachedPositions:true,clickableOnly:true,hoverableOnly:false,interactiveOnly:false};function ee(e,t,n){return i$1(e,t,c$2)?n.interactiveOnly?c$2.clickable[t]===1||c$2.hoverable[t]===1:n.clickableOnly&&n.hoverableOnly?c$2.clickable[t]===1&&c$2.hoverable[t]===1:n.clickableOnly?c$2.clickable[t]===1:n.hoverableOnly?c$2.hoverable[t]===1:true:false}function te(e,t,n,r,o){return o?gt(e,t,n,r):lt(e,t,n,r)}function Ri(e,t,n,r,o){let i=o.useCachedPositions??true;ne(e,t);for(let a of t.entities)if(ee(e,a,o)&&te(e,a,n,r,i))return a;return null}function Wi(e,t,n,r){let o=r.useCachedPositions??true,i=Q(e),a=[];for(let s of i)ee(e,s,r)&&te(e,s,t,n,o)&&a.push({eid:s,z:j(e,s)});return a.length===0?null:(a.sort((s,l)=>l.z-s.z),a[0]?.eid??null)}function pe(e,t,n,r,o=bt){return r?Ri(e,r,t,n,o):Wi(e,t,n,o)}function ht(e,t,n,r,o=bt){let i=o.useCachedPositions??true,a=[];if(r){ne(e,r);for(let c of r.entities)ee(e,c,o)&&te(e,c,t,n,i)&&a.push(c);return a}let s=Q(e),l=[];for(let c of s)ee(e,c,o)&&te(e,c,t,n,i)&&l.push({eid:c,z:j(e,c)});return l.sort((c,g)=>g.z-c.z),l.map(c=>c.eid)}function Mi(e,t,n,r,o=bt){let i=o.useCachedPositions??true,a=[];if(r){ne(e,r);for(let l of r.entities)ee(e,l,o)&&te(e,l,t,n,i)&&a.push({entity:l,zIndex:j(e,l)});return a}let s=Q(e);for(let l of s)ee(e,l,o)&&te(e,l,t,n,i)&&a.push({entity:l,zIndex:j(e,l)});return a.sort((l,c)=>c.zIndex-l.zIndex),a}function Oi(e,t,n,r){return pe(e,t,n,r,{clickableOnly:true,useCachedPositions:true})!==null}function wi(e,t,n,r){return pe(e,t,n,r,{hoverableOnly:true,clickableOnly:false,useCachedPositions:true})!==null}function Li(e,t,n,r){return pe(e,t,n,r,{clickableOnly:true,useCachedPositions:true})}function zi(e,t,n,r){return pe(e,t,n,r,{hoverableOnly:true,clickableOnly:false,useCachedPositions:true})}function Ni(e,t,n,r){return ht(e,t,n,r,{clickableOnly:true,useCachedPositions:true})}function Fi(e,t,n,r){return ht(e,t,n,r,{hoverableOnly:true,clickableOnly:false,useCachedPositions:true})}var Cn=z$1.object({keys:z$1.union([z$1.string(),z$1.array(z$1.string()).readonly()]),action:z$1.string().min(1),when:z$1.string().optional(),preventDefault:z$1.boolean().optional(),description:z$1.string().optional()}),Ki=z$1.array(Cn),_i={esc:"escape",ret:"return",cr:"return",lf:"enter",bs:"backspace",del:"delete",ins:"insert",pgup:"pageup",pgdn:"pagedown",pgdown:"pagedown",arrow_up:"up",arrow_down:"down",arrow_left:"left",arrow_right:"right"},Ui={control:"ctrl",cmd:"meta",command:"meta",option:"meta",alt:"meta",win:"meta",super:"meta"};function Hi(e,t){t==="ctrl"?e.ctrl=true:t==="meta"?e.meta=true:t==="shift"&&(e.shift=true);}function Vi(e,t,n){if(t){let r=Zi(e);if(!r)return false;n.name=r;}else {let r=Ji(e);if(!r)return false;Hi(n,r);}return true}function xt(e){if(!e)return null;let t=e.toLowerCase().split("+").map(r=>r.trim());if(t.length===0)return null;let n={name:"undefined",ctrl:false,meta:false,shift:false};for(let r=0;r<t.length;r++){let o=t[r];if(o&&!Vi(o,r===t.length-1,n))return null}return n.name==="undefined"?null:n}function Zi(e){let t=e.toLowerCase(),n=_i[t];return n||(t.length===1||/^f(1[0-2]|[1-9])$/.test(t)||new Set(["up","down","left","right","home","end","pageup","pagedown","insert","delete","clear","return","enter","tab","backspace","escape","space"]).has(t)?t:null)}function Ji(e){let t=e.toLowerCase();return t==="ctrl"||t==="meta"||t==="shift"?t:Ui[t]??null}function vt(e){let t=[];return e.ctrl&&t.push("ctrl"),e.meta&&t.push("meta"),e.shift&&t.push("shift"),t.push(e.name),t.join("+")}function Sn(e){let t=[];return e.ctrl&&t.push("ctrl"),e.meta&&t.push("meta"),e.shift&&t.push("shift"),t.push(e.name),t.join("+")}function Yi(){return {bindings:new Map,keyIndex:new Map}}function Dn(e,t){let n=new Map(e.bindings),r=new Map;for(let[i,a]of e.keyIndex)r.set(i,[...a]);n.set(t.action,t);let o=Array.isArray(t.keys)?t.keys:[t.keys];for(let i of o){let a=xt(i);if(!a)continue;let s=vt(a),l=r.get(s)??[];r.set(s,[...l,t]);}return {bindings:n,keyIndex:r}}function Gi(e,t){return t.reduce((n,r)=>Dn(n,r),e)}function Xi(e,t){if(!e.bindings.get(t))return e;let r=new Map(e.bindings),o=new Map;for(let[i,a]of e.keyIndex){let s=a.filter(l=>l.action!==t);s.length>0&&o.set(i,s);}return r.delete(t),{bindings:r,keyIndex:o}}function qi(e,t){return e.bindings.get(t)}function $i(e,t){let n=vt(t);return e.keyIndex.get(n)??[]}function Qi(e,t){let n=Array.isArray(e.keys)?e.keys:[e.keys];for(let r of n){let o=xt(r);if(o&&o.name===t.name&&o.ctrl===t.ctrl&&o.meta===t.meta&&o.shift===t.shift)return true}return false}function Pn(e,t){if(!e)return true;let n=e.split("&&").map(r=>r.trim());for(let r of n)if(!In(r,t))return false;return true}function In(e,t){let n=e.trim();if(n.startsWith("!"))return !In(n.slice(1),t);if(n.includes("==")){let o=n.split("==").map(c=>c.trim()),i=o[0],a=o[1];if(!i||!a)return false;let s=Et(i,t),l=a.replace(/^['"]|['"]$/g,"");return String(s)===l}if(n.includes("!=")){let o=n.split("!=").map(c=>c.trim()),i=o[0],a=o[1];if(!i||!a)return false;let s=Et(i,t),l=a.replace(/^['"]|['"]$/g,"");return String(s)!==l}return !!Et(n,t)}function Et(e,t){let n=e.trim();return t[n]}function ji(e,t,n={}){let r=Sn(t),o=e.keyIndex.get(r)??[],i=[];for(let a of o)a.when&&!Pn(a.when,n)||i.push({binding:a,action:a.action,preventDefault:a.preventDefault??true});return i}function ea(e){return vt(e)}function ta(e){return Sn(e)}function na(e){return [...e.bindings.values()]}var ra=[{keys:["ctrl+c"],action:"copy",description:"Copy selection"},{keys:["ctrl+v"],action:"paste",description:"Paste clipboard"},{keys:["ctrl+x"],action:"cut",description:"Cut selection"},{keys:["ctrl+z"],action:"undo",description:"Undo"},{keys:["ctrl+shift+z","ctrl+y"],action:"redo",description:"Redo"},{keys:["ctrl+a"],action:"selectAll",description:"Select all"},{keys:["backspace"],action:"deleteBack",description:"Delete backwards"},{keys:["delete"],action:"deleteForward",description:"Delete forwards"},{keys:["home"],action:"moveToLineStart",description:"Move to line start"},{keys:["end"],action:"moveToLineEnd",description:"Move to line end"},{keys:["ctrl+home"],action:"moveToStart",description:"Move to document start"},{keys:["ctrl+end"],action:"moveToEnd",description:"Move to document end"}],oa=[{keys:["tab"],action:"focusNext",description:"Focus next element"},{keys:["shift+tab"],action:"focusPrev",description:"Focus previous element"},{keys:["escape"],action:"cancel",description:"Cancel/close"},{keys:["enter","return"],action:"confirm",description:"Confirm/submit"},{keys:["up"],action:"moveUp",description:"Move up"},{keys:["down"],action:"moveDown",description:"Move down"},{keys:["left"],action:"moveLeft",description:"Move left"},{keys:["right"],action:"moveRight",description:"Move right"},{keys:["pageup"],action:"pageUp",description:"Page up"},{keys:["pagedown"],action:"pageDown",description:"Page down"}];var An={CRITICAL:0,HIGH:1,NORMAL:2,LOW:3};function ia(e){let t,n=false;return {get(){return n||(t=e(),n=true),t},isInitialized(){return n},reset(){t=void 0,n=false;}}}var Z=[],re=null,Ke=null;function aa(e,t,n){Z.find(o=>o.name===e)||Z.push({name:e,priority:t,initFn:n,initialized:false,initTimeMs:null});}function kn(e){let t=Z.find(o=>o.name===e);if(!t||t.initialized)return null;re===null&&(re=performance.now());let n=performance.now();t.initFn();let r=performance.now()-n;return t.initialized=true,t.initTimeMs=r,Ke===null&&(Ke=performance.now()-re),r}function sa(e=An.LOW){re===null&&(re=performance.now());let t=0,n=[...Z].filter(r=>!r.initialized&&r.priority<=e).sort((r,o)=>r.priority-o.priority);for(let r of n){let o=kn(r.name);o!==null&&(t+=o);}return t}function la(){return {totalMs:Z.filter(n=>n.initialized).reduce((n,r)=>n+(r.initTimeMs??0),0),subsystems:Z.map(n=>({name:n.name,priority:n.priority,initTimeMs:n.initTimeMs??0,lazy:!n.initialized})),timeToFirstInit:Ke??0}}function ca(e){let t=[],n=["CRITICAL","HIGH","NORMAL","LOW"];t.push("Startup Report"),t.push("\u2550".repeat(40)),t.push(`Total init time: ${e.totalMs.toFixed(1)}ms`),t.push(`Time to first init: ${e.timeToFirstInit.toFixed(1)}ms`),t.push("");for(let r of e.subsystems){let o=r.lazy?"(lazy)":`${r.initTimeMs.toFixed(1)}ms`,i=n[r.priority]??"UNKNOWN";t.push(` [${i}] ${r.name}: ${o}`);}return t.join(`
|
|
2
|
+
`)}function ua(){Z.length=0,re=null,Ke=null;}function fa(e=6e4){let t=Ct.get();if(t&&Date.now()-t.cachedAt<e)return t;let n=process.env,r=n.TERM??"",o=n.COLORTERM??"",i=o==="truecolor"||o==="24bit"||r.includes("24bit")||r.includes("truecolor"),a=i||r.includes("256color")||o==="256color",s=(n.LANG??"").includes("UTF-8")||(n.LC_ALL??"").includes("UTF-8"),l={term:r,trueColor:i,color256:a,unicode:s,width:process.stdout.columns??80,height:process.stdout.rows??24,cachedAt:Date.now()};return Ct.set(l),l}var Ct={_value:null,get(){return this._value},set(e){this._value=e;},clear(){this._value=null;}};function da(){Ct.clear();}var Bn={0:"INPUT",1:"EARLY_UPDATE",2:"UPDATE",3:"LATE_UPDATE",4:"PHYSICS",5:"LAYOUT",6:"RENDER",7:"POST_RENDER"};function ya(e){return typeof e=="number"&&e>=0&&e<=7}function Tn(e){for(let t=0;t<=7;t++)e.set(t,{id:t,name:Bn[t]??`PHASE_${t}`,order:t*1e3,isBuiltin:true});}function Rn(){let e=new Map,t=0,n=true,r=[];Tn(e);function o(a){let s=Number.MAX_SAFE_INTEGER;for(let l of e.values())l.order>a&&l.order<s&&(s=l.order);return s===Number.MAX_SAFE_INTEGER&&(s=a+1e3),s}function i(){let a=Array.from(e.values());a.sort((s,l)=>s.order-l.order),r=a.map(s=>s.id),n=false;}return {registerPhase(a,s){let l=e.get(s);if(!l)throw new Error(`Cannot register phase after unknown phase: ${String(s)}`);let c=`custom_${a}_${++t}`,g=l.order,A=o(g),be=g+(A-g)/2;return e.set(c,{id:c,name:a,order:be,isBuiltin:false}),n=true,c},unregisterPhase(a){let s=e.get(a);if(!s)return false;if(s.isBuiltin)throw new Error(`Cannot remove built-in phase: ${s.name}`);return e.delete(a),n=true,true},getPhaseOrder(){return n&&i(),r},getPhaseName(a){return e.get(a)?.name},hasPhase(a){return e.has(a)},isBuiltin(a){return e.get(a)?.isBuiltin??false},getPhaseCount(){return e.size},getCustomPhaseCount(){let a=0;for(let s of e.values())s.isBuiltin||a++;return a},getCustomPhases(){let a=[];for(let s of e.values())!s.isBuiltin&&typeof s.id=="string"&&a.push(s.id);return a},clearCustomPhases(){for(let[a,s]of e)s.isBuiltin||e.delete(a);t=0,n=true;},reset(){e.clear(),t=0,Tn(e),n=true;}}}var pa=Rn();var ma=z$1.union([z$1.number(),z$1.string().refine(e=>!!(["center","half","left","right","top","bottom"].includes(e)||/^\d+(\.\d+)?%$/.test(e)||/^(\d+(\.\d+)?%?)([-+]\d+(\.\d+)?)?$/.test(e)),{message:'Position must be a number, percentage (e.g. "50%"), expression (e.g. "50%-5"), or keyword (center, half)'})]),Wn={center:"center",half:"half",left:"start",right:"end",top:"start",bottom:"end"};function ga(e){let t=e.match(/^(\d+(?:\.\d+)?)(%?)(([+-])(\d+(?:\.\d+)?))?$/);if(!t)return null;let n=Number.parseFloat(t[1]),r=t[2]==="%",o=0;if(t[3]){let i=t[4],a=Number.parseFloat(t[5]);o=i==="-"?-a:a;}return {base:n,isPercent:r,offset:o}}function _e(e,t,n=0){if(typeof e=="number")return Math.floor(e)||0;let r=Wn[e];if(r)switch(r){case "center":return Math.floor((t-n)/2);case "half":return Math.floor(t/2);case "start":return 0;case "end":return t-n}let o=ga(e);if(!o)return 0;let i;return o.isPercent?i=o.base/100*t:i=o.base,i+=o.offset,Math.floor(i)}function ba(e,t,n=0){if(typeof e=="number"&&e<0)return t+e-n;if(typeof e=="string"&&e.startsWith("-")){let r=e.match(/^-(\d+(?:\.\d+)?)$/);if(r){let o=Number.parseFloat(r[1]);return t-o-n}}return _e(e,t,n)}function Dt(e,t,n=0){let r=t-n;return e<0?0:e>r?Math.max(0,r):e}function ha(e){return typeof e=="number"?false:e.includes("%")}function Ea(e){return typeof e=="number"?false:e in Wn}function xa(){return "center"}function va(e){return `${e}%`}function Ca(e,t){return t>=0?`${e}%+${t}`:`${e}%${t}`}function Mn(e,t,n,r,o=0,i=0){return {x:_e(e,n,o),y:_e(t,r,i)}}function Sa(e,t,n,r,o=0,i=0){let a=Mn(e,t,n,r,o,i);return {x:Dt(a.x,n,o),y:Dt(a.y,r,i)}}function Pt(e,t,n,r,o){e.transition={transition:o,elapsed:0,fromScene:n,toScene:r},o.onStart?.(t);}function Da(e,t){e.transition&&(e.transition.transition.onComplete?.(t),e.transition=null);}function It(e,t){e.created||(e.scene.onCreate?.(t),e.created=true);}function Ue(e,t){It(e,t),e.scene.onEnter?.(t);}function z(e,t){e.onExit?.(t);}function Pa(e,t,n){for(let r=e.stack.length-1;r>=0;r--){let o=e.stack[r];o&&z(o,t);}e.stack=[n.scene],Ue(n,t);}function Ia(e,t,n){let r=e.stack[e.stack.length-1];r&&z(r,t),e.stack.push(n.scene),Ue(n,t);}function Aa(e,t){if(e.stack.length<=0)return false;let n=e.stack[e.stack.length-1];n&&z(n,t),e.stack.pop();let r=e.stack[e.stack.length-1];if(r){let o=e.registry.get(r.name);o&&Ue(o,t);}return true}function ka(){let e={registry:new Map,stack:[],transition:null};return {registerScene(t){return e.registry.has(t.name)?false:(e.registry.set(t.name,{scene:t,created:false}),true)},unregisterScene(t,n){let r=e.registry.get(n);if(!r)return false;let o=e.stack.indexOf(r.scene);return o!==-1&&(z(r.scene,t),e.stack.splice(o,1)),r.created&&r.scene.onDestroy?.(t),e.registry.delete(n),true},switchTo(t,n,r){let o=e.registry.get(n);if(!o)return false;if(r){let i=e.stack[e.stack.length-1]??null;for(let a=e.stack.length-1;a>=0;a--){let s=e.stack[a];s&&z(s,t);}e.stack=[o.scene],It(o,t),Pt(e,t,i,o.scene,r);}else Pa(e,t,o);return true},push(t,n,r){let o=e.registry.get(n);if(!o)return false;if(r){let i=e.stack[e.stack.length-1]??null;i&&z(i,t),e.stack.push(o.scene),It(o,t),Pt(e,t,i,o.scene,r);}else Ia(e,t,o);return true},pop(t,n){if(e.stack.length<=0)return false;if(n){let r=e.stack[e.stack.length-1]??null;r&&z(r,t),e.stack.pop();let o=e.stack[e.stack.length-1]??null;return o?Pt(e,t,r,o,n):e.transition=null,true}return Aa(e,t)},getCurrentScene(){return e.stack[e.stack.length-1]??null},getSceneStack(){return [...e.stack]},getRegisteredScenes(){return Array.from(e.registry.keys())},isTransitioning(){return e.transition!==null},getTransitionState(){return e.transition},updateTransition(t,n){if(!e.transition)return;e.transition.elapsed+=n;let r=Math.min(1,e.transition.elapsed/e.transition.transition.duration);if(e.transition.transition.onUpdate?.(t,r),r>=1){let o=e.transition.toScene;Da(e,t);let i=e.registry.get(o.name);i&&Ue(i,t);}},reset(t){e.transition=null;for(let n=e.stack.length-1;n>=0;n--){let r=e.stack[n];r&&z(r,t);}for(let n of e.registry.values())n.created&&n.scene.onDestroy?.(t);e.registry.clear(),e.stack=[];}}}function Ta(e,t){return {duration:e,onUpdate:t}}function Ba(e,t,n){return {duration:e,onUpdate(r,o){n?.(r,o,t);}}}function Ra(e,t){return n=>{let r=t();return e.isTransitioning()&&e.updateTransition(n,r),e.isTransitioning()||e.getCurrentScene()?.onUpdate?.(n,r),n}}n();c();var N=new Map;function Wa(e){N.set(e.name,e);}function Ma(e){return N.delete(e)}function Oa(e){return N.get(e)}function wa(){return Array.from(N.keys())}function La(){N.clear();}function On(e){return e instanceof Float32Array||e instanceof Float64Array||e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array}function za(e,t){let n={};for(let[o,i]of Object.entries(e.store))On(i)&&(n[o]=i[t]);let r={fields:n};return e.serialize&&(r.custom=e.serialize(t)),r}function wn(e,t){let n=g$1(e),r=t?.entityFilter?n.filter(a=>t.entityFilter.includes(a)):n,o=_a(t?.componentFilter),i=[];for(let a of r){let s={},l=false;for(let c of o)i$1(e,a,c.store)&&(s[c.name]=za(c,a),l=true);l&&i.push({id:a,components:s});}return {version:1,timestamp:Date.now(),entities:i,metadata:t?.metadata}}function Na(e,t){return JSON.stringify(wn(e,t))}function Fa(e,t,n){for(let[r,o]of Object.entries(n.fields)){let i=e.store[r];On(i)&&(i[t]=o);}e.deserialize&&n.custom!==void 0&&e.deserialize(t,n.custom);}function Ln(e,t,n){let r=t;if(n?.createNew)r=a$5();else if(n?.clearWorld){let a=g$1(r);for(let s of a)e$2(r,s);}let o=new Map,i=0;for(let a of e.entities){let s=d$1(r);o.set(a.id,s);for(let[l,c]of Object.entries(a.components)){let g=N.get(l);g&&(h(r,s,g.store),Fa(g,s,c),i++);}}return {world:r,entityMap:o,entityCount:o.size,componentCount:i}}function Ka(e,t,n){let r=JSON.parse(e);return Ln(r,t,n)}function _a(e){if(!e)return Array.from(N.values());let t=[];for(let n of e){let r=N.get(n);r&&t.push(r);}return t}function Ua(e){return JSON.parse(JSON.stringify(e))}var Ha=1;s();function Nn(e,t){return m(e,t)?{h:2,v:2}:{h:0,v:0}}function He(e,t){let n=Nn(e,t),r=f$5(e,t)?g$3(e,t):0;return n.h+r}function zn(e,t){let n=Nn(e,t),r=f$5(e,t)?h$1(e,t):0;return n.v+r}function Fn(e,t){if(!l(e,t))return He(e,t);let n=f$3(e,t);if(!n)return He(e,t);let r=n.split(`
|
|
3
|
+
`),o=0;for(let i of r){let a=b$2(i);a>o&&(o=a);}return o+He(e,t)}function Kn(e,t,n){if(!l(e,t))return zn(e,t);let r=f$3(e,t),o=He(e,t),i=n?n-o:void 0,a;return i&&i>0?a=f$4(r,{width:i,wrap:true}).length:a=r.split(`
|
|
4
|
+
`).length,a+zn(e,t)}function At(e,t){let n=Fn(e,t),r=Kn(e,t,n);return {width:n,height:r}}function Va(e,t){if(!P(e,t)||!Q$1(e,t))return false;let n=At(e,t),r=K.minWidth[t],o=K.minHeight[t],i=K.maxWidth[t],a=K.maxHeight[t],s=Math.min(Math.max(n.width,r),i),l=Math.min(Math.max(n.height,o),a);return K.width[t]=s,K.height[t]=l,true}function Za(e,t){if(!Q$1(e,t))return;let n=At(e,t),r=K.minWidth[t],o=K.minHeight[t],i=K.maxWidth[t],a=K.maxHeight[t];return {width:Math.min(Math.max(n.width,r),i),height:Math.min(Math.max(n.height,o),a)}}var Un=["fg","bold","underline","blink","inverse"],Ja=["bg","transparent"],ie=new Map,me=0;function Ya(){return me}function Ga(e){ie.delete(e);}function Xa(){me++,ie.clear();}function qa(){ie.clear();}function $a(e){let t=ie.get(e);return t!==void 0&&t.timestamp===me}function oe(e,t){return l$1(e,t)?{fg:c$3.fg[t],bg:c$3.bg[t],bold:c$3.bold[t]===1,underline:c$3.underline[t]===1,blink:c$3.blink[t]===1,inverse:c$3.inverse[t]===1,transparent:c$3.transparent[t]===1,opacity:c$3.opacity[t]??1}:Bt()}function Bt(){return {fg:a$6,bg:0,bold:false,underline:false,blink:false,inverse:false,transparent:false,opacity:1}}function Tt(e,t){return {fg:t.fg!==a$6?t.fg:e.fg,bold:t.bold||e.bold,underline:t.underline||e.underline,blink:t.blink||e.blink,inverse:t.inverse||e.inverse,bg:t.bg,transparent:t.transparent,opacity:t.opacity}}function Qa(e){return e===a$6||e===0}function ge(e,t){let n=ie.get(t);if(n!==void 0&&n.timestamp===me)return n.style;let r=oe(e,t);if(!k$2(e,t))return kt(t,r),r;let o=g$2(e,t);if(o.length===0)return kt(t,r),r;let i=ja(e,o,r);return kt(t,i),i}function ja(e,t,n){let r=oe(e,t[t.length-1]);for(let o=t.length-2;o>=0;o--){let i=oe(e,t[o]);r=Tt(r,i);}return Tt(r,n)}function kt(e,t){ie.set(e,{style:t,timestamp:me});}function es(e,t){return ge(e,t)}function ts(e){return Un.includes(e)}function ns(e,t,n){return ge(e,t)[n]}function rs(e,t,n){let r=oe(e,t);if(_n(r,n))return t;if(!k$2(e,t))return 0;let o=g$2(e,t);for(let i of o){let a=oe(e,i);if(_n(a,n))return i}return 0}function _n(e,t){let n=Bt();switch(t){case "fg":return e.fg!==n.fg;case "bg":return e.bg!==n.bg;case "bold":return e.bold!==n.bold;case "underline":return e.underline!==n.underline;case "blink":return e.blink!==n.blink;case "inverse":return e.inverse!==n.inverse;case "transparent":return e.transparent!==n.transparent;default:return false}}function os(e,t){for(let n of t)ge(e,n);}function is(e,t){let n=new Map;for(let r of t)n.set(r,ge(e,r));return n}c();export{Ar as $,un as $a,pi as $b,kn as $c,es as $d,L as A,ro as Aa,y as Ab,Mi as Ac,Ma as Ad,p as B,oo as Ba,Jo as Bb,Oi as Bc,Oa as Bd,lr as C,io as Ca,Yo as Cb,wi as Cc,wa as Cd,cr as D,ao as Da,Go as Db,Li as Dc,La as Dd,De as E,so as Ea,Xo as Eb,zi as Ec,wn as Ed,ur as F,ft as Fa,qo as Fb,Ni as Fc,Na as Fd,fr as G,lo as Ga,$o as Gb,Fi as Gc,Ln as Gd,fe as H,co as Ha,Qo as Hb,Cn as Hc,Ka as Hd,dr as I,uo as Ia,jo as Ib,Ki as Ic,Ua as Id,yr as J,fo as Ja,ei as Jb,xt as Jc,Ha as Jd,pr as K,yo as Ka,gt as Kb,Yi as Kc,Fn as Kd,Pe as L,po as La,ti as Lb,Dn as Lc,Kn as Ld,mr as M,mo as Ma,ni as Mb,Gi as Mc,At as Md,gr as N,ln as Na,Q as Nb,Xi as Nc,Va as Nd,br as O,cn as Oa,ri as Ob,qi as Oc,Za as Od,Er as P,go as Pa,oi as Pb,$i as Pc,Un as Pd,xr as Q,bo as Qa,ii as Qb,Qi as Qc,Ja as Qd,vr as R,ho as Ra,ai as Rb,Pn as Rc,Ya as Rd,Cr as S,Eo as Sa,bn as Sb,ji as Sc,Ga as Sd,Sr as T,xo as Ta,si as Tb,ea as Tc,Xa as Td,Dr as U,vo as Ua,li as Ub,ta as Uc,qa as Ud,Pr as V,Co as Va,ci as Vb,na as Vc,$a as Vd,Ie as W,$ as Wa,hn as Wb,ra as Wc,oe as Wd,nn as X,Do as Xa,ui as Xb,oa as Xc,Bt as Xd,st as Y,Po as Ya,fi as Yb,An as Yc,Tt as Yd,Ae as Z,Io as Za,di as Zb,ia as Zc,Qa as Zd,rn as _,Ao as _a,yi as _b,aa as _c,ge as _d,Gt as a,kr as aa,fn as ab,mi as ac,sa as ad,ts as ae,je as b,Tr as ba,Me as bb,b as bc,la as bd,ns as be,Xt as c,lt as ca,dn as cb,Le as cc,ca as cd,rs as ce,Zn as d,Br as da,yn as db,ze as dc,ua as dd,os as de,Jn as e,an as ea,Oe as eb,f as ec,fa as ed,is as ee,et as f,Rr as fa,Bo as fb,j as fc,da as fd,qt as g,Wr as ga,pn as gb,bi as gc,Bn as gd,$t as h,Mr as ha,we as hb,Ne as hc,ya as hd,Qt as i,ke as ia,mn as ib,hi as ic,Rn as id,Yn as j,sn as ja,Ro as jb,Ei as jc,pa as jd,Gn as k,Or as ka,Wo as kb,xi as kc,ma as kd,Xn as l,wr as la,Mo as lb,vi as lc,_e as ld,tt as m,Lr as ma,Oo as mb,Ci as mc,ba as md,nt as n,Be as na,wo as nb,Si as nc,Dt as nd,W as o,Yr as oa,Lo as ob,xn as oc,ha as od,qn as p,Gr as pa,zo as pb,vn as pc,Ea as pd,rt as q,Xr as qa,No as qb,Di as qc,xa as qd,ot as r,qr as ra,pt as rb,Pi as rc,va as rd,$n as s,$r as sa,mt as sb,Ii as sc,Ca as sd,er as t,Qr as ta,Fo as tb,Ai as tc,Mn as td,tr as u,jr as ua,Ko as ub,ki as uc,Sa as ud,nr as v,eo as va,_o as vb,ne as vc,ka as vd,rr as w,to as wa,Uo as wb,Ti as wc,Ta as wd,or as x,M as xa,Ho as xb,Bi as xc,Ba as xd,ir as y,ut as ya,Vo as yb,pe as yc,Ra as yd,ar as z,no as za,Zo as zb,ht as zc,Wa as zd};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {j,a,f,b as b$1}from'./chunk-K3SX2LY5.js';import {r,c as c$1}from'./chunk-W5OU7Z6J.js';import {n,k}from'./chunk-PXXGH3BV.js';import {z}from'zod';function R(){let e=new Map;function d(r,t,n){let a=e.get(r);a||(a=new Set,e.set(r,a));let s={handler:t,once:n};return a.add(s),()=>{a.delete(s),a.size===0&&e.delete(r);}}let o={on(r,t){return d(r,t,false)},once(r,t){return d(r,t,true)},off(r,t){let n=e.get(r);if(!n)return o;for(let a of n)if(a.handler===t){n.delete(a);break}return n.size===0&&e.delete(r),o},emit(r,t){let n=e.get(r);if(!n||n.size===0)return false;let a=[];for(let s of n)s.handler(t),s.once&&a.push(s);for(let s of a)n.delete(s);return n.size===0&&e.delete(r),true},removeAllListeners(r){return r===void 0?e.clear():e.delete(r),o},listenerCount(r){return e.get(r)?.size??0},eventNames(){return Array.from(e.keys())},hasListeners(r){return o.listenerCount(r)>0}};return o}n();var K=z.object({name:z.string().min(1),components:z.array(z.unknown()).min(1)}),A=z.object({queries:z.array(K),initialCapacity:z.number().int().positive().optional()}),Q=Object.freeze([]),S=Object.freeze([]);function W(e){return k(e,[r,c$1])}var c={type:"bitecs",queryRenderables:W},b=new WeakMap;function H(e={}){return {...c,...e,type:e.type??c.type,queryRenderables:e.queryRenderables??c.queryRenderables}}function B(e,d){b.set(e,d);}function C(e){return b.get(e)??c}function N(e){b.delete(e);}function E(e,d,o){return {name:e,components:d,store:a(o),handleMap:new Map}}function h(e,d){let o=k(d,[...e.components]),{store:r,handleMap:t}=e,n=new Set;for(let s of o)n.add(s);let a=j(r);for(let s=r.size-1;s>=0;s--){let i=a[s];if(i===void 0||n.has(i))continue;let y=t.get(i);y&&(f(r,y),t.delete(i));}for(let s of o){let i=s;if(t.has(i))continue;let y=b$1(r,i);t.set(i,y);}}function v(e){let d=j(e.store),o=[];for(let r=0;r<e.store.size;r++){let t=d[r];t!==void 0&&o.push(t);}return o}function U(e){A.parse(e);let d=e.initialCapacity??64,o=new Map;for(let t of e.queries)o.set(t.name,E(t.name,t.components,d));o.has("renderables")||o.set("renderables",E("renderables",[r,c$1],d));let r$1=Object.freeze([...o.keys()]);return {type:"custom",queryRenderables(t){let n=o.get("renderables");return n?v(n):Q},queryByName(t,n){let a=o.get(t);if(a)return v(a)},sync(t){for(let n of o.values())h(n,t);},getQueryData(t){let n=o.get(t);return n?j(n.store):S},getQuerySize(t){let n=o.get(t);return n?n.store.size:0},getRegisteredQueries(){return r$1}}}function _(e){return "sync"in e&&"getQueryData"in e&&"getQuerySize"in e&&"getRegisteredQueries"in e}export{R as a,K as b,A as c,c as d,H as e,B as f,C as g,N as h,U as i,_ as j};
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { E as Entity, W as World } from './types-BcsvoKzf.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Memory-efficient component storage utilities.
|
|
5
|
+
*
|
|
6
|
+
* Provides helpers for measuring, optimizing, and managing memory
|
|
7
|
+
* for large entity counts. Includes sparse storage for rarely-used
|
|
8
|
+
* components and memory pool pre-allocation.
|
|
9
|
+
*
|
|
10
|
+
* @module utils/componentStorage
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Memory usage report for component storage.
|
|
15
|
+
*/
|
|
16
|
+
interface ComponentMemoryReport {
|
|
17
|
+
/** Total bytes used by all components */
|
|
18
|
+
readonly totalBytes: number;
|
|
19
|
+
/** Per-component byte usage */
|
|
20
|
+
readonly componentBytes: ReadonlyMap<string, number>;
|
|
21
|
+
/** Number of entities tracked */
|
|
22
|
+
readonly entityCount: number;
|
|
23
|
+
/** Average bytes per entity */
|
|
24
|
+
readonly avgBytesPerEntity: number;
|
|
25
|
+
/** Memory efficiency ratio (used / allocated) */
|
|
26
|
+
readonly efficiency: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Configuration for sparse component storage.
|
|
30
|
+
*/
|
|
31
|
+
interface SparseStorageConfig {
|
|
32
|
+
/** Initial capacity (default: 64) */
|
|
33
|
+
readonly initialCapacity: number;
|
|
34
|
+
/** Growth factor when expanding (default: 2) */
|
|
35
|
+
readonly growthFactor: number;
|
|
36
|
+
/** Maximum capacity before warning (default: 100000) */
|
|
37
|
+
readonly maxCapacity: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A sparse component store using Map for memory efficiency.
|
|
41
|
+
* Suitable for components that only a small fraction of entities use.
|
|
42
|
+
*/
|
|
43
|
+
interface SparseStore<T> {
|
|
44
|
+
/** Gets value for an entity */
|
|
45
|
+
get(eid: Entity): T | undefined;
|
|
46
|
+
/** Sets value for an entity */
|
|
47
|
+
set(eid: Entity, value: T): void;
|
|
48
|
+
/** Checks if entity has a value */
|
|
49
|
+
has(eid: Entity): boolean;
|
|
50
|
+
/** Removes value for an entity */
|
|
51
|
+
delete(eid: Entity): boolean;
|
|
52
|
+
/** Number of stored entries */
|
|
53
|
+
readonly size: number;
|
|
54
|
+
/** Iterates over all entries */
|
|
55
|
+
entries(): IterableIterator<[Entity, T]>;
|
|
56
|
+
/** Clears all data */
|
|
57
|
+
clear(): void;
|
|
58
|
+
/** Estimated memory usage in bytes */
|
|
59
|
+
memoryUsage(): number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Pre-allocated typed array pool for SoA components.
|
|
63
|
+
*/
|
|
64
|
+
interface TypedArrayPool {
|
|
65
|
+
/** Allocates a Float32Array from the pool */
|
|
66
|
+
allocateF32(size: number): Float32Array;
|
|
67
|
+
/** Allocates a Uint32Array from the pool */
|
|
68
|
+
allocateU32(size: number): Uint32Array;
|
|
69
|
+
/** Allocates a Uint8Array from the pool */
|
|
70
|
+
allocateU8(size: number): Uint8Array;
|
|
71
|
+
/** Returns an array to the pool */
|
|
72
|
+
release(arr: ArrayBufferView): void;
|
|
73
|
+
/** Total bytes allocated */
|
|
74
|
+
readonly totalAllocated: number;
|
|
75
|
+
/** Total bytes in free pool */
|
|
76
|
+
readonly totalFree: number;
|
|
77
|
+
/** Clears the pool */
|
|
78
|
+
reset(): void;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Configuration for creating a component store.
|
|
82
|
+
*/
|
|
83
|
+
interface ComponentStoreConfig {
|
|
84
|
+
/**
|
|
85
|
+
* When true, the store is backed by a PackedStore for cache-friendly
|
|
86
|
+
* dense iteration via forEach/data(). Use this for stores iterated in
|
|
87
|
+
* hot paths (widget rendering, systems).
|
|
88
|
+
*
|
|
89
|
+
* When false (default), the store is backed by a plain Map for
|
|
90
|
+
* point-lookup access with no iteration overhead.
|
|
91
|
+
*/
|
|
92
|
+
readonly iterable: boolean;
|
|
93
|
+
/** Initial capacity hint for iterable stores (default: 64) */
|
|
94
|
+
readonly initialCapacity?: number;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* A Map-like store that maps Entity to a value of type T.
|
|
98
|
+
*
|
|
99
|
+
* Depending on configuration, the backing store is either:
|
|
100
|
+
* - PackedStore (iterable mode): cache-friendly dense iteration, ideal for hot paths
|
|
101
|
+
* - Map (non-iterable mode): simple point lookups with minimal overhead
|
|
102
|
+
*
|
|
103
|
+
* The API is intentionally Map-compatible so existing `Map<Entity, T>` usage
|
|
104
|
+
* can be migrated with minimal changes.
|
|
105
|
+
*/
|
|
106
|
+
interface ComponentStore<T> {
|
|
107
|
+
/** Gets the value for an entity, or undefined if not present. */
|
|
108
|
+
get(eid: Entity): T | undefined;
|
|
109
|
+
/** Sets (or replaces) the value for an entity. */
|
|
110
|
+
set(eid: Entity, value: T): void;
|
|
111
|
+
/** Returns true if the entity has a value in this store. */
|
|
112
|
+
has(eid: Entity): boolean;
|
|
113
|
+
/** Removes the value for an entity. Returns true if it was present. */
|
|
114
|
+
delete(eid: Entity): boolean;
|
|
115
|
+
/** Number of entities in the store. */
|
|
116
|
+
readonly size: number;
|
|
117
|
+
/** Removes all entries. */
|
|
118
|
+
clear(): void;
|
|
119
|
+
/**
|
|
120
|
+
* Iterates over all entries, calling fn for each.
|
|
121
|
+
* In iterable mode, iteration traverses the dense PackedStore data array
|
|
122
|
+
* for cache-friendly access. In non-iterable mode, iterates the Map.
|
|
123
|
+
*/
|
|
124
|
+
forEach(fn: (value: T, eid: Entity) => void): void;
|
|
125
|
+
/**
|
|
126
|
+
* Returns a readonly view of the dense data array for fastest iteration.
|
|
127
|
+
* Only meaningful in iterable mode. In non-iterable mode, returns an
|
|
128
|
+
* empty frozen array.
|
|
129
|
+
*
|
|
130
|
+
* WARNING: Only elements at indices `0` through `size - 1` are live.
|
|
131
|
+
* Elements beyond `size` are stale leftovers from swap-and-pop removals.
|
|
132
|
+
* Do not modify the array structure (push/pop/splice).
|
|
133
|
+
*/
|
|
134
|
+
data(): readonly T[];
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Creates a component store that maps Entity to a value of type T.
|
|
138
|
+
*
|
|
139
|
+
* Use `iterable: true` for stores that need cache-friendly iteration
|
|
140
|
+
* (backed by PackedStore). Use `iterable: false` (default) for stores
|
|
141
|
+
* that only need point lookups (backed by Map).
|
|
142
|
+
*
|
|
143
|
+
* The Entity-to-PackedHandle mapping is fully internal; callers never
|
|
144
|
+
* touch handles directly.
|
|
145
|
+
*
|
|
146
|
+
* @param config - Store configuration (iterable mode, initial capacity)
|
|
147
|
+
* @returns A new component store
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```typescript
|
|
151
|
+
* import { createComponentStore } from 'blecsd';
|
|
152
|
+
*
|
|
153
|
+
* // Iterable store for hot-path iteration (e.g., rendering)
|
|
154
|
+
* interface TabData { label: string; active: boolean; }
|
|
155
|
+
* const tabStore = createComponentStore<TabData>({ iterable: true });
|
|
156
|
+
* tabStore.set(eid, { label: 'Home', active: true });
|
|
157
|
+
* tabStore.forEach((data, eid) => {
|
|
158
|
+
* // Dense iteration backed by PackedStore
|
|
159
|
+
* });
|
|
160
|
+
*
|
|
161
|
+
* // Non-iterable store for point lookups (e.g., callbacks, config)
|
|
162
|
+
* const callbacks = createComponentStore<() => void>({ iterable: false });
|
|
163
|
+
* callbacks.set(eid, () => console.log('clicked'));
|
|
164
|
+
* const cb = callbacks.get(eid);
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
declare function createComponentStore<T>(config?: ComponentStoreConfig): ComponentStore<T>;
|
|
168
|
+
/**
|
|
169
|
+
* Creates a sparse component store backed by a Map.
|
|
170
|
+
* Ideal for components present on <10% of entities.
|
|
171
|
+
*
|
|
172
|
+
* @param _config - Optional configuration
|
|
173
|
+
* @returns A new sparse store
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```typescript
|
|
177
|
+
* import { createSparseStore } from 'blecsd';
|
|
178
|
+
*
|
|
179
|
+
* const debugInfo = createSparseStore<{ label: string }>();
|
|
180
|
+
* debugInfo.set(eid, { label: 'Player' });
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
declare function createSparseStore<T>(_config?: Partial<SparseStorageConfig>): SparseStore<T>;
|
|
184
|
+
/**
|
|
185
|
+
* Creates a typed array pool for pre-allocation.
|
|
186
|
+
* Reduces GC pressure from repeated allocation of component arrays.
|
|
187
|
+
*
|
|
188
|
+
* @returns A new typed array pool
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```typescript
|
|
192
|
+
* import { createTypedArrayPool } from 'blecsd';
|
|
193
|
+
*
|
|
194
|
+
* const pool = createTypedArrayPool();
|
|
195
|
+
* const positions = pool.allocateF32(10000); // Pre-allocate for 10K entities
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
declare function createTypedArrayPool(): TypedArrayPool;
|
|
199
|
+
/**
|
|
200
|
+
* Estimates memory usage for a given entity count with standard components.
|
|
201
|
+
*
|
|
202
|
+
* @param entityCount - Number of entities to estimate for
|
|
203
|
+
* @param componentCount - Average number of components per entity
|
|
204
|
+
* @param bytesPerComponent - Average bytes per component field (default: 4 for f32)
|
|
205
|
+
* @param fieldsPerComponent - Average fields per component (default: 4)
|
|
206
|
+
* @returns Estimated memory in bytes
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* ```typescript
|
|
210
|
+
* import { estimateMemoryUsage } from 'blecsd';
|
|
211
|
+
*
|
|
212
|
+
* const bytes = estimateMemoryUsage(100000, 5);
|
|
213
|
+
* console.log(`~${(bytes / 1024 / 1024).toFixed(1)}MB for 100K entities`);
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
declare function estimateMemoryUsage(entityCount: number, componentCount: number, bytesPerComponent?: number, fieldsPerComponent?: number): number;
|
|
217
|
+
/**
|
|
218
|
+
* Generates a component memory report.
|
|
219
|
+
*
|
|
220
|
+
* @param world - The ECS world
|
|
221
|
+
* @param components - Named components to measure
|
|
222
|
+
* @returns Memory report
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```typescript
|
|
226
|
+
* import { getComponentMemoryReport, Position, Velocity } from 'blecsd';
|
|
227
|
+
*
|
|
228
|
+
* const report = getComponentMemoryReport(world, {
|
|
229
|
+
* Position: Position,
|
|
230
|
+
* Velocity: Velocity,
|
|
231
|
+
* });
|
|
232
|
+
* console.log(`Total: ${report.totalBytes} bytes`);
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
235
|
+
declare function getComponentMemoryReport(_world: World, components: Record<string, Record<string, ArrayLike<number>>>): ComponentMemoryReport;
|
|
236
|
+
/**
|
|
237
|
+
* Checks if entity count is within safe memory bounds.
|
|
238
|
+
*
|
|
239
|
+
* @param entityCount - Current entity count
|
|
240
|
+
* @param maxMemoryMB - Maximum memory in MB (default: 100)
|
|
241
|
+
* @param avgComponentsPerEntity - Average components per entity (default: 5)
|
|
242
|
+
* @returns Whether the entity count is within bounds
|
|
243
|
+
*/
|
|
244
|
+
declare function isWithinMemoryBounds(entityCount: number, maxMemoryMB?: number, avgComponentsPerEntity?: number): boolean;
|
|
245
|
+
|
|
246
|
+
export { type ComponentMemoryReport as C, type SparseStorageConfig as S, type TypedArrayPool as T, type ComponentStore as a, type ComponentStoreConfig as b, type SparseStore as c, createComponentStore as d, createSparseStore as e, createTypedArrayPool as f, estimateMemoryUsage as g, getComponentMemoryReport as h, isWithinMemoryBounds as i };
|
|
@@ -2,7 +2,7 @@ import { W as World, E as Entity } from '../types-BcsvoKzf.js';
|
|
|
2
2
|
export { B as BORDER_ASCII, a as BORDER_BOLD, b as BORDER_DOUBLE, c as BORDER_ROUNDED, d as BORDER_SINGLE, e as Border, f as BorderCharset, g as BorderData, h as BorderOptions, i as BorderType, D as DEFAULT_BORDER_BG, j as DEFAULT_BORDER_FG, k as disableAllBorders, l as enableAllBorders, m as getBorder, n as getBorderChar, o as hasBorder, p as hasBorderVisible, s as setBorder, q as setBorderChars } from '../border-D_Jb4ZJV.js';
|
|
3
3
|
import { cG as StateMachineConfig, cH as StateMachine } from '../virtualViewport-Dx2iJliO.js';
|
|
4
4
|
export { C as CellAlign, D as DEFAULT_CELL_BG, a as DEFAULT_CELL_FG, b as DEFAULT_DISABLED_FG, c as DEFAULT_HEADER_BG, d as DEFAULT_HEADER_FG, e as DEFAULT_ITEM_BG, f as DEFAULT_ITEM_FG, g as DEFAULT_SCROLLBACK_LINES, h as DEFAULT_SELECTED_BG, i as DEFAULT_SELECTED_FG, j as DEFAULT_SELECTED_PREFIX, k as DEFAULT_TABLE_BORDER_BG, l as DEFAULT_TABLE_BORDER_FG, m as DEFAULT_TERMINAL_HEIGHT, n as DEFAULT_TERMINAL_WIDTH, o as DEFAULT_UNSELECTED_PREFIX, L as LIST_STATE_MACHINE_CONFIG, p as ListAction, q as ListDisplay, r as ListDisplayOptions, s as ListEvent, t as ListItem, u as ListLazyLoadCallback, v as ListScrollCallback, w as ListScrollInfo, x as ListSelectCallback, y as ListState, z as ListStore, S as ScrollInfoSchema, A as ScrollPercentage, B as ScrollPosition, E as Scrollable, F as ScrollableData, G as ScrollableOptions, H as ScrollbarVisibility, T as Table, I as TableCell, J as TableColumn, K as TableData, M as TableDisplay, N as TableDisplayOptions, O as TableRow, P as TableStore, Q as TerminalBuffer, R as TerminalBufferConfig, U as TerminalBufferConfigSchema, V as TerminalCursorShape, W as TerminalState, X as VirtualViewport, Y as VirtualViewportData, Z as VirtualViewportOptions, _ as VirtualViewportOptionsSchema, $ as VirtualViewportScrollInfo, a0 as VisibleRange, a1 as VisibleRangeSchema, a2 as activateSelected, a3 as addItem, a4 as appendItems, a5 as appendRow, a6 as appendToSearchQuery, a7 as attachListBehavior, a8 as attachTableBehavior, a9 as backspaceSearchQuery, aa as blurList, ab as calculateColumnWidths, ac as canScroll, ad as checkNeedsLoad, ae as clearData, af as clearItems, ag as clearLazyLoadCallback, ah as clearListCallbacks, ai as clearListDisplay, aj as clearListSelection, ak as clearSearchQuery, al as clearTableDisplay, am as clearTerminal, an as clearViewportDirty, ao as detachTableBehavior, ap as disableList, aq as enableList, ar as endListSearch, as as ensureCursorVisible, at as ensureVisible, au as findAndSelectByText, av as findNextMatch, aw as focusList, cI as getCell, ax as getCellPadding, ay as getCellValue, az as getColCount, aA as getColumn, aB as getColumns, aC as getCursorLine, aD as getData, aE as getDataAsStrings, aF as getDataRows, aG as getFirstVisible, aH as getHeaderRowCount, aI as getHeaderRows, aJ as getItem, aK as getItemCount, aL as getItems, aM as getLazyLoadCallback, aN as getListDisplay, aO as getListSearchQuery, aP as getListSelectedIndex, aQ as getListState, aR as getLoadingPlaceholder, aS as getRow, aT as getRowCount, aU as getScroll, aV as getScrollInfo, aW as getScrollPercentage, aX as getScrollable, aY as getSelectedItem, aZ as getSelectedLine, a_ as getTableDisplay, a$ as getTerminalBuffer, b0 as getTerminalCells, b1 as getTerminalState, b2 as getTotalCount, b3 as getVirtualScrollInfo, b4 as getVirtualViewport, b5 as getVisibleCount, b6 as getVisibleItems, b7 as getVisibleRange, b8 as handleListKeyPress, b9 as hasCellBorders, ba as hasScrollable, bb as hasTerminalBuffer, bc as hasVirtualViewport, bd as insertRow, be as invalidateViewport, bf as isAtBottom, bg as isAtTop, bh as isLineInRenderRange, bi as isLineVisible, bj as isList, bk as isListDisabled, bl as isListFocused, bm as isListInState, bn as isListInteractive, bo as isListKeysEnabled, bp as isListLoading, bq as isListMouseEnabled, br as isListSearchEnabled, bs as isListSearching, bt as isTable, bu as isViewportDirty, bv as listStore, bw as loadItems, bx as moveViewportCursor, by as onListActivate, bz as onListScroll, bA as onListSearchChange, bB as onListSelect, bC as removeItem, bD as removeRow, bE as removeTerminalBuffer, bF as renderListItems, bG as renderTableLines, bH as renderTerminalToAnsi, bI as resetListStore, bJ as resetTableStore, bK as resetTerminal, bL as resetTerminalBufferStore, bM as resizeTerminalBuffer, bN as scrollBy, bO as scrollByLines, bP as scrollByPages, bQ as scrollPage, bR as scrollTerminalDown, bS as scrollTerminalToBottom, bT as scrollTerminalToTop, bU as scrollTerminalUp, bV as scrollTo, bW as scrollToBottom, bX as scrollToLine, bY as scrollToTop, bZ as scrollViewportToBottom, b_ as scrollViewportToTop, b$ as selectByValue, c0 as selectFirst, c1 as selectLast, c2 as selectNext, c3 as selectPrev, c4 as sendListEvent, cJ as setCell, c5 as setCellBorders, c6 as setCellPadding, c7 as setCursorLine, c8 as setCursorPosition, cK as setCursorVisible, c9 as setData, ca as setFirstVisible, cb as setHeaderRowCount, cc as setHeaders, cd as setItems, ce as setLazyLoadCallback, cf as setListDisplay, cg as setListInteractive, ch as setListKeys, ci as setListLoading, cj as setListMouse, ck as setListSearchEnabled, cl as setListSearchQuery, cm as setListSelectedIndex, cn as setLoadingPlaceholder, co as setOverscan, cp as setScroll, cq as setScrollSize, cr as setScrollable, cs as setScrollbarVisibility, ct as setSelectedLine, cu as setTableDisplay, cv as setTerminalBuffer, cw as setTotalCount, cx as setTotalLineCount, cy as setViewportStart, cz as setVirtualViewport, cA as setVisibleCount, cB as setVisibleLineCount, cC as startListSearch, cD as tableStore, cE as updateItem, cL as writeChar, cF as writeToTerminal } from '../virtualViewport-Dx2iJliO.js';
|
|
5
|
-
export { A as AABB, C as Collider, a as ColliderData, b as ColliderOptions, c as ColliderType, d as CollisionPair, D as DEFAULT_LAYER, e as DEFAULT_MASK, E as EMPTY_TILE, f as EmitterAppearance, g as EmitterData, h as EmitterOptions, P as Particle, i as ParticleData, j as ParticleEmitter, k as ParticleOptions, R as RenderedTileCell, T as TileDefinition, l as TileMap, m as TileMapComponentData, n as TileMapData, o as TileMapLayer, p as TileMapOptions, q as TilesetData, r as TilesetOptions, s as
|
|
5
|
+
export { A as AABB, C as Collider, a as ColliderData, b as ColliderOptions, c as ColliderType, d as CollisionPair, D as DEFAULT_LAYER, e as DEFAULT_MASK, E as EMPTY_TILE, f as EmitterAppearance, g as EmitterData, h as EmitterOptions, P as Particle, i as ParticleData, j as ParticleEmitter, k as ParticleOptions, R as RenderedTileCell, T as TileDefinition, l as TileMap, m as TileMapComponentData, n as TileMapData, o as TileMapLayer, p as TileMapOptions, q as TilesetData, r as TilesetOptions, s as TrackedParticle, t as activateEmitter, u as addLayer, v as canLayersCollide, w as collisionPairKey, x as createCollisionPair, y as createTileData, z as fillTileRect, B as fillTiles, F as getCollider, G as getColliderAABB, H as getEmitter, I as getEmitterAppearance, J as getEmitterParticles, K as getLayerCount, L as getParticle, M as getParticleColor, N as getParticleProgress, O as getParticleTrackingStore, Q as getTile, S as getTileData, U as getTileMap, V as getTileMapDataId, W as getTileset, X as getTilesetByName, Y as hasCollider, Z as hasEmitter, _ as hasParticle, $ as hasTileMap, a0 as interpolateColor, a1 as isEmitterActive, a2 as isLayerVisible, a3 as isParticleDead, a4 as isTrigger, a5 as pauseEmitter, a6 as registerTileset, a7 as removeCollider, a8 as removeEmitter, a9 as removeParticle, aa as removeTileData, ab as removeTileMap, ac as renderTileMapArea, ad as resetParticleStore, ae as resetTileMapStore, af as resetTilesetStore, ag as setCollider, ah as setCollisionLayer, ai as setCollisionMask, aj as setEmitter, ak as setEmitterAppearance, al as setEmitterGravity, am as setEmitterRate, an as setEmitterSpeed, ao as setLayerVisible, ap as setParticle, aq as setTile, ar as setTileMap, as as setTrigger, at as testAABBOverlap, au as testCircleAABBOverlap, av as testCircleOverlap, aw as testCollision, ax as tileMapStore, ay as tilesetStore, az as trackParticle, aA as unregisterTileset, aB as untrackParticle } from '../tilemap-j0twN9-y.js';
|
|
6
6
|
export { D as DEFAULT_BG, a as DEFAULT_FG, R as Renderable, b as RenderableData, S as StyleData, c as StyleOptions, g as getRenderable, d as getStyle, h as hasRenderable, e as hide, i as isDetached, f as isDirty, j as isEffectivelyVisible, k as isVisible, m as markClean, l as markDirty, s as setStyle, n as setVisible, o as show, t as toggle } from '../renderable-jTMOA-GK.js';
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
import { V as VirtualizedLineStore } from '../virtualizedLineStore-DwPEvPkk.js';
|
|
@@ -11,6 +11,7 @@ import 'bitecs';
|
|
|
11
11
|
import '../parser-iMHmQuUh.js';
|
|
12
12
|
import '../cell-DwIu2ryP.js';
|
|
13
13
|
import '../virtualScrollback-DvZTRU8a.js';
|
|
14
|
+
import '../packedStore-480t2X74.js';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Animation component for sprite animation control.
|